From: support Date: Thu, 2 Feb 2023 09:17:30 +0000 (+0000) Subject: Built motion from commit f25620e4.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=208470f4e946abf9d47b493ca1621f286258e0b0;p=motion2.git Built motion from commit f25620e4.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 85993ff..b7a017c 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.29", + "version": "2.6.30", "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": "2023-01-31T15:33:32.967Z", + "time": "2023-02-02T09:08:11.555Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 059f7fd..f55c105 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.29", + "version": "2.6.30", "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": "2023-01-31T15:33:32.967Z", + "time": "2023-02-02T09:08:11.555Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 1dcd4ac..79d1d28 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.29", + "version": "2.6.30", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index b794227..83cf024 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.29", + "version": "2.6.30", "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 b463060..c1e79c0 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 _0x2c37=['getDataValue','STRING','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','exports'];(function(_0x220e9a,_0x1ff765){var _0x1f4494=function(_0x4d72fc){while(--_0x4d72fc){_0x220e9a['push'](_0x220e9a['shift']());}};_0x1f4494(++_0x1ff765);}(_0x2c37,0x175));var _0x72c3=function(_0x46b8dc,_0x3cb8b6){_0x46b8dc=_0x46b8dc-0x0;var _0x15625e=_0x2c37[_0x46b8dc];return _0x15625e;};'use strict';var Sequelize=require('sequelize');module[_0x72c3('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5cefa3){return this[_0x72c3('0x1')]('action');}},'action':{'type':Sequelize[_0x72c3('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x72c3('0x3'),_0x72c3('0x4'),_0x72c3('0x5'),_0x72c3('0x6'),'browser',_0x72c3('0x7'),_0x72c3('0x8')]],'msg':_0x72c3('0x9')}},'comment':_0x72c3('0x9')},'data1':{'type':Sequelize[_0x72c3('0x2')](0x1000),'comment':_0x72c3('0xa')},'data2':{'type':Sequelize[_0x72c3('0x2')](0x1000),'comment':_0x72c3('0xb')},'data3':{'type':Sequelize[_0x72c3('0x2')](0x1000),'comment':_0x72c3('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x72c3('0xd')},'data5':{'type':Sequelize[_0x72c3('0x2')](0x1000),'comments':_0x72c3('0xe')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x72c3('0xf')],'comments':_0x72c3('0x10')}}; \ No newline at end of file +var _0xe86b=['browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','action','STRING','integration','jscripty','urlForward'];(function(_0x420fab,_0x362358){var _0xe66988=function(_0x3c2a6f){while(--_0x3c2a6f){_0x420fab['push'](_0x420fab['shift']());}};_0xe66988(++_0x362358);}(_0xe86b,0x173));var _0xbe86=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe86b[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xbe86('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe86('0x1')],'get':function(_0x1b02a6){return this['getDataValue'](_0xbe86('0x2'));}},'action':{'type':Sequelize[_0xbe86('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0xbe86('0x4'),'motionbar',_0xbe86('0x5'),_0xbe86('0x6'),_0xbe86('0x7'),_0xbe86('0x8'),_0xbe86('0x9')]],'msg':_0xbe86('0xa')}},'comment':_0xbe86('0xa')},'data1':{'type':Sequelize[_0xbe86('0x3')](0x1000),'comment':_0xbe86('0xb')},'data2':{'type':Sequelize[_0xbe86('0x3')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0xbe86('0x3')](0x1000),'comment':_0xbe86('0xc')},'data4':{'type':Sequelize[_0xbe86('0x3')](0x1000),'comments':_0xbe86('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0xbe86('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0xbe86('0xf')},'data7':{'type':Sequelize[_0xbe86('0x10')],'comments':_0xbe86('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 8908828..78e717e 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 _0x6934=['offset','set','Content-Range','reject','update','then','destroy','error','stack','name','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','count'];(function(_0x10e45f,_0x1390dc){var _0x48c4a6=function(_0x364469){while(--_0x364469){_0x10e45f['push'](_0x10e45f['shift']());}};_0x48c4a6(++_0x1390dc);}(_0x6934,0xeb));var _0x4693=function(_0x1222ed,_0x5431c2){_0x1222ed=_0x1222ed-0x0;var _0x542a51=_0x6934[_0x1222ed];return _0x542a51;};'use strict';var emlformat=require(_0x4693('0x0'));var rimraf=require(_0x4693('0x1'));var zipdir=require(_0x4693('0x2'));var jsonpatch=require(_0x4693('0x3'));var rp=require(_0x4693('0x4'));var moment=require('moment');var BPromise=require(_0x4693('0x5'));var Mustache=require(_0x4693('0x6'));var util=require(_0x4693('0x7'));var path=require(_0x4693('0x8'));var sox=require('sox');var csv=require(_0x4693('0x9'));var ejs=require(_0x4693('0xa'));var fs=require('fs');var fs_extra=require(_0x4693('0xb'));var _=require(_0x4693('0xc'));var squel=require(_0x4693('0xd'));var crypto=require('crypto');var jsforce=require(_0x4693('0xe'));var deskjs=require(_0x4693('0xf'));var toCsv=require(_0x4693('0x9'));var querystring=require(_0x4693('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4693('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4693('0x12'))(_0x4693('0x13'));var utils=require(_0x4693('0x14'));var config=require(_0x4693('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf64b1b,_0x29ad52){_0x29ad52=_0x29ad52||0xcc;return function(_0x129612){if(_0x129612){return _0xf64b1b[_0x4693('0x16')](_0x29ad52);}return _0xf64b1b[_0x4693('0x17')](_0x29ad52)[_0x4693('0x18')]();};}function respondWithResult(_0x5c199a,_0x37df39){_0x37df39=_0x37df39||0xc8;return function(_0x5906e2){if(_0x5906e2){return _0x5c199a[_0x4693('0x17')](_0x37df39)[_0x4693('0x19')](_0x5906e2);}};}function respondWithFilteredResult(_0x1fdbb9,_0x1a8549){return function(_0x7842a9){if(_0x7842a9){var _0xbd85f3=typeof _0x1a8549['offset']==='undefined'&&typeof _0x1a8549[_0x4693('0x1a')]===_0x4693('0x1b');var _0xeb3b89=_0x7842a9['count'];var _0xbf32ac=_0xbd85f3?0x0:_0x1a8549['offset'];var _0xaf68b3=_0xbd85f3?_0x7842a9[_0x4693('0x1c')]:_0x1a8549[_0x4693('0x1d')]+_0x1a8549[_0x4693('0x1a')];var _0x3041a5;if(_0xaf68b3>=_0xeb3b89){_0xaf68b3=_0xeb3b89;_0x3041a5=0xc8;}else{_0x3041a5=0xce;}_0x1fdbb9['status'](_0x3041a5);return _0x1fdbb9[_0x4693('0x1e')](_0x4693('0x1f'),_0xbf32ac+'-'+_0xaf68b3+'/'+_0xeb3b89)[_0x4693('0x19')](_0x7842a9);}return null;};}function patchUpdates(_0x1105b2){return function(_0x401f7d){try{jsonpatch['apply'](_0x401f7d,_0x1105b2,!![]);}catch(_0x12199c){return BPromise[_0x4693('0x20')](_0x12199c);}return _0x401f7d['save']();};}function saveUpdates(_0x5f5c0b,_0x18fcfb){return function(_0xedf567){if(_0xedf567){return _0xedf567[_0x4693('0x21')](_0x5f5c0b)[_0x4693('0x22')](function(_0x2776b1){return _0x2776b1;});}return null;};}function removeEntity(_0x57a223,_0x4972d2){return function(_0x49665f){if(_0x49665f){return _0x49665f[_0x4693('0x23')]()[_0x4693('0x22')](function(){_0x57a223['status'](0xcc)[_0x4693('0x18')]();});}};}function handleEntityNotFound(_0x5f5697,_0x43a6c0){return function(_0x356ee2){if(!_0x356ee2){_0x5f5697[_0x4693('0x16')](0x194);}return _0x356ee2;};}function handleError(_0x1e4cf9,_0x46f894){_0x46f894=_0x46f894||0x1f4;return function(_0x115114){logger[_0x4693('0x24')](_0x115114[_0x4693('0x25')]);if(_0x115114[_0x4693('0x26')]){delete _0x115114['name'];}_0x1e4cf9['status'](_0x46f894)['send'](_0x115114);};}exports[_0x4693('0x21')]=function(_0x5a6e3c,_0x1de3e3){if(_0x5a6e3c['body']['id']){delete _0x5a6e3c[_0x4693('0x27')]['id'];}return db[_0x4693('0x28')][_0x4693('0x29')]({'where':{'id':_0x5a6e3c[_0x4693('0x2a')]['id']}})[_0x4693('0x22')](handleEntityNotFound(_0x1de3e3,null))[_0x4693('0x22')](saveUpdates(_0x5a6e3c[_0x4693('0x27')],null))[_0x4693('0x22')](respondWithResult(_0x1de3e3,null))[_0x4693('0x2b')](handleError(_0x1de3e3,null));};exports[_0x4693('0x23')]=function(_0x20a88e,_0x1d1039){return db[_0x4693('0x28')][_0x4693('0x29')]({'where':{'id':_0x20a88e[_0x4693('0x2a')]['id']}})[_0x4693('0x22')](handleEntityNotFound(_0x1d1039,null))[_0x4693('0x22')](removeEntity(_0x1d1039,null))[_0x4693('0x2b')](handleError(_0x1d1039,null));}; \ No newline at end of file +var _0x4eb9=['sendStatus','status','end','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','body','find','params','catch','Action','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4eb9,0x1a1));var _0x94eb=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x4eb9[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94eb('0x0'));var zipdir=require(_0x94eb('0x1'));var jsonpatch=require(_0x94eb('0x2'));var rp=require('request-promise');var moment=require(_0x94eb('0x3'));var BPromise=require(_0x94eb('0x4'));var Mustache=require(_0x94eb('0x5'));var util=require(_0x94eb('0x6'));var path=require(_0x94eb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x94eb('0x8'));var fs=require('fs');var fs_extra=require(_0x94eb('0x9'));var _=require(_0x94eb('0xa'));var squel=require(_0x94eb('0xb'));var crypto=require(_0x94eb('0xc'));var jsforce=require(_0x94eb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x94eb('0xe'));var Papa=require(_0x94eb('0xf'));var Redis=require(_0x94eb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x94eb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94eb('0x12'));var logger=require(_0x94eb('0x13'))(_0x94eb('0x14'));var utils=require('../../config/utils');var config=require(_0x94eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x94eb('0x16'))['db'];function respondWithStatusCode(_0x1eb73a,_0x28726e){_0x28726e=_0x28726e||0xcc;return function(_0x545eb4){if(_0x545eb4){return _0x1eb73a[_0x94eb('0x17')](_0x28726e);}return _0x1eb73a[_0x94eb('0x18')](_0x28726e)[_0x94eb('0x19')]();};}function respondWithResult(_0x3c631a,_0x16d1bd){_0x16d1bd=_0x16d1bd||0xc8;return function(_0x3187eb){if(_0x3187eb){return _0x3c631a['status'](_0x16d1bd)['json'](_0x3187eb);}};}function respondWithFilteredResult(_0x5f4770,_0x45a7d8){return function(_0x3be9c3){if(_0x3be9c3){var _0xed2058=typeof _0x45a7d8[_0x94eb('0x1a')]==='undefined'&&typeof _0x45a7d8[_0x94eb('0x1b')]==='undefined';var _0x1704ed=_0x3be9c3[_0x94eb('0x1c')];var _0x3a508d=_0xed2058?0x0:_0x45a7d8[_0x94eb('0x1a')];var _0x1f4d62=_0xed2058?_0x3be9c3['count']:_0x45a7d8[_0x94eb('0x1a')]+_0x45a7d8['limit'];var _0x142d7d;if(_0x1f4d62>=_0x1704ed){_0x1f4d62=_0x1704ed;_0x142d7d=0xc8;}else{_0x142d7d=0xce;}_0x5f4770[_0x94eb('0x18')](_0x142d7d);return _0x5f4770[_0x94eb('0x1d')](_0x94eb('0x1e'),_0x3a508d+'-'+_0x1f4d62+'/'+_0x1704ed)['json'](_0x3be9c3);}return null;};}function patchUpdates(_0xaed0ae){return function(_0x4abb08){try{jsonpatch[_0x94eb('0x1f')](_0x4abb08,_0xaed0ae,!![]);}catch(_0xffb6ff){return BPromise['reject'](_0xffb6ff);}return _0x4abb08[_0x94eb('0x20')]();};}function saveUpdates(_0x5c6ffc,_0x1e968f){return function(_0x4517dc){if(_0x4517dc){return _0x4517dc[_0x94eb('0x21')](_0x5c6ffc)[_0x94eb('0x22')](function(_0x596328){return _0x596328;});}return null;};}function removeEntity(_0x27839b,_0x1e45d9){return function(_0x5862a){if(_0x5862a){return _0x5862a[_0x94eb('0x23')]()['then'](function(){_0x27839b[_0x94eb('0x18')](0xcc)[_0x94eb('0x19')]();});}};}function handleEntityNotFound(_0x175d4d,_0x27388e){return function(_0x2b4c4d){if(!_0x2b4c4d){_0x175d4d[_0x94eb('0x17')](0x194);}return _0x2b4c4d;};}function handleError(_0x1aef78,_0x471ca6){_0x471ca6=_0x471ca6||0x1f4;return function(_0xdf5a4){logger[_0x94eb('0x24')](_0xdf5a4['stack']);if(_0xdf5a4[_0x94eb('0x25')]){delete _0xdf5a4[_0x94eb('0x25')];}_0x1aef78[_0x94eb('0x18')](_0x471ca6)[_0x94eb('0x26')](_0xdf5a4);};}exports[_0x94eb('0x21')]=function(_0x526db5,_0x48f0a5){if(_0x526db5[_0x94eb('0x27')]['id']){delete _0x526db5[_0x94eb('0x27')]['id'];}return db['Action'][_0x94eb('0x28')]({'where':{'id':_0x526db5[_0x94eb('0x29')]['id']}})[_0x94eb('0x22')](handleEntityNotFound(_0x48f0a5,null))[_0x94eb('0x22')](saveUpdates(_0x526db5[_0x94eb('0x27')],null))['then'](respondWithResult(_0x48f0a5,null))[_0x94eb('0x2a')](handleError(_0x48f0a5,null));};exports[_0x94eb('0x23')]=function(_0x310579,_0x5d35b9){return db[_0x94eb('0x2b')][_0x94eb('0x28')]({'where':{'id':_0x310579[_0x94eb('0x29')]['id']}})[_0x94eb('0x22')](handleEntityNotFound(_0x5d35b9,null))[_0x94eb('0x22')](removeEntity(_0x5d35b9,null))[_0x94eb('0x2a')](handleError(_0x5d35b9,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 465e273..f011f13 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 _0xcdd6=['define','Action','tools_actions','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes'];(function(_0x25c5a4,_0x1922b9){var _0x3f191b=function(_0x4931f0){while(--_0x4931f0){_0x25c5a4['push'](_0x25c5a4['shift']());}};_0x3f191b(++_0x1922b9);}(_0xcdd6,0x177));var _0x6cdd=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0xcdd6[_0x56355a];return _0x573afa;};'use strict';var _=require(_0x6cdd('0x0'));var util=require(_0x6cdd('0x1'));var logger=require('../../config/logger')(_0x6cdd('0x2'));var moment=require(_0x6cdd('0x3'));var BPromise=require(_0x6cdd('0x4'));var rp=require(_0x6cdd('0x5'));var fs=require('fs');var path=require(_0x6cdd('0x6'));var rimraf=require('rimraf');var config=require(_0x6cdd('0x7'));var attributes=require(_0x6cdd('0x8'));module['exports']=function(_0x3a1f86,_0x350ad6){return _0x3a1f86[_0x6cdd('0x9')](_0x6cdd('0xa'),attributes,{'tableName':_0x6cdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x482b=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','Action','tools_actions','lodash','util'];(function(_0x1118ad,_0x3db984){var _0x590d28=function(_0x1dfffd){while(--_0x1dfffd){_0x1118ad['push'](_0x1118ad['shift']());}};_0x590d28(++_0x3db984);}(_0x482b,0x12a));var _0xb482=function(_0x451f99,_0x36ead2){_0x451f99=_0x451f99-0x0;var _0x8a8ae7=_0x482b[_0x451f99];return _0x8a8ae7;};'use strict';var _=require(_0xb482('0x0'));var util=require(_0xb482('0x1'));var logger=require(_0xb482('0x2'))('api');var moment=require(_0xb482('0x3'));var BPromise=require('bluebird');var rp=require(_0xb482('0x4'));var fs=require('fs');var path=require(_0xb482('0x5'));var rimraf=require(_0xb482('0x6'));var config=require(_0xb482('0x7'));var attributes=require('./action.attributes');module[_0xb482('0x8')]=function(_0x3a6412,_0x254284){return _0x3a6412[_0xb482('0x9')](_0xb482('0xa'),attributes,{'tableName':_0xb482('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 dc9e3c0..44e980a 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 _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'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')]('Action,\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']('Action,\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);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x65331c,_0x176927){var _0x401e4c=function(_0x191f01){while(--_0x191f01){_0x65331c['push'](_0x65331c['shift']());}};_0x401e4c(++_0x176927);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0x7fbe[_0xaf29da];return _0x295c51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 646fae7..7aa62f5 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 _0x10e5=['update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0xec7ff,_0xff5cba){var _0xc22216=function(_0x376d05){while(--_0x376d05){_0xec7ff['push'](_0xec7ff['shift']());}};_0xc22216(++_0xff5cba);}(_0x10e5,0x1f2));var _0x510e=function(_0x56bcff,_0x158e5f){_0x56bcff=_0x56bcff-0x0;var _0x340351=_0x10e5[_0x56bcff];return _0x340351;};'use strict';var multer=require(_0x510e('0x0'));var util=require(_0x510e('0x1'));var path=require('path');var timeout=require(_0x510e('0x2'));var express=require('express');var router=express[_0x510e('0x3')]();var fs_extra=require(_0x510e('0x4'));var auth=require(_0x510e('0x5'));var interaction=require(_0x510e('0x6'));var config=require(_0x510e('0x7'));var controller=require(_0x510e('0x8'));router[_0x510e('0x9')](_0x510e('0xa'),auth[_0x510e('0xb')](),controller[_0x510e('0xc')]);router[_0x510e('0xd')](_0x510e('0xa'),auth['isAuthenticated'](),controller[_0x510e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1d55=['put','/:id','isAuthenticated','update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller'];(function(_0x2ed55c,_0x146490){var _0x52122b=function(_0x1dc8fd){while(--_0x1dc8fd){_0x2ed55c['push'](_0x2ed55c['shift']());}};_0x52122b(++_0x146490);}(_0x1d55,0x11f));var _0x51d5=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1d55[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51d5('0x0'));var timeout=require('connect-timeout');var express=require(_0x51d5('0x1'));var router=express['Router']();var fs_extra=require(_0x51d5('0x2'));var auth=require(_0x51d5('0x3'));var interaction=require(_0x51d5('0x4'));var config=require(_0x51d5('0x5'));var controller=require(_0x51d5('0x6'));router[_0x51d5('0x7')](_0x51d5('0x8'),auth[_0x51d5('0x9')](),controller[_0x51d5('0xa')]);router[_0x51d5('0xb')](_0x51d5('0x8'),auth[_0x51d5('0x9')](),controller[_0x51d5('0xc')]);module[_0x51d5('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 5aef90b..458a5d4 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x54b313,_0x2540d9){_0x54b313=_0x54b313-0x0;var _0x1a56f5=_0x1cb9[_0x54b313];return _0x1a56f5;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','TEXT'];(function(_0x535250,_0x1127f7){var _0x16ffe8=function(_0x3062dc){while(--_0x3062dc){_0x535250['push'](_0x535250['shift']());}};_0x16ffe8(++_0x1127f7);}(_0x425d,0x1e0));var _0xd425=function(_0xb70791,_0x1d91d6){_0xb70791=_0xb70791-0x0;var _0x48f939=_0x425d[_0xb70791];return _0x48f939;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 7f68d33..bb8e198 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 _0x1b97=['csv','custom','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','runReport','IS\x20NULL','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','function','format','replace','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','left_join','SUM(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','metric','groupBy','DESC','table','output','fullPath','%s-%s.%s','randomstring','generate'];(function(_0x555406,_0x2138d3){var _0x357cf0=function(_0x1e5212){while(--_0x1e5212){_0x555406['push'](_0x555406['shift']());}};_0x357cf0(++_0x2138d3);}(_0x1b97,0x15c));var _0x71b9=function(_0x30df13,_0xa3448c){_0x30df13=_0x30df13-0x0;var _0x225ccb=_0x1b97[_0x30df13];return _0x225ccb;};'use strict';var emlformat=require(_0x71b9('0x0'));var rimraf=require(_0x71b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x71b9('0x2'));var moment=require(_0x71b9('0x3'));var BPromise=require(_0x71b9('0x4'));var Mustache=require('mustache');var util=require(_0x71b9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x71b9('0x6'));var ejs=require(_0x71b9('0x7'));var fs=require('fs');var fs_extra=require(_0x71b9('0x8'));var _=require('lodash');var squel=require(_0x71b9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x71b9('0xa'));var toCsv=require(_0x71b9('0x6'));var querystring=require(_0x71b9('0xb'));var Papa=require(_0x71b9('0xc'));var Redis=require(_0x71b9('0xd'));var authService=require(_0x71b9('0xe'));var qs=require(_0x71b9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x71b9('0x10'));var utils=require(_0x71b9('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x71b9('0x12'));var db=require(_0x71b9('0x13'))['db'];var dbH=require(_0x71b9('0x13'))[_0x71b9('0x14')];function respondWithStatusCode(_0x1d14ca,_0xf312b0){_0xf312b0=_0xf312b0||0xcc;return function(_0x267c70){if(_0x267c70){return _0x1d14ca[_0x71b9('0x15')](_0xf312b0);}return _0x1d14ca[_0x71b9('0x16')](_0xf312b0)['end']();};}function respondWithResult(_0x277573,_0x246c43){_0x246c43=_0x246c43||0xc8;return function(_0x5de31){if(_0x5de31){return _0x277573[_0x71b9('0x16')](_0x246c43)[_0x71b9('0x17')](_0x5de31);}};}function respondWithFilteredResult(_0x5762bc,_0x54324b){return function(_0x338cd7){if(_0x338cd7){var _0x180a39=typeof _0x54324b[_0x71b9('0x18')]===_0x71b9('0x19')&&typeof _0x54324b[_0x71b9('0x1a')]==='undefined';var _0x320147=_0x338cd7[_0x71b9('0x1b')];var _0x35047c=_0x180a39?0x0:_0x54324b[_0x71b9('0x18')];var _0x197d3c=_0x180a39?_0x338cd7['count']:_0x54324b[_0x71b9('0x18')]+_0x54324b['limit'];var _0x123a30;if(_0x197d3c>=_0x320147){_0x197d3c=_0x320147;_0x123a30=0xc8;}else{_0x123a30=0xce;}_0x5762bc[_0x71b9('0x16')](_0x123a30);return _0x5762bc[_0x71b9('0x1c')](_0x71b9('0x1d'),_0x35047c+'-'+_0x197d3c+'/'+_0x320147)[_0x71b9('0x17')](_0x338cd7);}return null;};}function patchUpdates(_0x2976c2){return function(_0x2ea26e){try{jsonpatch[_0x71b9('0x1e')](_0x2ea26e,_0x2976c2,!![]);}catch(_0x1b310c){return BPromise[_0x71b9('0x1f')](_0x1b310c);}return _0x2ea26e[_0x71b9('0x20')]();};}function saveUpdates(_0x5dc884,_0xfd4581){return function(_0x5f32ba){if(_0x5f32ba){return _0x5f32ba[_0x71b9('0x21')](_0x5dc884)[_0x71b9('0x22')](function(_0x425f9c){return _0x425f9c;});}return null;};}function removeEntity(_0x5997d0,_0x2db5a6){return function(_0x208086){if(_0x208086){return _0x208086[_0x71b9('0x23')]()[_0x71b9('0x22')](function(){var _0x22b6f0=_0x208086[_0x71b9('0x24')]({'plain':!![]});var _0x2b5f2b=_0x71b9('0x25');return db[_0x71b9('0x26')][_0x71b9('0x23')]({'where':{'type':_0x2b5f2b,'resourceId':_0x22b6f0['id']}})[_0x71b9('0x22')](function(){return _0x208086;});})['then'](function(){_0x5997d0[_0x71b9('0x16')](0xcc)[_0x71b9('0x27')]();});}};}function handleEntityNotFound(_0x29aa5f,_0x4cf3ea){return function(_0x2abb2c){if(!_0x2abb2c){_0x29aa5f[_0x71b9('0x15')](0x194);}return _0x2abb2c;};}function handleError(_0x7e3c1e,_0x14d26f){_0x14d26f=_0x14d26f||0x1f4;return function(_0x564cb8){logger[_0x71b9('0x28')](_0x564cb8[_0x71b9('0x29')]);if(_0x564cb8[_0x71b9('0x2a')]){delete _0x564cb8[_0x71b9('0x2a')];}_0x7e3c1e[_0x71b9('0x16')](_0x14d26f)[_0x71b9('0x2b')](_0x564cb8);};}exports['index']=function(_0x82f198,_0x22e696){var _0xba3640={},_0x5e6b92={},_0x10f4ba={'count':0x0,'rows':[]};var _0x4b015b=_[_0x71b9('0x2c')](db[_0x71b9('0x2d')][_0x71b9('0x2e')],function(_0x39e4ba){return{'name':_0x39e4ba[_0x71b9('0x2f')],'type':_0x39e4ba[_0x71b9('0x30')][_0x71b9('0x31')]};});_0x5e6b92[_0x71b9('0x32')]=_[_0x71b9('0x2c')](_0x4b015b,_0x71b9('0x2a'));_0x5e6b92[_0x71b9('0x33')]=_['keys'](_0x82f198[_0x71b9('0x33')]);_0x5e6b92['filters']=_[_0x71b9('0x34')](_0x5e6b92['model'],_0x5e6b92[_0x71b9('0x33')]);_0xba3640[_0x71b9('0x35')]=_[_0x71b9('0x34')](_0x5e6b92['model'],qs[_0x71b9('0x36')](_0x82f198[_0x71b9('0x33')][_0x71b9('0x36')]));_0xba3640[_0x71b9('0x35')]=_0xba3640[_0x71b9('0x35')][_0x71b9('0x37')]?_0xba3640[_0x71b9('0x35')]:_0x5e6b92['model'];if(!_0x82f198[_0x71b9('0x33')]['hasOwnProperty']('nolimit')){_0xba3640['limit']=qs['limit'](_0x82f198[_0x71b9('0x33')][_0x71b9('0x1a')]);_0xba3640['offset']=qs['offset'](_0x82f198[_0x71b9('0x33')][_0x71b9('0x18')]);}_0xba3640[_0x71b9('0x38')]=qs[_0x71b9('0x39')](_0x82f198[_0x71b9('0x33')][_0x71b9('0x39')]);_0xba3640[_0x71b9('0x3a')]=qs['filters'](_[_0x71b9('0x3b')](_0x82f198[_0x71b9('0x33')],_0x5e6b92[_0x71b9('0x3c')]),_0x4b015b);if(_0x82f198['query'][_0x71b9('0x3d')]){_0xba3640[_0x71b9('0x3a')]=_[_0x71b9('0x3e')](_0xba3640[_0x71b9('0x3a')],{'$or':_[_0x71b9('0x2c')](_0x4b015b,function(_0x56d367){if(_0x56d367[_0x71b9('0x30')]!==_0x71b9('0x3f')){var _0x525aa7={};_0x525aa7[_0x56d367['name']]={'$like':'%'+_0x82f198[_0x71b9('0x33')][_0x71b9('0x3d')]+'%'};return _0x525aa7;}})});}_0xba3640=_[_0x71b9('0x3e')]({},_0xba3640,_0x82f198['options']);var _0x1fdfcc={'where':_0xba3640[_0x71b9('0x3a')]};return db['AnalyticCustomReport']['count'](_0x1fdfcc)[_0x71b9('0x22')](function(_0x5245fb){_0x10f4ba['count']=_0x5245fb;if(_0x82f198[_0x71b9('0x33')][_0x71b9('0x40')]){_0xba3640[_0x71b9('0x41')]=[{'all':!![]}];}return db[_0x71b9('0x2d')][_0x71b9('0x42')](_0xba3640);})[_0x71b9('0x22')](function(_0x3ad2f4){_0x10f4ba['rows']=_0x3ad2f4;return _0x10f4ba;})[_0x71b9('0x22')](respondWithFilteredResult(_0x22e696,_0xba3640))[_0x71b9('0x43')](handleError(_0x22e696,null));};exports[_0x71b9('0x44')]=function(_0x4b53fe,_0x2ea5be){var _0x27e483={'raw':![],'where':{'id':_0x4b53fe[_0x71b9('0x45')]['id']}},_0x5f205a={};_0x5f205a[_0x71b9('0x32')]=_[_0x71b9('0x46')](db[_0x71b9('0x2d')][_0x71b9('0x2e')]);_0x5f205a['query']=_[_0x71b9('0x46')](_0x4b53fe[_0x71b9('0x33')]);_0x5f205a[_0x71b9('0x3c')]=_[_0x71b9('0x34')](_0x5f205a[_0x71b9('0x32')],_0x5f205a[_0x71b9('0x33')]);_0x27e483['attributes']=_[_0x71b9('0x34')](_0x5f205a[_0x71b9('0x32')],qs['fields'](_0x4b53fe[_0x71b9('0x33')][_0x71b9('0x36')]));_0x27e483[_0x71b9('0x35')]=_0x27e483[_0x71b9('0x35')][_0x71b9('0x37')]?_0x27e483[_0x71b9('0x35')]:_0x5f205a[_0x71b9('0x32')];if(_0x4b53fe['query'][_0x71b9('0x40')]){_0x27e483['include']=[{'all':!![]}];}_0x27e483=_['merge']({},_0x27e483,_0x4b53fe[_0x71b9('0x47')]);return db[_0x71b9('0x2d')][_0x71b9('0x48')](_0x27e483)[_0x71b9('0x22')](handleEntityNotFound(_0x2ea5be,null))[_0x71b9('0x22')](respondWithResult(_0x2ea5be,null))[_0x71b9('0x43')](handleError(_0x2ea5be,null));};exports[_0x71b9('0x49')]=function(_0x130280,_0x4c80c0){return db['AnalyticCustomReport'][_0x71b9('0x49')](_0x130280[_0x71b9('0x4a')],{})[_0x71b9('0x22')](function(_0xd4f351){var _0x171814=_0x130280['user'][_0x71b9('0x24')]({'plain':!![]});if(!_0x171814)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x171814[_0x71b9('0x4b')]===_0x71b9('0x4c')){var _0x469fe9=_0xd4f351['get']({'plain':!![]});var _0xd4154d='Reports';return db[_0x71b9('0x4d')][_0x71b9('0x48')]({'where':{'name':_0xd4154d,'userProfileId':_0x171814[_0x71b9('0x4e')]},'raw':!![]})[_0x71b9('0x22')](function(_0x14ec7b){if(_0x14ec7b&&_0x14ec7b[_0x71b9('0x4f')]===0x0){return db['UserProfileResource'][_0x71b9('0x49')]({'name':_0x469fe9[_0x71b9('0x2a')],'resourceId':_0x469fe9['id'],'type':'CustomReports','sectionId':_0x14ec7b['id']},{})[_0x71b9('0x22')](function(){return _0xd4f351;});}else{return _0xd4f351;}})[_0x71b9('0x43')](function(_0x2a37d6){logger[_0x71b9('0x28')](_0x71b9('0x50'),_0x2a37d6);throw _0x2a37d6;});}return _0xd4f351;})[_0x71b9('0x22')](respondWithResult(_0x4c80c0,0xc9))['catch'](handleError(_0x4c80c0,null));};exports[_0x71b9('0x21')]=function(_0x4fe2a1,_0x23f400){if(_0x4fe2a1['body']['id']){delete _0x4fe2a1[_0x71b9('0x4a')]['id'];}return db[_0x71b9('0x2d')][_0x71b9('0x48')]({'where':{'id':_0x4fe2a1['params']['id']}})['then'](handleEntityNotFound(_0x23f400,null))['then'](saveUpdates(_0x4fe2a1['body'],null))[_0x71b9('0x22')](respondWithResult(_0x23f400,null))[_0x71b9('0x43')](handleError(_0x23f400,null));};exports[_0x71b9('0x23')]=function(_0x4fd549,_0x21ab5a){return db[_0x71b9('0x2d')][_0x71b9('0x48')]({'where':{'id':_0x4fd549[_0x71b9('0x45')]['id']}})[_0x71b9('0x22')](handleEntityNotFound(_0x21ab5a,null))[_0x71b9('0x22')](removeEntity(_0x21ab5a,null))['catch'](handleError(_0x21ab5a,null));};exports[_0x71b9('0x51')]=function(_0x1443d4,_0xbe390d){var _0x40378b=0xa;var _0x55e11d=[_0x71b9('0x52'),'left_join','right_join',_0x71b9('0x53')];var _0x104b3c={'SUM':'SUM(%s)','COUNT':_0x71b9('0x54'),'COUNT DISTINCT':_0x71b9('0x55'),'MAX':_0x71b9('0x56'),'MIN':'MIN(%s)','AVG':_0x71b9('0x57'),'GROUP_CONCAT':_0x71b9('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x71b9('0x59')};var _0x2159e5={'SEC_TO_TIME':_0x71b9('0x5a'),'DATE':_0x71b9('0x5b'),'HOUR':_0x71b9('0x5c'),'ROUND':_0x71b9('0x5d'),'UNIX_TIMESTAMP':_0x71b9('0x5e')};var _0x58d139=function(_0x5891ca){return!_[_0x71b9('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x71b9('0x60'),_0x71b9('0x61')],_0x5891ca);};var _0x48bf83=function(_0x20104b){if(!_0x20104b||!_0x20104b[_0x71b9('0x62')][_0x71b9('0x37')]){return'';}for(var _0x2044e8='(',_0x58d87d=0x0;_0x58d87d<_0x20104b[_0x71b9('0x62')]['length'];_0x58d87d+=0x1){_0x58d87d>0x0&&(_0x2044e8+='\x20'+_0x20104b[_0x71b9('0x63')]+'\x20');_0x2044e8+=_0x20104b[_0x71b9('0x62')][_0x58d87d][_0x71b9('0x64')]?_0x48bf83(_0x20104b[_0x71b9('0x62')][_0x58d87d][_0x71b9('0x64')]):_0x20104b[_0x71b9('0x62')][_0x58d87d][_0x71b9('0x65')]+'\x20'+_0x20104b[_0x71b9('0x62')][_0x58d87d][_0x71b9('0x66')]+(_0x58d139(_0x20104b[_0x71b9('0x62')][_0x58d87d][_0x71b9('0x66')])?'\x20'+_0x20104b[_0x71b9('0x62')][_0x58d87d][_0x71b9('0x67')]:'');}return _0x2044e8+')';};var _0x274960={'where':{'id':_0x1443d4[_0x71b9('0x45')]['id']}},_0x253355,_0x1cb7ea,_0x2b8dd0,_0xd617d,_0x5bd54f;_0x274960=_[_0x71b9('0x3e')]({},_0x274960,_0x1443d4[_0x71b9('0x47')]);return db[_0x71b9('0x2d')][_0x71b9('0x48')](_0x274960)[_0x71b9('0x22')](function(_0x1df830){if(_0x1df830){_0x253355=_0x1df830;return _0x1df830[_0x71b9('0x68')]();}return null;})[_0x71b9('0x22')](function(_0x4131b9){if(_0x4131b9){if(!_0x4131b9['length']){throw new db[(_0x71b9('0x69'))][(_0x71b9('0x6a'))](_0x71b9('0x6b'),0x193);}_0x1cb7ea=_0x4131b9;return db[_0x71b9('0x6c')][_0x71b9('0x42')]({'raw':!![]});}return null;})['then'](function(_0x346bef){if(_0x346bef){_0x2b8dd0=_[_0x71b9('0x6d')](_0x346bef,'id');var _0x5c979c;var _0x319db6=squel[_0x71b9('0x6e')]();_0x319db6[_0x71b9('0x6f')](_0x253355['table']);for(var _0x139184=0x0;_0x139184<_0x1cb7ea[_0x71b9('0x37')];_0x139184+=0x1){_0x5c979c=_0x1cb7ea[_0x139184][_0x71b9('0x70')]?_0x2b8dd0[_0x1cb7ea[_0x139184]['MetricId']]['metric']:_0x1cb7ea[_0x139184][_0x71b9('0x65')];_0x5c979c=_0x1cb7ea[_0x139184]['function']?_['replace'](_0x104b3c[_0x1cb7ea[_0x139184][_0x71b9('0x71')]],'%s',_0x5c979c):_0x5c979c;_0x5c979c=_0x1cb7ea[_0x139184][_0x71b9('0x72')]?_[_0x71b9('0x73')](_0x2159e5[_0x1cb7ea[_0x139184][_0x71b9('0x72')]],'%s',_0x5c979c):_0x5c979c;if(_0x1cb7ea[_0x139184]['groupBy']){_0x319db6[_0x71b9('0x64')](_0x5c979c);}_0x1cb7ea[_0x139184][_0x71b9('0x74')]&&_0x319db6[_0x71b9('0x38')](_0x5c979c,_0x1cb7ea[_0x139184][_0x71b9('0x74')]==='DESC'?![]:!![]);_0x319db6[_0x71b9('0x65')](_0x5c979c,_0x1cb7ea[_0x139184][_0x71b9('0x75')]||_0x5c979c);}if(_0x253355['joins']){_0x253355[_0x71b9('0x76')]=JSON[_0x71b9('0x77')](_0x253355[_0x71b9('0x76')]);for(var _0x20a204=0x0;_0x20a204<_0x253355[_0x71b9('0x76')]['length'];_0x20a204+=0x1){if(_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x30')]&&_[_0x71b9('0x5f')](_0x55e11d,_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x30')])&&_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x78')]&&_0x253355[_0x71b9('0x76')][_0x20a204]['foreignTable']&&_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x79')]){_0x319db6[_0x253355['joins'][_0x20a204]['type']](_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x7a')],null,util['format'](_0x71b9('0x7b'),_0x253355['table'],_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x78')],_0x253355[_0x71b9('0x76')][_0x20a204][_0x71b9('0x7a')],_0x253355['joins'][_0x20a204][_0x71b9('0x79')]));}}}if(_0x253355[_0x71b9('0x7c')]){_0x253355[_0x71b9('0x7c')]=JSON[_0x71b9('0x77')](_0x253355[_0x71b9('0x7c')]);_0x319db6[_0x71b9('0x3a')](_0x48bf83(_0x253355[_0x71b9('0x7c')]['group']));}_0x5bd54f=_0x319db6[_0x71b9('0x7d')]();_0x319db6[_0x71b9('0x1a')](_0x40378b);_0x319db6[_0x71b9('0x18')](0x0);logger[_0x71b9('0x7e')](_0x71b9('0x7f'),_0x319db6[_0x71b9('0x80')]());return dbH[_0x71b9('0x81')][_0x71b9('0x33')](_0x319db6[_0x71b9('0x80')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});}})[_0x71b9('0x22')](respondWithResult(_0xbe390d,null))[_0x71b9('0x43')](handleError(_0xbe390d,null));};function runReport(_0x55833a,_0x1fb833,_0x299818){var _0x223057=_0x1fb833[_0x71b9('0x2a')];var _0x5b3a36=0xa;var _0x4ca4f8=[_0x71b9('0x52'),_0x71b9('0x82'),'right_join',_0x71b9('0x53')];var _0x4ff832={'SUM':_0x71b9('0x83'),'COUNT':_0x71b9('0x54'),'COUNT DISTINCT':_0x71b9('0x55'),'MAX':_0x71b9('0x56'),'MIN':_0x71b9('0x84'),'AVG':_0x71b9('0x57'),'GROUP_CONCAT':_0x71b9('0x58'),'GROUP_CONCAT ASC':_0x71b9('0x85'),'GROUP_CONCAT DESC':_0x71b9('0x59')};var _0x55c92e={'SEC_TO_TIME':_0x71b9('0x5a'),'DATE':_0x71b9('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x71b9('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x443b18=function(_0x2d6d14){return!_[_0x71b9('0x5f')](['IS\x20NULL',_0x71b9('0x86'),'IS\x20EMPTY',_0x71b9('0x61')],_0x2d6d14);};var _0xc1497e=function(_0x3e271f){if(!_0x3e271f||!_0x3e271f[_0x71b9('0x62')][_0x71b9('0x37')]){return'';}for(var _0x1fc599='(',_0x3906cc=0x0;_0x3906cc<_0x3e271f[_0x71b9('0x62')][_0x71b9('0x37')];_0x3906cc+=0x1){_0x3906cc>0x0&&(_0x1fc599+='\x20'+_0x3e271f[_0x71b9('0x63')]+'\x20');_0x1fc599+=_0x3e271f[_0x71b9('0x62')][_0x3906cc][_0x71b9('0x64')]?_0xc1497e(_0x3e271f[_0x71b9('0x62')][_0x3906cc][_0x71b9('0x64')]):_0x3e271f[_0x71b9('0x62')][_0x3906cc][_0x71b9('0x65')]+'\x20'+_0x3e271f[_0x71b9('0x62')][_0x3906cc][_0x71b9('0x66')]+(_0x443b18(_0x3e271f[_0x71b9('0x62')][_0x3906cc][_0x71b9('0x66')])?'\x20'+_0x3e271f['rules'][_0x3906cc][_0x71b9('0x67')]:'');}return _0x1fc599+')';};var _0x397405={'where':{'id':_0x55833a['id']}},_0x225cb5,_0x2a0860,_0x3510a6,_0x30b0d2,_0x1437d1;_0x397405=_[_0x71b9('0x3e')]({},_0x397405,_0x299818);return db[_0x71b9('0x2d')][_0x71b9('0x48')](_0x397405)['then'](function(_0x164f49){if(_0x164f49){_0x225cb5=_0x164f49;return _0x164f49[_0x71b9('0x68')]();}return null;})['then'](function(_0x39aa16){if(_0x39aa16){if(!_0x39aa16['length']){throw new db[(_0x71b9('0x69'))][(_0x71b9('0x6a'))](_0x71b9('0x6b'),0x193);}_0x2a0860=_0x39aa16;return db[_0x71b9('0x6c')]['findAll']({'raw':!![]});}return null;})[_0x71b9('0x22')](function(_0x12d7f2){if(_0x12d7f2){_0x3510a6=_['keyBy'](_0x12d7f2,'id');var _0x3810b7;var _0x3c6b69=squel['select']();_0x3c6b69[_0x71b9('0x6f')](_0x225cb5['table']);for(var _0x3a4b75=0x0;_0x3a4b75<_0x2a0860[_0x71b9('0x37')];_0x3a4b75+=0x1){_0x3810b7=_0x2a0860[_0x3a4b75][_0x71b9('0x70')]?_0x3510a6[_0x2a0860[_0x3a4b75][_0x71b9('0x70')]][_0x71b9('0x87')]:_0x2a0860[_0x3a4b75][_0x71b9('0x65')];_0x3810b7=_0x2a0860[_0x3a4b75][_0x71b9('0x71')]?_[_0x71b9('0x73')](_0x4ff832[_0x2a0860[_0x3a4b75][_0x71b9('0x71')]],'%s',_0x3810b7):_0x3810b7;_0x3810b7=_0x2a0860[_0x3a4b75][_0x71b9('0x72')]?_['replace'](_0x55c92e[_0x2a0860[_0x3a4b75]['format']],'%s',_0x3810b7):_0x3810b7;if(_0x2a0860[_0x3a4b75][_0x71b9('0x88')]){_0x3c6b69[_0x71b9('0x64')](_0x3810b7);}_0x2a0860[_0x3a4b75]['orderBy']&&_0x3c6b69[_0x71b9('0x38')](_0x3810b7,_0x2a0860[_0x3a4b75][_0x71b9('0x74')]===_0x71b9('0x89')?![]:!![]);_0x3c6b69[_0x71b9('0x65')](_0x3810b7,_0x2a0860[_0x3a4b75][_0x71b9('0x75')]||_0x3810b7);}if(_0x225cb5[_0x71b9('0x76')]){_0x225cb5[_0x71b9('0x76')]=JSON['parse'](_0x225cb5[_0x71b9('0x76')]);for(var _0x48a54d=0x0;_0x48a54d<_0x225cb5[_0x71b9('0x76')][_0x71b9('0x37')];_0x48a54d+=0x1){if(_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x30')]&&_[_0x71b9('0x5f')](_0x4ca4f8,_0x225cb5['joins'][_0x48a54d]['type'])&&_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x78')]&&_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x7a')]&&_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x79')]){_0x3c6b69[_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x30')]](_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x7a')],null,util[_0x71b9('0x72')](_0x71b9('0x7b'),_0x225cb5[_0x71b9('0x8a')],_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x78')],_0x225cb5[_0x71b9('0x76')][_0x48a54d]['foreignTable'],_0x225cb5[_0x71b9('0x76')][_0x48a54d][_0x71b9('0x79')]));}}}if(_0x225cb5[_0x71b9('0x7c')]){_0x225cb5[_0x71b9('0x7c')]=JSON[_0x71b9('0x77')](_0x225cb5[_0x71b9('0x7c')]);_0x3c6b69[_0x71b9('0x3a')](_0xc1497e(_0x225cb5[_0x71b9('0x7c')]['group']));}_0x1437d1=_0x3c6b69[_0x71b9('0x7d')]();_0x3c6b69[_0x71b9('0x1a')](_0x5b3a36);_0x3c6b69[_0x71b9('0x18')](0x0);return;}})[_0x71b9('0x22')](function(){if(_0x1fb833[_0x71b9('0x8b')]==='web'){return null;}var _0x3c6953=_[_0x71b9('0x3e')](_0x1fb833,{'name':_0x1fb833[_0x71b9('0x8c')]||_0x1fb833[_0x71b9('0x2a')]||_0x225cb5[_0x71b9('0x2a')],'basename':_0x223057,'savename':util[_0x71b9('0x72')](_0x71b9('0x8d'),_0x1fb833[_0x71b9('0x2a')]||_0x225cb5[_0x71b9('0x2a')],require(_0x71b9('0x8e'))[_0x71b9('0x8f')](0x4),_0x1fb833[_0x71b9('0x8b')]||_0x71b9('0x90')),'reportId':_0x225cb5['id'],'reportType':_0x71b9('0x91')});return db[_0x71b9('0x92')][_0x71b9('0x49')](_0x3c6953,{'raw':!![]});})['then'](function(_0x449386){if(_0x225cb5['table']===_0x71b9('0x93')){_0x1437d1[_0x71b9('0x3a')](_0x225cb5['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1fb833[_0x71b9('0x94')],_0x1fb833['endDate']);}else{_0x1437d1['where'](_0x225cb5[_0x71b9('0x8a')]+_0x71b9('0x95'),_0x1fb833[_0x71b9('0x94')],_0x1fb833[_0x71b9('0x96')]);}if(_0x449386){logger[_0x71b9('0x97')](_0x71b9('0x98'),_0x1437d1[_0x71b9('0x80')]());require('child_process')[_0x71b9('0x99')](path['join'](__dirname,_0x71b9('0x9a'),_0x449386['output']),[_0x449386['id'],_0x1437d1[_0x71b9('0x80')](),path[_0x71b9('0x52')](__dirname,_0x71b9('0x9b'),_0x449386[_0x71b9('0x9c')]),_0x223057]);return _0x449386;}else{var _0x2786ab=squel[_0x71b9('0x6e')]();_0x2786ab[_0x71b9('0x6f')]('('+_0x1437d1['toString']()+')',_0x71b9('0x9d'));_0x2786ab[_0x71b9('0x65')](_0x71b9('0x9e'),'count');_0x1437d1[_0x71b9('0x1a')](_0x1fb833[_0x71b9('0x1a')]||_0x5b3a36);_0x1437d1[_0x71b9('0x18')](_0x1fb833[_0x71b9('0x18')]||0x0);return dbH['sequelize'][_0x71b9('0x33')](_0x2786ab[_0x71b9('0x80')](),{'type':dbH[_0x71b9('0x81')][_0x71b9('0x9f')][_0x71b9('0xa0')]})[_0x71b9('0x22')](function(_0x20423b){if(!_0x20423b['length']){_0x30b0d2=0x0;}else{_0x30b0d2=_0x20423b[0x0][_0x71b9('0x1b')]||0x0;}return dbH[_0x71b9('0x81')][_0x71b9('0x33')](_0x1437d1[_0x71b9('0x80')](),{'type':dbH['sequelize'][_0x71b9('0x9f')][_0x71b9('0xa0')]});})[_0x71b9('0x22')](function(_0x33f301){return{'rows':_0x33f301||[],'count':_0x30b0d2};});}});}exports[_0x71b9('0xa1')]=function(_0x3a598c,_0x93c5ed){return runReport(_0x3a598c[_0x71b9('0x45')],_0x3a598c['query'],_0x3a598c['options'])[_0x71b9('0x22')](respondWithResult(_0x93c5ed,null))['catch'](handleError(_0x93c5ed,null));};exports[_0x71b9('0xa2')]=runReport;exports[_0x71b9('0x33')]=function(_0x1d3a52,_0x1e40d5){var _0x3df6d6=0xa;var _0x4dd6ca=[_0x71b9('0x52'),_0x71b9('0x82'),'right_join',_0x71b9('0x53')];var _0xdefd1b={'SUM':_0x71b9('0x83'),'COUNT':_0x71b9('0x54'),'COUNT DISTINCT':_0x71b9('0x55'),'MAX':_0x71b9('0x56'),'MIN':_0x71b9('0x84'),'AVG':_0x71b9('0x57'),'GROUP_CONCAT':_0x71b9('0x58'),'GROUP_CONCAT ASC':_0x71b9('0x85'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e44ea={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x71b9('0x5b'),'HOUR':_0x71b9('0x5c'),'ROUND':_0x71b9('0x5d'),'UNIX_TIMESTAMP':_0x71b9('0x5e')};var _0x5b216d=function(_0x38adca){return!_[_0x71b9('0x5f')]([_0x71b9('0xa3'),_0x71b9('0x86'),'IS\x20EMPTY',_0x71b9('0x61')],_0x38adca);};var _0x183fcb=function(_0x27f477){if(!_0x27f477||!_0x27f477[_0x71b9('0x62')][_0x71b9('0x37')]){return'';}for(var _0x2da78f='(',_0x3f63a3=0x0;_0x3f63a3<_0x27f477[_0x71b9('0x62')][_0x71b9('0x37')];_0x3f63a3+=0x1){_0x3f63a3>0x0&&(_0x2da78f+='\x20'+_0x27f477[_0x71b9('0x63')]+'\x20');_0x2da78f+=_0x27f477[_0x71b9('0x62')][_0x3f63a3]['group']?_0x183fcb(_0x27f477[_0x71b9('0x62')][_0x3f63a3]['group']):_0x27f477[_0x71b9('0x62')][_0x3f63a3][_0x71b9('0x65')]+'\x20'+_0x27f477[_0x71b9('0x62')][_0x3f63a3][_0x71b9('0x66')]+(_0x5b216d(_0x27f477[_0x71b9('0x62')][_0x3f63a3][_0x71b9('0x66')])?'\x20'+_0x27f477[_0x71b9('0x62')][_0x3f63a3]['value']:'');}return _0x2da78f+')';};var _0x4c13a3={'where':{'id':_0x1d3a52[_0x71b9('0x45')]['id']}},_0x310710,_0x1abdec,_0xcf19e9,_0x280a12,_0x305771;_0x4c13a3=_[_0x71b9('0x3e')]({},_0x4c13a3,_0x1d3a52['options']);return db[_0x71b9('0x2d')][_0x71b9('0x48')](_0x4c13a3)[_0x71b9('0x22')](function(_0x3f532f){if(_0x3f532f){_0x310710=_0x3f532f;return _0x3f532f[_0x71b9('0x68')]();}return null;})[_0x71b9('0x22')](function(_0x1c87fd){if(_0x1c87fd){if(!_0x1c87fd[_0x71b9('0x37')]){throw new db[(_0x71b9('0x69'))][(_0x71b9('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1abdec=_0x1c87fd;return db[_0x71b9('0x6c')][_0x71b9('0x42')]({'raw':!![]});}return null;})['then'](function(_0x476a78){if(_0x476a78){_0xcf19e9=_[_0x71b9('0x6d')](_0x476a78,'id');var _0x29f919;var _0x4964a7=squel[_0x71b9('0x6e')]();_0x4964a7[_0x71b9('0x6f')](_0x310710['table']);for(var _0x616c17=0x0;_0x616c17<_0x1abdec[_0x71b9('0x37')];_0x616c17+=0x1){_0x29f919=_0x1abdec[_0x616c17][_0x71b9('0x70')]?_0xcf19e9[_0x1abdec[_0x616c17][_0x71b9('0x70')]][_0x71b9('0x87')]:_0x1abdec[_0x616c17][_0x71b9('0x65')];_0x29f919=_0x1abdec[_0x616c17]['function']?_[_0x71b9('0x73')](_0xdefd1b[_0x1abdec[_0x616c17][_0x71b9('0x71')]],'%s',_0x29f919):_0x29f919;_0x29f919=_0x1abdec[_0x616c17][_0x71b9('0x72')]?_[_0x71b9('0x73')](_0x3e44ea[_0x1abdec[_0x616c17][_0x71b9('0x72')]],'%s',_0x29f919):_0x29f919;if(_0x1abdec[_0x616c17][_0x71b9('0x88')]){_0x4964a7[_0x71b9('0x64')](_0x29f919);}_0x1abdec[_0x616c17][_0x71b9('0x74')]&&_0x4964a7[_0x71b9('0x38')](_0x29f919,_0x1abdec[_0x616c17][_0x71b9('0x74')]===_0x71b9('0x89')?![]:!![]);_0x4964a7[_0x71b9('0x65')](_0x29f919,_0x1abdec[_0x616c17][_0x71b9('0x75')]||_0x29f919);}if(_0x310710[_0x71b9('0x76')]){_0x310710[_0x71b9('0x76')]=JSON['parse'](_0x310710[_0x71b9('0x76')]);for(var _0x5bf8d7=0x0;_0x5bf8d7<_0x310710[_0x71b9('0x76')][_0x71b9('0x37')];_0x5bf8d7+=0x1){if(_0x310710[_0x71b9('0x76')][_0x5bf8d7][_0x71b9('0x30')]&&_[_0x71b9('0x5f')](_0x4dd6ca,_0x310710['joins'][_0x5bf8d7][_0x71b9('0x30')])&&_0x310710[_0x71b9('0x76')][_0x5bf8d7][_0x71b9('0x78')]&&_0x310710[_0x71b9('0x76')][_0x5bf8d7]['foreignTable']&&_0x310710['joins'][_0x5bf8d7][_0x71b9('0x79')]){_0x4964a7[_0x310710['joins'][_0x5bf8d7][_0x71b9('0x30')]](_0x310710[_0x71b9('0x76')][_0x5bf8d7][_0x71b9('0x7a')],null,util[_0x71b9('0x72')]('%s.%s\x20=\x20%s.%s',_0x310710['table'],_0x310710[_0x71b9('0x76')][_0x5bf8d7][_0x71b9('0x78')],_0x310710[_0x71b9('0x76')][_0x5bf8d7][_0x71b9('0x7a')],_0x310710['joins'][_0x5bf8d7][_0x71b9('0x79')]));}}}if(_0x310710[_0x71b9('0x7c')]){_0x310710[_0x71b9('0x7c')]=JSON[_0x71b9('0x77')](_0x310710[_0x71b9('0x7c')]);_0x4964a7['where'](_0x183fcb(_0x310710[_0x71b9('0x7c')]['group']));}_0x305771=_0x4964a7[_0x71b9('0x7d')]();_0x4964a7['limit'](_0x3df6d6);_0x4964a7[_0x71b9('0x18')](0x0);logger[_0x71b9('0x7e')]('Limited\x20Query:',_0x4964a7[_0x71b9('0x80')]());return dbH['sequelize'][_0x71b9('0x33')](_0x4964a7[_0x71b9('0x80')](),{'type':dbH[_0x71b9('0x81')][_0x71b9('0x9f')]['SELECT']});}})[_0x71b9('0x22')](function(){return{'sql':_0x305771[_0x71b9('0x80')]()};})[_0x71b9('0x22')](respondWithResult(_0x1e40d5,null))[_0x71b9('0x43')](handleError(_0x1e40d5,null));}; \ No newline at end of file +var _0x52fb=['eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','type','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','field','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','SEC_TO_TIME(%s)','ROUND(%s)','metric','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s)','ValidationErrorItem','Limited\x20Query:'];(function(_0x22e09f,_0x5f1211){var _0x3c96cb=function(_0x28dcf0){while(--_0x28dcf0){_0x22e09f['push'](_0x22e09f['shift']());}};_0x3c96cb(++_0x5f1211);}(_0x52fb,0xa8));var _0xb52f=function(_0x2a5bb0,_0x32b8fd){_0x2a5bb0=_0x2a5bb0-0x0;var _0x103464=_0x52fb[_0x2a5bb0];return _0x103464;};'use strict';var emlformat=require(_0xb52f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb52f('0x1'));var jsonpatch=require(_0xb52f('0x2'));var rp=require(_0xb52f('0x3'));var moment=require('moment');var BPromise=require(_0xb52f('0x4'));var Mustache=require(_0xb52f('0x5'));var util=require('util');var path=require(_0xb52f('0x6'));var sox=require('sox');var csv=require(_0xb52f('0x7'));var ejs=require(_0xb52f('0x8'));var fs=require('fs');var fs_extra=require(_0xb52f('0x9'));var _=require('lodash');var squel=require(_0xb52f('0xa'));var crypto=require('crypto');var jsforce=require(_0xb52f('0xb'));var deskjs=require(_0xb52f('0xc'));var toCsv=require(_0xb52f('0x7'));var querystring=require(_0xb52f('0xd'));var Papa=require(_0xb52f('0xe'));var Redis=require(_0xb52f('0xf'));var authService=require(_0xb52f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb52f('0x11'));var hardwareService=require(_0xb52f('0x12'));var logger=require(_0xb52f('0x13'))(_0xb52f('0x14'));var utils=require(_0xb52f('0x15'));var config=require(_0xb52f('0x16'));var licenseUtil=require(_0xb52f('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb52f('0x18'))['dbH'];function respondWithStatusCode(_0x10d473,_0x3ac766){_0x3ac766=_0x3ac766||0xcc;return function(_0x14def7){if(_0x14def7){return _0x10d473[_0xb52f('0x19')](_0x3ac766);}return _0x10d473[_0xb52f('0x1a')](_0x3ac766)[_0xb52f('0x1b')]();};}function respondWithResult(_0x1059ab,_0x29f95a){_0x29f95a=_0x29f95a||0xc8;return function(_0x490676){if(_0x490676){return _0x1059ab['status'](_0x29f95a)[_0xb52f('0x1c')](_0x490676);}};}function respondWithFilteredResult(_0x32e6ca,_0x593ab0){return function(_0x410f79){if(_0x410f79){var _0x3c211c=typeof _0x593ab0[_0xb52f('0x1d')]===_0xb52f('0x1e')&&typeof _0x593ab0[_0xb52f('0x1f')]===_0xb52f('0x1e');var _0x5b2417=_0x410f79[_0xb52f('0x20')];var _0x5c9cb6=_0x3c211c?0x0:_0x593ab0[_0xb52f('0x1d')];var _0x41454d=_0x3c211c?_0x410f79['count']:_0x593ab0[_0xb52f('0x1d')]+_0x593ab0['limit'];var _0x2dd0c6;if(_0x41454d>=_0x5b2417){_0x41454d=_0x5b2417;_0x2dd0c6=0xc8;}else{_0x2dd0c6=0xce;}_0x32e6ca[_0xb52f('0x1a')](_0x2dd0c6);return _0x32e6ca[_0xb52f('0x21')](_0xb52f('0x22'),_0x5c9cb6+'-'+_0x41454d+'/'+_0x5b2417)[_0xb52f('0x1c')](_0x410f79);}return null;};}function patchUpdates(_0x341536){return function(_0xeaca37){try{jsonpatch[_0xb52f('0x23')](_0xeaca37,_0x341536,!![]);}catch(_0x4fccc4){return BPromise[_0xb52f('0x24')](_0x4fccc4);}return _0xeaca37[_0xb52f('0x25')]();};}function saveUpdates(_0x314919,_0x4ea31b){return function(_0x3fa3f5){if(_0x3fa3f5){return _0x3fa3f5[_0xb52f('0x26')](_0x314919)[_0xb52f('0x27')](function(_0x3d8b06){return _0x3d8b06;});}return null;};}function removeEntity(_0x36341a,_0x788d3e){return function(_0x56c318){if(_0x56c318){return _0x56c318[_0xb52f('0x28')]()[_0xb52f('0x27')](function(){var _0xadd653=_0x56c318[_0xb52f('0x29')]({'plain':!![]});var _0xbf0dd2=_0xb52f('0x2a');return db[_0xb52f('0x2b')][_0xb52f('0x28')]({'where':{'type':_0xbf0dd2,'resourceId':_0xadd653['id']}})['then'](function(){return _0x56c318;});})[_0xb52f('0x27')](function(){_0x36341a['status'](0xcc)[_0xb52f('0x1b')]();});}};}function handleEntityNotFound(_0x48e06b,_0x27596c){return function(_0x32e9e6){if(!_0x32e9e6){_0x48e06b[_0xb52f('0x19')](0x194);}return _0x32e9e6;};}function handleError(_0x5d0072,_0x3ffc97){_0x3ffc97=_0x3ffc97||0x1f4;return function(_0x5bf407){logger[_0xb52f('0x2c')](_0x5bf407['stack']);if(_0x5bf407[_0xb52f('0x2d')]){delete _0x5bf407[_0xb52f('0x2d')];}_0x5d0072[_0xb52f('0x1a')](_0x3ffc97)[_0xb52f('0x2e')](_0x5bf407);};}exports[_0xb52f('0x2f')]=function(_0x1f87aa,_0x23caf9){var _0x533354={},_0x4c7ce5={},_0x55c6a1={'count':0x0,'rows':[]};var _0x86f6a6=_['map'](db[_0xb52f('0x30')][_0xb52f('0x31')],function(_0x1f3261){return{'name':_0x1f3261[_0xb52f('0x32')],'type':_0x1f3261['type'][_0xb52f('0x33')]};});_0x4c7ce5[_0xb52f('0x34')]=_[_0xb52f('0x35')](_0x86f6a6,_0xb52f('0x2d'));_0x4c7ce5[_0xb52f('0x36')]=_[_0xb52f('0x37')](_0x1f87aa[_0xb52f('0x36')]);_0x4c7ce5[_0xb52f('0x38')]=_['intersection'](_0x4c7ce5[_0xb52f('0x34')],_0x4c7ce5[_0xb52f('0x36')]);_0x533354['attributes']=_[_0xb52f('0x39')](_0x4c7ce5[_0xb52f('0x34')],qs['fields'](_0x1f87aa[_0xb52f('0x36')][_0xb52f('0x3a')]));_0x533354['attributes']=_0x533354[_0xb52f('0x3b')][_0xb52f('0x3c')]?_0x533354['attributes']:_0x4c7ce5[_0xb52f('0x34')];if(!_0x1f87aa[_0xb52f('0x36')]['hasOwnProperty']('nolimit')){_0x533354[_0xb52f('0x1f')]=qs[_0xb52f('0x1f')](_0x1f87aa[_0xb52f('0x36')][_0xb52f('0x1f')]);_0x533354[_0xb52f('0x1d')]=qs['offset'](_0x1f87aa['query']['offset']);}_0x533354[_0xb52f('0x3d')]=qs[_0xb52f('0x3e')](_0x1f87aa[_0xb52f('0x36')][_0xb52f('0x3e')]);_0x533354[_0xb52f('0x3f')]=qs[_0xb52f('0x38')](_[_0xb52f('0x40')](_0x1f87aa['query'],_0x4c7ce5[_0xb52f('0x38')]),_0x86f6a6);if(_0x1f87aa[_0xb52f('0x36')][_0xb52f('0x41')]){_0x533354[_0xb52f('0x3f')]=_['merge'](_0x533354['where'],{'$or':_[_0xb52f('0x35')](_0x86f6a6,function(_0x558d14){if(_0x558d14[_0xb52f('0x42')]!=='VIRTUAL'){var _0x58fed3={};_0x58fed3[_0x558d14[_0xb52f('0x2d')]]={'$like':'%'+_0x1f87aa[_0xb52f('0x36')][_0xb52f('0x41')]+'%'};return _0x58fed3;}})});}_0x533354=_[_0xb52f('0x43')]({},_0x533354,_0x1f87aa[_0xb52f('0x44')]);var _0xafa15d={'where':_0x533354['where']};return db[_0xb52f('0x30')]['count'](_0xafa15d)[_0xb52f('0x27')](function(_0x5a8ce2){_0x55c6a1[_0xb52f('0x20')]=_0x5a8ce2;if(_0x1f87aa[_0xb52f('0x36')]['includeAll']){_0x533354[_0xb52f('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xb52f('0x46')](_0x533354);})[_0xb52f('0x27')](function(_0x180873){_0x55c6a1[_0xb52f('0x47')]=_0x180873;return _0x55c6a1;})['then'](respondWithFilteredResult(_0x23caf9,_0x533354))[_0xb52f('0x48')](handleError(_0x23caf9,null));};exports[_0xb52f('0x49')]=function(_0x9d4bfe,_0x531fbc){var _0x444933={'raw':![],'where':{'id':_0x9d4bfe[_0xb52f('0x4a')]['id']}},_0xda8ba5={};_0xda8ba5[_0xb52f('0x34')]=_[_0xb52f('0x37')](db[_0xb52f('0x30')][_0xb52f('0x31')]);_0xda8ba5[_0xb52f('0x36')]=_[_0xb52f('0x37')](_0x9d4bfe['query']);_0xda8ba5[_0xb52f('0x38')]=_[_0xb52f('0x39')](_0xda8ba5[_0xb52f('0x34')],_0xda8ba5[_0xb52f('0x36')]);_0x444933[_0xb52f('0x3b')]=_[_0xb52f('0x39')](_0xda8ba5[_0xb52f('0x34')],qs[_0xb52f('0x3a')](_0x9d4bfe[_0xb52f('0x36')][_0xb52f('0x3a')]));_0x444933['attributes']=_0x444933[_0xb52f('0x3b')][_0xb52f('0x3c')]?_0x444933[_0xb52f('0x3b')]:_0xda8ba5[_0xb52f('0x34')];if(_0x9d4bfe[_0xb52f('0x36')][_0xb52f('0x4b')]){_0x444933[_0xb52f('0x45')]=[{'all':!![]}];}_0x444933=_[_0xb52f('0x43')]({},_0x444933,_0x9d4bfe[_0xb52f('0x44')]);return db[_0xb52f('0x30')][_0xb52f('0x4c')](_0x444933)['then'](handleEntityNotFound(_0x531fbc,null))[_0xb52f('0x27')](respondWithResult(_0x531fbc,null))['catch'](handleError(_0x531fbc,null));};exports[_0xb52f('0x4d')]=function(_0xe8416d,_0x4b9318){return db[_0xb52f('0x30')][_0xb52f('0x4d')](_0xe8416d[_0xb52f('0x4e')],{})['then'](function(_0x2f1ffc){var _0x2953a1=_0xe8416d['user'][_0xb52f('0x29')]({'plain':!![]});if(!_0x2953a1)throw new Error(_0xb52f('0x4f'));if(_0x2953a1[_0xb52f('0x50')]==='user'){var _0x3dc54f=_0x2f1ffc['get']({'plain':!![]});var _0x2ce0f4=_0xb52f('0x51');return db['UserProfileSection'][_0xb52f('0x4c')]({'where':{'name':_0x2ce0f4,'userProfileId':_0x2953a1[_0xb52f('0x52')]},'raw':!![]})['then'](function(_0x36999c){if(_0x36999c&&_0x36999c['autoAssociation']===0x0){return db[_0xb52f('0x2b')][_0xb52f('0x4d')]({'name':_0x3dc54f['name'],'resourceId':_0x3dc54f['id'],'type':'CustomReports','sectionId':_0x36999c['id']},{})[_0xb52f('0x27')](function(){return _0x2f1ffc;});}else{return _0x2f1ffc;}})['catch'](function(_0x365a03){logger[_0xb52f('0x2c')](_0xb52f('0x53'),_0x365a03);throw _0x365a03;});}return _0x2f1ffc;})[_0xb52f('0x27')](respondWithResult(_0x4b9318,0xc9))[_0xb52f('0x48')](handleError(_0x4b9318,null));};exports['update']=function(_0x1a52f2,_0x4907e3){if(_0x1a52f2[_0xb52f('0x4e')]['id']){delete _0x1a52f2[_0xb52f('0x4e')]['id'];}return db[_0xb52f('0x30')][_0xb52f('0x4c')]({'where':{'id':_0x1a52f2[_0xb52f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4907e3,null))[_0xb52f('0x27')](saveUpdates(_0x1a52f2['body'],null))[_0xb52f('0x27')](respondWithResult(_0x4907e3,null))[_0xb52f('0x48')](handleError(_0x4907e3,null));};exports[_0xb52f('0x28')]=function(_0x8f9691,_0x16b8c2){return db[_0xb52f('0x30')]['find']({'where':{'id':_0x8f9691[_0xb52f('0x4a')]['id']}})[_0xb52f('0x27')](handleEntityNotFound(_0x16b8c2,null))['then'](removeEntity(_0x16b8c2,null))[_0xb52f('0x48')](handleError(_0x16b8c2,null));};exports[_0xb52f('0x54')]=function(_0x4871ba,_0x3aed6b){var _0x11fd6d=0xa;var _0x2b3abc=[_0xb52f('0x55'),_0xb52f('0x56'),_0xb52f('0x57'),_0xb52f('0x58')];var _0x3df563={'SUM':'SUM(%s)','COUNT':_0xb52f('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xb52f('0x5a'),'AVG':_0xb52f('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb52f('0x5c'),'GROUP_CONCAT DESC':_0xb52f('0x5d')};var _0x72d2e5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb52f('0x5e'),'HOUR':_0xb52f('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb52f('0x60')};var _0x3d6bc3=function(_0x37569d){return!_[_0xb52f('0x61')]([_0xb52f('0x62'),_0xb52f('0x63'),_0xb52f('0x64'),_0xb52f('0x65')],_0x37569d);};var _0x372fca=function(_0x32bb70){if(!_0x32bb70||!_0x32bb70[_0xb52f('0x66')][_0xb52f('0x3c')]){return'';}for(var _0x244dac='(',_0x24c5b5=0x0;_0x24c5b5<_0x32bb70[_0xb52f('0x66')]['length'];_0x24c5b5+=0x1){_0x24c5b5>0x0&&(_0x244dac+='\x20'+_0x32bb70[_0xb52f('0x67')]+'\x20');_0x244dac+=_0x32bb70[_0xb52f('0x66')][_0x24c5b5][_0xb52f('0x68')]?_0x372fca(_0x32bb70[_0xb52f('0x66')][_0x24c5b5][_0xb52f('0x68')]):_0x32bb70[_0xb52f('0x66')][_0x24c5b5]['field']+'\x20'+_0x32bb70['rules'][_0x24c5b5][_0xb52f('0x69')]+(_0x3d6bc3(_0x32bb70[_0xb52f('0x66')][_0x24c5b5][_0xb52f('0x69')])?'\x20'+_0x32bb70[_0xb52f('0x66')][_0x24c5b5][_0xb52f('0x6a')]:'');}return _0x244dac+')';};var _0x5ef886={'where':{'id':_0x4871ba[_0xb52f('0x4a')]['id']}},_0x6a5c4c,_0x4ec04b,_0x4e909c,_0x306521,_0x54c971;_0x5ef886=_[_0xb52f('0x43')]({},_0x5ef886,_0x4871ba['options']);return db[_0xb52f('0x30')]['find'](_0x5ef886)[_0xb52f('0x27')](function(_0x1aaa3e){if(_0x1aaa3e){_0x6a5c4c=_0x1aaa3e;return _0x1aaa3e[_0xb52f('0x6b')]();}return null;})[_0xb52f('0x27')](function(_0x528a5b){if(_0x528a5b){if(!_0x528a5b[_0xb52f('0x3c')]){throw new db[(_0xb52f('0x6c'))]['ValidationErrorItem'](_0xb52f('0x6d'),0x193);}_0x4ec04b=_0x528a5b;return db[_0xb52f('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xb52f('0x27')](function(_0x3a725c){if(_0x3a725c){_0x4e909c=_[_0xb52f('0x6f')](_0x3a725c,'id');var _0x5f0d0f;var _0x351524=squel[_0xb52f('0x70')]();_0x351524[_0xb52f('0x71')](_0x6a5c4c[_0xb52f('0x72')]);for(var _0x4fdb60=0x0;_0x4fdb60<_0x4ec04b['length'];_0x4fdb60+=0x1){_0x5f0d0f=_0x4ec04b[_0x4fdb60][_0xb52f('0x73')]?_0x4e909c[_0x4ec04b[_0x4fdb60]['MetricId']]['metric']:_0x4ec04b[_0x4fdb60]['field'];_0x5f0d0f=_0x4ec04b[_0x4fdb60][_0xb52f('0x74')]?_[_0xb52f('0x75')](_0x3df563[_0x4ec04b[_0x4fdb60][_0xb52f('0x74')]],'%s',_0x5f0d0f):_0x5f0d0f;_0x5f0d0f=_0x4ec04b[_0x4fdb60][_0xb52f('0x76')]?_['replace'](_0x72d2e5[_0x4ec04b[_0x4fdb60][_0xb52f('0x76')]],'%s',_0x5f0d0f):_0x5f0d0f;if(_0x4ec04b[_0x4fdb60][_0xb52f('0x77')]){_0x351524[_0xb52f('0x68')](_0x5f0d0f);}_0x4ec04b[_0x4fdb60][_0xb52f('0x78')]&&_0x351524[_0xb52f('0x3d')](_0x5f0d0f,_0x4ec04b[_0x4fdb60][_0xb52f('0x78')]===_0xb52f('0x79')?![]:!![]);_0x351524[_0xb52f('0x7a')](_0x5f0d0f,_0x4ec04b[_0x4fdb60][_0xb52f('0x7b')]||_0x5f0d0f);}if(_0x6a5c4c[_0xb52f('0x7c')]){_0x6a5c4c[_0xb52f('0x7c')]=JSON[_0xb52f('0x7d')](_0x6a5c4c[_0xb52f('0x7c')]);for(var _0x417bc1=0x0;_0x417bc1<_0x6a5c4c[_0xb52f('0x7c')][_0xb52f('0x3c')];_0x417bc1+=0x1){if(_0x6a5c4c['joins'][_0x417bc1][_0xb52f('0x42')]&&_[_0xb52f('0x61')](_0x2b3abc,_0x6a5c4c[_0xb52f('0x7c')][_0x417bc1][_0xb52f('0x42')])&&_0x6a5c4c['joins'][_0x417bc1][_0xb52f('0x7e')]&&_0x6a5c4c[_0xb52f('0x7c')][_0x417bc1]['foreignTable']&&_0x6a5c4c['joins'][_0x417bc1][_0xb52f('0x7f')]){_0x351524[_0x6a5c4c[_0xb52f('0x7c')][_0x417bc1][_0xb52f('0x42')]](_0x6a5c4c[_0xb52f('0x7c')][_0x417bc1][_0xb52f('0x80')],null,util[_0xb52f('0x76')](_0xb52f('0x81'),_0x6a5c4c[_0xb52f('0x72')],_0x6a5c4c['joins'][_0x417bc1][_0xb52f('0x7e')],_0x6a5c4c['joins'][_0x417bc1][_0xb52f('0x80')],_0x6a5c4c[_0xb52f('0x7c')][_0x417bc1]['foreignKey']));}}}if(_0x6a5c4c['conditions']){_0x6a5c4c[_0xb52f('0x82')]=JSON[_0xb52f('0x7d')](_0x6a5c4c[_0xb52f('0x82')]);_0x351524[_0xb52f('0x3f')](_0x372fca(_0x6a5c4c['conditions'][_0xb52f('0x68')]));}_0x54c971=_0x351524[_0xb52f('0x83')]();_0x351524[_0xb52f('0x1f')](_0x11fd6d);_0x351524['offset'](0x0);logger[_0xb52f('0x84')]('Limited\x20Query:',_0x351524[_0xb52f('0x85')]());return dbH[_0xb52f('0x86')][_0xb52f('0x36')](_0x351524[_0xb52f('0x85')](),{'type':dbH[_0xb52f('0x86')][_0xb52f('0x87')][_0xb52f('0x88')]});}})['then'](respondWithResult(_0x3aed6b,null))['catch'](handleError(_0x3aed6b,null));};function runReport(_0x18f5d9,_0x2c2f76,_0x36bb4a){var _0x29f5ba=_0x2c2f76[_0xb52f('0x2d')];var _0x3718f2=0xa;var _0x5d9a42=['join',_0xb52f('0x56'),_0xb52f('0x57'),'cross_join'];var _0x45060c={'SUM':_0xb52f('0x89'),'COUNT':_0xb52f('0x59'),'COUNT DISTINCT':_0xb52f('0x8a'),'MAX':_0xb52f('0x8b'),'MIN':'MIN(%s)','AVG':_0xb52f('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb52f('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xb60b8c={'SEC_TO_TIME':_0xb52f('0x8c'),'DATE':_0xb52f('0x5e'),'HOUR':_0xb52f('0x5f'),'ROUND':_0xb52f('0x8d'),'UNIX_TIMESTAMP':_0xb52f('0x60')};var _0x586c68=function(_0x1475e1){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb52f('0x64'),_0xb52f('0x65')],_0x1475e1);};var _0x2450a6=function(_0x132adf){if(!_0x132adf||!_0x132adf[_0xb52f('0x66')]['length']){return'';}for(var _0x1a83d2='(',_0x542930=0x0;_0x542930<_0x132adf[_0xb52f('0x66')][_0xb52f('0x3c')];_0x542930+=0x1){_0x542930>0x0&&(_0x1a83d2+='\x20'+_0x132adf['operator']+'\x20');_0x1a83d2+=_0x132adf[_0xb52f('0x66')][_0x542930]['group']?_0x2450a6(_0x132adf[_0xb52f('0x66')][_0x542930][_0xb52f('0x68')]):_0x132adf['rules'][_0x542930][_0xb52f('0x7a')]+'\x20'+_0x132adf[_0xb52f('0x66')][_0x542930][_0xb52f('0x69')]+(_0x586c68(_0x132adf[_0xb52f('0x66')][_0x542930][_0xb52f('0x69')])?'\x20'+_0x132adf[_0xb52f('0x66')][_0x542930]['value']:'');}return _0x1a83d2+')';};var _0x250866={'where':{'id':_0x18f5d9['id']}},_0x500d0a,_0x318d76,_0x45b1e3,_0xf3015e,_0xee78e2;_0x250866=_['merge']({},_0x250866,_0x36bb4a);return db['AnalyticCustomReport'][_0xb52f('0x4c')](_0x250866)[_0xb52f('0x27')](function(_0x181998){if(_0x181998){_0x500d0a=_0x181998;return _0x181998[_0xb52f('0x6b')]();}return null;})[_0xb52f('0x27')](function(_0x49233d){if(_0x49233d){if(!_0x49233d[_0xb52f('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb52f('0x6d'),0x193);}_0x318d76=_0x49233d;return db[_0xb52f('0x6e')]['findAll']({'raw':!![]});}return null;})[_0xb52f('0x27')](function(_0x3d89b7){if(_0x3d89b7){_0x45b1e3=_[_0xb52f('0x6f')](_0x3d89b7,'id');var _0x520163;var _0x4c0f08=squel['select']();_0x4c0f08[_0xb52f('0x71')](_0x500d0a[_0xb52f('0x72')]);for(var _0x2cb195=0x0;_0x2cb195<_0x318d76[_0xb52f('0x3c')];_0x2cb195+=0x1){_0x520163=_0x318d76[_0x2cb195][_0xb52f('0x73')]?_0x45b1e3[_0x318d76[_0x2cb195][_0xb52f('0x73')]][_0xb52f('0x8e')]:_0x318d76[_0x2cb195]['field'];_0x520163=_0x318d76[_0x2cb195][_0xb52f('0x74')]?_['replace'](_0x45060c[_0x318d76[_0x2cb195][_0xb52f('0x74')]],'%s',_0x520163):_0x520163;_0x520163=_0x318d76[_0x2cb195][_0xb52f('0x76')]?_[_0xb52f('0x75')](_0xb60b8c[_0x318d76[_0x2cb195]['format']],'%s',_0x520163):_0x520163;if(_0x318d76[_0x2cb195]['groupBy']){_0x4c0f08[_0xb52f('0x68')](_0x520163);}_0x318d76[_0x2cb195][_0xb52f('0x78')]&&_0x4c0f08[_0xb52f('0x3d')](_0x520163,_0x318d76[_0x2cb195]['orderBy']===_0xb52f('0x79')?![]:!![]);_0x4c0f08[_0xb52f('0x7a')](_0x520163,_0x318d76[_0x2cb195]['alias']||_0x520163);}if(_0x500d0a[_0xb52f('0x7c')]){_0x500d0a[_0xb52f('0x7c')]=JSON[_0xb52f('0x7d')](_0x500d0a[_0xb52f('0x7c')]);for(var _0x30b034=0x0;_0x30b034<_0x500d0a[_0xb52f('0x7c')][_0xb52f('0x3c')];_0x30b034+=0x1){if(_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x42')]&&_[_0xb52f('0x61')](_0x5d9a42,_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x42')])&&_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x7e')]&&_0x500d0a['joins'][_0x30b034][_0xb52f('0x80')]&&_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x7f')]){_0x4c0f08[_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x42')]](_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x80')],null,util[_0xb52f('0x76')](_0xb52f('0x81'),_0x500d0a['table'],_0x500d0a[_0xb52f('0x7c')][_0x30b034]['parentKey'],_0x500d0a[_0xb52f('0x7c')][_0x30b034]['foreignTable'],_0x500d0a[_0xb52f('0x7c')][_0x30b034][_0xb52f('0x7f')]));}}}if(_0x500d0a[_0xb52f('0x82')]){_0x500d0a['conditions']=JSON[_0xb52f('0x7d')](_0x500d0a['conditions']);_0x4c0f08[_0xb52f('0x3f')](_0x2450a6(_0x500d0a[_0xb52f('0x82')][_0xb52f('0x68')]));}_0xee78e2=_0x4c0f08[_0xb52f('0x83')]();_0x4c0f08[_0xb52f('0x1f')](_0x3718f2);_0x4c0f08[_0xb52f('0x1d')](0x0);return;}})[_0xb52f('0x27')](function(){if(_0x2c2f76[_0xb52f('0x8f')]==='web'){return null;}var _0x3b122f=_['merge'](_0x2c2f76,{'name':_0x2c2f76[_0xb52f('0x90')]||_0x2c2f76['name']||_0x500d0a['name'],'basename':_0x29f5ba,'savename':util[_0xb52f('0x76')](_0xb52f('0x91'),_0x2c2f76[_0xb52f('0x2d')]||_0x500d0a[_0xb52f('0x2d')],require(_0xb52f('0x92'))[_0xb52f('0x93')](0x4),_0x2c2f76[_0xb52f('0x8f')]||_0xb52f('0x94')),'reportId':_0x500d0a['id'],'reportType':_0xb52f('0x95')});return db[_0xb52f('0x96')][_0xb52f('0x4d')](_0x3b122f,{'raw':!![]});})[_0xb52f('0x27')](function(_0x469f0d){if(_0x500d0a['table']===_0xb52f('0x97')){_0xee78e2['where'](_0x500d0a[_0xb52f('0x72')]+_0xb52f('0x98'),_0x2c2f76[_0xb52f('0x99')],_0x2c2f76[_0xb52f('0x9a')]);}else{_0xee78e2[_0xb52f('0x3f')](_0x500d0a['table']+_0xb52f('0x9b'),_0x2c2f76['startDate'],_0x2c2f76[_0xb52f('0x9a')]);}if(_0x469f0d){logger[_0xb52f('0x9c')](_0xb52f('0x9d'),_0xee78e2[_0xb52f('0x85')]());require(_0xb52f('0x9e'))['fork'](path['join'](__dirname,'../../components/export/',_0x469f0d[_0xb52f('0x8f')]),[_0x469f0d['id'],_0xee78e2[_0xb52f('0x85')](),path[_0xb52f('0x55')](__dirname,_0xb52f('0x9f'),_0x469f0d[_0xb52f('0xa0')]),_0x29f5ba]);return _0x469f0d;}else{var _0x223e5c=squel[_0xb52f('0x70')]();_0x223e5c[_0xb52f('0x71')]('('+_0xee78e2[_0xb52f('0x85')]()+')',_0xb52f('0xa1'));_0x223e5c['field'](_0xb52f('0xa2'),'count');_0xee78e2[_0xb52f('0x1f')](_0x2c2f76[_0xb52f('0x1f')]||_0x3718f2);_0xee78e2['offset'](_0x2c2f76[_0xb52f('0x1d')]||0x0);return dbH[_0xb52f('0x86')][_0xb52f('0x36')](_0x223e5c[_0xb52f('0x85')](),{'type':dbH[_0xb52f('0x86')][_0xb52f('0x87')][_0xb52f('0x88')]})['then'](function(_0x5a89de){if(!_0x5a89de[_0xb52f('0x3c')]){_0xf3015e=0x0;}else{_0xf3015e=_0x5a89de[0x0][_0xb52f('0x20')]||0x0;}return dbH[_0xb52f('0x86')][_0xb52f('0x36')](_0xee78e2[_0xb52f('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0xb52f('0x88')]});})[_0xb52f('0x27')](function(_0x4330bc){return{'rows':_0x4330bc||[],'count':_0xf3015e};});}});}exports[_0xb52f('0xa3')]=function(_0x1256df,_0x1c72ba){return runReport(_0x1256df['params'],_0x1256df[_0xb52f('0x36')],_0x1256df[_0xb52f('0x44')])[_0xb52f('0x27')](respondWithResult(_0x1c72ba,null))[_0xb52f('0x48')](handleError(_0x1c72ba,null));};exports[_0xb52f('0xa4')]=runReport;exports[_0xb52f('0x36')]=function(_0xe631b3,_0x342e06){var _0x129146=0xa;var _0x2f9f2c=[_0xb52f('0x55'),_0xb52f('0x56'),_0xb52f('0x57'),_0xb52f('0x58')];var _0xc159e2={'SUM':_0xb52f('0x89'),'COUNT':_0xb52f('0x59'),'COUNT DISTINCT':_0xb52f('0x8a'),'MAX':_0xb52f('0x8b'),'MIN':_0xb52f('0x5a'),'AVG':_0xb52f('0x5b'),'GROUP_CONCAT':_0xb52f('0xa5'),'GROUP_CONCAT ASC':_0xb52f('0x5c'),'GROUP_CONCAT DESC':_0xb52f('0x5d')};var _0x53313c={'SEC_TO_TIME':_0xb52f('0x8c'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb52f('0x60')};var _0x521b58=function(_0x407c22){return!_[_0xb52f('0x61')]([_0xb52f('0x62'),'IS\x20NOT\x20NULL',_0xb52f('0x64'),_0xb52f('0x65')],_0x407c22);};var _0x34e416=function(_0x2fa0f5){if(!_0x2fa0f5||!_0x2fa0f5[_0xb52f('0x66')][_0xb52f('0x3c')]){return'';}for(var _0x5058c4='(',_0x2933e7=0x0;_0x2933e7<_0x2fa0f5['rules']['length'];_0x2933e7+=0x1){_0x2933e7>0x0&&(_0x5058c4+='\x20'+_0x2fa0f5[_0xb52f('0x67')]+'\x20');_0x5058c4+=_0x2fa0f5[_0xb52f('0x66')][_0x2933e7]['group']?_0x34e416(_0x2fa0f5[_0xb52f('0x66')][_0x2933e7][_0xb52f('0x68')]):_0x2fa0f5['rules'][_0x2933e7][_0xb52f('0x7a')]+'\x20'+_0x2fa0f5[_0xb52f('0x66')][_0x2933e7][_0xb52f('0x69')]+(_0x521b58(_0x2fa0f5[_0xb52f('0x66')][_0x2933e7][_0xb52f('0x69')])?'\x20'+_0x2fa0f5['rules'][_0x2933e7][_0xb52f('0x6a')]:'');}return _0x5058c4+')';};var _0x3b61ea={'where':{'id':_0xe631b3[_0xb52f('0x4a')]['id']}},_0x1c1d13,_0x39600d,_0x2b7f56,_0x56897,_0x5930b9;_0x3b61ea=_[_0xb52f('0x43')]({},_0x3b61ea,_0xe631b3[_0xb52f('0x44')]);return db['AnalyticCustomReport'][_0xb52f('0x4c')](_0x3b61ea)[_0xb52f('0x27')](function(_0x480f4e){if(_0x480f4e){_0x1c1d13=_0x480f4e;return _0x480f4e[_0xb52f('0x6b')]();}return null;})['then'](function(_0x21b2e2){if(_0x21b2e2){if(!_0x21b2e2['length']){throw new db[(_0xb52f('0x6c'))][(_0xb52f('0xa6'))](_0xb52f('0x6d'),0x193);}_0x39600d=_0x21b2e2;return db[_0xb52f('0x6e')][_0xb52f('0x46')]({'raw':!![]});}return null;})[_0xb52f('0x27')](function(_0x25cd29){if(_0x25cd29){_0x2b7f56=_[_0xb52f('0x6f')](_0x25cd29,'id');var _0x520bda;var _0x1db6cf=squel['select']();_0x1db6cf['from'](_0x1c1d13['table']);for(var _0x3f533e=0x0;_0x3f533e<_0x39600d['length'];_0x3f533e+=0x1){_0x520bda=_0x39600d[_0x3f533e]['MetricId']?_0x2b7f56[_0x39600d[_0x3f533e][_0xb52f('0x73')]][_0xb52f('0x8e')]:_0x39600d[_0x3f533e]['field'];_0x520bda=_0x39600d[_0x3f533e]['function']?_[_0xb52f('0x75')](_0xc159e2[_0x39600d[_0x3f533e][_0xb52f('0x74')]],'%s',_0x520bda):_0x520bda;_0x520bda=_0x39600d[_0x3f533e]['format']?_[_0xb52f('0x75')](_0x53313c[_0x39600d[_0x3f533e][_0xb52f('0x76')]],'%s',_0x520bda):_0x520bda;if(_0x39600d[_0x3f533e][_0xb52f('0x77')]){_0x1db6cf[_0xb52f('0x68')](_0x520bda);}_0x39600d[_0x3f533e]['orderBy']&&_0x1db6cf[_0xb52f('0x3d')](_0x520bda,_0x39600d[_0x3f533e][_0xb52f('0x78')]===_0xb52f('0x79')?![]:!![]);_0x1db6cf[_0xb52f('0x7a')](_0x520bda,_0x39600d[_0x3f533e]['alias']||_0x520bda);}if(_0x1c1d13[_0xb52f('0x7c')]){_0x1c1d13[_0xb52f('0x7c')]=JSON[_0xb52f('0x7d')](_0x1c1d13['joins']);for(var _0x286a8c=0x0;_0x286a8c<_0x1c1d13[_0xb52f('0x7c')]['length'];_0x286a8c+=0x1){if(_0x1c1d13['joins'][_0x286a8c][_0xb52f('0x42')]&&_[_0xb52f('0x61')](_0x2f9f2c,_0x1c1d13['joins'][_0x286a8c][_0xb52f('0x42')])&&_0x1c1d13['joins'][_0x286a8c]['parentKey']&&_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x80')]&&_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x7f')]){_0x1db6cf[_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x42')]](_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x80')],null,util[_0xb52f('0x76')](_0xb52f('0x81'),_0x1c1d13[_0xb52f('0x72')],_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x7e')],_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x80')],_0x1c1d13[_0xb52f('0x7c')][_0x286a8c][_0xb52f('0x7f')]));}}}if(_0x1c1d13[_0xb52f('0x82')]){_0x1c1d13[_0xb52f('0x82')]=JSON[_0xb52f('0x7d')](_0x1c1d13['conditions']);_0x1db6cf[_0xb52f('0x3f')](_0x34e416(_0x1c1d13[_0xb52f('0x82')]['group']));}_0x5930b9=_0x1db6cf[_0xb52f('0x83')]();_0x1db6cf[_0xb52f('0x1f')](_0x129146);_0x1db6cf[_0xb52f('0x1d')](0x0);logger[_0xb52f('0x84')](_0xb52f('0xa7'),_0x1db6cf[_0xb52f('0x85')]());return dbH[_0xb52f('0x86')][_0xb52f('0x36')](_0x1db6cf[_0xb52f('0x85')](),{'type':dbH[_0xb52f('0x86')][_0xb52f('0x87')][_0xb52f('0x88')]});}})[_0xb52f('0x27')](function(){return{'sql':_0x5930b9['toString']()};})[_0xb52f('0x27')](respondWithResult(_0x342e06,null))['catch'](handleError(_0x342e06,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index d4108f7..b46e76b 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 _0x64d7=['exports','define','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x64d7,0x1b3));var _0x764d=function(_0x2ecbfd,_0x5bacbc){_0x2ecbfd=_0x2ecbfd-0x0;var _0x2c65a2=_0x64d7[_0x2ecbfd];return _0x2c65a2;};'use strict';var _=require(_0x764d('0x0'));var util=require('util');var logger=require(_0x764d('0x1'))(_0x764d('0x2'));var moment=require(_0x764d('0x3'));var BPromise=require(_0x764d('0x4'));var rp=require(_0x764d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x764d('0x6'));var config=require(_0x764d('0x7'));var attributes=require(_0x764d('0x8'));module[_0x764d('0x9')]=function(_0x3f4cb4,_0x22edd9){return _0x3f4cb4[_0x764d('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x764d('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69dc=['analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','AnalyticCustomReport'];(function(_0x505d44,_0x5d1152){var _0x461166=function(_0xb0848d){while(--_0xb0848d){_0x505d44['push'](_0x505d44['shift']());}};_0x461166(++_0x5d1152);}(_0x69dc,0x1bd));var _0xc69d=function(_0x2cab80,_0x4f59d8){_0x2cab80=_0x2cab80-0x0;var _0x411205=_0x69dc[_0x2cab80];return _0x411205;};'use strict';var _=require(_0xc69d('0x0'));var util=require(_0xc69d('0x1'));var logger=require(_0xc69d('0x2'))(_0xc69d('0x3'));var moment=require('moment');var BPromise=require(_0xc69d('0x4'));var rp=require(_0xc69d('0x5'));var fs=require('fs');var path=require(_0xc69d('0x6'));var rimraf=require(_0xc69d('0x7'));var config=require(_0xc69d('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0xc69d('0x9')]=function(_0x167137,_0x4f1544){return _0x167137['define'](_0xc69d('0xa'),attributes,{'tableName':_0xc69d('0xb'),'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 07fb29c..dc664fb 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 _0x8f14=['info','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','code','error','message'];(function(_0x573b69,_0x3bd144){var _0x4f4f25=function(_0xe3a962){while(--_0xe3a962){_0x573b69['push'](_0x573b69['shift']());}};_0x4f4f25(++_0x3bd144);}(_0x8f14,0x9e));var _0x48f1=function(_0x2b0f08,_0x1eed29){_0x2b0f08=_0x2b0f08-0x0;var _0x4e05c8=_0x8f14[_0x2b0f08];return _0x4e05c8;};'use strict';var _=require(_0x48f1('0x0'));var util=require(_0x48f1('0x1'));var moment=require('moment');var BPromise=require(_0x48f1('0x2'));var rs=require(_0x48f1('0x3'));var fs=require('fs');var Redis=require(_0x48f1('0x4'));var db=require(_0x48f1('0x5'))['db'];var utils=require(_0x48f1('0x6'));var logger=require(_0x48f1('0x7'))('rpc');var config=require(_0x48f1('0x8'));var jayson=require(_0x48f1('0x9'));var client=jayson[_0x48f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x347ad9,_0x5270ce,_0x3cf100){return new BPromise(function(_0x1a048a,_0x4fb1eb){return client['request'](_0x347ad9,_0x3cf100)[_0x48f1('0xb')](function(_0x470775){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x5270ce,'request\x20sent');logger[_0x48f1('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x5270ce,_0x48f1('0xd'),JSON[_0x48f1('0xe')](_0x470775));if(_0x470775['error']){if(_0x470775['error'][_0x48f1('0xf')]===0x1f4){logger[_0x48f1('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5270ce,_0x470775[_0x48f1('0x10')][_0x48f1('0x11')]);return _0x4fb1eb(_0x470775[_0x48f1('0x10')][_0x48f1('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x5270ce,_0x470775[_0x48f1('0x10')][_0x48f1('0x11')]);return _0x1a048a(_0x470775[_0x48f1('0x10')][_0x48f1('0x11')]);}else{logger[_0x48f1('0x12')](_0x48f1('0x13'),_0x5270ce,'request\x20sent');_0x1a048a(_0x470775[_0x48f1('0x14')]['message']);}})[_0x48f1('0x15')](function(_0x436b2d){logger[_0x48f1('0x10')](_0x48f1('0x13'),_0x5270ce,_0x436b2d);_0x4fb1eb(_0x436b2d);});});} \ No newline at end of file +var _0xca80=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0xca80,0xdb));var _0x0ca8=function(_0x5f133a,_0x258967){_0x5f133a=_0x5f133a-0x0;var _0x548f1f=_0xca80[_0x5f133a];return _0x548f1f;};'use strict';var _=require('lodash');var util=require(_0x0ca8('0x0'));var moment=require(_0x0ca8('0x1'));var BPromise=require(_0x0ca8('0x2'));var rs=require(_0x0ca8('0x3'));var fs=require('fs');var Redis=require(_0x0ca8('0x4'));var db=require(_0x0ca8('0x5'))['db'];var utils=require(_0x0ca8('0x6'));var logger=require(_0x0ca8('0x7'))(_0x0ca8('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ca8('0x9'));var client=jayson[_0x0ca8('0xa')][_0x0ca8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x428d6b,_0x3bfdb4,_0x2e6237){return new BPromise(function(_0x1fd1e2,_0xef60bd){return client['request'](_0x428d6b,_0x2e6237)[_0x0ca8('0xc')](function(_0xb1a7d9){logger[_0x0ca8('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3bfdb4,_0x0ca8('0xe'));logger[_0x0ca8('0xf')](_0x0ca8('0x10'),_0x3bfdb4,_0x0ca8('0xe'),JSON[_0x0ca8('0x11')](_0xb1a7d9));if(_0xb1a7d9['error']){if(_0xb1a7d9[_0x0ca8('0x12')][_0x0ca8('0x13')]===0x1f4){logger['error'](_0x0ca8('0x14'),_0x3bfdb4,_0xb1a7d9['error']['message']);return _0xef60bd(_0xb1a7d9['error']['message']);}logger[_0x0ca8('0x12')](_0x0ca8('0x14'),_0x3bfdb4,_0xb1a7d9[_0x0ca8('0x12')]['message']);return _0x1fd1e2(_0xb1a7d9[_0x0ca8('0x12')][_0x0ca8('0x15')]);}else{logger[_0x0ca8('0xd')](_0x0ca8('0x14'),_0x3bfdb4,_0x0ca8('0xe'));_0x1fd1e2(_0xb1a7d9[_0x0ca8('0x16')][_0x0ca8('0x15')]);}})[_0x0ca8('0x17')](function(_0x3e8c11){logger[_0x0ca8('0x12')](_0x0ca8('0x14'),_0x3bfdb4,_0x3e8c11);_0xef60bd(_0x3e8c11);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a87cd67..6b221b5 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 _0x5c43=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview','/:id/run','run','/:id/query','query','put','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x5c43,0x13a));var _0x35c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c43[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x35c4('0x0'));var util=require(_0x35c4('0x1'));var path=require(_0x35c4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x35c4('0x3'));var auth=require(_0x35c4('0x4'));var interaction=require(_0x35c4('0x5'));var config=require(_0x35c4('0x6'));var controller=require(_0x35c4('0x7'));router[_0x35c4('0x8')]('/',auth[_0x35c4('0x9')](),controller['index']);router[_0x35c4('0x8')](_0x35c4('0xa'),auth[_0x35c4('0x9')](),controller['show']);router[_0x35c4('0x8')](_0x35c4('0xb'),auth[_0x35c4('0x9')](),controller['preview']);router['get'](_0x35c4('0xc'),auth[_0x35c4('0x9')](),controller[_0x35c4('0xd')]);router['get'](_0x35c4('0xe'),auth[_0x35c4('0x9')](),controller[_0x35c4('0xf')]);router['post']('/',auth[_0x35c4('0x9')](),controller['create']);router[_0x35c4('0x10')](_0x35c4('0xa'),auth[_0x35c4('0x9')](),controller['update']);router[_0x35c4('0x11')](_0x35c4('0xa'),auth[_0x35c4('0x9')](),controller[_0x35c4('0x12')]);module[_0x35c4('0x13')]=router; \ No newline at end of file +var _0x1518=['preview','/:id/run','query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','isAuthenticated','/:id','show','get','/:id/preview'];(function(_0x39abd1,_0x48aea7){var _0x4b1b6e=function(_0x2e96b2){while(--_0x2e96b2){_0x39abd1['push'](_0x39abd1['shift']());}};_0x4b1b6e(++_0x48aea7);}(_0x1518,0xef));var _0x8151=function(_0x576fd3,_0x19bfbc){_0x576fd3=_0x576fd3-0x0;var _0x3331cb=_0x1518[_0x576fd3];return _0x3331cb;};'use strict';var multer=require(_0x8151('0x0'));var util=require(_0x8151('0x1'));var path=require(_0x8151('0x2'));var timeout=require(_0x8151('0x3'));var express=require('express');var router=express[_0x8151('0x4')]();var fs_extra=require(_0x8151('0x5'));var auth=require(_0x8151('0x6'));var interaction=require(_0x8151('0x7'));var config=require('../../config/environment');var controller=require(_0x8151('0x8'));router['get']('/',auth[_0x8151('0x9')](),controller['index']);router['get'](_0x8151('0xa'),auth[_0x8151('0x9')](),controller[_0x8151('0xb')]);router[_0x8151('0xc')](_0x8151('0xd'),auth[_0x8151('0x9')](),controller[_0x8151('0xe')]);router['get'](_0x8151('0xf'),auth[_0x8151('0x9')](),controller['run']);router['get']('/:id/query',auth[_0x8151('0x9')](),controller[_0x8151('0x10')]);router[_0x8151('0x11')]('/',auth[_0x8151('0x9')](),controller['create']);router[_0x8151('0x12')](_0x8151('0xa'),auth[_0x8151('0x9')](),controller[_0x8151('0x13')]);router[_0x8151('0x14')](_0x8151('0xa'),auth[_0x8151('0x9')](),controller[_0x8151('0x15')]);module[_0x8151('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 6125577..8879923 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x2675,0x75));var _0x5267=function(_0x3001bc,_0x34efa4){_0x3001bc=_0x3001bc-0x0;var _0x108766=_0x2675[_0x3001bc];return _0x108766;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0xeda8=['sequelize','exports','STRING','TEXT'];(function(_0x14d584,_0x17c262){var _0x52bb57=function(_0x35ed62){while(--_0x35ed62){_0x14d584['push'](_0x14d584['shift']());}};_0x52bb57(++_0x17c262);}(_0xeda8,0x104));var _0x8eda=function(_0x1cf899,_0x3c818b){_0x1cf899=_0x1cf899-0x0;var _0x5f730f=_0xeda8[_0x1cf899];return _0x5f730f;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8eda('0x2')]},'parent':{'type':Sequelize[_0x8eda('0x2')]},'table':{'type':Sequelize[_0x8eda('0x2')]},'conditions':{'type':Sequelize[_0x8eda('0x3')]},'joins':{'type':Sequelize[_0x8eda('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index d8f7a2b..144d0bc 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 _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x2c0a57,_0x8df764){var _0x4e565e=function(_0x5933ac){while(--_0x5933ac){_0x2c0a57['push'](_0x2c0a57['shift']());}};_0x4e565e(++_0x8df764);}(_0x814b,0x1a2));var _0xb814=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x814b[_0x54de5d];return _0x1b349e;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file +var _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','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','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%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\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0xdc8987,_0x5ec847){_0xdc8987=_0xdc8987-0x0;var _0xb6891c=_0x326f[_0xdc8987];return _0xb6891c;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 07ccb6d..a054827 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 _0xb575=['analytics_default_reports','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport'];(function(_0x5746a3,_0x3cc07d){var _0x30139e=function(_0x267950){while(--_0x267950){_0x5746a3['push'](_0x5746a3['shift']());}};_0x30139e(++_0x3cc07d);}(_0xb575,0xfd));var _0x5b57=function(_0x4b53ed,_0x79b424){_0x4b53ed=_0x4b53ed-0x0;var _0x53b597=_0xb575[_0x4b53ed];return _0x53b597;};'use strict';var _=require(_0x5b57('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5b57('0x1'));var moment=require(_0x5b57('0x2'));var BPromise=require(_0x5b57('0x3'));var rp=require(_0x5b57('0x4'));var fs=require('fs');var path=require(_0x5b57('0x5'));var rimraf=require(_0x5b57('0x6'));var config=require(_0x5b57('0x7'));var attributes=require(_0x5b57('0x8'));module['exports']=function(_0x508b70,_0x49c448){return _0x508b70[_0x5b57('0x9')](_0x5b57('0xa'),attributes,{'tableName':_0x5b57('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeefb=['../../config/environment','./analyticDefaultReport.attributes','exports','analytics_default_reports','lodash','../../config/logger','api','moment','path'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xeefb,0x16c));var _0xbeef=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xeefb[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0xbeef('0x0'));var util=require('util');var logger=require(_0xbeef('0x1'))(_0xbeef('0x2'));var moment=require(_0xbeef('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbeef('0x4'));var rimraf=require('rimraf');var config=require(_0xbeef('0x5'));var attributes=require(_0xbeef('0x6'));module[_0xbeef('0x7')]=function(_0x54cd1e,_0x3ac063){return _0x54cd1e['define']('AnalyticDefaultReport',attributes,{'tableName':_0xbeef('0x8'),'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 2394f61..3f500f6 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 _0xf2d0=['request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0xf2d0,0x17c));var _0x0f2d=function(_0x368024,_0xaf46d9){_0x368024=_0x368024-0x0;var _0x1493f2=_0xf2d0[_0x368024];return _0x1493f2;};'use strict';var _=require(_0x0f2d('0x0'));var util=require(_0x0f2d('0x1'));var moment=require(_0x0f2d('0x2'));var BPromise=require(_0x0f2d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f2d('0x4'));var db=require(_0x0f2d('0x5'))['db'];var utils=require(_0x0f2d('0x6'));var logger=require(_0x0f2d('0x7'))(_0x0f2d('0x8'));var config=require(_0x0f2d('0x9'));var jayson=require(_0x0f2d('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30c672,_0x2f2cd9,_0x46ae97){return new BPromise(function(_0x3c1126,_0x60552a){return client[_0x0f2d('0xb')](_0x30c672,_0x46ae97)[_0x0f2d('0xc')](function(_0x255324){logger[_0x0f2d('0xd')](_0x0f2d('0xe'),_0x2f2cd9,'request\x20sent');logger[_0x0f2d('0xf')](_0x0f2d('0x10'),_0x2f2cd9,_0x0f2d('0x11'),JSON[_0x0f2d('0x12')](_0x255324));if(_0x255324[_0x0f2d('0x13')]){if(_0x255324[_0x0f2d('0x13')][_0x0f2d('0x14')]===0x1f4){logger['error'](_0x0f2d('0xe'),_0x2f2cd9,_0x255324[_0x0f2d('0x13')][_0x0f2d('0x15')]);return _0x60552a(_0x255324['error'][_0x0f2d('0x15')]);}logger[_0x0f2d('0x13')](_0x0f2d('0xe'),_0x2f2cd9,_0x255324[_0x0f2d('0x13')][_0x0f2d('0x15')]);return _0x3c1126(_0x255324[_0x0f2d('0x13')][_0x0f2d('0x15')]);}else{logger[_0x0f2d('0xd')](_0x0f2d('0xe'),_0x2f2cd9,_0x0f2d('0x11'));_0x3c1126(_0x255324[_0x0f2d('0x16')][_0x0f2d('0x15')]);}})['catch'](function(_0x556da3){logger['error'](_0x0f2d('0xe'),_0x2f2cd9,_0x556da3);_0x60552a(_0x556da3);});});} \ No newline at end of file +var _0x8cb0=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8cb0,0xa4));var _0x08cb=function(_0x5a8d4a,_0x4b352d){_0x5a8d4a=_0x5a8d4a-0x0;var _0x4163c7=_0x8cb0[_0x5a8d4a];return _0x4163c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08cb('0x0'));var BPromise=require(_0x08cb('0x1'));var rs=require(_0x08cb('0x2'));var fs=require('fs');var Redis=require(_0x08cb('0x3'));var db=require(_0x08cb('0x4'))['db'];var utils=require(_0x08cb('0x5'));var logger=require(_0x08cb('0x6'))(_0x08cb('0x7'));var config=require(_0x08cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x08cb('0x9')][_0x08cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bee7,_0x401c6d,_0x6cbfad){return new BPromise(function(_0x247c5a,_0x1e08ab){return client[_0x08cb('0xb')](_0x25bee7,_0x6cbfad)[_0x08cb('0xc')](function(_0x3c2035){logger[_0x08cb('0xd')](_0x08cb('0xe'),_0x401c6d,_0x08cb('0xf'));logger['debug'](_0x08cb('0x10'),_0x401c6d,_0x08cb('0xf'),JSON[_0x08cb('0x11')](_0x3c2035));if(_0x3c2035['error']){if(_0x3c2035['error'][_0x08cb('0x12')]===0x1f4){logger[_0x08cb('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x401c6d,_0x3c2035['error'][_0x08cb('0x14')]);return _0x1e08ab(_0x3c2035[_0x08cb('0x13')]['message']);}logger[_0x08cb('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x401c6d,_0x3c2035[_0x08cb('0x13')][_0x08cb('0x14')]);return _0x247c5a(_0x3c2035[_0x08cb('0x13')][_0x08cb('0x14')]);}else{logger['info'](_0x08cb('0xe'),_0x401c6d,_0x08cb('0xf'));_0x247c5a(_0x3c2035[_0x08cb('0x15')][_0x08cb('0x14')]);}})[_0x08cb('0x16')](function(_0x21b562){logger[_0x08cb('0x13')](_0x08cb('0xe'),_0x401c6d,_0x21b562);_0x1e08ab(_0x21b562);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index dca5175..a196dde 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 _0x1c23=['../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x32a513,_0x53fa9d){var _0x5d6bb6=function(_0x29eff3){while(--_0x29eff3){_0x32a513['push'](_0x32a513['shift']());}};_0x5d6bb6(++_0x53fa9d);}(_0x1c23,0x1d5));var _0x31c2=function(_0xbd0738,_0x20fd70){_0xbd0738=_0xbd0738-0x0;var _0x5bee5d=_0x1c23[_0xbd0738];return _0x5bee5d;};'use strict';var multer=require(_0x31c2('0x0'));var util=require(_0x31c2('0x1'));var path=require(_0x31c2('0x2'));var timeout=require(_0x31c2('0x3'));var express=require(_0x31c2('0x4'));var router=express[_0x31c2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x31c2('0x6'));var interaction=require(_0x31c2('0x7'));var config=require('../../config/environment');var controller=require(_0x31c2('0x8'));router[_0x31c2('0x9')]('/',auth[_0x31c2('0xa')](),controller[_0x31c2('0xb')]);router[_0x31c2('0x9')]('/:id',auth[_0x31c2('0xa')](),controller[_0x31c2('0xc')]);router[_0x31c2('0x9')](_0x31c2('0xd'),auth[_0x31c2('0xa')](),controller['preview']);router['get'](_0x31c2('0xe'),auth[_0x31c2('0xa')](),controller[_0x31c2('0xf')]);router[_0x31c2('0x9')](_0x31c2('0x10'),auth[_0x31c2('0xa')](),controller['query']);router[_0x31c2('0x11')]('/',auth['isAuthenticated'](),controller[_0x31c2('0x12')]);router[_0x31c2('0x13')](_0x31c2('0x14'),auth['isAuthenticated'](),controller[_0x31c2('0x15')]);router[_0x31c2('0x16')]('/:id',auth[_0x31c2('0xa')](),controller[_0x31c2('0x17')]);module[_0x31c2('0x18')]=router; \ No newline at end of file +var _0xdefa=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdefa,0xce));var _0xadef=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xdefa[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xadef('0x0'));var util=require(_0xadef('0x1'));var path=require(_0xadef('0x2'));var timeout=require('connect-timeout');var express=require(_0xadef('0x3'));var router=express[_0xadef('0x4')]();var fs_extra=require(_0xadef('0x5'));var auth=require(_0xadef('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xadef('0x7'));router[_0xadef('0x8')]('/',auth[_0xadef('0x9')](),controller[_0xadef('0xa')]);router[_0xadef('0x8')](_0xadef('0xb'),auth[_0xadef('0x9')](),controller[_0xadef('0xc')]);router['get'](_0xadef('0xd'),auth[_0xadef('0x9')](),controller[_0xadef('0xe')]);router[_0xadef('0x8')](_0xadef('0xf'),auth[_0xadef('0x9')](),controller[_0xadef('0x10')]);router['get'](_0xadef('0x11'),auth[_0xadef('0x9')](),controller[_0xadef('0x12')]);router[_0xadef('0x13')]('/',auth[_0xadef('0x9')](),controller['create']);router['put'](_0xadef('0xb'),auth[_0xadef('0x9')](),controller[_0xadef('0x14')]);router[_0xadef('0x15')]('/:id',auth[_0xadef('0x9')](),controller[_0xadef('0x16')]);module[_0xadef('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 28e9c69..1ea8e49 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 _0xb665=['STRING','ENUM','csv','pdf','DATE','Loading','INTEGER','UNSIGNED','sequelize'];(function(_0x25b2e9,_0x1c8bb3){var _0x50174d=function(_0x20c9b5){while(--_0x20c9b5){_0x25b2e9['push'](_0x25b2e9['shift']());}};_0x50174d(++_0x1c8bb3);}(_0xb665,0x182));var _0x5b66=function(_0x16d644,_0x46545e){_0x16d644=_0x16d644-0x0;var _0xf808cc=_0xb665[_0x16d644];return _0xf808cc;};'use strict';var Sequelize=require(_0x5b66('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x5b66('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x5b66('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x5b66('0x2')](_0x5b66('0x3'),_0x5b66('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x5b66('0x3')},'savename':{'type':Sequelize[_0x5b66('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5b66('0x5')]},'endDate':{'type':Sequelize[_0x5b66('0x5')]},'status':{'type':Sequelize[_0x5b66('0x1')],'defaultValue':_0x5b66('0x6')},'type':{'type':Sequelize[_0x5b66('0x2')]('manual','scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x5b66('0x7')](0xb)[_0x5b66('0x8')]},'reportType':{'type':Sequelize[_0x5b66('0x1')]}}; \ No newline at end of file +var _0xaa3a=['xlsx','csv','DATE','ENUM','manual','scheduled','INTEGER','sequelize','exports','STRING','pdf'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xaa3a,0xe3));var _0xaaa3=function(_0x2b6c01,_0x4a1d39){_0x2b6c01=_0x2b6c01-0x0;var _0x4c051e=_0xaa3a[_0x2b6c01];return _0x4c051e;};'use strict';var Sequelize=require(_0xaaa3('0x0'));var moment=require('moment');module[_0xaaa3('0x1')]={'name':{'type':Sequelize[_0xaaa3('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xaaa3('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xaaa3('0x3'),_0xaaa3('0x4')),'allowNull':![],'defaultValue':_0xaaa3('0x5')},'savename':{'type':Sequelize[_0xaaa3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xaaa3('0x6')]},'status':{'type':Sequelize[_0xaaa3('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xaaa3('0x7')](_0xaaa3('0x8'),_0xaaa3('0x9')),'allowNull':![],'defaultValue':_0xaaa3('0x8')},'reportId':{'type':Sequelize[_0xaaa3('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xaaa3('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index b0dab74..683cec6 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 _0x5b69=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','ExtractedReports','end','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','params','fields','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5b69,0x196));var _0x95b6=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x5b69[_0x230951];return _0xeb26b1;};'use strict';var emlformat=require(_0x95b6('0x0'));var rimraf=require(_0x95b6('0x1'));var zipdir=require(_0x95b6('0x2'));var jsonpatch=require(_0x95b6('0x3'));var rp=require(_0x95b6('0x4'));var moment=require(_0x95b6('0x5'));var BPromise=require(_0x95b6('0x6'));var Mustache=require('mustache');var util=require(_0x95b6('0x7'));var path=require(_0x95b6('0x8'));var sox=require(_0x95b6('0x9'));var csv=require(_0x95b6('0xa'));var ejs=require(_0x95b6('0xb'));var fs=require('fs');var fs_extra=require(_0x95b6('0xc'));var _=require(_0x95b6('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95b6('0xe'));var deskjs=require(_0x95b6('0xf'));var toCsv=require(_0x95b6('0xa'));var querystring=require('querystring');var Papa=require(_0x95b6('0x10'));var Redis=require('ioredis');var authService=require(_0x95b6('0x11'));var qs=require(_0x95b6('0x12'));var as=require(_0x95b6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95b6('0x14'))(_0x95b6('0x15'));var utils=require(_0x95b6('0x16'));var config=require(_0x95b6('0x17'));var licenseUtil=require(_0x95b6('0x18'));var db=require(_0x95b6('0x19'))['db'];function respondWithStatusCode(_0x85cca4,_0x45ef95){_0x45ef95=_0x45ef95||0xcc;return function(_0x2eeecd){if(_0x2eeecd){return _0x85cca4[_0x95b6('0x1a')](_0x45ef95);}return _0x85cca4[_0x95b6('0x1b')](_0x45ef95)['end']();};}function respondWithResult(_0x7e3f54,_0x1e18c1){_0x1e18c1=_0x1e18c1||0xc8;return function(_0x4eeb00){if(_0x4eeb00){return _0x7e3f54[_0x95b6('0x1b')](_0x1e18c1)[_0x95b6('0x1c')](_0x4eeb00);}};}function respondWithFilteredResult(_0x363d7b,_0x17da31){return function(_0x55981d){if(_0x55981d){var _0x53cfb3=typeof _0x17da31[_0x95b6('0x1d')]===_0x95b6('0x1e')&&typeof _0x17da31[_0x95b6('0x1f')]==='undefined';var _0x3f56e9=_0x55981d[_0x95b6('0x20')];var _0x215e68=_0x53cfb3?0x0:_0x17da31[_0x95b6('0x1d')];var _0x4e0d91=_0x53cfb3?_0x55981d[_0x95b6('0x20')]:_0x17da31['offset']+_0x17da31[_0x95b6('0x1f')];var _0x32b954;if(_0x4e0d91>=_0x3f56e9){_0x4e0d91=_0x3f56e9;_0x32b954=0xc8;}else{_0x32b954=0xce;}_0x363d7b['status'](_0x32b954);return _0x363d7b[_0x95b6('0x21')]('Content-Range',_0x215e68+'-'+_0x4e0d91+'/'+_0x3f56e9)['json'](_0x55981d);}return null;};}function patchUpdates(_0x4c4af0){return function(_0x4f8e6d){try{jsonpatch[_0x95b6('0x22')](_0x4f8e6d,_0x4c4af0,!![]);}catch(_0x572045){return BPromise['reject'](_0x572045);}return _0x4f8e6d[_0x95b6('0x23')]();};}function saveUpdates(_0x4e5857,_0x3249e4){return function(_0x28be63){if(_0x28be63){return _0x28be63[_0x95b6('0x24')](_0x4e5857)[_0x95b6('0x25')](function(_0x1067af){return _0x1067af;});}return null;};}function removeEntity(_0x1b6c53,_0x1f60a8){return function(_0x12469c){if(_0x12469c){return _0x12469c[_0x95b6('0x26')]()[_0x95b6('0x25')](function(){var _0x4e3642=_0x12469c[_0x95b6('0x27')]({'plain':!![]});var _0x36b5e4=_0x95b6('0x28');return db['UserProfileResource'][_0x95b6('0x26')]({'where':{'type':_0x36b5e4,'resourceId':_0x4e3642['id']}})['then'](function(){return _0x12469c;});})[_0x95b6('0x25')](function(){_0x1b6c53[_0x95b6('0x1b')](0xcc)[_0x95b6('0x29')]();});}};}function handleEntityNotFound(_0xcdb57d,_0x346fe5){return function(_0x33a352){if(!_0x33a352){_0xcdb57d['sendStatus'](0x194);}return _0x33a352;};}function handleError(_0x7a8a46,_0x5c4c1c){_0x5c4c1c=_0x5c4c1c||0x1f4;return function(_0x352f69){logger['error'](_0x352f69[_0x95b6('0x2a')]);if(_0x352f69[_0x95b6('0x2b')]){delete _0x352f69[_0x95b6('0x2b')];}_0x7a8a46[_0x95b6('0x1b')](_0x5c4c1c)['send'](_0x352f69);};}exports[_0x95b6('0x2c')]=function(_0xce7965,_0x321e27){var _0x59bfec={},_0x464f23={},_0x3c91ee={'count':0x0,'rows':[]};var _0x1167d9=_[_0x95b6('0x2d')](db[_0x95b6('0x2e')][_0x95b6('0x2f')],function(_0x4f5331){return{'name':_0x4f5331[_0x95b6('0x30')],'type':_0x4f5331['type'][_0x95b6('0x31')]};});_0x464f23['model']=_[_0x95b6('0x2d')](_0x1167d9,'name');_0x464f23['query']=_[_0x95b6('0x32')](_0xce7965[_0x95b6('0x33')]);_0x464f23[_0x95b6('0x34')]=_[_0x95b6('0x35')](_0x464f23[_0x95b6('0x36')],_0x464f23[_0x95b6('0x33')]);_0x59bfec[_0x95b6('0x37')]=_[_0x95b6('0x35')](_0x464f23[_0x95b6('0x36')],qs['fields'](_0xce7965[_0x95b6('0x33')]['fields']));_0x59bfec[_0x95b6('0x37')]=_0x59bfec[_0x95b6('0x37')]['length']?_0x59bfec[_0x95b6('0x37')]:_0x464f23[_0x95b6('0x36')];if(!_0xce7965[_0x95b6('0x33')][_0x95b6('0x38')](_0x95b6('0x39'))){_0x59bfec[_0x95b6('0x1f')]=qs[_0x95b6('0x1f')](_0xce7965[_0x95b6('0x33')][_0x95b6('0x1f')]);_0x59bfec[_0x95b6('0x1d')]=qs[_0x95b6('0x1d')](_0xce7965[_0x95b6('0x33')][_0x95b6('0x1d')]);}_0x59bfec['order']=qs[_0x95b6('0x3a')](_0xce7965['query']['sort']);_0x59bfec['where']=qs[_0x95b6('0x34')](_[_0x95b6('0x3b')](_0xce7965['query'],_0x464f23[_0x95b6('0x34')]),_0x1167d9);if(_0xce7965[_0x95b6('0x33')][_0x95b6('0x3c')]){_0x59bfec[_0x95b6('0x3d')]=_[_0x95b6('0x3e')](_0x59bfec['where'],{'$or':_[_0x95b6('0x2d')](_0x1167d9,function(_0x17067e){if(_0x17067e[_0x95b6('0x3f')]!=='VIRTUAL'){var _0x755c50={};_0x755c50[_0x17067e[_0x95b6('0x2b')]]={'$like':'%'+_0xce7965[_0x95b6('0x33')][_0x95b6('0x3c')]+'%'};return _0x755c50;}})});}_0x59bfec=_[_0x95b6('0x3e')]({},_0x59bfec,_0xce7965[_0x95b6('0x40')]);var _0x4b07ef={'where':_0x59bfec['where']};return db[_0x95b6('0x2e')][_0x95b6('0x20')](_0x4b07ef)['then'](function(_0x579713){_0x3c91ee[_0x95b6('0x20')]=_0x579713;if(_0xce7965[_0x95b6('0x33')][_0x95b6('0x41')]){_0x59bfec[_0x95b6('0x42')]=[{'all':!![]}];}return db[_0x95b6('0x2e')][_0x95b6('0x43')](_0x59bfec);})[_0x95b6('0x25')](function(_0x5d5005){_0x3c91ee[_0x95b6('0x44')]=_0x5d5005;return _0x3c91ee;})['then'](respondWithFilteredResult(_0x321e27,_0x59bfec))['catch'](handleError(_0x321e27,null));};exports['show']=function(_0x49dd58,_0x56f379){var _0x282692={'raw':!![],'where':{'id':_0x49dd58[_0x95b6('0x45')]['id']}},_0x1c36bc={};_0x1c36bc[_0x95b6('0x36')]=_['keys'](db[_0x95b6('0x2e')][_0x95b6('0x2f')]);_0x1c36bc[_0x95b6('0x33')]=_[_0x95b6('0x32')](_0x49dd58[_0x95b6('0x33')]);_0x1c36bc[_0x95b6('0x34')]=_['intersection'](_0x1c36bc['model'],_0x1c36bc[_0x95b6('0x33')]);_0x282692[_0x95b6('0x37')]=_[_0x95b6('0x35')](_0x1c36bc['model'],qs[_0x95b6('0x46')](_0x49dd58[_0x95b6('0x33')]['fields']));_0x282692[_0x95b6('0x37')]=_0x282692['attributes'][_0x95b6('0x47')]?_0x282692['attributes']:_0x1c36bc[_0x95b6('0x36')];if(_0x49dd58[_0x95b6('0x33')][_0x95b6('0x41')]){_0x282692[_0x95b6('0x42')]=[{'all':!![]}];}_0x282692=_[_0x95b6('0x3e')]({},_0x282692,_0x49dd58['options']);return db[_0x95b6('0x2e')][_0x95b6('0x48')](_0x282692)['then'](handleEntityNotFound(_0x56f379,null))[_0x95b6('0x25')](respondWithResult(_0x56f379,null))[_0x95b6('0x49')](handleError(_0x56f379,null));};exports[_0x95b6('0x4a')]=function(_0x230fee,_0x1c1b08){return db[_0x95b6('0x2e')][_0x95b6('0x4a')](_0x230fee[_0x95b6('0x4b')],{})['then'](function(_0x68d7d4){var _0x552c35=_0x230fee[_0x95b6('0x4c')][_0x95b6('0x27')]({'plain':!![]});if(!_0x552c35)throw new Error(_0x95b6('0x4d'));if(_0x552c35[_0x95b6('0x4e')]===_0x95b6('0x4c')){var _0x481ff7=_0x68d7d4['get']({'plain':!![]});var _0x979e71=_0x95b6('0x28');return db[_0x95b6('0x4f')][_0x95b6('0x48')]({'where':{'name':_0x979e71,'userProfileId':_0x552c35[_0x95b6('0x50')]},'raw':!![]})[_0x95b6('0x25')](function(_0x58394d){if(_0x58394d&&_0x58394d[_0x95b6('0x51')]===0x0){return db[_0x95b6('0x52')][_0x95b6('0x4a')]({'name':_0x481ff7[_0x95b6('0x2b')],'resourceId':_0x481ff7['id'],'type':_0x58394d['name'],'sectionId':_0x58394d['id']},{})[_0x95b6('0x25')](function(){return _0x68d7d4;});}else{return _0x68d7d4;}})[_0x95b6('0x49')](function(_0x193af8){logger[_0x95b6('0x53')](_0x95b6('0x54'),_0x193af8);throw _0x193af8;});}return _0x68d7d4;})['then'](respondWithResult(_0x1c1b08,0xc9))[_0x95b6('0x49')](handleError(_0x1c1b08,null));};exports['update']=function(_0x38063b,_0x5b214c){if(_0x38063b[_0x95b6('0x4b')]['id']){delete _0x38063b[_0x95b6('0x4b')]['id'];}return db[_0x95b6('0x2e')][_0x95b6('0x48')]({'where':{'id':_0x38063b[_0x95b6('0x45')]['id']}})[_0x95b6('0x25')](handleEntityNotFound(_0x5b214c,null))[_0x95b6('0x25')](saveUpdates(_0x38063b['body'],null))[_0x95b6('0x25')](respondWithResult(_0x5b214c,null))['catch'](handleError(_0x5b214c,null));};exports[_0x95b6('0x26')]=function(_0x3b97f0,_0x41603f){return db[_0x95b6('0x2e')][_0x95b6('0x48')]({'where':{'id':_0x3b97f0[_0x95b6('0x45')]['id']}})[_0x95b6('0x25')](handleEntityNotFound(_0x41603f,null))[_0x95b6('0x25')](removeEntity(_0x41603f,null))['catch'](handleError(_0x41603f,null));};exports['download']=function(_0x251e78,_0x13f211,_0x157ce2){return db[_0x95b6('0x2e')][_0x95b6('0x48')]({'where':{'id':_0x251e78[_0x95b6('0x45')]['id']},'attributes':['name',_0x95b6('0x55'),_0x95b6('0x56'),_0x95b6('0x57')],'raw':!![]})[_0x95b6('0x25')](handleEntityNotFound(_0x13f211,null))[_0x95b6('0x25')](function(_0x9bedf2){if(_0x9bedf2){if(!fs[_0x95b6('0x58')](path[_0x95b6('0x59')](config[_0x95b6('0x5a')],_0x95b6('0x5b'),_0x9bedf2['savename']))){throw new db[(_0x95b6('0x5c'))][(_0x95b6('0x5d'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x251e78['query'][_0x95b6('0x5e')]){return _0x13f211['sendStatus'](0xc8);}return _0x13f211['download'](path['join'](config[_0x95b6('0x5a')],_0x95b6('0x5b'),_0x9bedf2[_0x95b6('0x56')]),util[_0x95b6('0x5f')](_0x95b6('0x60'),_0x9bedf2[_0x95b6('0x55')]||_0x9bedf2['name'],_0x9bedf2[_0x95b6('0x57')][_0x95b6('0x61')]()));}})['catch'](handleError(_0x13f211,null));}; \ No newline at end of file +var _0xbadb=['merge','options','AnalyticExtractedReport','include','findAll','rows','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL'];(function(_0x261caf,_0x28a159){var _0x54d8d0=function(_0x3534b2){while(--_0x3534b2){_0x261caf['push'](_0x261caf['shift']());}};_0x54d8d0(++_0x28a159);}(_0xbadb,0x7a));var _0xbbad=function(_0x159d72,_0x2f17b5){_0x159d72=_0x159d72-0x0;var _0x499d86=_0xbadb[_0x159d72];return _0x499d86;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbbad('0x0'));var jsonpatch=require(_0xbbad('0x1'));var rp=require('request-promise');var moment=require(_0xbbad('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbbad('0x3'));var util=require(_0xbbad('0x4'));var path=require(_0xbbad('0x5'));var sox=require(_0xbbad('0x6'));var csv=require(_0xbbad('0x7'));var ejs=require(_0xbbad('0x8'));var fs=require('fs');var fs_extra=require(_0xbbad('0x9'));var _=require('lodash');var squel=require(_0xbbad('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbbad('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbbad('0xc'));var Papa=require(_0xbbad('0xd'));var Redis=require(_0xbbad('0xe'));var authService=require(_0xbbad('0xf'));var qs=require(_0xbbad('0x10'));var as=require(_0xbbad('0x11'));var hardwareService=require(_0xbbad('0x12'));var logger=require('../../config/logger')(_0xbbad('0x13'));var utils=require('../../config/utils');var config=require(_0xbbad('0x14'));var licenseUtil=require(_0xbbad('0x15'));var db=require(_0xbbad('0x16'))['db'];function respondWithStatusCode(_0x1ac846,_0x2a65ed){_0x2a65ed=_0x2a65ed||0xcc;return function(_0x180821){if(_0x180821){return _0x1ac846[_0xbbad('0x17')](_0x2a65ed);}return _0x1ac846['status'](_0x2a65ed)['end']();};}function respondWithResult(_0x4ce1a2,_0x3efc20){_0x3efc20=_0x3efc20||0xc8;return function(_0x465f30){if(_0x465f30){return _0x4ce1a2['status'](_0x3efc20)['json'](_0x465f30);}};}function respondWithFilteredResult(_0xe920d5,_0x1f7759){return function(_0x1536fa){if(_0x1536fa){var _0x5a099d=typeof _0x1f7759[_0xbbad('0x18')]===_0xbbad('0x19')&&typeof _0x1f7759[_0xbbad('0x1a')]===_0xbbad('0x19');var _0x51fd3c=_0x1536fa[_0xbbad('0x1b')];var _0x35ee0b=_0x5a099d?0x0:_0x1f7759[_0xbbad('0x18')];var _0x1a6f94=_0x5a099d?_0x1536fa[_0xbbad('0x1b')]:_0x1f7759[_0xbbad('0x18')]+_0x1f7759['limit'];var _0x30978c;if(_0x1a6f94>=_0x51fd3c){_0x1a6f94=_0x51fd3c;_0x30978c=0xc8;}else{_0x30978c=0xce;}_0xe920d5[_0xbbad('0x1c')](_0x30978c);return _0xe920d5['set'](_0xbbad('0x1d'),_0x35ee0b+'-'+_0x1a6f94+'/'+_0x51fd3c)[_0xbbad('0x1e')](_0x1536fa);}return null;};}function patchUpdates(_0x30ccd6){return function(_0x14d4a0){try{jsonpatch[_0xbbad('0x1f')](_0x14d4a0,_0x30ccd6,!![]);}catch(_0x37bfcf){return BPromise[_0xbbad('0x20')](_0x37bfcf);}return _0x14d4a0[_0xbbad('0x21')]();};}function saveUpdates(_0x2c436f,_0x13adbb){return function(_0x4056c7){if(_0x4056c7){return _0x4056c7[_0xbbad('0x22')](_0x2c436f)[_0xbbad('0x23')](function(_0x30576f){return _0x30576f;});}return null;};}function removeEntity(_0x3a8bbc,_0x29eb21){return function(_0x40716f){if(_0x40716f){return _0x40716f['destroy']()[_0xbbad('0x23')](function(){var _0x1a3717=_0x40716f[_0xbbad('0x24')]({'plain':!![]});var _0x5cd3f9=_0xbbad('0x25');return db[_0xbbad('0x26')]['destroy']({'where':{'type':_0x5cd3f9,'resourceId':_0x1a3717['id']}})[_0xbbad('0x23')](function(){return _0x40716f;});})[_0xbbad('0x23')](function(){_0x3a8bbc[_0xbbad('0x1c')](0xcc)[_0xbbad('0x27')]();});}};}function handleEntityNotFound(_0x431aba,_0x1e6e6b){return function(_0x1958e4){if(!_0x1958e4){_0x431aba[_0xbbad('0x17')](0x194);}return _0x1958e4;};}function handleError(_0xf4ad71,_0xd7a501){_0xd7a501=_0xd7a501||0x1f4;return function(_0x132def){logger[_0xbbad('0x28')](_0x132def[_0xbbad('0x29')]);if(_0x132def[_0xbbad('0x2a')]){delete _0x132def[_0xbbad('0x2a')];}_0xf4ad71[_0xbbad('0x1c')](_0xd7a501)['send'](_0x132def);};}exports[_0xbbad('0x2b')]=function(_0x27db72,_0x37d187){var _0x11cbe7={},_0x1597a0={},_0x541c9f={'count':0x0,'rows':[]};var _0x2c2956=_[_0xbbad('0x2c')](db['AnalyticExtractedReport'][_0xbbad('0x2d')],function(_0x48fb00){return{'name':_0x48fb00[_0xbbad('0x2e')],'type':_0x48fb00['type'][_0xbbad('0x2f')]};});_0x1597a0['model']=_[_0xbbad('0x2c')](_0x2c2956,'name');_0x1597a0[_0xbbad('0x30')]=_['keys'](_0x27db72[_0xbbad('0x30')]);_0x1597a0[_0xbbad('0x31')]=_[_0xbbad('0x32')](_0x1597a0[_0xbbad('0x33')],_0x1597a0[_0xbbad('0x30')]);_0x11cbe7[_0xbbad('0x34')]=_['intersection'](_0x1597a0[_0xbbad('0x33')],qs['fields'](_0x27db72['query'][_0xbbad('0x35')]));_0x11cbe7[_0xbbad('0x34')]=_0x11cbe7['attributes'][_0xbbad('0x36')]?_0x11cbe7[_0xbbad('0x34')]:_0x1597a0['model'];if(!_0x27db72[_0xbbad('0x30')][_0xbbad('0x37')]('nolimit')){_0x11cbe7[_0xbbad('0x1a')]=qs['limit'](_0x27db72[_0xbbad('0x30')][_0xbbad('0x1a')]);_0x11cbe7[_0xbbad('0x18')]=qs[_0xbbad('0x18')](_0x27db72['query']['offset']);}_0x11cbe7[_0xbbad('0x38')]=qs[_0xbbad('0x39')](_0x27db72[_0xbbad('0x30')][_0xbbad('0x39')]);_0x11cbe7[_0xbbad('0x3a')]=qs['filters'](_['pick'](_0x27db72[_0xbbad('0x30')],_0x1597a0['filters']),_0x2c2956);if(_0x27db72[_0xbbad('0x30')][_0xbbad('0x3b')]){_0x11cbe7[_0xbbad('0x3a')]=_['merge'](_0x11cbe7['where'],{'$or':_['map'](_0x2c2956,function(_0x46de10){if(_0x46de10[_0xbbad('0x3c')]!==_0xbbad('0x3d')){var _0x120d39={};_0x120d39[_0x46de10[_0xbbad('0x2a')]]={'$like':'%'+_0x27db72[_0xbbad('0x30')][_0xbbad('0x3b')]+'%'};return _0x120d39;}})});}_0x11cbe7=_[_0xbbad('0x3e')]({},_0x11cbe7,_0x27db72[_0xbbad('0x3f')]);var _0x3c6670={'where':_0x11cbe7['where']};return db[_0xbbad('0x40')]['count'](_0x3c6670)[_0xbbad('0x23')](function(_0x2964aa){_0x541c9f[_0xbbad('0x1b')]=_0x2964aa;if(_0x27db72[_0xbbad('0x30')]['includeAll']){_0x11cbe7[_0xbbad('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xbbad('0x42')](_0x11cbe7);})[_0xbbad('0x23')](function(_0x521619){_0x541c9f[_0xbbad('0x43')]=_0x521619;return _0x541c9f;})[_0xbbad('0x23')](respondWithFilteredResult(_0x37d187,_0x11cbe7))[_0xbbad('0x44')](handleError(_0x37d187,null));};exports['show']=function(_0x54a8c4,_0x1a6249){var _0x185bf9={'raw':!![],'where':{'id':_0x54a8c4['params']['id']}},_0x5dfb72={};_0x5dfb72[_0xbbad('0x33')]=_[_0xbbad('0x45')](db[_0xbbad('0x40')][_0xbbad('0x2d')]);_0x5dfb72[_0xbbad('0x30')]=_['keys'](_0x54a8c4['query']);_0x5dfb72['filters']=_[_0xbbad('0x32')](_0x5dfb72[_0xbbad('0x33')],_0x5dfb72['query']);_0x185bf9[_0xbbad('0x34')]=_['intersection'](_0x5dfb72[_0xbbad('0x33')],qs[_0xbbad('0x35')](_0x54a8c4[_0xbbad('0x30')][_0xbbad('0x35')]));_0x185bf9[_0xbbad('0x34')]=_0x185bf9[_0xbbad('0x34')][_0xbbad('0x36')]?_0x185bf9[_0xbbad('0x34')]:_0x5dfb72[_0xbbad('0x33')];if(_0x54a8c4[_0xbbad('0x30')]['includeAll']){_0x185bf9[_0xbbad('0x41')]=[{'all':!![]}];}_0x185bf9=_[_0xbbad('0x3e')]({},_0x185bf9,_0x54a8c4[_0xbbad('0x3f')]);return db['AnalyticExtractedReport'][_0xbbad('0x46')](_0x185bf9)[_0xbbad('0x23')](handleEntityNotFound(_0x1a6249,null))['then'](respondWithResult(_0x1a6249,null))['catch'](handleError(_0x1a6249,null));};exports[_0xbbad('0x47')]=function(_0x2da1dc,_0x5252bc){return db[_0xbbad('0x40')]['create'](_0x2da1dc[_0xbbad('0x48')],{})[_0xbbad('0x23')](function(_0x36bf25){var _0xf7c0a1=_0x2da1dc[_0xbbad('0x49')][_0xbbad('0x24')]({'plain':!![]});if(!_0xf7c0a1)throw new Error(_0xbbad('0x4a'));if(_0xf7c0a1[_0xbbad('0x4b')]===_0xbbad('0x49')){var _0x110301=_0x36bf25[_0xbbad('0x24')]({'plain':!![]});var _0x59f015='ExtractedReports';return db['UserProfileSection']['find']({'where':{'name':_0x59f015,'userProfileId':_0xf7c0a1[_0xbbad('0x4c')]},'raw':!![]})[_0xbbad('0x23')](function(_0x7ec275){if(_0x7ec275&&_0x7ec275[_0xbbad('0x4d')]===0x0){return db[_0xbbad('0x26')][_0xbbad('0x47')]({'name':_0x110301[_0xbbad('0x2a')],'resourceId':_0x110301['id'],'type':_0x7ec275[_0xbbad('0x2a')],'sectionId':_0x7ec275['id']},{})[_0xbbad('0x23')](function(){return _0x36bf25;});}else{return _0x36bf25;}})[_0xbbad('0x44')](function(_0x37d151){logger[_0xbbad('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d151);throw _0x37d151;});}return _0x36bf25;})[_0xbbad('0x23')](respondWithResult(_0x5252bc,0xc9))[_0xbbad('0x44')](handleError(_0x5252bc,null));};exports[_0xbbad('0x22')]=function(_0x308542,_0x39c7f9){if(_0x308542[_0xbbad('0x48')]['id']){delete _0x308542[_0xbbad('0x48')]['id'];}return db[_0xbbad('0x40')]['find']({'where':{'id':_0x308542[_0xbbad('0x4e')]['id']}})['then'](handleEntityNotFound(_0x39c7f9,null))[_0xbbad('0x23')](saveUpdates(_0x308542['body'],null))[_0xbbad('0x23')](respondWithResult(_0x39c7f9,null))[_0xbbad('0x44')](handleError(_0x39c7f9,null));};exports['destroy']=function(_0x540922,_0x55825a){return db[_0xbbad('0x40')]['find']({'where':{'id':_0x540922[_0xbbad('0x4e')]['id']}})[_0xbbad('0x23')](handleEntityNotFound(_0x55825a,null))[_0xbbad('0x23')](removeEntity(_0x55825a,null))[_0xbbad('0x44')](handleError(_0x55825a,null));};exports[_0xbbad('0x4f')]=function(_0x43c667,_0x280340,_0x293123){return db[_0xbbad('0x40')][_0xbbad('0x46')]({'where':{'id':_0x43c667[_0xbbad('0x4e')]['id']},'attributes':[_0xbbad('0x2a'),_0xbbad('0x50'),_0xbbad('0x51'),_0xbbad('0x52')],'raw':!![]})[_0xbbad('0x23')](handleEntityNotFound(_0x280340,null))[_0xbbad('0x23')](function(_0x5c8b28){if(_0x5c8b28){if(!fs[_0xbbad('0x53')](path[_0xbbad('0x54')](config[_0xbbad('0x55')],_0xbbad('0x56'),_0x5c8b28[_0xbbad('0x51')]))){throw new db['Sequelize'][(_0xbbad('0x57'))](_0xbbad('0x58'));}if(_0x43c667[_0xbbad('0x30')][_0xbbad('0x59')]){return _0x280340['sendStatus'](0xc8);}return _0x280340[_0xbbad('0x4f')](path['join'](config[_0xbbad('0x55')],_0xbbad('0x56'),_0x5c8b28[_0xbbad('0x51')]),util[_0xbbad('0x5a')](_0xbbad('0x5b'),_0x5c8b28[_0xbbad('0x50')]||_0x5c8b28[_0xbbad('0x2a')],_0x5c8b28[_0xbbad('0x52')]['toLowerCase']()));}})[_0xbbad('0x44')](handleError(_0x280340,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index f41334d..4ecedc0 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 _0xe1ea=['define','analytics_extracted_reports','lodash','util','../../config/logger','api','request-promise','path','rimraf','exports'];(function(_0x220771,_0x1768d3){var _0x2ccdff=function(_0xc0d442){while(--_0xc0d442){_0x220771['push'](_0x220771['shift']());}};_0x2ccdff(++_0x1768d3);}(_0xe1ea,0x12e));var _0xae1e=function(_0x820ce2,_0x5961e1){_0x820ce2=_0x820ce2-0x0;var _0x37bce1=_0xe1ea[_0x820ce2];return _0x37bce1;};'use strict';var _=require(_0xae1e('0x0'));var util=require(_0xae1e('0x1'));var logger=require(_0xae1e('0x2'))(_0xae1e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xae1e('0x4'));var fs=require('fs');var path=require(_0xae1e('0x5'));var rimraf=require(_0xae1e('0x6'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0xae1e('0x7')]=function(_0x1c2049,_0x5536a5){return _0x1c2049[_0xae1e('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0xae1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc04d=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1315cb,_0x14ed5f){var _0x30f6df=function(_0x16d9fa){while(--_0x16d9fa){_0x1315cb['push'](_0x1315cb['shift']());}};_0x30f6df(++_0x14ed5f);}(_0xc04d,0x1d1));var _0xdc04=function(_0x4a4d88,_0x2be95a){_0x4a4d88=_0x4a4d88-0x0;var _0x479329=_0xc04d[_0x4a4d88];return _0x479329;};'use strict';var _=require(_0xdc04('0x0'));var util=require('util');var logger=require(_0xdc04('0x1'))(_0xdc04('0x2'));var moment=require('moment');var BPromise=require(_0xdc04('0x3'));var rp=require(_0xdc04('0x4'));var fs=require('fs');var path=require(_0xdc04('0x5'));var rimraf=require(_0xdc04('0x6'));var config=require(_0xdc04('0x7'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x6401b8,_0x3cd840){return _0x6401b8[_0xdc04('0x8')](_0xdc04('0x9'),attributes,{'tableName':_0xdc04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 7edc9c2..76637e7 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 _0x2e32=['../../config/environment','jayson/promise','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc2dbce,_0x26eebe){var _0x4ccaf7=function(_0x551ed0){while(--_0x551ed0){_0xc2dbce['push'](_0xc2dbce['shift']());}};_0x4ccaf7(++_0x26eebe);}(_0x2e32,0x186));var _0x22e3=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x2e32[_0x411017];return _0x2adeea;};'use strict';var _=require(_0x22e3('0x0'));var util=require(_0x22e3('0x1'));var moment=require(_0x22e3('0x2'));var BPromise=require(_0x22e3('0x3'));var rs=require(_0x22e3('0x4'));var fs=require('fs');var Redis=require(_0x22e3('0x5'));var db=require(_0x22e3('0x6'))['db'];var utils=require(_0x22e3('0x7'));var logger=require(_0x22e3('0x8'))(_0x22e3('0x9'));var config=require(_0x22e3('0xa'));var jayson=require(_0x22e3('0xb'));var client=jayson['client'][_0x22e3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x56a2c5,_0x512e3b,_0x30a19b){return new BPromise(function(_0x2de007,_0x372093){return client[_0x22e3('0xd')](_0x56a2c5,_0x30a19b)[_0x22e3('0xe')](function(_0x11fed9){logger[_0x22e3('0xf')](_0x22e3('0x10'),_0x512e3b,'request\x20sent');logger[_0x22e3('0x11')](_0x22e3('0x12'),_0x512e3b,'request\x20sent',JSON[_0x22e3('0x13')](_0x11fed9));if(_0x11fed9['error']){if(_0x11fed9['error'][_0x22e3('0x14')]===0x1f4){logger['error'](_0x22e3('0x10'),_0x512e3b,_0x11fed9[_0x22e3('0x15')][_0x22e3('0x16')]);return _0x372093(_0x11fed9['error'][_0x22e3('0x16')]);}logger[_0x22e3('0x15')](_0x22e3('0x10'),_0x512e3b,_0x11fed9[_0x22e3('0x15')][_0x22e3('0x16')]);return _0x2de007(_0x11fed9[_0x22e3('0x15')][_0x22e3('0x16')]);}else{logger[_0x22e3('0xf')](_0x22e3('0x10'),_0x512e3b,'request\x20sent');_0x2de007(_0x11fed9[_0x22e3('0x17')][_0x22e3('0x16')]);}})[_0x22e3('0x18')](function(_0x2fcccc){logger[_0x22e3('0x15')](_0x22e3('0x10'),_0x512e3b,_0x2fcccc);_0x372093(_0x2fcccc);});});} \ No newline at end of file +var _0xbfba=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','info','AnalyticExtractedReport,\x20%s,\x20%s','debug'];(function(_0x82e71a,_0x2f5f68){var _0x34a5d4=function(_0x5eaec6){while(--_0x5eaec6){_0x82e71a['push'](_0x82e71a['shift']());}};_0x34a5d4(++_0x2f5f68);}(_0xbfba,0x1ac));var _0xabfb=function(_0x5ee08e,_0x19127){_0x5ee08e=_0x5ee08e-0x0;var _0x12ce20=_0xbfba[_0x5ee08e];return _0x12ce20;};'use strict';var _=require(_0xabfb('0x0'));var util=require(_0xabfb('0x1'));var moment=require(_0xabfb('0x2'));var BPromise=require(_0xabfb('0x3'));var rs=require(_0xabfb('0x4'));var fs=require('fs');var Redis=require(_0xabfb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xabfb('0x6'));var logger=require('../../config/logger')(_0xabfb('0x7'));var config=require(_0xabfb('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aed1e,_0x1f992a,_0x3af781){return new BPromise(function(_0x1d5320,_0x3e2904){return client[_0xabfb('0x9')](_0x5aed1e,_0x3af781)['then'](function(_0x42d549){logger[_0xabfb('0xa')](_0xabfb('0xb'),_0x1f992a,'request\x20sent');logger[_0xabfb('0xc')](_0xabfb('0xd'),_0x1f992a,_0xabfb('0xe'),JSON[_0xabfb('0xf')](_0x42d549));if(_0x42d549['error']){if(_0x42d549[_0xabfb('0x10')][_0xabfb('0x11')]===0x1f4){logger[_0xabfb('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f992a,_0x42d549[_0xabfb('0x10')][_0xabfb('0x12')]);return _0x3e2904(_0x42d549[_0xabfb('0x10')]['message']);}logger[_0xabfb('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1f992a,_0x42d549['error'][_0xabfb('0x12')]);return _0x1d5320(_0x42d549[_0xabfb('0x10')][_0xabfb('0x12')]);}else{logger['info'](_0xabfb('0xb'),_0x1f992a,_0xabfb('0xe'));_0x1d5320(_0x42d549[_0xabfb('0x13')][_0xabfb('0x12')]);}})[_0xabfb('0x14')](function(_0x327708){logger[_0xabfb('0x10')](_0xabfb('0xb'),_0x1f992a,_0x327708);_0x3e2904(_0x327708);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0bd0d49..a209ec7 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 _0x3090=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','/:id','show','/:id/download','isAuthenticated','download','post','create','put','update','util','path','express'];(function(_0x518b64,_0x4b0812){var _0x8fd2fe=function(_0x8833f8){while(--_0x8833f8){_0x518b64['push'](_0x518b64['shift']());}};_0x8fd2fe(++_0x4b0812);}(_0x3090,0xd5));var _0x0309=function(_0x11907c,_0x145aaa){_0x11907c=_0x11907c-0x0;var _0x13d7b7=_0x3090[_0x11907c];return _0x13d7b7;};'use strict';var multer=require('multer');var util=require(_0x0309('0x0'));var path=require(_0x0309('0x1'));var timeout=require('connect-timeout');var express=require(_0x0309('0x2'));var router=express[_0x0309('0x3')]();var fs_extra=require(_0x0309('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0309('0x5'));var config=require(_0x0309('0x6'));var controller=require(_0x0309('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0309('0x8')](_0x0309('0x9'),auth['isAuthenticated'](),controller[_0x0309('0xa')]);router[_0x0309('0x8')](_0x0309('0xb'),auth[_0x0309('0xc')](),controller[_0x0309('0xd')]);router[_0x0309('0xe')]('/',auth[_0x0309('0xc')](),controller[_0x0309('0xf')]);router[_0x0309('0x10')](_0x0309('0x9'),auth[_0x0309('0xc')](),controller[_0x0309('0x11')]);router['delete'](_0x0309('0x9'),auth[_0x0309('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x14f2=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create'];(function(_0xa38a2f,_0x3c15a8){var _0x5cf5b3=function(_0x2064ca){while(--_0x2064ca){_0xa38a2f['push'](_0xa38a2f['shift']());}};_0x5cf5b3(++_0x3c15a8);}(_0x14f2,0x130));var _0x214f=function(_0x53e6ca,_0x579281){_0x53e6ca=_0x53e6ca-0x0;var _0x53bb15=_0x14f2[_0x53e6ca];return _0x53bb15;};'use strict';var multer=require('multer');var util=require(_0x214f('0x0'));var path=require(_0x214f('0x1'));var timeout=require(_0x214f('0x2'));var express=require(_0x214f('0x3'));var router=express[_0x214f('0x4')]();var fs_extra=require(_0x214f('0x5'));var auth=require(_0x214f('0x6'));var interaction=require(_0x214f('0x7'));var config=require('../../config/environment');var controller=require(_0x214f('0x8'));router[_0x214f('0x9')]('/',auth[_0x214f('0xa')](),controller[_0x214f('0xb')]);router['get'](_0x214f('0xc'),auth[_0x214f('0xa')](),controller[_0x214f('0xd')]);router['get'](_0x214f('0xe'),auth[_0x214f('0xa')](),controller[_0x214f('0xf')]);router[_0x214f('0x10')]('/',auth[_0x214f('0xa')](),controller[_0x214f('0x11')]);router[_0x214f('0x12')](_0x214f('0xc'),auth[_0x214f('0xa')](),controller[_0x214f('0x13')]);router[_0x214f('0x14')]('/:id',auth[_0x214f('0xa')](),controller[_0x214f('0x15')]);module[_0x214f('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1682cf6..2f7e9ff 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 _0x8523=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x1a1195,_0x410610){var _0x5eb579=function(_0x5e46bc){while(--_0x5e46bc){_0x1a1195['push'](_0x1a1195['shift']());}};_0x5eb579(++_0x410610);}(_0x8523,0x1ca));var _0x3852=function(_0x1caa44,_0x3a691d){_0x1caa44=_0x1caa44-0x0;var _0xb133b4=_0x8523[_0x1caa44];return _0xb133b4;};'use strict';var Sequelize=require(_0x3852('0x0'));module[_0x3852('0x1')]={'field':{'type':Sequelize[_0x3852('0x2')]},'alias':{'type':Sequelize[_0x3852('0x3')]},'function':{'type':Sequelize[_0x3852('0x3')]},'format':{'type':Sequelize[_0x3852('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3852('0x3')]},'custom':{'type':Sequelize[_0x3852('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x8b5c=['STRING','BOOLEAN','exports','TEXT'];(function(_0x3f7b63,_0x570f89){var _0x42f648=function(_0x50b5d1){while(--_0x50b5d1){_0x3f7b63['push'](_0x3f7b63['shift']());}};_0x42f648(++_0x570f89);}(_0x8b5c,0xde));var _0xc8b5=function(_0x5347c8,_0x55f10b){_0x5347c8=_0x5347c8-0x0;var _0x5440c2=_0x8b5c[_0x5347c8];return _0x5440c2;};'use strict';var Sequelize=require('sequelize');module[_0xc8b5('0x0')]={'field':{'type':Sequelize[_0xc8b5('0x1')]},'alias':{'type':Sequelize[_0xc8b5('0x2')]},'function':{'type':Sequelize[_0xc8b5('0x2')]},'format':{'type':Sequelize[_0xc8b5('0x2')]},'groupBy':{'type':Sequelize[_0xc8b5('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc8b5('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index cfc6575..2b9032c 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 _0x3630=['pick','where','merge','type','options','include','findAll','rows','catch','show','intersection','includeAll','find','create','bulkCreate','body','params','destroy','bulkDestroy','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','keys','query','filters','model','fields','attributes','length','nolimit','order'];(function(_0x58abd0,_0x5977bd){var _0x30625d=function(_0x52b977){while(--_0x52b977){_0x58abd0['push'](_0x58abd0['shift']());}};_0x30625d(++_0x5977bd);}(_0x3630,0x66));var _0x0363=function(_0x1972e6,_0x3c8d05){_0x1972e6=_0x1972e6-0x0;var _0x4bdbbc=_0x3630[_0x1972e6];return _0x4bdbbc;};'use strict';var emlformat=require(_0x0363('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0363('0x1'));var jsonpatch=require(_0x0363('0x2'));var rp=require(_0x0363('0x3'));var moment=require(_0x0363('0x4'));var BPromise=require(_0x0363('0x5'));var Mustache=require(_0x0363('0x6'));var util=require(_0x0363('0x7'));var path=require(_0x0363('0x8'));var sox=require(_0x0363('0x9'));var csv=require(_0x0363('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0363('0xb'));var _=require(_0x0363('0xc'));var squel=require(_0x0363('0xd'));var crypto=require(_0x0363('0xe'));var jsforce=require(_0x0363('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0363('0xa'));var querystring=require(_0x0363('0x10'));var Papa=require(_0x0363('0x11'));var Redis=require('ioredis');var authService=require(_0x0363('0x12'));var qs=require(_0x0363('0x13'));var as=require(_0x0363('0x14'));var hardwareService=require(_0x0363('0x15'));var logger=require(_0x0363('0x16'))(_0x0363('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0363('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x519e71,_0x4ee57f){_0x4ee57f=_0x4ee57f||0xcc;return function(_0x3489b1){if(_0x3489b1){return _0x519e71[_0x0363('0x19')](_0x4ee57f);}return _0x519e71[_0x0363('0x1a')](_0x4ee57f)[_0x0363('0x1b')]();};}function respondWithResult(_0x28a674,_0x570af9){_0x570af9=_0x570af9||0xc8;return function(_0x160459){if(_0x160459){return _0x28a674['status'](_0x570af9)[_0x0363('0x1c')](_0x160459);}};}function respondWithFilteredResult(_0x2535e3,_0x5416e4){return function(_0x6ee9a9){if(_0x6ee9a9){var _0x2e76a3=typeof _0x5416e4['offset']===_0x0363('0x1d')&&typeof _0x5416e4[_0x0363('0x1e')]===_0x0363('0x1d');var _0x34d2df=_0x6ee9a9['count'];var _0x45c427=_0x2e76a3?0x0:_0x5416e4['offset'];var _0x429cb8=_0x2e76a3?_0x6ee9a9[_0x0363('0x1f')]:_0x5416e4[_0x0363('0x20')]+_0x5416e4[_0x0363('0x1e')];var _0x4465af;if(_0x429cb8>=_0x34d2df){_0x429cb8=_0x34d2df;_0x4465af=0xc8;}else{_0x4465af=0xce;}_0x2535e3['status'](_0x4465af);return _0x2535e3[_0x0363('0x21')](_0x0363('0x22'),_0x45c427+'-'+_0x429cb8+'/'+_0x34d2df)['json'](_0x6ee9a9);}return null;};}function patchUpdates(_0x49e92e){return function(_0x3af837){try{jsonpatch[_0x0363('0x23')](_0x3af837,_0x49e92e,!![]);}catch(_0x22ac2f){return BPromise[_0x0363('0x24')](_0x22ac2f);}return _0x3af837[_0x0363('0x25')]();};}function saveUpdates(_0x1401a8,_0x55ccb7){return function(_0x24c293){if(_0x24c293){return _0x24c293[_0x0363('0x26')](_0x1401a8)['then'](function(_0x11a7e8){return _0x11a7e8;});}return null;};}function removeEntity(_0x2b75e3,_0x52a8ba){return function(_0xcb0a89){if(_0xcb0a89){return _0xcb0a89['destroy']()[_0x0363('0x27')](function(){_0x2b75e3[_0x0363('0x1a')](0xcc)[_0x0363('0x1b')]();});}};}function handleEntityNotFound(_0x1108d9,_0xced504){return function(_0x41e1e2){if(!_0x41e1e2){_0x1108d9[_0x0363('0x19')](0x194);}return _0x41e1e2;};}function handleError(_0x3a0044,_0x3b475a){_0x3b475a=_0x3b475a||0x1f4;return function(_0x2a2950){logger['error'](_0x2a2950[_0x0363('0x28')]);if(_0x2a2950[_0x0363('0x29')]){delete _0x2a2950[_0x0363('0x29')];}_0x3a0044[_0x0363('0x1a')](_0x3b475a)[_0x0363('0x2a')](_0x2a2950);};}exports['index']=function(_0x453b32,_0x184320){var _0x317506={},_0x3affc3={},_0x233276={'count':0x0,'rows':[]};var _0x1a9425=_[_0x0363('0x2b')](db[_0x0363('0x2c')][_0x0363('0x2d')],function(_0x30986d){return{'name':_0x30986d[_0x0363('0x2e')],'type':_0x30986d['type']['key']};});_0x3affc3['model']=_[_0x0363('0x2b')](_0x1a9425,_0x0363('0x29'));_0x3affc3['query']=_[_0x0363('0x2f')](_0x453b32[_0x0363('0x30')]);_0x3affc3[_0x0363('0x31')]=_['intersection'](_0x3affc3[_0x0363('0x32')],_0x3affc3['query']);_0x317506['attributes']=_['intersection'](_0x3affc3[_0x0363('0x32')],qs[_0x0363('0x33')](_0x453b32[_0x0363('0x30')]['fields']));_0x317506[_0x0363('0x34')]=_0x317506[_0x0363('0x34')][_0x0363('0x35')]?_0x317506[_0x0363('0x34')]:_0x3affc3[_0x0363('0x32')];if(!_0x453b32[_0x0363('0x30')]['hasOwnProperty'](_0x0363('0x36'))){_0x317506[_0x0363('0x1e')]=qs[_0x0363('0x1e')](_0x453b32['query'][_0x0363('0x1e')]);_0x317506[_0x0363('0x20')]=qs[_0x0363('0x20')](_0x453b32[_0x0363('0x30')][_0x0363('0x20')]);}_0x317506[_0x0363('0x37')]=qs['sort'](_0x453b32[_0x0363('0x30')]['sort']);_0x317506['where']=qs['filters'](_[_0x0363('0x38')](_0x453b32[_0x0363('0x30')],_0x3affc3[_0x0363('0x31')]),_0x1a9425);if(_0x453b32[_0x0363('0x30')]['filter']){_0x317506[_0x0363('0x39')]=_[_0x0363('0x3a')](_0x317506[_0x0363('0x39')],{'$or':_[_0x0363('0x2b')](_0x1a9425,function(_0x145bfb){if(_0x145bfb[_0x0363('0x3b')]!=='VIRTUAL'){var _0x22e07b={};_0x22e07b[_0x145bfb[_0x0363('0x29')]]={'$like':'%'+_0x453b32[_0x0363('0x30')]['filter']+'%'};return _0x22e07b;}})});}_0x317506=_[_0x0363('0x3a')]({},_0x317506,_0x453b32[_0x0363('0x3c')]);var _0x134793={'where':_0x317506['where']};return db[_0x0363('0x2c')][_0x0363('0x1f')](_0x134793)[_0x0363('0x27')](function(_0x1f97bc){_0x233276[_0x0363('0x1f')]=_0x1f97bc;if(_0x453b32[_0x0363('0x30')]['includeAll']){_0x317506[_0x0363('0x3d')]=[{'all':!![]}];}return db[_0x0363('0x2c')][_0x0363('0x3e')](_0x317506);})['then'](function(_0x3f1701){_0x233276[_0x0363('0x3f')]=_0x3f1701;return _0x233276;})[_0x0363('0x27')](respondWithFilteredResult(_0x184320,_0x317506))[_0x0363('0x40')](handleError(_0x184320,null));};exports[_0x0363('0x41')]=function(_0x5ba4f4,_0x1dff98){var _0x508362={'raw':![],'where':{'id':_0x5ba4f4['params']['id']}},_0x230e48={};_0x230e48['model']=_[_0x0363('0x2f')](db['AnalyticFieldReport'][_0x0363('0x2d')]);_0x230e48[_0x0363('0x30')]=_[_0x0363('0x2f')](_0x5ba4f4[_0x0363('0x30')]);_0x230e48[_0x0363('0x31')]=_[_0x0363('0x42')](_0x230e48[_0x0363('0x32')],_0x230e48[_0x0363('0x30')]);_0x508362['attributes']=_[_0x0363('0x42')](_0x230e48[_0x0363('0x32')],qs[_0x0363('0x33')](_0x5ba4f4['query'][_0x0363('0x33')]));_0x508362[_0x0363('0x34')]=_0x508362[_0x0363('0x34')][_0x0363('0x35')]?_0x508362[_0x0363('0x34')]:_0x230e48[_0x0363('0x32')];if(_0x5ba4f4['query'][_0x0363('0x43')]){_0x508362[_0x0363('0x3d')]=[{'all':!![]}];}_0x508362=_[_0x0363('0x3a')]({},_0x508362,_0x5ba4f4[_0x0363('0x3c')]);return db['AnalyticFieldReport'][_0x0363('0x44')](_0x508362)[_0x0363('0x27')](handleEntityNotFound(_0x1dff98,null))['then'](respondWithResult(_0x1dff98,null))[_0x0363('0x40')](handleError(_0x1dff98,null));};exports['create']=function(_0x317095,_0xbf881b){return db['AnalyticFieldReport'][_0x0363('0x45')](_0x317095['body'],{})[_0x0363('0x27')](respondWithResult(_0xbf881b,0xc9))[_0x0363('0x40')](handleError(_0xbf881b,null));};exports[_0x0363('0x46')]=function(_0x240573,_0x23129d){return db[_0x0363('0x2c')]['bulkCreate'](_0x240573[_0x0363('0x47')],{'raw':![],'individualHooks':!![]})[_0x0363('0x27')](respondWithResult(_0x23129d,0xc9))[_0x0363('0x40')](handleError(_0x23129d,null));};exports[_0x0363('0x26')]=function(_0x5d7950,_0x2de611){if(_0x5d7950[_0x0363('0x47')]['id']){delete _0x5d7950['body']['id'];}return db['AnalyticFieldReport'][_0x0363('0x44')]({'where':{'id':_0x5d7950[_0x0363('0x48')]['id']}})[_0x0363('0x27')](handleEntityNotFound(_0x2de611,null))['then'](saveUpdates(_0x5d7950[_0x0363('0x47')],null))[_0x0363('0x27')](respondWithResult(_0x2de611,null))[_0x0363('0x40')](handleError(_0x2de611,null));};exports[_0x0363('0x49')]=function(_0x1454d5,_0x5941b6){return db[_0x0363('0x2c')][_0x0363('0x44')]({'where':{'id':_0x1454d5['params']['id']}})[_0x0363('0x27')](handleEntityNotFound(_0x5941b6,null))['then'](removeEntity(_0x5941b6,null))['catch'](handleError(_0x5941b6,null));};exports[_0x0363('0x4a')]=function(_0x104d77,_0x63ba7f){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x104d77[_0x0363('0x30')]['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x63ba7f,0xcc))['catch'](handleError(_0x63ba7f,null));};exports['addFields']=function(_0x1d1da6,_0x22417c,_0x127a02){return db[_0x0363('0x4b')][_0x0363('0x4c')]({'where':{'id':_0x1d1da6[_0x0363('0x48')]['id']}})[_0x0363('0x27')](handleEntityNotFound(_0x22417c,null))[_0x0363('0x27')](function(_0x91b544){if(_0x91b544){return db[_0x0363('0x4d')]['transaction'](function(_0x29f82b){return db[_0x0363('0x2c')]['destroy']({'where':{'CustomReportId':_0x1d1da6[_0x0363('0x48')]['id']},'transaction':_0x29f82b})[_0x0363('0x27')](function(_0x29f6ea){var _0x2f545b=_[_0x0363('0x2b')](_0x1d1da6[_0x0363('0x47')],function(_0x118b4e){delete _0x118b4e['id'];_0x118b4e[_0x0363('0x4e')]=_0x1d1da6[_0x0363('0x48')]['id'];return _0x118b4e;});return db['AnalyticFieldReport'][_0x0363('0x46')](_0x2f545b,{'transaction':_0x29f82b});});})['then'](function(){return db[_0x0363('0x2c')][_0x0363('0x3e')]({'where':{'CustomReportId':_0x1d1da6[_0x0363('0x48')]['id']}});});}})[_0x0363('0x27')](respondWithResult(_0x22417c,null))[_0x0363('0x40')](handleError(_0x22417c,null));}; \ No newline at end of file +var _0xd433=['include','find','create','body','bulkCreate','params','addFields','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','count','includeAll','findAll','catch','AnalyticFieldReport'];(function(_0x56058a,_0x1bf6bb){var _0x43eb1b=function(_0x571532){while(--_0x571532){_0x56058a['push'](_0x56058a['shift']());}};_0x43eb1b(++_0x1bf6bb);}(_0xd433,0xf7));var _0x3d43=function(_0x18978a,_0x230acf){_0x18978a=_0x18978a-0x0;var _0x3dc130=_0xd433[_0x18978a];return _0x3dc130;};'use strict';var emlformat=require(_0x3d43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d43('0x1'));var jsonpatch=require(_0x3d43('0x2'));var rp=require(_0x3d43('0x3'));var moment=require(_0x3d43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d43('0x5'));var util=require(_0x3d43('0x6'));var path=require(_0x3d43('0x7'));var sox=require(_0x3d43('0x8'));var csv=require(_0x3d43('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d43('0xa'));var squel=require('squel');var crypto=require(_0x3d43('0xb'));var jsforce=require(_0x3d43('0xc'));var deskjs=require(_0x3d43('0xd'));var toCsv=require(_0x3d43('0x9'));var querystring=require(_0x3d43('0xe'));var Papa=require(_0x3d43('0xf'));var Redis=require(_0x3d43('0x10'));var authService=require(_0x3d43('0x11'));var qs=require(_0x3d43('0x12'));var as=require(_0x3d43('0x13'));var hardwareService=require(_0x3d43('0x14'));var logger=require(_0x3d43('0x15'))('api');var utils=require(_0x3d43('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d43('0x17'))['db'];function respondWithStatusCode(_0x56510f,_0x49bf5b){_0x49bf5b=_0x49bf5b||0xcc;return function(_0x257a66){if(_0x257a66){return _0x56510f['sendStatus'](_0x49bf5b);}return _0x56510f[_0x3d43('0x18')](_0x49bf5b)[_0x3d43('0x19')]();};}function respondWithResult(_0x1665fc,_0x33f05f){_0x33f05f=_0x33f05f||0xc8;return function(_0x2e774d){if(_0x2e774d){return _0x1665fc[_0x3d43('0x18')](_0x33f05f)[_0x3d43('0x1a')](_0x2e774d);}};}function respondWithFilteredResult(_0x440094,_0x114663){return function(_0x2921c2){if(_0x2921c2){var _0x517d0a=typeof _0x114663[_0x3d43('0x1b')]==='undefined'&&typeof _0x114663[_0x3d43('0x1c')]===_0x3d43('0x1d');var _0x17d349=_0x2921c2['count'];var _0x4fd3ac=_0x517d0a?0x0:_0x114663[_0x3d43('0x1b')];var _0x1bddb7=_0x517d0a?_0x2921c2['count']:_0x114663[_0x3d43('0x1b')]+_0x114663[_0x3d43('0x1c')];var _0x15d6f9;if(_0x1bddb7>=_0x17d349){_0x1bddb7=_0x17d349;_0x15d6f9=0xc8;}else{_0x15d6f9=0xce;}_0x440094[_0x3d43('0x18')](_0x15d6f9);return _0x440094[_0x3d43('0x1e')]('Content-Range',_0x4fd3ac+'-'+_0x1bddb7+'/'+_0x17d349)[_0x3d43('0x1a')](_0x2921c2);}return null;};}function patchUpdates(_0x261b23){return function(_0x2622a6){try{jsonpatch[_0x3d43('0x1f')](_0x2622a6,_0x261b23,!![]);}catch(_0x24004e){return BPromise[_0x3d43('0x20')](_0x24004e);}return _0x2622a6[_0x3d43('0x21')]();};}function saveUpdates(_0x50c27b,_0x5af74d){return function(_0x28f8f8){if(_0x28f8f8){return _0x28f8f8[_0x3d43('0x22')](_0x50c27b)[_0x3d43('0x23')](function(_0x4767e9){return _0x4767e9;});}return null;};}function removeEntity(_0x5b5a7c,_0x485419){return function(_0x2f15d7){if(_0x2f15d7){return _0x2f15d7[_0x3d43('0x24')]()[_0x3d43('0x23')](function(){_0x5b5a7c['status'](0xcc)[_0x3d43('0x19')]();});}};}function handleEntityNotFound(_0x4c79a9,_0x1d5be7){return function(_0x438399){if(!_0x438399){_0x4c79a9[_0x3d43('0x25')](0x194);}return _0x438399;};}function handleError(_0x1084ad,_0x7d672){_0x7d672=_0x7d672||0x1f4;return function(_0x5a8f77){logger[_0x3d43('0x26')](_0x5a8f77[_0x3d43('0x27')]);if(_0x5a8f77[_0x3d43('0x28')]){delete _0x5a8f77[_0x3d43('0x28')];}_0x1084ad['status'](_0x7d672)[_0x3d43('0x29')](_0x5a8f77);};}exports[_0x3d43('0x2a')]=function(_0x44bea7,_0x43e223){var _0xde0f62={},_0x47852b={},_0x9fb5ff={'count':0x0,'rows':[]};var _0x5e11ea=_[_0x3d43('0x2b')](db['AnalyticFieldReport'][_0x3d43('0x2c')],function(_0x55be06){return{'name':_0x55be06[_0x3d43('0x2d')],'type':_0x55be06['type'][_0x3d43('0x2e')]};});_0x47852b[_0x3d43('0x2f')]=_[_0x3d43('0x2b')](_0x5e11ea,_0x3d43('0x28'));_0x47852b['query']=_[_0x3d43('0x30')](_0x44bea7[_0x3d43('0x31')]);_0x47852b['filters']=_['intersection'](_0x47852b['model'],_0x47852b['query']);_0xde0f62['attributes']=_[_0x3d43('0x32')](_0x47852b[_0x3d43('0x2f')],qs[_0x3d43('0x33')](_0x44bea7[_0x3d43('0x31')]['fields']));_0xde0f62['attributes']=_0xde0f62[_0x3d43('0x34')][_0x3d43('0x35')]?_0xde0f62[_0x3d43('0x34')]:_0x47852b[_0x3d43('0x2f')];if(!_0x44bea7[_0x3d43('0x31')][_0x3d43('0x36')](_0x3d43('0x37'))){_0xde0f62[_0x3d43('0x1c')]=qs[_0x3d43('0x1c')](_0x44bea7['query'][_0x3d43('0x1c')]);_0xde0f62[_0x3d43('0x1b')]=qs['offset'](_0x44bea7['query'][_0x3d43('0x1b')]);}_0xde0f62[_0x3d43('0x38')]=qs[_0x3d43('0x39')](_0x44bea7[_0x3d43('0x31')][_0x3d43('0x39')]);_0xde0f62[_0x3d43('0x3a')]=qs[_0x3d43('0x3b')](_[_0x3d43('0x3c')](_0x44bea7['query'],_0x47852b[_0x3d43('0x3b')]),_0x5e11ea);if(_0x44bea7[_0x3d43('0x31')][_0x3d43('0x3d')]){_0xde0f62['where']=_['merge'](_0xde0f62['where'],{'$or':_[_0x3d43('0x2b')](_0x5e11ea,function(_0x5f4774){if(_0x5f4774[_0x3d43('0x3e')]!==_0x3d43('0x3f')){var _0x10783d={};_0x10783d[_0x5f4774[_0x3d43('0x28')]]={'$like':'%'+_0x44bea7[_0x3d43('0x31')]['filter']+'%'};return _0x10783d;}})});}_0xde0f62=_['merge']({},_0xde0f62,_0x44bea7['options']);var _0x9ed10b={'where':_0xde0f62[_0x3d43('0x3a')]};return db['AnalyticFieldReport'][_0x3d43('0x40')](_0x9ed10b)[_0x3d43('0x23')](function(_0x40b2b1){_0x9fb5ff['count']=_0x40b2b1;if(_0x44bea7[_0x3d43('0x31')][_0x3d43('0x41')]){_0xde0f62['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x3d43('0x42')](_0xde0f62);})['then'](function(_0x29018b){_0x9fb5ff['rows']=_0x29018b;return _0x9fb5ff;})[_0x3d43('0x23')](respondWithFilteredResult(_0x43e223,_0xde0f62))[_0x3d43('0x43')](handleError(_0x43e223,null));};exports['show']=function(_0x1c602a,_0x1a675f){var _0x241b07={'raw':![],'where':{'id':_0x1c602a['params']['id']}},_0x13906b={};_0x13906b['model']=_['keys'](db[_0x3d43('0x44')][_0x3d43('0x2c')]);_0x13906b['query']=_[_0x3d43('0x30')](_0x1c602a[_0x3d43('0x31')]);_0x13906b['filters']=_[_0x3d43('0x32')](_0x13906b[_0x3d43('0x2f')],_0x13906b[_0x3d43('0x31')]);_0x241b07[_0x3d43('0x34')]=_['intersection'](_0x13906b[_0x3d43('0x2f')],qs[_0x3d43('0x33')](_0x1c602a['query'][_0x3d43('0x33')]));_0x241b07[_0x3d43('0x34')]=_0x241b07[_0x3d43('0x34')][_0x3d43('0x35')]?_0x241b07[_0x3d43('0x34')]:_0x13906b['model'];if(_0x1c602a[_0x3d43('0x31')]['includeAll']){_0x241b07[_0x3d43('0x45')]=[{'all':!![]}];}_0x241b07=_['merge']({},_0x241b07,_0x1c602a['options']);return db['AnalyticFieldReport'][_0x3d43('0x46')](_0x241b07)[_0x3d43('0x23')](handleEntityNotFound(_0x1a675f,null))[_0x3d43('0x23')](respondWithResult(_0x1a675f,null))['catch'](handleError(_0x1a675f,null));};exports[_0x3d43('0x47')]=function(_0x2f8ea1,_0x71fd2){return db[_0x3d43('0x44')][_0x3d43('0x47')](_0x2f8ea1[_0x3d43('0x48')],{})[_0x3d43('0x23')](respondWithResult(_0x71fd2,0xc9))[_0x3d43('0x43')](handleError(_0x71fd2,null));};exports[_0x3d43('0x49')]=function(_0x5a98b4,_0x2a3258){return db['AnalyticFieldReport'][_0x3d43('0x49')](_0x5a98b4[_0x3d43('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2a3258,0xc9))[_0x3d43('0x43')](handleError(_0x2a3258,null));};exports[_0x3d43('0x22')]=function(_0x20fb5f,_0x111f98){if(_0x20fb5f['body']['id']){delete _0x20fb5f[_0x3d43('0x48')]['id'];}return db[_0x3d43('0x44')][_0x3d43('0x46')]({'where':{'id':_0x20fb5f[_0x3d43('0x4a')]['id']}})[_0x3d43('0x23')](handleEntityNotFound(_0x111f98,null))['then'](saveUpdates(_0x20fb5f[_0x3d43('0x48')],null))[_0x3d43('0x23')](respondWithResult(_0x111f98,null))[_0x3d43('0x43')](handleError(_0x111f98,null));};exports[_0x3d43('0x24')]=function(_0x563448,_0x1765bc){return db[_0x3d43('0x44')][_0x3d43('0x46')]({'where':{'id':_0x563448['params']['id']}})[_0x3d43('0x23')](handleEntityNotFound(_0x1765bc,null))['then'](removeEntity(_0x1765bc,null))[_0x3d43('0x43')](handleError(_0x1765bc,null));};exports['bulkDestroy']=function(_0x76da55,_0x450b51){return db['AnalyticFieldReport'][_0x3d43('0x24')]({'where':{'id':_0x76da55['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x3d43('0x23')](respondWithResult(_0x450b51,0xcc))[_0x3d43('0x43')](handleError(_0x450b51,null));};exports[_0x3d43('0x4b')]=function(_0x2a5886,_0x37ccde,_0x5e19f7){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x2a5886[_0x3d43('0x4a')]['id']}})[_0x3d43('0x23')](handleEntityNotFound(_0x37ccde,null))[_0x3d43('0x23')](function(_0x50d032){if(_0x50d032){return db[_0x3d43('0x4c')][_0x3d43('0x4d')](function(_0x2980ed){return db[_0x3d43('0x44')]['destroy']({'where':{'CustomReportId':_0x2a5886[_0x3d43('0x4a')]['id']},'transaction':_0x2980ed})[_0x3d43('0x23')](function(_0x35ca0c){var _0x1debcd=_[_0x3d43('0x2b')](_0x2a5886['body'],function(_0x5390ba){delete _0x5390ba['id'];_0x5390ba[_0x3d43('0x4e')]=_0x2a5886[_0x3d43('0x4a')]['id'];return _0x5390ba;});return db[_0x3d43('0x44')][_0x3d43('0x49')](_0x1debcd,{'transaction':_0x2980ed});});})[_0x3d43('0x23')](function(){return db[_0x3d43('0x44')]['findAll']({'where':{'CustomReportId':_0x2a5886[_0x3d43('0x4a')]['id']}});});}})[_0x3d43('0x23')](respondWithResult(_0x37ccde,null))['catch'](handleError(_0x37ccde,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 39206ce..6636a33 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 _0xac44=['rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport','../../config/logger','api','moment','request-promise','path'];(function(_0x26e6f3,_0x1dcffa){var _0x5533a3=function(_0x54d492){while(--_0x54d492){_0x26e6f3['push'](_0x26e6f3['shift']());}};_0x5533a3(++_0x1dcffa);}(_0xac44,0x124));var _0x4ac4=function(_0x529c8e,_0x415245){_0x529c8e=_0x529c8e-0x0;var _0x4193d9=_0xac44[_0x529c8e];return _0x4193d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ac4('0x0'))(_0x4ac4('0x1'));var moment=require(_0x4ac4('0x2'));var BPromise=require('bluebird');var rp=require(_0x4ac4('0x3'));var fs=require('fs');var path=require(_0x4ac4('0x4'));var rimraf=require(_0x4ac4('0x5'));var config=require('../../config/environment');var attributes=require(_0x4ac4('0x6'));module[_0x4ac4('0x7')]=function(_0x1cfbe5,_0x30e7f1){return _0x1cfbe5['define'](_0x4ac4('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaaa=['lodash','util','moment','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x5ba4e7,_0x5a23e1){var _0x506678=function(_0x5e5de2){while(--_0x5e5de2){_0x5ba4e7['push'](_0x5ba4e7['shift']());}};_0x506678(++_0x5a23e1);}(_0xaaaa,0x9a));var _0xaaaa=function(_0x2827b5,_0x1f963c){_0x2827b5=_0x2827b5-0x0;var _0x5560d5=_0xaaaa[_0x2827b5];return _0x5560d5;};'use strict';var _=require(_0xaaaa('0x0'));var util=require(_0xaaaa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaaaa('0x2'));var BPromise=require('bluebird');var rp=require(_0xaaaa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaaaa('0x4'));var config=require(_0xaaaa('0x5'));var attributes=require(_0xaaaa('0x6'));module[_0xaaaa('0x7')]=function(_0x20e43a,_0x45eb90){return _0x20e43a[_0xaaaa('0x8')](_0xaaaa('0x9'),attributes,{'tableName':_0xaaaa('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 d41d8a8..0050554 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 _0x0add=['request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0add,0x168));var _0xd0ad=function(_0x420d8d,_0x78b67f){_0x420d8d=_0x420d8d-0x0;var _0x4865d7=_0x0add[_0x420d8d];return _0x4865d7;};'use strict';var _=require('lodash');var util=require(_0xd0ad('0x0'));var moment=require('moment');var BPromise=require(_0xd0ad('0x1'));var rs=require(_0xd0ad('0x2'));var fs=require('fs');var Redis=require(_0xd0ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0ad('0x4'));var logger=require(_0xd0ad('0x5'))(_0xd0ad('0x6'));var config=require(_0xd0ad('0x7'));var jayson=require(_0xd0ad('0x8'));var client=jayson[_0xd0ad('0x9')][_0xd0ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x159989,_0x2e668d,_0x50aa8d){return new BPromise(function(_0x3d12d9,_0x3a1963){return client[_0xd0ad('0xb')](_0x159989,_0x50aa8d)[_0xd0ad('0xc')](function(_0xc3ff0a){logger['info'](_0xd0ad('0xd'),_0x2e668d,_0xd0ad('0xe'));logger[_0xd0ad('0xf')](_0xd0ad('0x10'),_0x2e668d,_0xd0ad('0xe'),JSON[_0xd0ad('0x11')](_0xc3ff0a));if(_0xc3ff0a['error']){if(_0xc3ff0a[_0xd0ad('0x12')]['code']===0x1f4){logger['error'](_0xd0ad('0xd'),_0x2e668d,_0xc3ff0a[_0xd0ad('0x12')][_0xd0ad('0x13')]);return _0x3a1963(_0xc3ff0a['error']['message']);}logger[_0xd0ad('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2e668d,_0xc3ff0a[_0xd0ad('0x12')][_0xd0ad('0x13')]);return _0x3d12d9(_0xc3ff0a[_0xd0ad('0x12')]['message']);}else{logger[_0xd0ad('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2e668d,_0xd0ad('0xe'));_0x3d12d9(_0xc3ff0a[_0xd0ad('0x15')][_0xd0ad('0x13')]);}})['catch'](function(_0x148c2a){logger[_0xd0ad('0x12')](_0xd0ad('0xd'),_0x2e668d,_0x148c2a);_0x3a1963(_0x148c2a);});});} \ No newline at end of file +var _0x37af=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0x37af,0x10d));var _0xf37a=function(_0x58aa57,_0x32d905){_0x58aa57=_0x58aa57-0x0;var _0x2f134e=_0x37af[_0x58aa57];return _0x2f134e;};'use strict';var _=require('lodash');var util=require(_0xf37a('0x0'));var moment=require(_0xf37a('0x1'));var BPromise=require(_0xf37a('0x2'));var rs=require(_0xf37a('0x3'));var fs=require('fs');var Redis=require(_0xf37a('0x4'));var db=require(_0xf37a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf37a('0x6'));var config=require(_0xf37a('0x7'));var jayson=require(_0xf37a('0x8'));var client=jayson[_0xf37a('0x9')][_0xf37a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1da835,_0x576698,_0x15e8dc){return new BPromise(function(_0x16f7b1,_0x2f8e85){return client[_0xf37a('0xb')](_0x1da835,_0x15e8dc)[_0xf37a('0xc')](function(_0x1db587){logger[_0xf37a('0xd')](_0xf37a('0xe'),_0x576698,_0xf37a('0xf'));logger[_0xf37a('0x10')](_0xf37a('0x11'),_0x576698,_0xf37a('0xf'),JSON[_0xf37a('0x12')](_0x1db587));if(_0x1db587[_0xf37a('0x13')]){if(_0x1db587['error'][_0xf37a('0x14')]===0x1f4){logger[_0xf37a('0x13')](_0xf37a('0xe'),_0x576698,_0x1db587[_0xf37a('0x13')][_0xf37a('0x15')]);return _0x2f8e85(_0x1db587[_0xf37a('0x13')][_0xf37a('0x15')]);}logger[_0xf37a('0x13')](_0xf37a('0xe'),_0x576698,_0x1db587[_0xf37a('0x13')][_0xf37a('0x15')]);return _0x16f7b1(_0x1db587['error'][_0xf37a('0x15')]);}else{logger['info'](_0xf37a('0xe'),_0x576698,'request\x20sent');_0x16f7b1(_0x1db587['result'][_0xf37a('0x15')]);}})[_0xf37a('0x16')](function(_0x5d58df){logger[_0xf37a('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x576698,_0x5d58df);_0x2f8e85(_0x5d58df);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 5dcadbb..9e243b5 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(_0x2457d7,_0x3d7be4){var _0x2863ee=function(_0x407a8d){while(--_0x407a8d){_0x2457d7['push'](_0x2457d7['shift']());}};_0x2863ee(++_0x3d7be4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x36d20c,_0x3bafd5){var _0x2140af=function(_0x9c8bb7){while(--_0x9c8bb7){_0x36d20c['push'](_0x36d20c['shift']());}};_0x2140af(++_0x3bafd5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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 a07697f..54aa2e4 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 _0x8130=['TEXT','sequelize','exports','name','STRING'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x8130,0x146));var _0x0813=function(_0x55403e,_0x47a01b){_0x55403e=_0x55403e-0x0;var _0x2e5ad4=_0x8130[_0x55403e];return _0x2e5ad4;};'use strict';var Sequelize=require(_0x0813('0x0'));module[_0x0813('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0813('0x2')},'table':{'type':Sequelize[_0x0813('0x3')]},'metric':{'type':Sequelize[_0x0813('0x4')]},'description':{'type':Sequelize[_0x0813('0x3')]}}; \ No newline at end of file +var _0x980c=['TEXT','sequelize','exports','STRING','name'];(function(_0x397dcc,_0x51100c){var _0x2cd154=function(_0x3b14){while(--_0x3b14){_0x397dcc['push'](_0x397dcc['shift']());}};_0x2cd154(++_0x51100c);}(_0x980c,0x100));var _0xc980=function(_0x1e7157,_0x2659ba){_0x1e7157=_0x1e7157-0x0;var _0x595593=_0x980c[_0x1e7157];return _0x595593;};'use strict';var Sequelize=require(_0xc980('0x0'));module[_0xc980('0x1')]={'name':{'type':Sequelize[_0xc980('0x2')],'allowNull':![],'unique':_0xc980('0x3')},'table':{'type':Sequelize[_0xc980('0x2')]},'metric':{'type':Sequelize[_0xc980('0x4')]},'description':{'type':Sequelize[_0xc980('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 6bc362f..d6b2f3d 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 _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x345d3c,_0x35223e){var _0x429a26=function(_0x16c91d){while(--_0x16c91d){_0x345d3c['push'](_0x345d3c['shift']());}};_0x429a26(++_0x35223e);}(_0xabce,0x103));var _0xeabc=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xabce[_0x2160a9];return _0xa88cf7;};'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'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','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'];(function(_0x292f0d,_0x528c4c){var _0x2412f9=function(_0x722ed0){while(--_0x722ed0){_0x292f0d['push'](_0x292f0d['shift']());}};_0x2412f9(++_0x528c4c);}(_0x55ca,0x126));var _0xa55c=function(_0x55e28f,_0x20cedb){_0x55e28f=_0x55e28f-0x0;var _0xee48e9=_0x55ca[_0x55e28f];return _0xee48e9;};'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(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 330520a..3b9a957 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 _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics'];(function(_0x718ccd,_0x34b18c){var _0x3b6fc9=function(_0x9a20e6){while(--_0x9a20e6){_0x718ccd['push'](_0x718ccd['shift']());}};_0x3b6fc9(++_0x34b18c);}(_0x2d72,0xa8));var _0x22d7=function(_0x149b76,_0x53ac87){_0x149b76=_0x149b76-0x0;var _0x55a046=_0x2d72[_0x149b76];return _0x55a046;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7be=['analytics_metrics','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','AnalyticMetric'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xa7be,0xfd));var _0xea7b=function(_0x7bd69d,_0x4839ac){_0x7bd69d=_0x7bd69d-0x0;var _0x41b6ac=_0xa7be[_0x7bd69d];return _0x41b6ac;};'use strict';var _=require(_0xea7b('0x0'));var util=require(_0xea7b('0x1'));var logger=require(_0xea7b('0x2'))(_0xea7b('0x3'));var moment=require(_0xea7b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xea7b('0x5'));var rimraf=require(_0xea7b('0x6'));var config=require(_0xea7b('0x7'));var attributes=require('./analyticMetric.attributes');module[_0xea7b('0x8')]=function(_0x1bf6cb,_0x3078c9){return _0x1bf6cb[_0xea7b('0x9')](_0xea7b('0xa'),attributes,{'tableName':_0xea7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c8ef5ca..ea004a2 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 _0x43e9=['stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x43e9,0x64));var _0x943e=function(_0x4b56ee,_0x13c301){_0x4b56ee=_0x4b56ee-0x0;var _0x506b6a=_0x43e9[_0x4b56ee];return _0x506b6a;};'use strict';var _=require(_0x943e('0x0'));var util=require(_0x943e('0x1'));var moment=require(_0x943e('0x2'));var BPromise=require('bluebird');var rs=require(_0x943e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x943e('0x4'))['db'];var utils=require(_0x943e('0x5'));var logger=require(_0x943e('0x6'))(_0x943e('0x7'));var config=require('../../config/environment');var jayson=require(_0x943e('0x8'));var client=jayson[_0x943e('0x9')][_0x943e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22f205,_0x1e0247,_0x18d86a){return new BPromise(function(_0x3a99cc,_0x4479a8){return client[_0x943e('0xb')](_0x22f205,_0x18d86a)[_0x943e('0xc')](function(_0xab7d04){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x1e0247,_0x943e('0xd'));logger[_0x943e('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1e0247,_0x943e('0xd'),JSON[_0x943e('0xf')](_0xab7d04));if(_0xab7d04[_0x943e('0x10')]){if(_0xab7d04[_0x943e('0x10')][_0x943e('0x11')]===0x1f4){logger[_0x943e('0x10')](_0x943e('0x12'),_0x1e0247,_0xab7d04[_0x943e('0x10')]['message']);return _0x4479a8(_0xab7d04[_0x943e('0x10')][_0x943e('0x13')]);}logger[_0x943e('0x10')](_0x943e('0x12'),_0x1e0247,_0xab7d04[_0x943e('0x10')][_0x943e('0x13')]);return _0x3a99cc(_0xab7d04[_0x943e('0x10')][_0x943e('0x13')]);}else{logger[_0x943e('0x14')](_0x943e('0x12'),_0x1e0247,_0x943e('0xd'));_0x3a99cc(_0xab7d04[_0x943e('0x15')][_0x943e('0x13')]);}})[_0x943e('0x16')](function(_0x25f01c){logger[_0x943e('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1e0247,_0x25f01c);_0x4479a8(_0x25f01c);});});} \ No newline at end of file +var _0x916a=['message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s'];(function(_0xdfa8a6,_0x2b5761){var _0x19e515=function(_0xa24538){while(--_0xa24538){_0xdfa8a6['push'](_0xdfa8a6['shift']());}};_0x19e515(++_0x2b5761);}(_0x916a,0x1a5));var _0xa916=function(_0x195c21,_0x332612){_0x195c21=_0x195c21-0x0;var _0x3576a8=_0x916a[_0x195c21];return _0x3576a8;};'use strict';var _=require(_0xa916('0x0'));var util=require(_0xa916('0x1'));var moment=require(_0xa916('0x2'));var BPromise=require('bluebird');var rs=require(_0xa916('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa916('0x4'))['db'];var utils=require(_0xa916('0x5'));var logger=require(_0xa916('0x6'))(_0xa916('0x7'));var config=require(_0xa916('0x8'));var jayson=require(_0xa916('0x9'));var client=jayson[_0xa916('0xa')][_0xa916('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x374e00,_0x1dc6e6,_0x3997a7){return new BPromise(function(_0x54791a,_0x96dfa9){return client[_0xa916('0xc')](_0x374e00,_0x3997a7)[_0xa916('0xd')](function(_0x2d04f0){logger[_0xa916('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1dc6e6,'request\x20sent');logger[_0xa916('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x1dc6e6,_0xa916('0x10'),JSON[_0xa916('0x11')](_0x2d04f0));if(_0x2d04f0[_0xa916('0x12')]){if(_0x2d04f0[_0xa916('0x12')]['code']===0x1f4){logger[_0xa916('0x12')](_0xa916('0x13'),_0x1dc6e6,_0x2d04f0['error'][_0xa916('0x14')]);return _0x96dfa9(_0x2d04f0[_0xa916('0x12')][_0xa916('0x14')]);}logger['error'](_0xa916('0x13'),_0x1dc6e6,_0x2d04f0['error'][_0xa916('0x14')]);return _0x54791a(_0x2d04f0['error'][_0xa916('0x14')]);}else{logger[_0xa916('0xe')](_0xa916('0x13'),_0x1dc6e6,_0xa916('0x10'));_0x54791a(_0x2d04f0['result'][_0xa916('0x14')]);}})['catch'](function(_0x531003){logger[_0xa916('0x12')](_0xa916('0x13'),_0x1dc6e6,_0x531003);_0x96dfa9(_0x531003);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 84cd1c3..f95d034 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 _0x0d64=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','update','delete','exports'];(function(_0x56f6ec,_0x33b657){var _0x231c76=function(_0xcc3b8){while(--_0xcc3b8){_0x56f6ec['push'](_0x56f6ec['shift']());}};_0x231c76(++_0x33b657);}(_0x0d64,0x77));var _0x40d6=function(_0xf937d7,_0x59d955){_0xf937d7=_0xf937d7-0x0;var _0x39edc8=_0x0d64[_0xf937d7];return _0x39edc8;};'use strict';var multer=require(_0x40d6('0x0'));var util=require('util');var path=require(_0x40d6('0x1'));var timeout=require(_0x40d6('0x2'));var express=require('express');var router=express[_0x40d6('0x3')]();var fs_extra=require(_0x40d6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x40d6('0x5'));var config=require(_0x40d6('0x6'));var controller=require(_0x40d6('0x7'));router[_0x40d6('0x8')]('/',auth[_0x40d6('0x9')](),controller[_0x40d6('0xa')]);router[_0x40d6('0x8')](_0x40d6('0xb'),auth[_0x40d6('0x9')](),controller[_0x40d6('0xc')]);router[_0x40d6('0xd')]('/',auth[_0x40d6('0x9')](),controller['create']);router['put'](_0x40d6('0xb'),auth['isAuthenticated'](),controller[_0x40d6('0xe')]);router[_0x40d6('0xf')]('/:id',auth[_0x40d6('0x9')](),controller['destroy']);module[_0x40d6('0x10')]=router; \ No newline at end of file +var _0x0619=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1a9e8f,_0x22831f){var _0x1cd6ee=function(_0x28eb2c){while(--_0x28eb2c){_0x1a9e8f['push'](_0x1a9e8f['shift']());}};_0x1cd6ee(++_0x22831f);}(_0x0619,0x90));var _0x9061=function(_0x2c2439,_0x2462bc){_0x2c2439=_0x2c2439-0x0;var _0xa81182=_0x0619[_0x2c2439];return _0xa81182;};'use strict';var multer=require(_0x9061('0x0'));var util=require(_0x9061('0x1'));var path=require(_0x9061('0x2'));var timeout=require(_0x9061('0x3'));var express=require('express');var router=express[_0x9061('0x4')]();var fs_extra=require(_0x9061('0x5'));var auth=require(_0x9061('0x6'));var interaction=require(_0x9061('0x7'));var config=require(_0x9061('0x8'));var controller=require(_0x9061('0x9'));router[_0x9061('0xa')]('/',auth[_0x9061('0xb')](),controller[_0x9061('0xc')]);router[_0x9061('0xa')](_0x9061('0xd'),auth['isAuthenticated'](),controller[_0x9061('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9061('0xf')]);router[_0x9061('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x9061('0x11')]);router[_0x9061('0x12')](_0x9061('0xd'),auth[_0x9061('0xb')](),controller[_0x9061('0x13')]);module[_0x9061('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 643d476..b3f5d67 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 _0xa477=['sequelize','exports'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0xa477,0xe6));var _0x7a47=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa477[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x7a47('0x0'));module[_0x7a47('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x9464=['exports','TEXT','sequelize'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9464,0x10d));var _0x4946=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x9464[_0x1c7137];return _0xeb4432;};'use strict';var Sequelize=require(_0x4946('0x0'));module[_0x4946('0x1')]={'tree':{'type':Sequelize[_0x4946('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5c64c8b..68a4b72 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 _0x8dca=['rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','update','then','destroy','name','send','AnalyticTreeReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0x3c93ff,_0x46e1f2){var _0x35b80d=function(_0x2eca58){while(--_0x2eca58){_0x3c93ff['push'](_0x3c93ff['shift']());}};_0x35b80d(++_0x46e1f2);}(_0x8dca,0x1e9));var _0xa8dc=function(_0x119bca,_0x2604bd){_0x119bca=_0x119bca-0x0;var _0x115326=_0x8dca[_0x119bca];return _0x115326;};'use strict';var emlformat=require(_0xa8dc('0x0'));var rimraf=require(_0xa8dc('0x1'));var zipdir=require(_0xa8dc('0x2'));var jsonpatch=require(_0xa8dc('0x3'));var rp=require(_0xa8dc('0x4'));var moment=require(_0xa8dc('0x5'));var BPromise=require(_0xa8dc('0x6'));var Mustache=require(_0xa8dc('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa8dc('0x8'));var fs=require('fs');var fs_extra=require(_0xa8dc('0x9'));var _=require('lodash');var squel=require(_0xa8dc('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa8dc('0xb'));var toCsv=require(_0xa8dc('0xc'));var querystring=require(_0xa8dc('0xd'));var Papa=require(_0xa8dc('0xe'));var Redis=require('ioredis');var authService=require(_0xa8dc('0xf'));var qs=require(_0xa8dc('0x10'));var as=require(_0xa8dc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8dc('0x12'))(_0xa8dc('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa8dc('0x14'));var db=require(_0xa8dc('0x15'))['db'];function respondWithStatusCode(_0x381418,_0x2192dc){_0x2192dc=_0x2192dc||0xcc;return function(_0xb771c6){if(_0xb771c6){return _0x381418[_0xa8dc('0x16')](_0x2192dc);}return _0x381418[_0xa8dc('0x17')](_0x2192dc)[_0xa8dc('0x18')]();};}function respondWithResult(_0x12d2fe,_0x2e62fb){_0x2e62fb=_0x2e62fb||0xc8;return function(_0x130e52){if(_0x130e52){return _0x12d2fe[_0xa8dc('0x17')](_0x2e62fb)[_0xa8dc('0x19')](_0x130e52);}};}function respondWithFilteredResult(_0xf39cef,_0x4bc805){return function(_0x239ff1){if(_0x239ff1){var _0x27fbdc=typeof _0x4bc805['offset']===_0xa8dc('0x1a')&&typeof _0x4bc805[_0xa8dc('0x1b')]===_0xa8dc('0x1a');var _0x5ba8ad=_0x239ff1[_0xa8dc('0x1c')];var _0xabda3=_0x27fbdc?0x0:_0x4bc805['offset'];var _0x215553=_0x27fbdc?_0x239ff1['count']:_0x4bc805['offset']+_0x4bc805[_0xa8dc('0x1b')];var _0xc5ca25;if(_0x215553>=_0x5ba8ad){_0x215553=_0x5ba8ad;_0xc5ca25=0xc8;}else{_0xc5ca25=0xce;}_0xf39cef[_0xa8dc('0x17')](_0xc5ca25);return _0xf39cef['set']('Content-Range',_0xabda3+'-'+_0x215553+'/'+_0x5ba8ad)['json'](_0x239ff1);}return null;};}function patchUpdates(_0x58cd55){return function(_0x1e0ec1){try{jsonpatch[_0xa8dc('0x1d')](_0x1e0ec1,_0x58cd55,!![]);}catch(_0x58eabc){return BPromise[_0xa8dc('0x1e')](_0x58eabc);}return _0x1e0ec1['save']();};}function saveUpdates(_0x745438,_0x2275c6){return function(_0x1d976d){if(_0x1d976d){return _0x1d976d[_0xa8dc('0x1f')](_0x745438)[_0xa8dc('0x20')](function(_0x10bdd2){return _0x10bdd2;});}return null;};}function removeEntity(_0x1746f3,_0x1e59d1){return function(_0x39aa9d){if(_0x39aa9d){return _0x39aa9d[_0xa8dc('0x21')]()[_0xa8dc('0x20')](function(){_0x1746f3[_0xa8dc('0x17')](0xcc)[_0xa8dc('0x18')]();});}};}function handleEntityNotFound(_0x535e88,_0x3d7dae){return function(_0x2b99b4){if(!_0x2b99b4){_0x535e88[_0xa8dc('0x16')](0x194);}return _0x2b99b4;};}function handleError(_0x590f92,_0x5cee2c){_0x5cee2c=_0x5cee2c||0x1f4;return function(_0x41aa08){logger['error'](_0x41aa08['stack']);if(_0x41aa08[_0xa8dc('0x22')]){delete _0x41aa08[_0xa8dc('0x22')];}_0x590f92[_0xa8dc('0x17')](_0x5cee2c)[_0xa8dc('0x23')](_0x41aa08);};}exports['index']=function(_0x524177,_0x17f407){var _0x4e57d0={},_0x58810d={},_0x5af583={'count':0x0,'rows':[]};var _0x127ef1=_['map'](db[_0xa8dc('0x24')][_0xa8dc('0x25')],function(_0x2949f2){return{'name':_0x2949f2[_0xa8dc('0x26')],'type':_0x2949f2['type'][_0xa8dc('0x27')]};});_0x58810d[_0xa8dc('0x28')]=_[_0xa8dc('0x29')](_0x127ef1,'name');_0x58810d[_0xa8dc('0x2a')]=_[_0xa8dc('0x2b')](_0x524177[_0xa8dc('0x2a')]);_0x58810d[_0xa8dc('0x2c')]=_[_0xa8dc('0x2d')](_0x58810d[_0xa8dc('0x28')],_0x58810d[_0xa8dc('0x2a')]);_0x4e57d0['attributes']=_['intersection'](_0x58810d[_0xa8dc('0x28')],qs[_0xa8dc('0x2e')](_0x524177['query'][_0xa8dc('0x2e')]));_0x4e57d0[_0xa8dc('0x2f')]=_0x4e57d0[_0xa8dc('0x2f')][_0xa8dc('0x30')]?_0x4e57d0[_0xa8dc('0x2f')]:_0x58810d[_0xa8dc('0x28')];if(!_0x524177[_0xa8dc('0x2a')][_0xa8dc('0x31')](_0xa8dc('0x32'))){_0x4e57d0[_0xa8dc('0x1b')]=qs[_0xa8dc('0x1b')](_0x524177['query'][_0xa8dc('0x1b')]);_0x4e57d0[_0xa8dc('0x33')]=qs['offset'](_0x524177[_0xa8dc('0x2a')]['offset']);}_0x4e57d0['order']=qs[_0xa8dc('0x34')](_0x524177['query'][_0xa8dc('0x34')]);_0x4e57d0[_0xa8dc('0x35')]=qs[_0xa8dc('0x2c')](_[_0xa8dc('0x36')](_0x524177[_0xa8dc('0x2a')],_0x58810d['filters']),_0x127ef1);if(_0x524177[_0xa8dc('0x2a')][_0xa8dc('0x37')]){_0x4e57d0[_0xa8dc('0x35')]=_[_0xa8dc('0x38')](_0x4e57d0[_0xa8dc('0x35')],{'$or':_[_0xa8dc('0x29')](_0x127ef1,function(_0x1b9661){if(_0x1b9661[_0xa8dc('0x39')]!==_0xa8dc('0x3a')){var _0xf19e6a={};_0xf19e6a[_0x1b9661[_0xa8dc('0x22')]]={'$like':'%'+_0x524177['query'][_0xa8dc('0x37')]+'%'};return _0xf19e6a;}})});}_0x4e57d0=_[_0xa8dc('0x38')]({},_0x4e57d0,_0x524177[_0xa8dc('0x3b')]);var _0x41d2ee={'where':_0x4e57d0[_0xa8dc('0x35')]};return db[_0xa8dc('0x24')]['count'](_0x41d2ee)['then'](function(_0x475147){_0x5af583['count']=_0x475147;if(_0x524177['query'][_0xa8dc('0x3c')]){_0x4e57d0[_0xa8dc('0x3d')]=[{'all':!![]}];}return db[_0xa8dc('0x24')][_0xa8dc('0x3e')](_0x4e57d0);})[_0xa8dc('0x20')](function(_0x1e2c07){_0x5af583[_0xa8dc('0x3f')]=_0x1e2c07;return _0x5af583;})[_0xa8dc('0x20')](respondWithFilteredResult(_0x17f407,_0x4e57d0))[_0xa8dc('0x40')](handleError(_0x17f407,null));};exports['show']=function(_0x56814a,_0x162503){var _0x33d685={'raw':!![],'where':{'id':_0x56814a[_0xa8dc('0x41')]['id']}},_0x1387c6={};_0x1387c6[_0xa8dc('0x28')]=_[_0xa8dc('0x2b')](db['AnalyticTreeReport']['rawAttributes']);_0x1387c6[_0xa8dc('0x2a')]=_[_0xa8dc('0x2b')](_0x56814a['query']);_0x1387c6[_0xa8dc('0x2c')]=_[_0xa8dc('0x2d')](_0x1387c6[_0xa8dc('0x28')],_0x1387c6[_0xa8dc('0x2a')]);_0x33d685[_0xa8dc('0x2f')]=_['intersection'](_0x1387c6[_0xa8dc('0x28')],qs[_0xa8dc('0x2e')](_0x56814a[_0xa8dc('0x2a')][_0xa8dc('0x2e')]));_0x33d685['attributes']=_0x33d685[_0xa8dc('0x2f')]['length']?_0x33d685[_0xa8dc('0x2f')]:_0x1387c6[_0xa8dc('0x28')];if(_0x56814a[_0xa8dc('0x2a')]['includeAll']){_0x33d685[_0xa8dc('0x3d')]=[{'all':!![]}];}_0x33d685=_['merge']({},_0x33d685,_0x56814a['options']);return db[_0xa8dc('0x24')][_0xa8dc('0x42')](_0x33d685)[_0xa8dc('0x20')](handleEntityNotFound(_0x162503,null))['then'](respondWithResult(_0x162503,null))['catch'](handleError(_0x162503,null));};exports[_0xa8dc('0x43')]=function(_0x3d4bcf,_0x14fd25){return db[_0xa8dc('0x24')][_0xa8dc('0x43')](_0x3d4bcf['body'],{})[_0xa8dc('0x20')](respondWithResult(_0x14fd25,0xc9))[_0xa8dc('0x40')](handleError(_0x14fd25,null));};exports['update']=function(_0x494f84,_0x3a6c50){if(_0x494f84['body']['id']){delete _0x494f84[_0xa8dc('0x44')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x494f84[_0xa8dc('0x41')]['id']}})[_0xa8dc('0x20')](handleEntityNotFound(_0x3a6c50,null))[_0xa8dc('0x20')](saveUpdates(_0x494f84[_0xa8dc('0x44')],null))['then'](respondWithResult(_0x3a6c50,null))[_0xa8dc('0x40')](handleError(_0x3a6c50,null));};exports[_0xa8dc('0x21')]=function(_0x1932a2,_0x5bc1cf){return db[_0xa8dc('0x24')][_0xa8dc('0x42')]({'where':{'id':_0x1932a2[_0xa8dc('0x41')]['id']}})[_0xa8dc('0x20')](handleEntityNotFound(_0x5bc1cf,null))[_0xa8dc('0x20')](removeEntity(_0x5bc1cf,null))[_0xa8dc('0x40')](handleError(_0x5bc1cf,null));}; \ No newline at end of file +var _0x03c5=['update','destroy','then','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x03c5,0x190));var _0x503c=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x03c5[_0x14e27a];return _0x288688;};'use strict';var emlformat=require(_0x503c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x503c('0x1'));var rp=require(_0x503c('0x2'));var moment=require(_0x503c('0x3'));var BPromise=require(_0x503c('0x4'));var Mustache=require(_0x503c('0x5'));var util=require('util');var path=require(_0x503c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x503c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x503c('0x8'));var squel=require(_0x503c('0x9'));var crypto=require('crypto');var jsforce=require(_0x503c('0xa'));var deskjs=require(_0x503c('0xb'));var toCsv=require(_0x503c('0xc'));var querystring=require(_0x503c('0xd'));var Papa=require(_0x503c('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x503c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x503c('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x503c('0x11'));var db=require(_0x503c('0x12'))['db'];function respondWithStatusCode(_0x17a5e8,_0x40b6d1){_0x40b6d1=_0x40b6d1||0xcc;return function(_0x2be185){if(_0x2be185){return _0x17a5e8[_0x503c('0x13')](_0x40b6d1);}return _0x17a5e8['status'](_0x40b6d1)[_0x503c('0x14')]();};}function respondWithResult(_0x29ab2b,_0x5b237d){_0x5b237d=_0x5b237d||0xc8;return function(_0x2f229e){if(_0x2f229e){return _0x29ab2b['status'](_0x5b237d)[_0x503c('0x15')](_0x2f229e);}};}function respondWithFilteredResult(_0x37d75d,_0x1da073){return function(_0x3bbae8){if(_0x3bbae8){var _0x290fc3=typeof _0x1da073[_0x503c('0x16')]==='undefined'&&typeof _0x1da073['limit']===_0x503c('0x17');var _0x701666=_0x3bbae8[_0x503c('0x18')];var _0x56ae58=_0x290fc3?0x0:_0x1da073[_0x503c('0x16')];var _0x2eaf12=_0x290fc3?_0x3bbae8['count']:_0x1da073[_0x503c('0x16')]+_0x1da073[_0x503c('0x19')];var _0xebff17;if(_0x2eaf12>=_0x701666){_0x2eaf12=_0x701666;_0xebff17=0xc8;}else{_0xebff17=0xce;}_0x37d75d[_0x503c('0x1a')](_0xebff17);return _0x37d75d[_0x503c('0x1b')](_0x503c('0x1c'),_0x56ae58+'-'+_0x2eaf12+'/'+_0x701666)[_0x503c('0x15')](_0x3bbae8);}return null;};}function patchUpdates(_0x4abbcf){return function(_0x41c166){try{jsonpatch[_0x503c('0x1d')](_0x41c166,_0x4abbcf,!![]);}catch(_0x540c18){return BPromise[_0x503c('0x1e')](_0x540c18);}return _0x41c166[_0x503c('0x1f')]();};}function saveUpdates(_0x124356,_0x436442){return function(_0x515e9c){if(_0x515e9c){return _0x515e9c[_0x503c('0x20')](_0x124356)['then'](function(_0x1b97ab){return _0x1b97ab;});}return null;};}function removeEntity(_0x20d618,_0x82562e){return function(_0x4f4f02){if(_0x4f4f02){return _0x4f4f02[_0x503c('0x21')]()[_0x503c('0x22')](function(){_0x20d618['status'](0xcc)[_0x503c('0x14')]();});}};}function handleEntityNotFound(_0x132e9e,_0x4355dc){return function(_0x207d3f){if(!_0x207d3f){_0x132e9e[_0x503c('0x13')](0x194);}return _0x207d3f;};}function handleError(_0x4f7bcb,_0x1aa099){_0x1aa099=_0x1aa099||0x1f4;return function(_0x59ecdd){logger['error'](_0x59ecdd[_0x503c('0x23')]);if(_0x59ecdd[_0x503c('0x24')]){delete _0x59ecdd['name'];}_0x4f7bcb[_0x503c('0x1a')](_0x1aa099)[_0x503c('0x25')](_0x59ecdd);};}exports[_0x503c('0x26')]=function(_0x5c8066,_0x6b7d42){var _0x35fe88={},_0x25b15c={},_0x4b75bd={'count':0x0,'rows':[]};var _0x1d84e9=_[_0x503c('0x27')](db[_0x503c('0x28')][_0x503c('0x29')],function(_0x27c0a7){return{'name':_0x27c0a7['fieldName'],'type':_0x27c0a7[_0x503c('0x2a')][_0x503c('0x2b')]};});_0x25b15c[_0x503c('0x2c')]=_[_0x503c('0x27')](_0x1d84e9,_0x503c('0x24'));_0x25b15c['query']=_['keys'](_0x5c8066[_0x503c('0x2d')]);_0x25b15c[_0x503c('0x2e')]=_[_0x503c('0x2f')](_0x25b15c[_0x503c('0x2c')],_0x25b15c['query']);_0x35fe88[_0x503c('0x30')]=_[_0x503c('0x2f')](_0x25b15c[_0x503c('0x2c')],qs[_0x503c('0x31')](_0x5c8066[_0x503c('0x2d')]['fields']));_0x35fe88[_0x503c('0x30')]=_0x35fe88[_0x503c('0x30')][_0x503c('0x32')]?_0x35fe88[_0x503c('0x30')]:_0x25b15c[_0x503c('0x2c')];if(!_0x5c8066[_0x503c('0x2d')][_0x503c('0x33')](_0x503c('0x34'))){_0x35fe88[_0x503c('0x19')]=qs[_0x503c('0x19')](_0x5c8066[_0x503c('0x2d')]['limit']);_0x35fe88[_0x503c('0x16')]=qs[_0x503c('0x16')](_0x5c8066[_0x503c('0x2d')][_0x503c('0x16')]);}_0x35fe88[_0x503c('0x35')]=qs[_0x503c('0x36')](_0x5c8066[_0x503c('0x2d')][_0x503c('0x36')]);_0x35fe88[_0x503c('0x37')]=qs['filters'](_[_0x503c('0x38')](_0x5c8066['query'],_0x25b15c[_0x503c('0x2e')]),_0x1d84e9);if(_0x5c8066[_0x503c('0x2d')][_0x503c('0x39')]){_0x35fe88[_0x503c('0x37')]=_[_0x503c('0x3a')](_0x35fe88['where'],{'$or':_['map'](_0x1d84e9,function(_0x59b690){if(_0x59b690['type']!==_0x503c('0x3b')){var _0x3949b0={};_0x3949b0[_0x59b690[_0x503c('0x24')]]={'$like':'%'+_0x5c8066['query'][_0x503c('0x39')]+'%'};return _0x3949b0;}})});}_0x35fe88=_[_0x503c('0x3a')]({},_0x35fe88,_0x5c8066[_0x503c('0x3c')]);var _0x1fadd0={'where':_0x35fe88['where']};return db[_0x503c('0x28')]['count'](_0x1fadd0)[_0x503c('0x22')](function(_0x21c9ab){_0x4b75bd[_0x503c('0x18')]=_0x21c9ab;if(_0x5c8066[_0x503c('0x2d')][_0x503c('0x3d')]){_0x35fe88[_0x503c('0x3e')]=[{'all':!![]}];}return db[_0x503c('0x28')][_0x503c('0x3f')](_0x35fe88);})['then'](function(_0x2178cc){_0x4b75bd[_0x503c('0x40')]=_0x2178cc;return _0x4b75bd;})[_0x503c('0x22')](respondWithFilteredResult(_0x6b7d42,_0x35fe88))[_0x503c('0x41')](handleError(_0x6b7d42,null));};exports[_0x503c('0x42')]=function(_0xbcbb22,_0x171231){var _0x35a569={'raw':!![],'where':{'id':_0xbcbb22['params']['id']}},_0x235a46={};_0x235a46['model']=_[_0x503c('0x43')](db['AnalyticTreeReport']['rawAttributes']);_0x235a46[_0x503c('0x2d')]=_[_0x503c('0x43')](_0xbcbb22[_0x503c('0x2d')]);_0x235a46[_0x503c('0x2e')]=_[_0x503c('0x2f')](_0x235a46[_0x503c('0x2c')],_0x235a46[_0x503c('0x2d')]);_0x35a569['attributes']=_[_0x503c('0x2f')](_0x235a46[_0x503c('0x2c')],qs[_0x503c('0x31')](_0xbcbb22['query'][_0x503c('0x31')]));_0x35a569[_0x503c('0x30')]=_0x35a569['attributes'][_0x503c('0x32')]?_0x35a569[_0x503c('0x30')]:_0x235a46[_0x503c('0x2c')];if(_0xbcbb22[_0x503c('0x2d')]['includeAll']){_0x35a569[_0x503c('0x3e')]=[{'all':!![]}];}_0x35a569=_[_0x503c('0x3a')]({},_0x35a569,_0xbcbb22['options']);return db['AnalyticTreeReport'][_0x503c('0x44')](_0x35a569)[_0x503c('0x22')](handleEntityNotFound(_0x171231,null))[_0x503c('0x22')](respondWithResult(_0x171231,null))[_0x503c('0x41')](handleError(_0x171231,null));};exports[_0x503c('0x45')]=function(_0x1a8f46,_0x5b8918){return db[_0x503c('0x28')][_0x503c('0x45')](_0x1a8f46[_0x503c('0x46')],{})[_0x503c('0x22')](respondWithResult(_0x5b8918,0xc9))['catch'](handleError(_0x5b8918,null));};exports['update']=function(_0x36bee6,_0x1af4c3){if(_0x36bee6[_0x503c('0x46')]['id']){delete _0x36bee6[_0x503c('0x46')]['id'];}return db[_0x503c('0x28')][_0x503c('0x44')]({'where':{'id':_0x36bee6[_0x503c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1af4c3,null))[_0x503c('0x22')](saveUpdates(_0x36bee6[_0x503c('0x46')],null))[_0x503c('0x22')](respondWithResult(_0x1af4c3,null))[_0x503c('0x41')](handleError(_0x1af4c3,null));};exports['destroy']=function(_0xff8bc2,_0x3aa8ce){return db[_0x503c('0x28')][_0x503c('0x44')]({'where':{'id':_0xff8bc2[_0x503c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa8ce,null))['then'](removeEntity(_0x3aa8ce,null))['catch'](handleError(_0x3aa8ce,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 4525557..287a8fc 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 _0x9b1f=['exports','define','analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x9b1f,0x1dc));var _0xf9b1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9b1f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xf9b1('0x0'));var util=require(_0xf9b1('0x1'));var logger=require(_0xf9b1('0x2'))('api');var moment=require(_0xf9b1('0x3'));var BPromise=require(_0xf9b1('0x4'));var rp=require(_0xf9b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9b1('0x6'));var attributes=require(_0xf9b1('0x7'));module[_0xf9b1('0x8')]=function(_0x926abd,_0x4ddd7d){return _0x926abd[_0xf9b1('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0xf9b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05c4=['moment','bluebird','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','lodash','util','api'];(function(_0x285cf1,_0x47e330){var _0x2fea93=function(_0x4129d6){while(--_0x4129d6){_0x285cf1['push'](_0x285cf1['shift']());}};_0x2fea93(++_0x47e330);}(_0x05c4,0x1bf));var _0x405c=function(_0x3c7434,_0x3a1789){_0x3c7434=_0x3c7434-0x0;var _0x327695=_0x05c4[_0x3c7434];return _0x327695;};'use strict';var _=require(_0x405c('0x0'));var util=require(_0x405c('0x1'));var logger=require('../../config/logger')(_0x405c('0x2'));var moment=require(_0x405c('0x3'));var BPromise=require(_0x405c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x405c('0x5'));var config=require(_0x405c('0x6'));var attributes=require(_0x405c('0x7'));module[_0x405c('0x8')]=function(_0x482657,_0xf10793){return _0x482657['define']('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index a972646..e6ec3d3 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x8e99f1,_0x3bf27c){_0x8e99f1=_0x8e99f1-0x0;var _0x2f34b4=_0x7a54[_0x8e99f1];return _0x2f34b4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x1ed052,_0xa3a348){var _0xcbd823=function(_0xee8588){while(--_0xee8588){_0x1ed052['push'](_0x1ed052['shift']());}};_0xcbd823(++_0xa3a348);}(_0xdb28,0x106));var _0x8db2=function(_0x16ac32,_0x48b274){_0x16ac32=_0x16ac32-0x0;var _0x1ad273=_0xdb28[_0x16ac32];return _0x1ad273;};'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 0cb6523..4275bf3 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 _0xbccb=['fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','get','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2ff0b5,_0x3ddd30){var _0x3e272e=function(_0x4f7d5c){while(--_0x4f7d5c){_0x2ff0b5['push'](_0x2ff0b5['shift']());}};_0x3e272e(++_0x3ddd30);}(_0xbccb,0x1bd));var _0xbbcc=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0xbccb[_0x28111f];return _0x5203e6;};'use strict';var multer=require('multer');var util=require(_0xbbcc('0x0'));var path=require(_0xbbcc('0x1'));var timeout=require(_0xbbcc('0x2'));var express=require(_0xbbcc('0x3'));var router=express[_0xbbcc('0x4')]();var fs_extra=require(_0xbbcc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbbcc('0x6'));var config=require(_0xbbcc('0x7'));var controller=require(_0xbbcc('0x8'));router['get']('/',auth[_0xbbcc('0x9')](),controller['index']);router[_0xbbcc('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbbcc('0x9')](),controller[_0xbbcc('0xb')]);router[_0xbbcc('0xc')]('/:id',auth[_0xbbcc('0x9')](),controller[_0xbbcc('0xd')]);router[_0xbbcc('0xe')](_0xbbcc('0xf'),auth[_0xbbcc('0x9')](),controller[_0xbbcc('0x10')]);module[_0xbbcc('0x11')]=router; \ No newline at end of file +var _0xfacc=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfacc,0x1b0));var _0xcfac=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xfacc[_0x3b5049];return _0x12454e;};'use strict';var multer=require(_0xcfac('0x0'));var util=require(_0xcfac('0x1'));var path=require(_0xcfac('0x2'));var timeout=require(_0xcfac('0x3'));var express=require(_0xcfac('0x4'));var router=express['Router']();var fs_extra=require(_0xcfac('0x5'));var auth=require(_0xcfac('0x6'));var interaction=require(_0xcfac('0x7'));var config=require(_0xcfac('0x8'));var controller=require('./analyticTreeReport.controller');router[_0xcfac('0x9')]('/',auth[_0xcfac('0xa')](),controller['index']);router[_0xcfac('0x9')]('/:id',auth[_0xcfac('0xa')](),controller[_0xcfac('0xb')]);router['post']('/',auth[_0xcfac('0xa')](),controller[_0xcfac('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcfac('0xd')]);router['delete']('/:id',auth[_0xcfac('0xa')](),controller[_0xcfac('0xe')]);module[_0xcfac('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 905be7a..e9032bf 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 _0x87ae=['STRING'];(function(_0x22e79d,_0xcafc45){var _0x587a68=function(_0x34a7fe){while(--_0x34a7fe){_0x22e79d['push'](_0x22e79d['shift']());}};_0x587a68(++_0xcafc45);}(_0x87ae,0xf5));var _0xe87a=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x87ae[_0x6a0266];return _0x309e00;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe87a('0x0')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcee0=['STRING','sequelize','exports'];(function(_0x166f54,_0x467e5c){var _0x41fc2b=function(_0x2481e3){while(--_0x2481e3){_0x166f54['push'](_0x166f54['shift']());}};_0x41fc2b(++_0x467e5c);}(_0xcee0,0x1e1));var _0x0cee=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xcee0[_0x548200];return _0x1a6d74;};'use strict';var Sequelize=require(_0x0cee('0x0'));module[_0x0cee('0x1')]={'name':{'type':Sequelize[_0x0cee('0x2')]},'basename':{'type':Sequelize[_0x0cee('0x2')]},'type':{'type':Sequelize[_0x0cee('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 7628208..4b4c023 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 _0x01f6=['query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','keys','fields','options','params','find','get','omit','updatedAt','body','createdAt','create','update','destroy','file','originalname','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','basename','rimraf','zip-dir','request-promise','moment','mustache','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','index','map','Attachment','rawAttributes','fieldName','type'];(function(_0x25f9f6,_0x2916e2){var _0x17910a=function(_0x228355){while(--_0x228355){_0x25f9f6['push'](_0x25f9f6['shift']());}};_0x17910a(++_0x2916e2);}(_0x01f6,0xde));var _0x601f=function(_0xdfb29a,_0x3443b5){_0xdfb29a=_0xdfb29a-0x0;var _0x52f21e=_0x01f6[_0xdfb29a];return _0x52f21e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x601f('0x0'));var zipdir=require(_0x601f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x601f('0x2'));var moment=require(_0x601f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x601f('0x4'));var util=require('util');var path=require(_0x601f('0x5'));var sox=require(_0x601f('0x6'));var csv=require('to-csv');var ejs=require(_0x601f('0x7'));var fs=require('fs');var fs_extra=require(_0x601f('0x8'));var _=require(_0x601f('0x9'));var squel=require(_0x601f('0xa'));var crypto=require(_0x601f('0xb'));var jsforce=require(_0x601f('0xc'));var deskjs=require(_0x601f('0xd'));var toCsv=require(_0x601f('0xe'));var querystring=require(_0x601f('0xf'));var Papa=require(_0x601f('0x10'));var Redis=require(_0x601f('0x11'));var authService=require(_0x601f('0x12'));var qs=require(_0x601f('0x13'));var as=require(_0x601f('0x14'));var hardwareService=require(_0x601f('0x15'));var logger=require(_0x601f('0x16'))('api');var utils=require(_0x601f('0x17'));var config=require(_0x601f('0x18'));var licenseUtil=require(_0x601f('0x19'));var db=require(_0x601f('0x1a'))['db'];function respondWithStatusCode(_0x201024,_0x3d0340){_0x3d0340=_0x3d0340||0xcc;return function(_0x411f45){if(_0x411f45){return _0x201024[_0x601f('0x1b')](_0x3d0340);}return _0x201024[_0x601f('0x1c')](_0x3d0340)[_0x601f('0x1d')]();};}function respondWithResult(_0x166d2d,_0x45d067){_0x45d067=_0x45d067||0xc8;return function(_0x247804){if(_0x247804){return _0x166d2d[_0x601f('0x1c')](_0x45d067)[_0x601f('0x1e')](_0x247804);}};}function respondWithFilteredResult(_0x84e507,_0x39544f){return function(_0x460a85){if(_0x460a85){var _0x1b67d9=typeof _0x39544f[_0x601f('0x1f')]===_0x601f('0x20')&&typeof _0x39544f[_0x601f('0x21')]===_0x601f('0x20');var _0x4740e2=_0x460a85[_0x601f('0x22')];var _0xa1dc1b=_0x1b67d9?0x0:_0x39544f['offset'];var _0x18a010=_0x1b67d9?_0x460a85[_0x601f('0x22')]:_0x39544f[_0x601f('0x1f')]+_0x39544f[_0x601f('0x21')];var _0x2f1018;if(_0x18a010>=_0x4740e2){_0x18a010=_0x4740e2;_0x2f1018=0xc8;}else{_0x2f1018=0xce;}_0x84e507[_0x601f('0x1c')](_0x2f1018);return _0x84e507[_0x601f('0x23')](_0x601f('0x24'),_0xa1dc1b+'-'+_0x18a010+'/'+_0x4740e2)[_0x601f('0x1e')](_0x460a85);}return null;};}function patchUpdates(_0x55438e){return function(_0x5406b9){try{jsonpatch[_0x601f('0x25')](_0x5406b9,_0x55438e,!![]);}catch(_0x32362a){return BPromise[_0x601f('0x26')](_0x32362a);}return _0x5406b9['save']();};}function saveUpdates(_0x4f1f6f,_0x4f8646){return function(_0x12fd7b){if(_0x12fd7b){return _0x12fd7b['update'](_0x4f1f6f)[_0x601f('0x27')](function(_0x30442c){return _0x30442c;});}return null;};}function removeEntity(_0x354399,_0x4b7b0f){return function(_0x3abc1e){if(_0x3abc1e){return _0x3abc1e['destroy']()[_0x601f('0x27')](function(){_0x354399[_0x601f('0x1c')](0xcc)[_0x601f('0x1d')]();});}};}function handleEntityNotFound(_0x4d6289,_0xa6d287){return function(_0x2bf702){if(!_0x2bf702){_0x4d6289[_0x601f('0x1b')](0x194);}return _0x2bf702;};}function handleError(_0x23ea8b,_0x5dcfae){_0x5dcfae=_0x5dcfae||0x1f4;return function(_0x9ff0ea){logger['error'](_0x9ff0ea[_0x601f('0x28')]);if(_0x9ff0ea[_0x601f('0x29')]){delete _0x9ff0ea[_0x601f('0x29')];}_0x23ea8b['status'](_0x5dcfae)['send'](_0x9ff0ea);};}exports[_0x601f('0x2a')]=function(_0x4e0649,_0x257749){var _0x16cd27={},_0x2d884a={},_0x189d8e={'count':0x0,'rows':[]};var _0x4eccf3=_[_0x601f('0x2b')](db[_0x601f('0x2c')][_0x601f('0x2d')],function(_0x649bdc){return{'name':_0x649bdc[_0x601f('0x2e')],'type':_0x649bdc[_0x601f('0x2f')]['key']};});_0x2d884a['model']=_[_0x601f('0x2b')](_0x4eccf3,_0x601f('0x29'));_0x2d884a['query']=_['keys'](_0x4e0649[_0x601f('0x30')]);_0x2d884a[_0x601f('0x31')]=_[_0x601f('0x32')](_0x2d884a[_0x601f('0x33')],_0x2d884a[_0x601f('0x30')]);_0x16cd27[_0x601f('0x34')]=_[_0x601f('0x32')](_0x2d884a[_0x601f('0x33')],qs['fields'](_0x4e0649['query']['fields']));_0x16cd27[_0x601f('0x34')]=_0x16cd27[_0x601f('0x34')][_0x601f('0x35')]?_0x16cd27[_0x601f('0x34')]:_0x2d884a[_0x601f('0x33')];if(!_0x4e0649['query'][_0x601f('0x36')](_0x601f('0x37'))){_0x16cd27[_0x601f('0x21')]=qs[_0x601f('0x21')](_0x4e0649[_0x601f('0x30')][_0x601f('0x21')]);_0x16cd27[_0x601f('0x1f')]=qs[_0x601f('0x1f')](_0x4e0649['query'][_0x601f('0x1f')]);}_0x16cd27[_0x601f('0x38')]=qs[_0x601f('0x39')](_0x4e0649[_0x601f('0x30')]['sort']);_0x16cd27['where']=qs[_0x601f('0x31')](_['pick'](_0x4e0649[_0x601f('0x30')],_0x2d884a[_0x601f('0x31')]),_0x4eccf3);if(_0x4e0649[_0x601f('0x30')][_0x601f('0x3a')]){_0x16cd27[_0x601f('0x3b')]=_[_0x601f('0x3c')](_0x16cd27['where'],{'$or':_[_0x601f('0x2b')](_0x4eccf3,function(_0x1334ea){if(_0x1334ea[_0x601f('0x2f')]!==_0x601f('0x3d')){var _0x40e81d={};_0x40e81d[_0x1334ea[_0x601f('0x29')]]={'$like':'%'+_0x4e0649[_0x601f('0x30')]['filter']+'%'};return _0x40e81d;}})});}_0x16cd27=_[_0x601f('0x3c')]({},_0x16cd27,_0x4e0649['options']);var _0x42a001={'where':_0x16cd27['where']};return db[_0x601f('0x2c')][_0x601f('0x22')](_0x42a001)[_0x601f('0x27')](function(_0x36e765){_0x189d8e[_0x601f('0x22')]=_0x36e765;if(_0x4e0649[_0x601f('0x30')][_0x601f('0x3e')]){_0x16cd27[_0x601f('0x3f')]=[{'all':!![]}];}return db[_0x601f('0x2c')]['findAll'](_0x16cd27);})[_0x601f('0x27')](function(_0xca1472){_0x189d8e[_0x601f('0x40')]=_0xca1472;return _0x189d8e;})[_0x601f('0x27')](respondWithFilteredResult(_0x257749,_0x16cd27))[_0x601f('0x41')](handleError(_0x257749,null));};exports[_0x601f('0x42')]=function(_0x55783c,_0x593b49){var _0x462980={'raw':!![],'where':{'id':_0x55783c['params']['id']}},_0x38de25={};_0x38de25[_0x601f('0x33')]=_[_0x601f('0x43')](db[_0x601f('0x2c')][_0x601f('0x2d')]);_0x38de25['query']=_[_0x601f('0x43')](_0x55783c[_0x601f('0x30')]);_0x38de25[_0x601f('0x31')]=_['intersection'](_0x38de25[_0x601f('0x33')],_0x38de25[_0x601f('0x30')]);_0x462980['attributes']=_[_0x601f('0x32')](_0x38de25[_0x601f('0x33')],qs['fields'](_0x55783c[_0x601f('0x30')][_0x601f('0x44')]));_0x462980[_0x601f('0x34')]=_0x462980[_0x601f('0x34')][_0x601f('0x35')]?_0x462980[_0x601f('0x34')]:_0x38de25[_0x601f('0x33')];if(_0x55783c[_0x601f('0x30')][_0x601f('0x3e')]){_0x462980['include']=[{'all':!![]}];}_0x462980=_['merge']({},_0x462980,_0x55783c[_0x601f('0x45')]);return db[_0x601f('0x2c')]['find'](_0x462980)['then'](handleEntityNotFound(_0x593b49,null))[_0x601f('0x27')](respondWithResult(_0x593b49,null))[_0x601f('0x41')](handleError(_0x593b49,null));};exports['clone']=function(_0x544a0a,_0x169116){var _0x17d75c={'where':{'id':_0x544a0a[_0x601f('0x46')]['id']}},_0x324a08={};_0x324a08[_0x601f('0x33')]=_[_0x601f('0x43')](db['Attachment'][_0x601f('0x2d')]);_0x17d75c[_0x601f('0x34')]=_[_0x601f('0x32')](_0x324a08[_0x601f('0x33')],qs['fields'](_0x544a0a[_0x601f('0x30')][_0x601f('0x44')]));_0x17d75c['attributes']=_0x17d75c[_0x601f('0x34')][_0x601f('0x35')]?_0x17d75c['attributes']:_0x324a08[_0x601f('0x33')];if(_0x544a0a[_0x601f('0x30')]['includeAll']){_0x17d75c['include']=[{'all':!![]}];}_0x17d75c=_[_0x601f('0x3c')]({},_0x17d75c,_0x544a0a['options']);return db[_0x601f('0x2c')][_0x601f('0x47')](_0x17d75c)[_0x601f('0x27')](handleEntityNotFound(_0x169116,null))[_0x601f('0x27')](function(_0x2399d2){if(_0x2399d2){var _0x35529c=_0x2399d2[_0x601f('0x48')]({'plain':!![]});_0x35529c=qs[_0x601f('0x49')](_0x35529c,['id','createdAt',_0x601f('0x4a')]);_0x544a0a[_0x601f('0x4b')]=_[_0x601f('0x49')](_0x544a0a[_0x601f('0x4b')],['id',_0x601f('0x4c'),'updatedAt']);return db['Attachment'][_0x601f('0x4d')](_['merge'](_0x35529c,_0x544a0a[_0x601f('0x4b')]),{'include':_0x544a0a[_0x601f('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x601f('0x27')](respondWithResult(_0x169116,0xc9))['catch'](handleError(_0x169116,null));};exports[_0x601f('0x4e')]=function(_0x4ebaf9,_0x25b681){if(_0x4ebaf9[_0x601f('0x4b')]['id']){delete _0x4ebaf9[_0x601f('0x4b')]['id'];}return db['Attachment']['find']({'where':{'id':_0x4ebaf9['params']['id']}})['then'](handleEntityNotFound(_0x25b681,null))[_0x601f('0x27')](saveUpdates(_0x4ebaf9[_0x601f('0x4b')],null))[_0x601f('0x27')](respondWithResult(_0x25b681,null))[_0x601f('0x41')](handleError(_0x25b681,null));};exports[_0x601f('0x4f')]=function(_0x35432d,_0x400502){return db[_0x601f('0x2c')][_0x601f('0x47')]({'where':{'id':_0x35432d[_0x601f('0x46')]['id']}})['then'](handleEntityNotFound(_0x400502,null))[_0x601f('0x27')](removeEntity(_0x400502,null))[_0x601f('0x41')](handleError(_0x400502,null));};exports['create']=function(_0x46c0b3,_0x241f62,_0x46135d){_0x46c0b3[_0x601f('0x4b')][_0x601f('0x29')]=_0x46c0b3[_0x601f('0x50')][_0x601f('0x51')];_0x46c0b3[_0x601f('0x4b')]['basename']=_0x46c0b3[_0x601f('0x50')][_0x601f('0x52')];_0x46c0b3[_0x601f('0x4b')][_0x601f('0x2f')]=_0x46c0b3['file']['mimetype'];return db[_0x601f('0x2c')][_0x601f('0x4d')](_0x46c0b3['body'])['then'](respondWithResult(_0x241f62,0xc9))['catch'](handleError(_0x241f62,null));};exports[_0x601f('0x53')]=function(_0x16129c,_0x2f34ad,_0x395bec){return db[_0x601f('0x2c')][_0x601f('0x54')]({'where':{'id':_0x16129c[_0x601f('0x46')]['id']},'raw':!![]})[_0x601f('0x27')](handleEntityNotFound(_0x2f34ad,null))['then'](function(_0x201243){if(_0x201243){var _0x139c66=_0x201243[_0x601f('0x55')]!==null;var _0x647971=path[_0x601f('0x56')](config[_0x601f('0x57')],_0x601f('0x58'));if(_0x139c66){_0x647971=path['join'](_0x647971,'offline-chat/');}var _0x19c081=path[_0x601f('0x56')](_0x647971,_0x201243[_0x601f('0x59')]);return _0x2f34ad[_0x601f('0x53')](_0x19c081);}})[_0x601f('0x41')](handleError(_0x2f34ad,null));}; \ No newline at end of file +var _0xc4ad=['../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Attachment','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','clone','get','omit','createdAt','updatedAt','body','create','destroy','originalname','file','filename','mimetype','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc4ad,0x199));var _0xdc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ad[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xdc4a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc4a('0x1'));var jsonpatch=require(_0xdc4a('0x2'));var rp=require(_0xdc4a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdc4a('0x4'));var util=require('util');var path=require(_0xdc4a('0x5'));var sox=require('sox');var csv=require(_0xdc4a('0x6'));var ejs=require(_0xdc4a('0x7'));var fs=require('fs');var fs_extra=require(_0xdc4a('0x8'));var _=require(_0xdc4a('0x9'));var squel=require(_0xdc4a('0xa'));var crypto=require(_0xdc4a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xdc4a('0xc'));var toCsv=require(_0xdc4a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdc4a('0xd'));var qs=require(_0xdc4a('0xe'));var as=require(_0xdc4a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc4a('0x10'))('api');var utils=require(_0xdc4a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xdc4a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5712a2,_0x21a86f){_0x21a86f=_0x21a86f||0xcc;return function(_0x3c339c){if(_0x3c339c){return _0x5712a2[_0xdc4a('0x13')](_0x21a86f);}return _0x5712a2[_0xdc4a('0x14')](_0x21a86f)[_0xdc4a('0x15')]();};}function respondWithResult(_0x96b871,_0x4fc2b5){_0x4fc2b5=_0x4fc2b5||0xc8;return function(_0x41f8bf){if(_0x41f8bf){return _0x96b871[_0xdc4a('0x14')](_0x4fc2b5)[_0xdc4a('0x16')](_0x41f8bf);}};}function respondWithFilteredResult(_0x1e6685,_0x44d043){return function(_0x1981e3){if(_0x1981e3){var _0x24b290=typeof _0x44d043[_0xdc4a('0x17')]===_0xdc4a('0x18')&&typeof _0x44d043['limit']==='undefined';var _0x2dba72=_0x1981e3[_0xdc4a('0x19')];var _0x4ab303=_0x24b290?0x0:_0x44d043[_0xdc4a('0x17')];var _0xc7797a=_0x24b290?_0x1981e3['count']:_0x44d043['offset']+_0x44d043[_0xdc4a('0x1a')];var _0x39394c;if(_0xc7797a>=_0x2dba72){_0xc7797a=_0x2dba72;_0x39394c=0xc8;}else{_0x39394c=0xce;}_0x1e6685['status'](_0x39394c);return _0x1e6685[_0xdc4a('0x1b')](_0xdc4a('0x1c'),_0x4ab303+'-'+_0xc7797a+'/'+_0x2dba72)[_0xdc4a('0x16')](_0x1981e3);}return null;};}function patchUpdates(_0x461046){return function(_0x576bd6){try{jsonpatch[_0xdc4a('0x1d')](_0x576bd6,_0x461046,!![]);}catch(_0x3b9dea){return BPromise['reject'](_0x3b9dea);}return _0x576bd6[_0xdc4a('0x1e')]();};}function saveUpdates(_0x513daf,_0x3b0eb9){return function(_0x1d1ce0){if(_0x1d1ce0){return _0x1d1ce0[_0xdc4a('0x1f')](_0x513daf)[_0xdc4a('0x20')](function(_0x2884b8){return _0x2884b8;});}return null;};}function removeEntity(_0x566941,_0x11db05){return function(_0x5cf1cf){if(_0x5cf1cf){return _0x5cf1cf['destroy']()[_0xdc4a('0x20')](function(){_0x566941['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x587800,_0x1a8033){return function(_0x387c8a){if(!_0x387c8a){_0x587800[_0xdc4a('0x13')](0x194);}return _0x387c8a;};}function handleError(_0x4cf1cc,_0x3f89ab){_0x3f89ab=_0x3f89ab||0x1f4;return function(_0x52eaaa){logger[_0xdc4a('0x21')](_0x52eaaa[_0xdc4a('0x22')]);if(_0x52eaaa[_0xdc4a('0x23')]){delete _0x52eaaa[_0xdc4a('0x23')];}_0x4cf1cc[_0xdc4a('0x14')](_0x3f89ab)[_0xdc4a('0x24')](_0x52eaaa);};}exports[_0xdc4a('0x25')]=function(_0x4551be,_0x4ed91a){var _0xa2bc={},_0x5ad3a7={},_0x51dc1e={'count':0x0,'rows':[]};var _0x15d586=_[_0xdc4a('0x26')](db[_0xdc4a('0x27')][_0xdc4a('0x28')],function(_0x42540a){return{'name':_0x42540a['fieldName'],'type':_0x42540a[_0xdc4a('0x29')]['key']};});_0x5ad3a7[_0xdc4a('0x2a')]=_[_0xdc4a('0x26')](_0x15d586,'name');_0x5ad3a7[_0xdc4a('0x2b')]=_['keys'](_0x4551be[_0xdc4a('0x2b')]);_0x5ad3a7[_0xdc4a('0x2c')]=_['intersection'](_0x5ad3a7[_0xdc4a('0x2a')],_0x5ad3a7[_0xdc4a('0x2b')]);_0xa2bc[_0xdc4a('0x2d')]=_['intersection'](_0x5ad3a7['model'],qs[_0xdc4a('0x2e')](_0x4551be[_0xdc4a('0x2b')][_0xdc4a('0x2e')]));_0xa2bc[_0xdc4a('0x2d')]=_0xa2bc[_0xdc4a('0x2d')][_0xdc4a('0x2f')]?_0xa2bc[_0xdc4a('0x2d')]:_0x5ad3a7[_0xdc4a('0x2a')];if(!_0x4551be[_0xdc4a('0x2b')][_0xdc4a('0x30')]('nolimit')){_0xa2bc[_0xdc4a('0x1a')]=qs[_0xdc4a('0x1a')](_0x4551be[_0xdc4a('0x2b')]['limit']);_0xa2bc[_0xdc4a('0x17')]=qs[_0xdc4a('0x17')](_0x4551be['query'][_0xdc4a('0x17')]);}_0xa2bc['order']=qs['sort'](_0x4551be[_0xdc4a('0x2b')][_0xdc4a('0x31')]);_0xa2bc[_0xdc4a('0x32')]=qs[_0xdc4a('0x2c')](_[_0xdc4a('0x33')](_0x4551be[_0xdc4a('0x2b')],_0x5ad3a7[_0xdc4a('0x2c')]),_0x15d586);if(_0x4551be[_0xdc4a('0x2b')]['filter']){_0xa2bc[_0xdc4a('0x32')]=_[_0xdc4a('0x34')](_0xa2bc[_0xdc4a('0x32')],{'$or':_[_0xdc4a('0x26')](_0x15d586,function(_0x16e225){if(_0x16e225[_0xdc4a('0x29')]!==_0xdc4a('0x35')){var _0x5c3a9={};_0x5c3a9[_0x16e225[_0xdc4a('0x23')]]={'$like':'%'+_0x4551be['query'][_0xdc4a('0x36')]+'%'};return _0x5c3a9;}})});}_0xa2bc=_['merge']({},_0xa2bc,_0x4551be[_0xdc4a('0x37')]);var _0x593a24={'where':_0xa2bc[_0xdc4a('0x32')]};return db['Attachment'][_0xdc4a('0x19')](_0x593a24)[_0xdc4a('0x20')](function(_0x16d86a){_0x51dc1e[_0xdc4a('0x19')]=_0x16d86a;if(_0x4551be[_0xdc4a('0x2b')][_0xdc4a('0x38')]){_0xa2bc[_0xdc4a('0x39')]=[{'all':!![]}];}return db[_0xdc4a('0x27')][_0xdc4a('0x3a')](_0xa2bc);})['then'](function(_0x1ef02c){_0x51dc1e[_0xdc4a('0x3b')]=_0x1ef02c;return _0x51dc1e;})[_0xdc4a('0x20')](respondWithFilteredResult(_0x4ed91a,_0xa2bc))[_0xdc4a('0x3c')](handleError(_0x4ed91a,null));};exports[_0xdc4a('0x3d')]=function(_0x1a52f7,_0x453c58){var _0x169bfe={'raw':!![],'where':{'id':_0x1a52f7[_0xdc4a('0x3e')]['id']}},_0x5c54c5={};_0x5c54c5['model']=_[_0xdc4a('0x3f')](db[_0xdc4a('0x27')][_0xdc4a('0x28')]);_0x5c54c5['query']=_[_0xdc4a('0x3f')](_0x1a52f7['query']);_0x5c54c5[_0xdc4a('0x2c')]=_[_0xdc4a('0x40')](_0x5c54c5[_0xdc4a('0x2a')],_0x5c54c5[_0xdc4a('0x2b')]);_0x169bfe[_0xdc4a('0x2d')]=_[_0xdc4a('0x40')](_0x5c54c5[_0xdc4a('0x2a')],qs[_0xdc4a('0x2e')](_0x1a52f7[_0xdc4a('0x2b')][_0xdc4a('0x2e')]));_0x169bfe[_0xdc4a('0x2d')]=_0x169bfe[_0xdc4a('0x2d')]['length']?_0x169bfe[_0xdc4a('0x2d')]:_0x5c54c5['model'];if(_0x1a52f7['query'][_0xdc4a('0x38')]){_0x169bfe['include']=[{'all':!![]}];}_0x169bfe=_[_0xdc4a('0x34')]({},_0x169bfe,_0x1a52f7[_0xdc4a('0x37')]);return db[_0xdc4a('0x27')][_0xdc4a('0x41')](_0x169bfe)[_0xdc4a('0x20')](handleEntityNotFound(_0x453c58,null))[_0xdc4a('0x20')](respondWithResult(_0x453c58,null))[_0xdc4a('0x3c')](handleError(_0x453c58,null));};exports[_0xdc4a('0x42')]=function(_0x31e725,_0x54fac0){var _0x1f07cb={'where':{'id':_0x31e725['params']['id']}},_0x2cbb74={};_0x2cbb74[_0xdc4a('0x2a')]=_[_0xdc4a('0x3f')](db[_0xdc4a('0x27')]['rawAttributes']);_0x1f07cb[_0xdc4a('0x2d')]=_[_0xdc4a('0x40')](_0x2cbb74[_0xdc4a('0x2a')],qs[_0xdc4a('0x2e')](_0x31e725[_0xdc4a('0x2b')][_0xdc4a('0x2e')]));_0x1f07cb[_0xdc4a('0x2d')]=_0x1f07cb[_0xdc4a('0x2d')][_0xdc4a('0x2f')]?_0x1f07cb[_0xdc4a('0x2d')]:_0x2cbb74[_0xdc4a('0x2a')];if(_0x31e725[_0xdc4a('0x2b')]['includeAll']){_0x1f07cb[_0xdc4a('0x39')]=[{'all':!![]}];}_0x1f07cb=_[_0xdc4a('0x34')]({},_0x1f07cb,_0x31e725[_0xdc4a('0x37')]);return db['Attachment']['find'](_0x1f07cb)[_0xdc4a('0x20')](handleEntityNotFound(_0x54fac0,null))[_0xdc4a('0x20')](function(_0x1a1b35){if(_0x1a1b35){var _0x5d11a9=_0x1a1b35[_0xdc4a('0x43')]({'plain':!![]});_0x5d11a9=qs[_0xdc4a('0x44')](_0x5d11a9,['id',_0xdc4a('0x45'),_0xdc4a('0x46')]);_0x31e725[_0xdc4a('0x47')]=_['omit'](_0x31e725[_0xdc4a('0x47')],['id',_0xdc4a('0x45'),_0xdc4a('0x46')]);return db[_0xdc4a('0x27')][_0xdc4a('0x48')](_[_0xdc4a('0x34')](_0x5d11a9,_0x31e725[_0xdc4a('0x47')]),{'include':_0x31e725[_0xdc4a('0x2b')][_0xdc4a('0x38')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x54fac0,0xc9))[_0xdc4a('0x3c')](handleError(_0x54fac0,null));};exports[_0xdc4a('0x1f')]=function(_0x557d12,_0xa9a24b){if(_0x557d12['body']['id']){delete _0x557d12[_0xdc4a('0x47')]['id'];}return db[_0xdc4a('0x27')][_0xdc4a('0x41')]({'where':{'id':_0x557d12['params']['id']}})['then'](handleEntityNotFound(_0xa9a24b,null))[_0xdc4a('0x20')](saveUpdates(_0x557d12['body'],null))[_0xdc4a('0x20')](respondWithResult(_0xa9a24b,null))['catch'](handleError(_0xa9a24b,null));};exports[_0xdc4a('0x49')]=function(_0x1e3368,_0x3323b3){return db[_0xdc4a('0x27')][_0xdc4a('0x41')]({'where':{'id':_0x1e3368['params']['id']}})[_0xdc4a('0x20')](handleEntityNotFound(_0x3323b3,null))[_0xdc4a('0x20')](removeEntity(_0x3323b3,null))['catch'](handleError(_0x3323b3,null));};exports[_0xdc4a('0x48')]=function(_0x111e1f,_0x3fe274,_0x46c29e){_0x111e1f['body'][_0xdc4a('0x23')]=_0x111e1f['file'][_0xdc4a('0x4a')];_0x111e1f[_0xdc4a('0x47')]['basename']=_0x111e1f[_0xdc4a('0x4b')][_0xdc4a('0x4c')];_0x111e1f['body'][_0xdc4a('0x29')]=_0x111e1f['file'][_0xdc4a('0x4d')];return db[_0xdc4a('0x27')][_0xdc4a('0x48')](_0x111e1f[_0xdc4a('0x47')])[_0xdc4a('0x20')](respondWithResult(_0x3fe274,0xc9))[_0xdc4a('0x3c')](handleError(_0x3fe274,null));};exports['download']=function(_0x19047d,_0xc72d68,_0x40b5ca){return db[_0xdc4a('0x27')][_0xdc4a('0x4e')]({'where':{'id':_0x19047d[_0xdc4a('0x3e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xc72d68,null))[_0xdc4a('0x20')](function(_0x2a0a53){if(_0x2a0a53){var _0x50d01a=_0x2a0a53[_0xdc4a('0x4f')]!==null;var _0x4dc2ad=path[_0xdc4a('0x50')](config[_0xdc4a('0x51')],_0xdc4a('0x52'));if(_0x50d01a){_0x4dc2ad=path[_0xdc4a('0x50')](_0x4dc2ad,_0xdc4a('0x53'));}var _0x450ac4=path[_0xdc4a('0x50')](_0x4dc2ad,_0x2a0a53[_0xdc4a('0x54')]);return _0xc72d68['download'](_0x450ac4);}})[_0xdc4a('0x3c')](handleError(_0xc72d68,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index b7f3def..204f77c 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 _0x1a03=['api','moment','request-promise','path','./attachment.attributes','exports','attachments','lodash','../../config/logger'];(function(_0x43ad90,_0x72f7fd){var _0x341ea2=function(_0x4d0dcd){while(--_0x4d0dcd){_0x43ad90['push'](_0x43ad90['shift']());}};_0x341ea2(++_0x72f7fd);}(_0x1a03,0x73));var _0x31a0=function(_0x1f7a55,_0x352d22){_0x1f7a55=_0x1f7a55-0x0;var _0x2a291b=_0x1a03[_0x1f7a55];return _0x2a291b;};'use strict';var _=require(_0x31a0('0x0'));var util=require('util');var logger=require(_0x31a0('0x1'))(_0x31a0('0x2'));var moment=require(_0x31a0('0x3'));var BPromise=require('bluebird');var rp=require(_0x31a0('0x4'));var fs=require('fs');var path=require(_0x31a0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x31a0('0x6'));module[_0x31a0('0x7')]=function(_0x4d810c,_0xf023ed){return _0x4d810c['define']('Attachment',attributes,{'tableName':_0x31a0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb0ec=['./attachment.attributes','exports','attachments','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3441e9,_0x269c8a){var _0x7f9ada=function(_0x4e62fd){while(--_0x4e62fd){_0x3441e9['push'](_0x3441e9['shift']());}};_0x7f9ada(++_0x269c8a);}(_0xb0ec,0x1f2));var _0xcb0e=function(_0x449c1f,_0x535bdb){_0x449c1f=_0x449c1f-0x0;var _0x1167e1=_0xb0ec[_0x449c1f];return _0x1167e1;};'use strict';var _=require(_0xcb0e('0x0'));var util=require(_0xcb0e('0x1'));var logger=require(_0xcb0e('0x2'))('api');var moment=require(_0xcb0e('0x3'));var BPromise=require(_0xcb0e('0x4'));var rp=require(_0xcb0e('0x5'));var fs=require('fs');var path=require(_0xcb0e('0x6'));var rimraf=require('rimraf');var config=require(_0xcb0e('0x7'));var attributes=require(_0xcb0e('0x8'));module[_0xcb0e('0x9')]=function(_0x42ec6d,_0x419391){return _0x42ec6d['define']('Attachment',attributes,{'tableName':_0xcb0e('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 a1c1a4d..afa15f5 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 _0xfa2f=['result','catch','CreateAttachment','Attachment','create','body','options','raw','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent'];(function(_0x2c892e,_0x169a5b){var _0x10d0e4=function(_0x48c77d){while(--_0x48c77d){_0x2c892e['push'](_0x2c892e['shift']());}};_0x10d0e4(++_0x169a5b);}(_0xfa2f,0xe8));var _0xffa2=function(_0x5c3342,_0x24dc2c){_0x5c3342=_0x5c3342-0x0;var _0x45624f=_0xfa2f[_0x5c3342];return _0x45624f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xffa2('0x0'));var BPromise=require('bluebird');var rs=require(_0xffa2('0x1'));var fs=require('fs');var Redis=require(_0xffa2('0x2'));var db=require(_0xffa2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xffa2('0x4'))(_0xffa2('0x5'));var config=require(_0xffa2('0x6'));var jayson=require(_0xffa2('0x7'));var client=jayson[_0xffa2('0x8')][_0xffa2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x215134,_0x489257,_0x4c6406){return new BPromise(function(_0x34cf1b,_0x20a710){return client[_0xffa2('0xa')](_0x215134,_0x4c6406)[_0xffa2('0xb')](function(_0x3462ae){logger[_0xffa2('0xc')](_0xffa2('0xd'),_0x489257,'request\x20sent');logger[_0xffa2('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x489257,'request\x20sent',JSON[_0xffa2('0xf')](_0x3462ae));if(_0x3462ae[_0xffa2('0x10')]){if(_0x3462ae[_0xffa2('0x10')][_0xffa2('0x11')]===0x1f4){logger[_0xffa2('0x10')]('Attachment,\x20%s,\x20%s',_0x489257,_0x3462ae[_0xffa2('0x10')][_0xffa2('0x12')]);return _0x20a710(_0x3462ae[_0xffa2('0x10')][_0xffa2('0x12')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x489257,_0x3462ae[_0xffa2('0x10')][_0xffa2('0x12')]);return _0x34cf1b(_0x3462ae[_0xffa2('0x10')]['message']);}else{logger[_0xffa2('0xc')](_0xffa2('0xd'),_0x489257,_0xffa2('0x13'));_0x34cf1b(_0x3462ae[_0xffa2('0x14')][_0xffa2('0x12')]);}})[_0xffa2('0x15')](function(_0x892043){logger['error'](_0xffa2('0xd'),_0x489257,_0x892043);_0x20a710(_0x892043);});});}exports[_0xffa2('0x16')]=function(_0x923abf){var _0x2ae03f=this;return new Promise(function(_0x2b71e7,_0x4e396f){return db[_0xffa2('0x17')][_0xffa2('0x18')](_0x923abf[_0xffa2('0x19')],{'raw':_0x923abf[_0xffa2('0x1a')]?_0x923abf[_0xffa2('0x1a')][_0xffa2('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x6c9785){logger[_0xffa2('0xc')](_0xffa2('0x16'),_0x923abf);logger['debug'](_0xffa2('0x16'),_0x923abf,JSON['stringify'](_0x6c9785));_0x2b71e7(_0x6c9785);})[_0xffa2('0x15')](function(_0x3f602c){logger[_0xffa2('0x10')](_0xffa2('0x16'),_0x3f602c[_0xffa2('0x12')],_0x923abf);_0x4e396f(_0x2ae03f[_0xffa2('0x10')](0x1f4,_0x3f602c[_0xffa2('0x12')]));});});}; \ No newline at end of file +var _0x131e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','Attachment,\x20%s,\x20%s','catch','Attachment','create','options','raw','CreateAttachment','bluebird','randomstring'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x131e,0x1ec));var _0xe131=function(_0x5ab086,_0x416037){_0x5ab086=_0x5ab086-0x0;var _0x44d263=_0x131e[_0x5ab086];return _0x44d263;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe131('0x0'));var rs=require(_0xe131('0x1'));var fs=require('fs');var Redis=require(_0xe131('0x2'));var db=require(_0xe131('0x3'))['db'];var utils=require(_0xe131('0x4'));var logger=require(_0xe131('0x5'))('rpc');var config=require(_0xe131('0x6'));var jayson=require(_0xe131('0x7'));var client=jayson[_0xe131('0x8')][_0xe131('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1002a6,_0x48a90e,_0x5c4eb5){return new BPromise(function(_0x562617,_0x4bf386){return client[_0xe131('0xa')](_0x1002a6,_0x5c4eb5)[_0xe131('0xb')](function(_0x530ecb){logger[_0xe131('0xc')]('Attachment,\x20%s,\x20%s',_0x48a90e,_0xe131('0xd'));logger[_0xe131('0xe')](_0xe131('0xf'),_0x48a90e,_0xe131('0xd'),JSON[_0xe131('0x10')](_0x530ecb));if(_0x530ecb[_0xe131('0x11')]){if(_0x530ecb[_0xe131('0x11')]['code']===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x48a90e,_0x530ecb['error'][_0xe131('0x12')]);return _0x4bf386(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}logger[_0xe131('0x11')](_0xe131('0x13'),_0x48a90e,_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);return _0x562617(_0x530ecb[_0xe131('0x11')][_0xe131('0x12')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x48a90e,'request\x20sent');_0x562617(_0x530ecb['result']['message']);}})[_0xe131('0x14')](function(_0x32091b){logger[_0xe131('0x11')]('Attachment,\x20%s,\x20%s',_0x48a90e,_0x32091b);_0x4bf386(_0x32091b);});});}exports['CreateAttachment']=function(_0x400f6b){var _0x2e2bf8=this;return new Promise(function(_0x3bbca8,_0x1a1e03){return db[_0xe131('0x15')][_0xe131('0x16')](_0x400f6b['body'],{'raw':_0x400f6b[_0xe131('0x17')]?_0x400f6b[_0xe131('0x17')][_0xe131('0x18')]===undefined?!![]:![]:!![]})[_0xe131('0xb')](function(_0x2d6c6b){logger['info']('CreateAttachment',_0x400f6b);logger[_0xe131('0xe')](_0xe131('0x19'),_0x400f6b,JSON['stringify'](_0x2d6c6b));_0x3bbca8(_0x2d6c6b);})[_0xe131('0x14')](function(_0x55b0c5){logger['error'](_0xe131('0x19'),_0x55b0c5[_0xe131('0x12')],_0x400f6b);_0x1a1e03(_0x2e2bf8[_0xe131('0x11')](0x1f4,_0x55b0c5[_0xe131('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index a9fa89c..945284f 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(_0x2e832e,_0x4bbb3d){var _0x28c3e8=function(_0xcf4b01){while(--_0xcf4b01){_0x2e832e['push'](_0x2e832e['shift']());}};_0x28c3e8(++_0x4bbb3d);}(_0xadb5,0xad));var _0x5adb=function(_0x30d90a,_0x788ae7){_0x30d90a=_0x30d90a-0x0;var _0x577349=_0xadb5[_0x30d90a];return _0x577349;};'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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1f109c,_0xd9952e){_0x1f109c=_0x1f109c-0x0;var _0x3984e8=_0x0b0e[_0x1f109c];return _0x3984e8;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 4db458f..1bd57a3 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 _0x741c=['passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','blocked','blockedAt','admin','user','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','use','ad-login','User','passport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x741c,0x98));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var passport=require(_0xc741('0x0'));var LocalStrategy=require(_0xc741('0x1'))[_0xc741('0x2')];var moment=require(_0xc741('0x3'));var ActiveDirectory=require(_0xc741('0x4'));var BPromise=require('bluebird');var util=require(_0xc741('0x5'));var db=require(_0xc741('0x6'))['db'];var authService=require(_0xc741('0x7'));var utils=require(_0xc741('0x8'));var config=require('../../config/environment');var logger=require(_0xc741('0x9'))(_0xc741('0xa'));function isActiveDirectoryConfigured(_0x2b47ea){var _0x49e447=![];if(typeof _0x2b47ea['activedirectory']!=='undefined'){_0x49e447=_0x2b47ea[_0xc741('0xb')][_0xc741('0xc')]&&_0x2b47ea['activedirectory']['url']&&_0x2b47ea[_0xc741('0xb')][_0xc741('0xd')];}return _0x49e447;}function adAuthenticate(_0x15c0f5,_0x32b685,_0x19ff6d){return new BPromise(function(_0x17133c,_0x55ed44){try{var _0x1c96ec=new ActiveDirectory(_0x15c0f5);_0x1c96ec[_0xc741('0xe')](_0x32b685,_0x19ff6d,function(_0x2a82ab,_0x397aec){if(_0x2a82ab){logger['error'](_0xc741('0xf'),_0x32b685,util[_0xc741('0x10')](_0x2a82ab,{'showHidden':![],'depth':null}));_0x55ed44(_0xc741('0x11'));}else if(!_0x397aec){logger[_0xc741('0x12')](_0xc741('0x13'),_0x32b685);_0x55ed44(_0xc741('0x11'));}else{_0x17133c(_0x397aec);}});}catch(_0x10de8f){_0x55ed44(_0x10de8f);}});}function ActiveDirectoryAuthenticate(_0x372eed,_0x92a531,_0x362087,_0x2d677a){var _0x31ef38,_0x5978b1;if(!isActiveDirectoryConfigured(config)){logger[_0xc741('0x12')](_0xc741('0x14'),_0x92a531);return _0x2d677a(null,![],{'message':_0xc741('0x11')});}return db[_0xc741('0x15')][_0xc741('0x16')]({'where':{'id':0x1},'attributes':[_0xc741('0x17'),_0xc741('0x18')],'raw':!![]})[_0xc741('0x19')](function(_0x5376a8){_0x31ef38=_0x5376a8;if(!_0x31ef38[_0xc741('0x17')]){logger[_0xc741('0x12')](_0xc741('0x1a'),_0x92a531);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x372eed['findOne']({'attributes':['id',_0xc741('0x1b'),_0xc741('0x1c'),_0xc741('0x1d'),'role','disabled',_0xc741('0x1e'),_0xc741('0x1f'),'online'],'where':{'name':_0x92a531,'role':{'$or':[_0xc741('0x20'),_0xc741('0x21'),_0xc741('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0x5cd29e){if(!_0x5cd29e||_0x5cd29e&&_0x5cd29e[_0xc741('0x1b')]!==_0x92a531){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5978b1=_0x5cd29e;var _0x37f67a=_0x5978b1[_0xc741('0x1b')]+'@'+config[_0xc741('0xb')][_0xc741('0xd')];return adAuthenticate(config[_0xc741('0xb')],_0x37f67a,_0x362087);})[_0xc741('0x19')](function(_0x12c8ce){if(_0x5978b1['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x31ef38['blockDuration']>0x0){if(_0x5978b1[_0xc741('0x1e')]){if(moment(_0x5978b1[_0xc741('0x1f')])[_0xc741('0x23')](_0x31ef38[_0xc741('0x18')],_0xc741('0x24'))>moment()){throw new Error(_0xc741('0x11'));}return utils[_0xc741('0x25')](_0x5978b1,0x0,![],null)[_0xc741('0x19')](function(){return utils[_0xc741('0x26')](_0x5978b1);})[_0xc741('0x19')](function(){return _0x2d677a(null,_0x5978b1);});}else{return utils[_0xc741('0x26')](_0x5978b1)[_0xc741('0x19')](function(){return _0x2d677a(null,_0x5978b1);});}}else{return utils[_0xc741('0x26')](_0x5978b1)[_0xc741('0x19')](function(){return _0x2d677a(null,_0x5978b1);});}})[_0xc741('0x27')](function(_0x4d235c){return _0x2d677a(null,![],_0x4d235c);});}function handleError(_0x15c4ef,_0xbc6ec2,_0x54d740){return _0x15c4ef[_0xc741('0x28')](_0xbc6ec2||0x1f4)[_0xc741('0x29')]({'message':_0x54d740?_0x54d740[_0xc741('0x2a')]||_0x54d740:''});}exports[_0xc741('0x2b')]=function(_0x1b57ba,_0xbc7728,_0x5e2a6a){passport['authenticate']('ad-login',function(_0x4b613e,_0x3e1b21,_0x4bb704){var _0x2ae820=_0x4b613e||_0x4bb704;if(_0x2ae820){return handleError(_0xbc7728,0x191,_0x2ae820);}if(!_0x3e1b21){return handleError(_0xbc7728,0x194,{'message':_0xc741('0x2c')});}else{var _0x319a31={'payload':{'id':_0x3e1b21['id'],'role':_0x3e1b21[_0xc741('0x2d')]},'options':{'expiresIn':0x15180}};return authService[_0xc741('0x2e')](_0x319a31)[_0xc741('0x19')](function(_0x128e08){_0xbc7728['json']({'id':_0x3e1b21['id'],'token':_0x128e08,'statusCall':'','isAlreadyLogged':_0x3e1b21[_0xc741('0x2f')]});});}})(_0x1b57ba,_0xbc7728,_0x5e2a6a);};passport[_0xc741('0x30')](_0xc741('0x31'),new LocalStrategy({'usernameField':_0xc741('0x1b'),'passwordField':_0xc741('0x1c')},function(_0x265802,_0x8cd34,_0x5434da){return ActiveDirectoryAuthenticate(db[_0xc741('0x32')],_0x265802,_0x8cd34,_0x5434da);})); \ No newline at end of file +var _0xea1e=['minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','name','add'];(function(_0x179b61,_0x25ea0a){var _0x267877=function(_0x52973f){while(--_0x52973f){_0x179b61['push'](_0x179b61['shift']());}};_0x267877(++_0x25ea0a);}(_0xea1e,0x1e2));var _0xeea1=function(_0x19f424,_0x2cfb24){_0x19f424=_0x19f424-0x0;var _0x36977b=_0xea1e[_0x19f424];return _0x36977b;};'use strict';var passport=require(_0xeea1('0x0'));var LocalStrategy=require(_0xeea1('0x1'))['Strategy'];var moment=require(_0xeea1('0x2'));var ActiveDirectory=require(_0xeea1('0x3'));var BPromise=require(_0xeea1('0x4'));var util=require(_0xeea1('0x5'));var db=require(_0xeea1('0x6'))['db'];var authService=require(_0xeea1('0x7'));var utils=require(_0xeea1('0x8'));var config=require(_0xeea1('0x9'));var logger=require(_0xeea1('0xa'))(_0xeea1('0xb'));function isActiveDirectoryConfigured(_0x1b1047){var _0x36e1f0=![];if(typeof _0x1b1047[_0xeea1('0xc')]!==_0xeea1('0xd')){_0x36e1f0=_0x1b1047[_0xeea1('0xc')]['baseDN']&&_0x1b1047[_0xeea1('0xc')][_0xeea1('0xe')]&&_0x1b1047[_0xeea1('0xc')][_0xeea1('0xf')];}return _0x36e1f0;}function adAuthenticate(_0x238700,_0x406090,_0x5b0278){return new BPromise(function(_0x342b3f,_0x5875a5){try{var _0x48860c=new ActiveDirectory(_0x238700);_0x48860c[_0xeea1('0x10')](_0x406090,_0x5b0278,function(_0x3cee1b,_0x7414d9){if(_0x3cee1b){logger[_0xeea1('0x11')](_0xeea1('0x12'),_0x406090,util['inspect'](_0x3cee1b,{'showHidden':![],'depth':null}));_0x5875a5(_0xeea1('0x13'));}else if(!_0x7414d9){logger[_0xeea1('0x11')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x406090);_0x5875a5(_0xeea1('0x13'));}else{_0x342b3f(_0x7414d9);}});}catch(_0x1e4560){_0x5875a5(_0x1e4560);}});}function ActiveDirectoryAuthenticate(_0x2345ff,_0x326d3b,_0xf27be2,_0x1d0ccc){var _0x249f9f,_0x48ecdd;if(!isActiveDirectoryConfigured(config)){logger[_0xeea1('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x326d3b);return _0x1d0ccc(null,![],{'message':_0xeea1('0x13')});}return db[_0xeea1('0x14')]['findOne']({'where':{'id':0x1},'attributes':[_0xeea1('0x15'),_0xeea1('0x16')],'raw':!![]})[_0xeea1('0x17')](function(_0x48b9c7){_0x249f9f=_0x48b9c7;if(!_0x249f9f[_0xeea1('0x15')]){logger['error'](_0xeea1('0x18'),_0x326d3b);throw new Error(_0xeea1('0x13'));}return _0x2345ff[_0xeea1('0x19')]({'attributes':['id','name',_0xeea1('0x1a'),_0xeea1('0x1b'),_0xeea1('0x1c'),_0xeea1('0x1d'),_0xeea1('0x1e'),_0xeea1('0x1f'),_0xeea1('0x20')],'where':{'name':_0x326d3b,'role':{'$or':[_0xeea1('0x21'),_0xeea1('0x22'),_0xeea1('0x23')]},'adSsoEnabled':!![]}});})[_0xeea1('0x17')](function(_0x534b71){if(!_0x534b71||_0x534b71&&_0x534b71[_0xeea1('0x24')]!==_0x326d3b){throw new Error(_0xeea1('0x13'));}_0x48ecdd=_0x534b71;var _0x4d50cb=_0x48ecdd['name']+'@'+config[_0xeea1('0xc')][_0xeea1('0xf')];return adAuthenticate(config[_0xeea1('0xc')],_0x4d50cb,_0xf27be2);})[_0xeea1('0x17')](function(_0x1604ff){if(_0x48ecdd[_0xeea1('0x1d')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x249f9f[_0xeea1('0x16')]>0x0){if(_0x48ecdd[_0xeea1('0x1e')]){if(moment(_0x48ecdd[_0xeea1('0x1f')])[_0xeea1('0x25')](_0x249f9f[_0xeea1('0x16')],_0xeea1('0x26'))>moment()){throw new Error(_0xeea1('0x13'));}return utils[_0xeea1('0x27')](_0x48ecdd,0x0,![],null)[_0xeea1('0x17')](function(){return utils['getLicense'](_0x48ecdd);})[_0xeea1('0x17')](function(){return _0x1d0ccc(null,_0x48ecdd);});}else{return utils['getLicense'](_0x48ecdd)['then'](function(){return _0x1d0ccc(null,_0x48ecdd);});}}else{return utils[_0xeea1('0x28')](_0x48ecdd)[_0xeea1('0x17')](function(){return _0x1d0ccc(null,_0x48ecdd);});}})[_0xeea1('0x29')](function(_0x45b8ff){return _0x1d0ccc(null,![],_0x45b8ff);});}function handleError(_0x44c26b,_0x4170b8,_0x3c1de8){return _0x44c26b[_0xeea1('0x2a')](_0x4170b8||0x1f4)[_0xeea1('0x2b')]({'message':_0x3c1de8?_0x3c1de8[_0xeea1('0x2c')]||_0x3c1de8:''});}exports[_0xeea1('0x2d')]=function(_0x4554a7,_0x44f98e,_0x20607d){passport[_0xeea1('0x10')](_0xeea1('0x2e'),function(_0xca38f2,_0x4cb210,_0x4a7d88){var _0xaae880=_0xca38f2||_0x4a7d88;if(_0xaae880){return handleError(_0x44f98e,0x191,_0xaae880);}if(!_0x4cb210){return handleError(_0x44f98e,0x194,{'message':_0xeea1('0x2f')});}else{var _0x1bbaed={'payload':{'id':_0x4cb210['id'],'role':_0x4cb210[_0xeea1('0x1c')]},'options':{'expiresIn':0x15180}};return authService[_0xeea1('0x30')](_0x1bbaed)[_0xeea1('0x17')](function(_0x7a899e){_0x44f98e[_0xeea1('0x31')]({'id':_0x4cb210['id'],'token':_0x7a899e,'statusCall':'','isAlreadyLogged':_0x4cb210[_0xeea1('0x20')]});});}})(_0x4554a7,_0x44f98e,_0x20607d);};passport[_0xeea1('0x32')](_0xeea1('0x2e'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x4c8449,_0x205b2e,_0x436e3d){return ActiveDirectoryAuthenticate(db[_0xeea1('0x33')],_0x4c8449,_0x205b2e,_0x436e3d);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 3fbd0e6..ece38da 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 _0x33fd=['post','login','exports','express','./authActiveDirectory.controller'];(function(_0x5165ab,_0x2d2de6){var _0x60ae77=function(_0x547fd1){while(--_0x547fd1){_0x5165ab['push'](_0x5165ab['shift']());}};_0x60ae77(++_0x2d2de6);}(_0x33fd,0x1b6));var _0xd33f=function(_0x581230,_0x8ca685){_0x581230=_0x581230-0x0;var _0x3609df=_0x33fd[_0x581230];return _0x3609df;};'use strict';var express=require(_0xd33f('0x0'));var router=express['Router']();var controller=require(_0xd33f('0x1'));router[_0xd33f('0x2')]('/',controller[_0xd33f('0x3')]);module[_0xd33f('0x4')]=router; \ No newline at end of file +var _0xb0e1=['Router','./authActiveDirectory.controller','login','express'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0xb0e1,0x1bf));var _0x1b0e=function(_0x22e482,_0x84f6fa){_0x22e482=_0x22e482-0x0;var _0x422831=_0xb0e1[_0x22e482];return _0x422831;};'use strict';var express=require(_0x1b0e('0x0'));var router=express[_0x1b0e('0x1')]();var controller=require(_0x1b0e('0x2'));router['post']('/',controller[_0x1b0e('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4d67098..ba1dd2e 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x372b16,_0x5b8c43){var _0x4d261a=function(_0x42bd0c){while(--_0x42bd0c){_0x372b16['push'](_0x372b16['shift']());}};_0x4d261a(++_0x5b8c43);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x7a54,0x106));var _0x47a5=function(_0x123c18,_0x19fcbf){_0x123c18=_0x123c18-0x0;var _0x245224=_0x7a54[_0x123c18];return _0x245224;};'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 8f442b0..7183a7e 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 _0xb419=['express','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie'];(function(_0x5762d2,_0x52ee9e){var _0x152190=function(_0x971ca6){while(--_0x971ca6){_0x5762d2['push'](_0x5762d2['shift']());}};_0x152190(++_0x52ee9e);}(_0xb419,0x172));var _0x9b41=function(_0x147f56,_0x387e8a){_0x147f56=_0x147f56-0x0;var _0xad4536=_0xb419[_0x147f56];return _0xad4536;};'use strict';var express=require(_0x9b41('0x0'));var passport=require(_0x9b41('0x1'));var router=express['Router']();var controller=require(_0x9b41('0x2'));var userController=require(_0x9b41('0x3'));var authService=require(_0x9b41('0x4'));router[_0x9b41('0x5')]('/',controller[_0x9b41('0x6')]);router[_0x9b41('0x5')](_0x9b41('0x7'),controller['callback'],authService[_0x9b41('0x8')],userController[_0x9b41('0x6')],authService[_0x9b41('0x9')]);module['exports']=router; \ No newline at end of file +var _0x5146=['../user/user.controller.js','../../components/auth/service','get','setTokenCookie','express','passport','Router'];(function(_0x5a3b69,_0xe3f11e){var _0x3bf016=function(_0x270344){while(--_0x270344){_0x5a3b69['push'](_0x5a3b69['shift']());}};_0x3bf016(++_0xe3f11e);}(_0x5146,0xc8));var _0x6514=function(_0x25fa85,_0x41e865){_0x25fa85=_0x25fa85-0x0;var _0x2fbfc4=_0x5146[_0x25fa85];return _0x2fbfc4;};'use strict';var express=require(_0x6514('0x0'));var passport=require(_0x6514('0x1'));var router=express[_0x6514('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x6514('0x3'));var authService=require(_0x6514('0x4'));router[_0x6514('0x5')]('/',controller['login']);router['get']('/callback',controller['callback'],authService['isMiddleware'],userController['login'],authService[_0x6514('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index c81a197..edfe3d1 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 _0x00ed=['findOne','blockDuration','then','name','password','disabled','blockedAt','loginAttempts','user','agent','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','blocked','find','email','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','resetPasswordExpires','save','use','passport','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http'];(function(_0x241d1d,_0x1feb9f){var _0x42bd7b=function(_0x203dd4){while(--_0x203dd4){_0x241d1d['push'](_0x241d1d['shift']());}};_0x42bd7b(++_0x1feb9f);}(_0x00ed,0xe9));var _0xd00e=function(_0x363e8e,_0x2961c1){_0x363e8e=_0x363e8e-0x0;var _0x19776e=_0x00ed[_0x363e8e];return _0x19776e;};'use strict';var util=require('util');var passport=require(_0xd00e('0x0'));var LocalStrategy=require('passport-local')[_0xd00e('0x1')];var jayson=require(_0xd00e('0x2'));var _=require(_0xd00e('0x3'));var rs=require('randomstring');var moment=require(_0xd00e('0x4'));var db=require(_0xd00e('0x5'))['db'];var authService=require(_0xd00e('0x6'));var utils=require(_0xd00e('0x7'));var client=jayson[_0xd00e('0x8')][_0xd00e('0x9')]({'port':0x232b});function localAuthenticate(_0x1a8dc3,_0x5c625e,_0x19712a,_0x27233c){var _0x4da47f,_0x298517;return db['Setting'][_0xd00e('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd00e('0xb')],'raw':!![]})[_0xd00e('0xc')](function(_0x4ee84e){_0x4da47f=_0x4ee84e;return _0x1a8dc3['findOne']({'attributes':['id',_0xd00e('0xd'),_0xd00e('0xe'),'salt','role',_0xd00e('0xf'),'blocked',_0xd00e('0x10'),_0xd00e('0x11')],'where':{'name':_0x5c625e,'role':{'$or':['admin',_0xd00e('0x12'),_0xd00e('0x13')]}}});})[_0xd00e('0xc')](function(_0x72c5b0){if(!_0x72c5b0||_0x72c5b0&&_0x72c5b0['name']!==_0x5c625e){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x298517=_0x72c5b0;return _0x298517;}})[_0xd00e('0xc')](function(){_0x298517[_0xd00e('0x14')](_0x19712a,function(_0x6df4b4,_0x46e290){var _0x52edde=_0x298517[_0xd00e('0x11')]+0x1;if(_0x6df4b4){return _0x27233c(_0x6df4b4);}else if(!_0x46e290){if(_0x298517[_0xd00e('0xf')]){return _0x27233c(null,![],{'message':_0xd00e('0x15')});}else if(_0x4da47f[_0xd00e('0x16')]>0x0){if(_0x298517['blocked']){if(_0x4da47f[_0xd00e('0xb')]>0x0){if(moment(_0x298517[_0xd00e('0x10')])[_0xd00e('0x17')](_0x4da47f['blockDuration'],_0xd00e('0x18'))>moment()){return _0x27233c(null,![],{'message':_0xd00e('0x15')});}else{return utils[_0xd00e('0x19')](_0x298517,_0x52edde,![],null)[_0xd00e('0xc')](function(){return _0x27233c(null,![],{'message':_0xd00e('0x15')});});}}else{return _0x27233c(null,![],{'message':_0xd00e('0x15')});}}else{if(_0x52edde>=_0x4da47f['allowedLoginAttempts']){return utils[_0xd00e('0x19')](_0x298517,0x0,!![],moment())[_0xd00e('0xc')](function(){return _0x27233c(null,![],{'message':_0xd00e('0x15')});});}else{return utils[_0xd00e('0x19')](_0x298517,_0x52edde,![],null)['then'](function(){return _0x27233c(null,![],{'message':_0xd00e('0x15')});});}}}else{return _0x27233c(null,![],{'message':_0xd00e('0x15')});}}else{if(_0x298517['disabled']){return _0x27233c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4da47f['allowedLoginAttempts']>0x0){if(_0x298517['blocked']){if(_0x4da47f[_0xd00e('0xb')]>0x0){if(moment(_0x298517['blockedAt'])['add'](_0x4da47f['blockDuration'],_0xd00e('0x18'))>moment()){return _0x27233c(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd00e('0x19')](_0x298517,0x0,![],null)['then'](function(){return utils['getLicense'](_0x298517);})['then'](function(){return _0x27233c(null,_0x298517);});}}else{return _0x27233c(null,![],{'message':_0xd00e('0x15')});}}else{return utils['clearBlockUser'](_0x298517,0x0,![],null)[_0xd00e('0xc')](function(){return utils[_0xd00e('0x1a')](_0x298517);})[_0xd00e('0xc')](function(){return _0x27233c(null,_0x298517);})[_0xd00e('0x1b')](function(_0x2b1669){return _0x27233c(null,![],_0x2b1669);});}}else{if(_0x298517[_0xd00e('0x1c')]){return _0x27233c(null,![],{'message':_0xd00e('0x15')});}else{return utils[_0xd00e('0x1a')](_0x298517)[_0xd00e('0xc')](function(){return _0x27233c(null,_0x298517);});}}}});})[_0xd00e('0x1b')](function(_0x3d3587){return _0x27233c(null,![],_0x3d3587);});}function sendServiceMail(_0x232703){return db['MailAccount'][_0xd00e('0x1d')]({'where':{'service':!![]},'attributes':['id','name',_0xd00e('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0xd00e('0x1f'),'include':[{'model':db[_0xd00e('0x20')],'as':'CloudProvider'}]}]})['then'](function(_0x43fa70){if(!_0x43fa70){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x36c2bf=_0x43fa70[_0xd00e('0x21')]();var _0x34ae05={'account':_0x36c2bf,'message':_[_0xd00e('0x22')]({'from':util[_0xd00e('0x23')](_0xd00e('0x24'),_0x43fa70[_0xd00e('0xd')],_0x43fa70[_0xd00e('0x1e')]||_0x43fa70[_0xd00e('0x1f')][_0xd00e('0x12')])},_0x232703)};return client['request'](_0xd00e('0x25'),_0x34ae05);})[_0xd00e('0xc')](function(_0x9562b0){if(_0x9562b0[_0xd00e('0x26')]){throw new Error(util['format'](_0xd00e('0x27'),_0x9562b0['error']['message']||JSON[_0xd00e('0x28')](_0x9562b0[_0xd00e('0x26')])));}return!![];});}function handleError(_0x377154,_0x59d75d,_0x5d2746){return _0x377154[_0xd00e('0x29')](_0x59d75d||0x1f4)['send']({'message':_0x5d2746?_0x5d2746[_0xd00e('0x2a')]||_0x5d2746:''});}exports[_0xd00e('0x2b')]=function(_0x8b5f53,_0x4185ba,_0x37a16d){passport['authenticate'](_0xd00e('0x2c'),function(_0x466fd1,_0x20c7fa,_0x303f1d){var _0x475c1a=_0x466fd1||_0x303f1d;if(_0x475c1a){return handleError(_0x4185ba,0x191,_0x475c1a);}if(!_0x20c7fa){return handleError(_0x4185ba,0x194,{'message':_0xd00e('0x2d')});}else{var _0x2f951f={'payload':{'id':_0x20c7fa['id'],'role':_0x20c7fa[_0xd00e('0x2e')]},'options':{'expiresIn':0x15180}};return authService[_0xd00e('0x2f')](_0x2f951f)[_0xd00e('0xc')](function(_0x18e7af){_0x4185ba['json']({'id':_0x20c7fa['id'],'token':_0x18e7af,'statusCall':'','isAlreadyLogged':_0x20c7fa[_0xd00e('0x30')]});});}})(_0x8b5f53,_0x4185ba,_0x37a16d);};exports[_0xd00e('0x31')]=function(_0x1044e8,_0x38ccee){if(!_0x1044e8[_0xd00e('0x32')][_0xd00e('0x1e')]){return handleError(_0x38ccee,0x1f4,{'message':_0xd00e('0x33')});}var _0x2a22a5=rs['generate']();_0x1044e8[_0xd00e('0x32')][_0xd00e('0x1e')]=_0x1044e8['body']['email'][_0xd00e('0x34')]()[_0xd00e('0x35')]();var _0x288ac5;return db['Setting'][_0xd00e('0xa')]({'where':{'id':0x1},'attributes':[_0xd00e('0x16'),'blockDuration'],'raw':!![]})[_0xd00e('0xc')](function(_0x17b5b8){_0x288ac5=_0x17b5b8;return db[_0xd00e('0x36')][_0xd00e('0x1d')]({'where':{'email':_0x1044e8[_0xd00e('0x32')]['email']}});})['then'](function(_0x22cb66){if(!_0x22cb66){throw new Error(_0xd00e('0x37'));}if(_0x22cb66[_0xd00e('0xf')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x22cb66[_0xd00e('0x1c')]){if(moment(_0x22cb66[_0xd00e('0x10')])[_0xd00e('0x17')](_0x288ac5['blockDuration'],'minutes')>moment()){throw new Error(_0xd00e('0x38'));}else{_0x22cb66['blocked']=![];_0x22cb66[_0xd00e('0x10')]=null;}}_0x22cb66[_0xd00e('0x39')]=_0x2a22a5;_0x22cb66['resetPasswordExpires']=Date[_0xd00e('0x3a')]()+0x36ee80;return _0x22cb66['save']();})[_0xd00e('0xc')](function(){return sendServiceMail({'to':_0x1044e8['body'][_0xd00e('0x1e')],'subject':_0xd00e('0x3b'),'text':_0xd00e('0x3c')+_0xd00e('0x3d')+'https://'+_0x1044e8[_0xd00e('0x3e')]['host']+_0xd00e('0x3f')+_0x2a22a5+'\x0a\x0a'+_0xd00e('0x40')});})[_0xd00e('0xc')](function(){_0x38ccee[_0xd00e('0x29')](0xc8)[_0xd00e('0x41')]({'message':_0xd00e('0x42')});})[_0xd00e('0x1b')](function(_0x5f5df6){return handleError(_0x38ccee,0x1f4,_0x5f5df6);});};exports[_0xd00e('0x43')]=function(_0x174400,_0x408e36){return db[_0xd00e('0x36')][_0xd00e('0x1d')]({'where':{'resetPasswordToken':_0x174400[_0xd00e('0x44')][_0xd00e('0x45')],'resetPasswordExpires':{'$gt':Date[_0xd00e('0x3a')]()}}})[_0xd00e('0xc')](function(_0x4f6e43){if(!_0x4f6e43){throw new Error(_0xd00e('0x46'));}return db[_0xd00e('0x47')][_0xd00e('0xa')]({'attributes':['id',_0xd00e('0x48'),'enforcePasswordHistory',_0xd00e('0x49')]})['then'](function(_0x5adc02){if(_0x5adc02[_0xd00e('0x48')])authService[_0xd00e('0x4a')](_0x174400[_0xd00e('0x32')][_0xd00e('0xe')]);if(!_0x5adc02[_0xd00e('0x4b')]||!_0x4f6e43[_0xd00e('0x4c')])return _0x4f6e43;authService[_0xd00e('0x4d')](_0x174400['body'][_0xd00e('0xe')],_0x4f6e43[_0xd00e('0x4c')],_0x5adc02[_0xd00e('0x49')]);return _0x4f6e43;})[_0xd00e('0xc')](function(){_0x4f6e43['password']=_0x174400[_0xd00e('0x32')]['password'];_0x4f6e43[_0xd00e('0x39')]=null;_0x4f6e43[_0xd00e('0x4e')]=null;return _0x4f6e43[_0xd00e('0x4f')]();});})[_0xd00e('0xc')](function(){_0x408e36[_0xd00e('0x29')](0xc8)[_0xd00e('0x41')]({'message':'Password\x20reset!'});})[_0xd00e('0x1b')](function(_0x43760a){return handleError(_0x408e36,0x1f4,_0x43760a);});};passport[_0xd00e('0x50')]('local-login',new LocalStrategy({'usernameField':_0xd00e('0xd'),'passwordField':_0xd00e('0xe')},function(_0x5ccce3,_0x2fc352,_0x52febd){return localAuthenticate(db[_0xd00e('0x36')],_0x5ccce3,_0x2fc352,_0x52febd);})); \ No newline at end of file +var _0xc66a=['add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','use','local-login','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked'];(function(_0x3f3514,_0x4dbfea){var _0x1203de=function(_0x3e4603){while(--_0x3e4603){_0x3f3514['push'](_0x3f3514['shift']());}};_0x1203de(++_0x4dbfea);}(_0xc66a,0xd5));var _0xac66=function(_0x4fe0f0,_0x1ce43e){_0x4fe0f0=_0x4fe0f0-0x0;var _0x52f107=_0xc66a[_0x4fe0f0];return _0x52f107;};'use strict';var util=require('util');var passport=require(_0xac66('0x0'));var LocalStrategy=require(_0xac66('0x1'))[_0xac66('0x2')];var jayson=require(_0xac66('0x3'));var _=require(_0xac66('0x4'));var rs=require(_0xac66('0x5'));var moment=require(_0xac66('0x6'));var db=require(_0xac66('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xac66('0x8'));var client=jayson[_0xac66('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x4a6764,_0x680195,_0x3c376b,_0x2d90f5){var _0x26330f,_0x43715e;return db[_0xac66('0xa')][_0xac66('0xb')]({'where':{'id':0x1},'attributes':[_0xac66('0xc'),_0xac66('0xd')],'raw':!![]})[_0xac66('0xe')](function(_0xde3da2){_0x26330f=_0xde3da2;return _0x4a6764[_0xac66('0xb')]({'attributes':['id',_0xac66('0xf'),_0xac66('0x10'),'salt',_0xac66('0x11'),_0xac66('0x12'),'blocked',_0xac66('0x13'),_0xac66('0x14')],'where':{'name':_0x680195,'role':{'$or':[_0xac66('0x15'),_0xac66('0x16'),_0xac66('0x17')]}}});})[_0xac66('0xe')](function(_0x746bb9){if(!_0x746bb9||_0x746bb9&&_0x746bb9['name']!==_0x680195){throw new Error(_0xac66('0x18'));}else{_0x43715e=_0x746bb9;return _0x43715e;}})[_0xac66('0xe')](function(){_0x43715e[_0xac66('0x19')](_0x3c376b,function(_0x207fe7,_0x33d9c8){var _0x46d7cf=_0x43715e[_0xac66('0x14')]+0x1;if(_0x207fe7){return _0x2d90f5(_0x207fe7);}else if(!_0x33d9c8){if(_0x43715e['disabled']){return _0x2d90f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x26330f[_0xac66('0xc')]>0x0){if(_0x43715e[_0xac66('0x1a')]){if(_0x26330f['blockDuration']>0x0){if(moment(_0x43715e[_0xac66('0x13')])[_0xac66('0x1b')](_0x26330f[_0xac66('0xd')],_0xac66('0x1c'))>moment()){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});}else{return utils['clearBlockUser'](_0x43715e,_0x46d7cf,![],null)[_0xac66('0xe')](function(){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});});}}else{return _0x2d90f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x46d7cf>=_0x26330f[_0xac66('0xc')]){return utils[_0xac66('0x1d')](_0x43715e,0x0,!![],moment())['then'](function(){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});});}else{return utils['clearBlockUser'](_0x43715e,_0x46d7cf,![],null)['then'](function(){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});});}}}else{return _0x2d90f5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x43715e[_0xac66('0x12')]){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});}else if(_0x26330f[_0xac66('0xc')]>0x0){if(_0x43715e[_0xac66('0x1a')]){if(_0x26330f[_0xac66('0xd')]>0x0){if(moment(_0x43715e[_0xac66('0x13')])['add'](_0x26330f[_0xac66('0xd')],_0xac66('0x1c'))>moment()){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});}else{return utils[_0xac66('0x1d')](_0x43715e,0x0,![],null)['then'](function(){return utils[_0xac66('0x1e')](_0x43715e);})[_0xac66('0xe')](function(){return _0x2d90f5(null,_0x43715e);});}}else{return _0x2d90f5(null,![],{'message':_0xac66('0x18')});}}else{return utils[_0xac66('0x1d')](_0x43715e,0x0,![],null)[_0xac66('0xe')](function(){return utils[_0xac66('0x1e')](_0x43715e);})[_0xac66('0xe')](function(){return _0x2d90f5(null,_0x43715e);})[_0xac66('0x1f')](function(_0x3c8c3d){return _0x2d90f5(null,![],_0x3c8c3d);});}}else{if(_0x43715e[_0xac66('0x1a')]){return _0x2d90f5(null,![],{'message':_0xac66('0x18')});}else{return utils['getLicense'](_0x43715e)[_0xac66('0xe')](function(){return _0x2d90f5(null,_0x43715e);});}}}});})[_0xac66('0x1f')](function(_0x34b758){return _0x2d90f5(null,![],_0x34b758);});}function sendServiceMail(_0x3e802c){return db[_0xac66('0x20')][_0xac66('0x21')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0xac66('0x22'),'include':[{'model':db[_0xac66('0x23')],'as':_0xac66('0x23')}]}]})[_0xac66('0xe')](function(_0x1535a2){if(!_0x1535a2){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x24dcb3=_0x1535a2[_0xac66('0x24')]();var _0x4a54fd={'account':_0x24dcb3,'message':_['merge']({'from':util[_0xac66('0x25')](_0xac66('0x26'),_0x1535a2['name'],_0x1535a2[_0xac66('0x27')]||_0x1535a2['Smtp'][_0xac66('0x16')])},_0x3e802c)};return client[_0xac66('0x28')](_0xac66('0x29'),_0x4a54fd);})['then'](function(_0x52e075){if(_0x52e075[_0xac66('0x2a')]){throw new Error(util['format'](_0xac66('0x2b'),_0x52e075['error'][_0xac66('0x2c')]||JSON[_0xac66('0x2d')](_0x52e075[_0xac66('0x2a')])));}return!![];});}function handleError(_0x3f24c5,_0x108d27,_0x4a899b){return _0x3f24c5[_0xac66('0x2e')](_0x108d27||0x1f4)[_0xac66('0x2f')]({'message':_0x4a899b?_0x4a899b[_0xac66('0x2c')]||_0x4a899b:''});}exports[_0xac66('0x30')]=function(_0x1a6710,_0x953559,_0x4ab467){passport['authenticate']('local-login',function(_0x21178c,_0x3beade,_0x5ca875){var _0x2661f3=_0x21178c||_0x5ca875;if(_0x2661f3){return handleError(_0x953559,0x191,_0x2661f3);}if(!_0x3beade){return handleError(_0x953559,0x194,{'message':_0xac66('0x31')});}else{var _0x4107cd={'payload':{'id':_0x3beade['id'],'role':_0x3beade['role']},'options':{'expiresIn':0x15180}};return authService[_0xac66('0x32')](_0x4107cd)[_0xac66('0xe')](function(_0x22d262){_0x953559['json']({'id':_0x3beade['id'],'token':_0x22d262,'statusCall':'','isAlreadyLogged':_0x3beade['online']});});}})(_0x1a6710,_0x953559,_0x4ab467);};exports[_0xac66('0x33')]=function(_0x131157,_0x151ba2){if(!_0x131157[_0xac66('0x34')][_0xac66('0x27')]){return handleError(_0x151ba2,0x1f4,{'message':_0xac66('0x35')});}var _0xb3632e=rs['generate']();_0x131157[_0xac66('0x34')]['email']=_0x131157['body'][_0xac66('0x27')][_0xac66('0x36')]()[_0xac66('0x37')]();var _0x7c1cb1;return db[_0xac66('0xa')][_0xac66('0xb')]({'where':{'id':0x1},'attributes':[_0xac66('0xc'),_0xac66('0xd')],'raw':!![]})[_0xac66('0xe')](function(_0x1fd5c2){_0x7c1cb1=_0x1fd5c2;return db[_0xac66('0x38')][_0xac66('0x21')]({'where':{'email':_0x131157['body'][_0xac66('0x27')]}});})[_0xac66('0xe')](function(_0x50c3cb){if(!_0x50c3cb){throw new Error(_0xac66('0x39'));}if(_0x50c3cb['disabled']){throw new Error(_0xac66('0x3a'));}if(_0x50c3cb[_0xac66('0x1a')]){if(moment(_0x50c3cb[_0xac66('0x13')])['add'](_0x7c1cb1[_0xac66('0xd')],'minutes')>moment()){throw new Error(_0xac66('0x3b'));}else{_0x50c3cb[_0xac66('0x1a')]=![];_0x50c3cb[_0xac66('0x13')]=null;}}_0x50c3cb[_0xac66('0x3c')]=_0xb3632e;_0x50c3cb[_0xac66('0x3d')]=Date['now']()+0x36ee80;return _0x50c3cb[_0xac66('0x3e')]();})[_0xac66('0xe')](function(){return sendServiceMail({'to':_0x131157[_0xac66('0x34')][_0xac66('0x27')],'subject':_0xac66('0x3f'),'text':_0xac66('0x40')+_0xac66('0x41')+_0xac66('0x42')+_0x131157[_0xac66('0x43')]['host']+'/reset/'+_0xb3632e+'\x0a\x0a'+_0xac66('0x44')});})[_0xac66('0xe')](function(){_0x151ba2[_0xac66('0x2e')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x260a83){return handleError(_0x151ba2,0x1f4,_0x260a83);});};exports[_0xac66('0x45')]=function(_0x448f36,_0x467233){return db['User']['find']({'where':{'resetPasswordToken':_0x448f36[_0xac66('0x46')]['token'],'resetPasswordExpires':{'$gt':Date[_0xac66('0x47')]()}}})[_0xac66('0xe')](function(_0x381bfd){if(!_0x381bfd){throw new Error(_0xac66('0x48'));}return db[_0xac66('0xa')][_0xac66('0xb')]({'attributes':['id',_0xac66('0x49'),_0xac66('0x4a'),_0xac66('0x4b')]})[_0xac66('0xe')](function(_0x37937d){if(_0x37937d[_0xac66('0x49')])authService['validatePasswordPattern'](_0x448f36[_0xac66('0x34')][_0xac66('0x10')]);if(!_0x37937d[_0xac66('0x4a')]||!_0x381bfd[_0xac66('0x4c')])return _0x381bfd;authService[_0xac66('0x4d')](_0x448f36[_0xac66('0x34')]['password'],_0x381bfd[_0xac66('0x4c')],_0x37937d[_0xac66('0x4b')]);return _0x381bfd;})[_0xac66('0xe')](function(){_0x381bfd['password']=_0x448f36[_0xac66('0x34')][_0xac66('0x10')];_0x381bfd[_0xac66('0x3c')]=null;_0x381bfd[_0xac66('0x3d')]=null;return _0x381bfd[_0xac66('0x3e')]();});})[_0xac66('0xe')](function(){_0x467233['status'](0xc8)[_0xac66('0x2f')]({'message':'Password\x20reset!'});})[_0xac66('0x1f')](function(_0x3050f){return handleError(_0x467233,0x1f4,_0x3050f);});};passport[_0xac66('0x4e')](_0xac66('0x4f'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x2c60a4,_0x417717,_0x44c4e0){return localAuthenticate(db[_0xac66('0x38')],_0x2c60a4,_0x417717,_0x44c4e0);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4104320..be52a79 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 _0xf212=['/forgot','/reset/:token','reset','exports','express','Router','post','login'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xf212,0xe4));var _0x2f21=function(_0x79b7c0,_0x31862d){_0x79b7c0=_0x79b7c0-0x0;var _0xb2c932=_0xf212[_0x79b7c0];return _0xb2c932;};'use strict';var express=require(_0x2f21('0x0'));var router=express[_0x2f21('0x1')]();var controller=require('./authLocal.controller');router[_0x2f21('0x2')]('/',controller[_0x2f21('0x3')]);router[_0x2f21('0x2')](_0x2f21('0x4'),controller['forgot']);router[_0x2f21('0x2')](_0x2f21('0x5'),controller[_0x2f21('0x6')]);module[_0x2f21('0x7')]=router; \ No newline at end of file +var _0xcf79=['reset','exports','express','./authLocal.controller','post','login','/forgot','forgot'];(function(_0x1c8b71,_0x2fca5f){var _0x253dc8=function(_0x12b73f){while(--_0x12b73f){_0x1c8b71['push'](_0x1c8b71['shift']());}};_0x253dc8(++_0x2fca5f);}(_0xcf79,0x8a));var _0x9cf7=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcf79[_0x13d07a];return _0x5ee0ee;};'use strict';var express=require(_0x9cf7('0x0'));var router=express['Router']();var controller=require(_0x9cf7('0x1'));router[_0x9cf7('0x2')]('/',controller[_0x9cf7('0x3')]);router['post'](_0x9cf7('0x4'),controller[_0x9cf7('0x5')]);router['post']('/reset/:token',controller[_0x9cf7('0x6')]);module[_0x9cf7('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 925056e..8456e9c 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 _0x620e=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x2378a8,_0x449ed1){var _0x5709e2=function(_0x34e25a){while(--_0x34e25a){_0x2378a8['push'](_0x2378a8['shift']());}};_0x5709e2(++_0x449ed1);}(_0x620e,0x112));var _0xe620=function(_0x44a563,_0x2c387d){_0x44a563=_0x44a563-0x0;var _0x48960c=_0x620e[_0x44a563];return _0x48960c;};'use strict';var Sequelize=require('sequelize');module[_0xe620('0x0')]={'name':{'type':Sequelize[_0xe620('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe620('0x1')]},'description':{'type':Sequelize[_0xe620('0x1')]},'status':{'type':Sequelize[_0xe620('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe620('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xda8e=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x73301c,_0x3fd870){var _0x1f357b=function(_0x42e027){while(--_0x42e027){_0x73301c['push'](_0x73301c['shift']());}};_0x1f357b(++_0x3fd870);}(_0xda8e,0x1d8));var _0xeda8=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0xda8e[_0x5d8018];return _0x151ac4;};'use strict';var Sequelize=require(_0xeda8('0x0'));module[_0xeda8('0x1')]={'name':{'type':Sequelize[_0xeda8('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xeda8('0x2')]},'description':{'type':Sequelize[_0xeda8('0x2')]},'status':{'type':Sequelize[_0xeda8('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xeda8('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index c5cfd17..e80b59d 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 _0x7d8f=['update','destroy','error','stack','name','Automation','fieldName','type','map','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','count','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','addConditions','Condition','ids','omit','findOne','pick','getConditions','Action','addActions','getActions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save'];(function(_0x49744e,_0x2090ab){var _0x27a585=function(_0x15b6cc){while(--_0x15b6cc){_0x49744e['push'](_0x49744e['shift']());}};_0x27a585(++_0x2090ab);}(_0x7d8f,0xd9));var _0xf7d8=function(_0x13ebe3,_0x129833){_0x13ebe3=_0x13ebe3-0x0;var _0x42e9c6=_0x7d8f[_0x13ebe3];return _0x42e9c6;};'use strict';var emlformat=require(_0xf7d8('0x0'));var rimraf=require(_0xf7d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf7d8('0x2'));var rp=require('request-promise');var moment=require(_0xf7d8('0x3'));var BPromise=require(_0xf7d8('0x4'));var Mustache=require(_0xf7d8('0x5'));var util=require(_0xf7d8('0x6'));var path=require(_0xf7d8('0x7'));var sox=require('sox');var csv=require(_0xf7d8('0x8'));var ejs=require(_0xf7d8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf7d8('0xa'));var squel=require(_0xf7d8('0xb'));var crypto=require(_0xf7d8('0xc'));var jsforce=require(_0xf7d8('0xd'));var deskjs=require(_0xf7d8('0xe'));var toCsv=require(_0xf7d8('0x8'));var querystring=require('querystring');var Papa=require(_0xf7d8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf7d8('0x10'));var as=require(_0xf7d8('0x11'));var hardwareService=require(_0xf7d8('0x12'));var logger=require(_0xf7d8('0x13'))('api');var utils=require(_0xf7d8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf7d8('0x15'));var db=require(_0xf7d8('0x16'))['db'];function respondWithStatusCode(_0x425cd8,_0x328628){_0x328628=_0x328628||0xcc;return function(_0x3d053b){if(_0x3d053b){return _0x425cd8[_0xf7d8('0x17')](_0x328628);}return _0x425cd8['status'](_0x328628)[_0xf7d8('0x18')]();};}function respondWithResult(_0xd7c2ff,_0x35006f){_0x35006f=_0x35006f||0xc8;return function(_0x49f351){if(_0x49f351){return _0xd7c2ff[_0xf7d8('0x19')](_0x35006f)[_0xf7d8('0x1a')](_0x49f351);}};}function respondWithFilteredResult(_0x5852f1,_0x2861b6){return function(_0x59d24b){if(_0x59d24b){var _0xbac367=typeof _0x2861b6[_0xf7d8('0x1b')]===_0xf7d8('0x1c')&&typeof _0x2861b6[_0xf7d8('0x1d')]===_0xf7d8('0x1c');var _0x3c9f4e=_0x59d24b['count'];var _0x21fff6=_0xbac367?0x0:_0x2861b6[_0xf7d8('0x1b')];var _0x1cad17=_0xbac367?_0x59d24b['count']:_0x2861b6['offset']+_0x2861b6[_0xf7d8('0x1d')];var _0xd2f4c8;if(_0x1cad17>=_0x3c9f4e){_0x1cad17=_0x3c9f4e;_0xd2f4c8=0xc8;}else{_0xd2f4c8=0xce;}_0x5852f1[_0xf7d8('0x19')](_0xd2f4c8);return _0x5852f1[_0xf7d8('0x1e')](_0xf7d8('0x1f'),_0x21fff6+'-'+_0x1cad17+'/'+_0x3c9f4e)[_0xf7d8('0x1a')](_0x59d24b);}return null;};}function patchUpdates(_0x4e78d8){return function(_0x1930fb){try{jsonpatch[_0xf7d8('0x20')](_0x1930fb,_0x4e78d8,!![]);}catch(_0x4d6fb7){return BPromise[_0xf7d8('0x21')](_0x4d6fb7);}return _0x1930fb[_0xf7d8('0x22')]();};}function saveUpdates(_0x9f373c,_0x511fa1){return function(_0x50bb6b){if(_0x50bb6b){return _0x50bb6b[_0xf7d8('0x23')](_0x9f373c)['then'](function(_0x26097c){return _0x26097c;});}return null;};}function removeEntity(_0x413f96,_0x5129b8){return function(_0x588292){if(_0x588292){return _0x588292[_0xf7d8('0x24')]()['then'](function(){_0x413f96[_0xf7d8('0x19')](0xcc)[_0xf7d8('0x18')]();});}};}function handleEntityNotFound(_0x4a0fce,_0x3fd1c6){return function(_0x245514){if(!_0x245514){_0x4a0fce['sendStatus'](0x194);}return _0x245514;};}function handleError(_0x5b87c2,_0x1275da){_0x1275da=_0x1275da||0x1f4;return function(_0x280c96){logger[_0xf7d8('0x25')](_0x280c96[_0xf7d8('0x26')]);if(_0x280c96[_0xf7d8('0x27')]){delete _0x280c96[_0xf7d8('0x27')];}_0x5b87c2[_0xf7d8('0x19')](_0x1275da)['send'](_0x280c96);};}exports['index']=function(_0x588e37,_0x54b05e){var _0x4e5804={},_0x5e5aec={},_0x26d1bd={'count':0x0,'rows':[]};var _0x558e77=_['map'](db[_0xf7d8('0x28')]['rawAttributes'],function(_0x4daf87){return{'name':_0x4daf87[_0xf7d8('0x29')],'type':_0x4daf87[_0xf7d8('0x2a')]['key']};});_0x5e5aec['model']=_[_0xf7d8('0x2b')](_0x558e77,_0xf7d8('0x27'));_0x5e5aec[_0xf7d8('0x2c')]=_[_0xf7d8('0x2d')](_0x588e37[_0xf7d8('0x2c')]);_0x5e5aec[_0xf7d8('0x2e')]=_[_0xf7d8('0x2f')](_0x5e5aec[_0xf7d8('0x30')],_0x5e5aec[_0xf7d8('0x2c')]);_0x4e5804['attributes']=_[_0xf7d8('0x2f')](_0x5e5aec[_0xf7d8('0x30')],qs[_0xf7d8('0x31')](_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x31')]));_0x4e5804['attributes']=_0x4e5804['attributes'][_0xf7d8('0x32')]?_0x4e5804[_0xf7d8('0x33')]:_0x5e5aec[_0xf7d8('0x30')];if(!_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x34')](_0xf7d8('0x35'))){_0x4e5804[_0xf7d8('0x1d')]=qs['limit'](_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x1d')]);_0x4e5804['offset']=qs[_0xf7d8('0x1b')](_0x588e37[_0xf7d8('0x2c')]['offset']);}_0x4e5804[_0xf7d8('0x36')]=qs['sort'](_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x37')]);_0x4e5804['where']=qs[_0xf7d8('0x2e')](_['pick'](_0x588e37[_0xf7d8('0x2c')],_0x5e5aec[_0xf7d8('0x2e')]),_0x558e77);if(_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x38')]){_0x4e5804[_0xf7d8('0x39')]=_[_0xf7d8('0x3a')](_0x4e5804[_0xf7d8('0x39')],{'$or':_['map'](_0x558e77,function(_0x125880){if(_0x125880[_0xf7d8('0x2a')]!==_0xf7d8('0x3b')){var _0x3a3235={};_0x3a3235[_0x125880[_0xf7d8('0x27')]]={'$like':'%'+_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x38')]+'%'};return _0x3a3235;}})});}_0x4e5804=_['merge']({},_0x4e5804,_0x588e37[_0xf7d8('0x3c')]);var _0x29120c={'where':_0x4e5804[_0xf7d8('0x39')]};return db[_0xf7d8('0x28')][_0xf7d8('0x3d')](_0x29120c)[_0xf7d8('0x3e')](function(_0x409cf9){_0x26d1bd['count']=_0x409cf9;if(_0x588e37[_0xf7d8('0x2c')][_0xf7d8('0x3f')]){_0x4e5804[_0xf7d8('0x40')]=[{'all':!![]}];}return db[_0xf7d8('0x28')][_0xf7d8('0x41')](_0x4e5804);})[_0xf7d8('0x3e')](function(_0x4f1265){_0x26d1bd[_0xf7d8('0x42')]=_0x4f1265;return _0x26d1bd;})[_0xf7d8('0x3e')](respondWithFilteredResult(_0x54b05e,_0x4e5804))[_0xf7d8('0x43')](handleError(_0x54b05e,null));};exports[_0xf7d8('0x44')]=function(_0x38c6a7,_0x139ebe){var _0x4938b9={'raw':![],'where':{'id':_0x38c6a7[_0xf7d8('0x45')]['id']}},_0x171714={};_0x171714[_0xf7d8('0x30')]=_['keys'](db[_0xf7d8('0x28')][_0xf7d8('0x46')]);_0x171714[_0xf7d8('0x2c')]=_['keys'](_0x38c6a7[_0xf7d8('0x2c')]);_0x171714[_0xf7d8('0x2e')]=_['intersection'](_0x171714['model'],_0x171714['query']);_0x4938b9[_0xf7d8('0x33')]=_[_0xf7d8('0x2f')](_0x171714[_0xf7d8('0x30')],qs['fields'](_0x38c6a7[_0xf7d8('0x2c')][_0xf7d8('0x31')]));_0x4938b9[_0xf7d8('0x33')]=_0x4938b9[_0xf7d8('0x33')][_0xf7d8('0x32')]?_0x4938b9[_0xf7d8('0x33')]:_0x171714[_0xf7d8('0x30')];if(_0x38c6a7['query']['includeAll']){_0x4938b9[_0xf7d8('0x40')]=[{'all':!![]}];}_0x4938b9=_[_0xf7d8('0x3a')]({},_0x4938b9,_0x38c6a7['options']);return db[_0xf7d8('0x28')][_0xf7d8('0x47')](_0x4938b9)['then'](handleEntityNotFound(_0x139ebe,null))[_0xf7d8('0x3e')](respondWithResult(_0x139ebe,null))[_0xf7d8('0x43')](handleError(_0x139ebe,null));};exports[_0xf7d8('0x48')]=function(_0x192cb5,_0xca1ff1){return db['Automation'][_0xf7d8('0x48')](_0x192cb5[_0xf7d8('0x49')],{})[_0xf7d8('0x3e')](respondWithResult(_0xca1ff1,0xc9))[_0xf7d8('0x43')](handleError(_0xca1ff1,null));};exports[_0xf7d8('0x23')]=function(_0x445554,_0x599210){if(_0x445554[_0xf7d8('0x49')]['id']){delete _0x445554[_0xf7d8('0x49')]['id'];}return db[_0xf7d8('0x28')][_0xf7d8('0x47')]({'where':{'id':_0x445554[_0xf7d8('0x45')]['id']}})[_0xf7d8('0x3e')](handleEntityNotFound(_0x599210,null))[_0xf7d8('0x3e')](saveUpdates(_0x445554[_0xf7d8('0x49')],null))[_0xf7d8('0x3e')](respondWithResult(_0x599210,null))[_0xf7d8('0x43')](handleError(_0x599210,null));};exports[_0xf7d8('0x24')]=function(_0x3c61ce,_0x1c17a3){return db[_0xf7d8('0x28')]['find']({'where':{'id':_0x3c61ce[_0xf7d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c17a3,null))[_0xf7d8('0x3e')](removeEntity(_0x1c17a3,null))[_0xf7d8('0x43')](handleError(_0x1c17a3,null));};exports[_0xf7d8('0x4a')]=function(_0xb6a4b8,_0x43c5db,_0xc99678){return db[_0xf7d8('0x4b')]['find']({'where':{'id':_0xb6a4b8[_0xf7d8('0x45')]['id']}})[_0xf7d8('0x3e')](handleEntityNotFound(_0x43c5db,null))[_0xf7d8('0x3e')](function(_0x276172){if(_0x276172){return _0x276172[_0xf7d8('0x4a')](_0xb6a4b8[_0xf7d8('0x49')][_0xf7d8('0x4c')],_[_0xf7d8('0x4d')](_0xb6a4b8['body'],['ids','id'])||{});}})[_0xf7d8('0x3e')](respondWithResult(_0x43c5db,null))['catch'](handleError(_0x43c5db,null));};exports['getConditions']=function(_0x1037cd,_0x42149e,_0x76b722){var _0x3a22bd={};var _0x57387c={};var _0x43bb73;var _0x32ed44;return db[_0xf7d8('0x28')][_0xf7d8('0x4e')]({'where':{'id':_0x1037cd[_0xf7d8('0x45')]['id']}})[_0xf7d8('0x3e')](handleEntityNotFound(_0x42149e,null))[_0xf7d8('0x3e')](function(_0x1e08d8){if(_0x1e08d8){_0x43bb73=_0x1e08d8;_0x57387c[_0xf7d8('0x30')]=_[_0xf7d8('0x2d')](db[_0xf7d8('0x4b')]['rawAttributes']);_0x57387c[_0xf7d8('0x2c')]=_[_0xf7d8('0x2d')](_0x1037cd[_0xf7d8('0x2c')]);_0x57387c[_0xf7d8('0x2e')]=_[_0xf7d8('0x2f')](_0x57387c[_0xf7d8('0x30')],_0x57387c['query']);_0x3a22bd[_0xf7d8('0x33')]=_[_0xf7d8('0x2f')](_0x57387c[_0xf7d8('0x30')],qs[_0xf7d8('0x31')](_0x1037cd['query'][_0xf7d8('0x31')]));_0x3a22bd[_0xf7d8('0x33')]=_0x3a22bd[_0xf7d8('0x33')][_0xf7d8('0x32')]?_0x3a22bd[_0xf7d8('0x33')]:_0x57387c[_0xf7d8('0x30')];_0x3a22bd['order']=qs[_0xf7d8('0x37')](_0x1037cd[_0xf7d8('0x2c')]['sort']);_0x3a22bd['where']=qs[_0xf7d8('0x2e')](_[_0xf7d8('0x4f')](_0x1037cd[_0xf7d8('0x2c')],_0x57387c[_0xf7d8('0x2e')]));if(_0x1037cd[_0xf7d8('0x2c')][_0xf7d8('0x38')]){_0x3a22bd[_0xf7d8('0x39')]=_[_0xf7d8('0x3a')](_0x3a22bd[_0xf7d8('0x39')],{'$or':_['map'](_0x3a22bd[_0xf7d8('0x33')],function(_0x336d3b){var _0x4f8358={};_0x4f8358[_0x336d3b]={'$like':'%'+_0x1037cd[_0xf7d8('0x2c')]['filter']+'%'};return _0x4f8358;})});}_0x3a22bd=_[_0xf7d8('0x3a')]({},_0x3a22bd,_0x1037cd[_0xf7d8('0x3c')]);return _0x43bb73[_0xf7d8('0x50')](_0x3a22bd);}})[_0xf7d8('0x3e')](function(_0x36f92c){if(_0x36f92c){_0x32ed44=_0x36f92c[_0xf7d8('0x32')];if(!_0x1037cd[_0xf7d8('0x2c')][_0xf7d8('0x34')](_0xf7d8('0x35'))){_0x3a22bd[_0xf7d8('0x1d')]=qs[_0xf7d8('0x1d')](_0x1037cd[_0xf7d8('0x2c')][_0xf7d8('0x1d')]);_0x3a22bd[_0xf7d8('0x1b')]=qs[_0xf7d8('0x1b')](_0x1037cd[_0xf7d8('0x2c')][_0xf7d8('0x1b')]);}return _0x43bb73[_0xf7d8('0x50')](_0x3a22bd);}})[_0xf7d8('0x3e')](function(_0x42b27c){if(_0x42b27c){return _0x42b27c?{'count':_0x32ed44,'rows':_0x42b27c}:null;}})[_0xf7d8('0x3e')](respondWithResult(_0x42149e,null))[_0xf7d8('0x43')](handleError(_0x42149e,null));};exports['addActions']=function(_0x3beb14,_0x4c19dc,_0x2341d7){return db[_0xf7d8('0x51')][_0xf7d8('0x47')]({'where':{'id':_0x3beb14[_0xf7d8('0x45')]['id']}})[_0xf7d8('0x3e')](handleEntityNotFound(_0x4c19dc,null))[_0xf7d8('0x3e')](function(_0x20cbea){if(_0x20cbea){return _0x20cbea[_0xf7d8('0x52')](_0x3beb14[_0xf7d8('0x49')][_0xf7d8('0x4c')],_[_0xf7d8('0x4d')](_0x3beb14['body'],[_0xf7d8('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x4c19dc,null))[_0xf7d8('0x43')](handleError(_0x4c19dc,null));};exports['getActions']=function(_0x462257,_0x575d8d,_0x653f87){var _0x3ff82a={};var _0x183fd2={};var _0x39c88e;var _0x2c9667;return db[_0xf7d8('0x28')][_0xf7d8('0x4e')]({'where':{'id':_0x462257[_0xf7d8('0x45')]['id']}})['then'](handleEntityNotFound(_0x575d8d,null))['then'](function(_0x3cbeea){if(_0x3cbeea){_0x39c88e=_0x3cbeea;_0x183fd2[_0xf7d8('0x30')]=_[_0xf7d8('0x2d')](db['Action'][_0xf7d8('0x46')]);_0x183fd2[_0xf7d8('0x2c')]=_[_0xf7d8('0x2d')](_0x462257['query']);_0x183fd2[_0xf7d8('0x2e')]=_[_0xf7d8('0x2f')](_0x183fd2[_0xf7d8('0x30')],_0x183fd2[_0xf7d8('0x2c')]);_0x3ff82a[_0xf7d8('0x33')]=_[_0xf7d8('0x2f')](_0x183fd2['model'],qs[_0xf7d8('0x31')](_0x462257[_0xf7d8('0x2c')][_0xf7d8('0x31')]));_0x3ff82a[_0xf7d8('0x33')]=_0x3ff82a['attributes']['length']?_0x3ff82a['attributes']:_0x183fd2['model'];_0x3ff82a[_0xf7d8('0x36')]=qs['sort'](_0x462257[_0xf7d8('0x2c')][_0xf7d8('0x37')]);_0x3ff82a['where']=qs[_0xf7d8('0x2e')](_[_0xf7d8('0x4f')](_0x462257[_0xf7d8('0x2c')],_0x183fd2[_0xf7d8('0x2e')]));if(_0x462257[_0xf7d8('0x2c')][_0xf7d8('0x38')]){_0x3ff82a[_0xf7d8('0x39')]=_[_0xf7d8('0x3a')](_0x3ff82a['where'],{'$or':_[_0xf7d8('0x2b')](_0x3ff82a[_0xf7d8('0x33')],function(_0x2148a2){var _0x5305dc={};_0x5305dc[_0x2148a2]={'$like':'%'+_0x462257[_0xf7d8('0x2c')]['filter']+'%'};return _0x5305dc;})});}_0x3ff82a=_[_0xf7d8('0x3a')]({},_0x3ff82a,_0x462257['options']);return _0x39c88e[_0xf7d8('0x53')](_0x3ff82a);}})['then'](function(_0x54b37e){if(_0x54b37e){_0x2c9667=_0x54b37e[_0xf7d8('0x32')];if(!_0x462257['query'][_0xf7d8('0x34')](_0xf7d8('0x35'))){_0x3ff82a['limit']=qs[_0xf7d8('0x1d')](_0x462257[_0xf7d8('0x2c')][_0xf7d8('0x1d')]);_0x3ff82a['offset']=qs[_0xf7d8('0x1b')](_0x462257[_0xf7d8('0x2c')][_0xf7d8('0x1b')]);}return _0x39c88e[_0xf7d8('0x53')](_0x3ff82a);}})[_0xf7d8('0x3e')](function(_0x59c6c4){if(_0x59c6c4){return _0x59c6c4?{'count':_0x2c9667,'rows':_0x59c6c4}:null;}})[_0xf7d8('0x3e')](respondWithResult(_0x575d8d,null))['catch'](handleError(_0x575d8d,null));}; \ No newline at end of file +var _0xa02e=['omit','ids','getConditions','findOne','keys','Condition','pick','addActions','Action','getActions','rawAttributes','rimraf','zip-dir','request-promise','moment','bluebird','util','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','save','update','error','stack','name','send','index','map','Automation','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','include','findAll','rows','show','params','find','catch','create','body','destroy','addConditions'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa02e,0xa9));var _0xea02=function(_0x593cc7,_0x3a2a1d){_0x593cc7=_0x593cc7-0x0;var _0x31e78e=_0xa02e[_0x593cc7];return _0x31e78e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea02('0x0'));var zipdir=require(_0xea02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea02('0x2'));var moment=require(_0xea02('0x3'));var BPromise=require(_0xea02('0x4'));var Mustache=require('mustache');var util=require(_0xea02('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xea02('0x6'));var crypto=require(_0xea02('0x7'));var jsforce=require(_0xea02('0x8'));var deskjs=require(_0xea02('0x9'));var toCsv=require('to-csv');var querystring=require(_0xea02('0xa'));var Papa=require(_0xea02('0xb'));var Redis=require(_0xea02('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea02('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea02('0xe'))(_0xea02('0xf'));var utils=require(_0xea02('0x10'));var config=require(_0xea02('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xea02('0x12'))['db'];function respondWithStatusCode(_0xb01ad8,_0x30e352){_0x30e352=_0x30e352||0xcc;return function(_0x43fe16){if(_0x43fe16){return _0xb01ad8[_0xea02('0x13')](_0x30e352);}return _0xb01ad8[_0xea02('0x14')](_0x30e352)[_0xea02('0x15')]();};}function respondWithResult(_0x584c49,_0x3c77ba){_0x3c77ba=_0x3c77ba||0xc8;return function(_0x4d14db){if(_0x4d14db){return _0x584c49['status'](_0x3c77ba)['json'](_0x4d14db);}};}function respondWithFilteredResult(_0x2003cd,_0x5b6c16){return function(_0x5ba5ec){if(_0x5ba5ec){var _0x6e6c9d=typeof _0x5b6c16['offset']==='undefined'&&typeof _0x5b6c16[_0xea02('0x16')]===_0xea02('0x17');var _0x1c1d8b=_0x5ba5ec[_0xea02('0x18')];var _0x36b9cc=_0x6e6c9d?0x0:_0x5b6c16[_0xea02('0x19')];var _0xd45455=_0x6e6c9d?_0x5ba5ec[_0xea02('0x18')]:_0x5b6c16['offset']+_0x5b6c16[_0xea02('0x16')];var _0x52de4f;if(_0xd45455>=_0x1c1d8b){_0xd45455=_0x1c1d8b;_0x52de4f=0xc8;}else{_0x52de4f=0xce;}_0x2003cd[_0xea02('0x14')](_0x52de4f);return _0x2003cd['set'](_0xea02('0x1a'),_0x36b9cc+'-'+_0xd45455+'/'+_0x1c1d8b)[_0xea02('0x1b')](_0x5ba5ec);}return null;};}function patchUpdates(_0x555c1b){return function(_0x45a123){try{jsonpatch[_0xea02('0x1c')](_0x45a123,_0x555c1b,!![]);}catch(_0x4b44ca){return BPromise['reject'](_0x4b44ca);}return _0x45a123[_0xea02('0x1d')]();};}function saveUpdates(_0xde33e5,_0x30bb33){return function(_0x213c1f){if(_0x213c1f){return _0x213c1f[_0xea02('0x1e')](_0xde33e5)['then'](function(_0x2a4394){return _0x2a4394;});}return null;};}function removeEntity(_0x35f20b,_0x402462){return function(_0x31772c){if(_0x31772c){return _0x31772c['destroy']()['then'](function(){_0x35f20b['status'](0xcc)[_0xea02('0x15')]();});}};}function handleEntityNotFound(_0x282267,_0x2fc0f6){return function(_0xd23b65){if(!_0xd23b65){_0x282267[_0xea02('0x13')](0x194);}return _0xd23b65;};}function handleError(_0x3028d4,_0xd002e1){_0xd002e1=_0xd002e1||0x1f4;return function(_0x108413){logger[_0xea02('0x1f')](_0x108413[_0xea02('0x20')]);if(_0x108413[_0xea02('0x21')]){delete _0x108413[_0xea02('0x21')];}_0x3028d4['status'](_0xd002e1)[_0xea02('0x22')](_0x108413);};}exports[_0xea02('0x23')]=function(_0x4fd4bd,_0x44842a){var _0x4df794={},_0xe15a3f={},_0x1a2db5={'count':0x0,'rows':[]};var _0xf22d58=_[_0xea02('0x24')](db[_0xea02('0x25')]['rawAttributes'],function(_0x1ff315){return{'name':_0x1ff315[_0xea02('0x26')],'type':_0x1ff315[_0xea02('0x27')]['key']};});_0xe15a3f[_0xea02('0x28')]=_['map'](_0xf22d58,_0xea02('0x21'));_0xe15a3f[_0xea02('0x29')]=_['keys'](_0x4fd4bd['query']);_0xe15a3f[_0xea02('0x2a')]=_[_0xea02('0x2b')](_0xe15a3f[_0xea02('0x28')],_0xe15a3f[_0xea02('0x29')]);_0x4df794[_0xea02('0x2c')]=_[_0xea02('0x2b')](_0xe15a3f[_0xea02('0x28')],qs[_0xea02('0x2d')](_0x4fd4bd[_0xea02('0x29')][_0xea02('0x2d')]));_0x4df794[_0xea02('0x2c')]=_0x4df794['attributes'][_0xea02('0x2e')]?_0x4df794[_0xea02('0x2c')]:_0xe15a3f[_0xea02('0x28')];if(!_0x4fd4bd[_0xea02('0x29')][_0xea02('0x2f')](_0xea02('0x30'))){_0x4df794[_0xea02('0x16')]=qs[_0xea02('0x16')](_0x4fd4bd[_0xea02('0x29')][_0xea02('0x16')]);_0x4df794[_0xea02('0x19')]=qs['offset'](_0x4fd4bd[_0xea02('0x29')][_0xea02('0x19')]);}_0x4df794[_0xea02('0x31')]=qs[_0xea02('0x32')](_0x4fd4bd['query'][_0xea02('0x32')]);_0x4df794[_0xea02('0x33')]=qs[_0xea02('0x2a')](_['pick'](_0x4fd4bd[_0xea02('0x29')],_0xe15a3f[_0xea02('0x2a')]),_0xf22d58);if(_0x4fd4bd['query'][_0xea02('0x34')]){_0x4df794['where']=_[_0xea02('0x35')](_0x4df794[_0xea02('0x33')],{'$or':_[_0xea02('0x24')](_0xf22d58,function(_0x50fb47){if(_0x50fb47[_0xea02('0x27')]!==_0xea02('0x36')){var _0x1f7545={};_0x1f7545[_0x50fb47[_0xea02('0x21')]]={'$like':'%'+_0x4fd4bd[_0xea02('0x29')]['filter']+'%'};return _0x1f7545;}})});}_0x4df794=_[_0xea02('0x35')]({},_0x4df794,_0x4fd4bd[_0xea02('0x37')]);var _0x5036c8={'where':_0x4df794['where']};return db[_0xea02('0x25')][_0xea02('0x18')](_0x5036c8)[_0xea02('0x38')](function(_0x37b234){_0x1a2db5['count']=_0x37b234;if(_0x4fd4bd[_0xea02('0x29')]['includeAll']){_0x4df794[_0xea02('0x39')]=[{'all':!![]}];}return db[_0xea02('0x25')][_0xea02('0x3a')](_0x4df794);})[_0xea02('0x38')](function(_0x101414){_0x1a2db5[_0xea02('0x3b')]=_0x101414;return _0x1a2db5;})[_0xea02('0x38')](respondWithFilteredResult(_0x44842a,_0x4df794))['catch'](handleError(_0x44842a,null));};exports[_0xea02('0x3c')]=function(_0x46e250,_0x2358ee){var _0x2c4eb9={'raw':![],'where':{'id':_0x46e250[_0xea02('0x3d')]['id']}},_0x3cb504={};_0x3cb504[_0xea02('0x28')]=_['keys'](db[_0xea02('0x25')]['rawAttributes']);_0x3cb504[_0xea02('0x29')]=_['keys'](_0x46e250['query']);_0x3cb504['filters']=_[_0xea02('0x2b')](_0x3cb504['model'],_0x3cb504[_0xea02('0x29')]);_0x2c4eb9['attributes']=_[_0xea02('0x2b')](_0x3cb504[_0xea02('0x28')],qs[_0xea02('0x2d')](_0x46e250[_0xea02('0x29')][_0xea02('0x2d')]));_0x2c4eb9[_0xea02('0x2c')]=_0x2c4eb9['attributes']['length']?_0x2c4eb9[_0xea02('0x2c')]:_0x3cb504[_0xea02('0x28')];if(_0x46e250[_0xea02('0x29')]['includeAll']){_0x2c4eb9['include']=[{'all':!![]}];}_0x2c4eb9=_[_0xea02('0x35')]({},_0x2c4eb9,_0x46e250[_0xea02('0x37')]);return db['Automation'][_0xea02('0x3e')](_0x2c4eb9)['then'](handleEntityNotFound(_0x2358ee,null))[_0xea02('0x38')](respondWithResult(_0x2358ee,null))[_0xea02('0x3f')](handleError(_0x2358ee,null));};exports[_0xea02('0x40')]=function(_0x587c04,_0x3c6142){return db[_0xea02('0x25')]['create'](_0x587c04[_0xea02('0x41')],{})[_0xea02('0x38')](respondWithResult(_0x3c6142,0xc9))[_0xea02('0x3f')](handleError(_0x3c6142,null));};exports[_0xea02('0x1e')]=function(_0x1e078a,_0x8d3dfa){if(_0x1e078a['body']['id']){delete _0x1e078a[_0xea02('0x41')]['id'];}return db[_0xea02('0x25')][_0xea02('0x3e')]({'where':{'id':_0x1e078a[_0xea02('0x3d')]['id']}})[_0xea02('0x38')](handleEntityNotFound(_0x8d3dfa,null))[_0xea02('0x38')](saveUpdates(_0x1e078a['body'],null))[_0xea02('0x38')](respondWithResult(_0x8d3dfa,null))[_0xea02('0x3f')](handleError(_0x8d3dfa,null));};exports[_0xea02('0x42')]=function(_0x513383,_0x475e09){return db[_0xea02('0x25')][_0xea02('0x3e')]({'where':{'id':_0x513383['params']['id']}})[_0xea02('0x38')](handleEntityNotFound(_0x475e09,null))[_0xea02('0x38')](removeEntity(_0x475e09,null))[_0xea02('0x3f')](handleError(_0x475e09,null));};exports['addConditions']=function(_0x2215ae,_0x32775e,_0x5a42ce){return db['Condition'][_0xea02('0x3e')]({'where':{'id':_0x2215ae[_0xea02('0x3d')]['id']}})[_0xea02('0x38')](handleEntityNotFound(_0x32775e,null))[_0xea02('0x38')](function(_0x232551){if(_0x232551){return _0x232551[_0xea02('0x43')](_0x2215ae[_0xea02('0x41')]['ids'],_[_0xea02('0x44')](_0x2215ae[_0xea02('0x41')],[_0xea02('0x45'),'id'])||{});}})[_0xea02('0x38')](respondWithResult(_0x32775e,null))['catch'](handleError(_0x32775e,null));};exports[_0xea02('0x46')]=function(_0x5e0ef8,_0x15f13f,_0x203d13){var _0x4837d1={};var _0x4a5d3f={};var _0x19f192;var _0x5219b0;return db[_0xea02('0x25')][_0xea02('0x47')]({'where':{'id':_0x5e0ef8['params']['id']}})[_0xea02('0x38')](handleEntityNotFound(_0x15f13f,null))['then'](function(_0x5b5336){if(_0x5b5336){_0x19f192=_0x5b5336;_0x4a5d3f[_0xea02('0x28')]=_[_0xea02('0x48')](db[_0xea02('0x49')]['rawAttributes']);_0x4a5d3f[_0xea02('0x29')]=_[_0xea02('0x48')](_0x5e0ef8[_0xea02('0x29')]);_0x4a5d3f[_0xea02('0x2a')]=_[_0xea02('0x2b')](_0x4a5d3f[_0xea02('0x28')],_0x4a5d3f[_0xea02('0x29')]);_0x4837d1[_0xea02('0x2c')]=_[_0xea02('0x2b')](_0x4a5d3f[_0xea02('0x28')],qs[_0xea02('0x2d')](_0x5e0ef8[_0xea02('0x29')][_0xea02('0x2d')]));_0x4837d1[_0xea02('0x2c')]=_0x4837d1[_0xea02('0x2c')][_0xea02('0x2e')]?_0x4837d1[_0xea02('0x2c')]:_0x4a5d3f['model'];_0x4837d1[_0xea02('0x31')]=qs['sort'](_0x5e0ef8[_0xea02('0x29')][_0xea02('0x32')]);_0x4837d1['where']=qs[_0xea02('0x2a')](_[_0xea02('0x4a')](_0x5e0ef8[_0xea02('0x29')],_0x4a5d3f['filters']));if(_0x5e0ef8[_0xea02('0x29')]['filter']){_0x4837d1[_0xea02('0x33')]=_[_0xea02('0x35')](_0x4837d1[_0xea02('0x33')],{'$or':_['map'](_0x4837d1[_0xea02('0x2c')],function(_0x2b3bc9){var _0x36bd4d={};_0x36bd4d[_0x2b3bc9]={'$like':'%'+_0x5e0ef8['query'][_0xea02('0x34')]+'%'};return _0x36bd4d;})});}_0x4837d1=_[_0xea02('0x35')]({},_0x4837d1,_0x5e0ef8[_0xea02('0x37')]);return _0x19f192[_0xea02('0x46')](_0x4837d1);}})[_0xea02('0x38')](function(_0x2f6646){if(_0x2f6646){_0x5219b0=_0x2f6646[_0xea02('0x2e')];if(!_0x5e0ef8['query']['hasOwnProperty'](_0xea02('0x30'))){_0x4837d1[_0xea02('0x16')]=qs['limit'](_0x5e0ef8[_0xea02('0x29')]['limit']);_0x4837d1[_0xea02('0x19')]=qs['offset'](_0x5e0ef8['query'][_0xea02('0x19')]);}return _0x19f192[_0xea02('0x46')](_0x4837d1);}})[_0xea02('0x38')](function(_0x25865b){if(_0x25865b){return _0x25865b?{'count':_0x5219b0,'rows':_0x25865b}:null;}})[_0xea02('0x38')](respondWithResult(_0x15f13f,null))[_0xea02('0x3f')](handleError(_0x15f13f,null));};exports[_0xea02('0x4b')]=function(_0x42865f,_0x5ac349,_0x23f6ea){return db[_0xea02('0x4c')][_0xea02('0x3e')]({'where':{'id':_0x42865f[_0xea02('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5ac349,null))[_0xea02('0x38')](function(_0x46ae63){if(_0x46ae63){return _0x46ae63[_0xea02('0x4b')](_0x42865f[_0xea02('0x41')]['ids'],_[_0xea02('0x44')](_0x42865f[_0xea02('0x41')],['ids','id'])||{});}})[_0xea02('0x38')](respondWithResult(_0x5ac349,null))['catch'](handleError(_0x5ac349,null));};exports[_0xea02('0x4d')]=function(_0xccfe,_0x26ebab,_0x142687){var _0x5acceb={};var _0x14b547={};var _0x373737;var _0x231088;return db['Automation']['findOne']({'where':{'id':_0xccfe[_0xea02('0x3d')]['id']}})['then'](handleEntityNotFound(_0x26ebab,null))[_0xea02('0x38')](function(_0x3fe6b0){if(_0x3fe6b0){_0x373737=_0x3fe6b0;_0x14b547['model']=_[_0xea02('0x48')](db['Action'][_0xea02('0x4e')]);_0x14b547['query']=_[_0xea02('0x48')](_0xccfe[_0xea02('0x29')]);_0x14b547['filters']=_['intersection'](_0x14b547[_0xea02('0x28')],_0x14b547[_0xea02('0x29')]);_0x5acceb[_0xea02('0x2c')]=_[_0xea02('0x2b')](_0x14b547['model'],qs['fields'](_0xccfe['query']['fields']));_0x5acceb['attributes']=_0x5acceb[_0xea02('0x2c')]['length']?_0x5acceb['attributes']:_0x14b547[_0xea02('0x28')];_0x5acceb['order']=qs['sort'](_0xccfe[_0xea02('0x29')][_0xea02('0x32')]);_0x5acceb[_0xea02('0x33')]=qs[_0xea02('0x2a')](_[_0xea02('0x4a')](_0xccfe[_0xea02('0x29')],_0x14b547[_0xea02('0x2a')]));if(_0xccfe[_0xea02('0x29')][_0xea02('0x34')]){_0x5acceb['where']=_[_0xea02('0x35')](_0x5acceb[_0xea02('0x33')],{'$or':_['map'](_0x5acceb[_0xea02('0x2c')],function(_0x2153ae){var _0x1c6d97={};_0x1c6d97[_0x2153ae]={'$like':'%'+_0xccfe['query']['filter']+'%'};return _0x1c6d97;})});}_0x5acceb=_[_0xea02('0x35')]({},_0x5acceb,_0xccfe[_0xea02('0x37')]);return _0x373737['getActions'](_0x5acceb);}})[_0xea02('0x38')](function(_0x4f91bb){if(_0x4f91bb){_0x231088=_0x4f91bb[_0xea02('0x2e')];if(!_0xccfe['query'][_0xea02('0x2f')]('nolimit')){_0x5acceb['limit']=qs['limit'](_0xccfe[_0xea02('0x29')][_0xea02('0x16')]);_0x5acceb['offset']=qs[_0xea02('0x19')](_0xccfe[_0xea02('0x29')][_0xea02('0x19')]);}return _0x373737[_0xea02('0x4d')](_0x5acceb);}})[_0xea02('0x38')](function(_0x11eeae){if(_0x11eeae){return _0x11eeae?{'count':_0x231088,'rows':_0x11eeae}:null;}})['then'](respondWithResult(_0x26ebab,null))['catch'](handleError(_0x26ebab,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 765e7fc..36c7c46 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 _0xe34b=['path','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1f286b,_0x42248a){var _0x4fc275=function(_0x2888c2){while(--_0x2888c2){_0x1f286b['push'](_0x1f286b['shift']());}};_0x4fc275(++_0x42248a);}(_0xe34b,0x89));var _0xbe34=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xe34b[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0xbe34('0x0'));var util=require(_0xbe34('0x1'));var logger=require(_0xbe34('0x2'))(_0xbe34('0x3'));var moment=require('moment');var BPromise=require(_0xbe34('0x4'));var rp=require(_0xbe34('0x5'));var fs=require('fs');var path=require(_0xbe34('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe34('0x7'));module[_0xbe34('0x8')]=function(_0x913fd9,_0x5c42c6){return _0x913fd9[_0xbe34('0x9')](_0xbe34('0xa'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb57b=['tools_automations','lodash','util','../../config/logger','api','moment','request-promise','path','./automation.attributes','exports','define','Automation'];(function(_0x49d703,_0x347cc){var _0x5ec762=function(_0x8067a3){while(--_0x8067a3){_0x49d703['push'](_0x49d703['shift']());}};_0x5ec762(++_0x347cc);}(_0xb57b,0x1b1));var _0xbb57=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb57b[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xbb57('0x0'));var util=require(_0xbb57('0x1'));var logger=require(_0xbb57('0x2'))(_0xbb57('0x3'));var moment=require(_0xbb57('0x4'));var BPromise=require('bluebird');var rp=require(_0xbb57('0x5'));var fs=require('fs');var path=require(_0xbb57('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbb57('0x7'));module[_0xbb57('0x8')]=function(_0x560ad5,_0x2ad427){return _0x560ad5[_0xbb57('0x9')](_0xbb57('0xa'),attributes,{'tableName':_0xbb57('0xb'),'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 3f684e0..2ebf00d 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 _0xcf2f=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x34ae76,_0x4cd562){var _0x5325eb=function(_0x29406a){while(--_0x29406a){_0x34ae76['push'](_0x34ae76['shift']());}};_0x5325eb(++_0x4cd562);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x367eed,_0x44544d){_0x367eed=_0x367eed-0x0;var _0x1f57f1=_0xcf2f[_0x367eed];return _0x1f57f1;};'use strict';var _=require(_0xfcf2('0x0'));var util=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));var BPromise=require(_0xfcf2('0x3'));var rs=require(_0xfcf2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcf2('0x5'))['db'];var utils=require(_0xfcf2('0x6'));var logger=require(_0xfcf2('0x7'))(_0xfcf2('0x8'));var config=require(_0xfcf2('0x9'));var jayson=require(_0xfcf2('0xa'));var client=jayson[_0xfcf2('0xb')][_0xfcf2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41d4bd,_0x157f48,_0x16b6b2){return new BPromise(function(_0x34f444,_0xb4c510){return client[_0xfcf2('0xd')](_0x41d4bd,_0x16b6b2)['then'](function(_0x575f33){logger['info'](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));logger['debug'](_0xfcf2('0x10'),_0x157f48,_0xfcf2('0xf'),JSON[_0xfcf2('0x11')](_0x575f33));if(_0x575f33[_0xfcf2('0x12')]){if(_0x575f33['error']['code']===0x1f4){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x575f33[_0xfcf2('0x12')][_0xfcf2('0x13')]);return _0xb4c510(_0x575f33['error'][_0xfcf2('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0x157f48,_0x575f33['error'][_0xfcf2('0x13')]);return _0x34f444(_0x575f33['error'][_0xfcf2('0x13')]);}else{logger[_0xfcf2('0x14')](_0xfcf2('0xe'),_0x157f48,_0xfcf2('0xf'));_0x34f444(_0x575f33[_0xfcf2('0x15')][_0xfcf2('0x13')]);}})[_0xfcf2('0x16')](function(_0x4d64ce){logger[_0xfcf2('0x12')](_0xfcf2('0xe'),_0x157f48,_0x4d64ce);_0xb4c510(_0x4d64ce);});});} \ No newline at end of file +var _0x02a7=['Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x02a7,0x1a6));var _0x702a=function(_0x121905,_0x4b2c02){_0x121905=_0x121905-0x0;var _0x582f44=_0x02a7[_0x121905];return _0x582f44;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require(_0x702a('0x1'));var BPromise=require(_0x702a('0x2'));var rs=require(_0x702a('0x3'));var fs=require('fs');var Redis=require(_0x702a('0x4'));var db=require(_0x702a('0x5'))['db'];var utils=require(_0x702a('0x6'));var logger=require(_0x702a('0x7'))(_0x702a('0x8'));var config=require(_0x702a('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x702a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b6736,_0x27bfc7,_0x3f5ff8){return new BPromise(function(_0x51bf52,_0x562fdb){return client['request'](_0x4b6736,_0x3f5ff8)['then'](function(_0x3cb569){logger[_0x702a('0xb')]('Automation,\x20%s,\x20%s',_0x27bfc7,_0x702a('0xc'));logger[_0x702a('0xd')](_0x702a('0xe'),_0x27bfc7,_0x702a('0xc'),JSON[_0x702a('0xf')](_0x3cb569));if(_0x3cb569[_0x702a('0x10')]){if(_0x3cb569[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger['error'](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x562fdb(_0x3cb569[_0x702a('0x10')]['message']);}logger[_0x702a('0x10')](_0x702a('0x12'),_0x27bfc7,_0x3cb569[_0x702a('0x10')][_0x702a('0x13')]);return _0x51bf52(_0x3cb569[_0x702a('0x10')]['message']);}else{logger[_0x702a('0xb')](_0x702a('0x12'),_0x27bfc7,_0x702a('0xc'));_0x51bf52(_0x3cb569[_0x702a('0x14')][_0x702a('0x13')]);}})[_0x702a('0x15')](function(_0x451881){logger['error']('Automation,\x20%s,\x20%s',_0x27bfc7,_0x451881);_0x562fdb(_0x451881);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 2444d58..9280ee8 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 _0x4016=['getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','destroy','util','path','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/conditions'];(function(_0x26800b,_0x5db18c){var _0x164eb2=function(_0x334cb2){while(--_0x334cb2){_0x26800b['push'](_0x26800b['shift']());}};_0x164eb2(++_0x5db18c);}(_0x4016,0x131));var _0x6401=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4016[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x6401('0x0'));var path=require(_0x6401('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6401('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x6401('0x3'));var config=require(_0x6401('0x4'));var controller=require('./automation.controller');router['get']('/',auth[_0x6401('0x5')](),controller[_0x6401('0x6')]);router['get'](_0x6401('0x7'),auth['isAuthenticated'](),controller[_0x6401('0x8')]);router['get'](_0x6401('0x9'),auth[_0x6401('0x5')](),controller[_0x6401('0xa')]);router['get']('/:id/actions',auth[_0x6401('0x5')](),controller[_0x6401('0xb')]);router[_0x6401('0xc')]('/',auth['isAuthenticated'](),controller[_0x6401('0xd')]);router['post']('/:id/conditions',auth[_0x6401('0x5')](),controller[_0x6401('0xe')]);router[_0x6401('0xc')](_0x6401('0xf'),auth[_0x6401('0x5')](),controller[_0x6401('0x10')]);router[_0x6401('0x11')](_0x6401('0x7'),auth[_0x6401('0x5')](),controller[_0x6401('0x12')]);router[_0x6401('0x13')](_0x6401('0x7'),auth[_0x6401('0x5')](),controller[_0x6401('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2e35=['put','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions'];(function(_0x2e9187,_0x3763f6){var _0x1fc3a8=function(_0xb30d96){while(--_0xb30d96){_0x2e9187['push'](_0x2e9187['shift']());}};_0x1fc3a8(++_0x3763f6);}(_0x2e35,0x101));var _0x52e3=function(_0x4d9f21,_0x2419f7){_0x4d9f21=_0x4d9f21-0x0;var _0x570d53=_0x2e35[_0x4d9f21];return _0x570d53;};'use strict';var multer=require(_0x52e3('0x0'));var util=require('util');var path=require(_0x52e3('0x1'));var timeout=require('connect-timeout');var express=require(_0x52e3('0x2'));var router=express[_0x52e3('0x3')]();var fs_extra=require(_0x52e3('0x4'));var auth=require(_0x52e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x52e3('0x6'));var controller=require('./automation.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x52e3('0x7')]);router[_0x52e3('0x8')](_0x52e3('0x9'),auth[_0x52e3('0xa')](),controller[_0x52e3('0xb')]);router[_0x52e3('0x8')](_0x52e3('0xc'),auth[_0x52e3('0xa')](),controller['getConditions']);router[_0x52e3('0x8')](_0x52e3('0xd'),auth[_0x52e3('0xa')](),controller[_0x52e3('0xe')]);router[_0x52e3('0xf')]('/',auth[_0x52e3('0xa')](),controller[_0x52e3('0x10')]);router['post']('/:id/conditions',auth['isAuthenticated'](),controller[_0x52e3('0x11')]);router[_0x52e3('0xf')](_0x52e3('0xd'),auth['isAuthenticated'](),controller[_0x52e3('0x12')]);router[_0x52e3('0x13')]('/:id',auth[_0x52e3('0xa')](),controller[_0x52e3('0x14')]);router['delete'](_0x52e3('0x9'),auth[_0x52e3('0xa')](),controller[_0x52e3('0x15')]);module[_0x52e3('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 47cb49a..203d2c9 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 _0x68ea=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3deed4,_0x4455f5){var _0x40e50d=function(_0x22064b){while(--_0x22064b){_0x3deed4['push'](_0x3deed4['shift']());}};_0x40e50d(++_0x4455f5);}(_0x68ea,0xe9));var _0xa68e=function(_0x4676c9,_0xc25045){_0x4676c9=_0x4676c9-0x0;var _0x358409=_0x68ea[_0x4676c9];return _0x358409;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa68e('0x0')],'unique':_0xa68e('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa68e('0x2')]('ivr'),'allowNull':![],'defaultValue':_0xa68e('0x3')},'description':{'type':Sequelize[_0xa68e('0x0')]},'active':{'type':Sequelize[_0xa68e('0x4')],'defaultValue':0x0,'comment':_0xa68e('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xa68e('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa68e('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa68e('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa68e('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xa68e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa68e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xa68e('0x8')](0x3)[_0xa68e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa68e('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa68e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa68e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa68e('0x8')](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa68e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa68e('0x8')](0x3)[_0xa68e('0x6')],'defaultValue':0x3,'comment':_0xa68e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa68e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa68e('0xf')},'dialTimezone':{'type':Sequelize[_0xa68e('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa68e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xa68e('0x2')](_0xa68e('0x11'),_0xa68e('0x12'),_0xa68e('0x13')),'defaultValue':_0xa68e('0x11')},'dialAMDActive':{'type':Sequelize[_0xa68e('0x4')],'defaultValue':0x0,'comment':_0xa68e('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0xa68e('0x8')](0x9)[_0xa68e('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa68e('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa68e('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa68e('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa68e('0x8')](0x9)[_0xa68e('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa68e('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa68e('0x8')](0x9)[_0xa68e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xa68e('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa68e('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa68e('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa68e('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa68e('0x8')](0x9)[_0xa68e('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa68e('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa68e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa68e('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa68e('0x8')](0x9)[_0xa68e('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa68e('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xa68e('0x1d'),_0xa68e('0x1e')),'defaultValue':_0xa68e('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa68e('0x8')](0x3)[_0xa68e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa68e('0x1f')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xa68e('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa68e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa68e('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa68e('0x8')](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xa68e('0x8')](0x3)[_0xa68e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa68e('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xa68e('0x8')](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa68e('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa68e('0x8')](0x3)[_0xa68e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa68e('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xa68e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xa68e('0x8')](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa68e('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa68e('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa68e('0x8')](0x5)[_0xa68e('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa68e('0x25')}}; \ No newline at end of file +var _0x80a2=['ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#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)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING'];(function(_0x2d03f7,_0x453538){var _0x5e2e61=function(_0x5e78f7){while(--_0x5e78f7){_0x2d03f7['push'](_0x2d03f7['shift']());}};_0x5e2e61(++_0x453538);}(_0x80a2,0xf9));var _0x280a=function(_0x2d6684,_0x86ef71){_0x2d6684=_0x2d6684-0x0;var _0x2bb5e2=_0x80a2[_0x2d6684];return _0x2bb5e2;};'use strict';var Sequelize=require(_0x280a('0x0'));module[_0x280a('0x1')]={'name':{'type':Sequelize[_0x280a('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x280a('0x3')](_0x280a('0x4')),'allowNull':![],'defaultValue':_0x280a('0x4')},'description':{'type':Sequelize[_0x280a('0x2')]},'active':{'type':Sequelize[_0x280a('0x5')],'defaultValue':0x0,'comment':_0x280a('0x6')},'limitCalls':{'type':Sequelize[_0x280a('0x7')](0x4)[_0x280a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x280a('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x280a('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x280a('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x280a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x280a('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x280a('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'defaultValue':0x3,'comment':_0x280a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x280a('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'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[_0x280a('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x280a('0x3')](_0x280a('0xf'),_0x280a('0x10'),'onlyIfOpen'),'defaultValue':_0x280a('0xf')},'dialAMDActive':{'type':Sequelize[_0x280a('0x5')],'defaultValue':0x0,'comment':_0x280a('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x280a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x280a('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x280a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x280a('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x280a('0x7')](0x9)[_0x280a('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x280a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x280a('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x280a('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x280a('0x7')](0x9)[_0x280a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x280a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x280a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x280a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x280a('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x280a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x280a('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x280a('0x3')](_0x280a('0x19'),_0x280a('0x1a')),'defaultValue':_0x280a('0x19')},'dialPrefix':{'type':Sequelize[_0x280a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x280a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x280a('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x280a('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x280a('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x280a('0x7')](0x3)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x280a('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x280a('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x280a('0x20')},'dialMachineRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x280a('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x280a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x280a('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x280a('0x7')](0x5)[_0x280a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x280a('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 65db35b..4b17269 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 _0x57f8=['destroy','then','get','IvrCampaigns','UserProfileResource','error','name','send','index','map','Campaign','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','fields','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','findOne','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','from','onlyIfOpen','insert','cm_contacts','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','push','all','removeLists','getBlackLists','addBlackLists','format','spread','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update'];(function(_0x3aa34c,_0x31e668){var _0x5a7edd=function(_0x4f344b){while(--_0x4f344b){_0x3aa34c['push'](_0x3aa34c['shift']());}};_0x5a7edd(++_0x31e668);}(_0x57f8,0x198));var _0x857f=function(_0x10ed52,_0x4dcad2){_0x10ed52=_0x10ed52-0x0;var _0x2f4623=_0x57f8[_0x10ed52];return _0x2f4623;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){var _0x44ff23=_0x3bc543[_0x857f('0x29')]({'plain':!![]});var _0x3b23a7=_0x857f('0x2a');return db[_0x857f('0x2b')][_0x857f('0x27')]({'where':{'type':_0x3b23a7,'resourceId':_0x44ff23['id']}})[_0x857f('0x28')](function(){return _0x3bc543;});})[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x46761e,_0x570905){return function(_0x17e415){if(!_0x17e415){_0x46761e[_0x857f('0x1b')](0x194);}return _0x17e415;};}function handleError(_0x23afb8,_0x2c5792){_0x2c5792=_0x2c5792||0x1f4;return function(_0x58c2de){logger[_0x857f('0x2c')](_0x58c2de['stack']);if(_0x58c2de[_0x857f('0x2d')]){delete _0x58c2de[_0x857f('0x2d')];}_0x23afb8[_0x857f('0x1c')](_0x2c5792)[_0x857f('0x2e')](_0x58c2de);};}exports[_0x857f('0x2f')]=function(_0x464e8f,_0x1c4fff){var _0xe79241={},_0x17e7b6={},_0x41f832={'count':0x0,'rows':[]};var _0x24adc2=_[_0x857f('0x30')](db[_0x857f('0x31')]['rawAttributes'],function(_0x3078cf){return{'name':_0x3078cf[_0x857f('0x32')],'type':_0x3078cf['type'][_0x857f('0x33')]};});_0x17e7b6[_0x857f('0x34')]=_['map'](_0x24adc2,_0x857f('0x2d'));_0x17e7b6[_0x857f('0x35')]=_['keys'](_0x464e8f[_0x857f('0x35')]);_0x17e7b6[_0x857f('0x36')]=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],_0x17e7b6['query']);_0xe79241['attributes']=_[_0x857f('0x37')](_0x17e7b6[_0x857f('0x34')],qs['fields'](_0x464e8f[_0x857f('0x35')]['fields']));_0xe79241[_0x857f('0x38')]=_0xe79241[_0x857f('0x38')][_0x857f('0x39')]?_0xe79241[_0x857f('0x38')]:_0x17e7b6[_0x857f('0x34')];if(!_0x464e8f['query']['hasOwnProperty'](_0x857f('0x3a'))){_0xe79241['limit']=qs[_0x857f('0x21')](_0x464e8f[_0x857f('0x35')][_0x857f('0x21')]);_0xe79241['offset']=qs[_0x857f('0x1f')](_0x464e8f[_0x857f('0x35')][_0x857f('0x1f')]);}_0xe79241[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x464e8f[_0x857f('0x35')][_0x857f('0x3c')]);_0xe79241['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x464e8f[_0x857f('0x35')],_0x17e7b6[_0x857f('0x36')]),_0x24adc2);if(_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]){_0xe79241[_0x857f('0x3f')]=_['merge'](_0xe79241[_0x857f('0x3f')],{'$or':_[_0x857f('0x30')](_0x24adc2,function(_0xcd5959){if(_0xcd5959[_0x857f('0x40')]!==_0x857f('0x41')){var _0x1c119f={};_0x1c119f[_0xcd5959['name']]={'$like':'%'+_0x464e8f[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x1c119f;}})});}_0xe79241=_[_0x857f('0x42')]({},_0xe79241,_0x464e8f[_0x857f('0x43')]);var _0x3938ee={'where':_0xe79241[_0x857f('0x3f')]};return db[_0x857f('0x31')][_0x857f('0x22')](_0x3938ee)['then'](function(_0x40fb37){_0x41f832[_0x857f('0x22')]=_0x40fb37;if(_0x464e8f[_0x857f('0x35')][_0x857f('0x44')]){_0xe79241[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x31')][_0x857f('0x46')](_0xe79241);})[_0x857f('0x28')](function(_0xb4d7c2){_0x41f832[_0x857f('0x47')]=_0xb4d7c2;return _0x41f832;})[_0x857f('0x28')](respondWithFilteredResult(_0x1c4fff,_0xe79241))[_0x857f('0x48')](handleError(_0x1c4fff,null));};exports[_0x857f('0x49')]=function(_0x376f71,_0x5d4c2a){var _0xe0e078={'raw':![],'where':{'id':_0x376f71[_0x857f('0x4a')]['id']}},_0x5b2baa={};_0x5b2baa[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x31')][_0x857f('0x4c')]);_0x5b2baa[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x376f71[_0x857f('0x35')]);_0x5b2baa[_0x857f('0x36')]=_[_0x857f('0x37')](_0x5b2baa[_0x857f('0x34')],_0x5b2baa['query']);_0xe0e078['attributes']=_[_0x857f('0x37')](_0x5b2baa['model'],qs[_0x857f('0x4d')](_0x376f71['query'][_0x857f('0x4d')]));_0xe0e078[_0x857f('0x38')]=_0xe0e078[_0x857f('0x38')][_0x857f('0x39')]?_0xe0e078[_0x857f('0x38')]:_0x5b2baa[_0x857f('0x34')];if(_0x376f71[_0x857f('0x35')][_0x857f('0x44')]){_0xe0e078['include']=[{'all':!![]}];}_0xe0e078=_[_0x857f('0x42')]({},_0xe0e078,_0x376f71[_0x857f('0x43')]);return db[_0x857f('0x31')][_0x857f('0x4e')](_0xe0e078)['then'](handleEntityNotFound(_0x5d4c2a,null))[_0x857f('0x28')](respondWithResult(_0x5d4c2a,null))[_0x857f('0x48')](handleError(_0x5d4c2a,null));};exports[_0x857f('0x4f')]=function(_0x736ef6,_0x67563){return db['Campaign'][_0x857f('0x4f')](_0x736ef6[_0x857f('0x50')],{})['then'](function(_0xfd1679){var _0x847879=_0x736ef6['user'][_0x857f('0x29')]({'plain':!![]});if(!_0x847879)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x847879[_0x857f('0x51')]===_0x857f('0x52')){var _0x446fe9=_0xfd1679[_0x857f('0x29')]({'plain':!![]});var _0x58bf27=_0x857f('0x2a');return db[_0x857f('0x53')][_0x857f('0x4e')]({'where':{'name':_0x58bf27,'userProfileId':_0x847879[_0x857f('0x54')]},'raw':!![]})[_0x857f('0x28')](function(_0x4f9d24){if(_0x4f9d24&&_0x4f9d24[_0x857f('0x55')]===0x0){return db[_0x857f('0x2b')][_0x857f('0x4f')]({'name':_0x446fe9[_0x857f('0x2d')],'resourceId':_0x446fe9['id'],'type':_0x4f9d24[_0x857f('0x2d')],'sectionId':_0x4f9d24['id']},{})[_0x857f('0x28')](function(){return _0xfd1679;});}else{return _0xfd1679;}})[_0x857f('0x48')](function(_0x59164a){logger[_0x857f('0x2c')](_0x857f('0x56'),_0x59164a);throw _0x59164a;});}return _0xfd1679;})[_0x857f('0x28')](respondWithResult(_0x67563,0xc9))[_0x857f('0x48')](handleError(_0x67563,null));};exports[_0x857f('0x57')]=function(_0x153e4e,_0x4bb5fc){var _0x2cf62c={'where':{'id':_0x153e4e[_0x857f('0x4a')]['id']}},_0xe7e09b={};_0xe7e09b[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x31')][_0x857f('0x4c')]);_0x2cf62c[_0x857f('0x38')]=_['intersection'](_0xe7e09b['model'],qs[_0x857f('0x4d')](_0x153e4e[_0x857f('0x35')][_0x857f('0x4d')]));_0x2cf62c[_0x857f('0x38')]=_0x2cf62c[_0x857f('0x38')][_0x857f('0x39')]?_0x2cf62c['attributes']:_0xe7e09b[_0x857f('0x34')];if(_0x153e4e[_0x857f('0x35')]['includeAll']){_0x2cf62c[_0x857f('0x45')]=[{'all':!![]}];}_0x2cf62c=_['merge']({},_0x2cf62c,_0x153e4e[_0x857f('0x43')]);return db[_0x857f('0x31')]['find'](_0x2cf62c)[_0x857f('0x28')](handleEntityNotFound(_0x4bb5fc,null))[_0x857f('0x28')](function(_0x3520d3){if(_0x3520d3){var _0x464208=_0x3520d3[_0x857f('0x29')]({'plain':!![]});_0x464208=qs[_0x857f('0x58')](_0x464208,['id',_0x857f('0x59'),_0x857f('0x5a')]);_0x153e4e['body']=_[_0x857f('0x58')](_0x153e4e[_0x857f('0x50')],['id',_0x857f('0x59'),_0x857f('0x5a')]);return db[_0x857f('0x31')][_0x857f('0x4f')](_[_0x857f('0x42')](_0x464208,_0x153e4e[_0x857f('0x50')]),{'include':_0x153e4e[_0x857f('0x35')][_0x857f('0x44')]?[{'all':!![]}]:undefined})[_0x857f('0x28')](function(_0x5631fb){var _0x390f86=_0x153e4e[_0x857f('0x52')][_0x857f('0x29')]({'plain':!![]});if(!_0x390f86)throw new Error(_0x857f('0x5b'));if(_0x390f86['role']===_0x857f('0x52')){var _0x4b6e13=_0x5631fb[_0x857f('0x29')]({'plain':!![]});var _0x36d746=_0x857f('0x2a');return db[_0x857f('0x53')]['find']({'where':{'name':_0x36d746,'userProfileId':_0x390f86['userProfileId']},'raw':!![]})[_0x857f('0x28')](function(_0x3ee981){if(_0x3ee981&&_0x3ee981[_0x857f('0x55')]===0x0){return db['UserProfileResource'][_0x857f('0x4f')]({'name':_0x4b6e13['name'],'resourceId':_0x4b6e13['id'],'type':_0x3ee981[_0x857f('0x2d')],'sectionId':_0x3ee981['id']},{})[_0x857f('0x28')](function(){return _0x5631fb;});}else{return _0x5631fb;}})[_0x857f('0x48')](function(_0x47fa5a){logger['error'](_0x857f('0x56'),_0x47fa5a);throw _0x47fa5a;});}return _0x5631fb;});}})[_0x857f('0x28')](respondWithResult(_0x4bb5fc,0xc9))[_0x857f('0x48')](handleError(_0x4bb5fc,null));};exports[_0x857f('0x26')]=function(_0x41f9d8,_0x3eecda){if(_0x41f9d8[_0x857f('0x50')]['id']){delete _0x41f9d8[_0x857f('0x50')]['id'];}return db['Campaign']['find']({'where':{'id':_0x41f9d8[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x3eecda,null))[_0x857f('0x28')](saveUpdates(_0x41f9d8[_0x857f('0x50')],null))[_0x857f('0x28')](respondWithResult(_0x3eecda,null))[_0x857f('0x48')](handleError(_0x3eecda,null));};exports['destroy']=function(_0x16cfe0,_0x3ac1de){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x16cfe0[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x3ac1de,null))[_0x857f('0x28')](removeEntity(_0x3ac1de,null))[_0x857f('0x48')](handleError(_0x3ac1de,null));};exports[_0x857f('0x5c')]=function(_0x338670,_0x4b1110,_0x1cb405){var _0x4a17ea={'raw':!![],'where':{}};var _0x5ec513={};var _0x35cd3e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x338670[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b1110,null))[_0x857f('0x28')](function(_0x4da63c){if(_0x4da63c){_0x5ec513[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x5d')][_0x857f('0x4c')]);_0x5ec513['query']=_[_0x857f('0x4b')](_0x338670[_0x857f('0x35')]);_0x5ec513[_0x857f('0x36')]=_[_0x857f('0x37')](_0x5ec513[_0x857f('0x34')],_0x5ec513[_0x857f('0x35')]);_0x4a17ea[_0x857f('0x38')]=_['intersection'](_0x5ec513['model'],qs[_0x857f('0x4d')](_0x338670[_0x857f('0x35')][_0x857f('0x4d')]));_0x4a17ea[_0x857f('0x38')]=_0x4a17ea[_0x857f('0x38')][_0x857f('0x39')]?_0x4a17ea['attributes']:_0x5ec513[_0x857f('0x34')];if(!_0x338670[_0x857f('0x35')][_0x857f('0x5e')]('nolimit')){_0x4a17ea['limit']=qs[_0x857f('0x21')](_0x338670['query']['limit']);_0x4a17ea[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x338670['query'][_0x857f('0x1f')]);}_0x4a17ea[_0x857f('0x3b')]=qs['sort'](_0x338670[_0x857f('0x35')][_0x857f('0x3c')]);_0x4a17ea[_0x857f('0x3f')]=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x338670[_0x857f('0x35')],_0x5ec513[_0x857f('0x36')]));_0x4a17ea[_0x857f('0x3f')][_0x857f('0x5f')]=_0x4da63c['id'];if(_0x338670[_0x857f('0x35')][_0x857f('0x3e')]){_0x4a17ea[_0x857f('0x3f')]=_['merge'](_0x4a17ea['where'],{'$or':_['map'](_0x4a17ea[_0x857f('0x38')],function(_0x310b18){var _0x2c2422={};_0x2c2422[_0x310b18]={'$like':'%'+_0x338670[_0x857f('0x35')][_0x857f('0x3e')]+'%'};return _0x2c2422;})});}_0x4a17ea=_[_0x857f('0x42')]({},_0x4a17ea,_0x338670[_0x857f('0x43')]);return db['CmHopper'][_0x857f('0x22')]({'where':_0x4a17ea['where']})[_0x857f('0x28')](function(_0x4d7b27){_0x35cd3e['count']=_0x4d7b27;if(_0x338670[_0x857f('0x35')]['includeAll']){_0x4a17ea[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x5d')][_0x857f('0x46')](_0x4a17ea);})['then'](function(_0x45be3d){_0x35cd3e[_0x857f('0x47')]=_0x45be3d;return _0x35cd3e;});}})[_0x857f('0x28')](respondWithFilteredResult(_0x4b1110,_0x4a17ea))[_0x857f('0x48')](handleError(_0x4b1110,null));};exports[_0x857f('0x60')]=function(_0x8a1d41,_0x11b818,_0x3b8093){var _0x3e7cc1={'raw':!![],'where':{}};var _0x53a75d={};var _0x1f29e5={'count':0x0,'rows':[]};return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0x8a1d41[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11b818,null))[_0x857f('0x28')](function(_0x59cdfb){if(_0x59cdfb){_0x53a75d[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x62')][_0x857f('0x4c')]);_0x53a75d['query']=_[_0x857f('0x4b')](_0x8a1d41['query']);_0x53a75d['filters']=_[_0x857f('0x37')](_0x53a75d[_0x857f('0x34')],_0x53a75d['query']);_0x3e7cc1['attributes']=_[_0x857f('0x37')](_0x53a75d[_0x857f('0x34')],qs[_0x857f('0x4d')](_0x8a1d41[_0x857f('0x35')]['fields']));_0x3e7cc1[_0x857f('0x38')]=_0x3e7cc1[_0x857f('0x38')][_0x857f('0x39')]?_0x3e7cc1[_0x857f('0x38')]:_0x53a75d[_0x857f('0x34')];if(!_0x8a1d41['query']['hasOwnProperty'](_0x857f('0x3a'))){_0x3e7cc1['limit']=qs['limit'](_0x8a1d41[_0x857f('0x35')][_0x857f('0x21')]);_0x3e7cc1[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x8a1d41[_0x857f('0x35')][_0x857f('0x1f')]);}_0x3e7cc1[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x8a1d41[_0x857f('0x35')][_0x857f('0x3c')]);_0x3e7cc1[_0x857f('0x3f')]=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x8a1d41[_0x857f('0x35')],_0x53a75d[_0x857f('0x36')]));_0x3e7cc1[_0x857f('0x3f')][_0x857f('0x5f')]=_0x59cdfb['id'];if(_0x8a1d41[_0x857f('0x35')][_0x857f('0x3e')]){_0x3e7cc1[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x3e7cc1[_0x857f('0x3f')],{'$or':_['map'](_0x3e7cc1['attributes'],function(_0x4cbe64){var _0x2c4bf9={};_0x2c4bf9[_0x4cbe64]={'$like':'%'+_0x8a1d41[_0x857f('0x35')]['filter']+'%'};return _0x2c4bf9;})});}_0x3e7cc1=_[_0x857f('0x42')]({},_0x3e7cc1,_0x8a1d41[_0x857f('0x43')]);return db['CmHopperHistory'][_0x857f('0x22')]({'where':_0x3e7cc1['where']})[_0x857f('0x28')](function(_0x522dff){_0x1f29e5[_0x857f('0x22')]=_0x522dff;if(_0x8a1d41[_0x857f('0x35')][_0x857f('0x44')]){_0x3e7cc1[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x62')][_0x857f('0x46')](_0x3e7cc1);})[_0x857f('0x28')](function(_0x18a010){_0x1f29e5[_0x857f('0x47')]=_0x18a010;return _0x1f29e5;});}})['then'](respondWithFilteredResult(_0x11b818,_0x3e7cc1))[_0x857f('0x48')](handleError(_0x11b818,null));};exports['getHopperFinals']=function(_0x302ee3,_0x3a2cfe,_0x4ca37f){var _0x48eace={'raw':!![],'where':{}};var _0x4d9c25={};var _0x14ba78={'count':0x0,'rows':[]};return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0x302ee3['params']['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x3a2cfe,null))['then'](function(_0x2df9b8){if(_0x2df9b8){_0x4d9c25[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x63')]['rawAttributes']);_0x4d9c25[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x302ee3['query']);_0x4d9c25[_0x857f('0x36')]=_['intersection'](_0x4d9c25[_0x857f('0x34')],_0x4d9c25[_0x857f('0x35')]);_0x48eace[_0x857f('0x38')]=_[_0x857f('0x37')](_0x4d9c25[_0x857f('0x34')],qs[_0x857f('0x4d')](_0x302ee3[_0x857f('0x35')][_0x857f('0x4d')]));_0x48eace[_0x857f('0x38')]=_0x48eace['attributes'][_0x857f('0x39')]?_0x48eace[_0x857f('0x38')]:_0x4d9c25['model'];if(!_0x302ee3[_0x857f('0x35')]['hasOwnProperty'](_0x857f('0x3a'))){_0x48eace['limit']=qs[_0x857f('0x21')](_0x302ee3['query'][_0x857f('0x21')]);_0x48eace[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x302ee3[_0x857f('0x35')][_0x857f('0x1f')]);}_0x48eace[_0x857f('0x3b')]=qs['sort'](_0x302ee3[_0x857f('0x35')]['sort']);_0x48eace[_0x857f('0x3f')]=qs[_0x857f('0x36')](_['pick'](_0x302ee3[_0x857f('0x35')],_0x4d9c25[_0x857f('0x36')]));_0x48eace[_0x857f('0x3f')]['CampaignId']=_0x2df9b8['id'];if(_0x302ee3[_0x857f('0x35')]['filter']){_0x48eace[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x48eace['where'],{'$or':_[_0x857f('0x30')](_0x48eace['attributes'],function(_0x2e349f){var _0x333b8a={};_0x333b8a[_0x2e349f]={'$like':'%'+_0x302ee3['query'][_0x857f('0x3e')]+'%'};return _0x333b8a;})});}_0x48eace=_[_0x857f('0x42')]({},_0x48eace,_0x302ee3[_0x857f('0x43')]);return db['CmHopperFinal'][_0x857f('0x22')]({'where':_0x48eace[_0x857f('0x3f')]})[_0x857f('0x28')](function(_0x1ea073){_0x14ba78['count']=_0x1ea073;if(_0x302ee3[_0x857f('0x35')][_0x857f('0x44')]){_0x48eace[_0x857f('0x45')]=[{'all':!![]}];}return db[_0x857f('0x63')][_0x857f('0x46')](_0x48eace);})['then'](function(_0x5394a9){_0x14ba78[_0x857f('0x47')]=_0x5394a9;return _0x14ba78;});}})[_0x857f('0x28')](respondWithFilteredResult(_0x3a2cfe,_0x48eace))[_0x857f('0x48')](handleError(_0x3a2cfe,null));};exports[_0x857f('0x64')]=function(_0x1ea377,_0x4f9468,_0x4b1406){var _0x3fed74={'raw':!![],'where':{}};var _0x2e43fd={};var _0x6bdaba={'count':0x0,'rows':[]};return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0x1ea377[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x4f9468,null))['then'](function(_0x32f05c){if(_0x32f05c){_0x2e43fd[_0x857f('0x34')]=_['keys'](db[_0x857f('0x65')][_0x857f('0x4c')]);_0x2e43fd[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x1ea377['query']);_0x2e43fd[_0x857f('0x36')]=_[_0x857f('0x37')](_0x2e43fd[_0x857f('0x34')],_0x2e43fd[_0x857f('0x35')]);_0x3fed74[_0x857f('0x38')]=_['intersection'](_0x2e43fd[_0x857f('0x34')],qs[_0x857f('0x4d')](_0x1ea377[_0x857f('0x35')]['fields']));_0x3fed74['attributes']=_0x3fed74[_0x857f('0x38')][_0x857f('0x39')]?_0x3fed74[_0x857f('0x38')]:_0x2e43fd[_0x857f('0x34')];if(!_0x1ea377[_0x857f('0x35')][_0x857f('0x5e')]('nolimit')){_0x3fed74['limit']=qs['limit'](_0x1ea377['query'][_0x857f('0x21')]);_0x3fed74[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x1ea377[_0x857f('0x35')][_0x857f('0x1f')]);}_0x3fed74[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x1ea377['query'][_0x857f('0x3c')]);_0x3fed74[_0x857f('0x3f')]=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0x1ea377['query'],_0x2e43fd[_0x857f('0x36')]));_0x3fed74[_0x857f('0x3f')][_0x857f('0x5f')]=_0x32f05c['id'];if(_0x1ea377[_0x857f('0x35')][_0x857f('0x3e')]){_0x3fed74[_0x857f('0x3f')]=_[_0x857f('0x42')](_0x3fed74[_0x857f('0x3f')],{'$or':_['map'](_0x3fed74[_0x857f('0x38')],function(_0x1f2333){var _0xda999={};_0xda999[_0x1f2333]={'$like':'%'+_0x1ea377['query'][_0x857f('0x3e')]+'%'};return _0xda999;})});}_0x3fed74=_[_0x857f('0x42')]({},_0x3fed74,_0x1ea377[_0x857f('0x43')]);return db[_0x857f('0x65')][_0x857f('0x22')]({'where':_0x3fed74[_0x857f('0x3f')]})[_0x857f('0x28')](function(_0x2aa819){_0x6bdaba['count']=_0x2aa819;if(_0x1ea377[_0x857f('0x35')][_0x857f('0x44')]){_0x3fed74['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3fed74);})[_0x857f('0x28')](function(_0x27290d){_0x6bdaba[_0x857f('0x47')]=_0x27290d;return _0x6bdaba;});}})['then'](respondWithFilteredResult(_0x4f9468,_0x3fed74))[_0x857f('0x48')](handleError(_0x4f9468,null));};exports['getLists']=function(_0xe4e5ef,_0x14c3ac,_0x45ce2e){var _0x19d80f={};var _0x9aadf4={};var _0x14a077;var _0x5a63b8;return db[_0x857f('0x31')][_0x857f('0x61')]({'where':{'id':_0xe4e5ef[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x14c3ac,null))[_0x857f('0x28')](function(_0x4f01ee){if(_0x4f01ee){_0x14a077=_0x4f01ee;_0x9aadf4[_0x857f('0x34')]=_['keys'](db[_0x857f('0x66')][_0x857f('0x4c')]);_0x9aadf4[_0x857f('0x35')]=_[_0x857f('0x4b')](_0xe4e5ef[_0x857f('0x35')]);_0x9aadf4[_0x857f('0x36')]=_[_0x857f('0x37')](_0x9aadf4[_0x857f('0x34')],_0x9aadf4[_0x857f('0x35')]);_0x19d80f['attributes']=_[_0x857f('0x37')](_0x9aadf4[_0x857f('0x34')],qs[_0x857f('0x4d')](_0xe4e5ef[_0x857f('0x35')][_0x857f('0x4d')]));_0x19d80f['attributes']=_0x19d80f[_0x857f('0x38')][_0x857f('0x39')]?_0x19d80f[_0x857f('0x38')]:_0x9aadf4[_0x857f('0x34')];_0x19d80f['order']=qs[_0x857f('0x3c')](_0xe4e5ef[_0x857f('0x35')][_0x857f('0x3c')]);_0x19d80f['where']=qs[_0x857f('0x36')](_[_0x857f('0x3d')](_0xe4e5ef[_0x857f('0x35')],_0x9aadf4[_0x857f('0x36')]));if(_0xe4e5ef[_0x857f('0x35')][_0x857f('0x3e')]){_0x19d80f[_0x857f('0x3f')]=_['merge'](_0x19d80f[_0x857f('0x3f')],{'$or':_[_0x857f('0x30')](_0x19d80f[_0x857f('0x38')],function(_0x27908e){var _0x5c9051={};_0x5c9051[_0x27908e]={'$like':'%'+_0xe4e5ef['query'][_0x857f('0x3e')]+'%'};return _0x5c9051;})});}_0x19d80f=_[_0x857f('0x42')]({},_0x19d80f,_0xe4e5ef[_0x857f('0x43')]);return _0x14a077[_0x857f('0x67')](_0x19d80f);}})['then'](function(_0x1606bf){if(_0x1606bf){_0x5a63b8=_0x1606bf[_0x857f('0x39')];if(!_0xe4e5ef[_0x857f('0x35')][_0x857f('0x5e')](_0x857f('0x3a'))){_0x19d80f['limit']=qs['limit'](_0xe4e5ef['query'][_0x857f('0x21')]);_0x19d80f['offset']=qs[_0x857f('0x1f')](_0xe4e5ef['query']['offset']);}return _0x14a077[_0x857f('0x67')](_0x19d80f);}})[_0x857f('0x28')](function(_0x412ab5){if(_0x412ab5){return _0x412ab5?{'count':_0x5a63b8,'rows':_0x412ab5}:null;}})[_0x857f('0x28')](respondWithResult(_0x14c3ac,null))[_0x857f('0x48')](handleError(_0x14c3ac,null));};exports[_0x857f('0x68')]=function(_0x1113bf,_0x28c2db,_0x4e40d7){var _0x6fcc36,_0x39a738;var _0x35e5a2=[];var _0x13e6ec=moment()['format'](_0x857f('0x69'));return db['Campaign'][_0x857f('0x4e')]({'where':{'id':_0x1113bf[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x28c2db,null))[_0x857f('0x28')](function(_0x4787e0){if(_0x4787e0){_0x39a738=_0x4787e0;return _0x4787e0[_0x857f('0x68')](_0x1113bf[_0x857f('0x50')][_0x857f('0x6a')],_[_0x857f('0x58')](_0x1113bf[_0x857f('0x50')],['ids','id'])||{});}return null;})['spread'](function(_0x37f001){var _0x3e146b;var _0x52f1e2;_0x6fcc36=_0x37f001||[];var _0x17a939=[];if(_0x37f001){for(var _0x570ccc=0x0;_0x570ccc<_0x37f001[_0x857f('0x39')];_0x570ccc+=0x1){var _0x41deb9=_0x37f001[_0x570ccc][_0x857f('0x29')]({'plain':!![]});_0x39a738[_0x857f('0x6b')]=_0x1113bf['body']['dialCheckDuplicateType']?_0x1113bf[_0x857f('0x50')]['dialCheckDuplicateType']:_0x39a738['dialCheckDuplicateType'];switch(_0x39a738['dialCheckDuplicateType']){case _0x857f('0x6c'):_0x3e146b=squel['insert']()[_0x857f('0x6d')](_0x857f('0x6e'))[_0x857f('0x6f')]([_0x857f('0x70'),_0x857f('0x71'),_0x857f('0x72'),_0x857f('0x73'),_0x857f('0x5f'),_0x857f('0x59'),'updatedAt'],squel['select']()[_0x857f('0x74')](_0x857f('0x70'),_0x857f('0x70'))[_0x857f('0x74')](_0x857f('0x75'),'scheduledAt')[_0x857f('0x74')]('id',_0x857f('0x72'))['field'](_0x41deb9[_0x857f('0x76')]['toString'](),_0x857f('0x73'))[_0x857f('0x74')](_0x1113bf['params']['id'][_0x857f('0x77')](),_0x857f('0x5f'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x5a'))['from']('cm_contacts')['where'](_0x857f('0x78'))[_0x857f('0x3f')](_0x857f('0x79'),_0x41deb9[_0x857f('0x76')][_0x857f('0x77')]())[_0x857f('0x3f')](_0x857f('0x7a'))['where'](_0x857f('0x7b'),squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x7d'))['from']('cm_hopper_final')[_0x857f('0x3f')](_0x857f('0x7e'),_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')]()))[_0x857f('0x3f')](_0x857f('0x7b'),squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x7f'))[_0x857f('0x80')](_0x857f('0x6e'))[_0x857f('0x3f')](_0x857f('0x7e'),_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')]())))['toString']();break;case _0x857f('0x81'):_0x3e146b=squel[_0x857f('0x82')]()[_0x857f('0x6d')]('cm_hopper')['fromQuery']([_0x857f('0x70'),_0x857f('0x71'),_0x857f('0x72'),'ListId',_0x857f('0x5f'),_0x857f('0x59'),_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')]('phone','phone')[_0x857f('0x74')]('NOW()',_0x857f('0x71'))[_0x857f('0x74')]('id','ContactId')['field'](_0x41deb9[_0x857f('0x76')]['toString'](),_0x857f('0x73'))[_0x857f('0x74')](_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')](),_0x857f('0x5f'))[_0x857f('0x74')]('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))['field']('\x27'+_0x13e6ec+'\x27','updatedAt')[_0x857f('0x80')](_0x857f('0x83'))['where'](_0x857f('0x78'))[_0x857f('0x3f')](_0x857f('0x79'),_0x41deb9[_0x857f('0x76')]['toString']())[_0x857f('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x857f('0x7b'),squel[_0x857f('0x7c')]()['field'](_0x857f('0x7f'))[_0x857f('0x80')](_0x857f('0x6e'))['where'](_0x857f('0x7e'),_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')]())))[_0x857f('0x77')]();break;default:_0x3e146b=squel[_0x857f('0x82')]()[_0x857f('0x6d')](_0x857f('0x6e'))[_0x857f('0x6f')]([_0x857f('0x70'),_0x857f('0x71'),'ContactId',_0x857f('0x73'),_0x857f('0x5f'),'createdAt',_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x70'),_0x857f('0x70'))[_0x857f('0x74')](_0x857f('0x75'),_0x857f('0x71'))['field']('id',_0x857f('0x72'))[_0x857f('0x74')](_0x41deb9[_0x857f('0x76')][_0x857f('0x77')](),_0x857f('0x73'))['field'](_0x1113bf[_0x857f('0x4a')]['id'][_0x857f('0x77')](),_0x857f('0x5f'))[_0x857f('0x74')]('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))[_0x857f('0x74')]('\x27'+_0x13e6ec+'\x27',_0x857f('0x5a'))[_0x857f('0x80')](_0x857f('0x83'))[_0x857f('0x3f')]('deletedAt\x20IS\x20NULL')[_0x857f('0x3f')](_0x857f('0x79'),_0x41deb9[_0x857f('0x76')]['toString']())['where'](_0x857f('0x7a')))[_0x857f('0x77')]();}_0x52f1e2=squel['insert']()['into'](_0x857f('0x84'))['fromQuery'](['cmHopperId',_0x857f('0x71'),_0x857f('0x70'),_0x857f('0x85'),_0x857f('0x59'),_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')]('h.id','id')['field'](_0x857f('0x75'),'scheduledAt')['field']('ci.item',_0x857f('0x70'))[_0x857f('0x74')]('ci.OrderBY',_0x857f('0x85'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x59'))['field']('\x27'+_0x13e6ec+'\x27',_0x857f('0x5a'))[_0x857f('0x80')](_0x857f('0x86'),'ci')[_0x857f('0x87')]('cm_hopper','h',_0x857f('0x88'))[_0x857f('0x3f')]('h.ListId\x20=\x20?',_0x41deb9[_0x857f('0x76')][_0x857f('0x77')]())['where'](_0x857f('0x89'),_0x1113bf['params']['id'][_0x857f('0x77')]())[_0x857f('0x3f')](_0x857f('0x8a'),_0x13e6ec))[_0x857f('0x77')]();_0x17a939['push'](db[_0x857f('0x8b')][_0x857f('0x35')](_0x3e146b));_0x35e5a2[_0x857f('0x8c')](db['sequelize'][_0x857f('0x35')](_0x52f1e2));}return BPromise['all'](_0x17a939);}})[_0x857f('0x28')](function(){return BPromise[_0x857f('0x8d')](_0x35e5a2);})['then'](function(){return _0x6fcc36;})[_0x857f('0x28')](respondWithResult(_0x28c2db,null))[_0x857f('0x48')](handleError(_0x28c2db,null));};exports['removeLists']=function(_0x24b69a,_0x2435ee,_0x59f735){return db[_0x857f('0x31')][_0x857f('0x4e')]({'where':{'id':_0x24b69a['params']['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2435ee,null))['then'](function(_0x5d2fbf){if(_0x5d2fbf){return _0x5d2fbf[_0x857f('0x8e')](_0x24b69a[_0x857f('0x35')][_0x857f('0x6a')]);}})[_0x857f('0x28')](function(_0x110cbc){if(_0x110cbc){return db[_0x857f('0x5d')][_0x857f('0x27')]({'where':{'ListId':_0x24b69a[_0x857f('0x35')][_0x857f('0x6a')],'CampaignId':_0x24b69a[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](function(){return _0x110cbc;});}})[_0x857f('0x28')](respondWithStatusCode(_0x2435ee,null))[_0x857f('0x48')](handleError(_0x2435ee,null));};exports['getBlackLists']=function(_0x5a7cb2,_0x320036,_0x31d896){var _0x12a0d3={};var _0x1b3bb3={};var _0x3269d0;var _0x4077d7;return db[_0x857f('0x31')]['findOne']({'where':{'id':_0x5a7cb2[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x320036,null))['then'](function(_0xb49bfc){if(_0xb49bfc){_0x3269d0=_0xb49bfc;_0x1b3bb3[_0x857f('0x34')]=_[_0x857f('0x4b')](db[_0x857f('0x66')][_0x857f('0x4c')]);_0x1b3bb3[_0x857f('0x35')]=_[_0x857f('0x4b')](_0x5a7cb2['query']);_0x1b3bb3[_0x857f('0x36')]=_[_0x857f('0x37')](_0x1b3bb3[_0x857f('0x34')],_0x1b3bb3[_0x857f('0x35')]);_0x12a0d3[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b3bb3['model'],qs[_0x857f('0x4d')](_0x5a7cb2['query'][_0x857f('0x4d')]));_0x12a0d3[_0x857f('0x38')]=_0x12a0d3['attributes'][_0x857f('0x39')]?_0x12a0d3['attributes']:_0x1b3bb3[_0x857f('0x34')];_0x12a0d3[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x5a7cb2['query'][_0x857f('0x3c')]);_0x12a0d3[_0x857f('0x3f')]=qs[_0x857f('0x36')](_['pick'](_0x5a7cb2['query'],_0x1b3bb3['filters']));if(_0x5a7cb2[_0x857f('0x35')]['filter']){_0x12a0d3[_0x857f('0x3f')]=_['merge'](_0x12a0d3[_0x857f('0x3f')],{'$or':_['map'](_0x12a0d3[_0x857f('0x38')],function(_0x3c6112){var _0x4bd52a={};_0x4bd52a[_0x3c6112]={'$like':'%'+_0x5a7cb2[_0x857f('0x35')]['filter']+'%'};return _0x4bd52a;})});}_0x12a0d3=_[_0x857f('0x42')]({},_0x12a0d3,_0x5a7cb2[_0x857f('0x43')]);return _0x3269d0[_0x857f('0x8f')](_0x12a0d3);}})[_0x857f('0x28')](function(_0x5488d2){if(_0x5488d2){_0x4077d7=_0x5488d2[_0x857f('0x39')];if(!_0x5a7cb2[_0x857f('0x35')][_0x857f('0x5e')](_0x857f('0x3a'))){_0x12a0d3[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x5a7cb2[_0x857f('0x35')][_0x857f('0x21')]);_0x12a0d3['offset']=qs[_0x857f('0x1f')](_0x5a7cb2[_0x857f('0x35')][_0x857f('0x1f')]);}return _0x3269d0[_0x857f('0x8f')](_0x12a0d3);}})[_0x857f('0x28')](function(_0x336a06){if(_0x336a06){return _0x336a06?{'count':_0x4077d7,'rows':_0x336a06}:null;}})[_0x857f('0x28')](respondWithResult(_0x320036,null))[_0x857f('0x48')](handleError(_0x320036,null));};exports[_0x857f('0x90')]=function(_0x586d6c,_0x24bfe0,_0x3d5215){var _0x8896bd,_0x595b48;var _0x2560d8=[];var _0x38c523=moment()[_0x857f('0x91')](_0x857f('0x69'));return db['Campaign'][_0x857f('0x4e')]({'where':{'id':_0x586d6c[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x24bfe0,null))[_0x857f('0x28')](function(_0x1eeca5){if(_0x1eeca5){_0x595b48=_0x1eeca5;return _0x1eeca5['addBlackLists'](_0x586d6c['body'][_0x857f('0x6a')],_[_0x857f('0x58')](_0x586d6c[_0x857f('0x50')],['ids','id'])||{});}return null;})[_0x857f('0x92')](function(_0x14d2e8){var _0x2d1dc1;var _0x16cbe3;_0x8896bd=_0x14d2e8||[];var _0x41e261=[];if(_0x14d2e8){for(var _0x3282b5=0x0;_0x3282b5<_0x14d2e8[_0x857f('0x39')];_0x3282b5+=0x1){var _0x3e07ad=_0x14d2e8[_0x3282b5]['get']({'plain':!![]});_0x2d1dc1=squel['insert']()['into'](_0x857f('0x93'))[_0x857f('0x6f')]([_0x857f('0x70'),_0x857f('0x72'),_0x857f('0x73'),_0x857f('0x5f'),_0x857f('0x59'),_0x857f('0x5a')],squel[_0x857f('0x7c')]()[_0x857f('0x74')](_0x857f('0x70'),_0x857f('0x70'))[_0x857f('0x74')]('id',_0x857f('0x72'))[_0x857f('0x74')](_0x3e07ad[_0x857f('0x76')][_0x857f('0x77')](),'ListId')['field'](_0x586d6c['params']['id'][_0x857f('0x77')](),'CampaignId')[_0x857f('0x74')](_0x857f('0x75'),_0x857f('0x59'))[_0x857f('0x74')]('NOW()',_0x857f('0x5a'))[_0x857f('0x80')](_0x857f('0x83'))[_0x857f('0x3f')](_0x857f('0x78'))[_0x857f('0x3f')](_0x857f('0x79'),_0x3e07ad['CmListId'][_0x857f('0x77')]())[_0x857f('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x41e261[_0x857f('0x8c')](db[_0x857f('0x8b')][_0x857f('0x35')](_0x2d1dc1));}return BPromise[_0x857f('0x8d')](_0x41e261);}})[_0x857f('0x28')](function(){return _0x8896bd;})[_0x857f('0x28')](respondWithResult(_0x24bfe0,null))[_0x857f('0x48')](handleError(_0x24bfe0,null));};exports['removeBlackLists']=function(_0x253a2b,_0x1a17af,_0x349f4f){return db['Campaign'][_0x857f('0x4e')]({'where':{'id':_0x253a2b[_0x857f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1a17af,null))[_0x857f('0x28')](function(_0x52d5bc){if(_0x52d5bc){return _0x52d5bc[_0x857f('0x94')](_0x253a2b[_0x857f('0x35')][_0x857f('0x6a')]);}})['then'](function(_0x56d04f){if(_0x56d04f){return db['CmHopperBlack'][_0x857f('0x27')]({'where':{'ListId':_0x253a2b[_0x857f('0x35')]['ids'],'CampaignId':_0x253a2b[_0x857f('0x4a')]['id']}})[_0x857f('0x28')](function(){return _0x56d04f;});}})['then'](respondWithStatusCode(_0x1a17af,null))[_0x857f('0x48')](handleError(_0x1a17af,null));}; \ No newline at end of file +var _0x409b=['insert','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','select','phone\x20IS\x20NOT\x20NULL','into','cm_hopper_additional_phones','OrderBy','h.id','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','update','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','map','Campaign','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','order','CampaignId','findAll','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always'];(function(_0x54b026,_0x17f28d){var _0x14fe1d=function(_0x2a340b){while(--_0x2a340b){_0x54b026['push'](_0x54b026['shift']());}};_0x14fe1d(++_0x17f28d);}(_0x409b,0x14a));var _0xb409=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x409b[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0xb409('0x0'));var rimraf=require(_0xb409('0x1'));var zipdir=require(_0xb409('0x2'));var jsonpatch=require(_0xb409('0x3'));var rp=require(_0xb409('0x4'));var moment=require(_0xb409('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb409('0x6'));var util=require(_0xb409('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb409('0x8'));var fs=require('fs');var fs_extra=require(_0xb409('0x9'));var _=require(_0xb409('0xa'));var squel=require(_0xb409('0xb'));var crypto=require(_0xb409('0xc'));var jsforce=require(_0xb409('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb409('0xe'));var querystring=require(_0xb409('0xf'));var Papa=require(_0xb409('0x10'));var Redis=require('ioredis');var authService=require(_0xb409('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb409('0x12'));var hardwareService=require(_0xb409('0x13'));var logger=require(_0xb409('0x14'))('api');var utils=require(_0xb409('0x15'));var config=require(_0xb409('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb409('0x17'))['db'];function respondWithStatusCode(_0x21fa25,_0x23bd15){_0x23bd15=_0x23bd15||0xcc;return function(_0x6b563c){if(_0x6b563c){return _0x21fa25[_0xb409('0x18')](_0x23bd15);}return _0x21fa25[_0xb409('0x19')](_0x23bd15)['end']();};}function respondWithResult(_0x1e6895,_0x75b07e){_0x75b07e=_0x75b07e||0xc8;return function(_0x128035){if(_0x128035){return _0x1e6895[_0xb409('0x19')](_0x75b07e)[_0xb409('0x1a')](_0x128035);}};}function respondWithFilteredResult(_0x4f596b,_0xd19d17){return function(_0x58bb54){if(_0x58bb54){var _0x32c205=typeof _0xd19d17[_0xb409('0x1b')]===_0xb409('0x1c')&&typeof _0xd19d17[_0xb409('0x1d')]===_0xb409('0x1c');var _0x3975d0=_0x58bb54[_0xb409('0x1e')];var _0x12b1de=_0x32c205?0x0:_0xd19d17[_0xb409('0x1b')];var _0xf4a437=_0x32c205?_0x58bb54[_0xb409('0x1e')]:_0xd19d17[_0xb409('0x1b')]+_0xd19d17[_0xb409('0x1d')];var _0x1dd011;if(_0xf4a437>=_0x3975d0){_0xf4a437=_0x3975d0;_0x1dd011=0xc8;}else{_0x1dd011=0xce;}_0x4f596b[_0xb409('0x19')](_0x1dd011);return _0x4f596b['set']('Content-Range',_0x12b1de+'-'+_0xf4a437+'/'+_0x3975d0)[_0xb409('0x1a')](_0x58bb54);}return null;};}function patchUpdates(_0x24af7d){return function(_0x22d9ed){try{jsonpatch['apply'](_0x22d9ed,_0x24af7d,!![]);}catch(_0x4df44e){return BPromise['reject'](_0x4df44e);}return _0x22d9ed['save']();};}function saveUpdates(_0x443563,_0x437d9f){return function(_0x406324){if(_0x406324){return _0x406324[_0xb409('0x1f')](_0x443563)[_0xb409('0x20')](function(_0x17a506){return _0x17a506;});}return null;};}function removeEntity(_0x3b629f,_0x12789d){return function(_0x45979e){if(_0x45979e){return _0x45979e[_0xb409('0x21')]()[_0xb409('0x20')](function(){var _0x22c2ac=_0x45979e['get']({'plain':!![]});var _0x306511=_0xb409('0x22');return db[_0xb409('0x23')]['destroy']({'where':{'type':_0x306511,'resourceId':_0x22c2ac['id']}})['then'](function(){return _0x45979e;});})[_0xb409('0x20')](function(){_0x3b629f[_0xb409('0x19')](0xcc)[_0xb409('0x24')]();});}};}function handleEntityNotFound(_0x45c1b1,_0x169929){return function(_0x365233){if(!_0x365233){_0x45c1b1[_0xb409('0x18')](0x194);}return _0x365233;};}function handleError(_0x3439ce,_0x51000f){_0x51000f=_0x51000f||0x1f4;return function(_0x5343b8){logger[_0xb409('0x25')](_0x5343b8[_0xb409('0x26')]);if(_0x5343b8[_0xb409('0x27')]){delete _0x5343b8['name'];}_0x3439ce[_0xb409('0x19')](_0x51000f)[_0xb409('0x28')](_0x5343b8);};}exports[_0xb409('0x29')]=function(_0x78e448,_0x3b403a){var _0x454ff8={},_0x104469={},_0x3a60e3={'count':0x0,'rows':[]};var _0x1c3f9a=_[_0xb409('0x2a')](db[_0xb409('0x2b')]['rawAttributes'],function(_0x350b92){return{'name':_0x350b92['fieldName'],'type':_0x350b92[_0xb409('0x2c')][_0xb409('0x2d')]};});_0x104469[_0xb409('0x2e')]=_[_0xb409('0x2a')](_0x1c3f9a,_0xb409('0x27'));_0x104469['query']=_[_0xb409('0x2f')](_0x78e448[_0xb409('0x30')]);_0x104469[_0xb409('0x31')]=_[_0xb409('0x32')](_0x104469[_0xb409('0x2e')],_0x104469[_0xb409('0x30')]);_0x454ff8[_0xb409('0x33')]=_[_0xb409('0x32')](_0x104469['model'],qs['fields'](_0x78e448[_0xb409('0x30')][_0xb409('0x34')]));_0x454ff8['attributes']=_0x454ff8[_0xb409('0x33')][_0xb409('0x35')]?_0x454ff8[_0xb409('0x33')]:_0x104469[_0xb409('0x2e')];if(!_0x78e448[_0xb409('0x30')][_0xb409('0x36')](_0xb409('0x37'))){_0x454ff8[_0xb409('0x1d')]=qs['limit'](_0x78e448[_0xb409('0x30')]['limit']);_0x454ff8[_0xb409('0x1b')]=qs[_0xb409('0x1b')](_0x78e448[_0xb409('0x30')][_0xb409('0x1b')]);}_0x454ff8['order']=qs[_0xb409('0x38')](_0x78e448[_0xb409('0x30')][_0xb409('0x38')]);_0x454ff8[_0xb409('0x39')]=qs[_0xb409('0x31')](_[_0xb409('0x3a')](_0x78e448[_0xb409('0x30')],_0x104469[_0xb409('0x31')]),_0x1c3f9a);if(_0x78e448[_0xb409('0x30')]['filter']){_0x454ff8[_0xb409('0x39')]=_[_0xb409('0x3b')](_0x454ff8[_0xb409('0x39')],{'$or':_[_0xb409('0x2a')](_0x1c3f9a,function(_0x134ced){if(_0x134ced[_0xb409('0x2c')]!==_0xb409('0x3c')){var _0x506f4e={};_0x506f4e[_0x134ced[_0xb409('0x27')]]={'$like':'%'+_0x78e448[_0xb409('0x30')][_0xb409('0x3d')]+'%'};return _0x506f4e;}})});}_0x454ff8=_[_0xb409('0x3b')]({},_0x454ff8,_0x78e448[_0xb409('0x3e')]);var _0x558dbc={'where':_0x454ff8[_0xb409('0x39')]};return db[_0xb409('0x2b')]['count'](_0x558dbc)['then'](function(_0x33d3a6){_0x3a60e3[_0xb409('0x1e')]=_0x33d3a6;if(_0x78e448[_0xb409('0x30')][_0xb409('0x3f')]){_0x454ff8[_0xb409('0x40')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x454ff8);})[_0xb409('0x20')](function(_0x17e804){_0x3a60e3['rows']=_0x17e804;return _0x3a60e3;})[_0xb409('0x20')](respondWithFilteredResult(_0x3b403a,_0x454ff8))[_0xb409('0x41')](handleError(_0x3b403a,null));};exports[_0xb409('0x42')]=function(_0x1fb07d,_0x92a4ed){var _0x17476e={'raw':![],'where':{'id':_0x1fb07d[_0xb409('0x43')]['id']}},_0xb2cf52={};_0xb2cf52['model']=_[_0xb409('0x2f')](db[_0xb409('0x2b')][_0xb409('0x44')]);_0xb2cf52[_0xb409('0x30')]=_['keys'](_0x1fb07d[_0xb409('0x30')]);_0xb2cf52[_0xb409('0x31')]=_[_0xb409('0x32')](_0xb2cf52[_0xb409('0x2e')],_0xb2cf52[_0xb409('0x30')]);_0x17476e[_0xb409('0x33')]=_['intersection'](_0xb2cf52[_0xb409('0x2e')],qs['fields'](_0x1fb07d[_0xb409('0x30')][_0xb409('0x34')]));_0x17476e[_0xb409('0x33')]=_0x17476e['attributes'][_0xb409('0x35')]?_0x17476e[_0xb409('0x33')]:_0xb2cf52['model'];if(_0x1fb07d[_0xb409('0x30')]['includeAll']){_0x17476e[_0xb409('0x40')]=[{'all':!![]}];}_0x17476e=_[_0xb409('0x3b')]({},_0x17476e,_0x1fb07d[_0xb409('0x3e')]);return db[_0xb409('0x2b')][_0xb409('0x45')](_0x17476e)[_0xb409('0x20')](handleEntityNotFound(_0x92a4ed,null))['then'](respondWithResult(_0x92a4ed,null))['catch'](handleError(_0x92a4ed,null));};exports[_0xb409('0x46')]=function(_0x7f59a6,_0x541c95){return db[_0xb409('0x2b')]['create'](_0x7f59a6['body'],{})[_0xb409('0x20')](function(_0xbefbd9){var _0x217d34=_0x7f59a6[_0xb409('0x47')]['get']({'plain':!![]});if(!_0x217d34)throw new Error(_0xb409('0x48'));if(_0x217d34[_0xb409('0x49')]===_0xb409('0x47')){var _0x6c49=_0xbefbd9[_0xb409('0x4a')]({'plain':!![]});var _0x3dd13b=_0xb409('0x22');return db[_0xb409('0x4b')][_0xb409('0x45')]({'where':{'name':_0x3dd13b,'userProfileId':_0x217d34[_0xb409('0x4c')]},'raw':!![]})['then'](function(_0x3940d5){if(_0x3940d5&&_0x3940d5[_0xb409('0x4d')]===0x0){return db[_0xb409('0x23')][_0xb409('0x46')]({'name':_0x6c49['name'],'resourceId':_0x6c49['id'],'type':_0x3940d5['name'],'sectionId':_0x3940d5['id']},{})[_0xb409('0x20')](function(){return _0xbefbd9;});}else{return _0xbefbd9;}})[_0xb409('0x41')](function(_0x56036d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56036d);throw _0x56036d;});}return _0xbefbd9;})['then'](respondWithResult(_0x541c95,0xc9))['catch'](handleError(_0x541c95,null));};exports[_0xb409('0x4e')]=function(_0x148176,_0x5bea07){var _0x404278={'where':{'id':_0x148176[_0xb409('0x43')]['id']}},_0x22d537={};_0x22d537['model']=_[_0xb409('0x2f')](db[_0xb409('0x2b')][_0xb409('0x44')]);_0x404278[_0xb409('0x33')]=_[_0xb409('0x32')](_0x22d537['model'],qs[_0xb409('0x34')](_0x148176[_0xb409('0x30')][_0xb409('0x34')]));_0x404278[_0xb409('0x33')]=_0x404278['attributes'][_0xb409('0x35')]?_0x404278[_0xb409('0x33')]:_0x22d537[_0xb409('0x2e')];if(_0x148176[_0xb409('0x30')][_0xb409('0x3f')]){_0x404278[_0xb409('0x40')]=[{'all':!![]}];}_0x404278=_['merge']({},_0x404278,_0x148176['options']);return db['Campaign'][_0xb409('0x45')](_0x404278)[_0xb409('0x20')](handleEntityNotFound(_0x5bea07,null))[_0xb409('0x20')](function(_0x39712b){if(_0x39712b){var _0x265f7c=_0x39712b[_0xb409('0x4a')]({'plain':!![]});_0x265f7c=qs[_0xb409('0x4f')](_0x265f7c,['id',_0xb409('0x50'),_0xb409('0x51')]);_0x148176['body']=_[_0xb409('0x4f')](_0x148176[_0xb409('0x52')],['id',_0xb409('0x50'),'updatedAt']);return db[_0xb409('0x2b')][_0xb409('0x46')](_[_0xb409('0x3b')](_0x265f7c,_0x148176[_0xb409('0x52')]),{'include':_0x148176[_0xb409('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0xb409('0x20')](function(_0x5cf9ec){var _0x514542=_0x148176[_0xb409('0x47')]['get']({'plain':!![]});if(!_0x514542)throw new Error(_0xb409('0x48'));if(_0x514542[_0xb409('0x49')]===_0xb409('0x47')){var _0x2ca6b3=_0x5cf9ec[_0xb409('0x4a')]({'plain':!![]});var _0x416ff6=_0xb409('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x416ff6,'userProfileId':_0x514542[_0xb409('0x4c')]},'raw':!![]})['then'](function(_0x56fdde){if(_0x56fdde&&_0x56fdde['autoAssociation']===0x0){return db[_0xb409('0x23')][_0xb409('0x46')]({'name':_0x2ca6b3[_0xb409('0x27')],'resourceId':_0x2ca6b3['id'],'type':_0x56fdde[_0xb409('0x27')],'sectionId':_0x56fdde['id']},{})['then'](function(){return _0x5cf9ec;});}else{return _0x5cf9ec;}})[_0xb409('0x41')](function(_0x2a21a2){logger[_0xb409('0x25')](_0xb409('0x53'),_0x2a21a2);throw _0x2a21a2;});}return _0x5cf9ec;});}})['then'](respondWithResult(_0x5bea07,0xc9))['catch'](handleError(_0x5bea07,null));};exports[_0xb409('0x1f')]=function(_0x354bfb,_0x4fe681){if(_0x354bfb[_0xb409('0x52')]['id']){delete _0x354bfb[_0xb409('0x52')]['id'];}return db[_0xb409('0x2b')]['find']({'where':{'id':_0x354bfb['params']['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x4fe681,null))[_0xb409('0x20')](saveUpdates(_0x354bfb[_0xb409('0x52')],null))['then'](respondWithResult(_0x4fe681,null))['catch'](handleError(_0x4fe681,null));};exports[_0xb409('0x21')]=function(_0x3cdebb,_0x246a15){return db[_0xb409('0x2b')][_0xb409('0x45')]({'where':{'id':_0x3cdebb['params']['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x246a15,null))[_0xb409('0x20')](removeEntity(_0x246a15,null))[_0xb409('0x41')](handleError(_0x246a15,null));};exports[_0xb409('0x54')]=function(_0x5f056e,_0x39cb6c,_0x30d3e3){var _0x2a00fb={'raw':!![],'where':{}};var _0x1c3e1f={};var _0x4532ab={'count':0x0,'rows':[]};return db['Campaign'][_0xb409('0x55')]({'where':{'id':_0x5f056e['params']['id']}})['then'](handleEntityNotFound(_0x39cb6c,null))[_0xb409('0x20')](function(_0x6c0ca4){if(_0x6c0ca4){_0x1c3e1f[_0xb409('0x2e')]=_['keys'](db[_0xb409('0x56')]['rawAttributes']);_0x1c3e1f[_0xb409('0x30')]=_[_0xb409('0x2f')](_0x5f056e[_0xb409('0x30')]);_0x1c3e1f[_0xb409('0x31')]=_[_0xb409('0x32')](_0x1c3e1f[_0xb409('0x2e')],_0x1c3e1f[_0xb409('0x30')]);_0x2a00fb[_0xb409('0x33')]=_[_0xb409('0x32')](_0x1c3e1f[_0xb409('0x2e')],qs[_0xb409('0x34')](_0x5f056e['query'][_0xb409('0x34')]));_0x2a00fb[_0xb409('0x33')]=_0x2a00fb[_0xb409('0x33')]['length']?_0x2a00fb['attributes']:_0x1c3e1f[_0xb409('0x2e')];if(!_0x5f056e[_0xb409('0x30')][_0xb409('0x36')](_0xb409('0x37'))){_0x2a00fb[_0xb409('0x1d')]=qs[_0xb409('0x1d')](_0x5f056e[_0xb409('0x30')][_0xb409('0x1d')]);_0x2a00fb[_0xb409('0x1b')]=qs['offset'](_0x5f056e['query']['offset']);}_0x2a00fb[_0xb409('0x57')]=qs[_0xb409('0x38')](_0x5f056e[_0xb409('0x30')][_0xb409('0x38')]);_0x2a00fb[_0xb409('0x39')]=qs[_0xb409('0x31')](_[_0xb409('0x3a')](_0x5f056e[_0xb409('0x30')],_0x1c3e1f[_0xb409('0x31')]));_0x2a00fb[_0xb409('0x39')][_0xb409('0x58')]=_0x6c0ca4['id'];if(_0x5f056e[_0xb409('0x30')][_0xb409('0x3d')]){_0x2a00fb[_0xb409('0x39')]=_['merge'](_0x2a00fb[_0xb409('0x39')],{'$or':_[_0xb409('0x2a')](_0x2a00fb[_0xb409('0x33')],function(_0x233444){var _0x3334a6={};_0x3334a6[_0x233444]={'$like':'%'+_0x5f056e[_0xb409('0x30')]['filter']+'%'};return _0x3334a6;})});}_0x2a00fb=_['merge']({},_0x2a00fb,_0x5f056e[_0xb409('0x3e')]);return db[_0xb409('0x56')]['count']({'where':_0x2a00fb[_0xb409('0x39')]})[_0xb409('0x20')](function(_0x2884f4){_0x4532ab[_0xb409('0x1e')]=_0x2884f4;if(_0x5f056e[_0xb409('0x30')][_0xb409('0x3f')]){_0x2a00fb[_0xb409('0x40')]=[{'all':!![]}];}return db[_0xb409('0x56')][_0xb409('0x59')](_0x2a00fb);})[_0xb409('0x20')](function(_0x2ddad3){_0x4532ab[_0xb409('0x5a')]=_0x2ddad3;return _0x4532ab;});}})['then'](respondWithFilteredResult(_0x39cb6c,_0x2a00fb))[_0xb409('0x41')](handleError(_0x39cb6c,null));};exports['getHopperHistories']=function(_0x56cbad,_0x273a8b,_0x1fe092){var _0xb84e5a={'raw':!![],'where':{}};var _0x337dd2={};var _0x5e2ecd={'count':0x0,'rows':[]};return db['Campaign'][_0xb409('0x55')]({'where':{'id':_0x56cbad[_0xb409('0x43')]['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x273a8b,null))[_0xb409('0x20')](function(_0x3d5dfa){if(_0x3d5dfa){_0x337dd2[_0xb409('0x2e')]=_['keys'](db[_0xb409('0x5b')][_0xb409('0x44')]);_0x337dd2[_0xb409('0x30')]=_['keys'](_0x56cbad[_0xb409('0x30')]);_0x337dd2[_0xb409('0x31')]=_[_0xb409('0x32')](_0x337dd2[_0xb409('0x2e')],_0x337dd2[_0xb409('0x30')]);_0xb84e5a[_0xb409('0x33')]=_[_0xb409('0x32')](_0x337dd2[_0xb409('0x2e')],qs['fields'](_0x56cbad['query'][_0xb409('0x34')]));_0xb84e5a[_0xb409('0x33')]=_0xb84e5a[_0xb409('0x33')][_0xb409('0x35')]?_0xb84e5a[_0xb409('0x33')]:_0x337dd2[_0xb409('0x2e')];if(!_0x56cbad[_0xb409('0x30')][_0xb409('0x36')]('nolimit')){_0xb84e5a['limit']=qs[_0xb409('0x1d')](_0x56cbad['query'][_0xb409('0x1d')]);_0xb84e5a['offset']=qs[_0xb409('0x1b')](_0x56cbad[_0xb409('0x30')][_0xb409('0x1b')]);}_0xb84e5a[_0xb409('0x57')]=qs[_0xb409('0x38')](_0x56cbad[_0xb409('0x30')][_0xb409('0x38')]);_0xb84e5a['where']=qs['filters'](_['pick'](_0x56cbad[_0xb409('0x30')],_0x337dd2[_0xb409('0x31')]));_0xb84e5a[_0xb409('0x39')]['CampaignId']=_0x3d5dfa['id'];if(_0x56cbad[_0xb409('0x30')][_0xb409('0x3d')]){_0xb84e5a[_0xb409('0x39')]=_[_0xb409('0x3b')](_0xb84e5a[_0xb409('0x39')],{'$or':_[_0xb409('0x2a')](_0xb84e5a[_0xb409('0x33')],function(_0x412d31){var _0x1ea7e4={};_0x1ea7e4[_0x412d31]={'$like':'%'+_0x56cbad[_0xb409('0x30')][_0xb409('0x3d')]+'%'};return _0x1ea7e4;})});}_0xb84e5a=_[_0xb409('0x3b')]({},_0xb84e5a,_0x56cbad[_0xb409('0x3e')]);return db['CmHopperHistory'][_0xb409('0x1e')]({'where':_0xb84e5a[_0xb409('0x39')]})[_0xb409('0x20')](function(_0x4059e2){_0x5e2ecd['count']=_0x4059e2;if(_0x56cbad['query'][_0xb409('0x3f')]){_0xb84e5a[_0xb409('0x40')]=[{'all':!![]}];}return db[_0xb409('0x5b')][_0xb409('0x59')](_0xb84e5a);})[_0xb409('0x20')](function(_0x74febb){_0x5e2ecd['rows']=_0x74febb;return _0x5e2ecd;});}})[_0xb409('0x20')](respondWithFilteredResult(_0x273a8b,_0xb84e5a))[_0xb409('0x41')](handleError(_0x273a8b,null));};exports[_0xb409('0x5c')]=function(_0x431adc,_0x1adaeb,_0x36d847){var _0x97b9a0={'raw':!![],'where':{}};var _0x498f68={};var _0x28caf4={'count':0x0,'rows':[]};return db[_0xb409('0x2b')]['findOne']({'where':{'id':_0x431adc['params']['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x1adaeb,null))['then'](function(_0x144e28){if(_0x144e28){_0x498f68[_0xb409('0x2e')]=_['keys'](db['CmHopperFinal'][_0xb409('0x44')]);_0x498f68[_0xb409('0x30')]=_[_0xb409('0x2f')](_0x431adc[_0xb409('0x30')]);_0x498f68[_0xb409('0x31')]=_['intersection'](_0x498f68[_0xb409('0x2e')],_0x498f68[_0xb409('0x30')]);_0x97b9a0[_0xb409('0x33')]=_[_0xb409('0x32')](_0x498f68[_0xb409('0x2e')],qs[_0xb409('0x34')](_0x431adc[_0xb409('0x30')][_0xb409('0x34')]));_0x97b9a0[_0xb409('0x33')]=_0x97b9a0[_0xb409('0x33')][_0xb409('0x35')]?_0x97b9a0['attributes']:_0x498f68[_0xb409('0x2e')];if(!_0x431adc['query'][_0xb409('0x36')](_0xb409('0x37'))){_0x97b9a0[_0xb409('0x1d')]=qs['limit'](_0x431adc[_0xb409('0x30')][_0xb409('0x1d')]);_0x97b9a0[_0xb409('0x1b')]=qs[_0xb409('0x1b')](_0x431adc[_0xb409('0x30')][_0xb409('0x1b')]);}_0x97b9a0[_0xb409('0x57')]=qs[_0xb409('0x38')](_0x431adc[_0xb409('0x30')][_0xb409('0x38')]);_0x97b9a0['where']=qs[_0xb409('0x31')](_[_0xb409('0x3a')](_0x431adc[_0xb409('0x30')],_0x498f68['filters']));_0x97b9a0[_0xb409('0x39')]['CampaignId']=_0x144e28['id'];if(_0x431adc[_0xb409('0x30')][_0xb409('0x3d')]){_0x97b9a0[_0xb409('0x39')]=_[_0xb409('0x3b')](_0x97b9a0[_0xb409('0x39')],{'$or':_[_0xb409('0x2a')](_0x97b9a0[_0xb409('0x33')],function(_0x17e286){var _0x311720={};_0x311720[_0x17e286]={'$like':'%'+_0x431adc[_0xb409('0x30')]['filter']+'%'};return _0x311720;})});}_0x97b9a0=_['merge']({},_0x97b9a0,_0x431adc['options']);return db[_0xb409('0x5d')][_0xb409('0x1e')]({'where':_0x97b9a0['where']})[_0xb409('0x20')](function(_0x2d48c9){_0x28caf4['count']=_0x2d48c9;if(_0x431adc[_0xb409('0x30')][_0xb409('0x3f')]){_0x97b9a0[_0xb409('0x40')]=[{'all':!![]}];}return db[_0xb409('0x5d')][_0xb409('0x59')](_0x97b9a0);})['then'](function(_0x1e604e){_0x28caf4[_0xb409('0x5a')]=_0x1e604e;return _0x28caf4;});}})[_0xb409('0x20')](respondWithFilteredResult(_0x1adaeb,_0x97b9a0))['catch'](handleError(_0x1adaeb,null));};exports[_0xb409('0x5e')]=function(_0x5a12a8,_0x15a145,_0x3a6a4a){var _0x282ca6={'raw':!![],'where':{}};var _0x5f2791={};var _0x521179={'count':0x0,'rows':[]};return db[_0xb409('0x2b')][_0xb409('0x55')]({'where':{'id':_0x5a12a8[_0xb409('0x43')]['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x15a145,null))[_0xb409('0x20')](function(_0x4d76f2){if(_0x4d76f2){_0x5f2791[_0xb409('0x2e')]=_[_0xb409('0x2f')](db[_0xb409('0x5f')][_0xb409('0x44')]);_0x5f2791[_0xb409('0x30')]=_[_0xb409('0x2f')](_0x5a12a8['query']);_0x5f2791[_0xb409('0x31')]=_[_0xb409('0x32')](_0x5f2791['model'],_0x5f2791[_0xb409('0x30')]);_0x282ca6[_0xb409('0x33')]=_[_0xb409('0x32')](_0x5f2791[_0xb409('0x2e')],qs[_0xb409('0x34')](_0x5a12a8[_0xb409('0x30')][_0xb409('0x34')]));_0x282ca6['attributes']=_0x282ca6[_0xb409('0x33')][_0xb409('0x35')]?_0x282ca6[_0xb409('0x33')]:_0x5f2791['model'];if(!_0x5a12a8[_0xb409('0x30')][_0xb409('0x36')](_0xb409('0x37'))){_0x282ca6['limit']=qs[_0xb409('0x1d')](_0x5a12a8[_0xb409('0x30')]['limit']);_0x282ca6[_0xb409('0x1b')]=qs[_0xb409('0x1b')](_0x5a12a8[_0xb409('0x30')][_0xb409('0x1b')]);}_0x282ca6[_0xb409('0x57')]=qs[_0xb409('0x38')](_0x5a12a8[_0xb409('0x30')][_0xb409('0x38')]);_0x282ca6['where']=qs[_0xb409('0x31')](_[_0xb409('0x3a')](_0x5a12a8['query'],_0x5f2791['filters']));_0x282ca6[_0xb409('0x39')][_0xb409('0x58')]=_0x4d76f2['id'];if(_0x5a12a8[_0xb409('0x30')][_0xb409('0x3d')]){_0x282ca6[_0xb409('0x39')]=_[_0xb409('0x3b')](_0x282ca6[_0xb409('0x39')],{'$or':_[_0xb409('0x2a')](_0x282ca6[_0xb409('0x33')],function(_0x1c644a){var _0x3ca917={};_0x3ca917[_0x1c644a]={'$like':'%'+_0x5a12a8['query'][_0xb409('0x3d')]+'%'};return _0x3ca917;})});}_0x282ca6=_['merge']({},_0x282ca6,_0x5a12a8[_0xb409('0x3e')]);return db['CmHopperBlack'][_0xb409('0x1e')]({'where':_0x282ca6[_0xb409('0x39')]})[_0xb409('0x20')](function(_0x3a6fa9){_0x521179[_0xb409('0x1e')]=_0x3a6fa9;if(_0x5a12a8[_0xb409('0x30')][_0xb409('0x3f')]){_0x282ca6[_0xb409('0x40')]=[{'all':!![]}];}return db[_0xb409('0x5f')][_0xb409('0x59')](_0x282ca6);})[_0xb409('0x20')](function(_0x5c0903){_0x521179[_0xb409('0x5a')]=_0x5c0903;return _0x521179;});}})['then'](respondWithFilteredResult(_0x15a145,_0x282ca6))[_0xb409('0x41')](handleError(_0x15a145,null));};exports['getLists']=function(_0x43fa2b,_0x58319e,_0x25ffc2){var _0xac6978={};var _0x3e59a5={};var _0x1caa62;var _0x2ccd97;return db[_0xb409('0x2b')]['findOne']({'where':{'id':_0x43fa2b[_0xb409('0x43')]['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x58319e,null))['then'](function(_0x1af501){if(_0x1af501){_0x1caa62=_0x1af501;_0x3e59a5[_0xb409('0x2e')]=_[_0xb409('0x2f')](db[_0xb409('0x60')]['rawAttributes']);_0x3e59a5[_0xb409('0x30')]=_[_0xb409('0x2f')](_0x43fa2b[_0xb409('0x30')]);_0x3e59a5[_0xb409('0x31')]=_[_0xb409('0x32')](_0x3e59a5['model'],_0x3e59a5[_0xb409('0x30')]);_0xac6978[_0xb409('0x33')]=_[_0xb409('0x32')](_0x3e59a5['model'],qs[_0xb409('0x34')](_0x43fa2b['query'][_0xb409('0x34')]));_0xac6978[_0xb409('0x33')]=_0xac6978[_0xb409('0x33')]['length']?_0xac6978[_0xb409('0x33')]:_0x3e59a5[_0xb409('0x2e')];_0xac6978[_0xb409('0x57')]=qs[_0xb409('0x38')](_0x43fa2b[_0xb409('0x30')][_0xb409('0x38')]);_0xac6978[_0xb409('0x39')]=qs[_0xb409('0x31')](_[_0xb409('0x3a')](_0x43fa2b[_0xb409('0x30')],_0x3e59a5['filters']));if(_0x43fa2b[_0xb409('0x30')]['filter']){_0xac6978['where']=_['merge'](_0xac6978['where'],{'$or':_[_0xb409('0x2a')](_0xac6978[_0xb409('0x33')],function(_0x22bdd9){var _0x15515f={};_0x15515f[_0x22bdd9]={'$like':'%'+_0x43fa2b['query'][_0xb409('0x3d')]+'%'};return _0x15515f;})});}_0xac6978=_['merge']({},_0xac6978,_0x43fa2b[_0xb409('0x3e')]);return _0x1caa62[_0xb409('0x61')](_0xac6978);}})[_0xb409('0x20')](function(_0x5d2123){if(_0x5d2123){_0x2ccd97=_0x5d2123[_0xb409('0x35')];if(!_0x43fa2b['query'][_0xb409('0x36')](_0xb409('0x37'))){_0xac6978['limit']=qs['limit'](_0x43fa2b[_0xb409('0x30')][_0xb409('0x1d')]);_0xac6978['offset']=qs['offset'](_0x43fa2b[_0xb409('0x30')]['offset']);}return _0x1caa62[_0xb409('0x61')](_0xac6978);}})[_0xb409('0x20')](function(_0x2dfeb0){if(_0x2dfeb0){return _0x2dfeb0?{'count':_0x2ccd97,'rows':_0x2dfeb0}:null;}})[_0xb409('0x20')](respondWithResult(_0x58319e,null))['catch'](handleError(_0x58319e,null));};exports[_0xb409('0x62')]=function(_0x3b4733,_0xe2750,_0x1708f7){var _0x40b4d5,_0x565de1;var _0x1e9853=[];var _0x2e7cd3=moment()[_0xb409('0x63')](_0xb409('0x64'));return db[_0xb409('0x2b')][_0xb409('0x45')]({'where':{'id':_0x3b4733[_0xb409('0x43')]['id']}})[_0xb409('0x20')](handleEntityNotFound(_0xe2750,null))[_0xb409('0x20')](function(_0x1134f9){if(_0x1134f9){_0x565de1=_0x1134f9;return _0x1134f9[_0xb409('0x62')](_0x3b4733['body'][_0xb409('0x65')],_['omit'](_0x3b4733[_0xb409('0x52')],['ids','id'])||{});}return null;})[_0xb409('0x66')](function(_0x1db146){var _0x14091b;var _0x39cdaf;_0x40b4d5=_0x1db146||[];var _0x4a260b=[];if(_0x1db146){for(var _0xd8720f=0x0;_0xd8720f<_0x1db146[_0xb409('0x35')];_0xd8720f+=0x1){var _0x1d8d1d=_0x1db146[_0xd8720f][_0xb409('0x4a')]({'plain':!![]});_0x565de1[_0xb409('0x67')]=_0x3b4733['body']['dialCheckDuplicateType']?_0x3b4733[_0xb409('0x52')][_0xb409('0x67')]:_0x565de1[_0xb409('0x67')];switch(_0x565de1['dialCheckDuplicateType']){case _0xb409('0x68'):_0x14091b=squel[_0xb409('0x69')]()['into'](_0xb409('0x6a'))[_0xb409('0x6b')]([_0xb409('0x6c'),'scheduledAt',_0xb409('0x6d'),_0xb409('0x6e'),_0xb409('0x58'),_0xb409('0x50'),'updatedAt'],squel['select']()[_0xb409('0x6f')]('phone','phone')[_0xb409('0x6f')](_0xb409('0x70'),'scheduledAt')[_0xb409('0x6f')]('id',_0xb409('0x6d'))[_0xb409('0x6f')](_0x1d8d1d[_0xb409('0x71')][_0xb409('0x72')](),'ListId')[_0xb409('0x6f')](_0x3b4733['params']['id'][_0xb409('0x72')](),_0xb409('0x58'))['field']('\x27'+_0x2e7cd3+'\x27',_0xb409('0x50'))[_0xb409('0x6f')]('\x27'+_0x2e7cd3+'\x27',_0xb409('0x51'))[_0xb409('0x73')](_0xb409('0x74'))[_0xb409('0x39')](_0xb409('0x75'))[_0xb409('0x39')](_0xb409('0x76'),_0x1d8d1d[_0xb409('0x71')]['toString']())[_0xb409('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0xb409('0x39')](_0xb409('0x77'),squel['select']()[_0xb409('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xb409('0x73')](_0xb409('0x78'))[_0xb409('0x39')](_0xb409('0x79'),_0x3b4733['params']['id'][_0xb409('0x72')]()))[_0xb409('0x39')](_0xb409('0x77'),squel['select']()[_0xb409('0x6f')](_0xb409('0x7a'))[_0xb409('0x73')](_0xb409('0x6a'))['where']('CampaignId\x20=\x20?',_0x3b4733[_0xb409('0x43')]['id']['toString']())))['toString']();break;case _0xb409('0x7b'):_0x14091b=squel[_0xb409('0x69')]()['into'](_0xb409('0x6a'))[_0xb409('0x6b')]([_0xb409('0x6c'),_0xb409('0x7c'),_0xb409('0x6d'),'ListId','CampaignId',_0xb409('0x50'),_0xb409('0x51')],squel[_0xb409('0x7d')]()[_0xb409('0x6f')](_0xb409('0x6c'),'phone')['field'](_0xb409('0x70'),_0xb409('0x7c'))['field']('id',_0xb409('0x6d'))[_0xb409('0x6f')](_0x1d8d1d[_0xb409('0x71')][_0xb409('0x72')](),_0xb409('0x6e'))[_0xb409('0x6f')](_0x3b4733[_0xb409('0x43')]['id'][_0xb409('0x72')](),'CampaignId')[_0xb409('0x6f')]('\x27'+_0x2e7cd3+'\x27',_0xb409('0x50'))[_0xb409('0x6f')]('\x27'+_0x2e7cd3+'\x27',_0xb409('0x51'))[_0xb409('0x73')](_0xb409('0x74'))[_0xb409('0x39')](_0xb409('0x75'))['where'](_0xb409('0x76'),_0x1d8d1d[_0xb409('0x71')][_0xb409('0x72')]())[_0xb409('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0xb409('0x39')](_0xb409('0x77'),squel[_0xb409('0x7d')]()[_0xb409('0x6f')](_0xb409('0x7a'))[_0xb409('0x73')]('cm_hopper')[_0xb409('0x39')](_0xb409('0x79'),_0x3b4733[_0xb409('0x43')]['id'][_0xb409('0x72')]())))[_0xb409('0x72')]();break;default:_0x14091b=squel[_0xb409('0x69')]()['into']('cm_hopper')[_0xb409('0x6b')]([_0xb409('0x6c'),'scheduledAt',_0xb409('0x6d'),_0xb409('0x6e'),_0xb409('0x58'),_0xb409('0x50'),_0xb409('0x51')],squel[_0xb409('0x7d')]()[_0xb409('0x6f')]('phone',_0xb409('0x6c'))[_0xb409('0x6f')]('NOW()',_0xb409('0x7c'))[_0xb409('0x6f')]('id',_0xb409('0x6d'))[_0xb409('0x6f')](_0x1d8d1d['CmListId'][_0xb409('0x72')](),'ListId')[_0xb409('0x6f')](_0x3b4733['params']['id'][_0xb409('0x72')](),_0xb409('0x58'))['field']('\x27'+_0x2e7cd3+'\x27','createdAt')[_0xb409('0x6f')]('\x27'+_0x2e7cd3+'\x27','updatedAt')[_0xb409('0x73')](_0xb409('0x74'))[_0xb409('0x39')](_0xb409('0x75'))[_0xb409('0x39')](_0xb409('0x76'),_0x1d8d1d[_0xb409('0x71')][_0xb409('0x72')]())[_0xb409('0x39')](_0xb409('0x7e')))[_0xb409('0x72')]();}_0x39cdaf=squel[_0xb409('0x69')]()[_0xb409('0x7f')](_0xb409('0x80'))['fromQuery'](['cmHopperId',_0xb409('0x7c'),_0xb409('0x6c'),_0xb409('0x81'),_0xb409('0x50'),_0xb409('0x51')],squel['select']()[_0xb409('0x6f')](_0xb409('0x82'),'id')[_0xb409('0x6f')](_0xb409('0x70'),_0xb409('0x7c'))[_0xb409('0x6f')]('ci.item',_0xb409('0x6c'))['field'](_0xb409('0x83'),_0xb409('0x81'))[_0xb409('0x6f')]('\x27'+_0x2e7cd3+'\x27',_0xb409('0x50'))[_0xb409('0x6f')]('\x27'+_0x2e7cd3+'\x27',_0xb409('0x51'))[_0xb409('0x73')](_0xb409('0x84'),'ci')[_0xb409('0x85')](_0xb409('0x6a'),'h',_0xb409('0x86'))[_0xb409('0x39')](_0xb409('0x87'),_0x1d8d1d[_0xb409('0x71')][_0xb409('0x72')]())[_0xb409('0x39')]('h.CampaignId=?',_0x3b4733[_0xb409('0x43')]['id'][_0xb409('0x72')]())[_0xb409('0x39')](_0xb409('0x88'),_0x2e7cd3))[_0xb409('0x72')]();_0x4a260b[_0xb409('0x89')](db['sequelize'][_0xb409('0x30')](_0x14091b));_0x1e9853[_0xb409('0x89')](db[_0xb409('0x8a')][_0xb409('0x30')](_0x39cdaf));}return BPromise[_0xb409('0x8b')](_0x4a260b);}})[_0xb409('0x20')](function(){return BPromise['all'](_0x1e9853);})[_0xb409('0x20')](function(){return _0x40b4d5;})[_0xb409('0x20')](respondWithResult(_0xe2750,null))[_0xb409('0x41')](handleError(_0xe2750,null));};exports[_0xb409('0x8c')]=function(_0x11072f,_0x32cd33,_0x651a8){return db[_0xb409('0x2b')]['find']({'where':{'id':_0x11072f['params']['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x32cd33,null))[_0xb409('0x20')](function(_0x5e830f){if(_0x5e830f){return _0x5e830f[_0xb409('0x8c')](_0x11072f[_0xb409('0x30')][_0xb409('0x65')]);}})[_0xb409('0x20')](function(_0x2fdd4e){if(_0x2fdd4e){return db[_0xb409('0x56')][_0xb409('0x21')]({'where':{'ListId':_0x11072f[_0xb409('0x30')][_0xb409('0x65')],'CampaignId':_0x11072f['params']['id']}})['then'](function(){return _0x2fdd4e;});}})[_0xb409('0x20')](respondWithStatusCode(_0x32cd33,null))[_0xb409('0x41')](handleError(_0x32cd33,null));};exports[_0xb409('0x8d')]=function(_0x3180bd,_0x54072e,_0x28e216){var _0x5ec19a={};var _0x21ab44={};var _0xcb8555;var _0x2c200f;return db['Campaign'][_0xb409('0x55')]({'where':{'id':_0x3180bd['params']['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x54072e,null))[_0xb409('0x20')](function(_0x2095fa){if(_0x2095fa){_0xcb8555=_0x2095fa;_0x21ab44[_0xb409('0x2e')]=_['keys'](db[_0xb409('0x60')]['rawAttributes']);_0x21ab44[_0xb409('0x30')]=_['keys'](_0x3180bd[_0xb409('0x30')]);_0x21ab44[_0xb409('0x31')]=_[_0xb409('0x32')](_0x21ab44['model'],_0x21ab44[_0xb409('0x30')]);_0x5ec19a[_0xb409('0x33')]=_[_0xb409('0x32')](_0x21ab44[_0xb409('0x2e')],qs[_0xb409('0x34')](_0x3180bd[_0xb409('0x30')][_0xb409('0x34')]));_0x5ec19a['attributes']=_0x5ec19a[_0xb409('0x33')][_0xb409('0x35')]?_0x5ec19a[_0xb409('0x33')]:_0x21ab44[_0xb409('0x2e')];_0x5ec19a['order']=qs[_0xb409('0x38')](_0x3180bd['query'][_0xb409('0x38')]);_0x5ec19a[_0xb409('0x39')]=qs[_0xb409('0x31')](_[_0xb409('0x3a')](_0x3180bd[_0xb409('0x30')],_0x21ab44[_0xb409('0x31')]));if(_0x3180bd['query'][_0xb409('0x3d')]){_0x5ec19a[_0xb409('0x39')]=_[_0xb409('0x3b')](_0x5ec19a['where'],{'$or':_[_0xb409('0x2a')](_0x5ec19a['attributes'],function(_0xa0a2a4){var _0x555469={};_0x555469[_0xa0a2a4]={'$like':'%'+_0x3180bd[_0xb409('0x30')][_0xb409('0x3d')]+'%'};return _0x555469;})});}_0x5ec19a=_['merge']({},_0x5ec19a,_0x3180bd[_0xb409('0x3e')]);return _0xcb8555[_0xb409('0x8d')](_0x5ec19a);}})[_0xb409('0x20')](function(_0xd3b971){if(_0xd3b971){_0x2c200f=_0xd3b971[_0xb409('0x35')];if(!_0x3180bd[_0xb409('0x30')][_0xb409('0x36')](_0xb409('0x37'))){_0x5ec19a[_0xb409('0x1d')]=qs[_0xb409('0x1d')](_0x3180bd[_0xb409('0x30')][_0xb409('0x1d')]);_0x5ec19a[_0xb409('0x1b')]=qs[_0xb409('0x1b')](_0x3180bd['query'][_0xb409('0x1b')]);}return _0xcb8555[_0xb409('0x8d')](_0x5ec19a);}})[_0xb409('0x20')](function(_0x5ad330){if(_0x5ad330){return _0x5ad330?{'count':_0x2c200f,'rows':_0x5ad330}:null;}})[_0xb409('0x20')](respondWithResult(_0x54072e,null))[_0xb409('0x41')](handleError(_0x54072e,null));};exports[_0xb409('0x8e')]=function(_0x1e5d61,_0x453bb5,_0x21cd01){var _0x3da1b3,_0x92e188;var _0x5e4676=[];var _0x5c157b=moment()['format'](_0xb409('0x64'));return db[_0xb409('0x2b')][_0xb409('0x45')]({'where':{'id':_0x1e5d61[_0xb409('0x43')]['id']}})['then'](handleEntityNotFound(_0x453bb5,null))[_0xb409('0x20')](function(_0x95c689){if(_0x95c689){_0x92e188=_0x95c689;return _0x95c689['addBlackLists'](_0x1e5d61[_0xb409('0x52')][_0xb409('0x65')],_[_0xb409('0x4f')](_0x1e5d61['body'],[_0xb409('0x65'),'id'])||{});}return null;})[_0xb409('0x66')](function(_0x201883){var _0x3e9611;var _0x13f4e4;_0x3da1b3=_0x201883||[];var _0x1b15d8=[];if(_0x201883){for(var _0x261e25=0x0;_0x261e25<_0x201883['length'];_0x261e25+=0x1){var _0x5d6a8a=_0x201883[_0x261e25][_0xb409('0x4a')]({'plain':!![]});_0x3e9611=squel[_0xb409('0x69')]()['into'](_0xb409('0x8f'))['fromQuery']([_0xb409('0x6c'),_0xb409('0x6d'),'ListId',_0xb409('0x58'),'createdAt',_0xb409('0x51')],squel[_0xb409('0x7d')]()[_0xb409('0x6f')]('phone',_0xb409('0x6c'))[_0xb409('0x6f')]('id',_0xb409('0x6d'))[_0xb409('0x6f')](_0x5d6a8a['CmListId']['toString'](),_0xb409('0x6e'))[_0xb409('0x6f')](_0x1e5d61[_0xb409('0x43')]['id']['toString'](),_0xb409('0x58'))[_0xb409('0x6f')](_0xb409('0x70'),'createdAt')[_0xb409('0x6f')](_0xb409('0x70'),_0xb409('0x51'))['from'](_0xb409('0x74'))[_0xb409('0x39')](_0xb409('0x75'))[_0xb409('0x39')]('ListId\x20=\x20?',_0x5d6a8a[_0xb409('0x71')][_0xb409('0x72')]())[_0xb409('0x39')](_0xb409('0x7e')))[_0xb409('0x72')]();_0x1b15d8['push'](db[_0xb409('0x8a')][_0xb409('0x30')](_0x3e9611));}return BPromise['all'](_0x1b15d8);}})[_0xb409('0x20')](function(){return _0x3da1b3;})[_0xb409('0x20')](respondWithResult(_0x453bb5,null))['catch'](handleError(_0x453bb5,null));};exports[_0xb409('0x90')]=function(_0x20eb70,_0x68612d,_0x11a224){return db[_0xb409('0x2b')][_0xb409('0x45')]({'where':{'id':_0x20eb70[_0xb409('0x43')]['id']}})[_0xb409('0x20')](handleEntityNotFound(_0x68612d,null))['then'](function(_0x3b7f3a){if(_0x3b7f3a){return _0x3b7f3a[_0xb409('0x90')](_0x20eb70['query'][_0xb409('0x65')]);}})[_0xb409('0x20')](function(_0x33aa73){if(_0x33aa73){return db[_0xb409('0x5f')][_0xb409('0x21')]({'where':{'ListId':_0x20eb70[_0xb409('0x30')][_0xb409('0x65')],'CampaignId':_0x20eb70[_0xb409('0x43')]['id']}})[_0xb409('0x20')](function(){return _0x33aa73;});}})[_0xb409('0x20')](respondWithStatusCode(_0x68612d,null))[_0xb409('0x41')](handleError(_0x68612d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 3a98907..54129ae 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(_0x544baa,_0x1b17fe){var _0x5e8cc1=function(_0x1b55dc){while(--_0x1b55dc){_0x544baa['push'](_0x544baa['shift']());}};_0x5e8cc1(++_0x1b17fe);}(_0x7a54,0x106));var _0x47a5=function(_0x2d9710,_0x5f19f6){_0x2d9710=_0x2d9710-0x0;var _0x44d860=_0x7a54[_0x2d9710];return _0x44d860;};'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(_0x46f098,_0x5f5063){var _0x1eef1d=function(_0x4d8b59){while(--_0x4d8b59){_0x46f098['push'](_0x46f098['shift']());}};_0x1eef1d(++_0x5f5063);}(_0x7a54,0x106));var _0x47a5=function(_0x46405c,_0x33d64c){_0x46405c=_0x46405c-0x0;var _0x4c4e7d=_0x7a54[_0x46405c];return _0x4c4e7d;};'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 616e802..ce34cc5 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 _0xc560=['model','GetCampaign','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','Campaign','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x46b4fe,_0x2edb04){var _0x5b4f87=function(_0x2b3b50){while(--_0x2b3b50){_0x46b4fe['push'](_0x46b4fe['shift']());}};_0x5b4f87(++_0x2edb04);}(_0xc560,0x82));var _0x0c56=function(_0x1f5a4b,_0x40826a){_0x1f5a4b=_0x1f5a4b-0x0;var _0x40a771=_0xc560[_0x1f5a4b];return _0x40a771;};'use strict';var _=require(_0x0c56('0x0'));var util=require('util');var moment=require(_0x0c56('0x1'));var BPromise=require('bluebird');var rs=require(_0x0c56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0c56('0x3'));var logger=require(_0x0c56('0x4'))(_0x0c56('0x5'));var config=require(_0x0c56('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0c56('0x7')][_0x0c56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35b4ee,_0x1245b3,_0x501a0b){return new BPromise(function(_0x429ad1,_0x4f5a47){return client[_0x0c56('0x9')](_0x35b4ee,_0x501a0b)[_0x0c56('0xa')](function(_0x2c1669){logger['info'](_0x0c56('0xb'),_0x1245b3,_0x0c56('0xc'));logger[_0x0c56('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1245b3,_0x0c56('0xc'),JSON[_0x0c56('0xe')](_0x2c1669));if(_0x2c1669[_0x0c56('0xf')]){if(_0x2c1669[_0x0c56('0xf')][_0x0c56('0x10')]===0x1f4){logger[_0x0c56('0xf')](_0x0c56('0xb'),_0x1245b3,_0x2c1669['error']['message']);return _0x4f5a47(_0x2c1669[_0x0c56('0xf')][_0x0c56('0x11')]);}logger[_0x0c56('0xf')](_0x0c56('0xb'),_0x1245b3,_0x2c1669[_0x0c56('0xf')][_0x0c56('0x11')]);return _0x429ad1(_0x2c1669['error'][_0x0c56('0x11')]);}else{logger[_0x0c56('0x12')](_0x0c56('0xb'),_0x1245b3,_0x0c56('0xc'));_0x429ad1(_0x2c1669[_0x0c56('0x13')]['message']);}})[_0x0c56('0x14')](function(_0x5df4cd){logger['error'](_0x0c56('0xb'),_0x1245b3,_0x5df4cd);_0x4f5a47(_0x5df4cd);});});}exports['GetCampaign']=function(_0x1da146){var _0x5ebe5f=this;return new Promise(function(_0x5517e4,_0x224424){return db[_0x0c56('0x15')][_0x0c56('0x16')]({'raw':_0x1da146[_0x0c56('0x17')]?_0x1da146[_0x0c56('0x17')][_0x0c56('0x18')]===undefined?!![]:![]:!![],'where':_0x1da146[_0x0c56('0x17')]?_0x1da146[_0x0c56('0x17')][_0x0c56('0x19')]||null:null,'attributes':_0x1da146[_0x0c56('0x17')]?_0x1da146[_0x0c56('0x17')][_0x0c56('0x1a')]||null:null,'limit':_0x1da146['options']?_0x1da146['options'][_0x0c56('0x1b')]||null:null,'include':_0x1da146[_0x0c56('0x17')]?_0x1da146[_0x0c56('0x17')][_0x0c56('0x1c')]?_[_0x0c56('0x1d')](_0x1da146['options'][_0x0c56('0x1c')],function(_0x1b6812){return{'model':db[_0x1b6812[_0x0c56('0x1e')]],'as':_0x1b6812['as'],'attributes':_0x1b6812[_0x0c56('0x1a')],'include':_0x1b6812[_0x0c56('0x1c')]?_['map'](_0x1b6812[_0x0c56('0x1c')],function(_0x58e79d){return{'model':db[_0x58e79d[_0x0c56('0x1e')]],'as':_0x58e79d['as'],'attributes':_0x58e79d['attributes'],'include':_0x58e79d[_0x0c56('0x1c')]?_[_0x0c56('0x1d')](_0x58e79d[_0x0c56('0x1c')],function(_0x44d985){return{'model':db[_0x44d985[_0x0c56('0x1e')]],'as':_0x44d985['as'],'attributes':_0x44d985['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c56('0xa')](function(_0x5c1495){logger[_0x0c56('0x12')](_0x0c56('0x1f'),_0x1da146);logger['debug'](_0x0c56('0x1f'),_0x1da146,JSON['stringify'](_0x5c1495));_0x5517e4(_0x5c1495);})[_0x0c56('0x14')](function(_0x44b6ad){logger[_0x0c56('0xf')](_0x0c56('0x1f'),_0x44b6ad[_0x0c56('0x11')],_0x1da146);_0x224424(_0x5ebe5f[_0x0c56('0xf')](0x1f4,_0x44b6ad[_0x0c56('0x11')]));});});}; \ No newline at end of file +var _0x559a=['Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x559a,0xb3));var _0xa559=function(_0x4278eb,_0x16a32e){_0x4278eb=_0x4278eb-0x0;var _0x393dc1=_0x559a[_0x4278eb];return _0x393dc1;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require('moment');var BPromise=require(_0xa559('0x2'));var rs=require(_0xa559('0x3'));var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require(_0xa559('0x6'));var logger=require(_0xa559('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa559('0x8'));var client=jayson[_0xa559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edab4,_0x1a5cec,_0x4eada1){return new BPromise(function(_0xb8055,_0x218e3b){return client[_0xa559('0xa')](_0x2edab4,_0x4eada1)[_0xa559('0xb')](function(_0x48aa9a){logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,_0xa559('0xe'));logger[_0xa559('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0x1a5cec,'request\x20sent',JSON[_0xa559('0x10')](_0x48aa9a));if(_0x48aa9a[_0xa559('0x11')]){if(_0x48aa9a['error'][_0xa559('0x12')]===0x1f4){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a['error'][_0xa559('0x13')]);return _0x218e3b(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a[_0xa559('0x11')]['message']);return _0xb8055(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}else{logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,'request\x20sent');_0xb8055(_0x48aa9a[_0xa559('0x14')]['message']);}})[_0xa559('0x15')](function(_0x1387b6){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x1387b6);_0x218e3b(_0x1387b6);});});}exports[_0xa559('0x16')]=function(_0x163405){var _0xd21ebf=this;return new Promise(function(_0x1a4c42,_0x16f090){return db[_0xa559('0x17')][_0xa559('0x18')]({'raw':_0x163405[_0xa559('0x19')]?_0x163405[_0xa559('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x163405['options']?_0x163405[_0xa559('0x19')][_0xa559('0x1a')]||null:null,'attributes':_0x163405['options']?_0x163405[_0xa559('0x19')][_0xa559('0x1b')]||null:null,'limit':_0x163405[_0xa559('0x19')]?_0x163405[_0xa559('0x19')][_0xa559('0x1c')]||null:null,'include':_0x163405[_0xa559('0x19')]?_0x163405['options'][_0xa559('0x1d')]?_['map'](_0x163405[_0xa559('0x19')][_0xa559('0x1d')],function(_0x314fef){return{'model':db[_0x314fef['model']],'as':_0x314fef['as'],'attributes':_0x314fef[_0xa559('0x1b')],'include':_0x314fef['include']?_[_0xa559('0x1e')](_0x314fef[_0xa559('0x1d')],function(_0x5834c6){return{'model':db[_0x5834c6[_0xa559('0x1f')]],'as':_0x5834c6['as'],'attributes':_0x5834c6['attributes'],'include':_0x5834c6['include']?_[_0xa559('0x1e')](_0x5834c6[_0xa559('0x1d')],function(_0x3fcf7f){return{'model':db[_0x3fcf7f[_0xa559('0x1f')]],'as':_0x3fcf7f['as'],'attributes':_0x3fcf7f[_0xa559('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa559('0xb')](function(_0x31e24b){logger[_0xa559('0xc')]('GetCampaign',_0x163405);logger[_0xa559('0xf')](_0xa559('0x16'),_0x163405,JSON[_0xa559('0x10')](_0x31e24b));_0x1a4c42(_0x31e24b);})[_0xa559('0x15')](function(_0x5f3fbb){logger[_0xa559('0x11')](_0xa559('0x16'),_0x5f3fbb[_0xa559('0x13')],_0x163405);_0x16f090(_0xd21ebf['error'](0x1f4,_0x5f3fbb[_0xa559('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index a9d2da0..58bd5e8 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 _0x71c8=['util','path','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','addBlackLists','put','update','delete','removeBlackLists','multer'];(function(_0x314639,_0x34bea5){var _0x17dd7c=function(_0x557859){while(--_0x557859){_0x314639['push'](_0x314639['shift']());}};_0x17dd7c(++_0x34bea5);}(_0x71c8,0x149));var _0x871c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x871c('0x0'));var util=require(_0x871c('0x1'));var path=require(_0x871c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x871c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x871c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x871c('0x5'));var controller=require(_0x871c('0x6'));router[_0x871c('0x7')]('/',auth[_0x871c('0x8')](),controller[_0x871c('0x9')]);router['get'](_0x871c('0xa'),auth['isAuthenticated'](),controller[_0x871c('0xb')]);router[_0x871c('0x7')](_0x871c('0xc'),auth[_0x871c('0x8')](),controller[_0x871c('0xd')]);router[_0x871c('0x7')](_0x871c('0xe'),auth['isAuthenticated'](),controller[_0x871c('0xf')]);router[_0x871c('0x7')](_0x871c('0x10'),auth[_0x871c('0x8')](),controller[_0x871c('0x11')]);router['get'](_0x871c('0x12'),auth[_0x871c('0x8')](),controller[_0x871c('0x13')]);router[_0x871c('0x7')]('/:id/lists',auth[_0x871c('0x8')](),controller['getLists']);router[_0x871c('0x7')](_0x871c('0x14'),auth[_0x871c('0x8')](),controller[_0x871c('0x15')]);router[_0x871c('0x16')]('/',auth['isAuthenticated'](),controller[_0x871c('0x17')]);router[_0x871c('0x16')](_0x871c('0x18'),auth[_0x871c('0x8')](),controller[_0x871c('0x19')]);router[_0x871c('0x16')](_0x871c('0x1a'),auth[_0x871c('0x8')](),controller[_0x871c('0x1b')]);router[_0x871c('0x16')]('/:id/blacklists',auth[_0x871c('0x8')](),controller[_0x871c('0x1c')]);router[_0x871c('0x1d')](_0x871c('0xa'),auth[_0x871c('0x8')](),controller[_0x871c('0x1e')]);router['delete'](_0x871c('0xa'),auth[_0x871c('0x8')](),controller['destroy']);router[_0x871c('0x1f')](_0x871c('0x1a'),auth[_0x871c('0x8')](),controller['removeLists']);router['delete'](_0x871c('0x14'),auth[_0x871c('0x8')](),controller[_0x871c('0x20')]);module['exports']=router; \ No newline at end of file +var _0xdf71=['create','/:id/clone','clone','post','addLists','addBlackLists','put','destroy','delete','removeBlackLists','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x150340,_0x11959e){var _0x51d792=function(_0x4a587d){while(--_0x4a587d){_0x150340['push'](_0x150340['shift']());}};_0x51d792(++_0x11959e);}(_0xdf71,0x1d2));var _0x1df7=function(_0x4a4760,_0x7ce6b4){_0x4a4760=_0x4a4760-0x0;var _0x3c2c17=_0xdf71[_0x4a4760];return _0x3c2c17;};'use strict';var multer=require(_0x1df7('0x0'));var util=require('util');var path=require(_0x1df7('0x1'));var timeout=require(_0x1df7('0x2'));var express=require(_0x1df7('0x3'));var router=express[_0x1df7('0x4')]();var fs_extra=require(_0x1df7('0x5'));var auth=require(_0x1df7('0x6'));var interaction=require(_0x1df7('0x7'));var config=require('../../config/environment');var controller=require(_0x1df7('0x8'));router[_0x1df7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1df7('0x9')](_0x1df7('0xa'),auth['isAuthenticated'](),controller[_0x1df7('0xb')]);router['get'](_0x1df7('0xc'),auth[_0x1df7('0xd')](),controller[_0x1df7('0xe')]);router[_0x1df7('0x9')]('/:id/hopper_histories',auth[_0x1df7('0xd')](),controller[_0x1df7('0xf')]);router[_0x1df7('0x9')](_0x1df7('0x10'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x11')]);router['get'](_0x1df7('0x12'),auth['isAuthenticated'](),controller[_0x1df7('0x13')]);router[_0x1df7('0x9')](_0x1df7('0x14'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x15')]);router['get'](_0x1df7('0x16'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1df7('0x18')]);router['post'](_0x1df7('0x19'),auth['isAuthenticated'](),controller[_0x1df7('0x1a')]);router[_0x1df7('0x1b')](_0x1df7('0x14'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x1c')]);router['post'](_0x1df7('0x16'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x1d')]);router[_0x1df7('0x1e')](_0x1df7('0xa'),auth[_0x1df7('0xd')](),controller['update']);router['delete'](_0x1df7('0xa'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x1f')]);router[_0x1df7('0x20')](_0x1df7('0x14'),auth[_0x1df7('0xd')](),controller['removeLists']);router[_0x1df7('0x20')](_0x1df7('0x16'),auth[_0x1df7('0xd')](),controller[_0x1df7('0x21')]);module[_0x1df7('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4e81311..b7c4dd0 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 _0xbe47=['getDataValue','key','sequelize','exports','TEXT','medium','STRING','VIRTUAL'];(function(_0x4a6804,_0x28292b){var _0x2f0c17=function(_0x2f8e55){while(--_0x2f8e55){_0x4a6804['push'](_0x4a6804['shift']());}};_0x2f0c17(++_0x28292b);}(_0xbe47,0x1e2));var _0x7be4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbe47[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x7be4('0x0'));module[_0x7be4('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7be4('0x2')],'length':_0x7be4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7be4('0x4')]},'name':{'type':Sequelize[_0x7be4('0x5')],'get':function(){return this[_0x7be4('0x6')](_0x7be4('0x7'));}}}; \ No newline at end of file +var _0x3bf8=['getDataValue','sequelize','TEXT','medium','VIRTUAL'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3bf8,0x132));var _0x83bf=function(_0x5e2ece,_0x1a1633){_0x5e2ece=_0x5e2ece-0x0;var _0x5aed84=_0x3bf8[_0x5e2ece];return _0x5aed84;};'use strict';var Sequelize=require(_0x83bf('0x0'));module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x83bf('0x1')],'length':_0x83bf('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x83bf('0x3')],'get':function(){return this[_0x83bf('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index c856c50..8606484 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 _0xa306=['includeAll','include','findAll','catch','show','params','length','find','body','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','reject','update','then','destroy','CannedAnswers','UserProfileResource','sendStatus','error','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa306,0xb6));var _0x6a30=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xa306[_0xc8a931];return _0x28bd27;};'use strict';var emlformat=require(_0x6a30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a30('0x1'));var jsonpatch=require(_0x6a30('0x2'));var rp=require(_0x6a30('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6a30('0x4'));var util=require('util');var path=require(_0x6a30('0x5'));var sox=require(_0x6a30('0x6'));var csv=require('to-csv');var ejs=require(_0x6a30('0x7'));var fs=require('fs');var fs_extra=require(_0x6a30('0x8'));var _=require(_0x6a30('0x9'));var squel=require('squel');var crypto=require(_0x6a30('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6a30('0xb'));var toCsv=require(_0x6a30('0xc'));var querystring=require(_0x6a30('0xd'));var Papa=require('papaparse');var Redis=require(_0x6a30('0xe'));var authService=require(_0x6a30('0xf'));var qs=require(_0x6a30('0x10'));var as=require(_0x6a30('0x11'));var hardwareService=require(_0x6a30('0x12'));var logger=require(_0x6a30('0x13'))(_0x6a30('0x14'));var utils=require(_0x6a30('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6a30('0x16'))['db'];function respondWithStatusCode(_0x559d80,_0x47c18b){_0x47c18b=_0x47c18b||0xcc;return function(_0x5bf123){if(_0x5bf123){return _0x559d80['sendStatus'](_0x47c18b);}return _0x559d80['status'](_0x47c18b)[_0x6a30('0x17')]();};}function respondWithResult(_0x257760,_0x536465){_0x536465=_0x536465||0xc8;return function(_0x345ee9){if(_0x345ee9){return _0x257760[_0x6a30('0x18')](_0x536465)[_0x6a30('0x19')](_0x345ee9);}};}function respondWithFilteredResult(_0x25aa0f,_0x11b0ee){return function(_0x19322e){if(_0x19322e){var _0x29569b=typeof _0x11b0ee[_0x6a30('0x1a')]===_0x6a30('0x1b')&&typeof _0x11b0ee['limit']===_0x6a30('0x1b');var _0x9c2138=_0x19322e[_0x6a30('0x1c')];var _0xbe5e48=_0x29569b?0x0:_0x11b0ee[_0x6a30('0x1a')];var _0x3f968d=_0x29569b?_0x19322e[_0x6a30('0x1c')]:_0x11b0ee[_0x6a30('0x1a')]+_0x11b0ee[_0x6a30('0x1d')];var _0xf7f969;if(_0x3f968d>=_0x9c2138){_0x3f968d=_0x9c2138;_0xf7f969=0xc8;}else{_0xf7f969=0xce;}_0x25aa0f[_0x6a30('0x18')](_0xf7f969);return _0x25aa0f[_0x6a30('0x1e')]('Content-Range',_0xbe5e48+'-'+_0x3f968d+'/'+_0x9c2138)[_0x6a30('0x19')](_0x19322e);}return null;};}function patchUpdates(_0x192a92){return function(_0x25fba8){try{jsonpatch[_0x6a30('0x1f')](_0x25fba8,_0x192a92,!![]);}catch(_0xd83a26){return BPromise[_0x6a30('0x20')](_0xd83a26);}return _0x25fba8['save']();};}function saveUpdates(_0x5b727f,_0x1d4e32){return function(_0xb97246){if(_0xb97246){return _0xb97246[_0x6a30('0x21')](_0x5b727f)[_0x6a30('0x22')](function(_0x434302){return _0x434302;});}return null;};}function removeEntity(_0x1f50e0,_0x421f14){return function(_0x3f5202){if(_0x3f5202){return _0x3f5202[_0x6a30('0x23')]()['then'](function(){var _0x488182=_0x3f5202['get']({'plain':!![]});var _0x23b6dc=_0x6a30('0x24');return db[_0x6a30('0x25')][_0x6a30('0x23')]({'where':{'type':_0x23b6dc,'resourceId':_0x488182['id']}})[_0x6a30('0x22')](function(){return _0x3f5202;});})['then'](function(){_0x1f50e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47e828,_0x5da258){return function(_0x8c2126){if(!_0x8c2126){_0x47e828[_0x6a30('0x26')](0x194);}return _0x8c2126;};}function handleError(_0x582292,_0x5386a8){_0x5386a8=_0x5386a8||0x1f4;return function(_0x4af7f7){logger[_0x6a30('0x27')](_0x4af7f7['stack']);if(_0x4af7f7[_0x6a30('0x28')]){delete _0x4af7f7[_0x6a30('0x28')];}_0x582292['status'](_0x5386a8)['send'](_0x4af7f7);};}exports['index']=function(_0x9930a,_0x123b9a){var _0x2d8207={},_0x296540={},_0x46d2f3={'count':0x0,'rows':[]};var _0x547cb6=_[_0x6a30('0x29')](db[_0x6a30('0x2a')][_0x6a30('0x2b')],function(_0x4afeff){return{'name':_0x4afeff[_0x6a30('0x2c')],'type':_0x4afeff[_0x6a30('0x2d')][_0x6a30('0x2e')]};});_0x296540[_0x6a30('0x2f')]=_['map'](_0x547cb6,_0x6a30('0x28'));_0x296540[_0x6a30('0x30')]=_[_0x6a30('0x31')](_0x9930a[_0x6a30('0x30')]);_0x296540[_0x6a30('0x32')]=_[_0x6a30('0x33')](_0x296540[_0x6a30('0x2f')],_0x296540[_0x6a30('0x30')]);_0x2d8207[_0x6a30('0x34')]=_[_0x6a30('0x33')](_0x296540[_0x6a30('0x2f')],qs[_0x6a30('0x35')](_0x9930a[_0x6a30('0x30')]['fields']));_0x2d8207['attributes']=_0x2d8207[_0x6a30('0x34')]['length']?_0x2d8207[_0x6a30('0x34')]:_0x296540[_0x6a30('0x2f')];if(!_0x9930a[_0x6a30('0x30')][_0x6a30('0x36')]('nolimit')){_0x2d8207[_0x6a30('0x1d')]=qs[_0x6a30('0x1d')](_0x9930a['query'][_0x6a30('0x1d')]);_0x2d8207[_0x6a30('0x1a')]=qs['offset'](_0x9930a[_0x6a30('0x30')]['offset']);}_0x2d8207[_0x6a30('0x37')]=qs[_0x6a30('0x38')](_0x9930a[_0x6a30('0x30')]['sort']);_0x2d8207['where']=qs[_0x6a30('0x32')](_[_0x6a30('0x39')](_0x9930a[_0x6a30('0x30')],_0x296540[_0x6a30('0x32')]),_0x547cb6);if(_0x9930a['query'][_0x6a30('0x3a')]){_0x2d8207['where']=_[_0x6a30('0x3b')](_0x2d8207['where'],{'$or':[{'key':{'$like':'%'+_0x9930a[_0x6a30('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x9930a[_0x6a30('0x30')][_0x6a30('0x3a')]+'%'}}]});}_0x2d8207=_[_0x6a30('0x3b')]({},_0x2d8207,_0x9930a[_0x6a30('0x3c')]);var _0x16beec={'where':_0x2d8207['where']};return db['CannedAnswer']['count'](_0x16beec)['then'](function(_0x35afec){_0x46d2f3[_0x6a30('0x1c')]=_0x35afec;if(_0x9930a[_0x6a30('0x30')][_0x6a30('0x3d')]){_0x2d8207[_0x6a30('0x3e')]=[{'all':!![]}];}return db[_0x6a30('0x2a')][_0x6a30('0x3f')](_0x2d8207);})[_0x6a30('0x22')](function(_0x248b4c){_0x46d2f3['rows']=_0x248b4c;return _0x46d2f3;})[_0x6a30('0x22')](respondWithFilteredResult(_0x123b9a,_0x2d8207))[_0x6a30('0x40')](handleError(_0x123b9a,null));};exports[_0x6a30('0x41')]=function(_0x491bcc,_0x38cf65){var _0x4ca117={'raw':!![],'where':{'id':_0x491bcc[_0x6a30('0x42')]['id']}},_0x5ee878={};_0x5ee878['model']=_['keys'](db[_0x6a30('0x2a')][_0x6a30('0x2b')]);_0x5ee878[_0x6a30('0x30')]=_[_0x6a30('0x31')](_0x491bcc[_0x6a30('0x30')]);_0x5ee878['filters']=_['intersection'](_0x5ee878[_0x6a30('0x2f')],_0x5ee878[_0x6a30('0x30')]);_0x4ca117['attributes']=_[_0x6a30('0x33')](_0x5ee878[_0x6a30('0x2f')],qs[_0x6a30('0x35')](_0x491bcc[_0x6a30('0x30')]['fields']));_0x4ca117[_0x6a30('0x34')]=_0x4ca117[_0x6a30('0x34')][_0x6a30('0x43')]?_0x4ca117[_0x6a30('0x34')]:_0x5ee878[_0x6a30('0x2f')];if(_0x491bcc[_0x6a30('0x30')][_0x6a30('0x3d')]){_0x4ca117[_0x6a30('0x3e')]=[{'all':!![]}];}_0x4ca117=_[_0x6a30('0x3b')]({},_0x4ca117,_0x491bcc[_0x6a30('0x3c')]);return db['CannedAnswer'][_0x6a30('0x44')](_0x4ca117)[_0x6a30('0x22')](handleEntityNotFound(_0x38cf65,null))['then'](respondWithResult(_0x38cf65,null))[_0x6a30('0x40')](handleError(_0x38cf65,null));};exports['update']=function(_0x43c042,_0x5183e9){if(_0x43c042[_0x6a30('0x45')]['id']){delete _0x43c042[_0x6a30('0x45')]['id'];}return db[_0x6a30('0x2a')][_0x6a30('0x44')]({'where':{'id':_0x43c042[_0x6a30('0x42')]['id']}})[_0x6a30('0x22')](handleEntityNotFound(_0x5183e9,null))[_0x6a30('0x22')](saveUpdates(_0x43c042[_0x6a30('0x45')],null))[_0x6a30('0x22')](respondWithResult(_0x5183e9,null))[_0x6a30('0x40')](handleError(_0x5183e9,null));};exports[_0x6a30('0x23')]=function(_0x453e8a,_0x2db921){return db['CannedAnswer'][_0x6a30('0x44')]({'where':{'id':_0x453e8a[_0x6a30('0x42')]['id']}})[_0x6a30('0x22')](handleEntityNotFound(_0x2db921,null))[_0x6a30('0x22')](removeEntity(_0x2db921,null))[_0x6a30('0x40')](handleError(_0x2db921,null));};exports['create']=function(_0x37a23c,_0x5e9bc0){var _0x5c02c8={'key':_0x37a23c[_0x6a30('0x45')][_0x6a30('0x2e')]};if(_0x37a23c[_0x6a30('0x45')]['MailAccountId']){_0x5c02c8['MailAccountId']=_0x37a23c['body']['MailAccountId'];}else if(_0x37a23c[_0x6a30('0x45')][_0x6a30('0x46')]){_0x5c02c8[_0x6a30('0x46')]=_0x37a23c['body'][_0x6a30('0x46')];}else if(_0x37a23c[_0x6a30('0x45')][_0x6a30('0x47')]){_0x5c02c8[_0x6a30('0x47')]=_0x37a23c[_0x6a30('0x45')][_0x6a30('0x47')];}else if(_0x37a23c[_0x6a30('0x45')]['ChatWebsiteId']){_0x5c02c8[_0x6a30('0x48')]=_0x37a23c['body'][_0x6a30('0x48')];}return db['CannedAnswer'][_0x6a30('0x44')]({'where':_0x5c02c8})[_0x6a30('0x22')](function(_0x41282e){if(_0x41282e){throw new db['Sequelize']['ValidationError'](_0x6a30('0x49'));}return db[_0x6a30('0x2a')][_0x6a30('0x4a')](_0x37a23c[_0x6a30('0x45')]);})[_0x6a30('0x22')](function(_0x52e8c4){var _0x4e27f2=_0x37a23c['user']['get']({'plain':!![]});if(!_0x4e27f2)throw new Error(_0x6a30('0x4b'));if(_0x4e27f2[_0x6a30('0x4c')]==='user'){var _0x5115ce=_0x52e8c4['get']({'plain':!![]});return db[_0x6a30('0x4d')]['find']({'where':{'name':_0x6a30('0x24'),'userProfileId':_0x4e27f2[_0x6a30('0x4e')]},'raw':!![]})[_0x6a30('0x22')](function(_0x3e96c1){if(_0x3e96c1&&_0x3e96c1[_0x6a30('0x4f')]===0x0){return db[_0x6a30('0x25')]['create']({'name':_0x5115ce['name'],'resourceId':_0x5115ce['id'],'type':_0x3e96c1[_0x6a30('0x28')],'sectionId':_0x3e96c1['id']},{})['then'](function(){return _0x52e8c4;});}else{return _0x52e8c4;}})[_0x6a30('0x40')](function(_0x493171){logger[_0x6a30('0x27')](_0x6a30('0x50'),_0x493171);throw _0x493171;});}return _0x52e8c4;})[_0x6a30('0x22')](respondWithResult(_0x5e9bc0,0xc9))[_0x6a30('0x40')](handleError(_0x5e9bc0,null));}; \ No newline at end of file +var _0x5b44=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','Content-Range','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','options','count','includeAll','include','rows','catch','show','params','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x5b44,0x101));var _0x45b4=function(_0x584afc,_0x84064f){_0x584afc=_0x584afc-0x0;var _0x3d60f8=_0x5b44[_0x584afc];return _0x3d60f8;};'use strict';var emlformat=require(_0x45b4('0x0'));var rimraf=require(_0x45b4('0x1'));var zipdir=require(_0x45b4('0x2'));var jsonpatch=require(_0x45b4('0x3'));var rp=require('request-promise');var moment=require(_0x45b4('0x4'));var BPromise=require(_0x45b4('0x5'));var Mustache=require('mustache');var util=require(_0x45b4('0x6'));var path=require(_0x45b4('0x7'));var sox=require(_0x45b4('0x8'));var csv=require(_0x45b4('0x9'));var ejs=require(_0x45b4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45b4('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45b4('0xc'));var deskjs=require(_0x45b4('0xd'));var toCsv=require(_0x45b4('0x9'));var querystring=require(_0x45b4('0xe'));var Papa=require(_0x45b4('0xf'));var Redis=require('ioredis');var authService=require(_0x45b4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x45b4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45b4('0x12'))(_0x45b4('0x13'));var utils=require(_0x45b4('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x45b4('0x15'))['db'];function respondWithStatusCode(_0x2841e9,_0x1b7c86){_0x1b7c86=_0x1b7c86||0xcc;return function(_0xcda46c){if(_0xcda46c){return _0x2841e9['sendStatus'](_0x1b7c86);}return _0x2841e9[_0x45b4('0x16')](_0x1b7c86)['end']();};}function respondWithResult(_0x407807,_0x2cc6f9){_0x2cc6f9=_0x2cc6f9||0xc8;return function(_0x1eec44){if(_0x1eec44){return _0x407807['status'](_0x2cc6f9)[_0x45b4('0x17')](_0x1eec44);}};}function respondWithFilteredResult(_0x558bca,_0x3c23a0){return function(_0x119320){if(_0x119320){var _0x33c88c=typeof _0x3c23a0[_0x45b4('0x18')]===_0x45b4('0x19')&&typeof _0x3c23a0['limit']===_0x45b4('0x19');var _0x228efe=_0x119320['count'];var _0x4b25e1=_0x33c88c?0x0:_0x3c23a0[_0x45b4('0x18')];var _0x5a242f=_0x33c88c?_0x119320['count']:_0x3c23a0[_0x45b4('0x18')]+_0x3c23a0['limit'];var _0x4907e6;if(_0x5a242f>=_0x228efe){_0x5a242f=_0x228efe;_0x4907e6=0xc8;}else{_0x4907e6=0xce;}_0x558bca[_0x45b4('0x16')](_0x4907e6);return _0x558bca['set'](_0x45b4('0x1a'),_0x4b25e1+'-'+_0x5a242f+'/'+_0x228efe)['json'](_0x119320);}return null;};}function patchUpdates(_0x1deb11){return function(_0x52534f){try{jsonpatch['apply'](_0x52534f,_0x1deb11,!![]);}catch(_0x3058ca){return BPromise[_0x45b4('0x1b')](_0x3058ca);}return _0x52534f[_0x45b4('0x1c')]();};}function saveUpdates(_0x1e1c37,_0x5305ff){return function(_0x4bf56f){if(_0x4bf56f){return _0x4bf56f[_0x45b4('0x1d')](_0x1e1c37)[_0x45b4('0x1e')](function(_0x4aa2b5){return _0x4aa2b5;});}return null;};}function removeEntity(_0x5d3c69,_0x2cef39){return function(_0x898d73){if(_0x898d73){return _0x898d73[_0x45b4('0x1f')]()[_0x45b4('0x1e')](function(){var _0x3af261=_0x898d73[_0x45b4('0x20')]({'plain':!![]});var _0x4469ac=_0x45b4('0x21');return db[_0x45b4('0x22')][_0x45b4('0x1f')]({'where':{'type':_0x4469ac,'resourceId':_0x3af261['id']}})['then'](function(){return _0x898d73;});})[_0x45b4('0x1e')](function(){_0x5d3c69[_0x45b4('0x16')](0xcc)[_0x45b4('0x23')]();});}};}function handleEntityNotFound(_0x2e6287,_0x44783b){return function(_0x25b8e1){if(!_0x25b8e1){_0x2e6287[_0x45b4('0x24')](0x194);}return _0x25b8e1;};}function handleError(_0xc3d163,_0x571461){_0x571461=_0x571461||0x1f4;return function(_0x6e680b){logger[_0x45b4('0x25')](_0x6e680b[_0x45b4('0x26')]);if(_0x6e680b[_0x45b4('0x27')]){delete _0x6e680b[_0x45b4('0x27')];}_0xc3d163[_0x45b4('0x16')](_0x571461)[_0x45b4('0x28')](_0x6e680b);};}exports[_0x45b4('0x29')]=function(_0x224854,_0x2740f7){var _0x5c9888={},_0x218b5f={},_0x295f4e={'count':0x0,'rows':[]};var _0x4bbee5=_[_0x45b4('0x2a')](db[_0x45b4('0x2b')][_0x45b4('0x2c')],function(_0x4a69f9){return{'name':_0x4a69f9['fieldName'],'type':_0x4a69f9[_0x45b4('0x2d')][_0x45b4('0x2e')]};});_0x218b5f[_0x45b4('0x2f')]=_[_0x45b4('0x2a')](_0x4bbee5,_0x45b4('0x27'));_0x218b5f[_0x45b4('0x30')]=_[_0x45b4('0x31')](_0x224854['query']);_0x218b5f[_0x45b4('0x32')]=_[_0x45b4('0x33')](_0x218b5f[_0x45b4('0x2f')],_0x218b5f['query']);_0x5c9888[_0x45b4('0x34')]=_[_0x45b4('0x33')](_0x218b5f[_0x45b4('0x2f')],qs[_0x45b4('0x35')](_0x224854['query'][_0x45b4('0x35')]));_0x5c9888[_0x45b4('0x34')]=_0x5c9888['attributes'][_0x45b4('0x36')]?_0x5c9888[_0x45b4('0x34')]:_0x218b5f[_0x45b4('0x2f')];if(!_0x224854[_0x45b4('0x30')][_0x45b4('0x37')](_0x45b4('0x38'))){_0x5c9888[_0x45b4('0x39')]=qs['limit'](_0x224854['query'][_0x45b4('0x39')]);_0x5c9888[_0x45b4('0x18')]=qs[_0x45b4('0x18')](_0x224854[_0x45b4('0x30')][_0x45b4('0x18')]);}_0x5c9888[_0x45b4('0x3a')]=qs[_0x45b4('0x3b')](_0x224854[_0x45b4('0x30')]['sort']);_0x5c9888['where']=qs[_0x45b4('0x32')](_[_0x45b4('0x3c')](_0x224854[_0x45b4('0x30')],_0x218b5f[_0x45b4('0x32')]),_0x4bbee5);if(_0x224854[_0x45b4('0x30')][_0x45b4('0x3d')]){_0x5c9888[_0x45b4('0x3e')]=_['merge'](_0x5c9888[_0x45b4('0x3e')],{'$or':[{'key':{'$like':'%'+_0x224854[_0x45b4('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x224854['query'][_0x45b4('0x3d')]+'%'}}]});}_0x5c9888=_['merge']({},_0x5c9888,_0x224854[_0x45b4('0x3f')]);var _0x3e0320={'where':_0x5c9888[_0x45b4('0x3e')]};return db[_0x45b4('0x2b')]['count'](_0x3e0320)[_0x45b4('0x1e')](function(_0x26c10a){_0x295f4e[_0x45b4('0x40')]=_0x26c10a;if(_0x224854[_0x45b4('0x30')][_0x45b4('0x41')]){_0x5c9888[_0x45b4('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5c9888);})[_0x45b4('0x1e')](function(_0x2394bb){_0x295f4e[_0x45b4('0x43')]=_0x2394bb;return _0x295f4e;})[_0x45b4('0x1e')](respondWithFilteredResult(_0x2740f7,_0x5c9888))[_0x45b4('0x44')](handleError(_0x2740f7,null));};exports[_0x45b4('0x45')]=function(_0x30b2ca,_0x4b01bc){var _0x53a26a={'raw':!![],'where':{'id':_0x30b2ca[_0x45b4('0x46')]['id']}},_0x206069={};_0x206069[_0x45b4('0x2f')]=_[_0x45b4('0x31')](db[_0x45b4('0x2b')][_0x45b4('0x2c')]);_0x206069[_0x45b4('0x30')]=_[_0x45b4('0x31')](_0x30b2ca['query']);_0x206069[_0x45b4('0x32')]=_['intersection'](_0x206069[_0x45b4('0x2f')],_0x206069[_0x45b4('0x30')]);_0x53a26a[_0x45b4('0x34')]=_['intersection'](_0x206069['model'],qs[_0x45b4('0x35')](_0x30b2ca['query'][_0x45b4('0x35')]));_0x53a26a[_0x45b4('0x34')]=_0x53a26a[_0x45b4('0x34')][_0x45b4('0x36')]?_0x53a26a[_0x45b4('0x34')]:_0x206069[_0x45b4('0x2f')];if(_0x30b2ca[_0x45b4('0x30')][_0x45b4('0x41')]){_0x53a26a['include']=[{'all':!![]}];}_0x53a26a=_['merge']({},_0x53a26a,_0x30b2ca[_0x45b4('0x3f')]);return db[_0x45b4('0x2b')][_0x45b4('0x47')](_0x53a26a)['then'](handleEntityNotFound(_0x4b01bc,null))['then'](respondWithResult(_0x4b01bc,null))[_0x45b4('0x44')](handleError(_0x4b01bc,null));};exports[_0x45b4('0x1d')]=function(_0x10e434,_0xf077e1){if(_0x10e434['body']['id']){delete _0x10e434['body']['id'];}return db[_0x45b4('0x2b')]['find']({'where':{'id':_0x10e434['params']['id']}})[_0x45b4('0x1e')](handleEntityNotFound(_0xf077e1,null))['then'](saveUpdates(_0x10e434[_0x45b4('0x48')],null))[_0x45b4('0x1e')](respondWithResult(_0xf077e1,null))[_0x45b4('0x44')](handleError(_0xf077e1,null));};exports['destroy']=function(_0x407241,_0xea2f33){return db[_0x45b4('0x2b')][_0x45b4('0x47')]({'where':{'id':_0x407241['params']['id']}})[_0x45b4('0x1e')](handleEntityNotFound(_0xea2f33,null))[_0x45b4('0x1e')](removeEntity(_0xea2f33,null))[_0x45b4('0x44')](handleError(_0xea2f33,null));};exports[_0x45b4('0x49')]=function(_0x1a8e4f,_0x5a7dd7){var _0x18126d={'key':_0x1a8e4f[_0x45b4('0x48')][_0x45b4('0x2e')]};if(_0x1a8e4f[_0x45b4('0x48')][_0x45b4('0x4a')]){_0x18126d[_0x45b4('0x4a')]=_0x1a8e4f['body'][_0x45b4('0x4a')];}else if(_0x1a8e4f[_0x45b4('0x48')][_0x45b4('0x4b')]){_0x18126d[_0x45b4('0x4b')]=_0x1a8e4f['body'][_0x45b4('0x4b')];}else if(_0x1a8e4f['body'][_0x45b4('0x4c')]){_0x18126d[_0x45b4('0x4c')]=_0x1a8e4f[_0x45b4('0x48')][_0x45b4('0x4c')];}else if(_0x1a8e4f[_0x45b4('0x48')]['ChatWebsiteId']){_0x18126d[_0x45b4('0x4d')]=_0x1a8e4f[_0x45b4('0x48')][_0x45b4('0x4d')];}return db[_0x45b4('0x2b')][_0x45b4('0x47')]({'where':_0x18126d})['then'](function(_0x27c645){if(_0x27c645){throw new db['Sequelize'][(_0x45b4('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x45b4('0x2b')][_0x45b4('0x49')](_0x1a8e4f['body']);})[_0x45b4('0x1e')](function(_0x2bf465){var _0x17e5ad=_0x1a8e4f['user'][_0x45b4('0x20')]({'plain':!![]});if(!_0x17e5ad)throw new Error(_0x45b4('0x4f'));if(_0x17e5ad[_0x45b4('0x50')]===_0x45b4('0x51')){var _0x46557e=_0x2bf465['get']({'plain':!![]});return db['UserProfileSection'][_0x45b4('0x47')]({'where':{'name':'CannedAnswers','userProfileId':_0x17e5ad[_0x45b4('0x52')]},'raw':!![]})[_0x45b4('0x1e')](function(_0x29c169){if(_0x29c169&&_0x29c169[_0x45b4('0x53')]===0x0){return db[_0x45b4('0x22')]['create']({'name':_0x46557e['name'],'resourceId':_0x46557e['id'],'type':_0x29c169['name'],'sectionId':_0x29c169['id']},{})[_0x45b4('0x1e')](function(){return _0x2bf465;});}else{return _0x2bf465;}})['catch'](function(_0x4d27f9){logger['error'](_0x45b4('0x54'),_0x4d27f9);throw _0x4d27f9;});}return _0x2bf465;})[_0x45b4('0x1e')](respondWithResult(_0x5a7dd7,0xc9))[_0x45b4('0x44')](handleError(_0x5a7dd7,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 21f7138..5270cef 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 _0xf02e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x40419b,_0x5cbb00){var _0x1b5fa1=function(_0x5a941b){while(--_0x5a941b){_0x40419b['push'](_0x40419b['shift']());}};_0x1b5fa1(++_0x5cbb00);}(_0xf02e,0xbb));var _0xef02=function(_0x28f190,_0x40412e){_0x28f190=_0x28f190-0x0;var _0x18ac43=_0xf02e[_0x28f190];return _0x18ac43;};'use strict';var _=require('lodash');var util=require(_0xef02('0x0'));var logger=require(_0xef02('0x1'))(_0xef02('0x2'));var moment=require(_0xef02('0x3'));var BPromise=require(_0xef02('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xef02('0x5'));var rimraf=require(_0xef02('0x6'));var config=require(_0xef02('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x2344bf,_0x568293){return _0x2344bf['define']('CannedAnswer',attributes,{'tableName':_0xef02('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xef02('0x9'),'collate':_0xef02('0xa')});}; \ No newline at end of file +var _0x482b=['CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5d1c54,_0x1f2a92){var _0x2ecd1b=function(_0x344211){while(--_0x344211){_0x5d1c54['push'](_0x5d1c54['shift']());}};_0x2ecd1b(++_0x1f2a92);}(_0x482b,0x12a));var _0xb482=function(_0x2baf26,_0x425803){_0x2baf26=_0x2baf26-0x0;var _0x4cc2ad=_0x482b[_0x2baf26];return _0x4cc2ad;};'use strict';var _=require(_0xb482('0x0'));var util=require(_0xb482('0x1'));var logger=require(_0xb482('0x2'))('api');var moment=require(_0xb482('0x3'));var BPromise=require('bluebird');var rp=require(_0xb482('0x4'));var fs=require('fs');var path=require(_0xb482('0x5'));var rimraf=require(_0xb482('0x6'));var config=require(_0xb482('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0xb482('0x8')]=function(_0x3a6412,_0x254284){return _0x3a6412[_0xb482('0x9')](_0xb482('0xa'),attributes,{'tableName':_0xb482('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb482('0xc'),'collate':_0xb482('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 42aaa26..41ddde7 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(_0x55634d,_0x3216b5){var _0x3b790e=function(_0x2d00e9){while(--_0x2d00e9){_0x55634d['push'](_0x55634d['shift']());}};_0x3b790e(++_0x3216b5);}(_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 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(_0x5314c7,_0x392ead){var _0x81347c=function(_0x577f79){while(--_0x577f79){_0x5314c7['push'](_0x5314c7['shift']());}};_0x81347c(++_0x392ead);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 06378ce..96858b5 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 _0x28b8=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer'];(function(_0x39abbf,_0x441449){var _0x4e5215=function(_0x38d4c5){while(--_0x38d4c5){_0x39abbf['push'](_0x39abbf['shift']());}};_0x4e5215(++_0x441449);}(_0x28b8,0x1a3));var _0x828b=function(_0xa9d1f6,_0xed421){_0xa9d1f6=_0xa9d1f6-0x0;var _0x3860b2=_0x28b8[_0xa9d1f6];return _0x3860b2;};'use strict';var multer=require(_0x828b('0x0'));var util=require(_0x828b('0x1'));var path=require(_0x828b('0x2'));var timeout=require(_0x828b('0x3'));var express=require(_0x828b('0x4'));var router=express[_0x828b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x828b('0x6'));var config=require(_0x828b('0x7'));var controller=require(_0x828b('0x8'));router[_0x828b('0x9')]('/',auth[_0x828b('0xa')](),controller[_0x828b('0xb')]);router[_0x828b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x828b('0xc')]);router[_0x828b('0xd')]('/',auth[_0x828b('0xa')](),controller[_0x828b('0xe')]);router[_0x828b('0xf')](_0x828b('0x10'),auth['isAuthenticated'](),controller[_0x828b('0x11')]);router[_0x828b('0x12')]('/:id',auth[_0x828b('0xa')](),controller['destroy']);module[_0x828b('0x13')]=router; \ No newline at end of file +var _0xaddc=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete'];(function(_0x399dd8,_0x33eb97){var _0x592a3d=function(_0x48ebe6){while(--_0x48ebe6){_0x399dd8['push'](_0x399dd8['shift']());}};_0x592a3d(++_0x33eb97);}(_0xaddc,0x18e));var _0xcadd=function(_0x3436ad,_0x2cf72c){_0x3436ad=_0x3436ad-0x0;var _0x59b294=_0xaddc[_0x3436ad];return _0x59b294;};'use strict';var multer=require(_0xcadd('0x0'));var util=require(_0xcadd('0x1'));var path=require(_0xcadd('0x2'));var timeout=require(_0xcadd('0x3'));var express=require(_0xcadd('0x4'));var router=express[_0xcadd('0x5')]();var fs_extra=require(_0xcadd('0x6'));var auth=require(_0xcadd('0x7'));var interaction=require(_0xcadd('0x8'));var config=require(_0xcadd('0x9'));var controller=require(_0xcadd('0xa'));router[_0xcadd('0xb')]('/',auth['isAuthenticated'](),controller[_0xcadd('0xc')]);router[_0xcadd('0xb')](_0xcadd('0xd'),auth[_0xcadd('0xe')](),controller[_0xcadd('0xf')]);router['post']('/',auth[_0xcadd('0xe')](),controller[_0xcadd('0x10')]);router[_0xcadd('0x11')](_0xcadd('0xd'),auth[_0xcadd('0xe')](),controller[_0xcadd('0x12')]);router[_0xcadd('0x13')]('/:id',auth[_0xcadd('0xe')](),controller[_0xcadd('0x14')]);module[_0xcadd('0x15')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 07cdf28..7062d94 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 _0x3dcd=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x3dcd,0xc5));var _0xd3dc=function(_0x29d4ac,_0x5c4e0f){_0x29d4ac=_0x29d4ac-0x0;var _0x2a99b0=_0x3dcd[_0x29d4ac];return _0x2a99b0;};'use strict';var Sequelize=require(_0xd3dc('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xd3dc('0x1')],'allowNull':![],'defaultValue':_0xd3dc('0x2')},'clid':{'type':Sequelize[_0xd3dc('0x3')]},'src':{'type':Sequelize[_0xd3dc('0x3')]},'dst':{'type':Sequelize[_0xd3dc('0x3')]},'dcontext':{'type':Sequelize[_0xd3dc('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0xd3dc('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd3dc('0x3')]},'duration':{'type':Sequelize[_0xd3dc('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xd3dc('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xd3dc('0x3')]},'amaflags':{'type':Sequelize[_0xd3dc('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xd3dc('0x3')]},'userfield':{'type':Sequelize[_0xd3dc('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd3dc('0x3')]},'sequence':{'type':Sequelize[_0xd3dc('0x3')]},'peeraccount':{'type':Sequelize[_0xd3dc('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xd3dc('0x3')]}}; \ No newline at end of file +var _0x984b=['INTEGER','1970-01-01\x2000:00:01','STRING'];(function(_0x5be3d4,_0x2f9334){var _0x2aadf5=function(_0x3042e6){while(--_0x3042e6){_0x5be3d4['push'](_0x5be3d4['shift']());}};_0x2aadf5(++_0x2f9334);}(_0x984b,0xee));var _0xb984=function(_0x223ebc,_0x2ceb2e){_0x223ebc=_0x223ebc-0x0;var _0x2aed81=_0x984b[_0x223ebc];return _0x2aed81;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xb984('0x0')},'clid':{'type':Sequelize[_0xb984('0x1')]},'src':{'type':Sequelize[_0xb984('0x1')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb984('0x1')]},'dstchannel':{'type':Sequelize[_0xb984('0x1')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xb984('0x2')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb984('0x2')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xb984('0x2')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb984('0x1')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb984('0x1')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xb984('0x1')]},'peeraccount':{'type':Sequelize[_0xb984('0x1')]},'type':{'type':Sequelize[_0xb984('0x1')]},'tag':{'type':Sequelize[_0xb984('0x1')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 73664bd..aa0b8a5 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 _0x29d4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','end','stack','name','send','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','intersection','find','create','body','destroy','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x244489,_0x3377fc){var _0xd516f3=function(_0x6ec21a){while(--_0x6ec21a){_0x244489['push'](_0x244489['shift']());}};_0xd516f3(++_0x3377fc);}(_0x29d4,0x1a1));var _0x429d=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x29d4[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require(_0x429d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x429d('0x1'));var jsonpatch=require(_0x429d('0x2'));var rp=require(_0x429d('0x3'));var moment=require(_0x429d('0x4'));var BPromise=require(_0x429d('0x5'));var Mustache=require('mustache');var util=require(_0x429d('0x6'));var path=require(_0x429d('0x7'));var sox=require(_0x429d('0x8'));var csv=require(_0x429d('0x9'));var ejs=require(_0x429d('0xa'));var fs=require('fs');var fs_extra=require(_0x429d('0xb'));var _=require(_0x429d('0xc'));var squel=require(_0x429d('0xd'));var crypto=require('crypto');var jsforce=require(_0x429d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x429d('0x9'));var querystring=require(_0x429d('0xf'));var Papa=require(_0x429d('0x10'));var Redis=require('ioredis');var authService=require(_0x429d('0x11'));var qs=require(_0x429d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x429d('0x13'));var logger=require(_0x429d('0x14'))(_0x429d('0x15'));var utils=require('../../config/utils');var config=require(_0x429d('0x16'));var licenseUtil=require(_0x429d('0x17'));var db=require(_0x429d('0x18'))['db'];function respondWithStatusCode(_0x1cb1cf,_0x4843af){_0x4843af=_0x4843af||0xcc;return function(_0x1c542c){if(_0x1c542c){return _0x1cb1cf[_0x429d('0x19')](_0x4843af);}return _0x1cb1cf[_0x429d('0x1a')](_0x4843af)['end']();};}function respondWithResult(_0x315d8d,_0x5dc247){_0x5dc247=_0x5dc247||0xc8;return function(_0x5c32ab){if(_0x5c32ab){return _0x315d8d[_0x429d('0x1a')](_0x5dc247)[_0x429d('0x1b')](_0x5c32ab);}};}function respondWithFilteredResult(_0x1bfbdb,_0x2ee97b){return function(_0x8c8a15){if(_0x8c8a15){var _0x2363a0=typeof _0x2ee97b['offset']===_0x429d('0x1c')&&typeof _0x2ee97b['limit']===_0x429d('0x1c');var _0x35830e=_0x8c8a15[_0x429d('0x1d')];var _0x2dc57a=_0x2363a0?0x0:_0x2ee97b['offset'];var _0x240a7d=_0x2363a0?_0x8c8a15[_0x429d('0x1d')]:_0x2ee97b[_0x429d('0x1e')]+_0x2ee97b['limit'];var _0x329d67;if(_0x240a7d>=_0x35830e){_0x240a7d=_0x35830e;_0x329d67=0xc8;}else{_0x329d67=0xce;}_0x1bfbdb[_0x429d('0x1a')](_0x329d67);return _0x1bfbdb[_0x429d('0x1f')](_0x429d('0x20'),_0x2dc57a+'-'+_0x240a7d+'/'+_0x35830e)[_0x429d('0x1b')](_0x8c8a15);}return null;};}function patchUpdates(_0x4534bd){return function(_0x5a4093){try{jsonpatch[_0x429d('0x21')](_0x5a4093,_0x4534bd,!![]);}catch(_0x165e4d){return BPromise[_0x429d('0x22')](_0x165e4d);}return _0x5a4093['save']();};}function saveUpdates(_0x1492f1,_0x13fc71){return function(_0x452572){if(_0x452572){return _0x452572[_0x429d('0x23')](_0x1492f1)[_0x429d('0x24')](function(_0x1023e6){return _0x1023e6;});}return null;};}function removeEntity(_0x4c6d89,_0x28f84e){return function(_0x3a9a75){if(_0x3a9a75){return _0x3a9a75['destroy']()[_0x429d('0x24')](function(){_0x4c6d89[_0x429d('0x1a')](0xcc)[_0x429d('0x25')]();});}};}function handleEntityNotFound(_0x11c423,_0x5d2e06){return function(_0x3b12f6){if(!_0x3b12f6){_0x11c423[_0x429d('0x19')](0x194);}return _0x3b12f6;};}function handleError(_0x387639,_0x3896ee){_0x3896ee=_0x3896ee||0x1f4;return function(_0x3e4e73){logger['error'](_0x3e4e73[_0x429d('0x26')]);if(_0x3e4e73[_0x429d('0x27')]){delete _0x3e4e73[_0x429d('0x27')];}_0x387639[_0x429d('0x1a')](_0x3896ee)[_0x429d('0x28')](_0x3e4e73);};}exports[_0x429d('0x29')]=function(_0x2351c9,_0xdc7bf9){var _0x2ceb54={},_0x50ef02={},_0x31cae6={'count':0x0,'rows':[]};var _0x3ca640=_['map'](db[_0x429d('0x2a')][_0x429d('0x2b')],function(_0x2e95b5){return{'name':_0x2e95b5[_0x429d('0x2c')],'type':_0x2e95b5[_0x429d('0x2d')]['key']};});_0x50ef02[_0x429d('0x2e')]=_[_0x429d('0x2f')](_0x3ca640,_0x429d('0x27'));_0x50ef02[_0x429d('0x30')]=_[_0x429d('0x31')](_0x2351c9[_0x429d('0x30')]);_0x50ef02['filters']=_['intersection'](_0x50ef02[_0x429d('0x2e')],_0x50ef02[_0x429d('0x30')]);_0x2ceb54['attributes']=_['intersection'](_0x50ef02[_0x429d('0x2e')],qs['fields'](_0x2351c9[_0x429d('0x30')][_0x429d('0x32')]));_0x2ceb54[_0x429d('0x33')]=_0x2ceb54[_0x429d('0x33')]['length']?_0x2ceb54[_0x429d('0x33')]:_0x50ef02[_0x429d('0x2e')];if(!_0x2351c9['query']['hasOwnProperty']('nolimit')){_0x2ceb54['limit']=qs['limit'](_0x2351c9[_0x429d('0x30')]['limit']);_0x2ceb54['offset']=qs[_0x429d('0x1e')](_0x2351c9[_0x429d('0x30')][_0x429d('0x1e')]);}_0x2ceb54[_0x429d('0x34')]=qs[_0x429d('0x35')](_0x2351c9[_0x429d('0x30')]['sort']);_0x2ceb54[_0x429d('0x36')]=qs[_0x429d('0x37')](_[_0x429d('0x38')](_0x2351c9[_0x429d('0x30')],_0x50ef02[_0x429d('0x37')]),_0x3ca640);if(_0x2351c9[_0x429d('0x30')][_0x429d('0x39')]){_0x2ceb54[_0x429d('0x36')]=_[_0x429d('0x3a')](_0x2ceb54[_0x429d('0x36')],{'$or':_[_0x429d('0x2f')](_0x3ca640,function(_0x1e3924){if(_0x1e3924[_0x429d('0x2d')]!==_0x429d('0x3b')){var _0x1a80bc={};_0x1a80bc[_0x1e3924[_0x429d('0x27')]]={'$like':'%'+_0x2351c9['query']['filter']+'%'};return _0x1a80bc;}})});}_0x2ceb54=_[_0x429d('0x3a')]({},_0x2ceb54,_0x2351c9[_0x429d('0x3c')]);var _0x569811={'where':_0x2ceb54[_0x429d('0x36')]};return db[_0x429d('0x2a')][_0x429d('0x1d')](_0x569811)['then'](function(_0x50a907){_0x31cae6[_0x429d('0x1d')]=_0x50a907;if(_0x2351c9[_0x429d('0x30')]['includeAll']){_0x2ceb54[_0x429d('0x3d')]=[{'all':!![]}];}return db[_0x429d('0x2a')]['findAll'](_0x2ceb54);})[_0x429d('0x24')](function(_0x5182d3){_0x31cae6[_0x429d('0x3e')]=_0x5182d3;return _0x31cae6;})[_0x429d('0x24')](respondWithFilteredResult(_0xdc7bf9,_0x2ceb54))[_0x429d('0x3f')](handleError(_0xdc7bf9,null));};exports[_0x429d('0x40')]=function(_0x4da740,_0x34a79c){var _0x38b40c={'raw':!![],'where':{'id':_0x4da740['params']['id']}},_0x2a97c1={};_0x2a97c1['model']=_[_0x429d('0x31')](db[_0x429d('0x2a')][_0x429d('0x2b')]);_0x2a97c1[_0x429d('0x30')]=_['keys'](_0x4da740[_0x429d('0x30')]);_0x2a97c1[_0x429d('0x37')]=_[_0x429d('0x41')](_0x2a97c1[_0x429d('0x2e')],_0x2a97c1[_0x429d('0x30')]);_0x38b40c[_0x429d('0x33')]=_[_0x429d('0x41')](_0x2a97c1[_0x429d('0x2e')],qs[_0x429d('0x32')](_0x4da740[_0x429d('0x30')]['fields']));_0x38b40c[_0x429d('0x33')]=_0x38b40c['attributes']['length']?_0x38b40c['attributes']:_0x2a97c1[_0x429d('0x2e')];if(_0x4da740[_0x429d('0x30')]['includeAll']){_0x38b40c[_0x429d('0x3d')]=[{'all':!![]}];}_0x38b40c=_[_0x429d('0x3a')]({},_0x38b40c,_0x4da740['options']);return db[_0x429d('0x2a')][_0x429d('0x42')](_0x38b40c)[_0x429d('0x24')](handleEntityNotFound(_0x34a79c,null))[_0x429d('0x24')](respondWithResult(_0x34a79c,null))[_0x429d('0x3f')](handleError(_0x34a79c,null));};exports['create']=function(_0x29c7a2,_0xd9451b){return db[_0x429d('0x2a')][_0x429d('0x43')](_0x29c7a2['body'],{})[_0x429d('0x24')](respondWithResult(_0xd9451b,0xc9))[_0x429d('0x3f')](handleError(_0xd9451b,null));};exports[_0x429d('0x23')]=function(_0x58b6c7,_0x471ba5){if(_0x58b6c7['body']['id']){delete _0x58b6c7[_0x429d('0x44')]['id'];}return db[_0x429d('0x2a')][_0x429d('0x42')]({'where':{'id':_0x58b6c7['params']['id']}})['then'](handleEntityNotFound(_0x471ba5,null))[_0x429d('0x24')](saveUpdates(_0x58b6c7['body'],null))[_0x429d('0x24')](respondWithResult(_0x471ba5,null))[_0x429d('0x3f')](handleError(_0x471ba5,null));};exports[_0x429d('0x45')]=function(_0x25121e,_0x31d1e7){return db[_0x429d('0x2a')][_0x429d('0x42')]({'where':{'id':_0x25121e[_0x429d('0x46')]['id']}})['then'](handleEntityNotFound(_0x31d1e7,null))['then'](removeEntity(_0x31d1e7,null))[_0x429d('0x3f')](handleError(_0x31d1e7,null));};exports[_0x429d('0x47')]=function(_0x18f172,_0x3a15d1){return db['Cdr'][_0x429d('0x47')]()[_0x429d('0x24')](respondWithResult(_0x3a15d1,null))[_0x429d('0x3f')](handleError(_0x3a15d1,null));}; \ No newline at end of file +var _0xa1f6=['error','stack','name','send','index','map','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x7feb90,_0x28e700){var _0x3c5b33=function(_0x113cfa){while(--_0x113cfa){_0x7feb90['push'](_0x7feb90['shift']());}};_0x3c5b33(++_0x28e700);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0xa1f6[_0x280f4a];return _0x1bb157;};'use strict';var emlformat=require(_0x6a1f('0x0'));var rimraf=require(_0x6a1f('0x1'));var zipdir=require(_0x6a1f('0x2'));var jsonpatch=require(_0x6a1f('0x3'));var rp=require(_0x6a1f('0x4'));var moment=require(_0x6a1f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6a1f('0x6'));var ejs=require(_0x6a1f('0x7'));var fs=require('fs');var fs_extra=require(_0x6a1f('0x8'));var _=require(_0x6a1f('0x9'));var squel=require(_0x6a1f('0xa'));var crypto=require(_0x6a1f('0xb'));var jsforce=require(_0x6a1f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6a1f('0x6'));var querystring=require(_0x6a1f('0xd'));var Papa=require(_0x6a1f('0xe'));var Redis=require(_0x6a1f('0xf'));var authService=require(_0x6a1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6a1f('0x11'));var hardwareService=require(_0x6a1f('0x12'));var logger=require(_0x6a1f('0x13'))(_0x6a1f('0x14'));var utils=require('../../config/utils');var config=require(_0x6a1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a1f('0x16'))['db'];function respondWithStatusCode(_0x17edb6,_0x2a4e94){_0x2a4e94=_0x2a4e94||0xcc;return function(_0x442576){if(_0x442576){return _0x17edb6[_0x6a1f('0x17')](_0x2a4e94);}return _0x17edb6[_0x6a1f('0x18')](_0x2a4e94)[_0x6a1f('0x19')]();};}function respondWithResult(_0x8c3a36,_0x1918c6){_0x1918c6=_0x1918c6||0xc8;return function(_0x27d8f8){if(_0x27d8f8){return _0x8c3a36[_0x6a1f('0x18')](_0x1918c6)[_0x6a1f('0x1a')](_0x27d8f8);}};}function respondWithFilteredResult(_0x253305,_0x2677c1){return function(_0x14ecec){if(_0x14ecec){var _0x11ee0e=typeof _0x2677c1[_0x6a1f('0x1b')]===_0x6a1f('0x1c')&&typeof _0x2677c1[_0x6a1f('0x1d')]==='undefined';var _0x392ccb=_0x14ecec[_0x6a1f('0x1e')];var _0x1ccbed=_0x11ee0e?0x0:_0x2677c1[_0x6a1f('0x1b')];var _0x21d268=_0x11ee0e?_0x14ecec[_0x6a1f('0x1e')]:_0x2677c1[_0x6a1f('0x1b')]+_0x2677c1[_0x6a1f('0x1d')];var _0x5cb044;if(_0x21d268>=_0x392ccb){_0x21d268=_0x392ccb;_0x5cb044=0xc8;}else{_0x5cb044=0xce;}_0x253305[_0x6a1f('0x18')](_0x5cb044);return _0x253305['set'](_0x6a1f('0x1f'),_0x1ccbed+'-'+_0x21d268+'/'+_0x392ccb)[_0x6a1f('0x1a')](_0x14ecec);}return null;};}function patchUpdates(_0x3c7ed0){return function(_0x1b5856){try{jsonpatch[_0x6a1f('0x20')](_0x1b5856,_0x3c7ed0,!![]);}catch(_0x4eae7f){return BPromise[_0x6a1f('0x21')](_0x4eae7f);}return _0x1b5856[_0x6a1f('0x22')]();};}function saveUpdates(_0xa43cd5,_0x1be0c3){return function(_0x312e75){if(_0x312e75){return _0x312e75[_0x6a1f('0x23')](_0xa43cd5)[_0x6a1f('0x24')](function(_0x2736ab){return _0x2736ab;});}return null;};}function removeEntity(_0x53229b,_0x1eb146){return function(_0x3d953d){if(_0x3d953d){return _0x3d953d['destroy']()['then'](function(){_0x53229b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ea158,_0x5e6013){return function(_0x5abe40){if(!_0x5abe40){_0x3ea158[_0x6a1f('0x17')](0x194);}return _0x5abe40;};}function handleError(_0x286d1d,_0x2b53ca){_0x2b53ca=_0x2b53ca||0x1f4;return function(_0x1e8db8){logger[_0x6a1f('0x25')](_0x1e8db8[_0x6a1f('0x26')]);if(_0x1e8db8[_0x6a1f('0x27')]){delete _0x1e8db8[_0x6a1f('0x27')];}_0x286d1d['status'](_0x2b53ca)[_0x6a1f('0x28')](_0x1e8db8);};}exports[_0x6a1f('0x29')]=function(_0x3f0730,_0x574d80){var _0x1e951c={},_0x155c58={},_0x257cee={'count':0x0,'rows':[]};var _0x113422=_[_0x6a1f('0x2a')](db[_0x6a1f('0x2b')][_0x6a1f('0x2c')],function(_0x58d879){return{'name':_0x58d879['fieldName'],'type':_0x58d879[_0x6a1f('0x2d')][_0x6a1f('0x2e')]};});_0x155c58[_0x6a1f('0x2f')]=_[_0x6a1f('0x2a')](_0x113422,_0x6a1f('0x27'));_0x155c58[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x3f0730['query']);_0x155c58[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x155c58['model'],_0x155c58[_0x6a1f('0x30')]);_0x1e951c[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x155c58['model'],qs['fields'](_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x35')]));_0x1e951c[_0x6a1f('0x34')]=_0x1e951c['attributes']['length']?_0x1e951c[_0x6a1f('0x34')]:_0x155c58[_0x6a1f('0x2f')];if(!_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x36')](_0x6a1f('0x37'))){_0x1e951c[_0x6a1f('0x1d')]=qs[_0x6a1f('0x1d')](_0x3f0730['query'][_0x6a1f('0x1d')]);_0x1e951c['offset']=qs[_0x6a1f('0x1b')](_0x3f0730[_0x6a1f('0x30')]['offset']);}_0x1e951c[_0x6a1f('0x38')]=qs[_0x6a1f('0x39')](_0x3f0730['query'][_0x6a1f('0x39')]);_0x1e951c['where']=qs[_0x6a1f('0x32')](_['pick'](_0x3f0730[_0x6a1f('0x30')],_0x155c58['filters']),_0x113422);if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]){_0x1e951c['where']=_[_0x6a1f('0x3b')](_0x1e951c[_0x6a1f('0x3c')],{'$or':_['map'](_0x113422,function(_0x5beb28){if(_0x5beb28[_0x6a1f('0x2d')]!==_0x6a1f('0x3d')){var _0x314fef={};_0x314fef[_0x5beb28[_0x6a1f('0x27')]]={'$like':'%'+_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3a')]+'%'};return _0x314fef;}})});}_0x1e951c=_['merge']({},_0x1e951c,_0x3f0730[_0x6a1f('0x3e')]);var _0x2da23a={'where':_0x1e951c[_0x6a1f('0x3c')]};return db[_0x6a1f('0x2b')][_0x6a1f('0x1e')](_0x2da23a)[_0x6a1f('0x24')](function(_0x27be0a){_0x257cee[_0x6a1f('0x1e')]=_0x27be0a;if(_0x3f0730[_0x6a1f('0x30')][_0x6a1f('0x3f')]){_0x1e951c[_0x6a1f('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x6a1f('0x41')](_0x1e951c);})[_0x6a1f('0x24')](function(_0x334fc4){_0x257cee[_0x6a1f('0x42')]=_0x334fc4;return _0x257cee;})[_0x6a1f('0x24')](respondWithFilteredResult(_0x574d80,_0x1e951c))[_0x6a1f('0x43')](handleError(_0x574d80,null));};exports['show']=function(_0x211009,_0x482c3a){var _0x3a6f80={'raw':!![],'where':{'id':_0x211009[_0x6a1f('0x44')]['id']}},_0x33208d={};_0x33208d[_0x6a1f('0x2f')]=_[_0x6a1f('0x31')](db[_0x6a1f('0x2b')]['rawAttributes']);_0x33208d[_0x6a1f('0x30')]=_[_0x6a1f('0x31')](_0x211009[_0x6a1f('0x30')]);_0x33208d[_0x6a1f('0x32')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],_0x33208d[_0x6a1f('0x30')]);_0x3a6f80[_0x6a1f('0x34')]=_[_0x6a1f('0x33')](_0x33208d[_0x6a1f('0x2f')],qs['fields'](_0x211009['query']['fields']));_0x3a6f80[_0x6a1f('0x34')]=_0x3a6f80[_0x6a1f('0x34')][_0x6a1f('0x45')]?_0x3a6f80[_0x6a1f('0x34')]:_0x33208d[_0x6a1f('0x2f')];if(_0x211009[_0x6a1f('0x30')]['includeAll']){_0x3a6f80[_0x6a1f('0x40')]=[{'all':!![]}];}_0x3a6f80=_['merge']({},_0x3a6f80,_0x211009[_0x6a1f('0x3e')]);return db[_0x6a1f('0x2b')]['find'](_0x3a6f80)[_0x6a1f('0x24')](handleEntityNotFound(_0x482c3a,null))['then'](respondWithResult(_0x482c3a,null))[_0x6a1f('0x43')](handleError(_0x482c3a,null));};exports[_0x6a1f('0x46')]=function(_0xa864f3,_0x4318fd){return db[_0x6a1f('0x2b')][_0x6a1f('0x46')](_0xa864f3['body'],{})[_0x6a1f('0x24')](respondWithResult(_0x4318fd,0xc9))[_0x6a1f('0x43')](handleError(_0x4318fd,null));};exports[_0x6a1f('0x23')]=function(_0x2bea1a,_0x34fa17){if(_0x2bea1a[_0x6a1f('0x47')]['id']){delete _0x2bea1a[_0x6a1f('0x47')]['id'];}return db[_0x6a1f('0x2b')]['find']({'where':{'id':_0x2bea1a[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x34fa17,null))[_0x6a1f('0x24')](saveUpdates(_0x2bea1a['body'],null))[_0x6a1f('0x24')](respondWithResult(_0x34fa17,null))['catch'](handleError(_0x34fa17,null));};exports[_0x6a1f('0x48')]=function(_0x52c262,_0x366a60){return db['Cdr'][_0x6a1f('0x49')]({'where':{'id':_0x52c262[_0x6a1f('0x44')]['id']}})[_0x6a1f('0x24')](handleEntityNotFound(_0x366a60,null))['then'](removeEntity(_0x366a60,null))[_0x6a1f('0x43')](handleError(_0x366a60,null));};exports['describe']=function(_0x143873,_0x55d114){return db['Cdr'][_0x6a1f('0x4a')]()[_0x6a1f('0x24')](respondWithResult(_0x55d114,null))['catch'](handleError(_0x55d114,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2f51795..36015d0 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5ae78b,_0x3aa2b4){var _0x4b076d=function(_0x3cc9f1){while(--_0x3cc9f1){_0x5ae78b['push'](_0x5ae78b['shift']());}};_0x4b076d(++_0x3aa2b4);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x18b535,_0x3ac87f){var _0x27dcb3=function(_0x7071ce){while(--_0x7071ce){_0x18b535['push'](_0x18b535['shift']());}};_0x27dcb3(++_0x3ac87f);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'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 ed4ca27..b8c10a8 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 _0xc3e7=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util'];(function(_0x1d2cda,_0x5a9f07){var _0x3fabbd=function(_0x42bbf1){while(--_0x42bbf1){_0x1d2cda['push'](_0x1d2cda['shift']());}};_0x3fabbd(++_0x5a9f07);}(_0xc3e7,0x6c));var _0x7c3e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xc3e7[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x7c3e('0x0'));var util=require(_0x7c3e('0x1'));var moment=require(_0x7c3e('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c3e('0x3'));var fs=require('fs');var Redis=require(_0x7c3e('0x4'));var db=require(_0x7c3e('0x5'))['db'];var utils=require(_0x7c3e('0x6'));var logger=require(_0x7c3e('0x7'))(_0x7c3e('0x8'));var config=require(_0x7c3e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7c3e('0xa')][_0x7c3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23280f,_0x3c3fa9,_0x73a11b){return new BPromise(function(_0x4daf5f,_0x2ea70a){return client[_0x7c3e('0xc')](_0x23280f,_0x73a11b)[_0x7c3e('0xd')](function(_0x42ced6){logger[_0x7c3e('0xe')](_0x7c3e('0xf'),_0x3c3fa9,_0x7c3e('0x10'));logger[_0x7c3e('0x11')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3c3fa9,_0x7c3e('0x10'),JSON[_0x7c3e('0x12')](_0x42ced6));if(_0x42ced6[_0x7c3e('0x13')]){if(_0x42ced6[_0x7c3e('0x13')]['code']===0x1f4){logger[_0x7c3e('0x13')](_0x7c3e('0xf'),_0x3c3fa9,_0x42ced6[_0x7c3e('0x13')]['message']);return _0x2ea70a(_0x42ced6['error'][_0x7c3e('0x14')]);}logger[_0x7c3e('0x13')](_0x7c3e('0xf'),_0x3c3fa9,_0x42ced6[_0x7c3e('0x13')][_0x7c3e('0x14')]);return _0x4daf5f(_0x42ced6[_0x7c3e('0x13')]['message']);}else{logger[_0x7c3e('0xe')](_0x7c3e('0xf'),_0x3c3fa9,_0x7c3e('0x10'));_0x4daf5f(_0x42ced6[_0x7c3e('0x15')][_0x7c3e('0x14')]);}})['catch'](function(_0x5a9821){logger[_0x7c3e('0x13')](_0x7c3e('0xf'),_0x3c3fa9,_0x5a9821);_0x2ea70a(_0x5a9821);});});} \ No newline at end of file +var _0x8334=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis'];(function(_0x2d91c6,_0x10ae0e){var _0x3a8d19=function(_0x27a3ce){while(--_0x27a3ce){_0x2d91c6['push'](_0x2d91c6['shift']());}};_0x3a8d19(++_0x10ae0e);}(_0x8334,0x1b4));var _0x4833=function(_0x52883e,_0x10ef9a){_0x52883e=_0x52883e-0x0;var _0x434cf1=_0x8334[_0x52883e];return _0x434cf1;};'use strict';var _=require(_0x4833('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4833('0x1'));var rs=require(_0x4833('0x2'));var fs=require('fs');var Redis=require(_0x4833('0x3'));var db=require(_0x4833('0x4'))['db'];var utils=require(_0x4833('0x5'));var logger=require('../../config/logger')(_0x4833('0x6'));var config=require('../../config/environment');var jayson=require(_0x4833('0x7'));var client=jayson['client'][_0x4833('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b3cc5,_0x21e7d0,_0x12d176){return new BPromise(function(_0x2d8623,_0x117946){return client['request'](_0x3b3cc5,_0x12d176)[_0x4833('0x9')](function(_0x2eb04b){logger['info'](_0x4833('0xa'),_0x21e7d0,_0x4833('0xb'));logger[_0x4833('0xc')](_0x4833('0xd'),_0x21e7d0,_0x4833('0xb'),JSON[_0x4833('0xe')](_0x2eb04b));if(_0x2eb04b[_0x4833('0xf')]){if(_0x2eb04b[_0x4833('0xf')][_0x4833('0x10')]===0x1f4){logger['error'](_0x4833('0xa'),_0x21e7d0,_0x2eb04b[_0x4833('0xf')][_0x4833('0x11')]);return _0x117946(_0x2eb04b['error'][_0x4833('0x11')]);}logger[_0x4833('0xf')](_0x4833('0xa'),_0x21e7d0,_0x2eb04b['error']['message']);return _0x2d8623(_0x2eb04b[_0x4833('0xf')][_0x4833('0x11')]);}else{logger[_0x4833('0x12')]('Cdr,\x20%s,\x20%s',_0x21e7d0,_0x4833('0xb'));_0x2d8623(_0x2eb04b[_0x4833('0x13')]['message']);}})['catch'](function(_0x496b4c){logger[_0x4833('0xf')](_0x4833('0xa'),_0x21e7d0,_0x496b4c);_0x117946(_0x496b4c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index f3380ab..a044686 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 _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(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_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['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 f12cb98..b4c8bdb 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 _0xa0e3=['*,*,*,*','exports','TEXT','STRING'];(function(_0x523b3a,_0xae9ce5){var _0x5b94f7=function(_0x5619b3){while(--_0x5619b3){_0x523b3a['push'](_0x523b3a['shift']());}};_0x5b94f7(++_0xae9ce5);}(_0xa0e3,0x121));var _0x3a0e=function(_0x8c65e3,_0x446458){_0x8c65e3=_0x8c65e3-0x0;var _0x4d6e2a=_0xa0e3[_0x8c65e3];return _0x4d6e2a;};'use strict';var Sequelize=require('sequelize');module[_0x3a0e('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3a0e('0x1')]()},'description':{'type':Sequelize[_0x3a0e('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3a0e('0x3')}}; \ No newline at end of file +var _0x42d0=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x4b0fff,_0x2eff9e){var _0x379192=function(_0x7cb9cd){while(--_0x7cb9cd){_0x4b0fff['push'](_0x4b0fff['shift']());}};_0x379192(++_0x2eff9e);}(_0x42d0,0xc2));var _0x042d=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0x42d0[_0x919445];return _0x511b3e;};'use strict';var Sequelize=require(_0x042d('0x0'));module[_0x042d('0x1')]={'priority':{'type':Sequelize[_0x042d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x042d('0x3')],'allowNull':![],'defaultValue':_0x042d('0x4')},'appdata':{'type':Sequelize[_0x042d('0x5')]()},'description':{'type':Sequelize[_0x042d('0x3')]},'interval':{'type':Sequelize[_0x042d('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index a8115c1..9d4e827 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 _0x4746=['offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','params','keys','ChatApplication','rawAttributes','query','filters','model','attributes','intersection','fields','include','merge','options','find','catch','update','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4af1fd,_0x166611){var _0x2acc3a=function(_0x32aa97){while(--_0x32aa97){_0x4af1fd['push'](_0x4af1fd['shift']());}};_0x2acc3a(++_0x166611);}(_0x4746,0xc6));var _0x6474=function(_0x4b64ed,_0x349f25){_0x4b64ed=_0x4b64ed-0x0;var _0x2ec959=_0x4746[_0x4b64ed];return _0x2ec959;};'use strict';var emlformat=require(_0x6474('0x0'));var rimraf=require(_0x6474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6474('0x2'));var rp=require('request-promise');var moment=require(_0x6474('0x3'));var BPromise=require(_0x6474('0x4'));var Mustache=require(_0x6474('0x5'));var util=require(_0x6474('0x6'));var path=require(_0x6474('0x7'));var sox=require('sox');var csv=require(_0x6474('0x8'));var ejs=require(_0x6474('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6474('0xa'));var squel=require(_0x6474('0xb'));var crypto=require(_0x6474('0xc'));var jsforce=require(_0x6474('0xd'));var deskjs=require(_0x6474('0xe'));var toCsv=require(_0x6474('0x8'));var querystring=require('querystring');var Papa=require(_0x6474('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6474('0x10'));var as=require(_0x6474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6474('0x12'))('api');var utils=require(_0x6474('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6474('0x14'));var db=require(_0x6474('0x15'))['db'];function respondWithStatusCode(_0x5509d2,_0x4936c2){_0x4936c2=_0x4936c2||0xcc;return function(_0x5cf0de){if(_0x5cf0de){return _0x5509d2[_0x6474('0x16')](_0x4936c2);}return _0x5509d2[_0x6474('0x17')](_0x4936c2)[_0x6474('0x18')]();};}function respondWithResult(_0xad1ebe,_0x113aba){_0x113aba=_0x113aba||0xc8;return function(_0x37fe08){if(_0x37fe08){return _0xad1ebe[_0x6474('0x17')](_0x113aba)[_0x6474('0x19')](_0x37fe08);}};}function respondWithFilteredResult(_0x29b935,_0x5cf8fa){return function(_0x5ee279){if(_0x5ee279){var _0x583afa=typeof _0x5cf8fa[_0x6474('0x1a')]===_0x6474('0x1b')&&typeof _0x5cf8fa[_0x6474('0x1c')]===_0x6474('0x1b');var _0x195465=_0x5ee279['count'];var _0x1505fc=_0x583afa?0x0:_0x5cf8fa[_0x6474('0x1a')];var _0xb6ecb6=_0x583afa?_0x5ee279[_0x6474('0x1d')]:_0x5cf8fa[_0x6474('0x1a')]+_0x5cf8fa[_0x6474('0x1c')];var _0x2e33f0;if(_0xb6ecb6>=_0x195465){_0xb6ecb6=_0x195465;_0x2e33f0=0xc8;}else{_0x2e33f0=0xce;}_0x29b935[_0x6474('0x17')](_0x2e33f0);return _0x29b935['set'](_0x6474('0x1e'),_0x1505fc+'-'+_0xb6ecb6+'/'+_0x195465)['json'](_0x5ee279);}return null;};}function patchUpdates(_0xd23b18){return function(_0x1df53c){try{jsonpatch[_0x6474('0x1f')](_0x1df53c,_0xd23b18,!![]);}catch(_0x185760){return BPromise[_0x6474('0x20')](_0x185760);}return _0x1df53c[_0x6474('0x21')]();};}function saveUpdates(_0x382ebf,_0x5d0e5c){return function(_0xf3cd65){if(_0xf3cd65){return _0xf3cd65['update'](_0x382ebf)[_0x6474('0x22')](function(_0x4dc277){return _0x4dc277;});}return null;};}function removeEntity(_0x4ba645,_0x58e024){return function(_0xb67896){if(_0xb67896){return _0xb67896[_0x6474('0x23')]()[_0x6474('0x22')](function(){_0x4ba645[_0x6474('0x17')](0xcc)[_0x6474('0x18')]();});}};}function handleEntityNotFound(_0x4a9cb6,_0x7020fb){return function(_0x388d2d){if(!_0x388d2d){_0x4a9cb6[_0x6474('0x16')](0x194);}return _0x388d2d;};}function handleError(_0x698040,_0x559b33){_0x559b33=_0x559b33||0x1f4;return function(_0x587b7a){logger[_0x6474('0x24')](_0x587b7a[_0x6474('0x25')]);if(_0x587b7a[_0x6474('0x26')]){delete _0x587b7a[_0x6474('0x26')];}_0x698040['status'](_0x559b33)['send'](_0x587b7a);};}exports['show']=function(_0x4b81f3,_0x3333a8){var _0x28d445={'raw':!![],'where':{'id':_0x4b81f3[_0x6474('0x27')]['id']}},_0x1751bc={};_0x1751bc['model']=_[_0x6474('0x28')](db[_0x6474('0x29')][_0x6474('0x2a')]);_0x1751bc[_0x6474('0x2b')]=_[_0x6474('0x28')](_0x4b81f3[_0x6474('0x2b')]);_0x1751bc[_0x6474('0x2c')]=_['intersection'](_0x1751bc[_0x6474('0x2d')],_0x1751bc[_0x6474('0x2b')]);_0x28d445[_0x6474('0x2e')]=_[_0x6474('0x2f')](_0x1751bc['model'],qs['fields'](_0x4b81f3['query'][_0x6474('0x30')]));_0x28d445[_0x6474('0x2e')]=_0x28d445[_0x6474('0x2e')]['length']?_0x28d445[_0x6474('0x2e')]:_0x1751bc[_0x6474('0x2d')];if(_0x4b81f3[_0x6474('0x2b')]['includeAll']){_0x28d445[_0x6474('0x31')]=[{'all':!![]}];}_0x28d445=_[_0x6474('0x32')]({},_0x28d445,_0x4b81f3[_0x6474('0x33')]);return db['ChatApplication'][_0x6474('0x34')](_0x28d445)[_0x6474('0x22')](handleEntityNotFound(_0x3333a8,null))['then'](respondWithResult(_0x3333a8,null))[_0x6474('0x35')](handleError(_0x3333a8,null));};exports[_0x6474('0x36')]=function(_0x9289c8,_0x295d3f){if(_0x9289c8[_0x6474('0x37')]['id']){delete _0x9289c8['body']['id'];}return db[_0x6474('0x29')][_0x6474('0x34')]({'where':{'id':_0x9289c8['params']['id']}})['then'](handleEntityNotFound(_0x295d3f,null))[_0x6474('0x22')](saveUpdates(_0x9289c8['body'],null))[_0x6474('0x22')](respondWithResult(_0x295d3f,null))[_0x6474('0x35')](handleError(_0x295d3f,null));};exports[_0x6474('0x23')]=function(_0x410b6a,_0x52301d){return db['ChatApplication']['find']({'where':{'id':_0x410b6a[_0x6474('0x27')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x52301d,null))[_0x6474('0x22')](removeEntity(_0x52301d,null))['catch'](handleError(_0x52301d,null));}; \ No newline at end of file +var _0x0f69=['../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','length','attributes','includeAll','include','merge','find','catch','body','params','destroy','zip-dir','request-promise','moment','mustache','util','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'];(function(_0x107f52,_0x27401a){var _0x3be952=function(_0x24bf38){while(--_0x24bf38){_0x107f52['push'](_0x107f52['shift']());}};_0x3be952(++_0x27401a);}(_0x0f69,0x173));var _0x90f6=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x0f69[_0x11c573];return _0x6b72de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x90f6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90f6('0x1'));var moment=require(_0x90f6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x90f6('0x3'));var util=require(_0x90f6('0x4'));var path=require('path');var sox=require(_0x90f6('0x5'));var csv=require('to-csv');var ejs=require(_0x90f6('0x6'));var fs=require('fs');var fs_extra=require(_0x90f6('0x7'));var _=require(_0x90f6('0x8'));var squel=require(_0x90f6('0x9'));var crypto=require(_0x90f6('0xa'));var jsforce=require(_0x90f6('0xb'));var deskjs=require(_0x90f6('0xc'));var toCsv=require(_0x90f6('0xd'));var querystring=require(_0x90f6('0xe'));var Papa=require(_0x90f6('0xf'));var Redis=require(_0x90f6('0x10'));var authService=require(_0x90f6('0x11'));var qs=require(_0x90f6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f6('0x13'));var logger=require(_0x90f6('0x14'))('api');var utils=require(_0x90f6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x90f6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4aa86a,_0x13ca42){_0x13ca42=_0x13ca42||0xcc;return function(_0x47e1e6){if(_0x47e1e6){return _0x4aa86a[_0x90f6('0x17')](_0x13ca42);}return _0x4aa86a[_0x90f6('0x18')](_0x13ca42)[_0x90f6('0x19')]();};}function respondWithResult(_0x189351,_0x47fd3c){_0x47fd3c=_0x47fd3c||0xc8;return function(_0x3c7b60){if(_0x3c7b60){return _0x189351['status'](_0x47fd3c)['json'](_0x3c7b60);}};}function respondWithFilteredResult(_0x36803b,_0x598737){return function(_0x85ba42){if(_0x85ba42){var _0x16d692=typeof _0x598737[_0x90f6('0x1a')]===_0x90f6('0x1b')&&typeof _0x598737[_0x90f6('0x1c')]===_0x90f6('0x1b');var _0x2cb207=_0x85ba42['count'];var _0x36682a=_0x16d692?0x0:_0x598737[_0x90f6('0x1a')];var _0x5ac9be=_0x16d692?_0x85ba42[_0x90f6('0x1d')]:_0x598737[_0x90f6('0x1a')]+_0x598737[_0x90f6('0x1c')];var _0x12f0c4;if(_0x5ac9be>=_0x2cb207){_0x5ac9be=_0x2cb207;_0x12f0c4=0xc8;}else{_0x12f0c4=0xce;}_0x36803b[_0x90f6('0x18')](_0x12f0c4);return _0x36803b[_0x90f6('0x1e')](_0x90f6('0x1f'),_0x36682a+'-'+_0x5ac9be+'/'+_0x2cb207)['json'](_0x85ba42);}return null;};}function patchUpdates(_0x1beb61){return function(_0x3bec2e){try{jsonpatch['apply'](_0x3bec2e,_0x1beb61,!![]);}catch(_0x56a73e){return BPromise[_0x90f6('0x20')](_0x56a73e);}return _0x3bec2e['save']();};}function saveUpdates(_0x480cd5,_0x763a9b){return function(_0x520e2c){if(_0x520e2c){return _0x520e2c[_0x90f6('0x21')](_0x480cd5)[_0x90f6('0x22')](function(_0x300139){return _0x300139;});}return null;};}function removeEntity(_0x31f4ac,_0x31bec5){return function(_0x209244){if(_0x209244){return _0x209244['destroy']()[_0x90f6('0x22')](function(){_0x31f4ac['status'](0xcc)[_0x90f6('0x19')]();});}};}function handleEntityNotFound(_0x1b22d5,_0x2e7816){return function(_0x2c280b){if(!_0x2c280b){_0x1b22d5[_0x90f6('0x17')](0x194);}return _0x2c280b;};}function handleError(_0x304441,_0x291b62){_0x291b62=_0x291b62||0x1f4;return function(_0x21ed7){logger['error'](_0x21ed7[_0x90f6('0x23')]);if(_0x21ed7['name']){delete _0x21ed7['name'];}_0x304441['status'](_0x291b62)[_0x90f6('0x24')](_0x21ed7);};}exports[_0x90f6('0x25')]=function(_0x55b92f,_0x31f9cb){var _0x16a770={'raw':!![],'where':{'id':_0x55b92f['params']['id']}},_0x1bff1e={};_0x1bff1e[_0x90f6('0x26')]=_[_0x90f6('0x27')](db[_0x90f6('0x28')][_0x90f6('0x29')]);_0x1bff1e[_0x90f6('0x2a')]=_[_0x90f6('0x27')](_0x55b92f[_0x90f6('0x2a')]);_0x1bff1e[_0x90f6('0x2b')]=_['intersection'](_0x1bff1e['model'],_0x1bff1e['query']);_0x16a770['attributes']=_[_0x90f6('0x2c')](_0x1bff1e['model'],qs[_0x90f6('0x2d')](_0x55b92f[_0x90f6('0x2a')]['fields']));_0x16a770['attributes']=_0x16a770['attributes'][_0x90f6('0x2e')]?_0x16a770[_0x90f6('0x2f')]:_0x1bff1e[_0x90f6('0x26')];if(_0x55b92f[_0x90f6('0x2a')][_0x90f6('0x30')]){_0x16a770[_0x90f6('0x31')]=[{'all':!![]}];}_0x16a770=_[_0x90f6('0x32')]({},_0x16a770,_0x55b92f['options']);return db[_0x90f6('0x28')][_0x90f6('0x33')](_0x16a770)[_0x90f6('0x22')](handleEntityNotFound(_0x31f9cb,null))[_0x90f6('0x22')](respondWithResult(_0x31f9cb,null))[_0x90f6('0x34')](handleError(_0x31f9cb,null));};exports['update']=function(_0x2e5e22,_0x17ef33){if(_0x2e5e22[_0x90f6('0x35')]['id']){delete _0x2e5e22[_0x90f6('0x35')]['id'];}return db[_0x90f6('0x28')][_0x90f6('0x33')]({'where':{'id':_0x2e5e22[_0x90f6('0x36')]['id']}})['then'](handleEntityNotFound(_0x17ef33,null))[_0x90f6('0x22')](saveUpdates(_0x2e5e22[_0x90f6('0x35')],null))[_0x90f6('0x22')](respondWithResult(_0x17ef33,null))[_0x90f6('0x34')](handleError(_0x17ef33,null));};exports[_0x90f6('0x37')]=function(_0x410177,_0x14140d){return db[_0x90f6('0x28')][_0x90f6('0x33')]({'where':{'id':_0x410177[_0x90f6('0x36')]['id']}})[_0x90f6('0x22')](handleEntityNotFound(_0x14140d,null))[_0x90f6('0x22')](removeEntity(_0x14140d,null))[_0x90f6('0x34')](handleError(_0x14140d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5e46d21..253c80d 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 _0x5034=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4'];(function(_0x255e6a,_0x4ad4f0){var _0x18a38a=function(_0x4ae7da){while(--_0x4ae7da){_0x255e6a['push'](_0x255e6a['shift']());}};_0x18a38a(++_0x4ad4f0);}(_0x5034,0x8d));var _0x4503=function(_0x17a7e7,_0x59910c){_0x17a7e7=_0x17a7e7-0x0;var _0x1dd5a0=_0x5034[_0x17a7e7];return _0x1dd5a0;};'use strict';var _=require(_0x4503('0x0'));var util=require(_0x4503('0x1'));var logger=require(_0x4503('0x2'))('api');var moment=require(_0x4503('0x3'));var BPromise=require(_0x4503('0x4'));var rp=require(_0x4503('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4503('0x6'));var config=require(_0x4503('0x7'));var attributes=require(_0x4503('0x8'));module[_0x4503('0x9')]=function(_0x217cd4,_0x516a40){return _0x217cd4['define'](_0x4503('0xa'),attributes,{'tableName':_0x4503('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4503('0xc'),'collate':_0x4503('0xd')});}; \ No newline at end of file +var _0x933b=['chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','exports','define'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0x933b,0x16e));var _0xb933=function(_0x1bea75,_0xf76ca0){_0x1bea75=_0x1bea75-0x0;var _0x5a41cf=_0x933b[_0x1bea75];return _0x5a41cf;};'use strict';var _=require(_0xb933('0x0'));var util=require(_0xb933('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb933('0x2'));var BPromise=require(_0xb933('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb933('0x4'));var rimraf=require(_0xb933('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xb933('0x6')]=function(_0x322df5,_0x105a1f){return _0x322df5[_0xb933('0x7')]('ChatApplication',attributes,{'tableName':_0xb933('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb933('0x9'),'collate':_0xb933('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e9ad81e..14fd3c5 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 _0x513a=['jayson/promise','client','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x38ffec,_0xa82d03){var _0x4b9797=function(_0x2e3d7c){while(--_0x2e3d7c){_0x38ffec['push'](_0x38ffec['shift']());}};_0x4b9797(++_0xa82d03);}(_0x513a,0xfc));var _0xa513=function(_0x326406,_0x5aa772){_0x326406=_0x326406-0x0;var _0x30abe7=_0x513a[_0x326406];return _0x30abe7;};'use strict';var _=require(_0xa513('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa513('0x1'));var rs=require(_0xa513('0x2'));var fs=require('fs');var Redis=require(_0xa513('0x3'));var db=require(_0xa513('0x4'))['db'];var utils=require(_0xa513('0x5'));var logger=require('../../config/logger')(_0xa513('0x6'));var config=require(_0xa513('0x7'));var jayson=require(_0xa513('0x8'));var client=jayson[_0xa513('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54cde5,_0x1f6954,_0x1ca569){return new BPromise(function(_0x18b007,_0x220d47){return client['request'](_0x54cde5,_0x1ca569)['then'](function(_0x105b5d){logger[_0xa513('0xa')](_0xa513('0xb'),_0x1f6954,_0xa513('0xc'));logger[_0xa513('0xd')](_0xa513('0xe'),_0x1f6954,_0xa513('0xc'),JSON['stringify'](_0x105b5d));if(_0x105b5d[_0xa513('0xf')]){if(_0x105b5d[_0xa513('0xf')][_0xa513('0x10')]===0x1f4){logger[_0xa513('0xf')](_0xa513('0xb'),_0x1f6954,_0x105b5d['error'][_0xa513('0x11')]);return _0x220d47(_0x105b5d['error'][_0xa513('0x11')]);}logger[_0xa513('0xf')](_0xa513('0xb'),_0x1f6954,_0x105b5d[_0xa513('0xf')][_0xa513('0x11')]);return _0x18b007(_0x105b5d[_0xa513('0xf')]['message']);}else{logger[_0xa513('0xa')](_0xa513('0xb'),_0x1f6954,_0xa513('0xc'));_0x18b007(_0x105b5d[_0xa513('0x12')][_0xa513('0x11')]);}})[_0xa513('0x13')](function(_0x2e7bcc){logger[_0xa513('0xf')](_0xa513('0xb'),_0x1f6954,_0x2e7bcc);_0x220d47(_0x2e7bcc);});});} \ No newline at end of file +var _0xce01=['../../config/environment','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xef09a2,_0x1e2d64){var _0x390a34=function(_0x1be616){while(--_0x1be616){_0xef09a2['push'](_0xef09a2['shift']());}};_0x390a34(++_0x1e2d64);}(_0xce01,0x6b));var _0x1ce0=function(_0x4df531,_0x4d99f6){_0x4df531=_0x4df531-0x0;var _0x4bb657=_0xce01[_0x4df531];return _0x4bb657;};'use strict';var _=require(_0x1ce0('0x0'));var util=require(_0x1ce0('0x1'));var moment=require('moment');var BPromise=require(_0x1ce0('0x2'));var rs=require(_0x1ce0('0x3'));var fs=require('fs');var Redis=require(_0x1ce0('0x4'));var db=require(_0x1ce0('0x5'))['db'];var utils=require(_0x1ce0('0x6'));var logger=require(_0x1ce0('0x7'))('rpc');var config=require(_0x1ce0('0x8'));var jayson=require(_0x1ce0('0x9'));var client=jayson['client'][_0x1ce0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422715,_0x5d6958,_0x290aa2){return new BPromise(function(_0x3250a1,_0xbb4dec){return client[_0x1ce0('0xb')](_0x422715,_0x290aa2)[_0x1ce0('0xc')](function(_0x497dd1){logger[_0x1ce0('0xd')](_0x1ce0('0xe'),_0x5d6958,'request\x20sent');logger[_0x1ce0('0xf')](_0x1ce0('0x10'),_0x5d6958,_0x1ce0('0x11'),JSON[_0x1ce0('0x12')](_0x497dd1));if(_0x497dd1['error']){if(_0x497dd1['error'][_0x1ce0('0x13')]===0x1f4){logger[_0x1ce0('0x14')](_0x1ce0('0xe'),_0x5d6958,_0x497dd1[_0x1ce0('0x14')][_0x1ce0('0x15')]);return _0xbb4dec(_0x497dd1['error']['message']);}logger['error'](_0x1ce0('0xe'),_0x5d6958,_0x497dd1['error'][_0x1ce0('0x15')]);return _0x3250a1(_0x497dd1[_0x1ce0('0x14')]['message']);}else{logger[_0x1ce0('0xd')](_0x1ce0('0xe'),_0x5d6958,'request\x20sent');_0x3250a1(_0x497dd1[_0x1ce0('0x16')][_0x1ce0('0x15')]);}})['catch'](function(_0x376ccf){logger[_0x1ce0('0x14')](_0x1ce0('0xe'),_0x5d6958,_0x376ccf);_0xbb4dec(_0x376ccf);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a7ced68..021734c 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 _0xd1ee=['/:id','isAuthenticated','show','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller'];(function(_0x53e5b2,_0x24408a){var _0x5e2a1b=function(_0x5ee4a8){while(--_0x5ee4a8){_0x53e5b2['push'](_0x53e5b2['shift']());}};_0x5e2a1b(++_0x24408a);}(_0xd1ee,0xe8));var _0xed1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd1ee[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xed1e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xed1e('0x1'));var express=require(_0xed1e('0x2'));var router=express[_0xed1e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xed1e('0x4'));var interaction=require(_0xed1e('0x5'));var config=require(_0xed1e('0x6'));var controller=require(_0xed1e('0x7'));router['get'](_0xed1e('0x8'),auth[_0xed1e('0x9')](),controller[_0xed1e('0xa')]);router[_0xed1e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xed1e('0xc')]);router[_0xed1e('0xd')](_0xed1e('0x8'),auth[_0xed1e('0x9')](),controller[_0xed1e('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3f95=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','update','destroy','multer','util','path'];(function(_0x3eac36,_0x47a2d1){var _0x4319f6=function(_0x444df7){while(--_0x444df7){_0x3eac36['push'](_0x3eac36['shift']());}};_0x4319f6(++_0x47a2d1);}(_0x3f95,0x66));var _0x53f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3f95[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x53f9('0x0'));var util=require(_0x53f9('0x1'));var path=require(_0x53f9('0x2'));var timeout=require(_0x53f9('0x3'));var express=require('express');var router=express[_0x53f9('0x4')]();var fs_extra=require(_0x53f9('0x5'));var auth=require(_0x53f9('0x6'));var interaction=require(_0x53f9('0x7'));var config=require(_0x53f9('0x8'));var controller=require(_0x53f9('0x9'));router[_0x53f9('0xa')](_0x53f9('0xb'),auth[_0x53f9('0xc')](),controller['show']);router['put'](_0x53f9('0xb'),auth[_0x53f9('0xc')](),controller[_0x53f9('0xd')]);router['delete'](_0x53f9('0xb'),auth['isAuthenticated'](),controller[_0x53f9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a142de4..e17570b 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 _0x3f1b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2aa416,_0x5917ed){var _0x44a874=function(_0x4dc958){while(--_0x4dc958){_0x2aa416['push'](_0x2aa416['shift']());}};_0x44a874(++_0x5917ed);}(_0x3f1b,0xcc));var _0xb3f1=function(_0xe70445,_0x4a196b){_0xe70445=_0xe70445-0x0;var _0x4b6d5c=_0x3f1b[_0xe70445];return _0x4b6d5c;};'use strict';var Sequelize=require(_0xb3f1('0x0'));module[_0xb3f1('0x1')]={'name':{'type':Sequelize[_0xb3f1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb3f1('0x2')]},'write':{'type':Sequelize[_0xb3f1('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xa7c8=['BOOLEAN','sequelize','STRING'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa7c8,0x82));var _0x8a7c=function(_0x1223b6,_0x180811){_0x1223b6=_0x1223b6-0x0;var _0x361c17=_0xa7c8[_0x1223b6];return _0x361c17;};'use strict';var Sequelize=require(_0x8a7c('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a7c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8a7c('0x1')]},'write':{'type':Sequelize[_0x8a7c('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index cc4707d..0ed4791 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 _0xa94d=['count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','keys','length','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','User','getMembers','removeMembers','addMessage','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined'];(function(_0x2ab498,_0x3c9672){var _0x4be0f4=function(_0x4d0cdf){while(--_0x4d0cdf){_0x2ab498['push'](_0x2ab498['shift']());}};_0x4be0f4(++_0x3c9672);}(_0xa94d,0xa2));var _0xda94=function(_0x146c2d,_0x2aa26a){_0x146c2d=_0x146c2d-0x0;var _0xa7eee6=_0xa94d[_0x146c2d];return _0xa7eee6;};'use strict';var emlformat=require(_0xda94('0x0'));var rimraf=require(_0xda94('0x1'));var zipdir=require(_0xda94('0x2'));var jsonpatch=require(_0xda94('0x3'));var rp=require(_0xda94('0x4'));var moment=require(_0xda94('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda94('0x6'));var path=require(_0xda94('0x7'));var sox=require(_0xda94('0x8'));var csv=require(_0xda94('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda94('0xa'));var _=require(_0xda94('0xb'));var squel=require(_0xda94('0xc'));var crypto=require(_0xda94('0xd'));var jsforce=require(_0xda94('0xe'));var deskjs=require(_0xda94('0xf'));var toCsv=require(_0xda94('0x9'));var querystring=require(_0xda94('0x10'));var Papa=require(_0xda94('0x11'));var Redis=require(_0xda94('0x12'));var authService=require(_0xda94('0x13'));var qs=require(_0xda94('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda94('0x15'));var logger=require(_0xda94('0x16'))(_0xda94('0x17'));var utils=require(_0xda94('0x18'));var config=require(_0xda94('0x19'));var licenseUtil=require(_0xda94('0x1a'));var db=require(_0xda94('0x1b'))['db'];config[_0xda94('0x1c')]=_[_0xda94('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xda94('0x1e'))(new Redis(config[_0xda94('0x1c')]));require(_0xda94('0x1f'))[_0xda94('0x20')](socket);function respondWithStatusCode(_0x38201e,_0x719c8a){_0x719c8a=_0x719c8a||0xcc;return function(_0x3e76e8){if(_0x3e76e8){return _0x38201e[_0xda94('0x21')](_0x719c8a);}return _0x38201e[_0xda94('0x22')](_0x719c8a)[_0xda94('0x23')]();};}function respondWithResult(_0xfe7dae,_0x144f67){_0x144f67=_0x144f67||0xc8;return function(_0x3b6b90){if(_0x3b6b90){return _0xfe7dae['status'](_0x144f67)['json'](_0x3b6b90);}};}function respondWithFilteredResult(_0x51cac7,_0x3482e3){return function(_0x1d8507){if(_0x1d8507){var _0x3e3cb3=typeof _0x3482e3[_0xda94('0x24')]===_0xda94('0x25')&&typeof _0x3482e3['limit']==='undefined';var _0x223e4b=_0x1d8507[_0xda94('0x26')];var _0x5ee695=_0x3e3cb3?0x0:_0x3482e3[_0xda94('0x24')];var _0x3502b1=_0x3e3cb3?_0x1d8507[_0xda94('0x26')]:_0x3482e3[_0xda94('0x24')]+_0x3482e3['limit'];var _0x4fd5d0;if(_0x3502b1>=_0x223e4b){_0x3502b1=_0x223e4b;_0x4fd5d0=0xc8;}else{_0x4fd5d0=0xce;}_0x51cac7[_0xda94('0x22')](_0x4fd5d0);return _0x51cac7[_0xda94('0x27')](_0xda94('0x28'),_0x5ee695+'-'+_0x3502b1+'/'+_0x223e4b)[_0xda94('0x29')](_0x1d8507);}return null;};}function patchUpdates(_0x363e46){return function(_0x1147bc){try{jsonpatch['apply'](_0x1147bc,_0x363e46,!![]);}catch(_0x347f89){return BPromise['reject'](_0x347f89);}return _0x1147bc[_0xda94('0x2a')]();};}function saveUpdates(_0xfdcf37,_0x40aadc){return function(_0xb36935){if(_0xb36935){return _0xb36935[_0xda94('0x2b')](_0xfdcf37)[_0xda94('0x2c')](function(_0x4abeaa){return _0x4abeaa;});}return null;};}function removeEntity(_0x1832d2,_0x4ef3e8){return function(_0x314a1b){if(_0x314a1b){return _0x314a1b[_0xda94('0x2d')]()[_0xda94('0x2c')](function(){_0x1832d2[_0xda94('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e12f6,_0x1dac82){return function(_0x591629){if(!_0x591629){_0x5e12f6[_0xda94('0x21')](0x194);}return _0x591629;};}function handleError(_0x10c79f,_0x7278cb){_0x7278cb=_0x7278cb||0x1f4;return function(_0x389ed3){logger[_0xda94('0x2e')](_0x389ed3[_0xda94('0x2f')]);if(_0x389ed3[_0xda94('0x30')]){delete _0x389ed3[_0xda94('0x30')];}_0x10c79f[_0xda94('0x22')](_0x7278cb)[_0xda94('0x31')](_0x389ed3);};}exports['index']=function(_0x795116,_0xdacd7a){var _0x40b869={},_0x4d9753={},_0x480277={'count':0x0,'rows':[]};var _0x2d6158=_[_0xda94('0x32')](db[_0xda94('0x33')][_0xda94('0x34')],function(_0xe97beb){return{'name':_0xe97beb[_0xda94('0x35')],'type':_0xe97beb[_0xda94('0x36')][_0xda94('0x37')]};});_0x4d9753[_0xda94('0x38')]=_[_0xda94('0x32')](_0x2d6158,'name');_0x4d9753[_0xda94('0x39')]=_['keys'](_0x795116[_0xda94('0x39')]);_0x4d9753[_0xda94('0x3a')]=_[_0xda94('0x3b')](_0x4d9753[_0xda94('0x38')],_0x4d9753[_0xda94('0x39')]);_0x40b869[_0xda94('0x3c')]=_[_0xda94('0x3b')](_0x4d9753['model'],qs['fields'](_0x795116[_0xda94('0x39')][_0xda94('0x3d')]));_0x40b869['attributes']=_0x40b869[_0xda94('0x3c')]['length']?_0x40b869[_0xda94('0x3c')]:_0x4d9753['model'];if(!_0x795116[_0xda94('0x39')][_0xda94('0x3e')](_0xda94('0x3f'))){_0x40b869['limit']=qs[_0xda94('0x40')](_0x795116[_0xda94('0x39')][_0xda94('0x40')]);_0x40b869[_0xda94('0x24')]=qs[_0xda94('0x24')](_0x795116[_0xda94('0x39')][_0xda94('0x24')]);}_0x40b869[_0xda94('0x41')]=qs[_0xda94('0x42')](_0x795116[_0xda94('0x39')][_0xda94('0x42')]);_0x40b869[_0xda94('0x43')]=qs[_0xda94('0x3a')](_[_0xda94('0x44')](_0x795116[_0xda94('0x39')],_0x4d9753[_0xda94('0x3a')]),_0x2d6158);if(_0x795116[_0xda94('0x39')][_0xda94('0x45')]){_0x40b869[_0xda94('0x43')]=_[_0xda94('0x46')](_0x40b869['where'],{'$or':_[_0xda94('0x32')](_0x2d6158,function(_0x2d0db5){if(_0x2d0db5[_0xda94('0x36')]!==_0xda94('0x47')){var _0x55a327={};_0x55a327[_0x2d0db5[_0xda94('0x30')]]={'$like':'%'+_0x795116[_0xda94('0x39')][_0xda94('0x45')]+'%'};return _0x55a327;}})});}_0x40b869=_[_0xda94('0x46')]({},_0x40b869,_0x795116['options']);var _0x276a3b={'where':_0x40b869[_0xda94('0x43')]};return db[_0xda94('0x33')][_0xda94('0x26')](_0x276a3b)[_0xda94('0x2c')](function(_0x2ffd14){_0x480277[_0xda94('0x26')]=_0x2ffd14;if(_0x795116['query'][_0xda94('0x48')]){_0x40b869['include']=[{'all':!![]}];}return db['ChatGroup'][_0xda94('0x49')](_0x40b869);})[_0xda94('0x2c')](function(_0x11e1db){_0x480277[_0xda94('0x4a')]=_0x11e1db;return _0x480277;})[_0xda94('0x2c')](respondWithFilteredResult(_0xdacd7a,_0x40b869))[_0xda94('0x4b')](handleError(_0xdacd7a,null));};exports[_0xda94('0x4c')]=function(_0x1b8745,_0x2da3f5){var _0x4da956={'raw':!![],'where':{'id':_0x1b8745['params']['id']}},_0x3aa7c6={};_0x3aa7c6['model']=_[_0xda94('0x4d')](db['ChatGroup'][_0xda94('0x34')]);_0x3aa7c6[_0xda94('0x39')]=_[_0xda94('0x4d')](_0x1b8745[_0xda94('0x39')]);_0x3aa7c6[_0xda94('0x3a')]=_[_0xda94('0x3b')](_0x3aa7c6[_0xda94('0x38')],_0x3aa7c6[_0xda94('0x39')]);_0x4da956[_0xda94('0x3c')]=_[_0xda94('0x3b')](_0x3aa7c6[_0xda94('0x38')],qs['fields'](_0x1b8745[_0xda94('0x39')][_0xda94('0x3d')]));_0x4da956['attributes']=_0x4da956[_0xda94('0x3c')][_0xda94('0x4e')]?_0x4da956[_0xda94('0x3c')]:_0x3aa7c6[_0xda94('0x38')];if(_0x1b8745[_0xda94('0x39')][_0xda94('0x48')]){_0x4da956['include']=[{'all':!![]}];}_0x4da956=_[_0xda94('0x46')]({},_0x4da956,_0x1b8745['options']);return db['ChatGroup'][_0xda94('0x4f')](_0x4da956)[_0xda94('0x2c')](handleEntityNotFound(_0x2da3f5,null))[_0xda94('0x2c')](respondWithResult(_0x2da3f5,null))['catch'](handleError(_0x2da3f5,null));};exports[_0xda94('0x50')]=function(_0x2024ad,_0x44291d){return db['ChatGroup']['create'](_0x2024ad['body'],{})[_0xda94('0x2c')](respondWithResult(_0x44291d,0xc9))[_0xda94('0x4b')](handleError(_0x44291d,null));};exports[_0xda94('0x2b')]=function(_0x57f3dd,_0x5c6336){if(_0x57f3dd[_0xda94('0x51')]['id']){delete _0x57f3dd[_0xda94('0x51')]['id'];}return db[_0xda94('0x33')][_0xda94('0x4f')]({'where':{'id':_0x57f3dd[_0xda94('0x52')]['id']}})['then'](handleEntityNotFound(_0x5c6336,null))['then'](saveUpdates(_0x57f3dd['body'],null))['then'](respondWithResult(_0x5c6336,null))[_0xda94('0x4b')](handleError(_0x5c6336,null));};exports[_0xda94('0x2d')]=function(_0x3dfb8d,_0x53d85e){return db[_0xda94('0x33')]['find']({'where':{'id':_0x3dfb8d[_0xda94('0x52')]['id']}})[_0xda94('0x2c')](handleEntityNotFound(_0x53d85e,null))[_0xda94('0x2c')](removeEntity(_0x53d85e,null))[_0xda94('0x4b')](handleError(_0x53d85e,null));};exports['describe']=function(_0x4da3ee,_0x13b340){return db[_0xda94('0x33')][_0xda94('0x53')]()['then'](respondWithResult(_0x13b340,null))[_0xda94('0x4b')](handleError(_0x13b340,null));};exports[_0xda94('0x54')]=function(_0x43ae5c,_0x4cff72,_0x2ec5be){return db[_0xda94('0x55')]['count']({'where':{'ChatGroupId':_0x43ae5c[_0xda94('0x52')]['id'],'ToId':_0x43ae5c[_0xda94('0x56')]['id'],'read':![]}})['then'](function(_0x51edd2){return{'id':_[_0xda94('0x57')](_0x43ae5c[_0xda94('0x52')]['id']),'count':_0x51edd2};})[_0xda94('0x2c')](respondWithResult(_0x4cff72,null))[_0xda94('0x4b')](handleError(_0x4cff72,null));};exports[_0xda94('0x58')]=function(_0x3a7321,_0x206562,_0x4e6893){return db[_0xda94('0x33')]['find']({'where':{'id':_0x3a7321[_0xda94('0x52')]['id']}})[_0xda94('0x2c')](handleEntityNotFound(_0x206562,null))[_0xda94('0x2c')](function(_0x4d6b88){if(_0x4d6b88){return _0x4d6b88[_0xda94('0x58')](_0x3a7321[_0xda94('0x51')]['ids'],_[_0xda94('0x59')](_0x3a7321[_0xda94('0x51')],[_0xda94('0x5a'),'id'])||{});}})[_0xda94('0x2c')](respondWithResult(_0x206562,null))['catch'](handleError(_0x206562,null));};exports['getMembers']=function(_0x2c5b4d,_0x1fd13a,_0x5a2b0e){var _0x2c280b={};var _0x47aa86={};var _0x5072d6;var _0x5ef808;return db[_0xda94('0x33')]['findOne']({'where':{'id':_0x2c5b4d[_0xda94('0x52')]['id']}})[_0xda94('0x2c')](handleEntityNotFound(_0x1fd13a,null))[_0xda94('0x2c')](function(_0xfa9bf4){if(_0xfa9bf4){_0x5072d6=_0xfa9bf4;_0x47aa86[_0xda94('0x38')]=_[_0xda94('0x4d')](db[_0xda94('0x5b')][_0xda94('0x34')]);_0x47aa86[_0xda94('0x39')]=_[_0xda94('0x4d')](_0x2c5b4d[_0xda94('0x39')]);_0x47aa86['filters']=_[_0xda94('0x3b')](_0x47aa86[_0xda94('0x38')],_0x47aa86[_0xda94('0x39')]);_0x2c280b['attributes']=_[_0xda94('0x3b')](_0x47aa86[_0xda94('0x38')],qs[_0xda94('0x3d')](_0x2c5b4d[_0xda94('0x39')][_0xda94('0x3d')]));_0x2c280b[_0xda94('0x3c')]=_0x2c280b['attributes'][_0xda94('0x4e')]?_0x2c280b['attributes']:_0x47aa86[_0xda94('0x38')];_0x2c280b[_0xda94('0x41')]=qs[_0xda94('0x42')](_0x2c5b4d[_0xda94('0x39')]['sort']);_0x2c280b['where']=qs[_0xda94('0x3a')](_[_0xda94('0x44')](_0x2c5b4d['query'],_0x47aa86[_0xda94('0x3a')]));if(_0x2c5b4d[_0xda94('0x39')][_0xda94('0x45')]){_0x2c280b[_0xda94('0x43')]=_[_0xda94('0x46')](_0x2c280b[_0xda94('0x43')],{'$or':_[_0xda94('0x32')](_0x2c280b['attributes'],function(_0x344276){var _0x56d1f0={};_0x56d1f0[_0x344276]={'$like':'%'+_0x2c5b4d[_0xda94('0x39')]['filter']+'%'};return _0x56d1f0;})});}_0x2c280b=_['merge']({},_0x2c280b,_0x2c5b4d['options']);return _0x5072d6[_0xda94('0x5c')](_0x2c280b);}})[_0xda94('0x2c')](function(_0x3b427b){if(_0x3b427b){_0x5ef808=_0x3b427b[_0xda94('0x4e')];if(!_0x2c5b4d[_0xda94('0x39')]['hasOwnProperty'](_0xda94('0x3f'))){_0x2c280b[_0xda94('0x40')]=qs[_0xda94('0x40')](_0x2c5b4d[_0xda94('0x39')][_0xda94('0x40')]);_0x2c280b[_0xda94('0x24')]=qs[_0xda94('0x24')](_0x2c5b4d[_0xda94('0x39')][_0xda94('0x24')]);}return _0x5072d6['getMembers'](_0x2c280b);}})[_0xda94('0x2c')](function(_0x454435){if(_0x454435){return _0x454435?{'count':_0x5ef808,'rows':_0x454435}:null;}})['then'](respondWithResult(_0x1fd13a,null))[_0xda94('0x4b')](handleError(_0x1fd13a,null));};exports[_0xda94('0x5d')]=function(_0x269a48,_0x31f2b0,_0x2c6c17){return db['ChatGroup'][_0xda94('0x4f')]({'where':{'id':_0x269a48[_0xda94('0x52')]['id']}})['then'](handleEntityNotFound(_0x31f2b0,null))[_0xda94('0x2c')](function(_0x1a00f6){if(_0x1a00f6){return _0x1a00f6[_0xda94('0x5d')](_0x269a48[_0xda94('0x39')][_0xda94('0x5a')]);}})[_0xda94('0x2c')](respondWithStatusCode(_0x31f2b0,null))['catch'](handleError(_0x31f2b0,null));};exports[_0xda94('0x5e')]=function(_0x5e2af4,_0x7364cc,_0x589ca3){if(_0x5e2af4[_0xda94('0x51')]['id']){delete _0x5e2af4[_0xda94('0x51')]['id'];}return db[_0xda94('0x33')][_0xda94('0x4f')]({'where':{'id':_0x5e2af4[_0xda94('0x52')]['id']}})['then'](handleEntityNotFound(_0x7364cc,null))['then'](function(_0x1d2eed){if(_0x1d2eed){_0x5e2af4[_0xda94('0x51')]['ChatGroupId']=_0x1d2eed['id'];return db[_0xda94('0x55')][_0xda94('0x50')](_0x5e2af4[_0xda94('0x51')]);}})[_0xda94('0x2c')](respondWithResult(_0x7364cc,null))[_0xda94('0x4b')](handleError(_0x7364cc,null));};exports[_0xda94('0x5f')]=function(_0x9f9861,_0x2acf6e,_0x1ef025){var _0x1d48db={};var _0x449610={};var _0xba2d81;var _0xa7708f;return db[_0xda94('0x33')][_0xda94('0x60')]({'where':{'id':_0x9f9861['params']['id']}})['then'](handleEntityNotFound(_0x2acf6e,null))[_0xda94('0x2c')](function(_0x49587e){if(_0x49587e){_0xba2d81=_0x49587e;_0x449610[_0xda94('0x38')]=_['keys'](db['ChatInternalMessage'][_0xda94('0x34')]);_0x449610[_0xda94('0x39')]=_['keys'](_0x9f9861[_0xda94('0x39')]);_0x449610[_0xda94('0x3a')]=_['intersection'](_0x449610['model'],_0x449610[_0xda94('0x39')]);_0x1d48db[_0xda94('0x3c')]=_[_0xda94('0x3b')](_0x449610[_0xda94('0x38')],qs['fields'](_0x9f9861[_0xda94('0x39')][_0xda94('0x3d')]));_0x1d48db['attributes']=_0x1d48db['attributes']['length']?_0x1d48db[_0xda94('0x3c')]:_0x449610[_0xda94('0x38')];_0x1d48db[_0xda94('0x41')]=qs[_0xda94('0x42')](_0x9f9861[_0xda94('0x39')][_0xda94('0x42')]);_0x1d48db['where']=qs[_0xda94('0x3a')](_['pick'](_0x9f9861[_0xda94('0x39')],_0x449610[_0xda94('0x3a')]));if(_0x9f9861[_0xda94('0x39')][_0xda94('0x45')]){_0x1d48db[_0xda94('0x43')]=_[_0xda94('0x46')](_0x1d48db[_0xda94('0x43')],{'$or':_[_0xda94('0x32')](_0x1d48db[_0xda94('0x3c')],function(_0x5d8c32){var _0x5cefaa={};_0x5cefaa[_0x5d8c32]={'$like':'%'+_0x9f9861[_0xda94('0x39')][_0xda94('0x45')]+'%'};return _0x5cefaa;})});}if(_0x9f9861[_0xda94('0x39')][_0xda94('0x61')]){var _0x55f6eb=_0x9f9861[_0xda94('0x39')][_0xda94('0x61')]['split'](',');var _0x4ab15c={};_0x4ab15c[_0x55f6eb[0x0]]={'$gte':moment(_0x55f6eb[0x1])[_0xda94('0x62')](_0xda94('0x63'))};_0x1d48db[_0xda94('0x43')]=_['merge'](_0x1d48db[_0xda94('0x43')],_0x4ab15c);}_0x1d48db=_[_0xda94('0x46')]({},_0x1d48db,_0x9f9861['options']);return _0xba2d81[_0xda94('0x5f')](_0x1d48db);}})[_0xda94('0x2c')](function(_0x48b3df){if(_0x48b3df){_0xa7708f=_0x48b3df[_0xda94('0x4e')];if(!_0x9f9861[_0xda94('0x39')][_0xda94('0x3e')](_0xda94('0x3f'))){_0x1d48db[_0xda94('0x40')]=qs[_0xda94('0x40')](_0x9f9861[_0xda94('0x39')][_0xda94('0x40')]);_0x1d48db[_0xda94('0x24')]=qs[_0xda94('0x24')](_0x9f9861[_0xda94('0x39')]['offset']);}return _0xba2d81[_0xda94('0x5f')](_0x1d48db);}})[_0xda94('0x2c')](function(_0x2ddbdd){if(_0x2ddbdd){return _0x2ddbdd?{'count':_0xa7708f,'rows':_0x2ddbdd}:null;}})[_0xda94('0x2c')](respondWithResult(_0x2acf6e,null))[_0xda94('0x4b')](handleError(_0x2acf6e,null));}; \ No newline at end of file +var _0x9bb9=['getMembers','User','nolimit','removeMembers','addMessage','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','ChatGroup','count','includeAll','findAll','rows','catch','params','include','create','body','find','describe','getUnread','ChatInternalMessage','user','addMembers','ids'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x9bb9,0xca));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x99bb('0x0'));var rimraf=require(_0x99bb('0x1'));var zipdir=require(_0x99bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99bb('0x3'));var moment=require('moment');var BPromise=require(_0x99bb('0x4'));var Mustache=require(_0x99bb('0x5'));var util=require(_0x99bb('0x6'));var path=require(_0x99bb('0x7'));var sox=require(_0x99bb('0x8'));var csv=require(_0x99bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99bb('0xa'));var _=require(_0x99bb('0xb'));var squel=require(_0x99bb('0xc'));var crypto=require(_0x99bb('0xd'));var jsforce=require(_0x99bb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x99bb('0x9'));var querystring=require(_0x99bb('0xf'));var Papa=require(_0x99bb('0x10'));var Redis=require(_0x99bb('0x11'));var authService=require(_0x99bb('0x12'));var qs=require(_0x99bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x99bb('0x14'))(_0x99bb('0x15'));var utils=require(_0x99bb('0x16'));var config=require(_0x99bb('0x17'));var licenseUtil=require(_0x99bb('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x99bb('0x19')](config[_0x99bb('0x1a')],{'host':_0x99bb('0x1b'),'port':0x18eb});var socket=require(_0x99bb('0x1c'))(new Redis(config['redis']));require(_0x99bb('0x1d'))['register'](socket);function respondWithStatusCode(_0x9a31e4,_0x222603){_0x222603=_0x222603||0xcc;return function(_0x32d63a){if(_0x32d63a){return _0x9a31e4[_0x99bb('0x1e')](_0x222603);}return _0x9a31e4['status'](_0x222603)[_0x99bb('0x1f')]();};}function respondWithResult(_0x51bc87,_0xef46ce){_0xef46ce=_0xef46ce||0xc8;return function(_0x4dbf24){if(_0x4dbf24){return _0x51bc87[_0x99bb('0x20')](_0xef46ce)[_0x99bb('0x21')](_0x4dbf24);}};}function respondWithFilteredResult(_0x58bb56,_0x208e16){return function(_0x3afa99){if(_0x3afa99){var _0x56a576=typeof _0x208e16[_0x99bb('0x22')]===_0x99bb('0x23')&&typeof _0x208e16[_0x99bb('0x24')]===_0x99bb('0x23');var _0x2d19ec=_0x3afa99['count'];var _0x542f94=_0x56a576?0x0:_0x208e16[_0x99bb('0x22')];var _0x5ab28e=_0x56a576?_0x3afa99['count']:_0x208e16[_0x99bb('0x22')]+_0x208e16['limit'];var _0x4e17b2;if(_0x5ab28e>=_0x2d19ec){_0x5ab28e=_0x2d19ec;_0x4e17b2=0xc8;}else{_0x4e17b2=0xce;}_0x58bb56['status'](_0x4e17b2);return _0x58bb56[_0x99bb('0x25')]('Content-Range',_0x542f94+'-'+_0x5ab28e+'/'+_0x2d19ec)[_0x99bb('0x21')](_0x3afa99);}return null;};}function patchUpdates(_0x249a6c){return function(_0x60f6f2){try{jsonpatch[_0x99bb('0x26')](_0x60f6f2,_0x249a6c,!![]);}catch(_0x1a8e3b){return BPromise[_0x99bb('0x27')](_0x1a8e3b);}return _0x60f6f2[_0x99bb('0x28')]();};}function saveUpdates(_0x5048a9,_0xe5ec80){return function(_0x1afbf1){if(_0x1afbf1){return _0x1afbf1[_0x99bb('0x29')](_0x5048a9)[_0x99bb('0x2a')](function(_0x375044){return _0x375044;});}return null;};}function removeEntity(_0x1ab205,_0x1f1953){return function(_0x19a8ba){if(_0x19a8ba){return _0x19a8ba[_0x99bb('0x2b')]()[_0x99bb('0x2a')](function(){_0x1ab205[_0x99bb('0x20')](0xcc)[_0x99bb('0x1f')]();});}};}function handleEntityNotFound(_0x330457,_0x1a24ce){return function(_0x306855){if(!_0x306855){_0x330457[_0x99bb('0x1e')](0x194);}return _0x306855;};}function handleError(_0x8acb37,_0x227438){_0x227438=_0x227438||0x1f4;return function(_0x4136ab){logger[_0x99bb('0x2c')](_0x4136ab[_0x99bb('0x2d')]);if(_0x4136ab['name']){delete _0x4136ab[_0x99bb('0x2e')];}_0x8acb37[_0x99bb('0x20')](_0x227438)[_0x99bb('0x2f')](_0x4136ab);};}exports['index']=function(_0x53db50,_0x4461b0){var _0x36b7f8={},_0x3fbaf5={},_0x28b80e={'count':0x0,'rows':[]};var _0x4c4bb7=_[_0x99bb('0x30')](db['ChatGroup'][_0x99bb('0x31')],function(_0x1757b1){return{'name':_0x1757b1['fieldName'],'type':_0x1757b1[_0x99bb('0x32')][_0x99bb('0x33')]};});_0x3fbaf5[_0x99bb('0x34')]=_['map'](_0x4c4bb7,_0x99bb('0x2e'));_0x3fbaf5['query']=_[_0x99bb('0x35')](_0x53db50[_0x99bb('0x36')]);_0x3fbaf5[_0x99bb('0x37')]=_[_0x99bb('0x38')](_0x3fbaf5[_0x99bb('0x34')],_0x3fbaf5['query']);_0x36b7f8[_0x99bb('0x39')]=_[_0x99bb('0x38')](_0x3fbaf5[_0x99bb('0x34')],qs[_0x99bb('0x3a')](_0x53db50[_0x99bb('0x36')][_0x99bb('0x3a')]));_0x36b7f8['attributes']=_0x36b7f8['attributes'][_0x99bb('0x3b')]?_0x36b7f8[_0x99bb('0x39')]:_0x3fbaf5[_0x99bb('0x34')];if(!_0x53db50[_0x99bb('0x36')][_0x99bb('0x3c')]('nolimit')){_0x36b7f8[_0x99bb('0x24')]=qs[_0x99bb('0x24')](_0x53db50[_0x99bb('0x36')]['limit']);_0x36b7f8[_0x99bb('0x22')]=qs['offset'](_0x53db50[_0x99bb('0x36')][_0x99bb('0x22')]);}_0x36b7f8[_0x99bb('0x3d')]=qs[_0x99bb('0x3e')](_0x53db50[_0x99bb('0x36')][_0x99bb('0x3e')]);_0x36b7f8['where']=qs[_0x99bb('0x37')](_[_0x99bb('0x3f')](_0x53db50[_0x99bb('0x36')],_0x3fbaf5[_0x99bb('0x37')]),_0x4c4bb7);if(_0x53db50[_0x99bb('0x36')][_0x99bb('0x40')]){_0x36b7f8['where']=_[_0x99bb('0x41')](_0x36b7f8[_0x99bb('0x42')],{'$or':_['map'](_0x4c4bb7,function(_0x11db79){if(_0x11db79[_0x99bb('0x32')]!==_0x99bb('0x43')){var _0x33d2ab={};_0x33d2ab[_0x11db79['name']]={'$like':'%'+_0x53db50[_0x99bb('0x36')]['filter']+'%'};return _0x33d2ab;}})});}_0x36b7f8=_[_0x99bb('0x41')]({},_0x36b7f8,_0x53db50[_0x99bb('0x44')]);var _0x5cfa87={'where':_0x36b7f8['where']};return db[_0x99bb('0x45')]['count'](_0x5cfa87)[_0x99bb('0x2a')](function(_0x2011d7){_0x28b80e[_0x99bb('0x46')]=_0x2011d7;if(_0x53db50[_0x99bb('0x36')][_0x99bb('0x47')]){_0x36b7f8['include']=[{'all':!![]}];}return db[_0x99bb('0x45')][_0x99bb('0x48')](_0x36b7f8);})[_0x99bb('0x2a')](function(_0x3469ca){_0x28b80e[_0x99bb('0x49')]=_0x3469ca;return _0x28b80e;})[_0x99bb('0x2a')](respondWithFilteredResult(_0x4461b0,_0x36b7f8))[_0x99bb('0x4a')](handleError(_0x4461b0,null));};exports['show']=function(_0x1006ca,_0x5ce3b2){var _0x4ffb3b={'raw':!![],'where':{'id':_0x1006ca[_0x99bb('0x4b')]['id']}},_0x304063={};_0x304063[_0x99bb('0x34')]=_[_0x99bb('0x35')](db[_0x99bb('0x45')]['rawAttributes']);_0x304063[_0x99bb('0x36')]=_['keys'](_0x1006ca[_0x99bb('0x36')]);_0x304063[_0x99bb('0x37')]=_[_0x99bb('0x38')](_0x304063['model'],_0x304063[_0x99bb('0x36')]);_0x4ffb3b['attributes']=_['intersection'](_0x304063[_0x99bb('0x34')],qs[_0x99bb('0x3a')](_0x1006ca[_0x99bb('0x36')][_0x99bb('0x3a')]));_0x4ffb3b['attributes']=_0x4ffb3b['attributes'][_0x99bb('0x3b')]?_0x4ffb3b[_0x99bb('0x39')]:_0x304063['model'];if(_0x1006ca[_0x99bb('0x36')][_0x99bb('0x47')]){_0x4ffb3b[_0x99bb('0x4c')]=[{'all':!![]}];}_0x4ffb3b=_['merge']({},_0x4ffb3b,_0x1006ca[_0x99bb('0x44')]);return db[_0x99bb('0x45')]['find'](_0x4ffb3b)[_0x99bb('0x2a')](handleEntityNotFound(_0x5ce3b2,null))[_0x99bb('0x2a')](respondWithResult(_0x5ce3b2,null))[_0x99bb('0x4a')](handleError(_0x5ce3b2,null));};exports[_0x99bb('0x4d')]=function(_0x55574b,_0x29a41c){return db[_0x99bb('0x45')]['create'](_0x55574b['body'],{})[_0x99bb('0x2a')](respondWithResult(_0x29a41c,0xc9))[_0x99bb('0x4a')](handleError(_0x29a41c,null));};exports[_0x99bb('0x29')]=function(_0x4d9438,_0x28ec14){if(_0x4d9438['body']['id']){delete _0x4d9438[_0x99bb('0x4e')]['id'];}return db['ChatGroup'][_0x99bb('0x4f')]({'where':{'id':_0x4d9438[_0x99bb('0x4b')]['id']}})[_0x99bb('0x2a')](handleEntityNotFound(_0x28ec14,null))[_0x99bb('0x2a')](saveUpdates(_0x4d9438[_0x99bb('0x4e')],null))[_0x99bb('0x2a')](respondWithResult(_0x28ec14,null))[_0x99bb('0x4a')](handleError(_0x28ec14,null));};exports[_0x99bb('0x2b')]=function(_0x142b40,_0xd14ceb){return db[_0x99bb('0x45')]['find']({'where':{'id':_0x142b40[_0x99bb('0x4b')]['id']}})[_0x99bb('0x2a')](handleEntityNotFound(_0xd14ceb,null))[_0x99bb('0x2a')](removeEntity(_0xd14ceb,null))[_0x99bb('0x4a')](handleError(_0xd14ceb,null));};exports[_0x99bb('0x50')]=function(_0x5c3119,_0x44914c){return db['ChatGroup'][_0x99bb('0x50')]()['then'](respondWithResult(_0x44914c,null))['catch'](handleError(_0x44914c,null));};exports[_0x99bb('0x51')]=function(_0x1d8090,_0x114aee,_0x11e9a5){return db[_0x99bb('0x52')][_0x99bb('0x46')]({'where':{'ChatGroupId':_0x1d8090[_0x99bb('0x4b')]['id'],'ToId':_0x1d8090[_0x99bb('0x53')]['id'],'read':![]}})[_0x99bb('0x2a')](function(_0x5c5a5f){return{'id':_['toInteger'](_0x1d8090[_0x99bb('0x4b')]['id']),'count':_0x5c5a5f};})[_0x99bb('0x2a')](respondWithResult(_0x114aee,null))[_0x99bb('0x4a')](handleError(_0x114aee,null));};exports[_0x99bb('0x54')]=function(_0x2e2273,_0x5485c2,_0x150d6e){return db['ChatGroup'][_0x99bb('0x4f')]({'where':{'id':_0x2e2273[_0x99bb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5485c2,null))[_0x99bb('0x2a')](function(_0x389827){if(_0x389827){return _0x389827[_0x99bb('0x54')](_0x2e2273[_0x99bb('0x4e')][_0x99bb('0x55')],_['omit'](_0x2e2273[_0x99bb('0x4e')],[_0x99bb('0x55'),'id'])||{});}})[_0x99bb('0x2a')](respondWithResult(_0x5485c2,null))['catch'](handleError(_0x5485c2,null));};exports[_0x99bb('0x56')]=function(_0x14b97c,_0x4c37ca,_0x5eb367){var _0x5a479d={};var _0x4329fc={};var _0x2ff149;var _0x10cc93;return db[_0x99bb('0x45')]['findOne']({'where':{'id':_0x14b97c[_0x99bb('0x4b')]['id']}})[_0x99bb('0x2a')](handleEntityNotFound(_0x4c37ca,null))[_0x99bb('0x2a')](function(_0x36f072){if(_0x36f072){_0x2ff149=_0x36f072;_0x4329fc[_0x99bb('0x34')]=_[_0x99bb('0x35')](db[_0x99bb('0x57')][_0x99bb('0x31')]);_0x4329fc['query']=_[_0x99bb('0x35')](_0x14b97c[_0x99bb('0x36')]);_0x4329fc[_0x99bb('0x37')]=_['intersection'](_0x4329fc[_0x99bb('0x34')],_0x4329fc[_0x99bb('0x36')]);_0x5a479d[_0x99bb('0x39')]=_[_0x99bb('0x38')](_0x4329fc['model'],qs[_0x99bb('0x3a')](_0x14b97c[_0x99bb('0x36')]['fields']));_0x5a479d[_0x99bb('0x39')]=_0x5a479d[_0x99bb('0x39')][_0x99bb('0x3b')]?_0x5a479d[_0x99bb('0x39')]:_0x4329fc[_0x99bb('0x34')];_0x5a479d[_0x99bb('0x3d')]=qs[_0x99bb('0x3e')](_0x14b97c['query'][_0x99bb('0x3e')]);_0x5a479d[_0x99bb('0x42')]=qs[_0x99bb('0x37')](_[_0x99bb('0x3f')](_0x14b97c[_0x99bb('0x36')],_0x4329fc['filters']));if(_0x14b97c[_0x99bb('0x36')]['filter']){_0x5a479d[_0x99bb('0x42')]=_[_0x99bb('0x41')](_0x5a479d[_0x99bb('0x42')],{'$or':_['map'](_0x5a479d['attributes'],function(_0xf10612){var _0x1f15ec={};_0x1f15ec[_0xf10612]={'$like':'%'+_0x14b97c['query']['filter']+'%'};return _0x1f15ec;})});}_0x5a479d=_[_0x99bb('0x41')]({},_0x5a479d,_0x14b97c['options']);return _0x2ff149[_0x99bb('0x56')](_0x5a479d);}})['then'](function(_0x5aa9aa){if(_0x5aa9aa){_0x10cc93=_0x5aa9aa[_0x99bb('0x3b')];if(!_0x14b97c[_0x99bb('0x36')]['hasOwnProperty'](_0x99bb('0x58'))){_0x5a479d[_0x99bb('0x24')]=qs['limit'](_0x14b97c[_0x99bb('0x36')]['limit']);_0x5a479d[_0x99bb('0x22')]=qs['offset'](_0x14b97c[_0x99bb('0x36')][_0x99bb('0x22')]);}return _0x2ff149['getMembers'](_0x5a479d);}})[_0x99bb('0x2a')](function(_0x30b15c){if(_0x30b15c){return _0x30b15c?{'count':_0x10cc93,'rows':_0x30b15c}:null;}})[_0x99bb('0x2a')](respondWithResult(_0x4c37ca,null))[_0x99bb('0x4a')](handleError(_0x4c37ca,null));};exports[_0x99bb('0x59')]=function(_0x2d6202,_0x1abfb1,_0x20986f){return db[_0x99bb('0x45')][_0x99bb('0x4f')]({'where':{'id':_0x2d6202[_0x99bb('0x4b')]['id']}})[_0x99bb('0x2a')](handleEntityNotFound(_0x1abfb1,null))[_0x99bb('0x2a')](function(_0x442b50){if(_0x442b50){return _0x442b50[_0x99bb('0x59')](_0x2d6202[_0x99bb('0x36')][_0x99bb('0x55')]);}})[_0x99bb('0x2a')](respondWithStatusCode(_0x1abfb1,null))[_0x99bb('0x4a')](handleError(_0x1abfb1,null));};exports[_0x99bb('0x5a')]=function(_0x5a860f,_0x521c2b,_0x5eccdb){if(_0x5a860f['body']['id']){delete _0x5a860f[_0x99bb('0x4e')]['id'];}return db[_0x99bb('0x45')]['find']({'where':{'id':_0x5a860f['params']['id']}})[_0x99bb('0x2a')](handleEntityNotFound(_0x521c2b,null))[_0x99bb('0x2a')](function(_0x1ecf58){if(_0x1ecf58){_0x5a860f[_0x99bb('0x4e')]['ChatGroupId']=_0x1ecf58['id'];return db[_0x99bb('0x52')][_0x99bb('0x4d')](_0x5a860f[_0x99bb('0x4e')]);}})[_0x99bb('0x2a')](respondWithResult(_0x521c2b,null))['catch'](handleError(_0x521c2b,null));};exports[_0x99bb('0x5b')]=function(_0x56c89b,_0x4597fd,_0xa1373f){var _0x278a10={};var _0x210060={};var _0x1726e7;var _0x19ba6a;return db[_0x99bb('0x45')][_0x99bb('0x5c')]({'where':{'id':_0x56c89b[_0x99bb('0x4b')]['id']}})[_0x99bb('0x2a')](handleEntityNotFound(_0x4597fd,null))[_0x99bb('0x2a')](function(_0x2db512){if(_0x2db512){_0x1726e7=_0x2db512;_0x210060[_0x99bb('0x34')]=_[_0x99bb('0x35')](db['ChatInternalMessage']['rawAttributes']);_0x210060[_0x99bb('0x36')]=_[_0x99bb('0x35')](_0x56c89b[_0x99bb('0x36')]);_0x210060[_0x99bb('0x37')]=_[_0x99bb('0x38')](_0x210060['model'],_0x210060['query']);_0x278a10[_0x99bb('0x39')]=_[_0x99bb('0x38')](_0x210060[_0x99bb('0x34')],qs['fields'](_0x56c89b[_0x99bb('0x36')][_0x99bb('0x3a')]));_0x278a10['attributes']=_0x278a10[_0x99bb('0x39')][_0x99bb('0x3b')]?_0x278a10[_0x99bb('0x39')]:_0x210060[_0x99bb('0x34')];_0x278a10[_0x99bb('0x3d')]=qs[_0x99bb('0x3e')](_0x56c89b[_0x99bb('0x36')][_0x99bb('0x3e')]);_0x278a10[_0x99bb('0x42')]=qs['filters'](_[_0x99bb('0x3f')](_0x56c89b[_0x99bb('0x36')],_0x210060[_0x99bb('0x37')]));if(_0x56c89b[_0x99bb('0x36')][_0x99bb('0x40')]){_0x278a10[_0x99bb('0x42')]=_['merge'](_0x278a10[_0x99bb('0x42')],{'$or':_[_0x99bb('0x30')](_0x278a10[_0x99bb('0x39')],function(_0x263d3c){var _0x112145={};_0x112145[_0x263d3c]={'$like':'%'+_0x56c89b[_0x99bb('0x36')][_0x99bb('0x40')]+'%'};return _0x112145;})});}if(_0x56c89b['query'][_0x99bb('0x5d')]){var _0x390e6c=_0x56c89b[_0x99bb('0x36')][_0x99bb('0x5d')][_0x99bb('0x5e')](',');var _0x3be0fe={};_0x3be0fe[_0x390e6c[0x0]]={'$gte':moment(_0x390e6c[0x1])['format'](_0x99bb('0x5f'))};_0x278a10['where']=_[_0x99bb('0x41')](_0x278a10[_0x99bb('0x42')],_0x3be0fe);}_0x278a10=_[_0x99bb('0x41')]({},_0x278a10,_0x56c89b[_0x99bb('0x44')]);return _0x1726e7[_0x99bb('0x5b')](_0x278a10);}})[_0x99bb('0x2a')](function(_0x3416be){if(_0x3416be){_0x19ba6a=_0x3416be[_0x99bb('0x3b')];if(!_0x56c89b['query'][_0x99bb('0x3c')](_0x99bb('0x58'))){_0x278a10[_0x99bb('0x24')]=qs['limit'](_0x56c89b[_0x99bb('0x36')][_0x99bb('0x24')]);_0x278a10[_0x99bb('0x22')]=qs[_0x99bb('0x22')](_0x56c89b['query'][_0x99bb('0x22')]);}return _0x1726e7['getMessages'](_0x278a10);}})[_0x99bb('0x2a')](function(_0x3b890d){if(_0x3b890d){return _0x3b890d?{'count':_0x19ba6a,'rows':_0x3b890d}:null;}})['then'](respondWithResult(_0x4597fd,null))[_0x99bb('0x4a')](handleError(_0x4597fd,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 43111e7..36dfc97 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 _0x88f3=['emit','hasOwnProperty','hook','../../mysqldb','save','update','remove'];(function(_0xcd632a,_0x42d42){var _0x56decd=function(_0x6999ef){while(--_0x6999ef){_0xcd632a['push'](_0xcd632a['shift']());}};_0x56decd(++_0x42d42);}(_0x88f3,0x184));var _0x388f=function(_0x1fc619,_0x29ad91){_0x1fc619=_0x1fc619-0x0;var _0x3a5129=_0x88f3[_0x1fc619];return _0x3a5129;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x388f('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x388f('0x1'),'afterUpdate':_0x388f('0x2'),'afterDestroy':_0x388f('0x3')};function emitEvent(_0x7ac40f){return function(_0x445796,_0x2459b0,_0x228d47){ChatGroupEvents['emit'](_0x7ac40f+':'+_0x445796['id'],_0x445796);ChatGroupEvents[_0x388f('0x4')](_0x7ac40f,_0x445796);_0x228d47(null);};}for(var e in events){if(events[_0x388f('0x5')](e)){var event=events[e];ChatGroup[_0x388f('0x6')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x8b30=['exports','events','../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x8b30,0xc1));var _0x08b3=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x8b30[_0x68ee8b];return _0x5148f7;};'use strict';var EventEmitter=require(_0x08b3('0x0'));var ChatGroup=require(_0x08b3('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x08b3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1fd558){return function(_0x124b24,_0x1ec9ca,_0x1aa4f8){ChatGroupEvents[_0x08b3('0x3')](_0x1fd558+':'+_0x124b24['id'],_0x124b24);ChatGroupEvents['emit'](_0x1fd558,_0x124b24);_0x1aa4f8(null);};}for(var e in events){if(events[_0x08b3('0x4')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x08b3('0x5')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 73a80ef..1a943a9 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 _0xc480=['chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x27b0a9,_0x225e93){var _0x822b01=function(_0x5977d3){while(--_0x5977d3){_0x27b0a9['push'](_0x27b0a9['shift']());}};_0x822b01(++_0x225e93);}(_0xc480,0x139));var _0x0c48=function(_0xf88445,_0x2954f7){_0xf88445=_0xf88445-0x0;var _0xcf7aae=_0xc480[_0xf88445];return _0xcf7aae;};'use strict';var _=require(_0x0c48('0x0'));var util=require(_0x0c48('0x1'));var logger=require(_0x0c48('0x2'))('api');var moment=require(_0x0c48('0x3'));var BPromise=require(_0x0c48('0x4'));var rp=require(_0x0c48('0x5'));var fs=require('fs');var path=require(_0x0c48('0x6'));var rimraf=require(_0x0c48('0x7'));var config=require(_0x0c48('0x8'));var attributes=require(_0x0c48('0x9'));module[_0x0c48('0xa')]=function(_0x4764ac,_0x7e8b07){return _0x4764ac['define']('ChatGroup',attributes,{'tableName':_0x0c48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x416b=['exports','ChatGroup','chat_groups','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x416b,0xc9));var _0xb416=function(_0x41c088,_0x155e0f){_0x41c088=_0x41c088-0x0;var _0x273b77=_0x416b[_0x41c088];return _0x273b77;};'use strict';var _=require('lodash');var util=require(_0xb416('0x0'));var logger=require(_0xb416('0x1'))('api');var moment=require(_0xb416('0x2'));var BPromise=require(_0xb416('0x3'));var rp=require(_0xb416('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb416('0x5'));var attributes=require('./chatGroup.attributes');module[_0xb416('0x6')]=function(_0x2ddec2,_0x5d1a3d){return _0x2ddec2['define'](_0xb416('0x7'),attributes,{'tableName':_0xb416('0x8'),'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 bc5088c..7ffcee4 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 _0x4944=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x21f9d7,_0x2f2100){var _0x38aa98=function(_0x1de1a9){while(--_0x1de1a9){_0x21f9d7['push'](_0x21f9d7['shift']());}};_0x38aa98(++_0x2f2100);}(_0x4944,0x6d));var _0x4494=function(_0x5af6d6,_0x55bb91){_0x5af6d6=_0x5af6d6-0x0;var _0x3407aa=_0x4944[_0x5af6d6];return _0x3407aa;};'use strict';var _=require(_0x4494('0x0'));var util=require('util');var moment=require(_0x4494('0x1'));var BPromise=require(_0x4494('0x2'));var rs=require(_0x4494('0x3'));var fs=require('fs');var Redis=require(_0x4494('0x4'));var db=require(_0x4494('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4494('0x6'))('rpc');var config=require(_0x4494('0x7'));var jayson=require(_0x4494('0x8'));var client=jayson[_0x4494('0x9')][_0x4494('0xa')]({'port':0x232a});config[_0x4494('0xb')]=_[_0x4494('0xc')](config[_0x4494('0xb')],{'host':_0x4494('0xd'),'port':0x18eb});var socket=require(_0x4494('0xe'))(new Redis(config['redis']));require(_0x4494('0xf'))[_0x4494('0x10')](socket);function respondWithRpcPromise(_0x461525,_0x2b1cf5,_0x4acf68){return new BPromise(function(_0x5230d5,_0x461714){return client[_0x4494('0x11')](_0x461525,_0x4acf68)[_0x4494('0x12')](function(_0x4bba9c){logger['info'](_0x4494('0x13'),_0x2b1cf5,_0x4494('0x14'));logger[_0x4494('0x15')](_0x4494('0x16'),_0x2b1cf5,_0x4494('0x14'),JSON[_0x4494('0x17')](_0x4bba9c));if(_0x4bba9c['error']){if(_0x4bba9c[_0x4494('0x18')][_0x4494('0x19')]===0x1f4){logger[_0x4494('0x18')](_0x4494('0x13'),_0x2b1cf5,_0x4bba9c[_0x4494('0x18')][_0x4494('0x1a')]);return _0x461714(_0x4bba9c[_0x4494('0x18')]['message']);}logger[_0x4494('0x18')]('ChatGroup,\x20%s,\x20%s',_0x2b1cf5,_0x4bba9c['error'][_0x4494('0x1a')]);return _0x5230d5(_0x4bba9c[_0x4494('0x18')]['message']);}else{logger['info'](_0x4494('0x13'),_0x2b1cf5,'request\x20sent');_0x5230d5(_0x4bba9c[_0x4494('0x1b')][_0x4494('0x1a')]);}})['catch'](function(_0x22ed31){logger['error'](_0x4494('0x13'),_0x2b1cf5,_0x22ed31);_0x461714(_0x22ed31);});});} \ No newline at end of file +var _0xbb91=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./chatGroup.socket','register','request','then','request\x20sent','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','catch','lodash','util'];(function(_0x43f9d8,_0x4f5a7a){var _0x4c0720=function(_0xbfef72){while(--_0xbfef72){_0x43f9d8['push'](_0x43f9d8['shift']());}};_0x4c0720(++_0x4f5a7a);}(_0xbb91,0xce));var _0x1bb9=function(_0x1e2671,_0x4cf90a){_0x1e2671=_0x1e2671-0x0;var _0x492489=_0xbb91[_0x1e2671];return _0x492489;};'use strict';var _=require(_0x1bb9('0x0'));var util=require(_0x1bb9('0x1'));var moment=require(_0x1bb9('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bb9('0x3'));var fs=require('fs');var Redis=require(_0x1bb9('0x4'));var db=require(_0x1bb9('0x5'))['db'];var utils=require(_0x1bb9('0x6'));var logger=require(_0x1bb9('0x7'))(_0x1bb9('0x8'));var config=require(_0x1bb9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1bb9('0xa')][_0x1bb9('0xb')]({'port':0x232a});config[_0x1bb9('0xc')]=_[_0x1bb9('0xd')](config[_0x1bb9('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1bb9('0xc')]));require(_0x1bb9('0xe'))[_0x1bb9('0xf')](socket);function respondWithRpcPromise(_0x4be0ec,_0x5d8df9,_0x303345){return new BPromise(function(_0x269cc9,_0x5a0e26){return client[_0x1bb9('0x10')](_0x4be0ec,_0x303345)[_0x1bb9('0x11')](function(_0x1f0206){logger['info']('ChatGroup,\x20%s,\x20%s',_0x5d8df9,_0x1bb9('0x12'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5d8df9,'request\x20sent',JSON[_0x1bb9('0x13')](_0x1f0206));if(_0x1f0206[_0x1bb9('0x14')]){if(_0x1f0206[_0x1bb9('0x14')][_0x1bb9('0x15')]===0x1f4){logger[_0x1bb9('0x14')](_0x1bb9('0x16'),_0x5d8df9,_0x1f0206[_0x1bb9('0x14')][_0x1bb9('0x17')]);return _0x5a0e26(_0x1f0206[_0x1bb9('0x14')][_0x1bb9('0x17')]);}logger[_0x1bb9('0x14')](_0x1bb9('0x16'),_0x5d8df9,_0x1f0206[_0x1bb9('0x14')]['message']);return _0x269cc9(_0x1f0206[_0x1bb9('0x14')][_0x1bb9('0x17')]);}else{logger[_0x1bb9('0x18')](_0x1bb9('0x16'),_0x5d8df9,'request\x20sent');_0x269cc9(_0x1f0206['result']['message']);}})[_0x1bb9('0x19')](function(_0xd9d4a6){logger[_0x1bb9('0x14')](_0x1bb9('0x16'),_0x5d8df9,_0xd9d4a6);_0x5a0e26(_0xd9d4a6);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9bd8cf5..8ce5f6a 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 _0x927f=['register','./chatGroup.events','save','remove','update','emit','removeListener'];(function(_0x11fd60,_0x5e9617){var _0x21f003=function(_0x26a056){while(--_0x26a056){_0x11fd60['push'](_0x11fd60['shift']());}};_0x21f003(++_0x5e9617);}(_0x927f,0x6a));var _0xf927=function(_0x5aa7e0,_0x2033cf){_0x5aa7e0=_0x5aa7e0-0x0;var _0x3de368=_0x927f[_0x5aa7e0];return _0x3de368;};'use strict';var ChatGroupEvents=require(_0xf927('0x0'));var events=[_0xf927('0x1'),_0xf927('0x2'),_0xf927('0x3')];function createListener(_0x9bff27,_0x398818){return function(_0x16061d){_0x398818[_0xf927('0x4')](_0x9bff27,_0x16061d);};}function removeListener(_0x22abcb,_0x395a81){return function(){ChatGroupEvents[_0xf927('0x5')](_0x22abcb,_0x395a81);};}exports[_0xf927('0x6')]=function(_0x1d3d1d){for(var _0x40fcad=0x0,_0x266238=events['length'];_0x40fcad<_0x266238;_0x40fcad++){var _0x4c6f3c=events[_0x40fcad];var _0x37a0dc=createListener('chatGroup:'+_0x4c6f3c,_0x1d3d1d);ChatGroupEvents['on'](_0x4c6f3c,_0x37a0dc);}}; \ No newline at end of file +var _0x5d83=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register','length'];(function(_0x1a9c97,_0xe7144a){var _0x43f8d4=function(_0x10710a){while(--_0x10710a){_0x1a9c97['push'](_0x1a9c97['shift']());}};_0x43f8d4(++_0xe7144a);}(_0x5d83,0x12a));var _0x35d8=function(_0x48bee1,_0x29f43d){_0x48bee1=_0x48bee1-0x0;var _0x582372=_0x5d83[_0x48bee1];return _0x582372;};'use strict';var ChatGroupEvents=require(_0x35d8('0x0'));var events=[_0x35d8('0x1'),_0x35d8('0x2'),_0x35d8('0x3')];function createListener(_0x2dfab1,_0xd719ba){return function(_0x2e407f){_0xd719ba[_0x35d8('0x4')](_0x2dfab1,_0x2e407f);};}function removeListener(_0x45f923,_0xcfdff3){return function(){ChatGroupEvents[_0x35d8('0x5')](_0x45f923,_0xcfdff3);};}exports[_0x35d8('0x6')]=function(_0x228d80){for(var _0x28e47f=0x0,_0x5bcd3a=events[_0x35d8('0x7')];_0x28e47f<_0x5bcd3a;_0x28e47f++){var _0x1c0034=events[_0x28e47f];var _0x5593a6=createListener(_0x35d8('0x8')+_0x1c0034,_0x228d80);ChatGroupEvents['on'](_0x1c0034,_0x5593a6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 339ba36..48c4706 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 _0x6ed1=['./chatGroup.controller','get','isAuthenticated','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','destroy','delete','removeMembers','util','path','../../components/interaction/service','../../config/environment'];(function(_0x1c8742,_0x3e2e0c){var _0x89acc3=function(_0x4e7092){while(--_0x4e7092){_0x1c8742['push'](_0x1c8742['shift']());}};_0x89acc3(++_0x3e2e0c);}(_0x6ed1,0x80));var _0x16ed=function(_0x4557a4,_0x36f89c){_0x4557a4=_0x4557a4-0x0;var _0x4ceb15=_0x6ed1[_0x4557a4];return _0x4ceb15;};'use strict';var multer=require('multer');var util=require(_0x16ed('0x0'));var path=require(_0x16ed('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x16ed('0x2'));var config=require(_0x16ed('0x3'));var controller=require(_0x16ed('0x4'));router[_0x16ed('0x5')]('/',auth[_0x16ed('0x6')](),controller['index']);router['get']('/describe',auth[_0x16ed('0x6')](),controller['describe']);router['get'](_0x16ed('0x7'),auth[_0x16ed('0x6')](),controller[_0x16ed('0x8')]);router[_0x16ed('0x5')]('/:id/unread',auth[_0x16ed('0x6')](),controller[_0x16ed('0x9')]);router[_0x16ed('0x5')](_0x16ed('0xa'),auth[_0x16ed('0x6')](),controller[_0x16ed('0xb')]);router['get'](_0x16ed('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0x16ed('0xd')]('/',auth[_0x16ed('0x6')](),controller[_0x16ed('0xe')]);router['post'](_0x16ed('0xa'),auth[_0x16ed('0x6')](),controller[_0x16ed('0xf')]);router[_0x16ed('0xd')](_0x16ed('0xc'),auth[_0x16ed('0x6')](),controller[_0x16ed('0x10')]);router[_0x16ed('0x11')](_0x16ed('0x7'),auth[_0x16ed('0x6')](),controller[_0x16ed('0x12')]);router['delete'](_0x16ed('0x7'),auth[_0x16ed('0x6')](),controller[_0x16ed('0x13')]);router[_0x16ed('0x14')]('/:id/members',auth[_0x16ed('0x6')](),controller[_0x16ed('0x15')]);module['exports']=router; \ No newline at end of file +var _0x14f9=['show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','addMessage','delete','destroy','removeMembers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x14f9,0x194));var _0x914f=function(_0xedbf11,_0x582f4f){_0xedbf11=_0xedbf11-0x0;var _0x55ab30=_0x14f9[_0xedbf11];return _0x55ab30;};'use strict';var multer=require(_0x914f('0x0'));var util=require(_0x914f('0x1'));var path=require(_0x914f('0x2'));var timeout=require('connect-timeout');var express=require(_0x914f('0x3'));var router=express[_0x914f('0x4')]();var fs_extra=require(_0x914f('0x5'));var auth=require(_0x914f('0x6'));var interaction=require(_0x914f('0x7'));var config=require(_0x914f('0x8'));var controller=require(_0x914f('0x9'));router[_0x914f('0xa')]('/',auth[_0x914f('0xb')](),controller[_0x914f('0xc')]);router['get'](_0x914f('0xd'),auth[_0x914f('0xb')](),controller[_0x914f('0xe')]);router[_0x914f('0xa')](_0x914f('0xf'),auth[_0x914f('0xb')](),controller[_0x914f('0x10')]);router[_0x914f('0xa')](_0x914f('0x11'),auth[_0x914f('0xb')](),controller[_0x914f('0x12')]);router[_0x914f('0xa')](_0x914f('0x13'),auth[_0x914f('0xb')](),controller['getMembers']);router[_0x914f('0xa')](_0x914f('0x14'),auth[_0x914f('0xb')](),controller[_0x914f('0x15')]);router[_0x914f('0x16')]('/',auth[_0x914f('0xb')](),controller[_0x914f('0x17')]);router[_0x914f('0x16')]('/:id/members',auth['isAuthenticated'](),controller[_0x914f('0x18')]);router[_0x914f('0x16')](_0x914f('0x14'),auth['isAuthenticated'](),controller[_0x914f('0x19')]);router['put'](_0x914f('0xf'),auth[_0x914f('0xb')](),controller['update']);router[_0x914f('0x1a')]('/:id',auth[_0x914f('0xb')](),controller[_0x914f('0x1b')]);router['delete']('/:id/members',auth[_0x914f('0xb')](),controller[_0x914f('0x1c')]);module[_0x914f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a28e7c0..6d5de1e 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 _0x7ea9=['DATE','out','BOOLEAN','exports','INTEGER','ENUM','thumb','star','TEXT','STRING','long'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x7ea9,0x9d));var _0x97ea=function(_0x2e6b25,_0x2e381a){_0x2e6b25=_0x2e6b25-0x0;var _0x58a1d3=_0x7ea9[_0x2e6b25];return _0x58a1d3;};'use strict';var Sequelize=require('sequelize');module[_0x97ea('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x97ea('0x1')]},'ratingType':{'type':Sequelize[_0x97ea('0x2')]('star',_0x97ea('0x3')),'defaultValue':_0x97ea('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x97ea('0x5')]},'mailTranscript':{'type':Sequelize[_0x97ea('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x97ea('0x6')]},'note':{'type':Sequelize[_0x97ea('0x6')]},'browserName':{'type':Sequelize[_0x97ea('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x97ea('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x97ea('0x6')]},'deviceVendor':{'type':Sequelize[_0x97ea('0x6')]},'deviceType':{'type':Sequelize[_0x97ea('0x6')]},'referer':{'type':Sequelize[_0x97ea('0x5')]},'customerIp':{'type':Sequelize[_0x97ea('0x6')]},'formData':{'type':Sequelize[_0x97ea('0x5')](_0x97ea('0x7'))},'read1stAt':{'type':Sequelize[_0x97ea('0x8')]},'lastMsgAt':{'type':Sequelize[_0x97ea('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x97ea('0x2')]('in',_0x97ea('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x97ea('0x6')]},'customerPort':{'type':Sequelize[_0x97ea('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x97ea('0xa')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x97ea('0x1')]}}; \ No newline at end of file +var _0x83f2=['long','DATE','out','exports','BOOLEAN','INTEGER','ENUM','star','thumb','STRING','TEXT'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x83f2,0x184));var _0x283f=function(_0x2bef52,_0x29bfb0){_0x2bef52=_0x2bef52-0x0;var _0x2715b1=_0x83f2[_0x2bef52];return _0x2715b1;};'use strict';var Sequelize=require('sequelize');module[_0x283f('0x0')]={'closed':{'type':Sequelize[_0x283f('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x283f('0x2')]},'ratingType':{'type':Sequelize[_0x283f('0x3')](_0x283f('0x4'),_0x283f('0x5')),'defaultValue':_0x283f('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x283f('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x283f('0x6')]},'secondDisposition':{'type':Sequelize[_0x283f('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x283f('0x6')]},'browserName':{'type':Sequelize[_0x283f('0x6')]},'browserVersion':{'type':Sequelize[_0x283f('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x283f('0x6')]},'deviceModel':{'type':Sequelize[_0x283f('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x283f('0x6')]},'referer':{'type':Sequelize[_0x283f('0x7')]},'customerIp':{'type':Sequelize[_0x283f('0x6')]},'formData':{'type':Sequelize[_0x283f('0x7')](_0x283f('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x283f('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x283f('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x283f('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x283f('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0774642..e291466 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 _0x29bb=['fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','vidaooMetadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','originalname','basename','filename','file','Attachment','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','length','hasOwnProperty','order','sort','where','ChatInteractionId','filter','$gte','rows','getMyMessages','nolimit','pick','includeAgent','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','transcript-%d-%s.zip','push','firstName','lastName','attachments','createdAt','read','Account','Owner','get','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','stack','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','user','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','find','create','update','destroy','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic'];(function(_0x49c4de,_0xac4172){var _0xdcc4d3=function(_0x1193bc){while(--_0x1193bc){_0x49c4de['push'](_0x49c4de['shift']());}};_0xdcc4d3(++_0xac4172);}(_0x29bb,0x82));var _0xb29b=function(_0x39ef54,_0x136475){_0x39ef54=_0x39ef54-0x0;var _0x1618c0=_0x29bb[_0x39ef54];return _0x1618c0;};'use strict';var rimraf=require(_0xb29b('0x0'));var zipdir=require(_0xb29b('0x1'));var rp=require(_0xb29b('0x2'));var moment=require(_0xb29b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb29b('0x4'));var util=require(_0xb29b('0x5'));var path=require(_0xb29b('0x6'));var ejs=require(_0xb29b('0x7'));var fs=require('fs');var _=require(_0xb29b('0x8'));var Redis=require(_0xb29b('0x9'));var interaction=require(_0xb29b('0xa'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb29b('0xb'));var logger=require('../../config/logger')('api');var config=require(_0xb29b('0xc'));var db=require(_0xb29b('0xd'))['db'];config[_0xb29b('0xe')]=_[_0xb29b('0xf')](config['redis'],{'host':_0xb29b('0x10'),'port':0x18eb});var socket=require(_0xb29b('0x11'))(new Redis(config[_0xb29b('0xe')]));require(_0xb29b('0x12'))[_0xb29b('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb29b('0x14')][_0xb29b('0x15')]({'port':0x232b});var client9004=jayson['client'][_0xb29b('0x15')]({'port':0x232c});function respondWithRpcPromise(_0xbbd64d,_0x1b9af1,_0x3e9625,_0x65f61f){return new BPromise(function(_0x4e9fad,_0x3ade12){var _0x597df5=_0x65f61f||client;return _0x597df5[_0xb29b('0x16')](_0xbbd64d,_0x3e9625)[_0xb29b('0x17')](function(_0xff6d36){logger[_0xb29b('0x18')](_0xb29b('0x19'),_0x1b9af1,_0xb29b('0x1a'));logger[_0xb29b('0x1b')](_0xb29b('0x1c'),_0x1b9af1,_0xb29b('0x1a'),JSON[_0xb29b('0x1d')](_0xff6d36));if(_0xff6d36[_0xb29b('0x1e')]){if(_0xff6d36[_0xb29b('0x1e')][_0xb29b('0x1f')]===0x1f4){logger[_0xb29b('0x1e')](_0xb29b('0x19'),_0x1b9af1,_0xff6d36['error'][_0xb29b('0x20')]);return _0x3ade12(_0xff6d36['error'][_0xb29b('0x20')]);}logger[_0xb29b('0x1e')](_0xb29b('0x19'),_0x1b9af1,_0xff6d36['error'][_0xb29b('0x20')]);return _0x4e9fad(_0xff6d36['error'][_0xb29b('0x20')]);}else{logger[_0xb29b('0x18')](_0xb29b('0x19'),_0x1b9af1,_0xb29b('0x1a'));_0x4e9fad(_0xff6d36['result'][_0xb29b('0x20')]);}})[_0xb29b('0x21')](function(_0x501993){logger[_0xb29b('0x1e')](_0xb29b('0x19'),_0x1b9af1,_0x501993);_0x3ade12(_0x501993);});});}function respondWithStatusCode(_0xf8fa7a,_0xf53de2){_0xf53de2=_0xf53de2||0xcc;return function(_0x4ef45d){if(_0x4ef45d){return _0xf8fa7a[_0xb29b('0x22')](_0xf53de2);}return _0xf8fa7a['status'](_0xf53de2)[_0xb29b('0x23')]();};}function respondWithResult(_0x4007b2,_0x210a96){_0x210a96=_0x210a96||0xc8;return function(_0x356114){if(_0x356114){return _0x4007b2[_0xb29b('0x24')](_0x210a96)[_0xb29b('0x25')](_0x356114);}};}function respondWithFilteredResult(_0x1347f8,_0x2b0dc8){return function(_0xd0b755){if(_0xd0b755){var _0x54adc7=typeof _0x2b0dc8[_0xb29b('0x26')]==='undefined'&&typeof _0x2b0dc8['limit']===_0xb29b('0x27');var _0x117c91=_0xd0b755[_0xb29b('0x28')];var _0x3b1094=_0x54adc7?0x0:_0x2b0dc8[_0xb29b('0x26')];var _0x445714=_0x54adc7?_0xd0b755['count']:_0x2b0dc8[_0xb29b('0x26')]+_0x2b0dc8[_0xb29b('0x29')];var _0x233be9;if(_0x445714>=_0x117c91){_0x445714=_0x117c91;_0x233be9=0xc8;}else{_0x233be9=0xce;}_0x1347f8[_0xb29b('0x24')](_0x233be9);return _0x1347f8[_0xb29b('0x2a')]('Content-Range',_0x3b1094+'-'+_0x445714+'/'+_0x117c91)[_0xb29b('0x25')](_0xd0b755);}return null;};}function saveUpdates(_0xe6670f){return function(_0xe2489b){if(_0xe2489b){return _0xe2489b['update'](_0xe6670f)[_0xb29b('0x17')](function(_0x37dbee){return _0x37dbee;});}return null;};}function removeEntity(_0x15d718){return function(_0x599f3b){if(_0x599f3b){return _0x599f3b['destroy']()['then'](function(){_0x15d718[_0xb29b('0x24')](0xcc)[_0xb29b('0x23')]();});}};}function handleEntityNotFound(_0x5422f7){return function(_0x500ce4){if(!_0x500ce4){_0x5422f7['sendStatus'](0x194);}return _0x500ce4;};}function handleError(_0x5e479a,_0x29405a){_0x29405a=_0x29405a||0x1f4;return function(_0x5cdb7e){logger['error'](_0x5cdb7e[_0xb29b('0x2b')]);if(_0x5cdb7e[_0xb29b('0x2c')]){delete _0x5cdb7e[_0xb29b('0x2c')];}_0x5e479a[_0xb29b('0x24')](_0x29405a)[_0xb29b('0x2d')](_0x5cdb7e);};}function getMustacheRender(_0x1597e7,_0xb174a){return Mustache[_0xb29b('0x2e')](_0x1597e7,_[_0xb29b('0x2f')](_0xb174a[_0xb29b('0x30')],{'contact':_0xb174a[_0xb29b('0x31')],'message':_0xb174a['message'],'agent':_0xb174a[_0xb29b('0x32')],'interaction':_0xb174a[_0xb29b('0x33')],'account':_0xb174a[_0xb29b('0x34')]}))||'';}exports[_0xb29b('0x35')]=function(_0x16d024,_0x5c4c47){var _0x5a0bf6={};var _0x1531c7=_[_0xb29b('0x36')](db[_0xb29b('0x37')]['rawAttributes'],function(_0x38ab95){return{'name':_0x38ab95[_0xb29b('0x38')],'type':_0x38ab95[_0xb29b('0x39')][_0xb29b('0x3a')]};});_0x5a0bf6=qs[_0xb29b('0x3b')](_0x1531c7,_0x16d024);return interaction[_0xb29b('0x3c')](_0xb29b('0x3d'),_0x16d024['query'],_0x16d024[_0xb29b('0x3e')],_0x5a0bf6,_0x1531c7)[_0xb29b('0x17')](respondWithFilteredResult(_0x5c4c47,_0x5a0bf6))[_0xb29b('0x21')](handleError(_0x5c4c47,null));};exports[_0xb29b('0x3f')]=function(_0x2627a3,_0x20ea0b){var _0x27af84={'raw':![],'where':{'id':_0x2627a3[_0xb29b('0x40')]['id']}},_0x47fdf6={};_0x47fdf6[_0xb29b('0x41')]=_[_0xb29b('0x42')](db['ChatInteraction'][_0xb29b('0x43')]);_0x47fdf6['query']=_[_0xb29b('0x42')](_0x2627a3[_0xb29b('0x44')]);_0x47fdf6[_0xb29b('0x45')]=_[_0xb29b('0x46')](_0x47fdf6['model'],_0x47fdf6[_0xb29b('0x44')]);_0x27af84[_0xb29b('0x47')]=_['intersection'](_0x47fdf6['model'],qs[_0xb29b('0x48')](_0x2627a3[_0xb29b('0x44')][_0xb29b('0x48')]));_0x27af84[_0xb29b('0x47')]=_0x27af84[_0xb29b('0x47')]['length']?_0x27af84['attributes']:_0x47fdf6['model'];if(_0x2627a3[_0xb29b('0x44')][_0xb29b('0x49')]){_0x27af84[_0xb29b('0x4a')]=[{'all':!![]}];}_0x27af84=_[_0xb29b('0x2f')]({},_0x27af84,_0x2627a3[_0xb29b('0x4b')]);return db[_0xb29b('0x37')][_0xb29b('0x4c')](_0x27af84)[_0xb29b('0x17')](handleEntityNotFound(_0x20ea0b,null))[_0xb29b('0x17')](respondWithResult(_0x20ea0b,null))['catch'](handleError(_0x20ea0b,null));};exports['create']=function(_0x5b1f9a,_0xdef7a4){return db[_0xb29b('0x37')][_0xb29b('0x4d')](_0x5b1f9a[_0xb29b('0x30')],{})[_0xb29b('0x17')](respondWithResult(_0xdef7a4,0xc9))[_0xb29b('0x21')](handleError(_0xdef7a4,null));};exports[_0xb29b('0x4e')]=function(_0x364296,_0x5509de){if(_0x364296[_0xb29b('0x30')]['id']){delete _0x364296['body']['id'];}return db['ChatInteraction'][_0xb29b('0x4c')]({'where':{'id':_0x364296[_0xb29b('0x40')]['id']}})[_0xb29b('0x17')](handleEntityNotFound(_0x5509de,null))[_0xb29b('0x17')](saveUpdates(_0x364296[_0xb29b('0x30')],null))[_0xb29b('0x17')](respondWithResult(_0x5509de,null))[_0xb29b('0x21')](handleError(_0x5509de,null));};exports[_0xb29b('0x4f')]=function(_0x12206a,_0x20d2b9){return db[_0xb29b('0x37')]['find']({'where':{'id':_0x12206a[_0xb29b('0x40')]['id']}})[_0xb29b('0x17')](handleEntityNotFound(_0x20d2b9,null))[_0xb29b('0x17')](removeEntity(_0x20d2b9,null))[_0xb29b('0x21')](handleError(_0x20d2b9,null));};exports[_0xb29b('0x50')]=function(_0x4476a5,_0x4164a1){return db[_0xb29b('0x37')][_0xb29b('0x50')]()[_0xb29b('0x17')](respondWithResult(_0x4164a1,null))['catch'](handleError(_0x4164a1,null));};exports['createVidaooSession']=function(_0x4e09b1,_0x4a66f9){var _0x2420f5=_0x4e09b1[_0xb29b('0x40')]['id'];var _0x34788e;var _0xd6497d;var _0x5896fb;return db['ChatInteraction']['findOne']({'where':{'id':_0x2420f5}})['then'](function(_0x48fb14){_0x34788e=_0x48fb14;return db['ChatWebsite'][_0xb29b('0x51')]({'where':{'id':_0x48fb14[_0xb29b('0x52')]},'attributes':['id',_0xb29b('0x53'),_0xb29b('0x54'),_0xb29b('0x55'),'vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x4df616){if(_0x4df616&&_0x4df616[_0xb29b('0x53')]&&_0x4df616[_0xb29b('0x54')]){_0xd6497d=_0x4df616;var _0x469c48={'interaction':{'id':_0x2420f5},'agent':{'id':_0x4e09b1['user']['id'],'name':_0x4e09b1[_0xb29b('0x3e')][_0xb29b('0x2c')],'fullname':_0x4e09b1['user'][_0xb29b('0x56')],'email':_0x4e09b1[_0xb29b('0x3e')][_0xb29b('0x57')]},'contact':_0x4e09b1[_0xb29b('0x30')][_0xb29b('0x31')],'account':_0x4e09b1[_0xb29b('0x30')]['account']};var _0x3593bb={'rejectUnauthorized':![],'method':'POST','url':_0xb29b('0x58'),'headers':{'X-APIKEY':_0x4df616[_0xb29b('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4e09b1[_0xb29b('0x3e')][_0xb29b('0x57')]],'buttons':null,'topic':_0xd6497d[_0xb29b('0x55')],'note':_[_0xb29b('0x59')](_0xd6497d[_0xb29b('0x5a')])?null:getMustacheRender(_0xd6497d[_0xb29b('0x5a')],_0x469c48),'metadata':null},'redirect':_0xb29b('0x5b'),'json':!![]};try{if(!_[_0xb29b('0x59')](_0xd6497d[_0xb29b('0x5c')])){var _0x53afdf=getMustacheRender(_0xd6497d[_0xb29b('0x5c')],_0x469c48);var _0x25b936=JSON['parse'](_0x53afdf);_0x3593bb[_0xb29b('0x30')]['metadata']=_0x25b936;}}catch(_0x1f6b4){throw new db['Sequelize']['ValidationError'](_0xb29b('0x5d'));}return rp(_0x3593bb);}else{throw new db[(_0xb29b('0x5e'))]['ValidationError'](_0xb29b('0x5f'));}})[_0xb29b('0x17')](function(_0x244602){_0x5896fb=_0x244602;if(_0x5896fb['id']){var _0x26ef26={'body':_0x5896fb[_0xb29b('0x60')],'ChatWebsiteId':_0xd6497d['id'],'ChatInteractionId':_0x34788e['id'],'direction':_0xb29b('0x61'),'UserId':_0x4e09b1[_0xb29b('0x3e')]['id']};return db[_0xb29b('0x62')]['create'](_0x26ef26,{});}else{throw new db['Sequelize'][(_0xb29b('0x63'))](_0xb29b('0x64'));}})[_0xb29b('0x17')](function(){return _0x34788e[_0xb29b('0x65')]({'vidaooSessionId':_0x5896fb['id']});})[_0xb29b('0x17')](respondWithResult(_0x4a66f9,null))[_0xb29b('0x21')](handleError(_0x4a66f9,null));};exports[_0xb29b('0x66')]=function(_0x1cc673,_0x10cc79){if(_0x1cc673[_0xb29b('0x30')]['id']){delete _0x1cc673[_0xb29b('0x30')]['id'];}return db[_0xb29b('0x37')]['find']({'where':{'id':_0x1cc673['params']['id']},'include':[{'model':db[_0xb29b('0x67')],'as':_0xb29b('0x68')}]})[_0xb29b('0x17')](handleEntityNotFound(_0x10cc79,null))[_0xb29b('0x17')](saveUpdates(_0x1cc673[_0xb29b('0x30')],null))[_0xb29b('0x17')](respondWithResult(_0x10cc79,null))[_0xb29b('0x21')](handleError(_0x10cc79,null));};exports[_0xb29b('0x69')]=function(_0x286eeb,_0x11a572){if(_0x286eeb[_0xb29b('0x30')]['id']){delete _0x286eeb[_0xb29b('0x30')]['id'];}return db[_0xb29b('0x37')]['find']({'where':{'id':_0x286eeb[_0xb29b('0x40')]['id']}})[_0xb29b('0x17')](function(_0x3704b5){if(!_0x3704b5){logger[_0xb29b('0x1e')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xb29b('0x69'),0x194,_0xb29b('0x6a'));_0x11a572[_0xb29b('0x22')](0x194);}else{if(_0x3704b5['UserId']){throw new db[(_0xb29b('0x5e'))][(_0xb29b('0x63'))](_0xb29b('0x6b'));}}return _0x3704b5;})['then'](function(_0x1668a4){if(_0x1668a4){return _0x1668a4[_0xb29b('0x4e')]({'closed':_0x286eeb[_0xb29b('0x30')][_0xb29b('0x6c')],'disposition':_0x286eeb[_0xb29b('0x30')][_0xb29b('0x6d')]})[_0xb29b('0x17')](function(_0x7227ba){return _0x7227ba;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xb29b('0x69'),_0x286eeb[_0xb29b('0x30')],client9004);})[_0xb29b('0x17')](respondWithResult(_0x11a572,null))[_0xb29b('0x21')](handleError(_0x11a572,null));};exports['attachmentUpload']=function(_0x145ff7,_0x90ba3c){_0x145ff7[_0xb29b('0x30')][_0xb29b('0x2c')]=_0x145ff7['file'][_0xb29b('0x6e')];_0x145ff7[_0xb29b('0x30')][_0xb29b('0x6f')]=_0x145ff7['file'][_0xb29b('0x70')];_0x145ff7[_0xb29b('0x30')][_0xb29b('0x39')]=_0x145ff7[_0xb29b('0x71')]['mimetype'];return db[_0xb29b('0x72')][_0xb29b('0x4d')](_0x145ff7[_0xb29b('0x30')])['then'](respondWithResult(_0x90ba3c,0xc9))[_0xb29b('0x21')](handleError(_0x90ba3c,null));};exports['attachmentDownload']=function(_0x332768,_0x1901bf){return db[_0xb29b('0x37')][_0xb29b('0x51')]({'where':{'id':_0x332768['params']['id']},'raw':!![]})[_0xb29b('0x17')](handleEntityNotFound(_0x1901bf,null))[_0xb29b('0x17')](function(_0x1dc305){if(_0x1dc305){if(_0x1dc305['closed']){return _0x1901bf[_0xb29b('0x24')](0x193)['json']({'status':0x193,'message':_0xb29b('0x73')});}return db[_0xb29b('0x72')][_0xb29b('0x51')]({'where':{'id':_0x332768[_0xb29b('0x44')]['attachId']},'raw':!![]})[_0xb29b('0x17')](handleEntityNotFound(_0x1901bf,null));}})[_0xb29b('0x17')](function(_0x3f0ba8){if(_0x3f0ba8){var _0x478c27=_0x3f0ba8[_0xb29b('0x74')]!==null;var _0x41486e=path[_0xb29b('0x75')](config[_0xb29b('0x76')],_0xb29b('0x77'));if(_0x478c27){_0x41486e=path[_0xb29b('0x75')](_0x41486e,_0xb29b('0x78'));}var _0x5ebbf7=path[_0xb29b('0x75')](_0x41486e,_0x3f0ba8[_0xb29b('0x6f')]);return _0x1901bf[_0xb29b('0x79')](_0x5ebbf7);}})['catch'](handleError(_0x1901bf,null));};exports[_0xb29b('0x7a')]=function(_0x1e6ed0,_0x16d56d){var _0x58327d=null;var _0x1156b7=null;var _0x2a871b=null;if(_0x1e6ed0[_0xb29b('0x30')]['id']){delete _0x1e6ed0[_0xb29b('0x30')]['id'];}if(_0x1e6ed0[_0xb29b('0x30')]['mailTranscript']){_0x2a871b=path['join'](config['root'],_0xb29b('0x7b'),util[_0xb29b('0x7c')](_0xb29b('0x7d'),Date['now']()));_0x1e6ed0['body'][_0xb29b('0x7e')]=_0x2a871b;}return db[_0xb29b('0x37')]['find']({'where':{'id':_0x1e6ed0[_0xb29b('0x40')]['id']},'include':[{'model':db[_0xb29b('0x62')],'as':_0xb29b('0x7f'),'include':[{'model':db[_0xb29b('0x80')],'as':_0xb29b('0x80')}]}]})['then'](handleEntityNotFound(_0x16d56d,null))['then'](saveUpdates(_0x1e6ed0[_0xb29b('0x30')],null))[_0xb29b('0x17')](function(_0x4aa26a){if(_0x4aa26a){_0x58327d=_0x4aa26a;return db[_0xb29b('0x81')]['find']({'where':{'id':_0x58327d[_0xb29b('0x52')]}});}})[_0xb29b('0x17')](function(_0x593659){if(_0x593659){_0x1156b7=_0x593659;return db['CmContact']['find']({'where':{'id':_0x58327d[_0xb29b('0x82')]}});}})[_0xb29b('0x17')](function(_0x3c4161){if(_0x3c4161){if(_0x2a871b){var _0x133c32=null;for(var _0x2163e6=0x1;_0x2163e6<_0x58327d['Messages']['length'];++_0x2163e6){_0x133c32=_0x58327d[_0xb29b('0x7f')][_0x2163e6];var _0x5166ff=_0x133c32[_0xb29b('0x83')]?util['format'](_0xb29b('0x84'),_0x1156b7[_0xb29b('0x85')],_0x133c32['UserId']):_0xb29b('0x86');var _0x430cef=_0x1e6ed0[_0xb29b('0x30')][_0xb29b('0x87')]||util['format'](_0xb29b('0x84'),_0xb29b('0x88'),_0x133c32[_0xb29b('0x82')]);switch(_0x1156b7[_0xb29b('0x89')]){case _0xb29b('0x8a'):_0x5166ff=_0x133c32[_0xb29b('0x83')]?util[_0xb29b('0x7c')]('%s%d',_0x1156b7[_0xb29b('0x85')],_0x133c32[_0xb29b('0x83')]):_0xb29b('0x86');break;case'agent_alias':_0x5166ff=_0x133c32[_0xb29b('0x83')]?_0x133c32[_0xb29b('0x80')][_0xb29b('0x8b')]||_0x133c32[_0xb29b('0x80')][_0xb29b('0x56')]:'System';break;case _0xb29b('0x8c'):_0x5166ff=_0x133c32['UserId']?_0x133c32[_0xb29b('0x80')][_0xb29b('0x56')]:_0xb29b('0x86');break;default:_0x5166ff=_0x133c32[_0xb29b('0x83')]?util[_0xb29b('0x7c')]('%s%d',_0x1156b7[_0xb29b('0x85')],_0x133c32[_0xb29b('0x83')]):_0xb29b('0x86');}var _0x18fa82=util['format'](_0xb29b('0x8d'),moment(_0x133c32['createdAt'])['format'](_0xb29b('0x8e')),_0x133c32[_0xb29b('0x8f')]==='in'?_0x430cef:_0x5166ff,_0x133c32['body']);if(!_0x133c32[_0xb29b('0x90')]){fs[_0xb29b('0x91')](_0x2a871b,_0x18fa82);}}return db[_0xb29b('0x92')][_0xb29b('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0xb29b('0x93')],'as':_0xb29b('0x94'),'raw':!![],'include':[{'model':db[_0xb29b('0x95')],'as':_0xb29b('0x95'),'raw':!![]}]}]});}}})[_0xb29b('0x17')](function(_0x5b165a){if(!_0x5b165a||!_0x5b165a['Smtp']||!_0x1e6ed0[_0xb29b('0x30')])return _0x58327d;var _0x12550d=_0x5b165a[_0xb29b('0x96')]();return respondWithRpcPromise(_0xb29b('0x97'),_0xb29b('0x98'),{'account':_0x12550d,'message':{'from':util['format'](_0xb29b('0x99'),_0x5b165a[_0xb29b('0x2c')],_0x5b165a[_0xb29b('0x57')]||_0x5b165a[_0xb29b('0x94')]['user']),'to':_0x1e6ed0[_0xb29b('0x30')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xb29b('0x7c')](_0xb29b('0x9a'),_0x1e6ed0[_0xb29b('0x30')]['mailTranscript']),'attachments':[{'path':_0x2a871b}]}})[_0xb29b('0x17')](function(){return _0x58327d;})['catch'](function(_0x1f0c4a){logger[_0xb29b('0x1e')](_0x1f0c4a);});})[_0xb29b('0x17')](respondWithStatusCode(_0x16d56d,0xc8))[_0xb29b('0x21')](handleError(_0x16d56d,null));};exports[_0xb29b('0x9b')]=function(_0x493c14,_0xf669bd){return db[_0xb29b('0x62')][_0xb29b('0x4c')]({'where':{'id':_0x493c14[_0xb29b('0x40')]['id']}})[_0xb29b('0x17')](handleEntityNotFound(_0xf669bd,null))['then'](function(_0x397121){if(_0x397121){return _0x397121[_0xb29b('0x9b')](_0x493c14[_0xb29b('0x30')]['ids'],_[_0xb29b('0x9c')](_0x493c14[_0xb29b('0x30')],[_0xb29b('0x9d'),'id'])||{});}})['then'](respondWithResult(_0xf669bd,null))[_0xb29b('0x21')](handleError(_0xf669bd,null));};exports[_0xb29b('0x9e')]=function(_0x463da4,_0x186a9d){var _0x3a3e7f={'raw':![],'where':{}};var _0x15d217={};var _0x509d34={'count':0x0,'rows':[]};return db[_0xb29b('0x37')]['findOne']({'where':{'id':_0x463da4[_0xb29b('0x40')]['id']}})['then'](handleEntityNotFound(_0x186a9d,null))[_0xb29b('0x17')](function(_0xfe7c67){if(_0xfe7c67){_0x15d217[_0xb29b('0x41')]=_[_0xb29b('0x42')](db[_0xb29b('0x62')][_0xb29b('0x43')]);_0x15d217[_0xb29b('0x44')]=_[_0xb29b('0x42')](_0x463da4[_0xb29b('0x44')]);_0x15d217[_0xb29b('0x45')]=_['intersection'](_0x15d217['model'],_0x15d217[_0xb29b('0x44')]);_0x3a3e7f[_0xb29b('0x47')]=_[_0xb29b('0x46')](_0x15d217[_0xb29b('0x41')],qs[_0xb29b('0x48')](_0x463da4[_0xb29b('0x44')]['fields']));_0x3a3e7f[_0xb29b('0x47')]=_0x3a3e7f['attributes'][_0xb29b('0x9f')]?_0x3a3e7f['attributes']:_0x15d217[_0xb29b('0x41')];if(!_0x463da4[_0xb29b('0x44')][_0xb29b('0xa0')]('nolimit')){_0x3a3e7f[_0xb29b('0x29')]=qs[_0xb29b('0x29')](_0x463da4['query'][_0xb29b('0x29')]);_0x3a3e7f[_0xb29b('0x26')]=qs[_0xb29b('0x26')](_0x463da4[_0xb29b('0x44')][_0xb29b('0x26')]);}_0x3a3e7f[_0xb29b('0xa1')]=qs[_0xb29b('0xa2')](_0x463da4[_0xb29b('0x44')][_0xb29b('0xa2')]);_0x3a3e7f[_0xb29b('0xa3')]=qs[_0xb29b('0x45')](_['pick'](_0x463da4[_0xb29b('0x44')],_0x15d217[_0xb29b('0x45')]));_0x3a3e7f[_0xb29b('0xa3')][_0xb29b('0xa4')]=_0xfe7c67['id'];if(_0x463da4[_0xb29b('0x44')][_0xb29b('0xa5')]){_0x3a3e7f['where']=_[_0xb29b('0x2f')](_0x3a3e7f[_0xb29b('0xa3')],{'$or':_[_0xb29b('0x36')](_0x3a3e7f[_0xb29b('0x47')],function(_0x2da284){var _0x44d1e5={};_0x44d1e5[_0x2da284]={'$like':'%'+_0x463da4[_0xb29b('0x44')][_0xb29b('0xa5')]+'%'};return _0x44d1e5;})});}if(_0x463da4[_0xb29b('0x44')][_0xb29b('0xa6')]){var _0x2bd096=_0x463da4['query'][_0xb29b('0xa6')]['split'](',');var _0x854e19={};_0x854e19[_0x2bd096[0x0]]={'$gte':moment(_0x2bd096[0x1])[_0xb29b('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3a3e7f[_0xb29b('0xa3')]=_[_0xb29b('0x2f')](_0x3a3e7f[_0xb29b('0xa3')],_0x854e19);}_0x3a3e7f=_[_0xb29b('0x2f')]({},_0x3a3e7f,_0x463da4[_0xb29b('0x4b')]);return db[_0xb29b('0x62')][_0xb29b('0x28')]({'where':_0x3a3e7f[_0xb29b('0xa3')]})[_0xb29b('0x17')](function(_0x543a31){_0x509d34[_0xb29b('0x28')]=_0x543a31;if(_0x463da4['query'][_0xb29b('0x49')]){_0x3a3e7f[_0xb29b('0x4a')]=[{'all':!![]}];}return db[_0xb29b('0x62')][_0xb29b('0x3c')](_0x3a3e7f);})[_0xb29b('0x17')](function(_0x35b605){_0x509d34[_0xb29b('0xa7')]=_0x35b605;return _0x509d34;});}})[_0xb29b('0x17')](respondWithFilteredResult(_0x186a9d,_0x3a3e7f))[_0xb29b('0x21')](handleError(_0x186a9d,null));};exports[_0xb29b('0xa8')]=function(_0x17c7a3,_0x1824f1){var _0xddfdf4={'where':{}},_0xdced11={},_0x2aa289={'count':0x0,'rows':[]};return db[_0xb29b('0x37')][_0xb29b('0x51')]({'where':{'id':_0x17c7a3[_0xb29b('0x40')]['id']}})['then'](handleEntityNotFound(_0x1824f1,null))[_0xb29b('0x17')](function(_0x5516bb){if(_0x5516bb){_0xdced11[_0xb29b('0x41')]=_[_0xb29b('0x42')](db[_0xb29b('0x62')]['rawAttributes']);_0xdced11['query']=_[_0xb29b('0x42')](_0x17c7a3[_0xb29b('0x44')]);_0xdced11[_0xb29b('0x45')]=_[_0xb29b('0x46')](_0xdced11[_0xb29b('0x41')],_0xdced11[_0xb29b('0x44')]);_0xddfdf4[_0xb29b('0x47')]=_[_0xb29b('0x46')](_0xdced11[_0xb29b('0x41')],qs[_0xb29b('0x48')](_0x17c7a3[_0xb29b('0x44')][_0xb29b('0x48')]));_0xddfdf4[_0xb29b('0x47')]=_0xddfdf4[_0xb29b('0x47')][_0xb29b('0x9f')]?_0xddfdf4[_0xb29b('0x47')]:_0xdced11[_0xb29b('0x41')];if(!_0x17c7a3['query']['hasOwnProperty'](_0xb29b('0xa9'))){_0xddfdf4[_0xb29b('0x29')]=qs[_0xb29b('0x29')](_0x17c7a3['query'][_0xb29b('0x29')]);_0xddfdf4[_0xb29b('0x26')]=qs[_0xb29b('0x26')](_0x17c7a3['query'][_0xb29b('0x26')]);}_0xddfdf4[_0xb29b('0xa1')]=qs[_0xb29b('0xa2')](_0x17c7a3[_0xb29b('0x44')][_0xb29b('0xa2')]);_0xddfdf4['where']=qs[_0xb29b('0x45')](_[_0xb29b('0xaa')](_0x17c7a3[_0xb29b('0x44')],_0xdced11[_0xb29b('0x45')]));_0xddfdf4[_0xb29b('0xa3')][_0xb29b('0xa4')]=_0x5516bb['id'];if(_0x17c7a3[_0xb29b('0x44')][_0xb29b('0xa5')]){_0xddfdf4[_0xb29b('0xa3')]=_[_0xb29b('0x2f')](_0xddfdf4[_0xb29b('0xa3')],{'$or':_[_0xb29b('0x36')](_0xddfdf4['attributes'],function(_0x4c0c2a){var _0x164a7d={};_0x164a7d[_0x4c0c2a]={'$like':'%'+_0x17c7a3[_0xb29b('0x44')][_0xb29b('0xa5')]+'%'};return _0x164a7d;})});}_0xddfdf4[_0xb29b('0xa3')][_0xb29b('0x90')]=![];if(_0x17c7a3['query']['id']){_0xddfdf4['where']['id']={'$gt':_0x17c7a3[_0xb29b('0x44')]['id']};}_0xddfdf4=_[_0xb29b('0x2f')]({},_0xddfdf4,_0x17c7a3['options']);return db[_0xb29b('0x62')][_0xb29b('0x28')]({'where':_0xddfdf4[_0xb29b('0xa3')]})[_0xb29b('0x17')](function(_0x4f224d){_0x2aa289['count']=_0x4f224d;_0xddfdf4['include']=[];if(_0x17c7a3[_0xb29b('0x44')][_0xb29b('0xab')]){_0xddfdf4[_0xb29b('0x4a')]['push']({'model':db[_0xb29b('0x80')],'as':_0xb29b('0x80'),'attributes':['id',_0xb29b('0x56'),_0xb29b('0x8b')]});}if(_0x17c7a3[_0xb29b('0x44')][_0xb29b('0x49')]){_0xddfdf4[_0xb29b('0x4a')]=[{'all':!![]}];}return db['ChatMessage'][_0xb29b('0x3c')](_0xddfdf4);})[_0xb29b('0x17')](function(_0x28e956){_0x2aa289[_0xb29b('0xa7')]=_0x28e956;return _0x2aa289;});}})[_0xb29b('0x17')](respondWithFilteredResult(_0x1824f1,_0xddfdf4))[_0xb29b('0x21')](handleError(_0x1824f1,null));};exports[_0xb29b('0xac')]=function(_0x4cfe2e,_0x4355e8){return db[_0xb29b('0x37')][_0xb29b('0x4c')]({'where':{'id':_0x4cfe2e['params']['id']}})[_0xb29b('0x17')](handleEntityNotFound(_0x4355e8,null))[_0xb29b('0x17')](function(_0x50a38f){if(_0x50a38f){return _0x50a38f[_0xb29b('0xad')](_0x4cfe2e[_0xb29b('0x30')]['ids'],_[_0xb29b('0x9c')](_0x4cfe2e[_0xb29b('0x30')],[_0xb29b('0x9d'),'id'])||{})[_0xb29b('0xae')](function(){return db[_0xb29b('0xaf')][_0xb29b('0x3c')]({'attributes':['id','name','color'],'where':{'id':_0x4cfe2e['body'][_0xb29b('0x9d')]}});})[_0xb29b('0x17')](function(_0x556686){socket[_0xb29b('0xb0')](_0xb29b('0xb1'),{'id':Number(_0x4cfe2e[_0xb29b('0x40')]['id']),'tags':_0x556686||[]});return{'id':Number(_0x4cfe2e[_0xb29b('0x40')]['id']),'tags':_0x556686||[]};});}})[_0xb29b('0x17')](respondWithResult(_0x4355e8,null))['catch'](handleError(_0x4355e8,null));};exports[_0xb29b('0xb2')]=function(_0x87d70c,_0xd0e8ab){return db['ChatInteraction'][_0xb29b('0x4c')]({'where':{'id':_0x87d70c[_0xb29b('0x40')]['id']}})[_0xb29b('0x17')](handleEntityNotFound(_0xd0e8ab,null))[_0xb29b('0x17')](function(_0x2d2b20){if(_0x2d2b20){return _0x2d2b20['removeTags'](_0x87d70c[_0xb29b('0x44')][_0xb29b('0x9d')]);}})[_0xb29b('0x17')](respondWithStatusCode(_0xd0e8ab,null))[_0xb29b('0x21')](handleError(_0xd0e8ab,null));};exports[_0xb29b('0x79')]=function(_0x2c47b1,_0x892fe9){var _0x5919d4=moment()[_0xb29b('0xb3')]()[_0xb29b('0xb4')]();var _0x143ab9=path[_0xb29b('0x75')](config[_0xb29b('0x76')],_0xb29b('0xb5'),_0xb29b('0xb6'),_0xb29b('0xb7'));var _0x5e1862=path['join'](config['root'],_0xb29b('0xb5'),_0xb29b('0xb6'),'attachments');var _0x2dd183=path[_0xb29b('0x75')](_0x143ab9,_0x5919d4);var _0x38592b=util[_0xb29b('0x7c')](_0xb29b('0xb8'),_0x2c47b1['params']['id'],_0x5919d4);var _0x58f1e4=path[_0xb29b('0x75')](_0x143ab9,_0x38592b);var _0x18af0e=[];_0x18af0e[_0xb29b('0xb9')]({'model':db[_0xb29b('0x80')],'as':_0xb29b('0x80'),'attributes':['id',_0xb29b('0x56')],'raw':!![]});_0x18af0e[_0xb29b('0xb9')]({'model':db[_0xb29b('0x67')],'as':_0xb29b('0x68'),'attributes':['id',_0xb29b('0xba'),_0xb29b('0xbb')],'raw':!![]});if(_0x2c47b1['query'][_0xb29b('0xbc')]){_0x18af0e[_0xb29b('0xb9')]({'model':db[_0xb29b('0x72')],'as':_0xb29b('0x72'),'raw':!![]});}var _0x249588=[{'model':db[_0xb29b('0x62')],'as':_0xb29b('0x7f'),'attributes':['id',_0xb29b('0x30'),_0xb29b('0xbd'),_0xb29b('0x8f'),_0xb29b('0x90'),_0xb29b('0xbe')],'include':_0x18af0e}];_0x249588[_0xb29b('0xb9')]({'model':db[_0xb29b('0x81')],'as':_0xb29b('0xbf'),'attributes':['id',_0xb29b('0x2c')]});_0x249588['push']({'model':db['User'],'as':_0xb29b('0xc0'),'attributes':['id',_0xb29b('0x56')]});return db[_0xb29b('0x37')][_0xb29b('0x4c')]({'where':{'id':_0x2c47b1['params']['id']},'include':_0x249588})[_0xb29b('0x17')](handleEntityNotFound(_0x892fe9,null))[_0xb29b('0x17')](function(_0x1b2c84){if(_0x1b2c84){var _0x15426e=_0x1b2c84[_0xb29b('0xc1')]({'plain':!![]});fs[_0xb29b('0xc2')](_0x2dd183);var _0x125c8c={'channel':_0xb29b('0xc3'),'account':_0x15426e[_0xb29b('0xbf')][_0xb29b('0x2c')],'agent':_0x15426e['Owner']?_0x15426e[_0xb29b('0xc0')][_0xb29b('0x56')]:_0xb29b('0xc4'),'createdAt':moment(_0x15426e[_0xb29b('0xbd')])['format'](_0xb29b('0xc5'))[_0xb29b('0xb4')](),'closedAt':_0x15426e[_0xb29b('0x6c')]?moment(_0x15426e[_0xb29b('0xc6')])[_0xb29b('0x7c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb29b('0xb4')]():'','disposition':_0x15426e[_0xb29b('0x6d')],'chatInfo':{'browser':_0x15426e[_0xb29b('0xc7')],'os':_0x15426e[_0xb29b('0xc8')],'referer':_0x15426e[_0xb29b('0xc9')],'customerIp':_0x15426e[_0xb29b('0xca')],'customerPort':_0x15426e['customerPort']?_0x15426e[_0xb29b('0xcb')]:_0xb29b('0xc4')},'messages':_(_0x15426e[_0xb29b('0x7f')])[_0xb29b('0xcc')]()[_0xb29b('0xa5')]({'secret':![]})['map'](function(_0x58bd24){if(_0x58bd24[_0xb29b('0x72')]){var _0x5aed86=path[_0xb29b('0x75')](_0x5e1862,_0x58bd24[_0xb29b('0x72')][_0xb29b('0x6f')]);if(fs[_0xb29b('0xcd')](_0x5aed86)){fs[_0xb29b('0xce')](_0x5aed86)[_0xb29b('0xcf')](fs[_0xb29b('0xd0')](path[_0xb29b('0x75')](_0x2dd183,_0x58bd24[_0xb29b('0x72')][_0xb29b('0x6f')])));}}return{'date':moment(_0x58bd24[_0xb29b('0xbd')])[_0xb29b('0x7c')](_0xb29b('0xc5'))['toString'](),'sender':_0x58bd24['direction']===_0xb29b('0x61')?_0x58bd24[_0xb29b('0x80')]?_0x58bd24[_0xb29b('0x80')][_0xb29b('0x56')]:_0xb29b('0x86'):_0x58bd24[_0xb29b('0x68')][_0xb29b('0xba')]+(_0x58bd24['Contact'][_0xb29b('0xbb')]?'\x20'+_0x58bd24[_0xb29b('0x68')][_0xb29b('0xbb')]:''),'body':_0x58bd24[_0xb29b('0x72')]?_0x58bd24[_0xb29b('0x72')][_0xb29b('0x6f')]:_0x58bd24['body'],'direction':_0x58bd24[_0xb29b('0x8f')]==='out'?'A':'C','secret':_0x58bd24[_0xb29b('0x90')],'read':_0x58bd24[_0xb29b('0xbe')],'attachment':_0x58bd24[_0xb29b('0x72')]};})[_0xb29b('0xd1')]()};return ejs[_0xb29b('0xd2')](path['join'](config[_0xb29b('0x76')],_0xb29b('0xb5'),_0xb29b('0xd3'),'downloadInteraction.ejs'),{'interaction':_0x125c8c})[_0xb29b('0x17')](function(_0x19a911){var _0x24d07e=path[_0xb29b('0x75')](_0x2dd183,'transcript-'+_0x15426e['id']+'-'+_0x5919d4+_0xb29b('0xd4'));var _0x44bffc={'path':_0x24d07e,'channel':_0xb29b('0xc3'),'interactionId':_0x15426e['id']};return pdf[_0xb29b('0xd5')](_0x19a911,_0x44bffc);})[_0xb29b('0x17')](function(){return new Promise(function(_0x6b8d07,_0x4bffa1){zipdir(_0x2dd183,{'saveTo':_0x58f1e4},function(_0x678571,_0x7cda61){if(_0x678571)return _0x4bffa1(_0x678571);return _0x6b8d07(_0x7cda61);});})[_0xb29b('0x17')](function(){return new BPromise(function(_0x52dabc,_0x202d3f){rimraf(_0x2dd183,function(_0x4f4621){if(_0x4f4621)_0x202d3f(_0x4f4621);return _0x52dabc();});});})[_0xb29b('0x17')](function(){return _0x892fe9[_0xb29b('0x79')](_0x58f1e4,_0x38592b,function(_0x2ba12d){if(_0x2ba12d){logger['error'](_0xb29b('0xd6'),_0x2ba12d);}else{fs[_0xb29b('0xd7')](_0x58f1e4);}});});});}else{return _0x892fe9[_0xb29b('0x22')](0xc8);}})[_0xb29b('0x21')](handleError(_0x892fe9,null));}; \ No newline at end of file +var _0xcc81=['tail','existsSync','pipe','createWriteStream','lastName','renderFile','transcript-','createPdfFromHTML','rimraf','moment','bluebird','mustache','util','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','destroy','stack','name','render','merge','body','contact','agent','interaction','account','index','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','chat','user','catch','params','model','keys','query','filters','intersection','attributes','fields','include','options','find','create','update','describe','createVidaooSession','findOne','ChatWebsite','vidaooEscalation','vidaooNote','vidaooMetadata','vidaooApiKey','email','vidaooTopic','isNull','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','ValidationError','customUpdate','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','file','filename','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','basename','format','now','pathTranscript','Messages','ChatWebsiteId','%s%d','System','Visitor','ContactId','agentIdentifier','agent_alias','User','alias','fullname','agent_fullname','agentAlias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','count','includeAll','findAll','getMyMessages','order','ChatInteractionId','map','includeAgent','rows','addTags','setTags','spread','color','emit','chatInteractionTags:save','download','toString','server','files','tmp','transcript-%d-%s.zip','push','firstName','createdAt','read','Account','Owner','mkdirSync','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','browserName','osName','referer','customerIp','customerPort'];(function(_0x2f177c,_0x3717bb){var _0x7c655a=function(_0x5f32ca){while(--_0x5f32ca){_0x2f177c['push'](_0x2f177c['shift']());}};_0x7c655a(++_0x3717bb);}(_0xcc81,0x19c));var _0x1cc8=function(_0x242566,_0x4ec88d){_0x242566=_0x242566-0x0;var _0x1bc410=_0xcc81[_0x242566];return _0x1bc410;};'use strict';var rimraf=require(_0x1cc8('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require(_0x1cc8('0x1'));var BPromise=require(_0x1cc8('0x2'));var Mustache=require(_0x1cc8('0x3'));var util=require(_0x1cc8('0x4'));var path=require(_0x1cc8('0x5'));var ejs=require(_0x1cc8('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1cc8('0x7'));var interaction=require(_0x1cc8('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x1cc8('0x9'));var logger=require(_0x1cc8('0xa'))(_0x1cc8('0xb'));var config=require(_0x1cc8('0xc'));var db=require(_0x1cc8('0xd'))['db'];config[_0x1cc8('0xe')]=_[_0x1cc8('0xf')](config[_0x1cc8('0xe')],{'host':_0x1cc8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cc8('0xe')]));require('./chatInteraction.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x1cc8('0x11')][_0x1cc8('0x12')]({'port':0x232b});var client9004=jayson['client'][_0x1cc8('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x553f1f,_0x378edc,_0x5885d9,_0x5eba59){return new BPromise(function(_0x4d9126,_0x1aeafb){var _0x4a1bef=_0x5eba59||client;return _0x4a1bef[_0x1cc8('0x13')](_0x553f1f,_0x5885d9)[_0x1cc8('0x14')](function(_0x4905c1){logger[_0x1cc8('0x15')](_0x1cc8('0x16'),_0x378edc,_0x1cc8('0x17'));logger[_0x1cc8('0x18')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x378edc,_0x1cc8('0x17'),JSON[_0x1cc8('0x19')](_0x4905c1));if(_0x4905c1[_0x1cc8('0x1a')]){if(_0x4905c1[_0x1cc8('0x1a')][_0x1cc8('0x1b')]===0x1f4){logger[_0x1cc8('0x1a')]('ChatInteraction,\x20%s,\x20%s',_0x378edc,_0x4905c1[_0x1cc8('0x1a')][_0x1cc8('0x1c')]);return _0x1aeafb(_0x4905c1['error'][_0x1cc8('0x1c')]);}logger[_0x1cc8('0x1a')](_0x1cc8('0x16'),_0x378edc,_0x4905c1['error'][_0x1cc8('0x1c')]);return _0x4d9126(_0x4905c1[_0x1cc8('0x1a')][_0x1cc8('0x1c')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x378edc,_0x1cc8('0x17'));_0x4d9126(_0x4905c1[_0x1cc8('0x1d')][_0x1cc8('0x1c')]);}})['catch'](function(_0x33977e){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x378edc,_0x33977e);_0x1aeafb(_0x33977e);});});}function respondWithStatusCode(_0x4f58f3,_0x401be0){_0x401be0=_0x401be0||0xcc;return function(_0x3bf0c3){if(_0x3bf0c3){return _0x4f58f3[_0x1cc8('0x1e')](_0x401be0);}return _0x4f58f3[_0x1cc8('0x1f')](_0x401be0)[_0x1cc8('0x20')]();};}function respondWithResult(_0x1892bd,_0x1ea6ab){_0x1ea6ab=_0x1ea6ab||0xc8;return function(_0x1fff8b){if(_0x1fff8b){return _0x1892bd[_0x1cc8('0x1f')](_0x1ea6ab)[_0x1cc8('0x21')](_0x1fff8b);}};}function respondWithFilteredResult(_0x51b8f3,_0x1d89ab){return function(_0x28ba0d){if(_0x28ba0d){var _0x366de2=typeof _0x1d89ab[_0x1cc8('0x22')]===_0x1cc8('0x23')&&typeof _0x1d89ab[_0x1cc8('0x24')]===_0x1cc8('0x23');var _0x29e834=_0x28ba0d['count'];var _0x1185d2=_0x366de2?0x0:_0x1d89ab['offset'];var _0x3f7d75=_0x366de2?_0x28ba0d['count']:_0x1d89ab[_0x1cc8('0x22')]+_0x1d89ab[_0x1cc8('0x24')];var _0x3ec068;if(_0x3f7d75>=_0x29e834){_0x3f7d75=_0x29e834;_0x3ec068=0xc8;}else{_0x3ec068=0xce;}_0x51b8f3[_0x1cc8('0x1f')](_0x3ec068);return _0x51b8f3[_0x1cc8('0x25')](_0x1cc8('0x26'),_0x1185d2+'-'+_0x3f7d75+'/'+_0x29e834)['json'](_0x28ba0d);}return null;};}function saveUpdates(_0x5b7857){return function(_0x28846a){if(_0x28846a){return _0x28846a['update'](_0x5b7857)[_0x1cc8('0x14')](function(_0x2c6af0){return _0x2c6af0;});}return null;};}function removeEntity(_0x31f7c4){return function(_0x3f56c7){if(_0x3f56c7){return _0x3f56c7[_0x1cc8('0x27')]()[_0x1cc8('0x14')](function(){_0x31f7c4[_0x1cc8('0x1f')](0xcc)[_0x1cc8('0x20')]();});}};}function handleEntityNotFound(_0x33addb){return function(_0x32a80d){if(!_0x32a80d){_0x33addb['sendStatus'](0x194);}return _0x32a80d;};}function handleError(_0x16dd52,_0x2a5f11){_0x2a5f11=_0x2a5f11||0x1f4;return function(_0x2ccdf9){logger[_0x1cc8('0x1a')](_0x2ccdf9[_0x1cc8('0x28')]);if(_0x2ccdf9['name']){delete _0x2ccdf9[_0x1cc8('0x29')];}_0x16dd52[_0x1cc8('0x1f')](_0x2a5f11)['send'](_0x2ccdf9);};}function getMustacheRender(_0x54c350,_0xf2e326){return Mustache[_0x1cc8('0x2a')](_0x54c350,_[_0x1cc8('0x2b')](_0xf2e326[_0x1cc8('0x2c')],{'contact':_0xf2e326[_0x1cc8('0x2d')],'message':_0xf2e326[_0x1cc8('0x1c')],'agent':_0xf2e326[_0x1cc8('0x2e')],'interaction':_0xf2e326[_0x1cc8('0x2f')],'account':_0xf2e326[_0x1cc8('0x30')]}))||'';}exports[_0x1cc8('0x31')]=function(_0x216ca4,_0x4c613f){var _0x179e5c={};var _0x247920=_['map'](db[_0x1cc8('0x32')][_0x1cc8('0x33')],function(_0xf3c75){return{'name':_0xf3c75[_0x1cc8('0x34')],'type':_0xf3c75[_0x1cc8('0x35')][_0x1cc8('0x36')]};});_0x179e5c=qs[_0x1cc8('0x37')](_0x247920,_0x216ca4);return interaction['findAll'](_0x1cc8('0x38'),_0x216ca4['query'],_0x216ca4[_0x1cc8('0x39')],_0x179e5c,_0x247920)['then'](respondWithFilteredResult(_0x4c613f,_0x179e5c))[_0x1cc8('0x3a')](handleError(_0x4c613f,null));};exports['show']=function(_0xf98c1d,_0x300b02){var _0x244efe={'raw':![],'where':{'id':_0xf98c1d[_0x1cc8('0x3b')]['id']}},_0x15b6cc={};_0x15b6cc[_0x1cc8('0x3c')]=_[_0x1cc8('0x3d')](db['ChatInteraction'][_0x1cc8('0x33')]);_0x15b6cc[_0x1cc8('0x3e')]=_['keys'](_0xf98c1d[_0x1cc8('0x3e')]);_0x15b6cc[_0x1cc8('0x3f')]=_[_0x1cc8('0x40')](_0x15b6cc['model'],_0x15b6cc[_0x1cc8('0x3e')]);_0x244efe[_0x1cc8('0x41')]=_[_0x1cc8('0x40')](_0x15b6cc['model'],qs['fields'](_0xf98c1d['query'][_0x1cc8('0x42')]));_0x244efe['attributes']=_0x244efe[_0x1cc8('0x41')]['length']?_0x244efe[_0x1cc8('0x41')]:_0x15b6cc[_0x1cc8('0x3c')];if(_0xf98c1d[_0x1cc8('0x3e')]['includeAll']){_0x244efe[_0x1cc8('0x43')]=[{'all':!![]}];}_0x244efe=_['merge']({},_0x244efe,_0xf98c1d[_0x1cc8('0x44')]);return db[_0x1cc8('0x32')][_0x1cc8('0x45')](_0x244efe)[_0x1cc8('0x14')](handleEntityNotFound(_0x300b02,null))[_0x1cc8('0x14')](respondWithResult(_0x300b02,null))[_0x1cc8('0x3a')](handleError(_0x300b02,null));};exports[_0x1cc8('0x46')]=function(_0x20b2e1,_0x3eb52e){return db[_0x1cc8('0x32')]['create'](_0x20b2e1['body'],{})[_0x1cc8('0x14')](respondWithResult(_0x3eb52e,0xc9))[_0x1cc8('0x3a')](handleError(_0x3eb52e,null));};exports[_0x1cc8('0x47')]=function(_0x24d55c,_0x5b88de){if(_0x24d55c[_0x1cc8('0x2c')]['id']){delete _0x24d55c[_0x1cc8('0x2c')]['id'];}return db['ChatInteraction'][_0x1cc8('0x45')]({'where':{'id':_0x24d55c[_0x1cc8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x5b88de,null))[_0x1cc8('0x14')](saveUpdates(_0x24d55c[_0x1cc8('0x2c')],null))[_0x1cc8('0x14')](respondWithResult(_0x5b88de,null))[_0x1cc8('0x3a')](handleError(_0x5b88de,null));};exports[_0x1cc8('0x27')]=function(_0xbedfd7,_0x15d7df){return db[_0x1cc8('0x32')]['find']({'where':{'id':_0xbedfd7[_0x1cc8('0x3b')]['id']}})[_0x1cc8('0x14')](handleEntityNotFound(_0x15d7df,null))[_0x1cc8('0x14')](removeEntity(_0x15d7df,null))[_0x1cc8('0x3a')](handleError(_0x15d7df,null));};exports[_0x1cc8('0x48')]=function(_0x2e766f,_0x572996){return db[_0x1cc8('0x32')][_0x1cc8('0x48')]()[_0x1cc8('0x14')](respondWithResult(_0x572996,null))['catch'](handleError(_0x572996,null));};exports[_0x1cc8('0x49')]=function(_0x29e2e1,_0x18624a){var _0x5a5e54=_0x29e2e1[_0x1cc8('0x3b')]['id'];var _0x263a08;var _0x232f22;var _0x268706;return db[_0x1cc8('0x32')][_0x1cc8('0x4a')]({'where':{'id':_0x5a5e54}})[_0x1cc8('0x14')](function(_0x4010f1){_0x263a08=_0x4010f1;return db[_0x1cc8('0x4b')][_0x1cc8('0x4a')]({'where':{'id':_0x4010f1['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x1cc8('0x4c'),'vidaooTopic',_0x1cc8('0x4d'),_0x1cc8('0x4e')],'raw':!![]});})[_0x1cc8('0x14')](function(_0x23fc59){if(_0x23fc59&&_0x23fc59[_0x1cc8('0x4f')]&&_0x23fc59['vidaooEscalation']){_0x232f22=_0x23fc59;var _0xb981b1={'interaction':{'id':_0x5a5e54},'agent':{'id':_0x29e2e1[_0x1cc8('0x39')]['id'],'name':_0x29e2e1[_0x1cc8('0x39')][_0x1cc8('0x29')],'fullname':_0x29e2e1[_0x1cc8('0x39')]['fullname'],'email':_0x29e2e1[_0x1cc8('0x39')][_0x1cc8('0x50')]},'contact':_0x29e2e1[_0x1cc8('0x2c')]['contact'],'account':_0x29e2e1[_0x1cc8('0x2c')][_0x1cc8('0x30')]};var _0x577121={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x23fc59[_0x1cc8('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x29e2e1['user'][_0x1cc8('0x50')]],'buttons':null,'topic':_0x232f22[_0x1cc8('0x51')],'note':_[_0x1cc8('0x52')](_0x232f22[_0x1cc8('0x4d')])?null:getMustacheRender(_0x232f22['vidaooNote'],_0xb981b1),'metadata':null},'redirect':_0x1cc8('0x53'),'json':!![]};try{if(!_[_0x1cc8('0x52')](_0x232f22[_0x1cc8('0x4e')])){var _0x12f1a7=getMustacheRender(_0x232f22[_0x1cc8('0x4e')],_0xb981b1);var _0xe47bc8=JSON[_0x1cc8('0x54')](_0x12f1a7);_0x577121['body'][_0x1cc8('0x55')]=_0xe47bc8;}}catch(_0x442821){throw new db[(_0x1cc8('0x56'))]['ValidationError'](_0x1cc8('0x57'));}return rp(_0x577121);}else{throw new db[(_0x1cc8('0x56'))]['ValidationError'](_0x1cc8('0x58'));}})[_0x1cc8('0x14')](function(_0x4ee36d){_0x268706=_0x4ee36d;if(_0x268706['id']){var _0x7c3130={'body':_0x268706[_0x1cc8('0x59')],'ChatWebsiteId':_0x232f22['id'],'ChatInteractionId':_0x263a08['id'],'direction':_0x1cc8('0x5a'),'UserId':_0x29e2e1[_0x1cc8('0x39')]['id']};return db[_0x1cc8('0x5b')][_0x1cc8('0x46')](_0x7c3130,{});}else{throw new db[(_0x1cc8('0x56'))][(_0x1cc8('0x5c'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x263a08['updateAttributes']({'vidaooSessionId':_0x268706['id']});})['then'](respondWithResult(_0x18624a,null))[_0x1cc8('0x3a')](handleError(_0x18624a,null));};exports[_0x1cc8('0x5d')]=function(_0x132a39,_0x4ff23d){if(_0x132a39[_0x1cc8('0x2c')]['id']){delete _0x132a39[_0x1cc8('0x2c')]['id'];}return db['ChatInteraction'][_0x1cc8('0x45')]({'where':{'id':_0x132a39['params']['id']},'include':[{'model':db[_0x1cc8('0x5e')],'as':_0x1cc8('0x5f')}]})['then'](handleEntityNotFound(_0x4ff23d,null))[_0x1cc8('0x14')](saveUpdates(_0x132a39[_0x1cc8('0x2c')],null))['then'](respondWithResult(_0x4ff23d,null))[_0x1cc8('0x3a')](handleError(_0x4ff23d,null));};exports[_0x1cc8('0x60')]=function(_0x9310f3,_0x31b945){if(_0x9310f3[_0x1cc8('0x2c')]['id']){delete _0x9310f3[_0x1cc8('0x2c')]['id'];}return db[_0x1cc8('0x32')]['find']({'where':{'id':_0x9310f3[_0x1cc8('0x3b')]['id']}})[_0x1cc8('0x14')](function(_0x120a44){if(!_0x120a44){logger[_0x1cc8('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x1cc8('0x60'),0x194,'entity\x20not\x20found');_0x31b945[_0x1cc8('0x1e')](0x194);}else{if(_0x120a44[_0x1cc8('0x61')]){throw new db[(_0x1cc8('0x56'))][(_0x1cc8('0x5c'))](_0x1cc8('0x62'));}}return _0x120a44;})[_0x1cc8('0x14')](function(_0x5e7fcb){if(_0x5e7fcb){return _0x5e7fcb['update']({'closed':_0x9310f3[_0x1cc8('0x2c')][_0x1cc8('0x63')],'disposition':_0x9310f3[_0x1cc8('0x2c')]['disposition']})[_0x1cc8('0x14')](function(_0xc5006b){return _0xc5006b;});}})['then'](function(){return respondWithRpcPromise(_0x1cc8('0x64'),_0x1cc8('0x60'),_0x9310f3[_0x1cc8('0x2c')],client9004);})[_0x1cc8('0x14')](respondWithResult(_0x31b945,null))[_0x1cc8('0x3a')](handleError(_0x31b945,null));};exports[_0x1cc8('0x65')]=function(_0x252163,_0xd7bb6c){_0x252163['body'][_0x1cc8('0x29')]=_0x252163['file'][_0x1cc8('0x66')];_0x252163[_0x1cc8('0x2c')]['basename']=_0x252163[_0x1cc8('0x67')][_0x1cc8('0x68')];_0x252163[_0x1cc8('0x2c')][_0x1cc8('0x35')]=_0x252163[_0x1cc8('0x67')][_0x1cc8('0x69')];return db[_0x1cc8('0x6a')][_0x1cc8('0x46')](_0x252163['body'])[_0x1cc8('0x14')](respondWithResult(_0xd7bb6c,0xc9))[_0x1cc8('0x3a')](handleError(_0xd7bb6c,null));};exports['attachmentDownload']=function(_0x4f114b,_0x41127d){return db[_0x1cc8('0x32')]['findOne']({'where':{'id':_0x4f114b[_0x1cc8('0x3b')]['id']},'raw':!![]})[_0x1cc8('0x14')](handleEntityNotFound(_0x41127d,null))['then'](function(_0xc5ff4c){if(_0xc5ff4c){if(_0xc5ff4c[_0x1cc8('0x63')]){return _0x41127d[_0x1cc8('0x1f')](0x193)[_0x1cc8('0x21')]({'status':0x193,'message':_0x1cc8('0x6b')});}return db[_0x1cc8('0x6a')][_0x1cc8('0x4a')]({'where':{'id':_0x4f114b['query'][_0x1cc8('0x6c')]},'raw':!![]})[_0x1cc8('0x14')](handleEntityNotFound(_0x41127d,null));}})['then'](function(_0x2329f9){if(_0x2329f9){var _0x4d2092=_0x2329f9[_0x1cc8('0x6d')]!==null;var _0x36d828=path[_0x1cc8('0x6e')](config[_0x1cc8('0x6f')],_0x1cc8('0x70'));if(_0x4d2092){_0x36d828=path['join'](_0x36d828,'offline-chat/');}var _0x2ba43d=path['join'](_0x36d828,_0x2329f9[_0x1cc8('0x71')]);return _0x41127d['download'](_0x2ba43d);}})[_0x1cc8('0x3a')](handleError(_0x41127d,null));};exports['close']=function(_0x28bf53,_0x4db1d2){var _0x3c4bad=null;var _0x5d33e9=null;var _0x5ec547=null;if(_0x28bf53[_0x1cc8('0x2c')]['id']){delete _0x28bf53['body']['id'];}if(_0x28bf53[_0x1cc8('0x2c')]['mailTranscript']){_0x5ec547=path[_0x1cc8('0x6e')](config['root'],'server/files/chat/upload/',util[_0x1cc8('0x72')]('transcript-%s.txt',Date[_0x1cc8('0x73')]()));_0x28bf53[_0x1cc8('0x2c')][_0x1cc8('0x74')]=_0x5ec547;}return db[_0x1cc8('0x32')][_0x1cc8('0x45')]({'where':{'id':_0x28bf53[_0x1cc8('0x3b')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x1cc8('0x75'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x1cc8('0x14')](handleEntityNotFound(_0x4db1d2,null))[_0x1cc8('0x14')](saveUpdates(_0x28bf53['body'],null))[_0x1cc8('0x14')](function(_0x2a0a62){if(_0x2a0a62){_0x3c4bad=_0x2a0a62;return db[_0x1cc8('0x4b')][_0x1cc8('0x45')]({'where':{'id':_0x3c4bad[_0x1cc8('0x76')]}});}})[_0x1cc8('0x14')](function(_0x1d5dd3){if(_0x1d5dd3){_0x5d33e9=_0x1d5dd3;return db[_0x1cc8('0x5e')][_0x1cc8('0x45')]({'where':{'id':_0x3c4bad['ContactId']}});}})[_0x1cc8('0x14')](function(_0xff258d){if(_0xff258d){if(_0x5ec547){var _0x1bf0bc=null;for(var _0x32d2e1=0x1;_0x32d2e1<_0x3c4bad[_0x1cc8('0x75')]['length'];++_0x32d2e1){_0x1bf0bc=_0x3c4bad['Messages'][_0x32d2e1];var _0x5a274c=_0x1bf0bc['UserId']?util[_0x1cc8('0x72')](_0x1cc8('0x77'),_0x5d33e9['agentAlias'],_0x1bf0bc['UserId']):_0x1cc8('0x78');var _0x2aed2a=_0x28bf53[_0x1cc8('0x2c')]['customer']||util[_0x1cc8('0x72')](_0x1cc8('0x77'),_0x1cc8('0x79'),_0x1bf0bc[_0x1cc8('0x7a')]);switch(_0x5d33e9[_0x1cc8('0x7b')]){case'website_alias':_0x5a274c=_0x1bf0bc[_0x1cc8('0x61')]?util[_0x1cc8('0x72')]('%s%d',_0x5d33e9['agentAlias'],_0x1bf0bc['UserId']):_0x1cc8('0x78');break;case _0x1cc8('0x7c'):_0x5a274c=_0x1bf0bc[_0x1cc8('0x61')]?_0x1bf0bc[_0x1cc8('0x7d')][_0x1cc8('0x7e')]||_0x1bf0bc['User'][_0x1cc8('0x7f')]:_0x1cc8('0x78');break;case _0x1cc8('0x80'):_0x5a274c=_0x1bf0bc['UserId']?_0x1bf0bc[_0x1cc8('0x7d')][_0x1cc8('0x7f')]:'System';break;default:_0x5a274c=_0x1bf0bc[_0x1cc8('0x61')]?util[_0x1cc8('0x72')](_0x1cc8('0x77'),_0x5d33e9[_0x1cc8('0x81')],_0x1bf0bc[_0x1cc8('0x61')]):_0x1cc8('0x78');}var _0x380b92=util['format'](_0x1cc8('0x82'),moment(_0x1bf0bc['createdAt'])['format'](_0x1cc8('0x83')),_0x1bf0bc[_0x1cc8('0x84')]==='in'?_0x2aed2a:_0x5a274c,_0x1bf0bc[_0x1cc8('0x2c')]);if(!_0x1bf0bc[_0x1cc8('0x85')]){fs[_0x1cc8('0x86')](_0x5ec547,_0x380b92);}}return db['MailAccount'][_0x1cc8('0x4a')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1cc8('0x87'),'raw':!![],'include':[{'model':db[_0x1cc8('0x88')],'as':_0x1cc8('0x88'),'raw':!![]}]}]});}}})[_0x1cc8('0x14')](function(_0x1aee1c){if(!_0x1aee1c||!_0x1aee1c[_0x1cc8('0x87')]||!_0x28bf53[_0x1cc8('0x2c')])return _0x3c4bad;var _0x55e74b=_0x1aee1c[_0x1cc8('0x89')]();return respondWithRpcPromise(_0x1cc8('0x8a'),_0x1cc8('0x8b'),{'account':_0x55e74b,'message':{'from':util['format'](_0x1cc8('0x8c'),_0x1aee1c[_0x1cc8('0x29')],_0x1aee1c[_0x1cc8('0x50')]||_0x1aee1c[_0x1cc8('0x87')][_0x1cc8('0x39')]),'to':_0x28bf53['body'][_0x1cc8('0x8d')],'subject':_0x1cc8('0x8e'),'text':util['format'](_0x1cc8('0x8f'),_0x28bf53[_0x1cc8('0x2c')][_0x1cc8('0x8d')]),'attachments':[{'path':_0x5ec547}]}})['then'](function(){return _0x3c4bad;})[_0x1cc8('0x3a')](function(_0x5a74f2){logger[_0x1cc8('0x1a')](_0x5a74f2);});})['then'](respondWithStatusCode(_0x4db1d2,0xc8))['catch'](handleError(_0x4db1d2,null));};exports[_0x1cc8('0x90')]=function(_0x3e6d40,_0x4cb3e5){return db[_0x1cc8('0x5b')][_0x1cc8('0x45')]({'where':{'id':_0x3e6d40['params']['id']}})['then'](handleEntityNotFound(_0x4cb3e5,null))[_0x1cc8('0x14')](function(_0x496b2f){if(_0x496b2f){return _0x496b2f['addMessage'](_0x3e6d40[_0x1cc8('0x2c')][_0x1cc8('0x91')],_[_0x1cc8('0x92')](_0x3e6d40[_0x1cc8('0x2c')],[_0x1cc8('0x91'),'id'])||{});}})[_0x1cc8('0x14')](respondWithResult(_0x4cb3e5,null))[_0x1cc8('0x3a')](handleError(_0x4cb3e5,null));};exports[_0x1cc8('0x93')]=function(_0x36c6eb,_0x50f043){var _0x4f61b1={'raw':![],'where':{}};var _0x133b9d={};var _0x759a2b={'count':0x0,'rows':[]};return db[_0x1cc8('0x32')][_0x1cc8('0x4a')]({'where':{'id':_0x36c6eb[_0x1cc8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x50f043,null))['then'](function(_0xa74a96){if(_0xa74a96){_0x133b9d[_0x1cc8('0x3c')]=_[_0x1cc8('0x3d')](db[_0x1cc8('0x5b')][_0x1cc8('0x33')]);_0x133b9d[_0x1cc8('0x3e')]=_[_0x1cc8('0x3d')](_0x36c6eb[_0x1cc8('0x3e')]);_0x133b9d['filters']=_['intersection'](_0x133b9d[_0x1cc8('0x3c')],_0x133b9d[_0x1cc8('0x3e')]);_0x4f61b1[_0x1cc8('0x41')]=_[_0x1cc8('0x40')](_0x133b9d['model'],qs[_0x1cc8('0x42')](_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x42')]));_0x4f61b1[_0x1cc8('0x41')]=_0x4f61b1[_0x1cc8('0x41')][_0x1cc8('0x94')]?_0x4f61b1[_0x1cc8('0x41')]:_0x133b9d[_0x1cc8('0x3c')];if(!_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x95')](_0x1cc8('0x96'))){_0x4f61b1[_0x1cc8('0x24')]=qs['limit'](_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x24')]);_0x4f61b1[_0x1cc8('0x22')]=qs[_0x1cc8('0x22')](_0x36c6eb['query'][_0x1cc8('0x22')]);}_0x4f61b1['order']=qs['sort'](_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x97')]);_0x4f61b1[_0x1cc8('0x98')]=qs[_0x1cc8('0x3f')](_[_0x1cc8('0x99')](_0x36c6eb[_0x1cc8('0x3e')],_0x133b9d[_0x1cc8('0x3f')]));_0x4f61b1[_0x1cc8('0x98')]['ChatInteractionId']=_0xa74a96['id'];if(_0x36c6eb['query'][_0x1cc8('0x9a')]){_0x4f61b1[_0x1cc8('0x98')]=_['merge'](_0x4f61b1[_0x1cc8('0x98')],{'$or':_['map'](_0x4f61b1[_0x1cc8('0x41')],function(_0x444a7b){var _0x447cb7={};_0x447cb7[_0x444a7b]={'$like':'%'+_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x9a')]+'%'};return _0x447cb7;})});}if(_0x36c6eb['query'][_0x1cc8('0x9b')]){var _0x29b3c1=_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x9b')]['split'](',');var _0x388357={};_0x388357[_0x29b3c1[0x0]]={'$gte':moment(_0x29b3c1[0x1])[_0x1cc8('0x72')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4f61b1[_0x1cc8('0x98')]=_[_0x1cc8('0x2b')](_0x4f61b1['where'],_0x388357);}_0x4f61b1=_['merge']({},_0x4f61b1,_0x36c6eb[_0x1cc8('0x44')]);return db[_0x1cc8('0x5b')]['count']({'where':_0x4f61b1[_0x1cc8('0x98')]})[_0x1cc8('0x14')](function(_0x1b8d07){_0x759a2b[_0x1cc8('0x9c')]=_0x1b8d07;if(_0x36c6eb[_0x1cc8('0x3e')][_0x1cc8('0x9d')]){_0x4f61b1[_0x1cc8('0x43')]=[{'all':!![]}];}return db[_0x1cc8('0x5b')][_0x1cc8('0x9e')](_0x4f61b1);})[_0x1cc8('0x14')](function(_0xa2b4a7){_0x759a2b['rows']=_0xa2b4a7;return _0x759a2b;});}})[_0x1cc8('0x14')](respondWithFilteredResult(_0x50f043,_0x4f61b1))[_0x1cc8('0x3a')](handleError(_0x50f043,null));};exports[_0x1cc8('0x9f')]=function(_0x40427a,_0x1c63b9){var _0x336472={'where':{}},_0x4a91df={},_0x53487e={'count':0x0,'rows':[]};return db[_0x1cc8('0x32')][_0x1cc8('0x4a')]({'where':{'id':_0x40427a[_0x1cc8('0x3b')]['id']}})[_0x1cc8('0x14')](handleEntityNotFound(_0x1c63b9,null))[_0x1cc8('0x14')](function(_0x3183b0){if(_0x3183b0){_0x4a91df[_0x1cc8('0x3c')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x4a91df[_0x1cc8('0x3e')]=_[_0x1cc8('0x3d')](_0x40427a['query']);_0x4a91df['filters']=_['intersection'](_0x4a91df[_0x1cc8('0x3c')],_0x4a91df[_0x1cc8('0x3e')]);_0x336472[_0x1cc8('0x41')]=_['intersection'](_0x4a91df[_0x1cc8('0x3c')],qs[_0x1cc8('0x42')](_0x40427a[_0x1cc8('0x3e')]['fields']));_0x336472[_0x1cc8('0x41')]=_0x336472[_0x1cc8('0x41')][_0x1cc8('0x94')]?_0x336472['attributes']:_0x4a91df['model'];if(!_0x40427a[_0x1cc8('0x3e')][_0x1cc8('0x95')](_0x1cc8('0x96'))){_0x336472['limit']=qs[_0x1cc8('0x24')](_0x40427a[_0x1cc8('0x3e')][_0x1cc8('0x24')]);_0x336472[_0x1cc8('0x22')]=qs[_0x1cc8('0x22')](_0x40427a[_0x1cc8('0x3e')][_0x1cc8('0x22')]);}_0x336472[_0x1cc8('0xa0')]=qs[_0x1cc8('0x97')](_0x40427a['query'][_0x1cc8('0x97')]);_0x336472[_0x1cc8('0x98')]=qs['filters'](_[_0x1cc8('0x99')](_0x40427a[_0x1cc8('0x3e')],_0x4a91df[_0x1cc8('0x3f')]));_0x336472[_0x1cc8('0x98')][_0x1cc8('0xa1')]=_0x3183b0['id'];if(_0x40427a[_0x1cc8('0x3e')][_0x1cc8('0x9a')]){_0x336472[_0x1cc8('0x98')]=_[_0x1cc8('0x2b')](_0x336472[_0x1cc8('0x98')],{'$or':_[_0x1cc8('0xa2')](_0x336472[_0x1cc8('0x41')],function(_0x3657ce){var _0x6d042b={};_0x6d042b[_0x3657ce]={'$like':'%'+_0x40427a['query'][_0x1cc8('0x9a')]+'%'};return _0x6d042b;})});}_0x336472[_0x1cc8('0x98')][_0x1cc8('0x85')]=![];if(_0x40427a['query']['id']){_0x336472[_0x1cc8('0x98')]['id']={'$gt':_0x40427a[_0x1cc8('0x3e')]['id']};}_0x336472=_[_0x1cc8('0x2b')]({},_0x336472,_0x40427a[_0x1cc8('0x44')]);return db[_0x1cc8('0x5b')][_0x1cc8('0x9c')]({'where':_0x336472[_0x1cc8('0x98')]})[_0x1cc8('0x14')](function(_0x2caaf2){_0x53487e[_0x1cc8('0x9c')]=_0x2caaf2;_0x336472[_0x1cc8('0x43')]=[];if(_0x40427a[_0x1cc8('0x3e')][_0x1cc8('0xa3')]){_0x336472['include']['push']({'model':db[_0x1cc8('0x7d')],'as':_0x1cc8('0x7d'),'attributes':['id',_0x1cc8('0x7f'),_0x1cc8('0x7e')]});}if(_0x40427a[_0x1cc8('0x3e')][_0x1cc8('0x9d')]){_0x336472[_0x1cc8('0x43')]=[{'all':!![]}];}return db[_0x1cc8('0x5b')][_0x1cc8('0x9e')](_0x336472);})[_0x1cc8('0x14')](function(_0x26adeb){_0x53487e[_0x1cc8('0xa4')]=_0x26adeb;return _0x53487e;});}})['then'](respondWithFilteredResult(_0x1c63b9,_0x336472))[_0x1cc8('0x3a')](handleError(_0x1c63b9,null));};exports[_0x1cc8('0xa5')]=function(_0x2ec144,_0x46ab52){return db[_0x1cc8('0x32')]['find']({'where':{'id':_0x2ec144[_0x1cc8('0x3b')]['id']}})['then'](handleEntityNotFound(_0x46ab52,null))['then'](function(_0x4a0d0e){if(_0x4a0d0e){return _0x4a0d0e[_0x1cc8('0xa6')](_0x2ec144[_0x1cc8('0x2c')][_0x1cc8('0x91')],_[_0x1cc8('0x92')](_0x2ec144[_0x1cc8('0x2c')],[_0x1cc8('0x91'),'id'])||{})[_0x1cc8('0xa7')](function(){return db['Tag'][_0x1cc8('0x9e')]({'attributes':['id',_0x1cc8('0x29'),_0x1cc8('0xa8')],'where':{'id':_0x2ec144[_0x1cc8('0x2c')]['ids']}});})['then'](function(_0x40c289){socket[_0x1cc8('0xa9')](_0x1cc8('0xaa'),{'id':Number(_0x2ec144['params']['id']),'tags':_0x40c289||[]});return{'id':Number(_0x2ec144['params']['id']),'tags':_0x40c289||[]};});}})[_0x1cc8('0x14')](respondWithResult(_0x46ab52,null))[_0x1cc8('0x3a')](handleError(_0x46ab52,null));};exports['removeTags']=function(_0x10ef13,_0x5272fe){return db[_0x1cc8('0x32')][_0x1cc8('0x45')]({'where':{'id':_0x10ef13['params']['id']}})[_0x1cc8('0x14')](handleEntityNotFound(_0x5272fe,null))[_0x1cc8('0x14')](function(_0x32b2e4){if(_0x32b2e4){return _0x32b2e4['removeTags'](_0x10ef13[_0x1cc8('0x3e')][_0x1cc8('0x91')]);}})[_0x1cc8('0x14')](respondWithStatusCode(_0x5272fe,null))[_0x1cc8('0x3a')](handleError(_0x5272fe,null));};exports[_0x1cc8('0xab')]=function(_0x5ca706,_0x49d46a){var _0x18de8f=moment()['unix']()[_0x1cc8('0xac')]();var _0x12684a=path[_0x1cc8('0x6e')](config[_0x1cc8('0x6f')],_0x1cc8('0xad'),_0x1cc8('0xae'),_0x1cc8('0xaf'));var _0x22f358=path[_0x1cc8('0x6e')](config[_0x1cc8('0x6f')],'server','files','attachments');var _0x522b4b=path[_0x1cc8('0x6e')](_0x12684a,_0x18de8f);var _0x343cfc=util[_0x1cc8('0x72')](_0x1cc8('0xb0'),_0x5ca706['params']['id'],_0x18de8f);var _0x271c1c=path[_0x1cc8('0x6e')](_0x12684a,_0x343cfc);var _0x22a6d1=[];_0x22a6d1[_0x1cc8('0xb1')]({'model':db[_0x1cc8('0x7d')],'as':_0x1cc8('0x7d'),'attributes':['id',_0x1cc8('0x7f')],'raw':!![]});_0x22a6d1[_0x1cc8('0xb1')]({'model':db[_0x1cc8('0x5e')],'as':_0x1cc8('0x5f'),'attributes':['id',_0x1cc8('0xb2'),'lastName'],'raw':!![]});if(_0x5ca706[_0x1cc8('0x3e')]['attachments']){_0x22a6d1[_0x1cc8('0xb1')]({'model':db[_0x1cc8('0x6a')],'as':'Attachment','raw':!![]});}var _0x542afb=[{'model':db['ChatMessage'],'as':_0x1cc8('0x75'),'attributes':['id',_0x1cc8('0x2c'),_0x1cc8('0xb3'),'direction',_0x1cc8('0x85'),_0x1cc8('0xb4')],'include':_0x22a6d1}];_0x542afb[_0x1cc8('0xb1')]({'model':db[_0x1cc8('0x4b')],'as':_0x1cc8('0xb5'),'attributes':['id','name']});_0x542afb[_0x1cc8('0xb1')]({'model':db[_0x1cc8('0x7d')],'as':_0x1cc8('0xb6'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x1cc8('0x45')]({'where':{'id':_0x5ca706[_0x1cc8('0x3b')]['id']},'include':_0x542afb})['then'](handleEntityNotFound(_0x49d46a,null))[_0x1cc8('0x14')](function(_0x126b5e){if(_0x126b5e){var _0x4d9184=_0x126b5e['get']({'plain':!![]});fs[_0x1cc8('0xb7')](_0x522b4b);var _0x3fcc21={'channel':_0x1cc8('0xb8'),'account':_0x4d9184[_0x1cc8('0xb5')]['name'],'agent':_0x4d9184[_0x1cc8('0xb6')]?_0x4d9184['Owner'][_0x1cc8('0x7f')]:_0x1cc8('0xb9'),'createdAt':moment(_0x4d9184[_0x1cc8('0xb3')])[_0x1cc8('0x72')](_0x1cc8('0xba'))[_0x1cc8('0xac')](),'closedAt':_0x4d9184['closed']?moment(_0x4d9184[_0x1cc8('0xbb')])['format'](_0x1cc8('0xba'))['toString']():'','disposition':_0x4d9184[_0x1cc8('0xbc')],'chatInfo':{'browser':_0x4d9184[_0x1cc8('0xbd')],'os':_0x4d9184[_0x1cc8('0xbe')],'referer':_0x4d9184[_0x1cc8('0xbf')],'customerIp':_0x4d9184[_0x1cc8('0xc0')],'customerPort':_0x4d9184[_0x1cc8('0xc1')]?_0x4d9184[_0x1cc8('0xc1')]:'N.A.'},'messages':_(_0x4d9184[_0x1cc8('0x75')])[_0x1cc8('0xc2')]()[_0x1cc8('0x9a')]({'secret':![]})[_0x1cc8('0xa2')](function(_0x2fa656){if(_0x2fa656[_0x1cc8('0x6a')]){var _0x3d1e64=path[_0x1cc8('0x6e')](_0x22f358,_0x2fa656['Attachment'][_0x1cc8('0x71')]);if(fs[_0x1cc8('0xc3')](_0x3d1e64)){fs['createReadStream'](_0x3d1e64)[_0x1cc8('0xc4')](fs[_0x1cc8('0xc5')](path[_0x1cc8('0x6e')](_0x522b4b,_0x2fa656[_0x1cc8('0x6a')][_0x1cc8('0x71')])));}}return{'date':moment(_0x2fa656['createdAt'])[_0x1cc8('0x72')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1cc8('0xac')](),'sender':_0x2fa656[_0x1cc8('0x84')]==='out'?_0x2fa656[_0x1cc8('0x7d')]?_0x2fa656[_0x1cc8('0x7d')][_0x1cc8('0x7f')]:'System':_0x2fa656[_0x1cc8('0x5f')][_0x1cc8('0xb2')]+(_0x2fa656[_0x1cc8('0x5f')][_0x1cc8('0xc6')]?'\x20'+_0x2fa656[_0x1cc8('0x5f')]['lastName']:''),'body':_0x2fa656[_0x1cc8('0x6a')]?_0x2fa656[_0x1cc8('0x6a')][_0x1cc8('0x71')]:_0x2fa656['body'],'direction':_0x2fa656[_0x1cc8('0x84')]===_0x1cc8('0x5a')?'A':'C','secret':_0x2fa656[_0x1cc8('0x85')],'read':_0x2fa656[_0x1cc8('0xb4')],'attachment':_0x2fa656[_0x1cc8('0x6a')]};})['value']()};return ejs[_0x1cc8('0xc7')](path['join'](config[_0x1cc8('0x6f')],'server','views','downloadInteraction.ejs'),{'interaction':_0x3fcc21})[_0x1cc8('0x14')](function(_0x1777e3){var _0x4f63d8=path[_0x1cc8('0x6e')](_0x522b4b,_0x1cc8('0xc8')+_0x4d9184['id']+'-'+_0x18de8f+'.pdf');var _0x1f2de1={'path':_0x4f63d8,'channel':_0x1cc8('0xb8'),'interactionId':_0x4d9184['id']};return pdf[_0x1cc8('0xc9')](_0x1777e3,_0x1f2de1);})[_0x1cc8('0x14')](function(){return new Promise(function(_0x4b4a51,_0x2f2f27){zipdir(_0x522b4b,{'saveTo':_0x271c1c},function(_0x4bb60e,_0x1c59dc){if(_0x4bb60e)return _0x2f2f27(_0x4bb60e);return _0x4b4a51(_0x1c59dc);});})[_0x1cc8('0x14')](function(){return new BPromise(function(_0x3206f5,_0x2ca04b){rimraf(_0x522b4b,function(_0x7d3e9a){if(_0x7d3e9a)_0x2ca04b(_0x7d3e9a);return _0x3206f5();});});})[_0x1cc8('0x14')](function(){return _0x49d46a[_0x1cc8('0xab')](_0x271c1c,_0x343cfc,function(_0xb4977){if(_0xb4977){logger['error']('err',_0xb4977);}else{fs['unlinkSync'](_0x271c1c);}});});});}else{return _0x49d46a['sendStatus'](0xc8);}})[_0x1cc8('0x3a')](handleError(_0x49d46a,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 2d8097a..d58edf6 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 _0x6722=['then','Users','findAll','setDataValue','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','getUsers'];(function(_0x12d44c,_0xf11296){var _0x4fde20=function(_0x3c1ad6){while(--_0x3c1ad6){_0x12d44c['push'](_0x12d44c['shift']());}};_0x4fde20(++_0xf11296);}(_0x6722,0x8a));var _0x2672=function(_0xba0502,_0x2fb75b){_0xba0502=_0xba0502-0x0;var _0x5ed16d=_0x6722[_0xba0502];return _0x5ed16d;};'use strict';var EventEmitter=require(_0x2672('0x0'));var ChatInteraction=require(_0x2672('0x1'))['db']['ChatInteraction'];var ChatMessage=require('../../mysqldb')['db'][_0x2672('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x2672('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1c52c3){return function(_0x18284d,_0x187420,_0x41c609){_0x18284d[_0x2672('0x4')]({'attributes':['id'],'raw':!![]})[_0x2672('0x5')](function(_0x138e25){_0x18284d['setDataValue'](_0x2672('0x6'),_0x138e25['map'](function(_0x1ae12e){return{'id':_0x1ae12e['id']};}));return ChatMessage[_0x2672('0x7')]({'where':{'ChatInteractionId':_0x18284d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2672('0x5')](function(_0x4e6090){_0x18284d[_0x2672('0x8')]('unreadMessages',_0x4e6090['length']);ChatInteractionEvents[_0x2672('0x9')](_0x1c52c3+':'+_0x18284d['id'],_0x18284d);ChatInteractionEvents[_0x2672('0x9')](_0x1c52c3,_0x18284d);_0x41c609(null);})['catch'](_0x41c609(null));};}for(var e in events){if(events[_0x2672('0xa')](e)){var event=events[e];ChatInteraction[_0x2672('0xb')](e,emitEvent(event));}}module[_0x2672('0xc')]=ChatInteractionEvents; \ No newline at end of file +var _0x2c67=['then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x2c67,0x81));var _0x72c6=function(_0x26b090,_0x129196){_0x26b090=_0x26b090-0x0;var _0x1e488a=_0x2c67[_0x26b090];return _0x1e488a;};'use strict';var EventEmitter=require(_0x72c6('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0x72c6('0x1'))['db'][_0x72c6('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x72c6('0x3')](0x0);var events={'afterCreate':_0x72c6('0x4'),'afterUpdate':_0x72c6('0x5'),'afterDestroy':_0x72c6('0x6')};function emitEvent(_0x5be971){return function(_0x1f2acb,_0x2136c2,_0x1d65a3){_0x1f2acb['getUsers']({'attributes':['id'],'raw':!![]})[_0x72c6('0x7')](function(_0x206693){_0x1f2acb[_0x72c6('0x8')](_0x72c6('0x9'),_0x206693[_0x72c6('0xa')](function(_0x534611){return{'id':_0x534611['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x1f2acb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x9802aa){_0x1f2acb[_0x72c6('0x8')](_0x72c6('0xb'),_0x9802aa[_0x72c6('0xc')]);ChatInteractionEvents[_0x72c6('0xd')](_0x5be971+':'+_0x1f2acb['id'],_0x1f2acb);ChatInteractionEvents[_0x72c6('0xd')](_0x5be971,_0x1f2acb);_0x1d65a3(null);})[_0x72c6('0xe')](_0x1d65a3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x72c6('0xf')](e,emitEvent(event));}}module[_0x72c6('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 2c7b3c8..f844eb7 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 _0x175b=['define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports'];(function(_0x10518d,_0x12bcf4){var _0x84fb83=function(_0x1b0a2b){while(--_0x1b0a2b){_0x10518d['push'](_0x10518d['shift']());}};_0x84fb83(++_0x12bcf4);}(_0x175b,0x15d));var _0xb175=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0x175b[_0x2b0875];return _0xedb8d7;};'use strict';var _=require(_0xb175('0x0'));var util=require(_0xb175('0x1'));var logger=require(_0xb175('0x2'))(_0xb175('0x3'));var moment=require(_0xb175('0x4'));var BPromise=require(_0xb175('0x5'));var rp=require(_0xb175('0x6'));var fs=require('fs');var path=require(_0xb175('0x7'));var rimraf=require(_0xb175('0x8'));var config=require('../../config/environment');var attributes=require(_0xb175('0x9'));module[_0xb175('0xa')]=function(_0x4d2c47,_0x5b62e6){return _0x4d2c47[_0xb175('0xb')]('ChatInteraction',attributes,{'tableName':_0xb175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c78ef,_0x129ce0,_0x502075){if(_0x3c78ef[_0xb175('0xd')](_0xb175('0xe'))){_0x3c78ef[_0xb175('0xf')]=moment()[_0xb175('0x10')](_0xb175('0x11'));}_0x502075(null,_0x3c78ef);}},'charset':_0xb175('0x12'),'collate':_0xb175('0x13')});}; \ No newline at end of file +var _0x8066=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatInteraction','changed','closed'];(function(_0x42dcbb,_0x3bab87){var _0x597f5d=function(_0x3c93c6){while(--_0x3c93c6){_0x42dcbb['push'](_0x42dcbb['shift']());}};_0x597f5d(++_0x3bab87);}(_0x8066,0xe5));var _0x6806=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x8066[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0x6806('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6806('0x1'));var moment=require(_0x6806('0x2'));var BPromise=require(_0x6806('0x3'));var rp=require(_0x6806('0x4'));var fs=require('fs');var path=require(_0x6806('0x5'));var rimraf=require('rimraf');var config=require(_0x6806('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x6806('0x7')]=function(_0x43b08b,_0x3ed9c3){return _0x43b08b['define'](_0x6806('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2eba39,_0x4831de,_0x58edc8){if(_0x2eba39[_0x6806('0x9')](_0x6806('0xa'))){_0x2eba39[_0x6806('0xb')]=moment()[_0x6806('0xc')](_0x6806('0xd'));}_0x58edc8(null,_0x2eba39);}},'charset':_0x6806('0xe'),'collate':_0x6806('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 62956a8..7ca5c80 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 _0xaa85=['catch','ChatInteraction','update','body','options','raw','where','attributes','then','UpdateChatInteraction','AddTagsToChatInteraction','find','omit','AddTags','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x250646,_0x151509){var _0x4c3e10=function(_0x43921b){while(--_0x43921b){_0x250646['push'](_0x250646['shift']());}};_0x4c3e10(++_0x151509);}(_0xaa85,0xf8));var _0x5aa8=function(_0x230452,_0x279d15){_0x230452=_0x230452-0x0;var _0x548b02=_0xaa85[_0x230452];return _0x548b02;};'use strict';var _=require(_0x5aa8('0x0'));var util=require(_0x5aa8('0x1'));var moment=require('moment');var BPromise=require(_0x5aa8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5aa8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5aa8('0x4'));var logger=require(_0x5aa8('0x5'))(_0x5aa8('0x6'));var config=require(_0x5aa8('0x7'));var jayson=require(_0x5aa8('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5aa8('0x9')]=_[_0x5aa8('0xa')](config[_0x5aa8('0x9')],{'host':_0x5aa8('0xb'),'port':0x18eb});var socket=require(_0x5aa8('0xc'))(new Redis(config[_0x5aa8('0x9')]));require(_0x5aa8('0xd'))[_0x5aa8('0xe')](socket);function respondWithRpcPromise(_0x3f5d6e,_0x5b51f8,_0xb8bde8){return new BPromise(function(_0x285a74,_0x1a9848){return client[_0x5aa8('0xf')](_0x3f5d6e,_0xb8bde8)['then'](function(_0xa09b1a){logger[_0x5aa8('0x10')](_0x5aa8('0x11'),_0x5b51f8,_0x5aa8('0x12'));logger[_0x5aa8('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x5b51f8,_0x5aa8('0x12'),JSON[_0x5aa8('0x14')](_0xa09b1a));if(_0xa09b1a[_0x5aa8('0x15')]){if(_0xa09b1a[_0x5aa8('0x15')][_0x5aa8('0x16')]===0x1f4){logger[_0x5aa8('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x5b51f8,_0xa09b1a[_0x5aa8('0x15')]['message']);return _0x1a9848(_0xa09b1a[_0x5aa8('0x15')][_0x5aa8('0x17')]);}logger['error'](_0x5aa8('0x11'),_0x5b51f8,_0xa09b1a['error'][_0x5aa8('0x17')]);return _0x285a74(_0xa09b1a[_0x5aa8('0x15')][_0x5aa8('0x17')]);}else{logger[_0x5aa8('0x10')](_0x5aa8('0x11'),_0x5b51f8,_0x5aa8('0x12'));_0x285a74(_0xa09b1a[_0x5aa8('0x18')][_0x5aa8('0x17')]);}})[_0x5aa8('0x19')](function(_0x3a8f30){logger[_0x5aa8('0x15')](_0x5aa8('0x11'),_0x5b51f8,_0x3a8f30);_0x1a9848(_0x3a8f30);});});}exports['UpdateChatInteraction']=function(_0x5acdbf){var _0xa17cf=this;return new Promise(function(_0x55c054,_0x4fd173){return db[_0x5aa8('0x1a')][_0x5aa8('0x1b')](_0x5acdbf[_0x5aa8('0x1c')],{'raw':_0x5acdbf['options']?_0x5acdbf[_0x5aa8('0x1d')][_0x5aa8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5acdbf[_0x5aa8('0x1d')]?_0x5acdbf['options'][_0x5aa8('0x1f')]||null:null,'attributes':_0x5acdbf[_0x5aa8('0x1d')]?_0x5acdbf['options'][_0x5aa8('0x20')]||null:null,'limit':_0x5acdbf[_0x5aa8('0x1d')]?_0x5acdbf[_0x5aa8('0x1d')]['limit']||null:null})[_0x5aa8('0x21')](function(_0x5278ea){logger[_0x5aa8('0x10')](_0x5aa8('0x22'),_0x5acdbf);logger[_0x5aa8('0x13')](_0x5aa8('0x22'),_0x5acdbf,JSON[_0x5aa8('0x14')](_0x5278ea));_0x55c054(_0x5278ea);})[_0x5aa8('0x19')](function(_0x87c113){logger[_0x5aa8('0x15')](_0x5aa8('0x22'),_0x87c113[_0x5aa8('0x17')],_0x5acdbf);_0x4fd173(_0xa17cf[_0x5aa8('0x15')](0x1f4,_0x87c113[_0x5aa8('0x17')]));});});};exports[_0x5aa8('0x23')]=function(_0x1984c2){return new Promise(function(_0x5403c9,_0x5b86fc){return db['ChatInteraction'][_0x5aa8('0x24')]({'where':_0x1984c2['options']?_0x1984c2['options']['where']||null:null})[_0x5aa8('0x21')](function(_0x5c7ba7){if(_0x5c7ba7){return _0x5c7ba7['addTags'](_0x1984c2[_0x5aa8('0x1c')]['ids'],_[_0x5aa8('0x25')](_0x1984c2[_0x5aa8('0x1c')],['ids','id'])||{});}})['spread'](function(_0x23eedb){logger['info']('AddTags',_0x1984c2);logger['debug'](_0x5aa8('0x26'),_0x1984c2,JSON['stringify'](_0x23eedb));_0x5403c9(_0x23eedb);})[_0x5aa8('0x19')](function(_0x196158){logger[_0x5aa8('0x15')](_0x5aa8('0x26'),_0x196158[_0x5aa8('0x17')],_0x1984c2);_0x5b86fc(_this[_0x5aa8('0x15')](0x1f4,_0x196158['message']));});});}; \ No newline at end of file +var _0x2665=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateChatInteraction','update','body','options','where','attributes','AddTagsToChatInteraction','ChatInteraction','find','addTags','omit','ids','AddTags','lodash','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2665,0x1d1));var _0x5266=function(_0x5cb488,_0x92f6c7){_0x5cb488=_0x5cb488-0x0;var _0x2270d1=_0x2665[_0x5cb488];return _0x2270d1;};'use strict';var _=require(_0x5266('0x0'));var util=require('util');var moment=require(_0x5266('0x1'));var BPromise=require(_0x5266('0x2'));var rs=require(_0x5266('0x3'));var fs=require('fs');var Redis=require(_0x5266('0x4'));var db=require(_0x5266('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5266('0x6'))(_0x5266('0x7'));var config=require(_0x5266('0x8'));var jayson=require(_0x5266('0x9'));var client=jayson[_0x5266('0xa')]['http']({'port':0x232a});config[_0x5266('0xb')]=_['defaults'](config[_0x5266('0xb')],{'host':_0x5266('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5266('0xb')]));require(_0x5266('0xd'))[_0x5266('0xe')](socket);function respondWithRpcPromise(_0x313874,_0x149ab6,_0x5b1fc1){return new BPromise(function(_0x2b69e8,_0x267a00){return client[_0x5266('0xf')](_0x313874,_0x5b1fc1)[_0x5266('0x10')](function(_0xb3b1ca){logger[_0x5266('0x11')](_0x5266('0x12'),_0x149ab6,_0x5266('0x13'));logger[_0x5266('0x14')](_0x5266('0x15'),_0x149ab6,_0x5266('0x13'),JSON[_0x5266('0x16')](_0xb3b1ca));if(_0xb3b1ca['error']){if(_0xb3b1ca['error']['code']===0x1f4){logger[_0x5266('0x17')](_0x5266('0x12'),_0x149ab6,_0xb3b1ca['error'][_0x5266('0x18')]);return _0x267a00(_0xb3b1ca[_0x5266('0x17')]['message']);}logger[_0x5266('0x17')](_0x5266('0x12'),_0x149ab6,_0xb3b1ca['error']['message']);return _0x2b69e8(_0xb3b1ca[_0x5266('0x17')][_0x5266('0x18')]);}else{logger[_0x5266('0x11')](_0x5266('0x12'),_0x149ab6,_0x5266('0x13'));_0x2b69e8(_0xb3b1ca['result'][_0x5266('0x18')]);}})[_0x5266('0x19')](function(_0x3fff7f){logger['error'](_0x5266('0x12'),_0x149ab6,_0x3fff7f);_0x267a00(_0x3fff7f);});});}exports[_0x5266('0x1a')]=function(_0x3a8b09){var _0x4c4c1f=this;return new Promise(function(_0x5d2c8f,_0x1ed79a){return db['ChatInteraction'][_0x5266('0x1b')](_0x3a8b09[_0x5266('0x1c')],{'raw':_0x3a8b09[_0x5266('0x1d')]?_0x3a8b09[_0x5266('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a8b09[_0x5266('0x1d')]?_0x3a8b09['options'][_0x5266('0x1e')]||null:null,'attributes':_0x3a8b09[_0x5266('0x1d')]?_0x3a8b09[_0x5266('0x1d')][_0x5266('0x1f')]||null:null,'limit':_0x3a8b09[_0x5266('0x1d')]?_0x3a8b09['options']['limit']||null:null})[_0x5266('0x10')](function(_0x3fed6c){logger[_0x5266('0x11')]('UpdateChatInteraction',_0x3a8b09);logger['debug'](_0x5266('0x1a'),_0x3a8b09,JSON[_0x5266('0x16')](_0x3fed6c));_0x5d2c8f(_0x3fed6c);})[_0x5266('0x19')](function(_0x15ddbf){logger[_0x5266('0x17')](_0x5266('0x1a'),_0x15ddbf[_0x5266('0x18')],_0x3a8b09);_0x1ed79a(_0x4c4c1f['error'](0x1f4,_0x15ddbf[_0x5266('0x18')]));});});};exports[_0x5266('0x20')]=function(_0x42aa34){return new Promise(function(_0x575662,_0x28aea5){return db[_0x5266('0x21')][_0x5266('0x22')]({'where':_0x42aa34[_0x5266('0x1d')]?_0x42aa34[_0x5266('0x1d')]['where']||null:null})[_0x5266('0x10')](function(_0x474831){if(_0x474831){return _0x474831[_0x5266('0x23')](_0x42aa34['body']['ids'],_[_0x5266('0x24')](_0x42aa34[_0x5266('0x1c')],[_0x5266('0x25'),'id'])||{});}})['spread'](function(_0x13244e){logger[_0x5266('0x11')](_0x5266('0x26'),_0x42aa34);logger['debug'](_0x5266('0x26'),_0x42aa34,JSON[_0x5266('0x16')](_0x13244e));_0x575662(_0x13244e);})[_0x5266('0x19')](function(_0x331af2){logger['error'](_0x5266('0x26'),_0x331af2[_0x5266('0x18')],_0x42aa34);_0x28aea5(_this[_0x5266('0x17')](0x1f4,_0x331af2[_0x5266('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 845350e..178a9aa 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 _0x5437=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','register'];(function(_0x409bf5,_0x94841f){var _0xd6aea4=function(_0x14114e){while(--_0x14114e){_0x409bf5['push'](_0x409bf5['shift']());}};_0xd6aea4(++_0x94841f);}(_0x5437,0x1b2));var _0x7543=function(_0x5c1329,_0x44d752){_0x5c1329=_0x5c1329-0x0;var _0x282631=_0x5437[_0x5c1329];return _0x282631;};'use strict';var ChatInteractionEvents=require(_0x7543('0x0'));var events=[_0x7543('0x1'),_0x7543('0x2'),_0x7543('0x3')];function createListener(_0x5241fe,_0x1fb825){return function(_0x8ac58f){_0x1fb825[_0x7543('0x4')](_0x5241fe,_0x8ac58f);};}function removeListener(_0x732e77,_0x5dccbe){return function(){ChatInteractionEvents['removeListener'](_0x732e77,_0x5dccbe);};}exports[_0x7543('0x5')]=function(_0x4dd616){for(var _0x3422bd=0x0,_0x32c310=events[_0x7543('0x6')];_0x3422bd<_0x32c310;_0x3422bd++){var _0x2a6ca5=events[_0x3422bd];var _0x2c247f=createListener(_0x7543('0x7')+_0x2a6ca5,_0x4dd616);ChatInteractionEvents['on'](_0x2a6ca5,_0x2c247f);}}; \ No newline at end of file +var _0xd689=['save','update','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x56faeb,_0xc940de){var _0x1b96a9=function(_0x3cdf68){while(--_0x3cdf68){_0x56faeb['push'](_0x56faeb['shift']());}};_0x1b96a9(++_0xc940de);}(_0xd689,0x1cd));var _0x9d68=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0xd689[_0x305c8f];return _0x5ddc30;};'use strict';var ChatInteractionEvents=require(_0x9d68('0x0'));var events=[_0x9d68('0x1'),'remove',_0x9d68('0x2')];function createListener(_0x5e8ddc,_0x443d35){return function(_0x4243c8){_0x443d35[_0x9d68('0x3')](_0x5e8ddc,_0x4243c8);};}function removeListener(_0x493d93,_0x4fc29d){return function(){ChatInteractionEvents[_0x9d68('0x4')](_0x493d93,_0x4fc29d);};}exports[_0x9d68('0x5')]=function(_0x58ebd6){for(var _0x492239=0x0,_0x160f4c=events['length'];_0x492239<_0x160f4c;_0x492239++){var _0x438093=events[_0x492239];var _0x27af52=createListener(_0x9d68('0x6')+_0x438093,_0x58ebd6);ChatInteractionEvents['on'](_0x438093,_0x27af52);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index df1ecb9..e534762 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 _0xbf12=['delete','chatinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','format','%s-%s','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close'];(function(_0x3ddb4e,_0x5d9ecf){var _0x16202e=function(_0x505a25){while(--_0x505a25){_0x3ddb4e['push'](_0x3ddb4e['shift']());}};_0x16202e(++_0x5d9ecf);}(_0xbf12,0x64));var _0x2bf1=function(_0xc7c78d,_0x1dd9fb){_0xc7c78d=_0xc7c78d-0x0;var _0x175f3d=_0xbf12[_0xc7c78d];return _0x175f3d;};'use strict';var multer=require('multer');var util=require(_0x2bf1('0x0'));var path=require(_0x2bf1('0x1'));var timeout=require(_0x2bf1('0x2'));var express=require(_0x2bf1('0x3'));var router=express[_0x2bf1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bf1('0x5'));var interaction=require(_0x2bf1('0x6'));var config=require('../../config/environment');var controller=require(_0x2bf1('0x7'));router[_0x2bf1('0x8')]('/',auth[_0x2bf1('0x9')](),controller['index']);router['get']('/describe',auth[_0x2bf1('0x9')](),controller[_0x2bf1('0xa')]);router[_0x2bf1('0x8')](_0x2bf1('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router['get']('/:id/attachment_download',auth[_0x2bf1('0xc')](),controller['attachmentDownload']);router[_0x2bf1('0x8')](_0x2bf1('0xd'),auth['isAuthenticated'](),controller[_0x2bf1('0xe')]);router['get'](_0x2bf1('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x2bf1('0x10')]);router[_0x2bf1('0x8')](_0x2bf1('0x11'),auth[_0x2bf1('0x9')](),controller[_0x2bf1('0x12')]);router[_0x2bf1('0x13')]('/',auth[_0x2bf1('0x9')](),controller['create']);router[_0x2bf1('0x13')](_0x2bf1('0x14'),auth[_0x2bf1('0x9')](),controller[_0x2bf1('0x15')]);var upload=multer({'storage':multer[_0x2bf1('0x16')]({'destination':function(_0x492d19,_0x478d0e,_0x4f245e){_0x4f245e(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4f3cfe,_0x3148ca,_0x15c5bc){_0x15c5bc(null,util[_0x2bf1('0x17')](_0x2bf1('0x18'),Date['now'](),_0x3148ca[_0x2bf1('0x19')][_0x2bf1('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2bf1('0x13')](_0x2bf1('0x1b'),upload[_0x2bf1('0x1c')](_0x2bf1('0x1d')),controller[_0x2bf1('0x1e')]);router[_0x2bf1('0x13')](_0x2bf1('0xd'),auth[_0x2bf1('0xc')](),controller[_0x2bf1('0x1f')]);router[_0x2bf1('0x13')](_0x2bf1('0x20'),auth[_0x2bf1('0x9')](),interaction[_0x2bf1('0x21')](_0x2bf1('0x22'),'chatinteraction:addtags'),controller['addTags']);router[_0x2bf1('0x23')](_0x2bf1('0xb'),auth[_0x2bf1('0x9')](),interaction[_0x2bf1('0x21')]('chat',_0x2bf1('0x24')),controller[_0x2bf1('0x25')]);router[_0x2bf1('0x23')](_0x2bf1('0x26'),controller[_0x2bf1('0x27')]);router[_0x2bf1('0x23')](_0x2bf1('0x28'),auth[_0x2bf1('0xc')](),controller[_0x2bf1('0x29')]);router[_0x2bf1('0x23')](_0x2bf1('0x2a'),controller[_0x2bf1('0x2b')]);router[_0x2bf1('0x2c')](_0x2bf1('0xb'),auth['isAuthenticated'](),interaction[_0x2bf1('0x21')](_0x2bf1('0x22'),_0x2bf1('0x2d')),controller['destroy']);router[_0x2bf1('0x2c')]('/:id/tags',auth[_0x2bf1('0x9')](),controller[_0x2bf1('0x2e')]);module[_0x2bf1('0x2f')]=router; \ No newline at end of file +var _0x916c=['chatinteraction:update','update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','removeTags','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','getMessages','get','/:id/my_messages','getMyMessages','/:id/download','create','post','createVidaooSession','diskStorage','root','format','%s-%s','originalname','single','file','/:id/messages','addMessage','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chat'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x916c,0x152));var _0xc916=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x916c[_0x2df1f2];return _0x38652b;};'use strict';var multer=require(_0xc916('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc916('0x1'));var express=require('express');var router=express[_0xc916('0x2')]();var fs_extra=require(_0xc916('0x3'));var auth=require(_0xc916('0x4'));var interaction=require(_0xc916('0x5'));var config=require('../../config/environment');var controller=require(_0xc916('0x6'));router['get']('/',auth[_0xc916('0x7')](),controller[_0xc916('0x8')]);router['get'](_0xc916('0x9'),auth[_0xc916('0x7')](),controller[_0xc916('0xa')]);router['get'](_0xc916('0xb'),auth[_0xc916('0xc')](),controller[_0xc916('0xd')]);router['get']('/:id/attachment_download',auth[_0xc916('0xc')](),controller[_0xc916('0xe')]);router['get']('/:id/messages',auth[_0xc916('0x7')](),controller[_0xc916('0xf')]);router[_0xc916('0x10')](_0xc916('0x11'),auth[_0xc916('0xc')](),controller[_0xc916('0x12')]);router[_0xc916('0x10')](_0xc916('0x13'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xc916('0x14')]);router[_0xc916('0x15')]('/:id/vidaoo',auth[_0xc916('0x7')](),controller[_0xc916('0x16')]);var upload=multer({'storage':multer[_0xc916('0x17')]({'destination':function(_0x312a19,_0x3730f1,_0x49a95d){_0x49a95d(null,path['join'](config[_0xc916('0x18')],'server/files/attachments/'));},'filename':function(_0x5a142b,_0x3ff957,_0x3868cf){_0x3868cf(null,util[_0xc916('0x19')](_0xc916('0x1a'),Date['now'](),_0x3ff957[_0xc916('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xc916('0x15')]('/:id/attachment_upload',upload[_0xc916('0x1c')](_0xc916('0x1d')),controller['attachmentUpload']);router[_0xc916('0x15')](_0xc916('0x1e'),auth[_0xc916('0xc')](),controller[_0xc916('0x1f')]);router['post'](_0xc916('0x20'),auth[_0xc916('0x7')](),interaction['tracked']('chat',_0xc916('0x21')),controller[_0xc916('0x22')]);router[_0xc916('0x23')](_0xc916('0xb'),auth['isAuthenticated'](),interaction[_0xc916('0x24')](_0xc916('0x25'),_0xc916('0x26')),controller[_0xc916('0x27')]);router[_0xc916('0x23')]('/:id/custom_update',controller[_0xc916('0x28')]);router[_0xc916('0x23')](_0xc916('0x29'),auth[_0xc916('0xc')](),controller[_0xc916('0x2a')]);router['put'](_0xc916('0x2b'),controller['close']);router['delete'](_0xc916('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xc916('0x25'),_0xc916('0x2c')),controller['destroy']);router['delete'](_0xc916('0x20'),auth[_0xc916('0x7')](),controller[_0xc916('0x2d')]);module[_0xc916('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e9fb518..6d1fe01 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 _0x3c41=['sequelize','TEXT','BOOLEAN','INTEGER'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x3c41,0x10c));var _0x13c4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3c41[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x13c4('0x0'));module['exports']={'body':{'type':Sequelize[_0x13c4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x13c4('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x13c4('0x3')]}}; \ No newline at end of file +var _0x2354=['exports','TEXT','medium','INTEGER'];(function(_0x5d124d,_0x2b5378){var _0x99203=function(_0x1c339e){while(--_0x1c339e){_0x5d124d['push'](_0x5d124d['shift']());}};_0x99203(++_0x2b5378);}(_0x2354,0x84));var _0x4235=function(_0x63ba8,_0x5b4583){_0x63ba8=_0x63ba8-0x0;var _0x93620c=_0x2354[_0x63ba8];return _0x93620c;};'use strict';var Sequelize=require('sequelize');module[_0x4235('0x0')]={'body':{'type':Sequelize[_0x4235('0x1')](_0x4235('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x4235('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f1eaa73..61dd431 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 _0x4072=['apply','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','get','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x1b51d8,_0x2ca2ae){var _0xb6910f=function(_0xcebef8){while(--_0xcebef8){_0x1b51d8['push'](_0x1b51d8['shift']());}};_0xb6910f(++_0x2ca2ae);}(_0x4072,0x18e));var _0x2407=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4072[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2407('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2407('0x1'));var rp=require(_0x2407('0x2'));var moment=require(_0x2407('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2407('0x4'));var util=require(_0x2407('0x5'));var path=require(_0x2407('0x6'));var sox=require(_0x2407('0x7'));var csv=require(_0x2407('0x8'));var ejs=require(_0x2407('0x9'));var fs=require('fs');var fs_extra=require(_0x2407('0xa'));var _=require(_0x2407('0xb'));var squel=require(_0x2407('0xc'));var crypto=require(_0x2407('0xd'));var jsforce=require(_0x2407('0xe'));var deskjs=require(_0x2407('0xf'));var toCsv=require(_0x2407('0x8'));var querystring=require(_0x2407('0x10'));var Papa=require(_0x2407('0x11'));var Redis=require(_0x2407('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2407('0x13'));var as=require(_0x2407('0x14'));var hardwareService=require(_0x2407('0x15'));var logger=require(_0x2407('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2407('0x17'));var db=require(_0x2407('0x18'))['db'];config[_0x2407('0x19')]=_['defaults'](config[_0x2407('0x19')],{'host':_0x2407('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2407('0x19')]));require(_0x2407('0x1b'))[_0x2407('0x1c')](socket);function respondWithStatusCode(_0x253cd0,_0x21b262){_0x21b262=_0x21b262||0xcc;return function(_0xb4ee34){if(_0xb4ee34){return _0x253cd0[_0x2407('0x1d')](_0x21b262);}return _0x253cd0[_0x2407('0x1e')](_0x21b262)[_0x2407('0x1f')]();};}function respondWithResult(_0x28cac2,_0x33327d){_0x33327d=_0x33327d||0xc8;return function(_0x237235){if(_0x237235){return _0x28cac2[_0x2407('0x1e')](_0x33327d)[_0x2407('0x20')](_0x237235);}};}function respondWithFilteredResult(_0x567e8c,_0x2d2a24){return function(_0x8585a2){if(_0x8585a2){var _0x5da6c6=typeof _0x2d2a24[_0x2407('0x21')]===_0x2407('0x22')&&typeof _0x2d2a24[_0x2407('0x23')]===_0x2407('0x22');var _0x23e1d4=_0x8585a2[_0x2407('0x24')];var _0x2d4b7f=_0x5da6c6?0x0:_0x2d2a24['offset'];var _0xa31573=_0x5da6c6?_0x8585a2[_0x2407('0x24')]:_0x2d2a24[_0x2407('0x21')]+_0x2d2a24[_0x2407('0x23')];var _0x31dfc6;if(_0xa31573>=_0x23e1d4){_0xa31573=_0x23e1d4;_0x31dfc6=0xc8;}else{_0x31dfc6=0xce;}_0x567e8c[_0x2407('0x1e')](_0x31dfc6);return _0x567e8c[_0x2407('0x25')]('Content-Range',_0x2d4b7f+'-'+_0xa31573+'/'+_0x23e1d4)[_0x2407('0x20')](_0x8585a2);}return null;};}function patchUpdates(_0x28c504){return function(_0x30580c){try{jsonpatch[_0x2407('0x26')](_0x30580c,_0x28c504,!![]);}catch(_0x38c397){return BPromise['reject'](_0x38c397);}return _0x30580c[_0x2407('0x27')]();};}function saveUpdates(_0x32e655,_0x4eb058){return function(_0x10cdf2){if(_0x10cdf2){return _0x10cdf2[_0x2407('0x28')](_0x32e655)[_0x2407('0x29')](function(_0x3d4c55){return _0x3d4c55;});}return null;};}function removeEntity(_0x1fb2c6,_0x527e71){return function(_0x334d2c){if(_0x334d2c){return _0x334d2c[_0x2407('0x2a')]()[_0x2407('0x29')](function(){_0x1fb2c6[_0x2407('0x1e')](0xcc)[_0x2407('0x1f')]();});}};}function handleEntityNotFound(_0x3b735b,_0x24659c){return function(_0x1e7f83){if(!_0x1e7f83){_0x3b735b[_0x2407('0x1d')](0x194);}return _0x1e7f83;};}function handleError(_0x4e65c1,_0x2e47f1){_0x2e47f1=_0x2e47f1||0x1f4;return function(_0x58f9d2){logger[_0x2407('0x2b')](_0x58f9d2[_0x2407('0x2c')]);if(_0x58f9d2[_0x2407('0x2d')]){delete _0x58f9d2['name'];}_0x4e65c1[_0x2407('0x1e')](_0x2e47f1)[_0x2407('0x2e')](_0x58f9d2);};}exports[_0x2407('0x2f')]=function(_0x48f786,_0x581491){var _0x3a4fa7={},_0x73cac3={},_0x59ad4a={'count':0x0,'rows':[]};var _0x87d212=_[_0x2407('0x30')](db[_0x2407('0x31')][_0x2407('0x32')],function(_0x166fb7){return{'name':_0x166fb7[_0x2407('0x33')],'type':_0x166fb7[_0x2407('0x34')]['key']};});_0x73cac3[_0x2407('0x35')]=_['map'](_0x87d212,_0x2407('0x2d'));_0x73cac3[_0x2407('0x36')]=_[_0x2407('0x37')](_0x48f786[_0x2407('0x36')]);_0x73cac3[_0x2407('0x38')]=_[_0x2407('0x39')](_0x73cac3[_0x2407('0x35')],_0x73cac3[_0x2407('0x36')]);_0x3a4fa7[_0x2407('0x3a')]=_['intersection'](_0x73cac3[_0x2407('0x35')],qs[_0x2407('0x3b')](_0x48f786[_0x2407('0x36')][_0x2407('0x3b')]));_0x3a4fa7[_0x2407('0x3a')]=_0x3a4fa7[_0x2407('0x3a')][_0x2407('0x3c')]?_0x3a4fa7[_0x2407('0x3a')]:_0x73cac3[_0x2407('0x35')];if(!_0x48f786[_0x2407('0x36')]['hasOwnProperty'](_0x2407('0x3d'))){_0x3a4fa7[_0x2407('0x23')]=qs[_0x2407('0x23')](_0x48f786[_0x2407('0x36')][_0x2407('0x23')]);_0x3a4fa7[_0x2407('0x21')]=qs[_0x2407('0x21')](_0x48f786[_0x2407('0x36')][_0x2407('0x21')]);}_0x3a4fa7[_0x2407('0x3e')]=qs[_0x2407('0x3f')](_0x48f786[_0x2407('0x36')][_0x2407('0x3f')]);_0x3a4fa7['where']=qs[_0x2407('0x38')](_['pick'](_0x48f786[_0x2407('0x36')],_0x73cac3['filters']),_0x87d212);if(_0x48f786[_0x2407('0x36')][_0x2407('0x40')]){_0x3a4fa7[_0x2407('0x41')]=_[_0x2407('0x42')](_0x3a4fa7[_0x2407('0x41')],{'$or':_[_0x2407('0x30')](_0x87d212,function(_0x35f304){if(_0x35f304[_0x2407('0x34')]!=='VIRTUAL'){var _0x56f16a={};_0x56f16a[_0x35f304[_0x2407('0x2d')]]={'$like':'%'+_0x48f786[_0x2407('0x36')]['filter']+'%'};return _0x56f16a;}})});}_0x3a4fa7=_[_0x2407('0x42')]({},_0x3a4fa7,_0x48f786[_0x2407('0x43')]);var _0x2f48d5={'where':_0x3a4fa7[_0x2407('0x41')]};return db[_0x2407('0x31')]['count'](_0x2f48d5)[_0x2407('0x29')](function(_0x4f8e63){_0x59ad4a[_0x2407('0x24')]=_0x4f8e63;if(_0x48f786[_0x2407('0x36')][_0x2407('0x44')]){_0x3a4fa7[_0x2407('0x45')]=[{'all':!![]}];}return db[_0x2407('0x31')][_0x2407('0x46')](_0x3a4fa7);})[_0x2407('0x29')](function(_0x2ae4fc){_0x59ad4a[_0x2407('0x47')]=_0x2ae4fc;return _0x59ad4a;})['then'](respondWithFilteredResult(_0x581491,_0x3a4fa7))['catch'](handleError(_0x581491,null));};exports[_0x2407('0x48')]=function(_0x3aee8b,_0x285b9d){var _0x4c875c={'raw':!![],'where':{'id':_0x3aee8b['params']['id']}},_0x1eb6d7={};_0x1eb6d7[_0x2407('0x35')]=_[_0x2407('0x37')](db[_0x2407('0x31')]['rawAttributes']);_0x1eb6d7[_0x2407('0x36')]=_[_0x2407('0x37')](_0x3aee8b[_0x2407('0x36')]);_0x1eb6d7['filters']=_['intersection'](_0x1eb6d7['model'],_0x1eb6d7[_0x2407('0x36')]);_0x4c875c[_0x2407('0x3a')]=_[_0x2407('0x39')](_0x1eb6d7['model'],qs[_0x2407('0x3b')](_0x3aee8b['query'][_0x2407('0x3b')]));_0x4c875c[_0x2407('0x3a')]=_0x4c875c['attributes']['length']?_0x4c875c[_0x2407('0x3a')]:_0x1eb6d7[_0x2407('0x35')];if(_0x3aee8b['query'][_0x2407('0x44')]){_0x4c875c[_0x2407('0x45')]=[{'all':!![]}];}_0x4c875c=_[_0x2407('0x42')]({},_0x4c875c,_0x3aee8b['options']);return db[_0x2407('0x31')]['find'](_0x4c875c)[_0x2407('0x29')](handleEntityNotFound(_0x285b9d,null))['then'](respondWithResult(_0x285b9d,null))[_0x2407('0x49')](handleError(_0x285b9d,null));};exports[_0x2407('0x4a')]=function(_0x3cd580,_0x5523e3){return db[_0x2407('0x31')]['create'](_0x3cd580['body'],{})['then'](respondWithResult(_0x5523e3,0xc9))[_0x2407('0x49')](handleError(_0x5523e3,null));};exports[_0x2407('0x28')]=function(_0xb96dec,_0x4c1799){if(_0xb96dec[_0x2407('0x4b')]['id']){delete _0xb96dec[_0x2407('0x4b')]['id'];}return db[_0x2407('0x31')][_0x2407('0x4c')]({'where':{'id':_0xb96dec[_0x2407('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4c1799,null))[_0x2407('0x29')](saveUpdates(_0xb96dec[_0x2407('0x4b')],null))[_0x2407('0x29')](respondWithResult(_0x4c1799,null))[_0x2407('0x49')](handleError(_0x4c1799,null));};exports[_0x2407('0x2a')]=function(_0x3ca6ec,_0x5d8d06){return db[_0x2407('0x31')]['find']({'where':{'id':_0x3ca6ec[_0x2407('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d8d06,null))['then'](removeEntity(_0x5d8d06,null))[_0x2407('0x49')](handleError(_0x5d8d06,null));};exports[_0x2407('0x4e')]=function(_0x569c6a,_0x8f57df){return db[_0x2407('0x31')][_0x2407('0x4e')]()[_0x2407('0x29')](respondWithResult(_0x8f57df,null))[_0x2407('0x49')](handleError(_0x8f57df,null));};function wrapUser(_0x533d84){return function(_0x530174){var _0x101dca=_0x533d84[_0x2407('0x4f')]({'plain':!![]});_0x101dca['messages']=[];if(_0x530174){_0x101dca[_0x2407('0x50')]=_0x530174['createdAt'];_0x101dca['lastMessage']=_0x530174;}else{_0x101dca[_0x2407('0x50')]=moment(0x0)[_0x2407('0x51')](_0x2407('0x52'));_0x101dca['lastMessage']={};}return _0x101dca;};}exports[_0x2407('0x53')]=function(_0x282a4b,_0x258da4,_0x3bea86){var _0x161a64=[];return db[_0x2407('0x54')][_0x2407('0x46')]({'where':{'role':[_0x2407('0x55'),_0x2407('0x56'),_0x2407('0x57')]},'attributes':['id',_0x2407('0x58'),'name',_0x2407('0x59'),_0x2407('0x5a'),_0x2407('0x5b'),'online',_0x2407('0x5c'),_0x2407('0x5d'),_0x2407('0x5e')],'order':qs[_0x2407('0x3f')]('-online'),'include':[{'model':db[_0x2407('0x5f')],'as':'VoiceQueues','attributes':['id',_0x2407('0x2d'),_0x2407('0x34')],'through':{'attributes':[]}}]})[_0x2407('0x29')](function(_0x522e1a){if(_0x522e1a){var _0xd43455=_0x282a4b['user'][_0x2407('0x4f')]({'plain':!![]});if(!_0xd43455)throw new Error(_0x2407('0x60'));if(_0xd43455[_0x2407('0x59')]===_0x2407('0x57')){return db[_0x2407('0x61')]['find']({'where':{'name':'Agents','userProfileId':_0xd43455[_0x2407('0x62')]},'raw':!![]})[_0x2407('0x29')](function(_0x3ef98b){if(_0x3ef98b){if(_0x3ef98b['autoAssociation']===0x0){return db[_0x2407('0x63')][_0x2407('0x46')]({'where':{'sectionId':_0x3ef98b['id']},'raw':!![]})[_0x2407('0x29')](function(_0x1b449d){var _0x129d77=[];if(_[_0x2407('0x64')](_0x1b449d)){_0x129d77=_['filter'](_0x522e1a,function(_0x47d904){if(_0x47d904[_0x2407('0x59')]!==_0x2407('0x55')){return _0x47d904;}});return _0x129d77;}else{for(var _0x2ab720=0x0;_0x2ab720<_0x522e1a[_0x2407('0x3c')];_0x2ab720++){var _0x416df3=_0x522e1a[_0x2ab720];if(_0x416df3[_0x2407('0x59')]===_0x2407('0x55')){var _0x22a65c=_['find'](_0x1b449d,function(_0x599727){return _0x599727[_0x2407('0x65')]===_0x416df3['id'];});if(_0x22a65c)_0x129d77[_0x2407('0x66')](_0x416df3);}else{_0x129d77[_0x2407('0x66')](_0x416df3);}}return _0x129d77;}});}else{return _0x522e1a;}}else{var _0x50ae5f=_[_0x2407('0x40')](_0x522e1a,function(_0x235585){if(_0x235585[_0x2407('0x59')]!==_0x2407('0x55')){return _0x235585;}});return _0x50ae5f;}});}else{return _0x522e1a;}}})[_0x2407('0x29')](function(_0x27a06f){var _0x5e0275=[];if(_0x27a06f){_0x161a64=_0x27a06f;for(var _0x51d658=0x0;_0x51d658<_0x27a06f['length'];_0x51d658+=0x1){_0x161a64[_0x51d658]['messages']=[];_0x5e0275[_0x2407('0x66')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x282a4b[_0x2407('0x57')]['id'],_0x27a06f[_0x51d658]['id']],'ToId':[_0x282a4b[_0x2407('0x57')]['id'],_0x27a06f[_0x51d658]['id']],'ChatGroupId':null},'attributes':['id',_0x2407('0x67'),_0x2407('0x68'),_0x2407('0x69'),_0x2407('0x6a'),'body'],'order':qs[_0x2407('0x3f')](_0x2407('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x2407('0x29')](wrapUser(_0x27a06f[_0x51d658])));}return BPromise[_0x2407('0x6c')](_0x5e0275);}return[];})[_0x2407('0x29')](function(_0x3a3b6b){return{'rows':_0x3a3b6b,'count':_0x3a3b6b[_0x2407('0x3c')]};})[_0x2407('0x29')](respondWithResult(_0x258da4,null))[_0x2407('0x49')](handleError(_0x258da4,null));}; \ No newline at end of file +var _0xad5a=['lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','messages','createdAt','lastMessageAt','format'];(function(_0x8d7430,_0x503f1c){var _0x51797b=function(_0x319a74){while(--_0x319a74){_0x8d7430['push'](_0x8d7430['shift']());}};_0x51797b(++_0x503f1c);}(_0xad5a,0x91));var _0xaad5=function(_0x176a00,_0x421b0e){_0x176a00=_0x176a00-0x0;var _0x1f2c82=_0xad5a[_0x176a00];return _0x1f2c82;};'use strict';var emlformat=require(_0xaad5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaad5('0x1'));var jsonpatch=require(_0xaad5('0x2'));var rp=require(_0xaad5('0x3'));var moment=require(_0xaad5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaad5('0x5'));var util=require(_0xaad5('0x6'));var path=require(_0xaad5('0x7'));var sox=require(_0xaad5('0x8'));var csv=require(_0xaad5('0x9'));var ejs=require(_0xaad5('0xa'));var fs=require('fs');var fs_extra=require(_0xaad5('0xb'));var _=require('lodash');var squel=require(_0xaad5('0xc'));var crypto=require(_0xaad5('0xd'));var jsforce=require(_0xaad5('0xe'));var deskjs=require(_0xaad5('0xf'));var toCsv=require(_0xaad5('0x9'));var querystring=require(_0xaad5('0x10'));var Papa=require(_0xaad5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaad5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaad5('0x13'));var logger=require('../../config/logger')(_0xaad5('0x14'));var utils=require(_0xaad5('0x15'));var config=require(_0xaad5('0x16'));var licenseUtil=require(_0xaad5('0x17'));var db=require(_0xaad5('0x18'))['db'];config[_0xaad5('0x19')]=_[_0xaad5('0x1a')](config[_0xaad5('0x19')],{'host':_0xaad5('0x1b'),'port':0x18eb});var socket=require(_0xaad5('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xaad5('0x1d')](socket);function respondWithStatusCode(_0x1c7501,_0x175fe9){_0x175fe9=_0x175fe9||0xcc;return function(_0x58a375){if(_0x58a375){return _0x1c7501['sendStatus'](_0x175fe9);}return _0x1c7501[_0xaad5('0x1e')](_0x175fe9)[_0xaad5('0x1f')]();};}function respondWithResult(_0x5bab1d,_0x3ac99a){_0x3ac99a=_0x3ac99a||0xc8;return function(_0x1934dd){if(_0x1934dd){return _0x5bab1d[_0xaad5('0x1e')](_0x3ac99a)[_0xaad5('0x20')](_0x1934dd);}};}function respondWithFilteredResult(_0x2187c5,_0x45a110){return function(_0x3c64d8){if(_0x3c64d8){var _0x728823=typeof _0x45a110[_0xaad5('0x21')]===_0xaad5('0x22')&&typeof _0x45a110['limit']===_0xaad5('0x22');var _0x31a0aa=_0x3c64d8['count'];var _0x25b6cd=_0x728823?0x0:_0x45a110[_0xaad5('0x21')];var _0x38dd98=_0x728823?_0x3c64d8[_0xaad5('0x23')]:_0x45a110['offset']+_0x45a110[_0xaad5('0x24')];var _0x299ec0;if(_0x38dd98>=_0x31a0aa){_0x38dd98=_0x31a0aa;_0x299ec0=0xc8;}else{_0x299ec0=0xce;}_0x2187c5[_0xaad5('0x1e')](_0x299ec0);return _0x2187c5[_0xaad5('0x25')](_0xaad5('0x26'),_0x25b6cd+'-'+_0x38dd98+'/'+_0x31a0aa)['json'](_0x3c64d8);}return null;};}function patchUpdates(_0x11e3e6){return function(_0x1af9ab){try{jsonpatch['apply'](_0x1af9ab,_0x11e3e6,!![]);}catch(_0x49458c){return BPromise[_0xaad5('0x27')](_0x49458c);}return _0x1af9ab[_0xaad5('0x28')]();};}function saveUpdates(_0x2ce312,_0x30cc5c){return function(_0x117484){if(_0x117484){return _0x117484[_0xaad5('0x29')](_0x2ce312)['then'](function(_0x161d77){return _0x161d77;});}return null;};}function removeEntity(_0x4546cc,_0x4fda48){return function(_0x2126eb){if(_0x2126eb){return _0x2126eb[_0xaad5('0x2a')]()[_0xaad5('0x2b')](function(){_0x4546cc[_0xaad5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b4a6f,_0x160376){return function(_0x1d7c93){if(!_0x1d7c93){_0x1b4a6f[_0xaad5('0x2c')](0x194);}return _0x1d7c93;};}function handleError(_0x1d0e30,_0x3e3237){_0x3e3237=_0x3e3237||0x1f4;return function(_0x1712df){logger[_0xaad5('0x2d')](_0x1712df[_0xaad5('0x2e')]);if(_0x1712df['name']){delete _0x1712df[_0xaad5('0x2f')];}_0x1d0e30[_0xaad5('0x1e')](_0x3e3237)[_0xaad5('0x30')](_0x1712df);};}exports[_0xaad5('0x31')]=function(_0x386f7f,_0x400d34){var _0x1c0dad={},_0x15efa2={},_0x495f56={'count':0x0,'rows':[]};var _0x2bc080=_['map'](db[_0xaad5('0x32')][_0xaad5('0x33')],function(_0x56f390){return{'name':_0x56f390[_0xaad5('0x34')],'type':_0x56f390[_0xaad5('0x35')]['key']};});_0x15efa2[_0xaad5('0x36')]=_[_0xaad5('0x37')](_0x2bc080,_0xaad5('0x2f'));_0x15efa2[_0xaad5('0x38')]=_[_0xaad5('0x39')](_0x386f7f[_0xaad5('0x38')]);_0x15efa2[_0xaad5('0x3a')]=_[_0xaad5('0x3b')](_0x15efa2[_0xaad5('0x36')],_0x15efa2[_0xaad5('0x38')]);_0x1c0dad[_0xaad5('0x3c')]=_[_0xaad5('0x3b')](_0x15efa2['model'],qs[_0xaad5('0x3d')](_0x386f7f[_0xaad5('0x38')]['fields']));_0x1c0dad[_0xaad5('0x3c')]=_0x1c0dad['attributes'][_0xaad5('0x3e')]?_0x1c0dad[_0xaad5('0x3c')]:_0x15efa2[_0xaad5('0x36')];if(!_0x386f7f['query'][_0xaad5('0x3f')](_0xaad5('0x40'))){_0x1c0dad[_0xaad5('0x24')]=qs[_0xaad5('0x24')](_0x386f7f[_0xaad5('0x38')][_0xaad5('0x24')]);_0x1c0dad['offset']=qs[_0xaad5('0x21')](_0x386f7f[_0xaad5('0x38')][_0xaad5('0x21')]);}_0x1c0dad['order']=qs[_0xaad5('0x41')](_0x386f7f[_0xaad5('0x38')][_0xaad5('0x41')]);_0x1c0dad['where']=qs[_0xaad5('0x3a')](_['pick'](_0x386f7f[_0xaad5('0x38')],_0x15efa2['filters']),_0x2bc080);if(_0x386f7f[_0xaad5('0x38')][_0xaad5('0x42')]){_0x1c0dad[_0xaad5('0x43')]=_[_0xaad5('0x44')](_0x1c0dad[_0xaad5('0x43')],{'$or':_[_0xaad5('0x37')](_0x2bc080,function(_0x5b083a){if(_0x5b083a[_0xaad5('0x35')]!==_0xaad5('0x45')){var _0x4eb191={};_0x4eb191[_0x5b083a[_0xaad5('0x2f')]]={'$like':'%'+_0x386f7f[_0xaad5('0x38')][_0xaad5('0x42')]+'%'};return _0x4eb191;}})});}_0x1c0dad=_[_0xaad5('0x44')]({},_0x1c0dad,_0x386f7f[_0xaad5('0x46')]);var _0x2293f8={'where':_0x1c0dad['where']};return db[_0xaad5('0x32')][_0xaad5('0x23')](_0x2293f8)[_0xaad5('0x2b')](function(_0x2fd72c){_0x495f56['count']=_0x2fd72c;if(_0x386f7f[_0xaad5('0x38')]['includeAll']){_0x1c0dad[_0xaad5('0x47')]=[{'all':!![]}];}return db[_0xaad5('0x32')][_0xaad5('0x48')](_0x1c0dad);})['then'](function(_0x55f82a){_0x495f56['rows']=_0x55f82a;return _0x495f56;})['then'](respondWithFilteredResult(_0x400d34,_0x1c0dad))[_0xaad5('0x49')](handleError(_0x400d34,null));};exports[_0xaad5('0x4a')]=function(_0xfeb2ca,_0x153745){var _0x2cd9bb={'raw':!![],'where':{'id':_0xfeb2ca[_0xaad5('0x4b')]['id']}},_0xfc29c7={};_0xfc29c7[_0xaad5('0x36')]=_[_0xaad5('0x39')](db[_0xaad5('0x32')][_0xaad5('0x33')]);_0xfc29c7[_0xaad5('0x38')]=_[_0xaad5('0x39')](_0xfeb2ca['query']);_0xfc29c7[_0xaad5('0x3a')]=_[_0xaad5('0x3b')](_0xfc29c7['model'],_0xfc29c7['query']);_0x2cd9bb['attributes']=_['intersection'](_0xfc29c7[_0xaad5('0x36')],qs['fields'](_0xfeb2ca[_0xaad5('0x38')][_0xaad5('0x3d')]));_0x2cd9bb[_0xaad5('0x3c')]=_0x2cd9bb[_0xaad5('0x3c')]['length']?_0x2cd9bb[_0xaad5('0x3c')]:_0xfc29c7['model'];if(_0xfeb2ca[_0xaad5('0x38')][_0xaad5('0x4c')]){_0x2cd9bb[_0xaad5('0x47')]=[{'all':!![]}];}_0x2cd9bb=_[_0xaad5('0x44')]({},_0x2cd9bb,_0xfeb2ca[_0xaad5('0x46')]);return db['ChatInternalMessage'][_0xaad5('0x4d')](_0x2cd9bb)[_0xaad5('0x2b')](handleEntityNotFound(_0x153745,null))['then'](respondWithResult(_0x153745,null))[_0xaad5('0x49')](handleError(_0x153745,null));};exports['create']=function(_0x45011b,_0x40262d){return db[_0xaad5('0x32')][_0xaad5('0x4e')](_0x45011b[_0xaad5('0x4f')],{})[_0xaad5('0x2b')](respondWithResult(_0x40262d,0xc9))[_0xaad5('0x49')](handleError(_0x40262d,null));};exports['update']=function(_0x193da6,_0x2cd0bc){if(_0x193da6[_0xaad5('0x4f')]['id']){delete _0x193da6[_0xaad5('0x4f')]['id'];}return db['ChatInternalMessage'][_0xaad5('0x4d')]({'where':{'id':_0x193da6[_0xaad5('0x4b')]['id']}})[_0xaad5('0x2b')](handleEntityNotFound(_0x2cd0bc,null))['then'](saveUpdates(_0x193da6[_0xaad5('0x4f')],null))[_0xaad5('0x2b')](respondWithResult(_0x2cd0bc,null))[_0xaad5('0x49')](handleError(_0x2cd0bc,null));};exports[_0xaad5('0x2a')]=function(_0x44fb29,_0x470910){return db[_0xaad5('0x32')][_0xaad5('0x4d')]({'where':{'id':_0x44fb29['params']['id']}})['then'](handleEntityNotFound(_0x470910,null))[_0xaad5('0x2b')](removeEntity(_0x470910,null))[_0xaad5('0x49')](handleError(_0x470910,null));};exports[_0xaad5('0x50')]=function(_0x579a01,_0x3bcedc){return db[_0xaad5('0x32')][_0xaad5('0x50')]()[_0xaad5('0x2b')](respondWithResult(_0x3bcedc,null))[_0xaad5('0x49')](handleError(_0x3bcedc,null));};function wrapUser(_0x298674){return function(_0x4067da){var _0x19117b=_0x298674['get']({'plain':!![]});_0x19117b[_0xaad5('0x51')]=[];if(_0x4067da){_0x19117b['lastMessageAt']=_0x4067da[_0xaad5('0x52')];_0x19117b['lastMessage']=_0x4067da;}else{_0x19117b[_0xaad5('0x53')]=moment(0x0)[_0xaad5('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x19117b[_0xaad5('0x55')]={};}return _0x19117b;};}exports[_0xaad5('0x56')]=function(_0x2d18e7,_0x18a175,_0x4452a0){var _0x12a4b7=[];return db[_0xaad5('0x57')][_0xaad5('0x48')]({'where':{'role':[_0xaad5('0x58'),_0xaad5('0x59'),_0xaad5('0x5a')]},'attributes':['id',_0xaad5('0x5b'),_0xaad5('0x2f'),_0xaad5('0x5c'),_0xaad5('0x5d'),_0xaad5('0x5e'),_0xaad5('0x5f'),_0xaad5('0x60'),'allowmessenger',_0xaad5('0x61')],'order':qs[_0xaad5('0x41')](_0xaad5('0x62')),'include':[{'model':db[_0xaad5('0x63')],'as':_0xaad5('0x64'),'attributes':['id',_0xaad5('0x2f'),_0xaad5('0x35')],'through':{'attributes':[]}}]})[_0xaad5('0x2b')](function(_0x43f6ee){if(_0x43f6ee){var _0x2737c3=_0x2d18e7[_0xaad5('0x5a')][_0xaad5('0x65')]({'plain':!![]});if(!_0x2737c3)throw new Error(_0xaad5('0x66'));if(_0x2737c3['role']===_0xaad5('0x5a')){return db[_0xaad5('0x67')][_0xaad5('0x4d')]({'where':{'name':_0xaad5('0x68'),'userProfileId':_0x2737c3[_0xaad5('0x69')]},'raw':!![]})[_0xaad5('0x2b')](function(_0x581234){if(_0x581234){if(_0x581234[_0xaad5('0x6a')]===0x0){return db[_0xaad5('0x6b')][_0xaad5('0x48')]({'where':{'sectionId':_0x581234['id']},'raw':!![]})[_0xaad5('0x2b')](function(_0x9bdff5){var _0x4cd693=[];if(_[_0xaad5('0x6c')](_0x9bdff5)){_0x4cd693=_[_0xaad5('0x42')](_0x43f6ee,function(_0x10c980){if(_0x10c980[_0xaad5('0x5c')]!==_0xaad5('0x58')){return _0x10c980;}});return _0x4cd693;}else{for(var _0x488dea=0x0;_0x488dea<_0x43f6ee[_0xaad5('0x3e')];_0x488dea++){var _0x1d4349=_0x43f6ee[_0x488dea];if(_0x1d4349[_0xaad5('0x5c')]===_0xaad5('0x58')){var _0x17a84c=_['find'](_0x9bdff5,function(_0x383de9){return _0x383de9[_0xaad5('0x6d')]===_0x1d4349['id'];});if(_0x17a84c)_0x4cd693[_0xaad5('0x6e')](_0x1d4349);}else{_0x4cd693[_0xaad5('0x6e')](_0x1d4349);}}return _0x4cd693;}});}else{return _0x43f6ee;}}else{var _0x5bf25c=_[_0xaad5('0x42')](_0x43f6ee,function(_0x5adc99){if(_0x5adc99[_0xaad5('0x5c')]!=='agent'){return _0x5adc99;}});return _0x5bf25c;}});}else{return _0x43f6ee;}}})[_0xaad5('0x2b')](function(_0x1d0c39){var _0xb998e8=[];if(_0x1d0c39){_0x12a4b7=_0x1d0c39;for(var _0x12a21a=0x0;_0x12a21a<_0x1d0c39['length'];_0x12a21a+=0x1){_0x12a4b7[_0x12a21a][_0xaad5('0x51')]=[];_0xb998e8[_0xaad5('0x6e')](db[_0xaad5('0x32')]['find']({'where':{'FromId':[_0x2d18e7[_0xaad5('0x5a')]['id'],_0x1d0c39[_0x12a21a]['id']],'ToId':[_0x2d18e7['user']['id'],_0x1d0c39[_0x12a21a]['id']],'ChatGroupId':null},'attributes':['id',_0xaad5('0x52'),_0xaad5('0x6f'),_0xaad5('0x70'),'read',_0xaad5('0x4f')],'order':qs['sort'](_0xaad5('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xaad5('0x2b')](wrapUser(_0x1d0c39[_0x12a21a])));}return BPromise[_0xaad5('0x72')](_0xb998e8);}return[];})['then'](function(_0x212e5e){return{'rows':_0x212e5e,'count':_0x212e5e[_0xaad5('0x3e')]};})[_0xaad5('0x2b')](respondWithResult(_0x18a175,null))[_0xaad5('0x49')](handleError(_0x18a175,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f698412..1daeff9 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 _0xc12a=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x572df7,_0x247fe0){var _0x1899b7=function(_0x520b42){while(--_0x520b42){_0x572df7['push'](_0x572df7['shift']());}};_0x1899b7(++_0x247fe0);}(_0xc12a,0x1c1));var _0xac12=function(_0x1d0ae8,_0x9b4aaf){_0x1d0ae8=_0x1d0ae8-0x0;var _0xc20ec9=_0xc12a[_0x1d0ae8];return _0xc20ec9;};'use strict';var EventEmitter=require(_0xac12('0x0'));var ChatInternalMessage=require(_0xac12('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xac12('0x2')](0x0);var events={'afterCreate':_0xac12('0x3'),'afterUpdate':_0xac12('0x4'),'afterDestroy':_0xac12('0x5')};function emitEvent(_0x359a6a){return function(_0x2b685c,_0x3a3220,_0x5de9e7){ChatInternalMessageEvents[_0xac12('0x6')](_0x359a6a+':'+_0x2b685c['id'],_0x2b685c);ChatInternalMessageEvents[_0xac12('0x6')](_0x359a6a,_0x2b685c);_0x5de9e7(null);};}for(var e in events){if(events[_0xac12('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xf133=['update','remove','emit','hasOwnProperty','hook','exports','ChatInternalMessage','setMaxListeners'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0xf133,0x166));var _0x3f13=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf133[_0x2070da];return _0x4f9fe1;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x3f13('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x3f13('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3f13('0x2'),'afterDestroy':_0x3f13('0x3')};function emitEvent(_0x3fb529){return function(_0x525734,_0x32b39b,_0x38e420){ChatInternalMessageEvents[_0x3f13('0x4')](_0x3fb529+':'+_0x525734['id'],_0x525734);ChatInternalMessageEvents['emit'](_0x3fb529,_0x525734);_0x38e420(null);};}for(var e in events){if(events[_0x3f13('0x5')](e)){var event=events[e];ChatInternalMessage[_0x3f13('0x6')](e,emitEvent(event));}}module[_0x3f13('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index df37134..208a247 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 _0xfbdb=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xfbdb,0xf7));var _0xbfbd=function(_0xee10fb,_0x5b7225){_0xee10fb=_0xee10fb-0x0;var _0x16d55d=_0xfbdb[_0xee10fb];return _0x16d55d;};'use strict';var _=require('lodash');var util=require(_0xbfbd('0x0'));var logger=require(_0xbfbd('0x1'))(_0xbfbd('0x2'));var moment=require(_0xbfbd('0x3'));var BPromise=require(_0xbfbd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbfbd('0x5'));var rimraf=require(_0xbfbd('0x6'));var config=require(_0xbfbd('0x7'));var attributes=require(_0xbfbd('0x8'));module[_0xbfbd('0x9')]=function(_0x507466,_0x2fd245){return _0x507466['define']('ChatInternalMessage',attributes,{'tableName':_0xbfbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbfbd('0xb'),'collate':_0xbfbd('0xc')});}; \ No newline at end of file +var _0x5db0=['exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x31c3db,_0x10b243){var _0x57c39c=function(_0x456dda){while(--_0x456dda){_0x31c3db['push'](_0x31c3db['shift']());}};_0x57c39c(++_0x10b243);}(_0x5db0,0x158));var _0x05db=function(_0x198ac3,_0x51a6ba){_0x198ac3=_0x198ac3-0x0;var _0x3b0276=_0x5db0[_0x198ac3];return _0x3b0276;};'use strict';var _=require(_0x05db('0x0'));var util=require(_0x05db('0x1'));var logger=require(_0x05db('0x2'))(_0x05db('0x3'));var moment=require(_0x05db('0x4'));var BPromise=require('bluebird');var rp=require(_0x05db('0x5'));var fs=require('fs');var path=require(_0x05db('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x05db('0x7')]=function(_0x4e69c0,_0x4e01f0){return _0x4e69c0[_0x05db('0x8')](_0x05db('0x9'),attributes,{'tableName':_0x05db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x05db('0xb'),'collate':_0x05db('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index de7afa0..9bea06a 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 _0xc66a=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x53dd5e,_0x4bfedf){var _0x281dc5=function(_0xb7a995){while(--_0xb7a995){_0x53dd5e['push'](_0x53dd5e['shift']());}};_0x281dc5(++_0x4bfedf);}(_0xc66a,0x197));var _0xac66=function(_0x217d6d,_0x50f671){_0x217d6d=_0x217d6d-0x0;var _0x1f125a=_0xc66a[_0x217d6d];return _0x1f125a;};'use strict';var _=require(_0xac66('0x0'));var util=require(_0xac66('0x1'));var moment=require(_0xac66('0x2'));var BPromise=require(_0xac66('0x3'));var rs=require(_0xac66('0x4'));var fs=require('fs');var Redis=require(_0xac66('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xac66('0x6'))(_0xac66('0x7'));var config=require(_0xac66('0x8'));var jayson=require(_0xac66('0x9'));var client=jayson[_0xac66('0xa')][_0xac66('0xb')]({'port':0x232a});config[_0xac66('0xc')]=_[_0xac66('0xd')](config['redis'],{'host':_0xac66('0xe'),'port':0x18eb});var socket=require(_0xac66('0xf'))(new Redis(config['redis']));require(_0xac66('0x10'))[_0xac66('0x11')](socket);function respondWithRpcPromise(_0x299e2d,_0x408349,_0x2c7cbe){return new BPromise(function(_0x9486d,_0x552803){return client[_0xac66('0x12')](_0x299e2d,_0x2c7cbe)[_0xac66('0x13')](function(_0x3eaecd){logger[_0xac66('0x14')](_0xac66('0x15'),_0x408349,_0xac66('0x16'));logger['debug'](_0xac66('0x17'),_0x408349,'request\x20sent',JSON[_0xac66('0x18')](_0x3eaecd));if(_0x3eaecd['error']){if(_0x3eaecd['error'][_0xac66('0x19')]===0x1f4){logger[_0xac66('0x1a')](_0xac66('0x15'),_0x408349,_0x3eaecd[_0xac66('0x1a')][_0xac66('0x1b')]);return _0x552803(_0x3eaecd['error'][_0xac66('0x1b')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x408349,_0x3eaecd[_0xac66('0x1a')][_0xac66('0x1b')]);return _0x9486d(_0x3eaecd[_0xac66('0x1a')][_0xac66('0x1b')]);}else{logger[_0xac66('0x14')](_0xac66('0x15'),_0x408349,'request\x20sent');_0x9486d(_0x3eaecd[_0xac66('0x1c')][_0xac66('0x1b')]);}})[_0xac66('0x1d')](function(_0x5bd23d){logger[_0xac66('0x1a')]('ChatInternalMessage,\x20%s,\x20%s',_0x408349,_0x5bd23d);_0x552803(_0x5bd23d);});});} \ No newline at end of file +var _0xc6e5=['../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b97fa,_0x4399a6){var _0x44267a=function(_0x60f28){while(--_0x60f28){_0x3b97fa['push'](_0x3b97fa['shift']());}};_0x44267a(++_0x4399a6);}(_0xc6e5,0x192));var _0x5c6e=function(_0x44ff66,_0x247610){_0x44ff66=_0x44ff66-0x0;var _0x3f64a4=_0xc6e5[_0x44ff66];return _0x3f64a4;};'use strict';var _=require(_0x5c6e('0x0'));var util=require(_0x5c6e('0x1'));var moment=require('moment');var BPromise=require(_0x5c6e('0x2'));var rs=require(_0x5c6e('0x3'));var fs=require('fs');var Redis=require(_0x5c6e('0x4'));var db=require(_0x5c6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c6e('0x6'))('rpc');var config=require(_0x5c6e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5c6e('0x8')][_0x5c6e('0x9')]({'port':0x232a});config[_0x5c6e('0xa')]=_[_0x5c6e('0xb')](config[_0x5c6e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5c6e('0xc'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x5c6e('0xd')](socket);function respondWithRpcPromise(_0x274a2b,_0x3490b3,_0x4d7f2d){return new BPromise(function(_0x2415a7,_0x55f61d){return client[_0x5c6e('0xe')](_0x274a2b,_0x4d7f2d)[_0x5c6e('0xf')](function(_0x38b967){logger[_0x5c6e('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x3490b3,'request\x20sent');logger[_0x5c6e('0x11')](_0x5c6e('0x12'),_0x3490b3,'request\x20sent',JSON['stringify'](_0x38b967));if(_0x38b967[_0x5c6e('0x13')]){if(_0x38b967[_0x5c6e('0x13')]['code']===0x1f4){logger['error'](_0x5c6e('0x14'),_0x3490b3,_0x38b967[_0x5c6e('0x13')][_0x5c6e('0x15')]);return _0x55f61d(_0x38b967[_0x5c6e('0x13')][_0x5c6e('0x15')]);}logger[_0x5c6e('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x3490b3,_0x38b967[_0x5c6e('0x13')]['message']);return _0x2415a7(_0x38b967[_0x5c6e('0x13')][_0x5c6e('0x15')]);}else{logger[_0x5c6e('0x10')](_0x5c6e('0x14'),_0x3490b3,'request\x20sent');_0x2415a7(_0x38b967[_0x5c6e('0x16')][_0x5c6e('0x15')]);}})[_0x5c6e('0x17')](function(_0x238a98){logger[_0x5c6e('0x13')](_0x5c6e('0x14'),_0x3490b3,_0x238a98);_0x55f61d(_0x238a98);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 188bac5..7552ed8 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 _0x3189=['emit','register','chatInternalMessage:','save','update'];(function(_0x56c71f,_0xd8ff3b){var _0x2c4c06=function(_0x317d86){while(--_0x317d86){_0x56c71f['push'](_0x56c71f['shift']());}};_0x2c4c06(++_0xd8ff3b);}(_0x3189,0xee));var _0x9318=function(_0x11e571,_0x140120){_0x11e571=_0x11e571-0x0;var _0x306e5b=_0x3189[_0x11e571];return _0x306e5b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x9318('0x0'),'remove',_0x9318('0x1')];function createListener(_0x31e66b,_0x3a0e04){return function(_0x3e52d0){_0x3a0e04[_0x9318('0x2')](_0x31e66b,_0x3e52d0);};}function removeListener(_0x3d47c4,_0x33c3f4){return function(){ChatInternalMessageEvents['removeListener'](_0x3d47c4,_0x33c3f4);};}exports[_0x9318('0x3')]=function(_0x3457b9){for(var _0x448661=0x0,_0x358385=events['length'];_0x448661<_0x358385;_0x448661++){var _0x4b6278=events[_0x448661];var _0x1bc4d6=createListener(_0x9318('0x4')+_0x4b6278,_0x3457b9);ChatInternalMessageEvents['on'](_0x4b6278,_0x1bc4d6);}}; \ No newline at end of file +var _0x7af2=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','emit','removeListener'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0x7af2,0x1bb));var _0x27af=function(_0x592edb,_0x2e4d3f){_0x592edb=_0x592edb-0x0;var _0x108fc8=_0x7af2[_0x592edb];return _0x108fc8;};'use strict';var ChatInternalMessageEvents=require(_0x27af('0x0'));var events=[_0x27af('0x1'),_0x27af('0x2'),'update'];function createListener(_0xab5b1a,_0x2535d8){return function(_0xa8ea9b){_0x2535d8[_0x27af('0x3')](_0xab5b1a,_0xa8ea9b);};}function removeListener(_0x49461e,_0x7b3edc){return function(){ChatInternalMessageEvents[_0x27af('0x4')](_0x49461e,_0x7b3edc);};}exports[_0x27af('0x5')]=function(_0x3e40ef){for(var _0x2edbaa=0x0,_0x3ed398=events[_0x27af('0x6')];_0x2edbaa<_0x3ed398;_0x2edbaa++){var _0x368035=events[_0x2edbaa];var _0x314047=createListener(_0x27af('0x7')+_0x368035,_0x3e40ef);ChatInternalMessageEvents['on'](_0x368035,_0x314047);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index db87c09..2c7ed9a 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 _0xd096=['get','isAuthenticated','index','describe','/users','getUsers','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x4c1a08,_0x54d536){var _0x48a83f=function(_0x5588c7){while(--_0x5588c7){_0x4c1a08['push'](_0x4c1a08['shift']());}};_0x48a83f(++_0x54d536);}(_0xd096,0x1be));var _0x6d09=function(_0x2184bc,_0x51ac7d){_0x2184bc=_0x2184bc-0x0;var _0x37c7b0=_0xd096[_0x2184bc];return _0x37c7b0;};'use strict';var multer=require(_0x6d09('0x0'));var util=require(_0x6d09('0x1'));var path=require(_0x6d09('0x2'));var timeout=require(_0x6d09('0x3'));var express=require('express');var router=express[_0x6d09('0x4')]();var fs_extra=require(_0x6d09('0x5'));var auth=require(_0x6d09('0x6'));var interaction=require(_0x6d09('0x7'));var config=require(_0x6d09('0x8'));var controller=require(_0x6d09('0x9'));router[_0x6d09('0xa')]('/',auth[_0x6d09('0xb')](),controller[_0x6d09('0xc')]);router[_0x6d09('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x6d09('0xd')]);router['get'](_0x6d09('0xe'),auth[_0x6d09('0xb')](),controller[_0x6d09('0xf')]);router['get']('/:id',auth[_0x6d09('0xb')](),controller[_0x6d09('0x10')]);router[_0x6d09('0x11')]('/',auth[_0x6d09('0xb')](),controller[_0x6d09('0x12')]);router['put'](_0x6d09('0x13'),controller[_0x6d09('0x14')]);router[_0x6d09('0x15')](_0x6d09('0x13'),auth['isAuthenticated'](),controller[_0x6d09('0x16')]);module[_0x6d09('0x17')]=router; \ No newline at end of file +var _0x66d2=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','/:id','show','create','put','update','delete'];(function(_0x41ea43,_0x449611){var _0x273c57=function(_0x218037){while(--_0x218037){_0x41ea43['push'](_0x41ea43['shift']());}};_0x273c57(++_0x449611);}(_0x66d2,0x17b));var _0x266d=function(_0x5276ff,_0x4e416f){_0x5276ff=_0x5276ff-0x0;var _0x197192=_0x66d2[_0x5276ff];return _0x197192;};'use strict';var multer=require(_0x266d('0x0'));var util=require(_0x266d('0x1'));var path=require(_0x266d('0x2'));var timeout=require(_0x266d('0x3'));var express=require(_0x266d('0x4'));var router=express['Router']();var fs_extra=require(_0x266d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x266d('0x6'));var config=require(_0x266d('0x7'));var controller=require(_0x266d('0x8'));router[_0x266d('0x9')]('/',auth[_0x266d('0xa')](),controller[_0x266d('0xb')]);router[_0x266d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x266d('0xc')]);router[_0x266d('0x9')]('/users',auth[_0x266d('0xa')](),controller[_0x266d('0xd')]);router[_0x266d('0x9')](_0x266d('0xe'),auth[_0x266d('0xa')](),controller[_0x266d('0xf')]);router['post']('/',auth[_0x266d('0xa')](),controller[_0x266d('0x10')]);router[_0x266d('0x11')](_0x266d('0xe'),controller[_0x266d('0x12')]);router[_0x266d('0x13')](_0x266d('0xe'),auth[_0x266d('0xa')](),controller['destroy']);module[_0x266d('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5777dda..e34d5c4 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 _0x79e2=['out','DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x39340a,_0x533d5a){var _0x27fa75=function(_0x176dd0){while(--_0x176dd0){_0x39340a['push'](_0x39340a['shift']());}};_0x27fa75(++_0x533d5a);}(_0x79e2,0x1c3));var _0x279e=function(_0x39d496,_0x339bad){_0x39d496=_0x39d496-0x0;var _0x20da89=_0x79e2[_0x39d496];return _0x20da89;};'use strict';var Sequelize=require(_0x279e('0x0'));module['exports']={'body':{'type':Sequelize[_0x279e('0x1')](_0x279e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x279e('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x279e('0x4')]('in','out'),'defaultValue':_0x279e('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x279e('0x6')]},'providerName':{'type':Sequelize[_0x279e('0x7')]},'providerResponse':{'type':Sequelize[_0x279e('0x1')]}}; \ No newline at end of file +var _0xceb0=['ENUM','out','TEXT','BOOLEAN'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xceb0,0x173));var _0x0ceb=function(_0x3cb8b6,_0x5cad07){_0x3cb8b6=_0x3cb8b6-0x0;var _0xbc94f4=_0xceb0[_0x3cb8b6];return _0xbc94f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0ceb('0x0')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ceb('0x1')]('in',_0x0ceb('0x2')),'defaultValue':_0x0ceb('0x2'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0ceb('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b0083da..e970d91 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 _0xa13a=['Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','chat-interactions','reject','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','rejectmessage','parse','formData','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','ejs','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','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','count','limit','apply','save','update','end','stack','index','map','rawAttributes','fieldName','type','key','name','keys','filters','intersection','model','query','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','findAll','show','include','create','body','find','params','describe','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize'];(function(_0x5d7fa,_0x26c3e2){var _0x417403=function(_0x4dea55){while(--_0x4dea55){_0x5d7fa['push'](_0x5d7fa['shift']());}};_0x417403(++_0x26c3e2);}(_0xa13a,0x19d));var _0xaa13=function(_0x54ea8a,_0x49798c){_0x54ea8a=_0x54ea8a-0x0;var _0x564912=_0xa13a[_0x54ea8a];return _0x564912;};'use strict';var emlformat=require(_0xaa13('0x0'));var rimraf=require(_0xaa13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa13('0x2'));var rp=require('request-promise');var moment=require(_0xaa13('0x3'));var BPromise=require(_0xaa13('0x4'));var Mustache=require('mustache');var util=require(_0xaa13('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xaa13('0x6'));var ejs=require(_0xaa13('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa13('0x8'));var squel=require(_0xaa13('0x9'));var crypto=require(_0xaa13('0xa'));var jsforce=require(_0xaa13('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa13('0x6'));var querystring=require(_0xaa13('0xc'));var Papa=require('papaparse');var Redis=require(_0xaa13('0xd'));var authService=require(_0xaa13('0xe'));var qs=require(_0xaa13('0xf'));var as=require(_0xaa13('0x10'));var hardwareService=require(_0xaa13('0x11'));var logger=require(_0xaa13('0x12'))(_0xaa13('0x13'));var utils=require(_0xaa13('0x14'));var config=require(_0xaa13('0x15'));var licenseUtil=require(_0xaa13('0x16'));var db=require(_0xaa13('0x17'))['db'];config[_0xaa13('0x18')]=_['defaults'](config[_0xaa13('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa13('0x19'))(new Redis(config[_0xaa13('0x18')]));require(_0xaa13('0x1a'))[_0xaa13('0x1b')](socket);var jayson=require(_0xaa13('0x1c'));var client=jayson[_0xaa13('0x1d')][_0xaa13('0x1e')]({'port':0x232c});var client9002=jayson[_0xaa13('0x1d')][_0xaa13('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x50e392,_0x2af700,_0x187587,_0x5e6b78){return new BPromise(function(_0x40f626,_0x37f306){var _0x4bbcd4=_0x5e6b78||client;return _0x4bbcd4['request'](_0x50e392,_0x187587)[_0xaa13('0x1f')](function(_0x53b79a){logger[_0xaa13('0x20')]('ChatMessage,\x20%s,\x20%s',_0x2af700,_0xaa13('0x21'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2af700,'request\x20sent',JSON[_0xaa13('0x22')](_0x53b79a));if(_0x53b79a[_0xaa13('0x23')]){if(_0x53b79a[_0xaa13('0x23')][_0xaa13('0x24')]===0x1f4){logger[_0xaa13('0x23')]('ChatMessage,\x20%s,\x20%s',_0x2af700,_0x53b79a[_0xaa13('0x23')][_0xaa13('0x25')]);return _0x37f306(_0x53b79a[_0xaa13('0x23')][_0xaa13('0x25')]);}logger[_0xaa13('0x23')](_0xaa13('0x26'),_0x2af700,_0x53b79a['error'][_0xaa13('0x25')]);return _0x40f626(_0x53b79a[_0xaa13('0x23')]['message']);}else{logger['info'](_0xaa13('0x26'),_0x2af700,'request\x20sent');_0x40f626(_0x53b79a[_0xaa13('0x27')][_0xaa13('0x25')]);}})[_0xaa13('0x28')](function(_0x409ba1){logger[_0xaa13('0x23')](_0xaa13('0x26'),_0x2af700,_0x409ba1);_0x37f306(_0x409ba1);});});}function respondWithStatusCode(_0x2a993c,_0x5b6c95){_0x5b6c95=_0x5b6c95||0xcc;return function(_0x344256){if(_0x344256){return _0x2a993c[_0xaa13('0x29')](_0x5b6c95);}return _0x2a993c['status'](_0x5b6c95)['end']();};}function respondWithResult(_0x58e378,_0x223718){_0x223718=_0x223718||0xc8;return function(_0x5354a5){if(_0x5354a5){return _0x58e378[_0xaa13('0x2a')](_0x223718)[_0xaa13('0x2b')](_0x5354a5);}};}function respondWithFilteredResult(_0x463833,_0xf50767){return function(_0x3e6fc5){if(_0x3e6fc5){var _0x329cf7=typeof _0xf50767[_0xaa13('0x2c')]===_0xaa13('0x2d')&&typeof _0xf50767['limit']===_0xaa13('0x2d');var _0x30c639=_0x3e6fc5[_0xaa13('0x2e')];var _0x20fb5d=_0x329cf7?0x0:_0xf50767[_0xaa13('0x2c')];var _0xd92511=_0x329cf7?_0x3e6fc5['count']:_0xf50767[_0xaa13('0x2c')]+_0xf50767[_0xaa13('0x2f')];var _0x313ffd;if(_0xd92511>=_0x30c639){_0xd92511=_0x30c639;_0x313ffd=0xc8;}else{_0x313ffd=0xce;}_0x463833['status'](_0x313ffd);return _0x463833['set']('Content-Range',_0x20fb5d+'-'+_0xd92511+'/'+_0x30c639)['json'](_0x3e6fc5);}return null;};}function patchUpdates(_0x57fe0a){return function(_0x17d833){try{jsonpatch[_0xaa13('0x30')](_0x17d833,_0x57fe0a,!![]);}catch(_0x2b436a){return BPromise['reject'](_0x2b436a);}return _0x17d833[_0xaa13('0x31')]();};}function saveUpdates(_0x32afad,_0x3539d8){return function(_0xa69f7a){if(_0xa69f7a){return _0xa69f7a[_0xaa13('0x32')](_0x32afad)[_0xaa13('0x1f')](function(_0x4a744e){return _0x4a744e;});}return null;};}function removeEntity(_0x23d90f,_0x38ac2e){return function(_0x496c72){if(_0x496c72){return _0x496c72['destroy']()['then'](function(){_0x23d90f[_0xaa13('0x2a')](0xcc)[_0xaa13('0x33')]();});}};}function handleEntityNotFound(_0xe059b6,_0x5be8b5){return function(_0x1779a9){if(!_0x1779a9){_0xe059b6[_0xaa13('0x29')](0x194);}return _0x1779a9;};}function handleError(_0x51734f,_0x15e469){_0x15e469=_0x15e469||0x1f4;return function(_0x23c15a){logger[_0xaa13('0x23')](_0x23c15a[_0xaa13('0x34')]);if(_0x23c15a['name']){delete _0x23c15a['name'];}_0x51734f['status'](_0x15e469)['send'](_0x23c15a);};}exports[_0xaa13('0x35')]=function(_0x385a48,_0x29c998){var _0x5ed56f={},_0x5dc8e6={},_0x34e629={'count':0x0,'rows':[]};var _0x54a41c=_[_0xaa13('0x36')](db['ChatMessage'][_0xaa13('0x37')],function(_0x4b236c){return{'name':_0x4b236c[_0xaa13('0x38')],'type':_0x4b236c[_0xaa13('0x39')][_0xaa13('0x3a')]};});_0x5dc8e6['model']=_['map'](_0x54a41c,_0xaa13('0x3b'));_0x5dc8e6['query']=_[_0xaa13('0x3c')](_0x385a48['query']);_0x5dc8e6[_0xaa13('0x3d')]=_[_0xaa13('0x3e')](_0x5dc8e6[_0xaa13('0x3f')],_0x5dc8e6[_0xaa13('0x40')]);_0x5ed56f['attributes']=_[_0xaa13('0x3e')](_0x5dc8e6['model'],qs[_0xaa13('0x41')](_0x385a48[_0xaa13('0x40')][_0xaa13('0x41')]));_0x5ed56f[_0xaa13('0x42')]=_0x5ed56f[_0xaa13('0x42')][_0xaa13('0x43')]?_0x5ed56f['attributes']:_0x5dc8e6[_0xaa13('0x3f')];if(!_0x385a48[_0xaa13('0x40')]['hasOwnProperty'](_0xaa13('0x44'))){_0x5ed56f[_0xaa13('0x2f')]=qs[_0xaa13('0x2f')](_0x385a48['query']['limit']);_0x5ed56f[_0xaa13('0x2c')]=qs[_0xaa13('0x2c')](_0x385a48[_0xaa13('0x40')][_0xaa13('0x2c')]);}_0x5ed56f['order']=qs[_0xaa13('0x45')](_0x385a48['query'][_0xaa13('0x45')]);_0x5ed56f[_0xaa13('0x46')]=qs[_0xaa13('0x3d')](_[_0xaa13('0x47')](_0x385a48['query'],_0x5dc8e6[_0xaa13('0x3d')]),_0x54a41c);if(_0x385a48['query'][_0xaa13('0x48')]){_0x5ed56f[_0xaa13('0x46')]=_[_0xaa13('0x49')](_0x5ed56f[_0xaa13('0x46')],{'$or':_[_0xaa13('0x36')](_0x54a41c,function(_0x399f92){if(_0x399f92['type']!==_0xaa13('0x4a')){var _0x1bc363={};_0x1bc363[_0x399f92['name']]={'$like':'%'+_0x385a48[_0xaa13('0x40')][_0xaa13('0x48')]+'%'};return _0x1bc363;}})});}_0x5ed56f=_['merge']({},_0x5ed56f,_0x385a48[_0xaa13('0x4b')]);var _0x132c6f={'where':_0x5ed56f[_0xaa13('0x46')]};return db[_0xaa13('0x4c')][_0xaa13('0x2e')](_0x132c6f)['then'](function(_0x1acd3a){_0x34e629[_0xaa13('0x2e')]=_0x1acd3a;if(_0x385a48[_0xaa13('0x40')][_0xaa13('0x4d')]){_0x5ed56f['include']=[{'all':!![]}];}return db[_0xaa13('0x4c')][_0xaa13('0x4e')](_0x5ed56f);})['then'](function(_0x5da617){_0x34e629['rows']=_0x5da617;return _0x34e629;})[_0xaa13('0x1f')](respondWithFilteredResult(_0x29c998,_0x5ed56f))['catch'](handleError(_0x29c998,null));};exports[_0xaa13('0x4f')]=function(_0x3b470b,_0x5c5fd3){var _0x3fcfbf={'raw':!![],'where':{'id':_0x3b470b['params']['id']}},_0x39a769={};_0x39a769[_0xaa13('0x3f')]=_[_0xaa13('0x3c')](db[_0xaa13('0x4c')]['rawAttributes']);_0x39a769[_0xaa13('0x40')]=_[_0xaa13('0x3c')](_0x3b470b[_0xaa13('0x40')]);_0x39a769['filters']=_[_0xaa13('0x3e')](_0x39a769['model'],_0x39a769[_0xaa13('0x40')]);_0x3fcfbf[_0xaa13('0x42')]=_['intersection'](_0x39a769[_0xaa13('0x3f')],qs['fields'](_0x3b470b[_0xaa13('0x40')][_0xaa13('0x41')]));_0x3fcfbf[_0xaa13('0x42')]=_0x3fcfbf[_0xaa13('0x42')][_0xaa13('0x43')]?_0x3fcfbf[_0xaa13('0x42')]:_0x39a769[_0xaa13('0x3f')];if(_0x3b470b[_0xaa13('0x40')][_0xaa13('0x4d')]){_0x3fcfbf[_0xaa13('0x50')]=[{'all':!![]}];}_0x3fcfbf=_[_0xaa13('0x49')]({},_0x3fcfbf,_0x3b470b[_0xaa13('0x4b')]);return db[_0xaa13('0x4c')]['find'](_0x3fcfbf)[_0xaa13('0x1f')](handleEntityNotFound(_0x5c5fd3,null))[_0xaa13('0x1f')](respondWithResult(_0x5c5fd3,null))[_0xaa13('0x28')](handleError(_0x5c5fd3,null));};exports[_0xaa13('0x51')]=function(_0x56165d,_0x2ec626){return db[_0xaa13('0x4c')][_0xaa13('0x51')](_0x56165d[_0xaa13('0x52')],{})[_0xaa13('0x1f')](respondWithResult(_0x2ec626,0xc9))[_0xaa13('0x28')](handleError(_0x2ec626,null));};exports[_0xaa13('0x32')]=function(_0xec4acd,_0x2278d8){if(_0xec4acd[_0xaa13('0x52')]['id']){delete _0xec4acd[_0xaa13('0x52')]['id'];}return db['ChatMessage'][_0xaa13('0x53')]({'where':{'id':_0xec4acd['params']['id']}})[_0xaa13('0x1f')](handleEntityNotFound(_0x2278d8,null))[_0xaa13('0x1f')](saveUpdates(_0xec4acd[_0xaa13('0x52')],null))[_0xaa13('0x1f')](respondWithResult(_0x2278d8,null))[_0xaa13('0x28')](handleError(_0x2278d8,null));};exports['destroy']=function(_0x37a15e,_0x267037){return db[_0xaa13('0x4c')][_0xaa13('0x53')]({'where':{'id':_0x37a15e[_0xaa13('0x54')]['id']}})[_0xaa13('0x1f')](handleEntityNotFound(_0x267037,null))[_0xaa13('0x1f')](removeEntity(_0x267037,null))[_0xaa13('0x28')](handleError(_0x267037,null));};exports[_0xaa13('0x55')]=function(_0x4ddc75,_0x21cf4c){return db[_0xaa13('0x4c')][_0xaa13('0x55')]()[_0xaa13('0x1f')](respondWithResult(_0x21cf4c,null))[_0xaa13('0x28')](handleError(_0x21cf4c,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xaa13('0x56')]=function(_0x81d962,_0x5c6a1e,_0x4476ed){var _0x1df132={'agent':{},'channel':_0xaa13('0x57')};if(_0x81d962[_0xaa13('0x52')]['id']){delete _0x81d962[_0xaa13('0x52')]['id'];}_0x81d962['body'][_0xaa13('0x58')]=!![];_0x81d962['body']['readAt']=moment()[_0xaa13('0x59')](_0xaa13('0x5a'));_0x81d962['body'][_0xaa13('0x5b')]=_0x81d962[_0xaa13('0x52')][_0xaa13('0x5b')]||_0x81d962[_0xaa13('0x5c')]['id'];_0x1df132[_0xaa13('0x5d')]['id']=_0x81d962[_0xaa13('0x52')][_0xaa13('0x5b')];return db[_0xaa13('0x4c')][_0xaa13('0x53')]({'where':{'id':_0x81d962[_0xaa13('0x54')]['id'],'UserId':null}})[_0xaa13('0x1f')](handleEntityNotFound(_0x5c6a1e,null))['then'](saveUpdates(_0x81d962[_0xaa13('0x52')],null))[_0xaa13('0x1f')](function(_0x40db18){if(_0x40db18){_0x1df132[_0xaa13('0x25')]=_0x40db18[_0xaa13('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0xaa13('0x53')]({'where':{'id':_0x40db18[_0xaa13('0x5f')]}});}return null;})[_0xaa13('0x1f')](handleEntityNotFound(_0x5c6a1e,null))['then'](function(_0x1d240e){if(_0x1d240e){return _0x1d240e[_0xaa13('0x32')]({'UserId':_0x81d962[_0xaa13('0x52')][_0xaa13('0x5b')],'read1stAt':_[_0xaa13('0x60')](_0x1d240e[_0xaa13('0x61')])?moment()['format'](_0xaa13('0x5a')):undefined});}return null;})['then'](function(_0x3808db){if(_0x3808db){_0x1df132[_0xaa13('0x62')]=_0x3808db[_0xaa13('0x5e')]({'plain':!![]});interaction_log[_0xaa13('0x20')](_0xaa13('0x63'),_0x81d962[_0xaa13('0x5c')]['id'],_0x81d962[_0xaa13('0x5c')][_0xaa13('0x3b')],_0x81d962[_0xaa13('0x5c')][_0xaa13('0x64')],_0x1df132[_0xaa13('0x62')]['id'],_0x81d962[_0xaa13('0x52')]?JSON[_0xaa13('0x22')](_0x81d962[_0xaa13('0x52')]):_0xaa13('0x65'));return respondWithRpcPromise(_0xaa13('0x66'),_0xaa13('0x67'),_0x1df132);}return null;})[_0xaa13('0x1f')](function(_0xa52366){var _0x235fe5=_0xaa13('0x68')+_0xa52366['message'][_0xaa13('0x69')];return db[_0xaa13('0x6a')][_0xaa13('0x40')](_0x235fe5,{'type':db[_0xaa13('0x6b')][_0xaa13('0x6c')][_0xaa13('0x6d')],'raw':!![]})['then'](function(_0x5141d4){return _0x5141d4;});})[_0xaa13('0x1f')](function(_0x3c776f){if(_0x3c776f){_0x1df132[_0xaa13('0x25')]['contact']=_0x3c776f[0x0];if(!_0x81d962['body'][_0xaa13('0x5b')])return;return db[_0xaa13('0x6e')]['find']({'where':{'id':_0x81d962[_0xaa13('0x52')][_0xaa13('0x5b')],'role':_0xaa13('0x5d')},'attributes':['id',_0xaa13('0x3b'),_0xaa13('0x6f'),_0xaa13('0x70'),_0xaa13('0x71')],'raw':!![]});}return null;})[_0xaa13('0x1f')](function(_0x542a71){if(!_0x542a71)return null;_0x1df132[_0xaa13('0x25')][_0xaa13('0x5d')]=_0x542a71;return _0x1df132;})[_0xaa13('0x1f')](function(_0x1251d6){if(_0x1251d6){if(_0x81d962[_0xaa13('0x52')]['manual']){_0x1df132['message'][_0xaa13('0x72')]=util[_0xaa13('0x59')](_0xaa13('0x73'),_0x81d962['user']['name']);_0x1df132[_0xaa13('0x25')]['channel']=_0x1df132[_0xaa13('0x74')];_0x1df132[_0xaa13('0x25')][_0xaa13('0x75')]=_0x1df132[_0xaa13('0x74')];_0x1df132[_0xaa13('0x25')][_0xaa13('0x76')]=_0xaa13('0x56');return respondWithRpcPromise(_0xaa13('0x77'),_0xaa13('0x77'),{'event':'acceptmessage','message':_[_0xaa13('0x49')](_0x1df132[_0xaa13('0x25')],JSON['parse'](_0x1df132[_0xaa13('0x62')]['formData']))},client9002)[_0xaa13('0x1f')](function(){return _0x1df132;});}return _0x1df132;}return null;})['then'](respondWithResult(_0x5c6a1e,null))[_0xaa13('0x28')](handleError(_0x5c6a1e,null));};var interaction_log=require(_0xaa13('0x12'))(_0xaa13('0x78'));exports[_0xaa13('0x79')]=function(_0x16f089,_0x359764,_0x5a670b){var _0x29ec22={'agent':{},'channel':_0xaa13('0x57')};if(_0x16f089['body']['id']){delete _0x16f089[_0xaa13('0x52')]['id'];}_0x16f089['body'][_0xaa13('0x5b')]=_0x16f089[_0xaa13('0x52')][_0xaa13('0x5b')]||_0x16f089['user']['id'];_0x29ec22[_0xaa13('0x5d')]['id']=_0x16f089[_0xaa13('0x52')]['UserId'];return db[_0xaa13('0x4c')]['find']({'where':{'id':_0x16f089['params']['id'],'UserId':null}})[_0xaa13('0x1f')](handleEntityNotFound(_0x359764,null))[_0xaa13('0x1f')](function(_0x29d9a8){if(_0x29d9a8){_0x29ec22[_0xaa13('0x25')]=_0x29d9a8[_0xaa13('0x5e')]({'plain':!![]});return db[_0xaa13('0x7a')][_0xaa13('0x53')]({'where':{'id':_0x29d9a8[_0xaa13('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x359764,null))['then'](function(_0x35e27e){if(_0x35e27e){_0x29ec22[_0xaa13('0x62')]=_0x35e27e['get']({'plain':!![]});interaction_log[_0xaa13('0x20')](_0xaa13('0x7b'),_0x16f089[_0xaa13('0x5c')]['id'],_0x16f089[_0xaa13('0x5c')][_0xaa13('0x3b')],_0x16f089['user'][_0xaa13('0x64')],_0x29ec22[_0xaa13('0x62')]['id'],_0x16f089[_0xaa13('0x52')]?JSON[_0xaa13('0x22')](_0x16f089[_0xaa13('0x52')]):_0xaa13('0x65'));return respondWithRpcPromise(_0xaa13('0x7c'),_0xaa13('0x7d'),_0x29ec22);}return null;})[_0xaa13('0x1f')](function(_0x37e914){var _0x260b2e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37e914[_0xaa13('0x25')][_0xaa13('0x69')];return db[_0xaa13('0x6a')][_0xaa13('0x40')](_0x260b2e,{'type':db[_0xaa13('0x6b')][_0xaa13('0x6c')][_0xaa13('0x6d')],'raw':!![]})[_0xaa13('0x1f')](function(_0x502501){return _0x502501;});})['then'](function(_0x18bcd3){if(_0x18bcd3){_0x29ec22[_0xaa13('0x25')][_0xaa13('0x7e')]=_0x18bcd3[0x0];if(!_0x16f089[_0xaa13('0x52')][_0xaa13('0x5b')])return;return db[_0xaa13('0x6e')]['find']({'where':{'id':_0x16f089[_0xaa13('0x52')]['UserId'],'role':_0xaa13('0x5d')},'attributes':['id',_0xaa13('0x3b'),_0xaa13('0x6f'),'email',_0xaa13('0x71')],'raw':!![]});}return null;})[_0xaa13('0x1f')](function(_0x24c1bb){if(!_0x24c1bb)return null;_0x29ec22[_0xaa13('0x25')][_0xaa13('0x5d')]=_0x24c1bb;return _0x29ec22;})['then'](function(_0x5268fb){if(_0x5268fb){_0x5268fb[_0xaa13('0x25')][_0xaa13('0x72')]=util[_0xaa13('0x59')](_0xaa13('0x73'),_0x16f089[_0xaa13('0x5c')]['name']);_0x5268fb[_0xaa13('0x25')][_0xaa13('0x74')]=_0x29ec22[_0xaa13('0x74')];_0x5268fb[_0xaa13('0x25')][_0xaa13('0x75')]=_0x29ec22[_0xaa13('0x74')];_0x5268fb[_0xaa13('0x25')][_0xaa13('0x76')]=_0xaa13('0x79');respondWithRpcPromise(_0xaa13('0x77'),_0xaa13('0x77'),{'event':_0xaa13('0x7f'),'message':_[_0xaa13('0x49')](_0x29ec22[_0xaa13('0x25')],JSON[_0xaa13('0x80')](_0x29ec22['interaction'][_0xaa13('0x81')]))},client9002);return _0x29ec22;}return null;})[_0xaa13('0x1f')](respondWithResult(_0x359764,null))['catch'](handleError(_0x359764,null));}; \ No newline at end of file +var _0x29de=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','update','isNil','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','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','chat-interactions','reject','RejectMessage','ContactId','QueryTypes','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','send','ChatMessage','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','length','find','create','body','params','describe','chat','read','readAt','format'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x29de,0x134));var _0xe29d=function(_0x49c0b3,_0x4a1b06){_0x49c0b3=_0x49c0b3-0x0;var _0x245c6f=_0x29de[_0x49c0b3];return _0x245c6f;};'use strict';var emlformat=require(_0xe29d('0x0'));var rimraf=require(_0xe29d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe29d('0x2'));var rp=require(_0xe29d('0x3'));var moment=require(_0xe29d('0x4'));var BPromise=require(_0xe29d('0x5'));var Mustache=require(_0xe29d('0x6'));var util=require(_0xe29d('0x7'));var path=require(_0xe29d('0x8'));var sox=require('sox');var csv=require(_0xe29d('0x9'));var ejs=require(_0xe29d('0xa'));var fs=require('fs');var fs_extra=require(_0xe29d('0xb'));var _=require(_0xe29d('0xc'));var squel=require('squel');var crypto=require(_0xe29d('0xd'));var jsforce=require(_0xe29d('0xe'));var deskjs=require(_0xe29d('0xf'));var toCsv=require(_0xe29d('0x9'));var querystring=require('querystring');var Papa=require(_0xe29d('0x10'));var Redis=require(_0xe29d('0x11'));var authService=require(_0xe29d('0x12'));var qs=require(_0xe29d('0x13'));var as=require(_0xe29d('0x14'));var hardwareService=require(_0xe29d('0x15'));var logger=require(_0xe29d('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe29d('0x17'));var db=require(_0xe29d('0x18'))['db'];config[_0xe29d('0x19')]=_[_0xe29d('0x1a')](config[_0xe29d('0x19')],{'host':_0xe29d('0x1b'),'port':0x18eb});var socket=require(_0xe29d('0x1c'))(new Redis(config[_0xe29d('0x19')]));require(_0xe29d('0x1d'))[_0xe29d('0x1e')](socket);var jayson=require(_0xe29d('0x1f'));var client=jayson[_0xe29d('0x20')][_0xe29d('0x21')]({'port':0x232c});var client9002=jayson[_0xe29d('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a42aa,_0x1554e5,_0x234b1d,_0x42b7cc){return new BPromise(function(_0x343050,_0x1b1a89){var _0xce6a86=_0x42b7cc||client;return _0xce6a86['request'](_0x3a42aa,_0x234b1d)[_0xe29d('0x22')](function(_0x39c9fe){logger[_0xe29d('0x23')](_0xe29d('0x24'),_0x1554e5,'request\x20sent');logger[_0xe29d('0x25')](_0xe29d('0x26'),_0x1554e5,_0xe29d('0x27'),JSON[_0xe29d('0x28')](_0x39c9fe));if(_0x39c9fe['error']){if(_0x39c9fe[_0xe29d('0x29')]['code']===0x1f4){logger[_0xe29d('0x29')](_0xe29d('0x24'),_0x1554e5,_0x39c9fe[_0xe29d('0x29')][_0xe29d('0x2a')]);return _0x1b1a89(_0x39c9fe[_0xe29d('0x29')][_0xe29d('0x2a')]);}logger[_0xe29d('0x29')]('ChatMessage,\x20%s,\x20%s',_0x1554e5,_0x39c9fe[_0xe29d('0x29')][_0xe29d('0x2a')]);return _0x343050(_0x39c9fe[_0xe29d('0x29')]['message']);}else{logger[_0xe29d('0x23')](_0xe29d('0x24'),_0x1554e5,_0xe29d('0x27'));_0x343050(_0x39c9fe[_0xe29d('0x2b')]['message']);}})[_0xe29d('0x2c')](function(_0x163856){logger['error'](_0xe29d('0x24'),_0x1554e5,_0x163856);_0x1b1a89(_0x163856);});});}function respondWithStatusCode(_0x345eb0,_0xd41e75){_0xd41e75=_0xd41e75||0xcc;return function(_0x487bd9){if(_0x487bd9){return _0x345eb0[_0xe29d('0x2d')](_0xd41e75);}return _0x345eb0['status'](_0xd41e75)['end']();};}function respondWithResult(_0x5438de,_0x24155c){_0x24155c=_0x24155c||0xc8;return function(_0x5044a1){if(_0x5044a1){return _0x5438de[_0xe29d('0x2e')](_0x24155c)[_0xe29d('0x2f')](_0x5044a1);}};}function respondWithFilteredResult(_0x2af1e9,_0x1e0b17){return function(_0x35a33a){if(_0x35a33a){var _0x410f3e=typeof _0x1e0b17[_0xe29d('0x30')]===_0xe29d('0x31')&&typeof _0x1e0b17['limit']==='undefined';var _0x217503=_0x35a33a[_0xe29d('0x32')];var _0x2485a6=_0x410f3e?0x0:_0x1e0b17[_0xe29d('0x30')];var _0xc75459=_0x410f3e?_0x35a33a[_0xe29d('0x32')]:_0x1e0b17['offset']+_0x1e0b17[_0xe29d('0x33')];var _0x3159d8;if(_0xc75459>=_0x217503){_0xc75459=_0x217503;_0x3159d8=0xc8;}else{_0x3159d8=0xce;}_0x2af1e9['status'](_0x3159d8);return _0x2af1e9[_0xe29d('0x34')](_0xe29d('0x35'),_0x2485a6+'-'+_0xc75459+'/'+_0x217503)[_0xe29d('0x2f')](_0x35a33a);}return null;};}function patchUpdates(_0x2a2fe7){return function(_0x2ef01c){try{jsonpatch[_0xe29d('0x36')](_0x2ef01c,_0x2a2fe7,!![]);}catch(_0xe5646e){return BPromise['reject'](_0xe5646e);}return _0x2ef01c[_0xe29d('0x37')]();};}function saveUpdates(_0x4f211c,_0x51d4ef){return function(_0x79ab21){if(_0x79ab21){return _0x79ab21['update'](_0x4f211c)['then'](function(_0x31bd5e){return _0x31bd5e;});}return null;};}function removeEntity(_0x3da158,_0x1e1b53){return function(_0x32b8ef){if(_0x32b8ef){return _0x32b8ef[_0xe29d('0x38')]()['then'](function(){_0x3da158[_0xe29d('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x517bb9,_0x5c9e1c){return function(_0xacb365){if(!_0xacb365){_0x517bb9[_0xe29d('0x2d')](0x194);}return _0xacb365;};}function handleError(_0x311de2,_0x157fe4){_0x157fe4=_0x157fe4||0x1f4;return function(_0x30d658){logger['error'](_0x30d658['stack']);if(_0x30d658['name']){delete _0x30d658['name'];}_0x311de2['status'](_0x157fe4)[_0xe29d('0x39')](_0x30d658);};}exports['index']=function(_0x3c93ce,_0x4ed94a){var _0x63f9f5={},_0x35ca12={},_0x53fedf={'count':0x0,'rows':[]};var _0x1ada11=_['map'](db[_0xe29d('0x3a')][_0xe29d('0x3b')],function(_0x200018){return{'name':_0x200018[_0xe29d('0x3c')],'type':_0x200018[_0xe29d('0x3d')][_0xe29d('0x3e')]};});_0x35ca12['model']=_['map'](_0x1ada11,_0xe29d('0x3f'));_0x35ca12[_0xe29d('0x40')]=_[_0xe29d('0x41')](_0x3c93ce['query']);_0x35ca12[_0xe29d('0x42')]=_['intersection'](_0x35ca12['model'],_0x35ca12[_0xe29d('0x40')]);_0x63f9f5['attributes']=_[_0xe29d('0x43')](_0x35ca12[_0xe29d('0x44')],qs['fields'](_0x3c93ce['query'][_0xe29d('0x45')]));_0x63f9f5[_0xe29d('0x46')]=_0x63f9f5[_0xe29d('0x46')]['length']?_0x63f9f5[_0xe29d('0x46')]:_0x35ca12[_0xe29d('0x44')];if(!_0x3c93ce['query'][_0xe29d('0x47')](_0xe29d('0x48'))){_0x63f9f5[_0xe29d('0x33')]=qs[_0xe29d('0x33')](_0x3c93ce[_0xe29d('0x40')][_0xe29d('0x33')]);_0x63f9f5[_0xe29d('0x30')]=qs[_0xe29d('0x30')](_0x3c93ce[_0xe29d('0x40')]['offset']);}_0x63f9f5[_0xe29d('0x49')]=qs[_0xe29d('0x4a')](_0x3c93ce['query'][_0xe29d('0x4a')]);_0x63f9f5[_0xe29d('0x4b')]=qs[_0xe29d('0x42')](_[_0xe29d('0x4c')](_0x3c93ce[_0xe29d('0x40')],_0x35ca12[_0xe29d('0x42')]),_0x1ada11);if(_0x3c93ce[_0xe29d('0x40')][_0xe29d('0x4d')]){_0x63f9f5['where']=_[_0xe29d('0x4e')](_0x63f9f5[_0xe29d('0x4b')],{'$or':_['map'](_0x1ada11,function(_0x35c65c){if(_0x35c65c[_0xe29d('0x3d')]!==_0xe29d('0x4f')){var _0x3fdc2a={};_0x3fdc2a[_0x35c65c[_0xe29d('0x3f')]]={'$like':'%'+_0x3c93ce[_0xe29d('0x40')][_0xe29d('0x4d')]+'%'};return _0x3fdc2a;}})});}_0x63f9f5=_[_0xe29d('0x4e')]({},_0x63f9f5,_0x3c93ce[_0xe29d('0x50')]);var _0x5ae35a={'where':_0x63f9f5[_0xe29d('0x4b')]};return db[_0xe29d('0x3a')][_0xe29d('0x32')](_0x5ae35a)[_0xe29d('0x22')](function(_0x1a965d){_0x53fedf[_0xe29d('0x32')]=_0x1a965d;if(_0x3c93ce['query'][_0xe29d('0x51')]){_0x63f9f5[_0xe29d('0x52')]=[{'all':!![]}];}return db[_0xe29d('0x3a')][_0xe29d('0x53')](_0x63f9f5);})[_0xe29d('0x22')](function(_0x22fad8){_0x53fedf['rows']=_0x22fad8;return _0x53fedf;})[_0xe29d('0x22')](respondWithFilteredResult(_0x4ed94a,_0x63f9f5))[_0xe29d('0x2c')](handleError(_0x4ed94a,null));};exports['show']=function(_0x3168c1,_0x54a6d0){var _0x31af5e={'raw':!![],'where':{'id':_0x3168c1['params']['id']}},_0x21cf2b={};_0x21cf2b[_0xe29d('0x44')]=_[_0xe29d('0x41')](db[_0xe29d('0x3a')][_0xe29d('0x3b')]);_0x21cf2b[_0xe29d('0x40')]=_['keys'](_0x3168c1[_0xe29d('0x40')]);_0x21cf2b[_0xe29d('0x42')]=_[_0xe29d('0x43')](_0x21cf2b[_0xe29d('0x44')],_0x21cf2b[_0xe29d('0x40')]);_0x31af5e[_0xe29d('0x46')]=_[_0xe29d('0x43')](_0x21cf2b[_0xe29d('0x44')],qs[_0xe29d('0x45')](_0x3168c1[_0xe29d('0x40')][_0xe29d('0x45')]));_0x31af5e[_0xe29d('0x46')]=_0x31af5e[_0xe29d('0x46')][_0xe29d('0x54')]?_0x31af5e['attributes']:_0x21cf2b[_0xe29d('0x44')];if(_0x3168c1['query']['includeAll']){_0x31af5e[_0xe29d('0x52')]=[{'all':!![]}];}_0x31af5e=_[_0xe29d('0x4e')]({},_0x31af5e,_0x3168c1[_0xe29d('0x50')]);return db['ChatMessage'][_0xe29d('0x55')](_0x31af5e)[_0xe29d('0x22')](handleEntityNotFound(_0x54a6d0,null))[_0xe29d('0x22')](respondWithResult(_0x54a6d0,null))[_0xe29d('0x2c')](handleError(_0x54a6d0,null));};exports[_0xe29d('0x56')]=function(_0x4e96de,_0x489df5){return db['ChatMessage'][_0xe29d('0x56')](_0x4e96de['body'],{})[_0xe29d('0x22')](respondWithResult(_0x489df5,0xc9))[_0xe29d('0x2c')](handleError(_0x489df5,null));};exports['update']=function(_0x38d01e,_0x512b6a){if(_0x38d01e[_0xe29d('0x57')]['id']){delete _0x38d01e[_0xe29d('0x57')]['id'];}return db[_0xe29d('0x3a')][_0xe29d('0x55')]({'where':{'id':_0x38d01e['params']['id']}})['then'](handleEntityNotFound(_0x512b6a,null))['then'](saveUpdates(_0x38d01e[_0xe29d('0x57')],null))[_0xe29d('0x22')](respondWithResult(_0x512b6a,null))['catch'](handleError(_0x512b6a,null));};exports[_0xe29d('0x38')]=function(_0x578f80,_0x2e3861){return db[_0xe29d('0x3a')][_0xe29d('0x55')]({'where':{'id':_0x578f80[_0xe29d('0x58')]['id']}})[_0xe29d('0x22')](handleEntityNotFound(_0x2e3861,null))[_0xe29d('0x22')](removeEntity(_0x2e3861,null))[_0xe29d('0x2c')](handleError(_0x2e3861,null));};exports[_0xe29d('0x59')]=function(_0x5d8ab8,_0x4eac35){return db[_0xe29d('0x3a')][_0xe29d('0x59')]()[_0xe29d('0x22')](respondWithResult(_0x4eac35,null))[_0xe29d('0x2c')](handleError(_0x4eac35,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x41063f,_0x4594de,_0x52fde1){var _0x38660e={'agent':{},'channel':_0xe29d('0x5a')};if(_0x41063f[_0xe29d('0x57')]['id']){delete _0x41063f['body']['id'];}_0x41063f[_0xe29d('0x57')][_0xe29d('0x5b')]=!![];_0x41063f[_0xe29d('0x57')][_0xe29d('0x5c')]=moment()[_0xe29d('0x5d')](_0xe29d('0x5e'));_0x41063f['body'][_0xe29d('0x5f')]=_0x41063f['body'][_0xe29d('0x5f')]||_0x41063f[_0xe29d('0x60')]['id'];_0x38660e[_0xe29d('0x61')]['id']=_0x41063f[_0xe29d('0x57')][_0xe29d('0x5f')];return db['ChatMessage'][_0xe29d('0x55')]({'where':{'id':_0x41063f['params']['id'],'UserId':null}})[_0xe29d('0x22')](handleEntityNotFound(_0x4594de,null))[_0xe29d('0x22')](saveUpdates(_0x41063f[_0xe29d('0x57')],null))['then'](function(_0x2febbd){if(_0x2febbd){_0x38660e[_0xe29d('0x2a')]=_0x2febbd[_0xe29d('0x62')]({'plain':!![]});return db[_0xe29d('0x63')][_0xe29d('0x55')]({'where':{'id':_0x2febbd[_0xe29d('0x64')]}});}return null;})[_0xe29d('0x22')](handleEntityNotFound(_0x4594de,null))[_0xe29d('0x22')](function(_0x5e584d){if(_0x5e584d){return _0x5e584d[_0xe29d('0x65')]({'UserId':_0x41063f[_0xe29d('0x57')][_0xe29d('0x5f')],'read1stAt':_[_0xe29d('0x66')](_0x5e584d[_0xe29d('0x67')])?moment()['format'](_0xe29d('0x5e')):undefined});}return null;})[_0xe29d('0x22')](function(_0x2dea58){if(_0x2dea58){_0x38660e[_0xe29d('0x68')]=_0x2dea58['get']({'plain':!![]});interaction_log[_0xe29d('0x23')](_0xe29d('0x69'),_0x41063f[_0xe29d('0x60')]['id'],_0x41063f[_0xe29d('0x60')][_0xe29d('0x3f')],_0x41063f[_0xe29d('0x60')][_0xe29d('0x6a')],_0x38660e[_0xe29d('0x68')]['id'],_0x41063f[_0xe29d('0x57')]?JSON[_0xe29d('0x28')](_0x41063f[_0xe29d('0x57')]):_0xe29d('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xe29d('0x6c'),_0x38660e);}return null;})[_0xe29d('0x22')](function(_0x26a81a){var _0x5b92ea=_0xe29d('0x6d')+_0x26a81a[_0xe29d('0x2a')]['ContactId'];return db[_0xe29d('0x6e')]['query'](_0x5b92ea,{'type':db[_0xe29d('0x6f')]['QueryTypes'][_0xe29d('0x70')],'raw':!![]})['then'](function(_0x241d57){return _0x241d57;});})['then'](function(_0x1f3572){if(_0x1f3572){_0x38660e[_0xe29d('0x2a')][_0xe29d('0x71')]=_0x1f3572[0x0];if(!_0x41063f[_0xe29d('0x57')]['UserId'])return;return db[_0xe29d('0x72')][_0xe29d('0x55')]({'where':{'id':_0x41063f[_0xe29d('0x57')]['UserId'],'role':_0xe29d('0x61')},'attributes':['id',_0xe29d('0x3f'),_0xe29d('0x73'),_0xe29d('0x74'),_0xe29d('0x75')],'raw':!![]});}return null;})[_0xe29d('0x22')](function(_0x33de75){if(!_0x33de75)return null;_0x38660e[_0xe29d('0x2a')][_0xe29d('0x61')]=_0x33de75;return _0x38660e;})[_0xe29d('0x22')](function(_0x16ed4b){if(_0x16ed4b){if(_0x41063f[_0xe29d('0x57')]['manual']){_0x38660e[_0xe29d('0x2a')][_0xe29d('0x76')]=util[_0xe29d('0x5d')](_0xe29d('0x77'),_0x41063f[_0xe29d('0x60')][_0xe29d('0x3f')]);_0x38660e[_0xe29d('0x2a')][_0xe29d('0x78')]=_0x38660e[_0xe29d('0x78')];_0x38660e[_0xe29d('0x2a')][_0xe29d('0x79')]=_0x38660e[_0xe29d('0x78')];_0x38660e[_0xe29d('0x2a')][_0xe29d('0x7a')]=_0xe29d('0x7b');return respondWithRpcPromise(_0xe29d('0x7c'),_0xe29d('0x7c'),{'event':_0xe29d('0x7d'),'message':_[_0xe29d('0x4e')](_0x38660e[_0xe29d('0x2a')],JSON[_0xe29d('0x7e')](_0x38660e[_0xe29d('0x68')][_0xe29d('0x7f')]))},client9002)[_0xe29d('0x22')](function(){return _0x38660e;});}return _0x38660e;}return null;})[_0xe29d('0x22')](respondWithResult(_0x4594de,null))[_0xe29d('0x2c')](handleError(_0x4594de,null));};var interaction_log=require(_0xe29d('0x16'))(_0xe29d('0x80'));exports[_0xe29d('0x81')]=function(_0x47c843,_0x1ac75f,_0x48ef0b){var _0x4f3137={'agent':{},'channel':'chat'};if(_0x47c843[_0xe29d('0x57')]['id']){delete _0x47c843[_0xe29d('0x57')]['id'];}_0x47c843[_0xe29d('0x57')]['UserId']=_0x47c843[_0xe29d('0x57')][_0xe29d('0x5f')]||_0x47c843[_0xe29d('0x60')]['id'];_0x4f3137['agent']['id']=_0x47c843[_0xe29d('0x57')][_0xe29d('0x5f')];return db[_0xe29d('0x3a')][_0xe29d('0x55')]({'where':{'id':_0x47c843[_0xe29d('0x58')]['id'],'UserId':null}})[_0xe29d('0x22')](handleEntityNotFound(_0x1ac75f,null))[_0xe29d('0x22')](function(_0x395cb7){if(_0x395cb7){_0x4f3137[_0xe29d('0x2a')]=_0x395cb7[_0xe29d('0x62')]({'plain':!![]});return db[_0xe29d('0x63')]['find']({'where':{'id':_0x395cb7[_0xe29d('0x64')]}});}return null;})[_0xe29d('0x22')](handleEntityNotFound(_0x1ac75f,null))['then'](function(_0x8ad0ab){if(_0x8ad0ab){_0x4f3137['interaction']=_0x8ad0ab['get']({'plain':!![]});interaction_log[_0xe29d('0x23')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47c843[_0xe29d('0x60')]['id'],_0x47c843[_0xe29d('0x60')]['name'],_0x47c843['user'][_0xe29d('0x6a')],_0x4f3137[_0xe29d('0x68')]['id'],_0x47c843[_0xe29d('0x57')]?JSON[_0xe29d('0x28')](_0x47c843[_0xe29d('0x57')]):_0xe29d('0x6b'));return respondWithRpcPromise(_0xe29d('0x82'),'rejectMessage',_0x4f3137);}return null;})[_0xe29d('0x22')](function(_0x350aa1){var _0x2f8c07=_0xe29d('0x6d')+_0x350aa1[_0xe29d('0x2a')][_0xe29d('0x83')];return db[_0xe29d('0x6e')][_0xe29d('0x40')](_0x2f8c07,{'type':db[_0xe29d('0x6f')][_0xe29d('0x84')][_0xe29d('0x70')],'raw':!![]})[_0xe29d('0x22')](function(_0x25970f){return _0x25970f;});})[_0xe29d('0x22')](function(_0x29d5fe){if(_0x29d5fe){_0x4f3137[_0xe29d('0x2a')][_0xe29d('0x71')]=_0x29d5fe[0x0];if(!_0x47c843[_0xe29d('0x57')][_0xe29d('0x5f')])return;return db[_0xe29d('0x72')][_0xe29d('0x55')]({'where':{'id':_0x47c843[_0xe29d('0x57')]['UserId'],'role':_0xe29d('0x61')},'attributes':['id',_0xe29d('0x3f'),_0xe29d('0x73'),_0xe29d('0x74'),_0xe29d('0x75')],'raw':!![]});}return null;})['then'](function(_0x4f0cbf){if(!_0x4f0cbf)return null;_0x4f3137[_0xe29d('0x2a')][_0xe29d('0x61')]=_0x4f0cbf;return _0x4f3137;})[_0xe29d('0x22')](function(_0x41722a){if(_0x41722a){_0x41722a[_0xe29d('0x2a')][_0xe29d('0x76')]=util[_0xe29d('0x5d')](_0xe29d('0x77'),_0x47c843['user']['name']);_0x41722a[_0xe29d('0x2a')]['channel']=_0x4f3137[_0xe29d('0x78')];_0x41722a[_0xe29d('0x2a')][_0xe29d('0x79')]=_0x4f3137[_0xe29d('0x78')];_0x41722a['message'][_0xe29d('0x7a')]='reject';respondWithRpcPromise(_0xe29d('0x7c'),_0xe29d('0x7c'),{'event':_0xe29d('0x85'),'message':_['merge'](_0x4f3137[_0xe29d('0x2a')],JSON[_0xe29d('0x7e')](_0x4f3137[_0xe29d('0x68')][_0xe29d('0x7f')]))},client9002);return _0x4f3137;}return null;})[_0xe29d('0x22')](respondWithResult(_0x1ac75f,null))[_0xe29d('0x2c')](handleError(_0x1ac75f,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 9aa7c08..b5463ea 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 _0xb3e0=['emit','hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save','remove'];(function(_0x2314ec,_0x3e96ec){var _0x50fbf9=function(_0x2632f4){while(--_0x2632f4){_0x2314ec['push'](_0x2314ec['shift']());}};_0x50fbf9(++_0x3e96ec);}(_0xb3e0,0xeb));var _0x0b3e=function(_0x59f41d,_0x3b2543){_0x59f41d=_0x59f41d-0x0;var _0x16fb2e=_0xb3e0[_0x59f41d];return _0x16fb2e;};'use strict';var EventEmitter=require(_0x0b3e('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x0b3e('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x0b3e('0x2')](0x0);var events={'afterCreate':_0x0b3e('0x3'),'afterUpdate':'update','afterDestroy':_0x0b3e('0x4')};function emitEvent(_0x403224){return function(_0xc1aff7,_0x1d31d8,_0x55d037){ChatMessageEvents[_0x0b3e('0x5')](_0x403224+':'+_0xc1aff7['id'],_0xc1aff7);ChatMessageEvents[_0x0b3e('0x5')](_0x403224,_0xc1aff7);_0x55d037(null);};}for(var e in events){if(events[_0x0b3e('0x6')](e)){var event=events[e];ChatMessage[_0x0b3e('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xd192=['remove','emit','hasOwnProperty','exports','events','ChatMessage','setMaxListeners','save','update'];(function(_0xc83b33,_0x5d6cee){var _0x4dd7b8=function(_0x3687bf){while(--_0x3687bf){_0xc83b33['push'](_0xc83b33['shift']());}};_0x4dd7b8(++_0x5d6cee);}(_0xd192,0x67));var _0x2d19=function(_0x1fdbef,_0x41d245){_0x1fdbef=_0x1fdbef-0x0;var _0x21680a=_0xd192[_0x1fdbef];return _0x21680a;};'use strict';var EventEmitter=require(_0x2d19('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x2d19('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x2d19('0x2')](0x0);var events={'afterCreate':_0x2d19('0x3'),'afterUpdate':_0x2d19('0x4'),'afterDestroy':_0x2d19('0x5')};function emitEvent(_0x5ebd1b){return function(_0x6330ae,_0x9d3b95,_0x426924){ChatMessageEvents[_0x2d19('0x6')](_0x5ebd1b+':'+_0x6330ae['id'],_0x6330ae);ChatMessageEvents[_0x2d19('0x6')](_0x5ebd1b,_0x6330ae);_0x426924(null);};}for(var e in events){if(events[_0x2d19('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x2d19('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 3ed6c73..0cb5027 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 _0x9ade=['define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','./chatMessage.attributes','exports'];(function(_0x19293,_0x52b657){var _0x3e26de=function(_0x597fe1){while(--_0x597fe1){_0x19293['push'](_0x19293['shift']());}};_0x3e26de(++_0x52b657);}(_0x9ade,0x107));var _0xe9ad=function(_0x51fb3c,_0x28a763){_0x51fb3c=_0x51fb3c-0x0;var _0x941d96=_0x9ade[_0x51fb3c];return _0x941d96;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe9ad('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9ad('0x3'));var fs=require('fs');var path=require(_0xe9ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe9ad('0x5'));module[_0xe9ad('0x6')]=function(_0xdd1549,_0x3e4092){return _0xdd1549[_0xe9ad('0x7')](_0xe9ad('0x8'),attributes,{'tableName':_0xe9ad('0x9'),'paranoid':![],'indexes':[{'name':_0xe9ad('0xa'),'fields':['body'],'type':_0xe9ad('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38310c,_0x32d7d0,_0x3b353f){var _0x268c04=_0xdd1549[_0xe9ad('0xc')];var _0x16ef20=_0x38310c[_0xe9ad('0xd')]({'plain':!![]});if(_0x16ef20[_0xe9ad('0xe')][_0xe9ad('0xf')]()==='in'||_0x16ef20[_0xe9ad('0xe')][_0xe9ad('0xf')]()==='out'&&!_0x16ef20[_0xe9ad('0x10')]&&!_[_0xe9ad('0x11')](_0x16ef20[_0xe9ad('0x12')])){_0x268c04[_0xe9ad('0x13')]['findOne']({'where':{'id':_0x16ef20[_0xe9ad('0x14')]}})[_0xe9ad('0x15')](function(_0x2ea149){if(_0x2ea149){_0x2ea149[_0xe9ad('0x16')]({'lastMsgAt':_0x16ef20['createdAt'],'lastMsgDirection':_0x16ef20[_0xe9ad('0xe')]['toLowerCase']()});}})[_0xe9ad('0x17')](function(_0x4d018f){console[_0xe9ad('0x18')](_0x4d018f);});}_0x3b353f();}},'charset':_0xe9ad('0x19'),'collate':_0xe9ad('0x1a')});}; \ No newline at end of file +var _0x8d20=['path','rimraf','../../config/environment','exports','define','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f2438,_0x1aa150){var _0x25d498=function(_0x2a3fe4){while(--_0x2a3fe4){_0x1f2438['push'](_0x1f2438['shift']());}};_0x25d498(++_0x1aa150);}(_0x8d20,0x1c5));var _0x08d2=function(_0x4136b8,_0x9ce0ab){_0x4136b8=_0x4136b8-0x0;var _0x161647=_0x8d20[_0x4136b8];return _0x161647;};'use strict';var _=require('lodash');var util=require(_0x08d2('0x0'));var logger=require(_0x08d2('0x1'))(_0x08d2('0x2'));var moment=require(_0x08d2('0x3'));var BPromise=require(_0x08d2('0x4'));var rp=require(_0x08d2('0x5'));var fs=require('fs');var path=require(_0x08d2('0x6'));var rimraf=require(_0x08d2('0x7'));var config=require(_0x08d2('0x8'));var attributes=require('./chatMessage.attributes');module[_0x08d2('0x9')]=function(_0x459e2c,_0x1acbf4){return _0x459e2c[_0x08d2('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x08d2('0xb'),'fields':[_0x08d2('0xc')],'type':_0x08d2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xaf964,_0x3ff53f,_0x3f9e21){var _0x3112d0=_0x459e2c['models'];var _0x463135=_0xaf964['get']({'plain':!![]});if(_0x463135[_0x08d2('0xe')][_0x08d2('0xf')]()==='in'||_0x463135[_0x08d2('0xe')]['toLowerCase']()==='out'&&!_0x463135[_0x08d2('0x10')]&&!_[_0x08d2('0x11')](_0x463135[_0x08d2('0x12')])){_0x3112d0[_0x08d2('0x13')][_0x08d2('0x14')]({'where':{'id':_0x463135['ChatInteractionId']}})[_0x08d2('0x15')](function(_0x3c4718){if(_0x3c4718){_0x3c4718[_0x08d2('0x16')]({'lastMsgAt':_0x463135[_0x08d2('0x17')],'lastMsgDirection':_0x463135[_0x08d2('0xe')][_0x08d2('0xf')]()});}})[_0x08d2('0x18')](function(_0x3f355a){console['error'](_0x3f355a);});}_0x3f9e21();}},'charset':_0x08d2('0x19'),'collate':_0x08d2('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 981f46f..539e282 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 _0xf02c=['then','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatMessage','create','body','options','raw'];(function(_0x148c09,_0x4fd39f){var _0x18e613=function(_0xfaa810){while(--_0xfaa810){_0x148c09['push'](_0x148c09['shift']());}};_0x18e613(++_0x4fd39f);}(_0xf02c,0x92));var _0xcf02=function(_0x367c6d,_0x2d0d1d){_0x367c6d=_0x367c6d-0x0;var _0x42d350=_0xf02c[_0x367c6d];return _0x42d350;};'use strict';var _=require(_0xcf02('0x0'));var util=require(_0xcf02('0x1'));var moment=require(_0xcf02('0x2'));var BPromise=require(_0xcf02('0x3'));var rs=require(_0xcf02('0x4'));var fs=require('fs');var Redis=require(_0xcf02('0x5'));var db=require(_0xcf02('0x6'))['db'];var utils=require(_0xcf02('0x7'));var logger=require(_0xcf02('0x8'))(_0xcf02('0x9'));var config=require(_0xcf02('0xa'));var jayson=require(_0xcf02('0xb'));var client=jayson[_0xcf02('0xc')][_0xcf02('0xd')]({'port':0x232a});config[_0xcf02('0xe')]=_['defaults'](config[_0xcf02('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcf02('0xf'))[_0xcf02('0x10')](socket);function respondWithRpcPromise(_0x1411e5,_0x1c9cda,_0x5bd27c){return new BPromise(function(_0x70fe11,_0x2c0978){return client[_0xcf02('0x11')](_0x1411e5,_0x5bd27c)['then'](function(_0x48c0d8){logger[_0xcf02('0x12')](_0xcf02('0x13'),_0x1c9cda,_0xcf02('0x14'));logger[_0xcf02('0x15')](_0xcf02('0x16'),_0x1c9cda,'request\x20sent',JSON[_0xcf02('0x17')](_0x48c0d8));if(_0x48c0d8[_0xcf02('0x18')]){if(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x19')]===0x1f4){logger[_0xcf02('0x18')](_0xcf02('0x13'),_0x1c9cda,_0x48c0d8[_0xcf02('0x18')]['message']);return _0x2c0978(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);}logger[_0xcf02('0x18')]('ChatMessage,\x20%s,\x20%s',_0x1c9cda,_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);return _0x70fe11(_0x48c0d8[_0xcf02('0x18')][_0xcf02('0x1a')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x1c9cda,'request\x20sent');_0x70fe11(_0x48c0d8[_0xcf02('0x1b')]['message']);}})[_0xcf02('0x1c')](function(_0x1cac37){logger[_0xcf02('0x18')](_0xcf02('0x13'),_0x1c9cda,_0x1cac37);_0x2c0978(_0x1cac37);});});}exports['CreateChatMessage']=function(_0x52322d){var _0x2a3ba1=this;return new Promise(function(_0x27b04e,_0x5bc7a2){return db[_0xcf02('0x1d')][_0xcf02('0x1e')](_0x52322d[_0xcf02('0x1f')],{'raw':_0x52322d[_0xcf02('0x20')]?_0x52322d['options'][_0xcf02('0x21')]===undefined?!![]:![]:!![]})[_0xcf02('0x22')](function(_0x3bf3f4){logger[_0xcf02('0x12')](_0xcf02('0x23'),_0x52322d);logger[_0xcf02('0x15')](_0xcf02('0x23'),_0x52322d,JSON[_0xcf02('0x17')](_0x3bf3f4));_0x27b04e(_0x3bf3f4);})['catch'](function(_0x487ce6){logger['error'](_0xcf02('0x23'),_0x487ce6[_0xcf02('0x1a')],_0x52322d);_0x5bc7a2(_0x2a3ba1[_0xcf02('0x18')](0x1f4,_0x487ce6[_0xcf02('0x1a')]));});});}; \ No newline at end of file +var _0xa808=['stringify','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateChatMessage','ChatMessage','body','options','raw'];(function(_0x37679c,_0x1873fe){var _0x26b3b4=function(_0xb6ce4d){while(--_0xb6ce4d){_0x37679c['push'](_0x37679c['shift']());}};_0x26b3b4(++_0x1873fe);}(_0xa808,0x12b));var _0x8a80=function(_0x466fc5,_0x44df27){_0x466fc5=_0x466fc5-0x0;var _0x351e8a=_0xa808[_0x466fc5];return _0x351e8a;};'use strict';var _=require(_0x8a80('0x0'));var util=require(_0x8a80('0x1'));var moment=require('moment');var BPromise=require(_0x8a80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a80('0x3'));var db=require(_0x8a80('0x4'))['db'];var utils=require(_0x8a80('0x5'));var logger=require('../../config/logger')(_0x8a80('0x6'));var config=require(_0x8a80('0x7'));var jayson=require(_0x8a80('0x8'));var client=jayson[_0x8a80('0x9')][_0x8a80('0xa')]({'port':0x232a});config[_0x8a80('0xb')]=_[_0x8a80('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8a80('0xd'))(new Redis(config[_0x8a80('0xb')]));require(_0x8a80('0xe'))[_0x8a80('0xf')](socket);function respondWithRpcPromise(_0x27361c,_0x606674,_0x8f8cdd){return new BPromise(function(_0x30868c,_0x3702d6){return client['request'](_0x27361c,_0x8f8cdd)[_0x8a80('0x10')](function(_0x527d7a){logger[_0x8a80('0x11')](_0x8a80('0x12'),_0x606674,_0x8a80('0x13'));logger[_0x8a80('0x14')](_0x8a80('0x15'),_0x606674,_0x8a80('0x13'),JSON['stringify'](_0x527d7a));if(_0x527d7a[_0x8a80('0x16')]){if(_0x527d7a[_0x8a80('0x16')][_0x8a80('0x17')]===0x1f4){logger[_0x8a80('0x16')](_0x8a80('0x12'),_0x606674,_0x527d7a['error'][_0x8a80('0x18')]);return _0x3702d6(_0x527d7a[_0x8a80('0x16')]['message']);}logger[_0x8a80('0x16')](_0x8a80('0x12'),_0x606674,_0x527d7a['error'][_0x8a80('0x18')]);return _0x30868c(_0x527d7a['error'][_0x8a80('0x18')]);}else{logger['info'](_0x8a80('0x12'),_0x606674,_0x8a80('0x13'));_0x30868c(_0x527d7a[_0x8a80('0x19')][_0x8a80('0x18')]);}})['catch'](function(_0x10e306){logger[_0x8a80('0x16')]('ChatMessage,\x20%s,\x20%s',_0x606674,_0x10e306);_0x3702d6(_0x10e306);});});}exports[_0x8a80('0x1a')]=function(_0x2e68e5){var _0x24f342=this;return new Promise(function(_0x328b04,_0x55250a){return db[_0x8a80('0x1b')]['create'](_0x2e68e5[_0x8a80('0x1c')],{'raw':_0x2e68e5[_0x8a80('0x1d')]?_0x2e68e5[_0x8a80('0x1d')][_0x8a80('0x1e')]===undefined?!![]:![]:!![]})[_0x8a80('0x10')](function(_0x395532){logger[_0x8a80('0x11')](_0x8a80('0x1a'),_0x2e68e5);logger[_0x8a80('0x14')](_0x8a80('0x1a'),_0x2e68e5,JSON[_0x8a80('0x1f')](_0x395532));_0x328b04(_0x395532);})[_0x8a80('0x20')](function(_0x1e1e9f){logger['error'](_0x8a80('0x1a'),_0x1e1e9f['message'],_0x2e68e5);_0x55250a(_0x24f342['error'](0x1f4,_0x1e1e9f[_0x8a80('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 9198327..aadcb60 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 _0x3c6c=['update','emit','register','./chatMessage.events','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x4c836e,_0x58df59){_0x4c836e=_0x4c836e-0x0;var _0x43807e=_0x3c6c[_0x4c836e];return _0x43807e;};'use strict';var ChatMessageEvents=require(_0xc3c6('0x0'));var events=['save',_0xc3c6('0x1'),_0xc3c6('0x2')];function createListener(_0x274dda,_0x3d2b3f){return function(_0x16a464){_0x3d2b3f[_0xc3c6('0x3')](_0x274dda,_0x16a464);};}function removeListener(_0x65a78,_0x34db2e){return function(){ChatMessageEvents['removeListener'](_0x65a78,_0x34db2e);};}exports[_0xc3c6('0x4')]=function(_0x4a2ca1){for(var _0xe7731e=0x0,_0x4d7ae6=events['length'];_0xe7731e<_0x4d7ae6;_0xe7731e++){var _0x4aed87=events[_0xe7731e];var _0x5185c3=createListener('chatMessage:'+_0x4aed87,_0x4a2ca1);ChatMessageEvents['on'](_0x4aed87,_0x5185c3);}}; \ No newline at end of file +var _0x49c4=['chatMessage:','./chatMessage.events','remove','update','emit','register','length'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x49c4,0x9b));var _0x449c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x49c4[_0x2641f9];return _0x585741;};'use strict';var ChatMessageEvents=require(_0x449c('0x0'));var events=['save',_0x449c('0x1'),_0x449c('0x2')];function createListener(_0x17bf65,_0x1d60ee){return function(_0x2646ac){_0x1d60ee[_0x449c('0x3')](_0x17bf65,_0x2646ac);};}function removeListener(_0x23314e,_0x5b564c){return function(){ChatMessageEvents['removeListener'](_0x23314e,_0x5b564c);};}exports[_0x449c('0x4')]=function(_0x442e56){for(var _0x12586c=0x0,_0x2db09a=events[_0x449c('0x5')];_0x12586c<_0x2db09a;_0x12586c++){var _0x43cb0e=events[_0x12586c];var _0x3e6354=createListener(_0x449c('0x6')+_0x43cb0e,_0x442e56);ChatMessageEvents['on'](_0x43cb0e,_0x3e6354);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 4f07a68..08e839d 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 _0xdb38=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','/:id/accept','/:id/reject','reject','destroy'];(function(_0x218e87,_0x4cb35c){var _0x447102=function(_0x18ba28){while(--_0x18ba28){_0x218e87['push'](_0x218e87['shift']());}};_0x447102(++_0x4cb35c);}(_0xdb38,0xdc));var _0x8db3=function(_0x39f5d9,_0x580829){_0x39f5d9=_0x39f5d9-0x0;var _0x5ad2a5=_0xdb38[_0x39f5d9];return _0x5ad2a5;};'use strict';var multer=require('multer');var util=require(_0x8db3('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8db3('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x8db3('0x2'));var interaction=require(_0x8db3('0x3'));var config=require(_0x8db3('0x4'));var controller=require(_0x8db3('0x5'));router['get']('/',auth[_0x8db3('0x6')](),controller[_0x8db3('0x7')]);router[_0x8db3('0x8')](_0x8db3('0x9'),auth[_0x8db3('0x6')](),controller['describe']);router[_0x8db3('0x8')](_0x8db3('0xa'),auth['isAuthenticated'](),controller[_0x8db3('0xb')]);router[_0x8db3('0xc')]('/',auth[_0x8db3('0x6')](),interaction[_0x8db3('0xd')](_0x8db3('0xe'),_0x8db3('0xf')),controller['create']);router[_0x8db3('0x10')](_0x8db3('0xa'),controller[_0x8db3('0x11')]);router[_0x8db3('0x10')](_0x8db3('0x12'),auth[_0x8db3('0x6')](),controller['accept']);router[_0x8db3('0x10')](_0x8db3('0x13'),auth['isAuthenticated'](),controller[_0x8db3('0x14')]);router['delete']('/:id',auth[_0x8db3('0x6')](),controller[_0x8db3('0x15')]);module['exports']=router; \ No newline at end of file +var _0x95b9=['reject','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept'];(function(_0x21852b,_0x252996){var _0x369e2f=function(_0x58974a){while(--_0x58974a){_0x21852b['push'](_0x21852b['shift']());}};_0x369e2f(++_0x252996);}(_0x95b9,0xc1));var _0x995b=function(_0x5a5f4a,_0x38b29c){_0x5a5f4a=_0x5a5f4a-0x0;var _0x5cec38=_0x95b9[_0x5a5f4a];return _0x5cec38;};'use strict';var multer=require('multer');var util=require(_0x995b('0x0'));var path=require(_0x995b('0x1'));var timeout=require('connect-timeout');var express=require(_0x995b('0x2'));var router=express[_0x995b('0x3')]();var fs_extra=require(_0x995b('0x4'));var auth=require(_0x995b('0x5'));var interaction=require(_0x995b('0x6'));var config=require('../../config/environment');var controller=require(_0x995b('0x7'));router[_0x995b('0x8')]('/',auth[_0x995b('0x9')](),controller['index']);router[_0x995b('0x8')](_0x995b('0xa'),auth[_0x995b('0x9')](),controller[_0x995b('0xb')]);router[_0x995b('0x8')](_0x995b('0xc'),auth[_0x995b('0x9')](),controller[_0x995b('0xd')]);router[_0x995b('0xe')]('/',auth['isAuthenticated'](),interaction[_0x995b('0xf')](_0x995b('0x10'),_0x995b('0x11')),controller[_0x995b('0x12')]);router[_0x995b('0x13')](_0x995b('0xc'),controller[_0x995b('0x14')]);router[_0x995b('0x13')](_0x995b('0x15'),auth[_0x995b('0x9')](),controller[_0x995b('0x16')]);router['put']('/:id/reject',auth[_0x995b('0x9')](),controller[_0x995b('0x17')]);router[_0x995b('0x18')](_0x995b('0xc'),auth['isAuthenticated'](),controller[_0x995b('0x19')]);module[_0x995b('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 91bd948..de44d8d 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['medium','TEXT','exports'];(function(_0x553a44,_0xfdeec1){var _0x1788f0=function(_0x2b2a59){while(--_0x2b2a59){_0x553a44['push'](_0x553a44['shift']());}};_0x1788f0(++_0xfdeec1);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0b0e,0x187));var _0xe0b0=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0b0e[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b4e8587..ece8cb4 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x364530,_0x352a43){var _0xd62457=function(_0x4c0ec3){while(--_0x4c0ec3){_0x364530['push'](_0x364530['shift']());}};_0xd62457(++_0x352a43);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x7a54,0x106));var _0x47a5=function(_0x491320,_0x2992f0){_0x491320=_0x491320-0x0;var _0x3de290=_0x7a54[_0x491320];return _0x3de290;};'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 diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index a8039cc..1934637 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 _0xa478=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x190681,_0x590f58){var _0x4f2ada=function(_0x4556db){while(--_0x4556db){_0x190681['push'](_0x190681['shift']());}};_0x4f2ada(++_0x590f58);}(_0xa478,0x1ea));var _0x8a47=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0xa478[_0x444e8b];return _0x35eb37;};'use strict';var EventEmitter=require(_0x8a47('0x0'));var ChatOfflineMessage=require(_0x8a47('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x8a47('0x2')](0x0);var events={'afterCreate':_0x8a47('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b3b1c){return function(_0x3b37a2,_0x5a583a,_0xc3b95c){ChatOfflineMessageEvents[_0x8a47('0x4')](_0x3b3b1c+':'+_0x3b37a2['id'],_0x3b37a2);ChatOfflineMessageEvents[_0x8a47('0x4')](_0x3b3b1c,_0x3b37a2);_0xc3b95c(null);};}for(var e in events){if(events[_0x8a47('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x8a47('0x6')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x8591=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x45de85,_0x551d79){var _0x56d89d=function(_0x420e56){while(--_0x420e56){_0x45de85['push'](_0x45de85['shift']());}};_0x56d89d(++_0x551d79);}(_0x8591,0x1ec));var _0x1859=function(_0x51e3e5,_0x255f82){_0x51e3e5=_0x51e3e5-0x0;var _0x117d19=_0x8591[_0x51e3e5];return _0x117d19;};'use strict';var EventEmitter=require(_0x1859('0x0'));var ChatOfflineMessage=require(_0x1859('0x1'))['db'][_0x1859('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1859('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1859('0x4'),'afterDestroy':_0x1859('0x5')};function emitEvent(_0x3f27f1){return function(_0x18633f,_0x5c9dbf,_0x20e51f){ChatOfflineMessageEvents['emit'](_0x3f27f1+':'+_0x18633f['id'],_0x18633f);ChatOfflineMessageEvents[_0x1859('0x6')](_0x3f27f1,_0x18633f);_0x20e51f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x1859('0x7')](e,emitEvent(event));}}module[_0x1859('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8fd2de5..1b28419 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 _0xdca3=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0xe84bc,_0x4d40c1){var _0x25ec31=function(_0x2beacc){while(--_0x2beacc){_0xe84bc['push'](_0xe84bc['shift']());}};_0x25ec31(++_0x4d40c1);}(_0xdca3,0x190));var _0x3dca=function(_0x167789,_0x5b5b5b){_0x167789=_0x167789-0x0;var _0x4ca481=_0xdca3[_0x167789];return _0x4ca481;};'use strict';var attributes=require(_0x3dca('0x0'));module[_0x3dca('0x1')]=function(_0x1e4ee4){return _0x1e4ee4[_0x3dca('0x2')](_0x3dca('0x3'),attributes,{'tableName':_0x3dca('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3dca('0x5'),'collate':_0x3dca('0x6')});}; \ No newline at end of file +var _0xd165=['utf8mb4','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x5c68c7,_0x54ba85){var _0x4a94fc=function(_0x2fdd55){while(--_0x2fdd55){_0x5c68c7['push'](_0x5c68c7['shift']());}};_0x4a94fc(++_0x54ba85);}(_0xd165,0x1d7));var _0x5d16=function(_0x3834b3,_0x15377b){_0x3834b3=_0x3834b3-0x0;var _0x180b47=_0xd165[_0x3834b3];return _0x180b47;};'use strict';var attributes=require(_0x5d16('0x0'));module['exports']=function(_0x216c21){return _0x216c21[_0x5d16('0x1')](_0x5d16('0x2'),attributes,{'tableName':_0x5d16('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5d16('0x4'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0b0585a..14728a5 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 _0x0c92=['../../config/logger','../../config/environment','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x33096b,_0x4a7720){var _0x4cd3d4=function(_0x715641){while(--_0x715641){_0x33096b['push'](_0x33096b['shift']());}};_0x4cd3d4(++_0x4a7720);}(_0x0c92,0x1af));var _0x20c9=function(_0x451e44,_0x2a4226){_0x451e44=_0x451e44-0x0;var _0x58f6ca=_0x0c92[_0x451e44];return _0x58f6ca;};'use strict';var _=require(_0x20c9('0x0'));var util=require(_0x20c9('0x1'));var moment=require('moment');var BPromise=require(_0x20c9('0x2'));var rs=require(_0x20c9('0x3'));var fs=require('fs');var Redis=require(_0x20c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20c9('0x5'));var logger=require(_0x20c9('0x6'))('rpc');var config=require(_0x20c9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b8048,_0x3cb4c7,_0x32cebf){return new BPromise(function(_0x19c783,_0x1f6ac9){return client['request'](_0x2b8048,_0x32cebf)[_0x20c9('0x8')](function(_0x34a2c2){logger[_0x20c9('0x9')](_0x20c9('0xa'),_0x3cb4c7,_0x20c9('0xb'));logger['debug'](_0x20c9('0xc'),_0x3cb4c7,_0x20c9('0xb'),JSON[_0x20c9('0xd')](_0x34a2c2));if(_0x34a2c2[_0x20c9('0xe')]){if(_0x34a2c2['error'][_0x20c9('0xf')]===0x1f4){logger[_0x20c9('0xe')](_0x20c9('0xa'),_0x3cb4c7,_0x34a2c2[_0x20c9('0xe')][_0x20c9('0x10')]);return _0x1f6ac9(_0x34a2c2[_0x20c9('0xe')][_0x20c9('0x10')]);}logger[_0x20c9('0xe')](_0x20c9('0xa'),_0x3cb4c7,_0x34a2c2[_0x20c9('0xe')][_0x20c9('0x10')]);return _0x19c783(_0x34a2c2[_0x20c9('0xe')][_0x20c9('0x10')]);}else{logger[_0x20c9('0x9')](_0x20c9('0xa'),_0x3cb4c7,'request\x20sent');_0x19c783(_0x34a2c2[_0x20c9('0x11')][_0x20c9('0x10')]);}})[_0x20c9('0x12')](function(_0x9f1ac6){logger[_0x20c9('0xe')](_0x20c9('0xa'),_0x3cb4c7,_0x9f1ac6);_0x1f6ac9(_0x9f1ac6);});});} \ No newline at end of file +var _0x2b6d=['then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x21449a,_0x2b8522){var _0xc452c=function(_0x2d9169){while(--_0x2d9169){_0x21449a['push'](_0x21449a['shift']());}};_0xc452c(++_0x2b8522);}(_0x2b6d,0x1d6));var _0xd2b6=function(_0x467438,_0x257f02){_0x467438=_0x467438-0x0;var _0xeef87a=_0x2b6d[_0x467438];return _0xeef87a;};'use strict';var _=require(_0xd2b6('0x0'));var util=require(_0xd2b6('0x1'));var moment=require(_0xd2b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2b6('0x3'));var fs=require('fs');var Redis=require(_0xd2b6('0x4'));var db=require(_0xd2b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2b6('0x6'))(_0xd2b6('0x7'));var config=require(_0xd2b6('0x8'));var jayson=require(_0xd2b6('0x9'));var client=jayson[_0xd2b6('0xa')][_0xd2b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af77e,_0x11ffc6,_0x2f43bb){return new BPromise(function(_0x37ba35,_0x577d34){return client[_0xd2b6('0xc')](_0x3af77e,_0x2f43bb)[_0xd2b6('0xd')](function(_0x3f09c8){logger[_0xd2b6('0xe')](_0xd2b6('0xf'),_0x11ffc6,_0xd2b6('0x10'));logger[_0xd2b6('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x11ffc6,_0xd2b6('0x10'),JSON[_0xd2b6('0x12')](_0x3f09c8));if(_0x3f09c8[_0xd2b6('0x13')]){if(_0x3f09c8[_0xd2b6('0x13')][_0xd2b6('0x14')]===0x1f4){logger[_0xd2b6('0x13')](_0xd2b6('0xf'),_0x11ffc6,_0x3f09c8[_0xd2b6('0x13')][_0xd2b6('0x15')]);return _0x577d34(_0x3f09c8['error'][_0xd2b6('0x15')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x11ffc6,_0x3f09c8['error'][_0xd2b6('0x15')]);return _0x37ba35(_0x3f09c8[_0xd2b6('0x13')][_0xd2b6('0x15')]);}else{logger[_0xd2b6('0xe')](_0xd2b6('0xf'),_0x11ffc6,'request\x20sent');_0x37ba35(_0x3f09c8['result'][_0xd2b6('0x15')]);}})[_0xd2b6('0x16')](function(_0x4b73eb){logger[_0xd2b6('0x13')](_0xd2b6('0xf'),_0x11ffc6,_0x4b73eb);_0x577d34(_0x4b73eb);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 4d8333e..7e466e7 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 _0xc2e6=['isAuthenticated','index','/describe','show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller'];(function(_0xf7f60a,_0x15f736){var _0x2567ad=function(_0x396850){while(--_0x396850){_0xf7f60a['push'](_0xf7f60a['shift']());}};_0x2567ad(++_0x15f736);}(_0xc2e6,0xf3));var _0x6c2e=function(_0x3b045b,_0x401ddc){_0x3b045b=_0x3b045b-0x0;var _0x278d9e=_0xc2e6[_0x3b045b];return _0x278d9e;};'use strict';var multer=require('multer');var util=require(_0x6c2e('0x0'));var path=require(_0x6c2e('0x1'));var timeout=require(_0x6c2e('0x2'));var express=require('express');var router=express[_0x6c2e('0x3')]();var fs_extra=require(_0x6c2e('0x4'));var auth=require(_0x6c2e('0x5'));var interaction=require(_0x6c2e('0x6'));var config=require(_0x6c2e('0x7'));var controller=require(_0x6c2e('0x8'));router['get']('/',auth[_0x6c2e('0x9')](),controller[_0x6c2e('0xa')]);router['get'](_0x6c2e('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x6c2e('0x9')](),controller[_0x6c2e('0xc')]);router[_0x6c2e('0xd')]('/',auth[_0x6c2e('0x9')](),controller[_0x6c2e('0xe')]);router[_0x6c2e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x6c2e('0x10')]);router[_0x6c2e('0x11')](_0x6c2e('0x12'),auth['isAuthenticated'](),controller[_0x6c2e('0x13')]);module[_0x6c2e('0x14')]=router; \ No newline at end of file +var _0x980d=['delete','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x1cc92c,_0x3c630a){var _0x2cbe84=function(_0x5aaa97){while(--_0x5aaa97){_0x1cc92c['push'](_0x1cc92c['shift']());}};_0x2cbe84(++_0x3c630a);}(_0x980d,0xec));var _0xd980=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x980d[_0x1ad926];return _0x1b81dc;};'use strict';var multer=require('multer');var util=require(_0xd980('0x0'));var path=require(_0xd980('0x1'));var timeout=require('connect-timeout');var express=require(_0xd980('0x2'));var router=express['Router']();var fs_extra=require(_0xd980('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd980('0x4'));var config=require(_0xd980('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0xd980('0x6')]('/',auth[_0xd980('0x7')](),controller[_0xd980('0x8')]);router[_0xd980('0x6')](_0xd980('0x9'),auth[_0xd980('0x7')](),controller[_0xd980('0xa')]);router[_0xd980('0x6')](_0xd980('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd980('0xc')]('/',auth[_0xd980('0x7')](),controller[_0xd980('0xd')]);router[_0xd980('0xe')]('/:id',auth[_0xd980('0x7')](),controller[_0xd980('0xf')]);router[_0xd980('0x10')](_0xd980('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd980('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index bed30eb..2d78fde 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 _0xf05d=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0x353fc0,_0xec6aad){var _0x5b180b=function(_0x135a98){while(--_0x135a98){_0x353fc0['push'](_0x353fc0['shift']());}};_0x5b180b(++_0xec6aad);}(_0xf05d,0xca));var _0xdf05=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xf05d[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xdf05('0x0'));module[_0xdf05('0x1')]={'name':{'type':Sequelize[_0xdf05('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdf05('0x3')](_0xdf05('0x4'),_0xdf05('0x5')),'defaultValue':_0xdf05('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdf05('0x6')]}}; \ No newline at end of file +var _0x3454=['mouseOver','timeout','sequelize','exports','STRING','ENUM'];(function(_0x4fb184,_0x343308){var _0x52a280=function(_0x5354cb){while(--_0x5354cb){_0x4fb184['push'](_0x4fb184['shift']());}};_0x52a280(++_0x343308);}(_0x3454,0x122));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4345('0x0'));module[_0x4345('0x1')]={'name':{'type':Sequelize[_0x4345('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4345('0x3')](_0x4345('0x4'),_0x4345('0x5')),'defaultValue':_0x4345('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1c6148a..d2271bf 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 _0xf452=['catch','create','body','update','destroy','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','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','name','send','show','params','model','ChatProactiveAction','query','keys','attributes','intersection','fields','include','merge','options','find'];(function(_0x4ffb94,_0x372d75){var _0x2f5789=function(_0x3d3b9c){while(--_0x3d3b9c){_0x4ffb94['push'](_0x4ffb94['shift']());}};_0x2f5789(++_0x372d75);}(_0xf452,0x13b));var _0x2f45=function(_0x35fe8f,_0x369907){_0x35fe8f=_0x35fe8f-0x0;var _0x374cc2=_0xf452[_0x35fe8f];return _0x374cc2;};'use strict';var emlformat=require(_0x2f45('0x0'));var rimraf=require(_0x2f45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2f45('0x2'));var rp=require(_0x2f45('0x3'));var moment=require(_0x2f45('0x4'));var BPromise=require(_0x2f45('0x5'));var Mustache=require(_0x2f45('0x6'));var util=require(_0x2f45('0x7'));var path=require(_0x2f45('0x8'));var sox=require(_0x2f45('0x9'));var csv=require(_0x2f45('0xa'));var ejs=require(_0x2f45('0xb'));var fs=require('fs');var fs_extra=require(_0x2f45('0xc'));var _=require(_0x2f45('0xd'));var squel=require(_0x2f45('0xe'));var crypto=require(_0x2f45('0xf'));var jsforce=require(_0x2f45('0x10'));var deskjs=require(_0x2f45('0x11'));var toCsv=require(_0x2f45('0xa'));var querystring=require(_0x2f45('0x12'));var Papa=require(_0x2f45('0x13'));var Redis=require(_0x2f45('0x14'));var authService=require(_0x2f45('0x15'));var qs=require(_0x2f45('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2f45('0x17'))(_0x2f45('0x18'));var utils=require(_0x2f45('0x19'));var config=require(_0x2f45('0x1a'));var licenseUtil=require(_0x2f45('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b367,_0x55d108){_0x55d108=_0x55d108||0xcc;return function(_0x33534){if(_0x33534){return _0x14b367[_0x2f45('0x1c')](_0x55d108);}return _0x14b367['status'](_0x55d108)[_0x2f45('0x1d')]();};}function respondWithResult(_0x2b43e7,_0x25c318){_0x25c318=_0x25c318||0xc8;return function(_0x49e130){if(_0x49e130){return _0x2b43e7[_0x2f45('0x1e')](_0x25c318)['json'](_0x49e130);}};}function respondWithFilteredResult(_0x70b84b,_0x469fbe){return function(_0x5bd134){if(_0x5bd134){var _0x2ac0bf=typeof _0x469fbe[_0x2f45('0x1f')]===_0x2f45('0x20')&&typeof _0x469fbe['limit']==='undefined';var _0x58b92e=_0x5bd134[_0x2f45('0x21')];var _0xe4db0=_0x2ac0bf?0x0:_0x469fbe[_0x2f45('0x1f')];var _0x103542=_0x2ac0bf?_0x5bd134['count']:_0x469fbe[_0x2f45('0x1f')]+_0x469fbe[_0x2f45('0x22')];var _0x2cf411;if(_0x103542>=_0x58b92e){_0x103542=_0x58b92e;_0x2cf411=0xc8;}else{_0x2cf411=0xce;}_0x70b84b[_0x2f45('0x1e')](_0x2cf411);return _0x70b84b[_0x2f45('0x23')](_0x2f45('0x24'),_0xe4db0+'-'+_0x103542+'/'+_0x58b92e)['json'](_0x5bd134);}return null;};}function patchUpdates(_0x54683c){return function(_0x46d98c){try{jsonpatch[_0x2f45('0x25')](_0x46d98c,_0x54683c,!![]);}catch(_0x3d64b4){return BPromise[_0x2f45('0x26')](_0x3d64b4);}return _0x46d98c[_0x2f45('0x27')]();};}function saveUpdates(_0x303dbf,_0x322978){return function(_0x393ecc){if(_0x393ecc){return _0x393ecc['update'](_0x303dbf)[_0x2f45('0x28')](function(_0x190636){return _0x190636;});}return null;};}function removeEntity(_0x4cfd00,_0x7ff562){return function(_0x3018fe){if(_0x3018fe){return _0x3018fe['destroy']()[_0x2f45('0x28')](function(){_0x4cfd00[_0x2f45('0x1e')](0xcc)[_0x2f45('0x1d')]();});}};}function handleEntityNotFound(_0x3d8f12,_0x1c1c3e){return function(_0x4fc861){if(!_0x4fc861){_0x3d8f12['sendStatus'](0x194);}return _0x4fc861;};}function handleError(_0x3b533d,_0x4abcee){_0x4abcee=_0x4abcee||0x1f4;return function(_0x4a5df2){logger[_0x2f45('0x29')](_0x4a5df2['stack']);if(_0x4a5df2[_0x2f45('0x2a')]){delete _0x4a5df2[_0x2f45('0x2a')];}_0x3b533d[_0x2f45('0x1e')](_0x4abcee)[_0x2f45('0x2b')](_0x4a5df2);};}exports[_0x2f45('0x2c')]=function(_0x2b10cf,_0x2f3ecc){var _0x38eb3b={'raw':!![],'where':{'id':_0x2b10cf[_0x2f45('0x2d')]['id']}},_0x531bc7={};_0x531bc7[_0x2f45('0x2e')]=_['keys'](db[_0x2f45('0x2f')]['rawAttributes']);_0x531bc7[_0x2f45('0x30')]=_[_0x2f45('0x31')](_0x2b10cf[_0x2f45('0x30')]);_0x531bc7['filters']=_['intersection'](_0x531bc7[_0x2f45('0x2e')],_0x531bc7['query']);_0x38eb3b[_0x2f45('0x32')]=_[_0x2f45('0x33')](_0x531bc7['model'],qs[_0x2f45('0x34')](_0x2b10cf[_0x2f45('0x30')][_0x2f45('0x34')]));_0x38eb3b[_0x2f45('0x32')]=_0x38eb3b[_0x2f45('0x32')]['length']?_0x38eb3b[_0x2f45('0x32')]:_0x531bc7[_0x2f45('0x2e')];if(_0x2b10cf[_0x2f45('0x30')]['includeAll']){_0x38eb3b[_0x2f45('0x35')]=[{'all':!![]}];}_0x38eb3b=_[_0x2f45('0x36')]({},_0x38eb3b,_0x2b10cf[_0x2f45('0x37')]);return db[_0x2f45('0x2f')][_0x2f45('0x38')](_0x38eb3b)[_0x2f45('0x28')](handleEntityNotFound(_0x2f3ecc,null))[_0x2f45('0x28')](respondWithResult(_0x2f3ecc,null))[_0x2f45('0x39')](handleError(_0x2f3ecc,null));};exports[_0x2f45('0x3a')]=function(_0x4eb9d3,_0x53f884){return db[_0x2f45('0x2f')][_0x2f45('0x3a')](_0x4eb9d3[_0x2f45('0x3b')],{})[_0x2f45('0x28')](respondWithResult(_0x53f884,0xc9))[_0x2f45('0x39')](handleError(_0x53f884,null));};exports[_0x2f45('0x3c')]=function(_0x5cb0dd,_0x1b4bb4){if(_0x5cb0dd[_0x2f45('0x3b')]['id']){delete _0x5cb0dd[_0x2f45('0x3b')]['id'];}return db['ChatProactiveAction'][_0x2f45('0x38')]({'where':{'id':_0x5cb0dd[_0x2f45('0x2d')]['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0x1b4bb4,null))['then'](saveUpdates(_0x5cb0dd[_0x2f45('0x3b')],null))[_0x2f45('0x28')](respondWithResult(_0x1b4bb4,null))[_0x2f45('0x39')](handleError(_0x1b4bb4,null));};exports[_0x2f45('0x3d')]=function(_0x9196ad,_0x482984){return db[_0x2f45('0x2f')][_0x2f45('0x38')]({'where':{'id':_0x9196ad[_0x2f45('0x2d')]['id']}})[_0x2f45('0x28')](handleEntityNotFound(_0x482984,null))[_0x2f45('0x28')](removeEntity(_0x482984,null))['catch'](handleError(_0x482984,null));}; \ No newline at end of file +var _0x3148=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3bbf08,_0x484ae7){var _0x1f308d=function(_0x38f13d){while(--_0x38f13d){_0x3bbf08['push'](_0x3bbf08['shift']());}};_0x1f308d(++_0x484ae7);}(_0x3148,0x1d3));var _0x8314=function(_0x43c732,_0x2befdb){_0x43c732=_0x43c732-0x0;var _0x5dfee3=_0x3148[_0x43c732];return _0x5dfee3;};'use strict';var emlformat=require(_0x8314('0x0'));var rimraf=require(_0x8314('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8314('0x2'));var rp=require(_0x8314('0x3'));var moment=require(_0x8314('0x4'));var BPromise=require(_0x8314('0x5'));var Mustache=require('mustache');var util=require(_0x8314('0x6'));var path=require(_0x8314('0x7'));var sox=require(_0x8314('0x8'));var csv=require(_0x8314('0x9'));var ejs=require(_0x8314('0xa'));var fs=require('fs');var fs_extra=require(_0x8314('0xb'));var _=require(_0x8314('0xc'));var squel=require('squel');var crypto=require(_0x8314('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8314('0xe'));var toCsv=require(_0x8314('0x9'));var querystring=require(_0x8314('0xf'));var Papa=require(_0x8314('0x10'));var Redis=require(_0x8314('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8314('0x12'));var hardwareService=require(_0x8314('0x13'));var logger=require(_0x8314('0x14'))(_0x8314('0x15'));var utils=require('../../config/utils');var config=require(_0x8314('0x16'));var licenseUtil=require(_0x8314('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f8231,_0x55e770){_0x55e770=_0x55e770||0xcc;return function(_0x5f17d8){if(_0x5f17d8){return _0x2f8231[_0x8314('0x18')](_0x55e770);}return _0x2f8231[_0x8314('0x19')](_0x55e770)[_0x8314('0x1a')]();};}function respondWithResult(_0x24c55c,_0x49587c){_0x49587c=_0x49587c||0xc8;return function(_0x9e90a6){if(_0x9e90a6){return _0x24c55c[_0x8314('0x19')](_0x49587c)[_0x8314('0x1b')](_0x9e90a6);}};}function respondWithFilteredResult(_0x136e09,_0x2c459e){return function(_0x6a588a){if(_0x6a588a){var _0x579a15=typeof _0x2c459e['offset']===_0x8314('0x1c')&&typeof _0x2c459e[_0x8314('0x1d')]===_0x8314('0x1c');var _0x570db3=_0x6a588a[_0x8314('0x1e')];var _0x10e256=_0x579a15?0x0:_0x2c459e['offset'];var _0x1ade63=_0x579a15?_0x6a588a[_0x8314('0x1e')]:_0x2c459e['offset']+_0x2c459e[_0x8314('0x1d')];var _0x55053a;if(_0x1ade63>=_0x570db3){_0x1ade63=_0x570db3;_0x55053a=0xc8;}else{_0x55053a=0xce;}_0x136e09[_0x8314('0x19')](_0x55053a);return _0x136e09[_0x8314('0x1f')](_0x8314('0x20'),_0x10e256+'-'+_0x1ade63+'/'+_0x570db3)['json'](_0x6a588a);}return null;};}function patchUpdates(_0x4ead11){return function(_0x240f4b){try{jsonpatch[_0x8314('0x21')](_0x240f4b,_0x4ead11,!![]);}catch(_0xc37d84){return BPromise[_0x8314('0x22')](_0xc37d84);}return _0x240f4b[_0x8314('0x23')]();};}function saveUpdates(_0x1b1579,_0x2e9052){return function(_0x9e2c24){if(_0x9e2c24){return _0x9e2c24[_0x8314('0x24')](_0x1b1579)[_0x8314('0x25')](function(_0x5c6fd1){return _0x5c6fd1;});}return null;};}function removeEntity(_0xf72fc9,_0x29535a){return function(_0x2b6183){if(_0x2b6183){return _0x2b6183[_0x8314('0x26')]()[_0x8314('0x25')](function(){_0xf72fc9['status'](0xcc)[_0x8314('0x1a')]();});}};}function handleEntityNotFound(_0x2405af,_0x3f3736){return function(_0x4b37de){if(!_0x4b37de){_0x2405af[_0x8314('0x18')](0x194);}return _0x4b37de;};}function handleError(_0x56a047,_0x4c55b1){_0x4c55b1=_0x4c55b1||0x1f4;return function(_0x30d0b2){logger['error'](_0x30d0b2[_0x8314('0x27')]);if(_0x30d0b2['name']){delete _0x30d0b2[_0x8314('0x28')];}_0x56a047[_0x8314('0x19')](_0x4c55b1)[_0x8314('0x29')](_0x30d0b2);};}exports[_0x8314('0x2a')]=function(_0x40efa3,_0x7acf62){var _0x56f1c1={'raw':!![],'where':{'id':_0x40efa3[_0x8314('0x2b')]['id']}},_0x59fbfc={};_0x59fbfc[_0x8314('0x2c')]=_[_0x8314('0x2d')](db['ChatProactiveAction'][_0x8314('0x2e')]);_0x59fbfc[_0x8314('0x2f')]=_[_0x8314('0x2d')](_0x40efa3[_0x8314('0x2f')]);_0x59fbfc[_0x8314('0x30')]=_[_0x8314('0x31')](_0x59fbfc[_0x8314('0x2c')],_0x59fbfc[_0x8314('0x2f')]);_0x56f1c1[_0x8314('0x32')]=_[_0x8314('0x31')](_0x59fbfc[_0x8314('0x2c')],qs[_0x8314('0x33')](_0x40efa3[_0x8314('0x2f')][_0x8314('0x33')]));_0x56f1c1[_0x8314('0x32')]=_0x56f1c1[_0x8314('0x32')][_0x8314('0x34')]?_0x56f1c1['attributes']:_0x59fbfc['model'];if(_0x40efa3[_0x8314('0x2f')][_0x8314('0x35')]){_0x56f1c1['include']=[{'all':!![]}];}_0x56f1c1=_['merge']({},_0x56f1c1,_0x40efa3[_0x8314('0x36')]);return db[_0x8314('0x37')][_0x8314('0x38')](_0x56f1c1)[_0x8314('0x25')](handleEntityNotFound(_0x7acf62,null))['then'](respondWithResult(_0x7acf62,null))[_0x8314('0x39')](handleError(_0x7acf62,null));};exports[_0x8314('0x3a')]=function(_0x3be94c,_0x3637f5){return db['ChatProactiveAction'][_0x8314('0x3a')](_0x3be94c[_0x8314('0x3b')],{})[_0x8314('0x25')](respondWithResult(_0x3637f5,0xc9))['catch'](handleError(_0x3637f5,null));};exports[_0x8314('0x24')]=function(_0x480d81,_0x1194ff){if(_0x480d81[_0x8314('0x3b')]['id']){delete _0x480d81['body']['id'];}return db['ChatProactiveAction'][_0x8314('0x38')]({'where':{'id':_0x480d81['params']['id']}})[_0x8314('0x25')](handleEntityNotFound(_0x1194ff,null))['then'](saveUpdates(_0x480d81[_0x8314('0x3b')],null))[_0x8314('0x25')](respondWithResult(_0x1194ff,null))['catch'](handleError(_0x1194ff,null));};exports[_0x8314('0x26')]=function(_0x83e57a,_0x207afd){return db[_0x8314('0x37')][_0x8314('0x38')]({'where':{'id':_0x83e57a[_0x8314('0x2b')]['id']}})[_0x8314('0x25')](handleEntityNotFound(_0x207afd,null))[_0x8314('0x25')](removeEntity(_0x207afd,null))[_0x8314('0x39')](handleError(_0x207afd,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 0f29e6c..1b49d5c 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 _0xfb28=['api','moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger'];(function(_0x5aee70,_0x130b9e){var _0x474afb=function(_0x30ee5e){while(--_0x30ee5e){_0x5aee70['push'](_0x5aee70['shift']());}};_0x474afb(++_0x130b9e);}(_0xfb28,0xda));var _0x8fb2=function(_0x3b08b7,_0x22d450){_0x3b08b7=_0x3b08b7-0x0;var _0x224515=_0xfb28[_0x3b08b7];return _0x224515;};'use strict';var _=require(_0x8fb2('0x0'));var util=require(_0x8fb2('0x1'));var logger=require(_0x8fb2('0x2'))(_0x8fb2('0x3'));var moment=require(_0x8fb2('0x4'));var BPromise=require(_0x8fb2('0x5'));var rp=require(_0x8fb2('0x6'));var fs=require('fs');var path=require(_0x8fb2('0x7'));var rimraf=require('rimraf');var config=require(_0x8fb2('0x8'));var attributes=require(_0x8fb2('0x9'));module[_0x8fb2('0xa')]=function(_0x1af9f5,_0x1ec678){return _0x1af9f5['define'](_0x8fb2('0xb'),attributes,{'tableName':_0x8fb2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x626e=['./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x626e,0x109));var _0xe626=function(_0x199082,_0x1746c5){_0x199082=_0x199082-0x0;var _0x175da9=_0x626e[_0x199082];return _0x175da9;};'use strict';var _=require(_0xe626('0x0'));var util=require('util');var logger=require(_0xe626('0x1'))(_0xe626('0x2'));var moment=require(_0xe626('0x3'));var BPromise=require(_0xe626('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe626('0x5'));var rimraf=require(_0xe626('0x6'));var config=require(_0xe626('0x7'));var attributes=require(_0xe626('0x8'));module[_0xe626('0x9')]=function(_0x2783c6,_0x290e52){return _0x2783c6[_0xe626('0xa')](_0xe626('0xb'),attributes,{'tableName':_0xe626('0xc'),'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 ecbe154..6623c8d 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 _0x5312=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','request\x20sent','debug','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0x5312,0x153));var _0x2531=function(_0x2ed412,_0x33c7f7){_0x2ed412=_0x2ed412-0x0;var _0x159a96=_0x5312[_0x2ed412];return _0x159a96;};'use strict';var _=require(_0x2531('0x0'));var util=require('util');var moment=require(_0x2531('0x1'));var BPromise=require(_0x2531('0x2'));var rs=require(_0x2531('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2531('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2531('0x5'))(_0x2531('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2531('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35edd5,_0x224fc5,_0x2709e9){return new BPromise(function(_0xb5d313,_0x57b505){return client[_0x2531('0x8')](_0x35edd5,_0x2709e9)[_0x2531('0x9')](function(_0x1bcfb2){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x224fc5,_0x2531('0xa'));logger[_0x2531('0xb')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x224fc5,_0x2531('0xa'),JSON[_0x2531('0xc')](_0x1bcfb2));if(_0x1bcfb2[_0x2531('0xd')]){if(_0x1bcfb2['error'][_0x2531('0xe')]===0x1f4){logger['error'](_0x2531('0xf'),_0x224fc5,_0x1bcfb2['error'][_0x2531('0x10')]);return _0x57b505(_0x1bcfb2[_0x2531('0xd')][_0x2531('0x10')]);}logger['error'](_0x2531('0xf'),_0x224fc5,_0x1bcfb2[_0x2531('0xd')]['message']);return _0xb5d313(_0x1bcfb2[_0x2531('0xd')]['message']);}else{logger[_0x2531('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x224fc5,_0x2531('0xa'));_0xb5d313(_0x1bcfb2[_0x2531('0x12')][_0x2531('0x10')]);}})[_0x2531('0x13')](function(_0x3b0fe9){logger['error'](_0x2531('0xf'),_0x224fc5,_0x3b0fe9);_0x57b505(_0x3b0fe9);});});} \ No newline at end of file +var _0x6d77=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6d77,0x17d));var _0x76d7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6d77[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x76d7('0x0'));var util=require(_0x76d7('0x1'));var moment=require(_0x76d7('0x2'));var BPromise=require(_0x76d7('0x3'));var rs=require(_0x76d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76d7('0x5'))['db'];var utils=require(_0x76d7('0x6'));var logger=require(_0x76d7('0x7'))(_0x76d7('0x8'));var config=require(_0x76d7('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x76d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a02f1,_0x34344a,_0x41959c){return new BPromise(function(_0x1e3bf5,_0x5c4b2e){return client[_0x76d7('0xb')](_0x3a02f1,_0x41959c)[_0x76d7('0xc')](function(_0x217fbe){logger[_0x76d7('0xd')](_0x76d7('0xe'),_0x34344a,'request\x20sent');logger[_0x76d7('0xf')](_0x76d7('0x10'),_0x34344a,_0x76d7('0x11'),JSON[_0x76d7('0x12')](_0x217fbe));if(_0x217fbe[_0x76d7('0x13')]){if(_0x217fbe[_0x76d7('0x13')]['code']===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x34344a,_0x217fbe[_0x76d7('0x13')][_0x76d7('0x14')]);return _0x5c4b2e(_0x217fbe[_0x76d7('0x13')][_0x76d7('0x14')]);}logger['error'](_0x76d7('0xe'),_0x34344a,_0x217fbe['error'][_0x76d7('0x14')]);return _0x1e3bf5(_0x217fbe['error']['message']);}else{logger[_0x76d7('0xd')](_0x76d7('0xe'),_0x34344a,_0x76d7('0x11'));_0x1e3bf5(_0x217fbe[_0x76d7('0x15')][_0x76d7('0x14')]);}})[_0x76d7('0x16')](function(_0x376181){logger[_0x76d7('0x13')](_0x76d7('0xe'),_0x34344a,_0x376181);_0x5c4b2e(_0x376181);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 3a7170e..831e7a5 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 _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x51f510,_0x6dcedd){var _0x1bcb9b=function(_0x1cd3ef){while(--_0x1cd3ef){_0x51f510['push'](_0x51f510['shift']());}};_0x1bcb9b(++_0x6dcedd);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5cf23c,_0x1966b4){_0x5cf23c=_0x5cf23c-0x0;var _0x48a580=_0xdbf5[_0x5cf23c];return _0x48a580;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file +var _0xabce=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','show','isAuthenticated','create','put'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xabce,0x103));var _0xeabc=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xabce[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0xeabc('0x8'),auth['isAuthenticated'](),controller[_0xeabc('0x9')]);router['post']('/',auth[_0xeabc('0xa')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/:id',auth[_0xeabc('0xa')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0x8'),auth[_0xeabc('0xa')](),controller[_0xeabc('0xf')]);module[_0xeabc('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b387f5e..8fd069e 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 _0xaf1a=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xaf1a,0x108));var _0xaaf1=function(_0x5bfb56,_0x3339e4){_0x5bfb56=_0x5bfb56-0x0;var _0x483265=_0xaf1a[_0x5bfb56];return _0x483265;};'use strict';var Sequelize=require(_0xaaf1('0x0'));module[_0xaaf1('0x1')]={'name':{'type':Sequelize[_0xaaf1('0x2')],'unique':_0xaaf1('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xaaf1('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaaf1('0x5')](_0xaaf1('0x6'),_0xaaf1('0x7'),_0xaaf1('0x8'))}}; \ No newline at end of file +var _0xddbe=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xddbe,0x13b));var _0xeddb=function(_0x12c0a4,_0x2a4749){_0x12c0a4=_0x12c0a4-0x0;var _0x19e5ad=_0xddbe[_0x12c0a4];return _0x19e5ad;};'use strict';var Sequelize=require(_0xeddb('0x0'));module[_0xeddb('0x1')]={'name':{'type':Sequelize[_0xeddb('0x2')],'unique':_0xeddb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xeddb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xeddb('0x5')](_0xeddb('0x6'),_0xeddb('0x7'),_0xeddb('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 5360d07..10d3a33 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 _0xdb63=['addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','count','limit','set','update','then','get','ChatQueues','destroy','name','send','index','map','ChatQueue','fieldName','type','key','getOptions','where','include','query','findAll','show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','length','hasOwnProperty','order','sort','filters','ChatQueueId','filter','UserChatQueue','User','agent','chatPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','Team','rawAttributes','pick','nolimit','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','forEach','emit','userChatQueue:save','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','every','TeamId','includes','all','value','isEmpty','removeAgents','userChatQueue:remove'];(function(_0x2f97d5,_0x285487){var _0x256716=function(_0x3a7726){while(--_0x3a7726){_0x2f97d5['push'](_0x2f97d5['shift']());}};_0x256716(++_0x285487);}(_0xdb63,0xf0));var _0x3db6=function(_0x21405c,_0x353008){_0x21405c=_0x21405c-0x0;var _0x4ee152=_0xdb63[_0x21405c];return _0x4ee152;};'use strict';var BPromise=require(_0x3db6('0x0'));var util=require(_0x3db6('0x1'));var _=require(_0x3db6('0x2'));var squel=require(_0x3db6('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x3db6('0x4'))(_0x3db6('0x5'));var config=require(_0x3db6('0x6'));var db=require('../../mysqldb')['db'];config[_0x3db6('0x7')]=_[_0x3db6('0x8')](config['redis'],{'host':_0x3db6('0x9'),'port':0x18eb});var socket=require(_0x3db6('0xa'))(new Redis(config[_0x3db6('0x7')]));require(_0x3db6('0xb'))[_0x3db6('0xc')](socket);function respondWithStatusCode(_0x2d9d61,_0x4f9b0f){_0x4f9b0f=_0x4f9b0f||0xcc;return function(_0x2dbb26){if(_0x2dbb26){return _0x2d9d61['sendStatus'](_0x4f9b0f);}return _0x2d9d61[_0x3db6('0xd')](_0x4f9b0f)[_0x3db6('0xe')]();};}function respondWithResult(_0x904d20,_0x20265e){_0x20265e=_0x20265e||0xc8;return function(_0x1f4c2a){if(_0x1f4c2a){return _0x904d20[_0x3db6('0xd')](_0x20265e)[_0x3db6('0xf')](_0x1f4c2a);}};}function respondWithFilteredResult(_0x22e3b4,_0x2317d8){return function(_0x28ade6){if(_0x28ade6){var _0x4093fc=typeof _0x2317d8[_0x3db6('0x10')]==='undefined'&&typeof _0x2317d8['limit']===_0x3db6('0x11');var _0x204c08=_0x28ade6['count'];var _0x54648f=_0x4093fc?0x0:_0x2317d8[_0x3db6('0x10')];var _0x2cd261=_0x4093fc?_0x28ade6[_0x3db6('0x12')]:_0x2317d8['offset']+_0x2317d8[_0x3db6('0x13')];var _0x33f038;if(_0x2cd261>=_0x204c08){_0x2cd261=_0x204c08;_0x33f038=0xc8;}else{_0x33f038=0xce;}_0x22e3b4[_0x3db6('0xd')](_0x33f038);return _0x22e3b4[_0x3db6('0x14')]('Content-Range',_0x54648f+'-'+_0x2cd261+'/'+_0x204c08)[_0x3db6('0xf')](_0x28ade6);}return null;};}function saveUpdates(_0x92bf0a){return function(_0x26d706){if(_0x26d706){return _0x26d706[_0x3db6('0x15')](_0x92bf0a)[_0x3db6('0x16')](function(_0x2ed696){return _0x2ed696;});}return null;};}function removeEntity(_0x229da3){return function(_0x52e7c8){if(_0x52e7c8){return _0x52e7c8['destroy']()[_0x3db6('0x16')](function(){var _0x181f92=_0x52e7c8[_0x3db6('0x17')]({'plain':!![]});var _0x4a0e1b=_0x3db6('0x18');return db['UserProfileResource'][_0x3db6('0x19')]({'where':{'type':_0x4a0e1b,'resourceId':_0x181f92['id']}})[_0x3db6('0x16')](function(){return _0x52e7c8;});})[_0x3db6('0x16')](function(){_0x229da3[_0x3db6('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59c70c){return function(_0x2a2f09){if(!_0x2a2f09){_0x59c70c['sendStatus'](0x194);}return _0x2a2f09;};}function handleError(_0x3946a9,_0x27aa32){_0x27aa32=_0x27aa32||0x1f4;return function(_0x16f597){logger['error'](_0x16f597['stack']);if(_0x16f597[_0x3db6('0x1a')]){delete _0x16f597[_0x3db6('0x1a')];}_0x3946a9[_0x3db6('0xd')](_0x27aa32)[_0x3db6('0x1b')](_0x16f597);};}exports[_0x3db6('0x1c')]=function(_0x2942a1,_0x35febc){var _0x3c45d6={};var _0x261f26={'count':0x0,'rows':[]};var _0x4f611d=_[_0x3db6('0x1d')](db[_0x3db6('0x1e')]['rawAttributes'],function(_0x5e686b){return{'name':_0x5e686b[_0x3db6('0x1f')],'type':_0x5e686b[_0x3db6('0x20')][_0x3db6('0x21')]};});_0x3c45d6=qs[_0x3db6('0x22')](_0x4f611d,_0x2942a1);var _0x31c1a8={'where':_0x3c45d6[_0x3db6('0x23')]};return db[_0x3db6('0x1e')]['count'](_0x31c1a8)['then'](function(_0x1be49d){_0x261f26[_0x3db6('0x12')]=_0x1be49d;_0x3c45d6['include']=qs[_0x3db6('0x24')](_0x2942a1[_0x3db6('0x25')]);return db[_0x3db6('0x1e')][_0x3db6('0x26')](_0x3c45d6);})['then'](function(_0x446f9f){_0x261f26['rows']=_0x446f9f;return _0x261f26;})[_0x3db6('0x16')](respondWithFilteredResult(_0x35febc,_0x3c45d6))['catch'](handleError(_0x35febc,null));};exports[_0x3db6('0x27')]=function(_0x31fb9d,_0x36d146){var _0x2945ef={'raw':!![],'where':{'id':_0x31fb9d[_0x3db6('0x28')]['id']}},_0x3feb79={};_0x3feb79[_0x3db6('0x29')]=_[_0x3db6('0x2a')](db['ChatQueue']['rawAttributes']);_0x3feb79[_0x3db6('0x25')]=_[_0x3db6('0x2a')](_0x31fb9d[_0x3db6('0x25')]);_0x3feb79['filters']=_[_0x3db6('0x2b')](_0x3feb79[_0x3db6('0x29')],_0x3feb79[_0x3db6('0x25')]);_0x2945ef[_0x3db6('0x2c')]=_[_0x3db6('0x2b')](_0x3feb79['model'],qs['fields'](_0x31fb9d['query'][_0x3db6('0x2d')]));_0x2945ef[_0x3db6('0x2c')]=_0x2945ef[_0x3db6('0x2c')]['length']?_0x2945ef['attributes']:_0x3feb79[_0x3db6('0x29')];if(_0x31fb9d[_0x3db6('0x25')][_0x3db6('0x2e')]){_0x2945ef[_0x3db6('0x24')]=[{'all':!![]}];}_0x2945ef=_[_0x3db6('0x2f')]({},_0x2945ef,_0x31fb9d[_0x3db6('0x30')]);return db[_0x3db6('0x1e')][_0x3db6('0x31')](_0x2945ef)[_0x3db6('0x16')](handleEntityNotFound(_0x36d146,null))[_0x3db6('0x16')](respondWithResult(_0x36d146,null))[_0x3db6('0x32')](handleError(_0x36d146,null));};exports['create']=function(_0x119a8c,_0x541f84){return db[_0x3db6('0x1e')][_0x3db6('0x33')](_0x119a8c[_0x3db6('0x34')],{})[_0x3db6('0x16')](function(_0x379091){var _0x3aec03=_0x119a8c[_0x3db6('0x35')]['get']({'plain':!![]});if(!_0x3aec03)throw new Error(_0x3db6('0x36'));if(_0x3aec03[_0x3db6('0x37')]===_0x3db6('0x35')){var _0x744b94=_0x379091['get']({'plain':!![]});var _0x2c8eb7='ChatQueues';return db[_0x3db6('0x38')][_0x3db6('0x31')]({'where':{'name':_0x2c8eb7,'userProfileId':_0x3aec03[_0x3db6('0x39')]},'raw':!![]})[_0x3db6('0x16')](function(_0x1653e0){if(_0x1653e0&&_0x1653e0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x744b94[_0x3db6('0x1a')],'resourceId':_0x744b94['id'],'type':_0x1653e0[_0x3db6('0x1a')],'sectionId':_0x1653e0['id']},{})[_0x3db6('0x16')](function(){return _0x379091;});}else{return _0x379091;}})[_0x3db6('0x32')](function(_0x33449b){logger[_0x3db6('0x3a')](_0x3db6('0x3b'),_0x33449b);throw _0x33449b;});}return _0x379091;})[_0x3db6('0x16')](respondWithResult(_0x541f84,0xc9))[_0x3db6('0x32')](handleError(_0x541f84,null));};exports['update']=function(_0x2ffa7f,_0x30ddb8){if(_0x2ffa7f[_0x3db6('0x34')]['id']){delete _0x2ffa7f[_0x3db6('0x34')]['id'];}return db[_0x3db6('0x1e')][_0x3db6('0x31')]({'where':{'id':_0x2ffa7f[_0x3db6('0x28')]['id']}})[_0x3db6('0x16')](handleEntityNotFound(_0x30ddb8,null))[_0x3db6('0x16')](saveUpdates(_0x2ffa7f['body'],null))[_0x3db6('0x16')](respondWithResult(_0x30ddb8,null))['catch'](handleError(_0x30ddb8,null));};exports[_0x3db6('0x19')]=function(_0x4f9aa7,_0xab6d5b){return db[_0x3db6('0x1e')][_0x3db6('0x31')]({'where':{'id':_0x4f9aa7['params']['id']}})[_0x3db6('0x16')](handleEntityNotFound(_0xab6d5b,null))[_0x3db6('0x16')](removeEntity(_0xab6d5b,null))[_0x3db6('0x32')](handleError(_0xab6d5b,null));};exports[_0x3db6('0x3c')]=function(_0x40f6e4,_0x23411c){return db[_0x3db6('0x1e')]['describe']()[_0x3db6('0x16')](respondWithResult(_0x23411c,null))[_0x3db6('0x32')](handleError(_0x23411c,null));};exports[_0x3db6('0x3d')]=function(_0x3ae9c7,_0x4fbcef){var _0x594bdf={'raw':!![],'where':{}},_0x21afac={},_0x15d923;return db[_0x3db6('0x1e')][_0x3db6('0x3e')]({'where':{'id':_0x3ae9c7['params']['id']}})[_0x3db6('0x16')](handleEntityNotFound(_0x4fbcef,null))[_0x3db6('0x16')](function(_0xa8d872){if(_0xa8d872){_0x15d923=_0xa8d872['get']({'plain':!![]});_0x21afac[_0x3db6('0x29')]=_[_0x3db6('0x2a')](db['UserChatQueue']['rawAttributes']);_0x21afac[_0x3db6('0x25')]=_['keys'](_0x3ae9c7[_0x3db6('0x25')]);_0x21afac['filters']=_[_0x3db6('0x2b')](_0x21afac[_0x3db6('0x29')],_0x21afac[_0x3db6('0x25')]);_0x594bdf[_0x3db6('0x2c')]=_[_0x3db6('0x2b')](_0x21afac[_0x3db6('0x29')],qs['fields'](_0x3ae9c7[_0x3db6('0x25')][_0x3db6('0x2d')]));_0x594bdf[_0x3db6('0x2c')]=_0x594bdf[_0x3db6('0x2c')][_0x3db6('0x3f')]?_0x594bdf['attributes']:_0x21afac[_0x3db6('0x29')];if(!_0x3ae9c7['query'][_0x3db6('0x40')]('nolimit')){_0x594bdf[_0x3db6('0x13')]=qs[_0x3db6('0x13')](_0x3ae9c7[_0x3db6('0x25')][_0x3db6('0x13')]);_0x594bdf[_0x3db6('0x10')]=qs['offset'](_0x3ae9c7['query']['offset']);}_0x594bdf[_0x3db6('0x41')]=qs['sort'](_0x3ae9c7['query'][_0x3db6('0x42')]);_0x594bdf[_0x3db6('0x23')]=qs[_0x3db6('0x43')](_['pick'](_0x3ae9c7['query'],_0x21afac['filters']));_0x594bdf['where'][_0x3db6('0x44')]=_0xa8d872['id'];if(_0x3ae9c7[_0x3db6('0x25')][_0x3db6('0x45')]){_0x594bdf[_0x3db6('0x23')]=_[_0x3db6('0x2f')](_0x594bdf[_0x3db6('0x23')],{'$or':_[_0x3db6('0x1d')](_0x594bdf[_0x3db6('0x2c')],function(_0x54e8a6){var _0x10df62={};_0x10df62[_0x54e8a6]={'$like':'%'+_0x3ae9c7[_0x3db6('0x25')]['filter']+'%'};return _0x10df62;})});}_0x594bdf=_[_0x3db6('0x2f')]({},_0x594bdf,_0x3ae9c7['options']);return db[_0x3db6('0x46')]['findAll'](_0x594bdf);}})[_0x3db6('0x16')](function(_0x193f25){if(_0x193f25){return db[_0x3db6('0x47')]['findAndCountAll']({'where':{'id':_[_0x3db6('0x1d')](_0x193f25,'UserId'),'role':_0x3db6('0x48')},'attributes':['id',_0x3db6('0x1a'),_0x3db6('0x49'),'updatedAt',_0x3db6('0x4a')]});}})[_0x3db6('0x16')](function(_0x2599d6){if(_0x2599d6){return{'count':_0x2599d6[_0x3db6('0x12')],'rows':_[_0x3db6('0x1d')](_0x2599d6[_0x3db6('0x4b')],function(_0x315a68){return{'membername':_0x315a68[_0x3db6('0x1a')],'UserId':_0x315a68['id'],'queue_name':_0x15d923[_0x3db6('0x1a')],'ChatQueueId':_0x15d923['id'],'interface':util[_0x3db6('0x4c')](_0x3db6('0x4d'),_0x3db6('0x4e'),_0x315a68[_0x3db6('0x1a')]),'penalty':0x0,'paused':_0x315a68[_0x3db6('0x49')],'createdAt':_0x315a68[_0x3db6('0x4a')],'updatedAt':_0x315a68[_0x3db6('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3db6('0x16')](respondWithFilteredResult(_0x4fbcef,_0x594bdf))[_0x3db6('0x32')](handleError(_0x4fbcef,null));};exports[_0x3db6('0x50')]=function(_0x41179a,_0xf71184){var _0x3e16af={};var _0x12f7ae={};var _0x33bcb4;var _0x5f1708;return db[_0x3db6('0x1e')]['findOne']({'where':{'id':_0x41179a['params']['id']}})['then'](handleEntityNotFound(_0xf71184,null))[_0x3db6('0x16')](function(_0x362a48){if(_0x362a48){_0x33bcb4=_0x362a48;_0x12f7ae[_0x3db6('0x29')]=_[_0x3db6('0x2a')](db[_0x3db6('0x51')][_0x3db6('0x52')]);_0x12f7ae[_0x3db6('0x25')]=_[_0x3db6('0x2a')](_0x41179a['query']);_0x12f7ae['filters']=_[_0x3db6('0x2b')](_0x12f7ae[_0x3db6('0x29')],_0x12f7ae[_0x3db6('0x25')]);_0x3e16af[_0x3db6('0x2c')]=_['intersection'](_0x12f7ae[_0x3db6('0x29')],qs[_0x3db6('0x2d')](_0x41179a['query'][_0x3db6('0x2d')]));_0x3e16af['attributes']=_0x3e16af[_0x3db6('0x2c')]['length']?_0x3e16af['attributes']:_0x12f7ae[_0x3db6('0x29')];_0x3e16af['order']=qs[_0x3db6('0x42')](_0x41179a[_0x3db6('0x25')]['sort']);_0x3e16af['where']=qs['filters'](_[_0x3db6('0x53')](_0x41179a[_0x3db6('0x25')],_0x12f7ae[_0x3db6('0x43')]));if(_0x41179a[_0x3db6('0x25')]['filter']){_0x3e16af['where']=_[_0x3db6('0x2f')](_0x3e16af[_0x3db6('0x23')],{'$or':_[_0x3db6('0x1d')](_0x3e16af[_0x3db6('0x2c')],function(_0x46fa69){var _0x18bf03={};_0x18bf03[_0x46fa69]={'$like':'%'+_0x41179a[_0x3db6('0x25')]['filter']+'%'};return _0x18bf03;})});}_0x3e16af=_[_0x3db6('0x2f')]({},_0x3e16af,_0x41179a[_0x3db6('0x30')]);return _0x33bcb4[_0x3db6('0x50')](_0x3e16af);}})[_0x3db6('0x16')](function(_0x915793){if(_0x915793){_0x5f1708=_0x915793[_0x3db6('0x3f')];if(!_0x41179a['query']['hasOwnProperty'](_0x3db6('0x54'))){_0x3e16af[_0x3db6('0x13')]=qs[_0x3db6('0x13')](_0x41179a[_0x3db6('0x25')][_0x3db6('0x13')]);_0x3e16af[_0x3db6('0x10')]=qs[_0x3db6('0x10')](_0x41179a[_0x3db6('0x25')][_0x3db6('0x10')]);}return _0x33bcb4[_0x3db6('0x50')](_0x3e16af);}})['then'](function(_0x527c40){if(_0x527c40){return _0x527c40?{'count':_0x5f1708,'rows':_0x527c40}:null;}})['then'](respondWithResult(_0xf71184,null))['catch'](handleError(_0xf71184,null));};exports[_0x3db6('0x55')]=function(_0x20cb38,_0x750de3){var _0x25504a=_0x20cb38[_0x3db6('0x34')][_0x3db6('0x56')];return db[_0x3db6('0x51')]['findAll']({'where':{'id':_0x25504a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3db6('0x57'),'attributes':['id',_0x3db6('0x1a'),_0x3db6('0x58'),_0x3db6('0x59'),_0x3db6('0x5a')],'raw':!![]}]})[_0x3db6('0x16')](function(_0x2631f1){if(_0x2631f1){var _0x4bc0bc=_['flatMap'](_0x2631f1,function(_0x13c151){var _0x5030c9=_0x13c151['get']({'plain':!![]});return _0x5030c9['Agents'];});return db[_0x3db6('0x1e')][_0x3db6('0x31')]({'where':{'id':_0x20cb38[_0x3db6('0x28')]['id']}})[_0x3db6('0x16')](function(_0x3825c3){return db[_0x3db6('0x5b')][_0x3db6('0x5c')](function(_0x1f1f5c){return _0x3825c3[_0x3db6('0x55')](_0x25504a,{'transaction':_0x1f1f5c})[_0x3db6('0x16')](function(){return BPromise['each'](_0x4bc0bc,function(_0x1c96f7){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x1c96f7['id'],'ChatQueueId':_0x20cb38[_0x3db6('0x28')]['id']},'transaction':_0x1f1f5c});});})[_0x3db6('0x16')](function(){_0x4bc0bc[_0x3db6('0x5d')](function(_0x26521a){socket[_0x3db6('0x5e')](_0x3db6('0x5f'),{'UserId':_0x26521a['id'],'ChatQueueId':_0x3825c3['id']});});});});});}})[_0x3db6('0x16')](respondWithStatusCode(_0x750de3,null))[_0x3db6('0x32')](handleError(_0x750de3,null));};exports['removeTeams']=function(_0x153d10,_0x2ce746){return db[_0x3db6('0x51')][_0x3db6('0x26')]({'where':{'id':_0x153d10[_0x3db6('0x25')][_0x3db6('0x56')]},'attributes':['id'],'include':[{'model':db[_0x3db6('0x47')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3db6('0x16')](handleEntityNotFound(_0x2ce746,null))[_0x3db6('0x16')](function(_0x381c3a){var _0x56bc72=_[_0x3db6('0x1d')](_0x381c3a,'id');var _0x53116f=[];var _0x45433a=[];var _0x4ed71a=squel['select']();_0x4ed71a[_0x3db6('0x60')](_0x3db6('0x61'))[_0x3db6('0x62')](_0x3db6('0x63'),'tq')[_0x3db6('0x64')](_0x3db6('0x65'),'ut',_0x3db6('0x66'))[_0x3db6('0x23')]('ChatQueueId\x20=\x20?',_0x153d10[_0x3db6('0x28')]['id']);for(var _0x260393=0x0;_0x260393<_0x381c3a[_0x3db6('0x3f')];_0x260393+=0x1){let _0x31d16a=_0x381c3a[_0x260393];for(var _0x202f3f=0x0;_0x202f3f<_0x31d16a[_0x3db6('0x57')][_0x3db6('0x3f')];_0x202f3f+=0x1){let _0x14cf4c=_0x31d16a[_0x3db6('0x57')][_0x202f3f];var _0x2302e3=_0x4ed71a[_0x3db6('0x67')]();_0x2302e3[_0x3db6('0x23')]('ut.UserId\x20=\x20?',_0x14cf4c['id']);_0x45433a[_0x3db6('0x68')](db[_0x3db6('0x5b')]['query'](_0x2302e3[_0x3db6('0x69')](),{'type':db[_0x3db6('0x5b')]['QueryTypes']['SELECT']})[_0x3db6('0x16')](function(_0x537824){if(_0x537824['length']===0x1){return _0x14cf4c['id'];}else{var _0x6889ae=_[_0x3db6('0x6a')](_['map'](_0x537824,_0x3db6('0x6b')),function(_0x3a511e){return _[_0x3db6('0x6c')](_0x56bc72,_0x3a511e);});if(_0x6889ae){return _0x14cf4c['id'];}}}));}}return BPromise[_0x3db6('0x6d')](_0x45433a)['then'](function(_0x3a86b4){_0x53116f=_(_0x53116f)['union'](_0x3a86b4)['compact']()[_0x3db6('0x6e')]();return db[_0x3db6('0x1e')][_0x3db6('0x31')]({'where':{'id':_0x153d10['params']['id']}})[_0x3db6('0x16')](function(_0xfa5d1b){return db['sequelize'][_0x3db6('0x5c')](function(_0x20c90b){return _0xfa5d1b['removeTeams'](_0x153d10[_0x3db6('0x25')][_0x3db6('0x56')],{'transaction':_0x20c90b})['then'](function(){if(!_[_0x3db6('0x6f')](_0x53116f)){return _0xfa5d1b[_0x3db6('0x70')](_0x53116f,{'transaction':_0x20c90b});}})[_0x3db6('0x16')](function(){_0x53116f[_0x3db6('0x5d')](function(_0x38bdda){socket['emit'](_0x3db6('0x71'),{'UserId':_0x38bdda,'ChatQueueId':_0xfa5d1b['id']});});});});});});})[_0x3db6('0x16')](respondWithStatusCode(_0x2ce746,null))[_0x3db6('0x32')](handleError(_0x2ce746,null));};exports[_0x3db6('0x72')]=function(_0x3ab6c0,_0x279cf7){return db['ChatQueue'][_0x3db6('0x31')]({'where':{'id':_0x3ab6c0[_0x3db6('0x28')]['id']}})[_0x3db6('0x16')](handleEntityNotFound(_0x279cf7,null))[_0x3db6('0x16')](function(_0x869520){if(_0x869520){return _0x869520[_0x3db6('0x72')](_0x3ab6c0['body'][_0x3db6('0x56')],_[_0x3db6('0x73')](_0x3ab6c0[_0x3db6('0x34')],['ids','id'])||{})['spread'](function(_0xf55512){for(var _0xe4484=0x0;_0xe4484<_0x3ab6c0[_0x3db6('0x34')][_0x3db6('0x56')][_0x3db6('0x3f')];_0xe4484+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x3ab6c0[_0x3db6('0x34')]['ids'][_0xe4484]),'ChatQueueId':Number(_0x3ab6c0[_0x3db6('0x28')]['id'])});}return _0xf55512;});}})[_0x3db6('0x16')](respondWithResult(_0x279cf7,null))['catch'](handleError(_0x279cf7,null));};exports['removeAgents']=function(_0x2ed636,_0x34ff24){return db[_0x3db6('0x1e')][_0x3db6('0x31')]({'where':{'id':_0x2ed636[_0x3db6('0x28')]['id']}})[_0x3db6('0x16')](handleEntityNotFound(_0x34ff24,null))[_0x3db6('0x16')](function(_0x130815){if(_0x130815){return _0x130815[_0x3db6('0x70')](_0x2ed636[_0x3db6('0x25')]['ids'])[_0x3db6('0x16')](function(){if(_[_0x3db6('0x74')](_0x2ed636['query'][_0x3db6('0x56')])){for(var _0x5042fd=0x0;_0x5042fd<_0x2ed636[_0x3db6('0x25')][_0x3db6('0x56')][_0x3db6('0x3f')];_0x5042fd+=0x1){socket['emit'](_0x3db6('0x71'),{'UserId':Number(_0x2ed636[_0x3db6('0x25')][_0x3db6('0x56')][_0x5042fd]),'ChatQueueId':Number(_0x2ed636[_0x3db6('0x28')]['id'])});}}else{socket[_0x3db6('0x5e')](_0x3db6('0x71'),{'UserId':Number(_0x2ed636['query'][_0x3db6('0x56')]),'ChatQueueId':Number(_0x2ed636['params']['id'])});}});}})[_0x3db6('0x16')](respondWithStatusCode(_0x34ff24,null))['catch'](handleError(_0x34ff24,null));};exports[_0x3db6('0x75')]=function(_0x1488ea,_0x5b9370){var _0x5a6543={};var _0x4b0af4={};var _0x3219c5;var _0x45a960;return db[_0x3db6('0x1e')][_0x3db6('0x3e')]({'where':{'id':_0x1488ea[_0x3db6('0x28')]['id']}})[_0x3db6('0x16')](handleEntityNotFound(_0x5b9370,null))[_0x3db6('0x16')](function(_0x3cecf1){if(_0x3cecf1){_0x3219c5=_0x3cecf1;_0x4b0af4[_0x3db6('0x29')]=_[_0x3db6('0x2a')](db['User']['rawAttributes']);_0x4b0af4['query']=_[_0x3db6('0x2a')](_0x1488ea[_0x3db6('0x25')]);_0x4b0af4['filters']=_[_0x3db6('0x2b')](_0x4b0af4[_0x3db6('0x29')],_0x4b0af4[_0x3db6('0x25')]);_0x5a6543[_0x3db6('0x2c')]=_[_0x3db6('0x2b')](_0x4b0af4[_0x3db6('0x29')],qs[_0x3db6('0x2d')](_0x1488ea[_0x3db6('0x25')][_0x3db6('0x2d')]));_0x5a6543['attributes']=_0x5a6543['attributes'][_0x3db6('0x3f')]?_0x5a6543[_0x3db6('0x2c')]:_0x4b0af4['model'];_0x5a6543[_0x3db6('0x41')]=qs[_0x3db6('0x42')](_0x1488ea[_0x3db6('0x25')][_0x3db6('0x42')]);_0x5a6543[_0x3db6('0x23')]=qs[_0x3db6('0x43')](_[_0x3db6('0x53')](_0x1488ea[_0x3db6('0x25')],_0x4b0af4[_0x3db6('0x43')]));if(_0x1488ea[_0x3db6('0x25')][_0x3db6('0x45')]){_0x5a6543[_0x3db6('0x23')]=_[_0x3db6('0x2f')](_0x5a6543[_0x3db6('0x23')],{'$or':_[_0x3db6('0x1d')](_0x5a6543['attributes'],function(_0x1189ab){var _0x2adc93={};_0x2adc93[_0x1189ab]={'$like':'%'+_0x1488ea[_0x3db6('0x25')][_0x3db6('0x45')]+'%'};return _0x2adc93;})});}_0x5a6543=_[_0x3db6('0x2f')]({},_0x5a6543,_0x1488ea[_0x3db6('0x30')]);return _0x3219c5[_0x3db6('0x75')](_0x5a6543);}})[_0x3db6('0x16')](function(_0x2e72da){if(_0x2e72da){_0x45a960=_0x2e72da['length'];if(!_0x1488ea[_0x3db6('0x25')][_0x3db6('0x40')](_0x3db6('0x54'))){_0x5a6543['limit']=qs[_0x3db6('0x13')](_0x1488ea['query']['limit']);_0x5a6543[_0x3db6('0x10')]=qs[_0x3db6('0x10')](_0x1488ea[_0x3db6('0x25')][_0x3db6('0x10')]);}return _0x3219c5[_0x3db6('0x75')](_0x5a6543);}})['then'](function(_0x31e19f){if(_0x31e19f){return _0x31e19f?{'count':_0x45a960,'rows':_0x31e19f}:null;}})['then'](respondWithResult(_0x5b9370,null))['catch'](handleError(_0x5b9370,null));}; \ No newline at end of file +var _0x0241=['nolimit','where','pick','filter','findAndCountAll','UserId','chatPause','createdAt','rows','format','SIP','updatedAt','getTeams','Team','sort','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','status','json','offset','limit','count','set','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','include','query','findAll','catch','show','params','keys','filters','model','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','intersection','length','hasOwnProperty'];(function(_0x3b925f,_0x5a151e){var _0x4550b9=function(_0x22e1f7){while(--_0x22e1f7){_0x3b925f['push'](_0x3b925f['shift']());}};_0x4550b9(++_0x5a151e);}(_0x0241,0x1ac));var _0x1024=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0241[_0xfae23b];return _0x200640;};'use strict';var BPromise=require(_0x1024('0x0'));var util=require(_0x1024('0x1'));var _=require('lodash');var squel=require(_0x1024('0x2'));var Redis=require(_0x1024('0x3'));var qs=require(_0x1024('0x4'));var logger=require(_0x1024('0x5'))(_0x1024('0x6'));var config=require('../../config/environment');var db=require(_0x1024('0x7'))['db'];config[_0x1024('0x8')]=_['defaults'](config['redis'],{'host':_0x1024('0x9'),'port':0x18eb});var socket=require(_0x1024('0xa'))(new Redis(config[_0x1024('0x8')]));require(_0x1024('0xb'))[_0x1024('0xc')](socket);function respondWithStatusCode(_0x57f24e,_0x199e25){_0x199e25=_0x199e25||0xcc;return function(_0x3c35b0){if(_0x3c35b0){return _0x57f24e['sendStatus'](_0x199e25);}return _0x57f24e[_0x1024('0xd')](_0x199e25)['end']();};}function respondWithResult(_0x4c5b13,_0x1aa585){_0x1aa585=_0x1aa585||0xc8;return function(_0x1559a8){if(_0x1559a8){return _0x4c5b13[_0x1024('0xd')](_0x1aa585)[_0x1024('0xe')](_0x1559a8);}};}function respondWithFilteredResult(_0x133f21,_0x4d73ce){return function(_0x42e074){if(_0x42e074){var _0x1446b0=typeof _0x4d73ce[_0x1024('0xf')]==='undefined'&&typeof _0x4d73ce[_0x1024('0x10')]==='undefined';var _0x196644=_0x42e074[_0x1024('0x11')];var _0x13b599=_0x1446b0?0x0:_0x4d73ce[_0x1024('0xf')];var _0x3220dd=_0x1446b0?_0x42e074[_0x1024('0x11')]:_0x4d73ce[_0x1024('0xf')]+_0x4d73ce[_0x1024('0x10')];var _0x1173f5;if(_0x3220dd>=_0x196644){_0x3220dd=_0x196644;_0x1173f5=0xc8;}else{_0x1173f5=0xce;}_0x133f21[_0x1024('0xd')](_0x1173f5);return _0x133f21[_0x1024('0x12')](_0x1024('0x13'),_0x13b599+'-'+_0x3220dd+'/'+_0x196644)[_0x1024('0xe')](_0x42e074);}return null;};}function saveUpdates(_0xa073c6){return function(_0x34e80e){if(_0x34e80e){return _0x34e80e[_0x1024('0x14')](_0xa073c6)[_0x1024('0x15')](function(_0x31090b){return _0x31090b;});}return null;};}function removeEntity(_0x68461a){return function(_0xc66ae5){if(_0xc66ae5){return _0xc66ae5[_0x1024('0x16')]()['then'](function(){var _0x5418e9=_0xc66ae5[_0x1024('0x17')]({'plain':!![]});var _0x55eb02=_0x1024('0x18');return db[_0x1024('0x19')][_0x1024('0x16')]({'where':{'type':_0x55eb02,'resourceId':_0x5418e9['id']}})[_0x1024('0x15')](function(){return _0xc66ae5;});})[_0x1024('0x15')](function(){_0x68461a[_0x1024('0xd')](0xcc)[_0x1024('0x1a')]();});}};}function handleEntityNotFound(_0x3f9c43){return function(_0x49e34d){if(!_0x49e34d){_0x3f9c43[_0x1024('0x1b')](0x194);}return _0x49e34d;};}function handleError(_0x197e3f,_0x5887e7){_0x5887e7=_0x5887e7||0x1f4;return function(_0x3ba848){logger[_0x1024('0x1c')](_0x3ba848['stack']);if(_0x3ba848[_0x1024('0x1d')]){delete _0x3ba848[_0x1024('0x1d')];}_0x197e3f[_0x1024('0xd')](_0x5887e7)[_0x1024('0x1e')](_0x3ba848);};}exports[_0x1024('0x1f')]=function(_0x10d94d,_0x313964){var _0x32b842={};var _0xceece={'count':0x0,'rows':[]};var _0x3a0f34=_[_0x1024('0x20')](db[_0x1024('0x21')][_0x1024('0x22')],function(_0x3e1393){return{'name':_0x3e1393[_0x1024('0x23')],'type':_0x3e1393[_0x1024('0x24')][_0x1024('0x25')]};});_0x32b842=qs[_0x1024('0x26')](_0x3a0f34,_0x10d94d);var _0x2ecbd3={'where':_0x32b842['where']};return db[_0x1024('0x21')][_0x1024('0x11')](_0x2ecbd3)[_0x1024('0x15')](function(_0x13403b){_0xceece[_0x1024('0x11')]=_0x13403b;_0x32b842[_0x1024('0x27')]=qs['include'](_0x10d94d[_0x1024('0x28')]);return db['ChatQueue'][_0x1024('0x29')](_0x32b842);})[_0x1024('0x15')](function(_0x18a5ca){_0xceece['rows']=_0x18a5ca;return _0xceece;})[_0x1024('0x15')](respondWithFilteredResult(_0x313964,_0x32b842))[_0x1024('0x2a')](handleError(_0x313964,null));};exports[_0x1024('0x2b')]=function(_0x2bad47,_0x6d10d3){var _0x8827fc={'raw':!![],'where':{'id':_0x2bad47[_0x1024('0x2c')]['id']}},_0x3bbda6={};_0x3bbda6['model']=_[_0x1024('0x2d')](db[_0x1024('0x21')][_0x1024('0x22')]);_0x3bbda6[_0x1024('0x28')]=_[_0x1024('0x2d')](_0x2bad47[_0x1024('0x28')]);_0x3bbda6[_0x1024('0x2e')]=_['intersection'](_0x3bbda6[_0x1024('0x2f')],_0x3bbda6[_0x1024('0x28')]);_0x8827fc[_0x1024('0x30')]=_['intersection'](_0x3bbda6['model'],qs[_0x1024('0x31')](_0x2bad47[_0x1024('0x28')]['fields']));_0x8827fc['attributes']=_0x8827fc['attributes']['length']?_0x8827fc['attributes']:_0x3bbda6[_0x1024('0x2f')];if(_0x2bad47[_0x1024('0x28')]['includeAll']){_0x8827fc[_0x1024('0x27')]=[{'all':!![]}];}_0x8827fc=_[_0x1024('0x32')]({},_0x8827fc,_0x2bad47[_0x1024('0x33')]);return db[_0x1024('0x21')][_0x1024('0x34')](_0x8827fc)[_0x1024('0x15')](handleEntityNotFound(_0x6d10d3,null))['then'](respondWithResult(_0x6d10d3,null))[_0x1024('0x2a')](handleError(_0x6d10d3,null));};exports[_0x1024('0x35')]=function(_0x4bbb01,_0x27af16){return db[_0x1024('0x21')][_0x1024('0x35')](_0x4bbb01[_0x1024('0x36')],{})[_0x1024('0x15')](function(_0x1b220f){var _0x202868=_0x4bbb01[_0x1024('0x37')]['get']({'plain':!![]});if(!_0x202868)throw new Error(_0x1024('0x38'));if(_0x202868[_0x1024('0x39')]===_0x1024('0x37')){var _0x279b41=_0x1b220f[_0x1024('0x17')]({'plain':!![]});var _0x352e07='ChatQueues';return db[_0x1024('0x3a')][_0x1024('0x34')]({'where':{'name':_0x352e07,'userProfileId':_0x202868[_0x1024('0x3b')]},'raw':!![]})[_0x1024('0x15')](function(_0x4490a1){if(_0x4490a1&&_0x4490a1[_0x1024('0x3c')]===0x0){return db[_0x1024('0x19')]['create']({'name':_0x279b41[_0x1024('0x1d')],'resourceId':_0x279b41['id'],'type':_0x4490a1[_0x1024('0x1d')],'sectionId':_0x4490a1['id']},{})[_0x1024('0x15')](function(){return _0x1b220f;});}else{return _0x1b220f;}})[_0x1024('0x2a')](function(_0x255fb3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x255fb3);throw _0x255fb3;});}return _0x1b220f;})['then'](respondWithResult(_0x27af16,0xc9))[_0x1024('0x2a')](handleError(_0x27af16,null));};exports[_0x1024('0x14')]=function(_0x1922e9,_0x56f134){if(_0x1922e9[_0x1024('0x36')]['id']){delete _0x1922e9['body']['id'];}return db[_0x1024('0x21')][_0x1024('0x34')]({'where':{'id':_0x1922e9['params']['id']}})['then'](handleEntityNotFound(_0x56f134,null))[_0x1024('0x15')](saveUpdates(_0x1922e9[_0x1024('0x36')],null))[_0x1024('0x15')](respondWithResult(_0x56f134,null))[_0x1024('0x2a')](handleError(_0x56f134,null));};exports['destroy']=function(_0x5cb686,_0x5d21a7){return db[_0x1024('0x21')]['find']({'where':{'id':_0x5cb686[_0x1024('0x2c')]['id']}})['then'](handleEntityNotFound(_0x5d21a7,null))['then'](removeEntity(_0x5d21a7,null))[_0x1024('0x2a')](handleError(_0x5d21a7,null));};exports[_0x1024('0x3d')]=function(_0x573109,_0x16332b){return db[_0x1024('0x21')][_0x1024('0x3d')]()[_0x1024('0x15')](respondWithResult(_0x16332b,null))[_0x1024('0x2a')](handleError(_0x16332b,null));};exports[_0x1024('0x3e')]=function(_0xafcc6a,_0x28ffcb){var _0x4dc785={'raw':!![],'where':{}},_0x31b1d0={},_0x7d23c7;return db[_0x1024('0x21')][_0x1024('0x3f')]({'where':{'id':_0xafcc6a[_0x1024('0x2c')]['id']}})[_0x1024('0x15')](handleEntityNotFound(_0x28ffcb,null))[_0x1024('0x15')](function(_0x2d2cbb){if(_0x2d2cbb){_0x7d23c7=_0x2d2cbb[_0x1024('0x17')]({'plain':!![]});_0x31b1d0['model']=_['keys'](db[_0x1024('0x40')]['rawAttributes']);_0x31b1d0['query']=_[_0x1024('0x2d')](_0xafcc6a[_0x1024('0x28')]);_0x31b1d0['filters']=_[_0x1024('0x41')](_0x31b1d0[_0x1024('0x2f')],_0x31b1d0[_0x1024('0x28')]);_0x4dc785[_0x1024('0x30')]=_[_0x1024('0x41')](_0x31b1d0[_0x1024('0x2f')],qs['fields'](_0xafcc6a[_0x1024('0x28')][_0x1024('0x31')]));_0x4dc785[_0x1024('0x30')]=_0x4dc785[_0x1024('0x30')][_0x1024('0x42')]?_0x4dc785[_0x1024('0x30')]:_0x31b1d0[_0x1024('0x2f')];if(!_0xafcc6a[_0x1024('0x28')][_0x1024('0x43')](_0x1024('0x44'))){_0x4dc785[_0x1024('0x10')]=qs[_0x1024('0x10')](_0xafcc6a[_0x1024('0x28')]['limit']);_0x4dc785[_0x1024('0xf')]=qs[_0x1024('0xf')](_0xafcc6a[_0x1024('0x28')]['offset']);}_0x4dc785['order']=qs['sort'](_0xafcc6a['query']['sort']);_0x4dc785[_0x1024('0x45')]=qs[_0x1024('0x2e')](_[_0x1024('0x46')](_0xafcc6a[_0x1024('0x28')],_0x31b1d0[_0x1024('0x2e')]));_0x4dc785['where']['ChatQueueId']=_0x2d2cbb['id'];if(_0xafcc6a['query'][_0x1024('0x47')]){_0x4dc785[_0x1024('0x45')]=_[_0x1024('0x32')](_0x4dc785[_0x1024('0x45')],{'$or':_['map'](_0x4dc785[_0x1024('0x30')],function(_0x475b6b){var _0x43657b={};_0x43657b[_0x475b6b]={'$like':'%'+_0xafcc6a[_0x1024('0x28')]['filter']+'%'};return _0x43657b;})});}_0x4dc785=_[_0x1024('0x32')]({},_0x4dc785,_0xafcc6a[_0x1024('0x33')]);return db[_0x1024('0x40')]['findAll'](_0x4dc785);}})['then'](function(_0x34ecef){if(_0x34ecef){return db['User'][_0x1024('0x48')]({'where':{'id':_[_0x1024('0x20')](_0x34ecef,_0x1024('0x49')),'role':'agent'},'attributes':['id',_0x1024('0x1d'),_0x1024('0x4a'),'updatedAt',_0x1024('0x4b')]});}})[_0x1024('0x15')](function(_0x449837){if(_0x449837){return{'count':_0x449837['count'],'rows':_[_0x1024('0x20')](_0x449837[_0x1024('0x4c')],function(_0x21c3fc){return{'membername':_0x21c3fc[_0x1024('0x1d')],'UserId':_0x21c3fc['id'],'queue_name':_0x7d23c7[_0x1024('0x1d')],'ChatQueueId':_0x7d23c7['id'],'interface':util[_0x1024('0x4d')]('%s/%s',_0x1024('0x4e'),_0x21c3fc[_0x1024('0x1d')]),'penalty':0x0,'paused':_0x21c3fc['chatPause'],'createdAt':_0x21c3fc[_0x1024('0x4b')],'updatedAt':_0x21c3fc[_0x1024('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1024('0x15')](respondWithFilteredResult(_0x28ffcb,_0x4dc785))[_0x1024('0x2a')](handleError(_0x28ffcb,null));};exports[_0x1024('0x50')]=function(_0x3e9a70,_0x22b871){var _0x4faf39={};var _0x53d5dc={};var _0x8a6956;var _0x1578ad;return db[_0x1024('0x21')][_0x1024('0x3f')]({'where':{'id':_0x3e9a70[_0x1024('0x2c')]['id']}})['then'](handleEntityNotFound(_0x22b871,null))[_0x1024('0x15')](function(_0x301283){if(_0x301283){_0x8a6956=_0x301283;_0x53d5dc[_0x1024('0x2f')]=_[_0x1024('0x2d')](db[_0x1024('0x51')][_0x1024('0x22')]);_0x53d5dc[_0x1024('0x28')]=_[_0x1024('0x2d')](_0x3e9a70[_0x1024('0x28')]);_0x53d5dc[_0x1024('0x2e')]=_[_0x1024('0x41')](_0x53d5dc['model'],_0x53d5dc['query']);_0x4faf39['attributes']=_[_0x1024('0x41')](_0x53d5dc[_0x1024('0x2f')],qs[_0x1024('0x31')](_0x3e9a70[_0x1024('0x28')][_0x1024('0x31')]));_0x4faf39[_0x1024('0x30')]=_0x4faf39[_0x1024('0x30')]['length']?_0x4faf39['attributes']:_0x53d5dc[_0x1024('0x2f')];_0x4faf39['order']=qs[_0x1024('0x52')](_0x3e9a70['query'][_0x1024('0x52')]);_0x4faf39[_0x1024('0x45')]=qs[_0x1024('0x2e')](_[_0x1024('0x46')](_0x3e9a70['query'],_0x53d5dc[_0x1024('0x2e')]));if(_0x3e9a70['query'][_0x1024('0x47')]){_0x4faf39['where']=_['merge'](_0x4faf39[_0x1024('0x45')],{'$or':_['map'](_0x4faf39['attributes'],function(_0x24f162){var _0x1940bf={};_0x1940bf[_0x24f162]={'$like':'%'+_0x3e9a70[_0x1024('0x28')][_0x1024('0x47')]+'%'};return _0x1940bf;})});}_0x4faf39=_[_0x1024('0x32')]({},_0x4faf39,_0x3e9a70[_0x1024('0x33')]);return _0x8a6956[_0x1024('0x50')](_0x4faf39);}})[_0x1024('0x15')](function(_0x51db1c){if(_0x51db1c){_0x1578ad=_0x51db1c['length'];if(!_0x3e9a70[_0x1024('0x28')][_0x1024('0x43')](_0x1024('0x44'))){_0x4faf39[_0x1024('0x10')]=qs[_0x1024('0x10')](_0x3e9a70[_0x1024('0x28')][_0x1024('0x10')]);_0x4faf39[_0x1024('0xf')]=qs['offset'](_0x3e9a70['query'][_0x1024('0xf')]);}return _0x8a6956['getTeams'](_0x4faf39);}})['then'](function(_0x2e94c7){if(_0x2e94c7){return _0x2e94c7?{'count':_0x1578ad,'rows':_0x2e94c7}:null;}})[_0x1024('0x15')](respondWithResult(_0x22b871,null))[_0x1024('0x2a')](handleError(_0x22b871,null));};exports[_0x1024('0x53')]=function(_0x501f75,_0x586f13){var _0x342a48=_0x501f75[_0x1024('0x36')][_0x1024('0x54')];return db[_0x1024('0x51')][_0x1024('0x29')]({'where':{'id':_0x342a48},'attributes':['id'],'include':[{'model':db[_0x1024('0x55')],'as':_0x1024('0x56'),'attributes':['id','name',_0x1024('0x57'),'voicePause',_0x1024('0x58')],'raw':!![]}]})['then'](function(_0x405d69){if(_0x405d69){var _0xfe5e09=_[_0x1024('0x59')](_0x405d69,function(_0x1b9208){var _0x2d3297=_0x1b9208['get']({'plain':!![]});return _0x2d3297[_0x1024('0x56')];});return db[_0x1024('0x21')][_0x1024('0x34')]({'where':{'id':_0x501f75[_0x1024('0x2c')]['id']}})[_0x1024('0x15')](function(_0x4ad773){return db[_0x1024('0x5a')][_0x1024('0x5b')](function(_0x19fe9c){return _0x4ad773[_0x1024('0x53')](_0x342a48,{'transaction':_0x19fe9c})[_0x1024('0x15')](function(){return BPromise[_0x1024('0x5c')](_0xfe5e09,function(_0x59da4c){return db[_0x1024('0x40')][_0x1024('0x5d')]({'where':{'UserId':_0x59da4c['id'],'ChatQueueId':_0x501f75[_0x1024('0x2c')]['id']},'transaction':_0x19fe9c});});})[_0x1024('0x15')](function(){_0xfe5e09['forEach'](function(_0xd013ef){socket['emit'](_0x1024('0x5e'),{'UserId':_0xd013ef['id'],'ChatQueueId':_0x4ad773['id']});});});});});}})[_0x1024('0x15')](respondWithStatusCode(_0x586f13,null))['catch'](handleError(_0x586f13,null));};exports['removeTeams']=function(_0x4990f7,_0x3e663d){return db[_0x1024('0x51')][_0x1024('0x29')]({'where':{'id':_0x4990f7['query'][_0x1024('0x54')]},'attributes':['id'],'include':[{'model':db[_0x1024('0x55')],'as':_0x1024('0x56'),'attributes':['id'],'raw':!![]}]})[_0x1024('0x15')](handleEntityNotFound(_0x3e663d,null))['then'](function(_0x685597){var _0x40da63=_[_0x1024('0x20')](_0x685597,'id');var _0x2d7bb3=[];var _0x3e4d8b=[];var _0x48aa1d=squel[_0x1024('0x5f')]();_0x48aa1d[_0x1024('0x60')](_0x1024('0x61'))[_0x1024('0x62')](_0x1024('0x63'),'tq')[_0x1024('0x64')](_0x1024('0x65'),'ut',_0x1024('0x66'))[_0x1024('0x45')](_0x1024('0x67'),_0x4990f7[_0x1024('0x2c')]['id']);for(var _0x9b833a=0x0;_0x9b833a<_0x685597[_0x1024('0x42')];_0x9b833a+=0x1){let _0x24b8f7=_0x685597[_0x9b833a];for(var _0x21cdbc=0x0;_0x21cdbc<_0x24b8f7['Agents']['length'];_0x21cdbc+=0x1){let _0x445f3c=_0x24b8f7['Agents'][_0x21cdbc];var _0x6e3769=_0x48aa1d['clone']();_0x6e3769[_0x1024('0x45')](_0x1024('0x68'),_0x445f3c['id']);_0x3e4d8b[_0x1024('0x69')](db['sequelize'][_0x1024('0x28')](_0x6e3769[_0x1024('0x6a')](),{'type':db[_0x1024('0x5a')][_0x1024('0x6b')][_0x1024('0x6c')]})[_0x1024('0x15')](function(_0xc7cbf1){if(_0xc7cbf1[_0x1024('0x42')]===0x1){return _0x445f3c['id'];}else{var _0x186667=_[_0x1024('0x6d')](_[_0x1024('0x20')](_0xc7cbf1,'TeamId'),function(_0x49b3b2){return _[_0x1024('0x6e')](_0x40da63,_0x49b3b2);});if(_0x186667){return _0x445f3c['id'];}}}));}}return BPromise[_0x1024('0x6f')](_0x3e4d8b)['then'](function(_0x2bfe0b){_0x2d7bb3=_(_0x2d7bb3)['union'](_0x2bfe0b)[_0x1024('0x70')]()[_0x1024('0x71')]();return db[_0x1024('0x21')][_0x1024('0x34')]({'where':{'id':_0x4990f7['params']['id']}})[_0x1024('0x15')](function(_0x1e0855){return db[_0x1024('0x5a')][_0x1024('0x5b')](function(_0x5626ec){return _0x1e0855[_0x1024('0x72')](_0x4990f7[_0x1024('0x28')][_0x1024('0x54')],{'transaction':_0x5626ec})['then'](function(){if(!_[_0x1024('0x73')](_0x2d7bb3)){return _0x1e0855[_0x1024('0x74')](_0x2d7bb3,{'transaction':_0x5626ec});}})[_0x1024('0x15')](function(){_0x2d7bb3[_0x1024('0x75')](function(_0x21b973){socket[_0x1024('0x76')](_0x1024('0x77'),{'UserId':_0x21b973,'ChatQueueId':_0x1e0855['id']});});});});});});})[_0x1024('0x15')](respondWithStatusCode(_0x3e663d,null))[_0x1024('0x2a')](handleError(_0x3e663d,null));};exports[_0x1024('0x78')]=function(_0x346fc3,_0x8dc37d){return db[_0x1024('0x21')][_0x1024('0x34')]({'where':{'id':_0x346fc3['params']['id']}})[_0x1024('0x15')](handleEntityNotFound(_0x8dc37d,null))['then'](function(_0x3f2a54){if(_0x3f2a54){return _0x3f2a54[_0x1024('0x78')](_0x346fc3[_0x1024('0x36')][_0x1024('0x54')],_['omit'](_0x346fc3['body'],['ids','id'])||{})[_0x1024('0x79')](function(_0x54d600){for(var _0xf919e8=0x0;_0xf919e8<_0x346fc3[_0x1024('0x36')][_0x1024('0x54')][_0x1024('0x42')];_0xf919e8+=0x1){socket[_0x1024('0x76')](_0x1024('0x5e'),{'UserId':Number(_0x346fc3[_0x1024('0x36')][_0x1024('0x54')][_0xf919e8]),'ChatQueueId':Number(_0x346fc3[_0x1024('0x2c')]['id'])});}return _0x54d600;});}})['then'](respondWithResult(_0x8dc37d,null))[_0x1024('0x2a')](handleError(_0x8dc37d,null));};exports['removeAgents']=function(_0x48565d,_0x51ff8d){return db[_0x1024('0x21')][_0x1024('0x34')]({'where':{'id':_0x48565d['params']['id']}})['then'](handleEntityNotFound(_0x51ff8d,null))[_0x1024('0x15')](function(_0x2ea0ab){if(_0x2ea0ab){return _0x2ea0ab[_0x1024('0x74')](_0x48565d[_0x1024('0x28')][_0x1024('0x54')])['then'](function(){if(_[_0x1024('0x7a')](_0x48565d[_0x1024('0x28')]['ids'])){for(var _0x24e4fe=0x0;_0x24e4fe<_0x48565d[_0x1024('0x28')][_0x1024('0x54')]['length'];_0x24e4fe+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x48565d['query'][_0x1024('0x54')][_0x24e4fe]),'ChatQueueId':Number(_0x48565d[_0x1024('0x2c')]['id'])});}}else{socket['emit'](_0x1024('0x77'),{'UserId':Number(_0x48565d[_0x1024('0x28')][_0x1024('0x54')]),'ChatQueueId':Number(_0x48565d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x51ff8d,null))['catch'](handleError(_0x51ff8d,null));};exports[_0x1024('0x7b')]=function(_0x11f941,_0x281081){var _0x1489bf={};var _0x54cd65={};var _0x3a198a;var _0x1cb020;return db[_0x1024('0x21')][_0x1024('0x3f')]({'where':{'id':_0x11f941[_0x1024('0x2c')]['id']}})[_0x1024('0x15')](handleEntityNotFound(_0x281081,null))[_0x1024('0x15')](function(_0x35b9c6){if(_0x35b9c6){_0x3a198a=_0x35b9c6;_0x54cd65['model']=_[_0x1024('0x2d')](db[_0x1024('0x55')][_0x1024('0x22')]);_0x54cd65['query']=_[_0x1024('0x2d')](_0x11f941[_0x1024('0x28')]);_0x54cd65[_0x1024('0x2e')]=_[_0x1024('0x41')](_0x54cd65['model'],_0x54cd65[_0x1024('0x28')]);_0x1489bf['attributes']=_[_0x1024('0x41')](_0x54cd65[_0x1024('0x2f')],qs[_0x1024('0x31')](_0x11f941[_0x1024('0x28')][_0x1024('0x31')]));_0x1489bf[_0x1024('0x30')]=_0x1489bf[_0x1024('0x30')][_0x1024('0x42')]?_0x1489bf[_0x1024('0x30')]:_0x54cd65['model'];_0x1489bf['order']=qs['sort'](_0x11f941['query']['sort']);_0x1489bf[_0x1024('0x45')]=qs[_0x1024('0x2e')](_[_0x1024('0x46')](_0x11f941['query'],_0x54cd65[_0x1024('0x2e')]));if(_0x11f941[_0x1024('0x28')][_0x1024('0x47')]){_0x1489bf[_0x1024('0x45')]=_['merge'](_0x1489bf[_0x1024('0x45')],{'$or':_[_0x1024('0x20')](_0x1489bf[_0x1024('0x30')],function(_0x49c12f){var _0x5a5ef3={};_0x5a5ef3[_0x49c12f]={'$like':'%'+_0x11f941[_0x1024('0x28')][_0x1024('0x47')]+'%'};return _0x5a5ef3;})});}_0x1489bf=_[_0x1024('0x32')]({},_0x1489bf,_0x11f941[_0x1024('0x33')]);return _0x3a198a[_0x1024('0x7b')](_0x1489bf);}})[_0x1024('0x15')](function(_0x21e3d8){if(_0x21e3d8){_0x1cb020=_0x21e3d8[_0x1024('0x42')];if(!_0x11f941['query']['hasOwnProperty'](_0x1024('0x44'))){_0x1489bf[_0x1024('0x10')]=qs[_0x1024('0x10')](_0x11f941['query'][_0x1024('0x10')]);_0x1489bf[_0x1024('0xf')]=qs[_0x1024('0xf')](_0x11f941[_0x1024('0x28')][_0x1024('0xf')]);}return _0x3a198a[_0x1024('0x7b')](_0x1489bf);}})['then'](function(_0x2f8cda){if(_0x2f8cda){return _0x2f8cda?{'count':_0x1cb020,'rows':_0x2f8cda}:null;}})[_0x1024('0x15')](respondWithResult(_0x281081,null))[_0x1024('0x2a')](handleError(_0x281081,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ec98f13..a86ab0a 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 _0x5c00=['ChatQueue','setMaxListeners','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x58d5da,_0xc00d8c){var _0x4f40a6=function(_0x3603ae){while(--_0x3603ae){_0x58d5da['push'](_0x58d5da['shift']());}};_0x4f40a6(++_0xc00d8c);}(_0x5c00,0x75));var _0x05c0=function(_0x4d2aea,_0x4a8f11){_0x4d2aea=_0x4d2aea-0x0;var _0x1715b8=_0x5c00[_0x4d2aea];return _0x1715b8;};'use strict';var EventEmitter=require(_0x05c0('0x0'));var ChatQueue=require(_0x05c0('0x1'))['db'][_0x05c0('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x05c0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a872e){return function(_0x3e997d,_0xc5a3c5,_0x4eba71){ChatQueueEvents['emit'](_0x4a872e+':'+_0x3e997d['id'],_0x3e997d);ChatQueueEvents[_0x05c0('0x4')](_0x4a872e,_0x3e997d);_0x4eba71(null);};}for(var e in events){if(events[_0x05c0('0x5')](e)){var event=events[e];ChatQueue[_0x05c0('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x62fb=['events','../../mysqldb','ChatQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1d7ed7,_0x3a5e6a){var _0x3fcf8d=function(_0x4c3cfe){while(--_0x4c3cfe){_0x1d7ed7['push'](_0x1d7ed7['shift']());}};_0x3fcf8d(++_0x3a5e6a);}(_0x62fb,0x172));var _0xb62f=function(_0x4f491e,_0xbd7715){_0x4f491e=_0x4f491e-0x0;var _0x24c954=_0x62fb[_0x4f491e];return _0x24c954;};'use strict';var EventEmitter=require(_0xb62f('0x0'));var ChatQueue=require(_0xb62f('0x1'))['db'][_0xb62f('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xb62f('0x3')](0x0);var events={'afterCreate':_0xb62f('0x4'),'afterUpdate':_0xb62f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x22e459){return function(_0x4ba244,_0x21de3f,_0x12fce1){ChatQueueEvents[_0xb62f('0x6')](_0x22e459+':'+_0x4ba244['id'],_0x4ba244);ChatQueueEvents[_0xb62f('0x6')](_0x22e459,_0x4ba244);_0x12fce1(null);};}for(var e in events){if(events[_0xb62f('0x7')](e)){var event=events[e];ChatQueue[_0xb62f('0x8')](e,emitEvent(event));}}module[_0xb62f('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 8911052..6ffae9f 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 _0x39c4=['rimraf','../../config/environment','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x15bb49,_0x58dbcf){var _0x4b3402=function(_0x4ad44e){while(--_0x4ad44e){_0x15bb49['push'](_0x15bb49['shift']());}};_0x4b3402(++_0x58dbcf);}(_0x39c4,0x1cd));var _0x439c=function(_0x3241cd,_0x1e4adb){_0x3241cd=_0x3241cd-0x0;var _0xa4803b=_0x39c4[_0x3241cd];return _0xa4803b;};'use strict';var _=require(_0x439c('0x0'));var util=require(_0x439c('0x1'));var logger=require(_0x439c('0x2'))(_0x439c('0x3'));var moment=require(_0x439c('0x4'));var BPromise=require(_0x439c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x439c('0x6'));var rimraf=require(_0x439c('0x7'));var config=require(_0x439c('0x8'));var attributes=require('./chatQueue.attributes');module[_0x439c('0x9')]=function(_0x2ceb1f,_0xe3cc83){return _0x2ceb1f[_0x439c('0xa')](_0x439c('0xb'),attributes,{'tableName':_0x439c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x311f=['ChatQueue','chat_queues','util','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3b6d96,_0x5d3241){var _0x1e6b1c=function(_0x200631){while(--_0x200631){_0x3b6d96['push'](_0x3b6d96['shift']());}};_0x1e6b1c(++_0x5d3241);}(_0x311f,0xc0));var _0xf311=function(_0x487fb9,_0x43c08e){_0x487fb9=_0x487fb9-0x0;var _0x44d36a=_0x311f[_0x487fb9];return _0x44d36a;};'use strict';var _=require('lodash');var util=require(_0xf311('0x0'));var logger=require('../../config/logger')(_0xf311('0x1'));var moment=require(_0xf311('0x2'));var BPromise=require('bluebird');var rp=require(_0xf311('0x3'));var fs=require('fs');var path=require(_0xf311('0x4'));var rimraf=require(_0xf311('0x5'));var config=require(_0xf311('0x6'));var attributes=require('./chatQueue.attributes');module[_0xf311('0x7')]=function(_0x1362b1,_0x54c7d7){return _0x1362b1['define'](_0xf311('0x8'),attributes,{'tableName':_0xf311('0x9'),'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 196b2b0..cae5450 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 _0x1cf6=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','raw','options','attributes','limit','map','include','stringify','find','where','model','ShowChatQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then'];(function(_0x1537dc,_0x2a6c1c){var _0x331ebb=function(_0x17f1bc){while(--_0x17f1bc){_0x1537dc['push'](_0x1537dc['shift']());}};_0x331ebb(++_0x2a6c1c);}(_0x1cf6,0x1a4));var _0x61cf=function(_0x1cc3d7,_0x5d18b2){_0x1cc3d7=_0x1cc3d7-0x0;var _0x15fe7f=_0x1cf6[_0x1cc3d7];return _0x15fe7f;};'use strict';var _=require('lodash');var util=require(_0x61cf('0x0'));var moment=require(_0x61cf('0x1'));var BPromise=require(_0x61cf('0x2'));var rs=require(_0x61cf('0x3'));var fs=require('fs');var Redis=require(_0x61cf('0x4'));var db=require(_0x61cf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x61cf('0x6'))(_0x61cf('0x7'));var config=require(_0x61cf('0x8'));var jayson=require(_0x61cf('0x9'));var client=jayson[_0x61cf('0xa')][_0x61cf('0xb')]({'port':0x232a});config[_0x61cf('0xc')]=_[_0x61cf('0xd')](config[_0x61cf('0xc')],{'host':_0x61cf('0xe'),'port':0x18eb});var socket=require(_0x61cf('0xf'))(new Redis(config[_0x61cf('0xc')]));require(_0x61cf('0x10'))[_0x61cf('0x11')](socket);function respondWithRpcPromise(_0x1aab6b,_0x43681d,_0x4b6ea4){return new BPromise(function(_0x24b82f,_0x4f6914){return client[_0x61cf('0x12')](_0x1aab6b,_0x4b6ea4)[_0x61cf('0x13')](function(_0x4b849d){logger[_0x61cf('0x14')](_0x61cf('0x15'),_0x43681d,_0x61cf('0x16'));logger[_0x61cf('0x17')](_0x61cf('0x18'),_0x43681d,'request\x20sent',JSON['stringify'](_0x4b849d));if(_0x4b849d[_0x61cf('0x19')]){if(_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1a')]===0x1f4){logger[_0x61cf('0x19')](_0x61cf('0x15'),_0x43681d,_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1b')]);return _0x4f6914(_0x4b849d['error'][_0x61cf('0x1b')]);}logger[_0x61cf('0x19')](_0x61cf('0x15'),_0x43681d,_0x4b849d[_0x61cf('0x19')][_0x61cf('0x1b')]);return _0x24b82f(_0x4b849d['error'][_0x61cf('0x1b')]);}else{logger[_0x61cf('0x14')](_0x61cf('0x15'),_0x43681d,_0x61cf('0x16'));_0x24b82f(_0x4b849d[_0x61cf('0x1c')][_0x61cf('0x1b')]);}})[_0x61cf('0x1d')](function(_0x5e203c){logger['error'](_0x61cf('0x15'),_0x43681d,_0x5e203c);_0x4f6914(_0x5e203c);});});}exports[_0x61cf('0x1e')]=function(_0x52cabf){var _0x15f8c1=this;return new Promise(function(_0x5bb38d,_0x508617){return db[_0x61cf('0x1f')][_0x61cf('0x20')]({'raw':_0x52cabf['options']?_0x52cabf['options'][_0x61cf('0x21')]===undefined?!![]:![]:!![],'where':_0x52cabf['options']?_0x52cabf[_0x61cf('0x22')]['where']||null:null,'attributes':_0x52cabf['options']?_0x52cabf[_0x61cf('0x22')][_0x61cf('0x23')]||null:null,'limit':_0x52cabf[_0x61cf('0x22')]?_0x52cabf[_0x61cf('0x22')][_0x61cf('0x24')]||null:null,'include':_0x52cabf[_0x61cf('0x22')]?_0x52cabf['options']['include']?_[_0x61cf('0x25')](_0x52cabf[_0x61cf('0x22')][_0x61cf('0x26')],function(_0x349e50){return{'model':db[_0x349e50['model']],'as':_0x349e50['as'],'attributes':_0x349e50[_0x61cf('0x23')],'include':_0x349e50[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x349e50[_0x61cf('0x26')],function(_0x533aa1){return{'model':db[_0x533aa1['model']],'as':_0x533aa1['as'],'attributes':_0x533aa1[_0x61cf('0x23')],'include':_0x533aa1[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x533aa1[_0x61cf('0x26')],function(_0x5368ba){return{'model':db[_0x5368ba['model']],'as':_0x5368ba['as'],'attributes':_0x5368ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e3e3d){logger[_0x61cf('0x14')](_0x61cf('0x1e'),_0x52cabf);logger[_0x61cf('0x17')]('GetChatQueue',_0x52cabf,JSON[_0x61cf('0x27')](_0x3e3e3d));_0x5bb38d(_0x3e3e3d);})[_0x61cf('0x1d')](function(_0x133e9f){logger['error'](_0x61cf('0x1e'),_0x133e9f[_0x61cf('0x1b')],_0x52cabf);_0x508617(_0x15f8c1[_0x61cf('0x19')](0x1f4,_0x133e9f[_0x61cf('0x1b')]));});});};exports['ShowChatQueue']=function(_0x1e29d7){var _0x2e0077=this;return new Promise(function(_0x2f4464,_0x3428de){return db[_0x61cf('0x1f')][_0x61cf('0x28')]({'raw':_0x1e29d7[_0x61cf('0x22')]?_0x1e29d7[_0x61cf('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x1e29d7[_0x61cf('0x22')]?_0x1e29d7[_0x61cf('0x22')][_0x61cf('0x29')]||null:null,'attributes':_0x1e29d7[_0x61cf('0x22')]?_0x1e29d7[_0x61cf('0x22')][_0x61cf('0x23')]||null:null,'include':_0x1e29d7['options']?_0x1e29d7[_0x61cf('0x22')][_0x61cf('0x26')]?_['map'](_0x1e29d7[_0x61cf('0x22')]['include'],function(_0x4a3467){return{'model':db[_0x4a3467['model']],'as':_0x4a3467['as'],'attributes':_0x4a3467[_0x61cf('0x23')],'include':_0x4a3467[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x4a3467['include'],function(_0x4437ea){return{'model':db[_0x4437ea[_0x61cf('0x2a')]],'as':_0x4437ea['as'],'attributes':_0x4437ea['attributes'],'include':_0x4437ea[_0x61cf('0x26')]?_[_0x61cf('0x25')](_0x4437ea[_0x61cf('0x26')],function(_0x318c76){return{'model':db[_0x318c76[_0x61cf('0x2a')]],'as':_0x318c76['as'],'attributes':_0x318c76[_0x61cf('0x23')]};}):[]};}):[]};}):[]:[]})[_0x61cf('0x13')](function(_0x162e35){logger['info']('ShowChatQueue',_0x1e29d7);logger['debug']('ShowChatQueue',_0x1e29d7,JSON[_0x61cf('0x27')](_0x162e35));_0x2f4464(_0x162e35);})[_0x61cf('0x1d')](function(_0x49331a){logger[_0x61cf('0x19')](_0x61cf('0x2b'),_0x49331a[_0x61cf('0x1b')],_0x1e29d7);_0x3428de(_0x2e0077[_0x61cf('0x19')](0x1f4,_0x49331a[_0x61cf('0x1b')]));});});}; \ No newline at end of file +var _0x8b26=['./chatQueue.socket','request','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','findAll','options','raw','where','attributes','include','model','map','then','ChatQueue','find','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x8b26,0x1f3));var _0x68b2=function(_0x3875b1,_0x47cf1a){_0x3875b1=_0x3875b1-0x0;var _0x1e9c55=_0x8b26[_0x3875b1];return _0x1e9c55;};'use strict';var _=require(_0x68b2('0x0'));var util=require(_0x68b2('0x1'));var moment=require(_0x68b2('0x2'));var BPromise=require('bluebird');var rs=require(_0x68b2('0x3'));var fs=require('fs');var Redis=require(_0x68b2('0x4'));var db=require(_0x68b2('0x5'))['db'];var utils=require(_0x68b2('0x6'));var logger=require(_0x68b2('0x7'))(_0x68b2('0x8'));var config=require(_0x68b2('0x9'));var jayson=require(_0x68b2('0xa'));var client=jayson[_0x68b2('0xb')][_0x68b2('0xc')]({'port':0x232a});config['redis']=_[_0x68b2('0xd')](config[_0x68b2('0xe')],{'host':_0x68b2('0xf'),'port':0x18eb});var socket=require(_0x68b2('0x10'))(new Redis(config['redis']));require(_0x68b2('0x11'))['register'](socket);function respondWithRpcPromise(_0x5d960c,_0x45e46b,_0x17fd91){return new BPromise(function(_0x179350,_0x4b31c6){return client[_0x68b2('0x12')](_0x5d960c,_0x17fd91)['then'](function(_0x5ef591){logger[_0x68b2('0x13')](_0x68b2('0x14'),_0x45e46b,_0x68b2('0x15'));logger[_0x68b2('0x16')](_0x68b2('0x17'),_0x45e46b,_0x68b2('0x15'),JSON[_0x68b2('0x18')](_0x5ef591));if(_0x5ef591[_0x68b2('0x19')]){if(_0x5ef591[_0x68b2('0x19')][_0x68b2('0x1a')]===0x1f4){logger[_0x68b2('0x19')]('ChatQueue,\x20%s,\x20%s',_0x45e46b,_0x5ef591[_0x68b2('0x19')][_0x68b2('0x1b')]);return _0x4b31c6(_0x5ef591[_0x68b2('0x19')][_0x68b2('0x1b')]);}logger[_0x68b2('0x19')]('ChatQueue,\x20%s,\x20%s',_0x45e46b,_0x5ef591[_0x68b2('0x19')]['message']);return _0x179350(_0x5ef591[_0x68b2('0x19')][_0x68b2('0x1b')]);}else{logger[_0x68b2('0x13')]('ChatQueue,\x20%s,\x20%s',_0x45e46b,'request\x20sent');_0x179350(_0x5ef591[_0x68b2('0x1c')][_0x68b2('0x1b')]);}})[_0x68b2('0x1d')](function(_0x5836a5){logger[_0x68b2('0x19')](_0x68b2('0x14'),_0x45e46b,_0x5836a5);_0x4b31c6(_0x5836a5);});});}exports[_0x68b2('0x1e')]=function(_0x28af4d){var _0x313704=this;return new Promise(function(_0x240c89,_0x8ddd65){return db['ChatQueue'][_0x68b2('0x1f')]({'raw':_0x28af4d[_0x68b2('0x20')]?_0x28af4d[_0x68b2('0x20')][_0x68b2('0x21')]===undefined?!![]:![]:!![],'where':_0x28af4d[_0x68b2('0x20')]?_0x28af4d['options'][_0x68b2('0x22')]||null:null,'attributes':_0x28af4d[_0x68b2('0x20')]?_0x28af4d[_0x68b2('0x20')][_0x68b2('0x23')]||null:null,'limit':_0x28af4d['options']?_0x28af4d[_0x68b2('0x20')]['limit']||null:null,'include':_0x28af4d[_0x68b2('0x20')]?_0x28af4d[_0x68b2('0x20')][_0x68b2('0x24')]?_['map'](_0x28af4d['options'][_0x68b2('0x24')],function(_0x4ecbb3){return{'model':db[_0x4ecbb3[_0x68b2('0x25')]],'as':_0x4ecbb3['as'],'attributes':_0x4ecbb3[_0x68b2('0x23')],'include':_0x4ecbb3[_0x68b2('0x24')]?_[_0x68b2('0x26')](_0x4ecbb3['include'],function(_0x219142){return{'model':db[_0x219142[_0x68b2('0x25')]],'as':_0x219142['as'],'attributes':_0x219142['attributes'],'include':_0x219142[_0x68b2('0x24')]?_['map'](_0x219142[_0x68b2('0x24')],function(_0x5a073b){return{'model':db[_0x5a073b[_0x68b2('0x25')]],'as':_0x5a073b['as'],'attributes':_0x5a073b[_0x68b2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x27')](function(_0x356899){logger[_0x68b2('0x13')]('GetChatQueue',_0x28af4d);logger[_0x68b2('0x16')](_0x68b2('0x1e'),_0x28af4d,JSON['stringify'](_0x356899));_0x240c89(_0x356899);})[_0x68b2('0x1d')](function(_0x4bdb95){logger[_0x68b2('0x19')](_0x68b2('0x1e'),_0x4bdb95[_0x68b2('0x1b')],_0x28af4d);_0x8ddd65(_0x313704[_0x68b2('0x19')](0x1f4,_0x4bdb95[_0x68b2('0x1b')]));});});};exports['ShowChatQueue']=function(_0x533586){var _0x36c81b=this;return new Promise(function(_0x6da681,_0x26dac1){return db[_0x68b2('0x28')][_0x68b2('0x29')]({'raw':_0x533586['options']?_0x533586[_0x68b2('0x20')][_0x68b2('0x21')]===undefined?!![]:![]:!![],'where':_0x533586[_0x68b2('0x20')]?_0x533586[_0x68b2('0x20')][_0x68b2('0x22')]||null:null,'attributes':_0x533586[_0x68b2('0x20')]?_0x533586['options'][_0x68b2('0x23')]||null:null,'include':_0x533586['options']?_0x533586[_0x68b2('0x20')][_0x68b2('0x24')]?_[_0x68b2('0x26')](_0x533586[_0x68b2('0x20')]['include'],function(_0x58552d){return{'model':db[_0x58552d[_0x68b2('0x25')]],'as':_0x58552d['as'],'attributes':_0x58552d[_0x68b2('0x23')],'include':_0x58552d[_0x68b2('0x24')]?_['map'](_0x58552d[_0x68b2('0x24')],function(_0x524fac){return{'model':db[_0x524fac[_0x68b2('0x25')]],'as':_0x524fac['as'],'attributes':_0x524fac[_0x68b2('0x23')],'include':_0x524fac[_0x68b2('0x24')]?_[_0x68b2('0x26')](_0x524fac[_0x68b2('0x24')],function(_0x23ca1b){return{'model':db[_0x23ca1b[_0x68b2('0x25')]],'as':_0x23ca1b['as'],'attributes':_0x23ca1b[_0x68b2('0x23')]};}):[]};}):[]};}):[]:[]})[_0x68b2('0x27')](function(_0x5c05ee){logger[_0x68b2('0x13')](_0x68b2('0x2a'),_0x533586);logger[_0x68b2('0x16')](_0x68b2('0x2a'),_0x533586,JSON[_0x68b2('0x18')](_0x5c05ee));_0x6da681(_0x5c05ee);})[_0x68b2('0x1d')](function(_0x3fdb97){logger[_0x68b2('0x19')](_0x68b2('0x2a'),_0x3fdb97[_0x68b2('0x1b')],_0x533586);_0x26dac1(_0x36c81b[_0x68b2('0x19')](0x1f4,_0x3fdb97[_0x68b2('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a0a4c18..e226723 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 _0x0faf=['update','emit','removeListener','length','chatQueue:','./chatQueue.events','remove'];(function(_0x41a804,_0xcde371){var _0x26870d=function(_0x46fb2a){while(--_0x46fb2a){_0x41a804['push'](_0x41a804['shift']());}};_0x26870d(++_0xcde371);}(_0x0faf,0x132));var _0xf0fa=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x0faf[_0x36d203];return _0x2f9e62;};'use strict';var ChatQueueEvents=require(_0xf0fa('0x0'));var events=['save',_0xf0fa('0x1'),_0xf0fa('0x2')];function createListener(_0x2c6207,_0x35a260){return function(_0xccb93e){_0x35a260[_0xf0fa('0x3')](_0x2c6207,_0xccb93e);};}function removeListener(_0x515b12,_0xc83253){return function(){ChatQueueEvents[_0xf0fa('0x4')](_0x515b12,_0xc83253);};}exports['register']=function(_0x3637a3){for(var _0x44ffa0=0x0,_0x25b5c4=events[_0xf0fa('0x5')];_0x44ffa0<_0x25b5c4;_0x44ffa0++){var _0x2db1d9=events[_0x44ffa0];var _0x587865=createListener(_0xf0fa('0x6')+_0x2db1d9,_0x3637a3);ChatQueueEvents['on'](_0x2db1d9,_0x587865);}}; \ No newline at end of file +var _0x425d=['./chatQueue.events','remove','update','emit','removeListener','register','length','chatQueue:'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x425d,0x1e0));var _0xd425=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0x425d[_0x2726ad];return _0xd87993;};'use strict';var ChatQueueEvents=require(_0xd425('0x0'));var events=['save',_0xd425('0x1'),_0xd425('0x2')];function createListener(_0x314a2b,_0x97e370){return function(_0x183caa){_0x97e370[_0xd425('0x3')](_0x314a2b,_0x183caa);};}function removeListener(_0x47043f,_0x596be7){return function(){ChatQueueEvents[_0xd425('0x4')](_0x47043f,_0x596be7);};}exports[_0xd425('0x5')]=function(_0xc4e080){for(var _0x36866e=0x0,_0x1d97d9=events[_0xd425('0x6')];_0x36866e<_0x1d97d9;_0x36866e++){var _0x50b061=events[_0x36866e];var _0xb6ba8e=createListener(_0xd425('0x7')+_0x50b061,_0xc4e080);ChatQueueEvents['on'](_0x50b061,_0xb6ba8e);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 30fc2a7..21852c8 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0xc2688f,_0x1f2382){var _0x5175b5=function(_0x546bdc){while(--_0x546bdc){_0xc2688f['push'](_0xc2688f['shift']());}};_0x5175b5(++_0x1f2382);}(_0x55ca,0x126));var _0xa55c=function(_0x154d1e,_0x1f705a){_0x154d1e=_0x154d1e-0x0;var _0x17568e=_0x55ca[_0x154d1e];return _0x17568e;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _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(_0x455944,_0x487e92){var _0x52f79e=function(_0x208418){while(--_0x208418){_0x455944['push'](_0x455944['shift']());}};_0x52f79e(++_0x487e92);}(_0xe14b,0x93));var _0xbe14=function(_0xa82c60,_0x3f05bf){_0xa82c60=_0xa82c60-0x0;var _0x291fef=_0xe14b[_0xa82c60];return _0x291fef;};'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 diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 633aaab..8ed0a16 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 _0x324d=['moment','sequelize','STRING','DATE'];(function(_0x5ab3df,_0x45435a){var _0x31eced=function(_0xabb4a6){while(--_0xabb4a6){_0x5ab3df['push'](_0x5ab3df['shift']());}};_0x31eced(++_0x45435a);}(_0x324d,0x170));var _0xd324=function(_0x2ade77,_0x2d8619){_0x2ade77=_0x2ade77-0x0;var _0x12ccdf=_0x324d[_0x2ade77];return _0x12ccdf;};'use strict';var moment=require(_0xd324('0x0'));var Sequelize=require(_0xd324('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd324('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd324('0x2')]},'joinAt':{'type':Sequelize[_0xd324('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd324('0x3')]},'exitAt':{'type':Sequelize[_0xd324('0x3')]},'reason':{'type':Sequelize[_0xd324('0x2')]}}; \ No newline at end of file +var _0xb85f=['STRING','DATE','sequelize','exports'];(function(_0x57d9a7,_0x2b6a19){var _0x5e02f1=function(_0x5aacc5){while(--_0x5aacc5){_0x57d9a7['push'](_0x57d9a7['shift']());}};_0x5e02f1(++_0x2b6a19);}(_0xb85f,0x132));var _0xfb85=function(_0xcc6ae,_0x11bc90){_0xcc6ae=_0xcc6ae-0x0;var _0x57e3a8=_0xb85f[_0xcc6ae];return _0x57e3a8;};'use strict';var moment=require('moment');var Sequelize=require(_0xfb85('0x0'));module[_0xfb85('0x1')]={'uniqueid':{'type':Sequelize[_0xfb85('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfb85('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xfb85('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 08133d9..bb929af 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 _0xbea5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','reject','save','update','then','error','name','index','map','ChatQueueReport','rawAttributes','fieldName','model','query','filters','intersection'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbea5,0x177));var _0x5bea=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0xbea5[_0x5093e9];return _0x4c9a22;};'use strict';var emlformat=require(_0x5bea('0x0'));var rimraf=require(_0x5bea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bea('0x2'));var rp=require(_0x5bea('0x3'));var moment=require(_0x5bea('0x4'));var BPromise=require(_0x5bea('0x5'));var Mustache=require(_0x5bea('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5bea('0x7'));var csv=require('to-csv');var ejs=require(_0x5bea('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5bea('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5bea('0xa'));var toCsv=require(_0x5bea('0xb'));var querystring=require(_0x5bea('0xc'));var Papa=require('papaparse');var Redis=require(_0x5bea('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5bea('0xe'));var hardwareService=require(_0x5bea('0xf'));var logger=require(_0x5bea('0x10'))(_0x5bea('0x11'));var utils=require(_0x5bea('0x12'));var config=require(_0x5bea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bea('0x14'))['db'];function respondWithStatusCode(_0x1f49a0,_0x5aef2d){_0x5aef2d=_0x5aef2d||0xcc;return function(_0x289d99){if(_0x289d99){return _0x1f49a0[_0x5bea('0x15')](_0x5aef2d);}return _0x1f49a0['status'](_0x5aef2d)[_0x5bea('0x16')]();};}function respondWithResult(_0x229e09,_0x26cfca){_0x26cfca=_0x26cfca||0xc8;return function(_0xda336a){if(_0xda336a){return _0x229e09[_0x5bea('0x17')](_0x26cfca)[_0x5bea('0x18')](_0xda336a);}};}function respondWithFilteredResult(_0x14d46c,_0x5e0518){return function(_0x492190){if(_0x492190){var _0x1ad017=typeof _0x5e0518[_0x5bea('0x19')]===_0x5bea('0x1a')&&typeof _0x5e0518['limit']===_0x5bea('0x1a');var _0x18d13f=_0x492190[_0x5bea('0x1b')];var _0x49ba83=_0x1ad017?0x0:_0x5e0518[_0x5bea('0x19')];var _0x23fa96=_0x1ad017?_0x492190['count']:_0x5e0518[_0x5bea('0x19')]+_0x5e0518['limit'];var _0xd0f100;if(_0x23fa96>=_0x18d13f){_0x23fa96=_0x18d13f;_0xd0f100=0xc8;}else{_0xd0f100=0xce;}_0x14d46c[_0x5bea('0x17')](_0xd0f100);return _0x14d46c[_0x5bea('0x1c')]('Content-Range',_0x49ba83+'-'+_0x23fa96+'/'+_0x18d13f)['json'](_0x492190);}return null;};}function patchUpdates(_0x4169e5){return function(_0x2bf974){try{jsonpatch[_0x5bea('0x1d')](_0x2bf974,_0x4169e5,!![]);}catch(_0x52f12e){return BPromise[_0x5bea('0x1e')](_0x52f12e);}return _0x2bf974[_0x5bea('0x1f')]();};}function saveUpdates(_0x146177,_0xda92cf){return function(_0x595ee1){if(_0x595ee1){return _0x595ee1[_0x5bea('0x20')](_0x146177)[_0x5bea('0x21')](function(_0xcc0685){return _0xcc0685;});}return null;};}function removeEntity(_0x245c81,_0x5984f8){return function(_0x406ac8){if(_0x406ac8){return _0x406ac8['destroy']()[_0x5bea('0x21')](function(){_0x245c81['status'](0xcc)[_0x5bea('0x16')]();});}};}function handleEntityNotFound(_0x10282f,_0x37b196){return function(_0x5a8361){if(!_0x5a8361){_0x10282f['sendStatus'](0x194);}return _0x5a8361;};}function handleError(_0x4de13e,_0x57cde3){_0x57cde3=_0x57cde3||0x1f4;return function(_0x4c0821){logger[_0x5bea('0x22')](_0x4c0821['stack']);if(_0x4c0821['name']){delete _0x4c0821[_0x5bea('0x23')];}_0x4de13e[_0x5bea('0x17')](_0x57cde3)['send'](_0x4c0821);};}exports[_0x5bea('0x24')]=function(_0x5db06b,_0x577cf3){var _0x1a784b={},_0x2e773a={},_0x10b5e6={'count':0x0,'rows':[]};var _0x102ffb=_[_0x5bea('0x25')](db[_0x5bea('0x26')][_0x5bea('0x27')],function(_0x2d2308){return{'name':_0x2d2308[_0x5bea('0x28')],'type':_0x2d2308['type']['key']};});_0x2e773a[_0x5bea('0x29')]=_[_0x5bea('0x25')](_0x102ffb,_0x5bea('0x23'));_0x2e773a[_0x5bea('0x2a')]=_['keys'](_0x5db06b[_0x5bea('0x2a')]);_0x2e773a[_0x5bea('0x2b')]=_[_0x5bea('0x2c')](_0x2e773a[_0x5bea('0x29')],_0x2e773a['query']);_0x1a784b[_0x5bea('0x2d')]=_[_0x5bea('0x2c')](_0x2e773a[_0x5bea('0x29')],qs['fields'](_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x2e')]));_0x1a784b[_0x5bea('0x2d')]=_0x1a784b[_0x5bea('0x2d')][_0x5bea('0x2f')]?_0x1a784b[_0x5bea('0x2d')]:_0x2e773a['model'];if(!_0x5db06b['query'][_0x5bea('0x30')](_0x5bea('0x31'))){_0x1a784b['limit']=qs[_0x5bea('0x32')](_0x5db06b['query'][_0x5bea('0x32')]);_0x1a784b[_0x5bea('0x19')]=qs['offset'](_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x19')]);}_0x1a784b[_0x5bea('0x33')]=qs['sort'](_0x5db06b['query'][_0x5bea('0x34')]);_0x1a784b[_0x5bea('0x35')]=qs[_0x5bea('0x2b')](_[_0x5bea('0x36')](_0x5db06b[_0x5bea('0x2a')],_0x2e773a['filters']),_0x102ffb);if(_0x5db06b[_0x5bea('0x2a')]['filter']){_0x1a784b[_0x5bea('0x35')]=_[_0x5bea('0x37')](_0x1a784b[_0x5bea('0x35')],{'$or':_[_0x5bea('0x25')](_0x102ffb,function(_0x475307){if(_0x475307['type']!==_0x5bea('0x38')){var _0x439e27={};_0x439e27[_0x475307[_0x5bea('0x23')]]={'$like':'%'+_0x5db06b[_0x5bea('0x2a')]['filter']+'%'};return _0x439e27;}})});}_0x1a784b=_[_0x5bea('0x37')]({},_0x1a784b,_0x5db06b[_0x5bea('0x39')]);var _0x291d60={'where':_0x1a784b[_0x5bea('0x35')]};return db[_0x5bea('0x26')]['count'](_0x291d60)[_0x5bea('0x21')](function(_0x35e9f4){_0x10b5e6['count']=_0x35e9f4;if(_0x5db06b[_0x5bea('0x2a')][_0x5bea('0x3a')]){_0x1a784b[_0x5bea('0x3b')]=[{'all':!![]}];}return db[_0x5bea('0x26')]['findAll'](_0x1a784b);})[_0x5bea('0x21')](function(_0x2e1976){_0x10b5e6[_0x5bea('0x3c')]=_0x2e1976;return _0x10b5e6;})[_0x5bea('0x21')](respondWithFilteredResult(_0x577cf3,_0x1a784b))[_0x5bea('0x3d')](handleError(_0x577cf3,null));};exports[_0x5bea('0x3e')]=function(_0x5610b2,_0x378bfb){var _0x52ce37={'raw':!![],'where':{'id':_0x5610b2[_0x5bea('0x3f')]['id']}},_0x1b6332={};_0x1b6332[_0x5bea('0x29')]=_[_0x5bea('0x40')](db['ChatQueueReport']['rawAttributes']);_0x1b6332['query']=_[_0x5bea('0x40')](_0x5610b2[_0x5bea('0x2a')]);_0x1b6332[_0x5bea('0x2b')]=_['intersection'](_0x1b6332[_0x5bea('0x29')],_0x1b6332[_0x5bea('0x2a')]);_0x52ce37[_0x5bea('0x2d')]=_['intersection'](_0x1b6332['model'],qs[_0x5bea('0x2e')](_0x5610b2['query'][_0x5bea('0x2e')]));_0x52ce37[_0x5bea('0x2d')]=_0x52ce37[_0x5bea('0x2d')][_0x5bea('0x2f')]?_0x52ce37['attributes']:_0x1b6332[_0x5bea('0x29')];if(_0x5610b2[_0x5bea('0x2a')][_0x5bea('0x3a')]){_0x52ce37[_0x5bea('0x3b')]=[{'all':!![]}];}_0x52ce37=_[_0x5bea('0x37')]({},_0x52ce37,_0x5610b2['options']);return db['ChatQueueReport'][_0x5bea('0x41')](_0x52ce37)[_0x5bea('0x21')](handleEntityNotFound(_0x378bfb,null))['then'](respondWithResult(_0x378bfb,null))[_0x5bea('0x3d')](handleError(_0x378bfb,null));};exports['create']=function(_0x2a6695,_0x455bcb){return db[_0x5bea('0x26')][_0x5bea('0x42')](_0x2a6695[_0x5bea('0x43')],{})[_0x5bea('0x21')](respondWithResult(_0x455bcb,0xc9))[_0x5bea('0x3d')](handleError(_0x455bcb,null));};exports[_0x5bea('0x20')]=function(_0x52af41,_0x4b6783){if(_0x52af41['body']['id']){delete _0x52af41[_0x5bea('0x43')]['id'];}return db[_0x5bea('0x26')]['find']({'where':{'id':_0x52af41[_0x5bea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4b6783,null))[_0x5bea('0x21')](saveUpdates(_0x52af41[_0x5bea('0x43')],null))['then'](respondWithResult(_0x4b6783,null))[_0x5bea('0x3d')](handleError(_0x4b6783,null));};exports[_0x5bea('0x44')]=function(_0xaa37af,_0x11f275){return db[_0x5bea('0x26')][_0x5bea('0x41')]({'where':{'id':_0xaa37af[_0x5bea('0x3f')]['id']}})['then'](handleEntityNotFound(_0x11f275,null))[_0x5bea('0x21')](removeEntity(_0x11f275,null))[_0x5bea('0x3d')](handleError(_0x11f275,null));};exports[_0x5bea('0x45')]=function(_0x3c4dd2,_0x2416b5){return db[_0x5bea('0x26')]['describe']()[_0x5bea('0x21')](respondWithResult(_0x2416b5,null))[_0x5bea('0x3d')](handleError(_0x2416b5,null));}; \ No newline at end of file +var _0x8458=['reject','update','then','destroy','error','stack','name','send','map','ChatQueueReport','fieldName','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x8458,0x1a5));var _0x8845=function(_0x8c52ba,_0x20a269){_0x8c52ba=_0x8c52ba-0x0;var _0x248eeb=_0x8458[_0x8c52ba];return _0x248eeb;};'use strict';var emlformat=require(_0x8845('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8845('0x1'));var jsonpatch=require(_0x8845('0x2'));var rp=require(_0x8845('0x3'));var moment=require(_0x8845('0x4'));var BPromise=require(_0x8845('0x5'));var Mustache=require('mustache');var util=require(_0x8845('0x6'));var path=require(_0x8845('0x7'));var sox=require(_0x8845('0x8'));var csv=require(_0x8845('0x9'));var ejs=require(_0x8845('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8845('0xb'));var squel=require('squel');var crypto=require(_0x8845('0xc'));var jsforce=require(_0x8845('0xd'));var deskjs=require(_0x8845('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8845('0xf'));var Papa=require(_0x8845('0x10'));var Redis=require('ioredis');var authService=require(_0x8845('0x11'));var qs=require(_0x8845('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8845('0x13'));var logger=require(_0x8845('0x14'))(_0x8845('0x15'));var utils=require(_0x8845('0x16'));var config=require(_0x8845('0x17'));var licenseUtil=require(_0x8845('0x18'));var db=require(_0x8845('0x19'))['db'];function respondWithStatusCode(_0x160380,_0x189cfc){_0x189cfc=_0x189cfc||0xcc;return function(_0x2b11dd){if(_0x2b11dd){return _0x160380[_0x8845('0x1a')](_0x189cfc);}return _0x160380[_0x8845('0x1b')](_0x189cfc)[_0x8845('0x1c')]();};}function respondWithResult(_0x2b9b36,_0x4a3a96){_0x4a3a96=_0x4a3a96||0xc8;return function(_0x110541){if(_0x110541){return _0x2b9b36[_0x8845('0x1b')](_0x4a3a96)['json'](_0x110541);}};}function respondWithFilteredResult(_0x2df404,_0x4138c4){return function(_0x15e80e){if(_0x15e80e){var _0x4e56d2=typeof _0x4138c4['offset']==='undefined'&&typeof _0x4138c4[_0x8845('0x1d')]===_0x8845('0x1e');var _0x41c8dc=_0x15e80e[_0x8845('0x1f')];var _0x10f1d5=_0x4e56d2?0x0:_0x4138c4[_0x8845('0x20')];var _0x433170=_0x4e56d2?_0x15e80e['count']:_0x4138c4['offset']+_0x4138c4['limit'];var _0x2afdda;if(_0x433170>=_0x41c8dc){_0x433170=_0x41c8dc;_0x2afdda=0xc8;}else{_0x2afdda=0xce;}_0x2df404[_0x8845('0x1b')](_0x2afdda);return _0x2df404[_0x8845('0x21')](_0x8845('0x22'),_0x10f1d5+'-'+_0x433170+'/'+_0x41c8dc)['json'](_0x15e80e);}return null;};}function patchUpdates(_0x2e94f5){return function(_0x5a5197){try{jsonpatch['apply'](_0x5a5197,_0x2e94f5,!![]);}catch(_0x1ccdca){return BPromise[_0x8845('0x23')](_0x1ccdca);}return _0x5a5197['save']();};}function saveUpdates(_0x450bfc,_0x23a0d3){return function(_0x597fc5){if(_0x597fc5){return _0x597fc5[_0x8845('0x24')](_0x450bfc)[_0x8845('0x25')](function(_0x2b7ad7){return _0x2b7ad7;});}return null;};}function removeEntity(_0x391972,_0x4e48b1){return function(_0x5cd766){if(_0x5cd766){return _0x5cd766[_0x8845('0x26')]()[_0x8845('0x25')](function(){_0x391972[_0x8845('0x1b')](0xcc)[_0x8845('0x1c')]();});}};}function handleEntityNotFound(_0x3d2fca,_0x18819c){return function(_0x37eea4){if(!_0x37eea4){_0x3d2fca[_0x8845('0x1a')](0x194);}return _0x37eea4;};}function handleError(_0x9f40e8,_0x21be51){_0x21be51=_0x21be51||0x1f4;return function(_0x3e1e6e){logger[_0x8845('0x27')](_0x3e1e6e[_0x8845('0x28')]);if(_0x3e1e6e[_0x8845('0x29')]){delete _0x3e1e6e[_0x8845('0x29')];}_0x9f40e8[_0x8845('0x1b')](_0x21be51)[_0x8845('0x2a')](_0x3e1e6e);};}exports['index']=function(_0x47dfff,_0x3a831f){var _0xd1f69e={},_0x26cae2={},_0x3cc594={'count':0x0,'rows':[]};var _0x26dd9e=_[_0x8845('0x2b')](db[_0x8845('0x2c')]['rawAttributes'],function(_0x2991cd){return{'name':_0x2991cd[_0x8845('0x2d')],'type':_0x2991cd['type'][_0x8845('0x2e')]};});_0x26cae2[_0x8845('0x2f')]=_[_0x8845('0x2b')](_0x26dd9e,_0x8845('0x29'));_0x26cae2[_0x8845('0x30')]=_[_0x8845('0x31')](_0x47dfff[_0x8845('0x30')]);_0x26cae2[_0x8845('0x32')]=_['intersection'](_0x26cae2['model'],_0x26cae2[_0x8845('0x30')]);_0xd1f69e[_0x8845('0x33')]=_['intersection'](_0x26cae2[_0x8845('0x2f')],qs[_0x8845('0x34')](_0x47dfff[_0x8845('0x30')]['fields']));_0xd1f69e['attributes']=_0xd1f69e[_0x8845('0x33')]['length']?_0xd1f69e[_0x8845('0x33')]:_0x26cae2[_0x8845('0x2f')];if(!_0x47dfff[_0x8845('0x30')]['hasOwnProperty'](_0x8845('0x35'))){_0xd1f69e[_0x8845('0x1d')]=qs[_0x8845('0x1d')](_0x47dfff['query'][_0x8845('0x1d')]);_0xd1f69e['offset']=qs[_0x8845('0x20')](_0x47dfff[_0x8845('0x30')][_0x8845('0x20')]);}_0xd1f69e[_0x8845('0x36')]=qs[_0x8845('0x37')](_0x47dfff[_0x8845('0x30')][_0x8845('0x37')]);_0xd1f69e[_0x8845('0x38')]=qs['filters'](_[_0x8845('0x39')](_0x47dfff['query'],_0x26cae2[_0x8845('0x32')]),_0x26dd9e);if(_0x47dfff['query'][_0x8845('0x3a')]){_0xd1f69e[_0x8845('0x38')]=_['merge'](_0xd1f69e[_0x8845('0x38')],{'$or':_['map'](_0x26dd9e,function(_0x1c08a3){if(_0x1c08a3[_0x8845('0x3b')]!==_0x8845('0x3c')){var _0x13d360={};_0x13d360[_0x1c08a3[_0x8845('0x29')]]={'$like':'%'+_0x47dfff[_0x8845('0x30')][_0x8845('0x3a')]+'%'};return _0x13d360;}})});}_0xd1f69e=_[_0x8845('0x3d')]({},_0xd1f69e,_0x47dfff[_0x8845('0x3e')]);var _0x1b967b={'where':_0xd1f69e['where']};return db[_0x8845('0x2c')]['count'](_0x1b967b)[_0x8845('0x25')](function(_0x39cfb6){_0x3cc594['count']=_0x39cfb6;if(_0x47dfff[_0x8845('0x30')][_0x8845('0x3f')]){_0xd1f69e[_0x8845('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x8845('0x41')](_0xd1f69e);})['then'](function(_0x4d3a05){_0x3cc594[_0x8845('0x42')]=_0x4d3a05;return _0x3cc594;})[_0x8845('0x25')](respondWithFilteredResult(_0x3a831f,_0xd1f69e))[_0x8845('0x43')](handleError(_0x3a831f,null));};exports[_0x8845('0x44')]=function(_0x17bff3,_0x3c19c0){var _0x5002c4={'raw':!![],'where':{'id':_0x17bff3[_0x8845('0x45')]['id']}},_0x4f576a={};_0x4f576a[_0x8845('0x2f')]=_[_0x8845('0x31')](db[_0x8845('0x2c')][_0x8845('0x46')]);_0x4f576a[_0x8845('0x30')]=_[_0x8845('0x31')](_0x17bff3[_0x8845('0x30')]);_0x4f576a['filters']=_[_0x8845('0x47')](_0x4f576a[_0x8845('0x2f')],_0x4f576a[_0x8845('0x30')]);_0x5002c4['attributes']=_[_0x8845('0x47')](_0x4f576a[_0x8845('0x2f')],qs[_0x8845('0x34')](_0x17bff3[_0x8845('0x30')][_0x8845('0x34')]));_0x5002c4[_0x8845('0x33')]=_0x5002c4['attributes']['length']?_0x5002c4[_0x8845('0x33')]:_0x4f576a[_0x8845('0x2f')];if(_0x17bff3['query'][_0x8845('0x3f')]){_0x5002c4[_0x8845('0x40')]=[{'all':!![]}];}_0x5002c4=_[_0x8845('0x3d')]({},_0x5002c4,_0x17bff3['options']);return db[_0x8845('0x2c')]['find'](_0x5002c4)['then'](handleEntityNotFound(_0x3c19c0,null))[_0x8845('0x25')](respondWithResult(_0x3c19c0,null))[_0x8845('0x43')](handleError(_0x3c19c0,null));};exports[_0x8845('0x48')]=function(_0x45c22e,_0x2d4ca6){return db[_0x8845('0x2c')]['create'](_0x45c22e[_0x8845('0x49')],{})['then'](respondWithResult(_0x2d4ca6,0xc9))[_0x8845('0x43')](handleError(_0x2d4ca6,null));};exports[_0x8845('0x24')]=function(_0x3bd655,_0x3dbe0a){if(_0x3bd655['body']['id']){delete _0x3bd655[_0x8845('0x49')]['id'];}return db[_0x8845('0x2c')][_0x8845('0x4a')]({'where':{'id':_0x3bd655[_0x8845('0x45')]['id']}})[_0x8845('0x25')](handleEntityNotFound(_0x3dbe0a,null))[_0x8845('0x25')](saveUpdates(_0x3bd655[_0x8845('0x49')],null))['then'](respondWithResult(_0x3dbe0a,null))[_0x8845('0x43')](handleError(_0x3dbe0a,null));};exports[_0x8845('0x26')]=function(_0x2e9ce6,_0x176356){return db[_0x8845('0x2c')]['find']({'where':{'id':_0x2e9ce6[_0x8845('0x45')]['id']}})[_0x8845('0x25')](handleEntityNotFound(_0x176356,null))[_0x8845('0x25')](removeEntity(_0x176356,null))['catch'](handleError(_0x176356,null));};exports[_0x8845('0x4b')]=function(_0x2f8f9e,_0x81f01a){return db[_0x8845('0x2c')][_0x8845('0x4b')]()[_0x8845('0x25')](respondWithResult(_0x81f01a,null))['catch'](handleError(_0x81f01a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index e863327..77cf8de 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x10789b,_0x2b544a){var _0x36cc2c=function(_0x1a6195){while(--_0x1a6195){_0x10789b['push'](_0x10789b['shift']());}};_0x36cc2c(++_0x2b544a);}(_0x757a,0xde));var _0xa757=function(_0x346389,_0x173521){_0x346389=_0x346389-0x0;var _0x4e0626=_0x757a[_0x346389];return _0x4e0626;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4b868d0..c483d91 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 _0x559a=['http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ChatQueueReport','create','body','options','then','CreateChatQueueReport','UpdateChatQueueReport','raw','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x137ad6,_0x48589b){var _0x52f0d4=function(_0x8bd426){while(--_0x8bd426){_0x137ad6['push'](_0x137ad6['shift']());}};_0x52f0d4(++_0x48589b);}(_0x559a,0xe3));var _0xa559=function(_0x4593aa,_0x377069){_0x4593aa=_0x4593aa-0x0;var _0x50228b=_0x559a[_0x4593aa];return _0x50228b;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require(_0xa559('0x2'));var BPromise=require(_0xa559('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa559('0x6'))(_0xa559('0x7'));var config=require(_0xa559('0x8'));var jayson=require(_0xa559('0x9'));var client=jayson[_0xa559('0xa')][_0xa559('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e5b9a,_0x159f55,_0x766adc){return new BPromise(function(_0x352428,_0x546c5a){return client[_0xa559('0xc')](_0x2e5b9a,_0x766adc)['then'](function(_0xb8ba66){logger[_0xa559('0xd')](_0xa559('0xe'),_0x159f55,_0xa559('0xf'));logger['debug'](_0xa559('0x10'),_0x159f55,_0xa559('0xf'),JSON[_0xa559('0x11')](_0xb8ba66));if(_0xb8ba66['error']){if(_0xb8ba66[_0xa559('0x12')][_0xa559('0x13')]===0x1f4){logger[_0xa559('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x159f55,_0xb8ba66[_0xa559('0x12')]['message']);return _0x546c5a(_0xb8ba66[_0xa559('0x12')]['message']);}logger[_0xa559('0x12')](_0xa559('0xe'),_0x159f55,_0xb8ba66[_0xa559('0x12')][_0xa559('0x14')]);return _0x352428(_0xb8ba66[_0xa559('0x12')][_0xa559('0x14')]);}else{logger['info'](_0xa559('0xe'),_0x159f55,_0xa559('0xf'));_0x352428(_0xb8ba66[_0xa559('0x15')][_0xa559('0x14')]);}})[_0xa559('0x16')](function(_0x2678db){logger[_0xa559('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x159f55,_0x2678db);_0x546c5a(_0x2678db);});});}exports['CreateChatQueueReport']=function(_0x108841){var _0x27036d=this;return new Promise(function(_0x1e1264,_0x392124){return db[_0xa559('0x17')][_0xa559('0x18')](_0x108841[_0xa559('0x19')],{'raw':_0x108841[_0xa559('0x1a')]?_0x108841[_0xa559('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xa559('0x1b')](function(_0x3647d5){logger[_0xa559('0xd')]('CreateChatQueueReport',_0x108841);logger['debug'](_0xa559('0x1c'),_0x108841,JSON[_0xa559('0x11')](_0x3647d5));_0x1e1264(_0x3647d5);})[_0xa559('0x16')](function(_0x113b5f){logger[_0xa559('0x12')]('CreateChatQueueReport',_0x113b5f[_0xa559('0x14')],_0x108841);_0x392124(_0x27036d[_0xa559('0x12')](0x1f4,_0x113b5f[_0xa559('0x14')]));});});};exports[_0xa559('0x1d')]=function(_0x17b856){var _0x20e3f6=this;return new Promise(function(_0x1343a7,_0x414322){return db['ChatQueueReport']['update'](_0x17b856[_0xa559('0x19')],{'raw':_0x17b856[_0xa559('0x1a')]?_0x17b856[_0xa559('0x1a')][_0xa559('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17b856[_0xa559('0x1a')]?_0x17b856[_0xa559('0x1a')][_0xa559('0x1f')]||null:null,'attributes':_0x17b856[_0xa559('0x1a')]?_0x17b856[_0xa559('0x1a')][_0xa559('0x20')]||null:null,'limit':_0x17b856[_0xa559('0x1a')]?_0x17b856[_0xa559('0x1a')][_0xa559('0x21')]||null:null})[_0xa559('0x1b')](function(_0x2bd71e){logger[_0xa559('0xd')]('UpdateChatQueueReport',_0x17b856);logger['debug'](_0xa559('0x1d'),_0x17b856,JSON[_0xa559('0x11')](_0x2bd71e));_0x1343a7(_0x2bd71e);})[_0xa559('0x16')](function(_0x3472c8){logger['error']('UpdateChatQueueReport',_0x3472c8[_0xa559('0x14')],_0x17b856);_0x414322(_0x20e3f6[_0xa559('0x12')](0x1f4,_0x3472c8[_0xa559('0x14')]));});});}; \ No newline at end of file +var _0x1a58=['UpdateChatQueueReport','update','where','attributes','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatQueueReport','create','options','raw','CreateChatQueueReport'];(function(_0xa37959,_0x1759fe){var _0x17c997=function(_0x3a5019){while(--_0x3a5019){_0xa37959['push'](_0xa37959['shift']());}};_0x17c997(++_0x1759fe);}(_0x1a58,0x1b6));var _0x81a5=function(_0x22c15a,_0x2d6084){_0x22c15a=_0x22c15a-0x0;var _0x1071ca=_0x1a58[_0x22c15a];return _0x1071ca;};'use strict';var _=require(_0x81a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x81a5('0x1'));var fs=require('fs');var Redis=require(_0x81a5('0x2'));var db=require(_0x81a5('0x3'))['db'];var utils=require(_0x81a5('0x4'));var logger=require(_0x81a5('0x5'))(_0x81a5('0x6'));var config=require(_0x81a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x81a5('0x8')][_0x81a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x882e6d,_0x230901,_0x2eefaf){return new BPromise(function(_0x5b6070,_0x2dafee){return client[_0x81a5('0xa')](_0x882e6d,_0x2eefaf)[_0x81a5('0xb')](function(_0x222675){logger[_0x81a5('0xc')](_0x81a5('0xd'),_0x230901,_0x81a5('0xe'));logger[_0x81a5('0xf')](_0x81a5('0x10'),_0x230901,_0x81a5('0xe'),JSON[_0x81a5('0x11')](_0x222675));if(_0x222675[_0x81a5('0x12')]){if(_0x222675[_0x81a5('0x12')][_0x81a5('0x13')]===0x1f4){logger[_0x81a5('0x12')](_0x81a5('0xd'),_0x230901,_0x222675[_0x81a5('0x12')][_0x81a5('0x14')]);return _0x2dafee(_0x222675[_0x81a5('0x12')][_0x81a5('0x14')]);}logger['error'](_0x81a5('0xd'),_0x230901,_0x222675[_0x81a5('0x12')]['message']);return _0x5b6070(_0x222675[_0x81a5('0x12')][_0x81a5('0x14')]);}else{logger[_0x81a5('0xc')](_0x81a5('0xd'),_0x230901,_0x81a5('0xe'));_0x5b6070(_0x222675['result']['message']);}})[_0x81a5('0x15')](function(_0x150d74){logger[_0x81a5('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x230901,_0x150d74);_0x2dafee(_0x150d74);});});}exports['CreateChatQueueReport']=function(_0x2c4cff){var _0x5ae466=this;return new Promise(function(_0x3fefc5,_0x21f32b){return db[_0x81a5('0x16')][_0x81a5('0x17')](_0x2c4cff['body'],{'raw':_0x2c4cff[_0x81a5('0x18')]?_0x2c4cff['options'][_0x81a5('0x19')]===undefined?!![]:![]:!![]})[_0x81a5('0xb')](function(_0x15093a){logger[_0x81a5('0xc')](_0x81a5('0x1a'),_0x2c4cff);logger[_0x81a5('0xf')](_0x81a5('0x1a'),_0x2c4cff,JSON['stringify'](_0x15093a));_0x3fefc5(_0x15093a);})[_0x81a5('0x15')](function(_0x33ff5c){logger[_0x81a5('0x12')]('CreateChatQueueReport',_0x33ff5c['message'],_0x2c4cff);_0x21f32b(_0x5ae466['error'](0x1f4,_0x33ff5c[_0x81a5('0x14')]));});});};exports[_0x81a5('0x1b')]=function(_0x46a3bc){var _0x25c55c=this;return new Promise(function(_0x3107fa,_0x2b3267){return db[_0x81a5('0x16')][_0x81a5('0x1c')](_0x46a3bc['body'],{'raw':_0x46a3bc['options']?_0x46a3bc[_0x81a5('0x18')][_0x81a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a3bc[_0x81a5('0x18')]?_0x46a3bc['options'][_0x81a5('0x1d')]||null:null,'attributes':_0x46a3bc[_0x81a5('0x18')]?_0x46a3bc[_0x81a5('0x18')][_0x81a5('0x1e')]||null:null,'limit':_0x46a3bc['options']?_0x46a3bc[_0x81a5('0x18')]['limit']||null:null})['then'](function(_0x24aeec){logger[_0x81a5('0xc')](_0x81a5('0x1b'),_0x46a3bc);logger[_0x81a5('0xf')](_0x81a5('0x1b'),_0x46a3bc,JSON['stringify'](_0x24aeec));_0x3107fa(_0x24aeec);})[_0x81a5('0x15')](function(_0x17dda2){logger['error'](_0x81a5('0x1b'),_0x17dda2[_0x81a5('0x14')],_0x46a3bc);_0x2b3267(_0x25c55c[_0x81a5('0x12')](0x1f4,_0x17dda2['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 6651fae..3327675 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 _0xfd29=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x1de023,_0x17334d){var _0x1b25ff=function(_0x2a1fee){while(--_0x2a1fee){_0x1de023['push'](_0x1de023['shift']());}};_0x1b25ff(++_0x17334d);}(_0xfd29,0x115));var _0x9fd2=function(_0x17a609,_0xa8f77c){_0x17a609=_0x17a609-0x0;var _0x589c17=_0xfd29[_0x17a609];return _0x589c17;};'use strict';var multer=require(_0x9fd2('0x0'));var util=require(_0x9fd2('0x1'));var path=require(_0x9fd2('0x2'));var timeout=require(_0x9fd2('0x3'));var express=require(_0x9fd2('0x4'));var router=express['Router']();var fs_extra=require(_0x9fd2('0x5'));var auth=require(_0x9fd2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9fd2('0x7'));var controller=require('./chatQueueReport.controller');router[_0x9fd2('0x8')]('/',auth[_0x9fd2('0x9')](),controller[_0x9fd2('0xa')]);router[_0x9fd2('0x8')](_0x9fd2('0xb'),auth[_0x9fd2('0x9')](),controller[_0x9fd2('0xc')]);router['get'](_0x9fd2('0xd'),auth[_0x9fd2('0x9')](),controller[_0x9fd2('0xe')]);router[_0x9fd2('0xf')]('/',auth[_0x9fd2('0x9')](),controller[_0x9fd2('0x10')]);router[_0x9fd2('0x11')](_0x9fd2('0xd'),auth['isAuthenticated'](),controller[_0x9fd2('0x12')]);router[_0x9fd2('0x13')](_0x9fd2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9fd2('0x14')]=router; \ No newline at end of file +var _0x8551=['put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0xa5fdf4,_0x553bc8){var _0x45a73d=function(_0x3d6276){while(--_0x3d6276){_0xa5fdf4['push'](_0xa5fdf4['shift']());}};_0x45a73d(++_0x553bc8);}(_0x8551,0x159));var _0x1855=function(_0xd24b43,_0x11caa4){_0xd24b43=_0xd24b43-0x0;var _0x2b1b44=_0x8551[_0xd24b43];return _0x2b1b44;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1855('0x0'));var express=require(_0x1855('0x1'));var router=express[_0x1855('0x2')]();var fs_extra=require(_0x1855('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1855('0x4'));var config=require('../../config/environment');var controller=require(_0x1855('0x5'));router[_0x1855('0x6')]('/',auth['isAuthenticated'](),controller[_0x1855('0x7')]);router[_0x1855('0x6')](_0x1855('0x8'),auth[_0x1855('0x9')](),controller[_0x1855('0xa')]);router['get'](_0x1855('0xb'),auth[_0x1855('0x9')](),controller[_0x1855('0xc')]);router[_0x1855('0xd')]('/',auth[_0x1855('0x9')](),controller[_0x1855('0xe')]);router[_0x1855('0xf')](_0x1855('0xb'),auth[_0x1855('0x9')](),controller[_0x1855('0x10')]);router[_0x1855('0x11')](_0x1855('0xb'),auth[_0x1855('0x9')](),controller[_0x1855('0x12')]);module[_0x1855('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 87b0900..f2eb892 100644 --- a/server/api/chatTransferReport/chatTransferReport.attributes.js +++ b/server/api/chatTransferReport/chatTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x2d1a50,_0x28e2fa){var _0x1363c7=function(_0x151f1c){while(--_0x151f1c){_0x2d1a50['push'](_0x2d1a50['shift']());}};_0x1363c7(++_0x28e2fa);}(_0xedd9,0xfc));var _0x9edd=function(_0x2bef51,_0x3549d3){_0x2bef51=_0x2bef51-0x0;var _0x29097d=_0xedd9[_0x2bef51];return _0x29097d;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3e1768,_0x2e9066){var _0x489604=function(_0x388f87){while(--_0x388f87){_0x3e1768['push'](_0x3e1768['shift']());}};_0x489604(++_0x2e9066);}(_0x70e0,0x17b));var _0x070e=function(_0x8635cc,_0x1bee82){_0x8635cc=_0x8635cc-0x0;var _0x27600a=_0x70e0[_0x8635cc];return _0x27600a;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 65578df..d831648 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 _0xe88f=['fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','rawAttributes','include','find','create','body','eml-format','rimraf'];(function(_0x3e1f51,_0x5bc2d8){var _0x5a541f=function(_0x38e78c){while(--_0x38e78c){_0x3e1f51['push'](_0x3e1f51['shift']());}};_0x5a541f(++_0x5bc2d8);}(_0xe88f,0xe5));var _0xfe88=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0xe88f[_0x42bc91];return _0x3f5507;};'use strict';var emlformat=require(_0xfe88('0x0'));var rimraf=require(_0xfe88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe88('0x2'));var rp=require(_0xfe88('0x3'));var moment=require('moment');var BPromise=require(_0xfe88('0x4'));var Mustache=require(_0xfe88('0x5'));var util=require('util');var path=require(_0xfe88('0x6'));var sox=require(_0xfe88('0x7'));var csv=require(_0xfe88('0x8'));var ejs=require(_0xfe88('0x9'));var fs=require('fs');var fs_extra=require(_0xfe88('0xa'));var _=require(_0xfe88('0xb'));var squel=require(_0xfe88('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe88('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfe88('0x8'));var querystring=require(_0xfe88('0xe'));var Papa=require(_0xfe88('0xf'));var Redis=require(_0xfe88('0x10'));var authService=require(_0xfe88('0x11'));var qs=require(_0xfe88('0x12'));var as=require(_0xfe88('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfe88('0x14'));var utils=require(_0xfe88('0x15'));var config=require(_0xfe88('0x16'));var licenseUtil=require(_0xfe88('0x17'));var db=require(_0xfe88('0x18'))['db'];function respondWithStatusCode(_0x17fa0c,_0x2b6562){_0x2b6562=_0x2b6562||0xcc;return function(_0x2e4aa1){if(_0x2e4aa1){return _0x17fa0c['sendStatus'](_0x2b6562);}return _0x17fa0c[_0xfe88('0x19')](_0x2b6562)[_0xfe88('0x1a')]();};}function respondWithResult(_0x2f90fa,_0x211296){_0x211296=_0x211296||0xc8;return function(_0x4ac4e8){if(_0x4ac4e8){return _0x2f90fa['status'](_0x211296)['json'](_0x4ac4e8);}};}function respondWithFilteredResult(_0x56b23a,_0x3e2427){return function(_0x4ef49b){if(_0x4ef49b){var _0x3c9e44=typeof _0x3e2427[_0xfe88('0x1b')]===_0xfe88('0x1c')&&typeof _0x3e2427['limit']===_0xfe88('0x1c');var _0x47b4c3=_0x4ef49b[_0xfe88('0x1d')];var _0x35d290=_0x3c9e44?0x0:_0x3e2427[_0xfe88('0x1b')];var _0x24d2de=_0x3c9e44?_0x4ef49b[_0xfe88('0x1d')]:_0x3e2427[_0xfe88('0x1b')]+_0x3e2427[_0xfe88('0x1e')];var _0x1dcb33;if(_0x24d2de>=_0x47b4c3){_0x24d2de=_0x47b4c3;_0x1dcb33=0xc8;}else{_0x1dcb33=0xce;}_0x56b23a[_0xfe88('0x19')](_0x1dcb33);return _0x56b23a[_0xfe88('0x1f')](_0xfe88('0x20'),_0x35d290+'-'+_0x24d2de+'/'+_0x47b4c3)['json'](_0x4ef49b);}return null;};}function patchUpdates(_0x1406e){return function(_0x2d2624){try{jsonpatch[_0xfe88('0x21')](_0x2d2624,_0x1406e,!![]);}catch(_0x10e7b7){return BPromise[_0xfe88('0x22')](_0x10e7b7);}return _0x2d2624[_0xfe88('0x23')]();};}function saveUpdates(_0x2afcc6,_0x1248f4){return function(_0x42ba39){if(_0x42ba39){return _0x42ba39[_0xfe88('0x24')](_0x2afcc6)[_0xfe88('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2f209b,_0x388d87){return function(_0x239a2d){if(_0x239a2d){return _0x239a2d[_0xfe88('0x26')]()['then'](function(){_0x2f209b[_0xfe88('0x19')](0xcc)[_0xfe88('0x1a')]();});}};}function handleEntityNotFound(_0x435cc2,_0x3cceae){return function(_0x439718){if(!_0x439718){_0x435cc2[_0xfe88('0x27')](0x194);}return _0x439718;};}function handleError(_0x105a46,_0x177d68){_0x177d68=_0x177d68||0x1f4;return function(_0x711cd0){logger[_0xfe88('0x28')](_0x711cd0[_0xfe88('0x29')]);if(_0x711cd0['name']){delete _0x711cd0[_0xfe88('0x2a')];}_0x105a46[_0xfe88('0x19')](_0x177d68)[_0xfe88('0x2b')](_0x711cd0);};}exports[_0xfe88('0x2c')]=function(_0x474455,_0x3ceb8e){var _0xc8f6b6={},_0x390897={},_0x3ce4f8={'count':0x0,'rows':[]};var _0x2c7211=_[_0xfe88('0x2d')](db[_0xfe88('0x2e')]['rawAttributes'],function(_0xc3ec23){return{'name':_0xc3ec23[_0xfe88('0x2f')],'type':_0xc3ec23[_0xfe88('0x30')][_0xfe88('0x31')]};});_0x390897[_0xfe88('0x32')]=_[_0xfe88('0x2d')](_0x2c7211,'name');_0x390897[_0xfe88('0x33')]=_[_0xfe88('0x34')](_0x474455[_0xfe88('0x33')]);_0x390897['filters']=_[_0xfe88('0x35')](_0x390897[_0xfe88('0x32')],_0x390897[_0xfe88('0x33')]);_0xc8f6b6['attributes']=_[_0xfe88('0x35')](_0x390897[_0xfe88('0x32')],qs[_0xfe88('0x36')](_0x474455[_0xfe88('0x33')][_0xfe88('0x36')]));_0xc8f6b6['attributes']=_0xc8f6b6['attributes'][_0xfe88('0x37')]?_0xc8f6b6[_0xfe88('0x38')]:_0x390897[_0xfe88('0x32')];if(!_0x474455[_0xfe88('0x33')][_0xfe88('0x39')](_0xfe88('0x3a'))){_0xc8f6b6[_0xfe88('0x1e')]=qs[_0xfe88('0x1e')](_0x474455['query']['limit']);_0xc8f6b6[_0xfe88('0x1b')]=qs[_0xfe88('0x1b')](_0x474455['query']['offset']);}_0xc8f6b6[_0xfe88('0x3b')]=qs[_0xfe88('0x3c')](_0x474455[_0xfe88('0x33')]['sort']);_0xc8f6b6[_0xfe88('0x3d')]=qs[_0xfe88('0x3e')](_[_0xfe88('0x3f')](_0x474455[_0xfe88('0x33')],_0x390897[_0xfe88('0x3e')]),_0x2c7211);if(_0x474455[_0xfe88('0x33')]['filter']){_0xc8f6b6[_0xfe88('0x3d')]=_[_0xfe88('0x40')](_0xc8f6b6[_0xfe88('0x3d')],{'$or':_['map'](_0x2c7211,function(_0x547e1f){if(_0x547e1f['type']!==_0xfe88('0x41')){var _0x5750e8={};_0x5750e8[_0x547e1f[_0xfe88('0x2a')]]={'$like':'%'+_0x474455['query'][_0xfe88('0x42')]+'%'};return _0x5750e8;}})});}_0xc8f6b6=_[_0xfe88('0x40')]({},_0xc8f6b6,_0x474455[_0xfe88('0x43')]);var _0x27ef56={'where':_0xc8f6b6['where']};return db['ChatTransferReport'][_0xfe88('0x1d')](_0x27ef56)[_0xfe88('0x25')](function(_0x31cb33){_0x3ce4f8[_0xfe88('0x1d')]=_0x31cb33;if(_0x474455[_0xfe88('0x33')][_0xfe88('0x44')]){_0xc8f6b6['include']=[{'all':!![]}];}return db[_0xfe88('0x2e')]['findAll'](_0xc8f6b6);})[_0xfe88('0x25')](function(_0x5bdc76){_0x3ce4f8[_0xfe88('0x45')]=_0x5bdc76;return _0x3ce4f8;})[_0xfe88('0x25')](respondWithFilteredResult(_0x3ceb8e,_0xc8f6b6))[_0xfe88('0x46')](handleError(_0x3ceb8e,null));};exports['show']=function(_0x9e8821,_0x9baa75){var _0x459648={'raw':!![],'where':{'id':_0x9e8821[_0xfe88('0x47')]['id']}},_0x3f9a2c={};_0x3f9a2c[_0xfe88('0x32')]=_['keys'](db[_0xfe88('0x2e')][_0xfe88('0x48')]);_0x3f9a2c[_0xfe88('0x33')]=_[_0xfe88('0x34')](_0x9e8821[_0xfe88('0x33')]);_0x3f9a2c[_0xfe88('0x3e')]=_[_0xfe88('0x35')](_0x3f9a2c[_0xfe88('0x32')],_0x3f9a2c[_0xfe88('0x33')]);_0x459648[_0xfe88('0x38')]=_[_0xfe88('0x35')](_0x3f9a2c[_0xfe88('0x32')],qs[_0xfe88('0x36')](_0x9e8821[_0xfe88('0x33')][_0xfe88('0x36')]));_0x459648['attributes']=_0x459648[_0xfe88('0x38')][_0xfe88('0x37')]?_0x459648['attributes']:_0x3f9a2c['model'];if(_0x9e8821[_0xfe88('0x33')][_0xfe88('0x44')]){_0x459648[_0xfe88('0x49')]=[{'all':!![]}];}_0x459648=_['merge']({},_0x459648,_0x9e8821[_0xfe88('0x43')]);return db[_0xfe88('0x2e')][_0xfe88('0x4a')](_0x459648)[_0xfe88('0x25')](handleEntityNotFound(_0x9baa75,null))['then'](respondWithResult(_0x9baa75,null))['catch'](handleError(_0x9baa75,null));};exports[_0xfe88('0x4b')]=function(_0x57e8b9,_0x645229){return db[_0xfe88('0x2e')][_0xfe88('0x4b')](_0x57e8b9['body'],{})[_0xfe88('0x25')](respondWithResult(_0x645229,0xc9))['catch'](handleError(_0x645229,null));};exports[_0xfe88('0x24')]=function(_0x187f07,_0x55177d){if(_0x187f07['body']['id']){delete _0x187f07['body']['id'];}return db[_0xfe88('0x2e')][_0xfe88('0x4a')]({'where':{'id':_0x187f07[_0xfe88('0x47')]['id']}})[_0xfe88('0x25')](handleEntityNotFound(_0x55177d,null))[_0xfe88('0x25')](saveUpdates(_0x187f07[_0xfe88('0x4c')],null))[_0xfe88('0x25')](respondWithResult(_0x55177d,null))[_0xfe88('0x46')](handleError(_0x55177d,null));};exports[_0xfe88('0x26')]=function(_0x205e19,_0xd8982a){return db['ChatTransferReport'][_0xfe88('0x4a')]({'where':{'id':_0x205e19[_0xfe88('0x47')]['id']}})[_0xfe88('0x25')](handleEntityNotFound(_0xd8982a,null))[_0xfe88('0x25')](removeEntity(_0xd8982a,null))[_0xfe88('0x46')](handleError(_0xd8982a,null));};exports['describe']=function(_0x1b22df,_0x2747d7){return db[_0xfe88('0x2e')]['describe']()[_0xfe88('0x25')](respondWithResult(_0x2747d7,null))[_0xfe88('0x46')](handleError(_0x2747d7,null));}; \ No newline at end of file +var _0x1d63=['rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','ChatTransferReport','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d63,0x13c));var _0x31d6=function(_0x4744f4,_0x515ab0){_0x4744f4=_0x4744f4-0x0;var _0x2c4640=_0x1d63[_0x4744f4];return _0x2c4640;};'use strict';var emlformat=require(_0x31d6('0x0'));var rimraf=require(_0x31d6('0x1'));var zipdir=require(_0x31d6('0x2'));var jsonpatch=require(_0x31d6('0x3'));var rp=require(_0x31d6('0x4'));var moment=require(_0x31d6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31d6('0x6'));var util=require(_0x31d6('0x7'));var path=require(_0x31d6('0x8'));var sox=require('sox');var csv=require(_0x31d6('0x9'));var ejs=require(_0x31d6('0xa'));var fs=require('fs');var fs_extra=require(_0x31d6('0xb'));var _=require(_0x31d6('0xc'));var squel=require(_0x31d6('0xd'));var crypto=require(_0x31d6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x31d6('0xf'));var toCsv=require(_0x31d6('0x9'));var querystring=require(_0x31d6('0x10'));var Papa=require(_0x31d6('0x11'));var Redis=require(_0x31d6('0x12'));var authService=require(_0x31d6('0x13'));var qs=require(_0x31d6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x31d6('0x15'));var logger=require('../../config/logger')(_0x31d6('0x16'));var utils=require(_0x31d6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x31d6('0x18'));var db=require(_0x31d6('0x19'))['db'];function respondWithStatusCode(_0x4526c1,_0x4bd034){_0x4bd034=_0x4bd034||0xcc;return function(_0x2b6181){if(_0x2b6181){return _0x4526c1['sendStatus'](_0x4bd034);}return _0x4526c1[_0x31d6('0x1a')](_0x4bd034)[_0x31d6('0x1b')]();};}function respondWithResult(_0x5336a5,_0x5e11fd){_0x5e11fd=_0x5e11fd||0xc8;return function(_0x53fc0d){if(_0x53fc0d){return _0x5336a5[_0x31d6('0x1a')](_0x5e11fd)[_0x31d6('0x1c')](_0x53fc0d);}};}function respondWithFilteredResult(_0x3b5160,_0x565f0f){return function(_0x2c97c9){if(_0x2c97c9){var _0x291685=typeof _0x565f0f[_0x31d6('0x1d')]===_0x31d6('0x1e')&&typeof _0x565f0f['limit']===_0x31d6('0x1e');var _0x394692=_0x2c97c9[_0x31d6('0x1f')];var _0x1b1b77=_0x291685?0x0:_0x565f0f[_0x31d6('0x1d')];var _0x3a4857=_0x291685?_0x2c97c9[_0x31d6('0x1f')]:_0x565f0f[_0x31d6('0x1d')]+_0x565f0f[_0x31d6('0x20')];var _0x6122fd;if(_0x3a4857>=_0x394692){_0x3a4857=_0x394692;_0x6122fd=0xc8;}else{_0x6122fd=0xce;}_0x3b5160[_0x31d6('0x1a')](_0x6122fd);return _0x3b5160[_0x31d6('0x21')](_0x31d6('0x22'),_0x1b1b77+'-'+_0x3a4857+'/'+_0x394692)['json'](_0x2c97c9);}return null;};}function patchUpdates(_0x46ab30){return function(_0x5e5705){try{jsonpatch[_0x31d6('0x23')](_0x5e5705,_0x46ab30,!![]);}catch(_0x25a64c){return BPromise[_0x31d6('0x24')](_0x25a64c);}return _0x5e5705[_0x31d6('0x25')]();};}function saveUpdates(_0x33cf6c,_0x3e8415){return function(_0x473746){if(_0x473746){return _0x473746[_0x31d6('0x26')](_0x33cf6c)['then'](function(_0x56e3bc){return _0x56e3bc;});}return null;};}function removeEntity(_0x5e3120,_0x5a78e8){return function(_0x1091d2){if(_0x1091d2){return _0x1091d2[_0x31d6('0x27')]()[_0x31d6('0x28')](function(){_0x5e3120[_0x31d6('0x1a')](0xcc)[_0x31d6('0x1b')]();});}};}function handleEntityNotFound(_0xb62601,_0x3052ef){return function(_0x210162){if(!_0x210162){_0xb62601[_0x31d6('0x29')](0x194);}return _0x210162;};}function handleError(_0x18a8bb,_0x2a04b0){_0x2a04b0=_0x2a04b0||0x1f4;return function(_0x2d7c12){logger[_0x31d6('0x2a')](_0x2d7c12[_0x31d6('0x2b')]);if(_0x2d7c12[_0x31d6('0x2c')]){delete _0x2d7c12[_0x31d6('0x2c')];}_0x18a8bb[_0x31d6('0x1a')](_0x2a04b0)['send'](_0x2d7c12);};}exports['index']=function(_0x481b34,_0x17bc47){var _0x162ad8={},_0x4ed85a={},_0x2c8316={'count':0x0,'rows':[]};var _0xe70926=_[_0x31d6('0x2d')](db['ChatTransferReport'][_0x31d6('0x2e')],function(_0x37581c){return{'name':_0x37581c[_0x31d6('0x2f')],'type':_0x37581c[_0x31d6('0x30')]['key']};});_0x4ed85a['model']=_['map'](_0xe70926,_0x31d6('0x2c'));_0x4ed85a[_0x31d6('0x31')]=_[_0x31d6('0x32')](_0x481b34['query']);_0x4ed85a[_0x31d6('0x33')]=_[_0x31d6('0x34')](_0x4ed85a[_0x31d6('0x35')],_0x4ed85a[_0x31d6('0x31')]);_0x162ad8['attributes']=_[_0x31d6('0x34')](_0x4ed85a[_0x31d6('0x35')],qs[_0x31d6('0x36')](_0x481b34[_0x31d6('0x31')][_0x31d6('0x36')]));_0x162ad8[_0x31d6('0x37')]=_0x162ad8['attributes'][_0x31d6('0x38')]?_0x162ad8[_0x31d6('0x37')]:_0x4ed85a[_0x31d6('0x35')];if(!_0x481b34[_0x31d6('0x31')][_0x31d6('0x39')](_0x31d6('0x3a'))){_0x162ad8[_0x31d6('0x20')]=qs['limit'](_0x481b34[_0x31d6('0x31')]['limit']);_0x162ad8[_0x31d6('0x1d')]=qs[_0x31d6('0x1d')](_0x481b34[_0x31d6('0x31')]['offset']);}_0x162ad8[_0x31d6('0x3b')]=qs[_0x31d6('0x3c')](_0x481b34['query'][_0x31d6('0x3c')]);_0x162ad8[_0x31d6('0x3d')]=qs[_0x31d6('0x33')](_['pick'](_0x481b34['query'],_0x4ed85a[_0x31d6('0x33')]),_0xe70926);if(_0x481b34[_0x31d6('0x31')]['filter']){_0x162ad8[_0x31d6('0x3d')]=_[_0x31d6('0x3e')](_0x162ad8[_0x31d6('0x3d')],{'$or':_[_0x31d6('0x2d')](_0xe70926,function(_0x3ab4e6){if(_0x3ab4e6[_0x31d6('0x30')]!==_0x31d6('0x3f')){var _0x20d3e8={};_0x20d3e8[_0x3ab4e6[_0x31d6('0x2c')]]={'$like':'%'+_0x481b34['query'][_0x31d6('0x40')]+'%'};return _0x20d3e8;}})});}_0x162ad8=_[_0x31d6('0x3e')]({},_0x162ad8,_0x481b34[_0x31d6('0x41')]);var _0x3399f3={'where':_0x162ad8[_0x31d6('0x3d')]};return db[_0x31d6('0x42')]['count'](_0x3399f3)[_0x31d6('0x28')](function(_0x172be9){_0x2c8316['count']=_0x172be9;if(_0x481b34['query'][_0x31d6('0x43')]){_0x162ad8[_0x31d6('0x44')]=[{'all':!![]}];}return db[_0x31d6('0x42')]['findAll'](_0x162ad8);})[_0x31d6('0x28')](function(_0x4329dd){_0x2c8316[_0x31d6('0x45')]=_0x4329dd;return _0x2c8316;})[_0x31d6('0x28')](respondWithFilteredResult(_0x17bc47,_0x162ad8))[_0x31d6('0x46')](handleError(_0x17bc47,null));};exports[_0x31d6('0x47')]=function(_0x3b8379,_0x173c82){var _0x5653b7={'raw':!![],'where':{'id':_0x3b8379[_0x31d6('0x48')]['id']}},_0x2b4055={};_0x2b4055[_0x31d6('0x35')]=_[_0x31d6('0x32')](db[_0x31d6('0x42')][_0x31d6('0x2e')]);_0x2b4055[_0x31d6('0x31')]=_[_0x31d6('0x32')](_0x3b8379[_0x31d6('0x31')]);_0x2b4055['filters']=_[_0x31d6('0x34')](_0x2b4055['model'],_0x2b4055[_0x31d6('0x31')]);_0x5653b7[_0x31d6('0x37')]=_[_0x31d6('0x34')](_0x2b4055[_0x31d6('0x35')],qs[_0x31d6('0x36')](_0x3b8379['query'][_0x31d6('0x36')]));_0x5653b7['attributes']=_0x5653b7[_0x31d6('0x37')][_0x31d6('0x38')]?_0x5653b7[_0x31d6('0x37')]:_0x2b4055[_0x31d6('0x35')];if(_0x3b8379['query'][_0x31d6('0x43')]){_0x5653b7['include']=[{'all':!![]}];}_0x5653b7=_[_0x31d6('0x3e')]({},_0x5653b7,_0x3b8379[_0x31d6('0x41')]);return db[_0x31d6('0x42')][_0x31d6('0x49')](_0x5653b7)[_0x31d6('0x28')](handleEntityNotFound(_0x173c82,null))[_0x31d6('0x28')](respondWithResult(_0x173c82,null))['catch'](handleError(_0x173c82,null));};exports['create']=function(_0x491ff1,_0x4844fc){return db['ChatTransferReport'][_0x31d6('0x4a')](_0x491ff1[_0x31d6('0x4b')],{})[_0x31d6('0x28')](respondWithResult(_0x4844fc,0xc9))[_0x31d6('0x46')](handleError(_0x4844fc,null));};exports[_0x31d6('0x26')]=function(_0xbe0dd5,_0x3c2fb0){if(_0xbe0dd5[_0x31d6('0x4b')]['id']){delete _0xbe0dd5[_0x31d6('0x4b')]['id'];}return db['ChatTransferReport'][_0x31d6('0x49')]({'where':{'id':_0xbe0dd5[_0x31d6('0x48')]['id']}})[_0x31d6('0x28')](handleEntityNotFound(_0x3c2fb0,null))[_0x31d6('0x28')](saveUpdates(_0xbe0dd5['body'],null))['then'](respondWithResult(_0x3c2fb0,null))['catch'](handleError(_0x3c2fb0,null));};exports[_0x31d6('0x27')]=function(_0x3fbaa4,_0x14a71f){return db['ChatTransferReport'][_0x31d6('0x49')]({'where':{'id':_0x3fbaa4[_0x31d6('0x48')]['id']}})[_0x31d6('0x28')](handleEntityNotFound(_0x14a71f,null))[_0x31d6('0x28')](removeEntity(_0x14a71f,null))[_0x31d6('0x46')](handleError(_0x14a71f,null));};exports[_0x31d6('0x4c')]=function(_0x4b7b85,_0x41466a){return db['ChatTransferReport'][_0x31d6('0x4c')]()[_0x31d6('0x28')](respondWithResult(_0x41466a,null))[_0x31d6('0x46')](handleError(_0x41466a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index d4ec0d7..12a86cc 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 _0x29f7=['request-promise','path','rimraf','../../config/environment','exports','define','ChatTransferReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x397bfb,_0x589665){var _0x16c9b9=function(_0x13ce8a){while(--_0x13ce8a){_0x397bfb['push'](_0x397bfb['shift']());}};_0x16c9b9(++_0x589665);}(_0x29f7,0x132));var _0x729f=function(_0x553439,_0xcfc3c1){_0x553439=_0x553439-0x0;var _0x187218=_0x29f7[_0x553439];return _0x187218;};'use strict';var _=require(_0x729f('0x0'));var util=require(_0x729f('0x1'));var logger=require(_0x729f('0x2'))(_0x729f('0x3'));var moment=require(_0x729f('0x4'));var BPromise=require(_0x729f('0x5'));var rp=require(_0x729f('0x6'));var fs=require('fs');var path=require(_0x729f('0x7'));var rimraf=require(_0x729f('0x8'));var config=require(_0x729f('0x9'));var attributes=require('./chatTransferReport.attributes');module[_0x729f('0xa')]=function(_0x4d39b9,_0x1cac2b){return _0x4d39b9[_0x729f('0xb')](_0x729f('0xc'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6845=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x2c3c52,_0x57e3d6){var _0xe670a3=function(_0x467e34){while(--_0x467e34){_0x2c3c52['push'](_0x2c3c52['shift']());}};_0xe670a3(++_0x57e3d6);}(_0x6845,0x17c));var _0x5684=function(_0x49347f,_0x187a45){_0x49347f=_0x49347f-0x0;var _0x467e4f=_0x6845[_0x49347f];return _0x467e4f;};'use strict';var _=require(_0x5684('0x0'));var util=require(_0x5684('0x1'));var logger=require(_0x5684('0x2'))(_0x5684('0x3'));var moment=require('moment');var BPromise=require(_0x5684('0x4'));var rp=require(_0x5684('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5684('0x6'));var config=require(_0x5684('0x7'));var attributes=require(_0x5684('0x8'));module[_0x5684('0x9')]=function(_0x4c6f85,_0x56020f){return _0x4c6f85[_0x5684('0xa')](_0x5684('0xb'),attributes,{'tableName':_0x5684('0xc'),'paranoid':![],'indexes':[{'name':_0x5684('0xd'),'fields':[_0x5684('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 87e3d17..0167ec8 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 _0x463e=['client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x102749,_0x4c2cde){var _0x1d647d=function(_0x50a049){while(--_0x50a049){_0x102749['push'](_0x102749['shift']());}};_0x1d647d(++_0x4c2cde);}(_0x463e,0x69));var _0xe463=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x463e[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xe463('0x0'));var util=require(_0xe463('0x1'));var moment=require(_0xe463('0x2'));var BPromise=require(_0xe463('0x3'));var rs=require(_0xe463('0x4'));var fs=require('fs');var Redis=require(_0xe463('0x5'));var db=require(_0xe463('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe463('0x7'));var config=require(_0xe463('0x8'));var jayson=require(_0xe463('0x9'));var client=jayson[_0xe463('0xa')][_0xe463('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33ce6e,_0x2118ba,_0x131863){return new BPromise(function(_0x5c8251,_0x54954a){return client[_0xe463('0xc')](_0x33ce6e,_0x131863)[_0xe463('0xd')](function(_0x449bb3){logger[_0xe463('0xe')](_0xe463('0xf'),_0x2118ba,_0xe463('0x10'));logger[_0xe463('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x2118ba,_0xe463('0x10'),JSON[_0xe463('0x12')](_0x449bb3));if(_0x449bb3['error']){if(_0x449bb3[_0xe463('0x13')]['code']===0x1f4){logger['error'](_0xe463('0xf'),_0x2118ba,_0x449bb3[_0xe463('0x13')]['message']);return _0x54954a(_0x449bb3['error'][_0xe463('0x14')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x2118ba,_0x449bb3[_0xe463('0x13')]['message']);return _0x5c8251(_0x449bb3['error'][_0xe463('0x14')]);}else{logger['info'](_0xe463('0xf'),_0x2118ba,_0xe463('0x10'));_0x5c8251(_0x449bb3[_0xe463('0x15')][_0xe463('0x14')]);}})[_0xe463('0x16')](function(_0x3ce25d){logger[_0xe463('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x2118ba,_0x3ce25d);_0x54954a(_0x3ce25d);});});} \ No newline at end of file +var _0x8b72=['util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8b72,0xe7));var _0x28b7=function(_0x57c2aa,_0x1ce944){_0x57c2aa=_0x57c2aa-0x0;var _0xc614b9=_0x8b72[_0x57c2aa];return _0xc614b9;};'use strict';var _=require('lodash');var util=require(_0x28b7('0x0'));var moment=require('moment');var BPromise=require(_0x28b7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28b7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x28b7('0x3'));var logger=require(_0x28b7('0x4'))(_0x28b7('0x5'));var config=require(_0x28b7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x28b7('0x7')][_0x28b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2935ca,_0x95f287,_0x428cb4){return new BPromise(function(_0x56a174,_0x222231){return client[_0x28b7('0x9')](_0x2935ca,_0x428cb4)[_0x28b7('0xa')](function(_0x2cd3d1){logger[_0x28b7('0xb')](_0x28b7('0xc'),_0x95f287,_0x28b7('0xd'));logger[_0x28b7('0xe')](_0x28b7('0xf'),_0x95f287,_0x28b7('0xd'),JSON[_0x28b7('0x10')](_0x2cd3d1));if(_0x2cd3d1['error']){if(_0x2cd3d1['error']['code']===0x1f4){logger[_0x28b7('0x11')](_0x28b7('0xc'),_0x95f287,_0x2cd3d1['error']['message']);return _0x222231(_0x2cd3d1[_0x28b7('0x11')][_0x28b7('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x95f287,_0x2cd3d1[_0x28b7('0x11')][_0x28b7('0x12')]);return _0x56a174(_0x2cd3d1[_0x28b7('0x11')][_0x28b7('0x12')]);}else{logger['info'](_0x28b7('0xc'),_0x95f287,_0x28b7('0xd'));_0x56a174(_0x2cd3d1[_0x28b7('0x13')][_0x28b7('0x12')]);}})[_0x28b7('0x14')](function(_0x44a9fc){logger[_0x28b7('0x11')](_0x28b7('0xc'),_0x95f287,_0x44a9fc);_0x222231(_0x44a9fc);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 60aad00..156769c 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 _0x1973=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0x1b7422,_0x3915b9){var _0x1aded4=function(_0x2c1884){while(--_0x2c1884){_0x1b7422['push'](_0x1b7422['shift']());}};_0x1aded4(++_0x3915b9);}(_0x1973,0x16e));var _0x3197=function(_0x5c9a97,_0x342c8d){_0x5c9a97=_0x5c9a97-0x0;var _0x5f0606=_0x1973[_0x5c9a97];return _0x5f0606;};'use strict';var multer=require(_0x3197('0x0'));var util=require(_0x3197('0x1'));var path=require(_0x3197('0x2'));var timeout=require(_0x3197('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3197('0x4'));var auth=require(_0x3197('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3197('0x6'));var controller=require(_0x3197('0x7'));router[_0x3197('0x8')]('/',auth[_0x3197('0x9')](),controller[_0x3197('0xa')]);router[_0x3197('0x8')](_0x3197('0xb'),auth[_0x3197('0x9')](),controller['describe']);router[_0x3197('0x8')]('/:id',auth[_0x3197('0x9')](),controller[_0x3197('0xc')]);router[_0x3197('0xd')]('/',auth[_0x3197('0x9')](),controller[_0x3197('0xe')]);router[_0x3197('0xf')]('/:id',auth[_0x3197('0x9')](),controller[_0x3197('0x10')]);router[_0x3197('0x11')]('/:id',auth[_0x3197('0x9')](),controller[_0x3197('0x12')]);module[_0x3197('0x13')]=router; \ No newline at end of file +var _0x2eea=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x2eea,0xcb));var _0xa2ee=function(_0x1ca7d6,_0x3f531a){_0x1ca7d6=_0x1ca7d6-0x0;var _0x2a64ee=_0x2eea[_0x1ca7d6];return _0x2a64ee;};'use strict';var multer=require(_0xa2ee('0x0'));var util=require(_0xa2ee('0x1'));var path=require(_0xa2ee('0x2'));var timeout=require(_0xa2ee('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa2ee('0x4'));var config=require(_0xa2ee('0x5'));var controller=require(_0xa2ee('0x6'));router[_0xa2ee('0x7')]('/',auth[_0xa2ee('0x8')](),controller[_0xa2ee('0x9')]);router['get'](_0xa2ee('0xa'),auth[_0xa2ee('0x8')](),controller[_0xa2ee('0xb')]);router[_0xa2ee('0x7')](_0xa2ee('0xc'),auth[_0xa2ee('0x8')](),controller[_0xa2ee('0xd')]);router[_0xa2ee('0xe')]('/',auth['isAuthenticated'](),controller[_0xa2ee('0xf')]);router[_0xa2ee('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa2ee('0x11')](_0xa2ee('0xc'),auth[_0xa2ee('0x8')](),controller[_0xa2ee('0x12')]);module[_0xa2ee('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a61a509..affd9eb 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 _0x27cf=['We\x20are\x20here!','Send','Contact\x20us','INTEGER','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared'];(function(_0x34022e,_0x2076d1){var _0x3f4dfb=function(_0x36e8b3){while(--_0x36e8b3){_0x34022e['push'](_0x34022e['shift']());}};_0x3f4dfb(++_0x2076d1);}(_0x27cf,0x10e));var _0xf27c=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x27cf[_0x243b2f];return _0xcb3c2d;};'use strict';var Sequelize=require(_0xf27c('0x0'));var rs=require(_0xf27c('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xf27c('0x2')],'allowNull':![],'unique':_0xf27c('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x4')},'mapKeyOffline':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x4')},'key':{'type':Sequelize[_0xf27c('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x5')},'customerAlias':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf27c('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf27c('0x2')],'allowNull':![],'defaultValue':_0xf27c('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf27c('0x2')],'allowNull':![],'defaultValue':_0xf27c('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf27c('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf27c('0x2')]},'animation':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf27c('0x9')](_0xf27c('0xa'),_0xf27c('0xb')),'defaultValue':_0xf27c('0xa')},'header_online':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0xc')},'start_chat_button':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xf27c('0xe')},'download_transcript':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf27c('0xf')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x11')},'noteTitle':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x12')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf27c('0xd')},'skipMessageButton':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x13')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xf27c('0x9')](_0xf27c('0x14'),_0xf27c('0x15')),'defaultValue':_0xf27c('0x14')},'ratingStarsNumber':{'type':Sequelize[_0xf27c('0xf')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf27c('0x16')],'defaultValue':function(){return JSON[_0xf27c('0x17')]({'items':[{'type':_0xf27c('0x18'),'variable':null,'config':{'placeholder':_0xf27c('0x19'),'type':_0xf27c('0x1a'),'required':!![]},'props':{'title':_0xf27c('0x19'),'helpText':''}},{'type':_0xf27c('0x18'),'props':{'title':_0xf27c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf27c('0x4'),'type':_0xf27c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf27c('0x1b')](_0xf27c('0x1c'))?JSON[_0xf27c('0x1d')](this[_0xf27c('0x1b')]('onlineForm')):{};},'set':function(_0x4d5fd0){return this[_0xf27c('0x1e')](_0xf27c('0x1c'),JSON[_0xf27c('0x17')](_0x4d5fd0));}},'offlineForm':{'type':Sequelize[_0xf27c('0x16')],'defaultValue':function(){return JSON[_0xf27c('0x17')]({'items':[{'type':_0xf27c('0x18'),'props':{'title':_0xf27c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xf27c('0x4'),'type':_0xf27c('0x4')},'variable':null},{'type':_0xf27c('0x1f'),'config':{'placeholder':_0xf27c('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xf27c('0x1b')](_0xf27c('0x21'))?JSON[_0xf27c('0x1d')](this[_0xf27c('0x1b')](_0xf27c('0x21'))):{};},'set':function(_0x55828d){return this['setDataValue']('offlineForm',JSON['stringify'](_0x55828d));}},'token':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf27c('0x2')]},'forwardOffline':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf27c('0x2')]},'waitingTitle':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x22')},'waitingMessage':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x24')},'skipUnmanaged':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x13')},'sendUnmanaged':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf27c('0x16')]},'showAgentAvatar':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf27c('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf27c('0x25');}},'notificationSound':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xf27c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf27c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x26')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x27')},'messagesAlignment':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x28')},'defaultTitle':{'type':Sequelize[_0xf27c('0x2')]},'customerAvatar':{'type':Sequelize[_0xf27c('0x16')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf27c('0xf')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf27c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf27c('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':_0xf27c('0x29')},'systemAvatar':{'type':Sequelize[_0xf27c('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xf27c('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![],'comment':_0xf27c('0x2b'),'set':function(_0x1f9d39){if(!_0x1f9d39)this['setDataValue'](_0xf27c('0x2c'),null);this[_0xf27c('0x1e')](_0xf27c('0x2d'),_0x1f9d39);}},'vidaooEscalation':{'type':Sequelize[_0xf27c('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf27c('0x2')]},'vidaooTopic':{'type':Sequelize[_0xf27c('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xf27c('0x2')],'defaultValue':function(){return _0xf27c('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0xf27c('0x16')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf27c('0x16')]}}; \ No newline at end of file +var _0x58fd=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','setDataValue','Comments','offlineForm','parse','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x58fd,0x1c3));var _0xd58f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x58fd[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xd58f('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xd58f('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xd58f('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xd58f('0x2')},'mapKeyOffline':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x2')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd58f('0x1')],'allowNull':![],'defaultValue':_0xd58f('0x3'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd58f('0x3'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd58f('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd58f('0x4'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd58f('0x5')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd58f('0x1')]},'animation':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd58f('0x7')](_0xd58f('0x8'),_0xd58f('0x9')),'defaultValue':_0xd58f('0x8')},'header_online':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xa')},'start_chat_button':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xb')},'offline_chat_button':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xc')},'header_offline':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xd')},'download_transcript':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd58f('0x5')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xd58f('0x10')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd58f('0x11')},'closingMessageButton':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xc')},'skipMessageButton':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x12')},'conditionAgreement':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xd58f('0x7')](_0xd58f('0x13'),_0xd58f('0x14')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd58f('0x15')],'defaultValue':function(){return JSON[_0xd58f('0x16')]({'items':[{'type':_0xd58f('0x17'),'variable':null,'config':{'placeholder':_0xd58f('0x18'),'type':_0xd58f('0x19'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xd58f('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd58f('0x2'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd58f('0x1a')](_0xd58f('0x1b'))?JSON['parse'](this[_0xd58f('0x1a')](_0xd58f('0x1b'))):{};},'set':function(_0x58549a){return this[_0xd58f('0x1c')]('onlineForm',JSON['stringify'](_0x58549a));}},'offlineForm':{'type':Sequelize[_0xd58f('0x15')],'defaultValue':function(){return JSON[_0xd58f('0x16')]({'items':[{'type':_0xd58f('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd58f('0x2'),'type':_0xd58f('0x2')},'variable':null},{'type':'textarea','config':{'placeholder':_0xd58f('0x1d')},'props':{'title':_0xd58f('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xd58f('0x1e'))?JSON[_0xd58f('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x204487){return this[_0xd58f('0x1c')](_0xd58f('0x1e'),JSON[_0xd58f('0x16')](_0x204487));}},'token':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd58f('0x1')]},'forwardOffline':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd58f('0x1')]},'waitingTitle':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x20')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd58f('0x21')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xd58f('0x12')},'sendUnmanaged':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd58f('0x15')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd58f('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd58f('0x22');}},'notificationSound':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x23')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd58f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd58f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x24')},'verticalAlignment':{'type':Sequelize[_0xd58f('0x5')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x25')},'messagesAlignment':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x26')},'defaultTitle':{'type':Sequelize[_0xd58f('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd58f('0x5')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd58f('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd58f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd58f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd58f('0x1')],'defaultValue':_0xd58f('0x27')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd58f('0x5')],'comment':_0xd58f('0x28')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x16a164){if(!_0x16a164)this[_0xd58f('0x1c')](_0xd58f('0x29'),null);this[_0xd58f('0x1c')](_0xd58f('0x2a'),_0x16a164);}},'vidaooEscalation':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd58f('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd58f('0x2b')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xd58f('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0xd58f('0x15')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xd58f('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xd58f('0x15')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3ef4d1a..1ec55b4 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 _0xb66c=['bulkCreate','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','email','NotifyMailAccount','notifyMail','server','attachments','offline-chat','remove','addInteraction','getInteractions','Contact','fullname','Tags','tag','getSnippet','getProactiveActions','virtual','License','timezone','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','replace','color','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','false','offlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','omit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','mustache','path','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../errors/api','APIBadRequestError','APINotFoundError','handleError','APIConflictError','./helpers/wildcard-expressions','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','status','json','offset','limit','count','set','Content-Range','update','then','destroy','get','ChatWebsites','stack','name','send','user-agent-parser','setUA','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','fields','includeAll','find','create','body','address','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','describe','ChatWebsiteId','getDispositions','findOne','Disposition','sort','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','sitepic','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','Interval','resolve','ifTime','notify','chat','from','MapKey\x20is\x20mandatory','isEmpty','referer','No\x20available\x20attributes','updatedAt','includes','createdAt','CompanyId','ListId','mapKey','List','CmContact','Contacts','DESC','ChatApplication','Applications','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','priority','asc','account','list','contact','headers','threadId','closed','ChatInteraction','customerIp','externalUrl','ContactId','interaction','Writing\x20on\x20closed\x20interaction','messageId','created','autoclose','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','queue','Start','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','fromString','originalname','basename','openNewInteraction','transaction','Attachment'];(function(_0x559d36,_0x2b7ff4){var _0x54a297=function(_0xf8e1a7){while(--_0xf8e1a7){_0x559d36['push'](_0x559d36['shift']());}};_0x54a297(++_0x2b7ff4);}(_0xb66c,0x175));var _0xcb66=function(_0x2513f9,_0x485050){_0x2513f9=_0x2513f9-0x0;var _0x28c4c1=_0xb66c[_0x2513f9];return _0x28c4c1;};'use strict';var Mustache=require(_0xcb66('0x0'));var util=require('util');var path=require(_0xcb66('0x1'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb66('0x2'));var _=require(_0xcb66('0x3'));var querystring=require(_0xcb66('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0xcb66('0x5'));var jayson=require(_0xcb66('0x6'));var qs=require(_0xcb66('0x7'));var logger=require(_0xcb66('0x8'))('api');var config=require('../../config/environment');var APIBadRequestError=require(_0xcb66('0x9'))[_0xcb66('0xa')];var APINotFoundError=require(_0xcb66('0x9'))[_0xcb66('0xb')];var APIOutOfIntervalError=require(_0xcb66('0x9'))['APIOutOfIntervalError'];var APIHandleError=require(_0xcb66('0x9'))[_0xcb66('0xc')];var APIConflictError=require(_0xcb66('0x9'))[_0xcb66('0xd')];var wildcardUtils=require(_0xcb66('0xe'));var URL=require('url')[_0xcb66('0xf')];var db=require(_0xcb66('0x10'))['db'];config[_0xcb66('0x11')]=_[_0xcb66('0x12')](config['redis'],{'host':_0xcb66('0x13'),'port':0x18eb});var socket=require(_0xcb66('0x14'))(new Redis(config[_0xcb66('0x11')]));require(_0xcb66('0x15'))['register'](socket);var client=jayson[_0xcb66('0x16')][_0xcb66('0x17')]({'port':0x232c});var client9002=jayson[_0xcb66('0x16')][_0xcb66('0x17')]({'port':0x232a});var client9003=jayson['client'][_0xcb66('0x17')]({'port':0x232b});var client9001=jayson['client'][_0xcb66('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x52b058,_0x27442d,_0x573dc7,_0x4bef09){return new Promise(function(_0x274aed,_0x13cfea){var _0x681ce3=_0x4bef09||client;return _0x681ce3[_0xcb66('0x18')](_0x52b058,_0x573dc7)['then'](function(_0x3a6e26){logger[_0xcb66('0x19')](_0xcb66('0x1a'),_0x27442d,'request\x20sent');logger[_0xcb66('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x27442d,_0xcb66('0x1c'),JSON[_0xcb66('0x1d')](_0x3a6e26));if(_0x3a6e26[_0xcb66('0x1e')]){if(_0x3a6e26[_0xcb66('0x1e')]['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x27442d,_0x3a6e26[_0xcb66('0x1e')]['message']);return _0x13cfea(_0x3a6e26['error'][_0xcb66('0x1f')]);}logger['error'](_0xcb66('0x1a'),_0x27442d,_0x3a6e26[_0xcb66('0x1e')][_0xcb66('0x1f')]);return _0x274aed(_0x3a6e26[_0xcb66('0x1e')][_0xcb66('0x1f')]);}else{logger[_0xcb66('0x19')](_0xcb66('0x1a'),_0x27442d,'request\x20sent');_0x274aed(_0x3a6e26[_0xcb66('0x20')]['message']);}})['catch'](function(_0xf89c0e){logger[_0xcb66('0x1e')](_0xcb66('0x1a'),_0x27442d,_0xf89c0e);_0x13cfea(_0xf89c0e);});});}function respondWithStatusCode(_0x5f389f,_0x341554){_0x341554=_0x341554||0xcc;return function(_0x196ef6){if(_0x196ef6){return _0x5f389f[_0xcb66('0x21')](_0x341554);}return _0x5f389f[_0xcb66('0x22')](_0x341554)['end']();};}function respondWithResult(_0x6661c4,_0x31560e){_0x31560e=_0x31560e||0xc8;return function(_0x134987){if(_0x134987){return _0x6661c4[_0xcb66('0x22')](_0x31560e)[_0xcb66('0x23')](_0x134987);}};}function respondWithFilteredResult(_0x22527e,_0x1e5c56){return function(_0x967710){if(_0x967710){var _0x28fc0b=typeof _0x1e5c56[_0xcb66('0x24')]==='undefined'&&typeof _0x1e5c56[_0xcb66('0x25')]==='undefined';var _0x4dbb7f=_0x967710['count'];var _0x31a10a=_0x28fc0b?0x0:_0x1e5c56['offset'];var _0xb135e3=_0x28fc0b?_0x967710[_0xcb66('0x26')]:_0x1e5c56[_0xcb66('0x24')]+_0x1e5c56['limit'];var _0x123787;if(_0xb135e3>=_0x4dbb7f){_0xb135e3=_0x4dbb7f;_0x123787=0xc8;}else{_0x123787=0xce;}_0x22527e[_0xcb66('0x22')](_0x123787);return _0x22527e[_0xcb66('0x27')](_0xcb66('0x28'),_0x31a10a+'-'+_0xb135e3+'/'+_0x4dbb7f)[_0xcb66('0x23')](_0x967710);}return null;};}function saveUpdates(_0x375636){return function(_0x2a5e56){if(_0x2a5e56){return _0x2a5e56[_0xcb66('0x29')](_0x375636)[_0xcb66('0x2a')](function(_0x3e4755){return _0x3e4755;});}return null;};}function removeEntity(_0x521350){return function(_0x4529e8){if(_0x4529e8){return _0x4529e8[_0xcb66('0x2b')]()[_0xcb66('0x2a')](function(){var _0x5f6d80=_0x4529e8[_0xcb66('0x2c')]({'plain':!![]});var _0x128256=_0xcb66('0x2d');return db['UserProfileResource'][_0xcb66('0x2b')]({'where':{'type':_0x128256,'resourceId':_0x5f6d80['id']}})[_0xcb66('0x2a')](function(){return _0x4529e8;});})[_0xcb66('0x2a')](function(){_0x521350[_0xcb66('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a9545){return function(_0x17a21a){if(!_0x17a21a){_0x1a9545[_0xcb66('0x21')](0x194);}return _0x17a21a;};}function handleError(_0x407629,_0x17152e){_0x17152e=_0x17152e||0x1f4;return function(_0x1d9957){logger[_0xcb66('0x1e')](_0x1d9957[_0xcb66('0x2e')]);if(_0x1d9957[_0xcb66('0x2f')]){delete _0x1d9957[_0xcb66('0x2f')];}_0x407629[_0xcb66('0x22')](_0x17152e)[_0xcb66('0x30')](_0x1d9957);};}function createInteractionObject(_0x4ef8ba,_0x4d9b76,_0x5e69ab,_0x4509b3){var _0x4182f9=require(_0xcb66('0x31'));var _0xc02e47=new _0x4182f9();var _0x1a2686=_0xc02e47[_0xcb66('0x32')](_0x5e69ab['user-agent'])[_0xcb66('0x33')]();var _0x59cb38=_0x4d9b76['customerIp'];if(_0x5e69ab['cf-connecting-ip']){_0x59cb38=_0x5e69ab[_0xcb66('0x34')];}else if(_0x5e69ab[_0xcb66('0x35')]){_0x59cb38=_[_0xcb66('0x36')](_0x5e69ab[_0xcb66('0x35')][_0xcb66('0x37')](','));}return{'ContactId':_0x4509b3['id'],'ChatWebsiteId':_0x4ef8ba,'from':(_0x4509b3[_0xcb66('0x38')]||'')+'\x20'+(_0x4509b3[_0xcb66('0x39')]||''),'customerIp':_0x59cb38,'customerPort':_0x5e69ab[_0xcb66('0x3a')]?_0x5e69ab[_0xcb66('0x3a')]:null,'referer':_0x4d9b76['referer'],'browserName':_0x1a2686[_0xcb66('0x3b')][_0xcb66('0x2f')]&&_0x1a2686[_0xcb66('0x3b')]['version']?util[_0xcb66('0x3c')](_0xcb66('0x3d'),_0x1a2686['browser']['name'],_0x1a2686[_0xcb66('0x3b')]['version']):'unknown','browserVersion':_0x1a2686[_0xcb66('0x3b')][_0xcb66('0x3e')]||_0xcb66('0x3f'),'osName':util[_0xcb66('0x3c')](_0xcb66('0x3d'),_0x1a2686['os'][_0xcb66('0x2f')],_0x1a2686['os'][_0xcb66('0x3e')]),'osVersion':_0x1a2686['os'][_0xcb66('0x3e')],'deviceModel':_0x1a2686[_0xcb66('0x40')]['model']&&_0x1a2686['device']['vendor']?util[_0xcb66('0x3c')]('%s\x20%s\x20%s',_0x1a2686[_0xcb66('0x40')]['model'],_0x1a2686[_0xcb66('0x40')][_0xcb66('0x41')],_0x1a2686[_0xcb66('0x40')][_0xcb66('0x42')]):null,'deviceVendor':_0x1a2686[_0xcb66('0x40')][_0xcb66('0x41')],'deviceType':_0x1a2686['device']['type'],'formData':JSON[_0xcb66('0x1d')](_0x4d9b76)};}exports[_0xcb66('0x43')]=function(_0x165397,_0xc4026){var _0xf2c532={'include':[{'model':db[_0xcb66('0x44')],'as':_0xcb66('0x45')}]},_0x1c149b={},_0x1465df={'count':0x0,'rows':[]};var _0x5a0123=_[_0xcb66('0x46')](db[_0xcb66('0x47')][_0xcb66('0x48')],function(_0x346379){return{'name':_0x346379['fieldName'],'type':_0x346379[_0xcb66('0x42')][_0xcb66('0x49')]};});_0x1c149b[_0xcb66('0x4a')]=_['map'](_0x5a0123,_0xcb66('0x2f'));_0x1c149b[_0xcb66('0x4b')]=_[_0xcb66('0x4c')](_0x165397[_0xcb66('0x4b')]);_0x1c149b['filters']=_[_0xcb66('0x4d')](_0x1c149b[_0xcb66('0x4a')],_0x1c149b[_0xcb66('0x4b')]);_0xf2c532['attributes']=_['intersection'](_0x1c149b[_0xcb66('0x4a')],qs['fields'](_0x165397[_0xcb66('0x4b')]['fields']));_0xf2c532[_0xcb66('0x4e')]=_0xf2c532[_0xcb66('0x4e')][_0xcb66('0x4f')]?_0xf2c532['attributes']:_0x1c149b[_0xcb66('0x4a')];if(!_0x165397['query'][_0xcb66('0x50')](_0xcb66('0x51'))){_0xf2c532[_0xcb66('0x25')]=qs[_0xcb66('0x25')](_0x165397[_0xcb66('0x4b')]['limit']);_0xf2c532[_0xcb66('0x24')]=qs['offset'](_0x165397[_0xcb66('0x4b')][_0xcb66('0x24')]);}_0xf2c532[_0xcb66('0x52')]=qs['sort'](_0x165397['query']['sort']);_0xf2c532[_0xcb66('0x53')]=qs[_0xcb66('0x54')](_[_0xcb66('0x55')](_0x165397[_0xcb66('0x4b')],_0x1c149b[_0xcb66('0x54')]),_0x5a0123);if(_0x165397[_0xcb66('0x4b')][_0xcb66('0x56')]){_0xf2c532[_0xcb66('0x53')]=_[_0xcb66('0x57')](_0xf2c532[_0xcb66('0x53')],{'$or':_['map'](_0x5a0123,function(_0x23e3a0){if(_0x23e3a0[_0xcb66('0x42')]!==_0xcb66('0x58')){var _0x372b59={};_0x372b59[_0x23e3a0['name']]={'$like':'%'+_0x165397['query'][_0xcb66('0x56')]+'%'};return _0x372b59;}})});}_0xf2c532=_[_0xcb66('0x57')]({},_0xf2c532,_0x165397[_0xcb66('0x59')]);var _0x37bd10={'where':_0xf2c532[_0xcb66('0x53')]};return db[_0xcb66('0x47')]['count'](_0x37bd10)[_0xcb66('0x2a')](function(_0xf69f45){_0x1465df[_0xcb66('0x26')]=_0xf69f45;if(_0x165397[_0xcb66('0x4b')]['includeAll']){_0xf2c532[_0xcb66('0x5a')]=[{'all':!![]}];}return db['ChatWebsite'][_0xcb66('0x5b')](_0xf2c532);})['then'](function(_0x11e42d){_0x1465df[_0xcb66('0x5c')]=_0x11e42d;return _0x1465df;})[_0xcb66('0x2a')](respondWithFilteredResult(_0xc4026,_0xf2c532))['catch'](handleError(_0xc4026,null));};exports['show']=function(_0x696bc1,_0x3ebc9a){var _0x55ab08={'raw':![],'where':{'id':_0x696bc1[_0xcb66('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0xcb66('0x45')}]},_0x557819={};_0x557819['model']=_[_0xcb66('0x4c')](db[_0xcb66('0x47')][_0xcb66('0x48')]);_0x557819['query']=_[_0xcb66('0x4c')](_0x696bc1[_0xcb66('0x4b')]);_0x557819['filters']=_[_0xcb66('0x4d')](_0x557819[_0xcb66('0x4a')],_0x557819[_0xcb66('0x4b')]);_0x55ab08[_0xcb66('0x4e')]=_[_0xcb66('0x4d')](_0x557819[_0xcb66('0x4a')],qs['fields'](_0x696bc1[_0xcb66('0x4b')][_0xcb66('0x5e')]));_0x55ab08[_0xcb66('0x4e')]=_0x55ab08[_0xcb66('0x4e')][_0xcb66('0x4f')]?_0x55ab08[_0xcb66('0x4e')]:_0x557819[_0xcb66('0x4a')];if(_0x696bc1[_0xcb66('0x4b')][_0xcb66('0x5f')]){_0x55ab08['include']=[{'all':!![]}];}_0x55ab08=_[_0xcb66('0x57')]({},_0x55ab08,_0x696bc1[_0xcb66('0x59')]);return db[_0xcb66('0x47')][_0xcb66('0x60')](_0x55ab08)[_0xcb66('0x2a')](handleEntityNotFound(_0x3ebc9a,null))[_0xcb66('0x2a')](respondWithResult(_0x3ebc9a,null))['catch'](handleError(_0x3ebc9a,null));};exports[_0xcb66('0x61')]=function(_0x40d4f3,_0x5c59e6){var _0x1b14d4=null;_0x40d4f3[_0xcb66('0x62')][_0xcb66('0x63')][_0xcb66('0x37')](',')['forEach'](_0x3dbc42=>{if(_0x3dbc42[_0xcb66('0x64')]()!==''&&!wildcardUtils[_0xcb66('0x65')](_0x3dbc42[_0xcb66('0x64')]())){_0x1b14d4=new APIBadRequestError('\x22'+_0x3dbc42[_0xcb66('0x64')]()+_0xcb66('0x66'));}});if(_0x1b14d4){return handleError(_0x5c59e6,null)(_0x1b14d4);}return db[_0xcb66('0x47')][_0xcb66('0x61')](_0x40d4f3[_0xcb66('0x62')],{})[_0xcb66('0x2a')](function(_0x534f56){var _0x3d1970=_0x40d4f3[_0xcb66('0x67')][_0xcb66('0x2c')]({'plain':!![]});if(!_0x3d1970)throw new Error(_0xcb66('0x68'));if(_0x3d1970['role']===_0xcb66('0x67')){var _0x26c43c=_0x534f56[_0xcb66('0x2c')]({'plain':!![]});var _0x1c0533=_0xcb66('0x2d');return db[_0xcb66('0x69')][_0xcb66('0x60')]({'where':{'name':_0x1c0533,'userProfileId':_0x3d1970['userProfileId']},'raw':!![]})['then'](function(_0x1b7f2b){if(_0x1b7f2b&&_0x1b7f2b[_0xcb66('0x6a')]===0x0){return db[_0xcb66('0x6b')][_0xcb66('0x61')]({'name':_0x26c43c[_0xcb66('0x2f')],'resourceId':_0x26c43c['id'],'type':_0x1b7f2b[_0xcb66('0x2f')],'sectionId':_0x1b7f2b['id']},{})['then'](function(){return _0x534f56;});}else{return _0x534f56;}})[_0xcb66('0x6c')](function(_0x106927){logger[_0xcb66('0x1e')](_0xcb66('0x6d'),_0x106927);throw _0x106927;});}return _0x534f56;})[_0xcb66('0x2a')](respondWithResult(_0x5c59e6,0xc9))[_0xcb66('0x6c')](handleError(_0x5c59e6,null));};exports['update']=function(_0x3bf094,_0x28b205){var _0x28ad40=null;_0x3bf094[_0xcb66('0x62')][_0xcb66('0x63')][_0xcb66('0x37')](',')[_0xcb66('0x6e')](_0x3f8673=>{if(_0x3f8673[_0xcb66('0x64')]()!==''&&!wildcardUtils[_0xcb66('0x65')](_0x3f8673[_0xcb66('0x64')]())){_0x28ad40=new APIBadRequestError('\x22'+_0x3f8673[_0xcb66('0x64')]()+_0xcb66('0x66'));}});if(_0x28ad40){return handleError(_0x28b205,null)(_0x28ad40);}if(_0x3bf094[_0xcb66('0x62')]['id']){delete _0x3bf094[_0xcb66('0x62')]['id'];}return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x3bf094[_0xcb66('0x5d')]['id']},'include':[{'model':db[_0xcb66('0x44')],'as':'mandatoryDispositionPause'}]})[_0xcb66('0x2a')](handleEntityNotFound(_0x28b205,null))['then'](saveUpdates(_0x3bf094[_0xcb66('0x62')],null))['then'](respondWithResult(_0x28b205,null))[_0xcb66('0x6c')](handleError(_0x28b205,null));};exports[_0xcb66('0x2b')]=function(_0x42a71a,_0x1a4cdb){return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x42a71a[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x1a4cdb,null))[_0xcb66('0x2a')](removeEntity(_0x1a4cdb,null))[_0xcb66('0x6c')](handleError(_0x1a4cdb,null));};exports[_0xcb66('0x6f')]=function(_0x309b72,_0x44b995){return db['ChatWebsite'][_0xcb66('0x6f')]()[_0xcb66('0x2a')](respondWithResult(_0x44b995,null))[_0xcb66('0x6c')](handleError(_0x44b995,null));};exports['addDisposition']=function(_0x1d1566,_0x416e29){if(_0x1d1566[_0xcb66('0x62')]['id']){delete _0x1d1566['body']['id'];}return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x1d1566[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x416e29,null))[_0xcb66('0x2a')](function(_0x2601cc){if(_0x2601cc){_0x1d1566['body'][_0xcb66('0x70')]=_0x2601cc['id'];return db['Disposition'][_0xcb66('0x61')](_0x1d1566['body']);}})[_0xcb66('0x2a')](respondWithResult(_0x416e29,null))['catch'](handleError(_0x416e29,null));};exports[_0xcb66('0x71')]=function(_0x20fb30,_0x3276d9){var _0x480f46={'raw':![],'where':{}};var _0x2bf869={};var _0x58c952={'count':0x0,'rows':[]};return db[_0xcb66('0x47')][_0xcb66('0x72')]({'where':{'id':_0x20fb30[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x3276d9,null))[_0xcb66('0x2a')](function(_0x5c58e4){if(_0x5c58e4){_0x2bf869[_0xcb66('0x4a')]=_[_0xcb66('0x4c')](db[_0xcb66('0x73')][_0xcb66('0x48')]);_0x2bf869['query']=_[_0xcb66('0x4c')](_0x20fb30[_0xcb66('0x4b')]);_0x2bf869['filters']=_[_0xcb66('0x4d')](_0x2bf869[_0xcb66('0x4a')],_0x2bf869[_0xcb66('0x4b')]);_0x480f46[_0xcb66('0x4e')]=_['intersection'](_0x2bf869[_0xcb66('0x4a')],qs[_0xcb66('0x5e')](_0x20fb30[_0xcb66('0x4b')][_0xcb66('0x5e')]));_0x480f46[_0xcb66('0x4e')]=_0x480f46['attributes'][_0xcb66('0x4f')]?_0x480f46[_0xcb66('0x4e')]:_0x2bf869[_0xcb66('0x4a')];if(!_0x20fb30[_0xcb66('0x4b')][_0xcb66('0x50')](_0xcb66('0x51'))){_0x480f46[_0xcb66('0x25')]=qs['limit'](_0x20fb30['query']['limit']);_0x480f46[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x20fb30['query'][_0xcb66('0x24')]);}_0x480f46['order']=qs[_0xcb66('0x74')](_0x20fb30[_0xcb66('0x4b')][_0xcb66('0x74')]);_0x480f46[_0xcb66('0x53')]=qs['filters'](_[_0xcb66('0x55')](_0x20fb30[_0xcb66('0x4b')],_0x2bf869[_0xcb66('0x54')]));_0x480f46[_0xcb66('0x53')][_0xcb66('0x70')]=_0x5c58e4['id'];if(_0x20fb30['query']['filter']){_0x480f46[_0xcb66('0x53')]=_['merge'](_0x480f46[_0xcb66('0x53')],{'$or':_[_0xcb66('0x46')](_0x480f46[_0xcb66('0x4e')],function(_0x396b88){var _0x3a6226={};_0x3a6226[_0x396b88]={'$like':'%'+_0x20fb30[_0xcb66('0x4b')]['filter']+'%'};return _0x3a6226;})});}_0x480f46=_[_0xcb66('0x57')]({},_0x480f46,_0x20fb30['options']);return db[_0xcb66('0x73')][_0xcb66('0x26')]({'where':_0x480f46[_0xcb66('0x53')]})[_0xcb66('0x2a')](function(_0xfa8232){_0x58c952[_0xcb66('0x26')]=_0xfa8232;if(_0x20fb30['query'][_0xcb66('0x5f')]){_0x480f46[_0xcb66('0x5a')]=[{'all':!![]}];}return db[_0xcb66('0x73')][_0xcb66('0x5b')](_0x480f46);})[_0xcb66('0x2a')](function(_0x3f92c5){_0x58c952[_0xcb66('0x5c')]=_0x3f92c5;return _0x58c952;});}})[_0xcb66('0x2a')](respondWithFilteredResult(_0x3276d9,_0x480f46))['catch'](handleError(_0x3276d9,null));};exports['removeDispositions']=function(_0x25c9da,_0x328435){return db['ChatWebsite'][_0xcb66('0x60')]({'where':{'id':_0x25c9da[_0xcb66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x328435,null))[_0xcb66('0x2a')](function(_0x49a009){if(_0x49a009){return _0x49a009[_0xcb66('0x75')](_0x25c9da[_0xcb66('0x4b')][_0xcb66('0x76')]);}})[_0xcb66('0x2a')](respondWithStatusCode(_0x328435,null))[_0xcb66('0x6c')](handleError(_0x328435,null));};exports['addAnswer']=function(_0x5d512f,_0x283f19){if(_0x5d512f[_0xcb66('0x62')]['id']){delete _0x5d512f[_0xcb66('0x62')]['id'];}return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x5d512f['params']['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x283f19,null))['then'](function(_0x575ed7){if(_0x575ed7){_0x5d512f[_0xcb66('0x62')]['ChatWebsiteId']=_0x575ed7['id'];return db['CannedAnswer'][_0xcb66('0x61')](_0x5d512f[_0xcb66('0x62')]);}})['then'](respondWithResult(_0x283f19,null))[_0xcb66('0x6c')](handleError(_0x283f19,null));};exports[_0xcb66('0x77')]=function(_0x3d99b0,_0x3acdeb){var _0x2f605f={'raw':![],'where':{}};var _0x9c74ac={};var _0x1e21db={'count':0x0,'rows':[]};return db[_0xcb66('0x47')][_0xcb66('0x72')]({'where':{'id':_0x3d99b0[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x3acdeb,null))['then'](function(_0x49bd91){if(_0x49bd91){_0x9c74ac[_0xcb66('0x4a')]=_[_0xcb66('0x4c')](db[_0xcb66('0x78')][_0xcb66('0x48')]);_0x9c74ac[_0xcb66('0x4b')]=_[_0xcb66('0x4c')](_0x3d99b0[_0xcb66('0x4b')]);_0x9c74ac['filters']=_[_0xcb66('0x4d')](_0x9c74ac['model'],_0x9c74ac['query']);_0x2f605f['attributes']=_[_0xcb66('0x4d')](_0x9c74ac[_0xcb66('0x4a')],qs[_0xcb66('0x5e')](_0x3d99b0['query'][_0xcb66('0x5e')]));_0x2f605f['attributes']=_0x2f605f['attributes'][_0xcb66('0x4f')]?_0x2f605f[_0xcb66('0x4e')]:_0x9c74ac[_0xcb66('0x4a')];if(!_0x3d99b0[_0xcb66('0x4b')][_0xcb66('0x50')]('nolimit')){_0x2f605f[_0xcb66('0x25')]=qs[_0xcb66('0x25')](_0x3d99b0[_0xcb66('0x4b')][_0xcb66('0x25')]);_0x2f605f[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x3d99b0[_0xcb66('0x4b')]['offset']);}_0x2f605f[_0xcb66('0x52')]=qs[_0xcb66('0x74')](_0x3d99b0[_0xcb66('0x4b')]['sort']);_0x2f605f[_0xcb66('0x53')]=qs[_0xcb66('0x54')](_['pick'](_0x3d99b0[_0xcb66('0x4b')],_0x9c74ac[_0xcb66('0x54')]));_0x2f605f[_0xcb66('0x53')]['ChatWebsiteId']=_0x49bd91['id'];if(_0x3d99b0[_0xcb66('0x4b')][_0xcb66('0x56')]){_0x2f605f[_0xcb66('0x53')]=_[_0xcb66('0x57')](_0x2f605f[_0xcb66('0x53')],{'$or':_['map'](_0x2f605f[_0xcb66('0x4e')],function(_0xb7fd71){var _0x38eefa={};_0x38eefa[_0xb7fd71]={'$like':'%'+_0x3d99b0[_0xcb66('0x4b')][_0xcb66('0x56')]+'%'};return _0x38eefa;})});}_0x2f605f=_[_0xcb66('0x57')]({},_0x2f605f,_0x3d99b0['options']);return db['CannedAnswer'][_0xcb66('0x26')]({'where':_0x2f605f[_0xcb66('0x53')]})[_0xcb66('0x2a')](function(_0x38b12c){_0x1e21db[_0xcb66('0x26')]=_0x38b12c;if(_0x3d99b0[_0xcb66('0x4b')]['includeAll']){_0x2f605f[_0xcb66('0x5a')]=[{'all':!![]}];}return db[_0xcb66('0x78')][_0xcb66('0x5b')](_0x2f605f);})[_0xcb66('0x2a')](function(_0x41ea7e){_0x1e21db[_0xcb66('0x5c')]=_0x41ea7e;return _0x1e21db;});}})[_0xcb66('0x2a')](respondWithFilteredResult(_0x3acdeb,_0x2f605f))['catch'](handleError(_0x3acdeb,null));};exports[_0xcb66('0x79')]=function(_0x43d9f9,_0x2b8a98){return db['ChatWebsite'][_0xcb66('0x60')]({'where':{'id':_0x43d9f9[_0xcb66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2b8a98,null))['then'](function(_0x3e3d0a){if(_0x3e3d0a){return _0x3e3d0a[_0xcb66('0x79')](_0x43d9f9[_0xcb66('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x2b8a98,null))[_0xcb66('0x6c')](handleError(_0x2b8a98,null));};exports['addLogo']=function(_0x5d701a,_0x248f1a){_0x5d701a['body']['sitepic']=_0x5d701a[_0xcb66('0x7a')][_0xcb66('0x7b')];return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x5d701a[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x248f1a,null))[_0xcb66('0x2a')](saveUpdates(_0x5d701a[_0xcb66('0x62')],null))['then'](respondWithResult(_0x248f1a,null))[_0xcb66('0x6c')](handleError(_0x248f1a,null));};exports[_0xcb66('0x7c')]=function(_0x12be2,_0x595e4f){_0x12be2[_0xcb66('0x62')][_0xcb66('0x7d')]=_0x12be2[_0xcb66('0x7a')][_0xcb66('0x7b')];return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x12be2[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x595e4f,null))['then'](saveUpdates(_0x12be2[_0xcb66('0x62')],null))[_0xcb66('0x2a')](respondWithResult(_0x595e4f,null))[_0xcb66('0x6c')](handleError(_0x595e4f,null));};exports[_0xcb66('0x7e')]=function(_0x3fbc6f,_0x1bc4bc){_0x3fbc6f['body']['customerAvatar']=_0x3fbc6f['file'][_0xcb66('0x7b')];return db['ChatWebsite']['find']({'where':{'id':_0x3fbc6f[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x1bc4bc,null))[_0xcb66('0x2a')](saveUpdates(_0x3fbc6f[_0xcb66('0x62')],null))[_0xcb66('0x2a')](respondWithResult(_0x1bc4bc,null))[_0xcb66('0x6c')](handleError(_0x1bc4bc,null));};exports[_0xcb66('0x7f')]=function(_0x1d23ef,_0x56135d){_0x1d23ef[_0xcb66('0x62')][_0xcb66('0x80')]=_0x1d23ef[_0xcb66('0x7a')][_0xcb66('0x7b')];return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x1d23ef[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x56135d,null))['then'](saveUpdates(_0x1d23ef[_0xcb66('0x62')],null))[_0xcb66('0x2a')](respondWithResult(_0x56135d,null))[_0xcb66('0x6c')](handleError(_0x56135d,null));};exports[_0xcb66('0x81')]=function(_0x360ea8,_0x62477d){var _0x3f596e=path[_0xcb66('0x82')](config[_0xcb66('0x83')],'server/files/images/logos/default_logo.svg');var _0x431743={'where':{'id':_0x360ea8[_0xcb66('0x5d')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3e2ac3=![];return require(_0xcb66('0x84'))[_0xcb66('0x85')]()[_0xcb66('0x2a')](function(_0x225a8a){if(_0x225a8a){_0x3e2ac3=_0x225a8a[_0xcb66('0x86')];}})[_0xcb66('0x2a')](function(){return db['ChatWebsite'][_0xcb66('0x60')](_0x431743);})['then'](handleEntityNotFound(_0x62477d,null))['then'](function(_0x5e1e14){if(_0x5e1e14){if(!_[_0xcb66('0x87')](_0x5e1e14[_0xcb66('0x88')])){if(fs[_0xcb66('0x89')](path[_0xcb66('0x82')](config[_0xcb66('0x83')],_0xcb66('0x8a'),_0x5e1e14[_0xcb66('0x88')]))&&_0x3e2ac3){_0x3f596e=path['join'](config[_0xcb66('0x83')],_0xcb66('0x8a'),_0x5e1e14[_0xcb66('0x88')]);}}return _0x62477d[_0xcb66('0x8b')](_0x3f596e);}})['catch'](handleError(_0x62477d,null));};exports[_0xcb66('0x8c')]=function(_0x55b5db,_0x5e4f31){var _0x3dbff2=path[_0xcb66('0x82')](config['root'],_0xcb66('0x8d'));var _0x32167e={'where':{'id':_0x55b5db[_0xcb66('0x5d')]['id']},'attributes':['id',_0xcb66('0x7d')],'raw':!![]};return db['ChatWebsite'][_0xcb66('0x60')](_0x32167e)[_0xcb66('0x2a')](handleEntityNotFound(_0x5e4f31,null))[_0xcb66('0x2a')](function(_0x1ad3e7){if(_0x1ad3e7){if(!_['isNil'](_0x1ad3e7[_0xcb66('0x7d')])){if(fs['existsSync'](path[_0xcb66('0x82')](config[_0xcb66('0x83')],'server/files/images/avatars/',_0x1ad3e7['agentAvatar']))){_0x3dbff2=path['join'](config[_0xcb66('0x83')],_0xcb66('0x8e'),_0x1ad3e7['agentAvatar']);}}return _0x5e4f31[_0xcb66('0x8b')](_0x3dbff2);}})[_0xcb66('0x6c')](handleError(_0x5e4f31,null));};exports['getCustomerAvatar']=function(_0x16484b,_0x2b1f71){var _0xc15548=path[_0xcb66('0x82')](config[_0xcb66('0x83')],_0xcb66('0x8f'));var _0x31de77={'where':{'id':_0x16484b[_0xcb66('0x5d')]['id']},'attributes':['id','customerAvatar',_0xcb66('0x90')],'raw':!![]};return db[_0xcb66('0x47')][_0xcb66('0x60')](_0x31de77)[_0xcb66('0x2a')](handleEntityNotFound(_0x2b1f71,null))[_0xcb66('0x2a')](function(_0xe1ee43){if(_0xe1ee43){if(!_[_0xcb66('0x87')](_0xe1ee43['customerAvatar'])){if(fs[_0xcb66('0x89')](path[_0xcb66('0x82')](config[_0xcb66('0x83')],_0xcb66('0x8e'),_0xe1ee43['customerAvatar']))&&_0xe1ee43['showCustomerAvatar']){_0xc15548=path[_0xcb66('0x82')](config[_0xcb66('0x83')],_0xcb66('0x8e'),_0xe1ee43[_0xcb66('0x91')]);}}return _0x2b1f71[_0xcb66('0x8b')](_0xc15548);}})[_0xcb66('0x6c')](handleError(_0x2b1f71,null));};exports[_0xcb66('0x92')]=function(_0x82b928,_0x1b3826){var _0x45ce16=path[_0xcb66('0x82')](config[_0xcb66('0x83')],'server/files/images/avatars/system_avatar.png');var _0x4cdd22={'where':{'id':_0x82b928['params']['id']},'attributes':['id',_0xcb66('0x80')],'raw':!![]};return db[_0xcb66('0x47')][_0xcb66('0x60')](_0x4cdd22)['then'](handleEntityNotFound(_0x1b3826,null))[_0xcb66('0x2a')](function(_0x21509b){if(_0x21509b){if(!_[_0xcb66('0x87')](_0x21509b[_0xcb66('0x80')])){if(fs['existsSync'](path['join'](config[_0xcb66('0x83')],'server/files/images/avatars/',_0x21509b[_0xcb66('0x80')]))){_0x45ce16=path[_0xcb66('0x82')](config[_0xcb66('0x83')],_0xcb66('0x8e'),_0x21509b[_0xcb66('0x80')]);}}return _0x1b3826[_0xcb66('0x8b')](_0x45ce16);}})[_0xcb66('0x6c')](handleError(_0x1b3826,null));};function checkWebsiteInterval(_0x4b03cc){var _0x19d331=_0x4b03cc[_0xcb66('0x93')];if(!_0x19d331){return Promise[_0xcb66('0x94')](_0x4b03cc);}var _0xf2044d=_0x4b03cc['timezone']||undefined;return _0x19d331[_0xcb66('0x95')](_0xf2044d)[_0xcb66('0x2a')](function(_0x623fa){if(!_0x623fa){throw new APIOutOfIntervalError();}return _0x4b03cc;});}exports[_0xcb66('0x96')]=function(_0x141290,_0x4a0094){var _0x28a8ee={'body':_0x141290[_0xcb66('0x62')],'channel':_0xcb66('0x97')};var _0x19d559=[];var _0x39a248=[];var _0x4cb5c0={};var _0x1a4597=![];if(_0x141290[_0xcb66('0x62')]['id']){delete _0x141290[_0xcb66('0x62')]['id'];}if(_[_0xcb66('0x87')](_0x141290[_0xcb66('0x62')][_0xcb66('0x98')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0xcb66('0x87')](_0x141290[_0xcb66('0x62')]['mapKey'])){throw new APIBadRequestError(_0xcb66('0x99'));}if(_[_0xcb66('0x9a')](_0x141290[_0xcb66('0x62')]['body'])){throw new APIBadRequestError('Body\x20is\x20mandatory');}var _0x7a6acf=_0x141290[_0xcb66('0x62')]['customerIp']&&_0x141290[_0xcb66('0x62')][_0xcb66('0x9b')];return db['CmContact'][_0xcb66('0x6f')]()[_0xcb66('0x2a')](function(_0x4872a1){if(!_0x4872a1){throw new Error(_0xcb66('0x9c'));}_0x19d559=Object[_0xcb66('0x4c')](_0x4872a1)['filter'](function(_0xa9e44b){return!['createdAt',_0xcb66('0x9d')][_0xcb66('0x9e')](_0xa9e44b);});_0x39a248=Object[_0xcb66('0x4c')](_0x4872a1)[_0xcb66('0x56')](function(_0x4b1ea0){return![_0xcb66('0x9f'),'updatedAt',_0xcb66('0xa0'),_0xcb66('0xa1')]['includes'](_0x4b1ea0);});if(!_[_0xcb66('0x9e')](_0x39a248,_0x141290[_0xcb66('0x62')][_0xcb66('0xa2')])){throw new APIBadRequestError('Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20'+_0x39a248[_0xcb66('0x82')](',\x20'));}_0x4cb5c0[_0x141290[_0xcb66('0x62')]['mapKey']]=_0x141290[_0xcb66('0x62')][_0xcb66('0x98')];})[_0xcb66('0x2a')](function(){return db['ChatWebsite'][_0xcb66('0x60')]({'where':{'id':_0x141290[_0xcb66('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xcb66('0xa3'),'include':[{'model':db[_0xcb66('0xa4')],'as':_0xcb66('0xa5'),'where':_0x4cb5c0,'limit':0x1,'order':[[_0xcb66('0x9d'),_0xcb66('0xa6')]]}]},{'model':db[_0xcb66('0xa7')],'as':_0xcb66('0xa8')},{'model':db[_0xcb66('0x93')],'as':_0xcb66('0x93'),'include':[{'model':db[_0xcb66('0x93')],'as':_0xcb66('0xa9'),'attributes':['id',_0xcb66('0xaa')],'raw':!![]}]}]});})[_0xcb66('0x2a')](function(_0x5b84cc){if(!_0x5b84cc){throw new APINotFoundError(util[_0xcb66('0x3c')](_0xcb66('0xab'),_0x141290[_0xcb66('0x5d')]['id']));}if(_0x7a6acf){return checkWebsiteInterval(_0x5b84cc);}return _0x5b84cc;})['then'](function(_0x3d7e34){_0x28a8ee['account']=_0x3d7e34;_0x28a8ee[_0xcb66('0xac')]=_[_0xcb66('0xad')](_0x3d7e34[_0xcb66('0xa8')],[_0xcb66('0xae')],[_0xcb66('0xaf')]);if(_0x28a8ee[_0xcb66('0xb0')][_0xcb66('0xa8')]){delete _0x28a8ee[_0xcb66('0xb0')][_0xcb66('0xa8')];}_0x28a8ee[_0xcb66('0xb1')]=_0x3d7e34['List']||{'id':_0x3d7e34[_0xcb66('0xa1')]};if(_0x28a8ee['list']&&_0x28a8ee['list'][_0xcb66('0xa5')][_0xcb66('0x4f')]){return _0x28a8ee[_0xcb66('0xb1')][_0xcb66('0xa5')][0x0];}var _0x42d1a6=_[_0xcb66('0x12')](_0x141290[_0xcb66('0x62')],{'firstName':_0x141290['body'][_0xcb66('0x98')],'ListId':_0x3d7e34[_0xcb66('0xa1')]});_0x42d1a6[_0x141290[_0xcb66('0x62')][_0xcb66('0xa2')]]=_0x141290[_0xcb66('0x62')][_0xcb66('0x98')];return db[_0xcb66('0xa4')][_0xcb66('0x61')](_0x42d1a6,{'fields':_0x19d559,'raw':!![]});})['then'](function(_0x2245ef){_0x28a8ee[_0xcb66('0xb2')]=_0x2245ef;var _0x521519=createInteractionObject(_0x141290[_0xcb66('0x5d')]['id'],_0x141290['body'],_0x141290[_0xcb66('0xb3')],_0x2245ef);var _0x4ae876={'ChatWebsiteId':_0x141290[_0xcb66('0x5d')]['id']};if(_0x141290[_0xcb66('0x62')]['threadId']){_0x4ae876[_0xcb66('0xb4')]=_0x141290[_0xcb66('0x62')][_0xcb66('0xb4')];_0x4ae876[_0xcb66('0xb5')]=![];return db[_0xcb66('0xb6')][_0xcb66('0x60')]({'where':_0x4ae876})[_0xcb66('0x2a')](function(_0x33f34f){var _0x43c71f=_0x141290[_0xcb66('0x62')][_0xcb66('0xb7')]&&_0x141290['body'][_0xcb66('0x9b')];if(_0x33f34f){_0x1a4597=!![];return _0x33f34f;}else if(!_0x43c71f&&_0x33f34f&&_0x33f34f[_0xcb66('0xb5')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x521519[_0xcb66('0xb4')]=_0x141290[_0xcb66('0x62')][_0xcb66('0xb4')];_0x521519[_0xcb66('0xb8')]=_0x141290[_0xcb66('0x62')][_0xcb66('0xb8')];return db['ChatInteraction']['create'](_0x521519);});}_0x4ae876[_0xcb66('0xb9')]=_0x2245ef['id'];if(_0x141290[_0xcb66('0x62')][_0xcb66('0xba')]&&_0x141290[_0xcb66('0x62')][_0xcb66('0xba')]['id']){_0x4ae876['id']=_0x141290[_0xcb66('0x62')][_0xcb66('0xba')]['id'];return db[_0xcb66('0xb6')][_0xcb66('0x60')]({'where':_0x4ae876})[_0xcb66('0x2a')](function(_0x3e9522){var _0x2ee716=_0x141290[_0xcb66('0x62')]['customerIp']&&_0x141290[_0xcb66('0x62')][_0xcb66('0x9b')];if(!_0x2ee716&&_0x3e9522&&_0x3e9522[_0xcb66('0xb5')]){throw new APIConflictError(_0xcb66('0xbb'));}else if(_0x3e9522){_0x1a4597=!![];return _0x3e9522;}else{return db[_0xcb66('0xb6')][_0xcb66('0x61')](_0x521519);}});}return db[_0xcb66('0xb6')][_0xcb66('0x61')](_0x521519);})[_0xcb66('0x2a')](function(_0x5425b7){if(!_0x1a4597){return _0x5425b7;}var _0x122e36={'from':(_0x28a8ee[_0xcb66('0xb2')][_0xcb66('0x38')]||'')+'\x20'+(_0x28a8ee[_0xcb66('0xb2')][_0xcb66('0x39')]||'')};if(_0x141290['body'][_0xcb66('0xb4')]&&_0x141290[_0xcb66('0x62')][_0xcb66('0xbc')]&&_0x141290['body'][_0xcb66('0xb4')]!=_0x141290[_0xcb66('0x62')]['messageId']){_0x122e36[_0xcb66('0xb4')]=_0x141290['body'][_0xcb66('0xbc')];}return _0x5425b7[_0xcb66('0x29')](_0x122e36);})['then'](function(_0x1c8e78){_0x28a8ee['interaction']=_0x1c8e78[_0xcb66('0x2c')]({'plain':!![]});_0x28a8ee[_0xcb66('0xba')][_0xcb66('0xbd')]=!_0x1a4597;if(_0x28a8ee[_0xcb66('0xba')][_0xcb66('0xbd')]){if(_0x28a8ee[_0xcb66('0xb0')][_0xcb66('0xbe')]){_0x28a8ee['applications']['push']({'id':0x0,'priority':_0x28a8ee[_0xcb66('0xac')]['length']+0x1,'app':'close','appdata':_0xcb66('0xbf'),'interval':_0xcb66('0xc0')});}}return db[_0xcb66('0xc1')][_0xcb66('0x61')]({'body':_0x141290['body'][_0xcb66('0x62')],'ChatWebsiteId':_0x141290[_0xcb66('0x5d')]['id'],'ChatInteractionId':_0x1c8e78['id'],'direction':'in','ContactId':_0x28a8ee[_0xcb66('0xb2')]['id'],'AttachmentId':_0x141290[_0xcb66('0x62')]['AttachmentId']});})[_0xcb66('0x2a')](function(_0x2eb5ad){_0x28a8ee[_0xcb66('0x1f')]=_0x2eb5ad;if(!_0x28a8ee['interaction'][_0xcb66('0xc2')]){return;}return db[_0xcb66('0xc3')][_0xcb66('0x60')]({'attributes':['id',_0xcb66('0x2f')],'where':{'id':_0x28a8ee[_0xcb66('0xba')][_0xcb66('0xc2')]}});})['then'](function(_0x22e225){if(_0x22e225){_0x28a8ee[_0xcb66('0xac')][_0xcb66('0xc4')]({'id':0x0,'priority':0x0,'app':_0xcb66('0xc5'),'appdata':_0x22e225[_0xcb66('0x2f')]+','+(_0x28a8ee[_0xcb66('0xb0')][_0xcb66('0xc6')]||0xa),'interval':_0xcb66('0xc0')});_0x28a8ee['forcedOwnership']=!![];}if(!_0x28a8ee['interaction'][_0xcb66('0xc7')]){return;}return db[_0xcb66('0xc8')]['find']({'attributes':['id',_0xcb66('0x2f')],'where':{'id':_0x28a8ee[_0xcb66('0xba')][_0xcb66('0xc7')]}});})['then'](function(_0x560aaa){if(_0x560aaa){_0x28a8ee[_0xcb66('0xac')][_0xcb66('0xc4')]({'id':0x0,'priority':0x1,'app':_0xcb66('0xc9'),'appdata':_0x560aaa[_0xcb66('0x2f')]+','+(_0x28a8ee['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcb66('0xca'),_0xcb66('0xcb'),_0x28a8ee);})[_0xcb66('0x2a')](function(_0x438a70){respondWithRpcPromise(_0xcb66('0xcc'),_0xcb66('0xcc'),{'event':_0xcb66('0x96'),'message':_0x438a70},client9002);return _0x438a70;})[_0xcb66('0x2a')](respondWithResult(_0x4a0094,null))['catch'](APIHandleError(_0x4a0094));};exports[_0xcb66('0xcd')]=function(_0x1aa67c,_0x50b72d){var _0x2f1402,_0x5adf8c,_0x89db5;var _0x452ee2=[];var _0x58f70e={};var _0x120c77=_0x1aa67c[_0xcb66('0xce')]||[];var _0x5d9356=[];var _0xcfb9fe;return db[_0xcb66('0xa4')][_0xcb66('0x6f')]()[_0xcb66('0x2a')](function(_0x4cc1ee){if(!_0x4cc1ee){throw new db[(_0xcb66('0xcf'))][(_0xcb66('0xd0'))](_0xcb66('0xd1'));}_0x452ee2=_[_0xcb66('0xd2')](_['keys'](_0x4cc1ee),[_0xcb66('0x9f'),_0xcb66('0x9d'),_0xcb66('0xa0'),_0xcb66('0xa1')]);if(_0x1aa67c[_0xcb66('0x62')]['id']){delete _0x1aa67c[_0xcb66('0x62')]['id'];}if(_['isNil'](_0x1aa67c[_0xcb66('0x62')]['from'])){throw _0x50b72d[_0xcb66('0x22')](0x1f4)[_0xcb66('0x30')](new db[(_0xcb66('0xcf'))][(_0xcb66('0xd0'))](_0xcb66('0xd3')));}if(_[_0xcb66('0x87')](_0x1aa67c[_0xcb66('0x62')][_0xcb66('0x62')])||_0x1aa67c[_0xcb66('0x62')][_0xcb66('0x62')]===''){throw _0x50b72d[_0xcb66('0x22')](0x1f4)[_0xcb66('0x30')](new db[(_0xcb66('0xcf'))][(_0xcb66('0xd0'))](_0xcb66('0xd4')));}if(_['isNil'](_0x1aa67c['body']['mapKeyOffline'])){throw _0x50b72d[_0xcb66('0x22')](0x1f4)['send'](new db[(_0xcb66('0xcf'))][(_0xcb66('0xd0'))](_0xcb66('0xd5')+_0x452ee2));}if(!_[_0xcb66('0x9e')](_0x452ee2,_0x1aa67c[_0xcb66('0x62')][_0xcb66('0xd6')])){throw _0x50b72d['status'](0x1f4)[_0xcb66('0x30')](new db[(_0xcb66('0xcf'))]['ValidationError'](_0xcb66('0xd7')+_0x452ee2));}_0x58f70e[_0x1aa67c['body']['mapKeyOffline']]=_0x1aa67c['body'][_0xcb66('0x98')];})[_0xcb66('0x2a')](function(){return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x1aa67c[_0xcb66('0x5d')]['id']},'include':[{'model':db['CmList'],'as':_0xcb66('0xa3')},{'model':db[_0xcb66('0xd8')],'as':_0xcb66('0xd8')}]});})['then'](handleEntityNotFound(_0x50b72d,null))[_0xcb66('0x2a')](function(_0x1d8a1d){if(_0x1d8a1d&&_0x1d8a1d[_0xcb66('0xa3')]){_0x5adf8c=_0x1d8a1d;var _0x58bcbc=_[_0xcb66('0x12')](_0x1aa67c[_0xcb66('0x62')],{'firstName':_0x1aa67c[_0xcb66('0x62')][_0xcb66('0x98')],'phone':_0x1aa67c[_0xcb66('0x62')][_0xcb66('0x98')],'ListId':_0x1d8a1d[_0xcb66('0xa1')]});_0x58bcbc[_0x1aa67c[_0xcb66('0x62')]['mapKeyOffline']]=_0x1aa67c[_0xcb66('0x62')][_0xcb66('0x98')];return db[_0xcb66('0xa4')][_0xcb66('0xd9')]({'where':_0x58f70e,'defaults':_0x58bcbc});}})[_0xcb66('0xda')](function(_0x4747be){if(_0x4747be){_0x89db5=_0x4747be;var _0x50329e=fs[_0xcb66('0xdb')](path['join'](config['root'],_0xcb66('0xdc')),_0xcb66('0xdd'));var _0x205dc5=ejs[_0xcb66('0xde')](_0x50329e,{'body':_[_0xcb66('0xdf')](_0x1aa67c[_0xcb66('0x62')][_0xcb66('0x62')]),'bodyTitle':_0x5adf8c[_0xcb66('0xe0')]});return db['ChatOfflineMessage'][_0xcb66('0x61')]({'body':_0x205dc5,'plainBody':htmlToText[_0xcb66('0xe1')](_0x205dc5),'ContactId':_0x4747be['id'],'ChatWebsiteId':_0x5adf8c['id']});}})[_0xcb66('0x2a')](function(_0x27aac3){_0xcfb9fe=_0x27aac3;if(_0x120c77[_0xcb66('0x4f')]){var _0x1e46d3=_0x120c77[_0xcb66('0x46')](function(_0x503954){return{'name':_0x503954[_0xcb66('0xe2')],'basename':_0x503954[_0xcb66('0x7b')],'type':_0x503954['mimetype'],'ChatOfflineMessageId':_0x27aac3['id']};});_0x5d9356=_0x1e46d3[_0xcb66('0x46')](_0x2cb3b3=>{var _0x1d5787={'filename':_0x2cb3b3[_0xcb66('0x2f')],'path':path['join'](config[_0xcb66('0x83')],'server',_0xcb66('0xce'),'attachments','offline-chat',_0x2cb3b3[_0xcb66('0xe3')])};return _0x1d5787;});if(!_0x5adf8c[_0xcb66('0xe4')]){return db['sequelize'][_0xcb66('0xe5')](function(_0x4a719a){return db[_0xcb66('0xe6')][_0xcb66('0xe7')](_0x1e46d3,{'transaction':_0x4a719a});});}}})['then'](function(){if(_0xcfb9fe){_0x2f1402=_0xcfb9fe;return db[_0xcb66('0xd8')][_0xcb66('0x72')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xcb66('0xe8'),'raw':!![],'include':[{'model':db[_0xcb66('0xe9')],'as':_0xcb66('0xe9'),'raw':!![]}]}]});}})[_0xcb66('0x2a')](function(_0x5eaee3){if(_0x5eaee3&&_0x5eaee3[_0xcb66('0xe8')]&&_0x5adf8c['forwardOffline']&&_0x5adf8c[_0xcb66('0xea')]){var _0x21aadc=_0x5eaee3['getSmtpOptions']();return respondWithRpcPromise(_0xcb66('0xeb'),_0xcb66('0xec'),{'account':_0x21aadc,'message':{'from':util[_0xcb66('0x3c')](_0xcb66('0xed'),_0x5eaee3['name'],_0x5eaee3['email']||_0x5eaee3[_0xcb66('0xe8')][_0xcb66('0x67')]),'to':_0x5adf8c[_0xcb66('0xea')],'subject':_0x5adf8c[_0xcb66('0xee')],'html':_0x2f1402[_0xcb66('0x62')],'attachments':_0x5d9356}},client9003)[_0xcb66('0x2a')](function(){return _0x2f1402;})[_0xcb66('0x6c')](function(_0xe7310f){logger[_0xcb66('0x1e')](_0xe7310f);});}})['then'](function(){if(_0x5adf8c&&_0x5adf8c['openNewInteraction']&&_0x5adf8c[_0xcb66('0xef')]){var _0x4ac6a0=[];if(_0x120c77[_0xcb66('0x4f')]){_0x4ac6a0=_0x120c77[_0xcb66('0x46')](function(_0x53575f){return{'name':_0x53575f[_0xcb66('0xe2')],'basename':_0x53575f[_0xcb66('0x7b')],'type':_0x53575f['mimetype'],'ChatOfflineMessageId':_0xcfb9fe['id']};});}var _0x28fdb5;if(!_[_0xcb66('0x87')](_0x5adf8c[_0xcb66('0xf0')])){var _0x1281f2=_[_0xcb66('0x46')](_0x1aa67c[_0xcb66('0x62')],function(_0x165e33){return _0x165e33;});var _0x520d5b=_[_0xcb66('0xf1')](_0x1281f2)[0x0];var _0x230d3e=_[_0xcb66('0xf2')](_0x520d5b,function(_0x5481be){return _0x5481be;});_0x28fdb5=_0x230d3e[0x1][_0x5adf8c['subjectOffline']];}var _0x8f4122={'from':_0x89db5['email'],'firstName':_0x89db5[_0xcb66('0x38')],'lastName':_0x89db5[_0xcb66('0x39')],'mapKey':_0xcb66('0xf3'),'message':{'from':_0x89db5['email'],'to':_0x5adf8c[_0xcb66('0xd8')][_0xcb66('0xf3')],'cc':'','subject':_['isNil'](_0x28fdb5)?_0x5adf8c[_0xcb66('0xee')]:_0x28fdb5,'messageId':'','sentAt':new Date(),'attach':_0x4ac6a0[_0xcb66('0x4f')],'attachments':_0x4ac6a0,'originChannel':'Chat','ChatWebsiteId':_0x5adf8c['id'],'ChatOfflineMessageId':_0x2f1402['id'],'originTo':_0x5adf8c[_0xcb66('0xd8')][_0xcb66('0xf3')]},'body':_0x2f1402[_0xcb66('0x62')]};var _0x2ce4e4={'account':{'id':_0x5adf8c[_0xcb66('0xef')]},'body':_0x8f4122,'log':_0xcb66('0xf4')};return respondWithRpcPromise(_0xcb66('0xf4'),_0xcb66('0xf5'),_0x2ce4e4,client9001)[_0xcb66('0x2a')](function(){return _0x2f1402;})[_0xcb66('0x6c')](function(_0x4c07d3){logger[_0xcb66('0x1e')](_0x4c07d3);});}return;})[_0xcb66('0x2a')](function(){if(_0x2f1402){return _0x2f1402;}})[_0xcb66('0x2a')](respondWithResult(_0x50b72d,null))['catch'](function(){for(var _0x319d22 of _0x120c77){var _0xaab756=path[_0xcb66('0x82')](config['root'],_0xcb66('0xf6'),_0xcb66('0xce'),_0xcb66('0xf7'),_0xcb66('0xf8'),_0x319d22[_0xcb66('0x7b')]);fs_extra[_0xcb66('0xf9')](_0xaab756)['catch'](function(_0x2a380e){logger[_0xcb66('0x1e')]('Could\x20not\x20remove\x20attachment\x20file',_0xaab756,_0x2a380e);});}});};exports['addInteraction']=function(_0x3af4cb,_0x158f76){return db[_0xcb66('0xb6')][_0xcb66('0x60')]({'where':{'id':_0x3af4cb[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x158f76,null))['then'](function(_0x22817d){if(_0x22817d){return _0x22817d[_0xcb66('0xfa')](_0x3af4cb['body'][_0xcb66('0x76')],_['omit'](_0x3af4cb['body'],[_0xcb66('0x76'),'id'])||{});}})[_0xcb66('0x2a')](respondWithResult(_0x158f76,null))[_0xcb66('0x6c')](handleError(_0x158f76,null));};exports[_0xcb66('0xfb')]=function(_0x218d5c,_0x2a30cf){var _0x259021={'raw':![],'where':{}};var _0x27c84b={};var _0x2ceb4d={'count':0x0,'rows':[]};return db[_0xcb66('0x47')][_0xcb66('0x72')]({'where':{'id':_0x218d5c['params']['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x2a30cf,null))[_0xcb66('0x2a')](function(_0x1f868a){if(_0x1f868a){_0x27c84b[_0xcb66('0x4a')]=_[_0xcb66('0x4c')](db[_0xcb66('0xb6')][_0xcb66('0x48')]);_0x27c84b[_0xcb66('0x4b')]=_['keys'](_0x218d5c[_0xcb66('0x4b')]);_0x27c84b[_0xcb66('0x54')]=_[_0xcb66('0x4d')](_0x27c84b[_0xcb66('0x4a')],_0x27c84b['query']);_0x259021[_0xcb66('0x4e')]=_[_0xcb66('0x4d')](_0x27c84b[_0xcb66('0x4a')],qs[_0xcb66('0x5e')](_0x218d5c[_0xcb66('0x4b')]['fields']));_0x259021['attributes']=_0x259021['attributes'][_0xcb66('0x4f')]?_0x259021[_0xcb66('0x4e')]:_0x27c84b[_0xcb66('0x4a')];if(!_0x218d5c[_0xcb66('0x4b')][_0xcb66('0x50')](_0xcb66('0x51'))){_0x259021[_0xcb66('0x25')]=qs[_0xcb66('0x25')](_0x218d5c['query']['limit']);_0x259021[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x218d5c[_0xcb66('0x4b')][_0xcb66('0x24')]);}_0x259021[_0xcb66('0x52')]=qs[_0xcb66('0x74')](_0x218d5c[_0xcb66('0x4b')]['sort']);_0x259021['where']=qs[_0xcb66('0x54')](_[_0xcb66('0x55')](_0x218d5c[_0xcb66('0x4b')],_0x27c84b[_0xcb66('0x54')]));_0x259021[_0xcb66('0x53')][_0xcb66('0x70')]=_0x1f868a['id'];if(_0x218d5c[_0xcb66('0x4b')]['filter']){_0x259021['where']=_[_0xcb66('0x57')](_0x259021[_0xcb66('0x53')],{'$or':_[_0xcb66('0x46')](_0x259021[_0xcb66('0x4e')],function(_0x4a2838){var _0xa32239={};_0xa32239[_0x4a2838]={'$like':'%'+_0x218d5c['query'][_0xcb66('0x56')]+'%'};return _0xa32239;})});}_0x259021=_[_0xcb66('0x57')]({},_0x259021,_0x218d5c[_0xcb66('0x59')]);return db[_0xcb66('0xb6')][_0xcb66('0x26')]({'where':_0x259021[_0xcb66('0x53')]})['then'](function(_0xee9dc3){_0x2ceb4d[_0xcb66('0x26')]=_0xee9dc3;if(_0x218d5c[_0xcb66('0x4b')][_0xcb66('0x5f')]){_0x259021['include']=[{'model':db['CmContact'],'as':_0xcb66('0xfc'),'required':![]},{'model':db[_0xcb66('0xc3')],'as':'Owner','attributes':[_0xcb66('0x2f'),_0xcb66('0xfd'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xcb66('0xfe'),'attributes':['id',_0xcb66('0x2f'),'color'],'where':_0x218d5c[_0xcb66('0x4b')][_0xcb66('0xff')]?{'id':_0x218d5c[_0xcb66('0x4b')][_0xcb66('0xff')]}:undefined,'required':_0x218d5c[_0xcb66('0x4b')][_0xcb66('0xff')]?!![]:![]}];}return db[_0xcb66('0xb6')][_0xcb66('0x5b')](_0x259021);})[_0xcb66('0x2a')](function(_0xad3910){_0x2ceb4d[_0xcb66('0x5c')]=_0xad3910;return _0x2ceb4d;});}})[_0xcb66('0x2a')](respondWithFilteredResult(_0x2a30cf,_0x259021))[_0xcb66('0x6c')](handleError(_0x2a30cf,null));};exports[_0xcb66('0x100')]=function(_0x2717d9,_0x24cee){var _0x525b50=0x0;var _0x504b50=0x0;var _0x5c21c8=![];var _0x49b402;var _0x3d92a4;return db[_0xcb66('0x47')][_0xcb66('0x60')]({'where':{'id':_0x2717d9['params']['id']},'include':[{'model':db[_0xcb66('0x93')],'as':_0xcb66('0x93'),'include':[{'model':db[_0xcb66('0x93')],'as':_0xcb66('0xa9'),'attributes':['id','interval']}]}]})[_0xcb66('0x2a')](handleEntityNotFound(_0x24cee,null))[_0xcb66('0x2a')](function(_0x45eae5){if(_0x45eae5){_0x49b402=_0x45eae5;return _0x45eae5[_0xcb66('0x101')]({'raw':!![]});}})['then'](function(_0x55b94f){if(_0x49b402){if(_0x55b94f){_0x3d92a4=_0x55b94f;}}return require(_0xcb66('0x84'))['getLicense']();})[_0xcb66('0x2a')](function(_0x454967){if(_0x454967){_0x504b50=_0x454967[_0xcb66('0x102')];_0x5c21c8=_0x454967['custom'];}})[_0xcb66('0x2a')](function(){return db['ChatInteraction'][_0xcb66('0x26')]({'where':{'closed':![]}});})[_0xcb66('0x2a')](function(_0x31703a){_0x525b50=_0x31703a;if(_0x504b50&&_0x31703a>_0x504b50){return db[_0xcb66('0x103')][_0xcb66('0x72')]({'where':{'id':0x1}})[_0xcb66('0x2a')](function(_0x33fec4){if(_0x33fec4){_0x33fec4['increment']('chatLicenseExceeded');}});}})[_0xcb66('0x2a')](function(){var _0x2eff0b=_0x49b402[_0xcb66('0x93')];var _0x5112db=_0x49b402[_0xcb66('0x104')]||undefined;return _0x2eff0b?_0x2eff0b[_0xcb66('0x95')](_0x5112db):!![];})[_0xcb66('0x2a')](function(_0x19f853){var _0x45d728=fs['readFileSync'](path['join'](config['root'],_0xcb66('0x105')),'utf8');var _0x1c9ab6=_0xcb66('0x106');var _0x1fd6dc=![];var _0x1325be,_0x1a9125;if(_0x2717d9[_0xcb66('0xb3')][_0xcb66('0x9b')]){_0x1325be=new URL(_0x2717d9[_0xcb66('0xb3')][_0xcb66('0x9b')])[_0xcb66('0x107')];}else if(_0x2717d9[_0xcb66('0xb3')][_0xcb66('0x107')]){_0x1325be=new URL(_0x2717d9[_0xcb66('0xb3')][_0xcb66('0x107')])[_0xcb66('0x107')];}else{_0x1325be=_0xcb66('0x108');}_0x1a9125=typeof _0x49b402[_0xcb66('0x63')][_0xcb66('0x37')](',')[_0xcb66('0x60')](function(_0x30c2b9){return wildcardUtils[_0xcb66('0x109')](_0x30c2b9,_0x1325be);})!=='undefined';var _0x5377e1={'chatVersion':_0x1c9ab6,'chatWebsiteAddressOrigin':_0x1a9125?_0x1325be:_0x49b402[_0xcb66('0x63')],'remote':_0x49b402[_0xcb66('0x10a')],'query':querystring[_0xcb66('0x1d')](_[_0xcb66('0x57')](_0x49b402[_0xcb66('0x2c')]({'plain':!![]}),{'customerIp':_0x2717d9['headers'][_0xcb66('0x35')]||_0x2717d9[_0xcb66('0xb3')]['x-real-ip']||_0x2717d9[_0xcb66('0x10b')][_0xcb66('0x10c')]||_0x2717d9['ip'],'referer':_0x2717d9[_0xcb66('0xb3')][_0xcb66('0x9b')],'openedInteractions':_0x525b50,'maxInteractions':_0x504b50,'virtual':_0x5c21c8[_0xcb66('0x102')],'online':_0x19f853,'custom':_0x5c21c8,'address':_0x1a9125?_0x1325be:null}))[_0xcb66('0x10d')](/'/g,'\x5c\x27')};_0x24cee[_0xcb66('0x30')](ejs[_0xcb66('0xde')](Mustache[_0xcb66('0xde')](_0x45d728,_0x5377e1),{'proactiveActions':_0x3d92a4,'alignment':_0x49b402['alignment'],'verticalAlignment':_0x49b402['verticalAlignment'],'div_color':_0x49b402[_0xcb66('0x10e')],'labelText':_0x49b402['labelText'],'text_color':_0x49b402[_0xcb66('0x10f')],'text_button_color':_0x49b402[_0xcb66('0x110')],'button_color':_0x49b402[_0xcb66('0x111')],'background_color':_0x49b402[_0xcb66('0x112')],'hideWhenOffline':_0x49b402[_0xcb66('0x113')],'intervalId':_0x49b402[_0xcb66('0x114')],'isDevelopment':_0x1fd6dc,'chatVersion':_0x1c9ab6}));})[_0xcb66('0x6c')](handleError(_0x24cee,null));};exports[_0xcb66('0x115')]=function(_0x45242e,_0x1cd997){var _0x24c5b4=_0x45242e['params']['id'];var _0x187f4f=_0x45242e[_0xcb66('0x62')];var _0x466e59=0xc8;var _0x580d2c=null;return db['sequelize'][_0xcb66('0xe5')]({'isolationLevel':db[_0xcb66('0x116')][_0xcb66('0x117')][_0xcb66('0x118')][_0xcb66('0x119')]},function(_0x2f4f75){return db['ChatWebsite'][_0xcb66('0x72')]({'where':{'id':_0x24c5b4},'transaction':_0x2f4f75})['then'](function(_0x53e976){if(_0x53e976){return db[_0xcb66('0xa7')][_0xcb66('0x2b')]({'where':{'ChatWebsiteId':_0x24c5b4},'transaction':_0x2f4f75})[_0xcb66('0x2a')](function(){var _0x514ffb=_[_0xcb66('0x46')](_0x187f4f,function(_0x29f913){_0x29f913[_0xcb66('0x70')]=_0x24c5b4;return _0x29f913;});return db[_0xcb66('0xa7')][_0xcb66('0xe7')](_0x514ffb,{'transaction':_0x2f4f75});});}else{_0x466e59=0x194;_0x580d2c=[];}});})[_0xcb66('0x2a')](function(){if(_0x466e59!==0x194){return db[_0xcb66('0xa7')][_0xcb66('0x11a')]({'where':{'ChatWebsiteId':_0x24c5b4},'order':_0xcb66('0xae')})[_0xcb66('0x2a')](function(_0x2c044c){_0x580d2c=_0x2c044c;});}})[_0xcb66('0x6c')](function(_0x3e2ccb){_0x466e59=0x1f4;logger[_0xcb66('0x1e')](_0x3e2ccb[_0xcb66('0x2e')]);if(_0x3e2ccb[_0xcb66('0x2f')]){delete _0x3e2ccb[_0xcb66('0x2f')];}_0x580d2c=_0x3e2ccb;})[_0xcb66('0x11b')](function(){if(_0x580d2c===null){_0x1cd997[_0xcb66('0x21')](_0x466e59);}else{if(_0x466e59===0x1f4){_0x1cd997['status'](_0x466e59)[_0xcb66('0x30')](_0x580d2c);}else{_0x1cd997[_0xcb66('0x22')](_0x466e59)[_0xcb66('0x23')](_0x580d2c);}}});};exports['getApplications']=function(_0x5eb415,_0x4eb53d){var _0x29c787={};var _0x46cb51={};var _0x19a1a2;var _0xc951cf;return db['ChatWebsite'][_0xcb66('0x72')]({'where':{'id':_0x5eb415[_0xcb66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4eb53d,null))[_0xcb66('0x2a')](function(_0x412515){if(_0x412515){_0x19a1a2=_0x412515;_0x46cb51[_0xcb66('0x4a')]=_['keys'](db[_0xcb66('0xa7')][_0xcb66('0x48')]);_0x46cb51[_0xcb66('0x4b')]=_[_0xcb66('0x4c')](_0x5eb415['query']);_0x46cb51['filters']=_[_0xcb66('0x4d')](_0x46cb51[_0xcb66('0x4a')],_0x46cb51[_0xcb66('0x4b')]);_0x29c787[_0xcb66('0x4e')]=_[_0xcb66('0x4d')](_0x46cb51[_0xcb66('0x4a')],qs['fields'](_0x5eb415[_0xcb66('0x4b')][_0xcb66('0x5e')]));_0x29c787['attributes']=_0x29c787[_0xcb66('0x4e')][_0xcb66('0x4f')]?_0x29c787[_0xcb66('0x4e')]:_0x46cb51[_0xcb66('0x4a')];_0x29c787[_0xcb66('0x52')]=qs[_0xcb66('0x74')](_0x5eb415[_0xcb66('0x4b')][_0xcb66('0x74')]);_0x29c787[_0xcb66('0x53')]=qs['filters'](_[_0xcb66('0x55')](_0x5eb415[_0xcb66('0x4b')],_0x46cb51['filters']));if(_0x5eb415['query'][_0xcb66('0x56')]){_0x29c787[_0xcb66('0x53')]=_['merge'](_0x29c787[_0xcb66('0x53')],{'$or':_[_0xcb66('0x46')](_0x29c787[_0xcb66('0x4e')],function(_0x2d6b00){var _0x2d84a8={};_0x2d84a8[_0x2d6b00]={'$like':'%'+_0x5eb415[_0xcb66('0x4b')][_0xcb66('0x56')]+'%'};return _0x2d84a8;})});}_0x29c787=_[_0xcb66('0x57')]({},_0x29c787,_0x5eb415['options']);return _0x19a1a2[_0xcb66('0x11c')](_0x29c787);}})[_0xcb66('0x2a')](function(_0x51f218){if(_0x51f218){_0xc951cf=_0x51f218[_0xcb66('0x4f')];if(!_0x5eb415[_0xcb66('0x4b')][_0xcb66('0x50')](_0xcb66('0x51'))){_0x29c787['limit']=qs[_0xcb66('0x25')](_0x5eb415['query']['limit']);_0x29c787[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x5eb415[_0xcb66('0x4b')][_0xcb66('0x24')]);}return _0x19a1a2[_0xcb66('0x11c')](_0x29c787);}})[_0xcb66('0x2a')](function(_0x2b4adc){if(_0x2b4adc){return _0x2b4adc?{'count':_0xc951cf,'rows':_0x2b4adc}:null;}})[_0xcb66('0x2a')](respondWithResult(_0x4eb53d,null))[_0xcb66('0x6c')](handleError(_0x4eb53d,null));};exports[_0xcb66('0x11d')]=function(_0xb19670,_0x392437){return db[_0xcb66('0x11e')][_0xcb66('0x60')]({'where':{'id':_0xb19670[_0xcb66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x392437,null))[_0xcb66('0x2a')](function(_0x54fec7){if(_0x54fec7){return _0x54fec7[_0xcb66('0x11d')](_0xb19670[_0xcb66('0x62')]['ids'],_['omit'](_0xb19670[_0xcb66('0x62')],[_0xcb66('0x76'),'id'])||{});}})['then'](respondWithResult(_0x392437,null))['catch'](handleError(_0x392437,null));};exports[_0xcb66('0x101')]=function(_0x3f36f8,_0x47a606){var _0x362629={};var _0x3946f7={};var _0xa89cf3;var _0x28826b;return db[_0xcb66('0x47')][_0xcb66('0x72')]({'where':{'id':_0x3f36f8['params']['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x47a606,null))[_0xcb66('0x2a')](function(_0x5f40ca){if(_0x5f40ca){_0xa89cf3=_0x5f40ca;_0x3946f7[_0xcb66('0x4a')]=_['keys'](db[_0xcb66('0x11f')][_0xcb66('0x48')]);_0x3946f7[_0xcb66('0x4b')]=_['keys'](_0x3f36f8[_0xcb66('0x4b')]);_0x3946f7[_0xcb66('0x54')]=_['intersection'](_0x3946f7[_0xcb66('0x4a')],_0x3946f7[_0xcb66('0x4b')]);_0x362629['attributes']=_['intersection'](_0x3946f7[_0xcb66('0x4a')],qs[_0xcb66('0x5e')](_0x3f36f8[_0xcb66('0x4b')][_0xcb66('0x5e')]));_0x362629['attributes']=_0x362629[_0xcb66('0x4e')][_0xcb66('0x4f')]?_0x362629['attributes']:_0x3946f7[_0xcb66('0x4a')];_0x362629[_0xcb66('0x52')]=qs['sort'](_0x3f36f8[_0xcb66('0x4b')][_0xcb66('0x74')]);_0x362629['where']=qs[_0xcb66('0x54')](_[_0xcb66('0x55')](_0x3f36f8[_0xcb66('0x4b')],_0x3946f7[_0xcb66('0x54')]));if(_0x3f36f8['query'][_0xcb66('0x56')]){_0x362629[_0xcb66('0x53')]=_[_0xcb66('0x57')](_0x362629[_0xcb66('0x53')],{'$or':_['map'](_0x362629[_0xcb66('0x4e')],function(_0x500f7a){var _0x58ae75={};_0x58ae75[_0x500f7a]={'$like':'%'+_0x3f36f8['query'][_0xcb66('0x56')]+'%'};return _0x58ae75;})});}_0x362629=_[_0xcb66('0x57')]({},_0x362629,_0x3f36f8[_0xcb66('0x59')]);return _0xa89cf3[_0xcb66('0x101')](_0x362629);}})[_0xcb66('0x2a')](function(_0x3ebcc9){if(_0x3ebcc9){_0x28826b=_0x3ebcc9[_0xcb66('0x4f')];if(!_0x3f36f8[_0xcb66('0x4b')][_0xcb66('0x50')](_0xcb66('0x51'))){_0x362629[_0xcb66('0x25')]=qs[_0xcb66('0x25')](_0x3f36f8[_0xcb66('0x4b')]['limit']);_0x362629[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x3f36f8[_0xcb66('0x4b')][_0xcb66('0x24')]);}return _0xa89cf3['getProactiveActions'](_0x362629);}})[_0xcb66('0x2a')](function(_0x4bbdf2){if(_0x4bbdf2){return _0x4bbdf2?{'count':_0x28826b,'rows':_0x4bbdf2}:null;}})[_0xcb66('0x2a')](respondWithResult(_0x47a606,null))['catch'](handleError(_0x47a606,null));};exports['getFields']=function(_0x438877,_0x5a07ca){var _0x5f38cc=_0x438877['query'][_0xcb66('0x120')]===_0xcb66('0x121')?_0xcb66('0x122'):'onlineForm';return db[_0xcb66('0x47')][_0xcb66('0x60')]({'attributes':['id',_0x5f38cc],'where':{'id':_0x438877['params']['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x5a07ca,null))['then'](function(_0x287a75){if(_0x287a75){var _0x228f00=_0x287a75[_0x5f38cc];var _0x2ea4f3=_0x228f00&&_0x228f00[_0xcb66('0x123')]?_0x228f00['items']:[];_0x5a07ca['send']({'fromKey':_['isNil'](_0x228f00[_0xcb66('0x124')])?undefined:_0x228f00[_0xcb66('0x124')],'count':_0x2ea4f3[_0xcb66('0x4f')],'rows':_0x2ea4f3});}})[_0xcb66('0x6c')](handleError(_0x5a07ca,null));};exports[_0xcb66('0x125')]=function(_0x5ec6d1,_0x59bd98){var _0x2cea17={'raw':![],'where':{}};var _0x2f7667={};var _0x3a4b0a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xcb66('0x72')]({'where':{'id':_0x5ec6d1[_0xcb66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x59bd98,null))[_0xcb66('0x2a')](function(_0x4a4c01){if(_0x4a4c01){_0x2f7667['model']=_[_0xcb66('0x4c')](db[_0xcb66('0x126')]['rawAttributes']);_0x2f7667['query']=_['keys'](_0x5ec6d1[_0xcb66('0x4b')]);_0x2f7667['filters']=_['intersection'](_0x2f7667['model'],_0x2f7667[_0xcb66('0x4b')]);_0x2cea17[_0xcb66('0x4e')]=_[_0xcb66('0x4d')](_0x2f7667[_0xcb66('0x4a')],qs['fields'](_0x5ec6d1[_0xcb66('0x4b')][_0xcb66('0x5e')]));_0x2cea17[_0xcb66('0x4e')]=_0x2cea17[_0xcb66('0x4e')]['length']?_0x2cea17[_0xcb66('0x4e')]:_0x2f7667['model'];if(!_0x5ec6d1['query'][_0xcb66('0x50')](_0xcb66('0x51'))){_0x2cea17[_0xcb66('0x25')]=qs[_0xcb66('0x25')](_0x5ec6d1[_0xcb66('0x4b')]['limit']);_0x2cea17[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x5ec6d1['query'][_0xcb66('0x24')]);}_0x2cea17[_0xcb66('0x52')]=qs[_0xcb66('0x74')](_0x5ec6d1[_0xcb66('0x4b')]['sort']);_0x2cea17[_0xcb66('0x53')]=qs[_0xcb66('0x54')](_[_0xcb66('0x55')](_0x5ec6d1[_0xcb66('0x4b')],_0x2f7667[_0xcb66('0x54')]));_0x2cea17[_0xcb66('0x53')][_0xcb66('0x70')]=_0x4a4c01['id'];if(_0x5ec6d1[_0xcb66('0x4b')]['filter']){_0x2cea17['where']=_['merge'](_0x2cea17['where'],{'$or':_[_0xcb66('0x46')](_0x2cea17['attributes'],function(_0x574ab2){var _0x13d432={};_0x13d432[_0x574ab2]={'$like':'%'+_0x5ec6d1[_0xcb66('0x4b')][_0xcb66('0x56')]+'%'};return _0x13d432;})});}_0x2cea17=_['merge']({},_0x2cea17,_0x5ec6d1[_0xcb66('0x59')]);return db[_0xcb66('0x126')]['count']({'where':_0x2cea17['where']})[_0xcb66('0x2a')](function(_0x3e9e32){_0x3a4b0a['count']=_0x3e9e32;if(_0x5ec6d1[_0xcb66('0x4b')][_0xcb66('0x5f')]){_0x2cea17['include']=[{'all':!![]}];}else{_0x2cea17[_0xcb66('0x5a')]=[{'model':db[_0xcb66('0xa4')],'as':_0xcb66('0xfc'),'required':![]},{'model':db[_0xcb66('0xe6')],'as':'Attachments','required':![]}];}return db[_0xcb66('0x126')][_0xcb66('0x5b')](_0x2cea17);})['then'](function(_0x4aa30f){_0x3a4b0a['rows']=_0x4aa30f;return _0x3a4b0a;});}})[_0xcb66('0x2a')](respondWithFilteredResult(_0x59bd98,_0x2cea17))[_0xcb66('0x6c')](handleError(_0x59bd98,null));};exports['addAgents']=function(_0x3a953f,_0x248d62){return db[_0xcb66('0x47')]['find']({'where':{'id':_0x3a953f[_0xcb66('0x5d')]['id']}})['then'](handleEntityNotFound(_0x248d62,null))[_0xcb66('0x2a')](function(_0x223606){if(_0x223606){return _0x223606['addAgents'](_0x3a953f[_0xcb66('0x62')][_0xcb66('0x76')],_[_0xcb66('0x127')](_0x3a953f[_0xcb66('0x62')],[_0xcb66('0x76'),'id'])||{})['spread'](function(_0x45a211){for(var _0x59b15f=0x0;_0x59b15f<_0x3a953f[_0xcb66('0x62')]['ids'][_0xcb66('0x4f')];_0x59b15f+=0x1){socket['emit'](_0xcb66('0x128'),{'UserId':Number(_0x3a953f[_0xcb66('0x62')][_0xcb66('0x76')][_0x59b15f]),'ChatWebsiteId':Number(_0x3a953f[_0xcb66('0x5d')]['id'])});}return _0x45a211;});}})[_0xcb66('0x2a')](respondWithResult(_0x248d62,null))[_0xcb66('0x6c')](handleError(_0x248d62,null));};exports[_0xcb66('0x129')]=function(_0x5409b7,_0x1e6fc6){return db['ChatWebsite'][_0xcb66('0x60')]({'where':{'id':_0x5409b7[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x1e6fc6,null))[_0xcb66('0x2a')](function(_0x124ee7){if(_0x124ee7){return _0x124ee7['removeAgents'](_0x5409b7[_0xcb66('0x4b')][_0xcb66('0x76')])[_0xcb66('0x2a')](function(){if(_[_0xcb66('0x12a')](_0x5409b7['query'][_0xcb66('0x76')])){for(var _0x45a393=0x0;_0x45a393<_0x5409b7[_0xcb66('0x4b')]['ids'][_0xcb66('0x4f')];_0x45a393+=0x1){socket['emit'](_0xcb66('0x12b'),{'UserId':Number(_0x5409b7[_0xcb66('0x4b')]['ids'][_0x45a393]),'ChatWebsiteId':Number(_0x5409b7[_0xcb66('0x5d')]['id'])});}}else{socket[_0xcb66('0x12c')](_0xcb66('0x12b'),{'UserId':Number(_0x5409b7['query'][_0xcb66('0x76')]),'ChatWebsiteId':Number(_0x5409b7[_0xcb66('0x5d')]['id'])});}});}})[_0xcb66('0x2a')](respondWithStatusCode(_0x1e6fc6,null))['catch'](handleError(_0x1e6fc6,null));};exports[_0xcb66('0x12d')]=function(_0x4b841d,_0x147539){var _0x4b4c5a={};var _0x25fd5e={};var _0x2e108d;var _0x217ddf;return db[_0xcb66('0x47')]['findOne']({'where':{'id':_0x4b841d[_0xcb66('0x5d')]['id']}})[_0xcb66('0x2a')](handleEntityNotFound(_0x147539,null))[_0xcb66('0x2a')](function(_0x4da94a){if(_0x4da94a){_0x2e108d=_0x4da94a;_0x25fd5e[_0xcb66('0x4a')]=_['keys'](db[_0xcb66('0xc3')][_0xcb66('0x48')]);_0x25fd5e['query']=_[_0xcb66('0x4c')](_0x4b841d['query']);_0x25fd5e[_0xcb66('0x54')]=_[_0xcb66('0x4d')](_0x25fd5e['model'],_0x25fd5e[_0xcb66('0x4b')]);_0x4b4c5a[_0xcb66('0x4e')]=_['intersection'](_0x25fd5e[_0xcb66('0x4a')],qs[_0xcb66('0x5e')](_0x4b841d[_0xcb66('0x4b')][_0xcb66('0x5e')]));_0x4b4c5a[_0xcb66('0x4e')]=_0x4b4c5a[_0xcb66('0x4e')]['length']?_0x4b4c5a['attributes']:_0x25fd5e['model'];_0x4b4c5a[_0xcb66('0x52')]=qs[_0xcb66('0x74')](_0x4b841d[_0xcb66('0x4b')][_0xcb66('0x74')]);_0x4b4c5a['where']=qs[_0xcb66('0x54')](_[_0xcb66('0x55')](_0x4b841d[_0xcb66('0x4b')],_0x25fd5e[_0xcb66('0x54')]));if(_0x4b841d[_0xcb66('0x4b')][_0xcb66('0x56')]){_0x4b4c5a['where']=_[_0xcb66('0x57')](_0x4b4c5a[_0xcb66('0x53')],{'$or':_[_0xcb66('0x46')](_0x4b4c5a[_0xcb66('0x4e')],function(_0x3f173a){var _0x147ac7={};_0x147ac7[_0x3f173a]={'$like':'%'+_0x4b841d[_0xcb66('0x4b')]['filter']+'%'};return _0x147ac7;})});}_0x4b4c5a=_['merge']({},_0x4b4c5a,_0x4b841d[_0xcb66('0x59')]);return _0x2e108d[_0xcb66('0x12d')](_0x4b4c5a);}})[_0xcb66('0x2a')](function(_0x563f58){if(_0x563f58){_0x217ddf=_0x563f58['length'];if(!_0x4b841d[_0xcb66('0x4b')][_0xcb66('0x50')]('nolimit')){_0x4b4c5a[_0xcb66('0x25')]=qs[_0xcb66('0x25')](_0x4b841d['query'][_0xcb66('0x25')]);_0x4b4c5a[_0xcb66('0x24')]=qs[_0xcb66('0x24')](_0x4b841d['query'][_0xcb66('0x24')]);}return _0x2e108d['getAgents'](_0x4b4c5a);}})[_0xcb66('0x2a')](function(_0x6ef604){if(_0x6ef604){return _0x6ef604?{'count':_0x217ddf,'rows':_0x6ef604}:null;}})[_0xcb66('0x2a')](respondWithResult(_0x147539,null))['catch'](handleError(_0x147539,null));}; \ No newline at end of file +var _0x43fd=['filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','Interval','resolve','timezone','ifTime','notify','from','From\x20is\x20mandatory','mapKey','isEmpty','Body\x20is\x20mandatory','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','CmContact','Contacts','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','Applications','priority','account','list','List','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','firstName','lastName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','agent','waitForTheAssignedAgent','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','MailAccountId','NotifyMailAccount','notifyMail','server','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','chatLicenseExceeded','readFileSync','server/files/chat/iframe.ejs','utf8','origin','http://localhost:9000','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','replace','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','util','fs-extra','lodash','html-to-text','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','APIConflictError','./helpers/wildcard-expressions','url','URL','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','user-agent-parser','user-agent','getResult','customerIp','x-forwarded-for','split','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','model','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','address','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','describe','addDisposition','ChatWebsiteId','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file'];(function(_0xabbe3d,_0x4c9120){var _0x32d93d=function(_0x2b3722){while(--_0x2b3722){_0xabbe3d['push'](_0xabbe3d['shift']());}};_0x32d93d(++_0x4c9120);}(_0x43fd,0x1ec));var _0xd43f=function(_0x3d2a7b,_0x20b709){_0x3d2a7b=_0x3d2a7b-0x0;var _0xf8adb=_0x43fd[_0x3d2a7b];return _0xf8adb;};'use strict';var Mustache=require('mustache');var util=require(_0xd43f('0x0'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd43f('0x1'));var _=require(_0xd43f('0x2'));var querystring=require('querystring');var htmlToText=require(_0xd43f('0x3'));var Redis=require('ioredis');var jayson=require(_0xd43f('0x4'));var qs=require(_0xd43f('0x5'));var logger=require(_0xd43f('0x6'))(_0xd43f('0x7'));var config=require('../../config/environment');var APIBadRequestError=require(_0xd43f('0x8'))[_0xd43f('0x9')];var APINotFoundError=require(_0xd43f('0x8'))[_0xd43f('0xa')];var APIOutOfIntervalError=require('../../errors/api')[_0xd43f('0xb')];var APIHandleError=require(_0xd43f('0x8'))['handleError'];var APIConflictError=require(_0xd43f('0x8'))[_0xd43f('0xc')];var wildcardUtils=require(_0xd43f('0xd'));var URL=require(_0xd43f('0xe'))[_0xd43f('0xf')];var db=require('../../mysqldb')['db'];config[_0xd43f('0x10')]=_[_0xd43f('0x11')](config[_0xd43f('0x10')],{'host':_0xd43f('0x12'),'port':0x18eb});var socket=require(_0xd43f('0x13'))(new Redis(config[_0xd43f('0x10')]));require(_0xd43f('0x14'))[_0xd43f('0x15')](socket);var client=jayson[_0xd43f('0x16')][_0xd43f('0x17')]({'port':0x232c});var client9002=jayson[_0xd43f('0x16')]['http']({'port':0x232a});var client9003=jayson[_0xd43f('0x16')][_0xd43f('0x17')]({'port':0x232b});var client9001=jayson[_0xd43f('0x16')]['http']({'port':0x2329});function respondWithRpcPromise(_0x4c576e,_0x4a2b49,_0x1c729a,_0x3ca2d4){return new Promise(function(_0x4f8862,_0x3c0953){var _0x3647df=_0x3ca2d4||client;return _0x3647df['request'](_0x4c576e,_0x1c729a)['then'](function(_0x4fd639){logger['info'](_0xd43f('0x18'),_0x4a2b49,_0xd43f('0x19'));logger['debug'](_0xd43f('0x1a'),_0x4a2b49,_0xd43f('0x19'),JSON[_0xd43f('0x1b')](_0x4fd639));if(_0x4fd639[_0xd43f('0x1c')]){if(_0x4fd639['error'][_0xd43f('0x1d')]===0x1f4){logger[_0xd43f('0x1c')](_0xd43f('0x18'),_0x4a2b49,_0x4fd639['error']['message']);return _0x3c0953(_0x4fd639['error'][_0xd43f('0x1e')]);}logger[_0xd43f('0x1c')](_0xd43f('0x18'),_0x4a2b49,_0x4fd639[_0xd43f('0x1c')][_0xd43f('0x1e')]);return _0x4f8862(_0x4fd639[_0xd43f('0x1c')][_0xd43f('0x1e')]);}else{logger['info'](_0xd43f('0x18'),_0x4a2b49,'request\x20sent');_0x4f8862(_0x4fd639[_0xd43f('0x1f')]['message']);}})['catch'](function(_0x310195){logger[_0xd43f('0x1c')](_0xd43f('0x18'),_0x4a2b49,_0x310195);_0x3c0953(_0x310195);});});}function respondWithStatusCode(_0x2a38f6,_0x35acd0){_0x35acd0=_0x35acd0||0xcc;return function(_0xcaf5ae){if(_0xcaf5ae){return _0x2a38f6[_0xd43f('0x20')](_0x35acd0);}return _0x2a38f6[_0xd43f('0x21')](_0x35acd0)[_0xd43f('0x22')]();};}function respondWithResult(_0x49d043,_0x26a6c9){_0x26a6c9=_0x26a6c9||0xc8;return function(_0x2d5915){if(_0x2d5915){return _0x49d043[_0xd43f('0x21')](_0x26a6c9)[_0xd43f('0x23')](_0x2d5915);}};}function respondWithFilteredResult(_0x209ccd,_0x4a8b4d){return function(_0x161540){if(_0x161540){var _0x7b6761=typeof _0x4a8b4d[_0xd43f('0x24')]===_0xd43f('0x25')&&typeof _0x4a8b4d[_0xd43f('0x26')]===_0xd43f('0x25');var _0x481b4d=_0x161540[_0xd43f('0x27')];var _0x1f476d=_0x7b6761?0x0:_0x4a8b4d['offset'];var _0x308439=_0x7b6761?_0x161540['count']:_0x4a8b4d['offset']+_0x4a8b4d[_0xd43f('0x26')];var _0x18472c;if(_0x308439>=_0x481b4d){_0x308439=_0x481b4d;_0x18472c=0xc8;}else{_0x18472c=0xce;}_0x209ccd[_0xd43f('0x21')](_0x18472c);return _0x209ccd['set'](_0xd43f('0x28'),_0x1f476d+'-'+_0x308439+'/'+_0x481b4d)[_0xd43f('0x23')](_0x161540);}return null;};}function saveUpdates(_0x5bba3d){return function(_0x557a96){if(_0x557a96){return _0x557a96[_0xd43f('0x29')](_0x5bba3d)[_0xd43f('0x2a')](function(_0xb9e156){return _0xb9e156;});}return null;};}function removeEntity(_0x202a05){return function(_0x49ff92){if(_0x49ff92){return _0x49ff92[_0xd43f('0x2b')]()[_0xd43f('0x2a')](function(){var _0x134b27=_0x49ff92[_0xd43f('0x2c')]({'plain':!![]});var _0x5a5717=_0xd43f('0x2d');return db[_0xd43f('0x2e')]['destroy']({'where':{'type':_0x5a5717,'resourceId':_0x134b27['id']}})[_0xd43f('0x2a')](function(){return _0x49ff92;});})['then'](function(){_0x202a05[_0xd43f('0x21')](0xcc)[_0xd43f('0x22')]();});}};}function handleEntityNotFound(_0x2d91fc){return function(_0x51b765){if(!_0x51b765){_0x2d91fc[_0xd43f('0x20')](0x194);}return _0x51b765;};}function handleError(_0x2ccd50,_0x523718){_0x523718=_0x523718||0x1f4;return function(_0x3b785f){logger[_0xd43f('0x1c')](_0x3b785f[_0xd43f('0x2f')]);if(_0x3b785f['name']){delete _0x3b785f[_0xd43f('0x30')];}_0x2ccd50[_0xd43f('0x21')](_0x523718)[_0xd43f('0x31')](_0x3b785f);};}function createInteractionObject(_0x20682d,_0x176aac,_0x5bce4d,_0x3386d9){var _0x4b1c73=require(_0xd43f('0x32'));var _0x2d8bfe=new _0x4b1c73();var _0x416030=_0x2d8bfe['setUA'](_0x5bce4d[_0xd43f('0x33')])[_0xd43f('0x34')]();var _0x4b1dfa=_0x176aac[_0xd43f('0x35')];if(_0x5bce4d['cf-connecting-ip']){_0x4b1dfa=_0x5bce4d['cf-connecting-ip'];}else if(_0x5bce4d[_0xd43f('0x36')]){_0x4b1dfa=_['first'](_0x5bce4d['x-forwarded-for'][_0xd43f('0x37')](','));}return{'ContactId':_0x3386d9['id'],'ChatWebsiteId':_0x20682d,'from':(_0x3386d9['firstName']||'')+'\x20'+(_0x3386d9['lastName']||''),'customerIp':_0x4b1dfa,'customerPort':_0x5bce4d[_0xd43f('0x38')]?_0x5bce4d[_0xd43f('0x38')]:null,'referer':_0x176aac[_0xd43f('0x39')],'browserName':_0x416030[_0xd43f('0x3a')][_0xd43f('0x30')]&&_0x416030['browser'][_0xd43f('0x3b')]?util[_0xd43f('0x3c')](_0xd43f('0x3d'),_0x416030[_0xd43f('0x3a')][_0xd43f('0x30')],_0x416030[_0xd43f('0x3a')][_0xd43f('0x3b')]):_0xd43f('0x3e'),'browserVersion':_0x416030[_0xd43f('0x3a')][_0xd43f('0x3b')]||_0xd43f('0x3e'),'osName':util['format'](_0xd43f('0x3d'),_0x416030['os'][_0xd43f('0x30')],_0x416030['os']['version']),'osVersion':_0x416030['os']['version'],'deviceModel':_0x416030[_0xd43f('0x3f')][_0xd43f('0x40')]&&_0x416030[_0xd43f('0x3f')]['vendor']?util[_0xd43f('0x3c')](_0xd43f('0x41'),_0x416030[_0xd43f('0x3f')][_0xd43f('0x40')],_0x416030['device']['vendor'],_0x416030[_0xd43f('0x3f')][_0xd43f('0x42')]):null,'deviceVendor':_0x416030[_0xd43f('0x3f')]['vendor'],'deviceType':_0x416030[_0xd43f('0x3f')][_0xd43f('0x42')],'formData':JSON[_0xd43f('0x1b')](_0x176aac)};}exports[_0xd43f('0x43')]=function(_0x33a644,_0xc2a5a6){var _0x15071b={'include':[{'model':db[_0xd43f('0x44')],'as':_0xd43f('0x45')}]},_0xadbc59={},_0x4f5587={'count':0x0,'rows':[]};var _0x386dfa=_[_0xd43f('0x46')](db[_0xd43f('0x47')][_0xd43f('0x48')],function(_0x30fc76){return{'name':_0x30fc76[_0xd43f('0x49')],'type':_0x30fc76[_0xd43f('0x42')][_0xd43f('0x4a')]};});_0xadbc59[_0xd43f('0x40')]=_['map'](_0x386dfa,_0xd43f('0x30'));_0xadbc59[_0xd43f('0x4b')]=_[_0xd43f('0x4c')](_0x33a644[_0xd43f('0x4b')]);_0xadbc59[_0xd43f('0x4d')]=_[_0xd43f('0x4e')](_0xadbc59['model'],_0xadbc59[_0xd43f('0x4b')]);_0x15071b['attributes']=_[_0xd43f('0x4e')](_0xadbc59['model'],qs[_0xd43f('0x4f')](_0x33a644[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x15071b[_0xd43f('0x50')]=_0x15071b[_0xd43f('0x50')][_0xd43f('0x51')]?_0x15071b[_0xd43f('0x50')]:_0xadbc59[_0xd43f('0x40')];if(!_0x33a644[_0xd43f('0x4b')]['hasOwnProperty'](_0xd43f('0x52'))){_0x15071b[_0xd43f('0x26')]=qs[_0xd43f('0x26')](_0x33a644[_0xd43f('0x4b')][_0xd43f('0x26')]);_0x15071b[_0xd43f('0x24')]=qs[_0xd43f('0x24')](_0x33a644[_0xd43f('0x4b')][_0xd43f('0x24')]);}_0x15071b[_0xd43f('0x53')]=qs[_0xd43f('0x54')](_0x33a644['query']['sort']);_0x15071b[_0xd43f('0x55')]=qs[_0xd43f('0x4d')](_[_0xd43f('0x56')](_0x33a644['query'],_0xadbc59['filters']),_0x386dfa);if(_0x33a644[_0xd43f('0x4b')][_0xd43f('0x57')]){_0x15071b[_0xd43f('0x55')]=_[_0xd43f('0x58')](_0x15071b[_0xd43f('0x55')],{'$or':_['map'](_0x386dfa,function(_0x344797){if(_0x344797[_0xd43f('0x42')]!==_0xd43f('0x59')){var _0xafb5d4={};_0xafb5d4[_0x344797[_0xd43f('0x30')]]={'$like':'%'+_0x33a644[_0xd43f('0x4b')]['filter']+'%'};return _0xafb5d4;}})});}_0x15071b=_[_0xd43f('0x58')]({},_0x15071b,_0x33a644[_0xd43f('0x5a')]);var _0x39e85a={'where':_0x15071b[_0xd43f('0x55')]};return db[_0xd43f('0x47')][_0xd43f('0x27')](_0x39e85a)[_0xd43f('0x2a')](function(_0xece809){_0x4f5587['count']=_0xece809;if(_0x33a644[_0xd43f('0x4b')][_0xd43f('0x5b')]){_0x15071b[_0xd43f('0x5c')]=[{'all':!![]}];}return db['ChatWebsite'][_0xd43f('0x5d')](_0x15071b);})[_0xd43f('0x2a')](function(_0xb719d){_0x4f5587[_0xd43f('0x5e')]=_0xb719d;return _0x4f5587;})[_0xd43f('0x2a')](respondWithFilteredResult(_0xc2a5a6,_0x15071b))[_0xd43f('0x5f')](handleError(_0xc2a5a6,null));};exports[_0xd43f('0x60')]=function(_0x32590d,_0x1c1fd5){var _0x418af0={'raw':![],'where':{'id':_0x32590d[_0xd43f('0x61')]['id']},'include':[{'model':db[_0xd43f('0x44')],'as':'mandatoryDispositionPause'}]},_0x4ca871={};_0x4ca871[_0xd43f('0x40')]=_[_0xd43f('0x4c')](db[_0xd43f('0x47')]['rawAttributes']);_0x4ca871[_0xd43f('0x4b')]=_['keys'](_0x32590d[_0xd43f('0x4b')]);_0x4ca871['filters']=_[_0xd43f('0x4e')](_0x4ca871['model'],_0x4ca871[_0xd43f('0x4b')]);_0x418af0[_0xd43f('0x50')]=_[_0xd43f('0x4e')](_0x4ca871['model'],qs['fields'](_0x32590d[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x418af0['attributes']=_0x418af0[_0xd43f('0x50')][_0xd43f('0x51')]?_0x418af0['attributes']:_0x4ca871[_0xd43f('0x40')];if(_0x32590d[_0xd43f('0x4b')][_0xd43f('0x5b')]){_0x418af0[_0xd43f('0x5c')]=[{'all':!![]}];}_0x418af0=_[_0xd43f('0x58')]({},_0x418af0,_0x32590d[_0xd43f('0x5a')]);return db[_0xd43f('0x47')]['find'](_0x418af0)[_0xd43f('0x2a')](handleEntityNotFound(_0x1c1fd5,null))[_0xd43f('0x2a')](respondWithResult(_0x1c1fd5,null))[_0xd43f('0x5f')](handleError(_0x1c1fd5,null));};exports[_0xd43f('0x62')]=function(_0x6ee0ef,_0x18cdd9){var _0x2ff8ad=null;_0x6ee0ef['body'][_0xd43f('0x63')][_0xd43f('0x37')](',')['forEach'](_0x1898b6=>{if(_0x1898b6[_0xd43f('0x64')]()!==''&&!wildcardUtils[_0xd43f('0x65')](_0x1898b6[_0xd43f('0x64')]())){_0x2ff8ad=new APIBadRequestError('\x22'+_0x1898b6[_0xd43f('0x64')]()+_0xd43f('0x66'));}});if(_0x2ff8ad){return handleError(_0x18cdd9,null)(_0x2ff8ad);}return db[_0xd43f('0x47')]['create'](_0x6ee0ef[_0xd43f('0x67')],{})[_0xd43f('0x2a')](function(_0x5b70c8){var _0x451d18=_0x6ee0ef['user'][_0xd43f('0x2c')]({'plain':!![]});if(!_0x451d18)throw new Error(_0xd43f('0x68'));if(_0x451d18[_0xd43f('0x69')]===_0xd43f('0x6a')){var _0x32090e=_0x5b70c8[_0xd43f('0x2c')]({'plain':!![]});var _0x1c59c4=_0xd43f('0x2d');return db[_0xd43f('0x6b')][_0xd43f('0x6c')]({'where':{'name':_0x1c59c4,'userProfileId':_0x451d18[_0xd43f('0x6d')]},'raw':!![]})[_0xd43f('0x2a')](function(_0x332271){if(_0x332271&&_0x332271[_0xd43f('0x6e')]===0x0){return db['UserProfileResource'][_0xd43f('0x62')]({'name':_0x32090e[_0xd43f('0x30')],'resourceId':_0x32090e['id'],'type':_0x332271[_0xd43f('0x30')],'sectionId':_0x332271['id']},{})['then'](function(){return _0x5b70c8;});}else{return _0x5b70c8;}})[_0xd43f('0x5f')](function(_0x5211ee){logger[_0xd43f('0x1c')](_0xd43f('0x6f'),_0x5211ee);throw _0x5211ee;});}return _0x5b70c8;})[_0xd43f('0x2a')](respondWithResult(_0x18cdd9,0xc9))[_0xd43f('0x5f')](handleError(_0x18cdd9,null));};exports['update']=function(_0x1e2258,_0x1a53ce){var _0x15cfb3=null;_0x1e2258['body'][_0xd43f('0x63')]['split'](',')[_0xd43f('0x70')](_0x41d560=>{if(_0x41d560[_0xd43f('0x64')]()!==''&&!wildcardUtils[_0xd43f('0x65')](_0x41d560['trim']())){_0x15cfb3=new APIBadRequestError('\x22'+_0x41d560[_0xd43f('0x64')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x15cfb3){return handleError(_0x1a53ce,null)(_0x15cfb3);}if(_0x1e2258[_0xd43f('0x67')]['id']){delete _0x1e2258['body']['id'];}return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x1e2258['params']['id']},'include':[{'model':db[_0xd43f('0x44')],'as':_0xd43f('0x45')}]})[_0xd43f('0x2a')](handleEntityNotFound(_0x1a53ce,null))[_0xd43f('0x2a')](saveUpdates(_0x1e2258['body'],null))[_0xd43f('0x2a')](respondWithResult(_0x1a53ce,null))[_0xd43f('0x5f')](handleError(_0x1a53ce,null));};exports[_0xd43f('0x2b')]=function(_0x147c6b,_0x5f30f7){return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x147c6b['params']['id']}})['then'](handleEntityNotFound(_0x5f30f7,null))[_0xd43f('0x2a')](removeEntity(_0x5f30f7,null))[_0xd43f('0x5f')](handleError(_0x5f30f7,null));};exports[_0xd43f('0x71')]=function(_0x5346af,_0x209cdc){return db['ChatWebsite'][_0xd43f('0x71')]()[_0xd43f('0x2a')](respondWithResult(_0x209cdc,null))['catch'](handleError(_0x209cdc,null));};exports[_0xd43f('0x72')]=function(_0x45c946,_0x2d6b29){if(_0x45c946[_0xd43f('0x67')]['id']){delete _0x45c946[_0xd43f('0x67')]['id'];}return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x45c946[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x2d6b29,null))[_0xd43f('0x2a')](function(_0x3703b5){if(_0x3703b5){_0x45c946['body'][_0xd43f('0x73')]=_0x3703b5['id'];return db['Disposition'][_0xd43f('0x62')](_0x45c946[_0xd43f('0x67')]);}})[_0xd43f('0x2a')](respondWithResult(_0x2d6b29,null))[_0xd43f('0x5f')](handleError(_0x2d6b29,null));};exports['getDispositions']=function(_0x533892,_0x1ddba2){var _0x104006={'raw':![],'where':{}};var _0x5f0190={};var _0x43d8e7={'count':0x0,'rows':[]};return db[_0xd43f('0x47')][_0xd43f('0x74')]({'where':{'id':_0x533892[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x1ddba2,null))[_0xd43f('0x2a')](function(_0x49a6b4){if(_0x49a6b4){_0x5f0190[_0xd43f('0x40')]=_[_0xd43f('0x4c')](db[_0xd43f('0x75')][_0xd43f('0x48')]);_0x5f0190[_0xd43f('0x4b')]=_[_0xd43f('0x4c')](_0x533892[_0xd43f('0x4b')]);_0x5f0190[_0xd43f('0x4d')]=_[_0xd43f('0x4e')](_0x5f0190['model'],_0x5f0190['query']);_0x104006[_0xd43f('0x50')]=_[_0xd43f('0x4e')](_0x5f0190['model'],qs[_0xd43f('0x4f')](_0x533892[_0xd43f('0x4b')]['fields']));_0x104006[_0xd43f('0x50')]=_0x104006[_0xd43f('0x50')][_0xd43f('0x51')]?_0x104006['attributes']:_0x5f0190['model'];if(!_0x533892[_0xd43f('0x4b')][_0xd43f('0x76')](_0xd43f('0x52'))){_0x104006[_0xd43f('0x26')]=qs[_0xd43f('0x26')](_0x533892[_0xd43f('0x4b')][_0xd43f('0x26')]);_0x104006[_0xd43f('0x24')]=qs[_0xd43f('0x24')](_0x533892[_0xd43f('0x4b')][_0xd43f('0x24')]);}_0x104006[_0xd43f('0x53')]=qs['sort'](_0x533892[_0xd43f('0x4b')][_0xd43f('0x54')]);_0x104006[_0xd43f('0x55')]=qs[_0xd43f('0x4d')](_[_0xd43f('0x56')](_0x533892[_0xd43f('0x4b')],_0x5f0190[_0xd43f('0x4d')]));_0x104006['where'][_0xd43f('0x73')]=_0x49a6b4['id'];if(_0x533892[_0xd43f('0x4b')][_0xd43f('0x57')]){_0x104006[_0xd43f('0x55')]=_['merge'](_0x104006[_0xd43f('0x55')],{'$or':_[_0xd43f('0x46')](_0x104006[_0xd43f('0x50')],function(_0x13dd7f){var _0x1f5d58={};_0x1f5d58[_0x13dd7f]={'$like':'%'+_0x533892[_0xd43f('0x4b')][_0xd43f('0x57')]+'%'};return _0x1f5d58;})});}_0x104006=_[_0xd43f('0x58')]({},_0x104006,_0x533892[_0xd43f('0x5a')]);return db['Disposition'][_0xd43f('0x27')]({'where':_0x104006['where']})[_0xd43f('0x2a')](function(_0x4762fb){_0x43d8e7[_0xd43f('0x27')]=_0x4762fb;if(_0x533892[_0xd43f('0x4b')]['includeAll']){_0x104006[_0xd43f('0x5c')]=[{'all':!![]}];}return db[_0xd43f('0x75')]['findAll'](_0x104006);})[_0xd43f('0x2a')](function(_0x11fbbb){_0x43d8e7[_0xd43f('0x5e')]=_0x11fbbb;return _0x43d8e7;});}})[_0xd43f('0x2a')](respondWithFilteredResult(_0x1ddba2,_0x104006))[_0xd43f('0x5f')](handleError(_0x1ddba2,null));};exports[_0xd43f('0x77')]=function(_0x4f3d39,_0x5c6897){return db['ChatWebsite'][_0xd43f('0x6c')]({'where':{'id':_0x4f3d39['params']['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x5c6897,null))['then'](function(_0x24fc08){if(_0x24fc08){return _0x24fc08[_0xd43f('0x77')](_0x4f3d39[_0xd43f('0x4b')][_0xd43f('0x78')]);}})[_0xd43f('0x2a')](respondWithStatusCode(_0x5c6897,null))[_0xd43f('0x5f')](handleError(_0x5c6897,null));};exports[_0xd43f('0x79')]=function(_0x464c42,_0x17115b){if(_0x464c42[_0xd43f('0x67')]['id']){delete _0x464c42[_0xd43f('0x67')]['id'];}return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x464c42['params']['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x17115b,null))[_0xd43f('0x2a')](function(_0x80efa4){if(_0x80efa4){_0x464c42[_0xd43f('0x67')][_0xd43f('0x73')]=_0x80efa4['id'];return db['CannedAnswer'][_0xd43f('0x62')](_0x464c42[_0xd43f('0x67')]);}})[_0xd43f('0x2a')](respondWithResult(_0x17115b,null))[_0xd43f('0x5f')](handleError(_0x17115b,null));};exports[_0xd43f('0x7a')]=function(_0x41836b,_0x19c24c){var _0x4efd7d={'raw':![],'where':{}};var _0x4cddee={};var _0xb18bde={'count':0x0,'rows':[]};return db[_0xd43f('0x47')][_0xd43f('0x74')]({'where':{'id':_0x41836b[_0xd43f('0x61')]['id']}})['then'](handleEntityNotFound(_0x19c24c,null))['then'](function(_0x53a610){if(_0x53a610){_0x4cddee['model']=_[_0xd43f('0x4c')](db[_0xd43f('0x7b')][_0xd43f('0x48')]);_0x4cddee[_0xd43f('0x4b')]=_[_0xd43f('0x4c')](_0x41836b[_0xd43f('0x4b')]);_0x4cddee['filters']=_[_0xd43f('0x4e')](_0x4cddee[_0xd43f('0x40')],_0x4cddee['query']);_0x4efd7d['attributes']=_['intersection'](_0x4cddee[_0xd43f('0x40')],qs[_0xd43f('0x4f')](_0x41836b['query'][_0xd43f('0x4f')]));_0x4efd7d['attributes']=_0x4efd7d[_0xd43f('0x50')]['length']?_0x4efd7d[_0xd43f('0x50')]:_0x4cddee[_0xd43f('0x40')];if(!_0x41836b['query'][_0xd43f('0x76')](_0xd43f('0x52'))){_0x4efd7d[_0xd43f('0x26')]=qs['limit'](_0x41836b['query'][_0xd43f('0x26')]);_0x4efd7d['offset']=qs[_0xd43f('0x24')](_0x41836b[_0xd43f('0x4b')][_0xd43f('0x24')]);}_0x4efd7d[_0xd43f('0x53')]=qs[_0xd43f('0x54')](_0x41836b['query'][_0xd43f('0x54')]);_0x4efd7d['where']=qs[_0xd43f('0x4d')](_[_0xd43f('0x56')](_0x41836b['query'],_0x4cddee[_0xd43f('0x4d')]));_0x4efd7d[_0xd43f('0x55')]['ChatWebsiteId']=_0x53a610['id'];if(_0x41836b[_0xd43f('0x4b')]['filter']){_0x4efd7d[_0xd43f('0x55')]=_[_0xd43f('0x58')](_0x4efd7d['where'],{'$or':_[_0xd43f('0x46')](_0x4efd7d[_0xd43f('0x50')],function(_0x578e4f){var _0x40538e={};_0x40538e[_0x578e4f]={'$like':'%'+_0x41836b[_0xd43f('0x4b')][_0xd43f('0x57')]+'%'};return _0x40538e;})});}_0x4efd7d=_[_0xd43f('0x58')]({},_0x4efd7d,_0x41836b[_0xd43f('0x5a')]);return db[_0xd43f('0x7b')]['count']({'where':_0x4efd7d[_0xd43f('0x55')]})[_0xd43f('0x2a')](function(_0x3598c2){_0xb18bde[_0xd43f('0x27')]=_0x3598c2;if(_0x41836b['query'][_0xd43f('0x5b')]){_0x4efd7d[_0xd43f('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd43f('0x5d')](_0x4efd7d);})[_0xd43f('0x2a')](function(_0x870d3f){_0xb18bde[_0xd43f('0x5e')]=_0x870d3f;return _0xb18bde;});}})[_0xd43f('0x2a')](respondWithFilteredResult(_0x19c24c,_0x4efd7d))[_0xd43f('0x5f')](handleError(_0x19c24c,null));};exports['removeAnswers']=function(_0x3757e1,_0x570b79){return db['ChatWebsite'][_0xd43f('0x6c')]({'where':{'id':_0x3757e1[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x570b79,null))[_0xd43f('0x2a')](function(_0x5b017d){if(_0x5b017d){return _0x5b017d[_0xd43f('0x7c')](_0x3757e1[_0xd43f('0x4b')][_0xd43f('0x78')]);}})[_0xd43f('0x2a')](respondWithStatusCode(_0x570b79,null))['catch'](handleError(_0x570b79,null));};exports[_0xd43f('0x7d')]=function(_0x21635f,_0x5b2330){_0x21635f['body'][_0xd43f('0x7e')]=_0x21635f[_0xd43f('0x7f')][_0xd43f('0x80')];return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x21635f[_0xd43f('0x61')]['id']}})['then'](handleEntityNotFound(_0x5b2330,null))[_0xd43f('0x2a')](saveUpdates(_0x21635f[_0xd43f('0x67')],null))[_0xd43f('0x2a')](respondWithResult(_0x5b2330,null))[_0xd43f('0x5f')](handleError(_0x5b2330,null));};exports['addAvatar']=function(_0xf41755,_0x458d12){_0xf41755[_0xd43f('0x67')][_0xd43f('0x81')]=_0xf41755['file']['filename'];return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0xf41755['params']['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x458d12,null))[_0xd43f('0x2a')](saveUpdates(_0xf41755[_0xd43f('0x67')],null))[_0xd43f('0x2a')](respondWithResult(_0x458d12,null))['catch'](handleError(_0x458d12,null));};exports[_0xd43f('0x82')]=function(_0x37fded,_0x39b6ce){_0x37fded['body'][_0xd43f('0x83')]=_0x37fded[_0xd43f('0x7f')][_0xd43f('0x80')];return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x37fded[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x39b6ce,null))['then'](saveUpdates(_0x37fded['body'],null))[_0xd43f('0x2a')](respondWithResult(_0x39b6ce,null))[_0xd43f('0x5f')](handleError(_0x39b6ce,null));};exports[_0xd43f('0x84')]=function(_0x482c1f,_0x203821){_0x482c1f[_0xd43f('0x67')][_0xd43f('0x85')]=_0x482c1f[_0xd43f('0x7f')][_0xd43f('0x80')];return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x482c1f['params']['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x203821,null))[_0xd43f('0x2a')](saveUpdates(_0x482c1f[_0xd43f('0x67')],null))[_0xd43f('0x2a')](respondWithResult(_0x203821,null))[_0xd43f('0x5f')](handleError(_0x203821,null));};exports['getLogo']=function(_0x211b48,_0x4fe18a){var _0x5d39a9=path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0x88'));var _0x284afe={'where':{'id':_0x211b48[_0xd43f('0x61')]['id']},'attributes':['id',_0xd43f('0x7e')],'raw':!![]};var _0x35bf20=![];return require(_0xd43f('0x89'))[_0xd43f('0x8a')]()[_0xd43f('0x2a')](function(_0x5c69b6){if(_0x5c69b6){_0x35bf20=_0x5c69b6[_0xd43f('0x8b')];}})[_0xd43f('0x2a')](function(){return db[_0xd43f('0x47')][_0xd43f('0x6c')](_0x284afe);})[_0xd43f('0x2a')](handleEntityNotFound(_0x4fe18a,null))['then'](function(_0x4158e5){if(_0x4158e5){if(!_[_0xd43f('0x8c')](_0x4158e5[_0xd43f('0x7e')])){if(fs[_0xd43f('0x8d')](path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0x8e'),_0x4158e5[_0xd43f('0x7e')]))&&_0x35bf20){_0x5d39a9=path[_0xd43f('0x86')](config['root'],'server/files/images/logos/',_0x4158e5[_0xd43f('0x7e')]);}}return _0x4fe18a['download'](_0x5d39a9);}})[_0xd43f('0x5f')](handleError(_0x4fe18a,null));};exports[_0xd43f('0x8f')]=function(_0x475df1,_0x46632f){var _0x48499c=path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0x90'));var _0x50f233={'where':{'id':_0x475df1[_0xd43f('0x61')]['id']},'attributes':['id',_0xd43f('0x81')],'raw':!![]};return db[_0xd43f('0x47')][_0xd43f('0x6c')](_0x50f233)['then'](handleEntityNotFound(_0x46632f,null))[_0xd43f('0x2a')](function(_0x2d2035){if(_0x2d2035){if(!_[_0xd43f('0x8c')](_0x2d2035['agentAvatar'])){if(fs[_0xd43f('0x8d')](path['join'](config[_0xd43f('0x87')],_0xd43f('0x91'),_0x2d2035[_0xd43f('0x81')]))){_0x48499c=path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0x91'),_0x2d2035[_0xd43f('0x81')]);}}return _0x46632f[_0xd43f('0x92')](_0x48499c);}})[_0xd43f('0x5f')](handleError(_0x46632f,null));};exports[_0xd43f('0x93')]=function(_0x57e736,_0x103e10){var _0x4833c6=path[_0xd43f('0x86')](config[_0xd43f('0x87')],'server/files/images/avatars/customer_avatar.png');var _0x58dd26={'where':{'id':_0x57e736[_0xd43f('0x61')]['id']},'attributes':['id',_0xd43f('0x83'),_0xd43f('0x94')],'raw':!![]};return db[_0xd43f('0x47')]['find'](_0x58dd26)[_0xd43f('0x2a')](handleEntityNotFound(_0x103e10,null))[_0xd43f('0x2a')](function(_0x55bc9e){if(_0x55bc9e){if(!_[_0xd43f('0x8c')](_0x55bc9e[_0xd43f('0x83')])){if(fs[_0xd43f('0x8d')](path[_0xd43f('0x86')](config['root'],_0xd43f('0x91'),_0x55bc9e[_0xd43f('0x83')]))&&_0x55bc9e[_0xd43f('0x94')]){_0x4833c6=path[_0xd43f('0x86')](config['root'],_0xd43f('0x91'),_0x55bc9e['customerAvatar']);}}return _0x103e10[_0xd43f('0x92')](_0x4833c6);}})[_0xd43f('0x5f')](handleError(_0x103e10,null));};exports[_0xd43f('0x95')]=function(_0x42c198,_0x3df7d4){var _0x2af269=path[_0xd43f('0x86')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x4315d6={'where':{'id':_0x42c198[_0xd43f('0x61')]['id']},'attributes':['id',_0xd43f('0x85')],'raw':!![]};return db[_0xd43f('0x47')][_0xd43f('0x6c')](_0x4315d6)[_0xd43f('0x2a')](handleEntityNotFound(_0x3df7d4,null))[_0xd43f('0x2a')](function(_0x1f4052){if(_0x1f4052){if(!_[_0xd43f('0x8c')](_0x1f4052[_0xd43f('0x85')])){if(fs[_0xd43f('0x8d')](path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0x91'),_0x1f4052[_0xd43f('0x85')]))){_0x2af269=path['join'](config[_0xd43f('0x87')],_0xd43f('0x91'),_0x1f4052[_0xd43f('0x85')]);}}return _0x3df7d4[_0xd43f('0x92')](_0x2af269);}})['catch'](handleError(_0x3df7d4,null));};function checkWebsiteInterval(_0x19c481){var _0x294d4f=_0x19c481[_0xd43f('0x96')];if(!_0x294d4f){return Promise[_0xd43f('0x97')](_0x19c481);}var _0x438520=_0x19c481[_0xd43f('0x98')]||undefined;return _0x294d4f[_0xd43f('0x99')](_0x438520)[_0xd43f('0x2a')](function(_0x24dc61){if(!_0x24dc61){throw new APIOutOfIntervalError();}return _0x19c481;});}exports[_0xd43f('0x9a')]=function(_0x46223a,_0x139970){var _0x41c0ea={'body':_0x46223a[_0xd43f('0x67')],'channel':'chat'};var _0x517f8f=[];var _0x510e67=[];var _0xaf3a26={};var _0x4895a7=![];if(_0x46223a['body']['id']){delete _0x46223a[_0xd43f('0x67')]['id'];}if(_[_0xd43f('0x8c')](_0x46223a[_0xd43f('0x67')][_0xd43f('0x9b')])){throw new APIBadRequestError(_0xd43f('0x9c'));}if(_['isNil'](_0x46223a[_0xd43f('0x67')][_0xd43f('0x9d')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0xd43f('0x9e')](_0x46223a['body'][_0xd43f('0x67')])){throw new APIBadRequestError(_0xd43f('0x9f'));}var _0x1d173b=_0x46223a[_0xd43f('0x67')]['customerIp']&&_0x46223a[_0xd43f('0x67')][_0xd43f('0x39')];return db['CmContact'][_0xd43f('0x71')]()[_0xd43f('0x2a')](function(_0x651f61){if(!_0x651f61){throw new Error('No\x20available\x20attributes');}_0x517f8f=Object[_0xd43f('0x4c')](_0x651f61)['filter'](function(_0x50ea34){return![_0xd43f('0xa0'),_0xd43f('0xa1')][_0xd43f('0xa2')](_0x50ea34);});_0x510e67=Object[_0xd43f('0x4c')](_0x651f61)[_0xd43f('0x57')](function(_0x36e2e4){return![_0xd43f('0xa0'),_0xd43f('0xa1'),_0xd43f('0xa3'),_0xd43f('0xa4')]['includes'](_0x36e2e4);});if(!_[_0xd43f('0xa2')](_0x510e67,_0x46223a['body'][_0xd43f('0x9d')])){throw new APIBadRequestError(_0xd43f('0xa5')+_0x510e67['join'](',\x20'));}_0xaf3a26[_0x46223a['body'][_0xd43f('0x9d')]]=_0x46223a[_0xd43f('0x67')][_0xd43f('0x9b')];})['then'](function(){return db['ChatWebsite'][_0xd43f('0x6c')]({'where':{'id':_0x46223a[_0xd43f('0x61')]['id']},'include':[{'model':db[_0xd43f('0xa6')],'as':'List','include':[{'model':db[_0xd43f('0xa7')],'as':_0xd43f('0xa8'),'where':_0xaf3a26,'limit':0x1,'order':[[_0xd43f('0xa1'),'DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'},{'model':db[_0xd43f('0x96')],'as':_0xd43f('0x96'),'include':[{'model':db[_0xd43f('0x96')],'as':_0xd43f('0xa9'),'attributes':['id',_0xd43f('0xaa')],'raw':!![]}]}]});})[_0xd43f('0x2a')](function(_0x8824d5){if(!_0x8824d5){throw new APINotFoundError(util[_0xd43f('0x3c')](_0xd43f('0xab'),_0x46223a[_0xd43f('0x61')]['id']));}if(_0x1d173b){return checkWebsiteInterval(_0x8824d5);}return _0x8824d5;})[_0xd43f('0x2a')](function(_0x23cc45){_0x41c0ea['account']=_0x23cc45;_0x41c0ea[_0xd43f('0xac')]=_[_0xd43f('0xad')](_0x23cc45[_0xd43f('0xae')],[_0xd43f('0xaf')],['asc']);if(_0x41c0ea[_0xd43f('0xb0')]['Applications']){delete _0x41c0ea['account'][_0xd43f('0xae')];}_0x41c0ea[_0xd43f('0xb1')]=_0x23cc45[_0xd43f('0xb2')]||{'id':_0x23cc45[_0xd43f('0xa4')]};if(_0x41c0ea['list']&&_0x41c0ea[_0xd43f('0xb1')][_0xd43f('0xa8')][_0xd43f('0x51')]){return _0x41c0ea[_0xd43f('0xb1')][_0xd43f('0xa8')][0x0];}var _0x32a2d6=_['defaults'](_0x46223a[_0xd43f('0x67')],{'firstName':_0x46223a['body']['from'],'ListId':_0x23cc45['ListId']});_0x32a2d6[_0x46223a[_0xd43f('0x67')][_0xd43f('0x9d')]]=_0x46223a[_0xd43f('0x67')]['from'];return db[_0xd43f('0xa7')][_0xd43f('0x62')](_0x32a2d6,{'fields':_0x517f8f,'raw':!![]});})[_0xd43f('0x2a')](function(_0x21669b){_0x41c0ea[_0xd43f('0xb3')]=_0x21669b;var _0x2770cf=createInteractionObject(_0x46223a[_0xd43f('0x61')]['id'],_0x46223a[_0xd43f('0x67')],_0x46223a[_0xd43f('0xb4')],_0x21669b);var _0xab1320={'ChatWebsiteId':_0x46223a[_0xd43f('0x61')]['id']};if(_0x46223a[_0xd43f('0x67')][_0xd43f('0xb5')]){_0xab1320['threadId']=_0x46223a[_0xd43f('0x67')][_0xd43f('0xb5')];_0xab1320[_0xd43f('0xb6')]=![];return db[_0xd43f('0xb7')][_0xd43f('0x6c')]({'where':_0xab1320})[_0xd43f('0x2a')](function(_0x37b08b){var _0x479d80=_0x46223a[_0xd43f('0x67')]['customerIp']&&_0x46223a[_0xd43f('0x67')][_0xd43f('0x39')];if(_0x37b08b){_0x4895a7=!![];return _0x37b08b;}else if(!_0x479d80&&_0x37b08b&&_0x37b08b[_0xd43f('0xb6')]){throw new APIConflictError(_0xd43f('0xb8'));}_0x2770cf['threadId']=_0x46223a[_0xd43f('0x67')][_0xd43f('0xb5')];_0x2770cf[_0xd43f('0xb9')]=_0x46223a[_0xd43f('0x67')][_0xd43f('0xb9')];return db[_0xd43f('0xb7')][_0xd43f('0x62')](_0x2770cf);});}_0xab1320[_0xd43f('0xba')]=_0x21669b['id'];if(_0x46223a[_0xd43f('0x67')]['interaction']&&_0x46223a['body']['interaction']['id']){_0xab1320['id']=_0x46223a[_0xd43f('0x67')][_0xd43f('0xbb')]['id'];return db[_0xd43f('0xb7')][_0xd43f('0x6c')]({'where':_0xab1320})[_0xd43f('0x2a')](function(_0x3095bd){var _0x5654f6=_0x46223a[_0xd43f('0x67')][_0xd43f('0x35')]&&_0x46223a[_0xd43f('0x67')]['referer'];if(!_0x5654f6&&_0x3095bd&&_0x3095bd[_0xd43f('0xb6')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x3095bd){_0x4895a7=!![];return _0x3095bd;}else{return db[_0xd43f('0xb7')][_0xd43f('0x62')](_0x2770cf);}});}return db[_0xd43f('0xb7')][_0xd43f('0x62')](_0x2770cf);})['then'](function(_0x486e3e){if(!_0x4895a7){return _0x486e3e;}var _0x5a9af4={'from':(_0x41c0ea[_0xd43f('0xb3')][_0xd43f('0xbc')]||'')+'\x20'+(_0x41c0ea[_0xd43f('0xb3')][_0xd43f('0xbd')]||'')};if(_0x46223a[_0xd43f('0x67')][_0xd43f('0xb5')]&&_0x46223a[_0xd43f('0x67')][_0xd43f('0xbe')]&&_0x46223a[_0xd43f('0x67')][_0xd43f('0xb5')]!=_0x46223a[_0xd43f('0x67')][_0xd43f('0xbe')]){_0x5a9af4[_0xd43f('0xb5')]=_0x46223a[_0xd43f('0x67')]['messageId'];}return _0x486e3e[_0xd43f('0x29')](_0x5a9af4);})[_0xd43f('0x2a')](function(_0x1aa11f){_0x41c0ea[_0xd43f('0xbb')]=_0x1aa11f[_0xd43f('0x2c')]({'plain':!![]});_0x41c0ea['interaction'][_0xd43f('0xbf')]=!_0x4895a7;if(_0x41c0ea['interaction']['created']){if(_0x41c0ea[_0xd43f('0xb0')][_0xd43f('0xc0')]){_0x41c0ea[_0xd43f('0xac')]['push']({'id':0x0,'priority':_0x41c0ea[_0xd43f('0xac')][_0xd43f('0x51')]+0x1,'app':_0xd43f('0xc1'),'appdata':_0xd43f('0xc2'),'interval':_0xd43f('0xc3')});}}return db[_0xd43f('0xc4')]['create']({'body':_0x46223a[_0xd43f('0x67')][_0xd43f('0x67')],'ChatWebsiteId':_0x46223a[_0xd43f('0x61')]['id'],'ChatInteractionId':_0x1aa11f['id'],'direction':'in','ContactId':_0x41c0ea[_0xd43f('0xb3')]['id'],'AttachmentId':_0x46223a[_0xd43f('0x67')]['AttachmentId']});})[_0xd43f('0x2a')](function(_0x43442d){_0x41c0ea[_0xd43f('0x1e')]=_0x43442d;if(!_0x41c0ea[_0xd43f('0xbb')][_0xd43f('0xc5')]){return;}return db[_0xd43f('0xc6')]['find']({'attributes':['id',_0xd43f('0x30')],'where':{'id':_0x41c0ea['interaction'][_0xd43f('0xc5')]}});})[_0xd43f('0x2a')](function(_0x19a129){if(_0x19a129){_0x41c0ea[_0xd43f('0xac')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd43f('0xc7'),'appdata':_0x19a129[_0xd43f('0x30')]+','+(_0x41c0ea[_0xd43f('0xb0')][_0xd43f('0xc8')]||0xa),'interval':_0xd43f('0xc3')});_0x41c0ea['forcedOwnership']=!![];}if(!_0x41c0ea[_0xd43f('0xbb')][_0xd43f('0xc9')]){return;}return db[_0xd43f('0xca')]['find']({'attributes':['id','name'],'where':{'id':_0x41c0ea['interaction'][_0xd43f('0xc9')]}});})[_0xd43f('0x2a')](function(_0x5e5e44){if(_0x5e5e44){_0x41c0ea['applications'][_0xd43f('0xcb')]({'id':0x0,'priority':0x1,'app':_0xd43f('0xcc'),'appdata':_0x5e5e44[_0xd43f('0x30')]+','+(_0x41c0ea[_0xd43f('0xb0')][_0xd43f('0xcd')]||0x12c),'interval':_0xd43f('0xc3')});}return respondWithRpcPromise(_0xd43f('0xce'),_0xd43f('0xcf'),_0x41c0ea);})['then'](function(_0xf451bf){respondWithRpcPromise(_0xd43f('0xd0'),_0xd43f('0xd0'),{'event':_0xd43f('0x9a'),'message':_0xf451bf},client9002);return _0xf451bf;})['then'](respondWithResult(_0x139970,null))[_0xd43f('0x5f')](APIHandleError(_0x139970));};exports[_0xd43f('0xd1')]=function(_0x3d9159,_0x3eaa9e){var _0x593918,_0x587c0a,_0x4179cf;var _0x10b29c=[];var _0x132f85={};var _0x5f3cc1=_0x3d9159['files']||[];var _0x31ad17=[];var _0x36398a;return db['CmContact'][_0xd43f('0x71')]()[_0xd43f('0x2a')](function(_0x50c513){if(!_0x50c513){throw new db[(_0xd43f('0xd2'))][(_0xd43f('0xd3'))](_0xd43f('0xd4'));}_0x10b29c=_[_0xd43f('0xd5')](_[_0xd43f('0x4c')](_0x50c513),['createdAt',_0xd43f('0xa1'),_0xd43f('0xa3'),_0xd43f('0xa4')]);if(_0x3d9159[_0xd43f('0x67')]['id']){delete _0x3d9159['body']['id'];}if(_[_0xd43f('0x8c')](_0x3d9159[_0xd43f('0x67')][_0xd43f('0x9b')])){throw _0x3eaa9e['status'](0x1f4)[_0xd43f('0x31')](new db[(_0xd43f('0xd2'))][(_0xd43f('0xd3'))](_0xd43f('0xd6')));}if(_[_0xd43f('0x8c')](_0x3d9159['body'][_0xd43f('0x67')])||_0x3d9159['body']['body']===''){throw _0x3eaa9e[_0xd43f('0x21')](0x1f4)['send'](new db[(_0xd43f('0xd2'))]['ValidationError'](_0xd43f('0xd7')));}if(_[_0xd43f('0x8c')](_0x3d9159[_0xd43f('0x67')][_0xd43f('0xd8')])){throw _0x3eaa9e[_0xd43f('0x21')](0x1f4)[_0xd43f('0x31')](new db[(_0xd43f('0xd2'))][(_0xd43f('0xd3'))](_0xd43f('0xd9')+_0x10b29c));}if(!_[_0xd43f('0xa2')](_0x10b29c,_0x3d9159[_0xd43f('0x67')][_0xd43f('0xd8')])){throw _0x3eaa9e['status'](0x1f4)['send'](new db[(_0xd43f('0xd2'))]['ValidationError'](_0xd43f('0xda')+_0x10b29c));}_0x132f85[_0x3d9159[_0xd43f('0x67')][_0xd43f('0xd8')]]=_0x3d9159[_0xd43f('0x67')][_0xd43f('0x9b')];})[_0xd43f('0x2a')](function(){return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x3d9159[_0xd43f('0x61')]['id']},'include':[{'model':db[_0xd43f('0xa6')],'as':_0xd43f('0xb2')},{'model':db['MailAccount'],'as':_0xd43f('0xdb')}]});})[_0xd43f('0x2a')](handleEntityNotFound(_0x3eaa9e,null))[_0xd43f('0x2a')](function(_0xd9b10a){if(_0xd9b10a&&_0xd9b10a[_0xd43f('0xb2')]){_0x587c0a=_0xd9b10a;var _0x162d9b=_[_0xd43f('0x11')](_0x3d9159[_0xd43f('0x67')],{'firstName':_0x3d9159['body'][_0xd43f('0x9b')],'phone':_0x3d9159[_0xd43f('0x67')][_0xd43f('0x9b')],'ListId':_0xd9b10a[_0xd43f('0xa4')]});_0x162d9b[_0x3d9159['body'][_0xd43f('0xd8')]]=_0x3d9159[_0xd43f('0x67')][_0xd43f('0x9b')];return db[_0xd43f('0xa7')][_0xd43f('0xdc')]({'where':_0x132f85,'defaults':_0x162d9b});}})[_0xd43f('0xdd')](function(_0x4e9337){if(_0x4e9337){_0x4179cf=_0x4e9337;var _0x57321f=fs['readFileSync'](path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0xde')),'utf8');var _0x372b2d=ejs[_0xd43f('0xdf')](_0x57321f,{'body':_[_0xd43f('0xe0')](_0x3d9159[_0xd43f('0x67')][_0xd43f('0x67')]),'bodyTitle':_0x587c0a[_0xd43f('0xe1')]});return db[_0xd43f('0xe2')]['create']({'body':_0x372b2d,'plainBody':htmlToText[_0xd43f('0xe3')](_0x372b2d),'ContactId':_0x4e9337['id'],'ChatWebsiteId':_0x587c0a['id']});}})[_0xd43f('0x2a')](function(_0x50c93a){_0x36398a=_0x50c93a;if(_0x5f3cc1['length']){var _0x30c306=_0x5f3cc1[_0xd43f('0x46')](function(_0xfe034e){return{'name':_0xfe034e[_0xd43f('0xe4')],'basename':_0xfe034e['filename'],'type':_0xfe034e[_0xd43f('0xe5')],'ChatOfflineMessageId':_0x50c93a['id']};});_0x31ad17=_0x30c306[_0xd43f('0x46')](_0xcad05c=>{var _0x1e4efe={'filename':_0xcad05c[_0xd43f('0x30')],'path':path[_0xd43f('0x86')](config[_0xd43f('0x87')],'server','files',_0xd43f('0xe6'),_0xd43f('0xe7'),_0xcad05c[_0xd43f('0xe8')])};return _0x1e4efe;});if(!_0x587c0a[_0xd43f('0xe9')]){return db[_0xd43f('0xea')][_0xd43f('0xeb')](function(_0x3df481){return db[_0xd43f('0xec')][_0xd43f('0xed')](_0x30c306,{'transaction':_0x3df481});});}}})['then'](function(){if(_0x36398a){_0x593918=_0x36398a;return db[_0xd43f('0xdb')][_0xd43f('0x74')]({'where':{'service':!![]},'include':[{'model':db[_0xd43f('0xee')],'as':_0xd43f('0xef'),'raw':!![],'include':[{'model':db[_0xd43f('0xf0')],'as':'CloudProvider','raw':!![]}]}]});}})[_0xd43f('0x2a')](function(_0x44be88){if(_0x44be88&&_0x44be88[_0xd43f('0xef')]&&_0x587c0a['forwardOffline']&&_0x587c0a[_0xd43f('0xf1')]){var _0x36839a=_0x44be88[_0xd43f('0xf2')]();return respondWithRpcPromise(_0xd43f('0xf3'),_0xd43f('0xf4'),{'account':_0x36839a,'message':{'from':util[_0xd43f('0x3c')](_0xd43f('0xf5'),_0x44be88[_0xd43f('0x30')],_0x44be88[_0xd43f('0xf6')]||_0x44be88[_0xd43f('0xef')][_0xd43f('0x6a')]),'to':_0x587c0a['forwardOfflineAddress'],'subject':_0x587c0a['offlineMessageSubject'],'html':_0x593918[_0xd43f('0x67')],'attachments':_0x31ad17}},client9003)['then'](function(){return _0x593918;})[_0xd43f('0x5f')](function(_0x4b13d0){logger[_0xd43f('0x1c')](_0x4b13d0);});}})[_0xd43f('0x2a')](function(){if(_0x587c0a&&_0x587c0a[_0xd43f('0xe9')]&&_0x587c0a['MailAccountId']){var _0x28bb01=[];if(_0x5f3cc1['length']){_0x28bb01=_0x5f3cc1[_0xd43f('0x46')](function(_0x2bd853){return{'name':_0x2bd853[_0xd43f('0xe4')],'basename':_0x2bd853[_0xd43f('0x80')],'type':_0x2bd853[_0xd43f('0xe5')],'ChatOfflineMessageId':_0x36398a['id']};});}var _0x18fea1;if(!_['isNil'](_0x587c0a[_0xd43f('0xf7')])){var _0x25890a=_['map'](_0x3d9159[_0xd43f('0x67')],function(_0x48f676){return _0x48f676;});var _0xce79fa=_[_0xd43f('0xf8')](_0x25890a)[0x0];var _0x193ee8=_[_0xd43f('0xf9')](_0xce79fa,function(_0x701631){return _0x701631;});_0x18fea1=_0x193ee8[0x1][_0x587c0a['subjectOffline']];}var _0x2f10ee={'from':_0x4179cf[_0xd43f('0xf6')],'firstName':_0x4179cf[_0xd43f('0xbc')],'lastName':_0x4179cf[_0xd43f('0xbd')],'mapKey':_0xd43f('0xf6'),'message':{'from':_0x4179cf[_0xd43f('0xf6')],'to':_0x587c0a['MailAccount'][_0xd43f('0xf6')],'cc':'','subject':_['isNil'](_0x18fea1)?_0x587c0a[_0xd43f('0xfa')]:_0x18fea1,'messageId':'','sentAt':new Date(),'attach':_0x28bb01[_0xd43f('0x51')],'attachments':_0x28bb01,'originChannel':_0xd43f('0xfb'),'ChatWebsiteId':_0x587c0a['id'],'ChatOfflineMessageId':_0x593918['id'],'originTo':_0x587c0a[_0xd43f('0xdb')]['email']},'body':_0x593918[_0xd43f('0x67')]};var _0x17b5c8={'account':{'id':_0x587c0a[_0xd43f('0xfc')]},'body':_0x2f10ee,'log':_0xd43f('0xfd')};return respondWithRpcPromise(_0xd43f('0xfd'),_0xd43f('0xfe'),_0x17b5c8,client9001)[_0xd43f('0x2a')](function(){return _0x593918;})['catch'](function(_0x46c524){logger[_0xd43f('0x1c')](_0x46c524);});}return;})['then'](function(){if(_0x593918){return _0x593918;}})[_0xd43f('0x2a')](respondWithResult(_0x3eaa9e,null))[_0xd43f('0x5f')](function(){for(var _0x1facca of _0x5f3cc1){var _0x1a01b7=path[_0xd43f('0x86')](config['root'],_0xd43f('0xff'),'files',_0xd43f('0xe6'),_0xd43f('0xe7'),_0x1facca[_0xd43f('0x80')]);fs_extra[_0xd43f('0x100')](_0x1a01b7)[_0xd43f('0x5f')](function(_0x45433f){logger[_0xd43f('0x1c')](_0xd43f('0x101'),_0x1a01b7,_0x45433f);});}});};exports[_0xd43f('0x102')]=function(_0x21753f,_0x5aa425){return db[_0xd43f('0xb7')][_0xd43f('0x6c')]({'where':{'id':_0x21753f[_0xd43f('0x61')]['id']}})['then'](handleEntityNotFound(_0x5aa425,null))[_0xd43f('0x2a')](function(_0x2c1cf4){if(_0x2c1cf4){return _0x2c1cf4[_0xd43f('0x102')](_0x21753f['body'][_0xd43f('0x78')],_[_0xd43f('0x103')](_0x21753f[_0xd43f('0x67')],[_0xd43f('0x78'),'id'])||{});}})['then'](respondWithResult(_0x5aa425,null))[_0xd43f('0x5f')](handleError(_0x5aa425,null));};exports[_0xd43f('0x104')]=function(_0x1845fe,_0x52267d){var _0x55e661={'raw':![],'where':{}};var _0x5264b4={};var _0x58badb={'count':0x0,'rows':[]};return db[_0xd43f('0x47')][_0xd43f('0x74')]({'where':{'id':_0x1845fe[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x52267d,null))[_0xd43f('0x2a')](function(_0x56c0b6){if(_0x56c0b6){_0x5264b4[_0xd43f('0x40')]=_['keys'](db[_0xd43f('0xb7')][_0xd43f('0x48')]);_0x5264b4[_0xd43f('0x4b')]=_['keys'](_0x1845fe[_0xd43f('0x4b')]);_0x5264b4[_0xd43f('0x4d')]=_[_0xd43f('0x4e')](_0x5264b4[_0xd43f('0x40')],_0x5264b4['query']);_0x55e661[_0xd43f('0x50')]=_['intersection'](_0x5264b4[_0xd43f('0x40')],qs['fields'](_0x1845fe[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x55e661[_0xd43f('0x50')]=_0x55e661[_0xd43f('0x50')][_0xd43f('0x51')]?_0x55e661[_0xd43f('0x50')]:_0x5264b4[_0xd43f('0x40')];if(!_0x1845fe[_0xd43f('0x4b')][_0xd43f('0x76')]('nolimit')){_0x55e661[_0xd43f('0x26')]=qs[_0xd43f('0x26')](_0x1845fe['query'][_0xd43f('0x26')]);_0x55e661[_0xd43f('0x24')]=qs['offset'](_0x1845fe[_0xd43f('0x4b')]['offset']);}_0x55e661[_0xd43f('0x53')]=qs[_0xd43f('0x54')](_0x1845fe[_0xd43f('0x4b')][_0xd43f('0x54')]);_0x55e661[_0xd43f('0x55')]=qs['filters'](_[_0xd43f('0x56')](_0x1845fe['query'],_0x5264b4[_0xd43f('0x4d')]));_0x55e661['where']['ChatWebsiteId']=_0x56c0b6['id'];if(_0x1845fe[_0xd43f('0x4b')]['filter']){_0x55e661[_0xd43f('0x55')]=_['merge'](_0x55e661[_0xd43f('0x55')],{'$or':_[_0xd43f('0x46')](_0x55e661[_0xd43f('0x50')],function(_0x3bf49f){var _0x1bffe2={};_0x1bffe2[_0x3bf49f]={'$like':'%'+_0x1845fe[_0xd43f('0x4b')]['filter']+'%'};return _0x1bffe2;})});}_0x55e661=_['merge']({},_0x55e661,_0x1845fe[_0xd43f('0x5a')]);return db[_0xd43f('0xb7')][_0xd43f('0x27')]({'where':_0x55e661[_0xd43f('0x55')]})[_0xd43f('0x2a')](function(_0x4ba9cf){_0x58badb[_0xd43f('0x27')]=_0x4ba9cf;if(_0x1845fe[_0xd43f('0x4b')]['includeAll']){_0x55e661[_0xd43f('0x5c')]=[{'model':db[_0xd43f('0xa7')],'as':_0xd43f('0x105'),'required':![]},{'model':db['User'],'as':_0xd43f('0x106'),'attributes':[_0xd43f('0x30'),_0xd43f('0x107'),'internal'],'required':![]},{'model':db[_0xd43f('0x108')],'as':_0xd43f('0x109'),'attributes':['id',_0xd43f('0x30'),_0xd43f('0x10a')],'where':_0x1845fe[_0xd43f('0x4b')]['tag']?{'id':_0x1845fe['query'][_0xd43f('0x10b')]}:undefined,'required':_0x1845fe[_0xd43f('0x4b')][_0xd43f('0x10b')]?!![]:![]}];}return db[_0xd43f('0xb7')][_0xd43f('0x5d')](_0x55e661);})['then'](function(_0x452dc0){_0x58badb[_0xd43f('0x5e')]=_0x452dc0;return _0x58badb;});}})['then'](respondWithFilteredResult(_0x52267d,_0x55e661))[_0xd43f('0x5f')](handleError(_0x52267d,null));};exports[_0xd43f('0x10c')]=function(_0x4050c7,_0x314e00){var _0x5ef2c2=0x0;var _0x3a3a25=0x0;var _0x4f989d=![];var _0x478a6a;var _0x2f6cf1;return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x4050c7[_0xd43f('0x61')]['id']},'include':[{'model':db[_0xd43f('0x96')],'as':_0xd43f('0x96'),'include':[{'model':db[_0xd43f('0x96')],'as':_0xd43f('0xa9'),'attributes':['id','interval']}]}]})[_0xd43f('0x2a')](handleEntityNotFound(_0x314e00,null))[_0xd43f('0x2a')](function(_0x4acc9f){if(_0x4acc9f){_0x478a6a=_0x4acc9f;return _0x4acc9f[_0xd43f('0x10d')]({'raw':!![]});}})[_0xd43f('0x2a')](function(_0x3156ad){if(_0x478a6a){if(_0x3156ad){_0x2f6cf1=_0x3156ad;}}return require(_0xd43f('0x89'))[_0xd43f('0x8a')]();})['then'](function(_0x559ad7){if(_0x559ad7){_0x3a3a25=_0x559ad7[_0xd43f('0x10e')];_0x4f989d=_0x559ad7[_0xd43f('0x8b')];}})[_0xd43f('0x2a')](function(){return db[_0xd43f('0xb7')]['count']({'where':{'closed':![]}});})['then'](function(_0x1c06fd){_0x5ef2c2=_0x1c06fd;if(_0x3a3a25&&_0x1c06fd>_0x3a3a25){return db['License'][_0xd43f('0x74')]({'where':{'id':0x1}})[_0xd43f('0x2a')](function(_0xbd8d56){if(_0xbd8d56){_0xbd8d56['increment'](_0xd43f('0x10f'));}});}})['then'](function(){var _0x4874fd=_0x478a6a[_0xd43f('0x96')];var _0x2fbf1e=_0x478a6a[_0xd43f('0x98')]||undefined;return _0x4874fd?_0x4874fd['ifTime'](_0x2fbf1e):!![];})['then'](function(_0x3be95e){var _0x4087d9=fs[_0xd43f('0x110')](path[_0xd43f('0x86')](config[_0xd43f('0x87')],_0xd43f('0x111')),_0xd43f('0x112'));var _0x3b9b2c='3.10.1';var _0x38fe0c=![];var _0x2005e1,_0x1c63d5;if(_0x4050c7[_0xd43f('0xb4')][_0xd43f('0x39')]){_0x2005e1=new URL(_0x4050c7['headers'][_0xd43f('0x39')])[_0xd43f('0x113')];}else if(_0x4050c7[_0xd43f('0xb4')][_0xd43f('0x113')]){_0x2005e1=new URL(_0x4050c7['headers'][_0xd43f('0x113')])[_0xd43f('0x113')];}else{_0x2005e1=_0xd43f('0x114');}_0x1c63d5=typeof _0x478a6a[_0xd43f('0x63')][_0xd43f('0x37')](',')['find'](function(_0x53c9d3){return wildcardUtils[_0xd43f('0x115')](_0x53c9d3,_0x2005e1);})!=='undefined';var _0x5a0613={'chatVersion':_0x3b9b2c,'chatWebsiteAddressOrigin':_0x1c63d5?_0x2005e1:_0x478a6a[_0xd43f('0x63')],'remote':_0x478a6a['remote'],'query':querystring[_0xd43f('0x1b')](_[_0xd43f('0x58')](_0x478a6a[_0xd43f('0x2c')]({'plain':!![]}),{'customerIp':_0x4050c7[_0xd43f('0xb4')][_0xd43f('0x36')]||_0x4050c7[_0xd43f('0xb4')][_0xd43f('0x116')]||_0x4050c7[_0xd43f('0x117')][_0xd43f('0x118')]||_0x4050c7['ip'],'referer':_0x4050c7[_0xd43f('0xb4')][_0xd43f('0x39')],'openedInteractions':_0x5ef2c2,'maxInteractions':_0x3a3a25,'virtual':_0x4f989d['virtual'],'online':_0x3be95e,'custom':_0x4f989d,'address':_0x1c63d5?_0x2005e1:null}))[_0xd43f('0x119')](/'/g,'\x5c\x27')};_0x314e00[_0xd43f('0x31')](ejs[_0xd43f('0xdf')](Mustache[_0xd43f('0xdf')](_0x4087d9,_0x5a0613),{'proactiveActions':_0x2f6cf1,'alignment':_0x478a6a['alignment'],'verticalAlignment':_0x478a6a['verticalAlignment'],'div_color':_0x478a6a[_0xd43f('0x10a')],'labelText':_0x478a6a[_0xd43f('0x11a')],'text_color':_0x478a6a[_0xd43f('0x11b')],'text_button_color':_0x478a6a[_0xd43f('0x11c')],'button_color':_0x478a6a[_0xd43f('0x11d')],'background_color':_0x478a6a[_0xd43f('0x11e')],'hideWhenOffline':_0x478a6a['hideWhenOffline'],'intervalId':_0x478a6a[_0xd43f('0x11f')],'isDevelopment':_0x38fe0c,'chatVersion':_0x3b9b2c}));})[_0xd43f('0x5f')](handleError(_0x314e00,null));};exports['addApplications']=function(_0x4b3e23,_0x415d1e){var _0x2f7253=_0x4b3e23[_0xd43f('0x61')]['id'];var _0x515e60=_0x4b3e23[_0xd43f('0x67')];var _0x3132a2=0xc8;var _0x4b054=null;return db[_0xd43f('0xea')][_0xd43f('0xeb')]({'isolationLevel':db['sequelize'][_0xd43f('0x120')][_0xd43f('0x121')][_0xd43f('0x122')]},function(_0x5c69d9){return db[_0xd43f('0x47')][_0xd43f('0x74')]({'where':{'id':_0x2f7253},'transaction':_0x5c69d9})[_0xd43f('0x2a')](function(_0x10f796){if(_0x10f796){return db[_0xd43f('0x123')][_0xd43f('0x2b')]({'where':{'ChatWebsiteId':_0x2f7253},'transaction':_0x5c69d9})[_0xd43f('0x2a')](function(){var _0x35aaab=_['map'](_0x515e60,function(_0x160d74){_0x160d74[_0xd43f('0x73')]=_0x2f7253;return _0x160d74;});return db[_0xd43f('0x123')][_0xd43f('0xed')](_0x35aaab,{'transaction':_0x5c69d9});});}else{_0x3132a2=0x194;_0x4b054=[];}});})['then'](function(){if(_0x3132a2!==0x194){return db['ChatApplication'][_0xd43f('0x124')]({'where':{'ChatWebsiteId':_0x2f7253},'order':_0xd43f('0xaf')})[_0xd43f('0x2a')](function(_0xf87efb){_0x4b054=_0xf87efb;});}})[_0xd43f('0x5f')](function(_0x4fbe4c){_0x3132a2=0x1f4;logger[_0xd43f('0x1c')](_0x4fbe4c[_0xd43f('0x2f')]);if(_0x4fbe4c[_0xd43f('0x30')]){delete _0x4fbe4c[_0xd43f('0x30')];}_0x4b054=_0x4fbe4c;})[_0xd43f('0x125')](function(){if(_0x4b054===null){_0x415d1e[_0xd43f('0x20')](_0x3132a2);}else{if(_0x3132a2===0x1f4){_0x415d1e[_0xd43f('0x21')](_0x3132a2)[_0xd43f('0x31')](_0x4b054);}else{_0x415d1e[_0xd43f('0x21')](_0x3132a2)[_0xd43f('0x23')](_0x4b054);}}});};exports[_0xd43f('0x126')]=function(_0x10c59e,_0x221f68){var _0x22ab14={};var _0x169909={};var _0x47a5eb;var _0x2eae07;return db[_0xd43f('0x47')][_0xd43f('0x74')]({'where':{'id':_0x10c59e['params']['id']}})['then'](handleEntityNotFound(_0x221f68,null))['then'](function(_0x47d583){if(_0x47d583){_0x47a5eb=_0x47d583;_0x169909[_0xd43f('0x40')]=_[_0xd43f('0x4c')](db[_0xd43f('0x123')]['rawAttributes']);_0x169909[_0xd43f('0x4b')]=_[_0xd43f('0x4c')](_0x10c59e[_0xd43f('0x4b')]);_0x169909['filters']=_[_0xd43f('0x4e')](_0x169909[_0xd43f('0x40')],_0x169909[_0xd43f('0x4b')]);_0x22ab14[_0xd43f('0x50')]=_[_0xd43f('0x4e')](_0x169909[_0xd43f('0x40')],qs[_0xd43f('0x4f')](_0x10c59e[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x22ab14[_0xd43f('0x50')]=_0x22ab14[_0xd43f('0x50')][_0xd43f('0x51')]?_0x22ab14[_0xd43f('0x50')]:_0x169909['model'];_0x22ab14[_0xd43f('0x53')]=qs[_0xd43f('0x54')](_0x10c59e[_0xd43f('0x4b')]['sort']);_0x22ab14[_0xd43f('0x55')]=qs['filters'](_[_0xd43f('0x56')](_0x10c59e[_0xd43f('0x4b')],_0x169909[_0xd43f('0x4d')]));if(_0x10c59e[_0xd43f('0x4b')]['filter']){_0x22ab14['where']=_[_0xd43f('0x58')](_0x22ab14[_0xd43f('0x55')],{'$or':_[_0xd43f('0x46')](_0x22ab14[_0xd43f('0x50')],function(_0x303647){var _0xd186b9={};_0xd186b9[_0x303647]={'$like':'%'+_0x10c59e[_0xd43f('0x4b')]['filter']+'%'};return _0xd186b9;})});}_0x22ab14=_[_0xd43f('0x58')]({},_0x22ab14,_0x10c59e[_0xd43f('0x5a')]);return _0x47a5eb['getApplications'](_0x22ab14);}})[_0xd43f('0x2a')](function(_0x1fe152){if(_0x1fe152){_0x2eae07=_0x1fe152[_0xd43f('0x51')];if(!_0x10c59e[_0xd43f('0x4b')]['hasOwnProperty'](_0xd43f('0x52'))){_0x22ab14[_0xd43f('0x26')]=qs[_0xd43f('0x26')](_0x10c59e[_0xd43f('0x4b')][_0xd43f('0x26')]);_0x22ab14[_0xd43f('0x24')]=qs['offset'](_0x10c59e[_0xd43f('0x4b')][_0xd43f('0x24')]);}return _0x47a5eb[_0xd43f('0x126')](_0x22ab14);}})[_0xd43f('0x2a')](function(_0x4e417f){if(_0x4e417f){return _0x4e417f?{'count':_0x2eae07,'rows':_0x4e417f}:null;}})['then'](respondWithResult(_0x221f68,null))[_0xd43f('0x5f')](handleError(_0x221f68,null));};exports[_0xd43f('0x127')]=function(_0x495ae9,_0x1308e6){return db[_0xd43f('0x128')][_0xd43f('0x6c')]({'where':{'id':_0x495ae9[_0xd43f('0x61')]['id']}})['then'](handleEntityNotFound(_0x1308e6,null))[_0xd43f('0x2a')](function(_0x80dc00){if(_0x80dc00){return _0x80dc00[_0xd43f('0x127')](_0x495ae9['body']['ids'],_[_0xd43f('0x103')](_0x495ae9[_0xd43f('0x67')],[_0xd43f('0x78'),'id'])||{});}})[_0xd43f('0x2a')](respondWithResult(_0x1308e6,null))['catch'](handleError(_0x1308e6,null));};exports[_0xd43f('0x10d')]=function(_0x40d89c,_0x49daff){var _0x2ddf5b={};var _0x33821b={};var _0x1e66f2;var _0x43a1fa;return db[_0xd43f('0x47')]['findOne']({'where':{'id':_0x40d89c[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x49daff,null))[_0xd43f('0x2a')](function(_0xb93358){if(_0xb93358){_0x1e66f2=_0xb93358;_0x33821b[_0xd43f('0x40')]=_['keys'](db[_0xd43f('0x129')][_0xd43f('0x48')]);_0x33821b[_0xd43f('0x4b')]=_['keys'](_0x40d89c[_0xd43f('0x4b')]);_0x33821b[_0xd43f('0x4d')]=_[_0xd43f('0x4e')](_0x33821b[_0xd43f('0x40')],_0x33821b[_0xd43f('0x4b')]);_0x2ddf5b['attributes']=_[_0xd43f('0x4e')](_0x33821b['model'],qs[_0xd43f('0x4f')](_0x40d89c[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x2ddf5b['attributes']=_0x2ddf5b[_0xd43f('0x50')][_0xd43f('0x51')]?_0x2ddf5b[_0xd43f('0x50')]:_0x33821b['model'];_0x2ddf5b[_0xd43f('0x53')]=qs[_0xd43f('0x54')](_0x40d89c[_0xd43f('0x4b')]['sort']);_0x2ddf5b['where']=qs[_0xd43f('0x4d')](_[_0xd43f('0x56')](_0x40d89c['query'],_0x33821b[_0xd43f('0x4d')]));if(_0x40d89c[_0xd43f('0x4b')][_0xd43f('0x57')]){_0x2ddf5b[_0xd43f('0x55')]=_[_0xd43f('0x58')](_0x2ddf5b[_0xd43f('0x55')],{'$or':_[_0xd43f('0x46')](_0x2ddf5b['attributes'],function(_0x39fc95){var _0x4bb226={};_0x4bb226[_0x39fc95]={'$like':'%'+_0x40d89c[_0xd43f('0x4b')][_0xd43f('0x57')]+'%'};return _0x4bb226;})});}_0x2ddf5b=_[_0xd43f('0x58')]({},_0x2ddf5b,_0x40d89c[_0xd43f('0x5a')]);return _0x1e66f2['getProactiveActions'](_0x2ddf5b);}})[_0xd43f('0x2a')](function(_0x1eb282){if(_0x1eb282){_0x43a1fa=_0x1eb282[_0xd43f('0x51')];if(!_0x40d89c['query']['hasOwnProperty']('nolimit')){_0x2ddf5b[_0xd43f('0x26')]=qs['limit'](_0x40d89c[_0xd43f('0x4b')][_0xd43f('0x26')]);_0x2ddf5b[_0xd43f('0x24')]=qs[_0xd43f('0x24')](_0x40d89c[_0xd43f('0x4b')][_0xd43f('0x24')]);}return _0x1e66f2['getProactiveActions'](_0x2ddf5b);}})[_0xd43f('0x2a')](function(_0x54437b){if(_0x54437b){return _0x54437b?{'count':_0x43a1fa,'rows':_0x54437b}:null;}})[_0xd43f('0x2a')](respondWithResult(_0x49daff,null))[_0xd43f('0x5f')](handleError(_0x49daff,null));};exports[_0xd43f('0x12a')]=function(_0x501a44,_0x49dd44){var _0x564386=_0x501a44[_0xd43f('0x4b')]['online']===_0xd43f('0x12b')?_0xd43f('0x12c'):'onlineForm';return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'attributes':['id',_0x564386],'where':{'id':_0x501a44['params']['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x49dd44,null))[_0xd43f('0x2a')](function(_0x3e5ad9){if(_0x3e5ad9){var _0x179a4c=_0x3e5ad9[_0x564386];var _0x5e56fa=_0x179a4c&&_0x179a4c[_0xd43f('0x12d')]?_0x179a4c[_0xd43f('0x12d')]:[];_0x49dd44[_0xd43f('0x31')]({'fromKey':_[_0xd43f('0x8c')](_0x179a4c['fromKey'])?undefined:_0x179a4c[_0xd43f('0x12e')],'count':_0x5e56fa[_0xd43f('0x51')],'rows':_0x5e56fa});}})[_0xd43f('0x5f')](handleError(_0x49dd44,null));};exports[_0xd43f('0x12f')]=function(_0x1ec235,_0x2d8bc9){var _0x414a60={'raw':![],'where':{}};var _0x4ebdcd={};var _0x41bbe9={'count':0x0,'rows':[]};return db[_0xd43f('0x47')][_0xd43f('0x74')]({'where':{'id':_0x1ec235[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x2d8bc9,null))['then'](function(_0x2d3afd){if(_0x2d3afd){_0x4ebdcd[_0xd43f('0x40')]=_[_0xd43f('0x4c')](db[_0xd43f('0xe2')][_0xd43f('0x48')]);_0x4ebdcd[_0xd43f('0x4b')]=_[_0xd43f('0x4c')](_0x1ec235[_0xd43f('0x4b')]);_0x4ebdcd[_0xd43f('0x4d')]=_[_0xd43f('0x4e')](_0x4ebdcd['model'],_0x4ebdcd[_0xd43f('0x4b')]);_0x414a60[_0xd43f('0x50')]=_[_0xd43f('0x4e')](_0x4ebdcd[_0xd43f('0x40')],qs['fields'](_0x1ec235[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x414a60[_0xd43f('0x50')]=_0x414a60[_0xd43f('0x50')][_0xd43f('0x51')]?_0x414a60[_0xd43f('0x50')]:_0x4ebdcd[_0xd43f('0x40')];if(!_0x1ec235['query'][_0xd43f('0x76')](_0xd43f('0x52'))){_0x414a60[_0xd43f('0x26')]=qs[_0xd43f('0x26')](_0x1ec235[_0xd43f('0x4b')][_0xd43f('0x26')]);_0x414a60['offset']=qs[_0xd43f('0x24')](_0x1ec235[_0xd43f('0x4b')][_0xd43f('0x24')]);}_0x414a60[_0xd43f('0x53')]=qs[_0xd43f('0x54')](_0x1ec235[_0xd43f('0x4b')][_0xd43f('0x54')]);_0x414a60[_0xd43f('0x55')]=qs['filters'](_[_0xd43f('0x56')](_0x1ec235['query'],_0x4ebdcd[_0xd43f('0x4d')]));_0x414a60[_0xd43f('0x55')][_0xd43f('0x73')]=_0x2d3afd['id'];if(_0x1ec235['query'][_0xd43f('0x57')]){_0x414a60['where']=_[_0xd43f('0x58')](_0x414a60[_0xd43f('0x55')],{'$or':_[_0xd43f('0x46')](_0x414a60[_0xd43f('0x50')],function(_0x22efb1){var _0x34e038={};_0x34e038[_0x22efb1]={'$like':'%'+_0x1ec235[_0xd43f('0x4b')]['filter']+'%'};return _0x34e038;})});}_0x414a60=_['merge']({},_0x414a60,_0x1ec235[_0xd43f('0x5a')]);return db['ChatOfflineMessage']['count']({'where':_0x414a60['where']})[_0xd43f('0x2a')](function(_0x189375){_0x41bbe9[_0xd43f('0x27')]=_0x189375;if(_0x1ec235['query'][_0xd43f('0x5b')]){_0x414a60[_0xd43f('0x5c')]=[{'all':!![]}];}else{_0x414a60[_0xd43f('0x5c')]=[{'model':db[_0xd43f('0xa7')],'as':_0xd43f('0x105'),'required':![]},{'model':db[_0xd43f('0xec')],'as':'Attachments','required':![]}];}return db[_0xd43f('0xe2')]['findAll'](_0x414a60);})[_0xd43f('0x2a')](function(_0x4a1c14){_0x41bbe9[_0xd43f('0x5e')]=_0x4a1c14;return _0x41bbe9;});}})[_0xd43f('0x2a')](respondWithFilteredResult(_0x2d8bc9,_0x414a60))[_0xd43f('0x5f')](handleError(_0x2d8bc9,null));};exports[_0xd43f('0x130')]=function(_0xcb9333,_0x5a08c4){return db[_0xd43f('0x47')]['find']({'where':{'id':_0xcb9333[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x5a08c4,null))[_0xd43f('0x2a')](function(_0x276899){if(_0x276899){return _0x276899[_0xd43f('0x130')](_0xcb9333[_0xd43f('0x67')]['ids'],_[_0xd43f('0x103')](_0xcb9333['body'],[_0xd43f('0x78'),'id'])||{})[_0xd43f('0xdd')](function(_0x29a4ea){for(var _0x5ae805=0x0;_0x5ae805<_0xcb9333[_0xd43f('0x67')][_0xd43f('0x78')][_0xd43f('0x51')];_0x5ae805+=0x1){socket[_0xd43f('0x131')](_0xd43f('0x132'),{'UserId':Number(_0xcb9333[_0xd43f('0x67')]['ids'][_0x5ae805]),'ChatWebsiteId':Number(_0xcb9333[_0xd43f('0x61')]['id'])});}return _0x29a4ea;});}})[_0xd43f('0x2a')](respondWithResult(_0x5a08c4,null))[_0xd43f('0x5f')](handleError(_0x5a08c4,null));};exports[_0xd43f('0x133')]=function(_0x2d4e34,_0x52fb8a){return db[_0xd43f('0x47')][_0xd43f('0x6c')]({'where':{'id':_0x2d4e34['params']['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x52fb8a,null))[_0xd43f('0x2a')](function(_0x5dac85){if(_0x5dac85){return _0x5dac85[_0xd43f('0x133')](_0x2d4e34[_0xd43f('0x4b')]['ids'])['then'](function(){if(_[_0xd43f('0x134')](_0x2d4e34['query'][_0xd43f('0x78')])){for(var _0x2a5a61=0x0;_0x2a5a61<_0x2d4e34['query'][_0xd43f('0x78')][_0xd43f('0x51')];_0x2a5a61+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x2d4e34['query'][_0xd43f('0x78')][_0x2a5a61]),'ChatWebsiteId':Number(_0x2d4e34[_0xd43f('0x61')]['id'])});}}else{socket[_0xd43f('0x131')]('userChatWebsite:remove',{'UserId':Number(_0x2d4e34[_0xd43f('0x4b')][_0xd43f('0x78')]),'ChatWebsiteId':Number(_0x2d4e34[_0xd43f('0x61')]['id'])});}});}})[_0xd43f('0x2a')](respondWithStatusCode(_0x52fb8a,null))['catch'](handleError(_0x52fb8a,null));};exports[_0xd43f('0x135')]=function(_0x595980,_0x1af0a4){var _0x22bd32={};var _0x5174ed={};var _0x1bcde4;var _0x2040d8;return db[_0xd43f('0x47')]['findOne']({'where':{'id':_0x595980[_0xd43f('0x61')]['id']}})[_0xd43f('0x2a')](handleEntityNotFound(_0x1af0a4,null))['then'](function(_0xf5f331){if(_0xf5f331){_0x1bcde4=_0xf5f331;_0x5174ed[_0xd43f('0x40')]=_[_0xd43f('0x4c')](db[_0xd43f('0xc6')][_0xd43f('0x48')]);_0x5174ed[_0xd43f('0x4b')]=_[_0xd43f('0x4c')](_0x595980['query']);_0x5174ed['filters']=_['intersection'](_0x5174ed['model'],_0x5174ed[_0xd43f('0x4b')]);_0x22bd32['attributes']=_[_0xd43f('0x4e')](_0x5174ed['model'],qs[_0xd43f('0x4f')](_0x595980[_0xd43f('0x4b')][_0xd43f('0x4f')]));_0x22bd32[_0xd43f('0x50')]=_0x22bd32['attributes'][_0xd43f('0x51')]?_0x22bd32[_0xd43f('0x50')]:_0x5174ed[_0xd43f('0x40')];_0x22bd32['order']=qs[_0xd43f('0x54')](_0x595980[_0xd43f('0x4b')][_0xd43f('0x54')]);_0x22bd32['where']=qs['filters'](_[_0xd43f('0x56')](_0x595980[_0xd43f('0x4b')],_0x5174ed[_0xd43f('0x4d')]));if(_0x595980[_0xd43f('0x4b')][_0xd43f('0x57')]){_0x22bd32[_0xd43f('0x55')]=_[_0xd43f('0x58')](_0x22bd32['where'],{'$or':_[_0xd43f('0x46')](_0x22bd32[_0xd43f('0x50')],function(_0x148b77){var _0x50cc7e={};_0x50cc7e[_0x148b77]={'$like':'%'+_0x595980[_0xd43f('0x4b')]['filter']+'%'};return _0x50cc7e;})});}_0x22bd32=_[_0xd43f('0x58')]({},_0x22bd32,_0x595980['options']);return _0x1bcde4[_0xd43f('0x135')](_0x22bd32);}})['then'](function(_0x36c15e){if(_0x36c15e){_0x2040d8=_0x36c15e[_0xd43f('0x51')];if(!_0x595980[_0xd43f('0x4b')]['hasOwnProperty'](_0xd43f('0x52'))){_0x22bd32['limit']=qs[_0xd43f('0x26')](_0x595980[_0xd43f('0x4b')][_0xd43f('0x26')]);_0x22bd32[_0xd43f('0x24')]=qs[_0xd43f('0x24')](_0x595980[_0xd43f('0x4b')][_0xd43f('0x24')]);}return _0x1bcde4[_0xd43f('0x135')](_0x22bd32);}})[_0xd43f('0x2a')](function(_0x190cc9){if(_0x190cc9){return _0x190cc9?{'count':_0x2040d8,'rows':_0x190cc9}:null;}})[_0xd43f('0x2a')](respondWithResult(_0x1af0a4,null))[_0xd43f('0x5f')](handleError(_0x1af0a4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b952d46..219bf84 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 _0x0689=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x2570e6,_0x3d399a){var _0x3f46ab=function(_0x2ec399){while(--_0x2ec399){_0x2570e6['push'](_0x2570e6['shift']());}};_0x3f46ab(++_0x3d399a);}(_0x0689,0x161));var _0x9068=function(_0x4fe56b,_0x53d094){_0x4fe56b=_0x4fe56b-0x0;var _0x238f05=_0x0689[_0x4fe56b];return _0x238f05;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9068('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9068('0x1')](0x0);var events={'afterCreate':_0x9068('0x2'),'afterUpdate':_0x9068('0x3'),'afterDestroy':_0x9068('0x4')};function emitEvent(_0x44080a){return function(_0x1c35ba,_0x3b12f4,_0x1dbc6f){ChatWebsiteEvents[_0x9068('0x5')](_0x44080a+':'+_0x1c35ba['id'],_0x1c35ba);ChatWebsiteEvents[_0x9068('0x5')](_0x44080a,_0x1c35ba);_0x1dbc6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9068('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x86dd=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x4a12c2,_0x19f176){var _0x297f9f=function(_0x5df143){while(--_0x5df143){_0x4a12c2['push'](_0x4a12c2['shift']());}};_0x297f9f(++_0x19f176);}(_0x86dd,0x1ee));var _0xd86d=function(_0x5b48dc,_0x39c416){_0x5b48dc=_0x5b48dc-0x0;var _0x48031c=_0x86dd[_0x5b48dc];return _0x48031c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xd86d('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd86d('0x1')](0x0);var events={'afterCreate':_0xd86d('0x2'),'afterUpdate':_0xd86d('0x3'),'afterDestroy':_0xd86d('0x4')};function emitEvent(_0x17237d){return function(_0x30a31c,_0x2e82a9,_0x240531){ChatWebsiteEvents[_0xd86d('0x5')](_0x17237d+':'+_0x30a31c['id'],_0x30a31c);ChatWebsiteEvents[_0xd86d('0x5')](_0x17237d,_0x30a31c);_0x240531(null);};}for(var e in events){if(events[_0xd86d('0x6')](e)){var event=events[e];ChatWebsite[_0xd86d('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e9c606f..566bd0e 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 _0xdca0=['exports','define','chat_websites','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x404c35,_0xedfe89){var _0x28c900=function(_0x2dc0ab){while(--_0x2dc0ab){_0x404c35['push'](_0x404c35['shift']());}};_0x28c900(++_0xedfe89);}(_0xdca0,0x8f));var _0x0dca=function(_0xfd7b8,_0x4b30c4){_0xfd7b8=_0xfd7b8-0x0;var _0x494707=_0xdca0[_0xfd7b8];return _0x494707;};'use strict';var _=require('lodash');var util=require(_0x0dca('0x0'));var logger=require(_0x0dca('0x1'))('api');var moment=require(_0x0dca('0x2'));var BPromise=require(_0x0dca('0x3'));var rp=require(_0x0dca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dca('0x5'));var config=require(_0x0dca('0x6'));var attributes=require('./chatWebsite.attributes');module[_0x0dca('0x7')]=function(_0xc8c62b,_0x3c3fb7){return _0xc8c62b[_0x0dca('0x8')]('ChatWebsite',attributes,{'tableName':_0x0dca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf2b=['chat_websites','lodash','api','moment','request-promise','path','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x5dfb25,_0x31f4bd){var _0x3c16f7=function(_0x2cbc6b){while(--_0x2cbc6b){_0x5dfb25['push'](_0x5dfb25['shift']());}};_0x3c16f7(++_0x31f4bd);}(_0xbf2b,0xc7));var _0xbbf2=function(_0x59bd24,_0xdde327){_0x59bd24=_0x59bd24-0x0;var _0x41384a=_0xbf2b[_0x59bd24];return _0x41384a;};'use strict';var _=require(_0xbbf2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbbf2('0x1'));var moment=require(_0xbbf2('0x2'));var BPromise=require('bluebird');var rp=require(_0xbbf2('0x3'));var fs=require('fs');var path=require(_0xbbf2('0x4'));var rimraf=require('rimraf');var config=require(_0xbbf2('0x5'));var attributes=require(_0xbbf2('0x6'));module[_0xbbf2('0x7')]=function(_0x453847,_0x1de326){return _0x453847['define']('ChatWebsite',attributes,{'tableName':_0xbbf2('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index dd4f84f..2e6f1d7 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 _0xc748=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xc748,0xb4));var _0x8c74=function(_0x28e71a,_0x4405bd){_0x28e71a=_0x28e71a-0x0;var _0x268fed=_0xc748[_0x28e71a];return _0x268fed;};'use strict';var _=require(_0x8c74('0x0'));var util=require(_0x8c74('0x1'));var moment=require(_0x8c74('0x2'));var BPromise=require(_0x8c74('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c74('0x4'));var db=require(_0x8c74('0x5'))['db'];var utils=require(_0x8c74('0x6'));var logger=require(_0x8c74('0x7'))(_0x8c74('0x8'));var config=require(_0x8c74('0x9'));var jayson=require(_0x8c74('0xa'));var client=jayson['client'][_0x8c74('0xb')]({'port':0x232a});config[_0x8c74('0xc')]=_[_0x8c74('0xd')](config[_0x8c74('0xc')],{'host':_0x8c74('0xe'),'port':0x18eb});var socket=require(_0x8c74('0xf'))(new Redis(config[_0x8c74('0xc')]));require('./chatWebsite.socket')[_0x8c74('0x10')](socket);function respondWithRpcPromise(_0x5bfdd0,_0x108784,_0x4dacbe){return new BPromise(function(_0x11001f,_0x81b801){return client[_0x8c74('0x11')](_0x5bfdd0,_0x4dacbe)[_0x8c74('0x12')](function(_0x144c9b){logger[_0x8c74('0x13')](_0x8c74('0x14'),_0x108784,_0x8c74('0x15'));logger[_0x8c74('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x108784,'request\x20sent',JSON[_0x8c74('0x17')](_0x144c9b));if(_0x144c9b[_0x8c74('0x18')]){if(_0x144c9b[_0x8c74('0x18')][_0x8c74('0x19')]===0x1f4){logger[_0x8c74('0x18')](_0x8c74('0x14'),_0x108784,_0x144c9b['error'][_0x8c74('0x1a')]);return _0x81b801(_0x144c9b[_0x8c74('0x18')]['message']);}logger[_0x8c74('0x18')](_0x8c74('0x14'),_0x108784,_0x144c9b[_0x8c74('0x18')][_0x8c74('0x1a')]);return _0x11001f(_0x144c9b[_0x8c74('0x18')]['message']);}else{logger['info'](_0x8c74('0x14'),_0x108784,_0x8c74('0x15'));_0x11001f(_0x144c9b[_0x8c74('0x1b')][_0x8c74('0x1a')]);}})[_0x8c74('0x1c')](function(_0x203b5e){logger[_0x8c74('0x18')](_0x8c74('0x14'),_0x108784,_0x203b5e);_0x81b801(_0x203b5e);});});} \ No newline at end of file +var _0x2916=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c166f,_0xa0dbc4){var _0x5cbaeb=function(_0x5a1af0){while(--_0x5a1af0){_0x3c166f['push'](_0x3c166f['shift']());}};_0x5cbaeb(++_0xa0dbc4);}(_0x2916,0xac));var _0x6291=function(_0x308ddd,_0x3a8401){_0x308ddd=_0x308ddd-0x0;var _0x3224c3=_0x2916[_0x308ddd];return _0x3224c3;};'use strict';var _=require(_0x6291('0x0'));var util=require(_0x6291('0x1'));var moment=require(_0x6291('0x2'));var BPromise=require('bluebird');var rs=require(_0x6291('0x3'));var fs=require('fs');var Redis=require(_0x6291('0x4'));var db=require(_0x6291('0x5'))['db'];var utils=require(_0x6291('0x6'));var logger=require(_0x6291('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6291('0x8'));var client=jayson[_0x6291('0x9')][_0x6291('0xa')]({'port':0x232a});config['redis']=_[_0x6291('0xb')](config[_0x6291('0xc')],{'host':_0x6291('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6291('0xc')]));require(_0x6291('0xe'))[_0x6291('0xf')](socket);function respondWithRpcPromise(_0x47dc8b,_0x550ef2,_0x6fef8d){return new BPromise(function(_0x3c9bb2,_0x786721){return client['request'](_0x47dc8b,_0x6fef8d)[_0x6291('0x10')](function(_0x5eeec6){logger[_0x6291('0x11')](_0x6291('0x12'),_0x550ef2,_0x6291('0x13'));logger[_0x6291('0x14')](_0x6291('0x15'),_0x550ef2,_0x6291('0x13'),JSON[_0x6291('0x16')](_0x5eeec6));if(_0x5eeec6[_0x6291('0x17')]){if(_0x5eeec6['error'][_0x6291('0x18')]===0x1f4){logger[_0x6291('0x17')](_0x6291('0x12'),_0x550ef2,_0x5eeec6[_0x6291('0x17')]['message']);return _0x786721(_0x5eeec6[_0x6291('0x17')][_0x6291('0x19')]);}logger[_0x6291('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x550ef2,_0x5eeec6[_0x6291('0x17')][_0x6291('0x19')]);return _0x3c9bb2(_0x5eeec6[_0x6291('0x17')][_0x6291('0x19')]);}else{logger[_0x6291('0x11')](_0x6291('0x12'),_0x550ef2,_0x6291('0x13'));_0x3c9bb2(_0x5eeec6[_0x6291('0x1a')][_0x6291('0x19')]);}})[_0x6291('0x1b')](function(_0xf431d7){logger[_0x6291('0x17')](_0x6291('0x12'),_0x550ef2,_0xf431d7);_0x786721(_0xf431d7);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d47c9ad..feaa03b 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 _0x061c=['removeListener','length','chatWebsite:','./chatWebsite.events','remove','update','emit'];(function(_0x1ddbe1,_0x33f473){var _0x258a44=function(_0x1d5708){while(--_0x1d5708){_0x1ddbe1['push'](_0x1ddbe1['shift']());}};_0x258a44(++_0x33f473);}(_0x061c,0x129));var _0xc061=function(_0x5ba3e2,_0x103d09){_0x5ba3e2=_0x5ba3e2-0x0;var _0x525a34=_0x061c[_0x5ba3e2];return _0x525a34;};'use strict';var ChatWebsiteEvents=require(_0xc061('0x0'));var events=['save',_0xc061('0x1'),_0xc061('0x2')];function createListener(_0x4ea4ad,_0x40ca4f){return function(_0x2ce170){_0x40ca4f[_0xc061('0x3')](_0x4ea4ad,_0x2ce170);};}function removeListener(_0x332781,_0xca3780){return function(){ChatWebsiteEvents[_0xc061('0x4')](_0x332781,_0xca3780);};}exports['register']=function(_0x2d36b8){for(var _0x1df1db=0x0,_0x1c8f77=events[_0xc061('0x5')];_0x1df1db<_0x1c8f77;_0x1df1db++){var _0x5c86a7=events[_0x1df1db];var _0xda04f1=createListener(_0xc061('0x6')+_0x5c86a7,_0x2d36b8);ChatWebsiteEvents['on'](_0x5c86a7,_0xda04f1);}}; \ No newline at end of file +var _0xc47e=['register','length','chatWebsite:','./chatWebsite.events','remove','update','emit','removeListener'];(function(_0x16a9ea,_0x5ace14){var _0x550439=function(_0x33506b){while(--_0x33506b){_0x16a9ea['push'](_0x16a9ea['shift']());}};_0x550439(++_0x5ace14);}(_0xc47e,0x12b));var _0xec47=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0xc47e[_0x3a7a9c];return _0x59156e;};'use strict';var ChatWebsiteEvents=require(_0xec47('0x0'));var events=['save',_0xec47('0x1'),_0xec47('0x2')];function createListener(_0x14372f,_0x396843){return function(_0x1849fb){_0x396843[_0xec47('0x3')](_0x14372f,_0x1849fb);};}function removeListener(_0x439bae,_0x387d60){return function(){ChatWebsiteEvents[_0xec47('0x4')](_0x439bae,_0x387d60);};}exports[_0xec47('0x5')]=function(_0xc2527){for(var _0x460ba6=0x0,_0x4ed49c=events[_0xec47('0x6')];_0x460ba6<_0x4ed49c;_0x460ba6++){var _0x52e164=events[_0x460ba6];var _0x5a89c7=createListener(_0xec47('0x7')+_0x52e164,_0xc2527);ChatWebsiteEvents['on'](_0x52e164,_0x5a89c7);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 27bfdf7..b809393 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc0f9=['URL','localhost','test','trim','replace','([\x5cw]+)','exports','../../../utils/misc','escapeRegExp','url'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0xc0f9[_0x230951];return _0xeb26b1;};var escapeRegExp=require(_0x9c0f('0x0'))[_0x9c0f('0x1')];var URL=require(_0x9c0f('0x2'))[_0x9c0f('0x3')];function testWildcardValidity(_0x3c3a7b){var _0x2758cc=!![];try{new URL(_0x3c3a7b['replace']('*',_0x9c0f('0x4')));}catch(_0x273940){_0x2758cc=![];}return _0x2758cc&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x9c0f('0x5')](_0x3c3a7b);}function testWebsiteWithWildcard(_0x54b878,_0xbd7698){var _0x18f28e;var _0x2eab65=escapeRegExp(_0x54b878[_0x9c0f('0x6')]()['replace'](/\/$/,''))[_0x9c0f('0x7')]('\x5c*',_0x9c0f('0x8'));try{new URL(_0x54b878[_0x9c0f('0x7')]('\x5c*',_0x9c0f('0x4')));_0x18f28e=new RegExp(_0x2eab65)['test'](_0xbd7698);}catch(_0x9aa0b){_0x18f28e=![];}return _0x18f28e;}module[_0x9c0f('0x9')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x09df=['test','trim','([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','URL','replace'];(function(_0x3e4a3f,_0x3c2f2a){var _0x130e52=function(_0x5bd122){while(--_0x5bd122){_0x3e4a3f['push'](_0x3e4a3f['shift']());}};_0x130e52(++_0x3c2f2a);}(_0x09df,0x164));var _0xf09d=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x09df[_0x3511d3];return _0x5d6321;};var escapeRegExp=require(_0xf09d('0x0'))[_0xf09d('0x1')];var URL=require('url')[_0xf09d('0x2')];function testWildcardValidity(_0x55478e){var _0x5bbc52=!![];try{new URL(_0x55478e[_0xf09d('0x3')]('*','localhost'));}catch(_0x4b4911){_0x5bbc52=![];}return _0x5bbc52&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xf09d('0x4')](_0x55478e);}function testWebsiteWithWildcard(_0x436673,_0x4df47c){var _0x4db4e7;var _0x4b452b=escapeRegExp(_0x436673[_0xf09d('0x5')]()['replace'](/\/$/,''))[_0xf09d('0x3')]('\x5c*',_0xf09d('0x6'));try{new URL(_0x436673[_0xf09d('0x3')]('\x5c*',_0xf09d('0x7')));_0x4db4e7=new RegExp(_0x4b452b)[_0xf09d('0x4')](_0x4df47c);}catch(_0x2a59a8){_0x4db4e7=![];}return _0x4db4e7;}module[_0xf09d('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 82db6d4..fb61c27 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 _0xb02a=['fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','now','single','addAvatar','addCustomerAvatar','server/files/images/avatars/','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb02a,0x1dd));var _0xab02=function(_0x54232b,_0xce2a16){_0x54232b=_0x54232b-0x0;var _0x3898b3=_0xb02a[_0x54232b];return _0x3898b3;};'use strict';var multer=require(_0xab02('0x0'));var util=require(_0xab02('0x1'));var path=require(_0xab02('0x2'));var timeout=require(_0xab02('0x3'));var express=require(_0xab02('0x4'));var router=express[_0xab02('0x5')]();var fs_extra=require(_0xab02('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xab02('0x7'));var config=require(_0xab02('0x8'));var controller=require(_0xab02('0x9'));router[_0xab02('0xa')]('/',auth[_0xab02('0xb')](),controller['index']);router[_0xab02('0xa')](_0xab02('0xc'),auth['isAuthenticated'](),controller[_0xab02('0xd')]);router[_0xab02('0xa')](_0xab02('0xe'),auth[_0xab02('0xb')](),controller['show']);router[_0xab02('0xa')](_0xab02('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0xab02('0x10'),auth[_0xab02('0xb')](),controller[_0xab02('0x11')]);router[_0xab02('0xa')](_0xab02('0x12'),controller[_0xab02('0x13')]);router['get'](_0xab02('0x14'),controller[_0xab02('0x15')]);router['get'](_0xab02('0x16'),controller[_0xab02('0x17')]);router[_0xab02('0xa')]('/:id/system_avatar',controller[_0xab02('0x18')]);router[_0xab02('0xa')](_0xab02('0x19'),auth[_0xab02('0xb')](),controller[_0xab02('0x1a')]);router[_0xab02('0xa')](_0xab02('0x1b'),controller['getSnippet']);router['get'](_0xab02('0x1c'),auth[_0xab02('0xb')](),controller['getApplications']);router['get'](_0xab02('0x1d'),auth[_0xab02('0xb')](),controller['getProactiveActions']);router[_0xab02('0xa')](_0xab02('0x1e'),controller['getFields']);router[_0xab02('0xa')](_0xab02('0x1f'),auth[_0xab02('0xb')](),controller['getOfflineMessages']);router[_0xab02('0xa')](_0xab02('0x20'),auth[_0xab02('0xb')](),controller[_0xab02('0x21')]);router[_0xab02('0x22')]('/',auth[_0xab02('0xb')](),controller['create']);router[_0xab02('0x22')](_0xab02('0xf'),auth[_0xab02('0xb')](),controller[_0xab02('0x23')]);router[_0xab02('0x22')](_0xab02('0x10'),auth[_0xab02('0xb')](),controller[_0xab02('0x24')]);var upload=multer({'storage':multer[_0xab02('0x25')]({'destination':function(_0x6557e1,_0x559bc9,_0x1ad493){_0x1ad493(null,path[_0xab02('0x26')](config[_0xab02('0x27')],_0xab02('0x28')));},'filename':function(_0x2acbaf,_0x47f870,_0x540664){_0x540664(null,util[_0xab02('0x29')](_0xab02('0x2a'),Date['now'](),_0x47f870[_0xab02('0x2b')]));}})});router[_0xab02('0x22')](_0xab02('0x12'),upload['single'](_0xab02('0x2c')),controller[_0xab02('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5aea11,_0x48b4ae,_0x55ff8c){_0x55ff8c(null,path['join'](config[_0xab02('0x27')],'server/files/images/avatars/'));},'filename':function(_0x542913,_0x3d38a6,_0x3e5fa5){_0x3e5fa5(null,util[_0xab02('0x29')](_0xab02('0x2a'),Date[_0xab02('0x2e')](),_0x3d38a6[_0xab02('0x2b')]));}})});router['post']('/:id/avatar',upload[_0xab02('0x2f')]('file'),controller[_0xab02('0x30')]);var upload=multer({'storage':multer[_0xab02('0x25')]({'destination':function(_0x44830c,_0x371ee8,_0x5050fb){_0x5050fb(null,path[_0xab02('0x26')](config[_0xab02('0x27')],'server/files/images/avatars/'));},'filename':function(_0x4d0531,_0xf3f6ab,_0x16741c){_0x16741c(null,util[_0xab02('0x29')](_0xab02('0x2a'),Date[_0xab02('0x2e')](),_0xf3f6ab['originalname']));}})});router[_0xab02('0x22')](_0xab02('0x16'),upload[_0xab02('0x2f')]('file'),controller[_0xab02('0x31')]);var upload=multer({'storage':multer[_0xab02('0x25')]({'destination':function(_0x4ae417,_0x684d72,_0x1cc0df){_0x1cc0df(null,path[_0xab02('0x26')](config[_0xab02('0x27')],_0xab02('0x32')));},'filename':function(_0x1a2c2c,_0x4be853,_0x57ae32){_0x57ae32(null,util['format']('%s-%s',Date[_0xab02('0x2e')](),_0x4be853[_0xab02('0x2b')]));}})});router[_0xab02('0x22')]('/:id/system_avatar',upload[_0xab02('0x2f')](_0xab02('0x2c')),controller['addSystemAvatar']);router[_0xab02('0x22')](_0xab02('0x33'),controller[_0xab02('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0xab02('0x25')]({'destination':function(_0x2f4914,_0x2b20ca,_0x15d786){const _0x4fa44f=path['join'](config[_0xab02('0x27')],_0xab02('0x35'),_0xab02('0x36'),'offline-chat');fs_extra[_0xab02('0x37')](_0x4fa44f,function(){_0x15d786(null,_0x4fa44f);});},'filename':function(_0x3354ec,_0x452d56,_0x37b08d){const _0x534f28=_0x452d56[_0xab02('0x2b')][_0xab02('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x268797=path[_0xab02('0x39')](_0x534f28);const _0x1d74e0=Date[_0xab02('0x2e')]()+'-'+_0x534f28['replace'](_0x268797,'')+_0x268797;_0x37b08d(null,_0x1d74e0);}})});router['post'](_0xab02('0x3a'),offlineUploadMulter['any'](),controller['offline']);router[_0xab02('0x22')](_0xab02('0x19'),auth['isAuthenticated'](),controller[_0xab02('0x3b')]);router[_0xab02('0x22')](_0xab02('0x1c'),auth[_0xab02('0xb')](),controller[_0xab02('0x3c')]);router[_0xab02('0x22')](_0xab02('0x1d'),auth['isAuthenticated'](),controller[_0xab02('0x3d')]);router['post'](_0xab02('0x20'),auth[_0xab02('0xb')](),controller[_0xab02('0x3e')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xab02('0x3f')]);router[_0xab02('0x40')](_0xab02('0xe'),auth[_0xab02('0xb')](),controller[_0xab02('0x41')]);router[_0xab02('0x40')](_0xab02('0xf'),auth[_0xab02('0xb')](),controller[_0xab02('0x42')]);router[_0xab02('0x40')](_0xab02('0x10'),auth[_0xab02('0xb')](),controller['removeAnswers']);router[_0xab02('0x40')](_0xab02('0x20'),auth[_0xab02('0xb')](),controller[_0xab02('0x43')]);module[_0xab02('0x44')]=router; \ No newline at end of file +var _0x85c2=['attachments','offline-chat','ensureDir','replace','extname','offline','addInteraction','addApplications','addAgents','put','/:id','update','delete','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getDispositions','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','server/files/images/logos/','now','originalname','server/files/images/avatars/','format','%s-%s','/:id/avatar','file','addAvatar','single','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x85c2,0x1b4));var _0x285c=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x85c2[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0x285c('0x0'));var util=require(_0x285c('0x1'));var path=require(_0x285c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x285c('0x3')]();var fs_extra=require(_0x285c('0x4'));var auth=require(_0x285c('0x5'));var interaction=require(_0x285c('0x6'));var config=require(_0x285c('0x7'));var controller=require('./chatWebsite.controller');router[_0x285c('0x8')]('/',auth[_0x285c('0x9')](),controller[_0x285c('0xa')]);router[_0x285c('0x8')](_0x285c('0xb'),auth[_0x285c('0x9')](),controller[_0x285c('0xc')]);router[_0x285c('0x8')]('/:id',auth[_0x285c('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0x285c('0x9')](),controller[_0x285c('0xd')]);router[_0x285c('0x8')]('/:id/canned_answers',auth[_0x285c('0x9')](),controller['getAnswers']);router[_0x285c('0x8')](_0x285c('0xe'),controller[_0x285c('0xf')]);router[_0x285c('0x8')]('/:id/avatar',controller['getAvatar']);router[_0x285c('0x8')](_0x285c('0x10'),controller[_0x285c('0x11')]);router[_0x285c('0x8')](_0x285c('0x12'),controller[_0x285c('0x13')]);router[_0x285c('0x8')](_0x285c('0x14'),auth[_0x285c('0x9')](),controller[_0x285c('0x15')]);router[_0x285c('0x8')](_0x285c('0x16'),controller['getSnippet']);router[_0x285c('0x8')](_0x285c('0x17'),auth[_0x285c('0x9')](),controller[_0x285c('0x18')]);router['get'](_0x285c('0x19'),auth[_0x285c('0x9')](),controller[_0x285c('0x1a')]);router['get'](_0x285c('0x1b'),controller[_0x285c('0x1c')]);router['get'](_0x285c('0x1d'),auth['isAuthenticated'](),controller[_0x285c('0x1e')]);router['get'](_0x285c('0x1f'),auth[_0x285c('0x9')](),controller[_0x285c('0x20')]);router[_0x285c('0x21')]('/',auth[_0x285c('0x9')](),controller[_0x285c('0x22')]);router[_0x285c('0x21')](_0x285c('0x23'),auth[_0x285c('0x9')](),controller['addDisposition']);router[_0x285c('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x285c('0x24')]);var upload=multer({'storage':multer[_0x285c('0x25')]({'destination':function(_0x1099b7,_0x1a3e5f,_0x96d052){_0x96d052(null,path[_0x285c('0x26')](config[_0x285c('0x27')],_0x285c('0x28')));},'filename':function(_0x15b2a3,_0xa927a8,_0x29b038){_0x29b038(null,util['format']('%s-%s',Date[_0x285c('0x29')](),_0xa927a8[_0x285c('0x2a')]));}})});router['post'](_0x285c('0xe'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x285c('0x25')]({'destination':function(_0x14c802,_0x413ccb,_0x22ba23){_0x22ba23(null,path['join'](config['root'],_0x285c('0x2b')));},'filename':function(_0x149d95,_0x17a06d,_0x56f7fd){_0x56f7fd(null,util[_0x285c('0x2c')](_0x285c('0x2d'),Date[_0x285c('0x29')](),_0x17a06d[_0x285c('0x2a')]));}})});router[_0x285c('0x21')](_0x285c('0x2e'),upload['single'](_0x285c('0x2f')),controller[_0x285c('0x30')]);var upload=multer({'storage':multer[_0x285c('0x25')]({'destination':function(_0x594534,_0x3311d5,_0x3de0c4){_0x3de0c4(null,path[_0x285c('0x26')](config[_0x285c('0x27')],'server/files/images/avatars/'));},'filename':function(_0x5d5769,_0x2275c5,_0x18641f){_0x18641f(null,util['format'](_0x285c('0x2d'),Date[_0x285c('0x29')](),_0x2275c5['originalname']));}})});router['post'](_0x285c('0x10'),upload[_0x285c('0x31')](_0x285c('0x2f')),controller[_0x285c('0x32')]);var upload=multer({'storage':multer[_0x285c('0x25')]({'destination':function(_0x238429,_0x5a30e3,_0x21518f){_0x21518f(null,path[_0x285c('0x26')](config[_0x285c('0x27')],_0x285c('0x2b')));},'filename':function(_0x34a752,_0x57683c,_0x66048e){_0x66048e(null,util[_0x285c('0x2c')](_0x285c('0x2d'),Date[_0x285c('0x29')](),_0x57683c[_0x285c('0x2a')]));}})});router[_0x285c('0x21')]('/:id/system_avatar',upload[_0x285c('0x31')](_0x285c('0x2f')),controller[_0x285c('0x33')]);router[_0x285c('0x21')](_0x285c('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x285c('0x25')]({'destination':function(_0x54e831,_0x217fd4,_0x43c755){const _0x1c3590=path['join'](config[_0x285c('0x27')],_0x285c('0x35'),_0x285c('0x36'),_0x285c('0x37'));fs_extra[_0x285c('0x38')](_0x1c3590,function(){_0x43c755(null,_0x1c3590);});},'filename':function(_0xa68a0f,_0x2cfbbe,_0x28b885){const _0x4dc70a=_0x2cfbbe['originalname'][_0x285c('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2b3db9=path[_0x285c('0x3a')](_0x4dc70a);const _0x4f9ae8=Date[_0x285c('0x29')]()+'-'+_0x4dc70a['replace'](_0x2b3db9,'')+_0x2b3db9;_0x28b885(null,_0x4f9ae8);}})});router['post']('/:id/offline',offlineUploadMulter['any'](),controller[_0x285c('0x3b')]);router[_0x285c('0x21')](_0x285c('0x14'),auth['isAuthenticated'](),controller[_0x285c('0x3c')]);router[_0x285c('0x21')]('/:id/applications',auth[_0x285c('0x9')](),controller[_0x285c('0x3d')]);router[_0x285c('0x21')]('/:id/proactive_actions',auth[_0x285c('0x9')](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x285c('0x9')](),controller[_0x285c('0x3e')]);router[_0x285c('0x3f')](_0x285c('0x40'),auth[_0x285c('0x9')](),controller[_0x285c('0x41')]);router[_0x285c('0x42')](_0x285c('0x40'),auth[_0x285c('0x9')](),controller['destroy']);router[_0x285c('0x42')]('/:id/dispositions',auth[_0x285c('0x9')](),controller['removeDispositions']);router[_0x285c('0x42')]('/:id/canned_answers',auth[_0x285c('0x9')](),controller[_0x285c('0x43')]);router['delete'](_0x285c('0x1f'),auth[_0x285c('0x9')](),controller[_0x285c('0x44')]);module[_0x285c('0x45')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index fdc7cea..65964a3 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 _0x901d=['isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','app','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use'];(function(_0x3e5826,_0x394775){var _0x31688d=function(_0xee649e){while(--_0xee649e){_0x3e5826['push'](_0x3e5826['shift']());}};_0x31688d(++_0x394775);}(_0x901d,0x15e));var _0xd901=function(_0x17c07d,_0x3b5165){_0x17c07d=_0x17c07d-0x0;var _0x9b2638=_0x901d[_0x17c07d];return _0x9b2638;};var beaverLogger=require(_0xd901('0x0'));var express=require(_0xd901('0x1'));var auth=require('../components/auth/service');var config=require(_0xd901('0x2'));var router=express[_0xd901('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x40d26a,_0x391a7d,_0x37a8d4){var _0x5df34d=_0x40d26a[_0xd901('0x4')][_0xd901('0x5')]('client-side-logger');if(!_0x5df34d){throw new Error(_0xd901('0x6'));}return beaverLogger[_0xd901('0x7')]({'uri':_0xd901('0x8'),'logger':_0x5df34d,'enableCors':!isProduction})(_0x40d26a,_0x391a7d,_0x37a8d4);}router[_0xd901('0x9')](auth[_0xd901('0xa')](),clientSideLogs);module[_0xd901('0xb')]=router; \ No newline at end of file +var _0x0ac6=['production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','Router','env'];(function(_0x53e25c,_0x5a668a){var _0x5dbc9b=function(_0x5f5848){while(--_0x5f5848){_0x53e25c['push'](_0x53e25c['shift']());}};_0x5dbc9b(++_0x5a668a);}(_0x0ac6,0x14c));var _0x60ac=function(_0x32d015,_0x2bd009){_0x32d015=_0x32d015-0x0;var _0x17ceee=_0x0ac6[_0x32d015];return _0x17ceee;};var beaverLogger=require(_0x60ac('0x0'));var express=require('express');var auth=require(_0x60ac('0x1'));var config=require('../config/environment');var router=express[_0x60ac('0x2')]();var isProduction=config[_0x60ac('0x3')]===_0x60ac('0x4')||![];function clientSideLogs(_0x4c4996,_0x27ac7b,_0x25c8f6){var _0x51bc54=_0x4c4996[_0x60ac('0x5')][_0x60ac('0x6')](_0x60ac('0x7'));if(!_0x51bc54){throw new Error(_0x60ac('0x8'));}return beaverLogger[_0x60ac('0x9')]({'uri':_0x60ac('0xa'),'logger':_0x51bc54,'enableCors':!isProduction})(_0x4c4996,_0x27ac7b,_0x25c8f6);}router[_0x60ac('0xb')](auth[_0x60ac('0xc')](),clientSideLogs);module[_0x60ac('0xd')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f300375..df8052f 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 _0xb18a=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','exports','ENUM','AmazonAWS','Google','Outlook365','Dynamics365','STRING'];(function(_0x54391f,_0x3cdbee){var _0x4b0e52=function(_0x4b1008){while(--_0x4b1008){_0x54391f['push'](_0x54391f['shift']());}};_0x4b0e52(++_0x3cdbee);}(_0xb18a,0x1f1));var _0xab18=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb18a[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xab18('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xab18('0x1')](_0xab18('0x2'),_0xab18('0x3'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xab18('0x4'),_0xab18('0x5'))},'data1':{'type':Sequelize[_0xab18('0x6')],'comment':_0xab18('0x7')},'data2':{'type':Sequelize[_0xab18('0x6')],'comment':_0xab18('0x8')},'data3':{'type':Sequelize[_0xab18('0x6')],'comment':_0xab18('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0xab18('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xab18('0xb')},'data6':{'type':Sequelize[_0xab18('0xc')],'comment':_0xab18('0xd')},'data7':{'type':Sequelize[_0xab18('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0xe02c=['MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365'];(function(_0x14a83a,_0x54500b){var _0x474b3d=function(_0x252db6){while(--_0x252db6){_0x14a83a['push'](_0x14a83a['shift']());}};_0x474b3d(++_0x54500b);}(_0xe02c,0x143));var _0xce02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe02c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xce02('0x0'));module['exports']={'name':{'type':Sequelize[_0xce02('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xce02('0x2')](_0xce02('0x3'),_0xce02('0x4'),_0xce02('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xce02('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0xce02('0x1')],'comment':_0xce02('0x7')},'data2':{'type':Sequelize[_0xce02('0x1')],'comment':_0xce02('0x8')},'data3':{'type':Sequelize[_0xce02('0x1')],'comment':_0xce02('0x9')},'data4':{'type':Sequelize[_0xce02('0x1')],'comment':_0xce02('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xce02('0xb')},'data6':{'type':Sequelize[_0xce02('0xc')],'comment':_0xce02('0xd')},'data7':{'type':Sequelize[_0xce02('0xc')],'comment':_0xce02('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 16706a7..85b2a36 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 _0x34f6=['refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','name','send','padEnd','slice','index','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CloudProvider','includeAll','include','rows','service','decryptString','data3','catch','show','params','find','MicrosoftAzure','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','base64','ascii','isValidIdToken','id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token'];(function(_0x21e034,_0x59fc14){var _0x1faab3=function(_0x2bd3ba){while(--_0x2bd3ba){_0x21e034['push'](_0x21e034['shift']());}};_0x1faab3(++_0x59fc14);}(_0x34f6,0xc4));var _0x634f=function(_0x286731,_0x116916){_0x286731=_0x286731-0x0;var _0x50f5a5=_0x34f6[_0x286731];return _0x50f5a5;};'use strict';var _=require('lodash');var Redis=require(_0x634f('0x0'));var qs=require(_0x634f('0x1'));var encryptor=require(_0x634f('0x2'));var config=require(_0x634f('0x3'));var logger=require(_0x634f('0x4'))(_0x634f('0x5'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0x634f('0x6')]=_[_0x634f('0x7')](config[_0x634f('0x6')],{'host':_0x634f('0x8'),'port':0x18eb});var socket=require(_0x634f('0x9'))(new Redis(config['redis']));var redis=new Redis(config[_0x634f('0x6')]);function respondWithStatusCode(_0x49fbbf,_0x4dce18){_0x4dce18=_0x4dce18||0xcc;return function(_0x2f4472){if(_0x2f4472){return _0x49fbbf[_0x634f('0xa')](_0x4dce18);}return _0x49fbbf[_0x634f('0xb')](_0x4dce18)[_0x634f('0xc')]();};}function respondWithResult(_0x316b1e,_0x5457bc){_0x5457bc=_0x5457bc||0xc8;return function(_0x11fe8b){if(_0x11fe8b){return _0x316b1e[_0x634f('0xb')](_0x5457bc)[_0x634f('0xd')](_0x11fe8b);}};}function respondWithFilteredResult(_0x53446d,_0x1d77fb){return function(_0x5a6c61){if(_0x5a6c61){var _0x46f0e=typeof _0x1d77fb[_0x634f('0xe')]===_0x634f('0xf')&&typeof _0x1d77fb[_0x634f('0x10')]===_0x634f('0xf');var _0x4d9d9b=_0x5a6c61['count'];var _0xf6d949=_0x46f0e?0x0:_0x1d77fb[_0x634f('0xe')];var _0x423172=_0x46f0e?_0x5a6c61[_0x634f('0x11')]:_0x1d77fb[_0x634f('0xe')]+_0x1d77fb['limit'];var _0x36f3b8;if(_0x423172>=_0x4d9d9b){_0x423172=_0x4d9d9b;_0x36f3b8=0xc8;}else{_0x36f3b8=0xce;}_0x53446d[_0x634f('0xb')](_0x36f3b8);return _0x53446d[_0x634f('0x12')](_0x634f('0x13'),_0xf6d949+'-'+_0x423172+'/'+_0x4d9d9b)[_0x634f('0xd')](_0x5a6c61);}return null;};}function saveUpdates(_0x2e02b4){return function(_0x56f188){if(_0x56f188){return _0x56f188[_0x634f('0x14')](_0x2e02b4)['then'](function(_0x295e77){return _0x295e77;});}return null;};}function removeEntity(_0x3a4b31){return function(_0x5afe41){if(_0x5afe41){return _0x5afe41[_0x634f('0x15')]()[_0x634f('0x16')](function(){_0x3a4b31[_0x634f('0xb')](0xcc)[_0x634f('0xc')]();});}};}function handleEntityNotFound(_0x3a9393){return function(_0x491202){if(!_0x491202){_0x3a9393[_0x634f('0xa')](0x194);}return _0x491202;};}function handleError(_0x5eb05,_0x5b4f18){_0x5b4f18=_0x5b4f18||0x1f4;return function(_0x316bd7){logger['error'](_0x316bd7['stack']);if(_0x316bd7[_0x634f('0x17')]){delete _0x316bd7['name'];}_0x5eb05[_0x634f('0xb')](_0x5b4f18)[_0x634f('0x18')](_0x316bd7);};}function maskClientSecret(_0x12eea4){return _[_0x634f('0x19')](_0x12eea4[_0x634f('0x1a')](0x0,0x3),0x14,'*');}exports[_0x634f('0x1b')]=function(_0x31c5c8,_0x2a16c9){var _0x38ded2={},_0x297c0b={},_0xe39327={'count':0x0,'rows':[]};var _0x5b414d=_['map'](db['CloudProvider'][_0x634f('0x1c')],function(_0x428656){return{'name':_0x428656[_0x634f('0x1d')],'type':_0x428656[_0x634f('0x1e')]['key']};});_0x297c0b[_0x634f('0x1f')]=_[_0x634f('0x20')](_0x5b414d,_0x634f('0x17'));_0x297c0b[_0x634f('0x21')]=_[_0x634f('0x22')](_0x31c5c8[_0x634f('0x21')]);_0x297c0b['filters']=_['intersection'](_0x297c0b[_0x634f('0x1f')],_0x297c0b[_0x634f('0x21')]);_0x38ded2[_0x634f('0x23')]=_[_0x634f('0x24')](_0x297c0b[_0x634f('0x1f')],qs[_0x634f('0x25')](_0x31c5c8[_0x634f('0x21')][_0x634f('0x25')]));_0x38ded2[_0x634f('0x23')]=_0x38ded2[_0x634f('0x23')][_0x634f('0x26')]?_0x38ded2[_0x634f('0x23')]:_0x297c0b[_0x634f('0x1f')];if(!_0x31c5c8[_0x634f('0x21')][_0x634f('0x27')](_0x634f('0x28'))){_0x38ded2[_0x634f('0x10')]=qs[_0x634f('0x10')](_0x31c5c8[_0x634f('0x21')][_0x634f('0x10')]);_0x38ded2[_0x634f('0xe')]=qs[_0x634f('0xe')](_0x31c5c8[_0x634f('0x21')][_0x634f('0xe')]);}_0x38ded2[_0x634f('0x29')]=qs[_0x634f('0x2a')](_0x31c5c8[_0x634f('0x21')][_0x634f('0x2a')]);_0x38ded2[_0x634f('0x2b')]=qs[_0x634f('0x2c')](_[_0x634f('0x2d')](_0x31c5c8[_0x634f('0x21')],_0x297c0b[_0x634f('0x2c')]),_0x5b414d);if(_0x31c5c8[_0x634f('0x21')][_0x634f('0x2e')]){_0x38ded2[_0x634f('0x2b')]=_[_0x634f('0x2f')](_0x38ded2[_0x634f('0x2b')],{'$or':_[_0x634f('0x20')](_0x5b414d,function(_0x4849c3){if(_0x4849c3['type']!==_0x634f('0x30')){var _0x4574f8={};_0x4574f8[_0x4849c3[_0x634f('0x17')]]={'$like':'%'+_0x31c5c8[_0x634f('0x21')][_0x634f('0x2e')]+'%'};return _0x4574f8;}})});}_0x38ded2=_[_0x634f('0x2f')]({},_0x38ded2,_0x31c5c8[_0x634f('0x31')]);var _0xa946bd={'where':_0x38ded2[_0x634f('0x2b')]};return db[_0x634f('0x32')][_0x634f('0x11')](_0xa946bd)['then'](function(_0x3eeb2f){_0xe39327['count']=_0x3eeb2f;if(_0x31c5c8[_0x634f('0x21')][_0x634f('0x33')]){_0x38ded2[_0x634f('0x34')]=[{'all':!![]}];}return db[_0x634f('0x32')]['findAll'](_0x38ded2);})['then'](function(_0x3e3b64){_0xe39327[_0x634f('0x35')]=_[_0x634f('0x20')](_0x3e3b64,function(_0xc1fc9c){if(_0xc1fc9c[_0x634f('0x36')]==='MicrosoftAzure'){var _0x581240=encryptor[_0x634f('0x37')](_0xc1fc9c[_0x634f('0x38')]);_0xc1fc9c[_0x634f('0x38')]=maskClientSecret(_0x581240);}return _0xc1fc9c;});return _0xe39327;})[_0x634f('0x16')](respondWithFilteredResult(_0x2a16c9,_0x38ded2))[_0x634f('0x39')](handleError(_0x2a16c9,null));};exports[_0x634f('0x3a')]=function(_0x4e9bd4,_0x2f6224){var _0x2946ec={'raw':!![],'where':{'id':_0x4e9bd4[_0x634f('0x3b')]['id']}},_0x4343b6={};_0x4343b6[_0x634f('0x1f')]=_[_0x634f('0x22')](db['CloudProvider'][_0x634f('0x1c')]);_0x4343b6[_0x634f('0x21')]=_[_0x634f('0x22')](_0x4e9bd4[_0x634f('0x21')]);_0x4343b6[_0x634f('0x2c')]=_[_0x634f('0x24')](_0x4343b6[_0x634f('0x1f')],_0x4343b6[_0x634f('0x21')]);_0x2946ec[_0x634f('0x23')]=_[_0x634f('0x24')](_0x4343b6[_0x634f('0x1f')],qs[_0x634f('0x25')](_0x4e9bd4[_0x634f('0x21')][_0x634f('0x25')]));_0x2946ec['attributes']=_0x2946ec['attributes']['length']?_0x2946ec[_0x634f('0x23')]:_0x4343b6[_0x634f('0x1f')];if(_0x4e9bd4[_0x634f('0x21')][_0x634f('0x33')]){_0x2946ec[_0x634f('0x34')]=[{'all':!![]}];}_0x2946ec=_[_0x634f('0x2f')]({},_0x2946ec,_0x4e9bd4[_0x634f('0x31')]);return db[_0x634f('0x32')][_0x634f('0x3c')](_0x2946ec)[_0x634f('0x16')](handleEntityNotFound(_0x2f6224,null))[_0x634f('0x16')](function(_0x186f1c){if(_0x186f1c['service']===_0x634f('0x3d')){var _0x5b1be2=encryptor[_0x634f('0x37')](_0x186f1c['data3']);_0x186f1c[_0x634f('0x38')]=maskClientSecret(_0x5b1be2);}return _0x186f1c;})[_0x634f('0x16')](respondWithResult(_0x2f6224,null))[_0x634f('0x39')](handleError(_0x2f6224,null));};exports[_0x634f('0x3e')]=function(_0x424b84,_0x4e097d){if(!_0x424b84['body'][_0x634f('0x17')])throw new Error(_0x634f('0x3f'));if(!_0x424b84[_0x634f('0x40')][_0x634f('0x36')])throw new Error(_0x634f('0x41'));var _0x140eaf=db['CloudProvider'][_0x634f('0x1c')][_0x634f('0x36')][_0x634f('0x42')];if(!_0x140eaf[_0x634f('0x43')](_0x424b84[_0x634f('0x40')][_0x634f('0x36')]))throw new Error(_0x634f('0x44')+_0x140eaf['join'](',\x20'));if(_0x424b84[_0x634f('0x40')][_0x634f('0x36')]===_0x634f('0x3d')&&_0x424b84[_0x634f('0x40')][_0x634f('0x38')]){_0x424b84[_0x634f('0x40')]['data3']=encryptor[_0x634f('0x45')](_0x424b84[_0x634f('0x40')][_0x634f('0x38')]);}return db['CloudProvider'][_0x634f('0x3e')](_0x424b84[_0x634f('0x40')],{})[_0x634f('0x16')](respondWithResult(_0x4e097d,0xc9))[_0x634f('0x39')](handleError(_0x4e097d,null));};exports[_0x634f('0x14')]=function(_0x3092d5,_0x15e221){if(_0x3092d5['body']['id']){delete _0x3092d5[_0x634f('0x40')]['id'];}return db[_0x634f('0x32')][_0x634f('0x3c')]({'where':{'id':_0x3092d5[_0x634f('0x3b')]['id']}})[_0x634f('0x16')](handleEntityNotFound(_0x15e221,null))[_0x634f('0x16')](function(_0x1d910a){if(_0x1d910a[_0x634f('0x36')]==='MicrosoftAzure'&&_0x3092d5[_0x634f('0x40')]['data3']){_0x3092d5['body']['data3']=encryptor['encryptString'](_0x3092d5[_0x634f('0x40')]['data3']);}return _0x1d910a;})[_0x634f('0x16')](saveUpdates(_0x3092d5[_0x634f('0x40')],null))[_0x634f('0x16')](respondWithResult(_0x15e221,null))[_0x634f('0x39')](handleError(_0x15e221,null));};exports['destroy']=function(_0x3b95f5,_0x1d367e){return db['CloudProvider']['find']({'where':{'id':_0x3b95f5['params']['id']}})[_0x634f('0x16')](handleEntityNotFound(_0x1d367e,null))[_0x634f('0x16')](removeEntity(_0x1d367e,null))[_0x634f('0x39')](handleError(_0x1d367e,null));};exports['oauth2MicrosoftAuthorize']=function(_0x185169,_0x14cf2a){return db[_0x634f('0x32')][_0x634f('0x46')]({'where':{'id':_0x185169['params']['id']},'raw':!![]})['then'](function(_0x3d48f0){if(!_0x3d48f0)return _0x14cf2a[_0x634f('0xa')](0x194);return{'url':oauth[_0x634f('0x47')](_0x3d48f0,_0x185169['user']['id'])};})[_0x634f('0x16')](respondWithResult(_0x14cf2a,null))[_0x634f('0x39')](handleError(_0x14cf2a,null));};exports[_0x634f('0x48')]=function(_0x2a5ea6,_0xadb7f8){var _0x464fb5=_0x2a5ea6[_0x634f('0x40')];var _0x550a44;var _0x1d3970;if(_0x464fb5['error'])throw _0x464fb5;redis[_0x634f('0x49')](_0x464fb5[_0x634f('0x4a')])[_0x634f('0x16')](function(_0x530456){if(!_0x530456)throw new Error(_0x634f('0x4b'));_0x550a44=JSON[_0x634f('0x4c')](_0x530456);var _0x1ef2a8=Buffer['from'](_0x464fb5['state'],_0x634f('0x4d'))['toString'](_0x634f('0x4e'));_0x1d3970=JSON[_0x634f('0x4c')](_0x1ef2a8);if(!oauth[_0x634f('0x4f')](_0x464fb5[_0x634f('0x50')],_0x550a44['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x634f('0x51')](_0x464fb5[_0x634f('0x4a')]);return oauth[_0x634f('0x52')](_0x464fb5[_0x634f('0x53')],_0x550a44);})[_0x634f('0x16')](function(_0xbe4f57){_0x550a44[_0x634f('0x54')]=_0xbe4f57[_0x634f('0x55')];_0x550a44['data6']=_0xbe4f57[_0x634f('0x56')];return db[_0x634f('0x32')][_0x634f('0x14')]({'data5':_0x550a44['data5'],'data6':_0x550a44['data6']},{'where':{'id':_0x550a44['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x550a44);socket[_0x634f('0x57')](_0x634f('0x58'),{'id':_0x1d3970['id']});return;})[_0x634f('0x16')](respondWithStatusCode(_0xadb7f8,null))[_0x634f('0x39')](function(_0x1d365f){if(_0x1d3970){socket[_0x634f('0x57')](_0x634f('0x59'),{'id':_0x1d3970['id']});}if(!_0x550a44){logger[_0x634f('0x5a')]('Invalid\x20authentication\x20state\x20parameter',_0x1d365f);return _0xadb7f8[_0x634f('0xb')](0x1f4)[_0x634f('0x18')](_0x1d365f[_0x634f('0x5b')]);}logger[_0x634f('0x5a')](_0x634f('0x5c'),_0x550a44['id'],JSON[_0x634f('0x5d')](_0x1d365f));});}; \ No newline at end of file +var _0x8902=['id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','undefined','count','offset','limit','Content-Range','then','destroy','stack','send','padEnd','index','map','CloudProvider','type','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','filter','findAll','service','MicrosoftAzure','catch','show','params','rawAttributes','intersection','includeAll','options','data3','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','update','find','oauth2MicrosoftAuthorize','findOne','user','error','get','state','from','base64','ascii'];(function(_0x31f917,_0x3a9037){var _0x31d77a=function(_0x5c1553){while(--_0x5c1553){_0x31f917['push'](_0x31f917['shift']());}};_0x31d77a(++_0x3a9037);}(_0x8902,0x6c));var _0x2890=function(_0x2494c2,_0x288476){_0x2494c2=_0x2494c2-0x0;var _0x16f60b=_0x8902[_0x2494c2];return _0x16f60b;};'use strict';var _=require(_0x2890('0x0'));var Redis=require(_0x2890('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x2890('0x2'));var config=require(_0x2890('0x3'));var logger=require('../../config/logger')(_0x2890('0x4'));var db=require(_0x2890('0x5'))['db'];var oauth=require(_0x2890('0x6'));config['redis']=_[_0x2890('0x7')](config[_0x2890('0x8')],{'host':_0x2890('0x9'),'port':0x18eb});var socket=require(_0x2890('0xa'))(new Redis(config[_0x2890('0x8')]));var redis=new Redis(config[_0x2890('0x8')]);function respondWithStatusCode(_0x60e0a2,_0x57d149){_0x57d149=_0x57d149||0xcc;return function(_0x2a1640){if(_0x2a1640){return _0x60e0a2[_0x2890('0xb')](_0x57d149);}return _0x60e0a2['status'](_0x57d149)[_0x2890('0xc')]();};}function respondWithResult(_0x12d51b,_0x42d367){_0x42d367=_0x42d367||0xc8;return function(_0x456bb2){if(_0x456bb2){return _0x12d51b[_0x2890('0xd')](_0x42d367)['json'](_0x456bb2);}};}function respondWithFilteredResult(_0x411bcf,_0x3a2820){return function(_0x4137aa){if(_0x4137aa){var _0x2a099d=typeof _0x3a2820['offset']==='undefined'&&typeof _0x3a2820['limit']===_0x2890('0xe');var _0x530cf9=_0x4137aa[_0x2890('0xf')];var _0x2e4c22=_0x2a099d?0x0:_0x3a2820[_0x2890('0x10')];var _0x1884a3=_0x2a099d?_0x4137aa[_0x2890('0xf')]:_0x3a2820[_0x2890('0x10')]+_0x3a2820[_0x2890('0x11')];var _0x5eb5bb;if(_0x1884a3>=_0x530cf9){_0x1884a3=_0x530cf9;_0x5eb5bb=0xc8;}else{_0x5eb5bb=0xce;}_0x411bcf[_0x2890('0xd')](_0x5eb5bb);return _0x411bcf['set'](_0x2890('0x12'),_0x2e4c22+'-'+_0x1884a3+'/'+_0x530cf9)['json'](_0x4137aa);}return null;};}function saveUpdates(_0x1a8ed0){return function(_0x2098d9){if(_0x2098d9){return _0x2098d9['update'](_0x1a8ed0)[_0x2890('0x13')](function(_0x44b1dd){return _0x44b1dd;});}return null;};}function removeEntity(_0x1b69c8){return function(_0x28ecbf){if(_0x28ecbf){return _0x28ecbf[_0x2890('0x14')]()[_0x2890('0x13')](function(){_0x1b69c8[_0x2890('0xd')](0xcc)[_0x2890('0xc')]();});}};}function handleEntityNotFound(_0x387f02){return function(_0x3c4077){if(!_0x3c4077){_0x387f02[_0x2890('0xb')](0x194);}return _0x3c4077;};}function handleError(_0x1c1288,_0x23afce){_0x23afce=_0x23afce||0x1f4;return function(_0x4b7b9f){logger['error'](_0x4b7b9f[_0x2890('0x15')]);if(_0x4b7b9f['name']){delete _0x4b7b9f['name'];}_0x1c1288[_0x2890('0xd')](_0x23afce)[_0x2890('0x16')](_0x4b7b9f);};}function maskClientSecret(_0x2f3315){return _[_0x2890('0x17')](_0x2f3315['slice'](0x0,0x3),0x14,'*');}exports[_0x2890('0x18')]=function(_0x5d6a02,_0x2ca81f){var _0xae9069={},_0x5d879e={},_0x53dcb2={'count':0x0,'rows':[]};var _0x3f8d2f=_[_0x2890('0x19')](db[_0x2890('0x1a')]['rawAttributes'],function(_0x4fc27d){return{'name':_0x4fc27d['fieldName'],'type':_0x4fc27d[_0x2890('0x1b')][_0x2890('0x1c')]};});_0x5d879e[_0x2890('0x1d')]=_[_0x2890('0x19')](_0x3f8d2f,_0x2890('0x1e'));_0x5d879e[_0x2890('0x1f')]=_[_0x2890('0x20')](_0x5d6a02[_0x2890('0x1f')]);_0x5d879e['filters']=_['intersection'](_0x5d879e[_0x2890('0x1d')],_0x5d879e[_0x2890('0x1f')]);_0xae9069[_0x2890('0x21')]=_['intersection'](_0x5d879e[_0x2890('0x1d')],qs[_0x2890('0x22')](_0x5d6a02[_0x2890('0x1f')]['fields']));_0xae9069[_0x2890('0x21')]=_0xae9069[_0x2890('0x21')][_0x2890('0x23')]?_0xae9069['attributes']:_0x5d879e['model'];if(!_0x5d6a02[_0x2890('0x1f')][_0x2890('0x24')]('nolimit')){_0xae9069[_0x2890('0x11')]=qs[_0x2890('0x11')](_0x5d6a02[_0x2890('0x1f')]['limit']);_0xae9069[_0x2890('0x10')]=qs['offset'](_0x5d6a02['query'][_0x2890('0x10')]);}_0xae9069[_0x2890('0x25')]=qs[_0x2890('0x26')](_0x5d6a02[_0x2890('0x1f')][_0x2890('0x26')]);_0xae9069[_0x2890('0x27')]=qs[_0x2890('0x28')](_['pick'](_0x5d6a02[_0x2890('0x1f')],_0x5d879e[_0x2890('0x28')]),_0x3f8d2f);if(_0x5d6a02[_0x2890('0x1f')]['filter']){_0xae9069[_0x2890('0x27')]=_[_0x2890('0x29')](_0xae9069['where'],{'$or':_['map'](_0x3f8d2f,function(_0x133b42){if(_0x133b42['type']!==_0x2890('0x2a')){var _0x2cc131={};_0x2cc131[_0x133b42[_0x2890('0x1e')]]={'$like':'%'+_0x5d6a02[_0x2890('0x1f')][_0x2890('0x2b')]+'%'};return _0x2cc131;}})});}_0xae9069=_[_0x2890('0x29')]({},_0xae9069,_0x5d6a02['options']);var _0x2ba4c1={'where':_0xae9069[_0x2890('0x27')]};return db[_0x2890('0x1a')][_0x2890('0xf')](_0x2ba4c1)['then'](function(_0x35a0bc){_0x53dcb2['count']=_0x35a0bc;if(_0x5d6a02[_0x2890('0x1f')]['includeAll']){_0xae9069['include']=[{'all':!![]}];}return db[_0x2890('0x1a')][_0x2890('0x2c')](_0xae9069);})[_0x2890('0x13')](function(_0x122075){_0x53dcb2['rows']=_[_0x2890('0x19')](_0x122075,function(_0x506e3e){if(_0x506e3e[_0x2890('0x2d')]===_0x2890('0x2e')){var _0xdfa9ce=encryptor['decryptString'](_0x506e3e['data3']);_0x506e3e['data3']=maskClientSecret(_0xdfa9ce);}return _0x506e3e;});return _0x53dcb2;})['then'](respondWithFilteredResult(_0x2ca81f,_0xae9069))[_0x2890('0x2f')](handleError(_0x2ca81f,null));};exports[_0x2890('0x30')]=function(_0x2a3f2e,_0x2e9ded){var _0x4bc095={'raw':!![],'where':{'id':_0x2a3f2e[_0x2890('0x31')]['id']}},_0x2002e3={};_0x2002e3['model']=_[_0x2890('0x20')](db[_0x2890('0x1a')][_0x2890('0x32')]);_0x2002e3['query']=_[_0x2890('0x20')](_0x2a3f2e[_0x2890('0x1f')]);_0x2002e3[_0x2890('0x28')]=_[_0x2890('0x33')](_0x2002e3[_0x2890('0x1d')],_0x2002e3[_0x2890('0x1f')]);_0x4bc095[_0x2890('0x21')]=_['intersection'](_0x2002e3['model'],qs['fields'](_0x2a3f2e[_0x2890('0x1f')]['fields']));_0x4bc095[_0x2890('0x21')]=_0x4bc095[_0x2890('0x21')][_0x2890('0x23')]?_0x4bc095['attributes']:_0x2002e3[_0x2890('0x1d')];if(_0x2a3f2e[_0x2890('0x1f')][_0x2890('0x34')]){_0x4bc095['include']=[{'all':!![]}];}_0x4bc095=_[_0x2890('0x29')]({},_0x4bc095,_0x2a3f2e[_0x2890('0x35')]);return db['CloudProvider']['find'](_0x4bc095)[_0x2890('0x13')](handleEntityNotFound(_0x2e9ded,null))[_0x2890('0x13')](function(_0x1a117c){if(_0x1a117c[_0x2890('0x2d')]===_0x2890('0x2e')){var _0x5b5119=encryptor['decryptString'](_0x1a117c[_0x2890('0x36')]);_0x1a117c[_0x2890('0x36')]=maskClientSecret(_0x5b5119);}return _0x1a117c;})[_0x2890('0x13')](respondWithResult(_0x2e9ded,null))[_0x2890('0x2f')](handleError(_0x2e9ded,null));};exports['create']=function(_0x421c16,_0x10dad1){if(!_0x421c16[_0x2890('0x37')][_0x2890('0x1e')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x421c16[_0x2890('0x37')][_0x2890('0x2d')])throw new Error(_0x2890('0x38'));var _0x1e0c04=db[_0x2890('0x1a')][_0x2890('0x32')][_0x2890('0x2d')][_0x2890('0x39')];if(!_0x1e0c04[_0x2890('0x3a')](_0x421c16[_0x2890('0x37')][_0x2890('0x2d')]))throw new Error(_0x2890('0x3b')+_0x1e0c04[_0x2890('0x3c')](',\x20'));if(_0x421c16['body'][_0x2890('0x2d')]==='MicrosoftAzure'&&_0x421c16[_0x2890('0x37')]['data3']){_0x421c16[_0x2890('0x37')]['data3']=encryptor[_0x2890('0x3d')](_0x421c16[_0x2890('0x37')]['data3']);}return db[_0x2890('0x1a')][_0x2890('0x3e')](_0x421c16[_0x2890('0x37')],{})['then'](respondWithResult(_0x10dad1,0xc9))[_0x2890('0x2f')](handleError(_0x10dad1,null));};exports[_0x2890('0x3f')]=function(_0x41f7e4,_0x5375b3){if(_0x41f7e4[_0x2890('0x37')]['id']){delete _0x41f7e4[_0x2890('0x37')]['id'];}return db[_0x2890('0x1a')][_0x2890('0x40')]({'where':{'id':_0x41f7e4[_0x2890('0x31')]['id']}})[_0x2890('0x13')](handleEntityNotFound(_0x5375b3,null))[_0x2890('0x13')](function(_0x2085f1){if(_0x2085f1['service']===_0x2890('0x2e')&&_0x41f7e4[_0x2890('0x37')][_0x2890('0x36')]){_0x41f7e4[_0x2890('0x37')][_0x2890('0x36')]=encryptor[_0x2890('0x3d')](_0x41f7e4[_0x2890('0x37')][_0x2890('0x36')]);}return _0x2085f1;})[_0x2890('0x13')](saveUpdates(_0x41f7e4[_0x2890('0x37')],null))[_0x2890('0x13')](respondWithResult(_0x5375b3,null))[_0x2890('0x2f')](handleError(_0x5375b3,null));};exports[_0x2890('0x14')]=function(_0x10c3b9,_0x1278d9){return db[_0x2890('0x1a')][_0x2890('0x40')]({'where':{'id':_0x10c3b9[_0x2890('0x31')]['id']}})['then'](handleEntityNotFound(_0x1278d9,null))['then'](removeEntity(_0x1278d9,null))[_0x2890('0x2f')](handleError(_0x1278d9,null));};exports[_0x2890('0x41')]=function(_0x2ad24c,_0x5901ba){return db[_0x2890('0x1a')][_0x2890('0x42')]({'where':{'id':_0x2ad24c[_0x2890('0x31')]['id']},'raw':!![]})[_0x2890('0x13')](function(_0x1f02de){if(!_0x1f02de)return _0x5901ba[_0x2890('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x1f02de,_0x2ad24c[_0x2890('0x43')]['id'])};})['then'](respondWithResult(_0x5901ba,null))[_0x2890('0x2f')](handleError(_0x5901ba,null));};exports['oauth2MicrosoftCallback']=function(_0x4673a7,_0x2809a3){var _0xf9ef4=_0x4673a7['body'];var _0x25cad5;var _0x48bfa6;if(_0xf9ef4[_0x2890('0x44')])throw _0xf9ef4;redis[_0x2890('0x45')](_0xf9ef4[_0x2890('0x46')])['then'](function(_0x1e8dc2){if(!_0x1e8dc2)throw new Error('Invalid\x20state\x20parameter');_0x25cad5=JSON['parse'](_0x1e8dc2);var _0x49b8dc=Buffer[_0x2890('0x47')](_0xf9ef4['state'],_0x2890('0x48'))['toString'](_0x2890('0x49'));_0x48bfa6=JSON['parse'](_0x49b8dc);if(!oauth['isValidIdToken'](_0xf9ef4[_0x2890('0x4a')],_0x25cad5[_0x2890('0x4b')]))throw new Error(_0x2890('0x4c'));redis[_0x2890('0x4d')](_0xf9ef4[_0x2890('0x46')]);return oauth[_0x2890('0x4e')](_0xf9ef4[_0x2890('0x4f')],_0x25cad5);})[_0x2890('0x13')](function(_0x45f3f6){_0x25cad5['data5']=_0x45f3f6[_0x2890('0x50')];_0x25cad5[_0x2890('0x51')]=_0x45f3f6[_0x2890('0x52')];return db[_0x2890('0x1a')][_0x2890('0x3f')]({'data5':_0x25cad5[_0x2890('0x53')],'data6':_0x25cad5[_0x2890('0x51')]},{'where':{'id':_0x25cad5['id']}});})[_0x2890('0x13')](function(){oauth[_0x2890('0x54')](_0x25cad5);socket[_0x2890('0x55')](_0x2890('0x56'),{'id':_0x48bfa6['id']});return;})[_0x2890('0x13')](respondWithStatusCode(_0x2809a3,null))[_0x2890('0x2f')](function(_0x1f8807){if(_0x48bfa6){socket[_0x2890('0x55')](_0x2890('0x57'),{'id':_0x48bfa6['id']});}if(!_0x25cad5){logger[_0x2890('0x44')](_0x2890('0x58'),_0x1f8807);return _0x2809a3[_0x2890('0xd')](0x1f4)[_0x2890('0x16')](_0x1f8807[_0x2890('0x59')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x25cad5['id'],JSON[_0x2890('0x5a')](_0x1f8807));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d5d690e..dd12bee 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 _0xbc50=['../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x5ba46a,_0x582fe0){var _0x5cbf4f=function(_0x22349b){while(--_0x22349b){_0x5ba46a['push'](_0x5ba46a['shift']());}};_0x5cbf4f(++_0x582fe0);}(_0xbc50,0xf5));var _0x0bc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0bc5('0x0'));var util=require(_0x0bc5('0x1'));var logger=require(_0x0bc5('0x2'))('api');var moment=require(_0x0bc5('0x3'));var BPromise=require(_0x0bc5('0x4'));var rp=require(_0x0bc5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bc5('0x6'));var config=require(_0x0bc5('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x0bc5('0x8')]=function(_0x5fb9f8,_0x2eaebb){return _0x5fb9f8[_0x0bc5('0x9')](_0x0bc5('0xa'),attributes,{'tableName':_0x0bc5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f1b=['../../config/logger','request-promise','rimraf','./cloudProvider.attributes','define','CloudProvider','cloud_providers'];(function(_0x3aa1a3,_0x148306){var _0x427f8e=function(_0x3f31e1){while(--_0x3f31e1){_0x3aa1a3['push'](_0x3aa1a3['shift']());}};_0x427f8e(++_0x148306);}(_0x6f1b,0x15e));var _0xb6f1=function(_0x1cd2d7,_0x281cda){_0x1cd2d7=_0x1cd2d7-0x0;var _0x5342fb=_0x6f1b[_0x1cd2d7];return _0x5342fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb6f1('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb6f1('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb6f1('0x2'));var config=require('../../config/environment');var attributes=require(_0xb6f1('0x3'));module['exports']=function(_0x51242e,_0x3e33a3){return _0x51242e[_0xb6f1('0x4')](_0xb6f1('0x5'),attributes,{'tableName':_0xb6f1('0x6'),'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 cbf4906..4b56ccb 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 _0x5e82=['data1','response_type','join','data4','response_mode','form_post','scope','state','nonce','prompt','key','value','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','exp','then','CloudProvider','refresh_token','data6','POST','data5','access_token','update','catch','authorization_code','decryptString','data3','{TENANT_ID}','bind','intervals','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','data7','replace','data2','code','id_token','from','stringify','toString','base64','randomBytes','client_id'];(function(_0x4fa6c6,_0x44ca48){var _0x158906=function(_0x37935d){while(--_0x37935d){_0x4fa6c6['push'](_0x4fa6c6['shift']());}};_0x158906(++_0x44ca48);}(_0x5e82,0x1bf));var _0x25e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e82[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x25e8('0x0'));var crypto=require(_0x25e8('0x1'));var jwt=require(_0x25e8('0x2'));var moment=require(_0x25e8('0x3'));var Redis=require('ioredis');var rp=require(_0x25e8('0x4'));var util=require('util');var encryptor=require(_0x25e8('0x5'));var config=require(_0x25e8('0x6'));var logger=require(_0x25e8('0x7'))(_0x25e8('0x8'));var schedule=require(_0x25e8('0x9'));var db=require(_0x25e8('0xa'))['db'];config[_0x25e8('0xb')]=_[_0x25e8('0xc')](config[_0x25e8('0xb')],{'host':_0x25e8('0xd'),'port':0x18eb});var redis=new Redis(config[_0x25e8('0xb')]);var MICROSOFT_AUTH_URL=_0x25e8('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0x25e8('0xf'),_0x25e8('0x10'),_0x25e8('0x11'),_0x25e8('0x12'),_0x25e8('0x13'),_0x25e8('0x14'),_0x25e8('0x15')],'Dynamics365':[_0x25e8('0xf'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x25e8('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x328d09){var _0x193dd9=_[_0x25e8('0x17')](AZURE_AUTH_SCOPES[_0x328d09[_0x25e8('0x18')]]);if(_0x328d09[_0x25e8('0x18')]===_0x25e8('0x19'))_0x193dd9[_0x25e8('0x1a')](_0x328d09['data7']+_0x25e8('0x1b'));return _0x193dd9['join']('\x20');}function getAccessTokenScope(_0x2aa709){if(_0x2aa709[_0x25e8('0x18')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x2aa709[_0x25e8('0x18')]==='Dynamics365')return _0x2aa709[_0x25e8('0x1c')]+_0x25e8('0x1b');}function generateMicrosoftAuthorizationUrl(_0x4a2976,_0x3d4097){var _0x6b74d6=MICROSOFT_AUTH_URL[_0x25e8('0x1d')]('{TENANT_ID}',_0x4a2976[_0x25e8('0x1e')]);var _0x398449=[_0x25e8('0x1f'),_0x25e8('0x20')];var _0x351987=Buffer[_0x25e8('0x21')](JSON[_0x25e8('0x22')]({'id':_0x3d4097}))[_0x25e8('0x23')](_0x25e8('0x24'));var _0x4a3c16=crypto[_0x25e8('0x25')](0x10)[_0x25e8('0x23')]('hex');var _0x49377e=getAuthorizationScopes(_0x4a2976);var _0x3eeaf4=[{'key':_0x25e8('0x26'),'value':_0x4a2976[_0x25e8('0x27')]},{'key':_0x25e8('0x28'),'value':encodeURIComponent(_0x398449[_0x25e8('0x29')]('\x20'))},{'key':'redirect_uri','value':_0x4a2976[_0x25e8('0x2a')]},{'key':_0x25e8('0x2b'),'value':_0x25e8('0x2c')},{'key':_0x25e8('0x2d'),'value':encodeURIComponent(_0x49377e)},{'key':_0x25e8('0x2e'),'value':_0x351987},{'key':_0x25e8('0x2f'),'value':_0x4a3c16},{'key':_0x25e8('0x30'),'value':'login'}];var _0x1a20f0=_0x6b74d6+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x25e8('0x17')](_0x3eeaf4,function(_0xd8567a){return _0xd8567a[_0x25e8('0x31')]+'='+_0xd8567a[_0x25e8('0x32')];})[_0x25e8('0x29')]('&');_0x4a2976['oauth2Claims']={'issuer':_0x6b74d6['replace'](_0x25e8('0x33'),''),'audience':_0x4a2976[_0x25e8('0x27')],'state':_0x351987,'nonce':_0x4a3c16};redis[_0x25e8('0x34')](_0x351987,JSON[_0x25e8('0x22')](_0x4a2976));return _0x1a20f0;}function isValidIdToken(_0x3155e5,_0x311093){try{var _0x5aee72=jwt[_0x25e8('0x35')](_0x3155e5,{'complete':!![]});var _0x55ebb0=_0x5aee72[_0x25e8('0x36')];if(_0x55ebb0[_0x25e8('0x37')]!==_0x311093[_0x25e8('0x38')])return![];if(_0x55ebb0[_0x25e8('0x39')]!==_0x311093[_0x25e8('0x3a')])return![];if(_0x55ebb0[_0x25e8('0x2f')]!==_0x311093[_0x25e8('0x2f')])return![];if(moment()[_0x25e8('0x3b')](moment['unix'](_0x55ebb0[_0x25e8('0x3c')])))return![];return!![];}catch(_0x5cbc51){throw _0x5cbc51;}}function refreshOauth2MicrosoftAccessToken(_0x4f0f65){return Promise['resolve']()[_0x25e8('0x3d')](function(){if(_0x4f0f65['data3'])return _0x4f0f65;return db[_0x25e8('0x3e')]['findOne']({'where':{'id':_0x4f0f65['id']},'raw':!![]});})[_0x25e8('0x3d')](function(_0x694e13){var _0x111ea1={'grant_type':_0x25e8('0x3f'),'refresh_token':_0x694e13[_0x25e8('0x40')],'scope':getAccessTokenScope(_0x694e13),'redirect_uri':_0x694e13[_0x25e8('0x2a')],'client_id':_0x694e13[_0x25e8('0x27')],'client_secret':encryptor['decryptString'](_0x694e13['data3'])};var _0x470023={'method':_0x25e8('0x41'),'uri':MICROSOFT_AUTH_URL[_0x25e8('0x1d')]('{TENANT_ID}',_0x694e13[_0x25e8('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x111ea1,'json':!![]};return rp(_0x470023);})[_0x25e8('0x3d')](function(_0x23ce85){_0x4f0f65[_0x25e8('0x42')]=_0x23ce85[_0x25e8('0x43')];_0x4f0f65[_0x25e8('0x40')]=_0x23ce85['refresh_token'];return db[_0x25e8('0x3e')][_0x25e8('0x44')]({'data5':_0x4f0f65['data5'],'data6':_0x4f0f65[_0x25e8('0x40')]},{'where':{'id':_0x4f0f65['id']}});})[_0x25e8('0x3d')](function(){return _0x4f0f65;})[_0x25e8('0x45')](function(_0x525b16){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x4f0f65['id'],_0x525b16);});}function getOauth2MicrosoftAccessToken(_0x4a38dc,_0x3a0d25){var _0x193cf1={'grant_type':_0x25e8('0x46'),'code':_0x4a38dc,'scope':getAccessTokenScope(_0x3a0d25),'redirect_uri':_0x3a0d25[_0x25e8('0x2a')],'client_id':_0x3a0d25[_0x25e8('0x27')],'client_secret':encryptor[_0x25e8('0x47')](_0x3a0d25[_0x25e8('0x48')])};var _0x336710={'method':_0x25e8('0x41'),'uri':MICROSOFT_AUTH_URL[_0x25e8('0x1d')](_0x25e8('0x49'),_0x3a0d25[_0x25e8('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x193cf1,'json':!![]};return rp(_0x336710);}function startRefreshInterval(_0x12f904){var _0x4fd4c1=schedule['intervals'];if(_0x4fd4c1[_0x12f904['id']])clearInterval(_0x4fd4c1[_0x12f904['id']]);_0x4fd4c1[_0x12f904['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x25e8('0x4a')](this,{'id':_0x12f904['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x25e8('0x4b')]=_0x4fd4c1;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x25e8('0x4c')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x25e8('0x3d')](function(_0x1a46a2){var _0x21ca40=_0x1a46a2[_0x25e8('0x17')](function(_0x6b1f7c){return refreshOauth2MicrosoftAccessToken(_0x6b1f7c)[_0x25e8('0x3d')](function(_0x1adc44){startRefreshInterval(_0x1adc44);});});return Promise[_0x25e8('0x4d')](_0x21ca40);})[_0x25e8('0x45')](function(_0x1a0986){var _0x171c6b=_0x1a0986?util[_0x25e8('0x4e')](_0x1a0986,{'showHidden':![],'depth':null}):'';logger[_0x25e8('0x4f')](_0x25e8('0x50'),_0x171c6b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4079=['decryptString','data2','data5','access_token','data6','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','exports','lodash','crypto','jsonwebtoken','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','stringify','base64','randomBytes','toString','hex','client_id','data4','form_post','state','nonce','prompt','login','value','oauth2/','set','payload','aud','audience','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data1'];(function(_0x4472ea,_0x1c5c44){var _0x37d760=function(_0x39526b){while(--_0x39526b){_0x4472ea['push'](_0x4472ea['shift']());}};_0x37d760(++_0x1c5c44);}(_0x4079,0xe6));var _0x9407=function(_0x3b8a6a,_0x56c2df){_0x3b8a6a=_0x3b8a6a-0x0;var _0x4b2128=_0x4079[_0x3b8a6a];return _0x4b2128;};'use strict';var _=require(_0x9407('0x0'));var crypto=require(_0x9407('0x1'));var jwt=require(_0x9407('0x2'));var moment=require('moment');var Redis=require('ioredis');var rp=require('request-promise');var util=require(_0x9407('0x3'));var encryptor=require(_0x9407('0x4'));var config=require(_0x9407('0x5'));var logger=require(_0x9407('0x6'))(_0x9407('0x7'));var schedule=require(_0x9407('0x8'));var db=require(_0x9407('0x9'))['db'];config[_0x9407('0xa')]=_[_0x9407('0xb')](config[_0x9407('0xa')],{'host':_0x9407('0xc'),'port':0x18eb});var redis=new Redis(config[_0x9407('0xa')]);var MICROSOFT_AUTH_URL=_0x9407('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9407('0xe'),_0x9407('0xf'),_0x9407('0x10'),_0x9407('0x11'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x9407('0xe'),_0x9407('0x11')]};var MICROSOFT_AUTH_ENDPOINT=_0x9407('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0x9407('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xe79757){var _0xcdd15f=_[_0x9407('0x14')](AZURE_AUTH_SCOPES[_0xe79757[_0x9407('0x15')]]);if(_0xe79757[_0x9407('0x15')]===_0x9407('0x16'))_0xcdd15f[_0x9407('0x17')](_0xe79757[_0x9407('0x18')]+_0x9407('0x19'));return _0xcdd15f[_0x9407('0x1a')]('\x20');}function getAccessTokenScope(_0x37dc6a){if(_0x37dc6a[_0x9407('0x15')]===_0x9407('0x1b'))return _0x9407('0x1c');if(_0x37dc6a[_0x9407('0x15')]===_0x9407('0x16'))return _0x37dc6a[_0x9407('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x4c5713,_0x132243){var _0x5efb46=MICROSOFT_AUTH_URL[_0x9407('0x1d')](_0x9407('0x1e'),_0x4c5713['data2']);var _0x323189=['code','id_token'];var _0x2f999c=Buffer['from'](JSON[_0x9407('0x1f')]({'id':_0x132243}))['toString'](_0x9407('0x20'));var _0x19d694=crypto[_0x9407('0x21')](0x10)[_0x9407('0x22')](_0x9407('0x23'));var _0x5b30ae=getAuthorizationScopes(_0x4c5713);var _0x1bda52=[{'key':_0x9407('0x24'),'value':_0x4c5713['data1']},{'key':'response_type','value':encodeURIComponent(_0x323189[_0x9407('0x1a')]('\x20'))},{'key':'redirect_uri','value':_0x4c5713[_0x9407('0x25')]},{'key':'response_mode','value':_0x9407('0x26')},{'key':'scope','value':encodeURIComponent(_0x5b30ae)},{'key':_0x9407('0x27'),'value':_0x2f999c},{'key':_0x9407('0x28'),'value':_0x19d694},{'key':_0x9407('0x29'),'value':_0x9407('0x2a')}];var _0x230396=_0x5efb46+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9407('0x14')](_0x1bda52,function(_0x235084){return _0x235084['key']+'='+_0x235084[_0x9407('0x2b')];})[_0x9407('0x1a')]('&');_0x4c5713['oauth2Claims']={'issuer':_0x5efb46[_0x9407('0x1d')](_0x9407('0x2c'),''),'audience':_0x4c5713['data1'],'state':_0x2f999c,'nonce':_0x19d694};redis[_0x9407('0x2d')](_0x2f999c,JSON[_0x9407('0x1f')](_0x4c5713));return _0x230396;}function isValidIdToken(_0x7bb4b7,_0x3744d3){try{var _0x30c49f=jwt['decode'](_0x7bb4b7,{'complete':!![]});var _0x475614=_0x30c49f[_0x9407('0x2e')];if(_0x475614['iss']!==_0x3744d3['issuer'])return![];if(_0x475614[_0x9407('0x2f')]!==_0x3744d3[_0x9407('0x30')])return![];if(_0x475614['nonce']!==_0x3744d3[_0x9407('0x28')])return![];if(moment()['isAfter'](moment[_0x9407('0x31')](_0x475614[_0x9407('0x32')])))return![];return!![];}catch(_0x17810e){throw _0x17810e;}}function refreshOauth2MicrosoftAccessToken(_0xeeac74){return Promise[_0x9407('0x33')]()[_0x9407('0x34')](function(){if(_0xeeac74[_0x9407('0x35')])return _0xeeac74;return db[_0x9407('0x36')][_0x9407('0x37')]({'where':{'id':_0xeeac74['id']},'raw':!![]});})[_0x9407('0x34')](function(_0x44a0bf){var _0x1ea0cc={'grant_type':_0x9407('0x38'),'refresh_token':_0x44a0bf['data6'],'scope':getAccessTokenScope(_0x44a0bf),'redirect_uri':_0x44a0bf[_0x9407('0x25')],'client_id':_0x44a0bf[_0x9407('0x39')],'client_secret':encryptor[_0x9407('0x3a')](_0x44a0bf[_0x9407('0x35')])};var _0x234985={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x9407('0x1d')](_0x9407('0x1e'),_0x44a0bf[_0x9407('0x3b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1ea0cc,'json':!![]};return rp(_0x234985);})[_0x9407('0x34')](function(_0x57e02a){_0xeeac74[_0x9407('0x3c')]=_0x57e02a[_0x9407('0x3d')];_0xeeac74[_0x9407('0x3e')]=_0x57e02a[_0x9407('0x38')];return db[_0x9407('0x36')][_0x9407('0x3f')]({'data5':_0xeeac74[_0x9407('0x3c')],'data6':_0xeeac74[_0x9407('0x3e')]},{'where':{'id':_0xeeac74['id']}});})[_0x9407('0x34')](function(){return _0xeeac74;})[_0x9407('0x40')](function(_0x1fad7c){logger[_0x9407('0x41')](_0x9407('0x42'),_0xeeac74['id'],_0x1fad7c);});}function getOauth2MicrosoftAccessToken(_0xb1c69d,_0x3fde07){var _0x1b281c={'grant_type':'authorization_code','code':_0xb1c69d,'scope':getAccessTokenScope(_0x3fde07),'redirect_uri':_0x3fde07[_0x9407('0x25')],'client_id':_0x3fde07[_0x9407('0x39')],'client_secret':encryptor['decryptString'](_0x3fde07[_0x9407('0x35')])};var _0x4af167={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x9407('0x1d')](_0x9407('0x1e'),_0x3fde07[_0x9407('0x3b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1b281c,'json':!![]};return rp(_0x4af167);}function startRefreshInterval(_0x16c0a3){var _0x1dd025=schedule[_0x9407('0x43')];if(_0x1dd025[_0x16c0a3['id']])clearInterval(_0x1dd025[_0x16c0a3['id']]);_0x1dd025[_0x16c0a3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9407('0x44')](this,{'id':_0x16c0a3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9407('0x43')]=_0x1dd025;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x9407('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9407('0x34')](function(_0x20eca7){var _0x26eac9=_0x20eca7[_0x9407('0x14')](function(_0x378075){return refreshOauth2MicrosoftAccessToken(_0x378075)[_0x9407('0x34')](function(_0x35dd5a){startRefreshInterval(_0x35dd5a);});});return Promise[_0x9407('0x46')](_0x26eac9);})['catch'](function(_0x58f8bf){var _0x558582=_0x58f8bf?util['inspect'](_0x58f8bf,{'showHidden':![],'depth':null}):'';logger[_0x9407('0x41')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x558582);});}module[_0x9407('0x47')]={'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 1c6c3ae..8aae128 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 _0xbc87=['stringify','error','code','message','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x4ff003,_0x2b524a){var _0x4ce60b=function(_0x12a5e6){while(--_0x12a5e6){_0x4ff003['push'](_0x4ff003['shift']());}};_0x4ce60b(++_0x2b524a);}(_0xbc87,0x144));var _0x7bc8=function(_0xf96956,_0x201650){_0xf96956=_0xf96956-0x0;var _0x314653=_0xbc87[_0xf96956];return _0x314653;};'use strict';var _=require(_0x7bc8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7bc8('0x1'));var rs=require(_0x7bc8('0x2'));var fs=require('fs');var Redis=require(_0x7bc8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7bc8('0x4'))(_0x7bc8('0x5'));var config=require(_0x7bc8('0x6'));var jayson=require(_0x7bc8('0x7'));var client=jayson[_0x7bc8('0x8')][_0x7bc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410b95,_0x2e1d63,_0x1fcc43){return new BPromise(function(_0x466ed5,_0xb87048){return client[_0x7bc8('0xa')](_0x410b95,_0x1fcc43)[_0x7bc8('0xb')](function(_0x368899){logger[_0x7bc8('0xc')](_0x7bc8('0xd'),_0x2e1d63,_0x7bc8('0xe'));logger['debug'](_0x7bc8('0xf'),_0x2e1d63,'request\x20sent',JSON[_0x7bc8('0x10')](_0x368899));if(_0x368899[_0x7bc8('0x11')]){if(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x12')]===0x1f4){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x368899['error'][_0x7bc8('0x13')]);return _0xb87048(_0x368899[_0x7bc8('0x11')]['message']);}logger[_0x7bc8('0x11')]('CloudProvider,\x20%s,\x20%s',_0x2e1d63,_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);return _0x466ed5(_0x368899[_0x7bc8('0x11')][_0x7bc8('0x13')]);}else{logger[_0x7bc8('0xc')]('CloudProvider,\x20%s,\x20%s',_0x2e1d63,_0x7bc8('0xe'));_0x466ed5(_0x368899['result'][_0x7bc8('0x13')]);}})['catch'](function(_0x455f9a){logger[_0x7bc8('0x11')](_0x7bc8('0xd'),_0x2e1d63,_0x455f9a);_0xb87048(_0x455f9a);});});} \ No newline at end of file +var _0x8227=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3e8c83,_0x561dc7){var _0x488c0d=function(_0x5eff9f){while(--_0x5eff9f){_0x3e8c83['push'](_0x3e8c83['shift']());}};_0x488c0d(++_0x561dc7);}(_0x8227,0x146));var _0x7822=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8227[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7822('0x0'));var moment=require('moment');var BPromise=require(_0x7822('0x1'));var rs=require(_0x7822('0x2'));var fs=require('fs');var Redis=require(_0x7822('0x3'));var db=require(_0x7822('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7822('0x5'))(_0x7822('0x6'));var config=require(_0x7822('0x7'));var jayson=require(_0x7822('0x8'));var client=jayson[_0x7822('0x9')][_0x7822('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fdb55,_0x23d59f,_0x4c5213){return new BPromise(function(_0xe2a3cf,_0x5d749e){return client[_0x7822('0xb')](_0x3fdb55,_0x4c5213)[_0x7822('0xc')](function(_0x3ba7cb){logger[_0x7822('0xd')](_0x7822('0xe'),_0x23d59f,_0x7822('0xf'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x23d59f,_0x7822('0xf'),JSON['stringify'](_0x3ba7cb));if(_0x3ba7cb[_0x7822('0x10')]){if(_0x3ba7cb[_0x7822('0x10')][_0x7822('0x11')]===0x1f4){logger[_0x7822('0x10')](_0x7822('0xe'),_0x23d59f,_0x3ba7cb[_0x7822('0x10')]['message']);return _0x5d749e(_0x3ba7cb['error'][_0x7822('0x12')]);}logger[_0x7822('0x10')]('CloudProvider,\x20%s,\x20%s',_0x23d59f,_0x3ba7cb[_0x7822('0x10')][_0x7822('0x12')]);return _0xe2a3cf(_0x3ba7cb[_0x7822('0x10')][_0x7822('0x12')]);}else{logger[_0x7822('0xd')]('CloudProvider,\x20%s,\x20%s',_0x23d59f,'request\x20sent');_0xe2a3cf(_0x3ba7cb[_0x7822('0x13')][_0x7822('0x12')]);}})[_0x7822('0x14')](function(_0x144fdb){logger[_0x7822('0x10')](_0x7822('0xe'),_0x23d59f,_0x144fdb);_0x5d749e(_0x144fdb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4547c6b..bee90a8 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 _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x5c25ce,_0x467bc4){var _0x3a6394=function(_0x55d3eb){while(--_0x55d3eb){_0x5c25ce['push'](_0x5c25ce['shift']());}};_0x3a6394(++_0x467bc4);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b5396,_0x4ba3f1){_0x1b5396=_0x1b5396-0x0;var _0x59b797=_0x2ef3[_0x1b5396];return _0x59b797;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file +var _0x5f66=['index','post','/:id','update','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','Router','./cloudProvider.controller','get','isAuthenticated'];(function(_0x132387,_0x45fbc5){var _0x426409=function(_0x205d43){while(--_0x205d43){_0x132387['push'](_0x132387['shift']());}};_0x426409(++_0x45fbc5);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);router[_0x65f6('0x2')]('/:id',auth[_0x65f6('0x3')](),controller['show']);router[_0x65f6('0x5')]('/',auth[_0x65f6('0x3')](),controller['create']);router['put'](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller[_0x65f6('0x7')]);router[_0x65f6('0x8')](_0x65f6('0x6'),auth[_0x65f6('0x3')](),controller['destroy']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x3')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x5')]('/oauth2/microsoft/callback',controller[_0x65f6('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b9ddad6..761fae9 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 _0x3a01=['sequelize','STRING','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3a01,0x105));var _0x13a0=function(_0x273877,_0x20a25b){_0x273877=_0x273877-0x0;var _0x3bce1e=_0x3a01[_0x273877];return _0x3bce1e;};'use strict';var Sequelize=require(_0x13a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x13a0('0x1')],'unique':_0x13a0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x13a0('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x13a0('0x1')]},'type':{'type':Sequelize[_0x13a0('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x13a0('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x13a0('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x13a0('0x1')]},'sPostalCode':{'type':Sequelize[_0x13a0('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x13a0('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1323=['name','sequelize','STRING'];(function(_0x447ce1,_0x11cf0b){var _0x4c1e7a=function(_0x6693b9){while(--_0x6693b9){_0x447ce1['push'](_0x447ce1['shift']());}};_0x4c1e7a(++_0x11cf0b);}(_0x1323,0x1f3));var _0x3132=function(_0x348c39,_0x2b1cf3){_0x348c39=_0x348c39-0x0;var _0x135ce4=_0x1323[_0x348c39];return _0x135ce4;};'use strict';var Sequelize=require(_0x3132('0x0'));module['exports']={'name':{'type':Sequelize[_0x3132('0x1')],'unique':_0x3132('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3132('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x3132('0x1')]},'phone':{'type':Sequelize[_0x3132('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3132('0x1')]},'street':{'type':Sequelize[_0x3132('0x1')]},'postalCode':{'type':Sequelize[_0x3132('0x1')]},'city':{'type':Sequelize[_0x3132('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3132('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3132('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x3132('0x1')]},'sCity':{'type':Sequelize[_0x3132('0x1')]},'sCountry':{'type':Sequelize[_0x3132('0x1')]},'description':{'type':Sequelize[_0x3132('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9ec8860..7825ace 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 _0x9e02=['describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','merge','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','addContacts','CmContact','ids','omit','findOne','getContacts','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','index','CmCompany'];(function(_0x9df468,_0x5bfcdb){var _0x3b002a=function(_0x1ef06c){while(--_0x1ef06c){_0x9df468['push'](_0x9df468['shift']());}};_0x3b002a(++_0x5bfcdb);}(_0x9e02,0x1dc));var _0x29e0=function(_0x48ddb4,_0x3dc8ff){_0x48ddb4=_0x48ddb4-0x0;var _0x5511a5=_0x9e02[_0x48ddb4];return _0x5511a5;};'use strict';var emlformat=require(_0x29e0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x29e0('0x1'));var rp=require(_0x29e0('0x2'));var moment=require(_0x29e0('0x3'));var BPromise=require(_0x29e0('0x4'));var Mustache=require('mustache');var util=require(_0x29e0('0x5'));var path=require(_0x29e0('0x6'));var sox=require(_0x29e0('0x7'));var csv=require(_0x29e0('0x8'));var ejs=require(_0x29e0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x29e0('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29e0('0xb'));var deskjs=require(_0x29e0('0xc'));var toCsv=require(_0x29e0('0x8'));var querystring=require(_0x29e0('0xd'));var Papa=require(_0x29e0('0xe'));var Redis=require(_0x29e0('0xf'));var authService=require(_0x29e0('0x10'));var qs=require(_0x29e0('0x11'));var as=require(_0x29e0('0x12'));var hardwareService=require(_0x29e0('0x13'));var logger=require(_0x29e0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x29e0('0x15'));var licenseUtil=require(_0x29e0('0x16'));var db=require(_0x29e0('0x17'))['db'];function respondWithStatusCode(_0x53918f,_0x1f80be){_0x1f80be=_0x1f80be||0xcc;return function(_0x16191f){if(_0x16191f){return _0x53918f[_0x29e0('0x18')](_0x1f80be);}return _0x53918f[_0x29e0('0x19')](_0x1f80be)['end']();};}function respondWithResult(_0x56d795,_0x3c8321){_0x3c8321=_0x3c8321||0xc8;return function(_0x2cb020){if(_0x2cb020){return _0x56d795[_0x29e0('0x19')](_0x3c8321)[_0x29e0('0x1a')](_0x2cb020);}};}function respondWithFilteredResult(_0x232b14,_0x5d0047){return function(_0x4fefe9){if(_0x4fefe9){var _0x5b13ed=typeof _0x5d0047[_0x29e0('0x1b')]===_0x29e0('0x1c')&&typeof _0x5d0047[_0x29e0('0x1d')]===_0x29e0('0x1c');var _0x10ae7a=_0x4fefe9['count'];var _0x2f5fce=_0x5b13ed?0x0:_0x5d0047['offset'];var _0xfb83d0=_0x5b13ed?_0x4fefe9['count']:_0x5d0047[_0x29e0('0x1b')]+_0x5d0047[_0x29e0('0x1d')];var _0x6b82d1;if(_0xfb83d0>=_0x10ae7a){_0xfb83d0=_0x10ae7a;_0x6b82d1=0xc8;}else{_0x6b82d1=0xce;}_0x232b14['status'](_0x6b82d1);return _0x232b14[_0x29e0('0x1e')](_0x29e0('0x1f'),_0x2f5fce+'-'+_0xfb83d0+'/'+_0x10ae7a)[_0x29e0('0x1a')](_0x4fefe9);}return null;};}function patchUpdates(_0x57970c){return function(_0x4c1360){try{jsonpatch[_0x29e0('0x20')](_0x4c1360,_0x57970c,!![]);}catch(_0x4c8294){return BPromise[_0x29e0('0x21')](_0x4c8294);}return _0x4c1360[_0x29e0('0x22')]();};}function saveUpdates(_0x5443fd,_0x8cc2f4){return function(_0x7b2104){if(_0x7b2104){return _0x7b2104[_0x29e0('0x23')](_0x5443fd)[_0x29e0('0x24')](function(_0x1be3a8){return _0x1be3a8;});}return null;};}function removeEntity(_0x560252,_0x3e3544){return function(_0x47c7f6){if(_0x47c7f6){return _0x47c7f6[_0x29e0('0x25')]()[_0x29e0('0x24')](function(){var _0x3cd1d7=_0x47c7f6[_0x29e0('0x26')]({'plain':!![]});var _0x41b426='Companies';return db[_0x29e0('0x27')][_0x29e0('0x25')]({'where':{'type':_0x41b426,'resourceId':_0x3cd1d7['id']}})['then'](function(){return _0x47c7f6;});})[_0x29e0('0x24')](function(){_0x560252[_0x29e0('0x19')](0xcc)[_0x29e0('0x28')]();});}};}function handleEntityNotFound(_0xc471d1,_0x5d4b95){return function(_0x4dc01e){if(!_0x4dc01e){_0xc471d1[_0x29e0('0x18')](0x194);}return _0x4dc01e;};}function handleError(_0x21ef27,_0x267e36){_0x267e36=_0x267e36||0x1f4;return function(_0x456c33){logger[_0x29e0('0x29')](_0x456c33[_0x29e0('0x2a')]);if(_0x456c33['name']){delete _0x456c33[_0x29e0('0x2b')];}_0x21ef27[_0x29e0('0x19')](_0x267e36)['send'](_0x456c33);};}exports[_0x29e0('0x2c')]=function(_0x39e597,_0x23c00e){var _0x42e498={},_0x131034={},_0x4b0b44={'count':0x0,'rows':[]};return db[_0x29e0('0x2d')][_0x29e0('0x2e')]()[_0x29e0('0x24')](function(_0x475367){_0x131034[_0x29e0('0x2f')]=_[_0x29e0('0x30')](_0x475367);_0x131034[_0x29e0('0x31')]=_[_0x29e0('0x30')](_0x39e597['query']);_0x131034[_0x29e0('0x32')]=_[_0x29e0('0x33')](_0x131034[_0x29e0('0x2f')],_0x131034[_0x29e0('0x31')]);_0x42e498[_0x29e0('0x34')]=_[_0x29e0('0x33')](_0x131034['model'],qs[_0x29e0('0x35')](_0x39e597['query'][_0x29e0('0x35')]));_0x42e498['attributes']=_0x42e498[_0x29e0('0x34')][_0x29e0('0x36')]?_0x42e498[_0x29e0('0x34')]:_0x131034[_0x29e0('0x2f')];if(!_0x39e597[_0x29e0('0x31')][_0x29e0('0x37')](_0x29e0('0x38'))){_0x42e498['limit']=qs['limit'](_0x39e597[_0x29e0('0x31')]['limit']);_0x42e498[_0x29e0('0x1b')]=qs[_0x29e0('0x1b')](_0x39e597[_0x29e0('0x31')]['offset']);}_0x42e498[_0x29e0('0x39')]=qs['sort'](_0x39e597[_0x29e0('0x31')][_0x29e0('0x3a')]);_0x42e498[_0x29e0('0x3b')]=qs[_0x29e0('0x32')](_[_0x29e0('0x3c')](_0x39e597['query'],_0x131034[_0x29e0('0x32')]),_0x475367);if(_0x39e597[_0x29e0('0x31')][_0x29e0('0x3d')]){_0x42e498[_0x29e0('0x3b')]=_['merge'](_0x42e498['where'],{'$or':_[_0x29e0('0x3e')](_0x42e498[_0x29e0('0x34')],function(_0x4f76db){var _0x1ac976={};_0x1ac976[_0x4f76db]={'$like':'%'+_0x39e597['query']['filter']+'%'};return _0x1ac976;})});}_0x42e498=_[_0x29e0('0x3f')]({},_0x42e498,_0x39e597[_0x29e0('0x40')]);var _0x568af1={'where':_0x42e498[_0x29e0('0x3b')]};return db[_0x29e0('0x2d')]['count'](_0x568af1)[_0x29e0('0x24')](function(_0x3375a2){_0x4b0b44[_0x29e0('0x41')]=_0x3375a2;if(_0x39e597[_0x29e0('0x31')][_0x29e0('0x42')]){_0x42e498[_0x29e0('0x43')]=[{'all':!![]}];}return db[_0x29e0('0x2d')]['findAll'](_0x42e498);})['then'](function(_0x59d863){_0x4b0b44[_0x29e0('0x44')]=_0x59d863;return _0x4b0b44;})[_0x29e0('0x24')](respondWithFilteredResult(_0x23c00e,_0x42e498))[_0x29e0('0x45')](handleError(_0x23c00e,null));})[_0x29e0('0x45')](handleError(_0x23c00e,null));};exports[_0x29e0('0x46')]=function(_0x383bfb,_0xb02cf1){var _0x212879={'raw':![],'where':{'id':_0x383bfb[_0x29e0('0x47')]['id']}},_0x2012e3={};_0x2012e3[_0x29e0('0x2f')]=_[_0x29e0('0x30')](db['CmCompany'][_0x29e0('0x48')]);_0x2012e3[_0x29e0('0x31')]=_[_0x29e0('0x30')](_0x383bfb[_0x29e0('0x31')]);_0x2012e3[_0x29e0('0x32')]=_[_0x29e0('0x33')](_0x2012e3[_0x29e0('0x2f')],_0x2012e3[_0x29e0('0x31')]);_0x212879[_0x29e0('0x34')]=_['intersection'](_0x2012e3[_0x29e0('0x2f')],qs[_0x29e0('0x35')](_0x383bfb[_0x29e0('0x31')]['fields']));_0x212879['attributes']=_0x212879[_0x29e0('0x34')]['length']?_0x212879[_0x29e0('0x34')]:_0x2012e3[_0x29e0('0x2f')];if(_0x383bfb[_0x29e0('0x31')][_0x29e0('0x42')]){_0x212879[_0x29e0('0x43')]=[{'all':!![]}];}_0x212879=_[_0x29e0('0x3f')]({},_0x212879,_0x383bfb[_0x29e0('0x40')]);return db['CmCompany'][_0x29e0('0x49')](_0x212879)['then'](handleEntityNotFound(_0xb02cf1,null))[_0x29e0('0x24')](respondWithResult(_0xb02cf1,null))['catch'](handleError(_0xb02cf1,null));};exports[_0x29e0('0x4a')]=function(_0x131c66,_0x11bb45){return db[_0x29e0('0x2d')][_0x29e0('0x4a')](_0x131c66[_0x29e0('0x4b')],{})['then'](function(_0xbebe0){var _0x494625=_0x131c66[_0x29e0('0x4c')][_0x29e0('0x26')]({'plain':!![]});if(!_0x494625)throw new Error(_0x29e0('0x4d'));if(_0x494625[_0x29e0('0x4e')]===_0x29e0('0x4c')){var _0xb8082b=_0xbebe0['get']({'plain':!![]});var _0x19f2ab='Companies';return db[_0x29e0('0x4f')]['find']({'where':{'name':_0x19f2ab,'userProfileId':_0x494625[_0x29e0('0x50')]},'raw':!![]})['then'](function(_0x572b30){if(_0x572b30&&_0x572b30['autoAssociation']===0x0){return db[_0x29e0('0x27')][_0x29e0('0x4a')]({'name':_0xb8082b[_0x29e0('0x2b')],'resourceId':_0xb8082b['id'],'type':_0x572b30[_0x29e0('0x2b')],'sectionId':_0x572b30['id']},{})['then'](function(){return _0xbebe0;});}else{return _0xbebe0;}})[_0x29e0('0x45')](function(_0x30a53b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30a53b);throw _0x30a53b;});}return _0xbebe0;})[_0x29e0('0x24')](respondWithResult(_0x11bb45,0xc9))[_0x29e0('0x45')](handleError(_0x11bb45,null));};exports[_0x29e0('0x23')]=function(_0x5dcf17,_0x574e14){if(_0x5dcf17[_0x29e0('0x4b')]['id']){delete _0x5dcf17[_0x29e0('0x4b')]['id'];}return db['CmCompany'][_0x29e0('0x49')]({'where':{'id':_0x5dcf17[_0x29e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x574e14,null))[_0x29e0('0x24')](saveUpdates(_0x5dcf17[_0x29e0('0x4b')],null))[_0x29e0('0x24')](respondWithResult(_0x574e14,null))['catch'](handleError(_0x574e14,null));};exports['destroy']=function(_0x3d4691,_0x54873d){return db[_0x29e0('0x2d')]['find']({'where':{'id':_0x3d4691[_0x29e0('0x47')]['id']}})['then'](handleEntityNotFound(_0x54873d,null))[_0x29e0('0x24')](removeEntity(_0x54873d,null))[_0x29e0('0x45')](handleError(_0x54873d,null));};exports[_0x29e0('0x2e')]=function(_0x3c3476,_0x400d17){return db['CmCompany'][_0x29e0('0x2e')]()[_0x29e0('0x24')](respondWithResult(_0x400d17,null))[_0x29e0('0x45')](handleError(_0x400d17,null));};exports[_0x29e0('0x51')]=function(_0x282087,_0x44f490,_0x5d5a9b){return db[_0x29e0('0x52')][_0x29e0('0x49')]({'where':{'id':_0x282087[_0x29e0('0x47')]['id']}})[_0x29e0('0x24')](handleEntityNotFound(_0x44f490,null))[_0x29e0('0x24')](function(_0x3c1884){if(_0x3c1884){return _0x3c1884['addContacts'](_0x282087[_0x29e0('0x4b')][_0x29e0('0x53')],_[_0x29e0('0x54')](_0x282087[_0x29e0('0x4b')],[_0x29e0('0x53'),'id'])||{});}})['then'](respondWithResult(_0x44f490,null))[_0x29e0('0x45')](handleError(_0x44f490,null));};exports['getContacts']=function(_0x2e05fc,_0x1f5c5f,_0x254031){var _0x5e1a73={};var _0x5e709f={};var _0x4451c0;var _0xa3458f;return db['CmCompany'][_0x29e0('0x55')]({'where':{'id':_0x2e05fc[_0x29e0('0x47')]['id']}})[_0x29e0('0x24')](handleEntityNotFound(_0x1f5c5f,null))['then'](function(_0x44bfff){if(_0x44bfff){_0x4451c0=_0x44bfff;_0x5e709f[_0x29e0('0x2f')]=_['keys'](db[_0x29e0('0x52')][_0x29e0('0x48')]);_0x5e709f[_0x29e0('0x31')]=_[_0x29e0('0x30')](_0x2e05fc[_0x29e0('0x31')]);_0x5e709f['filters']=_['intersection'](_0x5e709f[_0x29e0('0x2f')],_0x5e709f['query']);_0x5e1a73['attributes']=_[_0x29e0('0x33')](_0x5e709f['model'],qs[_0x29e0('0x35')](_0x2e05fc[_0x29e0('0x31')]['fields']));_0x5e1a73['attributes']=_0x5e1a73[_0x29e0('0x34')][_0x29e0('0x36')]?_0x5e1a73['attributes']:_0x5e709f[_0x29e0('0x2f')];_0x5e1a73[_0x29e0('0x39')]=qs[_0x29e0('0x3a')](_0x2e05fc['query'][_0x29e0('0x3a')]);_0x5e1a73['where']=qs[_0x29e0('0x32')](_[_0x29e0('0x3c')](_0x2e05fc[_0x29e0('0x31')],_0x5e709f[_0x29e0('0x32')]));if(_0x2e05fc[_0x29e0('0x31')][_0x29e0('0x3d')]){_0x5e1a73[_0x29e0('0x3b')]=_['merge'](_0x5e1a73[_0x29e0('0x3b')],{'$or':_[_0x29e0('0x3e')](_0x5e1a73[_0x29e0('0x34')],function(_0x526f54){var _0x228de4={};_0x228de4[_0x526f54]={'$like':'%'+_0x2e05fc[_0x29e0('0x31')][_0x29e0('0x3d')]+'%'};return _0x228de4;})});}_0x5e1a73=_[_0x29e0('0x3f')]({},_0x5e1a73,_0x2e05fc[_0x29e0('0x40')]);return _0x4451c0[_0x29e0('0x56')](_0x5e1a73);}})[_0x29e0('0x24')](function(_0x36e9bb){if(_0x36e9bb){_0xa3458f=_0x36e9bb['length'];if(!_0x2e05fc[_0x29e0('0x31')][_0x29e0('0x37')](_0x29e0('0x38'))){_0x5e1a73[_0x29e0('0x1d')]=qs[_0x29e0('0x1d')](_0x2e05fc[_0x29e0('0x31')]['limit']);_0x5e1a73[_0x29e0('0x1b')]=qs[_0x29e0('0x1b')](_0x2e05fc['query']['offset']);}return _0x4451c0['getContacts'](_0x5e1a73);}})[_0x29e0('0x24')](function(_0x1a0f92){if(_0x1a0f92){return _0x1a0f92?{'count':_0xa3458f,'rows':_0x1a0f92}:null;}})['then'](respondWithResult(_0x1f5c5f,null))[_0x29e0('0x45')](handleError(_0x1f5c5f,null));}; \ No newline at end of file +var _0xb8d5=['include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','omit','getContacts','findOne','CmContact','rawAttributes','sort','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','then','get','UserProfileResource','destroy','end','error','name','index','CmCompany','describe','keys','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','pick','filter','where','merge','map','options','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb8d5,0xc7));var _0x5b8d=function(_0x186d3b,_0x25d00c){_0x186d3b=_0x186d3b-0x0;var _0x278910=_0xb8d5[_0x186d3b];return _0x278910;};'use strict';var emlformat=require(_0x5b8d('0x0'));var rimraf=require(_0x5b8d('0x1'));var zipdir=require(_0x5b8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5b8d('0x3'));var Mustache=require(_0x5b8d('0x4'));var util=require(_0x5b8d('0x5'));var path=require(_0x5b8d('0x6'));var sox=require(_0x5b8d('0x7'));var csv=require(_0x5b8d('0x8'));var ejs=require(_0x5b8d('0x9'));var fs=require('fs');var fs_extra=require(_0x5b8d('0xa'));var _=require(_0x5b8d('0xb'));var squel=require(_0x5b8d('0xc'));var crypto=require(_0x5b8d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5b8d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b8d('0xf'));var Papa=require(_0x5b8d('0x10'));var Redis=require(_0x5b8d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b8d('0x12'));var as=require(_0x5b8d('0x13'));var hardwareService=require(_0x5b8d('0x14'));var logger=require('../../config/logger')(_0x5b8d('0x15'));var utils=require('../../config/utils');var config=require(_0x5b8d('0x16'));var licenseUtil=require(_0x5b8d('0x17'));var db=require(_0x5b8d('0x18'))['db'];function respondWithStatusCode(_0xb46210,_0x52416c){_0x52416c=_0x52416c||0xcc;return function(_0x56a76d){if(_0x56a76d){return _0xb46210[_0x5b8d('0x19')](_0x52416c);}return _0xb46210[_0x5b8d('0x1a')](_0x52416c)['end']();};}function respondWithResult(_0x26eca4,_0xe5d3fa){_0xe5d3fa=_0xe5d3fa||0xc8;return function(_0xaa4342){if(_0xaa4342){return _0x26eca4[_0x5b8d('0x1a')](_0xe5d3fa)[_0x5b8d('0x1b')](_0xaa4342);}};}function respondWithFilteredResult(_0x409b95,_0x514787){return function(_0x201ca9){if(_0x201ca9){var _0x2cf1eb=typeof _0x514787[_0x5b8d('0x1c')]===_0x5b8d('0x1d')&&typeof _0x514787[_0x5b8d('0x1e')]==='undefined';var _0x43936e=_0x201ca9[_0x5b8d('0x1f')];var _0x551cc8=_0x2cf1eb?0x0:_0x514787[_0x5b8d('0x1c')];var _0xff10e=_0x2cf1eb?_0x201ca9['count']:_0x514787[_0x5b8d('0x1c')]+_0x514787[_0x5b8d('0x1e')];var _0x39a348;if(_0xff10e>=_0x43936e){_0xff10e=_0x43936e;_0x39a348=0xc8;}else{_0x39a348=0xce;}_0x409b95[_0x5b8d('0x1a')](_0x39a348);return _0x409b95['set']('Content-Range',_0x551cc8+'-'+_0xff10e+'/'+_0x43936e)[_0x5b8d('0x1b')](_0x201ca9);}return null;};}function patchUpdates(_0x4f7017){return function(_0x248c62){try{jsonpatch[_0x5b8d('0x20')](_0x248c62,_0x4f7017,!![]);}catch(_0x590de0){return BPromise[_0x5b8d('0x21')](_0x590de0);}return _0x248c62['save']();};}function saveUpdates(_0x5c5627,_0x2b9997){return function(_0x49687c){if(_0x49687c){return _0x49687c['update'](_0x5c5627)[_0x5b8d('0x22')](function(_0x8fa4fc){return _0x8fa4fc;});}return null;};}function removeEntity(_0x5b0eba,_0x32531d){return function(_0x55f7dc){if(_0x55f7dc){return _0x55f7dc['destroy']()[_0x5b8d('0x22')](function(){var _0x432e4f=_0x55f7dc[_0x5b8d('0x23')]({'plain':!![]});var _0x5a965c='Companies';return db[_0x5b8d('0x24')][_0x5b8d('0x25')]({'where':{'type':_0x5a965c,'resourceId':_0x432e4f['id']}})['then'](function(){return _0x55f7dc;});})['then'](function(){_0x5b0eba[_0x5b8d('0x1a')](0xcc)[_0x5b8d('0x26')]();});}};}function handleEntityNotFound(_0x556b9b,_0x455b54){return function(_0x57870f){if(!_0x57870f){_0x556b9b[_0x5b8d('0x19')](0x194);}return _0x57870f;};}function handleError(_0x140206,_0x578254){_0x578254=_0x578254||0x1f4;return function(_0x2c3d61){logger[_0x5b8d('0x27')](_0x2c3d61['stack']);if(_0x2c3d61[_0x5b8d('0x28')]){delete _0x2c3d61[_0x5b8d('0x28')];}_0x140206['status'](_0x578254)['send'](_0x2c3d61);};}exports[_0x5b8d('0x29')]=function(_0xc12e56,_0x3db4c9){var _0x11ba31={},_0x1960da={},_0x2d4fda={'count':0x0,'rows':[]};return db[_0x5b8d('0x2a')][_0x5b8d('0x2b')]()[_0x5b8d('0x22')](function(_0xf3516c){_0x1960da['model']=_[_0x5b8d('0x2c')](_0xf3516c);_0x1960da[_0x5b8d('0x2d')]=_[_0x5b8d('0x2c')](_0xc12e56[_0x5b8d('0x2d')]);_0x1960da[_0x5b8d('0x2e')]=_[_0x5b8d('0x2f')](_0x1960da['model'],_0x1960da[_0x5b8d('0x2d')]);_0x11ba31['attributes']=_[_0x5b8d('0x2f')](_0x1960da['model'],qs[_0x5b8d('0x30')](_0xc12e56[_0x5b8d('0x2d')][_0x5b8d('0x30')]));_0x11ba31[_0x5b8d('0x31')]=_0x11ba31['attributes'][_0x5b8d('0x32')]?_0x11ba31[_0x5b8d('0x31')]:_0x1960da[_0x5b8d('0x33')];if(!_0xc12e56[_0x5b8d('0x2d')][_0x5b8d('0x34')](_0x5b8d('0x35'))){_0x11ba31['limit']=qs['limit'](_0xc12e56[_0x5b8d('0x2d')][_0x5b8d('0x1e')]);_0x11ba31[_0x5b8d('0x1c')]=qs['offset'](_0xc12e56[_0x5b8d('0x2d')]['offset']);}_0x11ba31[_0x5b8d('0x36')]=qs['sort'](_0xc12e56['query']['sort']);_0x11ba31['where']=qs['filters'](_[_0x5b8d('0x37')](_0xc12e56[_0x5b8d('0x2d')],_0x1960da['filters']),_0xf3516c);if(_0xc12e56['query'][_0x5b8d('0x38')]){_0x11ba31[_0x5b8d('0x39')]=_[_0x5b8d('0x3a')](_0x11ba31[_0x5b8d('0x39')],{'$or':_[_0x5b8d('0x3b')](_0x11ba31[_0x5b8d('0x31')],function(_0x2ebe97){var _0x1a6751={};_0x1a6751[_0x2ebe97]={'$like':'%'+_0xc12e56[_0x5b8d('0x2d')]['filter']+'%'};return _0x1a6751;})});}_0x11ba31=_[_0x5b8d('0x3a')]({},_0x11ba31,_0xc12e56[_0x5b8d('0x3c')]);var _0x536ced={'where':_0x11ba31[_0x5b8d('0x39')]};return db[_0x5b8d('0x2a')][_0x5b8d('0x1f')](_0x536ced)['then'](function(_0xd23313){_0x2d4fda[_0x5b8d('0x1f')]=_0xd23313;if(_0xc12e56[_0x5b8d('0x2d')][_0x5b8d('0x3d')]){_0x11ba31[_0x5b8d('0x3e')]=[{'all':!![]}];}return db[_0x5b8d('0x2a')][_0x5b8d('0x3f')](_0x11ba31);})['then'](function(_0x4593c3){_0x2d4fda[_0x5b8d('0x40')]=_0x4593c3;return _0x2d4fda;})[_0x5b8d('0x22')](respondWithFilteredResult(_0x3db4c9,_0x11ba31))['catch'](handleError(_0x3db4c9,null));})[_0x5b8d('0x41')](handleError(_0x3db4c9,null));};exports[_0x5b8d('0x42')]=function(_0x4a5cb4,_0x16972a){var _0x40ba7c={'raw':![],'where':{'id':_0x4a5cb4[_0x5b8d('0x43')]['id']}},_0x5b2895={};_0x5b2895['model']=_[_0x5b8d('0x2c')](db[_0x5b8d('0x2a')]['rawAttributes']);_0x5b2895[_0x5b8d('0x2d')]=_['keys'](_0x4a5cb4[_0x5b8d('0x2d')]);_0x5b2895[_0x5b8d('0x2e')]=_[_0x5b8d('0x2f')](_0x5b2895[_0x5b8d('0x33')],_0x5b2895[_0x5b8d('0x2d')]);_0x40ba7c[_0x5b8d('0x31')]=_['intersection'](_0x5b2895['model'],qs[_0x5b8d('0x30')](_0x4a5cb4['query']['fields']));_0x40ba7c['attributes']=_0x40ba7c[_0x5b8d('0x31')][_0x5b8d('0x32')]?_0x40ba7c['attributes']:_0x5b2895['model'];if(_0x4a5cb4[_0x5b8d('0x2d')][_0x5b8d('0x3d')]){_0x40ba7c[_0x5b8d('0x3e')]=[{'all':!![]}];}_0x40ba7c=_[_0x5b8d('0x3a')]({},_0x40ba7c,_0x4a5cb4['options']);return db[_0x5b8d('0x2a')][_0x5b8d('0x44')](_0x40ba7c)[_0x5b8d('0x22')](handleEntityNotFound(_0x16972a,null))['then'](respondWithResult(_0x16972a,null))[_0x5b8d('0x41')](handleError(_0x16972a,null));};exports[_0x5b8d('0x45')]=function(_0x544b56,_0x1a29fa){return db['CmCompany']['create'](_0x544b56['body'],{})[_0x5b8d('0x22')](function(_0x580c32){var _0x4ce837=_0x544b56[_0x5b8d('0x46')][_0x5b8d('0x23')]({'plain':!![]});if(!_0x4ce837)throw new Error(_0x5b8d('0x47'));if(_0x4ce837[_0x5b8d('0x48')]===_0x5b8d('0x46')){var _0x1c8d6a=_0x580c32[_0x5b8d('0x23')]({'plain':!![]});var _0x474924=_0x5b8d('0x49');return db[_0x5b8d('0x4a')][_0x5b8d('0x44')]({'where':{'name':_0x474924,'userProfileId':_0x4ce837[_0x5b8d('0x4b')]},'raw':!![]})['then'](function(_0x1a5147){if(_0x1a5147&&_0x1a5147[_0x5b8d('0x4c')]===0x0){return db[_0x5b8d('0x24')]['create']({'name':_0x1c8d6a[_0x5b8d('0x28')],'resourceId':_0x1c8d6a['id'],'type':_0x1a5147[_0x5b8d('0x28')],'sectionId':_0x1a5147['id']},{})['then'](function(){return _0x580c32;});}else{return _0x580c32;}})['catch'](function(_0x1ac492){logger[_0x5b8d('0x27')](_0x5b8d('0x4d'),_0x1ac492);throw _0x1ac492;});}return _0x580c32;})[_0x5b8d('0x22')](respondWithResult(_0x1a29fa,0xc9))[_0x5b8d('0x41')](handleError(_0x1a29fa,null));};exports['update']=function(_0x25e632,_0x572b25){if(_0x25e632[_0x5b8d('0x4e')]['id']){delete _0x25e632[_0x5b8d('0x4e')]['id'];}return db[_0x5b8d('0x2a')]['find']({'where':{'id':_0x25e632[_0x5b8d('0x43')]['id']}})[_0x5b8d('0x22')](handleEntityNotFound(_0x572b25,null))['then'](saveUpdates(_0x25e632['body'],null))[_0x5b8d('0x22')](respondWithResult(_0x572b25,null))[_0x5b8d('0x41')](handleError(_0x572b25,null));};exports['destroy']=function(_0x8e8855,_0x14276b){return db[_0x5b8d('0x2a')]['find']({'where':{'id':_0x8e8855[_0x5b8d('0x43')]['id']}})['then'](handleEntityNotFound(_0x14276b,null))[_0x5b8d('0x22')](removeEntity(_0x14276b,null))[_0x5b8d('0x41')](handleError(_0x14276b,null));};exports['describe']=function(_0x1c0e3a,_0x331b68){return db[_0x5b8d('0x2a')][_0x5b8d('0x2b')]()[_0x5b8d('0x22')](respondWithResult(_0x331b68,null))[_0x5b8d('0x41')](handleError(_0x331b68,null));};exports['addContacts']=function(_0x17132d,_0x1d4a8d,_0x34d4fd){return db['CmContact']['find']({'where':{'id':_0x17132d[_0x5b8d('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d4a8d,null))[_0x5b8d('0x22')](function(_0x5b36e9){if(_0x5b36e9){return _0x5b36e9[_0x5b8d('0x4f')](_0x17132d[_0x5b8d('0x4e')][_0x5b8d('0x50')],_[_0x5b8d('0x51')](_0x17132d[_0x5b8d('0x4e')],[_0x5b8d('0x50'),'id'])||{});}})[_0x5b8d('0x22')](respondWithResult(_0x1d4a8d,null))['catch'](handleError(_0x1d4a8d,null));};exports[_0x5b8d('0x52')]=function(_0xdbaaff,_0xb3df0,_0x38c5e8){var _0x192d95={};var _0x5b27f1={};var _0x59dcca;var _0x2a51d9;return db[_0x5b8d('0x2a')][_0x5b8d('0x53')]({'where':{'id':_0xdbaaff['params']['id']}})[_0x5b8d('0x22')](handleEntityNotFound(_0xb3df0,null))[_0x5b8d('0x22')](function(_0x5cd3c2){if(_0x5cd3c2){_0x59dcca=_0x5cd3c2;_0x5b27f1[_0x5b8d('0x33')]=_[_0x5b8d('0x2c')](db[_0x5b8d('0x54')][_0x5b8d('0x55')]);_0x5b27f1[_0x5b8d('0x2d')]=_[_0x5b8d('0x2c')](_0xdbaaff[_0x5b8d('0x2d')]);_0x5b27f1['filters']=_[_0x5b8d('0x2f')](_0x5b27f1[_0x5b8d('0x33')],_0x5b27f1[_0x5b8d('0x2d')]);_0x192d95['attributes']=_[_0x5b8d('0x2f')](_0x5b27f1[_0x5b8d('0x33')],qs[_0x5b8d('0x30')](_0xdbaaff[_0x5b8d('0x2d')][_0x5b8d('0x30')]));_0x192d95[_0x5b8d('0x31')]=_0x192d95[_0x5b8d('0x31')]['length']?_0x192d95[_0x5b8d('0x31')]:_0x5b27f1[_0x5b8d('0x33')];_0x192d95[_0x5b8d('0x36')]=qs[_0x5b8d('0x56')](_0xdbaaff[_0x5b8d('0x2d')][_0x5b8d('0x56')]);_0x192d95[_0x5b8d('0x39')]=qs[_0x5b8d('0x2e')](_[_0x5b8d('0x37')](_0xdbaaff[_0x5b8d('0x2d')],_0x5b27f1[_0x5b8d('0x2e')]));if(_0xdbaaff[_0x5b8d('0x2d')]['filter']){_0x192d95[_0x5b8d('0x39')]=_[_0x5b8d('0x3a')](_0x192d95[_0x5b8d('0x39')],{'$or':_[_0x5b8d('0x3b')](_0x192d95[_0x5b8d('0x31')],function(_0x19e58d){var _0x490f17={};_0x490f17[_0x19e58d]={'$like':'%'+_0xdbaaff['query'][_0x5b8d('0x38')]+'%'};return _0x490f17;})});}_0x192d95=_[_0x5b8d('0x3a')]({},_0x192d95,_0xdbaaff['options']);return _0x59dcca[_0x5b8d('0x52')](_0x192d95);}})['then'](function(_0x532ba0){if(_0x532ba0){_0x2a51d9=_0x532ba0['length'];if(!_0xdbaaff[_0x5b8d('0x2d')]['hasOwnProperty'](_0x5b8d('0x35'))){_0x192d95[_0x5b8d('0x1e')]=qs[_0x5b8d('0x1e')](_0xdbaaff[_0x5b8d('0x2d')][_0x5b8d('0x1e')]);_0x192d95[_0x5b8d('0x1c')]=qs[_0x5b8d('0x1c')](_0xdbaaff[_0x5b8d('0x2d')][_0x5b8d('0x1c')]);}return _0x59dcca[_0x5b8d('0x52')](_0x192d95);}})[_0x5b8d('0x22')](function(_0x5488e2){if(_0x5488e2){return _0x5488e2?{'count':_0x2a51d9,'rows':_0x5488e2}:null;}})['then'](respondWithResult(_0xb3df0,null))['catch'](handleError(_0xb3df0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index af524b2..407e4a4 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 _0x2fc4=['../../config/environment','./cmCompany.attributes','exports','CmCompany','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x77d720,_0x4a5272){var _0x1bbdb3=function(_0x39926d){while(--_0x39926d){_0x77d720['push'](_0x77d720['shift']());}};_0x1bbdb3(++_0x4a5272);}(_0x2fc4,0x1bc));var _0x42fc=function(_0x2d604c,_0x49ac1b){_0x2d604c=_0x2d604c-0x0;var _0x2312e4=_0x2fc4[_0x2d604c];return _0x2312e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x42fc('0x0'))(_0x42fc('0x1'));var moment=require(_0x42fc('0x2'));var BPromise=require(_0x42fc('0x3'));var rp=require(_0x42fc('0x4'));var fs=require('fs');var path=require(_0x42fc('0x5'));var rimraf=require('rimraf');var config=require(_0x42fc('0x6'));var attributes=require(_0x42fc('0x7'));module[_0x42fc('0x8')]=function(_0x5a18db,_0x583105){return _0x5a18db['define'](_0x42fc('0x9'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c57=['api','bluebird','request-promise','path','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0x2ca865,_0x93e8bf){var _0x31510d=function(_0x182b9b){while(--_0x182b9b){_0x2ca865['push'](_0x2ca865['shift']());}};_0x31510d(++_0x93e8bf);}(_0x4c57,0x81));var _0x74c5=function(_0x5b942d,_0x1cc659){_0x5b942d=_0x5b942d-0x0;var _0x2e3f86=_0x4c57[_0x5b942d];return _0x2e3f86;};'use strict';var _=require(_0x74c5('0x0'));var util=require(_0x74c5('0x1'));var logger=require(_0x74c5('0x2'))(_0x74c5('0x3'));var moment=require('moment');var BPromise=require(_0x74c5('0x4'));var rp=require(_0x74c5('0x5'));var fs=require('fs');var path=require(_0x74c5('0x6'));var rimraf=require('rimraf');var config=require(_0x74c5('0x7'));var attributes=require('./cmCompany.attributes');module[_0x74c5('0x8')]=function(_0x4b8d2b,_0x4c512a){return _0x4b8d2b[_0x74c5('0x9')](_0x74c5('0xa'),attributes,{'tableName':_0x74c5('0xb'),'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 d406add..34c7439 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 _0x9f7a=['bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f7a,0xba));var _0xa9f7=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x9f7a[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xa9f7('0x0'));var util=require(_0xa9f7('0x1'));var moment=require(_0xa9f7('0x2'));var BPromise=require(_0xa9f7('0x3'));var rs=require(_0xa9f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa9f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa9f7('0x6'));var jayson=require(_0xa9f7('0x7'));var client=jayson[_0xa9f7('0x8')][_0xa9f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x88d74f,_0x331ca1,_0x2c8eea){return new BPromise(function(_0x28b36c,_0x225f40){return client[_0xa9f7('0xa')](_0x88d74f,_0x2c8eea)['then'](function(_0x5d2a9c){logger[_0xa9f7('0xb')](_0xa9f7('0xc'),_0x331ca1,_0xa9f7('0xd'));logger[_0xa9f7('0xe')](_0xa9f7('0xf'),_0x331ca1,_0xa9f7('0xd'),JSON[_0xa9f7('0x10')](_0x5d2a9c));if(_0x5d2a9c['error']){if(_0x5d2a9c[_0xa9f7('0x11')][_0xa9f7('0x12')]===0x1f4){logger['error'](_0xa9f7('0xc'),_0x331ca1,_0x5d2a9c[_0xa9f7('0x11')][_0xa9f7('0x13')]);return _0x225f40(_0x5d2a9c['error']['message']);}logger[_0xa9f7('0x11')](_0xa9f7('0xc'),_0x331ca1,_0x5d2a9c['error'][_0xa9f7('0x13')]);return _0x28b36c(_0x5d2a9c[_0xa9f7('0x11')][_0xa9f7('0x13')]);}else{logger[_0xa9f7('0xb')](_0xa9f7('0xc'),_0x331ca1,_0xa9f7('0xd'));_0x28b36c(_0x5d2a9c['result'][_0xa9f7('0x13')]);}})[_0xa9f7('0x14')](function(_0x223b4c){logger[_0xa9f7('0x11')](_0xa9f7('0xc'),_0x331ca1,_0x223b4c);_0x225f40(_0x223b4c);});});} \ No newline at end of file +var _0x1666=['http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x2aba0f,_0x29a10c){var _0x26e2ac=function(_0x278db7){while(--_0x278db7){_0x2aba0f['push'](_0x2aba0f['shift']());}};_0x26e2ac(++_0x29a10c);}(_0x1666,0x107));var _0x6166=function(_0x2197f7,_0x2a2d89){_0x2197f7=_0x2197f7-0x0;var _0x522991=_0x1666[_0x2197f7];return _0x522991;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require(_0x6166('0x2'));var BPromise=require(_0x6166('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))(_0x6166('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6166('0x9')][_0x6166('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf84b7,_0x3f84c0,_0x23b00c){return new BPromise(function(_0x544e39,_0x1eee6f){return client[_0x6166('0xb')](_0xf84b7,_0x23b00c)[_0x6166('0xc')](function(_0x5bab4b){logger[_0x6166('0xd')](_0x6166('0xe'),_0x3f84c0,_0x6166('0xf'));logger['debug'](_0x6166('0x10'),_0x3f84c0,_0x6166('0xf'),JSON['stringify'](_0x5bab4b));if(_0x5bab4b[_0x6166('0x11')]){if(_0x5bab4b[_0x6166('0x11')]['code']===0x1f4){logger[_0x6166('0x11')]('CmCompany,\x20%s,\x20%s',_0x3f84c0,_0x5bab4b['error'][_0x6166('0x12')]);return _0x1eee6f(_0x5bab4b['error'][_0x6166('0x12')]);}logger[_0x6166('0x11')](_0x6166('0xe'),_0x3f84c0,_0x5bab4b['error'][_0x6166('0x12')]);return _0x544e39(_0x5bab4b['error'][_0x6166('0x12')]);}else{logger[_0x6166('0xd')]('CmCompany,\x20%s,\x20%s',_0x3f84c0,'request\x20sent');_0x544e39(_0x5bab4b[_0x6166('0x13')][_0x6166('0x12')]);}})[_0x6166('0x14')](function(_0x4a26b9){logger['error'](_0x6166('0xe'),_0x3f84c0,_0x4a26b9);_0x1eee6f(_0x4a26b9);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 94d4803..4d29e3d 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 _0x8a87=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','/:id/contacts','getContacts','post','put','/:id','update','destroy','exports','multer'];(function(_0x3cc90b,_0x1b69d9){var _0x34051b=function(_0x1f01f7){while(--_0x1f01f7){_0x3cc90b['push'](_0x3cc90b['shift']());}};_0x34051b(++_0x1b69d9);}(_0x8a87,0x6b));var _0x78a8=function(_0x4eb269,_0x3cd1b6){_0x4eb269=_0x4eb269-0x0;var _0x1597b8=_0x8a87[_0x4eb269];return _0x1597b8;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x78a8('0x1'));var express=require('express');var router=express[_0x78a8('0x2')]();var fs_extra=require(_0x78a8('0x3'));var auth=require(_0x78a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78a8('0x5'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x78a8('0x6')](),controller[_0x78a8('0x7')]);router[_0x78a8('0x8')](_0x78a8('0x9'),auth[_0x78a8('0x6')](),controller['describe']);router[_0x78a8('0x8')]('/:id',auth[_0x78a8('0x6')](),controller['show']);router[_0x78a8('0x8')](_0x78a8('0xa'),auth[_0x78a8('0x6')](),controller[_0x78a8('0xb')]);router[_0x78a8('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x78a8('0xc')](_0x78a8('0xa'),auth[_0x78a8('0x6')](),controller['addContacts']);router[_0x78a8('0xd')](_0x78a8('0xe'),auth[_0x78a8('0x6')](),controller[_0x78a8('0xf')]);router['delete'](_0x78a8('0xe'),auth[_0x78a8('0x6')](),controller[_0x78a8('0x10')]);module[_0x78a8('0x11')]=router; \ No newline at end of file +var _0x1635=['../../config/environment','get','index','isAuthenticated','describe','/:id','/:id/contacts','getContacts','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service'];(function(_0x20c19f,_0xe79d0e){var _0x4e6151=function(_0x5744a9){while(--_0x5744a9){_0x20c19f['push'](_0x20c19f['shift']());}};_0x4e6151(++_0xe79d0e);}(_0x1635,0xea));var _0x5163=function(_0x2dd69d,_0x34fb32){_0x2dd69d=_0x2dd69d-0x0;var _0x31149b=_0x1635[_0x2dd69d];return _0x31149b;};'use strict';var multer=require(_0x5163('0x0'));var util=require(_0x5163('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5163('0x2'));var router=express[_0x5163('0x3')]();var fs_extra=require(_0x5163('0x4'));var auth=require(_0x5163('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5163('0x6'));var controller=require('./cmCompany.controller');router[_0x5163('0x7')]('/',auth['isAuthenticated'](),controller[_0x5163('0x8')]);router[_0x5163('0x7')]('/describe',auth[_0x5163('0x9')](),controller[_0x5163('0xa')]);router[_0x5163('0x7')](_0x5163('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x5163('0xc'),auth[_0x5163('0x9')](),controller[_0x5163('0xd')]);router[_0x5163('0xe')]('/',auth[_0x5163('0x9')](),controller[_0x5163('0xf')]);router[_0x5163('0xe')](_0x5163('0xc'),auth['isAuthenticated'](),controller['addContacts']);router[_0x5163('0x10')](_0x5163('0xb'),auth[_0x5163('0x9')](),controller['update']);router[_0x5163('0x11')](_0x5163('0xb'),auth[_0x5163('0x9')](),controller[_0x5163('0x12')]);module[_0x5163('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index de16c97..e54023d 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 _0x148c=['sequelize','exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x12b731,_0x4d834c){var _0x2a6976=function(_0x4bda8f){while(--_0x4bda8f){_0x12b731['push'](_0x12b731['shift']());}};_0x2a6976(++_0x4d834c);}(_0x148c,0x13f));var _0xc148=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x148c[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xc148('0x0'));var Sequelize=require(_0xc148('0x1'));module[_0xc148('0x2')]={'firstName':{'type':Sequelize[_0xc148('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc148('0x3')]},'street':{'type':Sequelize[_0xc148('0x3')]},'postalCode':{'type':Sequelize[_0xc148('0x3')]},'city':{'type':Sequelize[_0xc148('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xc148('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xc148('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xc148('0x3')]},'fb_data':{'type':Sequelize[_0xc148('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xc148('0x3')]},'teams':{'type':Sequelize[_0xc148('0x3')]},'viber':{'type':Sequelize[_0xc148('0x3')]},'line':{'type':Sequelize[_0xc148('0x3')]},'wechat':{'type':Sequelize[_0xc148('0x3')]},'telegram':{'type':Sequelize[_0xc148('0x3')]},'UserId':{'type':Sequelize[_0xc148('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xc148('0x3')]},'priority':{'type':Sequelize[_0xc148('0x4')](0x2)[_0xc148('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc148('0x6')],'defaultValue':Sequelize[_0xc148('0x7')]},'dialTimezone':{'type':Sequelize[_0xc148('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xf306=['INTEGER','lodash','sequelize','exports','STRING','TEXT'];(function(_0x477daf,_0x324543){var _0x26dd75=function(_0x3502ae){while(--_0x3502ae){_0x477daf['push'](_0x477daf['shift']());}};_0x26dd75(++_0x324543);}(_0xf306,0x145));var _0x6f30=function(_0x1760e9,_0xbbfd0b){_0x1760e9=_0x1760e9-0x0;var _0x3fe586=_0xf306[_0x1760e9];return _0x3fe586;};'use strict';var _=require(_0x6f30('0x0'));var Sequelize=require(_0x6f30('0x1'));module[_0x6f30('0x2')]={'firstName':{'type':Sequelize[_0x6f30('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6f30('0x3')]},'street':{'type':Sequelize[_0x6f30('0x3')]},'postalCode':{'type':Sequelize[_0x6f30('0x3')]},'city':{'type':Sequelize[_0x6f30('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6f30('0x3')]},'description':{'type':Sequelize[_0x6f30('0x4')]},'phone':{'type':Sequelize[_0x6f30('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6f30('0x3')]},'email':{'type':Sequelize[_0x6f30('0x3')]},'url':{'type':Sequelize[_0x6f30('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x6f30('0x3')]},'twitter':{'type':Sequelize[_0x6f30('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x6f30('0x3')]},'viber':{'type':Sequelize[_0x6f30('0x3')]},'line':{'type':Sequelize[_0x6f30('0x3')]},'wechat':{'type':Sequelize[_0x6f30('0x3')]},'telegram':{'type':Sequelize[_0x6f30('0x3')]},'UserId':{'type':Sequelize[_0x6f30('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x6f30('0x3')]},'priority':{'type':Sequelize[_0x6f30('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x6f30('0x3')]},'utcOffset':{'type':Sequelize[_0x6f30('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f0d158f..da51ad1 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 _0x8410=['items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','includeAll','include','getHopperHistories','CmHopperHistory','rows','ContactId','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','zipObject','firstName','root','server/files/tmp','filename','chmodSync','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','file','parse','import','User','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','importUpdates','agent','../../components/import/cm/csvUpdates','exit','error\x20child\x20process','getJourney','mail','chat','sms','fax','whatsapp','voice','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','type','source','destination','callerid','starttime','endtime','duration','note','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','createdAt','secondDisposition','key','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','openchannel','externalUrl','threadId','Interaction','Owner','flatten','sortBy','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','status','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','name','send','index','describe','getOptions','findAll','query','catch','CmContact','find','params','tags','keys','startsWith','cf_','columnName','displayName','CmCustomField','alias','custom','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','get','length','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isArray','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','Tag','Tags','color','tag','CmContactHasItem','Phones','ItemType','sequelize','literal','$and','map','format','cf_%d','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','options','nolimit','setTags','setAdditionalPhones','all','OrderBy','item_types'];(function(_0x2d0a5c,_0x2321bc){var _0x3267bc=function(_0x30c03d){while(--_0x30c03d){_0x2d0a5c['push'](_0x2d0a5c['shift']());}};_0x3267bc(++_0x2321bc);}(_0x8410,0x175));var _0x0841=function(_0x402d17,_0x3e5f70){_0x402d17=_0x402d17-0x0;var _0x30c35f=_0x8410[_0x402d17];return _0x30c35f;};'use strict';var moment=require(_0x0841('0x0'));var BPromise=require(_0x0841('0x1'));var util=require(_0x0841('0x2'));var path=require(_0x0841('0x3'));var fs=require('fs');var _=require(_0x0841('0x4'));var squel=require(_0x0841('0x5'));var Papa=require(_0x0841('0x6'));var Redis=require(_0x0841('0x7'));var contacts=require(_0x0841('0x8'));var qs=require(_0x0841('0x9'));var logger=require('../../config/logger')(_0x0841('0xa'));var config=require(_0x0841('0xb'));var shared=require(_0x0841('0xc'));var db=require(_0x0841('0xd'))['db'];config[_0x0841('0xe')]=_[_0x0841('0xf')](config[_0x0841('0xe')],{'host':_0x0841('0x10'),'port':0x18eb});var socket=require(_0x0841('0x11'))(new Redis(config[_0x0841('0xe')]));require(_0x0841('0x12'))['register'](socket);function respondWithResult(_0x5a9975,_0x3f7bbd){_0x3f7bbd=_0x3f7bbd||0xc8;return function(_0x1044f6){if(_0x1044f6){return _0x5a9975[_0x0841('0x13')](_0x3f7bbd)[_0x0841('0x14')](_0x1044f6);}};}function respondWithFilteredResult(_0x290be7,_0x31fed5){return function(_0x21d48d){if(_0x21d48d){var _0x522c3c=typeof _0x31fed5['offset']===_0x0841('0x15')&&typeof _0x31fed5['limit']===_0x0841('0x15');var _0x4a1701=_0x21d48d[_0x0841('0x16')];var _0x4476d1=_0x522c3c?0x0:_0x31fed5[_0x0841('0x17')];var _0x7ca9dc=_0x522c3c?_0x21d48d[_0x0841('0x16')]:_0x31fed5[_0x0841('0x17')]+_0x31fed5[_0x0841('0x18')];var _0x3c75a9;if(_0x7ca9dc>=_0x4a1701){_0x7ca9dc=_0x4a1701;_0x3c75a9=0xc8;}else{_0x3c75a9=0xce;}_0x290be7['status'](_0x3c75a9);return _0x290be7[_0x0841('0x19')](_0x0841('0x1a'),_0x4476d1+'-'+_0x7ca9dc+'/'+_0x4a1701)['json'](_0x21d48d);}return null;};}function saveUpdates(_0x1667c0){return function(_0x1ebf56){if(_0x1ebf56){return _0x1ebf56[_0x0841('0x1b')](_0x1667c0)[_0x0841('0x1c')](function(_0x2114ef){return _0x2114ef;});}return null;};}function removeEntity(_0x8c5955){return function(_0x1b9c7e){if(_0x1b9c7e){return _0x1b9c7e[_0x0841('0x1d')]()[_0x0841('0x1c')](function(){_0x8c5955['status'](0xcc)[_0x0841('0x1e')]();});}};}function handleEntityNotFound(_0x4d7aaa){return function(_0x5bb2db){if(!_0x5bb2db){_0x4d7aaa[_0x0841('0x1f')](0x194);}return _0x5bb2db;};}function handleError(_0x2be3db,_0x3d0fa1){_0x3d0fa1=_0x3d0fa1||0x1f4;return function(_0x2bf2b4){logger[_0x0841('0x20')](_0x2bf2b4['stack']);if(_0x2bf2b4[_0x0841('0x21')]){delete _0x2bf2b4[_0x0841('0x21')];}_0x2be3db[_0x0841('0x13')](_0x3d0fa1)[_0x0841('0x22')](_0x2bf2b4);};}exports[_0x0841('0x23')]=function(_0x57a4ec,_0x37f31e){var _0x549407={};return contacts[_0x0841('0x24')]()[_0x0841('0x1c')](function(_0x21f173){_0x549407=qs[_0x0841('0x25')](_0x21f173,_0x57a4ec);return contacts[_0x0841('0x26')](_0x57a4ec[_0x0841('0x27')],_0x57a4ec['user'],_0x549407,_0x21f173);})[_0x0841('0x1c')](respondWithFilteredResult(_0x37f31e,_0x549407))[_0x0841('0x28')](handleError(_0x37f31e,null));};exports[_0x0841('0x1d')]=function(_0x5d7a86,_0x18560c){return db[_0x0841('0x29')][_0x0841('0x2a')]({'where':{'id':_0x5d7a86[_0x0841('0x2b')]['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0x18560c,null))[_0x0841('0x1c')](removeEntity(_0x18560c,null))['catch'](handleError(_0x18560c,null));};exports[_0x0841('0x24')]=function(_0x40cf18,_0xc12100){return db[_0x0841('0x29')][_0x0841('0x24')]()['then'](function(_0x1aa9bc){delete _0x1aa9bc[_0x0841('0x2c')];for(var _0xe18b22=0x0;_0xe18b220x0){return new Promise(function(_0x2a1161){var _0xbcafd7=[];for(var _0x5b3848=0x0;_0x5b3848<_0x5acd62[_0x0841('0x3c')];_0x5b3848++){_0xbcafd7['push'](insertAdditionalPhones(_0x5acd62[_0x5b3848][_0x0841('0x68')],_0x5acd62[_0x5b3848][_0x0841('0x5e')]));}Promise['all'](_0xbcafd7)[_0x0841('0x1c')](function(){_0x2a1161(0x1);});})[_0x0841('0x1c')](function(){return{'success':_0x32cb35,'failure':_0x205cd4,'duplicates':_0x573da7};});}else{return{'success':_0x32cb35,'failure':_0x205cd4,'duplicates':_0x573da7};}}})[_0x0841('0x1c')](respondWithResult(_0x3e401b,0xc9))[_0x0841('0x28')](handleError(_0x3e401b,null));};exports['show']=function(_0x46d4a3,_0x3b217b){var _0x3d76b2;return db[_0x0841('0x29')][_0x0841('0x24')]()[_0x0841('0x1c')](function(_0x48b402){return db[_0x0841('0x29')]['find']({'where':{'id':_0x46d4a3[_0x0841('0x2b')]['id']},'include':[{'model':db[_0x0841('0x69')],'as':_0x0841('0x6a'),'attributes':['id',_0x0841('0x21'),_0x0841('0x6b')],'required':_0x46d4a3[_0x0841('0x27')][_0x0841('0x6c')]?!![]:![]},{'model':db[_0x0841('0x6d')],'as':_0x0841('0x6e'),'where':{'CmContactId':_0x46d4a3['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x0841('0x6f')}]}],'order':[db[_0x0841('0x70')][_0x0841('0x71')]('Phones.OrderBy')],'attributes':_['keys'](_0x48b402)});})[_0x0841('0x1c')](function(_0x6bfcf3){if(!_[_0x0841('0x5a')](_0x6bfcf3)){_0x3d76b2=_0x6bfcf3[_0x0841('0x3b')]({'plain':!![]});var _0xb4ba3d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x6bfcf3&&_0x6bfcf3[_0x0841('0x65')]){if(_0x6bfcf3[_0x0841('0x65')]){_0xb4ba3d[_0x0841('0x62')][_0x0841('0x72')][_0x0841('0x64')]({'ListId':{'$ne':_0x6bfcf3[_0x0841('0x65')]}});}}return db['CmCustomField']['findAll'](_0xb4ba3d);}})['then'](function(_0x4ab377){if(!_[_0x0841('0x5a')](_0x4ab377)){return _['omit'](_0x3d76b2,_[_0x0841('0x73')](_0x4ab377,function(_0x2d779d){return util[_0x0841('0x74')]('cf_%d',_0x2d779d['id']);}));}})[_0x0841('0x1c')](handleEntityNotFound(_0x3b217b,null))[_0x0841('0x1c')](respondWithResult(_0x3b217b,null))['catch'](handleError(_0x3b217b,null));};exports[_0x0841('0x1b')]=function(_0x269088,_0x45dc99){var _0x507d2b;if(_0x269088[_0x0841('0x39')]['id']){delete _0x269088[_0x0841('0x39')]['id'];}if(!_[_0x0841('0x5a')](_0x269088[_0x0841('0x39')]['dialTimezone'])){var _0x4e90bf=_0x269088[_0x0841('0x39')][_0x0841('0x5b')];if(!_['isNil'](shared['timezones'][_0x4e90bf]))_0x269088['body']['utcOffset']=shared[_0x0841('0x5c')][_0x4e90bf][_0x0841('0x5d')];}return db[_0x0841('0x29')]['find']({'where':{'id':_0x269088[_0x0841('0x2b')]['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0x45dc99,null))[_0x0841('0x1c')](saveUpdates(_0x269088[_0x0841('0x39')],null))[_0x0841('0x1c')](function(_0x91f5bb){_0x507d2b=_0x91f5bb;var _0x523b16={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x91f5bb&&_0x91f5bb['ListId']){if(_0x91f5bb[_0x0841('0x65')]){_0x523b16[_0x0841('0x62')][_0x0841('0x72')][_0x0841('0x64')]({'ListId':{'$ne':_0x91f5bb['ListId']}});}}return db[_0x0841('0x32')]['findAll'](_0x523b16);})['then'](function(_0x4787ce){if(_0x4787ce){return _['omit'](_['pickBy'](_0x269088[_0x0841('0x39')],function(_0x5c78f9,_0x415553){return _[_0x0841('0x2e')](_0x415553,'cf_');}),_[_0x0841('0x73')](_0x4787ce,function(_0x335846){return util['format'](_0x0841('0x75'),_0x335846['id']);}));}})[_0x0841('0x1c')](function(_0x1eee50){if(_0x1eee50&&!_[_0x0841('0x76')](_0x1eee50)){var _0x59a741=squel[_0x0841('0x1b')]()[_0x0841('0x77')](_0x0841('0x78'))[_0x0841('0x79')](_0x1eee50)['where'](_0x0841('0x7a'),_0x269088[_0x0841('0x2b')]['id'])[_0x0841('0x7b')]();return db['sequelize']['query'](_0x59a741[_0x0841('0x7c')],{'replacements':_0x59a741[_0x0841('0x35')]});}})['then'](function(){if(_0x269088['body'][_0x0841('0x7d')]&&_0x507d2b){return db[_0x0841('0x40')][_0x0841('0x1b')]({'phone':_0x269088[_0x0841('0x39')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x507d2b['id']}});}})['then'](function(){return _0x507d2b;})[_0x0841('0x1c')](respondWithResult(_0x45dc99,null))[_0x0841('0x28')](handleError(_0x45dc99,null));};exports[_0x0841('0x7e')]=function(_0x5018e3,_0xd0f5ef){var _0x15e5cf={};var _0x7a4011={};var _0x30fcc9;var _0x483d64;return db[_0x0841('0x29')][_0x0841('0x7f')]({'where':{'id':_0x5018e3[_0x0841('0x2b')]['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0xd0f5ef,null))[_0x0841('0x1c')](function(_0x362f10){if(_0x362f10){_0x30fcc9=_0x362f10;_0x7a4011[_0x0841('0x80')]=_['keys'](db[_0x0841('0x69')][_0x0841('0x81')]);_0x7a4011['query']=_[_0x0841('0x2d')](_0x5018e3[_0x0841('0x27')]);_0x7a4011[_0x0841('0x82')]=_[_0x0841('0x83')](_0x7a4011[_0x0841('0x80')],_0x7a4011[_0x0841('0x27')]);_0x15e5cf[_0x0841('0x84')]=_[_0x0841('0x83')](_0x7a4011[_0x0841('0x80')],qs['fields'](_0x5018e3['query'][_0x0841('0x85')]));_0x15e5cf[_0x0841('0x84')]=_0x15e5cf[_0x0841('0x84')][_0x0841('0x3c')]?_0x15e5cf['attributes']:_0x7a4011[_0x0841('0x80')];_0x15e5cf[_0x0841('0x86')]=qs[_0x0841('0x87')](_0x5018e3[_0x0841('0x27')]['sort']);_0x15e5cf[_0x0841('0x62')]=qs['filters'](_[_0x0841('0x88')](_0x5018e3[_0x0841('0x27')],_0x7a4011[_0x0841('0x82')]));if(_0x5018e3[_0x0841('0x27')][_0x0841('0x89')]){_0x15e5cf[_0x0841('0x62')]=_[_0x0841('0x38')](_0x15e5cf[_0x0841('0x62')],{'$or':_[_0x0841('0x73')](_0x15e5cf[_0x0841('0x84')],function(_0x12f36d){var _0x19f957={};_0x19f957[_0x12f36d]={'$like':'%'+_0x5018e3['query'][_0x0841('0x89')]+'%'};return _0x19f957;})});}_0x15e5cf=_['merge']({},_0x15e5cf,_0x5018e3[_0x0841('0x8a')]);return _0x30fcc9[_0x0841('0x7e')](_0x15e5cf);}})['then'](function(_0x5d8454){if(_0x5d8454){_0x483d64=_0x5d8454[_0x0841('0x3c')];if(!_0x5018e3['query'][_0x0841('0x37')](_0x0841('0x8b'))){_0x15e5cf[_0x0841('0x18')]=qs[_0x0841('0x18')](_0x5018e3[_0x0841('0x27')][_0x0841('0x18')]);_0x15e5cf[_0x0841('0x17')]=qs[_0x0841('0x17')](_0x5018e3[_0x0841('0x27')][_0x0841('0x17')]);}return _0x30fcc9['getTags'](_0x15e5cf);}})[_0x0841('0x1c')](function(_0x202323){if(_0x202323){return _0x202323?{'count':_0x483d64,'rows':_0x202323}:null;}})[_0x0841('0x1c')](respondWithResult(_0xd0f5ef,null))[_0x0841('0x28')](handleError(_0xd0f5ef,null));};exports[_0x0841('0x8c')]=function(_0x5c9a3c,_0x3c9278){if(_0x5c9a3c['body']['id']){delete _0x5c9a3c[_0x0841('0x39')]['id'];}return db[_0x0841('0x29')][_0x0841('0x7f')]({'where':{'id':_0x5c9a3c[_0x0841('0x2b')]['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0x3c9278,null))[_0x0841('0x1c')](function(_0x1f17ab){if(_0x1f17ab){return _0x1f17ab[_0x0841('0x8c')](_0x5c9a3c[_0x0841('0x39')]['ids']||[]);}return null;})[_0x0841('0x1c')](respondWithResult(_0x3c9278,null))[_0x0841('0x28')](handleError(_0x3c9278,null));};exports[_0x0841('0x8d')]=function(_0xcb85f6,_0x9df3b8){var _0x30d468=[];_0x30d468[_0x0841('0x64')](addAdditionalPhones(_0xcb85f6[_0x0841('0x39')]));Promise[_0x0841('0x8e')](_0x30d468)[_0x0841('0x1c')](function(){_0x30d468=[];_0x30d468[_0x0841('0x64')](deleteCmHopperPhones(_0xcb85f6[_0x0841('0x39')]['id']));_0x30d468['push'](addCmHopperPhones(_0xcb85f6[_0x0841('0x39')]['id']));Promise[_0x0841('0x8e')](_0x30d468)[_0x0841('0x1c')](function(){return[0x1];})[_0x0841('0x1c')](respondWithResult(_0x9df3b8,null));});};function addAdditionalPhones(_0x3f786f){var _0xb3f820;return new Promise(function(_0x549616){return db[_0x0841('0x6d')][_0x0841('0x1d')]({'where':{'CmContactId':_0x3f786f['id']}})[_0x0841('0x1c')](function(){db['ContactItemType'][_0x0841('0x26')]({'raw':!![],'attributes':['id',_0x0841('0x8f')]})[_0x0841('0x1c')](function(_0xa51b5c){var _0x1ecd5d=[];for(var _0xeb21e0=0x0;_0xeb21e0<_0x3f786f['items'][_0x0841('0x3c')];_0xeb21e0++){var _0x1193ab=_0x3f786f[_0x0841('0x90')]?_[_0x0841('0x5a')](_0x3f786f['item_types'][_0xeb21e0])?'':_0x3f786f[_0x0841('0x90')][_0xeb21e0]:_0x3f786f[_0x0841('0x91')][_0xeb21e0]['ItemTypeId']?_0x3f786f[_0x0841('0x91')][_0xeb21e0][_0x0841('0x92')]:'';var _0x3d6757=_[_0x0841('0x5a')](_0x3f786f['items'][_0xeb21e0][_0x0841('0x93')])?'':_0x3f786f['items'][_0xeb21e0][_0x0841('0x93')];var _0xae06c3=_0x1193ab+':'+_0x3f786f[_0x0841('0x91')][_0xeb21e0][_0x0841('0x7d')]+'§'+_0x3d6757;if(_['isNil'](_0xb3f820))_0xb3f820=_0xae06c3;else _0xb3f820+=';'+_0xae06c3;var _0x5716e4=null;var _0x557e76=null;if(_0x3f786f[_0x0841('0x90')]){if(!_[_0x0841('0x5a')](_0x3f786f[_0x0841('0x90')][_0xeb21e0])){_0x557e76=_[_0x0841('0x2a')](_0xa51b5c,function(_0x49494e){return _0x49494e['id']===_0x3f786f[_0x0841('0x90')][_0xeb21e0];});if(!_[_0x0841('0x5a')](_0x557e76)){_0x5716e4=_0x557e76[_0x0841('0x8f')];}}}else{if(!_[_0x0841('0x5a')](_0x3f786f['items'][_0xeb21e0])){_0x557e76=_['find'](_0xa51b5c,function(_0x516fb6){return _0x516fb6['id']===_0x3f786f[_0x0841('0x91')][_0xeb21e0][_0x0841('0x92')];});if(!_[_0x0841('0x5a')](_0x557e76)){_0x5716e4=_0xeb21e0;}}}if(_[_0x0841('0x5a')](_0x5716e4)){_0x5716e4=0x64;}_0x1ecd5d[_0x0841('0x64')](addAdditionalPhone(_0x3f786f['id'],_0x3f786f['items'][_0xeb21e0][_0x0841('0x7d')],_0x3f786f[_0x0841('0x90')]?_['isNil'](_0x3f786f[_0x0841('0x90')][_0xeb21e0])?null:_0x3f786f[_0x0841('0x90')][_0xeb21e0]:_0x3f786f['items'][_0xeb21e0][_0x0841('0x92')]?_0x3f786f[_0x0841('0x91')][_0xeb21e0]['ItemTypeId']:null,_0x5716e4,_0x3d6757));}Promise[_0x0841('0x8e')](_0x1ecd5d)[_0x0841('0x1c')](function(){db[_0x0841('0x29')][_0x0841('0x1b')]({'AdditionalPhones':_0xb3f820},{'where':{'id':_0x3f786f['id']}})[_0x0841('0x1c')](function(){_0x549616(0x1);});});});});});}function addAdditionalPhone(_0x17eef6,_0x188d7f,_0x39ce6c,_0x59a9d1,_0x1d1795){return db[_0x0841('0x6d')][_0x0841('0x2a')]({'where':{'CmContactId':_0x17eef6,'item':_0x188d7f}})['then'](function(_0x45ad24){if(_0x45ad24)logger[_0x0841('0x3e')](_0x0841('0x94'),_0x45ad24);else{db[_0x0841('0x6d')][_0x0841('0x44')]({'CmContactId':_0x17eef6,'item':_0x188d7f,'ItemTypeId':_0x39ce6c,'OrderBy':_0x59a9d1,'ItemClass':_0x0841('0x95'),'description':_0x1d1795});}});}function deleteCmHopperPhones(_0x1c6323){return new Promise(function(_0x4adfe2){return db[_0x0841('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1c6323}})['then'](function(_0x41e6e0){db[_0x0841('0x96')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0841('0x73')](_0x41e6e0,'id')}}});})['then'](function(){_0x4adfe2(0x1);});});}function addCmHopperPhones(_0x169224){return new Promise(function(_0x4ea270){return db[_0x0841('0x40')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x169224}})[_0x0841('0x1c')](function(_0x9ecb4b){var _0x322183=[];_['map'](_0x9ecb4b,function(_0x136e58){_0x322183[_0x0841('0x64')](createCmHopperPhone(_0x169224,_0x136e58['id']));});Promise[_0x0841('0x8e')](_0x322183)[_0x0841('0x1c')](function(){_0x4ea270(0x1);});});});}function createCmHopperPhone(_0x2450cd,_0x20886d){return new Promise(function(_0x3b6baf){db[_0x0841('0x6d')][_0x0841('0x26')]({'raw':!![],'attributes':[_0x0841('0x97'),_0x0841('0x8f')],'where':{'CmContactId':_0x2450cd,'ItemClass':_0x0841('0x95')},'include':[{'model':db['ContactItemType'],'attributes':[_0x0841('0x8f')],'as':_0x0841('0x6f')}],'order':[_0x0841('0x8f'),db[_0x0841('0x70')][_0x0841('0x71')](_0x0841('0x98'))]})[_0x0841('0x1c')](function(_0x22d891){var _0x2c248b=0x1;var _0x32ee70=_[_0x0841('0x73')](_0x22d891,function(_0x1b25ca){_0x1b25ca['CmHopperId']=_0x20886d;_0x1b25ca[_0x0841('0x7d')]=_0x1b25ca[_0x0841('0x97')];_0x1b25ca['OrderBy']=_0x2c248b;delete _0x1b25ca[_0x0841('0x99')];_0x2c248b=_0x2c248b+0x1;return _0x1b25ca;});return db['CmHopperAdditionalPhone']['bulkCreate'](_0x32ee70,{});})[_0x0841('0x1c')](function(){_0x3b6baf(0x1);});});}function insertAdditionalPhones(_0x10dd5d,_0x40f9a4){return new Promise(function(_0x38594f){var _0x2ab192=[];for(var _0x525944=0x0;_0x525944<_0x40f9a4[_0x0841('0x3c')];_0x525944++){var _0x189c7c=_0x40f9a4[_0x525944];_0x2ab192['push'](parseContactItemType(_0x189c7c));}Promise[_0x0841('0x8e')](_0x2ab192)[_0x0841('0x1c')](function(){var _0x4dde9d={'id':_0x10dd5d['id'],'items':_0x40f9a4};return addAdditionalPhones(_0x4dde9d)[_0x0841('0x1c')](function(){return addCmHopperPhones(_0x10dd5d['id']);});})[_0x0841('0x1c')](function(){_0x38594f(_0x10dd5d);});});}function parseContactItemType(_0x1fe17b){return new Promise(function(_0x30c85d){if(_0x1fe17b[_0x0841('0x37')](_0x0841('0x92'))){_0x30c85d(_0x1fe17b);}else{return db['ContactItemType'][_0x0841('0x2a')]({'where':{'name':_0x1fe17b[_0x0841('0x6f')]}})[_0x0841('0x1c')](function(_0x4bee86){if(_[_0x0841('0x5a')](_0x4bee86))_0x1fe17b[_0x0841('0x92')]=null;else _0x1fe17b[_0x0841('0x92')]=_0x4bee86['id'];_0x30c85d(_0x1fe17b);});}});}exports[_0x0841('0x9a')]=function(_0x1e56b8,_0x2474ea){return db[_0x0841('0x6d')][_0x0841('0x26')]({'raw':!![],'where':{'CmContactId':_0x1e56b8[_0x0841('0x2b')]['id'],'ItemClass':_0x0841('0x95')},'include':[{'model':db['ContactItemType'],'as':'ItemType'}],'order':[['OrderBy'],[db[_0x0841('0x70')][_0x0841('0x71')](_0x0841('0x98'))]]})[_0x0841('0x1c')](function(_0x77ac9a){return _0x77ac9a;})['then'](respondWithResult(_0x2474ea,null))['catch'](handleError(_0x2474ea,null));};exports[_0x0841('0x9b')]=function(_0x4eb44b,_0xfe99cd){return db[_0x0841('0x6d')][_0x0841('0x26')]({'raw':!![],'where':{'CmContactId':_0x4eb44b[_0x0841('0x39')][_0x0841('0x9c')]}})[_0x0841('0x1c')](function(_0x2ac67f){var _0x191cec=_[_0x0841('0x73')](_0x2ac67f,function(_0x534e7f){_0x534e7f[_0x0841('0x9d')]=_0x4eb44b[_0x0841('0x39')]['toContactId'];return _0x534e7f;});return db[_0x0841('0x6d')][_0x0841('0x5f')](_0x191cec,{});})[_0x0841('0x1c')](function(){return addCmHopperPhones(_0x4eb44b[_0x0841('0x39')][_0x0841('0x9e')]);})[_0x0841('0x1c')](function(){return['ok'];})[_0x0841('0x1c')](respondWithResult(_0xfe99cd,null))['catch'](handleError(_0xfe99cd,null));};exports['rescheduleAdditionalPhones']=function(_0x1912ac,_0x49d194){var _0x4bd334=[];_0x4bd334[_0x0841('0x64')](createCmHopperPhone(_0x1912ac[_0x0841('0x39')]['id'],_0x1912ac[_0x0841('0x39')][_0x0841('0x9f')]));Promise[_0x0841('0x8e')](_0x4bd334)[_0x0841('0x1c')](function(){return[0x1];})[_0x0841('0x1c')](respondWithResult(_0x49d194,null));};exports[_0x0841('0xa0')]=function(_0x120f58,_0x3cdf49){var _0x454494={'raw':![],'where':{}};var _0x27a42a={};var _0xf864c5={'count':0x0,'rows':[]};return db[_0x0841('0x29')][_0x0841('0x7f')]({'where':{'id':_0x120f58['params']['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0x3cdf49,null))[_0x0841('0x1c')](function(_0x2c32fe){if(_0x2c32fe){_0x27a42a[_0x0841('0x80')]=_[_0x0841('0x2d')](db[_0x0841('0x40')][_0x0841('0x81')]);_0x27a42a[_0x0841('0x27')]=_['keys'](_0x120f58[_0x0841('0x27')]);_0x27a42a[_0x0841('0x82')]=_[_0x0841('0x83')](_0x27a42a[_0x0841('0x80')],_0x27a42a[_0x0841('0x27')]);_0x454494[_0x0841('0x84')]=_[_0x0841('0x83')](_0x27a42a['model'],qs[_0x0841('0x85')](_0x120f58[_0x0841('0x27')][_0x0841('0x85')]));_0x454494[_0x0841('0x84')]=_0x454494[_0x0841('0x84')][_0x0841('0x3c')]?_0x454494['attributes']:_0x27a42a[_0x0841('0x80')];if(!_0x120f58[_0x0841('0x27')][_0x0841('0x37')](_0x0841('0x8b'))){_0x454494[_0x0841('0x18')]=qs['limit'](_0x120f58[_0x0841('0x27')][_0x0841('0x18')]);_0x454494[_0x0841('0x17')]=qs['offset'](_0x120f58['query'][_0x0841('0x17')]);}_0x454494[_0x0841('0x86')]=qs['sort'](_0x120f58['query']['sort']);_0x454494[_0x0841('0x62')]=qs['filters'](_['pick'](_0x120f58['query'],_0x27a42a[_0x0841('0x82')]));_0x454494[_0x0841('0x62')]['ContactId']=_0x2c32fe['id'];if(_0x120f58['query'][_0x0841('0x89')]){_0x454494[_0x0841('0x62')]=_[_0x0841('0x38')](_0x454494[_0x0841('0x62')],{'$or':_[_0x0841('0x73')](_0x454494[_0x0841('0x84')],function(_0x3bb666){var _0x21b8c6={};_0x21b8c6[_0x3bb666]={'$like':'%'+_0x120f58[_0x0841('0x27')]['filter']+'%'};return _0x21b8c6;})});}_0x454494=_[_0x0841('0x38')]({},_0x454494,_0x120f58['options']);return db[_0x0841('0x40')][_0x0841('0x16')]({'where':_0x454494[_0x0841('0x62')]})[_0x0841('0x1c')](function(_0x31e49e){_0xf864c5[_0x0841('0x16')]=_0x31e49e;if(_0x120f58['query'][_0x0841('0xa1')]){_0x454494[_0x0841('0xa2')]=[{'all':!![]}];}return db[_0x0841('0x40')][_0x0841('0x26')](_0x454494);})[_0x0841('0x1c')](function(_0x16ca8b){_0xf864c5['rows']=_0x16ca8b;return _0xf864c5;});}})['then'](respondWithFilteredResult(_0x3cdf49,_0x454494))[_0x0841('0x28')](handleError(_0x3cdf49,null));};exports[_0x0841('0xa3')]=function(_0x345820,_0x15d6a7){var _0x6a7fd6={'raw':!![],'where':{}};var _0x158a0f={};var _0x54e710={'count':0x0,'rows':[]};return db[_0x0841('0x29')][_0x0841('0x7f')]({'where':{'id':_0x345820[_0x0841('0x2b')]['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0x15d6a7,null))[_0x0841('0x1c')](function(_0x25cd4d){if(_0x25cd4d){_0x158a0f[_0x0841('0x80')]=_[_0x0841('0x2d')](db['CmHopperHistory']['rawAttributes']);_0x158a0f['query']=_[_0x0841('0x2d')](_0x345820[_0x0841('0x27')]);_0x158a0f[_0x0841('0x82')]=_[_0x0841('0x83')](_0x158a0f['model'],_0x158a0f[_0x0841('0x27')]);_0x6a7fd6[_0x0841('0x84')]=_['intersection'](_0x158a0f[_0x0841('0x80')],qs[_0x0841('0x85')](_0x345820['query'][_0x0841('0x85')]));_0x6a7fd6['attributes']=_0x6a7fd6['attributes'][_0x0841('0x3c')]?_0x6a7fd6[_0x0841('0x84')]:_0x158a0f[_0x0841('0x80')];if(!_0x345820['query'][_0x0841('0x37')](_0x0841('0x8b'))){_0x6a7fd6[_0x0841('0x18')]=qs[_0x0841('0x18')](_0x345820[_0x0841('0x27')][_0x0841('0x18')]);_0x6a7fd6['offset']=qs[_0x0841('0x17')](_0x345820[_0x0841('0x27')][_0x0841('0x17')]);}_0x6a7fd6[_0x0841('0x86')]=qs[_0x0841('0x87')](_0x345820[_0x0841('0x27')][_0x0841('0x87')]);_0x6a7fd6[_0x0841('0x62')]=qs[_0x0841('0x82')](_[_0x0841('0x88')](_0x345820[_0x0841('0x27')],_0x158a0f[_0x0841('0x82')]));_0x6a7fd6[_0x0841('0x62')]['ContactId']=_0x25cd4d['id'];if(_0x345820[_0x0841('0x27')][_0x0841('0x89')]){_0x6a7fd6[_0x0841('0x62')]=_['merge'](_0x6a7fd6[_0x0841('0x62')],{'$or':_['map'](_0x6a7fd6[_0x0841('0x84')],function(_0x3e566e){var _0x1dd01d={};_0x1dd01d[_0x3e566e]={'$like':'%'+_0x345820[_0x0841('0x27')][_0x0841('0x89')]+'%'};return _0x1dd01d;})});}_0x6a7fd6=_[_0x0841('0x38')]({},_0x6a7fd6,_0x345820[_0x0841('0x8a')]);return db[_0x0841('0xa4')]['count']({'where':_0x6a7fd6[_0x0841('0x62')]})[_0x0841('0x1c')](function(_0x31ba34){_0x54e710[_0x0841('0x16')]=_0x31ba34;if(_0x345820[_0x0841('0x27')][_0x0841('0xa1')]){_0x6a7fd6[_0x0841('0xa2')]=[{'all':!![]}];}return db[_0x0841('0xa4')][_0x0841('0x26')](_0x6a7fd6);})[_0x0841('0x1c')](function(_0x63b8e9){_0x54e710[_0x0841('0xa5')]=_0x63b8e9;return _0x54e710;});}})[_0x0841('0x1c')](respondWithFilteredResult(_0x15d6a7,_0x6a7fd6))['catch'](handleError(_0x15d6a7,null));};exports['getHopperFinals']=function(_0x400fcd,_0x53fc04){var _0x2d8033={'raw':!![],'where':{}};var _0x49bad9={};var _0x1f89d5={'count':0x0,'rows':[]};return db[_0x0841('0x29')][_0x0841('0x7f')]({'where':{'id':_0x400fcd[_0x0841('0x2b')]['id']}})['then'](handleEntityNotFound(_0x53fc04,null))[_0x0841('0x1c')](function(_0x156b37){if(_0x156b37){_0x49bad9[_0x0841('0x80')]=_['keys'](db['CmHopperFinal'][_0x0841('0x81')]);_0x49bad9[_0x0841('0x27')]=_[_0x0841('0x2d')](_0x400fcd[_0x0841('0x27')]);_0x49bad9[_0x0841('0x82')]=_[_0x0841('0x83')](_0x49bad9['model'],_0x49bad9[_0x0841('0x27')]);_0x2d8033[_0x0841('0x84')]=_[_0x0841('0x83')](_0x49bad9[_0x0841('0x80')],qs[_0x0841('0x85')](_0x400fcd[_0x0841('0x27')][_0x0841('0x85')]));_0x2d8033[_0x0841('0x84')]=_0x2d8033['attributes'][_0x0841('0x3c')]?_0x2d8033[_0x0841('0x84')]:_0x49bad9['model'];if(!_0x400fcd[_0x0841('0x27')][_0x0841('0x37')](_0x0841('0x8b'))){_0x2d8033[_0x0841('0x18')]=qs['limit'](_0x400fcd[_0x0841('0x27')][_0x0841('0x18')]);_0x2d8033[_0x0841('0x17')]=qs['offset'](_0x400fcd[_0x0841('0x27')][_0x0841('0x17')]);}_0x2d8033[_0x0841('0x86')]=qs[_0x0841('0x87')](_0x400fcd[_0x0841('0x27')][_0x0841('0x87')]);_0x2d8033[_0x0841('0x62')]=qs[_0x0841('0x82')](_[_0x0841('0x88')](_0x400fcd[_0x0841('0x27')],_0x49bad9[_0x0841('0x82')]));_0x2d8033['where'][_0x0841('0xa6')]=_0x156b37['id'];if(_0x400fcd[_0x0841('0x27')][_0x0841('0x89')]){_0x2d8033[_0x0841('0x62')]=_[_0x0841('0x38')](_0x2d8033[_0x0841('0x62')],{'$or':_[_0x0841('0x73')](_0x2d8033[_0x0841('0x84')],function(_0x438001){var _0x1505a4={};_0x1505a4[_0x438001]={'$like':'%'+_0x400fcd[_0x0841('0x27')][_0x0841('0x89')]+'%'};return _0x1505a4;})});}_0x2d8033=_[_0x0841('0x38')]({},_0x2d8033,_0x400fcd[_0x0841('0x8a')]);return db[_0x0841('0x4f')]['count']({'where':_0x2d8033['where']})[_0x0841('0x1c')](function(_0x46d210){_0x1f89d5['count']=_0x46d210;if(_0x400fcd[_0x0841('0x27')]['includeAll']){_0x2d8033[_0x0841('0xa2')]=[{'all':!![]}];}return db[_0x0841('0x4f')][_0x0841('0x26')](_0x2d8033);})['then'](function(_0x3592ef){_0x1f89d5['rows']=_0x3592ef;return _0x1f89d5;});}})[_0x0841('0x1c')](respondWithFilteredResult(_0x53fc04,_0x2d8033))['catch'](handleError(_0x53fc04,null));};exports[_0x0841('0xa7')]=function(_0x23bc66,_0x300a9d){var _0x39b611={'raw':!![],'where':{}};var _0x23b47b={};var _0x44a0a6={'count':0x0,'rows':[]};return db[_0x0841('0x29')][_0x0841('0x7f')]({'where':{'id':_0x23bc66[_0x0841('0x2b')]['id']}})[_0x0841('0x1c')](handleEntityNotFound(_0x300a9d,null))[_0x0841('0x1c')](function(_0x119e52){if(_0x119e52){_0x23b47b[_0x0841('0x80')]=_[_0x0841('0x2d')](db[_0x0841('0x55')]['rawAttributes']);_0x23b47b[_0x0841('0x27')]=_[_0x0841('0x2d')](_0x23bc66['query']);_0x23b47b[_0x0841('0x82')]=_['intersection'](_0x23b47b[_0x0841('0x80')],_0x23b47b[_0x0841('0x27')]);_0x39b611[_0x0841('0x84')]=_['intersection'](_0x23b47b[_0x0841('0x80')],qs['fields'](_0x23bc66[_0x0841('0x27')][_0x0841('0x85')]));_0x39b611['attributes']=_0x39b611['attributes']['length']?_0x39b611[_0x0841('0x84')]:_0x23b47b[_0x0841('0x80')];if(!_0x23bc66[_0x0841('0x27')][_0x0841('0x37')](_0x0841('0x8b'))){_0x39b611[_0x0841('0x18')]=qs[_0x0841('0x18')](_0x23bc66['query']['limit']);_0x39b611[_0x0841('0x17')]=qs['offset'](_0x23bc66[_0x0841('0x27')]['offset']);}_0x39b611[_0x0841('0x86')]=qs[_0x0841('0x87')](_0x23bc66['query'][_0x0841('0x87')]);_0x39b611[_0x0841('0x62')]=qs[_0x0841('0x82')](_[_0x0841('0x88')](_0x23bc66[_0x0841('0x27')],_0x23b47b[_0x0841('0x82')]));_0x39b611[_0x0841('0x62')]['ContactId']=_0x119e52['id'];if(_0x23bc66['query'][_0x0841('0x89')]){_0x39b611['where']=_[_0x0841('0x38')](_0x39b611[_0x0841('0x62')],{'$or':_['map'](_0x39b611[_0x0841('0x84')],function(_0x558c0e){var _0x4b8ef3={};_0x4b8ef3[_0x558c0e]={'$like':'%'+_0x23bc66['query']['filter']+'%'};return _0x4b8ef3;})});}_0x39b611=_[_0x0841('0x38')]({},_0x39b611,_0x23bc66[_0x0841('0x8a')]);return db[_0x0841('0x55')][_0x0841('0x16')]({'where':_0x39b611['where']})['then'](function(_0x2418d7){_0x44a0a6[_0x0841('0x16')]=_0x2418d7;if(_0x23bc66[_0x0841('0x27')][_0x0841('0xa1')]){_0x39b611[_0x0841('0xa2')]=[{'all':!![]}];}return db[_0x0841('0x55')][_0x0841('0x26')](_0x39b611);})[_0x0841('0x1c')](function(_0xe2ccf8){_0x44a0a6['rows']=_0xe2ccf8;return _0x44a0a6;});}})[_0x0841('0x1c')](respondWithFilteredResult(_0x300a9d,_0x39b611))[_0x0841('0x28')](handleError(_0x300a9d,null));};exports[_0x0841('0xa8')]=function(_0x4326f0,_0x4eeb2b){try{if(!_0x4326f0[_0x0841('0x39')]['ListId']){throw new Error(_0x0841('0xa9'));}if(!_0x4326f0[_0x0841('0x39')][_0x0841('0xaa')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4326f0[_0x0841('0x39')]['binding_values']){throw new Error(_0x0841('0xab'));}if(!_0x4326f0[_0x0841('0x39')][_0x0841('0xac')]){throw new Error(_0x0841('0xad'));}var _0xa80b8e=_0x4326f0['body'][_0x0841('0xaa')][_0x0841('0xae')](',');var _0x2fcc5b=_0x4326f0[_0x0841('0x39')]['binding_values'][_0x0841('0xae')](',');if(!_0xa80b8e[_0x0841('0x3c')]||!_0x2fcc5b[_0x0841('0x3c')]||_0xa80b8e['length']!==_0x2fcc5b['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x4326f0['body'][_0x0841('0x85')]=_[_0x0841('0xaf')](_0xa80b8e,_0x2fcc5b);if(!_0x4326f0['body'][_0x0841('0x85')][_0x0841('0x7d')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4326f0[_0x0841('0x39')][_0x0841('0x85')][_0x0841('0xb0')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x57cec4=path['join'](config[_0x0841('0xb1')],_0x0841('0xb2'),_0x4326f0['file'][_0x0841('0xb3')]);fs[_0x0841('0xb4')](_0x57cec4,parseInt('0777',0x8));var _0x5dd2be=require('child_process')[_0x0841('0xb5')](path['join'](__dirname,_0x0841('0xb6')),[_0x57cec4,_0x4326f0['body'][_0x0841('0xaa')],_0x4326f0[_0x0841('0x39')]['binding_values'],_0x4326f0['body'][_0x0841('0x65')],_0x4326f0[_0x0841('0x39')]['CompanyId'],_0x4326f0[_0x0841('0x39')][_0x0841('0x61')],_0x4326f0[_0x0841('0x39')][_0x0841('0xac')]]);return _0x4eeb2b[_0x0841('0x13')](0xc8)['json']({'message':_0x0841('0xb7'),'pid':_0x5dd2be[_0x0841('0xb8')]});}catch(_0x57a155){return _0x4eeb2b['status'](0x1f4)['send'](_0x57a155);}};exports['upload']=function(_0x43f097,_0x18d7e7){var _0x47ae24=fs['createReadStream'](_0x43f097[_0x0841('0xb9')][_0x0841('0x3')]);Papa[_0x0841('0xba')](_0x47ae24,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1386ac){return _0x18d7e7[_0x0841('0x13')](0xc8)[_0x0841('0x14')]({'file':_0x43f097[_0x0841('0xb9')],'fields':_0x1386ac['meta'][_0x0841('0x85')]});}});};exports[_0x0841('0xbb')]=function(_0x3d1e86,_0x27a971){return db[_0x0841('0xbc')][_0x0841('0x26')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x190190){var _0x411b66=![];if(!_0x3d1e86[_0x0841('0x39')][_0x0841('0x65')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3d1e86[_0x0841('0x39')][_0x0841('0xbd')][_0x0841('0x7d')]){throw new Error(_0x0841('0xbe'));}if(!_0x3d1e86[_0x0841('0x39')][_0x0841('0xbd')][_0x0841('0xb0')]){throw new Error(_0x0841('0xbf'));}if(!_0x3d1e86['body'][_0x0841('0xac')]){throw new Error(_0x0841('0xad'));}var _0x454627=require(_0x0841('0xc0'))[_0x0841('0xb5')](path[_0x0841('0x3d')](__dirname,_0x0841('0xc1')),[_0x3d1e86['params']['id'],JSON[_0x0841('0xc2')](_0x3d1e86[_0x0841('0x39')]),JSON[_0x0841('0xc2')](_0x190190)]);_0x454627['on'](_0x0841('0xc3'),function(){_0x411b66=!![];return _0x27a971[_0x0841('0x13')](0xc8)['json']({'message':_0x0841('0xc4'),'pid':_0x454627[_0x0841('0xb8')]});});_0x454627['on']('exit',function(_0xdbe34b){if(_0xdbe34b&&!_0x411b66){return _0x27a971[_0x0841('0x13')](0x1f4)[_0x0841('0x14')]({'message':'error\x20child\x20process','pid':_0x454627['pid']});}});})[_0x0841('0x28')](handleError(_0x27a971,null));};exports[_0x0841('0xc5')]=function(_0x6d3c30,_0x1dadc0){return db[_0x0841('0xbc')][_0x0841('0x26')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0841('0xc6')}})[_0x0841('0x1c')](function(_0x518404){var _0x35d324=![];if(!_0x6d3c30[_0x0841('0x39')][_0x0841('0x65')]){throw new Error(_0x0841('0xa9'));}if(!_0x6d3c30[_0x0841('0x39')][_0x0841('0xbd')][_0x0841('0x7d')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x6d3c30[_0x0841('0x39')][_0x0841('0xbd')][_0x0841('0xb0')]){throw new Error(_0x0841('0xbf'));}if(!_0x6d3c30[_0x0841('0x39')]['socket_timestamp']){throw new Error(_0x0841('0xad'));}var _0x302bee=require(_0x0841('0xc0'))[_0x0841('0xb5')](path[_0x0841('0x3d')](__dirname,_0x0841('0xc7')),[_0x6d3c30[_0x0841('0x2b')]['id'],JSON[_0x0841('0xc2')](_0x6d3c30[_0x0841('0x39')]),JSON[_0x0841('0xc2')](_0x518404)]);_0x302bee['on'](_0x0841('0xc3'),function(){_0x35d324=!![];return _0x1dadc0[_0x0841('0x13')](0xc8)['json']({'message':_0x0841('0xc4'),'pid':_0x302bee[_0x0841('0xb8')]});});_0x302bee['on'](_0x0841('0xc8'),function(_0x3640d9){if(_0x3640d9&&!_0x35d324){return _0x1dadc0[_0x0841('0x13')](0x1f4)[_0x0841('0x14')]({'message':_0x0841('0xc9'),'pid':_0x302bee['pid']});}});})[_0x0841('0x28')](handleError(_0x1dadc0,null));};exports[_0x0841('0xca')]=function(_0x1a149d,_0xfd1354){var _0x2c6ee5=[_0x0841('0xcb'),_0x0841('0xcc'),_0x0841('0xcd'),'openchannel',_0x0841('0xce'),_0x0841('0xcf'),_0x0841('0xd0')];var _0x7e9b8f={'offset':0x0,'order':qs[_0x0841('0x87')]('-createdAt')},_0x4d537f={'count':0x0,'rows':[]};Promise[_0x0841('0xd1')]()[_0x0841('0x1c')](function(){if(_0x1a149d['query'][_0x0841('0xd2')]){if(!_[_0x0841('0xd3')](_0x2c6ee5,_0x1a149d['query'][_0x0841('0xd2')][_0x0841('0xd4')]())){throw new Error(_0x0841('0xd5'));}_0x2c6ee5=[_0x1a149d[_0x0841('0x27')][_0x0841('0xd2')][_0x0841('0xd4')]()];}if(_0x1a149d[_0x0841('0x27')][_0x0841('0xd6')]){try{var _0x5f5479=JSON[_0x0841('0xba')](_0x1a149d[_0x0841('0x27')][_0x0841('0xd6')]);if(!moment(_0x5f5479[_0x0841('0x3a')])['isValid']()){throw new Error(_0x0841('0xd7'));}if(!moment(_0x5f5479['to'])[_0x0841('0xd8')]()){throw new Error(_0x0841('0xd9'));}}catch(_0x13abe2){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x1a149d['query']['hasOwnProperty']('nolimit')){_0x7e9b8f[_0x0841('0x18')]=qs['limit'](_0x1a149d[_0x0841('0x27')][_0x0841('0x18')]||0xa);_0x7e9b8f[_0x0841('0x17')]=qs[_0x0841('0x17')](_0x1a149d['query']['offset']);}var _0x397c59=_0x2c6ee5[_0x0841('0x73')](function(_0x3c5b8a){if(_0x3c5b8a==='voice'){var _0x3b24a0={'attributes':['id',_0x0841('0xda'),_0x0841('0xdb'),_0x0841('0xdc'),_0x0841('0xdd'),_0x0841('0xde'),_0x0841('0xdf'),_0x0841('0xe0'),_0x0841('0xe1'),_0x0841('0xe2'),'createdAt',_0x0841('0xe3'),_0x0841('0xe4'),_0x0841('0xe5'),_0x0841('0xe6')],'where':{'ContactId':_0x1a149d[_0x0841('0x2b')]['id']},'include':[{'model':db['User'],'as':_0x0841('0xbc'),'attributes':['id','name','fullname','alias']}],'order':[['createdAt',_0x0841('0xe7')]]};if(_0x1a149d[_0x0841('0x27')][_0x0841('0xd6')]){_0x3b24a0['where']['createdAt']={'$gte':_0x5f5479[_0x0841('0x3a')],'$lte':_0x5f5479['to']};}return db[_0x0841('0x51')][_0x0841('0xe8')](_0x3b24a0)[_0x0841('0x1c')](function(_0x3199eb){_0x4d537f[_0x0841('0x16')]+=_0x3199eb[_0x0841('0x16')];return _[_0x0841('0x73')](_0x3199eb[_0x0841('0xa5')],function(_0x37e9e7){var _0x3a2b70=_0x37e9e7[_0x0841('0x3b')]({'plain':!![]});_0x3a2b70[_0x0841('0xd2')]=_0x3c5b8a;if(_0x3a2b70[_0x0841('0xbc')]){_0x3a2b70[_0x0841('0xbc')]={'id':_0x3a2b70[_0x0841('0xbc')]['id'],'name':_0x3a2b70['User'][_0x0841('0x21')],'fullname':_0x3a2b70['User'][_0x0841('0xe9')],'alias':_0x3a2b70[_0x0841('0xbc')][_0x0841('0x33')]};}return _0x3a2b70;});});}else{var _0x2e38f9=_[_0x0841('0xea')](_0x3c5b8a)+(_0x3c5b8a===_0x0841('0xcc')?_0x0841('0xeb'):_0x0841('0xec'));var _0x22df8a={'attributes':['id',_0x0841('0xed'),_0x0841('0xee'),_0x0841('0xef'),'note','disposition',_0x0841('0xf0'),'thirdDisposition',_0x0841('0xe6'),_0x2e38f9+'Id'],'where':{'ContactId':_0x1a149d['params']['id']},'include':[{'model':db[_0x2e38f9],'as':'Account','attributes':['id',_0x0841('0x21'),_0x0841('0xf1')]},{'model':db[_0x0841('0xbc')],'as':'Owner','attributes':['id',_0x0841('0x21'),_0x0841('0xe9')]},{'model':db[_0x0841('0x69')],'as':_0x0841('0x6a'),'attributes':['id',_0x0841('0x21'),_0x0841('0x6b')],'through':{'attributes':[]}}],'order':[[_0x0841('0xef'),_0x0841('0xe7')]]};if(_0x1a149d[_0x0841('0x27')][_0x0841('0xd6')]){_0x22df8a[_0x0841('0x62')][_0x0841('0xef')]={'$gte':_0x5f5479[_0x0841('0x3a')],'$lte':_0x5f5479['to']};}switch(_0x3c5b8a){case _0x0841('0xcc'):_0x22df8a[_0x0841('0x84')][_0x0841('0x64')](_0x0841('0xf2'),_0x0841('0xf3'),_0x0841('0xf4'),_0x0841('0xf5'),_0x0841('0xf6'),_0x0841('0xf7'),_0x0841('0xf8'),_0x0841('0xf9'),_0x0841('0xfa'));break;case _0x0841('0xcb'):_0x22df8a[_0x0841('0x84')][_0x0841('0x64')](_0x0841('0xfb'),'substatus');break;case _0x0841('0xfc'):_0x22df8a['attributes']['push'](_0x0841('0xfd'),_0x0841('0xfe'));break;}return db[_[_0x0841('0xea')](_0x3c5b8a)+_0x0841('0xff')][_0x0841('0xe8')](_0x22df8a)['then'](function(_0x446738){_0x4d537f[_0x0841('0x16')]+=_0x446738[_0x0841('0x16')];return _[_0x0841('0x73')](_0x446738[_0x0841('0xa5')],function(_0x87c2c6){var _0x3c56c2=_0x87c2c6[_0x0841('0x3b')]({'plain':!![]});_0x3c56c2['channel']=_0x3c5b8a;if(_0x3c56c2[_0x0841('0x100')]){_0x3c56c2[_0x0841('0x100')]={'id':_0x3c56c2[_0x0841('0x100')]['id'],'name':_0x3c56c2[_0x0841('0x100')][_0x0841('0x21')],'fullname':_0x3c56c2[_0x0841('0x100')]['fullname']};}return _0x3c56c2;});});}});return Promise[_0x0841('0x8e')](_0x397c59);})[_0x0841('0x1c')](function(_0x1ad4d5){return _(_0x1ad4d5)[_0x0841('0x101')]()[_0x0841('0x102')](_0x0841('0xef'))['reverse']()['value']();})['then'](function(_0x25916f){_0x4d537f['rows']=_0x7e9b8f[_0x0841('0x18')]?_0x25916f['slice'](_0x7e9b8f[_0x0841('0x17')],_0x7e9b8f[_0x0841('0x17')]+_0x7e9b8f[_0x0841('0x18')]):_0x25916f;return _0x4d537f;})['then'](respondWithFilteredResult(_0xfd1354,_0x7e9b8f))[_0x0841('0x28')](handleError(_0xfd1354,null));}; \ No newline at end of file +var _0x8dd4=['../../components/parsers/qs','../../config/logger','../../config/environment/shared','redis','defaults','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','stack','name','send','describe','getOptions','query','catch','CmContact','find','tags','keys','length','cf_','displayName','analytics','CmCustomField','columnName','custom','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','findAll','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','WhatsappInteraction','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','push','ListId','findOrCreate','spread','contact','all','Tag','color','Phones','params','ContactItemType','ItemType','sequelize','Phones.OrderBy','$and','omit','format','pickBy','startsWith','cf_%d','isEmpty','table','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','filters','intersection','fields','attributes','order','sort','pick','filter','map','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','literal','`ItemType`.OrderBy','ItemType.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','rawAttributes','nolimit','ContactId','options','includeAll','include','getHopperHistories','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','No\x20association\x20keys\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','agent','binding','../../components/import/cm/csv2','stringify','exit','message','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','-createdAt','channel','includes','toLowerCase','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','voice','uniqueid','callerid','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','DESC','range','findAndCountAll','alias','startCase','Website','Account','closed','closedAt','note','disposition','secondDisposition','UserId','key','Owner','fullname','Tags','customerIp','customerPort','deviceModel','ratingMessage','referer','substatus','threadId','Interaction','sortBy','reverse','value','moment','bluebird','path','lodash','squel','papaparse','ioredis','../../components/contacts'];(function(_0x564821,_0x4d037e){var _0x2b604d=function(_0x26fabf){while(--_0x26fabf){_0x564821['push'](_0x564821['shift']());}};_0x2b604d(++_0x4d037e);}(_0x8dd4,0x1dc));var _0x48dd=function(_0x2c78df,_0x4e8eae){_0x2c78df=_0x2c78df-0x0;var _0x1a602d=_0x8dd4[_0x2c78df];return _0x1a602d;};'use strict';var moment=require(_0x48dd('0x0'));var BPromise=require(_0x48dd('0x1'));var util=require('util');var path=require(_0x48dd('0x2'));var fs=require('fs');var _=require(_0x48dd('0x3'));var squel=require(_0x48dd('0x4'));var Papa=require(_0x48dd('0x5'));var Redis=require(_0x48dd('0x6'));var contacts=require(_0x48dd('0x7'));var qs=require(_0x48dd('0x8'));var logger=require(_0x48dd('0x9'))('api');var config=require('../../config/environment');var shared=require(_0x48dd('0xa'));var db=require('../../mysqldb')['db'];config[_0x48dd('0xb')]=_[_0x48dd('0xc')](config[_0x48dd('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48dd('0xb')]));require(_0x48dd('0xd'))[_0x48dd('0xe')](socket);function respondWithResult(_0x2c8ea6,_0x31a56e){_0x31a56e=_0x31a56e||0xc8;return function(_0x59ac9c){if(_0x59ac9c){return _0x2c8ea6[_0x48dd('0xf')](_0x31a56e)[_0x48dd('0x10')](_0x59ac9c);}};}function respondWithFilteredResult(_0xe39852,_0x222daf){return function(_0x120407){if(_0x120407){var _0x198343=typeof _0x222daf[_0x48dd('0x11')]===_0x48dd('0x12')&&typeof _0x222daf[_0x48dd('0x13')]==='undefined';var _0x17ccc8=_0x120407[_0x48dd('0x14')];var _0x57d1d2=_0x198343?0x0:_0x222daf[_0x48dd('0x11')];var _0x4ae985=_0x198343?_0x120407['count']:_0x222daf['offset']+_0x222daf['limit'];var _0x52c2ff;if(_0x4ae985>=_0x17ccc8){_0x4ae985=_0x17ccc8;_0x52c2ff=0xc8;}else{_0x52c2ff=0xce;}_0xe39852[_0x48dd('0xf')](_0x52c2ff);return _0xe39852[_0x48dd('0x15')]('Content-Range',_0x57d1d2+'-'+_0x4ae985+'/'+_0x17ccc8)[_0x48dd('0x10')](_0x120407);}return null;};}function saveUpdates(_0x8848f3){return function(_0x28511c){if(_0x28511c){return _0x28511c[_0x48dd('0x16')](_0x8848f3)[_0x48dd('0x17')](function(_0x2d069e){return _0x2d069e;});}return null;};}function removeEntity(_0x1ded92){return function(_0x1ace51){if(_0x1ace51){return _0x1ace51[_0x48dd('0x18')]()['then'](function(){_0x1ded92['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2450bd){return function(_0x540d92){if(!_0x540d92){_0x2450bd[_0x48dd('0x19')](0x194);}return _0x540d92;};}function handleError(_0x3e2392,_0x56c7ae){_0x56c7ae=_0x56c7ae||0x1f4;return function(_0x678a){logger['error'](_0x678a[_0x48dd('0x1a')]);if(_0x678a[_0x48dd('0x1b')]){delete _0x678a[_0x48dd('0x1b')];}_0x3e2392['status'](_0x56c7ae)[_0x48dd('0x1c')](_0x678a);};}exports['index']=function(_0x153648,_0xfdd408){var _0x2d4b38={};return contacts[_0x48dd('0x1d')]()[_0x48dd('0x17')](function(_0x3eeacf){_0x2d4b38=qs[_0x48dd('0x1e')](_0x3eeacf,_0x153648);return contacts['findAll'](_0x153648[_0x48dd('0x1f')],_0x153648['user'],_0x2d4b38,_0x3eeacf);})[_0x48dd('0x17')](respondWithFilteredResult(_0xfdd408,_0x2d4b38))[_0x48dd('0x20')](handleError(_0xfdd408,null));};exports[_0x48dd('0x18')]=function(_0x36c45e,_0xd811c3){return db[_0x48dd('0x21')][_0x48dd('0x22')]({'where':{'id':_0x36c45e['params']['id']}})['then'](handleEntityNotFound(_0xd811c3,null))['then'](removeEntity(_0xd811c3,null))['catch'](handleError(_0xd811c3,null));};exports[_0x48dd('0x1d')]=function(_0x15ec62,_0x1de20d){return db['CmContact'][_0x48dd('0x1d')]()['then'](function(_0x1671a2){delete _0x1671a2[_0x48dd('0x23')];for(var _0x5022ae=0x0;_0x5022ae0x0){return new Promise(function(_0x585bb2){var _0x2c3c37=[];for(var _0xf466a9=0x0;_0xf466a9<_0x596114[_0x48dd('0x25')];_0xf466a9++){_0x2c3c37[_0x48dd('0x59')](insertAdditionalPhones(_0x596114[_0xf466a9][_0x48dd('0x5d')],_0x596114[_0xf466a9][_0x48dd('0x55')]));}Promise[_0x48dd('0x5e')](_0x2c3c37)[_0x48dd('0x17')](function(){_0x585bb2(0x1);});})['then'](function(){return{'success':_0x98c0bb,'failure':_0x286544,'duplicates':_0x13ce6b};});}else{return{'success':_0x98c0bb,'failure':_0x286544,'duplicates':_0x13ce6b};}}})[_0x48dd('0x17')](respondWithResult(_0x588a1b,0xc9))[_0x48dd('0x20')](handleError(_0x588a1b,null));};exports['show']=function(_0x6a478f,_0x108f0d){var _0x3f5d41;return db['CmContact'][_0x48dd('0x1d')]()['then'](function(_0x27bf43){return db[_0x48dd('0x21')]['find']({'where':{'id':_0x6a478f['params']['id']},'include':[{'model':db[_0x48dd('0x5f')],'as':'Tags','attributes':['id',_0x48dd('0x1b'),_0x48dd('0x60')],'required':_0x6a478f[_0x48dd('0x1f')]['tag']?!![]:![]},{'model':db[_0x48dd('0x48')],'as':_0x48dd('0x61'),'where':{'CmContactId':_0x6a478f[_0x48dd('0x62')]['id']},'required':![],'include':[{'model':db[_0x48dd('0x63')],'as':_0x48dd('0x64')}]}],'order':[db[_0x48dd('0x65')]['literal'](_0x48dd('0x66'))],'attributes':_[_0x48dd('0x24')](_0x27bf43)});})[_0x48dd('0x17')](function(_0x3ede7b){if(!_[_0x48dd('0x51')](_0x3ede7b)){_0x3f5d41=_0x3ede7b[_0x48dd('0x35')]({'plain':!![]});var _0x6875b5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x3ede7b&&_0x3ede7b['ListId']){if(_0x3ede7b[_0x48dd('0x5a')]){_0x6875b5[_0x48dd('0x58')][_0x48dd('0x67')][_0x48dd('0x59')]({'ListId':{'$ne':_0x3ede7b[_0x48dd('0x5a')]}});}}return db[_0x48dd('0x29')][_0x48dd('0x33')](_0x6875b5);}})[_0x48dd('0x17')](function(_0x4ae357){if(!_[_0x48dd('0x51')](_0x4ae357)){return _[_0x48dd('0x68')](_0x3f5d41,_['map'](_0x4ae357,function(_0x3034e8){return util[_0x48dd('0x69')]('cf_%d',_0x3034e8['id']);}));}})[_0x48dd('0x17')](handleEntityNotFound(_0x108f0d,null))[_0x48dd('0x17')](respondWithResult(_0x108f0d,null))['catch'](handleError(_0x108f0d,null));};exports['update']=function(_0x211bd0,_0x3f179b){var _0x2aebef;if(_0x211bd0['body']['id']){delete _0x211bd0[_0x48dd('0x32')]['id'];}if(!_[_0x48dd('0x51')](_0x211bd0[_0x48dd('0x32')][_0x48dd('0x52')])){var _0x314403=_0x211bd0['body'][_0x48dd('0x52')];if(!_[_0x48dd('0x51')](shared['timezones'][_0x314403]))_0x211bd0[_0x48dd('0x32')][_0x48dd('0x54')]=shared['timezones'][_0x314403]['utcOffset'];}return db[_0x48dd('0x21')][_0x48dd('0x22')]({'where':{'id':_0x211bd0['params']['id']}})[_0x48dd('0x17')](handleEntityNotFound(_0x3f179b,null))['then'](saveUpdates(_0x211bd0[_0x48dd('0x32')],null))[_0x48dd('0x17')](function(_0x4a019a){_0x2aebef=_0x4a019a;var _0x16d814={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4a019a&&_0x4a019a[_0x48dd('0x5a')]){if(_0x4a019a['ListId']){_0x16d814[_0x48dd('0x58')][_0x48dd('0x67')]['push']({'ListId':{'$ne':_0x4a019a['ListId']}});}}return db[_0x48dd('0x29')]['findAll'](_0x16d814);})[_0x48dd('0x17')](function(_0x28c85f){if(_0x28c85f){return _[_0x48dd('0x68')](_[_0x48dd('0x6a')](_0x211bd0['body'],function(_0x1658a3,_0x5f5807){return _[_0x48dd('0x6b')](_0x5f5807,'cf_');}),_['map'](_0x28c85f,function(_0x564030){return util[_0x48dd('0x69')](_0x48dd('0x6c'),_0x564030['id']);}));}})['then'](function(_0x42ff48){if(_0x42ff48&&!_[_0x48dd('0x6d')](_0x42ff48)){var _0x193136=squel[_0x48dd('0x16')]()[_0x48dd('0x6e')]('cm_contacts')[_0x48dd('0x6f')](_0x42ff48)[_0x48dd('0x58')](_0x48dd('0x70'),_0x211bd0[_0x48dd('0x62')]['id'])[_0x48dd('0x71')]();return db['sequelize'][_0x48dd('0x1f')](_0x193136[_0x48dd('0x72')],{'replacements':_0x193136['values']});}})[_0x48dd('0x17')](function(){if(_0x211bd0[_0x48dd('0x32')][_0x48dd('0x73')]&&_0x2aebef){return db['CmHopper'][_0x48dd('0x16')]({'phone':_0x211bd0['body'][_0x48dd('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x2aebef['id']}});}})[_0x48dd('0x17')](function(){return _0x2aebef;})[_0x48dd('0x17')](respondWithResult(_0x3f179b,null))['catch'](handleError(_0x3f179b,null));};exports[_0x48dd('0x74')]=function(_0x21027a,_0x55a725){var _0x22ce7e={};var _0x241977={};var _0x1af3d4;var _0x27bc56;return db[_0x48dd('0x21')][_0x48dd('0x75')]({'where':{'id':_0x21027a[_0x48dd('0x62')]['id']}})[_0x48dd('0x17')](handleEntityNotFound(_0x55a725,null))[_0x48dd('0x17')](function(_0x58a0d6){if(_0x58a0d6){_0x1af3d4=_0x58a0d6;_0x241977[_0x48dd('0x76')]=_[_0x48dd('0x24')](db[_0x48dd('0x5f')]['rawAttributes']);_0x241977['query']=_[_0x48dd('0x24')](_0x21027a[_0x48dd('0x1f')]);_0x241977[_0x48dd('0x77')]=_['intersection'](_0x241977[_0x48dd('0x76')],_0x241977[_0x48dd('0x1f')]);_0x22ce7e['attributes']=_[_0x48dd('0x78')](_0x241977[_0x48dd('0x76')],qs[_0x48dd('0x79')](_0x21027a[_0x48dd('0x1f')]['fields']));_0x22ce7e['attributes']=_0x22ce7e[_0x48dd('0x7a')]['length']?_0x22ce7e[_0x48dd('0x7a')]:_0x241977[_0x48dd('0x76')];_0x22ce7e[_0x48dd('0x7b')]=qs[_0x48dd('0x7c')](_0x21027a[_0x48dd('0x1f')][_0x48dd('0x7c')]);_0x22ce7e[_0x48dd('0x58')]=qs[_0x48dd('0x77')](_[_0x48dd('0x7d')](_0x21027a[_0x48dd('0x1f')],_0x241977[_0x48dd('0x77')]));if(_0x21027a['query'][_0x48dd('0x7e')]){_0x22ce7e[_0x48dd('0x58')]=_[_0x48dd('0x31')](_0x22ce7e[_0x48dd('0x58')],{'$or':_[_0x48dd('0x7f')](_0x22ce7e[_0x48dd('0x7a')],function(_0x9c32b7){var _0x4343c3={};_0x4343c3[_0x9c32b7]={'$like':'%'+_0x21027a['query'][_0x48dd('0x7e')]+'%'};return _0x4343c3;})});}_0x22ce7e=_['merge']({},_0x22ce7e,_0x21027a['options']);return _0x1af3d4['getTags'](_0x22ce7e);}})['then'](function(_0x26b4ad){if(_0x26b4ad){_0x27bc56=_0x26b4ad[_0x48dd('0x25')];if(!_0x21027a[_0x48dd('0x1f')][_0x48dd('0x30')]('nolimit')){_0x22ce7e[_0x48dd('0x13')]=qs[_0x48dd('0x13')](_0x21027a[_0x48dd('0x1f')][_0x48dd('0x13')]);_0x22ce7e[_0x48dd('0x11')]=qs[_0x48dd('0x11')](_0x21027a[_0x48dd('0x1f')][_0x48dd('0x11')]);}return _0x1af3d4[_0x48dd('0x74')](_0x22ce7e);}})[_0x48dd('0x17')](function(_0x233c73){if(_0x233c73){return _0x233c73?{'count':_0x27bc56,'rows':_0x233c73}:null;}})[_0x48dd('0x17')](respondWithResult(_0x55a725,null))['catch'](handleError(_0x55a725,null));};exports[_0x48dd('0x80')]=function(_0x597e97,_0x31d174){if(_0x597e97[_0x48dd('0x32')]['id']){delete _0x597e97[_0x48dd('0x32')]['id'];}return db[_0x48dd('0x21')][_0x48dd('0x75')]({'where':{'id':_0x597e97['params']['id']}})[_0x48dd('0x17')](handleEntityNotFound(_0x31d174,null))['then'](function(_0x5a4d13){if(_0x5a4d13){return _0x5a4d13[_0x48dd('0x80')](_0x597e97[_0x48dd('0x32')][_0x48dd('0x81')]||[]);}return null;})[_0x48dd('0x17')](respondWithResult(_0x31d174,null))[_0x48dd('0x20')](handleError(_0x31d174,null));};exports[_0x48dd('0x82')]=function(_0x31f2a7,_0x4d9381){var _0x3d4c11=[];_0x3d4c11['push'](addAdditionalPhones(_0x31f2a7[_0x48dd('0x32')]));Promise[_0x48dd('0x5e')](_0x3d4c11)[_0x48dd('0x17')](function(){_0x3d4c11=[];_0x3d4c11[_0x48dd('0x59')](deleteCmHopperPhones(_0x31f2a7[_0x48dd('0x32')]['id']));_0x3d4c11[_0x48dd('0x59')](addCmHopperPhones(_0x31f2a7[_0x48dd('0x32')]['id']));Promise[_0x48dd('0x5e')](_0x3d4c11)['then'](function(){return[0x1];})[_0x48dd('0x17')](respondWithResult(_0x4d9381,null));});};function addAdditionalPhones(_0x28d6a5){var _0x91ad70;return new Promise(function(_0x252658){return db[_0x48dd('0x48')]['destroy']({'where':{'CmContactId':_0x28d6a5['id']}})[_0x48dd('0x17')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x48dd('0x83')]})[_0x48dd('0x17')](function(_0x21b7c3){var _0x50d0b8=[];for(var _0x25cf16=0x0;_0x25cf16<_0x28d6a5[_0x48dd('0x84')][_0x48dd('0x25')];_0x25cf16++){var _0x397f81=_0x28d6a5[_0x48dd('0x85')]?_[_0x48dd('0x51')](_0x28d6a5[_0x48dd('0x85')][_0x25cf16])?'':_0x28d6a5['item_types'][_0x25cf16]:_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x86')]?_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x86')]:'';var _0x3cfad2=_['isNil'](_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x87')])?'':_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x87')];var _0x5bcc2a=_0x397f81+':'+_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x73')]+'§'+_0x3cfad2;if(_[_0x48dd('0x51')](_0x91ad70))_0x91ad70=_0x5bcc2a;else _0x91ad70+=';'+_0x5bcc2a;var _0x16320f=null;var _0x143a39=null;if(_0x28d6a5['item_types']){if(!_[_0x48dd('0x51')](_0x28d6a5['item_types'][_0x25cf16])){_0x143a39=_[_0x48dd('0x22')](_0x21b7c3,function(_0x4cb6e5){return _0x4cb6e5['id']===_0x28d6a5['item_types'][_0x25cf16];});if(!_[_0x48dd('0x51')](_0x143a39)){_0x16320f=_0x143a39[_0x48dd('0x83')];}}}else{if(!_[_0x48dd('0x51')](_0x28d6a5[_0x48dd('0x84')][_0x25cf16])){_0x143a39=_['find'](_0x21b7c3,function(_0x3bb262){return _0x3bb262['id']===_0x28d6a5['items'][_0x25cf16][_0x48dd('0x86')];});if(!_[_0x48dd('0x51')](_0x143a39)){_0x16320f=_0x25cf16;}}}if(_[_0x48dd('0x51')](_0x16320f)){_0x16320f=0x64;}_0x50d0b8[_0x48dd('0x59')](addAdditionalPhone(_0x28d6a5['id'],_0x28d6a5[_0x48dd('0x84')][_0x25cf16]['phone'],_0x28d6a5['item_types']?_[_0x48dd('0x51')](_0x28d6a5['item_types'][_0x25cf16])?null:_0x28d6a5[_0x48dd('0x85')][_0x25cf16]:_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x86')]?_0x28d6a5[_0x48dd('0x84')][_0x25cf16][_0x48dd('0x86')]:null,_0x16320f,_0x3cfad2));}Promise[_0x48dd('0x5e')](_0x50d0b8)[_0x48dd('0x17')](function(){db[_0x48dd('0x21')]['update']({'AdditionalPhones':_0x91ad70},{'where':{'id':_0x28d6a5['id']}})[_0x48dd('0x17')](function(){_0x252658(0x1);});});});});});}function addAdditionalPhone(_0x3f25c9,_0x5f1d4e,_0x4469bf,_0x3393e0,_0x1541d7){return db[_0x48dd('0x48')][_0x48dd('0x22')]({'where':{'CmContactId':_0x3f25c9,'item':_0x5f1d4e}})[_0x48dd('0x17')](function(_0x49fcd8){if(_0x49fcd8)logger[_0x48dd('0x2d')]('contact\x20phone\x20exists',_0x49fcd8);else{db[_0x48dd('0x48')][_0x48dd('0x3d')]({'CmContactId':_0x3f25c9,'item':_0x5f1d4e,'ItemTypeId':_0x4469bf,'OrderBy':_0x3393e0,'ItemClass':_0x48dd('0x88'),'description':_0x1541d7});}});}function deleteCmHopperPhones(_0x5652fb){return new Promise(function(_0x5ac1d8){return db[_0x48dd('0x39')][_0x48dd('0x33')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5652fb}})[_0x48dd('0x17')](function(_0x2bbdf8){db[_0x48dd('0x89')][_0x48dd('0x18')]({'where':{'CmHopperId':{'$in':_['map'](_0x2bbdf8,'id')}}});})[_0x48dd('0x17')](function(){_0x5ac1d8(0x1);});});}function addCmHopperPhones(_0x91af03){return new Promise(function(_0x2afc67){return db[_0x48dd('0x39')][_0x48dd('0x33')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x91af03}})['then'](function(_0x478424){var _0xe5fbf2=[];_[_0x48dd('0x7f')](_0x478424,function(_0x2429d2){_0xe5fbf2['push'](createCmHopperPhone(_0x91af03,_0x2429d2['id']));});Promise[_0x48dd('0x5e')](_0xe5fbf2)[_0x48dd('0x17')](function(){_0x2afc67(0x1);});});});}function createCmHopperPhone(_0x27b81e,_0x3b4781){return new Promise(function(_0x2b1dd5){db[_0x48dd('0x48')]['findAll']({'raw':!![],'attributes':[_0x48dd('0x8a'),_0x48dd('0x83')],'where':{'CmContactId':_0x27b81e,'ItemClass':_0x48dd('0x88')},'include':[{'model':db[_0x48dd('0x63')],'attributes':[_0x48dd('0x83')],'as':_0x48dd('0x64')}],'order':['OrderBy',db[_0x48dd('0x65')][_0x48dd('0x8b')](_0x48dd('0x8c'))]})[_0x48dd('0x17')](function(_0x495c7f){var _0x519481=0x1;var _0x59463c=_['map'](_0x495c7f,function(_0x4c71f6){_0x4c71f6['CmHopperId']=_0x3b4781;_0x4c71f6['phone']=_0x4c71f6[_0x48dd('0x8a')];_0x4c71f6[_0x48dd('0x83')]=_0x519481;delete _0x4c71f6[_0x48dd('0x8d')];_0x519481=_0x519481+0x1;return _0x4c71f6;});return db[_0x48dd('0x89')][_0x48dd('0x56')](_0x59463c,{});})[_0x48dd('0x17')](function(){_0x2b1dd5(0x1);});});}function insertAdditionalPhones(_0x588c0b,_0x50214d){return new Promise(function(_0x4e0680){var _0x7715d6=[];for(var _0x473f3b=0x0;_0x473f3b<_0x50214d[_0x48dd('0x25')];_0x473f3b++){var _0x4a4e86=_0x50214d[_0x473f3b];_0x7715d6[_0x48dd('0x59')](parseContactItemType(_0x4a4e86));}Promise[_0x48dd('0x5e')](_0x7715d6)['then'](function(){var _0xc0f4af={'id':_0x588c0b['id'],'items':_0x50214d};return addAdditionalPhones(_0xc0f4af)[_0x48dd('0x17')](function(){return addCmHopperPhones(_0x588c0b['id']);});})['then'](function(){_0x4e0680(_0x588c0b);});});}function parseContactItemType(_0x2abd08){return new Promise(function(_0xae8f65){if(_0x2abd08[_0x48dd('0x30')](_0x48dd('0x86'))){_0xae8f65(_0x2abd08);}else{return db[_0x48dd('0x63')][_0x48dd('0x22')]({'where':{'name':_0x2abd08['ItemType']}})[_0x48dd('0x17')](function(_0x584099){if(_[_0x48dd('0x51')](_0x584099))_0x2abd08[_0x48dd('0x86')]=null;else _0x2abd08[_0x48dd('0x86')]=_0x584099['id'];_0xae8f65(_0x2abd08);});}});}exports['getAdditionalPhones']=function(_0x3cb063,_0x3aef33){return db[_0x48dd('0x48')][_0x48dd('0x33')]({'raw':!![],'where':{'CmContactId':_0x3cb063[_0x48dd('0x62')]['id'],'ItemClass':_0x48dd('0x88')},'include':[{'model':db[_0x48dd('0x63')],'as':_0x48dd('0x64')}],'order':[[_0x48dd('0x83')],[db[_0x48dd('0x65')][_0x48dd('0x8b')]('`ItemType`.OrderBy')]]})[_0x48dd('0x17')](function(_0x143ac0){return _0x143ac0;})[_0x48dd('0x17')](respondWithResult(_0x3aef33,null))[_0x48dd('0x20')](handleError(_0x3aef33,null));};exports[_0x48dd('0x8e')]=function(_0x6a087e,_0xa2d04a){return db[_0x48dd('0x48')][_0x48dd('0x33')]({'raw':!![],'where':{'CmContactId':_0x6a087e['body'][_0x48dd('0x8f')]}})[_0x48dd('0x17')](function(_0x494271){var _0xffbe3b=_[_0x48dd('0x7f')](_0x494271,function(_0x56aedb){_0x56aedb[_0x48dd('0x90')]=_0x6a087e[_0x48dd('0x32')][_0x48dd('0x91')];return _0x56aedb;});return db[_0x48dd('0x48')][_0x48dd('0x56')](_0xffbe3b,{});})['then'](function(){return addCmHopperPhones(_0x6a087e[_0x48dd('0x32')]['toContactId']);})[_0x48dd('0x17')](function(){return['ok'];})[_0x48dd('0x17')](respondWithResult(_0xa2d04a,null))[_0x48dd('0x20')](handleError(_0xa2d04a,null));};exports[_0x48dd('0x92')]=function(_0x54f54f,_0x4e114f){var _0xcc925a=[];_0xcc925a[_0x48dd('0x59')](createCmHopperPhone(_0x54f54f['body']['id'],_0x54f54f['body'][_0x48dd('0x93')]));Promise['all'](_0xcc925a)[_0x48dd('0x17')](function(){return[0x1];})[_0x48dd('0x17')](respondWithResult(_0x4e114f,null));};exports[_0x48dd('0x94')]=function(_0x4697c2,_0x3cab7c){var _0x3c5b8b={'raw':![],'where':{}};var _0x483136={};var _0x2cd630={'count':0x0,'rows':[]};return db['CmContact'][_0x48dd('0x75')]({'where':{'id':_0x4697c2[_0x48dd('0x62')]['id']}})['then'](handleEntityNotFound(_0x3cab7c,null))[_0x48dd('0x17')](function(_0x4d4149){if(_0x4d4149){_0x483136[_0x48dd('0x76')]=_[_0x48dd('0x24')](db['CmHopper'][_0x48dd('0x95')]);_0x483136['query']=_['keys'](_0x4697c2['query']);_0x483136['filters']=_[_0x48dd('0x78')](_0x483136[_0x48dd('0x76')],_0x483136[_0x48dd('0x1f')]);_0x3c5b8b['attributes']=_[_0x48dd('0x78')](_0x483136[_0x48dd('0x76')],qs[_0x48dd('0x79')](_0x4697c2['query'][_0x48dd('0x79')]));_0x3c5b8b[_0x48dd('0x7a')]=_0x3c5b8b[_0x48dd('0x7a')]['length']?_0x3c5b8b[_0x48dd('0x7a')]:_0x483136[_0x48dd('0x76')];if(!_0x4697c2[_0x48dd('0x1f')][_0x48dd('0x30')](_0x48dd('0x96'))){_0x3c5b8b[_0x48dd('0x13')]=qs[_0x48dd('0x13')](_0x4697c2['query'][_0x48dd('0x13')]);_0x3c5b8b[_0x48dd('0x11')]=qs[_0x48dd('0x11')](_0x4697c2[_0x48dd('0x1f')][_0x48dd('0x11')]);}_0x3c5b8b[_0x48dd('0x7b')]=qs[_0x48dd('0x7c')](_0x4697c2[_0x48dd('0x1f')][_0x48dd('0x7c')]);_0x3c5b8b[_0x48dd('0x58')]=qs[_0x48dd('0x77')](_[_0x48dd('0x7d')](_0x4697c2[_0x48dd('0x1f')],_0x483136[_0x48dd('0x77')]));_0x3c5b8b['where'][_0x48dd('0x97')]=_0x4d4149['id'];if(_0x4697c2['query'][_0x48dd('0x7e')]){_0x3c5b8b[_0x48dd('0x58')]=_['merge'](_0x3c5b8b[_0x48dd('0x58')],{'$or':_[_0x48dd('0x7f')](_0x3c5b8b[_0x48dd('0x7a')],function(_0x552dd3){var _0x41a75a={};_0x41a75a[_0x552dd3]={'$like':'%'+_0x4697c2[_0x48dd('0x1f')][_0x48dd('0x7e')]+'%'};return _0x41a75a;})});}_0x3c5b8b=_[_0x48dd('0x31')]({},_0x3c5b8b,_0x4697c2[_0x48dd('0x98')]);return db[_0x48dd('0x39')][_0x48dd('0x14')]({'where':_0x3c5b8b[_0x48dd('0x58')]})[_0x48dd('0x17')](function(_0x2377f7){_0x2cd630[_0x48dd('0x14')]=_0x2377f7;if(_0x4697c2[_0x48dd('0x1f')][_0x48dd('0x99')]){_0x3c5b8b[_0x48dd('0x9a')]=[{'all':!![]}];}return db[_0x48dd('0x39')][_0x48dd('0x33')](_0x3c5b8b);})[_0x48dd('0x17')](function(_0x2666e1){_0x2cd630['rows']=_0x2666e1;return _0x2cd630;});}})[_0x48dd('0x17')](respondWithFilteredResult(_0x3cab7c,_0x3c5b8b))[_0x48dd('0x20')](handleError(_0x3cab7c,null));};exports[_0x48dd('0x9b')]=function(_0x585c3e,_0x4b298a){var _0x36f9fd={'raw':!![],'where':{}};var _0x1c8ce3={};var _0x4962e3={'count':0x0,'rows':[]};return db[_0x48dd('0x21')][_0x48dd('0x75')]({'where':{'id':_0x585c3e['params']['id']}})['then'](handleEntityNotFound(_0x4b298a,null))['then'](function(_0x2128be){if(_0x2128be){_0x1c8ce3[_0x48dd('0x76')]=_[_0x48dd('0x24')](db[_0x48dd('0x4a')][_0x48dd('0x95')]);_0x1c8ce3[_0x48dd('0x1f')]=_[_0x48dd('0x24')](_0x585c3e[_0x48dd('0x1f')]);_0x1c8ce3['filters']=_[_0x48dd('0x78')](_0x1c8ce3[_0x48dd('0x76')],_0x1c8ce3[_0x48dd('0x1f')]);_0x36f9fd[_0x48dd('0x7a')]=_[_0x48dd('0x78')](_0x1c8ce3['model'],qs[_0x48dd('0x79')](_0x585c3e[_0x48dd('0x1f')]['fields']));_0x36f9fd[_0x48dd('0x7a')]=_0x36f9fd[_0x48dd('0x7a')]['length']?_0x36f9fd[_0x48dd('0x7a')]:_0x1c8ce3[_0x48dd('0x76')];if(!_0x585c3e[_0x48dd('0x1f')][_0x48dd('0x30')](_0x48dd('0x96'))){_0x36f9fd[_0x48dd('0x13')]=qs[_0x48dd('0x13')](_0x585c3e[_0x48dd('0x1f')]['limit']);_0x36f9fd[_0x48dd('0x11')]=qs[_0x48dd('0x11')](_0x585c3e[_0x48dd('0x1f')][_0x48dd('0x11')]);}_0x36f9fd[_0x48dd('0x7b')]=qs['sort'](_0x585c3e['query'][_0x48dd('0x7c')]);_0x36f9fd[_0x48dd('0x58')]=qs[_0x48dd('0x77')](_[_0x48dd('0x7d')](_0x585c3e['query'],_0x1c8ce3[_0x48dd('0x77')]));_0x36f9fd[_0x48dd('0x58')][_0x48dd('0x97')]=_0x2128be['id'];if(_0x585c3e['query']['filter']){_0x36f9fd[_0x48dd('0x58')]=_['merge'](_0x36f9fd[_0x48dd('0x58')],{'$or':_[_0x48dd('0x7f')](_0x36f9fd['attributes'],function(_0x31ca9e){var _0x4af4b2={};_0x4af4b2[_0x31ca9e]={'$like':'%'+_0x585c3e[_0x48dd('0x1f')][_0x48dd('0x7e')]+'%'};return _0x4af4b2;})});}_0x36f9fd=_[_0x48dd('0x31')]({},_0x36f9fd,_0x585c3e[_0x48dd('0x98')]);return db[_0x48dd('0x4a')]['count']({'where':_0x36f9fd[_0x48dd('0x58')]})['then'](function(_0x4c9fc8){_0x4962e3[_0x48dd('0x14')]=_0x4c9fc8;if(_0x585c3e[_0x48dd('0x1f')][_0x48dd('0x99')]){_0x36f9fd[_0x48dd('0x9a')]=[{'all':!![]}];}return db[_0x48dd('0x4a')][_0x48dd('0x33')](_0x36f9fd);})['then'](function(_0x44493f){_0x4962e3[_0x48dd('0x9c')]=_0x44493f;return _0x4962e3;});}})[_0x48dd('0x17')](respondWithFilteredResult(_0x4b298a,_0x36f9fd))[_0x48dd('0x20')](handleError(_0x4b298a,null));};exports['getHopperFinals']=function(_0x5457a5,_0x155f17){var _0x51e336={'raw':!![],'where':{}};var _0x126eef={};var _0x456780={'count':0x0,'rows':[]};return db[_0x48dd('0x21')]['findOne']({'where':{'id':_0x5457a5[_0x48dd('0x62')]['id']}})[_0x48dd('0x17')](handleEntityNotFound(_0x155f17,null))[_0x48dd('0x17')](function(_0x987ed0){if(_0x987ed0){_0x126eef[_0x48dd('0x76')]=_[_0x48dd('0x24')](db[_0x48dd('0x49')][_0x48dd('0x95')]);_0x126eef['query']=_[_0x48dd('0x24')](_0x5457a5[_0x48dd('0x1f')]);_0x126eef['filters']=_['intersection'](_0x126eef[_0x48dd('0x76')],_0x126eef[_0x48dd('0x1f')]);_0x51e336[_0x48dd('0x7a')]=_['intersection'](_0x126eef['model'],qs[_0x48dd('0x79')](_0x5457a5[_0x48dd('0x1f')][_0x48dd('0x79')]));_0x51e336['attributes']=_0x51e336['attributes'][_0x48dd('0x25')]?_0x51e336[_0x48dd('0x7a')]:_0x126eef['model'];if(!_0x5457a5[_0x48dd('0x1f')]['hasOwnProperty'](_0x48dd('0x96'))){_0x51e336['limit']=qs['limit'](_0x5457a5[_0x48dd('0x1f')][_0x48dd('0x13')]);_0x51e336['offset']=qs[_0x48dd('0x11')](_0x5457a5[_0x48dd('0x1f')]['offset']);}_0x51e336[_0x48dd('0x7b')]=qs['sort'](_0x5457a5[_0x48dd('0x1f')][_0x48dd('0x7c')]);_0x51e336[_0x48dd('0x58')]=qs['filters'](_['pick'](_0x5457a5[_0x48dd('0x1f')],_0x126eef[_0x48dd('0x77')]));_0x51e336['where'][_0x48dd('0x97')]=_0x987ed0['id'];if(_0x5457a5[_0x48dd('0x1f')]['filter']){_0x51e336[_0x48dd('0x58')]=_[_0x48dd('0x31')](_0x51e336[_0x48dd('0x58')],{'$or':_[_0x48dd('0x7f')](_0x51e336[_0x48dd('0x7a')],function(_0x48907c){var _0x542d94={};_0x542d94[_0x48907c]={'$like':'%'+_0x5457a5[_0x48dd('0x1f')][_0x48dd('0x7e')]+'%'};return _0x542d94;})});}_0x51e336=_[_0x48dd('0x31')]({},_0x51e336,_0x5457a5[_0x48dd('0x98')]);return db[_0x48dd('0x49')][_0x48dd('0x14')]({'where':_0x51e336[_0x48dd('0x58')]})[_0x48dd('0x17')](function(_0x19de64){_0x456780[_0x48dd('0x14')]=_0x19de64;if(_0x5457a5[_0x48dd('0x1f')][_0x48dd('0x99')]){_0x51e336['include']=[{'all':!![]}];}return db[_0x48dd('0x49')][_0x48dd('0x33')](_0x51e336);})[_0x48dd('0x17')](function(_0x54f90e){_0x456780[_0x48dd('0x9c')]=_0x54f90e;return _0x456780;});}})[_0x48dd('0x17')](respondWithFilteredResult(_0x155f17,_0x51e336))[_0x48dd('0x20')](handleError(_0x155f17,null));};exports[_0x48dd('0x9d')]=function(_0x3046b5,_0x56b26a){var _0x810b16={'raw':!![],'where':{}};var _0x313f0d={};var _0xa70905={'count':0x0,'rows':[]};return db[_0x48dd('0x21')][_0x48dd('0x75')]({'where':{'id':_0x3046b5[_0x48dd('0x62')]['id']}})[_0x48dd('0x17')](handleEntityNotFound(_0x56b26a,null))[_0x48dd('0x17')](function(_0xbdbd3a){if(_0xbdbd3a){_0x313f0d[_0x48dd('0x76')]=_[_0x48dd('0x24')](db[_0x48dd('0x9e')]['rawAttributes']);_0x313f0d['query']=_[_0x48dd('0x24')](_0x3046b5[_0x48dd('0x1f')]);_0x313f0d['filters']=_[_0x48dd('0x78')](_0x313f0d[_0x48dd('0x76')],_0x313f0d[_0x48dd('0x1f')]);_0x810b16[_0x48dd('0x7a')]=_['intersection'](_0x313f0d['model'],qs[_0x48dd('0x79')](_0x3046b5['query'][_0x48dd('0x79')]));_0x810b16[_0x48dd('0x7a')]=_0x810b16[_0x48dd('0x7a')][_0x48dd('0x25')]?_0x810b16[_0x48dd('0x7a')]:_0x313f0d['model'];if(!_0x3046b5[_0x48dd('0x1f')][_0x48dd('0x30')]('nolimit')){_0x810b16['limit']=qs[_0x48dd('0x13')](_0x3046b5[_0x48dd('0x1f')][_0x48dd('0x13')]);_0x810b16[_0x48dd('0x11')]=qs[_0x48dd('0x11')](_0x3046b5[_0x48dd('0x1f')][_0x48dd('0x11')]);}_0x810b16['order']=qs[_0x48dd('0x7c')](_0x3046b5['query'][_0x48dd('0x7c')]);_0x810b16['where']=qs[_0x48dd('0x77')](_[_0x48dd('0x7d')](_0x3046b5[_0x48dd('0x1f')],_0x313f0d[_0x48dd('0x77')]));_0x810b16[_0x48dd('0x58')][_0x48dd('0x97')]=_0xbdbd3a['id'];if(_0x3046b5[_0x48dd('0x1f')][_0x48dd('0x7e')]){_0x810b16[_0x48dd('0x58')]=_[_0x48dd('0x31')](_0x810b16[_0x48dd('0x58')],{'$or':_[_0x48dd('0x7f')](_0x810b16['attributes'],function(_0x432e92){var _0x94bde2={};_0x94bde2[_0x432e92]={'$like':'%'+_0x3046b5['query']['filter']+'%'};return _0x94bde2;})});}_0x810b16=_[_0x48dd('0x31')]({},_0x810b16,_0x3046b5[_0x48dd('0x98')]);return db[_0x48dd('0x9e')]['count']({'where':_0x810b16[_0x48dd('0x58')]})[_0x48dd('0x17')](function(_0x555050){_0xa70905[_0x48dd('0x14')]=_0x555050;if(_0x3046b5[_0x48dd('0x1f')][_0x48dd('0x99')]){_0x810b16[_0x48dd('0x9a')]=[{'all':!![]}];}return db[_0x48dd('0x9e')][_0x48dd('0x33')](_0x810b16);})['then'](function(_0x1d0b09){_0xa70905[_0x48dd('0x9c')]=_0x1d0b09;return _0xa70905;});}})[_0x48dd('0x17')](respondWithFilteredResult(_0x56b26a,_0x810b16))[_0x48dd('0x20')](handleError(_0x56b26a,null));};exports[_0x48dd('0x9f')]=function(_0x262117,_0x59f830){try{if(!_0x262117[_0x48dd('0x32')][_0x48dd('0x5a')]){throw new Error(_0x48dd('0xa0'));}if(!_0x262117['body']['binding_keys']){throw new Error(_0x48dd('0xa1'));}if(!_0x262117[_0x48dd('0x32')]['binding_values']){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x262117[_0x48dd('0x32')][_0x48dd('0xa2')]){throw new Error(_0x48dd('0xa3'));}var _0x48393f=_0x262117[_0x48dd('0x32')][_0x48dd('0xa4')][_0x48dd('0xa5')](',');var _0x1c582a=_0x262117[_0x48dd('0x32')][_0x48dd('0xa6')][_0x48dd('0xa5')](',');if(!_0x48393f[_0x48dd('0x25')]||!_0x1c582a[_0x48dd('0x25')]||_0x48393f['length']!==_0x1c582a[_0x48dd('0x25')]){throw new Error(_0x48dd('0xa7'));}_0x262117[_0x48dd('0x32')][_0x48dd('0x79')]=_['zipObject'](_0x48393f,_0x1c582a);if(!_0x262117[_0x48dd('0x32')]['fields'][_0x48dd('0x73')]){throw new Error(_0x48dd('0xa8'));}if(!_0x262117['body']['fields'][_0x48dd('0xa9')]){throw new Error(_0x48dd('0xaa'));}var _0x42c924=path[_0x48dd('0x37')](config[_0x48dd('0xab')],'server/files/tmp',_0x262117[_0x48dd('0xac')][_0x48dd('0xad')]);fs['chmodSync'](_0x42c924,parseInt(_0x48dd('0xae'),0x8));var _0x34687d=require(_0x48dd('0xaf'))[_0x48dd('0xb0')](path[_0x48dd('0x37')](__dirname,'../../components/import/cm/csv'),[_0x42c924,_0x262117['body']['binding_keys'],_0x262117[_0x48dd('0x32')][_0x48dd('0xa6')],_0x262117[_0x48dd('0x32')][_0x48dd('0x5a')],_0x262117[_0x48dd('0x32')][_0x48dd('0xb1')],_0x262117[_0x48dd('0x32')][_0x48dd('0x57')],_0x262117[_0x48dd('0x32')][_0x48dd('0xa2')]]);return _0x59f830[_0x48dd('0xf')](0xc8)[_0x48dd('0x10')]({'message':_0x48dd('0xb2'),'pid':_0x34687d[_0x48dd('0xb3')]});}catch(_0x3180e7){return _0x59f830[_0x48dd('0xf')](0x1f4)[_0x48dd('0x1c')](_0x3180e7);}};exports[_0x48dd('0xb4')]=function(_0x354b38,_0x4fea3e){var _0x4cef4b=fs[_0x48dd('0xb5')](_0x354b38[_0x48dd('0xac')]['path']);Papa[_0x48dd('0xb6')](_0x4cef4b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4f1107){return _0x4fea3e[_0x48dd('0xf')](0xc8)[_0x48dd('0x10')]({'file':_0x354b38[_0x48dd('0xac')],'fields':_0x4f1107[_0x48dd('0xb7')][_0x48dd('0x79')]});}});};exports['import']=function(_0x34d462,_0x3aab5e){return db[_0x48dd('0xb8')][_0x48dd('0x33')]({'raw':!![],'attributes':['id'],'where':{'role':_0x48dd('0xb9')}})['then'](function(_0xec6d98){var _0x5060ea=![];if(!_0x34d462[_0x48dd('0x32')][_0x48dd('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x34d462[_0x48dd('0x32')]['binding'][_0x48dd('0x73')]){throw new Error(_0x48dd('0xa8'));}if(!_0x34d462[_0x48dd('0x32')][_0x48dd('0xba')][_0x48dd('0xa9')]){throw new Error(_0x48dd('0xaa'));}if(!_0x34d462['body'][_0x48dd('0xa2')]){throw new Error(_0x48dd('0xa3'));}var _0x27c83=require(_0x48dd('0xaf'))[_0x48dd('0xb0')](path['join'](__dirname,_0x48dd('0xbb')),[_0x34d462[_0x48dd('0x62')]['id'],JSON['stringify'](_0x34d462[_0x48dd('0x32')]),JSON[_0x48dd('0xbc')](_0xec6d98)]);_0x27c83['on']('message',function(){_0x5060ea=!![];return _0x3aab5e[_0x48dd('0xf')](0xc8)[_0x48dd('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x27c83[_0x48dd('0xb3')]});});_0x27c83['on'](_0x48dd('0xbd'),function(_0x1307d6){if(_0x1307d6&&!_0x5060ea){return _0x3aab5e['status'](0x1f4)[_0x48dd('0x10')]({'message':'error\x20child\x20process','pid':_0x27c83['pid']});}});})[_0x48dd('0x20')](handleError(_0x3aab5e,null));};exports['importUpdates']=function(_0x1afe24,_0x5da9f4){return db[_0x48dd('0xb8')][_0x48dd('0x33')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x48dd('0x17')](function(_0x2b7975){var _0x2dfa1a=![];if(!_0x1afe24[_0x48dd('0x32')][_0x48dd('0x5a')]){throw new Error(_0x48dd('0xa0'));}if(!_0x1afe24[_0x48dd('0x32')][_0x48dd('0xba')][_0x48dd('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1afe24[_0x48dd('0x32')]['binding'][_0x48dd('0xa9')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1afe24['body'][_0x48dd('0xa2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x53670a=require('child_process')[_0x48dd('0xb0')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x1afe24[_0x48dd('0x62')]['id'],JSON[_0x48dd('0xbc')](_0x1afe24[_0x48dd('0x32')]),JSON['stringify'](_0x2b7975)]);_0x53670a['on'](_0x48dd('0xbe'),function(){_0x2dfa1a=!![];return _0x5da9f4[_0x48dd('0xf')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x53670a['pid']});});_0x53670a['on'](_0x48dd('0xbd'),function(_0x4bf88e){if(_0x4bf88e&&!_0x2dfa1a){return _0x5da9f4[_0x48dd('0xf')](0x1f4)[_0x48dd('0x10')]({'message':_0x48dd('0xbf'),'pid':_0x53670a[_0x48dd('0xb3')]});}});})[_0x48dd('0x20')](handleError(_0x5da9f4,null));};exports[_0x48dd('0xc0')]=function(_0x59d887,_0x55e3a1){var _0x958f59=[_0x48dd('0xc1'),_0x48dd('0xc2'),_0x48dd('0xc3'),_0x48dd('0xc4'),_0x48dd('0xc5'),'whatsapp','voice'];var _0x11adcf={'offset':0x0,'order':qs['sort'](_0x48dd('0xc6'))},_0x1aacca={'count':0x0,'rows':[]};Promise['resolve']()[_0x48dd('0x17')](function(){if(_0x59d887[_0x48dd('0x1f')][_0x48dd('0xc7')]){if(!_[_0x48dd('0xc8')](_0x958f59,_0x59d887['query'][_0x48dd('0xc7')][_0x48dd('0xc9')]())){throw new Error('Invalid\x20channel');}_0x958f59=[_0x59d887[_0x48dd('0x1f')][_0x48dd('0xc7')][_0x48dd('0xc9')]()];}if(_0x59d887['query']['range']){try{var _0x318328=JSON[_0x48dd('0xb6')](_0x59d887[_0x48dd('0x1f')]['range']);if(!moment(_0x318328['from'])['isValid']()){throw new Error(_0x48dd('0xca'));}if(!moment(_0x318328['to'])['isValid']()){throw new Error(_0x48dd('0xcb'));}}catch(_0x56e8b9){throw new Error(_0x48dd('0xcc'));}}if(!_0x59d887[_0x48dd('0x1f')][_0x48dd('0x30')]('nolimit')){_0x11adcf[_0x48dd('0x13')]=qs[_0x48dd('0x13')](_0x59d887[_0x48dd('0x1f')]['limit']||0xa);_0x11adcf['offset']=qs['offset'](_0x59d887[_0x48dd('0x1f')]['offset']);}var _0x11fbe6=_0x958f59[_0x48dd('0x7f')](function(_0x58b137){if(_0x58b137===_0x48dd('0xcd')){var _0x574dfb={'attributes':['id',_0x48dd('0xce'),'type','source','destination',_0x48dd('0xcf'),'starttime',_0x48dd('0xd0'),_0x48dd('0xd1'),'note',_0x48dd('0xd2'),_0x48dd('0xd3'),_0x48dd('0xd4'),_0x48dd('0xd5'),'UserId'],'where':{'ContactId':_0x59d887[_0x48dd('0x62')]['id']},'include':[{'model':db['User'],'as':_0x48dd('0xb8'),'attributes':['id',_0x48dd('0x1b'),'fullname','alias']}],'order':[[_0x48dd('0xd2'),_0x48dd('0xd6')]]};if(_0x59d887['query'][_0x48dd('0xd7')]){_0x574dfb[_0x48dd('0x58')]['createdAt']={'$gte':_0x318328[_0x48dd('0x34')],'$lte':_0x318328['to']};}return db['VoiceCallReport'][_0x48dd('0xd8')](_0x574dfb)[_0x48dd('0x17')](function(_0x234253){_0x1aacca[_0x48dd('0x14')]+=_0x234253[_0x48dd('0x14')];return _[_0x48dd('0x7f')](_0x234253[_0x48dd('0x9c')],function(_0x32390d){var _0x3d13d2=_0x32390d[_0x48dd('0x35')]({'plain':!![]});_0x3d13d2[_0x48dd('0xc7')]=_0x58b137;if(_0x3d13d2['User']){_0x3d13d2[_0x48dd('0xb8')]={'id':_0x3d13d2['User']['id'],'name':_0x3d13d2['User']['name'],'fullname':_0x3d13d2[_0x48dd('0xb8')]['fullname'],'alias':_0x3d13d2[_0x48dd('0xb8')][_0x48dd('0xd9')]};}return _0x3d13d2;});});}else{var _0x2065b8=_[_0x48dd('0xda')](_0x58b137)+(_0x58b137===_0x48dd('0xc2')?_0x48dd('0xdb'):_0x48dd('0xdc'));var _0x3800bf={'attributes':['id',_0x48dd('0xdd'),_0x48dd('0xde'),_0x48dd('0xd2'),_0x48dd('0xdf'),_0x48dd('0xe0'),_0x48dd('0xe1'),'thirdDisposition',_0x48dd('0xe2'),_0x2065b8+'Id'],'where':{'ContactId':_0x59d887[_0x48dd('0x62')]['id']},'include':[{'model':db[_0x2065b8],'as':_0x48dd('0xdc'),'attributes':['id','name',_0x48dd('0xe3')]},{'model':db[_0x48dd('0xb8')],'as':_0x48dd('0xe4'),'attributes':['id',_0x48dd('0x1b'),_0x48dd('0xe5')]},{'model':db[_0x48dd('0x5f')],'as':_0x48dd('0xe6'),'attributes':['id','name',_0x48dd('0x60')],'through':{'attributes':[]}}],'order':[[_0x48dd('0xd2'),_0x48dd('0xd6')]]};if(_0x59d887[_0x48dd('0x1f')][_0x48dd('0xd7')]){_0x3800bf['where'][_0x48dd('0xd2')]={'$gte':_0x318328['from'],'$lte':_0x318328['to']};}switch(_0x58b137){case _0x48dd('0xc2'):_0x3800bf['attributes'][_0x48dd('0x59')]('browserName',_0x48dd('0xe7'),_0x48dd('0xe8'),_0x48dd('0xe9'),'osName',_0x48dd('0xea'),'ratingType','ratingValue',_0x48dd('0xeb'));break;case _0x48dd('0xc1'):_0x3800bf[_0x48dd('0x7a')][_0x48dd('0x59')]('subject',_0x48dd('0xec'));break;case _0x48dd('0xc4'):_0x3800bf[_0x48dd('0x7a')][_0x48dd('0x59')]('externalUrl',_0x48dd('0xed'));break;}return db[_[_0x48dd('0xda')](_0x58b137)+_0x48dd('0xee')]['findAndCountAll'](_0x3800bf)[_0x48dd('0x17')](function(_0x3fa98f){_0x1aacca[_0x48dd('0x14')]+=_0x3fa98f[_0x48dd('0x14')];return _['map'](_0x3fa98f[_0x48dd('0x9c')],function(_0x4a16f2){var _0x2a9c62=_0x4a16f2[_0x48dd('0x35')]({'plain':!![]});_0x2a9c62[_0x48dd('0xc7')]=_0x58b137;if(_0x2a9c62['Owner']){_0x2a9c62['Owner']={'id':_0x2a9c62[_0x48dd('0xe4')]['id'],'name':_0x2a9c62['Owner']['name'],'fullname':_0x2a9c62['Owner']['fullname']};}return _0x2a9c62;});});}});return Promise[_0x48dd('0x5e')](_0x11fbe6);})[_0x48dd('0x17')](function(_0x5242b3){return _(_0x5242b3)['flatten']()[_0x48dd('0xef')](_0x48dd('0xd2'))[_0x48dd('0xf0')]()[_0x48dd('0xf1')]();})[_0x48dd('0x17')](function(_0xe08462){_0x1aacca[_0x48dd('0x9c')]=_0x11adcf['limit']?_0xe08462['slice'](_0x11adcf[_0x48dd('0x11')],_0x11adcf[_0x48dd('0x11')]+_0x11adcf[_0x48dd('0x13')]):_0xe08462;return _0x1aacca;})[_0x48dd('0x17')](respondWithFilteredResult(_0x55e3a1,_0x11adcf))[_0x48dd('0x20')](handleError(_0x55e3a1,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 68fa5f8..d0e6447 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 _0x0999=['save','update','hasOwnProperty','exports','events','../../mysqldb','CmContact','setMaxListeners'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x0999,0xec));var _0x9099=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0x0999[_0x434783];return _0x13efcf;};'use strict';var EventEmitter=require(_0x9099('0x0'));var CmContact=require(_0x9099('0x1'))['db'][_0x9099('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9099('0x3')](0x0);var events={'afterCreate':_0x9099('0x4'),'afterUpdate':_0x9099('0x5'),'afterDestroy':'remove'};function emitEvent(_0x35b465){return function(_0x5d6d70,_0x4d6e2c,_0x5a44a0){CmContactEvents['emit'](_0x35b465+':'+_0x5d6d70['id'],_0x5d6d70);CmContactEvents['emit'](_0x35b465,_0x5d6d70);_0x5a44a0(null);};}for(var e in events){if(events[_0x9099('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x9099('0x7')]=CmContactEvents; \ No newline at end of file +var _0x22f7=['emit','hook','exports','../../mysqldb','save','update','remove'];(function(_0x56b886,_0x1ff474){var _0x164baf=function(_0x575d09){while(--_0x575d09){_0x56b886['push'](_0x56b886['shift']());}};_0x164baf(++_0x1ff474);}(_0x22f7,0x199));var _0x722f=function(_0x321226,_0x55c833){_0x321226=_0x321226-0x0;var _0x2d8c8d=_0x22f7[_0x321226];return _0x2d8c8d;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x722f('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x722f('0x1'),'afterUpdate':_0x722f('0x2'),'afterDestroy':_0x722f('0x3')};function emitEvent(_0x52571f){return function(_0x26086c,_0x5619f5,_0x262ac4){CmContactEvents[_0x722f('0x4')](_0x52571f+':'+_0x26086c['id'],_0x26086c);CmContactEvents[_0x722f('0x4')](_0x52571f,_0x26086c);_0x262ac4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x722f('0x5')](e,emitEvent(event));}}module[_0x722f('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 5013b02..5388532 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 _0xd8c9=['moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','resolve','findOne','then','timezones','dialTimezone','utcOffset','ListId','priority','callbackUniqueid','phone','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType','always','outbound','CmList','Lists','map','findAll','all','BlackLists','CmHopperBlack','define','CmContact','fti_cm_contacts','firstName','lastName','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api'];(function(_0x5bb0ba,_0x3a1803){var _0x551a4e=function(_0x46de11){while(--_0x46de11){_0x5bb0ba['push'](_0x5bb0ba['shift']());}};_0x551a4e(++_0x3a1803);}(_0xd8c9,0x176));var _0x9d8c=function(_0x1f74f7,_0x45a7c2){_0x1f74f7=_0x1f74f7-0x0;var _0x39e902=_0xd8c9[_0x1f74f7];return _0x39e902;};'use strict';var _=require(_0x9d8c('0x0'));var util=require(_0x9d8c('0x1'));var logger=require(_0x9d8c('0x2'))(_0x9d8c('0x3'));var moment=require(_0x9d8c('0x4'));var shared=require(_0x9d8c('0x5'));var attributes=require(_0x9d8c('0x6'));function getTimezoneCallbackAt(_0xbb4a16,_0x16b53c,_0x598c77,_0x2382a2){var _0x39e5b1=_0x2382a2?_0x9d8c('0x7'):_0x9d8c('0x8');var _0x12879a=_0x598c77[_0x9d8c('0x9')]?_0x598c77[_0x9d8c('0x9')]:moment()[_0x9d8c('0xa')](_0x9d8c('0xb'));if(_[_0x9d8c('0xc')](_0x598c77['dialTimezone'])){return Promise[_0x9d8c('0xd')](_0x12879a);}return _0xbb4a16[_0x39e5b1][_0x9d8c('0xe')]({'where':{'id':_0x16b53c}})[_0x9d8c('0xf')](function(_0x38c7d3){if(_['isNil'](_0x38c7d3)||_[_0x9d8c('0xc')](_0x38c7d3['dialTimezone'])){return Promise[_0x9d8c('0xd')](_0x12879a);}var _0x527240=shared[_0x9d8c('0x10')];var _0x2c61e3=_0x527240[_0x38c7d3[_0x9d8c('0x11')]];var _0x43fe69=_0x527240[_0x598c77['dialTimezone']];if(_[_0x9d8c('0xc')](_0x2c61e3)&&_[_0x9d8c('0xc')](_0x43fe69)){return Promise['resolve'](_0x12879a);}var _0x2c537d=_0x2c61e3[_0x9d8c('0x12')]-_0x43fe69[_0x9d8c('0x12')];var _0x36dcca=_0x598c77[_0x9d8c('0x9')]?_0x598c77['scheduledat']:moment();_0x12879a=moment(_0x36dcca)['add'](_0x2c537d,'minutes')['format'](_0x9d8c('0xb'));return Promise[_0x9d8c('0xd')](_0x12879a);});}function getNewHopperPayload(_0x2034f6){return{'phone':_0x2034f6['phone'],'ContactId':_0x2034f6['id'],'ListId':_0x2034f6[_0x9d8c('0x13')],'scheduledat':_0x2034f6[_0x9d8c('0x9')]?_0x2034f6['scheduledat']:moment()[_0x9d8c('0xa')](_0x9d8c('0xb')),'priority':_0x2034f6[_0x9d8c('0x14')]?_0x2034f6['priority']:0x2,'callback':_0x2034f6['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2034f6[_0x9d8c('0x15')]?_0x2034f6[_0x9d8c('0x15')]:undefined,'callbackat':_0x2034f6[_0x9d8c('0x15')]?moment()[_0x9d8c('0xa')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x45e46d,_0x543ccb,_0x285f79,_0x504345){var _0x4676fb={'phone':_0x285f79[_0x9d8c('0x16')]};var _0x4359fc={'calleridnum':_0x285f79[_0x9d8c('0x16')]};if(_0x504345){Object[_0x9d8c('0x17')](_0x4676fb,{'CampaignId':_0x543ccb['id']});Object[_0x9d8c('0x17')](_0x4359fc,{'CampaignId':_0x543ccb['id']});}else{Object['assign'](_0x4676fb,{'VoiceQueueId':_0x543ccb['id']});Object[_0x9d8c('0x17')](_0x4359fc,{'VoiceQueueId':_0x543ccb['id']});}return _0x45e46d[_0x9d8c('0x18')][_0x9d8c('0xe')]({'where':_0x4676fb})[_0x9d8c('0xf')](function(_0x56d856){if(_0x56d856){throw new Error(_0x9d8c('0x19')+_0x285f79[_0x9d8c('0x16')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x543ccb['id']);}return _0x45e46d['CmHopperFinal'][_0x9d8c('0xe')]({'where':_0x4359fc});})[_0x9d8c('0xf')](function(_0x47aecf){if(_0x47aecf){throw new Error('[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x285f79[_0x9d8c('0x16')]+_0x9d8c('0x1a')+_0x543ccb['id']);}var _0x5286e9=getNewHopperPayload(_0x285f79);if(_0x504345){_0x5286e9[_0x9d8c('0x1b')]=_0x543ccb['id'];}else{_0x5286e9[_0x9d8c('0x1c')]=_0x543ccb['id'];}return _0x45e46d['CmHopper']['create'](_0x5286e9);});}function handleOnlyIfOpenCheckDuplicate(_0x5ca903,_0x5d79a5,_0x240bb2,_0x15712b){var _0x2baf91={'phone':_0x240bb2[_0x9d8c('0x16')]};if(_0x15712b){Object[_0x9d8c('0x17')](_0x2baf91,{'CampaignId':_0x5d79a5['id']});}else{Object[_0x9d8c('0x17')](_0x2baf91,{'VoiceQueueId':_0x5d79a5['id']});}return _0x5ca903['CmHopper']['findOne']({'where':_0x2baf91})['then'](function(_0x41eaf5){if(_0x41eaf5){throw new Error(_0x9d8c('0x1d')+_0x240bb2[_0x9d8c('0x16')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5d79a5['id']);}var _0x516666=getNewHopperPayload(_0x240bb2);if(_0x15712b){_0x516666[_0x9d8c('0x1b')]=_0x5d79a5['id'];}else{_0x516666[_0x9d8c('0x1c')]=_0x5d79a5['id'];}return _0x5ca903['CmHopper'][_0x9d8c('0x1e')](_0x516666);});}function handleNeverCheckDuplicate(_0x51d979,_0xf130b7,_0x1acbf9){var _0x31df5b=getNewHopperPayload(_0x1acbf9);_0x31df5b['VoiceQueueId']=_0xf130b7['id'];return _0x51d979[_0x9d8c('0x18')][_0x9d8c('0x1e')](_0x31df5b);}function handleCheckDuplicate(_0x3c04b8,_0x67746,_0x15a75f,_0x13e6e3){return getTimezoneCallbackAt(_0x3c04b8,_0x67746,_0x15a75f,_0x13e6e3)[_0x9d8c('0xf')](function(_0x302f5f){_0x15a75f['scheduledat']=_0x302f5f;switch(_0x67746[_0x9d8c('0x1f')]){case _0x9d8c('0x20'):return handleAlwaysCheckDuplicate(_0x3c04b8,_0x67746,_0x15a75f,_0x13e6e3);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x3c04b8,_0x67746,_0x15a75f,_0x13e6e3);default:return handleNeverCheckDuplicate(_0x3c04b8,_0x67746,_0x15a75f);}});}function createHopperForVoiceQueues(_0xab8ab1,_0x5f493f){return _0xab8ab1[_0x9d8c('0x8')]['findAll']({'where':{'type':_0x9d8c('0x21')},'attributes':['id',_0x9d8c('0x1f'),_0x9d8c('0x11')],'include':[{'model':_0xab8ab1[_0x9d8c('0x22')],'as':_0x9d8c('0x23'),'where':{'id':_0x5f493f[_0x9d8c('0x13')]}}],'raw':!![]})[_0x9d8c('0xf')](function(_0x112874){var _0x5ae770=_0x112874[_0x9d8c('0x24')](function(_0x17da46){return handleCheckDuplicate(_0xab8ab1,_0x17da46,_0x5f493f,![]);});return Promise['all'](_0x5ae770);});}function createHopperForCampaigns(_0x504453,_0x118229){return _0x504453['Campaign'][_0x9d8c('0x25')]({'attributes':['id',_0x9d8c('0x1f'),_0x9d8c('0x11')],'include':[{'model':_0x504453[_0x9d8c('0x22')],'as':_0x9d8c('0x23'),'where':{'id':_0x118229[_0x9d8c('0x13')]}}],'raw':!![]})[_0x9d8c('0xf')](function(_0x102c74){var _0x59ef33=_0x102c74['map'](function(_0x4cd514){return handleCheckDuplicate(_0x504453,_0x4cd514,_0x118229,!![]);});return Promise[_0x9d8c('0x26')](_0x59ef33);});}function createHopperBlackForVoiceQueues(_0x44e369,_0x1e3434){return _0x44e369[_0x9d8c('0x8')][_0x9d8c('0x25')]({'where':{'type':_0x9d8c('0x21')},'attributes':['id'],'include':[{'model':_0x44e369[_0x9d8c('0x22')],'as':_0x9d8c('0x27'),'where':{'id':_0x1e3434[_0x9d8c('0x13')]}}],'raw':!![]})[_0x9d8c('0xf')](function(_0x21b71c){var _0x3a5d54=_0x21b71c[_0x9d8c('0x24')](function(_0x3d4ea9){return _0x44e369[_0x9d8c('0x28')][_0x9d8c('0x1e')]({'phone':_0x1e3434[_0x9d8c('0x16')],'ContactId':_0x1e3434['id'],'ListId':_0x1e3434[_0x9d8c('0x13')],'VoiceQueueId':_0x3d4ea9['id']});});return Promise[_0x9d8c('0x26')](_0x3a5d54);});}function createHopperBlackForCampaigns(_0x336bd0,_0x3657f7){return _0x336bd0[_0x9d8c('0x7')][_0x9d8c('0x25')]({'attributes':['id'],'include':[{'model':_0x336bd0[_0x9d8c('0x22')],'as':'BlackLists','where':{'id':_0x3657f7[_0x9d8c('0x13')]}}],'raw':!![]})[_0x9d8c('0xf')](function(_0xd1cc01){var _0x221b6b=_0xd1cc01['map'](function(_0x1ffd38){return _0x336bd0[_0x9d8c('0x28')]['create']({'phone':_0x3657f7['phone'],'ContactId':_0x3657f7['id'],'ListId':_0x3657f7[_0x9d8c('0x13')],'CampaignId':_0x1ffd38['id']});});return Promise[_0x9d8c('0x26')](_0x221b6b);});}module['exports']=function(_0x37e6c4){return _0x37e6c4[_0x9d8c('0x29')](_0x9d8c('0x2a'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x9d8c('0x2b'),'fields':[_0x9d8c('0x2c'),_0x9d8c('0x2d'),_0x9d8c('0x16'),'mobile','fax','email'],'type':_0x9d8c('0x2e')}],'timestamps':!![],'charset':_0x9d8c('0x2f'),'collate':_0x9d8c('0x30'),'hooks':{'afterCreate':function(_0x24c22e,_0x3dd3cd,_0x12ecbc){var _0x21efee=_0x37e6c4[_0x9d8c('0x31')];var _0x45ba4a=_0x24c22e[_0x9d8c('0x32')]({'plain':!![]});if(!_0x45ba4a[_0x9d8c('0x13')]){logger[_0x9d8c('0x33')](_0x9d8c('0x34')+_0x45ba4a['id']);return _0x12ecbc();}if(!_0x45ba4a['phone']){return _0x12ecbc();}return createHopperForVoiceQueues(_0x21efee,_0x45ba4a)[_0x9d8c('0xf')](function(){return createHopperBlackForVoiceQueues(_0x21efee,_0x45ba4a);})[_0x9d8c('0xf')](function(){return createHopperForCampaigns(_0x21efee,_0x45ba4a);})[_0x9d8c('0xf')](function(){return createHopperBlackForCampaigns(_0x21efee,_0x45ba4a);})[_0x9d8c('0xf')](function(){return _0x12ecbc();})[_0x9d8c('0x35')](function(_0xdf948c){logger['error'](_0x9d8c('0x36'),_0xdf948c[_0x9d8c('0x37')]);_0x12ecbc();});},'afterDestroy':function(_0x4306ae,_0x5736f1,_0x39a659){var _0x3fc045=_0x37e6c4['models'];var _0x4d5960=_0x4306ae['get']({'plain':!![]});return _0x3fc045[_0x9d8c('0x18')][_0x9d8c('0x25')]({'raw':!![],'where':{'ListId':_0x4d5960[_0x9d8c('0x13')],'ContactId':_0x4d5960['id']}})[_0x9d8c('0xf')](function(_0x526ec7){if(!_['isEmpty'](_0x526ec7)){var _0x181f96=[];for(var _0x157622=0x0;_0x157622<_0x526ec7[_0x9d8c('0x38')];_0x157622+=0x1){var _0x1ca3ee=_0x3fc045[_0x9d8c('0x18')][_0x9d8c('0x39')]({'where':{'ListId':_0x526ec7[_0x157622]['ListId'],'ContactId':_0x526ec7[_0x157622][_0x9d8c('0x3a')],'VoiceQueueId':_0x526ec7[_0x157622]['VoiceQueueId'],'CampaignId':_0x526ec7[_0x157622][_0x9d8c('0x1b')]}});_0x181f96[_0x9d8c('0x3b')](_0x1ca3ee);}return Promise[_0x9d8c('0x26')](_0x181f96);}})['then'](function(_0x6cab04){logger['info'](_0x9d8c('0x3c'),util[_0x9d8c('0x3d')](_0x6cab04,{'showHidden':![],'depth':null}));_0x39a659();})['catch'](function(_0x17ac54){logger[_0x9d8c('0x33')](_0x9d8c('0x3e'),util[_0x9d8c('0x3d')](_0x17ac54,{'showHidden':![],'depth':null}));_0x39a659(_0x17ac54);});}}});}; \ No newline at end of file +var _0x42b3=['email','utf8mb4','utf8mb4_unicode_ci','models','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','get','isEmpty','length','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','resolve','findOne','then','isNil','timezones','dialTimezone','utcOffset','add','minutes','phone','format','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','ListId','map','all','BlackLists','CmHopperBlack','CmContact','cm_contacts','fti_cm_contacts','firstName','lastName'];(function(_0x5e6e7,_0x592fa6){var _0xfb9ec9=function(_0x66e3f6){while(--_0x66e3f6){_0x5e6e7['push'](_0x5e6e7['shift']());}};_0xfb9ec9(++_0x592fa6);}(_0x42b3,0x14a));var _0x342b=function(_0x2efb96,_0x40a4ce){_0x2efb96=_0x2efb96-0x0;var _0x50d38d=_0x42b3[_0x2efb96];return _0x50d38d;};'use strict';var _=require(_0x342b('0x0'));var util=require(_0x342b('0x1'));var logger=require(_0x342b('0x2'))(_0x342b('0x3'));var moment=require(_0x342b('0x4'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');function getTimezoneCallbackAt(_0x3b4545,_0x382f16,_0x3b4132,_0x3afe1d){var _0x172758=_0x3afe1d?_0x342b('0x5'):_0x342b('0x6');var _0x18366d=_0x3b4132[_0x342b('0x7')]?_0x3b4132[_0x342b('0x7')]:moment()['format'](_0x342b('0x8'));if(_['isNil'](_0x3b4132['dialTimezone'])){return Promise[_0x342b('0x9')](_0x18366d);}return _0x3b4545[_0x172758][_0x342b('0xa')]({'where':{'id':_0x382f16}})[_0x342b('0xb')](function(_0x2bfa47){if(_['isNil'](_0x2bfa47)||_[_0x342b('0xc')](_0x2bfa47['dialTimezone'])){return Promise[_0x342b('0x9')](_0x18366d);}var _0x13c1f4=shared[_0x342b('0xd')];var _0x508786=_0x13c1f4[_0x2bfa47[_0x342b('0xe')]];var _0x385ad6=_0x13c1f4[_0x3b4132['dialTimezone']];if(_[_0x342b('0xc')](_0x508786)&&_[_0x342b('0xc')](_0x385ad6)){return Promise[_0x342b('0x9')](_0x18366d);}var _0x149c8e=_0x508786[_0x342b('0xf')]-_0x385ad6['utcOffset'];var _0xf0ae0f=_0x3b4132[_0x342b('0x7')]?_0x3b4132[_0x342b('0x7')]:moment();_0x18366d=moment(_0xf0ae0f)[_0x342b('0x10')](_0x149c8e,_0x342b('0x11'))['format'](_0x342b('0x8'));return Promise['resolve'](_0x18366d);});}function getNewHopperPayload(_0x4773c7){return{'phone':_0x4773c7[_0x342b('0x12')],'ContactId':_0x4773c7['id'],'ListId':_0x4773c7['ListId'],'scheduledat':_0x4773c7[_0x342b('0x7')]?_0x4773c7[_0x342b('0x7')]:moment()[_0x342b('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x4773c7[_0x342b('0x14')]?_0x4773c7[_0x342b('0x14')]:0x2,'callback':_0x4773c7[_0x342b('0x15')]?!![]:![],'callbackuniqueid':_0x4773c7['callbackUniqueid']?_0x4773c7[_0x342b('0x15')]:undefined,'callbackat':_0x4773c7[_0x342b('0x15')]?moment()[_0x342b('0x13')](_0x342b('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0x14d795,_0x10c2a2,_0x23065a,_0x34a039){var _0x10b145={'phone':_0x23065a[_0x342b('0x12')]};var _0x29d35b={'calleridnum':_0x23065a['phone']};if(_0x34a039){Object['assign'](_0x10b145,{'CampaignId':_0x10c2a2['id']});Object[_0x342b('0x16')](_0x29d35b,{'CampaignId':_0x10c2a2['id']});}else{Object[_0x342b('0x16')](_0x10b145,{'VoiceQueueId':_0x10c2a2['id']});Object[_0x342b('0x16')](_0x29d35b,{'VoiceQueueId':_0x10c2a2['id']});}return _0x14d795[_0x342b('0x17')][_0x342b('0xa')]({'where':_0x10b145})[_0x342b('0xb')](function(_0x2b3282){if(_0x2b3282){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x23065a[_0x342b('0x12')]+_0x342b('0x18')+_0x10c2a2['id']);}return _0x14d795[_0x342b('0x19')][_0x342b('0xa')]({'where':_0x29d35b});})[_0x342b('0xb')](function(_0x714388){if(_0x714388){throw new Error(_0x342b('0x1a')+_0x23065a[_0x342b('0x12')]+_0x342b('0x18')+_0x10c2a2['id']);}var _0x40a96b=getNewHopperPayload(_0x23065a);if(_0x34a039){_0x40a96b[_0x342b('0x1b')]=_0x10c2a2['id'];}else{_0x40a96b[_0x342b('0x1c')]=_0x10c2a2['id'];}return _0x14d795[_0x342b('0x17')]['create'](_0x40a96b);});}function handleOnlyIfOpenCheckDuplicate(_0x3a6d4f,_0x1d2f84,_0x604209,_0x498308){var _0x188622={'phone':_0x604209[_0x342b('0x12')]};if(_0x498308){Object[_0x342b('0x16')](_0x188622,{'CampaignId':_0x1d2f84['id']});}else{Object[_0x342b('0x16')](_0x188622,{'VoiceQueueId':_0x1d2f84['id']});}return _0x3a6d4f[_0x342b('0x17')][_0x342b('0xa')]({'where':_0x188622})[_0x342b('0xb')](function(_0x3ad89c){if(_0x3ad89c){throw new Error(_0x342b('0x1d')+_0x604209[_0x342b('0x12')]+_0x342b('0x18')+_0x1d2f84['id']);}var _0x55eafb=getNewHopperPayload(_0x604209);if(_0x498308){_0x55eafb['CampaignId']=_0x1d2f84['id'];}else{_0x55eafb[_0x342b('0x1c')]=_0x1d2f84['id'];}return _0x3a6d4f['CmHopper'][_0x342b('0x1e')](_0x55eafb);});}function handleNeverCheckDuplicate(_0x411b8e,_0x5c8847,_0x35067e){var _0x4749ef=getNewHopperPayload(_0x35067e);_0x4749ef[_0x342b('0x1c')]=_0x5c8847['id'];return _0x411b8e[_0x342b('0x17')]['create'](_0x4749ef);}function handleCheckDuplicate(_0x473b38,_0x5f1d40,_0x16700b,_0x4dddc5){return getTimezoneCallbackAt(_0x473b38,_0x5f1d40,_0x16700b,_0x4dddc5)[_0x342b('0xb')](function(_0x4d4160){_0x16700b[_0x342b('0x7')]=_0x4d4160;switch(_0x5f1d40[_0x342b('0x1f')]){case _0x342b('0x20'):return handleAlwaysCheckDuplicate(_0x473b38,_0x5f1d40,_0x16700b,_0x4dddc5);case _0x342b('0x21'):return handleOnlyIfOpenCheckDuplicate(_0x473b38,_0x5f1d40,_0x16700b,_0x4dddc5);default:return handleNeverCheckDuplicate(_0x473b38,_0x5f1d40,_0x16700b);}});}function createHopperForVoiceQueues(_0x45ff3d,_0x346323){return _0x45ff3d[_0x342b('0x6')][_0x342b('0x22')]({'where':{'type':_0x342b('0x23')},'attributes':['id',_0x342b('0x1f'),_0x342b('0xe')],'include':[{'model':_0x45ff3d[_0x342b('0x24')],'as':_0x342b('0x25'),'where':{'id':_0x346323[_0x342b('0x26')]}}],'raw':!![]})[_0x342b('0xb')](function(_0xfb606d){var _0x5946e7=_0xfb606d[_0x342b('0x27')](function(_0x3c3fc8){return handleCheckDuplicate(_0x45ff3d,_0x3c3fc8,_0x346323,![]);});return Promise[_0x342b('0x28')](_0x5946e7);});}function createHopperForCampaigns(_0x1aea18,_0x6448c3){return _0x1aea18[_0x342b('0x5')]['findAll']({'attributes':['id',_0x342b('0x1f'),_0x342b('0xe')],'include':[{'model':_0x1aea18[_0x342b('0x24')],'as':_0x342b('0x25'),'where':{'id':_0x6448c3[_0x342b('0x26')]}}],'raw':!![]})[_0x342b('0xb')](function(_0xd1e4c7){var _0x35e5ac=_0xd1e4c7['map'](function(_0x44f980){return handleCheckDuplicate(_0x1aea18,_0x44f980,_0x6448c3,!![]);});return Promise[_0x342b('0x28')](_0x35e5ac);});}function createHopperBlackForVoiceQueues(_0x3c047f,_0x2128e5){return _0x3c047f[_0x342b('0x6')][_0x342b('0x22')]({'where':{'type':_0x342b('0x23')},'attributes':['id'],'include':[{'model':_0x3c047f['CmList'],'as':_0x342b('0x29'),'where':{'id':_0x2128e5['ListId']}}],'raw':!![]})[_0x342b('0xb')](function(_0x4d991d){var _0x53715e=_0x4d991d[_0x342b('0x27')](function(_0x4489d3){return _0x3c047f[_0x342b('0x2a')]['create']({'phone':_0x2128e5['phone'],'ContactId':_0x2128e5['id'],'ListId':_0x2128e5['ListId'],'VoiceQueueId':_0x4489d3['id']});});return Promise[_0x342b('0x28')](_0x53715e);});}function createHopperBlackForCampaigns(_0x4ebbb0,_0x4a5af9){return _0x4ebbb0[_0x342b('0x5')]['findAll']({'attributes':['id'],'include':[{'model':_0x4ebbb0[_0x342b('0x24')],'as':_0x342b('0x29'),'where':{'id':_0x4a5af9[_0x342b('0x26')]}}],'raw':!![]})[_0x342b('0xb')](function(_0x1060af){var _0x26fd71=_0x1060af[_0x342b('0x27')](function(_0x54adfe){return _0x4ebbb0[_0x342b('0x2a')]['create']({'phone':_0x4a5af9['phone'],'ContactId':_0x4a5af9['id'],'ListId':_0x4a5af9[_0x342b('0x26')],'CampaignId':_0x54adfe['id']});});return Promise[_0x342b('0x28')](_0x26fd71);});}module['exports']=function(_0x492844){return _0x492844['define'](_0x342b('0x2b'),attributes,{'tableName':_0x342b('0x2c'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x342b('0x12')]},{'name':_0x342b('0x2d'),'fields':[_0x342b('0x2e'),_0x342b('0x2f'),_0x342b('0x12'),'mobile','fax',_0x342b('0x30')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0x342b('0x31'),'collate':_0x342b('0x32'),'hooks':{'afterCreate':function(_0x33e79e,_0x5b7ba2,_0x181cb5){var _0x40da2f=_0x492844[_0x342b('0x33')];var _0x16ae26=_0x33e79e['get']({'plain':!![]});if(!_0x16ae26[_0x342b('0x26')]){logger[_0x342b('0x34')](_0x342b('0x35')+_0x16ae26['id']);return _0x181cb5();}if(!_0x16ae26[_0x342b('0x12')]){return _0x181cb5();}return createHopperForVoiceQueues(_0x40da2f,_0x16ae26)[_0x342b('0xb')](function(){return createHopperBlackForVoiceQueues(_0x40da2f,_0x16ae26);})[_0x342b('0xb')](function(){return createHopperForCampaigns(_0x40da2f,_0x16ae26);})[_0x342b('0xb')](function(){return createHopperBlackForCampaigns(_0x40da2f,_0x16ae26);})[_0x342b('0xb')](function(){return _0x181cb5();})[_0x342b('0x36')](function(_0x28c420){logger['error']('[cmContact][afterCreate]',_0x28c420['message']);_0x181cb5();});},'afterDestroy':function(_0x29f6ad,_0x69a7cf,_0x38c8f1){var _0x3fb39b=_0x492844[_0x342b('0x33')];var _0x138999=_0x29f6ad[_0x342b('0x37')]({'plain':!![]});return _0x3fb39b[_0x342b('0x17')][_0x342b('0x22')]({'raw':!![],'where':{'ListId':_0x138999[_0x342b('0x26')],'ContactId':_0x138999['id']}})[_0x342b('0xb')](function(_0x31c02b){if(!_[_0x342b('0x38')](_0x31c02b)){var _0x426166=[];for(var _0x28f23d=0x0;_0x28f23d<_0x31c02b[_0x342b('0x39')];_0x28f23d+=0x1){var _0x472fba=_0x3fb39b[_0x342b('0x17')]['destroy']({'where':{'ListId':_0x31c02b[_0x28f23d][_0x342b('0x26')],'ContactId':_0x31c02b[_0x28f23d][_0x342b('0x3a')],'VoiceQueueId':_0x31c02b[_0x28f23d][_0x342b('0x1c')],'CampaignId':_0x31c02b[_0x28f23d]['CampaignId']}});_0x426166['push'](_0x472fba);}return Promise['all'](_0x426166);}})[_0x342b('0xb')](function(_0x326a23){logger[_0x342b('0x3b')](_0x342b('0x3c'),util[_0x342b('0x3d')](_0x326a23,{'showHidden':![],'depth':null}));_0x38c8f1();})[_0x342b('0x36')](function(_0x313283){logger[_0x342b('0x34')](_0x342b('0x3e'),util['inspect'](_0x313283,{'showHidden':![],'depth':null}));_0x38c8f1(_0x313283);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 653c9d8..815e04b 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x1ba91e,_0x5f0e21){var _0x22a3a9=function(_0x1f62bd){while(--_0x1f62bd){_0x1ba91e['push'](_0x1ba91e['shift']());}};_0x22a3a9(++_0x5f0e21);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 8e73b18..31d5433 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 _0xbdeb=['STRING','PHONE','INTEGER','exports'];(function(_0x13d878,_0x3ac33){var _0x4f9280=function(_0x3e59e4){while(--_0x3e59e4){_0x13d878['push'](_0x13d878['shift']());}};_0x4f9280(++_0x3ac33);}(_0xbdeb,0x6f));var _0xbbde=function(_0x5597a0,_0x35c11e){_0x5597a0=_0x5597a0-0x0;var _0x2fc8d6=_0xbdeb[_0x5597a0];return _0x2fc8d6;};'use strict';var Sequelize=require('sequelize');module[_0xbbde('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xbbde('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbbde('0x1')],'defaultValue':_0xbbde('0x2')},'OrderBy':{'type':Sequelize[_0xbbde('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xbbde('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x544a=['STRING','sequelize','exports','INTEGER'];(function(_0x5acd5d,_0x1d3cf3){var _0x359411=function(_0x281312){while(--_0x281312){_0x5acd5d['push'](_0x5acd5d['shift']());}};_0x359411(++_0x1d3cf3);}(_0x544a,0xbd));var _0xa544=function(_0x58d127,_0x41d972){_0x58d127=_0x58d127-0x0;var _0x4a594d=_0x544a[_0x58d127];return _0x4a594d;};'use strict';var Sequelize=require(_0xa544('0x0'));module[_0xa544('0x1')]={'CmContactId':{'type':Sequelize[_0xa544('0x2')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa544('0x3')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xa544('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xa544('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index dbcadf0..0a3b3d1 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 _0x3c6e=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','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','sendStatus','status','json','undefined','count','offset','limit','set','reject','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','index','map','CmContactHasItem','fieldName','key','model','query','keys','filters','intersection','fields','attributes','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x183c5e,_0x493c6a){var _0x4f9c94=function(_0x1c910c){while(--_0x1c910c){_0x183c5e['push'](_0x183c5e['shift']());}};_0x4f9c94(++_0x493c6a);}(_0x3c6e,0xa3));var _0xe3c6=function(_0x35e3fd,_0x1af961){_0x35e3fd=_0x35e3fd-0x0;var _0x2b8ace=_0x3c6e[_0x35e3fd];return _0x2b8ace;};'use strict';var emlformat=require(_0xe3c6('0x0'));var rimraf=require(_0xe3c6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe3c6('0x2'));var moment=require(_0xe3c6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe3c6('0x4'));var util=require(_0xe3c6('0x5'));var path=require('path');var sox=require(_0xe3c6('0x6'));var csv=require(_0xe3c6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3c6('0x8'));var squel=require(_0xe3c6('0x9'));var crypto=require(_0xe3c6('0xa'));var jsforce=require(_0xe3c6('0xb'));var deskjs=require(_0xe3c6('0xc'));var toCsv=require(_0xe3c6('0x7'));var querystring=require(_0xe3c6('0xd'));var Papa=require(_0xe3c6('0xe'));var Redis=require('ioredis');var authService=require(_0xe3c6('0xf'));var qs=require(_0xe3c6('0x10'));var as=require(_0xe3c6('0x11'));var hardwareService=require(_0xe3c6('0x12'));var logger=require(_0xe3c6('0x13'))(_0xe3c6('0x14'));var utils=require(_0xe3c6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe3c6('0x16'));var db=require(_0xe3c6('0x17'))['db'];function respondWithStatusCode(_0x3f7a71,_0x181a1e){_0x181a1e=_0x181a1e||0xcc;return function(_0x3f1986){if(_0x3f1986){return _0x3f7a71[_0xe3c6('0x18')](_0x181a1e);}return _0x3f7a71[_0xe3c6('0x19')](_0x181a1e)['end']();};}function respondWithResult(_0xb967a6,_0x2c3adf){_0x2c3adf=_0x2c3adf||0xc8;return function(_0xd7767e){if(_0xd7767e){return _0xb967a6[_0xe3c6('0x19')](_0x2c3adf)[_0xe3c6('0x1a')](_0xd7767e);}};}function respondWithFilteredResult(_0x21a45d,_0x311b97){return function(_0x328217){if(_0x328217){var _0x521759=typeof _0x311b97['offset']===_0xe3c6('0x1b')&&typeof _0x311b97['limit']==='undefined';var _0x5c91a5=_0x328217[_0xe3c6('0x1c')];var _0x1f187a=_0x521759?0x0:_0x311b97[_0xe3c6('0x1d')];var _0x2de257=_0x521759?_0x328217['count']:_0x311b97[_0xe3c6('0x1d')]+_0x311b97[_0xe3c6('0x1e')];var _0x4c9682;if(_0x2de257>=_0x5c91a5){_0x2de257=_0x5c91a5;_0x4c9682=0xc8;}else{_0x4c9682=0xce;}_0x21a45d['status'](_0x4c9682);return _0x21a45d[_0xe3c6('0x1f')]('Content-Range',_0x1f187a+'-'+_0x2de257+'/'+_0x5c91a5)[_0xe3c6('0x1a')](_0x328217);}return null;};}function patchUpdates(_0x56a92e){return function(_0x291daf){try{jsonpatch['apply'](_0x291daf,_0x56a92e,!![]);}catch(_0x3a3377){return BPromise[_0xe3c6('0x20')](_0x3a3377);}return _0x291daf['save']();};}function saveUpdates(_0x5ad5df,_0x2213f1){return function(_0x549764){if(_0x549764){return _0x549764[_0xe3c6('0x21')](_0x5ad5df)[_0xe3c6('0x22')](function(_0x48eaa2){return _0x48eaa2;});}return null;};}function removeEntity(_0x5db48c,_0x1c372a){return function(_0x1f794f){if(_0x1f794f){return _0x1f794f['destroy']()['then'](function(){var _0x5ec742=_0x1f794f[_0xe3c6('0x23')]({'plain':!![]});var _0x32b979=_0xe3c6('0x24');return db[_0xe3c6('0x25')][_0xe3c6('0x26')]({'where':{'type':_0x32b979,'resourceId':_0x5ec742['id']}})['then'](function(){return _0x1f794f;});})[_0xe3c6('0x22')](function(){_0x5db48c[_0xe3c6('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29351c,_0x1adedd){return function(_0x30b66e){if(!_0x30b66e){_0x29351c[_0xe3c6('0x18')](0x194);}return _0x30b66e;};}function handleError(_0xe455f6,_0xce576){_0xce576=_0xce576||0x1f4;return function(_0x5ed316){logger[_0xe3c6('0x27')](_0x5ed316[_0xe3c6('0x28')]);if(_0x5ed316[_0xe3c6('0x29')]){delete _0x5ed316[_0xe3c6('0x29')];}_0xe455f6[_0xe3c6('0x19')](_0xce576)['send'](_0x5ed316);};}exports[_0xe3c6('0x2a')]=function(_0x247f24,_0x220763){var _0x21a7d8={},_0x92be0e={},_0x2a5694={'count':0x0,'rows':[]};var _0x31aeef=_[_0xe3c6('0x2b')](db[_0xe3c6('0x2c')]['rawAttributes'],function(_0x1ba5af){return{'name':_0x1ba5af[_0xe3c6('0x2d')],'type':_0x1ba5af['type'][_0xe3c6('0x2e')]};});_0x92be0e[_0xe3c6('0x2f')]=_['map'](_0x31aeef,_0xe3c6('0x29'));_0x92be0e[_0xe3c6('0x30')]=_[_0xe3c6('0x31')](_0x247f24[_0xe3c6('0x30')]);_0x92be0e[_0xe3c6('0x32')]=_[_0xe3c6('0x33')](_0x92be0e['model'],_0x92be0e['query']);_0x21a7d8['attributes']=_[_0xe3c6('0x33')](_0x92be0e[_0xe3c6('0x2f')],qs[_0xe3c6('0x34')](_0x247f24[_0xe3c6('0x30')][_0xe3c6('0x34')]));_0x21a7d8[_0xe3c6('0x35')]=_0x21a7d8[_0xe3c6('0x35')]['length']?_0x21a7d8[_0xe3c6('0x35')]:_0x92be0e[_0xe3c6('0x2f')];if(!_0x247f24[_0xe3c6('0x30')]['hasOwnProperty']('nolimit')){_0x21a7d8[_0xe3c6('0x1e')]=qs['limit'](_0x247f24['query'][_0xe3c6('0x1e')]);_0x21a7d8['offset']=qs[_0xe3c6('0x1d')](_0x247f24['query'][_0xe3c6('0x1d')]);}_0x21a7d8['order']=qs['sort'](_0x247f24[_0xe3c6('0x30')][_0xe3c6('0x36')]);_0x21a7d8['where']=qs[_0xe3c6('0x32')](_[_0xe3c6('0x37')](_0x247f24[_0xe3c6('0x30')],_0x92be0e['filters']),_0x31aeef);if(_0x247f24['query'][_0xe3c6('0x38')]){_0x21a7d8['where']=_[_0xe3c6('0x39')](_0x21a7d8[_0xe3c6('0x3a')],{'$or':_[_0xe3c6('0x2b')](_0x31aeef,function(_0x3ace73){if(_0x3ace73[_0xe3c6('0x3b')]!==_0xe3c6('0x3c')){var _0x2e84f1={};_0x2e84f1[_0x3ace73[_0xe3c6('0x29')]]={'$like':'%'+_0x247f24[_0xe3c6('0x30')][_0xe3c6('0x38')]+'%'};return _0x2e84f1;}})});}_0x21a7d8=_[_0xe3c6('0x39')]({},_0x21a7d8,_0x247f24[_0xe3c6('0x3d')]);var _0x4518f1={'where':_0x21a7d8[_0xe3c6('0x3a')]};return db['CmContactHasItem'][_0xe3c6('0x1c')](_0x4518f1)['then'](function(_0x1efa61){_0x2a5694[_0xe3c6('0x1c')]=_0x1efa61;if(_0x247f24[_0xe3c6('0x30')][_0xe3c6('0x3e')]){_0x21a7d8[_0xe3c6('0x3f')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xe3c6('0x40')](_0x21a7d8);})[_0xe3c6('0x22')](function(_0x51d232){_0x2a5694[_0xe3c6('0x41')]=_0x51d232;return _0x2a5694;})[_0xe3c6('0x22')](respondWithFilteredResult(_0x220763,_0x21a7d8))[_0xe3c6('0x42')](handleError(_0x220763,null));};exports[_0xe3c6('0x43')]=function(_0x28e4a8,_0x1db706){var _0x502eb3={'raw':!![],'where':{'id':_0x28e4a8[_0xe3c6('0x44')]['id']}},_0x1bd4af={};_0x1bd4af['model']=_[_0xe3c6('0x31')](db[_0xe3c6('0x2c')][_0xe3c6('0x45')]);_0x1bd4af['query']=_[_0xe3c6('0x31')](_0x28e4a8[_0xe3c6('0x30')]);_0x1bd4af[_0xe3c6('0x32')]=_[_0xe3c6('0x33')](_0x1bd4af['model'],_0x1bd4af[_0xe3c6('0x30')]);_0x502eb3['attributes']=_[_0xe3c6('0x33')](_0x1bd4af[_0xe3c6('0x2f')],qs[_0xe3c6('0x34')](_0x28e4a8['query'][_0xe3c6('0x34')]));_0x502eb3[_0xe3c6('0x35')]=_0x502eb3[_0xe3c6('0x35')][_0xe3c6('0x46')]?_0x502eb3[_0xe3c6('0x35')]:_0x1bd4af[_0xe3c6('0x2f')];if(_0x28e4a8[_0xe3c6('0x30')][_0xe3c6('0x3e')]){_0x502eb3[_0xe3c6('0x3f')]=[{'all':!![]}];}_0x502eb3=_[_0xe3c6('0x39')]({},_0x502eb3,_0x28e4a8[_0xe3c6('0x3d')]);return db[_0xe3c6('0x2c')][_0xe3c6('0x47')](_0x502eb3)[_0xe3c6('0x22')](handleEntityNotFound(_0x1db706,null))[_0xe3c6('0x22')](respondWithResult(_0x1db706,null))['catch'](handleError(_0x1db706,null));};exports[_0xe3c6('0x48')]=function(_0x20cd3b,_0x37a5bb){return db[_0xe3c6('0x2c')][_0xe3c6('0x48')](_0x20cd3b[_0xe3c6('0x49')],{})[_0xe3c6('0x22')](function(_0x23f7d7){var _0x5e9609=_0x20cd3b['user'][_0xe3c6('0x23')]({'plain':!![]});if(!_0x5e9609)throw new Error(_0xe3c6('0x4a'));if(_0x5e9609[_0xe3c6('0x4b')]===_0xe3c6('0x4c')){var _0x2dfa23=_0x23f7d7[_0xe3c6('0x23')]({'plain':!![]});var _0x6a3a55=_0xe3c6('0x24');return db[_0xe3c6('0x4d')]['find']({'where':{'name':_0x6a3a55,'userProfileId':_0x5e9609['userProfileId']},'raw':!![]})[_0xe3c6('0x22')](function(_0x166b57){if(_0x166b57&&_0x166b57[_0xe3c6('0x4e')]===0x0){return db[_0xe3c6('0x25')][_0xe3c6('0x48')]({'name':_0x2dfa23[_0xe3c6('0x29')],'resourceId':_0x2dfa23['id'],'type':_0x166b57[_0xe3c6('0x29')],'sectionId':_0x166b57['id']},{})[_0xe3c6('0x22')](function(){return _0x23f7d7;});}else{return _0x23f7d7;}})[_0xe3c6('0x42')](function(_0x25f399){logger[_0xe3c6('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25f399);throw _0x25f399;});}return _0x23f7d7;})[_0xe3c6('0x22')](respondWithResult(_0x37a5bb,0xc9))[_0xe3c6('0x42')](handleError(_0x37a5bb,null));};exports[_0xe3c6('0x21')]=function(_0x13dfa4,_0x1edde8){if(_0x13dfa4[_0xe3c6('0x49')]['id']){delete _0x13dfa4[_0xe3c6('0x49')]['id'];}return db[_0xe3c6('0x2c')]['find']({'where':{'id':_0x13dfa4[_0xe3c6('0x44')]['id']}})[_0xe3c6('0x22')](handleEntityNotFound(_0x1edde8,null))[_0xe3c6('0x22')](saveUpdates(_0x13dfa4[_0xe3c6('0x49')],null))[_0xe3c6('0x22')](respondWithResult(_0x1edde8,null))['catch'](handleError(_0x1edde8,null));};exports[_0xe3c6('0x26')]=function(_0x3296e1,_0x17c7f9){return db[_0xe3c6('0x2c')]['find']({'where':{'id':_0x3296e1[_0xe3c6('0x44')]['id']}})[_0xe3c6('0x22')](handleEntityNotFound(_0x17c7f9,null))[_0xe3c6('0x22')](removeEntity(_0x17c7f9,null))['catch'](handleError(_0x17c7f9,null));}; \ No newline at end of file +var _0x216c=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId'];(function(_0x528b7b,_0x11ec67){var _0x20dadf=function(_0x3cedb1){while(--_0x3cedb1){_0x528b7b['push'](_0x528b7b['shift']());}};_0x20dadf(++_0x11ec67);}(_0x216c,0x153));var _0xc216=function(_0x55551a,_0x44aa7e){_0x55551a=_0x55551a-0x0;var _0x1a80b0=_0x216c[_0x55551a];return _0x1a80b0;};'use strict';var emlformat=require(_0xc216('0x0'));var rimraf=require(_0xc216('0x1'));var zipdir=require(_0xc216('0x2'));var jsonpatch=require(_0xc216('0x3'));var rp=require(_0xc216('0x4'));var moment=require(_0xc216('0x5'));var BPromise=require(_0xc216('0x6'));var Mustache=require('mustache');var util=require(_0xc216('0x7'));var path=require(_0xc216('0x8'));var sox=require(_0xc216('0x9'));var csv=require(_0xc216('0xa'));var ejs=require(_0xc216('0xb'));var fs=require('fs');var fs_extra=require(_0xc216('0xc'));var _=require('lodash');var squel=require(_0xc216('0xd'));var crypto=require(_0xc216('0xe'));var jsforce=require(_0xc216('0xf'));var deskjs=require(_0xc216('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc216('0x11'));var Redis=require(_0xc216('0x12'));var authService=require(_0xc216('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc216('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc216('0x15'))(_0xc216('0x16'));var utils=require(_0xc216('0x17'));var config=require(_0xc216('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc216('0x19'))['db'];function respondWithStatusCode(_0x500ec7,_0x3f42be){_0x3f42be=_0x3f42be||0xcc;return function(_0x506d16){if(_0x506d16){return _0x500ec7[_0xc216('0x1a')](_0x3f42be);}return _0x500ec7[_0xc216('0x1b')](_0x3f42be)[_0xc216('0x1c')]();};}function respondWithResult(_0x2adcc1,_0x19c7d1){_0x19c7d1=_0x19c7d1||0xc8;return function(_0x33dcdf){if(_0x33dcdf){return _0x2adcc1[_0xc216('0x1b')](_0x19c7d1)['json'](_0x33dcdf);}};}function respondWithFilteredResult(_0x165278,_0x3d0221){return function(_0x1b26e1){if(_0x1b26e1){var _0x421e04=typeof _0x3d0221[_0xc216('0x1d')]===_0xc216('0x1e')&&typeof _0x3d0221['limit']==='undefined';var _0x1b4cdb=_0x1b26e1['count'];var _0x18f8ce=_0x421e04?0x0:_0x3d0221[_0xc216('0x1d')];var _0x3f70fd=_0x421e04?_0x1b26e1[_0xc216('0x1f')]:_0x3d0221['offset']+_0x3d0221['limit'];var _0x296a85;if(_0x3f70fd>=_0x1b4cdb){_0x3f70fd=_0x1b4cdb;_0x296a85=0xc8;}else{_0x296a85=0xce;}_0x165278[_0xc216('0x1b')](_0x296a85);return _0x165278[_0xc216('0x20')](_0xc216('0x21'),_0x18f8ce+'-'+_0x3f70fd+'/'+_0x1b4cdb)[_0xc216('0x22')](_0x1b26e1);}return null;};}function patchUpdates(_0x40e292){return function(_0x1e6d30){try{jsonpatch[_0xc216('0x23')](_0x1e6d30,_0x40e292,!![]);}catch(_0xa39f23){return BPromise[_0xc216('0x24')](_0xa39f23);}return _0x1e6d30['save']();};}function saveUpdates(_0x214e6d,_0x3c6797){return function(_0x5c16fe){if(_0x5c16fe){return _0x5c16fe['update'](_0x214e6d)[_0xc216('0x25')](function(_0x59fe8f){return _0x59fe8f;});}return null;};}function removeEntity(_0x43ff14,_0x2e0b70){return function(_0x4948a0){if(_0x4948a0){return _0x4948a0[_0xc216('0x26')]()['then'](function(){var _0x16cd93=_0x4948a0[_0xc216('0x27')]({'plain':!![]});var _0x269946=_0xc216('0x28');return db[_0xc216('0x29')][_0xc216('0x26')]({'where':{'type':_0x269946,'resourceId':_0x16cd93['id']}})[_0xc216('0x25')](function(){return _0x4948a0;});})['then'](function(){_0x43ff14['status'](0xcc)[_0xc216('0x1c')]();});}};}function handleEntityNotFound(_0x1d5b30,_0x1ce2af){return function(_0x327f0c){if(!_0x327f0c){_0x1d5b30[_0xc216('0x1a')](0x194);}return _0x327f0c;};}function handleError(_0x32e92c,_0x58d6b2){_0x58d6b2=_0x58d6b2||0x1f4;return function(_0x31c6bc){logger[_0xc216('0x2a')](_0x31c6bc[_0xc216('0x2b')]);if(_0x31c6bc[_0xc216('0x2c')]){delete _0x31c6bc[_0xc216('0x2c')];}_0x32e92c[_0xc216('0x1b')](_0x58d6b2)['send'](_0x31c6bc);};}exports[_0xc216('0x2d')]=function(_0x314113,_0x3ca490){var _0x594327={},_0x9594fe={},_0x310e53={'count':0x0,'rows':[]};var _0x4849dd=_[_0xc216('0x2e')](db['CmContactHasItem'][_0xc216('0x2f')],function(_0x58fee3){return{'name':_0x58fee3[_0xc216('0x30')],'type':_0x58fee3[_0xc216('0x31')][_0xc216('0x32')]};});_0x9594fe[_0xc216('0x33')]=_[_0xc216('0x2e')](_0x4849dd,_0xc216('0x2c'));_0x9594fe[_0xc216('0x34')]=_[_0xc216('0x35')](_0x314113[_0xc216('0x34')]);_0x9594fe[_0xc216('0x36')]=_[_0xc216('0x37')](_0x9594fe[_0xc216('0x33')],_0x9594fe[_0xc216('0x34')]);_0x594327['attributes']=_[_0xc216('0x37')](_0x9594fe[_0xc216('0x33')],qs[_0xc216('0x38')](_0x314113['query']['fields']));_0x594327[_0xc216('0x39')]=_0x594327[_0xc216('0x39')][_0xc216('0x3a')]?_0x594327[_0xc216('0x39')]:_0x9594fe[_0xc216('0x33')];if(!_0x314113[_0xc216('0x34')]['hasOwnProperty'](_0xc216('0x3b'))){_0x594327[_0xc216('0x3c')]=qs['limit'](_0x314113[_0xc216('0x34')][_0xc216('0x3c')]);_0x594327[_0xc216('0x1d')]=qs[_0xc216('0x1d')](_0x314113[_0xc216('0x34')][_0xc216('0x1d')]);}_0x594327[_0xc216('0x3d')]=qs[_0xc216('0x3e')](_0x314113[_0xc216('0x34')]['sort']);_0x594327[_0xc216('0x3f')]=qs[_0xc216('0x36')](_['pick'](_0x314113['query'],_0x9594fe[_0xc216('0x36')]),_0x4849dd);if(_0x314113[_0xc216('0x34')][_0xc216('0x40')]){_0x594327[_0xc216('0x3f')]=_[_0xc216('0x41')](_0x594327[_0xc216('0x3f')],{'$or':_[_0xc216('0x2e')](_0x4849dd,function(_0x529c47){if(_0x529c47[_0xc216('0x31')]!=='VIRTUAL'){var _0x102c53={};_0x102c53[_0x529c47[_0xc216('0x2c')]]={'$like':'%'+_0x314113[_0xc216('0x34')][_0xc216('0x40')]+'%'};return _0x102c53;}})});}_0x594327=_[_0xc216('0x41')]({},_0x594327,_0x314113[_0xc216('0x42')]);var _0x45fff2={'where':_0x594327[_0xc216('0x3f')]};return db[_0xc216('0x43')]['count'](_0x45fff2)[_0xc216('0x25')](function(_0x5ca70c){_0x310e53['count']=_0x5ca70c;if(_0x314113['query'][_0xc216('0x44')]){_0x594327[_0xc216('0x45')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xc216('0x46')](_0x594327);})[_0xc216('0x25')](function(_0x4d52f7){_0x310e53[_0xc216('0x47')]=_0x4d52f7;return _0x310e53;})[_0xc216('0x25')](respondWithFilteredResult(_0x3ca490,_0x594327))[_0xc216('0x48')](handleError(_0x3ca490,null));};exports[_0xc216('0x49')]=function(_0x5cc8a1,_0x4f1c08){var _0x5a2cd1={'raw':!![],'where':{'id':_0x5cc8a1[_0xc216('0x4a')]['id']}},_0x51deb3={};_0x51deb3[_0xc216('0x33')]=_['keys'](db[_0xc216('0x43')][_0xc216('0x2f')]);_0x51deb3[_0xc216('0x34')]=_[_0xc216('0x35')](_0x5cc8a1[_0xc216('0x34')]);_0x51deb3[_0xc216('0x36')]=_[_0xc216('0x37')](_0x51deb3[_0xc216('0x33')],_0x51deb3[_0xc216('0x34')]);_0x5a2cd1[_0xc216('0x39')]=_['intersection'](_0x51deb3[_0xc216('0x33')],qs[_0xc216('0x38')](_0x5cc8a1[_0xc216('0x34')]['fields']));_0x5a2cd1[_0xc216('0x39')]=_0x5a2cd1[_0xc216('0x39')][_0xc216('0x3a')]?_0x5a2cd1[_0xc216('0x39')]:_0x51deb3[_0xc216('0x33')];if(_0x5cc8a1['query'][_0xc216('0x44')]){_0x5a2cd1['include']=[{'all':!![]}];}_0x5a2cd1=_[_0xc216('0x41')]({},_0x5a2cd1,_0x5cc8a1[_0xc216('0x42')]);return db[_0xc216('0x43')][_0xc216('0x4b')](_0x5a2cd1)[_0xc216('0x25')](handleEntityNotFound(_0x4f1c08,null))[_0xc216('0x25')](respondWithResult(_0x4f1c08,null))[_0xc216('0x48')](handleError(_0x4f1c08,null));};exports[_0xc216('0x4c')]=function(_0x175a35,_0x3342ec){return db[_0xc216('0x43')]['create'](_0x175a35[_0xc216('0x4d')],{})[_0xc216('0x25')](function(_0xde1abc){var _0x4035eb=_0x175a35[_0xc216('0x4e')][_0xc216('0x27')]({'plain':!![]});if(!_0x4035eb)throw new Error(_0xc216('0x4f'));if(_0x4035eb['role']===_0xc216('0x4e')){var _0x16be79=_0xde1abc['get']({'plain':!![]});var _0x19aa1a=_0xc216('0x28');return db['UserProfileSection'][_0xc216('0x4b')]({'where':{'name':_0x19aa1a,'userProfileId':_0x4035eb[_0xc216('0x50')]},'raw':!![]})['then'](function(_0x1a2be4){if(_0x1a2be4&&_0x1a2be4[_0xc216('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x16be79[_0xc216('0x2c')],'resourceId':_0x16be79['id'],'type':_0x1a2be4[_0xc216('0x2c')],'sectionId':_0x1a2be4['id']},{})['then'](function(){return _0xde1abc;});}else{return _0xde1abc;}})['catch'](function(_0x310288){logger[_0xc216('0x2a')](_0xc216('0x52'),_0x310288);throw _0x310288;});}return _0xde1abc;})[_0xc216('0x25')](respondWithResult(_0x3342ec,0xc9))[_0xc216('0x48')](handleError(_0x3342ec,null));};exports[_0xc216('0x53')]=function(_0x1fc929,_0x3d03e6){if(_0x1fc929['body']['id']){delete _0x1fc929[_0xc216('0x4d')]['id'];}return db['CmContactHasItem']['find']({'where':{'id':_0x1fc929['params']['id']}})[_0xc216('0x25')](handleEntityNotFound(_0x3d03e6,null))[_0xc216('0x25')](saveUpdates(_0x1fc929[_0xc216('0x4d')],null))[_0xc216('0x25')](respondWithResult(_0x3d03e6,null))['catch'](handleError(_0x3d03e6,null));};exports[_0xc216('0x26')]=function(_0x5f4aae,_0x20e2ee){return db['CmContactHasItem'][_0xc216('0x4b')]({'where':{'id':_0x5f4aae[_0xc216('0x4a')]['id']}})[_0xc216('0x25')](handleEntityNotFound(_0x20e2ee,null))['then'](removeEntity(_0x20e2ee,null))[_0xc216('0x48')](handleError(_0x20e2ee,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index d5859ff..8e19ceb 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 _0xc951=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment'];(function(_0x303862,_0x20b5ab){var _0xe6f228=function(_0x41fc5a){while(--_0x41fc5a){_0x303862['push'](_0x303862['shift']());}};_0xe6f228(++_0x20b5ab);}(_0xc951,0x190));var _0x1c95=function(_0xf64dfc,_0x34092d){_0xf64dfc=_0xf64dfc-0x0;var _0x53bddc=_0xc951[_0xf64dfc];return _0x53bddc;};'use strict';var _=require(_0x1c95('0x0'));var util=require(_0x1c95('0x1'));var logger=require(_0x1c95('0x2'))(_0x1c95('0x3'));var moment=require(_0x1c95('0x4'));var BPromise=require(_0x1c95('0x5'));var rp=require(_0x1c95('0x6'));var fs=require('fs');var path=require(_0x1c95('0x7'));var rimraf=require(_0x1c95('0x8'));var config=require(_0x1c95('0x9'));var attributes=require(_0x1c95('0xa'));module[_0x1c95('0xb')]=function(_0x2c80b4,_0x566c6a){return _0x2c80b4[_0x1c95('0xc')](_0x1c95('0xd'),attributes,{'tableName':_0x1c95('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5187=['api','moment','bluebird','path','../../config/environment','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger'];(function(_0x46e5fc,_0x5db9aa){var _0x52f4e6=function(_0x51a00){while(--_0x51a00){_0x46e5fc['push'](_0x46e5fc['shift']());}};_0x52f4e6(++_0x5db9aa);}(_0x5187,0x1c0));var _0x7518=function(_0x5c4e16,_0x113035){_0x5c4e16=_0x5c4e16-0x0;var _0x36044a=_0x5187[_0x5c4e16];return _0x36044a;};'use strict';var _=require(_0x7518('0x0'));var util=require(_0x7518('0x1'));var logger=require(_0x7518('0x2'))(_0x7518('0x3'));var moment=require(_0x7518('0x4'));var BPromise=require(_0x7518('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7518('0x6'));var rimraf=require('rimraf');var config=require(_0x7518('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x209689,_0xbc909d){return _0x209689[_0x7518('0x8')](_0x7518('0x9'),attributes,{'tableName':_0x7518('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 1275e5a..213095a 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 _0x31bf=['stringify','error','code','message','info','CmContactHasItem,\x20%s,\x20%s','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31bf,0x18f));var _0xf31b=function(_0x41d34f,_0x7a4f44){_0x41d34f=_0x41d34f-0x0;var _0x4c9f88=_0x31bf[_0x41d34f];return _0x4c9f88;};'use strict';var _=require('lodash');var util=require(_0xf31b('0x0'));var moment=require(_0xf31b('0x1'));var BPromise=require(_0xf31b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf31b('0x3'));var db=require(_0xf31b('0x4'))['db'];var utils=require(_0xf31b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf31b('0x6'));var jayson=require(_0xf31b('0x7'));var client=jayson[_0xf31b('0x8')][_0xf31b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2365e6,_0x55773e,_0x1afab7){return new BPromise(function(_0x3f0fb4,_0x5137a3){return client[_0xf31b('0xa')](_0x2365e6,_0x1afab7)[_0xf31b('0xb')](function(_0x38c430){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x55773e,_0xf31b('0xc'));logger[_0xf31b('0xd')](_0xf31b('0xe'),_0x55773e,_0xf31b('0xc'),JSON[_0xf31b('0xf')](_0x38c430));if(_0x38c430[_0xf31b('0x10')]){if(_0x38c430[_0xf31b('0x10')][_0xf31b('0x11')]===0x1f4){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x55773e,_0x38c430['error'][_0xf31b('0x12')]);return _0x5137a3(_0x38c430['error'][_0xf31b('0x12')]);}logger[_0xf31b('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x55773e,_0x38c430[_0xf31b('0x10')]['message']);return _0x3f0fb4(_0x38c430[_0xf31b('0x10')][_0xf31b('0x12')]);}else{logger[_0xf31b('0x13')](_0xf31b('0x14'),_0x55773e,_0xf31b('0xc'));_0x3f0fb4(_0x38c430[_0xf31b('0x15')][_0xf31b('0x12')]);}})[_0xf31b('0x16')](function(_0x1fa024){logger[_0xf31b('0x10')](_0xf31b('0x14'),_0x55773e,_0x1fa024);_0x5137a3(_0x1fa024);});});} \ No newline at end of file +var _0x6208=['jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e772a,_0x5419b6){var _0x282f4d=function(_0x2a21cb){while(--_0x2a21cb){_0x1e772a['push'](_0x1e772a['shift']());}};_0x282f4d(++_0x5419b6);}(_0x6208,0x1ea));var _0x8620=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x6208[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0x8620('0x0'));var util=require(_0x8620('0x1'));var moment=require(_0x8620('0x2'));var BPromise=require(_0x8620('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8620('0x4'));var db=require(_0x8620('0x5'))['db'];var utils=require(_0x8620('0x6'));var logger=require(_0x8620('0x7'))(_0x8620('0x8'));var config=require(_0x8620('0x9'));var jayson=require(_0x8620('0xa'));var client=jayson['client'][_0x8620('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17109b,_0xf97b7c,_0x41830c){return new BPromise(function(_0x1b8847,_0x5c5508){return client[_0x8620('0xc')](_0x17109b,_0x41830c)[_0x8620('0xd')](function(_0x346ec2){logger[_0x8620('0xe')](_0x8620('0xf'),_0xf97b7c,_0x8620('0x10'));logger[_0x8620('0x11')](_0x8620('0x12'),_0xf97b7c,_0x8620('0x10'),JSON[_0x8620('0x13')](_0x346ec2));if(_0x346ec2[_0x8620('0x14')]){if(_0x346ec2[_0x8620('0x14')][_0x8620('0x15')]===0x1f4){logger[_0x8620('0x14')](_0x8620('0xf'),_0xf97b7c,_0x346ec2[_0x8620('0x14')][_0x8620('0x16')]);return _0x5c5508(_0x346ec2[_0x8620('0x14')][_0x8620('0x16')]);}logger[_0x8620('0x14')](_0x8620('0xf'),_0xf97b7c,_0x346ec2[_0x8620('0x14')]['message']);return _0x1b8847(_0x346ec2[_0x8620('0x14')][_0x8620('0x16')]);}else{logger[_0x8620('0xe')](_0x8620('0xf'),_0xf97b7c,'request\x20sent');_0x1b8847(_0x346ec2[_0x8620('0x17')]['message']);}})[_0x8620('0x18')](function(_0x5e8f12){logger['error'](_0x8620('0xf'),_0xf97b7c,_0x5e8f12);_0x5c5508(_0x5e8f12);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b53f4e0..ab6c26b 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 _0x0bb9=['index','/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated'];(function(_0x2c95df,_0x4bc472){var _0x401346=function(_0x7817e6){while(--_0x7817e6){_0x2c95df['push'](_0x2c95df['shift']());}};_0x401346(++_0x4bc472);}(_0x0bb9,0xd4));var _0x90bb=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x0bb9[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0x90bb('0x0'));var util=require('util');var path=require(_0x90bb('0x1'));var timeout=require(_0x90bb('0x2'));var express=require('express');var router=express[_0x90bb('0x3')]();var fs_extra=require(_0x90bb('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x90bb('0x5'));var controller=require(_0x90bb('0x6'));router[_0x90bb('0x7')]('/',auth[_0x90bb('0x8')](),controller[_0x90bb('0x9')]);router[_0x90bb('0x7')](_0x90bb('0xa'),auth['isAuthenticated'](),controller[_0x90bb('0xb')]);router[_0x90bb('0xc')]('/',auth[_0x90bb('0x8')](),controller[_0x90bb('0xd')]);router['put'](_0x90bb('0xa'),auth[_0x90bb('0x8')](),controller[_0x90bb('0xe')]);router[_0x90bb('0xf')](_0x90bb('0xa'),auth[_0x90bb('0x8')](),controller[_0x90bb('0x10')]);module['exports']=router; \ No newline at end of file +var _0xab06=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x5cc40f,_0xd9a3a9){var _0x28db81=function(_0x1c707f){while(--_0x1c707f){_0x5cc40f['push'](_0x5cc40f['shift']());}};_0x28db81(++_0xd9a3a9);}(_0xab06,0xe5));var _0x6ab0=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0xab06[_0x28611e];return _0x530f69;};'use strict';var multer=require(_0x6ab0('0x0'));var util=require(_0x6ab0('0x1'));var path=require(_0x6ab0('0x2'));var timeout=require(_0x6ab0('0x3'));var express=require(_0x6ab0('0x4'));var router=express[_0x6ab0('0x5')]();var fs_extra=require(_0x6ab0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6ab0('0x7'));var config=require(_0x6ab0('0x8'));var controller=require(_0x6ab0('0x9'));router[_0x6ab0('0xa')]('/',auth[_0x6ab0('0xb')](),controller[_0x6ab0('0xc')]);router['get'](_0x6ab0('0xd'),auth[_0x6ab0('0xb')](),controller[_0x6ab0('0xe')]);router['post']('/',auth[_0x6ab0('0xb')](),controller[_0x6ab0('0xf')]);router[_0x6ab0('0x10')]('/:id',auth[_0x6ab0('0xb')](),controller[_0x6ab0('0x11')]);router[_0x6ab0('0x12')](_0x6ab0('0xd'),auth[_0x6ab0('0xb')](),controller[_0x6ab0('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 3516641..a6dd8d1 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 _0xe08c=['exports','VIRTUAL','STRING','setDataValue','alias','getDataValue','name','TEXT','long','type','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x8022cb,_0x442c38){var _0x3e7a46=function(_0xe60da3){while(--_0xe60da3){_0x8022cb['push'](_0x8022cb['shift']());}};_0x3e7a46(++_0x442c38);}(_0xe08c,0xed));var _0xce08=function(_0x5ebc2a,_0x188637){_0x5ebc2a=_0x5ebc2a-0x0;var _0x256a03=_0xe08c[_0x5ebc2a];return _0x256a03;};'use strict';var Sequelize=require(_0xce08('0x0'));var _=require('lodash');module[_0xce08('0x1')]={'name':{'type':Sequelize[_0xce08('0x2')],'get':function(_0x2cad2c){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0xce08('0x3')],'allowNull':![],'set':function(_0x4138c8){this[_0xce08('0x4')](_0xce08('0x5'),_0x4138c8?_0x4138c8:this[_0xce08('0x6')](_0xce08('0x7')));}},'type':{'type':Sequelize[_0xce08('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0xce08('0x8')](_0xce08('0x9')),'get':function(){if(this[_0xce08('0x6')](_0xce08('0xa'))==='select'){return JSON[_0xce08('0xb')](this['getDataValue'](_0xce08('0xc')));}else{return this[_0xce08('0x6')](_0xce08('0xc'));}},'set':function(_0x23ea5c){if(Array['isArray'](_0x23ea5c)){this[_0xce08('0x4')]('values',JSON[_0xce08('0xd')](_0x23ea5c));}else{this[_0xce08('0x4')](_0xce08('0xc'),_0x23ea5c);}}},'required':{'type':Sequelize[_0xce08('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xce08('0xf')](_0xce08('0x10'))}}; \ No newline at end of file +var _0x7e9f=['alias','STRING','setDataValue','TEXT','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','getDataValue'];(function(_0x28b31b,_0x53a290){var _0x2a8933=function(_0x55557c){while(--_0x55557c){_0x28b31b['push'](_0x28b31b['shift']());}};_0x2a8933(++_0x53a290);}(_0x7e9f,0x11c));var _0xf7e9=function(_0x5ea850,_0x2f19c4){_0x5ea850=_0x5ea850-0x0;var _0x51acb1=_0x7e9f[_0x5ea850];return _0x51acb1;};'use strict';var Sequelize=require(_0xf7e9('0x0'));var _=require(_0xf7e9('0x1'));module[_0xf7e9('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4625f8){return this[_0xf7e9('0x3')](_0xf7e9('0x4'));}},'alias':{'type':Sequelize[_0xf7e9('0x5')],'allowNull':![],'set':function(_0xc97dca){this[_0xf7e9('0x6')](_0xf7e9('0x4'),_0xc97dca?_0xc97dca:this[_0xf7e9('0x3')]('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xf7e9('0x7')]('long'),'get':function(){if(this[_0xf7e9('0x3')](_0xf7e9('0x8'))==='select'){return JSON[_0xf7e9('0x9')](this[_0xf7e9('0x3')]('values'));}else{return this['getDataValue'](_0xf7e9('0xa'));}},'set':function(_0x568ceb){if(Array[_0xf7e9('0xb')](_0x568ceb)){this['setDataValue'](_0xf7e9('0xa'),JSON[_0xf7e9('0xc')](_0x568ceb));}else{this[_0xf7e9('0x6')](_0xf7e9('0xa'),_0x568ceb);}}},'required':{'type':Sequelize[_0xf7e9('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf7e9('0xe')](_0xf7e9('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d69ddf7..680a71b 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 _0xacf7=['ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x262f47,_0x300945){var _0x557f7c=function(_0x8988d0){while(--_0x8988d0){_0x262f47['push'](_0x262f47['shift']());}};_0x557f7c(++_0x300945);}(_0xacf7,0x1bd));var _0x7acf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xacf7[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x7acf('0x0'));var rimraf=require(_0x7acf('0x1'));var zipdir=require(_0x7acf('0x2'));var jsonpatch=require(_0x7acf('0x3'));var rp=require(_0x7acf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7acf('0x5'));var util=require(_0x7acf('0x6'));var path=require(_0x7acf('0x7'));var sox=require(_0x7acf('0x8'));var csv=require(_0x7acf('0x9'));var ejs=require(_0x7acf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7acf('0xb'));var squel=require(_0x7acf('0xc'));var crypto=require(_0x7acf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7acf('0xe'));var toCsv=require(_0x7acf('0x9'));var querystring=require(_0x7acf('0xf'));var Papa=require(_0x7acf('0x10'));var Redis=require(_0x7acf('0x11'));var authService=require(_0x7acf('0x12'));var qs=require(_0x7acf('0x13'));var as=require(_0x7acf('0x14'));var hardwareService=require(_0x7acf('0x15'));var logger=require(_0x7acf('0x16'))(_0x7acf('0x17'));var utils=require(_0x7acf('0x18'));var config=require(_0x7acf('0x19'));var licenseUtil=require(_0x7acf('0x1a'));var db=require(_0x7acf('0x1b'))['db'];function respondWithStatusCode(_0x2e4fae,_0x5644f3){_0x5644f3=_0x5644f3||0xcc;return function(_0x1d76bc){if(_0x1d76bc){return _0x2e4fae['sendStatus'](_0x5644f3);}return _0x2e4fae[_0x7acf('0x1c')](_0x5644f3)['end']();};}function respondWithResult(_0xe48928,_0x40dc19){_0x40dc19=_0x40dc19||0xc8;return function(_0x10d29b){if(_0x10d29b){return _0xe48928['status'](_0x40dc19)[_0x7acf('0x1d')](_0x10d29b);}};}function respondWithFilteredResult(_0x1ab1a3,_0x531b60){return function(_0x518a7c){if(_0x518a7c){var _0x41c1ef=typeof _0x531b60['offset']==='undefined'&&typeof _0x531b60['limit']===_0x7acf('0x1e');var _0x317c60=_0x518a7c[_0x7acf('0x1f')];var _0xbd4cb8=_0x41c1ef?0x0:_0x531b60[_0x7acf('0x20')];var _0x3a05a8=_0x41c1ef?_0x518a7c[_0x7acf('0x1f')]:_0x531b60[_0x7acf('0x20')]+_0x531b60['limit'];var _0x1b9a88;if(_0x3a05a8>=_0x317c60){_0x3a05a8=_0x317c60;_0x1b9a88=0xc8;}else{_0x1b9a88=0xce;}_0x1ab1a3['status'](_0x1b9a88);return _0x1ab1a3['set']('Content-Range',_0xbd4cb8+'-'+_0x3a05a8+'/'+_0x317c60)[_0x7acf('0x1d')](_0x518a7c);}return null;};}function patchUpdates(_0x9a19a9){return function(_0x1ea307){try{jsonpatch[_0x7acf('0x21')](_0x1ea307,_0x9a19a9,!![]);}catch(_0x4d5e09){return BPromise[_0x7acf('0x22')](_0x4d5e09);}return _0x1ea307[_0x7acf('0x23')]();};}function saveUpdates(_0x563ff3,_0x2b0452){return function(_0x3b3521){if(_0x3b3521){return _0x3b3521[_0x7acf('0x24')](_0x563ff3)[_0x7acf('0x25')](function(_0x58cd66){return _0x58cd66;});}return null;};}function removeEntity(_0x1291c4,_0x4e9b20){return function(_0x99d1c7){if(_0x99d1c7){return _0x99d1c7['destroy']()[_0x7acf('0x25')](function(){_0x1291c4['status'](0xcc)[_0x7acf('0x26')]();});}};}function handleEntityNotFound(_0xf8fe81,_0x15032b){return function(_0x4c1807){if(!_0x4c1807){_0xf8fe81[_0x7acf('0x27')](0x194);}return _0x4c1807;};}function handleError(_0x4668dd,_0x45be23){_0x45be23=_0x45be23||0x1f4;return function(_0x23ab5a){logger[_0x7acf('0x28')](_0x23ab5a[_0x7acf('0x29')]);if(_0x23ab5a[_0x7acf('0x2a')]){delete _0x23ab5a[_0x7acf('0x2a')];}_0x4668dd['status'](_0x45be23)[_0x7acf('0x2b')](_0x23ab5a);};}exports[_0x7acf('0x2c')]=function(_0x1f5520,_0x272867){var _0x1e9842={},_0x48a9f7={},_0x16c0c9={'count':0x0,'rows':[]};var _0x35def6=_[_0x7acf('0x2d')](db[_0x7acf('0x2e')][_0x7acf('0x2f')],function(_0x3ee5ed){return{'name':_0x3ee5ed[_0x7acf('0x30')],'type':_0x3ee5ed[_0x7acf('0x31')][_0x7acf('0x32')]};});_0x48a9f7[_0x7acf('0x33')]=_['differenceBy'](_[_0x7acf('0x2d')](_0x35def6,'name'),[_0x7acf('0x2a')]);_0x48a9f7[_0x7acf('0x34')]=_[_0x7acf('0x35')](_0x1f5520['query']);_0x48a9f7[_0x7acf('0x36')]=_[_0x7acf('0x37')](_0x48a9f7[_0x7acf('0x33')],_0x48a9f7[_0x7acf('0x34')]);_0x1e9842[_0x7acf('0x38')]=_[_0x7acf('0x37')](_0x48a9f7[_0x7acf('0x33')],qs[_0x7acf('0x39')](_0x1f5520[_0x7acf('0x34')][_0x7acf('0x39')]));_0x1e9842[_0x7acf('0x38')]=_0x1e9842[_0x7acf('0x38')][_0x7acf('0x3a')]?_0x1e9842['attributes']:_0x48a9f7[_0x7acf('0x33')];if(!_0x1f5520['query']['hasOwnProperty'](_0x7acf('0x3b'))){_0x1e9842['limit']=qs[_0x7acf('0x3c')](_0x1f5520[_0x7acf('0x34')][_0x7acf('0x3c')]);_0x1e9842[_0x7acf('0x20')]=qs[_0x7acf('0x20')](_0x1f5520[_0x7acf('0x34')][_0x7acf('0x20')]);}_0x1e9842[_0x7acf('0x3d')]=qs[_0x7acf('0x3e')](_0x1f5520[_0x7acf('0x34')][_0x7acf('0x3e')]);_0x1e9842[_0x7acf('0x3f')]=qs['filters'](_[_0x7acf('0x40')](_0x1f5520[_0x7acf('0x34')],_0x48a9f7['filters']),_0x35def6);if(_0x1f5520[_0x7acf('0x34')][_0x7acf('0x41')]){_0x1e9842[_0x7acf('0x3f')]=_[_0x7acf('0x42')](_0x1e9842[_0x7acf('0x3f')],{'$or':_[_0x7acf('0x2d')](_0x35def6,function(_0x378439){if(_0x378439[_0x7acf('0x31')]!==_0x7acf('0x43')){var _0x122a2d={};_0x122a2d[_0x378439['name']]={'$like':'%'+_0x1f5520['query'][_0x7acf('0x41')]+'%'};return _0x122a2d;}})});}_0x1e9842=_[_0x7acf('0x42')]({},_0x1e9842,_0x1f5520[_0x7acf('0x44')]);var _0x29bae2={'where':_0x1e9842[_0x7acf('0x3f')]};return db[_0x7acf('0x2e')][_0x7acf('0x1f')](_0x29bae2)['then'](function(_0x1f5f43){_0x16c0c9[_0x7acf('0x1f')]=_0x1f5f43;if(_0x1f5520[_0x7acf('0x34')][_0x7acf('0x45')]){_0x1e9842[_0x7acf('0x46')]=[{'all':!![]}];}return db[_0x7acf('0x2e')]['findAll'](_0x1e9842);})['then'](function(_0x5e30f7){_0x16c0c9['rows']=_0x5e30f7;return _0x16c0c9;})[_0x7acf('0x25')](respondWithFilteredResult(_0x272867,_0x1e9842))[_0x7acf('0x47')](handleError(_0x272867,null));};exports[_0x7acf('0x48')]=function(_0x208286,_0x4c8c11){var _0x5e7d3e={'raw':!![],'where':{'id':_0x208286[_0x7acf('0x49')]['id']}},_0x2c83bf={};_0x2c83bf['model']=_[_0x7acf('0x35')](db[_0x7acf('0x2e')][_0x7acf('0x2f')]);_0x2c83bf[_0x7acf('0x34')]=_['keys'](_0x208286[_0x7acf('0x34')]);_0x2c83bf[_0x7acf('0x36')]=_[_0x7acf('0x37')](_0x2c83bf[_0x7acf('0x33')],_0x2c83bf[_0x7acf('0x34')]);_0x5e7d3e[_0x7acf('0x38')]=_[_0x7acf('0x37')](_0x2c83bf['model'],qs['fields'](_0x208286[_0x7acf('0x34')]['fields']));_0x5e7d3e['attributes']=_0x5e7d3e[_0x7acf('0x38')]['length']?_0x5e7d3e[_0x7acf('0x38')]:_0x2c83bf['model'];if(_0x208286[_0x7acf('0x34')][_0x7acf('0x45')]){_0x5e7d3e[_0x7acf('0x46')]=[{'all':!![]}];}_0x5e7d3e=_[_0x7acf('0x42')]({},_0x5e7d3e,_0x208286[_0x7acf('0x44')]);return db[_0x7acf('0x2e')][_0x7acf('0x4a')](_0x5e7d3e)[_0x7acf('0x25')](handleEntityNotFound(_0x4c8c11,null))['then'](respondWithResult(_0x4c8c11,null))[_0x7acf('0x47')](handleError(_0x4c8c11,null));};exports[_0x7acf('0x24')]=function(_0x5cdc00,_0x4021f8){if(_0x5cdc00[_0x7acf('0x4b')]['id']){delete _0x5cdc00[_0x7acf('0x4b')]['id'];}return db[_0x7acf('0x2e')][_0x7acf('0x4a')]({'where':{'id':_0x5cdc00[_0x7acf('0x49')]['id']}})[_0x7acf('0x25')](handleEntityNotFound(_0x4021f8,null))[_0x7acf('0x25')](saveUpdates(_0x5cdc00['body'],null))['then'](respondWithResult(_0x4021f8,null))[_0x7acf('0x47')](handleError(_0x4021f8,null));};exports['destroy']=function(_0x407f27,_0xcd8055){return db[_0x7acf('0x2e')][_0x7acf('0x4a')]({'where':{'id':_0x407f27[_0x7acf('0x49')]['id']}})[_0x7acf('0x25')](handleEntityNotFound(_0xcd8055,null))[_0x7acf('0x25')](removeEntity(_0xcd8055,null))[_0x7acf('0x47')](handleError(_0xcd8055,null));};exports[_0x7acf('0x4c')]=function(_0x30e655,_0x1e75e5){var _0x3a0d90;return db[_0x7acf('0x4d')][_0x7acf('0x4e')](function(_0x1f60de){return db[_0x7acf('0x2e')][_0x7acf('0x4c')](_0x30e655[_0x7acf('0x4b')],{'transaction':_0x1f60de})[_0x7acf('0x25')](function(_0x4b231a){_0x3a0d90=_0x4b231a;var _0x27a020={'type':db[_0x7acf('0x4f')][_0x7acf('0x50')],'transaction':_0x1f60de};switch(_0x30e655[_0x7acf('0x4b')][_0x7acf('0x31')]){case _0x7acf('0x51'):_0x27a020['type']=db[_0x7acf('0x4f')][_0x7acf('0x50')];break;case _0x7acf('0x52'):_0x27a020['type']=db[_0x7acf('0x4f')][_0x7acf('0x53')];break;case _0x7acf('0x54'):_0x27a020[_0x7acf('0x31')]=db[_0x7acf('0x4f')][_0x7acf('0x55')];_0x27a020[_0x7acf('0x56')]=![];break;default:}return db[_0x7acf('0x4d')][_0x7acf('0x57')][_0x7acf('0x58')]('cm_contacts',util[_0x7acf('0x59')](_0x7acf('0x5a'),_0x3a0d90['id']),_0x27a020);})['then'](function(){return _0x3a0d90;});})[_0x7acf('0x25')](respondWithResult(_0x1e75e5,0xc9))[_0x7acf('0x47')](handleError(_0x1e75e5,null));}; \ No newline at end of file +var _0xd248=['switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','key','model','differenceBy','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','Sequelize','TEXT','text','number','INTEGER'];(function(_0x42c5fa,_0x308358){var _0x1086af=function(_0x5950da){while(--_0x5950da){_0x42c5fa['push'](_0x42c5fa['shift']());}};_0x1086af(++_0x308358);}(_0xd248,0x16c));var _0x8d24=function(_0x14dc8a,_0x4fe14d){_0x14dc8a=_0x14dc8a-0x0;var _0xc2be12=_0xd248[_0x14dc8a];return _0xc2be12;};'use strict';var emlformat=require(_0x8d24('0x0'));var rimraf=require(_0x8d24('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d24('0x2'));var rp=require('request-promise');var moment=require(_0x8d24('0x3'));var BPromise=require(_0x8d24('0x4'));var Mustache=require(_0x8d24('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8d24('0x6'));var csv=require('to-csv');var ejs=require(_0x8d24('0x7'));var fs=require('fs');var fs_extra=require(_0x8d24('0x8'));var _=require(_0x8d24('0x9'));var squel=require(_0x8d24('0xa'));var crypto=require(_0x8d24('0xb'));var jsforce=require(_0x8d24('0xc'));var deskjs=require(_0x8d24('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8d24('0xe'));var authService=require(_0x8d24('0xf'));var qs=require(_0x8d24('0x10'));var as=require(_0x8d24('0x11'));var hardwareService=require(_0x8d24('0x12'));var logger=require(_0x8d24('0x13'))(_0x8d24('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d24('0x15'));var db=require(_0x8d24('0x16'))['db'];function respondWithStatusCode(_0x4e98af,_0xd6c2e3){_0xd6c2e3=_0xd6c2e3||0xcc;return function(_0x23e90e){if(_0x23e90e){return _0x4e98af[_0x8d24('0x17')](_0xd6c2e3);}return _0x4e98af[_0x8d24('0x18')](_0xd6c2e3)[_0x8d24('0x19')]();};}function respondWithResult(_0xd76265,_0x526ff8){_0x526ff8=_0x526ff8||0xc8;return function(_0xead351){if(_0xead351){return _0xd76265[_0x8d24('0x18')](_0x526ff8)['json'](_0xead351);}};}function respondWithFilteredResult(_0x59c0a8,_0x4bf581){return function(_0x30d607){if(_0x30d607){var _0x46077a=typeof _0x4bf581[_0x8d24('0x1a')]===_0x8d24('0x1b')&&typeof _0x4bf581[_0x8d24('0x1c')]===_0x8d24('0x1b');var _0x389da3=_0x30d607['count'];var _0x3fe764=_0x46077a?0x0:_0x4bf581[_0x8d24('0x1a')];var _0x3d94e2=_0x46077a?_0x30d607[_0x8d24('0x1d')]:_0x4bf581['offset']+_0x4bf581[_0x8d24('0x1c')];var _0x9aa993;if(_0x3d94e2>=_0x389da3){_0x3d94e2=_0x389da3;_0x9aa993=0xc8;}else{_0x9aa993=0xce;}_0x59c0a8['status'](_0x9aa993);return _0x59c0a8[_0x8d24('0x1e')](_0x8d24('0x1f'),_0x3fe764+'-'+_0x3d94e2+'/'+_0x389da3)['json'](_0x30d607);}return null;};}function patchUpdates(_0x1a6b5a){return function(_0x35fdca){try{jsonpatch[_0x8d24('0x20')](_0x35fdca,_0x1a6b5a,!![]);}catch(_0x45958b){return BPromise[_0x8d24('0x21')](_0x45958b);}return _0x35fdca[_0x8d24('0x22')]();};}function saveUpdates(_0x4188aa,_0x57a0ce){return function(_0x56f470){if(_0x56f470){return _0x56f470[_0x8d24('0x23')](_0x4188aa)['then'](function(_0x4be451){return _0x4be451;});}return null;};}function removeEntity(_0xd690de,_0x5cccc2){return function(_0xfe2a64){if(_0xfe2a64){return _0xfe2a64[_0x8d24('0x24')]()[_0x8d24('0x25')](function(){_0xd690de[_0x8d24('0x18')](0xcc)[_0x8d24('0x19')]();});}};}function handleEntityNotFound(_0xecbef1,_0x38842e){return function(_0x193029){if(!_0x193029){_0xecbef1['sendStatus'](0x194);}return _0x193029;};}function handleError(_0x45fa81,_0x25d2ba){_0x25d2ba=_0x25d2ba||0x1f4;return function(_0x541420){logger[_0x8d24('0x26')](_0x541420[_0x8d24('0x27')]);if(_0x541420['name']){delete _0x541420[_0x8d24('0x28')];}_0x45fa81[_0x8d24('0x18')](_0x25d2ba)[_0x8d24('0x29')](_0x541420);};}exports[_0x8d24('0x2a')]=function(_0x2060fa,_0x41a3f5){var _0x56d1a7={},_0x21f38f={},_0xc8a823={'count':0x0,'rows':[]};var _0x16e123=_[_0x8d24('0x2b')](db[_0x8d24('0x2c')][_0x8d24('0x2d')],function(_0x3c7dcc){return{'name':_0x3c7dcc['fieldName'],'type':_0x3c7dcc['type'][_0x8d24('0x2e')]};});_0x21f38f[_0x8d24('0x2f')]=_[_0x8d24('0x30')](_[_0x8d24('0x2b')](_0x16e123,_0x8d24('0x28')),['name']);_0x21f38f[_0x8d24('0x31')]=_['keys'](_0x2060fa[_0x8d24('0x31')]);_0x21f38f[_0x8d24('0x32')]=_[_0x8d24('0x33')](_0x21f38f[_0x8d24('0x2f')],_0x21f38f['query']);_0x56d1a7[_0x8d24('0x34')]=_[_0x8d24('0x33')](_0x21f38f[_0x8d24('0x2f')],qs[_0x8d24('0x35')](_0x2060fa[_0x8d24('0x31')][_0x8d24('0x35')]));_0x56d1a7[_0x8d24('0x34')]=_0x56d1a7[_0x8d24('0x34')][_0x8d24('0x36')]?_0x56d1a7[_0x8d24('0x34')]:_0x21f38f[_0x8d24('0x2f')];if(!_0x2060fa['query'][_0x8d24('0x37')](_0x8d24('0x38'))){_0x56d1a7['limit']=qs['limit'](_0x2060fa[_0x8d24('0x31')][_0x8d24('0x1c')]);_0x56d1a7['offset']=qs[_0x8d24('0x1a')](_0x2060fa[_0x8d24('0x31')]['offset']);}_0x56d1a7[_0x8d24('0x39')]=qs[_0x8d24('0x3a')](_0x2060fa[_0x8d24('0x31')][_0x8d24('0x3a')]);_0x56d1a7[_0x8d24('0x3b')]=qs[_0x8d24('0x32')](_[_0x8d24('0x3c')](_0x2060fa['query'],_0x21f38f[_0x8d24('0x32')]),_0x16e123);if(_0x2060fa[_0x8d24('0x31')][_0x8d24('0x3d')]){_0x56d1a7[_0x8d24('0x3b')]=_[_0x8d24('0x3e')](_0x56d1a7[_0x8d24('0x3b')],{'$or':_['map'](_0x16e123,function(_0x3c59b7){if(_0x3c59b7[_0x8d24('0x3f')]!==_0x8d24('0x40')){var _0x4cb96f={};_0x4cb96f[_0x3c59b7[_0x8d24('0x28')]]={'$like':'%'+_0x2060fa[_0x8d24('0x31')][_0x8d24('0x3d')]+'%'};return _0x4cb96f;}})});}_0x56d1a7=_[_0x8d24('0x3e')]({},_0x56d1a7,_0x2060fa['options']);var _0x256246={'where':_0x56d1a7[_0x8d24('0x3b')]};return db[_0x8d24('0x2c')][_0x8d24('0x1d')](_0x256246)[_0x8d24('0x25')](function(_0x5b1b9b){_0xc8a823['count']=_0x5b1b9b;if(_0x2060fa['query'][_0x8d24('0x41')]){_0x56d1a7[_0x8d24('0x42')]=[{'all':!![]}];}return db[_0x8d24('0x2c')][_0x8d24('0x43')](_0x56d1a7);})['then'](function(_0x3569bf){_0xc8a823[_0x8d24('0x44')]=_0x3569bf;return _0xc8a823;})[_0x8d24('0x25')](respondWithFilteredResult(_0x41a3f5,_0x56d1a7))[_0x8d24('0x45')](handleError(_0x41a3f5,null));};exports[_0x8d24('0x46')]=function(_0x18c268,_0x324ce9){var _0x5c33de={'raw':!![],'where':{'id':_0x18c268[_0x8d24('0x47')]['id']}},_0x64cadb={};_0x64cadb['model']=_[_0x8d24('0x48')](db[_0x8d24('0x2c')][_0x8d24('0x2d')]);_0x64cadb['query']=_[_0x8d24('0x48')](_0x18c268[_0x8d24('0x31')]);_0x64cadb[_0x8d24('0x32')]=_[_0x8d24('0x33')](_0x64cadb[_0x8d24('0x2f')],_0x64cadb[_0x8d24('0x31')]);_0x5c33de[_0x8d24('0x34')]=_['intersection'](_0x64cadb['model'],qs[_0x8d24('0x35')](_0x18c268[_0x8d24('0x31')][_0x8d24('0x35')]));_0x5c33de[_0x8d24('0x34')]=_0x5c33de[_0x8d24('0x34')][_0x8d24('0x36')]?_0x5c33de[_0x8d24('0x34')]:_0x64cadb[_0x8d24('0x2f')];if(_0x18c268['query'][_0x8d24('0x41')]){_0x5c33de[_0x8d24('0x42')]=[{'all':!![]}];}_0x5c33de=_['merge']({},_0x5c33de,_0x18c268[_0x8d24('0x49')]);return db['CmCustomField'][_0x8d24('0x4a')](_0x5c33de)[_0x8d24('0x25')](handleEntityNotFound(_0x324ce9,null))[_0x8d24('0x25')](respondWithResult(_0x324ce9,null))[_0x8d24('0x45')](handleError(_0x324ce9,null));};exports[_0x8d24('0x23')]=function(_0xa428ee,_0x5a88e9){if(_0xa428ee['body']['id']){delete _0xa428ee[_0x8d24('0x4b')]['id'];}return db['CmCustomField'][_0x8d24('0x4a')]({'where':{'id':_0xa428ee[_0x8d24('0x47')]['id']}})[_0x8d24('0x25')](handleEntityNotFound(_0x5a88e9,null))[_0x8d24('0x25')](saveUpdates(_0xa428ee['body'],null))[_0x8d24('0x25')](respondWithResult(_0x5a88e9,null))[_0x8d24('0x45')](handleError(_0x5a88e9,null));};exports[_0x8d24('0x24')]=function(_0x47e091,_0x86e8df){return db[_0x8d24('0x2c')]['find']({'where':{'id':_0x47e091['params']['id']}})[_0x8d24('0x25')](handleEntityNotFound(_0x86e8df,null))[_0x8d24('0x25')](removeEntity(_0x86e8df,null))[_0x8d24('0x45')](handleError(_0x86e8df,null));};exports['create']=function(_0x223230,_0x1bf7d3){var _0x355141;return db['sequelize']['transaction'](function(_0x2c2a40){return db[_0x8d24('0x2c')]['create'](_0x223230[_0x8d24('0x4b')],{'transaction':_0x2c2a40})[_0x8d24('0x25')](function(_0x3ca080){_0x355141=_0x3ca080;var _0x2678ae={'type':db[_0x8d24('0x4c')][_0x8d24('0x4d')],'transaction':_0x2c2a40};switch(_0x223230[_0x8d24('0x4b')][_0x8d24('0x3f')]){case _0x8d24('0x4e'):_0x2678ae[_0x8d24('0x3f')]=db['Sequelize'][_0x8d24('0x4d')];break;case _0x8d24('0x4f'):_0x2678ae[_0x8d24('0x3f')]=db['Sequelize'][_0x8d24('0x50')];break;case _0x8d24('0x51'):_0x2678ae[_0x8d24('0x3f')]=db['Sequelize'][_0x8d24('0x52')];_0x2678ae[_0x8d24('0x53')]=![];break;default:}return db[_0x8d24('0x54')][_0x8d24('0x55')][_0x8d24('0x56')](_0x8d24('0x57'),util[_0x8d24('0x58')]('cf_%d',_0x355141['id']),_0x2678ae);})[_0x8d24('0x25')](function(){return _0x355141;});})[_0x8d24('0x25')](respondWithResult(_0x1bf7d3,0xc9))[_0x8d24('0x45')](handleError(_0x1bf7d3,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 96f5a58..d03bda7 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 _0x7ffc=['request-promise','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields','lodash','util','api','bluebird'];(function(_0x2795a4,_0x2fe3d9){var _0x55367a=function(_0x5e6d49){while(--_0x5e6d49){_0x2795a4['push'](_0x2795a4['shift']());}};_0x55367a(++_0x2fe3d9);}(_0x7ffc,0xa1));var _0xc7ff=function(_0x21e0a9,_0x5edd42){_0x21e0a9=_0x21e0a9-0x0;var _0x2a12f5=_0x7ffc[_0x21e0a9];return _0x2a12f5;};'use strict';var _=require(_0xc7ff('0x0'));var util=require(_0xc7ff('0x1'));var logger=require('../../config/logger')(_0xc7ff('0x2'));var moment=require('moment');var BPromise=require(_0xc7ff('0x3'));var rp=require(_0xc7ff('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc7ff('0x5'));var config=require(_0xc7ff('0x6'));var attributes=require(_0xc7ff('0x7'));module['exports']=function(_0x38c2a1,_0x2a33ae){return _0x38c2a1[_0xc7ff('0x8')](_0xc7ff('0x9'),attributes,{'tableName':_0xc7ff('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b7=['exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x90b7,0x1e4));var _0x790b=function(_0xaf1a2f,_0xffd315){_0xaf1a2f=_0xaf1a2f-0x0;var _0x4fbe51=_0x90b7[_0xaf1a2f];return _0x4fbe51;};'use strict';var _=require(_0x790b('0x0'));var util=require(_0x790b('0x1'));var logger=require(_0x790b('0x2'))(_0x790b('0x3'));var moment=require(_0x790b('0x4'));var BPromise=require(_0x790b('0x5'));var rp=require(_0x790b('0x6'));var fs=require('fs');var path=require(_0x790b('0x7'));var rimraf=require(_0x790b('0x8'));var config=require(_0x790b('0x9'));var attributes=require(_0x790b('0xa'));module[_0x790b('0xb')]=function(_0x58a4b0,_0xbe13ef){return _0x58a4b0[_0x790b('0xc')](_0x790b('0xd'),attributes,{'tableName':_0x790b('0xe'),'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 4627e96..b6ae18b 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 _0x8bd1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment'];(function(_0x545d5e,_0x43bad1){var _0x1623bc=function(_0x5b1c47){while(--_0x5b1c47){_0x545d5e['push'](_0x545d5e['shift']());}};_0x1623bc(++_0x43bad1);}(_0x8bd1,0xfb));var _0x18bd=function(_0x113313,_0x139d6c){_0x113313=_0x113313-0x0;var _0x12c04d=_0x8bd1[_0x113313];return _0x12c04d;};'use strict';var _=require(_0x18bd('0x0'));var util=require('util');var moment=require(_0x18bd('0x1'));var BPromise=require(_0x18bd('0x2'));var rs=require(_0x18bd('0x3'));var fs=require('fs');var Redis=require(_0x18bd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x18bd('0x5'));var logger=require(_0x18bd('0x6'))(_0x18bd('0x7'));var config=require(_0x18bd('0x8'));var jayson=require(_0x18bd('0x9'));var client=jayson[_0x18bd('0xa')][_0x18bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17c440,_0x2796e6,_0x311c28){return new BPromise(function(_0x40fe71,_0x2071d7){return client['request'](_0x17c440,_0x311c28)[_0x18bd('0xc')](function(_0x5e36b6){logger[_0x18bd('0xd')](_0x18bd('0xe'),_0x2796e6,'request\x20sent');logger[_0x18bd('0xf')](_0x18bd('0x10'),_0x2796e6,_0x18bd('0x11'),JSON[_0x18bd('0x12')](_0x5e36b6));if(_0x5e36b6[_0x18bd('0x13')]){if(_0x5e36b6['error'][_0x18bd('0x14')]===0x1f4){logger[_0x18bd('0x13')](_0x18bd('0xe'),_0x2796e6,_0x5e36b6['error'][_0x18bd('0x15')]);return _0x2071d7(_0x5e36b6['error']['message']);}logger[_0x18bd('0x13')](_0x18bd('0xe'),_0x2796e6,_0x5e36b6[_0x18bd('0x13')]['message']);return _0x40fe71(_0x5e36b6[_0x18bd('0x13')]['message']);}else{logger[_0x18bd('0xd')]('CmCustomField,\x20%s,\x20%s',_0x2796e6,'request\x20sent');_0x40fe71(_0x5e36b6['result'][_0x18bd('0x15')]);}})[_0x18bd('0x16')](function(_0x68a8bf){logger[_0x18bd('0x13')](_0x18bd('0xe'),_0x2796e6,_0x68a8bf);_0x2071d7(_0x68a8bf);});});} \ No newline at end of file +var _0xf5a6=['then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xf5a6,0x7f));var _0x6f5a=function(_0x3eb0d2,_0x2e33e9){_0x3eb0d2=_0x3eb0d2-0x0;var _0x492ef2=_0xf5a6[_0x3eb0d2];return _0x492ef2;};'use strict';var _=require(_0x6f5a('0x0'));var util=require(_0x6f5a('0x1'));var moment=require('moment');var BPromise=require(_0x6f5a('0x2'));var rs=require(_0x6f5a('0x3'));var fs=require('fs');var Redis=require(_0x6f5a('0x4'));var db=require(_0x6f5a('0x5'))['db'];var utils=require(_0x6f5a('0x6'));var logger=require('../../config/logger')(_0x6f5a('0x7'));var config=require(_0x6f5a('0x8'));var jayson=require(_0x6f5a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c1e88,_0x38ea6c,_0x576a6c){return new BPromise(function(_0x52e279,_0x55a736){return client[_0x6f5a('0xa')](_0x4c1e88,_0x576a6c)[_0x6f5a('0xb')](function(_0x1e790c){logger['info'](_0x6f5a('0xc'),_0x38ea6c,'request\x20sent');logger[_0x6f5a('0xd')](_0x6f5a('0xe'),_0x38ea6c,_0x6f5a('0xf'),JSON[_0x6f5a('0x10')](_0x1e790c));if(_0x1e790c[_0x6f5a('0x11')]){if(_0x1e790c[_0x6f5a('0x11')][_0x6f5a('0x12')]===0x1f4){logger[_0x6f5a('0x11')](_0x6f5a('0xc'),_0x38ea6c,_0x1e790c[_0x6f5a('0x11')][_0x6f5a('0x13')]);return _0x55a736(_0x1e790c['error'][_0x6f5a('0x13')]);}logger['error'](_0x6f5a('0xc'),_0x38ea6c,_0x1e790c[_0x6f5a('0x11')]['message']);return _0x52e279(_0x1e790c[_0x6f5a('0x11')]['message']);}else{logger[_0x6f5a('0x14')](_0x6f5a('0xc'),_0x38ea6c,_0x6f5a('0xf'));_0x52e279(_0x1e790c[_0x6f5a('0x15')]['message']);}})[_0x6f5a('0x16')](function(_0x4da361){logger['error'](_0x6f5a('0xc'),_0x38ea6c,_0x4da361);_0x55a736(_0x4da361);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 6c0bbe7..ab232ad 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 _0xcb04=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4cb0('0x0'));var util=require(_0x4cb0('0x1'));var path=require(_0x4cb0('0x2'));var timeout=require(_0x4cb0('0x3'));var express=require(_0x4cb0('0x4'));var router=express[_0x4cb0('0x5')]();var fs_extra=require(_0x4cb0('0x6'));var auth=require(_0x4cb0('0x7'));var interaction=require(_0x4cb0('0x8'));var config=require(_0x4cb0('0x9'));var controller=require('./cmCustomField.controller');router[_0x4cb0('0xa')]('/',auth[_0x4cb0('0xb')](),controller[_0x4cb0('0xc')]);router[_0x4cb0('0xa')](_0x4cb0('0xd'),auth[_0x4cb0('0xb')](),controller[_0x4cb0('0xe')]);router[_0x4cb0('0xf')]('/',auth[_0x4cb0('0xb')](),controller[_0x4cb0('0x10')]);router[_0x4cb0('0x11')](_0x4cb0('0xd'),auth[_0x4cb0('0xb')](),controller[_0x4cb0('0x12')]);router[_0x4cb0('0x13')](_0x4cb0('0xd'),auth[_0x4cb0('0xb')](),controller[_0x4cb0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd072=['post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','show'];(function(_0x2e4fd9,_0xd04a69){var _0x2aa740=function(_0x461b1c){while(--_0x461b1c){_0x2e4fd9['push'](_0x2e4fd9['shift']());}};_0x2aa740(++_0xd04a69);}(_0xd072,0x132));var _0x2d07=function(_0x12be8c,_0x4febf3){_0x12be8c=_0x12be8c-0x0;var _0x21291c=_0xd072[_0x12be8c];return _0x21291c;};'use strict';var multer=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var path=require(_0x2d07('0x2'));var timeout=require(_0x2d07('0x3'));var express=require(_0x2d07('0x4'));var router=express[_0x2d07('0x5')]();var fs_extra=require(_0x2d07('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2d07('0x7'));var config=require(_0x2d07('0x8'));var controller=require(_0x2d07('0x9'));router[_0x2d07('0xa')]('/',auth[_0x2d07('0xb')](),controller['index']);router[_0x2d07('0xa')](_0x2d07('0xc'),auth[_0x2d07('0xb')](),controller[_0x2d07('0xd')]);router[_0x2d07('0xe')]('/',auth[_0x2d07('0xb')](),controller[_0x2d07('0xf')]);router['put'](_0x2d07('0xc'),auth[_0x2d07('0xb')](),controller[_0x2d07('0x10')]);router[_0x2d07('0x11')](_0x2d07('0xc'),auth[_0x2d07('0xb')](),controller[_0x2d07('0x12')]);module[_0x2d07('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index d8f6395..2bc5b80 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 _0xb359=['STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0x13c9e2,_0x6e2d4a){var _0x23caa4=function(_0x488843){while(--_0x488843){_0x13c9e2['push'](_0x13c9e2['shift']());}};_0x23caa4(++_0x6e2d4a);}(_0xb359,0xf1));var _0x9b35=function(_0x51fcb2,_0x2d26ea){_0x51fcb2=_0x51fcb2-0x0;var _0x116f15=_0xb359[_0x51fcb2];return _0x116f15;};'use strict';var moment=require('moment');var Sequelize=require(_0x9b35('0x0'));module[_0x9b35('0x1')]={'phone':{'type':Sequelize[_0x9b35('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9b35('0x3')],'defaultValue':moment()['format'](_0x9b35('0x4'))},'countbusyretry':{'type':Sequelize[_0x9b35('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9b35('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b35('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9b35('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x9b35('0x5')](0x2)[_0x9b35('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9b35('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9b35('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9b35('0x5')],'unique':_0x9b35('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x9b35('0x5')],'unique':_0x9b35('0x8')},'CampaignId':{'type':Sequelize[_0x9b35('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9b35('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b35('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9b35('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x9b35('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x0789=['STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x0789,0xa7));var _0x9078=function(_0x3fddf3,_0x34cfd6){_0x3fddf3=_0x3fddf3-0x0;var _0x44d4a3=_0x0789[_0x3fddf3];return _0x44d4a3;};'use strict';var moment=require(_0x9078('0x0'));var Sequelize=require(_0x9078('0x1'));module[_0x9078('0x2')]={'phone':{'type':Sequelize[_0x9078('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x9078('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9078('0x5')],'defaultValue':moment()['format'](_0x9078('0x6'))},'countbusyretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9078('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9078('0x5')]},'priority':{'type':Sequelize[_0x9078('0x7')](0x2)[_0x9078('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9078('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9078('0x7')],'unique':_0x9078('0x9')},'ListId':{'type':Sequelize[_0x9078('0x7')],'unique':_0x9078('0x9')},'UserId':{'type':Sequelize[_0x9078('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x9078('0x7')],'unique':_0x9078('0x9')},'CampaignId':{'type':Sequelize[_0x9078('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9078('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9078('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9078('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 53e17a2..440acd7 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 _0x038b=['limit','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','intersection','filters','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','format','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','isNumber','getOpenContacts','entity\x20not\x20found','getTimezones','push','utcOffset','timezones','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','status','json','offset','undefined'];(function(_0x32fec7,_0x54b86f){var _0x2a71ac=function(_0x4607dd){while(--_0x4607dd){_0x32fec7['push'](_0x32fec7['shift']());}};_0x2a71ac(++_0x54b86f);}(_0x038b,0x114));var _0xb038=function(_0x268c49,_0x343042){_0x268c49=_0x268c49-0x0;var _0x18e452=_0x038b[_0x268c49];return _0x18e452;};'use strict';var moment=require('moment');var _=require(_0xb038('0x0'));var qs=require(_0xb038('0x1'));var logger=require(_0xb038('0x2'))('api');var shared=require(_0xb038('0x3'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x23574d,_0x3d090b){_0x3d090b=_0x3d090b||0xc8;return function(_0x4a8a30){if(_0x4a8a30){return _0x23574d[_0xb038('0x4')](_0x3d090b)[_0xb038('0x5')](_0x4a8a30);}};}function respondWithFilteredResult(_0x4fe092,_0x54e1e7){return function(_0x2e3e64){if(_0x2e3e64){var _0x1b077a=typeof _0x54e1e7[_0xb038('0x6')]==='undefined'&&typeof _0x54e1e7['limit']===_0xb038('0x7');var _0x20c102=_0x2e3e64['count'];var _0x53bcc0=_0x1b077a?0x0:_0x54e1e7[_0xb038('0x6')];var _0x2d1ae5=_0x1b077a?_0x2e3e64['count']:_0x54e1e7[_0xb038('0x6')]+_0x54e1e7[_0xb038('0x8')];var _0x3fc2c1;if(_0x2d1ae5>=_0x20c102){_0x2d1ae5=_0x20c102;_0x3fc2c1=0xc8;}else{_0x3fc2c1=0xce;}_0x4fe092[_0xb038('0x4')](_0x3fc2c1);return _0x4fe092[_0xb038('0x9')](_0xb038('0xa'),_0x53bcc0+'-'+_0x2d1ae5+'/'+_0x20c102)[_0xb038('0x5')](_0x2e3e64);}return null;};}function saveUpdates(_0x439751,_0x16e4a3){return function(_0x57acd8){if(_0x57acd8){return _0x57acd8[_0xb038('0xb')](_0x439751)[_0xb038('0xc')](function(_0x1b9686){return _0x1b9686;});}return null;};}function handleEntityNotFound(_0x3cc717,_0x3a71a6){return function(_0x13acc7){if(!_0x13acc7){_0x3cc717[_0xb038('0xd')](0x194);}return _0x13acc7;};}function handleError(_0x535109,_0xe8aa7c){_0xe8aa7c=_0xe8aa7c||0x1f4;return function(_0x26e4f2){logger[_0xb038('0xe')](_0x26e4f2[_0xb038('0xf')]);if(_0x26e4f2[_0xb038('0x10')]){delete _0x26e4f2[_0xb038('0x10')];}_0x535109['status'](_0xe8aa7c)[_0xb038('0x11')](_0x26e4f2);};}exports[_0xb038('0x12')]=function(_0xd1fae0,_0x3b095a){var _0x4aa892={},_0x49b237={},_0x20cea2={'count':0x0,'rows':[]};var _0x3f48e6=_[_0xb038('0x13')](db[_0xb038('0x14')]['rawAttributes'],function(_0x222b84){return{'name':_0x222b84[_0xb038('0x15')],'type':_0x222b84[_0xb038('0x16')][_0xb038('0x17')]};});_0x49b237[_0xb038('0x18')]=_['map'](_0x3f48e6,_0xb038('0x10'));_0x49b237[_0xb038('0x19')]=_[_0xb038('0x1a')](_0xd1fae0[_0xb038('0x19')]);_0x49b237['filters']=_[_0xb038('0x1b')](_0x49b237[_0xb038('0x18')],_0x49b237['query']);_0x49b237[_0xb038('0x1c')]=_[_0xb038('0x1d')](_0x49b237['filters'],[_0xb038('0x1e'),'$or',_0xb038('0x1f'),_0xb038('0x20'),_0xb038('0x21'),_0xb038('0x22'),_0xb038('0x23'),_0xb038('0x24'),_0xb038('0x25'),'$between',_0xb038('0x26'),_0xb038('0x27'),_0xb038('0x28'),'$like',_0xb038('0x29'),_0xb038('0x2a'),_0xb038('0x2b'),'$like',_0xb038('0x2c'),_0xb038('0x2d'),_0xb038('0x2e'),_0xb038('0x2f')]);_0x4aa892[_0xb038('0x30')]=_['intersection'](_0x49b237[_0xb038('0x18')],qs[_0xb038('0x31')](_0xd1fae0[_0xb038('0x19')][_0xb038('0x31')]));_0x4aa892[_0xb038('0x30')]=_0x4aa892[_0xb038('0x30')][_0xb038('0x32')]?_0x4aa892[_0xb038('0x30')]:_0x49b237[_0xb038('0x18')];if(!_0xd1fae0[_0xb038('0x19')][_0xb038('0x33')](_0xb038('0x34'))){_0x4aa892[_0xb038('0x8')]=qs['limit'](_0xd1fae0[_0xb038('0x19')]['limit']);_0x4aa892[_0xb038('0x6')]=qs[_0xb038('0x6')](_0xd1fae0[_0xb038('0x19')][_0xb038('0x6')]);}_0x4aa892[_0xb038('0x35')]=qs[_0xb038('0x36')](_0xd1fae0[_0xb038('0x19')][_0xb038('0x36')]);_0x4aa892[_0xb038('0x37')]=qs[_0xb038('0x1c')](_['pick'](_0xd1fae0[_0xb038('0x19')],_0x49b237[_0xb038('0x1c')]),_0x3f48e6);if(_0xd1fae0[_0xb038('0x19')]['filter']){_0x4aa892['where']=_['merge'](_0x4aa892[_0xb038('0x37')],{'$or':_[_0xb038('0x13')](_0x3f48e6,function(_0x30677e){if(_0x30677e[_0xb038('0x16')]!==_0xb038('0x38')){var _0x268f1b={};_0x268f1b[_0x30677e['name']]={'$like':'%'+_0xd1fae0[_0xb038('0x19')][_0xb038('0x39')]+'%'};return _0x268f1b;}})});}_0x4aa892=_[_0xb038('0x3a')]({},_0x4aa892,_0xd1fae0[_0xb038('0x3b')]);var _0x48e70b={'where':_0x4aa892[_0xb038('0x37')]};return db[_0xb038('0x14')]['count'](_0x48e70b)['then'](function(_0x26c769){_0x20cea2[_0xb038('0x3c')]=_0x26c769;if(_0xd1fae0[_0xb038('0x19')][_0xb038('0x3d')]){_0x4aa892[_0xb038('0x3e')]=[{'all':!![]}];}return db['CmHopper'][_0xb038('0x3f')](_0x4aa892);})[_0xb038('0xc')](function(_0x26d48c){_0x20cea2[_0xb038('0x40')]=_0x26d48c;return _0x20cea2;})['then'](respondWithFilteredResult(_0x3b095a,_0x4aa892))[_0xb038('0x41')](handleError(_0x3b095a,null));};exports[_0xb038('0x42')]=function(_0x7d2f79,_0x573426){var _0x412d71={'raw':!![],'where':{'id':_0x7d2f79[_0xb038('0x43')]['id']}},_0x594c0d={};_0x594c0d[_0xb038('0x18')]=_[_0xb038('0x1a')](db['CmHopper'][_0xb038('0x44')]);_0x594c0d[_0xb038('0x19')]=_[_0xb038('0x1a')](_0x7d2f79['query']);_0x594c0d[_0xb038('0x1c')]=_[_0xb038('0x1b')](_0x594c0d[_0xb038('0x18')],_0x594c0d[_0xb038('0x19')]);_0x412d71['attributes']=_[_0xb038('0x1b')](_0x594c0d[_0xb038('0x18')],qs[_0xb038('0x31')](_0x7d2f79[_0xb038('0x19')]['fields']));_0x412d71[_0xb038('0x30')]=_0x412d71[_0xb038('0x30')]['length']?_0x412d71[_0xb038('0x30')]:_0x594c0d[_0xb038('0x18')];if(_0x7d2f79[_0xb038('0x19')]['includeAll']){_0x412d71[_0xb038('0x3e')]=[{'all':!![]}];}_0x412d71=_[_0xb038('0x3a')]({},_0x412d71,_0x7d2f79['options']);return db['CmHopper'][_0xb038('0x45')](_0x412d71)[_0xb038('0xc')](handleEntityNotFound(_0x573426,null))[_0xb038('0xc')](respondWithResult(_0x573426,null))[_0xb038('0x41')](handleError(_0x573426,null));};exports[_0xb038('0x46')]=function(_0x36e48c,_0x630aef){return db[_0xb038('0x14')]['create'](_0x36e48c['body'],{})['then'](respondWithResult(_0x630aef,0xc9))[_0xb038('0x41')](handleError(_0x630aef,null));};exports[_0xb038('0xb')]=function(_0x52f0b8,_0x46a724){if(_0x52f0b8[_0xb038('0x47')]['id']){delete _0x52f0b8[_0xb038('0x47')]['id'];}return db['CmHopper'][_0xb038('0x45')]({'where':{'id':_0x52f0b8['params']['id']}})['then'](handleEntityNotFound(_0x46a724,null))[_0xb038('0xc')](saveUpdates(_0x52f0b8[_0xb038('0x47')],null))[_0xb038('0xc')](respondWithResult(_0x46a724,null))[_0xb038('0x41')](handleError(_0x46a724,null));};exports[_0xb038('0x48')]=function(_0x3b09e3,_0x2f053a){return db[_0xb038('0x14')][_0xb038('0x48')]()[_0xb038('0xc')](respondWithResult(_0x2f053a,null))['catch'](handleError(_0x2f053a,null));};exports[_0xb038('0x49')]=function(_0x3ed968,_0x5c11d7){var _0x906c9c;var _0x19ab72=_0x3ed968['params']['id'];return db[_0xb038('0x14')][_0xb038('0x45')]({'where':{'id':_0x3ed968[_0xb038('0x43')]['id']}})[_0xb038('0xc')](handleEntityNotFound(_0x5c11d7,null))[_0xb038('0xc')](function(_0x45a1b5){if(_0x45a1b5){return _0x45a1b5[_0xb038('0x49')]()[_0xb038('0xc')](function(_0x3a291d){return _0x3a291d;});}})['then'](function(_0x62daba){_0x906c9c=_0x62daba;if(_0x62daba){if(_0x62daba[_0xb038('0x4a')]||_0x62daba[_0xb038('0x4b')]){return db[_0x62daba[_0xb038('0x4a')]?_0xb038('0x4c'):_0xb038('0x4d')]['find']({'where':{'id':_0x62daba[_0xb038('0x4a')]?_0x62daba[_0xb038('0x4a')]:_0x62daba[_0xb038('0x4b')]},'attributes':['id',_0xb038('0x10')],'raw':!![]});}}})[_0xb038('0xc')](function(_0x24198c){var _0xd7a862={};if(_0x24198c){_['merge'](_0xd7a862,_[_0xb038('0x4e')](_0x906c9c['dataValues'],[_0xb038('0x4f'),_0xb038('0x50'),'id']));_0xd7a862[_0xb038('0x51')]=0x15;_0xd7a862[_0xb038('0x52')]=_0xb038('0x53');_0xd7a862['campaign']=_0x24198c['name'];_0xd7a862['membername']=_0x3ed968[_0xb038('0x54')][_0xb038('0x10')];_0xd7a862[_0xb038('0x55')]=_0x3ed968[_0xb038('0x54')]['id'];_0xd7a862[_0xb038('0x53')]=!![];_0xd7a862[_0xb038('0x56')]=moment()['format'](_0xb038('0x57'));_0xd7a862[_0xb038('0x58')]=_0x906c9c['phone'];_0xd7a862['campaigntype']=_0x906c9c[_0xb038('0x4a')]?'queue':_0xb038('0x59');return db['CmContact'][_0xb038('0x45')]({'where':{'id':_0xd7a862[_0xb038('0x5a')]},'attributes':[_0xb038('0x5b'),_0xb038('0x5c')]})['then'](function(_0x32aea0){if(!_[_0xb038('0x5d')](_0x5c11d7)&&!_[_0xb038('0x5d')](_0x32aea0[_0xb038('0x5b')])){_0xd7a862[_0xb038('0x5e')]=_0x32aea0[_0xb038('0x5b')];if(!_[_0xb038('0x5d')](_0x32aea0[_0xb038('0x5c')])){_0xd7a862[_0xb038('0x5e')]+='\x20'+_0x32aea0[_0xb038('0x5c')];}}})[_0xb038('0x5f')](function(){return db[_0xb038('0x60')]['create'](_0xd7a862);});}})[_0xb038('0xc')](function(_0x2fc38d){return db[_0xb038('0x61')][_0xb038('0x49')]({'where':{'CmHopperId':_0x19ab72}});})[_0xb038('0xc')](function(){return _0x5c11d7['status'](0xcc)[_0xb038('0x62')]();})['catch'](handleError(_0x5c11d7,null));};exports[_0xb038('0x63')]=function(_0x170a7e,_0x47e809){var _0x15d61c=[];return db[_0xb038('0x64')][_0xb038('0x48')]()[_0xb038('0xc')](function(_0x120cc7){_0x15d61c=_[_0xb038('0x1a')](_0x120cc7);return _0x170a7e[_0xb038('0x54')][_0xb038('0x65')]({'where':{'type':_0xb038('0x66'),'dialActive':!![],'dialMethod':_0xb038('0x67')},'attributes':['id','dialOrderByScheduledAt',_0xb038('0x68')],'raw':!![]});})['then'](function(_0x189894){if(_0x189894&&_0x189894[_0xb038('0x32')]){return db[_0xb038('0x69')][_0xb038('0x6a')](function(_0x1f5f3f){var _0x23fb92={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb038('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x189894,'id')},'$or':[{'UserId':null},{'UserId':_0x170a7e[_0xb038('0x54')]['id']}]};var _0x3a7310={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x189894)[_0xb038('0x39')](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0xb038('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x170a7e['user']['id']}]};var _0x35da9e={'$or':[_0x23fb92,_0x3a7310]};var _0x50e078=[];if(_0x170a7e[_0xb038('0x47')]['direction']&&_0x170a7e[_0xb038('0x47')][_0xb038('0x6d')]===_0xb038('0x6e')){if(!_[_0xb038('0x6f')](_0x170a7e[_0xb038('0x47')][_0xb038('0x70')])){_0x35da9e['id']={'$in':_0x170a7e['body']['hopperIds']};}_0x50e078=[[_0xb038('0x71'),'ASC'],[_0xb038('0x72'),_0x189894[0x0][_0xb038('0x73')]===_0xb038('0x74')?'DESC':_0xb038('0x74')],db['sequelize'][_0xb038('0x75')](_0xb038('0x76')),['id',_0xb038('0x77')]];}else{if(!_[_0xb038('0x6f')](_0x170a7e[_0xb038('0x47')][_0xb038('0x70')])){_0x35da9e['id']={'$notIn':_0x170a7e[_0xb038('0x47')][_0xb038('0x70')]};}_0x50e078=[[_0xb038('0x71'),'DESC'],['scheduledAt',_0x189894[0x0]['dialOrderByScheduledAt']],db[_0xb038('0x69')]['literal'](_0xb038('0x78')),['id','ASC']];}return db[_0xb038('0x14')][_0xb038('0x79')]({'attributes':['id',_0xb038('0x7a'),_0xb038('0x7b'),_0xb038('0x7c')],'where':_0x35da9e,'order':_0x50e078,'transaction':_0x1f5f3f,'lock':_0x1f5f3f[_0xb038('0x7d')][_0xb038('0x7e')],'include':[{'model':db[_0xb038('0x64')],'as':_0xb038('0x7f'),'attributes':_0x15d61c,'include':[{'model':db[_0xb038('0x80')],'as':_0xb038('0x81'),'attributes':['id',_0xb038('0x10')]}]},{'model':db[_0xb038('0x82')],'as':_0xb038('0x83'),'attributes':['id',_0xb038('0x10')]},{'model':db[_0xb038('0x4c')],'as':_0xb038('0x84'),'attributes':['id',_0xb038('0x10'),_0xb038('0x85')]}]})['then'](function(_0x23adc3){if(_0x23adc3){return _0x23adc3[_0xb038('0xb')]({'UserId':_0x170a7e[_0xb038('0x54')]['id']},{'transaction':_0x1f5f3f});}});});}})[_0xb038('0xc')](handleEntityNotFound(_0x47e809,null))[_0xb038('0xc')](respondWithResult(_0x47e809,null))['catch'](handleError(_0x47e809,null));};exports[_0xb038('0x86')]=function(_0x1489a1,_0x297b75,_0x80d720){var _0x34e222=[];var _0x468b41=_0x1489a1[_0xb038('0x43')]['id'];var _0x2d0313=_0x1489a1[_0xb038('0x54')]['id'];return db['CmContact']['describe']()[_0xb038('0xc')](function(_0x496f1e){_0x34e222=_[_0xb038('0x1a')](_0x496f1e);return db['sequelize']['transaction'](function(_0x4aeb6b){const _0x43c4b7={'id':_0x468b41};return db[_0xb038('0x14')]['findOne']({'attributes':['id',_0xb038('0x7a'),_0xb038('0x7c')],'where':_0x43c4b7,'transaction':_0x4aeb6b,'lock':_0x4aeb6b[_0xb038('0x7d')][_0xb038('0x7e')],'include':[{'model':db[_0xb038('0x64')],'as':_0xb038('0x7f'),'attributes':_0x34e222,'include':[{'model':db[_0xb038('0x80')],'as':_0xb038('0x81'),'attributes':['id',_0xb038('0x10')]}]},{'model':db[_0xb038('0x82')],'as':'List','attributes':['id',_0xb038('0x10')]},{'model':db[_0xb038('0x4c')],'as':_0xb038('0x84'),'attributes':['id',_0xb038('0x10'),_0xb038('0x85')]}]})[_0xb038('0xc')](function(_0x425854){if(_0x425854){return _0x425854['update']({'UserId':_0x2d0313},{'transaction':_0x4aeb6b});}});});})[_0xb038('0xc')](handleEntityNotFound(_0x297b75,null))[_0xb038('0xc')](respondWithResult(_0x297b75,null))[_0xb038('0x41')](handleError(_0x297b75,null));};exports['getOpenContacts']=function(_0x551fcc,_0x2adf3b){return _0x551fcc[_0xb038('0x54')][_0xb038('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xb038('0x67')},'attributes':['id'],'raw':!![]})[_0xb038('0xc')](function(_0x5b003a){if(_0x5b003a&&_0x5b003a[_0xb038('0x32')]){return db[_0xb038('0x14')][_0xb038('0x3c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xb038('0x6b')](_0xb038('0x57'))},'VoiceQueueId':{'$in':_[_0xb038('0x13')](_0x5b003a,'id')},'$or':[{'UserId':null},{'UserId':_0x551fcc[_0xb038('0x54')]['id']}]}});}return 0x0;})[_0xb038('0xc')](function(_0x27a14a){if(!_[_0xb038('0x5d')](_0x27a14a)&&_[_0xb038('0x87')](_0x27a14a)){return _0x2adf3b[_0xb038('0x4')](0xc8)[_0xb038('0x5')]({'contacts':_0x27a14a});}else{logger[_0xb038('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xb038('0x88'),0x194,_0xb038('0x89'));_0x2adf3b[_0xb038('0xd')](0x194);}})[_0xb038('0x41')](handleError(_0x2adf3b,null));};exports[_0xb038('0x8a')]=function(_0x1df908,_0x3ce0a2){var _0xf9caa5=shared['timezones'];var _0x3e29d2=[];_[_0xb038('0x13')](_0xf9caa5,function(_0x4d7537){_0x3e29d2[_0xb038('0x8b')]({'id':_0x4d7537['name'],'name':_0x4d7537['name'],'utcOffset':_0x4d7537[_0xb038('0x8c')]});});return _0x3ce0a2['status'](0xc8)[_0xb038('0x5')]({'tz':_0x3e29d2});};exports['getTimezone']=function(_0x3493da,_0x1d15df){var _0x231ba1=shared[_0xb038('0x8d')];var _0x367475={};if(!_[_0xb038('0x5d')](_0x231ba1[_0x3493da[_0xb038('0x47')]['id']]))_0x367475=_0x231ba1[_0x3493da[_0xb038('0x47')]['id']];return _0x1d15df['status'](0xc8)['json'](_0x367475);}; \ No newline at end of file +var _0x9c5a=['UserId','user','deleted','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','getPreviewRecall','getOpenContacts','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','moment','lodash','../../config/logger','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','update','sendStatus','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','model','keys','query','filters','intersection','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','length','find','create','body','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','omit','updatedAt','statedesc','campaign','membername'];(function(_0x3fec46,_0x2f5d60){var _0x4c779=function(_0x476f1d){while(--_0x476f1d){_0x3fec46['push'](_0x3fec46['shift']());}};_0x4c779(++_0x2f5d60);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x578b4d,_0x336e39){_0x578b4d=_0x578b4d-0x0;var _0x41c5c1=_0x9c5a[_0x578b4d];return _0x41c5c1;};'use strict';var moment=require(_0xa9c5('0x0'));var _=require(_0xa9c5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xa9c5('0x2'))(_0xa9c5('0x3'));var shared=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];function respondWithResult(_0x4f5552,_0x2acfaf){_0x2acfaf=_0x2acfaf||0xc8;return function(_0x3051b1){if(_0x3051b1){return _0x4f5552['status'](_0x2acfaf)[_0xa9c5('0x6')](_0x3051b1);}};}function respondWithFilteredResult(_0x4d9c7a,_0x394d84){return function(_0x3df556){if(_0x3df556){var _0x4cb597=typeof _0x394d84['offset']===_0xa9c5('0x7')&&typeof _0x394d84[_0xa9c5('0x8')]==='undefined';var _0x2e2b3e=_0x3df556[_0xa9c5('0x9')];var _0x51c14c=_0x4cb597?0x0:_0x394d84[_0xa9c5('0xa')];var _0x40a79d=_0x4cb597?_0x3df556['count']:_0x394d84['offset']+_0x394d84[_0xa9c5('0x8')];var _0x11421c;if(_0x40a79d>=_0x2e2b3e){_0x40a79d=_0x2e2b3e;_0x11421c=0xc8;}else{_0x11421c=0xce;}_0x4d9c7a[_0xa9c5('0xb')](_0x11421c);return _0x4d9c7a[_0xa9c5('0xc')](_0xa9c5('0xd'),_0x51c14c+'-'+_0x40a79d+'/'+_0x2e2b3e)[_0xa9c5('0x6')](_0x3df556);}return null;};}function saveUpdates(_0x51c8d,_0x42d5cf){return function(_0x3c5ac7){if(_0x3c5ac7){return _0x3c5ac7[_0xa9c5('0xe')](_0x51c8d)['then'](function(_0x390ca2){return _0x390ca2;});}return null;};}function handleEntityNotFound(_0x1276d2,_0x7df76d){return function(_0x3806c4){if(!_0x3806c4){_0x1276d2[_0xa9c5('0xf')](0x194);}return _0x3806c4;};}function handleError(_0x1dad66,_0x251099){_0x251099=_0x251099||0x1f4;return function(_0x40b001){logger[_0xa9c5('0x10')](_0x40b001[_0xa9c5('0x11')]);if(_0x40b001['name']){delete _0x40b001[_0xa9c5('0x12')];}_0x1dad66[_0xa9c5('0xb')](_0x251099)[_0xa9c5('0x13')](_0x40b001);};}exports['index']=function(_0x2cda1b,_0x1142d9){var _0x2b9ac5={},_0x3b8cf7={},_0x452a9b={'count':0x0,'rows':[]};var _0x349f27=_[_0xa9c5('0x14')](db[_0xa9c5('0x15')][_0xa9c5('0x16')],function(_0x36c486){return{'name':_0x36c486[_0xa9c5('0x17')],'type':_0x36c486[_0xa9c5('0x18')]['key']};});_0x3b8cf7[_0xa9c5('0x19')]=_[_0xa9c5('0x14')](_0x349f27,'name');_0x3b8cf7['query']=_[_0xa9c5('0x1a')](_0x2cda1b[_0xa9c5('0x1b')]);_0x3b8cf7[_0xa9c5('0x1c')]=_[_0xa9c5('0x1d')](_0x3b8cf7[_0xa9c5('0x19')],_0x3b8cf7[_0xa9c5('0x1b')]);_0x3b8cf7['filters']=_['concat'](_0x3b8cf7[_0xa9c5('0x1c')],[_0xa9c5('0x1e'),'$or',_0xa9c5('0x1f'),_0xa9c5('0x20'),_0xa9c5('0x21'),_0xa9c5('0x22'),_0xa9c5('0x23'),_0xa9c5('0x24'),_0xa9c5('0x25'),'$between','$notBetween',_0xa9c5('0x26'),'$notIn',_0xa9c5('0x27'),_0xa9c5('0x28'),'$iLike',_0xa9c5('0x29'),_0xa9c5('0x27'),'$overlap',_0xa9c5('0x2a'),_0xa9c5('0x2b'),_0xa9c5('0x2c')]);_0x2b9ac5[_0xa9c5('0x2d')]=_[_0xa9c5('0x1d')](_0x3b8cf7['model'],qs[_0xa9c5('0x2e')](_0x2cda1b['query'][_0xa9c5('0x2e')]));_0x2b9ac5[_0xa9c5('0x2d')]=_0x2b9ac5[_0xa9c5('0x2d')]['length']?_0x2b9ac5[_0xa9c5('0x2d')]:_0x3b8cf7[_0xa9c5('0x19')];if(!_0x2cda1b['query'][_0xa9c5('0x2f')](_0xa9c5('0x30'))){_0x2b9ac5[_0xa9c5('0x8')]=qs[_0xa9c5('0x8')](_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x8')]);_0x2b9ac5[_0xa9c5('0xa')]=qs['offset'](_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0xa')]);}_0x2b9ac5[_0xa9c5('0x31')]=qs[_0xa9c5('0x32')](_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x32')]);_0x2b9ac5[_0xa9c5('0x33')]=qs[_0xa9c5('0x1c')](_['pick'](_0x2cda1b['query'],_0x3b8cf7[_0xa9c5('0x1c')]),_0x349f27);if(_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x34')]){_0x2b9ac5[_0xa9c5('0x33')]=_[_0xa9c5('0x35')](_0x2b9ac5[_0xa9c5('0x33')],{'$or':_['map'](_0x349f27,function(_0x598920){if(_0x598920['type']!==_0xa9c5('0x36')){var _0x27d614={};_0x27d614[_0x598920['name']]={'$like':'%'+_0x2cda1b[_0xa9c5('0x1b')]['filter']+'%'};return _0x27d614;}})});}_0x2b9ac5=_[_0xa9c5('0x35')]({},_0x2b9ac5,_0x2cda1b[_0xa9c5('0x37')]);var _0x2567be={'where':_0x2b9ac5[_0xa9c5('0x33')]};return db['CmHopper'][_0xa9c5('0x9')](_0x2567be)[_0xa9c5('0x38')](function(_0x191153){_0x452a9b[_0xa9c5('0x9')]=_0x191153;if(_0x2cda1b[_0xa9c5('0x1b')][_0xa9c5('0x39')]){_0x2b9ac5[_0xa9c5('0x3a')]=[{'all':!![]}];}return db[_0xa9c5('0x15')]['findAll'](_0x2b9ac5);})[_0xa9c5('0x38')](function(_0x46e5d2){_0x452a9b[_0xa9c5('0x3b')]=_0x46e5d2;return _0x452a9b;})[_0xa9c5('0x38')](respondWithFilteredResult(_0x1142d9,_0x2b9ac5))[_0xa9c5('0x3c')](handleError(_0x1142d9,null));};exports[_0xa9c5('0x3d')]=function(_0x493b20,_0x307736){var _0x5b7a0a={'raw':!![],'where':{'id':_0x493b20['params']['id']}},_0x2fa3e3={};_0x2fa3e3[_0xa9c5('0x19')]=_[_0xa9c5('0x1a')](db[_0xa9c5('0x15')]['rawAttributes']);_0x2fa3e3[_0xa9c5('0x1b')]=_[_0xa9c5('0x1a')](_0x493b20[_0xa9c5('0x1b')]);_0x2fa3e3[_0xa9c5('0x1c')]=_['intersection'](_0x2fa3e3[_0xa9c5('0x19')],_0x2fa3e3[_0xa9c5('0x1b')]);_0x5b7a0a[_0xa9c5('0x2d')]=_[_0xa9c5('0x1d')](_0x2fa3e3[_0xa9c5('0x19')],qs['fields'](_0x493b20[_0xa9c5('0x1b')]['fields']));_0x5b7a0a[_0xa9c5('0x2d')]=_0x5b7a0a[_0xa9c5('0x2d')][_0xa9c5('0x3e')]?_0x5b7a0a[_0xa9c5('0x2d')]:_0x2fa3e3[_0xa9c5('0x19')];if(_0x493b20[_0xa9c5('0x1b')][_0xa9c5('0x39')]){_0x5b7a0a[_0xa9c5('0x3a')]=[{'all':!![]}];}_0x5b7a0a=_[_0xa9c5('0x35')]({},_0x5b7a0a,_0x493b20[_0xa9c5('0x37')]);return db['CmHopper'][_0xa9c5('0x3f')](_0x5b7a0a)[_0xa9c5('0x38')](handleEntityNotFound(_0x307736,null))[_0xa9c5('0x38')](respondWithResult(_0x307736,null))[_0xa9c5('0x3c')](handleError(_0x307736,null));};exports[_0xa9c5('0x40')]=function(_0x3794d2,_0x583ec9){return db[_0xa9c5('0x15')][_0xa9c5('0x40')](_0x3794d2['body'],{})['then'](respondWithResult(_0x583ec9,0xc9))['catch'](handleError(_0x583ec9,null));};exports['update']=function(_0x4e97bf,_0x160020){if(_0x4e97bf[_0xa9c5('0x41')]['id']){delete _0x4e97bf[_0xa9c5('0x41')]['id'];}return db[_0xa9c5('0x15')][_0xa9c5('0x3f')]({'where':{'id':_0x4e97bf[_0xa9c5('0x42')]['id']}})[_0xa9c5('0x38')](handleEntityNotFound(_0x160020,null))[_0xa9c5('0x38')](saveUpdates(_0x4e97bf[_0xa9c5('0x41')],null))[_0xa9c5('0x38')](respondWithResult(_0x160020,null))[_0xa9c5('0x3c')](handleError(_0x160020,null));};exports[_0xa9c5('0x43')]=function(_0x1c2ccf,_0x4bf8b4){return db[_0xa9c5('0x15')]['describe']()[_0xa9c5('0x38')](respondWithResult(_0x4bf8b4,null))[_0xa9c5('0x3c')](handleError(_0x4bf8b4,null));};exports['destroy']=function(_0x5cbd33,_0xf00970){var _0x32e64a;var _0xeb0720=_0x5cbd33['params']['id'];return db['CmHopper'][_0xa9c5('0x3f')]({'where':{'id':_0x5cbd33[_0xa9c5('0x42')]['id']}})['then'](handleEntityNotFound(_0xf00970,null))[_0xa9c5('0x38')](function(_0x2c095f){if(_0x2c095f){return _0x2c095f[_0xa9c5('0x44')]()[_0xa9c5('0x38')](function(_0x34020f){return _0x34020f;});}})[_0xa9c5('0x38')](function(_0x4b6fc9){_0x32e64a=_0x4b6fc9;if(_0x4b6fc9){if(_0x4b6fc9['VoiceQueueId']||_0x4b6fc9['CampaignId']){return db[_0x4b6fc9[_0xa9c5('0x45')]?_0xa9c5('0x46'):_0xa9c5('0x47')][_0xa9c5('0x3f')]({'where':{'id':_0x4b6fc9[_0xa9c5('0x45')]?_0x4b6fc9[_0xa9c5('0x45')]:_0x4b6fc9['CampaignId']},'attributes':['id',_0xa9c5('0x12')],'raw':!![]});}}})[_0xa9c5('0x38')](function(_0x433a58){var _0x2bdc77={};if(_0x433a58){_[_0xa9c5('0x35')](_0x2bdc77,_[_0xa9c5('0x48')](_0x32e64a['dataValues'],['createdAt',_0xa9c5('0x49'),'id']));_0x2bdc77['state']=0x15;_0x2bdc77[_0xa9c5('0x4a')]='deleted';_0x2bdc77[_0xa9c5('0x4b')]=_0x433a58[_0xa9c5('0x12')];_0x2bdc77[_0xa9c5('0x4c')]=_0x5cbd33['user'][_0xa9c5('0x12')];_0x2bdc77[_0xa9c5('0x4d')]=_0x5cbd33[_0xa9c5('0x4e')]['id'];_0x2bdc77[_0xa9c5('0x4f')]=!![];_0x2bdc77['deletedat']=moment()['format'](_0xa9c5('0x50'));_0x2bdc77[_0xa9c5('0x51')]=_0x32e64a[_0xa9c5('0x52')];_0x2bdc77['campaigntype']=_0x32e64a[_0xa9c5('0x45')]?_0xa9c5('0x53'):_0xa9c5('0x54');return db[_0xa9c5('0x55')][_0xa9c5('0x3f')]({'where':{'id':_0x2bdc77[_0xa9c5('0x56')]},'attributes':[_0xa9c5('0x57'),_0xa9c5('0x58')]})['then'](function(_0x41f528){if(!_['isNil'](_0xf00970)&&!_[_0xa9c5('0x59')](_0x41f528[_0xa9c5('0x57')])){_0x2bdc77[_0xa9c5('0x5a')]=_0x41f528['firstName'];if(!_[_0xa9c5('0x59')](_0x41f528[_0xa9c5('0x58')])){_0x2bdc77['calleridname']+='\x20'+_0x41f528[_0xa9c5('0x58')];}}})[_0xa9c5('0x5b')](function(){return db[_0xa9c5('0x5c')][_0xa9c5('0x40')](_0x2bdc77);});}})['then'](function(_0x3505d3){return db[_0xa9c5('0x5d')][_0xa9c5('0x44')]({'where':{'CmHopperId':_0xeb0720}});})[_0xa9c5('0x38')](function(){return _0xf00970['status'](0xcc)['end']();})[_0xa9c5('0x3c')](handleError(_0xf00970,null));};exports[_0xa9c5('0x5e')]=function(_0x67c1f8,_0x1b676e){var _0x279a26=[];return db[_0xa9c5('0x55')]['describe']()[_0xa9c5('0x38')](function(_0x1e787e){_0x279a26=_[_0xa9c5('0x1a')](_0x1e787e);return _0x67c1f8[_0xa9c5('0x4e')][_0xa9c5('0x5f')]({'where':{'type':_0xa9c5('0x60'),'dialActive':!![],'dialMethod':_0xa9c5('0x61')},'attributes':['id',_0xa9c5('0x62'),_0xa9c5('0x63')],'raw':!![]});})[_0xa9c5('0x38')](function(_0x50d438){if(_0x50d438&&_0x50d438['length']){return db[_0xa9c5('0x64')][_0xa9c5('0x65')](function(_0x3322cc){var _0x47afaa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa9c5('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x50d438,'id')},'$or':[{'UserId':null},{'UserId':_0x67c1f8[_0xa9c5('0x4e')]['id']}]};var _0x28c0df={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x50d438)[_0xa9c5('0x34')]([_0xa9c5('0x63'),0x0])[_0xa9c5('0x14')]('id')[_0xa9c5('0x66')]()},'$or':[{'UserId':null},{'UserId':_0x67c1f8[_0xa9c5('0x4e')]['id']}]};var _0x3890b4={'$or':[_0x47afaa,_0x28c0df]};var _0x2f323e=[];if(_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x67')]&&_0x67c1f8[_0xa9c5('0x41')]['direction']===_0xa9c5('0x68')){if(!_[_0xa9c5('0x69')](_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x6a')])){_0x3890b4['id']={'$in':_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x6a')]};}_0x2f323e=[[_0xa9c5('0x6b'),'ASC'],['scheduledAt',_0x50d438[0x0][_0xa9c5('0x62')]==='ASC'?_0xa9c5('0x6c'):_0xa9c5('0x6d')],db['sequelize'][_0xa9c5('0x6e')](_0xa9c5('0x6f')),['id','DESC']];}else{if(!_['isEmpty'](_0x67c1f8[_0xa9c5('0x41')][_0xa9c5('0x6a')])){_0x3890b4['id']={'$notIn':_0x67c1f8[_0xa9c5('0x41')]['hopperIds']};}_0x2f323e=[['priority',_0xa9c5('0x6c')],[_0xa9c5('0x70'),_0x50d438[0x0]['dialOrderByScheduledAt']],db[_0xa9c5('0x64')][_0xa9c5('0x6e')](_0xa9c5('0x71')),['id',_0xa9c5('0x6d')]];}return db[_0xa9c5('0x15')][_0xa9c5('0x72')]({'attributes':['id','scheduledat',_0xa9c5('0x52'),_0xa9c5('0x73')],'where':_0x3890b4,'order':_0x2f323e,'transaction':_0x3322cc,'lock':_0x3322cc[_0xa9c5('0x74')][_0xa9c5('0x75')],'include':[{'model':db['CmContact'],'as':_0xa9c5('0x76'),'attributes':_0x279a26,'include':[{'model':db[_0xa9c5('0x77')],'as':'Company','attributes':['id',_0xa9c5('0x12')]}]},{'model':db[_0xa9c5('0x78')],'as':_0xa9c5('0x79'),'attributes':['id','name']},{'model':db[_0xa9c5('0x46')],'as':_0xa9c5('0x7a'),'attributes':['id',_0xa9c5('0x12'),_0xa9c5('0x7b')]}]})[_0xa9c5('0x38')](function(_0x4db621){if(_0x4db621){return _0x4db621[_0xa9c5('0xe')]({'UserId':_0x67c1f8['user']['id']},{'transaction':_0x3322cc});}});});}})[_0xa9c5('0x38')](handleEntityNotFound(_0x1b676e,null))[_0xa9c5('0x38')](respondWithResult(_0x1b676e,null))[_0xa9c5('0x3c')](handleError(_0x1b676e,null));};exports[_0xa9c5('0x7c')]=function(_0x427817,_0x42b1d7,_0x39fae1){var _0x390d0b=[];var _0x3f6114=_0x427817[_0xa9c5('0x42')]['id'];var _0x2f350e=_0x427817['user']['id'];return db[_0xa9c5('0x55')][_0xa9c5('0x43')]()['then'](function(_0x2a0a94){_0x390d0b=_[_0xa9c5('0x1a')](_0x2a0a94);return db[_0xa9c5('0x64')]['transaction'](function(_0x27bcc0){const _0x282f84={'id':_0x3f6114};return db[_0xa9c5('0x15')][_0xa9c5('0x72')]({'attributes':['id','scheduledat',_0xa9c5('0x73')],'where':_0x282f84,'transaction':_0x27bcc0,'lock':_0x27bcc0[_0xa9c5('0x74')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x390d0b,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':'List','attributes':['id',_0xa9c5('0x12')]},{'model':db[_0xa9c5('0x46')],'as':_0xa9c5('0x7a'),'attributes':['id',_0xa9c5('0x12'),_0xa9c5('0x7b')]}]})['then'](function(_0x4d7772){if(_0x4d7772){return _0x4d7772['update']({'UserId':_0x2f350e},{'transaction':_0x27bcc0});}});});})['then'](handleEntityNotFound(_0x42b1d7,null))[_0xa9c5('0x38')](respondWithResult(_0x42b1d7,null))[_0xa9c5('0x3c')](handleError(_0x42b1d7,null));};exports[_0xa9c5('0x7d')]=function(_0x2eda17,_0x5253e8){return _0x2eda17['user'][_0xa9c5('0x5f')]({'where':{'type':_0xa9c5('0x60'),'dialActive':!![],'dialMethod':_0xa9c5('0x61')},'attributes':['id'],'raw':!![]})[_0xa9c5('0x38')](function(_0x1d89ec){if(_0x1d89ec&&_0x1d89ec['length']){return db[_0xa9c5('0x15')][_0xa9c5('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa9c5('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xa9c5('0x14')](_0x1d89ec,'id')},'$or':[{'UserId':null},{'UserId':_0x2eda17[_0xa9c5('0x4e')]['id']}]}});}return 0x0;})[_0xa9c5('0x38')](function(_0x3dfef2){if(!_['isNil'](_0x3dfef2)&&_[_0xa9c5('0x7f')](_0x3dfef2)){return _0x5253e8[_0xa9c5('0xb')](0xc8)['json']({'contacts':_0x3dfef2});}else{logger['error'](_0xa9c5('0x80'),'getOpenContacts',0x194,'entity\x20not\x20found');_0x5253e8[_0xa9c5('0xf')](0x194);}})[_0xa9c5('0x3c')](handleError(_0x5253e8,null));};exports[_0xa9c5('0x81')]=function(_0x2f9757,_0x22661f){var _0x5bc433=shared[_0xa9c5('0x82')];var _0x4c04f7=[];_[_0xa9c5('0x14')](_0x5bc433,function(_0x2ff914){_0x4c04f7[_0xa9c5('0x83')]({'id':_0x2ff914[_0xa9c5('0x12')],'name':_0x2ff914['name'],'utcOffset':_0x2ff914['utcOffset']});});return _0x22661f[_0xa9c5('0xb')](0xc8)['json']({'tz':_0x4c04f7});};exports['getTimezone']=function(_0x38e2f,_0x370bbb){var _0x4cdf88=shared['timezones'];var _0x4335ff={};if(!_[_0xa9c5('0x59')](_0x4cdf88[_0x38e2f[_0xa9c5('0x41')]['id']]))_0x4335ff=_0x4cdf88[_0x38e2f[_0xa9c5('0x41')]['id']];return _0x370bbb['status'](0xc8)['json'](_0x4335ff);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index aa75a9d..a9af75b 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9536=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x9536,0x179));var _0x6953=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x9536[_0x493a51];return _0xc85756;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var logger=require(_0x6953('0x2'))(_0x6953('0x3'));var moment=require('moment');var BPromise=require(_0x6953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6953('0x5'));var rimraf=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var attributes=require(_0x6953('0x8'));module[_0x6953('0x9')]=function(_0x494ac2,_0x2b273e){return _0x494ac2[_0x6953('0xa')](_0x6953('0xb'),attributes,{'tableName':_0x6953('0xc'),'paranoid':![],'indexes':[{'name':_0x6953('0xd'),'fields':['scheduledat']},{'name':_0x6953('0xe'),'fields':[_0x6953('0xe')]},{'name':_0x6953('0xf'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2a110d,_0x43d2e8){var _0x282f9b=function(_0x1bfcf9){while(--_0x1bfcf9){_0x2a110d['push'](_0x2a110d['shift']());}};_0x282f9b(++_0x43d2e8);}(_0x2542,0x169));var _0x2254=function(_0x1a7d5b,_0xb8611a){_0x1a7d5b=_0x1a7d5b-0x0;var _0x42bc59=_0x2542[_0x1a7d5b];return _0x42bc59;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]},{'name':_0x2254('0xe'),'fields':[_0x2254('0xe')]},{'name':_0x2254('0xf'),'fields':[_0x2254('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4ad9b35..418afdf 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 _0x3a29=['Contact','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','List','NOW()','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','message','error','ShowCmHopper','find','stringify','body','CreateCmHopper','UpdateCmHopper','update','active','DestroyCmHopper','CmContact','describe','sequelize','transaction','UPDATE','keys','User','Agent','name','voicePause','includes','push','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','CmHopperFinal','create','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','LOCK','GetCmHopperPreview'];(function(_0x26dd03,_0x5c58a9){var _0x1721c4=function(_0x308ead){while(--_0x308ead){_0x26dd03['push'](_0x26dd03['shift']());}};_0x1721c4(++_0x5c58a9);}(_0x3a29,0xf8));var _0x93a2=function(_0x31658b,_0x39c760){_0x31658b=_0x31658b-0x0;var _0x489e93=_0x3a29[_0x31658b];return _0x489e93;};'use strict';var _=require('lodash');var util=require(_0x93a2('0x0'));var moment=require(_0x93a2('0x1'));var BPromise=require(_0x93a2('0x2'));var db=require(_0x93a2('0x3'))['db'];var logger=require('../../config/logger')(_0x93a2('0x4'));exports[_0x93a2('0x5')]=function(_0x39f1b5){var _0x27462a=this;return new Promise(function(_0xb8a52f,_0x1a44d7){return db[_0x93a2('0x6')][_0x93a2('0x7')]({'raw':_0x39f1b5['options']?_0x39f1b5[_0x93a2('0x8')][_0x93a2('0x9')]===undefined?!![]:![]:!![],'where':_0x39f1b5[_0x93a2('0x8')]?_0x39f1b5[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'attributes':_0x39f1b5[_0x93a2('0x8')]?_0x39f1b5['options']['attributes']||null:null,'limit':_0x39f1b5[_0x93a2('0x8')]?_0x39f1b5[_0x93a2('0x8')][_0x93a2('0xb')]||null:null,'include':_0x39f1b5[_0x93a2('0x8')]?_0x39f1b5[_0x93a2('0x8')][_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x39f1b5[_0x93a2('0x8')][_0x93a2('0xc')],function(_0x279c05){return{'model':db[_0x279c05[_0x93a2('0xe')]],'as':_0x279c05['as'],'attributes':_0x279c05[_0x93a2('0xf')],'include':_0x279c05[_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x279c05[_0x93a2('0xc')],function(_0x35d847){return{'model':db[_0x35d847[_0x93a2('0xe')]],'as':_0x35d847['as'],'attributes':_0x35d847[_0x93a2('0xf')],'include':_0x35d847[_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x35d847[_0x93a2('0xc')],function(_0x105b2a){return{'model':db[_0x105b2a[_0x93a2('0xe')]],'as':_0x105b2a['as'],'attributes':_0x105b2a[_0x93a2('0xf')]};}):[]};}):[]};}):[]:[]})[_0x93a2('0x10')](function(_0x3e49c0){logger[_0x93a2('0x11')]('GetCmHopper',_0x39f1b5);logger[_0x93a2('0x12')](_0x93a2('0x5'),_0x39f1b5,JSON['stringify'](_0x3e49c0));_0xb8a52f(_0x3e49c0);})[_0x93a2('0x13')](function(_0x40157b){logger['error'](_0x93a2('0x5'),_0x40157b[_0x93a2('0x14')],_0x39f1b5);_0x1a44d7(_0x27462a[_0x93a2('0x15')](0x1f4,_0x40157b[_0x93a2('0x14')]));});});};exports[_0x93a2('0x16')]=function(_0x401dd8){var _0x2c379e=this;return new Promise(function(_0x35ea18,_0x120636){return db['CmHopper'][_0x93a2('0x17')]({'raw':_0x401dd8[_0x93a2('0x8')]?_0x401dd8['options']['raw']===undefined?!![]:![]:!![],'where':_0x401dd8[_0x93a2('0x8')]?_0x401dd8[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'attributes':_0x401dd8[_0x93a2('0x8')]?_0x401dd8[_0x93a2('0x8')]['attributes']||null:null,'include':_0x401dd8[_0x93a2('0x8')]?_0x401dd8['options'][_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x401dd8[_0x93a2('0x8')][_0x93a2('0xc')],function(_0x4d7b21){return{'model':db[_0x4d7b21['model']],'as':_0x4d7b21['as'],'attributes':_0x4d7b21['attributes'],'include':_0x4d7b21[_0x93a2('0xc')]?_['map'](_0x4d7b21[_0x93a2('0xc')],function(_0x5dc368){return{'model':db[_0x5dc368[_0x93a2('0xe')]],'as':_0x5dc368['as'],'attributes':_0x5dc368[_0x93a2('0xf')],'include':_0x5dc368[_0x93a2('0xc')]?_['map'](_0x5dc368[_0x93a2('0xc')],function(_0x3e1202){return{'model':db[_0x3e1202[_0x93a2('0xe')]],'as':_0x3e1202['as'],'attributes':_0x3e1202['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e1267){logger[_0x93a2('0x11')](_0x93a2('0x16'),_0x401dd8);logger['debug']('ShowCmHopper',_0x401dd8,JSON[_0x93a2('0x18')](_0x2e1267));_0x35ea18(_0x2e1267);})[_0x93a2('0x13')](function(_0x409c25){logger[_0x93a2('0x15')]('ShowCmHopper',_0x409c25[_0x93a2('0x14')],_0x401dd8);_0x120636(_0x2c379e['error'](0x1f4,_0x409c25[_0x93a2('0x14')]));});});};exports['CreateCmHopper']=function(_0x16de0e){var _0x3e382a=this;return new Promise(function(_0x51e74a,_0x2a223d){return db['CmHopper']['create'](_0x16de0e[_0x93a2('0x19')],{'raw':_0x16de0e['options']?_0x16de0e['options']['raw']===undefined?!![]:![]:!![]})[_0x93a2('0x10')](function(_0x51ce6b){logger[_0x93a2('0x11')](_0x93a2('0x1a'),_0x16de0e);logger[_0x93a2('0x12')](_0x93a2('0x1a'),_0x16de0e,JSON[_0x93a2('0x18')](_0x51ce6b));_0x51e74a(_0x51ce6b);})[_0x93a2('0x13')](function(_0x4250f8){logger[_0x93a2('0x15')](_0x93a2('0x1a'),_0x4250f8[_0x93a2('0x14')],_0x16de0e);_0x2a223d(_0x3e382a[_0x93a2('0x15')](0x1f4,_0x4250f8[_0x93a2('0x14')]));});});};exports[_0x93a2('0x1b')]=function(_0x563364){var _0xee6be0=this;return new Promise(function(_0x35b638,_0x3b8580){return db['CmHopper'][_0x93a2('0x1c')](_0x563364['body'],{'raw':_0x563364['options']?_0x563364[_0x93a2('0x8')][_0x93a2('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x563364[_0x93a2('0x8')]?_0x563364[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'attributes':_0x563364[_0x93a2('0x8')]?_0x563364[_0x93a2('0x8')][_0x93a2('0xf')]||null:null,'limit':_0x563364['options']?_0x563364[_0x93a2('0x8')][_0x93a2('0xb')]||null:null})[_0x93a2('0x10')](function(_0x494983){logger[_0x93a2('0x11')](_0x93a2('0x1b'),_0x563364);logger[_0x93a2('0x11')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x93a2('0x18')](_0x563364[_0x93a2('0x8')]['where']),_0x563364['body'][_0x93a2('0x1d')]);logger[_0x93a2('0x12')]('UpdateCmHopper',_0x563364,JSON['stringify'](_0x494983));_0x35b638(_0x494983);})[_0x93a2('0x13')](function(_0x2e690c){logger[_0x93a2('0x15')](_0x93a2('0x1b'),_0x2e690c[_0x93a2('0x14')],_0x563364);_0x3b8580(_0xee6be0[_0x93a2('0x15')](0x1f4,_0x2e690c[_0x93a2('0x14')]));});});};exports['DestroyCmHopper']=function(_0x14b835){var _0xecbfb9=this;return new Promise(function(_0x16b0e8,_0x3261fc){return db[_0x93a2('0x6')]['destroy']({'where':_0x14b835[_0x93a2('0x8')]?_0x14b835[_0x93a2('0x8')][_0x93a2('0xa')]||null:null})[_0x93a2('0x10')](function(_0x57fd73){logger[_0x93a2('0x11')](_0x93a2('0x1e'),_0x14b835);logger[_0x93a2('0x12')](_0x93a2('0x1e'),_0x14b835,JSON['stringify'](_0x57fd73));_0x16b0e8(_0x57fd73);})[_0x93a2('0x13')](function(_0x7861d3){logger['error'](_0x93a2('0x1e'),_0x7861d3[_0x93a2('0x14')],_0x14b835);_0x3261fc(_0xecbfb9[_0x93a2('0x15')](0x1f4,_0x7861d3[_0x93a2('0x14')]));});});};exports['GetContactDialer']=function(_0x35a8bc){var _0x1026e8=this;return new Promise(function(_0x31bd81,_0x231686){return db[_0x93a2('0x1f')][_0x93a2('0x20')]()['then'](function(_0x384cbc){return db[_0x93a2('0x21')][_0x93a2('0x22')](function(_0x504455){return db[_0x93a2('0x6')]['findAll']({'where':_0x35a8bc[_0x93a2('0x8')]?_0x35a8bc[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'attributes':_0x35a8bc['options']?_0x35a8bc[_0x93a2('0x8')][_0x93a2('0xf')]||null:null,'limit':_0x35a8bc[_0x93a2('0x8')]?_0x35a8bc[_0x93a2('0x8')][_0x93a2('0xb')]||null:null,'order':_0x35a8bc[_0x93a2('0x8')]?_0x35a8bc[_0x93a2('0x8')]['order']||null:null,'transaction':_0x504455,'lock':_0x504455['LOCK'][_0x93a2('0x23')],'include':[{'model':db[_0x93a2('0x1f')],'as':'Contact','attributes':_[_0x93a2('0x24')](_0x384cbc)},{'model':db[_0x93a2('0x25')],'as':_0x93a2('0x26'),'attributes':['id',_0x93a2('0x27'),_0x93a2('0x28')]}]})[_0x93a2('0x10')](function(_0x47aaa3){var _0x27b75c=[];var _0x426121=[];for(var _0x20a991=0x0;_0x20a991<_0x47aaa3['length'];_0x20a991+=0x1){var _0x4d4c63=_0x47aaa3[_0x20a991]['UserId'];if(_0x4d4c63===null){_0x27b75c['push'](_0x47aaa3[_0x20a991][_0x93a2('0x1c')](_0x35a8bc['body'],{'transaction':_0x504455}));}else if(!_0x426121[_0x93a2('0x29')](_0x4d4c63)){_0x426121[_0x93a2('0x2a')](_0x4d4c63);_0x27b75c[_0x93a2('0x2a')](_0x47aaa3[_0x20a991]['update'](_0x35a8bc[_0x93a2('0x19')],{'transaction':_0x504455}));}}return BPromise[_0x93a2('0x2b')](_0x27b75c);});})[_0x93a2('0x10')](function(_0x3b8ce3){logger[_0x93a2('0x11')](_0x93a2('0x2c'),_0x35a8bc);if(_0x3b8ce3[_0x93a2('0x2d')]>0x0){logger['info'](_0x93a2('0x2e'),_0x3b8ce3[0x0][_0x93a2('0x2f')]['id'],_0x3b8ce3[0x0]['dataValues']['ContactId'],_0x3b8ce3[0x0]['dataValues'][_0x93a2('0x1d')]);}logger[_0x93a2('0x12')]('GetContactDialer',_0x35a8bc,JSON[_0x93a2('0x18')](_0x3b8ce3));_0x31bd81(_0x3b8ce3);})[_0x93a2('0x13')](function(_0x387a0c){logger[_0x93a2('0x15')](_0x93a2('0x2c'),_0x387a0c[_0x93a2('0x14')],_0x35a8bc);_0x231686(_0x1026e8[_0x93a2('0x15')](0x1f4,_0x387a0c['message']));});});});};exports['MoveContactManagedDialer']=function(_0x5ad541){var _0x7ba12d=this;return new Promise(function(_0x65eed4,_0x3943e2){return db['sequelize'][_0x93a2('0x22')](function(_0x4d923e){return db[_0x93a2('0x30')][_0x93a2('0x31')](_0x5ad541[_0x93a2('0x19')],{'raw':_0x5ad541[_0x93a2('0x8')]?_0x5ad541['options'][_0x93a2('0x9')]===undefined?!![]:![]:!![],'transaction':_0x4d923e})['then'](function(){logger[_0x93a2('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x93a2('0x18')](_0x5ad541[_0x93a2('0x8')][_0x93a2('0xa')]),_0x5ad541[_0x93a2('0x8')][_0x93a2('0xa')][_0x93a2('0x1d')]);return db[_0x93a2('0x6')][_0x93a2('0x32')]({'where':_0x5ad541[_0x93a2('0x8')]?_0x5ad541[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'transaction':_0x4d923e});});})[_0x93a2('0x10')](function(_0xd2fb50){logger[_0x93a2('0x11')](_0x93a2('0x33'),_0x5ad541);logger['debug'](_0x93a2('0x33'),_0x5ad541,JSON['stringify'](_0xd2fb50));_0x65eed4(_0xd2fb50);})['catch'](function(_0x5d84e2){logger[_0x93a2('0x15')]('MoveContactManagedDialer',_0x5d84e2[_0x93a2('0x14')],_0x5ad541);_0x3943e2(_0x7ba12d[_0x93a2('0x15')](0x1f4,_0x5d84e2['message']));});});};exports[_0x93a2('0x34')]=function(_0x3b9445){var _0xce8791=this;return new Promise(function(_0x184cb9,_0x272690){return db[_0x93a2('0x6')][_0x93a2('0x7')]({'raw':_0x3b9445[_0x93a2('0x8')]?_0x3b9445[_0x93a2('0x8')][_0x93a2('0x9')]===undefined?!![]:![]:!![],'where':_0x3b9445[_0x93a2('0x8')]?_0x3b9445[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'attributes':[[db[_0x93a2('0x21')]['fn'](_0x93a2('0x35'),db['sequelize']['fn']('IF',db[_0x93a2('0x21')][_0x93a2('0x36')](_0x93a2('0x37')+util[_0x93a2('0x38')](_0x93a2('0x39'),moment()['format'](_0x93a2('0x3a')))+'\x20,\x201,\x20null'))),_0x93a2('0x3b')]]})['then'](function(_0x323a24){logger['info']('CountReScheduled',_0x3b9445);logger[_0x93a2('0x12')](_0x93a2('0x34'),_0x3b9445,JSON[_0x93a2('0x18')](_0x323a24));_0x184cb9(_0x323a24);})[_0x93a2('0x13')](function(_0x5ae147){logger['error'](_0x93a2('0x34'),_0x5ae147[_0x93a2('0x14')],_0x3b9445);_0x272690(_0xce8791[_0x93a2('0x15')](0x1f4,_0x5ae147[_0x93a2('0x14')]));});});};exports[_0x93a2('0x3c')]=function(_0x1dee76){var _0x4f1c0d=this;return new Promise(function(_0xdf6cd3,_0x12d43a){return db[_0x93a2('0x1f')][_0x93a2('0x20')]()[_0x93a2('0x10')](function(){return db[_0x93a2('0x21')][_0x93a2('0x22')](function(_0x224cac){return db[_0x93a2('0x6')]['findAll']({'where':_0x1dee76[_0x93a2('0x8')]?_0x1dee76[_0x93a2('0x8')][_0x93a2('0xa')]||null:null,'attributes':_0x1dee76[_0x93a2('0x8')]?_0x1dee76[_0x93a2('0x8')][_0x93a2('0xf')]||null:null,'limit':0x1,'order':_0x1dee76[_0x93a2('0x8')]?_0x1dee76[_0x93a2('0x8')]['order']||null:null,'group':db[_0x93a2('0x6')][_0x93a2('0x3d')],'transaction':_0x224cac,'lock':_0x224cac[_0x93a2('0x3e')][_0x93a2('0x23')],'include':_0x1dee76[_0x93a2('0x8')]?_0x1dee76[_0x93a2('0x8')][_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x1dee76[_0x93a2('0x8')][_0x93a2('0xc')],function(_0x217127){return{'model':db[_0x217127[_0x93a2('0xe')]],'as':_0x217127['as'],'attributes':_0x217127[_0x93a2('0xf')],'include':_0x217127['include']?_[_0x93a2('0xd')](_0x217127[_0x93a2('0xc')],function(_0x47f0ec){return{'model':db[_0x47f0ec[_0x93a2('0xe')]],'as':_0x47f0ec['as'],'attributes':_0x47f0ec[_0x93a2('0xf')],'include':_0x47f0ec['include']?_[_0x93a2('0xd')](_0x47f0ec['include'],function(_0x34a533){return{'model':db[_0x34a533[_0x93a2('0xe')]],'as':_0x34a533['as'],'attributes':_0x34a533[_0x93a2('0xf')]};}):[]};}):[]};}):[]:[]})[_0x93a2('0x10')](function(_0x5d1c67){var _0x1e34d0=[];for(var _0xf73fda=0x0;_0xf73fda<_0x5d1c67[_0x93a2('0x2d')];_0xf73fda+=0x1){_0x1e34d0[_0x93a2('0x2a')](_0x5d1c67[_0xf73fda][_0x93a2('0x1c')](_0x1dee76[_0x93a2('0x19')],{'transaction':_0x224cac}));}return BPromise[_0x93a2('0x2b')](_0x1e34d0);});})['then'](function(_0xcf1a33){logger[_0x93a2('0x11')](_0x93a2('0x3c'),_0x1dee76);logger['debug'](_0x93a2('0x3c'),_0x1dee76,JSON[_0x93a2('0x18')](_0xcf1a33));_0xdf6cd3(_0xcf1a33);})['catch'](function(_0x15e65d){logger[_0x93a2('0x15')](_0x93a2('0x3c'),_0x15e65d['message'],_0x1dee76);_0x12d43a(_0x4f1c0d[_0x93a2('0x15')](0x1f4,_0x15e65d[_0x93a2('0x14')]));});});});};exports[_0x93a2('0x3f')]=function(_0x553930){var _0x51d072=this;return new Promise(function(_0x4a5463,_0x56f8d7){db[_0x93a2('0x1f')]['describe']()[_0x93a2('0x10')](function(_0x5eae1d){return db[_0x93a2('0x6')]['findAll']({'raw':_0x553930[_0x93a2('0x8')]?_0x553930[_0x93a2('0x8')][_0x93a2('0x9')]===undefined?!![]:![]:!![],'where':_0x553930[_0x93a2('0x8')]?_0x553930['options'][_0x93a2('0xa')]||null:null,'attributes':_0x553930['options']?_0x553930[_0x93a2('0x8')]['attributes']||null:null,'limit':_0x553930['options']?_0x553930['options'][_0x93a2('0xb')]||null:null,'include':_0x553930['options']?_0x553930[_0x93a2('0x8')]['include']?_[_0x93a2('0xd')](_0x553930[_0x93a2('0x8')][_0x93a2('0xc')],function(_0x1c6f6e){return{'model':db[_0x1c6f6e[_0x93a2('0xe')]],'as':_0x1c6f6e['as'],'attributes':_0x1c6f6e['as']===_0x93a2('0x40')?_[_0x93a2('0x24')](_0x5eae1d):_0x1c6f6e['attributes'],'include':_0x1c6f6e[_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x1c6f6e['include'],function(_0x165b8f){return{'model':db[_0x165b8f[_0x93a2('0xe')]],'as':_0x165b8f['as'],'attributes':_0x165b8f[_0x93a2('0xf')],'include':_0x165b8f[_0x93a2('0xc')]?_[_0x93a2('0xd')](_0x165b8f['include'],function(_0x50e136){return{'model':db[_0x50e136[_0x93a2('0xe')]],'as':_0x50e136['as'],'attributes':_0x50e136[_0x93a2('0xf')]};}):[]};}):[]};}):[]:[]})[_0x93a2('0x10')](function(_0x21d47e){logger[_0x93a2('0x11')](_0x93a2('0x5'),_0x553930);logger[_0x93a2('0x12')]('GetCmHopper',_0x553930,JSON[_0x93a2('0x18')](_0x21d47e));_0x4a5463(_0x21d47e);})[_0x93a2('0x13')](function(_0x186d0e){logger[_0x93a2('0x15')]('GetCmHopper',_0x186d0e[_0x93a2('0x14')],_0x553930);_0x56f8d7(_0x51d072['error'](0x1f4,_0x186d0e['message']));});});});};exports['GetContactByPhone']=function(_0x3bacf5){var _0x3160da=this;return new Promise(function(_0x2d073c,_0x50e158){return db[_0x93a2('0x1f')][_0x93a2('0x41')]({'raw':!![],'where':{'phone':_0x3bacf5['options'][_0x93a2('0xa')][_0x93a2('0x42')]},'attributes':['id',_0x93a2('0x43')],'order':[['id','DESC']]})[_0x93a2('0x10')](function(_0x1cf232){logger[_0x93a2('0x11')](_0x93a2('0x44'),_0x3bacf5);logger[_0x93a2('0x12')](_0x93a2('0x44'),_0x3bacf5,JSON[_0x93a2('0x18')](_0x1cf232));_0x2d073c(_0x1cf232);})['catch'](function(_0x351158){logger['error']('getContactByPhone',_0x351158[_0x93a2('0x14')],_0x3bacf5);_0x50e158(_0x3160da[_0x93a2('0x15')](0x1f4,_0x351158[_0x93a2('0x14')]));});});};exports['ResetActiveCalls']=function(_0x227da5){var _0x34eab4=this;return new Promise(function(_0x56d2f1,_0x38f881){return db[_0x93a2('0x21')][_0x93a2('0x22')](function(_0x376cf8){var _0x2b9773=_0x227da5[_0x93a2('0x8')]&&_0x227da5[_0x93a2('0x8')][_0x93a2('0xa')]?_0x227da5[_0x93a2('0x8')][_0x93a2('0xa')]:{};return db[_0x93a2('0x6')][_0x93a2('0x1c')](_0x227da5[_0x93a2('0x19')],{'where':_0x2b9773,'transaction':_0x376cf8})[_0x93a2('0x10')](function(_0x2d835e){logger[_0x93a2('0x11')](_0x93a2('0x45'),_0x227da5);logger['debug'](_0x93a2('0x45'),_0x227da5,JSON[_0x93a2('0x18')](_0x2d835e));_0x56d2f1(_0x2d835e);})[_0x93a2('0x13')](function(_0x43690f){logger[_0x93a2('0x15')]('ResetActiveCalls',_0x43690f[_0x93a2('0x14')],_0x227da5);_0x38f881(_0x34eab4[_0x93a2('0x15')](0x1f4,_0x43690f[_0x93a2('0x14')]));});});});};exports[_0x93a2('0x46')]=function(_0x34ec5b){var _0x12922e=this;var _0x5ab70d=_0x34ec5b[_0x93a2('0x19')][_0x93a2('0xa')][_0x93a2('0x47')];var _0x4bf30e=_0x34ec5b[_0x93a2('0x19')]['where'][_0x93a2('0x48')];var _0x225614=_0x34ec5b['body'][_0x93a2('0xa')][_0x93a2('0x49')];return new Promise(function(_0x3c04ab,_0x406ef5){return db[_0x93a2('0x6')][_0x93a2('0x7')]({'where':{'voiceQueueId':{'$in':_0x5ab70d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x93a2('0x21')][_0x93a2('0x36')](_0x93a2('0x4a')+_0x4bf30e+_0x93a2('0x4b')),'$gt':db[_0x93a2('0x21')][_0x93a2('0x36')]('NOW()')}},'UserId':{'$in':_0x225614}},'include':[{'model':db[_0x93a2('0x1f')],'as':_0x93a2('0x40')},{'model':db[_0x93a2('0x25')],'as':'Agent','attributes':['id',_0x93a2('0x27'),_0x93a2('0x28')]},{'model':db['CmList'],'as':_0x93a2('0x4c')}]})['then'](function(_0x17b3cb){if(_0x17b3cb[_0x93a2('0x2d')]>0x0){return db['sequelize'][_0x93a2('0x22')](function(_0x577e90){return db['CmHopper'][_0x93a2('0x1c')]({'recallmeNotifiedDate':db['sequelize'][_0x93a2('0x36')](_0x93a2('0x4d'))},{'where':{'id':{'$in':_[_0x93a2('0xd')](_0x17b3cb,'id')}},'transaction':_0x577e90})[_0x93a2('0x10')](function(){_0x3c04ab(_0x17b3cb);})[_0x93a2('0x13')](function(_0x27beb1){logger['error'](_0x93a2('0x46'),_0x27beb1[_0x93a2('0x14')],_0x34ec5b);_0x406ef5(_0x12922e[_0x93a2('0x15')](0x1f4,_0x27beb1[_0x93a2('0x14')]));});})[_0x93a2('0x13')](function(_0x19fba3){logger[_0x93a2('0x15')](_0x93a2('0x46'),_0x19fba3['message'],_0x34ec5b);_0x406ef5(_0x12922e['error'](0x1f4,_0x19fba3[_0x93a2('0x14')]));});}else{_0x3c04ab(_0x17b3cb);}});});}; \ No newline at end of file +var _0xf21d=['stringify','catch','error','message','ShowCmHopper','find','debug','CreateCmHopper','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','name','length','UserId','update','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','findAll','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds','\x20MINUTE','NOW()','voicePause','CmList','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','options','raw','where','limit','include','map','model','attributes','then','info','GetCmHopper'];(function(_0x25cd2c,_0x42f3b5){var _0x573939=function(_0x1514be){while(--_0x1514be){_0x25cd2c['push'](_0x25cd2c['shift']());}};_0x573939(++_0x42f3b5);}(_0xf21d,0x8c));var _0xdf21=function(_0x5eea2c,_0x2044b3){_0x5eea2c=_0x5eea2c-0x0;var _0x12694b=_0xf21d[_0x5eea2c];return _0x12694b;};'use strict';var _=require(_0xdf21('0x0'));var util=require(_0xdf21('0x1'));var moment=require('moment');var BPromise=require(_0xdf21('0x2'));var db=require(_0xdf21('0x3'))['db'];var logger=require(_0xdf21('0x4'))(_0xdf21('0x5'));exports['GetCmHopper']=function(_0x5eb83d){var _0x374298=this;return new Promise(function(_0x33b955,_0x595dac){return db[_0xdf21('0x6')]['findAll']({'raw':_0x5eb83d['options']?_0x5eb83d[_0xdf21('0x7')][_0xdf21('0x8')]===undefined?!![]:![]:!![],'where':_0x5eb83d['options']?_0x5eb83d[_0xdf21('0x7')][_0xdf21('0x9')]||null:null,'attributes':_0x5eb83d['options']?_0x5eb83d[_0xdf21('0x7')]['attributes']||null:null,'limit':_0x5eb83d['options']?_0x5eb83d[_0xdf21('0x7')][_0xdf21('0xa')]||null:null,'include':_0x5eb83d['options']?_0x5eb83d[_0xdf21('0x7')][_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x5eb83d[_0xdf21('0x7')][_0xdf21('0xb')],function(_0x3d066a){return{'model':db[_0x3d066a[_0xdf21('0xd')]],'as':_0x3d066a['as'],'attributes':_0x3d066a[_0xdf21('0xe')],'include':_0x3d066a[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x3d066a[_0xdf21('0xb')],function(_0x5b7e97){return{'model':db[_0x5b7e97[_0xdf21('0xd')]],'as':_0x5b7e97['as'],'attributes':_0x5b7e97[_0xdf21('0xe')],'include':_0x5b7e97[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x5b7e97[_0xdf21('0xb')],function(_0x5b0a16){return{'model':db[_0x5b0a16[_0xdf21('0xd')]],'as':_0x5b0a16['as'],'attributes':_0x5b0a16[_0xdf21('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf21('0xf')](function(_0x1f472e){logger[_0xdf21('0x10')](_0xdf21('0x11'),_0x5eb83d);logger['debug']('GetCmHopper',_0x5eb83d,JSON[_0xdf21('0x12')](_0x1f472e));_0x33b955(_0x1f472e);})[_0xdf21('0x13')](function(_0x34a258){logger[_0xdf21('0x14')](_0xdf21('0x11'),_0x34a258[_0xdf21('0x15')],_0x5eb83d);_0x595dac(_0x374298['error'](0x1f4,_0x34a258['message']));});});};exports[_0xdf21('0x16')]=function(_0x55d344){var _0x4be8df=this;return new Promise(function(_0xf1af4f,_0x23a8ee){return db[_0xdf21('0x6')][_0xdf21('0x17')]({'raw':_0x55d344['options']?_0x55d344['options'][_0xdf21('0x8')]===undefined?!![]:![]:!![],'where':_0x55d344[_0xdf21('0x7')]?_0x55d344['options'][_0xdf21('0x9')]||null:null,'attributes':_0x55d344[_0xdf21('0x7')]?_0x55d344[_0xdf21('0x7')]['attributes']||null:null,'include':_0x55d344[_0xdf21('0x7')]?_0x55d344[_0xdf21('0x7')][_0xdf21('0xb')]?_['map'](_0x55d344['options']['include'],function(_0x169630){return{'model':db[_0x169630[_0xdf21('0xd')]],'as':_0x169630['as'],'attributes':_0x169630[_0xdf21('0xe')],'include':_0x169630['include']?_[_0xdf21('0xc')](_0x169630[_0xdf21('0xb')],function(_0xac4e64){return{'model':db[_0xac4e64[_0xdf21('0xd')]],'as':_0xac4e64['as'],'attributes':_0xac4e64[_0xdf21('0xe')],'include':_0xac4e64[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0xac4e64[_0xdf21('0xb')],function(_0x4c538d){return{'model':db[_0x4c538d[_0xdf21('0xd')]],'as':_0x4c538d['as'],'attributes':_0x4c538d[_0xdf21('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf21('0xf')](function(_0x39b183){logger['info'](_0xdf21('0x16'),_0x55d344);logger[_0xdf21('0x18')](_0xdf21('0x16'),_0x55d344,JSON[_0xdf21('0x12')](_0x39b183));_0xf1af4f(_0x39b183);})['catch'](function(_0x49583b){logger[_0xdf21('0x14')]('ShowCmHopper',_0x49583b['message'],_0x55d344);_0x23a8ee(_0x4be8df['error'](0x1f4,_0x49583b[_0xdf21('0x15')]));});});};exports[_0xdf21('0x19')]=function(_0x3814a7){var _0x98dcbc=this;return new Promise(function(_0x3d9a3b,_0x5554b1){return db[_0xdf21('0x6')]['create'](_0x3814a7[_0xdf21('0x1a')],{'raw':_0x3814a7[_0xdf21('0x7')]?_0x3814a7[_0xdf21('0x7')]['raw']===undefined?!![]:![]:!![]})[_0xdf21('0xf')](function(_0x2f5bfb){logger['info'](_0xdf21('0x19'),_0x3814a7);logger[_0xdf21('0x18')](_0xdf21('0x19'),_0x3814a7,JSON[_0xdf21('0x12')](_0x2f5bfb));_0x3d9a3b(_0x2f5bfb);})[_0xdf21('0x13')](function(_0x36d609){logger[_0xdf21('0x14')](_0xdf21('0x19'),_0x36d609[_0xdf21('0x15')],_0x3814a7);_0x5554b1(_0x98dcbc['error'](0x1f4,_0x36d609[_0xdf21('0x15')]));});});};exports[_0xdf21('0x1b')]=function(_0x3da779){var _0x1e609e=this;return new Promise(function(_0xc06e2,_0x1b7e26){return db['CmHopper']['update'](_0x3da779[_0xdf21('0x1a')],{'raw':_0x3da779[_0xdf21('0x7')]?_0x3da779[_0xdf21('0x7')][_0xdf21('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3da779[_0xdf21('0x7')]?_0x3da779[_0xdf21('0x7')][_0xdf21('0x9')]||null:null,'attributes':_0x3da779[_0xdf21('0x7')]?_0x3da779[_0xdf21('0x7')][_0xdf21('0xe')]||null:null,'limit':_0x3da779[_0xdf21('0x7')]?_0x3da779[_0xdf21('0x7')][_0xdf21('0xa')]||null:null})[_0xdf21('0xf')](function(_0x267850){logger['info'](_0xdf21('0x1b'),_0x3da779);logger[_0xdf21('0x10')](_0xdf21('0x1c'),JSON['stringify'](_0x3da779[_0xdf21('0x7')][_0xdf21('0x9')]),_0x3da779['body'][_0xdf21('0x1d')]);logger['debug'](_0xdf21('0x1b'),_0x3da779,JSON[_0xdf21('0x12')](_0x267850));_0xc06e2(_0x267850);})[_0xdf21('0x13')](function(_0xdf76be){logger[_0xdf21('0x14')](_0xdf21('0x1b'),_0xdf76be[_0xdf21('0x15')],_0x3da779);_0x1b7e26(_0x1e609e[_0xdf21('0x14')](0x1f4,_0xdf76be['message']));});});};exports[_0xdf21('0x1e')]=function(_0x40e151){var _0x3650dd=this;return new Promise(function(_0x2ab247,_0x76b44b){return db['CmHopper'][_0xdf21('0x1f')]({'where':_0x40e151['options']?_0x40e151[_0xdf21('0x7')][_0xdf21('0x9')]||null:null})['then'](function(_0x4806d1){logger['info'](_0xdf21('0x1e'),_0x40e151);logger[_0xdf21('0x18')](_0xdf21('0x1e'),_0x40e151,JSON[_0xdf21('0x12')](_0x4806d1));_0x2ab247(_0x4806d1);})[_0xdf21('0x13')](function(_0x19db26){logger[_0xdf21('0x14')]('DestroyCmHopper',_0x19db26['message'],_0x40e151);_0x76b44b(_0x3650dd[_0xdf21('0x14')](0x1f4,_0x19db26[_0xdf21('0x15')]));});});};exports[_0xdf21('0x20')]=function(_0x40de9a){var _0x4a5e2c=this;return new Promise(function(_0x128647,_0x56bf11){return db[_0xdf21('0x21')][_0xdf21('0x22')]()[_0xdf21('0xf')](function(_0x1cd701){return db[_0xdf21('0x23')][_0xdf21('0x24')](function(_0x53170f){return db[_0xdf21('0x6')]['findAll']({'where':_0x40de9a['options']?_0x40de9a[_0xdf21('0x7')]['where']||null:null,'attributes':_0x40de9a[_0xdf21('0x7')]?_0x40de9a[_0xdf21('0x7')]['attributes']||null:null,'limit':_0x40de9a[_0xdf21('0x7')]?_0x40de9a['options'][_0xdf21('0xa')]||null:null,'order':_0x40de9a['options']?_0x40de9a[_0xdf21('0x7')][_0xdf21('0x25')]||null:null,'transaction':_0x53170f,'lock':_0x53170f[_0xdf21('0x26')][_0xdf21('0x27')],'include':[{'model':db['CmContact'],'as':_0xdf21('0x28'),'attributes':_[_0xdf21('0x29')](_0x1cd701)},{'model':db[_0xdf21('0x2a')],'as':'Agent','attributes':['id',_0xdf21('0x2b'),'voicePause']}]})[_0xdf21('0xf')](function(_0x594b75){var _0x505496=[];var _0x1671d8=[];for(var _0x2333e8=0x0;_0x2333e8<_0x594b75[_0xdf21('0x2c')];_0x2333e8+=0x1){var _0xdc97fc=_0x594b75[_0x2333e8][_0xdf21('0x2d')];if(_0xdc97fc===null){_0x505496['push'](_0x594b75[_0x2333e8][_0xdf21('0x2e')](_0x40de9a[_0xdf21('0x1a')],{'transaction':_0x53170f}));}else if(!_0x1671d8[_0xdf21('0x2f')](_0xdc97fc)){_0x1671d8[_0xdf21('0x30')](_0xdc97fc);_0x505496[_0xdf21('0x30')](_0x594b75[_0x2333e8][_0xdf21('0x2e')](_0x40de9a[_0xdf21('0x1a')],{'transaction':_0x53170f}));}}return BPromise[_0xdf21('0x31')](_0x505496);});})[_0xdf21('0xf')](function(_0x2613a0){logger[_0xdf21('0x10')]('GetContactDialer',_0x40de9a);if(_0x2613a0['length']>0x0){logger[_0xdf21('0x10')](_0xdf21('0x32'),_0x2613a0[0x0]['dataValues']['id'],_0x2613a0[0x0][_0xdf21('0x33')][_0xdf21('0x34')],_0x2613a0[0x0][_0xdf21('0x33')]['active']);}logger[_0xdf21('0x18')](_0xdf21('0x20'),_0x40de9a,JSON[_0xdf21('0x12')](_0x2613a0));_0x128647(_0x2613a0);})[_0xdf21('0x13')](function(_0x23678b){logger[_0xdf21('0x14')](_0xdf21('0x20'),_0x23678b[_0xdf21('0x15')],_0x40de9a);_0x56bf11(_0x4a5e2c[_0xdf21('0x14')](0x1f4,_0x23678b[_0xdf21('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x22b775){var _0x31f094=this;return new Promise(function(_0x5442d7,_0x3149e6){return db[_0xdf21('0x23')][_0xdf21('0x24')](function(_0x106fc9){return db[_0xdf21('0x35')]['create'](_0x22b775[_0xdf21('0x1a')],{'raw':_0x22b775['options']?_0x22b775[_0xdf21('0x7')][_0xdf21('0x8')]===undefined?!![]:![]:!![],'transaction':_0x106fc9})[_0xdf21('0xf')](function(){logger[_0xdf21('0x10')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xdf21('0x12')](_0x22b775[_0xdf21('0x7')][_0xdf21('0x9')]),_0x22b775[_0xdf21('0x7')][_0xdf21('0x9')][_0xdf21('0x1d')]);return db[_0xdf21('0x6')][_0xdf21('0x1f')]({'where':_0x22b775['options']?_0x22b775[_0xdf21('0x7')]['where']||null:null,'transaction':_0x106fc9});});})[_0xdf21('0xf')](function(_0x294462){logger[_0xdf21('0x10')](_0xdf21('0x36'),_0x22b775);logger['debug']('MoveContactManagedDialer',_0x22b775,JSON['stringify'](_0x294462));_0x5442d7(_0x294462);})[_0xdf21('0x13')](function(_0xb922a6){logger[_0xdf21('0x14')](_0xdf21('0x36'),_0xb922a6[_0xdf21('0x15')],_0x22b775);_0x3149e6(_0x31f094['error'](0x1f4,_0xb922a6[_0xdf21('0x15')]));});});};exports[_0xdf21('0x37')]=function(_0x5eb3e4){var _0xcd7858=this;return new Promise(function(_0x473905,_0x4108af){return db['CmHopper'][_0xdf21('0x38')]({'raw':_0x5eb3e4[_0xdf21('0x7')]?_0x5eb3e4[_0xdf21('0x7')][_0xdf21('0x8')]===undefined?!![]:![]:!![],'where':_0x5eb3e4[_0xdf21('0x7')]?_0x5eb3e4[_0xdf21('0x7')][_0xdf21('0x9')]||null:null,'attributes':[[db['sequelize']['fn'](_0xdf21('0x39'),db[_0xdf21('0x23')]['fn']('IF',db[_0xdf21('0x23')][_0xdf21('0x3a')](_0xdf21('0x3b')+util[_0xdf21('0x3c')](_0xdf21('0x3d'),moment()[_0xdf21('0x3c')](_0xdf21('0x3e')))+_0xdf21('0x3f')))),_0xdf21('0x40')]]})[_0xdf21('0xf')](function(_0x428e9e){logger[_0xdf21('0x10')](_0xdf21('0x37'),_0x5eb3e4);logger[_0xdf21('0x18')](_0xdf21('0x37'),_0x5eb3e4,JSON[_0xdf21('0x12')](_0x428e9e));_0x473905(_0x428e9e);})[_0xdf21('0x13')](function(_0x39c212){logger[_0xdf21('0x14')](_0xdf21('0x37'),_0x39c212[_0xdf21('0x15')],_0x5eb3e4);_0x4108af(_0xcd7858[_0xdf21('0x14')](0x1f4,_0x39c212[_0xdf21('0x15')]));});});};exports[_0xdf21('0x41')]=function(_0x3a0115){var _0x3ddb06=this;return new Promise(function(_0x2d7511,_0x391003){return db[_0xdf21('0x21')][_0xdf21('0x22')]()['then'](function(){return db[_0xdf21('0x23')][_0xdf21('0x24')](function(_0xdfbdac){return db[_0xdf21('0x6')][_0xdf21('0x38')]({'where':_0x3a0115[_0xdf21('0x7')]?_0x3a0115[_0xdf21('0x7')][_0xdf21('0x9')]||null:null,'attributes':_0x3a0115[_0xdf21('0x7')]?_0x3a0115[_0xdf21('0x7')][_0xdf21('0xe')]||null:null,'limit':0x1,'order':_0x3a0115['options']?_0x3a0115[_0xdf21('0x7')][_0xdf21('0x25')]||null:null,'group':db['CmHopper'][_0xdf21('0x2d')],'transaction':_0xdfbdac,'lock':_0xdfbdac[_0xdf21('0x26')][_0xdf21('0x27')],'include':_0x3a0115[_0xdf21('0x7')]?_0x3a0115[_0xdf21('0x7')][_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x3a0115[_0xdf21('0x7')][_0xdf21('0xb')],function(_0x6c644f){return{'model':db[_0x6c644f[_0xdf21('0xd')]],'as':_0x6c644f['as'],'attributes':_0x6c644f[_0xdf21('0xe')],'include':_0x6c644f[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x6c644f[_0xdf21('0xb')],function(_0x1f4822){return{'model':db[_0x1f4822[_0xdf21('0xd')]],'as':_0x1f4822['as'],'attributes':_0x1f4822['attributes'],'include':_0x1f4822[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x1f4822[_0xdf21('0xb')],function(_0x5f2767){return{'model':db[_0x5f2767[_0xdf21('0xd')]],'as':_0x5f2767['as'],'attributes':_0x5f2767[_0xdf21('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26ae35){var _0x3cd843=[];for(var _0x2bc121=0x0;_0x2bc121<_0x26ae35[_0xdf21('0x2c')];_0x2bc121+=0x1){_0x3cd843[_0xdf21('0x30')](_0x26ae35[_0x2bc121][_0xdf21('0x2e')](_0x3a0115['body'],{'transaction':_0xdfbdac}));}return BPromise[_0xdf21('0x31')](_0x3cd843);});})['then'](function(_0x4fd12f){logger[_0xdf21('0x10')]('GetContactRecallMe',_0x3a0115);logger[_0xdf21('0x18')]('GetContactRecallMe',_0x3a0115,JSON[_0xdf21('0x12')](_0x4fd12f));_0x2d7511(_0x4fd12f);})[_0xdf21('0x13')](function(_0x237ba7){logger['error'](_0xdf21('0x41'),_0x237ba7[_0xdf21('0x15')],_0x3a0115);_0x391003(_0x3ddb06[_0xdf21('0x14')](0x1f4,_0x237ba7[_0xdf21('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x1a36ef){var _0x3145d1=this;return new Promise(function(_0x557598,_0x233ca1){db['CmContact'][_0xdf21('0x22')]()['then'](function(_0x3f8acb){return db['CmHopper'][_0xdf21('0x38')]({'raw':_0x1a36ef[_0xdf21('0x7')]?_0x1a36ef['options'][_0xdf21('0x8')]===undefined?!![]:![]:!![],'where':_0x1a36ef['options']?_0x1a36ef[_0xdf21('0x7')][_0xdf21('0x9')]||null:null,'attributes':_0x1a36ef[_0xdf21('0x7')]?_0x1a36ef[_0xdf21('0x7')]['attributes']||null:null,'limit':_0x1a36ef[_0xdf21('0x7')]?_0x1a36ef[_0xdf21('0x7')]['limit']||null:null,'include':_0x1a36ef[_0xdf21('0x7')]?_0x1a36ef[_0xdf21('0x7')][_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x1a36ef[_0xdf21('0x7')][_0xdf21('0xb')],function(_0x410941){return{'model':db[_0x410941['model']],'as':_0x410941['as'],'attributes':_0x410941['as']==='Contact'?_[_0xdf21('0x29')](_0x3f8acb):_0x410941[_0xdf21('0xe')],'include':_0x410941[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x410941[_0xdf21('0xb')],function(_0x9a83e8){return{'model':db[_0x9a83e8[_0xdf21('0xd')]],'as':_0x9a83e8['as'],'attributes':_0x9a83e8[_0xdf21('0xe')],'include':_0x9a83e8[_0xdf21('0xb')]?_[_0xdf21('0xc')](_0x9a83e8[_0xdf21('0xb')],function(_0x44b09e){return{'model':db[_0x44b09e[_0xdf21('0xd')]],'as':_0x44b09e['as'],'attributes':_0x44b09e[_0xdf21('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdf21('0xf')](function(_0xa8b4d5){logger['info'](_0xdf21('0x11'),_0x1a36ef);logger[_0xdf21('0x18')](_0xdf21('0x11'),_0x1a36ef,JSON['stringify'](_0xa8b4d5));_0x557598(_0xa8b4d5);})[_0xdf21('0x13')](function(_0x2cbf10){logger[_0xdf21('0x14')]('GetCmHopper',_0x2cbf10[_0xdf21('0x15')],_0x1a36ef);_0x233ca1(_0x3145d1[_0xdf21('0x14')](0x1f4,_0x2cbf10['message']));});});});};exports[_0xdf21('0x42')]=function(_0xc89336){var _0x2e6f2f=this;return new Promise(function(_0x5ee58b,_0x5d3f18){return db[_0xdf21('0x21')][_0xdf21('0x43')]({'raw':!![],'where':{'phone':_0xc89336[_0xdf21('0x7')][_0xdf21('0x9')][_0xdf21('0x44')]},'attributes':['id',_0xdf21('0x45')],'order':[['id','DESC']]})[_0xdf21('0xf')](function(_0x386a1f){logger[_0xdf21('0x10')](_0xdf21('0x46'),_0xc89336);logger[_0xdf21('0x18')](_0xdf21('0x46'),_0xc89336,JSON[_0xdf21('0x12')](_0x386a1f));_0x5ee58b(_0x386a1f);})[_0xdf21('0x13')](function(_0x478ea0){logger[_0xdf21('0x14')]('getContactByPhone',_0x478ea0[_0xdf21('0x15')],_0xc89336);_0x5d3f18(_0x2e6f2f[_0xdf21('0x14')](0x1f4,_0x478ea0[_0xdf21('0x15')]));});});};exports['ResetActiveCalls']=function(_0x28402d){var _0x2830b3=this;return new Promise(function(_0x16c0d6,_0x11a36c){return db[_0xdf21('0x23')][_0xdf21('0x24')](function(_0x331a1a){var _0x40b78f=_0x28402d[_0xdf21('0x7')]&&_0x28402d['options']['where']?_0x28402d[_0xdf21('0x7')][_0xdf21('0x9')]:{};return db[_0xdf21('0x6')][_0xdf21('0x2e')](_0x28402d[_0xdf21('0x1a')],{'where':_0x40b78f,'transaction':_0x331a1a})['then'](function(_0x99c093){logger[_0xdf21('0x10')](_0xdf21('0x47'),_0x28402d);logger[_0xdf21('0x18')]('ResetActiveCalls',_0x28402d,JSON[_0xdf21('0x12')](_0x99c093));_0x16c0d6(_0x99c093);})['catch'](function(_0x126207){logger[_0xdf21('0x14')](_0xdf21('0x47'),_0x126207['message'],_0x28402d);_0x11a36c(_0x2830b3[_0xdf21('0x14')](0x1f4,_0x126207['message']));});});});};exports[_0xdf21('0x48')]=function(_0x5d88af){var _0x57a7da=this;var _0x3916d4=_0x5d88af['body'][_0xdf21('0x9')][_0xdf21('0x49')];var _0x17796d=_0x5d88af[_0xdf21('0x1a')][_0xdf21('0x9')]['interval'];var _0x5358de=_0x5d88af[_0xdf21('0x1a')][_0xdf21('0x9')][_0xdf21('0x4a')];return new Promise(function(_0x56aadc,_0x447391){return db[_0xdf21('0x6')]['findAll']({'where':{'voiceQueueId':{'$in':_0x3916d4},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xdf21('0x23')][_0xdf21('0x3a')]('NOW()\x20+\x20INTERVAL\x20'+_0x17796d+_0xdf21('0x4b')),'$gt':db[_0xdf21('0x23')][_0xdf21('0x3a')](_0xdf21('0x4c'))}},'UserId':{'$in':_0x5358de}},'include':[{'model':db['CmContact'],'as':_0xdf21('0x28')},{'model':db[_0xdf21('0x2a')],'as':'Agent','attributes':['id',_0xdf21('0x2b'),_0xdf21('0x4d')]},{'model':db[_0xdf21('0x4e')],'as':'List'}]})[_0xdf21('0xf')](function(_0x5bd5db){if(_0x5bd5db[_0xdf21('0x2c')]>0x0){return db[_0xdf21('0x23')][_0xdf21('0x24')](function(_0x505e47){return db['CmHopper'][_0xdf21('0x2e')]({'recallmeNotifiedDate':db['sequelize'][_0xdf21('0x3a')](_0xdf21('0x4c'))},{'where':{'id':{'$in':_[_0xdf21('0xc')](_0x5bd5db,'id')}},'transaction':_0x505e47})[_0xdf21('0xf')](function(){_0x56aadc(_0x5bd5db);})[_0xdf21('0x13')](function(_0x6c5a06){logger[_0xdf21('0x14')](_0xdf21('0x48'),_0x6c5a06[_0xdf21('0x15')],_0x5d88af);_0x447391(_0x57a7da[_0xdf21('0x14')](0x1f4,_0x6c5a06[_0xdf21('0x15')]));});})['catch'](function(_0xba769){logger[_0xdf21('0x14')](_0xdf21('0x48'),_0xba769['message'],_0x5d88af);_0x447391(_0x57a7da[_0xdf21('0x14')](0x1f4,_0xba769[_0xdf21('0x15')]));});}else{_0x56aadc(_0x5bd5db);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 945668f..ad069d1 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 _0x75bc=['create','/preview','getPreview','/timezone','getTimezone','put','update','destroy','exports','../../components/auth/service','./cmHopper.controller','index','get','/describe','isAuthenticated','describe','/opencontacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post'];(function(_0x5e6ebe,_0x373752){var _0x5d80a0=function(_0x145677){while(--_0x145677){_0x5e6ebe['push'](_0x5e6ebe['shift']());}};_0x5d80a0(++_0x373752);}(_0x75bc,0x190));var _0xc75b=function(_0x586af9,_0x879a1d){_0x586af9=_0x586af9-0x0;var _0x542469=_0x75bc[_0x586af9];return _0x542469;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xc75b('0x0'));var controller=require(_0xc75b('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0xc75b('0x2')]);router[_0xc75b('0x3')](_0xc75b('0x4'),auth[_0xc75b('0x5')](),controller[_0xc75b('0x6')]);router['get'](_0xc75b('0x7'),auth[_0xc75b('0x5')](),controller['getOpenContacts']);router['get'](_0xc75b('0x8'),auth[_0xc75b('0x5')](),controller['getTimezones']);router[_0xc75b('0x3')](_0xc75b('0x9'),auth[_0xc75b('0x5')](),controller[_0xc75b('0xa')]);router[_0xc75b('0x3')](_0xc75b('0xb'),auth[_0xc75b('0x5')](),controller[_0xc75b('0xc')]);router[_0xc75b('0xd')]('/',auth[_0xc75b('0x5')](),controller[_0xc75b('0xe')]);router[_0xc75b('0xd')](_0xc75b('0xf'),auth['isAuthenticated'](),controller[_0xc75b('0x10')]);router['post'](_0xc75b('0x11'),auth['isAuthenticated'](),controller[_0xc75b('0x12')]);router[_0xc75b('0x13')]('/:id',auth[_0xc75b('0x5')](),controller[_0xc75b('0x14')]);router['delete'](_0xc75b('0x9'),auth[_0xc75b('0x5')](),controller[_0xc75b('0x15')]);module[_0xc75b('0x16')]=router; \ No newline at end of file +var _0xfe65=['./cmHopper.controller','isAuthenticated','index','get','/describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','create','post','getPreview','/timezone','getTimezone','put','update','delete','exports','express'];(function(_0x47bfff,_0x20f3c3){var _0x2f7c23=function(_0x18b433){while(--_0x18b433){_0x47bfff['push'](_0x47bfff['shift']());}};_0x2f7c23(++_0x20f3c3);}(_0xfe65,0xe5));var _0x5fe6=function(_0x76a667,_0x456b95){_0x76a667=_0x76a667-0x0;var _0xaac135=_0xfe65[_0x76a667];return _0xaac135;};'use strict';var express=require(_0x5fe6('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x5fe6('0x1'));router['get']('/',auth[_0x5fe6('0x2')](),controller[_0x5fe6('0x3')]);router[_0x5fe6('0x4')](_0x5fe6('0x5'),auth[_0x5fe6('0x2')](),controller['describe']);router[_0x5fe6('0x4')](_0x5fe6('0x6'),auth['isAuthenticated'](),controller[_0x5fe6('0x7')]);router['get'](_0x5fe6('0x8'),auth[_0x5fe6('0x2')](),controller[_0x5fe6('0x9')]);router[_0x5fe6('0x4')](_0x5fe6('0xa'),auth[_0x5fe6('0x2')](),controller[_0x5fe6('0xb')]);router['get'](_0x5fe6('0xc'),auth['isAuthenticated'](),controller[_0x5fe6('0xd')]);router['post']('/',auth[_0x5fe6('0x2')](),controller[_0x5fe6('0xe')]);router[_0x5fe6('0xf')]('/preview',auth[_0x5fe6('0x2')](),controller[_0x5fe6('0x10')]);router[_0x5fe6('0xf')](_0x5fe6('0x11'),auth[_0x5fe6('0x2')](),controller[_0x5fe6('0x12')]);router[_0x5fe6('0x13')](_0x5fe6('0xa'),auth[_0x5fe6('0x2')](),controller[_0x5fe6('0x14')]);router[_0x5fe6('0x15')](_0x5fe6('0xa'),auth[_0x5fe6('0x2')](),controller['destroy']);module[_0x5fe6('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 fd46d9b..4d07628 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 _0xc6e3=['DATE','moment','exports','INTEGER'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0xc6e3,0x11d));var _0x3c6e=function(_0x1d3162,_0x4debcc){_0x1d3162=_0x1d3162-0x0;var _0x16c9d0=_0xc6e3[_0x1d3162];return _0x16c9d0;};'use strict';var moment=require(_0x3c6e('0x0'));var Sequelize=require('sequelize');module[_0x3c6e('0x1')]={'CmHopperId':{'type':Sequelize[_0x3c6e('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3c6e('0x3')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3c6e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed93=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5deec8,_0x5530f9){var _0x50cf5f=function(_0x44ce43){while(--_0x44ce43){_0x5deec8['push'](_0x5deec8['shift']());}};_0x50cf5f(++_0x5530f9);}(_0xed93,0x1f0));var _0x3ed9=function(_0x4d9497,_0x3e2eb6){_0x4d9497=_0x4d9497-0x0;var _0x2a48b1=_0xed93[_0x4d9497];return _0x2a48b1;};'use strict';var moment=require(_0x3ed9('0x0'));var Sequelize=require('sequelize');module[_0x3ed9('0x1')]={'CmHopperId':{'type':Sequelize[_0x3ed9('0x2')]},'phone':{'type':Sequelize[_0x3ed9('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x3ed9('0x4')],'defaultValue':moment()[_0x3ed9('0x5')](_0x3ed9('0x6'))},'countbusyretry':{'type':Sequelize[_0x3ed9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3ed9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3ed9('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x3ed9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3ed9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3ed9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3ed9('0x2')],'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 1b20ff7..60df248 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 _0xd6c3=['pick','filter','where','merge','VIRTUAL','CmHopperAdditionalPhone','includeAll','include','catch','show','params','keys','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','find','userProfileId','UserProfileResource','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','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','then','destroy','get','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x83cc7b,_0x337a6b){var _0x77e5ab=function(_0xe70954){while(--_0xe70954){_0x83cc7b['push'](_0x83cc7b['shift']());}};_0x77e5ab(++_0x337a6b);}(_0xd6c3,0x67));var _0x3d6c=function(_0x8ac26c,_0x5dacb8){_0x8ac26c=_0x8ac26c-0x0;var _0x3d43ae=_0xd6c3[_0x8ac26c];return _0x3d43ae;};'use strict';var emlformat=require(_0x3d6c('0x0'));var rimraf=require(_0x3d6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d6c('0x2'));var rp=require(_0x3d6c('0x3'));var moment=require(_0x3d6c('0x4'));var BPromise=require(_0x3d6c('0x5'));var Mustache=require(_0x3d6c('0x6'));var util=require(_0x3d6c('0x7'));var path=require(_0x3d6c('0x8'));var sox=require(_0x3d6c('0x9'));var csv=require(_0x3d6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3d6c('0xb'));var _=require(_0x3d6c('0xc'));var squel=require('squel');var crypto=require(_0x3d6c('0xd'));var jsforce=require(_0x3d6c('0xe'));var deskjs=require(_0x3d6c('0xf'));var toCsv=require(_0x3d6c('0xa'));var querystring=require(_0x3d6c('0x10'));var Papa=require(_0x3d6c('0x11'));var Redis=require(_0x3d6c('0x12'));var authService=require(_0x3d6c('0x13'));var qs=require(_0x3d6c('0x14'));var as=require(_0x3d6c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6c('0x16'))('api');var utils=require(_0x3d6c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3d6c('0x18'))['db'];function respondWithStatusCode(_0x2a8711,_0x1d2661){_0x1d2661=_0x1d2661||0xcc;return function(_0x800076){if(_0x800076){return _0x2a8711[_0x3d6c('0x19')](_0x1d2661);}return _0x2a8711[_0x3d6c('0x1a')](_0x1d2661)[_0x3d6c('0x1b')]();};}function respondWithResult(_0x24e740,_0x3ec839){_0x3ec839=_0x3ec839||0xc8;return function(_0x1807cf){if(_0x1807cf){return _0x24e740[_0x3d6c('0x1a')](_0x3ec839)[_0x3d6c('0x1c')](_0x1807cf);}};}function respondWithFilteredResult(_0x31266c,_0x1b8cd5){return function(_0x48eaee){if(_0x48eaee){var _0x2125b0=typeof _0x1b8cd5[_0x3d6c('0x1d')]===_0x3d6c('0x1e')&&typeof _0x1b8cd5[_0x3d6c('0x1f')]===_0x3d6c('0x1e');var _0x81f5a=_0x48eaee[_0x3d6c('0x20')];var _0x3e5805=_0x2125b0?0x0:_0x1b8cd5[_0x3d6c('0x1d')];var _0x36d686=_0x2125b0?_0x48eaee[_0x3d6c('0x20')]:_0x1b8cd5[_0x3d6c('0x1d')]+_0x1b8cd5['limit'];var _0x529daf;if(_0x36d686>=_0x81f5a){_0x36d686=_0x81f5a;_0x529daf=0xc8;}else{_0x529daf=0xce;}_0x31266c[_0x3d6c('0x1a')](_0x529daf);return _0x31266c['set']('Content-Range',_0x3e5805+'-'+_0x36d686+'/'+_0x81f5a)[_0x3d6c('0x1c')](_0x48eaee);}return null;};}function patchUpdates(_0x4777fe){return function(_0x3f1a05){try{jsonpatch[_0x3d6c('0x21')](_0x3f1a05,_0x4777fe,!![]);}catch(_0x2aae5e){return BPromise['reject'](_0x2aae5e);}return _0x3f1a05[_0x3d6c('0x22')]();};}function saveUpdates(_0x24d984,_0x4c144b){return function(_0x3d64df){if(_0x3d64df){return _0x3d64df['update'](_0x24d984)[_0x3d6c('0x23')](function(_0x18c071){return _0x18c071;});}return null;};}function removeEntity(_0xb8baa4,_0x165e3b){return function(_0x166bb2){if(_0x166bb2){return _0x166bb2[_0x3d6c('0x24')]()[_0x3d6c('0x23')](function(){var _0x36177b=_0x166bb2[_0x3d6c('0x25')]({'plain':!![]});var _0x2f6e58='CmHopperAdditionalPhones';return db['UserProfileResource'][_0x3d6c('0x24')]({'where':{'type':_0x2f6e58,'resourceId':_0x36177b['id']}})[_0x3d6c('0x23')](function(){return _0x166bb2;});})[_0x3d6c('0x23')](function(){_0xb8baa4['status'](0xcc)[_0x3d6c('0x1b')]();});}};}function handleEntityNotFound(_0x2eef3c,_0x2f9542){return function(_0x3859e6){if(!_0x3859e6){_0x2eef3c[_0x3d6c('0x19')](0x194);}return _0x3859e6;};}function handleError(_0x331172,_0x3956d8){_0x3956d8=_0x3956d8||0x1f4;return function(_0x3db6c5){logger['error'](_0x3db6c5['stack']);if(_0x3db6c5[_0x3d6c('0x26')]){delete _0x3db6c5[_0x3d6c('0x26')];}_0x331172[_0x3d6c('0x1a')](_0x3956d8)[_0x3d6c('0x27')](_0x3db6c5);};}exports[_0x3d6c('0x28')]=function(_0x2701f1,_0x4dc900){var _0x3a69d1={},_0x38fff2={},_0x216424={'count':0x0,'rows':[]};var _0x209180=_[_0x3d6c('0x29')](db['CmHopperAdditionalPhone']['rawAttributes'],function(_0x233bfb){return{'name':_0x233bfb[_0x3d6c('0x2a')],'type':_0x233bfb[_0x3d6c('0x2b')][_0x3d6c('0x2c')]};});_0x38fff2[_0x3d6c('0x2d')]=_[_0x3d6c('0x29')](_0x209180,'name');_0x38fff2[_0x3d6c('0x2e')]=_['keys'](_0x2701f1[_0x3d6c('0x2e')]);_0x38fff2[_0x3d6c('0x2f')]=_[_0x3d6c('0x30')](_0x38fff2[_0x3d6c('0x2d')],_0x38fff2[_0x3d6c('0x2e')]);_0x3a69d1[_0x3d6c('0x31')]=_['intersection'](_0x38fff2[_0x3d6c('0x2d')],qs[_0x3d6c('0x32')](_0x2701f1[_0x3d6c('0x2e')][_0x3d6c('0x32')]));_0x3a69d1[_0x3d6c('0x31')]=_0x3a69d1[_0x3d6c('0x31')][_0x3d6c('0x33')]?_0x3a69d1[_0x3d6c('0x31')]:_0x38fff2['model'];if(!_0x2701f1[_0x3d6c('0x2e')]['hasOwnProperty'](_0x3d6c('0x34'))){_0x3a69d1[_0x3d6c('0x1f')]=qs[_0x3d6c('0x1f')](_0x2701f1[_0x3d6c('0x2e')]['limit']);_0x3a69d1[_0x3d6c('0x1d')]=qs['offset'](_0x2701f1[_0x3d6c('0x2e')][_0x3d6c('0x1d')]);}_0x3a69d1[_0x3d6c('0x35')]=qs['sort'](_0x2701f1[_0x3d6c('0x2e')][_0x3d6c('0x36')]);_0x3a69d1['where']=qs['filters'](_[_0x3d6c('0x37')](_0x2701f1['query'],_0x38fff2[_0x3d6c('0x2f')]),_0x209180);if(_0x2701f1[_0x3d6c('0x2e')][_0x3d6c('0x38')]){_0x3a69d1[_0x3d6c('0x39')]=_[_0x3d6c('0x3a')](_0x3a69d1[_0x3d6c('0x39')],{'$or':_[_0x3d6c('0x29')](_0x209180,function(_0x52577d){if(_0x52577d['type']!==_0x3d6c('0x3b')){var _0x551b36={};_0x551b36[_0x52577d[_0x3d6c('0x26')]]={'$like':'%'+_0x2701f1[_0x3d6c('0x2e')]['filter']+'%'};return _0x551b36;}})});}_0x3a69d1=_[_0x3d6c('0x3a')]({},_0x3a69d1,_0x2701f1['options']);var _0x5331de={'where':_0x3a69d1[_0x3d6c('0x39')]};return db[_0x3d6c('0x3c')][_0x3d6c('0x20')](_0x5331de)[_0x3d6c('0x23')](function(_0x5683f9){_0x216424[_0x3d6c('0x20')]=_0x5683f9;if(_0x2701f1[_0x3d6c('0x2e')][_0x3d6c('0x3d')]){_0x3a69d1[_0x3d6c('0x3e')]=[{'all':!![]}];}return db[_0x3d6c('0x3c')]['findAll'](_0x3a69d1);})[_0x3d6c('0x23')](function(_0x5699b0){_0x216424['rows']=_0x5699b0;return _0x216424;})[_0x3d6c('0x23')](respondWithFilteredResult(_0x4dc900,_0x3a69d1))[_0x3d6c('0x3f')](handleError(_0x4dc900,null));};exports[_0x3d6c('0x40')]=function(_0x3ee4a5,_0x3e1f3d){var _0xd99900={'raw':!![],'where':{'id':_0x3ee4a5[_0x3d6c('0x41')]['id']}},_0x32347d={};_0x32347d['model']=_[_0x3d6c('0x42')](db['CmHopperAdditionalPhone'][_0x3d6c('0x43')]);_0x32347d['query']=_[_0x3d6c('0x42')](_0x3ee4a5['query']);_0x32347d['filters']=_['intersection'](_0x32347d[_0x3d6c('0x2d')],_0x32347d[_0x3d6c('0x2e')]);_0xd99900[_0x3d6c('0x31')]=_[_0x3d6c('0x30')](_0x32347d['model'],qs['fields'](_0x3ee4a5[_0x3d6c('0x2e')][_0x3d6c('0x32')]));_0xd99900[_0x3d6c('0x31')]=_0xd99900[_0x3d6c('0x31')][_0x3d6c('0x33')]?_0xd99900['attributes']:_0x32347d[_0x3d6c('0x2d')];if(_0x3ee4a5['query'][_0x3d6c('0x3d')]){_0xd99900['include']=[{'all':!![]}];}_0xd99900=_[_0x3d6c('0x3a')]({},_0xd99900,_0x3ee4a5['options']);return db[_0x3d6c('0x3c')]['find'](_0xd99900)[_0x3d6c('0x23')](handleEntityNotFound(_0x3e1f3d,null))['then'](respondWithResult(_0x3e1f3d,null))[_0x3d6c('0x3f')](handleError(_0x3e1f3d,null));};exports[_0x3d6c('0x44')]=function(_0x2434d9,_0x350861){return db[_0x3d6c('0x3c')]['create'](_0x2434d9[_0x3d6c('0x45')],{})[_0x3d6c('0x23')](function(_0x46ec9d){var _0x4185e8=_0x2434d9[_0x3d6c('0x46')][_0x3d6c('0x25')]({'plain':!![]});if(!_0x4185e8)throw new Error(_0x3d6c('0x47'));if(_0x4185e8[_0x3d6c('0x48')]===_0x3d6c('0x46')){var _0x25fb5d=_0x46ec9d[_0x3d6c('0x25')]({'plain':!![]});var _0x35cef2=_0x3d6c('0x49');return db['UserProfileSection'][_0x3d6c('0x4a')]({'where':{'name':_0x35cef2,'userProfileId':_0x4185e8[_0x3d6c('0x4b')]},'raw':!![]})[_0x3d6c('0x23')](function(_0x1eb145){if(_0x1eb145&&_0x1eb145['autoAssociation']===0x0){return db[_0x3d6c('0x4c')]['create']({'name':_0x25fb5d[_0x3d6c('0x26')],'resourceId':_0x25fb5d['id'],'type':_0x1eb145[_0x3d6c('0x26')],'sectionId':_0x1eb145['id']},{})['then'](function(){return _0x46ec9d;});}else{return _0x46ec9d;}})[_0x3d6c('0x3f')](function(_0xf1d175){logger['error'](_0x3d6c('0x4d'),_0xf1d175);throw _0xf1d175;});}return _0x46ec9d;})[_0x3d6c('0x23')](respondWithResult(_0x350861,0xc9))['catch'](handleError(_0x350861,null));};exports[_0x3d6c('0x4e')]=function(_0x351642,_0x2ef236){if(_0x351642[_0x3d6c('0x45')]['id']){delete _0x351642[_0x3d6c('0x45')]['id'];}return db[_0x3d6c('0x3c')][_0x3d6c('0x4a')]({'where':{'id':_0x351642[_0x3d6c('0x41')]['id']}})[_0x3d6c('0x23')](handleEntityNotFound(_0x2ef236,null))[_0x3d6c('0x23')](saveUpdates(_0x351642['body'],null))[_0x3d6c('0x23')](respondWithResult(_0x2ef236,null))[_0x3d6c('0x3f')](handleError(_0x2ef236,null));};exports[_0x3d6c('0x24')]=function(_0x3e3568,_0x3ec1d9){return db[_0x3d6c('0x3c')][_0x3d6c('0x4a')]({'where':{'id':_0x3e3568[_0x3d6c('0x41')]['id']}})[_0x3d6c('0x23')](handleEntityNotFound(_0x3ec1d9,null))['then'](removeEntity(_0x3ec1d9,null))[_0x3d6c('0x3f')](handleError(_0x3ec1d9,null));}; \ No newline at end of file +var _0x0b8d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation'];(function(_0x115d8d,_0xacde78){var _0x250c76=function(_0x5a5236){while(--_0x5a5236){_0x115d8d['push'](_0x115d8d['shift']());}};_0x250c76(++_0xacde78);}(_0x0b8d,0x107));var _0xd0b8=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x0b8d[_0x4d613c];return _0x301fe3;};'use strict';var emlformat=require(_0xd0b8('0x0'));var rimraf=require(_0xd0b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd0b8('0x2'));var rp=require(_0xd0b8('0x3'));var moment=require(_0xd0b8('0x4'));var BPromise=require(_0xd0b8('0x5'));var Mustache=require(_0xd0b8('0x6'));var util=require('util');var path=require(_0xd0b8('0x7'));var sox=require(_0xd0b8('0x8'));var csv=require(_0xd0b8('0x9'));var ejs=require(_0xd0b8('0xa'));var fs=require('fs');var fs_extra=require(_0xd0b8('0xb'));var _=require(_0xd0b8('0xc'));var squel=require('squel');var crypto=require(_0xd0b8('0xd'));var jsforce=require(_0xd0b8('0xe'));var deskjs=require(_0xd0b8('0xf'));var toCsv=require(_0xd0b8('0x9'));var querystring=require(_0xd0b8('0x10'));var Papa=require(_0xd0b8('0x11'));var Redis=require(_0xd0b8('0x12'));var authService=require(_0xd0b8('0x13'));var qs=require(_0xd0b8('0x14'));var as=require(_0xd0b8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0b8('0x16'))(_0xd0b8('0x17'));var utils=require(_0xd0b8('0x18'));var config=require(_0xd0b8('0x19'));var licenseUtil=require(_0xd0b8('0x1a'));var db=require(_0xd0b8('0x1b'))['db'];function respondWithStatusCode(_0x455dbd,_0x4344ad){_0x4344ad=_0x4344ad||0xcc;return function(_0x868478){if(_0x868478){return _0x455dbd['sendStatus'](_0x4344ad);}return _0x455dbd[_0xd0b8('0x1c')](_0x4344ad)[_0xd0b8('0x1d')]();};}function respondWithResult(_0x54ea72,_0x34c3d6){_0x34c3d6=_0x34c3d6||0xc8;return function(_0x426590){if(_0x426590){return _0x54ea72[_0xd0b8('0x1c')](_0x34c3d6)[_0xd0b8('0x1e')](_0x426590);}};}function respondWithFilteredResult(_0x516a0f,_0x2fcbee){return function(_0x143e20){if(_0x143e20){var _0x395734=typeof _0x2fcbee[_0xd0b8('0x1f')]===_0xd0b8('0x20')&&typeof _0x2fcbee['limit']===_0xd0b8('0x20');var _0x541b40=_0x143e20[_0xd0b8('0x21')];var _0x2b753f=_0x395734?0x0:_0x2fcbee['offset'];var _0x553a37=_0x395734?_0x143e20[_0xd0b8('0x21')]:_0x2fcbee[_0xd0b8('0x1f')]+_0x2fcbee['limit'];var _0x3a9486;if(_0x553a37>=_0x541b40){_0x553a37=_0x541b40;_0x3a9486=0xc8;}else{_0x3a9486=0xce;}_0x516a0f[_0xd0b8('0x1c')](_0x3a9486);return _0x516a0f[_0xd0b8('0x22')](_0xd0b8('0x23'),_0x2b753f+'-'+_0x553a37+'/'+_0x541b40)[_0xd0b8('0x1e')](_0x143e20);}return null;};}function patchUpdates(_0x3d8e00){return function(_0x2a71c1){try{jsonpatch[_0xd0b8('0x24')](_0x2a71c1,_0x3d8e00,!![]);}catch(_0x15b187){return BPromise[_0xd0b8('0x25')](_0x15b187);}return _0x2a71c1[_0xd0b8('0x26')]();};}function saveUpdates(_0x3aeb40,_0x1e8bc6){return function(_0x559c84){if(_0x559c84){return _0x559c84[_0xd0b8('0x27')](_0x3aeb40)[_0xd0b8('0x28')](function(_0xab2e1d){return _0xab2e1d;});}return null;};}function removeEntity(_0x51cc93,_0x530471){return function(_0x2a9e72){if(_0x2a9e72){return _0x2a9e72[_0xd0b8('0x29')]()[_0xd0b8('0x28')](function(){var _0x55e327=_0x2a9e72[_0xd0b8('0x2a')]({'plain':!![]});var _0x479443='CmHopperAdditionalPhones';return db[_0xd0b8('0x2b')]['destroy']({'where':{'type':_0x479443,'resourceId':_0x55e327['id']}})[_0xd0b8('0x28')](function(){return _0x2a9e72;});})['then'](function(){_0x51cc93[_0xd0b8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34cdba,_0x3546c8){return function(_0x385f3d){if(!_0x385f3d){_0x34cdba['sendStatus'](0x194);}return _0x385f3d;};}function handleError(_0x5f0303,_0x595010){_0x595010=_0x595010||0x1f4;return function(_0x3781e4){logger[_0xd0b8('0x2c')](_0x3781e4['stack']);if(_0x3781e4[_0xd0b8('0x2d')]){delete _0x3781e4[_0xd0b8('0x2d')];}_0x5f0303['status'](_0x595010)[_0xd0b8('0x2e')](_0x3781e4);};}exports['index']=function(_0x3eebf7,_0x37f808){var _0x8dc863={},_0x551cbf={},_0x2b9559={'count':0x0,'rows':[]};var _0x17c320=_[_0xd0b8('0x2f')](db[_0xd0b8('0x30')][_0xd0b8('0x31')],function(_0x3b3e75){return{'name':_0x3b3e75[_0xd0b8('0x32')],'type':_0x3b3e75['type'][_0xd0b8('0x33')]};});_0x551cbf['model']=_['map'](_0x17c320,_0xd0b8('0x2d'));_0x551cbf[_0xd0b8('0x34')]=_['keys'](_0x3eebf7[_0xd0b8('0x34')]);_0x551cbf[_0xd0b8('0x35')]=_['intersection'](_0x551cbf['model'],_0x551cbf[_0xd0b8('0x34')]);_0x8dc863[_0xd0b8('0x36')]=_[_0xd0b8('0x37')](_0x551cbf[_0xd0b8('0x38')],qs[_0xd0b8('0x39')](_0x3eebf7['query'][_0xd0b8('0x39')]));_0x8dc863[_0xd0b8('0x36')]=_0x8dc863[_0xd0b8('0x36')][_0xd0b8('0x3a')]?_0x8dc863[_0xd0b8('0x36')]:_0x551cbf[_0xd0b8('0x38')];if(!_0x3eebf7[_0xd0b8('0x34')][_0xd0b8('0x3b')](_0xd0b8('0x3c'))){_0x8dc863[_0xd0b8('0x3d')]=qs['limit'](_0x3eebf7[_0xd0b8('0x34')]['limit']);_0x8dc863['offset']=qs[_0xd0b8('0x1f')](_0x3eebf7[_0xd0b8('0x34')][_0xd0b8('0x1f')]);}_0x8dc863['order']=qs['sort'](_0x3eebf7[_0xd0b8('0x34')][_0xd0b8('0x3e')]);_0x8dc863[_0xd0b8('0x3f')]=qs[_0xd0b8('0x35')](_[_0xd0b8('0x40')](_0x3eebf7[_0xd0b8('0x34')],_0x551cbf['filters']),_0x17c320);if(_0x3eebf7[_0xd0b8('0x34')][_0xd0b8('0x41')]){_0x8dc863[_0xd0b8('0x3f')]=_[_0xd0b8('0x42')](_0x8dc863[_0xd0b8('0x3f')],{'$or':_[_0xd0b8('0x2f')](_0x17c320,function(_0x59b25a){if(_0x59b25a[_0xd0b8('0x43')]!=='VIRTUAL'){var _0x29b88f={};_0x29b88f[_0x59b25a[_0xd0b8('0x2d')]]={'$like':'%'+_0x3eebf7[_0xd0b8('0x34')]['filter']+'%'};return _0x29b88f;}})});}_0x8dc863=_[_0xd0b8('0x42')]({},_0x8dc863,_0x3eebf7[_0xd0b8('0x44')]);var _0x164b00={'where':_0x8dc863[_0xd0b8('0x3f')]};return db[_0xd0b8('0x30')][_0xd0b8('0x21')](_0x164b00)[_0xd0b8('0x28')](function(_0x1b983f){_0x2b9559[_0xd0b8('0x21')]=_0x1b983f;if(_0x3eebf7[_0xd0b8('0x34')][_0xd0b8('0x45')]){_0x8dc863[_0xd0b8('0x46')]=[{'all':!![]}];}return db[_0xd0b8('0x30')]['findAll'](_0x8dc863);})[_0xd0b8('0x28')](function(_0x38e86f){_0x2b9559[_0xd0b8('0x47')]=_0x38e86f;return _0x2b9559;})['then'](respondWithFilteredResult(_0x37f808,_0x8dc863))['catch'](handleError(_0x37f808,null));};exports[_0xd0b8('0x48')]=function(_0x57a2f6,_0x23189a){var _0x3f2dce={'raw':!![],'where':{'id':_0x57a2f6['params']['id']}},_0x564db7={};_0x564db7[_0xd0b8('0x38')]=_[_0xd0b8('0x49')](db[_0xd0b8('0x30')][_0xd0b8('0x31')]);_0x564db7[_0xd0b8('0x34')]=_[_0xd0b8('0x49')](_0x57a2f6[_0xd0b8('0x34')]);_0x564db7[_0xd0b8('0x35')]=_[_0xd0b8('0x37')](_0x564db7[_0xd0b8('0x38')],_0x564db7[_0xd0b8('0x34')]);_0x3f2dce[_0xd0b8('0x36')]=_[_0xd0b8('0x37')](_0x564db7[_0xd0b8('0x38')],qs[_0xd0b8('0x39')](_0x57a2f6[_0xd0b8('0x34')][_0xd0b8('0x39')]));_0x3f2dce[_0xd0b8('0x36')]=_0x3f2dce[_0xd0b8('0x36')][_0xd0b8('0x3a')]?_0x3f2dce['attributes']:_0x564db7[_0xd0b8('0x38')];if(_0x57a2f6[_0xd0b8('0x34')][_0xd0b8('0x45')]){_0x3f2dce['include']=[{'all':!![]}];}_0x3f2dce=_[_0xd0b8('0x42')]({},_0x3f2dce,_0x57a2f6['options']);return db['CmHopperAdditionalPhone'][_0xd0b8('0x4a')](_0x3f2dce)['then'](handleEntityNotFound(_0x23189a,null))[_0xd0b8('0x28')](respondWithResult(_0x23189a,null))[_0xd0b8('0x4b')](handleError(_0x23189a,null));};exports[_0xd0b8('0x4c')]=function(_0x3108e3,_0xa1f163){return db['CmHopperAdditionalPhone'][_0xd0b8('0x4c')](_0x3108e3[_0xd0b8('0x4d')],{})['then'](function(_0x5ba4e8){var _0x168014=_0x3108e3['user']['get']({'plain':!![]});if(!_0x168014)throw new Error(_0xd0b8('0x4e'));if(_0x168014[_0xd0b8('0x4f')]===_0xd0b8('0x50')){var _0x373478=_0x5ba4e8[_0xd0b8('0x2a')]({'plain':!![]});var _0x4dcab3=_0xd0b8('0x51');return db[_0xd0b8('0x52')][_0xd0b8('0x4a')]({'where':{'name':_0x4dcab3,'userProfileId':_0x168014[_0xd0b8('0x53')]},'raw':!![]})[_0xd0b8('0x28')](function(_0x5a517b){if(_0x5a517b&&_0x5a517b[_0xd0b8('0x54')]===0x0){return db[_0xd0b8('0x2b')][_0xd0b8('0x4c')]({'name':_0x373478[_0xd0b8('0x2d')],'resourceId':_0x373478['id'],'type':_0x5a517b[_0xd0b8('0x2d')],'sectionId':_0x5a517b['id']},{})[_0xd0b8('0x28')](function(){return _0x5ba4e8;});}else{return _0x5ba4e8;}})[_0xd0b8('0x4b')](function(_0x55707d){logger['error'](_0xd0b8('0x55'),_0x55707d);throw _0x55707d;});}return _0x5ba4e8;})[_0xd0b8('0x28')](respondWithResult(_0xa1f163,0xc9))[_0xd0b8('0x4b')](handleError(_0xa1f163,null));};exports[_0xd0b8('0x27')]=function(_0x4637b5,_0x8bec8e){if(_0x4637b5[_0xd0b8('0x4d')]['id']){delete _0x4637b5['body']['id'];}return db[_0xd0b8('0x30')][_0xd0b8('0x4a')]({'where':{'id':_0x4637b5[_0xd0b8('0x56')]['id']}})[_0xd0b8('0x28')](handleEntityNotFound(_0x8bec8e,null))[_0xd0b8('0x28')](saveUpdates(_0x4637b5[_0xd0b8('0x4d')],null))[_0xd0b8('0x28')](respondWithResult(_0x8bec8e,null))[_0xd0b8('0x4b')](handleError(_0x8bec8e,null));};exports[_0xd0b8('0x29')]=function(_0xa307e3,_0xc2667e){return db['CmHopperAdditionalPhone'][_0xd0b8('0x4a')]({'where':{'id':_0xa307e3[_0xd0b8('0x56')]['id']}})[_0xd0b8('0x28')](handleEntityNotFound(_0xc2667e,null))[_0xd0b8('0x28')](removeEntity(_0xc2667e,null))['catch'](handleError(_0xc2667e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index b5eaf70..8b52221 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 _0xe497=['moment','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash'];(function(_0x5e228b,_0x3a7269){var _0x292b3b=function(_0x5db2e8){while(--_0x5db2e8){_0x5e228b['push'](_0x5e228b['shift']());}};_0x292b3b(++_0x3a7269);}(_0xe497,0x1c1));var _0x7e49=function(_0x126831,_0x4a5fa2){_0x126831=_0x126831-0x0;var _0xf72304=_0xe497[_0x126831];return _0xf72304;};'use strict';var _=require(_0x7e49('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7e49('0x1'));var BPromise=require('bluebird');var rp=require(_0x7e49('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e49('0x3'));var config=require(_0x7e49('0x4'));var attributes=require(_0x7e49('0x5'));module[_0x7e49('0x6')]=function(_0x169eef,_0x472c4d){return _0x169eef[_0x7e49('0x7')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x7e49('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5da1=['CmHopperAdditionalPhone','cm_hopper_additional_phones','api','moment','bluebird','path','../../config/environment','./cmHopperAdditionalPhone.attributes','define'];(function(_0x41a96e,_0x36bf41){var _0x2b7b54=function(_0x65f3f0){while(--_0x65f3f0){_0x41a96e['push'](_0x41a96e['shift']());}};_0x2b7b54(++_0x36bf41);}(_0x5da1,0xbf));var _0x15da=function(_0x16f3c0,_0x175a36){_0x16f3c0=_0x16f3c0-0x0;var _0x24fcc9=_0x5da1[_0x16f3c0];return _0x24fcc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x15da('0x0'));var moment=require(_0x15da('0x1'));var BPromise=require(_0x15da('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15da('0x3'));var rimraf=require('rimraf');var config=require(_0x15da('0x4'));var attributes=require(_0x15da('0x5'));module['exports']=function(_0x261900,_0x4054bd){return _0x261900[_0x15da('0x6')](_0x15da('0x7'),attributes,{'tableName':_0x15da('0x8'),'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 b63d0d0..00b645b 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 _0xfe53=['waitTime','duration','isNil','scheduledat','minutes','add','phone','countabandonedretry','createdAt','updatedAt','transaction','CmHopper','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countmachineretry','catch','VerifyAdditionalPhones','SwapAdditionalPhones'];(function(_0x3b5d96,_0x347ff1){var _0xa552b5=function(_0x57bad1){while(--_0x57bad1){_0x3b5d96['push'](_0x3b5d96['shift']());}};_0xa552b5(++_0x347ff1);}(_0xfe53,0x146));var _0x3fe5=function(_0x2e78fd,_0x474e23){_0x2e78fd=_0x2e78fd-0x0;var _0x1f2d6a=_0xfe53[_0x2e78fd];return _0x1f2d6a;};'use strict';var _=require(_0x3fe5('0x0'));var util=require(_0x3fe5('0x1'));var moment=require('moment');var BPromise=require(_0x3fe5('0x2'));var rs=require(_0x3fe5('0x3'));var fs=require('fs');var Redis=require(_0x3fe5('0x4'));var db=require(_0x3fe5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3fe5('0x6'));var client=jayson[_0x3fe5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2796a6,_0x40d830,_0x4fca75){return new BPromise(function(_0x339f0a,_0x4a2a01){return client[_0x3fe5('0x8')](_0x2796a6,_0x4fca75)[_0x3fe5('0x9')](function(_0x2997da){logger[_0x3fe5('0xa')](_0x3fe5('0xb'),_0x40d830,_0x3fe5('0xc'));logger[_0x3fe5('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x40d830,_0x3fe5('0xc'),JSON['stringify'](_0x2997da));if(_0x2997da['error']){if(_0x2997da[_0x3fe5('0xe')][_0x3fe5('0xf')]===0x1f4){logger[_0x3fe5('0xe')](_0x3fe5('0xb'),_0x40d830,_0x2997da[_0x3fe5('0xe')]['message']);return _0x4a2a01(_0x2997da[_0x3fe5('0xe')][_0x3fe5('0x10')]);}logger['error'](_0x3fe5('0xb'),_0x40d830,_0x2997da['error'][_0x3fe5('0x10')]);return _0x339f0a(_0x2997da[_0x3fe5('0xe')][_0x3fe5('0x10')]);}else{logger[_0x3fe5('0xa')](_0x3fe5('0xb'),_0x40d830,_0x3fe5('0xc'));_0x339f0a(_0x2997da[_0x3fe5('0x11')][_0x3fe5('0x10')]);}})['catch'](function(_0x35b0f1){logger[_0x3fe5('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x40d830,_0x35b0f1);_0x4a2a01(_0x35b0f1);});});}exports['VerifyAdditionalPhones']=function(_0xaf6d38){var _0xd387e8=this;return new Promise(function(_0x517cf3,_0x43743d){return db['CmHopper'][_0x3fe5('0x12')]({'raw':!![],'where':{'ContactId':_0xaf6d38[_0x3fe5('0x13')][_0x3fe5('0x14')],'ListId':_0xaf6d38[_0x3fe5('0x13')]['ListId'],'VoiceQueueId':_0xaf6d38[_0x3fe5('0x13')][_0x3fe5('0x15')]===undefined?null:_0xaf6d38['body']['VoiceQueueId'],'CampaignId':_0xaf6d38['body'][_0x3fe5('0x16')]===undefined?null:_0xaf6d38[_0x3fe5('0x13')]['CampaignId']}})['then'](function(_0x20827b){if(_0x20827b!=null){return db[_0x3fe5('0x17')][_0x3fe5('0x12')]({'raw':!![],'where':{'CmHopperId':_0x20827b['id'],'OrderBy':{'$gt':_0x20827b[_0x3fe5('0x18')]}},'order':[[_0x3fe5('0x18'),_0x3fe5('0x19')]]})[_0x3fe5('0x9')](function(_0x4b98c4){var _0x19eca8=0x0;if(_0x4b98c4){if(_0x4b98c4[_0x3fe5('0x1a')]+_0x4b98c4[_0x3fe5('0x1b')]+_0x4b98c4[_0x3fe5('0x1c')]+_0x4b98c4['countnosuchnumberretry']+_0x4b98c4[_0x3fe5('0x1d')]+_0x4b98c4['countabandonedretry']+_0x4b98c4['countmachineretry']+_0x4b98c4[_0x3fe5('0x1e')]<_0xaf6d38[_0x3fe5('0x1f')][_0x3fe5('0x20')])_0x19eca8=0x1;_0x517cf3({'additional':_0x19eca8});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x20827b['id']},'order':[[_0x3fe5('0x18'),_0x3fe5('0x19')]]})['then'](function(_0x29ad26){var _0x4d5d74=0x0;if(_0x29ad26){if(_0x29ad26[_0x3fe5('0x1a')]+_0x29ad26['countcongestionretry']+_0x29ad26['countnoanswerretry']+_0x29ad26[_0x3fe5('0x21')]+_0x29ad26[_0x3fe5('0x1d')]+_0x29ad26['countabandonedretry']+_0x29ad26[_0x3fe5('0x22')]+_0x29ad26['countagentrejectretry']<_0xaf6d38[_0x3fe5('0x1f')][_0x3fe5('0x20')])_0x4d5d74=0x1;_0x517cf3({'additional':_0x4d5d74});}else{_0x517cf3({'additional':0x0});}})[_0x3fe5('0x23')](function(_0x3fda2e){logger[_0x3fe5('0xe')]('VerifyAdditionalPhones',_0x3fda2e[_0x3fe5('0x10')]);_0x43743d(_0xd387e8[_0x3fe5('0xe')](0x1f4,_0x3fda2e[_0x3fe5('0x10')]));});}})[_0x3fe5('0x23')](function(_0x4828fb){logger['error'](_0x3fe5('0x24'),_0x4828fb[_0x3fe5('0x10')]);_0x43743d(_0xd387e8[_0x3fe5('0xe')](0x1f4,_0x4828fb[_0x3fe5('0x10')]));});}else _0x517cf3({'additional':0x0});});});};exports[_0x3fe5('0x25')]=function(_0x509c5b){var _0x378b57=this;return new Promise(function(_0x1b0c3a,_0x4cc3a0){return db['CmHopper'][_0x3fe5('0x12')]({'raw':!![],'where':{'ContactId':_0x509c5b['body'][_0x3fe5('0x14')],'ListId':_0x509c5b[_0x3fe5('0x13')]['ListId'],'VoiceQueueId':_0x509c5b[_0x3fe5('0x13')]['VoiceQueueId']===undefined?null:_0x509c5b[_0x3fe5('0x13')][_0x3fe5('0x15')],'CampaignId':_0x509c5b['body']['CampaignId']===undefined?null:_0x509c5b[_0x3fe5('0x13')][_0x3fe5('0x16')]}})[_0x3fe5('0x9')](function(_0x15ee38){if(_0x15ee38!=null){return db[_0x3fe5('0x17')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x15ee38['id'],'OrderBy':{'$gte':_0x15ee38[_0x3fe5('0x18')]}},'order':[['OrderBy',_0x3fe5('0x19')]]})[_0x3fe5('0x9')](function(_0xdd0d6){if(_0xdd0d6)return activateAdditionalPhone(_0x15ee38,_0x509c5b['body'],_0xdd0d6,_0x509c5b['duration'],_0x509c5b[_0x3fe5('0x26')])[_0x3fe5('0x9')](function(_0x26342a){_0x1b0c3a(_0x26342a);});else{return db[_0x3fe5('0x17')][_0x3fe5('0x12')]({'raw':!![],'where':{'CmHopperId':_0x15ee38['id']},'order':[[_0x3fe5('0x18'),_0x3fe5('0x19')]]})[_0x3fe5('0x9')](function(_0x436746){if(_0x436746)return activateAdditionalPhone(_0x15ee38,_0x509c5b[_0x3fe5('0x13')],_0x436746,_0x509c5b[_0x3fe5('0x27')],_0x509c5b[_0x3fe5('0x26')])[_0x3fe5('0x9')](function(_0x3da92e){_0x1b0c3a(_0x3da92e);});else{_0x1b0c3a({'id':_0x15ee38['id'],'phone':''});}})[_0x3fe5('0x23')](function(_0x1d6751){logger[_0x3fe5('0xe')](_0x3fe5('0x24'),_0x1d6751[_0x3fe5('0x10')]);_0x4cc3a0(_0x378b57[_0x3fe5('0xe')](0x1f4,_0x1d6751[_0x3fe5('0x10')]));});}})[_0x3fe5('0x23')](function(_0x5b551d){logger[_0x3fe5('0xe')](_0x3fe5('0x24'),_0x5b551d[_0x3fe5('0x10')]);_0x4cc3a0(_0x378b57[_0x3fe5('0xe')](0x1f4,_0x5b551d[_0x3fe5('0x10')]));});}else _0x1b0c3a(0x1);});});};function activateAdditionalPhone(_0x309e52,_0x948a13,_0x355e88,_0x1fe26f,_0x30f23a){return new Promise(function(_0x3c62df,_0x4ae707){var _0x48a0f9;if(_[_0x3fe5('0x28')](_0x355e88[_0x3fe5('0x29')])){_0x355e88[_0x3fe5('0x29')]=moment();}if(moment()>moment(_0x355e88[_0x3fe5('0x29')])){_0x48a0f9=moment()['add'](_0x30f23a||0x3,_0x3fe5('0x2a'));}else{if(_0x355e88[_0x3fe5('0x18')]==0x0){_0x48a0f9=moment(_0x355e88[_0x3fe5('0x29')]);}else{_0x48a0f9=moment()[_0x3fe5('0x2b')](_0x30f23a||0x3,_0x3fe5('0x2a'));}}if(_[_0x3fe5('0x28')](_0x48a0f9)){_0x48a0f9=moment()[_0x3fe5('0x2b')](_0x30f23a||0x3,_0x3fe5('0x2a'));}var _0x5a422b={'phone':_0x309e52[_0x3fe5('0x2c')],'active':0x0,'OrderBy':_['isNil'](_0x309e52[_0x3fe5('0x18')])?0x0:_0x309e52[_0x3fe5('0x18')],'scheduledat':moment()['add'](_0x1fe26f||0x1,_0x3fe5('0x2a')),'countbusyretry':_0x948a13[_0x3fe5('0x1a')],'countcongestionretry':_0x948a13['countcongestionretry'],'countnoanswerretry':_0x948a13[_0x3fe5('0x1c')],'countnosuchnumberretry':_0x948a13['countnosuchnumberretry'],'countdropretry':_0x948a13[_0x3fe5('0x1d')],'countabandonedretry':_0x948a13[_0x3fe5('0x2d')],'countmachineretry':_0x948a13[_0x3fe5('0x22')],'countagentrejectretry':_0x948a13[_0x3fe5('0x1e')],'createdAt':_0x948a13[_0x3fe5('0x2e')],'updatedAt':_0x948a13['updatedAt']};var _0x86b5fc={'CmHopperId':_0x309e52['id'],'phone':_0x355e88[_0x3fe5('0x2c')],'active':0x0,'OrderBy':_[_0x3fe5('0x28')](_0x355e88[_0x3fe5('0x18')])?0x0:_0x355e88[_0x3fe5('0x18')],'scheduledat':_0x48a0f9,'countbusyretry':_0x355e88[_0x3fe5('0x1a')],'countcongestionretry':_0x355e88[_0x3fe5('0x1b')],'countnoanswerretry':_0x355e88['countnoanswerretry'],'countnosuchnumberretry':_0x355e88[_0x3fe5('0x21')],'countdropretry':_0x355e88[_0x3fe5('0x1d')],'countabandonedretry':_0x355e88[_0x3fe5('0x2d')],'countmachineretry':_0x355e88[_0x3fe5('0x22')],'countagentrejectretry':_0x355e88['countagentrejectretry'],'createdAt':_0x355e88['createdAt'],'updatedAt':_0x355e88[_0x3fe5('0x2f')]};return db['sequelize'][_0x3fe5('0x30')](function(_0x2f921d){return db[_0x3fe5('0x17')]['update'](_0x5a422b,{'where':{'id':_0x355e88['id']}},{'transaction':_0x2f921d})[_0x3fe5('0x9')](function(){return db[_0x3fe5('0x31')]['update'](_0x86b5fc,{'where':{'id':_0x309e52['id']}},{'transaction':_0x2f921d});});})[_0x3fe5('0x9')](function(_0x43509e){_0x3c62df({'id':_0x309e52['id'],'phone':_0x355e88['phone']});})[_0x3fe5('0x23')](function(_0x295200){logger[_0x3fe5('0xe')]('activateAdditionalPhone',_0x295200[_0x3fe5('0x10')]);_0x4ae707({'error':_0x295200[_0x3fe5('0x10')]});});});}exports[_0x3fe5('0x32')]=function(_0x12d941){var _0x51bcb2=this;return new Promise(function(_0x263b74,_0xcd0087){return db['CmHopper']['update'](_0x12d941[_0x3fe5('0x13')][_0x3fe5('0x33')],{'where':{'id':_0x12d941['body']['id']}})['then'](function(_0x2451b8){_0x263b74(_0x2451b8);})[_0x3fe5('0x23')](function(_0x24b2c9){logger[_0x3fe5('0xe')](_0x3fe5('0x32'),_0x24b2c9[_0x3fe5('0x10')]);_0xcd0087(_0x51bcb2[_0x3fe5('0xe')](0x1f4,_0x24b2c9[_0x3fe5('0x10')]));});});}; \ No newline at end of file +var _0xc6fa=['waitTime','duration','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','findOne','OrderBy','ASC','then','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','entity','dialGlobalMaxRetry','countabandonedretry','countagentrejectretry','catch','VerifyAdditionalPhones','CmHopper'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc6fa,0xbd));var _0xac6f=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0xc6fa[_0x3cfb0d];return _0x3486b4;};'use strict';var _=require(_0xac6f('0x0'));var util=require(_0xac6f('0x1'));var moment=require(_0xac6f('0x2'));var BPromise=require(_0xac6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac6f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac6f('0x5'));var logger=require(_0xac6f('0x6'))(_0xac6f('0x7'));var config=require(_0xac6f('0x8'));var jayson=require(_0xac6f('0x9'));var client=jayson['client'][_0xac6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b3b60,_0x9335ff,_0xdbdb88){return new BPromise(function(_0xf719dc,_0x1b4209){return client['request'](_0x5b3b60,_0xdbdb88)['then'](function(_0x367c3a){logger[_0xac6f('0xb')](_0xac6f('0xc'),_0x9335ff,_0xac6f('0xd'));logger[_0xac6f('0xe')](_0xac6f('0xf'),_0x9335ff,_0xac6f('0xd'),JSON[_0xac6f('0x10')](_0x367c3a));if(_0x367c3a[_0xac6f('0x11')]){if(_0x367c3a[_0xac6f('0x11')]['code']===0x1f4){logger[_0xac6f('0x11')](_0xac6f('0xc'),_0x9335ff,_0x367c3a[_0xac6f('0x11')][_0xac6f('0x12')]);return _0x1b4209(_0x367c3a['error']['message']);}logger[_0xac6f('0x11')](_0xac6f('0xc'),_0x9335ff,_0x367c3a['error'][_0xac6f('0x12')]);return _0xf719dc(_0x367c3a[_0xac6f('0x11')][_0xac6f('0x12')]);}else{logger[_0xac6f('0xb')](_0xac6f('0xc'),_0x9335ff,_0xac6f('0xd'));_0xf719dc(_0x367c3a[_0xac6f('0x13')]['message']);}})['catch'](function(_0x4998a6){logger[_0xac6f('0x11')](_0xac6f('0xc'),_0x9335ff,_0x4998a6);_0x1b4209(_0x4998a6);});});}exports['VerifyAdditionalPhones']=function(_0x405b9a){var _0x330f52=this;return new Promise(function(_0x525408,_0x49e69d){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x405b9a['body'][_0xac6f('0x14')],'ListId':_0x405b9a[_0xac6f('0x15')][_0xac6f('0x16')],'VoiceQueueId':_0x405b9a[_0xac6f('0x15')][_0xac6f('0x17')]===undefined?null:_0x405b9a['body'][_0xac6f('0x17')],'CampaignId':_0x405b9a[_0xac6f('0x15')][_0xac6f('0x18')]===undefined?null:_0x405b9a['body']['CampaignId']}})['then'](function(_0x39ba4a){if(_0x39ba4a!=null){return db[_0xac6f('0x19')][_0xac6f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x39ba4a['id'],'OrderBy':{'$gt':_0x39ba4a[_0xac6f('0x1b')]}},'order':[[_0xac6f('0x1b'),_0xac6f('0x1c')]]})[_0xac6f('0x1d')](function(_0x14774e){var _0x35faa5=0x0;if(_0x14774e){if(_0x14774e[_0xac6f('0x1e')]+_0x14774e[_0xac6f('0x1f')]+_0x14774e[_0xac6f('0x20')]+_0x14774e[_0xac6f('0x21')]+_0x14774e[_0xac6f('0x22')]+_0x14774e['countabandonedretry']+_0x14774e[_0xac6f('0x23')]+_0x14774e['countagentrejectretry']<_0x405b9a[_0xac6f('0x24')][_0xac6f('0x25')])_0x35faa5=0x1;_0x525408({'additional':_0x35faa5});}else{return db[_0xac6f('0x19')][_0xac6f('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x39ba4a['id']},'order':[['OrderBy',_0xac6f('0x1c')]]})[_0xac6f('0x1d')](function(_0x464260){var _0x59477d=0x0;if(_0x464260){if(_0x464260[_0xac6f('0x1e')]+_0x464260[_0xac6f('0x1f')]+_0x464260[_0xac6f('0x20')]+_0x464260[_0xac6f('0x21')]+_0x464260[_0xac6f('0x22')]+_0x464260[_0xac6f('0x26')]+_0x464260['countmachineretry']+_0x464260[_0xac6f('0x27')]<_0x405b9a['entity'][_0xac6f('0x25')])_0x59477d=0x1;_0x525408({'additional':_0x59477d});}else{_0x525408({'additional':0x0});}})[_0xac6f('0x28')](function(_0x1bacea){logger[_0xac6f('0x11')](_0xac6f('0x29'),_0x1bacea[_0xac6f('0x12')]);_0x49e69d(_0x330f52[_0xac6f('0x11')](0x1f4,_0x1bacea[_0xac6f('0x12')]));});}})[_0xac6f('0x28')](function(_0x12875a){logger['error'](_0xac6f('0x29'),_0x12875a[_0xac6f('0x12')]);_0x49e69d(_0x330f52[_0xac6f('0x11')](0x1f4,_0x12875a[_0xac6f('0x12')]));});}else _0x525408({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x1006c7){var _0x2d8f56=this;return new Promise(function(_0x234579,_0xa2bffa){return db[_0xac6f('0x2a')][_0xac6f('0x1a')]({'raw':!![],'where':{'ContactId':_0x1006c7[_0xac6f('0x15')][_0xac6f('0x14')],'ListId':_0x1006c7[_0xac6f('0x15')][_0xac6f('0x16')],'VoiceQueueId':_0x1006c7[_0xac6f('0x15')][_0xac6f('0x17')]===undefined?null:_0x1006c7['body'][_0xac6f('0x17')],'CampaignId':_0x1006c7[_0xac6f('0x15')][_0xac6f('0x18')]===undefined?null:_0x1006c7[_0xac6f('0x15')][_0xac6f('0x18')]}})[_0xac6f('0x1d')](function(_0x39cba0){if(_0x39cba0!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x39cba0['id'],'OrderBy':{'$gte':_0x39cba0[_0xac6f('0x1b')]}},'order':[[_0xac6f('0x1b'),'ASC']]})[_0xac6f('0x1d')](function(_0x4e504e){if(_0x4e504e)return activateAdditionalPhone(_0x39cba0,_0x1006c7[_0xac6f('0x15')],_0x4e504e,_0x1006c7['duration'],_0x1006c7[_0xac6f('0x2b')])[_0xac6f('0x1d')](function(_0x344e11){_0x234579(_0x344e11);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x39cba0['id']},'order':[[_0xac6f('0x1b'),'ASC']]})[_0xac6f('0x1d')](function(_0x12e9b9){if(_0x12e9b9)return activateAdditionalPhone(_0x39cba0,_0x1006c7[_0xac6f('0x15')],_0x12e9b9,_0x1006c7[_0xac6f('0x2c')],_0x1006c7['waitTime'])[_0xac6f('0x1d')](function(_0x1e5626){_0x234579(_0x1e5626);});else{_0x234579({'id':_0x39cba0['id'],'phone':''});}})['catch'](function(_0x33185e){logger[_0xac6f('0x11')](_0xac6f('0x29'),_0x33185e[_0xac6f('0x12')]);_0xa2bffa(_0x2d8f56['error'](0x1f4,_0x33185e[_0xac6f('0x12')]));});}})['catch'](function(_0x42988a){logger[_0xac6f('0x11')](_0xac6f('0x29'),_0x42988a['message']);_0xa2bffa(_0x2d8f56[_0xac6f('0x11')](0x1f4,_0x42988a['message']));});}else _0x234579(0x1);});});};function activateAdditionalPhone(_0xf95d0b,_0x3b6626,_0x46f60b,_0x2ba17d,_0x4e1c31){return new Promise(function(_0x3093ee,_0x1b0baa){var _0x437c7c;if(_['isNil'](_0x46f60b['scheduledat'])){_0x46f60b[_0xac6f('0x2d')]=moment();}if(moment()>moment(_0x46f60b[_0xac6f('0x2d')])){_0x437c7c=moment()[_0xac6f('0x2e')](_0x4e1c31||0x3,_0xac6f('0x2f'));}else{if(_0x46f60b[_0xac6f('0x1b')]==0x0){_0x437c7c=moment(_0x46f60b[_0xac6f('0x2d')]);}else{_0x437c7c=moment()[_0xac6f('0x2e')](_0x4e1c31||0x3,'minutes');}}if(_[_0xac6f('0x30')](_0x437c7c)){_0x437c7c=moment()[_0xac6f('0x2e')](_0x4e1c31||0x3,_0xac6f('0x2f'));}var _0x3be816={'phone':_0xf95d0b[_0xac6f('0x31')],'active':0x0,'OrderBy':_[_0xac6f('0x30')](_0xf95d0b['OrderBy'])?0x0:_0xf95d0b[_0xac6f('0x1b')],'scheduledat':moment()[_0xac6f('0x2e')](_0x2ba17d||0x1,_0xac6f('0x2f')),'countbusyretry':_0x3b6626[_0xac6f('0x1e')],'countcongestionretry':_0x3b6626[_0xac6f('0x1f')],'countnoanswerretry':_0x3b6626['countnoanswerretry'],'countnosuchnumberretry':_0x3b6626[_0xac6f('0x21')],'countdropretry':_0x3b6626[_0xac6f('0x22')],'countabandonedretry':_0x3b6626[_0xac6f('0x26')],'countmachineretry':_0x3b6626[_0xac6f('0x23')],'countagentrejectretry':_0x3b6626[_0xac6f('0x27')],'createdAt':_0x3b6626[_0xac6f('0x32')],'updatedAt':_0x3b6626[_0xac6f('0x33')]};var _0x5a0d41={'CmHopperId':_0xf95d0b['id'],'phone':_0x46f60b['phone'],'active':0x0,'OrderBy':_[_0xac6f('0x30')](_0x46f60b[_0xac6f('0x1b')])?0x0:_0x46f60b[_0xac6f('0x1b')],'scheduledat':_0x437c7c,'countbusyretry':_0x46f60b['countbusyretry'],'countcongestionretry':_0x46f60b[_0xac6f('0x1f')],'countnoanswerretry':_0x46f60b[_0xac6f('0x20')],'countnosuchnumberretry':_0x46f60b[_0xac6f('0x21')],'countdropretry':_0x46f60b[_0xac6f('0x22')],'countabandonedretry':_0x46f60b[_0xac6f('0x26')],'countmachineretry':_0x46f60b[_0xac6f('0x23')],'countagentrejectretry':_0x46f60b[_0xac6f('0x27')],'createdAt':_0x46f60b[_0xac6f('0x32')],'updatedAt':_0x46f60b[_0xac6f('0x33')]};return db[_0xac6f('0x34')][_0xac6f('0x35')](function(_0x39303a){return db[_0xac6f('0x19')][_0xac6f('0x36')](_0x3be816,{'where':{'id':_0x46f60b['id']}},{'transaction':_0x39303a})['then'](function(){return db[_0xac6f('0x2a')][_0xac6f('0x36')](_0x5a0d41,{'where':{'id':_0xf95d0b['id']}},{'transaction':_0x39303a});});})['then'](function(_0x246ed5){_0x3093ee({'id':_0xf95d0b['id'],'phone':_0x46f60b['phone']});})[_0xac6f('0x28')](function(_0x2f08f0){logger[_0xac6f('0x11')](_0xac6f('0x37'),_0x2f08f0[_0xac6f('0x12')]);_0x1b0baa({'error':_0x2f08f0[_0xac6f('0x12')]});});});}exports[_0xac6f('0x38')]=function(_0x27febb){var _0x30cc38=this;return new Promise(function(_0x58cbc8,_0x708046){return db[_0xac6f('0x2a')][_0xac6f('0x36')](_0x27febb[_0xac6f('0x15')][_0xac6f('0x39')],{'where':{'id':_0x27febb[_0xac6f('0x15')]['id']}})[_0xac6f('0x1d')](function(_0x403b58){_0x58cbc8(_0x403b58);})[_0xac6f('0x28')](function(_0x1a4b68){logger[_0xac6f('0x11')]('IncrementPreviewCounters',_0x1a4b68[_0xac6f('0x12')]);_0x708046(_0x30cc38[_0xac6f('0x11')](0x1f4,_0x1a4b68[_0xac6f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1f040a6..1002e5d 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 _0x243b=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','post','create','update'];(function(_0x5c4fb3,_0x3a30fb){var _0x2070ef=function(_0x1712c1){while(--_0x1712c1){_0x5c4fb3['push'](_0x5c4fb3['shift']());}};_0x2070ef(++_0x3a30fb);}(_0x243b,0x9c));var _0xb243=function(_0x373cc7,_0x3e965b){_0x373cc7=_0x373cc7-0x0;var _0x3bea18=_0x243b[_0x373cc7];return _0x3bea18;};'use strict';var multer=require(_0xb243('0x0'));var util=require(_0xb243('0x1'));var path=require(_0xb243('0x2'));var timeout=require(_0xb243('0x3'));var express=require(_0xb243('0x4'));var router=express[_0xb243('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb243('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb243('0x7'));var controller=require(_0xb243('0x8'));router[_0xb243('0x9')]('/',auth[_0xb243('0xa')](),controller[_0xb243('0xb')]);router[_0xb243('0x9')]('/:id',auth[_0xb243('0xa')](),controller['show']);router[_0xb243('0xc')]('/',auth['isAuthenticated'](),controller[_0xb243('0xd')]);router['put']('/:id',auth[_0xb243('0xa')](),controller[_0xb243('0xe')]);router[_0xb243('0xf')](_0xb243('0x10'),auth[_0xb243('0xa')](),controller[_0xb243('0x11')]);module[_0xb243('0x12')]=router; \ No newline at end of file +var _0xb63b=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x416ef5,_0x34d3b8){var _0x2e9370=function(_0x5a9b24){while(--_0x5a9b24){_0x416ef5['push'](_0x416ef5['shift']());}};_0x2e9370(++_0x34d3b8);}(_0xb63b,0x106));var _0xbb63=function(_0x18be73,_0x2a54f7){_0x18be73=_0x18be73-0x0;var _0x4fbe8d=_0xb63b[_0x18be73];return _0x4fbe8d;};'use strict';var multer=require(_0xbb63('0x0'));var util=require(_0xbb63('0x1'));var path=require(_0xbb63('0x2'));var timeout=require(_0xbb63('0x3'));var express=require(_0xbb63('0x4'));var router=express[_0xbb63('0x5')]();var fs_extra=require(_0xbb63('0x6'));var auth=require(_0xbb63('0x7'));var interaction=require(_0xbb63('0x8'));var config=require('../../config/environment');var controller=require(_0xbb63('0x9'));router[_0xbb63('0xa')]('/',auth[_0xbb63('0xb')](),controller['index']);router[_0xbb63('0xa')](_0xbb63('0xc'),auth[_0xbb63('0xb')](),controller[_0xbb63('0xd')]);router[_0xbb63('0xe')]('/',auth[_0xbb63('0xb')](),controller[_0xbb63('0xf')]);router[_0xbb63('0x10')](_0xbb63('0xc'),auth[_0xbb63('0xb')](),controller[_0xbb63('0x11')]);router[_0xbb63('0x12')](_0xbb63('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xbb63('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 8460d62..a7db25b 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 _0x174d=['STRING','INTEGER','exports'];(function(_0xf55458,_0x31756c){var _0x2c36aa=function(_0x33d8e1){while(--_0x33d8e1){_0xf55458['push'](_0xf55458['shift']());}};_0x2c36aa(++_0x31756c);}(_0x174d,0x1ca));var _0xd174=function(_0x438675,_0x406389){_0x438675=_0x438675-0x0;var _0xd37c26=_0x174d[_0x438675];return _0xd37c26;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd174('0x0')]={'phone':{'type':Sequelize[_0xd174('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xd174('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xd174('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xd174('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0xed1f=['moment','sequelize','INTEGER','contactListQueue'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xed1f,0x170));var _0xfed1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xed1f[_0x1da527];return _0x40fc7c;};'use strict';var moment=require(_0xfed1('0x0'));var Sequelize=require(_0xfed1('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfed1('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfed1('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xfed1('0x2')],'unique':_0xfed1('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 19ecf66..b26e028 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 _0x929b=['describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','body'];(function(_0x5efd7d,_0x3f37b6){var _0x1531f1=function(_0x137d92){while(--_0x137d92){_0x5efd7d['push'](_0x5efd7d['shift']());}};_0x1531f1(++_0x3f37b6);}(_0x929b,0x1f2));var _0xb929=function(_0x425541,_0x5dec0e){_0x425541=_0x425541-0x0;var _0x455616=_0x929b[_0x425541];return _0x455616;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb929('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb929('0x1'));var moment=require(_0xb929('0x2'));var BPromise=require(_0xb929('0x3'));var Mustache=require(_0xb929('0x4'));var util=require(_0xb929('0x5'));var path=require(_0xb929('0x6'));var sox=require(_0xb929('0x7'));var csv=require(_0xb929('0x8'));var ejs=require(_0xb929('0x9'));var fs=require('fs');var fs_extra=require(_0xb929('0xa'));var _=require(_0xb929('0xb'));var squel=require(_0xb929('0xc'));var crypto=require(_0xb929('0xd'));var jsforce=require(_0xb929('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb929('0x8'));var querystring=require(_0xb929('0xf'));var Papa=require('papaparse');var Redis=require(_0xb929('0x10'));var authService=require(_0xb929('0x11'));var qs=require(_0xb929('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb929('0x13'));var config=require(_0xb929('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2165ec,_0xc64fda){_0xc64fda=_0xc64fda||0xcc;return function(_0x2f6542){if(_0x2f6542){return _0x2165ec['sendStatus'](_0xc64fda);}return _0x2165ec[_0xb929('0x15')](_0xc64fda)[_0xb929('0x16')]();};}function respondWithResult(_0x352bd5,_0x143453){_0x143453=_0x143453||0xc8;return function(_0x221dce){if(_0x221dce){return _0x352bd5['status'](_0x143453)[_0xb929('0x17')](_0x221dce);}};}function respondWithFilteredResult(_0x307d20,_0x4f3b1a){return function(_0x31fbf5){if(_0x31fbf5){var _0x5b1703=typeof _0x4f3b1a[_0xb929('0x18')]===_0xb929('0x19')&&typeof _0x4f3b1a[_0xb929('0x1a')]===_0xb929('0x19');var _0x36f4ac=_0x31fbf5[_0xb929('0x1b')];var _0x53ad15=_0x5b1703?0x0:_0x4f3b1a[_0xb929('0x18')];var _0x42df37=_0x5b1703?_0x31fbf5[_0xb929('0x1b')]:_0x4f3b1a[_0xb929('0x18')]+_0x4f3b1a['limit'];var _0x22e0c7;if(_0x42df37>=_0x36f4ac){_0x42df37=_0x36f4ac;_0x22e0c7=0xc8;}else{_0x22e0c7=0xce;}_0x307d20['status'](_0x22e0c7);return _0x307d20[_0xb929('0x1c')](_0xb929('0x1d'),_0x53ad15+'-'+_0x42df37+'/'+_0x36f4ac)[_0xb929('0x17')](_0x31fbf5);}return null;};}function patchUpdates(_0x790d47){return function(_0x106c13){try{jsonpatch[_0xb929('0x1e')](_0x106c13,_0x790d47,!![]);}catch(_0x57bced){return BPromise[_0xb929('0x1f')](_0x57bced);}return _0x106c13['save']();};}function saveUpdates(_0x22c4b4,_0x16dc42){return function(_0x53637b){if(_0x53637b){return _0x53637b[_0xb929('0x20')](_0x22c4b4)[_0xb929('0x21')](function(_0x1b825d){return _0x1b825d;});}return null;};}function removeEntity(_0x552f4f,_0x27e521){return function(_0x3a2b77){if(_0x3a2b77){return _0x3a2b77[_0xb929('0x22')]()['then'](function(){_0x552f4f[_0xb929('0x15')](0xcc)[_0xb929('0x16')]();});}};}function handleEntityNotFound(_0x9b2522,_0x470fb9){return function(_0x1b1951){if(!_0x1b1951){_0x9b2522[_0xb929('0x23')](0x194);}return _0x1b1951;};}function handleError(_0x5db8e9,_0x96ba28){_0x96ba28=_0x96ba28||0x1f4;return function(_0x2206a4){logger['error'](_0x2206a4[_0xb929('0x24')]);if(_0x2206a4['name']){delete _0x2206a4[_0xb929('0x25')];}_0x5db8e9[_0xb929('0x15')](_0x96ba28)[_0xb929('0x26')](_0x2206a4);};}exports[_0xb929('0x27')]=function(_0x2ab5bc,_0x2412f2){var _0x2256a2={},_0xd64a89={},_0x313b12={'count':0x0,'rows':[]};var _0xa384ee=_[_0xb929('0x28')](db[_0xb929('0x29')][_0xb929('0x2a')],function(_0x2ed47c){return{'name':_0x2ed47c['fieldName'],'type':_0x2ed47c[_0xb929('0x2b')][_0xb929('0x2c')]};});_0xd64a89[_0xb929('0x2d')]=_[_0xb929('0x28')](_0xa384ee,'name');_0xd64a89[_0xb929('0x2e')]=_[_0xb929('0x2f')](_0x2ab5bc[_0xb929('0x2e')]);_0xd64a89[_0xb929('0x30')]=_[_0xb929('0x31')](_0xd64a89['model'],_0xd64a89['query']);_0x2256a2['attributes']=_[_0xb929('0x31')](_0xd64a89[_0xb929('0x2d')],qs[_0xb929('0x32')](_0x2ab5bc[_0xb929('0x2e')][_0xb929('0x32')]));_0x2256a2['attributes']=_0x2256a2['attributes'][_0xb929('0x33')]?_0x2256a2[_0xb929('0x34')]:_0xd64a89['model'];if(!_0x2ab5bc[_0xb929('0x2e')][_0xb929('0x35')](_0xb929('0x36'))){_0x2256a2[_0xb929('0x1a')]=qs[_0xb929('0x1a')](_0x2ab5bc[_0xb929('0x2e')][_0xb929('0x1a')]);_0x2256a2[_0xb929('0x18')]=qs[_0xb929('0x18')](_0x2ab5bc[_0xb929('0x2e')]['offset']);}_0x2256a2[_0xb929('0x37')]=qs['sort'](_0x2ab5bc[_0xb929('0x2e')]['sort']);_0x2256a2[_0xb929('0x38')]=qs[_0xb929('0x30')](_[_0xb929('0x39')](_0x2ab5bc['query'],_0xd64a89[_0xb929('0x30')]),_0xa384ee);if(_0x2ab5bc['query'][_0xb929('0x3a')]){_0x2256a2[_0xb929('0x38')]=_[_0xb929('0x3b')](_0x2256a2[_0xb929('0x38')],{'$or':_[_0xb929('0x28')](_0xa384ee,function(_0x2bb38b){if(_0x2bb38b[_0xb929('0x2b')]!==_0xb929('0x3c')){var _0x5a0f67={};_0x5a0f67[_0x2bb38b[_0xb929('0x25')]]={'$like':'%'+_0x2ab5bc[_0xb929('0x2e')][_0xb929('0x3a')]+'%'};return _0x5a0f67;}})});}_0x2256a2=_[_0xb929('0x3b')]({},_0x2256a2,_0x2ab5bc[_0xb929('0x3d')]);var _0x9ef79e={'where':_0x2256a2[_0xb929('0x38')]};return db[_0xb929('0x29')]['count'](_0x9ef79e)[_0xb929('0x21')](function(_0x11e561){_0x313b12[_0xb929('0x1b')]=_0x11e561;if(_0x2ab5bc[_0xb929('0x2e')][_0xb929('0x3e')]){_0x2256a2['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xb929('0x3f')](_0x2256a2);})[_0xb929('0x21')](function(_0x2b2b51){_0x313b12[_0xb929('0x40')]=_0x2b2b51;return _0x313b12;})[_0xb929('0x21')](respondWithFilteredResult(_0x2412f2,_0x2256a2))[_0xb929('0x41')](handleError(_0x2412f2,null));};exports['show']=function(_0x599d82,_0x12db43){var _0xb0759={'raw':!![],'where':{'id':_0x599d82[_0xb929('0x42')]['id']}},_0x3547d8={};_0x3547d8['model']=_[_0xb929('0x2f')](db[_0xb929('0x29')]['rawAttributes']);_0x3547d8['query']=_[_0xb929('0x2f')](_0x599d82['query']);_0x3547d8[_0xb929('0x30')]=_[_0xb929('0x31')](_0x3547d8[_0xb929('0x2d')],_0x3547d8[_0xb929('0x2e')]);_0xb0759[_0xb929('0x34')]=_[_0xb929('0x31')](_0x3547d8[_0xb929('0x2d')],qs[_0xb929('0x32')](_0x599d82['query']['fields']));_0xb0759[_0xb929('0x34')]=_0xb0759[_0xb929('0x34')]['length']?_0xb0759[_0xb929('0x34')]:_0x3547d8['model'];if(_0x599d82['query']['includeAll']){_0xb0759[_0xb929('0x43')]=[{'all':!![]}];}_0xb0759=_[_0xb929('0x3b')]({},_0xb0759,_0x599d82['options']);return db[_0xb929('0x29')][_0xb929('0x44')](_0xb0759)[_0xb929('0x21')](handleEntityNotFound(_0x12db43,null))[_0xb929('0x21')](respondWithResult(_0x12db43,null))['catch'](handleError(_0x12db43,null));};exports[_0xb929('0x20')]=function(_0x4a0b69,_0x57b365){if(_0x4a0b69[_0xb929('0x45')]['id']){delete _0x4a0b69[_0xb929('0x45')]['id'];}return db[_0xb929('0x29')][_0xb929('0x44')]({'where':{'id':_0x4a0b69['params']['id']}})[_0xb929('0x21')](handleEntityNotFound(_0x57b365,null))[_0xb929('0x21')](saveUpdates(_0x4a0b69['body'],null))['then'](respondWithResult(_0x57b365,null))[_0xb929('0x41')](handleError(_0x57b365,null));};exports[_0xb929('0x22')]=function(_0x322663,_0x47fb3c){return db[_0xb929('0x29')][_0xb929('0x44')]({'where':{'id':_0x322663[_0xb929('0x42')]['id']}})[_0xb929('0x21')](handleEntityNotFound(_0x47fb3c,null))['then'](removeEntity(_0x47fb3c,null))[_0xb929('0x41')](handleError(_0x47fb3c,null));};exports[_0xb929('0x46')]=function(_0x54d5b3,_0x3f516c){return db[_0xb929('0x29')][_0xb929('0x46')]()['then'](respondWithResult(_0x3f516c,null))['catch'](handleError(_0x3f516c,null));}; \ No newline at end of file +var _0x61c7=['status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','sendStatus','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','catch','show','length','options','find','update','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x2c842c,_0x2c0fec){var _0x584f63=function(_0x38dba1){while(--_0x38dba1){_0x2c842c['push'](_0x2c842c['shift']());}};_0x584f63(++_0x2c0fec);}(_0x61c7,0x76));var _0x761c=function(_0xa5e078,_0x24e6d3){_0xa5e078=_0xa5e078-0x0;var _0x2f669a=_0x61c7[_0xa5e078];return _0x2f669a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x761c('0x0'));var zipdir=require(_0x761c('0x1'));var jsonpatch=require(_0x761c('0x2'));var rp=require(_0x761c('0x3'));var moment=require(_0x761c('0x4'));var BPromise=require(_0x761c('0x5'));var Mustache=require(_0x761c('0x6'));var util=require(_0x761c('0x7'));var path=require(_0x761c('0x8'));var sox=require('sox');var csv=require(_0x761c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x761c('0xa'));var _=require('lodash');var squel=require(_0x761c('0xb'));var crypto=require(_0x761c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x761c('0xd'));var toCsv=require(_0x761c('0x9'));var querystring=require(_0x761c('0xe'));var Papa=require(_0x761c('0xf'));var Redis=require(_0x761c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x761c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x761c('0x12'))('api');var utils=require(_0x761c('0x13'));var config=require(_0x761c('0x14'));var licenseUtil=require(_0x761c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b5183,_0x32e8cd){_0x32e8cd=_0x32e8cd||0xcc;return function(_0x3b4a1b){if(_0x3b4a1b){return _0x1b5183['sendStatus'](_0x32e8cd);}return _0x1b5183[_0x761c('0x16')](_0x32e8cd)[_0x761c('0x17')]();};}function respondWithResult(_0x288e46,_0x4693fd){_0x4693fd=_0x4693fd||0xc8;return function(_0x2a5fae){if(_0x2a5fae){return _0x288e46['status'](_0x4693fd)[_0x761c('0x18')](_0x2a5fae);}};}function respondWithFilteredResult(_0x39aeaa,_0x5771ea){return function(_0x421ece){if(_0x421ece){var _0x122cea=typeof _0x5771ea[_0x761c('0x19')]==='undefined'&&typeof _0x5771ea[_0x761c('0x1a')]==='undefined';var _0x26b2e6=_0x421ece[_0x761c('0x1b')];var _0x4a1132=_0x122cea?0x0:_0x5771ea['offset'];var _0x39038c=_0x122cea?_0x421ece[_0x761c('0x1b')]:_0x5771ea['offset']+_0x5771ea[_0x761c('0x1a')];var _0x4ff462;if(_0x39038c>=_0x26b2e6){_0x39038c=_0x26b2e6;_0x4ff462=0xc8;}else{_0x4ff462=0xce;}_0x39aeaa[_0x761c('0x16')](_0x4ff462);return _0x39aeaa[_0x761c('0x1c')](_0x761c('0x1d'),_0x4a1132+'-'+_0x39038c+'/'+_0x26b2e6)[_0x761c('0x18')](_0x421ece);}return null;};}function patchUpdates(_0x12a6d6){return function(_0x2b681e){try{jsonpatch['apply'](_0x2b681e,_0x12a6d6,!![]);}catch(_0x4cd9c2){return BPromise[_0x761c('0x1e')](_0x4cd9c2);}return _0x2b681e[_0x761c('0x1f')]();};}function saveUpdates(_0xf45339,_0x521404){return function(_0x443fd9){if(_0x443fd9){return _0x443fd9['update'](_0xf45339)[_0x761c('0x20')](function(_0x2b81ab){return _0x2b81ab;});}return null;};}function removeEntity(_0x3ab92c,_0x4a15bd){return function(_0x8ec8db){if(_0x8ec8db){return _0x8ec8db[_0x761c('0x21')]()[_0x761c('0x20')](function(){_0x3ab92c[_0x761c('0x16')](0xcc)[_0x761c('0x17')]();});}};}function handleEntityNotFound(_0x38b94c,_0x4c0a8a){return function(_0x39be7a){if(!_0x39be7a){_0x38b94c[_0x761c('0x22')](0x194);}return _0x39be7a;};}function handleError(_0x5623f6,_0x468212){_0x468212=_0x468212||0x1f4;return function(_0x12fca6){logger['error'](_0x12fca6['stack']);if(_0x12fca6[_0x761c('0x23')]){delete _0x12fca6['name'];}_0x5623f6[_0x761c('0x16')](_0x468212)[_0x761c('0x24')](_0x12fca6);};}exports[_0x761c('0x25')]=function(_0x199595,_0x207a1e){var _0x4b04c8={},_0x185b19={},_0x50a793={'count':0x0,'rows':[]};var _0xbe703f=_[_0x761c('0x26')](db[_0x761c('0x27')][_0x761c('0x28')],function(_0x5ca5d3){return{'name':_0x5ca5d3[_0x761c('0x29')],'type':_0x5ca5d3[_0x761c('0x2a')][_0x761c('0x2b')]};});_0x185b19['model']=_[_0x761c('0x26')](_0xbe703f,_0x761c('0x23'));_0x185b19[_0x761c('0x2c')]=_[_0x761c('0x2d')](_0x199595[_0x761c('0x2c')]);_0x185b19[_0x761c('0x2e')]=_[_0x761c('0x2f')](_0x185b19['model'],_0x185b19[_0x761c('0x2c')]);_0x4b04c8['attributes']=_[_0x761c('0x2f')](_0x185b19[_0x761c('0x30')],qs[_0x761c('0x31')](_0x199595[_0x761c('0x2c')][_0x761c('0x31')]));_0x4b04c8[_0x761c('0x32')]=_0x4b04c8[_0x761c('0x32')]['length']?_0x4b04c8['attributes']:_0x185b19[_0x761c('0x30')];if(!_0x199595[_0x761c('0x2c')][_0x761c('0x33')](_0x761c('0x34'))){_0x4b04c8[_0x761c('0x1a')]=qs[_0x761c('0x1a')](_0x199595[_0x761c('0x2c')][_0x761c('0x1a')]);_0x4b04c8['offset']=qs['offset'](_0x199595[_0x761c('0x2c')][_0x761c('0x19')]);}_0x4b04c8[_0x761c('0x35')]=qs[_0x761c('0x36')](_0x199595[_0x761c('0x2c')][_0x761c('0x36')]);_0x4b04c8[_0x761c('0x37')]=qs['filters'](_[_0x761c('0x38')](_0x199595[_0x761c('0x2c')],_0x185b19[_0x761c('0x2e')]),_0xbe703f);if(_0x199595[_0x761c('0x2c')][_0x761c('0x39')]){_0x4b04c8['where']=_[_0x761c('0x3a')](_0x4b04c8['where'],{'$or':_['map'](_0xbe703f,function(_0x315336){if(_0x315336[_0x761c('0x2a')]!==_0x761c('0x3b')){var _0x1f91da={};_0x1f91da[_0x315336['name']]={'$like':'%'+_0x199595['query'][_0x761c('0x39')]+'%'};return _0x1f91da;}})});}_0x4b04c8=_[_0x761c('0x3a')]({},_0x4b04c8,_0x199595['options']);var _0x5cc2e7={'where':_0x4b04c8[_0x761c('0x37')]};return db[_0x761c('0x27')][_0x761c('0x1b')](_0x5cc2e7)[_0x761c('0x20')](function(_0x3c5e33){_0x50a793[_0x761c('0x1b')]=_0x3c5e33;if(_0x199595[_0x761c('0x2c')][_0x761c('0x3c')]){_0x4b04c8['include']=[{'all':!![]}];}return db[_0x761c('0x27')]['findAll'](_0x4b04c8);})[_0x761c('0x20')](function(_0x5d79d2){_0x50a793['rows']=_0x5d79d2;return _0x50a793;})[_0x761c('0x20')](respondWithFilteredResult(_0x207a1e,_0x4b04c8))[_0x761c('0x3d')](handleError(_0x207a1e,null));};exports[_0x761c('0x3e')]=function(_0xfcecb,_0x34778f){var _0x225927={'raw':!![],'where':{'id':_0xfcecb['params']['id']}},_0x128422={};_0x128422[_0x761c('0x30')]=_[_0x761c('0x2d')](db[_0x761c('0x27')][_0x761c('0x28')]);_0x128422['query']=_[_0x761c('0x2d')](_0xfcecb['query']);_0x128422['filters']=_[_0x761c('0x2f')](_0x128422['model'],_0x128422[_0x761c('0x2c')]);_0x225927[_0x761c('0x32')]=_['intersection'](_0x128422['model'],qs['fields'](_0xfcecb['query'][_0x761c('0x31')]));_0x225927[_0x761c('0x32')]=_0x225927['attributes'][_0x761c('0x3f')]?_0x225927['attributes']:_0x128422[_0x761c('0x30')];if(_0xfcecb[_0x761c('0x2c')][_0x761c('0x3c')]){_0x225927['include']=[{'all':!![]}];}_0x225927=_['merge']({},_0x225927,_0xfcecb[_0x761c('0x40')]);return db[_0x761c('0x27')][_0x761c('0x41')](_0x225927)[_0x761c('0x20')](handleEntityNotFound(_0x34778f,null))[_0x761c('0x20')](respondWithResult(_0x34778f,null))[_0x761c('0x3d')](handleError(_0x34778f,null));};exports[_0x761c('0x42')]=function(_0x1d5bad,_0x16c1c8){if(_0x1d5bad['body']['id']){delete _0x1d5bad[_0x761c('0x43')]['id'];}return db[_0x761c('0x27')][_0x761c('0x41')]({'where':{'id':_0x1d5bad[_0x761c('0x44')]['id']}})[_0x761c('0x20')](handleEntityNotFound(_0x16c1c8,null))[_0x761c('0x20')](saveUpdates(_0x1d5bad[_0x761c('0x43')],null))[_0x761c('0x20')](respondWithResult(_0x16c1c8,null))['catch'](handleError(_0x16c1c8,null));};exports[_0x761c('0x21')]=function(_0x311452,_0x12d7dd){return db[_0x761c('0x27')][_0x761c('0x41')]({'where':{'id':_0x311452[_0x761c('0x44')]['id']}})[_0x761c('0x20')](handleEntityNotFound(_0x12d7dd,null))['then'](removeEntity(_0x12d7dd,null))['catch'](handleError(_0x12d7dd,null));};exports[_0x761c('0x45')]=function(_0x26618a,_0x312eb7){return db[_0x761c('0x27')][_0x761c('0x45')]()['then'](respondWithResult(_0x312eb7,null))[_0x761c('0x3d')](handleError(_0x312eb7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index bd7e58e..96237c5 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 _0x9c26=['rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x12944d,_0x28dfa5){var _0x1b6629=function(_0x2920f3){while(--_0x2920f3){_0x12944d['push'](_0x12944d['shift']());}};_0x1b6629(++_0x28dfa5);}(_0x9c26,0x100));var _0x69c2=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x9c26[_0x4bb66f];return _0xf2772f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x69c2('0x0'))('api');var moment=require(_0x69c2('0x1'));var BPromise=require(_0x69c2('0x2'));var rp=require(_0x69c2('0x3'));var fs=require('fs');var path=require(_0x69c2('0x4'));var rimraf=require(_0x69c2('0x5'));var config=require('../../config/environment');var attributes=require(_0x69c2('0x6'));module[_0x69c2('0x7')]=function(_0x4c2242,_0x32d014){return _0x4c2242['define'](_0x69c2('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf83=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','CmHopperBlack','util','../../config/logger','api'];(function(_0x33151f,_0xef8a34){var _0xd97d19=function(_0x32969c){while(--_0x32969c){_0x33151f['push'](_0x33151f['shift']());}};_0xd97d19(++_0xef8a34);}(_0xbf83,0x1cb));var _0x3bf8=function(_0xda3db,_0x28bb11){_0xda3db=_0xda3db-0x0;var _0x3b054a=_0xbf83[_0xda3db];return _0x3b054a;};'use strict';var _=require('lodash');var util=require(_0x3bf8('0x0'));var logger=require(_0x3bf8('0x1'))(_0x3bf8('0x2'));var moment=require(_0x3bf8('0x3'));var BPromise=require(_0x3bf8('0x4'));var rp=require(_0x3bf8('0x5'));var fs=require('fs');var path=require(_0x3bf8('0x6'));var rimraf=require(_0x3bf8('0x7'));var config=require(_0x3bf8('0x8'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x5ce7e6,_0x143183){return _0x5ce7e6[_0x3bf8('0x9')](_0x3bf8('0xa'),attributes,{'tableName':'cm_hopper_black','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 368dae7..7faa8a0 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 _0x413d=['result','catch','CmHopperBlack','options','raw','where','limit','map','include','model','attributes','GetCmHopperBlack','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x245ac5,_0x4215f1){var _0x437858=function(_0x3f121b){while(--_0x3f121b){_0x245ac5['push'](_0x245ac5['shift']());}};_0x437858(++_0x4215f1);}(_0x413d,0x1f1));var _0xd413=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x413d[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0xd413('0x0'));var util=require(_0xd413('0x1'));var moment=require(_0xd413('0x2'));var BPromise=require('bluebird');var rs=require(_0xd413('0x3'));var fs=require('fs');var Redis=require(_0xd413('0x4'));var db=require(_0xd413('0x5'))['db'];var utils=require(_0xd413('0x6'));var logger=require(_0xd413('0x7'))(_0xd413('0x8'));var config=require(_0xd413('0x9'));var jayson=require(_0xd413('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56cee9,_0x381796,_0x23ef31){return new BPromise(function(_0x3a4825,_0x1c8fc3){return client[_0xd413('0xb')](_0x56cee9,_0x23ef31)[_0xd413('0xc')](function(_0xa28ede){logger[_0xd413('0xd')](_0xd413('0xe'),_0x381796,_0xd413('0xf'));logger[_0xd413('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x381796,_0xd413('0xf'),JSON[_0xd413('0x11')](_0xa28ede));if(_0xa28ede[_0xd413('0x12')]){if(_0xa28ede['error'][_0xd413('0x13')]===0x1f4){logger[_0xd413('0x12')](_0xd413('0xe'),_0x381796,_0xa28ede[_0xd413('0x12')][_0xd413('0x14')]);return _0x1c8fc3(_0xa28ede['error']['message']);}logger[_0xd413('0x12')](_0xd413('0xe'),_0x381796,_0xa28ede['error']['message']);return _0x3a4825(_0xa28ede[_0xd413('0x12')][_0xd413('0x14')]);}else{logger[_0xd413('0xd')](_0xd413('0xe'),_0x381796,_0xd413('0xf'));_0x3a4825(_0xa28ede[_0xd413('0x15')][_0xd413('0x14')]);}})[_0xd413('0x16')](function(_0x550c4a){logger[_0xd413('0x12')](_0xd413('0xe'),_0x381796,_0x550c4a);_0x1c8fc3(_0x550c4a);});});}exports['GetCmHopperBlack']=function(_0x195ba9){var _0x1f49c4=this;return new Promise(function(_0x541d28,_0x35c6a2){return db[_0xd413('0x17')]['findAll']({'raw':_0x195ba9['options']?_0x195ba9[_0xd413('0x18')][_0xd413('0x19')]===undefined?!![]:![]:!![],'where':_0x195ba9['options']?_0x195ba9[_0xd413('0x18')][_0xd413('0x1a')]||null:null,'attributes':_0x195ba9[_0xd413('0x18')]?_0x195ba9[_0xd413('0x18')]['attributes']||null:null,'limit':_0x195ba9[_0xd413('0x18')]?_0x195ba9[_0xd413('0x18')][_0xd413('0x1b')]||null:null,'include':_0x195ba9[_0xd413('0x18')]?_0x195ba9[_0xd413('0x18')]['include']?_[_0xd413('0x1c')](_0x195ba9[_0xd413('0x18')][_0xd413('0x1d')],function(_0x580447){return{'model':db[_0x580447['model']],'as':_0x580447['as'],'attributes':_0x580447['attributes'],'include':_0x580447['include']?_[_0xd413('0x1c')](_0x580447[_0xd413('0x1d')],function(_0x45d0ef){return{'model':db[_0x45d0ef[_0xd413('0x1e')]],'as':_0x45d0ef['as'],'attributes':_0x45d0ef[_0xd413('0x1f')],'include':_0x45d0ef[_0xd413('0x1d')]?_[_0xd413('0x1c')](_0x45d0ef['include'],function(_0x37436f){return{'model':db[_0x37436f[_0xd413('0x1e')]],'as':_0x37436f['as'],'attributes':_0x37436f[_0xd413('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd413('0xc')](function(_0x3e9693){logger['info']('GetCmHopperBlack',_0x195ba9);logger['debug'](_0xd413('0x20'),_0x195ba9,JSON[_0xd413('0x11')](_0x3e9693));_0x541d28(_0x3e9693);})[_0xd413('0x16')](function(_0x3b239e){logger[_0xd413('0x12')](_0xd413('0x20'),_0x3b239e[_0xd413('0x14')],_0x195ba9);_0x35c6a2(_0x1f49c4[_0xd413('0x12')](0x1f4,_0x3b239e[_0xd413('0x14')]));});});};exports[_0xd413('0x21')]=function(_0x4a5d40){var _0x5e6099=this;return new Promise(function(_0x5d0c53,_0x719244){return db[_0xd413('0x17')]['update'](_0x4a5d40[_0xd413('0x22')],{'raw':_0x4a5d40[_0xd413('0x18')]?_0x4a5d40['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a5d40[_0xd413('0x18')]?_0x4a5d40[_0xd413('0x18')][_0xd413('0x1a')]||null:null,'attributes':_0x4a5d40[_0xd413('0x18')]?_0x4a5d40[_0xd413('0x18')][_0xd413('0x1f')]||null:null,'limit':_0x4a5d40[_0xd413('0x18')]?_0x4a5d40[_0xd413('0x18')][_0xd413('0x1b')]||null:null})['then'](function(_0x974f07){logger['info'](_0xd413('0x21'),_0x4a5d40);logger[_0xd413('0x10')]('UpdateCmHopperBlack',_0x4a5d40,JSON[_0xd413('0x11')](_0x974f07));_0x5d0c53(_0x974f07);})[_0xd413('0x16')](function(_0x42dbc3){logger[_0xd413('0x12')]('UpdateCmHopperBlack',_0x42dbc3[_0xd413('0x14')],_0x4a5d40);_0x719244(_0x5e6099[_0xd413('0x12')](0x1f4,_0x42dbc3[_0xd413('0x14')]));});});};exports[_0xd413('0x23')]=function(_0x52d480){var _0x3e8c30=this;return new Promise(function(_0x54afa2,_0x3ab73d){return db[_0xd413('0x17')][_0xd413('0x24')]({'where':_0x52d480[_0xd413('0x18')]?_0x52d480[_0xd413('0x18')][_0xd413('0x1a')]||null:null})[_0xd413('0xc')](function(_0x80b0d){logger['info']('DestroyCmHopperBlack',_0x52d480);logger[_0xd413('0x10')](_0xd413('0x23'),_0x52d480,JSON[_0xd413('0x11')](_0x80b0d));_0x54afa2(_0x80b0d);})[_0xd413('0x16')](function(_0xa827f){logger[_0xd413('0x12')](_0xd413('0x23'),_0xa827f[_0xd413('0x14')],_0x52d480);_0x3ab73d(_0x3e8c30[_0xd413('0x12')](0x1f4,_0xa827f['message']));});});}; \ No newline at end of file +var _0x33d9=['error','code','message','catch','GetCmHopperBlack','options','raw','where','attributes','limit','map','include','model','UpdateCmHopperBlack','body','DestroyCmHopperBlack','CmHopperBlack','destroy','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x33d9,0xa2));var _0x933d=function(_0x512e00,_0x1af120){_0x512e00=_0x512e00-0x0;var _0x371e14=_0x33d9[_0x512e00];return _0x371e14;};'use strict';var _=require(_0x933d('0x0'));var util=require(_0x933d('0x1'));var moment=require(_0x933d('0x2'));var BPromise=require(_0x933d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x933d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x933d('0x5'));var logger=require(_0x933d('0x6'))(_0x933d('0x7'));var config=require(_0x933d('0x8'));var jayson=require(_0x933d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x573164,_0xd581d8,_0x1508ae){return new BPromise(function(_0x42784f,_0x44371f){return client[_0x933d('0xa')](_0x573164,_0x1508ae)[_0x933d('0xb')](function(_0x55ef19){logger[_0x933d('0xc')](_0x933d('0xd'),_0xd581d8,'request\x20sent');logger[_0x933d('0xe')](_0x933d('0xf'),_0xd581d8,_0x933d('0x10'),JSON[_0x933d('0x11')](_0x55ef19));if(_0x55ef19[_0x933d('0x12')]){if(_0x55ef19[_0x933d('0x12')][_0x933d('0x13')]===0x1f4){logger['error'](_0x933d('0xd'),_0xd581d8,_0x55ef19[_0x933d('0x12')][_0x933d('0x14')]);return _0x44371f(_0x55ef19['error']['message']);}logger['error'](_0x933d('0xd'),_0xd581d8,_0x55ef19[_0x933d('0x12')][_0x933d('0x14')]);return _0x42784f(_0x55ef19[_0x933d('0x12')][_0x933d('0x14')]);}else{logger[_0x933d('0xc')](_0x933d('0xd'),_0xd581d8,'request\x20sent');_0x42784f(_0x55ef19['result'][_0x933d('0x14')]);}})[_0x933d('0x15')](function(_0x52d449){logger[_0x933d('0x12')](_0x933d('0xd'),_0xd581d8,_0x52d449);_0x44371f(_0x52d449);});});}exports[_0x933d('0x16')]=function(_0x38cfef){var _0x1be7dc=this;return new Promise(function(_0x3b9264,_0x35c66e){return db['CmHopperBlack']['findAll']({'raw':_0x38cfef[_0x933d('0x17')]?_0x38cfef[_0x933d('0x17')][_0x933d('0x18')]===undefined?!![]:![]:!![],'where':_0x38cfef[_0x933d('0x17')]?_0x38cfef[_0x933d('0x17')][_0x933d('0x19')]||null:null,'attributes':_0x38cfef[_0x933d('0x17')]?_0x38cfef['options'][_0x933d('0x1a')]||null:null,'limit':_0x38cfef[_0x933d('0x17')]?_0x38cfef['options'][_0x933d('0x1b')]||null:null,'include':_0x38cfef[_0x933d('0x17')]?_0x38cfef[_0x933d('0x17')]['include']?_[_0x933d('0x1c')](_0x38cfef[_0x933d('0x17')][_0x933d('0x1d')],function(_0x20a2ba){return{'model':db[_0x20a2ba['model']],'as':_0x20a2ba['as'],'attributes':_0x20a2ba[_0x933d('0x1a')],'include':_0x20a2ba['include']?_[_0x933d('0x1c')](_0x20a2ba[_0x933d('0x1d')],function(_0x33fc70){return{'model':db[_0x33fc70[_0x933d('0x1e')]],'as':_0x33fc70['as'],'attributes':_0x33fc70[_0x933d('0x1a')],'include':_0x33fc70[_0x933d('0x1d')]?_['map'](_0x33fc70[_0x933d('0x1d')],function(_0x165cf3){return{'model':db[_0x165cf3[_0x933d('0x1e')]],'as':_0x165cf3['as'],'attributes':_0x165cf3[_0x933d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x933d('0xb')](function(_0x34d0d8){logger['info'](_0x933d('0x16'),_0x38cfef);logger[_0x933d('0xe')](_0x933d('0x16'),_0x38cfef,JSON['stringify'](_0x34d0d8));_0x3b9264(_0x34d0d8);})[_0x933d('0x15')](function(_0x556cf5){logger[_0x933d('0x12')]('GetCmHopperBlack',_0x556cf5[_0x933d('0x14')],_0x38cfef);_0x35c66e(_0x1be7dc[_0x933d('0x12')](0x1f4,_0x556cf5[_0x933d('0x14')]));});});};exports[_0x933d('0x1f')]=function(_0x57d808){var _0x3ed2a3=this;return new Promise(function(_0x353244,_0x5e95bd){return db['CmHopperBlack']['update'](_0x57d808[_0x933d('0x20')],{'raw':_0x57d808[_0x933d('0x17')]?_0x57d808[_0x933d('0x17')][_0x933d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d808['options']?_0x57d808[_0x933d('0x17')][_0x933d('0x19')]||null:null,'attributes':_0x57d808[_0x933d('0x17')]?_0x57d808[_0x933d('0x17')][_0x933d('0x1a')]||null:null,'limit':_0x57d808[_0x933d('0x17')]?_0x57d808[_0x933d('0x17')][_0x933d('0x1b')]||null:null})['then'](function(_0x1fce35){logger[_0x933d('0xc')](_0x933d('0x1f'),_0x57d808);logger[_0x933d('0xe')]('UpdateCmHopperBlack',_0x57d808,JSON[_0x933d('0x11')](_0x1fce35));_0x353244(_0x1fce35);})[_0x933d('0x15')](function(_0x5bc8ab){logger[_0x933d('0x12')](_0x933d('0x1f'),_0x5bc8ab['message'],_0x57d808);_0x5e95bd(_0x3ed2a3[_0x933d('0x12')](0x1f4,_0x5bc8ab[_0x933d('0x14')]));});});};exports[_0x933d('0x21')]=function(_0x181e2e){var _0x3fc91c=this;return new Promise(function(_0x4c237b,_0x201067){return db[_0x933d('0x22')][_0x933d('0x23')]({'where':_0x181e2e['options']?_0x181e2e[_0x933d('0x17')]['where']||null:null})['then'](function(_0x2ab260){logger['info'](_0x933d('0x21'),_0x181e2e);logger[_0x933d('0xe')]('DestroyCmHopperBlack',_0x181e2e,JSON[_0x933d('0x11')](_0x2ab260));_0x4c237b(_0x2ab260);})[_0x933d('0x15')](function(_0x1743f0){logger['error'](_0x933d('0x21'),_0x1743f0[_0x933d('0x14')],_0x181e2e);_0x201067(_0x3fc91c[_0x933d('0x12')](0x1f4,_0x1743f0[_0x933d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index d79e43c..796ac27 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 _0x1967=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x636e70,_0xc8eee8){var _0x395846=function(_0x35a76e){while(--_0x35a76e){_0x636e70['push'](_0x636e70['shift']());}};_0x395846(++_0xc8eee8);}(_0x1967,0x173));var _0x7196=function(_0x5a7e9e,_0x2dfd74){_0x5a7e9e=_0x5a7e9e-0x0;var _0x9b25e1=_0x1967[_0x5a7e9e];return _0x9b25e1;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')](_0x7196('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x7196('0x12')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);module[_0x7196('0x14')]=router; \ No newline at end of file +var _0x5334=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id'];(function(_0x544847,_0x18fac5){var _0xa1e70d=function(_0x2cb91c){while(--_0x2cb91c){_0x544847['push'](_0x544847['shift']());}};_0xa1e70d(++_0x18fac5);}(_0x5334,0x84));var _0x4533=function(_0x2dda7b,_0x3364b8){_0x2dda7b=_0x2dda7b-0x0;var _0x172693=_0x5334[_0x2dda7b];return _0x172693;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0xf')]);router[_0x4533('0x10')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller['destroy']);module[_0x4533('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 e2c8f59..eb2a3d4 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 _0x942a=['INTEGER','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','exports','STRING'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x942a,0xef));var _0xa942=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x942a[_0x3e6b2f];return _0x323215;};'use strict';var Sequelize=require(_0xa942('0x0'));var moment=require('moment');module[_0xa942('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa942('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa942('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa942('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa942('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa942('0x2')]},'starttime':{'type':Sequelize[_0xa942('0x4')]},'responsetime':{'type':Sequelize[_0xa942('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa942('0x4')]},'endtime':{'type':Sequelize[_0xa942('0x4')]},'ringtime':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa942('0x2')]},'campaign':{'type':Sequelize[_0xa942('0x2')]},'campaigntype':{'type':Sequelize[_0xa942('0x2')]},'membername':{'type':Sequelize[_0xa942('0x2')]},'reason':{'type':Sequelize[_0xa942('0x2')]},'disposition':{'type':Sequelize[_0xa942('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa942('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x2e0aff){var _0x54ec1c=this[_0xa942('0x5')](_0xa942('0x6'));if(_0x54ec1c&&_0x2e0aff){this[_0xa942('0x7')](_0xa942('0x8'),moment(_0x2e0aff)['diff'](moment(_0x54ec1c),_0xa942('0x9')));}}},'amd':{'type':Sequelize[_0xa942('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa942('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa942('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa942('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa942('0x4')]},'deleted':{'type':Sequelize[_0xa942('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa942('0x4')]},'recallme':{'type':Sequelize[_0xa942('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa942('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa942('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd1fc=['BOOLEAN','sequelize','INTEGER','STRING','DATE','setDataValue','followuptime','diff','seconds'];(function(_0x16f6e4,_0x288b61){var _0x275354=function(_0x43865e){while(--_0x43865e){_0x16f6e4['push'](_0x16f6e4['shift']());}};_0x275354(++_0x288b61);}(_0xd1fc,0x7f));var _0xcd1f=function(_0x5d3bac,_0x2eb657){_0x5d3bac=_0x5d3bac-0x0;var _0x2c8242=_0xd1fc[_0x5d3bac];return _0x2c8242;};'use strict';var Sequelize=require(_0xcd1f('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0xcd1f('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xcd1f('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcd1f('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xcd1f('0x2')]},'originatecalleridname':{'type':Sequelize[_0xcd1f('0x2')]},'calleridnum':{'type':Sequelize[_0xcd1f('0x2')]},'calleridname':{'type':Sequelize[_0xcd1f('0x2')]},'starttime':{'type':Sequelize[_0xcd1f('0x3')]},'responsetime':{'type':Sequelize[_0xcd1f('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xcd1f('0x3')]},'endtime':{'type':Sequelize[_0xcd1f('0x3')]},'ringtime':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcd1f('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xcd1f('0x2')]},'membername':{'type':Sequelize[_0xcd1f('0x2')]},'reason':{'type':Sequelize[_0xcd1f('0x2')]},'disposition':{'type':Sequelize[_0xcd1f('0x2')]},'secondDisposition':{'type':Sequelize[_0xcd1f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcd1f('0x2')]},'dispositionat':{'type':Sequelize[_0xcd1f('0x3')],'set':function(_0x1acb47){var _0x37c195=this['getDataValue']('endtime');if(_0x37c195&&_0x1acb47){this[_0xcd1f('0x4')](_0xcd1f('0x5'),moment(_0x1acb47)[_0xcd1f('0x6')](moment(_0x37c195),_0xcd1f('0x7')));}}},'amd':{'type':Sequelize[_0xcd1f('0x8')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcd1f('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xcd1f('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcd1f('0x3')]},'callback':{'type':Sequelize[_0xcd1f('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcd1f('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcd1f('0x3')]},'deleted':{'type':Sequelize[_0xcd1f('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcd1f('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xcd1f('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd1f('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 3d3256c..2f6cd25 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 _0x9536=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','index','map','CmHopperFinal','fieldName','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','length','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ListId','NOW()','from','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ListId)','CampaignId\x20=\x20?','cm_hopper_final','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0xcda891,_0x33309c){var _0x581fcf=function(_0x52f0cc){while(--_0x52f0cc){_0xcda891['push'](_0xcda891['shift']());}};_0x581fcf(++_0x33309c);}(_0x9536,0x179));var _0x6953=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x9536[_0x4b1665];return _0x5850c0;};'use strict';var emlformat=require(_0x6953('0x0'));var rimraf=require(_0x6953('0x1'));var zipdir=require(_0x6953('0x2'));var jsonpatch=require(_0x6953('0x3'));var rp=require('request-promise');var moment=require(_0x6953('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6953('0x5'));var util=require(_0x6953('0x6'));var path=require(_0x6953('0x7'));var sox=require(_0x6953('0x8'));var csv=require(_0x6953('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6953('0xa'));var _=require(_0x6953('0xb'));var squel=require(_0x6953('0xc'));var crypto=require(_0x6953('0xd'));var jsforce=require(_0x6953('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6953('0x9'));var querystring=require(_0x6953('0xf'));var Papa=require(_0x6953('0x10'));var Redis=require('ioredis');var authService=require(_0x6953('0x11'));var qs=require(_0x6953('0x12'));var as=require(_0x6953('0x13'));var hardwareService=require(_0x6953('0x14'));var logger=require(_0x6953('0x15'))(_0x6953('0x16'));var utils=require(_0x6953('0x17'));var config=require(_0x6953('0x18'));var licenseUtil=require(_0x6953('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x358388,_0x513dd0){_0x513dd0=_0x513dd0||0xcc;return function(_0x8de91e){if(_0x8de91e){return _0x358388[_0x6953('0x1a')](_0x513dd0);}return _0x358388[_0x6953('0x1b')](_0x513dd0)[_0x6953('0x1c')]();};}function respondWithResult(_0x1b5221,_0x244713){_0x244713=_0x244713||0xc8;return function(_0x175fa9){if(_0x175fa9){return _0x1b5221[_0x6953('0x1b')](_0x244713)[_0x6953('0x1d')](_0x175fa9);}};}function respondWithFilteredResult(_0x31d182,_0xae5515){return function(_0x548473){if(_0x548473){var _0x5f49db=typeof _0xae5515[_0x6953('0x1e')]===_0x6953('0x1f')&&typeof _0xae5515[_0x6953('0x20')]===_0x6953('0x1f');var _0x510d46=_0x548473[_0x6953('0x21')];var _0x2da771=_0x5f49db?0x0:_0xae5515['offset'];var _0x10858a=_0x5f49db?_0x548473[_0x6953('0x21')]:_0xae5515[_0x6953('0x1e')]+_0xae5515[_0x6953('0x20')];var _0xc714d3;if(_0x10858a>=_0x510d46){_0x10858a=_0x510d46;_0xc714d3=0xc8;}else{_0xc714d3=0xce;}_0x31d182['status'](_0xc714d3);return _0x31d182[_0x6953('0x22')](_0x6953('0x23'),_0x2da771+'-'+_0x10858a+'/'+_0x510d46)[_0x6953('0x1d')](_0x548473);}return null;};}function patchUpdates(_0x2ba433){return function(_0x41f021){try{jsonpatch['apply'](_0x41f021,_0x2ba433,!![]);}catch(_0xf96d07){return BPromise[_0x6953('0x24')](_0xf96d07);}return _0x41f021['save']();};}function saveUpdates(_0x317979,_0x40c9d1){return function(_0xb92529){if(_0xb92529){return _0xb92529[_0x6953('0x25')](_0x317979)['then'](function(_0x37f339){return _0x37f339;});}return null;};}function removeEntity(_0x231cb2,_0x2a7f6a){return function(_0x508ea7){if(_0x508ea7){return _0x508ea7['destroy']()['then'](function(){_0x231cb2[_0x6953('0x1b')](0xcc)[_0x6953('0x1c')]();});}};}function handleEntityNotFound(_0x550be4,_0x1a32f4){return function(_0x587df0){if(!_0x587df0){_0x550be4[_0x6953('0x1a')](0x194);}return _0x587df0;};}function handleError(_0x2bf39b,_0xcdbce8){_0xcdbce8=_0xcdbce8||0x1f4;return function(_0x2cc01e){logger[_0x6953('0x26')](_0x2cc01e[_0x6953('0x27')]);if(_0x2cc01e['name']){delete _0x2cc01e[_0x6953('0x28')];}_0x2bf39b[_0x6953('0x1b')](_0xcdbce8)['send'](_0x2cc01e);};}exports[_0x6953('0x29')]=function(_0x4af39d,_0x173b3c){var _0x3b1175={},_0x426c7c={},_0x4b0325={'count':0x0,'rows':[]};var _0x131992=_[_0x6953('0x2a')](db[_0x6953('0x2b')]['rawAttributes'],function(_0x4c49fc){return{'name':_0x4c49fc[_0x6953('0x2c')],'type':_0x4c49fc['type']['key']};});_0x426c7c[_0x6953('0x2d')]=_[_0x6953('0x2a')](_0x131992,_0x6953('0x28'));_0x426c7c[_0x6953('0x2e')]=_[_0x6953('0x2f')](_0x4af39d['query']);_0x426c7c[_0x6953('0x30')]=_['intersection'](_0x426c7c[_0x6953('0x2d')],_0x426c7c[_0x6953('0x2e')]);_0x3b1175['attributes']=_['intersection'](_0x426c7c[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x4af39d[_0x6953('0x2e')]['fields']));_0x3b1175[_0x6953('0x32')]=_0x3b1175['attributes']['length']?_0x3b1175['attributes']:_0x426c7c['model'];if(!_0x4af39d[_0x6953('0x2e')][_0x6953('0x33')](_0x6953('0x34'))){_0x3b1175[_0x6953('0x20')]=qs[_0x6953('0x20')](_0x4af39d[_0x6953('0x2e')]['limit']);_0x3b1175[_0x6953('0x1e')]=qs['offset'](_0x4af39d[_0x6953('0x2e')]['offset']);}_0x3b1175[_0x6953('0x35')]=qs[_0x6953('0x36')](_0x4af39d[_0x6953('0x2e')][_0x6953('0x36')]);_0x3b1175['where']=qs[_0x6953('0x30')](_[_0x6953('0x37')](_0x4af39d[_0x6953('0x2e')],_0x426c7c[_0x6953('0x30')]),_0x131992);if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x38')]){_0x3b1175[_0x6953('0x39')]=_[_0x6953('0x3a')](_0x3b1175[_0x6953('0x39')],{'$or':_[_0x6953('0x2a')](_0x131992,function(_0x2d9d81){if(_0x2d9d81['type']!==_0x6953('0x3b')){var _0x3c03ab={};_0x3c03ab[_0x2d9d81[_0x6953('0x28')]]={'$like':'%'+_0x4af39d['query']['filter']+'%'};return _0x3c03ab;}})});}_0x3b1175=_[_0x6953('0x3a')]({},_0x3b1175,_0x4af39d['options']);var _0x5abaf2={'where':_0x3b1175[_0x6953('0x39')]};return db[_0x6953('0x2b')]['count'](_0x5abaf2)[_0x6953('0x3c')](function(_0x263728){_0x4b0325[_0x6953('0x21')]=_0x263728;if(_0x4af39d[_0x6953('0x2e')][_0x6953('0x3d')]){_0x3b1175[_0x6953('0x3e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6953('0x3f')](_0x3b1175);})[_0x6953('0x3c')](function(_0x30a27a){_0x4b0325[_0x6953('0x40')]=_0x30a27a;return _0x4b0325;})[_0x6953('0x3c')](respondWithFilteredResult(_0x173b3c,_0x3b1175))[_0x6953('0x41')](handleError(_0x173b3c,null));};exports['show']=function(_0x5a40de,_0xeef91a){var _0x54d7c2={'raw':!![],'where':{'id':_0x5a40de[_0x6953('0x42')]['id']}},_0x588ff8={};_0x588ff8[_0x6953('0x2d')]=_[_0x6953('0x2f')](db[_0x6953('0x2b')][_0x6953('0x43')]);_0x588ff8['query']=_['keys'](_0x5a40de[_0x6953('0x2e')]);_0x588ff8[_0x6953('0x30')]=_['intersection'](_0x588ff8[_0x6953('0x2d')],_0x588ff8['query']);_0x54d7c2[_0x6953('0x32')]=_[_0x6953('0x44')](_0x588ff8[_0x6953('0x2d')],qs[_0x6953('0x31')](_0x5a40de['query'][_0x6953('0x31')]));_0x54d7c2[_0x6953('0x32')]=_0x54d7c2['attributes'][_0x6953('0x45')]?_0x54d7c2[_0x6953('0x32')]:_0x588ff8[_0x6953('0x2d')];if(_0x5a40de[_0x6953('0x2e')][_0x6953('0x3d')]){_0x54d7c2[_0x6953('0x3e')]=[{'all':!![]}];}_0x54d7c2=_[_0x6953('0x3a')]({},_0x54d7c2,_0x5a40de[_0x6953('0x46')]);return db[_0x6953('0x2b')][_0x6953('0x47')](_0x54d7c2)[_0x6953('0x3c')](handleEntityNotFound(_0xeef91a,null))['then'](respondWithResult(_0xeef91a,null))[_0x6953('0x41')](handleError(_0xeef91a,null));};exports['describe']=function(_0x15c142,_0x1d5979){return db[_0x6953('0x2b')]['describe']()[_0x6953('0x3c')](respondWithResult(_0x1d5979,null))[_0x6953('0x41')](handleError(_0x1d5979,null));};exports['update']=function(_0x525145,_0xbf5b61){if(_0x525145[_0x6953('0x48')][_0x6953('0x49')]){delete _0x525145[_0x6953('0x48')][_0x6953('0x49')];}return db[_0x6953('0x2b')][_0x6953('0x47')]({'where':{'uniqueid':_0x525145[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xbf5b61,null))[_0x6953('0x3c')](saveUpdates(_0x525145[_0x6953('0x48')],null))['then'](respondWithResult(_0xbf5b61,null))['catch'](handleError(_0xbf5b61,null));};exports[_0x6953('0x4a')]=function(_0x38e3e8,_0x68ab5d,_0x7bcd92){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x38e3e8[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db['sequelize']['fn']('COUNT',db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db['sequelize']['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db['sequelize']['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x6953('0x4e')](_0x6953('0x57')))),'reCallContacts'],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x58')))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x68ab5d,null))['then'](respondWithResult(_0x68ab5d,null))[_0x6953('0x41')](handleError(_0x68ab5d,null));};exports[_0x6953('0x5a')]=function(_0x35ac0e,_0x57ffab,_0x479ab4){return db[_0x6953('0x2b')][_0x6953('0x3f')]({'raw':![],'where':{'CampaignId':_0x35ac0e[_0x6953('0x42')]['id']},'attributes':[[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5b')))),_0x6953('0x4d')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x4f')))),_0x6953('0x50')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5c')))),_0x6953('0x51')],[db[_0x6953('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x52')))),_0x6953('0x53')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db['sequelize']['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x54')))),_0x6953('0x55')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')](_0x6953('0x5d')))),_0x6953('0x56')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')]['literal'](_0x6953('0x57')))),_0x6953('0x5e')],[db[_0x6953('0x4b')]['fn'](_0x6953('0x4c'),db[_0x6953('0x4b')]['fn']('IF',db[_0x6953('0x4b')][_0x6953('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6953('0x59')]]})[_0x6953('0x3c')](handleEntityNotFound(_0x57ffab,null))['then'](respondWithResult(_0x57ffab,null))[_0x6953('0x41')](handleError(_0x57ffab,null));};exports[_0x6953('0x5f')]=function(_0x41d74d,_0x5063ac,_0x4cb8a4){return db[_0x6953('0x60')][_0x6953('0x47')]({'where':{'id':_0x41d74d[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0x5063ac,null))[_0x6953('0x3c')](function(_0x43a39f){var _0x3cf1c0;if(_0x43a39f){_0x3cf1c0=squel[_0x6953('0x61')]()[_0x6953('0x62')]('cm_hopper')[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),_0x6953('0x66'),'ListId',_0x6953('0x67'),_0x6953('0x68'),_0x6953('0x69')],squel['select']()[_0x6953('0x6a')](_0x6953('0x6b'),_0x6953('0x64'))[_0x6953('0x6a')]('NOW()',_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field']('ANY_VALUE(ListId)',_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(VoiceQueueId)','VoiceQueueId')[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x68'))[_0x6953('0x6a')]('NOW()',_0x6953('0x69'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id']['toString']())['where'](_0x6953('0x71'),_0x41d74d[_0x6953('0x48')][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x64'))[_0x6953('0x6f')](_0x6953('0x76'))[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d['params']['id'][_0x6953('0x73')]()))['where'](_0x6953('0x75'),squel['select']()[_0x6953('0x6a')](_0x6953('0x77'))[_0x6953('0x6f')]('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x70'),_0x41d74d[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))['group'](_0x6953('0x66')))[_0x6953('0x73')]();return db[_0x6953('0x4b')][_0x6953('0x2e')](_0x3cf1c0);}return[];})[_0x6953('0x3c')](respondWithResult(_0x5063ac,null))[_0x6953('0x41')](handleError(_0x5063ac,null));};exports[_0x6953('0x79')]=function(_0xa26241,_0xefb593,_0x216b92){return db[_0x6953('0x7a')]['find']({'where':{'id':_0xa26241[_0x6953('0x42')]['id']}})[_0x6953('0x3c')](handleEntityNotFound(_0xefb593,null))[_0x6953('0x3c')](function(_0x396a9f){var _0x92c0bc;if(_0x396a9f){_0x92c0bc=squel[_0x6953('0x61')]()[_0x6953('0x62')](_0x6953('0x76'))[_0x6953('0x63')]([_0x6953('0x64'),_0x6953('0x65'),'ContactId',_0x6953('0x6d'),_0x6953('0x7b'),_0x6953('0x68'),'updatedAt'],squel[_0x6953('0x7c')]()['field']('ANY_VALUE(calleridnum)',_0x6953('0x64'))[_0x6953('0x6a')](_0x6953('0x6e'),_0x6953('0x65'))[_0x6953('0x6a')](_0x6953('0x6c'),_0x6953('0x66'))['field'](_0x6953('0x7d'),_0x6953('0x6d'))[_0x6953('0x6a')]('ANY_VALUE(CampaignId)',_0x6953('0x7b'))[_0x6953('0x6a')]('NOW()',_0x6953('0x68'))['field']('NOW()',_0x6953('0x69'))['from']('cm_hopper_final')[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id']['toString']())[_0x6953('0x39')](_0x6953('0x71'),_0xa26241['body'][_0x6953('0x72')][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x74'))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x64'))['from'](_0x6953('0x76'))[_0x6953('0x39')]('CampaignId\x20=\x20?',_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]()))[_0x6953('0x39')](_0x6953('0x75'),squel[_0x6953('0x7c')]()[_0x6953('0x6a')](_0x6953('0x77'))['from'](_0x6953('0x7f'))[_0x6953('0x39')](_0x6953('0x7e'),_0xa26241[_0x6953('0x42')]['id'][_0x6953('0x73')]())[_0x6953('0x39')](_0x6953('0x78')))[_0x6953('0x80')](_0x6953('0x66')))['toString']();return db[_0x6953('0x4b')]['query'](_0x92c0bc);}return[];})[_0x6953('0x3c')](respondWithResult(_0xefb593,null))['catch'](handleError(_0xefb593,null));};exports[_0x6953('0x81')]=function(_0x7215ed,_0x3cb96a,_0x46bcec){return db[_0x6953('0x82')]['findOne']({'where':{'VoiceQueueId':_0x7215ed[_0x6953('0x48')]['VoiceQueueId'],'CampaignId':_0x7215ed[_0x6953('0x48')][_0x6953('0x7b')],'ContactId':_0x7215ed[_0x6953('0x48')][_0x6953('0x66')]}})['then'](handleEntityNotFound(_0x3cb96a,null))[_0x6953('0x3c')](function(_0x50f019){if(_0x50f019){return _0x50f019;}return null;})[_0x6953('0x3c')](respondWithResult(_0x3cb96a,null))[_0x6953('0x41')](handleError(_0x3cb96a,null));}; \ No newline at end of file +var _0x0295=['ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperFinal','includeAll','rows','catch','show','params','intersection','include','find','describe','body','uniqueid','findAll','sequelize','literal','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','createdAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','CmHopper','findOne','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3cbf29,_0x502fcc){var _0xac4006=function(_0x32fb98){while(--_0x32fb98){_0x3cbf29['push'](_0x3cbf29['shift']());}};_0xac4006(++_0x502fcc);}(_0x0295,0x1f0));var _0x5029=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x0295[_0x400322];return _0xfdd597;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['CmHopperFinal'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['CmHopperFinal'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')]()[_0x5029('0x20')](respondWithResult(_0x2bb7fc,null))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x449ef5,_0x18f1f5){if(_0x449ef5[_0x5029('0x45')][_0x5029('0x46')]){delete _0x449ef5[_0x5029('0x45')][_0x5029('0x46')];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'uniqueid':_0x449ef5[_0x5029('0x40')]['id']}})['then'](handleEntityNotFound(_0x18f1f5,null))[_0x5029('0x20')](saveUpdates(_0x449ef5['body'],null))[_0x5029('0x20')](respondWithResult(_0x18f1f5,null))[_0x5029('0x3e')](handleError(_0x18f1f5,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x5343c6,_0x319bff,_0x5e739d){return db['CmHopperFinal'][_0x5029('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x5343c6[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x5029('0x4a')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4c')))),_0x5029('0x4d')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x4e')))),'busyContacts'],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal']('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x50')))),_0x5029('0x51')],[db['sequelize']['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x2022,\x201,\x20null'))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x53')))),_0x5029('0x54')]]})['then'](handleEntityNotFound(_0x319bff,null))[_0x5029('0x20')](respondWithResult(_0x319bff,null))[_0x5029('0x3e')](handleError(_0x319bff,null));};exports[_0x5029('0x55')]=function(_0x2aebb3,_0x3a82f7,_0x26f56f){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x2aebb3[_0x5029('0x40')]['id']},'attributes':[[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x56')))),_0x5029('0x4a')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')]('`state`\x20=\x203,\x201,\x20null'))),_0x5029('0x4d')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x4e')))),_0x5029('0x57')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')][_0x5029('0x49')](_0x5029('0x58')))),_0x5029('0x59')],[db[_0x5029('0x48')]['fn']('COUNT',db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5029('0x4f')],[db['sequelize']['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db['sequelize'][_0x5029('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5029('0x51')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db['sequelize']['fn']('IF',db[_0x5029('0x48')]['literal'](_0x5029('0x5a')))),_0x5029('0x52')],[db[_0x5029('0x48')]['fn'](_0x5029('0x4b'),db[_0x5029('0x48')]['fn']('IF',db['sequelize'][_0x5029('0x49')](_0x5029('0x53')))),'answeringMachine']]})[_0x5029('0x20')](handleEntityNotFound(_0x3a82f7,null))[_0x5029('0x20')](respondWithResult(_0x3a82f7,null))[_0x5029('0x3e')](handleError(_0x3a82f7,null));};exports[_0x5029('0x5b')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){return db['VoiceQueue'][_0x5029('0x43')]({'where':{'id':_0x9b1c13['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x20')](function(_0x58db57){var _0x181956;if(_0x58db57){_0x181956=squel['insert']()['into'](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),_0x5029('0x5f'),'ContactId',_0x5029('0x60'),_0x5029('0x61'),'createdAt',_0x5029('0x62')],squel[_0x5029('0x63')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field']('ANY_VALUE(VoiceQueueId)',_0x5029('0x61'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x69'))[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))['from'](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x6b'),_0x9b1c13['params']['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x6d'),_0x9b1c13['body'][_0x5029('0x6e')][_0x5029('0x6c')]())[_0x5029('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel['select']()[_0x5029('0x64')](_0x5029('0x5e'))[_0x5029('0x70')](_0x5029('0x5c'))[_0x5029('0x38')]('VoiceQueueId\x20=\x20?',_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()['field'](_0x5029('0x71'))[_0x5029('0x70')](_0x5029('0x6a'))['where'](_0x5029('0x6b'),_0x9b1c13[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))['toString']();return db[_0x5029('0x48')][_0x5029('0x2c')](_0x181956);}return[];})[_0x5029('0x20')](respondWithResult(_0x1bd1c6,null))[_0x5029('0x3e')](handleError(_0x1bd1c6,null));};exports[_0x5029('0x74')]=function(_0x4c40d1,_0x209c83,_0x443070){return db[_0x5029('0x75')]['find']({'where':{'id':_0x4c40d1[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x209c83,null))['then'](function(_0x5c8bd4){var _0x524825;if(_0x5c8bd4){_0x524825=squel[_0x5029('0x76')]()[_0x5029('0x77')](_0x5029('0x5c'))[_0x5029('0x5d')]([_0x5029('0x5e'),'scheduledAt',_0x5029('0x67'),_0x5029('0x60'),_0x5029('0x78'),'createdAt','updatedAt'],squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x79'),_0x5029('0x5e'))['field'](_0x5029('0x65'),_0x5029('0x5f'))[_0x5029('0x64')](_0x5029('0x66'),_0x5029('0x67'))[_0x5029('0x64')](_0x5029('0x68'),_0x5029('0x60'))['field'](_0x5029('0x7a'),'CampaignId')['field'](_0x5029('0x65'),'createdAt')[_0x5029('0x64')](_0x5029('0x65'),_0x5029('0x62'))[_0x5029('0x70')](_0x5029('0x6a'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1[_0x5029('0x40')]['id']['toString']())['where'](_0x5029('0x6d'),_0x4c40d1['body']['state'][_0x5029('0x6c')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')](_0x5029('0x5e'))['from'](_0x5029('0x5c'))[_0x5029('0x38')](_0x5029('0x7b'),_0x4c40d1['params']['id'][_0x5029('0x6c')]()))[_0x5029('0x38')](_0x5029('0x6f'),squel[_0x5029('0x63')]()[_0x5029('0x64')]('calleridnum')['from'](_0x5029('0x6a'))[_0x5029('0x38')]('CampaignId\x20=\x20?',_0x4c40d1[_0x5029('0x40')]['id'][_0x5029('0x6c')]())[_0x5029('0x38')](_0x5029('0x72')))[_0x5029('0x73')](_0x5029('0x67')))[_0x5029('0x6c')]();return db[_0x5029('0x48')]['query'](_0x524825);}return[];})['then'](respondWithResult(_0x209c83,null))[_0x5029('0x3e')](handleError(_0x209c83,null));};exports['checkContactHopper']=function(_0x20a259,_0x5e5f88,_0x36fdce){return db[_0x5029('0x7c')][_0x5029('0x7d')]({'where':{'VoiceQueueId':_0x20a259['body'][_0x5029('0x61')],'CampaignId':_0x20a259[_0x5029('0x45')][_0x5029('0x78')],'ContactId':_0x20a259['body'][_0x5029('0x67')]}})[_0x5029('0x20')](handleEntityNotFound(_0x5e5f88,null))[_0x5029('0x20')](function(_0x4421bd){if(_0x4421bd){return _0x4421bd;}return null;})[_0x5029('0x20')](respondWithResult(_0x5e5f88,null))[_0x5029('0x3e')](handleError(_0x5e5f88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 23f4c7c..9b7cec5 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 _0x5e37=['bluebird','request-promise','path','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x501760,_0x5e3956){var _0x2180b5=function(_0x2744fd){while(--_0x2744fd){_0x501760['push'](_0x501760['shift']());}};_0x2180b5(++_0x5e3956);}(_0x5e37,0x195));var _0x75e3=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0x5e37[_0x2ff4bd];return _0x28edc6;};'use strict';var _=require(_0x75e3('0x0'));var util=require('util');var logger=require(_0x75e3('0x1'))(_0x75e3('0x2'));var moment=require('moment');var BPromise=require(_0x75e3('0x3'));var rp=require(_0x75e3('0x4'));var fs=require('fs');var path=require(_0x75e3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x75e3('0x6')]=function(_0x52c489,_0x144735){return _0x52c489[_0x75e3('0x7')](_0x75e3('0x8'),attributes,{'tableName':_0x75e3('0x9'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x75e3('0xa')]},{'name':_0x75e3('0xb'),'fields':[_0x75e3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc14c=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','exports'];(function(_0x11f20e,_0xfe98c8){var _0x56052f=function(_0x5a42e8){while(--_0x5a42e8){_0x11f20e['push'](_0x11f20e['shift']());}};_0x56052f(++_0xfe98c8);}(_0xc14c,0x1b1));var _0xcc14=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc14c[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xcc14('0x0'));var util=require(_0xcc14('0x1'));var logger=require(_0xcc14('0x2'))('api');var moment=require(_0xcc14('0x3'));var BPromise=require(_0xcc14('0x4'));var rp=require(_0xcc14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xcc14('0x6')]=function(_0x13c84e,_0x35b491){return _0x13c84e['define'](_0xcc14('0x7'),attributes,{'tableName':_0xcc14('0x8'),'paranoid':![],'indexes':[{'name':_0xcc14('0x9'),'fields':['calleridnum']},{'name':_0xcc14('0xa'),'fields':[_0xcc14('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 1901ae2..c5f3f41 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3a55fd,_0x2f45a1){var _0x534b01=function(_0x3e5326){while(--_0x3e5326){_0x3a55fd['push'](_0x3a55fd['shift']());}};_0x534b01(++_0x2f45a1);}(_0x7a54,0x106));var _0x47a5=function(_0x24fc57,_0x1cf3dc){_0x24fc57=_0x24fc57-0x0;var _0x3bd213=_0x7a54[_0x24fc57];return _0x3bd213;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x35ae91,_0x3308ab){var _0x19b5ba=function(_0x39a21a){while(--_0x39a21a){_0x35ae91['push'](_0x35ae91['shift']());}};_0x19b5ba(++_0x3308ab);}(_0xb10b,0x12a));var _0xbb10=function(_0x423f1c,_0x2adb8c){_0x423f1c=_0x423f1c-0x0;var _0xebed4c=_0xb10b[_0x423f1c];return _0xebed4c;};'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 20ed6f1..5000c35 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 _0x3713=['/:id','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x3713,0xa2));var _0x3371=function(_0x3a852a,_0xf3f1d3){_0x3a852a=_0x3a852a-0x0;var _0x48c902=_0x3713[_0x3a852a];return _0x48c902;};'use strict';var multer=require(_0x3371('0x0'));var util=require(_0x3371('0x1'));var path=require(_0x3371('0x2'));var timeout=require(_0x3371('0x3'));var express=require(_0x3371('0x4'));var router=express[_0x3371('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3371('0x6'));var interaction=require(_0x3371('0x7'));var config=require(_0x3371('0x8'));var controller=require(_0x3371('0x9'));router['get']('/',auth[_0x3371('0xa')](),controller[_0x3371('0xb')]);router[_0x3371('0xc')](_0x3371('0xd'),auth[_0x3371('0xa')](),controller[_0x3371('0xe')]);router['get']('/:id',auth[_0x3371('0xa')](),controller['show']);router[_0x3371('0xc')](_0x3371('0xf'),auth[_0x3371('0xa')](),controller[_0x3371('0x10')]);router[_0x3371('0xc')]('/campaign/countAttributes/:id',auth[_0x3371('0xa')](),controller[_0x3371('0x11')]);router[_0x3371('0x12')](_0x3371('0x13'),auth[_0x3371('0xa')](),controller[_0x3371('0x14')]);router[_0x3371('0x12')]('/voice/campaign/moveContacts/:id',auth[_0x3371('0xa')](),controller[_0x3371('0x15')]);router[_0x3371('0x12')]('/checkContactHopper',auth[_0x3371('0xa')](),controller['checkContactHopper']);router['put'](_0x3371('0x16'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xec81=['countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id'];(function(_0x2ec747,_0x2bf5ff){var _0x3b3d3c=function(_0x162e98){while(--_0x162e98){_0x2ec747['push'](_0x2ec747['shift']());}};_0x3b3d3c(++_0x2bf5ff);}(_0xec81,0xf6));var _0x1ec8=function(_0x30f242,_0x361217){_0x30f242=_0x30f242-0x0;var _0x203e30=_0xec81[_0x30f242];return _0x203e30;};'use strict';var multer=require(_0x1ec8('0x0'));var util=require(_0x1ec8('0x1'));var path=require(_0x1ec8('0x2'));var timeout=require(_0x1ec8('0x3'));var express=require('express');var router=express[_0x1ec8('0x4')]();var fs_extra=require(_0x1ec8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1ec8('0x6'));var config=require('../../config/environment');var controller=require(_0x1ec8('0x7'));router[_0x1ec8('0x8')]('/',auth[_0x1ec8('0x9')](),controller[_0x1ec8('0xa')]);router['get'](_0x1ec8('0xb'),auth[_0x1ec8('0x9')](),controller['describe']);router['get']('/:id',auth[_0x1ec8('0x9')](),controller['show']);router['get'](_0x1ec8('0xc'),auth[_0x1ec8('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x1ec8('0x8')](_0x1ec8('0xd'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0xe')]);router[_0x1ec8('0xf')](_0x1ec8('0x10'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0x11')]);router[_0x1ec8('0xf')](_0x1ec8('0x12'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0x13')]);router[_0x1ec8('0xf')](_0x1ec8('0x14'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0x15')]);router[_0x1ec8('0x16')](_0x1ec8('0x17'),auth[_0x1ec8('0x9')](),controller[_0x1ec8('0x18')]);module[_0x1ec8('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7664b3e..d2cc9cf 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 _0x66c7=['sequelize','exports','INTEGER','DATE','STRING','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x66c7,0x15c));var _0x766c=function(_0x25ae1d,_0xd6bb99){_0x25ae1d=_0x25ae1d-0x0;var _0x456126=_0x66c7[_0x25ae1d];return _0x456126;};'use strict';var Sequelize=require(_0x766c('0x0'));module[_0x766c('0x1')]={'state':{'type':Sequelize[_0x766c('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x766c('0x3')]},'countbusyretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x766c('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x766c('0x4')]},'calleridnum':{'type':Sequelize[_0x766c('0x4')]},'calleridname':{'type':Sequelize[_0x766c('0x4')]},'starttime':{'type':Sequelize[_0x766c('0x3')]},'responsetime':{'type':Sequelize[_0x766c('0x3')]},'answertime':{'type':Sequelize[_0x766c('0x3')]},'droptime':{'type':Sequelize[_0x766c('0x3')]},'endtime':{'type':Sequelize[_0x766c('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x766c('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x766c('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x766c('0x4')]},'amd':{'type':Sequelize[_0x766c('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x766c('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x766c('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x766c('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x766c('0x3')]},'recallme':{'type':Sequelize[_0x766c('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x766c('0x3')]},'edited':{'type':Sequelize[_0x766c('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x766c('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x766c('0x4')]}}; \ No newline at end of file +var _0xb1ad=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0xbddd94,_0x3435df){var _0x4b1d19=function(_0x14048e){while(--_0x14048e){_0xbddd94['push'](_0xbddd94['shift']());}};_0x4b1d19(++_0x3435df);}(_0xb1ad,0x184));var _0xdb1a=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xb1ad[_0x54d4fe];return _0x1ab5bb;};'use strict';var Sequelize=require(_0xdb1a('0x0'));module[_0xdb1a('0x1')]={'state':{'type':Sequelize[_0xdb1a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdb1a('0x3')]},'scheduledat':{'type':Sequelize[_0xdb1a('0x4')]},'countbusyretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdb1a('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xdb1a('0x3')]},'originatecalleridname':{'type':Sequelize[_0xdb1a('0x3')]},'calleridnum':{'type':Sequelize[_0xdb1a('0x3')]},'calleridname':{'type':Sequelize[_0xdb1a('0x3')]},'starttime':{'type':Sequelize[_0xdb1a('0x4')]},'responsetime':{'type':Sequelize[_0xdb1a('0x4')]},'answertime':{'type':Sequelize[_0xdb1a('0x4')]},'droptime':{'type':Sequelize[_0xdb1a('0x4')]},'endtime':{'type':Sequelize[_0xdb1a('0x4')]},'ringtime':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdb1a('0x3')]},'campaign':{'type':Sequelize[_0xdb1a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xdb1a('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xdb1a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xdb1a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdb1a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdb1a('0x4')]},'recallme':{'type':Sequelize[_0xdb1a('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xdb1a('0x4')]},'edited':{'type':Sequelize[_0xdb1a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdb1a('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 328ef5d..32d4dd8 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 _0x9549=['count','set','Content-Range','reject','save','update','destroy','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','fields','length','model','nolimit','sort','where','pick','VIRTUAL','filter','merge','CmHopperHistory','includeAll','findAll','then','rows','params','filters','include','find','catch','body','describe','uniqueid','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x44c894,_0x34bcaa){var _0x3071af=function(_0x44d20d){while(--_0x44d20d){_0x44c894['push'](_0x44c894['shift']());}};_0x3071af(++_0x34bcaa);}(_0x9549,0x1da));var _0x9954=function(_0xd8b2aa,_0x3b5e2c){_0xd8b2aa=_0xd8b2aa-0x0;var _0x5255c5=_0x9549[_0xd8b2aa];return _0x5255c5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9954('0x0'));var zipdir=require(_0x9954('0x1'));var jsonpatch=require(_0x9954('0x2'));var rp=require('request-promise');var moment=require(_0x9954('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9954('0x4'));var util=require(_0x9954('0x5'));var path=require(_0x9954('0x6'));var sox=require('sox');var csv=require(_0x9954('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9954('0x8'));var _=require(_0x9954('0x9'));var squel=require(_0x9954('0xa'));var crypto=require('crypto');var jsforce=require(_0x9954('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9954('0xc'));var Papa=require(_0x9954('0xd'));var Redis=require('ioredis');var authService=require(_0x9954('0xe'));var qs=require(_0x9954('0xf'));var as=require(_0x9954('0x10'));var hardwareService=require(_0x9954('0x11'));var logger=require(_0x9954('0x12'))(_0x9954('0x13'));var utils=require(_0x9954('0x14'));var config=require(_0x9954('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9954('0x16'))['db'];function respondWithStatusCode(_0x347705,_0x27d2cd){_0x27d2cd=_0x27d2cd||0xcc;return function(_0x2d6c26){if(_0x2d6c26){return _0x347705[_0x9954('0x17')](_0x27d2cd);}return _0x347705[_0x9954('0x18')](_0x27d2cd)[_0x9954('0x19')]();};}function respondWithResult(_0x37b2ab,_0x1a8e84){_0x1a8e84=_0x1a8e84||0xc8;return function(_0x8f55ed){if(_0x8f55ed){return _0x37b2ab[_0x9954('0x18')](_0x1a8e84)[_0x9954('0x1a')](_0x8f55ed);}};}function respondWithFilteredResult(_0xccfb3f,_0x4d9322){return function(_0x16f236){if(_0x16f236){var _0x220113=typeof _0x4d9322[_0x9954('0x1b')]===_0x9954('0x1c')&&typeof _0x4d9322[_0x9954('0x1d')]==='undefined';var _0x1552a8=_0x16f236[_0x9954('0x1e')];var _0x3c9852=_0x220113?0x0:_0x4d9322['offset'];var _0x4597ce=_0x220113?_0x16f236['count']:_0x4d9322[_0x9954('0x1b')]+_0x4d9322['limit'];var _0x3fd20b;if(_0x4597ce>=_0x1552a8){_0x4597ce=_0x1552a8;_0x3fd20b=0xc8;}else{_0x3fd20b=0xce;}_0xccfb3f[_0x9954('0x18')](_0x3fd20b);return _0xccfb3f[_0x9954('0x1f')](_0x9954('0x20'),_0x3c9852+'-'+_0x4597ce+'/'+_0x1552a8)[_0x9954('0x1a')](_0x16f236);}return null;};}function patchUpdates(_0xcaf449){return function(_0x30f779){try{jsonpatch['apply'](_0x30f779,_0xcaf449,!![]);}catch(_0x10f4ea){return BPromise[_0x9954('0x21')](_0x10f4ea);}return _0x30f779[_0x9954('0x22')]();};}function saveUpdates(_0x255006,_0x36a593){return function(_0x4f4dde){if(_0x4f4dde){return _0x4f4dde[_0x9954('0x23')](_0x255006)['then'](function(_0x137d79){return _0x137d79;});}return null;};}function removeEntity(_0x3a79d8,_0x1af4af){return function(_0x33786d){if(_0x33786d){return _0x33786d[_0x9954('0x24')]()['then'](function(){_0x3a79d8[_0x9954('0x18')](0xcc)[_0x9954('0x19')]();});}};}function handleEntityNotFound(_0x33db91,_0x4572a5){return function(_0x8e54a){if(!_0x8e54a){_0x33db91['sendStatus'](0x194);}return _0x8e54a;};}function handleError(_0x4613c9,_0x5f1fb4){_0x5f1fb4=_0x5f1fb4||0x1f4;return function(_0x1a43ae){logger[_0x9954('0x25')](_0x1a43ae['stack']);if(_0x1a43ae[_0x9954('0x26')]){delete _0x1a43ae[_0x9954('0x26')];}_0x4613c9[_0x9954('0x18')](_0x5f1fb4)['send'](_0x1a43ae);};}exports[_0x9954('0x27')]=function(_0x4c655a,_0x37d3fe){var _0x1f370c={},_0x4551bc={},_0x1fece4={'count':0x0,'rows':[]};var _0x1a6015=_[_0x9954('0x28')](db['CmHopperHistory'][_0x9954('0x29')],function(_0x58c9a8){return{'name':_0x58c9a8[_0x9954('0x2a')],'type':_0x58c9a8[_0x9954('0x2b')][_0x9954('0x2c')]};});_0x4551bc['model']=_['map'](_0x1a6015,_0x9954('0x26'));_0x4551bc['query']=_[_0x9954('0x2d')](_0x4c655a[_0x9954('0x2e')]);_0x4551bc['filters']=_['intersection'](_0x4551bc['model'],_0x4551bc['query']);_0x1f370c[_0x9954('0x2f')]=_[_0x9954('0x30')](_0x4551bc['model'],qs[_0x9954('0x31')](_0x4c655a[_0x9954('0x2e')][_0x9954('0x31')]));_0x1f370c['attributes']=_0x1f370c[_0x9954('0x2f')][_0x9954('0x32')]?_0x1f370c[_0x9954('0x2f')]:_0x4551bc[_0x9954('0x33')];if(!_0x4c655a[_0x9954('0x2e')]['hasOwnProperty'](_0x9954('0x34'))){_0x1f370c[_0x9954('0x1d')]=qs[_0x9954('0x1d')](_0x4c655a[_0x9954('0x2e')][_0x9954('0x1d')]);_0x1f370c[_0x9954('0x1b')]=qs[_0x9954('0x1b')](_0x4c655a[_0x9954('0x2e')][_0x9954('0x1b')]);}_0x1f370c['order']=qs['sort'](_0x4c655a['query'][_0x9954('0x35')]);_0x1f370c[_0x9954('0x36')]=qs['filters'](_[_0x9954('0x37')](_0x4c655a[_0x9954('0x2e')],_0x4551bc['filters']),_0x1a6015);if(_0x4c655a['query']['filter']){_0x1f370c[_0x9954('0x36')]=_['merge'](_0x1f370c[_0x9954('0x36')],{'$or':_[_0x9954('0x28')](_0x1a6015,function(_0x8be31d){if(_0x8be31d[_0x9954('0x2b')]!==_0x9954('0x38')){var _0x27d397={};_0x27d397[_0x8be31d[_0x9954('0x26')]]={'$like':'%'+_0x4c655a[_0x9954('0x2e')][_0x9954('0x39')]+'%'};return _0x27d397;}})});}_0x1f370c=_[_0x9954('0x3a')]({},_0x1f370c,_0x4c655a['options']);var _0x471988={'where':_0x1f370c[_0x9954('0x36')]};return db[_0x9954('0x3b')]['count'](_0x471988)['then'](function(_0x29da43){_0x1fece4[_0x9954('0x1e')]=_0x29da43;if(_0x4c655a[_0x9954('0x2e')][_0x9954('0x3c')]){_0x1f370c['include']=[{'all':!![]}];}return db[_0x9954('0x3b')][_0x9954('0x3d')](_0x1f370c);})[_0x9954('0x3e')](function(_0x28b1ec){_0x1fece4[_0x9954('0x3f')]=_0x28b1ec;return _0x1fece4;})[_0x9954('0x3e')](respondWithFilteredResult(_0x37d3fe,_0x1f370c))['catch'](handleError(_0x37d3fe,null));};exports['show']=function(_0x5dd751,_0x15bdad){var _0x20f0ab={'raw':!![],'where':{'id':_0x5dd751[_0x9954('0x40')]['id']}},_0x58a785={};_0x58a785[_0x9954('0x33')]=_[_0x9954('0x2d')](db[_0x9954('0x3b')][_0x9954('0x29')]);_0x58a785[_0x9954('0x2e')]=_['keys'](_0x5dd751['query']);_0x58a785[_0x9954('0x41')]=_[_0x9954('0x30')](_0x58a785[_0x9954('0x33')],_0x58a785[_0x9954('0x2e')]);_0x20f0ab[_0x9954('0x2f')]=_[_0x9954('0x30')](_0x58a785[_0x9954('0x33')],qs[_0x9954('0x31')](_0x5dd751[_0x9954('0x2e')][_0x9954('0x31')]));_0x20f0ab[_0x9954('0x2f')]=_0x20f0ab['attributes']['length']?_0x20f0ab[_0x9954('0x2f')]:_0x58a785['model'];if(_0x5dd751[_0x9954('0x2e')]['includeAll']){_0x20f0ab[_0x9954('0x42')]=[{'all':!![]}];}_0x20f0ab=_[_0x9954('0x3a')]({},_0x20f0ab,_0x5dd751['options']);return db[_0x9954('0x3b')][_0x9954('0x43')](_0x20f0ab)[_0x9954('0x3e')](handleEntityNotFound(_0x15bdad,null))[_0x9954('0x3e')](respondWithResult(_0x15bdad,null))[_0x9954('0x44')](handleError(_0x15bdad,null));};exports['create']=function(_0x322ad2,_0x5624dc){return db['CmHopperHistory']['create'](_0x322ad2[_0x9954('0x45')],{})[_0x9954('0x3e')](respondWithResult(_0x5624dc,0xc9))[_0x9954('0x44')](handleError(_0x5624dc,null));};exports[_0x9954('0x46')]=function(_0x3194d1,_0x1dd770){return db[_0x9954('0x3b')][_0x9954('0x46')]()[_0x9954('0x3e')](respondWithResult(_0x1dd770,null))['catch'](handleError(_0x1dd770,null));};exports[_0x9954('0x23')]=function(_0x1f5cb0,_0x287642){if(_0x1f5cb0['body'][_0x9954('0x47')]){delete _0x1f5cb0[_0x9954('0x45')][_0x9954('0x47')];}return db[_0x9954('0x3b')][_0x9954('0x43')]({'where':{'uniqueid':_0x1f5cb0['params']['id']}})[_0x9954('0x3e')](handleEntityNotFound(_0x287642,null))[_0x9954('0x3e')](saveUpdates(_0x1f5cb0[_0x9954('0x45')],null))['then'](respondWithResult(_0x287642,null))[_0x9954('0x44')](handleError(_0x287642,null));}; \ No newline at end of file +var _0x5e33=['map','CmHopperHistory','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','find','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','request-promise','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send'];(function(_0x2b2ce4,_0x38e23a){var _0x347ddd=function(_0x1c8e56){while(--_0x1c8e56){_0x2b2ce4['push'](_0x2b2ce4['shift']());}};_0x347ddd(++_0x38e23a);}(_0x5e33,0x14e));var _0x35e3=function(_0x32d6aa,_0x52f19f){_0x32d6aa=_0x32d6aa-0x0;var _0x237ea8=_0x5e33[_0x32d6aa];return _0x237ea8;};'use strict';var emlformat=require(_0x35e3('0x0'));var rimraf=require(_0x35e3('0x1'));var zipdir=require(_0x35e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35e3('0x3'));var moment=require('moment');var BPromise=require(_0x35e3('0x4'));var Mustache=require(_0x35e3('0x5'));var util=require(_0x35e3('0x6'));var path=require('path');var sox=require(_0x35e3('0x7'));var csv=require(_0x35e3('0x8'));var ejs=require(_0x35e3('0x9'));var fs=require('fs');var fs_extra=require(_0x35e3('0xa'));var _=require(_0x35e3('0xb'));var squel=require(_0x35e3('0xc'));var crypto=require('crypto');var jsforce=require(_0x35e3('0xd'));var deskjs=require(_0x35e3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x35e3('0xf'));var Papa=require(_0x35e3('0x10'));var Redis=require(_0x35e3('0x11'));var authService=require(_0x35e3('0x12'));var qs=require(_0x35e3('0x13'));var as=require(_0x35e3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x35e3('0x15'));var licenseUtil=require(_0x35e3('0x16'));var db=require(_0x35e3('0x17'))['db'];function respondWithStatusCode(_0x39f092,_0xf709f2){_0xf709f2=_0xf709f2||0xcc;return function(_0x50dc92){if(_0x50dc92){return _0x39f092[_0x35e3('0x18')](_0xf709f2);}return _0x39f092[_0x35e3('0x19')](_0xf709f2)[_0x35e3('0x1a')]();};}function respondWithResult(_0x468b1e,_0x2f235){_0x2f235=_0x2f235||0xc8;return function(_0x98b1f0){if(_0x98b1f0){return _0x468b1e[_0x35e3('0x19')](_0x2f235)[_0x35e3('0x1b')](_0x98b1f0);}};}function respondWithFilteredResult(_0x366b07,_0x56c98d){return function(_0x1d63ee){if(_0x1d63ee){var _0x39a480=typeof _0x56c98d[_0x35e3('0x1c')]==='undefined'&&typeof _0x56c98d['limit']==='undefined';var _0x449377=_0x1d63ee[_0x35e3('0x1d')];var _0x5ac4d2=_0x39a480?0x0:_0x56c98d[_0x35e3('0x1c')];var _0xa85b3e=_0x39a480?_0x1d63ee['count']:_0x56c98d[_0x35e3('0x1c')]+_0x56c98d[_0x35e3('0x1e')];var _0x46f215;if(_0xa85b3e>=_0x449377){_0xa85b3e=_0x449377;_0x46f215=0xc8;}else{_0x46f215=0xce;}_0x366b07['status'](_0x46f215);return _0x366b07[_0x35e3('0x1f')](_0x35e3('0x20'),_0x5ac4d2+'-'+_0xa85b3e+'/'+_0x449377)['json'](_0x1d63ee);}return null;};}function patchUpdates(_0x1ee283){return function(_0x50671f){try{jsonpatch[_0x35e3('0x21')](_0x50671f,_0x1ee283,!![]);}catch(_0x323f7b){return BPromise[_0x35e3('0x22')](_0x323f7b);}return _0x50671f[_0x35e3('0x23')]();};}function saveUpdates(_0x2d47de,_0x433746){return function(_0x1dd745){if(_0x1dd745){return _0x1dd745['update'](_0x2d47de)[_0x35e3('0x24')](function(_0x12f4e8){return _0x12f4e8;});}return null;};}function removeEntity(_0x158a4f,_0x45ed32){return function(_0x2d0fa4){if(_0x2d0fa4){return _0x2d0fa4[_0x35e3('0x25')]()['then'](function(){_0x158a4f[_0x35e3('0x19')](0xcc)[_0x35e3('0x1a')]();});}};}function handleEntityNotFound(_0x3e01a2,_0x13325e){return function(_0x1934af){if(!_0x1934af){_0x3e01a2[_0x35e3('0x18')](0x194);}return _0x1934af;};}function handleError(_0x272a2c,_0x2fed2f){_0x2fed2f=_0x2fed2f||0x1f4;return function(_0x5334e8){logger[_0x35e3('0x26')](_0x5334e8['stack']);if(_0x5334e8[_0x35e3('0x27')]){delete _0x5334e8[_0x35e3('0x27')];}_0x272a2c[_0x35e3('0x19')](_0x2fed2f)[_0x35e3('0x28')](_0x5334e8);};}exports['index']=function(_0x22fa58,_0x110d28){var _0x3802c7={},_0x446e46={},_0x1181ac={'count':0x0,'rows':[]};var _0x4ce0cc=_[_0x35e3('0x29')](db[_0x35e3('0x2a')][_0x35e3('0x2b')],function(_0x30123f){return{'name':_0x30123f[_0x35e3('0x2c')],'type':_0x30123f['type'][_0x35e3('0x2d')]};});_0x446e46[_0x35e3('0x2e')]=_['map'](_0x4ce0cc,_0x35e3('0x27'));_0x446e46[_0x35e3('0x2f')]=_['keys'](_0x22fa58[_0x35e3('0x2f')]);_0x446e46[_0x35e3('0x30')]=_[_0x35e3('0x31')](_0x446e46[_0x35e3('0x2e')],_0x446e46['query']);_0x3802c7['attributes']=_[_0x35e3('0x31')](_0x446e46[_0x35e3('0x2e')],qs['fields'](_0x22fa58[_0x35e3('0x2f')]['fields']));_0x3802c7[_0x35e3('0x32')]=_0x3802c7[_0x35e3('0x32')][_0x35e3('0x33')]?_0x3802c7[_0x35e3('0x32')]:_0x446e46['model'];if(!_0x22fa58[_0x35e3('0x2f')]['hasOwnProperty'](_0x35e3('0x34'))){_0x3802c7[_0x35e3('0x1e')]=qs['limit'](_0x22fa58[_0x35e3('0x2f')][_0x35e3('0x1e')]);_0x3802c7[_0x35e3('0x1c')]=qs[_0x35e3('0x1c')](_0x22fa58[_0x35e3('0x2f')][_0x35e3('0x1c')]);}_0x3802c7['order']=qs[_0x35e3('0x35')](_0x22fa58[_0x35e3('0x2f')]['sort']);_0x3802c7[_0x35e3('0x36')]=qs[_0x35e3('0x30')](_[_0x35e3('0x37')](_0x22fa58[_0x35e3('0x2f')],_0x446e46[_0x35e3('0x30')]),_0x4ce0cc);if(_0x22fa58['query'][_0x35e3('0x38')]){_0x3802c7[_0x35e3('0x36')]=_[_0x35e3('0x39')](_0x3802c7['where'],{'$or':_[_0x35e3('0x29')](_0x4ce0cc,function(_0x2e7d68){if(_0x2e7d68[_0x35e3('0x3a')]!==_0x35e3('0x3b')){var _0x1eaeeb={};_0x1eaeeb[_0x2e7d68[_0x35e3('0x27')]]={'$like':'%'+_0x22fa58[_0x35e3('0x2f')][_0x35e3('0x38')]+'%'};return _0x1eaeeb;}})});}_0x3802c7=_[_0x35e3('0x39')]({},_0x3802c7,_0x22fa58[_0x35e3('0x3c')]);var _0x1f1882={'where':_0x3802c7[_0x35e3('0x36')]};return db[_0x35e3('0x2a')][_0x35e3('0x1d')](_0x1f1882)[_0x35e3('0x24')](function(_0x55c117){_0x1181ac[_0x35e3('0x1d')]=_0x55c117;if(_0x22fa58['query'][_0x35e3('0x3d')]){_0x3802c7['include']=[{'all':!![]}];}return db[_0x35e3('0x2a')][_0x35e3('0x3e')](_0x3802c7);})[_0x35e3('0x24')](function(_0x3e4587){_0x1181ac[_0x35e3('0x3f')]=_0x3e4587;return _0x1181ac;})['then'](respondWithFilteredResult(_0x110d28,_0x3802c7))[_0x35e3('0x40')](handleError(_0x110d28,null));};exports[_0x35e3('0x41')]=function(_0xb8b595,_0x3684d4){var _0x88c3c7={'raw':!![],'where':{'id':_0xb8b595[_0x35e3('0x42')]['id']}},_0x469f95={};_0x469f95[_0x35e3('0x2e')]=_['keys'](db[_0x35e3('0x2a')][_0x35e3('0x2b')]);_0x469f95[_0x35e3('0x2f')]=_['keys'](_0xb8b595['query']);_0x469f95[_0x35e3('0x30')]=_[_0x35e3('0x31')](_0x469f95[_0x35e3('0x2e')],_0x469f95['query']);_0x88c3c7[_0x35e3('0x32')]=_[_0x35e3('0x31')](_0x469f95[_0x35e3('0x2e')],qs[_0x35e3('0x43')](_0xb8b595[_0x35e3('0x2f')]['fields']));_0x88c3c7[_0x35e3('0x32')]=_0x88c3c7[_0x35e3('0x32')]['length']?_0x88c3c7[_0x35e3('0x32')]:_0x469f95['model'];if(_0xb8b595[_0x35e3('0x2f')][_0x35e3('0x3d')]){_0x88c3c7[_0x35e3('0x44')]=[{'all':!![]}];}_0x88c3c7=_[_0x35e3('0x39')]({},_0x88c3c7,_0xb8b595['options']);return db[_0x35e3('0x2a')][_0x35e3('0x45')](_0x88c3c7)[_0x35e3('0x24')](handleEntityNotFound(_0x3684d4,null))[_0x35e3('0x24')](respondWithResult(_0x3684d4,null))[_0x35e3('0x40')](handleError(_0x3684d4,null));};exports[_0x35e3('0x46')]=function(_0x33beab,_0x3d78d4){return db[_0x35e3('0x2a')][_0x35e3('0x46')](_0x33beab['body'],{})[_0x35e3('0x24')](respondWithResult(_0x3d78d4,0xc9))[_0x35e3('0x40')](handleError(_0x3d78d4,null));};exports[_0x35e3('0x47')]=function(_0x479d91,_0x2a9351){return db[_0x35e3('0x2a')][_0x35e3('0x47')]()[_0x35e3('0x24')](respondWithResult(_0x2a9351,null))[_0x35e3('0x40')](handleError(_0x2a9351,null));};exports[_0x35e3('0x48')]=function(_0xccaefb,_0x59b12f){if(_0xccaefb[_0x35e3('0x49')][_0x35e3('0x4a')]){delete _0xccaefb[_0x35e3('0x49')]['uniqueid'];}return db[_0x35e3('0x2a')]['find']({'where':{'uniqueid':_0xccaefb[_0x35e3('0x42')]['id']}})[_0x35e3('0x24')](handleEntityNotFound(_0x59b12f,null))[_0x35e3('0x24')](saveUpdates(_0xccaefb[_0x35e3('0x49')],null))['then'](respondWithResult(_0x59b12f,null))[_0x35e3('0x40')](handleError(_0x59b12f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0befc55..73dd7c4 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 _0x565e=['uniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x54688c,_0x1bc838){var _0x1100d9=function(_0x2a751a){while(--_0x2a751a){_0x54688c['push'](_0x54688c['shift']());}};_0x1100d9(++_0x1bc838);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var logger=require(_0xe565('0x1'))(_0xe565('0x2'));var moment=require(_0xe565('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe565('0x4'));var rimraf=require(_0xe565('0x5'));var config=require(_0xe565('0x6'));var attributes=require(_0xe565('0x7'));module[_0xe565('0x8')]=function(_0x45ba66,_0xe4af03){return _0x45ba66[_0xe565('0x9')](_0xe565('0xa'),attributes,{'tableName':_0xe565('0xb'),'paranoid':![],'indexes':[{'name':_0xe565('0xc'),'fields':[_0xe565('0xc')]},{'name':_0xe565('0xd'),'fields':[_0xe565('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8921=['CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8921,0x9a));var _0x1892=function(_0x227648,_0x108213){_0x227648=_0x227648-0x0;var _0x486781=_0x8921[_0x227648];return _0x486781;};'use strict';var _=require(_0x1892('0x0'));var util=require('util');var logger=require(_0x1892('0x1'))(_0x1892('0x2'));var moment=require(_0x1892('0x3'));var BPromise=require(_0x1892('0x4'));var rp=require(_0x1892('0x5'));var fs=require('fs');var path=require(_0x1892('0x6'));var rimraf=require(_0x1892('0x7'));var config=require(_0x1892('0x8'));var attributes=require(_0x1892('0x9'));module[_0x1892('0xa')]=function(_0x40e2e5,_0x238d31){return _0x40e2e5['define'](_0x1892('0xb'),attributes,{'tableName':_0x1892('0xc'),'paranoid':![],'indexes':[{'name':_0x1892('0xd'),'fields':[_0x1892('0xd')]},{'name':_0x1892('0xe'),'fields':[_0x1892('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 35ed0c8..e46b075 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 _0xd0d5=['jayson/promise','client','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','catch','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','name','ivrAnswerCallsDay','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4b39df,_0x4b7245){var _0x2530a8=function(_0x1c2ee8){while(--_0x1c2ee8){_0x4b39df['push'](_0x4b39df['shift']());}};_0x2530a8(++_0x4b7245);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0xf6b11b,_0x24c1de){_0xf6b11b=_0xf6b11b-0x0;var _0x37ff55=_0xd0d5[_0xf6b11b];return _0x37ff55;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d0d('0x0'));var db=require(_0x5d0d('0x1'))['db'];var utils=require(_0x5d0d('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x5d0d('0x3'));var jayson=require(_0x5d0d('0x4'));var client=jayson[_0x5d0d('0x5')][_0x5d0d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5ace89,_0x36598d,_0xcfec38){return new BPromise(function(_0x11c549,_0x1404bf){return client[_0x5d0d('0x7')](_0x5ace89,_0xcfec38)['then'](function(_0x21a607){logger['info'](_0x5d0d('0x8'),_0x36598d,_0x5d0d('0x9'));logger[_0x5d0d('0xa')](_0x5d0d('0xb'),_0x36598d,_0x5d0d('0x9'),JSON[_0x5d0d('0xc')](_0x21a607));if(_0x21a607[_0x5d0d('0xd')]){if(_0x21a607['error'][_0x5d0d('0xe')]===0x1f4){logger[_0x5d0d('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x36598d,_0x21a607['error'][_0x5d0d('0xf')]);return _0x1404bf(_0x21a607[_0x5d0d('0xd')][_0x5d0d('0xf')]);}logger[_0x5d0d('0xd')](_0x5d0d('0x8'),_0x36598d,_0x21a607[_0x5d0d('0xd')][_0x5d0d('0xf')]);return _0x11c549(_0x21a607[_0x5d0d('0xd')][_0x5d0d('0xf')]);}else{logger[_0x5d0d('0x10')](_0x5d0d('0x8'),_0x36598d,_0x5d0d('0x9'));_0x11c549(_0x21a607[_0x5d0d('0x11')][_0x5d0d('0xf')]);}})['catch'](function(_0x68b55b){logger[_0x5d0d('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x36598d,_0x68b55b);_0x1404bf(_0x68b55b);});});}exports[_0x5d0d('0x12')]=function(_0x4567c6){var _0x286dcb=this;return new Promise(function(_0x1c24cc,_0x161a8e){return db[_0x5d0d('0x13')][_0x5d0d('0x14')](_0x4567c6[_0x5d0d('0x15')],{'raw':_0x4567c6[_0x5d0d('0x16')]?_0x4567c6['options'][_0x5d0d('0x17')]===undefined?!![]:![]:!![]})[_0x5d0d('0x18')](function(_0x29c332){logger['info'](_0x5d0d('0x12'),_0x4567c6);logger[_0x5d0d('0xa')](_0x5d0d('0x12'),_0x4567c6,JSON[_0x5d0d('0xc')](_0x29c332));_0x1c24cc(_0x29c332);})['catch'](function(_0x5a8e73){logger[_0x5d0d('0xd')](_0x5d0d('0x12'),_0x5a8e73['message'],_0x4567c6);_0x161a8e(_0x286dcb[_0x5d0d('0xd')](0x1f4,_0x5a8e73[_0x5d0d('0xf')]));});});};exports[_0x5d0d('0x19')]=function(_0xea36ca){var _0x1d6c1d=this;return new Promise(function(_0x41b525,_0x1ca18f){return db[_0x5d0d('0x13')][_0x5d0d('0x1a')]({'raw':_0xea36ca['options']?_0xea36ca[_0x5d0d('0x16')][_0x5d0d('0x17')]===undefined?!![]:![]:!![],'where':_0xea36ca[_0x5d0d('0x16')]?_0xea36ca[_0x5d0d('0x16')][_0x5d0d('0x1b')]||null:null,'attributes':[[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')][_0x5d0d('0x1e')]('id')),_0x5d0d('0x1f')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x5d0d('0x20')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db['sequelize']['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x22')))),_0x5d0d('0x23')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')]['literal'](_0x5d0d('0x24')))),_0x5d0d('0x25')],[db[_0x5d0d('0x1c')]['fn']('AVG',db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x26')))),_0x5d0d('0x27')],[db['sequelize']['fn'](_0x5d0d('0x28'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x29')))),_0x5d0d('0x2a')]]})[_0x5d0d('0x18')](function(_0x2564dd){logger[_0x5d0d('0x10')](_0x5d0d('0x19'),_0xea36ca);logger[_0x5d0d('0xa')](_0x5d0d('0x19'),_0xea36ca,JSON[_0x5d0d('0xc')](_0x2564dd));_0x41b525(_0x2564dd);})[_0x5d0d('0x2b')](function(_0x248202){logger[_0x5d0d('0xd')]('AvgHandleTime',_0x248202[_0x5d0d('0xf')],_0xea36ca);_0x1ca18f(_0x1d6c1d[_0x5d0d('0xd')](0x1f4,_0x248202[_0x5d0d('0xf')]));});});};exports[_0x5d0d('0x2c')]=function(_0x28c9d0){var _0x13fc1e=this;return new Promise(function(_0x185279,_0x83011e){return db[_0x5d0d('0x13')][_0x5d0d('0x1a')]({'raw':_0x28c9d0[_0x5d0d('0x16')]?_0x28c9d0[_0x5d0d('0x16')][_0x5d0d('0x17')]===undefined?!![]:![]:!![],'where':_0x28c9d0['options']?_0x28c9d0[_0x5d0d('0x16')]['where']||null:null,'attributes':[[_0x5d0d('0x2d'),'name'],[db['sequelize']['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db['sequelize'][_0x5d0d('0x21')](_0x5d0d('0x2e')))),_0x5d0d('0x2f')],[db['sequelize']['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x5d0d('0x30')))),'outboundNoAnswerCallsDay'],[db[_0x5d0d('0x1c')]['fn']('COUNT',db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x31')))),_0x5d0d('0x32')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db['sequelize'][_0x5d0d('0x21')](_0x5d0d('0x33')))),_0x5d0d('0x34')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x35')))),_0x5d0d('0x36')],[db['sequelize']['fn'](_0x5d0d('0x1d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5d0d('0x37')))),_0x5d0d('0x38')],[db[_0x5d0d('0x1c')]['fn']('COUNT',db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x39')))),_0x5d0d('0x3a')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x3b')))),'outboundUnknownCallsDay'],[db[_0x5d0d('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x3c')))),_0x5d0d('0x3d')],[db['sequelize']['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')](_0x5d0d('0x3f')))),'outboundRejectCallsDay'],[db[_0x5d0d('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5d0d('0x1c')][_0x5d0d('0x21')]('`state`\x20=\x2016,\x201,\x20null'))),_0x5d0d('0x40')],[db[_0x5d0d('0x1c')]['fn']('COUNT',db[_0x5d0d('0x1c')]['fn']('IF',db['sequelize'][_0x5d0d('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x5d0d('0x41')],[db['sequelize']['fn']('COUNT',db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')]['literal'](_0x5d0d('0x42')))),_0x5d0d('0x43')]],'group':[_0x5d0d('0x2d')]})['then'](function(_0x44bf4f){logger['info'](_0x5d0d('0x2c'),_0x28c9d0);logger[_0x5d0d('0xa')](_0x5d0d('0x2c'),_0x28c9d0,JSON[_0x5d0d('0xc')](_0x44bf4f));_0x185279(_0x44bf4f);})[_0x5d0d('0x2b')](function(_0x5bd551){logger[_0x5d0d('0xd')](_0x5d0d('0x2c'),_0x5bd551[_0x5d0d('0xf')],_0x28c9d0);_0x83011e(_0x13fc1e[_0x5d0d('0xd')](0x1f4,_0x5bd551[_0x5d0d('0xf')]));});});};exports[_0x5d0d('0x44')]=function(_0xb50a51){var _0x550f33=this;return new Promise(function(_0x279c51,_0x1d77a0){return db[_0x5d0d('0x13')]['findAll']({'raw':_0xb50a51[_0x5d0d('0x16')]?_0xb50a51['options'][_0x5d0d('0x17')]===undefined?!![]:![]:!![],'where':_0xb50a51[_0x5d0d('0x16')]?_0xb50a51[_0x5d0d('0x16')][_0x5d0d('0x1b')]||null:null,'attributes':[[_0x5d0d('0x2d'),_0x5d0d('0x45')],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db['sequelize'][_0x5d0d('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0x5d0d('0x1c')]['fn'](_0x5d0d('0x1d'),db[_0x5d0d('0x1c')]['fn']('IF',db[_0x5d0d('0x1c')]['literal'](_0x5d0d('0x31')))),_0x5d0d('0x46')]],'group':[_0x5d0d('0x2d')]})['then'](function(_0x5e13be){logger[_0x5d0d('0x10')]('GetCampaignHopperHistory',_0xb50a51);logger[_0x5d0d('0xa')](_0x5d0d('0x44'),_0xb50a51,JSON[_0x5d0d('0xc')](_0x5e13be));_0x279c51(_0x5e13be);})[_0x5d0d('0x2b')](function(_0x49da68){logger[_0x5d0d('0xd')]('GetCampaignHopperHistory',_0x49da68[_0x5d0d('0xf')],_0xb50a51);_0x1d77a0(_0x550f33[_0x5d0d('0xd')](0x1f4,_0x49da68[_0x5d0d('0xf')]));});});}; \ No newline at end of file +var _0xf04c=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','CmHopperHistory,\x20%s,\x20%s','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','stringify','AvgHandleTime','findAll','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf04c,0xfd));var _0xcf04=function(_0x4dbe82,_0x3e7d85){_0x4dbe82=_0x4dbe82-0x0;var _0x5c3e79=_0xf04c[_0x4dbe82];return _0x5c3e79;};'use strict';var _=require(_0xcf04('0x0'));var util=require(_0xcf04('0x1'));var moment=require(_0xcf04('0x2'));var BPromise=require(_0xcf04('0x3'));var rs=require(_0xcf04('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf04('0x5'))['db'];var utils=require(_0xcf04('0x6'));var logger=require(_0xcf04('0x7'))(_0xcf04('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf04('0x9'));var client=jayson[_0xcf04('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d26a7,_0x3a605c,_0x3002e9){return new BPromise(function(_0x2fe602,_0x5023cc){return client[_0xcf04('0xb')](_0x5d26a7,_0x3002e9)[_0xcf04('0xc')](function(_0x2598ed){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x3a605c,_0xcf04('0xd'));logger[_0xcf04('0xe')](_0xcf04('0xf'),_0x3a605c,'request\x20sent',JSON['stringify'](_0x2598ed));if(_0x2598ed[_0xcf04('0x10')]){if(_0x2598ed[_0xcf04('0x10')][_0xcf04('0x11')]===0x1f4){logger[_0xcf04('0x10')](_0xcf04('0x12'),_0x3a605c,_0x2598ed[_0xcf04('0x10')][_0xcf04('0x13')]);return _0x5023cc(_0x2598ed[_0xcf04('0x10')][_0xcf04('0x13')]);}logger[_0xcf04('0x10')](_0xcf04('0x12'),_0x3a605c,_0x2598ed[_0xcf04('0x10')]['message']);return _0x2fe602(_0x2598ed[_0xcf04('0x10')][_0xcf04('0x13')]);}else{logger[_0xcf04('0x14')](_0xcf04('0x12'),_0x3a605c,_0xcf04('0xd'));_0x2fe602(_0x2598ed[_0xcf04('0x15')][_0xcf04('0x13')]);}})[_0xcf04('0x16')](function(_0x33c116){logger['error'](_0xcf04('0x12'),_0x3a605c,_0x33c116);_0x5023cc(_0x33c116);});});}exports[_0xcf04('0x17')]=function(_0x511723){var _0x2e2c5f=this;return new Promise(function(_0x4bb065,_0x494620){return db[_0xcf04('0x18')]['create'](_0x511723[_0xcf04('0x19')],{'raw':_0x511723[_0xcf04('0x1a')]?_0x511723[_0xcf04('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4db7d4){logger[_0xcf04('0x14')](_0xcf04('0x17'),_0x511723);logger[_0xcf04('0xe')]('CreateCmHopperHistory',_0x511723,JSON[_0xcf04('0x1b')](_0x4db7d4));_0x4bb065(_0x4db7d4);})[_0xcf04('0x16')](function(_0x1ff929){logger[_0xcf04('0x10')](_0xcf04('0x17'),_0x1ff929[_0xcf04('0x13')],_0x511723);_0x494620(_0x2e2c5f[_0xcf04('0x10')](0x1f4,_0x1ff929[_0xcf04('0x13')]));});});};exports[_0xcf04('0x1c')]=function(_0x31384a){var _0x5590c5=this;return new Promise(function(_0x352836,_0x505591){return db[_0xcf04('0x18')][_0xcf04('0x1d')]({'raw':_0x31384a[_0xcf04('0x1a')]?_0x31384a['options'][_0xcf04('0x1e')]===undefined?!![]:![]:!![],'where':_0x31384a[_0xcf04('0x1a')]?_0x31384a[_0xcf04('0x1a')][_0xcf04('0x1f')]||null:null,'attributes':[[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db['sequelize'][_0xcf04('0x22')]('id')),_0xcf04('0x23')],[db[_0xcf04('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x25')))),_0xcf04('0x26')],[db['sequelize']['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0xcf04('0x27')],[db[_0xcf04('0x20')]['fn']('COUNT',db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn']('AVG',db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xcf04('0x29')],[db[_0xcf04('0x20')]['fn']('AVG',db[_0xcf04('0x20')]['fn']('IF',db['sequelize'][_0xcf04('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xcf04('0x2a')]]})[_0xcf04('0xc')](function(_0x5c2c67){logger[_0xcf04('0x14')](_0xcf04('0x1c'),_0x31384a);logger['debug'](_0xcf04('0x1c'),_0x31384a,JSON[_0xcf04('0x1b')](_0x5c2c67));_0x352836(_0x5c2c67);})[_0xcf04('0x16')](function(_0x3a0bb7){logger[_0xcf04('0x10')](_0xcf04('0x1c'),_0x3a0bb7[_0xcf04('0x13')],_0x31384a);_0x505591(_0x5590c5[_0xcf04('0x10')](0x1f4,_0x3a0bb7['message']));});});};exports[_0xcf04('0x2b')]=function(_0x3e4789){var _0x3ae46f=this;return new Promise(function(_0x3bad93,_0x3b0c6e){return db[_0xcf04('0x18')][_0xcf04('0x1d')]({'raw':_0x3e4789['options']?_0x3e4789[_0xcf04('0x1a')][_0xcf04('0x1e')]===undefined?!![]:![]:!![],'where':_0x3e4789['options']?_0x3e4789[_0xcf04('0x1a')]['where']||null:null,'attributes':[[_0xcf04('0x2c'),_0xcf04('0x2d')],[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db['sequelize'][_0xcf04('0x24')](_0xcf04('0x2e')))),'outboundNoSuchCallsDay'],[db[_0xcf04('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x2f')))),_0xcf04('0x30')],[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')]['literal'](_0xcf04('0x25')))),_0xcf04('0x31')],[db[_0xcf04('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcf04('0x20')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xcf04('0x32')],[db['sequelize']['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db['sequelize'][_0xcf04('0x24')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')]['literal'](_0xcf04('0x33')))),'outboundDropCallsDayTimeout'],[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x34')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db['sequelize'][_0xcf04('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),_0xcf04('0x35')],[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x36')))),_0xcf04('0x37')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x38')))),_0xcf04('0x39')],[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db['sequelize']['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xcf04('0x20')]['fn']('COUNT',db[_0xcf04('0x20')]['fn']('IF',db['sequelize'][_0xcf04('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0xcf04('0x3a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x3b')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')]['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x3c')))),'outboundReCallsDay']],'group':[_0xcf04('0x2c')]})['then'](function(_0x249040){logger[_0xcf04('0x14')](_0xcf04('0x2b'),_0x3e4789);logger[_0xcf04('0xe')](_0xcf04('0x2b'),_0x3e4789,JSON[_0xcf04('0x1b')](_0x249040));_0x3bad93(_0x249040);})['catch'](function(_0x5b8027){logger['error'](_0xcf04('0x2b'),_0x5b8027[_0xcf04('0x13')],_0x3e4789);_0x3b0c6e(_0x3ae46f[_0xcf04('0x10')](0x1f4,_0x5b8027['message']));});});};exports[_0xcf04('0x3d')]=function(_0x1292bc){var _0x759817=this;return new Promise(function(_0x1fd4ad,_0x51a49d){return db[_0xcf04('0x18')][_0xcf04('0x1d')]({'raw':_0x1292bc['options']?_0x1292bc['options'][_0xcf04('0x1e')]===undefined?!![]:![]:!![],'where':_0x1292bc[_0xcf04('0x1a')]?_0x1292bc[_0xcf04('0x1a')][_0xcf04('0x1f')]||null:null,'attributes':[[_0xcf04('0x2c'),'name'],[db[_0xcf04('0x20')]['fn'](_0xcf04('0x21'),db[_0xcf04('0x20')][_0xcf04('0x22')]('id')),_0xcf04('0x3e')],[db[_0xcf04('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcf04('0x20')][_0xcf04('0x24')](_0xcf04('0x25')))),_0xcf04('0x3f')]],'group':[_0xcf04('0x2c')]})[_0xcf04('0xc')](function(_0x4407c5){logger['info']('GetCampaignHopperHistory',_0x1292bc);logger[_0xcf04('0xe')](_0xcf04('0x3d'),_0x1292bc,JSON[_0xcf04('0x1b')](_0x4407c5));_0x1fd4ad(_0x4407c5);})['catch'](function(_0x18da0f){logger[_0xcf04('0x10')](_0xcf04('0x3d'),_0x18da0f[_0xcf04('0x13')],_0x1292bc);_0x51a49d(_0x759817[_0xcf04('0x10')](0x1f4,_0x18da0f[_0xcf04('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 25d7ec4..6aa5109 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 _0x588d=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','put','/:id','update','multer','util','path'];(function(_0x5bcf72,_0x23645b){var _0x12d511=function(_0x4bb9bf){while(--_0x4bb9bf){_0x5bcf72['push'](_0x5bcf72['shift']());}};_0x12d511(++_0x23645b);}(_0x588d,0x1dd));var _0xd588=function(_0xd0bc84,_0x2c02c4){_0xd0bc84=_0xd0bc84-0x0;var _0x26a709=_0x588d[_0xd0bc84];return _0x26a709;};'use strict';var multer=require(_0xd588('0x0'));var util=require(_0xd588('0x1'));var path=require(_0xd588('0x2'));var timeout=require('connect-timeout');var express=require(_0xd588('0x3'));var router=express[_0xd588('0x4')]();var fs_extra=require(_0xd588('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd588('0x6'));var config=require(_0xd588('0x7'));var controller=require('./cmHopperHistory.controller');router[_0xd588('0x8')]('/',auth[_0xd588('0x9')](),controller[_0xd588('0xa')]);router[_0xd588('0x8')](_0xd588('0xb'),auth[_0xd588('0x9')](),controller['describe']);router[_0xd588('0x8')]('/:id',auth[_0xd588('0x9')](),controller[_0xd588('0xc')]);router['post']('/',auth[_0xd588('0x9')](),controller['create']);router[_0xd588('0xd')](_0xd588('0xe'),auth['isAuthenticated'](),controller[_0xd588('0xf')]);module['exports']=router; \ No newline at end of file +var _0x655d=['../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x40a3bb,_0x5aa60c){var _0x528131=function(_0x5523be){while(--_0x5523be){_0x40a3bb['push'](_0x40a3bb['shift']());}};_0x528131(++_0x5aa60c);}(_0x655d,0xbe));var _0xd655=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x655d[_0x2be8c2];return _0x97f531;};'use strict';var multer=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var path=require(_0xd655('0x2'));var timeout=require(_0xd655('0x3'));var express=require(_0xd655('0x4'));var router=express['Router']();var fs_extra=require(_0xd655('0x5'));var auth=require(_0xd655('0x6'));var interaction=require(_0xd655('0x7'));var config=require(_0xd655('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0xd655('0x9')](),controller['index']);router[_0xd655('0xa')](_0xd655('0xb'),auth[_0xd655('0x9')](),controller[_0xd655('0xc')]);router[_0xd655('0xa')](_0xd655('0xd'),auth[_0xd655('0x9')](),controller[_0xd655('0xe')]);router[_0xd655('0xf')]('/',auth[_0xd655('0x9')](),controller[_0xd655('0x10')]);router['put'](_0xd655('0xd'),auth['isAuthenticated'](),controller['update']);module[_0xd655('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 0ad9a24..ca4d122 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 _0x2bd6=['sequelize','exports','STRING','name'];(function(_0x1ba9bd,_0x3299e8){var _0x19aae2=function(_0x1ebe8f){while(--_0x1ebe8f){_0x1ba9bd['push'](_0x1ba9bd['shift']());}};_0x19aae2(++_0x3299e8);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2bd6[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x62bd('0x0'));module[_0x62bd('0x1')]={'name':{'type':Sequelize[_0x62bd('0x2')],'unique':_0x62bd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x62bd('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x097c=['STRING','sequelize','exports'];(function(_0x18d57,_0x3a99e2){var _0x5b57ad=function(_0x31c6dc){while(--_0x31c6dc){_0x18d57['push'](_0x18d57['shift']());}};_0x5b57ad(++_0x3a99e2);}(_0x097c,0x1d5));var _0xc097=function(_0x25abc2,_0x1379d9){_0x25abc2=_0x25abc2-0x0;var _0x187caf=_0x097c[_0x25abc2];return _0x187caf;};'use strict';var Sequelize=require(_0xc097('0x0'));module[_0xc097('0x1')]={'name':{'type':Sequelize[_0xc097('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc097('0x2')]},'dialPrefix':{'type':Sequelize[_0xc097('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 41be91e..21bf362 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 _0xbb48=['findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','register','status','end','offset','undefined','limit','Content-Range','json','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmList','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','Disposition','findOne','rawAttributes','order','pick','removeDispositions','ids','addContacts','CmContact','describe','isArray','tags','join','push','each','omit','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','select','description','from','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','addCustomField','sequelize','CmCustomField','addCustomFields','Sequelize','TEXT','text','BOOLEAN','defaultValue','queryInterface','getCustomFields'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0xbb48,0x1db));var _0x8bb4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbb48[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x8bb4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bb4('0x1'));var jsonpatch=require(_0x8bb4('0x2'));var rp=require(_0x8bb4('0x3'));var moment=require(_0x8bb4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8bb4('0x5'));var util=require('util');var path=require(_0x8bb4('0x6'));var sox=require('sox');var csv=require(_0x8bb4('0x7'));var ejs=require(_0x8bb4('0x8'));var fs=require('fs');var fs_extra=require(_0x8bb4('0x9'));var _=require('lodash');var squel=require(_0x8bb4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8bb4('0x7'));var querystring=require('querystring');var Papa=require(_0x8bb4('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8bb4('0xc'));var as=require(_0x8bb4('0xd'));var hardwareService=require(_0x8bb4('0xe'));var logger=require(_0x8bb4('0xf'))(_0x8bb4('0x10'));var utils=require(_0x8bb4('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8bb4('0x12'));var db=require('../../mysqldb')['db'];var csv_results;config[_0x8bb4('0x13')]=_[_0x8bb4('0x14')](config[_0x8bb4('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x8bb4('0x15'))(new Redis(config[_0x8bb4('0x13')]));require('./cmList.socket')[_0x8bb4('0x16')](socket);function respondWithStatusCode(_0x47c407,_0xde868b){_0xde868b=_0xde868b||0xcc;return function(_0x4d7def){if(_0x4d7def){return _0x47c407['sendStatus'](_0xde868b);}return _0x47c407[_0x8bb4('0x17')](_0xde868b)[_0x8bb4('0x18')]();};}function respondWithResult(_0x412fdc,_0x58eb57){_0x58eb57=_0x58eb57||0xc8;return function(_0x569be5){if(_0x569be5){return _0x412fdc[_0x8bb4('0x17')](_0x58eb57)['json'](_0x569be5);}};}function respondWithFilteredResult(_0x37d940,_0x3d0550){return function(_0x15c071){if(_0x15c071){var _0x3710fa=typeof _0x3d0550[_0x8bb4('0x19')]===_0x8bb4('0x1a')&&typeof _0x3d0550[_0x8bb4('0x1b')]===_0x8bb4('0x1a');var _0x608d28=_0x15c071['count'];var _0x4b2104=_0x3710fa?0x0:_0x3d0550['offset'];var _0x3183c9=_0x3710fa?_0x15c071['count']:_0x3d0550['offset']+_0x3d0550[_0x8bb4('0x1b')];var _0x4662f3;if(_0x3183c9>=_0x608d28){_0x3183c9=_0x608d28;_0x4662f3=0xc8;}else{_0x4662f3=0xce;}_0x37d940[_0x8bb4('0x17')](_0x4662f3);return _0x37d940['set'](_0x8bb4('0x1c'),_0x4b2104+'-'+_0x3183c9+'/'+_0x608d28)[_0x8bb4('0x1d')](_0x15c071);}return null;};}function patchUpdates(_0xccfc9a){return function(_0x1c7281){try{jsonpatch[_0x8bb4('0x1e')](_0x1c7281,_0xccfc9a,!![]);}catch(_0x16f00d){return BPromise[_0x8bb4('0x1f')](_0x16f00d);}return _0x1c7281['save']();};}function saveUpdates(_0xfe9fd9,_0xff983){return function(_0x525473){if(_0x525473){return _0x525473[_0x8bb4('0x20')](_0xfe9fd9)['then'](function(_0x1309d0){return _0x1309d0;});}return null;};}function removeEntity(_0x69890f,_0xea7902){return function(_0x4101ce){if(_0x4101ce){return _0x4101ce[_0x8bb4('0x21')]()[_0x8bb4('0x22')](function(){var _0x114234=_0x4101ce['get']({'plain':!![]});var _0xca41a4='Lists';return db['UserProfileResource'][_0x8bb4('0x21')]({'where':{'type':_0xca41a4,'resourceId':_0x114234['id']}})[_0x8bb4('0x22')](function(){return _0x4101ce;});})[_0x8bb4('0x22')](function(){_0x69890f[_0x8bb4('0x17')](0xcc)[_0x8bb4('0x18')]();});}};}function handleEntityNotFound(_0x40b75b,_0x2d9abf){return function(_0x2939e9){if(!_0x2939e9){_0x40b75b[_0x8bb4('0x23')](0x194);}return _0x2939e9;};}function handleError(_0xa3f76a,_0x184ea5){_0x184ea5=_0x184ea5||0x1f4;return function(_0x265eb4){logger[_0x8bb4('0x24')](_0x265eb4[_0x8bb4('0x25')]);if(_0x265eb4[_0x8bb4('0x26')]){delete _0x265eb4[_0x8bb4('0x26')];}_0xa3f76a[_0x8bb4('0x17')](_0x184ea5)[_0x8bb4('0x27')](_0x265eb4);};}exports[_0x8bb4('0x28')]=function(_0x6f564b,_0x45ce5e){var _0x320690={},_0x3e2f5a={},_0x4d3e72={'count':0x0,'rows':[]};var _0x3db3a0=_[_0x8bb4('0x29')](db[_0x8bb4('0x2a')]['rawAttributes'],function(_0x487777){return{'name':_0x487777[_0x8bb4('0x2b')],'type':_0x487777[_0x8bb4('0x2c')]['key']};});_0x3e2f5a[_0x8bb4('0x2d')]=_[_0x8bb4('0x29')](_0x3db3a0,_0x8bb4('0x26'));_0x3e2f5a['query']=_[_0x8bb4('0x2e')](_0x6f564b[_0x8bb4('0x2f')]);_0x3e2f5a['filters']=_[_0x8bb4('0x30')](_0x3e2f5a[_0x8bb4('0x2d')],_0x3e2f5a[_0x8bb4('0x2f')]);_0x320690[_0x8bb4('0x31')]=_[_0x8bb4('0x30')](_0x3e2f5a[_0x8bb4('0x2d')],qs[_0x8bb4('0x32')](_0x6f564b['query'][_0x8bb4('0x32')]));_0x320690[_0x8bb4('0x31')]=_0x320690['attributes'][_0x8bb4('0x33')]?_0x320690[_0x8bb4('0x31')]:_0x3e2f5a[_0x8bb4('0x2d')];if(!_0x6f564b[_0x8bb4('0x2f')][_0x8bb4('0x34')](_0x8bb4('0x35'))){_0x320690[_0x8bb4('0x1b')]=qs['limit'](_0x6f564b['query'][_0x8bb4('0x1b')]);_0x320690[_0x8bb4('0x19')]=qs['offset'](_0x6f564b[_0x8bb4('0x2f')][_0x8bb4('0x19')]);}_0x320690['order']=qs['sort'](_0x6f564b[_0x8bb4('0x2f')][_0x8bb4('0x36')]);_0x320690['where']=qs[_0x8bb4('0x37')](_['pick'](_0x6f564b[_0x8bb4('0x2f')],_0x3e2f5a['filters']),_0x3db3a0);if(_0x6f564b['query'][_0x8bb4('0x38')]){_0x320690[_0x8bb4('0x39')]=_[_0x8bb4('0x3a')](_0x320690[_0x8bb4('0x39')],{'$or':_['map'](_0x3db3a0,function(_0x5c8766){if(_0x5c8766['type']!=='VIRTUAL'){var _0x285254={};_0x285254[_0x5c8766[_0x8bb4('0x26')]]={'$like':'%'+_0x6f564b[_0x8bb4('0x2f')]['filter']+'%'};return _0x285254;}})});}_0x320690=_['merge']({},_0x320690,_0x6f564b[_0x8bb4('0x3b')]);var _0x50b7cf={'where':_0x320690[_0x8bb4('0x39')]};return db[_0x8bb4('0x2a')][_0x8bb4('0x3c')](_0x50b7cf)[_0x8bb4('0x22')](function(_0x5aa900){_0x4d3e72['count']=_0x5aa900;if(_0x6f564b[_0x8bb4('0x2f')][_0x8bb4('0x3d')]){_0x320690[_0x8bb4('0x3e')]=[{'all':!![]}];}return db[_0x8bb4('0x2a')][_0x8bb4('0x3f')](_0x320690);})[_0x8bb4('0x22')](function(_0x504ea0){_0x4d3e72[_0x8bb4('0x40')]=_0x504ea0;return _0x4d3e72;})['then'](respondWithFilteredResult(_0x45ce5e,_0x320690))['catch'](handleError(_0x45ce5e,null));};exports['show']=function(_0x1f8c51,_0xeb15f7){var _0x32c504={'raw':![],'where':{'id':_0x1f8c51[_0x8bb4('0x41')]['id']}},_0x42e0b1={};_0x42e0b1[_0x8bb4('0x2d')]=_[_0x8bb4('0x2e')](db[_0x8bb4('0x2a')]['rawAttributes']);_0x42e0b1[_0x8bb4('0x2f')]=_['keys'](_0x1f8c51[_0x8bb4('0x2f')]);_0x42e0b1[_0x8bb4('0x37')]=_[_0x8bb4('0x30')](_0x42e0b1[_0x8bb4('0x2d')],_0x42e0b1[_0x8bb4('0x2f')]);_0x32c504[_0x8bb4('0x31')]=_[_0x8bb4('0x30')](_0x42e0b1[_0x8bb4('0x2d')],qs[_0x8bb4('0x32')](_0x1f8c51[_0x8bb4('0x2f')]['fields']));_0x32c504['attributes']=_0x32c504[_0x8bb4('0x31')][_0x8bb4('0x33')]?_0x32c504[_0x8bb4('0x31')]:_0x42e0b1['model'];if(_0x1f8c51[_0x8bb4('0x2f')][_0x8bb4('0x3d')]){_0x32c504[_0x8bb4('0x3e')]=[{'all':!![]}];}_0x32c504=_[_0x8bb4('0x3a')]({},_0x32c504,_0x1f8c51['options']);return db['CmList'][_0x8bb4('0x42')](_0x32c504)[_0x8bb4('0x22')](handleEntityNotFound(_0xeb15f7,null))[_0x8bb4('0x22')](respondWithResult(_0xeb15f7,null))[_0x8bb4('0x43')](handleError(_0xeb15f7,null));};exports[_0x8bb4('0x44')]=function(_0x57db4c,_0x44305e){return db['CmList'][_0x8bb4('0x44')](_0x57db4c[_0x8bb4('0x45')],{})[_0x8bb4('0x22')](function(_0x524f14){var _0x3b4f71=_0x57db4c[_0x8bb4('0x46')]['get']({'plain':!![]});if(!_0x3b4f71)throw new Error(_0x8bb4('0x47'));if(_0x3b4f71[_0x8bb4('0x48')]==='user'){var _0x14eb9e=_0x524f14[_0x8bb4('0x49')]({'plain':!![]});var _0x5d1397='Lists';return db['UserProfileSection'][_0x8bb4('0x42')]({'where':{'name':_0x5d1397,'userProfileId':_0x3b4f71['userProfileId']},'raw':!![]})[_0x8bb4('0x22')](function(_0xb8960b){if(_0xb8960b&&_0xb8960b[_0x8bb4('0x4a')]===0x0){return db[_0x8bb4('0x4b')][_0x8bb4('0x44')]({'name':_0x14eb9e[_0x8bb4('0x26')],'resourceId':_0x14eb9e['id'],'type':_0xb8960b[_0x8bb4('0x26')],'sectionId':_0xb8960b['id']},{})[_0x8bb4('0x22')](function(){return _0x524f14;});}else{return _0x524f14;}})[_0x8bb4('0x43')](function(_0xf3b710){logger[_0x8bb4('0x24')](_0x8bb4('0x4c'),_0xf3b710);throw _0xf3b710;});}return _0x524f14;})[_0x8bb4('0x22')](respondWithResult(_0x44305e,0xc9))[_0x8bb4('0x43')](handleError(_0x44305e,null));};exports['update']=function(_0x3a60df,_0x48cc6e){if(_0x3a60df['body']['id']){delete _0x3a60df[_0x8bb4('0x45')]['id'];}return db['CmList'][_0x8bb4('0x42')]({'where':{'id':_0x3a60df[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x48cc6e,null))[_0x8bb4('0x22')](saveUpdates(_0x3a60df['body'],null))[_0x8bb4('0x22')](respondWithResult(_0x48cc6e,null))[_0x8bb4('0x43')](handleError(_0x48cc6e,null));};exports['destroy']=function(_0x4087ad,_0x9623d4){return db['CmList'][_0x8bb4('0x42')]({'where':{'id':_0x4087ad[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x9623d4,null))[_0x8bb4('0x22')](removeEntity(_0x9623d4,null))[_0x8bb4('0x43')](handleError(_0x9623d4,null));};exports['describe']=function(_0x5efce5,_0x4c4a9f){return db[_0x8bb4('0x2a')]['describe']()[_0x8bb4('0x22')](respondWithResult(_0x4c4a9f,null))[_0x8bb4('0x43')](handleError(_0x4c4a9f,null));};exports[_0x8bb4('0x4d')]=function(_0x567262,_0x3c45a5,_0x5c26c6){if(_0x567262[_0x8bb4('0x45')]['id']){delete _0x567262['body']['id'];}return db[_0x8bb4('0x2a')][_0x8bb4('0x42')]({'where':{'id':_0x567262['params']['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x3c45a5,null))[_0x8bb4('0x22')](function(_0x2b6886){if(_0x2b6886){_0x567262['body'][_0x8bb4('0x4e')]=_0x2b6886['id'];return db[_0x8bb4('0x4f')][_0x8bb4('0x44')](_0x567262[_0x8bb4('0x45')]);}})[_0x8bb4('0x22')](respondWithResult(_0x3c45a5,null))['catch'](handleError(_0x3c45a5,null));};exports['getDispositions']=function(_0x1c4b8a,_0x19c95b,_0x323bf6){var _0x3a6712={'raw':![],'where':{}};var _0x3eb91d={};var _0x3a08a7={'count':0x0,'rows':[]};return db[_0x8bb4('0x2a')][_0x8bb4('0x50')]({'where':{'id':_0x1c4b8a[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x19c95b,null))[_0x8bb4('0x22')](function(_0xb60efa){if(_0xb60efa){_0x3eb91d[_0x8bb4('0x2d')]=_[_0x8bb4('0x2e')](db[_0x8bb4('0x4f')][_0x8bb4('0x51')]);_0x3eb91d['query']=_['keys'](_0x1c4b8a[_0x8bb4('0x2f')]);_0x3eb91d[_0x8bb4('0x37')]=_[_0x8bb4('0x30')](_0x3eb91d['model'],_0x3eb91d[_0x8bb4('0x2f')]);_0x3a6712[_0x8bb4('0x31')]=_[_0x8bb4('0x30')](_0x3eb91d[_0x8bb4('0x2d')],qs[_0x8bb4('0x32')](_0x1c4b8a[_0x8bb4('0x2f')][_0x8bb4('0x32')]));_0x3a6712['attributes']=_0x3a6712['attributes'][_0x8bb4('0x33')]?_0x3a6712['attributes']:_0x3eb91d[_0x8bb4('0x2d')];if(!_0x1c4b8a[_0x8bb4('0x2f')][_0x8bb4('0x34')](_0x8bb4('0x35'))){_0x3a6712[_0x8bb4('0x1b')]=qs[_0x8bb4('0x1b')](_0x1c4b8a[_0x8bb4('0x2f')][_0x8bb4('0x1b')]);_0x3a6712[_0x8bb4('0x19')]=qs['offset'](_0x1c4b8a['query'][_0x8bb4('0x19')]);}_0x3a6712[_0x8bb4('0x52')]=qs[_0x8bb4('0x36')](_0x1c4b8a[_0x8bb4('0x2f')][_0x8bb4('0x36')]);_0x3a6712[_0x8bb4('0x39')]=qs[_0x8bb4('0x37')](_[_0x8bb4('0x53')](_0x1c4b8a[_0x8bb4('0x2f')],_0x3eb91d[_0x8bb4('0x37')]));_0x3a6712['where'][_0x8bb4('0x4e')]=_0xb60efa['id'];if(_0x1c4b8a[_0x8bb4('0x2f')][_0x8bb4('0x38')]){_0x3a6712['where']=_[_0x8bb4('0x3a')](_0x3a6712['where'],{'$or':_[_0x8bb4('0x29')](_0x3a6712[_0x8bb4('0x31')],function(_0x5bbdae){var _0x122cc5={};_0x122cc5[_0x5bbdae]={'$like':'%'+_0x1c4b8a[_0x8bb4('0x2f')]['filter']+'%'};return _0x122cc5;})});}_0x3a6712=_['merge']({},_0x3a6712,_0x1c4b8a[_0x8bb4('0x3b')]);return db['Disposition'][_0x8bb4('0x3c')]({'where':_0x3a6712[_0x8bb4('0x39')]})[_0x8bb4('0x22')](function(_0x2b7dba){_0x3a08a7['count']=_0x2b7dba;if(_0x1c4b8a['query']['includeAll']){_0x3a6712[_0x8bb4('0x3e')]=[{'all':!![]}];}return db[_0x8bb4('0x4f')]['findAll'](_0x3a6712);})[_0x8bb4('0x22')](function(_0x38b573){_0x3a08a7[_0x8bb4('0x40')]=_0x38b573;return _0x3a08a7;});}})[_0x8bb4('0x22')](respondWithFilteredResult(_0x19c95b,_0x3a6712))['catch'](handleError(_0x19c95b,null));};exports[_0x8bb4('0x54')]=function(_0x3a40cd,_0x58ae35,_0x4397f9){return db['CmList']['find']({'where':{'id':_0x3a40cd[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x58ae35,null))[_0x8bb4('0x22')](function(_0x1644e4){if(_0x1644e4){return _0x1644e4[_0x8bb4('0x54')](_0x3a40cd['query'][_0x8bb4('0x55')]);}})[_0x8bb4('0x22')](respondWithStatusCode(_0x58ae35,null))[_0x8bb4('0x43')](handleError(_0x58ae35,null));};exports[_0x8bb4('0x56')]=function(_0x393dc8,_0x3678f3,_0x3f841c){return db[_0x8bb4('0x2a')][_0x8bb4('0x42')]({'where':{'id':_0x393dc8[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x3678f3,null))[_0x8bb4('0x22')](function(_0x485f49){if(_0x485f49){var _0x444961=[];var _0x45146f={'success':[],'errors':[]};return db[_0x8bb4('0x57')][_0x8bb4('0x58')]()['then'](function(_0x58a38c){if(_0x393dc8['body']['tags']&&_[_0x8bb4('0x59')](_0x393dc8[_0x8bb4('0x45')][_0x8bb4('0x5a')])){if(_0x393dc8[_0x8bb4('0x45')]['tags'][_0x8bb4('0x33')]){_0x393dc8[_0x8bb4('0x45')][_0x8bb4('0x5a')]=_0x393dc8['body']['tags'][_0x8bb4('0x5b')](';')+';';}else{_0x393dc8['body'][_0x8bb4('0x5a')]=null;}}else{_0x393dc8[_0x8bb4('0x45')][_0x8bb4('0x5a')]=null;}if(_0x393dc8[_0x8bb4('0x45')]&&_['isArray'](_0x393dc8[_0x8bb4('0x45')])){for(var _0x561998=0x0;_0x561998<_0x393dc8[_0x8bb4('0x45')][_0x8bb4('0x33')];_0x561998+=0x1){_0x393dc8['body'][_0x561998][_0x8bb4('0x4e')]=_0x393dc8[_0x8bb4('0x41')]['id'];_0x444961[_0x8bb4('0x5c')](_0x393dc8[_0x8bb4('0x45')][_0x561998]);}return BPromise[_0x8bb4('0x5d')](_0x444961,function(_0x4bc6b3){return db['CmContact'][_0x8bb4('0x44')](_[_0x8bb4('0x5e')](_0x4bc6b3,['ids','id'])||{},{'fields':_['keys'](_0x58a38c),'raw':!![]})[_0x8bb4('0x22')](function(_0x15bb05){_0x45146f[_0x8bb4('0x5f')][_0x8bb4('0x5c')](_0x15bb05[_0x8bb4('0x60')]);})[_0x8bb4('0x43')](function(_0x3213a9){_0x45146f[_0x8bb4('0x61')][_0x8bb4('0x5c')]({'data':_0x4bc6b3,'error':_0x3213a9['message']});});})[_0x8bb4('0x22')](function(_0x293942){return _0x45146f;})['catch'](function(_0x5d9d3c){return _0x5d9d3c;});}else{_0x3678f3['status'](0x190)[_0x8bb4('0x1d')]({'message':_0x8bb4('0x62')});}});}})[_0x8bb4('0x22')](respondWithResult(_0x3678f3,null))['catch'](handleError(_0x3678f3,null));};exports[_0x8bb4('0x63')]=function(_0x854868,_0x30a4d0,_0x5805b2){var _0x56a293;return db[_0x8bb4('0x2a')][_0x8bb4('0x42')]({'where':{'id':_0x854868['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x8bb4('0x64')}]})[_0x8bb4('0x22')](handleEntityNotFound(_0x30a4d0,null))[_0x8bb4('0x22')](function(_0x52e0d3){if(_0x52e0d3){_0x56a293=_0x52e0d3;return db[_0x8bb4('0x57')][_0x8bb4('0x51')];}})['then'](function(_0x5bd703){if(_0x5bd703){var _0xf1f7c8={};var _0x44bd4c={};_0x44bd4c[_0x8bb4('0x2d')]=_[_0x8bb4('0x65')](_['keys'](_0x5bd703),_[_0x8bb4('0x29')](_0x56a293[_0x8bb4('0x64')],function(_0x2b2002){return util[_0x8bb4('0x66')](_0x8bb4('0x67'),_0x2b2002['id']);}));_0x44bd4c[_0x8bb4('0x2f')]=_['keys'](_0x854868['query']);_0x44bd4c[_0x8bb4('0x37')]=_[_0x8bb4('0x30')](_0x44bd4c[_0x8bb4('0x2d')],_0x44bd4c[_0x8bb4('0x2f')]);_0xf1f7c8[_0x8bb4('0x31')]=_[_0x8bb4('0x30')](_0x44bd4c[_0x8bb4('0x2d')],qs[_0x8bb4('0x32')](_0x854868[_0x8bb4('0x2f')][_0x8bb4('0x32')]));_0xf1f7c8[_0x8bb4('0x31')]=_0xf1f7c8[_0x8bb4('0x31')][_0x8bb4('0x33')]?_0xf1f7c8[_0x8bb4('0x31')]:_0x44bd4c[_0x8bb4('0x2d')];if(!_0x854868['query'][_0x8bb4('0x34')](_0x8bb4('0x35'))){_0xf1f7c8[_0x8bb4('0x1b')]=qs[_0x8bb4('0x1b')](_0x854868[_0x8bb4('0x2f')][_0x8bb4('0x1b')]);_0xf1f7c8[_0x8bb4('0x19')]=qs[_0x8bb4('0x19')](_0x854868[_0x8bb4('0x2f')][_0x8bb4('0x19')]);}_0xf1f7c8[_0x8bb4('0x52')]=qs[_0x8bb4('0x36')](_0x854868[_0x8bb4('0x2f')][_0x8bb4('0x36')]);_0xf1f7c8[_0x8bb4('0x39')]=qs[_0x8bb4('0x37')](_[_0x8bb4('0x53')](_0x854868[_0x8bb4('0x2f')],_0x44bd4c[_0x8bb4('0x37')]));_0xf1f7c8[_0x8bb4('0x68')]=!![];if(_0x854868['query'][_0x8bb4('0x38')]){_0xf1f7c8[_0x8bb4('0x39')]=_[_0x8bb4('0x3a')](_0xf1f7c8[_0x8bb4('0x39')],{'$or':_['map'](_0xf1f7c8[_0x8bb4('0x31')],function(_0x58599b){var _0x48fe98={};_0x48fe98[_0x58599b]={'$like':'%'+_0x854868[_0x8bb4('0x2f')][_0x8bb4('0x38')]+'%'};return _0x48fe98;})});}_0xf1f7c8=_[_0x8bb4('0x3a')]({},_0xf1f7c8,_0x854868[_0x8bb4('0x3b')]);return _0x56a293[_0x8bb4('0x63')](_0xf1f7c8);}})['then'](respondWithResult(_0x30a4d0,null))[_0x8bb4('0x43')](handleError(_0x30a4d0,null));};exports[_0x8bb4('0x69')]=function(_0x3ce58f,_0x465324,_0x55b100){var _0xb1ecd0;var _0x31043e;var _0x1fe97f;var _0x220ece=_0x3ce58f['params']['id'];csv_results=[];return db[_0x8bb4('0x6a')][_0x8bb4('0x3f')]({'attributes':['id',_0x8bb4('0x26')],'raw':!![],'order':[_0x8bb4('0x6b')]})[_0x8bb4('0x22')](function(_0x16c608){_0xb1ecd0=_0x16c608;var _0x1470d6=_[_0x8bb4('0x2e')](db[_0x8bb4('0x57')]['rawAttributes']);return db['CmCustomField'][_0x8bb4('0x3f')]({'raw':!![],'attributes':['id',_0x8bb4('0x6c')]})[_0x8bb4('0x22')](function(_0xd86c4e){_0x31043e=_0xd86c4e;var _0xb636ec=squel['select']()[_0x8bb4('0x32')](_0x1470d6)['from'](_0x8bb4('0x6d'),'c')[_0x8bb4('0x39')](_0x8bb4('0x6e'),_0x220ece)[_0x8bb4('0x39')]('c.deletedAt\x20is\x20null')[_0x8bb4('0x6f')]();for(var _0x4e9ec1=0x0;_0x4e9ec1<_0x31043e['length'];_0x4e9ec1++){_0xb636ec[_0x8bb4('0x70')](_0x8bb4('0x71')+_0x31043e[_0x4e9ec1]['id'],_0x8bb4('0x72')+_0x31043e[_0x4e9ec1][_0x8bb4('0x6c')]);}for(var _0x4e9ec1=0x0;_0x4e9ec1<_0xb1ecd0[_0x8bb4('0x33')];_0x4e9ec1++){_0xb636ec[_0x8bb4('0x70')](squel['select']()[_0x8bb4('0x70')](_0x8bb4('0x73'))['from'](_0x8bb4('0x74'))[_0x8bb4('0x39')]('ItemTypeId\x20=\x20?',_0xb1ecd0[_0x4e9ec1]['id'])['where'](_0x8bb4('0x75')),_0x8bb4('0x76')+_0xb1ecd0[_0x4e9ec1]['name']);_0xb636ec[_0x8bb4('0x70')](squel[_0x8bb4('0x77')]()[_0x8bb4('0x70')](_0x8bb4('0x78'))[_0x8bb4('0x79')](_0x8bb4('0x74'))[_0x8bb4('0x39')](_0x8bb4('0x7a'),_0xb1ecd0[_0x4e9ec1]['id'])[_0x8bb4('0x39')](_0x8bb4('0x75')),_0x8bb4('0x7b')+_0xb1ecd0[_0x4e9ec1]['name']);}var _0x2791b7=[];_0x2791b7[_0x8bb4('0x5c')](_0xb636ec[_0x8bb4('0x7c')]());BPromise[_0x8bb4('0x5d')](_0x2791b7,handleQuery)['then'](function(_0x2e17c4){handleQuery(_0xb636ec[_0x8bb4('0x7c')]());var _0xe7d131=csv_results[0x0];if(!_[_0x8bb4('0x7d')](_0xe7d131)){var _0x35d68d=toCsv(_0xe7d131);var _0x120ad7=Date['now']();fs[_0x8bb4('0x7e')](util[_0x8bb4('0x66')](_0x8bb4('0x7f'),_0x220ece,_0x120ad7),_0x35d68d);_0x465324['setHeader'](_0x8bb4('0x80'),_0x8bb4('0x81')+util[_0x8bb4('0x66')](_0x8bb4('0x82'),_0x220ece,_0x120ad7));_0x465324[_0x8bb4('0x83')](_0x8bb4('0x84'),_0x8bb4('0x85'));return _0x465324['download'](util[_0x8bb4('0x66')](_0x8bb4('0x7f'),_0x220ece,_0x120ad7));}else{return _0x465324[_0x8bb4('0x23')](0xcc);}});});});};exports[_0x8bb4('0x86')]=function(_0x51eff9,_0x236898,_0x47758d){var _0x52af30;delete _0x51eff9[_0x8bb4('0x45')]['id'];return db[_0x8bb4('0x2a')][_0x8bb4('0x50')]({'where':{'id':_0x51eff9['params']['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x236898,null))[_0x8bb4('0x22')](function(_0x4064d8){if(_0x4064d8){return db[_0x8bb4('0x87')]['transaction'](function(_0x11c69d){return db[_0x8bb4('0x88')][_0x8bb4('0x44')](_0x51eff9[_0x8bb4('0x45')],{'transaction':_0x11c69d})[_0x8bb4('0x22')](function(_0x4d0e10){_0x52af30=_0x4d0e10;return _0x4064d8[_0x8bb4('0x89')](_0x4d0e10,{'transaction':_0x11c69d});})[_0x8bb4('0x22')](function(){var _0x1f32dd={'type':db[_0x8bb4('0x8a')][_0x8bb4('0x8b')],'transaction':_0x11c69d};switch(_0x51eff9[_0x8bb4('0x45')][_0x8bb4('0x2c')]){case _0x8bb4('0x8c'):_0x1f32dd['type']=db['Sequelize'][_0x8bb4('0x8b')];break;case'number':_0x1f32dd[_0x8bb4('0x2c')]=db[_0x8bb4('0x8a')]['INTEGER'];break;case'switch':_0x1f32dd[_0x8bb4('0x2c')]=db[_0x8bb4('0x8a')][_0x8bb4('0x8d')];_0x1f32dd[_0x8bb4('0x8e')]=![];break;default:}return db[_0x8bb4('0x87')][_0x8bb4('0x8f')]['addColumn']('cm_contacts',util[_0x8bb4('0x66')]('cf_%s',_0x52af30['id']),_0x1f32dd);})['then'](function(){return _0x52af30;});});}})['then'](respondWithResult(_0x236898,null))[_0x8bb4('0x43')](handleError(_0x236898,null));};exports[_0x8bb4('0x90')]=function(_0x2b1088,_0x460c8e,_0x4f0db2){var _0x688455={};var _0x635a75={};var _0x553c1b;var _0x47485b;return db['CmList'][_0x8bb4('0x50')]({'where':{'id':_0x2b1088[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x460c8e,null))[_0x8bb4('0x22')](function(_0x36ad5d){if(_0x36ad5d){_0x553c1b=_0x36ad5d;_0x635a75[_0x8bb4('0x2d')]=_['keys'](db['CmCustomField'][_0x8bb4('0x51')]);_0x635a75['query']=_[_0x8bb4('0x2e')](_0x2b1088[_0x8bb4('0x2f')]);_0x635a75['filters']=_['intersection'](_0x635a75['model'],_0x635a75['query']);_0x688455['attributes']=_[_0x8bb4('0x30')](_0x635a75[_0x8bb4('0x2d')],qs[_0x8bb4('0x32')](_0x2b1088[_0x8bb4('0x2f')][_0x8bb4('0x32')]));_0x688455[_0x8bb4('0x31')]=_0x688455[_0x8bb4('0x31')][_0x8bb4('0x33')]?_0x688455[_0x8bb4('0x31')]:_0x635a75['model'];_0x688455[_0x8bb4('0x52')]=qs[_0x8bb4('0x36')](_0x2b1088[_0x8bb4('0x2f')][_0x8bb4('0x36')]);_0x688455[_0x8bb4('0x39')]=qs[_0x8bb4('0x37')](_['pick'](_0x2b1088[_0x8bb4('0x2f')],_0x635a75[_0x8bb4('0x37')]));_0x688455[_0x8bb4('0x39')]=_['merge'](_0x688455[_0x8bb4('0x39')],{'$or':[{'ListId':_0x36ad5d['id']},{'ListId':null}]});if(_0x2b1088[_0x8bb4('0x2f')][_0x8bb4('0x38')]){_0x688455['where']=_[_0x8bb4('0x3a')](_0x688455[_0x8bb4('0x39')],{'$or':_['map'](_0x688455[_0x8bb4('0x31')],function(_0x381b23){var _0x4cf836={};_0x4cf836[_0x381b23]={'$like':'%'+_0x2b1088['query']['filter']+'%'};return _0x4cf836;})});}_0x688455=_[_0x8bb4('0x3a')]({},_0x688455,_0x2b1088[_0x8bb4('0x3b')]);return db[_0x8bb4('0x88')][_0x8bb4('0x91')](_0x688455);}})[_0x8bb4('0x22')](respondWithResult(_0x460c8e,null))[_0x8bb4('0x43')](handleError(_0x460c8e,null));};exports['getGlobalCustomFields']=function(_0x57f9c9,_0x30f0ca){return db[_0x8bb4('0x88')][_0x8bb4('0x91')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x30f0ca,null))['then'](function(_0x2bbe23){return _0x2bbe23;})['then'](respondWithResult(_0x30f0ca,null))[_0x8bb4('0x43')](handleError(_0x30f0ca,null));};exports[_0x8bb4('0x92')]=function(_0x2fde78,_0x37bf0a,_0x3f574f){return db['CmList'][_0x8bb4('0x42')]({'where':{'id':_0x2fde78[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x37bf0a,null))[_0x8bb4('0x22')](function(_0x1cd17d){if(_0x1cd17d){return _0x1cd17d[_0x8bb4('0x92')](_0x2fde78['body']['ids'],_['omit'](_0x2fde78[_0x8bb4('0x45')],[_0x8bb4('0x55'),'id'])||{})[_0x8bb4('0x93')](function(_0xfa4ea4){for(var _0x2d170c=0x0;_0x2d170c<_0x2fde78[_0x8bb4('0x45')][_0x8bb4('0x55')][_0x8bb4('0x33')];_0x2d170c+=0x1){socket[_0x8bb4('0x94')](_0x8bb4('0x95'),{'UserId':Number(_0x2fde78['body'][_0x8bb4('0x55')][_0x2d170c]),'CmListId':Number(_0x2fde78[_0x8bb4('0x41')]['id'])});}return _0xfa4ea4;});}})[_0x8bb4('0x22')](respondWithResult(_0x37bf0a,null))[_0x8bb4('0x43')](handleError(_0x37bf0a,null));};exports[_0x8bb4('0x96')]=function(_0x763ea5,_0x213356,_0x23525b){return db[_0x8bb4('0x2a')][_0x8bb4('0x42')]({'where':{'id':_0x763ea5[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0x213356,null))['then'](function(_0x129614){if(_0x129614){return _0x129614['removeAgents'](_0x763ea5['query'][_0x8bb4('0x55')])[_0x8bb4('0x22')](function(){if(_[_0x8bb4('0x59')](_0x763ea5[_0x8bb4('0x2f')]['ids'])){for(var _0x139fa5=0x0;_0x139fa5<_0x763ea5[_0x8bb4('0x2f')][_0x8bb4('0x55')][_0x8bb4('0x33')];_0x139fa5+=0x1){socket[_0x8bb4('0x94')](_0x8bb4('0x97'),{'UserId':Number(_0x763ea5[_0x8bb4('0x2f')][_0x8bb4('0x55')][_0x139fa5]),'CmListId':Number(_0x763ea5[_0x8bb4('0x41')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x763ea5[_0x8bb4('0x2f')][_0x8bb4('0x55')]),'CmListId':Number(_0x763ea5[_0x8bb4('0x41')]['id'])});}});}})[_0x8bb4('0x22')](respondWithStatusCode(_0x213356,null))[_0x8bb4('0x43')](handleError(_0x213356,null));};exports['getAgents']=function(_0x3dd5bd,_0xd564e7,_0x4d364f){var _0x2df87b={};var _0x4281e4={};var _0x360938;var _0x51aeef;return db['CmList']['findOne']({'where':{'id':_0x3dd5bd[_0x8bb4('0x41')]['id']}})[_0x8bb4('0x22')](handleEntityNotFound(_0xd564e7,null))[_0x8bb4('0x22')](function(_0x387d70){if(_0x387d70){_0x360938=_0x387d70;_0x4281e4[_0x8bb4('0x2d')]=_[_0x8bb4('0x2e')](db['User'][_0x8bb4('0x51')]);_0x4281e4[_0x8bb4('0x2f')]=_[_0x8bb4('0x2e')](_0x3dd5bd[_0x8bb4('0x2f')]);_0x4281e4[_0x8bb4('0x37')]=_[_0x8bb4('0x30')](_0x4281e4[_0x8bb4('0x2d')],_0x4281e4[_0x8bb4('0x2f')]);_0x2df87b['attributes']=_['intersection'](_0x4281e4[_0x8bb4('0x2d')],qs['fields'](_0x3dd5bd[_0x8bb4('0x2f')][_0x8bb4('0x32')]));_0x2df87b['attributes']=_0x2df87b[_0x8bb4('0x31')][_0x8bb4('0x33')]?_0x2df87b[_0x8bb4('0x31')]:_0x4281e4[_0x8bb4('0x2d')];_0x2df87b['order']=qs[_0x8bb4('0x36')](_0x3dd5bd['query'][_0x8bb4('0x36')]);_0x2df87b[_0x8bb4('0x39')]=qs[_0x8bb4('0x37')](_[_0x8bb4('0x53')](_0x3dd5bd['query'],_0x4281e4[_0x8bb4('0x37')]));if(_0x3dd5bd[_0x8bb4('0x2f')][_0x8bb4('0x38')]){_0x2df87b[_0x8bb4('0x39')]=_[_0x8bb4('0x3a')](_0x2df87b[_0x8bb4('0x39')],{'$or':_['map'](_0x2df87b[_0x8bb4('0x31')],function(_0x4942c6){var _0x5ca95c={};_0x5ca95c[_0x4942c6]={'$like':'%'+_0x3dd5bd[_0x8bb4('0x2f')][_0x8bb4('0x38')]+'%'};return _0x5ca95c;})});}_0x2df87b=_[_0x8bb4('0x3a')]({},_0x2df87b,_0x3dd5bd['options']);return _0x360938[_0x8bb4('0x98')](_0x2df87b);}})['then'](function(_0xbe86bb){if(_0xbe86bb){_0x51aeef=_0xbe86bb[_0x8bb4('0x33')];if(!_0x3dd5bd[_0x8bb4('0x2f')][_0x8bb4('0x34')]('nolimit')){_0x2df87b[_0x8bb4('0x1b')]=qs[_0x8bb4('0x1b')](_0x3dd5bd['query'][_0x8bb4('0x1b')]);_0x2df87b[_0x8bb4('0x19')]=qs[_0x8bb4('0x19')](_0x3dd5bd[_0x8bb4('0x2f')][_0x8bb4('0x19')]);}return _0x360938[_0x8bb4('0x98')](_0x2df87b);}})[_0x8bb4('0x22')](function(_0x1641d1){if(_0x1641d1){return _0x1641d1?{'count':_0x51aeef,'rows':_0x1641d1}:null;}})[_0x8bb4('0x22')](respondWithResult(_0xd564e7,null))[_0x8bb4('0x43')](handleError(_0xd564e7,null));};function handleQuery(_0x53f67b){logger[_0x8bb4('0x99')](_0x53f67b);return db['sequelize'][_0x8bb4('0x2f')](_0x53f67b)['spread'](function(_0x547b6e){csv_results[_0x8bb4('0x5c')](_0x547b6e);})[_0x8bb4('0x43')](function(_0x2e0f27){logger[_0x8bb4('0x24')](_0x2e0f27[_0x8bb4('0x9a')]);});} \ No newline at end of file +var _0x5370=['undefined','limit','count','apply','reject','save','destroy','then','get','Lists','UserProfileResource','error','name','map','CmList','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','update','find','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','rows','ids','CmContact','tags','isArray','join','each','omit','success','push','dataValues','errors','message','getContacts','CustomFields','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','c.cf_','field','item','cm_contact_has_items','CmContactId\x20=\x20c.id','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','CmCustomField','addCustomFields','text','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset'];(function(_0x23e010,_0x1eaac6){var _0x4bca44=function(_0x55c746){while(--_0x55c746){_0x23e010['push'](_0x23e010['shift']());}};_0x4bca44(++_0x1eaac6);}(_0x5370,0x11f));var _0x0537=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5370[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0537('0x0'));var zipdir=require(_0x0537('0x1'));var jsonpatch=require(_0x0537('0x2'));var rp=require(_0x0537('0x3'));var moment=require(_0x0537('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0537('0x5'));var path=require('path');var sox=require(_0x0537('0x6'));var csv=require(_0x0537('0x7'));var ejs=require(_0x0537('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0537('0x9'));var squel=require(_0x0537('0xa'));var crypto=require(_0x0537('0xb'));var jsforce=require(_0x0537('0xc'));var deskjs=require(_0x0537('0xd'));var toCsv=require(_0x0537('0x7'));var querystring=require(_0x0537('0xe'));var Papa=require(_0x0537('0xf'));var Redis=require(_0x0537('0x10'));var authService=require(_0x0537('0x11'));var qs=require(_0x0537('0x12'));var as=require(_0x0537('0x13'));var hardwareService=require(_0x0537('0x14'));var logger=require('../../config/logger')(_0x0537('0x15'));var utils=require('../../config/utils');var config=require(_0x0537('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x0537('0x17')]=_[_0x0537('0x18')](config[_0x0537('0x17')],{'host':_0x0537('0x19'),'port':0x18eb});var socket=require(_0x0537('0x1a'))(new Redis(config[_0x0537('0x17')]));require('./cmList.socket')[_0x0537('0x1b')](socket);function respondWithStatusCode(_0x3970c6,_0x1f7896){_0x1f7896=_0x1f7896||0xcc;return function(_0x530719){if(_0x530719){return _0x3970c6[_0x0537('0x1c')](_0x1f7896);}return _0x3970c6[_0x0537('0x1d')](_0x1f7896)[_0x0537('0x1e')]();};}function respondWithResult(_0x2cccd1,_0x716225){_0x716225=_0x716225||0xc8;return function(_0x150eb6){if(_0x150eb6){return _0x2cccd1[_0x0537('0x1d')](_0x716225)[_0x0537('0x1f')](_0x150eb6);}};}function respondWithFilteredResult(_0x51fae9,_0x4c4fb9){return function(_0x489872){if(_0x489872){var _0x222892=typeof _0x4c4fb9[_0x0537('0x20')]===_0x0537('0x21')&&typeof _0x4c4fb9[_0x0537('0x22')]===_0x0537('0x21');var _0x3b1db7=_0x489872[_0x0537('0x23')];var _0x2c8d4c=_0x222892?0x0:_0x4c4fb9['offset'];var _0x403f15=_0x222892?_0x489872['count']:_0x4c4fb9[_0x0537('0x20')]+_0x4c4fb9[_0x0537('0x22')];var _0x131f95;if(_0x403f15>=_0x3b1db7){_0x403f15=_0x3b1db7;_0x131f95=0xc8;}else{_0x131f95=0xce;}_0x51fae9['status'](_0x131f95);return _0x51fae9['set']('Content-Range',_0x2c8d4c+'-'+_0x403f15+'/'+_0x3b1db7)[_0x0537('0x1f')](_0x489872);}return null;};}function patchUpdates(_0x2f3c1d){return function(_0x5c1441){try{jsonpatch[_0x0537('0x24')](_0x5c1441,_0x2f3c1d,!![]);}catch(_0x53369f){return BPromise[_0x0537('0x25')](_0x53369f);}return _0x5c1441[_0x0537('0x26')]();};}function saveUpdates(_0x104776,_0x9920ac){return function(_0x301f94){if(_0x301f94){return _0x301f94['update'](_0x104776)['then'](function(_0x11c400){return _0x11c400;});}return null;};}function removeEntity(_0x362b29,_0x861cfa){return function(_0x276a1c){if(_0x276a1c){return _0x276a1c[_0x0537('0x27')]()[_0x0537('0x28')](function(){var _0x2997c7=_0x276a1c[_0x0537('0x29')]({'plain':!![]});var _0x57d538=_0x0537('0x2a');return db[_0x0537('0x2b')][_0x0537('0x27')]({'where':{'type':_0x57d538,'resourceId':_0x2997c7['id']}})['then'](function(){return _0x276a1c;});})[_0x0537('0x28')](function(){_0x362b29['status'](0xcc)[_0x0537('0x1e')]();});}};}function handleEntityNotFound(_0x4b2a3f,_0x203fcb){return function(_0x694557){if(!_0x694557){_0x4b2a3f[_0x0537('0x1c')](0x194);}return _0x694557;};}function handleError(_0xd2141e,_0x77e9c0){_0x77e9c0=_0x77e9c0||0x1f4;return function(_0x577e36){logger[_0x0537('0x2c')](_0x577e36['stack']);if(_0x577e36[_0x0537('0x2d')]){delete _0x577e36[_0x0537('0x2d')];}_0xd2141e[_0x0537('0x1d')](_0x77e9c0)['send'](_0x577e36);};}exports['index']=function(_0x493fc9,_0x3f1eec){var _0x28861a={},_0x45fd05={},_0x3c2d97={'count':0x0,'rows':[]};var _0x16ad0d=_[_0x0537('0x2e')](db[_0x0537('0x2f')][_0x0537('0x30')],function(_0x5bb294){return{'name':_0x5bb294[_0x0537('0x31')],'type':_0x5bb294[_0x0537('0x32')][_0x0537('0x33')]};});_0x45fd05[_0x0537('0x34')]=_['map'](_0x16ad0d,_0x0537('0x2d'));_0x45fd05[_0x0537('0x35')]=_['keys'](_0x493fc9[_0x0537('0x35')]);_0x45fd05[_0x0537('0x36')]=_[_0x0537('0x37')](_0x45fd05['model'],_0x45fd05[_0x0537('0x35')]);_0x28861a[_0x0537('0x38')]=_[_0x0537('0x37')](_0x45fd05['model'],qs[_0x0537('0x39')](_0x493fc9[_0x0537('0x35')][_0x0537('0x39')]));_0x28861a[_0x0537('0x38')]=_0x28861a[_0x0537('0x38')][_0x0537('0x3a')]?_0x28861a['attributes']:_0x45fd05[_0x0537('0x34')];if(!_0x493fc9[_0x0537('0x35')][_0x0537('0x3b')](_0x0537('0x3c'))){_0x28861a[_0x0537('0x22')]=qs[_0x0537('0x22')](_0x493fc9['query'][_0x0537('0x22')]);_0x28861a[_0x0537('0x20')]=qs[_0x0537('0x20')](_0x493fc9['query'][_0x0537('0x20')]);}_0x28861a[_0x0537('0x3d')]=qs[_0x0537('0x3e')](_0x493fc9[_0x0537('0x35')]['sort']);_0x28861a[_0x0537('0x3f')]=qs['filters'](_[_0x0537('0x40')](_0x493fc9[_0x0537('0x35')],_0x45fd05['filters']),_0x16ad0d);if(_0x493fc9[_0x0537('0x35')][_0x0537('0x41')]){_0x28861a[_0x0537('0x3f')]=_['merge'](_0x28861a['where'],{'$or':_[_0x0537('0x2e')](_0x16ad0d,function(_0x352bf0){if(_0x352bf0[_0x0537('0x32')]!==_0x0537('0x42')){var _0x126d27={};_0x126d27[_0x352bf0['name']]={'$like':'%'+_0x493fc9[_0x0537('0x35')][_0x0537('0x41')]+'%'};return _0x126d27;}})});}_0x28861a=_[_0x0537('0x43')]({},_0x28861a,_0x493fc9[_0x0537('0x44')]);var _0x436ee3={'where':_0x28861a[_0x0537('0x3f')]};return db[_0x0537('0x2f')][_0x0537('0x23')](_0x436ee3)[_0x0537('0x28')](function(_0x592590){_0x3c2d97[_0x0537('0x23')]=_0x592590;if(_0x493fc9['query'][_0x0537('0x45')]){_0x28861a[_0x0537('0x46')]=[{'all':!![]}];}return db[_0x0537('0x2f')][_0x0537('0x47')](_0x28861a);})[_0x0537('0x28')](function(_0x3cbeed){_0x3c2d97['rows']=_0x3cbeed;return _0x3c2d97;})[_0x0537('0x28')](respondWithFilteredResult(_0x3f1eec,_0x28861a))[_0x0537('0x48')](handleError(_0x3f1eec,null));};exports[_0x0537('0x49')]=function(_0x34f871,_0x869057){var _0x1ff801={'raw':![],'where':{'id':_0x34f871['params']['id']}},_0x371bb3={};_0x371bb3['model']=_['keys'](db['CmList'][_0x0537('0x30')]);_0x371bb3[_0x0537('0x35')]=_[_0x0537('0x4a')](_0x34f871['query']);_0x371bb3[_0x0537('0x36')]=_[_0x0537('0x37')](_0x371bb3['model'],_0x371bb3[_0x0537('0x35')]);_0x1ff801[_0x0537('0x38')]=_[_0x0537('0x37')](_0x371bb3[_0x0537('0x34')],qs[_0x0537('0x39')](_0x34f871['query'][_0x0537('0x39')]));_0x1ff801[_0x0537('0x38')]=_0x1ff801[_0x0537('0x38')]['length']?_0x1ff801[_0x0537('0x38')]:_0x371bb3[_0x0537('0x34')];if(_0x34f871[_0x0537('0x35')][_0x0537('0x45')]){_0x1ff801[_0x0537('0x46')]=[{'all':!![]}];}_0x1ff801=_[_0x0537('0x43')]({},_0x1ff801,_0x34f871[_0x0537('0x44')]);return db['CmList']['find'](_0x1ff801)[_0x0537('0x28')](handleEntityNotFound(_0x869057,null))['then'](respondWithResult(_0x869057,null))['catch'](handleError(_0x869057,null));};exports[_0x0537('0x4b')]=function(_0x240e60,_0x5a7157){return db[_0x0537('0x2f')][_0x0537('0x4b')](_0x240e60[_0x0537('0x4c')],{})['then'](function(_0x2073d4){var _0x36e751=_0x240e60[_0x0537('0x4d')][_0x0537('0x29')]({'plain':!![]});if(!_0x36e751)throw new Error(_0x0537('0x4e'));if(_0x36e751['role']===_0x0537('0x4d')){var _0x4fa4f3=_0x2073d4[_0x0537('0x29')]({'plain':!![]});var _0x53e63e=_0x0537('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x53e63e,'userProfileId':_0x36e751[_0x0537('0x4f')]},'raw':!![]})['then'](function(_0x793f5){if(_0x793f5&&_0x793f5[_0x0537('0x50')]===0x0){return db[_0x0537('0x2b')]['create']({'name':_0x4fa4f3[_0x0537('0x2d')],'resourceId':_0x4fa4f3['id'],'type':_0x793f5[_0x0537('0x2d')],'sectionId':_0x793f5['id']},{})[_0x0537('0x28')](function(){return _0x2073d4;});}else{return _0x2073d4;}})[_0x0537('0x48')](function(_0x4518ee){logger[_0x0537('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4518ee);throw _0x4518ee;});}return _0x2073d4;})[_0x0537('0x28')](respondWithResult(_0x5a7157,0xc9))['catch'](handleError(_0x5a7157,null));};exports[_0x0537('0x51')]=function(_0xe5032,_0x18c660){if(_0xe5032[_0x0537('0x4c')]['id']){delete _0xe5032[_0x0537('0x4c')]['id'];}return db[_0x0537('0x2f')][_0x0537('0x52')]({'where':{'id':_0xe5032[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x18c660,null))['then'](saveUpdates(_0xe5032[_0x0537('0x4c')],null))[_0x0537('0x28')](respondWithResult(_0x18c660,null))[_0x0537('0x48')](handleError(_0x18c660,null));};exports[_0x0537('0x27')]=function(_0x26c9b2,_0x17a1c6){return db[_0x0537('0x2f')][_0x0537('0x52')]({'where':{'id':_0x26c9b2[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x17a1c6,null))['then'](removeEntity(_0x17a1c6,null))[_0x0537('0x48')](handleError(_0x17a1c6,null));};exports[_0x0537('0x54')]=function(_0x2585b7,_0x2d044a){return db[_0x0537('0x2f')][_0x0537('0x54')]()[_0x0537('0x28')](respondWithResult(_0x2d044a,null))[_0x0537('0x48')](handleError(_0x2d044a,null));};exports[_0x0537('0x55')]=function(_0x264e3f,_0x1776bc,_0x907393){if(_0x264e3f[_0x0537('0x4c')]['id']){delete _0x264e3f['body']['id'];}return db[_0x0537('0x2f')]['find']({'where':{'id':_0x264e3f[_0x0537('0x53')]['id']}})['then'](handleEntityNotFound(_0x1776bc,null))[_0x0537('0x28')](function(_0xb177ff){if(_0xb177ff){_0x264e3f[_0x0537('0x4c')][_0x0537('0x56')]=_0xb177ff['id'];return db['Disposition'][_0x0537('0x4b')](_0x264e3f['body']);}})['then'](respondWithResult(_0x1776bc,null))['catch'](handleError(_0x1776bc,null));};exports[_0x0537('0x57')]=function(_0x5d005e,_0x3d73c7,_0xb9ae40){var _0x46ffe6={'raw':![],'where':{}};var _0x295687={};var _0x2e20ac={'count':0x0,'rows':[]};return db['CmList'][_0x0537('0x58')]({'where':{'id':_0x5d005e[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x3d73c7,null))['then'](function(_0x369547){if(_0x369547){_0x295687[_0x0537('0x34')]=_[_0x0537('0x4a')](db[_0x0537('0x59')][_0x0537('0x30')]);_0x295687['query']=_['keys'](_0x5d005e[_0x0537('0x35')]);_0x295687[_0x0537('0x36')]=_[_0x0537('0x37')](_0x295687[_0x0537('0x34')],_0x295687[_0x0537('0x35')]);_0x46ffe6[_0x0537('0x38')]=_[_0x0537('0x37')](_0x295687[_0x0537('0x34')],qs[_0x0537('0x39')](_0x5d005e['query']['fields']));_0x46ffe6[_0x0537('0x38')]=_0x46ffe6[_0x0537('0x38')][_0x0537('0x3a')]?_0x46ffe6[_0x0537('0x38')]:_0x295687['model'];if(!_0x5d005e[_0x0537('0x35')][_0x0537('0x3b')]('nolimit')){_0x46ffe6['limit']=qs[_0x0537('0x22')](_0x5d005e[_0x0537('0x35')]['limit']);_0x46ffe6[_0x0537('0x20')]=qs[_0x0537('0x20')](_0x5d005e[_0x0537('0x35')][_0x0537('0x20')]);}_0x46ffe6[_0x0537('0x3d')]=qs['sort'](_0x5d005e[_0x0537('0x35')][_0x0537('0x3e')]);_0x46ffe6[_0x0537('0x3f')]=qs['filters'](_[_0x0537('0x40')](_0x5d005e[_0x0537('0x35')],_0x295687['filters']));_0x46ffe6['where'][_0x0537('0x56')]=_0x369547['id'];if(_0x5d005e[_0x0537('0x35')]['filter']){_0x46ffe6[_0x0537('0x3f')]=_['merge'](_0x46ffe6[_0x0537('0x3f')],{'$or':_[_0x0537('0x2e')](_0x46ffe6[_0x0537('0x38')],function(_0x59f9f9){var _0x3c2001={};_0x3c2001[_0x59f9f9]={'$like':'%'+_0x5d005e[_0x0537('0x35')][_0x0537('0x41')]+'%'};return _0x3c2001;})});}_0x46ffe6=_[_0x0537('0x43')]({},_0x46ffe6,_0x5d005e[_0x0537('0x44')]);return db['Disposition'][_0x0537('0x23')]({'where':_0x46ffe6[_0x0537('0x3f')]})[_0x0537('0x28')](function(_0xd04bcb){_0x2e20ac[_0x0537('0x23')]=_0xd04bcb;if(_0x5d005e[_0x0537('0x35')]['includeAll']){_0x46ffe6['include']=[{'all':!![]}];}return db[_0x0537('0x59')][_0x0537('0x47')](_0x46ffe6);})[_0x0537('0x28')](function(_0x693abb){_0x2e20ac[_0x0537('0x5a')]=_0x693abb;return _0x2e20ac;});}})[_0x0537('0x28')](respondWithFilteredResult(_0x3d73c7,_0x46ffe6))[_0x0537('0x48')](handleError(_0x3d73c7,null));};exports['removeDispositions']=function(_0x140bde,_0x4daabd,_0x1efa7e){return db[_0x0537('0x2f')][_0x0537('0x52')]({'where':{'id':_0x140bde[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x4daabd,null))['then'](function(_0x229f6f){if(_0x229f6f){return _0x229f6f['removeDispositions'](_0x140bde[_0x0537('0x35')][_0x0537('0x5b')]);}})[_0x0537('0x28')](respondWithStatusCode(_0x4daabd,null))[_0x0537('0x48')](handleError(_0x4daabd,null));};exports['addContacts']=function(_0x278911,_0x47434d,_0x2b6777){return db['CmList'][_0x0537('0x52')]({'where':{'id':_0x278911['params']['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x47434d,null))[_0x0537('0x28')](function(_0x408695){if(_0x408695){var _0x29a3b2=[];var _0x4924f4={'success':[],'errors':[]};return db[_0x0537('0x5c')][_0x0537('0x54')]()[_0x0537('0x28')](function(_0x27c207){if(_0x278911[_0x0537('0x4c')][_0x0537('0x5d')]&&_[_0x0537('0x5e')](_0x278911[_0x0537('0x4c')][_0x0537('0x5d')])){if(_0x278911[_0x0537('0x4c')]['tags']['length']){_0x278911['body']['tags']=_0x278911[_0x0537('0x4c')][_0x0537('0x5d')][_0x0537('0x5f')](';')+';';}else{_0x278911[_0x0537('0x4c')][_0x0537('0x5d')]=null;}}else{_0x278911['body'][_0x0537('0x5d')]=null;}if(_0x278911[_0x0537('0x4c')]&&_[_0x0537('0x5e')](_0x278911['body'])){for(var _0x25fdac=0x0;_0x25fdac<_0x278911['body'][_0x0537('0x3a')];_0x25fdac+=0x1){_0x278911['body'][_0x25fdac][_0x0537('0x56')]=_0x278911['params']['id'];_0x29a3b2['push'](_0x278911[_0x0537('0x4c')][_0x25fdac]);}return BPromise[_0x0537('0x60')](_0x29a3b2,function(_0x27ed5a){return db['CmContact'][_0x0537('0x4b')](_[_0x0537('0x61')](_0x27ed5a,['ids','id'])||{},{'fields':_['keys'](_0x27c207),'raw':!![]})[_0x0537('0x28')](function(_0x58dab0){_0x4924f4[_0x0537('0x62')][_0x0537('0x63')](_0x58dab0[_0x0537('0x64')]);})[_0x0537('0x48')](function(_0x43eacb){_0x4924f4[_0x0537('0x65')]['push']({'data':_0x27ed5a,'error':_0x43eacb[_0x0537('0x66')]});});})[_0x0537('0x28')](function(_0x388592){return _0x4924f4;})[_0x0537('0x48')](function(_0x29e67a){return _0x29e67a;});}else{_0x47434d[_0x0537('0x1d')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x47434d,null))['catch'](handleError(_0x47434d,null));};exports[_0x0537('0x67')]=function(_0x597c72,_0x1f97f6,_0x3a3616){var _0x368d0e;return db[_0x0537('0x2f')][_0x0537('0x52')]({'where':{'id':_0x597c72['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x0537('0x68')}]})['then'](handleEntityNotFound(_0x1f97f6,null))[_0x0537('0x28')](function(_0x4a1311){if(_0x4a1311){_0x368d0e=_0x4a1311;return db[_0x0537('0x5c')][_0x0537('0x30')];}})[_0x0537('0x28')](function(_0x59734c){if(_0x59734c){var _0xc9abed={};var _0x59fec3={};_0x59fec3[_0x0537('0x34')]=_['concat'](_[_0x0537('0x4a')](_0x59734c),_[_0x0537('0x2e')](_0x368d0e[_0x0537('0x68')],function(_0x161842){return util['format']('cf_%d',_0x161842['id']);}));_0x59fec3['query']=_[_0x0537('0x4a')](_0x597c72[_0x0537('0x35')]);_0x59fec3[_0x0537('0x36')]=_['intersection'](_0x59fec3[_0x0537('0x34')],_0x59fec3[_0x0537('0x35')]);_0xc9abed[_0x0537('0x38')]=_['intersection'](_0x59fec3[_0x0537('0x34')],qs['fields'](_0x597c72[_0x0537('0x35')][_0x0537('0x39')]));_0xc9abed[_0x0537('0x38')]=_0xc9abed[_0x0537('0x38')][_0x0537('0x3a')]?_0xc9abed[_0x0537('0x38')]:_0x59fec3[_0x0537('0x34')];if(!_0x597c72[_0x0537('0x35')]['hasOwnProperty'](_0x0537('0x3c'))){_0xc9abed['limit']=qs[_0x0537('0x22')](_0x597c72[_0x0537('0x35')][_0x0537('0x22')]);_0xc9abed[_0x0537('0x20')]=qs[_0x0537('0x20')](_0x597c72['query'][_0x0537('0x20')]);}_0xc9abed['order']=qs[_0x0537('0x3e')](_0x597c72[_0x0537('0x35')]['sort']);_0xc9abed[_0x0537('0x3f')]=qs[_0x0537('0x36')](_[_0x0537('0x40')](_0x597c72[_0x0537('0x35')],_0x59fec3[_0x0537('0x36')]));_0xc9abed[_0x0537('0x69')]=!![];if(_0x597c72[_0x0537('0x35')][_0x0537('0x41')]){_0xc9abed['where']=_[_0x0537('0x43')](_0xc9abed[_0x0537('0x3f')],{'$or':_[_0x0537('0x2e')](_0xc9abed[_0x0537('0x38')],function(_0x18bbc2){var _0x17b71d={};_0x17b71d[_0x18bbc2]={'$like':'%'+_0x597c72[_0x0537('0x35')]['filter']+'%'};return _0x17b71d;})});}_0xc9abed=_[_0x0537('0x43')]({},_0xc9abed,_0x597c72[_0x0537('0x44')]);return _0x368d0e['getContacts'](_0xc9abed);}})['then'](respondWithResult(_0x1f97f6,null))[_0x0537('0x48')](handleError(_0x1f97f6,null));};exports[_0x0537('0x6a')]=function(_0xca688c,_0x199861,_0x13beb8){var _0x3e34f8;var _0x2f6a26;var _0x2d0719;var _0x8147d4=_0xca688c['params']['id'];csv_results=[];return db[_0x0537('0x6b')][_0x0537('0x47')]({'attributes':['id',_0x0537('0x2d')],'raw':!![],'order':[_0x0537('0x6c')]})[_0x0537('0x28')](function(_0x1a069a){_0x3e34f8=_0x1a069a;var _0x3f5d00=_[_0x0537('0x4a')](db['CmContact']['rawAttributes']);return db['CmCustomField'][_0x0537('0x47')]({'raw':!![],'attributes':['id',_0x0537('0x6d')]})[_0x0537('0x28')](function(_0x5b4d77){_0x2f6a26=_0x5b4d77;var _0x554c5b=squel[_0x0537('0x6e')]()[_0x0537('0x39')](_0x3f5d00)[_0x0537('0x6f')]('cm_contacts','c')[_0x0537('0x3f')](_0x0537('0x70'),_0x8147d4)[_0x0537('0x3f')](_0x0537('0x71'))[_0x0537('0x72')]();for(var _0x483b70=0x0;_0x483b70<_0x2f6a26[_0x0537('0x3a')];_0x483b70++){_0x554c5b['field'](_0x0537('0x73')+_0x2f6a26[_0x483b70]['id'],'customField_'+_0x2f6a26[_0x483b70]['alias']);}for(var _0x483b70=0x0;_0x483b70<_0x3e34f8['length'];_0x483b70++){_0x554c5b[_0x0537('0x74')](squel[_0x0537('0x6e')]()[_0x0537('0x74')](_0x0537('0x75'))[_0x0537('0x6f')](_0x0537('0x76'))[_0x0537('0x3f')]('ItemTypeId\x20=\x20?',_0x3e34f8[_0x483b70]['id'])['where'](_0x0537('0x77')),'additionalPhone_'+_0x3e34f8[_0x483b70]['name']);_0x554c5b[_0x0537('0x74')](squel['select']()['field']('description')[_0x0537('0x6f')]('cm_contact_has_items')[_0x0537('0x3f')](_0x0537('0x78'),_0x3e34f8[_0x483b70]['id'])[_0x0537('0x3f')](_0x0537('0x77')),_0x0537('0x79')+_0x3e34f8[_0x483b70]['name']);}var _0x118289=[];_0x118289['push'](_0x554c5b[_0x0537('0x7a')]());BPromise[_0x0537('0x60')](_0x118289,handleQuery)['then'](function(_0x5f1b08){handleQuery(_0x554c5b['toString']());var _0x3fe6af=csv_results[0x0];if(!_[_0x0537('0x7b')](_0x3fe6af)){var _0x48c488=toCsv(_0x3fe6af);var _0x42dec2=Date[_0x0537('0x7c')]();fs[_0x0537('0x7d')](util[_0x0537('0x7e')]('/tmp/list_%d_%s.csv',_0x8147d4,_0x42dec2),_0x48c488);_0x199861[_0x0537('0x7f')](_0x0537('0x80'),_0x0537('0x81')+util[_0x0537('0x7e')](_0x0537('0x82'),_0x8147d4,_0x42dec2));_0x199861[_0x0537('0x7f')](_0x0537('0x83'),_0x0537('0x84'));return _0x199861[_0x0537('0x85')](util['format']('/tmp/list_%d_%s.csv',_0x8147d4,_0x42dec2));}else{return _0x199861['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x45b0d3,_0x2ddc8a,_0x4a2977){var _0x2fca5d;delete _0x45b0d3[_0x0537('0x4c')]['id'];return db[_0x0537('0x2f')][_0x0537('0x58')]({'where':{'id':_0x45b0d3['params']['id']}})['then'](handleEntityNotFound(_0x2ddc8a,null))[_0x0537('0x28')](function(_0x44f81d){if(_0x44f81d){return db[_0x0537('0x86')][_0x0537('0x87')](function(_0x243b61){return db[_0x0537('0x88')][_0x0537('0x4b')](_0x45b0d3[_0x0537('0x4c')],{'transaction':_0x243b61})['then'](function(_0x2a4225){_0x2fca5d=_0x2a4225;return _0x44f81d[_0x0537('0x89')](_0x2a4225,{'transaction':_0x243b61});})[_0x0537('0x28')](function(){var _0x23d8af={'type':db['Sequelize']['TEXT'],'transaction':_0x243b61};switch(_0x45b0d3['body']['type']){case _0x0537('0x8a'):_0x23d8af[_0x0537('0x32')]=db[_0x0537('0x8b')][_0x0537('0x8c')];break;case _0x0537('0x8d'):_0x23d8af[_0x0537('0x32')]=db[_0x0537('0x8b')]['INTEGER'];break;case _0x0537('0x8e'):_0x23d8af[_0x0537('0x32')]=db['Sequelize'][_0x0537('0x8f')];_0x23d8af[_0x0537('0x90')]=![];break;default:}return db[_0x0537('0x86')][_0x0537('0x91')][_0x0537('0x92')]('cm_contacts',util[_0x0537('0x7e')](_0x0537('0x93'),_0x2fca5d['id']),_0x23d8af);})[_0x0537('0x28')](function(){return _0x2fca5d;});});}})[_0x0537('0x28')](respondWithResult(_0x2ddc8a,null))[_0x0537('0x48')](handleError(_0x2ddc8a,null));};exports[_0x0537('0x94')]=function(_0x496116,_0xa51f58,_0x1b1ff3){var _0x3c8f25={};var _0x2d6691={};var _0x5c4a60;var _0x5a1b8d;return db[_0x0537('0x2f')]['findOne']({'where':{'id':_0x496116[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0xa51f58,null))['then'](function(_0x441344){if(_0x441344){_0x5c4a60=_0x441344;_0x2d6691[_0x0537('0x34')]=_[_0x0537('0x4a')](db[_0x0537('0x88')]['rawAttributes']);_0x2d6691[_0x0537('0x35')]=_['keys'](_0x496116[_0x0537('0x35')]);_0x2d6691[_0x0537('0x36')]=_[_0x0537('0x37')](_0x2d6691[_0x0537('0x34')],_0x2d6691[_0x0537('0x35')]);_0x3c8f25[_0x0537('0x38')]=_['intersection'](_0x2d6691[_0x0537('0x34')],qs['fields'](_0x496116[_0x0537('0x35')][_0x0537('0x39')]));_0x3c8f25[_0x0537('0x38')]=_0x3c8f25['attributes'][_0x0537('0x3a')]?_0x3c8f25[_0x0537('0x38')]:_0x2d6691[_0x0537('0x34')];_0x3c8f25[_0x0537('0x3d')]=qs[_0x0537('0x3e')](_0x496116['query'][_0x0537('0x3e')]);_0x3c8f25['where']=qs[_0x0537('0x36')](_[_0x0537('0x40')](_0x496116['query'],_0x2d6691[_0x0537('0x36')]));_0x3c8f25[_0x0537('0x3f')]=_[_0x0537('0x43')](_0x3c8f25[_0x0537('0x3f')],{'$or':[{'ListId':_0x441344['id']},{'ListId':null}]});if(_0x496116[_0x0537('0x35')][_0x0537('0x41')]){_0x3c8f25['where']=_[_0x0537('0x43')](_0x3c8f25['where'],{'$or':_[_0x0537('0x2e')](_0x3c8f25['attributes'],function(_0x4bf8df){var _0x8eab48={};_0x8eab48[_0x4bf8df]={'$like':'%'+_0x496116[_0x0537('0x35')]['filter']+'%'};return _0x8eab48;})});}_0x3c8f25=_['merge']({},_0x3c8f25,_0x496116[_0x0537('0x44')]);return db[_0x0537('0x88')][_0x0537('0x95')](_0x3c8f25);}})[_0x0537('0x28')](respondWithResult(_0xa51f58,null))[_0x0537('0x48')](handleError(_0xa51f58,null));};exports[_0x0537('0x96')]=function(_0x368ddd,_0x358427){return db[_0x0537('0x88')][_0x0537('0x95')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x358427,null))['then'](function(_0x48f2c6){return _0x48f2c6;})['then'](respondWithResult(_0x358427,null))[_0x0537('0x48')](handleError(_0x358427,null));};exports[_0x0537('0x97')]=function(_0x5dd1de,_0xfeb9c1,_0x1a2f88){return db[_0x0537('0x2f')][_0x0537('0x52')]({'where':{'id':_0x5dd1de[_0x0537('0x53')]['id']}})['then'](handleEntityNotFound(_0xfeb9c1,null))[_0x0537('0x28')](function(_0x2e01d5){if(_0x2e01d5){return _0x2e01d5[_0x0537('0x97')](_0x5dd1de[_0x0537('0x4c')][_0x0537('0x5b')],_[_0x0537('0x61')](_0x5dd1de[_0x0537('0x4c')],[_0x0537('0x5b'),'id'])||{})[_0x0537('0x98')](function(_0x584661){for(var _0x149fa8=0x0;_0x149fa8<_0x5dd1de[_0x0537('0x4c')][_0x0537('0x5b')]['length'];_0x149fa8+=0x1){socket[_0x0537('0x99')](_0x0537('0x9a'),{'UserId':Number(_0x5dd1de['body'][_0x0537('0x5b')][_0x149fa8]),'CmListId':Number(_0x5dd1de['params']['id'])});}return _0x584661;});}})[_0x0537('0x28')](respondWithResult(_0xfeb9c1,null))['catch'](handleError(_0xfeb9c1,null));};exports[_0x0537('0x9b')]=function(_0x3966be,_0x2d8a0b,_0x58f07e){return db[_0x0537('0x2f')]['find']({'where':{'id':_0x3966be[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x2d8a0b,null))[_0x0537('0x28')](function(_0x105397){if(_0x105397){return _0x105397[_0x0537('0x9b')](_0x3966be[_0x0537('0x35')][_0x0537('0x5b')])[_0x0537('0x28')](function(){if(_[_0x0537('0x5e')](_0x3966be[_0x0537('0x35')][_0x0537('0x5b')])){for(var _0x33031b=0x0;_0x33031b<_0x3966be[_0x0537('0x35')][_0x0537('0x5b')]['length'];_0x33031b+=0x1){socket['emit'](_0x0537('0x9c'),{'UserId':Number(_0x3966be[_0x0537('0x35')][_0x0537('0x5b')][_0x33031b]),'CmListId':Number(_0x3966be['params']['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x3966be[_0x0537('0x35')][_0x0537('0x5b')]),'CmListId':Number(_0x3966be[_0x0537('0x53')]['id'])});}});}})[_0x0537('0x28')](respondWithStatusCode(_0x2d8a0b,null))[_0x0537('0x48')](handleError(_0x2d8a0b,null));};exports[_0x0537('0x9d')]=function(_0x5ad9d9,_0x75e5dd,_0x21c2d9){var _0x59553f={};var _0x472ca8={};var _0x7aefc0;var _0x7025a5;return db[_0x0537('0x2f')]['findOne']({'where':{'id':_0x5ad9d9[_0x0537('0x53')]['id']}})[_0x0537('0x28')](handleEntityNotFound(_0x75e5dd,null))[_0x0537('0x28')](function(_0x10e556){if(_0x10e556){_0x7aefc0=_0x10e556;_0x472ca8[_0x0537('0x34')]=_['keys'](db[_0x0537('0x9e')][_0x0537('0x30')]);_0x472ca8[_0x0537('0x35')]=_[_0x0537('0x4a')](_0x5ad9d9[_0x0537('0x35')]);_0x472ca8[_0x0537('0x36')]=_[_0x0537('0x37')](_0x472ca8[_0x0537('0x34')],_0x472ca8[_0x0537('0x35')]);_0x59553f[_0x0537('0x38')]=_[_0x0537('0x37')](_0x472ca8['model'],qs['fields'](_0x5ad9d9['query'][_0x0537('0x39')]));_0x59553f['attributes']=_0x59553f[_0x0537('0x38')]['length']?_0x59553f[_0x0537('0x38')]:_0x472ca8[_0x0537('0x34')];_0x59553f['order']=qs['sort'](_0x5ad9d9[_0x0537('0x35')][_0x0537('0x3e')]);_0x59553f[_0x0537('0x3f')]=qs['filters'](_[_0x0537('0x40')](_0x5ad9d9['query'],_0x472ca8[_0x0537('0x36')]));if(_0x5ad9d9[_0x0537('0x35')][_0x0537('0x41')]){_0x59553f[_0x0537('0x3f')]=_[_0x0537('0x43')](_0x59553f[_0x0537('0x3f')],{'$or':_[_0x0537('0x2e')](_0x59553f[_0x0537('0x38')],function(_0xe64611){var _0x3691d4={};_0x3691d4[_0xe64611]={'$like':'%'+_0x5ad9d9['query'][_0x0537('0x41')]+'%'};return _0x3691d4;})});}_0x59553f=_['merge']({},_0x59553f,_0x5ad9d9[_0x0537('0x44')]);return _0x7aefc0[_0x0537('0x9d')](_0x59553f);}})[_0x0537('0x28')](function(_0x7599e4){if(_0x7599e4){_0x7025a5=_0x7599e4['length'];if(!_0x5ad9d9[_0x0537('0x35')][_0x0537('0x3b')](_0x0537('0x3c'))){_0x59553f[_0x0537('0x22')]=qs['limit'](_0x5ad9d9[_0x0537('0x35')][_0x0537('0x22')]);_0x59553f[_0x0537('0x20')]=qs[_0x0537('0x20')](_0x5ad9d9['query']['offset']);}return _0x7aefc0[_0x0537('0x9d')](_0x59553f);}})[_0x0537('0x28')](function(_0x1df7c0){if(_0x1df7c0){return _0x1df7c0?{'count':_0x7025a5,'rows':_0x1df7c0}:null;}})[_0x0537('0x28')](respondWithResult(_0x75e5dd,null))[_0x0537('0x48')](handleError(_0x75e5dd,null));};function handleQuery(_0x4ed049){logger[_0x0537('0x9f')](_0x4ed049);return db['sequelize'][_0x0537('0x35')](_0x4ed049)['spread'](function(_0x247158){csv_results[_0x0537('0x63')](_0x247158);})['catch'](function(_0x5b3382){logger['error'](_0x5b3382[_0x0537('0x66')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 46ae68e..25878fb 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x55ca,0x126));var _0xa55c=function(_0x5ce268,_0x1835b6){_0x5ce268=_0x5ce268-0x0;var _0x28c96a=_0x55ca[_0x5ce268];return _0x28c96a;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x2a7c2a,_0x37cc9e){var _0x195732=function(_0x4d3902){while(--_0x4d3902){_0x2a7c2a['push'](_0x2a7c2a['shift']());}};_0x195732(++_0x37cc9e);}(_0x7217,0x19e));var _0x7721=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x7217[_0x92c450];return _0x2a9599;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f99c74d..0ce7839 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 _0x9bde=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','api','bluebird'];(function(_0x3d01fe,_0x371dcc){var _0x4a6807=function(_0x3c8cb8){while(--_0x3c8cb8){_0x3d01fe['push'](_0x3d01fe['shift']());}};_0x4a6807(++_0x371dcc);}(_0x9bde,0xe1));var _0xe9bd=function(_0x295e2a,_0x2e0795){_0x295e2a=_0x295e2a-0x0;var _0x269f9b=_0x9bde[_0x295e2a];return _0x269f9b;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb5=['define','CmList','cm_lists','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x39f18f,_0x41841a){var _0x8285b7=function(_0x196a8f){while(--_0x196a8f){_0x39f18f['push'](_0x39f18f['shift']());}};_0x8285b7(++_0x41841a);}(_0x0bb5,0x148));var _0x50bb=function(_0x369fca,_0x5ed2e9){_0x369fca=_0x369fca-0x0;var _0x2db08f=_0x0bb5[_0x369fca];return _0x2db08f;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50bb('0x2'));var BPromise=require(_0x50bb('0x3'));var rp=require(_0x50bb('0x4'));var fs=require('fs');var path=require(_0x50bb('0x5'));var rimraf=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var attributes=require(_0x50bb('0x8'));module[_0x50bb('0x9')]=function(_0x4e6093,_0x4a105c){return _0x4e6093[_0x50bb('0xa')](_0x50bb('0xb'),attributes,{'tableName':_0x50bb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 717a378..798b4d3 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 _0x704e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./cmList.socket','register','then','info','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x2f974c,_0x2a9938){var _0xd74bc6=function(_0x426652){while(--_0x426652){_0x2f974c['push'](_0x2f974c['shift']());}};_0xd74bc6(++_0x2a9938);}(_0x704e,0x83));var _0xe704=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x704e[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xe704('0x0'));var util=require(_0xe704('0x1'));var moment=require(_0xe704('0x2'));var BPromise=require(_0xe704('0x3'));var rs=require(_0xe704('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe704('0x5'));var logger=require(_0xe704('0x6'))(_0xe704('0x7'));var config=require(_0xe704('0x8'));var jayson=require(_0xe704('0x9'));var client=jayson[_0xe704('0xa')][_0xe704('0xb')]({'port':0x232a});config['redis']=_[_0xe704('0xc')](config['redis'],{'host':_0xe704('0xd'),'port':0x18eb});var socket=require(_0xe704('0xe'))(new Redis(config[_0xe704('0xf')]));require(_0xe704('0x10'))[_0xe704('0x11')](socket);function respondWithRpcPromise(_0x2ef702,_0x550e57,_0x2286fc){return new BPromise(function(_0x4bef3d,_0x3b6584){return client['request'](_0x2ef702,_0x2286fc)[_0xe704('0x12')](function(_0x4da13e){logger[_0xe704('0x13')]('CmList,\x20%s,\x20%s',_0x550e57,_0xe704('0x14'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x550e57,_0xe704('0x14'),JSON[_0xe704('0x15')](_0x4da13e));if(_0x4da13e[_0xe704('0x16')]){if(_0x4da13e['error'][_0xe704('0x17')]===0x1f4){logger['error'](_0xe704('0x18'),_0x550e57,_0x4da13e[_0xe704('0x16')][_0xe704('0x19')]);return _0x3b6584(_0x4da13e[_0xe704('0x16')][_0xe704('0x19')]);}logger[_0xe704('0x16')](_0xe704('0x18'),_0x550e57,_0x4da13e[_0xe704('0x16')]['message']);return _0x4bef3d(_0x4da13e[_0xe704('0x16')][_0xe704('0x19')]);}else{logger[_0xe704('0x13')](_0xe704('0x18'),_0x550e57,_0xe704('0x14'));_0x4bef3d(_0x4da13e['result'][_0xe704('0x19')]);}})[_0xe704('0x1a')](function(_0x125cd6){logger[_0xe704('0x16')]('CmList,\x20%s,\x20%s',_0x550e57,_0x125cd6);_0x3b6584(_0x125cd6);});});} \ No newline at end of file +var _0x0e0b=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5ef905,_0x564b87){var _0x367808=function(_0x14f487){while(--_0x14f487){_0x5ef905['push'](_0x5ef905['shift']());}};_0x367808(++_0x564b87);}(_0x0e0b,0x1e7));var _0xb0e0=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0x0e0b[_0x3f465d];return _0x121ad1;};'use strict';var _=require('lodash');var util=require(_0xb0e0('0x0'));var moment=require(_0xb0e0('0x1'));var BPromise=require(_0xb0e0('0x2'));var rs=require(_0xb0e0('0x3'));var fs=require('fs');var Redis=require(_0xb0e0('0x4'));var db=require(_0xb0e0('0x5'))['db'];var utils=require(_0xb0e0('0x6'));var logger=require(_0xb0e0('0x7'))(_0xb0e0('0x8'));var config=require(_0xb0e0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb0e0('0xa')]['http']({'port':0x232a});config[_0xb0e0('0xb')]=_[_0xb0e0('0xc')](config['redis'],{'host':_0xb0e0('0xd'),'port':0x18eb});var socket=require(_0xb0e0('0xe'))(new Redis(config[_0xb0e0('0xb')]));require(_0xb0e0('0xf'))[_0xb0e0('0x10')](socket);function respondWithRpcPromise(_0x48b6b5,_0x422a41,_0x25dfa1){return new BPromise(function(_0x35e0b2,_0x5cfc15){return client['request'](_0x48b6b5,_0x25dfa1)[_0xb0e0('0x11')](function(_0x2592b5){logger[_0xb0e0('0x12')](_0xb0e0('0x13'),_0x422a41,_0xb0e0('0x14'));logger[_0xb0e0('0x15')](_0xb0e0('0x16'),_0x422a41,_0xb0e0('0x14'),JSON[_0xb0e0('0x17')](_0x2592b5));if(_0x2592b5['error']){if(_0x2592b5[_0xb0e0('0x18')]['code']===0x1f4){logger[_0xb0e0('0x18')]('CmList,\x20%s,\x20%s',_0x422a41,_0x2592b5[_0xb0e0('0x18')][_0xb0e0('0x19')]);return _0x5cfc15(_0x2592b5[_0xb0e0('0x18')][_0xb0e0('0x19')]);}logger[_0xb0e0('0x18')](_0xb0e0('0x13'),_0x422a41,_0x2592b5[_0xb0e0('0x18')][_0xb0e0('0x19')]);return _0x35e0b2(_0x2592b5[_0xb0e0('0x18')][_0xb0e0('0x19')]);}else{logger[_0xb0e0('0x12')](_0xb0e0('0x13'),_0x422a41,'request\x20sent');_0x35e0b2(_0x2592b5['result'][_0xb0e0('0x19')]);}})[_0xb0e0('0x1a')](function(_0x2bad6f){logger['error']('CmList,\x20%s,\x20%s',_0x422a41,_0x2bad6f);_0x5cfc15(_0x2bad6f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f4952fd..ac90765 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 _0x23bf=['register','cmList:','./cmList.events','update','emit','removeListener'];(function(_0x317a44,_0x3f1213){var _0x179626=function(_0x508208){while(--_0x508208){_0x317a44['push'](_0x317a44['shift']());}};_0x179626(++_0x3f1213);}(_0x23bf,0x17c));var _0xf23b=function(_0x2cf90b,_0x13daca){_0x2cf90b=_0x2cf90b-0x0;var _0x296771=_0x23bf[_0x2cf90b];return _0x296771;};'use strict';var CmListEvents=require(_0xf23b('0x0'));var events=['save','remove',_0xf23b('0x1')];function createListener(_0x1877a8,_0xd294a0){return function(_0x46f297){_0xd294a0[_0xf23b('0x2')](_0x1877a8,_0x46f297);};}function removeListener(_0x530fb3,_0x2d89eb){return function(){CmListEvents[_0xf23b('0x3')](_0x530fb3,_0x2d89eb);};}exports[_0xf23b('0x4')]=function(_0x459c88){for(var _0x3d58c9=0x0,_0x22387e=events['length'];_0x3d58c9<_0x22387e;_0x3d58c9++){var _0x5dcd01=events[_0x3d58c9];var _0x16c5f7=createListener(_0xf23b('0x5')+_0x5dcd01,_0x459c88);CmListEvents['on'](_0x5dcd01,_0x16c5f7);}}; \ No newline at end of file +var _0x5f9c=['length','cmList:','./cmList.events','save','remove','removeListener','register'];(function(_0x4412e3,_0x9cd8b4){var _0x265790=function(_0x1f6813){while(--_0x1f6813){_0x4412e3['push'](_0x4412e3['shift']());}};_0x265790(++_0x9cd8b4);}(_0x5f9c,0xaa));var _0xc5f9=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x5f9c[_0x5a3cf0];return _0x5a64ee;};'use strict';var CmListEvents=require(_0xc5f9('0x0'));var events=[_0xc5f9('0x1'),_0xc5f9('0x2'),'update'];function createListener(_0x2ac38c,_0x51d332){return function(_0x3027ff){_0x51d332['emit'](_0x2ac38c,_0x3027ff);};}function removeListener(_0x2d0779,_0x2d955f){return function(){CmListEvents[_0xc5f9('0x3')](_0x2d0779,_0x2d955f);};}exports[_0xc5f9('0x4')]=function(_0x3c0c66){for(var _0x2a48db=0x0,_0x4a1bf5=events[_0xc5f9('0x5')];_0x2a48db<_0x4a1bf5;_0x2a48db++){var _0x500e56=events[_0x2a48db];var _0x374cc2=createListener(_0xc5f9('0x6')+_0x500e56,_0x3c0c66);CmListEvents['on'](_0x500e56,_0x374cc2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 394c867..11e524c 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 _0x1f31=['../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','connect-timeout','../../components/auth/service'];(function(_0x37233f,_0x6dada0){var _0x143036=function(_0x5afb50){while(--_0x5afb50){_0x37233f['push'](_0x37233f['shift']());}};_0x143036(++_0x6dada0);}(_0x1f31,0xca));var _0x11f3=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x1f31[_0x4e93a9];return _0x43013c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x11f3('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x11f3('0x1'));var interaction=require(_0x11f3('0x2'));var config=require(_0x11f3('0x3'));var controller=require(_0x11f3('0x4'));router['get']('/',auth[_0x11f3('0x5')](),controller[_0x11f3('0x6')]);router[_0x11f3('0x7')](_0x11f3('0x8'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x9')]);router[_0x11f3('0x7')](_0x11f3('0xa'),auth[_0x11f3('0x5')](),controller[_0x11f3('0xb')]);router[_0x11f3('0x7')](_0x11f3('0xc'),auth[_0x11f3('0x5')](),controller[_0x11f3('0xd')]);router['get'](_0x11f3('0xe'),auth[_0x11f3('0x5')](),controller[_0x11f3('0xf')]);router['get'](_0x11f3('0x10'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x11')]);router['get'](_0x11f3('0x12'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x13')]);router[_0x11f3('0x7')](_0x11f3('0x14'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x15')]);router[_0x11f3('0x7')](_0x11f3('0x16'),auth['isAuthenticated'](),controller[_0x11f3('0x17')]);router['post']('/',auth[_0x11f3('0x5')](),controller['create']);router[_0x11f3('0x18')]('/:id/dispositions',auth[_0x11f3('0x5')](),controller[_0x11f3('0x19')]);router['post'](_0x11f3('0x10'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x1a')]);router['post']('/:id/fields',auth[_0x11f3('0x5')](),controller[_0x11f3('0x1b')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x11f3('0x1c')]);router[_0x11f3('0x1d')](_0x11f3('0xc'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x1e')]);router[_0x11f3('0x1f')](_0x11f3('0xc'),auth[_0x11f3('0x5')](),controller['destroy']);router[_0x11f3('0x1f')](_0x11f3('0xe'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x20')]);router[_0x11f3('0x1f')](_0x11f3('0x16'),auth[_0x11f3('0x5')](),controller[_0x11f3('0x21')]);module['exports']=router; \ No newline at end of file +var _0xe826=['update','delete','destroy','removeDispositions','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','addContacts','/:id/fields','addCustomField','addAgents','put'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xe826,0x1a9));var _0x6e82=function(_0x22ac8a,_0x200a2f){_0x22ac8a=_0x22ac8a-0x0;var _0x510d11=_0xe826[_0x22ac8a];return _0x510d11;};'use strict';var multer=require(_0x6e82('0x0'));var util=require(_0x6e82('0x1'));var path=require(_0x6e82('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6e82('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6e82('0x4'));var interaction=require(_0x6e82('0x5'));var config=require(_0x6e82('0x6'));var controller=require(_0x6e82('0x7'));router[_0x6e82('0x8')]('/',auth[_0x6e82('0x9')](),controller[_0x6e82('0xa')]);router[_0x6e82('0x8')]('/describe',auth[_0x6e82('0x9')](),controller[_0x6e82('0xb')]);router[_0x6e82('0x8')](_0x6e82('0xc'),auth['isAuthenticated'](),controller[_0x6e82('0xd')]);router[_0x6e82('0x8')](_0x6e82('0xe'),auth['isAuthenticated'](),controller[_0x6e82('0xf')]);router[_0x6e82('0x8')](_0x6e82('0x10'),auth[_0x6e82('0x9')](),controller[_0x6e82('0x11')]);router[_0x6e82('0x8')](_0x6e82('0x12'),auth['isAuthenticated'](),controller[_0x6e82('0x13')]);router[_0x6e82('0x8')](_0x6e82('0x14'),auth['isAuthenticated'](),controller[_0x6e82('0x15')]);router[_0x6e82('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getCustomFields']);router[_0x6e82('0x8')](_0x6e82('0x16'),auth[_0x6e82('0x9')](),controller[_0x6e82('0x17')]);router[_0x6e82('0x18')]('/',auth[_0x6e82('0x9')](),controller['create']);router[_0x6e82('0x18')](_0x6e82('0x10'),auth[_0x6e82('0x9')](),controller['addDisposition']);router[_0x6e82('0x18')](_0x6e82('0x12'),auth[_0x6e82('0x9')](),controller[_0x6e82('0x19')]);router[_0x6e82('0x18')](_0x6e82('0x1a'),auth[_0x6e82('0x9')](),controller[_0x6e82('0x1b')]);router['post']('/:id/users',auth[_0x6e82('0x9')](),controller[_0x6e82('0x1c')]);router[_0x6e82('0x1d')](_0x6e82('0xe'),auth[_0x6e82('0x9')](),controller[_0x6e82('0x1e')]);router[_0x6e82('0x1f')](_0x6e82('0xe'),auth['isAuthenticated'](),controller[_0x6e82('0x20')]);router[_0x6e82('0x1f')]('/:id/dispositions',auth[_0x6e82('0x9')](),controller[_0x6e82('0x21')]);router[_0x6e82('0x1f')](_0x6e82('0x16'),auth[_0x6e82('0x9')](),controller['removeAgents']);module[_0x6e82('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index c2872b0..337decc 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 _0x8c47=['sequelize','exports','VIRTUAL','field','STRING'];(function(_0x5dc10c,_0x544c38){var _0xc0d9a3=function(_0x167457){while(--_0x167457){_0x5dc10c['push'](_0x5dc10c['shift']());}};_0xc0d9a3(++_0x544c38);}(_0x8c47,0xa5));var _0x78c4=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x8c47[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x78c4('0x0'));module[_0x78c4('0x1')]={'name':{'type':Sequelize[_0x78c4('0x2')],'get':function(_0x2fec40){return this['getDataValue'](_0x78c4('0x3'));}},'field':{'type':Sequelize[_0x78c4('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x78c4('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x78c4('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xdccb=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0xd61f3,_0x166992){var _0x4c6ce7=function(_0x54ea51){while(--_0x54ea51){_0xd61f3['push'](_0xd61f3['shift']());}};_0x4c6ce7(++_0x166992);}(_0xdccb,0x168));var _0xbdcc=function(_0x30df2d,_0x117496){_0x30df2d=_0x30df2d-0x0;var _0x174b6d=_0xdccb[_0x30df2d];return _0x174b6d;};'use strict';var Sequelize=require(_0xbdcc('0x0'));module['exports']={'name':{'type':Sequelize[_0xbdcc('0x1')],'get':function(_0x52ad36){return this[_0xbdcc('0x2')](_0xbdcc('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xbdcc('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xbdcc('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 c097f46..d08a8fe 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(_0x43d658,_0x433742){var _0x5949c5=function(_0x429474){while(--_0x429474){_0x43d658['push'](_0x43d658['shift']());}};_0x5949c5(++_0x433742);}(_0x7a54,0x106));var _0x47a5=function(_0x2922f7,_0x233bc5){_0x2922f7=_0x2922f7-0x0;var _0x3b04d5=_0x7a54[_0x2922f7];return _0x3b04d5;};'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(_0x1226d9,_0x545616){var _0x3c5ef3=function(_0x186db8){while(--_0x186db8){_0x1226d9['push'](_0x1226d9['shift']());}};_0x3c5ef3(++_0x545616);}(_0x7a54,0x106));var _0x47a5=function(_0x4a1608,_0x304a68){_0x4a1608=_0x4a1608-0x0;var _0x233de1=_0x7a54[_0x4a1608];return _0x233de1;};'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 85731e5..015d791 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 _0x6c75=['util','api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash'];(function(_0x276b57,_0x1fa708){var _0x5db4b9=function(_0x28234e){while(--_0x28234e){_0x276b57['push'](_0x276b57['shift']());}};_0x5db4b9(++_0x1fa708);}(_0x6c75,0x110));var _0x56c7=function(_0x1abf78,_0x4e69f3){_0x1abf78=_0x1abf78-0x0;var _0x1b2393=_0x6c75[_0x1abf78];return _0x1b2393;};'use strict';var _=require(_0x56c7('0x0'));var util=require(_0x56c7('0x1'));var logger=require('../../config/logger')(_0x56c7('0x2'));var moment=require(_0x56c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x56c7('0x4'));var fs=require('fs');var path=require(_0x56c7('0x5'));var rimraf=require(_0x56c7('0x6'));var config=require(_0x56c7('0x7'));var attributes=require(_0x56c7('0x8'));module[_0x56c7('0x9')]=function(_0x520ff4,_0x4023c4){return _0x520ff4[_0x56c7('0xa')](_0x56c7('0xb'),attributes,{'tableName':_0x56c7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf738=['define','Condition','tools_conditions','../../config/logger','moment','bluebird','path','rimraf','./condition.attributes','exports'];(function(_0xafdfb1,_0x58b859){var _0x31bed=function(_0x2e8df5){while(--_0x2e8df5){_0xafdfb1['push'](_0xafdfb1['shift']());}};_0x31bed(++_0x58b859);}(_0xf738,0x1c5));var _0x8f73=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xf738[_0x5c4f6b];return _0x104c4e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f73('0x0'))('api');var moment=require(_0x8f73('0x1'));var BPromise=require(_0x8f73('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f73('0x3'));var rimraf=require(_0x8f73('0x4'));var config=require('../../config/environment');var attributes=require(_0x8f73('0x5'));module[_0x8f73('0x6')]=function(_0x24edb8,_0x3830a3){return _0x24edb8[_0x8f73('0x7')](_0x8f73('0x8'),attributes,{'tableName':_0x8f73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 19d8049..4ed98b3 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 _0xf36f=['request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s'];(function(_0x41ac1f,_0x183672){var _0x3b5516=function(_0x47b950){while(--_0x47b950){_0x41ac1f['push'](_0x41ac1f['shift']());}};_0x3b5516(++_0x183672);}(_0xf36f,0x1e9));var _0xff36=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf36f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xff36('0x0'));var util=require(_0xff36('0x1'));var moment=require('moment');var BPromise=require(_0xff36('0x2'));var rs=require(_0xff36('0x3'));var fs=require('fs');var Redis=require(_0xff36('0x4'));var db=require(_0xff36('0x5'))['db'];var utils=require(_0xff36('0x6'));var logger=require(_0xff36('0x7'))(_0xff36('0x8'));var config=require(_0xff36('0x9'));var jayson=require(_0xff36('0xa'));var client=jayson[_0xff36('0xb')][_0xff36('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3db2f1,_0x1fe368,_0x3e9395){return new BPromise(function(_0x3f01f6,_0x27bcd6){return client[_0xff36('0xd')](_0x3db2f1,_0x3e9395)[_0xff36('0xe')](function(_0xff9c61){logger[_0xff36('0xf')](_0xff36('0x10'),_0x1fe368,_0xff36('0x11'));logger[_0xff36('0x12')](_0xff36('0x13'),_0x1fe368,_0xff36('0x11'),JSON[_0xff36('0x14')](_0xff9c61));if(_0xff9c61[_0xff36('0x15')]){if(_0xff9c61[_0xff36('0x15')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x1fe368,_0xff9c61[_0xff36('0x15')][_0xff36('0x16')]);return _0x27bcd6(_0xff9c61['error'][_0xff36('0x16')]);}logger[_0xff36('0x15')](_0xff36('0x10'),_0x1fe368,_0xff9c61[_0xff36('0x15')][_0xff36('0x16')]);return _0x3f01f6(_0xff9c61['error'][_0xff36('0x16')]);}else{logger[_0xff36('0xf')](_0xff36('0x10'),_0x1fe368,'request\x20sent');_0x3f01f6(_0xff9c61['result']['message']);}})['catch'](function(_0x4942df){logger['error']('Condition,\x20%s,\x20%s',_0x1fe368,_0x4942df);_0x27bcd6(_0x4942df);});});} \ No newline at end of file +var _0xb544=['then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0xb9d849,_0x5aa518){var _0x2d08a5=function(_0x3511be){while(--_0x3511be){_0xb9d849['push'](_0xb9d849['shift']());}};_0x2d08a5(++_0x5aa518);}(_0xb544,0x128));var _0x4b54=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xb544[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x4b54('0x0'));var moment=require(_0x4b54('0x1'));var BPromise=require(_0x4b54('0x2'));var rs=require(_0x4b54('0x3'));var fs=require('fs');var Redis=require(_0x4b54('0x4'));var db=require(_0x4b54('0x5'))['db'];var utils=require(_0x4b54('0x6'));var logger=require(_0x4b54('0x7'))(_0x4b54('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b54('0x9')][_0x4b54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b247d,_0x4f412f,_0xe86f23){return new BPromise(function(_0x3133d2,_0x2697e6){return client[_0x4b54('0xb')](_0x3b247d,_0xe86f23)[_0x4b54('0xc')](function(_0x2a912f){logger[_0x4b54('0xd')](_0x4b54('0xe'),_0x4f412f,_0x4b54('0xf'));logger[_0x4b54('0x10')](_0x4b54('0x11'),_0x4f412f,'request\x20sent',JSON[_0x4b54('0x12')](_0x2a912f));if(_0x2a912f[_0x4b54('0x13')]){if(_0x2a912f[_0x4b54('0x13')]['code']===0x1f4){logger[_0x4b54('0x13')](_0x4b54('0xe'),_0x4f412f,_0x2a912f[_0x4b54('0x13')]['message']);return _0x2697e6(_0x2a912f[_0x4b54('0x13')][_0x4b54('0x14')]);}logger[_0x4b54('0x13')](_0x4b54('0xe'),_0x4f412f,_0x2a912f[_0x4b54('0x13')][_0x4b54('0x14')]);return _0x3133d2(_0x2a912f['error']['message']);}else{logger[_0x4b54('0xd')](_0x4b54('0xe'),_0x4f412f,_0x4b54('0xf'));_0x3133d2(_0x2a912f[_0x4b54('0x15')]['message']);}})['catch'](function(_0x532881){logger[_0x4b54('0x13')](_0x4b54('0xe'),_0x4f412f,_0x532881);_0x2697e6(_0x532881);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 40c6955..892cda5 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 _0x419e=['fs-extra','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','update','delete','isAuthenticated','exports','multer','util','path','connect-timeout'];(function(_0x29947b,_0x1b63eb){var _0x108bdd=function(_0x593ee7){while(--_0x593ee7){_0x29947b['push'](_0x29947b['shift']());}};_0x108bdd(++_0x1b63eb);}(_0x419e,0x1a0));var _0xe419=function(_0xe7d24e,_0x235022){_0xe7d24e=_0xe7d24e-0x0;var _0x42c6e3=_0x419e[_0xe7d24e];return _0x42c6e3;};'use strict';var multer=require(_0xe419('0x0'));var util=require(_0xe419('0x1'));var path=require(_0xe419('0x2'));var timeout=require(_0xe419('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe419('0x4'));var auth=require(_0xe419('0x5'));var interaction=require(_0xe419('0x6'));var config=require('../../config/environment');var controller=require(_0xe419('0x7'));router[_0xe419('0x8')](_0xe419('0x9'),auth['isAuthenticated'](),controller[_0xe419('0xa')]);router[_0xe419('0xb')]('/:id',auth[_0xe419('0xc')](),controller['destroy']);module[_0xe419('0xd')]=router; \ No newline at end of file +var _0x0149=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','update','delete','destroy','exports','multer'];(function(_0x389b85,_0x243112){var _0x2fd54b=function(_0xc1c935){while(--_0xc1c935){_0x389b85['push'](_0x389b85['shift']());}};_0x2fd54b(++_0x243112);}(_0x0149,0xa4));var _0x9014=function(_0x3fad19,_0x354121){_0x3fad19=_0x3fad19-0x0;var _0x583d77=_0x0149[_0x3fad19];return _0x583d77;};'use strict';var multer=require(_0x9014('0x0'));var util=require(_0x9014('0x1'));var path=require('path');var timeout=require(_0x9014('0x2'));var express=require(_0x9014('0x3'));var router=express[_0x9014('0x4')]();var fs_extra=require(_0x9014('0x5'));var auth=require(_0x9014('0x6'));var interaction=require(_0x9014('0x7'));var config=require(_0x9014('0x8'));var controller=require('./condition.controller');router[_0x9014('0x9')](_0x9014('0xa'),auth['isAuthenticated'](),controller[_0x9014('0xb')]);router[_0x9014('0xc')](_0x9014('0xa'),auth['isAuthenticated'](),controller[_0x9014('0xd')]);module[_0x9014('0xe')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index c9dfe80..47a1f07 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 _0xbf6f=['name','exports','STRING'];(function(_0x3f061c,_0x1c8136){var _0x2d2f93=function(_0x4eb3e5){while(--_0x4eb3e5){_0x3f061c['push'](_0x3f061c['shift']());}};_0x2d2f93(++_0x1c8136);}(_0xbf6f,0x12d));var _0xfbf6=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xbf6f[_0xc0d9bc];return _0x32ff73;};'use strict';var Sequelize=require('sequelize');module[_0xfbf6('0x0')]={'name':{'type':Sequelize[_0xfbf6('0x1')],'allowNull':![],'unique':_0xfbf6('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfbf6('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x3b6b=['exports','name','INTEGER','STRING','sequelize'];(function(_0x3e0628,_0x511646){var _0x4e1918=function(_0xe98ca7){while(--_0xe98ca7){_0x3e0628['push'](_0x3e0628['shift']());}};_0x4e1918(++_0x511646);}(_0x3b6b,0x194));var _0xb3b6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b6b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb3b6('0x0'));module[_0xb3b6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb3b6('0x2')},'OrderBy':{'type':Sequelize[_0xb3b6('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb3b6('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index cd82bd6..7a7d353 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 _0x4e2e=['include','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll'];(function(_0x183487,_0x14001c){var _0x152c4a=function(_0x3ccc12){while(--_0x3ccc12){_0x183487['push'](_0x183487['shift']());}};_0x152c4a(++_0x14001c);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x19bb0d,_0x436c74){_0x19bb0d=_0x19bb0d-0x0;var _0x224335=_0x4e2e[_0x19bb0d];return _0x224335;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4e2('0x0'));var zipdir=require(_0xe4e2('0x1'));var jsonpatch=require(_0xe4e2('0x2'));var rp=require(_0xe4e2('0x3'));var moment=require(_0xe4e2('0x4'));var BPromise=require(_0xe4e2('0x5'));var Mustache=require('mustache');var util=require(_0xe4e2('0x6'));var path=require(_0xe4e2('0x7'));var sox=require(_0xe4e2('0x8'));var csv=require(_0xe4e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4e2('0xa'));var _=require(_0xe4e2('0xb'));var squel=require(_0xe4e2('0xc'));var crypto=require(_0xe4e2('0xd'));var jsforce=require(_0xe4e2('0xe'));var deskjs=require(_0xe4e2('0xf'));var toCsv=require(_0xe4e2('0x9'));var querystring=require(_0xe4e2('0x10'));var Papa=require('papaparse');var Redis=require(_0xe4e2('0x11'));var authService=require(_0xe4e2('0x12'));var qs=require(_0xe4e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4e2('0x14'));var logger=require(_0xe4e2('0x15'))(_0xe4e2('0x16'));var utils=require(_0xe4e2('0x17'));var config=require(_0xe4e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4e2('0x19'))['db'];function respondWithStatusCode(_0x20d34e,_0x19c6ef){_0x19c6ef=_0x19c6ef||0xcc;return function(_0x13657c){if(_0x13657c){return _0x20d34e['sendStatus'](_0x19c6ef);}return _0x20d34e[_0xe4e2('0x1a')](_0x19c6ef)[_0xe4e2('0x1b')]();};}function respondWithResult(_0xb45217,_0x4e0bc2){_0x4e0bc2=_0x4e0bc2||0xc8;return function(_0x202486){if(_0x202486){return _0xb45217['status'](_0x4e0bc2)['json'](_0x202486);}};}function respondWithFilteredResult(_0x117a2a,_0x2d2018){return function(_0x1f9b2d){if(_0x1f9b2d){var _0x28ee12=typeof _0x2d2018[_0xe4e2('0x1c')]==='undefined'&&typeof _0x2d2018[_0xe4e2('0x1d')]===_0xe4e2('0x1e');var _0x340935=_0x1f9b2d['count'];var _0x196f16=_0x28ee12?0x0:_0x2d2018['offset'];var _0x1d5e9d=_0x28ee12?_0x1f9b2d[_0xe4e2('0x1f')]:_0x2d2018[_0xe4e2('0x1c')]+_0x2d2018[_0xe4e2('0x1d')];var _0x3dfbdf;if(_0x1d5e9d>=_0x340935){_0x1d5e9d=_0x340935;_0x3dfbdf=0xc8;}else{_0x3dfbdf=0xce;}_0x117a2a[_0xe4e2('0x1a')](_0x3dfbdf);return _0x117a2a[_0xe4e2('0x20')](_0xe4e2('0x21'),_0x196f16+'-'+_0x1d5e9d+'/'+_0x340935)[_0xe4e2('0x22')](_0x1f9b2d);}return null;};}function patchUpdates(_0x362741){return function(_0x5a84c5){try{jsonpatch[_0xe4e2('0x23')](_0x5a84c5,_0x362741,!![]);}catch(_0x2e7ecd){return BPromise[_0xe4e2('0x24')](_0x2e7ecd);}return _0x5a84c5[_0xe4e2('0x25')]();};}function saveUpdates(_0xbdf1ad,_0x23b466){return function(_0x16f14b){if(_0x16f14b){return _0x16f14b['update'](_0xbdf1ad)[_0xe4e2('0x26')](function(_0x2ab435){return _0x2ab435;});}return null;};}function removeEntity(_0x2088b9,_0x5373c0){return function(_0x353030){if(_0x353030){return _0x353030[_0xe4e2('0x27')]()['then'](function(){var _0xcba85a=_0x353030[_0xe4e2('0x28')]({'plain':!![]});var _0x29143c=_0xe4e2('0x29');return db[_0xe4e2('0x2a')]['destroy']({'where':{'type':_0x29143c,'resourceId':_0xcba85a['id']}})[_0xe4e2('0x26')](function(){return _0x353030;});})[_0xe4e2('0x26')](function(){_0x2088b9[_0xe4e2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a31b8,_0x41cfd9){return function(_0x31f651){if(!_0x31f651){_0x3a31b8['sendStatus'](0x194);}return _0x31f651;};}function handleError(_0x2e5a65,_0x50b4d9){_0x50b4d9=_0x50b4d9||0x1f4;return function(_0x477b5c){logger[_0xe4e2('0x2b')](_0x477b5c['stack']);if(_0x477b5c[_0xe4e2('0x2c')]){delete _0x477b5c[_0xe4e2('0x2c')];}_0x2e5a65[_0xe4e2('0x1a')](_0x50b4d9)[_0xe4e2('0x2d')](_0x477b5c);};}exports[_0xe4e2('0x2e')]=function(_0x4d33de,_0x5f30dc){var _0x2cb235={},_0x2fe075={},_0x12848d={'count':0x0,'rows':[]};var _0x26fb97=_[_0xe4e2('0x2f')](db[_0xe4e2('0x30')][_0xe4e2('0x31')],function(_0x40569e){return{'name':_0x40569e[_0xe4e2('0x32')],'type':_0x40569e[_0xe4e2('0x33')][_0xe4e2('0x34')]};});_0x2fe075[_0xe4e2('0x35')]=_['map'](_0x26fb97,_0xe4e2('0x2c'));_0x2fe075[_0xe4e2('0x36')]=_[_0xe4e2('0x37')](_0x4d33de[_0xe4e2('0x36')]);_0x2fe075[_0xe4e2('0x38')]=_[_0xe4e2('0x39')](_0x2fe075['model'],_0x2fe075[_0xe4e2('0x36')]);_0x2cb235[_0xe4e2('0x3a')]=_[_0xe4e2('0x39')](_0x2fe075[_0xe4e2('0x35')],qs[_0xe4e2('0x3b')](_0x4d33de[_0xe4e2('0x36')][_0xe4e2('0x3b')]));_0x2cb235[_0xe4e2('0x3a')]=_0x2cb235[_0xe4e2('0x3a')][_0xe4e2('0x3c')]?_0x2cb235[_0xe4e2('0x3a')]:_0x2fe075['model'];if(!_0x4d33de[_0xe4e2('0x36')]['hasOwnProperty'](_0xe4e2('0x3d'))){_0x2cb235[_0xe4e2('0x1d')]=qs['limit'](_0x4d33de[_0xe4e2('0x36')][_0xe4e2('0x1d')]);_0x2cb235[_0xe4e2('0x1c')]=qs[_0xe4e2('0x1c')](_0x4d33de['query'][_0xe4e2('0x1c')]);}_0x2cb235['order']=qs[_0xe4e2('0x3e')](_0x4d33de['query'][_0xe4e2('0x3e')]);_0x2cb235[_0xe4e2('0x3f')]=qs[_0xe4e2('0x38')](_['pick'](_0x4d33de[_0xe4e2('0x36')],_0x2fe075[_0xe4e2('0x38')]),_0x26fb97);if(_0x4d33de['query'][_0xe4e2('0x40')]){_0x2cb235[_0xe4e2('0x3f')]=_[_0xe4e2('0x41')](_0x2cb235[_0xe4e2('0x3f')],{'$or':_[_0xe4e2('0x2f')](_0x26fb97,function(_0x242435){if(_0x242435[_0xe4e2('0x33')]!==_0xe4e2('0x42')){var _0xc07ff5={};_0xc07ff5[_0x242435['name']]={'$like':'%'+_0x4d33de['query'][_0xe4e2('0x40')]+'%'};return _0xc07ff5;}})});}_0x2cb235=_[_0xe4e2('0x41')]({},_0x2cb235,_0x4d33de[_0xe4e2('0x43')]);var _0x3e1ae5={'where':_0x2cb235['where']};return db['ContactItemType'][_0xe4e2('0x1f')](_0x3e1ae5)[_0xe4e2('0x26')](function(_0x3080d5){_0x12848d[_0xe4e2('0x1f')]=_0x3080d5;if(_0x4d33de['query'][_0xe4e2('0x44')]){_0x2cb235[_0xe4e2('0x45')]=[{'all':!![]}];}return db[_0xe4e2('0x30')]['findAll'](_0x2cb235);})[_0xe4e2('0x26')](function(_0x4789cf){_0x12848d[_0xe4e2('0x46')]=_0x4789cf;return _0x12848d;})[_0xe4e2('0x26')](respondWithFilteredResult(_0x5f30dc,_0x2cb235))['catch'](handleError(_0x5f30dc,null));};exports['show']=function(_0x41f16c,_0x87eb2d){var _0x39fff5={'raw':!![],'where':{'id':_0x41f16c[_0xe4e2('0x47')]['id']}},_0x5c29c3={};_0x5c29c3[_0xe4e2('0x35')]=_['keys'](db[_0xe4e2('0x30')][_0xe4e2('0x31')]);_0x5c29c3[_0xe4e2('0x36')]=_[_0xe4e2('0x37')](_0x41f16c[_0xe4e2('0x36')]);_0x5c29c3[_0xe4e2('0x38')]=_[_0xe4e2('0x39')](_0x5c29c3[_0xe4e2('0x35')],_0x5c29c3['query']);_0x39fff5[_0xe4e2('0x3a')]=_[_0xe4e2('0x39')](_0x5c29c3['model'],qs['fields'](_0x41f16c[_0xe4e2('0x36')][_0xe4e2('0x3b')]));_0x39fff5[_0xe4e2('0x3a')]=_0x39fff5['attributes'][_0xe4e2('0x3c')]?_0x39fff5[_0xe4e2('0x3a')]:_0x5c29c3[_0xe4e2('0x35')];if(_0x41f16c[_0xe4e2('0x36')]['includeAll']){_0x39fff5[_0xe4e2('0x45')]=[{'all':!![]}];}_0x39fff5=_[_0xe4e2('0x41')]({},_0x39fff5,_0x41f16c[_0xe4e2('0x43')]);return db[_0xe4e2('0x30')]['find'](_0x39fff5)[_0xe4e2('0x26')](handleEntityNotFound(_0x87eb2d,null))[_0xe4e2('0x26')](respondWithResult(_0x87eb2d,null))['catch'](handleError(_0x87eb2d,null));};exports[_0xe4e2('0x48')]=function(_0xedcd86,_0x21e5d7){return db['ContactItemType'][_0xe4e2('0x48')](_0xedcd86[_0xe4e2('0x49')],{})[_0xe4e2('0x26')](function(_0x599978){var _0x5edd7e=_0xedcd86[_0xe4e2('0x4a')]['get']({'plain':!![]});if(!_0x5edd7e)throw new Error(_0xe4e2('0x4b'));if(_0x5edd7e['role']===_0xe4e2('0x4a')){var _0x2125df=_0x599978[_0xe4e2('0x28')]({'plain':!![]});var _0x553817=_0xe4e2('0x29');return db['UserProfileSection'][_0xe4e2('0x4c')]({'where':{'name':_0x553817,'userProfileId':_0x5edd7e[_0xe4e2('0x4d')]},'raw':!![]})['then'](function(_0x9d00fb){if(_0x9d00fb&&_0x9d00fb['autoAssociation']===0x0){return db[_0xe4e2('0x2a')][_0xe4e2('0x48')]({'name':_0x2125df['name'],'resourceId':_0x2125df['id'],'type':_0x9d00fb[_0xe4e2('0x2c')],'sectionId':_0x9d00fb['id']},{})[_0xe4e2('0x26')](function(){return _0x599978;});}else{return _0x599978;}})[_0xe4e2('0x4e')](function(_0x3e540d){logger[_0xe4e2('0x2b')](_0xe4e2('0x4f'),_0x3e540d);throw _0x3e540d;});}return _0x599978;})[_0xe4e2('0x26')](respondWithResult(_0x21e5d7,0xc9))[_0xe4e2('0x4e')](handleError(_0x21e5d7,null));};exports[_0xe4e2('0x50')]=function(_0x503b77,_0x3e65df){if(_0x503b77[_0xe4e2('0x49')]['id']){delete _0x503b77[_0xe4e2('0x49')]['id'];}return db[_0xe4e2('0x30')][_0xe4e2('0x4c')]({'where':{'id':_0x503b77[_0xe4e2('0x47')]['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x3e65df,null))[_0xe4e2('0x26')](saveUpdates(_0x503b77[_0xe4e2('0x49')],null))[_0xe4e2('0x26')](respondWithResult(_0x3e65df,null))[_0xe4e2('0x4e')](handleError(_0x3e65df,null));};exports['destroy']=function(_0x17a350,_0x435ae0){return db[_0xe4e2('0x30')][_0xe4e2('0x4c')]({'where':{'id':_0x17a350['params']['id']}})[_0xe4e2('0x26')](handleEntityNotFound(_0x435ae0,null))[_0xe4e2('0x26')](db['CmContactHasItem'][_0xe4e2('0x50')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x17a350[_0xe4e2('0x47')]['id']}}))[_0xe4e2('0x26')](removeEntity(_0x435ae0,null))[_0xe4e2('0x4e')](handleError(_0x435ae0,null));}; \ No newline at end of file +var _0x28f2=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','ContactItemType','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5483a6,_0x30d8bb){var _0x1f8e85=function(_0x3bbc49){while(--_0x3bbc49){_0x5483a6['push'](_0x5483a6['shift']());}};_0x1f8e85(++_0x30d8bb);}(_0x28f2,0x193));var _0x228f=function(_0x201145,_0x58795d){_0x201145=_0x201145-0x0;var _0x7c007=_0x28f2[_0x201145];return _0x7c007;};'use strict';var emlformat=require(_0x228f('0x0'));var rimraf=require(_0x228f('0x1'));var zipdir=require(_0x228f('0x2'));var jsonpatch=require(_0x228f('0x3'));var rp=require(_0x228f('0x4'));var moment=require('moment');var BPromise=require(_0x228f('0x5'));var Mustache=require(_0x228f('0x6'));var util=require(_0x228f('0x7'));var path=require(_0x228f('0x8'));var sox=require(_0x228f('0x9'));var csv=require(_0x228f('0xa'));var ejs=require(_0x228f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x228f('0xc'));var squel=require('squel');var crypto=require(_0x228f('0xd'));var jsforce=require(_0x228f('0xe'));var deskjs=require(_0x228f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x228f('0x10'));var Papa=require('papaparse');var Redis=require(_0x228f('0x11'));var authService=require(_0x228f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x228f('0x13'));var hardwareService=require(_0x228f('0x14'));var logger=require(_0x228f('0x15'))(_0x228f('0x16'));var utils=require(_0x228f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x228f('0x18'));var db=require(_0x228f('0x19'))['db'];function respondWithStatusCode(_0x24f69c,_0x14073a){_0x14073a=_0x14073a||0xcc;return function(_0x2e1a43){if(_0x2e1a43){return _0x24f69c[_0x228f('0x1a')](_0x14073a);}return _0x24f69c[_0x228f('0x1b')](_0x14073a)[_0x228f('0x1c')]();};}function respondWithResult(_0x572535,_0x2fab95){_0x2fab95=_0x2fab95||0xc8;return function(_0xfb6aff){if(_0xfb6aff){return _0x572535[_0x228f('0x1b')](_0x2fab95)[_0x228f('0x1d')](_0xfb6aff);}};}function respondWithFilteredResult(_0x2a4d87,_0x21a913){return function(_0x272723){if(_0x272723){var _0x5b5abb=typeof _0x21a913[_0x228f('0x1e')]==='undefined'&&typeof _0x21a913[_0x228f('0x1f')]===_0x228f('0x20');var _0x195e65=_0x272723['count'];var _0x2d4819=_0x5b5abb?0x0:_0x21a913['offset'];var _0x33e32e=_0x5b5abb?_0x272723['count']:_0x21a913[_0x228f('0x1e')]+_0x21a913['limit'];var _0x5aa203;if(_0x33e32e>=_0x195e65){_0x33e32e=_0x195e65;_0x5aa203=0xc8;}else{_0x5aa203=0xce;}_0x2a4d87[_0x228f('0x1b')](_0x5aa203);return _0x2a4d87['set'](_0x228f('0x21'),_0x2d4819+'-'+_0x33e32e+'/'+_0x195e65)[_0x228f('0x1d')](_0x272723);}return null;};}function patchUpdates(_0x1294a8){return function(_0x3a623a){try{jsonpatch[_0x228f('0x22')](_0x3a623a,_0x1294a8,!![]);}catch(_0x313cf2){return BPromise[_0x228f('0x23')](_0x313cf2);}return _0x3a623a[_0x228f('0x24')]();};}function saveUpdates(_0x15d54f,_0x4ee0c9){return function(_0x1e96d4){if(_0x1e96d4){return _0x1e96d4[_0x228f('0x25')](_0x15d54f)[_0x228f('0x26')](function(_0x3c00ad){return _0x3c00ad;});}return null;};}function removeEntity(_0x1dad27,_0x194d1a){return function(_0x33e882){if(_0x33e882){return _0x33e882[_0x228f('0x27')]()[_0x228f('0x26')](function(){var _0x56fbc2=_0x33e882[_0x228f('0x28')]({'plain':!![]});var _0x306928=_0x228f('0x29');return db[_0x228f('0x2a')][_0x228f('0x27')]({'where':{'type':_0x306928,'resourceId':_0x56fbc2['id']}})['then'](function(){return _0x33e882;});})[_0x228f('0x26')](function(){_0x1dad27['status'](0xcc)[_0x228f('0x1c')]();});}};}function handleEntityNotFound(_0x5afa52,_0x58a151){return function(_0x2b9802){if(!_0x2b9802){_0x5afa52[_0x228f('0x1a')](0x194);}return _0x2b9802;};}function handleError(_0x2a7842,_0x3ab339){_0x3ab339=_0x3ab339||0x1f4;return function(_0x34c735){logger[_0x228f('0x2b')](_0x34c735[_0x228f('0x2c')]);if(_0x34c735[_0x228f('0x2d')]){delete _0x34c735[_0x228f('0x2d')];}_0x2a7842[_0x228f('0x1b')](_0x3ab339)[_0x228f('0x2e')](_0x34c735);};}exports[_0x228f('0x2f')]=function(_0xc25917,_0xc6921f){var _0x2a3677={},_0x4e9ca8={},_0x4148ff={'count':0x0,'rows':[]};var _0x40bf17=_[_0x228f('0x30')](db['ContactItemType'][_0x228f('0x31')],function(_0x41be2d){return{'name':_0x41be2d['fieldName'],'type':_0x41be2d[_0x228f('0x32')][_0x228f('0x33')]};});_0x4e9ca8[_0x228f('0x34')]=_[_0x228f('0x30')](_0x40bf17,'name');_0x4e9ca8[_0x228f('0x35')]=_['keys'](_0xc25917[_0x228f('0x35')]);_0x4e9ca8[_0x228f('0x36')]=_[_0x228f('0x37')](_0x4e9ca8[_0x228f('0x34')],_0x4e9ca8['query']);_0x2a3677[_0x228f('0x38')]=_[_0x228f('0x37')](_0x4e9ca8['model'],qs['fields'](_0xc25917['query'][_0x228f('0x39')]));_0x2a3677[_0x228f('0x38')]=_0x2a3677[_0x228f('0x38')][_0x228f('0x3a')]?_0x2a3677[_0x228f('0x38')]:_0x4e9ca8[_0x228f('0x34')];if(!_0xc25917[_0x228f('0x35')][_0x228f('0x3b')](_0x228f('0x3c'))){_0x2a3677['limit']=qs['limit'](_0xc25917[_0x228f('0x35')][_0x228f('0x1f')]);_0x2a3677[_0x228f('0x1e')]=qs[_0x228f('0x1e')](_0xc25917[_0x228f('0x35')][_0x228f('0x1e')]);}_0x2a3677[_0x228f('0x3d')]=qs[_0x228f('0x3e')](_0xc25917[_0x228f('0x35')][_0x228f('0x3e')]);_0x2a3677['where']=qs['filters'](_[_0x228f('0x3f')](_0xc25917[_0x228f('0x35')],_0x4e9ca8[_0x228f('0x36')]),_0x40bf17);if(_0xc25917[_0x228f('0x35')]['filter']){_0x2a3677[_0x228f('0x40')]=_[_0x228f('0x41')](_0x2a3677['where'],{'$or':_['map'](_0x40bf17,function(_0x3da115){if(_0x3da115[_0x228f('0x32')]!=='VIRTUAL'){var _0x12a750={};_0x12a750[_0x3da115[_0x228f('0x2d')]]={'$like':'%'+_0xc25917['query']['filter']+'%'};return _0x12a750;}})});}_0x2a3677=_[_0x228f('0x41')]({},_0x2a3677,_0xc25917['options']);var _0x323d68={'where':_0x2a3677[_0x228f('0x40')]};return db[_0x228f('0x42')][_0x228f('0x43')](_0x323d68)[_0x228f('0x26')](function(_0x20c178){_0x4148ff['count']=_0x20c178;if(_0xc25917[_0x228f('0x35')]['includeAll']){_0x2a3677[_0x228f('0x44')]=[{'all':!![]}];}return db[_0x228f('0x42')][_0x228f('0x45')](_0x2a3677);})[_0x228f('0x26')](function(_0x41cba5){_0x4148ff[_0x228f('0x46')]=_0x41cba5;return _0x4148ff;})[_0x228f('0x26')](respondWithFilteredResult(_0xc6921f,_0x2a3677))[_0x228f('0x47')](handleError(_0xc6921f,null));};exports[_0x228f('0x48')]=function(_0x2592a1,_0x788e8b){var _0x345114={'raw':!![],'where':{'id':_0x2592a1['params']['id']}},_0x19839d={};_0x19839d['model']=_[_0x228f('0x49')](db[_0x228f('0x42')][_0x228f('0x31')]);_0x19839d[_0x228f('0x35')]=_[_0x228f('0x49')](_0x2592a1[_0x228f('0x35')]);_0x19839d[_0x228f('0x36')]=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],_0x19839d[_0x228f('0x35')]);_0x345114['attributes']=_[_0x228f('0x37')](_0x19839d[_0x228f('0x34')],qs['fields'](_0x2592a1[_0x228f('0x35')]['fields']));_0x345114[_0x228f('0x38')]=_0x345114['attributes'][_0x228f('0x3a')]?_0x345114['attributes']:_0x19839d[_0x228f('0x34')];if(_0x2592a1[_0x228f('0x35')][_0x228f('0x4a')]){_0x345114[_0x228f('0x44')]=[{'all':!![]}];}_0x345114=_[_0x228f('0x41')]({},_0x345114,_0x2592a1[_0x228f('0x4b')]);return db[_0x228f('0x42')][_0x228f('0x4c')](_0x345114)[_0x228f('0x26')](handleEntityNotFound(_0x788e8b,null))[_0x228f('0x26')](respondWithResult(_0x788e8b,null))[_0x228f('0x47')](handleError(_0x788e8b,null));};exports[_0x228f('0x4d')]=function(_0x4099d4,_0x250345){return db[_0x228f('0x42')][_0x228f('0x4d')](_0x4099d4[_0x228f('0x4e')],{})[_0x228f('0x26')](function(_0x1872e2){var _0x55e140=_0x4099d4['user'][_0x228f('0x28')]({'plain':!![]});if(!_0x55e140)throw new Error(_0x228f('0x4f'));if(_0x55e140[_0x228f('0x50')]==='user'){var _0x17bcd9=_0x1872e2[_0x228f('0x28')]({'plain':!![]});var _0x28f91e='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x28f91e,'userProfileId':_0x55e140[_0x228f('0x51')]},'raw':!![]})[_0x228f('0x26')](function(_0x208397){if(_0x208397&&_0x208397[_0x228f('0x52')]===0x0){return db[_0x228f('0x2a')][_0x228f('0x4d')]({'name':_0x17bcd9[_0x228f('0x2d')],'resourceId':_0x17bcd9['id'],'type':_0x208397[_0x228f('0x2d')],'sectionId':_0x208397['id']},{})[_0x228f('0x26')](function(){return _0x1872e2;});}else{return _0x1872e2;}})[_0x228f('0x47')](function(_0x43bbd2){logger[_0x228f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43bbd2);throw _0x43bbd2;});}return _0x1872e2;})[_0x228f('0x26')](respondWithResult(_0x250345,0xc9))[_0x228f('0x47')](handleError(_0x250345,null));};exports[_0x228f('0x25')]=function(_0x561144,_0x3e9f76){if(_0x561144[_0x228f('0x4e')]['id']){delete _0x561144[_0x228f('0x4e')]['id'];}return db[_0x228f('0x42')]['find']({'where':{'id':_0x561144[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x3e9f76,null))[_0x228f('0x26')](saveUpdates(_0x561144[_0x228f('0x4e')],null))['then'](respondWithResult(_0x3e9f76,null))[_0x228f('0x47')](handleError(_0x3e9f76,null));};exports[_0x228f('0x27')]=function(_0x4b516e,_0x32787c){return db[_0x228f('0x42')][_0x228f('0x4c')]({'where':{'id':_0x4b516e[_0x228f('0x53')]['id']}})[_0x228f('0x26')](handleEntityNotFound(_0x32787c,null))[_0x228f('0x26')](db[_0x228f('0x54')][_0x228f('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4b516e[_0x228f('0x53')]['id']}}))[_0x228f('0x26')](removeEntity(_0x32787c,null))['catch'](handleError(_0x32787c,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 5f9b3ec..8d1bdae 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 _0x4b81=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x285a37,_0x271e6f){var _0x24617a=function(_0x4ef6f8){while(--_0x4ef6f8){_0x285a37['push'](_0x285a37['shift']());}};_0x24617a(++_0x271e6f);}(_0x4b81,0x15e));var _0x14b8=function(_0x254f7d,_0x432e32){_0x254f7d=_0x254f7d-0x0;var _0x2ce002=_0x4b81[_0x254f7d];return _0x2ce002;};'use strict';var _=require(_0x14b8('0x0'));var util=require(_0x14b8('0x1'));var logger=require(_0x14b8('0x2'))('api');var moment=require(_0x14b8('0x3'));var BPromise=require(_0x14b8('0x4'));var rp=require(_0x14b8('0x5'));var fs=require('fs');var path=require(_0x14b8('0x6'));var rimraf=require(_0x14b8('0x7'));var config=require(_0x14b8('0x8'));var attributes=require('./contactItemType.attributes');module[_0x14b8('0x9')]=function(_0x16997a,_0x4d9913){return _0x16997a[_0x14b8('0xa')](_0x14b8('0xb'),attributes,{'tableName':_0x14b8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d20=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','define','tools_contact_item_types'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x3d20,0x1e1));var _0x03d2=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x3d20[_0x18cd5b];return _0x5eaa52;};'use strict';var _=require(_0x03d2('0x0'));var util=require(_0x03d2('0x1'));var logger=require(_0x03d2('0x2'))(_0x03d2('0x3'));var moment=require(_0x03d2('0x4'));var BPromise=require(_0x03d2('0x5'));var rp=require(_0x03d2('0x6'));var fs=require('fs');var path=require(_0x03d2('0x7'));var rimraf=require(_0x03d2('0x8'));var config=require(_0x03d2('0x9'));var attributes=require(_0x03d2('0xa'));module['exports']=function(_0x527ef5,_0x4b376a){return _0x527ef5[_0x03d2('0xb')]('ContactItemType',attributes,{'tableName':_0x03d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index b5fed25..d7e4d3a 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 _0x18ad=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18ad,0x1bc));var _0xd18a=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0x18ad[_0x448bab];return _0x5dc534;};'use strict';var _=require(_0xd18a('0x0'));var util=require(_0xd18a('0x1'));var moment=require(_0xd18a('0x2'));var BPromise=require(_0xd18a('0x3'));var rs=require(_0xd18a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd18a('0x5'));var logger=require('../../config/logger')(_0xd18a('0x6'));var config=require(_0xd18a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd18a('0x8')][_0xd18a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x526a0d,_0x1df2a4,_0x496794){return new BPromise(function(_0x2aa8d8,_0x37eac9){return client['request'](_0x526a0d,_0x496794)['then'](function(_0x2832a7){logger['info'](_0xd18a('0xa'),_0x1df2a4,_0xd18a('0xb'));logger[_0xd18a('0xc')](_0xd18a('0xd'),_0x1df2a4,_0xd18a('0xb'),JSON[_0xd18a('0xe')](_0x2832a7));if(_0x2832a7[_0xd18a('0xf')]){if(_0x2832a7[_0xd18a('0xf')]['code']===0x1f4){logger[_0xd18a('0xf')](_0xd18a('0xa'),_0x1df2a4,_0x2832a7[_0xd18a('0xf')]['message']);return _0x37eac9(_0x2832a7[_0xd18a('0xf')][_0xd18a('0x10')]);}logger['error'](_0xd18a('0xa'),_0x1df2a4,_0x2832a7[_0xd18a('0xf')]['message']);return _0x2aa8d8(_0x2832a7[_0xd18a('0xf')][_0xd18a('0x10')]);}else{logger['info'](_0xd18a('0xa'),_0x1df2a4,_0xd18a('0xb'));_0x2aa8d8(_0x2832a7[_0xd18a('0x11')]['message']);}})[_0xd18a('0x12')](function(_0x34ae13){logger[_0xd18a('0xf')](_0xd18a('0xa'),_0x1df2a4,_0x34ae13);_0x37eac9(_0x34ae13);});});} \ No newline at end of file +var _0xd6d5=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis'];(function(_0x51289c,_0x35570c){var _0x5c80a7=function(_0x3328f0){while(--_0x3328f0){_0x51289c['push'](_0x51289c['shift']());}};_0x5c80a7(++_0x35570c);}(_0xd6d5,0x171));var _0x5d6d=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0xd6d5[_0x124f88];return _0xed0e3b;};'use strict';var _=require(_0x5d6d('0x0'));var util=require(_0x5d6d('0x1'));var moment=require(_0x5d6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d6d('0x3'));var fs=require('fs');var Redis=require(_0x5d6d('0x4'));var db=require(_0x5d6d('0x5'))['db'];var utils=require(_0x5d6d('0x6'));var logger=require(_0x5d6d('0x7'))('rpc');var config=require(_0x5d6d('0x8'));var jayson=require(_0x5d6d('0x9'));var client=jayson[_0x5d6d('0xa')][_0x5d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x150e8b,_0x5270a0,_0x69d8ce){return new BPromise(function(_0x25e070,_0x5879cc){return client[_0x5d6d('0xc')](_0x150e8b,_0x69d8ce)[_0x5d6d('0xd')](function(_0xbb5875){logger[_0x5d6d('0xe')]('ContactItemType,\x20%s,\x20%s',_0x5270a0,_0x5d6d('0xf'));logger[_0x5d6d('0x10')](_0x5d6d('0x11'),_0x5270a0,_0x5d6d('0xf'),JSON[_0x5d6d('0x12')](_0xbb5875));if(_0xbb5875[_0x5d6d('0x13')]){if(_0xbb5875[_0x5d6d('0x13')]['code']===0x1f4){logger[_0x5d6d('0x13')](_0x5d6d('0x14'),_0x5270a0,_0xbb5875[_0x5d6d('0x13')][_0x5d6d('0x15')]);return _0x5879cc(_0xbb5875[_0x5d6d('0x13')][_0x5d6d('0x15')]);}logger[_0x5d6d('0x13')]('ContactItemType,\x20%s,\x20%s',_0x5270a0,_0xbb5875[_0x5d6d('0x13')][_0x5d6d('0x15')]);return _0x25e070(_0xbb5875[_0x5d6d('0x13')]['message']);}else{logger[_0x5d6d('0xe')](_0x5d6d('0x14'),_0x5270a0,_0x5d6d('0xf'));_0x25e070(_0xbb5875['result']['message']);}})['catch'](function(_0x5b7d75){logger[_0x5d6d('0x13')]('ContactItemType,\x20%s,\x20%s',_0x5270a0,_0x5b7d75);_0x5879cc(_0x5b7d75);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index eb1ae27..6fb6295 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 _0xf4da=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','update','delete','destroy'];(function(_0x2260bf,_0x489a4a){var _0x2d0c17=function(_0x1598fe){while(--_0x1598fe){_0x2260bf['push'](_0x2260bf['shift']());}};_0x2d0c17(++_0x489a4a);}(_0xf4da,0xb5));var _0xaf4d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xf4da[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0xaf4d('0x0'));var path=require(_0xaf4d('0x1'));var timeout=require(_0xaf4d('0x2'));var express=require(_0xaf4d('0x3'));var router=express[_0xaf4d('0x4')]();var fs_extra=require(_0xaf4d('0x5'));var auth=require(_0xaf4d('0x6'));var interaction=require(_0xaf4d('0x7'));var config=require(_0xaf4d('0x8'));var controller=require('./contactItemType.controller');router[_0xaf4d('0x9')]('/',auth[_0xaf4d('0xa')](),controller['index']);router[_0xaf4d('0x9')](_0xaf4d('0xb'),auth[_0xaf4d('0xa')](),controller[_0xaf4d('0xc')]);router['post']('/',auth[_0xaf4d('0xa')](),controller[_0xaf4d('0xd')]);router['put']('/:id',auth[_0xaf4d('0xa')](),controller[_0xaf4d('0xe')]);router[_0xaf4d('0xf')]('/:id',auth[_0xaf4d('0xa')](),controller[_0xaf4d('0x10')]);module[_0xaf4d('0x11')]=router; \ No newline at end of file +var _0x867b=['get','post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./contactItemType.controller'];(function(_0x115f64,_0x22532d){var _0x2ad8f6=function(_0x402875){while(--_0x402875){_0x115f64['push'](_0x115f64['shift']());}};_0x2ad8f6(++_0x22532d);}(_0x867b,0x1b3));var _0xb867=function(_0x4da777,_0x2a02f9){_0x4da777=_0x4da777-0x0;var _0x394a82=_0x867b[_0x4da777];return _0x394a82;};'use strict';var multer=require(_0xb867('0x0'));var util=require('util');var path=require(_0xb867('0x1'));var timeout=require(_0xb867('0x2'));var express=require(_0xb867('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb867('0x4'));var interaction=require(_0xb867('0x5'));var config=require('../../config/environment');var controller=require(_0xb867('0x6'));router[_0xb867('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb867('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb867('0x8')]('/',auth[_0xb867('0x9')](),controller[_0xb867('0xa')]);router[_0xb867('0xb')](_0xb867('0xc'),auth[_0xb867('0x9')](),controller[_0xb867('0xd')]);router[_0xb867('0xe')](_0xb867('0xc'),auth[_0xb867('0x9')](),controller[_0xb867('0xf')]);module[_0xb867('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 41c5d3d..f358548 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 _0xd8b0=['exports','sequelize'];(function(_0x243a9b,_0x1b1eb9){var _0x49be6f=function(_0x202efe){while(--_0x202efe){_0x243a9b['push'](_0x243a9b['shift']());}};_0x49be6f(++_0x1b1eb9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x53ac65,_0x51cfb3){var _0x4c5122=function(_0x590bc4){while(--_0x590bc4){_0x53ac65['push'](_0x53ac65['shift']());}};_0x4c5122(++_0x51cfb3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 98b1052..4e2f9e7 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 _0x4cc6=['limit','count','reject','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','findAll','rows','catch','show','params','attributes','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrFaxAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','offset','undefined'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4cc6,0x1f0));var _0x64cc=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x4cc6[_0x49fcfb];return _0x964926;};'use strict';var emlformat=require(_0x64cc('0x0'));var rimraf=require(_0x64cc('0x1'));var zipdir=require(_0x64cc('0x2'));var jsonpatch=require(_0x64cc('0x3'));var rp=require(_0x64cc('0x4'));var moment=require(_0x64cc('0x5'));var BPromise=require(_0x64cc('0x6'));var Mustache=require(_0x64cc('0x7'));var util=require(_0x64cc('0x8'));var path=require(_0x64cc('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x64cc('0xa'));var fs=require('fs');var fs_extra=require(_0x64cc('0xb'));var _=require(_0x64cc('0xc'));var squel=require('squel');var crypto=require(_0x64cc('0xd'));var jsforce=require(_0x64cc('0xe'));var deskjs=require(_0x64cc('0xf'));var toCsv=require(_0x64cc('0x10'));var querystring=require(_0x64cc('0x11'));var Papa=require(_0x64cc('0x12'));var Redis=require(_0x64cc('0x13'));var authService=require(_0x64cc('0x14'));var qs=require(_0x64cc('0x15'));var as=require(_0x64cc('0x16'));var hardwareService=require(_0x64cc('0x17'));var logger=require(_0x64cc('0x18'))(_0x64cc('0x19'));var utils=require(_0x64cc('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x64cc('0x1b'))['db'];config[_0x64cc('0x1c')]=_[_0x64cc('0x1d')](config['redis'],{'host':_0x64cc('0x1e'),'port':0x18eb});var socket=require(_0x64cc('0x1f'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x12497d,_0x6e719d){_0x6e719d=_0x6e719d||0xcc;return function(_0x56c880){if(_0x56c880){return _0x12497d['sendStatus'](_0x6e719d);}return _0x12497d['status'](_0x6e719d)[_0x64cc('0x20')]();};}function respondWithResult(_0x184c7f,_0x266e51){_0x266e51=_0x266e51||0xc8;return function(_0x4148f4){if(_0x4148f4){return _0x184c7f[_0x64cc('0x21')](_0x266e51)['json'](_0x4148f4);}};}function respondWithFilteredResult(_0x4eaa9a,_0x2a8fec){return function(_0x224b60){if(_0x224b60){var _0x59988a=typeof _0x2a8fec[_0x64cc('0x22')]===_0x64cc('0x23')&&typeof _0x2a8fec[_0x64cc('0x24')]===_0x64cc('0x23');var _0x282a71=_0x224b60[_0x64cc('0x25')];var _0x41c855=_0x59988a?0x0:_0x2a8fec['offset'];var _0xf01870=_0x59988a?_0x224b60[_0x64cc('0x25')]:_0x2a8fec[_0x64cc('0x22')]+_0x2a8fec[_0x64cc('0x24')];var _0x2618d5;if(_0xf01870>=_0x282a71){_0xf01870=_0x282a71;_0x2618d5=0xc8;}else{_0x2618d5=0xce;}_0x4eaa9a['status'](_0x2618d5);return _0x4eaa9a['set']('Content-Range',_0x41c855+'-'+_0xf01870+'/'+_0x282a71)['json'](_0x224b60);}return null;};}function patchUpdates(_0x572d18){return function(_0x2e6af8){try{jsonpatch['apply'](_0x2e6af8,_0x572d18,!![]);}catch(_0x3d2e9a){return BPromise[_0x64cc('0x26')](_0x3d2e9a);}return _0x2e6af8[_0x64cc('0x27')]();};}function saveUpdates(_0x1bdd76,_0x3c1b74){return function(_0xb620fd){if(_0xb620fd){return _0xb620fd[_0x64cc('0x28')](_0x1bdd76)[_0x64cc('0x29')](function(_0x5bd128){return _0x5bd128;});}return null;};}function removeEntity(_0x36e3c9,_0xd7cfef){return function(_0x37c529){if(_0x37c529){return _0x37c529[_0x64cc('0x2a')]()[_0x64cc('0x29')](function(){var _0x523efa=_0x37c529['get']({'plain':!![]});var _0x237b6f='CustomDashboards';return db[_0x64cc('0x2b')][_0x64cc('0x2a')]({'where':{'type':_0x237b6f,'resourceId':_0x523efa['id']}})['then'](function(){return _0x37c529;});})['then'](function(){_0x36e3c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38c70b,_0x46b47a){return function(_0x1f1369){if(!_0x1f1369){_0x38c70b[_0x64cc('0x2c')](0x194);}return _0x1f1369;};}function handleError(_0xaf6667,_0x53718a){_0x53718a=_0x53718a||0x1f4;return function(_0x48eaba){logger[_0x64cc('0x2d')](_0x48eaba[_0x64cc('0x2e')]);if(_0x48eaba[_0x64cc('0x2f')]){delete _0x48eaba['name'];}_0xaf6667['status'](_0x53718a)[_0x64cc('0x30')](_0x48eaba);};}exports[_0x64cc('0x31')]=function(_0x3f4981,_0x5561e2){var _0x2eb290={},_0xd03337={},_0xf40dc5={'count':0x0,'rows':[]};var _0x427eb8=_[_0x64cc('0x32')](db['Dashboard'][_0x64cc('0x33')],function(_0x43b804){return{'name':_0x43b804['fieldName'],'type':_0x43b804[_0x64cc('0x34')][_0x64cc('0x35')]};});_0xd03337[_0x64cc('0x36')]=_[_0x64cc('0x32')](_0x427eb8,_0x64cc('0x2f'));_0xd03337[_0x64cc('0x37')]=_[_0x64cc('0x38')](_0x3f4981[_0x64cc('0x37')]);_0xd03337[_0x64cc('0x39')]=_['intersection'](_0xd03337[_0x64cc('0x36')],_0xd03337[_0x64cc('0x37')]);_0x2eb290['attributes']=_[_0x64cc('0x3a')](_0xd03337[_0x64cc('0x36')],qs[_0x64cc('0x3b')](_0x3f4981[_0x64cc('0x37')]['fields']));_0x2eb290['attributes']=_0x2eb290['attributes'][_0x64cc('0x3c')]?_0x2eb290['attributes']:_0xd03337['model'];if(!_0x3f4981[_0x64cc('0x37')][_0x64cc('0x3d')](_0x64cc('0x3e'))){_0x2eb290[_0x64cc('0x24')]=qs[_0x64cc('0x24')](_0x3f4981[_0x64cc('0x37')]['limit']);_0x2eb290[_0x64cc('0x22')]=qs[_0x64cc('0x22')](_0x3f4981[_0x64cc('0x37')][_0x64cc('0x22')]);}_0x2eb290[_0x64cc('0x3f')]=qs[_0x64cc('0x40')](_0x3f4981[_0x64cc('0x37')][_0x64cc('0x40')]);_0x2eb290[_0x64cc('0x41')]=qs[_0x64cc('0x39')](_[_0x64cc('0x42')](_0x3f4981[_0x64cc('0x37')],_0xd03337[_0x64cc('0x39')]),_0x427eb8);if(_0x3f4981[_0x64cc('0x37')][_0x64cc('0x43')]){_0x2eb290['where']=_[_0x64cc('0x44')](_0x2eb290['where'],{'$or':_[_0x64cc('0x32')](_0x427eb8,function(_0x3a6592){if(_0x3a6592[_0x64cc('0x34')]!==_0x64cc('0x45')){var _0x3a0ca9={};_0x3a0ca9[_0x3a6592[_0x64cc('0x2f')]]={'$like':'%'+_0x3f4981[_0x64cc('0x37')][_0x64cc('0x43')]+'%'};return _0x3a0ca9;}})});}_0x2eb290=_[_0x64cc('0x44')]({},_0x2eb290,_0x3f4981[_0x64cc('0x46')]);var _0x5d2e70={'where':_0x2eb290['where']};return db[_0x64cc('0x47')][_0x64cc('0x25')](_0x5d2e70)[_0x64cc('0x29')](function(_0x2b135a){_0xf40dc5[_0x64cc('0x25')]=_0x2b135a;if(_0x3f4981[_0x64cc('0x37')]['includeAll']){_0x2eb290['include']=[{'all':!![]}];}return db[_0x64cc('0x47')][_0x64cc('0x48')](_0x2eb290);})['then'](function(_0x138c4a){_0xf40dc5[_0x64cc('0x49')]=_0x138c4a;return _0xf40dc5;})['then'](respondWithFilteredResult(_0x5561e2,_0x2eb290))[_0x64cc('0x4a')](handleError(_0x5561e2,null));};exports[_0x64cc('0x4b')]=function(_0x21296c,_0x379d58){var _0x1221d1={'raw':![],'where':{'id':_0x21296c[_0x64cc('0x4c')]['id']}},_0x5a779d={};_0x5a779d[_0x64cc('0x36')]=_[_0x64cc('0x38')](db[_0x64cc('0x47')]['rawAttributes']);_0x5a779d[_0x64cc('0x37')]=_[_0x64cc('0x38')](_0x21296c[_0x64cc('0x37')]);_0x5a779d[_0x64cc('0x39')]=_[_0x64cc('0x3a')](_0x5a779d[_0x64cc('0x36')],_0x5a779d[_0x64cc('0x37')]);_0x1221d1[_0x64cc('0x4d')]=_['intersection'](_0x5a779d['model'],qs[_0x64cc('0x3b')](_0x21296c[_0x64cc('0x37')]['fields']));_0x1221d1[_0x64cc('0x4d')]=_0x1221d1[_0x64cc('0x4d')][_0x64cc('0x3c')]?_0x1221d1[_0x64cc('0x4d')]:_0x5a779d['model'];if(_0x21296c[_0x64cc('0x37')]['includeAll']){_0x1221d1[_0x64cc('0x4e')]=[{'all':!![]}];}_0x1221d1=_['merge']({},_0x1221d1,_0x21296c[_0x64cc('0x46')]);return db[_0x64cc('0x47')]['find'](_0x1221d1)[_0x64cc('0x29')](handleEntityNotFound(_0x379d58,null))[_0x64cc('0x29')](respondWithResult(_0x379d58,null))[_0x64cc('0x4a')](handleError(_0x379d58,null));};exports[_0x64cc('0x4f')]=function(_0x5c92ea,_0x32cb5c){return db[_0x64cc('0x47')][_0x64cc('0x4f')](_0x5c92ea[_0x64cc('0x50')],{})[_0x64cc('0x29')](function(_0xbbc222){var _0x448c11=_0x5c92ea['user'][_0x64cc('0x51')]({'plain':!![]});if(!_0x448c11)throw new Error(_0x64cc('0x52'));if(_0x448c11[_0x64cc('0x53')]===_0x64cc('0x54')){var _0x4d1ee9=_0xbbc222[_0x64cc('0x51')]({'plain':!![]});var _0x1c8508=_0x64cc('0x55');return db[_0x64cc('0x56')][_0x64cc('0x57')]({'where':{'name':_0x1c8508,'userProfileId':_0x448c11['userProfileId']},'raw':!![]})[_0x64cc('0x29')](function(_0x53fdb3){if(_0x53fdb3&&_0x53fdb3[_0x64cc('0x58')]===0x0){return db[_0x64cc('0x2b')][_0x64cc('0x4f')]({'name':_0x4d1ee9[_0x64cc('0x2f')],'resourceId':_0x4d1ee9['id'],'type':_0x53fdb3['name'],'sectionId':_0x53fdb3['id']},{})[_0x64cc('0x29')](function(){return _0xbbc222;});}else{return _0xbbc222;}})[_0x64cc('0x4a')](function(_0x4c5a5e){logger['error'](_0x64cc('0x59'),_0x4c5a5e);throw _0x4c5a5e;});}return _0xbbc222;})['then'](respondWithResult(_0x32cb5c,0xc9))[_0x64cc('0x4a')](handleError(_0x32cb5c,null));};exports[_0x64cc('0x5a')]=function(_0x1cb787,_0x285786){var _0x441df5={'where':{'id':_0x1cb787[_0x64cc('0x4c')]['id']}},_0x113567={};_0x113567[_0x64cc('0x36')]=_['keys'](db[_0x64cc('0x47')][_0x64cc('0x33')]);_0x441df5[_0x64cc('0x4d')]=_[_0x64cc('0x3a')](_0x113567[_0x64cc('0x36')],qs[_0x64cc('0x3b')](_0x1cb787['query'][_0x64cc('0x3b')]));_0x441df5[_0x64cc('0x4d')]=_0x441df5[_0x64cc('0x4d')][_0x64cc('0x3c')]?_0x441df5['attributes']:_0x113567[_0x64cc('0x36')];if(_0x1cb787[_0x64cc('0x37')][_0x64cc('0x5b')]){_0x441df5['include']=[{'all':!![]}];}_0x441df5=_[_0x64cc('0x44')]({},_0x441df5,_0x1cb787['options']);return db[_0x64cc('0x47')][_0x64cc('0x57')](_0x441df5)['then'](handleEntityNotFound(_0x285786,null))['then'](function(_0x6243b9){if(_0x6243b9){var _0x5cdaee=_0x6243b9[_0x64cc('0x51')]({'plain':!![]});_0x5cdaee=qs[_0x64cc('0x5c')](_0x5cdaee,['id',_0x64cc('0x5d'),_0x64cc('0x5e')]);_0x1cb787[_0x64cc('0x50')]=_[_0x64cc('0x5c')](_0x1cb787['body'],['id',_0x64cc('0x5d'),'updatedAt']);return db[_0x64cc('0x47')][_0x64cc('0x4f')](_[_0x64cc('0x44')](_0x5cdaee,_0x1cb787[_0x64cc('0x50')]),{'include':_0x1cb787[_0x64cc('0x37')]['includeAll']?[{'all':!![]}]:undefined})[_0x64cc('0x29')](function(_0x41d77b){var _0x43d300=_0x1cb787['user']['get']({'plain':!![]});if(!_0x43d300)throw new Error(_0x64cc('0x52'));if(_0x43d300[_0x64cc('0x53')]==='user'){var _0x28cdb0=_0x41d77b[_0x64cc('0x51')]({'plain':!![]});var _0x5340d8=_0x64cc('0x55');return db[_0x64cc('0x56')][_0x64cc('0x57')]({'where':{'name':_0x5340d8,'userProfileId':_0x43d300[_0x64cc('0x5f')]},'raw':!![]})[_0x64cc('0x29')](function(_0x1017b1){if(_0x1017b1&&_0x1017b1['autoAssociation']===0x0){return db[_0x64cc('0x2b')][_0x64cc('0x4f')]({'name':_0x28cdb0[_0x64cc('0x2f')],'resourceId':_0x28cdb0['id'],'type':_0x1017b1[_0x64cc('0x2f')],'sectionId':_0x1017b1['id']},{})[_0x64cc('0x29')](function(){return _0x41d77b;});}else{return _0x41d77b;}})[_0x64cc('0x4a')](function(_0x4aff62){logger[_0x64cc('0x2d')](_0x64cc('0x59'),_0x4aff62);throw _0x4aff62;});}return _0x41d77b;});}})['then'](respondWithResult(_0x285786,0xc9))[_0x64cc('0x4a')](handleError(_0x285786,null));};exports['update']=function(_0x2f7844,_0x451db9){if(_0x2f7844[_0x64cc('0x50')]['id']){delete _0x2f7844[_0x64cc('0x50')]['id'];}return db[_0x64cc('0x47')][_0x64cc('0x57')]({'where':{'id':_0x2f7844[_0x64cc('0x4c')]['id']}})[_0x64cc('0x29')](handleEntityNotFound(_0x451db9,null))['then'](saveUpdates(_0x2f7844[_0x64cc('0x50')],null))[_0x64cc('0x29')](respondWithResult(_0x451db9,null))[_0x64cc('0x4a')](handleError(_0x451db9,null));};exports[_0x64cc('0x2a')]=function(_0x533e74,_0x465bbf){return db[_0x64cc('0x47')]['find']({'where':{'id':_0x533e74[_0x64cc('0x4c')]['id']}})[_0x64cc('0x29')](handleEntityNotFound(_0x465bbf,null))['then'](removeEntity(_0x465bbf,null))[_0x64cc('0x4a')](handleError(_0x465bbf,null));};function widgetAttributes(_0xb6080b){try{switch(_0xb6080b[_0x64cc('0x34')]){case _0x64cc('0x60'):return[{'name':_0x64cc('0x61'),'value':_0xb6080b[_0x64cc('0x61')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x0]?_0xb6080b[_0x64cc('0x62')][0x0]['value']:undefined)||'https://'}];case _0x64cc('0x63'):return[{'name':_0x64cc('0x64'),'value':_0xb6080b[_0x64cc('0x64')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x0]?_0xb6080b[_0x64cc('0x62')][0x0]['value']:undefined)||''}];case _0x64cc('0x65'):return[{'name':_0x64cc('0x66'),'value':_0xb6080b['attrHourFormat']||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x0]?_0xb6080b[_0x64cc('0x62')][0x0][_0x64cc('0x67')]:undefined)||_0x64cc('0x68')},{'name':_0x64cc('0x69'),'value':_0xb6080b[_0x64cc('0x69')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x1]?_0xb6080b['attrs'][0x1][_0x64cc('0x67')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0xb6080b[_0x64cc('0x6a')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x2]?_0xb6080b[_0x64cc('0x62')][0x2]['value']:undefined)||0xc}];case _0x64cc('0x6b'):return[{'name':_0x64cc('0x6c'),'value':_0xb6080b[_0x64cc('0x6c')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x0]?_0xb6080b[_0x64cc('0x62')][0x0][_0x64cc('0x67')]:undefined)||'total'},{'name':_0x64cc('0x6d'),'value':_0xb6080b['attrVoiceQueues']||(_0xb6080b['attrs']&&_0xb6080b[_0x64cc('0x62')][0x1]?_0xb6080b['attrs'][0x1][_0x64cc('0x67')]:undefined)||[]},{'name':_0x64cc('0x6a'),'value':_0xb6080b[_0x64cc('0x6a')]||(_0xb6080b['attrs']&&_0xb6080b[_0x64cc('0x62')][0x2]?_0xb6080b['attrs'][0x2][_0x64cc('0x67')]:undefined)||0x14},{'name':_0x64cc('0x6e'),'value':_0xb6080b[_0x64cc('0x6e')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x3]?_0xb6080b[_0x64cc('0x62')][0x3][_0x64cc('0x67')]:undefined)||_0x64cc('0x6f')},{'name':'attrEmailAccounts','value':_0xb6080b[_0x64cc('0x70')]||(_0xb6080b['attrs']&&_0xb6080b[_0x64cc('0x62')][0x4]?_0xb6080b['attrs'][0x4][_0x64cc('0x67')]:undefined)||''},{'name':'attrFaxAccounts','value':_0xb6080b['attrFaxAccounts']||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x5]?_0xb6080b[_0x64cc('0x62')][0x5][_0x64cc('0x67')]:undefined)||''},{'name':_0x64cc('0x71'),'value':_0xb6080b[_0x64cc('0x71')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x6]?_0xb6080b[_0x64cc('0x62')][0x6][_0x64cc('0x67')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xb6080b[_0x64cc('0x72')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x7]?_0xb6080b[_0x64cc('0x62')][0x7][_0x64cc('0x67')]:undefined)||''},{'name':_0x64cc('0x73'),'value':_0xb6080b[_0x64cc('0x73')]||(_0xb6080b['attrs']&&_0xb6080b['attrs'][0x8]?_0xb6080b[_0x64cc('0x62')][0x8]['value']:undefined)||''},{'name':_0x64cc('0x74'),'value':_0xb6080b[_0x64cc('0x74')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x9]?_0xb6080b[_0x64cc('0x62')][0x9]['value']:undefined)||''}];case _0x64cc('0x75'):case _0x64cc('0x76'):return[{'name':_0x64cc('0x77'),'value':_0xb6080b[_0x64cc('0x77')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b['attrs'][0x0]?_0xb6080b[_0x64cc('0x62')][0x0][_0x64cc('0x67')]:undefined)||_0x64cc('0x78')},{'name':_0x64cc('0x79'),'value':_0xb6080b[_0x64cc('0x79')]||(_0xb6080b['attrs']&&_0xb6080b[_0x64cc('0x62')][0x1]?_0xb6080b[_0x64cc('0x62')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0xb6080b[_0x64cc('0x7a')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b['attrs'][0x2]?_0xb6080b['attrs'][0x2]['value']:undefined)||null},{'name':_0x64cc('0x6d'),'value':_0xb6080b[_0x64cc('0x6d')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x3]?_0xb6080b[_0x64cc('0x62')][0x3][_0x64cc('0x67')]:undefined)||[]},{'name':_0x64cc('0x6e'),'value':_0xb6080b['attrChannel']||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x4]?_0xb6080b[_0x64cc('0x62')][0x4][_0x64cc('0x67')]:undefined)||'voice'},{'name':_0x64cc('0x70'),'value':_0xb6080b[_0x64cc('0x70')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x5]?_0xb6080b['attrs'][0x5][_0x64cc('0x67')]:undefined)||''},{'name':_0x64cc('0x7b'),'value':_0xb6080b[_0x64cc('0x7b')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x6]?_0xb6080b[_0x64cc('0x62')][0x6][_0x64cc('0x67')]:undefined)||''},{'name':_0x64cc('0x71'),'value':_0xb6080b[_0x64cc('0x71')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b['attrs'][0x7]?_0xb6080b[_0x64cc('0x62')][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0xb6080b[_0x64cc('0x72')]||(_0xb6080b['attrs']&&_0xb6080b['attrs'][0x8]?_0xb6080b[_0x64cc('0x62')][0x8][_0x64cc('0x67')]:undefined)||''},{'name':_0x64cc('0x73'),'value':_0xb6080b[_0x64cc('0x73')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x9]?_0xb6080b['attrs'][0x9]['value']:undefined)||''},{'name':_0x64cc('0x74'),'value':_0xb6080b['attrChatWebsites']||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0xa]?_0xb6080b[_0x64cc('0x62')][0xa][_0x64cc('0x67')]:undefined)||''}];case _0x64cc('0x7c'):return[{'name':_0x64cc('0x7d'),'type':_0xb6080b['reportType']||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b['attrs'][0x0]?_0xb6080b[_0x64cc('0x62')][0x0][_0x64cc('0x34')]:undefined)||null,'value':_0xb6080b[_0x64cc('0x7d')]||(_0xb6080b[_0x64cc('0x62')]&&_0xb6080b[_0x64cc('0x62')][0x0]?_0xb6080b[_0x64cc('0x62')][0x0][_0x64cc('0x67')]:undefined)||null},{'name':_0x64cc('0x7e'),'value':_0xb6080b[_0x64cc('0x7e')]||(_0xb6080b['attrs']&&_0xb6080b[_0x64cc('0x62')][0x1]?_0xb6080b[_0x64cc('0x62')][0x1][_0x64cc('0x67')]:undefined)||0x0}];default:return[];}}catch(_0x38d6f3){logger[_0x64cc('0x2d')](_0x64cc('0x7f'),JSON[_0x64cc('0x80')](_0x38d6f3));return[];}}exports[_0x64cc('0x81')]=function(_0x116694,_0x505ada,_0x6a1b26){if(_0x116694[_0x64cc('0x50')]['id']){delete _0x116694[_0x64cc('0x50')]['id'];}return db[_0x64cc('0x47')][_0x64cc('0x57')]({'where':{'id':_0x116694[_0x64cc('0x4c')]['id']}})[_0x64cc('0x29')](handleEntityNotFound(_0x505ada,null))[_0x64cc('0x29')](function(_0x4d153c){if(_0x4d153c){_0x116694[_0x64cc('0x50')]['DashboardId']=_0x4d153c['id'];_0x116694[_0x64cc('0x50')]['attrs']=widgetAttributes(_0x116694[_0x64cc('0x50')]);return db[_0x64cc('0x82')][_0x64cc('0x4f')](_0x116694[_0x64cc('0x50')]);}})[_0x64cc('0x29')](respondWithResult(_0x505ada,null))[_0x64cc('0x4a')](handleError(_0x505ada,null));};exports[_0x64cc('0x83')]=function(_0x199c70,_0x7aef66,_0x5b1a26){var _0x50409b={};var _0x185c40={};var _0x420e2c;var _0x5c8072;return db[_0x64cc('0x47')][_0x64cc('0x84')]({'where':{'id':_0x199c70[_0x64cc('0x4c')]['id']}})[_0x64cc('0x29')](handleEntityNotFound(_0x7aef66,null))[_0x64cc('0x29')](function(_0x3d0211){if(_0x3d0211){_0x420e2c=_0x3d0211;_0x185c40[_0x64cc('0x36')]=_['keys'](db[_0x64cc('0x82')][_0x64cc('0x33')]);_0x185c40[_0x64cc('0x37')]=_['keys'](_0x199c70[_0x64cc('0x37')]);_0x185c40[_0x64cc('0x39')]=_['intersection'](_0x185c40['model'],_0x185c40[_0x64cc('0x37')]);_0x50409b[_0x64cc('0x4d')]=_[_0x64cc('0x3a')](_0x185c40[_0x64cc('0x36')],qs[_0x64cc('0x3b')](_0x199c70['query']['fields']));_0x50409b[_0x64cc('0x4d')]=_0x50409b[_0x64cc('0x4d')][_0x64cc('0x3c')]?_0x50409b[_0x64cc('0x4d')]:_0x185c40[_0x64cc('0x36')];_0x50409b[_0x64cc('0x3f')]=qs[_0x64cc('0x40')](_0x199c70[_0x64cc('0x37')][_0x64cc('0x40')]);_0x50409b[_0x64cc('0x41')]=qs['filters'](_['pick'](_0x199c70[_0x64cc('0x37')],_0x185c40[_0x64cc('0x39')]));if(_0x199c70[_0x64cc('0x37')]['filter']){_0x50409b['where']=_[_0x64cc('0x44')](_0x50409b['where'],{'$or':_[_0x64cc('0x32')](_0x50409b[_0x64cc('0x4d')],function(_0xa14040){var _0x375532={};_0x375532[_0xa14040]={'$like':'%'+_0x199c70['query'][_0x64cc('0x43')]+'%'};return _0x375532;})});}_0x50409b=_[_0x64cc('0x44')]({},_0x50409b,_0x199c70[_0x64cc('0x46')]);return _0x420e2c[_0x64cc('0x83')](_0x50409b);}})[_0x64cc('0x29')](function(_0x52453f){if(_0x52453f){_0x5c8072=_0x52453f[_0x64cc('0x3c')];if(!_0x199c70[_0x64cc('0x37')]['hasOwnProperty'](_0x64cc('0x3e'))){_0x50409b[_0x64cc('0x24')]=qs[_0x64cc('0x24')](_0x199c70['query'][_0x64cc('0x24')]);_0x50409b[_0x64cc('0x22')]=qs[_0x64cc('0x22')](_0x199c70[_0x64cc('0x37')][_0x64cc('0x22')]);}return _0x420e2c[_0x64cc('0x83')](_0x50409b);}})['then'](function(_0x475f9f){if(_0x475f9f){return _0x475f9f?{'count':_0x5c8072,'rows':_0x475f9f}:null;}})[_0x64cc('0x29')](respondWithResult(_0x7aef66,null))['catch'](handleError(_0x7aef66,null));}; \ No newline at end of file +var _0x6036=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','options','includeAll','findAll','catch','params','rawAttributes','include','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','https://','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','voice','attrWhatsappAccounts','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','order','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x36021c,_0x5eeb8e){var _0x1c6ab4=function(_0x427f63){while(--_0x427f63){_0x36021c['push'](_0x36021c['shift']());}};_0x1c6ab4(++_0x5eeb8e);}(_0x6036,0x6f));var _0x6603=function(_0x62e54b,_0x35d2db){_0x62e54b=_0x62e54b-0x0;var _0x431f2e=_0x6036[_0x62e54b];return _0x431f2e;};'use strict';var emlformat=require(_0x6603('0x0'));var rimraf=require(_0x6603('0x1'));var zipdir=require(_0x6603('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6603('0x3'));var moment=require(_0x6603('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6603('0x5'));var util=require('util');var path=require(_0x6603('0x6'));var sox=require(_0x6603('0x7'));var csv=require(_0x6603('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6603('0x9'));var squel=require(_0x6603('0xa'));var crypto=require('crypto');var jsforce=require(_0x6603('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6603('0x8'));var querystring=require(_0x6603('0xc'));var Papa=require('papaparse');var Redis=require(_0x6603('0xd'));var authService=require(_0x6603('0xe'));var qs=require(_0x6603('0xf'));var as=require(_0x6603('0x10'));var hardwareService=require(_0x6603('0x11'));var logger=require(_0x6603('0x12'))(_0x6603('0x13'));var utils=require(_0x6603('0x14'));var config=require(_0x6603('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6603('0x16'))['db'];config['redis']=_[_0x6603('0x17')](config[_0x6603('0x18')],{'host':_0x6603('0x19'),'port':0x18eb});var socket=require(_0x6603('0x1a'))(new Redis(config[_0x6603('0x18')]));require(_0x6603('0x1b'))['register'](socket);function respondWithStatusCode(_0x553867,_0x3b66e4){_0x3b66e4=_0x3b66e4||0xcc;return function(_0x12cd88){if(_0x12cd88){return _0x553867[_0x6603('0x1c')](_0x3b66e4);}return _0x553867[_0x6603('0x1d')](_0x3b66e4)[_0x6603('0x1e')]();};}function respondWithResult(_0x3ff9e5,_0x28570d){_0x28570d=_0x28570d||0xc8;return function(_0x389b22){if(_0x389b22){return _0x3ff9e5['status'](_0x28570d)[_0x6603('0x1f')](_0x389b22);}};}function respondWithFilteredResult(_0x6eb60,_0x3ebb1d){return function(_0x8f0e29){if(_0x8f0e29){var _0xbe99c7=typeof _0x3ebb1d[_0x6603('0x20')]===_0x6603('0x21')&&typeof _0x3ebb1d[_0x6603('0x22')]===_0x6603('0x21');var _0x5e443d=_0x8f0e29['count'];var _0x30e3ff=_0xbe99c7?0x0:_0x3ebb1d[_0x6603('0x20')];var _0x1b976d=_0xbe99c7?_0x8f0e29[_0x6603('0x23')]:_0x3ebb1d[_0x6603('0x20')]+_0x3ebb1d['limit'];var _0x1a368c;if(_0x1b976d>=_0x5e443d){_0x1b976d=_0x5e443d;_0x1a368c=0xc8;}else{_0x1a368c=0xce;}_0x6eb60['status'](_0x1a368c);return _0x6eb60[_0x6603('0x24')](_0x6603('0x25'),_0x30e3ff+'-'+_0x1b976d+'/'+_0x5e443d)[_0x6603('0x1f')](_0x8f0e29);}return null;};}function patchUpdates(_0x1e73a6){return function(_0x14eea7){try{jsonpatch[_0x6603('0x26')](_0x14eea7,_0x1e73a6,!![]);}catch(_0xc70528){return BPromise[_0x6603('0x27')](_0xc70528);}return _0x14eea7['save']();};}function saveUpdates(_0x53e4f7,_0x488350){return function(_0x549749){if(_0x549749){return _0x549749[_0x6603('0x28')](_0x53e4f7)[_0x6603('0x29')](function(_0x1e074b){return _0x1e074b;});}return null;};}function removeEntity(_0x4d7ff9,_0x3d9685){return function(_0x565baf){if(_0x565baf){return _0x565baf[_0x6603('0x2a')]()['then'](function(){var _0x5c1b8d=_0x565baf[_0x6603('0x2b')]({'plain':!![]});var _0x5b800c=_0x6603('0x2c');return db[_0x6603('0x2d')]['destroy']({'where':{'type':_0x5b800c,'resourceId':_0x5c1b8d['id']}})[_0x6603('0x29')](function(){return _0x565baf;});})[_0x6603('0x29')](function(){_0x4d7ff9['status'](0xcc)[_0x6603('0x1e')]();});}};}function handleEntityNotFound(_0x693a7,_0x1c6fc6){return function(_0x50bba3){if(!_0x50bba3){_0x693a7[_0x6603('0x1c')](0x194);}return _0x50bba3;};}function handleError(_0x2aae65,_0x11870e){_0x11870e=_0x11870e||0x1f4;return function(_0xda420f){logger[_0x6603('0x2e')](_0xda420f[_0x6603('0x2f')]);if(_0xda420f[_0x6603('0x30')]){delete _0xda420f['name'];}_0x2aae65[_0x6603('0x1d')](_0x11870e)[_0x6603('0x31')](_0xda420f);};}exports[_0x6603('0x32')]=function(_0x473bb3,_0x1d7f1e){var _0x488aa5={},_0x54f9a2={},_0x52aebf={'count':0x0,'rows':[]};var _0x770b99=_[_0x6603('0x33')](db[_0x6603('0x34')]['rawAttributes'],function(_0x4d6f44){return{'name':_0x4d6f44[_0x6603('0x35')],'type':_0x4d6f44['type'][_0x6603('0x36')]};});_0x54f9a2[_0x6603('0x37')]=_[_0x6603('0x33')](_0x770b99,_0x6603('0x30'));_0x54f9a2['query']=_[_0x6603('0x38')](_0x473bb3['query']);_0x54f9a2[_0x6603('0x39')]=_[_0x6603('0x3a')](_0x54f9a2[_0x6603('0x37')],_0x54f9a2[_0x6603('0x3b')]);_0x488aa5['attributes']=_[_0x6603('0x3a')](_0x54f9a2['model'],qs[_0x6603('0x3c')](_0x473bb3[_0x6603('0x3b')]['fields']));_0x488aa5['attributes']=_0x488aa5[_0x6603('0x3d')][_0x6603('0x3e')]?_0x488aa5[_0x6603('0x3d')]:_0x54f9a2[_0x6603('0x37')];if(!_0x473bb3[_0x6603('0x3b')][_0x6603('0x3f')](_0x6603('0x40'))){_0x488aa5[_0x6603('0x22')]=qs['limit'](_0x473bb3[_0x6603('0x3b')][_0x6603('0x22')]);_0x488aa5[_0x6603('0x20')]=qs[_0x6603('0x20')](_0x473bb3[_0x6603('0x3b')][_0x6603('0x20')]);}_0x488aa5['order']=qs['sort'](_0x473bb3[_0x6603('0x3b')][_0x6603('0x41')]);_0x488aa5['where']=qs[_0x6603('0x39')](_[_0x6603('0x42')](_0x473bb3[_0x6603('0x3b')],_0x54f9a2[_0x6603('0x39')]),_0x770b99);if(_0x473bb3[_0x6603('0x3b')][_0x6603('0x43')]){_0x488aa5[_0x6603('0x44')]=_['merge'](_0x488aa5[_0x6603('0x44')],{'$or':_[_0x6603('0x33')](_0x770b99,function(_0x285f1d){if(_0x285f1d[_0x6603('0x45')]!==_0x6603('0x46')){var _0x330db9={};_0x330db9[_0x285f1d['name']]={'$like':'%'+_0x473bb3[_0x6603('0x3b')][_0x6603('0x43')]+'%'};return _0x330db9;}})});}_0x488aa5=_['merge']({},_0x488aa5,_0x473bb3[_0x6603('0x47')]);var _0x55a320={'where':_0x488aa5[_0x6603('0x44')]};return db[_0x6603('0x34')]['count'](_0x55a320)['then'](function(_0x4abf88){_0x52aebf[_0x6603('0x23')]=_0x4abf88;if(_0x473bb3[_0x6603('0x3b')][_0x6603('0x48')]){_0x488aa5['include']=[{'all':!![]}];}return db[_0x6603('0x34')][_0x6603('0x49')](_0x488aa5);})[_0x6603('0x29')](function(_0x4c5e19){_0x52aebf['rows']=_0x4c5e19;return _0x52aebf;})[_0x6603('0x29')](respondWithFilteredResult(_0x1d7f1e,_0x488aa5))[_0x6603('0x4a')](handleError(_0x1d7f1e,null));};exports['show']=function(_0x3cc75e,_0x490706){var _0x5efc4f={'raw':![],'where':{'id':_0x3cc75e[_0x6603('0x4b')]['id']}},_0x9db5b={};_0x9db5b['model']=_[_0x6603('0x38')](db['Dashboard'][_0x6603('0x4c')]);_0x9db5b[_0x6603('0x3b')]=_[_0x6603('0x38')](_0x3cc75e['query']);_0x9db5b['filters']=_[_0x6603('0x3a')](_0x9db5b[_0x6603('0x37')],_0x9db5b[_0x6603('0x3b')]);_0x5efc4f['attributes']=_['intersection'](_0x9db5b[_0x6603('0x37')],qs[_0x6603('0x3c')](_0x3cc75e['query'][_0x6603('0x3c')]));_0x5efc4f['attributes']=_0x5efc4f[_0x6603('0x3d')][_0x6603('0x3e')]?_0x5efc4f['attributes']:_0x9db5b[_0x6603('0x37')];if(_0x3cc75e['query'][_0x6603('0x48')]){_0x5efc4f[_0x6603('0x4d')]=[{'all':!![]}];}_0x5efc4f=_[_0x6603('0x4e')]({},_0x5efc4f,_0x3cc75e['options']);return db['Dashboard'][_0x6603('0x4f')](_0x5efc4f)[_0x6603('0x29')](handleEntityNotFound(_0x490706,null))[_0x6603('0x29')](respondWithResult(_0x490706,null))[_0x6603('0x4a')](handleError(_0x490706,null));};exports[_0x6603('0x50')]=function(_0x305cb7,_0x18a731){return db['Dashboard'][_0x6603('0x50')](_0x305cb7[_0x6603('0x51')],{})['then'](function(_0x51d499){var _0xd1ca80=_0x305cb7[_0x6603('0x52')][_0x6603('0x2b')]({'plain':!![]});if(!_0xd1ca80)throw new Error(_0x6603('0x53'));if(_0xd1ca80[_0x6603('0x54')]===_0x6603('0x52')){var _0x29fa38=_0x51d499[_0x6603('0x2b')]({'plain':!![]});var _0xc5aa91=_0x6603('0x2c');return db[_0x6603('0x55')][_0x6603('0x4f')]({'where':{'name':_0xc5aa91,'userProfileId':_0xd1ca80[_0x6603('0x56')]},'raw':!![]})[_0x6603('0x29')](function(_0x353178){if(_0x353178&&_0x353178[_0x6603('0x57')]===0x0){return db[_0x6603('0x2d')][_0x6603('0x50')]({'name':_0x29fa38[_0x6603('0x30')],'resourceId':_0x29fa38['id'],'type':_0x353178['name'],'sectionId':_0x353178['id']},{})[_0x6603('0x29')](function(){return _0x51d499;});}else{return _0x51d499;}})['catch'](function(_0x5664b4){logger[_0x6603('0x2e')](_0x6603('0x58'),_0x5664b4);throw _0x5664b4;});}return _0x51d499;})[_0x6603('0x29')](respondWithResult(_0x18a731,0xc9))[_0x6603('0x4a')](handleError(_0x18a731,null));};exports[_0x6603('0x59')]=function(_0x3ac8c1,_0x2f479b){var _0x1d1c4a={'where':{'id':_0x3ac8c1[_0x6603('0x4b')]['id']}},_0x2abb6a={};_0x2abb6a[_0x6603('0x37')]=_[_0x6603('0x38')](db[_0x6603('0x34')][_0x6603('0x4c')]);_0x1d1c4a[_0x6603('0x3d')]=_[_0x6603('0x3a')](_0x2abb6a[_0x6603('0x37')],qs['fields'](_0x3ac8c1[_0x6603('0x3b')][_0x6603('0x3c')]));_0x1d1c4a['attributes']=_0x1d1c4a[_0x6603('0x3d')][_0x6603('0x3e')]?_0x1d1c4a[_0x6603('0x3d')]:_0x2abb6a['model'];if(_0x3ac8c1[_0x6603('0x3b')][_0x6603('0x48')]){_0x1d1c4a[_0x6603('0x4d')]=[{'all':!![]}];}_0x1d1c4a=_[_0x6603('0x4e')]({},_0x1d1c4a,_0x3ac8c1[_0x6603('0x47')]);return db[_0x6603('0x34')]['find'](_0x1d1c4a)[_0x6603('0x29')](handleEntityNotFound(_0x2f479b,null))[_0x6603('0x29')](function(_0x460f3d){if(_0x460f3d){var _0x4be74f=_0x460f3d[_0x6603('0x2b')]({'plain':!![]});_0x4be74f=qs[_0x6603('0x5a')](_0x4be74f,['id',_0x6603('0x5b'),_0x6603('0x5c')]);_0x3ac8c1[_0x6603('0x51')]=_['omit'](_0x3ac8c1['body'],['id',_0x6603('0x5b'),_0x6603('0x5c')]);return db[_0x6603('0x34')]['create'](_[_0x6603('0x4e')](_0x4be74f,_0x3ac8c1[_0x6603('0x51')]),{'include':_0x3ac8c1[_0x6603('0x3b')][_0x6603('0x48')]?[{'all':!![]}]:undefined})[_0x6603('0x29')](function(_0x4349c7){var _0xd32def=_0x3ac8c1[_0x6603('0x52')][_0x6603('0x2b')]({'plain':!![]});if(!_0xd32def)throw new Error(_0x6603('0x53'));if(_0xd32def['role']===_0x6603('0x52')){var _0x5a54c6=_0x4349c7['get']({'plain':!![]});var _0x466e09='CustomDashboards';return db[_0x6603('0x55')]['find']({'where':{'name':_0x466e09,'userProfileId':_0xd32def[_0x6603('0x56')]},'raw':!![]})[_0x6603('0x29')](function(_0x685618){if(_0x685618&&_0x685618[_0x6603('0x57')]===0x0){return db[_0x6603('0x2d')]['create']({'name':_0x5a54c6[_0x6603('0x30')],'resourceId':_0x5a54c6['id'],'type':_0x685618[_0x6603('0x30')],'sectionId':_0x685618['id']},{})[_0x6603('0x29')](function(){return _0x4349c7;});}else{return _0x4349c7;}})[_0x6603('0x4a')](function(_0x29ec8a){logger[_0x6603('0x2e')](_0x6603('0x58'),_0x29ec8a);throw _0x29ec8a;});}return _0x4349c7;});}})[_0x6603('0x29')](respondWithResult(_0x2f479b,0xc9))['catch'](handleError(_0x2f479b,null));};exports[_0x6603('0x28')]=function(_0xa3ee53,_0x3b98f5){if(_0xa3ee53['body']['id']){delete _0xa3ee53[_0x6603('0x51')]['id'];}return db[_0x6603('0x34')][_0x6603('0x4f')]({'where':{'id':_0xa3ee53['params']['id']}})[_0x6603('0x29')](handleEntityNotFound(_0x3b98f5,null))[_0x6603('0x29')](saveUpdates(_0xa3ee53[_0x6603('0x51')],null))[_0x6603('0x29')](respondWithResult(_0x3b98f5,null))[_0x6603('0x4a')](handleError(_0x3b98f5,null));};exports[_0x6603('0x2a')]=function(_0x28effb,_0x33c2ac){return db['Dashboard'][_0x6603('0x4f')]({'where':{'id':_0x28effb[_0x6603('0x4b')]['id']}})[_0x6603('0x29')](handleEntityNotFound(_0x33c2ac,null))['then'](removeEntity(_0x33c2ac,null))[_0x6603('0x4a')](handleError(_0x33c2ac,null));};function widgetAttributes(_0xbb2182){try{switch(_0xbb2182[_0x6603('0x45')]){case _0x6603('0x5d'):return[{'name':_0x6603('0x5e'),'value':_0xbb2182[_0x6603('0x5e')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x0]?_0xbb2182[_0x6603('0x5f')][0x0]['value']:undefined)||_0x6603('0x60')}];case'custom':return[{'name':'attrPath','value':_0xbb2182['attrPath']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x0]?_0xbb2182[_0x6603('0x5f')][0x0][_0x6603('0x61')]:undefined)||''}];case _0x6603('0x62'):return[{'name':'attrHourFormat','value':_0xbb2182[_0x6603('0x63')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x0]?_0xbb2182[_0x6603('0x5f')][0x0][_0x6603('0x61')]:undefined)||_0x6603('0x64')},{'name':_0x6603('0x65'),'value':_0xbb2182[_0x6603('0x65')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x1]?_0xbb2182[_0x6603('0x5f')][0x1]['value']:undefined)||_0x6603('0x66')},{'name':_0x6603('0x67'),'value':_0xbb2182['attrFontSize']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182['attrs'][0x2]?_0xbb2182[_0x6603('0x5f')][0x2][_0x6603('0x61')]:undefined)||0xc}];case _0x6603('0x68'):return[{'name':'attrMetric','value':_0xbb2182[_0x6603('0x69')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x0]?_0xbb2182[_0x6603('0x5f')][0x0][_0x6603('0x61')]:undefined)||_0x6603('0x6a')},{'name':'attrVoiceQueues','value':_0xbb2182[_0x6603('0x6b')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x1]?_0xbb2182[_0x6603('0x5f')][0x1][_0x6603('0x61')]:undefined)||[]},{'name':_0x6603('0x67'),'value':_0xbb2182[_0x6603('0x67')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x2]?_0xbb2182[_0x6603('0x5f')][0x2]['value']:undefined)||0x14},{'name':_0x6603('0x6c'),'value':_0xbb2182['attrChannel']||(_0xbb2182['attrs']&&_0xbb2182['attrs'][0x3]?_0xbb2182['attrs'][0x3][_0x6603('0x61')]:undefined)||'voice'},{'name':_0x6603('0x6d'),'value':_0xbb2182['attrEmailAccounts']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x4]?_0xbb2182['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0xbb2182[_0x6603('0x6e')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x5]?_0xbb2182[_0x6603('0x5f')][0x5][_0x6603('0x61')]:undefined)||''},{'name':_0x6603('0x6f'),'value':_0xbb2182[_0x6603('0x6f')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182['attrs'][0x6]?_0xbb2182['attrs'][0x6]['value']:undefined)||''},{'name':_0x6603('0x70'),'value':_0xbb2182[_0x6603('0x70')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x7]?_0xbb2182[_0x6603('0x5f')][0x7][_0x6603('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xbb2182['attrWhatsappAccounts']||(_0xbb2182['attrs']&&_0xbb2182[_0x6603('0x5f')][0x8]?_0xbb2182[_0x6603('0x5f')][0x8][_0x6603('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0xbb2182[_0x6603('0x71')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x9]?_0xbb2182['attrs'][0x9][_0x6603('0x61')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x6603('0x72'),'value':_0xbb2182[_0x6603('0x72')]||(_0xbb2182['attrs']&&_0xbb2182[_0x6603('0x5f')][0x0]?_0xbb2182[_0x6603('0x5f')][0x0]['value']:undefined)||_0x6603('0x6a')},{'name':_0x6603('0x73'),'value':_0xbb2182[_0x6603('0x73')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x1]?_0xbb2182[_0x6603('0x5f')][0x1][_0x6603('0x61')]:undefined)||null},{'name':_0x6603('0x74'),'value':_0xbb2182[_0x6603('0x74')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x2]?_0xbb2182[_0x6603('0x5f')][0x2][_0x6603('0x61')]:undefined)||null},{'name':_0x6603('0x6b'),'value':_0xbb2182['attrVoiceQueues']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x3]?_0xbb2182[_0x6603('0x5f')][0x3][_0x6603('0x61')]:undefined)||[]},{'name':_0x6603('0x6c'),'value':_0xbb2182[_0x6603('0x6c')]||(_0xbb2182['attrs']&&_0xbb2182[_0x6603('0x5f')][0x4]?_0xbb2182[_0x6603('0x5f')][0x4]['value']:undefined)||_0x6603('0x75')},{'name':_0x6603('0x6d'),'value':_0xbb2182[_0x6603('0x6d')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x5]?_0xbb2182['attrs'][0x5]['value']:undefined)||''},{'name':_0x6603('0x6e'),'value':_0xbb2182[_0x6603('0x6e')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x6]?_0xbb2182['attrs'][0x6][_0x6603('0x61')]:undefined)||''},{'name':_0x6603('0x6f'),'value':_0xbb2182[_0x6603('0x6f')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x7]?_0xbb2182['attrs'][0x7][_0x6603('0x61')]:undefined)||''},{'name':_0x6603('0x70'),'value':_0xbb2182[_0x6603('0x70')]||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x8]?_0xbb2182[_0x6603('0x5f')][0x8]['value']:undefined)||''},{'name':_0x6603('0x76'),'value':_0xbb2182['attrWhatsappAccounts']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182['attrs'][0x9]?_0xbb2182[_0x6603('0x5f')][0x9][_0x6603('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0xbb2182['attrChatWebsites']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0xa]?_0xbb2182[_0x6603('0x5f')][0xa][_0x6603('0x61')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0xbb2182[_0x6603('0x77')]||(_0xbb2182['attrs']&&_0xbb2182[_0x6603('0x5f')][0x0]?_0xbb2182['attrs'][0x0][_0x6603('0x45')]:undefined)||null,'value':_0xbb2182[_0x6603('0x78')]||(_0xbb2182['attrs']&&_0xbb2182['attrs'][0x0]?_0xbb2182[_0x6603('0x5f')][0x0][_0x6603('0x61')]:undefined)||null},{'name':_0x6603('0x79'),'value':_0xbb2182['attrRefresh']||(_0xbb2182[_0x6603('0x5f')]&&_0xbb2182[_0x6603('0x5f')][0x1]?_0xbb2182['attrs'][0x1][_0x6603('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x3108e1){logger[_0x6603('0x2e')](_0x6603('0x7a'),JSON['stringify'](_0x3108e1));return[];}}exports[_0x6603('0x7b')]=function(_0x376331,_0x9d256e,_0x459f90){if(_0x376331[_0x6603('0x51')]['id']){delete _0x376331['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x376331[_0x6603('0x4b')]['id']}})[_0x6603('0x29')](handleEntityNotFound(_0x9d256e,null))[_0x6603('0x29')](function(_0x55bb36){if(_0x55bb36){_0x376331[_0x6603('0x51')][_0x6603('0x7c')]=_0x55bb36['id'];_0x376331[_0x6603('0x51')][_0x6603('0x5f')]=widgetAttributes(_0x376331[_0x6603('0x51')]);return db[_0x6603('0x7d')]['create'](_0x376331[_0x6603('0x51')]);}})[_0x6603('0x29')](respondWithResult(_0x9d256e,null))['catch'](handleError(_0x9d256e,null));};exports[_0x6603('0x7e')]=function(_0x7e7a72,_0x2dc2d6,_0x287dc6){var _0x55c189={};var _0x4d06b3={};var _0x451f6f;var _0x486979;return db['Dashboard'][_0x6603('0x7f')]({'where':{'id':_0x7e7a72['params']['id']}})[_0x6603('0x29')](handleEntityNotFound(_0x2dc2d6,null))[_0x6603('0x29')](function(_0x231d08){if(_0x231d08){_0x451f6f=_0x231d08;_0x4d06b3['model']=_[_0x6603('0x38')](db[_0x6603('0x7d')][_0x6603('0x4c')]);_0x4d06b3[_0x6603('0x3b')]=_['keys'](_0x7e7a72[_0x6603('0x3b')]);_0x4d06b3[_0x6603('0x39')]=_['intersection'](_0x4d06b3[_0x6603('0x37')],_0x4d06b3[_0x6603('0x3b')]);_0x55c189[_0x6603('0x3d')]=_['intersection'](_0x4d06b3[_0x6603('0x37')],qs['fields'](_0x7e7a72['query'][_0x6603('0x3c')]));_0x55c189[_0x6603('0x3d')]=_0x55c189[_0x6603('0x3d')][_0x6603('0x3e')]?_0x55c189[_0x6603('0x3d')]:_0x4d06b3[_0x6603('0x37')];_0x55c189[_0x6603('0x80')]=qs[_0x6603('0x41')](_0x7e7a72[_0x6603('0x3b')][_0x6603('0x41')]);_0x55c189[_0x6603('0x44')]=qs['filters'](_[_0x6603('0x42')](_0x7e7a72[_0x6603('0x3b')],_0x4d06b3[_0x6603('0x39')]));if(_0x7e7a72[_0x6603('0x3b')][_0x6603('0x43')]){_0x55c189[_0x6603('0x44')]=_[_0x6603('0x4e')](_0x55c189['where'],{'$or':_[_0x6603('0x33')](_0x55c189[_0x6603('0x3d')],function(_0x210f44){var _0x122a5d={};_0x122a5d[_0x210f44]={'$like':'%'+_0x7e7a72['query'][_0x6603('0x43')]+'%'};return _0x122a5d;})});}_0x55c189=_[_0x6603('0x4e')]({},_0x55c189,_0x7e7a72[_0x6603('0x47')]);return _0x451f6f[_0x6603('0x7e')](_0x55c189);}})[_0x6603('0x29')](function(_0x399d9b){if(_0x399d9b){_0x486979=_0x399d9b['length'];if(!_0x7e7a72[_0x6603('0x3b')]['hasOwnProperty'](_0x6603('0x40'))){_0x55c189['limit']=qs[_0x6603('0x22')](_0x7e7a72['query'][_0x6603('0x22')]);_0x55c189[_0x6603('0x20')]=qs[_0x6603('0x20')](_0x7e7a72[_0x6603('0x3b')][_0x6603('0x20')]);}return _0x451f6f[_0x6603('0x7e')](_0x55c189);}})['then'](function(_0x2cef1a){if(_0x2cef1a){return _0x2cef1a?{'count':_0x486979,'rows':_0x2cef1a}:null;}})[_0x6603('0x29')](respondWithResult(_0x2dc2d6,null))[_0x6603('0x4a')](handleError(_0x2dc2d6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index fa6d578..8d94167 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 _0xc17f=['../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x2c0d7b,_0x4ec918){var _0x3c769f=function(_0x13fb48){while(--_0x13fb48){_0x2c0d7b['push'](_0x2c0d7b['shift']());}};_0x3c769f(++_0x4ec918);}(_0xc17f,0x155));var _0xfc17=function(_0x570e59,_0x27236e){_0x570e59=_0x570e59-0x0;var _0x235f4c=_0xc17f[_0x570e59];return _0x235f4c;};'use strict';var EventEmitter=require(_0xfc17('0x0'));var Dashboard=require(_0xfc17('0x1'))['db'][_0xfc17('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfc17('0x3')](0x0);var events={'afterCreate':_0xfc17('0x4'),'afterUpdate':_0xfc17('0x5'),'afterDestroy':_0xfc17('0x6')};function emitEvent(_0xb7c91f){return function(_0x26f01b,_0x396295,_0x12e715){DashboardEvents[_0xfc17('0x7')](_0xb7c91f+':'+_0x26f01b['id'],_0x26f01b);DashboardEvents['emit'](_0xb7c91f,_0x26f01b);_0x12e715(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xfc17('0x8')]=DashboardEvents; \ No newline at end of file +var _0x1ea9=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x351327,_0x510c3b){var _0x1d8b4e=function(_0x425fda){while(--_0x425fda){_0x351327['push'](_0x351327['shift']());}};_0x1d8b4e(++_0x510c3b);}(_0x1ea9,0x1b5));var _0x91ea=function(_0x1a507d,_0xcea1af){_0x1a507d=_0x1a507d-0x0;var _0x2dd8fa=_0x1ea9[_0x1a507d];return _0x2dd8fa;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x91ea('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x91ea('0x1')](0x0);var events={'afterCreate':_0x91ea('0x2'),'afterUpdate':_0x91ea('0x3'),'afterDestroy':_0x91ea('0x4')};function emitEvent(_0x379711){return function(_0x39a02c,_0x3126f2,_0x34270e){DashboardEvents[_0x91ea('0x5')](_0x379711+':'+_0x39a02c['id'],_0x39a02c);DashboardEvents[_0x91ea('0x5')](_0x379711,_0x39a02c);_0x34270e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x91ea('0x6')](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 7fba987..314aaca 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 _0x6828=['./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x33ef3d,_0x24bb6a){var _0x5846e7=function(_0x421224){while(--_0x421224){_0x33ef3d['push'](_0x33ef3d['shift']());}};_0x5846e7(++_0x24bb6a);}(_0x6828,0x1f0));var _0x8682=function(_0x9b4edf,_0x42fa6f){_0x9b4edf=_0x9b4edf-0x0;var _0x43ee98=_0x6828[_0x9b4edf];return _0x43ee98;};'use strict';var _=require(_0x8682('0x0'));var util=require(_0x8682('0x1'));var logger=require(_0x8682('0x2'))('api');var moment=require(_0x8682('0x3'));var BPromise=require(_0x8682('0x4'));var rp=require(_0x8682('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8682('0x6'));var config=require(_0x8682('0x7'));var attributes=require(_0x8682('0x8'));module[_0x8682('0x9')]=function(_0x549527,_0x6c007e){return _0x549527[_0x8682('0xa')](_0x8682('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9366=['define','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes'];(function(_0x3825e8,_0x4c1f20){var _0x2e1708=function(_0x6f7ff9){while(--_0x6f7ff9){_0x3825e8['push'](_0x3825e8['shift']());}};_0x2e1708(++_0x4c1f20);}(_0x9366,0x7a));var _0x6936=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9366[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6936('0x0'));var util=require(_0x6936('0x1'));var logger=require(_0x6936('0x2'))(_0x6936('0x3'));var moment=require(_0x6936('0x4'));var BPromise=require(_0x6936('0x5'));var rp=require(_0x6936('0x6'));var fs=require('fs');var path=require(_0x6936('0x7'));var rimraf=require('rimraf');var config=require(_0x6936('0x8'));var attributes=require(_0x6936('0x9'));module['exports']=function(_0x589532,_0x5103fb){return _0x589532[_0x6936('0xa')]('Dashboard',attributes,{'tableName':_0x6936('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 91edcdd..0a654db 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 _0xccba=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','ioredis'];(function(_0x508581,_0xb1411){var _0x4c75b2=function(_0x4dc5b8){while(--_0x4dc5b8){_0x508581['push'](_0x508581['shift']());}};_0x4c75b2(++_0xb1411);}(_0xccba,0x83));var _0xaccb=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xccba[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xaccb('0x0'));var util=require(_0xaccb('0x1'));var moment=require(_0xaccb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaccb('0x3'));var db=require(_0xaccb('0x4'))['db'];var utils=require(_0xaccb('0x5'));var logger=require(_0xaccb('0x6'))(_0xaccb('0x7'));var config=require(_0xaccb('0x8'));var jayson=require(_0xaccb('0x9'));var client=jayson['client'][_0xaccb('0xa')]({'port':0x232a});config[_0xaccb('0xb')]=_[_0xaccb('0xc')](config[_0xaccb('0xb')],{'host':_0xaccb('0xd'),'port':0x18eb});var socket=require(_0xaccb('0xe'))(new Redis(config[_0xaccb('0xb')]));require(_0xaccb('0xf'))[_0xaccb('0x10')](socket);function respondWithRpcPromise(_0x56dcd8,_0x85e2fd,_0x102630){return new BPromise(function(_0x440191,_0x1cac8a){return client['request'](_0x56dcd8,_0x102630)[_0xaccb('0x11')](function(_0x520590){logger[_0xaccb('0x12')](_0xaccb('0x13'),_0x85e2fd,_0xaccb('0x14'));logger[_0xaccb('0x15')](_0xaccb('0x16'),_0x85e2fd,'request\x20sent',JSON[_0xaccb('0x17')](_0x520590));if(_0x520590[_0xaccb('0x18')]){if(_0x520590[_0xaccb('0x18')]['code']===0x1f4){logger[_0xaccb('0x18')](_0xaccb('0x13'),_0x85e2fd,_0x520590[_0xaccb('0x18')][_0xaccb('0x19')]);return _0x1cac8a(_0x520590[_0xaccb('0x18')][_0xaccb('0x19')]);}logger[_0xaccb('0x18')](_0xaccb('0x13'),_0x85e2fd,_0x520590[_0xaccb('0x18')][_0xaccb('0x19')]);return _0x440191(_0x520590['error'][_0xaccb('0x19')]);}else{logger[_0xaccb('0x12')](_0xaccb('0x13'),_0x85e2fd,'request\x20sent');_0x440191(_0x520590['result']['message']);}})[_0xaccb('0x1a')](function(_0x3fb1aa){logger['error'](_0xaccb('0x13'),_0x85e2fd,_0x3fb1aa);_0x1cac8a(_0x3fb1aa);});});} \ No newline at end of file +var _0xdd05=['http','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2bd7a9,_0x1369a1){var _0x2866ac=function(_0x38302c){while(--_0x38302c){_0x2bd7a9['push'](_0x2bd7a9['shift']());}};_0x2866ac(++_0x1369a1);}(_0xdd05,0x1e4));var _0x5dd0=function(_0x570016,_0x111cb9){_0x570016=_0x570016-0x0;var _0x3b4176=_0xdd05[_0x570016];return _0x3b4176;};'use strict';var _=require(_0x5dd0('0x0'));var util=require(_0x5dd0('0x1'));var moment=require(_0x5dd0('0x2'));var BPromise=require(_0x5dd0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5dd0('0x4'));var db=require(_0x5dd0('0x5'))['db'];var utils=require(_0x5dd0('0x6'));var logger=require(_0x5dd0('0x7'))(_0x5dd0('0x8'));var config=require(_0x5dd0('0x9'));var jayson=require(_0x5dd0('0xa'));var client=jayson[_0x5dd0('0xb')][_0x5dd0('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5dd0('0xd')],{'host':_0x5dd0('0xe'),'port':0x18eb});var socket=require(_0x5dd0('0xf'))(new Redis(config['redis']));require(_0x5dd0('0x10'))[_0x5dd0('0x11')](socket);function respondWithRpcPromise(_0x4818b4,_0x1f2813,_0x4da654){return new BPromise(function(_0x3df573,_0x21cbec){return client[_0x5dd0('0x12')](_0x4818b4,_0x4da654)[_0x5dd0('0x13')](function(_0x37eb19){logger[_0x5dd0('0x14')](_0x5dd0('0x15'),_0x1f2813,_0x5dd0('0x16'));logger[_0x5dd0('0x17')](_0x5dd0('0x18'),_0x1f2813,_0x5dd0('0x16'),JSON[_0x5dd0('0x19')](_0x37eb19));if(_0x37eb19[_0x5dd0('0x1a')]){if(_0x37eb19['error'][_0x5dd0('0x1b')]===0x1f4){logger[_0x5dd0('0x1a')](_0x5dd0('0x15'),_0x1f2813,_0x37eb19[_0x5dd0('0x1a')]['message']);return _0x21cbec(_0x37eb19[_0x5dd0('0x1a')][_0x5dd0('0x1c')]);}logger[_0x5dd0('0x1a')](_0x5dd0('0x15'),_0x1f2813,_0x37eb19[_0x5dd0('0x1a')][_0x5dd0('0x1c')]);return _0x3df573(_0x37eb19[_0x5dd0('0x1a')][_0x5dd0('0x1c')]);}else{logger['info'](_0x5dd0('0x15'),_0x1f2813,'request\x20sent');_0x3df573(_0x37eb19[_0x5dd0('0x1d')][_0x5dd0('0x1c')]);}})[_0x5dd0('0x1e')](function(_0x2b7dcf){logger[_0x5dd0('0x1a')](_0x5dd0('0x15'),_0x1f2813,_0x2b7dcf);_0x21cbec(_0x2b7dcf);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 1629b14..93d8fe6 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 _0x35c5=['./dashboard.events','save','remove','update','removeListener','register'];(function(_0x4fb25c,_0x27c302){var _0x3ef44d=function(_0x44d33f){while(--_0x44d33f){_0x4fb25c['push'](_0x4fb25c['shift']());}};_0x3ef44d(++_0x27c302);}(_0x35c5,0x1e0));var _0x535c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x35c5[_0x2b5eae];return _0x5f3ac9;};'use strict';var DashboardEvents=require(_0x535c('0x0'));var events=[_0x535c('0x1'),_0x535c('0x2'),_0x535c('0x3')];function createListener(_0x333ce7,_0x61362d){return function(_0x539595){_0x61362d['emit'](_0x333ce7,_0x539595);};}function removeListener(_0xb9f058,_0x32e532){return function(){DashboardEvents[_0x535c('0x4')](_0xb9f058,_0x32e532);};}exports[_0x535c('0x5')]=function(_0x44ceb3){for(var _0x181063=0x0,_0x2e0668=events['length'];_0x181063<_0x2e0668;_0x181063++){var _0x4d732a=events[_0x181063];var _0x5297a8=createListener('dashboard:'+_0x4d732a,_0x44ceb3);DashboardEvents['on'](_0x4d732a,_0x5297a8);}}; \ No newline at end of file +var _0x3c68=['remove','update','emit','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x104513,_0x166e91){var _0x59600d=function(_0x3fac2f){while(--_0x3fac2f){_0x104513['push'](_0x104513['shift']());}};_0x59600d(++_0x166e91);}(_0x3c68,0x10c));var _0x83c6=function(_0x4a63d9,_0x2e32e1){_0x4a63d9=_0x4a63d9-0x0;var _0xca3ba0=_0x3c68[_0x4a63d9];return _0xca3ba0;};'use strict';var DashboardEvents=require(_0x83c6('0x0'));var events=[_0x83c6('0x1'),_0x83c6('0x2'),_0x83c6('0x3')];function createListener(_0xc135a5,_0x2dc4f5){return function(_0x43f17f){_0x2dc4f5[_0x83c6('0x4')](_0xc135a5,_0x43f17f);};}function removeListener(_0x4f04c9,_0x31dfae){return function(){DashboardEvents[_0x83c6('0x5')](_0x4f04c9,_0x31dfae);};}exports[_0x83c6('0x6')]=function(_0x59e973){for(var _0x49b4c4=0x0,_0x5021be=events[_0x83c6('0x7')];_0x49b4c4<_0x5021be;_0x49b4c4++){var _0x1792de=events[_0x49b4c4];var _0x35f537=createListener(_0x83c6('0x8')+_0x1792de,_0x59e973);DashboardEvents['on'](_0x1792de,_0x35f537);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 93f4fa9..8b54dbd 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 _0x0ff7=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','isAuthenticated','/:id','/:id/items','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','util','path'];(function(_0x42bea1,_0x4795da){var _0x1371e1=function(_0xd27d5e){while(--_0xd27d5e){_0x42bea1['push'](_0x42bea1['shift']());}};_0x1371e1(++_0x4795da);}(_0x0ff7,0xef));var _0x70ff=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x0ff7[_0x5f0089];return _0x193892;};'use strict';var multer=require(_0x70ff('0x0'));var util=require(_0x70ff('0x1'));var path=require(_0x70ff('0x2'));var timeout=require(_0x70ff('0x3'));var express=require(_0x70ff('0x4'));var router=express['Router']();var fs_extra=require(_0x70ff('0x5'));var auth=require(_0x70ff('0x6'));var interaction=require(_0x70ff('0x7'));var config=require('../../config/environment');var controller=require(_0x70ff('0x8'));router[_0x70ff('0x9')]('/',auth[_0x70ff('0xa')](),controller['index']);router['get'](_0x70ff('0xb'),auth[_0x70ff('0xa')](),controller['show']);router['get'](_0x70ff('0xc'),auth[_0x70ff('0xa')](),controller['getItems']);router[_0x70ff('0xd')]('/',auth[_0x70ff('0xa')](),controller['create']);router[_0x70ff('0xd')](_0x70ff('0xe'),auth[_0x70ff('0xa')](),controller[_0x70ff('0xf')]);router[_0x70ff('0xd')]('/:id/items',auth[_0x70ff('0xa')](),controller[_0x70ff('0x10')]);router[_0x70ff('0x11')]('/:id',auth[_0x70ff('0xa')](),controller[_0x70ff('0x12')]);router[_0x70ff('0x13')](_0x70ff('0xb'),auth[_0x70ff('0xa')](),controller[_0x70ff('0x14')]);module[_0x70ff('0x15')]=router; \ No newline at end of file +var _0x2027=['getItems','post','create','/:id/clone','clone','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items'];(function(_0x21310f,_0x2b178d){var _0x5bb5a3=function(_0x5ea0ff){while(--_0x5ea0ff){_0x21310f['push'](_0x21310f['shift']());}};_0x5bb5a3(++_0x2b178d);}(_0x2027,0xb9));var _0x7202=function(_0x542b28,_0x2f5526){_0x542b28=_0x542b28-0x0;var _0x207946=_0x2027[_0x542b28];return _0x207946;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7202('0x0'));var timeout=require(_0x7202('0x1'));var express=require(_0x7202('0x2'));var router=express[_0x7202('0x3')]();var fs_extra=require(_0x7202('0x4'));var auth=require(_0x7202('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7202('0x6'));router[_0x7202('0x7')]('/',auth[_0x7202('0x8')](),controller[_0x7202('0x9')]);router[_0x7202('0x7')](_0x7202('0xa'),auth[_0x7202('0x8')](),controller[_0x7202('0xb')]);router['get'](_0x7202('0xc'),auth[_0x7202('0x8')](),controller[_0x7202('0xd')]);router[_0x7202('0xe')]('/',auth[_0x7202('0x8')](),controller[_0x7202('0xf')]);router['post'](_0x7202('0x10'),auth['isAuthenticated'](),controller[_0x7202('0x11')]);router[_0x7202('0xe')](_0x7202('0xc'),auth[_0x7202('0x8')](),controller['addItem']);router[_0x7202('0x12')](_0x7202('0xa'),auth[_0x7202('0x8')](),controller[_0x7202('0x13')]);router[_0x7202('0x14')](_0x7202('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7202('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index bad8ddc..5b13caa 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 _0xeff8=['sequelize','squel','exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x1a9460,_0x5b4a8f){var _0x3854c2=function(_0x323c37){while(--_0x323c37){_0x1a9460['push'](_0x1a9460['shift']());}};_0x3854c2(++_0x5b4a8f);}(_0xeff8,0x186));var _0x8eff=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xeff8[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x8eff('0x0'));var squel=require(_0x8eff('0x1'));var _=require('lodash');module[_0x8eff('0x2')]={'title':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eff('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x8eff('0x4')),'get':function(){try{return JSON[_0x8eff('0x5')](this[_0x8eff('0x6')](_0x8eff('0x7')));}catch(_0x4ac51c){return[];}},'set':function(_0x469641){try{this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')](_0x469641));}catch(_0x491f01){this[_0x8eff('0x8')](_0x8eff('0x7'),JSON[_0x8eff('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x8eff('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x8eff('0xa')]},'background':{'type':Sequelize[_0x8eff('0x3')],'allowNull':![],'defaultValue':_0x8eff('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8eff('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eff('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x5496=['#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5496,0x175));var _0x6549=function(_0x2d95c2,_0x4b26a7){_0x2d95c2=_0x2d95c2-0x0;var _0x5db352=_0x5496[_0x2d95c2];return _0x5db352;};'use strict';var Sequelize=require(_0x6549('0x0'));var squel=require(_0x6549('0x1'));var _=require(_0x6549('0x2'));module[_0x6549('0x3')]={'title':{'type':Sequelize[_0x6549('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6549('0x5')]('long'),'get':function(){try{return JSON[_0x6549('0x6')](this[_0x6549('0x7')](_0x6549('0x8')));}catch(_0x4d0473){return[];}},'set':function(_0x5a4658){try{this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify'](_0x5a4658));}catch(_0x1ca8fc){this[_0x6549('0x9')](_0x6549('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6549('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x6549('0xa')]},'col':{'type':Sequelize[_0x6549('0xa')]},'background':{'type':Sequelize[_0x6549('0x4')],'allowNull':![],'defaultValue':_0x6549('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6549('0x4')]},'titleFontSize':{'type':Sequelize[_0x6549('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 58c8b9a..94e5aa5 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 _0x25fa=['Content-Range','apply','reject','update','then','error','stack','name','show','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','merge','options','catch','destroy','find','params','type','attrUrl','attrs','value','https://','custom','attrPath','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','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','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','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','count','set'];(function(_0x21cfc8,_0x466318){var _0x36a3ab=function(_0x1ec5db){while(--_0x1ec5db){_0x21cfc8['push'](_0x21cfc8['shift']());}};_0x36a3ab(++_0x466318);}(_0x25fa,0x109));var _0xa25f=function(_0x22cb8b,_0x36e391){_0x22cb8b=_0x22cb8b-0x0;var _0x50d53e=_0x25fa[_0x22cb8b];return _0x50d53e;};'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'];config[_0xa25f('0x18')]=_[_0xa25f('0x19')](config['redis'],{'host':_0xa25f('0x1a'),'port':0x18eb});var socket=require(_0xa25f('0x1b'))(new Redis(config[_0xa25f('0x18')]));require(_0xa25f('0x1c'))[_0xa25f('0x1d')](socket);function respondWithStatusCode(_0x2a627f,_0x46cd8c){_0x46cd8c=_0x46cd8c||0xcc;return function(_0x363668){if(_0x363668){return _0x2a627f[_0xa25f('0x1e')](_0x46cd8c);}return _0x2a627f[_0xa25f('0x1f')](_0x46cd8c)[_0xa25f('0x20')]();};}function respondWithResult(_0x1859ba,_0x57ada6){_0x57ada6=_0x57ada6||0xc8;return function(_0x2d4f0f){if(_0x2d4f0f){return _0x1859ba[_0xa25f('0x1f')](_0x57ada6)[_0xa25f('0x21')](_0x2d4f0f);}};}function respondWithFilteredResult(_0x451a6e,_0x18705c){return function(_0x427105){if(_0x427105){var _0x4a4805=typeof _0x18705c[_0xa25f('0x22')]==='undefined'&&typeof _0x18705c[_0xa25f('0x23')]==='undefined';var _0x559c89=_0x427105[_0xa25f('0x24')];var _0x489c83=_0x4a4805?0x0:_0x18705c[_0xa25f('0x22')];var _0x131c68=_0x4a4805?_0x427105[_0xa25f('0x24')]:_0x18705c[_0xa25f('0x22')]+_0x18705c[_0xa25f('0x23')];var _0x504135;if(_0x131c68>=_0x559c89){_0x131c68=_0x559c89;_0x504135=0xc8;}else{_0x504135=0xce;}_0x451a6e[_0xa25f('0x1f')](_0x504135);return _0x451a6e[_0xa25f('0x25')](_0xa25f('0x26'),_0x489c83+'-'+_0x131c68+'/'+_0x559c89)[_0xa25f('0x21')](_0x427105);}return null;};}function patchUpdates(_0x5d2803){return function(_0x7dc402){try{jsonpatch[_0xa25f('0x27')](_0x7dc402,_0x5d2803,!![]);}catch(_0x248c0c){return BPromise[_0xa25f('0x28')](_0x248c0c);}return _0x7dc402['save']();};}function saveUpdates(_0x2b710f,_0x906388){return function(_0x22f123){if(_0x22f123){return _0x22f123[_0xa25f('0x29')](_0x2b710f)['then'](function(_0x2812d7){return _0x2812d7;});}return null;};}function removeEntity(_0x898446,_0x53f011){return function(_0x23d1ba){if(_0x23d1ba){return _0x23d1ba['destroy']()[_0xa25f('0x2a')](function(){_0x898446['status'](0xcc)[_0xa25f('0x20')]();});}};}function handleEntityNotFound(_0x2448f4,_0x493de0){return function(_0xf6c928){if(!_0xf6c928){_0x2448f4[_0xa25f('0x1e')](0x194);}return _0xf6c928;};}function handleError(_0x54d98c,_0x471e7c){_0x471e7c=_0x471e7c||0x1f4;return function(_0x5d39c7){logger[_0xa25f('0x2b')](_0x5d39c7[_0xa25f('0x2c')]);if(_0x5d39c7[_0xa25f('0x2d')]){delete _0x5d39c7[_0xa25f('0x2d')];}_0x54d98c[_0xa25f('0x1f')](_0x471e7c)['send'](_0x5d39c7);};}exports[_0xa25f('0x2e')]=function(_0x28d84e,_0x119ffc){var _0x245684={'raw':![],'where':{'id':_0x28d84e['params']['id']}},_0x3bdde0={};_0x3bdde0[_0xa25f('0x2f')]=_[_0xa25f('0x30')](db[_0xa25f('0x31')][_0xa25f('0x32')]);_0x3bdde0[_0xa25f('0x33')]=_[_0xa25f('0x30')](_0x28d84e[_0xa25f('0x33')]);_0x3bdde0[_0xa25f('0x34')]=_[_0xa25f('0x35')](_0x3bdde0['model'],_0x3bdde0['query']);_0x245684['attributes']=_[_0xa25f('0x35')](_0x3bdde0[_0xa25f('0x2f')],qs[_0xa25f('0x36')](_0x28d84e[_0xa25f('0x33')][_0xa25f('0x36')]));_0x245684[_0xa25f('0x37')]=_0x245684[_0xa25f('0x37')][_0xa25f('0x38')]?_0x245684[_0xa25f('0x37')]:_0x3bdde0[_0xa25f('0x2f')];if(_0x28d84e[_0xa25f('0x33')]['includeAll']){_0x245684['include']=[{'all':!![]}];}_0x245684=_[_0xa25f('0x39')]({},_0x245684,_0x28d84e[_0xa25f('0x3a')]);return db[_0xa25f('0x31')]['find'](_0x245684)['then'](handleEntityNotFound(_0x119ffc,null))['then'](respondWithResult(_0x119ffc,null))[_0xa25f('0x3b')](handleError(_0x119ffc,null));};exports[_0xa25f('0x3c')]=function(_0x1078c4,_0x4a334b){return db['DashboardItem'][_0xa25f('0x3d')]({'where':{'id':_0x1078c4[_0xa25f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4a334b,null))['then'](removeEntity(_0x4a334b,null))[_0xa25f('0x3b')](handleError(_0x4a334b,null));};function widgetAttributes(_0x33ad7a){try{switch(_0x33ad7a[_0xa25f('0x3f')]){case'iframe':return[{'name':_0xa25f('0x40'),'value':_0x33ad7a[_0xa25f('0x40')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x0]?_0x33ad7a['attrs'][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x43')}];case _0xa25f('0x44'):return[{'name':_0xa25f('0x45'),'value':_0x33ad7a[_0xa25f('0x45')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0]['value']:undefined)||''}];case _0xa25f('0x46'):return[{'name':_0xa25f('0x47'),'value':_0x33ad7a[_0xa25f('0x47')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x48')},{'name':_0xa25f('0x49'),'value':_0x33ad7a[_0xa25f('0x49')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x1]?_0x33ad7a[_0xa25f('0x41')][0x1]['value']:undefined)||_0xa25f('0x4a')},{'name':'attrFontSize','value':_0x33ad7a[_0xa25f('0x4b')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x2]?_0x33ad7a['attrs'][0x2][_0xa25f('0x42')]:undefined)||0xc}];case _0xa25f('0x4c'):return[{'name':_0xa25f('0x4d'),'value':_0x33ad7a[_0xa25f('0x4d')]||(_0x33ad7a['attrs']&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x4e')},{'name':_0xa25f('0x4f'),'value':_0x33ad7a[_0xa25f('0x4f')]||(_0x33ad7a['attrs']&&_0x33ad7a[_0xa25f('0x41')][0x1]?_0x33ad7a[_0xa25f('0x41')][0x1]['value']:undefined)||[]},{'name':_0xa25f('0x4b'),'value':_0x33ad7a[_0xa25f('0x4b')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x2]?_0x33ad7a[_0xa25f('0x41')][0x2][_0xa25f('0x42')]:undefined)||0x14},{'name':_0xa25f('0x50'),'value':_0x33ad7a[_0xa25f('0x50')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x3]?_0x33ad7a[_0xa25f('0x41')][0x3][_0xa25f('0x42')]:undefined)||_0xa25f('0x51')},{'name':'attrEmailAccounts','value':_0x33ad7a[_0xa25f('0x52')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x4]?_0x33ad7a[_0xa25f('0x41')][0x4]['value']:undefined)||''},{'name':_0xa25f('0x53'),'value':_0x33ad7a[_0xa25f('0x53')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x5]?_0x33ad7a[_0xa25f('0x41')][0x5][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x54'),'value':_0x33ad7a[_0xa25f('0x54')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x6]?_0x33ad7a[_0xa25f('0x41')][0x6][_0xa25f('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x33ad7a[_0xa25f('0x55')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x7]?_0x33ad7a[_0xa25f('0x41')][0x7][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x56'),'value':_0x33ad7a[_0xa25f('0x56')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x8]?_0x33ad7a[_0xa25f('0x41')][0x8][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x57'),'value':_0x33ad7a[_0xa25f('0x57')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x9]?_0x33ad7a[_0xa25f('0x41')][0x9][_0xa25f('0x42')]:undefined)||''}];case _0xa25f('0x58'):case _0xa25f('0x59'):return[{'name':_0xa25f('0x5a'),'value':_0x33ad7a[_0xa25f('0x5a')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||_0xa25f('0x4e')},{'name':_0xa25f('0x5b'),'value':_0x33ad7a['attrSerie2']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x1]?_0x33ad7a[_0xa25f('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x33ad7a[_0xa25f('0x5c')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x2]?_0x33ad7a[_0xa25f('0x41')][0x2][_0xa25f('0x42')]:undefined)||null},{'name':_0xa25f('0x4f'),'value':_0x33ad7a[_0xa25f('0x4f')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x3]?_0x33ad7a[_0xa25f('0x41')][0x3][_0xa25f('0x42')]:undefined)||[]},{'name':_0xa25f('0x50'),'value':_0x33ad7a['attrChannel']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x4]?_0x33ad7a[_0xa25f('0x41')][0x4][_0xa25f('0x42')]:undefined)||'voice'},{'name':_0xa25f('0x52'),'value':_0x33ad7a['attrEmailAccounts']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x5]?_0x33ad7a[_0xa25f('0x41')][0x5][_0xa25f('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x33ad7a[_0xa25f('0x53')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x6]?_0x33ad7a['attrs'][0x6][_0xa25f('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x33ad7a[_0xa25f('0x54')]||(_0x33ad7a['attrs']&&_0x33ad7a[_0xa25f('0x41')][0x7]?_0x33ad7a[_0xa25f('0x41')][0x7][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x55'),'value':_0x33ad7a[_0xa25f('0x55')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a['attrs'][0x8]?_0x33ad7a[_0xa25f('0x41')][0x8][_0xa25f('0x42')]:undefined)||''},{'name':_0xa25f('0x56'),'value':_0x33ad7a[_0xa25f('0x56')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x9]?_0x33ad7a[_0xa25f('0x41')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x33ad7a['attrChatWebsites']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0xa]?_0x33ad7a[_0xa25f('0x41')][0xa][_0xa25f('0x42')]:undefined)||''}];case _0xa25f('0x5d'):return[{'name':_0xa25f('0x5e'),'type':_0x33ad7a[_0xa25f('0x5f')]||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x3f')]:undefined)||null,'value':_0x33ad7a['attrReport']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x0]?_0x33ad7a[_0xa25f('0x41')][0x0][_0xa25f('0x42')]:undefined)||null},{'name':_0xa25f('0x60'),'value':_0x33ad7a['attrRefresh']||(_0x33ad7a[_0xa25f('0x41')]&&_0x33ad7a[_0xa25f('0x41')][0x1]?_0x33ad7a['attrs'][0x1][_0xa25f('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x214d6a){logger['error'](_0xa25f('0x61'),JSON[_0xa25f('0x62')](_0x214d6a));return[];}}exports[_0xa25f('0x63')]=function(_0x336beb,_0x380f61){if(_0x336beb['body']){_0x336beb[_0xa25f('0x64')][_0xa25f('0x41')]=widgetAttributes(_0x336beb[_0xa25f('0x64')]);}return db['DashboardItem'][_0xa25f('0x63')](_0x336beb[_0xa25f('0x64')],{})[_0xa25f('0x2a')](respondWithResult(_0x380f61,0xc9))['catch'](handleError(_0x380f61,null));};exports[_0xa25f('0x29')]=function(_0x2595a2,_0x23029f){if(_0x2595a2[_0xa25f('0x64')]['id']){delete _0x2595a2['body']['id'];}_0x2595a2['body'][_0xa25f('0x41')]=widgetAttributes(_0x2595a2[_0xa25f('0x64')]);return db[_0xa25f('0x31')][_0xa25f('0x3d')]({'where':{'id':_0x2595a2[_0xa25f('0x3e')]['id']}})[_0xa25f('0x2a')](handleEntityNotFound(_0x23029f,null))[_0xa25f('0x2a')](saveUpdates(_0x2595a2['body'],null))['then'](respondWithResult(_0x23029f,null))[_0xa25f('0x3b')](handleError(_0x23029f,null));}; \ No newline at end of file +var _0xefce=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','DashboardItem','catch','find','type','iframe','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','create','body','rimraf','request-promise'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xefce,0x1e8));var _0xeefc=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0xefce[_0x5cfb92];return _0x1cd7c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeefc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeefc('0x1'));var moment=require(_0xeefc('0x2'));var BPromise=require(_0xeefc('0x3'));var Mustache=require(_0xeefc('0x4'));var util=require(_0xeefc('0x5'));var path=require(_0xeefc('0x6'));var sox=require(_0xeefc('0x7'));var csv=require(_0xeefc('0x8'));var ejs=require(_0xeefc('0x9'));var fs=require('fs');var fs_extra=require(_0xeefc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeefc('0xb'));var jsforce=require(_0xeefc('0xc'));var deskjs=require(_0xeefc('0xd'));var toCsv=require(_0xeefc('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeefc('0xe'));var authService=require(_0xeefc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xeefc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeefc('0x11'))(_0xeefc('0x12'));var utils=require('../../config/utils');var config=require(_0xeefc('0x13'));var licenseUtil=require(_0xeefc('0x14'));var db=require(_0xeefc('0x15'))['db'];config['redis']=_[_0xeefc('0x16')](config[_0xeefc('0x17')],{'host':_0xeefc('0x18'),'port':0x18eb});var socket=require(_0xeefc('0x19'))(new Redis(config[_0xeefc('0x17')]));require(_0xeefc('0x1a'))[_0xeefc('0x1b')](socket);function respondWithStatusCode(_0x4537e2,_0x2d5fc1){_0x2d5fc1=_0x2d5fc1||0xcc;return function(_0x3ac92a){if(_0x3ac92a){return _0x4537e2[_0xeefc('0x1c')](_0x2d5fc1);}return _0x4537e2['status'](_0x2d5fc1)[_0xeefc('0x1d')]();};}function respondWithResult(_0x5c447b,_0x2ce41b){_0x2ce41b=_0x2ce41b||0xc8;return function(_0x2fe7c2){if(_0x2fe7c2){return _0x5c447b[_0xeefc('0x1e')](_0x2ce41b)[_0xeefc('0x1f')](_0x2fe7c2);}};}function respondWithFilteredResult(_0x15baaa,_0x49cfe2){return function(_0x1c247e){if(_0x1c247e){var _0x1ea90e=typeof _0x49cfe2['offset']===_0xeefc('0x20')&&typeof _0x49cfe2[_0xeefc('0x21')]===_0xeefc('0x20');var _0x4ba684=_0x1c247e[_0xeefc('0x22')];var _0x1f2825=_0x1ea90e?0x0:_0x49cfe2['offset'];var _0x25ca4d=_0x1ea90e?_0x1c247e['count']:_0x49cfe2[_0xeefc('0x23')]+_0x49cfe2[_0xeefc('0x21')];var _0x3cebaa;if(_0x25ca4d>=_0x4ba684){_0x25ca4d=_0x4ba684;_0x3cebaa=0xc8;}else{_0x3cebaa=0xce;}_0x15baaa[_0xeefc('0x1e')](_0x3cebaa);return _0x15baaa[_0xeefc('0x24')](_0xeefc('0x25'),_0x1f2825+'-'+_0x25ca4d+'/'+_0x4ba684)[_0xeefc('0x1f')](_0x1c247e);}return null;};}function patchUpdates(_0x4ec1c9){return function(_0x168700){try{jsonpatch[_0xeefc('0x26')](_0x168700,_0x4ec1c9,!![]);}catch(_0x6e690b){return BPromise[_0xeefc('0x27')](_0x6e690b);}return _0x168700['save']();};}function saveUpdates(_0x48246d,_0x1a8b12){return function(_0x1f2d59){if(_0x1f2d59){return _0x1f2d59[_0xeefc('0x28')](_0x48246d)[_0xeefc('0x29')](function(_0x4aeaa7){return _0x4aeaa7;});}return null;};}function removeEntity(_0x16e60e,_0x3ea299){return function(_0xceece3){if(_0xceece3){return _0xceece3[_0xeefc('0x2a')]()['then'](function(){_0x16e60e['status'](0xcc)[_0xeefc('0x1d')]();});}};}function handleEntityNotFound(_0x5b7d0d,_0x27f8cd){return function(_0x2d13b6){if(!_0x2d13b6){_0x5b7d0d['sendStatus'](0x194);}return _0x2d13b6;};}function handleError(_0x52dab1,_0x167fe8){_0x167fe8=_0x167fe8||0x1f4;return function(_0x56ea84){logger['error'](_0x56ea84[_0xeefc('0x2b')]);if(_0x56ea84[_0xeefc('0x2c')]){delete _0x56ea84['name'];}_0x52dab1['status'](_0x167fe8)[_0xeefc('0x2d')](_0x56ea84);};}exports[_0xeefc('0x2e')]=function(_0x4369c9,_0x13a33e){var _0x29fc6b={'raw':![],'where':{'id':_0x4369c9[_0xeefc('0x2f')]['id']}},_0x325578={};_0x325578[_0xeefc('0x30')]=_[_0xeefc('0x31')](db['DashboardItem'][_0xeefc('0x32')]);_0x325578[_0xeefc('0x33')]=_[_0xeefc('0x31')](_0x4369c9[_0xeefc('0x33')]);_0x325578[_0xeefc('0x34')]=_[_0xeefc('0x35')](_0x325578[_0xeefc('0x30')],_0x325578[_0xeefc('0x33')]);_0x29fc6b[_0xeefc('0x36')]=_[_0xeefc('0x35')](_0x325578[_0xeefc('0x30')],qs[_0xeefc('0x37')](_0x4369c9[_0xeefc('0x33')]['fields']));_0x29fc6b[_0xeefc('0x36')]=_0x29fc6b[_0xeefc('0x36')]['length']?_0x29fc6b[_0xeefc('0x36')]:_0x325578[_0xeefc('0x30')];if(_0x4369c9['query']['includeAll']){_0x29fc6b[_0xeefc('0x38')]=[{'all':!![]}];}_0x29fc6b=_[_0xeefc('0x39')]({},_0x29fc6b,_0x4369c9[_0xeefc('0x3a')]);return db[_0xeefc('0x3b')]['find'](_0x29fc6b)[_0xeefc('0x29')](handleEntityNotFound(_0x13a33e,null))['then'](respondWithResult(_0x13a33e,null))[_0xeefc('0x3c')](handleError(_0x13a33e,null));};exports[_0xeefc('0x2a')]=function(_0x52b74a,_0x38d4c2){return db[_0xeefc('0x3b')][_0xeefc('0x3d')]({'where':{'id':_0x52b74a[_0xeefc('0x2f')]['id']}})[_0xeefc('0x29')](handleEntityNotFound(_0x38d4c2,null))[_0xeefc('0x29')](removeEntity(_0x38d4c2,null))[_0xeefc('0x3c')](handleError(_0x38d4c2,null));};function widgetAttributes(_0x11186c){try{switch(_0x11186c[_0xeefc('0x3e')]){case _0xeefc('0x3f'):return[{'name':'attrUrl','value':_0x11186c['attrUrl']||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||_0xeefc('0x42')}];case'custom':return[{'name':_0xeefc('0x43'),'value':_0x11186c[_0xeefc('0x43')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c['attrs'][0x0][_0xeefc('0x41')]:undefined)||''}];case _0xeefc('0x44'):return[{'name':_0xeefc('0x45'),'value':_0x11186c[_0xeefc('0x45')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||_0xeefc('0x46')},{'name':_0xeefc('0x47'),'value':_0x11186c['attrTimezone']||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||_0xeefc('0x48')},{'name':_0xeefc('0x49'),'value':_0x11186c[_0xeefc('0x49')]||(_0x11186c['attrs']&&_0x11186c['attrs'][0x2]?_0x11186c[_0xeefc('0x40')][0x2][_0xeefc('0x41')]:undefined)||0xc}];case _0xeefc('0x4a'):return[{'name':_0xeefc('0x4b'),'value':_0x11186c[_0xeefc('0x4b')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0][_0xeefc('0x41')]:undefined)||'total'},{'name':_0xeefc('0x4c'),'value':_0x11186c[_0xeefc('0x4c')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||[]},{'name':_0xeefc('0x49'),'value':_0x11186c[_0xeefc('0x49')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x2]?_0x11186c[_0xeefc('0x40')][0x2][_0xeefc('0x41')]:undefined)||0x14},{'name':_0xeefc('0x4d'),'value':_0x11186c[_0xeefc('0x4d')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x3]?_0x11186c[_0xeefc('0x40')][0x3][_0xeefc('0x41')]:undefined)||_0xeefc('0x4e')},{'name':_0xeefc('0x4f'),'value':_0x11186c[_0xeefc('0x4f')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x4]?_0x11186c[_0xeefc('0x40')][0x4][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x50'),'value':_0x11186c[_0xeefc('0x50')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x5]?_0x11186c[_0xeefc('0x40')][0x5]['value']:undefined)||''},{'name':_0xeefc('0x51'),'value':_0x11186c[_0xeefc('0x51')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x6]?_0x11186c['attrs'][0x6]['value']:undefined)||''},{'name':_0xeefc('0x52'),'value':_0x11186c[_0xeefc('0x52')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x7]?_0x11186c[_0xeefc('0x40')][0x7][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x53'),'value':_0x11186c[_0xeefc('0x53')]||(_0x11186c['attrs']&&_0x11186c['attrs'][0x8]?_0x11186c[_0xeefc('0x40')][0x8][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x54'),'value':_0x11186c['attrChatWebsites']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x9]?_0x11186c[_0xeefc('0x40')][0x9]['value']:undefined)||''}];case _0xeefc('0x55'):case _0xeefc('0x56'):return[{'name':_0xeefc('0x57'),'value':_0x11186c[_0xeefc('0x57')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c['attrs'][0x0]['value']:undefined)||_0xeefc('0x58')},{'name':_0xeefc('0x59'),'value':_0x11186c[_0xeefc('0x59')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c['attrs'][0x1][_0xeefc('0x41')]:undefined)||null},{'name':_0xeefc('0x5a'),'value':_0x11186c[_0xeefc('0x5a')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x2]?_0x11186c[_0xeefc('0x40')][0x2]['value']:undefined)||null},{'name':_0xeefc('0x4c'),'value':_0x11186c[_0xeefc('0x4c')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x3]?_0x11186c['attrs'][0x3][_0xeefc('0x41')]:undefined)||[]},{'name':_0xeefc('0x4d'),'value':_0x11186c['attrChannel']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x4]?_0x11186c[_0xeefc('0x40')][0x4][_0xeefc('0x41')]:undefined)||_0xeefc('0x4e')},{'name':_0xeefc('0x4f'),'value':_0x11186c['attrEmailAccounts']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x5]?_0x11186c[_0xeefc('0x40')][0x5][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x50'),'value':_0x11186c[_0xeefc('0x50')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x6]?_0x11186c[_0xeefc('0x40')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x11186c[_0xeefc('0x51')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x7]?_0x11186c[_0xeefc('0x40')][0x7][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x52'),'value':_0x11186c[_0xeefc('0x52')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x8]?_0x11186c['attrs'][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x11186c[_0xeefc('0x53')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x9]?_0x11186c[_0xeefc('0x40')][0x9][_0xeefc('0x41')]:undefined)||''},{'name':_0xeefc('0x54'),'value':_0x11186c[_0xeefc('0x54')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0xa]?_0x11186c[_0xeefc('0x40')][0xa][_0xeefc('0x41')]:undefined)||''}];case _0xeefc('0x5b'):return[{'name':_0xeefc('0x5c'),'type':_0x11186c['reportType']||(_0x11186c[_0xeefc('0x40')]&&_0x11186c['attrs'][0x0]?_0x11186c['attrs'][0x0]['type']:undefined)||null,'value':_0x11186c[_0xeefc('0x5c')]||(_0x11186c['attrs']&&_0x11186c[_0xeefc('0x40')][0x0]?_0x11186c[_0xeefc('0x40')][0x0]['value']:undefined)||null},{'name':_0xeefc('0x5d'),'value':_0x11186c[_0xeefc('0x5d')]||(_0x11186c[_0xeefc('0x40')]&&_0x11186c[_0xeefc('0x40')][0x1]?_0x11186c[_0xeefc('0x40')][0x1][_0xeefc('0x41')]:undefined)||0x0}];default:return[];}}catch(_0xa1c28f){logger[_0xeefc('0x5e')](_0xeefc('0x5f'),JSON['stringify'](_0xa1c28f));return[];}}exports[_0xeefc('0x60')]=function(_0x232c64,_0x5c5ec2){if(_0x232c64[_0xeefc('0x61')]){_0x232c64[_0xeefc('0x61')][_0xeefc('0x40')]=widgetAttributes(_0x232c64['body']);}return db['DashboardItem'][_0xeefc('0x60')](_0x232c64[_0xeefc('0x61')],{})[_0xeefc('0x29')](respondWithResult(_0x5c5ec2,0xc9))[_0xeefc('0x3c')](handleError(_0x5c5ec2,null));};exports[_0xeefc('0x28')]=function(_0x34a816,_0x1f5e28){if(_0x34a816['body']['id']){delete _0x34a816[_0xeefc('0x61')]['id'];}_0x34a816['body'][_0xeefc('0x40')]=widgetAttributes(_0x34a816[_0xeefc('0x61')]);return db[_0xeefc('0x3b')]['find']({'where':{'id':_0x34a816[_0xeefc('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1f5e28,null))[_0xeefc('0x29')](saveUpdates(_0x34a816['body'],null))[_0xeefc('0x29')](respondWithResult(_0x1f5e28,null))[_0xeefc('0x3c')](handleError(_0x1f5e28,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 3b9b4c3..d79ff44 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 _0xbd3e=['update','remove','emit','hook','exports','events','DashboardItem','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd3e,0xbd));var _0xebd3=function(_0x222f56,_0xf548ff){_0x222f56=_0x222f56-0x0;var _0x408f2d=_0xbd3e[_0x222f56];return _0x408f2d;};'use strict';var EventEmitter=require(_0xebd3('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xebd3('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xebd3('0x2'),'afterUpdate':_0xebd3('0x3'),'afterDestroy':_0xebd3('0x4')};function emitEvent(_0x4a8561){return function(_0x5ec139,_0x4e1fe8,_0x323fc5){DashboardItemEvents[_0xebd3('0x5')](_0x4a8561+':'+_0x5ec139['id'],_0x5ec139);DashboardItemEvents[_0xebd3('0x5')](_0x4a8561,_0x5ec139);_0x323fc5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xebd3('0x6')](e,emitEvent(event));}}module[_0xebd3('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0xe09e=['update','emit','exports','DashboardItem','setMaxListeners','save'];(function(_0x1536c9,_0x322f06){var _0x375faf=function(_0x5b17a0){while(--_0x5b17a0){_0x1536c9['push'](_0x1536c9['shift']());}};_0x375faf(++_0x322f06);}(_0xe09e,0x177));var _0xee09=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0xe09e[_0x130d82];return _0x112070;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xee09('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xee09('0x1')](0x0);var events={'afterCreate':_0xee09('0x2'),'afterUpdate':_0xee09('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16ef17){return function(_0x6f29f4,_0x530108,_0x9407de){DashboardItemEvents['emit'](_0x16ef17+':'+_0x6f29f4['id'],_0x6f29f4);DashboardItemEvents[_0xee09('0x4')](_0x16ef17,_0x6f29f4);_0x9407de(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xee09('0x5')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5c3915f..2a00de0 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 _0x6a8e=['moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','util','api'];(function(_0x5d59b4,_0x2a566a){var _0x442c14=function(_0x48b13a){while(--_0x48b13a){_0x5d59b4['push'](_0x5d59b4['shift']());}};_0x442c14(++_0x2a566a);}(_0x6a8e,0xc4));var _0xe6a8=function(_0x5dc2fa,_0x56279d){_0x5dc2fa=_0x5dc2fa-0x0;var _0x16eaf9=_0x6a8e[_0x5dc2fa];return _0x16eaf9;};'use strict';var _=require('lodash');var util=require(_0xe6a8('0x0'));var logger=require('../../config/logger')(_0xe6a8('0x1'));var moment=require(_0xe6a8('0x2'));var BPromise=require('bluebird');var rp=require(_0xe6a8('0x3'));var fs=require('fs');var path=require(_0xe6a8('0x4'));var rimraf=require(_0xe6a8('0x5'));var config=require(_0xe6a8('0x6'));var attributes=require(_0xe6a8('0x7'));module['exports']=function(_0x3907c3,_0x8b2615){return _0x3907c3[_0xe6a8('0x8')](_0xe6a8('0x9'),attributes,{'tableName':_0xe6a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3bb=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','../../config/logger','api','moment','bluebird'];(function(_0x308a5a,_0x407e2f){var _0x5eda97=function(_0x5ee2b8){while(--_0x5ee2b8){_0x308a5a['push'](_0x308a5a['shift']());}};_0x5eda97(++_0x407e2f);}(_0xf3bb,0x1e0));var _0xbf3b=function(_0x2d1721,_0x55c55a){_0x2d1721=_0x2d1721-0x0;var _0x494c4c=_0xf3bb[_0x2d1721];return _0x494c4c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf3b('0x0'))(_0xbf3b('0x1'));var moment=require(_0xbf3b('0x2'));var BPromise=require(_0xbf3b('0x3'));var rp=require(_0xbf3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf3b('0x5'));var config=require(_0xbf3b('0x6'));var attributes=require(_0xbf3b('0x7'));module[_0xbf3b('0x8')]=function(_0x1bca30,_0x255a12){return _0x1bca30[_0xbf3b('0x9')](_0xbf3b('0xa'),attributes,{'tableName':'dashboard_items','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 e57d252..2ca98c2 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 _0x6e7f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','lodash','util','moment'];(function(_0x55153a,_0x18e950){var _0x1faaa6=function(_0x2c2b85){while(--_0x2c2b85){_0x55153a['push'](_0x55153a['shift']());}};_0x1faaa6(++_0x18e950);}(_0x6e7f,0x1a1));var _0xf6e7=function(_0x1d06df,_0x2d86b7){_0x1d06df=_0x1d06df-0x0;var _0x13d003=_0x6e7f[_0x1d06df];return _0x13d003;};'use strict';var _=require(_0xf6e7('0x0'));var util=require(_0xf6e7('0x1'));var moment=require(_0xf6e7('0x2'));var BPromise=require(_0xf6e7('0x3'));var rs=require(_0xf6e7('0x4'));var fs=require('fs');var Redis=require(_0xf6e7('0x5'));var db=require(_0xf6e7('0x6'))['db'];var utils=require(_0xf6e7('0x7'));var logger=require(_0xf6e7('0x8'))(_0xf6e7('0x9'));var config=require(_0xf6e7('0xa'));var jayson=require(_0xf6e7('0xb'));var client=jayson[_0xf6e7('0xc')]['http']({'port':0x232a});config[_0xf6e7('0xd')]=_['defaults'](config[_0xf6e7('0xd')],{'host':_0xf6e7('0xe'),'port':0x18eb});var socket=require(_0xf6e7('0xf'))(new Redis(config[_0xf6e7('0xd')]));require(_0xf6e7('0x10'))[_0xf6e7('0x11')](socket);function respondWithRpcPromise(_0x2ef8e9,_0x23623e,_0x3d55ee){return new BPromise(function(_0x4b81d9,_0x3b11e5){return client[_0xf6e7('0x12')](_0x2ef8e9,_0x3d55ee)[_0xf6e7('0x13')](function(_0x1c6742){logger[_0xf6e7('0x14')](_0xf6e7('0x15'),_0x23623e,'request\x20sent');logger[_0xf6e7('0x16')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x23623e,'request\x20sent',JSON['stringify'](_0x1c6742));if(_0x1c6742['error']){if(_0x1c6742[_0xf6e7('0x17')][_0xf6e7('0x18')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x23623e,_0x1c6742['error'][_0xf6e7('0x19')]);return _0x3b11e5(_0x1c6742[_0xf6e7('0x17')][_0xf6e7('0x19')]);}logger[_0xf6e7('0x17')](_0xf6e7('0x15'),_0x23623e,_0x1c6742[_0xf6e7('0x17')][_0xf6e7('0x19')]);return _0x4b81d9(_0x1c6742['error'][_0xf6e7('0x19')]);}else{logger[_0xf6e7('0x14')](_0xf6e7('0x15'),_0x23623e,_0xf6e7('0x1a'));_0x4b81d9(_0x1c6742['result']['message']);}})[_0xf6e7('0x1b')](function(_0x23ff31){logger[_0xf6e7('0x17')](_0xf6e7('0x15'),_0x23623e,_0x23ff31);_0x3b11e5(_0x23ff31);});});} \ No newline at end of file +var _0x2564=['request\x20sent','stringify','error','DashboardItem,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0x2564,0xba));var _0x4256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2564[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4256('0x0'));var util=require(_0x4256('0x1'));var moment=require(_0x4256('0x2'));var BPromise=require(_0x4256('0x3'));var rs=require(_0x4256('0x4'));var fs=require('fs');var Redis=require(_0x4256('0x5'));var db=require(_0x4256('0x6'))['db'];var utils=require(_0x4256('0x7'));var logger=require(_0x4256('0x8'))(_0x4256('0x9'));var config=require(_0x4256('0xa'));var jayson=require(_0x4256('0xb'));var client=jayson['client'][_0x4256('0xc')]({'port':0x232a});config[_0x4256('0xd')]=_[_0x4256('0xe')](config[_0x4256('0xd')],{'host':_0x4256('0xf'),'port':0x18eb});var socket=require(_0x4256('0x10'))(new Redis(config[_0x4256('0xd')]));require(_0x4256('0x11'))[_0x4256('0x12')](socket);function respondWithRpcPromise(_0xea3942,_0x3dba6f,_0x467168){return new BPromise(function(_0x179ab1,_0xd15a34){return client[_0x4256('0x13')](_0xea3942,_0x467168)[_0x4256('0x14')](function(_0x5dc66a){logger[_0x4256('0x15')]('DashboardItem,\x20%s,\x20%s',_0x3dba6f,'request\x20sent');logger[_0x4256('0x16')](_0x4256('0x17'),_0x3dba6f,_0x4256('0x18'),JSON[_0x4256('0x19')](_0x5dc66a));if(_0x5dc66a[_0x4256('0x1a')]){if(_0x5dc66a['error']['code']===0x1f4){logger['error'](_0x4256('0x1b'),_0x3dba6f,_0x5dc66a[_0x4256('0x1a')][_0x4256('0x1c')]);return _0xd15a34(_0x5dc66a[_0x4256('0x1a')][_0x4256('0x1c')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x3dba6f,_0x5dc66a[_0x4256('0x1a')][_0x4256('0x1c')]);return _0x179ab1(_0x5dc66a[_0x4256('0x1a')][_0x4256('0x1c')]);}else{logger[_0x4256('0x15')](_0x4256('0x1b'),_0x3dba6f,_0x4256('0x18'));_0x179ab1(_0x5dc66a[_0x4256('0x1d')][_0x4256('0x1c')]);}})['catch'](function(_0x3f6fd3){logger[_0x4256('0x1a')](_0x4256('0x1b'),_0x3dba6f,_0x3f6fd3);_0xd15a34(_0x3f6fd3);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3f8e00b..49d9c37 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 _0xb1b3=['update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x1ae0da,_0x3c72ea){var _0x139f8c=function(_0x589201){while(--_0x589201){_0x1ae0da['push'](_0x1ae0da['shift']());}};_0x139f8c(++_0x3c72ea);}(_0xb1b3,0x1dd));var _0x3b1b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb1b3[_0x397e5f];return _0x5302b8;};'use strict';var DashboardItemEvents=require(_0x3b1b('0x0'));var events=[_0x3b1b('0x1'),_0x3b1b('0x2'),_0x3b1b('0x3')];function createListener(_0x6b2e6e,_0x1e32c3){return function(_0x41b7be){_0x1e32c3[_0x3b1b('0x4')](_0x6b2e6e,_0x41b7be);};}function removeListener(_0x386bbe,_0x39a506){return function(){DashboardItemEvents[_0x3b1b('0x5')](_0x386bbe,_0x39a506);};}exports['register']=function(_0x373bba){for(var _0x31bf18=0x0,_0x19150e=events[_0x3b1b('0x6')];_0x31bf18<_0x19150e;_0x31bf18++){var _0xd46986=events[_0x31bf18];var _0xbdcc3b=createListener(_0x3b1b('0x7')+_0xd46986,_0x373bba);DashboardItemEvents['on'](_0xd46986,_0xbdcc3b);}}; \ No newline at end of file +var _0x2b79=['register','length','dashboardItem:','update','emit'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x2b79,0x1d9));var _0x92b7=function(_0x380af2,_0x36cf66){_0x380af2=_0x380af2-0x0;var _0x1789dc=_0x2b79[_0x380af2];return _0x1789dc;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0x92b7('0x0')];function createListener(_0x1e542c,_0x4c5aa1){return function(_0x3af9b2){_0x4c5aa1[_0x92b7('0x1')](_0x1e542c,_0x3af9b2);};}function removeListener(_0x2043f3,_0x19ef88){return function(){DashboardItemEvents['removeListener'](_0x2043f3,_0x19ef88);};}exports[_0x92b7('0x2')]=function(_0x1718b5){for(var _0x1a5181=0x0,_0x28528a=events[_0x92b7('0x3')];_0x1a5181<_0x28528a;_0x1a5181++){var _0x45a9c4=events[_0x1a5181];var _0x164cff=createListener(_0x92b7('0x4')+_0x45a9c4,_0x1718b5);DashboardItemEvents['on'](_0x45a9c4,_0x164cff);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ddffda5..bb4d84b 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 _0xdd15=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','update','delete','exports','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdd15,0x6e));var _0x5dd1=function(_0x3df9dd,_0x26f5cd){_0x3df9dd=_0x3df9dd-0x0;var _0x4f11e4=_0xdd15[_0x3df9dd];return _0x4f11e4;};'use strict';var multer=require(_0x5dd1('0x0'));var util=require(_0x5dd1('0x1'));var path=require(_0x5dd1('0x2'));var timeout=require(_0x5dd1('0x3'));var express=require(_0x5dd1('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5dd1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5dd1('0x6'));var controller=require(_0x5dd1('0x7'));router[_0x5dd1('0x8')](_0x5dd1('0x9'),auth[_0x5dd1('0xa')](),controller[_0x5dd1('0xb')]);router['post']('/',auth[_0x5dd1('0xa')](),controller[_0x5dd1('0xc')]);router['put'](_0x5dd1('0x9'),auth[_0x5dd1('0xa')](),controller[_0x5dd1('0xd')]);router[_0x5dd1('0xe')](_0x5dd1('0x9'),auth[_0x5dd1('0xa')](),controller['destroy']);module[_0x5dd1('0xf')]=router; \ No newline at end of file +var _0x1b10=['../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','create','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5e17e5,_0x3d73fc){var _0x3ff101=function(_0x4720e8){while(--_0x4720e8){_0x5e17e5['push'](_0x5e17e5['shift']());}};_0x3ff101(++_0x3d73fc);}(_0x1b10,0x159));var _0x01b1=function(_0x4a2324,_0x29b899){_0x4a2324=_0x4a2324-0x0;var _0x1b86b6=_0x1b10[_0x4a2324];return _0x1b86b6;};'use strict';var multer=require(_0x01b1('0x0'));var util=require(_0x01b1('0x1'));var path=require(_0x01b1('0x2'));var timeout=require(_0x01b1('0x3'));var express=require(_0x01b1('0x4'));var router=express[_0x01b1('0x5')]();var fs_extra=require(_0x01b1('0x6'));var auth=require(_0x01b1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x01b1('0x8'));var controller=require(_0x01b1('0x9'));router['get'](_0x01b1('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x01b1('0xb')]);router['put'](_0x01b1('0xa'),auth[_0x01b1('0xc')](),controller[_0x01b1('0xd')]);router['delete'](_0x01b1('0xa'),auth[_0x01b1('0xc')](),controller[_0x01b1('0xe')]);module[_0x01b1('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 b5d9ada..1ae959b 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 _0xee5e=['ENUM','first','second','third','sequelize','exports','STRING'];(function(_0x3ace47,_0x3add27){var _0x5f39b0=function(_0x3b0d87){while(--_0x3b0d87){_0x3ace47['push'](_0x3ace47['shift']());}};_0x5f39b0(++_0x3add27);}(_0xee5e,0x162));var _0xeee5=function(_0x5a539f,_0x4f35a5){_0x5a539f=_0x5a539f-0x0;var _0x215171=_0xee5e[_0x5a539f];return _0x215171;};'use strict';var Sequelize=require(_0xeee5('0x0'));module[_0xeee5('0x1')]={'name':{'type':Sequelize[_0xeee5('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xeee5('0x3')](_0xeee5('0x4'),_0xeee5('0x5'),_0xeee5('0x6')),'allowNull':![],'defaultValue':_0xeee5('0x4')},'description':{'type':Sequelize[_0xeee5('0x2')]}}; \ No newline at end of file +var _0x76c4=['ENUM','second','first','STRING','sequelize','exports'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0x76c4,0x1ea));var _0x476c=function(_0x51a29f,_0x26bd00){_0x51a29f=_0x51a29f-0x0;var _0x14a794=_0x76c4[_0x51a29f];return _0x14a794;};'use strict';var Sequelize=require(_0x476c('0x0'));module[_0x476c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x476c('0x2')]('first',_0x476c('0x3'),'third'),'allowNull':![],'defaultValue':_0x476c('0x4')},'description':{'type':Sequelize[_0x476c('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 943eb08..4ea4ce3 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 _0x544f=['rows','catch','show','params','includeAll','options','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','include','findAll'];(function(_0x58418a,_0x3d9f06){var _0x2716bf=function(_0x36fcfd){while(--_0x36fcfd){_0x58418a['push'](_0x58418a['shift']());}};_0x2716bf(++_0x3d9f06);}(_0x544f,0x104));var _0xf544=function(_0x2b91c5,_0x3b6db5){_0x2b91c5=_0x2b91c5-0x0;var _0xbd5531=_0x544f[_0x2b91c5];return _0xbd5531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf544('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf544('0x1'));var rp=require(_0xf544('0x2'));var moment=require(_0xf544('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf544('0x4'));var util=require(_0xf544('0x5'));var path=require(_0xf544('0x6'));var sox=require('sox');var csv=require(_0xf544('0x7'));var ejs=require(_0xf544('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf544('0x9'));var jsforce=require(_0xf544('0xa'));var deskjs=require(_0xf544('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf544('0xc'));var Papa=require(_0xf544('0xd'));var Redis=require(_0xf544('0xe'));var authService=require(_0xf544('0xf'));var qs=require(_0xf544('0x10'));var as=require(_0xf544('0x11'));var hardwareService=require(_0xf544('0x12'));var logger=require(_0xf544('0x13'))(_0xf544('0x14'));var utils=require(_0xf544('0x15'));var config=require(_0xf544('0x16'));var licenseUtil=require(_0xf544('0x17'));var db=require(_0xf544('0x18'))['db'];function respondWithStatusCode(_0x1b5698,_0x7e7085){_0x7e7085=_0x7e7085||0xcc;return function(_0x2263c3){if(_0x2263c3){return _0x1b5698[_0xf544('0x19')](_0x7e7085);}return _0x1b5698[_0xf544('0x1a')](_0x7e7085)[_0xf544('0x1b')]();};}function respondWithResult(_0x42880b,_0x49ed2c){_0x49ed2c=_0x49ed2c||0xc8;return function(_0x5c87b4){if(_0x5c87b4){return _0x42880b['status'](_0x49ed2c)[_0xf544('0x1c')](_0x5c87b4);}};}function respondWithFilteredResult(_0x5396fe,_0x54048d){return function(_0x27e13d){if(_0x27e13d){var _0x2ad9ae=typeof _0x54048d['offset']===_0xf544('0x1d')&&typeof _0x54048d[_0xf544('0x1e')]===_0xf544('0x1d');var _0x454f9e=_0x27e13d[_0xf544('0x1f')];var _0x2abda3=_0x2ad9ae?0x0:_0x54048d[_0xf544('0x20')];var _0x49c3d8=_0x2ad9ae?_0x27e13d[_0xf544('0x1f')]:_0x54048d[_0xf544('0x20')]+_0x54048d[_0xf544('0x1e')];var _0x48cbb3;if(_0x49c3d8>=_0x454f9e){_0x49c3d8=_0x454f9e;_0x48cbb3=0xc8;}else{_0x48cbb3=0xce;}_0x5396fe[_0xf544('0x1a')](_0x48cbb3);return _0x5396fe['set']('Content-Range',_0x2abda3+'-'+_0x49c3d8+'/'+_0x454f9e)[_0xf544('0x1c')](_0x27e13d);}return null;};}function patchUpdates(_0x4cd4c9){return function(_0x27a3cd){try{jsonpatch['apply'](_0x27a3cd,_0x4cd4c9,!![]);}catch(_0x223707){return BPromise['reject'](_0x223707);}return _0x27a3cd[_0xf544('0x21')]();};}function saveUpdates(_0x5f5d1e,_0x1def98){return function(_0x1f4235){if(_0x1f4235){return _0x1f4235[_0xf544('0x22')](_0x5f5d1e)[_0xf544('0x23')](function(_0x49a558){return _0x49a558;});}return null;};}function removeEntity(_0x244e74,_0x216558){return function(_0x131511){if(_0x131511){return _0x131511['destroy']()['then'](function(){var _0xc826e6=_0x131511[_0xf544('0x24')]({'plain':!![]});var _0x5c5148=_0xf544('0x25');return db[_0xf544('0x26')][_0xf544('0x27')]({'where':{'type':_0x5c5148,'resourceId':_0xc826e6['id']}})[_0xf544('0x23')](function(){return _0x131511;});})['then'](function(){_0x244e74[_0xf544('0x1a')](0xcc)[_0xf544('0x1b')]();});}};}function handleEntityNotFound(_0x343f3a,_0x31581e){return function(_0x553cf1){if(!_0x553cf1){_0x343f3a[_0xf544('0x19')](0x194);}return _0x553cf1;};}function handleError(_0x4a7eea,_0x31f0bd){_0x31f0bd=_0x31f0bd||0x1f4;return function(_0x1375cb){logger[_0xf544('0x28')](_0x1375cb[_0xf544('0x29')]);if(_0x1375cb[_0xf544('0x2a')]){delete _0x1375cb[_0xf544('0x2a')];}_0x4a7eea[_0xf544('0x1a')](_0x31f0bd)[_0xf544('0x2b')](_0x1375cb);};}exports[_0xf544('0x2c')]=function(_0x29cd18,_0x626635){var _0x20f30e={},_0x2de6d1={},_0x38a5c5={'count':0x0,'rows':[]};var _0x4d554a=_[_0xf544('0x2d')](db[_0xf544('0x2e')][_0xf544('0x2f')],function(_0x3d4931){return{'name':_0x3d4931[_0xf544('0x30')],'type':_0x3d4931['type'][_0xf544('0x31')]};});_0x2de6d1[_0xf544('0x32')]=_[_0xf544('0x2d')](_0x4d554a,_0xf544('0x2a'));_0x2de6d1[_0xf544('0x33')]=_[_0xf544('0x34')](_0x29cd18['query']);_0x2de6d1['filters']=_[_0xf544('0x35')](_0x2de6d1['model'],_0x2de6d1[_0xf544('0x33')]);_0x20f30e[_0xf544('0x36')]=_[_0xf544('0x35')](_0x2de6d1[_0xf544('0x32')],qs[_0xf544('0x37')](_0x29cd18['query'][_0xf544('0x37')]));_0x20f30e[_0xf544('0x36')]=_0x20f30e['attributes'][_0xf544('0x38')]?_0x20f30e[_0xf544('0x36')]:_0x2de6d1[_0xf544('0x32')];if(!_0x29cd18[_0xf544('0x33')][_0xf544('0x39')](_0xf544('0x3a'))){_0x20f30e['limit']=qs['limit'](_0x29cd18['query'][_0xf544('0x1e')]);_0x20f30e[_0xf544('0x20')]=qs[_0xf544('0x20')](_0x29cd18['query']['offset']);}_0x20f30e[_0xf544('0x3b')]=qs[_0xf544('0x3c')](_0x29cd18[_0xf544('0x33')][_0xf544('0x3c')]);_0x20f30e['where']=qs[_0xf544('0x3d')](_['pick'](_0x29cd18[_0xf544('0x33')],_0x2de6d1[_0xf544('0x3d')]),_0x4d554a);if(_0x29cd18[_0xf544('0x33')]['filter']){_0x20f30e[_0xf544('0x3e')]=_[_0xf544('0x3f')](_0x20f30e[_0xf544('0x3e')],{'$or':_[_0xf544('0x2d')](_0x4d554a,function(_0x4315e1){if(_0x4315e1['type']!==_0xf544('0x40')){var _0x539701={};_0x539701[_0x4315e1[_0xf544('0x2a')]]={'$like':'%'+_0x29cd18[_0xf544('0x33')][_0xf544('0x41')]+'%'};return _0x539701;}})});}_0x20f30e=_[_0xf544('0x3f')]({},_0x20f30e,_0x29cd18['options']);var _0xe05fb0={'where':_0x20f30e[_0xf544('0x3e')]};return db[_0xf544('0x2e')][_0xf544('0x1f')](_0xe05fb0)['then'](function(_0x1455a9){_0x38a5c5[_0xf544('0x1f')]=_0x1455a9;if(_0x29cd18['query']['includeAll']){_0x20f30e[_0xf544('0x42')]=[{'all':!![]}];}return db[_0xf544('0x2e')][_0xf544('0x43')](_0x20f30e);})[_0xf544('0x23')](function(_0x38ff26){_0x38a5c5[_0xf544('0x44')]=_0x38ff26;return _0x38a5c5;})[_0xf544('0x23')](respondWithFilteredResult(_0x626635,_0x20f30e))[_0xf544('0x45')](handleError(_0x626635,null));};exports[_0xf544('0x46')]=function(_0x50b090,_0x416698){var _0x5b3af6={'raw':!![],'where':{'id':_0x50b090[_0xf544('0x47')]['id']}},_0xbbc659={};_0xbbc659[_0xf544('0x32')]=_[_0xf544('0x34')](db['Disposition'][_0xf544('0x2f')]);_0xbbc659[_0xf544('0x33')]=_[_0xf544('0x34')](_0x50b090[_0xf544('0x33')]);_0xbbc659[_0xf544('0x3d')]=_[_0xf544('0x35')](_0xbbc659[_0xf544('0x32')],_0xbbc659[_0xf544('0x33')]);_0x5b3af6[_0xf544('0x36')]=_[_0xf544('0x35')](_0xbbc659[_0xf544('0x32')],qs['fields'](_0x50b090[_0xf544('0x33')][_0xf544('0x37')]));_0x5b3af6[_0xf544('0x36')]=_0x5b3af6[_0xf544('0x36')][_0xf544('0x38')]?_0x5b3af6[_0xf544('0x36')]:_0xbbc659['model'];if(_0x50b090[_0xf544('0x33')][_0xf544('0x48')]){_0x5b3af6[_0xf544('0x42')]=[{'all':!![]}];}_0x5b3af6=_[_0xf544('0x3f')]({},_0x5b3af6,_0x50b090[_0xf544('0x49')]);return db[_0xf544('0x2e')][_0xf544('0x4a')](_0x5b3af6)['then'](handleEntityNotFound(_0x416698,null))[_0xf544('0x23')](respondWithResult(_0x416698,null))[_0xf544('0x45')](handleError(_0x416698,null));};exports[_0xf544('0x4b')]=function(_0x1b5250,_0x5bf594){return db[_0xf544('0x2e')]['create'](_0x1b5250[_0xf544('0x4c')],{})[_0xf544('0x23')](function(_0x2d902a){var _0x3351a7=_0x1b5250['user'][_0xf544('0x24')]({'plain':!![]});if(!_0x3351a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3351a7[_0xf544('0x4d')]==='user'){var _0x10c874=_0x2d902a[_0xf544('0x24')]({'plain':!![]});var _0x4bbbbd=_0xf544('0x25');return db[_0xf544('0x4e')]['find']({'where':{'name':_0x4bbbbd,'userProfileId':_0x3351a7[_0xf544('0x4f')]},'raw':!![]})[_0xf544('0x23')](function(_0x119bf2){if(_0x119bf2&&_0x119bf2[_0xf544('0x50')]===0x0){return db[_0xf544('0x26')][_0xf544('0x4b')]({'name':_0x10c874[_0xf544('0x2a')],'resourceId':_0x10c874['id'],'type':_0x119bf2['name'],'sectionId':_0x119bf2['id']},{})[_0xf544('0x23')](function(){return _0x2d902a;});}else{return _0x2d902a;}})[_0xf544('0x45')](function(_0x9141ba){logger['error'](_0xf544('0x51'),_0x9141ba);throw _0x9141ba;});}return _0x2d902a;})[_0xf544('0x23')](respondWithResult(_0x5bf594,0xc9))[_0xf544('0x45')](handleError(_0x5bf594,null));};exports['update']=function(_0x1e017e,_0x4373b1){if(_0x1e017e[_0xf544('0x4c')]['id']){delete _0x1e017e[_0xf544('0x4c')]['id'];}return db[_0xf544('0x2e')]['find']({'where':{'id':_0x1e017e[_0xf544('0x47')]['id']}})[_0xf544('0x23')](handleEntityNotFound(_0x4373b1,null))[_0xf544('0x23')](saveUpdates(_0x1e017e[_0xf544('0x4c')],null))[_0xf544('0x23')](respondWithResult(_0x4373b1,null))[_0xf544('0x45')](handleError(_0x4373b1,null));};exports[_0xf544('0x27')]=function(_0x1ca554,_0x4d311a){return db[_0xf544('0x2e')]['find']({'where':{'id':_0x1ca554[_0xf544('0x47')]['id']}})[_0xf544('0x23')](handleEntityNotFound(_0x4d311a,null))[_0xf544('0x23')](removeEntity(_0x4d311a,null))[_0xf544('0x45')](handleError(_0x4d311a,null));}; \ No newline at end of file +var _0xefd8=['VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','autoAssociation','find','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','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Disposition','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick'];(function(_0x2b4a73,_0x510d8d){var _0x4401e7=function(_0x1bdc46){while(--_0x1bdc46){_0x2b4a73['push'](_0x2b4a73['shift']());}};_0x4401e7(++_0x510d8d);}(_0xefd8,0x104));var _0x8efd=function(_0x145028,_0x58a967){_0x145028=_0x145028-0x0;var _0x2d1cdd=_0xefd8[_0x145028];return _0x2d1cdd;};'use strict';var emlformat=require(_0x8efd('0x0'));var rimraf=require(_0x8efd('0x1'));var zipdir=require(_0x8efd('0x2'));var jsonpatch=require(_0x8efd('0x3'));var rp=require(_0x8efd('0x4'));var moment=require(_0x8efd('0x5'));var BPromise=require(_0x8efd('0x6'));var Mustache=require(_0x8efd('0x7'));var util=require(_0x8efd('0x8'));var path=require('path');var sox=require(_0x8efd('0x9'));var csv=require(_0x8efd('0xa'));var ejs=require(_0x8efd('0xb'));var fs=require('fs');var fs_extra=require(_0x8efd('0xc'));var _=require(_0x8efd('0xd'));var squel=require(_0x8efd('0xe'));var crypto=require(_0x8efd('0xf'));var jsforce=require(_0x8efd('0x10'));var deskjs=require(_0x8efd('0x11'));var toCsv=require(_0x8efd('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8efd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8efd('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8efd('0x14'));var config=require(_0x8efd('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2adbfb,_0x51449b){_0x51449b=_0x51449b||0xcc;return function(_0x49b92a){if(_0x49b92a){return _0x2adbfb['sendStatus'](_0x51449b);}return _0x2adbfb[_0x8efd('0x16')](_0x51449b)[_0x8efd('0x17')]();};}function respondWithResult(_0xc1f24c,_0x3ed627){_0x3ed627=_0x3ed627||0xc8;return function(_0x13b9d5){if(_0x13b9d5){return _0xc1f24c[_0x8efd('0x16')](_0x3ed627)[_0x8efd('0x18')](_0x13b9d5);}};}function respondWithFilteredResult(_0x2ff533,_0x563a4c){return function(_0x42b92e){if(_0x42b92e){var _0x41c3cf=typeof _0x563a4c[_0x8efd('0x19')]===_0x8efd('0x1a')&&typeof _0x563a4c[_0x8efd('0x1b')]===_0x8efd('0x1a');var _0x4c67cb=_0x42b92e[_0x8efd('0x1c')];var _0x2fe4df=_0x41c3cf?0x0:_0x563a4c[_0x8efd('0x19')];var _0x3c8d07=_0x41c3cf?_0x42b92e[_0x8efd('0x1c')]:_0x563a4c[_0x8efd('0x19')]+_0x563a4c[_0x8efd('0x1b')];var _0x4d776a;if(_0x3c8d07>=_0x4c67cb){_0x3c8d07=_0x4c67cb;_0x4d776a=0xc8;}else{_0x4d776a=0xce;}_0x2ff533[_0x8efd('0x16')](_0x4d776a);return _0x2ff533[_0x8efd('0x1d')](_0x8efd('0x1e'),_0x2fe4df+'-'+_0x3c8d07+'/'+_0x4c67cb)['json'](_0x42b92e);}return null;};}function patchUpdates(_0x3b3bca){return function(_0x4eb558){try{jsonpatch[_0x8efd('0x1f')](_0x4eb558,_0x3b3bca,!![]);}catch(_0xd7fce3){return BPromise[_0x8efd('0x20')](_0xd7fce3);}return _0x4eb558[_0x8efd('0x21')]();};}function saveUpdates(_0x4f9152,_0x5291b9){return function(_0xa10f25){if(_0xa10f25){return _0xa10f25[_0x8efd('0x22')](_0x4f9152)[_0x8efd('0x23')](function(_0x266ff6){return _0x266ff6;});}return null;};}function removeEntity(_0x1873da,_0x10485f){return function(_0x1ed1bb){if(_0x1ed1bb){return _0x1ed1bb[_0x8efd('0x24')]()['then'](function(){var _0x2195a6=_0x1ed1bb[_0x8efd('0x25')]({'plain':!![]});var _0xd4c79d='Dispositions';return db[_0x8efd('0x26')][_0x8efd('0x24')]({'where':{'type':_0xd4c79d,'resourceId':_0x2195a6['id']}})['then'](function(){return _0x1ed1bb;});})[_0x8efd('0x23')](function(){_0x1873da['status'](0xcc)[_0x8efd('0x17')]();});}};}function handleEntityNotFound(_0x3e67e0,_0x2d4aa7){return function(_0x493191){if(!_0x493191){_0x3e67e0['sendStatus'](0x194);}return _0x493191;};}function handleError(_0x14bda7,_0x23abdd){_0x23abdd=_0x23abdd||0x1f4;return function(_0x120887){logger[_0x8efd('0x27')](_0x120887[_0x8efd('0x28')]);if(_0x120887[_0x8efd('0x29')]){delete _0x120887[_0x8efd('0x29')];}_0x14bda7[_0x8efd('0x16')](_0x23abdd)[_0x8efd('0x2a')](_0x120887);};}exports[_0x8efd('0x2b')]=function(_0x3daedf,_0x3529b3){var _0xf6b2f={},_0x4e15d8={},_0x13e58c={'count':0x0,'rows':[]};var _0xbb6e89=_[_0x8efd('0x2c')](db[_0x8efd('0x2d')]['rawAttributes'],function(_0x1351e1){return{'name':_0x1351e1['fieldName'],'type':_0x1351e1[_0x8efd('0x2e')][_0x8efd('0x2f')]};});_0x4e15d8[_0x8efd('0x30')]=_['map'](_0xbb6e89,_0x8efd('0x29'));_0x4e15d8[_0x8efd('0x31')]=_[_0x8efd('0x32')](_0x3daedf[_0x8efd('0x31')]);_0x4e15d8[_0x8efd('0x33')]=_['intersection'](_0x4e15d8['model'],_0x4e15d8[_0x8efd('0x31')]);_0xf6b2f[_0x8efd('0x34')]=_[_0x8efd('0x35')](_0x4e15d8[_0x8efd('0x30')],qs[_0x8efd('0x36')](_0x3daedf[_0x8efd('0x31')][_0x8efd('0x36')]));_0xf6b2f[_0x8efd('0x34')]=_0xf6b2f[_0x8efd('0x34')]['length']?_0xf6b2f[_0x8efd('0x34')]:_0x4e15d8[_0x8efd('0x30')];if(!_0x3daedf['query']['hasOwnProperty'](_0x8efd('0x37'))){_0xf6b2f[_0x8efd('0x1b')]=qs['limit'](_0x3daedf[_0x8efd('0x31')][_0x8efd('0x1b')]);_0xf6b2f[_0x8efd('0x19')]=qs[_0x8efd('0x19')](_0x3daedf[_0x8efd('0x31')][_0x8efd('0x19')]);}_0xf6b2f[_0x8efd('0x38')]=qs[_0x8efd('0x39')](_0x3daedf[_0x8efd('0x31')][_0x8efd('0x39')]);_0xf6b2f[_0x8efd('0x3a')]=qs[_0x8efd('0x33')](_[_0x8efd('0x3b')](_0x3daedf[_0x8efd('0x31')],_0x4e15d8[_0x8efd('0x33')]),_0xbb6e89);if(_0x3daedf[_0x8efd('0x31')]['filter']){_0xf6b2f[_0x8efd('0x3a')]=_['merge'](_0xf6b2f[_0x8efd('0x3a')],{'$or':_[_0x8efd('0x2c')](_0xbb6e89,function(_0x2ace52){if(_0x2ace52['type']!==_0x8efd('0x3c')){var _0x16cd27={};_0x16cd27[_0x2ace52[_0x8efd('0x29')]]={'$like':'%'+_0x3daedf[_0x8efd('0x31')][_0x8efd('0x3d')]+'%'};return _0x16cd27;}})});}_0xf6b2f=_[_0x8efd('0x3e')]({},_0xf6b2f,_0x3daedf[_0x8efd('0x3f')]);var _0x57701e={'where':_0xf6b2f[_0x8efd('0x3a')]};return db[_0x8efd('0x2d')][_0x8efd('0x1c')](_0x57701e)['then'](function(_0x47b488){_0x13e58c[_0x8efd('0x1c')]=_0x47b488;if(_0x3daedf['query'][_0x8efd('0x40')]){_0xf6b2f[_0x8efd('0x41')]=[{'all':!![]}];}return db[_0x8efd('0x2d')][_0x8efd('0x42')](_0xf6b2f);})['then'](function(_0x212a82){_0x13e58c[_0x8efd('0x43')]=_0x212a82;return _0x13e58c;})[_0x8efd('0x23')](respondWithFilteredResult(_0x3529b3,_0xf6b2f))[_0x8efd('0x44')](handleError(_0x3529b3,null));};exports[_0x8efd('0x45')]=function(_0x340eaa,_0x33d98f){var _0x53eb2a={'raw':!![],'where':{'id':_0x340eaa[_0x8efd('0x46')]['id']}},_0x245386={};_0x245386[_0x8efd('0x30')]=_[_0x8efd('0x32')](db[_0x8efd('0x2d')][_0x8efd('0x47')]);_0x245386[_0x8efd('0x31')]=_['keys'](_0x340eaa[_0x8efd('0x31')]);_0x245386[_0x8efd('0x33')]=_[_0x8efd('0x35')](_0x245386[_0x8efd('0x30')],_0x245386['query']);_0x53eb2a[_0x8efd('0x34')]=_[_0x8efd('0x35')](_0x245386['model'],qs[_0x8efd('0x36')](_0x340eaa[_0x8efd('0x31')][_0x8efd('0x36')]));_0x53eb2a[_0x8efd('0x34')]=_0x53eb2a[_0x8efd('0x34')]['length']?_0x53eb2a[_0x8efd('0x34')]:_0x245386[_0x8efd('0x30')];if(_0x340eaa[_0x8efd('0x31')]['includeAll']){_0x53eb2a['include']=[{'all':!![]}];}_0x53eb2a=_['merge']({},_0x53eb2a,_0x340eaa[_0x8efd('0x3f')]);return db[_0x8efd('0x2d')]['find'](_0x53eb2a)[_0x8efd('0x23')](handleEntityNotFound(_0x33d98f,null))[_0x8efd('0x23')](respondWithResult(_0x33d98f,null))['catch'](handleError(_0x33d98f,null));};exports['create']=function(_0x4eb397,_0x39a4f5){return db['Disposition'][_0x8efd('0x48')](_0x4eb397[_0x8efd('0x49')],{})[_0x8efd('0x23')](function(_0x533666){var _0x493b3d=_0x4eb397[_0x8efd('0x4a')][_0x8efd('0x25')]({'plain':!![]});if(!_0x493b3d)throw new Error(_0x8efd('0x4b'));if(_0x493b3d['role']===_0x8efd('0x4a')){var _0x30476e=_0x533666['get']({'plain':!![]});var _0x21536b=_0x8efd('0x4c');return db[_0x8efd('0x4d')]['find']({'where':{'name':_0x21536b,'userProfileId':_0x493b3d['userProfileId']},'raw':!![]})[_0x8efd('0x23')](function(_0x1c53d8){if(_0x1c53d8&&_0x1c53d8[_0x8efd('0x4e')]===0x0){return db[_0x8efd('0x26')]['create']({'name':_0x30476e[_0x8efd('0x29')],'resourceId':_0x30476e['id'],'type':_0x1c53d8['name'],'sectionId':_0x1c53d8['id']},{})['then'](function(){return _0x533666;});}else{return _0x533666;}})[_0x8efd('0x44')](function(_0x31fc0b){logger[_0x8efd('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31fc0b);throw _0x31fc0b;});}return _0x533666;})[_0x8efd('0x23')](respondWithResult(_0x39a4f5,0xc9))[_0x8efd('0x44')](handleError(_0x39a4f5,null));};exports[_0x8efd('0x22')]=function(_0x1d472c,_0x4f3969){if(_0x1d472c[_0x8efd('0x49')]['id']){delete _0x1d472c[_0x8efd('0x49')]['id'];}return db[_0x8efd('0x2d')][_0x8efd('0x4f')]({'where':{'id':_0x1d472c[_0x8efd('0x46')]['id']}})[_0x8efd('0x23')](handleEntityNotFound(_0x4f3969,null))[_0x8efd('0x23')](saveUpdates(_0x1d472c['body'],null))[_0x8efd('0x23')](respondWithResult(_0x4f3969,null))['catch'](handleError(_0x4f3969,null));};exports['destroy']=function(_0x4f6068,_0x3982fd){return db[_0x8efd('0x2d')][_0x8efd('0x4f')]({'where':{'id':_0x4f6068[_0x8efd('0x46')]['id']}})[_0x8efd('0x23')](handleEntityNotFound(_0x3982fd,null))[_0x8efd('0x23')](removeEntity(_0x3982fd,null))['catch'](handleError(_0x3982fd,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4628b4c..f51e5f5 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 _0xcf85=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','name_voice','name','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','name_whatsapp'];(function(_0x1f962b,_0x52d84a){var _0x39007f=function(_0x167b82){while(--_0x167b82){_0x1f962b['push'](_0x1f962b['shift']());}};_0x39007f(++_0x52d84a);}(_0xcf85,0x90));var _0x5cf8=function(_0x5afacf,_0x3c8414){_0x5afacf=_0x5afacf-0x0;var _0x3e2c16=_0xcf85[_0x5afacf];return _0x3e2c16;};'use strict';var _=require(_0x5cf8('0x0'));var util=require(_0x5cf8('0x1'));var logger=require('../../config/logger')(_0x5cf8('0x2'));var moment=require(_0x5cf8('0x3'));var BPromise=require(_0x5cf8('0x4'));var rp=require(_0x5cf8('0x5'));var fs=require('fs');var path=require(_0x5cf8('0x6'));var rimraf=require(_0x5cf8('0x7'));var config=require('../../config/environment');var attributes=require(_0x5cf8('0x8'));module[_0x5cf8('0x9')]=function(_0x4e4b7b,_0x2224aa){return _0x4e4b7b[_0x5cf8('0xa')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x5cf8('0xb'),'fields':['name','ListId']},{'unique':!![],'name':'name_chat','fields':[_0x5cf8('0xc'),_0x5cf8('0xd')]},{'unique':!![],'name':'name_mail','fields':['name',_0x5cf8('0xe')]},{'unique':!![],'name':'name_sms','fields':['name',_0x5cf8('0xf')]},{'unique':!![],'name':_0x5cf8('0x10'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x5cf8('0x11'),'fields':[_0x5cf8('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6012=['util','moment','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel','name_whatsapp','lodash'];(function(_0x9dfbcf,_0x4469f4){var _0x19cc2c=function(_0x350860){while(--_0x350860){_0x9dfbcf['push'](_0x9dfbcf['shift']());}};_0x19cc2c(++_0x4469f4);}(_0x6012,0x6d));var _0x2601=function(_0x3238ea,_0x91809d){_0x3238ea=_0x3238ea-0x0;var _0x4aaac2=_0x6012[_0x3238ea];return _0x4aaac2;};'use strict';var _=require(_0x2601('0x0'));var util=require(_0x2601('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2601('0x2'));var BPromise=require('bluebird');var rp=require(_0x2601('0x3'));var fs=require('fs');var path=require(_0x2601('0x4'));var rimraf=require(_0x2601('0x5'));var config=require('../../config/environment');var attributes=require(_0x2601('0x6'));module[_0x2601('0x7')]=function(_0xb77728,_0x20b4a6){return _0xb77728[_0x2601('0x8')](_0x2601('0x9'),attributes,{'tableName':_0x2601('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2601('0xb'),'fields':[_0x2601('0xc'),_0x2601('0xd')]},{'unique':!![],'name':_0x2601('0xe'),'fields':['name',_0x2601('0xf')]},{'unique':!![],'name':_0x2601('0x10'),'fields':[_0x2601('0xc'),_0x2601('0x11')]},{'unique':!![],'name':_0x2601('0x12'),'fields':[_0x2601('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x2601('0x13'),'fields':['name','FaxAccountId']},{'unique':!![],'name':_0x2601('0x14'),'fields':[_0x2601('0xc'),'OpenchannelAccountId']},{'unique':!![],'name':_0x2601('0x15'),'fields':[_0x2601('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 5f0ecd3..8821f26 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(_0x24cb09,_0x45c503){var _0x169413=function(_0x2c7361){while(--_0x2c7361){_0x24cb09['push'](_0x24cb09['shift']());}};_0x169413(++_0x45c503);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x313dbe,_0x438305){var _0x36b6f3=function(_0x80cc43){while(--_0x80cc43){_0x313dbe['push'](_0x313dbe['shift']());}};_0x36b6f3(++_0x438305);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 a3904b7..48407c0 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 _0xdda6=['isAuthenticated','create','put','/:id','delete','exports','multer','path','connect-timeout','../../components/auth/service','index'];(function(_0x4c66b8,_0x48f5cf){var _0x328221=function(_0x572ebc){while(--_0x572ebc){_0x4c66b8['push'](_0x4c66b8['shift']());}};_0x328221(++_0x48f5cf);}(_0xdda6,0xd7));var _0x6dda=function(_0x47f038,_0x68f37b){_0x47f038=_0x47f038-0x0;var _0x211674=_0xdda6[_0x47f038];return _0x211674;};'use strict';var multer=require(_0x6dda('0x0'));var util=require('util');var path=require(_0x6dda('0x1'));var timeout=require(_0x6dda('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6dda('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6dda('0x4')]);router['get']('/:id',auth[_0x6dda('0x5')](),controller['show']);router['post']('/',auth[_0x6dda('0x5')](),controller[_0x6dda('0x6')]);router[_0x6dda('0x7')](_0x6dda('0x8'),auth[_0x6dda('0x5')](),controller['update']);router[_0x6dda('0x9')](_0x6dda('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x6dda('0xa')]=router; \ No newline at end of file +var _0xdb60=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','create','/:id'];(function(_0x3c22eb,_0x325218){var _0x5d3f47=function(_0x470f2a){while(--_0x470f2a){_0x3c22eb['push'](_0x3c22eb['shift']());}};_0x5d3f47(++_0x325218);}(_0xdb60,0x17a));var _0x0db6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdb60[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0db6('0x0'));var util=require(_0x0db6('0x1'));var path=require(_0x0db6('0x2'));var timeout=require(_0x0db6('0x3'));var express=require(_0x0db6('0x4'));var router=express['Router']();var fs_extra=require(_0x0db6('0x5'));var auth=require(_0x0db6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0db6('0x7'));var controller=require(_0x0db6('0x8'));router[_0x0db6('0x9')]('/',auth[_0x0db6('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0db6('0xb')]);router['put'](_0x0db6('0xc'),auth[_0x0db6('0xa')](),controller[_0x0db6('0xd')]);router[_0x0db6('0xe')](_0x0db6('0xc'),auth['isAuthenticated'](),controller[_0x0db6('0xf')]);module[_0x0db6('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index e4423e2..a6c6d3b 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 _0xbff5=['v17,v27,v29','INTEGER','SIP','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400'];(function(_0x4018bc,_0x80171a){var _0x30ca4f=function(_0x470e65){while(--_0x470e65){_0x4018bc['push'](_0x4018bc['shift']());}};_0x30ca4f(++_0x80171a);}(_0xbff5,0x1bc));var _0x5bff=function(_0x551f52,_0x5b1c05){_0x551f52=_0x551f52-0x0;var _0x194d20=_0xbff5[_0x551f52];return _0x194d20;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'name':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5bff('0x2')]},'ecm':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x4'),'no'),'defaultValue':_0x5bff('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x6'),_0x5bff('0x7'),_0x5bff('0x8'),_0x5bff('0x9'),_0x5bff('0xa'),_0x5bff('0xb')),'defaultValue':_0x5bff('0x7')},'maxrate':{'type':Sequelize[_0x5bff('0x3')]('2400',_0x5bff('0x7'),'7200',_0x5bff('0x9'),_0x5bff('0xa'),'14400'),'defaultValue':_0x5bff('0xb')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5bff('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5bff('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5bff('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5bff('0xe'),'IAX',_0x5bff('0xf'),_0x5bff('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5bff('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5bff('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x5bff('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5bff('0x12')],'defaultValue':![],'comment':_0x5bff('0x14'),'set':function(_0x546351){if(!_0x546351)this[_0x5bff('0x15')](_0x5bff('0x16'),null);this[_0x5bff('0x15')](_0x5bff('0x17'),_0x546351);}}}; \ No newline at end of file +var _0x1dcc=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','12000','14400','ENUM','9600','v17,v27,v29','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3b12e2,_0x4a60b0){_0x3b12e2=_0x3b12e2-0x0;var _0x3283d6=_0x1dcc[_0x3b12e2];return _0x3283d6;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc1dc('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xc1dc('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':_0xc1dc('0x4')},'localstationid':{'type':Sequelize[_0xc1dc('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0xc1dc('0x5'),_0xc1dc('0x6'),_0xc1dc('0x7'),'9600',_0xc1dc('0x8'),_0xc1dc('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc1dc('0xa')]('2400',_0xc1dc('0x6'),'7200',_0xc1dc('0xb'),_0xc1dc('0x8'),_0xc1dc('0x9')),'defaultValue':_0xc1dc('0x9')},'modem':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':_0xc1dc('0xc')},'gateway':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc1dc('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc1dc('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc1dc('0xe'),_0xc1dc('0xf'),_0xc1dc('0x10'),'KHOMP'),'defaultValue':_0xc1dc('0xe')},'key':{'type':Sequelize[_0xc1dc('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc1dc('0x11')],'defaultValue':function(){return _0xc1dc('0x12');}},'notificationSound':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc1dc('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc1dc('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xc1dc('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc1dc('0x13')],'defaultValue':![],'comment':_0xc1dc('0x15'),'set':function(_0x47c72e){if(!_0x47c72e)this[_0xc1dc('0x16')](_0xc1dc('0x17'),null);this['setDataValue']('mandatoryDisposition',_0x47c72e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 50540eb..36ebdf1 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 _0x07fd=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','FaxAccount','includeAll','include','rows','show','params','Pause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','internal','Tag','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','getApplications','context','from-voip-provider','app','type','system','description','Fax\x20Extension','appdata','push','Set','localstationid','faxdetect','headerinfo','maxrate','modem','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','transaction','bulkCreate','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','User','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1adb0f,_0x8d949e){var _0x494a34=function(_0x5a227e){while(--_0x5a227e){_0x1adb0f['push'](_0x1adb0f['shift']());}};_0x494a34(++_0x8d949e);}(_0x07fd,0x16c));var _0xd07f=function(_0x4bb730,_0x25cbee){_0x4bb730=_0x4bb730-0x0;var _0x4c0897=_0x07fd[_0x4bb730];return _0x4c0897;};'use strict';var emlformat=require(_0xd07f('0x0'));var rimraf=require(_0xd07f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd07f('0x2'));var rp=require('request-promise');var moment=require(_0xd07f('0x3'));var BPromise=require(_0xd07f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd07f('0x5'));var sox=require(_0xd07f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd07f('0x7'));var squel=require(_0xd07f('0x8'));var crypto=require(_0xd07f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd07f('0xa'));var toCsv=require(_0xd07f('0xb'));var querystring=require(_0xd07f('0xc'));var Papa=require(_0xd07f('0xd'));var Redis=require(_0xd07f('0xe'));var authService=require(_0xd07f('0xf'));var qs=require(_0xd07f('0x10'));var as=require(_0xd07f('0x11'));var hardwareService=require(_0xd07f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xd07f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd07f('0x14')]=_[_0xd07f('0x15')](config[_0xd07f('0x14')],{'host':_0xd07f('0x16'),'port':0x18eb});var socket=require(_0xd07f('0x17'))(new Redis(config[_0xd07f('0x14')]));require(_0xd07f('0x18'))[_0xd07f('0x19')](socket);var jayson=require(_0xd07f('0x1a'));var client=jayson[_0xd07f('0x1b')][_0xd07f('0x1c')]({'port':0x232c});var client9002=jayson[_0xd07f('0x1b')][_0xd07f('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2a5a0c,_0x5d6a31,_0xe0b2bc,_0x4efcda){return new BPromise(function(_0x205c0d,_0x205362){var _0x15f576=_0x4efcda||client;return _0x15f576[_0xd07f('0x1d')](_0x2a5a0c,_0xe0b2bc)[_0xd07f('0x1e')](function(_0x1601c2){logger[_0xd07f('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x5d6a31,'request\x20sent');logger['debug'](_0xd07f('0x20'),_0x5d6a31,_0xd07f('0x21'),JSON[_0xd07f('0x22')](_0x1601c2));if(_0x1601c2[_0xd07f('0x23')]){if(_0x1601c2['error']['code']===0x1f4){logger['error'](_0xd07f('0x24'),_0x5d6a31,_0x1601c2[_0xd07f('0x23')][_0xd07f('0x25')]);return _0x205362(_0x1601c2['error'][_0xd07f('0x25')]);}logger[_0xd07f('0x23')](_0xd07f('0x24'),_0x5d6a31,_0x1601c2[_0xd07f('0x23')]['message']);return _0x205c0d(_0x1601c2[_0xd07f('0x23')][_0xd07f('0x25')]);}else{logger['info'](_0xd07f('0x24'),_0x5d6a31,_0xd07f('0x21'));_0x205c0d(_0x1601c2[_0xd07f('0x26')]['message']);}})[_0xd07f('0x27')](function(_0x240c7){logger[_0xd07f('0x23')](_0xd07f('0x24'),_0x5d6a31,_0x240c7);_0x205362(_0x240c7);});});}function respondWithStatusCode(_0x69f75a,_0x5b0b4b){_0x5b0b4b=_0x5b0b4b||0xcc;return function(_0x1ebfe8){if(_0x1ebfe8){return _0x69f75a[_0xd07f('0x28')](_0x5b0b4b);}return _0x69f75a[_0xd07f('0x29')](_0x5b0b4b)[_0xd07f('0x2a')]();};}function respondWithResult(_0x428a1a,_0x40e5d5){_0x40e5d5=_0x40e5d5||0xc8;return function(_0x36155){if(_0x36155){return _0x428a1a[_0xd07f('0x29')](_0x40e5d5)[_0xd07f('0x2b')](_0x36155);}};}function respondWithFilteredResult(_0xa92698,_0x296f80){return function(_0x2d44ca){if(_0x2d44ca){var _0x570d28=typeof _0x296f80[_0xd07f('0x2c')]===_0xd07f('0x2d')&&typeof _0x296f80[_0xd07f('0x2e')]==='undefined';var _0x9077a6=_0x2d44ca[_0xd07f('0x2f')];var _0x500f83=_0x570d28?0x0:_0x296f80[_0xd07f('0x2c')];var _0x14896f=_0x570d28?_0x2d44ca['count']:_0x296f80['offset']+_0x296f80['limit'];var _0x507384;if(_0x14896f>=_0x9077a6){_0x14896f=_0x9077a6;_0x507384=0xc8;}else{_0x507384=0xce;}_0xa92698[_0xd07f('0x29')](_0x507384);return _0xa92698[_0xd07f('0x30')](_0xd07f('0x31'),_0x500f83+'-'+_0x14896f+'/'+_0x9077a6)[_0xd07f('0x2b')](_0x2d44ca);}return null;};}function patchUpdates(_0x40c701){return function(_0x4c3d95){try{jsonpatch[_0xd07f('0x32')](_0x4c3d95,_0x40c701,!![]);}catch(_0x134d61){return BPromise[_0xd07f('0x33')](_0x134d61);}return _0x4c3d95[_0xd07f('0x34')]();};}function saveUpdates(_0x5aa9d9,_0x48477a){return function(_0x4c388d){if(_0x4c388d){return _0x4c388d[_0xd07f('0x35')](_0x5aa9d9)[_0xd07f('0x1e')](function(_0x2ff95d){return _0x2ff95d;});}return null;};}function removeEntity(_0x9a83d,_0x158cb2){return function(_0x117677){if(_0x117677){return _0x117677[_0xd07f('0x36')]()[_0xd07f('0x1e')](function(){var _0x382412=_0x117677[_0xd07f('0x37')]({'plain':!![]});var _0x1fb730='FaxAccounts';return db[_0xd07f('0x38')][_0xd07f('0x36')]({'where':{'type':_0x1fb730,'resourceId':_0x382412['id']}})[_0xd07f('0x1e')](function(){return _0x117677;});})[_0xd07f('0x1e')](function(){_0x9a83d[_0xd07f('0x29')](0xcc)[_0xd07f('0x2a')]();});}};}function handleEntityNotFound(_0x4ed018,_0xcd1ffe){return function(_0x438ca8){if(!_0x438ca8){_0x4ed018[_0xd07f('0x28')](0x194);}return _0x438ca8;};}function handleError(_0x230217,_0xed05bc){_0xed05bc=_0xed05bc||0x1f4;return function(_0x1e7885){logger[_0xd07f('0x23')](_0x1e7885[_0xd07f('0x39')]);if(_0x1e7885['name']){delete _0x1e7885[_0xd07f('0x3a')];}_0x230217[_0xd07f('0x29')](_0xed05bc)[_0xd07f('0x3b')](_0x1e7885);};}exports[_0xd07f('0x3c')]=function(_0x203d80,_0xe5a6b2){var _0x4d3d8a={'include':[{'model':db['Pause'],'as':_0xd07f('0x3d')}]},_0x10a52a={},_0x405afa={'count':0x0,'rows':[]};var _0x30cf4f=_['map'](db['FaxAccount'][_0xd07f('0x3e')],function(_0x53ac8b){return{'name':_0x53ac8b[_0xd07f('0x3f')],'type':_0x53ac8b['type'][_0xd07f('0x40')]};});_0x10a52a[_0xd07f('0x41')]=_[_0xd07f('0x42')](_0x30cf4f,_0xd07f('0x3a'));_0x10a52a['query']=_['keys'](_0x203d80[_0xd07f('0x43')]);_0x10a52a[_0xd07f('0x44')]=_[_0xd07f('0x45')](_0x10a52a[_0xd07f('0x41')],_0x10a52a['query']);_0x4d3d8a[_0xd07f('0x46')]=_[_0xd07f('0x45')](_0x10a52a[_0xd07f('0x41')],qs[_0xd07f('0x47')](_0x203d80['query'][_0xd07f('0x47')]));_0x4d3d8a[_0xd07f('0x46')]=_0x4d3d8a['attributes'][_0xd07f('0x48')]?_0x4d3d8a[_0xd07f('0x46')]:_0x10a52a[_0xd07f('0x41')];if(!_0x203d80['query'][_0xd07f('0x49')]('nolimit')){_0x4d3d8a[_0xd07f('0x2e')]=qs[_0xd07f('0x2e')](_0x203d80[_0xd07f('0x43')][_0xd07f('0x2e')]);_0x4d3d8a[_0xd07f('0x2c')]=qs[_0xd07f('0x2c')](_0x203d80[_0xd07f('0x43')][_0xd07f('0x2c')]);}_0x4d3d8a['order']=qs[_0xd07f('0x4a')](_0x203d80[_0xd07f('0x43')][_0xd07f('0x4a')]);_0x4d3d8a['where']=qs[_0xd07f('0x44')](_[_0xd07f('0x4b')](_0x203d80['query'],_0x10a52a['filters']),_0x30cf4f);if(_0x203d80[_0xd07f('0x43')][_0xd07f('0x4c')]){_0x4d3d8a[_0xd07f('0x4d')]=_['merge'](_0x4d3d8a[_0xd07f('0x4d')],{'$or':_['map'](_0x30cf4f,function(_0x4ab0b2){if(_0x4ab0b2['type']!==_0xd07f('0x4e')){var _0x1bd491={};_0x1bd491[_0x4ab0b2[_0xd07f('0x3a')]]={'$like':'%'+_0x203d80[_0xd07f('0x43')][_0xd07f('0x4c')]+'%'};return _0x1bd491;}})});}_0x4d3d8a=_[_0xd07f('0x4f')]({},_0x4d3d8a,_0x203d80[_0xd07f('0x50')]);var _0x2a5672={'where':_0x4d3d8a[_0xd07f('0x4d')]};return db[_0xd07f('0x51')][_0xd07f('0x2f')](_0x2a5672)[_0xd07f('0x1e')](function(_0x4664d6){_0x405afa['count']=_0x4664d6;if(_0x203d80['query'][_0xd07f('0x52')]){_0x4d3d8a[_0xd07f('0x53')]=[{'all':!![]}];}return db[_0xd07f('0x51')]['findAll'](_0x4d3d8a);})[_0xd07f('0x1e')](function(_0x558d76){_0x405afa[_0xd07f('0x54')]=_0x558d76;return _0x405afa;})['then'](respondWithFilteredResult(_0xe5a6b2,_0x4d3d8a))[_0xd07f('0x27')](handleError(_0xe5a6b2,null));};exports[_0xd07f('0x55')]=function(_0xd0db1,_0x563305){var _0x366b22={'raw':![],'where':{'id':_0xd0db1[_0xd07f('0x56')]['id']},'include':[{'model':db[_0xd07f('0x57')],'as':_0xd07f('0x3d')}]},_0x294d43={};_0x294d43[_0xd07f('0x41')]=_[_0xd07f('0x58')](db['FaxAccount'][_0xd07f('0x3e')]);_0x294d43[_0xd07f('0x43')]=_[_0xd07f('0x58')](_0xd0db1['query']);_0x294d43[_0xd07f('0x44')]=_[_0xd07f('0x45')](_0x294d43[_0xd07f('0x41')],_0x294d43[_0xd07f('0x43')]);_0x366b22[_0xd07f('0x46')]=_[_0xd07f('0x45')](_0x294d43['model'],qs[_0xd07f('0x47')](_0xd0db1[_0xd07f('0x43')][_0xd07f('0x47')]));_0x366b22[_0xd07f('0x46')]=_0x366b22[_0xd07f('0x46')][_0xd07f('0x48')]?_0x366b22[_0xd07f('0x46')]:_0x294d43[_0xd07f('0x41')];if(_0xd0db1[_0xd07f('0x43')]['includeAll']){_0x366b22[_0xd07f('0x53')]=[{'all':!![]}];}_0x366b22=_[_0xd07f('0x4f')]({},_0x366b22,_0xd0db1[_0xd07f('0x50')]);return db[_0xd07f('0x51')][_0xd07f('0x59')](_0x366b22)[_0xd07f('0x1e')](handleEntityNotFound(_0x563305,null))[_0xd07f('0x1e')](respondWithResult(_0x563305,null))[_0xd07f('0x27')](handleError(_0x563305,null));};exports[_0xd07f('0x5a')]=function(_0x3b4ef2,_0x44dc54){return db[_0xd07f('0x51')]['create'](_0x3b4ef2['body'],{})[_0xd07f('0x1e')](function(_0x1bc3be){var _0x14b2b0=_0x3b4ef2[_0xd07f('0x5b')]['get']({'plain':!![]});if(!_0x14b2b0)throw new Error(_0xd07f('0x5c'));if(_0x14b2b0[_0xd07f('0x5d')]===_0xd07f('0x5b')){var _0xaea531=_0x1bc3be[_0xd07f('0x37')]({'plain':!![]});var _0xe1643d=_0xd07f('0x5e');return db['UserProfileSection'][_0xd07f('0x59')]({'where':{'name':_0xe1643d,'userProfileId':_0x14b2b0['userProfileId']},'raw':!![]})[_0xd07f('0x1e')](function(_0x47d228){if(_0x47d228&&_0x47d228[_0xd07f('0x5f')]===0x0){return db[_0xd07f('0x38')]['create']({'name':_0xaea531[_0xd07f('0x3a')],'resourceId':_0xaea531['id'],'type':_0x47d228[_0xd07f('0x3a')],'sectionId':_0x47d228['id']},{})[_0xd07f('0x1e')](function(){return _0x1bc3be;});}else{return _0x1bc3be;}})[_0xd07f('0x27')](function(_0x1b0554){logger['error'](_0xd07f('0x60'),_0x1b0554);throw _0x1b0554;});}return _0x1bc3be;})[_0xd07f('0x1e')](respondWithResult(_0x44dc54,0xc9))[_0xd07f('0x27')](handleError(_0x44dc54,null));};exports['update']=function(_0x55e1be,_0x4a6180){if(_0x55e1be[_0xd07f('0x61')]['id']){delete _0x55e1be[_0xd07f('0x61')]['id'];}return db['FaxAccount'][_0xd07f('0x59')]({'where':{'id':_0x55e1be[_0xd07f('0x56')]['id']},'include':[{'model':db[_0xd07f('0x57')],'as':_0xd07f('0x3d')}]})[_0xd07f('0x1e')](handleEntityNotFound(_0x4a6180,null))['then'](saveUpdates(_0x55e1be['body'],null))[_0xd07f('0x1e')](respondWithResult(_0x4a6180,null))[_0xd07f('0x27')](handleError(_0x4a6180,null));};exports[_0xd07f('0x36')]=function(_0x4318ed,_0x30e8aa){return db[_0xd07f('0x51')][_0xd07f('0x59')]({'where':{'id':_0x4318ed['params']['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x30e8aa,null))[_0xd07f('0x1e')](removeEntity(_0x30e8aa,null))[_0xd07f('0x27')](handleError(_0x30e8aa,null));};exports[_0xd07f('0x62')]=function(_0x494221,_0x23bad6){return db['FaxAccount'][_0xd07f('0x62')]()[_0xd07f('0x1e')](respondWithResult(_0x23bad6,null))[_0xd07f('0x27')](handleError(_0x23bad6,null));};exports[_0xd07f('0x63')]=function(_0x625262,_0x4b4c43,_0x29f9ea){if(_0x625262[_0xd07f('0x61')]['id']){delete _0x625262[_0xd07f('0x61')]['id'];}return db['FaxAccount'][_0xd07f('0x59')]({'where':{'id':_0x625262[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x4b4c43,null))[_0xd07f('0x1e')](function(_0x132af1){if(_0x132af1){_0x625262['body'][_0xd07f('0x64')]=_0x132af1['id'];return db['Disposition'][_0xd07f('0x5a')](_0x625262['body']);}})[_0xd07f('0x1e')](respondWithResult(_0x4b4c43,null))[_0xd07f('0x27')](handleError(_0x4b4c43,null));};exports[_0xd07f('0x65')]=function(_0x30f5ef,_0x2d0d34,_0x2e6b2d){var _0x4089f9={'raw':![],'where':{}};var _0x416e1c={};var _0x42176f={'count':0x0,'rows':[]};return db[_0xd07f('0x51')][_0xd07f('0x66')]({'where':{'id':_0x30f5ef['params']['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x2d0d34,null))['then'](function(_0x1f08ab){if(_0x1f08ab){_0x416e1c[_0xd07f('0x41')]=_['keys'](db[_0xd07f('0x67')]['rawAttributes']);_0x416e1c['query']=_['keys'](_0x30f5ef[_0xd07f('0x43')]);_0x416e1c[_0xd07f('0x44')]=_[_0xd07f('0x45')](_0x416e1c['model'],_0x416e1c[_0xd07f('0x43')]);_0x4089f9['attributes']=_[_0xd07f('0x45')](_0x416e1c[_0xd07f('0x41')],qs['fields'](_0x30f5ef[_0xd07f('0x43')]['fields']));_0x4089f9[_0xd07f('0x46')]=_0x4089f9[_0xd07f('0x46')][_0xd07f('0x48')]?_0x4089f9[_0xd07f('0x46')]:_0x416e1c[_0xd07f('0x41')];if(!_0x30f5ef['query'][_0xd07f('0x49')]('nolimit')){_0x4089f9['limit']=qs[_0xd07f('0x2e')](_0x30f5ef[_0xd07f('0x43')][_0xd07f('0x2e')]);_0x4089f9[_0xd07f('0x2c')]=qs[_0xd07f('0x2c')](_0x30f5ef[_0xd07f('0x43')][_0xd07f('0x2c')]);}_0x4089f9[_0xd07f('0x68')]=qs[_0xd07f('0x4a')](_0x30f5ef[_0xd07f('0x43')][_0xd07f('0x4a')]);_0x4089f9[_0xd07f('0x4d')]=qs['filters'](_['pick'](_0x30f5ef[_0xd07f('0x43')],_0x416e1c[_0xd07f('0x44')]));_0x4089f9[_0xd07f('0x4d')][_0xd07f('0x64')]=_0x1f08ab['id'];if(_0x30f5ef[_0xd07f('0x43')][_0xd07f('0x4c')]){_0x4089f9['where']=_[_0xd07f('0x4f')](_0x4089f9[_0xd07f('0x4d')],{'$or':_[_0xd07f('0x42')](_0x4089f9['attributes'],function(_0x291f00){var _0x1a3e2a={};_0x1a3e2a[_0x291f00]={'$like':'%'+_0x30f5ef[_0xd07f('0x43')][_0xd07f('0x4c')]+'%'};return _0x1a3e2a;})});}_0x4089f9=_[_0xd07f('0x4f')]({},_0x4089f9,_0x30f5ef['options']);return db['Disposition']['count']({'where':_0x4089f9['where']})[_0xd07f('0x1e')](function(_0x486d5a){_0x42176f[_0xd07f('0x2f')]=_0x486d5a;if(_0x30f5ef[_0xd07f('0x43')][_0xd07f('0x52')]){_0x4089f9[_0xd07f('0x53')]=[{'all':!![]}];}return db[_0xd07f('0x67')][_0xd07f('0x69')](_0x4089f9);})[_0xd07f('0x1e')](function(_0xef5e97){_0x42176f[_0xd07f('0x54')]=_0xef5e97;return _0x42176f;});}})['then'](respondWithFilteredResult(_0x2d0d34,_0x4089f9))[_0xd07f('0x27')](handleError(_0x2d0d34,null));};exports[_0xd07f('0x6a')]=function(_0xd6a590,_0x25c99e,_0x25e624){return db[_0xd07f('0x51')][_0xd07f('0x59')]({'where':{'id':_0xd6a590['params']['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x25c99e,null))[_0xd07f('0x1e')](function(_0x5c577e){if(_0x5c577e){return _0x5c577e[_0xd07f('0x6a')](_0xd6a590[_0xd07f('0x43')][_0xd07f('0x6b')]);}})[_0xd07f('0x1e')](respondWithStatusCode(_0x25c99e,null))[_0xd07f('0x27')](handleError(_0x25c99e,null));};exports[_0xd07f('0x6c')]=function(_0x27adf5,_0x50333b,_0x2d5b43){if(_0x27adf5[_0xd07f('0x61')]['id']){delete _0x27adf5[_0xd07f('0x61')]['id'];}return db['FaxAccount'][_0xd07f('0x59')]({'where':{'id':_0x27adf5[_0xd07f('0x56')]['id']}})['then'](handleEntityNotFound(_0x50333b,null))['then'](function(_0x25d64f){if(_0x25d64f){_0x27adf5[_0xd07f('0x61')][_0xd07f('0x64')]=_0x25d64f['id'];return db[_0xd07f('0x6d')][_0xd07f('0x5a')](_0x27adf5['body']);}})[_0xd07f('0x1e')](respondWithResult(_0x50333b,null))[_0xd07f('0x27')](handleError(_0x50333b,null));};exports[_0xd07f('0x6e')]=function(_0x97adf3,_0x2e35e3,_0x31dd04){var _0x558393={'raw':![],'where':{}};var _0x62f79a={};var _0x591f86={'count':0x0,'rows':[]};return db[_0xd07f('0x51')][_0xd07f('0x66')]({'where':{'id':_0x97adf3[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x2e35e3,null))[_0xd07f('0x1e')](function(_0x476b78){if(_0x476b78){_0x62f79a['model']=_[_0xd07f('0x58')](db[_0xd07f('0x6d')]['rawAttributes']);_0x62f79a['query']=_[_0xd07f('0x58')](_0x97adf3[_0xd07f('0x43')]);_0x62f79a[_0xd07f('0x44')]=_[_0xd07f('0x45')](_0x62f79a[_0xd07f('0x41')],_0x62f79a[_0xd07f('0x43')]);_0x558393[_0xd07f('0x46')]=_[_0xd07f('0x45')](_0x62f79a[_0xd07f('0x41')],qs[_0xd07f('0x47')](_0x97adf3[_0xd07f('0x43')][_0xd07f('0x47')]));_0x558393[_0xd07f('0x46')]=_0x558393[_0xd07f('0x46')][_0xd07f('0x48')]?_0x558393[_0xd07f('0x46')]:_0x62f79a[_0xd07f('0x41')];if(!_0x97adf3[_0xd07f('0x43')][_0xd07f('0x49')](_0xd07f('0x6f'))){_0x558393['limit']=qs[_0xd07f('0x2e')](_0x97adf3[_0xd07f('0x43')][_0xd07f('0x2e')]);_0x558393['offset']=qs[_0xd07f('0x2c')](_0x97adf3[_0xd07f('0x43')]['offset']);}_0x558393[_0xd07f('0x68')]=qs[_0xd07f('0x4a')](_0x97adf3[_0xd07f('0x43')]['sort']);_0x558393[_0xd07f('0x4d')]=qs[_0xd07f('0x44')](_[_0xd07f('0x4b')](_0x97adf3[_0xd07f('0x43')],_0x62f79a[_0xd07f('0x44')]));_0x558393[_0xd07f('0x4d')][_0xd07f('0x64')]=_0x476b78['id'];if(_0x97adf3['query'][_0xd07f('0x4c')]){_0x558393[_0xd07f('0x4d')]=_['merge'](_0x558393['where'],{'$or':_[_0xd07f('0x42')](_0x558393[_0xd07f('0x46')],function(_0x4a5879){var _0x3b935b={};_0x3b935b[_0x4a5879]={'$like':'%'+_0x97adf3['query'][_0xd07f('0x4c')]+'%'};return _0x3b935b;})});}_0x558393=_['merge']({},_0x558393,_0x97adf3[_0xd07f('0x50')]);return db[_0xd07f('0x6d')]['count']({'where':_0x558393[_0xd07f('0x4d')]})[_0xd07f('0x1e')](function(_0x34b5c2){_0x591f86[_0xd07f('0x2f')]=_0x34b5c2;if(_0x97adf3[_0xd07f('0x43')][_0xd07f('0x52')]){_0x558393[_0xd07f('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd07f('0x69')](_0x558393);})[_0xd07f('0x1e')](function(_0x5b39c8){_0x591f86[_0xd07f('0x54')]=_0x5b39c8;return _0x591f86;});}})[_0xd07f('0x1e')](respondWithFilteredResult(_0x2e35e3,_0x558393))[_0xd07f('0x27')](handleError(_0x2e35e3,null));};exports['removeAnswers']=function(_0x10be95,_0x4957b7,_0x1949b6){return db[_0xd07f('0x51')]['find']({'where':{'id':_0x10be95[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x4957b7,null))[_0xd07f('0x1e')](function(_0x5823a7){if(_0x5823a7){return _0x5823a7['removeAnswers'](_0x10be95[_0xd07f('0x43')]['ids']);}})[_0xd07f('0x1e')](respondWithStatusCode(_0x4957b7,null))['catch'](handleError(_0x4957b7,null));};exports[_0xd07f('0x70')]=function(_0x187bb8,_0x2091fe,_0x14b45e){return db[_0xd07f('0x71')][_0xd07f('0x59')]({'where':{'id':_0x187bb8[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x2091fe,null))[_0xd07f('0x1e')](function(_0x3cf883){if(_0x3cf883){return _0x3cf883[_0xd07f('0x70')](_0x187bb8['body'][_0xd07f('0x6b')],_[_0xd07f('0x72')](_0x187bb8[_0xd07f('0x61')],[_0xd07f('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x2091fe,null))[_0xd07f('0x27')](handleError(_0x2091fe,null));};exports[_0xd07f('0x73')]=function(_0x990ba5,_0x425f2f,_0x93f8b){var _0x32ac57={'raw':![],'where':{}};var _0x3f1619={};var _0x85ceaf={'count':0x0,'rows':[]};return db[_0xd07f('0x51')][_0xd07f('0x66')]({'where':{'id':_0x990ba5[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x425f2f,null))[_0xd07f('0x1e')](function(_0x432e87){if(_0x432e87){_0x3f1619[_0xd07f('0x41')]=_['keys'](db[_0xd07f('0x71')][_0xd07f('0x3e')]);_0x3f1619[_0xd07f('0x43')]=_[_0xd07f('0x58')](_0x990ba5[_0xd07f('0x43')]);_0x3f1619[_0xd07f('0x44')]=_['intersection'](_0x3f1619[_0xd07f('0x41')],_0x3f1619['query']);_0x32ac57[_0xd07f('0x46')]=_[_0xd07f('0x45')](_0x3f1619[_0xd07f('0x41')],qs[_0xd07f('0x47')](_0x990ba5[_0xd07f('0x43')][_0xd07f('0x47')]));_0x32ac57[_0xd07f('0x46')]=_0x32ac57['attributes']['length']?_0x32ac57[_0xd07f('0x46')]:_0x3f1619[_0xd07f('0x41')];if(!_0x990ba5[_0xd07f('0x43')][_0xd07f('0x49')](_0xd07f('0x6f'))){_0x32ac57[_0xd07f('0x2e')]=qs[_0xd07f('0x2e')](_0x990ba5['query'][_0xd07f('0x2e')]);_0x32ac57[_0xd07f('0x2c')]=qs[_0xd07f('0x2c')](_0x990ba5[_0xd07f('0x43')][_0xd07f('0x2c')]);}_0x32ac57['order']=qs[_0xd07f('0x4a')](_0x990ba5['query']['sort']);_0x32ac57['where']=qs[_0xd07f('0x44')](_[_0xd07f('0x4b')](_0x990ba5[_0xd07f('0x43')],_0x3f1619[_0xd07f('0x44')]));_0x32ac57['where'][_0xd07f('0x64')]=_0x432e87['id'];if(_0x990ba5[_0xd07f('0x43')][_0xd07f('0x4c')]){_0x32ac57['where']=_[_0xd07f('0x4f')](_0x32ac57[_0xd07f('0x4d')],{'$or':_[_0xd07f('0x42')](_0x32ac57[_0xd07f('0x46')],function(_0x3d4d0a){var _0x5ede72={};_0x5ede72[_0x3d4d0a]={'$like':'%'+_0x990ba5[_0xd07f('0x43')]['filter']+'%'};return _0x5ede72;})});}_0x32ac57=_[_0xd07f('0x4f')]({},_0x32ac57,_0x990ba5[_0xd07f('0x50')]);return db[_0xd07f('0x71')]['count']({'where':_0x32ac57[_0xd07f('0x4d')]})['then'](function(_0x5329b8){_0x85ceaf[_0xd07f('0x2f')]=_0x5329b8;if(_0x990ba5[_0xd07f('0x43')][_0xd07f('0x52')]){_0x32ac57[_0xd07f('0x53')]=[{'model':db[_0xd07f('0x74')],'as':_0xd07f('0x75'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xd07f('0x3a'),'fullname',_0xd07f('0x76')],'required':![]},{'model':db[_0xd07f('0x77')],'as':'Tags','attributes':['id',_0xd07f('0x3a'),_0xd07f('0x78')],'where':_0x990ba5[_0xd07f('0x43')][_0xd07f('0x79')]?{'id':_0x990ba5[_0xd07f('0x43')][_0xd07f('0x79')]}:undefined,'required':_0x990ba5[_0xd07f('0x43')]['tag']?!![]:![]}];}return db[_0xd07f('0x71')][_0xd07f('0x69')](_0x32ac57);})[_0xd07f('0x1e')](function(_0x42ff11){_0x85ceaf[_0xd07f('0x54')]=_0x42ff11;return _0x85ceaf;});}})[_0xd07f('0x1e')](respondWithFilteredResult(_0x425f2f,_0x32ac57))['catch'](handleError(_0x425f2f,null));};exports[_0xd07f('0x7a')]=function(_0x1b5600,_0x4e915d){var _0x4fb04e=_0x1b5600[_0xd07f('0x56')]['id'];var _0xa6d4fe=_0x1b5600[_0xd07f('0x61')];var _0x1673c2=0xc8;var _0x317a17=null;return db[_0xd07f('0x7b')]['transaction']({'isolationLevel':db[_0xd07f('0x7b')]['Transaction'][_0xd07f('0x7c')][_0xd07f('0x7d')]},function(_0x7a1ac6){return db[_0xd07f('0x51')]['findOne']({'where':{'id':_0x4fb04e},'transaction':_0x7a1ac6})[_0xd07f('0x1e')](function(_0x1ac792){if(_0x1ac792){return db[_0xd07f('0x7e')][_0xd07f('0x36')]({'where':{'FaxAccountId':_0x4fb04e},'transaction':_0x7a1ac6})['then'](function(){var _0x56e2e8=_[_0xd07f('0x42')](_0xa6d4fe,function(_0x1da0cd){_0x1da0cd['FaxAccountId']=_0x4fb04e;return _0x1da0cd;});return db['FaxApplication']['bulkCreate'](_0x56e2e8,{'transaction':_0x7a1ac6});});}else{_0x1673c2=0x194;_0x317a17=[];}});})['then'](function(){if(_0x1673c2!==0x194){return db[_0xd07f('0x7e')][_0xd07f('0x7f')]({'where':{'FaxAccountId':_0x4fb04e},'order':'priority'})['then'](function(_0x2c3478){_0x317a17=_0x2c3478;});}})[_0xd07f('0x27')](function(_0x562e20){_0x1673c2=0x1f4;logger[_0xd07f('0x23')](_0x562e20[_0xd07f('0x39')]);if(_0x562e20[_0xd07f('0x3a')]){delete _0x562e20['name'];}_0x317a17=_0x562e20;})[_0xd07f('0x80')](function(){if(_0x317a17===null){_0x4e915d[_0xd07f('0x28')](_0x1673c2);}else{if(_0x1673c2===0x1f4){_0x4e915d[_0xd07f('0x29')](_0x1673c2)[_0xd07f('0x3b')](_0x317a17);}else{_0x4e915d['status'](_0x1673c2)[_0xd07f('0x2b')](_0x317a17);}}});};exports[_0xd07f('0x81')]=function(_0x536203,_0x53486a,_0x522dfd){var _0x230aec={};var _0x218d3d={};var _0x55760f;var _0xdea181;return db[_0xd07f('0x51')][_0xd07f('0x66')]({'where':{'id':_0x536203[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x53486a,null))[_0xd07f('0x1e')](function(_0x4f7290){if(_0x4f7290){_0x55760f=_0x4f7290;_0x218d3d['model']=_[_0xd07f('0x58')](db[_0xd07f('0x7e')][_0xd07f('0x3e')]);_0x218d3d[_0xd07f('0x43')]=_[_0xd07f('0x58')](_0x536203[_0xd07f('0x43')]);_0x218d3d[_0xd07f('0x44')]=_[_0xd07f('0x45')](_0x218d3d[_0xd07f('0x41')],_0x218d3d[_0xd07f('0x43')]);_0x230aec['attributes']=_['intersection'](_0x218d3d['model'],qs['fields'](_0x536203['query'][_0xd07f('0x47')]));_0x230aec[_0xd07f('0x46')]=_0x230aec[_0xd07f('0x46')][_0xd07f('0x48')]?_0x230aec['attributes']:_0x218d3d[_0xd07f('0x41')];_0x230aec[_0xd07f('0x68')]=qs[_0xd07f('0x4a')](_0x536203[_0xd07f('0x43')]['sort']);_0x230aec[_0xd07f('0x4d')]=qs[_0xd07f('0x44')](_[_0xd07f('0x4b')](_0x536203[_0xd07f('0x43')],_0x218d3d[_0xd07f('0x44')]));if(_0x536203[_0xd07f('0x43')][_0xd07f('0x4c')]){_0x230aec[_0xd07f('0x4d')]=_[_0xd07f('0x4f')](_0x230aec[_0xd07f('0x4d')],{'$or':_['map'](_0x230aec[_0xd07f('0x46')],function(_0x202d73){var _0x498990={};_0x498990[_0x202d73]={'$like':'%'+_0x536203['query'][_0xd07f('0x4c')]+'%'};return _0x498990;})});}_0x230aec=_[_0xd07f('0x4f')]({},_0x230aec,_0x536203['options']);return _0x55760f[_0xd07f('0x81')](_0x230aec);}})[_0xd07f('0x1e')](function(_0x641f2f){if(_0x641f2f){_0xdea181=_0x641f2f[_0xd07f('0x48')];if(!_0x536203['query'][_0xd07f('0x49')](_0xd07f('0x6f'))){_0x230aec[_0xd07f('0x2e')]=qs[_0xd07f('0x2e')](_0x536203[_0xd07f('0x43')]['limit']);_0x230aec[_0xd07f('0x2c')]=qs[_0xd07f('0x2c')](_0x536203[_0xd07f('0x43')][_0xd07f('0x2c')]);}return _0x55760f[_0xd07f('0x81')](_0x230aec);}})[_0xd07f('0x1e')](function(_0x16df5f){if(_0x16df5f){return _0x16df5f?{'count':_0xdea181,'rows':_0x16df5f}:null;}})[_0xd07f('0x1e')](respondWithResult(_0x53486a,null))['catch'](handleError(_0x53486a,null));};function Extension(_0x27db12,_0x46e3e9,_0x7525bb,_0x5d2d94){this[_0xd07f('0x82')]=_0xd07f('0x83');this['exten']=_0x27db12['localstationid'];this[_0xd07f('0x84')]=_0x5d2d94;this[_0xd07f('0x85')]=_0xd07f('0x86');this[_0xd07f('0x87')]=_0xd07f('0x88');this[_0xd07f('0x64')]=_0x27db12['id'];this['priority']=_0x46e3e9;this[_0xd07f('0x89')]=_0x7525bb;}function createExtensionsReciveFax(_0x1a421c){var _0x1f42fa=0x1;var _0xdf3550=[];_0xdf3550['push'](new Extension(_0x1a421c,_0x1f42fa,'','Answer'));_0x1f42fa+=0x1;_0xdf3550[_0xd07f('0x8a')](new Extension(_0x1a421c,_0x1f42fa,'CDR(type)=inbound-fax',_0xd07f('0x8b')));_0x1f42fa+=0x1;for(var _0x5b154c in _0x1a421c){if(_0x1a421c[_0xd07f('0x49')](_0x5b154c)&&(_0x5b154c==='ecm'||_0x5b154c===_0xd07f('0x8c')||_0x5b154c==='gateway'||_0x5b154c===_0xd07f('0x8d')||_0x5b154c===_0xd07f('0x8e')||_0x5b154c===_0xd07f('0x8f')||_0x5b154c==='minrate'||_0x5b154c===_0xd07f('0x90')||_0x5b154c==='t38timeout')){_0xdf3550[_0xd07f('0x8a')](new Extension(_0x1a421c,_0x1f42fa,_0xd07f('0x91')+_0x5b154c+')='+_0x1a421c[_0x5b154c],_0xd07f('0x8b')));_0x1f42fa+=0x1;}}_0xdf3550['push'](new Extension(_0x1a421c,_0x1f42fa,'6','Wait'));_0x1f42fa+=0x1;_0xdf3550['push'](new Extension(_0x1a421c,_0x1f42fa,_0xd07f('0x92'),_0xd07f('0x93')));_0x1f42fa=0x0;return _0xdf3550;}exports[_0xd07f('0x94')]=function(_0x3c2b00,_0x14bcf2,_0x58961a){var _0x19b238;return db[_0xd07f('0x7b')][_0xd07f('0x95')](function(_0x113564){return db[_0xd07f('0x51')]['create'](_0x3c2b00[_0xd07f('0x61')],{'transaction':_0x113564})['then'](function(_0x5bb5d3){_0x19b238=_0x5bb5d3[_0xd07f('0x37')]({'plain':!![]});return db['VoiceExtension'][_0xd07f('0x96')](createExtensionsReciveFax(_0x19b238),{'transaction':_0x113564});});})[_0xd07f('0x1e')](function(){return _0x19b238;})[_0xd07f('0x1e')](respondWithResult(_0x14bcf2,null))[_0xd07f('0x27')](handleError(_0x14bcf2,null));};exports['updateAccountApplications']=function(_0x43a3de,_0x294018,_0x277007){var _0x3ed345;return db[_0xd07f('0x7b')][_0xd07f('0x95')](function(_0x1d55c2){return db['FaxAccount'][_0xd07f('0x35')](_0x43a3de[_0xd07f('0x61')],{'where':{'id':_0x43a3de[_0xd07f('0x61')]['id']},'transaction':_0x1d55c2})[_0xd07f('0x1e')](function(_0x8d9213){return db[_0xd07f('0x97')][_0xd07f('0x36')]({'where':{'FaxAccountId':_0x43a3de['body']['id']},'transaction':_0x1d55c2})[_0xd07f('0x1e')](function(_0x349a26){return db[_0xd07f('0x97')][_0xd07f('0x96')](createExtensionsReciveFax(_['omit'](_0x43a3de[_0xd07f('0x61')],[_0xd07f('0x98'),'key',_0xd07f('0x99'),_0xd07f('0x9a'),_0xd07f('0x9b'),_0xd07f('0x9c')])),{'transaction':_0x1d55c2});});});})[_0xd07f('0x1e')](function(){return db['FaxAccount'][_0xd07f('0x9d')](_0x43a3de[_0xd07f('0x61')]['id']);})[_0xd07f('0x1e')](respondWithResult(_0x294018,null))[_0xd07f('0x27')](handleError(_0x294018,null));};exports['getMessages']=function(_0x19dec0,_0x12c07d,_0x4d5a63){var _0xba73ac={'raw':!![],'where':{}};var _0x8ec4f={};var _0x324273={'count':0x0,'rows':[]};return db[_0xd07f('0x51')][_0xd07f('0x66')]({'where':{'id':_0x19dec0['params']['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x12c07d,null))[_0xd07f('0x1e')](function(_0x3decb4){if(_0x3decb4){_0x8ec4f['model']=_['keys'](db[_0xd07f('0x9e')][_0xd07f('0x3e')]);_0x8ec4f['query']=_[_0xd07f('0x58')](_0x19dec0['query']);_0x8ec4f[_0xd07f('0x44')]=_['intersection'](_0x8ec4f[_0xd07f('0x41')],_0x8ec4f[_0xd07f('0x43')]);_0xba73ac[_0xd07f('0x46')]=_[_0xd07f('0x45')](_0x8ec4f['model'],qs[_0xd07f('0x47')](_0x19dec0['query'][_0xd07f('0x47')]));_0xba73ac[_0xd07f('0x46')]=_0xba73ac[_0xd07f('0x46')][_0xd07f('0x48')]?_0xba73ac['attributes']:_0x8ec4f[_0xd07f('0x41')];if(!_0x19dec0[_0xd07f('0x43')][_0xd07f('0x49')](_0xd07f('0x6f'))){_0xba73ac[_0xd07f('0x2e')]=qs[_0xd07f('0x2e')](_0x19dec0[_0xd07f('0x43')][_0xd07f('0x2e')]);_0xba73ac[_0xd07f('0x2c')]=qs[_0xd07f('0x2c')](_0x19dec0['query'][_0xd07f('0x2c')]);}_0xba73ac[_0xd07f('0x68')]=qs[_0xd07f('0x4a')](_0x19dec0[_0xd07f('0x43')][_0xd07f('0x4a')]);_0xba73ac[_0xd07f('0x4d')]=qs[_0xd07f('0x44')](_[_0xd07f('0x4b')](_0x19dec0['query'],_0x8ec4f[_0xd07f('0x44')]));_0xba73ac[_0xd07f('0x4d')][_0xd07f('0x64')]=_0x3decb4['id'];if(_0x19dec0[_0xd07f('0x43')]['filter']){_0xba73ac['where']=_['merge'](_0xba73ac['where'],{'$or':_['map'](_0xba73ac[_0xd07f('0x46')],function(_0x7dafd5){var _0x3bb94c={};_0x3bb94c[_0x7dafd5]={'$like':'%'+_0x19dec0[_0xd07f('0x43')][_0xd07f('0x4c')]+'%'};return _0x3bb94c;})});}if(_0x19dec0[_0xd07f('0x43')][_0xd07f('0x9f')]){var _0x11cd4d=_0x19dec0[_0xd07f('0x43')]['$gte'][_0xd07f('0xa0')](',');var _0x21920b={};_0x21920b[_0x11cd4d[0x0]]={'$gte':moment(_0x11cd4d[0x1])[_0xd07f('0xa1')](_0xd07f('0xa2'))};_0xba73ac[_0xd07f('0x4d')]=_[_0xd07f('0x4f')](_0xba73ac['where'],_0x21920b);}_0xba73ac=_['merge']({},_0xba73ac,_0x19dec0[_0xd07f('0x50')]);return db['FaxMessage'][_0xd07f('0x2f')]({'where':_0xba73ac[_0xd07f('0x4d')]})['then'](function(_0x1f828f){_0x324273[_0xd07f('0x2f')]=_0x1f828f;if(_0x19dec0[_0xd07f('0x43')][_0xd07f('0x52')]){_0xba73ac[_0xd07f('0x53')]=[{'all':!![]}];}return db[_0xd07f('0x9e')][_0xd07f('0x69')](_0xba73ac);})[_0xd07f('0x1e')](function(_0x5be43a){_0x324273['rows']=_0x5be43a;return _0x324273;});}})[_0xd07f('0x1e')](respondWithFilteredResult(_0x12c07d,_0xba73ac))[_0xd07f('0x27')](handleError(_0x12c07d,null));};exports['send']=function(_0x1cccb6,_0x3083d7,_0x587a10){var _0x243c3c,_0x48df86={},_0x3f3cca;if(_0x1cccb6['body']['to']){_0x3f3cca=_0x1cccb6[_0xd07f('0x61')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x1cccb6[_0xd07f('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xd07f('0xa3'),'include':[{'model':db[_0xd07f('0x74')],'as':_0xd07f('0xa4'),'where':{'fax':_0x3f3cca},'limit':0x1,'order':[[_0xd07f('0x9a'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3083d7,null))['then'](function(_0x55c8da){_0x243c3c=_0x55c8da;if(_0x1cccb6['body']['attachments']&&_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xa5')][_0xd07f('0x48')]){for(var _0x31b292=0x0;_0x31b292<_0x1cccb6[_0xd07f('0x61')]['attachments']['length'];_0x31b292+=0x1){_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xa5')][_0x31b292]={'filename':_0x1cccb6['body'][_0xd07f('0xa5')][_0x31b292][_0xd07f('0x3a')],'id':_0x1cccb6['body'][_0xd07f('0xa5')][_0x31b292]['id'],'path':path['join'](config[_0xd07f('0xa6')],_0xd07f('0xa7'),_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xa5')][_0x31b292][_0xd07f('0xa8')])};}}return respondWithRpcPromise(_0xd07f('0xa9'),_0xd07f('0xa9'),{'FaxAccountId':_[_0xd07f('0xaa')](_0x1cccb6['params']['id'])?undefined:_0x1cccb6['params']['id'],'path':_[_0xd07f('0xaa')](_0x1cccb6[_0xd07f('0x61')]['attachments'][0x0][_0xd07f('0x5')])?undefined:_0x1cccb6['body']['attachments'][0x0][_0xd07f('0x5')],'fax':_['isNil'](_0x1cccb6[_0xd07f('0x61')]['to'][0x0])?undefined:_0x1cccb6[_0xd07f('0x61')]['to'][0x0]},client9002);})[_0xd07f('0x1e')](function(){if(_0x243c3c){if(_[_0xd07f('0xaa')](_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xab')])){_0x1cccb6[_0xd07f('0x61')]['from']=util['format'](_0xd07f('0xac'),_0x243c3c[_0xd07f('0x3a')],_0x243c3c[_0xd07f('0xad')]);}if(_0x243c3c[_0xd07f('0xa3')]){if(_0x243c3c['List'][_0xd07f('0xa4')][_0xd07f('0x48')]){return _0x243c3c[_0xd07f('0xa3')]['Contacts'][0x0];}else{return db['CmContact'][_0xd07f('0x5a')](_[_0xd07f('0x15')](_0x1cccb6[_0xd07f('0x61')],{'firstName':_0x1cccb6['body']['to'][0x0],'phone':_0x1cccb6['body']['to'][0x0],'fax':_0x1cccb6['body']['to'][0x0],'ListId':_0x243c3c[_0xd07f('0x9c')]}));}}else{throw new Error(_0xd07f('0xae'));}}else{throw new Error(_0xd07f('0xaf'));}})['then'](function(_0x24026b){if(_0x24026b){return db[_0xd07f('0x71')][_0xd07f('0x59')]({'where':{'ContactId':_0x24026b['id'],'closed':![],'FaxAccountId':_0x243c3c['id']}})['then'](function(_0x3edc68){if(_0x3edc68){return[_0x3edc68,![]];}return db[_0xd07f('0x71')]['create']({'UserId':_0x1cccb6[_0xd07f('0x5b')]['id'],'ContactId':_0x24026b['id'],'FaxAccountId':_0x243c3c['id'],'fax':_0x1cccb6[_0xd07f('0x61')]['to'][0x0],'firstMsgDirection':_0xd07f('0xb0'),'Messages':[_['merge'](_0x1cccb6[_0xd07f('0x61')],{'read':![],'body':_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xa5')][0x0][_0xd07f('0xb1')],'FaxAccountId':_0x243c3c['id'],'UserId':_0x1cccb6[_0xd07f('0x5b')]['id'],'ContactId':_0x24026b['id'],'AttachmentId':_0x1cccb6['body'][_0xd07f('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xd07f('0x9e')],'as':_0xd07f('0xb2')}]})[_0xd07f('0x1e')](function(_0x222141){return[_0x222141,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xd07f('0xb3')](function(_0x3849a5,_0xd5b21d){if(_0xd5b21d){return _0x3849a5;}return db[_0xd07f('0x9e')]['create']({'direction':_0xd07f('0xb0'),'read':![],'body':_0x1cccb6[_0xd07f('0x61')]['attachments'][0x0][_0xd07f('0xb1')],'FaxAccountId':_0x243c3c['id'],'FaxInteractionId':_0x3849a5['id'],'UserId':_0x1cccb6[_0xd07f('0x5b')]['id'],'ContactId':_0x3849a5[_0xd07f('0xb4')],'AttachmentId':_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xa5')][0x0]['id']})[_0xd07f('0x1e')](function(_0x2cb1eb){_0x3849a5[_0xd07f('0xb5')][_0xd07f('0xb2')]=[];_0x3849a5['dataValues']['Messages'][_0xd07f('0x8a')](_0x2cb1eb[_0xd07f('0xb5')]);return _0x3849a5;});})[_0xd07f('0x1e')](function(_0x19f8a4){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x1cccb6['params']['id'])?undefined:_0x1cccb6['params']['id'],'path':_[_0xd07f('0xaa')](_0x1cccb6['body']['attachments'][0x0]['path'])?undefined:_0x1cccb6[_0xd07f('0x61')][_0xd07f('0xa5')][0x0][_0xd07f('0x5')],'fax':_[_0xd07f('0xaa')](_0x1cccb6[_0xd07f('0x61')]['to'][0x0])?undefined:_0x1cccb6[_0xd07f('0x61')]['to'][0x0],'AttachmentId':_0x1cccb6['body'][_0xd07f('0xa5')][0x0]['id']},client9002)[_0xd07f('0x1e')](function(_0x5db32b){logger[_0xd07f('0x1f')]('SendFaxRpc,\x20%s',_0x5db32b);})[_0xd07f('0x27')](function(_0x36e192){logger[_0xd07f('0x1f')](_0xd07f('0xb6'),_0x36e192);});return _0x19f8a4;})[_0xd07f('0x1e')](respondWithResult(_0x3083d7,null))[_0xd07f('0x27')](handleError(_0x3083d7,null));};exports[_0xd07f('0xb7')]=function(_0x17ce0e,_0x13a413,_0x17519b){return db[_0xd07f('0x51')]['find']({'where':{'id':_0x17ce0e[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x13a413,null))[_0xd07f('0x1e')](function(_0x5333bc){if(_0x5333bc){return _0x5333bc[_0xd07f('0xb7')](_0x17ce0e['body'][_0xd07f('0x6b')],_[_0xd07f('0x72')](_0x17ce0e[_0xd07f('0x61')],[_0xd07f('0x6b'),'id'])||{})[_0xd07f('0xb3')](function(_0x5766ac){for(var _0x5caef1=0x0;_0x5caef1<_0x17ce0e[_0xd07f('0x61')]['ids']['length'];_0x5caef1+=0x1){socket[_0xd07f('0xb8')](_0xd07f('0xb9'),{'UserId':Number(_0x17ce0e[_0xd07f('0x61')]['ids'][_0x5caef1]),'FaxAccountId':Number(_0x17ce0e[_0xd07f('0x56')]['id'])});}return _0x5766ac;});}})[_0xd07f('0x1e')](respondWithResult(_0x13a413,null))[_0xd07f('0x27')](handleError(_0x13a413,null));};exports[_0xd07f('0xba')]=function(_0x15b9a5,_0x4c7d75,_0x6da7cc){return db['FaxAccount'][_0xd07f('0x59')]({'where':{'id':_0x15b9a5[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x4c7d75,null))[_0xd07f('0x1e')](function(_0x410db8){if(_0x410db8){return _0x410db8[_0xd07f('0xba')](_0x15b9a5[_0xd07f('0x43')][_0xd07f('0x6b')])[_0xd07f('0x1e')](function(){if(_['isArray'](_0x15b9a5[_0xd07f('0x43')][_0xd07f('0x6b')])){for(var _0x88f48=0x0;_0x88f48<_0x15b9a5['query'][_0xd07f('0x6b')][_0xd07f('0x48')];_0x88f48+=0x1){socket[_0xd07f('0xb8')](_0xd07f('0xbb'),{'UserId':Number(_0x15b9a5[_0xd07f('0x43')][_0xd07f('0x6b')][_0x88f48]),'FaxAccountId':Number(_0x15b9a5['params']['id'])});}}else{socket[_0xd07f('0xb8')]('userFaxAccount:remove',{'UserId':Number(_0x15b9a5[_0xd07f('0x43')]['ids']),'FaxAccountId':Number(_0x15b9a5['params']['id'])});}});}})[_0xd07f('0x1e')](respondWithStatusCode(_0x4c7d75,null))[_0xd07f('0x27')](handleError(_0x4c7d75,null));};exports[_0xd07f('0xbc')]=function(_0x23e920,_0x3e1df4,_0x4e9634){var _0xece4fa={};var _0x222f6f={};var _0x4556f5;var _0x8ce0aa;return db[_0xd07f('0x51')][_0xd07f('0x66')]({'where':{'id':_0x23e920[_0xd07f('0x56')]['id']}})[_0xd07f('0x1e')](handleEntityNotFound(_0x3e1df4,null))['then'](function(_0x53a9aa){if(_0x53a9aa){_0x4556f5=_0x53a9aa;_0x222f6f[_0xd07f('0x41')]=_['keys'](db[_0xd07f('0xbd')][_0xd07f('0x3e')]);_0x222f6f['query']=_['keys'](_0x23e920['query']);_0x222f6f[_0xd07f('0x44')]=_[_0xd07f('0x45')](_0x222f6f[_0xd07f('0x41')],_0x222f6f['query']);_0xece4fa[_0xd07f('0x46')]=_[_0xd07f('0x45')](_0x222f6f[_0xd07f('0x41')],qs[_0xd07f('0x47')](_0x23e920['query'][_0xd07f('0x47')]));_0xece4fa[_0xd07f('0x46')]=_0xece4fa[_0xd07f('0x46')][_0xd07f('0x48')]?_0xece4fa[_0xd07f('0x46')]:_0x222f6f[_0xd07f('0x41')];_0xece4fa[_0xd07f('0x68')]=qs['sort'](_0x23e920[_0xd07f('0x43')]['sort']);_0xece4fa[_0xd07f('0x4d')]=qs[_0xd07f('0x44')](_[_0xd07f('0x4b')](_0x23e920[_0xd07f('0x43')],_0x222f6f['filters']));if(_0x23e920[_0xd07f('0x43')][_0xd07f('0x4c')]){_0xece4fa['where']=_['merge'](_0xece4fa[_0xd07f('0x4d')],{'$or':_[_0xd07f('0x42')](_0xece4fa[_0xd07f('0x46')],function(_0x501605){var _0x354fb5={};_0x354fb5[_0x501605]={'$like':'%'+_0x23e920[_0xd07f('0x43')][_0xd07f('0x4c')]+'%'};return _0x354fb5;})});}_0xece4fa=_[_0xd07f('0x4f')]({},_0xece4fa,_0x23e920['options']);return _0x4556f5['getAgents'](_0xece4fa);}})[_0xd07f('0x1e')](function(_0x48663c){if(_0x48663c){_0x8ce0aa=_0x48663c[_0xd07f('0x48')];if(!_0x23e920[_0xd07f('0x43')][_0xd07f('0x49')](_0xd07f('0x6f'))){_0xece4fa['limit']=qs['limit'](_0x23e920[_0xd07f('0x43')][_0xd07f('0x2e')]);_0xece4fa[_0xd07f('0x2c')]=qs[_0xd07f('0x2c')](_0x23e920[_0xd07f('0x43')][_0xd07f('0x2c')]);}return _0x4556f5[_0xd07f('0xbc')](_0xece4fa);}})[_0xd07f('0x1e')](function(_0x20a4d8){if(_0x20a4d8){return _0x20a4d8?{'count':_0x8ce0aa,'rows':_0x20a4d8}:null;}})[_0xd07f('0x1e')](respondWithResult(_0x3e1df4,null))['catch'](handleError(_0x3e1df4,null));}; \ No newline at end of file +var _0x19c5=['attachments','join','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','ListId','List\x20not\x20found','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','destroy','end','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','findOne','pick','rows','ids','addAnswer','getAnswers','hasOwnProperty','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','appdata','push','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','/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','updateAccountApplications','updatedAt','findById','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x19c5,0xd7));var _0x519c=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0x19c5[_0x1a89a1];return _0x3d5b46;};'use strict';var emlformat=require(_0x519c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x519c('0x1'));var rp=require(_0x519c('0x2'));var moment=require(_0x519c('0x3'));var BPromise=require(_0x519c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x519c('0x5'));var sox=require(_0x519c('0x6'));var csv=require(_0x519c('0x7'));var ejs=require(_0x519c('0x8'));var fs=require('fs');var fs_extra=require(_0x519c('0x9'));var _=require(_0x519c('0xa'));var squel=require(_0x519c('0xb'));var crypto=require(_0x519c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x519c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x519c('0xe'));var Papa=require(_0x519c('0xf'));var Redis=require(_0x519c('0x10'));var authService=require(_0x519c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x519c('0x12'));var logger=require(_0x519c('0x13'))(_0x519c('0x14'));var utils=require(_0x519c('0x15'));var config=require(_0x519c('0x16'));var licenseUtil=require(_0x519c('0x17'));var db=require(_0x519c('0x18'))['db'];config[_0x519c('0x19')]=_['defaults'](config['redis'],{'host':_0x519c('0x1a'),'port':0x18eb});var socket=require(_0x519c('0x1b'))(new Redis(config['redis']));require(_0x519c('0x1c'))[_0x519c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x519c('0x1e')][_0x519c('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x519c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x205c55,_0xf29155,_0x3231a8,_0x29e6df){return new BPromise(function(_0x2256a4,_0x1eea0c){var _0x7d3cb7=_0x29e6df||client;return _0x7d3cb7[_0x519c('0x20')](_0x205c55,_0x3231a8)[_0x519c('0x21')](function(_0xd7d1a9){logger[_0x519c('0x22')](_0x519c('0x23'),_0xf29155,_0x519c('0x24'));logger['debug'](_0x519c('0x25'),_0xf29155,_0x519c('0x24'),JSON[_0x519c('0x26')](_0xd7d1a9));if(_0xd7d1a9['error']){if(_0xd7d1a9['error'][_0x519c('0x27')]===0x1f4){logger[_0x519c('0x28')](_0x519c('0x23'),_0xf29155,_0xd7d1a9['error'][_0x519c('0x29')]);return _0x1eea0c(_0xd7d1a9['error'][_0x519c('0x29')]);}logger[_0x519c('0x28')](_0x519c('0x23'),_0xf29155,_0xd7d1a9[_0x519c('0x28')][_0x519c('0x29')]);return _0x2256a4(_0xd7d1a9[_0x519c('0x28')][_0x519c('0x29')]);}else{logger['info'](_0x519c('0x23'),_0xf29155,'request\x20sent');_0x2256a4(_0xd7d1a9[_0x519c('0x2a')][_0x519c('0x29')]);}})[_0x519c('0x2b')](function(_0x4d586d){logger[_0x519c('0x28')](_0x519c('0x23'),_0xf29155,_0x4d586d);_0x1eea0c(_0x4d586d);});});}function respondWithStatusCode(_0x2a29d6,_0x4ef874){_0x4ef874=_0x4ef874||0xcc;return function(_0x17cf4b){if(_0x17cf4b){return _0x2a29d6[_0x519c('0x2c')](_0x4ef874);}return _0x2a29d6[_0x519c('0x2d')](_0x4ef874)['end']();};}function respondWithResult(_0x2ee2c4,_0x2b530d){_0x2b530d=_0x2b530d||0xc8;return function(_0x380f90){if(_0x380f90){return _0x2ee2c4[_0x519c('0x2d')](_0x2b530d)[_0x519c('0x2e')](_0x380f90);}};}function respondWithFilteredResult(_0xfc4290,_0x170582){return function(_0x1eb79e){if(_0x1eb79e){var _0x42095d=typeof _0x170582[_0x519c('0x2f')]===_0x519c('0x30')&&typeof _0x170582[_0x519c('0x31')]==='undefined';var _0x18cbe1=_0x1eb79e['count'];var _0x54acaf=_0x42095d?0x0:_0x170582['offset'];var _0x22e666=_0x42095d?_0x1eb79e[_0x519c('0x32')]:_0x170582[_0x519c('0x2f')]+_0x170582[_0x519c('0x31')];var _0x2fc259;if(_0x22e666>=_0x18cbe1){_0x22e666=_0x18cbe1;_0x2fc259=0xc8;}else{_0x2fc259=0xce;}_0xfc4290['status'](_0x2fc259);return _0xfc4290[_0x519c('0x33')](_0x519c('0x34'),_0x54acaf+'-'+_0x22e666+'/'+_0x18cbe1)[_0x519c('0x2e')](_0x1eb79e);}return null;};}function patchUpdates(_0x5ec39d){return function(_0x35af68){try{jsonpatch['apply'](_0x35af68,_0x5ec39d,!![]);}catch(_0x408d78){return BPromise[_0x519c('0x35')](_0x408d78);}return _0x35af68[_0x519c('0x36')]();};}function saveUpdates(_0x4de417,_0x2b47cd){return function(_0x3e9cb8){if(_0x3e9cb8){return _0x3e9cb8[_0x519c('0x37')](_0x4de417)[_0x519c('0x21')](function(_0x13b326){return _0x13b326;});}return null;};}function removeEntity(_0x17496e,_0x272ee6){return function(_0x33b7ed){if(_0x33b7ed){return _0x33b7ed['destroy']()[_0x519c('0x21')](function(){var _0x4a386a=_0x33b7ed[_0x519c('0x38')]({'plain':!![]});var _0x3b3f0f='FaxAccounts';return db['UserProfileResource'][_0x519c('0x39')]({'where':{'type':_0x3b3f0f,'resourceId':_0x4a386a['id']}})[_0x519c('0x21')](function(){return _0x33b7ed;});})[_0x519c('0x21')](function(){_0x17496e[_0x519c('0x2d')](0xcc)[_0x519c('0x3a')]();});}};}function handleEntityNotFound(_0x58148b,_0x9c538d){return function(_0x464d72){if(!_0x464d72){_0x58148b[_0x519c('0x2c')](0x194);}return _0x464d72;};}function handleError(_0x27d8f7,_0xaef83a){_0xaef83a=_0xaef83a||0x1f4;return function(_0x56686d){logger[_0x519c('0x28')](_0x56686d[_0x519c('0x3b')]);if(_0x56686d[_0x519c('0x3c')]){delete _0x56686d[_0x519c('0x3c')];}_0x27d8f7[_0x519c('0x2d')](_0xaef83a)[_0x519c('0x3d')](_0x56686d);};}exports['index']=function(_0x549c34,_0x5b0410){var _0x25aa4c={'include':[{'model':db[_0x519c('0x3e')],'as':_0x519c('0x3f')}]},_0x5457f6={},_0x17351f={'count':0x0,'rows':[]};var _0x491d66=_['map'](db[_0x519c('0x40')]['rawAttributes'],function(_0x1ab129){return{'name':_0x1ab129[_0x519c('0x41')],'type':_0x1ab129[_0x519c('0x42')][_0x519c('0x43')]};});_0x5457f6[_0x519c('0x44')]=_[_0x519c('0x45')](_0x491d66,_0x519c('0x3c'));_0x5457f6[_0x519c('0x46')]=_[_0x519c('0x47')](_0x549c34[_0x519c('0x46')]);_0x5457f6[_0x519c('0x48')]=_[_0x519c('0x49')](_0x5457f6[_0x519c('0x44')],_0x5457f6[_0x519c('0x46')]);_0x25aa4c[_0x519c('0x4a')]=_[_0x519c('0x49')](_0x5457f6[_0x519c('0x44')],qs[_0x519c('0x4b')](_0x549c34[_0x519c('0x46')][_0x519c('0x4b')]));_0x25aa4c[_0x519c('0x4a')]=_0x25aa4c[_0x519c('0x4a')][_0x519c('0x4c')]?_0x25aa4c[_0x519c('0x4a')]:_0x5457f6[_0x519c('0x44')];if(!_0x549c34[_0x519c('0x46')]['hasOwnProperty'](_0x519c('0x4d'))){_0x25aa4c[_0x519c('0x31')]=qs['limit'](_0x549c34['query']['limit']);_0x25aa4c['offset']=qs[_0x519c('0x2f')](_0x549c34['query'][_0x519c('0x2f')]);}_0x25aa4c[_0x519c('0x4e')]=qs[_0x519c('0x4f')](_0x549c34['query'][_0x519c('0x4f')]);_0x25aa4c[_0x519c('0x50')]=qs[_0x519c('0x48')](_['pick'](_0x549c34[_0x519c('0x46')],_0x5457f6['filters']),_0x491d66);if(_0x549c34[_0x519c('0x46')][_0x519c('0x51')]){_0x25aa4c[_0x519c('0x50')]=_[_0x519c('0x52')](_0x25aa4c['where'],{'$or':_['map'](_0x491d66,function(_0xf99499){if(_0xf99499[_0x519c('0x42')]!==_0x519c('0x53')){var _0x505d8d={};_0x505d8d[_0xf99499[_0x519c('0x3c')]]={'$like':'%'+_0x549c34[_0x519c('0x46')][_0x519c('0x51')]+'%'};return _0x505d8d;}})});}_0x25aa4c=_[_0x519c('0x52')]({},_0x25aa4c,_0x549c34[_0x519c('0x54')]);var _0x3e033e={'where':_0x25aa4c[_0x519c('0x50')]};return db['FaxAccount'][_0x519c('0x32')](_0x3e033e)[_0x519c('0x21')](function(_0x5c9b75){_0x17351f[_0x519c('0x32')]=_0x5c9b75;if(_0x549c34[_0x519c('0x46')][_0x519c('0x55')]){_0x25aa4c[_0x519c('0x56')]=[{'all':!![]}];}return db[_0x519c('0x40')][_0x519c('0x57')](_0x25aa4c);})['then'](function(_0x2d08d1){_0x17351f['rows']=_0x2d08d1;return _0x17351f;})[_0x519c('0x21')](respondWithFilteredResult(_0x5b0410,_0x25aa4c))[_0x519c('0x2b')](handleError(_0x5b0410,null));};exports[_0x519c('0x58')]=function(_0x5ecfda,_0x18b19f){var _0x9d65cb={'raw':![],'where':{'id':_0x5ecfda[_0x519c('0x59')]['id']},'include':[{'model':db[_0x519c('0x3e')],'as':_0x519c('0x3f')}]},_0x51d8a5={};_0x51d8a5[_0x519c('0x44')]=_['keys'](db[_0x519c('0x40')][_0x519c('0x5a')]);_0x51d8a5[_0x519c('0x46')]=_[_0x519c('0x47')](_0x5ecfda[_0x519c('0x46')]);_0x51d8a5[_0x519c('0x48')]=_['intersection'](_0x51d8a5[_0x519c('0x44')],_0x51d8a5['query']);_0x9d65cb[_0x519c('0x4a')]=_[_0x519c('0x49')](_0x51d8a5[_0x519c('0x44')],qs[_0x519c('0x4b')](_0x5ecfda[_0x519c('0x46')][_0x519c('0x4b')]));_0x9d65cb[_0x519c('0x4a')]=_0x9d65cb[_0x519c('0x4a')][_0x519c('0x4c')]?_0x9d65cb[_0x519c('0x4a')]:_0x51d8a5['model'];if(_0x5ecfda[_0x519c('0x46')][_0x519c('0x55')]){_0x9d65cb[_0x519c('0x56')]=[{'all':!![]}];}_0x9d65cb=_[_0x519c('0x52')]({},_0x9d65cb,_0x5ecfda[_0x519c('0x54')]);return db['FaxAccount']['find'](_0x9d65cb)[_0x519c('0x21')](handleEntityNotFound(_0x18b19f,null))[_0x519c('0x21')](respondWithResult(_0x18b19f,null))[_0x519c('0x2b')](handleError(_0x18b19f,null));};exports['create']=function(_0x505bbc,_0x2a1785){return db[_0x519c('0x40')][_0x519c('0x5b')](_0x505bbc['body'],{})[_0x519c('0x21')](function(_0x32eb75){var _0x325daf=_0x505bbc[_0x519c('0x5c')][_0x519c('0x38')]({'plain':!![]});if(!_0x325daf)throw new Error(_0x519c('0x5d'));if(_0x325daf[_0x519c('0x5e')]===_0x519c('0x5c')){var _0xe6b338=_0x32eb75[_0x519c('0x38')]({'plain':!![]});var _0xbe8880=_0x519c('0x5f');return db['UserProfileSection'][_0x519c('0x60')]({'where':{'name':_0xbe8880,'userProfileId':_0x325daf[_0x519c('0x61')]},'raw':!![]})[_0x519c('0x21')](function(_0x59756d){if(_0x59756d&&_0x59756d['autoAssociation']===0x0){return db['UserProfileResource'][_0x519c('0x5b')]({'name':_0xe6b338[_0x519c('0x3c')],'resourceId':_0xe6b338['id'],'type':_0x59756d[_0x519c('0x3c')],'sectionId':_0x59756d['id']},{})[_0x519c('0x21')](function(){return _0x32eb75;});}else{return _0x32eb75;}})[_0x519c('0x2b')](function(_0x243ef4){logger[_0x519c('0x28')](_0x519c('0x62'),_0x243ef4);throw _0x243ef4;});}return _0x32eb75;})[_0x519c('0x21')](respondWithResult(_0x2a1785,0xc9))[_0x519c('0x2b')](handleError(_0x2a1785,null));};exports[_0x519c('0x37')]=function(_0x4283ac,_0x304f61){if(_0x4283ac[_0x519c('0x63')]['id']){delete _0x4283ac[_0x519c('0x63')]['id'];}return db[_0x519c('0x40')][_0x519c('0x60')]({'where':{'id':_0x4283ac['params']['id']},'include':[{'model':db[_0x519c('0x3e')],'as':_0x519c('0x3f')}]})[_0x519c('0x21')](handleEntityNotFound(_0x304f61,null))['then'](saveUpdates(_0x4283ac[_0x519c('0x63')],null))['then'](respondWithResult(_0x304f61,null))[_0x519c('0x2b')](handleError(_0x304f61,null));};exports[_0x519c('0x39')]=function(_0x4f7714,_0x3d3b14){return db['FaxAccount'][_0x519c('0x60')]({'where':{'id':_0x4f7714[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x3d3b14,null))[_0x519c('0x21')](removeEntity(_0x3d3b14,null))['catch'](handleError(_0x3d3b14,null));};exports[_0x519c('0x64')]=function(_0x5c6d3b,_0x52b6ce){return db[_0x519c('0x40')]['describe']()['then'](respondWithResult(_0x52b6ce,null))[_0x519c('0x2b')](handleError(_0x52b6ce,null));};exports[_0x519c('0x65')]=function(_0x1b4dda,_0x2f0414,_0xb41898){if(_0x1b4dda[_0x519c('0x63')]['id']){delete _0x1b4dda[_0x519c('0x63')]['id'];}return db['FaxAccount'][_0x519c('0x60')]({'where':{'id':_0x1b4dda[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x2f0414,null))[_0x519c('0x21')](function(_0x4823a0){if(_0x4823a0){_0x1b4dda['body'][_0x519c('0x66')]=_0x4823a0['id'];return db[_0x519c('0x67')][_0x519c('0x5b')](_0x1b4dda[_0x519c('0x63')]);}})[_0x519c('0x21')](respondWithResult(_0x2f0414,null))[_0x519c('0x2b')](handleError(_0x2f0414,null));};exports['getDispositions']=function(_0x5509ab,_0x4621a4,_0x4d0aee){var _0x300ee5={'raw':![],'where':{}};var _0x511ea9={};var _0x531290={'count':0x0,'rows':[]};return db[_0x519c('0x40')][_0x519c('0x68')]({'where':{'id':_0x5509ab[_0x519c('0x59')]['id']}})['then'](handleEntityNotFound(_0x4621a4,null))[_0x519c('0x21')](function(_0x269a47){if(_0x269a47){_0x511ea9[_0x519c('0x44')]=_[_0x519c('0x47')](db['Disposition'][_0x519c('0x5a')]);_0x511ea9[_0x519c('0x46')]=_[_0x519c('0x47')](_0x5509ab[_0x519c('0x46')]);_0x511ea9[_0x519c('0x48')]=_[_0x519c('0x49')](_0x511ea9['model'],_0x511ea9['query']);_0x300ee5[_0x519c('0x4a')]=_['intersection'](_0x511ea9['model'],qs[_0x519c('0x4b')](_0x5509ab[_0x519c('0x46')][_0x519c('0x4b')]));_0x300ee5[_0x519c('0x4a')]=_0x300ee5['attributes'][_0x519c('0x4c')]?_0x300ee5['attributes']:_0x511ea9[_0x519c('0x44')];if(!_0x5509ab[_0x519c('0x46')]['hasOwnProperty'](_0x519c('0x4d'))){_0x300ee5[_0x519c('0x31')]=qs[_0x519c('0x31')](_0x5509ab['query'][_0x519c('0x31')]);_0x300ee5[_0x519c('0x2f')]=qs[_0x519c('0x2f')](_0x5509ab[_0x519c('0x46')][_0x519c('0x2f')]);}_0x300ee5[_0x519c('0x4e')]=qs[_0x519c('0x4f')](_0x5509ab['query'][_0x519c('0x4f')]);_0x300ee5[_0x519c('0x50')]=qs['filters'](_[_0x519c('0x69')](_0x5509ab[_0x519c('0x46')],_0x511ea9[_0x519c('0x48')]));_0x300ee5[_0x519c('0x50')][_0x519c('0x66')]=_0x269a47['id'];if(_0x5509ab[_0x519c('0x46')][_0x519c('0x51')]){_0x300ee5['where']=_[_0x519c('0x52')](_0x300ee5['where'],{'$or':_[_0x519c('0x45')](_0x300ee5['attributes'],function(_0x3b0d97){var _0x1390eb={};_0x1390eb[_0x3b0d97]={'$like':'%'+_0x5509ab[_0x519c('0x46')][_0x519c('0x51')]+'%'};return _0x1390eb;})});}_0x300ee5=_[_0x519c('0x52')]({},_0x300ee5,_0x5509ab[_0x519c('0x54')]);return db[_0x519c('0x67')][_0x519c('0x32')]({'where':_0x300ee5['where']})[_0x519c('0x21')](function(_0x59cd65){_0x531290[_0x519c('0x32')]=_0x59cd65;if(_0x5509ab['query'][_0x519c('0x55')]){_0x300ee5[_0x519c('0x56')]=[{'all':!![]}];}return db[_0x519c('0x67')][_0x519c('0x57')](_0x300ee5);})[_0x519c('0x21')](function(_0x4810e4){_0x531290[_0x519c('0x6a')]=_0x4810e4;return _0x531290;});}})[_0x519c('0x21')](respondWithFilteredResult(_0x4621a4,_0x300ee5))[_0x519c('0x2b')](handleError(_0x4621a4,null));};exports['removeDispositions']=function(_0x5b323e,_0xe3ce7,_0x2c6a01){return db[_0x519c('0x40')][_0x519c('0x60')]({'where':{'id':_0x5b323e[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0xe3ce7,null))[_0x519c('0x21')](function(_0x794d81){if(_0x794d81){return _0x794d81['removeDispositions'](_0x5b323e[_0x519c('0x46')][_0x519c('0x6b')]);}})[_0x519c('0x21')](respondWithStatusCode(_0xe3ce7,null))[_0x519c('0x2b')](handleError(_0xe3ce7,null));};exports[_0x519c('0x6c')]=function(_0x40dd62,_0x4788f0,_0x259dce){if(_0x40dd62[_0x519c('0x63')]['id']){delete _0x40dd62[_0x519c('0x63')]['id'];}return db['FaxAccount'][_0x519c('0x60')]({'where':{'id':_0x40dd62['params']['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x4788f0,null))[_0x519c('0x21')](function(_0xc4d6c){if(_0xc4d6c){_0x40dd62[_0x519c('0x63')]['FaxAccountId']=_0xc4d6c['id'];return db['CannedAnswer']['create'](_0x40dd62[_0x519c('0x63')]);}})[_0x519c('0x21')](respondWithResult(_0x4788f0,null))[_0x519c('0x2b')](handleError(_0x4788f0,null));};exports[_0x519c('0x6d')]=function(_0x1d7745,_0x479b9c,_0x4cb83c){var _0x1e5895={'raw':![],'where':{}};var _0x26b630={};var _0x5ccc28={'count':0x0,'rows':[]};return db[_0x519c('0x40')]['findOne']({'where':{'id':_0x1d7745[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x479b9c,null))[_0x519c('0x21')](function(_0x80e49e){if(_0x80e49e){_0x26b630[_0x519c('0x44')]=_[_0x519c('0x47')](db['CannedAnswer'][_0x519c('0x5a')]);_0x26b630[_0x519c('0x46')]=_[_0x519c('0x47')](_0x1d7745[_0x519c('0x46')]);_0x26b630['filters']=_[_0x519c('0x49')](_0x26b630[_0x519c('0x44')],_0x26b630[_0x519c('0x46')]);_0x1e5895[_0x519c('0x4a')]=_[_0x519c('0x49')](_0x26b630[_0x519c('0x44')],qs[_0x519c('0x4b')](_0x1d7745[_0x519c('0x46')][_0x519c('0x4b')]));_0x1e5895[_0x519c('0x4a')]=_0x1e5895[_0x519c('0x4a')][_0x519c('0x4c')]?_0x1e5895[_0x519c('0x4a')]:_0x26b630[_0x519c('0x44')];if(!_0x1d7745['query'][_0x519c('0x6e')](_0x519c('0x4d'))){_0x1e5895[_0x519c('0x31')]=qs[_0x519c('0x31')](_0x1d7745[_0x519c('0x46')]['limit']);_0x1e5895[_0x519c('0x2f')]=qs['offset'](_0x1d7745['query']['offset']);}_0x1e5895[_0x519c('0x4e')]=qs[_0x519c('0x4f')](_0x1d7745[_0x519c('0x46')][_0x519c('0x4f')]);_0x1e5895[_0x519c('0x50')]=qs[_0x519c('0x48')](_['pick'](_0x1d7745[_0x519c('0x46')],_0x26b630[_0x519c('0x48')]));_0x1e5895['where'][_0x519c('0x66')]=_0x80e49e['id'];if(_0x1d7745['query'][_0x519c('0x51')]){_0x1e5895[_0x519c('0x50')]=_[_0x519c('0x52')](_0x1e5895[_0x519c('0x50')],{'$or':_[_0x519c('0x45')](_0x1e5895[_0x519c('0x4a')],function(_0x4b580b){var _0x7f0acc={};_0x7f0acc[_0x4b580b]={'$like':'%'+_0x1d7745['query'][_0x519c('0x51')]+'%'};return _0x7f0acc;})});}_0x1e5895=_['merge']({},_0x1e5895,_0x1d7745[_0x519c('0x54')]);return db[_0x519c('0x6f')][_0x519c('0x32')]({'where':_0x1e5895[_0x519c('0x50')]})[_0x519c('0x21')](function(_0x3e5085){_0x5ccc28[_0x519c('0x32')]=_0x3e5085;if(_0x1d7745[_0x519c('0x46')][_0x519c('0x55')]){_0x1e5895[_0x519c('0x56')]=[{'all':!![]}];}return db[_0x519c('0x6f')]['findAll'](_0x1e5895);})[_0x519c('0x21')](function(_0x1bebd3){_0x5ccc28['rows']=_0x1bebd3;return _0x5ccc28;});}})[_0x519c('0x21')](respondWithFilteredResult(_0x479b9c,_0x1e5895))['catch'](handleError(_0x479b9c,null));};exports['removeAnswers']=function(_0x3948fd,_0x501e8b,_0x9e2f7c){return db[_0x519c('0x40')][_0x519c('0x60')]({'where':{'id':_0x3948fd[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x501e8b,null))[_0x519c('0x21')](function(_0x4b1762){if(_0x4b1762){return _0x4b1762[_0x519c('0x70')](_0x3948fd['query'][_0x519c('0x6b')]);}})[_0x519c('0x21')](respondWithStatusCode(_0x501e8b,null))[_0x519c('0x2b')](handleError(_0x501e8b,null));};exports[_0x519c('0x71')]=function(_0x2e8161,_0x1821f3,_0x385338){return db['FaxInteraction'][_0x519c('0x60')]({'where':{'id':_0x2e8161[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x1821f3,null))[_0x519c('0x21')](function(_0x10c95e){if(_0x10c95e){return _0x10c95e[_0x519c('0x71')](_0x2e8161[_0x519c('0x63')][_0x519c('0x6b')],_[_0x519c('0x72')](_0x2e8161[_0x519c('0x63')],['ids','id'])||{});}})[_0x519c('0x21')](respondWithResult(_0x1821f3,null))[_0x519c('0x2b')](handleError(_0x1821f3,null));};exports[_0x519c('0x73')]=function(_0x495bba,_0x1fd334,_0x51ea20){var _0x1fd8a6={'raw':![],'where':{}};var _0x4036b5={};var _0x583829={'count':0x0,'rows':[]};return db[_0x519c('0x40')][_0x519c('0x68')]({'where':{'id':_0x495bba[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x1fd334,null))['then'](function(_0xbd76ee){if(_0xbd76ee){_0x4036b5['model']=_['keys'](db[_0x519c('0x74')][_0x519c('0x5a')]);_0x4036b5['query']=_[_0x519c('0x47')](_0x495bba[_0x519c('0x46')]);_0x4036b5[_0x519c('0x48')]=_['intersection'](_0x4036b5[_0x519c('0x44')],_0x4036b5[_0x519c('0x46')]);_0x1fd8a6[_0x519c('0x4a')]=_[_0x519c('0x49')](_0x4036b5[_0x519c('0x44')],qs[_0x519c('0x4b')](_0x495bba[_0x519c('0x46')][_0x519c('0x4b')]));_0x1fd8a6['attributes']=_0x1fd8a6['attributes'][_0x519c('0x4c')]?_0x1fd8a6[_0x519c('0x4a')]:_0x4036b5[_0x519c('0x44')];if(!_0x495bba['query']['hasOwnProperty'](_0x519c('0x4d'))){_0x1fd8a6[_0x519c('0x31')]=qs[_0x519c('0x31')](_0x495bba[_0x519c('0x46')]['limit']);_0x1fd8a6[_0x519c('0x2f')]=qs[_0x519c('0x2f')](_0x495bba[_0x519c('0x46')][_0x519c('0x2f')]);}_0x1fd8a6[_0x519c('0x4e')]=qs['sort'](_0x495bba[_0x519c('0x46')]['sort']);_0x1fd8a6[_0x519c('0x50')]=qs[_0x519c('0x48')](_['pick'](_0x495bba[_0x519c('0x46')],_0x4036b5[_0x519c('0x48')]));_0x1fd8a6[_0x519c('0x50')][_0x519c('0x66')]=_0xbd76ee['id'];if(_0x495bba[_0x519c('0x46')][_0x519c('0x51')]){_0x1fd8a6[_0x519c('0x50')]=_['merge'](_0x1fd8a6[_0x519c('0x50')],{'$or':_[_0x519c('0x45')](_0x1fd8a6['attributes'],function(_0x10cf23){var _0x1c0e0c={};_0x1c0e0c[_0x10cf23]={'$like':'%'+_0x495bba[_0x519c('0x46')][_0x519c('0x51')]+'%'};return _0x1c0e0c;})});}_0x1fd8a6=_[_0x519c('0x52')]({},_0x1fd8a6,_0x495bba[_0x519c('0x54')]);return db[_0x519c('0x74')][_0x519c('0x32')]({'where':_0x1fd8a6['where']})['then'](function(_0x59411f){_0x583829[_0x519c('0x32')]=_0x59411f;if(_0x495bba[_0x519c('0x46')][_0x519c('0x55')]){_0x1fd8a6[_0x519c('0x56')]=[{'model':db[_0x519c('0x75')],'as':_0x519c('0x76'),'required':![]},{'model':db[_0x519c('0x77')],'as':_0x519c('0x78'),'attributes':['name',_0x519c('0x79'),_0x519c('0x7a')],'required':![]},{'model':db[_0x519c('0x7b')],'as':_0x519c('0x7c'),'attributes':['id','name',_0x519c('0x7d')],'where':_0x495bba[_0x519c('0x46')]['tag']?{'id':_0x495bba[_0x519c('0x46')][_0x519c('0x7e')]}:undefined,'required':_0x495bba[_0x519c('0x46')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x519c('0x57')](_0x1fd8a6);})[_0x519c('0x21')](function(_0x47a11f){_0x583829[_0x519c('0x6a')]=_0x47a11f;return _0x583829;});}})[_0x519c('0x21')](respondWithFilteredResult(_0x1fd334,_0x1fd8a6))['catch'](handleError(_0x1fd334,null));};exports['addApplications']=function(_0x227364,_0xec21fd){var _0x3956a2=_0x227364[_0x519c('0x59')]['id'];var _0x5163f9=_0x227364[_0x519c('0x63')];var _0x519bec=0xc8;var _0x38e64c=null;return db['sequelize'][_0x519c('0x7f')]({'isolationLevel':db[_0x519c('0x80')][_0x519c('0x81')][_0x519c('0x82')][_0x519c('0x83')]},function(_0x137dfa){return db['FaxAccount']['findOne']({'where':{'id':_0x3956a2},'transaction':_0x137dfa})[_0x519c('0x21')](function(_0x95c0ec){if(_0x95c0ec){return db['FaxApplication'][_0x519c('0x39')]({'where':{'FaxAccountId':_0x3956a2},'transaction':_0x137dfa})[_0x519c('0x21')](function(){var _0x4393e3=_['map'](_0x5163f9,function(_0x17baf4){_0x17baf4[_0x519c('0x66')]=_0x3956a2;return _0x17baf4;});return db[_0x519c('0x84')][_0x519c('0x85')](_0x4393e3,{'transaction':_0x137dfa});});}else{_0x519bec=0x194;_0x38e64c=[];}});})['then'](function(){if(_0x519bec!==0x194){return db[_0x519c('0x84')][_0x519c('0x86')]({'where':{'FaxAccountId':_0x3956a2},'order':'priority'})[_0x519c('0x21')](function(_0x28aec9){_0x38e64c=_0x28aec9;});}})[_0x519c('0x2b')](function(_0x36ad78){_0x519bec=0x1f4;logger[_0x519c('0x28')](_0x36ad78['stack']);if(_0x36ad78[_0x519c('0x3c')]){delete _0x36ad78[_0x519c('0x3c')];}_0x38e64c=_0x36ad78;})[_0x519c('0x87')](function(){if(_0x38e64c===null){_0xec21fd[_0x519c('0x2c')](_0x519bec);}else{if(_0x519bec===0x1f4){_0xec21fd[_0x519c('0x2d')](_0x519bec)[_0x519c('0x3d')](_0x38e64c);}else{_0xec21fd[_0x519c('0x2d')](_0x519bec)[_0x519c('0x2e')](_0x38e64c);}}});};exports[_0x519c('0x88')]=function(_0xc37c20,_0x5199ea,_0x5342f3){var _0x51ccc3={};var _0x34cdbb={};var _0x2b72f9;var _0x1af9a2;return db['FaxAccount'][_0x519c('0x68')]({'where':{'id':_0xc37c20[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x5199ea,null))['then'](function(_0x557542){if(_0x557542){_0x2b72f9=_0x557542;_0x34cdbb[_0x519c('0x44')]=_[_0x519c('0x47')](db[_0x519c('0x84')][_0x519c('0x5a')]);_0x34cdbb['query']=_[_0x519c('0x47')](_0xc37c20[_0x519c('0x46')]);_0x34cdbb['filters']=_[_0x519c('0x49')](_0x34cdbb[_0x519c('0x44')],_0x34cdbb[_0x519c('0x46')]);_0x51ccc3[_0x519c('0x4a')]=_[_0x519c('0x49')](_0x34cdbb[_0x519c('0x44')],qs['fields'](_0xc37c20['query'][_0x519c('0x4b')]));_0x51ccc3[_0x519c('0x4a')]=_0x51ccc3[_0x519c('0x4a')][_0x519c('0x4c')]?_0x51ccc3[_0x519c('0x4a')]:_0x34cdbb['model'];_0x51ccc3[_0x519c('0x4e')]=qs[_0x519c('0x4f')](_0xc37c20[_0x519c('0x46')][_0x519c('0x4f')]);_0x51ccc3[_0x519c('0x50')]=qs[_0x519c('0x48')](_[_0x519c('0x69')](_0xc37c20[_0x519c('0x46')],_0x34cdbb[_0x519c('0x48')]));if(_0xc37c20['query']['filter']){_0x51ccc3[_0x519c('0x50')]=_[_0x519c('0x52')](_0x51ccc3['where'],{'$or':_[_0x519c('0x45')](_0x51ccc3[_0x519c('0x4a')],function(_0x48598c){var _0x2e7886={};_0x2e7886[_0x48598c]={'$like':'%'+_0xc37c20['query'][_0x519c('0x51')]+'%'};return _0x2e7886;})});}_0x51ccc3=_[_0x519c('0x52')]({},_0x51ccc3,_0xc37c20['options']);return _0x2b72f9[_0x519c('0x88')](_0x51ccc3);}})[_0x519c('0x21')](function(_0x35c1d9){if(_0x35c1d9){_0x1af9a2=_0x35c1d9[_0x519c('0x4c')];if(!_0xc37c20[_0x519c('0x46')][_0x519c('0x6e')](_0x519c('0x4d'))){_0x51ccc3[_0x519c('0x31')]=qs[_0x519c('0x31')](_0xc37c20['query'][_0x519c('0x31')]);_0x51ccc3[_0x519c('0x2f')]=qs[_0x519c('0x2f')](_0xc37c20[_0x519c('0x46')][_0x519c('0x2f')]);}return _0x2b72f9['getApplications'](_0x51ccc3);}})[_0x519c('0x21')](function(_0x59c6c1){if(_0x59c6c1){return _0x59c6c1?{'count':_0x1af9a2,'rows':_0x59c6c1}:null;}})[_0x519c('0x21')](respondWithResult(_0x5199ea,null))['catch'](handleError(_0x5199ea,null));};function Extension(_0x21a9cf,_0x2f947e,_0x27fc61,_0x4fb4c2){this[_0x519c('0x89')]=_0x519c('0x8a');this[_0x519c('0x8b')]=_0x21a9cf[_0x519c('0x8c')];this[_0x519c('0x8d')]=_0x4fb4c2;this[_0x519c('0x42')]='system';this['description']=_0x519c('0x8e');this['FaxAccountId']=_0x21a9cf['id'];this[_0x519c('0x8f')]=_0x2f947e;this[_0x519c('0x90')]=_0x27fc61;}function createExtensionsReciveFax(_0x2e1b14){var _0x40cf76=0x1;var _0x1a242b=[];_0x1a242b[_0x519c('0x91')](new Extension(_0x2e1b14,_0x40cf76,'','Answer'));_0x40cf76+=0x1;_0x1a242b['push'](new Extension(_0x2e1b14,_0x40cf76,_0x519c('0x92'),'Set'));_0x40cf76+=0x1;for(var _0x3e34d4 in _0x2e1b14){if(_0x2e1b14[_0x519c('0x6e')](_0x3e34d4)&&(_0x3e34d4==='ecm'||_0x3e34d4===_0x519c('0x8c')||_0x3e34d4===_0x519c('0x93')||_0x3e34d4===_0x519c('0x94')||_0x3e34d4===_0x519c('0x95')||_0x3e34d4===_0x519c('0x96')||_0x3e34d4===_0x519c('0x97')||_0x3e34d4===_0x519c('0x98')||_0x3e34d4===_0x519c('0x99'))){_0x1a242b['push'](new Extension(_0x2e1b14,_0x40cf76,_0x519c('0x9a')+_0x3e34d4+')='+_0x2e1b14[_0x3e34d4],_0x519c('0x9b')));_0x40cf76+=0x1;}}_0x1a242b[_0x519c('0x91')](new Extension(_0x2e1b14,_0x40cf76,'6','Wait'));_0x40cf76+=0x1;_0x1a242b[_0x519c('0x91')](new Extension(_0x2e1b14,_0x40cf76,_0x519c('0x9c'),_0x519c('0x9d')));_0x40cf76=0x0;return _0x1a242b;}exports[_0x519c('0x9e')]=function(_0xd98fbd,_0x4bc8ad,_0x48f3aa){var _0x5df284;return db[_0x519c('0x80')][_0x519c('0x7f')](function(_0x31c986){return db[_0x519c('0x40')][_0x519c('0x5b')](_0xd98fbd['body'],{'transaction':_0x31c986})[_0x519c('0x21')](function(_0x44a8e0){_0x5df284=_0x44a8e0[_0x519c('0x38')]({'plain':!![]});return db[_0x519c('0x9f')]['bulkCreate'](createExtensionsReciveFax(_0x5df284),{'transaction':_0x31c986});});})[_0x519c('0x21')](function(){return _0x5df284;})['then'](respondWithResult(_0x4bc8ad,null))[_0x519c('0x2b')](handleError(_0x4bc8ad,null));};exports[_0x519c('0xa0')]=function(_0x3e8abd,_0x94657f,_0x4ff52e){var _0x2b5ad5;return db['sequelize'][_0x519c('0x7f')](function(_0x4c80c8){return db[_0x519c('0x40')]['update'](_0x3e8abd[_0x519c('0x63')],{'where':{'id':_0x3e8abd[_0x519c('0x63')]['id']},'transaction':_0x4c80c8})[_0x519c('0x21')](function(_0x562250){return db[_0x519c('0x9f')][_0x519c('0x39')]({'where':{'FaxAccountId':_0x3e8abd['body']['id']},'transaction':_0x4c80c8})[_0x519c('0x21')](function(_0x582ff1){return db[_0x519c('0x9f')][_0x519c('0x85')](createExtensionsReciveFax(_[_0x519c('0x72')](_0x3e8abd[_0x519c('0x63')],['tech','key','createdAt',_0x519c('0xa1'),'TrunkId','ListId'])),{'transaction':_0x4c80c8});});});})[_0x519c('0x21')](function(){return db['FaxAccount'][_0x519c('0xa2')](_0x3e8abd[_0x519c('0x63')]['id']);})[_0x519c('0x21')](respondWithResult(_0x94657f,null))[_0x519c('0x2b')](handleError(_0x94657f,null));};exports['getMessages']=function(_0xc048a9,_0x84d9a,_0x574373){var _0x1d1a30={'raw':!![],'where':{}};var _0x2c3fa2={};var _0x2b7ba0={'count':0x0,'rows':[]};return db[_0x519c('0x40')][_0x519c('0x68')]({'where':{'id':_0xc048a9['params']['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x84d9a,null))[_0x519c('0x21')](function(_0x12eda2){if(_0x12eda2){_0x2c3fa2['model']=_[_0x519c('0x47')](db[_0x519c('0xa3')][_0x519c('0x5a')]);_0x2c3fa2[_0x519c('0x46')]=_[_0x519c('0x47')](_0xc048a9[_0x519c('0x46')]);_0x2c3fa2[_0x519c('0x48')]=_[_0x519c('0x49')](_0x2c3fa2[_0x519c('0x44')],_0x2c3fa2[_0x519c('0x46')]);_0x1d1a30[_0x519c('0x4a')]=_[_0x519c('0x49')](_0x2c3fa2['model'],qs[_0x519c('0x4b')](_0xc048a9['query'][_0x519c('0x4b')]));_0x1d1a30[_0x519c('0x4a')]=_0x1d1a30['attributes']['length']?_0x1d1a30[_0x519c('0x4a')]:_0x2c3fa2[_0x519c('0x44')];if(!_0xc048a9[_0x519c('0x46')][_0x519c('0x6e')](_0x519c('0x4d'))){_0x1d1a30[_0x519c('0x31')]=qs[_0x519c('0x31')](_0xc048a9[_0x519c('0x46')][_0x519c('0x31')]);_0x1d1a30[_0x519c('0x2f')]=qs[_0x519c('0x2f')](_0xc048a9[_0x519c('0x46')][_0x519c('0x2f')]);}_0x1d1a30[_0x519c('0x4e')]=qs[_0x519c('0x4f')](_0xc048a9['query'][_0x519c('0x4f')]);_0x1d1a30[_0x519c('0x50')]=qs[_0x519c('0x48')](_[_0x519c('0x69')](_0xc048a9[_0x519c('0x46')],_0x2c3fa2[_0x519c('0x48')]));_0x1d1a30[_0x519c('0x50')][_0x519c('0x66')]=_0x12eda2['id'];if(_0xc048a9[_0x519c('0x46')][_0x519c('0x51')]){_0x1d1a30[_0x519c('0x50')]=_[_0x519c('0x52')](_0x1d1a30[_0x519c('0x50')],{'$or':_[_0x519c('0x45')](_0x1d1a30[_0x519c('0x4a')],function(_0x1f7c77){var _0x20de1b={};_0x20de1b[_0x1f7c77]={'$like':'%'+_0xc048a9[_0x519c('0x46')]['filter']+'%'};return _0x20de1b;})});}if(_0xc048a9['query'][_0x519c('0xa4')]){var _0x257ca7=_0xc048a9[_0x519c('0x46')][_0x519c('0xa4')]['split'](',');var _0x765e18={};_0x765e18[_0x257ca7[0x0]]={'$gte':moment(_0x257ca7[0x1])['format'](_0x519c('0xa5'))};_0x1d1a30[_0x519c('0x50')]=_[_0x519c('0x52')](_0x1d1a30[_0x519c('0x50')],_0x765e18);}_0x1d1a30=_[_0x519c('0x52')]({},_0x1d1a30,_0xc048a9['options']);return db[_0x519c('0xa3')][_0x519c('0x32')]({'where':_0x1d1a30['where']})[_0x519c('0x21')](function(_0x301997){_0x2b7ba0[_0x519c('0x32')]=_0x301997;if(_0xc048a9['query'][_0x519c('0x55')]){_0x1d1a30[_0x519c('0x56')]=[{'all':!![]}];}return db[_0x519c('0xa3')][_0x519c('0x57')](_0x1d1a30);})['then'](function(_0xf9b389){_0x2b7ba0[_0x519c('0x6a')]=_0xf9b389;return _0x2b7ba0;});}})['then'](respondWithFilteredResult(_0x84d9a,_0x1d1a30))[_0x519c('0x2b')](handleError(_0x84d9a,null));};exports[_0x519c('0x3d')]=function(_0x16bf47,_0x5f4219,_0x1f36a){var _0x4da9db,_0x4b9f81={},_0x158741;if(_0x16bf47['body']['to']){_0x158741=_0x16bf47[_0x519c('0x63')]['to'][0x0];}return db[_0x519c('0x40')][_0x519c('0x60')]({'where':{'id':_0x16bf47[_0x519c('0x59')]['id']},'include':[{'model':db[_0x519c('0xa6')],'as':_0x519c('0xa7'),'include':[{'model':db[_0x519c('0x75')],'as':_0x519c('0xa8'),'where':{'fax':_0x158741},'limit':0x1,'order':[[_0x519c('0xa1'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x5f4219,null))[_0x519c('0x21')](function(_0x1c9e94){_0x4da9db=_0x1c9e94;if(_0x16bf47['body'][_0x519c('0xa9')]&&_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')][_0x519c('0x4c')]){for(var _0x2f918a=0x0;_0x2f918a<_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')]['length'];_0x2f918a+=0x1){_0x16bf47[_0x519c('0x63')]['attachments'][_0x2f918a]={'filename':_0x16bf47['body'][_0x519c('0xa9')][_0x2f918a][_0x519c('0x3c')],'id':_0x16bf47[_0x519c('0x63')]['attachments'][_0x2f918a]['id'],'path':path[_0x519c('0xaa')](config['root'],'server/files/attachments',_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')][_0x2f918a]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0x519c('0xab'),{'FaxAccountId':_[_0x519c('0xac')](_0x16bf47[_0x519c('0x59')]['id'])?undefined:_0x16bf47[_0x519c('0x59')]['id'],'path':_[_0x519c('0xac')](_0x16bf47['body']['attachments'][0x0][_0x519c('0x5')])?undefined:_0x16bf47['body'][_0x519c('0xa9')][0x0][_0x519c('0x5')],'fax':_[_0x519c('0xac')](_0x16bf47[_0x519c('0x63')]['to'][0x0])?undefined:_0x16bf47[_0x519c('0x63')]['to'][0x0]},client9002);})[_0x519c('0x21')](function(){if(_0x4da9db){if(_[_0x519c('0xac')](_0x16bf47['body'][_0x519c('0xad')])){_0x16bf47[_0x519c('0x63')][_0x519c('0xad')]=util[_0x519c('0xae')](_0x519c('0xaf'),_0x4da9db['name'],_0x4da9db[_0x519c('0xb0')]);}if(_0x4da9db['List']){if(_0x4da9db[_0x519c('0xa7')]['Contacts'][_0x519c('0x4c')]){return _0x4da9db[_0x519c('0xa7')][_0x519c('0xa8')][0x0];}else{return db[_0x519c('0x75')][_0x519c('0x5b')](_['defaults'](_0x16bf47[_0x519c('0x63')],{'firstName':_0x16bf47[_0x519c('0x63')]['to'][0x0],'phone':_0x16bf47[_0x519c('0x63')]['to'][0x0],'fax':_0x16bf47[_0x519c('0x63')]['to'][0x0],'ListId':_0x4da9db[_0x519c('0xb1')]}));}}else{throw new Error(_0x519c('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x519c('0x21')](function(_0x397cae){if(_0x397cae){return db[_0x519c('0x74')]['find']({'where':{'ContactId':_0x397cae['id'],'closed':![],'FaxAccountId':_0x4da9db['id']}})[_0x519c('0x21')](function(_0x4dcda7){if(_0x4dcda7){return[_0x4dcda7,![]];}return db[_0x519c('0x74')][_0x519c('0x5b')]({'UserId':_0x16bf47[_0x519c('0x5c')]['id'],'ContactId':_0x397cae['id'],'FaxAccountId':_0x4da9db['id'],'fax':_0x16bf47[_0x519c('0x63')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x519c('0x52')](_0x16bf47[_0x519c('0x63')],{'read':![],'body':_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')][0x0][_0x519c('0xb3')],'FaxAccountId':_0x4da9db['id'],'UserId':_0x16bf47[_0x519c('0x5c')]['id'],'ContactId':_0x397cae['id'],'AttachmentId':_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x519c('0xa3')],'as':_0x519c('0xb4')}]})['then'](function(_0x46cdf7){return[_0x46cdf7,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x3f4699,_0x162eec){if(_0x162eec){return _0x3f4699;}return db['FaxMessage'][_0x519c('0x5b')]({'direction':'out','read':![],'body':_0x16bf47['body']['attachments'][0x0][_0x519c('0xb3')],'FaxAccountId':_0x4da9db['id'],'FaxInteractionId':_0x3f4699['id'],'UserId':_0x16bf47[_0x519c('0x5c')]['id'],'ContactId':_0x3f4699[_0x519c('0xb5')],'AttachmentId':_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')][0x0]['id']})[_0x519c('0x21')](function(_0x53bc81){_0x3f4699['dataValues'][_0x519c('0xb4')]=[];_0x3f4699[_0x519c('0xb6')][_0x519c('0xb4')][_0x519c('0x91')](_0x53bc81[_0x519c('0xb6')]);return _0x3f4699;});})[_0x519c('0x21')](function(_0x2a1620){respondWithRpcPromise(_0x519c('0xb7'),_0x519c('0xb7'),{'FaxAccountId':_['isNil'](_0x16bf47['params']['id'])?undefined:_0x16bf47['params']['id'],'path':_[_0x519c('0xac')](_0x16bf47[_0x519c('0x63')][_0x519c('0xa9')][0x0][_0x519c('0x5')])?undefined:_0x16bf47[_0x519c('0x63')]['attachments'][0x0]['path'],'fax':_[_0x519c('0xac')](_0x16bf47[_0x519c('0x63')]['to'][0x0])?undefined:_0x16bf47[_0x519c('0x63')]['to'][0x0],'AttachmentId':_0x16bf47[_0x519c('0x63')]['attachments'][0x0]['id']},client9002)[_0x519c('0x21')](function(_0x20f4d4){logger['info'](_0x519c('0xb8'),_0x20f4d4);})[_0x519c('0x2b')](function(_0x4c6cab){logger[_0x519c('0x22')](_0x519c('0xb8'),_0x4c6cab);});return _0x2a1620;})[_0x519c('0x21')](respondWithResult(_0x5f4219,null))['catch'](handleError(_0x5f4219,null));};exports[_0x519c('0xb9')]=function(_0x50d86f,_0xce7426,_0x3b2b25){return db[_0x519c('0x40')]['find']({'where':{'id':_0x50d86f['params']['id']}})[_0x519c('0x21')](handleEntityNotFound(_0xce7426,null))[_0x519c('0x21')](function(_0x21f963){if(_0x21f963){return _0x21f963['addAgents'](_0x50d86f['body'][_0x519c('0x6b')],_['omit'](_0x50d86f['body'],[_0x519c('0x6b'),'id'])||{})['spread'](function(_0x3a8371){for(var _0x27558a=0x0;_0x27558a<_0x50d86f[_0x519c('0x63')][_0x519c('0x6b')][_0x519c('0x4c')];_0x27558a+=0x1){socket[_0x519c('0xba')](_0x519c('0xbb'),{'UserId':Number(_0x50d86f[_0x519c('0x63')]['ids'][_0x27558a]),'FaxAccountId':Number(_0x50d86f['params']['id'])});}return _0x3a8371;});}})[_0x519c('0x21')](respondWithResult(_0xce7426,null))[_0x519c('0x2b')](handleError(_0xce7426,null));};exports[_0x519c('0xbc')]=function(_0x4a0257,_0x350dfc,_0x5ab34e){return db[_0x519c('0x40')][_0x519c('0x60')]({'where':{'id':_0x4a0257[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x350dfc,null))[_0x519c('0x21')](function(_0x45d913){if(_0x45d913){return _0x45d913[_0x519c('0xbc')](_0x4a0257[_0x519c('0x46')][_0x519c('0x6b')])['then'](function(){if(_[_0x519c('0xbd')](_0x4a0257['query'][_0x519c('0x6b')])){for(var _0x48a4f6=0x0;_0x48a4f6<_0x4a0257[_0x519c('0x46')]['ids'][_0x519c('0x4c')];_0x48a4f6+=0x1){socket[_0x519c('0xba')](_0x519c('0xbe'),{'UserId':Number(_0x4a0257[_0x519c('0x46')]['ids'][_0x48a4f6]),'FaxAccountId':Number(_0x4a0257[_0x519c('0x59')]['id'])});}}else{socket[_0x519c('0xba')](_0x519c('0xbe'),{'UserId':Number(_0x4a0257['query'][_0x519c('0x6b')]),'FaxAccountId':Number(_0x4a0257[_0x519c('0x59')]['id'])});}});}})[_0x519c('0x21')](respondWithStatusCode(_0x350dfc,null))[_0x519c('0x2b')](handleError(_0x350dfc,null));};exports[_0x519c('0xbf')]=function(_0xe80b8f,_0x1dc459,_0x393fe4){var _0x1075c2={};var _0xce06b8={};var _0x9193ee;var _0x489fb7;return db[_0x519c('0x40')][_0x519c('0x68')]({'where':{'id':_0xe80b8f[_0x519c('0x59')]['id']}})[_0x519c('0x21')](handleEntityNotFound(_0x1dc459,null))[_0x519c('0x21')](function(_0xa1e0b2){if(_0xa1e0b2){_0x9193ee=_0xa1e0b2;_0xce06b8[_0x519c('0x44')]=_[_0x519c('0x47')](db['User'][_0x519c('0x5a')]);_0xce06b8[_0x519c('0x46')]=_[_0x519c('0x47')](_0xe80b8f[_0x519c('0x46')]);_0xce06b8[_0x519c('0x48')]=_[_0x519c('0x49')](_0xce06b8[_0x519c('0x44')],_0xce06b8[_0x519c('0x46')]);_0x1075c2['attributes']=_[_0x519c('0x49')](_0xce06b8[_0x519c('0x44')],qs[_0x519c('0x4b')](_0xe80b8f['query'][_0x519c('0x4b')]));_0x1075c2['attributes']=_0x1075c2[_0x519c('0x4a')]['length']?_0x1075c2['attributes']:_0xce06b8[_0x519c('0x44')];_0x1075c2[_0x519c('0x4e')]=qs['sort'](_0xe80b8f[_0x519c('0x46')]['sort']);_0x1075c2[_0x519c('0x50')]=qs[_0x519c('0x48')](_[_0x519c('0x69')](_0xe80b8f[_0x519c('0x46')],_0xce06b8[_0x519c('0x48')]));if(_0xe80b8f[_0x519c('0x46')][_0x519c('0x51')]){_0x1075c2[_0x519c('0x50')]=_[_0x519c('0x52')](_0x1075c2[_0x519c('0x50')],{'$or':_[_0x519c('0x45')](_0x1075c2[_0x519c('0x4a')],function(_0x4bf7c5){var _0x5ae4df={};_0x5ae4df[_0x4bf7c5]={'$like':'%'+_0xe80b8f[_0x519c('0x46')][_0x519c('0x51')]+'%'};return _0x5ae4df;})});}_0x1075c2=_[_0x519c('0x52')]({},_0x1075c2,_0xe80b8f[_0x519c('0x54')]);return _0x9193ee[_0x519c('0xbf')](_0x1075c2);}})[_0x519c('0x21')](function(_0x32b94f){if(_0x32b94f){_0x489fb7=_0x32b94f['length'];if(!_0xe80b8f[_0x519c('0x46')]['hasOwnProperty']('nolimit')){_0x1075c2[_0x519c('0x31')]=qs[_0x519c('0x31')](_0xe80b8f[_0x519c('0x46')]['limit']);_0x1075c2[_0x519c('0x2f')]=qs[_0x519c('0x2f')](_0xe80b8f[_0x519c('0x46')][_0x519c('0x2f')]);}return _0x9193ee[_0x519c('0xbf')](_0x1075c2);}})['then'](function(_0x423100){if(_0x423100){return _0x423100?{'count':_0x489fb7,'rows':_0x423100}:null;}})[_0x519c('0x21')](respondWithResult(_0x1dc459,null))[_0x519c('0x2b')](handleError(_0x1dc459,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 8348429..d4fc2f3 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 _0xf88a=['../../mysqldb','FaxAccount','save','remove','hasOwnProperty','hook','exports','events'];(function(_0x4089f6,_0x3441f4){var _0x5e9536=function(_0x44b15e){while(--_0x44b15e){_0x4089f6['push'](_0x4089f6['shift']());}};_0x5e9536(++_0x3441f4);}(_0xf88a,0x1ef));var _0xaf88=function(_0x3f0b03,_0x34d361){_0x3f0b03=_0x3f0b03-0x0;var _0x32aa32=_0xf88a[_0x3f0b03];return _0x32aa32;};'use strict';var EventEmitter=require(_0xaf88('0x0'));var FaxAccount=require(_0xaf88('0x1'))['db'][_0xaf88('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaf88('0x3'),'afterUpdate':'update','afterDestroy':_0xaf88('0x4')};function emitEvent(_0x4dcd3e){return function(_0x50952e,_0xca42ed,_0x142d11){FaxAccountEvents['emit'](_0x4dcd3e+':'+_0x50952e['id'],_0x50952e);FaxAccountEvents['emit'](_0x4dcd3e,_0x50952e);_0x142d11(null);};}for(var e in events){if(events[_0xaf88('0x5')](e)){var event=events[e];FaxAccount[_0xaf88('0x6')](e,emitEvent(event));}}module[_0xaf88('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x6d73=['FaxAccount','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x3c62ab,_0x33f23d){var _0x536970=function(_0x3a4759){while(--_0x3a4759){_0x3c62ab['push'](_0x3c62ab['shift']());}};_0x536970(++_0x33f23d);}(_0x6d73,0x132));var _0x36d7=function(_0x386132,_0x5646dd){_0x386132=_0x386132-0x0;var _0x3ba4da=_0x6d73[_0x386132];return _0x3ba4da;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x36d7('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x36d7('0x1')](0x0);var events={'afterCreate':_0x36d7('0x2'),'afterUpdate':'update','afterDestroy':_0x36d7('0x3')};function emitEvent(_0x3fe4a2){return function(_0x36195c,_0x4dfe92,_0x704d55){FaxAccountEvents['emit'](_0x3fe4a2+':'+_0x36195c['id'],_0x36195c);FaxAccountEvents['emit'](_0x3fe4a2,_0x36195c);_0x704d55(null);};}for(var e in events){if(events[_0x36d7('0x4')](e)){var event=events[e];FaxAccount[_0x36d7('0x5')](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 839463f..7080df0 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 _0x5db5=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','lodash','../../config/logger','api','moment'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x5db5,0xbc));var _0x55db=function(_0x2491a1,_0x234a0f){_0x2491a1=_0x2491a1-0x0;var _0x316dd1=_0x5db5[_0x2491a1];return _0x316dd1;};'use strict';var _=require(_0x55db('0x0'));var util=require('util');var logger=require(_0x55db('0x1'))(_0x55db('0x2'));var moment=require(_0x55db('0x3'));var BPromise=require(_0x55db('0x4'));var rp=require(_0x55db('0x5'));var fs=require('fs');var path=require(_0x55db('0x6'));var rimraf=require(_0x55db('0x7'));var config=require('../../config/environment');var attributes=require(_0x55db('0x8'));module[_0x55db('0x9')]=function(_0x298cbd,_0x5b87b0){return _0x298cbd[_0x55db('0xa')](_0x55db('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ad=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x40ad,0x9b));var _0xd40a=function(_0x1a362a,_0x532d2e){_0x1a362a=_0x1a362a-0x0;var _0x1c6fc4=_0x40ad[_0x1a362a];return _0x1c6fc4;};'use strict';var _=require(_0xd40a('0x0'));var util=require(_0xd40a('0x1'));var logger=require(_0xd40a('0x2'))('api');var moment=require(_0xd40a('0x3'));var BPromise=require(_0xd40a('0x4'));var rp=require(_0xd40a('0x5'));var fs=require('fs');var path=require(_0xd40a('0x6'));var rimraf=require(_0xd40a('0x7'));var config=require(_0xd40a('0x8'));var attributes=require(_0xd40a('0x9'));module['exports']=function(_0x11b7ce,_0x5e880e){return _0x11b7ce[_0xd40a('0xa')](_0xd40a('0xb'),attributes,{'tableName':_0xd40a('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 daec076..f7227e7 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 _0x954a=['queueId','FaxQueue','queue','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','map','include','model','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','CompanyId','ListId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','push','close','*,*,*,*','created','ContactId','AttachmentId','interaction','UserId','name','unshift','agent','waitForTheAssignedAgent'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0x954a,0x119));var _0xa954=function(_0x4e866b,_0x508288){_0x4e866b=_0x4e866b-0x0;var _0x5888f6=_0x954a[_0x4e866b];return _0x5888f6;};'use strict';var _=require(_0xa954('0x0'));var util=require('util');var moment=require(_0xa954('0x1'));var BPromise=require(_0xa954('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa954('0x3'));var db=require(_0xa954('0x4'))['db'];var utils=require(_0xa954('0x5'));var logger=require(_0xa954('0x6'))(_0xa954('0x7'));var config=require(_0xa954('0x8'));var jayson=require(_0xa954('0x9'));var client=jayson['client'][_0xa954('0xa')]({'port':0x232c});config[_0xa954('0xb')]=_[_0xa954('0xc')](config['redis'],{'host':_0xa954('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa954('0xb')]));require(_0xa954('0xe'))[_0xa954('0xf')](socket);function respondWithRpcPromise(_0x52ef1a,_0x55303e,_0x44557f){return new BPromise(function(_0x2e3bad,_0x29275a){return client[_0xa954('0x10')](_0x52ef1a,_0x44557f)['then'](function(_0x5c577f){logger[_0xa954('0x11')](_0xa954('0x12'),_0x55303e,_0xa954('0x13'));logger[_0xa954('0x14')](_0xa954('0x15'),_0x55303e,_0xa954('0x13'),JSON[_0xa954('0x16')](_0x5c577f));if(_0x5c577f[_0xa954('0x17')]){if(_0x5c577f[_0xa954('0x17')][_0xa954('0x18')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x55303e,_0x5c577f['error'][_0xa954('0x19')]);return _0x29275a(_0x5c577f['error'][_0xa954('0x19')]);}logger[_0xa954('0x17')](_0xa954('0x12'),_0x55303e,_0x5c577f['error']['message']);return _0x2e3bad(_0x5c577f[_0xa954('0x17')][_0xa954('0x19')]);}else{logger[_0xa954('0x11')](_0xa954('0x12'),_0x55303e,_0xa954('0x13'));_0x2e3bad(_0x5c577f[_0xa954('0x1a')][_0xa954('0x19')]);}})[_0xa954('0x1b')](function(_0x539812){logger[_0xa954('0x17')](_0xa954('0x12'),_0x55303e,_0x539812);_0x29275a(_0x539812);});});}exports[_0xa954('0x1c')]=function(_0x5b9df8){var _0x4db9c6=this;return new Promise(function(_0x24bc8b,_0x5b943d){return db[_0xa954('0x1d')]['findAll']({'raw':_0x5b9df8[_0xa954('0x1e')]?_0x5b9df8[_0xa954('0x1e')][_0xa954('0x1f')]===undefined?!![]:![]:!![],'where':_0x5b9df8[_0xa954('0x1e')]?_0x5b9df8[_0xa954('0x1e')][_0xa954('0x20')]||null:null,'attributes':_0x5b9df8[_0xa954('0x1e')]?_0x5b9df8['options'][_0xa954('0x21')]||null:null,'limit':_0x5b9df8['options']?_0x5b9df8[_0xa954('0x1e')][_0xa954('0x22')]||null:null,'include':_0x5b9df8['options']?_0x5b9df8[_0xa954('0x1e')]['include']?_[_0xa954('0x23')](_0x5b9df8[_0xa954('0x1e')]['include'],function(_0x1b0449){return{'model':db[_0x1b0449['model']],'as':_0x1b0449['as'],'attributes':_0x1b0449[_0xa954('0x21')],'include':_0x1b0449[_0xa954('0x24')]?_['map'](_0x1b0449[_0xa954('0x24')],function(_0x9b33b7){return{'model':db[_0x9b33b7[_0xa954('0x25')]],'as':_0x9b33b7['as'],'attributes':_0x9b33b7[_0xa954('0x21')],'include':_0x9b33b7[_0xa954('0x24')]?_[_0xa954('0x23')](_0x9b33b7[_0xa954('0x24')],function(_0x564f33){return{'model':db[_0x564f33[_0xa954('0x25')]],'as':_0x564f33['as'],'attributes':_0x564f33[_0xa954('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa954('0x26')](function(_0x4ed19b){logger[_0xa954('0x11')](_0xa954('0x1c'),_0x5b9df8);logger['debug'](_0xa954('0x1c'),_0x5b9df8,JSON[_0xa954('0x16')](_0x4ed19b));_0x24bc8b(_0x4ed19b);})[_0xa954('0x1b')](function(_0x3f3401){logger[_0xa954('0x17')]('GetFaxAccount',_0x3f3401[_0xa954('0x19')],_0x5b9df8);_0x5b943d(_0x4db9c6['error'](0x1f4,_0x3f3401[_0xa954('0x19')]));});});};exports[_0xa954('0x27')]=function(_0x11bb6d,_0x5ca4ff,_0x338196){var _0x2dd857=this;return new Promise(function(_0x2ed409,_0x14ff1d){var _0x4d8cb2={'body':_0x11bb6d[_0xa954('0x28')],'channel':_0xa954('0x29')};var _0x40b04b=[];var _0x18d9c9=[];var _0x48b997={};return db[_0xa954('0x2a')][_0xa954('0x2b')]()[_0xa954('0x26')](function(_0x58fc5e){if(!_0x58fc5e){throw new db[(_0xa954('0x2c'))][(_0xa954('0x2d'))](_0xa954('0x2e'));}_0x40b04b=_['difference'](_[_0xa954('0x2f')](_0x58fc5e),['createdAt',_0xa954('0x30')]);_0x18d9c9=_[_0xa954('0x31')](_[_0xa954('0x2f')](_0x58fc5e),[_0xa954('0x32'),_0xa954('0x30'),_0xa954('0x33'),_0xa954('0x34')]);if(_0x11bb6d['body']['id']){delete _0x11bb6d['body']['id'];}if(_[_0xa954('0x35')](_0x11bb6d[_0xa954('0x28')][_0xa954('0x36')])){throw new db[(_0xa954('0x2c'))][(_0xa954('0x2d'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x11bb6d[_0xa954('0x28')][_0xa954('0x28')])||_0x11bb6d[_0xa954('0x28')][_0xa954('0x28')]===''){throw new db[(_0xa954('0x2c'))][(_0xa954('0x2d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa954('0x35')](_0x11bb6d[_0xa954('0x28')][_0xa954('0x37')])){throw new db[(_0xa954('0x2c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18d9c9);}if(!_[_0xa954('0x38')](_0x18d9c9,_0x11bb6d[_0xa954('0x28')][_0xa954('0x37')])){throw new db[(_0xa954('0x2c'))]['ValidationError'](_0xa954('0x39')+_0x18d9c9);}_0x48b997[_0x11bb6d['body']['mapKey']]=_0x11bb6d[_0xa954('0x28')]['from'];})[_0xa954('0x26')](function(){return db['FaxAccount']['find']({'where':{'id':_0x11bb6d[_0xa954('0x3a')]['id']},'include':[{'model':db[_0xa954('0x3b')],'as':_0xa954('0x3c'),'include':[{'model':db[_0xa954('0x2a')],'as':_0xa954('0x3d'),'where':_0x48b997,'limit':0x1,'order':[['updatedAt',_0xa954('0x3e')]]}]},{'model':db[_0xa954('0x3f')],'as':_0xa954('0x40')}]});})[_0xa954('0x26')](function(_0x183d2d){if(_0x183d2d&&_0x183d2d[_0xa954('0x3c')]){var _0x121596=_0x183d2d['get']({'plain':!![]});_0x4d8cb2[_0xa954('0x3a')]=_0x121596;_0x4d8cb2[_0xa954('0x41')]=_0x121596[_0xa954('0x40')];_0x4d8cb2[_0xa954('0x42')]=_0x121596[_0xa954('0x3c')];_0x4d8cb2[_0xa954('0x41')]=_['orderBy'](_0x4d8cb2[_0xa954('0x41')],['priority'],[_0xa954('0x43')]);if(_0x4d8cb2[_0xa954('0x3a')][_0xa954('0x40')]){delete _0x4d8cb2['account'][_0xa954('0x40')];}if(_0x4d8cb2[_0xa954('0x3a')][_0xa954('0x3c')]&&_0x4d8cb2[_0xa954('0x3a')][_0xa954('0x3c')][_0xa954('0x3d')][_0xa954('0x44')]){return _0x4d8cb2[_0xa954('0x3a')]['List'][_0xa954('0x3d')][0x0];}var _0x5cbb61=_[_0xa954('0xc')](_0x11bb6d['body'],{'firstName':_0x11bb6d['body'][_0xa954('0x36')],'ListId':_0x121596[_0xa954('0x34')]});_0x5cbb61[_0x11bb6d[_0xa954('0x28')][_0xa954('0x37')]]=_0x11bb6d['body']['from'];return db[_0xa954('0x2a')][_0xa954('0x45')](_0x5cbb61,{'fields':_0x40b04b,'raw':!![]});}})[_0xa954('0x26')](function(_0x23338e){_0x4d8cb2[_0xa954('0x46')]=_0x23338e;if(_0x23338e){var _0x56aa73={'ContactId':_0x23338e['id'],'FaxAccountId':_0x11bb6d['account']['id'],'fax':_0x23338e['fax']};return db[_0xa954('0x47')]['find']({'where':{'ContactId':_0x23338e['id'],'closed':![],'FaxAccountId':_0x11bb6d[_0xa954('0x3a')]['id']}})[_0xa954('0x26')](function(_0x5c8b40){if(_0x5c8b40){return[_0x5c8b40,![]];}return db[_0xa954('0x47')][_0xa954('0x45')](_0x56aa73)['then'](function(_0x44d4c3){return[_0x44d4c3,!![]];});});}else{throw new Error(_0xa954('0x48'));}})[_0xa954('0x49')](function(_0x59eafc,_0x252f15){var _0x2ebd2e=_0x59eafc[_0xa954('0x4a')]({'plain':!![]});if(_0x252f15){if(_0x4d8cb2[_0xa954('0x3a')]['autoclose']){_0x4d8cb2[_0xa954('0x41')][_0xa954('0x4b')]({'id':0x0,'priority':_0x4d8cb2[_0xa954('0x41')]['length']+0x1,'app':_0xa954('0x4c'),'appdata':'unmanaged','interval':_0xa954('0x4d')});}_0x2ebd2e[_0xa954('0x4e')]=!![];}else{_0x2ebd2e['created']=![];}_0x4d8cb2['interaction']=_0x2ebd2e;return db['FaxMessage'][_0xa954('0x45')]({'body':_0x11bb6d[_0xa954('0x28')][_0xa954('0x28')],'FaxAccountId':_0x11bb6d[_0xa954('0x3a')]['id'],'FaxInteractionId':_0x59eafc['id'],'direction':'in','ContactId':_0x59eafc[_0xa954('0x4f')],'AttachmentId':_0x11bb6d['body'][_0xa954('0x50')]});})[_0xa954('0x26')](function(_0x51caaa){_0x4d8cb2[_0xa954('0x19')]=_0x51caaa;if(!_0x4d8cb2[_0xa954('0x51')][_0xa954('0x52')])return;return db['User']['find']({'attributes':['id',_0xa954('0x53')],'where':{'id':_0x4d8cb2[_0xa954('0x51')][_0xa954('0x52')]}});})[_0xa954('0x26')](function(_0x549858){if(_0x549858){_0x4d8cb2['applications'][_0xa954('0x54')]({'id':0x0,'priority':0x0,'app':_0xa954('0x55'),'appdata':_0x549858[_0xa954('0x53')]+','+(_0x4d8cb2[_0xa954('0x3a')][_0xa954('0x56')]||0xa),'interval':_0xa954('0x4d')});}if(!_0x4d8cb2['interaction'][_0xa954('0x57')])return;return db[_0xa954('0x58')]['find']({'attributes':['id','name'],'where':{'id':_0x4d8cb2['interaction'][_0xa954('0x57')]}});})[_0xa954('0x26')](function(_0x94ea72){if(_0x94ea72){_0x4d8cb2[_0xa954('0x41')][_0xa954('0x54')]({'id':0x0,'priority':0x1,'app':_0xa954('0x59'),'appdata':_0x94ea72[_0xa954('0x53')]+','+(_0x4d8cb2['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xa954('0x4d')});}return respondWithRpcPromise(_0xa954('0x5a'),_0xa954('0x5b'),_0x4d8cb2);})[_0xa954('0x26')](function(_0x4af19f){_0x2ed409(_0x4af19f);})['catch'](function(_0x69fdfc){_0x14ff1d(_0x2dd857['error'](0x1f4,_0x69fdfc[_0xa954('0x19')]));});});}; \ No newline at end of file +var _0x5b8d=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','attributes','limit','include','map','model','then','GetFaxAccount','catch','NotifyFaxAccount','body','fax','describe','Sequelize','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','CmContact','Contacts','applications','Applications','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','push','close','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','unshift','agent','name','queueId','FaxQueue','queue','waitForTheAssignedQueue','Start','startRouting'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x5b8d,0x1c2));var _0xd5b8=function(_0x5a453b,_0x32a8a4){_0x5a453b=_0x5a453b-0x0;var _0x325a5b=_0x5b8d[_0x5a453b];return _0x325a5b;};'use strict';var _=require('lodash');var util=require(_0xd5b8('0x0'));var moment=require('moment');var BPromise=require(_0xd5b8('0x1'));var rs=require(_0xd5b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd5b8('0x3'))['db'];var utils=require(_0xd5b8('0x4'));var logger=require(_0xd5b8('0x5'))(_0xd5b8('0x6'));var config=require(_0xd5b8('0x7'));var jayson=require(_0xd5b8('0x8'));var client=jayson[_0xd5b8('0x9')]['http']({'port':0x232c});config['redis']=_[_0xd5b8('0xa')](config[_0xd5b8('0xb')],{'host':_0xd5b8('0xc'),'port':0x18eb});var socket=require(_0xd5b8('0xd'))(new Redis(config[_0xd5b8('0xb')]));require(_0xd5b8('0xe'))[_0xd5b8('0xf')](socket);function respondWithRpcPromise(_0xb42b08,_0xe2d612,_0x23431e){return new BPromise(function(_0x3113da,_0x255f9b){return client[_0xd5b8('0x10')](_0xb42b08,_0x23431e)['then'](function(_0x1f7acb){logger['info'](_0xd5b8('0x11'),_0xe2d612,_0xd5b8('0x12'));logger[_0xd5b8('0x13')](_0xd5b8('0x14'),_0xe2d612,_0xd5b8('0x12'),JSON[_0xd5b8('0x15')](_0x1f7acb));if(_0x1f7acb[_0xd5b8('0x16')]){if(_0x1f7acb['error'][_0xd5b8('0x17')]===0x1f4){logger[_0xd5b8('0x16')](_0xd5b8('0x11'),_0xe2d612,_0x1f7acb[_0xd5b8('0x16')][_0xd5b8('0x18')]);return _0x255f9b(_0x1f7acb[_0xd5b8('0x16')][_0xd5b8('0x18')]);}logger[_0xd5b8('0x16')](_0xd5b8('0x11'),_0xe2d612,_0x1f7acb[_0xd5b8('0x16')][_0xd5b8('0x18')]);return _0x3113da(_0x1f7acb['error']['message']);}else{logger['info'](_0xd5b8('0x11'),_0xe2d612,_0xd5b8('0x12'));_0x3113da(_0x1f7acb[_0xd5b8('0x19')][_0xd5b8('0x18')]);}})['catch'](function(_0x555b0d){logger[_0xd5b8('0x16')](_0xd5b8('0x11'),_0xe2d612,_0x555b0d);_0x255f9b(_0x555b0d);});});}exports['GetFaxAccount']=function(_0x5a7a95){var _0x8e078b=this;return new Promise(function(_0x3bc02e,_0x25792c){return db['FaxAccount']['findAll']({'raw':_0x5a7a95[_0xd5b8('0x1a')]?_0x5a7a95[_0xd5b8('0x1a')][_0xd5b8('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a7a95[_0xd5b8('0x1a')]?_0x5a7a95[_0xd5b8('0x1a')]['where']||null:null,'attributes':_0x5a7a95['options']?_0x5a7a95[_0xd5b8('0x1a')][_0xd5b8('0x1c')]||null:null,'limit':_0x5a7a95['options']?_0x5a7a95[_0xd5b8('0x1a')][_0xd5b8('0x1d')]||null:null,'include':_0x5a7a95[_0xd5b8('0x1a')]?_0x5a7a95[_0xd5b8('0x1a')][_0xd5b8('0x1e')]?_[_0xd5b8('0x1f')](_0x5a7a95[_0xd5b8('0x1a')][_0xd5b8('0x1e')],function(_0x38a0ab){return{'model':db[_0x38a0ab[_0xd5b8('0x20')]],'as':_0x38a0ab['as'],'attributes':_0x38a0ab[_0xd5b8('0x1c')],'include':_0x38a0ab[_0xd5b8('0x1e')]?_[_0xd5b8('0x1f')](_0x38a0ab['include'],function(_0x18d6a9){return{'model':db[_0x18d6a9['model']],'as':_0x18d6a9['as'],'attributes':_0x18d6a9[_0xd5b8('0x1c')],'include':_0x18d6a9[_0xd5b8('0x1e')]?_[_0xd5b8('0x1f')](_0x18d6a9[_0xd5b8('0x1e')],function(_0x193533){return{'model':db[_0x193533[_0xd5b8('0x20')]],'as':_0x193533['as'],'attributes':_0x193533[_0xd5b8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd5b8('0x21')](function(_0x3b3ed2){logger['info'](_0xd5b8('0x22'),_0x5a7a95);logger['debug'](_0xd5b8('0x22'),_0x5a7a95,JSON[_0xd5b8('0x15')](_0x3b3ed2));_0x3bc02e(_0x3b3ed2);})[_0xd5b8('0x23')](function(_0x3e7c48){logger[_0xd5b8('0x16')](_0xd5b8('0x22'),_0x3e7c48[_0xd5b8('0x18')],_0x5a7a95);_0x25792c(_0x8e078b['error'](0x1f4,_0x3e7c48['message']));});});};exports[_0xd5b8('0x24')]=function(_0xac69d9,_0x475b9d,_0x3569c0){var _0x2cb789=this;return new Promise(function(_0x5e3683,_0x81992f){var _0x3766e6={'body':_0xac69d9[_0xd5b8('0x25')],'channel':_0xd5b8('0x26')};var _0x4ab454=[];var _0x22ad06=[];var _0xa33129={};return db['CmContact'][_0xd5b8('0x27')]()[_0xd5b8('0x21')](function(_0x5e51be){if(!_0x5e51be){throw new db[(_0xd5b8('0x28'))]['ValidationError'](_0xd5b8('0x29'));}_0x4ab454=_[_0xd5b8('0x2a')](_[_0xd5b8('0x2b')](_0x5e51be),['createdAt',_0xd5b8('0x2c')]);_0x22ad06=_[_0xd5b8('0x2a')](_[_0xd5b8('0x2b')](_0x5e51be),[_0xd5b8('0x2d'),_0xd5b8('0x2c'),_0xd5b8('0x2e'),_0xd5b8('0x2f')]);if(_0xac69d9['body']['id']){delete _0xac69d9[_0xd5b8('0x25')]['id'];}if(_[_0xd5b8('0x30')](_0xac69d9[_0xd5b8('0x25')][_0xd5b8('0x31')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0xd5b8('0x30')](_0xac69d9[_0xd5b8('0x25')][_0xd5b8('0x25')])||_0xac69d9[_0xd5b8('0x25')][_0xd5b8('0x25')]===''){throw new db['Sequelize'][(_0xd5b8('0x32'))](_0xd5b8('0x33'));}if(_[_0xd5b8('0x30')](_0xac69d9[_0xd5b8('0x25')][_0xd5b8('0x34')])){throw new db[(_0xd5b8('0x28'))][(_0xd5b8('0x32'))](_0xd5b8('0x35')+_0x22ad06);}if(!_[_0xd5b8('0x36')](_0x22ad06,_0xac69d9[_0xd5b8('0x25')][_0xd5b8('0x34')])){throw new db[(_0xd5b8('0x28'))][(_0xd5b8('0x32'))](_0xd5b8('0x37')+_0x22ad06);}_0xa33129[_0xac69d9[_0xd5b8('0x25')]['mapKey']]=_0xac69d9[_0xd5b8('0x25')][_0xd5b8('0x31')];})[_0xd5b8('0x21')](function(){return db[_0xd5b8('0x38')][_0xd5b8('0x39')]({'where':{'id':_0xac69d9[_0xd5b8('0x3a')]['id']},'include':[{'model':db[_0xd5b8('0x3b')],'as':_0xd5b8('0x3c'),'include':[{'model':db[_0xd5b8('0x3d')],'as':_0xd5b8('0x3e'),'where':_0xa33129,'limit':0x1,'order':[[_0xd5b8('0x2c'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0xd5b8('0x21')](function(_0x27857e){if(_0x27857e&&_0x27857e[_0xd5b8('0x3c')]){var _0x53eee8=_0x27857e['get']({'plain':!![]});_0x3766e6[_0xd5b8('0x3a')]=_0x53eee8;_0x3766e6[_0xd5b8('0x3f')]=_0x53eee8[_0xd5b8('0x40')];_0x3766e6['list']=_0x53eee8['List'];_0x3766e6['applications']=_['orderBy'](_0x3766e6[_0xd5b8('0x3f')],[_0xd5b8('0x41')],[_0xd5b8('0x42')]);if(_0x3766e6[_0xd5b8('0x3a')][_0xd5b8('0x40')]){delete _0x3766e6[_0xd5b8('0x3a')]['Applications'];}if(_0x3766e6[_0xd5b8('0x3a')][_0xd5b8('0x3c')]&&_0x3766e6['account'][_0xd5b8('0x3c')][_0xd5b8('0x3e')]['length']){return _0x3766e6[_0xd5b8('0x3a')][_0xd5b8('0x3c')][_0xd5b8('0x3e')][0x0];}var _0x5b07a5=_[_0xd5b8('0xa')](_0xac69d9[_0xd5b8('0x25')],{'firstName':_0xac69d9[_0xd5b8('0x25')]['from'],'ListId':_0x53eee8['ListId']});_0x5b07a5[_0xac69d9['body']['mapKey']]=_0xac69d9[_0xd5b8('0x25')]['from'];return db[_0xd5b8('0x3d')][_0xd5b8('0x43')](_0x5b07a5,{'fields':_0x4ab454,'raw':!![]});}})[_0xd5b8('0x21')](function(_0x365823){_0x3766e6[_0xd5b8('0x44')]=_0x365823;if(_0x365823){var _0x4f6145={'ContactId':_0x365823['id'],'FaxAccountId':_0xac69d9['account']['id'],'fax':_0x365823['fax']};return db[_0xd5b8('0x45')][_0xd5b8('0x39')]({'where':{'ContactId':_0x365823['id'],'closed':![],'FaxAccountId':_0xac69d9['account']['id']}})[_0xd5b8('0x21')](function(_0x316149){if(_0x316149){return[_0x316149,![]];}return db['FaxInteraction'][_0xd5b8('0x43')](_0x4f6145)[_0xd5b8('0x21')](function(_0x4df89d){return[_0x4df89d,!![]];});});}else{throw new Error(_0xd5b8('0x46'));}})[_0xd5b8('0x47')](function(_0x1ec68d,_0x54df22){var _0x2c9c59=_0x1ec68d[_0xd5b8('0x48')]({'plain':!![]});if(_0x54df22){if(_0x3766e6[_0xd5b8('0x3a')]['autoclose']){_0x3766e6[_0xd5b8('0x3f')][_0xd5b8('0x49')]({'id':0x0,'priority':_0x3766e6[_0xd5b8('0x3f')]['length']+0x1,'app':_0xd5b8('0x4a'),'appdata':'unmanaged','interval':_0xd5b8('0x4b')});}_0x2c9c59[_0xd5b8('0x4c')]=!![];}else{_0x2c9c59[_0xd5b8('0x4c')]=![];}_0x3766e6['interaction']=_0x2c9c59;return db[_0xd5b8('0x4d')][_0xd5b8('0x43')]({'body':_0xac69d9[_0xd5b8('0x25')]['body'],'FaxAccountId':_0xac69d9[_0xd5b8('0x3a')]['id'],'FaxInteractionId':_0x1ec68d['id'],'direction':'in','ContactId':_0x1ec68d['ContactId'],'AttachmentId':_0xac69d9['body'][_0xd5b8('0x4e')]});})[_0xd5b8('0x21')](function(_0x1b3375){_0x3766e6[_0xd5b8('0x18')]=_0x1b3375;if(!_0x3766e6[_0xd5b8('0x4f')]['UserId'])return;return db['User'][_0xd5b8('0x39')]({'attributes':['id','name'],'where':{'id':_0x3766e6[_0xd5b8('0x4f')][_0xd5b8('0x50')]}});})[_0xd5b8('0x21')](function(_0x33d118){if(_0x33d118){_0x3766e6[_0xd5b8('0x3f')][_0xd5b8('0x51')]({'id':0x0,'priority':0x0,'app':_0xd5b8('0x52'),'appdata':_0x33d118[_0xd5b8('0x53')]+','+(_0x3766e6[_0xd5b8('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0xd5b8('0x4b')});}if(!_0x3766e6['interaction'][_0xd5b8('0x54')])return;return db[_0xd5b8('0x55')][_0xd5b8('0x39')]({'attributes':['id',_0xd5b8('0x53')],'where':{'id':_0x3766e6['interaction'][_0xd5b8('0x54')]}});})[_0xd5b8('0x21')](function(_0x352ee7){if(_0x352ee7){_0x3766e6[_0xd5b8('0x3f')][_0xd5b8('0x51')]({'id':0x0,'priority':0x1,'app':_0xd5b8('0x56'),'appdata':_0x352ee7[_0xd5b8('0x53')]+','+(_0x3766e6[_0xd5b8('0x3a')][_0xd5b8('0x57')]||0x12c),'interval':_0xd5b8('0x4b')});}return respondWithRpcPromise(_0xd5b8('0x58'),_0xd5b8('0x59'),_0x3766e6);})[_0xd5b8('0x21')](function(_0x1c9a1b){_0x5e3683(_0x1c9a1b);})['catch'](function(_0x137355){_0x81992f(_0x2cb789[_0xd5b8('0x16')](0x1f4,_0x137355[_0xd5b8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7a7747c..c97dad6 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 _0x8bb3=['length','faxAccount:','save','remove','update','removeListener'];(function(_0x247ebe,_0x23b626){var _0x55f7f7=function(_0x4357ff){while(--_0x4357ff){_0x247ebe['push'](_0x247ebe['shift']());}};_0x55f7f7(++_0x23b626);}(_0x8bb3,0x110));var _0x38bb=function(_0x32e2a1,_0x5e579d){_0x32e2a1=_0x32e2a1-0x0;var _0x3542c3=_0x8bb3[_0x32e2a1];return _0x3542c3;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x38bb('0x0'),_0x38bb('0x1'),_0x38bb('0x2')];function createListener(_0x2fb92f,_0x134a49){return function(_0x2c46a4){_0x134a49['emit'](_0x2fb92f,_0x2c46a4);};}function removeListener(_0x3ebf12,_0x48ec1c){return function(){FaxAccountEvents[_0x38bb('0x3')](_0x3ebf12,_0x48ec1c);};}exports['register']=function(_0x2341f0){for(var _0x575219=0x0,_0x40e80e=events[_0x38bb('0x4')];_0x575219<_0x40e80e;_0x575219++){var _0x3c2aab=events[_0x575219];var _0x40736b=createListener(_0x38bb('0x5')+_0x3c2aab,_0x2341f0);FaxAccountEvents['on'](_0x3c2aab,_0x40736b);}}; \ No newline at end of file +var _0xf65a=['remove','update','emit','removeListener','length','save'];(function(_0xb5db3c,_0x4e3042){var _0x5a5159=function(_0x2a95f6){while(--_0x2a95f6){_0xb5db3c['push'](_0xb5db3c['shift']());}};_0x5a5159(++_0x4e3042);}(_0xf65a,0x167));var _0xaf65=function(_0x3c5b4c,_0x1e873a){_0x3c5b4c=_0x3c5b4c-0x0;var _0x262dd7=_0xf65a[_0x3c5b4c];return _0x262dd7;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xaf65('0x0'),_0xaf65('0x1'),_0xaf65('0x2')];function createListener(_0x40240a,_0x494f2b){return function(_0x3cf339){_0x494f2b[_0xaf65('0x3')](_0x40240a,_0x3cf339);};}function removeListener(_0x19a3a8,_0x5ca133){return function(){FaxAccountEvents[_0xaf65('0x4')](_0x19a3a8,_0x5ca133);};}exports['register']=function(_0x4aadeb){for(var _0x299d7e=0x0,_0x3d3983=events[_0xaf65('0x5')];_0x299d7e<_0x3d3983;_0x299d7e++){var _0x25c814=events[_0x299d7e];var _0x269d21=createListener('faxAccount:'+_0x25c814,_0x4aadeb);FaxAccountEvents['on'](_0x25c814,_0x269d21);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 601b5f4..2ab9490 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 _0x22c4=['addAnswer','addInteraction','addApplications','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers'];(function(_0x4809f3,_0x262568){var _0x4a14fb=function(_0x358363){while(--_0x358363){_0x4809f3['push'](_0x4809f3['shift']());}};_0x4a14fb(++_0x262568);}(_0x22c4,0x81));var _0x422c=function(_0x239875,_0x52a793){_0x239875=_0x239875-0x0;var _0x55a8d6=_0x22c4[_0x239875];return _0x55a8d6;};'use strict';var multer=require(_0x422c('0x0'));var util=require('util');var path=require(_0x422c('0x1'));var timeout=require(_0x422c('0x2'));var express=require(_0x422c('0x3'));var router=express[_0x422c('0x4')]();var fs_extra=require(_0x422c('0x5'));var auth=require(_0x422c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x422c('0x7'));router[_0x422c('0x8')]('/',auth[_0x422c('0x9')](),controller[_0x422c('0xa')]);router['get'](_0x422c('0xb'),auth['isAuthenticated'](),controller[_0x422c('0xc')]);router['get'](_0x422c('0xd'),auth[_0x422c('0x9')](),controller[_0x422c('0xe')]);router[_0x422c('0x8')](_0x422c('0xf'),auth[_0x422c('0x9')](),controller[_0x422c('0x10')]);router[_0x422c('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x422c('0x11'),auth[_0x422c('0x9')](),controller['getInteractions']);router[_0x422c('0x8')](_0x422c('0x12'),auth[_0x422c('0x9')](),controller[_0x422c('0x13')]);router[_0x422c('0x8')](_0x422c('0x14'),auth[_0x422c('0x9')](),controller[_0x422c('0x15')]);router[_0x422c('0x8')](_0x422c('0x16'),auth['isAuthenticated'](),controller[_0x422c('0x17')]);router[_0x422c('0x18')]('/',auth[_0x422c('0x9')](),controller['create']);router[_0x422c('0x18')](_0x422c('0xf'),auth[_0x422c('0x9')](),controller[_0x422c('0x19')]);router[_0x422c('0x18')](_0x422c('0x1a'),auth[_0x422c('0x9')](),controller[_0x422c('0x1b')]);router['post'](_0x422c('0x11'),auth[_0x422c('0x9')](),controller[_0x422c('0x1c')]);router[_0x422c('0x18')]('/:id/applications',auth[_0x422c('0x9')](),controller[_0x422c('0x1d')]);router[_0x422c('0x18')]('/addaccountapplications',auth['isAuthenticated'](),controller['addAccountApplications']);router['post']('/updateaccountapplications',auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x422c('0x18')]('/:id/send',auth['isAuthenticated'](),controller[_0x422c('0x1e')]);router[_0x422c('0x18')](_0x422c('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0x422c('0x1f')](_0x422c('0xd'),auth[_0x422c('0x9')](),controller[_0x422c('0x20')]);router[_0x422c('0x21')](_0x422c('0xd'),auth[_0x422c('0x9')](),controller[_0x422c('0x22')]);router[_0x422c('0x21')](_0x422c('0xf'),auth['isAuthenticated'](),controller[_0x422c('0x23')]);router['delete']('/:id/canned_answers',auth[_0x422c('0x9')](),controller[_0x422c('0x24')]);router[_0x422c('0x21')](_0x422c('0x16'),auth['isAuthenticated'](),controller[_0x422c('0x25')]);module[_0x422c('0x26')]=router; \ No newline at end of file +var _0x4bae=['put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','post','create','/:id/dispositions','addDisposition','addApplications','/addaccountapplications','/updateaccountapplications','send','addAgents'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x4bae,0xc7));var _0xe4ba=function(_0x3792e6,_0x32bd91){_0x3792e6=_0x3792e6-0x0;var _0x441e44=_0x4bae[_0x3792e6];return _0x441e44;};'use strict';var multer=require(_0xe4ba('0x0'));var util=require('util');var path=require(_0xe4ba('0x1'));var timeout=require(_0xe4ba('0x2'));var express=require('express');var router=express[_0xe4ba('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe4ba('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe4ba('0x5'));var controller=require(_0xe4ba('0x6'));router[_0xe4ba('0x7')]('/',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x9')]);router[_0xe4ba('0x7')](_0xe4ba('0xa'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xb')]);router[_0xe4ba('0x7')]('/:id',auth[_0xe4ba('0x8')](),controller['show']);router[_0xe4ba('0x7')]('/:id/dispositions',auth[_0xe4ba('0x8')](),controller['getDispositions']);router[_0xe4ba('0x7')](_0xe4ba('0xc'),auth['isAuthenticated'](),controller[_0xe4ba('0xd')]);router[_0xe4ba('0x7')](_0xe4ba('0xe'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xf')]);router[_0xe4ba('0x7')](_0xe4ba('0x10'),auth['isAuthenticated'](),controller[_0xe4ba('0x11')]);router[_0xe4ba('0x7')]('/:id/messages',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x12')]);router[_0xe4ba('0x7')](_0xe4ba('0x13'),auth[_0xe4ba('0x8')](),controller['getAgents']);router[_0xe4ba('0x14')]('/',auth['isAuthenticated'](),controller[_0xe4ba('0x15')]);router[_0xe4ba('0x14')](_0xe4ba('0x16'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x17')]);router[_0xe4ba('0x14')](_0xe4ba('0xc'),auth[_0xe4ba('0x8')](),controller['addAnswer']);router[_0xe4ba('0x14')](_0xe4ba('0xe'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xe4ba('0x14')]('/:id/applications',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x18')]);router['post'](_0xe4ba('0x19'),auth[_0xe4ba('0x8')](),controller['addAccountApplications']);router[_0xe4ba('0x14')](_0xe4ba('0x1a'),auth[_0xe4ba('0x8')](),controller['updateAccountApplications']);router[_0xe4ba('0x14')]('/:id/send',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x1b')]);router['post'](_0xe4ba('0x13'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x1c')]);router[_0xe4ba('0x1d')](_0xe4ba('0x1e'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x1f')]);router[_0xe4ba('0x20')](_0xe4ba('0x1e'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x21')]);router[_0xe4ba('0x20')](_0xe4ba('0x16'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x22')]);router['delete'](_0xe4ba('0xc'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x23')]);router[_0xe4ba('0x20')](_0xe4ba('0x13'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x24')]);module[_0xe4ba('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b71e243..3f59186 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 _0x96ec=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x11036b,_0xc1f553){var _0x248858=function(_0xd666fa){while(--_0xd666fa){_0x11036b['push'](_0x11036b['shift']());}};_0x248858(++_0xc1f553);}(_0x96ec,0xb8));var _0xc96e=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x96ec[_0x27604f];return _0x40d189;};'use strict';var Sequelize=require('sequelize');module[_0xc96e('0x0')]={'priority':{'type':Sequelize[_0xc96e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc96e('0x2')],'allowNull':![],'defaultValue':_0xc96e('0x3')},'appdata':{'type':Sequelize[_0xc96e('0x4')]()},'description':{'type':Sequelize[_0xc96e('0x2')]},'interval':{'type':Sequelize[_0xc96e('0x2')],'defaultValue':_0xc96e('0x5')}}; \ No newline at end of file +var _0xe0e8=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x231d2a,_0x5c8ec4){var _0xe6d507=function(_0x28454e){while(--_0x28454e){_0x231d2a['push'](_0x231d2a['shift']());}};_0xe6d507(++_0x5c8ec4);}(_0xe0e8,0xd6));var _0x8e0e=function(_0x4ea31e,_0x45cc3d){_0x4ea31e=_0x4ea31e-0x0;var _0x151f45=_0xe0e8[_0x4ea31e];return _0x151f45;};'use strict';var Sequelize=require(_0x8e0e('0x0'));module[_0x8e0e('0x1')]={'priority':{'type':Sequelize[_0x8e0e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8e0e('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8e0e('0x4')],'defaultValue':_0x8e0e('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index bb78fa2..16e8122 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 _0xb463=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','end','json','offset','limit','undefined','count','status','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxApplication','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','eml-format','rimraf','zip-dir'];(function(_0x39b340,_0x367ae8){var _0x3edb46=function(_0x432fc9){while(--_0x432fc9){_0x39b340['push'](_0x39b340['shift']());}};_0x3edb46(++_0x367ae8);}(_0xb463,0x1b3));var _0x3b46=function(_0x149fd6,_0x1b5dfc){_0x149fd6=_0x149fd6-0x0;var _0x105bed=_0xb463[_0x149fd6];return _0x105bed;};'use strict';var emlformat=require(_0x3b46('0x0'));var rimraf=require(_0x3b46('0x1'));var zipdir=require(_0x3b46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b46('0x3'));var BPromise=require(_0x3b46('0x4'));var Mustache=require('mustache');var util=require(_0x3b46('0x5'));var path=require(_0x3b46('0x6'));var sox=require(_0x3b46('0x7'));var csv=require(_0x3b46('0x8'));var ejs=require(_0x3b46('0x9'));var fs=require('fs');var fs_extra=require(_0x3b46('0xa'));var _=require('lodash');var squel=require(_0x3b46('0xb'));var crypto=require(_0x3b46('0xc'));var jsforce=require(_0x3b46('0xd'));var deskjs=require(_0x3b46('0xe'));var toCsv=require(_0x3b46('0x8'));var querystring=require('querystring');var Papa=require(_0x3b46('0xf'));var Redis=require('ioredis');var authService=require(_0x3b46('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3b46('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b46('0x12'))(_0x3b46('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3b46('0x14'));var db=require(_0x3b46('0x15'))['db'];function respondWithStatusCode(_0x113c69,_0x4d6d2a){_0x4d6d2a=_0x4d6d2a||0xcc;return function(_0x4c69a8){if(_0x4c69a8){return _0x113c69['sendStatus'](_0x4d6d2a);}return _0x113c69['status'](_0x4d6d2a)[_0x3b46('0x16')]();};}function respondWithResult(_0x44c041,_0x192b4b){_0x192b4b=_0x192b4b||0xc8;return function(_0x4376a4){if(_0x4376a4){return _0x44c041['status'](_0x192b4b)[_0x3b46('0x17')](_0x4376a4);}};}function respondWithFilteredResult(_0x1a5d02,_0x322c0b){return function(_0x317258){if(_0x317258){var _0x2a450f=typeof _0x322c0b[_0x3b46('0x18')]==='undefined'&&typeof _0x322c0b[_0x3b46('0x19')]===_0x3b46('0x1a');var _0x2442e1=_0x317258[_0x3b46('0x1b')];var _0x2663bc=_0x2a450f?0x0:_0x322c0b[_0x3b46('0x18')];var _0x17bf5b=_0x2a450f?_0x317258[_0x3b46('0x1b')]:_0x322c0b[_0x3b46('0x18')]+_0x322c0b['limit'];var _0x3338e2;if(_0x17bf5b>=_0x2442e1){_0x17bf5b=_0x2442e1;_0x3338e2=0xc8;}else{_0x3338e2=0xce;}_0x1a5d02[_0x3b46('0x1c')](_0x3338e2);return _0x1a5d02[_0x3b46('0x1d')](_0x3b46('0x1e'),_0x2663bc+'-'+_0x17bf5b+'/'+_0x2442e1)[_0x3b46('0x17')](_0x317258);}return null;};}function patchUpdates(_0x408fca){return function(_0x4d040f){try{jsonpatch['apply'](_0x4d040f,_0x408fca,!![]);}catch(_0x359fd8){return BPromise['reject'](_0x359fd8);}return _0x4d040f[_0x3b46('0x1f')]();};}function saveUpdates(_0x5abacc,_0x2b0538){return function(_0x21a810){if(_0x21a810){return _0x21a810[_0x3b46('0x20')](_0x5abacc)[_0x3b46('0x21')](function(_0x5bdba7){return _0x5bdba7;});}return null;};}function removeEntity(_0x3e2d43,_0x16fafa){return function(_0x207706){if(_0x207706){return _0x207706[_0x3b46('0x22')]()['then'](function(){_0x3e2d43[_0x3b46('0x1c')](0xcc)[_0x3b46('0x16')]();});}};}function handleEntityNotFound(_0x25b606,_0x31e041){return function(_0x388f85){if(!_0x388f85){_0x25b606[_0x3b46('0x23')](0x194);}return _0x388f85;};}function handleError(_0x3c00b2,_0x5a16ae){_0x5a16ae=_0x5a16ae||0x1f4;return function(_0x5c2944){logger[_0x3b46('0x24')](_0x5c2944[_0x3b46('0x25')]);if(_0x5c2944[_0x3b46('0x26')]){delete _0x5c2944[_0x3b46('0x26')];}_0x3c00b2[_0x3b46('0x1c')](_0x5a16ae)[_0x3b46('0x27')](_0x5c2944);};}exports[_0x3b46('0x28')]=function(_0x2bfed1,_0x4fd937){var _0x3b07d5={},_0x5bec23={},_0x2e4fb1={'count':0x0,'rows':[]};var _0x22e92f=_[_0x3b46('0x29')](db[_0x3b46('0x2a')]['rawAttributes'],function(_0x4a0c52){return{'name':_0x4a0c52[_0x3b46('0x2b')],'type':_0x4a0c52[_0x3b46('0x2c')][_0x3b46('0x2d')]};});_0x5bec23['model']=_['map'](_0x22e92f,_0x3b46('0x26'));_0x5bec23[_0x3b46('0x2e')]=_[_0x3b46('0x2f')](_0x2bfed1[_0x3b46('0x2e')]);_0x5bec23[_0x3b46('0x30')]=_[_0x3b46('0x31')](_0x5bec23[_0x3b46('0x32')],_0x5bec23[_0x3b46('0x2e')]);_0x3b07d5[_0x3b46('0x33')]=_[_0x3b46('0x31')](_0x5bec23[_0x3b46('0x32')],qs[_0x3b46('0x34')](_0x2bfed1['query'][_0x3b46('0x34')]));_0x3b07d5[_0x3b46('0x33')]=_0x3b07d5[_0x3b46('0x33')][_0x3b46('0x35')]?_0x3b07d5[_0x3b46('0x33')]:_0x5bec23[_0x3b46('0x32')];if(!_0x2bfed1[_0x3b46('0x2e')][_0x3b46('0x36')](_0x3b46('0x37'))){_0x3b07d5[_0x3b46('0x19')]=qs[_0x3b46('0x19')](_0x2bfed1[_0x3b46('0x2e')][_0x3b46('0x19')]);_0x3b07d5['offset']=qs[_0x3b46('0x18')](_0x2bfed1['query'][_0x3b46('0x18')]);}_0x3b07d5['order']=qs['sort'](_0x2bfed1[_0x3b46('0x2e')][_0x3b46('0x38')]);_0x3b07d5[_0x3b46('0x39')]=qs['filters'](_['pick'](_0x2bfed1[_0x3b46('0x2e')],_0x5bec23[_0x3b46('0x30')]),_0x22e92f);if(_0x2bfed1[_0x3b46('0x2e')]['filter']){_0x3b07d5[_0x3b46('0x39')]=_['merge'](_0x3b07d5[_0x3b46('0x39')],{'$or':_[_0x3b46('0x29')](_0x22e92f,function(_0x13558b){if(_0x13558b[_0x3b46('0x2c')]!==_0x3b46('0x3a')){var _0x5a396d={};_0x5a396d[_0x13558b[_0x3b46('0x26')]]={'$like':'%'+_0x2bfed1[_0x3b46('0x2e')][_0x3b46('0x3b')]+'%'};return _0x5a396d;}})});}_0x3b07d5=_[_0x3b46('0x3c')]({},_0x3b07d5,_0x2bfed1[_0x3b46('0x3d')]);var _0x506ccc={'where':_0x3b07d5[_0x3b46('0x39')]};return db[_0x3b46('0x2a')][_0x3b46('0x1b')](_0x506ccc)['then'](function(_0x142a82){_0x2e4fb1['count']=_0x142a82;if(_0x2bfed1[_0x3b46('0x2e')][_0x3b46('0x3e')]){_0x3b07d5['include']=[{'all':!![]}];}return db[_0x3b46('0x2a')][_0x3b46('0x3f')](_0x3b07d5);})[_0x3b46('0x21')](function(_0x39cbd3){_0x2e4fb1[_0x3b46('0x40')]=_0x39cbd3;return _0x2e4fb1;})['then'](respondWithFilteredResult(_0x4fd937,_0x3b07d5))['catch'](handleError(_0x4fd937,null));};exports[_0x3b46('0x41')]=function(_0x4b3c9b,_0x3f55b7){var _0x1cd7d6={'raw':!![],'where':{'id':_0x4b3c9b[_0x3b46('0x42')]['id']}},_0x344b98={};_0x344b98[_0x3b46('0x32')]=_['keys'](db['FaxApplication'][_0x3b46('0x43')]);_0x344b98[_0x3b46('0x2e')]=_[_0x3b46('0x2f')](_0x4b3c9b['query']);_0x344b98[_0x3b46('0x30')]=_[_0x3b46('0x31')](_0x344b98['model'],_0x344b98['query']);_0x1cd7d6[_0x3b46('0x33')]=_[_0x3b46('0x31')](_0x344b98['model'],qs[_0x3b46('0x34')](_0x4b3c9b['query'][_0x3b46('0x34')]));_0x1cd7d6[_0x3b46('0x33')]=_0x1cd7d6[_0x3b46('0x33')][_0x3b46('0x35')]?_0x1cd7d6[_0x3b46('0x33')]:_0x344b98['model'];if(_0x4b3c9b[_0x3b46('0x2e')][_0x3b46('0x3e')]){_0x1cd7d6[_0x3b46('0x44')]=[{'all':!![]}];}_0x1cd7d6=_[_0x3b46('0x3c')]({},_0x1cd7d6,_0x4b3c9b[_0x3b46('0x3d')]);return db['FaxApplication'][_0x3b46('0x45')](_0x1cd7d6)[_0x3b46('0x21')](handleEntityNotFound(_0x3f55b7,null))['then'](respondWithResult(_0x3f55b7,null))[_0x3b46('0x46')](handleError(_0x3f55b7,null));};exports[_0x3b46('0x47')]=function(_0x5237d7,_0x3bf835){return db['FaxApplication'][_0x3b46('0x47')](_0x5237d7[_0x3b46('0x48')],{})['then'](respondWithResult(_0x3bf835,0xc9))[_0x3b46('0x46')](handleError(_0x3bf835,null));};exports[_0x3b46('0x20')]=function(_0x327896,_0x4156cc){if(_0x327896[_0x3b46('0x48')]['id']){delete _0x327896[_0x3b46('0x48')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x327896[_0x3b46('0x42')]['id']}})[_0x3b46('0x21')](handleEntityNotFound(_0x4156cc,null))[_0x3b46('0x21')](saveUpdates(_0x327896['body'],null))[_0x3b46('0x21')](respondWithResult(_0x4156cc,null))['catch'](handleError(_0x4156cc,null));};exports['destroy']=function(_0x13cca4,_0x3dd70d){return db['FaxApplication']['find']({'where':{'id':_0x13cca4[_0x3b46('0x42')]['id']}})[_0x3b46('0x21')](handleEntityNotFound(_0x3dd70d,null))['then'](removeEntity(_0x3dd70d,null))[_0x3b46('0x46')](handleError(_0x3dd70d,null));}; \ No newline at end of file +var _0x2270=['catch','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','merge','options','FaxApplication','include','findAll','rows'];(function(_0x563b3f,_0x2458a5){var _0x5e1e0f=function(_0x2aefc6){while(--_0x2aefc6){_0x563b3f['push'](_0x563b3f['shift']());}};_0x5e1e0f(++_0x2458a5);}(_0x2270,0xd8));var _0x0227=function(_0x32f1f8,_0x5aaef5){_0x32f1f8=_0x32f1f8-0x0;var _0x58bdf1=_0x2270[_0x32f1f8];return _0x58bdf1;};'use strict';var emlformat=require(_0x0227('0x0'));var rimraf=require(_0x0227('0x1'));var zipdir=require(_0x0227('0x2'));var jsonpatch=require(_0x0227('0x3'));var rp=require(_0x0227('0x4'));var moment=require(_0x0227('0x5'));var BPromise=require(_0x0227('0x6'));var Mustache=require('mustache');var util=require(_0x0227('0x7'));var path=require(_0x0227('0x8'));var sox=require(_0x0227('0x9'));var csv=require(_0x0227('0xa'));var ejs=require(_0x0227('0xb'));var fs=require('fs');var fs_extra=require(_0x0227('0xc'));var _=require('lodash');var squel=require(_0x0227('0xd'));var crypto=require(_0x0227('0xe'));var jsforce=require(_0x0227('0xf'));var deskjs=require(_0x0227('0x10'));var toCsv=require(_0x0227('0xa'));var querystring=require('querystring');var Papa=require(_0x0227('0x11'));var Redis=require('ioredis');var authService=require(_0x0227('0x12'));var qs=require(_0x0227('0x13'));var as=require(_0x0227('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0227('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0227('0x16'));var db=require(_0x0227('0x17'))['db'];function respondWithStatusCode(_0x35e837,_0x16b746){_0x16b746=_0x16b746||0xcc;return function(_0x435798){if(_0x435798){return _0x35e837[_0x0227('0x18')](_0x16b746);}return _0x35e837[_0x0227('0x19')](_0x16b746)[_0x0227('0x1a')]();};}function respondWithResult(_0x2bb9b5,_0x588147){_0x588147=_0x588147||0xc8;return function(_0xe0f358){if(_0xe0f358){return _0x2bb9b5[_0x0227('0x19')](_0x588147)[_0x0227('0x1b')](_0xe0f358);}};}function respondWithFilteredResult(_0x13b27b,_0x511f04){return function(_0x380310){if(_0x380310){var _0x2b6792=typeof _0x511f04[_0x0227('0x1c')]===_0x0227('0x1d')&&typeof _0x511f04[_0x0227('0x1e')]===_0x0227('0x1d');var _0x5be601=_0x380310[_0x0227('0x1f')];var _0x408659=_0x2b6792?0x0:_0x511f04[_0x0227('0x1c')];var _0xe110e4=_0x2b6792?_0x380310['count']:_0x511f04[_0x0227('0x1c')]+_0x511f04[_0x0227('0x1e')];var _0x5d1243;if(_0xe110e4>=_0x5be601){_0xe110e4=_0x5be601;_0x5d1243=0xc8;}else{_0x5d1243=0xce;}_0x13b27b[_0x0227('0x19')](_0x5d1243);return _0x13b27b[_0x0227('0x20')]('Content-Range',_0x408659+'-'+_0xe110e4+'/'+_0x5be601)[_0x0227('0x1b')](_0x380310);}return null;};}function patchUpdates(_0x8ad270){return function(_0x552e50){try{jsonpatch[_0x0227('0x21')](_0x552e50,_0x8ad270,!![]);}catch(_0x50dd2b){return BPromise[_0x0227('0x22')](_0x50dd2b);}return _0x552e50['save']();};}function saveUpdates(_0x27fccf,_0x3a1454){return function(_0x4ad67d){if(_0x4ad67d){return _0x4ad67d['update'](_0x27fccf)[_0x0227('0x23')](function(_0x45e16c){return _0x45e16c;});}return null;};}function removeEntity(_0x3ab251,_0xca0676){return function(_0x40d146){if(_0x40d146){return _0x40d146[_0x0227('0x24')]()['then'](function(){_0x3ab251[_0x0227('0x19')](0xcc)[_0x0227('0x1a')]();});}};}function handleEntityNotFound(_0x33152f,_0x2502fd){return function(_0x3949b5){if(!_0x3949b5){_0x33152f['sendStatus'](0x194);}return _0x3949b5;};}function handleError(_0x17aee8,_0x4a4c83){_0x4a4c83=_0x4a4c83||0x1f4;return function(_0x4ec9b9){logger[_0x0227('0x25')](_0x4ec9b9[_0x0227('0x26')]);if(_0x4ec9b9[_0x0227('0x27')]){delete _0x4ec9b9[_0x0227('0x27')];}_0x17aee8[_0x0227('0x19')](_0x4a4c83)[_0x0227('0x28')](_0x4ec9b9);};}exports['index']=function(_0x477d0f,_0x398e89){var _0x1b530e={},_0x5494a0={},_0x4895d9={'count':0x0,'rows':[]};var _0x268eb4=_[_0x0227('0x29')](db['FaxApplication'][_0x0227('0x2a')],function(_0x1e3f73){return{'name':_0x1e3f73['fieldName'],'type':_0x1e3f73['type'][_0x0227('0x2b')]};});_0x5494a0['model']=_[_0x0227('0x29')](_0x268eb4,'name');_0x5494a0[_0x0227('0x2c')]=_[_0x0227('0x2d')](_0x477d0f['query']);_0x5494a0[_0x0227('0x2e')]=_['intersection'](_0x5494a0[_0x0227('0x2f')],_0x5494a0['query']);_0x1b530e[_0x0227('0x30')]=_[_0x0227('0x31')](_0x5494a0[_0x0227('0x2f')],qs[_0x0227('0x32')](_0x477d0f[_0x0227('0x2c')][_0x0227('0x32')]));_0x1b530e['attributes']=_0x1b530e['attributes'][_0x0227('0x33')]?_0x1b530e[_0x0227('0x30')]:_0x5494a0[_0x0227('0x2f')];if(!_0x477d0f[_0x0227('0x2c')][_0x0227('0x34')](_0x0227('0x35'))){_0x1b530e[_0x0227('0x1e')]=qs[_0x0227('0x1e')](_0x477d0f['query'][_0x0227('0x1e')]);_0x1b530e['offset']=qs['offset'](_0x477d0f[_0x0227('0x2c')][_0x0227('0x1c')]);}_0x1b530e['order']=qs[_0x0227('0x36')](_0x477d0f['query']['sort']);_0x1b530e['where']=qs[_0x0227('0x2e')](_[_0x0227('0x37')](_0x477d0f[_0x0227('0x2c')],_0x5494a0[_0x0227('0x2e')]),_0x268eb4);if(_0x477d0f[_0x0227('0x2c')]['filter']){_0x1b530e[_0x0227('0x38')]=_['merge'](_0x1b530e[_0x0227('0x38')],{'$or':_[_0x0227('0x29')](_0x268eb4,function(_0x5768f2){if(_0x5768f2['type']!==_0x0227('0x39')){var _0x14b565={};_0x14b565[_0x5768f2[_0x0227('0x27')]]={'$like':'%'+_0x477d0f[_0x0227('0x2c')]['filter']+'%'};return _0x14b565;}})});}_0x1b530e=_[_0x0227('0x3a')]({},_0x1b530e,_0x477d0f[_0x0227('0x3b')]);var _0x2bf5cb={'where':_0x1b530e[_0x0227('0x38')]};return db[_0x0227('0x3c')]['count'](_0x2bf5cb)[_0x0227('0x23')](function(_0x5a778c){_0x4895d9[_0x0227('0x1f')]=_0x5a778c;if(_0x477d0f[_0x0227('0x2c')]['includeAll']){_0x1b530e[_0x0227('0x3d')]=[{'all':!![]}];}return db[_0x0227('0x3c')][_0x0227('0x3e')](_0x1b530e);})[_0x0227('0x23')](function(_0x20b688){_0x4895d9[_0x0227('0x3f')]=_0x20b688;return _0x4895d9;})[_0x0227('0x23')](respondWithFilteredResult(_0x398e89,_0x1b530e))[_0x0227('0x40')](handleError(_0x398e89,null));};exports['show']=function(_0x51f15a,_0xc5169d){var _0x5f4c3d={'raw':!![],'where':{'id':_0x51f15a['params']['id']}},_0x27f268={};_0x27f268[_0x0227('0x2f')]=_['keys'](db[_0x0227('0x3c')][_0x0227('0x2a')]);_0x27f268[_0x0227('0x2c')]=_[_0x0227('0x2d')](_0x51f15a['query']);_0x27f268['filters']=_['intersection'](_0x27f268[_0x0227('0x2f')],_0x27f268['query']);_0x5f4c3d[_0x0227('0x30')]=_[_0x0227('0x31')](_0x27f268[_0x0227('0x2f')],qs[_0x0227('0x32')](_0x51f15a[_0x0227('0x2c')][_0x0227('0x32')]));_0x5f4c3d['attributes']=_0x5f4c3d['attributes'][_0x0227('0x33')]?_0x5f4c3d[_0x0227('0x30')]:_0x27f268['model'];if(_0x51f15a['query']['includeAll']){_0x5f4c3d['include']=[{'all':!![]}];}_0x5f4c3d=_[_0x0227('0x3a')]({},_0x5f4c3d,_0x51f15a[_0x0227('0x3b')]);return db[_0x0227('0x3c')][_0x0227('0x41')](_0x5f4c3d)[_0x0227('0x23')](handleEntityNotFound(_0xc5169d,null))[_0x0227('0x23')](respondWithResult(_0xc5169d,null))[_0x0227('0x40')](handleError(_0xc5169d,null));};exports[_0x0227('0x42')]=function(_0x5d2c70,_0x5c7c37){return db[_0x0227('0x3c')][_0x0227('0x42')](_0x5d2c70[_0x0227('0x43')],{})[_0x0227('0x23')](respondWithResult(_0x5c7c37,0xc9))[_0x0227('0x40')](handleError(_0x5c7c37,null));};exports[_0x0227('0x44')]=function(_0x18fc5f,_0x568cc9){if(_0x18fc5f[_0x0227('0x43')]['id']){delete _0x18fc5f[_0x0227('0x43')]['id'];}return db[_0x0227('0x3c')][_0x0227('0x41')]({'where':{'id':_0x18fc5f['params']['id']}})[_0x0227('0x23')](handleEntityNotFound(_0x568cc9,null))[_0x0227('0x23')](saveUpdates(_0x18fc5f['body'],null))[_0x0227('0x23')](respondWithResult(_0x568cc9,null))['catch'](handleError(_0x568cc9,null));};exports[_0x0227('0x24')]=function(_0x2c3940,_0x49bd5d){return db[_0x0227('0x3c')]['find']({'where':{'id':_0x2c3940[_0x0227('0x45')]['id']}})[_0x0227('0x23')](handleEntityNotFound(_0x49bd5d,null))[_0x0227('0x23')](removeEntity(_0x49bd5d,null))['catch'](handleError(_0x49bd5d,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 5112f59..859684d 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 _0x2b9d=['lodash','util','../../config/logger','moment','bluebird','request-promise','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x2b9d,0x1b0));var _0xd2b9=function(_0x1a8939,_0x523af8){_0x1a8939=_0x1a8939-0x0;var _0x507eac=_0x2b9d[_0x1a8939];return _0x507eac;};'use strict';var _=require(_0xd2b9('0x0'));var util=require(_0xd2b9('0x1'));var logger=require(_0xd2b9('0x2'))('api');var moment=require(_0xd2b9('0x3'));var BPromise=require(_0xd2b9('0x4'));var rp=require(_0xd2b9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2b9('0x6'));module[_0xd2b9('0x7')]=function(_0x398b2b,_0x85a2f){return _0x398b2b[_0xd2b9('0x8')](_0xd2b9('0x9'),attributes,{'tableName':_0xd2b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd2b9('0xb')});}; \ No newline at end of file +var _0xc673=['moment','bluebird','path','rimraf','exports','define','FaxApplication','utf8mb4_unicode_ci','util','api'];(function(_0x4d6c04,_0x5d28c4){var _0x6ad814=function(_0xa0598a){while(--_0xa0598a){_0x4d6c04['push'](_0x4d6c04['shift']());}};_0x6ad814(++_0x5d28c4);}(_0xc673,0x120));var _0x3c67=function(_0x1c05d9,_0x5b1233){_0x1c05d9=_0x1c05d9-0x0;var _0x409f7e=_0xc673[_0x1c05d9];return _0x409f7e;};'use strict';var _=require('lodash');var util=require(_0x3c67('0x0'));var logger=require('../../config/logger')(_0x3c67('0x1'));var moment=require(_0x3c67('0x2'));var BPromise=require(_0x3c67('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c67('0x4'));var rimraf=require(_0x3c67('0x5'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0x3c67('0x6')]=function(_0x4c69cc,_0x3f4359){return _0x4c69cc[_0x3c67('0x7')](_0x3c67('0x8'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3c67('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 6fdcc66..9086422 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 _0x5569=['rpc','../../config/environment','jayson/promise','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5569,0x143));var _0x9556=function(_0x282f9a,_0x63dff){_0x282f9a=_0x282f9a-0x0;var _0x52528c=_0x5569[_0x282f9a];return _0x52528c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9556('0x0'));var BPromise=require(_0x9556('0x1'));var rs=require(_0x9556('0x2'));var fs=require('fs');var Redis=require(_0x9556('0x3'));var db=require(_0x9556('0x4'))['db'];var utils=require(_0x9556('0x5'));var logger=require(_0x9556('0x6'))(_0x9556('0x7'));var config=require(_0x9556('0x8'));var jayson=require(_0x9556('0x9'));var client=jayson['client'][_0x9556('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a60d2,_0x4eb987,_0x59fbd8){return new BPromise(function(_0x4de1fd,_0x5e6f5a){return client[_0x9556('0xb')](_0x1a60d2,_0x59fbd8)[_0x9556('0xc')](function(_0x725ee4){logger[_0x9556('0xd')](_0x9556('0xe'),_0x4eb987,_0x9556('0xf'));logger[_0x9556('0x10')](_0x9556('0x11'),_0x4eb987,_0x9556('0xf'),JSON['stringify'](_0x725ee4));if(_0x725ee4[_0x9556('0x12')]){if(_0x725ee4[_0x9556('0x12')][_0x9556('0x13')]===0x1f4){logger[_0x9556('0x12')](_0x9556('0xe'),_0x4eb987,_0x725ee4[_0x9556('0x12')]['message']);return _0x5e6f5a(_0x725ee4[_0x9556('0x12')][_0x9556('0x14')]);}logger['error'](_0x9556('0xe'),_0x4eb987,_0x725ee4['error'][_0x9556('0x14')]);return _0x4de1fd(_0x725ee4[_0x9556('0x12')]['message']);}else{logger[_0x9556('0xd')]('FaxApplication,\x20%s,\x20%s',_0x4eb987,_0x9556('0xf'));_0x4de1fd(_0x725ee4[_0x9556('0x15')][_0x9556('0x14')]);}})[_0x9556('0x16')](function(_0x27a7c8){logger[_0x9556('0x12')](_0x9556('0xe'),_0x4eb987,_0x27a7c8);_0x5e6f5a(_0x27a7c8);});});}exports[_0x9556('0x17')]=function(_0x1fb34c){var _0x465f10=this;return new Promise(function(_0x3da9d5,_0x21958f){return db[_0x9556('0x18')][_0x9556('0x19')](_0x1fb34c[_0x9556('0x1a')],{'raw':_0x1fb34c[_0x9556('0x1b')]?_0x1fb34c[_0x9556('0x1b')][_0x9556('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fb34c[_0x9556('0x1b')]?_0x1fb34c[_0x9556('0x1b')][_0x9556('0x1d')]||null:null,'attributes':_0x1fb34c[_0x9556('0x1b')]?_0x1fb34c[_0x9556('0x1b')][_0x9556('0x1e')]||null:null,'limit':_0x1fb34c[_0x9556('0x1b')]?_0x1fb34c['options'][_0x9556('0x1f')]||null:null})[_0x9556('0xc')](function(_0xd4fc0e){logger['info']('UpdateFaxApplication',_0x1fb34c);logger[_0x9556('0x10')](_0x9556('0x17'),_0x1fb34c,JSON[_0x9556('0x20')](_0xd4fc0e));_0x3da9d5(_0xd4fc0e);})[_0x9556('0x16')](function(_0x154f08){logger[_0x9556('0x12')]('UpdateFaxApplication',_0x154f08[_0x9556('0x14')],_0x1fb34c);_0x21958f(_0x465f10['error'](0x1f4,_0x154f08[_0x9556('0x14')]));});});}; \ No newline at end of file +var _0x5e4c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','catch','lodash','util','moment'];(function(_0x1e758b,_0x2ca30b){var _0x458a0e=function(_0x3d46d4){while(--_0x3d46d4){_0x1e758b['push'](_0x1e758b['shift']());}};_0x458a0e(++_0x2ca30b);}(_0x5e4c,0xd6));var _0xc5e4=function(_0xf8be3f,_0x59035b){_0xf8be3f=_0xf8be3f-0x0;var _0x3bed87=_0x5e4c[_0xf8be3f];return _0x3bed87;};'use strict';var _=require(_0xc5e4('0x0'));var util=require(_0xc5e4('0x1'));var moment=require(_0xc5e4('0x2'));var BPromise=require(_0xc5e4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5e4('0x4'));var db=require(_0xc5e4('0x5'))['db'];var utils=require(_0xc5e4('0x6'));var logger=require(_0xc5e4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc5e4('0x8'));var client=jayson['client'][_0xc5e4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23362a,_0x42df7c,_0x30a958){return new BPromise(function(_0x1ec748,_0x477d26){return client[_0xc5e4('0xa')](_0x23362a,_0x30a958)['then'](function(_0x25baac){logger[_0xc5e4('0xb')](_0xc5e4('0xc'),_0x42df7c,_0xc5e4('0xd'));logger[_0xc5e4('0xe')](_0xc5e4('0xf'),_0x42df7c,_0xc5e4('0xd'),JSON[_0xc5e4('0x10')](_0x25baac));if(_0x25baac['error']){if(_0x25baac[_0xc5e4('0x11')][_0xc5e4('0x12')]===0x1f4){logger[_0xc5e4('0x11')]('FaxApplication,\x20%s,\x20%s',_0x42df7c,_0x25baac['error'][_0xc5e4('0x13')]);return _0x477d26(_0x25baac[_0xc5e4('0x11')][_0xc5e4('0x13')]);}logger[_0xc5e4('0x11')](_0xc5e4('0xc'),_0x42df7c,_0x25baac[_0xc5e4('0x11')][_0xc5e4('0x13')]);return _0x1ec748(_0x25baac[_0xc5e4('0x11')][_0xc5e4('0x13')]);}else{logger[_0xc5e4('0xb')](_0xc5e4('0xc'),_0x42df7c,'request\x20sent');_0x1ec748(_0x25baac[_0xc5e4('0x14')]['message']);}})['catch'](function(_0x302cfc){logger[_0xc5e4('0x11')](_0xc5e4('0xc'),_0x42df7c,_0x302cfc);_0x477d26(_0x302cfc);});});}exports['UpdateFaxApplication']=function(_0xb12285){var _0x1037f4=this;return new Promise(function(_0x3dc7fc,_0x57d6ea){return db[_0xc5e4('0x15')][_0xc5e4('0x16')](_0xb12285[_0xc5e4('0x17')],{'raw':_0xb12285['options']?_0xb12285[_0xc5e4('0x18')][_0xc5e4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb12285['options']?_0xb12285[_0xc5e4('0x18')][_0xc5e4('0x1a')]||null:null,'attributes':_0xb12285[_0xc5e4('0x18')]?_0xb12285[_0xc5e4('0x18')][_0xc5e4('0x1b')]||null:null,'limit':_0xb12285[_0xc5e4('0x18')]?_0xb12285[_0xc5e4('0x18')][_0xc5e4('0x1c')]||null:null})['then'](function(_0x359d54){logger['info'](_0xc5e4('0x1d'),_0xb12285);logger[_0xc5e4('0xe')](_0xc5e4('0x1d'),_0xb12285,JSON[_0xc5e4('0x10')](_0x359d54));_0x3dc7fc(_0x359d54);})[_0xc5e4('0x1e')](function(_0x67fb5f){logger[_0xc5e4('0x11')](_0xc5e4('0x1d'),_0x67fb5f[_0xc5e4('0x13')],_0xb12285);_0x57d6ea(_0x1037f4[_0xc5e4('0x11')](0x1f4,_0x67fb5f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ee9f4ab..6664488 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x2d27af,_0x372192){var _0x536700=function(_0x5bdaec){while(--_0x5bdaec){_0x2d27af['push'](_0x2d27af['shift']());}};_0x536700(++_0x372192);}(_0x2032,0xd9));var _0x2203=function(_0x3be8d3,_0x1a634e){_0x3be8d3=_0x3be8d3-0x0;var _0x3ebd62=_0x2032[_0x3be8d3];return _0x3ebd62;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x5c00=['delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x228e29,_0xc4e7e6){var _0x401123=function(_0x2dfa68){while(--_0x2dfa68){_0x228e29['push'](_0x228e29['shift']());}};_0x401123(++_0xc4e7e6);}(_0x5c00,0x17e));var _0x05c0=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x5c00[_0x351509];return _0x4e9861;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./faxApplication.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x05c0('0xd')]);router[_0x05c0('0xe')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x05c0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 8314977..647b7c2 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 _0x3e24=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x3eea16,_0x3918cc){var _0x4ecfc1=function(_0x5ab0cf){while(--_0x5ab0cf){_0x3eea16['push'](_0x3eea16['shift']());}};_0x4ecfc1(++_0x3918cc);}(_0x3e24,0x167));var _0x43e2=function(_0x976eee,_0x106e6e){_0x976eee=_0x976eee-0x0;var _0x21ab95=_0x3e24[_0x976eee];return _0x21ab95;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'closed':{'type':Sequelize[_0x43e2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x43e2('0x3')]},'disposition':{'type':Sequelize[_0x43e2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x43e2('0x4')]},'note':{'type':Sequelize[_0x43e2('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x43e2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x43e2('0x5')]('in',_0x43e2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x43e2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x43e2('0x5')]('in',_0x43e2('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x43e2('0x7')]}}; \ No newline at end of file +var _0x6a95=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x354ae6,_0x10f833){var _0x3c02b1=function(_0x68720b){while(--_0x68720b){_0x354ae6['push'](_0x354ae6['shift']());}};_0x3c02b1(++_0x10f833);}(_0x6a95,0x1db));var _0x56a9=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x6a95[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0x56a9('0x0'));module[_0x56a9('0x1')]={'closed':{'type':Sequelize[_0x56a9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x56a9('0x3')]},'disposition':{'type':Sequelize[_0x56a9('0x4')]},'secondDisposition':{'type':Sequelize[_0x56a9('0x4')]},'thirdDisposition':{'type':Sequelize[_0x56a9('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x56a9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x56a9('0x5')]('in',_0x56a9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x56a9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x56a9('0x5')]('in',_0x56a9('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x56a9('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index e0fc67b..35b9ea4 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 _0x0426=['YYYY-MM-DD\x20HH:mm:ss','findAll','rows','omit','spread','Tag','color','emit','removeTags','download','unix','root','server','files','tmp','attachments','format','join','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','pipe','createWriteStream','resolve','log','err','rimraf','zip-dir','moment','util','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','user','catch','params','model','keys','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','sort','where','pick','FaxInteractionId','filter','$gte','split'];(function(_0x5abbda,_0x21a99a){var _0x5e0877=function(_0x335c33){while(--_0x335c33){_0x5abbda['push'](_0x5abbda['shift']());}};_0x5e0877(++_0x21a99a);}(_0x0426,0x84));var _0x6042=function(_0x1fafdc,_0x55e96c){_0x1fafdc=_0x1fafdc-0x0;var _0x3f8801=_0x0426[_0x1fafdc];return _0x3f8801;};'use strict';var rimraf=require(_0x6042('0x0'));var zipdir=require(_0x6042('0x1'));var moment=require(_0x6042('0x2'));var BPromise=require('bluebird');var util=require(_0x6042('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x6042('0x4'));var Redis=require(_0x6042('0x5'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var logger=require(_0x6042('0x6'))('api');var config=require(_0x6042('0x7'));var db=require(_0x6042('0x8'))['db'];config[_0x6042('0x9')]=_[_0x6042('0xa')](config[_0x6042('0x9')],{'host':_0x6042('0xb'),'port':0x18eb});var socket=require(_0x6042('0xc'))(new Redis(config[_0x6042('0x9')]));require(_0x6042('0xd'))['register'](socket);function respondWithStatusCode(_0xbae6f9,_0x1a1cd9){_0x1a1cd9=_0x1a1cd9||0xcc;return function(_0x502e56){if(_0x502e56){return _0xbae6f9[_0x6042('0xe')](_0x1a1cd9);}return _0xbae6f9[_0x6042('0xf')](_0x1a1cd9)['end']();};}function respondWithResult(_0x3e4771,_0x32a1ba){_0x32a1ba=_0x32a1ba||0xc8;return function(_0x18f8c7){if(_0x18f8c7){return _0x3e4771['status'](_0x32a1ba)[_0x6042('0x10')](_0x18f8c7);}};}function respondWithFilteredResult(_0x35b0f5,_0x58cbf3){return function(_0x472775){if(_0x472775){var _0x90ddf1=typeof _0x58cbf3[_0x6042('0x11')]===_0x6042('0x12')&&typeof _0x58cbf3[_0x6042('0x13')]==='undefined';var _0x4c510d=_0x472775['count'];var _0x4a40c7=_0x90ddf1?0x0:_0x58cbf3[_0x6042('0x11')];var _0xaa9735=_0x90ddf1?_0x472775[_0x6042('0x14')]:_0x58cbf3[_0x6042('0x11')]+_0x58cbf3[_0x6042('0x13')];var _0x440338;if(_0xaa9735>=_0x4c510d){_0xaa9735=_0x4c510d;_0x440338=0xc8;}else{_0x440338=0xce;}_0x35b0f5[_0x6042('0xf')](_0x440338);return _0x35b0f5[_0x6042('0x15')](_0x6042('0x16'),_0x4a40c7+'-'+_0xaa9735+'/'+_0x4c510d)[_0x6042('0x10')](_0x472775);}return null;};}function saveUpdates(_0x45efb6){return function(_0xd896cc){if(_0xd896cc){return _0xd896cc[_0x6042('0x17')](_0x45efb6)[_0x6042('0x18')](function(_0x1a8d22){return _0x1a8d22;});}return null;};}function removeEntity(_0x5cf333){return function(_0x456723){if(_0x456723){return _0x456723[_0x6042('0x19')]()['then'](function(){_0x5cf333[_0x6042('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x125e3c){return function(_0x218c3c){if(!_0x218c3c){_0x125e3c[_0x6042('0xe')](0x194);}return _0x218c3c;};}function handleError(_0x11d010,_0x25a379){_0x25a379=_0x25a379||0x1f4;return function(_0x53a975){logger[_0x6042('0x1a')](_0x53a975[_0x6042('0x1b')]);if(_0x53a975[_0x6042('0x1c')]){delete _0x53a975[_0x6042('0x1c')];}_0x11d010[_0x6042('0xf')](_0x25a379)[_0x6042('0x1d')](_0x53a975);};}exports[_0x6042('0x1e')]=function(_0x2c487a,_0x2aad84){var _0x451b16={};var _0x2d88fe=_[_0x6042('0x1f')](db[_0x6042('0x20')][_0x6042('0x21')],function(_0x888a22){return{'name':_0x888a22[_0x6042('0x22')],'type':_0x888a22[_0x6042('0x23')][_0x6042('0x24')]};});_0x451b16=qs[_0x6042('0x25')](_0x2d88fe,_0x2c487a);return interaction['findAll'](_0x6042('0x26'),_0x2c487a['query'],_0x2c487a[_0x6042('0x27')],_0x451b16,_0x2d88fe)[_0x6042('0x18')](respondWithFilteredResult(_0x2aad84,_0x451b16))[_0x6042('0x28')](handleError(_0x2aad84,null));};exports['show']=function(_0x14238f,_0x1f3d79){var _0x17c383={'raw':![],'where':{'id':_0x14238f[_0x6042('0x29')]['id']}},_0x41e6de={};_0x41e6de[_0x6042('0x2a')]=_[_0x6042('0x2b')](db[_0x6042('0x20')][_0x6042('0x21')]);_0x41e6de['query']=_['keys'](_0x14238f[_0x6042('0x2c')]);_0x41e6de[_0x6042('0x2d')]=_[_0x6042('0x2e')](_0x41e6de[_0x6042('0x2a')],_0x41e6de[_0x6042('0x2c')]);_0x17c383['attributes']=_[_0x6042('0x2e')](_0x41e6de[_0x6042('0x2a')],qs[_0x6042('0x2f')](_0x14238f[_0x6042('0x2c')]['fields']));_0x17c383[_0x6042('0x30')]=_0x17c383[_0x6042('0x30')][_0x6042('0x31')]?_0x17c383[_0x6042('0x30')]:_0x41e6de[_0x6042('0x2a')];if(_0x14238f['query'][_0x6042('0x32')]){_0x17c383[_0x6042('0x33')]=[{'all':!![]}];}_0x17c383=_[_0x6042('0x34')]({},_0x17c383,_0x14238f[_0x6042('0x35')]);return db[_0x6042('0x20')][_0x6042('0x36')](_0x17c383)[_0x6042('0x18')](handleEntityNotFound(_0x1f3d79,null))['then'](respondWithResult(_0x1f3d79,null))[_0x6042('0x28')](handleError(_0x1f3d79,null));};exports[_0x6042('0x37')]=function(_0x54bfdd,_0xdaaf07){return db[_0x6042('0x20')]['create'](_0x54bfdd[_0x6042('0x38')],{})[_0x6042('0x18')](respondWithResult(_0xdaaf07,0xc9))[_0x6042('0x28')](handleError(_0xdaaf07,null));};exports['update']=function(_0x3cf577,_0x3df6b8){if(_0x3cf577['body']['id']){delete _0x3cf577[_0x6042('0x38')]['id'];}return db[_0x6042('0x20')][_0x6042('0x36')]({'where':{'id':_0x3cf577[_0x6042('0x29')]['id']}})[_0x6042('0x18')](handleEntityNotFound(_0x3df6b8,null))[_0x6042('0x18')](saveUpdates(_0x3cf577[_0x6042('0x38')],null))['then'](respondWithResult(_0x3df6b8,null))[_0x6042('0x28')](handleError(_0x3df6b8,null));};exports[_0x6042('0x19')]=function(_0x54789e,_0x31d566){return db[_0x6042('0x20')][_0x6042('0x36')]({'where':{'id':_0x54789e['params']['id']}})[_0x6042('0x18')](handleEntityNotFound(_0x31d566,null))[_0x6042('0x18')](removeEntity(_0x31d566,null))[_0x6042('0x28')](handleError(_0x31d566,null));};exports[_0x6042('0x39')]=function(_0x4d006d,_0x577ecb){return db[_0x6042('0x20')][_0x6042('0x39')]()['then'](respondWithResult(_0x577ecb,null))['catch'](handleError(_0x577ecb,null));};exports[_0x6042('0x3a')]=function(_0x4a29a4,_0x396a61){return db[_0x6042('0x3b')][_0x6042('0x36')]({'where':{'id':_0x4a29a4[_0x6042('0x29')]['id']}})[_0x6042('0x18')](handleEntityNotFound(_0x396a61,null))[_0x6042('0x18')](function(_0x1609ed){if(_0x1609ed){return _0x1609ed[_0x6042('0x3a')](_0x4a29a4['body'][_0x6042('0x3c')],_['omit'](_0x4a29a4[_0x6042('0x38')],['ids','id'])||{});}})[_0x6042('0x18')](respondWithResult(_0x396a61,null))['catch'](handleError(_0x396a61,null));};exports[_0x6042('0x3d')]=function(_0x45f661,_0xc9b8b5){var _0x256968={'raw':![],'where':{}};var _0x546a53={};var _0x384397={'count':0x0,'rows':[]};return db[_0x6042('0x20')][_0x6042('0x3e')]({'where':{'id':_0x45f661['params']['id']}})[_0x6042('0x18')](handleEntityNotFound(_0xc9b8b5,null))['then'](function(_0x4dbb65){if(_0x4dbb65){_0x546a53[_0x6042('0x2a')]=_[_0x6042('0x2b')](db[_0x6042('0x3b')][_0x6042('0x21')]);_0x546a53[_0x6042('0x2c')]=_[_0x6042('0x2b')](_0x45f661[_0x6042('0x2c')]);_0x546a53[_0x6042('0x2d')]=_[_0x6042('0x2e')](_0x546a53[_0x6042('0x2a')],_0x546a53[_0x6042('0x2c')]);_0x256968[_0x6042('0x30')]=_['intersection'](_0x546a53[_0x6042('0x2a')],qs[_0x6042('0x2f')](_0x45f661[_0x6042('0x2c')][_0x6042('0x2f')]));_0x256968['attributes']=_0x256968[_0x6042('0x30')][_0x6042('0x31')]?_0x256968[_0x6042('0x30')]:_0x546a53[_0x6042('0x2a')];if(!_0x45f661['query']['hasOwnProperty']('nolimit')){_0x256968[_0x6042('0x13')]=qs[_0x6042('0x13')](_0x45f661[_0x6042('0x2c')][_0x6042('0x13')]);_0x256968[_0x6042('0x11')]=qs[_0x6042('0x11')](_0x45f661[_0x6042('0x2c')][_0x6042('0x11')]);}_0x256968['order']=qs[_0x6042('0x3f')](_0x45f661[_0x6042('0x2c')]['sort']);_0x256968[_0x6042('0x40')]=qs[_0x6042('0x2d')](_[_0x6042('0x41')](_0x45f661[_0x6042('0x2c')],_0x546a53['filters']));_0x256968[_0x6042('0x40')][_0x6042('0x42')]=_0x4dbb65['id'];if(_0x45f661[_0x6042('0x2c')][_0x6042('0x43')]){_0x256968['where']=_['merge'](_0x256968['where'],{'$or':_[_0x6042('0x1f')](_0x256968[_0x6042('0x30')],function(_0x272293){var _0x5a89a5={};_0x5a89a5[_0x272293]={'$like':'%'+_0x45f661[_0x6042('0x2c')]['filter']+'%'};return _0x5a89a5;})});}if(_0x45f661[_0x6042('0x2c')]['$gte']){var _0x1b3f54=_0x45f661['query'][_0x6042('0x44')][_0x6042('0x45')](',');var _0x2b189b={};_0x2b189b[_0x1b3f54[0x0]]={'$gte':moment(_0x1b3f54[0x1])['format'](_0x6042('0x46'))};_0x256968[_0x6042('0x40')]=_[_0x6042('0x34')](_0x256968[_0x6042('0x40')],_0x2b189b);}_0x256968=_['merge']({},_0x256968,_0x45f661[_0x6042('0x35')]);return db[_0x6042('0x3b')]['count']({'where':_0x256968[_0x6042('0x40')]})[_0x6042('0x18')](function(_0x275f86){_0x384397[_0x6042('0x14')]=_0x275f86;if(_0x45f661[_0x6042('0x2c')]['includeAll']){_0x256968[_0x6042('0x33')]=[{'all':!![]}];}return db[_0x6042('0x3b')][_0x6042('0x47')](_0x256968);})[_0x6042('0x18')](function(_0x1ed696){_0x384397[_0x6042('0x48')]=_0x1ed696;return _0x384397;});}})['then'](respondWithFilteredResult(_0xc9b8b5,_0x256968))[_0x6042('0x28')](handleError(_0xc9b8b5,null));};exports['addTags']=function(_0x300847,_0x3e2a28){return db['FaxInteraction'][_0x6042('0x36')]({'where':{'id':_0x300847['params']['id']}})[_0x6042('0x18')](handleEntityNotFound(_0x3e2a28,null))[_0x6042('0x18')](function(_0x15f0f3){if(_0x15f0f3){return _0x15f0f3['setTags'](_0x300847[_0x6042('0x38')][_0x6042('0x3c')],_[_0x6042('0x49')](_0x300847[_0x6042('0x38')],[_0x6042('0x3c'),'id'])||{})[_0x6042('0x4a')](function(){return db[_0x6042('0x4b')][_0x6042('0x47')]({'attributes':['id','name',_0x6042('0x4c')],'where':{'id':_0x300847[_0x6042('0x38')][_0x6042('0x3c')]}});})[_0x6042('0x18')](function(_0x29d692){socket[_0x6042('0x4d')]('faxInteractionTags:save',{'id':Number(_0x300847[_0x6042('0x29')]['id']),'tags':_0x29d692||[]});return{'id':Number(_0x300847['params']['id']),'tags':_0x29d692||[]};});}})[_0x6042('0x18')](respondWithResult(_0x3e2a28,null))[_0x6042('0x28')](handleError(_0x3e2a28,null));};exports[_0x6042('0x4e')]=function(_0x2d0f80,_0x1e4451){return db[_0x6042('0x20')][_0x6042('0x36')]({'where':{'id':_0x2d0f80[_0x6042('0x29')]['id']}})[_0x6042('0x18')](handleEntityNotFound(_0x1e4451,null))[_0x6042('0x18')](function(_0x5a3a6b){if(_0x5a3a6b){return _0x5a3a6b['removeTags'](_0x2d0f80[_0x6042('0x2c')][_0x6042('0x3c')]);}})[_0x6042('0x18')](respondWithStatusCode(_0x1e4451,null))['catch'](handleError(_0x1e4451,null));};exports[_0x6042('0x4f')]=function(_0x3b55aa,_0x23d84f){var _0x3afdc3=moment()[_0x6042('0x50')]()['toString']();var _0x104a27=path['join'](config[_0x6042('0x51')],_0x6042('0x52'),_0x6042('0x53'),_0x6042('0x54'));var _0xd4a026=path['join'](config[_0x6042('0x51')],_0x6042('0x52'),_0x6042('0x53'),_0x6042('0x55'));var _0x2954ed=path['join'](_0x104a27,_0x3afdc3);var _0x2aa555=util[_0x6042('0x56')]('transcript-%d-%s.zip',_0x3b55aa[_0x6042('0x29')]['id'],_0x3afdc3);var _0x10ad75=path[_0x6042('0x57')](_0x104a27,_0x2aa555);var _0x2b70d6=[];_0x2b70d6[_0x6042('0x58')]({'model':db[_0x6042('0x59')],'as':_0x6042('0x59'),'raw':!![]});var _0x48ecd9=[{'model':db['FaxMessage'],'as':_0x6042('0x5a'),'attributes':['id',_0x6042('0x38'),_0x6042('0x5b')],'include':_0x2b70d6}];return db[_0x6042('0x20')][_0x6042('0x36')]({'where':{'id':_0x3b55aa[_0x6042('0x29')]['id']},'include':_0x48ecd9})[_0x6042('0x18')](handleEntityNotFound(_0x23d84f,null))[_0x6042('0x18')](function(_0x546411){if(_0x546411&&_0x546411[_0x6042('0x5a')]){var _0x4e4ff7=_0x546411[_0x6042('0x5c')]({'plain':!![]});fs[_0x6042('0x5d')](_0x2954ed);for(var _0x49c7b3=0x0;_0x49c7b3<_0x4e4ff7[_0x6042('0x5a')][_0x6042('0x31')];_0x49c7b3++){var _0x5e8835=_0x4e4ff7[_0x6042('0x5a')][_0x49c7b3][_0x6042('0x59')];if(_0x5e8835){var _0xb44374=path[_0x6042('0x57')](_0xd4a026,_0x5e8835[_0x6042('0x5e')]);if(fs[_0x6042('0x5f')](_0xb44374)){fs['createReadStream'](_0xb44374)[_0x6042('0x60')](fs[_0x6042('0x61')](path['join'](_0x2954ed,_0x5e8835[_0x6042('0x5e')])));}}}return BPromise[_0x6042('0x62')]()[_0x6042('0x18')](function(){return new BPromise(function(_0x27f69b,_0x2989b6){zipdir(_0x2954ed,{'saveTo':_0x10ad75},function(_0x144b4a,_0x43c374){if(_0x144b4a)return _0x2989b6(_0x144b4a);return _0x27f69b(_0x43c374);});})[_0x6042('0x18')](function(){return new BPromise(function(_0x31b689,_0x1bf4d3){rimraf(_0x2954ed,function(_0x4eab16){if(_0x4eab16)_0x1bf4d3(_0x4eab16);return _0x31b689();});});})[_0x6042('0x18')](function(){return _0x23d84f[_0x6042('0x4f')](_0x10ad75,_0x2aa555,function(_0x47c966){if(_0x47c966){console[_0x6042('0x63')](_0x6042('0x64'),_0x47c966);}else{fs['unlinkSync'](_0x10ad75);}});});});}else{return _0x23d84f['sendStatus'](0xc8);}})[_0x6042('0x28')](handleError(_0x23d84f,null));}; \ No newline at end of file +var _0xd02c=['Content-Range','update','then','destroy','error','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','params','describe','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','sort','pick','where','FaxInteractionId','filter','merge','$gte','split','format','FaxMessage','count','addTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','files','attachments','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','undefined','limit','offset','set'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0xd02c,0x1e5));var _0xcd02=function(_0x3604bc,_0x491f9a){_0x3604bc=_0x3604bc-0x0;var _0x4b873d=_0xd02c[_0x3604bc];return _0x4b873d;};'use strict';var rimraf=require(_0xcd02('0x0'));var zipdir=require(_0xcd02('0x1'));var moment=require(_0xcd02('0x2'));var BPromise=require(_0xcd02('0x3'));var util=require('util');var path=require(_0xcd02('0x4'));var fs=require('fs');var _=require(_0xcd02('0x5'));var Redis=require(_0xcd02('0x6'));var interaction=require(_0xcd02('0x7'));var qs=require(_0xcd02('0x8'));var logger=require(_0xcd02('0x9'))(_0xcd02('0xa'));var config=require('../../config/environment');var db=require(_0xcd02('0xb'))['db'];config[_0xcd02('0xc')]=_[_0xcd02('0xd')](config[_0xcd02('0xc')],{'host':_0xcd02('0xe'),'port':0x18eb});var socket=require(_0xcd02('0xf'))(new Redis(config['redis']));require(_0xcd02('0x10'))['register'](socket);function respondWithStatusCode(_0x545470,_0x42e42b){_0x42e42b=_0x42e42b||0xcc;return function(_0x1f0b7f){if(_0x1f0b7f){return _0x545470[_0xcd02('0x11')](_0x42e42b);}return _0x545470[_0xcd02('0x12')](_0x42e42b)[_0xcd02('0x13')]();};}function respondWithResult(_0x21ec06,_0x55b09b){_0x55b09b=_0x55b09b||0xc8;return function(_0x58dbda){if(_0x58dbda){return _0x21ec06['status'](_0x55b09b)[_0xcd02('0x14')](_0x58dbda);}};}function respondWithFilteredResult(_0x17fbb3,_0x1fb1b4){return function(_0x44ae62){if(_0x44ae62){var _0x510a65=typeof _0x1fb1b4['offset']===_0xcd02('0x15')&&typeof _0x1fb1b4[_0xcd02('0x16')]===_0xcd02('0x15');var _0x2e5d2f=_0x44ae62['count'];var _0x17d338=_0x510a65?0x0:_0x1fb1b4[_0xcd02('0x17')];var _0x16d2df=_0x510a65?_0x44ae62['count']:_0x1fb1b4['offset']+_0x1fb1b4[_0xcd02('0x16')];var _0x6b1ee0;if(_0x16d2df>=_0x2e5d2f){_0x16d2df=_0x2e5d2f;_0x6b1ee0=0xc8;}else{_0x6b1ee0=0xce;}_0x17fbb3[_0xcd02('0x12')](_0x6b1ee0);return _0x17fbb3[_0xcd02('0x18')](_0xcd02('0x19'),_0x17d338+'-'+_0x16d2df+'/'+_0x2e5d2f)[_0xcd02('0x14')](_0x44ae62);}return null;};}function saveUpdates(_0x165fe2){return function(_0x1d7082){if(_0x1d7082){return _0x1d7082[_0xcd02('0x1a')](_0x165fe2)[_0xcd02('0x1b')](function(_0x581062){return _0x581062;});}return null;};}function removeEntity(_0x259a62){return function(_0x53c931){if(_0x53c931){return _0x53c931[_0xcd02('0x1c')]()[_0xcd02('0x1b')](function(){_0x259a62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x274af5){return function(_0x1ed6db){if(!_0x1ed6db){_0x274af5[_0xcd02('0x11')](0x194);}return _0x1ed6db;};}function handleError(_0x490673,_0x35f578){_0x35f578=_0x35f578||0x1f4;return function(_0x446770){logger[_0xcd02('0x1d')](_0x446770['stack']);if(_0x446770[_0xcd02('0x1e')]){delete _0x446770[_0xcd02('0x1e')];}_0x490673[_0xcd02('0x12')](_0x35f578)[_0xcd02('0x1f')](_0x446770);};}exports['index']=function(_0x280a6a,_0x4f63e9){var _0x157bd6={};var _0x47253f=_[_0xcd02('0x20')](db[_0xcd02('0x21')][_0xcd02('0x22')],function(_0x21dd8a){return{'name':_0x21dd8a[_0xcd02('0x23')],'type':_0x21dd8a[_0xcd02('0x24')][_0xcd02('0x25')]};});_0x157bd6=qs[_0xcd02('0x26')](_0x47253f,_0x280a6a);return interaction[_0xcd02('0x27')](_0xcd02('0x28'),_0x280a6a[_0xcd02('0x29')],_0x280a6a[_0xcd02('0x2a')],_0x157bd6,_0x47253f)[_0xcd02('0x1b')](respondWithFilteredResult(_0x4f63e9,_0x157bd6))[_0xcd02('0x2b')](handleError(_0x4f63e9,null));};exports[_0xcd02('0x2c')]=function(_0x9d290a,_0x10f349){var _0x5df121={'raw':![],'where':{'id':_0x9d290a['params']['id']}},_0x3b6ce5={};_0x3b6ce5[_0xcd02('0x2d')]=_[_0xcd02('0x2e')](db['FaxInteraction'][_0xcd02('0x22')]);_0x3b6ce5[_0xcd02('0x29')]=_[_0xcd02('0x2e')](_0x9d290a['query']);_0x3b6ce5[_0xcd02('0x2f')]=_[_0xcd02('0x30')](_0x3b6ce5[_0xcd02('0x2d')],_0x3b6ce5['query']);_0x5df121[_0xcd02('0x31')]=_[_0xcd02('0x30')](_0x3b6ce5[_0xcd02('0x2d')],qs['fields'](_0x9d290a['query'][_0xcd02('0x32')]));_0x5df121[_0xcd02('0x31')]=_0x5df121[_0xcd02('0x31')][_0xcd02('0x33')]?_0x5df121[_0xcd02('0x31')]:_0x3b6ce5['model'];if(_0x9d290a[_0xcd02('0x29')][_0xcd02('0x34')]){_0x5df121[_0xcd02('0x35')]=[{'all':!![]}];}_0x5df121=_['merge']({},_0x5df121,_0x9d290a[_0xcd02('0x36')]);return db[_0xcd02('0x21')][_0xcd02('0x37')](_0x5df121)[_0xcd02('0x1b')](handleEntityNotFound(_0x10f349,null))[_0xcd02('0x1b')](respondWithResult(_0x10f349,null))[_0xcd02('0x2b')](handleError(_0x10f349,null));};exports[_0xcd02('0x38')]=function(_0x22e785,_0x39a335){return db['FaxInteraction'][_0xcd02('0x38')](_0x22e785[_0xcd02('0x39')],{})[_0xcd02('0x1b')](respondWithResult(_0x39a335,0xc9))[_0xcd02('0x2b')](handleError(_0x39a335,null));};exports[_0xcd02('0x1a')]=function(_0x1ed52a,_0x16da8b){if(_0x1ed52a[_0xcd02('0x39')]['id']){delete _0x1ed52a[_0xcd02('0x39')]['id'];}return db[_0xcd02('0x21')][_0xcd02('0x37')]({'where':{'id':_0x1ed52a['params']['id']}})[_0xcd02('0x1b')](handleEntityNotFound(_0x16da8b,null))[_0xcd02('0x1b')](saveUpdates(_0x1ed52a[_0xcd02('0x39')],null))[_0xcd02('0x1b')](respondWithResult(_0x16da8b,null))['catch'](handleError(_0x16da8b,null));};exports[_0xcd02('0x1c')]=function(_0x488707,_0x2ad8d0){return db[_0xcd02('0x21')][_0xcd02('0x37')]({'where':{'id':_0x488707[_0xcd02('0x3a')]['id']}})[_0xcd02('0x1b')](handleEntityNotFound(_0x2ad8d0,null))['then'](removeEntity(_0x2ad8d0,null))[_0xcd02('0x2b')](handleError(_0x2ad8d0,null));};exports[_0xcd02('0x3b')]=function(_0x37c13e,_0x20ecf6){return db[_0xcd02('0x21')][_0xcd02('0x3b')]()[_0xcd02('0x1b')](respondWithResult(_0x20ecf6,null))[_0xcd02('0x2b')](handleError(_0x20ecf6,null));};exports['addMessage']=function(_0x150433,_0x10ff01){return db['FaxMessage'][_0xcd02('0x37')]({'where':{'id':_0x150433[_0xcd02('0x3a')]['id']}})[_0xcd02('0x1b')](handleEntityNotFound(_0x10ff01,null))[_0xcd02('0x1b')](function(_0x578cab){if(_0x578cab){return _0x578cab[_0xcd02('0x3c')](_0x150433[_0xcd02('0x39')][_0xcd02('0x3d')],_[_0xcd02('0x3e')](_0x150433[_0xcd02('0x39')],[_0xcd02('0x3d'),'id'])||{});}})[_0xcd02('0x1b')](respondWithResult(_0x10ff01,null))['catch'](handleError(_0x10ff01,null));};exports[_0xcd02('0x3f')]=function(_0x464201,_0x50e25c){var _0x303d5f={'raw':![],'where':{}};var _0x540c36={};var _0x3b79ff={'count':0x0,'rows':[]};return db[_0xcd02('0x21')]['findOne']({'where':{'id':_0x464201['params']['id']}})[_0xcd02('0x1b')](handleEntityNotFound(_0x50e25c,null))['then'](function(_0x445e9e){if(_0x445e9e){_0x540c36['model']=_[_0xcd02('0x2e')](db['FaxMessage'][_0xcd02('0x22')]);_0x540c36[_0xcd02('0x29')]=_[_0xcd02('0x2e')](_0x464201['query']);_0x540c36[_0xcd02('0x2f')]=_[_0xcd02('0x30')](_0x540c36[_0xcd02('0x2d')],_0x540c36[_0xcd02('0x29')]);_0x303d5f[_0xcd02('0x31')]=_['intersection'](_0x540c36[_0xcd02('0x2d')],qs[_0xcd02('0x32')](_0x464201[_0xcd02('0x29')][_0xcd02('0x32')]));_0x303d5f[_0xcd02('0x31')]=_0x303d5f['attributes']['length']?_0x303d5f[_0xcd02('0x31')]:_0x540c36['model'];if(!_0x464201[_0xcd02('0x29')][_0xcd02('0x40')](_0xcd02('0x41'))){_0x303d5f[_0xcd02('0x16')]=qs[_0xcd02('0x16')](_0x464201[_0xcd02('0x29')][_0xcd02('0x16')]);_0x303d5f[_0xcd02('0x17')]=qs['offset'](_0x464201['query'][_0xcd02('0x17')]);}_0x303d5f['order']=qs[_0xcd02('0x42')](_0x464201['query'][_0xcd02('0x42')]);_0x303d5f['where']=qs['filters'](_[_0xcd02('0x43')](_0x464201['query'],_0x540c36[_0xcd02('0x2f')]));_0x303d5f[_0xcd02('0x44')][_0xcd02('0x45')]=_0x445e9e['id'];if(_0x464201[_0xcd02('0x29')][_0xcd02('0x46')]){_0x303d5f[_0xcd02('0x44')]=_[_0xcd02('0x47')](_0x303d5f['where'],{'$or':_[_0xcd02('0x20')](_0x303d5f[_0xcd02('0x31')],function(_0x335f24){var _0x4818d4={};_0x4818d4[_0x335f24]={'$like':'%'+_0x464201[_0xcd02('0x29')][_0xcd02('0x46')]+'%'};return _0x4818d4;})});}if(_0x464201[_0xcd02('0x29')][_0xcd02('0x48')]){var _0x222e76=_0x464201[_0xcd02('0x29')][_0xcd02('0x48')][_0xcd02('0x49')](',');var _0xc8cc58={};_0xc8cc58[_0x222e76[0x0]]={'$gte':moment(_0x222e76[0x1])[_0xcd02('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x303d5f[_0xcd02('0x44')]=_[_0xcd02('0x47')](_0x303d5f[_0xcd02('0x44')],_0xc8cc58);}_0x303d5f=_[_0xcd02('0x47')]({},_0x303d5f,_0x464201[_0xcd02('0x36')]);return db[_0xcd02('0x4b')][_0xcd02('0x4c')]({'where':_0x303d5f[_0xcd02('0x44')]})[_0xcd02('0x1b')](function(_0x12146a){_0x3b79ff['count']=_0x12146a;if(_0x464201['query'][_0xcd02('0x34')]){_0x303d5f[_0xcd02('0x35')]=[{'all':!![]}];}return db[_0xcd02('0x4b')][_0xcd02('0x27')](_0x303d5f);})[_0xcd02('0x1b')](function(_0x2db0dd){_0x3b79ff['rows']=_0x2db0dd;return _0x3b79ff;});}})[_0xcd02('0x1b')](respondWithFilteredResult(_0x50e25c,_0x303d5f))[_0xcd02('0x2b')](handleError(_0x50e25c,null));};exports[_0xcd02('0x4d')]=function(_0x4ccfb9,_0x9b37f4){return db['FaxInteraction'][_0xcd02('0x37')]({'where':{'id':_0x4ccfb9[_0xcd02('0x3a')]['id']}})[_0xcd02('0x1b')](handleEntityNotFound(_0x9b37f4,null))[_0xcd02('0x1b')](function(_0x25eef7){if(_0x25eef7){return _0x25eef7['setTags'](_0x4ccfb9[_0xcd02('0x39')][_0xcd02('0x3d')],_[_0xcd02('0x3e')](_0x4ccfb9['body'],[_0xcd02('0x3d'),'id'])||{})[_0xcd02('0x4e')](function(){return db['Tag'][_0xcd02('0x27')]({'attributes':['id',_0xcd02('0x1e'),_0xcd02('0x4f')],'where':{'id':_0x4ccfb9['body'][_0xcd02('0x3d')]}});})[_0xcd02('0x1b')](function(_0x28416d){socket[_0xcd02('0x50')](_0xcd02('0x51'),{'id':Number(_0x4ccfb9[_0xcd02('0x3a')]['id']),'tags':_0x28416d||[]});return{'id':Number(_0x4ccfb9[_0xcd02('0x3a')]['id']),'tags':_0x28416d||[]};});}})['then'](respondWithResult(_0x9b37f4,null))[_0xcd02('0x2b')](handleError(_0x9b37f4,null));};exports['removeTags']=function(_0x5eb191,_0x3584c9){return db[_0xcd02('0x21')][_0xcd02('0x37')]({'where':{'id':_0x5eb191[_0xcd02('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3584c9,null))['then'](function(_0x20faec){if(_0x20faec){return _0x20faec[_0xcd02('0x52')](_0x5eb191['query'][_0xcd02('0x3d')]);}})['then'](respondWithStatusCode(_0x3584c9,null))[_0xcd02('0x2b')](handleError(_0x3584c9,null));};exports[_0xcd02('0x53')]=function(_0x57ceb6,_0x340a9b){var _0x234b03=moment()[_0xcd02('0x54')]()[_0xcd02('0x55')]();var _0x4851c7=path[_0xcd02('0x56')](config['root'],_0xcd02('0x57'),_0xcd02('0x58'),'tmp');var _0x187b98=path[_0xcd02('0x56')](config['root'],_0xcd02('0x57'),_0xcd02('0x58'),_0xcd02('0x59'));var _0x1b4aa3=path[_0xcd02('0x56')](_0x4851c7,_0x234b03);var _0x5da082=util[_0xcd02('0x4a')](_0xcd02('0x5a'),_0x57ceb6[_0xcd02('0x3a')]['id'],_0x234b03);var _0xf4b0ce=path[_0xcd02('0x56')](_0x4851c7,_0x5da082);var _0x4fbf5e=[];_0x4fbf5e['push']({'model':db[_0xcd02('0x5b')],'as':_0xcd02('0x5b'),'raw':!![]});var _0x368e12=[{'model':db[_0xcd02('0x4b')],'as':'Messages','attributes':['id',_0xcd02('0x39'),_0xcd02('0x5c')],'include':_0x4fbf5e}];return db[_0xcd02('0x21')][_0xcd02('0x37')]({'where':{'id':_0x57ceb6[_0xcd02('0x3a')]['id']},'include':_0x368e12})[_0xcd02('0x1b')](handleEntityNotFound(_0x340a9b,null))[_0xcd02('0x1b')](function(_0x17355e){if(_0x17355e&&_0x17355e[_0xcd02('0x5d')]){var _0x15f3f1=_0x17355e[_0xcd02('0x5e')]({'plain':!![]});fs[_0xcd02('0x5f')](_0x1b4aa3);for(var _0x3ca043=0x0;_0x3ca043<_0x15f3f1[_0xcd02('0x5d')][_0xcd02('0x33')];_0x3ca043++){var _0x1c5ca0=_0x15f3f1[_0xcd02('0x5d')][_0x3ca043]['Attachment'];if(_0x1c5ca0){var _0x42f34d=path['join'](_0x187b98,_0x1c5ca0[_0xcd02('0x60')]);if(fs['existsSync'](_0x42f34d)){fs['createReadStream'](_0x42f34d)['pipe'](fs[_0xcd02('0x61')](path['join'](_0x1b4aa3,_0x1c5ca0[_0xcd02('0x60')])));}}}return BPromise[_0xcd02('0x62')]()['then'](function(){return new BPromise(function(_0x412345,_0x4bffd3){zipdir(_0x1b4aa3,{'saveTo':_0xf4b0ce},function(_0x383ca8,_0x22493a){if(_0x383ca8)return _0x4bffd3(_0x383ca8);return _0x412345(_0x22493a);});})[_0xcd02('0x1b')](function(){return new BPromise(function(_0x1bdbfd,_0xa7be3d){rimraf(_0x1b4aa3,function(_0x5282d4){if(_0x5282d4)_0xa7be3d(_0x5282d4);return _0x1bdbfd();});});})['then'](function(){return _0x340a9b[_0xcd02('0x53')](_0xf4b0ce,_0x5da082,function(_0x1f1b29){if(_0x1f1b29){console[_0xcd02('0x63')](_0xcd02('0x64'),_0x1f1b29);}else{fs[_0xcd02('0x65')](_0xf4b0ce);}});});});}else{return _0x340a9b[_0xcd02('0x11')](0xc8);}})[_0xcd02('0x2b')](handleError(_0x340a9b,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index e7a147c..5933364 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 _0x101c=['FaxMessage','save','update','remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','events','../../mysqldb'];(function(_0x20704a,_0x5de696){var _0x5548c0=function(_0x368628){while(--_0x368628){_0x20704a['push'](_0x20704a['shift']());}};_0x5548c0(++_0x5de696);}(_0x101c,0xec));var _0xc101=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x101c[_0x3a7a9c];return _0x59156e;};'use strict';var EventEmitter=require(_0xc101('0x0'));var FaxInteraction=require(_0xc101('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xc101('0x1'))['db'][_0xc101('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc101('0x3'),'afterUpdate':_0xc101('0x4'),'afterDestroy':_0xc101('0x5')};function emitEvent(_0x395208){return function(_0x9afc0a,_0x1f3b45,_0x269087){_0x9afc0a['getUsers']({'attributes':['id'],'raw':!![]})[_0xc101('0x6')](function(_0x1c93b8){_0x9afc0a[_0xc101('0x7')](_0xc101('0x8'),_0x1c93b8[_0xc101('0x9')](function(_0x22b7eb){return{'id':_0x22b7eb['id']};}));return FaxMessage[_0xc101('0xa')]({'where':{'FaxInteractionId':_0x9afc0a['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc101('0x6')](function(_0x50835c){_0x9afc0a['setDataValue']('unreadMessages',_0x50835c['length']);FaxInteractionEvents[_0xc101('0xb')](_0x395208+':'+_0x9afc0a['id'],_0x9afc0a);FaxInteractionEvents[_0xc101('0xb')](_0x395208,_0x9afc0a);_0x269087(null);})[_0xc101('0xc')](_0x269087(null));};}for(var e in events){if(events[_0xc101('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xce13=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','then','setDataValue','Users','map','findAll','unreadMessages','length','emit'];(function(_0x4283b7,_0x22f102){var _0x333d48=function(_0x37e373){while(--_0x37e373){_0x4283b7['push'](_0x4283b7['shift']());}};_0x333d48(++_0x22f102);}(_0xce13,0xd5));var _0x3ce1=function(_0x44801a,_0xec2d43){_0x44801a=_0x44801a-0x0;var _0x2dda7f=_0xce13[_0x44801a];return _0x2dda7f;};'use strict';var EventEmitter=require(_0x3ce1('0x0'));var FaxInteraction=require(_0x3ce1('0x1'))['db'][_0x3ce1('0x2')];var FaxMessage=require(_0x3ce1('0x1'))['db'][_0x3ce1('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x3ce1('0x4')](0x0);var events={'afterCreate':_0x3ce1('0x5'),'afterUpdate':_0x3ce1('0x6'),'afterDestroy':'remove'};function emitEvent(_0x2a0f19){return function(_0x5b6c5c,_0x110471,_0x189368){_0x5b6c5c['getUsers']({'attributes':['id'],'raw':!![]})[_0x3ce1('0x7')](function(_0x2c5d5c){_0x5b6c5c[_0x3ce1('0x8')](_0x3ce1('0x9'),_0x2c5d5c[_0x3ce1('0xa')](function(_0x4b548e){return{'id':_0x4b548e['id']};}));return FaxMessage[_0x3ce1('0xb')]({'where':{'FaxInteractionId':_0x5b6c5c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3ce1('0x7')](function(_0x2ab775){_0x5b6c5c[_0x3ce1('0x8')](_0x3ce1('0xc'),_0x2ab775[_0x3ce1('0xd')]);FaxInteractionEvents[_0x3ce1('0xe')](_0x2a0f19+':'+_0x5b6c5c['id'],_0x5b6c5c);FaxInteractionEvents['emit'](_0x2a0f19,_0x5b6c5c);_0x189368(null);})[_0x3ce1('0xf')](_0x189368(null));};}for(var e in events){if(events[_0x3ce1('0x10')](e)){var event=events[e];FaxInteraction[_0x3ce1('0x11')](e,emitEvent(event));}}module[_0x3ce1('0x12')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7e0b67b..d92611b 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 _0x9072=['fax_interactions','changed','closed','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9072,0x169));var _0x2907=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9072[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2907('0x0'));var util=require(_0x2907('0x1'));var logger=require(_0x2907('0x2'))(_0x2907('0x3'));var moment=require(_0x2907('0x4'));var BPromise=require(_0x2907('0x5'));var rp=require(_0x2907('0x6'));var fs=require('fs');var path=require(_0x2907('0x7'));var rimraf=require(_0x2907('0x8'));var config=require(_0x2907('0x9'));var attributes=require(_0x2907('0xa'));module[_0x2907('0xb')]=function(_0x59f217,_0x4c0b1c){return _0x59f217[_0x2907('0xc')]('FaxInteraction',attributes,{'tableName':_0x2907('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1cc603,_0x35f236,_0x421478){if(_0x1cc603[_0x2907('0xe')](_0x2907('0xf'))){_0x1cc603['closedAt']=moment()[_0x2907('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x421478(null,_0x1cc603);}}});}; \ No newline at end of file +var _0x693d=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','closed','format'];(function(_0x4b95fc,_0x3c61f7){var _0x33c2b4=function(_0x138478){while(--_0x138478){_0x4b95fc['push'](_0x4b95fc['shift']());}};_0x33c2b4(++_0x3c61f7);}(_0x693d,0x68));var _0xd693=function(_0x4be15e,_0x55144f){_0x4be15e=_0x4be15e-0x0;var _0x1014c6=_0x693d[_0x4be15e];return _0x1014c6;};'use strict';var _=require(_0xd693('0x0'));var util=require('util');var logger=require(_0xd693('0x1'))(_0xd693('0x2'));var moment=require(_0xd693('0x3'));var BPromise=require('bluebird');var rp=require(_0xd693('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd693('0x5'));var config=require(_0xd693('0x6'));var attributes=require(_0xd693('0x7'));module[_0xd693('0x8')]=function(_0x11a062,_0x58e563){return _0x11a062['define'](_0xd693('0x9'),attributes,{'tableName':_0xd693('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23be39,_0x22533e,_0x12f687){if(_0x23be39['changed'](_0xd693('0xb'))){_0x23be39['closedAt']=moment()[_0xd693('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x12f687(null,_0x23be39);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 45121c9..52ebe91 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 _0xedda=['options','raw','attributes','limit','debug','AddTagsToFaxInteraction','find','where','addTags','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','redis','socket.io-emitter','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','update','body'];(function(_0x50cae0,_0x2b0fae){var _0x513511=function(_0x33633b){while(--_0x33633b){_0x50cae0['push'](_0x50cae0['shift']());}};_0x513511(++_0x2b0fae);}(_0xedda,0x1a6));var _0xaedd=function(_0x46093e,_0x442c89){_0x46093e=_0x46093e-0x0;var _0x2303fb=_0xedda[_0x46093e];return _0x2303fb;};'use strict';var _=require(_0xaedd('0x0'));var util=require(_0xaedd('0x1'));var moment=require(_0xaedd('0x2'));var BPromise=require(_0xaedd('0x3'));var rs=require(_0xaedd('0x4'));var fs=require('fs');var Redis=require(_0xaedd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaedd('0x6'))('rpc');var config=require(_0xaedd('0x7'));var jayson=require(_0xaedd('0x8'));var client=jayson[_0xaedd('0x9')]['http']({'port':0x232a});config[_0xaedd('0xa')]=_['defaults'](config[_0xaedd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaedd('0xb'))(new Redis(config[_0xaedd('0xa')]));require('./faxInteraction.socket')[_0xaedd('0xc')](socket);function respondWithRpcPromise(_0x3f4fa8,_0x507ac1,_0x41b011){return new BPromise(function(_0x1b083e,_0x43b0dc){return client[_0xaedd('0xd')](_0x3f4fa8,_0x41b011)[_0xaedd('0xe')](function(_0x48c396){logger['info'](_0xaedd('0xf'),_0x507ac1,_0xaedd('0x10'));logger['debug'](_0xaedd('0x11'),_0x507ac1,_0xaedd('0x10'),JSON[_0xaedd('0x12')](_0x48c396));if(_0x48c396[_0xaedd('0x13')]){if(_0x48c396[_0xaedd('0x13')][_0xaedd('0x14')]===0x1f4){logger['error'](_0xaedd('0xf'),_0x507ac1,_0x48c396[_0xaedd('0x13')][_0xaedd('0x15')]);return _0x43b0dc(_0x48c396[_0xaedd('0x13')][_0xaedd('0x15')]);}logger[_0xaedd('0x13')](_0xaedd('0xf'),_0x507ac1,_0x48c396[_0xaedd('0x13')]['message']);return _0x1b083e(_0x48c396['error'][_0xaedd('0x15')]);}else{logger[_0xaedd('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x507ac1,_0xaedd('0x10'));_0x1b083e(_0x48c396[_0xaedd('0x17')][_0xaedd('0x15')]);}})[_0xaedd('0x18')](function(_0x203452){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x507ac1,_0x203452);_0x43b0dc(_0x203452);});});}exports[_0xaedd('0x19')]=function(_0x6428c8){var _0x530b0f=this;return new Promise(function(_0x23585b,_0x2212ff){return db[_0xaedd('0x1a')][_0xaedd('0x1b')](_0x6428c8[_0xaedd('0x1c')],{'raw':_0x6428c8[_0xaedd('0x1d')]?_0x6428c8[_0xaedd('0x1d')][_0xaedd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6428c8['options']?_0x6428c8[_0xaedd('0x1d')]['where']||null:null,'attributes':_0x6428c8[_0xaedd('0x1d')]?_0x6428c8[_0xaedd('0x1d')][_0xaedd('0x1f')]||null:null,'limit':_0x6428c8[_0xaedd('0x1d')]?_0x6428c8[_0xaedd('0x1d')][_0xaedd('0x20')]||null:null})[_0xaedd('0xe')](function(_0x56daf7){logger['info'](_0xaedd('0x19'),_0x6428c8);logger[_0xaedd('0x21')](_0xaedd('0x19'),_0x6428c8,JSON[_0xaedd('0x12')](_0x56daf7));_0x23585b(_0x56daf7);})[_0xaedd('0x18')](function(_0x71bd39){logger[_0xaedd('0x13')](_0xaedd('0x19'),_0x71bd39['message'],_0x6428c8);_0x2212ff(_0x530b0f[_0xaedd('0x13')](0x1f4,_0x71bd39[_0xaedd('0x15')]));});});};exports[_0xaedd('0x22')]=function(_0x195a2d){return new Promise(function(_0x38c3e6,_0x1ff248){return db[_0xaedd('0x1a')][_0xaedd('0x23')]({'where':_0x195a2d['options']?_0x195a2d['options'][_0xaedd('0x24')]||null:null})[_0xaedd('0xe')](function(_0x17c56b){if(_0x17c56b){return _0x17c56b[_0xaedd('0x25')](_0x195a2d[_0xaedd('0x1c')]['ids'],_[_0xaedd('0x26')](_0x195a2d[_0xaedd('0x1c')],[_0xaedd('0x27'),'id'])||{});}})['spread'](function(_0x5d242c){logger[_0xaedd('0x16')]('AddTags',_0x195a2d);logger[_0xaedd('0x21')](_0xaedd('0x28'),_0x195a2d,JSON[_0xaedd('0x12')](_0x5d242c));_0x38c3e6(_0x5d242c);})['catch'](function(_0x18cbdf){logger['error']('AddTags',_0x18cbdf['message'],_0x195a2d);_0x1ff248(_this['error'](0x1f4,_0x18cbdf[_0xaedd('0x15')]));});});}; \ No newline at end of file +var _0xee91=['spread','AddTags','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','AddTagsToFaxInteraction','FaxInteraction','addTags','ids','omit'];(function(_0xe724b1,_0x4d2f34){var _0x528840=function(_0x12c505){while(--_0x12c505){_0xe724b1['push'](_0xe724b1['shift']());}};_0x528840(++_0x4d2f34);}(_0xee91,0xc5));var _0x1ee9=function(_0x4e1357,_0x27651d){_0x4e1357=_0x4e1357-0x0;var _0x5857e1=_0xee91[_0x4e1357];return _0x5857e1;};'use strict';var _=require(_0x1ee9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ee9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ee9('0x2'));var db=require(_0x1ee9('0x3'))['db'];var utils=require(_0x1ee9('0x4'));var logger=require(_0x1ee9('0x5'))('rpc');var config=require(_0x1ee9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ee9('0x7')]['http']({'port':0x232a});config[_0x1ee9('0x8')]=_[_0x1ee9('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1ee9('0xa'))(new Redis(config[_0x1ee9('0x8')]));require(_0x1ee9('0xb'))[_0x1ee9('0xc')](socket);function respondWithRpcPromise(_0x550a95,_0x5ca839,_0x339f39){return new BPromise(function(_0x2c9e96,_0x4a74c7){return client[_0x1ee9('0xd')](_0x550a95,_0x339f39)[_0x1ee9('0xe')](function(_0x12477d){logger['info'](_0x1ee9('0xf'),_0x5ca839,_0x1ee9('0x10'));logger[_0x1ee9('0x11')](_0x1ee9('0x12'),_0x5ca839,_0x1ee9('0x10'),JSON[_0x1ee9('0x13')](_0x12477d));if(_0x12477d[_0x1ee9('0x14')]){if(_0x12477d[_0x1ee9('0x14')][_0x1ee9('0x15')]===0x1f4){logger[_0x1ee9('0x14')](_0x1ee9('0xf'),_0x5ca839,_0x12477d[_0x1ee9('0x14')][_0x1ee9('0x16')]);return _0x4a74c7(_0x12477d[_0x1ee9('0x14')]['message']);}logger[_0x1ee9('0x14')](_0x1ee9('0xf'),_0x5ca839,_0x12477d['error'][_0x1ee9('0x16')]);return _0x2c9e96(_0x12477d['error']['message']);}else{logger[_0x1ee9('0x17')](_0x1ee9('0xf'),_0x5ca839,_0x1ee9('0x10'));_0x2c9e96(_0x12477d['result']['message']);}})[_0x1ee9('0x18')](function(_0x45f932){logger[_0x1ee9('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x5ca839,_0x45f932);_0x4a74c7(_0x45f932);});});}exports[_0x1ee9('0x19')]=function(_0x537f29){var _0x3ed47f=this;return new Promise(function(_0xe24ffb,_0x52b031){return db['FaxInteraction'][_0x1ee9('0x1a')](_0x537f29[_0x1ee9('0x1b')],{'raw':_0x537f29[_0x1ee9('0x1c')]?_0x537f29[_0x1ee9('0x1c')][_0x1ee9('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537f29[_0x1ee9('0x1c')]?_0x537f29[_0x1ee9('0x1c')][_0x1ee9('0x1e')]||null:null,'attributes':_0x537f29[_0x1ee9('0x1c')]?_0x537f29[_0x1ee9('0x1c')][_0x1ee9('0x1f')]||null:null,'limit':_0x537f29['options']?_0x537f29[_0x1ee9('0x1c')]['limit']||null:null})['then'](function(_0x2e30a3){logger[_0x1ee9('0x17')](_0x1ee9('0x19'),_0x537f29);logger[_0x1ee9('0x11')](_0x1ee9('0x19'),_0x537f29,JSON[_0x1ee9('0x13')](_0x2e30a3));_0xe24ffb(_0x2e30a3);})[_0x1ee9('0x18')](function(_0x550c5f){logger[_0x1ee9('0x14')](_0x1ee9('0x19'),_0x550c5f['message'],_0x537f29);_0x52b031(_0x3ed47f['error'](0x1f4,_0x550c5f[_0x1ee9('0x16')]));});});};exports[_0x1ee9('0x20')]=function(_0x10d91c){return new Promise(function(_0x41fcda,_0x43e0ac){return db[_0x1ee9('0x21')]['find']({'where':_0x10d91c['options']?_0x10d91c['options'][_0x1ee9('0x1e')]||null:null})[_0x1ee9('0xe')](function(_0x189e22){if(_0x189e22){return _0x189e22[_0x1ee9('0x22')](_0x10d91c['body'][_0x1ee9('0x23')],_[_0x1ee9('0x24')](_0x10d91c[_0x1ee9('0x1b')],[_0x1ee9('0x23'),'id'])||{});}})[_0x1ee9('0x25')](function(_0x19eb80){logger[_0x1ee9('0x17')](_0x1ee9('0x26'),_0x10d91c);logger['debug'](_0x1ee9('0x26'),_0x10d91c,JSON[_0x1ee9('0x13')](_0x19eb80));_0x41fcda(_0x19eb80);})[_0x1ee9('0x18')](function(_0x3d906e){logger[_0x1ee9('0x14')](_0x1ee9('0x26'),_0x3d906e['message'],_0x10d91c);_0x43e0ac(_this[_0x1ee9('0x14')](0x1f4,_0x3d906e[_0x1ee9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6cbdfe4..c7f01b0 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 _0x6cbe=['./faxInteraction.events','save','update','removeListener','register','length','faxInteraction:'];(function(_0x2424c5,_0x3eaec9){var _0x29d608=function(_0x1ebf59){while(--_0x1ebf59){_0x2424c5['push'](_0x2424c5['shift']());}};_0x29d608(++_0x3eaec9);}(_0x6cbe,0x9a));var _0xe6cb=function(_0x46ec78,_0x2642cc){_0x46ec78=_0x46ec78-0x0;var _0x4a622e=_0x6cbe[_0x46ec78];return _0x4a622e;};'use strict';var FaxInteractionEvents=require(_0xe6cb('0x0'));var events=[_0xe6cb('0x1'),'remove',_0xe6cb('0x2')];function createListener(_0x568758,_0x59e6f9){return function(_0x10570e){_0x59e6f9['emit'](_0x568758,_0x10570e);};}function removeListener(_0x1dea32,_0x35b668){return function(){FaxInteractionEvents[_0xe6cb('0x3')](_0x1dea32,_0x35b668);};}exports[_0xe6cb('0x4')]=function(_0x5d7931){for(var _0x59ca5a=0x0,_0xb4d011=events[_0xe6cb('0x5')];_0x59ca5a<_0xb4d011;_0x59ca5a++){var _0x4f76fd=events[_0x59ca5a];var _0xd80c04=createListener(_0xe6cb('0x6')+_0x4f76fd,_0x5d7931);FaxInteractionEvents['on'](_0x4f76fd,_0xd80c04);}}; \ No newline at end of file +var _0x5634=['faxInteraction:','./faxInteraction.events','save','remove','emit','register','length'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x5634,0x112));var _0x4563=function(_0x4e18f1,_0x1e85a6){_0x4e18f1=_0x4e18f1-0x0;var _0x12bde4=_0x5634[_0x4e18f1];return _0x12bde4;};'use strict';var FaxInteractionEvents=require(_0x4563('0x0'));var events=[_0x4563('0x1'),_0x4563('0x2'),'update'];function createListener(_0x1b8eec,_0x5b9699){return function(_0x11b69f){_0x5b9699[_0x4563('0x3')](_0x1b8eec,_0x11b69f);};}function removeListener(_0x4c3183,_0x497a46){return function(){FaxInteractionEvents['removeListener'](_0x4c3183,_0x497a46);};}exports[_0x4563('0x4')]=function(_0xe58192){for(var _0x577ee7=0x0,_0x4b1308=events[_0x4563('0x5')];_0x577ee7<_0x4b1308;_0x577ee7++){var _0x188dd6=events[_0x577ee7];var _0x3dc94d=createListener(_0x4563('0x6')+_0x188dd6,_0xe58192);FaxInteractionEvents['on'](_0x188dd6,_0x3dc94d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 01b18d9..337be53 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 _0x6c69=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x56b4b8,_0x2cf6ba){var _0x33c0c2=function(_0x53c774){while(--_0x53c774){_0x56b4b8['push'](_0x56b4b8['shift']());}};_0x33c0c2(++_0x2cf6ba);}(_0x6c69,0xbc));var _0x96c6=function(_0x566816,_0x73fea5){_0x566816=_0x566816-0x0;var _0x36719c=_0x6c69[_0x566816];return _0x36719c;};'use strict';var multer=require(_0x96c6('0x0'));var util=require(_0x96c6('0x1'));var path=require(_0x96c6('0x2'));var timeout=require(_0x96c6('0x3'));var express=require('express');var router=express[_0x96c6('0x4')]();var fs_extra=require(_0x96c6('0x5'));var auth=require(_0x96c6('0x6'));var interaction=require(_0x96c6('0x7'));var config=require(_0x96c6('0x8'));var controller=require('./faxInteraction.controller');router[_0x96c6('0x9')]('/',auth[_0x96c6('0xa')](),controller[_0x96c6('0xb')]);router['get'](_0x96c6('0xc'),auth[_0x96c6('0xa')](),controller[_0x96c6('0xd')]);router['get'](_0x96c6('0xe'),auth[_0x96c6('0xa')](),controller[_0x96c6('0xf')]);router[_0x96c6('0x9')](_0x96c6('0x10'),auth['isAuthenticated'](),controller[_0x96c6('0x11')]);router['get'](_0x96c6('0x12'),auth[_0x96c6('0xa')](),controller[_0x96c6('0x13')]);router[_0x96c6('0x14')]('/',auth[_0x96c6('0xa')](),controller[_0x96c6('0x15')]);router[_0x96c6('0x14')](_0x96c6('0x10'),auth[_0x96c6('0xa')](),controller[_0x96c6('0x16')]);router['post'](_0x96c6('0x17'),auth[_0x96c6('0xa')](),interaction[_0x96c6('0x18')](_0x96c6('0x19'),_0x96c6('0x1a')),controller[_0x96c6('0x1b')]);router[_0x96c6('0x1c')](_0x96c6('0xe'),auth[_0x96c6('0xa')](),interaction[_0x96c6('0x18')]('fax',_0x96c6('0x1d')),controller['update']);router[_0x96c6('0x1e')](_0x96c6('0xe'),auth[_0x96c6('0xa')](),interaction[_0x96c6('0x18')]('fax',_0x96c6('0x1f')),controller[_0x96c6('0x20')]);router['delete'](_0x96c6('0x17'),auth['isAuthenticated'](),controller[_0x96c6('0x21')]);module['exports']=router; \ No newline at end of file +var _0x0a12=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','/:id/tags','tracked','fax','faxinteraction:addtags','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path'];(function(_0x18df4c,_0x5f3667){var _0x44a246=function(_0x2febaf){while(--_0x2febaf){_0x18df4c['push'](_0x18df4c['shift']());}};_0x44a246(++_0x5f3667);}(_0x0a12,0x1bf));var _0x20a1=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x0a12[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0x20a1('0x0'));var util=require(_0x20a1('0x1'));var path=require(_0x20a1('0x2'));var timeout=require(_0x20a1('0x3'));var express=require(_0x20a1('0x4'));var router=express[_0x20a1('0x5')]();var fs_extra=require(_0x20a1('0x6'));var auth=require(_0x20a1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x20a1('0x8'));var controller=require(_0x20a1('0x9'));router[_0x20a1('0xa')]('/',auth[_0x20a1('0xb')](),controller[_0x20a1('0xc')]);router[_0x20a1('0xa')](_0x20a1('0xd'),auth[_0x20a1('0xb')](),controller['describe']);router[_0x20a1('0xa')](_0x20a1('0xe'),auth[_0x20a1('0xb')](),controller[_0x20a1('0xf')]);router['get'](_0x20a1('0x10'),auth[_0x20a1('0xb')](),controller[_0x20a1('0x11')]);router['get'](_0x20a1('0x12'),auth['isAuthenticated'](),controller[_0x20a1('0x13')]);router[_0x20a1('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x20a1('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0x20a1('0x14')](_0x20a1('0x15'),auth[_0x20a1('0xb')](),interaction[_0x20a1('0x16')](_0x20a1('0x17'),_0x20a1('0x18')),controller['addTags']);router['put']('/:id',auth[_0x20a1('0xb')](),interaction['tracked'](_0x20a1('0x17'),_0x20a1('0x19')),controller['update']);router[_0x20a1('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x20a1('0x17'),_0x20a1('0x1b')),controller[_0x20a1('0x1c')]);router[_0x20a1('0x1a')](_0x20a1('0x15'),auth[_0x20a1('0xb')](),controller[_0x20a1('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 764c155..2efaee8 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 _0xea89=['BOOLEAN','out','sequelize','exports','TEXT','medium'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xea89,0x1e2));var _0x9ea8=function(_0x534a02,_0x288eef){_0x534a02=_0x534a02-0x0;var _0x30f7c1=_0xea89[_0x534a02];return _0x30f7c1;};'use strict';var Sequelize=require(_0x9ea8('0x0'));module[_0x9ea8('0x1')]={'body':{'type':Sequelize[_0x9ea8('0x2')](_0x9ea8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9ea8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9ea8('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9ea8('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb377=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize','exports'];(function(_0x166acc,_0x111e4e){var _0x209f4d=function(_0x354b62){while(--_0x354b62){_0x166acc['push'](_0x166acc['shift']());}};_0x209f4d(++_0x111e4e);}(_0xb377,0x1b6));var _0x7b37=function(_0x44aebf,_0x27d698){_0x44aebf=_0x44aebf-0x0;var _0x166696=_0xb377[_0x44aebf];return _0x166696;};'use strict';var Sequelize=require(_0x7b37('0x0'));module[_0x7b37('0x1')]={'body':{'type':Sequelize[_0x7b37('0x2')](_0x7b37('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7b37('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7b37('0x5')]('in',_0x7b37('0x6')),'defaultValue':_0x7b37('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7b37('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7b37('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c5f5306..3ea577b 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 _0x1e98=['params','length','options','find','body','destroy','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','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','rejectmessage','create','findOne','isNil','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','root','files','attachments','basename','eml-format','zip-dir','request-promise','moment','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','index','map','FaxMessage','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1e98,0x1ee));var _0x81e9=function(_0x2abffd,_0x760487){_0x2abffd=_0x2abffd-0x0;var _0xe147d4=_0x1e98[_0x2abffd];return _0xe147d4;};'use strict';var emlformat=require(_0x81e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x81e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81e9('0x2'));var moment=require(_0x81e9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81e9('0x4'));var path=require('path');var sox=require(_0x81e9('0x5'));var csv=require(_0x81e9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x81e9('0x7'));var crypto=require(_0x81e9('0x8'));var jsforce=require(_0x81e9('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x81e9('0x6'));var querystring=require(_0x81e9('0xa'));var Papa=require(_0x81e9('0xb'));var Redis=require('ioredis');var authService=require(_0x81e9('0xc'));var qs=require(_0x81e9('0xd'));var as=require(_0x81e9('0xe'));var hardwareService=require(_0x81e9('0xf'));var logger=require(_0x81e9('0x10'))(_0x81e9('0x11'));var utils=require(_0x81e9('0x12'));var config=require(_0x81e9('0x13'));var licenseUtil=require(_0x81e9('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x81e9('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x81e9('0x16'))(new Redis(config[_0x81e9('0x15')]));require(_0x81e9('0x17'))[_0x81e9('0x18')](socket);var jayson=require(_0x81e9('0x19'));var client=jayson[_0x81e9('0x1a')][_0x81e9('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x548578,_0x5232e4,_0x30754f,_0x441eda){return new BPromise(function(_0x4a988d,_0x3910f7){var _0x4f5b03=_0x441eda||client;return _0x4f5b03[_0x81e9('0x1c')](_0x548578,_0x30754f)['then'](function(_0xe449c4){logger['info'](_0x81e9('0x1d'),_0x5232e4,_0x81e9('0x1e'));logger[_0x81e9('0x1f')](_0x81e9('0x20'),_0x5232e4,_0x81e9('0x1e'),JSON[_0x81e9('0x21')](_0xe449c4));if(_0xe449c4[_0x81e9('0x22')]){if(_0xe449c4[_0x81e9('0x22')][_0x81e9('0x23')]===0x1f4){logger[_0x81e9('0x22')](_0x81e9('0x1d'),_0x5232e4,_0xe449c4['error']['message']);return _0x3910f7(_0xe449c4[_0x81e9('0x22')][_0x81e9('0x24')]);}logger[_0x81e9('0x22')](_0x81e9('0x1d'),_0x5232e4,_0xe449c4[_0x81e9('0x22')][_0x81e9('0x24')]);return _0x4a988d(_0xe449c4['error'][_0x81e9('0x24')]);}else{logger[_0x81e9('0x25')]('FaxMessage,\x20%s,\x20%s',_0x5232e4,_0x81e9('0x1e'));_0x4a988d(_0xe449c4[_0x81e9('0x26')][_0x81e9('0x24')]);}})['catch'](function(_0x4010a4){logger[_0x81e9('0x22')](_0x81e9('0x1d'),_0x5232e4,_0x4010a4);_0x3910f7(_0x4010a4);});});}function respondWithStatusCode(_0x521dff,_0x18527e){_0x18527e=_0x18527e||0xcc;return function(_0x1598a1){if(_0x1598a1){return _0x521dff['sendStatus'](_0x18527e);}return _0x521dff[_0x81e9('0x27')](_0x18527e)['end']();};}function respondWithResult(_0x3cebd9,_0xd838af){_0xd838af=_0xd838af||0xc8;return function(_0x561f93){if(_0x561f93){return _0x3cebd9[_0x81e9('0x27')](_0xd838af)[_0x81e9('0x28')](_0x561f93);}};}function respondWithFilteredResult(_0x5632e6,_0x51fb6b){return function(_0x5686c6){if(_0x5686c6){var _0x460a99=typeof _0x51fb6b[_0x81e9('0x29')]==='undefined'&&typeof _0x51fb6b['limit']===_0x81e9('0x2a');var _0x12de6e=_0x5686c6[_0x81e9('0x2b')];var _0x17180b=_0x460a99?0x0:_0x51fb6b[_0x81e9('0x29')];var _0x18a821=_0x460a99?_0x5686c6[_0x81e9('0x2b')]:_0x51fb6b[_0x81e9('0x29')]+_0x51fb6b[_0x81e9('0x2c')];var _0x211a53;if(_0x18a821>=_0x12de6e){_0x18a821=_0x12de6e;_0x211a53=0xc8;}else{_0x211a53=0xce;}_0x5632e6[_0x81e9('0x27')](_0x211a53);return _0x5632e6[_0x81e9('0x2d')](_0x81e9('0x2e'),_0x17180b+'-'+_0x18a821+'/'+_0x12de6e)[_0x81e9('0x28')](_0x5686c6);}return null;};}function patchUpdates(_0x2becf2){return function(_0x3028e8){try{jsonpatch[_0x81e9('0x2f')](_0x3028e8,_0x2becf2,!![]);}catch(_0x28964d){return BPromise[_0x81e9('0x30')](_0x28964d);}return _0x3028e8[_0x81e9('0x31')]();};}function saveUpdates(_0x5d1b9c,_0x13ac18){return function(_0x2ec2c0){if(_0x2ec2c0){return _0x2ec2c0[_0x81e9('0x32')](_0x5d1b9c)[_0x81e9('0x33')](function(_0x236de0){return _0x236de0;});}return null;};}function removeEntity(_0x52e069,_0x3dc109){return function(_0x5da1a9){if(_0x5da1a9){return _0x5da1a9['destroy']()[_0x81e9('0x33')](function(){_0x52e069[_0x81e9('0x27')](0xcc)[_0x81e9('0x34')]();});}};}function handleEntityNotFound(_0xe991f0,_0x504d41){return function(_0x475d4d){if(!_0x475d4d){_0xe991f0[_0x81e9('0x35')](0x194);}return _0x475d4d;};}function handleError(_0x2b7d21,_0x1ede71){_0x1ede71=_0x1ede71||0x1f4;return function(_0x290fc5){logger[_0x81e9('0x22')](_0x290fc5[_0x81e9('0x36')]);if(_0x290fc5[_0x81e9('0x37')]){delete _0x290fc5[_0x81e9('0x37')];}_0x2b7d21[_0x81e9('0x27')](_0x1ede71)['send'](_0x290fc5);};}exports[_0x81e9('0x38')]=function(_0x55e9fa,_0x51d887){var _0x520041={},_0x511bf3={},_0x541cfd={'count':0x0,'rows':[]};var _0x680c6d=_[_0x81e9('0x39')](db[_0x81e9('0x3a')]['rawAttributes'],function(_0x2adabb){return{'name':_0x2adabb[_0x81e9('0x3b')],'type':_0x2adabb[_0x81e9('0x3c')][_0x81e9('0x3d')]};});_0x511bf3['model']=_[_0x81e9('0x39')](_0x680c6d,_0x81e9('0x37'));_0x511bf3[_0x81e9('0x3e')]=_[_0x81e9('0x3f')](_0x55e9fa[_0x81e9('0x3e')]);_0x511bf3['filters']=_[_0x81e9('0x40')](_0x511bf3[_0x81e9('0x41')],_0x511bf3['query']);_0x520041[_0x81e9('0x42')]=_['intersection'](_0x511bf3[_0x81e9('0x41')],qs[_0x81e9('0x43')](_0x55e9fa['query'][_0x81e9('0x43')]));_0x520041[_0x81e9('0x42')]=_0x520041[_0x81e9('0x42')]['length']?_0x520041[_0x81e9('0x42')]:_0x511bf3[_0x81e9('0x41')];if(!_0x55e9fa[_0x81e9('0x3e')][_0x81e9('0x44')]('nolimit')){_0x520041[_0x81e9('0x2c')]=qs['limit'](_0x55e9fa[_0x81e9('0x3e')][_0x81e9('0x2c')]);_0x520041[_0x81e9('0x29')]=qs[_0x81e9('0x29')](_0x55e9fa[_0x81e9('0x3e')]['offset']);}_0x520041[_0x81e9('0x45')]=qs[_0x81e9('0x46')](_0x55e9fa[_0x81e9('0x3e')][_0x81e9('0x46')]);_0x520041['where']=qs['filters'](_['pick'](_0x55e9fa[_0x81e9('0x3e')],_0x511bf3[_0x81e9('0x47')]),_0x680c6d);if(_0x55e9fa['query'][_0x81e9('0x48')]){_0x520041[_0x81e9('0x49')]=_[_0x81e9('0x4a')](_0x520041[_0x81e9('0x49')],{'$or':_[_0x81e9('0x39')](_0x680c6d,function(_0x1bf07d){if(_0x1bf07d['type']!==_0x81e9('0x4b')){var _0x79bb9c={};_0x79bb9c[_0x1bf07d[_0x81e9('0x37')]]={'$like':'%'+_0x55e9fa[_0x81e9('0x3e')][_0x81e9('0x48')]+'%'};return _0x79bb9c;}})});}_0x520041=_[_0x81e9('0x4a')]({},_0x520041,_0x55e9fa['options']);var _0x47e163={'where':_0x520041[_0x81e9('0x49')]};return db[_0x81e9('0x3a')][_0x81e9('0x2b')](_0x47e163)[_0x81e9('0x33')](function(_0x17e51b){_0x541cfd[_0x81e9('0x2b')]=_0x17e51b;if(_0x55e9fa[_0x81e9('0x3e')][_0x81e9('0x4c')]){_0x520041[_0x81e9('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0x81e9('0x4e')](_0x520041);})[_0x81e9('0x33')](function(_0x24da4d){_0x541cfd[_0x81e9('0x4f')]=_0x24da4d;return _0x541cfd;})[_0x81e9('0x33')](respondWithFilteredResult(_0x51d887,_0x520041))[_0x81e9('0x50')](handleError(_0x51d887,null));};exports[_0x81e9('0x51')]=function(_0x23cee7,_0x1e91c1){var _0xf3c4e9={'raw':!![],'where':{'id':_0x23cee7[_0x81e9('0x52')]['id']}},_0xdb2b26={};_0xdb2b26['model']=_[_0x81e9('0x3f')](db[_0x81e9('0x3a')]['rawAttributes']);_0xdb2b26['query']=_[_0x81e9('0x3f')](_0x23cee7[_0x81e9('0x3e')]);_0xdb2b26[_0x81e9('0x47')]=_['intersection'](_0xdb2b26[_0x81e9('0x41')],_0xdb2b26[_0x81e9('0x3e')]);_0xf3c4e9[_0x81e9('0x42')]=_[_0x81e9('0x40')](_0xdb2b26[_0x81e9('0x41')],qs['fields'](_0x23cee7[_0x81e9('0x3e')][_0x81e9('0x43')]));_0xf3c4e9['attributes']=_0xf3c4e9['attributes'][_0x81e9('0x53')]?_0xf3c4e9[_0x81e9('0x42')]:_0xdb2b26[_0x81e9('0x41')];if(_0x23cee7[_0x81e9('0x3e')]['includeAll']){_0xf3c4e9[_0x81e9('0x4d')]=[{'all':!![]}];}_0xf3c4e9=_[_0x81e9('0x4a')]({},_0xf3c4e9,_0x23cee7[_0x81e9('0x54')]);return db['FaxMessage'][_0x81e9('0x55')](_0xf3c4e9)[_0x81e9('0x33')](handleEntityNotFound(_0x1e91c1,null))[_0x81e9('0x33')](respondWithResult(_0x1e91c1,null))[_0x81e9('0x50')](handleError(_0x1e91c1,null));};exports[_0x81e9('0x32')]=function(_0xddc8ed,_0x43e275){if(_0xddc8ed[_0x81e9('0x56')]['id']){delete _0xddc8ed[_0x81e9('0x56')]['id'];}return db[_0x81e9('0x3a')]['find']({'where':{'id':_0xddc8ed[_0x81e9('0x52')]['id']}})[_0x81e9('0x33')](handleEntityNotFound(_0x43e275,null))['then'](saveUpdates(_0xddc8ed[_0x81e9('0x56')],null))[_0x81e9('0x33')](respondWithResult(_0x43e275,null))[_0x81e9('0x50')](handleError(_0x43e275,null));};exports[_0x81e9('0x57')]=function(_0xb57936,_0x42fbf2){return db[_0x81e9('0x3a')][_0x81e9('0x55')]({'where':{'id':_0xb57936[_0x81e9('0x52')]['id']}})['then'](handleEntityNotFound(_0x42fbf2,null))['then'](removeEntity(_0x42fbf2,null))[_0x81e9('0x50')](handleError(_0x42fbf2,null));};exports[_0x81e9('0x58')]=function(_0x4d5158,_0x4428db){return db[_0x81e9('0x3a')][_0x81e9('0x58')]()[_0x81e9('0x33')](respondWithResult(_0x4428db,null))[_0x81e9('0x50')](handleError(_0x4428db,null));};var interaction_log=require(_0x81e9('0x10'))(_0x81e9('0x59'));exports[_0x81e9('0x5a')]=function(_0x4e986b,_0xe808bf,_0x56e24c){var _0x10eaed={'agent':{},'channel':_0x81e9('0x5b')};if(_0x4e986b[_0x81e9('0x56')]['id']){delete _0x4e986b['body']['id'];}_0x4e986b[_0x81e9('0x56')][_0x81e9('0x5c')]=!![];_0x4e986b[_0x81e9('0x56')][_0x81e9('0x5d')]=moment()[_0x81e9('0x5e')](_0x81e9('0x5f'));_0x4e986b[_0x81e9('0x56')][_0x81e9('0x60')]=_0x4e986b['body']['UserId']||_0x4e986b['user']['id'];_0x10eaed[_0x81e9('0x61')]['id']=_0x4e986b[_0x81e9('0x56')][_0x81e9('0x60')];return db[_0x81e9('0x3a')][_0x81e9('0x55')]({'where':{'id':_0x4e986b[_0x81e9('0x52')]['id'],'UserId':null}})[_0x81e9('0x33')](handleEntityNotFound(_0xe808bf,null))['then'](saveUpdates(_0x4e986b['body'],null))['then'](function(_0xadb2e6){if(_0xadb2e6){_0x10eaed[_0x81e9('0x24')]=_0xadb2e6[_0x81e9('0x62')]({'plain':!![]});return db[_0x81e9('0x63')][_0x81e9('0x55')]({'where':{'id':_0xadb2e6[_0x81e9('0x64')]}});}return null;})[_0x81e9('0x33')](handleEntityNotFound(_0xe808bf,null))[_0x81e9('0x33')](function(_0x33d4c5){if(_0x33d4c5){return _0x33d4c5[_0x81e9('0x32')]({'UserId':_0x4e986b[_0x81e9('0x56')][_0x81e9('0x60')],'read1stAt':_['isNil'](_0x33d4c5[_0x81e9('0x65')])?moment()[_0x81e9('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x81e9('0x33')](function(_0x36c631){if(_0x36c631){_0x10eaed['interaction']=_0x36c631['get']({'plain':!![]});interaction_log[_0x81e9('0x25')](_0x81e9('0x66'),_0x4e986b['user']['id'],_0x4e986b[_0x81e9('0x67')][_0x81e9('0x37')],_0x4e986b[_0x81e9('0x67')][_0x81e9('0x68')],_0x10eaed['interaction']['id'],_0x4e986b[_0x81e9('0x56')]?JSON['stringify'](_0x4e986b[_0x81e9('0x56')]):_0x81e9('0x69'));return respondWithRpcPromise(_0x81e9('0x6a'),_0x81e9('0x6b'),_0x10eaed);}return null;})[_0x81e9('0x33')](function(_0x3e2dbf){var _0x12f602='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3e2dbf[_0x81e9('0x24')][_0x81e9('0x6c')];return db[_0x81e9('0x6d')]['query'](_0x12f602,{'type':db[_0x81e9('0x6e')][_0x81e9('0x6f')][_0x81e9('0x70')],'raw':!![]})[_0x81e9('0x33')](function(_0x4dae52){return _0x4dae52;});})['then'](function(_0x44cb3d){if(_0x44cb3d){_0x10eaed[_0x81e9('0x24')][_0x81e9('0x71')]=_0x44cb3d[0x0];if(!_0x4e986b[_0x81e9('0x56')][_0x81e9('0x60')])return;return db[_0x81e9('0x72')][_0x81e9('0x55')]({'where':{'id':_0x4e986b[_0x81e9('0x56')][_0x81e9('0x60')],'role':'agent'},'attributes':['id',_0x81e9('0x37'),_0x81e9('0x73'),_0x81e9('0x74'),_0x81e9('0x75')],'raw':!![]});}return null;})[_0x81e9('0x33')](function(_0x5a353f){if(!_0x5a353f)return null;_0x10eaed[_0x81e9('0x24')][_0x81e9('0x61')]=_0x5a353f;return _0x10eaed;})[_0x81e9('0x33')](function(_0x4bd7fb){if(_0x4bd7fb){if(_0x4e986b[_0x81e9('0x56')][_0x81e9('0x76')]){_0x10eaed[_0x81e9('0x24')][_0x81e9('0x77')]=util[_0x81e9('0x5e')](_0x81e9('0x78'),_0x4e986b['user'][_0x81e9('0x37')]);_0x10eaed[_0x81e9('0x24')][_0x81e9('0x79')]=_0x10eaed[_0x81e9('0x79')];_0x10eaed[_0x81e9('0x24')][_0x81e9('0x7a')]=_0x10eaed['channel'];_0x10eaed[_0x81e9('0x24')][_0x81e9('0x7b')]=_0x81e9('0x5a');return respondWithRpcPromise(_0x81e9('0x7c'),_0x81e9('0x7c'),{'event':_0x81e9('0x7d'),'message':_0x10eaed[_0x81e9('0x24')]},client9002)[_0x81e9('0x33')](function(){return _0x10eaed;});}return _0x10eaed;}return null;})[_0x81e9('0x33')](respondWithResult(_0xe808bf,null))[_0x81e9('0x50')](handleError(_0xe808bf,null));};var interaction_log=require('../../config/logger')(_0x81e9('0x59'));exports[_0x81e9('0x30')]=function(_0xe8aace,_0x29135e,_0x4862f3){var _0x53395b={'agent':{},'channel':'fax'};if(_0xe8aace[_0x81e9('0x56')]['id']){delete _0xe8aace[_0x81e9('0x56')]['id'];}_0xe8aace[_0x81e9('0x56')][_0x81e9('0x60')]=_0xe8aace['body']['UserId']||_0xe8aace[_0x81e9('0x67')]['id'];_0x53395b[_0x81e9('0x61')]['id']=_0xe8aace[_0x81e9('0x56')][_0x81e9('0x60')];return db['FaxMessage']['find']({'where':{'id':_0xe8aace['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x29135e,null))[_0x81e9('0x33')](function(_0x4fb510){if(_0x4fb510){_0x53395b['message']=_0x4fb510[_0x81e9('0x62')]({'plain':!![]});return db[_0x81e9('0x63')][_0x81e9('0x55')]({'where':{'id':_0x4fb510[_0x81e9('0x64')]}});}return null;})[_0x81e9('0x33')](handleEntityNotFound(_0x29135e,null))['then'](function(_0x35f38c){if(_0x35f38c){_0x53395b['interaction']=_0x35f38c[_0x81e9('0x62')]({'plain':!![]});interaction_log[_0x81e9('0x25')](_0x81e9('0x7e'),_0xe8aace['user']['id'],_0xe8aace[_0x81e9('0x67')][_0x81e9('0x37')],_0xe8aace['user'][_0x81e9('0x68')],_0x53395b['interaction']['id'],_0xe8aace['body']?JSON[_0x81e9('0x21')](_0xe8aace[_0x81e9('0x56')]):_0x81e9('0x69'));return respondWithRpcPromise(_0x81e9('0x7f'),_0x81e9('0x80'),_0x53395b);}return null;})[_0x81e9('0x33')](function(_0xfa1efd){var _0x24d5c9=_0x81e9('0x81')+_0xfa1efd[_0x81e9('0x24')][_0x81e9('0x6c')];return db[_0x81e9('0x6d')][_0x81e9('0x3e')](_0x24d5c9,{'type':db[_0x81e9('0x6e')]['QueryTypes'][_0x81e9('0x70')],'raw':!![]})[_0x81e9('0x33')](function(_0x20fbed){return _0x20fbed;});})[_0x81e9('0x33')](function(_0xa5b9dd){if(_0xa5b9dd){_0x53395b[_0x81e9('0x24')][_0x81e9('0x71')]=_0xa5b9dd[0x0];if(!_0xe8aace['body']['UserId'])return;return db[_0x81e9('0x72')][_0x81e9('0x55')]({'where':{'id':_0xe8aace[_0x81e9('0x56')][_0x81e9('0x60')],'role':_0x81e9('0x61')},'attributes':['id',_0x81e9('0x37'),_0x81e9('0x73'),'email',_0x81e9('0x75')],'raw':!![]});}return null;})[_0x81e9('0x33')](function(_0x17973e){if(!_0x17973e)return null;_0x53395b['message'][_0x81e9('0x61')]=_0x17973e;return _0x53395b;})[_0x81e9('0x33')](function(_0x320fdf){if(_0x320fdf){_0x320fdf[_0x81e9('0x24')][_0x81e9('0x77')]=util['format']('SIP/%s',_0xe8aace[_0x81e9('0x67')]['name']);_0x320fdf[_0x81e9('0x24')][_0x81e9('0x79')]=_0x53395b[_0x81e9('0x79')];_0x320fdf[_0x81e9('0x24')][_0x81e9('0x7a')]=_0x53395b[_0x81e9('0x79')];_0x320fdf[_0x81e9('0x24')][_0x81e9('0x7b')]=_0x81e9('0x30');respondWithRpcPromise('EventManager',_0x81e9('0x7c'),{'event':_0x81e9('0x82'),'message':_0x320fdf[_0x81e9('0x24')]},client9002);return _0x53395b;}return null;})[_0x81e9('0x33')](respondWithResult(_0x29135e,null))[_0x81e9('0x50')](handleError(_0x29135e,null));};exports[_0x81e9('0x83')]=function(_0x4b5a05,_0x1dbd1d){var _0x242f92;return db[_0x81e9('0x3a')][_0x81e9('0x83')](_0x4b5a05[_0x81e9('0x56')],{})[_0x81e9('0x33')](function(_0x56e90b){_0x242f92=_0x56e90b;return db['CmContact'][_0x81e9('0x84')]({'where':{'id':_0x242f92[_0x81e9('0x6c')]}});})[_0x81e9('0x33')](function(_0x1563ac){if(_[_0x81e9('0x85')](_0x1563ac)){return;}else{_0x242f92[_0x81e9('0x5b')]=_0x1563ac[_0x81e9('0x5b')];return db[_0x81e9('0x86')][_0x81e9('0x84')]({'where':{'id':_0x242f92[_0x81e9('0x87')]}});}})[_0x81e9('0x33')](function(_0x77b4e7){return respondWithRpcPromise(_0x81e9('0x88'),_0x81e9('0x88'),{'FaxAccountId':_['isNil'](_0x4b5a05[_0x81e9('0x56')])?undefined:_0x4b5a05['body']['FaxAccountId'],'path':_['isNil'](_0x77b4e7)?undefined:util['format'](_0x81e9('0x89'),_0x77b4e7['basename']),'fax':_[_0x81e9('0x85')](_0x242f92['fax'])?undefined:_0x242f92['fax'],'AttachmentId':_0x242f92['AttachmentId']},client9002);})[_0x81e9('0x33')](respondWithResult(_0x1dbd1d,0xc9))[_0x81e9('0x50')](handleError(_0x1dbd1d,null));};exports[_0x81e9('0x8a')]=function(_0x554ca2,_0x4898bb){var _0x36737e=path[_0x81e9('0x8b')](config[_0x81e9('0x8c')],'server',_0x81e9('0x8d'),_0x81e9('0x8e'));return db[_0x81e9('0x3a')][_0x81e9('0x55')]({'where':{'id':_0x554ca2[_0x81e9('0x52')]['id']},'include':[{'model':db[_0x81e9('0x86')],'as':_0x81e9('0x86')}]})[_0x81e9('0x33')](handleEntityNotFound(_0x4898bb,null))['then'](function(_0x207cd5){if(_0x207cd5){return _0x4898bb[_0x81e9('0x8a')](path[_0x81e9('0x8b')](_0x36737e,_0x207cd5[_0x81e9('0x86')][_0x81e9('0x8f')]));}})[_0x81e9('0x50')](handleError(_0x4898bb,null));}; \ No newline at end of file +var _0xebe3=['role','rejectMessage','sequelize','Sequelize','rejectmessage','create','CmContact','Attachment','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','root','files','download','join','basename','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','sendStatus','stack','send','index','map','FaxMessage','fieldName','type','key','model','name','keys','query','filters','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','rawAttributes','intersection','include','find','body','params','describe','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xebe3,0xa2));var _0x3ebe=function(_0x1bdeb9,_0x5cb3a9){_0x1bdeb9=_0x1bdeb9-0x0;var _0x874754=_0xebe3[_0x1bdeb9];return _0x874754;};'use strict';var emlformat=require(_0x3ebe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3ebe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ebe('0x2'));var moment=require(_0x3ebe('0x3'));var BPromise=require(_0x3ebe('0x4'));var Mustache=require('mustache');var util=require(_0x3ebe('0x5'));var path=require(_0x3ebe('0x6'));var sox=require(_0x3ebe('0x7'));var csv=require(_0x3ebe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ebe('0x9'));var squel=require(_0x3ebe('0xa'));var crypto=require(_0x3ebe('0xb'));var jsforce=require(_0x3ebe('0xc'));var deskjs=require(_0x3ebe('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3ebe('0xe'));var Papa=require('papaparse');var Redis=require(_0x3ebe('0xf'));var authService=require(_0x3ebe('0x10'));var qs=require(_0x3ebe('0x11'));var as=require(_0x3ebe('0x12'));var hardwareService=require(_0x3ebe('0x13'));var logger=require(_0x3ebe('0x14'))('api');var utils=require(_0x3ebe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3ebe('0x16'));var db=require(_0x3ebe('0x17'))['db'];config['redis']=_[_0x3ebe('0x18')](config[_0x3ebe('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3ebe('0x1a'))(new Redis(config[_0x3ebe('0x19')]));require(_0x3ebe('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3ebe('0x1c')][_0x3ebe('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x482351,_0x18ab1d,_0x5ec84b,_0x3dff0b){return new BPromise(function(_0xe74edd,_0x8902ed){var _0x4c0ddb=_0x3dff0b||client;return _0x4c0ddb[_0x3ebe('0x1e')](_0x482351,_0x5ec84b)[_0x3ebe('0x1f')](function(_0x3e03b7){logger[_0x3ebe('0x20')](_0x3ebe('0x21'),_0x18ab1d,_0x3ebe('0x22'));logger[_0x3ebe('0x23')](_0x3ebe('0x24'),_0x18ab1d,_0x3ebe('0x22'),JSON[_0x3ebe('0x25')](_0x3e03b7));if(_0x3e03b7[_0x3ebe('0x26')]){if(_0x3e03b7[_0x3ebe('0x26')][_0x3ebe('0x27')]===0x1f4){logger[_0x3ebe('0x26')](_0x3ebe('0x21'),_0x18ab1d,_0x3e03b7['error'][_0x3ebe('0x28')]);return _0x8902ed(_0x3e03b7[_0x3ebe('0x26')][_0x3ebe('0x28')]);}logger[_0x3ebe('0x26')]('FaxMessage,\x20%s,\x20%s',_0x18ab1d,_0x3e03b7[_0x3ebe('0x26')][_0x3ebe('0x28')]);return _0xe74edd(_0x3e03b7[_0x3ebe('0x26')][_0x3ebe('0x28')]);}else{logger[_0x3ebe('0x20')](_0x3ebe('0x21'),_0x18ab1d,'request\x20sent');_0xe74edd(_0x3e03b7[_0x3ebe('0x29')]['message']);}})[_0x3ebe('0x2a')](function(_0x121eed){logger[_0x3ebe('0x26')](_0x3ebe('0x21'),_0x18ab1d,_0x121eed);_0x8902ed(_0x121eed);});});}function respondWithStatusCode(_0x594c52,_0x5d4f33){_0x5d4f33=_0x5d4f33||0xcc;return function(_0x387dc7){if(_0x387dc7){return _0x594c52['sendStatus'](_0x5d4f33);}return _0x594c52[_0x3ebe('0x2b')](_0x5d4f33)[_0x3ebe('0x2c')]();};}function respondWithResult(_0x38e828,_0x4b8007){_0x4b8007=_0x4b8007||0xc8;return function(_0x3b23d7){if(_0x3b23d7){return _0x38e828[_0x3ebe('0x2b')](_0x4b8007)[_0x3ebe('0x2d')](_0x3b23d7);}};}function respondWithFilteredResult(_0x415c26,_0x4208aa){return function(_0x4b1fc6){if(_0x4b1fc6){var _0x4b1f8b=typeof _0x4208aa[_0x3ebe('0x2e')]===_0x3ebe('0x2f')&&typeof _0x4208aa['limit']==='undefined';var _0x5bb6fb=_0x4b1fc6['count'];var _0x19018a=_0x4b1f8b?0x0:_0x4208aa['offset'];var _0xcf9acd=_0x4b1f8b?_0x4b1fc6[_0x3ebe('0x30')]:_0x4208aa['offset']+_0x4208aa[_0x3ebe('0x31')];var _0x48b577;if(_0xcf9acd>=_0x5bb6fb){_0xcf9acd=_0x5bb6fb;_0x48b577=0xc8;}else{_0x48b577=0xce;}_0x415c26[_0x3ebe('0x2b')](_0x48b577);return _0x415c26[_0x3ebe('0x32')](_0x3ebe('0x33'),_0x19018a+'-'+_0xcf9acd+'/'+_0x5bb6fb)[_0x3ebe('0x2d')](_0x4b1fc6);}return null;};}function patchUpdates(_0xb55fce){return function(_0x5a39e2){try{jsonpatch[_0x3ebe('0x34')](_0x5a39e2,_0xb55fce,!![]);}catch(_0x2cacb0){return BPromise['reject'](_0x2cacb0);}return _0x5a39e2[_0x3ebe('0x35')]();};}function saveUpdates(_0x39f4ef,_0x411675){return function(_0x4e5149){if(_0x4e5149){return _0x4e5149[_0x3ebe('0x36')](_0x39f4ef)[_0x3ebe('0x1f')](function(_0x28755f){return _0x28755f;});}return null;};}function removeEntity(_0x13962c,_0x4daaa1){return function(_0x37b11f){if(_0x37b11f){return _0x37b11f[_0x3ebe('0x37')]()[_0x3ebe('0x1f')](function(){_0x13962c[_0x3ebe('0x2b')](0xcc)[_0x3ebe('0x2c')]();});}};}function handleEntityNotFound(_0x483178,_0x11b77c){return function(_0x2d5457){if(!_0x2d5457){_0x483178[_0x3ebe('0x38')](0x194);}return _0x2d5457;};}function handleError(_0x2ea064,_0x5e370f){_0x5e370f=_0x5e370f||0x1f4;return function(_0x53bf59){logger['error'](_0x53bf59[_0x3ebe('0x39')]);if(_0x53bf59['name']){delete _0x53bf59['name'];}_0x2ea064['status'](_0x5e370f)[_0x3ebe('0x3a')](_0x53bf59);};}exports[_0x3ebe('0x3b')]=function(_0x29c1a1,_0xff4e67){var _0x1eec97={},_0x427dd5={},_0x30a2c7={'count':0x0,'rows':[]};var _0xa0bdc8=_[_0x3ebe('0x3c')](db[_0x3ebe('0x3d')]['rawAttributes'],function(_0x56f84a){return{'name':_0x56f84a[_0x3ebe('0x3e')],'type':_0x56f84a[_0x3ebe('0x3f')][_0x3ebe('0x40')]};});_0x427dd5[_0x3ebe('0x41')]=_[_0x3ebe('0x3c')](_0xa0bdc8,_0x3ebe('0x42'));_0x427dd5['query']=_[_0x3ebe('0x43')](_0x29c1a1[_0x3ebe('0x44')]);_0x427dd5[_0x3ebe('0x45')]=_['intersection'](_0x427dd5['model'],_0x427dd5['query']);_0x1eec97[_0x3ebe('0x46')]=_['intersection'](_0x427dd5['model'],qs['fields'](_0x29c1a1['query'][_0x3ebe('0x47')]));_0x1eec97['attributes']=_0x1eec97[_0x3ebe('0x46')][_0x3ebe('0x48')]?_0x1eec97[_0x3ebe('0x46')]:_0x427dd5[_0x3ebe('0x41')];if(!_0x29c1a1[_0x3ebe('0x44')]['hasOwnProperty'](_0x3ebe('0x49'))){_0x1eec97[_0x3ebe('0x31')]=qs[_0x3ebe('0x31')](_0x29c1a1[_0x3ebe('0x44')]['limit']);_0x1eec97[_0x3ebe('0x2e')]=qs[_0x3ebe('0x2e')](_0x29c1a1[_0x3ebe('0x44')][_0x3ebe('0x2e')]);}_0x1eec97[_0x3ebe('0x4a')]=qs[_0x3ebe('0x4b')](_0x29c1a1[_0x3ebe('0x44')][_0x3ebe('0x4b')]);_0x1eec97['where']=qs['filters'](_['pick'](_0x29c1a1['query'],_0x427dd5['filters']),_0xa0bdc8);if(_0x29c1a1[_0x3ebe('0x44')][_0x3ebe('0x4c')]){_0x1eec97[_0x3ebe('0x4d')]=_[_0x3ebe('0x4e')](_0x1eec97[_0x3ebe('0x4d')],{'$or':_[_0x3ebe('0x3c')](_0xa0bdc8,function(_0x58e88e){if(_0x58e88e[_0x3ebe('0x3f')]!==_0x3ebe('0x4f')){var _0x572404={};_0x572404[_0x58e88e[_0x3ebe('0x42')]]={'$like':'%'+_0x29c1a1[_0x3ebe('0x44')]['filter']+'%'};return _0x572404;}})});}_0x1eec97=_[_0x3ebe('0x4e')]({},_0x1eec97,_0x29c1a1[_0x3ebe('0x50')]);var _0x27d41e={'where':_0x1eec97[_0x3ebe('0x4d')]};return db[_0x3ebe('0x3d')]['count'](_0x27d41e)[_0x3ebe('0x1f')](function(_0x3164d6){_0x30a2c7[_0x3ebe('0x30')]=_0x3164d6;if(_0x29c1a1[_0x3ebe('0x44')][_0x3ebe('0x51')]){_0x1eec97['include']=[{'all':!![]}];}return db[_0x3ebe('0x3d')][_0x3ebe('0x52')](_0x1eec97);})[_0x3ebe('0x1f')](function(_0x1266a5){_0x30a2c7['rows']=_0x1266a5;return _0x30a2c7;})['then'](respondWithFilteredResult(_0xff4e67,_0x1eec97))[_0x3ebe('0x2a')](handleError(_0xff4e67,null));};exports[_0x3ebe('0x53')]=function(_0x40fdaf,_0x2497b1){var _0x2c37f8={'raw':!![],'where':{'id':_0x40fdaf['params']['id']}},_0x14521c={};_0x14521c['model']=_[_0x3ebe('0x43')](db[_0x3ebe('0x3d')][_0x3ebe('0x54')]);_0x14521c[_0x3ebe('0x44')]=_[_0x3ebe('0x43')](_0x40fdaf[_0x3ebe('0x44')]);_0x14521c[_0x3ebe('0x45')]=_['intersection'](_0x14521c[_0x3ebe('0x41')],_0x14521c[_0x3ebe('0x44')]);_0x2c37f8[_0x3ebe('0x46')]=_[_0x3ebe('0x55')](_0x14521c[_0x3ebe('0x41')],qs[_0x3ebe('0x47')](_0x40fdaf['query'][_0x3ebe('0x47')]));_0x2c37f8[_0x3ebe('0x46')]=_0x2c37f8['attributes'][_0x3ebe('0x48')]?_0x2c37f8[_0x3ebe('0x46')]:_0x14521c[_0x3ebe('0x41')];if(_0x40fdaf[_0x3ebe('0x44')][_0x3ebe('0x51')]){_0x2c37f8[_0x3ebe('0x56')]=[{'all':!![]}];}_0x2c37f8=_[_0x3ebe('0x4e')]({},_0x2c37f8,_0x40fdaf[_0x3ebe('0x50')]);return db[_0x3ebe('0x3d')][_0x3ebe('0x57')](_0x2c37f8)[_0x3ebe('0x1f')](handleEntityNotFound(_0x2497b1,null))[_0x3ebe('0x1f')](respondWithResult(_0x2497b1,null))[_0x3ebe('0x2a')](handleError(_0x2497b1,null));};exports['update']=function(_0x1a694b,_0x2a2234){if(_0x1a694b[_0x3ebe('0x58')]['id']){delete _0x1a694b['body']['id'];}return db['FaxMessage'][_0x3ebe('0x57')]({'where':{'id':_0x1a694b[_0x3ebe('0x59')]['id']}})[_0x3ebe('0x1f')](handleEntityNotFound(_0x2a2234,null))[_0x3ebe('0x1f')](saveUpdates(_0x1a694b[_0x3ebe('0x58')],null))[_0x3ebe('0x1f')](respondWithResult(_0x2a2234,null))[_0x3ebe('0x2a')](handleError(_0x2a2234,null));};exports[_0x3ebe('0x37')]=function(_0x62296,_0x1c0356){return db[_0x3ebe('0x3d')][_0x3ebe('0x57')]({'where':{'id':_0x62296[_0x3ebe('0x59')]['id']}})[_0x3ebe('0x1f')](handleEntityNotFound(_0x1c0356,null))[_0x3ebe('0x1f')](removeEntity(_0x1c0356,null))['catch'](handleError(_0x1c0356,null));};exports[_0x3ebe('0x5a')]=function(_0xdd1328,_0x4eee00){return db[_0x3ebe('0x3d')][_0x3ebe('0x5a')]()[_0x3ebe('0x1f')](respondWithResult(_0x4eee00,null))[_0x3ebe('0x2a')](handleError(_0x4eee00,null));};var interaction_log=require(_0x3ebe('0x14'))('fax-interactions');exports[_0x3ebe('0x5b')]=function(_0x2cfaf2,_0x57fc48,_0x1c357d){var _0x56d17c={'agent':{},'channel':_0x3ebe('0x5c')};if(_0x2cfaf2[_0x3ebe('0x58')]['id']){delete _0x2cfaf2[_0x3ebe('0x58')]['id'];}_0x2cfaf2['body']['read']=!![];_0x2cfaf2[_0x3ebe('0x58')][_0x3ebe('0x5d')]=moment()[_0x3ebe('0x5e')](_0x3ebe('0x5f'));_0x2cfaf2['body'][_0x3ebe('0x60')]=_0x2cfaf2[_0x3ebe('0x58')][_0x3ebe('0x60')]||_0x2cfaf2['user']['id'];_0x56d17c[_0x3ebe('0x61')]['id']=_0x2cfaf2[_0x3ebe('0x58')][_0x3ebe('0x60')];return db[_0x3ebe('0x3d')]['find']({'where':{'id':_0x2cfaf2[_0x3ebe('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x57fc48,null))['then'](saveUpdates(_0x2cfaf2[_0x3ebe('0x58')],null))['then'](function(_0x14fc53){if(_0x14fc53){_0x56d17c[_0x3ebe('0x28')]=_0x14fc53[_0x3ebe('0x62')]({'plain':!![]});return db[_0x3ebe('0x63')]['find']({'where':{'id':_0x14fc53[_0x3ebe('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x57fc48,null))[_0x3ebe('0x1f')](function(_0x77417e){if(_0x77417e){return _0x77417e[_0x3ebe('0x36')]({'UserId':_0x2cfaf2['body']['UserId'],'read1stAt':_[_0x3ebe('0x65')](_0x77417e[_0x3ebe('0x66')])?moment()['format'](_0x3ebe('0x5f')):undefined});}return null;})[_0x3ebe('0x1f')](function(_0x70a2b9){if(_0x70a2b9){_0x56d17c[_0x3ebe('0x67')]=_0x70a2b9[_0x3ebe('0x62')]({'plain':!![]});interaction_log[_0x3ebe('0x20')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2cfaf2[_0x3ebe('0x68')]['id'],_0x2cfaf2[_0x3ebe('0x68')][_0x3ebe('0x42')],_0x2cfaf2[_0x3ebe('0x68')]['role'],_0x56d17c[_0x3ebe('0x67')]['id'],_0x2cfaf2['body']?JSON[_0x3ebe('0x25')](_0x2cfaf2[_0x3ebe('0x58')]):_0x3ebe('0x69'));return respondWithRpcPromise('AcceptMessage',_0x3ebe('0x6a'),_0x56d17c);}return null;})[_0x3ebe('0x1f')](function(_0x3a137a){var _0x50115b=_0x3ebe('0x6b')+_0x3a137a[_0x3ebe('0x28')][_0x3ebe('0x6c')];return db['sequelize'][_0x3ebe('0x44')](_0x50115b,{'type':db['Sequelize'][_0x3ebe('0x6d')][_0x3ebe('0x6e')],'raw':!![]})[_0x3ebe('0x1f')](function(_0x5c50ad){return _0x5c50ad;});})['then'](function(_0x485852){if(_0x485852){_0x56d17c['message']['contact']=_0x485852[0x0];if(!_0x2cfaf2[_0x3ebe('0x58')][_0x3ebe('0x60')])return;return db[_0x3ebe('0x6f')][_0x3ebe('0x57')]({'where':{'id':_0x2cfaf2[_0x3ebe('0x58')]['UserId'],'role':_0x3ebe('0x61')},'attributes':['id',_0x3ebe('0x42'),_0x3ebe('0x70'),_0x3ebe('0x71'),_0x3ebe('0x72')],'raw':!![]});}return null;})[_0x3ebe('0x1f')](function(_0x192f81){if(!_0x192f81)return null;_0x56d17c[_0x3ebe('0x28')][_0x3ebe('0x61')]=_0x192f81;return _0x56d17c;})[_0x3ebe('0x1f')](function(_0x563aa7){if(_0x563aa7){if(_0x2cfaf2[_0x3ebe('0x58')][_0x3ebe('0x73')]){_0x56d17c['message'][_0x3ebe('0x74')]=util[_0x3ebe('0x5e')](_0x3ebe('0x75'),_0x2cfaf2[_0x3ebe('0x68')][_0x3ebe('0x42')]);_0x56d17c['message'][_0x3ebe('0x76')]=_0x56d17c['channel'];_0x56d17c['message'][_0x3ebe('0x77')]=_0x56d17c[_0x3ebe('0x76')];_0x56d17c[_0x3ebe('0x28')][_0x3ebe('0x78')]='accept';return respondWithRpcPromise(_0x3ebe('0x79'),'EventManager',{'event':_0x3ebe('0x7a'),'message':_0x56d17c[_0x3ebe('0x28')]},client9002)[_0x3ebe('0x1f')](function(){return _0x56d17c;});}return _0x56d17c;}return null;})[_0x3ebe('0x1f')](respondWithResult(_0x57fc48,null))[_0x3ebe('0x2a')](handleError(_0x57fc48,null));};var interaction_log=require(_0x3ebe('0x14'))(_0x3ebe('0x7b'));exports[_0x3ebe('0x7c')]=function(_0x327797,_0x5ba57e,_0x170876){var _0x5be27d={'agent':{},'channel':'fax'};if(_0x327797[_0x3ebe('0x58')]['id']){delete _0x327797['body']['id'];}_0x327797[_0x3ebe('0x58')][_0x3ebe('0x60')]=_0x327797['body'][_0x3ebe('0x60')]||_0x327797['user']['id'];_0x5be27d[_0x3ebe('0x61')]['id']=_0x327797['body'][_0x3ebe('0x60')];return db[_0x3ebe('0x3d')]['find']({'where':{'id':_0x327797[_0x3ebe('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ba57e,null))[_0x3ebe('0x1f')](function(_0xf08938){if(_0xf08938){_0x5be27d[_0x3ebe('0x28')]=_0xf08938[_0x3ebe('0x62')]({'plain':!![]});return db[_0x3ebe('0x63')][_0x3ebe('0x57')]({'where':{'id':_0xf08938['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5ba57e,null))[_0x3ebe('0x1f')](function(_0x39e13d){if(_0x39e13d){_0x5be27d[_0x3ebe('0x67')]=_0x39e13d['get']({'plain':!![]});interaction_log['info'](_0x3ebe('0x7d'),_0x327797['user']['id'],_0x327797[_0x3ebe('0x68')][_0x3ebe('0x42')],_0x327797[_0x3ebe('0x68')][_0x3ebe('0x7e')],_0x5be27d[_0x3ebe('0x67')]['id'],_0x327797[_0x3ebe('0x58')]?JSON[_0x3ebe('0x25')](_0x327797['body']):_0x3ebe('0x69'));return respondWithRpcPromise('RejectMessage',_0x3ebe('0x7f'),_0x5be27d);}return null;})[_0x3ebe('0x1f')](function(_0x39f40f){var _0x10b7ac=_0x3ebe('0x6b')+_0x39f40f[_0x3ebe('0x28')][_0x3ebe('0x6c')];return db[_0x3ebe('0x80')][_0x3ebe('0x44')](_0x10b7ac,{'type':db[_0x3ebe('0x81')][_0x3ebe('0x6d')][_0x3ebe('0x6e')],'raw':!![]})[_0x3ebe('0x1f')](function(_0x27ea1b){return _0x27ea1b;});})[_0x3ebe('0x1f')](function(_0x816a7){if(_0x816a7){_0x5be27d[_0x3ebe('0x28')]['contact']=_0x816a7[0x0];if(!_0x327797[_0x3ebe('0x58')][_0x3ebe('0x60')])return;return db[_0x3ebe('0x6f')][_0x3ebe('0x57')]({'where':{'id':_0x327797[_0x3ebe('0x58')][_0x3ebe('0x60')],'role':'agent'},'attributes':['id',_0x3ebe('0x42'),_0x3ebe('0x70'),_0x3ebe('0x71'),_0x3ebe('0x72')],'raw':!![]});}return null;})[_0x3ebe('0x1f')](function(_0x4ead90){if(!_0x4ead90)return null;_0x5be27d[_0x3ebe('0x28')][_0x3ebe('0x61')]=_0x4ead90;return _0x5be27d;})[_0x3ebe('0x1f')](function(_0x56cd82){if(_0x56cd82){_0x56cd82[_0x3ebe('0x28')][_0x3ebe('0x74')]=util[_0x3ebe('0x5e')]('SIP/%s',_0x327797['user'][_0x3ebe('0x42')]);_0x56cd82[_0x3ebe('0x28')][_0x3ebe('0x76')]=_0x5be27d[_0x3ebe('0x76')];_0x56cd82[_0x3ebe('0x28')]['motionChannel']=_0x5be27d[_0x3ebe('0x76')];_0x56cd82[_0x3ebe('0x28')]['event']='reject';respondWithRpcPromise(_0x3ebe('0x79'),_0x3ebe('0x79'),{'event':_0x3ebe('0x82'),'message':_0x56cd82[_0x3ebe('0x28')]},client9002);return _0x5be27d;}return null;})[_0x3ebe('0x1f')](respondWithResult(_0x5ba57e,null))[_0x3ebe('0x2a')](handleError(_0x5ba57e,null));};exports['create']=function(_0x4f5056,_0x1c3870){var _0x27b846;return db[_0x3ebe('0x3d')][_0x3ebe('0x83')](_0x4f5056['body'],{})[_0x3ebe('0x1f')](function(_0xc1ef0b){_0x27b846=_0xc1ef0b;return db[_0x3ebe('0x84')]['findOne']({'where':{'id':_0x27b846[_0x3ebe('0x6c')]}});})[_0x3ebe('0x1f')](function(_0x4b9b59){if(_[_0x3ebe('0x65')](_0x4b9b59)){return;}else{_0x27b846[_0x3ebe('0x5c')]=_0x4b9b59[_0x3ebe('0x5c')];return db[_0x3ebe('0x85')][_0x3ebe('0x86')]({'where':{'id':_0x27b846['AttachmentId']}});}})[_0x3ebe('0x1f')](function(_0x1d53a8){return respondWithRpcPromise(_0x3ebe('0x87'),_0x3ebe('0x87'),{'FaxAccountId':_['isNil'](_0x4f5056[_0x3ebe('0x58')])?undefined:_0x4f5056[_0x3ebe('0x58')][_0x3ebe('0x88')],'path':_[_0x3ebe('0x65')](_0x1d53a8)?undefined:util['format'](_0x3ebe('0x89'),_0x1d53a8['basename']),'fax':_[_0x3ebe('0x65')](_0x27b846[_0x3ebe('0x5c')])?undefined:_0x27b846[_0x3ebe('0x5c')],'AttachmentId':_0x27b846[_0x3ebe('0x8a')]},client9002);})[_0x3ebe('0x1f')](respondWithResult(_0x1c3870,0xc9))[_0x3ebe('0x2a')](handleError(_0x1c3870,null));};exports['download']=function(_0x1cd384,_0x150801){var _0x41863b=path['join'](config[_0x3ebe('0x8b')],'server',_0x3ebe('0x8c'),'attachments');return db['FaxMessage'][_0x3ebe('0x57')]({'where':{'id':_0x1cd384[_0x3ebe('0x59')]['id']},'include':[{'model':db['Attachment'],'as':_0x3ebe('0x85')}]})['then'](handleEntityNotFound(_0x150801,null))[_0x3ebe('0x1f')](function(_0xffcf4d){if(_0xffcf4d){return _0x150801[_0x3ebe('0x8d')](path[_0x3ebe('0x8e')](_0x41863b,_0xffcf4d[_0x3ebe('0x85')][_0x3ebe('0x8f')]));}})[_0x3ebe('0x2a')](handleError(_0x150801,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index d5f0920..06ca008 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 _0x044a=['hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2bbd24,_0x1c5aa8){var _0x2db52e=function(_0x13cc22){while(--_0x13cc22){_0x2bbd24['push'](_0x2bbd24['shift']());}};_0x2db52e(++_0x1c5aa8);}(_0x044a,0x173));var _0xa044=function(_0x59073a,_0x316149){_0x59073a=_0x59073a-0x0;var _0x431742=_0x044a[_0x59073a];return _0x431742;};'use strict';var EventEmitter=require(_0xa044('0x0'));var FaxMessage=require(_0xa044('0x1'))['db'][_0xa044('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa044('0x3')](0x0);var events={'afterCreate':_0xa044('0x4'),'afterUpdate':_0xa044('0x5'),'afterDestroy':_0xa044('0x6')};function emitEvent(_0x30b0c9){return function(_0x25ed77,_0x116358,_0x566ddf){FaxMessageEvents[_0xa044('0x7')](_0x30b0c9+':'+_0x25ed77['id'],_0x25ed77);FaxMessageEvents[_0xa044('0x7')](_0x30b0c9,_0x25ed77);_0x566ddf(null);};}for(var e in events){if(events[_0xa044('0x8')](e)){var event=events[e];FaxMessage[_0xa044('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x7880=['exports','events','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7880,0x10f));var _0x0788=function(_0x66ef11,_0x42f78b){_0x66ef11=_0x66ef11-0x0;var _0x318579=_0x7880[_0x66ef11];return _0x318579;};'use strict';var EventEmitter=require(_0x0788('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x0788('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x0788('0x2')](0x0);var events={'afterCreate':_0x0788('0x3'),'afterUpdate':_0x0788('0x4'),'afterDestroy':_0x0788('0x5')};function emitEvent(_0x509799){return function(_0x563529,_0x10143c,_0x487b5b){FaxMessageEvents[_0x0788('0x6')](_0x509799+':'+_0x563529['id'],_0x563529);FaxMessageEvents[_0x0788('0x6')](_0x509799,_0x563529);_0x487b5b(null);};}for(var e in events){if(events[_0x0788('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x0788('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 3fe3c1d..cf094a3 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 _0x37e9=['FaxInteraction','findOne','FaxInteractionId','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','UserId'];(function(_0x3c86b4,_0x431782){var _0x268334=function(_0x77a2cc){while(--_0x77a2cc){_0x3c86b4['push'](_0x3c86b4['shift']());}};_0x268334(++_0x431782);}(_0x37e9,0x1ee));var _0x937e=function(_0x4f32c6,_0x478f41){_0x4f32c6=_0x4f32c6-0x0;var _0x5b5a18=_0x37e9[_0x4f32c6];return _0x5b5a18;};'use strict';var _=require(_0x937e('0x0'));var util=require(_0x937e('0x1'));var logger=require(_0x937e('0x2'))(_0x937e('0x3'));var moment=require(_0x937e('0x4'));var BPromise=require(_0x937e('0x5'));var rp=require(_0x937e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x937e('0x7'));var config=require(_0x937e('0x8'));var attributes=require(_0x937e('0x9'));module[_0x937e('0xa')]=function(_0x2fd703,_0x3e398f){return _0x2fd703[_0x937e('0xb')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x937e('0xc'),'fields':[_0x937e('0xd')],'type':_0x937e('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7d9a08,_0x259ed5,_0x3dcbe0){var _0x421dfc=_0x2fd703['models'];var _0x1c1a88=_0x7d9a08[_0x937e('0xf')]({'plain':!![]});if(_0x1c1a88[_0x937e('0x10')]['toLowerCase']()==='in'||_0x1c1a88[_0x937e('0x10')][_0x937e('0x11')]()==='out'&&!_0x1c1a88['secret']&&!_['isNil'](_0x1c1a88[_0x937e('0x12')])){_0x421dfc[_0x937e('0x13')][_0x937e('0x14')]({'where':{'id':_0x1c1a88[_0x937e('0x15')]}})['then'](function(_0x2ffd06){if(_0x2ffd06){_0x2ffd06[_0x937e('0x16')]({'lastMsgAt':_0x1c1a88['createdAt'],'lastMsgDirection':_0x1c1a88[_0x937e('0x10')][_0x937e('0x11')]()});}})[_0x937e('0x17')](function(_0xf7f4b3){console[_0x937e('0x18')](_0xf7f4b3);});}_0x3dcbe0();}},'charset':_0x937e('0x19'),'collate':_0x937e('0x1a')});}; \ No newline at end of file +var _0xed88=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','models','get','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','error'];(function(_0x162367,_0x41f140){var _0x3a23c4=function(_0x572998){while(--_0x572998){_0x162367['push'](_0x162367['shift']());}};_0x3a23c4(++_0x41f140);}(_0xed88,0x17b));var _0x8ed8=function(_0x15f4f4,_0x26072c){_0x15f4f4=_0x15f4f4-0x0;var _0x48f9dc=_0xed88[_0x15f4f4];return _0x48f9dc;};'use strict';var _=require('lodash');var util=require(_0x8ed8('0x0'));var logger=require(_0x8ed8('0x1'))(_0x8ed8('0x2'));var moment=require(_0x8ed8('0x3'));var BPromise=require(_0x8ed8('0x4'));var rp=require(_0x8ed8('0x5'));var fs=require('fs');var path=require(_0x8ed8('0x6'));var rimraf=require(_0x8ed8('0x7'));var config=require(_0x8ed8('0x8'));var attributes=require(_0x8ed8('0x9'));module['exports']=function(_0xc99965,_0x124d30){return _0xc99965[_0x8ed8('0xa')](_0x8ed8('0xb'),attributes,{'tableName':_0x8ed8('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x8ed8('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43a19,_0x42347d,_0x31c193){var _0x219947=_0xc99965[_0x8ed8('0xe')];var _0x352758=_0x43a19[_0x8ed8('0xf')]({'plain':!![]});if(_0x352758[_0x8ed8('0x10')]['toLowerCase']()==='in'||_0x352758[_0x8ed8('0x10')][_0x8ed8('0x11')]()===_0x8ed8('0x12')&&!_0x352758[_0x8ed8('0x13')]&&!_['isNil'](_0x352758[_0x8ed8('0x14')])){_0x219947[_0x8ed8('0x15')][_0x8ed8('0x16')]({'where':{'id':_0x352758[_0x8ed8('0x17')]}})['then'](function(_0x49c620){if(_0x49c620){_0x49c620[_0x8ed8('0x18')]({'lastMsgAt':_0x352758['createdAt'],'lastMsgDirection':_0x352758[_0x8ed8('0x10')][_0x8ed8('0x11')]()});}})['catch'](function(_0x87a6e7){console[_0x8ed8('0x19')](_0x87a6e7);});}_0x31c193();}},'charset':'utf8mb4','collate':_0x8ed8('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index cea315d..c994342 100644 --- a/server/api/faxMessage/faxMessage.rpc.js +++ b/server/api/faxMessage/faxMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6d6=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','then','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','update','where','limit','UpdateFaxMessage'];(function(_0x1c36f6,_0x2b9a87){var _0x46cee8=function(_0x41fa8f){while(--_0x41fa8f){_0x1c36f6['push'](_0x1c36f6['shift']());}};_0x46cee8(++_0x2b9a87);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x4ca710,_0x147872){_0x4ca710=_0x4ca710-0x0;var _0x1cc6d9=_0xd6d6[_0x4ca710];return _0x1cc6d9;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});config[_0x6d6d('0xc')]=_[_0x6d6d('0xd')](config[_0x6d6d('0xc')],{'host':_0x6d6d('0xe'),'port':0x18eb});var socket=require(_0x6d6d('0xf'))(new Redis(config[_0x6d6d('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x404c88,_0x1fa46d,_0x23b18a){return new BPromise(function(_0x290dfb,_0xf84314){return client['request'](_0x404c88,_0x23b18a)[_0x6d6d('0x10')](function(_0x158f82){logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));logger[_0x6d6d('0x12')](_0x6d6d('0x13'),_0x1fa46d,_0x6d6d('0x11'),JSON[_0x6d6d('0x14')](_0x158f82));if(_0x158f82[_0x6d6d('0x15')]){if(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x16')]===0x1f4){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);return _0xf84314(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x158f82['error'][_0x6d6d('0x18')]);return _0x290dfb(_0x158f82[_0x6d6d('0x15')][_0x6d6d('0x18')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x1fa46d,_0x6d6d('0x11'));_0x290dfb(_0x158f82[_0x6d6d('0x19')][_0x6d6d('0x18')]);}})[_0x6d6d('0x1a')](function(_0x51fff6){logger['error'](_0x6d6d('0x17'),_0x1fa46d,_0x51fff6);_0xf84314(_0x51fff6);});});}exports['CreateFaxMessage']=function(_0x26f631){var _0xb8590d=this;return new Promise(function(_0x30d87d,_0x450352){return db[_0x6d6d('0x1b')][_0x6d6d('0x1c')](_0x26f631[_0x6d6d('0x1d')],{'raw':_0x26f631[_0x6d6d('0x1e')]?_0x26f631[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![]})[_0x6d6d('0x10')](function(_0x6e58e3){logger[_0x6d6d('0x20')](_0x6d6d('0x21'),_0x26f631);logger[_0x6d6d('0x12')](_0x6d6d('0x21'),_0x26f631,JSON[_0x6d6d('0x14')](_0x6e58e3));_0x30d87d(_0x6e58e3);})['catch'](function(_0x3b73e5){logger[_0x6d6d('0x15')](_0x6d6d('0x21'),_0x3b73e5[_0x6d6d('0x18')],_0x26f631);_0x450352(_0xb8590d[_0x6d6d('0x15')](0x1f4,_0x3b73e5[_0x6d6d('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x2851dd){var _0x2b5e31=this;return new Promise(function(_0x235451,_0x126ac8){return db[_0x6d6d('0x1b')][_0x6d6d('0x22')](_0x2851dd[_0x6d6d('0x1d')],{'raw':_0x2851dd['options']?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2851dd['options']?_0x2851dd['options'][_0x6d6d('0x23')]||null:null,'attributes':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')]['attributes']||null:null,'limit':_0x2851dd[_0x6d6d('0x1e')]?_0x2851dd[_0x6d6d('0x1e')][_0x6d6d('0x24')]||null:null})[_0x6d6d('0x10')](function(_0x64d1f7){logger[_0x6d6d('0x20')](_0x6d6d('0x25'),_0x2851dd);logger[_0x6d6d('0x12')](_0x6d6d('0x25'),_0x2851dd,JSON[_0x6d6d('0x14')](_0x64d1f7));_0x235451(_0x64d1f7);})['catch'](function(_0x1f9469){logger['error'](_0x6d6d('0x25'),_0x1f9469[_0x6d6d('0x18')],_0x2851dd);_0x126ac8(_0x2b5e31[_0x6d6d('0x15')](0x1f4,_0x1f9469[_0x6d6d('0x18')]));});});}; \ No newline at end of file +var _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x7d1be0,_0x3509e1){var _0x6f1a35=function(_0x15adfc){while(--_0x15adfc){_0x7d1be0['push'](_0x7d1be0['shift']());}};_0x6f1a35(++_0x3509e1);}(_0x2d17,0x17e));var _0x72d1=function(_0x4039e4,_0x3d4436){_0x4039e4=_0x4039e4-0x0;var _0x361a7e=_0x2d17[_0x4039e4];return _0x361a7e;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 96b311c..8c23f6f 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 _0xe8b2=['emit','removeListener','register','faxMessage:','./faxMessage.events','save','remove'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe8b2,0x162));var _0x2e8b=function(_0x46e5e9,_0x3eee14){_0x46e5e9=_0x46e5e9-0x0;var _0x384313=_0xe8b2[_0x46e5e9];return _0x384313;};'use strict';var FaxMessageEvents=require(_0x2e8b('0x0'));var events=[_0x2e8b('0x1'),_0x2e8b('0x2'),'update'];function createListener(_0x2f40dd,_0x58acad){return function(_0xf63809){_0x58acad[_0x2e8b('0x3')](_0x2f40dd,_0xf63809);};}function removeListener(_0x297272,_0x5eeddc){return function(){FaxMessageEvents[_0x2e8b('0x4')](_0x297272,_0x5eeddc);};}exports[_0x2e8b('0x5')]=function(_0x5e6ac8){for(var _0x4a151f=0x0,_0xf318eb=events['length'];_0x4a151f<_0xf318eb;_0x4a151f++){var _0x2e660c=events[_0x4a151f];var _0x5f36e6=createListener(_0x2e8b('0x6')+_0x2e660c,_0x5e6ac8);FaxMessageEvents['on'](_0x2e660c,_0x5f36e6);}}; \ No newline at end of file +var _0x04b0=['register','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x995cac,_0x3932a7){var _0x22d338=function(_0x5a8c95){while(--_0x5a8c95){_0x995cac['push'](_0x995cac['shift']());}};_0x22d338(++_0x3932a7);}(_0x04b0,0xd2));var _0x004b=function(_0x25a798,_0x1e12ec){_0x25a798=_0x25a798-0x0;var _0xa7c00=_0x04b0[_0x25a798];return _0xa7c00;};'use strict';var FaxMessageEvents=require(_0x004b('0x0'));var events=[_0x004b('0x1'),_0x004b('0x2'),_0x004b('0x3')];function createListener(_0x4e12b1,_0x3e8448){return function(_0x452773){_0x3e8448[_0x004b('0x4')](_0x4e12b1,_0x452773);};}function removeListener(_0x286854,_0x3c16cd){return function(){FaxMessageEvents[_0x004b('0x5')](_0x286854,_0x3c16cd);};}exports[_0x004b('0x6')]=function(_0x4a531d){for(var _0x5e512e=0x0,_0x2806a8=events['length'];_0x5e512e<_0x2806a8;_0x5e512e++){var _0xcf18e7=events[_0x5e512e];var _0x51bf7d=createListener(_0x004b('0x7')+_0xcf18e7,_0x4a531d);FaxMessageEvents['on'](_0xcf18e7,_0x51bf7d);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 73b44f9..7da686c 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/reject','reject','delete','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x9c1172,_0x5af040){var _0x5b1b74=function(_0x5bcb13){while(--_0x5bcb13){_0x9c1172['push'](_0x9c1172['shift']());}};_0x5b1b74(++_0x5af040);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x0fd9[_0x5ce3c8];return _0xa76867;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),interaction[_0x90fd('0x10')](_0x90fd('0x11'),'faxmessage:create'),controller[_0x90fd('0x12')]);router[_0x90fd('0x13')]('/:id',auth[_0x90fd('0x9')](),controller[_0x90fd('0x14')]);router[_0x90fd('0x13')]('/:id/accept',auth[_0x90fd('0x9')](),controller['accept']);router[_0x90fd('0x13')](_0x90fd('0x15'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x16')]);router[_0x90fd('0x17')](_0x90fd('0xb'),auth[_0x90fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2e54=['download','post','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x1f0724,_0x3a58bf){var _0x253ffb=function(_0x3b4c72){while(--_0x3b4c72){_0x1f0724['push'](_0x1f0724['shift']());}};_0x253ffb(++_0x3a58bf);}(_0x2e54,0x1dd));var _0x42e5=function(_0x12f331,_0xf732dc){_0x12f331=_0x12f331-0x0;var _0x493b88=_0x2e54[_0x12f331];return _0x493b88;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./faxMessage.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),interaction['tracked'](_0x42e5('0x12'),_0x42e5('0x13')),controller['create']);router[_0x42e5('0x14')](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x15')]);router[_0x42e5('0x14')](_0x42e5('0x16'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x17')]);router[_0x42e5('0x14')](_0x42e5('0x18'),auth['isAuthenticated'](),controller[_0x42e5('0x19')]);router[_0x42e5('0x1a')](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x1b')]);module[_0x42e5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a240f75..707c15b 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 _0x8887=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x8887,0x1c6));var _0x7888=function(_0x375936,_0x5a64da){_0x375936=_0x375936-0x0;var _0x1e915c=_0x8887[_0x375936];return _0x1e915c;};'use strict';var Sequelize=require(_0x7888('0x0'));module[_0x7888('0x1')]={'name':{'type':Sequelize[_0x7888('0x2')],'unique':_0x7888('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x7888('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7888('0x5')](_0x7888('0x6'),_0x7888('0x7'),_0x7888('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7888('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x21a8=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x1943d5,_0x16fed5){var _0x3f02ef=function(_0x375acc){while(--_0x375acc){_0x1943d5['push'](_0x1943d5['shift']());}};_0x3f02ef(++_0x16fed5);}(_0x21a8,0xed));var _0x821a=function(_0xdfa25b,_0x4b35ff){_0xdfa25b=_0xdfa25b-0x0;var _0xa0e09c=_0x21a8[_0xdfa25b];return _0xa0e09c;};'use strict';var Sequelize=require(_0x821a('0x0'));module[_0x821a('0x1')]={'name':{'type':Sequelize[_0x821a('0x2')],'unique':_0x821a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x821a('0x2')]},'timeout':{'type':Sequelize[_0x821a('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x821a('0x5')](_0x821a('0x6'),_0x821a('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x821a('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 18f6b84..ea241b2 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 _0xcaaf=['update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','status','send','map','FaxQueue','rawAttributes','fieldName','type','include','findAll','rows','catch','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','merge','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','describe','findOne','filters','hasOwnProperty','order','where','pick','filter','UserFaxQueue','findAndCountAll','agent','faxPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','sort','nolimit','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','userFaxQueue:remove','omit','isArray','getAgents','bluebird','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x2318da,_0x4b0f98){var _0x14c397=function(_0x2e5d90){while(--_0x2e5d90){_0x2318da['push'](_0x2318da['shift']());}};_0x14c397(++_0x4b0f98);}(_0xcaaf,0x66));var _0xfcaa=function(_0x371621,_0x1702f8){_0x371621=_0x371621-0x0;var _0xb3287e=_0xcaaf[_0x371621];return _0xb3287e;};'use strict';var BPromise=require(_0xfcaa('0x0'));var util=require('util');var _=require(_0xfcaa('0x1'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xfcaa('0x2'));var logger=require(_0xfcaa('0x3'))('api');var config=require(_0xfcaa('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfcaa('0x5')](config[_0xfcaa('0x6')],{'host':_0xfcaa('0x7'),'port':0x18eb});var socket=require(_0xfcaa('0x8'))(new Redis(config[_0xfcaa('0x6')]));require(_0xfcaa('0x9'))[_0xfcaa('0xa')](socket);function respondWithStatusCode(_0x4ee7d3,_0xa0706d){_0xa0706d=_0xa0706d||0xcc;return function(_0x4c084d){if(_0x4c084d){return _0x4ee7d3[_0xfcaa('0xb')](_0xa0706d);}return _0x4ee7d3['status'](_0xa0706d)[_0xfcaa('0xc')]();};}function respondWithResult(_0x593c04,_0x586902){_0x586902=_0x586902||0xc8;return function(_0x345e39){if(_0x345e39){return _0x593c04['status'](_0x586902)[_0xfcaa('0xd')](_0x345e39);}};}function respondWithFilteredResult(_0x2e83f8,_0xb7b580){return function(_0x34448e){if(_0x34448e){var _0x278a68=typeof _0xb7b580[_0xfcaa('0xe')]===_0xfcaa('0xf')&&typeof _0xb7b580[_0xfcaa('0x10')]==='undefined';var _0x5831ba=_0x34448e[_0xfcaa('0x11')];var _0x129b69=_0x278a68?0x0:_0xb7b580[_0xfcaa('0xe')];var _0x521fff=_0x278a68?_0x34448e[_0xfcaa('0x11')]:_0xb7b580[_0xfcaa('0xe')]+_0xb7b580[_0xfcaa('0x10')];var _0xf49a9b;if(_0x521fff>=_0x5831ba){_0x521fff=_0x5831ba;_0xf49a9b=0xc8;}else{_0xf49a9b=0xce;}_0x2e83f8['status'](_0xf49a9b);return _0x2e83f8[_0xfcaa('0x12')](_0xfcaa('0x13'),_0x129b69+'-'+_0x521fff+'/'+_0x5831ba)[_0xfcaa('0xd')](_0x34448e);}return null;};}function saveUpdates(_0x580335){return function(_0x130233){if(_0x130233){return _0x130233[_0xfcaa('0x14')](_0x580335)['then'](function(_0x4202dc){return _0x4202dc;});}return null;};}function removeEntity(_0x5c0277){return function(_0x587419){if(_0x587419){return _0x587419[_0xfcaa('0x15')]()[_0xfcaa('0x16')](function(){var _0x416132=_0x587419[_0xfcaa('0x17')]({'plain':!![]});var _0x2b56e4=_0xfcaa('0x18');return db[_0xfcaa('0x19')][_0xfcaa('0x15')]({'where':{'type':_0x2b56e4,'resourceId':_0x416132['id']}})[_0xfcaa('0x16')](function(){return _0x587419;});})[_0xfcaa('0x16')](function(){_0x5c0277['status'](0xcc)[_0xfcaa('0xc')]();});}};}function handleEntityNotFound(_0x3d4f89){return function(_0x233a73){if(!_0x233a73){_0x3d4f89[_0xfcaa('0xb')](0x194);}return _0x233a73;};}function handleError(_0xcc1c83,_0x4416ed){_0x4416ed=_0x4416ed||0x1f4;return function(_0xf59b30){logger[_0xfcaa('0x1a')](_0xf59b30[_0xfcaa('0x1b')]);if(_0xf59b30['name']){delete _0xf59b30[_0xfcaa('0x1c')];}_0xcc1c83[_0xfcaa('0x1d')](_0x4416ed)[_0xfcaa('0x1e')](_0xf59b30);};}exports['index']=function(_0x1d8e09,_0x59c206){var _0x4642bb={};var _0x2209d8={'count':0x0,'rows':[]};var _0x3dc1d4=_[_0xfcaa('0x1f')](db[_0xfcaa('0x20')][_0xfcaa('0x21')],function(_0xf471ce){return{'name':_0xf471ce[_0xfcaa('0x22')],'type':_0xf471ce[_0xfcaa('0x23')]['key']};});_0x4642bb=qs['getOptions'](_0x3dc1d4,_0x1d8e09);var _0x513223={'where':_0x4642bb['where']};return db[_0xfcaa('0x20')][_0xfcaa('0x11')](_0x513223)['then'](function(_0xa4390a){_0x2209d8[_0xfcaa('0x11')]=_0xa4390a;_0x4642bb['include']=qs[_0xfcaa('0x24')](_0x1d8e09['query']);return db['FaxQueue'][_0xfcaa('0x25')](_0x4642bb);})[_0xfcaa('0x16')](function(_0x37bc0f){_0x2209d8[_0xfcaa('0x26')]=_0x37bc0f;return _0x2209d8;})['then'](respondWithFilteredResult(_0x59c206,_0x4642bb))[_0xfcaa('0x27')](handleError(_0x59c206,null));};exports[_0xfcaa('0x28')]=function(_0x528b10,_0x1f9351){var _0x327c4f={'raw':!![],'where':{'id':_0x528b10[_0xfcaa('0x29')]['id']}},_0x201598={};_0x201598[_0xfcaa('0x2a')]=_[_0xfcaa('0x2b')](db['FaxQueue'][_0xfcaa('0x21')]);_0x201598[_0xfcaa('0x2c')]=_[_0xfcaa('0x2b')](_0x528b10[_0xfcaa('0x2c')]);_0x201598['filters']=_[_0xfcaa('0x2d')](_0x201598['model'],_0x201598[_0xfcaa('0x2c')]);_0x327c4f['attributes']=_[_0xfcaa('0x2d')](_0x201598[_0xfcaa('0x2a')],qs[_0xfcaa('0x2e')](_0x528b10[_0xfcaa('0x2c')][_0xfcaa('0x2e')]));_0x327c4f[_0xfcaa('0x2f')]=_0x327c4f['attributes'][_0xfcaa('0x30')]?_0x327c4f[_0xfcaa('0x2f')]:_0x201598[_0xfcaa('0x2a')];if(_0x528b10[_0xfcaa('0x2c')][_0xfcaa('0x31')]){_0x327c4f[_0xfcaa('0x24')]=[{'all':!![]}];}_0x327c4f=_[_0xfcaa('0x32')]({},_0x327c4f,_0x528b10[_0xfcaa('0x33')]);return db[_0xfcaa('0x20')][_0xfcaa('0x34')](_0x327c4f)[_0xfcaa('0x16')](handleEntityNotFound(_0x1f9351,null))[_0xfcaa('0x16')](respondWithResult(_0x1f9351,null))[_0xfcaa('0x27')](handleError(_0x1f9351,null));};exports[_0xfcaa('0x35')]=function(_0x4e0a5b,_0x515255){return db[_0xfcaa('0x20')]['create'](_0x4e0a5b[_0xfcaa('0x36')],{})['then'](function(_0x21139a){var _0x54c786=_0x4e0a5b[_0xfcaa('0x37')][_0xfcaa('0x17')]({'plain':!![]});if(!_0x54c786)throw new Error(_0xfcaa('0x38'));if(_0x54c786[_0xfcaa('0x39')]===_0xfcaa('0x37')){var _0xb39033=_0x21139a[_0xfcaa('0x17')]({'plain':!![]});var _0x2c5abf='FaxQueues';return db[_0xfcaa('0x3a')][_0xfcaa('0x34')]({'where':{'name':_0x2c5abf,'userProfileId':_0x54c786[_0xfcaa('0x3b')]},'raw':!![]})['then'](function(_0x1777e8){if(_0x1777e8&&_0x1777e8[_0xfcaa('0x3c')]===0x0){return db[_0xfcaa('0x19')][_0xfcaa('0x35')]({'name':_0xb39033[_0xfcaa('0x1c')],'resourceId':_0xb39033['id'],'type':_0x1777e8['name'],'sectionId':_0x1777e8['id']},{})[_0xfcaa('0x16')](function(){return _0x21139a;});}else{return _0x21139a;}})[_0xfcaa('0x27')](function(_0x45f336){logger[_0xfcaa('0x1a')](_0xfcaa('0x3d'),_0x45f336);throw _0x45f336;});}return _0x21139a;})['then'](respondWithResult(_0x515255,0xc9))['catch'](handleError(_0x515255,null));};exports[_0xfcaa('0x14')]=function(_0x77681b,_0x4f9d36){if(_0x77681b[_0xfcaa('0x36')]['id']){delete _0x77681b[_0xfcaa('0x36')]['id'];}return db['FaxQueue'][_0xfcaa('0x34')]({'where':{'id':_0x77681b[_0xfcaa('0x29')]['id']}})[_0xfcaa('0x16')](handleEntityNotFound(_0x4f9d36,null))[_0xfcaa('0x16')](saveUpdates(_0x77681b['body'],null))[_0xfcaa('0x16')](respondWithResult(_0x4f9d36,null))[_0xfcaa('0x27')](handleError(_0x4f9d36,null));};exports['destroy']=function(_0x4e4efb,_0xc999e7){return db[_0xfcaa('0x20')][_0xfcaa('0x34')]({'where':{'id':_0x4e4efb[_0xfcaa('0x29')]['id']}})['then'](handleEntityNotFound(_0xc999e7,null))[_0xfcaa('0x16')](removeEntity(_0xc999e7,null))[_0xfcaa('0x27')](handleError(_0xc999e7,null));};exports[_0xfcaa('0x3e')]=function(_0xa5879c,_0x23cf9e){return db[_0xfcaa('0x20')][_0xfcaa('0x3e')]()['then'](respondWithResult(_0x23cf9e,null))[_0xfcaa('0x27')](handleError(_0x23cf9e,null));};exports['getMembers']=function(_0x420c2c,_0x5ba8e0){var _0x45d310={'raw':!![],'where':{}},_0x4fa001={},_0x404ee4;return db['FaxQueue'][_0xfcaa('0x3f')]({'where':{'id':_0x420c2c[_0xfcaa('0x29')]['id']}})['then'](handleEntityNotFound(_0x5ba8e0,null))[_0xfcaa('0x16')](function(_0x2ef883){if(_0x2ef883){_0x404ee4=_0x2ef883[_0xfcaa('0x17')]({'plain':!![]});_0x4fa001[_0xfcaa('0x2a')]=_[_0xfcaa('0x2b')](db['UserFaxQueue'][_0xfcaa('0x21')]);_0x4fa001[_0xfcaa('0x2c')]=_[_0xfcaa('0x2b')](_0x420c2c[_0xfcaa('0x2c')]);_0x4fa001[_0xfcaa('0x40')]=_[_0xfcaa('0x2d')](_0x4fa001[_0xfcaa('0x2a')],_0x4fa001[_0xfcaa('0x2c')]);_0x45d310['attributes']=_['intersection'](_0x4fa001['model'],qs[_0xfcaa('0x2e')](_0x420c2c['query'][_0xfcaa('0x2e')]));_0x45d310[_0xfcaa('0x2f')]=_0x45d310[_0xfcaa('0x2f')][_0xfcaa('0x30')]?_0x45d310[_0xfcaa('0x2f')]:_0x4fa001[_0xfcaa('0x2a')];if(!_0x420c2c[_0xfcaa('0x2c')][_0xfcaa('0x41')]('nolimit')){_0x45d310[_0xfcaa('0x10')]=qs['limit'](_0x420c2c[_0xfcaa('0x2c')][_0xfcaa('0x10')]);_0x45d310[_0xfcaa('0xe')]=qs['offset'](_0x420c2c[_0xfcaa('0x2c')][_0xfcaa('0xe')]);}_0x45d310[_0xfcaa('0x42')]=qs['sort'](_0x420c2c[_0xfcaa('0x2c')]['sort']);_0x45d310[_0xfcaa('0x43')]=qs['filters'](_[_0xfcaa('0x44')](_0x420c2c[_0xfcaa('0x2c')],_0x4fa001[_0xfcaa('0x40')]));_0x45d310[_0xfcaa('0x43')]['FaxQueueId']=_0x2ef883['id'];if(_0x420c2c[_0xfcaa('0x2c')][_0xfcaa('0x45')]){_0x45d310['where']=_[_0xfcaa('0x32')](_0x45d310[_0xfcaa('0x43')],{'$or':_[_0xfcaa('0x1f')](_0x45d310[_0xfcaa('0x2f')],function(_0x53229a){var _0x2d4938={};_0x2d4938[_0x53229a]={'$like':'%'+_0x420c2c[_0xfcaa('0x2c')][_0xfcaa('0x45')]+'%'};return _0x2d4938;})});}_0x45d310=_[_0xfcaa('0x32')]({},_0x45d310,_0x420c2c['options']);return db[_0xfcaa('0x46')]['findAll'](_0x45d310);}})[_0xfcaa('0x16')](function(_0x137a39){if(_0x137a39){return db['User'][_0xfcaa('0x47')]({'where':{'id':_['map'](_0x137a39,'UserId'),'role':_0xfcaa('0x48')},'attributes':['id',_0xfcaa('0x1c'),_0xfcaa('0x49'),'updatedAt','createdAt']});}})[_0xfcaa('0x16')](function(_0x30e294){if(_0x30e294){return{'count':_0x30e294[_0xfcaa('0x11')],'rows':_['map'](_0x30e294['rows'],function(_0x2120a6){return{'membername':_0x2120a6[_0xfcaa('0x1c')],'UserId':_0x2120a6['id'],'queue_name':_0x404ee4[_0xfcaa('0x1c')],'FaxQueueId':_0x404ee4['id'],'interface':util[_0xfcaa('0x4a')](_0xfcaa('0x4b'),_0xfcaa('0x4c'),_0x2120a6['name']),'penalty':0x0,'paused':_0x2120a6['faxPause'],'createdAt':_0x2120a6[_0xfcaa('0x4d')],'updatedAt':_0x2120a6[_0xfcaa('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcaa('0x16')](respondWithFilteredResult(_0x5ba8e0,_0x45d310))[_0xfcaa('0x27')](handleError(_0x5ba8e0,null));};exports[_0xfcaa('0x4f')]=function(_0x45c54a,_0x8b1f43){var _0x5881bb={};var _0x4f324b={};var _0x2c577d;var _0x2af4e4;return db['FaxQueue'][_0xfcaa('0x3f')]({'where':{'id':_0x45c54a['params']['id']}})[_0xfcaa('0x16')](handleEntityNotFound(_0x8b1f43,null))[_0xfcaa('0x16')](function(_0x54ca8a){if(_0x54ca8a){_0x2c577d=_0x54ca8a;_0x4f324b[_0xfcaa('0x2a')]=_[_0xfcaa('0x2b')](db['Team'][_0xfcaa('0x21')]);_0x4f324b['query']=_[_0xfcaa('0x2b')](_0x45c54a[_0xfcaa('0x2c')]);_0x4f324b['filters']=_[_0xfcaa('0x2d')](_0x4f324b[_0xfcaa('0x2a')],_0x4f324b['query']);_0x5881bb[_0xfcaa('0x2f')]=_[_0xfcaa('0x2d')](_0x4f324b[_0xfcaa('0x2a')],qs[_0xfcaa('0x2e')](_0x45c54a[_0xfcaa('0x2c')][_0xfcaa('0x2e')]));_0x5881bb[_0xfcaa('0x2f')]=_0x5881bb[_0xfcaa('0x2f')][_0xfcaa('0x30')]?_0x5881bb[_0xfcaa('0x2f')]:_0x4f324b['model'];_0x5881bb[_0xfcaa('0x42')]=qs[_0xfcaa('0x50')](_0x45c54a[_0xfcaa('0x2c')][_0xfcaa('0x50')]);_0x5881bb[_0xfcaa('0x43')]=qs[_0xfcaa('0x40')](_[_0xfcaa('0x44')](_0x45c54a[_0xfcaa('0x2c')],_0x4f324b[_0xfcaa('0x40')]));if(_0x45c54a[_0xfcaa('0x2c')]['filter']){_0x5881bb[_0xfcaa('0x43')]=_[_0xfcaa('0x32')](_0x5881bb[_0xfcaa('0x43')],{'$or':_[_0xfcaa('0x1f')](_0x5881bb[_0xfcaa('0x2f')],function(_0x2a53c2){var _0x1fb97b={};_0x1fb97b[_0x2a53c2]={'$like':'%'+_0x45c54a[_0xfcaa('0x2c')][_0xfcaa('0x45')]+'%'};return _0x1fb97b;})});}_0x5881bb=_[_0xfcaa('0x32')]({},_0x5881bb,_0x45c54a[_0xfcaa('0x33')]);return _0x2c577d['getTeams'](_0x5881bb);}})['then'](function(_0x1760c7){if(_0x1760c7){_0x2af4e4=_0x1760c7[_0xfcaa('0x30')];if(!_0x45c54a[_0xfcaa('0x2c')]['hasOwnProperty'](_0xfcaa('0x51'))){_0x5881bb[_0xfcaa('0x10')]=qs[_0xfcaa('0x10')](_0x45c54a[_0xfcaa('0x2c')][_0xfcaa('0x10')]);_0x5881bb[_0xfcaa('0xe')]=qs[_0xfcaa('0xe')](_0x45c54a[_0xfcaa('0x2c')][_0xfcaa('0xe')]);}return _0x2c577d[_0xfcaa('0x4f')](_0x5881bb);}})[_0xfcaa('0x16')](function(_0x4cf33b){if(_0x4cf33b){return _0x4cf33b?{'count':_0x2af4e4,'rows':_0x4cf33b}:null;}})[_0xfcaa('0x16')](respondWithResult(_0x8b1f43,null))[_0xfcaa('0x27')](handleError(_0x8b1f43,null));};exports[_0xfcaa('0x52')]=function(_0x1de980,_0x43370a){var _0x40a5d1=_0x1de980[_0xfcaa('0x36')][_0xfcaa('0x53')];return db[_0xfcaa('0x54')][_0xfcaa('0x25')]({'where':{'id':_0x40a5d1},'attributes':['id'],'include':[{'model':db[_0xfcaa('0x55')],'as':_0xfcaa('0x56'),'attributes':['id',_0xfcaa('0x1c'),_0xfcaa('0x57'),_0xfcaa('0x58'),_0xfcaa('0x59')],'raw':!![]}]})['then'](function(_0x4d34fd){if(_0x4d34fd){var _0x5356cc=_[_0xfcaa('0x5a')](_0x4d34fd,function(_0x4e65d0){var _0x29d315=_0x4e65d0[_0xfcaa('0x17')]({'plain':!![]});return _0x29d315['Agents'];});return db[_0xfcaa('0x20')][_0xfcaa('0x34')]({'where':{'id':_0x1de980[_0xfcaa('0x29')]['id']}})[_0xfcaa('0x16')](function(_0x1ad9b9){return db[_0xfcaa('0x5b')][_0xfcaa('0x5c')](function(_0x334898){return _0x1ad9b9[_0xfcaa('0x52')](_0x40a5d1,{'transaction':_0x334898})[_0xfcaa('0x16')](function(){return BPromise[_0xfcaa('0x5d')](_0x5356cc,function(_0x32cd36){return db[_0xfcaa('0x46')][_0xfcaa('0x5e')]({'where':{'UserId':_0x32cd36['id'],'FaxQueueId':_0x1de980[_0xfcaa('0x29')]['id']},'transaction':_0x334898});});})[_0xfcaa('0x16')](function(){_0x5356cc[_0xfcaa('0x5f')](function(_0x39d6b){socket[_0xfcaa('0x60')](_0xfcaa('0x61'),{'UserId':_0x39d6b['id'],'FaxQueueId':_0x1ad9b9['id']});});});});});}})[_0xfcaa('0x16')](respondWithStatusCode(_0x43370a,null))[_0xfcaa('0x27')](handleError(_0x43370a,null));};exports[_0xfcaa('0x62')]=function(_0x2444a8,_0x51747a){return db[_0xfcaa('0x54')][_0xfcaa('0x25')]({'where':{'id':_0x2444a8[_0xfcaa('0x2c')][_0xfcaa('0x53')]},'attributes':['id'],'include':[{'model':db[_0xfcaa('0x55')],'as':_0xfcaa('0x56'),'attributes':['id'],'raw':!![]}]})[_0xfcaa('0x16')](handleEntityNotFound(_0x51747a,null))[_0xfcaa('0x16')](function(_0x2f80c3){var _0x28cb84=_[_0xfcaa('0x1f')](_0x2f80c3,'id');var _0x16aae7=[];var _0x32268e=[];var _0x1bba7a=squel['select']();_0x1bba7a[_0xfcaa('0x63')](_0xfcaa('0x64'))[_0xfcaa('0x65')](_0xfcaa('0x66'),'tq')[_0xfcaa('0x67')](_0xfcaa('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfcaa('0x43')](_0xfcaa('0x69'),_0x2444a8[_0xfcaa('0x29')]['id']);for(var _0x2b50d1=0x0;_0x2b50d1<_0x2f80c3[_0xfcaa('0x30')];_0x2b50d1+=0x1){let _0x21c485=_0x2f80c3[_0x2b50d1];for(var _0x1ff718=0x0;_0x1ff718<_0x21c485[_0xfcaa('0x56')][_0xfcaa('0x30')];_0x1ff718+=0x1){let _0x2f9d80=_0x21c485[_0xfcaa('0x56')][_0x1ff718];var _0x251c33=_0x1bba7a[_0xfcaa('0x6a')]();_0x251c33[_0xfcaa('0x43')](_0xfcaa('0x6b'),_0x2f9d80['id']);_0x32268e['push'](db[_0xfcaa('0x5b')][_0xfcaa('0x2c')](_0x251c33[_0xfcaa('0x6c')](),{'type':db[_0xfcaa('0x5b')][_0xfcaa('0x6d')][_0xfcaa('0x6e')]})['then'](function(_0x463f05){if(_0x463f05[_0xfcaa('0x30')]===0x1){return _0x2f9d80['id'];}else{var _0x2ca18c=_['every'](_[_0xfcaa('0x1f')](_0x463f05,_0xfcaa('0x6f')),function(_0x3dca66){return _[_0xfcaa('0x70')](_0x28cb84,_0x3dca66);});if(_0x2ca18c){return _0x2f9d80['id'];}}}));}}return BPromise[_0xfcaa('0x71')](_0x32268e)['then'](function(_0x21c452){_0x16aae7=_(_0x16aae7)[_0xfcaa('0x72')](_0x21c452)[_0xfcaa('0x73')]()['value']();return db[_0xfcaa('0x20')][_0xfcaa('0x34')]({'where':{'id':_0x2444a8[_0xfcaa('0x29')]['id']}})['then'](function(_0xafbc17){return db[_0xfcaa('0x5b')][_0xfcaa('0x5c')](function(_0x5e63aa){return _0xafbc17['removeTeams'](_0x2444a8[_0xfcaa('0x2c')][_0xfcaa('0x53')],{'transaction':_0x5e63aa})[_0xfcaa('0x16')](function(){if(!_[_0xfcaa('0x74')](_0x16aae7)){return _0xafbc17[_0xfcaa('0x75')](_0x16aae7,{'transaction':_0x5e63aa});}})[_0xfcaa('0x16')](function(){_0x16aae7[_0xfcaa('0x5f')](function(_0x51cc7c){socket['emit'](_0xfcaa('0x76'),{'UserId':_0x51cc7c,'FaxQueueId':_0xafbc17['id']});});});});});});})['then'](respondWithStatusCode(_0x51747a,null))[_0xfcaa('0x27')](handleError(_0x51747a,null));};exports['addAgents']=function(_0x476a74,_0x34e0f9){return db[_0xfcaa('0x20')]['find']({'where':{'id':_0x476a74[_0xfcaa('0x29')]['id']}})[_0xfcaa('0x16')](handleEntityNotFound(_0x34e0f9,null))[_0xfcaa('0x16')](function(_0x5d9f5c){if(_0x5d9f5c){return _0x5d9f5c['addAgents'](_0x476a74['body'][_0xfcaa('0x53')],_[_0xfcaa('0x77')](_0x476a74[_0xfcaa('0x36')],['ids','id'])||{})['spread'](function(_0x2bdc72){for(var _0x1bc0cc=0x0;_0x1bc0cc<_0x476a74[_0xfcaa('0x36')][_0xfcaa('0x53')][_0xfcaa('0x30')];_0x1bc0cc+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x476a74[_0xfcaa('0x36')][_0xfcaa('0x53')][_0x1bc0cc]),'FaxQueueId':Number(_0x476a74[_0xfcaa('0x29')]['id'])});}return _0x2bdc72;});}})[_0xfcaa('0x16')](respondWithResult(_0x34e0f9,null))[_0xfcaa('0x27')](handleError(_0x34e0f9,null));};exports['removeAgents']=function(_0x3dc83a,_0x2296cc){return db['FaxQueue'][_0xfcaa('0x34')]({'where':{'id':_0x3dc83a['params']['id']}})[_0xfcaa('0x16')](handleEntityNotFound(_0x2296cc,null))[_0xfcaa('0x16')](function(_0x3216bd){if(_0x3216bd){return _0x3216bd[_0xfcaa('0x75')](_0x3dc83a['query'][_0xfcaa('0x53')])[_0xfcaa('0x16')](function(){if(_[_0xfcaa('0x78')](_0x3dc83a[_0xfcaa('0x2c')][_0xfcaa('0x53')])){for(var _0x123102=0x0;_0x123102<_0x3dc83a['query']['ids'][_0xfcaa('0x30')];_0x123102+=0x1){socket[_0xfcaa('0x60')](_0xfcaa('0x76'),{'UserId':Number(_0x3dc83a[_0xfcaa('0x2c')]['ids'][_0x123102]),'FaxQueueId':Number(_0x3dc83a[_0xfcaa('0x29')]['id'])});}}else{socket[_0xfcaa('0x60')](_0xfcaa('0x76'),{'UserId':Number(_0x3dc83a['query'][_0xfcaa('0x53')]),'FaxQueueId':Number(_0x3dc83a[_0xfcaa('0x29')]['id'])});}});}})[_0xfcaa('0x16')](respondWithStatusCode(_0x2296cc,null))['catch'](handleError(_0x2296cc,null));};exports[_0xfcaa('0x79')]=function(_0x2195a2,_0x4cad9c){var _0x706bd8={};var _0xb4740e={};var _0x51293f;var _0x3d8592;return db[_0xfcaa('0x20')][_0xfcaa('0x3f')]({'where':{'id':_0x2195a2[_0xfcaa('0x29')]['id']}})[_0xfcaa('0x16')](handleEntityNotFound(_0x4cad9c,null))[_0xfcaa('0x16')](function(_0x10d724){if(_0x10d724){_0x51293f=_0x10d724;_0xb4740e[_0xfcaa('0x2a')]=_['keys'](db[_0xfcaa('0x55')][_0xfcaa('0x21')]);_0xb4740e[_0xfcaa('0x2c')]=_[_0xfcaa('0x2b')](_0x2195a2[_0xfcaa('0x2c')]);_0xb4740e[_0xfcaa('0x40')]=_['intersection'](_0xb4740e[_0xfcaa('0x2a')],_0xb4740e[_0xfcaa('0x2c')]);_0x706bd8['attributes']=_[_0xfcaa('0x2d')](_0xb4740e[_0xfcaa('0x2a')],qs['fields'](_0x2195a2[_0xfcaa('0x2c')][_0xfcaa('0x2e')]));_0x706bd8[_0xfcaa('0x2f')]=_0x706bd8[_0xfcaa('0x2f')]['length']?_0x706bd8[_0xfcaa('0x2f')]:_0xb4740e[_0xfcaa('0x2a')];_0x706bd8[_0xfcaa('0x42')]=qs[_0xfcaa('0x50')](_0x2195a2['query'][_0xfcaa('0x50')]);_0x706bd8['where']=qs['filters'](_['pick'](_0x2195a2[_0xfcaa('0x2c')],_0xb4740e[_0xfcaa('0x40')]));if(_0x2195a2['query']['filter']){_0x706bd8[_0xfcaa('0x43')]=_[_0xfcaa('0x32')](_0x706bd8[_0xfcaa('0x43')],{'$or':_[_0xfcaa('0x1f')](_0x706bd8[_0xfcaa('0x2f')],function(_0x251946){var _0x271a6a={};_0x271a6a[_0x251946]={'$like':'%'+_0x2195a2[_0xfcaa('0x2c')][_0xfcaa('0x45')]+'%'};return _0x271a6a;})});}_0x706bd8=_[_0xfcaa('0x32')]({},_0x706bd8,_0x2195a2[_0xfcaa('0x33')]);return _0x51293f[_0xfcaa('0x79')](_0x706bd8);}})[_0xfcaa('0x16')](function(_0x1bdb67){if(_0x1bdb67){_0x3d8592=_0x1bdb67['length'];if(!_0x2195a2[_0xfcaa('0x2c')][_0xfcaa('0x41')](_0xfcaa('0x51'))){_0x706bd8[_0xfcaa('0x10')]=qs['limit'](_0x2195a2[_0xfcaa('0x2c')][_0xfcaa('0x10')]);_0x706bd8[_0xfcaa('0xe')]=qs[_0xfcaa('0xe')](_0x2195a2[_0xfcaa('0x2c')][_0xfcaa('0xe')]);}return _0x51293f['getAgents'](_0x706bd8);}})[_0xfcaa('0x16')](function(_0x5941da){if(_0x5941da){return _0x5941da?{'count':_0x3d8592,'rows':_0x5941da}:null;}})['then'](respondWithResult(_0x4cad9c,null))[_0xfcaa('0x27')](handleError(_0x4cad9c,null));}; \ No newline at end of file +var _0x4bd3=['addAgents','spread','isArray','getAgents','order','nolimit','bluebird','lodash','squel','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','then','get','FaxQueues','UserProfileResource','destroy','end','name','send','index','FaxQueue','rawAttributes','fieldName','key','getOptions','where','include','query','rows','model','keys','filters','attributes','fields','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','intersection','length','sort','pick','FaxQueueId','map','UserFaxQueue','findAll','User','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','filter','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4bd3,0x174));var _0x34bd=function(_0x3f5726,_0x5d636c){_0x3f5726=_0x3f5726-0x0;var _0x4e7bef=_0x4bd3[_0x3f5726];return _0x4e7bef;};'use strict';var BPromise=require(_0x34bd('0x0'));var util=require('util');var _=require(_0x34bd('0x1'));var squel=require(_0x34bd('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x34bd('0x3'));var config=require(_0x34bd('0x4'));var db=require(_0x34bd('0x5'))['db'];config['redis']=_[_0x34bd('0x6')](config[_0x34bd('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x34bd('0x8'))(new Redis(config[_0x34bd('0x7')]));require('./faxQueue.socket')[_0x34bd('0x9')](socket);function respondWithStatusCode(_0x76de8d,_0x3260ff){_0x3260ff=_0x3260ff||0xcc;return function(_0xed6181){if(_0xed6181){return _0x76de8d[_0x34bd('0xa')](_0x3260ff);}return _0x76de8d[_0x34bd('0xb')](_0x3260ff)['end']();};}function respondWithResult(_0x4102c1,_0x45322f){_0x45322f=_0x45322f||0xc8;return function(_0x282ea6){if(_0x282ea6){return _0x4102c1[_0x34bd('0xb')](_0x45322f)['json'](_0x282ea6);}};}function respondWithFilteredResult(_0x4a8622,_0x3da7a0){return function(_0x5e4ce7){if(_0x5e4ce7){var _0x4ac0dc=typeof _0x3da7a0[_0x34bd('0xc')]===_0x34bd('0xd')&&typeof _0x3da7a0[_0x34bd('0xe')]===_0x34bd('0xd');var _0x2ee180=_0x5e4ce7[_0x34bd('0xf')];var _0x4134ee=_0x4ac0dc?0x0:_0x3da7a0[_0x34bd('0xc')];var _0xf6d2f2=_0x4ac0dc?_0x5e4ce7['count']:_0x3da7a0[_0x34bd('0xc')]+_0x3da7a0['limit'];var _0x4e3886;if(_0xf6d2f2>=_0x2ee180){_0xf6d2f2=_0x2ee180;_0x4e3886=0xc8;}else{_0x4e3886=0xce;}_0x4a8622[_0x34bd('0xb')](_0x4e3886);return _0x4a8622[_0x34bd('0x10')](_0x34bd('0x11'),_0x4134ee+'-'+_0xf6d2f2+'/'+_0x2ee180)[_0x34bd('0x12')](_0x5e4ce7);}return null;};}function saveUpdates(_0x34b91b){return function(_0x1643af){if(_0x1643af){return _0x1643af[_0x34bd('0x13')](_0x34b91b)[_0x34bd('0x14')](function(_0x3b4bf8){return _0x3b4bf8;});}return null;};}function removeEntity(_0x72b197){return function(_0x4b5ebb){if(_0x4b5ebb){return _0x4b5ebb['destroy']()[_0x34bd('0x14')](function(){var _0x324f7d=_0x4b5ebb[_0x34bd('0x15')]({'plain':!![]});var _0x220666=_0x34bd('0x16');return db[_0x34bd('0x17')][_0x34bd('0x18')]({'where':{'type':_0x220666,'resourceId':_0x324f7d['id']}})[_0x34bd('0x14')](function(){return _0x4b5ebb;});})[_0x34bd('0x14')](function(){_0x72b197['status'](0xcc)[_0x34bd('0x19')]();});}};}function handleEntityNotFound(_0xe02cc5){return function(_0x49f625){if(!_0x49f625){_0xe02cc5[_0x34bd('0xa')](0x194);}return _0x49f625;};}function handleError(_0x463224,_0x5e0c06){_0x5e0c06=_0x5e0c06||0x1f4;return function(_0x582772){logger['error'](_0x582772['stack']);if(_0x582772[_0x34bd('0x1a')]){delete _0x582772['name'];}_0x463224[_0x34bd('0xb')](_0x5e0c06)[_0x34bd('0x1b')](_0x582772);};}exports[_0x34bd('0x1c')]=function(_0x5c3c85,_0x41bffd){var _0x14479a={};var _0x4f0dff={'count':0x0,'rows':[]};var _0x457006=_['map'](db[_0x34bd('0x1d')][_0x34bd('0x1e')],function(_0x264c94){return{'name':_0x264c94[_0x34bd('0x1f')],'type':_0x264c94['type'][_0x34bd('0x20')]};});_0x14479a=qs[_0x34bd('0x21')](_0x457006,_0x5c3c85);var _0x5d2e3d={'where':_0x14479a[_0x34bd('0x22')]};return db[_0x34bd('0x1d')][_0x34bd('0xf')](_0x5d2e3d)[_0x34bd('0x14')](function(_0x26b8e7){_0x4f0dff[_0x34bd('0xf')]=_0x26b8e7;_0x14479a[_0x34bd('0x23')]=qs['include'](_0x5c3c85[_0x34bd('0x24')]);return db[_0x34bd('0x1d')]['findAll'](_0x14479a);})['then'](function(_0x38bdba){_0x4f0dff[_0x34bd('0x25')]=_0x38bdba;return _0x4f0dff;})[_0x34bd('0x14')](respondWithFilteredResult(_0x41bffd,_0x14479a))['catch'](handleError(_0x41bffd,null));};exports['show']=function(_0x3cf514,_0x386ee6){var _0x1387b5={'raw':!![],'where':{'id':_0x3cf514['params']['id']}},_0x19eb5d={};_0x19eb5d[_0x34bd('0x26')]=_[_0x34bd('0x27')](db[_0x34bd('0x1d')][_0x34bd('0x1e')]);_0x19eb5d[_0x34bd('0x24')]=_[_0x34bd('0x27')](_0x3cf514['query']);_0x19eb5d[_0x34bd('0x28')]=_['intersection'](_0x19eb5d[_0x34bd('0x26')],_0x19eb5d[_0x34bd('0x24')]);_0x1387b5[_0x34bd('0x29')]=_['intersection'](_0x19eb5d[_0x34bd('0x26')],qs[_0x34bd('0x2a')](_0x3cf514['query'][_0x34bd('0x2a')]));_0x1387b5[_0x34bd('0x29')]=_0x1387b5[_0x34bd('0x29')]['length']?_0x1387b5[_0x34bd('0x29')]:_0x19eb5d[_0x34bd('0x26')];if(_0x3cf514['query'][_0x34bd('0x2b')]){_0x1387b5[_0x34bd('0x23')]=[{'all':!![]}];}_0x1387b5=_[_0x34bd('0x2c')]({},_0x1387b5,_0x3cf514[_0x34bd('0x2d')]);return db[_0x34bd('0x1d')][_0x34bd('0x2e')](_0x1387b5)['then'](handleEntityNotFound(_0x386ee6,null))['then'](respondWithResult(_0x386ee6,null))['catch'](handleError(_0x386ee6,null));};exports[_0x34bd('0x2f')]=function(_0x1258cf,_0x5e30c5){return db['FaxQueue'][_0x34bd('0x2f')](_0x1258cf['body'],{})['then'](function(_0x86b626){var _0xb5a456=_0x1258cf[_0x34bd('0x30')][_0x34bd('0x15')]({'plain':!![]});if(!_0xb5a456)throw new Error(_0x34bd('0x31'));if(_0xb5a456['role']==='user'){var _0xd4edfa=_0x86b626['get']({'plain':!![]});var _0xce6bc6=_0x34bd('0x16');return db[_0x34bd('0x32')][_0x34bd('0x2e')]({'where':{'name':_0xce6bc6,'userProfileId':_0xb5a456[_0x34bd('0x33')]},'raw':!![]})['then'](function(_0x282297){if(_0x282297&&_0x282297[_0x34bd('0x34')]===0x0){return db[_0x34bd('0x17')][_0x34bd('0x2f')]({'name':_0xd4edfa['name'],'resourceId':_0xd4edfa['id'],'type':_0x282297[_0x34bd('0x1a')],'sectionId':_0x282297['id']},{})['then'](function(){return _0x86b626;});}else{return _0x86b626;}})[_0x34bd('0x35')](function(_0x560282){logger['error'](_0x34bd('0x36'),_0x560282);throw _0x560282;});}return _0x86b626;})['then'](respondWithResult(_0x5e30c5,0xc9))[_0x34bd('0x35')](handleError(_0x5e30c5,null));};exports[_0x34bd('0x13')]=function(_0x18e9f6,_0x42a424){if(_0x18e9f6[_0x34bd('0x37')]['id']){delete _0x18e9f6[_0x34bd('0x37')]['id'];}return db[_0x34bd('0x1d')]['find']({'where':{'id':_0x18e9f6['params']['id']}})['then'](handleEntityNotFound(_0x42a424,null))[_0x34bd('0x14')](saveUpdates(_0x18e9f6[_0x34bd('0x37')],null))[_0x34bd('0x14')](respondWithResult(_0x42a424,null))[_0x34bd('0x35')](handleError(_0x42a424,null));};exports['destroy']=function(_0x412fa5,_0x148abe){return db[_0x34bd('0x1d')][_0x34bd('0x2e')]({'where':{'id':_0x412fa5[_0x34bd('0x38')]['id']}})['then'](handleEntityNotFound(_0x148abe,null))[_0x34bd('0x14')](removeEntity(_0x148abe,null))['catch'](handleError(_0x148abe,null));};exports['describe']=function(_0x1c637f,_0x53a114){return db[_0x34bd('0x1d')][_0x34bd('0x39')]()[_0x34bd('0x14')](respondWithResult(_0x53a114,null))[_0x34bd('0x35')](handleError(_0x53a114,null));};exports[_0x34bd('0x3a')]=function(_0x5b061a,_0x4d22ff){var _0x33e8e8={'raw':!![],'where':{}},_0x51f892={},_0x1f3db3;return db[_0x34bd('0x1d')][_0x34bd('0x3b')]({'where':{'id':_0x5b061a['params']['id']}})['then'](handleEntityNotFound(_0x4d22ff,null))['then'](function(_0x5a68f3){if(_0x5a68f3){_0x1f3db3=_0x5a68f3[_0x34bd('0x15')]({'plain':!![]});_0x51f892['model']=_[_0x34bd('0x27')](db['UserFaxQueue'][_0x34bd('0x1e')]);_0x51f892[_0x34bd('0x24')]=_[_0x34bd('0x27')](_0x5b061a[_0x34bd('0x24')]);_0x51f892[_0x34bd('0x28')]=_['intersection'](_0x51f892[_0x34bd('0x26')],_0x51f892[_0x34bd('0x24')]);_0x33e8e8[_0x34bd('0x29')]=_[_0x34bd('0x3c')](_0x51f892[_0x34bd('0x26')],qs['fields'](_0x5b061a[_0x34bd('0x24')][_0x34bd('0x2a')]));_0x33e8e8['attributes']=_0x33e8e8[_0x34bd('0x29')][_0x34bd('0x3d')]?_0x33e8e8['attributes']:_0x51f892['model'];if(!_0x5b061a[_0x34bd('0x24')]['hasOwnProperty']('nolimit')){_0x33e8e8[_0x34bd('0xe')]=qs[_0x34bd('0xe')](_0x5b061a['query']['limit']);_0x33e8e8['offset']=qs['offset'](_0x5b061a[_0x34bd('0x24')][_0x34bd('0xc')]);}_0x33e8e8['order']=qs['sort'](_0x5b061a['query'][_0x34bd('0x3e')]);_0x33e8e8[_0x34bd('0x22')]=qs['filters'](_[_0x34bd('0x3f')](_0x5b061a[_0x34bd('0x24')],_0x51f892[_0x34bd('0x28')]));_0x33e8e8[_0x34bd('0x22')][_0x34bd('0x40')]=_0x5a68f3['id'];if(_0x5b061a[_0x34bd('0x24')]['filter']){_0x33e8e8[_0x34bd('0x22')]=_[_0x34bd('0x2c')](_0x33e8e8[_0x34bd('0x22')],{'$or':_[_0x34bd('0x41')](_0x33e8e8['attributes'],function(_0x1b8b37){var _0x5235e4={};_0x5235e4[_0x1b8b37]={'$like':'%'+_0x5b061a[_0x34bd('0x24')]['filter']+'%'};return _0x5235e4;})});}_0x33e8e8=_[_0x34bd('0x2c')]({},_0x33e8e8,_0x5b061a[_0x34bd('0x2d')]);return db[_0x34bd('0x42')][_0x34bd('0x43')](_0x33e8e8);}})[_0x34bd('0x14')](function(_0x418fa5){if(_0x418fa5){return db[_0x34bd('0x44')][_0x34bd('0x45')]({'where':{'id':_[_0x34bd('0x41')](_0x418fa5,_0x34bd('0x46')),'role':_0x34bd('0x47')},'attributes':['id','name',_0x34bd('0x48'),'updatedAt',_0x34bd('0x49')]});}})['then'](function(_0x3fc297){if(_0x3fc297){return{'count':_0x3fc297['count'],'rows':_[_0x34bd('0x41')](_0x3fc297[_0x34bd('0x25')],function(_0x2da924){return{'membername':_0x2da924[_0x34bd('0x1a')],'UserId':_0x2da924['id'],'queue_name':_0x1f3db3[_0x34bd('0x1a')],'FaxQueueId':_0x1f3db3['id'],'interface':util[_0x34bd('0x4a')](_0x34bd('0x4b'),_0x34bd('0x4c'),_0x2da924[_0x34bd('0x1a')]),'penalty':0x0,'paused':_0x2da924[_0x34bd('0x48')],'createdAt':_0x2da924[_0x34bd('0x49')],'updatedAt':_0x2da924[_0x34bd('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x34bd('0x14')](respondWithFilteredResult(_0x4d22ff,_0x33e8e8))[_0x34bd('0x35')](handleError(_0x4d22ff,null));};exports[_0x34bd('0x4e')]=function(_0x4a0c28,_0x5c5766){var _0x246c52={};var _0x79e6b4={};var _0x352f17;var _0x3e8c8e;return db[_0x34bd('0x1d')]['findOne']({'where':{'id':_0x4a0c28['params']['id']}})['then'](handleEntityNotFound(_0x5c5766,null))['then'](function(_0x24c635){if(_0x24c635){_0x352f17=_0x24c635;_0x79e6b4[_0x34bd('0x26')]=_['keys'](db[_0x34bd('0x4f')][_0x34bd('0x1e')]);_0x79e6b4[_0x34bd('0x24')]=_['keys'](_0x4a0c28[_0x34bd('0x24')]);_0x79e6b4[_0x34bd('0x28')]=_[_0x34bd('0x3c')](_0x79e6b4[_0x34bd('0x26')],_0x79e6b4[_0x34bd('0x24')]);_0x246c52[_0x34bd('0x29')]=_[_0x34bd('0x3c')](_0x79e6b4[_0x34bd('0x26')],qs['fields'](_0x4a0c28['query'][_0x34bd('0x2a')]));_0x246c52['attributes']=_0x246c52[_0x34bd('0x29')][_0x34bd('0x3d')]?_0x246c52[_0x34bd('0x29')]:_0x79e6b4['model'];_0x246c52['order']=qs[_0x34bd('0x3e')](_0x4a0c28[_0x34bd('0x24')][_0x34bd('0x3e')]);_0x246c52['where']=qs['filters'](_[_0x34bd('0x3f')](_0x4a0c28[_0x34bd('0x24')],_0x79e6b4[_0x34bd('0x28')]));if(_0x4a0c28[_0x34bd('0x24')][_0x34bd('0x50')]){_0x246c52[_0x34bd('0x22')]=_[_0x34bd('0x2c')](_0x246c52[_0x34bd('0x22')],{'$or':_[_0x34bd('0x41')](_0x246c52['attributes'],function(_0x4d3118){var _0x3878a0={};_0x3878a0[_0x4d3118]={'$like':'%'+_0x4a0c28['query'][_0x34bd('0x50')]+'%'};return _0x3878a0;})});}_0x246c52=_[_0x34bd('0x2c')]({},_0x246c52,_0x4a0c28[_0x34bd('0x2d')]);return _0x352f17[_0x34bd('0x4e')](_0x246c52);}})['then'](function(_0x50ae2e){if(_0x50ae2e){_0x3e8c8e=_0x50ae2e[_0x34bd('0x3d')];if(!_0x4a0c28[_0x34bd('0x24')][_0x34bd('0x51')]('nolimit')){_0x246c52[_0x34bd('0xe')]=qs['limit'](_0x4a0c28[_0x34bd('0x24')][_0x34bd('0xe')]);_0x246c52[_0x34bd('0xc')]=qs['offset'](_0x4a0c28[_0x34bd('0x24')]['offset']);}return _0x352f17['getTeams'](_0x246c52);}})[_0x34bd('0x14')](function(_0x12ae13){if(_0x12ae13){return _0x12ae13?{'count':_0x3e8c8e,'rows':_0x12ae13}:null;}})[_0x34bd('0x14')](respondWithResult(_0x5c5766,null))['catch'](handleError(_0x5c5766,null));};exports[_0x34bd('0x52')]=function(_0x23ac17,_0xff33cb){var _0x50c5a2=_0x23ac17[_0x34bd('0x37')][_0x34bd('0x53')];return db[_0x34bd('0x4f')][_0x34bd('0x43')]({'where':{'id':_0x50c5a2},'attributes':['id'],'include':[{'model':db[_0x34bd('0x44')],'as':_0x34bd('0x54'),'attributes':['id',_0x34bd('0x1a'),_0x34bd('0x55'),_0x34bd('0x56'),_0x34bd('0x57')],'raw':!![]}]})[_0x34bd('0x14')](function(_0x59e377){if(_0x59e377){var _0x24e164=_['flatMap'](_0x59e377,function(_0x46e98d){var _0x51459d=_0x46e98d[_0x34bd('0x15')]({'plain':!![]});return _0x51459d[_0x34bd('0x54')];});return db[_0x34bd('0x1d')][_0x34bd('0x2e')]({'where':{'id':_0x23ac17[_0x34bd('0x38')]['id']}})[_0x34bd('0x14')](function(_0x27adad){return db[_0x34bd('0x58')][_0x34bd('0x59')](function(_0x23f5a6){return _0x27adad['addTeams'](_0x50c5a2,{'transaction':_0x23f5a6})['then'](function(){return BPromise[_0x34bd('0x5a')](_0x24e164,function(_0x31b313){return db[_0x34bd('0x42')]['findOrCreate']({'where':{'UserId':_0x31b313['id'],'FaxQueueId':_0x23ac17['params']['id']},'transaction':_0x23f5a6});});})['then'](function(){_0x24e164[_0x34bd('0x5b')](function(_0x190614){socket[_0x34bd('0x5c')](_0x34bd('0x5d'),{'UserId':_0x190614['id'],'FaxQueueId':_0x27adad['id']});});});});});}})[_0x34bd('0x14')](respondWithStatusCode(_0xff33cb,null))['catch'](handleError(_0xff33cb,null));};exports[_0x34bd('0x5e')]=function(_0x4d94d0,_0x4732f5){return db[_0x34bd('0x4f')]['findAll']({'where':{'id':_0x4d94d0[_0x34bd('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0x34bd('0x44')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x34bd('0x14')](handleEntityNotFound(_0x4732f5,null))['then'](function(_0x397396){var _0x38f6f2=_[_0x34bd('0x41')](_0x397396,'id');var _0x35d257=[];var _0x2de8a0=[];var _0x34bb6d=squel[_0x34bd('0x5f')]();_0x34bb6d[_0x34bd('0x60')]('tq.TeamId')[_0x34bd('0x61')](_0x34bd('0x62'),'tq')[_0x34bd('0x63')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x34bd('0x64'),_0x4d94d0[_0x34bd('0x38')]['id']);for(var _0x56935e=0x0;_0x56935e<_0x397396[_0x34bd('0x3d')];_0x56935e+=0x1){let _0x5d0621=_0x397396[_0x56935e];for(var _0x2ccc12=0x0;_0x2ccc12<_0x5d0621[_0x34bd('0x54')][_0x34bd('0x3d')];_0x2ccc12+=0x1){let _0x4c6508=_0x5d0621[_0x34bd('0x54')][_0x2ccc12];var _0x4a05cb=_0x34bb6d[_0x34bd('0x65')]();_0x4a05cb[_0x34bd('0x22')](_0x34bd('0x66'),_0x4c6508['id']);_0x2de8a0[_0x34bd('0x67')](db[_0x34bd('0x58')][_0x34bd('0x24')](_0x4a05cb[_0x34bd('0x68')](),{'type':db[_0x34bd('0x58')][_0x34bd('0x69')][_0x34bd('0x6a')]})[_0x34bd('0x14')](function(_0x23ca28){if(_0x23ca28[_0x34bd('0x3d')]===0x1){return _0x4c6508['id'];}else{var _0x48d9b9=_['every'](_[_0x34bd('0x41')](_0x23ca28,_0x34bd('0x6b')),function(_0x19341e){return _[_0x34bd('0x6c')](_0x38f6f2,_0x19341e);});if(_0x48d9b9){return _0x4c6508['id'];}}}));}}return BPromise[_0x34bd('0x6d')](_0x2de8a0)['then'](function(_0x1799dd){_0x35d257=_(_0x35d257)[_0x34bd('0x6e')](_0x1799dd)[_0x34bd('0x6f')]()[_0x34bd('0x70')]();return db['FaxQueue'][_0x34bd('0x2e')]({'where':{'id':_0x4d94d0['params']['id']}})['then'](function(_0x49ba99){return db['sequelize'][_0x34bd('0x59')](function(_0x1a1111){return _0x49ba99[_0x34bd('0x5e')](_0x4d94d0['query'][_0x34bd('0x53')],{'transaction':_0x1a1111})[_0x34bd('0x14')](function(){if(!_[_0x34bd('0x71')](_0x35d257)){return _0x49ba99[_0x34bd('0x72')](_0x35d257,{'transaction':_0x1a1111});}})[_0x34bd('0x14')](function(){_0x35d257[_0x34bd('0x5b')](function(_0x4624fc){socket[_0x34bd('0x5c')](_0x34bd('0x73'),{'UserId':_0x4624fc,'FaxQueueId':_0x49ba99['id']});});});});});});})[_0x34bd('0x14')](respondWithStatusCode(_0x4732f5,null))[_0x34bd('0x35')](handleError(_0x4732f5,null));};exports['addAgents']=function(_0x5403fa,_0x26620a){return db['FaxQueue'][_0x34bd('0x2e')]({'where':{'id':_0x5403fa[_0x34bd('0x38')]['id']}})[_0x34bd('0x14')](handleEntityNotFound(_0x26620a,null))[_0x34bd('0x14')](function(_0x22aa49){if(_0x22aa49){return _0x22aa49[_0x34bd('0x74')](_0x5403fa[_0x34bd('0x37')][_0x34bd('0x53')],_['omit'](_0x5403fa[_0x34bd('0x37')],[_0x34bd('0x53'),'id'])||{})[_0x34bd('0x75')](function(_0x533f32){for(var _0x2b56eb=0x0;_0x2b56eb<_0x5403fa[_0x34bd('0x37')][_0x34bd('0x53')][_0x34bd('0x3d')];_0x2b56eb+=0x1){socket['emit'](_0x34bd('0x5d'),{'UserId':Number(_0x5403fa[_0x34bd('0x37')][_0x34bd('0x53')][_0x2b56eb]),'FaxQueueId':Number(_0x5403fa[_0x34bd('0x38')]['id'])});}return _0x533f32;});}})[_0x34bd('0x14')](respondWithResult(_0x26620a,null))[_0x34bd('0x35')](handleError(_0x26620a,null));};exports[_0x34bd('0x72')]=function(_0x193f37,_0x15651a){return db[_0x34bd('0x1d')]['find']({'where':{'id':_0x193f37[_0x34bd('0x38')]['id']}})[_0x34bd('0x14')](handleEntityNotFound(_0x15651a,null))[_0x34bd('0x14')](function(_0x1e9839){if(_0x1e9839){return _0x1e9839[_0x34bd('0x72')](_0x193f37[_0x34bd('0x24')][_0x34bd('0x53')])[_0x34bd('0x14')](function(){if(_[_0x34bd('0x76')](_0x193f37[_0x34bd('0x24')][_0x34bd('0x53')])){for(var _0x1d735f=0x0;_0x1d735f<_0x193f37[_0x34bd('0x24')][_0x34bd('0x53')]['length'];_0x1d735f+=0x1){socket[_0x34bd('0x5c')]('userFaxQueue:remove',{'UserId':Number(_0x193f37[_0x34bd('0x24')][_0x34bd('0x53')][_0x1d735f]),'FaxQueueId':Number(_0x193f37[_0x34bd('0x38')]['id'])});}}else{socket[_0x34bd('0x5c')](_0x34bd('0x73'),{'UserId':Number(_0x193f37[_0x34bd('0x24')][_0x34bd('0x53')]),'FaxQueueId':Number(_0x193f37[_0x34bd('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x15651a,null))[_0x34bd('0x35')](handleError(_0x15651a,null));};exports[_0x34bd('0x77')]=function(_0x3efd93,_0x4d510d){var _0x4519eb={};var _0x58d4b4={};var _0x288b12;var _0x44c6ae;return db['FaxQueue'][_0x34bd('0x3b')]({'where':{'id':_0x3efd93[_0x34bd('0x38')]['id']}})[_0x34bd('0x14')](handleEntityNotFound(_0x4d510d,null))[_0x34bd('0x14')](function(_0x2b8917){if(_0x2b8917){_0x288b12=_0x2b8917;_0x58d4b4['model']=_[_0x34bd('0x27')](db['User']['rawAttributes']);_0x58d4b4[_0x34bd('0x24')]=_[_0x34bd('0x27')](_0x3efd93[_0x34bd('0x24')]);_0x58d4b4['filters']=_[_0x34bd('0x3c')](_0x58d4b4['model'],_0x58d4b4[_0x34bd('0x24')]);_0x4519eb[_0x34bd('0x29')]=_['intersection'](_0x58d4b4['model'],qs['fields'](_0x3efd93[_0x34bd('0x24')][_0x34bd('0x2a')]));_0x4519eb['attributes']=_0x4519eb[_0x34bd('0x29')]['length']?_0x4519eb[_0x34bd('0x29')]:_0x58d4b4[_0x34bd('0x26')];_0x4519eb[_0x34bd('0x78')]=qs[_0x34bd('0x3e')](_0x3efd93[_0x34bd('0x24')][_0x34bd('0x3e')]);_0x4519eb[_0x34bd('0x22')]=qs[_0x34bd('0x28')](_['pick'](_0x3efd93[_0x34bd('0x24')],_0x58d4b4[_0x34bd('0x28')]));if(_0x3efd93[_0x34bd('0x24')][_0x34bd('0x50')]){_0x4519eb[_0x34bd('0x22')]=_[_0x34bd('0x2c')](_0x4519eb[_0x34bd('0x22')],{'$or':_[_0x34bd('0x41')](_0x4519eb[_0x34bd('0x29')],function(_0x7cf676){var _0x499703={};_0x499703[_0x7cf676]={'$like':'%'+_0x3efd93[_0x34bd('0x24')]['filter']+'%'};return _0x499703;})});}_0x4519eb=_['merge']({},_0x4519eb,_0x3efd93[_0x34bd('0x2d')]);return _0x288b12[_0x34bd('0x77')](_0x4519eb);}})[_0x34bd('0x14')](function(_0x19671c){if(_0x19671c){_0x44c6ae=_0x19671c['length'];if(!_0x3efd93[_0x34bd('0x24')][_0x34bd('0x51')](_0x34bd('0x79'))){_0x4519eb[_0x34bd('0xe')]=qs['limit'](_0x3efd93['query'][_0x34bd('0xe')]);_0x4519eb[_0x34bd('0xc')]=qs['offset'](_0x3efd93[_0x34bd('0x24')][_0x34bd('0xc')]);}return _0x288b12['getAgents'](_0x4519eb);}})[_0x34bd('0x14')](function(_0x268718){if(_0x268718){return _0x268718?{'count':_0x44c6ae,'rows':_0x268718}:null;}})[_0x34bd('0x14')](respondWithResult(_0x4d510d,null))[_0x34bd('0x35')](handleError(_0x4d510d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 3b4a31f..7b1fb92 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 _0xf40c=['setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','FaxQueue'];(function(_0x34762e,_0x255fef){var _0x5dabd2=function(_0x47d94d){while(--_0x47d94d){_0x34762e['push'](_0x34762e['shift']());}};_0x5dabd2(++_0x255fef);}(_0xf40c,0x9e));var _0xcf40=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0xf40c[_0x234ae1];return _0x227ba0;};'use strict';var EventEmitter=require(_0xcf40('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xcf40('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xcf40('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xcf40('0x3')};function emitEvent(_0x214a64){return function(_0x5bc276,_0x4d2e30,_0x304711){FaxQueueEvents[_0xcf40('0x4')](_0x214a64+':'+_0x5bc276['id'],_0x5bc276);FaxQueueEvents[_0xcf40('0x4')](_0x214a64,_0x5bc276);_0x304711(null);};}for(var e in events){if(events[_0xcf40('0x5')](e)){var event=events[e];FaxQueue[_0xcf40('0x6')](e,emitEvent(event));}}module[_0xcf40('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x0242=['save','update','remove','emit','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0242,0xcc));var _0x2024=function(_0x313927,_0x2b3a6d){_0x313927=_0x313927-0x0;var _0x545b28=_0x0242[_0x313927];return _0x545b28;};'use strict';var EventEmitter=require(_0x2024('0x0'));var FaxQueue=require(_0x2024('0x1'))['db'][_0x2024('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2024('0x3')](0x0);var events={'afterCreate':_0x2024('0x4'),'afterUpdate':_0x2024('0x5'),'afterDestroy':_0x2024('0x6')};function emitEvent(_0x2d11dd){return function(_0x423959,_0x1b3afc,_0x1e2bb8){FaxQueueEvents[_0x2024('0x7')](_0x2d11dd+':'+_0x423959['id'],_0x423959);FaxQueueEvents[_0x2024('0x7')](_0x2d11dd,_0x423959);_0x1e2bb8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 37e111a..48a9145 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 _0x81c1=['fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3509d4,_0x1d733e){var _0x5c7984=function(_0x1f1aff){while(--_0x1f1aff){_0x3509d4['push'](_0x3509d4['shift']());}};_0x5c7984(++_0x1d733e);}(_0x81c1,0x90));var _0x181c=function(_0x3a7c98,_0x25f0a6){_0x3a7c98=_0x3a7c98-0x0;var _0x33ad34=_0x81c1[_0x3a7c98];return _0x33ad34;};'use strict';var _=require(_0x181c('0x0'));var util=require(_0x181c('0x1'));var logger=require(_0x181c('0x2'))(_0x181c('0x3'));var moment=require(_0x181c('0x4'));var BPromise=require(_0x181c('0x5'));var rp=require(_0x181c('0x6'));var fs=require('fs');var path=require(_0x181c('0x7'));var rimraf=require(_0x181c('0x8'));var config=require(_0x181c('0x9'));var attributes=require('./faxQueue.attributes');module[_0x181c('0xa')]=function(_0x1acdc,_0x2f25ec){return _0x1acdc[_0x181c('0xb')]('FaxQueue',attributes,{'tableName':_0x181c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa993=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','util','api','moment','bluebird','request-promise'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0xa993,0x16d));var _0x3a99=function(_0x15d56d,_0xfab3d7){_0x15d56d=_0x15d56d-0x0;var _0x5e78d8=_0xa993[_0x15d56d];return _0x5e78d8;};'use strict';var _=require('lodash');var util=require(_0x3a99('0x0'));var logger=require('../../config/logger')(_0x3a99('0x1'));var moment=require(_0x3a99('0x2'));var BPromise=require(_0x3a99('0x3'));var rp=require(_0x3a99('0x4'));var fs=require('fs');var path=require(_0x3a99('0x5'));var rimraf=require(_0x3a99('0x6'));var config=require(_0x3a99('0x7'));var attributes=require(_0x3a99('0x8'));module[_0x3a99('0x9')]=function(_0x4e3057,_0x2380f4){return _0x4e3057['define']('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ce53673..7a8f3d7 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 _0x863f=['model','ShowFaxQueue','find','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x863f,0x18a));var _0xf863=function(_0x3c5ceb,_0xafb909){_0x3c5ceb=_0x3c5ceb-0x0;var _0x5e6d75=_0x863f[_0x3c5ceb];return _0x5e6d75;};'use strict';var _=require(_0xf863('0x0'));var util=require(_0xf863('0x1'));var moment=require('moment');var BPromise=require(_0xf863('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf863('0x3'));var db=require(_0xf863('0x4'))['db'];var utils=require(_0xf863('0x5'));var logger=require('../../config/logger')(_0xf863('0x6'));var config=require(_0xf863('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf863('0x8')][_0xf863('0x9')]({'port':0x232a});config[_0xf863('0xa')]=_[_0xf863('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf863('0xc'))(new Redis(config['redis']));require(_0xf863('0xd'))['register'](socket);function respondWithRpcPromise(_0x42932a,_0x1ebf0f,_0x1a34b1){return new BPromise(function(_0x2ceedf,_0x5573b1){return client['request'](_0x42932a,_0x1a34b1)[_0xf863('0xe')](function(_0x3b0bca){logger['info'](_0xf863('0xf'),_0x1ebf0f,_0xf863('0x10'));logger[_0xf863('0x11')](_0xf863('0x12'),_0x1ebf0f,_0xf863('0x10'),JSON['stringify'](_0x3b0bca));if(_0x3b0bca[_0xf863('0x13')]){if(_0x3b0bca[_0xf863('0x13')][_0xf863('0x14')]===0x1f4){logger[_0xf863('0x13')](_0xf863('0xf'),_0x1ebf0f,_0x3b0bca[_0xf863('0x13')][_0xf863('0x15')]);return _0x5573b1(_0x3b0bca[_0xf863('0x13')][_0xf863('0x15')]);}logger[_0xf863('0x13')](_0xf863('0xf'),_0x1ebf0f,_0x3b0bca[_0xf863('0x13')][_0xf863('0x15')]);return _0x2ceedf(_0x3b0bca[_0xf863('0x13')][_0xf863('0x15')]);}else{logger[_0xf863('0x16')](_0xf863('0xf'),_0x1ebf0f,_0xf863('0x10'));_0x2ceedf(_0x3b0bca[_0xf863('0x17')]['message']);}})[_0xf863('0x18')](function(_0x4833df){logger[_0xf863('0x13')](_0xf863('0xf'),_0x1ebf0f,_0x4833df);_0x5573b1(_0x4833df);});});}exports[_0xf863('0x19')]=function(_0x10c9fd){var _0x196fd5=this;return new Promise(function(_0x3dff6c,_0x5028){return db[_0xf863('0x1a')][_0xf863('0x1b')]({'raw':_0x10c9fd[_0xf863('0x1c')]?_0x10c9fd[_0xf863('0x1c')][_0xf863('0x1d')]===undefined?!![]:![]:!![],'where':_0x10c9fd[_0xf863('0x1c')]?_0x10c9fd[_0xf863('0x1c')][_0xf863('0x1e')]||null:null,'attributes':_0x10c9fd[_0xf863('0x1c')]?_0x10c9fd[_0xf863('0x1c')][_0xf863('0x1f')]||null:null,'limit':_0x10c9fd[_0xf863('0x1c')]?_0x10c9fd[_0xf863('0x1c')][_0xf863('0x20')]||null:null,'include':_0x10c9fd['options']?_0x10c9fd[_0xf863('0x1c')]['include']?_[_0xf863('0x21')](_0x10c9fd['options'][_0xf863('0x22')],function(_0xa91d6a){return{'model':db[_0xa91d6a['model']],'as':_0xa91d6a['as'],'attributes':_0xa91d6a[_0xf863('0x1f')],'include':_0xa91d6a[_0xf863('0x22')]?_[_0xf863('0x21')](_0xa91d6a[_0xf863('0x22')],function(_0x5dfadd){return{'model':db[_0x5dfadd['model']],'as':_0x5dfadd['as'],'attributes':_0x5dfadd['attributes'],'include':_0x5dfadd[_0xf863('0x22')]?_['map'](_0x5dfadd[_0xf863('0x22')],function(_0x1bbfc5){return{'model':db[_0x1bbfc5[_0xf863('0x23')]],'as':_0x1bbfc5['as'],'attributes':_0x1bbfc5[_0xf863('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf863('0xe')](function(_0x2dd9f8){logger[_0xf863('0x16')](_0xf863('0x19'),_0x10c9fd);logger[_0xf863('0x11')](_0xf863('0x19'),_0x10c9fd,JSON['stringify'](_0x2dd9f8));_0x3dff6c(_0x2dd9f8);})['catch'](function(_0x591100){logger[_0xf863('0x13')]('GetFaxQueue',_0x591100[_0xf863('0x15')],_0x10c9fd);_0x5028(_0x196fd5['error'](0x1f4,_0x591100[_0xf863('0x15')]));});});};exports[_0xf863('0x24')]=function(_0x415bb1){var _0xb28615=this;return new Promise(function(_0xfe61d,_0xebf0cf){return db['FaxQueue'][_0xf863('0x25')]({'raw':_0x415bb1['options']?_0x415bb1[_0xf863('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x415bb1[_0xf863('0x1c')]?_0x415bb1[_0xf863('0x1c')][_0xf863('0x1e')]||null:null,'attributes':_0x415bb1[_0xf863('0x1c')]?_0x415bb1[_0xf863('0x1c')][_0xf863('0x1f')]||null:null,'include':_0x415bb1['options']?_0x415bb1[_0xf863('0x1c')][_0xf863('0x22')]?_['map'](_0x415bb1[_0xf863('0x1c')][_0xf863('0x22')],function(_0x1047f6){return{'model':db[_0x1047f6[_0xf863('0x23')]],'as':_0x1047f6['as'],'attributes':_0x1047f6['attributes'],'include':_0x1047f6[_0xf863('0x22')]?_['map'](_0x1047f6[_0xf863('0x22')],function(_0xfc1ff7){return{'model':db[_0xfc1ff7[_0xf863('0x23')]],'as':_0xfc1ff7['as'],'attributes':_0xfc1ff7[_0xf863('0x1f')],'include':_0xfc1ff7[_0xf863('0x22')]?_[_0xf863('0x21')](_0xfc1ff7[_0xf863('0x22')],function(_0x9b0829){return{'model':db[_0x9b0829[_0xf863('0x23')]],'as':_0x9b0829['as'],'attributes':_0x9b0829['attributes']};}):[]};}):[]};}):[]:[]})[_0xf863('0xe')](function(_0x48f082){logger[_0xf863('0x16')](_0xf863('0x24'),_0x415bb1);logger['debug'](_0xf863('0x24'),_0x415bb1,JSON[_0xf863('0x26')](_0x48f082));_0xfe61d(_0x48f082);})[_0xf863('0x18')](function(_0x203a5e){logger['error'](_0xf863('0x24'),_0x203a5e[_0xf863('0x15')],_0x415bb1);_0xebf0cf(_0xb28615['error'](0x1f4,_0x203a5e[_0xf863('0x15')]));});});}; \ No newline at end of file +var _0xc8fe=['findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','debug','FaxQueue','find','ShowFaxQueue','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','register','request','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc8fe,0x180));var _0xec8f=function(_0x33ee3b,_0x4fbfec){_0x33ee3b=_0x33ee3b-0x0;var _0x4b07a9=_0xc8fe[_0x33ee3b];return _0x4b07a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xec8f('0x0'));var rs=require(_0xec8f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec8f('0x2'))['db'];var utils=require(_0xec8f('0x3'));var logger=require(_0xec8f('0x4'))(_0xec8f('0x5'));var config=require(_0xec8f('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xec8f('0x7')][_0xec8f('0x8')]({'port':0x232a});config[_0xec8f('0x9')]=_[_0xec8f('0xa')](config[_0xec8f('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xec8f('0xb')](socket);function respondWithRpcPromise(_0x19c96c,_0x4f1e17,_0x4d2496){return new BPromise(function(_0x308aaf,_0x37a12d){return client[_0xec8f('0xc')](_0x19c96c,_0x4d2496)[_0xec8f('0xd')](function(_0x47f889){logger[_0xec8f('0xe')](_0xec8f('0xf'),_0x4f1e17,'request\x20sent');logger['debug'](_0xec8f('0x10'),_0x4f1e17,_0xec8f('0x11'),JSON[_0xec8f('0x12')](_0x47f889));if(_0x47f889[_0xec8f('0x13')]){if(_0x47f889[_0xec8f('0x13')]['code']===0x1f4){logger[_0xec8f('0x13')](_0xec8f('0xf'),_0x4f1e17,_0x47f889[_0xec8f('0x13')][_0xec8f('0x14')]);return _0x37a12d(_0x47f889[_0xec8f('0x13')][_0xec8f('0x14')]);}logger['error'](_0xec8f('0xf'),_0x4f1e17,_0x47f889[_0xec8f('0x13')][_0xec8f('0x14')]);return _0x308aaf(_0x47f889[_0xec8f('0x13')]['message']);}else{logger[_0xec8f('0xe')](_0xec8f('0xf'),_0x4f1e17,_0xec8f('0x11'));_0x308aaf(_0x47f889[_0xec8f('0x15')][_0xec8f('0x14')]);}})[_0xec8f('0x16')](function(_0x120193){logger['error'](_0xec8f('0xf'),_0x4f1e17,_0x120193);_0x37a12d(_0x120193);});});}exports['GetFaxQueue']=function(_0x438147){var _0x3cb48c=this;return new Promise(function(_0x245d02,_0x409a22){return db['FaxQueue'][_0xec8f('0x17')]({'raw':_0x438147[_0xec8f('0x18')]?_0x438147[_0xec8f('0x18')][_0xec8f('0x19')]===undefined?!![]:![]:!![],'where':_0x438147['options']?_0x438147[_0xec8f('0x18')][_0xec8f('0x1a')]||null:null,'attributes':_0x438147['options']?_0x438147[_0xec8f('0x18')][_0xec8f('0x1b')]||null:null,'limit':_0x438147[_0xec8f('0x18')]?_0x438147[_0xec8f('0x18')][_0xec8f('0x1c')]||null:null,'include':_0x438147[_0xec8f('0x18')]?_0x438147[_0xec8f('0x18')][_0xec8f('0x1d')]?_['map'](_0x438147[_0xec8f('0x18')]['include'],function(_0x3d40a3){return{'model':db[_0x3d40a3['model']],'as':_0x3d40a3['as'],'attributes':_0x3d40a3[_0xec8f('0x1b')],'include':_0x3d40a3['include']?_[_0xec8f('0x1e')](_0x3d40a3['include'],function(_0x461099){return{'model':db[_0x461099[_0xec8f('0x1f')]],'as':_0x461099['as'],'attributes':_0x461099[_0xec8f('0x1b')],'include':_0x461099[_0xec8f('0x1d')]?_[_0xec8f('0x1e')](_0x461099[_0xec8f('0x1d')],function(_0x33ee18){return{'model':db[_0x33ee18[_0xec8f('0x1f')]],'as':_0x33ee18['as'],'attributes':_0x33ee18[_0xec8f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xec8f('0xd')](function(_0x72645c){logger['info'](_0xec8f('0x20'),_0x438147);logger[_0xec8f('0x21')]('GetFaxQueue',_0x438147,JSON[_0xec8f('0x12')](_0x72645c));_0x245d02(_0x72645c);})[_0xec8f('0x16')](function(_0x51f8ee){logger[_0xec8f('0x13')]('GetFaxQueue',_0x51f8ee[_0xec8f('0x14')],_0x438147);_0x409a22(_0x3cb48c[_0xec8f('0x13')](0x1f4,_0x51f8ee[_0xec8f('0x14')]));});});};exports['ShowFaxQueue']=function(_0x15839a){var _0x16179b=this;return new Promise(function(_0x221756,_0x3c19ac){return db[_0xec8f('0x22')][_0xec8f('0x23')]({'raw':_0x15839a[_0xec8f('0x18')]?_0x15839a[_0xec8f('0x18')][_0xec8f('0x19')]===undefined?!![]:![]:!![],'where':_0x15839a['options']?_0x15839a[_0xec8f('0x18')][_0xec8f('0x1a')]||null:null,'attributes':_0x15839a[_0xec8f('0x18')]?_0x15839a[_0xec8f('0x18')][_0xec8f('0x1b')]||null:null,'include':_0x15839a['options']?_0x15839a['options']['include']?_[_0xec8f('0x1e')](_0x15839a['options'][_0xec8f('0x1d')],function(_0x42b76a){return{'model':db[_0x42b76a[_0xec8f('0x1f')]],'as':_0x42b76a['as'],'attributes':_0x42b76a[_0xec8f('0x1b')],'include':_0x42b76a['include']?_['map'](_0x42b76a['include'],function(_0x32dd91){return{'model':db[_0x32dd91['model']],'as':_0x32dd91['as'],'attributes':_0x32dd91[_0xec8f('0x1b')],'include':_0x32dd91[_0xec8f('0x1d')]?_['map'](_0x32dd91[_0xec8f('0x1d')],function(_0x54c740){return{'model':db[_0x54c740[_0xec8f('0x1f')]],'as':_0x54c740['as'],'attributes':_0x54c740['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ee273){logger[_0xec8f('0xe')]('ShowFaxQueue',_0x15839a);logger['debug'](_0xec8f('0x24'),_0x15839a,JSON[_0xec8f('0x12')](_0x2ee273));_0x221756(_0x2ee273);})['catch'](function(_0x3733ba){logger[_0xec8f('0x13')]('ShowFaxQueue',_0x3733ba[_0xec8f('0x14')],_0x15839a);_0x3c19ac(_0x16179b[_0xec8f('0x13')](0x1f4,_0x3733ba[_0xec8f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3e594c8..7a8a81b 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 _0x94fe=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0x94fe,0x167));var _0xe94f=function(_0x1f063e,_0x254e74){_0x1f063e=_0x1f063e-0x0;var _0x2f1a80=_0x94fe[_0x1f063e];return _0x2f1a80;};'use strict';var FaxQueueEvents=require(_0xe94f('0x0'));var events=[_0xe94f('0x1'),_0xe94f('0x2'),_0xe94f('0x3')];function createListener(_0x1faf1c,_0x5144fb){return function(_0x1e6676){_0x5144fb[_0xe94f('0x4')](_0x1faf1c,_0x1e6676);};}function removeListener(_0xe80ba8,_0x44f546){return function(){FaxQueueEvents[_0xe94f('0x5')](_0xe80ba8,_0x44f546);};}exports[_0xe94f('0x6')]=function(_0x13ee9a){for(var _0x14ea58=0x0,_0x552f05=events[_0xe94f('0x7')];_0x14ea58<_0x552f05;_0x14ea58++){var _0x8d1016=events[_0x14ea58];var _0x50e5a9=createListener(_0xe94f('0x8')+_0x8d1016,_0x13ee9a);FaxQueueEvents['on'](_0x8d1016,_0x50e5a9);}}; \ No newline at end of file +var _0x1219=['emit','length','faxQueue:','./faxQueue.events','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1219,0x1e8));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x9121('0x0'));var events=['save','remove',_0x9121('0x1')];function createListener(_0x7c5cf2,_0x4ea789){return function(_0x2130b3){_0x4ea789[_0x9121('0x2')](_0x7c5cf2,_0x2130b3);};}function removeListener(_0x554268,_0x160acb){return function(){FaxQueueEvents['removeListener'](_0x554268,_0x160acb);};}exports['register']=function(_0x147e98){for(var _0x74337b=0x0,_0x48a1f8=events[_0x9121('0x3')];_0x74337b<_0x48a1f8;_0x74337b++){var _0x22bd2c=events[_0x74337b];var _0x1e7f97=createListener(_0x9121('0x4')+_0x22bd2c,_0x147e98);FaxQueueEvents['on'](_0x22bd2c,_0x1e7f97);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index c70325b..71c8f80 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 _0x6f44=['/:id/users','getAgents','post','create','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','isAuthenticated','getTeams'];(function(_0x187a33,_0x53330a){var _0x54cdb8=function(_0xb40681){while(--_0xb40681){_0x187a33['push'](_0x187a33['shift']());}};_0x54cdb8(++_0x53330a);}(_0x6f44,0x1ea));var _0x46f4=function(_0x3a2eb3,_0x288072){_0x3a2eb3=_0x3a2eb3-0x0;var _0x3b06b6=_0x6f44[_0x3a2eb3];return _0x3b06b6;};'use strict';var multer=require(_0x46f4('0x0'));var util=require(_0x46f4('0x1'));var path=require('path');var timeout=require(_0x46f4('0x2'));var express=require(_0x46f4('0x3'));var router=express[_0x46f4('0x4')]();var fs_extra=require(_0x46f4('0x5'));var auth=require(_0x46f4('0x6'));var interaction=require(_0x46f4('0x7'));var config=require(_0x46f4('0x8'));var controller=require(_0x46f4('0x9'));router[_0x46f4('0xa')]('/',auth['isAuthenticated'](),controller[_0x46f4('0xb')]);router[_0x46f4('0xa')](_0x46f4('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x46f4('0xa')](_0x46f4('0xd'),auth['isAuthenticated'](),controller[_0x46f4('0xe')]);router['get'](_0x46f4('0xf'),auth['isAuthenticated'](),controller[_0x46f4('0x10')]);router[_0x46f4('0xa')](_0x46f4('0x11'),auth[_0x46f4('0x12')](),controller[_0x46f4('0x13')]);router[_0x46f4('0xa')](_0x46f4('0x14'),auth[_0x46f4('0x12')](),controller[_0x46f4('0x15')]);router[_0x46f4('0x16')]('/',auth[_0x46f4('0x12')](),controller[_0x46f4('0x17')]);router['post'](_0x46f4('0x11'),auth[_0x46f4('0x12')](),controller['addTeams']);router[_0x46f4('0x16')](_0x46f4('0x14'),auth[_0x46f4('0x12')](),controller['addAgents']);router[_0x46f4('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x46f4('0x19')]);router[_0x46f4('0x1a')](_0x46f4('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth[_0x46f4('0x12')](),controller[_0x46f4('0x1b')]);router['delete'](_0x46f4('0x14'),auth[_0x46f4('0x12')](),controller[_0x46f4('0x1c')]);module[_0x46f4('0x1d')]=router; \ No newline at end of file +var _0x9fe7=['show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0x5a7208,_0x4d8078){var _0x1ab14f=function(_0x55fb44){while(--_0x55fb44){_0x5a7208['push'](_0x5a7208['shift']());}};_0x1ab14f(++_0x4d8078);}(_0x9fe7,0x1df));var _0x79fe=function(_0x967518,_0x3330a5){_0x967518=_0x967518-0x0;var _0x481f36=_0x9fe7[_0x967518];return _0x481f36;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['get'](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller['getMembers']);router[_0x79fe('0x8')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);router['get'](_0x79fe('0x12'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x13')]);router[_0x79fe('0x14')]('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0x15')]);router[_0x79fe('0x14')](_0x79fe('0x10'),auth['isAuthenticated'](),controller[_0x79fe('0x16')]);router[_0x79fe('0x14')](_0x79fe('0x12'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x17')]);router[_0x79fe('0x18')]('/:id',auth[_0x79fe('0xd')](),controller[_0x79fe('0x19')]);router[_0x79fe('0x1a')](_0x79fe('0xc'),auth['isAuthenticated'](),controller[_0x79fe('0x1b')]);router[_0x79fe('0x1a')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller['removeTeams']);router['delete'](_0x79fe('0x12'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 99c2dc6..7233e1e 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 _0xc485=['STRING','DATE','moment','exports'];(function(_0x1e685f,_0x2eda9c){var _0x1457cc=function(_0x3d2745){while(--_0x3d2745){_0x1e685f['push'](_0x1e685f['shift']());}};_0x1457cc(++_0x2eda9c);}(_0xc485,0x1be));var _0x5c48=function(_0x4403e5,_0x32ddae){_0x4403e5=_0x4403e5-0x0;var _0x512114=_0xc485[_0x4403e5];return _0x512114;};'use strict';var moment=require(_0x5c48('0x0'));var Sequelize=require('sequelize');module[_0x5c48('0x1')]={'uniqueid':{'type':Sequelize[_0x5c48('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5c48('0x2')]},'joinAt':{'type':Sequelize[_0x5c48('0x3')]},'leaveAt':{'type':Sequelize[_0x5c48('0x3')]},'acceptAt':{'type':Sequelize[_0x5c48('0x3')]},'exitAt':{'type':Sequelize[_0x5c48('0x3')]},'reason':{'type':Sequelize[_0x5c48('0x2')]}}; \ No newline at end of file +var _0x735e=['STRING','DATE','moment','sequelize'];(function(_0x257ef6,_0x2ebd60){var _0x52476d=function(_0x474e9b){while(--_0x474e9b){_0x257ef6['push'](_0x257ef6['shift']());}};_0x52476d(++_0x2ebd60);}(_0x735e,0x15a));var _0xe735=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x735e[_0x4536a4];return _0x4fd1c1;};'use strict';var moment=require(_0xe735('0x0'));var Sequelize=require(_0xe735('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe735('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe735('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe735('0x3')]},'acceptAt':{'type':Sequelize[_0xe735('0x3')]},'exitAt':{'type':Sequelize[_0xe735('0x3')]},'reason':{'type':Sequelize[_0xe735('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 73036cb..7b1cbe4 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 _0x5712=['intersection','attributes','model','fields','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','count','limit','set','Content-Range','apply','save','then','destroy','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0x5712,0x140));var _0x2571=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x5712[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x2571('0x0'));var rimraf=require(_0x2571('0x1'));var zipdir=require(_0x2571('0x2'));var jsonpatch=require(_0x2571('0x3'));var rp=require(_0x2571('0x4'));var moment=require(_0x2571('0x5'));var BPromise=require(_0x2571('0x6'));var Mustache=require(_0x2571('0x7'));var util=require(_0x2571('0x8'));var path=require(_0x2571('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2571('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2571('0xb'));var squel=require(_0x2571('0xc'));var crypto=require(_0x2571('0xd'));var jsforce=require(_0x2571('0xe'));var deskjs=require(_0x2571('0xf'));var toCsv=require(_0x2571('0x10'));var querystring=require('querystring');var Papa=require(_0x2571('0x11'));var Redis=require('ioredis');var authService=require(_0x2571('0x12'));var qs=require(_0x2571('0x13'));var as=require(_0x2571('0x14'));var hardwareService=require(_0x2571('0x15'));var logger=require(_0x2571('0x16'))(_0x2571('0x17'));var utils=require(_0x2571('0x18'));var config=require(_0x2571('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x33d3ed,_0x1ab846){_0x1ab846=_0x1ab846||0xcc;return function(_0x10823d){if(_0x10823d){return _0x33d3ed[_0x2571('0x1a')](_0x1ab846);}return _0x33d3ed[_0x2571('0x1b')](_0x1ab846)[_0x2571('0x1c')]();};}function respondWithResult(_0x241129,_0x130ab1){_0x130ab1=_0x130ab1||0xc8;return function(_0xdf8c3a){if(_0xdf8c3a){return _0x241129[_0x2571('0x1b')](_0x130ab1)[_0x2571('0x1d')](_0xdf8c3a);}};}function respondWithFilteredResult(_0x3c1a08,_0x5b0392){return function(_0x30b0f2){if(_0x30b0f2){var _0x47b5e9=typeof _0x5b0392['offset']==='undefined'&&typeof _0x5b0392['limit']===_0x2571('0x1e');var _0x371ae2=_0x30b0f2[_0x2571('0x1f')];var _0x75af2a=_0x47b5e9?0x0:_0x5b0392['offset'];var _0x7707=_0x47b5e9?_0x30b0f2[_0x2571('0x1f')]:_0x5b0392['offset']+_0x5b0392[_0x2571('0x20')];var _0x7303ad;if(_0x7707>=_0x371ae2){_0x7707=_0x371ae2;_0x7303ad=0xc8;}else{_0x7303ad=0xce;}_0x3c1a08[_0x2571('0x1b')](_0x7303ad);return _0x3c1a08[_0x2571('0x21')](_0x2571('0x22'),_0x75af2a+'-'+_0x7707+'/'+_0x371ae2)['json'](_0x30b0f2);}return null;};}function patchUpdates(_0x52da27){return function(_0x5fe030){try{jsonpatch[_0x2571('0x23')](_0x5fe030,_0x52da27,!![]);}catch(_0x58f6aa){return BPromise['reject'](_0x58f6aa);}return _0x5fe030[_0x2571('0x24')]();};}function saveUpdates(_0x2e7d89,_0x2218fb){return function(_0xb6dfa6){if(_0xb6dfa6){return _0xb6dfa6['update'](_0x2e7d89)[_0x2571('0x25')](function(_0x55ec06){return _0x55ec06;});}return null;};}function removeEntity(_0x1ec23c,_0x4316b1){return function(_0x5d6778){if(_0x5d6778){return _0x5d6778[_0x2571('0x26')]()[_0x2571('0x25')](function(){_0x1ec23c[_0x2571('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d455d,_0x77e02){return function(_0x1cbbdc){if(!_0x1cbbdc){_0x5d455d[_0x2571('0x1a')](0x194);}return _0x1cbbdc;};}function handleError(_0x1547d2,_0x2f5cae){_0x2f5cae=_0x2f5cae||0x1f4;return function(_0x246bbd){logger['error'](_0x246bbd['stack']);if(_0x246bbd[_0x2571('0x27')]){delete _0x246bbd[_0x2571('0x27')];}_0x1547d2[_0x2571('0x1b')](_0x2f5cae)[_0x2571('0x28')](_0x246bbd);};}exports[_0x2571('0x29')]=function(_0x165aa8,_0x3d5660){var _0x315dc1={},_0x1f7562={},_0xac59bc={'count':0x0,'rows':[]};var _0x5b3373=_[_0x2571('0x2a')](db[_0x2571('0x2b')][_0x2571('0x2c')],function(_0x441e7d){return{'name':_0x441e7d[_0x2571('0x2d')],'type':_0x441e7d[_0x2571('0x2e')]['key']};});_0x1f7562['model']=_[_0x2571('0x2a')](_0x5b3373,_0x2571('0x27'));_0x1f7562[_0x2571('0x2f')]=_[_0x2571('0x30')](_0x165aa8['query']);_0x1f7562[_0x2571('0x31')]=_[_0x2571('0x32')](_0x1f7562['model'],_0x1f7562['query']);_0x315dc1[_0x2571('0x33')]=_[_0x2571('0x32')](_0x1f7562[_0x2571('0x34')],qs['fields'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x35')]));_0x315dc1['attributes']=_0x315dc1[_0x2571('0x33')]['length']?_0x315dc1[_0x2571('0x33')]:_0x1f7562[_0x2571('0x34')];if(!_0x165aa8[_0x2571('0x2f')]['hasOwnProperty']('nolimit')){_0x315dc1[_0x2571('0x20')]=qs['limit'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x20')]);_0x315dc1[_0x2571('0x36')]=qs[_0x2571('0x36')](_0x165aa8['query'][_0x2571('0x36')]);}_0x315dc1[_0x2571('0x37')]=qs['sort'](_0x165aa8[_0x2571('0x2f')][_0x2571('0x38')]);_0x315dc1['where']=qs[_0x2571('0x31')](_[_0x2571('0x39')](_0x165aa8[_0x2571('0x2f')],_0x1f7562[_0x2571('0x31')]),_0x5b3373);if(_0x165aa8[_0x2571('0x2f')][_0x2571('0x3a')]){_0x315dc1[_0x2571('0x3b')]=_[_0x2571('0x3c')](_0x315dc1[_0x2571('0x3b')],{'$or':_[_0x2571('0x2a')](_0x5b3373,function(_0x379a45){if(_0x379a45[_0x2571('0x2e')]!==_0x2571('0x3d')){var _0x198f44={};_0x198f44[_0x379a45['name']]={'$like':'%'+_0x165aa8[_0x2571('0x2f')][_0x2571('0x3a')]+'%'};return _0x198f44;}})});}_0x315dc1=_[_0x2571('0x3c')]({},_0x315dc1,_0x165aa8[_0x2571('0x3e')]);var _0x158432={'where':_0x315dc1[_0x2571('0x3b')]};return db[_0x2571('0x2b')]['count'](_0x158432)[_0x2571('0x25')](function(_0x15c610){_0xac59bc[_0x2571('0x1f')]=_0x15c610;if(_0x165aa8['query'][_0x2571('0x3f')]){_0x315dc1[_0x2571('0x40')]=[{'all':!![]}];}return db[_0x2571('0x2b')]['findAll'](_0x315dc1);})[_0x2571('0x25')](function(_0x1c6ccd){_0xac59bc[_0x2571('0x41')]=_0x1c6ccd;return _0xac59bc;})[_0x2571('0x25')](respondWithFilteredResult(_0x3d5660,_0x315dc1))[_0x2571('0x42')](handleError(_0x3d5660,null));};exports[_0x2571('0x43')]=function(_0x3a817a,_0x45fdd9){var _0x3d4004={'raw':!![],'where':{'id':_0x3a817a[_0x2571('0x44')]['id']}},_0x5d2734={};_0x5d2734[_0x2571('0x34')]=_[_0x2571('0x30')](db[_0x2571('0x2b')][_0x2571('0x2c')]);_0x5d2734[_0x2571('0x2f')]=_[_0x2571('0x30')](_0x3a817a[_0x2571('0x2f')]);_0x5d2734['filters']=_['intersection'](_0x5d2734['model'],_0x5d2734['query']);_0x3d4004['attributes']=_['intersection'](_0x5d2734[_0x2571('0x34')],qs[_0x2571('0x35')](_0x3a817a['query'][_0x2571('0x35')]));_0x3d4004[_0x2571('0x33')]=_0x3d4004[_0x2571('0x33')][_0x2571('0x45')]?_0x3d4004[_0x2571('0x33')]:_0x5d2734['model'];if(_0x3a817a['query']['includeAll']){_0x3d4004[_0x2571('0x40')]=[{'all':!![]}];}_0x3d4004=_[_0x2571('0x3c')]({},_0x3d4004,_0x3a817a[_0x2571('0x3e')]);return db[_0x2571('0x2b')][_0x2571('0x46')](_0x3d4004)[_0x2571('0x25')](handleEntityNotFound(_0x45fdd9,null))[_0x2571('0x25')](respondWithResult(_0x45fdd9,null))['catch'](handleError(_0x45fdd9,null));};exports[_0x2571('0x47')]=function(_0x20189c,_0x1642a8){return db['FaxQueueReport'][_0x2571('0x47')](_0x20189c[_0x2571('0x48')],{})[_0x2571('0x25')](respondWithResult(_0x1642a8,0xc9))[_0x2571('0x42')](handleError(_0x1642a8,null));};exports['update']=function(_0x18291c,_0x245edb){if(_0x18291c[_0x2571('0x48')]['id']){delete _0x18291c[_0x2571('0x48')]['id'];}return db['FaxQueueReport'][_0x2571('0x46')]({'where':{'id':_0x18291c[_0x2571('0x44')]['id']}})[_0x2571('0x25')](handleEntityNotFound(_0x245edb,null))[_0x2571('0x25')](saveUpdates(_0x18291c[_0x2571('0x48')],null))['then'](respondWithResult(_0x245edb,null))[_0x2571('0x42')](handleError(_0x245edb,null));};exports[_0x2571('0x26')]=function(_0x20302b,_0x1d2e36){return db[_0x2571('0x2b')][_0x2571('0x46')]({'where':{'id':_0x20302b['params']['id']}})['then'](handleEntityNotFound(_0x1d2e36,null))[_0x2571('0x25')](removeEntity(_0x1d2e36,null))['catch'](handleError(_0x1d2e36,null));};exports['describe']=function(_0x34a19f,_0x358179){return db[_0x2571('0x2b')][_0x2571('0x49')]()[_0x2571('0x25')](respondWithResult(_0x358179,null))[_0x2571('0x42')](handleError(_0x358179,null));}; \ No newline at end of file +var _0xe600=['sort','where','pick','filter','merge','type','VIRTUAL','name','options','include','FaxQueueReport','findAll','rows','catch','show','includeAll','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xe600,0x159));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e60('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e60('0x1'));var rp=require(_0x0e60('0x2'));var moment=require(_0x0e60('0x3'));var BPromise=require(_0x0e60('0x4'));var Mustache=require(_0x0e60('0x5'));var util=require(_0x0e60('0x6'));var path=require(_0x0e60('0x7'));var sox=require(_0x0e60('0x8'));var csv=require(_0x0e60('0x9'));var ejs=require(_0x0e60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e60('0xb'));var squel=require(_0x0e60('0xc'));var crypto=require(_0x0e60('0xd'));var jsforce=require(_0x0e60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0e60('0x9'));var querystring=require(_0x0e60('0xf'));var Papa=require(_0x0e60('0x10'));var Redis=require(_0x0e60('0x11'));var authService=require(_0x0e60('0x12'));var qs=require(_0x0e60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e60('0x14'));var logger=require(_0x0e60('0x15'))(_0x0e60('0x16'));var utils=require(_0x0e60('0x17'));var config=require(_0x0e60('0x18'));var licenseUtil=require(_0x0e60('0x19'));var db=require(_0x0e60('0x1a'))['db'];function respondWithStatusCode(_0x2f5ee4,_0x540411){_0x540411=_0x540411||0xcc;return function(_0x2d848f){if(_0x2d848f){return _0x2f5ee4[_0x0e60('0x1b')](_0x540411);}return _0x2f5ee4[_0x0e60('0x1c')](_0x540411)[_0x0e60('0x1d')]();};}function respondWithResult(_0x45328b,_0x37bf95){_0x37bf95=_0x37bf95||0xc8;return function(_0x5d7f84){if(_0x5d7f84){return _0x45328b[_0x0e60('0x1c')](_0x37bf95)['json'](_0x5d7f84);}};}function respondWithFilteredResult(_0x91cd1,_0x128887){return function(_0x170890){if(_0x170890){var _0x5ab4ba=typeof _0x128887[_0x0e60('0x1e')]===_0x0e60('0x1f')&&typeof _0x128887[_0x0e60('0x20')]===_0x0e60('0x1f');var _0x2e6270=_0x170890['count'];var _0x992490=_0x5ab4ba?0x0:_0x128887[_0x0e60('0x1e')];var _0x599c1d=_0x5ab4ba?_0x170890[_0x0e60('0x21')]:_0x128887[_0x0e60('0x1e')]+_0x128887[_0x0e60('0x20')];var _0x504b31;if(_0x599c1d>=_0x2e6270){_0x599c1d=_0x2e6270;_0x504b31=0xc8;}else{_0x504b31=0xce;}_0x91cd1[_0x0e60('0x1c')](_0x504b31);return _0x91cd1['set'](_0x0e60('0x22'),_0x992490+'-'+_0x599c1d+'/'+_0x2e6270)[_0x0e60('0x23')](_0x170890);}return null;};}function patchUpdates(_0xb9f037){return function(_0xabf953){try{jsonpatch[_0x0e60('0x24')](_0xabf953,_0xb9f037,!![]);}catch(_0x31a63e){return BPromise[_0x0e60('0x25')](_0x31a63e);}return _0xabf953[_0x0e60('0x26')]();};}function saveUpdates(_0x352633,_0x10f875){return function(_0x22c0e0){if(_0x22c0e0){return _0x22c0e0[_0x0e60('0x27')](_0x352633)[_0x0e60('0x28')](function(_0x16985f){return _0x16985f;});}return null;};}function removeEntity(_0x4702f,_0x33f9f3){return function(_0x41642c){if(_0x41642c){return _0x41642c[_0x0e60('0x29')]()[_0x0e60('0x28')](function(){_0x4702f['status'](0xcc)[_0x0e60('0x1d')]();});}};}function handleEntityNotFound(_0x41ad9a,_0x5ea254){return function(_0x10451f){if(!_0x10451f){_0x41ad9a['sendStatus'](0x194);}return _0x10451f;};}function handleError(_0x3ddc19,_0x5665c2){_0x5665c2=_0x5665c2||0x1f4;return function(_0x48d950){logger[_0x0e60('0x2a')](_0x48d950[_0x0e60('0x2b')]);if(_0x48d950['name']){delete _0x48d950['name'];}_0x3ddc19[_0x0e60('0x1c')](_0x5665c2)['send'](_0x48d950);};}exports[_0x0e60('0x2c')]=function(_0x548919,_0x4e6b41){var _0x154478={},_0x3d3c13={},_0x2a282d={'count':0x0,'rows':[]};var _0x4d9b18=_[_0x0e60('0x2d')](db['FaxQueueReport'][_0x0e60('0x2e')],function(_0x1d54c0){return{'name':_0x1d54c0[_0x0e60('0x2f')],'type':_0x1d54c0['type'][_0x0e60('0x30')]};});_0x3d3c13[_0x0e60('0x31')]=_[_0x0e60('0x2d')](_0x4d9b18,'name');_0x3d3c13[_0x0e60('0x32')]=_[_0x0e60('0x33')](_0x548919[_0x0e60('0x32')]);_0x3d3c13[_0x0e60('0x34')]=_[_0x0e60('0x35')](_0x3d3c13['model'],_0x3d3c13[_0x0e60('0x32')]);_0x154478['attributes']=_[_0x0e60('0x35')](_0x3d3c13['model'],qs[_0x0e60('0x36')](_0x548919[_0x0e60('0x32')][_0x0e60('0x36')]));_0x154478['attributes']=_0x154478[_0x0e60('0x37')][_0x0e60('0x38')]?_0x154478[_0x0e60('0x37')]:_0x3d3c13[_0x0e60('0x31')];if(!_0x548919[_0x0e60('0x32')][_0x0e60('0x39')](_0x0e60('0x3a'))){_0x154478[_0x0e60('0x20')]=qs[_0x0e60('0x20')](_0x548919[_0x0e60('0x32')][_0x0e60('0x20')]);_0x154478[_0x0e60('0x1e')]=qs['offset'](_0x548919[_0x0e60('0x32')][_0x0e60('0x1e')]);}_0x154478[_0x0e60('0x3b')]=qs[_0x0e60('0x3c')](_0x548919['query']['sort']);_0x154478[_0x0e60('0x3d')]=qs['filters'](_[_0x0e60('0x3e')](_0x548919['query'],_0x3d3c13[_0x0e60('0x34')]),_0x4d9b18);if(_0x548919[_0x0e60('0x32')][_0x0e60('0x3f')]){_0x154478[_0x0e60('0x3d')]=_[_0x0e60('0x40')](_0x154478[_0x0e60('0x3d')],{'$or':_[_0x0e60('0x2d')](_0x4d9b18,function(_0x39fac1){if(_0x39fac1[_0x0e60('0x41')]!==_0x0e60('0x42')){var _0xb0a66c={};_0xb0a66c[_0x39fac1[_0x0e60('0x43')]]={'$like':'%'+_0x548919['query'][_0x0e60('0x3f')]+'%'};return _0xb0a66c;}})});}_0x154478=_['merge']({},_0x154478,_0x548919[_0x0e60('0x44')]);var _0x266cae={'where':_0x154478['where']};return db['FaxQueueReport'][_0x0e60('0x21')](_0x266cae)[_0x0e60('0x28')](function(_0x50b793){_0x2a282d[_0x0e60('0x21')]=_0x50b793;if(_0x548919[_0x0e60('0x32')]['includeAll']){_0x154478[_0x0e60('0x45')]=[{'all':!![]}];}return db[_0x0e60('0x46')][_0x0e60('0x47')](_0x154478);})[_0x0e60('0x28')](function(_0x3ac0f0){_0x2a282d[_0x0e60('0x48')]=_0x3ac0f0;return _0x2a282d;})[_0x0e60('0x28')](respondWithFilteredResult(_0x4e6b41,_0x154478))[_0x0e60('0x49')](handleError(_0x4e6b41,null));};exports[_0x0e60('0x4a')]=function(_0x4c89b4,_0x4a2a10){var _0x535c06={'raw':!![],'where':{'id':_0x4c89b4['params']['id']}},_0x39c7d4={};_0x39c7d4[_0x0e60('0x31')]=_[_0x0e60('0x33')](db[_0x0e60('0x46')]['rawAttributes']);_0x39c7d4[_0x0e60('0x32')]=_[_0x0e60('0x33')](_0x4c89b4['query']);_0x39c7d4['filters']=_[_0x0e60('0x35')](_0x39c7d4[_0x0e60('0x31')],_0x39c7d4[_0x0e60('0x32')]);_0x535c06[_0x0e60('0x37')]=_[_0x0e60('0x35')](_0x39c7d4[_0x0e60('0x31')],qs['fields'](_0x4c89b4[_0x0e60('0x32')][_0x0e60('0x36')]));_0x535c06[_0x0e60('0x37')]=_0x535c06[_0x0e60('0x37')][_0x0e60('0x38')]?_0x535c06['attributes']:_0x39c7d4['model'];if(_0x4c89b4['query'][_0x0e60('0x4b')]){_0x535c06[_0x0e60('0x45')]=[{'all':!![]}];}_0x535c06=_[_0x0e60('0x40')]({},_0x535c06,_0x4c89b4[_0x0e60('0x44')]);return db['FaxQueueReport']['find'](_0x535c06)['then'](handleEntityNotFound(_0x4a2a10,null))[_0x0e60('0x28')](respondWithResult(_0x4a2a10,null))[_0x0e60('0x49')](handleError(_0x4a2a10,null));};exports[_0x0e60('0x4c')]=function(_0x5fe304,_0x8777f4){return db['FaxQueueReport']['create'](_0x5fe304[_0x0e60('0x4d')],{})[_0x0e60('0x28')](respondWithResult(_0x8777f4,0xc9))[_0x0e60('0x49')](handleError(_0x8777f4,null));};exports[_0x0e60('0x27')]=function(_0x4ad156,_0x36a999){if(_0x4ad156[_0x0e60('0x4d')]['id']){delete _0x4ad156[_0x0e60('0x4d')]['id'];}return db['FaxQueueReport'][_0x0e60('0x4e')]({'where':{'id':_0x4ad156[_0x0e60('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36a999,null))[_0x0e60('0x28')](saveUpdates(_0x4ad156['body'],null))[_0x0e60('0x28')](respondWithResult(_0x36a999,null))[_0x0e60('0x49')](handleError(_0x36a999,null));};exports[_0x0e60('0x29')]=function(_0x2e887c,_0x477a99){return db['FaxQueueReport'][_0x0e60('0x4e')]({'where':{'id':_0x2e887c[_0x0e60('0x4f')]['id']}})[_0x0e60('0x28')](handleEntityNotFound(_0x477a99,null))[_0x0e60('0x28')](removeEntity(_0x477a99,null))['catch'](handleError(_0x477a99,null));};exports[_0x0e60('0x50')]=function(_0x241c9e,_0x5a20f4){return db[_0x0e60('0x46')]['describe']()[_0x0e60('0x28')](respondWithResult(_0x5a20f4,null))['catch'](handleError(_0x5a20f4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2c709ca..a0a4b3b 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0xdf36e6,_0x2eec46){var _0x59fa7a=function(_0x4e873f){while(--_0x4e873f){_0xdf36e6['push'](_0xdf36e6['shift']());}};_0x59fa7a(++_0x2eec46);}(_0xf494,0x1c6));var _0x4f49=function(_0x4c5393,_0x45b781){_0x4c5393=_0x4c5393-0x0;var _0x5da4b4=_0xf494[_0x4c5393];return _0x5da4b4;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x1729d8,_0x481673){var _0x1d9d38=function(_0x50f503){while(--_0x50f503){_0x1729d8['push'](_0x1729d8['shift']());}};_0x1d9d38(++_0x481673);}(_0x7a54,0x106));var _0x47a5=function(_0x4a8edb,_0x46bb37){_0x4a8edb=_0x4a8edb-0x0;var _0x45930a=_0x7a54[_0x4a8edb];return _0x45930a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 14ec395..8a37449 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 _0xef2c=['UpdateFaxQueueReport','update','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','options','raw','stringify','catch'];(function(_0x43595e,_0x438219){var _0x1e485a=function(_0x313e2f){while(--_0x313e2f){_0x43595e['push'](_0x43595e['shift']());}};_0x1e485a(++_0x438219);}(_0xef2c,0xd2));var _0xcef2=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0xef2c[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0xcef2('0x0'));var util=require('util');var moment=require(_0xcef2('0x1'));var BPromise=require(_0xcef2('0x2'));var rs=require(_0xcef2('0x3'));var fs=require('fs');var Redis=require(_0xcef2('0x4'));var db=require(_0xcef2('0x5'))['db'];var utils=require(_0xcef2('0x6'));var logger=require(_0xcef2('0x7'))('rpc');var config=require(_0xcef2('0x8'));var jayson=require(_0xcef2('0x9'));var client=jayson[_0xcef2('0xa')][_0xcef2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x295118,_0x2cccda,_0x429d09){return new BPromise(function(_0x398fbd,_0x49b346){return client['request'](_0x295118,_0x429d09)[_0xcef2('0xc')](function(_0x2d1b7b){logger[_0xcef2('0xd')](_0xcef2('0xe'),_0x2cccda,_0xcef2('0xf'));logger['debug'](_0xcef2('0x10'),_0x2cccda,'request\x20sent',JSON['stringify'](_0x2d1b7b));if(_0x2d1b7b[_0xcef2('0x11')]){if(_0x2d1b7b['error'][_0xcef2('0x12')]===0x1f4){logger[_0xcef2('0x11')](_0xcef2('0xe'),_0x2cccda,_0x2d1b7b[_0xcef2('0x11')][_0xcef2('0x13')]);return _0x49b346(_0x2d1b7b['error'][_0xcef2('0x13')]);}logger[_0xcef2('0x11')](_0xcef2('0xe'),_0x2cccda,_0x2d1b7b[_0xcef2('0x11')]['message']);return _0x398fbd(_0x2d1b7b[_0xcef2('0x11')][_0xcef2('0x13')]);}else{logger['info'](_0xcef2('0xe'),_0x2cccda,'request\x20sent');_0x398fbd(_0x2d1b7b[_0xcef2('0x14')][_0xcef2('0x13')]);}})['catch'](function(_0x4aa6ec){logger[_0xcef2('0x11')](_0xcef2('0xe'),_0x2cccda,_0x4aa6ec);_0x49b346(_0x4aa6ec);});});}exports[_0xcef2('0x15')]=function(_0x324561){var _0xdbf9ba=this;return new Promise(function(_0x50698a,_0x544ad8){return db[_0xcef2('0x16')][_0xcef2('0x17')](_0x324561['body'],{'raw':_0x324561['options']?_0x324561[_0xcef2('0x18')][_0xcef2('0x19')]===undefined?!![]:![]:!![]})[_0xcef2('0xc')](function(_0x1a9bee){logger[_0xcef2('0xd')]('CreateFaxQueueReport',_0x324561);logger['debug'](_0xcef2('0x15'),_0x324561,JSON[_0xcef2('0x1a')](_0x1a9bee));_0x50698a(_0x1a9bee);})[_0xcef2('0x1b')](function(_0x8f9b72){logger[_0xcef2('0x11')](_0xcef2('0x15'),_0x8f9b72[_0xcef2('0x13')],_0x324561);_0x544ad8(_0xdbf9ba[_0xcef2('0x11')](0x1f4,_0x8f9b72[_0xcef2('0x13')]));});});};exports[_0xcef2('0x1c')]=function(_0xe3c8f4){var _0x3b1529=this;return new Promise(function(_0x5085de,_0x3cb9bf){return db[_0xcef2('0x16')][_0xcef2('0x1d')](_0xe3c8f4['body'],{'raw':_0xe3c8f4[_0xcef2('0x18')]?_0xe3c8f4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe3c8f4[_0xcef2('0x18')]?_0xe3c8f4[_0xcef2('0x18')][_0xcef2('0x1e')]||null:null,'attributes':_0xe3c8f4[_0xcef2('0x18')]?_0xe3c8f4[_0xcef2('0x18')][_0xcef2('0x1f')]||null:null,'limit':_0xe3c8f4[_0xcef2('0x18')]?_0xe3c8f4[_0xcef2('0x18')][_0xcef2('0x20')]||null:null})[_0xcef2('0xc')](function(_0x2d423d){logger[_0xcef2('0xd')]('UpdateFaxQueueReport',_0xe3c8f4);logger[_0xcef2('0x21')](_0xcef2('0x1c'),_0xe3c8f4,JSON[_0xcef2('0x1a')](_0x2d423d));_0x5085de(_0x2d423d);})[_0xcef2('0x1b')](function(_0x5c5d6a){logger[_0xcef2('0x11')](_0xcef2('0x1c'),_0x5c5d6a[_0xcef2('0x13')],_0xe3c8f4);_0x3cb9bf(_0x3b1529['error'](0x1f4,_0x5c5d6a[_0xcef2('0x13')]));});});}; \ No newline at end of file +var _0x32b7=['FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FaxQueueReport','create','body','options','raw','CreateFaxQueueReport','update','where','attributes','limit','UpdateFaxQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x103c7c,_0x3e464d){var _0x18d62b=function(_0x428883){while(--_0x428883){_0x103c7c['push'](_0x103c7c['shift']());}};_0x18d62b(++_0x3e464d);}(_0x32b7,0xb8));var _0x732b=function(_0x78f8ae,_0x5d9321){_0x78f8ae=_0x78f8ae-0x0;var _0x110332=_0x32b7[_0x78f8ae];return _0x110332;};'use strict';var _=require(_0x732b('0x0'));var util=require(_0x732b('0x1'));var moment=require(_0x732b('0x2'));var BPromise=require(_0x732b('0x3'));var rs=require(_0x732b('0x4'));var fs=require('fs');var Redis=require(_0x732b('0x5'));var db=require(_0x732b('0x6'))['db'];var utils=require(_0x732b('0x7'));var logger=require(_0x732b('0x8'))(_0x732b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x732b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42d078,_0x73e679,_0x47a7b6){return new BPromise(function(_0x29a126,_0x4bb07b){return client[_0x732b('0xb')](_0x42d078,_0x47a7b6)[_0x732b('0xc')](function(_0x35d907){logger[_0x732b('0xd')](_0x732b('0xe'),_0x73e679,_0x732b('0xf'));logger[_0x732b('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x73e679,_0x732b('0xf'),JSON[_0x732b('0x11')](_0x35d907));if(_0x35d907[_0x732b('0x12')]){if(_0x35d907['error']['code']===0x1f4){logger[_0x732b('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x73e679,_0x35d907[_0x732b('0x12')][_0x732b('0x13')]);return _0x4bb07b(_0x35d907[_0x732b('0x12')]['message']);}logger[_0x732b('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x73e679,_0x35d907['error'][_0x732b('0x13')]);return _0x29a126(_0x35d907[_0x732b('0x12')][_0x732b('0x13')]);}else{logger[_0x732b('0xd')](_0x732b('0xe'),_0x73e679,_0x732b('0xf'));_0x29a126(_0x35d907[_0x732b('0x14')][_0x732b('0x13')]);}})[_0x732b('0x15')](function(_0x5e8d89){logger[_0x732b('0x12')](_0x732b('0xe'),_0x73e679,_0x5e8d89);_0x4bb07b(_0x5e8d89);});});}exports['CreateFaxQueueReport']=function(_0x3947c8){var _0x2dbeb=this;return new Promise(function(_0x504957,_0xb170b8){return db[_0x732b('0x16')][_0x732b('0x17')](_0x3947c8[_0x732b('0x18')],{'raw':_0x3947c8[_0x732b('0x19')]?_0x3947c8[_0x732b('0x19')][_0x732b('0x1a')]===undefined?!![]:![]:!![]})[_0x732b('0xc')](function(_0xe9ca53){logger['info'](_0x732b('0x1b'),_0x3947c8);logger[_0x732b('0x10')](_0x732b('0x1b'),_0x3947c8,JSON[_0x732b('0x11')](_0xe9ca53));_0x504957(_0xe9ca53);})['catch'](function(_0x4016c8){logger[_0x732b('0x12')](_0x732b('0x1b'),_0x4016c8[_0x732b('0x13')],_0x3947c8);_0xb170b8(_0x2dbeb[_0x732b('0x12')](0x1f4,_0x4016c8[_0x732b('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x244823){var _0x1a08c2=this;return new Promise(function(_0x3e8ab9,_0x57ef12){return db[_0x732b('0x16')][_0x732b('0x1c')](_0x244823['body'],{'raw':_0x244823['options']?_0x244823['options'][_0x732b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x244823[_0x732b('0x19')]?_0x244823[_0x732b('0x19')][_0x732b('0x1d')]||null:null,'attributes':_0x244823[_0x732b('0x19')]?_0x244823['options'][_0x732b('0x1e')]||null:null,'limit':_0x244823['options']?_0x244823[_0x732b('0x19')][_0x732b('0x1f')]||null:null})[_0x732b('0xc')](function(_0xaadae8){logger[_0x732b('0xd')](_0x732b('0x20'),_0x244823);logger[_0x732b('0x10')]('UpdateFaxQueueReport',_0x244823,JSON[_0x732b('0x11')](_0xaadae8));_0x3e8ab9(_0xaadae8);})['catch'](function(_0x391d0e){logger[_0x732b('0x12')](_0x732b('0x20'),_0x391d0e['message'],_0x244823);_0x57ef12(_0x1a08c2[_0x732b('0x12')](0x1f4,_0x391d0e[_0x732b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 64565e6..a1820f7 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 _0x0f01=['put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x356b1f,_0x2f474a){var _0x18da12=function(_0x3ba6e2){while(--_0x3ba6e2){_0x356b1f['push'](_0x356b1f['shift']());}};_0x18da12(++_0x2f474a);}(_0x0f01,0xfb));var _0x10f0=function(_0x4e46ba,_0x48201e){_0x4e46ba=_0x4e46ba-0x0;var _0x7bee18=_0x0f01[_0x4e46ba];return _0x7bee18;};'use strict';var multer=require(_0x10f0('0x0'));var util=require(_0x10f0('0x1'));var path=require('path');var timeout=require(_0x10f0('0x2'));var express=require(_0x10f0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10f0('0x4'));var interaction=require(_0x10f0('0x5'));var config=require('../../config/environment');var controller=require(_0x10f0('0x6'));router[_0x10f0('0x7')]('/',auth['isAuthenticated'](),controller[_0x10f0('0x8')]);router['get'](_0x10f0('0x9'),auth[_0x10f0('0xa')](),controller[_0x10f0('0xb')]);router[_0x10f0('0x7')](_0x10f0('0xc'),auth[_0x10f0('0xa')](),controller['show']);router[_0x10f0('0xd')]('/',auth[_0x10f0('0xa')](),controller[_0x10f0('0xe')]);router[_0x10f0('0xf')](_0x10f0('0xc'),auth['isAuthenticated'](),controller[_0x10f0('0x10')]);router['delete'](_0x10f0('0xc'),auth['isAuthenticated'](),controller[_0x10f0('0x11')]);module[_0x10f0('0x12')]=router; \ No newline at end of file +var _0x07a8=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create','put','/:id','update','delete','destroy'];(function(_0x27bed4,_0xf17e71){var _0x412e9d=function(_0x2c4eb4){while(--_0x2c4eb4){_0x27bed4['push'](_0x27bed4['shift']());}};_0x412e9d(++_0xf17e71);}(_0x07a8,0x151));var _0x807a=function(_0x570acd,_0x40377a){_0x570acd=_0x570acd-0x0;var _0x133635=_0x07a8[_0x570acd];return _0x133635;};'use strict';var multer=require(_0x807a('0x0'));var util=require(_0x807a('0x1'));var path=require(_0x807a('0x2'));var timeout=require(_0x807a('0x3'));var express=require(_0x807a('0x4'));var router=express[_0x807a('0x5')]();var fs_extra=require(_0x807a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x807a('0x7'));var config=require(_0x807a('0x8'));var controller=require(_0x807a('0x9'));router['get']('/',auth[_0x807a('0xa')](),controller[_0x807a('0xb')]);router['get'](_0x807a('0xc'),auth[_0x807a('0xa')](),controller[_0x807a('0xd')]);router[_0x807a('0xe')]('/:id',auth[_0x807a('0xa')](),controller[_0x807a('0xf')]);router[_0x807a('0x10')]('/',auth[_0x807a('0xa')](),controller[_0x807a('0x11')]);router[_0x807a('0x12')](_0x807a('0x13'),auth['isAuthenticated'](),controller[_0x807a('0x14')]);router[_0x807a('0x15')](_0x807a('0x13'),auth[_0x807a('0xa')](),controller[_0x807a('0x16')]);module[_0x807a('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index d39d579..879ebc6 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1d46bb,_0x33301f){var _0x42049c=function(_0x4bb9f2){while(--_0x4bb9f2){_0x1d46bb['push'](_0x1d46bb['shift']());}};_0x42049c(++_0x33301f);}(_0xaa88,0x137));var _0x8aa8=function(_0x31a37b,_0x826249){_0x31a37b=_0x31a37b-0x0;var _0x49ae16=_0xaa88[_0x31a37b];return _0x49ae16;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x135b01,_0x17b2ff){var _0x22d364=function(_0x57b100){while(--_0x57b100){_0x135b01['push'](_0x135b01['shift']());}};_0x22d364(++_0x17b2ff);}(_0xaa88,0x137));var _0x8aa8=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0xaa88[_0x34b821];return _0x5e00a0;};'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 75baadd..dc01c53 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 _0x3373=['describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','FaxTransferReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','find','create','body'];(function(_0x10800f,_0x2a8eed){var _0x351b2f=function(_0xe53b55){while(--_0xe53b55){_0x10800f['push'](_0x10800f['shift']());}};_0x351b2f(++_0x2a8eed);}(_0x3373,0xd9));var _0x3337=function(_0x1807ba,_0x47235a){_0x1807ba=_0x1807ba-0x0;var _0x50c250=_0x3373[_0x1807ba];return _0x50c250;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3337('0x0'));var zipdir=require(_0x3337('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3337('0x2'));var moment=require('moment');var BPromise=require(_0x3337('0x3'));var Mustache=require(_0x3337('0x4'));var util=require(_0x3337('0x5'));var path=require(_0x3337('0x6'));var sox=require(_0x3337('0x7'));var csv=require(_0x3337('0x8'));var ejs=require(_0x3337('0x9'));var fs=require('fs');var fs_extra=require(_0x3337('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3337('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3337('0x8'));var querystring=require(_0x3337('0xc'));var Papa=require(_0x3337('0xd'));var Redis=require(_0x3337('0xe'));var authService=require(_0x3337('0xf'));var qs=require(_0x3337('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3337('0x11'));var logger=require(_0x3337('0x12'))(_0x3337('0x13'));var utils=require(_0x3337('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3337('0x15'));var db=require(_0x3337('0x16'))['db'];function respondWithStatusCode(_0x155ebf,_0x1ff575){_0x1ff575=_0x1ff575||0xcc;return function(_0x5d6989){if(_0x5d6989){return _0x155ebf[_0x3337('0x17')](_0x1ff575);}return _0x155ebf[_0x3337('0x18')](_0x1ff575)[_0x3337('0x19')]();};}function respondWithResult(_0x1eae97,_0xb46eb8){_0xb46eb8=_0xb46eb8||0xc8;return function(_0x132d05){if(_0x132d05){return _0x1eae97['status'](_0xb46eb8)[_0x3337('0x1a')](_0x132d05);}};}function respondWithFilteredResult(_0x38fed4,_0x5e2485){return function(_0x2e6e16){if(_0x2e6e16){var _0xc1a77d=typeof _0x5e2485['offset']===_0x3337('0x1b')&&typeof _0x5e2485['limit']===_0x3337('0x1b');var _0x3f5f8d=_0x2e6e16[_0x3337('0x1c')];var _0x52c1fd=_0xc1a77d?0x0:_0x5e2485[_0x3337('0x1d')];var _0x2cdf4f=_0xc1a77d?_0x2e6e16['count']:_0x5e2485[_0x3337('0x1d')]+_0x5e2485['limit'];var _0xd1ff20;if(_0x2cdf4f>=_0x3f5f8d){_0x2cdf4f=_0x3f5f8d;_0xd1ff20=0xc8;}else{_0xd1ff20=0xce;}_0x38fed4[_0x3337('0x18')](_0xd1ff20);return _0x38fed4[_0x3337('0x1e')](_0x3337('0x1f'),_0x52c1fd+'-'+_0x2cdf4f+'/'+_0x3f5f8d)[_0x3337('0x1a')](_0x2e6e16);}return null;};}function patchUpdates(_0x1a12d8){return function(_0x48bd70){try{jsonpatch['apply'](_0x48bd70,_0x1a12d8,!![]);}catch(_0x2b5231){return BPromise[_0x3337('0x20')](_0x2b5231);}return _0x48bd70[_0x3337('0x21')]();};}function saveUpdates(_0x15a366,_0xfee4c5){return function(_0x5f0266){if(_0x5f0266){return _0x5f0266[_0x3337('0x22')](_0x15a366)[_0x3337('0x23')](function(_0x3640a6){return _0x3640a6;});}return null;};}function removeEntity(_0x452042,_0x51a7c2){return function(_0x3abe48){if(_0x3abe48){return _0x3abe48[_0x3337('0x24')]()[_0x3337('0x23')](function(){_0x452042[_0x3337('0x18')](0xcc)[_0x3337('0x19')]();});}};}function handleEntityNotFound(_0x27e4ba,_0x1f3129){return function(_0x445a9d){if(!_0x445a9d){_0x27e4ba[_0x3337('0x17')](0x194);}return _0x445a9d;};}function handleError(_0xe86b25,_0x1d932f){_0x1d932f=_0x1d932f||0x1f4;return function(_0x151238){logger['error'](_0x151238[_0x3337('0x25')]);if(_0x151238[_0x3337('0x26')]){delete _0x151238[_0x3337('0x26')];}_0xe86b25[_0x3337('0x18')](_0x1d932f)['send'](_0x151238);};}exports[_0x3337('0x27')]=function(_0x38cc88,_0x448529){var _0x24b44c={},_0x4245fd={},_0x37d976={'count':0x0,'rows':[]};var _0x4b3e4e=_[_0x3337('0x28')](db[_0x3337('0x29')][_0x3337('0x2a')],function(_0x33f7cc){return{'name':_0x33f7cc['fieldName'],'type':_0x33f7cc[_0x3337('0x2b')][_0x3337('0x2c')]};});_0x4245fd['model']=_['map'](_0x4b3e4e,'name');_0x4245fd[_0x3337('0x2d')]=_[_0x3337('0x2e')](_0x38cc88[_0x3337('0x2d')]);_0x4245fd[_0x3337('0x2f')]=_[_0x3337('0x30')](_0x4245fd[_0x3337('0x31')],_0x4245fd[_0x3337('0x2d')]);_0x24b44c['attributes']=_[_0x3337('0x30')](_0x4245fd[_0x3337('0x31')],qs['fields'](_0x38cc88[_0x3337('0x2d')]['fields']));_0x24b44c[_0x3337('0x32')]=_0x24b44c[_0x3337('0x32')][_0x3337('0x33')]?_0x24b44c[_0x3337('0x32')]:_0x4245fd['model'];if(!_0x38cc88[_0x3337('0x2d')][_0x3337('0x34')]('nolimit')){_0x24b44c['limit']=qs[_0x3337('0x35')](_0x38cc88[_0x3337('0x2d')][_0x3337('0x35')]);_0x24b44c[_0x3337('0x1d')]=qs[_0x3337('0x1d')](_0x38cc88['query'][_0x3337('0x1d')]);}_0x24b44c['order']=qs[_0x3337('0x36')](_0x38cc88[_0x3337('0x2d')][_0x3337('0x36')]);_0x24b44c[_0x3337('0x37')]=qs[_0x3337('0x2f')](_[_0x3337('0x38')](_0x38cc88['query'],_0x4245fd[_0x3337('0x2f')]),_0x4b3e4e);if(_0x38cc88[_0x3337('0x2d')][_0x3337('0x39')]){_0x24b44c[_0x3337('0x37')]=_[_0x3337('0x3a')](_0x24b44c[_0x3337('0x37')],{'$or':_[_0x3337('0x28')](_0x4b3e4e,function(_0x2f6f4a){if(_0x2f6f4a[_0x3337('0x2b')]!==_0x3337('0x3b')){var _0x3cf99c={};_0x3cf99c[_0x2f6f4a[_0x3337('0x26')]]={'$like':'%'+_0x38cc88[_0x3337('0x2d')][_0x3337('0x39')]+'%'};return _0x3cf99c;}})});}_0x24b44c=_[_0x3337('0x3a')]({},_0x24b44c,_0x38cc88[_0x3337('0x3c')]);var _0x2941d9={'where':_0x24b44c[_0x3337('0x37')]};return db['FaxTransferReport'][_0x3337('0x1c')](_0x2941d9)['then'](function(_0x26f78a){_0x37d976['count']=_0x26f78a;if(_0x38cc88[_0x3337('0x2d')]['includeAll']){_0x24b44c[_0x3337('0x3d')]=[{'all':!![]}];}return db[_0x3337('0x29')][_0x3337('0x3e')](_0x24b44c);})[_0x3337('0x23')](function(_0x1a47bd){_0x37d976['rows']=_0x1a47bd;return _0x37d976;})[_0x3337('0x23')](respondWithFilteredResult(_0x448529,_0x24b44c))[_0x3337('0x3f')](handleError(_0x448529,null));};exports[_0x3337('0x40')]=function(_0x42018c,_0x25aa46){var _0x365f4b={'raw':!![],'where':{'id':_0x42018c[_0x3337('0x41')]['id']}},_0x17021d={};_0x17021d[_0x3337('0x31')]=_[_0x3337('0x2e')](db[_0x3337('0x29')]['rawAttributes']);_0x17021d[_0x3337('0x2d')]=_['keys'](_0x42018c['query']);_0x17021d[_0x3337('0x2f')]=_[_0x3337('0x30')](_0x17021d['model'],_0x17021d[_0x3337('0x2d')]);_0x365f4b[_0x3337('0x32')]=_[_0x3337('0x30')](_0x17021d[_0x3337('0x31')],qs[_0x3337('0x42')](_0x42018c[_0x3337('0x2d')][_0x3337('0x42')]));_0x365f4b[_0x3337('0x32')]=_0x365f4b[_0x3337('0x32')]['length']?_0x365f4b[_0x3337('0x32')]:_0x17021d[_0x3337('0x31')];if(_0x42018c[_0x3337('0x2d')][_0x3337('0x43')]){_0x365f4b[_0x3337('0x3d')]=[{'all':!![]}];}_0x365f4b=_[_0x3337('0x3a')]({},_0x365f4b,_0x42018c[_0x3337('0x3c')]);return db[_0x3337('0x29')][_0x3337('0x44')](_0x365f4b)[_0x3337('0x23')](handleEntityNotFound(_0x25aa46,null))[_0x3337('0x23')](respondWithResult(_0x25aa46,null))['catch'](handleError(_0x25aa46,null));};exports['create']=function(_0xedc6c2,_0x21aee1){return db[_0x3337('0x29')][_0x3337('0x45')](_0xedc6c2[_0x3337('0x46')],{})[_0x3337('0x23')](respondWithResult(_0x21aee1,0xc9))[_0x3337('0x3f')](handleError(_0x21aee1,null));};exports[_0x3337('0x22')]=function(_0x2d570a,_0x43b69b){if(_0x2d570a[_0x3337('0x46')]['id']){delete _0x2d570a[_0x3337('0x46')]['id'];}return db[_0x3337('0x29')][_0x3337('0x44')]({'where':{'id':_0x2d570a[_0x3337('0x41')]['id']}})['then'](handleEntityNotFound(_0x43b69b,null))['then'](saveUpdates(_0x2d570a['body'],null))[_0x3337('0x23')](respondWithResult(_0x43b69b,null))[_0x3337('0x3f')](handleError(_0x43b69b,null));};exports['destroy']=function(_0x59a0cf,_0x2a10eb){return db[_0x3337('0x29')]['find']({'where':{'id':_0x59a0cf['params']['id']}})[_0x3337('0x23')](handleEntityNotFound(_0x2a10eb,null))[_0x3337('0x23')](removeEntity(_0x2a10eb,null))[_0x3337('0x3f')](handleError(_0x2a10eb,null));};exports[_0x3337('0x47')]=function(_0xf6e2e7,_0x332d23){return db[_0x3337('0x29')][_0x3337('0x47')]()[_0x3337('0x23')](respondWithResult(_0x332d23,null))[_0x3337('0x3f')](handleError(_0x332d23,null));}; \ No newline at end of file +var _0x0eb9=['pick','filter','where','merge','includeAll','include','findAll','rows','catch','length','options','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x31eb4b,_0x2cf5cd){var _0x3ae61b=function(_0x458b80){while(--_0x458b80){_0x31eb4b['push'](_0x31eb4b['shift']());}};_0x3ae61b(++_0x2cf5cd);}(_0x0eb9,0xec));var _0x90eb=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0x0eb9[_0x15fc7a];return _0x3aa9f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90eb('0x0'));var zipdir=require(_0x90eb('0x1'));var jsonpatch=require(_0x90eb('0x2'));var rp=require(_0x90eb('0x3'));var moment=require(_0x90eb('0x4'));var BPromise=require(_0x90eb('0x5'));var Mustache=require(_0x90eb('0x6'));var util=require('util');var path=require(_0x90eb('0x7'));var sox=require(_0x90eb('0x8'));var csv=require(_0x90eb('0x9'));var ejs=require(_0x90eb('0xa'));var fs=require('fs');var fs_extra=require(_0x90eb('0xb'));var _=require(_0x90eb('0xc'));var squel=require('squel');var crypto=require(_0x90eb('0xd'));var jsforce=require(_0x90eb('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x90eb('0xf'));var Redis=require(_0x90eb('0x10'));var authService=require(_0x90eb('0x11'));var qs=require(_0x90eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x90eb('0x13'))(_0x90eb('0x14'));var utils=require(_0x90eb('0x15'));var config=require(_0x90eb('0x16'));var licenseUtil=require(_0x90eb('0x17'));var db=require(_0x90eb('0x18'))['db'];function respondWithStatusCode(_0x28cdbf,_0x19b418){_0x19b418=_0x19b418||0xcc;return function(_0x168eb4){if(_0x168eb4){return _0x28cdbf[_0x90eb('0x19')](_0x19b418);}return _0x28cdbf['status'](_0x19b418)[_0x90eb('0x1a')]();};}function respondWithResult(_0x179ce6,_0x2ab1ea){_0x2ab1ea=_0x2ab1ea||0xc8;return function(_0x507cca){if(_0x507cca){return _0x179ce6[_0x90eb('0x1b')](_0x2ab1ea)['json'](_0x507cca);}};}function respondWithFilteredResult(_0x28b53c,_0x17edc5){return function(_0x106669){if(_0x106669){var _0x144624=typeof _0x17edc5[_0x90eb('0x1c')]===_0x90eb('0x1d')&&typeof _0x17edc5[_0x90eb('0x1e')]===_0x90eb('0x1d');var _0x1d3628=_0x106669[_0x90eb('0x1f')];var _0x12d974=_0x144624?0x0:_0x17edc5[_0x90eb('0x1c')];var _0x2761d7=_0x144624?_0x106669[_0x90eb('0x1f')]:_0x17edc5[_0x90eb('0x1c')]+_0x17edc5['limit'];var _0x33d535;if(_0x2761d7>=_0x1d3628){_0x2761d7=_0x1d3628;_0x33d535=0xc8;}else{_0x33d535=0xce;}_0x28b53c[_0x90eb('0x1b')](_0x33d535);return _0x28b53c[_0x90eb('0x20')](_0x90eb('0x21'),_0x12d974+'-'+_0x2761d7+'/'+_0x1d3628)[_0x90eb('0x22')](_0x106669);}return null;};}function patchUpdates(_0x38d2b0){return function(_0x141c4a){try{jsonpatch[_0x90eb('0x23')](_0x141c4a,_0x38d2b0,!![]);}catch(_0x16249d){return BPromise[_0x90eb('0x24')](_0x16249d);}return _0x141c4a[_0x90eb('0x25')]();};}function saveUpdates(_0x2be86b,_0x5afc12){return function(_0x18e367){if(_0x18e367){return _0x18e367[_0x90eb('0x26')](_0x2be86b)[_0x90eb('0x27')](function(_0x2390fb){return _0x2390fb;});}return null;};}function removeEntity(_0x25125e,_0x2e34f8){return function(_0x5c271a){if(_0x5c271a){return _0x5c271a['destroy']()['then'](function(){_0x25125e[_0x90eb('0x1b')](0xcc)[_0x90eb('0x1a')]();});}};}function handleEntityNotFound(_0x777cd4,_0x2d0b12){return function(_0x8de101){if(!_0x8de101){_0x777cd4[_0x90eb('0x19')](0x194);}return _0x8de101;};}function handleError(_0x3edfd0,_0x5883de){_0x5883de=_0x5883de||0x1f4;return function(_0x31a4f7){logger[_0x90eb('0x28')](_0x31a4f7[_0x90eb('0x29')]);if(_0x31a4f7[_0x90eb('0x2a')]){delete _0x31a4f7[_0x90eb('0x2a')];}_0x3edfd0[_0x90eb('0x1b')](_0x5883de)[_0x90eb('0x2b')](_0x31a4f7);};}exports['index']=function(_0x55c952,_0x5577df){var _0x337335={},_0xb56693={},_0x1588a1={'count':0x0,'rows':[]};var _0x2d2063=_[_0x90eb('0x2c')](db[_0x90eb('0x2d')][_0x90eb('0x2e')],function(_0x2f527d){return{'name':_0x2f527d[_0x90eb('0x2f')],'type':_0x2f527d[_0x90eb('0x30')][_0x90eb('0x31')]};});_0xb56693[_0x90eb('0x32')]=_[_0x90eb('0x2c')](_0x2d2063,_0x90eb('0x2a'));_0xb56693['query']=_[_0x90eb('0x33')](_0x55c952[_0x90eb('0x34')]);_0xb56693[_0x90eb('0x35')]=_[_0x90eb('0x36')](_0xb56693[_0x90eb('0x32')],_0xb56693['query']);_0x337335[_0x90eb('0x37')]=_[_0x90eb('0x36')](_0xb56693[_0x90eb('0x32')],qs['fields'](_0x55c952[_0x90eb('0x34')][_0x90eb('0x38')]));_0x337335['attributes']=_0x337335[_0x90eb('0x37')]['length']?_0x337335[_0x90eb('0x37')]:_0xb56693[_0x90eb('0x32')];if(!_0x55c952['query'][_0x90eb('0x39')]('nolimit')){_0x337335[_0x90eb('0x1e')]=qs[_0x90eb('0x1e')](_0x55c952['query'][_0x90eb('0x1e')]);_0x337335[_0x90eb('0x1c')]=qs[_0x90eb('0x1c')](_0x55c952['query'][_0x90eb('0x1c')]);}_0x337335[_0x90eb('0x3a')]=qs[_0x90eb('0x3b')](_0x55c952[_0x90eb('0x34')][_0x90eb('0x3b')]);_0x337335['where']=qs[_0x90eb('0x35')](_[_0x90eb('0x3c')](_0x55c952[_0x90eb('0x34')],_0xb56693['filters']),_0x2d2063);if(_0x55c952[_0x90eb('0x34')][_0x90eb('0x3d')]){_0x337335[_0x90eb('0x3e')]=_['merge'](_0x337335[_0x90eb('0x3e')],{'$or':_[_0x90eb('0x2c')](_0x2d2063,function(_0x5eac72){if(_0x5eac72[_0x90eb('0x30')]!=='VIRTUAL'){var _0x569695={};_0x569695[_0x5eac72[_0x90eb('0x2a')]]={'$like':'%'+_0x55c952[_0x90eb('0x34')][_0x90eb('0x3d')]+'%'};return _0x569695;}})});}_0x337335=_[_0x90eb('0x3f')]({},_0x337335,_0x55c952['options']);var _0x5f218a={'where':_0x337335['where']};return db[_0x90eb('0x2d')][_0x90eb('0x1f')](_0x5f218a)[_0x90eb('0x27')](function(_0x59d685){_0x1588a1[_0x90eb('0x1f')]=_0x59d685;if(_0x55c952[_0x90eb('0x34')][_0x90eb('0x40')]){_0x337335[_0x90eb('0x41')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x90eb('0x42')](_0x337335);})[_0x90eb('0x27')](function(_0x3737d0){_0x1588a1[_0x90eb('0x43')]=_0x3737d0;return _0x1588a1;})[_0x90eb('0x27')](respondWithFilteredResult(_0x5577df,_0x337335))[_0x90eb('0x44')](handleError(_0x5577df,null));};exports['show']=function(_0x364e11,_0x213132){var _0x5980d9={'raw':!![],'where':{'id':_0x364e11['params']['id']}},_0x29f81b={};_0x29f81b[_0x90eb('0x32')]=_[_0x90eb('0x33')](db[_0x90eb('0x2d')][_0x90eb('0x2e')]);_0x29f81b[_0x90eb('0x34')]=_[_0x90eb('0x33')](_0x364e11[_0x90eb('0x34')]);_0x29f81b['filters']=_['intersection'](_0x29f81b[_0x90eb('0x32')],_0x29f81b['query']);_0x5980d9[_0x90eb('0x37')]=_[_0x90eb('0x36')](_0x29f81b[_0x90eb('0x32')],qs[_0x90eb('0x38')](_0x364e11['query'][_0x90eb('0x38')]));_0x5980d9[_0x90eb('0x37')]=_0x5980d9[_0x90eb('0x37')][_0x90eb('0x45')]?_0x5980d9[_0x90eb('0x37')]:_0x29f81b['model'];if(_0x364e11[_0x90eb('0x34')][_0x90eb('0x40')]){_0x5980d9[_0x90eb('0x41')]=[{'all':!![]}];}_0x5980d9=_['merge']({},_0x5980d9,_0x364e11[_0x90eb('0x46')]);return db['FaxTransferReport'][_0x90eb('0x47')](_0x5980d9)[_0x90eb('0x27')](handleEntityNotFound(_0x213132,null))[_0x90eb('0x27')](respondWithResult(_0x213132,null))['catch'](handleError(_0x213132,null));};exports['create']=function(_0x5a954b,_0x3b03d7){return db[_0x90eb('0x2d')]['create'](_0x5a954b[_0x90eb('0x48')],{})['then'](respondWithResult(_0x3b03d7,0xc9))[_0x90eb('0x44')](handleError(_0x3b03d7,null));};exports['update']=function(_0x136d63,_0xf0bae3){if(_0x136d63[_0x90eb('0x48')]['id']){delete _0x136d63['body']['id'];}return db[_0x90eb('0x2d')][_0x90eb('0x47')]({'where':{'id':_0x136d63['params']['id']}})[_0x90eb('0x27')](handleEntityNotFound(_0xf0bae3,null))[_0x90eb('0x27')](saveUpdates(_0x136d63[_0x90eb('0x48')],null))[_0x90eb('0x27')](respondWithResult(_0xf0bae3,null))['catch'](handleError(_0xf0bae3,null));};exports['destroy']=function(_0x3d72a8,_0x4631aa){return db[_0x90eb('0x2d')][_0x90eb('0x47')]({'where':{'id':_0x3d72a8['params']['id']}})[_0x90eb('0x27')](handleEntityNotFound(_0x4631aa,null))[_0x90eb('0x27')](removeEntity(_0x4631aa,null))[_0x90eb('0x44')](handleError(_0x4631aa,null));};exports[_0x90eb('0x49')]=function(_0x5de044,_0x476a16){return db[_0x90eb('0x2d')][_0x90eb('0x49')]()[_0x90eb('0x27')](respondWithResult(_0x476a16,null))[_0x90eb('0x44')](handleError(_0x476a16,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index cd65c0e..bc5bc9e 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 _0xf79e=['exports','define','report_fax_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./faxTransferReport.attributes'];(function(_0x1e7f4d,_0x20acaa){var _0x5f0fd9=function(_0x4dbbf4){while(--_0x4dbbf4){_0x1e7f4d['push'](_0x1e7f4d['shift']());}};_0x5f0fd9(++_0x20acaa);}(_0xf79e,0x185));var _0xef79=function(_0x451638,_0x263f62){_0x451638=_0x451638-0x0;var _0x35fdeb=_0xf79e[_0x451638];return _0x35fdeb;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));module[_0xef79('0x7')]=function(_0x22b3c2,_0x396c51){return _0x22b3c2[_0xef79('0x8')]('FaxTransferReport',attributes,{'tableName':_0xef79('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xef79('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1fed=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','uniqueid','lodash'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x171de5,_0x260fd1){_0x171de5=_0x171de5-0x0;var _0x1c2d68=_0x1fed[_0x171de5];return _0x1c2d68;};'use strict';var _=require(_0xd1fe('0x0'));var util=require('util');var logger=require(_0xd1fe('0x1'))(_0xd1fe('0x2'));var moment=require(_0xd1fe('0x3'));var BPromise=require(_0xd1fe('0x4'));var rp=require(_0xd1fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd1fe('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0xd1fe('0x7')]=function(_0x352f93,_0x4f194d){return _0x352f93['define']('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xd1fe('0x8'),'fields':[_0xd1fe('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4a967dd..aaa0299 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 _0x9b7e=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x2bf47f,_0x4ab9ff){var _0x3fc18d=function(_0x3aa9d2){while(--_0x3aa9d2){_0x2bf47f['push'](_0x2bf47f['shift']());}};_0x3fc18d(++_0x4ab9ff);}(_0x9b7e,0xc8));var _0xe9b7=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x9b7e[_0x3a7634];return _0x23bbe9;};'use strict';var _=require(_0xe9b7('0x0'));var util=require(_0xe9b7('0x1'));var moment=require(_0xe9b7('0x2'));var BPromise=require(_0xe9b7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9b7('0x4'));var db=require(_0xe9b7('0x5'))['db'];var utils=require(_0xe9b7('0x6'));var logger=require(_0xe9b7('0x7'))(_0xe9b7('0x8'));var config=require(_0xe9b7('0x9'));var jayson=require(_0xe9b7('0xa'));var client=jayson[_0xe9b7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b045d,_0x3abf68,_0x63e756){return new BPromise(function(_0x2a8b10,_0x3d9bee){return client[_0xe9b7('0xc')](_0x5b045d,_0x63e756)[_0xe9b7('0xd')](function(_0x266c98){logger['info'](_0xe9b7('0xe'),_0x3abf68,'request\x20sent');logger[_0xe9b7('0xf')](_0xe9b7('0x10'),_0x3abf68,_0xe9b7('0x11'),JSON[_0xe9b7('0x12')](_0x266c98));if(_0x266c98[_0xe9b7('0x13')]){if(_0x266c98['error'][_0xe9b7('0x14')]===0x1f4){logger[_0xe9b7('0x13')](_0xe9b7('0xe'),_0x3abf68,_0x266c98[_0xe9b7('0x13')][_0xe9b7('0x15')]);return _0x3d9bee(_0x266c98[_0xe9b7('0x13')]['message']);}logger[_0xe9b7('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x3abf68,_0x266c98[_0xe9b7('0x13')]['message']);return _0x2a8b10(_0x266c98[_0xe9b7('0x13')][_0xe9b7('0x15')]);}else{logger[_0xe9b7('0x16')](_0xe9b7('0xe'),_0x3abf68,_0xe9b7('0x11'));_0x2a8b10(_0x266c98[_0xe9b7('0x17')][_0xe9b7('0x15')]);}})[_0xe9b7('0x18')](function(_0x2f29fd){logger[_0xe9b7('0x13')](_0xe9b7('0xe'),_0x3abf68,_0x2f29fd);_0x3d9bee(_0x2f29fd);});});} \ No newline at end of file +var _0x8170=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash'];(function(_0x575fc8,_0x44f8bd){var _0x3af95f=function(_0x370ece){while(--_0x370ece){_0x575fc8['push'](_0x575fc8['shift']());}};_0x3af95f(++_0x44f8bd);}(_0x8170,0x1b4));var _0x0817=function(_0x55e7bf,_0x562619){_0x55e7bf=_0x55e7bf-0x0;var _0x5df4b5=_0x8170[_0x55e7bf];return _0x5df4b5;};'use strict';var _=require(_0x0817('0x0'));var util=require(_0x0817('0x1'));var moment=require(_0x0817('0x2'));var BPromise=require(_0x0817('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0817('0x4'));var db=require(_0x0817('0x5'))['db'];var utils=require(_0x0817('0x6'));var logger=require(_0x0817('0x7'))('rpc');var config=require(_0x0817('0x8'));var jayson=require(_0x0817('0x9'));var client=jayson[_0x0817('0xa')][_0x0817('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59c440,_0x54bf3a,_0x3d7ca9){return new BPromise(function(_0x573560,_0x198630){return client['request'](_0x59c440,_0x3d7ca9)[_0x0817('0xc')](function(_0x4c8aca){logger[_0x0817('0xd')](_0x0817('0xe'),_0x54bf3a,_0x0817('0xf'));logger[_0x0817('0x10')](_0x0817('0x11'),_0x54bf3a,_0x0817('0xf'),JSON[_0x0817('0x12')](_0x4c8aca));if(_0x4c8aca['error']){if(_0x4c8aca['error'][_0x0817('0x13')]===0x1f4){logger[_0x0817('0x14')](_0x0817('0xe'),_0x54bf3a,_0x4c8aca[_0x0817('0x14')][_0x0817('0x15')]);return _0x198630(_0x4c8aca[_0x0817('0x14')][_0x0817('0x15')]);}logger[_0x0817('0x14')](_0x0817('0xe'),_0x54bf3a,_0x4c8aca[_0x0817('0x14')]['message']);return _0x573560(_0x4c8aca[_0x0817('0x14')][_0x0817('0x15')]);}else{logger[_0x0817('0xd')](_0x0817('0xe'),_0x54bf3a,_0x0817('0xf'));_0x573560(_0x4c8aca['result'][_0x0817('0x15')]);}})[_0x0817('0x16')](function(_0x970ff2){logger[_0x0817('0x14')](_0x0817('0xe'),_0x54bf3a,_0x970ff2);_0x198630(_0x970ff2);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a74c9b7..089fb3b 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 _0xe8c6=['isAuthenticated','/describe','describe','show','post','create','/:id','update','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get'];(function(_0x4c281b,_0x2442ee){var _0x3807c0=function(_0x4b42b4){while(--_0x4b42b4){_0x4c281b['push'](_0x4c281b['shift']());}};_0x3807c0(++_0x2442ee);}(_0xe8c6,0x1d6));var _0x6e8c=function(_0x258690,_0x227ed1){_0x258690=_0x258690-0x0;var _0x261526=_0xe8c6[_0x258690];return _0x261526;};'use strict';var multer=require(_0x6e8c('0x0'));var util=require(_0x6e8c('0x1'));var path=require('path');var timeout=require(_0x6e8c('0x2'));var express=require(_0x6e8c('0x3'));var router=express['Router']();var fs_extra=require(_0x6e8c('0x4'));var auth=require(_0x6e8c('0x5'));var interaction=require(_0x6e8c('0x6'));var config=require(_0x6e8c('0x7'));var controller=require(_0x6e8c('0x8'));router[_0x6e8c('0x9')]('/',auth[_0x6e8c('0xa')](),controller['index']);router[_0x6e8c('0x9')](_0x6e8c('0xb'),auth[_0x6e8c('0xa')](),controller[_0x6e8c('0xc')]);router['get']('/:id',auth[_0x6e8c('0xa')](),controller[_0x6e8c('0xd')]);router[_0x6e8c('0xe')]('/',auth['isAuthenticated'](),controller[_0x6e8c('0xf')]);router['put'](_0x6e8c('0x10'),auth[_0x6e8c('0xa')](),controller[_0x6e8c('0x11')]);router[_0x6e8c('0x12')]('/:id',auth[_0x6e8c('0xa')](),controller['destroy']);module[_0x6e8c('0x13')]=router; \ No newline at end of file +var _0xc130=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','/:id','post','create'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xc130,0x1e7));var _0x0c13=function(_0x20e254,_0x2386a7){_0x20e254=_0x20e254-0x0;var _0x359aed=_0xc130[_0x20e254];return _0x359aed;};'use strict';var multer=require(_0x0c13('0x0'));var util=require(_0x0c13('0x1'));var path=require(_0x0c13('0x2'));var timeout=require(_0x0c13('0x3'));var express=require(_0x0c13('0x4'));var router=express[_0x0c13('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0c13('0x6'));var interaction=require(_0x0c13('0x7'));var config=require(_0x0c13('0x8'));var controller=require(_0x0c13('0x9'));router['get']('/',auth[_0x0c13('0xa')](),controller[_0x0c13('0xb')]);router[_0x0c13('0xc')](_0x0c13('0xd'),auth[_0x0c13('0xa')](),controller['describe']);router[_0x0c13('0xc')](_0x0c13('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0c13('0xf')]('/',auth[_0x0c13('0xa')](),controller[_0x0c13('0x10')]);router[_0x0c13('0x11')](_0x0c13('0xe'),auth[_0x0c13('0xa')](),controller[_0x0c13('0x12')]);router['delete'](_0x0c13('0xe'),auth[_0x0c13('0xa')](),controller[_0x0c13('0x13')]);module[_0x0c13('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 2821281..cee7c07 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 _0x6761=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','/:id'];(function(_0x54e177,_0x45046f){var _0x55bb4a=function(_0x249e62){while(--_0x249e62){_0x54e177['push'](_0x54e177['shift']());}};_0x55bb4a(++_0x45046f);}(_0x6761,0xab));var _0x1676=function(_0x37292b,_0x1abbda){_0x37292b=_0x37292b-0x0;var _0x5ca516=_0x6761[_0x37292b];return _0x5ca516;};'use strict';var multer=require(_0x1676('0x0'));var util=require(_0x1676('0x1'));var path=require(_0x1676('0x2'));var timeout=require(_0x1676('0x3'));var express=require(_0x1676('0x4'));var router=express[_0x1676('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1676('0x6'));var interaction=require(_0x1676('0x7'));var config=require(_0x1676('0x8'));var controller=require(_0x1676('0x9'));router['get']('/',auth[_0x1676('0xa')](),controller[_0x1676('0xb')]);router[_0x1676('0xc')]('/:id',auth[_0x1676('0xa')](),controller[_0x1676('0xd')]);router[_0x1676('0xc')](_0x1676('0xe'),auth[_0x1676('0xa')](),controller[_0x1676('0xf')]);router[_0x1676('0xc')](_0x1676('0x10'),auth[_0x1676('0xa')](),controller[_0x1676('0x11')]);router['post']('/',auth[_0x1676('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0x1676('0xa')](),controller[_0x1676('0x12')]);router[_0x1676('0x13')](_0x1676('0x14'),auth['isAuthenticated'](),controller[_0x1676('0x15')]);router[_0x1676('0x16')](_0x1676('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x1676('0x17')]=router; \ No newline at end of file +var _0xda52=['put','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xda52,0x124));var _0x2da5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xda52[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x2da5('0x0'));var path=require(_0x2da5('0x1'));var timeout=require('connect-timeout');var express=require(_0x2da5('0x2'));var router=express[_0x2da5('0x3')]();var fs_extra=require(_0x2da5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2da5('0x5'));var config=require(_0x2da5('0x6'));var controller=require(_0x2da5('0x7'));router['get']('/',auth[_0x2da5('0x8')](),controller[_0x2da5('0x9')]);router[_0x2da5('0xa')](_0x2da5('0xb'),auth['isAuthenticated'](),controller[_0x2da5('0xc')]);router[_0x2da5('0xa')](_0x2da5('0xd'),auth[_0x2da5('0x8')](),controller[_0x2da5('0xe')]);router[_0x2da5('0xa')](_0x2da5('0xf'),auth[_0x2da5('0x8')](),controller[_0x2da5('0x10')]);router[_0x2da5('0x11')]('/',auth[_0x2da5('0x8')](),controller[_0x2da5('0x12')]);router['post'](_0x2da5('0xd'),auth[_0x2da5('0x8')](),controller[_0x2da5('0x13')]);router[_0x2da5('0x14')](_0x2da5('0xb'),auth[_0x2da5('0x8')](),controller['update']);router[_0x2da5('0x15')]('/:id',auth[_0x2da5('0x8')](),controller[_0x2da5('0x16')]);module[_0x2da5('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 b06cec1..7cfe920 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 _0x3a33=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x201e20,_0x5e1c42){var _0x210eea=function(_0x4f5e3e){while(--_0x4f5e3e){_0x201e20['push'](_0x201e20['shift']());}};_0x210eea(++_0x5e1c42);}(_0x3a33,0x148));var _0x33a3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3a33[_0x550d12];return _0x12103d;};'use strict';var Sequelize=require('sequelize');module[_0x33a3('0x0')]={'name':{'type':Sequelize[_0x33a3('0x1')]},'description':{'type':Sequelize[_0x33a3('0x1')]},'username':{'type':Sequelize[_0x33a3('0x1')]},'remoteUri':{'type':Sequelize[_0x33a3('0x1')]},'authType':{'type':Sequelize[_0x33a3('0x2')]('basic'),'defaultValue':_0x33a3('0x3')},'password':{'type':Sequelize[_0x33a3('0x1')]},'consumerKey':{'type':Sequelize[_0x33a3('0x1')]},'consumerSecret':{'type':Sequelize[_0x33a3('0x1')]},'token':{'type':Sequelize[_0x33a3('0x1')]},'tokenSecret':{'type':Sequelize[_0x33a3('0x1')]},'serverUrl':{'type':Sequelize[_0x33a3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x33a3('0x2')](_0x33a3('0x4'),_0x33a3('0x5')),'defaultValue':_0x33a3('0x4')}}; \ No newline at end of file +var _0xfc49=['integrationTab','newTab','sequelize','STRING','ENUM','basic'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xfc49,0x128));var _0x9fc4=function(_0x314487,_0x1deac1){_0x314487=_0x314487-0x0;var _0x1c5134=_0xfc49[_0x314487];return _0x1c5134;};'use strict';var Sequelize=require(_0x9fc4('0x0'));module['exports']={'name':{'type':Sequelize[_0x9fc4('0x1')]},'description':{'type':Sequelize[_0x9fc4('0x1')]},'username':{'type':Sequelize[_0x9fc4('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x9fc4('0x2')](_0x9fc4('0x3')),'defaultValue':_0x9fc4('0x3')},'password':{'type':Sequelize[_0x9fc4('0x1')]},'consumerKey':{'type':Sequelize[_0x9fc4('0x1')]},'consumerSecret':{'type':Sequelize[_0x9fc4('0x1')]},'token':{'type':Sequelize[_0x9fc4('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9fc4('0x2')](_0x9fc4('0x4'),_0x9fc4('0x5')),'defaultValue':_0x9fc4('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 64eb302..869b42a 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 _0x7734=['username','password','consumerKey','consumerSecret','token','substring','lastIndexOf','GET','format','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','VIRTUAL','merge','DeskAccount','include','findAll','rows','catch','show','params','options','find','create','body','getConfigurations','order','pick','hasOwnProperty','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType'];(function(_0x2c28e9,_0x2257f1){var _0x3ada94=function(_0x56d210){while(--_0x56d210){_0x2c28e9['push'](_0x2c28e9['shift']());}};_0x3ada94(++_0x2257f1);}(_0x7734,0x1e6));var _0x4773=function(_0x1f5511,_0xd63c35){_0x1f5511=_0x1f5511-0x0;var _0x36a47e=_0x7734[_0x1f5511];return _0x36a47e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4773('0x0'));var jsonpatch=require(_0x4773('0x1'));var rp=require(_0x4773('0x2'));var moment=require('moment');var BPromise=require(_0x4773('0x3'));var Mustache=require(_0x4773('0x4'));var util=require('util');var path=require(_0x4773('0x5'));var sox=require(_0x4773('0x6'));var csv=require(_0x4773('0x7'));var ejs=require(_0x4773('0x8'));var fs=require('fs');var fs_extra=require(_0x4773('0x9'));var _=require(_0x4773('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4773('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4773('0x7'));var querystring=require(_0x4773('0xc'));var Papa=require(_0x4773('0xd'));var Redis=require(_0x4773('0xe'));var authService=require(_0x4773('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4773('0x10'));var hardwareService=require(_0x4773('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4773('0x12'));var config=require(_0x4773('0x13'));var licenseUtil=require(_0x4773('0x14'));var db=require(_0x4773('0x15'))['db'];var integrations=require(_0x4773('0x16'));function respondWithStatusCode(_0x25138e,_0x5a1f57){_0x5a1f57=_0x5a1f57||0xcc;return function(_0x526902){if(_0x526902){return _0x25138e['sendStatus'](_0x5a1f57);}return _0x25138e['status'](_0x5a1f57)[_0x4773('0x17')]();};}function respondWithResult(_0x35c786,_0x5a8daa){_0x5a8daa=_0x5a8daa||0xc8;return function(_0x125a68){if(_0x125a68){return _0x35c786[_0x4773('0x18')](_0x5a8daa)[_0x4773('0x19')](_0x125a68);}};}function respondWithFilteredResult(_0x29a938,_0x597368){return function(_0x55a558){if(_0x55a558){var _0x4945c5=typeof _0x597368[_0x4773('0x1a')]===_0x4773('0x1b')&&typeof _0x597368['limit']===_0x4773('0x1b');var _0x3860a5=_0x55a558['count'];var _0x429209=_0x4945c5?0x0:_0x597368[_0x4773('0x1a')];var _0x12fbf0=_0x4945c5?_0x55a558[_0x4773('0x1c')]:_0x597368['offset']+_0x597368[_0x4773('0x1d')];var _0x4baa0d;if(_0x12fbf0>=_0x3860a5){_0x12fbf0=_0x3860a5;_0x4baa0d=0xc8;}else{_0x4baa0d=0xce;}_0x29a938[_0x4773('0x18')](_0x4baa0d);return _0x29a938[_0x4773('0x1e')](_0x4773('0x1f'),_0x429209+'-'+_0x12fbf0+'/'+_0x3860a5)[_0x4773('0x19')](_0x55a558);}return null;};}function patchUpdates(_0x22e825){return function(_0x426a47){try{jsonpatch['apply'](_0x426a47,_0x22e825,!![]);}catch(_0x1e7960){return BPromise['reject'](_0x1e7960);}return _0x426a47[_0x4773('0x20')]();};}function saveUpdates(_0x168b10,_0x52ce76){return function(_0x515c1b){if(_0x515c1b){return _0x515c1b[_0x4773('0x21')](_0x168b10)[_0x4773('0x22')](function(_0x4436ec){return _0x4436ec;});}return null;};}function removeEntity(_0x223dd7,_0x44c053){return function(_0x4f0574){if(_0x4f0574){return _0x4f0574[_0x4773('0x23')]()['then'](function(){_0x223dd7['status'](0xcc)[_0x4773('0x17')]();});}};}function handleEntityNotFound(_0x15a4da,_0x6f3f87){return function(_0x148483){if(!_0x148483){_0x15a4da[_0x4773('0x24')](0x194);}return _0x148483;};}function handleError(_0x4c8da1,_0xf030a0){_0xf030a0=_0xf030a0||0x1f4;return function(_0x4e8c89){logger[_0x4773('0x25')](_0x4e8c89[_0x4773('0x26')]);if(_0x4e8c89['name']){delete _0x4e8c89[_0x4773('0x27')];}_0x4c8da1[_0x4773('0x18')](_0xf030a0)[_0x4773('0x28')](_0x4e8c89);};}exports[_0x4773('0x29')]=function(_0x540780,_0x166853){var _0x55c14c={},_0x224669={},_0x154027={'count':0x0,'rows':[]};var _0x4fe9fd=_[_0x4773('0x2a')](db['DeskAccount'][_0x4773('0x2b')],function(_0x474263){return{'name':_0x474263[_0x4773('0x2c')],'type':_0x474263[_0x4773('0x2d')][_0x4773('0x2e')]};});_0x224669['model']=_[_0x4773('0x2a')](_0x4fe9fd,_0x4773('0x27'));_0x224669[_0x4773('0x2f')]=_[_0x4773('0x30')](_0x540780['query']);_0x224669['filters']=_[_0x4773('0x31')](_0x224669[_0x4773('0x32')],_0x224669[_0x4773('0x2f')]);_0x55c14c[_0x4773('0x33')]=_[_0x4773('0x31')](_0x224669[_0x4773('0x32')],qs[_0x4773('0x34')](_0x540780['query'][_0x4773('0x34')]));_0x55c14c[_0x4773('0x33')]=_0x55c14c[_0x4773('0x33')][_0x4773('0x35')]?_0x55c14c[_0x4773('0x33')]:_0x224669[_0x4773('0x32')];if(!_0x540780['query']['hasOwnProperty'](_0x4773('0x36'))){_0x55c14c[_0x4773('0x1d')]=qs[_0x4773('0x1d')](_0x540780[_0x4773('0x2f')][_0x4773('0x1d')]);_0x55c14c[_0x4773('0x1a')]=qs[_0x4773('0x1a')](_0x540780[_0x4773('0x2f')][_0x4773('0x1a')]);}_0x55c14c['order']=qs[_0x4773('0x37')](_0x540780[_0x4773('0x2f')][_0x4773('0x37')]);_0x55c14c[_0x4773('0x38')]=qs[_0x4773('0x39')](_['pick'](_0x540780[_0x4773('0x2f')],_0x224669[_0x4773('0x39')]),_0x4fe9fd);if(_0x540780[_0x4773('0x2f')][_0x4773('0x3a')]){_0x55c14c['where']=_['merge'](_0x55c14c['where'],{'$or':_['map'](_0x4fe9fd,function(_0x3d7faf){if(_0x3d7faf[_0x4773('0x2d')]!==_0x4773('0x3b')){var _0x2d6319={};_0x2d6319[_0x3d7faf[_0x4773('0x27')]]={'$like':'%'+_0x540780[_0x4773('0x2f')][_0x4773('0x3a')]+'%'};return _0x2d6319;}})});}_0x55c14c=_[_0x4773('0x3c')]({},_0x55c14c,_0x540780['options']);var _0x51840e={'where':_0x55c14c['where']};return db[_0x4773('0x3d')]['count'](_0x51840e)[_0x4773('0x22')](function(_0x48d32b){_0x154027[_0x4773('0x1c')]=_0x48d32b;if(_0x540780[_0x4773('0x2f')]['includeAll']){_0x55c14c[_0x4773('0x3e')]=[{'all':!![]}];}return db['DeskAccount'][_0x4773('0x3f')](_0x55c14c);})[_0x4773('0x22')](function(_0x378eb4){_0x154027[_0x4773('0x40')]=_0x378eb4;return _0x154027;})[_0x4773('0x22')](respondWithFilteredResult(_0x166853,_0x55c14c))[_0x4773('0x41')](handleError(_0x166853,null));};exports[_0x4773('0x42')]=function(_0x35c8a0,_0x4d2434){var _0x94b532={'raw':![],'where':{'id':_0x35c8a0[_0x4773('0x43')]['id']}},_0x4b9e98={};_0x4b9e98['model']=_[_0x4773('0x30')](db['DeskAccount'][_0x4773('0x2b')]);_0x4b9e98[_0x4773('0x2f')]=_['keys'](_0x35c8a0[_0x4773('0x2f')]);_0x4b9e98[_0x4773('0x39')]=_[_0x4773('0x31')](_0x4b9e98[_0x4773('0x32')],_0x4b9e98['query']);_0x94b532[_0x4773('0x33')]=_[_0x4773('0x31')](_0x4b9e98['model'],qs['fields'](_0x35c8a0[_0x4773('0x2f')][_0x4773('0x34')]));_0x94b532[_0x4773('0x33')]=_0x94b532[_0x4773('0x33')][_0x4773('0x35')]?_0x94b532[_0x4773('0x33')]:_0x4b9e98['model'];if(_0x35c8a0[_0x4773('0x2f')]['includeAll']){_0x94b532[_0x4773('0x3e')]=[{'all':!![]}];}_0x94b532=_['merge']({},_0x94b532,_0x35c8a0[_0x4773('0x44')]);return db['DeskAccount'][_0x4773('0x45')](_0x94b532)[_0x4773('0x22')](handleEntityNotFound(_0x4d2434,null))[_0x4773('0x22')](respondWithResult(_0x4d2434,null))[_0x4773('0x41')](handleError(_0x4d2434,null));};exports[_0x4773('0x46')]=function(_0x3eec4f,_0x5353e6){return db[_0x4773('0x3d')][_0x4773('0x46')](_0x3eec4f[_0x4773('0x47')],{})[_0x4773('0x22')](respondWithResult(_0x5353e6,0xc9))['catch'](handleError(_0x5353e6,null));};exports[_0x4773('0x21')]=function(_0x3f9f66,_0x52f735){if(_0x3f9f66['body']['id']){delete _0x3f9f66['body']['id'];}return db[_0x4773('0x3d')]['find']({'where':{'id':_0x3f9f66[_0x4773('0x43')]['id']}})['then'](handleEntityNotFound(_0x52f735,null))['then'](saveUpdates(_0x3f9f66[_0x4773('0x47')],null))[_0x4773('0x22')](respondWithResult(_0x52f735,null))['catch'](handleError(_0x52f735,null));};exports['destroy']=function(_0x11c5fa,_0x2317ee){return db[_0x4773('0x3d')][_0x4773('0x45')]({'where':{'id':_0x11c5fa[_0x4773('0x43')]['id']}})['then'](handleEntityNotFound(_0x2317ee,null))['then'](removeEntity(_0x2317ee,null))['catch'](handleError(_0x2317ee,null));};exports[_0x4773('0x48')]=function(_0x40e120,_0x2703b4,_0x4a640c){var _0x1843c3={};var _0x2de57c={};var _0x2be45d;var _0x2a3aec;return db[_0x4773('0x3d')]['findOne']({'where':{'id':_0x40e120[_0x4773('0x43')]['id']}})[_0x4773('0x22')](handleEntityNotFound(_0x2703b4,null))['then'](function(_0xf93844){if(_0xf93844){_0x2be45d=_0xf93844;_0x2de57c[_0x4773('0x32')]=_['keys'](db['DeskConfiguration'][_0x4773('0x2b')]);_0x2de57c['query']=_[_0x4773('0x30')](_0x40e120[_0x4773('0x2f')]);_0x2de57c[_0x4773('0x39')]=_[_0x4773('0x31')](_0x2de57c[_0x4773('0x32')],_0x2de57c[_0x4773('0x2f')]);_0x1843c3[_0x4773('0x33')]=_['intersection'](_0x2de57c['model'],qs[_0x4773('0x34')](_0x40e120['query'][_0x4773('0x34')]));_0x1843c3[_0x4773('0x33')]=_0x1843c3[_0x4773('0x33')][_0x4773('0x35')]?_0x1843c3[_0x4773('0x33')]:_0x2de57c[_0x4773('0x32')];_0x1843c3[_0x4773('0x49')]=qs[_0x4773('0x37')](_0x40e120[_0x4773('0x2f')][_0x4773('0x37')]);_0x1843c3[_0x4773('0x38')]=qs[_0x4773('0x39')](_[_0x4773('0x4a')](_0x40e120[_0x4773('0x2f')],_0x2de57c[_0x4773('0x39')]));if(_0x40e120[_0x4773('0x2f')][_0x4773('0x3a')]){_0x1843c3[_0x4773('0x38')]=_['merge'](_0x1843c3['where'],{'$or':_[_0x4773('0x2a')](_0x1843c3[_0x4773('0x33')],function(_0x315404){var _0x169fb3={};_0x169fb3[_0x315404]={'$like':'%'+_0x40e120['query'][_0x4773('0x3a')]+'%'};return _0x169fb3;})});}_0x1843c3=_['merge']({},_0x1843c3,_0x40e120[_0x4773('0x44')]);return _0x2be45d['getConfigurations'](_0x1843c3);}})['then'](function(_0x391643){if(_0x391643){_0x2a3aec=_0x391643['length'];if(!_0x40e120[_0x4773('0x2f')][_0x4773('0x4b')]('nolimit')){_0x1843c3['limit']=qs[_0x4773('0x1d')](_0x40e120[_0x4773('0x2f')][_0x4773('0x1d')]);_0x1843c3[_0x4773('0x1a')]=qs['offset'](_0x40e120[_0x4773('0x2f')][_0x4773('0x1a')]);}return _0x2be45d['getConfigurations'](_0x1843c3);}})['then'](function(_0xe49642){if(_0xe49642){return _0xe49642?{'count':_0x2a3aec,'rows':_0xe49642}:null;}})[_0x4773('0x22')](respondWithResult(_0x2703b4,null))[_0x4773('0x41')](handleError(_0x2703b4,null));};exports['addConfiguration']=function(_0xd01525,_0x2131c0,_0x4e046f){if(_0xd01525[_0x4773('0x47')]['id']){delete _0xd01525['body']['id'];}return db[_0x4773('0x3d')][_0x4773('0x4c')]({'where':{'id':_0xd01525[_0x4773('0x43')]['id']}})[_0x4773('0x22')](handleEntityNotFound(_0x2131c0,null))[_0x4773('0x22')](function(_0x526cb8){if(_0x526cb8){_0xd01525[_0x4773('0x47')][_0x4773('0x4d')]=_0x526cb8['id'];_0xd01525['body'][_0x4773('0x4e')]=integrations[_0x4773('0x4f')](_0xd01525['body'][_0x4773('0x50')],_0xd01525[_0x4773('0x47')][_0x4773('0x2d')]);_0xd01525[_0x4773('0x47')][_0x4773('0x51')]=integrations[_0x4773('0x52')](_0xd01525[_0x4773('0x47')][_0x4773('0x50')],_0xd01525[_0x4773('0x47')][_0x4773('0x2d')]);return db[_0x4773('0x53')][_0x4773('0x46')](_0xd01525[_0x4773('0x47')],{'include':[{'model':db[_0x4773('0x54')],'as':_0x4773('0x4e')},{'model':db['DeskField'],'as':_0x4773('0x51')}]});}return null;})['then'](respondWithResult(_0x2131c0,null))['catch'](handleError(_0x2131c0,null));};exports[_0x4773('0x55')]=function(_0x24be0b,_0x382158,_0x1f2b3f){var _0x4629e8=[{'name':_0x4773('0x56'),'label':_0x4773('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 _0xf155c='';return db[_0x4773('0x3d')][_0x4773('0x4c')]({'where':{'id':_0x24be0b[_0x4773('0x43')]['id']},'attributes':['id',_0x4773('0x57'),_0x4773('0x58'),_0x4773('0x59'),_0x4773('0x5a'),_0x4773('0x5b'),_0x4773('0x5c'),_0x4773('0x5d'),'tokenSecret']})[_0x4773('0x22')](handleEntityNotFound(_0x382158,null))['then'](function(_0x11934e){if(_0x11934e){_0xf155c=_0x11934e['remoteUri'];var _0x4e7b96=_0xf155c['slice'](-0x1);if(_0x4e7b96==='/'){_0xf155c=_0xf155c[_0x4773('0x5e')](0x0,_0xf155c[_0x4773('0x5f')](_0x4e7b96));}var _0xf36476={'method':_0x4773('0x60'),'uri':util[_0x4773('0x61')]('%s/custom_fields',_0xf155c),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x11934e['authType']===_0x4773('0x62')){_0xf36476[_0x4773('0x63')][_0x4773('0x64')]=util[_0x4773('0x61')](_0x4773('0x65'),new Buffer(util[_0x4773('0x61')](_0x4773('0x66'),_0x11934e[_0x4773('0x59')],_0x11934e[_0x4773('0x5a')]))[_0x4773('0x67')](_0x4773('0x68')));}return rp(_0xf36476)[_0x4773('0x22')](function(_0x36f773){return _0x4629e8[_0x4773('0x69')](_[_0x4773('0x2a')](_0x36f773[_0x4773('0x6a')][_0x4773('0x6b')],function(_0x311b55){return{'id':_0x311b55['name'],'name':_0x311b55[_0x4773('0x27')],'type':_0x311b55[_0x4773('0x2d')],'active':_0x311b55[_0x4773('0x6c')],'label':_0x311b55[_0x4773('0x6d')],'custom':!![]};}));});}})['then'](function(_0x5c47fd){return{'count':_0x5c47fd['length'],'rows':_0x5c47fd};})[_0x4773('0x22')](respondWithResult(_0x382158,null))['catch'](function(_0x1aab30){var _0x1b2cf1=_0x24be0b[_0x4773('0x2f')][_0x4773('0x6e')]?0x1f4:_0x1aab30[_0x4773('0x6f')]||0x1f4;logger['error'](_0x4773('0x70'),_0x4773('0x55'),_0x1b2cf1,JSON[_0x4773('0x71')](_0x1aab30));delete _0x1aab30[_0x4773('0x27')];if(_0x1b2cf1===0x191){_0x1b2cf1=0x190;}_0x382158[_0x4773('0x18')](_0x1b2cf1)['send'](_0x24be0b[_0x4773('0x2f')]['test']?{'message':_0x4773('0x72'),'statusCode':_0x1aab30[_0x4773('0x6f')]}:_0x1aab30);});}; \ No newline at end of file +var _0xc249=['password','toString','entries','active','label','test','statusCode','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/util','../../components/integrations/configuration','sendStatus','offset','undefined','limit','count','status','set','reject','update','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','destroy','find','getConfigurations','findOne','DeskConfiguration','pick','filter','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','DeskField','Subjects','getFields','priority','remoteUri','authType','username','consumerSecret','token','tokenSecret','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s'];(function(_0x4ec42,_0x36177b){var _0x385e11=function(_0x44e535){while(--_0x44e535){_0x4ec42['push'](_0x4ec42['shift']());}};_0x385e11(++_0x36177b);}(_0xc249,0x76));var _0x9c24=function(_0x557fe3,_0x1fdff7){_0x557fe3=_0x557fe3-0x0;var _0x203c68=_0xc249[_0x557fe3];return _0x203c68;};'use strict';var emlformat=require(_0x9c24('0x0'));var rimraf=require(_0x9c24('0x1'));var zipdir=require(_0x9c24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c24('0x3'));var moment=require(_0x9c24('0x4'));var BPromise=require(_0x9c24('0x5'));var Mustache=require(_0x9c24('0x6'));var util=require(_0x9c24('0x7'));var path=require(_0x9c24('0x8'));var sox=require(_0x9c24('0x9'));var csv=require(_0x9c24('0xa'));var ejs=require(_0x9c24('0xb'));var fs=require('fs');var fs_extra=require(_0x9c24('0xc'));var _=require(_0x9c24('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9c24('0xe'));var deskjs=require(_0x9c24('0xf'));var toCsv=require(_0x9c24('0xa'));var querystring=require(_0x9c24('0x10'));var Papa=require(_0x9c24('0x11'));var Redis=require(_0x9c24('0x12'));var authService=require(_0x9c24('0x13'));var qs=require(_0x9c24('0x14'));var as=require(_0x9c24('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c24('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9c24('0x17'));function respondWithStatusCode(_0x19cb4e,_0x21fa19){_0x21fa19=_0x21fa19||0xcc;return function(_0x5ef726){if(_0x5ef726){return _0x19cb4e[_0x9c24('0x18')](_0x21fa19);}return _0x19cb4e['status'](_0x21fa19)['end']();};}function respondWithResult(_0x1db8a7,_0x5c305f){_0x5c305f=_0x5c305f||0xc8;return function(_0x171f4f){if(_0x171f4f){return _0x1db8a7['status'](_0x5c305f)['json'](_0x171f4f);}};}function respondWithFilteredResult(_0x21c80a,_0x5c966d){return function(_0x10eab9){if(_0x10eab9){var _0x105468=typeof _0x5c966d[_0x9c24('0x19')]===_0x9c24('0x1a')&&typeof _0x5c966d[_0x9c24('0x1b')]===_0x9c24('0x1a');var _0x3d81ed=_0x10eab9[_0x9c24('0x1c')];var _0x20d1f2=_0x105468?0x0:_0x5c966d[_0x9c24('0x19')];var _0x5f1a54=_0x105468?_0x10eab9['count']:_0x5c966d[_0x9c24('0x19')]+_0x5c966d[_0x9c24('0x1b')];var _0x39d53f;if(_0x5f1a54>=_0x3d81ed){_0x5f1a54=_0x3d81ed;_0x39d53f=0xc8;}else{_0x39d53f=0xce;}_0x21c80a[_0x9c24('0x1d')](_0x39d53f);return _0x21c80a[_0x9c24('0x1e')]('Content-Range',_0x20d1f2+'-'+_0x5f1a54+'/'+_0x3d81ed)['json'](_0x10eab9);}return null;};}function patchUpdates(_0x13c438){return function(_0xb51f3){try{jsonpatch['apply'](_0xb51f3,_0x13c438,!![]);}catch(_0x18cec0){return BPromise[_0x9c24('0x1f')](_0x18cec0);}return _0xb51f3['save']();};}function saveUpdates(_0x1c85c9,_0x1abda4){return function(_0x47f110){if(_0x47f110){return _0x47f110[_0x9c24('0x20')](_0x1c85c9)[_0x9c24('0x21')](function(_0xdaffa9){return _0xdaffa9;});}return null;};}function removeEntity(_0x1d4b44,_0x447cf2){return function(_0x59fff1){if(_0x59fff1){return _0x59fff1['destroy']()['then'](function(){_0x1d4b44[_0x9c24('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37155f,_0x489264){return function(_0x57b314){if(!_0x57b314){_0x37155f[_0x9c24('0x18')](0x194);}return _0x57b314;};}function handleError(_0xaff592,_0x416693){_0x416693=_0x416693||0x1f4;return function(_0x33f2f3){logger[_0x9c24('0x22')](_0x33f2f3[_0x9c24('0x23')]);if(_0x33f2f3[_0x9c24('0x24')]){delete _0x33f2f3[_0x9c24('0x24')];}_0xaff592['status'](_0x416693)[_0x9c24('0x25')](_0x33f2f3);};}exports[_0x9c24('0x26')]=function(_0x399f31,_0x417be4){var _0x302125={},_0x6de98e={},_0x14f9b7={'count':0x0,'rows':[]};var _0x124b6b=_[_0x9c24('0x27')](db[_0x9c24('0x28')][_0x9c24('0x29')],function(_0x77b0a6){return{'name':_0x77b0a6['fieldName'],'type':_0x77b0a6[_0x9c24('0x2a')][_0x9c24('0x2b')]};});_0x6de98e[_0x9c24('0x2c')]=_[_0x9c24('0x27')](_0x124b6b,_0x9c24('0x24'));_0x6de98e[_0x9c24('0x2d')]=_[_0x9c24('0x2e')](_0x399f31[_0x9c24('0x2d')]);_0x6de98e[_0x9c24('0x2f')]=_[_0x9c24('0x30')](_0x6de98e[_0x9c24('0x2c')],_0x6de98e['query']);_0x302125['attributes']=_[_0x9c24('0x30')](_0x6de98e['model'],qs[_0x9c24('0x31')](_0x399f31[_0x9c24('0x2d')][_0x9c24('0x31')]));_0x302125[_0x9c24('0x32')]=_0x302125[_0x9c24('0x32')][_0x9c24('0x33')]?_0x302125[_0x9c24('0x32')]:_0x6de98e[_0x9c24('0x2c')];if(!_0x399f31[_0x9c24('0x2d')][_0x9c24('0x34')](_0x9c24('0x35'))){_0x302125[_0x9c24('0x1b')]=qs[_0x9c24('0x1b')](_0x399f31['query'][_0x9c24('0x1b')]);_0x302125['offset']=qs[_0x9c24('0x19')](_0x399f31[_0x9c24('0x2d')][_0x9c24('0x19')]);}_0x302125[_0x9c24('0x36')]=qs[_0x9c24('0x37')](_0x399f31[_0x9c24('0x2d')][_0x9c24('0x37')]);_0x302125[_0x9c24('0x38')]=qs[_0x9c24('0x2f')](_['pick'](_0x399f31[_0x9c24('0x2d')],_0x6de98e['filters']),_0x124b6b);if(_0x399f31[_0x9c24('0x2d')]['filter']){_0x302125['where']=_[_0x9c24('0x39')](_0x302125['where'],{'$or':_[_0x9c24('0x27')](_0x124b6b,function(_0xb5a903){if(_0xb5a903['type']!==_0x9c24('0x3a')){var _0x3c32c0={};_0x3c32c0[_0xb5a903['name']]={'$like':'%'+_0x399f31[_0x9c24('0x2d')]['filter']+'%'};return _0x3c32c0;}})});}_0x302125=_['merge']({},_0x302125,_0x399f31[_0x9c24('0x3b')]);var _0x5b3e3b={'where':_0x302125[_0x9c24('0x38')]};return db[_0x9c24('0x28')][_0x9c24('0x1c')](_0x5b3e3b)[_0x9c24('0x21')](function(_0xea55f7){_0x14f9b7[_0x9c24('0x1c')]=_0xea55f7;if(_0x399f31['query'][_0x9c24('0x3c')]){_0x302125['include']=[{'all':!![]}];}return db[_0x9c24('0x28')]['findAll'](_0x302125);})[_0x9c24('0x21')](function(_0x48f342){_0x14f9b7[_0x9c24('0x3d')]=_0x48f342;return _0x14f9b7;})[_0x9c24('0x21')](respondWithFilteredResult(_0x417be4,_0x302125))[_0x9c24('0x3e')](handleError(_0x417be4,null));};exports[_0x9c24('0x3f')]=function(_0x317090,_0x16061c){var _0x3f928f={'raw':![],'where':{'id':_0x317090[_0x9c24('0x40')]['id']}},_0x421261={};_0x421261[_0x9c24('0x2c')]=_[_0x9c24('0x2e')](db['DeskAccount'][_0x9c24('0x29')]);_0x421261[_0x9c24('0x2d')]=_[_0x9c24('0x2e')](_0x317090[_0x9c24('0x2d')]);_0x421261[_0x9c24('0x2f')]=_[_0x9c24('0x30')](_0x421261[_0x9c24('0x2c')],_0x421261[_0x9c24('0x2d')]);_0x3f928f['attributes']=_['intersection'](_0x421261[_0x9c24('0x2c')],qs[_0x9c24('0x31')](_0x317090['query'][_0x9c24('0x31')]));_0x3f928f['attributes']=_0x3f928f[_0x9c24('0x32')]['length']?_0x3f928f[_0x9c24('0x32')]:_0x421261[_0x9c24('0x2c')];if(_0x317090[_0x9c24('0x2d')]['includeAll']){_0x3f928f[_0x9c24('0x41')]=[{'all':!![]}];}_0x3f928f=_[_0x9c24('0x39')]({},_0x3f928f,_0x317090[_0x9c24('0x3b')]);return db[_0x9c24('0x28')]['find'](_0x3f928f)[_0x9c24('0x21')](handleEntityNotFound(_0x16061c,null))[_0x9c24('0x21')](respondWithResult(_0x16061c,null))['catch'](handleError(_0x16061c,null));};exports[_0x9c24('0x42')]=function(_0x548a92,_0x3a0663){return db[_0x9c24('0x28')][_0x9c24('0x42')](_0x548a92['body'],{})['then'](respondWithResult(_0x3a0663,0xc9))[_0x9c24('0x3e')](handleError(_0x3a0663,null));};exports[_0x9c24('0x20')]=function(_0x47e3a0,_0x211284){if(_0x47e3a0['body']['id']){delete _0x47e3a0[_0x9c24('0x43')]['id'];}return db[_0x9c24('0x28')]['find']({'where':{'id':_0x47e3a0[_0x9c24('0x40')]['id']}})[_0x9c24('0x21')](handleEntityNotFound(_0x211284,null))[_0x9c24('0x21')](saveUpdates(_0x47e3a0[_0x9c24('0x43')],null))[_0x9c24('0x21')](respondWithResult(_0x211284,null))['catch'](handleError(_0x211284,null));};exports[_0x9c24('0x44')]=function(_0x29ff13,_0x179386){return db['DeskAccount'][_0x9c24('0x45')]({'where':{'id':_0x29ff13[_0x9c24('0x40')]['id']}})['then'](handleEntityNotFound(_0x179386,null))['then'](removeEntity(_0x179386,null))['catch'](handleError(_0x179386,null));};exports[_0x9c24('0x46')]=function(_0x342d49,_0x358dd5,_0x47cce9){var _0x25c22c={};var _0x36a80f={};var _0x25899e;var _0x33ff54;return db[_0x9c24('0x28')][_0x9c24('0x47')]({'where':{'id':_0x342d49['params']['id']}})[_0x9c24('0x21')](handleEntityNotFound(_0x358dd5,null))[_0x9c24('0x21')](function(_0x1e3e51){if(_0x1e3e51){_0x25899e=_0x1e3e51;_0x36a80f['model']=_[_0x9c24('0x2e')](db[_0x9c24('0x48')][_0x9c24('0x29')]);_0x36a80f[_0x9c24('0x2d')]=_[_0x9c24('0x2e')](_0x342d49[_0x9c24('0x2d')]);_0x36a80f[_0x9c24('0x2f')]=_[_0x9c24('0x30')](_0x36a80f[_0x9c24('0x2c')],_0x36a80f[_0x9c24('0x2d')]);_0x25c22c[_0x9c24('0x32')]=_[_0x9c24('0x30')](_0x36a80f[_0x9c24('0x2c')],qs[_0x9c24('0x31')](_0x342d49[_0x9c24('0x2d')][_0x9c24('0x31')]));_0x25c22c[_0x9c24('0x32')]=_0x25c22c[_0x9c24('0x32')][_0x9c24('0x33')]?_0x25c22c[_0x9c24('0x32')]:_0x36a80f[_0x9c24('0x2c')];_0x25c22c[_0x9c24('0x36')]=qs[_0x9c24('0x37')](_0x342d49[_0x9c24('0x2d')]['sort']);_0x25c22c[_0x9c24('0x38')]=qs[_0x9c24('0x2f')](_[_0x9c24('0x49')](_0x342d49[_0x9c24('0x2d')],_0x36a80f[_0x9c24('0x2f')]));if(_0x342d49['query'][_0x9c24('0x4a')]){_0x25c22c['where']=_[_0x9c24('0x39')](_0x25c22c[_0x9c24('0x38')],{'$or':_[_0x9c24('0x27')](_0x25c22c[_0x9c24('0x32')],function(_0x387f62){var _0x20cc65={};_0x20cc65[_0x387f62]={'$like':'%'+_0x342d49['query'][_0x9c24('0x4a')]+'%'};return _0x20cc65;})});}_0x25c22c=_[_0x9c24('0x39')]({},_0x25c22c,_0x342d49[_0x9c24('0x3b')]);return _0x25899e[_0x9c24('0x46')](_0x25c22c);}})['then'](function(_0x3b0d6d){if(_0x3b0d6d){_0x33ff54=_0x3b0d6d[_0x9c24('0x33')];if(!_0x342d49[_0x9c24('0x2d')]['hasOwnProperty'](_0x9c24('0x35'))){_0x25c22c[_0x9c24('0x1b')]=qs[_0x9c24('0x1b')](_0x342d49['query']['limit']);_0x25c22c['offset']=qs[_0x9c24('0x19')](_0x342d49[_0x9c24('0x2d')][_0x9c24('0x19')]);}return _0x25899e[_0x9c24('0x46')](_0x25c22c);}})[_0x9c24('0x21')](function(_0x433c80){if(_0x433c80){return _0x433c80?{'count':_0x33ff54,'rows':_0x433c80}:null;}})['then'](respondWithResult(_0x358dd5,null))['catch'](handleError(_0x358dd5,null));};exports[_0x9c24('0x4b')]=function(_0x4d5894,_0x118918,_0x450410){if(_0x4d5894['body']['id']){delete _0x4d5894['body']['id'];}return db['DeskAccount'][_0x9c24('0x47')]({'where':{'id':_0x4d5894[_0x9c24('0x40')]['id']}})[_0x9c24('0x21')](handleEntityNotFound(_0x118918,null))['then'](function(_0x48738b){if(_0x48738b){_0x4d5894['body'][_0x9c24('0x4c')]=_0x48738b['id'];_0x4d5894['body']['Subjects']=integrations[_0x9c24('0x4d')](_0x4d5894['body']['channel'],_0x4d5894[_0x9c24('0x43')][_0x9c24('0x2a')]);_0x4d5894[_0x9c24('0x43')][_0x9c24('0x4e')]=integrations[_0x9c24('0x4f')](_0x4d5894[_0x9c24('0x43')][_0x9c24('0x50')],_0x4d5894[_0x9c24('0x43')]['type']);return db[_0x9c24('0x48')][_0x9c24('0x42')](_0x4d5894['body'],{'include':[{'model':db[_0x9c24('0x51')],'as':_0x9c24('0x52')},{'model':db[_0x9c24('0x51')],'as':'Descriptions'}]});}return null;})[_0x9c24('0x21')](respondWithResult(_0x118918,null))['catch'](handleError(_0x118918,null));};exports[_0x9c24('0x53')]=function(_0x52c7ba,_0x211431,_0x37350e){var _0x46be61=[{'name':_0x9c24('0x54'),'label':_0x9c24('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4a0a8c='';return db[_0x9c24('0x28')][_0x9c24('0x47')]({'where':{'id':_0x52c7ba[_0x9c24('0x40')]['id']},'attributes':['id',_0x9c24('0x55'),_0x9c24('0x56'),_0x9c24('0x57'),'password','consumerKey',_0x9c24('0x58'),_0x9c24('0x59'),_0x9c24('0x5a')]})['then'](handleEntityNotFound(_0x211431,null))['then'](function(_0x15667e){if(_0x15667e){_0x4a0a8c=_0x15667e[_0x9c24('0x55')];var _0x1b7e86=_0x4a0a8c[_0x9c24('0x5b')](-0x1);if(_0x1b7e86==='/'){_0x4a0a8c=_0x4a0a8c['substring'](0x0,_0x4a0a8c[_0x9c24('0x5c')](_0x1b7e86));}var _0x19fdd0={'method':_0x9c24('0x5d'),'uri':util[_0x9c24('0x5e')](_0x9c24('0x5f'),_0x4a0a8c),'headers':{'Content-Type':_0x9c24('0x60'),'Accept':_0x9c24('0x60')},'json':!![]};if(_0x15667e['authType']===_0x9c24('0x61')){_0x19fdd0[_0x9c24('0x62')][_0x9c24('0x63')]=util[_0x9c24('0x5e')](_0x9c24('0x64'),new Buffer(util['format'](_0x9c24('0x65'),_0x15667e[_0x9c24('0x57')],_0x15667e[_0x9c24('0x66')]))[_0x9c24('0x67')]('base64'));}return rp(_0x19fdd0)[_0x9c24('0x21')](function(_0x4e96d5){return _0x46be61['concat'](_[_0x9c24('0x27')](_0x4e96d5['_embedded'][_0x9c24('0x68')],function(_0x4e0e97){return{'id':_0x4e0e97[_0x9c24('0x24')],'name':_0x4e0e97['name'],'type':_0x4e0e97[_0x9c24('0x2a')],'active':_0x4e0e97[_0x9c24('0x69')],'label':_0x4e0e97[_0x9c24('0x6a')],'custom':!![]};}));});}})[_0x9c24('0x21')](function(_0x2c3ee2){return{'count':_0x2c3ee2[_0x9c24('0x33')],'rows':_0x2c3ee2};})['then'](respondWithResult(_0x211431,null))['catch'](function(_0x3bb713){var _0x3a36a3=_0x52c7ba['query'][_0x9c24('0x6b')]?0x1f4:_0x3bb713[_0x9c24('0x6c')]||0x1f4;logger[_0x9c24('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x9c24('0x53'),_0x3a36a3,JSON[_0x9c24('0x6d')](_0x3bb713));delete _0x3bb713[_0x9c24('0x24')];if(_0x3a36a3===0x191){_0x3a36a3=0x190;}_0x211431['status'](_0x3a36a3)[_0x9c24('0x25')](_0x52c7ba['query'][_0x9c24('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x3bb713['statusCode']}:_0x3bb713);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0726f06..a73f43f 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 _0xf25d=['path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','api','moment','bluebird','request-promise'];(function(_0x7090b,_0xb19960){var _0x526c77=function(_0x3793ff){while(--_0x3793ff){_0x7090b['push'](_0x7090b['shift']());}};_0x526c77(++_0xb19960);}(_0xf25d,0xa3));var _0xdf25=function(_0x135aa2,_0x4d6596){_0x135aa2=_0x135aa2-0x0;var _0x38a99a=_0xf25d[_0x135aa2];return _0x38a99a;};'use strict';var _=require('lodash');var util=require(_0xdf25('0x0'));var logger=require('../../config/logger')(_0xdf25('0x1'));var moment=require(_0xdf25('0x2'));var BPromise=require(_0xdf25('0x3'));var rp=require(_0xdf25('0x4'));var fs=require('fs');var path=require(_0xdf25('0x5'));var rimraf=require(_0xdf25('0x6'));var config=require(_0xdf25('0x7'));var attributes=require(_0xdf25('0x8'));var integrations=require(_0xdf25('0x9'));module[_0xdf25('0xa')]=function(_0x4a14be,_0x5e5556){return _0x4a14be[_0xdf25('0xb')](_0xdf25('0xc'),attributes,{'tableName':_0xdf25('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0f2d=['rimraf','../../config/environment','exports','define','DeskAccount','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x219f7a,_0x5d1ce7){var _0x1cdeb2=function(_0x19165f){while(--_0x19165f){_0x219f7a['push'](_0x219f7a['shift']());}};_0x1cdeb2(++_0x5d1ce7);}(_0x0f2d,0xa2));var _0xd0f2=function(_0x4918fb,_0x59a41d){_0x4918fb=_0x4918fb-0x0;var _0x42ef2a=_0x0f2d[_0x4918fb];return _0x42ef2a;};'use strict';var _=require(_0xd0f2('0x0'));var util=require(_0xd0f2('0x1'));var logger=require('../../config/logger')(_0xd0f2('0x2'));var moment=require(_0xd0f2('0x3'));var BPromise=require(_0xd0f2('0x4'));var rp=require(_0xd0f2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0f2('0x6'));var config=require(_0xd0f2('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd0f2('0x8')]=function(_0x2c764c,_0x45e2c1){return _0x2c764c[_0xd0f2('0x9')](_0xd0f2('0xa'),attributes,{'tableName':_0xd0f2('0xb'),'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 464b665..dd02685 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 _0xf83a=['info','request\x20sent','debug','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','limit','include','map','attributes','model','ShowDeskAccount','find','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then'];(function(_0x4b1576,_0x28e92e){var _0x293a2f=function(_0x5e40e7){while(--_0x5e40e7){_0x4b1576['push'](_0x4b1576['shift']());}};_0x293a2f(++_0x28e92e);}(_0xf83a,0x9e));var _0xaf83=function(_0x1fcaf1,_0x21c3c2){_0x1fcaf1=_0x1fcaf1-0x0;var _0x55f464=_0xf83a[_0x1fcaf1];return _0x55f464;};'use strict';var _=require(_0xaf83('0x0'));var util=require(_0xaf83('0x1'));var moment=require(_0xaf83('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf83('0x3'));var fs=require('fs');var Redis=require(_0xaf83('0x4'));var db=require(_0xaf83('0x5'))['db'];var utils=require(_0xaf83('0x6'));var logger=require('../../config/logger')(_0xaf83('0x7'));var config=require(_0xaf83('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaf83('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536e60,_0x2df339,_0x2c0208){return new BPromise(function(_0x24d3ae,_0x1f84b9){return client[_0xaf83('0xa')](_0x536e60,_0x2c0208)[_0xaf83('0xb')](function(_0x27967d){logger[_0xaf83('0xc')]('DeskAccount,\x20%s,\x20%s',_0x2df339,_0xaf83('0xd'));logger[_0xaf83('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x2df339,'request\x20sent',JSON['stringify'](_0x27967d));if(_0x27967d[_0xaf83('0xf')]){if(_0x27967d[_0xaf83('0xf')][_0xaf83('0x10')]===0x1f4){logger['error'](_0xaf83('0x11'),_0x2df339,_0x27967d[_0xaf83('0xf')]['message']);return _0x1f84b9(_0x27967d['error']['message']);}logger[_0xaf83('0xf')](_0xaf83('0x11'),_0x2df339,_0x27967d[_0xaf83('0xf')]['message']);return _0x24d3ae(_0x27967d[_0xaf83('0xf')][_0xaf83('0x12')]);}else{logger[_0xaf83('0xc')](_0xaf83('0x11'),_0x2df339,_0xaf83('0xd'));_0x24d3ae(_0x27967d[_0xaf83('0x13')][_0xaf83('0x12')]);}})[_0xaf83('0x14')](function(_0x426842){logger['error'](_0xaf83('0x11'),_0x2df339,_0x426842);_0x1f84b9(_0x426842);});});}exports[_0xaf83('0x15')]=function(_0x2b2e6e){var _0x24bd53=this;return new Promise(function(_0x569a8b,_0x2adcb8){return db[_0xaf83('0x16')][_0xaf83('0x17')]({'raw':_0x2b2e6e[_0xaf83('0x18')]?_0x2b2e6e[_0xaf83('0x18')][_0xaf83('0x19')]===undefined?!![]:![]:!![],'where':_0x2b2e6e[_0xaf83('0x18')]?_0x2b2e6e['options']['where']||null:null,'attributes':_0x2b2e6e['options']?_0x2b2e6e[_0xaf83('0x18')]['attributes']||null:null,'limit':_0x2b2e6e[_0xaf83('0x18')]?_0x2b2e6e[_0xaf83('0x18')][_0xaf83('0x1a')]||null:null,'include':_0x2b2e6e['options']?_0x2b2e6e[_0xaf83('0x18')][_0xaf83('0x1b')]?_[_0xaf83('0x1c')](_0x2b2e6e[_0xaf83('0x18')][_0xaf83('0x1b')],function(_0x116540){return{'model':db[_0x116540['model']],'as':_0x116540['as'],'attributes':_0x116540[_0xaf83('0x1d')],'include':_0x116540['include']?_['map'](_0x116540['include'],function(_0x294185){return{'model':db[_0x294185[_0xaf83('0x1e')]],'as':_0x294185['as'],'attributes':_0x294185['attributes'],'include':_0x294185[_0xaf83('0x1b')]?_[_0xaf83('0x1c')](_0x294185[_0xaf83('0x1b')],function(_0x1ec9bf){return{'model':db[_0x1ec9bf['model']],'as':_0x1ec9bf['as'],'attributes':_0x1ec9bf[_0xaf83('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf83('0xb')](function(_0x25a124){logger[_0xaf83('0xc')](_0xaf83('0x15'),_0x2b2e6e);logger['debug']('GetDeskAccount',_0x2b2e6e,JSON['stringify'](_0x25a124));_0x569a8b(_0x25a124);})[_0xaf83('0x14')](function(_0x416cd6){logger[_0xaf83('0xf')](_0xaf83('0x15'),_0x416cd6[_0xaf83('0x12')],_0x2b2e6e);_0x2adcb8(_0x24bd53['error'](0x1f4,_0x416cd6[_0xaf83('0x12')]));});});};exports[_0xaf83('0x1f')]=function(_0x5ecf58){var _0x48f808=this;return new Promise(function(_0x4f5d62,_0x4bc8c9){return db['DeskAccount'][_0xaf83('0x20')]({'raw':_0x5ecf58[_0xaf83('0x18')]?_0x5ecf58['options'][_0xaf83('0x19')]===undefined?!![]:![]:!![],'where':_0x5ecf58[_0xaf83('0x18')]?_0x5ecf58[_0xaf83('0x18')]['where']||null:null,'attributes':_0x5ecf58['options']?_0x5ecf58['options'][_0xaf83('0x1d')]||null:null,'include':_0x5ecf58[_0xaf83('0x18')]?_0x5ecf58[_0xaf83('0x18')]['include']?_['map'](_0x5ecf58[_0xaf83('0x18')][_0xaf83('0x1b')],function(_0x208564){return{'model':db[_0x208564['model']],'as':_0x208564['as'],'attributes':_0x208564[_0xaf83('0x1d')],'include':_0x208564[_0xaf83('0x1b')]?_[_0xaf83('0x1c')](_0x208564[_0xaf83('0x1b')],function(_0x222bdb){return{'model':db[_0x222bdb[_0xaf83('0x1e')]],'as':_0x222bdb['as'],'attributes':_0x222bdb[_0xaf83('0x1d')],'include':_0x222bdb[_0xaf83('0x1b')]?_[_0xaf83('0x1c')](_0x222bdb['include'],function(_0x2a45ba){return{'model':db[_0x2a45ba[_0xaf83('0x1e')]],'as':_0x2a45ba['as'],'attributes':_0x2a45ba['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf83('0xb')](function(_0x279511){logger[_0xaf83('0xc')](_0xaf83('0x1f'),_0x5ecf58);logger['debug'](_0xaf83('0x1f'),_0x5ecf58,JSON[_0xaf83('0x21')](_0x279511));_0x4f5d62(_0x279511);})[_0xaf83('0x14')](function(_0x13f367){logger[_0xaf83('0xf')](_0xaf83('0x1f'),_0x13f367[_0xaf83('0x12')],_0x5ecf58);_0x4bc8c9(_0x48f808[_0xaf83('0xf')](0x1f4,_0x13f367[_0xaf83('0x12')]));});});}; \ No newline at end of file +var _0x0d9e=['moment','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','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','raw','where','attributes','include','map','model','ShowDeskAccount','find','lodash','util'];(function(_0x23ced6,_0x4e1238){var _0x14ba1b=function(_0xd92213){while(--_0xd92213){_0x23ced6['push'](_0x23ced6['shift']());}};_0x14ba1b(++_0x4e1238);}(_0x0d9e,0x1ab));var _0xe0d9=function(_0x2f1b91,_0x65cb11){_0x2f1b91=_0x2f1b91-0x0;var _0x2b4eb1=_0x0d9e[_0x2f1b91];return _0x2b4eb1;};'use strict';var _=require(_0xe0d9('0x0'));var util=require(_0xe0d9('0x1'));var moment=require(_0xe0d9('0x2'));var BPromise=require('bluebird');var rs=require(_0xe0d9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe0d9('0x4'))['db'];var utils=require(_0xe0d9('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe0d9('0x6'));var client=jayson[_0xe0d9('0x7')][_0xe0d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35134c,_0x558cdb,_0x37f334){return new BPromise(function(_0x15abfc,_0x28066a){return client[_0xe0d9('0x9')](_0x35134c,_0x37f334)[_0xe0d9('0xa')](function(_0x4a3c58){logger[_0xe0d9('0xb')](_0xe0d9('0xc'),_0x558cdb,_0xe0d9('0xd'));logger[_0xe0d9('0xe')](_0xe0d9('0xf'),_0x558cdb,'request\x20sent',JSON[_0xe0d9('0x10')](_0x4a3c58));if(_0x4a3c58['error']){if(_0x4a3c58[_0xe0d9('0x11')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x558cdb,_0x4a3c58[_0xe0d9('0x11')][_0xe0d9('0x12')]);return _0x28066a(_0x4a3c58[_0xe0d9('0x11')][_0xe0d9('0x12')]);}logger['error'](_0xe0d9('0xc'),_0x558cdb,_0x4a3c58[_0xe0d9('0x11')][_0xe0d9('0x12')]);return _0x15abfc(_0x4a3c58['error'][_0xe0d9('0x12')]);}else{logger[_0xe0d9('0xb')](_0xe0d9('0xc'),_0x558cdb,'request\x20sent');_0x15abfc(_0x4a3c58[_0xe0d9('0x13')]['message']);}})[_0xe0d9('0x14')](function(_0x441e67){logger[_0xe0d9('0x11')](_0xe0d9('0xc'),_0x558cdb,_0x441e67);_0x28066a(_0x441e67);});});}exports[_0xe0d9('0x15')]=function(_0x53dd24){var _0x1cf0c1=this;return new Promise(function(_0x43bf69,_0x231b8d){return db[_0xe0d9('0x16')][_0xe0d9('0x17')]({'raw':_0x53dd24[_0xe0d9('0x18')]?_0x53dd24[_0xe0d9('0x18')][_0xe0d9('0x19')]===undefined?!![]:![]:!![],'where':_0x53dd24[_0xe0d9('0x18')]?_0x53dd24[_0xe0d9('0x18')][_0xe0d9('0x1a')]||null:null,'attributes':_0x53dd24['options']?_0x53dd24[_0xe0d9('0x18')][_0xe0d9('0x1b')]||null:null,'limit':_0x53dd24[_0xe0d9('0x18')]?_0x53dd24[_0xe0d9('0x18')]['limit']||null:null,'include':_0x53dd24[_0xe0d9('0x18')]?_0x53dd24[_0xe0d9('0x18')][_0xe0d9('0x1c')]?_[_0xe0d9('0x1d')](_0x53dd24[_0xe0d9('0x18')][_0xe0d9('0x1c')],function(_0x55eda1){return{'model':db[_0x55eda1[_0xe0d9('0x1e')]],'as':_0x55eda1['as'],'attributes':_0x55eda1[_0xe0d9('0x1b')],'include':_0x55eda1[_0xe0d9('0x1c')]?_['map'](_0x55eda1[_0xe0d9('0x1c')],function(_0x4ce879){return{'model':db[_0x4ce879[_0xe0d9('0x1e')]],'as':_0x4ce879['as'],'attributes':_0x4ce879[_0xe0d9('0x1b')],'include':_0x4ce879[_0xe0d9('0x1c')]?_[_0xe0d9('0x1d')](_0x4ce879[_0xe0d9('0x1c')],function(_0xa8b86){return{'model':db[_0xa8b86[_0xe0d9('0x1e')]],'as':_0xa8b86['as'],'attributes':_0xa8b86[_0xe0d9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0d9('0xa')](function(_0x33c74c){logger[_0xe0d9('0xb')](_0xe0d9('0x15'),_0x53dd24);logger[_0xe0d9('0xe')]('GetDeskAccount',_0x53dd24,JSON[_0xe0d9('0x10')](_0x33c74c));_0x43bf69(_0x33c74c);})[_0xe0d9('0x14')](function(_0x29eb5){logger['error'](_0xe0d9('0x15'),_0x29eb5[_0xe0d9('0x12')],_0x53dd24);_0x231b8d(_0x1cf0c1[_0xe0d9('0x11')](0x1f4,_0x29eb5['message']));});});};exports[_0xe0d9('0x1f')]=function(_0x30d40d){var _0x507074=this;return new Promise(function(_0x39e602,_0x479727){return db[_0xe0d9('0x16')][_0xe0d9('0x20')]({'raw':_0x30d40d[_0xe0d9('0x18')]?_0x30d40d[_0xe0d9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x30d40d[_0xe0d9('0x18')]?_0x30d40d[_0xe0d9('0x18')][_0xe0d9('0x1a')]||null:null,'attributes':_0x30d40d[_0xe0d9('0x18')]?_0x30d40d[_0xe0d9('0x18')][_0xe0d9('0x1b')]||null:null,'include':_0x30d40d[_0xe0d9('0x18')]?_0x30d40d[_0xe0d9('0x18')]['include']?_['map'](_0x30d40d['options']['include'],function(_0x415720){return{'model':db[_0x415720[_0xe0d9('0x1e')]],'as':_0x415720['as'],'attributes':_0x415720['attributes'],'include':_0x415720[_0xe0d9('0x1c')]?_[_0xe0d9('0x1d')](_0x415720['include'],function(_0x22707e){return{'model':db[_0x22707e[_0xe0d9('0x1e')]],'as':_0x22707e['as'],'attributes':_0x22707e[_0xe0d9('0x1b')],'include':_0x22707e[_0xe0d9('0x1c')]?_[_0xe0d9('0x1d')](_0x22707e[_0xe0d9('0x1c')],function(_0x14caee){return{'model':db[_0x14caee[_0xe0d9('0x1e')]],'as':_0x14caee['as'],'attributes':_0x14caee[_0xe0d9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0d9('0xa')](function(_0x403dc2){logger['info'](_0xe0d9('0x1f'),_0x30d40d);logger[_0xe0d9('0xe')](_0xe0d9('0x1f'),_0x30d40d,JSON[_0xe0d9('0x10')](_0x403dc2));_0x39e602(_0x403dc2);})[_0xe0d9('0x14')](function(_0x2480a2){logger[_0xe0d9('0x11')](_0xe0d9('0x1f'),_0x2480a2[_0xe0d9('0x12')],_0x30d40d);_0x479727(_0x507074[_0xe0d9('0x11')](0x1f4,_0x2480a2['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 514e4ba..0e21d5a 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 _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x8aa996,_0x14e50e){var _0x274dd1=function(_0x7945ba){while(--_0x7945ba){_0x8aa996['push'](_0x8aa996['shift']());}};_0x274dd1(++_0x14e50e);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0xb5fec3,_0x156398){var _0x2c90ec=function(_0x1ff6df){while(--_0x1ff6df){_0xb5fec3['push'](_0xb5fec3['shift']());}};_0x2c90ec(++_0x156398);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 2c752ab..99a9bb6 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 _0xe9f6=['sequelize','exports','STRING'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0xe9f6,0x1d4));var _0x6e9f=function(_0x1ec29e,_0x62165b){_0x1ec29e=_0x1ec29e-0x0;var _0x559508=_0xe9f6[_0x1ec29e];return _0x559508;};'use strict';var Sequelize=require(_0x6e9f('0x0'));module[_0x6e9f('0x1')]={'name':{'type':Sequelize[_0x6e9f('0x2')]},'description':{'type':Sequelize[_0x6e9f('0x2')]}}; \ No newline at end of file +var _0xefb7=['STRING','exports'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0xefb7,0xf9));var _0x7efb=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xefb7[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require('sequelize');module[_0x7efb('0x0')]={'name':{'type':Sequelize[_0x7efb('0x1')]},'description':{'type':Sequelize[_0x7efb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 184417a..aac2df5 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 _0xad0f=['path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','findOne','DeskField','order','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x5f8992,_0x5c07c3){var _0x2687cb=function(_0x16c61d){while(--_0x16c61d){_0x5f8992['push'](_0x5f8992['shift']());}};_0x2687cb(++_0x5c07c3);}(_0xad0f,0xa1));var _0xfad0=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0xad0f[_0x3c504b];return _0x2e5354;};'use strict';var emlformat=require(_0xfad0('0x0'));var rimraf=require(_0xfad0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfad0('0x2'));var rp=require(_0xfad0('0x3'));var moment=require(_0xfad0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfad0('0x5'));var sox=require(_0xfad0('0x6'));var csv=require(_0xfad0('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfad0('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfad0('0x9'));var jsforce=require(_0xfad0('0xa'));var deskjs=require(_0xfad0('0xb'));var toCsv=require(_0xfad0('0x7'));var querystring=require(_0xfad0('0xc'));var Papa=require(_0xfad0('0xd'));var Redis=require(_0xfad0('0xe'));var authService=require(_0xfad0('0xf'));var qs=require(_0xfad0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfad0('0x11'))(_0xfad0('0x12'));var utils=require(_0xfad0('0x13'));var config=require(_0xfad0('0x14'));var licenseUtil=require(_0xfad0('0x15'));var db=require(_0xfad0('0x16'))['db'];function respondWithStatusCode(_0x4633f5,_0x40cb7a){_0x40cb7a=_0x40cb7a||0xcc;return function(_0x5a065d){if(_0x5a065d){return _0x4633f5['sendStatus'](_0x40cb7a);}return _0x4633f5[_0xfad0('0x17')](_0x40cb7a)[_0xfad0('0x18')]();};}function respondWithResult(_0x1e1de2,_0x5ad519){_0x5ad519=_0x5ad519||0xc8;return function(_0x26ab21){if(_0x26ab21){return _0x1e1de2[_0xfad0('0x17')](_0x5ad519)[_0xfad0('0x19')](_0x26ab21);}};}function respondWithFilteredResult(_0x26aa7a,_0x1130e8){return function(_0x5fec44){if(_0x5fec44){var _0x12685c=typeof _0x1130e8[_0xfad0('0x1a')]==='undefined'&&typeof _0x1130e8[_0xfad0('0x1b')]===_0xfad0('0x1c');var _0xaeb59d=_0x5fec44[_0xfad0('0x1d')];var _0x330564=_0x12685c?0x0:_0x1130e8[_0xfad0('0x1a')];var _0x224bef=_0x12685c?_0x5fec44[_0xfad0('0x1d')]:_0x1130e8[_0xfad0('0x1a')]+_0x1130e8[_0xfad0('0x1b')];var _0x154f0f;if(_0x224bef>=_0xaeb59d){_0x224bef=_0xaeb59d;_0x154f0f=0xc8;}else{_0x154f0f=0xce;}_0x26aa7a['status'](_0x154f0f);return _0x26aa7a[_0xfad0('0x1e')](_0xfad0('0x1f'),_0x330564+'-'+_0x224bef+'/'+_0xaeb59d)[_0xfad0('0x19')](_0x5fec44);}return null;};}function patchUpdates(_0x33c0fd){return function(_0x1f84e5){try{jsonpatch[_0xfad0('0x20')](_0x1f84e5,_0x33c0fd,!![]);}catch(_0x2d1fde){return BPromise[_0xfad0('0x21')](_0x2d1fde);}return _0x1f84e5[_0xfad0('0x22')]();};}function saveUpdates(_0xd80853,_0x5074ef){return function(_0x478956){if(_0x478956){return _0x478956[_0xfad0('0x23')](_0xd80853)[_0xfad0('0x24')](function(_0x5ebc04){return _0x5ebc04;});}return null;};}function removeEntity(_0x152f38,_0x3de28e){return function(_0x50552c){if(_0x50552c){return _0x50552c['destroy']()[_0xfad0('0x24')](function(){_0x152f38[_0xfad0('0x17')](0xcc)[_0xfad0('0x18')]();});}};}function handleEntityNotFound(_0x2ccc91,_0x148127){return function(_0x76b376){if(!_0x76b376){_0x2ccc91[_0xfad0('0x25')](0x194);}return _0x76b376;};}function handleError(_0x574369,_0x476cc4){_0x476cc4=_0x476cc4||0x1f4;return function(_0x463ff6){logger['error'](_0x463ff6['stack']);if(_0x463ff6['name']){delete _0x463ff6[_0xfad0('0x26')];}_0x574369['status'](_0x476cc4)[_0xfad0('0x27')](_0x463ff6);};}exports[_0xfad0('0x28')]=function(_0x2df62f,_0x150069){var _0x4fb1ad={},_0xe166ad={},_0x23cdc4={'count':0x0,'rows':[]};var _0x245d66=_['map'](db[_0xfad0('0x29')][_0xfad0('0x2a')],function(_0x5d9752){return{'name':_0x5d9752[_0xfad0('0x2b')],'type':_0x5d9752[_0xfad0('0x2c')][_0xfad0('0x2d')]};});_0xe166ad[_0xfad0('0x2e')]=_[_0xfad0('0x2f')](_0x245d66,_0xfad0('0x26'));_0xe166ad[_0xfad0('0x30')]=_[_0xfad0('0x31')](_0x2df62f[_0xfad0('0x30')]);_0xe166ad[_0xfad0('0x32')]=_[_0xfad0('0x33')](_0xe166ad[_0xfad0('0x2e')],_0xe166ad[_0xfad0('0x30')]);_0x4fb1ad[_0xfad0('0x34')]=_['intersection'](_0xe166ad[_0xfad0('0x2e')],qs[_0xfad0('0x35')](_0x2df62f['query']['fields']));_0x4fb1ad[_0xfad0('0x34')]=_0x4fb1ad[_0xfad0('0x34')][_0xfad0('0x36')]?_0x4fb1ad[_0xfad0('0x34')]:_0xe166ad[_0xfad0('0x2e')];if(!_0x2df62f[_0xfad0('0x30')][_0xfad0('0x37')](_0xfad0('0x38'))){_0x4fb1ad[_0xfad0('0x1b')]=qs[_0xfad0('0x1b')](_0x2df62f[_0xfad0('0x30')][_0xfad0('0x1b')]);_0x4fb1ad[_0xfad0('0x1a')]=qs[_0xfad0('0x1a')](_0x2df62f[_0xfad0('0x30')][_0xfad0('0x1a')]);}_0x4fb1ad['order']=qs['sort'](_0x2df62f[_0xfad0('0x30')][_0xfad0('0x39')]);_0x4fb1ad[_0xfad0('0x3a')]=qs['filters'](_[_0xfad0('0x3b')](_0x2df62f['query'],_0xe166ad[_0xfad0('0x32')]),_0x245d66);if(_0x2df62f[_0xfad0('0x30')][_0xfad0('0x3c')]){_0x4fb1ad[_0xfad0('0x3a')]=_[_0xfad0('0x3d')](_0x4fb1ad[_0xfad0('0x3a')],{'$or':_[_0xfad0('0x2f')](_0x245d66,function(_0x1f6174){if(_0x1f6174[_0xfad0('0x2c')]!==_0xfad0('0x3e')){var _0x49d039={};_0x49d039[_0x1f6174[_0xfad0('0x26')]]={'$like':'%'+_0x2df62f['query']['filter']+'%'};return _0x49d039;}})});}_0x4fb1ad=_['merge']({},_0x4fb1ad,_0x2df62f[_0xfad0('0x3f')]);var _0x57036d={'where':_0x4fb1ad[_0xfad0('0x3a')]};return db['DeskConfiguration']['count'](_0x57036d)[_0xfad0('0x24')](function(_0x107124){_0x23cdc4[_0xfad0('0x1d')]=_0x107124;if(_0x2df62f[_0xfad0('0x30')]['includeAll']){_0x4fb1ad['include']=[{'all':!![]}];}return db[_0xfad0('0x29')][_0xfad0('0x40')](_0x4fb1ad);})[_0xfad0('0x24')](function(_0x5ee9ae){_0x23cdc4[_0xfad0('0x41')]=_0x5ee9ae;return _0x23cdc4;})['then'](respondWithFilteredResult(_0x150069,_0x4fb1ad))[_0xfad0('0x42')](handleError(_0x150069,null));};exports[_0xfad0('0x43')]=function(_0xb21a5c,_0xe2b4d8){var _0x138b2a={'raw':![],'where':{'id':_0xb21a5c[_0xfad0('0x44')]['id']}},_0x261cf={};_0x261cf['model']=_[_0xfad0('0x31')](db['DeskConfiguration'][_0xfad0('0x2a')]);_0x261cf[_0xfad0('0x30')]=_[_0xfad0('0x31')](_0xb21a5c[_0xfad0('0x30')]);_0x261cf['filters']=_[_0xfad0('0x33')](_0x261cf[_0xfad0('0x2e')],_0x261cf['query']);_0x138b2a[_0xfad0('0x34')]=_['intersection'](_0x261cf[_0xfad0('0x2e')],qs[_0xfad0('0x35')](_0xb21a5c[_0xfad0('0x30')]['fields']));_0x138b2a[_0xfad0('0x34')]=_0x138b2a[_0xfad0('0x34')][_0xfad0('0x36')]?_0x138b2a['attributes']:_0x261cf[_0xfad0('0x2e')];if(_0xb21a5c['query'][_0xfad0('0x45')]){_0x138b2a['include']=[{'all':!![]}];}_0x138b2a=_['merge']({},_0x138b2a,_0xb21a5c[_0xfad0('0x3f')]);return db[_0xfad0('0x29')][_0xfad0('0x46')](_0x138b2a)[_0xfad0('0x24')](handleEntityNotFound(_0xe2b4d8,null))['then'](respondWithResult(_0xe2b4d8,null))[_0xfad0('0x42')](handleError(_0xe2b4d8,null));};exports[_0xfad0('0x47')]=function(_0x4554c3,_0x176df5){return db['DeskConfiguration']['create'](_0x4554c3[_0xfad0('0x48')],{})[_0xfad0('0x24')](respondWithResult(_0x176df5,0xc9))['catch'](handleError(_0x176df5,null));};exports['update']=function(_0x32c5c5,_0x1f2e5f){if(_0x32c5c5['body']['id']){delete _0x32c5c5[_0xfad0('0x48')]['id'];}return db[_0xfad0('0x29')][_0xfad0('0x46')]({'where':{'id':_0x32c5c5[_0xfad0('0x44')]['id']}})['then'](handleEntityNotFound(_0x1f2e5f,null))[_0xfad0('0x24')](saveUpdates(_0x32c5c5['body'],null))[_0xfad0('0x24')](respondWithResult(_0x1f2e5f,null))[_0xfad0('0x42')](handleError(_0x1f2e5f,null));};exports[_0xfad0('0x49')]=function(_0x1b3bd5,_0x57bdce){return db[_0xfad0('0x29')]['find']({'where':{'id':_0x1b3bd5['params']['id']}})[_0xfad0('0x24')](handleEntityNotFound(_0x57bdce,null))[_0xfad0('0x24')](removeEntity(_0x57bdce,null))[_0xfad0('0x42')](handleError(_0x57bdce,null));};exports['getFields']=function(_0x2d4ed0,_0x4f55b8,_0x2226d6){var _0x58f443={};var _0x4d8143={};var _0x2cac91;var _0x45605c;return db[_0xfad0('0x29')][_0xfad0('0x4a')]({'where':{'id':_0x2d4ed0[_0xfad0('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f55b8,null))[_0xfad0('0x24')](function(_0x5aecd9){if(_0x5aecd9){_0x2cac91=_0x5aecd9;_0x4d8143[_0xfad0('0x2e')]=_['keys'](db[_0xfad0('0x4b')][_0xfad0('0x2a')]);_0x4d8143[_0xfad0('0x30')]=_[_0xfad0('0x31')](_0x2d4ed0['query']);_0x4d8143[_0xfad0('0x32')]=_[_0xfad0('0x33')](_0x4d8143[_0xfad0('0x2e')],_0x4d8143[_0xfad0('0x30')]);_0x58f443[_0xfad0('0x34')]=_['intersection'](_0x4d8143[_0xfad0('0x2e')],qs[_0xfad0('0x35')](_0x2d4ed0[_0xfad0('0x30')][_0xfad0('0x35')]));_0x58f443[_0xfad0('0x34')]=_0x58f443[_0xfad0('0x34')][_0xfad0('0x36')]?_0x58f443[_0xfad0('0x34')]:_0x4d8143[_0xfad0('0x2e')];_0x58f443[_0xfad0('0x4c')]=qs['sort'](_0x2d4ed0[_0xfad0('0x30')][_0xfad0('0x39')]);_0x58f443[_0xfad0('0x3a')]=qs[_0xfad0('0x32')](_[_0xfad0('0x3b')](_0x2d4ed0['query'],_0x4d8143[_0xfad0('0x32')]));if(_0x2d4ed0[_0xfad0('0x30')]['filter']){_0x58f443[_0xfad0('0x3a')]=_['merge'](_0x58f443[_0xfad0('0x3a')],{'$or':_[_0xfad0('0x2f')](_0x58f443[_0xfad0('0x34')],function(_0x1d0356){var _0x3bb30b={};_0x3bb30b[_0x1d0356]={'$like':'%'+_0x2d4ed0[_0xfad0('0x30')][_0xfad0('0x3c')]+'%'};return _0x3bb30b;})});}_0x58f443=_[_0xfad0('0x3d')]({},_0x58f443,_0x2d4ed0[_0xfad0('0x3f')]);return _0x2cac91[_0xfad0('0x4d')](_0x58f443);}})[_0xfad0('0x24')](function(_0x26ae2f){if(_0x26ae2f){_0x45605c=_0x26ae2f[_0xfad0('0x36')];if(!_0x2d4ed0['query']['hasOwnProperty']('nolimit')){_0x58f443['limit']=qs[_0xfad0('0x1b')](_0x2d4ed0[_0xfad0('0x30')][_0xfad0('0x1b')]);_0x58f443['offset']=qs[_0xfad0('0x1a')](_0x2d4ed0[_0xfad0('0x30')][_0xfad0('0x1a')]);}return _0x2cac91[_0xfad0('0x4d')](_0x58f443);}})[_0xfad0('0x24')](function(_0x6a6aae){if(_0x6a6aae){return _0x6a6aae?{'count':_0x45605c,'rows':_0x6a6aae}:null;}})['then'](respondWithResult(_0x4f55b8,null))[_0xfad0('0x42')](handleError(_0x4f55b8,null));};exports['getSubjects']=function(_0x3e38a4,_0x4f3f71,_0x4a7502){var _0x1d3c51={};var _0x2bf162={};var _0x27f3d5;var _0x43f412;return db[_0xfad0('0x29')][_0xfad0('0x4a')]({'where':{'id':_0x3e38a4[_0xfad0('0x44')]['id']}})[_0xfad0('0x24')](handleEntityNotFound(_0x4f3f71,null))[_0xfad0('0x24')](function(_0x7adfd1){if(_0x7adfd1){_0x27f3d5=_0x7adfd1;_0x2bf162[_0xfad0('0x2e')]=_['keys'](db['DeskField'][_0xfad0('0x2a')]);_0x2bf162[_0xfad0('0x30')]=_[_0xfad0('0x31')](_0x3e38a4[_0xfad0('0x30')]);_0x2bf162[_0xfad0('0x32')]=_['intersection'](_0x2bf162[_0xfad0('0x2e')],_0x2bf162[_0xfad0('0x30')]);_0x1d3c51[_0xfad0('0x34')]=_[_0xfad0('0x33')](_0x2bf162[_0xfad0('0x2e')],qs[_0xfad0('0x35')](_0x3e38a4[_0xfad0('0x30')][_0xfad0('0x35')]));_0x1d3c51['attributes']=_0x1d3c51['attributes']['length']?_0x1d3c51['attributes']:_0x2bf162[_0xfad0('0x2e')];_0x1d3c51['order']=qs['sort'](_0x3e38a4[_0xfad0('0x30')][_0xfad0('0x39')]);_0x1d3c51[_0xfad0('0x3a')]=qs['filters'](_[_0xfad0('0x3b')](_0x3e38a4[_0xfad0('0x30')],_0x2bf162['filters']));if(_0x3e38a4[_0xfad0('0x30')][_0xfad0('0x3c')]){_0x1d3c51[_0xfad0('0x3a')]=_[_0xfad0('0x3d')](_0x1d3c51['where'],{'$or':_[_0xfad0('0x2f')](_0x1d3c51[_0xfad0('0x34')],function(_0x20cee9){var _0x4e5319={};_0x4e5319[_0x20cee9]={'$like':'%'+_0x3e38a4['query'][_0xfad0('0x3c')]+'%'};return _0x4e5319;})});}_0x1d3c51=_[_0xfad0('0x3d')]({},_0x1d3c51,_0x3e38a4[_0xfad0('0x3f')]);return _0x27f3d5['getSubjects'](_0x1d3c51);}})[_0xfad0('0x24')](function(_0x40f314){if(_0x40f314){_0x43f412=_0x40f314['length'];if(!_0x3e38a4[_0xfad0('0x30')][_0xfad0('0x37')](_0xfad0('0x38'))){_0x1d3c51[_0xfad0('0x1b')]=qs[_0xfad0('0x1b')](_0x3e38a4[_0xfad0('0x30')]['limit']);_0x1d3c51[_0xfad0('0x1a')]=qs[_0xfad0('0x1a')](_0x3e38a4[_0xfad0('0x30')]['offset']);}return _0x27f3d5[_0xfad0('0x4e')](_0x1d3c51);}})[_0xfad0('0x24')](function(_0xe6622f){if(_0xe6622f){return _0xe6622f?{'count':_0x43f412,'rows':_0xe6622f}:null;}})[_0xfad0('0x24')](respondWithResult(_0x4f3f71,null))[_0xfad0('0x42')](handleError(_0x4f3f71,null));};exports['getDescriptions']=function(_0x1f60a7,_0x349c2a,_0x4ba288){var _0x26021f={};var _0x3c087a={};var _0x4a232d;var _0x271517;return db[_0xfad0('0x29')][_0xfad0('0x4a')]({'where':{'id':_0x1f60a7[_0xfad0('0x44')]['id']}})[_0xfad0('0x24')](handleEntityNotFound(_0x349c2a,null))[_0xfad0('0x24')](function(_0x3c9725){if(_0x3c9725){_0x4a232d=_0x3c9725;_0x3c087a[_0xfad0('0x2e')]=_[_0xfad0('0x31')](db[_0xfad0('0x4b')]['rawAttributes']);_0x3c087a[_0xfad0('0x30')]=_[_0xfad0('0x31')](_0x1f60a7[_0xfad0('0x30')]);_0x3c087a[_0xfad0('0x32')]=_['intersection'](_0x3c087a[_0xfad0('0x2e')],_0x3c087a[_0xfad0('0x30')]);_0x26021f['attributes']=_[_0xfad0('0x33')](_0x3c087a['model'],qs['fields'](_0x1f60a7['query'][_0xfad0('0x35')]));_0x26021f[_0xfad0('0x34')]=_0x26021f[_0xfad0('0x34')][_0xfad0('0x36')]?_0x26021f['attributes']:_0x3c087a[_0xfad0('0x2e')];_0x26021f[_0xfad0('0x4c')]=qs[_0xfad0('0x39')](_0x1f60a7[_0xfad0('0x30')][_0xfad0('0x39')]);_0x26021f[_0xfad0('0x3a')]=qs[_0xfad0('0x32')](_['pick'](_0x1f60a7[_0xfad0('0x30')],_0x3c087a[_0xfad0('0x32')]));if(_0x1f60a7[_0xfad0('0x30')][_0xfad0('0x3c')]){_0x26021f['where']=_[_0xfad0('0x3d')](_0x26021f[_0xfad0('0x3a')],{'$or':_[_0xfad0('0x2f')](_0x26021f[_0xfad0('0x34')],function(_0x383e93){var _0x3a784f={};_0x3a784f[_0x383e93]={'$like':'%'+_0x1f60a7[_0xfad0('0x30')][_0xfad0('0x3c')]+'%'};return _0x3a784f;})});}_0x26021f=_[_0xfad0('0x3d')]({},_0x26021f,_0x1f60a7[_0xfad0('0x3f')]);return _0x4a232d[_0xfad0('0x4f')](_0x26021f);}})[_0xfad0('0x24')](function(_0x4c0410){if(_0x4c0410){_0x271517=_0x4c0410[_0xfad0('0x36')];if(!_0x1f60a7[_0xfad0('0x30')][_0xfad0('0x37')]('nolimit')){_0x26021f[_0xfad0('0x1b')]=qs[_0xfad0('0x1b')](_0x1f60a7[_0xfad0('0x30')]['limit']);_0x26021f[_0xfad0('0x1a')]=qs[_0xfad0('0x1a')](_0x1f60a7[_0xfad0('0x30')][_0xfad0('0x1a')]);}return _0x4a232d[_0xfad0('0x4f')](_0x26021f);}})[_0xfad0('0x24')](function(_0x101489){if(_0x101489){return _0x101489?{'count':_0x271517,'rows':_0x101489}:null;}})[_0xfad0('0x24')](respondWithResult(_0x349c2a,null))['catch'](handleError(_0x349c2a,null));};exports[_0xfad0('0x50')]=function(_0x1982db,_0xbe121f,_0x181469){var _0x34ba09={};var _0xb835f7={};var _0x1e35ec;var _0x2d8e07;return db[_0xfad0('0x29')][_0xfad0('0x4a')]({'where':{'id':_0x1982db[_0xfad0('0x44')]['id']}})['then'](handleEntityNotFound(_0xbe121f,null))['then'](function(_0x4aede8){if(_0x4aede8){_0x1e35ec=_0x4aede8;_0xb835f7[_0xfad0('0x2e')]=_[_0xfad0('0x31')](db[_0xfad0('0x51')][_0xfad0('0x2a')]);_0xb835f7[_0xfad0('0x30')]=_['keys'](_0x1982db['query']);_0xb835f7[_0xfad0('0x32')]=_[_0xfad0('0x33')](_0xb835f7['model'],_0xb835f7[_0xfad0('0x30')]);_0x34ba09['attributes']=_['intersection'](_0xb835f7[_0xfad0('0x2e')],qs['fields'](_0x1982db[_0xfad0('0x30')]['fields']));_0x34ba09[_0xfad0('0x34')]=_0x34ba09['attributes']['length']?_0x34ba09[_0xfad0('0x34')]:_0xb835f7[_0xfad0('0x2e')];_0x34ba09[_0xfad0('0x4c')]=qs['sort'](_0x1982db[_0xfad0('0x30')][_0xfad0('0x39')]);_0x34ba09[_0xfad0('0x3a')]=qs[_0xfad0('0x32')](_[_0xfad0('0x3b')](_0x1982db[_0xfad0('0x30')],_0xb835f7['filters']));if(_0x1982db[_0xfad0('0x30')][_0xfad0('0x3c')]){_0x34ba09[_0xfad0('0x3a')]=_['merge'](_0x34ba09[_0xfad0('0x3a')],{'$or':_[_0xfad0('0x2f')](_0x34ba09['attributes'],function(_0x43c294){var _0x4c9a9c={};_0x4c9a9c[_0x43c294]={'$like':'%'+_0x1982db['query'][_0xfad0('0x3c')]+'%'};return _0x4c9a9c;})});}_0x34ba09=_[_0xfad0('0x3d')]({},_0x34ba09,_0x1982db[_0xfad0('0x3f')]);return _0x1e35ec[_0xfad0('0x50')](_0x34ba09);}})[_0xfad0('0x24')](function(_0xd3f14d){if(_0xd3f14d){_0x2d8e07=_0xd3f14d[_0xfad0('0x36')];if(!_0x1982db['query'][_0xfad0('0x37')](_0xfad0('0x38'))){_0x34ba09[_0xfad0('0x1b')]=qs[_0xfad0('0x1b')](_0x1982db[_0xfad0('0x30')][_0xfad0('0x1b')]);_0x34ba09['offset']=qs[_0xfad0('0x1a')](_0x1982db[_0xfad0('0x30')][_0xfad0('0x1a')]);}return _0x1e35ec[_0xfad0('0x50')](_0x34ba09);}})[_0xfad0('0x24')](function(_0x558cbf){if(_0x558cbf){return _0x558cbf?{'count':_0x2d8e07,'rows':_0x558cbf}:null;}})['then'](respondWithResult(_0xbe121f,null))[_0xfad0('0x42')](handleError(_0xbe121f,null));};exports[_0xfad0('0x52')]=function(_0x2c8ba1,_0x4b8fb0,_0x1273b5){if(_0x2c8ba1[_0xfad0('0x48')]['id']){delete _0x2c8ba1[_0xfad0('0x48')]['id'];}return db[_0xfad0('0x29')][_0xfad0('0x4a')]({'where':{'id':_0x2c8ba1[_0xfad0('0x44')]['id']}})[_0xfad0('0x24')](handleEntityNotFound(_0x4b8fb0,null))[_0xfad0('0x24')](function(_0x24c316){if(_0x24c316){return _0x24c316[_0xfad0('0x52')](_0x2c8ba1[_0xfad0('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4b8fb0,null))['catch'](handleError(_0x4b8fb0,null));}; \ No newline at end of file +var _0x7f1c=['params','getFields','findOne','DeskField','getSubjects','pick','getTags','Tag','setTags','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','rows','show','find','catch','create','body','update'];(function(_0x29f47f,_0x198df0){var _0x28c3ee=function(_0x5eecd3){while(--_0x5eecd3){_0x29f47f['push'](_0x29f47f['shift']());}};_0x28c3ee(++_0x198df0);}(_0x7f1c,0xa9));var _0xc7f1=function(_0x15dd68,_0x268ff5){_0x15dd68=_0x15dd68-0x0;var _0x111dc2=_0x7f1c[_0x15dd68];return _0x111dc2;};'use strict';var emlformat=require(_0xc7f1('0x0'));var rimraf=require(_0xc7f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc7f1('0x2'));var rp=require(_0xc7f1('0x3'));var moment=require(_0xc7f1('0x4'));var BPromise=require(_0xc7f1('0x5'));var Mustache=require(_0xc7f1('0x6'));var util=require('util');var path=require(_0xc7f1('0x7'));var sox=require(_0xc7f1('0x8'));var csv=require(_0xc7f1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc7f1('0xa'));var squel=require(_0xc7f1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc7f1('0xc'));var toCsv=require(_0xc7f1('0x9'));var querystring=require(_0xc7f1('0xd'));var Papa=require(_0xc7f1('0xe'));var Redis=require(_0xc7f1('0xf'));var authService=require(_0xc7f1('0x10'));var qs=require(_0xc7f1('0x11'));var as=require(_0xc7f1('0x12'));var hardwareService=require(_0xc7f1('0x13'));var logger=require(_0xc7f1('0x14'))('api');var utils=require(_0xc7f1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc7f1('0x16'));var db=require(_0xc7f1('0x17'))['db'];function respondWithStatusCode(_0x2e783f,_0x3cafd3){_0x3cafd3=_0x3cafd3||0xcc;return function(_0x3b8ef0){if(_0x3b8ef0){return _0x2e783f[_0xc7f1('0x18')](_0x3cafd3);}return _0x2e783f[_0xc7f1('0x19')](_0x3cafd3)[_0xc7f1('0x1a')]();};}function respondWithResult(_0x3c8ba7,_0x230222){_0x230222=_0x230222||0xc8;return function(_0x3b087c){if(_0x3b087c){return _0x3c8ba7['status'](_0x230222)['json'](_0x3b087c);}};}function respondWithFilteredResult(_0x25bb85,_0x54673d){return function(_0x2e1614){if(_0x2e1614){var _0x25d87f=typeof _0x54673d[_0xc7f1('0x1b')]==='undefined'&&typeof _0x54673d['limit']===_0xc7f1('0x1c');var _0x207fd3=_0x2e1614['count'];var _0x59e9c9=_0x25d87f?0x0:_0x54673d[_0xc7f1('0x1b')];var _0x411e65=_0x25d87f?_0x2e1614[_0xc7f1('0x1d')]:_0x54673d['offset']+_0x54673d[_0xc7f1('0x1e')];var _0x41354c;if(_0x411e65>=_0x207fd3){_0x411e65=_0x207fd3;_0x41354c=0xc8;}else{_0x41354c=0xce;}_0x25bb85[_0xc7f1('0x19')](_0x41354c);return _0x25bb85['set'](_0xc7f1('0x1f'),_0x59e9c9+'-'+_0x411e65+'/'+_0x207fd3)['json'](_0x2e1614);}return null;};}function patchUpdates(_0x1274c0){return function(_0x158c24){try{jsonpatch['apply'](_0x158c24,_0x1274c0,!![]);}catch(_0x3d858d){return BPromise['reject'](_0x3d858d);}return _0x158c24['save']();};}function saveUpdates(_0x2dbfac,_0x5bfa01){return function(_0x3337a8){if(_0x3337a8){return _0x3337a8['update'](_0x2dbfac)['then'](function(_0x256880){return _0x256880;});}return null;};}function removeEntity(_0x2f6583,_0x36020a){return function(_0x33a483){if(_0x33a483){return _0x33a483[_0xc7f1('0x20')]()[_0xc7f1('0x21')](function(){_0x2f6583[_0xc7f1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x234d8b,_0x7bf8d9){return function(_0x144095){if(!_0x144095){_0x234d8b[_0xc7f1('0x18')](0x194);}return _0x144095;};}function handleError(_0x38f17c,_0x12a8a8){_0x12a8a8=_0x12a8a8||0x1f4;return function(_0x1797c6){logger[_0xc7f1('0x22')](_0x1797c6[_0xc7f1('0x23')]);if(_0x1797c6[_0xc7f1('0x24')]){delete _0x1797c6[_0xc7f1('0x24')];}_0x38f17c['status'](_0x12a8a8)[_0xc7f1('0x25')](_0x1797c6);};}exports[_0xc7f1('0x26')]=function(_0xcacc,_0x30109e){var _0x3f0db2={},_0x42259f={},_0x3652c8={'count':0x0,'rows':[]};var _0x1059ec=_[_0xc7f1('0x27')](db['DeskConfiguration'][_0xc7f1('0x28')],function(_0x464568){return{'name':_0x464568[_0xc7f1('0x29')],'type':_0x464568[_0xc7f1('0x2a')][_0xc7f1('0x2b')]};});_0x42259f[_0xc7f1('0x2c')]=_['map'](_0x1059ec,_0xc7f1('0x24'));_0x42259f[_0xc7f1('0x2d')]=_[_0xc7f1('0x2e')](_0xcacc[_0xc7f1('0x2d')]);_0x42259f[_0xc7f1('0x2f')]=_['intersection'](_0x42259f[_0xc7f1('0x2c')],_0x42259f['query']);_0x3f0db2[_0xc7f1('0x30')]=_[_0xc7f1('0x31')](_0x42259f[_0xc7f1('0x2c')],qs[_0xc7f1('0x32')](_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x32')]));_0x3f0db2[_0xc7f1('0x30')]=_0x3f0db2[_0xc7f1('0x30')][_0xc7f1('0x33')]?_0x3f0db2['attributes']:_0x42259f['model'];if(!_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x34')](_0xc7f1('0x35'))){_0x3f0db2[_0xc7f1('0x1e')]=qs['limit'](_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x1e')]);_0x3f0db2[_0xc7f1('0x1b')]=qs[_0xc7f1('0x1b')](_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x1b')]);}_0x3f0db2[_0xc7f1('0x36')]=qs[_0xc7f1('0x37')](_0xcacc['query'][_0xc7f1('0x37')]);_0x3f0db2[_0xc7f1('0x38')]=qs[_0xc7f1('0x2f')](_['pick'](_0xcacc[_0xc7f1('0x2d')],_0x42259f[_0xc7f1('0x2f')]),_0x1059ec);if(_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x39')]){_0x3f0db2[_0xc7f1('0x38')]=_[_0xc7f1('0x3a')](_0x3f0db2[_0xc7f1('0x38')],{'$or':_['map'](_0x1059ec,function(_0x461fb7){if(_0x461fb7['type']!==_0xc7f1('0x3b')){var _0x1306aa={};_0x1306aa[_0x461fb7[_0xc7f1('0x24')]]={'$like':'%'+_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x39')]+'%'};return _0x1306aa;}})});}_0x3f0db2=_[_0xc7f1('0x3a')]({},_0x3f0db2,_0xcacc[_0xc7f1('0x3c')]);var _0x1bf96f={'where':_0x3f0db2[_0xc7f1('0x38')]};return db[_0xc7f1('0x3d')][_0xc7f1('0x1d')](_0x1bf96f)[_0xc7f1('0x21')](function(_0x26cbb5){_0x3652c8[_0xc7f1('0x1d')]=_0x26cbb5;if(_0xcacc[_0xc7f1('0x2d')][_0xc7f1('0x3e')]){_0x3f0db2[_0xc7f1('0x3f')]=[{'all':!![]}];}return db[_0xc7f1('0x3d')]['findAll'](_0x3f0db2);})['then'](function(_0x458d73){_0x3652c8[_0xc7f1('0x40')]=_0x458d73;return _0x3652c8;})[_0xc7f1('0x21')](respondWithFilteredResult(_0x30109e,_0x3f0db2))['catch'](handleError(_0x30109e,null));};exports[_0xc7f1('0x41')]=function(_0x2d3dd1,_0x383b3a){var _0x5a96cc={'raw':![],'where':{'id':_0x2d3dd1['params']['id']}},_0xe4d637={};_0xe4d637[_0xc7f1('0x2c')]=_[_0xc7f1('0x2e')](db[_0xc7f1('0x3d')]['rawAttributes']);_0xe4d637['query']=_['keys'](_0x2d3dd1[_0xc7f1('0x2d')]);_0xe4d637[_0xc7f1('0x2f')]=_[_0xc7f1('0x31')](_0xe4d637[_0xc7f1('0x2c')],_0xe4d637['query']);_0x5a96cc[_0xc7f1('0x30')]=_[_0xc7f1('0x31')](_0xe4d637['model'],qs[_0xc7f1('0x32')](_0x2d3dd1['query']['fields']));_0x5a96cc[_0xc7f1('0x30')]=_0x5a96cc[_0xc7f1('0x30')][_0xc7f1('0x33')]?_0x5a96cc[_0xc7f1('0x30')]:_0xe4d637[_0xc7f1('0x2c')];if(_0x2d3dd1[_0xc7f1('0x2d')]['includeAll']){_0x5a96cc[_0xc7f1('0x3f')]=[{'all':!![]}];}_0x5a96cc=_['merge']({},_0x5a96cc,_0x2d3dd1['options']);return db['DeskConfiguration'][_0xc7f1('0x42')](_0x5a96cc)[_0xc7f1('0x21')](handleEntityNotFound(_0x383b3a,null))[_0xc7f1('0x21')](respondWithResult(_0x383b3a,null))[_0xc7f1('0x43')](handleError(_0x383b3a,null));};exports[_0xc7f1('0x44')]=function(_0x326d9b,_0x15a34a){return db[_0xc7f1('0x3d')][_0xc7f1('0x44')](_0x326d9b[_0xc7f1('0x45')],{})['then'](respondWithResult(_0x15a34a,0xc9))['catch'](handleError(_0x15a34a,null));};exports[_0xc7f1('0x46')]=function(_0x1e5bc7,_0x67b4b3){if(_0x1e5bc7[_0xc7f1('0x45')]['id']){delete _0x1e5bc7['body']['id'];}return db[_0xc7f1('0x3d')][_0xc7f1('0x42')]({'where':{'id':_0x1e5bc7[_0xc7f1('0x47')]['id']}})[_0xc7f1('0x21')](handleEntityNotFound(_0x67b4b3,null))['then'](saveUpdates(_0x1e5bc7[_0xc7f1('0x45')],null))[_0xc7f1('0x21')](respondWithResult(_0x67b4b3,null))[_0xc7f1('0x43')](handleError(_0x67b4b3,null));};exports[_0xc7f1('0x20')]=function(_0x588bda,_0x42a3bd){return db['DeskConfiguration'][_0xc7f1('0x42')]({'where':{'id':_0x588bda[_0xc7f1('0x47')]['id']}})[_0xc7f1('0x21')](handleEntityNotFound(_0x42a3bd,null))['then'](removeEntity(_0x42a3bd,null))['catch'](handleError(_0x42a3bd,null));};exports[_0xc7f1('0x48')]=function(_0x5c8c42,_0x21a2d5,_0xe3b4bd){var _0x4b58e8={};var _0x5b6dbd={};var _0x146c6c;var _0x2d9bdc;return db[_0xc7f1('0x3d')][_0xc7f1('0x49')]({'where':{'id':_0x5c8c42[_0xc7f1('0x47')]['id']}})['then'](handleEntityNotFound(_0x21a2d5,null))[_0xc7f1('0x21')](function(_0x49fa8a){if(_0x49fa8a){_0x146c6c=_0x49fa8a;_0x5b6dbd['model']=_[_0xc7f1('0x2e')](db[_0xc7f1('0x4a')]['rawAttributes']);_0x5b6dbd[_0xc7f1('0x2d')]=_['keys'](_0x5c8c42['query']);_0x5b6dbd[_0xc7f1('0x2f')]=_[_0xc7f1('0x31')](_0x5b6dbd[_0xc7f1('0x2c')],_0x5b6dbd[_0xc7f1('0x2d')]);_0x4b58e8[_0xc7f1('0x30')]=_['intersection'](_0x5b6dbd['model'],qs[_0xc7f1('0x32')](_0x5c8c42[_0xc7f1('0x2d')][_0xc7f1('0x32')]));_0x4b58e8[_0xc7f1('0x30')]=_0x4b58e8['attributes'][_0xc7f1('0x33')]?_0x4b58e8[_0xc7f1('0x30')]:_0x5b6dbd[_0xc7f1('0x2c')];_0x4b58e8[_0xc7f1('0x36')]=qs['sort'](_0x5c8c42[_0xc7f1('0x2d')][_0xc7f1('0x37')]);_0x4b58e8[_0xc7f1('0x38')]=qs['filters'](_['pick'](_0x5c8c42[_0xc7f1('0x2d')],_0x5b6dbd[_0xc7f1('0x2f')]));if(_0x5c8c42[_0xc7f1('0x2d')][_0xc7f1('0x39')]){_0x4b58e8['where']=_[_0xc7f1('0x3a')](_0x4b58e8[_0xc7f1('0x38')],{'$or':_[_0xc7f1('0x27')](_0x4b58e8[_0xc7f1('0x30')],function(_0x256c74){var _0x3ce42f={};_0x3ce42f[_0x256c74]={'$like':'%'+_0x5c8c42[_0xc7f1('0x2d')][_0xc7f1('0x39')]+'%'};return _0x3ce42f;})});}_0x4b58e8=_['merge']({},_0x4b58e8,_0x5c8c42[_0xc7f1('0x3c')]);return _0x146c6c[_0xc7f1('0x48')](_0x4b58e8);}})['then'](function(_0x5288a3){if(_0x5288a3){_0x2d9bdc=_0x5288a3[_0xc7f1('0x33')];if(!_0x5c8c42['query'][_0xc7f1('0x34')]('nolimit')){_0x4b58e8[_0xc7f1('0x1e')]=qs[_0xc7f1('0x1e')](_0x5c8c42['query'][_0xc7f1('0x1e')]);_0x4b58e8['offset']=qs[_0xc7f1('0x1b')](_0x5c8c42[_0xc7f1('0x2d')][_0xc7f1('0x1b')]);}return _0x146c6c[_0xc7f1('0x48')](_0x4b58e8);}})[_0xc7f1('0x21')](function(_0x20071d){if(_0x20071d){return _0x20071d?{'count':_0x2d9bdc,'rows':_0x20071d}:null;}})['then'](respondWithResult(_0x21a2d5,null))[_0xc7f1('0x43')](handleError(_0x21a2d5,null));};exports[_0xc7f1('0x4b')]=function(_0xf5491a,_0x4f7bf6,_0x27a051){var _0x23f177={};var _0x1290fe={};var _0x1b26c7;var _0x5e2e62;return db[_0xc7f1('0x3d')]['findOne']({'where':{'id':_0xf5491a['params']['id']}})['then'](handleEntityNotFound(_0x4f7bf6,null))[_0xc7f1('0x21')](function(_0x7d274b){if(_0x7d274b){_0x1b26c7=_0x7d274b;_0x1290fe[_0xc7f1('0x2c')]=_[_0xc7f1('0x2e')](db[_0xc7f1('0x4a')][_0xc7f1('0x28')]);_0x1290fe[_0xc7f1('0x2d')]=_['keys'](_0xf5491a[_0xc7f1('0x2d')]);_0x1290fe['filters']=_[_0xc7f1('0x31')](_0x1290fe[_0xc7f1('0x2c')],_0x1290fe[_0xc7f1('0x2d')]);_0x23f177['attributes']=_['intersection'](_0x1290fe['model'],qs['fields'](_0xf5491a[_0xc7f1('0x2d')]['fields']));_0x23f177['attributes']=_0x23f177[_0xc7f1('0x30')]['length']?_0x23f177['attributes']:_0x1290fe[_0xc7f1('0x2c')];_0x23f177['order']=qs['sort'](_0xf5491a[_0xc7f1('0x2d')][_0xc7f1('0x37')]);_0x23f177[_0xc7f1('0x38')]=qs[_0xc7f1('0x2f')](_[_0xc7f1('0x4c')](_0xf5491a[_0xc7f1('0x2d')],_0x1290fe[_0xc7f1('0x2f')]));if(_0xf5491a['query'][_0xc7f1('0x39')]){_0x23f177[_0xc7f1('0x38')]=_[_0xc7f1('0x3a')](_0x23f177[_0xc7f1('0x38')],{'$or':_[_0xc7f1('0x27')](_0x23f177['attributes'],function(_0x386f02){var _0x5550b9={};_0x5550b9[_0x386f02]={'$like':'%'+_0xf5491a[_0xc7f1('0x2d')]['filter']+'%'};return _0x5550b9;})});}_0x23f177=_[_0xc7f1('0x3a')]({},_0x23f177,_0xf5491a['options']);return _0x1b26c7[_0xc7f1('0x4b')](_0x23f177);}})['then'](function(_0x22b440){if(_0x22b440){_0x5e2e62=_0x22b440['length'];if(!_0xf5491a[_0xc7f1('0x2d')][_0xc7f1('0x34')]('nolimit')){_0x23f177[_0xc7f1('0x1e')]=qs['limit'](_0xf5491a[_0xc7f1('0x2d')][_0xc7f1('0x1e')]);_0x23f177['offset']=qs[_0xc7f1('0x1b')](_0xf5491a[_0xc7f1('0x2d')]['offset']);}return _0x1b26c7[_0xc7f1('0x4b')](_0x23f177);}})['then'](function(_0xf8115c){if(_0xf8115c){return _0xf8115c?{'count':_0x5e2e62,'rows':_0xf8115c}:null;}})[_0xc7f1('0x21')](respondWithResult(_0x4f7bf6,null))[_0xc7f1('0x43')](handleError(_0x4f7bf6,null));};exports['getDescriptions']=function(_0xabbc4a,_0x99591f,_0x25acdb){var _0x1ed9ec={};var _0xd2ff92={};var _0x20a3ef;var _0x852e;return db[_0xc7f1('0x3d')][_0xc7f1('0x49')]({'where':{'id':_0xabbc4a[_0xc7f1('0x47')]['id']}})[_0xc7f1('0x21')](handleEntityNotFound(_0x99591f,null))[_0xc7f1('0x21')](function(_0x13aa30){if(_0x13aa30){_0x20a3ef=_0x13aa30;_0xd2ff92[_0xc7f1('0x2c')]=_[_0xc7f1('0x2e')](db[_0xc7f1('0x4a')][_0xc7f1('0x28')]);_0xd2ff92[_0xc7f1('0x2d')]=_['keys'](_0xabbc4a[_0xc7f1('0x2d')]);_0xd2ff92[_0xc7f1('0x2f')]=_['intersection'](_0xd2ff92[_0xc7f1('0x2c')],_0xd2ff92['query']);_0x1ed9ec['attributes']=_[_0xc7f1('0x31')](_0xd2ff92[_0xc7f1('0x2c')],qs[_0xc7f1('0x32')](_0xabbc4a[_0xc7f1('0x2d')]['fields']));_0x1ed9ec[_0xc7f1('0x30')]=_0x1ed9ec[_0xc7f1('0x30')][_0xc7f1('0x33')]?_0x1ed9ec[_0xc7f1('0x30')]:_0xd2ff92[_0xc7f1('0x2c')];_0x1ed9ec[_0xc7f1('0x36')]=qs[_0xc7f1('0x37')](_0xabbc4a[_0xc7f1('0x2d')][_0xc7f1('0x37')]);_0x1ed9ec['where']=qs[_0xc7f1('0x2f')](_[_0xc7f1('0x4c')](_0xabbc4a['query'],_0xd2ff92[_0xc7f1('0x2f')]));if(_0xabbc4a[_0xc7f1('0x2d')][_0xc7f1('0x39')]){_0x1ed9ec['where']=_[_0xc7f1('0x3a')](_0x1ed9ec[_0xc7f1('0x38')],{'$or':_[_0xc7f1('0x27')](_0x1ed9ec[_0xc7f1('0x30')],function(_0x343c23){var _0x9cc3d8={};_0x9cc3d8[_0x343c23]={'$like':'%'+_0xabbc4a[_0xc7f1('0x2d')][_0xc7f1('0x39')]+'%'};return _0x9cc3d8;})});}_0x1ed9ec=_[_0xc7f1('0x3a')]({},_0x1ed9ec,_0xabbc4a[_0xc7f1('0x3c')]);return _0x20a3ef['getDescriptions'](_0x1ed9ec);}})['then'](function(_0x46dff5){if(_0x46dff5){_0x852e=_0x46dff5[_0xc7f1('0x33')];if(!_0xabbc4a[_0xc7f1('0x2d')]['hasOwnProperty']('nolimit')){_0x1ed9ec[_0xc7f1('0x1e')]=qs[_0xc7f1('0x1e')](_0xabbc4a['query'][_0xc7f1('0x1e')]);_0x1ed9ec[_0xc7f1('0x1b')]=qs[_0xc7f1('0x1b')](_0xabbc4a[_0xc7f1('0x2d')]['offset']);}return _0x20a3ef['getDescriptions'](_0x1ed9ec);}})[_0xc7f1('0x21')](function(_0x46d932){if(_0x46d932){return _0x46d932?{'count':_0x852e,'rows':_0x46d932}:null;}})['then'](respondWithResult(_0x99591f,null))[_0xc7f1('0x43')](handleError(_0x99591f,null));};exports[_0xc7f1('0x4d')]=function(_0x42d6a1,_0x19c753,_0x23f869){var _0xb641b4={};var _0x643151={};var _0x420067;var _0x3ec4af;return db['DeskConfiguration'][_0xc7f1('0x49')]({'where':{'id':_0x42d6a1['params']['id']}})[_0xc7f1('0x21')](handleEntityNotFound(_0x19c753,null))[_0xc7f1('0x21')](function(_0x3309e1){if(_0x3309e1){_0x420067=_0x3309e1;_0x643151['model']=_['keys'](db[_0xc7f1('0x4e')][_0xc7f1('0x28')]);_0x643151['query']=_[_0xc7f1('0x2e')](_0x42d6a1[_0xc7f1('0x2d')]);_0x643151['filters']=_[_0xc7f1('0x31')](_0x643151[_0xc7f1('0x2c')],_0x643151[_0xc7f1('0x2d')]);_0xb641b4['attributes']=_['intersection'](_0x643151['model'],qs['fields'](_0x42d6a1[_0xc7f1('0x2d')]['fields']));_0xb641b4[_0xc7f1('0x30')]=_0xb641b4[_0xc7f1('0x30')][_0xc7f1('0x33')]?_0xb641b4[_0xc7f1('0x30')]:_0x643151['model'];_0xb641b4[_0xc7f1('0x36')]=qs['sort'](_0x42d6a1[_0xc7f1('0x2d')][_0xc7f1('0x37')]);_0xb641b4[_0xc7f1('0x38')]=qs['filters'](_[_0xc7f1('0x4c')](_0x42d6a1[_0xc7f1('0x2d')],_0x643151[_0xc7f1('0x2f')]));if(_0x42d6a1[_0xc7f1('0x2d')][_0xc7f1('0x39')]){_0xb641b4[_0xc7f1('0x38')]=_[_0xc7f1('0x3a')](_0xb641b4[_0xc7f1('0x38')],{'$or':_['map'](_0xb641b4[_0xc7f1('0x30')],function(_0x223f13){var _0x3903bd={};_0x3903bd[_0x223f13]={'$like':'%'+_0x42d6a1[_0xc7f1('0x2d')]['filter']+'%'};return _0x3903bd;})});}_0xb641b4=_[_0xc7f1('0x3a')]({},_0xb641b4,_0x42d6a1[_0xc7f1('0x3c')]);return _0x420067[_0xc7f1('0x4d')](_0xb641b4);}})[_0xc7f1('0x21')](function(_0x3ce697){if(_0x3ce697){_0x3ec4af=_0x3ce697[_0xc7f1('0x33')];if(!_0x42d6a1[_0xc7f1('0x2d')][_0xc7f1('0x34')](_0xc7f1('0x35'))){_0xb641b4[_0xc7f1('0x1e')]=qs[_0xc7f1('0x1e')](_0x42d6a1['query']['limit']);_0xb641b4[_0xc7f1('0x1b')]=qs['offset'](_0x42d6a1['query']['offset']);}return _0x420067[_0xc7f1('0x4d')](_0xb641b4);}})['then'](function(_0x3ead7e){if(_0x3ead7e){return _0x3ead7e?{'count':_0x3ec4af,'rows':_0x3ead7e}:null;}})['then'](respondWithResult(_0x19c753,null))[_0xc7f1('0x43')](handleError(_0x19c753,null));};exports['setTags']=function(_0xe0ec5a,_0x5786fb,_0x178d28){if(_0xe0ec5a[_0xc7f1('0x45')]['id']){delete _0xe0ec5a[_0xc7f1('0x45')]['id'];}return db[_0xc7f1('0x3d')][_0xc7f1('0x49')]({'where':{'id':_0xe0ec5a[_0xc7f1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5786fb,null))[_0xc7f1('0x21')](function(_0x4cbc7a){if(_0x4cbc7a){return _0x4cbc7a[_0xc7f1('0x4f')](_0xe0ec5a[_0xc7f1('0x45')]['ids']||[]);}return null;})[_0xc7f1('0x21')](respondWithResult(_0x5786fb,null))['catch'](handleError(_0x5786fb,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e11be35..3a57509 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 _0x0bd7=['bluebird','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','../../config/logger','moment'];(function(_0x447f94,_0x5d73ea){var _0x56fad4=function(_0x227564){while(--_0x227564){_0x447f94['push'](_0x447f94['shift']());}};_0x56fad4(++_0x5d73ea);}(_0x0bd7,0x1dc));var _0x70bd=function(_0x169e53,_0x46be55){_0x169e53=_0x169e53-0x0;var _0x252bb3=_0x0bd7[_0x169e53];return _0x252bb3;};'use strict';var _=require(_0x70bd('0x0'));var util=require(_0x70bd('0x1'));var logger=require(_0x70bd('0x2'))('api');var moment=require(_0x70bd('0x3'));var BPromise=require(_0x70bd('0x4'));var rp=require(_0x70bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70bd('0x6'));var config=require(_0x70bd('0x7'));var attributes=require(_0x70bd('0x8'));module[_0x70bd('0x9')]=function(_0x226ef0,_0x5e5dca){return _0x226ef0[_0x70bd('0xa')]('DeskConfiguration',attributes,{'tableName':_0x70bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4380=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','request-promise','../../config/environment'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x4380,0x186));var _0x0438=function(_0x5e1bde,_0x28bbc0){_0x5e1bde=_0x5e1bde-0x0;var _0x1bc73f=_0x4380[_0x5e1bde];return _0x1bc73f;};'use strict';var _=require(_0x0438('0x0'));var util=require(_0x0438('0x1'));var logger=require('../../config/logger')(_0x0438('0x2'));var moment=require(_0x0438('0x3'));var BPromise=require('bluebird');var rp=require(_0x0438('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0438('0x5'));var attributes=require(_0x0438('0x6'));module[_0x0438('0x7')]=function(_0x7c08ad,_0x5180f8){return _0x7c08ad[_0x0438('0x8')](_0x0438('0x9'),attributes,{'tableName':_0x0438('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 49284df..67192d0 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 _0xd5a2=['debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x147317,_0x286392){var _0x3dca4f=function(_0x4ec85b){while(--_0x4ec85b){_0x147317['push'](_0x147317['shift']());}};_0x3dca4f(++_0x286392);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x465c3f,_0x45b9d5){_0x465c3f=_0x465c3f-0x0;var _0x2098da=_0xd5a2[_0x465c3f];return _0x2098da;};'use strict';var _=require('lodash');var util=require(_0x2d5a('0x0'));var moment=require(_0x2d5a('0x1'));var BPromise=require(_0x2d5a('0x2'));var rs=require(_0x2d5a('0x3'));var fs=require('fs');var Redis=require(_0x2d5a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2d5a('0x5'));var logger=require(_0x2d5a('0x6'))(_0x2d5a('0x7'));var config=require(_0x2d5a('0x8'));var jayson=require(_0x2d5a('0x9'));var client=jayson[_0x2d5a('0xa')][_0x2d5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae103,_0x1cdfc4,_0x7eb4c3){return new BPromise(function(_0x79898c,_0x4d5c52){return client['request'](_0x1ae103,_0x7eb4c3)[_0x2d5a('0xc')](function(_0x562b6a){logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,'request\x20sent');logger[_0x2d5a('0xf')](_0x2d5a('0x10'),_0x1cdfc4,_0x2d5a('0x11'),JSON[_0x2d5a('0x12')](_0x562b6a));if(_0x562b6a[_0x2d5a('0x13')]){if(_0x562b6a['error'][_0x2d5a('0x14')]===0x1f4){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x4d5c52(_0x562b6a['error'][_0x2d5a('0x15')]);}logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x562b6a[_0x2d5a('0x13')]['message']);return _0x79898c(_0x562b6a[_0x2d5a('0x13')][_0x2d5a('0x15')]);}else{logger[_0x2d5a('0xd')](_0x2d5a('0xe'),_0x1cdfc4,_0x2d5a('0x11'));_0x79898c(_0x562b6a['result'][_0x2d5a('0x15')]);}})[_0x2d5a('0x16')](function(_0x38de62){logger[_0x2d5a('0x13')](_0x2d5a('0xe'),_0x1cdfc4,_0x38de62);_0x4d5c52(_0x38de62);});});} \ No newline at end of file +var _0xd506=['catch','lodash','../../config/logger','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','message'];(function(_0x287b1b,_0x59403d){var _0x19565d=function(_0x22068d){while(--_0x22068d){_0x287b1b['push'](_0x287b1b['shift']());}};_0x19565d(++_0x59403d);}(_0xd506,0x197));var _0x6d50=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd506[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x6d50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d50('0x1'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d50('0x2')][_0x6d50('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x1b0af3,_0x4cf512,_0x9565b6){return new BPromise(function(_0xce67b6,_0x2dacde){return client['request'](_0x1b0af3,_0x9565b6)[_0x6d50('0x4')](function(_0x5012ed){logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,_0x6d50('0x7'));logger[_0x6d50('0x8')](_0x6d50('0x9'),_0x4cf512,_0x6d50('0x7'),JSON['stringify'](_0x5012ed));if(_0x5012ed['error']){if(_0x5012ed['error'][_0x6d50('0xa')]===0x1f4){logger[_0x6d50('0xb')](_0x6d50('0x6'),_0x4cf512,_0x5012ed[_0x6d50('0xb')]['message']);return _0x2dacde(_0x5012ed[_0x6d50('0xb')]['message']);}logger[_0x6d50('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x4cf512,_0x5012ed['error']['message']);return _0xce67b6(_0x5012ed[_0x6d50('0xb')]['message']);}else{logger[_0x6d50('0x5')](_0x6d50('0x6'),_0x4cf512,'request\x20sent');_0xce67b6(_0x5012ed['result'][_0x6d50('0xc')]);}})[_0x6d50('0xd')](function(_0x38068e){logger['error'](_0x6d50('0x6'),_0x4cf512,_0x38068e);_0x2dacde(_0x38068e);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index c759f0d..6adc3d6 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 _0xfea4=['get','/:id','show','post','create','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index'];(function(_0x2cacef,_0xba1573){var _0x289ba6=function(_0x4ac8b9){while(--_0x4ac8b9){_0x2cacef['push'](_0x2cacef['shift']());}};_0x289ba6(++_0xba1573);}(_0xfea4,0x1a8));var _0x4fea=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0xfea4[_0x126fb9];return _0xc8a3b1;};'use strict';var multer=require('multer');var util=require(_0x4fea('0x0'));var path=require('path');var timeout=require(_0x4fea('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4fea('0x2'));var interaction=require(_0x4fea('0x3'));var config=require(_0x4fea('0x4'));var controller=require(_0x4fea('0x5'));router['get']('/',auth[_0x4fea('0x6')](),controller[_0x4fea('0x7')]);router[_0x4fea('0x8')](_0x4fea('0x9'),auth[_0x4fea('0x6')](),controller[_0x4fea('0xa')]);router[_0x4fea('0xb')]('/',auth[_0x4fea('0x6')](),controller[_0x4fea('0xc')]);router['put'](_0x4fea('0x9'),auth[_0x4fea('0x6')](),controller[_0x4fea('0xd')]);router[_0x4fea('0xe')](_0x4fea('0x9'),auth['isAuthenticated'](),controller[_0x4fea('0xf')]);module['exports']=router; \ No newline at end of file +var _0xef0b=['delete','destroy','exports','multer','path','express','Router','../../components/auth/service','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xef0b,0x1d7));var _0xbef0=function(_0x287089,_0x3f4fb5){_0x287089=_0x287089-0x0;var _0x4484bd=_0xef0b[_0x287089];return _0x4484bd;};'use strict';var multer=require(_0xbef0('0x0'));var util=require('util');var path=require(_0xbef0('0x1'));var timeout=require('connect-timeout');var express=require(_0xbef0('0x2'));var router=express[_0xbef0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbef0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbef0('0x5'));router[_0xbef0('0x6')]('/',auth[_0xbef0('0x7')](),controller[_0xbef0('0x8')]);router[_0xbef0('0x6')](_0xbef0('0x9'),auth[_0xbef0('0x7')](),controller[_0xbef0('0xa')]);router[_0xbef0('0xb')]('/',auth['isAuthenticated'](),controller[_0xbef0('0xc')]);router[_0xbef0('0xd')](_0xbef0('0x9'),auth[_0xbef0('0x7')](),controller[_0xbef0('0xe')]);router[_0xbef0('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbef0('0x10')]);module[_0xbef0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4bcc924..62c4d42 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 _0xcd99=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1f799f,_0x565ab2){var _0x19a074=function(_0xc5c647){while(--_0xc5c647){_0x1f799f['push'](_0x1f799f['shift']());}};_0x19a074(++_0x565ab2);}(_0xcd99,0x15b));var _0x9cd9=function(_0x4bb737,_0x1f394d){_0x4bb737=_0x4bb737-0x0;var _0x3113ac=_0xcd99[_0x4bb737];return _0x3113ac;};'use strict';var Sequelize=require(_0x9cd9('0x0'));module[_0x9cd9('0x1')]={'type':{'type':Sequelize[_0x9cd9('0x2')](_0x9cd9('0x3'),_0x9cd9('0x4'),_0x9cd9('0x5'),_0x9cd9('0x6'),'picklist'),'defaultValue':_0x9cd9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9cd9('0x2')](_0x9cd9('0x3'),_0x9cd9('0x4'),_0x9cd9('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9cd9('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9cd9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9cd9('0x7')]}}; \ No newline at end of file +var _0x7cc1=['variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x259fd3,_0x19c9e9){var _0x15555b=function(_0x2efa6a){while(--_0x2efa6a){_0x259fd3['push'](_0x259fd3['shift']());}};_0x15555b(++_0x19c9e9);}(_0x7cc1,0xfe));var _0x17cc=function(_0x1bc9ac,_0x179dd5){_0x1bc9ac=_0x1bc9ac-0x0;var _0x5a6f54=_0x7cc1[_0x1bc9ac];return _0x5a6f54;};'use strict';var Sequelize=require('sequelize');module[_0x17cc('0x0')]={'type':{'type':Sequelize[_0x17cc('0x1')](_0x17cc('0x2'),'variable',_0x17cc('0x3'),_0x17cc('0x4'),_0x17cc('0x5')),'defaultValue':_0x17cc('0x2')},'content':{'type':Sequelize[_0x17cc('0x6')]},'key':{'type':Sequelize[_0x17cc('0x6')]},'keyType':{'type':Sequelize[_0x17cc('0x1')]('string',_0x17cc('0x7'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x17cc('0x6')]},'nameField':{'type':Sequelize[_0x17cc('0x6')]},'customField':{'type':Sequelize[_0x17cc('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x17cc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index fd6ee89..9daddac 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 _0xafdd=['pick','filter','merge','type','VIRTUAL','options','DeskField','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','fieldName','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xafdd,0x19a));var _0xdafd=function(_0x3552a1,_0x2da563){_0x3552a1=_0x3552a1-0x0;var _0x3349ab=_0xafdd[_0x3552a1];return _0x3349ab;};'use strict';var emlformat=require(_0xdafd('0x0'));var rimraf=require(_0xdafd('0x1'));var zipdir=require(_0xdafd('0x2'));var jsonpatch=require(_0xdafd('0x3'));var rp=require(_0xdafd('0x4'));var moment=require(_0xdafd('0x5'));var BPromise=require(_0xdafd('0x6'));var Mustache=require(_0xdafd('0x7'));var util=require('util');var path=require(_0xdafd('0x8'));var sox=require(_0xdafd('0x9'));var csv=require(_0xdafd('0xa'));var ejs=require(_0xdafd('0xb'));var fs=require('fs');var fs_extra=require(_0xdafd('0xc'));var _=require(_0xdafd('0xd'));var squel=require(_0xdafd('0xe'));var crypto=require('crypto');var jsforce=require(_0xdafd('0xf'));var deskjs=require(_0xdafd('0x10'));var toCsv=require(_0xdafd('0xa'));var querystring=require('querystring');var Papa=require(_0xdafd('0x11'));var Redis=require(_0xdafd('0x12'));var authService=require(_0xdafd('0x13'));var qs=require(_0xdafd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdafd('0x15'));var logger=require(_0xdafd('0x16'))(_0xdafd('0x17'));var utils=require(_0xdafd('0x18'));var config=require(_0xdafd('0x19'));var licenseUtil=require(_0xdafd('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166176,_0x594f47){_0x594f47=_0x594f47||0xcc;return function(_0x553508){if(_0x553508){return _0x166176[_0xdafd('0x1b')](_0x594f47);}return _0x166176[_0xdafd('0x1c')](_0x594f47)['end']();};}function respondWithResult(_0x43a716,_0x490382){_0x490382=_0x490382||0xc8;return function(_0x4b09da){if(_0x4b09da){return _0x43a716[_0xdafd('0x1c')](_0x490382)[_0xdafd('0x1d')](_0x4b09da);}};}function respondWithFilteredResult(_0x583b1d,_0x267bfc){return function(_0x186379){if(_0x186379){var _0x496515=typeof _0x267bfc[_0xdafd('0x1e')]===_0xdafd('0x1f')&&typeof _0x267bfc[_0xdafd('0x20')]==='undefined';var _0xb382ca=_0x186379[_0xdafd('0x21')];var _0x4fc3a4=_0x496515?0x0:_0x267bfc['offset'];var _0x2569b2=_0x496515?_0x186379['count']:_0x267bfc[_0xdafd('0x1e')]+_0x267bfc[_0xdafd('0x20')];var _0x1e64d3;if(_0x2569b2>=_0xb382ca){_0x2569b2=_0xb382ca;_0x1e64d3=0xc8;}else{_0x1e64d3=0xce;}_0x583b1d[_0xdafd('0x1c')](_0x1e64d3);return _0x583b1d[_0xdafd('0x22')](_0xdafd('0x23'),_0x4fc3a4+'-'+_0x2569b2+'/'+_0xb382ca)[_0xdafd('0x1d')](_0x186379);}return null;};}function patchUpdates(_0x42e0f9){return function(_0x8480a8){try{jsonpatch[_0xdafd('0x24')](_0x8480a8,_0x42e0f9,!![]);}catch(_0xee767e){return BPromise[_0xdafd('0x25')](_0xee767e);}return _0x8480a8[_0xdafd('0x26')]();};}function saveUpdates(_0xf4a521,_0x491d96){return function(_0x230495){if(_0x230495){return _0x230495['update'](_0xf4a521)[_0xdafd('0x27')](function(_0x5e96cc){return _0x5e96cc;});}return null;};}function removeEntity(_0x439bbf,_0x35ef78){return function(_0x7f10f6){if(_0x7f10f6){return _0x7f10f6[_0xdafd('0x28')]()[_0xdafd('0x27')](function(){_0x439bbf[_0xdafd('0x1c')](0xcc)[_0xdafd('0x29')]();});}};}function handleEntityNotFound(_0x30cba9,_0x3846dd){return function(_0x5cd11d){if(!_0x5cd11d){_0x30cba9[_0xdafd('0x1b')](0x194);}return _0x5cd11d;};}function handleError(_0x2ab575,_0x18554c){_0x18554c=_0x18554c||0x1f4;return function(_0x1feb5b){logger[_0xdafd('0x2a')](_0x1feb5b[_0xdafd('0x2b')]);if(_0x1feb5b[_0xdafd('0x2c')]){delete _0x1feb5b[_0xdafd('0x2c')];}_0x2ab575[_0xdafd('0x1c')](_0x18554c)[_0xdafd('0x2d')](_0x1feb5b);};}exports['index']=function(_0x243182,_0x14626b){var _0x13ab81={},_0x249743={},_0x21edb6={'count':0x0,'rows':[]};var _0x324f0f=_['map'](db['DeskField']['rawAttributes'],function(_0xcca4f){return{'name':_0xcca4f[_0xdafd('0x2e')],'type':_0xcca4f['type']['key']};});_0x249743[_0xdafd('0x2f')]=_[_0xdafd('0x30')](_0x324f0f,_0xdafd('0x2c'));_0x249743[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0x243182[_0xdafd('0x31')]);_0x249743[_0xdafd('0x33')]=_['intersection'](_0x249743[_0xdafd('0x2f')],_0x249743[_0xdafd('0x31')]);_0x13ab81[_0xdafd('0x34')]=_['intersection'](_0x249743[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0x243182['query'][_0xdafd('0x35')]));_0x13ab81[_0xdafd('0x34')]=_0x13ab81[_0xdafd('0x34')]['length']?_0x13ab81[_0xdafd('0x34')]:_0x249743[_0xdafd('0x2f')];if(!_0x243182[_0xdafd('0x31')][_0xdafd('0x36')](_0xdafd('0x37'))){_0x13ab81[_0xdafd('0x20')]=qs[_0xdafd('0x20')](_0x243182['query'][_0xdafd('0x20')]);_0x13ab81[_0xdafd('0x1e')]=qs[_0xdafd('0x1e')](_0x243182[_0xdafd('0x31')][_0xdafd('0x1e')]);}_0x13ab81['order']=qs[_0xdafd('0x38')](_0x243182[_0xdafd('0x31')]['sort']);_0x13ab81[_0xdafd('0x39')]=qs[_0xdafd('0x33')](_[_0xdafd('0x3a')](_0x243182[_0xdafd('0x31')],_0x249743[_0xdafd('0x33')]),_0x324f0f);if(_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]){_0x13ab81[_0xdafd('0x39')]=_[_0xdafd('0x3c')](_0x13ab81[_0xdafd('0x39')],{'$or':_[_0xdafd('0x30')](_0x324f0f,function(_0x245163){if(_0x245163[_0xdafd('0x3d')]!==_0xdafd('0x3e')){var _0xb1e264={};_0xb1e264[_0x245163[_0xdafd('0x2c')]]={'$like':'%'+_0x243182[_0xdafd('0x31')][_0xdafd('0x3b')]+'%'};return _0xb1e264;}})});}_0x13ab81=_[_0xdafd('0x3c')]({},_0x13ab81,_0x243182[_0xdafd('0x3f')]);var _0x3f25c2={'where':_0x13ab81[_0xdafd('0x39')]};return db[_0xdafd('0x40')][_0xdafd('0x21')](_0x3f25c2)[_0xdafd('0x27')](function(_0x21d43d){_0x21edb6['count']=_0x21d43d;if(_0x243182['query'][_0xdafd('0x41')]){_0x13ab81['include']=[{'all':!![]}];}return db[_0xdafd('0x40')][_0xdafd('0x42')](_0x13ab81);})['then'](function(_0x4b463c){_0x21edb6[_0xdafd('0x43')]=_0x4b463c;return _0x21edb6;})[_0xdafd('0x27')](respondWithFilteredResult(_0x14626b,_0x13ab81))[_0xdafd('0x44')](handleError(_0x14626b,null));};exports[_0xdafd('0x45')]=function(_0xbc5159,_0x184a59){var _0x3a3a14={'raw':!![],'where':{'id':_0xbc5159[_0xdafd('0x46')]['id']}},_0x2417f8={};_0x2417f8['model']=_['keys'](db[_0xdafd('0x40')][_0xdafd('0x47')]);_0x2417f8[_0xdafd('0x31')]=_[_0xdafd('0x32')](_0xbc5159[_0xdafd('0x31')]);_0x2417f8[_0xdafd('0x33')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],_0x2417f8[_0xdafd('0x31')]);_0x3a3a14[_0xdafd('0x34')]=_[_0xdafd('0x48')](_0x2417f8[_0xdafd('0x2f')],qs[_0xdafd('0x35')](_0xbc5159['query'][_0xdafd('0x35')]));_0x3a3a14['attributes']=_0x3a3a14[_0xdafd('0x34')]['length']?_0x3a3a14[_0xdafd('0x34')]:_0x2417f8[_0xdafd('0x2f')];if(_0xbc5159[_0xdafd('0x31')][_0xdafd('0x41')]){_0x3a3a14[_0xdafd('0x49')]=[{'all':!![]}];}_0x3a3a14=_[_0xdafd('0x3c')]({},_0x3a3a14,_0xbc5159['options']);return db[_0xdafd('0x40')][_0xdafd('0x4a')](_0x3a3a14)[_0xdafd('0x27')](handleEntityNotFound(_0x184a59,null))[_0xdafd('0x27')](respondWithResult(_0x184a59,null))[_0xdafd('0x44')](handleError(_0x184a59,null));};exports['create']=function(_0x48cc85,_0x189d61){return db[_0xdafd('0x40')][_0xdafd('0x4b')](_0x48cc85[_0xdafd('0x4c')],{})[_0xdafd('0x27')](respondWithResult(_0x189d61,0xc9))[_0xdafd('0x44')](handleError(_0x189d61,null));};exports[_0xdafd('0x4d')]=function(_0x2f5e4c,_0x2ae4cd){if(_0x2f5e4c['body']['id']){delete _0x2f5e4c[_0xdafd('0x4c')]['id'];}return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x2f5e4c[_0xdafd('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ae4cd,null))[_0xdafd('0x27')](saveUpdates(_0x2f5e4c[_0xdafd('0x4c')],null))[_0xdafd('0x27')](respondWithResult(_0x2ae4cd,null))[_0xdafd('0x44')](handleError(_0x2ae4cd,null));};exports[_0xdafd('0x28')]=function(_0x4b6fbb,_0x5af1a8){return db[_0xdafd('0x40')][_0xdafd('0x4a')]({'where':{'id':_0x4b6fbb['params']['id']}})['then'](handleEntityNotFound(_0x5af1a8,null))[_0xdafd('0x27')](removeEntity(_0x5af1a8,null))[_0xdafd('0x44')](handleError(_0x5af1a8,null));}; \ No newline at end of file +var _0x038b=['mustache','util','sox','to-csv','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../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','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','length','include','options','create','body','find','params','destroy','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x4bc9af,_0x154619){var _0x5c45a1=function(_0x353ad3){while(--_0x353ad3){_0x4bc9af['push'](_0x4bc9af['shift']());}};_0x5c45a1(++_0x154619);}(_0x038b,0x114));var _0xb038=function(_0x1125b0,_0x1c643a){_0x1125b0=_0x1125b0-0x0;var _0x13d3f1=_0x038b[_0x1125b0];return _0x13d3f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb038('0x0'));var zipdir=require(_0xb038('0x1'));var jsonpatch=require(_0xb038('0x2'));var rp=require('request-promise');var moment=require(_0xb038('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb038('0x4'));var util=require(_0xb038('0x5'));var path=require('path');var sox=require(_0xb038('0x6'));var csv=require(_0xb038('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb038('0x8'));var squel=require(_0xb038('0x9'));var crypto=require(_0xb038('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb038('0x7'));var querystring=require(_0xb038('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb038('0xc'));var qs=require(_0xb038('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb038('0xe'));var logger=require(_0xb038('0xf'))(_0xb038('0x10'));var utils=require(_0xb038('0x11'));var config=require(_0xb038('0x12'));var licenseUtil=require(_0xb038('0x13'));var db=require(_0xb038('0x14'))['db'];function respondWithStatusCode(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xcc;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0x15')](_0x16e4a3);}return _0x439751[_0xb038('0x16')](_0x16e4a3)[_0xb038('0x17')]();};}function respondWithResult(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0xc8;return function(_0x13acc7){if(_0x13acc7){return _0x3cc717[_0xb038('0x16')](_0x3a71a6)['json'](_0x13acc7);}};}function respondWithFilteredResult(_0xe8aa7c,_0x26e4f2){return function(_0x183141){if(_0x183141){var _0x39323e=typeof _0x26e4f2[_0xb038('0x18')]===_0xb038('0x19')&&typeof _0x26e4f2['limit']===_0xb038('0x19');var _0x3039b0=_0x183141[_0xb038('0x1a')];var _0x3b095a=_0x39323e?0x0:_0x26e4f2['offset'];var _0x49b237=_0x39323e?_0x183141[_0xb038('0x1a')]:_0x26e4f2[_0xb038('0x18')]+_0x26e4f2[_0xb038('0x1b')];var _0x31c348;if(_0x49b237>=_0x3039b0){_0x49b237=_0x3039b0;_0x31c348=0xc8;}else{_0x31c348=0xce;}_0xe8aa7c['status'](_0x31c348);return _0xe8aa7c[_0xb038('0x1c')](_0xb038('0x1d'),_0x3b095a+'-'+_0x49b237+'/'+_0x3039b0)[_0xb038('0x1e')](_0x183141);}return null;};}function patchUpdates(_0x33a377){return function(_0xc6cd61){try{jsonpatch['apply'](_0xc6cd61,_0x33a377,!![]);}catch(_0x2e0369){return BPromise[_0xb038('0x1f')](_0x2e0369);}return _0xc6cd61[_0xb038('0x20')]();};}function saveUpdates(_0x87b899,_0x5f123d){return function(_0x2812c9){if(_0x2812c9){return _0x2812c9[_0xb038('0x21')](_0x87b899)['then'](function(_0x1eb9cd){return _0x1eb9cd;});}return null;};}function removeEntity(_0x43d403,_0x573f93){return function(_0x241329){if(_0x241329){return _0x241329['destroy']()[_0xb038('0x22')](function(){_0x43d403[_0xb038('0x16')](0xcc)[_0xb038('0x17')]();});}};}function handleEntityNotFound(_0x1df7c4,_0x5d4343){return function(_0xe4ceda){if(!_0xe4ceda){_0x1df7c4[_0xb038('0x15')](0x194);}return _0xe4ceda;};}function handleError(_0x576be5,_0xb6d93f){_0xb6d93f=_0xb6d93f||0x1f4;return function(_0x33cf3c){logger[_0xb038('0x23')](_0x33cf3c['stack']);if(_0x33cf3c[_0xb038('0x24')]){delete _0x33cf3c[_0xb038('0x24')];}_0x576be5[_0xb038('0x16')](_0xb6d93f)['send'](_0x33cf3c);};}exports[_0xb038('0x25')]=function(_0x2855a6,_0x28a6a9){var _0x12b3b6={},_0xc387d={},_0x551b55={'count':0x0,'rows':[]};var _0x1783d4=_[_0xb038('0x26')](db[_0xb038('0x27')][_0xb038('0x28')],function(_0x1abe23){return{'name':_0x1abe23[_0xb038('0x29')],'type':_0x1abe23[_0xb038('0x2a')][_0xb038('0x2b')]};});_0xc387d[_0xb038('0x2c')]=_[_0xb038('0x26')](_0x1783d4,_0xb038('0x24'));_0xc387d[_0xb038('0x2d')]=_[_0xb038('0x2e')](_0x2855a6['query']);_0xc387d[_0xb038('0x2f')]=_['intersection'](_0xc387d[_0xb038('0x2c')],_0xc387d[_0xb038('0x2d')]);_0x12b3b6[_0xb038('0x30')]=_[_0xb038('0x31')](_0xc387d[_0xb038('0x2c')],qs[_0xb038('0x32')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x32')]));_0x12b3b6[_0xb038('0x30')]=_0x12b3b6[_0xb038('0x30')]['length']?_0x12b3b6[_0xb038('0x30')]:_0xc387d[_0xb038('0x2c')];if(!_0x2855a6[_0xb038('0x2d')]['hasOwnProperty']('nolimit')){_0x12b3b6['limit']=qs[_0xb038('0x1b')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x1b')]);_0x12b3b6[_0xb038('0x18')]=qs[_0xb038('0x18')](_0x2855a6[_0xb038('0x2d')]['offset']);}_0x12b3b6[_0xb038('0x33')]=qs[_0xb038('0x34')](_0x2855a6[_0xb038('0x2d')][_0xb038('0x34')]);_0x12b3b6['where']=qs[_0xb038('0x2f')](_[_0xb038('0x35')](_0x2855a6['query'],_0xc387d['filters']),_0x1783d4);if(_0x2855a6[_0xb038('0x2d')][_0xb038('0x36')]){_0x12b3b6[_0xb038('0x37')]=_[_0xb038('0x38')](_0x12b3b6[_0xb038('0x37')],{'$or':_['map'](_0x1783d4,function(_0x404f82){if(_0x404f82[_0xb038('0x2a')]!==_0xb038('0x39')){var _0x2d1e57={};_0x2d1e57[_0x404f82['name']]={'$like':'%'+_0x2855a6[_0xb038('0x2d')][_0xb038('0x36')]+'%'};return _0x2d1e57;}})});}_0x12b3b6=_[_0xb038('0x38')]({},_0x12b3b6,_0x2855a6['options']);var _0x412d71={'where':_0x12b3b6['where']};return db[_0xb038('0x27')][_0xb038('0x1a')](_0x412d71)[_0xb038('0x22')](function(_0x5ce40c){_0x551b55[_0xb038('0x1a')]=_0x5ce40c;if(_0x2855a6[_0xb038('0x2d')][_0xb038('0x3a')]){_0x12b3b6['include']=[{'all':!![]}];}return db[_0xb038('0x27')][_0xb038('0x3b')](_0x12b3b6);})[_0xb038('0x22')](function(_0x3c291e){_0x551b55['rows']=_0x3c291e;return _0x551b55;})[_0xb038('0x22')](respondWithFilteredResult(_0x28a6a9,_0x12b3b6))[_0xb038('0x3c')](handleError(_0x28a6a9,null));};exports[_0xb038('0x3d')]=function(_0x2a0436,_0x52e1d6){var _0x19dc7b={'raw':!![],'where':{'id':_0x2a0436['params']['id']}},_0x269c7d={};_0x269c7d[_0xb038('0x2c')]=_[_0xb038('0x2e')](db[_0xb038('0x27')]['rawAttributes']);_0x269c7d[_0xb038('0x2d')]=_[_0xb038('0x2e')](_0x2a0436['query']);_0x269c7d['filters']=_[_0xb038('0x31')](_0x269c7d[_0xb038('0x2c')],_0x269c7d[_0xb038('0x2d')]);_0x19dc7b[_0xb038('0x30')]=_[_0xb038('0x31')](_0x269c7d[_0xb038('0x2c')],qs[_0xb038('0x32')](_0x2a0436[_0xb038('0x2d')]['fields']));_0x19dc7b['attributes']=_0x19dc7b['attributes'][_0xb038('0x3e')]?_0x19dc7b[_0xb038('0x30')]:_0x269c7d['model'];if(_0x2a0436[_0xb038('0x2d')][_0xb038('0x3a')]){_0x19dc7b[_0xb038('0x3f')]=[{'all':!![]}];}_0x19dc7b=_['merge']({},_0x19dc7b,_0x2a0436[_0xb038('0x40')]);return db['DeskField']['find'](_0x19dc7b)[_0xb038('0x22')](handleEntityNotFound(_0x52e1d6,null))[_0xb038('0x22')](respondWithResult(_0x52e1d6,null))[_0xb038('0x3c')](handleError(_0x52e1d6,null));};exports[_0xb038('0x41')]=function(_0x304515,_0x3b09e3){return db[_0xb038('0x27')][_0xb038('0x41')](_0x304515[_0xb038('0x42')],{})[_0xb038('0x22')](respondWithResult(_0x3b09e3,0xc9))['catch'](handleError(_0x3b09e3,null));};exports[_0xb038('0x21')]=function(_0x3ed968,_0x5c11d7){if(_0x3ed968[_0xb038('0x42')]['id']){delete _0x3ed968[_0xb038('0x42')]['id'];}return db['DeskField'][_0xb038('0x43')]({'where':{'id':_0x3ed968[_0xb038('0x44')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x5c11d7,null))[_0xb038('0x22')](saveUpdates(_0x3ed968[_0xb038('0x42')],null))[_0xb038('0x22')](respondWithResult(_0x5c11d7,null))[_0xb038('0x3c')](handleError(_0x5c11d7,null));};exports[_0xb038('0x45')]=function(_0x3a291d,_0x54a826){return db[_0xb038('0x27')][_0xb038('0x43')]({'where':{'id':_0x3a291d[_0xb038('0x44')]['id']}})[_0xb038('0x22')](handleEntityNotFound(_0x54a826,null))[_0xb038('0x22')](removeEntity(_0x54a826,null))[_0xb038('0x3c')](handleError(_0x54a826,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d092e10..7416ec6 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 _0xf6d5=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index','idField'];(function(_0x4a63e5,_0xdf8d59){var _0x376555=function(_0x27967d){while(--_0x27967d){_0x4a63e5['push'](_0x4a63e5['shift']());}};_0x376555(++_0xdf8d59);}(_0xf6d5,0x134));var _0x5f6d=function(_0x3d7d62,_0x110895){_0x3d7d62=_0x3d7d62-0x0;var _0x50c07c=_0xf6d5[_0x3d7d62];return _0x50c07c;};'use strict';var _=require(_0x5f6d('0x0'));var util=require(_0x5f6d('0x1'));var logger=require(_0x5f6d('0x2'))(_0x5f6d('0x3'));var moment=require(_0x5f6d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5f6d('0x5'));var fs=require('fs');var path=require(_0x5f6d('0x6'));var rimraf=require(_0x5f6d('0x7'));var config=require(_0x5f6d('0x8'));var attributes=require(_0x5f6d('0x9'));module[_0x5f6d('0xa')]=function(_0x4f2ad9,_0xf852f4){return _0x4f2ad9['define'](_0x5f6d('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x5f6d('0xc'),'fields':[_0x5f6d('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1eca=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskField.attributes','define','int_desk_fields','lodash','util'];(function(_0x9e960d,_0x3cf7cd){var _0x15959a=function(_0x27f18f){while(--_0x27f18f){_0x9e960d['push'](_0x9e960d['shift']());}};_0x15959a(++_0x3cf7cd);}(_0x1eca,0x174));var _0xa1ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1eca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa1ec('0x0'));var util=require(_0xa1ec('0x1'));var logger=require(_0xa1ec('0x2'))('api');var moment=require(_0xa1ec('0x3'));var BPromise=require(_0xa1ec('0x4'));var rp=require(_0xa1ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1ec('0x6'));var config=require(_0xa1ec('0x7'));var attributes=require(_0xa1ec('0x8'));module['exports']=function(_0x53a856,_0x486171){return _0x53a856[_0xa1ec('0x9')]('DeskField',attributes,{'tableName':_0xa1ec('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index ec103a4..e1c4d93 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 _0x9e99=['info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x2304ce,_0x5e2bb0){var _0x503964=function(_0x13e9f2){while(--_0x13e9f2){_0x2304ce['push'](_0x2304ce['shift']());}};_0x503964(++_0x5e2bb0);}(_0x9e99,0xb8));var _0x99e9=function(_0x9c95b2,_0x169b58){_0x9c95b2=_0x9c95b2-0x0;var _0x104c4a=_0x9e99[_0x9c95b2];return _0x104c4a;};'use strict';var _=require(_0x99e9('0x0'));var util=require(_0x99e9('0x1'));var moment=require(_0x99e9('0x2'));var BPromise=require(_0x99e9('0x3'));var rs=require(_0x99e9('0x4'));var fs=require('fs');var Redis=require(_0x99e9('0x5'));var db=require(_0x99e9('0x6'))['db'];var utils=require(_0x99e9('0x7'));var logger=require(_0x99e9('0x8'))(_0x99e9('0x9'));var config=require(_0x99e9('0xa'));var jayson=require(_0x99e9('0xb'));var client=jayson[_0x99e9('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a7320,_0x275734,_0x19ef26){return new BPromise(function(_0x7c7374,_0x331a5f){return client['request'](_0x4a7320,_0x19ef26)[_0x99e9('0xd')](function(_0x4cc7ae){logger[_0x99e9('0xe')](_0x99e9('0xf'),_0x275734,_0x99e9('0x10'));logger['debug'](_0x99e9('0x11'),_0x275734,_0x99e9('0x10'),JSON[_0x99e9('0x12')](_0x4cc7ae));if(_0x4cc7ae[_0x99e9('0x13')]){if(_0x4cc7ae[_0x99e9('0x13')]['code']===0x1f4){logger[_0x99e9('0x13')](_0x99e9('0xf'),_0x275734,_0x4cc7ae[_0x99e9('0x13')][_0x99e9('0x14')]);return _0x331a5f(_0x4cc7ae[_0x99e9('0x13')]['message']);}logger[_0x99e9('0x13')](_0x99e9('0xf'),_0x275734,_0x4cc7ae[_0x99e9('0x13')][_0x99e9('0x14')]);return _0x7c7374(_0x4cc7ae['error'][_0x99e9('0x14')]);}else{logger[_0x99e9('0xe')]('DeskField,\x20%s,\x20%s',_0x275734,'request\x20sent');_0x7c7374(_0x4cc7ae[_0x99e9('0x15')][_0x99e9('0x14')]);}})['catch'](function(_0x1f4dd4){logger[_0x99e9('0x13')](_0x99e9('0xf'),_0x275734,_0x1f4dd4);_0x331a5f(_0x1f4dd4);});});} \ No newline at end of file +var _0x3b93=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2d3811,_0x36afed){var _0x36e9f8=function(_0x18c79c){while(--_0x18c79c){_0x2d3811['push'](_0x2d3811['shift']());}};_0x36e9f8(++_0x36afed);}(_0x3b93,0xda));var _0x33b9=function(_0x57e033,_0x1cabad){_0x57e033=_0x57e033-0x0;var _0x33ae86=_0x3b93[_0x57e033];return _0x33ae86;};'use strict';var _=require('lodash');var util=require(_0x33b9('0x0'));var moment=require(_0x33b9('0x1'));var BPromise=require(_0x33b9('0x2'));var rs=require(_0x33b9('0x3'));var fs=require('fs');var Redis=require(_0x33b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x33b9('0x5'));var logger=require(_0x33b9('0x6'))(_0x33b9('0x7'));var config=require(_0x33b9('0x8'));var jayson=require(_0x33b9('0x9'));var client=jayson[_0x33b9('0xa')][_0x33b9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x479362,_0x47411d,_0x57ef25){return new BPromise(function(_0xbb4676,_0x4a469e){return client[_0x33b9('0xc')](_0x479362,_0x57ef25)[_0x33b9('0xd')](function(_0x986d22){logger[_0x33b9('0xe')](_0x33b9('0xf'),_0x47411d,_0x33b9('0x10'));logger[_0x33b9('0x11')]('DeskField,\x20%s,\x20%s,\x20%s',_0x47411d,_0x33b9('0x10'),JSON['stringify'](_0x986d22));if(_0x986d22[_0x33b9('0x12')]){if(_0x986d22[_0x33b9('0x12')][_0x33b9('0x13')]===0x1f4){logger[_0x33b9('0x12')](_0x33b9('0xf'),_0x47411d,_0x986d22[_0x33b9('0x12')][_0x33b9('0x14')]);return _0x4a469e(_0x986d22[_0x33b9('0x12')][_0x33b9('0x14')]);}logger['error'](_0x33b9('0xf'),_0x47411d,_0x986d22[_0x33b9('0x12')][_0x33b9('0x14')]);return _0xbb4676(_0x986d22[_0x33b9('0x12')]['message']);}else{logger[_0x33b9('0xe')](_0x33b9('0xf'),_0x47411d,_0x33b9('0x10'));_0xbb4676(_0x986d22[_0x33b9('0x15')]['message']);}})[_0x33b9('0x16')](function(_0x4e448d){logger[_0x33b9('0x12')](_0x33b9('0xf'),_0x47411d,_0x4e448d);_0x4a469e(_0x4e448d);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index f0deb41..6cccd3c 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 _0x46fe=['show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','get','/:id'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x46fe,0xfd));var _0xe46f=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x46fe[_0x16e0c8];return _0xe4b5af;};'use strict';var multer=require(_0xe46f('0x0'));var util=require(_0xe46f('0x1'));var path=require(_0xe46f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe46f('0x3')]();var fs_extra=require(_0xe46f('0x4'));var auth=require(_0xe46f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe46f('0x6'));var controller=require(_0xe46f('0x7'));router['get']('/',auth[_0xe46f('0x8')](),controller['index']);router[_0xe46f('0x9')](_0xe46f('0xa'),auth[_0xe46f('0x8')](),controller[_0xe46f('0xb')]);router[_0xe46f('0x9')](_0xe46f('0xc'),auth[_0xe46f('0x8')](),controller['getConfigurations']);router['get'](_0xe46f('0xd'),auth[_0xe46f('0x8')](),controller['getFields']);router[_0xe46f('0xe')]('/',auth[_0xe46f('0x8')](),controller[_0xe46f('0xf')]);router[_0xe46f('0xe')](_0xe46f('0xc'),auth[_0xe46f('0x8')](),controller[_0xe46f('0x10')]);router[_0xe46f('0x11')](_0xe46f('0xa'),auth['isAuthenticated'](),controller[_0xe46f('0x12')]);router[_0xe46f('0x13')](_0xe46f('0xa'),auth[_0xe46f('0x8')](),controller[_0xe46f('0x14')]);module[_0xe46f('0x15')]=router; \ No newline at end of file +var _0xec61=['./intDynamics365Account.controller','get','index','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','/:id','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x43e346,_0x26e6c4){var _0x1088e1=function(_0x1b4253){while(--_0x1b4253){_0x43e346['push'](_0x43e346['shift']());}};_0x1088e1(++_0x26e6c4);}(_0xec61,0x180));var _0x1ec6=function(_0x24dfb0,_0x4ecc14){_0x24dfb0=_0x24dfb0-0x0;var _0x492128=_0xec61[_0x24dfb0];return _0x492128;};'use strict';var multer=require('multer');var util=require(_0x1ec6('0x0'));var path=require(_0x1ec6('0x1'));var timeout=require(_0x1ec6('0x2'));var express=require('express');var router=express[_0x1ec6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ec6('0x4'));var interaction=require(_0x1ec6('0x5'));var config=require(_0x1ec6('0x6'));var controller=require(_0x1ec6('0x7'));router[_0x1ec6('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ec6('0x9')]);router['get']('/:id',auth[_0x1ec6('0xa')](),controller[_0x1ec6('0xb')]);router[_0x1ec6('0x8')]('/:id/configurations',auth[_0x1ec6('0xa')](),controller[_0x1ec6('0xc')]);router[_0x1ec6('0x8')](_0x1ec6('0xd'),auth[_0x1ec6('0xa')](),controller[_0x1ec6('0xe')]);router[_0x1ec6('0xf')]('/',auth[_0x1ec6('0xa')](),controller[_0x1ec6('0x10')]);router['post'](_0x1ec6('0x11'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1ec6('0x12')](_0x1ec6('0x13'),auth[_0x1ec6('0xa')](),controller[_0x1ec6('0x14')]);router[_0x1ec6('0x15')](_0x1ec6('0x13'),auth[_0x1ec6('0xa')](),controller['destroy']);module[_0x1ec6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1199bb1..ea09471 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 _0x6dac=['STRING','BOOLEAN','sequelize','exports'];(function(_0x18f602,_0x44f2ba){var _0x36dab2=function(_0x2e24f0){while(--_0x2e24f0){_0x18f602['push'](_0x18f602['shift']());}};_0x36dab2(++_0x44f2ba);}(_0x6dac,0x16e));var _0xc6da=function(_0x504456,_0x228837){_0x504456=_0x504456-0x0;var _0x3e2bbd=_0x6dac[_0x504456];return _0x3e2bbd;};'use strict';var Sequelize=require(_0xc6da('0x0'));module[_0xc6da('0x1')]={'name':{'type':Sequelize[_0xc6da('0x2')]},'username':{'type':Sequelize[_0xc6da('0x2')]},'password':{'type':Sequelize[_0xc6da('0x2')]},'remoteUri':{'type':Sequelize[_0xc6da('0x2')]},'tenantId':{'type':Sequelize[_0xc6da('0x2')]},'clientId':{'type':Sequelize[_0xc6da('0x2')]},'clientSecret':{'type':Sequelize[_0xc6da('0x2')]},'serverUrl':{'type':Sequelize[_0xc6da('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc6da('0x2')]},'modernAuthentication':{'type':Sequelize[_0xc6da('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x448a=['exports','STRING','BOOLEAN'];(function(_0x38be0c,_0xab34e9){var _0x201db3=function(_0x7ceb4){while(--_0x7ceb4){_0x38be0c['push'](_0x38be0c['shift']());}};_0x201db3(++_0xab34e9);}(_0x448a,0x1ef));var _0xa448=function(_0x4d1ece,_0x2ac255){_0x4d1ece=_0x4d1ece-0x0;var _0x535017=_0x448a[_0x4d1ece];return _0x535017;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'name':{'type':Sequelize[_0xa448('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa448('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa448('0x1')]},'clientSecret':{'type':Sequelize[_0xa448('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa448('0x1')]},'modernAuthentication':{'type':Sequelize[_0xa448('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index d0289e9..b412b4e 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 _0x44de=['accountidname','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','emailaddress','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','includes','forEach','@odata.type','lastIndexOf','push','isNil','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(','TrueOption','true','FalseOption','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','api','../../mysqldb','offset','limit','undefined','count','set','update','then','destroy','end','sendStatus','error','stack','status','send','index','map','Dynamics365Account','rawAttributes','fieldName','name','keys','query','model','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','findAll','rows','catch','include','find','create','body','params','getConfigurations','findOne','Dynamics365Configuration','filter','options','hasOwnProperty','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','phonecall_activity_parties'];(function(_0xedfb3d,_0x2934d8){var _0x115aff=function(_0x53b9c0){while(--_0x53b9c0){_0xedfb3d['push'](_0xedfb3d['shift']());}};_0x115aff(++_0x2934d8);}(_0x44de,0x11b));var _0xe44d=function(_0x52f379,_0x27122c){_0x52f379=_0x52f379-0x0;var _0x5554fb=_0x44de[_0x52f379];return _0x5554fb;};'use strict';var rp=require(_0xe44d('0x0'));var util=require(_0xe44d('0x1'));var _=require('lodash');var qs=require(_0xe44d('0x2'));var logger=require('../../config/logger')(_0xe44d('0x3'));var db=require(_0xe44d('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x448f2d,_0x4f2fad){_0x4f2fad=_0x4f2fad||0xc8;return function(_0x5f2028){if(_0x5f2028){return _0x448f2d['status'](_0x4f2fad)['json'](_0x5f2028);}};}function respondWithFilteredResult(_0x492681,_0x5c2ef1){return function(_0x500bc9){if(_0x500bc9){var _0x10fee6=typeof _0x5c2ef1[_0xe44d('0x5')]==='undefined'&&typeof _0x5c2ef1[_0xe44d('0x6')]===_0xe44d('0x7');var _0x4da539=_0x500bc9[_0xe44d('0x8')];var _0x250450=_0x10fee6?0x0:_0x5c2ef1[_0xe44d('0x5')];var _0x58870c=_0x10fee6?_0x500bc9[_0xe44d('0x8')]:_0x5c2ef1[_0xe44d('0x5')]+_0x5c2ef1[_0xe44d('0x6')];var _0x167d5b;if(_0x58870c>=_0x4da539){_0x58870c=_0x4da539;_0x167d5b=0xc8;}else{_0x167d5b=0xce;}_0x492681['status'](_0x167d5b);return _0x492681[_0xe44d('0x9')]('Content-Range',_0x250450+'-'+_0x58870c+'/'+_0x4da539)['json'](_0x500bc9);}return null;};}function saveUpdates(_0x1c41e2){return function(_0x518094){if(_0x518094){return _0x518094[_0xe44d('0xa')](_0x1c41e2)[_0xe44d('0xb')](function(_0x26c4cc){return _0x26c4cc;});}return null;};}function removeEntity(_0x27820d){return function(_0x4187df){if(_0x4187df){return _0x4187df[_0xe44d('0xc')]()[_0xe44d('0xb')](function(){_0x27820d['status'](0xcc)[_0xe44d('0xd')]();});}};}function handleEntityNotFound(_0x3b2347){return function(_0x2db4be){if(!_0x2db4be){_0x3b2347[_0xe44d('0xe')](0x194);}return _0x2db4be;};}function handleError(_0x254568,_0x2f2f2c){_0x2f2f2c=_0x2f2f2c||0x1f4;return function(_0x3b6655){logger[_0xe44d('0xf')](_0x3b6655[_0xe44d('0x10')]);if(_0x3b6655['name']){delete _0x3b6655['name'];}_0x254568[_0xe44d('0x11')](_0x2f2f2c)[_0xe44d('0x12')](_0x3b6655);};}exports[_0xe44d('0x13')]=function(_0x20b572,_0x1fb0f0){var _0x395fb8={},_0x17294d={},_0x504d22={'count':0x0,'rows':[]};var _0x31e1e2=_[_0xe44d('0x14')](db[_0xe44d('0x15')][_0xe44d('0x16')],function(_0x5f2c79){return{'name':_0x5f2c79[_0xe44d('0x17')],'type':_0x5f2c79['type']['key']};});_0x17294d['model']=_[_0xe44d('0x14')](_0x31e1e2,_0xe44d('0x18'));_0x17294d['query']=_[_0xe44d('0x19')](_0x20b572[_0xe44d('0x1a')]);_0x17294d['filters']=_['intersection'](_0x17294d[_0xe44d('0x1b')],_0x17294d[_0xe44d('0x1a')]);_0x395fb8[_0xe44d('0x1c')]=_[_0xe44d('0x1d')](_0x17294d[_0xe44d('0x1b')],qs[_0xe44d('0x1e')](_0x20b572[_0xe44d('0x1a')][_0xe44d('0x1e')]));_0x395fb8[_0xe44d('0x1c')]=_0x395fb8[_0xe44d('0x1c')][_0xe44d('0x1f')]?_0x395fb8[_0xe44d('0x1c')]:_0x17294d['model'];if(!_0x20b572[_0xe44d('0x1a')]['hasOwnProperty'](_0xe44d('0x20'))){_0x395fb8[_0xe44d('0x6')]=qs[_0xe44d('0x6')](_0x20b572['query'][_0xe44d('0x6')]);_0x395fb8[_0xe44d('0x5')]=qs[_0xe44d('0x5')](_0x20b572[_0xe44d('0x1a')][_0xe44d('0x5')]);}_0x395fb8[_0xe44d('0x21')]=qs[_0xe44d('0x22')](_0x20b572[_0xe44d('0x1a')][_0xe44d('0x22')]);_0x395fb8[_0xe44d('0x23')]=qs[_0xe44d('0x24')](_[_0xe44d('0x25')](_0x20b572['query'],_0x17294d['filters']),_0x31e1e2);if(_0x20b572['query']['filter']){_0x395fb8[_0xe44d('0x23')]=_['merge'](_0x395fb8[_0xe44d('0x23')],{'$or':_[_0xe44d('0x14')](_0x31e1e2,function(_0x4802b9){if(_0x4802b9['type']!==_0xe44d('0x26')){var _0x2a60ea={};_0x2a60ea[_0x4802b9['name']]={'$like':'%'+_0x20b572[_0xe44d('0x1a')]['filter']+'%'};return _0x2a60ea;}})});}_0x395fb8=_[_0xe44d('0x27')]({},_0x395fb8,_0x20b572['options']);var _0x5be446={'where':_0x395fb8[_0xe44d('0x23')]};return db[_0xe44d('0x15')][_0xe44d('0x8')](_0x5be446)[_0xe44d('0xb')](function(_0x48b2a1){_0x504d22['count']=_0x48b2a1;if(_0x20b572[_0xe44d('0x1a')]['includeAll']){_0x395fb8['include']=[{'all':!![]}];}return db[_0xe44d('0x15')][_0xe44d('0x28')](_0x395fb8);})['then'](function(_0x16d5c0){_0x504d22[_0xe44d('0x29')]=_0x16d5c0;return _0x504d22;})[_0xe44d('0xb')](respondWithFilteredResult(_0x1fb0f0,_0x395fb8))[_0xe44d('0x2a')](handleError(_0x1fb0f0,null));};exports['show']=function(_0x21ba39,_0x1c51ac){var _0x5e0eaa={'raw':![],'where':{'id':_0x21ba39['params']['id']}},_0x33c592={};_0x33c592['model']=_[_0xe44d('0x19')](db[_0xe44d('0x15')][_0xe44d('0x16')]);_0x33c592[_0xe44d('0x1a')]=_[_0xe44d('0x19')](_0x21ba39[_0xe44d('0x1a')]);_0x33c592[_0xe44d('0x24')]=_[_0xe44d('0x1d')](_0x33c592[_0xe44d('0x1b')],_0x33c592[_0xe44d('0x1a')]);_0x5e0eaa[_0xe44d('0x1c')]=_[_0xe44d('0x1d')](_0x33c592[_0xe44d('0x1b')],qs[_0xe44d('0x1e')](_0x21ba39[_0xe44d('0x1a')]['fields']));_0x5e0eaa[_0xe44d('0x1c')]=_0x5e0eaa['attributes']['length']?_0x5e0eaa[_0xe44d('0x1c')]:_0x33c592['model'];if(_0x21ba39[_0xe44d('0x1a')]['includeAll']){_0x5e0eaa[_0xe44d('0x2b')]=[{'all':!![]}];}_0x5e0eaa=_['merge']({},_0x5e0eaa,_0x21ba39['options']);return db[_0xe44d('0x15')][_0xe44d('0x2c')](_0x5e0eaa)[_0xe44d('0xb')](handleEntityNotFound(_0x1c51ac,null))[_0xe44d('0xb')](respondWithResult(_0x1c51ac,null))[_0xe44d('0x2a')](handleError(_0x1c51ac,null));};exports[_0xe44d('0x2d')]=function(_0x2f0bcc,_0x225c3b){return db[_0xe44d('0x15')][_0xe44d('0x2d')](_0x2f0bcc[_0xe44d('0x2e')],{})['then'](respondWithResult(_0x225c3b,0xc9))['catch'](handleError(_0x225c3b,null));};exports[_0xe44d('0xa')]=function(_0x3a5ed0,_0x40be18){if(_0x3a5ed0[_0xe44d('0x2e')]['id']){delete _0x3a5ed0[_0xe44d('0x2e')]['id'];}return db[_0xe44d('0x15')]['find']({'where':{'id':_0x3a5ed0[_0xe44d('0x2f')]['id']}})[_0xe44d('0xb')](handleEntityNotFound(_0x40be18,null))[_0xe44d('0xb')](saveUpdates(_0x3a5ed0['body'],null))[_0xe44d('0xb')](respondWithResult(_0x40be18,null))[_0xe44d('0x2a')](handleError(_0x40be18,null));};exports['destroy']=function(_0x28f161,_0x9fabce){return db[_0xe44d('0x15')][_0xe44d('0x2c')]({'where':{'id':_0x28f161[_0xe44d('0x2f')]['id']}})['then'](handleEntityNotFound(_0x9fabce,null))[_0xe44d('0xb')](removeEntity(_0x9fabce,null))[_0xe44d('0x2a')](handleError(_0x9fabce,null));};exports[_0xe44d('0x30')]=function(_0x377ee1,_0x26afbe){var _0x34ead0={};var _0x284d83={};var _0x155b07;var _0x4579cd;return db[_0xe44d('0x15')][_0xe44d('0x31')]({'where':{'id':_0x377ee1[_0xe44d('0x2f')]['id']}})[_0xe44d('0xb')](handleEntityNotFound(_0x26afbe,null))[_0xe44d('0xb')](function(_0x5993d){if(_0x5993d){_0x155b07=_0x5993d;_0x284d83[_0xe44d('0x1b')]=_[_0xe44d('0x19')](db[_0xe44d('0x32')][_0xe44d('0x16')]);_0x284d83[_0xe44d('0x1a')]=_[_0xe44d('0x19')](_0x377ee1[_0xe44d('0x1a')]);_0x284d83[_0xe44d('0x24')]=_[_0xe44d('0x1d')](_0x284d83[_0xe44d('0x1b')],_0x284d83[_0xe44d('0x1a')]);_0x34ead0[_0xe44d('0x1c')]=_['intersection'](_0x284d83[_0xe44d('0x1b')],qs[_0xe44d('0x1e')](_0x377ee1[_0xe44d('0x1a')][_0xe44d('0x1e')]));_0x34ead0['attributes']=_0x34ead0[_0xe44d('0x1c')]['length']?_0x34ead0[_0xe44d('0x1c')]:_0x284d83[_0xe44d('0x1b')];_0x34ead0[_0xe44d('0x21')]=qs['sort'](_0x377ee1[_0xe44d('0x1a')][_0xe44d('0x22')]);_0x34ead0[_0xe44d('0x23')]=qs[_0xe44d('0x24')](_[_0xe44d('0x25')](_0x377ee1['query'],_0x284d83[_0xe44d('0x24')]));if(_0x377ee1[_0xe44d('0x1a')][_0xe44d('0x33')]){_0x34ead0[_0xe44d('0x23')]=_[_0xe44d('0x27')](_0x34ead0[_0xe44d('0x23')],{'$or':_['map'](_0x34ead0['attributes'],function(_0x1427e5){var _0x47e159={};_0x47e159[_0x1427e5]={'$like':'%'+_0x377ee1[_0xe44d('0x1a')][_0xe44d('0x33')]+'%'};return _0x47e159;})});}_0x34ead0=_[_0xe44d('0x27')]({},_0x34ead0,_0x377ee1[_0xe44d('0x34')]);return _0x155b07['getConfigurations'](_0x34ead0);}})[_0xe44d('0xb')](function(_0x4b05aa){if(_0x4b05aa){_0x4579cd=_0x4b05aa[_0xe44d('0x1f')];if(!_0x377ee1[_0xe44d('0x1a')][_0xe44d('0x35')](_0xe44d('0x20'))){_0x34ead0[_0xe44d('0x6')]=qs[_0xe44d('0x6')](_0x377ee1[_0xe44d('0x1a')]['limit']);_0x34ead0['offset']=qs[_0xe44d('0x5')](_0x377ee1[_0xe44d('0x1a')]['offset']);}return _0x155b07['getConfigurations'](_0x34ead0);}})[_0xe44d('0xb')](function(_0x442eb0){if(_0x442eb0){return _0x442eb0?{'count':_0x4579cd,'rows':_0x442eb0}:null;}})[_0xe44d('0xb')](respondWithResult(_0x26afbe,null))[_0xe44d('0x2a')](handleError(_0x26afbe,null));};exports[_0xe44d('0x36')]=function(_0x2f8bfb,_0x32c450){if(_0x2f8bfb[_0xe44d('0x2e')]['id']){delete _0x2f8bfb['body']['id'];}return db[_0xe44d('0x15')][_0xe44d('0x31')]({'where':{'id':_0x2f8bfb[_0xe44d('0x2f')]['id']}})[_0xe44d('0xb')](handleEntityNotFound(_0x32c450,null))['then'](function(_0x3bc8ab){if(_0x3bc8ab){_0x2f8bfb[_0xe44d('0x2e')]['AccountId']=_0x3bc8ab['id'];_0x2f8bfb['body'][_0xe44d('0x37')]=integrations[_0xe44d('0x38')](_0x2f8bfb[_0xe44d('0x2e')]['channel'],_0x2f8bfb[_0xe44d('0x2e')][_0xe44d('0x39')]);_0x2f8bfb[_0xe44d('0x2e')][_0xe44d('0x3a')]=integrations[_0xe44d('0x3b')](_0x2f8bfb['body'][_0xe44d('0x3c')],_0x2f8bfb[_0xe44d('0x2e')]['type']);return db[_0xe44d('0x32')][_0xe44d('0x2d')](_0x2f8bfb[_0xe44d('0x2e')],{'include':[{'model':db[_0xe44d('0x3d')],'as':_0xe44d('0x37')},{'model':db[_0xe44d('0x3d')],'as':_0xe44d('0x3a')}]});}return null;})['then'](respondWithResult(_0x32c450,null))[_0xe44d('0x2a')](handleError(_0x32c450,null));};function sanitizeRemoteUri(_0x596573){var _0x9f7f37=_0x596573[_0xe44d('0x3e')](-0x1);if(_0x9f7f37==='/')return _0x596573[_0xe44d('0x3f')](0x0,_0x596573['lastIndexOf'](_0x9f7f37));return _0x596573;}function getWebApiUrl(_0x264d35){return util[_0xe44d('0x40')](_0xe44d('0x41'),_0x264d35);}exports[_0xe44d('0x42')]=function(_0x37ee94,_0x370d92){var _0x2bf681=_0x37ee94[_0xe44d('0x1a')][_0xe44d('0x43')];var _0x8a153b=_0x2bf681==='incident'?_0xe44d('0x44'):_0xe44d('0x45');var _0x307dfa='';var _0x5dad55='';var _0x2b9722='';var _0x314219='';var _0x51285c='';var _0x591bf8='';var _0x22b02d='';var _0x2b92aa='';var _0x2789d6=[_0xe44d('0x46'),_0xe44d('0x47'),_0xe44d('0x48'),_0xe44d('0x49'),_0xe44d('0x4a'),_0xe44d('0x4b'),'phonenumber',_0xe44d('0x4c'),_0xe44d('0x4d'),_0xe44d('0x4e')];var _0x5c829d=[_0xe44d('0x4f'),_0xe44d('0x50'),'actualserviceunits',_0xe44d('0x51'),_0xe44d('0x52'),'contactidyominame',_0xe44d('0x53'),_0xe44d('0x54'),_0xe44d('0x55'),_0xe44d('0x56'),_0xe44d('0x57'),_0xe44d('0x58'),_0xe44d('0x59'),_0xe44d('0x5a'),_0xe44d('0x5b'),_0xe44d('0x5c'),'customeridtype',_0xe44d('0x5d'),_0xe44d('0x5e'),'entitlementidname',_0xe44d('0x5f'),'entityimage_url','escalatedon',_0xe44d('0x60'),_0xe44d('0x61'),_0xe44d('0x62'),'importsequencenumber',_0xe44d('0x63'),'kbarticleidname',_0xe44d('0x64'),_0xe44d('0x65'),_0xe44d('0x66'),_0xe44d('0x67'),_0xe44d('0x68'),_0xe44d('0x69'),'modifiedon',_0xe44d('0x6a'),_0xe44d('0x6b'),'msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon',_0xe44d('0x6c'),'owneridtype',_0xe44d('0x6d'),_0xe44d('0x6e'),_0xe44d('0x6f'),_0xe44d('0x70'),_0xe44d('0x71'),'productidname','productserialnumber','resolveby','resolvebykpiidname',_0xe44d('0x72'),_0xe44d('0x73'),'responsiblecontactidyominame',_0xe44d('0x74'),_0xe44d('0x75'),_0xe44d('0x76'),'socialprofileidname',_0xe44d('0x77'),_0xe44d('0x78'),'subjectidname',_0xe44d('0x79'),_0xe44d('0x7a'),_0xe44d('0x7b'),'traversedpath','utcconversiontimezonecode',_0xe44d('0x7c')];var _0xbfc67d=_0x2789d6['concat'](_0x5c829d);return db[_0xe44d('0x15')][_0xe44d('0x31')]({'where':{'id':_0x37ee94[_0xe44d('0x2f')]['id']},'attributes':['id','username',_0xe44d('0x7d'),_0xe44d('0x7e'),_0xe44d('0x7f'),_0xe44d('0x80'),'clientSecret',_0xe44d('0x81')],'include':[{'model':db['CloudProvider'],'as':_0xe44d('0x82'),'attributes':['id',_0xe44d('0x83'),'data7']}]})['then'](handleEntityNotFound(_0x370d92,null))['then'](function(_0x3ff58c){if(_0x3ff58c){if(_0x3ff58c[_0xe44d('0x81')]){_0x3ff58c[_0xe44d('0x84')]=_0x3ff58c['CloudProvider'][_0xe44d('0x83')];_0x2b92aa=sanitizeRemoteUri(_0x3ff58c[_0xe44d('0x82')][_0xe44d('0x85')]);_0x22b02d=getWebApiUrl(_0x2b92aa);return _0x3ff58c;}_0x2b92aa=sanitizeRemoteUri(_0x3ff58c['remoteUri']);_0x22b02d=getWebApiUrl(_0x2b92aa);var _0x19b560={'method':_0xe44d('0x86'),'uri':_0xe44d('0x87')+_0x3ff58c[_0xe44d('0x7f')]+_0xe44d('0x88'),'form':{'client_id':_0x3ff58c[_0xe44d('0x80')],'resource':_0x2b92aa,'username':_0x3ff58c['username'],'password':_0x3ff58c[_0xe44d('0x7d')],'grant_type':_0xe44d('0x7d'),'client_secret':_0x3ff58c[_0xe44d('0x89')]},'json':!![]};return rp(_0x19b560);}})[_0xe44d('0xb')](function(_0x43aa74){_0x591bf8=_0x43aa74[_0xe44d('0x84')];var _0x2852d0={'method':_0xe44d('0x8a'),'uri':encodeURI(_0x22b02d+_0xe44d('0x8b')+_0x8a153b+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x591bf8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2852d0);})[_0xe44d('0xb')](function(_0x7826a0){var _0x5d9373=_0x7826a0[_0xe44d('0x8c')][0x0];var _0x4500eb=_0x5d9373[_0xe44d('0x8d')];var _0x3c1985={'method':_0xe44d('0x8a'),'uri':_0x22b02d+_0xe44d('0x8e')+_0x4500eb+_0xe44d('0x8f'),'headers':{'Authorization':_0xe44d('0x90')+_0x591bf8,'If-None-Match':null,'OData-Version':_0xe44d('0x91')},'json':!![]};return rp(_0x3c1985);})[_0xe44d('0xb')](function(_0x3fc3bd){_0x307dfa=_0x3fc3bd;_0x5dad55=_0x307dfa[_0xe44d('0x92')];_0x5dad55=_[_0xe44d('0x93')](_0x5dad55,function(_0x2d30c2){return!_0xbfc67d[_0xe44d('0x94')](_0x2d30c2['LogicalName']);});var _0x3609c8=[];var _0x517a7b=[];_0x5dad55[_0xe44d('0x95')](function(_0x8f6986){if(_0x8f6986[_0xe44d('0x96')]){var _0x18b681=_0x8f6986[_0xe44d('0x96')][_0xe44d('0x3f')](_0x8f6986[_0xe44d('0x96')][_0xe44d('0x97')]('.')+0x1);if(_0x18b681==='PicklistAttributeMetadata'){_0x3609c8[_0xe44d('0x98')](getSelectList(_0x22b02d,_0x2bf681,_0x517a7b,_0x307dfa[_0xe44d('0x8d')],_0x8f6986[_0xe44d('0x8d')],_0x591bf8));}}});return Promise['all'](_0x3609c8);})['then'](function(_0x88dc76){_0x2b9722=_0x88dc76[0x0];var _0x1bdc3f=[];var _0x2fa6e4=[];_0x5dad55[_0xe44d('0x95')](function(_0x299260){if(!_[_0xe44d('0x99')](_0x299260[_0xe44d('0x96')])){var _0x5225a5=_0x299260[_0xe44d('0x96')][_0xe44d('0x3f')](_0x299260[_0xe44d('0x96')]['lastIndexOf']('.')+0x1);if(_0x5225a5==='BooleanAttributeMetadata'){_0x1bdc3f[_0xe44d('0x98')](getBooleanList(_0x22b02d,_0x2bf681,_0x2fa6e4,_0x307dfa[_0xe44d('0x8d')],_0x299260['MetadataId'],_0x591bf8));}}});return Promise[_0xe44d('0x9a')](_0x1bdc3f);})[_0xe44d('0xb')](function(_0xfc63a5){_0x314219=_0xfc63a5[0x0];var _0x2fcec4=[];var _0x386efc=[];_0x5dad55[_0xe44d('0x95')](function(_0x1f1f94){if(_0x1f1f94['@odata.type']){var _0x4d651c=_0x1f1f94[_0xe44d('0x96')]['substring'](_0x1f1f94['@odata.type'][_0xe44d('0x97')]('.')+0x1);if(_0x4d651c===_0xe44d('0x9b')||_0x4d651c===_0xe44d('0x9c')||_0x4d651c===_0xe44d('0x9d')||_0x4d651c===_0xe44d('0x9e')||_0x4d651c===_0xe44d('0x9f')||_0x4d651c==='DateTimeAttributeMetadata'||_0x4d651c===_0xe44d('0xa0')||_0x4d651c===_0xe44d('0xa1')||_0x4d651c===_0xe44d('0xa2')||_0x4d651c===_0xe44d('0xa3')){_0x2fcec4[_0xe44d('0x98')](getInputList(_0x22b02d,_0x2bf681,_0x4d651c,_0x386efc,_0x307dfa[_0xe44d('0x8d')],_0x1f1f94[_0xe44d('0x8d')],_0x591bf8));}}});return Promise[_0xe44d('0x9a')](_0x2fcec4);})[_0xe44d('0xb')](function(_0x5bf584){_0x51285c=_0x5bf584[0x0];var _0x7846d1=_0x2b9722[_0xe44d('0xa4')](_0x314219)[_0xe44d('0xa4')](_0x51285c);var _0x34f947={'count':_0x7846d1[_0xe44d('0x1f')],'rows':_0x7846d1};return _0x34f947;})['then'](respondWithResult(_0x370d92,null))['catch'](function(_0x44cf51){var _0x73e1ce=_0x37ee94['query']['test']?0x1f4:_0x44cf51[_0xe44d('0xa5')]||0x1f4;logger['error'](_0x44cf51['stack']);delete _0x44cf51[_0xe44d('0x18')];if(_0x73e1ce===0x191){_0x73e1ce=0x190;}_0x370d92[_0xe44d('0x11')](_0x73e1ce)[_0xe44d('0x12')](_0x37ee94[_0xe44d('0x1a')]['test']?{'message':_0xe44d('0xa6'),'statusCode':_0x44cf51['statusCode']}:_0x44cf51);});};function getSelectList(_0x3f74f5,_0x2e3e34,_0x6fc59c,_0x5c5712,_0x314f18,_0x316adf){var _0x402809={'method':'GET','uri':_0x3f74f5+_0xe44d('0x8e')+_0x5c5712+')/Attributes('+_0x314f18+_0xe44d('0xa7')+_0xe44d('0xa8'),'headers':{'Authorization':_0xe44d('0x90')+_0x316adf,'If-None-Match':null,'OData-Version':_0xe44d('0x91')},'json':!![]};return rp(_0x402809)[_0xe44d('0xb')](function(_0xe7b4aa){var _0xa75337=[];var _0x1860bf=_0xe7b4aa[_0xe44d('0xa9')]['Options'];_0x1860bf[_0xe44d('0x95')](function(_0x196b15){_0xa75337[_0xe44d('0x98')]({'name':_0x196b15[_0xe44d('0xaa')][_0xe44d('0xab')]['Label'],'value':String(_0x196b15[_0xe44d('0xac')])});});var _0x201d51={'id':_0x2e3e34+'_'+_0xe7b4aa['LogicalName'],'name':_0xe7b4aa[_0xe44d('0xad')][_0xe44d('0xab')]['Label'],'custom':![],'options':_0xa75337};_0x6fc59c[_0xe44d('0x98')](_0x201d51);return _0x6fc59c;});}function getBooleanList(_0x1c473d,_0xbda03f,_0x179da5,_0x4a4b3d,_0x46ec07,_0x588c43){var _0x4b0d77={'method':_0xe44d('0x8a'),'uri':_0x1c473d+'EntityDefinitions('+_0x4a4b3d+_0xe44d('0xae')+_0x46ec07+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x588c43,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b0d77)[_0xe44d('0xb')](function(_0xafffb){var _0x279efc=[];_0x279efc[_0xe44d('0x98')]({'name':_0xafffb[_0xe44d('0xa9')][_0xe44d('0xaf')][_0xe44d('0xaa')]['UserLocalizedLabel'][_0xe44d('0xaa')],'value':_0xe44d('0xb0')},{'name':_0xafffb['OptionSet'][_0xe44d('0xb1')][_0xe44d('0xaa')][_0xe44d('0xab')][_0xe44d('0xaa')],'value':'false'});var _0x3882f0={'id':_0xbda03f+'_'+_0xafffb[_0xe44d('0xb2')],'name':_0xafffb[_0xe44d('0xad')][_0xe44d('0xab')]['Label'],'custom':![],'options':_0x279efc};_0x179da5[_0xe44d('0x98')](_0x3882f0);return _0x179da5;});}function getInputList(_0x2bd64b,_0x14c220,_0x57c1e2,_0xd16905,_0x31ded9,_0x3a3ad8,_0x16ebf9){var _0xfae5f0={'method':_0xe44d('0x8a'),'uri':_0x2bd64b+_0xe44d('0x8e')+_0x31ded9+_0xe44d('0xae')+_0x3a3ad8+_0xe44d('0xb3')+_0x57c1e2+_0xe44d('0xb4'),'headers':{'Authorization':_0xe44d('0x90')+_0x16ebf9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xfae5f0)[_0xe44d('0xb')](function(_0xc6aa28){var _0x44737f={'id':_0x14c220+'_'+_0xc6aa28[_0xe44d('0xb2')],'name':_0xc6aa28[_0xe44d('0xad')][_0xe44d('0xab')]?_0xc6aa28[_0xe44d('0xad')]['UserLocalizedLabel']['Label']:_0xc6aa28[_0xe44d('0xb2')],'custom':![],'options':[]};_0xd16905[_0xe44d('0x98')](_0x44737f);return _0xd16905;});} \ No newline at end of file +var _0x5843=['lastIndexOf','format','%s/api/data/v9.0/','getFields','Incident','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','offset','undefined','limit','status','set','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','Dynamics365Field','substring'];(function(_0x52b914,_0x52bcd3){var _0x21e041=function(_0x379e3a){while(--_0x379e3a){_0x52b914['push'](_0x52b914['shift']());}};_0x21e041(++_0x52bcd3);}(_0x5843,0x74));var _0x3584=function(_0x231f70,_0x6a5f1d){_0x231f70=_0x231f70-0x0;var _0x1ce2cb=_0x5843[_0x231f70];return _0x1ce2cb;};'use strict';var rp=require(_0x3584('0x0'));var util=require('util');var _=require(_0x3584('0x1'));var qs=require(_0x3584('0x2'));var logger=require(_0x3584('0x3'))(_0x3584('0x4'));var db=require(_0x3584('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x6671f,_0x5a8622){_0x5a8622=_0x5a8622||0xc8;return function(_0x3b8a3c){if(_0x3b8a3c){return _0x6671f['status'](_0x5a8622)['json'](_0x3b8a3c);}};}function respondWithFilteredResult(_0xa79ee7,_0x303eac){return function(_0xba1edc){if(_0xba1edc){var _0x3025cf=typeof _0x303eac[_0x3584('0x6')]===_0x3584('0x7')&&typeof _0x303eac['limit']===_0x3584('0x7');var _0x37673d=_0xba1edc['count'];var _0xdfdf39=_0x3025cf?0x0:_0x303eac[_0x3584('0x6')];var _0x333d3e=_0x3025cf?_0xba1edc['count']:_0x303eac[_0x3584('0x6')]+_0x303eac[_0x3584('0x8')];var _0x5714c3;if(_0x333d3e>=_0x37673d){_0x333d3e=_0x37673d;_0x5714c3=0xc8;}else{_0x5714c3=0xce;}_0xa79ee7[_0x3584('0x9')](_0x5714c3);return _0xa79ee7[_0x3584('0xa')]('Content-Range',_0xdfdf39+'-'+_0x333d3e+'/'+_0x37673d)[_0x3584('0xb')](_0xba1edc);}return null;};}function saveUpdates(_0x577576){return function(_0x3ffa24){if(_0x3ffa24){return _0x3ffa24[_0x3584('0xc')](_0x577576)[_0x3584('0xd')](function(_0x10611f){return _0x10611f;});}return null;};}function removeEntity(_0x34b45e){return function(_0x25a1b5){if(_0x25a1b5){return _0x25a1b5[_0x3584('0xe')]()[_0x3584('0xd')](function(){_0x34b45e[_0x3584('0x9')](0xcc)[_0x3584('0xf')]();});}};}function handleEntityNotFound(_0x3f2944){return function(_0x2e62fd){if(!_0x2e62fd){_0x3f2944[_0x3584('0x10')](0x194);}return _0x2e62fd;};}function handleError(_0x1cd803,_0x16f1a5){_0x16f1a5=_0x16f1a5||0x1f4;return function(_0x3ebe90){logger[_0x3584('0x11')](_0x3ebe90[_0x3584('0x12')]);if(_0x3ebe90[_0x3584('0x13')]){delete _0x3ebe90['name'];}_0x1cd803[_0x3584('0x9')](_0x16f1a5)[_0x3584('0x14')](_0x3ebe90);};}exports[_0x3584('0x15')]=function(_0x3b7f8d,_0x348b1a){var _0x5ec2f6={},_0x391d4d={},_0x4d3f4b={'count':0x0,'rows':[]};var _0x5cf047=_[_0x3584('0x16')](db[_0x3584('0x17')][_0x3584('0x18')],function(_0x114cc2){return{'name':_0x114cc2['fieldName'],'type':_0x114cc2['type']['key']};});_0x391d4d[_0x3584('0x19')]=_[_0x3584('0x16')](_0x5cf047,_0x3584('0x13'));_0x391d4d['query']=_['keys'](_0x3b7f8d[_0x3584('0x1a')]);_0x391d4d[_0x3584('0x1b')]=_[_0x3584('0x1c')](_0x391d4d['model'],_0x391d4d[_0x3584('0x1a')]);_0x5ec2f6[_0x3584('0x1d')]=_[_0x3584('0x1c')](_0x391d4d[_0x3584('0x19')],qs['fields'](_0x3b7f8d[_0x3584('0x1a')][_0x3584('0x1e')]));_0x5ec2f6['attributes']=_0x5ec2f6[_0x3584('0x1d')][_0x3584('0x1f')]?_0x5ec2f6[_0x3584('0x1d')]:_0x391d4d[_0x3584('0x19')];if(!_0x3b7f8d[_0x3584('0x1a')][_0x3584('0x20')]('nolimit')){_0x5ec2f6['limit']=qs[_0x3584('0x8')](_0x3b7f8d[_0x3584('0x1a')][_0x3584('0x8')]);_0x5ec2f6[_0x3584('0x6')]=qs[_0x3584('0x6')](_0x3b7f8d[_0x3584('0x1a')]['offset']);}_0x5ec2f6[_0x3584('0x21')]=qs[_0x3584('0x22')](_0x3b7f8d[_0x3584('0x1a')][_0x3584('0x22')]);_0x5ec2f6[_0x3584('0x23')]=qs[_0x3584('0x1b')](_['pick'](_0x3b7f8d[_0x3584('0x1a')],_0x391d4d['filters']),_0x5cf047);if(_0x3b7f8d[_0x3584('0x1a')][_0x3584('0x24')]){_0x5ec2f6['where']=_[_0x3584('0x25')](_0x5ec2f6[_0x3584('0x23')],{'$or':_['map'](_0x5cf047,function(_0x27e671){if(_0x27e671['type']!==_0x3584('0x26')){var _0x22ee83={};_0x22ee83[_0x27e671[_0x3584('0x13')]]={'$like':'%'+_0x3b7f8d[_0x3584('0x1a')]['filter']+'%'};return _0x22ee83;}})});}_0x5ec2f6=_['merge']({},_0x5ec2f6,_0x3b7f8d[_0x3584('0x27')]);var _0x2655ef={'where':_0x5ec2f6[_0x3584('0x23')]};return db[_0x3584('0x17')][_0x3584('0x28')](_0x2655ef)[_0x3584('0xd')](function(_0x2d8de1){_0x4d3f4b[_0x3584('0x28')]=_0x2d8de1;if(_0x3b7f8d['query'][_0x3584('0x29')]){_0x5ec2f6[_0x3584('0x2a')]=[{'all':!![]}];}return db[_0x3584('0x17')][_0x3584('0x2b')](_0x5ec2f6);})[_0x3584('0xd')](function(_0x31d24c){_0x4d3f4b[_0x3584('0x2c')]=_0x31d24c;return _0x4d3f4b;})[_0x3584('0xd')](respondWithFilteredResult(_0x348b1a,_0x5ec2f6))[_0x3584('0x2d')](handleError(_0x348b1a,null));};exports[_0x3584('0x2e')]=function(_0x24a091,_0x4059bf){var _0x397958={'raw':![],'where':{'id':_0x24a091[_0x3584('0x2f')]['id']}},_0x36317d={};_0x36317d['model']=_[_0x3584('0x30')](db['Dynamics365Account'][_0x3584('0x18')]);_0x36317d[_0x3584('0x1a')]=_['keys'](_0x24a091['query']);_0x36317d[_0x3584('0x1b')]=_[_0x3584('0x1c')](_0x36317d[_0x3584('0x19')],_0x36317d[_0x3584('0x1a')]);_0x397958[_0x3584('0x1d')]=_[_0x3584('0x1c')](_0x36317d[_0x3584('0x19')],qs[_0x3584('0x1e')](_0x24a091['query']['fields']));_0x397958[_0x3584('0x1d')]=_0x397958[_0x3584('0x1d')][_0x3584('0x1f')]?_0x397958['attributes']:_0x36317d[_0x3584('0x19')];if(_0x24a091[_0x3584('0x1a')][_0x3584('0x29')]){_0x397958[_0x3584('0x2a')]=[{'all':!![]}];}_0x397958=_[_0x3584('0x25')]({},_0x397958,_0x24a091['options']);return db[_0x3584('0x17')][_0x3584('0x31')](_0x397958)[_0x3584('0xd')](handleEntityNotFound(_0x4059bf,null))['then'](respondWithResult(_0x4059bf,null))[_0x3584('0x2d')](handleError(_0x4059bf,null));};exports[_0x3584('0x32')]=function(_0x341362,_0xb6be5f){return db['Dynamics365Account']['create'](_0x341362[_0x3584('0x33')],{})['then'](respondWithResult(_0xb6be5f,0xc9))[_0x3584('0x2d')](handleError(_0xb6be5f,null));};exports[_0x3584('0xc')]=function(_0x33ed14,_0x3e6a5c){if(_0x33ed14[_0x3584('0x33')]['id']){delete _0x33ed14[_0x3584('0x33')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x33ed14[_0x3584('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3e6a5c,null))[_0x3584('0xd')](saveUpdates(_0x33ed14[_0x3584('0x33')],null))['then'](respondWithResult(_0x3e6a5c,null))[_0x3584('0x2d')](handleError(_0x3e6a5c,null));};exports['destroy']=function(_0x2eb8b8,_0x5d0230){return db['Dynamics365Account'][_0x3584('0x31')]({'where':{'id':_0x2eb8b8[_0x3584('0x2f')]['id']}})[_0x3584('0xd')](handleEntityNotFound(_0x5d0230,null))['then'](removeEntity(_0x5d0230,null))[_0x3584('0x2d')](handleError(_0x5d0230,null));};exports[_0x3584('0x34')]=function(_0x4619f3,_0x256e2d){var _0x5a7223={};var _0x390076={};var _0x269777;var _0x54b68f;return db[_0x3584('0x17')][_0x3584('0x35')]({'where':{'id':_0x4619f3[_0x3584('0x2f')]['id']}})[_0x3584('0xd')](handleEntityNotFound(_0x256e2d,null))['then'](function(_0x74a4d1){if(_0x74a4d1){_0x269777=_0x74a4d1;_0x390076[_0x3584('0x19')]=_['keys'](db[_0x3584('0x36')][_0x3584('0x18')]);_0x390076[_0x3584('0x1a')]=_[_0x3584('0x30')](_0x4619f3[_0x3584('0x1a')]);_0x390076['filters']=_['intersection'](_0x390076['model'],_0x390076[_0x3584('0x1a')]);_0x5a7223[_0x3584('0x1d')]=_['intersection'](_0x390076[_0x3584('0x19')],qs['fields'](_0x4619f3[_0x3584('0x1a')][_0x3584('0x1e')]));_0x5a7223['attributes']=_0x5a7223[_0x3584('0x1d')][_0x3584('0x1f')]?_0x5a7223[_0x3584('0x1d')]:_0x390076[_0x3584('0x19')];_0x5a7223[_0x3584('0x21')]=qs[_0x3584('0x22')](_0x4619f3[_0x3584('0x1a')][_0x3584('0x22')]);_0x5a7223[_0x3584('0x23')]=qs[_0x3584('0x1b')](_['pick'](_0x4619f3['query'],_0x390076[_0x3584('0x1b')]));if(_0x4619f3[_0x3584('0x1a')][_0x3584('0x24')]){_0x5a7223['where']=_[_0x3584('0x25')](_0x5a7223[_0x3584('0x23')],{'$or':_[_0x3584('0x16')](_0x5a7223[_0x3584('0x1d')],function(_0x347850){var _0x42d250={};_0x42d250[_0x347850]={'$like':'%'+_0x4619f3['query']['filter']+'%'};return _0x42d250;})});}_0x5a7223=_[_0x3584('0x25')]({},_0x5a7223,_0x4619f3[_0x3584('0x27')]);return _0x269777[_0x3584('0x34')](_0x5a7223);}})['then'](function(_0x4a42f5){if(_0x4a42f5){_0x54b68f=_0x4a42f5[_0x3584('0x1f')];if(!_0x4619f3['query']['hasOwnProperty'](_0x3584('0x37'))){_0x5a7223[_0x3584('0x8')]=qs[_0x3584('0x8')](_0x4619f3[_0x3584('0x1a')][_0x3584('0x8')]);_0x5a7223[_0x3584('0x6')]=qs[_0x3584('0x6')](_0x4619f3[_0x3584('0x1a')][_0x3584('0x6')]);}return _0x269777[_0x3584('0x34')](_0x5a7223);}})[_0x3584('0xd')](function(_0x36e250){if(_0x36e250){return _0x36e250?{'count':_0x54b68f,'rows':_0x36e250}:null;}})[_0x3584('0xd')](respondWithResult(_0x256e2d,null))[_0x3584('0x2d')](handleError(_0x256e2d,null));};exports[_0x3584('0x38')]=function(_0x155b93,_0x4d760f){if(_0x155b93[_0x3584('0x33')]['id']){delete _0x155b93[_0x3584('0x33')]['id'];}return db[_0x3584('0x17')]['findOne']({'where':{'id':_0x155b93['params']['id']}})[_0x3584('0xd')](handleEntityNotFound(_0x4d760f,null))[_0x3584('0xd')](function(_0x272a6a){if(_0x272a6a){_0x155b93[_0x3584('0x33')]['AccountId']=_0x272a6a['id'];_0x155b93[_0x3584('0x33')][_0x3584('0x39')]=integrations[_0x3584('0x3a')](_0x155b93[_0x3584('0x33')][_0x3584('0x3b')],_0x155b93[_0x3584('0x33')][_0x3584('0x3c')]);_0x155b93[_0x3584('0x33')][_0x3584('0x3d')]=integrations[_0x3584('0x3e')](_0x155b93[_0x3584('0x33')][_0x3584('0x3b')],_0x155b93[_0x3584('0x33')][_0x3584('0x3c')]);return db['Dynamics365Configuration'][_0x3584('0x32')](_0x155b93[_0x3584('0x33')],{'include':[{'model':db[_0x3584('0x3f')],'as':_0x3584('0x39')},{'model':db[_0x3584('0x3f')],'as':_0x3584('0x3d')}]});}return null;})[_0x3584('0xd')](respondWithResult(_0x4d760f,null))[_0x3584('0x2d')](handleError(_0x4d760f,null));};function sanitizeRemoteUri(_0x4e0288){var _0x1b583b=_0x4e0288['slice'](-0x1);if(_0x1b583b==='/')return _0x4e0288[_0x3584('0x40')](0x0,_0x4e0288[_0x3584('0x41')](_0x1b583b));return _0x4e0288;}function getWebApiUrl(_0x1d4024){return util[_0x3584('0x42')](_0x3584('0x43'),_0x1d4024);}exports[_0x3584('0x44')]=function(_0x86698c,_0x467081){var _0x8ffd54=_0x86698c[_0x3584('0x1a')]['ticketType'];var _0x57bd67=_0x8ffd54==='incident'?_0x3584('0x45'):'PhoneCall';var _0x1e3822='';var _0x3b8741='';var _0x2781f2='';var _0x255c1f='';var _0x1a33a6='';var _0x1cb16c='';var _0x29ce85='';var _0x5ef293='';var _0x5299b0=[_0x3584('0x46'),_0x3584('0x47'),_0x3584('0x48'),'ownerid',_0x3584('0x49'),_0x3584('0x4a'),_0x3584('0x4b'),_0x3584('0x4c'),'directioncode',_0x3584('0x4d')];var _0x463c77=[_0x3584('0x4e'),_0x3584('0x4f'),_0x3584('0x50'),_0x3584('0x51'),'contactidname','contactidyominame',_0x3584('0x52'),_0x3584('0x53'),_0x3584('0x54'),_0x3584('0x55'),_0x3584('0x56'),'createdbyyominame',_0x3584('0x57'),_0x3584('0x58'),_0x3584('0x59'),_0x3584('0x5a'),'customeridtype','customeridyominame',_0x3584('0x5b'),_0x3584('0x5c'),_0x3584('0x5d'),_0x3584('0x5e'),_0x3584('0x5f'),_0x3584('0x60'),_0x3584('0x61'),_0x3584('0x62'),_0x3584('0x63'),_0x3584('0x64'),'kbarticleidname',_0x3584('0x65'),_0x3584('0x66'),_0x3584('0x67'),_0x3584('0x68'),_0x3584('0x69'),'modifiedbyyominame','modifiedon',_0x3584('0x6a'),_0x3584('0x6b'),'msdyn_incidenttypename','msdyn_iotalertname',_0x3584('0x6c'),_0x3584('0x6d'),_0x3584('0x6e'),_0x3584('0x6f'),_0x3584('0x70'),'owneridyominame','parentcaseidname',_0x3584('0x71'),'primarycontactidyominame',_0x3584('0x72'),'productidname',_0x3584('0x73'),'resolveby',_0x3584('0x74'),_0x3584('0x75'),_0x3584('0x76'),_0x3584('0x77'),_0x3584('0x78'),'slainvokedidname','slaname',_0x3584('0x79'),_0x3584('0x7a'),_0x3584('0x7b'),_0x3584('0x7c'),_0x3584('0x7d'),_0x3584('0x7e'),_0x3584('0x7f'),_0x3584('0x80'),_0x3584('0x81'),_0x3584('0x82')];var _0x44745f=_0x5299b0[_0x3584('0x83')](_0x463c77);return db[_0x3584('0x17')][_0x3584('0x35')]({'where':{'id':_0x86698c[_0x3584('0x2f')]['id']},'attributes':['id',_0x3584('0x84'),_0x3584('0x85'),'remoteUri',_0x3584('0x86'),_0x3584('0x87'),_0x3584('0x88'),_0x3584('0x89')],'include':[{'model':db[_0x3584('0x8a')],'as':'CloudProvider','attributes':['id',_0x3584('0x8b'),_0x3584('0x8c')]}]})['then'](handleEntityNotFound(_0x467081,null))['then'](function(_0x4fc07c){if(_0x4fc07c){if(_0x4fc07c[_0x3584('0x89')]){_0x4fc07c[_0x3584('0x8d')]=_0x4fc07c[_0x3584('0x8a')][_0x3584('0x8b')];_0x5ef293=sanitizeRemoteUri(_0x4fc07c['CloudProvider'][_0x3584('0x8c')]);_0x29ce85=getWebApiUrl(_0x5ef293);return _0x4fc07c;}_0x5ef293=sanitizeRemoteUri(_0x4fc07c['remoteUri']);_0x29ce85=getWebApiUrl(_0x5ef293);var _0x6479a9={'method':_0x3584('0x8e'),'uri':_0x3584('0x8f')+_0x4fc07c[_0x3584('0x86')]+'/oauth2/token','form':{'client_id':_0x4fc07c['clientId'],'resource':_0x5ef293,'username':_0x4fc07c[_0x3584('0x84')],'password':_0x4fc07c['password'],'grant_type':_0x3584('0x85'),'client_secret':_0x4fc07c['clientSecret']},'json':!![]};return rp(_0x6479a9);}})[_0x3584('0xd')](function(_0xb6b1c4){_0x1cb16c=_0xb6b1c4[_0x3584('0x8d')];var _0x39ed1b={'method':_0x3584('0x90'),'uri':encodeURI(_0x29ce85+_0x3584('0x91')+_0x57bd67+'\x27'),'headers':{'Authorization':_0x3584('0x92')+_0x1cb16c,'If-None-Match':null,'OData-Version':_0x3584('0x93')},'json':!![]};return rp(_0x39ed1b);})[_0x3584('0xd')](function(_0x5279ca){var _0x27dfa4=_0x5279ca['value'][0x0];var _0x44260d=_0x27dfa4[_0x3584('0x94')];var _0x58893c={'method':_0x3584('0x90'),'uri':_0x29ce85+_0x3584('0x95')+_0x44260d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3584('0x92')+_0x1cb16c,'If-None-Match':null,'OData-Version':_0x3584('0x93')},'json':!![]};return rp(_0x58893c);})[_0x3584('0xd')](function(_0xed0fda){_0x1e3822=_0xed0fda;_0x3b8741=_0x1e3822['Attributes'];_0x3b8741=_[_0x3584('0x96')](_0x3b8741,function(_0x1bcf77){return!_0x44745f[_0x3584('0x97')](_0x1bcf77[_0x3584('0x98')]);});var _0x766112=[];var _0x5c4165=[];_0x3b8741[_0x3584('0x99')](function(_0x2b9ed8){if(_0x2b9ed8[_0x3584('0x9a')]){var _0x5880c7=_0x2b9ed8[_0x3584('0x9a')][_0x3584('0x40')](_0x2b9ed8['@odata.type'][_0x3584('0x41')]('.')+0x1);if(_0x5880c7===_0x3584('0x9b')){_0x766112[_0x3584('0x9c')](getSelectList(_0x29ce85,_0x8ffd54,_0x5c4165,_0x1e3822[_0x3584('0x94')],_0x2b9ed8[_0x3584('0x94')],_0x1cb16c));}}});return Promise[_0x3584('0x9d')](_0x766112);})[_0x3584('0xd')](function(_0x5dca77){_0x2781f2=_0x5dca77[0x0];var _0x4cad9b=[];var _0xdb12e6=[];_0x3b8741[_0x3584('0x99')](function(_0x2af4cc){if(!_[_0x3584('0x9e')](_0x2af4cc[_0x3584('0x9a')])){var _0x3adbe6=_0x2af4cc[_0x3584('0x9a')]['substring'](_0x2af4cc[_0x3584('0x9a')]['lastIndexOf']('.')+0x1);if(_0x3adbe6===_0x3584('0x9f')){_0x4cad9b[_0x3584('0x9c')](getBooleanList(_0x29ce85,_0x8ffd54,_0xdb12e6,_0x1e3822[_0x3584('0x94')],_0x2af4cc[_0x3584('0x94')],_0x1cb16c));}}});return Promise[_0x3584('0x9d')](_0x4cad9b);})['then'](function(_0x4f32bb){_0x255c1f=_0x4f32bb[0x0];var _0x49ef65=[];var _0x1a1bc0=[];_0x3b8741[_0x3584('0x99')](function(_0x3d0d60){if(_0x3d0d60['@odata.type']){var _0x1a837b=_0x3d0d60[_0x3584('0x9a')][_0x3584('0x40')](_0x3d0d60[_0x3584('0x9a')]['lastIndexOf']('.')+0x1);if(_0x1a837b===_0x3584('0xa0')||_0x1a837b===_0x3584('0xa1')||_0x1a837b==='BigIntAttributeMetadata'||_0x1a837b===_0x3584('0xa2')||_0x1a837b===_0x3584('0xa3')||_0x1a837b==='DateTimeAttributeMetadata'||_0x1a837b===_0x3584('0xa4')||_0x1a837b==='EntityNameAttributeMetadata'||_0x1a837b==='StateAttributeMetadata'||_0x1a837b===_0x3584('0xa5')){_0x49ef65['push'](getInputList(_0x29ce85,_0x8ffd54,_0x1a837b,_0x1a1bc0,_0x1e3822[_0x3584('0x94')],_0x3d0d60[_0x3584('0x94')],_0x1cb16c));}}});return Promise['all'](_0x49ef65);})[_0x3584('0xd')](function(_0x447c95){_0x1a33a6=_0x447c95[0x0];var _0x10eb2c=_0x2781f2[_0x3584('0x83')](_0x255c1f)['concat'](_0x1a33a6);var _0x4c257c={'count':_0x10eb2c['length'],'rows':_0x10eb2c};return _0x4c257c;})[_0x3584('0xd')](respondWithResult(_0x467081,null))[_0x3584('0x2d')](function(_0x229442){var _0x43eb90=_0x86698c['query']['test']?0x1f4:_0x229442['statusCode']||0x1f4;logger[_0x3584('0x11')](_0x229442['stack']);delete _0x229442[_0x3584('0x13')];if(_0x43eb90===0x191){_0x43eb90=0x190;}_0x467081['status'](_0x43eb90)[_0x3584('0x14')](_0x86698c[_0x3584('0x1a')]['test']?{'message':_0x3584('0xa6'),'statusCode':_0x229442[_0x3584('0xa7')]}:_0x229442);});};function getSelectList(_0x58416b,_0x554a91,_0x2ad923,_0x3035d3,_0x1ddcb0,_0x28edb7){var _0x34daee={'method':_0x3584('0x90'),'uri':_0x58416b+_0x3584('0x95')+_0x3035d3+_0x3584('0xa8')+_0x1ddcb0+_0x3584('0xa9')+_0x3584('0xaa'),'headers':{'Authorization':_0x3584('0x92')+_0x28edb7,'If-None-Match':null,'OData-Version':_0x3584('0x93')},'json':!![]};return rp(_0x34daee)[_0x3584('0xd')](function(_0x32ecc3){var _0x1debd1=[];var _0x5a6722=_0x32ecc3[_0x3584('0xab')]['Options'];_0x5a6722[_0x3584('0x99')](function(_0x1f4ede){_0x1debd1[_0x3584('0x9c')]({'name':_0x1f4ede[_0x3584('0xac')][_0x3584('0xad')]['Label'],'value':String(_0x1f4ede[_0x3584('0xae')])});});var _0x1af9b9={'id':_0x554a91+'_'+_0x32ecc3[_0x3584('0x98')],'name':_0x32ecc3[_0x3584('0xaf')][_0x3584('0xad')][_0x3584('0xac')],'custom':![],'options':_0x1debd1};_0x2ad923['push'](_0x1af9b9);return _0x2ad923;});}function getBooleanList(_0x48a7e5,_0x316391,_0x406f4c,_0x262665,_0x22a733,_0x49afdf){var _0x2eb058={'method':_0x3584('0x90'),'uri':_0x48a7e5+_0x3584('0x95')+_0x262665+_0x3584('0xa8')+_0x22a733+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x3584('0x92')+_0x49afdf,'If-None-Match':null,'OData-Version':_0x3584('0x93')},'json':!![]};return rp(_0x2eb058)['then'](function(_0x526846){var _0x4ad253=[];_0x4ad253[_0x3584('0x9c')]({'name':_0x526846['OptionSet'][_0x3584('0xb0')][_0x3584('0xac')][_0x3584('0xad')][_0x3584('0xac')],'value':_0x3584('0xb1')},{'name':_0x526846[_0x3584('0xab')][_0x3584('0xb2')][_0x3584('0xac')][_0x3584('0xad')]['Label'],'value':_0x3584('0xb3')});var _0x3d924f={'id':_0x316391+'_'+_0x526846[_0x3584('0x98')],'name':_0x526846[_0x3584('0xaf')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4ad253};_0x406f4c[_0x3584('0x9c')](_0x3d924f);return _0x406f4c;});}function getInputList(_0xca394d,_0xda249a,_0x2d6ec3,_0x45f32d,_0x21f0d6,_0x5b5193,_0x1c7a1b){var _0xb1c980={'method':_0x3584('0x90'),'uri':_0xca394d+_0x3584('0x95')+_0x21f0d6+_0x3584('0xa8')+_0x5b5193+')/Microsoft.Dynamics.CRM.'+_0x2d6ec3+_0x3584('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x1c7a1b,'If-None-Match':null,'OData-Version':_0x3584('0x93')},'json':!![]};return rp(_0xb1c980)[_0x3584('0xd')](function(_0x3e00d3){var _0x5b84d9={'id':_0xda249a+'_'+_0x3e00d3[_0x3584('0x98')],'name':_0x3e00d3[_0x3584('0xaf')]['UserLocalizedLabel']?_0x3e00d3[_0x3584('0xaf')][_0x3584('0xad')][_0x3584('0xac')]:_0x3e00d3[_0x3584('0x98')],'custom':![],'options':[]};_0x45f32d[_0x3584('0x9c')](_0x5b84d9);return _0x45f32d;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 1195e1a..286be12 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x36ad66,_0x3daec0){var _0x17d89e=function(_0x2fd1bf){while(--_0x2fd1bf){_0x36ad66['push'](_0x36ad66['shift']());}};_0x17d89e(++_0x3daec0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x2b0bc2,_0x4331f5){var _0x56e5b9=function(_0x4c1b06){while(--_0x4c1b06){_0x2b0bc2['push'](_0x2b0bc2['shift']());}};_0x56e5b9(++_0x4331f5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 1ba506f..83dfda7 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 _0xb47d=['GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','map','include','model','catch','ShowDynamics365Account','where','debug','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x424c98,_0x3a12d1){var _0x470d95=function(_0x29f7e1){while(--_0x29f7e1){_0x424c98['push'](_0x424c98['shift']());}};_0x470d95(++_0x3a12d1);}(_0xb47d,0x162));var _0xdb47=function(_0x40ffc4,_0x3d3e37){_0x40ffc4=_0x40ffc4-0x0;var _0xff9c15=_0xb47d[_0x40ffc4];return _0xff9c15;};'use strict';var _=require(_0xdb47('0x0'));var util=require(_0xdb47('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdb47('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb47('0x3'))['db'];var utils=require(_0xdb47('0x4'));var logger=require(_0xdb47('0x5'))(_0xdb47('0x6'));var config=require(_0xdb47('0x7'));var jayson=require(_0xdb47('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ee616,_0x441096,_0x31adb0){return new BPromise(function(_0x8fe4a1,_0x19a7c9){return client[_0xdb47('0x9')](_0x3ee616,_0x31adb0)[_0xdb47('0xa')](function(_0x2d2cff){logger[_0xdb47('0xb')](_0xdb47('0xc'),_0x441096,_0xdb47('0xd'));logger['debug'](_0xdb47('0xe'),_0x441096,'request\x20sent',JSON[_0xdb47('0xf')](_0x2d2cff));if(_0x2d2cff[_0xdb47('0x10')]){if(_0x2d2cff[_0xdb47('0x10')][_0xdb47('0x11')]===0x1f4){logger[_0xdb47('0x10')](_0xdb47('0xc'),_0x441096,_0x2d2cff[_0xdb47('0x10')]['message']);return _0x19a7c9(_0x2d2cff[_0xdb47('0x10')]['message']);}logger[_0xdb47('0x10')](_0xdb47('0xc'),_0x441096,_0x2d2cff[_0xdb47('0x10')][_0xdb47('0x12')]);return _0x8fe4a1(_0x2d2cff[_0xdb47('0x10')][_0xdb47('0x12')]);}else{logger['info'](_0xdb47('0xc'),_0x441096,_0xdb47('0xd'));_0x8fe4a1(_0x2d2cff[_0xdb47('0x13')][_0xdb47('0x12')]);}})['catch'](function(_0x2ae1a5){logger[_0xdb47('0x10')](_0xdb47('0xc'),_0x441096,_0x2ae1a5);_0x19a7c9(_0x2ae1a5);});});}exports[_0xdb47('0x14')]=function(_0x517cf2){var _0x212c21=this;return new Promise(function(_0x53cc4e,_0x2f07e7){return db[_0xdb47('0x15')][_0xdb47('0x16')]({'raw':_0x517cf2['options']?_0x517cf2[_0xdb47('0x17')][_0xdb47('0x18')]===undefined?!![]:![]:!![],'where':_0x517cf2[_0xdb47('0x17')]?_0x517cf2['options']['where']||null:null,'attributes':_0x517cf2[_0xdb47('0x17')]?_0x517cf2[_0xdb47('0x17')][_0xdb47('0x19')]||null:null,'limit':_0x517cf2[_0xdb47('0x17')]?_0x517cf2[_0xdb47('0x17')][_0xdb47('0x1a')]||null:null,'include':_0x517cf2[_0xdb47('0x17')]?_0x517cf2[_0xdb47('0x17')]['include']?_[_0xdb47('0x1b')](_0x517cf2[_0xdb47('0x17')][_0xdb47('0x1c')],function(_0x1b6a93){return{'model':db[_0x1b6a93[_0xdb47('0x1d')]],'as':_0x1b6a93['as'],'attributes':_0x1b6a93[_0xdb47('0x19')],'include':_0x1b6a93[_0xdb47('0x1c')]?_[_0xdb47('0x1b')](_0x1b6a93['include'],function(_0x13532f){return{'model':db[_0x13532f[_0xdb47('0x1d')]],'as':_0x13532f['as'],'attributes':_0x13532f[_0xdb47('0x19')],'include':_0x13532f[_0xdb47('0x1c')]?_[_0xdb47('0x1b')](_0x13532f['include'],function(_0x18945a){return{'model':db[_0x18945a[_0xdb47('0x1d')]],'as':_0x18945a['as'],'attributes':_0x18945a['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb47('0xa')](function(_0x4ff150){logger[_0xdb47('0xb')](_0xdb47('0x14'),_0x517cf2);logger['debug'](_0xdb47('0x14'),_0x517cf2,JSON[_0xdb47('0xf')](_0x4ff150));_0x53cc4e(_0x4ff150);})[_0xdb47('0x1e')](function(_0x2a92ac){logger[_0xdb47('0x10')](_0xdb47('0x14'),_0x2a92ac[_0xdb47('0x12')],_0x517cf2);_0x2f07e7(_0x212c21['error'](0x1f4,_0x2a92ac[_0xdb47('0x12')]));});});};exports[_0xdb47('0x1f')]=function(_0x58b740){var _0x13d2d9=this;return new Promise(function(_0x396de8,_0x59f021){return db[_0xdb47('0x15')]['find']({'raw':_0x58b740[_0xdb47('0x17')]?_0x58b740[_0xdb47('0x17')][_0xdb47('0x18')]===undefined?!![]:![]:!![],'where':_0x58b740['options']?_0x58b740['options'][_0xdb47('0x20')]||null:null,'attributes':_0x58b740[_0xdb47('0x17')]?_0x58b740[_0xdb47('0x17')]['attributes']||null:null,'include':_0x58b740[_0xdb47('0x17')]?_0x58b740[_0xdb47('0x17')][_0xdb47('0x1c')]?_[_0xdb47('0x1b')](_0x58b740['options']['include'],function(_0x5c49c4){return{'model':db[_0x5c49c4[_0xdb47('0x1d')]],'as':_0x5c49c4['as'],'attributes':_0x5c49c4['attributes'],'include':_0x5c49c4[_0xdb47('0x1c')]?_['map'](_0x5c49c4[_0xdb47('0x1c')],function(_0x34b5f1){return{'model':db[_0x34b5f1[_0xdb47('0x1d')]],'as':_0x34b5f1['as'],'attributes':_0x34b5f1[_0xdb47('0x19')],'include':_0x34b5f1[_0xdb47('0x1c')]?_['map'](_0x34b5f1[_0xdb47('0x1c')],function(_0x14ffb4){return{'model':db[_0x14ffb4[_0xdb47('0x1d')]],'as':_0x14ffb4['as'],'attributes':_0x14ffb4['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb47('0xa')](function(_0x22cbb8){logger[_0xdb47('0xb')](_0xdb47('0x1f'),_0x58b740);logger[_0xdb47('0x21')](_0xdb47('0x1f'),_0x58b740,JSON[_0xdb47('0xf')](_0x22cbb8));_0x396de8(_0x22cbb8);})[_0xdb47('0x1e')](function(_0x3dec40){logger['error'](_0xdb47('0x1f'),_0x3dec40[_0xdb47('0x12')],_0x58b740);_0x59f021(_0x13d2d9[_0xdb47('0x10')](0x1f4,_0x3dec40[_0xdb47('0x12')]));});});}; \ No newline at end of file +var _0xc9c1=['where','attributes','limit','include','map','model','info','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw'];(function(_0x5a38e9,_0x2cb2fd){var _0x320217=function(_0x5e5d11){while(--_0x5e5d11){_0x5a38e9['push'](_0x5a38e9['shift']());}};_0x320217(++_0x2cb2fd);}(_0xc9c1,0x120));var _0x1c9c=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xc9c1[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x1c9c('0x0'));var util=require(_0x1c9c('0x1'));var moment=require(_0x1c9c('0x2'));var BPromise=require(_0x1c9c('0x3'));var rs=require(_0x1c9c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c9c('0x6'))(_0x1c9c('0x7'));var config=require(_0x1c9c('0x8'));var jayson=require(_0x1c9c('0x9'));var client=jayson[_0x1c9c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x136e4b,_0x367235,_0x141ea6){return new BPromise(function(_0x340879,_0x3a8ecb){return client[_0x1c9c('0xb')](_0x136e4b,_0x141ea6)[_0x1c9c('0xc')](function(_0x590321){logger['info'](_0x1c9c('0xd'),_0x367235,'request\x20sent');logger[_0x1c9c('0xe')](_0x1c9c('0xf'),_0x367235,'request\x20sent',JSON[_0x1c9c('0x10')](_0x590321));if(_0x590321[_0x1c9c('0x11')]){if(_0x590321[_0x1c9c('0x11')][_0x1c9c('0x12')]===0x1f4){logger[_0x1c9c('0x11')](_0x1c9c('0xd'),_0x367235,_0x590321[_0x1c9c('0x11')][_0x1c9c('0x13')]);return _0x3a8ecb(_0x590321[_0x1c9c('0x11')]['message']);}logger[_0x1c9c('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x367235,_0x590321['error'][_0x1c9c('0x13')]);return _0x340879(_0x590321[_0x1c9c('0x11')][_0x1c9c('0x13')]);}else{logger['info'](_0x1c9c('0xd'),_0x367235,'request\x20sent');_0x340879(_0x590321[_0x1c9c('0x14')][_0x1c9c('0x13')]);}})[_0x1c9c('0x15')](function(_0x21970f){logger['error'](_0x1c9c('0xd'),_0x367235,_0x21970f);_0x3a8ecb(_0x21970f);});});}exports[_0x1c9c('0x16')]=function(_0x1b764d){var _0x549c20=this;return new Promise(function(_0x342d60,_0xd4d17a){return db[_0x1c9c('0x17')][_0x1c9c('0x18')]({'raw':_0x1b764d[_0x1c9c('0x19')]?_0x1b764d[_0x1c9c('0x19')][_0x1c9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b764d[_0x1c9c('0x19')]?_0x1b764d[_0x1c9c('0x19')][_0x1c9c('0x1b')]||null:null,'attributes':_0x1b764d[_0x1c9c('0x19')]?_0x1b764d[_0x1c9c('0x19')][_0x1c9c('0x1c')]||null:null,'limit':_0x1b764d[_0x1c9c('0x19')]?_0x1b764d[_0x1c9c('0x19')][_0x1c9c('0x1d')]||null:null,'include':_0x1b764d[_0x1c9c('0x19')]?_0x1b764d[_0x1c9c('0x19')][_0x1c9c('0x1e')]?_[_0x1c9c('0x1f')](_0x1b764d['options'][_0x1c9c('0x1e')],function(_0x1eb218){return{'model':db[_0x1eb218[_0x1c9c('0x20')]],'as':_0x1eb218['as'],'attributes':_0x1eb218[_0x1c9c('0x1c')],'include':_0x1eb218[_0x1c9c('0x1e')]?_[_0x1c9c('0x1f')](_0x1eb218[_0x1c9c('0x1e')],function(_0x13c01){return{'model':db[_0x13c01['model']],'as':_0x13c01['as'],'attributes':_0x13c01['attributes'],'include':_0x13c01[_0x1c9c('0x1e')]?_['map'](_0x13c01[_0x1c9c('0x1e')],function(_0x403f64){return{'model':db[_0x403f64['model']],'as':_0x403f64['as'],'attributes':_0x403f64[_0x1c9c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1c9c('0xc')](function(_0x1c1980){logger[_0x1c9c('0x21')](_0x1c9c('0x16'),_0x1b764d);logger[_0x1c9c('0xe')](_0x1c9c('0x16'),_0x1b764d,JSON[_0x1c9c('0x10')](_0x1c1980));_0x342d60(_0x1c1980);})[_0x1c9c('0x15')](function(_0x5be83b){logger['error'](_0x1c9c('0x16'),_0x5be83b[_0x1c9c('0x13')],_0x1b764d);_0xd4d17a(_0x549c20[_0x1c9c('0x11')](0x1f4,_0x5be83b[_0x1c9c('0x13')]));});});};exports[_0x1c9c('0x22')]=function(_0x200f8a){var _0x5188f5=this;return new Promise(function(_0x308674,_0x541685){return db['Dynamics365Account']['find']({'raw':_0x200f8a[_0x1c9c('0x19')]?_0x200f8a[_0x1c9c('0x19')][_0x1c9c('0x1a')]===undefined?!![]:![]:!![],'where':_0x200f8a[_0x1c9c('0x19')]?_0x200f8a[_0x1c9c('0x19')][_0x1c9c('0x1b')]||null:null,'attributes':_0x200f8a[_0x1c9c('0x19')]?_0x200f8a['options'][_0x1c9c('0x1c')]||null:null,'include':_0x200f8a[_0x1c9c('0x19')]?_0x200f8a[_0x1c9c('0x19')][_0x1c9c('0x1e')]?_[_0x1c9c('0x1f')](_0x200f8a['options'][_0x1c9c('0x1e')],function(_0x44b1f9){return{'model':db[_0x44b1f9[_0x1c9c('0x20')]],'as':_0x44b1f9['as'],'attributes':_0x44b1f9[_0x1c9c('0x1c')],'include':_0x44b1f9[_0x1c9c('0x1e')]?_[_0x1c9c('0x1f')](_0x44b1f9[_0x1c9c('0x1e')],function(_0x20dd25){return{'model':db[_0x20dd25[_0x1c9c('0x20')]],'as':_0x20dd25['as'],'attributes':_0x20dd25[_0x1c9c('0x1c')],'include':_0x20dd25['include']?_['map'](_0x20dd25['include'],function(_0x4f702a){return{'model':db[_0x4f702a['model']],'as':_0x4f702a['as'],'attributes':_0x4f702a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c9c('0xc')](function(_0x527bff){logger[_0x1c9c('0x21')](_0x1c9c('0x22'),_0x200f8a);logger[_0x1c9c('0xe')]('ShowDynamics365Account',_0x200f8a,JSON[_0x1c9c('0x10')](_0x527bff));_0x308674(_0x527bff);})[_0x1c9c('0x15')](function(_0x23d760){logger[_0x1c9c('0x11')](_0x1c9c('0x22'),_0x23d760['message'],_0x200f8a);_0x541685(_0x5188f5['error'](0x1f4,_0x23d760[_0x1c9c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6315a75..cea33b5 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 _0x3436=['path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','getFields','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','util'];(function(_0x11141a,_0x669621){var _0x1c08c5=function(_0xc19bad){while(--_0xc19bad){_0x11141a['push'](_0x11141a['shift']());}};_0x1c08c5(++_0x669621);}(_0x3436,0x131));var _0x6343=function(_0x21b4a5,_0x57baa6){_0x21b4a5=_0x21b4a5-0x0;var _0x166cd4=_0x3436[_0x21b4a5];return _0x166cd4;};'use strict';var multer=require('multer');var util=require(_0x6343('0x0'));var path=require(_0x6343('0x1'));var timeout=require(_0x6343('0x2'));var express=require(_0x6343('0x3'));var router=express['Router']();var fs_extra=require(_0x6343('0x4'));var auth=require(_0x6343('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x6343('0x6')]('/',auth[_0x6343('0x7')](),controller['index']);router[_0x6343('0x6')](_0x6343('0x8'),auth[_0x6343('0x7')](),controller[_0x6343('0x9')]);router[_0x6343('0x6')]('/:id/fields',auth[_0x6343('0x7')](),controller[_0x6343('0xa')]);router['get']('/:id/subjects',auth[_0x6343('0x7')](),controller['getSubjects']);router[_0x6343('0x6')](_0x6343('0xb'),auth[_0x6343('0x7')](),controller[_0x6343('0xc')]);router['post']('/',auth[_0x6343('0x7')](),controller[_0x6343('0xd')]);router[_0x6343('0xe')]('/:id',auth[_0x6343('0x7')](),controller[_0x6343('0xf')]);router['delete']('/:id',auth[_0x6343('0x7')](),controller[_0x6343('0x10')]);module[_0x6343('0x11')]=router; \ No newline at end of file +var _0x70e3=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update'];(function(_0x55e295,_0x48dc82){var _0x1df1a0=function(_0x1b7951){while(--_0x1b7951){_0x55e295['push'](_0x55e295['shift']());}};_0x1df1a0(++_0x48dc82);}(_0x70e3,0x9d));var _0x370e=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x70e3[_0x19b84f];return _0x18067b;};'use strict';var multer=require(_0x370e('0x0'));var util=require(_0x370e('0x1'));var path=require(_0x370e('0x2'));var timeout=require(_0x370e('0x3'));var express=require('express');var router=express[_0x370e('0x4')]();var fs_extra=require(_0x370e('0x5'));var auth=require(_0x370e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x370e('0x7'));var controller=require(_0x370e('0x8'));router[_0x370e('0x9')]('/',auth[_0x370e('0xa')](),controller['index']);router[_0x370e('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x370e('0x9')]('/:id/fields',auth[_0x370e('0xa')](),controller['getFields']);router[_0x370e('0x9')](_0x370e('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x370e('0x9')](_0x370e('0xc'),auth[_0x370e('0xa')](),controller[_0x370e('0xd')]);router[_0x370e('0xe')]('/',auth['isAuthenticated'](),controller[_0x370e('0xf')]);router[_0x370e('0x10')](_0x370e('0x11'),auth[_0x370e('0xa')](),controller[_0x370e('0x12')]);router[_0x370e('0x13')](_0x370e('0x11'),auth[_0x370e('0xa')](),controller[_0x370e('0x14')]);module[_0x370e('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 e07ac3e..425949f 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 _0xd8c0=['BOOLEAN','exports','STRING','phonecall','incident','nothing'];(function(_0x568f96,_0x32d489){var _0x5a053a=function(_0x5570ce){while(--_0x5570ce){_0x568f96['push'](_0x568f96['shift']());}};_0x5a053a(++_0x32d489);}(_0xd8c0,0x6d));var _0x0d8c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8c0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x0d8c('0x0')]={'name':{'type':Sequelize[_0x0d8c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM']('incident',_0x0d8c('0x2')),'defaultValue':_0x0d8c('0x3')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x0d8c('0x4')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0d8c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0d8c('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3cc1=['phonecall','contact','nothing','sequelize','exports','STRING','ENUM','incident'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3cc1,0xd3));var _0x13cc=function(_0x4ca6f3,_0x33fc1c){_0x4ca6f3=_0x4ca6f3-0x0;var _0x167ae5=_0x3cc1[_0x4ca6f3];return _0x167ae5;};'use strict';var Sequelize=require(_0x13cc('0x0'));module[_0x13cc('0x1')]={'name':{'type':Sequelize[_0x13cc('0x2')]},'description':{'type':Sequelize[_0x13cc('0x2')]},'ticketType':{'type':Sequelize[_0x13cc('0x3')](_0x13cc('0x4'),_0x13cc('0x5')),'defaultValue':_0x13cc('0x4')},'moduleCreate':{'type':Sequelize[_0x13cc('0x3')](_0x13cc('0x6'),_0x13cc('0x7')),'defaultValue':_0x13cc('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 1b29f17..9be4ae1 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 _0x76d1=['../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','error','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body','params','destroy','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x7967be,_0x34e4e0){var _0x1873e3=function(_0xcf98e4){while(--_0xcf98e4){_0x7967be['push'](_0x7967be['shift']());}};_0x1873e3(++_0x34e4e0);}(_0x76d1,0x8b));var _0x176d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x76d1[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x176d('0x0'));var rimraf=require(_0x176d('0x1'));var zipdir=require(_0x176d('0x2'));var jsonpatch=require(_0x176d('0x3'));var rp=require(_0x176d('0x4'));var moment=require(_0x176d('0x5'));var BPromise=require(_0x176d('0x6'));var Mustache=require(_0x176d('0x7'));var util=require(_0x176d('0x8'));var path=require(_0x176d('0x9'));var sox=require('sox');var csv=require(_0x176d('0xa'));var ejs=require(_0x176d('0xb'));var fs=require('fs');var fs_extra=require(_0x176d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x176d('0xd'));var deskjs=require(_0x176d('0xe'));var toCsv=require(_0x176d('0xa'));var querystring=require('querystring');var Papa=require(_0x176d('0xf'));var Redis=require(_0x176d('0x10'));var authService=require(_0x176d('0x11'));var qs=require(_0x176d('0x12'));var as=require(_0x176d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x176d('0x14'));var utils=require(_0x176d('0x15'));var config=require(_0x176d('0x16'));var licenseUtil=require(_0x176d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275b99,_0x3f9486){_0x3f9486=_0x3f9486||0xcc;return function(_0x4b94b5){if(_0x4b94b5){return _0x275b99[_0x176d('0x18')](_0x3f9486);}return _0x275b99[_0x176d('0x19')](_0x3f9486)[_0x176d('0x1a')]();};}function respondWithResult(_0x4ed562,_0x4bf39f){_0x4bf39f=_0x4bf39f||0xc8;return function(_0x298f40){if(_0x298f40){return _0x4ed562[_0x176d('0x19')](_0x4bf39f)[_0x176d('0x1b')](_0x298f40);}};}function respondWithFilteredResult(_0x2f5271,_0x530d1e){return function(_0x24d465){if(_0x24d465){var _0x34e963=typeof _0x530d1e['offset']===_0x176d('0x1c')&&typeof _0x530d1e[_0x176d('0x1d')]==='undefined';var _0x21ae51=_0x24d465[_0x176d('0x1e')];var _0xa79062=_0x34e963?0x0:_0x530d1e[_0x176d('0x1f')];var _0x3a1d8e=_0x34e963?_0x24d465[_0x176d('0x1e')]:_0x530d1e[_0x176d('0x1f')]+_0x530d1e[_0x176d('0x1d')];var _0x1629cb;if(_0x3a1d8e>=_0x21ae51){_0x3a1d8e=_0x21ae51;_0x1629cb=0xc8;}else{_0x1629cb=0xce;}_0x2f5271[_0x176d('0x19')](_0x1629cb);return _0x2f5271[_0x176d('0x20')]('Content-Range',_0xa79062+'-'+_0x3a1d8e+'/'+_0x21ae51)[_0x176d('0x1b')](_0x24d465);}return null;};}function patchUpdates(_0x93ac34){return function(_0x554417){try{jsonpatch[_0x176d('0x21')](_0x554417,_0x93ac34,!![]);}catch(_0x457c6c){return BPromise[_0x176d('0x22')](_0x457c6c);}return _0x554417['save']();};}function saveUpdates(_0x1bfec1,_0x19ce9a){return function(_0x551556){if(_0x551556){return _0x551556[_0x176d('0x23')](_0x1bfec1)['then'](function(_0x118b3c){return _0x118b3c;});}return null;};}function removeEntity(_0x3feefa,_0x5c2645){return function(_0x30d201){if(_0x30d201){return _0x30d201['destroy']()[_0x176d('0x24')](function(){_0x3feefa['status'](0xcc)[_0x176d('0x1a')]();});}};}function handleEntityNotFound(_0x1e149f,_0x967f25){return function(_0x31fcb6){if(!_0x31fcb6){_0x1e149f[_0x176d('0x18')](0x194);}return _0x31fcb6;};}function handleError(_0x3faf75,_0x413b85){_0x413b85=_0x413b85||0x1f4;return function(_0x202744){logger[_0x176d('0x25')](_0x202744['stack']);if(_0x202744[_0x176d('0x26')]){delete _0x202744[_0x176d('0x26')];}_0x3faf75['status'](_0x413b85)[_0x176d('0x27')](_0x202744);};}exports[_0x176d('0x28')]=function(_0x1e3949,_0x2ddb1b){var _0x470dfb={},_0x548c47={},_0x34131c={'count':0x0,'rows':[]};var _0x43a21d=_[_0x176d('0x29')](db['Dynamics365Configuration']['rawAttributes'],function(_0x787fd1){return{'name':_0x787fd1[_0x176d('0x2a')],'type':_0x787fd1[_0x176d('0x2b')][_0x176d('0x2c')]};});_0x548c47[_0x176d('0x2d')]=_[_0x176d('0x29')](_0x43a21d,_0x176d('0x26'));_0x548c47[_0x176d('0x2e')]=_[_0x176d('0x2f')](_0x1e3949[_0x176d('0x2e')]);_0x548c47['filters']=_[_0x176d('0x30')](_0x548c47[_0x176d('0x2d')],_0x548c47[_0x176d('0x2e')]);_0x470dfb[_0x176d('0x31')]=_[_0x176d('0x30')](_0x548c47[_0x176d('0x2d')],qs['fields'](_0x1e3949[_0x176d('0x2e')][_0x176d('0x32')]));_0x470dfb[_0x176d('0x31')]=_0x470dfb[_0x176d('0x31')][_0x176d('0x33')]?_0x470dfb['attributes']:_0x548c47['model'];if(!_0x1e3949[_0x176d('0x2e')][_0x176d('0x34')]('nolimit')){_0x470dfb[_0x176d('0x1d')]=qs['limit'](_0x1e3949[_0x176d('0x2e')]['limit']);_0x470dfb['offset']=qs[_0x176d('0x1f')](_0x1e3949[_0x176d('0x2e')]['offset']);}_0x470dfb[_0x176d('0x35')]=qs[_0x176d('0x36')](_0x1e3949['query'][_0x176d('0x36')]);_0x470dfb[_0x176d('0x37')]=qs[_0x176d('0x38')](_[_0x176d('0x39')](_0x1e3949[_0x176d('0x2e')],_0x548c47[_0x176d('0x38')]),_0x43a21d);if(_0x1e3949[_0x176d('0x2e')][_0x176d('0x3a')]){_0x470dfb[_0x176d('0x37')]=_[_0x176d('0x3b')](_0x470dfb[_0x176d('0x37')],{'$or':_['map'](_0x43a21d,function(_0x5da7a6){if(_0x5da7a6[_0x176d('0x2b')]!==_0x176d('0x3c')){var _0x3b0106={};_0x3b0106[_0x5da7a6[_0x176d('0x26')]]={'$like':'%'+_0x1e3949['query'][_0x176d('0x3a')]+'%'};return _0x3b0106;}})});}_0x470dfb=_[_0x176d('0x3b')]({},_0x470dfb,_0x1e3949[_0x176d('0x3d')]);var _0x42583e={'where':_0x470dfb[_0x176d('0x37')]};return db[_0x176d('0x3e')][_0x176d('0x1e')](_0x42583e)['then'](function(_0x1b8f9d){_0x34131c['count']=_0x1b8f9d;if(_0x1e3949['query']['includeAll']){_0x470dfb[_0x176d('0x3f')]=[{'all':!![]}];}return db[_0x176d('0x3e')][_0x176d('0x40')](_0x470dfb);})[_0x176d('0x24')](function(_0x184f78){_0x34131c[_0x176d('0x41')]=_0x184f78;return _0x34131c;})[_0x176d('0x24')](respondWithFilteredResult(_0x2ddb1b,_0x470dfb))[_0x176d('0x42')](handleError(_0x2ddb1b,null));};exports[_0x176d('0x43')]=function(_0x15477c,_0x3f4f1f){var _0xc95241={'raw':![],'where':{'id':_0x15477c['params']['id']}},_0x18d764={};_0x18d764['model']=_[_0x176d('0x2f')](db[_0x176d('0x3e')][_0x176d('0x44')]);_0x18d764[_0x176d('0x2e')]=_['keys'](_0x15477c[_0x176d('0x2e')]);_0x18d764[_0x176d('0x38')]=_['intersection'](_0x18d764[_0x176d('0x2d')],_0x18d764['query']);_0xc95241[_0x176d('0x31')]=_[_0x176d('0x30')](_0x18d764[_0x176d('0x2d')],qs[_0x176d('0x32')](_0x15477c['query'][_0x176d('0x32')]));_0xc95241[_0x176d('0x31')]=_0xc95241[_0x176d('0x31')][_0x176d('0x33')]?_0xc95241[_0x176d('0x31')]:_0x18d764[_0x176d('0x2d')];if(_0x15477c[_0x176d('0x2e')][_0x176d('0x45')]){_0xc95241[_0x176d('0x3f')]=[{'all':!![]}];}_0xc95241=_[_0x176d('0x3b')]({},_0xc95241,_0x15477c[_0x176d('0x3d')]);return db[_0x176d('0x3e')]['find'](_0xc95241)[_0x176d('0x24')](handleEntityNotFound(_0x3f4f1f,null))['then'](respondWithResult(_0x3f4f1f,null))['catch'](handleError(_0x3f4f1f,null));};exports[_0x176d('0x46')]=function(_0x13d267,_0x2233f5){return db['Dynamics365Configuration']['create'](_0x13d267[_0x176d('0x47')],{})[_0x176d('0x24')](respondWithResult(_0x2233f5,0xc9))['catch'](handleError(_0x2233f5,null));};exports[_0x176d('0x23')]=function(_0x4c608c,_0x581923){if(_0x4c608c[_0x176d('0x47')]['id']){delete _0x4c608c['body']['id'];}return db[_0x176d('0x3e')]['find']({'where':{'id':_0x4c608c[_0x176d('0x48')]['id']}})['then'](handleEntityNotFound(_0x581923,null))['then'](saveUpdates(_0x4c608c[_0x176d('0x47')],null))[_0x176d('0x24')](respondWithResult(_0x581923,null))[_0x176d('0x42')](handleError(_0x581923,null));};exports[_0x176d('0x49')]=function(_0x1806d1,_0x54187d){return db[_0x176d('0x3e')]['find']({'where':{'id':_0x1806d1['params']['id']}})['then'](handleEntityNotFound(_0x54187d,null))[_0x176d('0x24')](removeEntity(_0x54187d,null))['catch'](handleError(_0x54187d,null));};exports['getFields']=function(_0x119727,_0x19b77b,_0x57d1ef){var _0x21e8df={};var _0x4af9ac={};var _0x36adfc;var _0x39bf4a;return db[_0x176d('0x3e')][_0x176d('0x4a')]({'where':{'id':_0x119727[_0x176d('0x48')]['id']}})[_0x176d('0x24')](handleEntityNotFound(_0x19b77b,null))[_0x176d('0x24')](function(_0x5b83f2){if(_0x5b83f2){_0x36adfc=_0x5b83f2;_0x4af9ac['model']=_[_0x176d('0x2f')](db[_0x176d('0x4b')][_0x176d('0x44')]);_0x4af9ac[_0x176d('0x2e')]=_['keys'](_0x119727[_0x176d('0x2e')]);_0x4af9ac[_0x176d('0x38')]=_[_0x176d('0x30')](_0x4af9ac['model'],_0x4af9ac[_0x176d('0x2e')]);_0x21e8df[_0x176d('0x31')]=_[_0x176d('0x30')](_0x4af9ac[_0x176d('0x2d')],qs['fields'](_0x119727[_0x176d('0x2e')][_0x176d('0x32')]));_0x21e8df[_0x176d('0x31')]=_0x21e8df[_0x176d('0x31')][_0x176d('0x33')]?_0x21e8df[_0x176d('0x31')]:_0x4af9ac[_0x176d('0x2d')];_0x21e8df[_0x176d('0x35')]=qs[_0x176d('0x36')](_0x119727['query'][_0x176d('0x36')]);_0x21e8df['where']=qs[_0x176d('0x38')](_[_0x176d('0x39')](_0x119727[_0x176d('0x2e')],_0x4af9ac[_0x176d('0x38')]));if(_0x119727['query'][_0x176d('0x3a')]){_0x21e8df[_0x176d('0x37')]=_[_0x176d('0x3b')](_0x21e8df[_0x176d('0x37')],{'$or':_[_0x176d('0x29')](_0x21e8df[_0x176d('0x31')],function(_0x2c7ca3){var _0x3f60ed={};_0x3f60ed[_0x2c7ca3]={'$like':'%'+_0x119727['query'][_0x176d('0x3a')]+'%'};return _0x3f60ed;})});}_0x21e8df=_['merge']({},_0x21e8df,_0x119727['options']);return _0x36adfc['getFields'](_0x21e8df);}})['then'](function(_0x328803){if(_0x328803){_0x39bf4a=_0x328803[_0x176d('0x33')];if(!_0x119727[_0x176d('0x2e')][_0x176d('0x34')](_0x176d('0x4c'))){_0x21e8df['limit']=qs[_0x176d('0x1d')](_0x119727[_0x176d('0x2e')][_0x176d('0x1d')]);_0x21e8df[_0x176d('0x1f')]=qs[_0x176d('0x1f')](_0x119727['query'][_0x176d('0x1f')]);}return _0x36adfc['getFields'](_0x21e8df);}})[_0x176d('0x24')](function(_0x5c1ec9){if(_0x5c1ec9){return _0x5c1ec9?{'count':_0x39bf4a,'rows':_0x5c1ec9}:null;}})['then'](respondWithResult(_0x19b77b,null))[_0x176d('0x42')](handleError(_0x19b77b,null));};exports['getSubjects']=function(_0x58d6c9,_0x312581,_0x2ae17a){var _0x28588c={};var _0x46c745={};var _0x410903;var _0x3d3a1b;return db[_0x176d('0x3e')]['findOne']({'where':{'id':_0x58d6c9[_0x176d('0x48')]['id']}})['then'](handleEntityNotFound(_0x312581,null))['then'](function(_0x2ebf0e){if(_0x2ebf0e){_0x410903=_0x2ebf0e;_0x46c745[_0x176d('0x2d')]=_[_0x176d('0x2f')](db[_0x176d('0x4b')][_0x176d('0x44')]);_0x46c745[_0x176d('0x2e')]=_[_0x176d('0x2f')](_0x58d6c9[_0x176d('0x2e')]);_0x46c745[_0x176d('0x38')]=_['intersection'](_0x46c745[_0x176d('0x2d')],_0x46c745[_0x176d('0x2e')]);_0x28588c[_0x176d('0x31')]=_[_0x176d('0x30')](_0x46c745['model'],qs[_0x176d('0x32')](_0x58d6c9[_0x176d('0x2e')]['fields']));_0x28588c['attributes']=_0x28588c[_0x176d('0x31')]['length']?_0x28588c[_0x176d('0x31')]:_0x46c745[_0x176d('0x2d')];_0x28588c[_0x176d('0x35')]=qs['sort'](_0x58d6c9[_0x176d('0x2e')][_0x176d('0x36')]);_0x28588c[_0x176d('0x37')]=qs[_0x176d('0x38')](_[_0x176d('0x39')](_0x58d6c9[_0x176d('0x2e')],_0x46c745['filters']));if(_0x58d6c9[_0x176d('0x2e')][_0x176d('0x3a')]){_0x28588c[_0x176d('0x37')]=_[_0x176d('0x3b')](_0x28588c[_0x176d('0x37')],{'$or':_[_0x176d('0x29')](_0x28588c[_0x176d('0x31')],function(_0x4480d0){var _0x5c7c20={};_0x5c7c20[_0x4480d0]={'$like':'%'+_0x58d6c9[_0x176d('0x2e')]['filter']+'%'};return _0x5c7c20;})});}_0x28588c=_[_0x176d('0x3b')]({},_0x28588c,_0x58d6c9[_0x176d('0x3d')]);return _0x410903[_0x176d('0x4d')](_0x28588c);}})[_0x176d('0x24')](function(_0xdfead3){if(_0xdfead3){_0x3d3a1b=_0xdfead3[_0x176d('0x33')];if(!_0x58d6c9[_0x176d('0x2e')][_0x176d('0x34')](_0x176d('0x4c'))){_0x28588c[_0x176d('0x1d')]=qs[_0x176d('0x1d')](_0x58d6c9[_0x176d('0x2e')]['limit']);_0x28588c[_0x176d('0x1f')]=qs['offset'](_0x58d6c9[_0x176d('0x2e')]['offset']);}return _0x410903[_0x176d('0x4d')](_0x28588c);}})['then'](function(_0x3d633a){if(_0x3d633a){return _0x3d633a?{'count':_0x3d3a1b,'rows':_0x3d633a}:null;}})[_0x176d('0x24')](respondWithResult(_0x312581,null))[_0x176d('0x42')](handleError(_0x312581,null));};exports[_0x176d('0x4e')]=function(_0x5baa75,_0x460151,_0x453b21){var _0x7eea88={};var _0x52fc4b={};var _0x23a3fc;var _0x323592;return db[_0x176d('0x3e')][_0x176d('0x4a')]({'where':{'id':_0x5baa75[_0x176d('0x48')]['id']}})[_0x176d('0x24')](handleEntityNotFound(_0x460151,null))[_0x176d('0x24')](function(_0x5841f6){if(_0x5841f6){_0x23a3fc=_0x5841f6;_0x52fc4b[_0x176d('0x2d')]=_[_0x176d('0x2f')](db['Dynamics365Field'][_0x176d('0x44')]);_0x52fc4b[_0x176d('0x2e')]=_[_0x176d('0x2f')](_0x5baa75[_0x176d('0x2e')]);_0x52fc4b[_0x176d('0x38')]=_['intersection'](_0x52fc4b[_0x176d('0x2d')],_0x52fc4b[_0x176d('0x2e')]);_0x7eea88[_0x176d('0x31')]=_[_0x176d('0x30')](_0x52fc4b[_0x176d('0x2d')],qs[_0x176d('0x32')](_0x5baa75[_0x176d('0x2e')][_0x176d('0x32')]));_0x7eea88[_0x176d('0x31')]=_0x7eea88[_0x176d('0x31')][_0x176d('0x33')]?_0x7eea88['attributes']:_0x52fc4b[_0x176d('0x2d')];_0x7eea88['order']=qs['sort'](_0x5baa75[_0x176d('0x2e')][_0x176d('0x36')]);_0x7eea88['where']=qs['filters'](_['pick'](_0x5baa75[_0x176d('0x2e')],_0x52fc4b[_0x176d('0x38')]));if(_0x5baa75['query'][_0x176d('0x3a')]){_0x7eea88['where']=_[_0x176d('0x3b')](_0x7eea88['where'],{'$or':_[_0x176d('0x29')](_0x7eea88[_0x176d('0x31')],function(_0x3458ce){var _0x3e6cfe={};_0x3e6cfe[_0x3458ce]={'$like':'%'+_0x5baa75['query']['filter']+'%'};return _0x3e6cfe;})});}_0x7eea88=_[_0x176d('0x3b')]({},_0x7eea88,_0x5baa75[_0x176d('0x3d')]);return _0x23a3fc[_0x176d('0x4e')](_0x7eea88);}})[_0x176d('0x24')](function(_0x3cd9c9){if(_0x3cd9c9){_0x323592=_0x3cd9c9[_0x176d('0x33')];if(!_0x5baa75[_0x176d('0x2e')][_0x176d('0x34')]('nolimit')){_0x7eea88[_0x176d('0x1d')]=qs[_0x176d('0x1d')](_0x5baa75[_0x176d('0x2e')][_0x176d('0x1d')]);_0x7eea88[_0x176d('0x1f')]=qs[_0x176d('0x1f')](_0x5baa75[_0x176d('0x2e')][_0x176d('0x1f')]);}return _0x23a3fc[_0x176d('0x4e')](_0x7eea88);}})[_0x176d('0x24')](function(_0xde0571){if(_0xde0571){return _0xde0571?{'count':_0x323592,'rows':_0xde0571}:null;}})[_0x176d('0x24')](respondWithResult(_0x460151,null))[_0x176d('0x42')](handleError(_0x460151,null));}; \ No newline at end of file +var _0xf466=['filter','where','VIRTUAL','merge','options','count','include','Dynamics365Configuration','findAll','show','params','keys','rawAttributes','includeAll','find','catch','create','body','getFields','findOne','getSubjects','Dynamics365Field','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0x5dec9e,_0x2edb79){var _0x501b46=function(_0x558adc){while(--_0x558adc){_0x5dec9e['push'](_0x5dec9e['shift']());}};_0x501b46(++_0x2edb79);}(_0xf466,0x1eb));var _0x6f46=function(_0x66b7e5,_0x2c0406){_0x66b7e5=_0x66b7e5-0x0;var _0x1ad502=_0xf466[_0x66b7e5];return _0x1ad502;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f46('0x0'));var zipdir=require(_0x6f46('0x1'));var jsonpatch=require(_0x6f46('0x2'));var rp=require('request-promise');var moment=require(_0x6f46('0x3'));var BPromise=require(_0x6f46('0x4'));var Mustache=require(_0x6f46('0x5'));var util=require('util');var path=require(_0x6f46('0x6'));var sox=require(_0x6f46('0x7'));var csv=require(_0x6f46('0x8'));var ejs=require(_0x6f46('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f46('0xa'));var squel=require(_0x6f46('0xb'));var crypto=require(_0x6f46('0xc'));var jsforce=require(_0x6f46('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6f46('0x8'));var querystring=require(_0x6f46('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f46('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f46('0x10'));var hardwareService=require(_0x6f46('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6f46('0x12'));var config=require(_0x6f46('0x13'));var licenseUtil=require(_0x6f46('0x14'));var db=require(_0x6f46('0x15'))['db'];function respondWithStatusCode(_0x14e4a5,_0x165044){_0x165044=_0x165044||0xcc;return function(_0x2f9fa9){if(_0x2f9fa9){return _0x14e4a5[_0x6f46('0x16')](_0x165044);}return _0x14e4a5[_0x6f46('0x17')](_0x165044)[_0x6f46('0x18')]();};}function respondWithResult(_0x56c874,_0x10422b){_0x10422b=_0x10422b||0xc8;return function(_0x19c69e){if(_0x19c69e){return _0x56c874[_0x6f46('0x17')](_0x10422b)['json'](_0x19c69e);}};}function respondWithFilteredResult(_0x4c5518,_0x530bdb){return function(_0xd13be8){if(_0xd13be8){var _0x4fba2d=typeof _0x530bdb[_0x6f46('0x19')]===_0x6f46('0x1a')&&typeof _0x530bdb[_0x6f46('0x1b')]===_0x6f46('0x1a');var _0x5d66e7=_0xd13be8['count'];var _0x1fb101=_0x4fba2d?0x0:_0x530bdb[_0x6f46('0x19')];var _0x421354=_0x4fba2d?_0xd13be8['count']:_0x530bdb[_0x6f46('0x19')]+_0x530bdb['limit'];var _0x5c141e;if(_0x421354>=_0x5d66e7){_0x421354=_0x5d66e7;_0x5c141e=0xc8;}else{_0x5c141e=0xce;}_0x4c5518[_0x6f46('0x17')](_0x5c141e);return _0x4c5518[_0x6f46('0x1c')](_0x6f46('0x1d'),_0x1fb101+'-'+_0x421354+'/'+_0x5d66e7)['json'](_0xd13be8);}return null;};}function patchUpdates(_0x1eccda){return function(_0x5b0f6c){try{jsonpatch[_0x6f46('0x1e')](_0x5b0f6c,_0x1eccda,!![]);}catch(_0x3c1b9c){return BPromise[_0x6f46('0x1f')](_0x3c1b9c);}return _0x5b0f6c[_0x6f46('0x20')]();};}function saveUpdates(_0x103404,_0x12b19e){return function(_0x4a98f9){if(_0x4a98f9){return _0x4a98f9[_0x6f46('0x21')](_0x103404)[_0x6f46('0x22')](function(_0x544ce5){return _0x544ce5;});}return null;};}function removeEntity(_0x4a8e00,_0x11e1c0){return function(_0x117e5b){if(_0x117e5b){return _0x117e5b[_0x6f46('0x23')]()[_0x6f46('0x22')](function(){_0x4a8e00[_0x6f46('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5be765,_0x4ca781){return function(_0x4fcd1a){if(!_0x4fcd1a){_0x5be765[_0x6f46('0x16')](0x194);}return _0x4fcd1a;};}function handleError(_0x34707b,_0x4ba085){_0x4ba085=_0x4ba085||0x1f4;return function(_0x282d2b){logger['error'](_0x282d2b[_0x6f46('0x24')]);if(_0x282d2b[_0x6f46('0x25')]){delete _0x282d2b[_0x6f46('0x25')];}_0x34707b['status'](_0x4ba085)[_0x6f46('0x26')](_0x282d2b);};}exports[_0x6f46('0x27')]=function(_0x2d7d34,_0x278b78){var _0x4b5cd4={},_0x8ac1ea={},_0x55086e={'count':0x0,'rows':[]};var _0xf3f4cd=_['map'](db['Dynamics365Configuration']['rawAttributes'],function(_0x3ce18a){return{'name':_0x3ce18a[_0x6f46('0x28')],'type':_0x3ce18a[_0x6f46('0x29')]['key']};});_0x8ac1ea[_0x6f46('0x2a')]=_[_0x6f46('0x2b')](_0xf3f4cd,_0x6f46('0x25'));_0x8ac1ea['query']=_['keys'](_0x2d7d34[_0x6f46('0x2c')]);_0x8ac1ea['filters']=_[_0x6f46('0x2d')](_0x8ac1ea['model'],_0x8ac1ea[_0x6f46('0x2c')]);_0x4b5cd4[_0x6f46('0x2e')]=_[_0x6f46('0x2d')](_0x8ac1ea[_0x6f46('0x2a')],qs[_0x6f46('0x2f')](_0x2d7d34[_0x6f46('0x2c')][_0x6f46('0x2f')]));_0x4b5cd4['attributes']=_0x4b5cd4[_0x6f46('0x2e')][_0x6f46('0x30')]?_0x4b5cd4[_0x6f46('0x2e')]:_0x8ac1ea[_0x6f46('0x2a')];if(!_0x2d7d34[_0x6f46('0x2c')][_0x6f46('0x31')](_0x6f46('0x32'))){_0x4b5cd4['limit']=qs[_0x6f46('0x1b')](_0x2d7d34[_0x6f46('0x2c')][_0x6f46('0x1b')]);_0x4b5cd4[_0x6f46('0x19')]=qs['offset'](_0x2d7d34['query'][_0x6f46('0x19')]);}_0x4b5cd4[_0x6f46('0x33')]=qs[_0x6f46('0x34')](_0x2d7d34[_0x6f46('0x2c')][_0x6f46('0x34')]);_0x4b5cd4['where']=qs[_0x6f46('0x35')](_[_0x6f46('0x36')](_0x2d7d34['query'],_0x8ac1ea[_0x6f46('0x35')]),_0xf3f4cd);if(_0x2d7d34['query'][_0x6f46('0x37')]){_0x4b5cd4[_0x6f46('0x38')]=_['merge'](_0x4b5cd4[_0x6f46('0x38')],{'$or':_[_0x6f46('0x2b')](_0xf3f4cd,function(_0x2d9585){if(_0x2d9585[_0x6f46('0x29')]!==_0x6f46('0x39')){var _0x48a612={};_0x48a612[_0x2d9585[_0x6f46('0x25')]]={'$like':'%'+_0x2d7d34['query'][_0x6f46('0x37')]+'%'};return _0x48a612;}})});}_0x4b5cd4=_[_0x6f46('0x3a')]({},_0x4b5cd4,_0x2d7d34[_0x6f46('0x3b')]);var _0x1086aa={'where':_0x4b5cd4[_0x6f46('0x38')]};return db['Dynamics365Configuration'][_0x6f46('0x3c')](_0x1086aa)[_0x6f46('0x22')](function(_0x115fbb){_0x55086e[_0x6f46('0x3c')]=_0x115fbb;if(_0x2d7d34[_0x6f46('0x2c')]['includeAll']){_0x4b5cd4[_0x6f46('0x3d')]=[{'all':!![]}];}return db[_0x6f46('0x3e')][_0x6f46('0x3f')](_0x4b5cd4);})[_0x6f46('0x22')](function(_0x54a607){_0x55086e['rows']=_0x54a607;return _0x55086e;})[_0x6f46('0x22')](respondWithFilteredResult(_0x278b78,_0x4b5cd4))['catch'](handleError(_0x278b78,null));};exports[_0x6f46('0x40')]=function(_0x2779f7,_0x55cb1f){var _0x376e76={'raw':![],'where':{'id':_0x2779f7[_0x6f46('0x41')]['id']}},_0x14bfd6={};_0x14bfd6[_0x6f46('0x2a')]=_[_0x6f46('0x42')](db[_0x6f46('0x3e')][_0x6f46('0x43')]);_0x14bfd6[_0x6f46('0x2c')]=_[_0x6f46('0x42')](_0x2779f7[_0x6f46('0x2c')]);_0x14bfd6[_0x6f46('0x35')]=_[_0x6f46('0x2d')](_0x14bfd6[_0x6f46('0x2a')],_0x14bfd6[_0x6f46('0x2c')]);_0x376e76[_0x6f46('0x2e')]=_[_0x6f46('0x2d')](_0x14bfd6[_0x6f46('0x2a')],qs[_0x6f46('0x2f')](_0x2779f7['query'][_0x6f46('0x2f')]));_0x376e76[_0x6f46('0x2e')]=_0x376e76[_0x6f46('0x2e')][_0x6f46('0x30')]?_0x376e76[_0x6f46('0x2e')]:_0x14bfd6[_0x6f46('0x2a')];if(_0x2779f7[_0x6f46('0x2c')][_0x6f46('0x44')]){_0x376e76[_0x6f46('0x3d')]=[{'all':!![]}];}_0x376e76=_[_0x6f46('0x3a')]({},_0x376e76,_0x2779f7['options']);return db[_0x6f46('0x3e')][_0x6f46('0x45')](_0x376e76)['then'](handleEntityNotFound(_0x55cb1f,null))['then'](respondWithResult(_0x55cb1f,null))[_0x6f46('0x46')](handleError(_0x55cb1f,null));};exports[_0x6f46('0x47')]=function(_0x4b9062,_0x316450){return db[_0x6f46('0x3e')][_0x6f46('0x47')](_0x4b9062[_0x6f46('0x48')],{})[_0x6f46('0x22')](respondWithResult(_0x316450,0xc9))['catch'](handleError(_0x316450,null));};exports[_0x6f46('0x21')]=function(_0x17485f,_0x144a45){if(_0x17485f['body']['id']){delete _0x17485f['body']['id'];}return db['Dynamics365Configuration'][_0x6f46('0x45')]({'where':{'id':_0x17485f[_0x6f46('0x41')]['id']}})[_0x6f46('0x22')](handleEntityNotFound(_0x144a45,null))[_0x6f46('0x22')](saveUpdates(_0x17485f[_0x6f46('0x48')],null))[_0x6f46('0x22')](respondWithResult(_0x144a45,null))['catch'](handleError(_0x144a45,null));};exports['destroy']=function(_0x43ddd6,_0x292ce5){return db[_0x6f46('0x3e')][_0x6f46('0x45')]({'where':{'id':_0x43ddd6[_0x6f46('0x41')]['id']}})['then'](handleEntityNotFound(_0x292ce5,null))[_0x6f46('0x22')](removeEntity(_0x292ce5,null))[_0x6f46('0x46')](handleError(_0x292ce5,null));};exports[_0x6f46('0x49')]=function(_0x518805,_0x9874d6,_0x4d7e8c){var _0x17ad43={};var _0x281e29={};var _0x39ac16;var _0x393cd6;return db[_0x6f46('0x3e')][_0x6f46('0x4a')]({'where':{'id':_0x518805[_0x6f46('0x41')]['id']}})['then'](handleEntityNotFound(_0x9874d6,null))[_0x6f46('0x22')](function(_0x28f2e3){if(_0x28f2e3){_0x39ac16=_0x28f2e3;_0x281e29['model']=_[_0x6f46('0x42')](db['Dynamics365Field']['rawAttributes']);_0x281e29[_0x6f46('0x2c')]=_[_0x6f46('0x42')](_0x518805[_0x6f46('0x2c')]);_0x281e29['filters']=_[_0x6f46('0x2d')](_0x281e29[_0x6f46('0x2a')],_0x281e29[_0x6f46('0x2c')]);_0x17ad43['attributes']=_['intersection'](_0x281e29[_0x6f46('0x2a')],qs['fields'](_0x518805[_0x6f46('0x2c')][_0x6f46('0x2f')]));_0x17ad43[_0x6f46('0x2e')]=_0x17ad43[_0x6f46('0x2e')][_0x6f46('0x30')]?_0x17ad43['attributes']:_0x281e29[_0x6f46('0x2a')];_0x17ad43[_0x6f46('0x33')]=qs[_0x6f46('0x34')](_0x518805[_0x6f46('0x2c')][_0x6f46('0x34')]);_0x17ad43[_0x6f46('0x38')]=qs[_0x6f46('0x35')](_['pick'](_0x518805['query'],_0x281e29[_0x6f46('0x35')]));if(_0x518805[_0x6f46('0x2c')][_0x6f46('0x37')]){_0x17ad43['where']=_['merge'](_0x17ad43[_0x6f46('0x38')],{'$or':_[_0x6f46('0x2b')](_0x17ad43[_0x6f46('0x2e')],function(_0x390251){var _0x36a499={};_0x36a499[_0x390251]={'$like':'%'+_0x518805[_0x6f46('0x2c')][_0x6f46('0x37')]+'%'};return _0x36a499;})});}_0x17ad43=_[_0x6f46('0x3a')]({},_0x17ad43,_0x518805['options']);return _0x39ac16[_0x6f46('0x49')](_0x17ad43);}})[_0x6f46('0x22')](function(_0x19674d){if(_0x19674d){_0x393cd6=_0x19674d[_0x6f46('0x30')];if(!_0x518805[_0x6f46('0x2c')]['hasOwnProperty'](_0x6f46('0x32'))){_0x17ad43['limit']=qs[_0x6f46('0x1b')](_0x518805[_0x6f46('0x2c')]['limit']);_0x17ad43['offset']=qs[_0x6f46('0x19')](_0x518805[_0x6f46('0x2c')][_0x6f46('0x19')]);}return _0x39ac16[_0x6f46('0x49')](_0x17ad43);}})[_0x6f46('0x22')](function(_0x16ff33){if(_0x16ff33){return _0x16ff33?{'count':_0x393cd6,'rows':_0x16ff33}:null;}})['then'](respondWithResult(_0x9874d6,null))['catch'](handleError(_0x9874d6,null));};exports[_0x6f46('0x4b')]=function(_0x186b0a,_0x31acdb,_0x268344){var _0x3a3ed3={};var _0x4f79b1={};var _0x4b11c0;var _0x5c728f;return db[_0x6f46('0x3e')][_0x6f46('0x4a')]({'where':{'id':_0x186b0a[_0x6f46('0x41')]['id']}})[_0x6f46('0x22')](handleEntityNotFound(_0x31acdb,null))['then'](function(_0x10b8d5){if(_0x10b8d5){_0x4b11c0=_0x10b8d5;_0x4f79b1[_0x6f46('0x2a')]=_['keys'](db[_0x6f46('0x4c')]['rawAttributes']);_0x4f79b1[_0x6f46('0x2c')]=_[_0x6f46('0x42')](_0x186b0a[_0x6f46('0x2c')]);_0x4f79b1['filters']=_['intersection'](_0x4f79b1['model'],_0x4f79b1[_0x6f46('0x2c')]);_0x3a3ed3['attributes']=_[_0x6f46('0x2d')](_0x4f79b1[_0x6f46('0x2a')],qs[_0x6f46('0x2f')](_0x186b0a[_0x6f46('0x2c')][_0x6f46('0x2f')]));_0x3a3ed3[_0x6f46('0x2e')]=_0x3a3ed3[_0x6f46('0x2e')][_0x6f46('0x30')]?_0x3a3ed3[_0x6f46('0x2e')]:_0x4f79b1[_0x6f46('0x2a')];_0x3a3ed3[_0x6f46('0x33')]=qs['sort'](_0x186b0a[_0x6f46('0x2c')][_0x6f46('0x34')]);_0x3a3ed3['where']=qs[_0x6f46('0x35')](_[_0x6f46('0x36')](_0x186b0a[_0x6f46('0x2c')],_0x4f79b1[_0x6f46('0x35')]));if(_0x186b0a[_0x6f46('0x2c')][_0x6f46('0x37')]){_0x3a3ed3[_0x6f46('0x38')]=_[_0x6f46('0x3a')](_0x3a3ed3[_0x6f46('0x38')],{'$or':_[_0x6f46('0x2b')](_0x3a3ed3[_0x6f46('0x2e')],function(_0x2c6d01){var _0x23826a={};_0x23826a[_0x2c6d01]={'$like':'%'+_0x186b0a[_0x6f46('0x2c')][_0x6f46('0x37')]+'%'};return _0x23826a;})});}_0x3a3ed3=_[_0x6f46('0x3a')]({},_0x3a3ed3,_0x186b0a['options']);return _0x4b11c0['getSubjects'](_0x3a3ed3);}})[_0x6f46('0x22')](function(_0x44eeac){if(_0x44eeac){_0x5c728f=_0x44eeac['length'];if(!_0x186b0a[_0x6f46('0x2c')][_0x6f46('0x31')]('nolimit')){_0x3a3ed3[_0x6f46('0x1b')]=qs[_0x6f46('0x1b')](_0x186b0a[_0x6f46('0x2c')][_0x6f46('0x1b')]);_0x3a3ed3[_0x6f46('0x19')]=qs[_0x6f46('0x19')](_0x186b0a[_0x6f46('0x2c')]['offset']);}return _0x4b11c0[_0x6f46('0x4b')](_0x3a3ed3);}})['then'](function(_0x190e2d){if(_0x190e2d){return _0x190e2d?{'count':_0x5c728f,'rows':_0x190e2d}:null;}})[_0x6f46('0x22')](respondWithResult(_0x31acdb,null))[_0x6f46('0x46')](handleError(_0x31acdb,null));};exports['getDescriptions']=function(_0x178211,_0x48a85e,_0x3879ca){var _0xa37205={};var _0xab223a={};var _0x59e505;var _0x222b52;return db[_0x6f46('0x3e')][_0x6f46('0x4a')]({'where':{'id':_0x178211[_0x6f46('0x41')]['id']}})['then'](handleEntityNotFound(_0x48a85e,null))['then'](function(_0x309963){if(_0x309963){_0x59e505=_0x309963;_0xab223a['model']=_[_0x6f46('0x42')](db[_0x6f46('0x4c')][_0x6f46('0x43')]);_0xab223a[_0x6f46('0x2c')]=_[_0x6f46('0x42')](_0x178211[_0x6f46('0x2c')]);_0xab223a['filters']=_[_0x6f46('0x2d')](_0xab223a[_0x6f46('0x2a')],_0xab223a[_0x6f46('0x2c')]);_0xa37205['attributes']=_[_0x6f46('0x2d')](_0xab223a[_0x6f46('0x2a')],qs[_0x6f46('0x2f')](_0x178211[_0x6f46('0x2c')][_0x6f46('0x2f')]));_0xa37205[_0x6f46('0x2e')]=_0xa37205[_0x6f46('0x2e')][_0x6f46('0x30')]?_0xa37205[_0x6f46('0x2e')]:_0xab223a[_0x6f46('0x2a')];_0xa37205[_0x6f46('0x33')]=qs[_0x6f46('0x34')](_0x178211[_0x6f46('0x2c')][_0x6f46('0x34')]);_0xa37205[_0x6f46('0x38')]=qs[_0x6f46('0x35')](_[_0x6f46('0x36')](_0x178211[_0x6f46('0x2c')],_0xab223a['filters']));if(_0x178211[_0x6f46('0x2c')]['filter']){_0xa37205[_0x6f46('0x38')]=_[_0x6f46('0x3a')](_0xa37205[_0x6f46('0x38')],{'$or':_[_0x6f46('0x2b')](_0xa37205['attributes'],function(_0x2ae6e6){var _0x464f39={};_0x464f39[_0x2ae6e6]={'$like':'%'+_0x178211[_0x6f46('0x2c')]['filter']+'%'};return _0x464f39;})});}_0xa37205=_[_0x6f46('0x3a')]({},_0xa37205,_0x178211['options']);return _0x59e505[_0x6f46('0x4d')](_0xa37205);}})[_0x6f46('0x22')](function(_0xd4bd8e){if(_0xd4bd8e){_0x222b52=_0xd4bd8e['length'];if(!_0x178211[_0x6f46('0x2c')][_0x6f46('0x31')](_0x6f46('0x32'))){_0xa37205[_0x6f46('0x1b')]=qs[_0x6f46('0x1b')](_0x178211[_0x6f46('0x2c')][_0x6f46('0x1b')]);_0xa37205[_0x6f46('0x19')]=qs[_0x6f46('0x19')](_0x178211[_0x6f46('0x2c')][_0x6f46('0x19')]);}return _0x59e505['getDescriptions'](_0xa37205);}})['then'](function(_0x42f660){if(_0x42f660){return _0x42f660?{'count':_0x222b52,'rows':_0x42f660}:null;}})[_0x6f46('0x22')](respondWithResult(_0x48a85e,null))[_0x6f46('0x46')](handleError(_0x48a85e,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 71a72a5..5b1e4ea 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 _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0xc7f448,_0x4abad9){var _0x2ee39a=function(_0x2f4a51){while(--_0x2f4a51){_0xc7f448['push'](_0xc7f448['shift']());}};_0x2ee39a(++_0x4abad9);}(_0x9f62,0x154));var _0x29f6=function(_0x31b0dc,_0x58eaaf){_0x31b0dc=_0x31b0dc-0x0;var _0x42ebba=_0x9f62[_0x31b0dc];return _0x42ebba;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','../../config/logger','api','moment','bluebird'];(function(_0x2c39e0,_0x51dd3c){var _0x1141b1=function(_0x414135){while(--_0x414135){_0x2c39e0['push'](_0x2c39e0['shift']());}};_0x1141b1(++_0x51dd3c);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 262ca66..0181193 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 _0xff3f=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xff3f,0x116));var _0xfff3=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xff3f[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0xfff3('0x0'));var util=require(_0xfff3('0x1'));var moment=require('moment');var BPromise=require(_0xfff3('0x2'));var rs=require(_0xfff3('0x3'));var fs=require('fs');var Redis=require(_0xfff3('0x4'));var db=require(_0xfff3('0x5'))['db'];var utils=require(_0xfff3('0x6'));var logger=require(_0xfff3('0x7'))(_0xfff3('0x8'));var config=require('../../config/environment');var jayson=require(_0xfff3('0x9'));var client=jayson[_0xfff3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e42d2,_0x1f6e03,_0x5a355f){return new BPromise(function(_0x4eaad5,_0x5eefaf){return client[_0xfff3('0xb')](_0x3e42d2,_0x5a355f)[_0xfff3('0xc')](function(_0x399580){logger[_0xfff3('0xd')](_0xfff3('0xe'),_0x1f6e03,_0xfff3('0xf'));logger['debug'](_0xfff3('0x10'),_0x1f6e03,_0xfff3('0xf'),JSON['stringify'](_0x399580));if(_0x399580[_0xfff3('0x11')]){if(_0x399580[_0xfff3('0x11')][_0xfff3('0x12')]===0x1f4){logger[_0xfff3('0x11')](_0xfff3('0xe'),_0x1f6e03,_0x399580[_0xfff3('0x11')][_0xfff3('0x13')]);return _0x5eefaf(_0x399580['error'][_0xfff3('0x13')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1f6e03,_0x399580[_0xfff3('0x11')]['message']);return _0x4eaad5(_0x399580[_0xfff3('0x11')][_0xfff3('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x1f6e03,'request\x20sent');_0x4eaad5(_0x399580['result'][_0xfff3('0x13')]);}})[_0xfff3('0x14')](function(_0x24c9a5){logger[_0xfff3('0x11')](_0xfff3('0xe'),_0x1f6e03,_0x24c9a5);_0x5eefaf(_0x24c9a5);});});} \ No newline at end of file +var _0x5036=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5036,0x14b));var _0x6503=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0x5036[_0x4d821c];return _0x15dd5b;};'use strict';var _=require(_0x6503('0x0'));var util=require('util');var moment=require(_0x6503('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6503('0x2'));var db=require(_0x6503('0x3'))['db'];var utils=require(_0x6503('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6503('0x5'));var jayson=require(_0x6503('0x6'));var client=jayson[_0x6503('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba5a3,_0xcb43df,_0x318fe9){return new BPromise(function(_0x3d9944,_0x4057bd){return client[_0x6503('0x8')](_0x4ba5a3,_0x318fe9)[_0x6503('0x9')](function(_0x521493){logger[_0x6503('0xa')](_0x6503('0xb'),_0xcb43df,_0x6503('0xc'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xcb43df,_0x6503('0xc'),JSON[_0x6503('0xd')](_0x521493));if(_0x521493[_0x6503('0xe')]){if(_0x521493[_0x6503('0xe')][_0x6503('0xf')]===0x1f4){logger[_0x6503('0xe')](_0x6503('0xb'),_0xcb43df,_0x521493[_0x6503('0xe')]['message']);return _0x4057bd(_0x521493['error'][_0x6503('0x10')]);}logger[_0x6503('0xe')](_0x6503('0xb'),_0xcb43df,_0x521493[_0x6503('0xe')][_0x6503('0x10')]);return _0x3d9944(_0x521493[_0x6503('0xe')][_0x6503('0x10')]);}else{logger[_0x6503('0xa')](_0x6503('0xb'),_0xcb43df,'request\x20sent');_0x3d9944(_0x521493[_0x6503('0x11')][_0x6503('0x10')]);}})['catch'](function(_0x4fb8a4){logger['error'](_0x6503('0xb'),_0xcb43df,_0x4fb8a4);_0x4057bd(_0x4fb8a4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 13c51f3..eba6115 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 _0x5170=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','create','update','delete','util','path'];(function(_0x8caca3,_0x3160c7){var _0x2f4434=function(_0x93dea){while(--_0x93dea){_0x8caca3['push'](_0x8caca3['shift']());}};_0x2f4434(++_0x3160c7);}(_0x5170,0x163));var _0x0517=function(_0x51bd56,_0x1a5863){_0x51bd56=_0x51bd56-0x0;var _0x3c55f0=_0x5170[_0x51bd56];return _0x3c55f0;};'use strict';var multer=require('multer');var util=require(_0x0517('0x0'));var path=require(_0x0517('0x1'));var timeout=require(_0x0517('0x2'));var express=require(_0x0517('0x3'));var router=express[_0x0517('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0517('0x5'));var interaction=require(_0x0517('0x6'));var config=require(_0x0517('0x7'));var controller=require(_0x0517('0x8'));router[_0x0517('0x9')]('/',auth['isAuthenticated'](),controller[_0x0517('0xa')]);router['get'](_0x0517('0xb'),auth[_0x0517('0xc')](),controller[_0x0517('0xd')]);router['post']('/',auth[_0x0517('0xc')](),controller[_0x0517('0xe')]);router['put'](_0x0517('0xb'),auth[_0x0517('0xc')](),controller[_0x0517('0xf')]);router[_0x0517('0x10')](_0x0517('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc71b=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x31c81b,_0x4a2b1c){var _0x52ab34=function(_0x2e6c48){while(--_0x2e6c48){_0x31c81b['push'](_0x31c81b['shift']());}};_0x52ab34(++_0x4a2b1c);}(_0xc71b,0x7d));var _0xbc71=function(_0x5af0b2,_0x1db833){_0x5af0b2=_0x5af0b2-0x0;var _0x2d7936=_0xc71b[_0x5af0b2];return _0x2d7936;};'use strict';var multer=require(_0xbc71('0x0'));var util=require(_0xbc71('0x1'));var path=require(_0xbc71('0x2'));var timeout=require(_0xbc71('0x3'));var express=require(_0xbc71('0x4'));var router=express['Router']();var fs_extra=require(_0xbc71('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbc71('0x6'));var config=require(_0xbc71('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xbc71('0x8')]('/',auth[_0xbc71('0x9')](),controller['index']);router[_0xbc71('0x8')](_0xbc71('0xa'),auth[_0xbc71('0x9')](),controller['show']);router[_0xbc71('0xb')]('/',auth[_0xbc71('0x9')](),controller[_0xbc71('0xc')]);router[_0xbc71('0xd')]('/:id',auth[_0xbc71('0x9')](),controller[_0xbc71('0xe')]);router[_0xbc71('0xf')](_0xbc71('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xbc71('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5c8a8dd..f1b5393 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 _0xdca7=['BOOLEAN','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x629403,_0x16ab45){var _0x46cd77=function(_0x47f213){while(--_0x47f213){_0x629403['push'](_0x629403['shift']());}};_0x46cd77(++_0x16ab45);}(_0xdca7,0x169));var _0x7dca=function(_0x4f0844,_0x1eded6){_0x4f0844=_0x4f0844-0x0;var _0x47175d=_0xdca7[_0x4f0844];return _0x47175d;};'use strict';var Sequelize=require('sequelize');module[_0x7dca('0x0')]={'type':{'type':Sequelize[_0x7dca('0x1')](_0x7dca('0x2'),'variable',_0x7dca('0x3'),_0x7dca('0x4'),'picklist'),'defaultValue':_0x7dca('0x2')},'content':{'type':Sequelize[_0x7dca('0x5')]},'key':{'type':Sequelize[_0x7dca('0x5')]},'keyType':{'type':Sequelize[_0x7dca('0x1')]('string',_0x7dca('0x6'),_0x7dca('0x3'))},'keyContent':{'type':Sequelize[_0x7dca('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7dca('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7dca('0x5')]}}; \ No newline at end of file +var _0xa136=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0xa136,0x91));var _0x6a13=function(_0x5501d2,_0x36e066){_0x5501d2=_0x5501d2-0x0;var _0x3bcb21=_0xa136[_0x5501d2];return _0x3bcb21;};'use strict';var Sequelize=require(_0x6a13('0x0'));module[_0x6a13('0x1')]={'type':{'type':Sequelize[_0x6a13('0x2')]('string',_0x6a13('0x3'),_0x6a13('0x4'),_0x6a13('0x5'),_0x6a13('0x6')),'defaultValue':_0x6a13('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6a13('0x8')]},'keyType':{'type':Sequelize[_0x6a13('0x2')](_0x6a13('0x7'),_0x6a13('0x3'),_0x6a13('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6a13('0x8')]},'nameField':{'type':Sequelize[_0x6a13('0x8')]},'customField':{'type':Sequelize[_0x6a13('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a13('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index d807e94..e0ae083 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 _0xa9a4=['model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','create','body','find','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','end','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','key','query','keys','filters','intersection'];(function(_0x4699bc,_0x563509){var _0x21b55a=function(_0x58ea44){while(--_0x58ea44){_0x4699bc['push'](_0x4699bc['shift']());}};_0x21b55a(++_0x563509);}(_0xa9a4,0xa0));var _0x4a9a=function(_0x3204c0,_0x4bd900){_0x3204c0=_0x3204c0-0x0;var _0x5547aa=_0xa9a4[_0x3204c0];return _0x5547aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a9a('0x0'));var zipdir=require(_0x4a9a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a9a('0x2'));var moment=require(_0x4a9a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4a9a('0x4'));var path=require(_0x4a9a('0x5'));var sox=require(_0x4a9a('0x6'));var csv=require(_0x4a9a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a9a('0x8'));var crypto=require(_0x4a9a('0x9'));var jsforce=require(_0x4a9a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4a9a('0x7'));var querystring=require(_0x4a9a('0xb'));var Papa=require('papaparse');var Redis=require(_0x4a9a('0xc'));var authService=require(_0x4a9a('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x4a9a('0xe'));var hardwareService=require(_0x4a9a('0xf'));var logger=require(_0x4a9a('0x10'))(_0x4a9a('0x11'));var utils=require('../../config/utils');var config=require(_0x4a9a('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126e62,_0x236c79){_0x236c79=_0x236c79||0xcc;return function(_0x89097a){if(_0x89097a){return _0x126e62['sendStatus'](_0x236c79);}return _0x126e62['status'](_0x236c79)[_0x4a9a('0x13')]();};}function respondWithResult(_0x41cedf,_0x2d2171){_0x2d2171=_0x2d2171||0xc8;return function(_0x1b24a2){if(_0x1b24a2){return _0x41cedf[_0x4a9a('0x14')](_0x2d2171)[_0x4a9a('0x15')](_0x1b24a2);}};}function respondWithFilteredResult(_0x3334f2,_0x568465){return function(_0x56c631){if(_0x56c631){var _0x30f894=typeof _0x568465[_0x4a9a('0x16')]===_0x4a9a('0x17')&&typeof _0x568465['limit']==='undefined';var _0x539b2a=_0x56c631['count'];var _0x542f57=_0x30f894?0x0:_0x568465[_0x4a9a('0x16')];var _0x4e2ee5=_0x30f894?_0x56c631['count']:_0x568465[_0x4a9a('0x16')]+_0x568465['limit'];var _0x1358d3;if(_0x4e2ee5>=_0x539b2a){_0x4e2ee5=_0x539b2a;_0x1358d3=0xc8;}else{_0x1358d3=0xce;}_0x3334f2['status'](_0x1358d3);return _0x3334f2[_0x4a9a('0x18')](_0x4a9a('0x19'),_0x542f57+'-'+_0x4e2ee5+'/'+_0x539b2a)[_0x4a9a('0x15')](_0x56c631);}return null;};}function patchUpdates(_0x44db6f){return function(_0x2158f7){try{jsonpatch[_0x4a9a('0x1a')](_0x2158f7,_0x44db6f,!![]);}catch(_0x2ab9f9){return BPromise[_0x4a9a('0x1b')](_0x2ab9f9);}return _0x2158f7[_0x4a9a('0x1c')]();};}function saveUpdates(_0x32ec9f,_0x6d053d){return function(_0x6fa8e7){if(_0x6fa8e7){return _0x6fa8e7[_0x4a9a('0x1d')](_0x32ec9f)[_0x4a9a('0x1e')](function(_0x313d25){return _0x313d25;});}return null;};}function removeEntity(_0x425cf6,_0x37db8a){return function(_0x106111){if(_0x106111){return _0x106111[_0x4a9a('0x1f')]()['then'](function(){_0x425cf6[_0x4a9a('0x14')](0xcc)[_0x4a9a('0x13')]();});}};}function handleEntityNotFound(_0x343a3a,_0x952b98){return function(_0x34cf03){if(!_0x34cf03){_0x343a3a['sendStatus'](0x194);}return _0x34cf03;};}function handleError(_0x4c64c1,_0x491b6b){_0x491b6b=_0x491b6b||0x1f4;return function(_0x353ab6){logger[_0x4a9a('0x20')](_0x353ab6[_0x4a9a('0x21')]);if(_0x353ab6[_0x4a9a('0x22')]){delete _0x353ab6[_0x4a9a('0x22')];}_0x4c64c1[_0x4a9a('0x14')](_0x491b6b)[_0x4a9a('0x23')](_0x353ab6);};}exports[_0x4a9a('0x24')]=function(_0x3d4efc,_0x1832c8){var _0xbcfa16={},_0x5a5fcd={},_0x4bc7d9={'count':0x0,'rows':[]};var _0x5be601=_[_0x4a9a('0x25')](db[_0x4a9a('0x26')]['rawAttributes'],function(_0x59e6ec){return{'name':_0x59e6ec['fieldName'],'type':_0x59e6ec['type'][_0x4a9a('0x27')]};});_0x5a5fcd['model']=_[_0x4a9a('0x25')](_0x5be601,'name');_0x5a5fcd[_0x4a9a('0x28')]=_[_0x4a9a('0x29')](_0x3d4efc[_0x4a9a('0x28')]);_0x5a5fcd[_0x4a9a('0x2a')]=_[_0x4a9a('0x2b')](_0x5a5fcd[_0x4a9a('0x2c')],_0x5a5fcd[_0x4a9a('0x28')]);_0xbcfa16['attributes']=_['intersection'](_0x5a5fcd[_0x4a9a('0x2c')],qs[_0x4a9a('0x2d')](_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x2d')]));_0xbcfa16[_0x4a9a('0x2e')]=_0xbcfa16[_0x4a9a('0x2e')][_0x4a9a('0x2f')]?_0xbcfa16[_0x4a9a('0x2e')]:_0x5a5fcd['model'];if(!_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x30')](_0x4a9a('0x31'))){_0xbcfa16['limit']=qs['limit'](_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x32')]);_0xbcfa16['offset']=qs[_0x4a9a('0x16')](_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x16')]);}_0xbcfa16[_0x4a9a('0x33')]=qs[_0x4a9a('0x34')](_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x34')]);_0xbcfa16[_0x4a9a('0x35')]=qs['filters'](_['pick'](_0x3d4efc['query'],_0x5a5fcd[_0x4a9a('0x2a')]),_0x5be601);if(_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x36')]){_0xbcfa16[_0x4a9a('0x35')]=_[_0x4a9a('0x37')](_0xbcfa16['where'],{'$or':_['map'](_0x5be601,function(_0x3250d5){if(_0x3250d5['type']!==_0x4a9a('0x38')){var _0x1dd45d={};_0x1dd45d[_0x3250d5['name']]={'$like':'%'+_0x3d4efc['query'][_0x4a9a('0x36')]+'%'};return _0x1dd45d;}})});}_0xbcfa16=_[_0x4a9a('0x37')]({},_0xbcfa16,_0x3d4efc['options']);var _0x3b9797={'where':_0xbcfa16['where']};return db[_0x4a9a('0x26')]['count'](_0x3b9797)[_0x4a9a('0x1e')](function(_0x535988){_0x4bc7d9['count']=_0x535988;if(_0x3d4efc[_0x4a9a('0x28')][_0x4a9a('0x39')]){_0xbcfa16[_0x4a9a('0x3a')]=[{'all':!![]}];}return db[_0x4a9a('0x26')][_0x4a9a('0x3b')](_0xbcfa16);})['then'](function(_0x2b9801){_0x4bc7d9['rows']=_0x2b9801;return _0x4bc7d9;})[_0x4a9a('0x1e')](respondWithFilteredResult(_0x1832c8,_0xbcfa16))[_0x4a9a('0x3c')](handleError(_0x1832c8,null));};exports[_0x4a9a('0x3d')]=function(_0x45fd5a,_0x56d143){var _0x512a75={'raw':!![],'where':{'id':_0x45fd5a[_0x4a9a('0x3e')]['id']}},_0x527d95={};_0x527d95[_0x4a9a('0x2c')]=_[_0x4a9a('0x29')](db[_0x4a9a('0x26')][_0x4a9a('0x3f')]);_0x527d95[_0x4a9a('0x28')]=_[_0x4a9a('0x29')](_0x45fd5a[_0x4a9a('0x28')]);_0x527d95['filters']=_[_0x4a9a('0x2b')](_0x527d95['model'],_0x527d95[_0x4a9a('0x28')]);_0x512a75['attributes']=_['intersection'](_0x527d95['model'],qs[_0x4a9a('0x2d')](_0x45fd5a[_0x4a9a('0x28')][_0x4a9a('0x2d')]));_0x512a75[_0x4a9a('0x2e')]=_0x512a75['attributes']['length']?_0x512a75[_0x4a9a('0x2e')]:_0x527d95[_0x4a9a('0x2c')];if(_0x45fd5a[_0x4a9a('0x28')][_0x4a9a('0x39')]){_0x512a75[_0x4a9a('0x3a')]=[{'all':!![]}];}_0x512a75=_[_0x4a9a('0x37')]({},_0x512a75,_0x45fd5a[_0x4a9a('0x40')]);return db[_0x4a9a('0x26')]['find'](_0x512a75)[_0x4a9a('0x1e')](handleEntityNotFound(_0x56d143,null))[_0x4a9a('0x1e')](respondWithResult(_0x56d143,null))[_0x4a9a('0x3c')](handleError(_0x56d143,null));};exports[_0x4a9a('0x41')]=function(_0x4de539,_0x4a9ce3){return db[_0x4a9a('0x26')][_0x4a9a('0x41')](_0x4de539[_0x4a9a('0x42')],{})[_0x4a9a('0x1e')](respondWithResult(_0x4a9ce3,0xc9))['catch'](handleError(_0x4a9ce3,null));};exports['update']=function(_0xae2217,_0x5f48ac){if(_0xae2217[_0x4a9a('0x42')]['id']){delete _0xae2217[_0x4a9a('0x42')]['id'];}return db[_0x4a9a('0x26')]['find']({'where':{'id':_0xae2217[_0x4a9a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5f48ac,null))[_0x4a9a('0x1e')](saveUpdates(_0xae2217[_0x4a9a('0x42')],null))[_0x4a9a('0x1e')](respondWithResult(_0x5f48ac,null))[_0x4a9a('0x3c')](handleError(_0x5f48ac,null));};exports[_0x4a9a('0x1f')]=function(_0x3d1b7a,_0x2edc8e){return db['Dynamics365Field'][_0x4a9a('0x43')]({'where':{'id':_0x3d1b7a[_0x4a9a('0x3e')]['id']}})[_0x4a9a('0x1e')](handleEntityNotFound(_0x2edc8e,null))[_0x4a9a('0x1e')](removeEntity(_0x2edc8e,null))[_0x4a9a('0x3c')](handleError(_0x2edc8e,null));}; \ No newline at end of file +var _0xf868=['findAll','catch','show','params','keys','create','body','update','find','eml-format','rimraf','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x2d5844,_0x352c30){var _0x267ff3=function(_0xddca34){while(--_0xddca34){_0x2d5844['push'](_0x2d5844['shift']());}};_0x267ff3(++_0x352c30);}(_0xf868,0x129));var _0x8f86=function(_0x51ae82,_0x4fabc3){_0x51ae82=_0x51ae82-0x0;var _0x588135=_0xf868[_0x51ae82];return _0x588135;};'use strict';var emlformat=require(_0x8f86('0x0'));var rimraf=require(_0x8f86('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8f86('0x2'));var BPromise=require(_0x8f86('0x3'));var Mustache=require('mustache');var util=require(_0x8f86('0x4'));var path=require(_0x8f86('0x5'));var sox=require('sox');var csv=require(_0x8f86('0x6'));var ejs=require(_0x8f86('0x7'));var fs=require('fs');var fs_extra=require(_0x8f86('0x8'));var _=require(_0x8f86('0x9'));var squel=require(_0x8f86('0xa'));var crypto=require('crypto');var jsforce=require(_0x8f86('0xb'));var deskjs=require(_0x8f86('0xc'));var toCsv=require(_0x8f86('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f86('0xd'));var authService=require(_0x8f86('0xe'));var qs=require(_0x8f86('0xf'));var as=require(_0x8f86('0x10'));var hardwareService=require(_0x8f86('0x11'));var logger=require(_0x8f86('0x12'))(_0x8f86('0x13'));var utils=require('../../config/utils');var config=require(_0x8f86('0x14'));var licenseUtil=require(_0x8f86('0x15'));var db=require(_0x8f86('0x16'))['db'];function respondWithStatusCode(_0x1b62aa,_0x112d3c){_0x112d3c=_0x112d3c||0xcc;return function(_0x1d545f){if(_0x1d545f){return _0x1b62aa[_0x8f86('0x17')](_0x112d3c);}return _0x1b62aa[_0x8f86('0x18')](_0x112d3c)[_0x8f86('0x19')]();};}function respondWithResult(_0xb79106,_0x4b4ab6){_0x4b4ab6=_0x4b4ab6||0xc8;return function(_0x112cab){if(_0x112cab){return _0xb79106[_0x8f86('0x18')](_0x4b4ab6)[_0x8f86('0x1a')](_0x112cab);}};}function respondWithFilteredResult(_0x1df05f,_0x3e85ad){return function(_0x182fd5){if(_0x182fd5){var _0x24d3b8=typeof _0x3e85ad[_0x8f86('0x1b')]===_0x8f86('0x1c')&&typeof _0x3e85ad[_0x8f86('0x1d')]===_0x8f86('0x1c');var _0x173cf2=_0x182fd5[_0x8f86('0x1e')];var _0x380178=_0x24d3b8?0x0:_0x3e85ad[_0x8f86('0x1b')];var _0x1a3826=_0x24d3b8?_0x182fd5[_0x8f86('0x1e')]:_0x3e85ad[_0x8f86('0x1b')]+_0x3e85ad[_0x8f86('0x1d')];var _0x4c9a8d;if(_0x1a3826>=_0x173cf2){_0x1a3826=_0x173cf2;_0x4c9a8d=0xc8;}else{_0x4c9a8d=0xce;}_0x1df05f[_0x8f86('0x18')](_0x4c9a8d);return _0x1df05f['set'](_0x8f86('0x1f'),_0x380178+'-'+_0x1a3826+'/'+_0x173cf2)[_0x8f86('0x1a')](_0x182fd5);}return null;};}function patchUpdates(_0x519040){return function(_0x11235c){try{jsonpatch['apply'](_0x11235c,_0x519040,!![]);}catch(_0x46ef21){return BPromise[_0x8f86('0x20')](_0x46ef21);}return _0x11235c['save']();};}function saveUpdates(_0x364b5b,_0x142411){return function(_0x2f69ac){if(_0x2f69ac){return _0x2f69ac['update'](_0x364b5b)[_0x8f86('0x21')](function(_0x4874d5){return _0x4874d5;});}return null;};}function removeEntity(_0x1392fa,_0x41029e){return function(_0x238a4e){if(_0x238a4e){return _0x238a4e[_0x8f86('0x22')]()[_0x8f86('0x21')](function(){_0x1392fa['status'](0xcc)[_0x8f86('0x19')]();});}};}function handleEntityNotFound(_0x3afd3b,_0x50fb9c){return function(_0x328bf5){if(!_0x328bf5){_0x3afd3b[_0x8f86('0x17')](0x194);}return _0x328bf5;};}function handleError(_0x34a6ff,_0x5d2d32){_0x5d2d32=_0x5d2d32||0x1f4;return function(_0x1757f7){logger[_0x8f86('0x23')](_0x1757f7[_0x8f86('0x24')]);if(_0x1757f7[_0x8f86('0x25')]){delete _0x1757f7[_0x8f86('0x25')];}_0x34a6ff[_0x8f86('0x18')](_0x5d2d32)[_0x8f86('0x26')](_0x1757f7);};}exports[_0x8f86('0x27')]=function(_0x1f4878,_0x5ee891){var _0x5e6465={},_0x1fe57a={},_0xf2ad78={'count':0x0,'rows':[]};var _0x327446=_[_0x8f86('0x28')](db[_0x8f86('0x29')][_0x8f86('0x2a')],function(_0xe6c0f7){return{'name':_0xe6c0f7[_0x8f86('0x2b')],'type':_0xe6c0f7[_0x8f86('0x2c')][_0x8f86('0x2d')]};});_0x1fe57a[_0x8f86('0x2e')]=_[_0x8f86('0x28')](_0x327446,_0x8f86('0x25'));_0x1fe57a['query']=_['keys'](_0x1f4878[_0x8f86('0x2f')]);_0x1fe57a['filters']=_['intersection'](_0x1fe57a[_0x8f86('0x2e')],_0x1fe57a['query']);_0x5e6465[_0x8f86('0x30')]=_[_0x8f86('0x31')](_0x1fe57a[_0x8f86('0x2e')],qs[_0x8f86('0x32')](_0x1f4878[_0x8f86('0x2f')][_0x8f86('0x32')]));_0x5e6465['attributes']=_0x5e6465['attributes'][_0x8f86('0x33')]?_0x5e6465['attributes']:_0x1fe57a[_0x8f86('0x2e')];if(!_0x1f4878['query'][_0x8f86('0x34')](_0x8f86('0x35'))){_0x5e6465['limit']=qs['limit'](_0x1f4878[_0x8f86('0x2f')][_0x8f86('0x1d')]);_0x5e6465['offset']=qs['offset'](_0x1f4878['query'][_0x8f86('0x1b')]);}_0x5e6465['order']=qs[_0x8f86('0x36')](_0x1f4878[_0x8f86('0x2f')][_0x8f86('0x36')]);_0x5e6465['where']=qs[_0x8f86('0x37')](_['pick'](_0x1f4878[_0x8f86('0x2f')],_0x1fe57a[_0x8f86('0x37')]),_0x327446);if(_0x1f4878[_0x8f86('0x2f')][_0x8f86('0x38')]){_0x5e6465[_0x8f86('0x39')]=_['merge'](_0x5e6465['where'],{'$or':_['map'](_0x327446,function(_0x1df35f){if(_0x1df35f[_0x8f86('0x2c')]!==_0x8f86('0x3a')){var _0x147385={};_0x147385[_0x1df35f[_0x8f86('0x25')]]={'$like':'%'+_0x1f4878[_0x8f86('0x2f')][_0x8f86('0x38')]+'%'};return _0x147385;}})});}_0x5e6465=_[_0x8f86('0x3b')]({},_0x5e6465,_0x1f4878[_0x8f86('0x3c')]);var _0x8470ec={'where':_0x5e6465[_0x8f86('0x39')]};return db[_0x8f86('0x29')]['count'](_0x8470ec)[_0x8f86('0x21')](function(_0x389c60){_0xf2ad78[_0x8f86('0x1e')]=_0x389c60;if(_0x1f4878['query'][_0x8f86('0x3d')]){_0x5e6465[_0x8f86('0x3e')]=[{'all':!![]}];}return db[_0x8f86('0x29')][_0x8f86('0x3f')](_0x5e6465);})[_0x8f86('0x21')](function(_0xc50bbf){_0xf2ad78['rows']=_0xc50bbf;return _0xf2ad78;})[_0x8f86('0x21')](respondWithFilteredResult(_0x5ee891,_0x5e6465))[_0x8f86('0x40')](handleError(_0x5ee891,null));};exports[_0x8f86('0x41')]=function(_0xdf936c,_0x2295d7){var _0x5d7a7a={'raw':!![],'where':{'id':_0xdf936c[_0x8f86('0x42')]['id']}},_0x414fe6={};_0x414fe6[_0x8f86('0x2e')]=_[_0x8f86('0x43')](db[_0x8f86('0x29')][_0x8f86('0x2a')]);_0x414fe6[_0x8f86('0x2f')]=_['keys'](_0xdf936c[_0x8f86('0x2f')]);_0x414fe6[_0x8f86('0x37')]=_['intersection'](_0x414fe6[_0x8f86('0x2e')],_0x414fe6[_0x8f86('0x2f')]);_0x5d7a7a[_0x8f86('0x30')]=_['intersection'](_0x414fe6[_0x8f86('0x2e')],qs['fields'](_0xdf936c['query'][_0x8f86('0x32')]));_0x5d7a7a[_0x8f86('0x30')]=_0x5d7a7a[_0x8f86('0x30')][_0x8f86('0x33')]?_0x5d7a7a[_0x8f86('0x30')]:_0x414fe6[_0x8f86('0x2e')];if(_0xdf936c[_0x8f86('0x2f')][_0x8f86('0x3d')]){_0x5d7a7a[_0x8f86('0x3e')]=[{'all':!![]}];}_0x5d7a7a=_[_0x8f86('0x3b')]({},_0x5d7a7a,_0xdf936c[_0x8f86('0x3c')]);return db[_0x8f86('0x29')]['find'](_0x5d7a7a)[_0x8f86('0x21')](handleEntityNotFound(_0x2295d7,null))[_0x8f86('0x21')](respondWithResult(_0x2295d7,null))[_0x8f86('0x40')](handleError(_0x2295d7,null));};exports[_0x8f86('0x44')]=function(_0x241ed0,_0x184232){return db[_0x8f86('0x29')][_0x8f86('0x44')](_0x241ed0[_0x8f86('0x45')],{})[_0x8f86('0x21')](respondWithResult(_0x184232,0xc9))[_0x8f86('0x40')](handleError(_0x184232,null));};exports[_0x8f86('0x46')]=function(_0x3f1c72,_0x296ab6){if(_0x3f1c72[_0x8f86('0x45')]['id']){delete _0x3f1c72[_0x8f86('0x45')]['id'];}return db['Dynamics365Field'][_0x8f86('0x47')]({'where':{'id':_0x3f1c72[_0x8f86('0x42')]['id']}})[_0x8f86('0x21')](handleEntityNotFound(_0x296ab6,null))['then'](saveUpdates(_0x3f1c72[_0x8f86('0x45')],null))[_0x8f86('0x21')](respondWithResult(_0x296ab6,null))[_0x8f86('0x40')](handleError(_0x296ab6,null));};exports[_0x8f86('0x22')]=function(_0x3d192a,_0x35eeb8){return db[_0x8f86('0x29')][_0x8f86('0x47')]({'where':{'id':_0x3d192a[_0x8f86('0x42')]['id']}})['then'](handleEntityNotFound(_0x35eeb8,null))[_0x8f86('0x21')](removeEntity(_0x35eeb8,null))['catch'](handleError(_0x35eeb8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 64c36f9..9968d1d 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 _0x6014=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x3229d8,_0x463b0d){var _0x3c57f2=function(_0x490835){while(--_0x490835){_0x3229d8['push'](_0x3229d8['shift']());}};_0x3c57f2(++_0x463b0d);}(_0x6014,0x196));var _0x4601=function(_0x10548e,_0x80eaff){_0x10548e=_0x10548e-0x0;var _0x540aa4=_0x6014[_0x10548e];return _0x540aa4;};'use strict';var _=require(_0x4601('0x0'));var util=require(_0x4601('0x1'));var logger=require(_0x4601('0x2'))(_0x4601('0x3'));var moment=require(_0x4601('0x4'));var BPromise=require(_0x4601('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4601('0x6'));var rimraf=require(_0x4601('0x7'));var config=require(_0x4601('0x8'));var attributes=require(_0x4601('0x9'));module[_0x4601('0xa')]=function(_0x3d45bc,_0x858dec){return _0x3d45bc[_0x4601('0xb')](_0x4601('0xc'),attributes,{'tableName':_0x4601('0xd'),'paranoid':![],'indexes':[{'name':_0x4601('0xe'),'fields':['idField',_0x4601('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53e8=['idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x2be73a,_0x2e4b2e){var _0x3f47b9=function(_0x3dd782){while(--_0x3dd782){_0x2be73a['push'](_0x2be73a['shift']());}};_0x3f47b9(++_0x2e4b2e);}(_0x53e8,0x15b));var _0x853e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x53e8[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x853e('0x0'));var util=require(_0x853e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x853e('0x2'));var BPromise=require(_0x853e('0x3'));var rp=require(_0x853e('0x4'));var fs=require('fs');var path=require(_0x853e('0x5'));var rimraf=require(_0x853e('0x6'));var config=require(_0x853e('0x7'));var attributes=require(_0x853e('0x8'));module[_0x853e('0x9')]=function(_0x56f344,_0x560002){return _0x56f344[_0x853e('0xa')]('Dynamics365Field',attributes,{'tableName':_0x853e('0xb'),'paranoid':![],'indexes':[{'name':_0x853e('0xc'),'fields':[_0x853e('0xd'),_0x853e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index abdfece..e9de715 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 _0xda8d=['client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda8d,0x108));var _0xdda8=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xda8d[_0x2fee96];return _0x2e6ad1;};'use strict';var _=require('lodash');var util=require(_0xdda8('0x0'));var moment=require(_0xdda8('0x1'));var BPromise=require(_0xdda8('0x2'));var rs=require(_0xdda8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdda8('0x4'))['db'];var utils=require(_0xdda8('0x5'));var logger=require(_0xdda8('0x6'))('rpc');var config=require(_0xdda8('0x7'));var jayson=require(_0xdda8('0x8'));var client=jayson[_0xdda8('0x9')][_0xdda8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45d950,_0x78718,_0x12bf08){return new BPromise(function(_0x35169f,_0x13fb60){return client['request'](_0x45d950,_0x12bf08)[_0xdda8('0xb')](function(_0x4bdbba){logger[_0xdda8('0xc')](_0xdda8('0xd'),_0x78718,_0xdda8('0xe'));logger[_0xdda8('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x78718,'request\x20sent',JSON[_0xdda8('0x10')](_0x4bdbba));if(_0x4bdbba[_0xdda8('0x11')]){if(_0x4bdbba[_0xdda8('0x11')]['code']===0x1f4){logger[_0xdda8('0x11')](_0xdda8('0xd'),_0x78718,_0x4bdbba['error'][_0xdda8('0x12')]);return _0x13fb60(_0x4bdbba[_0xdda8('0x11')][_0xdda8('0x12')]);}logger[_0xdda8('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x78718,_0x4bdbba['error'][_0xdda8('0x12')]);return _0x35169f(_0x4bdbba[_0xdda8('0x11')][_0xdda8('0x12')]);}else{logger[_0xdda8('0xc')](_0xdda8('0xd'),_0x78718,_0xdda8('0xe'));_0x35169f(_0x4bdbba[_0xdda8('0x13')][_0xdda8('0x12')]);}})[_0xdda8('0x14')](function(_0x143b15){logger[_0xdda8('0x11')](_0xdda8('0xd'),_0x78718,_0x143b15);_0x13fb60(_0x143b15);});});} \ No newline at end of file +var _0x5c1c=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../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','code','error','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5c1c,0x1c4));var _0xc5c1=function(_0x55c556,_0x50a349){_0x55c556=_0x55c556-0x0;var _0x5b6507=_0x5c1c[_0x55c556];return _0x5b6507;};'use strict';var _=require('lodash');var util=require(_0xc5c1('0x0'));var moment=require(_0xc5c1('0x1'));var BPromise=require(_0xc5c1('0x2'));var rs=require(_0xc5c1('0x3'));var fs=require('fs');var Redis=require(_0xc5c1('0x4'));var db=require(_0xc5c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c1('0x6'))(_0xc5c1('0x7'));var config=require(_0xc5c1('0x8'));var jayson=require(_0xc5c1('0x9'));var client=jayson[_0xc5c1('0xa')][_0xc5c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28a4c2,_0x141941,_0xe16fe2){return new BPromise(function(_0x1bbb68,_0x3f6845){return client[_0xc5c1('0xc')](_0x28a4c2,_0xe16fe2)[_0xc5c1('0xd')](function(_0x5bf08d){logger[_0xc5c1('0xe')](_0xc5c1('0xf'),_0x141941,_0xc5c1('0x10'));logger[_0xc5c1('0x11')](_0xc5c1('0x12'),_0x141941,_0xc5c1('0x10'),JSON[_0xc5c1('0x13')](_0x5bf08d));if(_0x5bf08d['error']){if(_0x5bf08d['error'][_0xc5c1('0x14')]===0x1f4){logger[_0xc5c1('0x15')](_0xc5c1('0xf'),_0x141941,_0x5bf08d['error'][_0xc5c1('0x16')]);return _0x3f6845(_0x5bf08d[_0xc5c1('0x15')][_0xc5c1('0x16')]);}logger[_0xc5c1('0x15')](_0xc5c1('0xf'),_0x141941,_0x5bf08d[_0xc5c1('0x15')]['message']);return _0x1bbb68(_0x5bf08d[_0xc5c1('0x15')][_0xc5c1('0x16')]);}else{logger['info'](_0xc5c1('0xf'),_0x141941,_0xc5c1('0x10'));_0x1bbb68(_0x5bf08d[_0xc5c1('0x17')][_0xc5c1('0x16')]);}})[_0xc5c1('0x18')](function(_0x4bf5f0){logger['error'](_0xc5c1('0xf'),_0x141941,_0x4bf5f0);_0x3f6845(_0x4bf5f0);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index ff38f83..8731002 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 _0xe469=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id'];(function(_0x16c00f,_0x5091cb){var _0x309337=function(_0x3d12d4){while(--_0x3d12d4){_0x16c00f['push'](_0x16c00f['shift']());}};_0x309337(++_0x5091cb);}(_0xe469,0x1ce));var _0x9e46=function(_0x246194,_0x27cdd9){_0x246194=_0x246194-0x0;var _0x4fed0e=_0xe469[_0x246194];return _0x4fed0e;};'use strict';var multer=require('multer');var util=require(_0x9e46('0x0'));var path=require(_0x9e46('0x1'));var timeout=require(_0x9e46('0x2'));var express=require(_0x9e46('0x3'));var router=express[_0x9e46('0x4')]();var fs_extra=require(_0x9e46('0x5'));var auth=require(_0x9e46('0x6'));var interaction=require(_0x9e46('0x7'));var config=require(_0x9e46('0x8'));var controller=require(_0x9e46('0x9'));router[_0x9e46('0xa')]('/',auth['isAuthenticated'](),controller[_0x9e46('0xb')]);router['get'](_0x9e46('0xc'),auth[_0x9e46('0xd')](),controller[_0x9e46('0xe')]);router[_0x9e46('0xa')](_0x9e46('0xf'),auth[_0x9e46('0xd')](),controller[_0x9e46('0x10')]);router['get'](_0x9e46('0x11'),auth[_0x9e46('0xd')](),controller['getFields']);router[_0x9e46('0x12')]('/',auth[_0x9e46('0xd')](),controller[_0x9e46('0x13')]);router[_0x9e46('0x12')](_0x9e46('0xf'),auth['isAuthenticated'](),controller[_0x9e46('0x14')]);router[_0x9e46('0x15')]('/:id',auth[_0x9e46('0xd')](),controller[_0x9e46('0x16')]);router['delete'](_0x9e46('0xc'),auth[_0x9e46('0xd')](),controller[_0x9e46('0x17')]);module[_0x9e46('0x18')]=router; \ No newline at end of file +var _0x92f2=['/:id','/:id/fields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x49fb1c,_0x113891){var _0x36cc02=function(_0x308d72){while(--_0x308d72){_0x49fb1c['push'](_0x49fb1c['shift']());}};_0x36cc02(++_0x113891);}(_0x92f2,0x126));var _0x292f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x92f2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x292f('0x0'));var util=require('util');var path=require(_0x292f('0x1'));var timeout=require('connect-timeout');var express=require(_0x292f('0x2'));var router=express[_0x292f('0x3')]();var fs_extra=require(_0x292f('0x4'));var auth=require(_0x292f('0x5'));var interaction=require(_0x292f('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x292f('0x7')]('/',auth[_0x292f('0x8')](),controller[_0x292f('0x9')]);router[_0x292f('0x7')](_0x292f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x292f('0x7')]('/:id/configurations',auth[_0x292f('0x8')](),controller['getConfigurations']);router[_0x292f('0x7')](_0x292f('0xb'),auth[_0x292f('0x8')](),controller['getFields']);router[_0x292f('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x292f('0xc')](_0x292f('0xd'),auth[_0x292f('0x8')](),controller[_0x292f('0xe')]);router[_0x292f('0xf')](_0x292f('0xa'),auth[_0x292f('0x8')](),controller[_0x292f('0x10')]);router[_0x292f('0x11')](_0x292f('0xa'),auth[_0x292f('0x8')](),controller[_0x292f('0x12')]);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 aa3c555..f75ad61 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 _0x4991=['STRING','username','remoteUri','sequelize'];(function(_0x5e487a,_0x3e43eb){var _0x204a9e=function(_0x3447cb){while(--_0x3447cb){_0x5e487a['push'](_0x5e487a['shift']());}};_0x204a9e(++_0x3e43eb);}(_0x4991,0xf7));var _0x1499=function(_0x4ce6fa,_0x26a348){_0x4ce6fa=_0x4ce6fa-0x0;var _0xcd00be=_0x4991[_0x4ce6fa];return _0xcd00be;};'use strict';var Sequelize=require(_0x1499('0x0'));module['exports']={'name':{'type':Sequelize[_0x1499('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x2')},'apiKey':{'type':Sequelize[_0x1499('0x1')]},'remoteUri':{'type':Sequelize[_0x1499('0x1')],'unique':_0x1499('0x3')},'serverUrl':{'type':Sequelize[_0x1499('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x55f160,_0x722f1f){var _0x1ddce6=function(_0x28552a){while(--_0x28552a){_0x55f160['push'](_0x55f160['shift']());}};_0x1ddce6(++_0x722f1f);}(_0x7916,0x128));var _0x6791=function(_0x478e89,_0x9d1545){_0x478e89=_0x478e89-0x0;var _0x4eb4e5=_0x7916[_0x478e89];return _0x4eb4e5;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 6b158b8..c0e0b6b 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 _0x6be1=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','options','FreshdeskAccount','includeAll','include','rows','catch','show','params','merge','create','body','find','destroy','getConfigurations','findOne','order','pick','map','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','company','remove','includes','default','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','Content-Range','json','apply','save','update','then','error','stack','name','send'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6be1,0x12f));var _0x16be=function(_0x15e197,_0x254a5d){_0x15e197=_0x15e197-0x0;var _0x2ea455=_0x6be1[_0x15e197];return _0x2ea455;};'use strict';var emlformat=require(_0x16be('0x0'));var rimraf=require(_0x16be('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16be('0x2'));var Mustache=require(_0x16be('0x3'));var util=require(_0x16be('0x4'));var path=require(_0x16be('0x5'));var sox=require(_0x16be('0x6'));var csv=require(_0x16be('0x7'));var ejs=require(_0x16be('0x8'));var fs=require('fs');var fs_extra=require(_0x16be('0x9'));var _=require(_0x16be('0xa'));var squel=require(_0x16be('0xb'));var crypto=require('crypto');var jsforce=require(_0x16be('0xc'));var deskjs=require(_0x16be('0xd'));var toCsv=require(_0x16be('0x7'));var querystring=require(_0x16be('0xe'));var Papa=require(_0x16be('0xf'));var Redis=require(_0x16be('0x10'));var authService=require(_0x16be('0x11'));var qs=require(_0x16be('0x12'));var as=require(_0x16be('0x13'));var hardwareService=require(_0x16be('0x14'));var logger=require(_0x16be('0x15'))(_0x16be('0x16'));var utils=require(_0x16be('0x17'));var config=require(_0x16be('0x18'));var licenseUtil=require(_0x16be('0x19'));var db=require(_0x16be('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13aa8c,_0xb321f1){_0xb321f1=_0xb321f1||0xcc;return function(_0xe2330d){if(_0xe2330d){return _0x13aa8c[_0x16be('0x1b')](_0xb321f1);}return _0x13aa8c[_0x16be('0x1c')](_0xb321f1)['end']();};}function respondWithResult(_0x16e9f1,_0xcf91fc){_0xcf91fc=_0xcf91fc||0xc8;return function(_0x5905ff){if(_0x5905ff){return _0x16e9f1[_0x16be('0x1c')](_0xcf91fc)['json'](_0x5905ff);}};}function respondWithFilteredResult(_0x557de5,_0x5f3095){return function(_0x74e610){if(_0x74e610){var _0x3682f9=typeof _0x5f3095[_0x16be('0x1d')]==='undefined'&&typeof _0x5f3095[_0x16be('0x1e')]==='undefined';var _0x23b698=_0x74e610[_0x16be('0x1f')];var _0x10ee4e=_0x3682f9?0x0:_0x5f3095[_0x16be('0x1d')];var _0x47d49d=_0x3682f9?_0x74e610[_0x16be('0x1f')]:_0x5f3095[_0x16be('0x1d')]+_0x5f3095['limit'];var _0x2875b3;if(_0x47d49d>=_0x23b698){_0x47d49d=_0x23b698;_0x2875b3=0xc8;}else{_0x2875b3=0xce;}_0x557de5[_0x16be('0x1c')](_0x2875b3);return _0x557de5['set'](_0x16be('0x20'),_0x10ee4e+'-'+_0x47d49d+'/'+_0x23b698)[_0x16be('0x21')](_0x74e610);}return null;};}function patchUpdates(_0x5944cc){return function(_0x23dbe0){try{jsonpatch[_0x16be('0x22')](_0x23dbe0,_0x5944cc,!![]);}catch(_0x4f6269){return BPromise['reject'](_0x4f6269);}return _0x23dbe0[_0x16be('0x23')]();};}function saveUpdates(_0xd99f60,_0x57f0fe){return function(_0xe8091){if(_0xe8091){return _0xe8091[_0x16be('0x24')](_0xd99f60)[_0x16be('0x25')](function(_0x110caa){return _0x110caa;});}return null;};}function removeEntity(_0x4a966b,_0x71a798){return function(_0x4525a2){if(_0x4525a2){return _0x4525a2['destroy']()[_0x16be('0x25')](function(){_0x4a966b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c5f97,_0x2feb94){return function(_0x50f310){if(!_0x50f310){_0x2c5f97[_0x16be('0x1b')](0x194);}return _0x50f310;};}function handleError(_0x334bc6,_0x3cd6cb){_0x3cd6cb=_0x3cd6cb||0x1f4;return function(_0x1580d5){logger[_0x16be('0x26')](_0x1580d5[_0x16be('0x27')]);if(_0x1580d5[_0x16be('0x28')]){delete _0x1580d5[_0x16be('0x28')];}_0x334bc6['status'](_0x3cd6cb)[_0x16be('0x29')](_0x1580d5);};}exports['index']=function(_0x8f8394,_0x37d1dd){var _0x132848={},_0x94f5d={},_0x19be4f={'count':0x0,'rows':[]};var _0x3e021d=_['map'](db['FreshdeskAccount'][_0x16be('0x2a')],function(_0x2fc389){return{'name':_0x2fc389[_0x16be('0x2b')],'type':_0x2fc389[_0x16be('0x2c')]['key']};});_0x94f5d[_0x16be('0x2d')]=_['map'](_0x3e021d,_0x16be('0x28'));_0x94f5d[_0x16be('0x2e')]=_[_0x16be('0x2f')](_0x8f8394[_0x16be('0x2e')]);_0x94f5d[_0x16be('0x30')]=_[_0x16be('0x31')](_0x94f5d['model'],_0x94f5d[_0x16be('0x2e')]);_0x132848[_0x16be('0x32')]=_[_0x16be('0x31')](_0x94f5d['model'],qs['fields'](_0x8f8394[_0x16be('0x2e')][_0x16be('0x33')]));_0x132848[_0x16be('0x32')]=_0x132848[_0x16be('0x32')][_0x16be('0x34')]?_0x132848[_0x16be('0x32')]:_0x94f5d[_0x16be('0x2d')];if(!_0x8f8394['query']['hasOwnProperty'](_0x16be('0x35'))){_0x132848[_0x16be('0x1e')]=qs[_0x16be('0x1e')](_0x8f8394[_0x16be('0x2e')]['limit']);_0x132848[_0x16be('0x1d')]=qs[_0x16be('0x1d')](_0x8f8394[_0x16be('0x2e')][_0x16be('0x1d')]);}_0x132848['order']=qs[_0x16be('0x36')](_0x8f8394['query']['sort']);_0x132848[_0x16be('0x37')]=qs[_0x16be('0x30')](_['pick'](_0x8f8394[_0x16be('0x2e')],_0x94f5d[_0x16be('0x30')]),_0x3e021d);if(_0x8f8394[_0x16be('0x2e')][_0x16be('0x38')]){_0x132848[_0x16be('0x37')]=_['merge'](_0x132848[_0x16be('0x37')],{'$or':_['map'](_0x3e021d,function(_0x588746){if(_0x588746[_0x16be('0x2c')]!==_0x16be('0x39')){var _0x2de984={};_0x2de984[_0x588746['name']]={'$like':'%'+_0x8f8394[_0x16be('0x2e')][_0x16be('0x38')]+'%'};return _0x2de984;}})});}_0x132848=_['merge']({},_0x132848,_0x8f8394[_0x16be('0x3a')]);var _0x5321d4={'where':_0x132848[_0x16be('0x37')]};return db[_0x16be('0x3b')][_0x16be('0x1f')](_0x5321d4)[_0x16be('0x25')](function(_0x7ad81f){_0x19be4f[_0x16be('0x1f')]=_0x7ad81f;if(_0x8f8394[_0x16be('0x2e')][_0x16be('0x3c')]){_0x132848[_0x16be('0x3d')]=[{'all':!![]}];}return db[_0x16be('0x3b')]['findAll'](_0x132848);})[_0x16be('0x25')](function(_0x287e2d){_0x19be4f[_0x16be('0x3e')]=_0x287e2d;return _0x19be4f;})['then'](respondWithFilteredResult(_0x37d1dd,_0x132848))[_0x16be('0x3f')](handleError(_0x37d1dd,null));};exports[_0x16be('0x40')]=function(_0x1e9e4f,_0x47b61e){var _0x2814c3={'raw':![],'where':{'id':_0x1e9e4f[_0x16be('0x41')]['id']}},_0x59c888={};_0x59c888[_0x16be('0x2d')]=_['keys'](db[_0x16be('0x3b')]['rawAttributes']);_0x59c888[_0x16be('0x2e')]=_['keys'](_0x1e9e4f[_0x16be('0x2e')]);_0x59c888[_0x16be('0x30')]=_[_0x16be('0x31')](_0x59c888['model'],_0x59c888[_0x16be('0x2e')]);_0x2814c3['attributes']=_[_0x16be('0x31')](_0x59c888[_0x16be('0x2d')],qs['fields'](_0x1e9e4f[_0x16be('0x2e')][_0x16be('0x33')]));_0x2814c3[_0x16be('0x32')]=_0x2814c3[_0x16be('0x32')][_0x16be('0x34')]?_0x2814c3[_0x16be('0x32')]:_0x59c888[_0x16be('0x2d')];if(_0x1e9e4f['query'][_0x16be('0x3c')]){_0x2814c3[_0x16be('0x3d')]=[{'all':!![]}];}_0x2814c3=_[_0x16be('0x42')]({},_0x2814c3,_0x1e9e4f[_0x16be('0x3a')]);return db[_0x16be('0x3b')]['find'](_0x2814c3)[_0x16be('0x25')](handleEntityNotFound(_0x47b61e,null))[_0x16be('0x25')](respondWithResult(_0x47b61e,null))[_0x16be('0x3f')](handleError(_0x47b61e,null));};exports[_0x16be('0x43')]=function(_0x5ce6e9,_0x5df861){return db[_0x16be('0x3b')][_0x16be('0x43')](_0x5ce6e9['body'],{})['then'](respondWithResult(_0x5df861,0xc9))[_0x16be('0x3f')](handleError(_0x5df861,null));};exports[_0x16be('0x24')]=function(_0x84f107,_0x281851){if(_0x84f107[_0x16be('0x44')]['id']){delete _0x84f107[_0x16be('0x44')]['id'];}return db[_0x16be('0x3b')][_0x16be('0x45')]({'where':{'id':_0x84f107[_0x16be('0x41')]['id']}})[_0x16be('0x25')](handleEntityNotFound(_0x281851,null))[_0x16be('0x25')](saveUpdates(_0x84f107['body'],null))[_0x16be('0x25')](respondWithResult(_0x281851,null))[_0x16be('0x3f')](handleError(_0x281851,null));};exports[_0x16be('0x46')]=function(_0x297aad,_0x1a0650){return db[_0x16be('0x3b')][_0x16be('0x45')]({'where':{'id':_0x297aad[_0x16be('0x41')]['id']}})[_0x16be('0x25')](handleEntityNotFound(_0x1a0650,null))[_0x16be('0x25')](removeEntity(_0x1a0650,null))['catch'](handleError(_0x1a0650,null));};exports[_0x16be('0x47')]=function(_0x448316,_0x4129d6,_0x46cc65){var _0x50609e={};var _0x12ef78={};var _0x404a39;var _0x2897b1;return db[_0x16be('0x3b')][_0x16be('0x48')]({'where':{'id':_0x448316[_0x16be('0x41')]['id']}})['then'](handleEntityNotFound(_0x4129d6,null))[_0x16be('0x25')](function(_0x4b7459){if(_0x4b7459){_0x404a39=_0x4b7459;_0x12ef78[_0x16be('0x2d')]=_[_0x16be('0x2f')](db['FreshdeskConfiguration']['rawAttributes']);_0x12ef78['query']=_['keys'](_0x448316['query']);_0x12ef78['filters']=_[_0x16be('0x31')](_0x12ef78['model'],_0x12ef78[_0x16be('0x2e')]);_0x50609e['attributes']=_[_0x16be('0x31')](_0x12ef78['model'],qs[_0x16be('0x33')](_0x448316['query'][_0x16be('0x33')]));_0x50609e[_0x16be('0x32')]=_0x50609e[_0x16be('0x32')][_0x16be('0x34')]?_0x50609e[_0x16be('0x32')]:_0x12ef78[_0x16be('0x2d')];_0x50609e[_0x16be('0x49')]=qs[_0x16be('0x36')](_0x448316[_0x16be('0x2e')][_0x16be('0x36')]);_0x50609e['where']=qs[_0x16be('0x30')](_[_0x16be('0x4a')](_0x448316[_0x16be('0x2e')],_0x12ef78[_0x16be('0x30')]));if(_0x448316[_0x16be('0x2e')][_0x16be('0x38')]){_0x50609e[_0x16be('0x37')]=_[_0x16be('0x42')](_0x50609e[_0x16be('0x37')],{'$or':_[_0x16be('0x4b')](_0x50609e[_0x16be('0x32')],function(_0x354848){var _0x35185b={};_0x35185b[_0x354848]={'$like':'%'+_0x448316[_0x16be('0x2e')][_0x16be('0x38')]+'%'};return _0x35185b;})});}_0x50609e=_[_0x16be('0x42')]({},_0x50609e,_0x448316[_0x16be('0x3a')]);return _0x404a39['getConfigurations'](_0x50609e);}})[_0x16be('0x25')](function(_0x14e08a){if(_0x14e08a){_0x2897b1=_0x14e08a[_0x16be('0x34')];if(!_0x448316[_0x16be('0x2e')][_0x16be('0x4c')](_0x16be('0x35'))){_0x50609e['limit']=qs[_0x16be('0x1e')](_0x448316['query']['limit']);_0x50609e[_0x16be('0x1d')]=qs[_0x16be('0x1d')](_0x448316['query'][_0x16be('0x1d')]);}return _0x404a39[_0x16be('0x47')](_0x50609e);}})[_0x16be('0x25')](function(_0x57cfdd){if(_0x57cfdd){return _0x57cfdd?{'count':_0x2897b1,'rows':_0x57cfdd}:null;}})['then'](respondWithResult(_0x4129d6,null))[_0x16be('0x3f')](handleError(_0x4129d6,null));};exports[_0x16be('0x4d')]=function(_0x16f8f3,_0x522ca6,_0x1f11a2){if(_0x16f8f3[_0x16be('0x44')]['id']){delete _0x16f8f3[_0x16be('0x44')]['id'];}return db[_0x16be('0x3b')]['findOne']({'where':{'id':_0x16f8f3[_0x16be('0x41')]['id']}})[_0x16be('0x25')](handleEntityNotFound(_0x522ca6,null))[_0x16be('0x25')](function(_0x5bc4ba){if(_0x5bc4ba){_0x16f8f3[_0x16be('0x44')][_0x16be('0x4e')]=_0x5bc4ba['id'];_0x16f8f3[_0x16be('0x44')]['Subjects']=integrations[_0x16be('0x4f')](_0x16f8f3[_0x16be('0x44')][_0x16be('0x50')],_0x16f8f3['body']['type']);_0x16f8f3['body'][_0x16be('0x51')]=integrations[_0x16be('0x52')](_0x16f8f3[_0x16be('0x44')]['channel'],_0x16f8f3['body'][_0x16be('0x2c')]);return db['FreshdeskConfiguration'][_0x16be('0x43')](_0x16f8f3['body'],{'include':[{'model':db[_0x16be('0x53')],'as':_0x16be('0x54')},{'model':db[_0x16be('0x53')],'as':_0x16be('0x51')}]});}return null;})['then'](respondWithResult(_0x522ca6,null))[_0x16be('0x3f')](handleError(_0x522ca6,null));};exports[_0x16be('0x55')]=function(_0x5ba03b,_0xc59732,_0x546034){var _0x3d274a='';return db[_0x16be('0x3b')][_0x16be('0x48')]({'where':{'id':_0x5ba03b[_0x16be('0x41')]['id']},'attributes':['id',_0x16be('0x56'),_0x16be('0x57')]})['then'](handleEntityNotFound(_0xc59732,null))[_0x16be('0x25')](function(_0x3c82e3){if(_0x3c82e3){_0x3d274a=_0x3c82e3[_0x16be('0x56')];var _0x517f22=_0x3d274a[_0x16be('0x58')](-0x1);if(_0x517f22==='/'){_0x3d274a=_0x3d274a[_0x16be('0x59')](0x0,_0x3d274a['lastIndexOf'](_0x517f22));}return rp({'method':'GET','uri':util[_0x16be('0x5a')](_0x16be('0x5b'),_0x3d274a,_0x16be('0x5c')),'headers':{'Authorization':util[_0x16be('0x5a')]('Basic\x20%s',new Buffer(util['format'](_0x16be('0x5d'),_0x3c82e3['apiKey']))[_0x16be('0x5e')](_0x16be('0x5f')))},'json':!![]});}})[_0x16be('0x25')](function(_0x556cfc){if(_0x556cfc){var _0x33096a=[_0x16be('0x60'),_0x16be('0x61'),_0x16be('0x62'),_0x16be('0x63'),'status',_0x16be('0x64'),'group',_0x16be('0x65'),_0x16be('0x66'),_0x16be('0x67'),_0x16be('0x68')];_[_0x16be('0x69')](_0x556cfc,function(_0x4db9bc){return _0x33096a[_0x16be('0x6a')](_0x4db9bc['name'])||!_0x4db9bc[_0x16be('0x6b')]&&_0x4db9bc[_0x16be('0x2c')]!=='custom_text'&&_0x4db9bc['type']!=='custom_dropdown';});return{'count':_0x556cfc[_0x16be('0x34')],'rows':_[_0x16be('0x4b')](_0x556cfc,function(_0x5ab349){return{'id':_0x5ab349['name'],'name':_0x5ab349[_0x16be('0x6c')],'custom':!_0x5ab349[_0x16be('0x6b')],'options':_0x5ab349[_0x16be('0x6d')]?_[_0x16be('0x4b')](_0x5ab349['choices'],function(_0x3f2c92){return{'name':_[_0x16be('0x6e')](_0x3f2c92),'value':_0x3f2c92};}):[]};})};}})[_0x16be('0x25')](respondWithResult(_0xc59732,null))['catch'](function(_0x57b2eb){var _0x4fa8e8=_0x5ba03b[_0x16be('0x2e')][_0x16be('0x6f')]?0x1f4:_0x57b2eb[_0x16be('0x70')]||0x1f4;logger[_0x16be('0x26')](_0x16be('0x71'),_0x16be('0x55'),_0x4fa8e8,JSON[_0x16be('0x72')](_0x57b2eb));delete _0x57b2eb[_0x16be('0x28')];if(_0x4fa8e8===0x191){_0x4fa8e8=0x190;}_0xc59732[_0x16be('0x1c')](_0x4fa8e8)[_0x16be('0x29')](_0x5ba03b['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x57b2eb[_0x16be('0x70')]}:_0x57b2eb);});}; \ No newline at end of file +var _0xb84e=['index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','where','filters','pick','filter','VIRTUAL','options','include','findAll','catch','show','includeAll','merge','body','find','params','FreshdeskConfiguration','sort','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','create','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send'];(function(_0x304957,_0x486700){var _0x374ca2=function(_0x1123b3){while(--_0x1123b3){_0x304957['push'](_0x304957['shift']());}};_0x374ca2(++_0x486700);}(_0xb84e,0xbf));var _0xeb84=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0xb84e[_0x59e821];return _0x5333f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb84('0x0'));var zipdir=require(_0xeb84('0x1'));var jsonpatch=require(_0xeb84('0x2'));var rp=require(_0xeb84('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb84('0x4'));var util=require(_0xeb84('0x5'));var path=require(_0xeb84('0x6'));var sox=require(_0xeb84('0x7'));var csv=require(_0xeb84('0x8'));var ejs=require(_0xeb84('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb84('0xa'));var crypto=require('crypto');var jsforce=require(_0xeb84('0xb'));var deskjs=require(_0xeb84('0xc'));var toCsv=require(_0xeb84('0x8'));var querystring=require(_0xeb84('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb84('0xe'));var authService=require(_0xeb84('0xf'));var qs=require(_0xeb84('0x10'));var as=require(_0xeb84('0x11'));var hardwareService=require(_0xeb84('0x12'));var logger=require(_0xeb84('0x13'))(_0xeb84('0x14'));var utils=require(_0xeb84('0x15'));var config=require(_0xeb84('0x16'));var licenseUtil=require(_0xeb84('0x17'));var db=require(_0xeb84('0x18'))['db'];var integrations=require(_0xeb84('0x19'));function respondWithStatusCode(_0xfe7209,_0x59692e){_0x59692e=_0x59692e||0xcc;return function(_0x5bab5f){if(_0x5bab5f){return _0xfe7209[_0xeb84('0x1a')](_0x59692e);}return _0xfe7209[_0xeb84('0x1b')](_0x59692e)[_0xeb84('0x1c')]();};}function respondWithResult(_0x24cb39,_0x460016){_0x460016=_0x460016||0xc8;return function(_0xf54282){if(_0xf54282){return _0x24cb39['status'](_0x460016)[_0xeb84('0x1d')](_0xf54282);}};}function respondWithFilteredResult(_0x457b61,_0x105382){return function(_0xff258e){if(_0xff258e){var _0x4e7839=typeof _0x105382[_0xeb84('0x1e')]===_0xeb84('0x1f')&&typeof _0x105382[_0xeb84('0x20')]===_0xeb84('0x1f');var _0x3c5415=_0xff258e['count'];var _0x6ec07d=_0x4e7839?0x0:_0x105382['offset'];var _0x360575=_0x4e7839?_0xff258e[_0xeb84('0x21')]:_0x105382[_0xeb84('0x1e')]+_0x105382['limit'];var _0x568a75;if(_0x360575>=_0x3c5415){_0x360575=_0x3c5415;_0x568a75=0xc8;}else{_0x568a75=0xce;}_0x457b61[_0xeb84('0x1b')](_0x568a75);return _0x457b61[_0xeb84('0x22')](_0xeb84('0x23'),_0x6ec07d+'-'+_0x360575+'/'+_0x3c5415)[_0xeb84('0x1d')](_0xff258e);}return null;};}function patchUpdates(_0x3401ce){return function(_0x30f460){try{jsonpatch[_0xeb84('0x24')](_0x30f460,_0x3401ce,!![]);}catch(_0x224c91){return BPromise[_0xeb84('0x25')](_0x224c91);}return _0x30f460[_0xeb84('0x26')]();};}function saveUpdates(_0x159622,_0xea877a){return function(_0x3d0789){if(_0x3d0789){return _0x3d0789[_0xeb84('0x27')](_0x159622)[_0xeb84('0x28')](function(_0xae2c58){return _0xae2c58;});}return null;};}function removeEntity(_0x507115,_0x22ebf7){return function(_0x64b4ac){if(_0x64b4ac){return _0x64b4ac['destroy']()[_0xeb84('0x28')](function(){_0x507115[_0xeb84('0x1b')](0xcc)[_0xeb84('0x1c')]();});}};}function handleEntityNotFound(_0x993591,_0x3ccca6){return function(_0x31634b){if(!_0x31634b){_0x993591[_0xeb84('0x1a')](0x194);}return _0x31634b;};}function handleError(_0x4c805a,_0x4fae19){_0x4fae19=_0x4fae19||0x1f4;return function(_0x3cb622){logger[_0xeb84('0x29')](_0x3cb622[_0xeb84('0x2a')]);if(_0x3cb622[_0xeb84('0x2b')]){delete _0x3cb622[_0xeb84('0x2b')];}_0x4c805a[_0xeb84('0x1b')](_0x4fae19)[_0xeb84('0x2c')](_0x3cb622);};}exports[_0xeb84('0x2d')]=function(_0x397ecf,_0x87142a){var _0x2cd088={},_0x238772={},_0x414be4={'count':0x0,'rows':[]};var _0xb914ec=_['map'](db[_0xeb84('0x2e')][_0xeb84('0x2f')],function(_0x3e6bd5){return{'name':_0x3e6bd5[_0xeb84('0x30')],'type':_0x3e6bd5[_0xeb84('0x31')][_0xeb84('0x32')]};});_0x238772[_0xeb84('0x33')]=_[_0xeb84('0x34')](_0xb914ec,_0xeb84('0x2b'));_0x238772[_0xeb84('0x35')]=_[_0xeb84('0x36')](_0x397ecf['query']);_0x238772['filters']=_[_0xeb84('0x37')](_0x238772['model'],_0x238772[_0xeb84('0x35')]);_0x2cd088[_0xeb84('0x38')]=_[_0xeb84('0x37')](_0x238772[_0xeb84('0x33')],qs['fields'](_0x397ecf['query'][_0xeb84('0x39')]));_0x2cd088[_0xeb84('0x38')]=_0x2cd088['attributes'][_0xeb84('0x3a')]?_0x2cd088[_0xeb84('0x38')]:_0x238772['model'];if(!_0x397ecf[_0xeb84('0x35')][_0xeb84('0x3b')]('nolimit')){_0x2cd088[_0xeb84('0x20')]=qs['limit'](_0x397ecf['query'][_0xeb84('0x20')]);_0x2cd088['offset']=qs[_0xeb84('0x1e')](_0x397ecf[_0xeb84('0x35')][_0xeb84('0x1e')]);}_0x2cd088[_0xeb84('0x3c')]=qs['sort'](_0x397ecf[_0xeb84('0x35')]['sort']);_0x2cd088[_0xeb84('0x3d')]=qs[_0xeb84('0x3e')](_[_0xeb84('0x3f')](_0x397ecf[_0xeb84('0x35')],_0x238772[_0xeb84('0x3e')]),_0xb914ec);if(_0x397ecf[_0xeb84('0x35')][_0xeb84('0x40')]){_0x2cd088[_0xeb84('0x3d')]=_['merge'](_0x2cd088[_0xeb84('0x3d')],{'$or':_[_0xeb84('0x34')](_0xb914ec,function(_0x46df8a){if(_0x46df8a[_0xeb84('0x31')]!==_0xeb84('0x41')){var _0x413e36={};_0x413e36[_0x46df8a['name']]={'$like':'%'+_0x397ecf['query'][_0xeb84('0x40')]+'%'};return _0x413e36;}})});}_0x2cd088=_['merge']({},_0x2cd088,_0x397ecf[_0xeb84('0x42')]);var _0xa84c41={'where':_0x2cd088[_0xeb84('0x3d')]};return db['FreshdeskAccount'][_0xeb84('0x21')](_0xa84c41)[_0xeb84('0x28')](function(_0x1ee328){_0x414be4['count']=_0x1ee328;if(_0x397ecf[_0xeb84('0x35')]['includeAll']){_0x2cd088[_0xeb84('0x43')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xeb84('0x44')](_0x2cd088);})[_0xeb84('0x28')](function(_0x5095f3){_0x414be4['rows']=_0x5095f3;return _0x414be4;})[_0xeb84('0x28')](respondWithFilteredResult(_0x87142a,_0x2cd088))[_0xeb84('0x45')](handleError(_0x87142a,null));};exports[_0xeb84('0x46')]=function(_0x4e4df3,_0x4eb810){var _0x20edc6={'raw':![],'where':{'id':_0x4e4df3['params']['id']}},_0x354d83={};_0x354d83[_0xeb84('0x33')]=_['keys'](db[_0xeb84('0x2e')][_0xeb84('0x2f')]);_0x354d83['query']=_[_0xeb84('0x36')](_0x4e4df3[_0xeb84('0x35')]);_0x354d83[_0xeb84('0x3e')]=_[_0xeb84('0x37')](_0x354d83[_0xeb84('0x33')],_0x354d83[_0xeb84('0x35')]);_0x20edc6['attributes']=_[_0xeb84('0x37')](_0x354d83[_0xeb84('0x33')],qs['fields'](_0x4e4df3[_0xeb84('0x35')]['fields']));_0x20edc6['attributes']=_0x20edc6[_0xeb84('0x38')][_0xeb84('0x3a')]?_0x20edc6[_0xeb84('0x38')]:_0x354d83[_0xeb84('0x33')];if(_0x4e4df3['query'][_0xeb84('0x47')]){_0x20edc6[_0xeb84('0x43')]=[{'all':!![]}];}_0x20edc6=_[_0xeb84('0x48')]({},_0x20edc6,_0x4e4df3[_0xeb84('0x42')]);return db[_0xeb84('0x2e')]['find'](_0x20edc6)[_0xeb84('0x28')](handleEntityNotFound(_0x4eb810,null))['then'](respondWithResult(_0x4eb810,null))['catch'](handleError(_0x4eb810,null));};exports['create']=function(_0x24cc99,_0x1087da){return db[_0xeb84('0x2e')]['create'](_0x24cc99[_0xeb84('0x49')],{})[_0xeb84('0x28')](respondWithResult(_0x1087da,0xc9))[_0xeb84('0x45')](handleError(_0x1087da,null));};exports[_0xeb84('0x27')]=function(_0x130047,_0x5b9374){if(_0x130047['body']['id']){delete _0x130047['body']['id'];}return db['FreshdeskAccount'][_0xeb84('0x4a')]({'where':{'id':_0x130047[_0xeb84('0x4b')]['id']}})[_0xeb84('0x28')](handleEntityNotFound(_0x5b9374,null))['then'](saveUpdates(_0x130047[_0xeb84('0x49')],null))[_0xeb84('0x28')](respondWithResult(_0x5b9374,null))['catch'](handleError(_0x5b9374,null));};exports['destroy']=function(_0x2837f5,_0xb77b41){return db['FreshdeskAccount']['find']({'where':{'id':_0x2837f5[_0xeb84('0x4b')]['id']}})['then'](handleEntityNotFound(_0xb77b41,null))[_0xeb84('0x28')](removeEntity(_0xb77b41,null))['catch'](handleError(_0xb77b41,null));};exports['getConfigurations']=function(_0x880f19,_0x541829,_0x1529dc){var _0x3aa4b8={};var _0x2ad97c={};var _0x591a7e;var _0x2c0673;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x880f19[_0xeb84('0x4b')]['id']}})[_0xeb84('0x28')](handleEntityNotFound(_0x541829,null))['then'](function(_0x53c259){if(_0x53c259){_0x591a7e=_0x53c259;_0x2ad97c['model']=_['keys'](db[_0xeb84('0x4c')][_0xeb84('0x2f')]);_0x2ad97c[_0xeb84('0x35')]=_[_0xeb84('0x36')](_0x880f19['query']);_0x2ad97c[_0xeb84('0x3e')]=_[_0xeb84('0x37')](_0x2ad97c['model'],_0x2ad97c[_0xeb84('0x35')]);_0x3aa4b8[_0xeb84('0x38')]=_[_0xeb84('0x37')](_0x2ad97c[_0xeb84('0x33')],qs['fields'](_0x880f19[_0xeb84('0x35')]['fields']));_0x3aa4b8[_0xeb84('0x38')]=_0x3aa4b8[_0xeb84('0x38')][_0xeb84('0x3a')]?_0x3aa4b8['attributes']:_0x2ad97c[_0xeb84('0x33')];_0x3aa4b8[_0xeb84('0x3c')]=qs[_0xeb84('0x4d')](_0x880f19[_0xeb84('0x35')][_0xeb84('0x4d')]);_0x3aa4b8[_0xeb84('0x3d')]=qs[_0xeb84('0x3e')](_[_0xeb84('0x3f')](_0x880f19[_0xeb84('0x35')],_0x2ad97c[_0xeb84('0x3e')]));if(_0x880f19['query']['filter']){_0x3aa4b8[_0xeb84('0x3d')]=_[_0xeb84('0x48')](_0x3aa4b8[_0xeb84('0x3d')],{'$or':_[_0xeb84('0x34')](_0x3aa4b8[_0xeb84('0x38')],function(_0xc1f63a){var _0x79551f={};_0x79551f[_0xc1f63a]={'$like':'%'+_0x880f19[_0xeb84('0x35')]['filter']+'%'};return _0x79551f;})});}_0x3aa4b8=_['merge']({},_0x3aa4b8,_0x880f19[_0xeb84('0x42')]);return _0x591a7e[_0xeb84('0x4e')](_0x3aa4b8);}})[_0xeb84('0x28')](function(_0x3505f2){if(_0x3505f2){_0x2c0673=_0x3505f2[_0xeb84('0x3a')];if(!_0x880f19['query'][_0xeb84('0x3b')](_0xeb84('0x4f'))){_0x3aa4b8[_0xeb84('0x20')]=qs['limit'](_0x880f19[_0xeb84('0x35')]['limit']);_0x3aa4b8['offset']=qs[_0xeb84('0x1e')](_0x880f19['query'][_0xeb84('0x1e')]);}return _0x591a7e['getConfigurations'](_0x3aa4b8);}})['then'](function(_0x4fe2e8){if(_0x4fe2e8){return _0x4fe2e8?{'count':_0x2c0673,'rows':_0x4fe2e8}:null;}})['then'](respondWithResult(_0x541829,null))[_0xeb84('0x45')](handleError(_0x541829,null));};exports[_0xeb84('0x50')]=function(_0x10214d,_0x495813,_0x312bd8){if(_0x10214d[_0xeb84('0x49')]['id']){delete _0x10214d[_0xeb84('0x49')]['id'];}return db[_0xeb84('0x2e')][_0xeb84('0x51')]({'where':{'id':_0x10214d['params']['id']}})[_0xeb84('0x28')](handleEntityNotFound(_0x495813,null))[_0xeb84('0x28')](function(_0x1f232c){if(_0x1f232c){_0x10214d[_0xeb84('0x49')][_0xeb84('0x52')]=_0x1f232c['id'];_0x10214d[_0xeb84('0x49')][_0xeb84('0x53')]=integrations['getSubjects'](_0x10214d[_0xeb84('0x49')][_0xeb84('0x54')],_0x10214d['body'][_0xeb84('0x31')]);_0x10214d[_0xeb84('0x49')][_0xeb84('0x55')]=integrations[_0xeb84('0x56')](_0x10214d[_0xeb84('0x49')]['channel'],_0x10214d[_0xeb84('0x49')]['type']);return db['FreshdeskConfiguration'][_0xeb84('0x57')](_0x10214d[_0xeb84('0x49')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0xeb84('0x55')}]});}return null;})[_0xeb84('0x28')](respondWithResult(_0x495813,null))[_0xeb84('0x45')](handleError(_0x495813,null));};exports[_0xeb84('0x58')]=function(_0x3d3ead,_0x327c99,_0x371465){var _0x25daf1='';return db[_0xeb84('0x2e')][_0xeb84('0x51')]({'where':{'id':_0x3d3ead[_0xeb84('0x4b')]['id']},'attributes':['id',_0xeb84('0x59'),_0xeb84('0x5a')]})['then'](handleEntityNotFound(_0x327c99,null))['then'](function(_0x287900){if(_0x287900){_0x25daf1=_0x287900['remoteUri'];var _0x2d841a=_0x25daf1[_0xeb84('0x5b')](-0x1);if(_0x2d841a==='/'){_0x25daf1=_0x25daf1['substring'](0x0,_0x25daf1[_0xeb84('0x5c')](_0x2d841a));}return rp({'method':'GET','uri':util[_0xeb84('0x5d')](_0xeb84('0x5e'),_0x25daf1,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xeb84('0x5d')](_0xeb84('0x5f'),new Buffer(util['format'](_0xeb84('0x60'),_0x287900['apiKey']))[_0xeb84('0x61')](_0xeb84('0x62')))},'json':!![]});}})[_0xeb84('0x28')](function(_0x356ea3){if(_0x356ea3){var _0x1e9921=[_0xeb84('0x63'),_0xeb84('0x64'),_0xeb84('0x65'),_0xeb84('0x66'),_0xeb84('0x1b'),_0xeb84('0x67'),_0xeb84('0x68'),_0xeb84('0x69'),_0xeb84('0x6a'),'group','company'];_[_0xeb84('0x6b')](_0x356ea3,function(_0x38d0f2){return _0x1e9921[_0xeb84('0x6c')](_0x38d0f2[_0xeb84('0x2b')])||!_0x38d0f2['default']&&_0x38d0f2[_0xeb84('0x31')]!==_0xeb84('0x6d')&&_0x38d0f2[_0xeb84('0x31')]!=='custom_dropdown';});return{'count':_0x356ea3[_0xeb84('0x3a')],'rows':_[_0xeb84('0x34')](_0x356ea3,function(_0xb5b6d3){return{'id':_0xb5b6d3[_0xeb84('0x2b')],'name':_0xb5b6d3['label'],'custom':!_0xb5b6d3[_0xeb84('0x6e')],'options':_0xb5b6d3[_0xeb84('0x6f')]?_[_0xeb84('0x34')](_0xb5b6d3[_0xeb84('0x6f')],function(_0x1ab28d){return{'name':_[_0xeb84('0x70')](_0x1ab28d),'value':_0x1ab28d};}):[]};})};}})[_0xeb84('0x28')](respondWithResult(_0x327c99,null))[_0xeb84('0x45')](function(_0x1effa8){var _0x145fdd=_0x3d3ead[_0xeb84('0x35')][_0xeb84('0x71')]?0x1f4:_0x1effa8[_0xeb84('0x72')]||0x1f4;logger['error'](_0xeb84('0x73'),_0xeb84('0x58'),_0x145fdd,JSON[_0xeb84('0x74')](_0x1effa8));delete _0x1effa8['name'];if(_0x145fdd===0x191){_0x145fdd=0x190;}_0x327c99['status'](_0x145fdd)[_0xeb84('0x2c')](_0x3d3ead['query'][_0xeb84('0x71')]?{'message':_0xeb84('0x75'),'statusCode':_0x1effa8['statusCode']}:_0x1effa8);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 868cd0f..6dfa979 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 _0xfa8f=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports','define'];(function(_0x254baf,_0x443ac4){var _0x135897=function(_0x568c88){while(--_0x568c88){_0x254baf['push'](_0x254baf['shift']());}};_0x135897(++_0x443ac4);}(_0xfa8f,0x1ec));var _0xffa8=function(_0x27639f,_0x21ae2c){_0x27639f=_0x27639f-0x0;var _0x59ba8d=_0xfa8f[_0x27639f];return _0x59ba8d;};'use strict';var _=require(_0xffa8('0x0'));var util=require(_0xffa8('0x1'));var logger=require(_0xffa8('0x2'))(_0xffa8('0x3'));var moment=require(_0xffa8('0x4'));var BPromise=require(_0xffa8('0x5'));var rp=require(_0xffa8('0x6'));var fs=require('fs');var path=require(_0xffa8('0x7'));var rimraf=require('rimraf');var config=require(_0xffa8('0x8'));var attributes=require(_0xffa8('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xffa8('0xa')]=function(_0xe90b28,_0x160395){return _0xe90b28[_0xffa8('0xb')](_0xffa8('0xc'),attributes,{'tableName':_0xffa8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9132=['./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','int_freshdesk_accounts','util','../../config/logger','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9132,0x1a4));var _0x2913=function(_0x4e0355,_0x2e7a05){_0x4e0355=_0x4e0355-0x0;var _0x11f45f=_0x9132[_0x4e0355];return _0x11f45f;};'use strict';var _=require('lodash');var util=require(_0x2913('0x0'));var logger=require(_0x2913('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2913('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2913('0x3'));var config=require('../../config/environment');var attributes=require(_0x2913('0x4'));var integrations=require(_0x2913('0x5'));module['exports']=function(_0x516beb,_0x40ba1f){return _0x516beb[_0x2913('0x6')]('FreshdeskAccount',attributes,{'tableName':_0x2913('0x7'),'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 3393df0..ae0cf50 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 _0x84cc=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','limit','include','model','map','find','raw','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x84cc,0x1c6));var _0xc84c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x84cc[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xc84c('0x0'));var util=require('util');var moment=require(_0xc84c('0x1'));var BPromise=require(_0xc84c('0x2'));var rs=require(_0xc84c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc84c('0x4'))['db'];var utils=require(_0xc84c('0x5'));var logger=require(_0xc84c('0x6'))('rpc');var config=require(_0xc84c('0x7'));var jayson=require(_0xc84c('0x8'));var client=jayson[_0xc84c('0x9')][_0xc84c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2895f6,_0x1f0951,_0x2276b6){return new BPromise(function(_0x3f4ffd,_0x435163){return client[_0xc84c('0xb')](_0x2895f6,_0x2276b6)[_0xc84c('0xc')](function(_0x4c24eb){logger['info'](_0xc84c('0xd'),_0x1f0951,'request\x20sent');logger[_0xc84c('0xe')](_0xc84c('0xf'),_0x1f0951,_0xc84c('0x10'),JSON[_0xc84c('0x11')](_0x4c24eb));if(_0x4c24eb['error']){if(_0x4c24eb[_0xc84c('0x12')][_0xc84c('0x13')]===0x1f4){logger[_0xc84c('0x12')](_0xc84c('0xd'),_0x1f0951,_0x4c24eb[_0xc84c('0x12')][_0xc84c('0x14')]);return _0x435163(_0x4c24eb[_0xc84c('0x12')][_0xc84c('0x14')]);}logger[_0xc84c('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f0951,_0x4c24eb['error'][_0xc84c('0x14')]);return _0x3f4ffd(_0x4c24eb[_0xc84c('0x12')][_0xc84c('0x14')]);}else{logger[_0xc84c('0x15')](_0xc84c('0xd'),_0x1f0951,_0xc84c('0x10'));_0x3f4ffd(_0x4c24eb['result'][_0xc84c('0x14')]);}})[_0xc84c('0x16')](function(_0x11deb4){logger[_0xc84c('0x12')](_0xc84c('0xd'),_0x1f0951,_0x11deb4);_0x435163(_0x11deb4);});});}exports[_0xc84c('0x17')]=function(_0x51c938){var _0x1709e5=this;return new Promise(function(_0x34c30c,_0x57bcfe){return db[_0xc84c('0x18')][_0xc84c('0x19')]({'raw':_0x51c938[_0xc84c('0x1a')]?_0x51c938[_0xc84c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x51c938['options']?_0x51c938['options'][_0xc84c('0x1b')]||null:null,'attributes':_0x51c938[_0xc84c('0x1a')]?_0x51c938['options'][_0xc84c('0x1c')]||null:null,'limit':_0x51c938[_0xc84c('0x1a')]?_0x51c938[_0xc84c('0x1a')][_0xc84c('0x1d')]||null:null,'include':_0x51c938['options']?_0x51c938[_0xc84c('0x1a')]['include']?_['map'](_0x51c938['options'][_0xc84c('0x1e')],function(_0x530fc3){return{'model':db[_0x530fc3[_0xc84c('0x1f')]],'as':_0x530fc3['as'],'attributes':_0x530fc3[_0xc84c('0x1c')],'include':_0x530fc3[_0xc84c('0x1e')]?_[_0xc84c('0x20')](_0x530fc3[_0xc84c('0x1e')],function(_0x2dc122){return{'model':db[_0x2dc122[_0xc84c('0x1f')]],'as':_0x2dc122['as'],'attributes':_0x2dc122[_0xc84c('0x1c')],'include':_0x2dc122[_0xc84c('0x1e')]?_[_0xc84c('0x20')](_0x2dc122[_0xc84c('0x1e')],function(_0x21ec14){return{'model':db[_0x21ec14[_0xc84c('0x1f')]],'as':_0x21ec14['as'],'attributes':_0x21ec14['attributes']};}):[]};}):[]};}):[]:[]})[_0xc84c('0xc')](function(_0x338f81){logger[_0xc84c('0x15')](_0xc84c('0x17'),_0x51c938);logger[_0xc84c('0xe')]('GetFreshdeskAccount',_0x51c938,JSON[_0xc84c('0x11')](_0x338f81));_0x34c30c(_0x338f81);})[_0xc84c('0x16')](function(_0xb45743){logger[_0xc84c('0x12')](_0xc84c('0x17'),_0xb45743[_0xc84c('0x14')],_0x51c938);_0x57bcfe(_0x1709e5[_0xc84c('0x12')](0x1f4,_0xb45743[_0xc84c('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x150db0){var _0x3737b3=this;return new Promise(function(_0x4fa4c0,_0x5c9ea2){return db[_0xc84c('0x18')][_0xc84c('0x21')]({'raw':_0x150db0[_0xc84c('0x1a')]?_0x150db0[_0xc84c('0x1a')][_0xc84c('0x22')]===undefined?!![]:![]:!![],'where':_0x150db0['options']?_0x150db0['options'][_0xc84c('0x1b')]||null:null,'attributes':_0x150db0['options']?_0x150db0['options'][_0xc84c('0x1c')]||null:null,'include':_0x150db0[_0xc84c('0x1a')]?_0x150db0[_0xc84c('0x1a')][_0xc84c('0x1e')]?_[_0xc84c('0x20')](_0x150db0[_0xc84c('0x1a')][_0xc84c('0x1e')],function(_0x1f7fb1){return{'model':db[_0x1f7fb1[_0xc84c('0x1f')]],'as':_0x1f7fb1['as'],'attributes':_0x1f7fb1[_0xc84c('0x1c')],'include':_0x1f7fb1[_0xc84c('0x1e')]?_[_0xc84c('0x20')](_0x1f7fb1['include'],function(_0x57a01c){return{'model':db[_0x57a01c['model']],'as':_0x57a01c['as'],'attributes':_0x57a01c[_0xc84c('0x1c')],'include':_0x57a01c[_0xc84c('0x1e')]?_[_0xc84c('0x20')](_0x57a01c[_0xc84c('0x1e')],function(_0x39ff1b){return{'model':db[_0x39ff1b[_0xc84c('0x1f')]],'as':_0x39ff1b['as'],'attributes':_0x39ff1b[_0xc84c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc84c('0xc')](function(_0x289990){logger[_0xc84c('0x15')](_0xc84c('0x23'),_0x150db0);logger[_0xc84c('0xe')](_0xc84c('0x23'),_0x150db0,JSON[_0xc84c('0x11')](_0x289990));_0x4fa4c0(_0x289990);})[_0xc84c('0x16')](function(_0x8dcbe8){logger['error'](_0xc84c('0x23'),_0x8dcbe8[_0xc84c('0x14')],_0x150db0);_0x5c9ea2(_0x3737b3[_0xc84c('0x12')](0x1f4,_0x8dcbe8[_0xc84c('0x14')]));});});}; \ No newline at end of file +var _0x0460=['ShowFreshdeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','include','map','model','attributes','stringify','where'];(function(_0x2d09b0,_0x313dfc){var _0x121204=function(_0x21d3a6){while(--_0x21d3a6){_0x2d09b0['push'](_0x2d09b0['shift']());}};_0x121204(++_0x313dfc);}(_0x0460,0xab));var _0x0046=function(_0x283dc1,_0x19adee){_0x283dc1=_0x283dc1-0x0;var _0x49d8a4=_0x0460[_0x283dc1];return _0x49d8a4;};'use strict';var _=require(_0x0046('0x0'));var util=require(_0x0046('0x1'));var moment=require(_0x0046('0x2'));var BPromise=require('bluebird');var rs=require(_0x0046('0x3'));var fs=require('fs');var Redis=require(_0x0046('0x4'));var db=require(_0x0046('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0046('0x6'))('rpc');var config=require(_0x0046('0x7'));var jayson=require(_0x0046('0x8'));var client=jayson[_0x0046('0x9')][_0x0046('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x225be1,_0x421339,_0x21d97e){return new BPromise(function(_0x369814,_0x4e6d48){return client[_0x0046('0xb')](_0x225be1,_0x21d97e)[_0x0046('0xc')](function(_0x3b61bc){logger[_0x0046('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x421339,_0x0046('0xe'));logger[_0x0046('0xf')](_0x0046('0x10'),_0x421339,_0x0046('0xe'),JSON['stringify'](_0x3b61bc));if(_0x3b61bc[_0x0046('0x11')]){if(_0x3b61bc[_0x0046('0x11')][_0x0046('0x12')]===0x1f4){logger[_0x0046('0x11')](_0x0046('0x13'),_0x421339,_0x3b61bc[_0x0046('0x11')][_0x0046('0x14')]);return _0x4e6d48(_0x3b61bc[_0x0046('0x11')][_0x0046('0x14')]);}logger[_0x0046('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x421339,_0x3b61bc[_0x0046('0x11')][_0x0046('0x14')]);return _0x369814(_0x3b61bc[_0x0046('0x11')]['message']);}else{logger[_0x0046('0xd')](_0x0046('0x13'),_0x421339,'request\x20sent');_0x369814(_0x3b61bc['result'][_0x0046('0x14')]);}})[_0x0046('0x15')](function(_0x313301){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x421339,_0x313301);_0x4e6d48(_0x313301);});});}exports[_0x0046('0x16')]=function(_0x525c22){var _0x51519d=this;return new Promise(function(_0x44fe00,_0x21526f){return db[_0x0046('0x17')][_0x0046('0x18')]({'raw':_0x525c22['options']?_0x525c22[_0x0046('0x19')][_0x0046('0x1a')]===undefined?!![]:![]:!![],'where':_0x525c22[_0x0046('0x19')]?_0x525c22['options']['where']||null:null,'attributes':_0x525c22[_0x0046('0x19')]?_0x525c22[_0x0046('0x19')]['attributes']||null:null,'limit':_0x525c22[_0x0046('0x19')]?_0x525c22[_0x0046('0x19')]['limit']||null:null,'include':_0x525c22[_0x0046('0x19')]?_0x525c22[_0x0046('0x19')][_0x0046('0x1b')]?_[_0x0046('0x1c')](_0x525c22['options'][_0x0046('0x1b')],function(_0x3be7c6){return{'model':db[_0x3be7c6[_0x0046('0x1d')]],'as':_0x3be7c6['as'],'attributes':_0x3be7c6[_0x0046('0x1e')],'include':_0x3be7c6['include']?_['map'](_0x3be7c6[_0x0046('0x1b')],function(_0x29b045){return{'model':db[_0x29b045['model']],'as':_0x29b045['as'],'attributes':_0x29b045['attributes'],'include':_0x29b045['include']?_[_0x0046('0x1c')](_0x29b045[_0x0046('0x1b')],function(_0x445549){return{'model':db[_0x445549[_0x0046('0x1d')]],'as':_0x445549['as'],'attributes':_0x445549[_0x0046('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0046('0xc')](function(_0x1a3022){logger['info'](_0x0046('0x16'),_0x525c22);logger['debug']('GetFreshdeskAccount',_0x525c22,JSON[_0x0046('0x1f')](_0x1a3022));_0x44fe00(_0x1a3022);})[_0x0046('0x15')](function(_0x2c5a8b){logger[_0x0046('0x11')](_0x0046('0x16'),_0x2c5a8b[_0x0046('0x14')],_0x525c22);_0x21526f(_0x51519d[_0x0046('0x11')](0x1f4,_0x2c5a8b[_0x0046('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0x866d14){var _0x6f97da=this;return new Promise(function(_0x4e49f3,_0x27c68a){return db['FreshdeskAccount']['find']({'raw':_0x866d14[_0x0046('0x19')]?_0x866d14[_0x0046('0x19')][_0x0046('0x1a')]===undefined?!![]:![]:!![],'where':_0x866d14[_0x0046('0x19')]?_0x866d14[_0x0046('0x19')][_0x0046('0x20')]||null:null,'attributes':_0x866d14[_0x0046('0x19')]?_0x866d14[_0x0046('0x19')][_0x0046('0x1e')]||null:null,'include':_0x866d14[_0x0046('0x19')]?_0x866d14[_0x0046('0x19')][_0x0046('0x1b')]?_[_0x0046('0x1c')](_0x866d14[_0x0046('0x19')][_0x0046('0x1b')],function(_0x3e9a08){return{'model':db[_0x3e9a08[_0x0046('0x1d')]],'as':_0x3e9a08['as'],'attributes':_0x3e9a08[_0x0046('0x1e')],'include':_0x3e9a08[_0x0046('0x1b')]?_[_0x0046('0x1c')](_0x3e9a08[_0x0046('0x1b')],function(_0x52aa36){return{'model':db[_0x52aa36[_0x0046('0x1d')]],'as':_0x52aa36['as'],'attributes':_0x52aa36[_0x0046('0x1e')],'include':_0x52aa36[_0x0046('0x1b')]?_[_0x0046('0x1c')](_0x52aa36[_0x0046('0x1b')],function(_0x2bb561){return{'model':db[_0x2bb561[_0x0046('0x1d')]],'as':_0x2bb561['as'],'attributes':_0x2bb561[_0x0046('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0046('0xc')](function(_0x4e32ad){logger[_0x0046('0xd')](_0x0046('0x21'),_0x866d14);logger[_0x0046('0xf')](_0x0046('0x21'),_0x866d14,JSON['stringify'](_0x4e32ad));_0x4e49f3(_0x4e32ad);})[_0x0046('0x15')](function(_0x3db27c){logger[_0x0046('0x11')]('ShowFreshdeskAccount',_0x3db27c[_0x0046('0x14')],_0x866d14);_0x27c68a(_0x6f97da[_0x0046('0x11')](0x1f4,_0x3db27c[_0x0046('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 6ae4648..78bf49a 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 _0x238d=['/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x420316,_0x45dc6d){var _0x8806b1=function(_0x4cddfc){while(--_0x4cddfc){_0x420316['push'](_0x420316['shift']());}};_0x8806b1(++_0x45dc6d);}(_0x238d,0xcf));var _0xd238=function(_0x49beda,_0x438b2b){_0x49beda=_0x49beda-0x0;var _0x224b50=_0x238d[_0x49beda];return _0x224b50;};'use strict';var multer=require(_0xd238('0x0'));var util=require(_0xd238('0x1'));var path=require(_0xd238('0x2'));var timeout=require(_0xd238('0x3'));var express=require(_0xd238('0x4'));var router=express[_0xd238('0x5')]();var fs_extra=require(_0xd238('0x6'));var auth=require(_0xd238('0x7'));var interaction=require(_0xd238('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0xd238('0x9')]('/',auth[_0xd238('0xa')](),controller['index']);router[_0xd238('0x9')](_0xd238('0xb'),auth[_0xd238('0xa')](),controller[_0xd238('0xc')]);router['get'](_0xd238('0xd'),auth[_0xd238('0xa')](),controller[_0xd238('0xe')]);router[_0xd238('0x9')](_0xd238('0xf'),auth[_0xd238('0xa')](),controller[_0xd238('0x10')]);router[_0xd238('0x9')](_0xd238('0x11'),auth[_0xd238('0xa')](),controller[_0xd238('0x12')]);router['get'](_0xd238('0x13'),auth[_0xd238('0xa')](),controller[_0xd238('0x14')]);router['post']('/',auth[_0xd238('0xa')](),controller[_0xd238('0x15')]);router[_0xd238('0x16')](_0xd238('0x13'),auth[_0xd238('0xa')](),controller[_0xd238('0x17')]);router[_0xd238('0x18')]('/:id',auth[_0xd238('0xa')](),controller[_0xd238('0x19')]);router[_0xd238('0x1a')]('/:id',auth[_0xd238('0xa')](),controller[_0xd238('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x1252=['post','setTags','put','/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x981a2b,_0x509bf7){var _0x3fd5c7=function(_0x43fc2d){while(--_0x43fc2d){_0x981a2b['push'](_0x981a2b['shift']());}};_0x3fd5c7(++_0x509bf7);}(_0x1252,0x1b7));var _0x2125=function(_0x330792,_0x26b33a){_0x330792=_0x330792-0x0;var _0x90c562=_0x1252[_0x330792];return _0x90c562;};'use strict';var multer=require(_0x2125('0x0'));var util=require(_0x2125('0x1'));var path=require('path');var timeout=require(_0x2125('0x2'));var express=require(_0x2125('0x3'));var router=express[_0x2125('0x4')]();var fs_extra=require(_0x2125('0x5'));var auth=require(_0x2125('0x6'));var interaction=require(_0x2125('0x7'));var config=require(_0x2125('0x8'));var controller=require(_0x2125('0x9'));router[_0x2125('0xa')]('/',auth['isAuthenticated'](),controller[_0x2125('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x2125('0xc')]);router['get'](_0x2125('0xd'),auth[_0x2125('0xe')](),controller[_0x2125('0xf')]);router['get'](_0x2125('0x10'),auth[_0x2125('0xe')](),controller[_0x2125('0x11')]);router['get'](_0x2125('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2125('0xa')](_0x2125('0x13'),auth[_0x2125('0xe')](),controller['getTags']);router[_0x2125('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2125('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2125('0x15')]);router[_0x2125('0x16')](_0x2125('0x17'),auth[_0x2125('0xe')](),controller['update']);router[_0x2125('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x2125('0x19')]);module[_0x2125('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 9ee7afc..80dbe4d 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 _0x35e2=['sequelize','STRING'];(function(_0x58e253,_0x30a9c3){var _0x2ffe75=function(_0x22d30b){while(--_0x22d30b){_0x58e253['push'](_0x58e253['shift']());}};_0x2ffe75(++_0x30a9c3);}(_0x35e2,0xa2));var _0x235e=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x35e2[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require(_0x235e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x235e('0x1')]}}; \ No newline at end of file +var _0x95bf=['STRING'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x95bf,0x10f));var _0xf95b=function(_0x2732da,_0x23e816){_0x2732da=_0x2732da-0x0;var _0x241842=_0x95bf[_0x2732da];return _0x241842;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf95b('0x0')]},'description':{'type':Sequelize[_0xf95b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 08999c7..36764d7 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 _0x84b0=['getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','create','body','find','params','destroy'];(function(_0x44e11d,_0x89718a){var _0x223f11=function(_0x2b8446){while(--_0x2b8446){_0x44e11d['push'](_0x44e11d['shift']());}};_0x223f11(++_0x89718a);}(_0x84b0,0x19d));var _0x084b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x84b0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x084b('0x0'));var rimraf=require(_0x084b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x084b('0x2'));var BPromise=require(_0x084b('0x3'));var Mustache=require(_0x084b('0x4'));var util=require(_0x084b('0x5'));var path=require(_0x084b('0x6'));var sox=require(_0x084b('0x7'));var csv=require(_0x084b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x084b('0x9'));var squel=require(_0x084b('0xa'));var crypto=require('crypto');var jsforce=require(_0x084b('0xb'));var deskjs=require(_0x084b('0xc'));var toCsv=require(_0x084b('0x8'));var querystring=require('querystring');var Papa=require(_0x084b('0xd'));var Redis=require(_0x084b('0xe'));var authService=require(_0x084b('0xf'));var qs=require(_0x084b('0x10'));var as=require(_0x084b('0x11'));var hardwareService=require(_0x084b('0x12'));var logger=require('../../config/logger')(_0x084b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x084b('0x14'));var db=require(_0x084b('0x15'))['db'];function respondWithStatusCode(_0x567ade,_0x18c6f8){_0x18c6f8=_0x18c6f8||0xcc;return function(_0x2794f9){if(_0x2794f9){return _0x567ade['sendStatus'](_0x18c6f8);}return _0x567ade[_0x084b('0x16')](_0x18c6f8)[_0x084b('0x17')]();};}function respondWithResult(_0x296b85,_0x3642dc){_0x3642dc=_0x3642dc||0xc8;return function(_0x412746){if(_0x412746){return _0x296b85['status'](_0x3642dc)[_0x084b('0x18')](_0x412746);}};}function respondWithFilteredResult(_0x502741,_0x30509a){return function(_0x255300){if(_0x255300){var _0x354c37=typeof _0x30509a[_0x084b('0x19')]===_0x084b('0x1a')&&typeof _0x30509a[_0x084b('0x1b')]===_0x084b('0x1a');var _0x39680a=_0x255300[_0x084b('0x1c')];var _0x12cfce=_0x354c37?0x0:_0x30509a[_0x084b('0x19')];var _0x2d3040=_0x354c37?_0x255300[_0x084b('0x1c')]:_0x30509a[_0x084b('0x19')]+_0x30509a[_0x084b('0x1b')];var _0x5aa34c;if(_0x2d3040>=_0x39680a){_0x2d3040=_0x39680a;_0x5aa34c=0xc8;}else{_0x5aa34c=0xce;}_0x502741[_0x084b('0x16')](_0x5aa34c);return _0x502741['set'](_0x084b('0x1d'),_0x12cfce+'-'+_0x2d3040+'/'+_0x39680a)[_0x084b('0x18')](_0x255300);}return null;};}function patchUpdates(_0x4ddbf8){return function(_0x1dbe1b){try{jsonpatch[_0x084b('0x1e')](_0x1dbe1b,_0x4ddbf8,!![]);}catch(_0x189b63){return BPromise[_0x084b('0x1f')](_0x189b63);}return _0x1dbe1b[_0x084b('0x20')]();};}function saveUpdates(_0xddcaf4,_0x23a4fc){return function(_0x6a4d73){if(_0x6a4d73){return _0x6a4d73[_0x084b('0x21')](_0xddcaf4)[_0x084b('0x22')](function(_0x141571){return _0x141571;});}return null;};}function removeEntity(_0x49e8f4,_0x178ed3){return function(_0x1739d4){if(_0x1739d4){return _0x1739d4['destroy']()[_0x084b('0x22')](function(){_0x49e8f4[_0x084b('0x16')](0xcc)[_0x084b('0x17')]();});}};}function handleEntityNotFound(_0x5107a9,_0x4a0b30){return function(_0x3953cd){if(!_0x3953cd){_0x5107a9[_0x084b('0x23')](0x194);}return _0x3953cd;};}function handleError(_0x5aa9fa,_0x9518ad){_0x9518ad=_0x9518ad||0x1f4;return function(_0x108a2e){logger[_0x084b('0x24')](_0x108a2e[_0x084b('0x25')]);if(_0x108a2e[_0x084b('0x26')]){delete _0x108a2e[_0x084b('0x26')];}_0x5aa9fa[_0x084b('0x16')](_0x9518ad)[_0x084b('0x27')](_0x108a2e);};}exports[_0x084b('0x28')]=function(_0x302488,_0x56663a){var _0x4ab53a={},_0x35431e={},_0x32a052={'count':0x0,'rows':[]};var _0x5032d7=_[_0x084b('0x29')](db[_0x084b('0x2a')][_0x084b('0x2b')],function(_0x230b91){return{'name':_0x230b91[_0x084b('0x2c')],'type':_0x230b91[_0x084b('0x2d')]['key']};});_0x35431e[_0x084b('0x2e')]=_[_0x084b('0x29')](_0x5032d7,'name');_0x35431e[_0x084b('0x2f')]=_[_0x084b('0x30')](_0x302488[_0x084b('0x2f')]);_0x35431e[_0x084b('0x31')]=_[_0x084b('0x32')](_0x35431e[_0x084b('0x2e')],_0x35431e[_0x084b('0x2f')]);_0x4ab53a['attributes']=_[_0x084b('0x32')](_0x35431e[_0x084b('0x2e')],qs[_0x084b('0x33')](_0x302488[_0x084b('0x2f')]['fields']));_0x4ab53a[_0x084b('0x34')]=_0x4ab53a[_0x084b('0x34')][_0x084b('0x35')]?_0x4ab53a[_0x084b('0x34')]:_0x35431e[_0x084b('0x2e')];if(!_0x302488[_0x084b('0x2f')][_0x084b('0x36')](_0x084b('0x37'))){_0x4ab53a[_0x084b('0x1b')]=qs[_0x084b('0x1b')](_0x302488[_0x084b('0x2f')]['limit']);_0x4ab53a[_0x084b('0x19')]=qs['offset'](_0x302488[_0x084b('0x2f')][_0x084b('0x19')]);}_0x4ab53a[_0x084b('0x38')]=qs[_0x084b('0x39')](_0x302488['query'][_0x084b('0x39')]);_0x4ab53a[_0x084b('0x3a')]=qs[_0x084b('0x31')](_[_0x084b('0x3b')](_0x302488[_0x084b('0x2f')],_0x35431e[_0x084b('0x31')]),_0x5032d7);if(_0x302488[_0x084b('0x2f')][_0x084b('0x3c')]){_0x4ab53a[_0x084b('0x3a')]=_[_0x084b('0x3d')](_0x4ab53a['where'],{'$or':_['map'](_0x5032d7,function(_0x591502){if(_0x591502[_0x084b('0x2d')]!=='VIRTUAL'){var _0x295ee0={};_0x295ee0[_0x591502[_0x084b('0x26')]]={'$like':'%'+_0x302488[_0x084b('0x2f')][_0x084b('0x3c')]+'%'};return _0x295ee0;}})});}_0x4ab53a=_['merge']({},_0x4ab53a,_0x302488[_0x084b('0x3e')]);var _0x1084a2={'where':_0x4ab53a[_0x084b('0x3a')]};return db[_0x084b('0x2a')][_0x084b('0x1c')](_0x1084a2)[_0x084b('0x22')](function(_0x4473d3){_0x32a052['count']=_0x4473d3;if(_0x302488[_0x084b('0x2f')][_0x084b('0x3f')]){_0x4ab53a[_0x084b('0x40')]=[{'all':!![]}];}return db[_0x084b('0x2a')][_0x084b('0x41')](_0x4ab53a);})[_0x084b('0x22')](function(_0x3b4556){_0x32a052['rows']=_0x3b4556;return _0x32a052;})[_0x084b('0x22')](respondWithFilteredResult(_0x56663a,_0x4ab53a))[_0x084b('0x42')](handleError(_0x56663a,null));};exports[_0x084b('0x43')]=function(_0x3db88a,_0x10bdae){var _0x23446c={'raw':![],'where':{'id':_0x3db88a['params']['id']}},_0x1bb5f0={};_0x1bb5f0['model']=_['keys'](db[_0x084b('0x2a')][_0x084b('0x2b')]);_0x1bb5f0[_0x084b('0x2f')]=_[_0x084b('0x30')](_0x3db88a['query']);_0x1bb5f0[_0x084b('0x31')]=_[_0x084b('0x32')](_0x1bb5f0[_0x084b('0x2e')],_0x1bb5f0[_0x084b('0x2f')]);_0x23446c['attributes']=_['intersection'](_0x1bb5f0['model'],qs[_0x084b('0x33')](_0x3db88a[_0x084b('0x2f')]['fields']));_0x23446c[_0x084b('0x34')]=_0x23446c[_0x084b('0x34')][_0x084b('0x35')]?_0x23446c[_0x084b('0x34')]:_0x1bb5f0[_0x084b('0x2e')];if(_0x3db88a[_0x084b('0x2f')][_0x084b('0x3f')]){_0x23446c[_0x084b('0x40')]=[{'all':!![]}];}_0x23446c=_['merge']({},_0x23446c,_0x3db88a[_0x084b('0x3e')]);return db['FreshdeskConfiguration']['find'](_0x23446c)['then'](handleEntityNotFound(_0x10bdae,null))['then'](respondWithResult(_0x10bdae,null))[_0x084b('0x42')](handleError(_0x10bdae,null));};exports[_0x084b('0x44')]=function(_0x4b15e0,_0x292ff3){return db['FreshdeskConfiguration'][_0x084b('0x44')](_0x4b15e0[_0x084b('0x45')],{})[_0x084b('0x22')](respondWithResult(_0x292ff3,0xc9))[_0x084b('0x42')](handleError(_0x292ff3,null));};exports['update']=function(_0x50a15b,_0x373bc3){if(_0x50a15b[_0x084b('0x45')]['id']){delete _0x50a15b[_0x084b('0x45')]['id'];}return db[_0x084b('0x2a')][_0x084b('0x46')]({'where':{'id':_0x50a15b[_0x084b('0x47')]['id']}})[_0x084b('0x22')](handleEntityNotFound(_0x373bc3,null))[_0x084b('0x22')](saveUpdates(_0x50a15b[_0x084b('0x45')],null))[_0x084b('0x22')](respondWithResult(_0x373bc3,null))[_0x084b('0x42')](handleError(_0x373bc3,null));};exports[_0x084b('0x48')]=function(_0x3e0dba,_0x3b01fd){return db[_0x084b('0x2a')][_0x084b('0x46')]({'where':{'id':_0x3e0dba[_0x084b('0x47')]['id']}})[_0x084b('0x22')](handleEntityNotFound(_0x3b01fd,null))[_0x084b('0x22')](removeEntity(_0x3b01fd,null))[_0x084b('0x42')](handleError(_0x3b01fd,null));};exports[_0x084b('0x49')]=function(_0x1bfc64,_0x44188e,_0x2e5c16){var _0x23ef88={};var _0xe209dd={};var _0x318a4b;var _0x84eae9;return db[_0x084b('0x2a')][_0x084b('0x4a')]({'where':{'id':_0x1bfc64[_0x084b('0x47')]['id']}})[_0x084b('0x22')](handleEntityNotFound(_0x44188e,null))[_0x084b('0x22')](function(_0x58a0a5){if(_0x58a0a5){_0x318a4b=_0x58a0a5;_0xe209dd[_0x084b('0x2e')]=_[_0x084b('0x30')](db[_0x084b('0x4b')][_0x084b('0x2b')]);_0xe209dd[_0x084b('0x2f')]=_['keys'](_0x1bfc64[_0x084b('0x2f')]);_0xe209dd[_0x084b('0x31')]=_[_0x084b('0x32')](_0xe209dd[_0x084b('0x2e')],_0xe209dd[_0x084b('0x2f')]);_0x23ef88[_0x084b('0x34')]=_[_0x084b('0x32')](_0xe209dd[_0x084b('0x2e')],qs[_0x084b('0x33')](_0x1bfc64[_0x084b('0x2f')][_0x084b('0x33')]));_0x23ef88[_0x084b('0x34')]=_0x23ef88[_0x084b('0x34')][_0x084b('0x35')]?_0x23ef88[_0x084b('0x34')]:_0xe209dd[_0x084b('0x2e')];_0x23ef88[_0x084b('0x38')]=qs[_0x084b('0x39')](_0x1bfc64['query'][_0x084b('0x39')]);_0x23ef88[_0x084b('0x3a')]=qs[_0x084b('0x31')](_[_0x084b('0x3b')](_0x1bfc64[_0x084b('0x2f')],_0xe209dd[_0x084b('0x31')]));if(_0x1bfc64[_0x084b('0x2f')]['filter']){_0x23ef88[_0x084b('0x3a')]=_[_0x084b('0x3d')](_0x23ef88[_0x084b('0x3a')],{'$or':_[_0x084b('0x29')](_0x23ef88['attributes'],function(_0x37171e){var _0x2de5dc={};_0x2de5dc[_0x37171e]={'$like':'%'+_0x1bfc64[_0x084b('0x2f')][_0x084b('0x3c')]+'%'};return _0x2de5dc;})});}_0x23ef88=_[_0x084b('0x3d')]({},_0x23ef88,_0x1bfc64[_0x084b('0x3e')]);return _0x318a4b[_0x084b('0x49')](_0x23ef88);}})['then'](function(_0x3faa6e){if(_0x3faa6e){_0x84eae9=_0x3faa6e['length'];if(!_0x1bfc64['query'][_0x084b('0x36')](_0x084b('0x37'))){_0x23ef88['limit']=qs[_0x084b('0x1b')](_0x1bfc64[_0x084b('0x2f')][_0x084b('0x1b')]);_0x23ef88[_0x084b('0x19')]=qs[_0x084b('0x19')](_0x1bfc64[_0x084b('0x2f')][_0x084b('0x19')]);}return _0x318a4b['getFields'](_0x23ef88);}})[_0x084b('0x22')](function(_0xd9fe2b){if(_0xd9fe2b){return _0xd9fe2b?{'count':_0x84eae9,'rows':_0xd9fe2b}:null;}})[_0x084b('0x22')](respondWithResult(_0x44188e,null))[_0x084b('0x42')](handleError(_0x44188e,null));};exports['getSubjects']=function(_0x487da8,_0x41bdb2,_0x1d4cd5){var _0x15a177={};var _0xa9952b={};var _0x27a6c5;var _0x35103a;return db[_0x084b('0x2a')][_0x084b('0x4a')]({'where':{'id':_0x487da8[_0x084b('0x47')]['id']}})['then'](handleEntityNotFound(_0x41bdb2,null))[_0x084b('0x22')](function(_0x147126){if(_0x147126){_0x27a6c5=_0x147126;_0xa9952b[_0x084b('0x2e')]=_['keys'](db['FreshdeskField'][_0x084b('0x2b')]);_0xa9952b[_0x084b('0x2f')]=_[_0x084b('0x30')](_0x487da8[_0x084b('0x2f')]);_0xa9952b[_0x084b('0x31')]=_[_0x084b('0x32')](_0xa9952b['model'],_0xa9952b[_0x084b('0x2f')]);_0x15a177[_0x084b('0x34')]=_[_0x084b('0x32')](_0xa9952b[_0x084b('0x2e')],qs[_0x084b('0x33')](_0x487da8['query'][_0x084b('0x33')]));_0x15a177[_0x084b('0x34')]=_0x15a177[_0x084b('0x34')][_0x084b('0x35')]?_0x15a177[_0x084b('0x34')]:_0xa9952b[_0x084b('0x2e')];_0x15a177[_0x084b('0x38')]=qs[_0x084b('0x39')](_0x487da8[_0x084b('0x2f')][_0x084b('0x39')]);_0x15a177[_0x084b('0x3a')]=qs[_0x084b('0x31')](_['pick'](_0x487da8[_0x084b('0x2f')],_0xa9952b[_0x084b('0x31')]));if(_0x487da8[_0x084b('0x2f')]['filter']){_0x15a177[_0x084b('0x3a')]=_[_0x084b('0x3d')](_0x15a177[_0x084b('0x3a')],{'$or':_[_0x084b('0x29')](_0x15a177[_0x084b('0x34')],function(_0x2602a7){var _0x54eca7={};_0x54eca7[_0x2602a7]={'$like':'%'+_0x487da8['query'][_0x084b('0x3c')]+'%'};return _0x54eca7;})});}_0x15a177=_[_0x084b('0x3d')]({},_0x15a177,_0x487da8[_0x084b('0x3e')]);return _0x27a6c5[_0x084b('0x4c')](_0x15a177);}})['then'](function(_0x4a170c){if(_0x4a170c){_0x35103a=_0x4a170c[_0x084b('0x35')];if(!_0x487da8[_0x084b('0x2f')][_0x084b('0x36')]('nolimit')){_0x15a177[_0x084b('0x1b')]=qs[_0x084b('0x1b')](_0x487da8['query'][_0x084b('0x1b')]);_0x15a177[_0x084b('0x19')]=qs[_0x084b('0x19')](_0x487da8[_0x084b('0x2f')]['offset']);}return _0x27a6c5[_0x084b('0x4c')](_0x15a177);}})[_0x084b('0x22')](function(_0x2c97d4){if(_0x2c97d4){return _0x2c97d4?{'count':_0x35103a,'rows':_0x2c97d4}:null;}})[_0x084b('0x22')](respondWithResult(_0x41bdb2,null))[_0x084b('0x42')](handleError(_0x41bdb2,null));};exports[_0x084b('0x4d')]=function(_0x3ea824,_0x512256,_0x359aa6){var _0x554270={};var _0x1a45bb={};var _0x516241;var _0x16218f;return db['FreshdeskConfiguration'][_0x084b('0x4a')]({'where':{'id':_0x3ea824[_0x084b('0x47')]['id']}})[_0x084b('0x22')](handleEntityNotFound(_0x512256,null))[_0x084b('0x22')](function(_0x8efab8){if(_0x8efab8){_0x516241=_0x8efab8;_0x1a45bb[_0x084b('0x2e')]=_['keys'](db[_0x084b('0x4b')][_0x084b('0x2b')]);_0x1a45bb['query']=_[_0x084b('0x30')](_0x3ea824[_0x084b('0x2f')]);_0x1a45bb[_0x084b('0x31')]=_['intersection'](_0x1a45bb['model'],_0x1a45bb[_0x084b('0x2f')]);_0x554270[_0x084b('0x34')]=_['intersection'](_0x1a45bb['model'],qs[_0x084b('0x33')](_0x3ea824[_0x084b('0x2f')]['fields']));_0x554270['attributes']=_0x554270['attributes'][_0x084b('0x35')]?_0x554270[_0x084b('0x34')]:_0x1a45bb['model'];_0x554270[_0x084b('0x38')]=qs[_0x084b('0x39')](_0x3ea824[_0x084b('0x2f')][_0x084b('0x39')]);_0x554270['where']=qs[_0x084b('0x31')](_['pick'](_0x3ea824['query'],_0x1a45bb[_0x084b('0x31')]));if(_0x3ea824[_0x084b('0x2f')][_0x084b('0x3c')]){_0x554270[_0x084b('0x3a')]=_[_0x084b('0x3d')](_0x554270[_0x084b('0x3a')],{'$or':_['map'](_0x554270[_0x084b('0x34')],function(_0x1a0c20){var _0x57f517={};_0x57f517[_0x1a0c20]={'$like':'%'+_0x3ea824[_0x084b('0x2f')][_0x084b('0x3c')]+'%'};return _0x57f517;})});}_0x554270=_[_0x084b('0x3d')]({},_0x554270,_0x3ea824[_0x084b('0x3e')]);return _0x516241[_0x084b('0x4d')](_0x554270);}})[_0x084b('0x22')](function(_0x4fa139){if(_0x4fa139){_0x16218f=_0x4fa139['length'];if(!_0x3ea824[_0x084b('0x2f')]['hasOwnProperty'](_0x084b('0x37'))){_0x554270[_0x084b('0x1b')]=qs[_0x084b('0x1b')](_0x3ea824[_0x084b('0x2f')][_0x084b('0x1b')]);_0x554270[_0x084b('0x19')]=qs[_0x084b('0x19')](_0x3ea824[_0x084b('0x2f')][_0x084b('0x19')]);}return _0x516241[_0x084b('0x4d')](_0x554270);}})[_0x084b('0x22')](function(_0xeec0df){if(_0xeec0df){return _0xeec0df?{'count':_0x16218f,'rows':_0xeec0df}:null;}})[_0x084b('0x22')](respondWithResult(_0x512256,null))[_0x084b('0x42')](handleError(_0x512256,null));};exports[_0x084b('0x4e')]=function(_0x9f5234,_0x11e95c,_0x1375be){var _0x169205={};var _0x14cd45={};var _0x53a2c9;var _0xad3f14;return db[_0x084b('0x2a')][_0x084b('0x4a')]({'where':{'id':_0x9f5234[_0x084b('0x47')]['id']}})[_0x084b('0x22')](handleEntityNotFound(_0x11e95c,null))['then'](function(_0x11b8fa){if(_0x11b8fa){_0x53a2c9=_0x11b8fa;_0x14cd45[_0x084b('0x2e')]=_[_0x084b('0x30')](db[_0x084b('0x4f')][_0x084b('0x2b')]);_0x14cd45['query']=_[_0x084b('0x30')](_0x9f5234['query']);_0x14cd45[_0x084b('0x31')]=_[_0x084b('0x32')](_0x14cd45[_0x084b('0x2e')],_0x14cd45[_0x084b('0x2f')]);_0x169205['attributes']=_[_0x084b('0x32')](_0x14cd45[_0x084b('0x2e')],qs['fields'](_0x9f5234['query'][_0x084b('0x33')]));_0x169205[_0x084b('0x34')]=_0x169205[_0x084b('0x34')][_0x084b('0x35')]?_0x169205[_0x084b('0x34')]:_0x14cd45['model'];_0x169205[_0x084b('0x38')]=qs['sort'](_0x9f5234['query'][_0x084b('0x39')]);_0x169205[_0x084b('0x3a')]=qs['filters'](_[_0x084b('0x3b')](_0x9f5234['query'],_0x14cd45['filters']));if(_0x9f5234[_0x084b('0x2f')][_0x084b('0x3c')]){_0x169205[_0x084b('0x3a')]=_[_0x084b('0x3d')](_0x169205[_0x084b('0x3a')],{'$or':_[_0x084b('0x29')](_0x169205['attributes'],function(_0x2f94d2){var _0x5139ba={};_0x5139ba[_0x2f94d2]={'$like':'%'+_0x9f5234[_0x084b('0x2f')][_0x084b('0x3c')]+'%'};return _0x5139ba;})});}_0x169205=_[_0x084b('0x3d')]({},_0x169205,_0x9f5234['options']);return _0x53a2c9[_0x084b('0x4e')](_0x169205);}})[_0x084b('0x22')](function(_0x4c39b1){if(_0x4c39b1){_0xad3f14=_0x4c39b1['length'];if(!_0x9f5234[_0x084b('0x2f')]['hasOwnProperty']('nolimit')){_0x169205[_0x084b('0x1b')]=qs[_0x084b('0x1b')](_0x9f5234[_0x084b('0x2f')][_0x084b('0x1b')]);_0x169205[_0x084b('0x19')]=qs[_0x084b('0x19')](_0x9f5234[_0x084b('0x2f')]['offset']);}return _0x53a2c9['getTags'](_0x169205);}})['then'](function(_0x525538){if(_0x525538){return _0x525538?{'count':_0xad3f14,'rows':_0x525538}:null;}})[_0x084b('0x22')](respondWithResult(_0x11e95c,null))[_0x084b('0x42')](handleError(_0x11e95c,null));};exports['setTags']=function(_0x3f86d4,_0x555194,_0x151372){if(_0x3f86d4[_0x084b('0x45')]['id']){delete _0x3f86d4[_0x084b('0x45')]['id'];}return db[_0x084b('0x2a')][_0x084b('0x4a')]({'where':{'id':_0x3f86d4[_0x084b('0x47')]['id']}})[_0x084b('0x22')](handleEntityNotFound(_0x555194,null))[_0x084b('0x22')](function(_0x34f611){if(_0x34f611){return _0x34f611[_0x084b('0x50')](_0x3f86d4['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x555194,null))[_0x084b('0x42')](handleError(_0x555194,null));}; \ No newline at end of file +var _0x941e=['catch','params','include','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll'];(function(_0x2b48cf,_0x4ca5bb){var _0x49b711=function(_0x40e008){while(--_0x40e008){_0x2b48cf['push'](_0x2b48cf['shift']());}};_0x49b711(++_0x4ca5bb);}(_0x941e,0x10d));var _0xe941=function(_0x991df0,_0x2e9a2d){_0x991df0=_0x991df0-0x0;var _0x4f27fd=_0x941e[_0x991df0];return _0x4f27fd;};'use strict';var emlformat=require(_0xe941('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe941('0x1'));var jsonpatch=require(_0xe941('0x2'));var rp=require(_0xe941('0x3'));var moment=require(_0xe941('0x4'));var BPromise=require(_0xe941('0x5'));var Mustache=require(_0xe941('0x6'));var util=require(_0xe941('0x7'));var path=require(_0xe941('0x8'));var sox=require(_0xe941('0x9'));var csv=require(_0xe941('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe941('0xb'));var _=require(_0xe941('0xc'));var squel=require(_0xe941('0xd'));var crypto=require(_0xe941('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe941('0xf'));var toCsv=require(_0xe941('0xa'));var querystring=require('querystring');var Papa=require(_0xe941('0x10'));var Redis=require(_0xe941('0x11'));var authService=require(_0xe941('0x12'));var qs=require(_0xe941('0x13'));var as=require(_0xe941('0x14'));var hardwareService=require(_0xe941('0x15'));var logger=require(_0xe941('0x16'))(_0xe941('0x17'));var utils=require(_0xe941('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe941('0x19'));var db=require(_0xe941('0x1a'))['db'];function respondWithStatusCode(_0x1d8ed2,_0x47afb7){_0x47afb7=_0x47afb7||0xcc;return function(_0xa00275){if(_0xa00275){return _0x1d8ed2[_0xe941('0x1b')](_0x47afb7);}return _0x1d8ed2[_0xe941('0x1c')](_0x47afb7)[_0xe941('0x1d')]();};}function respondWithResult(_0x9d7e65,_0x1a3a6f){_0x1a3a6f=_0x1a3a6f||0xc8;return function(_0x5a3cb3){if(_0x5a3cb3){return _0x9d7e65['status'](_0x1a3a6f)[_0xe941('0x1e')](_0x5a3cb3);}};}function respondWithFilteredResult(_0x1e4415,_0x1e71e3){return function(_0x20d245){if(_0x20d245){var _0x33d271=typeof _0x1e71e3[_0xe941('0x1f')]===_0xe941('0x20')&&typeof _0x1e71e3[_0xe941('0x21')]==='undefined';var _0x26d0aa=_0x20d245[_0xe941('0x22')];var _0x22d600=_0x33d271?0x0:_0x1e71e3[_0xe941('0x1f')];var _0x3b5ae6=_0x33d271?_0x20d245[_0xe941('0x22')]:_0x1e71e3[_0xe941('0x1f')]+_0x1e71e3['limit'];var _0x3961b5;if(_0x3b5ae6>=_0x26d0aa){_0x3b5ae6=_0x26d0aa;_0x3961b5=0xc8;}else{_0x3961b5=0xce;}_0x1e4415['status'](_0x3961b5);return _0x1e4415[_0xe941('0x23')]('Content-Range',_0x22d600+'-'+_0x3b5ae6+'/'+_0x26d0aa)['json'](_0x20d245);}return null;};}function patchUpdates(_0x43cfb4){return function(_0x4891d6){try{jsonpatch['apply'](_0x4891d6,_0x43cfb4,!![]);}catch(_0x2d88be){return BPromise[_0xe941('0x24')](_0x2d88be);}return _0x4891d6[_0xe941('0x25')]();};}function saveUpdates(_0x359845,_0xbbf7c){return function(_0x3608c2){if(_0x3608c2){return _0x3608c2[_0xe941('0x26')](_0x359845)['then'](function(_0xb8b6ee){return _0xb8b6ee;});}return null;};}function removeEntity(_0x350bbd,_0x47bd38){return function(_0x258017){if(_0x258017){return _0x258017[_0xe941('0x27')]()[_0xe941('0x28')](function(){_0x350bbd['status'](0xcc)[_0xe941('0x1d')]();});}};}function handleEntityNotFound(_0x3765d9,_0x5adb9c){return function(_0x10ec5a){if(!_0x10ec5a){_0x3765d9[_0xe941('0x1b')](0x194);}return _0x10ec5a;};}function handleError(_0x17fdbe,_0x580dd3){_0x580dd3=_0x580dd3||0x1f4;return function(_0x7c2923){logger[_0xe941('0x29')](_0x7c2923[_0xe941('0x2a')]);if(_0x7c2923['name']){delete _0x7c2923[_0xe941('0x2b')];}_0x17fdbe['status'](_0x580dd3)[_0xe941('0x2c')](_0x7c2923);};}exports[_0xe941('0x2d')]=function(_0x2143b3,_0x2cb278){var _0xb25f53={},_0x1450e8={},_0x5cdd2c={'count':0x0,'rows':[]};var _0x1e3f4d=_[_0xe941('0x2e')](db[_0xe941('0x2f')][_0xe941('0x30')],function(_0x58e622){return{'name':_0x58e622[_0xe941('0x31')],'type':_0x58e622[_0xe941('0x32')][_0xe941('0x33')]};});_0x1450e8[_0xe941('0x34')]=_[_0xe941('0x2e')](_0x1e3f4d,_0xe941('0x2b'));_0x1450e8[_0xe941('0x35')]=_[_0xe941('0x36')](_0x2143b3[_0xe941('0x35')]);_0x1450e8['filters']=_[_0xe941('0x37')](_0x1450e8[_0xe941('0x34')],_0x1450e8['query']);_0xb25f53[_0xe941('0x38')]=_['intersection'](_0x1450e8[_0xe941('0x34')],qs[_0xe941('0x39')](_0x2143b3[_0xe941('0x35')]['fields']));_0xb25f53[_0xe941('0x38')]=_0xb25f53[_0xe941('0x38')][_0xe941('0x3a')]?_0xb25f53[_0xe941('0x38')]:_0x1450e8['model'];if(!_0x2143b3[_0xe941('0x35')][_0xe941('0x3b')](_0xe941('0x3c'))){_0xb25f53[_0xe941('0x21')]=qs[_0xe941('0x21')](_0x2143b3[_0xe941('0x35')]['limit']);_0xb25f53[_0xe941('0x1f')]=qs['offset'](_0x2143b3[_0xe941('0x35')][_0xe941('0x1f')]);}_0xb25f53[_0xe941('0x3d')]=qs[_0xe941('0x3e')](_0x2143b3[_0xe941('0x35')][_0xe941('0x3e')]);_0xb25f53[_0xe941('0x3f')]=qs[_0xe941('0x40')](_[_0xe941('0x41')](_0x2143b3[_0xe941('0x35')],_0x1450e8['filters']),_0x1e3f4d);if(_0x2143b3[_0xe941('0x35')][_0xe941('0x42')]){_0xb25f53[_0xe941('0x3f')]=_[_0xe941('0x43')](_0xb25f53['where'],{'$or':_[_0xe941('0x2e')](_0x1e3f4d,function(_0x307453){if(_0x307453['type']!=='VIRTUAL'){var _0x5c1566={};_0x5c1566[_0x307453['name']]={'$like':'%'+_0x2143b3[_0xe941('0x35')][_0xe941('0x42')]+'%'};return _0x5c1566;}})});}_0xb25f53=_[_0xe941('0x43')]({},_0xb25f53,_0x2143b3[_0xe941('0x44')]);var _0x32720b={'where':_0xb25f53['where']};return db[_0xe941('0x2f')][_0xe941('0x22')](_0x32720b)[_0xe941('0x28')](function(_0x343b16){_0x5cdd2c[_0xe941('0x22')]=_0x343b16;if(_0x2143b3['query'][_0xe941('0x45')]){_0xb25f53['include']=[{'all':!![]}];}return db[_0xe941('0x2f')][_0xe941('0x46')](_0xb25f53);})[_0xe941('0x28')](function(_0x50ef5a){_0x5cdd2c['rows']=_0x50ef5a;return _0x5cdd2c;})[_0xe941('0x28')](respondWithFilteredResult(_0x2cb278,_0xb25f53))[_0xe941('0x47')](handleError(_0x2cb278,null));};exports['show']=function(_0x281f43,_0x2ae544){var _0x15d6d9={'raw':![],'where':{'id':_0x281f43[_0xe941('0x48')]['id']}},_0x26123b={};_0x26123b[_0xe941('0x34')]=_[_0xe941('0x36')](db[_0xe941('0x2f')][_0xe941('0x30')]);_0x26123b['query']=_['keys'](_0x281f43[_0xe941('0x35')]);_0x26123b[_0xe941('0x40')]=_[_0xe941('0x37')](_0x26123b[_0xe941('0x34')],_0x26123b['query']);_0x15d6d9[_0xe941('0x38')]=_[_0xe941('0x37')](_0x26123b[_0xe941('0x34')],qs[_0xe941('0x39')](_0x281f43[_0xe941('0x35')]['fields']));_0x15d6d9['attributes']=_0x15d6d9['attributes'][_0xe941('0x3a')]?_0x15d6d9[_0xe941('0x38')]:_0x26123b[_0xe941('0x34')];if(_0x281f43[_0xe941('0x35')][_0xe941('0x45')]){_0x15d6d9[_0xe941('0x49')]=[{'all':!![]}];}_0x15d6d9=_[_0xe941('0x43')]({},_0x15d6d9,_0x281f43[_0xe941('0x44')]);return db[_0xe941('0x2f')][_0xe941('0x4a')](_0x15d6d9)[_0xe941('0x28')](handleEntityNotFound(_0x2ae544,null))[_0xe941('0x28')](respondWithResult(_0x2ae544,null))[_0xe941('0x47')](handleError(_0x2ae544,null));};exports[_0xe941('0x4b')]=function(_0x21a773,_0x9cae6){return db[_0xe941('0x2f')][_0xe941('0x4b')](_0x21a773[_0xe941('0x4c')],{})[_0xe941('0x28')](respondWithResult(_0x9cae6,0xc9))['catch'](handleError(_0x9cae6,null));};exports[_0xe941('0x26')]=function(_0x3f6573,_0x566b19){if(_0x3f6573['body']['id']){delete _0x3f6573[_0xe941('0x4c')]['id'];}return db['FreshdeskConfiguration'][_0xe941('0x4a')]({'where':{'id':_0x3f6573['params']['id']}})[_0xe941('0x28')](handleEntityNotFound(_0x566b19,null))[_0xe941('0x28')](saveUpdates(_0x3f6573[_0xe941('0x4c')],null))[_0xe941('0x28')](respondWithResult(_0x566b19,null))[_0xe941('0x47')](handleError(_0x566b19,null));};exports[_0xe941('0x27')]=function(_0x15253e,_0x1fbe54){return db['FreshdeskConfiguration'][_0xe941('0x4a')]({'where':{'id':_0x15253e[_0xe941('0x48')]['id']}})[_0xe941('0x28')](handleEntityNotFound(_0x1fbe54,null))[_0xe941('0x28')](removeEntity(_0x1fbe54,null))[_0xe941('0x47')](handleError(_0x1fbe54,null));};exports[_0xe941('0x4d')]=function(_0x4af41f,_0x3363c9,_0x23aaaa){var _0x57c89d={};var _0x4a33ac={};var _0x495438;var _0xa3dd2f;return db[_0xe941('0x2f')][_0xe941('0x4e')]({'where':{'id':_0x4af41f['params']['id']}})[_0xe941('0x28')](handleEntityNotFound(_0x3363c9,null))[_0xe941('0x28')](function(_0x2d0e43){if(_0x2d0e43){_0x495438=_0x2d0e43;_0x4a33ac[_0xe941('0x34')]=_['keys'](db[_0xe941('0x4f')][_0xe941('0x30')]);_0x4a33ac['query']=_[_0xe941('0x36')](_0x4af41f[_0xe941('0x35')]);_0x4a33ac['filters']=_[_0xe941('0x37')](_0x4a33ac['model'],_0x4a33ac['query']);_0x57c89d[_0xe941('0x38')]=_[_0xe941('0x37')](_0x4a33ac['model'],qs[_0xe941('0x39')](_0x4af41f['query']['fields']));_0x57c89d['attributes']=_0x57c89d[_0xe941('0x38')][_0xe941('0x3a')]?_0x57c89d['attributes']:_0x4a33ac[_0xe941('0x34')];_0x57c89d[_0xe941('0x3d')]=qs[_0xe941('0x3e')](_0x4af41f[_0xe941('0x35')][_0xe941('0x3e')]);_0x57c89d[_0xe941('0x3f')]=qs[_0xe941('0x40')](_[_0xe941('0x41')](_0x4af41f[_0xe941('0x35')],_0x4a33ac['filters']));if(_0x4af41f[_0xe941('0x35')][_0xe941('0x42')]){_0x57c89d[_0xe941('0x3f')]=_[_0xe941('0x43')](_0x57c89d[_0xe941('0x3f')],{'$or':_[_0xe941('0x2e')](_0x57c89d[_0xe941('0x38')],function(_0x3e4d6a){var _0x5be38e={};_0x5be38e[_0x3e4d6a]={'$like':'%'+_0x4af41f['query'][_0xe941('0x42')]+'%'};return _0x5be38e;})});}_0x57c89d=_[_0xe941('0x43')]({},_0x57c89d,_0x4af41f[_0xe941('0x44')]);return _0x495438['getFields'](_0x57c89d);}})[_0xe941('0x28')](function(_0x2f02c2){if(_0x2f02c2){_0xa3dd2f=_0x2f02c2[_0xe941('0x3a')];if(!_0x4af41f[_0xe941('0x35')][_0xe941('0x3b')](_0xe941('0x3c'))){_0x57c89d[_0xe941('0x21')]=qs[_0xe941('0x21')](_0x4af41f['query'][_0xe941('0x21')]);_0x57c89d[_0xe941('0x1f')]=qs[_0xe941('0x1f')](_0x4af41f[_0xe941('0x35')][_0xe941('0x1f')]);}return _0x495438[_0xe941('0x4d')](_0x57c89d);}})['then'](function(_0x19c5c3){if(_0x19c5c3){return _0x19c5c3?{'count':_0xa3dd2f,'rows':_0x19c5c3}:null;}})['then'](respondWithResult(_0x3363c9,null))[_0xe941('0x47')](handleError(_0x3363c9,null));};exports[_0xe941('0x50')]=function(_0x15855d,_0x3fe6a0,_0x1f1533){var _0x3ae490={};var _0xde2ae7={};var _0x1c76d7;var _0x317c36;return db[_0xe941('0x2f')][_0xe941('0x4e')]({'where':{'id':_0x15855d[_0xe941('0x48')]['id']}})[_0xe941('0x28')](handleEntityNotFound(_0x3fe6a0,null))[_0xe941('0x28')](function(_0x42fd03){if(_0x42fd03){_0x1c76d7=_0x42fd03;_0xde2ae7[_0xe941('0x34')]=_[_0xe941('0x36')](db[_0xe941('0x4f')][_0xe941('0x30')]);_0xde2ae7['query']=_[_0xe941('0x36')](_0x15855d[_0xe941('0x35')]);_0xde2ae7[_0xe941('0x40')]=_[_0xe941('0x37')](_0xde2ae7[_0xe941('0x34')],_0xde2ae7[_0xe941('0x35')]);_0x3ae490['attributes']=_['intersection'](_0xde2ae7[_0xe941('0x34')],qs[_0xe941('0x39')](_0x15855d[_0xe941('0x35')][_0xe941('0x39')]));_0x3ae490[_0xe941('0x38')]=_0x3ae490[_0xe941('0x38')][_0xe941('0x3a')]?_0x3ae490[_0xe941('0x38')]:_0xde2ae7[_0xe941('0x34')];_0x3ae490[_0xe941('0x3d')]=qs[_0xe941('0x3e')](_0x15855d['query']['sort']);_0x3ae490[_0xe941('0x3f')]=qs[_0xe941('0x40')](_['pick'](_0x15855d[_0xe941('0x35')],_0xde2ae7['filters']));if(_0x15855d[_0xe941('0x35')][_0xe941('0x42')]){_0x3ae490[_0xe941('0x3f')]=_[_0xe941('0x43')](_0x3ae490['where'],{'$or':_[_0xe941('0x2e')](_0x3ae490[_0xe941('0x38')],function(_0x112bae){var _0x24adb7={};_0x24adb7[_0x112bae]={'$like':'%'+_0x15855d['query'][_0xe941('0x42')]+'%'};return _0x24adb7;})});}_0x3ae490=_[_0xe941('0x43')]({},_0x3ae490,_0x15855d[_0xe941('0x44')]);return _0x1c76d7[_0xe941('0x50')](_0x3ae490);}})[_0xe941('0x28')](function(_0xa651e2){if(_0xa651e2){_0x317c36=_0xa651e2[_0xe941('0x3a')];if(!_0x15855d[_0xe941('0x35')][_0xe941('0x3b')](_0xe941('0x3c'))){_0x3ae490['limit']=qs[_0xe941('0x21')](_0x15855d[_0xe941('0x35')]['limit']);_0x3ae490['offset']=qs[_0xe941('0x1f')](_0x15855d[_0xe941('0x35')]['offset']);}return _0x1c76d7[_0xe941('0x50')](_0x3ae490);}})[_0xe941('0x28')](function(_0x67e5f9){if(_0x67e5f9){return _0x67e5f9?{'count':_0x317c36,'rows':_0x67e5f9}:null;}})['then'](respondWithResult(_0x3fe6a0,null))[_0xe941('0x47')](handleError(_0x3fe6a0,null));};exports['getDescriptions']=function(_0x4555cf,_0x3462f8,_0x2d4f34){var _0x3d1d07={};var _0x229d7e={};var _0x2283a4;var _0x409d0c;return db[_0xe941('0x2f')][_0xe941('0x4e')]({'where':{'id':_0x4555cf['params']['id']}})[_0xe941('0x28')](handleEntityNotFound(_0x3462f8,null))[_0xe941('0x28')](function(_0x315f57){if(_0x315f57){_0x2283a4=_0x315f57;_0x229d7e['model']=_['keys'](db['FreshdeskField'][_0xe941('0x30')]);_0x229d7e[_0xe941('0x35')]=_[_0xe941('0x36')](_0x4555cf['query']);_0x229d7e[_0xe941('0x40')]=_[_0xe941('0x37')](_0x229d7e[_0xe941('0x34')],_0x229d7e[_0xe941('0x35')]);_0x3d1d07[_0xe941('0x38')]=_[_0xe941('0x37')](_0x229d7e['model'],qs['fields'](_0x4555cf[_0xe941('0x35')][_0xe941('0x39')]));_0x3d1d07['attributes']=_0x3d1d07['attributes']['length']?_0x3d1d07[_0xe941('0x38')]:_0x229d7e[_0xe941('0x34')];_0x3d1d07[_0xe941('0x3d')]=qs[_0xe941('0x3e')](_0x4555cf['query'][_0xe941('0x3e')]);_0x3d1d07['where']=qs['filters'](_[_0xe941('0x41')](_0x4555cf['query'],_0x229d7e[_0xe941('0x40')]));if(_0x4555cf[_0xe941('0x35')][_0xe941('0x42')]){_0x3d1d07[_0xe941('0x3f')]=_[_0xe941('0x43')](_0x3d1d07[_0xe941('0x3f')],{'$or':_['map'](_0x3d1d07['attributes'],function(_0x45d157){var _0x556c35={};_0x556c35[_0x45d157]={'$like':'%'+_0x4555cf[_0xe941('0x35')][_0xe941('0x42')]+'%'};return _0x556c35;})});}_0x3d1d07=_['merge']({},_0x3d1d07,_0x4555cf[_0xe941('0x44')]);return _0x2283a4[_0xe941('0x51')](_0x3d1d07);}})[_0xe941('0x28')](function(_0x3fd749){if(_0x3fd749){_0x409d0c=_0x3fd749[_0xe941('0x3a')];if(!_0x4555cf[_0xe941('0x35')][_0xe941('0x3b')](_0xe941('0x3c'))){_0x3d1d07[_0xe941('0x21')]=qs['limit'](_0x4555cf[_0xe941('0x35')][_0xe941('0x21')]);_0x3d1d07[_0xe941('0x1f')]=qs[_0xe941('0x1f')](_0x4555cf[_0xe941('0x35')][_0xe941('0x1f')]);}return _0x2283a4[_0xe941('0x51')](_0x3d1d07);}})[_0xe941('0x28')](function(_0x1fc299){if(_0x1fc299){return _0x1fc299?{'count':_0x409d0c,'rows':_0x1fc299}:null;}})[_0xe941('0x28')](respondWithResult(_0x3462f8,null))['catch'](handleError(_0x3462f8,null));};exports[_0xe941('0x52')]=function(_0x2fd70c,_0x2534c9,_0x36c004){var _0x25d4b3={};var _0x598261={};var _0x128f9b;var _0x56fadf;return db[_0xe941('0x2f')][_0xe941('0x4e')]({'where':{'id':_0x2fd70c[_0xe941('0x48')]['id']}})['then'](handleEntityNotFound(_0x2534c9,null))[_0xe941('0x28')](function(_0x111e45){if(_0x111e45){_0x128f9b=_0x111e45;_0x598261['model']=_['keys'](db['Tag'][_0xe941('0x30')]);_0x598261[_0xe941('0x35')]=_['keys'](_0x2fd70c['query']);_0x598261[_0xe941('0x40')]=_[_0xe941('0x37')](_0x598261[_0xe941('0x34')],_0x598261[_0xe941('0x35')]);_0x25d4b3[_0xe941('0x38')]=_[_0xe941('0x37')](_0x598261[_0xe941('0x34')],qs['fields'](_0x2fd70c[_0xe941('0x35')][_0xe941('0x39')]));_0x25d4b3[_0xe941('0x38')]=_0x25d4b3['attributes'][_0xe941('0x3a')]?_0x25d4b3['attributes']:_0x598261[_0xe941('0x34')];_0x25d4b3[_0xe941('0x3d')]=qs[_0xe941('0x3e')](_0x2fd70c[_0xe941('0x35')]['sort']);_0x25d4b3[_0xe941('0x3f')]=qs['filters'](_['pick'](_0x2fd70c['query'],_0x598261[_0xe941('0x40')]));if(_0x2fd70c[_0xe941('0x35')][_0xe941('0x42')]){_0x25d4b3['where']=_[_0xe941('0x43')](_0x25d4b3['where'],{'$or':_[_0xe941('0x2e')](_0x25d4b3[_0xe941('0x38')],function(_0x2522a4){var _0x35b121={};_0x35b121[_0x2522a4]={'$like':'%'+_0x2fd70c[_0xe941('0x35')][_0xe941('0x42')]+'%'};return _0x35b121;})});}_0x25d4b3=_['merge']({},_0x25d4b3,_0x2fd70c['options']);return _0x128f9b[_0xe941('0x52')](_0x25d4b3);}})[_0xe941('0x28')](function(_0x44b688){if(_0x44b688){_0x56fadf=_0x44b688[_0xe941('0x3a')];if(!_0x2fd70c[_0xe941('0x35')]['hasOwnProperty'](_0xe941('0x3c'))){_0x25d4b3[_0xe941('0x21')]=qs['limit'](_0x2fd70c[_0xe941('0x35')][_0xe941('0x21')]);_0x25d4b3[_0xe941('0x1f')]=qs[_0xe941('0x1f')](_0x2fd70c[_0xe941('0x35')][_0xe941('0x1f')]);}return _0x128f9b[_0xe941('0x52')](_0x25d4b3);}})['then'](function(_0x5c5497){if(_0x5c5497){return _0x5c5497?{'count':_0x56fadf,'rows':_0x5c5497}:null;}})['then'](respondWithResult(_0x2534c9,null))[_0xe941('0x47')](handleError(_0x2534c9,null));};exports[_0xe941('0x53')]=function(_0x429587,_0x2d765a,_0x4f7c21){if(_0x429587[_0xe941('0x4c')]['id']){delete _0x429587[_0xe941('0x4c')]['id'];}return db[_0xe941('0x2f')][_0xe941('0x4e')]({'where':{'id':_0x429587['params']['id']}})[_0xe941('0x28')](handleEntityNotFound(_0x2d765a,null))[_0xe941('0x28')](function(_0x5aff25){if(_0x5aff25){return _0x5aff25[_0xe941('0x53')](_0x429587[_0xe941('0x4c')][_0xe941('0x54')]||[]);}return null;})[_0xe941('0x28')](respondWithResult(_0x2d765a,null))[_0xe941('0x47')](handleError(_0x2d765a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c57e244..8dc8859 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 _0x6081=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x567d48,_0x4a6798){var _0x7af946=function(_0x249f14){while(--_0x249f14){_0x567d48['push'](_0x567d48['shift']());}};_0x7af946(++_0x4a6798);}(_0x6081,0x1b0));var _0x1608=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6081[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1608('0x0'));var util=require(_0x1608('0x1'));var logger=require(_0x1608('0x2'))(_0x1608('0x3'));var moment=require('moment');var BPromise=require(_0x1608('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1608('0x5'));var rimraf=require(_0x1608('0x6'));var config=require(_0x1608('0x7'));var attributes=require(_0x1608('0x8'));module[_0x1608('0x9')]=function(_0x18c081,_0x36b140){return _0x18c081[_0x1608('0xa')](_0x1608('0xb'),attributes,{'tableName':_0x1608('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ce5=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x421b58,_0x30e951){var _0x4f5339=function(_0x1a0fb2){while(--_0x1a0fb2){_0x421b58['push'](_0x421b58['shift']());}};_0x4f5339(++_0x30e951);}(_0x1ce5,0x73));var _0x51ce=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x1ce5[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x51ce('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x51ce('0x1'));var moment=require(_0x51ce('0x2'));var BPromise=require('bluebird');var rp=require(_0x51ce('0x3'));var fs=require('fs');var path=require(_0x51ce('0x4'));var rimraf=require(_0x51ce('0x5'));var config=require(_0x51ce('0x6'));var attributes=require(_0x51ce('0x7'));module[_0x51ce('0x8')]=function(_0x4f2bb8,_0x55b84c){return _0x4f2bb8[_0x51ce('0x9')]('FreshdeskConfiguration',attributes,{'tableName':_0x51ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index ec499be..5526aaf 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 _0x5fbb=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info'];(function(_0x1e7077,_0x3e57b3){var _0x2bb221=function(_0x4452e2){while(--_0x4452e2){_0x1e7077['push'](_0x1e7077['shift']());}};_0x2bb221(++_0x3e57b3);}(_0x5fbb,0xf9));var _0xb5fb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5fbb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb5fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb5fb('0x1'));var rs=require(_0xb5fb('0x2'));var fs=require('fs');var Redis=require(_0xb5fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb5fb('0x4'));var logger=require(_0xb5fb('0x5'))(_0xb5fb('0x6'));var config=require(_0xb5fb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb5fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x155a8a,_0x1075be,_0x1293e7){return new BPromise(function(_0x389ab2,_0x477e8a){return client[_0xb5fb('0x9')](_0x155a8a,_0x1293e7)['then'](function(_0x4d0bba){logger[_0xb5fb('0xa')](_0xb5fb('0xb'),_0x1075be,_0xb5fb('0xc'));logger[_0xb5fb('0xd')](_0xb5fb('0xe'),_0x1075be,'request\x20sent',JSON[_0xb5fb('0xf')](_0x4d0bba));if(_0x4d0bba[_0xb5fb('0x10')]){if(_0x4d0bba[_0xb5fb('0x10')][_0xb5fb('0x11')]===0x1f4){logger['error'](_0xb5fb('0xb'),_0x1075be,_0x4d0bba[_0xb5fb('0x10')][_0xb5fb('0x12')]);return _0x477e8a(_0x4d0bba[_0xb5fb('0x10')][_0xb5fb('0x12')]);}logger[_0xb5fb('0x10')](_0xb5fb('0xb'),_0x1075be,_0x4d0bba[_0xb5fb('0x10')][_0xb5fb('0x12')]);return _0x389ab2(_0x4d0bba[_0xb5fb('0x10')][_0xb5fb('0x12')]);}else{logger[_0xb5fb('0xa')](_0xb5fb('0xb'),_0x1075be,_0xb5fb('0xc'));_0x389ab2(_0x4d0bba['result'][_0xb5fb('0x12')]);}})[_0xb5fb('0x13')](function(_0x96a802){logger[_0xb5fb('0x10')](_0xb5fb('0xb'),_0x1075be,_0x96a802);_0x477e8a(_0x96a802);});});} \ No newline at end of file +var _0x32f4=['request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x2c0c1f,_0xb8e832){var _0x371cf9=function(_0x4f3de7){while(--_0x4f3de7){_0x2c0c1f['push'](_0x2c0c1f['shift']());}};_0x371cf9(++_0xb8e832);}(_0x32f4,0x69));var _0x432f=function(_0x442ff0,_0x4249fc){_0x442ff0=_0x442ff0-0x0;var _0x820e60=_0x32f4[_0x442ff0];return _0x820e60;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require(_0x432f('0x4'));var fs=require('fs');var Redis=require(_0x432f('0x5'));var db=require(_0x432f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2184c3,_0x49e953,_0x36a0f1){return new BPromise(function(_0x294615,_0x13d9e9){return client[_0x432f('0xb')](_0x2184c3,_0x36a0f1)[_0x432f('0xc')](function(_0x344148){logger[_0x432f('0xd')](_0x432f('0xe'),_0x49e953,_0x432f('0xf'));logger[_0x432f('0x10')](_0x432f('0x11'),_0x49e953,_0x432f('0xf'),JSON[_0x432f('0x12')](_0x344148));if(_0x344148['error']){if(_0x344148['error'][_0x432f('0x13')]===0x1f4){logger[_0x432f('0x14')](_0x432f('0xe'),_0x49e953,_0x344148[_0x432f('0x14')]['message']);return _0x13d9e9(_0x344148['error'][_0x432f('0x15')]);}logger['error'](_0x432f('0xe'),_0x49e953,_0x344148[_0x432f('0x14')]['message']);return _0x294615(_0x344148[_0x432f('0x14')][_0x432f('0x15')]);}else{logger[_0x432f('0xd')](_0x432f('0xe'),_0x49e953,_0x432f('0xf'));_0x294615(_0x344148[_0x432f('0x16')][_0x432f('0x15')]);}})[_0x432f('0x17')](function(_0x31ab63){logger[_0x432f('0x14')](_0x432f('0xe'),_0x49e953,_0x31ab63);_0x13d9e9(_0x31ab63);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index d64b2d8..31088ba 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 _0x6fa0=['post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x212b5d,_0x318113){var _0xd29835=function(_0x39dc22){while(--_0x39dc22){_0x212b5d['push'](_0x212b5d['shift']());}};_0xd29835(++_0x318113);}(_0x6fa0,0xcb));var _0x06fa=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x6fa0[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0x06fa('0x0'));var util=require(_0x06fa('0x1'));var path=require(_0x06fa('0x2'));var timeout=require(_0x06fa('0x3'));var express=require(_0x06fa('0x4'));var router=express['Router']();var fs_extra=require(_0x06fa('0x5'));var auth=require(_0x06fa('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x06fa('0x7'));router[_0x06fa('0x8')]('/',auth['isAuthenticated'](),controller[_0x06fa('0x9')]);router[_0x06fa('0x8')](_0x06fa('0xa'),auth[_0x06fa('0xb')](),controller[_0x06fa('0xc')]);router[_0x06fa('0xd')]('/',auth[_0x06fa('0xb')](),controller[_0x06fa('0xe')]);router['put'](_0x06fa('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x06fa('0xf')]('/:id',auth[_0x06fa('0xb')](),controller[_0x06fa('0x10')]);module[_0x06fa('0x11')]=router; \ No newline at end of file +var _0xef66=['post','delete','destroy','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x3bb4bf,_0x3b93d5){var _0x2700c0=function(_0x3cec67){while(--_0x3cec67){_0x3bb4bf['push'](_0x3bb4bf['shift']());}};_0x2700c0(++_0x3b93d5);}(_0xef66,0x1e4));var _0x6ef6=function(_0x49415b,_0x1f036a){_0x49415b=_0x49415b-0x0;var _0x37c65e=_0xef66[_0x49415b];return _0x37c65e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6ef6('0x0'));var timeout=require(_0x6ef6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6ef6('0x2'));var auth=require(_0x6ef6('0x3'));var interaction=require(_0x6ef6('0x4'));var config=require('../../config/environment');var controller=require(_0x6ef6('0x5'));router[_0x6ef6('0x6')]('/',auth[_0x6ef6('0x7')](),controller[_0x6ef6('0x8')]);router['get'](_0x6ef6('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6ef6('0xa')]('/',auth[_0x6ef6('0x7')](),controller['create']);router['put'](_0x6ef6('0x9'),auth[_0x6ef6('0x7')](),controller['update']);router[_0x6ef6('0xb')]('/:id',auth[_0x6ef6('0x7')](),controller[_0x6ef6('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c4a5dc0..6c51975 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 _0xda8b=['picklist','STRING','ENUM','variable','BOOLEAN','exports','string','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda8b,0xf8));var _0xbda8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xda8b[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module[_0xbda8('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbda8('0x1'),'variable',_0xbda8('0x2'),_0xbda8('0x3'),_0xbda8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbda8('0x5')]},'key':{'type':Sequelize[_0xbda8('0x5')]},'keyType':{'type':Sequelize[_0xbda8('0x6')](_0xbda8('0x1'),_0xbda8('0x7'),_0xbda8('0x2'))},'keyContent':{'type':Sequelize[_0xbda8('0x5')]},'idField':{'type':Sequelize[_0xbda8('0x5')]},'nameField':{'type':Sequelize[_0xbda8('0x5')]},'customField':{'type':Sequelize[_0xbda8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbda8('0x5')]}}; \ No newline at end of file +var _0x56cb=['exports','string','variable','customVariable','STRING','ENUM'];(function(_0x3b8f3d,_0x3783f0){var _0x3c4cd3=function(_0x572ef2){while(--_0x572ef2){_0x3b8f3d['push'](_0x3b8f3d['shift']());}};_0x3c4cd3(++_0x3783f0);}(_0x56cb,0x6c));var _0xb56c=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x56cb[_0x1daaa9];return _0x1dd221;};'use strict';var Sequelize=require('sequelize');module[_0xb56c('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb56c('0x1'),_0xb56c('0x2'),_0xb56c('0x3'),'keyValue','picklist'),'defaultValue':_0xb56c('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb56c('0x4')]},'keyType':{'type':Sequelize[_0xb56c('0x5')]('string',_0xb56c('0x2'),_0xb56c('0x3'))},'keyContent':{'type':Sequelize[_0xb56c('0x4')]},'idField':{'type':Sequelize[_0xb56c('0x4')]},'nameField':{'type':Sequelize[_0xb56c('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb56c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 3b8710e..bba771e 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 _0xcecc=['end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','destroy','name','send','index','map','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','type','options','count','FreshdeskField','findAll','rows','catch','rawAttributes','includeAll','include','find','create','body','params','eml-format','zip-dir','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x17d901,_0x2a932b){var _0x19fa2a=function(_0x5305ad){while(--_0x5305ad){_0x17d901['push'](_0x17d901['shift']());}};_0x19fa2a(++_0x2a932b);}(_0xcecc,0x186));var _0xccec=function(_0x328d32,_0x2679d7){_0x328d32=_0x328d32-0x0;var _0x181bd9=_0xcecc[_0x328d32];return _0x181bd9;};'use strict';var emlformat=require(_0xccec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xccec('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xccec('0x2'));var BPromise=require(_0xccec('0x3'));var Mustache=require(_0xccec('0x4'));var util=require(_0xccec('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xccec('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccec('0x7'));var _=require(_0xccec('0x8'));var squel=require(_0xccec('0x9'));var crypto=require('crypto');var jsforce=require(_0xccec('0xa'));var deskjs=require(_0xccec('0xb'));var toCsv=require('to-csv');var querystring=require(_0xccec('0xc'));var Papa=require(_0xccec('0xd'));var Redis=require(_0xccec('0xe'));var authService=require(_0xccec('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccec('0x11'))(_0xccec('0x12'));var utils=require('../../config/utils');var config=require(_0xccec('0x13'));var licenseUtil=require(_0xccec('0x14'));var db=require(_0xccec('0x15'))['db'];function respondWithStatusCode(_0x5ad07a,_0x349054){_0x349054=_0x349054||0xcc;return function(_0x2ac888){if(_0x2ac888){return _0x5ad07a[_0xccec('0x16')](_0x349054);}return _0x5ad07a[_0xccec('0x17')](_0x349054)[_0xccec('0x18')]();};}function respondWithResult(_0x4b4c3d,_0x2882d9){_0x2882d9=_0x2882d9||0xc8;return function(_0x566a81){if(_0x566a81){return _0x4b4c3d['status'](_0x2882d9)['json'](_0x566a81);}};}function respondWithFilteredResult(_0x8ff6a6,_0x3482d4){return function(_0x18e7d0){if(_0x18e7d0){var _0x69a776=typeof _0x3482d4[_0xccec('0x19')]===_0xccec('0x1a')&&typeof _0x3482d4[_0xccec('0x1b')]===_0xccec('0x1a');var _0x199e52=_0x18e7d0['count'];var _0x518016=_0x69a776?0x0:_0x3482d4['offset'];var _0x970c66=_0x69a776?_0x18e7d0['count']:_0x3482d4[_0xccec('0x19')]+_0x3482d4[_0xccec('0x1b')];var _0x88741b;if(_0x970c66>=_0x199e52){_0x970c66=_0x199e52;_0x88741b=0xc8;}else{_0x88741b=0xce;}_0x8ff6a6['status'](_0x88741b);return _0x8ff6a6[_0xccec('0x1c')](_0xccec('0x1d'),_0x518016+'-'+_0x970c66+'/'+_0x199e52)[_0xccec('0x1e')](_0x18e7d0);}return null;};}function patchUpdates(_0x4a7f08){return function(_0x2fedff){try{jsonpatch[_0xccec('0x1f')](_0x2fedff,_0x4a7f08,!![]);}catch(_0x2163e7){return BPromise['reject'](_0x2163e7);}return _0x2fedff[_0xccec('0x20')]();};}function saveUpdates(_0x57c27c,_0x9065a3){return function(_0x4b2666){if(_0x4b2666){return _0x4b2666[_0xccec('0x21')](_0x57c27c)[_0xccec('0x22')](function(_0x312da0){return _0x312da0;});}return null;};}function removeEntity(_0x50794d,_0x3d83e1){return function(_0x6be7ac){if(_0x6be7ac){return _0x6be7ac[_0xccec('0x23')]()[_0xccec('0x22')](function(){_0x50794d[_0xccec('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44bc44,_0xb0b0da){return function(_0x2d8fa0){if(!_0x2d8fa0){_0x44bc44[_0xccec('0x16')](0x194);}return _0x2d8fa0;};}function handleError(_0x4c8dbe,_0x27b541){_0x27b541=_0x27b541||0x1f4;return function(_0x52ddd7){logger['error'](_0x52ddd7['stack']);if(_0x52ddd7[_0xccec('0x24')]){delete _0x52ddd7[_0xccec('0x24')];}_0x4c8dbe[_0xccec('0x17')](_0x27b541)[_0xccec('0x25')](_0x52ddd7);};}exports[_0xccec('0x26')]=function(_0x3e8557,_0x3ca9c7){var _0x59bb66={},_0x11085d={},_0x5ee7c1={'count':0x0,'rows':[]};var _0x23e324=_[_0xccec('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x1e93e3){return{'name':_0x1e93e3[_0xccec('0x28')],'type':_0x1e93e3['type'][_0xccec('0x29')]};});_0x11085d[_0xccec('0x2a')]=_[_0xccec('0x27')](_0x23e324,_0xccec('0x24'));_0x11085d['query']=_[_0xccec('0x2b')](_0x3e8557[_0xccec('0x2c')]);_0x11085d[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x11085d[_0xccec('0x2a')],_0x11085d[_0xccec('0x2c')]);_0x59bb66[_0xccec('0x2f')]=_[_0xccec('0x2e')](_0x11085d['model'],qs[_0xccec('0x30')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x30')]));_0x59bb66['attributes']=_0x59bb66['attributes'][_0xccec('0x31')]?_0x59bb66[_0xccec('0x2f')]:_0x11085d[_0xccec('0x2a')];if(!_0x3e8557[_0xccec('0x2c')]['hasOwnProperty'](_0xccec('0x32'))){_0x59bb66['limit']=qs['limit'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x1b')]);_0x59bb66[_0xccec('0x19')]=qs[_0xccec('0x19')](_0x3e8557[_0xccec('0x2c')][_0xccec('0x19')]);}_0x59bb66['order']=qs['sort'](_0x3e8557[_0xccec('0x2c')][_0xccec('0x33')]);_0x59bb66[_0xccec('0x34')]=qs[_0xccec('0x2d')](_['pick'](_0x3e8557[_0xccec('0x2c')],_0x11085d['filters']),_0x23e324);if(_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]){_0x59bb66[_0xccec('0x34')]=_[_0xccec('0x36')](_0x59bb66[_0xccec('0x34')],{'$or':_['map'](_0x23e324,function(_0x2a3a54){if(_0x2a3a54[_0xccec('0x37')]!=='VIRTUAL'){var _0x3ce4ee={};_0x3ce4ee[_0x2a3a54[_0xccec('0x24')]]={'$like':'%'+_0x3e8557[_0xccec('0x2c')][_0xccec('0x35')]+'%'};return _0x3ce4ee;}})});}_0x59bb66=_['merge']({},_0x59bb66,_0x3e8557[_0xccec('0x38')]);var _0x1526ca={'where':_0x59bb66[_0xccec('0x34')]};return db['FreshdeskField'][_0xccec('0x39')](_0x1526ca)['then'](function(_0x256e9b){_0x5ee7c1[_0xccec('0x39')]=_0x256e9b;if(_0x3e8557[_0xccec('0x2c')]['includeAll']){_0x59bb66['include']=[{'all':!![]}];}return db[_0xccec('0x3a')][_0xccec('0x3b')](_0x59bb66);})[_0xccec('0x22')](function(_0x4c0184){_0x5ee7c1[_0xccec('0x3c')]=_0x4c0184;return _0x5ee7c1;})[_0xccec('0x22')](respondWithFilteredResult(_0x3ca9c7,_0x59bb66))[_0xccec('0x3d')](handleError(_0x3ca9c7,null));};exports['show']=function(_0x720b56,_0x3b0472){var _0x262e25={'raw':!![],'where':{'id':_0x720b56['params']['id']}},_0x1dfd34={};_0x1dfd34['model']=_[_0xccec('0x2b')](db[_0xccec('0x3a')][_0xccec('0x3e')]);_0x1dfd34['query']=_[_0xccec('0x2b')](_0x720b56[_0xccec('0x2c')]);_0x1dfd34[_0xccec('0x2d')]=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],_0x1dfd34[_0xccec('0x2c')]);_0x262e25['attributes']=_[_0xccec('0x2e')](_0x1dfd34[_0xccec('0x2a')],qs[_0xccec('0x30')](_0x720b56[_0xccec('0x2c')][_0xccec('0x30')]));_0x262e25[_0xccec('0x2f')]=_0x262e25[_0xccec('0x2f')][_0xccec('0x31')]?_0x262e25['attributes']:_0x1dfd34[_0xccec('0x2a')];if(_0x720b56[_0xccec('0x2c')][_0xccec('0x3f')]){_0x262e25[_0xccec('0x40')]=[{'all':!![]}];}_0x262e25=_['merge']({},_0x262e25,_0x720b56[_0xccec('0x38')]);return db[_0xccec('0x3a')][_0xccec('0x41')](_0x262e25)['then'](handleEntityNotFound(_0x3b0472,null))[_0xccec('0x22')](respondWithResult(_0x3b0472,null))['catch'](handleError(_0x3b0472,null));};exports[_0xccec('0x42')]=function(_0xa6ef39,_0x1f6de7){return db['FreshdeskField'][_0xccec('0x42')](_0xa6ef39[_0xccec('0x43')],{})[_0xccec('0x22')](respondWithResult(_0x1f6de7,0xc9))['catch'](handleError(_0x1f6de7,null));};exports[_0xccec('0x21')]=function(_0x28064b,_0x25c627){if(_0x28064b[_0xccec('0x43')]['id']){delete _0x28064b[_0xccec('0x43')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x28064b['params']['id']}})[_0xccec('0x22')](handleEntityNotFound(_0x25c627,null))[_0xccec('0x22')](saveUpdates(_0x28064b[_0xccec('0x43')],null))[_0xccec('0x22')](respondWithResult(_0x25c627,null))[_0xccec('0x3d')](handleError(_0x25c627,null));};exports[_0xccec('0x23')]=function(_0x5b4826,_0x1ddc01){return db['FreshdeskField'][_0xccec('0x41')]({'where':{'id':_0x5b4826[_0xccec('0x44')]['id']}})['then'](handleEntityNotFound(_0x1ddc01,null))[_0xccec('0x22')](removeEntity(_0x1ddc01,null))[_0xccec('0x3d')](handleError(_0x1ddc01,null));}; \ No newline at end of file +var _0xad95=['offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','end','error','name','send','index','map','FreshdeskField','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json'];(function(_0x31ed74,_0x96d0de){var _0x260f84=function(_0x49e5f2){while(--_0x49e5f2){_0x31ed74['push'](_0x31ed74['shift']());}};_0x260f84(++_0x96d0de);}(_0xad95,0x70));var _0x5ad9=function(_0x3677c0,_0x377bb8){_0x3677c0=_0x3677c0-0x0;var _0x5475f1=_0xad95[_0x3677c0];return _0x5475f1;};'use strict';var emlformat=require(_0x5ad9('0x0'));var rimraf=require(_0x5ad9('0x1'));var zipdir=require(_0x5ad9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ad9('0x3'));var BPromise=require(_0x5ad9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5ad9('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ad9('0x6'));var squel=require(_0x5ad9('0x7'));var crypto=require(_0x5ad9('0x8'));var jsforce=require(_0x5ad9('0x9'));var deskjs=require(_0x5ad9('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5ad9('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5ad9('0xc'));var qs=require(_0x5ad9('0xd'));var as=require(_0x5ad9('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ad9('0xf'))(_0x5ad9('0x10'));var utils=require('../../config/utils');var config=require(_0x5ad9('0x11'));var licenseUtil=require(_0x5ad9('0x12'));var db=require(_0x5ad9('0x13'))['db'];function respondWithStatusCode(_0x3b2718,_0x262ce4){_0x262ce4=_0x262ce4||0xcc;return function(_0xc7e5e9){if(_0xc7e5e9){return _0x3b2718['sendStatus'](_0x262ce4);}return _0x3b2718['status'](_0x262ce4)['end']();};}function respondWithResult(_0x431358,_0x4519ad){_0x4519ad=_0x4519ad||0xc8;return function(_0x52cb37){if(_0x52cb37){return _0x431358[_0x5ad9('0x14')](_0x4519ad)[_0x5ad9('0x15')](_0x52cb37);}};}function respondWithFilteredResult(_0x3f16ef,_0x543743){return function(_0x3da125){if(_0x3da125){var _0x32b0bd=typeof _0x543743[_0x5ad9('0x16')]===_0x5ad9('0x17')&&typeof _0x543743[_0x5ad9('0x18')]===_0x5ad9('0x17');var _0x521cc3=_0x3da125[_0x5ad9('0x19')];var _0x54f392=_0x32b0bd?0x0:_0x543743[_0x5ad9('0x16')];var _0x28682f=_0x32b0bd?_0x3da125[_0x5ad9('0x19')]:_0x543743[_0x5ad9('0x16')]+_0x543743[_0x5ad9('0x18')];var _0x2ba5c0;if(_0x28682f>=_0x521cc3){_0x28682f=_0x521cc3;_0x2ba5c0=0xc8;}else{_0x2ba5c0=0xce;}_0x3f16ef[_0x5ad9('0x14')](_0x2ba5c0);return _0x3f16ef['set'](_0x5ad9('0x1a'),_0x54f392+'-'+_0x28682f+'/'+_0x521cc3)['json'](_0x3da125);}return null;};}function patchUpdates(_0x49363b){return function(_0x3356e5){try{jsonpatch['apply'](_0x3356e5,_0x49363b,!![]);}catch(_0xded166){return BPromise[_0x5ad9('0x1b')](_0xded166);}return _0x3356e5[_0x5ad9('0x1c')]();};}function saveUpdates(_0xebbe63,_0x1274f7){return function(_0x57b2ba){if(_0x57b2ba){return _0x57b2ba[_0x5ad9('0x1d')](_0xebbe63)['then'](function(_0x807b05){return _0x807b05;});}return null;};}function removeEntity(_0x5b816d,_0x570d3c){return function(_0x524249){if(_0x524249){return _0x524249[_0x5ad9('0x1e')]()[_0x5ad9('0x1f')](function(){_0x5b816d[_0x5ad9('0x14')](0xcc)[_0x5ad9('0x20')]();});}};}function handleEntityNotFound(_0x1252e6,_0x36da5f){return function(_0x11d919){if(!_0x11d919){_0x1252e6['sendStatus'](0x194);}return _0x11d919;};}function handleError(_0x54e9dd,_0xe6540f){_0xe6540f=_0xe6540f||0x1f4;return function(_0x4f3889){logger[_0x5ad9('0x21')](_0x4f3889['stack']);if(_0x4f3889[_0x5ad9('0x22')]){delete _0x4f3889['name'];}_0x54e9dd['status'](_0xe6540f)[_0x5ad9('0x23')](_0x4f3889);};}exports[_0x5ad9('0x24')]=function(_0x49b3df,_0x509d41){var _0x3942fa={},_0x129804={},_0x1b6faf={'count':0x0,'rows':[]};var _0x2ad078=_[_0x5ad9('0x25')](db[_0x5ad9('0x26')]['rawAttributes'],function(_0x132ec6){return{'name':_0x132ec6[_0x5ad9('0x27')],'type':_0x132ec6[_0x5ad9('0x28')][_0x5ad9('0x29')]};});_0x129804['model']=_['map'](_0x2ad078,_0x5ad9('0x22'));_0x129804[_0x5ad9('0x2a')]=_['keys'](_0x49b3df['query']);_0x129804['filters']=_[_0x5ad9('0x2b')](_0x129804[_0x5ad9('0x2c')],_0x129804['query']);_0x3942fa[_0x5ad9('0x2d')]=_[_0x5ad9('0x2b')](_0x129804[_0x5ad9('0x2c')],qs[_0x5ad9('0x2e')](_0x49b3df['query']['fields']));_0x3942fa[_0x5ad9('0x2d')]=_0x3942fa[_0x5ad9('0x2d')][_0x5ad9('0x2f')]?_0x3942fa[_0x5ad9('0x2d')]:_0x129804[_0x5ad9('0x2c')];if(!_0x49b3df['query'][_0x5ad9('0x30')](_0x5ad9('0x31'))){_0x3942fa[_0x5ad9('0x18')]=qs[_0x5ad9('0x18')](_0x49b3df[_0x5ad9('0x2a')][_0x5ad9('0x18')]);_0x3942fa['offset']=qs[_0x5ad9('0x16')](_0x49b3df[_0x5ad9('0x2a')]['offset']);}_0x3942fa[_0x5ad9('0x32')]=qs[_0x5ad9('0x33')](_0x49b3df['query'][_0x5ad9('0x33')]);_0x3942fa[_0x5ad9('0x34')]=qs[_0x5ad9('0x35')](_['pick'](_0x49b3df[_0x5ad9('0x2a')],_0x129804[_0x5ad9('0x35')]),_0x2ad078);if(_0x49b3df[_0x5ad9('0x2a')][_0x5ad9('0x36')]){_0x3942fa['where']=_[_0x5ad9('0x37')](_0x3942fa[_0x5ad9('0x34')],{'$or':_[_0x5ad9('0x25')](_0x2ad078,function(_0x143700){if(_0x143700[_0x5ad9('0x28')]!==_0x5ad9('0x38')){var _0x1f0c06={};_0x1f0c06[_0x143700[_0x5ad9('0x22')]]={'$like':'%'+_0x49b3df[_0x5ad9('0x2a')]['filter']+'%'};return _0x1f0c06;}})});}_0x3942fa=_[_0x5ad9('0x37')]({},_0x3942fa,_0x49b3df[_0x5ad9('0x39')]);var _0x41d733={'where':_0x3942fa[_0x5ad9('0x34')]};return db[_0x5ad9('0x26')]['count'](_0x41d733)[_0x5ad9('0x1f')](function(_0xbbfaa0){_0x1b6faf[_0x5ad9('0x19')]=_0xbbfaa0;if(_0x49b3df['query'][_0x5ad9('0x3a')]){_0x3942fa[_0x5ad9('0x3b')]=[{'all':!![]}];}return db[_0x5ad9('0x26')]['findAll'](_0x3942fa);})[_0x5ad9('0x1f')](function(_0x5cfe5b){_0x1b6faf['rows']=_0x5cfe5b;return _0x1b6faf;})[_0x5ad9('0x1f')](respondWithFilteredResult(_0x509d41,_0x3942fa))[_0x5ad9('0x3c')](handleError(_0x509d41,null));};exports[_0x5ad9('0x3d')]=function(_0x24f377,_0x5b8608){var _0x526fda={'raw':!![],'where':{'id':_0x24f377['params']['id']}},_0x552c39={};_0x552c39[_0x5ad9('0x2c')]=_['keys'](db[_0x5ad9('0x26')]['rawAttributes']);_0x552c39[_0x5ad9('0x2a')]=_[_0x5ad9('0x3e')](_0x24f377[_0x5ad9('0x2a')]);_0x552c39[_0x5ad9('0x35')]=_[_0x5ad9('0x2b')](_0x552c39[_0x5ad9('0x2c')],_0x552c39[_0x5ad9('0x2a')]);_0x526fda[_0x5ad9('0x2d')]=_[_0x5ad9('0x2b')](_0x552c39['model'],qs[_0x5ad9('0x2e')](_0x24f377[_0x5ad9('0x2a')][_0x5ad9('0x2e')]));_0x526fda[_0x5ad9('0x2d')]=_0x526fda[_0x5ad9('0x2d')]['length']?_0x526fda[_0x5ad9('0x2d')]:_0x552c39['model'];if(_0x24f377['query']['includeAll']){_0x526fda[_0x5ad9('0x3b')]=[{'all':!![]}];}_0x526fda=_[_0x5ad9('0x37')]({},_0x526fda,_0x24f377[_0x5ad9('0x39')]);return db['FreshdeskField'][_0x5ad9('0x3f')](_0x526fda)[_0x5ad9('0x1f')](handleEntityNotFound(_0x5b8608,null))[_0x5ad9('0x1f')](respondWithResult(_0x5b8608,null))[_0x5ad9('0x3c')](handleError(_0x5b8608,null));};exports['create']=function(_0x126086,_0x420677){return db[_0x5ad9('0x26')][_0x5ad9('0x40')](_0x126086['body'],{})[_0x5ad9('0x1f')](respondWithResult(_0x420677,0xc9))[_0x5ad9('0x3c')](handleError(_0x420677,null));};exports[_0x5ad9('0x1d')]=function(_0x1e03f,_0x479bbc){if(_0x1e03f[_0x5ad9('0x41')]['id']){delete _0x1e03f[_0x5ad9('0x41')]['id'];}return db['FreshdeskField'][_0x5ad9('0x3f')]({'where':{'id':_0x1e03f['params']['id']}})[_0x5ad9('0x1f')](handleEntityNotFound(_0x479bbc,null))[_0x5ad9('0x1f')](saveUpdates(_0x1e03f[_0x5ad9('0x41')],null))[_0x5ad9('0x1f')](respondWithResult(_0x479bbc,null))[_0x5ad9('0x3c')](handleError(_0x479bbc,null));};exports[_0x5ad9('0x1e')]=function(_0xa0f426,_0x2c3945){return db[_0x5ad9('0x26')][_0x5ad9('0x3f')]({'where':{'id':_0xa0f426[_0x5ad9('0x42')]['id']}})[_0x5ad9('0x1f')](handleEntityNotFound(_0x2c3945,null))[_0x5ad9('0x1f')](removeEntity(_0x2c3945,null))[_0x5ad9('0x3c')](handleError(_0x2c3945,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f147fc9..5e01b8a 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 _0x60e6=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId'];(function(_0x2052b2,_0x4b9a83){var _0x33448e=function(_0x21ed8e){while(--_0x21ed8e){_0x2052b2['push'](_0x2052b2['shift']());}};_0x33448e(++_0x4b9a83);}(_0x60e6,0xd2));var _0x660e=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0x60e6[_0x1443eb];return _0x2b8810;};'use strict';var _=require(_0x660e('0x0'));var util=require(_0x660e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x660e('0x2'));var BPromise=require(_0x660e('0x3'));var rp=require(_0x660e('0x4'));var fs=require('fs');var path=require(_0x660e('0x5'));var rimraf=require(_0x660e('0x6'));var config=require(_0x660e('0x7'));var attributes=require(_0x660e('0x8'));module[_0x660e('0x9')]=function(_0x9da18d,_0x4b393f){return _0x9da18d[_0x660e('0xa')](_0x660e('0xb'),attributes,{'tableName':_0x660e('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x660e('0xd'),_0x660e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x677f=['idField','lodash','util','api','moment','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x39c51e,_0x2cd366){var _0x595842=function(_0x59d47e){while(--_0x59d47e){_0x39c51e['push'](_0x39c51e['shift']());}};_0x595842(++_0x2cd366);}(_0x677f,0xf8));var _0xf677=function(_0xdba1a,_0xc401fd){_0xdba1a=_0xdba1a-0x0;var _0x2d0d34=_0x677f[_0xdba1a];return _0x2d0d34;};'use strict';var _=require(_0xf677('0x0'));var util=require(_0xf677('0x1'));var logger=require('../../config/logger')(_0xf677('0x2'));var moment=require(_0xf677('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf677('0x4'));var rimraf=require(_0xf677('0x5'));var config=require(_0xf677('0x6'));var attributes=require(_0xf677('0x7'));module[_0xf677('0x8')]=function(_0x468326,_0xbc05c5){return _0x468326[_0xf677('0x9')]('FreshdeskField',attributes,{'tableName':_0xf677('0xa'),'paranoid':![],'indexes':[{'name':_0xf677('0xb'),'fields':[_0xf677('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index d0686a4..55f6a4a 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 _0x305b=['info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x305b,0xa4));var _0xb305=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x305b[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0xb305('0x0'));var moment=require('moment');var BPromise=require(_0xb305('0x1'));var rs=require(_0xb305('0x2'));var fs=require('fs');var Redis=require(_0xb305('0x3'));var db=require(_0xb305('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb305('0x5'))('rpc');var config=require(_0xb305('0x6'));var jayson=require(_0xb305('0x7'));var client=jayson[_0xb305('0x8')][_0xb305('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f145,_0xa84d70,_0x5b4244){return new BPromise(function(_0x1d9297,_0x4717a0){return client[_0xb305('0xa')](_0x21f145,_0x5b4244)[_0xb305('0xb')](function(_0x1e5795){logger[_0xb305('0xc')](_0xb305('0xd'),_0xa84d70,'request\x20sent');logger[_0xb305('0xe')](_0xb305('0xf'),_0xa84d70,_0xb305('0x10'),JSON[_0xb305('0x11')](_0x1e5795));if(_0x1e5795[_0xb305('0x12')]){if(_0x1e5795[_0xb305('0x12')]['code']===0x1f4){logger[_0xb305('0x12')](_0xb305('0xd'),_0xa84d70,_0x1e5795[_0xb305('0x12')]['message']);return _0x4717a0(_0x1e5795[_0xb305('0x12')][_0xb305('0x13')]);}logger[_0xb305('0x12')](_0xb305('0xd'),_0xa84d70,_0x1e5795['error']['message']);return _0x1d9297(_0x1e5795[_0xb305('0x12')][_0xb305('0x13')]);}else{logger['info'](_0xb305('0xd'),_0xa84d70,_0xb305('0x10'));_0x1d9297(_0x1e5795[_0xb305('0x14')][_0xb305('0x13')]);}})[_0xb305('0x15')](function(_0x98d6f6){logger[_0xb305('0x12')]('FreshdeskField,\x20%s,\x20%s',_0xa84d70,_0x98d6f6);_0x4717a0(_0x98d6f6);});});} \ No newline at end of file +var _0x20fe=['stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x209511,_0x231622){var _0x39b937=function(_0x4005a3){while(--_0x4005a3){_0x209511['push'](_0x209511['shift']());}};_0x39b937(++_0x231622);}(_0x20fe,0x130));var _0xe20f=function(_0x319760,_0x44458d){_0x319760=_0x319760-0x0;var _0x4871c3=_0x20fe[_0x319760];return _0x4871c3;};'use strict';var _=require(_0xe20f('0x0'));var util=require(_0xe20f('0x1'));var moment=require(_0xe20f('0x2'));var BPromise=require(_0xe20f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe20f('0x4'));var db=require(_0xe20f('0x5'))['db'];var utils=require(_0xe20f('0x6'));var logger=require(_0xe20f('0x7'))(_0xe20f('0x8'));var config=require(_0xe20f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe20f('0xa')][_0xe20f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d2066,_0x3a2770,_0x1c163f){return new BPromise(function(_0x5af2d7,_0x55375b){return client[_0xe20f('0xc')](_0x1d2066,_0x1c163f)[_0xe20f('0xd')](function(_0x5eaee2){logger[_0xe20f('0xe')](_0xe20f('0xf'),_0x3a2770,'request\x20sent');logger[_0xe20f('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3a2770,_0xe20f('0x11'),JSON[_0xe20f('0x12')](_0x5eaee2));if(_0x5eaee2[_0xe20f('0x13')]){if(_0x5eaee2[_0xe20f('0x13')][_0xe20f('0x14')]===0x1f4){logger[_0xe20f('0x13')](_0xe20f('0xf'),_0x3a2770,_0x5eaee2[_0xe20f('0x13')][_0xe20f('0x15')]);return _0x55375b(_0x5eaee2[_0xe20f('0x13')]['message']);}logger[_0xe20f('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3a2770,_0x5eaee2[_0xe20f('0x13')]['message']);return _0x5af2d7(_0x5eaee2[_0xe20f('0x13')]['message']);}else{logger[_0xe20f('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x3a2770,_0xe20f('0x11'));_0x5af2d7(_0x5eaee2['result'][_0xe20f('0x15')]);}})[_0xe20f('0x16')](function(_0x3eb9aa){logger[_0xe20f('0x13')](_0xe20f('0xf'),_0x3a2770,_0x3eb9aa);_0x55375b(_0x3eb9aa);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6841e9d..7d16e61 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 _0x16d2=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x16d2,0x123));var _0x216d=function(_0x2c5bd5,_0x606b6e){_0x2c5bd5=_0x2c5bd5-0x0;var _0x50a9ff=_0x16d2[_0x2c5bd5];return _0x50a9ff;};'use strict';var multer=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var path=require(_0x216d('0x2'));var timeout=require(_0x216d('0x3'));var express=require(_0x216d('0x4'));var router=express[_0x216d('0x5')]();var fs_extra=require(_0x216d('0x6'));var auth=require(_0x216d('0x7'));var interaction=require(_0x216d('0x8'));var config=require('../../config/environment');var controller=require(_0x216d('0x9'));router[_0x216d('0xa')]('/',auth[_0x216d('0xb')](),controller[_0x216d('0xc')]);router[_0x216d('0xa')](_0x216d('0xd'),auth[_0x216d('0xb')](),controller[_0x216d('0xe')]);router['get'](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x10')]);router[_0x216d('0xa')](_0x216d('0x11'),auth[_0x216d('0xb')](),controller['getFields']);router[_0x216d('0x12')]('/',auth['isAuthenticated'](),controller[_0x216d('0x13')]);router[_0x216d('0x12')](_0x216d('0xf'),auth[_0x216d('0xb')](),controller[_0x216d('0x14')]);router[_0x216d('0x15')]('/:id',auth[_0x216d('0xb')](),controller['update']);router[_0x216d('0x16')](_0x216d('0xd'),auth['isAuthenticated'](),controller[_0x216d('0x17')]);module[_0x216d('0x18')]=router; \ No newline at end of file +var _0xf7b4=['destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf7b4,0x152));var _0x4f7b=function(_0x366783,_0x339fd8){_0x366783=_0x366783-0x0;var _0x3562b7=_0xf7b4[_0x366783];return _0x3562b7;};'use strict';var multer=require(_0x4f7b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4f7b('0x1'));var express=require(_0x4f7b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4f7b('0x3'));var interaction=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var controller=require(_0x4f7b('0x6'));router[_0x4f7b('0x7')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x9')]);router[_0x4f7b('0x7')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xb')]);router[_0x4f7b('0x7')](_0x4f7b('0xc'),auth['isAuthenticated'](),controller[_0x4f7b('0xd')]);router[_0x4f7b('0x7')]('/:id/fields',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0xe')]);router[_0x4f7b('0xf')]('/',auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x10')]);router['post'](_0x4f7b('0xc'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x4f7b('0x11')](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x12')]);router['delete'](_0x4f7b('0xa'),auth[_0x4f7b('0x8')](),controller[_0x4f7b('0x13')]);module[_0x4f7b('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 b64ec1a..3785e2f 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 _0xd943=['exports','STRING','username','remoteUri','sequelize'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xd943,0x15d));var _0x3d94=function(_0x3877f1,_0x4e9ab1){_0x3877f1=_0x3877f1-0x0;var _0x1762cf=_0xd943[_0x3877f1];return _0x1762cf;};'use strict';var Sequelize=require(_0x3d94('0x0'));module[_0x3d94('0x1')]={'name':{'type':Sequelize[_0x3d94('0x2')]},'description':{'type':Sequelize[_0x3d94('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3d94('0x3')},'apiKey':{'type':Sequelize[_0x3d94('0x2')]},'remoteUri':{'type':Sequelize[_0x3d94('0x2')],'unique':_0x3d94('0x4')},'serverUrl':{'type':Sequelize[_0x3d94('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6a55=['STRING','sequelize'];(function(_0x3f3f44,_0x2a3574){var _0xeedf00=function(_0x513427){while(--_0x513427){_0x3f3f44['push'](_0x3f3f44['shift']());}};_0xeedf00(++_0x2a3574);}(_0x6a55,0xdb));var _0x56a5=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0x6a55[_0x55e059];return _0x1e6bb7;};'use strict';var Sequelize=require(_0x56a5('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x56a5('0x1')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x56a5('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x56a5('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index abacc1e..eaebf6d 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 _0x6f06=['apply','reject','save','sendStatus','stack','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','users','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','request-promise','moment','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/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x188110,_0x5588f9){var _0x654e37=function(_0x31958a){while(--_0x31958a){_0x188110['push'](_0x188110['shift']());}};_0x654e37(++_0x5588f9);}(_0x6f06,0x117));var _0x66f0=function(_0x50b634,_0x1a9974){_0x50b634=_0x50b634-0x0;var _0xcbb832=_0x6f06[_0x50b634];return _0xcbb832;};'use strict';var emlformat=require(_0x66f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66f0('0x2'));var moment=require(_0x66f0('0x3'));var BPromise=require(_0x66f0('0x4'));var Mustache=require(_0x66f0('0x5'));var util=require('util');var path=require(_0x66f0('0x6'));var sox=require(_0x66f0('0x7'));var csv=require(_0x66f0('0x8'));var ejs=require(_0x66f0('0x9'));var fs=require('fs');var fs_extra=require(_0x66f0('0xa'));var _=require('lodash');var squel=require(_0x66f0('0xb'));var crypto=require(_0x66f0('0xc'));var jsforce=require(_0x66f0('0xd'));var deskjs=require(_0x66f0('0xe'));var toCsv=require(_0x66f0('0x8'));var querystring=require(_0x66f0('0xf'));var Papa=require(_0x66f0('0x10'));var Redis=require(_0x66f0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x66f0('0x12'));var as=require(_0x66f0('0x13'));var hardwareService=require(_0x66f0('0x14'));var logger=require(_0x66f0('0x15'))(_0x66f0('0x16'));var utils=require(_0x66f0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x66f0('0x18'));var db=require(_0x66f0('0x19'))['db'];var integrations=require(_0x66f0('0x1a'));function respondWithStatusCode(_0x41faae,_0x9d3e47){_0x9d3e47=_0x9d3e47||0xcc;return function(_0x6f57a7){if(_0x6f57a7){return _0x41faae['sendStatus'](_0x9d3e47);}return _0x41faae[_0x66f0('0x1b')](_0x9d3e47)[_0x66f0('0x1c')]();};}function respondWithResult(_0x2cb9bd,_0x2c7579){_0x2c7579=_0x2c7579||0xc8;return function(_0x2d586c){if(_0x2d586c){return _0x2cb9bd[_0x66f0('0x1b')](_0x2c7579)[_0x66f0('0x1d')](_0x2d586c);}};}function respondWithFilteredResult(_0x3f6c2a,_0x38d0bd){return function(_0x586c1a){if(_0x586c1a){var _0x54a8af=typeof _0x38d0bd[_0x66f0('0x1e')]===_0x66f0('0x1f')&&typeof _0x38d0bd[_0x66f0('0x20')]==='undefined';var _0x4c846c=_0x586c1a[_0x66f0('0x21')];var _0x142326=_0x54a8af?0x0:_0x38d0bd[_0x66f0('0x1e')];var _0x39cb2a=_0x54a8af?_0x586c1a[_0x66f0('0x21')]:_0x38d0bd[_0x66f0('0x1e')]+_0x38d0bd[_0x66f0('0x20')];var _0x2a409a;if(_0x39cb2a>=_0x4c846c){_0x39cb2a=_0x4c846c;_0x2a409a=0xc8;}else{_0x2a409a=0xce;}_0x3f6c2a[_0x66f0('0x1b')](_0x2a409a);return _0x3f6c2a[_0x66f0('0x22')](_0x66f0('0x23'),_0x142326+'-'+_0x39cb2a+'/'+_0x4c846c)[_0x66f0('0x1d')](_0x586c1a);}return null;};}function patchUpdates(_0x4f4967){return function(_0x2776b3){try{jsonpatch[_0x66f0('0x24')](_0x2776b3,_0x4f4967,!![]);}catch(_0x4254a0){return BPromise[_0x66f0('0x25')](_0x4254a0);}return _0x2776b3[_0x66f0('0x26')]();};}function saveUpdates(_0xd8665c,_0x4f6f94){return function(_0x162cbc){if(_0x162cbc){return _0x162cbc['update'](_0xd8665c)['then'](function(_0x1b6b95){return _0x1b6b95;});}return null;};}function removeEntity(_0x45cb13,_0x4a7a7e){return function(_0x5f07e4){if(_0x5f07e4){return _0x5f07e4['destroy']()['then'](function(){_0x45cb13['status'](0xcc)[_0x66f0('0x1c')]();});}};}function handleEntityNotFound(_0x4cda4a,_0x3811ed){return function(_0x685d41){if(!_0x685d41){_0x4cda4a[_0x66f0('0x27')](0x194);}return _0x685d41;};}function handleError(_0x2fe097,_0x3aec96){_0x3aec96=_0x3aec96||0x1f4;return function(_0x29d01f){logger['error'](_0x29d01f[_0x66f0('0x28')]);if(_0x29d01f[_0x66f0('0x29')]){delete _0x29d01f['name'];}_0x2fe097['status'](_0x3aec96)[_0x66f0('0x2a')](_0x29d01f);};}exports[_0x66f0('0x2b')]=function(_0x4aae83,_0x5270ce){var _0xe050ed={},_0x54bb3b={},_0x55e4ed={'count':0x0,'rows':[]};var _0x490004=_['map'](db[_0x66f0('0x2c')][_0x66f0('0x2d')],function(_0x32df8e){return{'name':_0x32df8e[_0x66f0('0x2e')],'type':_0x32df8e[_0x66f0('0x2f')]['key']};});_0x54bb3b[_0x66f0('0x30')]=_[_0x66f0('0x31')](_0x490004,_0x66f0('0x29'));_0x54bb3b['query']=_[_0x66f0('0x32')](_0x4aae83[_0x66f0('0x33')]);_0x54bb3b[_0x66f0('0x34')]=_[_0x66f0('0x35')](_0x54bb3b[_0x66f0('0x30')],_0x54bb3b['query']);_0xe050ed[_0x66f0('0x36')]=_[_0x66f0('0x35')](_0x54bb3b[_0x66f0('0x30')],qs[_0x66f0('0x37')](_0x4aae83[_0x66f0('0x33')][_0x66f0('0x37')]));_0xe050ed[_0x66f0('0x36')]=_0xe050ed[_0x66f0('0x36')][_0x66f0('0x38')]?_0xe050ed[_0x66f0('0x36')]:_0x54bb3b[_0x66f0('0x30')];if(!_0x4aae83[_0x66f0('0x33')]['hasOwnProperty'](_0x66f0('0x39'))){_0xe050ed[_0x66f0('0x20')]=qs[_0x66f0('0x20')](_0x4aae83[_0x66f0('0x33')]['limit']);_0xe050ed['offset']=qs[_0x66f0('0x1e')](_0x4aae83[_0x66f0('0x33')][_0x66f0('0x1e')]);}_0xe050ed[_0x66f0('0x3a')]=qs[_0x66f0('0x3b')](_0x4aae83[_0x66f0('0x33')]['sort']);_0xe050ed[_0x66f0('0x3c')]=qs['filters'](_['pick'](_0x4aae83[_0x66f0('0x33')],_0x54bb3b[_0x66f0('0x34')]),_0x490004);if(_0x4aae83[_0x66f0('0x33')][_0x66f0('0x3d')]){_0xe050ed[_0x66f0('0x3c')]=_['merge'](_0xe050ed[_0x66f0('0x3c')],{'$or':_[_0x66f0('0x31')](_0x490004,function(_0x352b35){if(_0x352b35[_0x66f0('0x2f')]!==_0x66f0('0x3e')){var _0xe5f189={};_0xe5f189[_0x352b35[_0x66f0('0x29')]]={'$like':'%'+_0x4aae83[_0x66f0('0x33')]['filter']+'%'};return _0xe5f189;}})});}_0xe050ed=_[_0x66f0('0x3f')]({},_0xe050ed,_0x4aae83[_0x66f0('0x40')]);var _0x1328a8={'where':_0xe050ed['where']};return db['FreshsalesAccount'][_0x66f0('0x21')](_0x1328a8)[_0x66f0('0x41')](function(_0x26983e){_0x55e4ed[_0x66f0('0x21')]=_0x26983e;if(_0x4aae83[_0x66f0('0x33')][_0x66f0('0x42')]){_0xe050ed[_0x66f0('0x43')]=[{'all':!![]}];}return db[_0x66f0('0x2c')][_0x66f0('0x44')](_0xe050ed);})[_0x66f0('0x41')](function(_0x208725){_0x55e4ed[_0x66f0('0x45')]=_0x208725;return _0x55e4ed;})[_0x66f0('0x41')](respondWithFilteredResult(_0x5270ce,_0xe050ed))[_0x66f0('0x46')](handleError(_0x5270ce,null));};exports[_0x66f0('0x47')]=function(_0x3286b4,_0xe7e2c0){var _0x3ebad9={'raw':![],'where':{'id':_0x3286b4[_0x66f0('0x48')]['id']}},_0x1a76eb={};_0x1a76eb[_0x66f0('0x30')]=_[_0x66f0('0x32')](db[_0x66f0('0x2c')][_0x66f0('0x2d')]);_0x1a76eb['query']=_['keys'](_0x3286b4['query']);_0x1a76eb['filters']=_[_0x66f0('0x35')](_0x1a76eb[_0x66f0('0x30')],_0x1a76eb['query']);_0x3ebad9[_0x66f0('0x36')]=_[_0x66f0('0x35')](_0x1a76eb[_0x66f0('0x30')],qs['fields'](_0x3286b4[_0x66f0('0x33')][_0x66f0('0x37')]));_0x3ebad9[_0x66f0('0x36')]=_0x3ebad9[_0x66f0('0x36')][_0x66f0('0x38')]?_0x3ebad9[_0x66f0('0x36')]:_0x1a76eb[_0x66f0('0x30')];if(_0x3286b4[_0x66f0('0x33')][_0x66f0('0x42')]){_0x3ebad9[_0x66f0('0x43')]=[{'all':!![]}];}_0x3ebad9=_[_0x66f0('0x3f')]({},_0x3ebad9,_0x3286b4[_0x66f0('0x40')]);return db['FreshsalesAccount'][_0x66f0('0x49')](_0x3ebad9)[_0x66f0('0x41')](handleEntityNotFound(_0xe7e2c0,null))[_0x66f0('0x41')](respondWithResult(_0xe7e2c0,null))[_0x66f0('0x46')](handleError(_0xe7e2c0,null));};exports['create']=function(_0x54e9ad,_0x49442c){return db['FreshsalesAccount'][_0x66f0('0x4a')](_0x54e9ad[_0x66f0('0x4b')],{})['then'](respondWithResult(_0x49442c,0xc9))['catch'](handleError(_0x49442c,null));};exports[_0x66f0('0x4c')]=function(_0x28a41c,_0x49f6a1){if(_0x28a41c[_0x66f0('0x4b')]['id']){delete _0x28a41c[_0x66f0('0x4b')]['id'];}return db['FreshsalesAccount'][_0x66f0('0x49')]({'where':{'id':_0x28a41c[_0x66f0('0x48')]['id']}})[_0x66f0('0x41')](handleEntityNotFound(_0x49f6a1,null))[_0x66f0('0x41')](saveUpdates(_0x28a41c['body'],null))[_0x66f0('0x41')](respondWithResult(_0x49f6a1,null))[_0x66f0('0x46')](handleError(_0x49f6a1,null));};exports[_0x66f0('0x4d')]=function(_0x2eaa43,_0x18551d){return db[_0x66f0('0x2c')][_0x66f0('0x49')]({'where':{'id':_0x2eaa43[_0x66f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x18551d,null))['then'](removeEntity(_0x18551d,null))[_0x66f0('0x46')](handleError(_0x18551d,null));};exports[_0x66f0('0x4e')]=function(_0x434283,_0x2bffc8,_0x19ce96){var _0x5331a7={};var _0x9b961a={};var _0xb7e9cb;var _0xd6c140;return db[_0x66f0('0x2c')]['findOne']({'where':{'id':_0x434283[_0x66f0('0x48')]['id']}})[_0x66f0('0x41')](handleEntityNotFound(_0x2bffc8,null))[_0x66f0('0x41')](function(_0x3d5152){if(_0x3d5152){_0xb7e9cb=_0x3d5152;_0x9b961a[_0x66f0('0x30')]=_[_0x66f0('0x32')](db[_0x66f0('0x4f')]['rawAttributes']);_0x9b961a[_0x66f0('0x33')]=_[_0x66f0('0x32')](_0x434283[_0x66f0('0x33')]);_0x9b961a['filters']=_[_0x66f0('0x35')](_0x9b961a[_0x66f0('0x30')],_0x9b961a[_0x66f0('0x33')]);_0x5331a7[_0x66f0('0x36')]=_[_0x66f0('0x35')](_0x9b961a[_0x66f0('0x30')],qs['fields'](_0x434283[_0x66f0('0x33')][_0x66f0('0x37')]));_0x5331a7[_0x66f0('0x36')]=_0x5331a7[_0x66f0('0x36')][_0x66f0('0x38')]?_0x5331a7[_0x66f0('0x36')]:_0x9b961a[_0x66f0('0x30')];_0x5331a7[_0x66f0('0x3a')]=qs[_0x66f0('0x3b')](_0x434283['query']['sort']);_0x5331a7[_0x66f0('0x3c')]=qs[_0x66f0('0x34')](_['pick'](_0x434283[_0x66f0('0x33')],_0x9b961a[_0x66f0('0x34')]));if(_0x434283[_0x66f0('0x33')][_0x66f0('0x3d')]){_0x5331a7[_0x66f0('0x3c')]=_['merge'](_0x5331a7['where'],{'$or':_[_0x66f0('0x31')](_0x5331a7[_0x66f0('0x36')],function(_0x2e1a8d){var _0xe8fe56={};_0xe8fe56[_0x2e1a8d]={'$like':'%'+_0x434283[_0x66f0('0x33')][_0x66f0('0x3d')]+'%'};return _0xe8fe56;})});}_0x5331a7=_['merge']({},_0x5331a7,_0x434283[_0x66f0('0x40')]);return _0xb7e9cb[_0x66f0('0x4e')](_0x5331a7);}})[_0x66f0('0x41')](function(_0x46cd5e){if(_0x46cd5e){_0xd6c140=_0x46cd5e[_0x66f0('0x38')];if(!_0x434283['query']['hasOwnProperty'](_0x66f0('0x39'))){_0x5331a7[_0x66f0('0x20')]=qs[_0x66f0('0x20')](_0x434283[_0x66f0('0x33')][_0x66f0('0x20')]);_0x5331a7[_0x66f0('0x1e')]=qs[_0x66f0('0x1e')](_0x434283[_0x66f0('0x33')]['offset']);}return _0xb7e9cb[_0x66f0('0x4e')](_0x5331a7);}})['then'](function(_0x8a1aaf){if(_0x8a1aaf){return _0x8a1aaf?{'count':_0xd6c140,'rows':_0x8a1aaf}:null;}})[_0x66f0('0x41')](respondWithResult(_0x2bffc8,null))[_0x66f0('0x46')](handleError(_0x2bffc8,null));};exports[_0x66f0('0x50')]=function(_0x26e5a8,_0x13a33d,_0x5cf7b9){if(_0x26e5a8[_0x66f0('0x4b')]['id']){delete _0x26e5a8[_0x66f0('0x4b')]['id'];}return db['FreshsalesAccount'][_0x66f0('0x51')]({'where':{'id':_0x26e5a8['params']['id']}})[_0x66f0('0x41')](handleEntityNotFound(_0x13a33d,null))[_0x66f0('0x41')](function(_0xd673bd){if(_0xd673bd){_0x26e5a8[_0x66f0('0x4b')][_0x66f0('0x52')]=_0xd673bd['id'];_0x26e5a8[_0x66f0('0x4b')][_0x66f0('0x53')]=integrations['getSubjects'](_0x26e5a8[_0x66f0('0x4b')][_0x66f0('0x54')],_0x26e5a8[_0x66f0('0x4b')][_0x66f0('0x2f')]);_0x26e5a8[_0x66f0('0x4b')][_0x66f0('0x55')]=integrations[_0x66f0('0x56')](_0x26e5a8['body'][_0x66f0('0x54')],_0x26e5a8[_0x66f0('0x4b')][_0x66f0('0x2f')]);return db[_0x66f0('0x4f')]['create'](_0x26e5a8['body'],{'include':[{'model':db[_0x66f0('0x57')],'as':_0x66f0('0x53')},{'model':db[_0x66f0('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x13a33d,null))[_0x66f0('0x46')](handleError(_0x13a33d,null));};exports[_0x66f0('0x58')]=function(_0x78f25c,_0xbec7c0,_0xd012a2){var _0x5f598d='';var _0x5bc726='';return db[_0x66f0('0x2c')][_0x66f0('0x51')]({'where':{'id':_0x78f25c[_0x66f0('0x48')]['id']},'attributes':['id',_0x66f0('0x59'),_0x66f0('0x5a'),_0x66f0('0x5b')]})[_0x66f0('0x41')](handleEntityNotFound(_0xbec7c0,null))[_0x66f0('0x41')](function(_0x22ea04){if(_0x22ea04){_0x5bc726=_0x22ea04['username'];_0x5f598d=_0x22ea04[_0x66f0('0x5a')];var _0x3f9336=_0x22ea04[_0x66f0('0x5a')][_0x66f0('0x5c')](-0x1);if(_0x3f9336==='/'){_0x5f598d=_0x5f598d[_0x66f0('0x5d')](0x0,_0x5f598d[_0x66f0('0x5e')](_0x3f9336));}return rp({'method':'GET','uri':util[_0x66f0('0x5f')](_0x66f0('0x60'),_0x5f598d,_0x66f0('0x61')),'headers':{'Authorization':_0x66f0('0x62')+_0x22ea04[_0x66f0('0x5b')]},'json':!![]});}})[_0x66f0('0x41')](function(_0x3a72b8){if(_0x3a72b8){var _0x5786da=_0x3a72b8[_0x66f0('0x63')];var _0x301701=![];var _0x2a8026=null;for(_0x2a8026=0x0;_0x2a8026<_0x5786da['length'];_0x2a8026++){if(_0x5786da[_0x2a8026]['email']===_0x5bc726){_0x301701=!![];}}if(_0x301701){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0xbec7c0,null))['catch'](function(_0x53f9c0){var _0x3dab67=_0x78f25c[_0x66f0('0x33')][_0x66f0('0x64')]?0x1f4:_0x53f9c0[_0x66f0('0x65')]||0x1f4;logger[_0x66f0('0x66')](_0x66f0('0x67'),'getFields',_0x3dab67,JSON[_0x66f0('0x68')](_0x53f9c0));delete _0x53f9c0['name'];if(_0x3dab67===0x191){_0x3dab67=0x190;}_0xbec7c0[_0x66f0('0x1b')](_0x3dab67)[_0x66f0('0x2a')](_0x78f25c['query'][_0x66f0('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x53f9c0[_0x66f0('0x65')]}:_0x53f9c0);});}; \ No newline at end of file +var _0x0e55=['merge','options','FreshsalesAccount','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','include','body','find','getConfigurations','FreshsalesConfiguration','addConfiguration','findOne','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','users','email','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','statusCode','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e55,0x8e));var _0x50e5=function(_0x4cca4f,_0x414aed){_0x4cca4f=_0x4cca4f-0x0;var _0x4bb584=_0x0e55[_0x4cca4f];return _0x4bb584;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x50e5('0x0'));var jsonpatch=require(_0x50e5('0x1'));var rp=require(_0x50e5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x50e5('0x3'));var util=require(_0x50e5('0x4'));var path=require(_0x50e5('0x5'));var sox=require(_0x50e5('0x6'));var csv=require(_0x50e5('0x7'));var ejs=require(_0x50e5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50e5('0x9'));var squel=require(_0x50e5('0xa'));var crypto=require(_0x50e5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x50e5('0xc'));var toCsv=require(_0x50e5('0x7'));var querystring=require(_0x50e5('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e5('0xe'));var authService=require(_0x50e5('0xf'));var qs=require(_0x50e5('0x10'));var as=require(_0x50e5('0x11'));var hardwareService=require(_0x50e5('0x12'));var logger=require(_0x50e5('0x13'))(_0x50e5('0x14'));var utils=require(_0x50e5('0x15'));var config=require(_0x50e5('0x16'));var licenseUtil=require(_0x50e5('0x17'));var db=require(_0x50e5('0x18'))['db'];var integrations=require(_0x50e5('0x19'));function respondWithStatusCode(_0x24dbbf,_0x5ccc51){_0x5ccc51=_0x5ccc51||0xcc;return function(_0x17fe90){if(_0x17fe90){return _0x24dbbf[_0x50e5('0x1a')](_0x5ccc51);}return _0x24dbbf['status'](_0x5ccc51)[_0x50e5('0x1b')]();};}function respondWithResult(_0x5c1643,_0x5ba80c){_0x5ba80c=_0x5ba80c||0xc8;return function(_0x552850){if(_0x552850){return _0x5c1643[_0x50e5('0x1c')](_0x5ba80c)[_0x50e5('0x1d')](_0x552850);}};}function respondWithFilteredResult(_0x1d5799,_0x4140dd){return function(_0x5ee3d3){if(_0x5ee3d3){var _0x4a67e5=typeof _0x4140dd[_0x50e5('0x1e')]===_0x50e5('0x1f')&&typeof _0x4140dd[_0x50e5('0x20')]===_0x50e5('0x1f');var _0x6d943=_0x5ee3d3[_0x50e5('0x21')];var _0x70fa75=_0x4a67e5?0x0:_0x4140dd[_0x50e5('0x1e')];var _0x4ca979=_0x4a67e5?_0x5ee3d3[_0x50e5('0x21')]:_0x4140dd[_0x50e5('0x1e')]+_0x4140dd[_0x50e5('0x20')];var _0x3b8102;if(_0x4ca979>=_0x6d943){_0x4ca979=_0x6d943;_0x3b8102=0xc8;}else{_0x3b8102=0xce;}_0x1d5799[_0x50e5('0x1c')](_0x3b8102);return _0x1d5799[_0x50e5('0x22')](_0x50e5('0x23'),_0x70fa75+'-'+_0x4ca979+'/'+_0x6d943)[_0x50e5('0x1d')](_0x5ee3d3);}return null;};}function patchUpdates(_0x3193d9){return function(_0x4257d9){try{jsonpatch['apply'](_0x4257d9,_0x3193d9,!![]);}catch(_0x54fd08){return BPromise[_0x50e5('0x24')](_0x54fd08);}return _0x4257d9['save']();};}function saveUpdates(_0x2987d1,_0x1e9b30){return function(_0x2f8386){if(_0x2f8386){return _0x2f8386[_0x50e5('0x25')](_0x2987d1)[_0x50e5('0x26')](function(_0x4f70fe){return _0x4f70fe;});}return null;};}function removeEntity(_0x9d0a02,_0x5adbbe){return function(_0x51d726){if(_0x51d726){return _0x51d726[_0x50e5('0x27')]()[_0x50e5('0x26')](function(){_0x9d0a02[_0x50e5('0x1c')](0xcc)[_0x50e5('0x1b')]();});}};}function handleEntityNotFound(_0x3d81d4,_0x46e3ed){return function(_0x549e80){if(!_0x549e80){_0x3d81d4[_0x50e5('0x1a')](0x194);}return _0x549e80;};}function handleError(_0x4f04a9,_0x3022a3){_0x3022a3=_0x3022a3||0x1f4;return function(_0x2d875f){logger[_0x50e5('0x28')](_0x2d875f[_0x50e5('0x29')]);if(_0x2d875f[_0x50e5('0x2a')]){delete _0x2d875f[_0x50e5('0x2a')];}_0x4f04a9[_0x50e5('0x1c')](_0x3022a3)['send'](_0x2d875f);};}exports['index']=function(_0x42c04d,_0x409419){var _0x94021={},_0x3fb39a={},_0x456f35={'count':0x0,'rows':[]};var _0x142c4d=_[_0x50e5('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x554a8f){return{'name':_0x554a8f[_0x50e5('0x2c')],'type':_0x554a8f[_0x50e5('0x2d')][_0x50e5('0x2e')]};});_0x3fb39a[_0x50e5('0x2f')]=_[_0x50e5('0x2b')](_0x142c4d,_0x50e5('0x2a'));_0x3fb39a[_0x50e5('0x30')]=_['keys'](_0x42c04d[_0x50e5('0x30')]);_0x3fb39a[_0x50e5('0x31')]=_[_0x50e5('0x32')](_0x3fb39a[_0x50e5('0x2f')],_0x3fb39a[_0x50e5('0x30')]);_0x94021['attributes']=_['intersection'](_0x3fb39a['model'],qs[_0x50e5('0x33')](_0x42c04d[_0x50e5('0x30')][_0x50e5('0x33')]));_0x94021[_0x50e5('0x34')]=_0x94021[_0x50e5('0x34')][_0x50e5('0x35')]?_0x94021[_0x50e5('0x34')]:_0x3fb39a['model'];if(!_0x42c04d[_0x50e5('0x30')][_0x50e5('0x36')](_0x50e5('0x37'))){_0x94021[_0x50e5('0x20')]=qs[_0x50e5('0x20')](_0x42c04d['query']['limit']);_0x94021[_0x50e5('0x1e')]=qs[_0x50e5('0x1e')](_0x42c04d['query']['offset']);}_0x94021[_0x50e5('0x38')]=qs[_0x50e5('0x39')](_0x42c04d['query'][_0x50e5('0x39')]);_0x94021[_0x50e5('0x3a')]=qs[_0x50e5('0x31')](_[_0x50e5('0x3b')](_0x42c04d[_0x50e5('0x30')],_0x3fb39a[_0x50e5('0x31')]),_0x142c4d);if(_0x42c04d[_0x50e5('0x30')][_0x50e5('0x3c')]){_0x94021[_0x50e5('0x3a')]=_['merge'](_0x94021[_0x50e5('0x3a')],{'$or':_['map'](_0x142c4d,function(_0x3a5751){if(_0x3a5751[_0x50e5('0x2d')]!==_0x50e5('0x3d')){var _0x5f4b08={};_0x5f4b08[_0x3a5751['name']]={'$like':'%'+_0x42c04d[_0x50e5('0x30')][_0x50e5('0x3c')]+'%'};return _0x5f4b08;}})});}_0x94021=_[_0x50e5('0x3e')]({},_0x94021,_0x42c04d[_0x50e5('0x3f')]);var _0x3f036d={'where':_0x94021['where']};return db[_0x50e5('0x40')][_0x50e5('0x21')](_0x3f036d)[_0x50e5('0x26')](function(_0x111b19){_0x456f35[_0x50e5('0x21')]=_0x111b19;if(_0x42c04d[_0x50e5('0x30')]['includeAll']){_0x94021['include']=[{'all':!![]}];}return db[_0x50e5('0x40')][_0x50e5('0x41')](_0x94021);})[_0x50e5('0x26')](function(_0x100541){_0x456f35[_0x50e5('0x42')]=_0x100541;return _0x456f35;})[_0x50e5('0x26')](respondWithFilteredResult(_0x409419,_0x94021))[_0x50e5('0x43')](handleError(_0x409419,null));};exports[_0x50e5('0x44')]=function(_0x98a631,_0xbd5056){var _0x1e080e={'raw':![],'where':{'id':_0x98a631[_0x50e5('0x45')]['id']}},_0x564dea={};_0x564dea[_0x50e5('0x2f')]=_[_0x50e5('0x46')](db[_0x50e5('0x40')][_0x50e5('0x47')]);_0x564dea[_0x50e5('0x30')]=_[_0x50e5('0x46')](_0x98a631['query']);_0x564dea[_0x50e5('0x31')]=_[_0x50e5('0x32')](_0x564dea[_0x50e5('0x2f')],_0x564dea[_0x50e5('0x30')]);_0x1e080e[_0x50e5('0x34')]=_[_0x50e5('0x32')](_0x564dea[_0x50e5('0x2f')],qs['fields'](_0x98a631['query']['fields']));_0x1e080e['attributes']=_0x1e080e['attributes']['length']?_0x1e080e[_0x50e5('0x34')]:_0x564dea['model'];if(_0x98a631['query'][_0x50e5('0x48')]){_0x1e080e[_0x50e5('0x49')]=[{'all':!![]}];}_0x1e080e=_[_0x50e5('0x3e')]({},_0x1e080e,_0x98a631['options']);return db[_0x50e5('0x40')]['find'](_0x1e080e)[_0x50e5('0x26')](handleEntityNotFound(_0xbd5056,null))['then'](respondWithResult(_0xbd5056,null))[_0x50e5('0x43')](handleError(_0xbd5056,null));};exports['create']=function(_0x2caa7e,_0x5e2d23){return db[_0x50e5('0x40')]['create'](_0x2caa7e['body'],{})['then'](respondWithResult(_0x5e2d23,0xc9))[_0x50e5('0x43')](handleError(_0x5e2d23,null));};exports[_0x50e5('0x25')]=function(_0x4fb072,_0x25f1a3){if(_0x4fb072[_0x50e5('0x4a')]['id']){delete _0x4fb072['body']['id'];}return db[_0x50e5('0x40')][_0x50e5('0x4b')]({'where':{'id':_0x4fb072[_0x50e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x25f1a3,null))[_0x50e5('0x26')](saveUpdates(_0x4fb072['body'],null))[_0x50e5('0x26')](respondWithResult(_0x25f1a3,null))[_0x50e5('0x43')](handleError(_0x25f1a3,null));};exports['destroy']=function(_0x2dc1e5,_0x3242ca){return db[_0x50e5('0x40')][_0x50e5('0x4b')]({'where':{'id':_0x2dc1e5['params']['id']}})[_0x50e5('0x26')](handleEntityNotFound(_0x3242ca,null))[_0x50e5('0x26')](removeEntity(_0x3242ca,null))[_0x50e5('0x43')](handleError(_0x3242ca,null));};exports[_0x50e5('0x4c')]=function(_0x3012c6,_0x169182,_0x3e969f){var _0x4f6ffb={};var _0x311b9a={};var _0x4a7688;var _0x45d5c7;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3012c6['params']['id']}})['then'](handleEntityNotFound(_0x169182,null))[_0x50e5('0x26')](function(_0x39564d){if(_0x39564d){_0x4a7688=_0x39564d;_0x311b9a[_0x50e5('0x2f')]=_[_0x50e5('0x46')](db[_0x50e5('0x4d')][_0x50e5('0x47')]);_0x311b9a[_0x50e5('0x30')]=_['keys'](_0x3012c6[_0x50e5('0x30')]);_0x311b9a[_0x50e5('0x31')]=_[_0x50e5('0x32')](_0x311b9a[_0x50e5('0x2f')],_0x311b9a['query']);_0x4f6ffb[_0x50e5('0x34')]=_['intersection'](_0x311b9a[_0x50e5('0x2f')],qs['fields'](_0x3012c6[_0x50e5('0x30')][_0x50e5('0x33')]));_0x4f6ffb[_0x50e5('0x34')]=_0x4f6ffb['attributes']['length']?_0x4f6ffb[_0x50e5('0x34')]:_0x311b9a[_0x50e5('0x2f')];_0x4f6ffb[_0x50e5('0x38')]=qs[_0x50e5('0x39')](_0x3012c6[_0x50e5('0x30')][_0x50e5('0x39')]);_0x4f6ffb[_0x50e5('0x3a')]=qs[_0x50e5('0x31')](_[_0x50e5('0x3b')](_0x3012c6[_0x50e5('0x30')],_0x311b9a['filters']));if(_0x3012c6[_0x50e5('0x30')][_0x50e5('0x3c')]){_0x4f6ffb[_0x50e5('0x3a')]=_[_0x50e5('0x3e')](_0x4f6ffb[_0x50e5('0x3a')],{'$or':_[_0x50e5('0x2b')](_0x4f6ffb[_0x50e5('0x34')],function(_0x4b8b18){var _0x38bd3c={};_0x38bd3c[_0x4b8b18]={'$like':'%'+_0x3012c6[_0x50e5('0x30')][_0x50e5('0x3c')]+'%'};return _0x38bd3c;})});}_0x4f6ffb=_[_0x50e5('0x3e')]({},_0x4f6ffb,_0x3012c6[_0x50e5('0x3f')]);return _0x4a7688[_0x50e5('0x4c')](_0x4f6ffb);}})[_0x50e5('0x26')](function(_0x17a6c9){if(_0x17a6c9){_0x45d5c7=_0x17a6c9[_0x50e5('0x35')];if(!_0x3012c6[_0x50e5('0x30')][_0x50e5('0x36')](_0x50e5('0x37'))){_0x4f6ffb[_0x50e5('0x20')]=qs[_0x50e5('0x20')](_0x3012c6[_0x50e5('0x30')]['limit']);_0x4f6ffb[_0x50e5('0x1e')]=qs[_0x50e5('0x1e')](_0x3012c6[_0x50e5('0x30')][_0x50e5('0x1e')]);}return _0x4a7688['getConfigurations'](_0x4f6ffb);}})[_0x50e5('0x26')](function(_0x2c6f7c){if(_0x2c6f7c){return _0x2c6f7c?{'count':_0x45d5c7,'rows':_0x2c6f7c}:null;}})['then'](respondWithResult(_0x169182,null))['catch'](handleError(_0x169182,null));};exports[_0x50e5('0x4e')]=function(_0x2fd777,_0x2cfd96,_0x3d60fa){if(_0x2fd777[_0x50e5('0x4a')]['id']){delete _0x2fd777[_0x50e5('0x4a')]['id'];}return db[_0x50e5('0x40')][_0x50e5('0x4f')]({'where':{'id':_0x2fd777[_0x50e5('0x45')]['id']}})[_0x50e5('0x26')](handleEntityNotFound(_0x2cfd96,null))[_0x50e5('0x26')](function(_0x27649f){if(_0x27649f){_0x2fd777[_0x50e5('0x4a')]['AccountId']=_0x27649f['id'];_0x2fd777['body'][_0x50e5('0x50')]=integrations[_0x50e5('0x51')](_0x2fd777[_0x50e5('0x4a')][_0x50e5('0x52')],_0x2fd777['body']['type']);_0x2fd777[_0x50e5('0x4a')]['Descriptions']=integrations[_0x50e5('0x53')](_0x2fd777['body']['channel'],_0x2fd777[_0x50e5('0x4a')][_0x50e5('0x2d')]);return db[_0x50e5('0x4d')]['create'](_0x2fd777['body'],{'include':[{'model':db[_0x50e5('0x54')],'as':'Subjects'},{'model':db[_0x50e5('0x54')],'as':_0x50e5('0x55')}]});}return null;})[_0x50e5('0x26')](respondWithResult(_0x2cfd96,null))[_0x50e5('0x43')](handleError(_0x2cfd96,null));};exports[_0x50e5('0x56')]=function(_0x22eaec,_0x21751a,_0x32a1aa){var _0x29678e='';var _0x10fe0b='';return db[_0x50e5('0x40')][_0x50e5('0x4f')]({'where':{'id':_0x22eaec[_0x50e5('0x45')]['id']},'attributes':['id',_0x50e5('0x57'),_0x50e5('0x58'),_0x50e5('0x59')]})[_0x50e5('0x26')](handleEntityNotFound(_0x21751a,null))[_0x50e5('0x26')](function(_0x2f9a6c){if(_0x2f9a6c){_0x10fe0b=_0x2f9a6c[_0x50e5('0x57')];_0x29678e=_0x2f9a6c[_0x50e5('0x58')];var _0x4eec9d=_0x2f9a6c[_0x50e5('0x58')][_0x50e5('0x5a')](-0x1);if(_0x4eec9d==='/'){_0x29678e=_0x29678e['substring'](0x0,_0x29678e[_0x50e5('0x5b')](_0x4eec9d));}return rp({'method':_0x50e5('0x5c'),'uri':util[_0x50e5('0x5d')](_0x50e5('0x5e'),_0x29678e,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x2f9a6c['apiKey']},'json':!![]});}})[_0x50e5('0x26')](function(_0x283c23){if(_0x283c23){var _0x4a2fd9=_0x283c23[_0x50e5('0x5f')];var _0x2b0976=![];var _0x25307e=null;for(_0x25307e=0x0;_0x25307e<_0x4a2fd9[_0x50e5('0x35')];_0x25307e++){if(_0x4a2fd9[_0x25307e][_0x50e5('0x60')]===_0x10fe0b){_0x2b0976=!![];}}if(_0x2b0976){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x50e5('0x26')](respondWithResult(_0x21751a,null))[_0x50e5('0x43')](function(_0x5b6548){var _0x5c1195=_0x22eaec[_0x50e5('0x30')][_0x50e5('0x61')]?0x1f4:_0x5b6548['statusCode']||0x1f4;logger[_0x50e5('0x28')](_0x50e5('0x62'),'getFields',_0x5c1195,JSON[_0x50e5('0x63')](_0x5b6548));delete _0x5b6548[_0x50e5('0x2a')];if(_0x5c1195===0x191){_0x5c1195=0x190;}_0x21751a['status'](_0x5c1195)[_0x50e5('0x64')](_0x22eaec['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x5b6548[_0x50e5('0x65')]}:_0x5b6548);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4ea091c..cfaa21b 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 _0xe2fe=['define','int_freshsales_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x410e57,_0x43979c){var _0x10f69e=function(_0x4c57d1){while(--_0x4c57d1){_0x410e57['push'](_0x410e57['shift']());}};_0x10f69e(++_0x43979c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('FreshsalesAccount',attributes,{'tableName':_0xee2f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbff5=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x3723e1,_0x1bf81d){var _0x465a3f=function(_0x553576){while(--_0x553576){_0x3723e1['push'](_0x3723e1['shift']());}};_0x465a3f(++_0x1bf81d);}(_0xbff5,0x1bc));var _0x5bff=function(_0x1d34fd,_0x4f8ba8){_0x1d34fd=_0x1d34fd-0x0;var _0x14ab3f=_0xbff5[_0x1d34fd];return _0x14ab3f;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5bff('0x8'));module[_0x5bff('0x9')]=function(_0x151add,_0xa54c57){return _0x151add[_0x5bff('0xa')](_0x5bff('0xb'),attributes,{'tableName':_0x5bff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index c7da7f4..82595d1 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 _0xf61e=['include','map','then','ShowFreshsalesAccount','FreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','model'];(function(_0x2f78e6,_0x972393){var _0x2bbb30=function(_0x9ba7b3){while(--_0x9ba7b3){_0x2f78e6['push'](_0x2f78e6['shift']());}};_0x2bbb30(++_0x972393);}(_0xf61e,0x191));var _0xef61=function(_0x3288c7,_0x4a3706){_0x3288c7=_0x3288c7-0x0;var _0x48b175=_0xf61e[_0x3288c7];return _0x48b175;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var moment=require(_0xef61('0x2'));var BPromise=require(_0xef61('0x3'));var rs=require(_0xef61('0x4'));var fs=require('fs');var Redis=require(_0xef61('0x5'));var db=require(_0xef61('0x6'))['db'];var utils=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var config=require(_0xef61('0xa'));var jayson=require(_0xef61('0xb'));var client=jayson['client'][_0xef61('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3e2f79,_0x4f0cc5,_0x2242a7){return new BPromise(function(_0x277fa1,_0x106e7f){return client['request'](_0x3e2f79,_0x2242a7)['then'](function(_0x188894){logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));logger[_0xef61('0x10')](_0xef61('0x11'),_0x4f0cc5,_0xef61('0xf'),JSON[_0xef61('0x12')](_0x188894));if(_0x188894[_0xef61('0x13')]){if(_0x188894[_0xef61('0x13')][_0xef61('0x14')]===0x1f4){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')]['message']);return _0x106e7f(_0x188894[_0xef61('0x13')]['message']);}logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x188894[_0xef61('0x13')][_0xef61('0x15')]);return _0x277fa1(_0x188894['error'][_0xef61('0x15')]);}else{logger[_0xef61('0xd')](_0xef61('0xe'),_0x4f0cc5,_0xef61('0xf'));_0x277fa1(_0x188894['result'][_0xef61('0x15')]);}})[_0xef61('0x16')](function(_0x4f7a62){logger[_0xef61('0x13')](_0xef61('0xe'),_0x4f0cc5,_0x4f7a62);_0x106e7f(_0x4f7a62);});});}exports[_0xef61('0x17')]=function(_0x22dc1b){var _0xfc36d6=this;return new Promise(function(_0x28315a,_0xdd5e38){return db['FreshsalesAccount'][_0xef61('0x18')]({'raw':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b['options'][_0xef61('0x1a')]===undefined?!![]:![]:!![],'where':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1b')]||null:null,'attributes':_0x22dc1b[_0xef61('0x19')]?_0x22dc1b[_0xef61('0x19')][_0xef61('0x1c')]||null:null,'limit':_0x22dc1b['options']?_0x22dc1b['options'][_0xef61('0x1d')]||null:null,'include':_0x22dc1b['options']?_0x22dc1b[_0xef61('0x19')]['include']?_['map'](_0x22dc1b[_0xef61('0x19')]['include'],function(_0x53181b){return{'model':db[_0x53181b[_0xef61('0x1e')]],'as':_0x53181b['as'],'attributes':_0x53181b[_0xef61('0x1c')],'include':_0x53181b[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x53181b['include'],function(_0x16b144){return{'model':db[_0x16b144['model']],'as':_0x16b144['as'],'attributes':_0x16b144[_0xef61('0x1c')],'include':_0x16b144[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x16b144[_0xef61('0x1f')],function(_0x2155f1){return{'model':db[_0x2155f1[_0xef61('0x1e')]],'as':_0x2155f1['as'],'attributes':_0x2155f1[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xef61('0x21')](function(_0x297df7){logger[_0xef61('0xd')](_0xef61('0x17'),_0x22dc1b);logger[_0xef61('0x10')](_0xef61('0x17'),_0x22dc1b,JSON[_0xef61('0x12')](_0x297df7));_0x28315a(_0x297df7);})[_0xef61('0x16')](function(_0x85978){logger[_0xef61('0x13')](_0xef61('0x17'),_0x85978[_0xef61('0x15')],_0x22dc1b);_0xdd5e38(_0xfc36d6[_0xef61('0x13')](0x1f4,_0x85978[_0xef61('0x15')]));});});};exports[_0xef61('0x22')]=function(_0x4f35ad){var _0x51d5d1=this;return new Promise(function(_0x38b522,_0x36713e){return db[_0xef61('0x23')]['find']({'raw':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad[_0xef61('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options']['where']||null:null,'attributes':_0x4f35ad[_0xef61('0x19')]?_0x4f35ad['options'][_0xef61('0x1c')]||null:null,'include':_0x4f35ad['options']?_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')]?_[_0xef61('0x20')](_0x4f35ad[_0xef61('0x19')][_0xef61('0x1f')],function(_0x1bdcb9){return{'model':db[_0x1bdcb9[_0xef61('0x1e')]],'as':_0x1bdcb9['as'],'attributes':_0x1bdcb9[_0xef61('0x1c')],'include':_0x1bdcb9[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x1bdcb9['include'],function(_0x569db6){return{'model':db[_0x569db6[_0xef61('0x1e')]],'as':_0x569db6['as'],'attributes':_0x569db6[_0xef61('0x1c')],'include':_0x569db6[_0xef61('0x1f')]?_[_0xef61('0x20')](_0x569db6['include'],function(_0x1c38dc){return{'model':db[_0x1c38dc[_0xef61('0x1e')]],'as':_0x1c38dc['as'],'attributes':_0x1c38dc[_0xef61('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59b97b){logger['info'](_0xef61('0x22'),_0x4f35ad);logger['debug']('ShowFreshsalesAccount',_0x4f35ad,JSON['stringify'](_0x59b97b));_0x38b522(_0x59b97b);})[_0xef61('0x16')](function(_0x294063){logger[_0xef61('0x13')]('ShowFreshsalesAccount',_0x294063['message'],_0x4f35ad);_0x36713e(_0x51d5d1['error'](0x1f4,_0x294063[_0xef61('0x15')]));});});}; \ No newline at end of file +var _0x0295=['find','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','where','include','map','model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount'];(function(_0xf82a8d,_0x3fec8d){var _0x39a911=function(_0x4c3bd4){while(--_0x4c3bd4){_0xf82a8d['push'](_0xf82a8d['shift']());}};_0x39a911(++_0x3fec8d);}(_0x0295,0x1f0));var _0x5029=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x0295[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});}exports['GetFreshsalesAccount']=function(_0x1ed567){var _0x31a155=this;return new Promise(function(_0x35de81,_0x4902f3){return db[_0x5029('0x15')][_0x5029('0x16')]({'raw':_0x1ed567[_0x5029('0x17')]?_0x1ed567['options'][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')][_0x5029('0x19')]||null:null,'attributes':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')]['attributes']||null:null,'limit':_0x1ed567['options']?_0x1ed567[_0x5029('0x17')]['limit']||null:null,'include':_0x1ed567[_0x5029('0x17')]?_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x1ed567[_0x5029('0x17')][_0x5029('0x1a')],function(_0x125c26){return{'model':db[_0x125c26[_0x5029('0x1c')]],'as':_0x125c26['as'],'attributes':_0x125c26[_0x5029('0x1d')],'include':_0x125c26['include']?_['map'](_0x125c26['include'],function(_0x588d90){return{'model':db[_0x588d90[_0x5029('0x1c')]],'as':_0x588d90['as'],'attributes':_0x588d90['attributes'],'include':_0x588d90['include']?_[_0x5029('0x1b')](_0x588d90[_0x5029('0x1a')],function(_0x36d810){return{'model':db[_0x36d810['model']],'as':_0x36d810['as'],'attributes':_0x36d810[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x5e45c4){logger[_0x5029('0xb')](_0x5029('0x1e'),_0x1ed567);logger[_0x5029('0xd')]('GetFreshsalesAccount',_0x1ed567,JSON[_0x5029('0xf')](_0x5e45c4));_0x35de81(_0x5e45c4);})[_0x5029('0x14')](function(_0xe5313e){logger['error'](_0x5029('0x1e'),_0xe5313e[_0x5029('0x12')],_0x1ed567);_0x4902f3(_0x31a155['error'](0x1f4,_0xe5313e[_0x5029('0x12')]));});});};exports[_0x5029('0x1f')]=function(_0x4434ff){var _0x1c3dd9=this;return new Promise(function(_0x196830,_0x2a1ed6){return db[_0x5029('0x15')][_0x5029('0x20')]({'raw':_0x4434ff[_0x5029('0x17')]?_0x4434ff[_0x5029('0x17')][_0x5029('0x18')]===undefined?!![]:![]:!![],'where':_0x4434ff[_0x5029('0x17')]?_0x4434ff['options'][_0x5029('0x19')]||null:null,'attributes':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')]['attributes']||null:null,'include':_0x4434ff['options']?_0x4434ff[_0x5029('0x17')][_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x4434ff['options'][_0x5029('0x1a')],function(_0x15d882){return{'model':db[_0x15d882[_0x5029('0x1c')]],'as':_0x15d882['as'],'attributes':_0x15d882[_0x5029('0x1d')],'include':_0x15d882[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x15d882[_0x5029('0x1a')],function(_0x22205e){return{'model':db[_0x22205e[_0x5029('0x1c')]],'as':_0x22205e['as'],'attributes':_0x22205e['attributes'],'include':_0x22205e[_0x5029('0x1a')]?_[_0x5029('0x1b')](_0x22205e[_0x5029('0x1a')],function(_0x1b3817){return{'model':db[_0x1b3817['model']],'as':_0x1b3817['as'],'attributes':_0x1b3817[_0x5029('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5029('0xa')](function(_0x3e2d88){logger['info']('ShowFreshsalesAccount',_0x4434ff);logger[_0x5029('0xd')](_0x5029('0x1f'),_0x4434ff,JSON['stringify'](_0x3e2d88));_0x196830(_0x3e2d88);})['catch'](function(_0x9656f2){logger[_0x5029('0x10')](_0x5029('0x1f'),_0x9656f2[_0x5029('0x12')],_0x4434ff);_0x2a1ed6(_0x1c3dd9[_0x5029('0x10')](0x1f4,_0x9656f2[_0x5029('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 85e2e47..8ed474c 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 _0xf3f8=['post','isAuthenticated','create','put','update','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf3f8,0x89));var _0x8f3f=function(_0x2945c4,_0x58577b){_0x2945c4=_0x2945c4-0x0;var _0x8ca289=_0xf3f8[_0x2945c4];return _0x8ca289;};'use strict';var multer=require('multer');var util=require(_0x8f3f('0x0'));var path=require(_0x8f3f('0x1'));var timeout=require(_0x8f3f('0x2'));var express=require(_0x8f3f('0x3'));var router=express[_0x8f3f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8f3f('0x5'));var interaction=require(_0x8f3f('0x6'));var config=require('../../config/environment');var controller=require(_0x8f3f('0x7'));router[_0x8f3f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8f3f('0x8')](_0x8f3f('0x9'),auth['isAuthenticated'](),controller[_0x8f3f('0xa')]);router['get'](_0x8f3f('0xb'),auth['isAuthenticated'](),controller[_0x8f3f('0xc')]);router[_0x8f3f('0x8')](_0x8f3f('0xd'),auth['isAuthenticated'](),controller[_0x8f3f('0xe')]);router[_0x8f3f('0x8')](_0x8f3f('0xf'),auth['isAuthenticated'](),controller[_0x8f3f('0x10')]);router[_0x8f3f('0x11')]('/',auth[_0x8f3f('0x12')](),controller[_0x8f3f('0x13')]);router[_0x8f3f('0x14')](_0x8f3f('0x9'),auth[_0x8f3f('0x12')](),controller[_0x8f3f('0x15')]);router['delete']('/:id',auth[_0x8f3f('0x12')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x888f=['index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated'];(function(_0x858e7b,_0x274ae4){var _0x417c65=function(_0x4e1519){while(--_0x4e1519){_0x858e7b['push'](_0x858e7b['shift']());}};_0x417c65(++_0x274ae4);}(_0x888f,0x1e3));var _0xf888=function(_0x4c0028,_0x129f6d){_0x4c0028=_0x4c0028-0x0;var _0x221bc2=_0x888f[_0x4c0028];return _0x221bc2;};'use strict';var multer=require(_0xf888('0x0'));var util=require(_0xf888('0x1'));var path=require('path');var timeout=require(_0xf888('0x2'));var express=require(_0xf888('0x3'));var router=express[_0xf888('0x4')]();var fs_extra=require(_0xf888('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf888('0x6'));var config=require(_0xf888('0x7'));var controller=require(_0xf888('0x8'));router[_0xf888('0x9')]('/',auth[_0xf888('0xa')](),controller[_0xf888('0xb')]);router[_0xf888('0x9')](_0xf888('0xc'),auth[_0xf888('0xa')](),controller[_0xf888('0xd')]);router[_0xf888('0x9')](_0xf888('0xe'),auth[_0xf888('0xa')](),controller[_0xf888('0xf')]);router[_0xf888('0x9')](_0xf888('0x10'),auth['isAuthenticated'](),controller[_0xf888('0x11')]);router[_0xf888('0x9')](_0xf888('0x12'),auth[_0xf888('0xa')](),controller[_0xf888('0x13')]);router['post']('/',auth[_0xf888('0xa')](),controller[_0xf888('0x14')]);router[_0xf888('0x15')]('/:id',auth[_0xf888('0xa')](),controller[_0xf888('0x16')]);router[_0xf888('0x17')](_0xf888('0xc'),auth[_0xf888('0xa')](),controller[_0xf888('0x18')]);module[_0xf888('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b52af03..4c22a5a 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 _0x5686=['STRING','sequelize'];(function(_0x5e3bb2,_0x51dcef){var _0x2f73c8=function(_0x12ce37){while(--_0x12ce37){_0x5e3bb2['push'](_0x5e3bb2['shift']());}};_0x2f73c8(++_0x51dcef);}(_0x5686,0x115));var _0x6568=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x5686[_0x1ccbcc];return _0x1e873f;};'use strict';var Sequelize=require(_0x6568('0x0'));module['exports']={'name':{'type':Sequelize[_0x6568('0x1')]},'description':{'type':Sequelize[_0x6568('0x1')]}}; \ No newline at end of file +var _0xfc26=['exports','STRING','sequelize'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0xfc26,0x1d3));var _0x6fc2=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xfc26[_0x367e5b];return _0x4b909e;};'use strict';var Sequelize=require(_0x6fc2('0x0'));module[_0x6fc2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6fc2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 79c7f43..d3b16e0 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 _0x2998=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','FreshsalesConfiguration','includeAll','rows','catch','show','params','intersection','merge','find','create','body','getSubjects','findOne','FreshsalesField','options','getDescriptions','getFields','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','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'];(function(_0x121085,_0x2989b0){var _0x3272d7=function(_0x2d520f){while(--_0x2d520f){_0x121085['push'](_0x121085['shift']());}};_0x3272d7(++_0x2989b0);}(_0x2998,0xd4));var _0x8299=function(_0x491c43,_0x718ade){_0x491c43=_0x491c43-0x0;var _0x1d22a0=_0x2998[_0x491c43];return _0x1d22a0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8299('0x0'));var jsonpatch=require(_0x8299('0x1'));var rp=require(_0x8299('0x2'));var moment=require(_0x8299('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8299('0x4'));var util=require(_0x8299('0x5'));var path=require(_0x8299('0x6'));var sox=require('sox');var csv=require(_0x8299('0x7'));var ejs=require(_0x8299('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8299('0x9'));var crypto=require(_0x8299('0xa'));var jsforce=require(_0x8299('0xb'));var deskjs=require(_0x8299('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8299('0xd'));var Papa=require(_0x8299('0xe'));var Redis=require(_0x8299('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8299('0x10'));var as=require(_0x8299('0x11'));var hardwareService=require(_0x8299('0x12'));var logger=require(_0x8299('0x13'))(_0x8299('0x14'));var utils=require('../../config/utils');var config=require(_0x8299('0x15'));var licenseUtil=require(_0x8299('0x16'));var db=require(_0x8299('0x17'))['db'];function respondWithStatusCode(_0x4c7662,_0xf7e9d8){_0xf7e9d8=_0xf7e9d8||0xcc;return function(_0x3bb591){if(_0x3bb591){return _0x4c7662[_0x8299('0x18')](_0xf7e9d8);}return _0x4c7662[_0x8299('0x19')](_0xf7e9d8)[_0x8299('0x1a')]();};}function respondWithResult(_0x52f3f9,_0x2ff97c){_0x2ff97c=_0x2ff97c||0xc8;return function(_0x24818c){if(_0x24818c){return _0x52f3f9[_0x8299('0x19')](_0x2ff97c)[_0x8299('0x1b')](_0x24818c);}};}function respondWithFilteredResult(_0xba4ca7,_0x3d72b4){return function(_0x59c57f){if(_0x59c57f){var _0x3ddf78=typeof _0x3d72b4[_0x8299('0x1c')]===_0x8299('0x1d')&&typeof _0x3d72b4[_0x8299('0x1e')]==='undefined';var _0x4717b5=_0x59c57f[_0x8299('0x1f')];var _0x2f0232=_0x3ddf78?0x0:_0x3d72b4[_0x8299('0x1c')];var _0x2b24bb=_0x3ddf78?_0x59c57f[_0x8299('0x1f')]:_0x3d72b4[_0x8299('0x1c')]+_0x3d72b4[_0x8299('0x1e')];var _0x16fca8;if(_0x2b24bb>=_0x4717b5){_0x2b24bb=_0x4717b5;_0x16fca8=0xc8;}else{_0x16fca8=0xce;}_0xba4ca7[_0x8299('0x19')](_0x16fca8);return _0xba4ca7[_0x8299('0x20')](_0x8299('0x21'),_0x2f0232+'-'+_0x2b24bb+'/'+_0x4717b5)['json'](_0x59c57f);}return null;};}function patchUpdates(_0x35f541){return function(_0x7d1759){try{jsonpatch[_0x8299('0x22')](_0x7d1759,_0x35f541,!![]);}catch(_0x3436e2){return BPromise['reject'](_0x3436e2);}return _0x7d1759['save']();};}function saveUpdates(_0x5672b3,_0x29f909){return function(_0x56e5ad){if(_0x56e5ad){return _0x56e5ad[_0x8299('0x23')](_0x5672b3)['then'](function(_0x186083){return _0x186083;});}return null;};}function removeEntity(_0x47310f,_0x516e8f){return function(_0xe85e94){if(_0xe85e94){return _0xe85e94[_0x8299('0x24')]()[_0x8299('0x25')](function(){_0x47310f[_0x8299('0x19')](0xcc)[_0x8299('0x1a')]();});}};}function handleEntityNotFound(_0x211606,_0x2438a9){return function(_0x4de85a){if(!_0x4de85a){_0x211606[_0x8299('0x18')](0x194);}return _0x4de85a;};}function handleError(_0xeec197,_0x34bd71){_0x34bd71=_0x34bd71||0x1f4;return function(_0x4bdafe){logger[_0x8299('0x26')](_0x4bdafe[_0x8299('0x27')]);if(_0x4bdafe[_0x8299('0x28')]){delete _0x4bdafe[_0x8299('0x28')];}_0xeec197[_0x8299('0x19')](_0x34bd71)[_0x8299('0x29')](_0x4bdafe);};}exports[_0x8299('0x2a')]=function(_0x3da92e,_0x43397a){var _0x1747cb={},_0x110419={},_0x2f06b0={'count':0x0,'rows':[]};var _0x20de3a=_[_0x8299('0x2b')](db['FreshsalesConfiguration'][_0x8299('0x2c')],function(_0x79cf8){return{'name':_0x79cf8['fieldName'],'type':_0x79cf8[_0x8299('0x2d')][_0x8299('0x2e')]};});_0x110419['model']=_[_0x8299('0x2b')](_0x20de3a,_0x8299('0x28'));_0x110419[_0x8299('0x2f')]=_[_0x8299('0x30')](_0x3da92e[_0x8299('0x2f')]);_0x110419['filters']=_['intersection'](_0x110419['model'],_0x110419[_0x8299('0x2f')]);_0x1747cb[_0x8299('0x31')]=_['intersection'](_0x110419[_0x8299('0x32')],qs['fields'](_0x3da92e['query'][_0x8299('0x33')]));_0x1747cb[_0x8299('0x31')]=_0x1747cb[_0x8299('0x31')][_0x8299('0x34')]?_0x1747cb[_0x8299('0x31')]:_0x110419[_0x8299('0x32')];if(!_0x3da92e[_0x8299('0x2f')][_0x8299('0x35')](_0x8299('0x36'))){_0x1747cb[_0x8299('0x1e')]=qs[_0x8299('0x1e')](_0x3da92e[_0x8299('0x2f')]['limit']);_0x1747cb[_0x8299('0x1c')]=qs['offset'](_0x3da92e[_0x8299('0x2f')][_0x8299('0x1c')]);}_0x1747cb[_0x8299('0x37')]=qs[_0x8299('0x38')](_0x3da92e[_0x8299('0x2f')]['sort']);_0x1747cb[_0x8299('0x39')]=qs['filters'](_[_0x8299('0x3a')](_0x3da92e[_0x8299('0x2f')],_0x110419[_0x8299('0x3b')]),_0x20de3a);if(_0x3da92e[_0x8299('0x2f')][_0x8299('0x3c')]){_0x1747cb[_0x8299('0x39')]=_['merge'](_0x1747cb['where'],{'$or':_[_0x8299('0x2b')](_0x20de3a,function(_0x4d431f){if(_0x4d431f[_0x8299('0x2d')]!==_0x8299('0x3d')){var _0x3505c3={};_0x3505c3[_0x4d431f[_0x8299('0x28')]]={'$like':'%'+_0x3da92e[_0x8299('0x2f')]['filter']+'%'};return _0x3505c3;}})});}_0x1747cb=_['merge']({},_0x1747cb,_0x3da92e['options']);var _0x222e2f={'where':_0x1747cb[_0x8299('0x39')]};return db[_0x8299('0x3e')]['count'](_0x222e2f)['then'](function(_0x39014b){_0x2f06b0[_0x8299('0x1f')]=_0x39014b;if(_0x3da92e['query'][_0x8299('0x3f')]){_0x1747cb['include']=[{'all':!![]}];}return db[_0x8299('0x3e')]['findAll'](_0x1747cb);})['then'](function(_0x17bfa2){_0x2f06b0[_0x8299('0x40')]=_0x17bfa2;return _0x2f06b0;})[_0x8299('0x25')](respondWithFilteredResult(_0x43397a,_0x1747cb))[_0x8299('0x41')](handleError(_0x43397a,null));};exports[_0x8299('0x42')]=function(_0x4135db,_0x21e3c8){var _0x4dfa48={'raw':![],'where':{'id':_0x4135db[_0x8299('0x43')]['id']}},_0x407c34={};_0x407c34[_0x8299('0x32')]=_[_0x8299('0x30')](db[_0x8299('0x3e')][_0x8299('0x2c')]);_0x407c34[_0x8299('0x2f')]=_[_0x8299('0x30')](_0x4135db['query']);_0x407c34['filters']=_['intersection'](_0x407c34['model'],_0x407c34['query']);_0x4dfa48['attributes']=_[_0x8299('0x44')](_0x407c34['model'],qs['fields'](_0x4135db[_0x8299('0x2f')]['fields']));_0x4dfa48[_0x8299('0x31')]=_0x4dfa48[_0x8299('0x31')][_0x8299('0x34')]?_0x4dfa48[_0x8299('0x31')]:_0x407c34[_0x8299('0x32')];if(_0x4135db['query']['includeAll']){_0x4dfa48['include']=[{'all':!![]}];}_0x4dfa48=_[_0x8299('0x45')]({},_0x4dfa48,_0x4135db['options']);return db[_0x8299('0x3e')][_0x8299('0x46')](_0x4dfa48)[_0x8299('0x25')](handleEntityNotFound(_0x21e3c8,null))[_0x8299('0x25')](respondWithResult(_0x21e3c8,null))[_0x8299('0x41')](handleError(_0x21e3c8,null));};exports['create']=function(_0x27edf4,_0x41a9ae){return db[_0x8299('0x3e')][_0x8299('0x47')](_0x27edf4[_0x8299('0x48')],{})[_0x8299('0x25')](respondWithResult(_0x41a9ae,0xc9))[_0x8299('0x41')](handleError(_0x41a9ae,null));};exports[_0x8299('0x23')]=function(_0x1be749,_0x4a334c){if(_0x1be749['body']['id']){delete _0x1be749[_0x8299('0x48')]['id'];}return db[_0x8299('0x3e')]['find']({'where':{'id':_0x1be749[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x4a334c,null))['then'](saveUpdates(_0x1be749[_0x8299('0x48')],null))[_0x8299('0x25')](respondWithResult(_0x4a334c,null))['catch'](handleError(_0x4a334c,null));};exports['destroy']=function(_0xf649e2,_0x1d4d9b){return db[_0x8299('0x3e')][_0x8299('0x46')]({'where':{'id':_0xf649e2[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x1d4d9b,null))[_0x8299('0x25')](removeEntity(_0x1d4d9b,null))[_0x8299('0x41')](handleError(_0x1d4d9b,null));};exports[_0x8299('0x49')]=function(_0x3f9256,_0x466029,_0x4da705){var _0x37dc7a={};var _0x38f62f={};var _0x2c5274;var _0x133024;return db[_0x8299('0x3e')][_0x8299('0x4a')]({'where':{'id':_0x3f9256[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x466029,null))[_0x8299('0x25')](function(_0x1ef80e){if(_0x1ef80e){_0x2c5274=_0x1ef80e;_0x38f62f[_0x8299('0x32')]=_[_0x8299('0x30')](db[_0x8299('0x4b')]['rawAttributes']);_0x38f62f['query']=_[_0x8299('0x30')](_0x3f9256['query']);_0x38f62f[_0x8299('0x3b')]=_[_0x8299('0x44')](_0x38f62f[_0x8299('0x32')],_0x38f62f[_0x8299('0x2f')]);_0x37dc7a['attributes']=_[_0x8299('0x44')](_0x38f62f[_0x8299('0x32')],qs[_0x8299('0x33')](_0x3f9256[_0x8299('0x2f')][_0x8299('0x33')]));_0x37dc7a[_0x8299('0x31')]=_0x37dc7a[_0x8299('0x31')]['length']?_0x37dc7a[_0x8299('0x31')]:_0x38f62f[_0x8299('0x32')];_0x37dc7a[_0x8299('0x37')]=qs[_0x8299('0x38')](_0x3f9256[_0x8299('0x2f')][_0x8299('0x38')]);_0x37dc7a[_0x8299('0x39')]=qs[_0x8299('0x3b')](_[_0x8299('0x3a')](_0x3f9256['query'],_0x38f62f['filters']));if(_0x3f9256[_0x8299('0x2f')][_0x8299('0x3c')]){_0x37dc7a[_0x8299('0x39')]=_[_0x8299('0x45')](_0x37dc7a[_0x8299('0x39')],{'$or':_[_0x8299('0x2b')](_0x37dc7a[_0x8299('0x31')],function(_0x20e94d){var _0x3aa1d8={};_0x3aa1d8[_0x20e94d]={'$like':'%'+_0x3f9256[_0x8299('0x2f')][_0x8299('0x3c')]+'%'};return _0x3aa1d8;})});}_0x37dc7a=_[_0x8299('0x45')]({},_0x37dc7a,_0x3f9256[_0x8299('0x4c')]);return _0x2c5274[_0x8299('0x49')](_0x37dc7a);}})[_0x8299('0x25')](function(_0x3abe93){if(_0x3abe93){_0x133024=_0x3abe93[_0x8299('0x34')];if(!_0x3f9256[_0x8299('0x2f')]['hasOwnProperty'](_0x8299('0x36'))){_0x37dc7a[_0x8299('0x1e')]=qs[_0x8299('0x1e')](_0x3f9256[_0x8299('0x2f')][_0x8299('0x1e')]);_0x37dc7a[_0x8299('0x1c')]=qs[_0x8299('0x1c')](_0x3f9256['query'][_0x8299('0x1c')]);}return _0x2c5274[_0x8299('0x49')](_0x37dc7a);}})[_0x8299('0x25')](function(_0x53133b){if(_0x53133b){return _0x53133b?{'count':_0x133024,'rows':_0x53133b}:null;}})['then'](respondWithResult(_0x466029,null))[_0x8299('0x41')](handleError(_0x466029,null));};exports[_0x8299('0x4d')]=function(_0x5db7e8,_0x520945,_0x2768c5){var _0x9ae41a={};var _0x2a6232={};var _0xbcb7ca;var _0x2c58b5;return db[_0x8299('0x3e')][_0x8299('0x4a')]({'where':{'id':_0x5db7e8[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x520945,null))['then'](function(_0x2b4040){if(_0x2b4040){_0xbcb7ca=_0x2b4040;_0x2a6232[_0x8299('0x32')]=_[_0x8299('0x30')](db[_0x8299('0x4b')][_0x8299('0x2c')]);_0x2a6232[_0x8299('0x2f')]=_['keys'](_0x5db7e8['query']);_0x2a6232[_0x8299('0x3b')]=_[_0x8299('0x44')](_0x2a6232[_0x8299('0x32')],_0x2a6232[_0x8299('0x2f')]);_0x9ae41a['attributes']=_[_0x8299('0x44')](_0x2a6232[_0x8299('0x32')],qs['fields'](_0x5db7e8[_0x8299('0x2f')][_0x8299('0x33')]));_0x9ae41a[_0x8299('0x31')]=_0x9ae41a[_0x8299('0x31')][_0x8299('0x34')]?_0x9ae41a[_0x8299('0x31')]:_0x2a6232[_0x8299('0x32')];_0x9ae41a[_0x8299('0x37')]=qs['sort'](_0x5db7e8['query']['sort']);_0x9ae41a['where']=qs['filters'](_[_0x8299('0x3a')](_0x5db7e8[_0x8299('0x2f')],_0x2a6232[_0x8299('0x3b')]));if(_0x5db7e8[_0x8299('0x2f')][_0x8299('0x3c')]){_0x9ae41a[_0x8299('0x39')]=_[_0x8299('0x45')](_0x9ae41a[_0x8299('0x39')],{'$or':_[_0x8299('0x2b')](_0x9ae41a[_0x8299('0x31')],function(_0x5c6fae){var _0x35403c={};_0x35403c[_0x5c6fae]={'$like':'%'+_0x5db7e8['query'][_0x8299('0x3c')]+'%'};return _0x35403c;})});}_0x9ae41a=_[_0x8299('0x45')]({},_0x9ae41a,_0x5db7e8[_0x8299('0x4c')]);return _0xbcb7ca[_0x8299('0x4d')](_0x9ae41a);}})[_0x8299('0x25')](function(_0xc8ac4){if(_0xc8ac4){_0x2c58b5=_0xc8ac4['length'];if(!_0x5db7e8['query'][_0x8299('0x35')](_0x8299('0x36'))){_0x9ae41a[_0x8299('0x1e')]=qs[_0x8299('0x1e')](_0x5db7e8[_0x8299('0x2f')][_0x8299('0x1e')]);_0x9ae41a['offset']=qs[_0x8299('0x1c')](_0x5db7e8[_0x8299('0x2f')][_0x8299('0x1c')]);}return _0xbcb7ca['getDescriptions'](_0x9ae41a);}})['then'](function(_0xa6b79d){if(_0xa6b79d){return _0xa6b79d?{'count':_0x2c58b5,'rows':_0xa6b79d}:null;}})[_0x8299('0x25')](respondWithResult(_0x520945,null))[_0x8299('0x41')](handleError(_0x520945,null));};exports['getFields']=function(_0x8199b7,_0x583201,_0x5a9183){var _0x5136e9={};var _0x55f79b={};var _0x21bb7e;var _0x3b1477;return db[_0x8299('0x3e')][_0x8299('0x4a')]({'where':{'id':_0x8199b7[_0x8299('0x43')]['id']}})[_0x8299('0x25')](handleEntityNotFound(_0x583201,null))['then'](function(_0x5b2559){if(_0x5b2559){_0x21bb7e=_0x5b2559;_0x55f79b[_0x8299('0x32')]=_[_0x8299('0x30')](db[_0x8299('0x4b')]['rawAttributes']);_0x55f79b[_0x8299('0x2f')]=_[_0x8299('0x30')](_0x8199b7[_0x8299('0x2f')]);_0x55f79b[_0x8299('0x3b')]=_[_0x8299('0x44')](_0x55f79b[_0x8299('0x32')],_0x55f79b[_0x8299('0x2f')]);_0x5136e9[_0x8299('0x31')]=_['intersection'](_0x55f79b[_0x8299('0x32')],qs[_0x8299('0x33')](_0x8199b7[_0x8299('0x2f')][_0x8299('0x33')]));_0x5136e9[_0x8299('0x31')]=_0x5136e9[_0x8299('0x31')][_0x8299('0x34')]?_0x5136e9[_0x8299('0x31')]:_0x55f79b[_0x8299('0x32')];_0x5136e9[_0x8299('0x37')]=qs['sort'](_0x8199b7[_0x8299('0x2f')][_0x8299('0x38')]);_0x5136e9[_0x8299('0x39')]=qs['filters'](_[_0x8299('0x3a')](_0x8199b7[_0x8299('0x2f')],_0x55f79b[_0x8299('0x3b')]));if(_0x8199b7[_0x8299('0x2f')]['filter']){_0x5136e9[_0x8299('0x39')]=_[_0x8299('0x45')](_0x5136e9[_0x8299('0x39')],{'$or':_['map'](_0x5136e9[_0x8299('0x31')],function(_0x5081f9){var _0x43fcb5={};_0x43fcb5[_0x5081f9]={'$like':'%'+_0x8199b7[_0x8299('0x2f')][_0x8299('0x3c')]+'%'};return _0x43fcb5;})});}_0x5136e9=_['merge']({},_0x5136e9,_0x8199b7[_0x8299('0x4c')]);return _0x21bb7e[_0x8299('0x4e')](_0x5136e9);}})[_0x8299('0x25')](function(_0x571a76){if(_0x571a76){_0x3b1477=_0x571a76[_0x8299('0x34')];if(!_0x8199b7['query'][_0x8299('0x35')](_0x8299('0x36'))){_0x5136e9[_0x8299('0x1e')]=qs['limit'](_0x8199b7[_0x8299('0x2f')][_0x8299('0x1e')]);_0x5136e9[_0x8299('0x1c')]=qs[_0x8299('0x1c')](_0x8199b7[_0x8299('0x2f')][_0x8299('0x1c')]);}return _0x21bb7e[_0x8299('0x4e')](_0x5136e9);}})['then'](function(_0x5be802){if(_0x5be802){return _0x5be802?{'count':_0x3b1477,'rows':_0x5be802}:null;}})['then'](respondWithResult(_0x583201,null))[_0x8299('0x41')](handleError(_0x583201,null));}; \ No newline at end of file +var _0xa338=['show','params','keys','find','create','body','destroy','getSubjects','findOne','FreshsalesField','filter','hasOwnProperty','getDescriptions','getFields','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa338,0xa6));var _0x8a33=function(_0xc5f792,_0x107603){_0xc5f792=_0xc5f792-0x0;var _0x4ea854=_0xa338[_0xc5f792];return _0x4ea854;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8a33('0x0'));var moment=require(_0x8a33('0x1'));var BPromise=require(_0x8a33('0x2'));var Mustache=require('mustache');var util=require(_0x8a33('0x3'));var path=require('path');var sox=require(_0x8a33('0x4'));var csv=require('to-csv');var ejs=require(_0x8a33('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a33('0x6'));var crypto=require(_0x8a33('0x7'));var jsforce=require(_0x8a33('0x8'));var deskjs=require(_0x8a33('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8a33('0xa'));var Redis=require(_0x8a33('0xb'));var authService=require(_0x8a33('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x8a33('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a33('0xe'))('api');var utils=require(_0x8a33('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a33('0x10'))['db'];function respondWithStatusCode(_0x571608,_0xba4cd){_0xba4cd=_0xba4cd||0xcc;return function(_0x3a62c7){if(_0x3a62c7){return _0x571608[_0x8a33('0x11')](_0xba4cd);}return _0x571608[_0x8a33('0x12')](_0xba4cd)[_0x8a33('0x13')]();};}function respondWithResult(_0x12b460,_0x526329){_0x526329=_0x526329||0xc8;return function(_0x2f2e6d){if(_0x2f2e6d){return _0x12b460[_0x8a33('0x12')](_0x526329)['json'](_0x2f2e6d);}};}function respondWithFilteredResult(_0x4bcab3,_0x18e16f){return function(_0x92f078){if(_0x92f078){var _0x5f0a27=typeof _0x18e16f['offset']===_0x8a33('0x14')&&typeof _0x18e16f[_0x8a33('0x15')]===_0x8a33('0x14');var _0x23d3ab=_0x92f078[_0x8a33('0x16')];var _0x535481=_0x5f0a27?0x0:_0x18e16f[_0x8a33('0x17')];var _0x57c1a1=_0x5f0a27?_0x92f078[_0x8a33('0x16')]:_0x18e16f[_0x8a33('0x17')]+_0x18e16f[_0x8a33('0x15')];var _0x380684;if(_0x57c1a1>=_0x23d3ab){_0x57c1a1=_0x23d3ab;_0x380684=0xc8;}else{_0x380684=0xce;}_0x4bcab3['status'](_0x380684);return _0x4bcab3[_0x8a33('0x18')](_0x8a33('0x19'),_0x535481+'-'+_0x57c1a1+'/'+_0x23d3ab)[_0x8a33('0x1a')](_0x92f078);}return null;};}function patchUpdates(_0xf16768){return function(_0xc098bf){try{jsonpatch[_0x8a33('0x1b')](_0xc098bf,_0xf16768,!![]);}catch(_0x2fe0c4){return BPromise[_0x8a33('0x1c')](_0x2fe0c4);}return _0xc098bf[_0x8a33('0x1d')]();};}function saveUpdates(_0x36f146,_0xf020db){return function(_0x30c9ed){if(_0x30c9ed){return _0x30c9ed[_0x8a33('0x1e')](_0x36f146)[_0x8a33('0x1f')](function(_0x7446b8){return _0x7446b8;});}return null;};}function removeEntity(_0x3007bc,_0x5c2451){return function(_0xf495c7){if(_0xf495c7){return _0xf495c7['destroy']()[_0x8a33('0x1f')](function(){_0x3007bc[_0x8a33('0x12')](0xcc)[_0x8a33('0x13')]();});}};}function handleEntityNotFound(_0x42d8f2,_0x59b530){return function(_0x4ba8af){if(!_0x4ba8af){_0x42d8f2[_0x8a33('0x11')](0x194);}return _0x4ba8af;};}function handleError(_0x400f98,_0x39de1b){_0x39de1b=_0x39de1b||0x1f4;return function(_0x983996){logger[_0x8a33('0x20')](_0x983996[_0x8a33('0x21')]);if(_0x983996['name']){delete _0x983996[_0x8a33('0x22')];}_0x400f98[_0x8a33('0x12')](_0x39de1b)[_0x8a33('0x23')](_0x983996);};}exports[_0x8a33('0x24')]=function(_0x462263,_0xbc7a9d){var _0x395823={},_0x5abd8e={},_0x477467={'count':0x0,'rows':[]};var _0x12c4c7=_[_0x8a33('0x25')](db[_0x8a33('0x26')][_0x8a33('0x27')],function(_0x56e0ed){return{'name':_0x56e0ed[_0x8a33('0x28')],'type':_0x56e0ed['type'][_0x8a33('0x29')]};});_0x5abd8e[_0x8a33('0x2a')]=_['map'](_0x12c4c7,_0x8a33('0x22'));_0x5abd8e[_0x8a33('0x2b')]=_['keys'](_0x462263[_0x8a33('0x2b')]);_0x5abd8e[_0x8a33('0x2c')]=_[_0x8a33('0x2d')](_0x5abd8e[_0x8a33('0x2a')],_0x5abd8e[_0x8a33('0x2b')]);_0x395823[_0x8a33('0x2e')]=_[_0x8a33('0x2d')](_0x5abd8e[_0x8a33('0x2a')],qs[_0x8a33('0x2f')](_0x462263[_0x8a33('0x2b')][_0x8a33('0x2f')]));_0x395823[_0x8a33('0x2e')]=_0x395823[_0x8a33('0x2e')][_0x8a33('0x30')]?_0x395823['attributes']:_0x5abd8e[_0x8a33('0x2a')];if(!_0x462263[_0x8a33('0x2b')]['hasOwnProperty'](_0x8a33('0x31'))){_0x395823[_0x8a33('0x15')]=qs[_0x8a33('0x15')](_0x462263[_0x8a33('0x2b')][_0x8a33('0x15')]);_0x395823['offset']=qs[_0x8a33('0x17')](_0x462263[_0x8a33('0x2b')]['offset']);}_0x395823[_0x8a33('0x32')]=qs[_0x8a33('0x33')](_0x462263[_0x8a33('0x2b')][_0x8a33('0x33')]);_0x395823[_0x8a33('0x34')]=qs['filters'](_[_0x8a33('0x35')](_0x462263['query'],_0x5abd8e[_0x8a33('0x2c')]),_0x12c4c7);if(_0x462263[_0x8a33('0x2b')]['filter']){_0x395823[_0x8a33('0x34')]=_[_0x8a33('0x36')](_0x395823['where'],{'$or':_['map'](_0x12c4c7,function(_0x277f3d){if(_0x277f3d[_0x8a33('0x37')]!==_0x8a33('0x38')){var _0xa51f24={};_0xa51f24[_0x277f3d[_0x8a33('0x22')]]={'$like':'%'+_0x462263[_0x8a33('0x2b')]['filter']+'%'};return _0xa51f24;}})});}_0x395823=_[_0x8a33('0x36')]({},_0x395823,_0x462263[_0x8a33('0x39')]);var _0x15ba7a={'where':_0x395823[_0x8a33('0x34')]};return db['FreshsalesConfiguration'][_0x8a33('0x16')](_0x15ba7a)[_0x8a33('0x1f')](function(_0x46313a){_0x477467[_0x8a33('0x16')]=_0x46313a;if(_0x462263[_0x8a33('0x2b')][_0x8a33('0x3a')]){_0x395823[_0x8a33('0x3b')]=[{'all':!![]}];}return db[_0x8a33('0x26')][_0x8a33('0x3c')](_0x395823);})[_0x8a33('0x1f')](function(_0x59057c){_0x477467['rows']=_0x59057c;return _0x477467;})['then'](respondWithFilteredResult(_0xbc7a9d,_0x395823))[_0x8a33('0x3d')](handleError(_0xbc7a9d,null));};exports[_0x8a33('0x3e')]=function(_0x11e50a,_0x5df1ec){var _0x858b25={'raw':![],'where':{'id':_0x11e50a[_0x8a33('0x3f')]['id']}},_0x534bb={};_0x534bb['model']=_[_0x8a33('0x40')](db[_0x8a33('0x26')][_0x8a33('0x27')]);_0x534bb['query']=_['keys'](_0x11e50a['query']);_0x534bb[_0x8a33('0x2c')]=_[_0x8a33('0x2d')](_0x534bb['model'],_0x534bb[_0x8a33('0x2b')]);_0x858b25[_0x8a33('0x2e')]=_[_0x8a33('0x2d')](_0x534bb['model'],qs[_0x8a33('0x2f')](_0x11e50a[_0x8a33('0x2b')]['fields']));_0x858b25[_0x8a33('0x2e')]=_0x858b25[_0x8a33('0x2e')][_0x8a33('0x30')]?_0x858b25['attributes']:_0x534bb[_0x8a33('0x2a')];if(_0x11e50a[_0x8a33('0x2b')][_0x8a33('0x3a')]){_0x858b25[_0x8a33('0x3b')]=[{'all':!![]}];}_0x858b25=_['merge']({},_0x858b25,_0x11e50a[_0x8a33('0x39')]);return db['FreshsalesConfiguration'][_0x8a33('0x41')](_0x858b25)[_0x8a33('0x1f')](handleEntityNotFound(_0x5df1ec,null))[_0x8a33('0x1f')](respondWithResult(_0x5df1ec,null))[_0x8a33('0x3d')](handleError(_0x5df1ec,null));};exports[_0x8a33('0x42')]=function(_0x3db403,_0x60b4fe){return db[_0x8a33('0x26')][_0x8a33('0x42')](_0x3db403['body'],{})[_0x8a33('0x1f')](respondWithResult(_0x60b4fe,0xc9))[_0x8a33('0x3d')](handleError(_0x60b4fe,null));};exports[_0x8a33('0x1e')]=function(_0x19e10e,_0x5374fc){if(_0x19e10e[_0x8a33('0x43')]['id']){delete _0x19e10e[_0x8a33('0x43')]['id'];}return db[_0x8a33('0x26')][_0x8a33('0x41')]({'where':{'id':_0x19e10e[_0x8a33('0x3f')]['id']}})[_0x8a33('0x1f')](handleEntityNotFound(_0x5374fc,null))['then'](saveUpdates(_0x19e10e[_0x8a33('0x43')],null))[_0x8a33('0x1f')](respondWithResult(_0x5374fc,null))[_0x8a33('0x3d')](handleError(_0x5374fc,null));};exports[_0x8a33('0x44')]=function(_0x5d28cc,_0x2e2a5f){return db[_0x8a33('0x26')][_0x8a33('0x41')]({'where':{'id':_0x5d28cc[_0x8a33('0x3f')]['id']}})[_0x8a33('0x1f')](handleEntityNotFound(_0x2e2a5f,null))[_0x8a33('0x1f')](removeEntity(_0x2e2a5f,null))[_0x8a33('0x3d')](handleError(_0x2e2a5f,null));};exports[_0x8a33('0x45')]=function(_0x4cfb1e,_0x341bc1,_0x3583da){var _0x34d1ff={};var _0x31bc17={};var _0x822dfd;var _0x4fac45;return db[_0x8a33('0x26')][_0x8a33('0x46')]({'where':{'id':_0x4cfb1e[_0x8a33('0x3f')]['id']}})[_0x8a33('0x1f')](handleEntityNotFound(_0x341bc1,null))['then'](function(_0x1b2f5f){if(_0x1b2f5f){_0x822dfd=_0x1b2f5f;_0x31bc17[_0x8a33('0x2a')]=_[_0x8a33('0x40')](db[_0x8a33('0x47')][_0x8a33('0x27')]);_0x31bc17[_0x8a33('0x2b')]=_[_0x8a33('0x40')](_0x4cfb1e['query']);_0x31bc17[_0x8a33('0x2c')]=_['intersection'](_0x31bc17['model'],_0x31bc17[_0x8a33('0x2b')]);_0x34d1ff[_0x8a33('0x2e')]=_[_0x8a33('0x2d')](_0x31bc17[_0x8a33('0x2a')],qs[_0x8a33('0x2f')](_0x4cfb1e[_0x8a33('0x2b')][_0x8a33('0x2f')]));_0x34d1ff[_0x8a33('0x2e')]=_0x34d1ff[_0x8a33('0x2e')][_0x8a33('0x30')]?_0x34d1ff[_0x8a33('0x2e')]:_0x31bc17[_0x8a33('0x2a')];_0x34d1ff[_0x8a33('0x32')]=qs[_0x8a33('0x33')](_0x4cfb1e['query'][_0x8a33('0x33')]);_0x34d1ff[_0x8a33('0x34')]=qs[_0x8a33('0x2c')](_[_0x8a33('0x35')](_0x4cfb1e[_0x8a33('0x2b')],_0x31bc17['filters']));if(_0x4cfb1e[_0x8a33('0x2b')][_0x8a33('0x48')]){_0x34d1ff[_0x8a33('0x34')]=_[_0x8a33('0x36')](_0x34d1ff[_0x8a33('0x34')],{'$or':_[_0x8a33('0x25')](_0x34d1ff['attributes'],function(_0x433033){var _0x3b1c1b={};_0x3b1c1b[_0x433033]={'$like':'%'+_0x4cfb1e['query'][_0x8a33('0x48')]+'%'};return _0x3b1c1b;})});}_0x34d1ff=_[_0x8a33('0x36')]({},_0x34d1ff,_0x4cfb1e[_0x8a33('0x39')]);return _0x822dfd['getSubjects'](_0x34d1ff);}})['then'](function(_0xbae41e){if(_0xbae41e){_0x4fac45=_0xbae41e[_0x8a33('0x30')];if(!_0x4cfb1e[_0x8a33('0x2b')][_0x8a33('0x49')]('nolimit')){_0x34d1ff[_0x8a33('0x15')]=qs[_0x8a33('0x15')](_0x4cfb1e['query'][_0x8a33('0x15')]);_0x34d1ff[_0x8a33('0x17')]=qs[_0x8a33('0x17')](_0x4cfb1e[_0x8a33('0x2b')]['offset']);}return _0x822dfd[_0x8a33('0x45')](_0x34d1ff);}})[_0x8a33('0x1f')](function(_0x605a6b){if(_0x605a6b){return _0x605a6b?{'count':_0x4fac45,'rows':_0x605a6b}:null;}})[_0x8a33('0x1f')](respondWithResult(_0x341bc1,null))[_0x8a33('0x3d')](handleError(_0x341bc1,null));};exports['getDescriptions']=function(_0x59c4c4,_0x46e7e9,_0x35a5b9){var _0x168c8d={};var _0x26c4b1={};var _0x316c42;var _0x2fecb3;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x59c4c4[_0x8a33('0x3f')]['id']}})[_0x8a33('0x1f')](handleEntityNotFound(_0x46e7e9,null))[_0x8a33('0x1f')](function(_0x2a3abd){if(_0x2a3abd){_0x316c42=_0x2a3abd;_0x26c4b1[_0x8a33('0x2a')]=_[_0x8a33('0x40')](db[_0x8a33('0x47')][_0x8a33('0x27')]);_0x26c4b1[_0x8a33('0x2b')]=_['keys'](_0x59c4c4[_0x8a33('0x2b')]);_0x26c4b1[_0x8a33('0x2c')]=_[_0x8a33('0x2d')](_0x26c4b1['model'],_0x26c4b1[_0x8a33('0x2b')]);_0x168c8d[_0x8a33('0x2e')]=_[_0x8a33('0x2d')](_0x26c4b1[_0x8a33('0x2a')],qs[_0x8a33('0x2f')](_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x2f')]));_0x168c8d['attributes']=_0x168c8d[_0x8a33('0x2e')][_0x8a33('0x30')]?_0x168c8d[_0x8a33('0x2e')]:_0x26c4b1['model'];_0x168c8d[_0x8a33('0x32')]=qs['sort'](_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x33')]);_0x168c8d['where']=qs[_0x8a33('0x2c')](_[_0x8a33('0x35')](_0x59c4c4['query'],_0x26c4b1['filters']));if(_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x48')]){_0x168c8d[_0x8a33('0x34')]=_[_0x8a33('0x36')](_0x168c8d['where'],{'$or':_[_0x8a33('0x25')](_0x168c8d[_0x8a33('0x2e')],function(_0x44b4f1){var _0x356673={};_0x356673[_0x44b4f1]={'$like':'%'+_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x48')]+'%'};return _0x356673;})});}_0x168c8d=_['merge']({},_0x168c8d,_0x59c4c4[_0x8a33('0x39')]);return _0x316c42[_0x8a33('0x4a')](_0x168c8d);}})[_0x8a33('0x1f')](function(_0x56ba02){if(_0x56ba02){_0x2fecb3=_0x56ba02[_0x8a33('0x30')];if(!_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x49')](_0x8a33('0x31'))){_0x168c8d['limit']=qs['limit'](_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x15')]);_0x168c8d[_0x8a33('0x17')]=qs[_0x8a33('0x17')](_0x59c4c4[_0x8a33('0x2b')][_0x8a33('0x17')]);}return _0x316c42[_0x8a33('0x4a')](_0x168c8d);}})[_0x8a33('0x1f')](function(_0x58fe24){if(_0x58fe24){return _0x58fe24?{'count':_0x2fecb3,'rows':_0x58fe24}:null;}})['then'](respondWithResult(_0x46e7e9,null))['catch'](handleError(_0x46e7e9,null));};exports[_0x8a33('0x4b')]=function(_0x5a44d9,_0x1a23b0,_0xcc55f3){var _0x42b305={};var _0x47dad3={};var _0x2ada53;var _0x136ece;return db[_0x8a33('0x26')]['findOne']({'where':{'id':_0x5a44d9['params']['id']}})['then'](handleEntityNotFound(_0x1a23b0,null))[_0x8a33('0x1f')](function(_0x1a1bc5){if(_0x1a1bc5){_0x2ada53=_0x1a1bc5;_0x47dad3[_0x8a33('0x2a')]=_[_0x8a33('0x40')](db[_0x8a33('0x47')][_0x8a33('0x27')]);_0x47dad3[_0x8a33('0x2b')]=_[_0x8a33('0x40')](_0x5a44d9['query']);_0x47dad3[_0x8a33('0x2c')]=_[_0x8a33('0x2d')](_0x47dad3[_0x8a33('0x2a')],_0x47dad3['query']);_0x42b305[_0x8a33('0x2e')]=_[_0x8a33('0x2d')](_0x47dad3['model'],qs[_0x8a33('0x2f')](_0x5a44d9[_0x8a33('0x2b')]['fields']));_0x42b305[_0x8a33('0x2e')]=_0x42b305[_0x8a33('0x2e')][_0x8a33('0x30')]?_0x42b305[_0x8a33('0x2e')]:_0x47dad3['model'];_0x42b305[_0x8a33('0x32')]=qs[_0x8a33('0x33')](_0x5a44d9[_0x8a33('0x2b')][_0x8a33('0x33')]);_0x42b305[_0x8a33('0x34')]=qs[_0x8a33('0x2c')](_[_0x8a33('0x35')](_0x5a44d9[_0x8a33('0x2b')],_0x47dad3[_0x8a33('0x2c')]));if(_0x5a44d9['query'][_0x8a33('0x48')]){_0x42b305['where']=_[_0x8a33('0x36')](_0x42b305['where'],{'$or':_['map'](_0x42b305[_0x8a33('0x2e')],function(_0x27cfee){var _0x15ec0b={};_0x15ec0b[_0x27cfee]={'$like':'%'+_0x5a44d9[_0x8a33('0x2b')][_0x8a33('0x48')]+'%'};return _0x15ec0b;})});}_0x42b305=_[_0x8a33('0x36')]({},_0x42b305,_0x5a44d9[_0x8a33('0x39')]);return _0x2ada53['getFields'](_0x42b305);}})[_0x8a33('0x1f')](function(_0x2b116d){if(_0x2b116d){_0x136ece=_0x2b116d[_0x8a33('0x30')];if(!_0x5a44d9[_0x8a33('0x2b')][_0x8a33('0x49')](_0x8a33('0x31'))){_0x42b305[_0x8a33('0x15')]=qs[_0x8a33('0x15')](_0x5a44d9[_0x8a33('0x2b')][_0x8a33('0x15')]);_0x42b305['offset']=qs[_0x8a33('0x17')](_0x5a44d9['query'][_0x8a33('0x17')]);}return _0x2ada53[_0x8a33('0x4b')](_0x42b305);}})[_0x8a33('0x1f')](function(_0x371050){if(_0x371050){return _0x371050?{'count':_0x136ece,'rows':_0x371050}:null;}})[_0x8a33('0x1f')](respondWithResult(_0x1a23b0,null))['catch'](handleError(_0x1a23b0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 850fdde..1ecf5fa 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 _0xee58=['path','rimraf','../../config/environment','define','FreshsalesConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e74b6,_0x17fe6a){var _0xb8a985=function(_0x304e90){while(--_0x304e90){_0x5e74b6['push'](_0x5e74b6['shift']());}};_0xb8a985(++_0x17fe6a);}(_0xee58,0x161));var _0x8ee5=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xee58[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x8ee5('0x0'));var util=require(_0x8ee5('0x1'));var logger=require(_0x8ee5('0x2'))(_0x8ee5('0x3'));var moment=require(_0x8ee5('0x4'));var BPromise=require(_0x8ee5('0x5'));var rp=require(_0x8ee5('0x6'));var fs=require('fs');var path=require(_0x8ee5('0x7'));var rimraf=require(_0x8ee5('0x8'));var config=require(_0x8ee5('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x482add,_0x159246){return _0x482add[_0x8ee5('0xa')](_0x8ee5('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24bf=['exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x4e3676,_0x34db46){var _0x5f3159=function(_0x4f91d9){while(--_0x4f91d9){_0x4e3676['push'](_0x4e3676['shift']());}};_0x5f3159(++_0x34db46);}(_0x24bf,0xfa));var _0xf24b=function(_0x5e2f61,_0x5b29de){_0x5e2f61=_0x5e2f61-0x0;var _0x1cb4d0=_0x24bf[_0x5e2f61];return _0x1cb4d0;};'use strict';var _=require(_0xf24b('0x0'));var util=require(_0xf24b('0x1'));var logger=require(_0xf24b('0x2'))(_0xf24b('0x3'));var moment=require('moment');var BPromise=require(_0xf24b('0x4'));var rp=require(_0xf24b('0x5'));var fs=require('fs');var path=require(_0xf24b('0x6'));var rimraf=require(_0xf24b('0x7'));var config=require(_0xf24b('0x8'));var attributes=require(_0xf24b('0x9'));module[_0xf24b('0xa')]=function(_0x185aaf,_0x52652b){return _0x185aaf['define'](_0xf24b('0xb'),attributes,{'tableName':_0xf24b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index bdc0a23..af92e31 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 _0x5560=['info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x5560,0xca));var _0x0556=function(_0xb42c59,_0x69867){_0xb42c59=_0xb42c59-0x0;var _0x133207=_0x5560[_0xb42c59];return _0x133207;};'use strict';var _=require(_0x0556('0x0'));var util=require(_0x0556('0x1'));var moment=require(_0x0556('0x2'));var BPromise=require(_0x0556('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0556('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0556('0x5'));var logger=require(_0x0556('0x6'))(_0x0556('0x7'));var config=require('../../config/environment');var jayson=require(_0x0556('0x8'));var client=jayson['client'][_0x0556('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ceacf,_0x25d060,_0x47b72e){return new BPromise(function(_0x40f106,_0x447ef1){return client[_0x0556('0xa')](_0x3ceacf,_0x47b72e)[_0x0556('0xb')](function(_0x5a95db){logger['info'](_0x0556('0xc'),_0x25d060,'request\x20sent');logger[_0x0556('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x25d060,_0x0556('0xe'),JSON['stringify'](_0x5a95db));if(_0x5a95db[_0x0556('0xf')]){if(_0x5a95db[_0x0556('0xf')][_0x0556('0x10')]===0x1f4){logger[_0x0556('0xf')](_0x0556('0xc'),_0x25d060,_0x5a95db[_0x0556('0xf')][_0x0556('0x11')]);return _0x447ef1(_0x5a95db[_0x0556('0xf')][_0x0556('0x11')]);}logger['error'](_0x0556('0xc'),_0x25d060,_0x5a95db[_0x0556('0xf')][_0x0556('0x11')]);return _0x40f106(_0x5a95db['error'][_0x0556('0x11')]);}else{logger[_0x0556('0x12')](_0x0556('0xc'),_0x25d060,_0x0556('0xe'));_0x40f106(_0x5a95db[_0x0556('0x13')]['message']);}})['catch'](function(_0x2fadf5){logger['error'](_0x0556('0xc'),_0x25d060,_0x2fadf5);_0x447ef1(_0x2fadf5);});});} \ No newline at end of file +var _0x4f53=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x5032ab,_0x366f18){var _0x3312bf=function(_0x41480a){while(--_0x41480a){_0x5032ab['push'](_0x5032ab['shift']());}};_0x3312bf(++_0x366f18);}(_0x4f53,0x69));var _0x34f5=function(_0x1463fb,_0x50229f){_0x1463fb=_0x1463fb-0x0;var _0x4131ff=_0x4f53[_0x1463fb];return _0x4131ff;};'use strict';var _=require(_0x34f5('0x0'));var util=require(_0x34f5('0x1'));var moment=require(_0x34f5('0x2'));var BPromise=require(_0x34f5('0x3'));var rs=require(_0x34f5('0x4'));var fs=require('fs');var Redis=require(_0x34f5('0x5'));var db=require(_0x34f5('0x6'))['db'];var utils=require(_0x34f5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x34f5('0x8'));var jayson=require(_0x34f5('0x9'));var client=jayson['client'][_0x34f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d971d,_0x150a32,_0x1b335f){return new BPromise(function(_0x1d3000,_0x36cbda){return client[_0x34f5('0xb')](_0x3d971d,_0x1b335f)[_0x34f5('0xc')](function(_0x4f6579){logger[_0x34f5('0xd')](_0x34f5('0xe'),_0x150a32,_0x34f5('0xf'));logger[_0x34f5('0x10')](_0x34f5('0x11'),_0x150a32,_0x34f5('0xf'),JSON[_0x34f5('0x12')](_0x4f6579));if(_0x4f6579[_0x34f5('0x13')]){if(_0x4f6579['error'][_0x34f5('0x14')]===0x1f4){logger[_0x34f5('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x150a32,_0x4f6579[_0x34f5('0x13')][_0x34f5('0x15')]);return _0x36cbda(_0x4f6579[_0x34f5('0x13')][_0x34f5('0x15')]);}logger['error'](_0x34f5('0xe'),_0x150a32,_0x4f6579[_0x34f5('0x13')]['message']);return _0x1d3000(_0x4f6579['error'][_0x34f5('0x15')]);}else{logger[_0x34f5('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x150a32,_0x34f5('0xf'));_0x1d3000(_0x4f6579[_0x34f5('0x16')]['message']);}})[_0x34f5('0x17')](function(_0x2a7df3){logger[_0x34f5('0x13')](_0x34f5('0xe'),_0x150a32,_0x2a7df3);_0x36cbda(_0x2a7df3);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 897f979..f14df0d 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 _0x782e=['/:id','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','post','create','put'];(function(_0xfcd69d,_0x2101cf){var _0x233b2b=function(_0x2d4f94){while(--_0x2d4f94){_0xfcd69d['push'](_0xfcd69d['shift']());}};_0x233b2b(++_0x2101cf);}(_0x782e,0xb9));var _0xe782=function(_0x1a313c,_0x3c52ff){_0x1a313c=_0x1a313c-0x0;var _0x281f73=_0x782e[_0x1a313c];return _0x281f73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe782('0x0'));var timeout=require(_0xe782('0x1'));var express=require('express');var router=express[_0xe782('0x2')]();var fs_extra=require(_0xe782('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe782('0x4'));var config=require(_0xe782('0x5'));var controller=require(_0xe782('0x6'));router[_0xe782('0x7')]('/',auth['isAuthenticated'](),controller[_0xe782('0x8')]);router['get']('/:id',auth[_0xe782('0x9')](),controller['show']);router[_0xe782('0xa')]('/',auth[_0xe782('0x9')](),controller[_0xe782('0xb')]);router[_0xe782('0xc')](_0xe782('0xd'),auth[_0xe782('0x9')](),controller[_0xe782('0xe')]);router[_0xe782('0xf')](_0xe782('0xd'),auth[_0xe782('0x9')](),controller[_0xe782('0x10')]);module[_0xe782('0x11')]=router; \ No newline at end of file +var _0xaf1d=['show','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x8e74d1,_0x5835e9){var _0x31936c=function(_0x17ca2b){while(--_0x17ca2b){_0x8e74d1['push'](_0x8e74d1['shift']());}};_0x31936c(++_0x5835e9);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x123762,_0x5d5e7d){_0x123762=_0x123762-0x0;var _0x20ff95=_0xaf1d[_0x123762];return _0x20ff95;};'use strict';var multer=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var path=require(_0xdaf1('0x2'));var timeout=require(_0xdaf1('0x3'));var express=require('express');var router=express[_0xdaf1('0x4')]();var fs_extra=require(_0xdaf1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdaf1('0x6'));var config=require(_0xdaf1('0x7'));var controller=require(_0xdaf1('0x8'));router[_0xdaf1('0x9')]('/',auth[_0xdaf1('0xa')](),controller[_0xdaf1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdaf1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdaf1('0xd')]);router[_0xdaf1('0xe')](_0xdaf1('0xf'),auth[_0xdaf1('0xa')](),controller['update']);router[_0xdaf1('0x10')](_0xdaf1('0xf'),auth[_0xdaf1('0xa')](),controller[_0xdaf1('0x11')]);module[_0xdaf1('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 4a83b96..7310a89 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 _0x4bd0=['variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x4bd0,0x147));var _0x04bd=function(_0xdc0397,_0x20d1f1){_0xdc0397=_0xdc0397-0x0;var _0x553d02=_0x4bd0[_0xdc0397];return _0x553d02;};'use strict';var Sequelize=require(_0x04bd('0x0'));module[_0x04bd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x04bd('0x2'),_0x04bd('0x3'),_0x04bd('0x4'),_0x04bd('0x5'),_0x04bd('0x6')),'defaultValue':_0x04bd('0x2')},'content':{'type':Sequelize[_0x04bd('0x7')]},'key':{'type':Sequelize[_0x04bd('0x7')]},'keyType':{'type':Sequelize[_0x04bd('0x8')](_0x04bd('0x2'),_0x04bd('0x3'),_0x04bd('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x04bd('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x04bd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x04bd('0x7')]}}; \ No newline at end of file +var _0x29a2=['picklist','string','STRING','BOOLEAN','ENUM','variable','keyValue'];(function(_0x1513c8,_0x4ca319){var _0x261a16=function(_0x5bca8c){while(--_0x5bca8c){_0x1513c8['push'](_0x1513c8['shift']());}};_0x261a16(++_0x4ca319);}(_0x29a2,0x13f));var _0x229a=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x29a2[_0x2ff238];return _0x204a56;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x229a('0x0')]('string',_0x229a('0x1'),'customVariable',_0x229a('0x2'),_0x229a('0x3')),'defaultValue':_0x229a('0x4')},'content':{'type':Sequelize[_0x229a('0x5')]},'key':{'type':Sequelize[_0x229a('0x5')]},'keyType':{'type':Sequelize[_0x229a('0x0')](_0x229a('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x229a('0x5')]},'idField':{'type':Sequelize[_0x229a('0x5')]},'nameField':{'type':Sequelize[_0x229a('0x5')]},'customField':{'type':Sequelize[_0x229a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x229a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 426e8c0..27bd4ae 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 _0x064b=['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','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','end','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel'];(function(_0x49b5f,_0x9a99fd){var _0x48576b=function(_0x3ef5c8){while(--_0x3ef5c8){_0x49b5f['push'](_0x49b5f['shift']());}};_0x48576b(++_0x9a99fd);}(_0x064b,0xcd));var _0xb064=function(_0x2ce4d9,_0x47173f){_0x2ce4d9=_0x2ce4d9-0x0;var _0x3a802c=_0x064b[_0x2ce4d9];return _0x3a802c;};'use strict';var emlformat=require(_0xb064('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb064('0x1'));var jsonpatch=require(_0xb064('0x2'));var rp=require(_0xb064('0x3'));var moment=require(_0xb064('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb064('0x5'));var util=require('util');var path=require(_0xb064('0x6'));var sox=require('sox');var csv=require(_0xb064('0x7'));var ejs=require(_0xb064('0x8'));var fs=require('fs');var fs_extra=require(_0xb064('0x9'));var _=require('lodash');var squel=require(_0xb064('0xa'));var crypto=require('crypto');var jsforce=require(_0xb064('0xb'));var deskjs=require(_0xb064('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb064('0xd'));var Papa=require('papaparse');var Redis=require(_0xb064('0xe'));var authService=require(_0xb064('0xf'));var qs=require(_0xb064('0x10'));var as=require(_0xb064('0x11'));var hardwareService=require(_0xb064('0x12'));var logger=require(_0xb064('0x13'))(_0xb064('0x14'));var utils=require(_0xb064('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb064('0x16'));var db=require(_0xb064('0x17'))['db'];function respondWithStatusCode(_0x3114e7,_0x1f9609){_0x1f9609=_0x1f9609||0xcc;return function(_0x4f422a){if(_0x4f422a){return _0x3114e7[_0xb064('0x18')](_0x1f9609);}return _0x3114e7['status'](_0x1f9609)['end']();};}function respondWithResult(_0x486934,_0xce1f8c){_0xce1f8c=_0xce1f8c||0xc8;return function(_0x1d88e2){if(_0x1d88e2){return _0x486934[_0xb064('0x19')](_0xce1f8c)[_0xb064('0x1a')](_0x1d88e2);}};}function respondWithFilteredResult(_0x32b7fb,_0x34f1fd){return function(_0x2c18d2){if(_0x2c18d2){var _0x188097=typeof _0x34f1fd[_0xb064('0x1b')]===_0xb064('0x1c')&&typeof _0x34f1fd[_0xb064('0x1d')]===_0xb064('0x1c');var _0x38fddc=_0x2c18d2[_0xb064('0x1e')];var _0x3b36ec=_0x188097?0x0:_0x34f1fd[_0xb064('0x1b')];var _0x9230c8=_0x188097?_0x2c18d2['count']:_0x34f1fd[_0xb064('0x1b')]+_0x34f1fd[_0xb064('0x1d')];var _0x4262f1;if(_0x9230c8>=_0x38fddc){_0x9230c8=_0x38fddc;_0x4262f1=0xc8;}else{_0x4262f1=0xce;}_0x32b7fb[_0xb064('0x19')](_0x4262f1);return _0x32b7fb['set'](_0xb064('0x1f'),_0x3b36ec+'-'+_0x9230c8+'/'+_0x38fddc)[_0xb064('0x1a')](_0x2c18d2);}return null;};}function patchUpdates(_0xf5461e){return function(_0x2a16db){try{jsonpatch[_0xb064('0x20')](_0x2a16db,_0xf5461e,!![]);}catch(_0x35e2f3){return BPromise[_0xb064('0x21')](_0x35e2f3);}return _0x2a16db['save']();};}function saveUpdates(_0x420022,_0x380b3f){return function(_0x3277b5){if(_0x3277b5){return _0x3277b5[_0xb064('0x22')](_0x420022)['then'](function(_0x5acdc8){return _0x5acdc8;});}return null;};}function removeEntity(_0x13cae3,_0x5b0c4c){return function(_0x2e1981){if(_0x2e1981){return _0x2e1981[_0xb064('0x23')]()[_0xb064('0x24')](function(){_0x13cae3[_0xb064('0x19')](0xcc)[_0xb064('0x25')]();});}};}function handleEntityNotFound(_0x251df3,_0x1445be){return function(_0x257941){if(!_0x257941){_0x251df3[_0xb064('0x18')](0x194);}return _0x257941;};}function handleError(_0xcf5cbf,_0x58900f){_0x58900f=_0x58900f||0x1f4;return function(_0x299980){logger['error'](_0x299980[_0xb064('0x26')]);if(_0x299980[_0xb064('0x27')]){delete _0x299980['name'];}_0xcf5cbf[_0xb064('0x19')](_0x58900f)['send'](_0x299980);};}exports[_0xb064('0x28')]=function(_0x39bc94,_0x19f8e6){var _0x1f76a1={},_0x4497d9={},_0x264b1e={'count':0x0,'rows':[]};var _0x58f558=_[_0xb064('0x29')](db['FreshsalesField'][_0xb064('0x2a')],function(_0x2fe882){return{'name':_0x2fe882[_0xb064('0x2b')],'type':_0x2fe882[_0xb064('0x2c')]['key']};});_0x4497d9[_0xb064('0x2d')]=_[_0xb064('0x29')](_0x58f558,_0xb064('0x27'));_0x4497d9[_0xb064('0x2e')]=_[_0xb064('0x2f')](_0x39bc94[_0xb064('0x2e')]);_0x4497d9[_0xb064('0x30')]=_[_0xb064('0x31')](_0x4497d9['model'],_0x4497d9[_0xb064('0x2e')]);_0x1f76a1['attributes']=_['intersection'](_0x4497d9[_0xb064('0x2d')],qs[_0xb064('0x32')](_0x39bc94[_0xb064('0x2e')]['fields']));_0x1f76a1[_0xb064('0x33')]=_0x1f76a1[_0xb064('0x33')]['length']?_0x1f76a1[_0xb064('0x33')]:_0x4497d9[_0xb064('0x2d')];if(!_0x39bc94[_0xb064('0x2e')][_0xb064('0x34')](_0xb064('0x35'))){_0x1f76a1[_0xb064('0x1d')]=qs[_0xb064('0x1d')](_0x39bc94['query'][_0xb064('0x1d')]);_0x1f76a1[_0xb064('0x1b')]=qs[_0xb064('0x1b')](_0x39bc94[_0xb064('0x2e')][_0xb064('0x1b')]);}_0x1f76a1['order']=qs['sort'](_0x39bc94[_0xb064('0x2e')][_0xb064('0x36')]);_0x1f76a1[_0xb064('0x37')]=qs[_0xb064('0x30')](_[_0xb064('0x38')](_0x39bc94[_0xb064('0x2e')],_0x4497d9[_0xb064('0x30')]),_0x58f558);if(_0x39bc94[_0xb064('0x2e')][_0xb064('0x39')]){_0x1f76a1[_0xb064('0x37')]=_[_0xb064('0x3a')](_0x1f76a1[_0xb064('0x37')],{'$or':_[_0xb064('0x29')](_0x58f558,function(_0x2e5c25){if(_0x2e5c25[_0xb064('0x2c')]!==_0xb064('0x3b')){var _0x1b2b6e={};_0x1b2b6e[_0x2e5c25[_0xb064('0x27')]]={'$like':'%'+_0x39bc94['query']['filter']+'%'};return _0x1b2b6e;}})});}_0x1f76a1=_[_0xb064('0x3a')]({},_0x1f76a1,_0x39bc94[_0xb064('0x3c')]);var _0x5a9d3e={'where':_0x1f76a1[_0xb064('0x37')]};return db[_0xb064('0x3d')][_0xb064('0x1e')](_0x5a9d3e)['then'](function(_0x168bc8){_0x264b1e[_0xb064('0x1e')]=_0x168bc8;if(_0x39bc94[_0xb064('0x2e')]['includeAll']){_0x1f76a1[_0xb064('0x3e')]=[{'all':!![]}];}return db['FreshsalesField'][_0xb064('0x3f')](_0x1f76a1);})[_0xb064('0x24')](function(_0x1df8d5){_0x264b1e[_0xb064('0x40')]=_0x1df8d5;return _0x264b1e;})[_0xb064('0x24')](respondWithFilteredResult(_0x19f8e6,_0x1f76a1))[_0xb064('0x41')](handleError(_0x19f8e6,null));};exports[_0xb064('0x42')]=function(_0x4f25f8,_0x3b5733){var _0x7e76ce={'raw':!![],'where':{'id':_0x4f25f8[_0xb064('0x43')]['id']}},_0x154a39={};_0x154a39[_0xb064('0x2d')]=_[_0xb064('0x2f')](db['FreshsalesField'][_0xb064('0x2a')]);_0x154a39[_0xb064('0x2e')]=_[_0xb064('0x2f')](_0x4f25f8[_0xb064('0x2e')]);_0x154a39[_0xb064('0x30')]=_[_0xb064('0x31')](_0x154a39[_0xb064('0x2d')],_0x154a39[_0xb064('0x2e')]);_0x7e76ce[_0xb064('0x33')]=_[_0xb064('0x31')](_0x154a39[_0xb064('0x2d')],qs[_0xb064('0x32')](_0x4f25f8[_0xb064('0x2e')]['fields']));_0x7e76ce['attributes']=_0x7e76ce[_0xb064('0x33')]['length']?_0x7e76ce['attributes']:_0x154a39[_0xb064('0x2d')];if(_0x4f25f8[_0xb064('0x2e')][_0xb064('0x44')]){_0x7e76ce[_0xb064('0x3e')]=[{'all':!![]}];}_0x7e76ce=_[_0xb064('0x3a')]({},_0x7e76ce,_0x4f25f8['options']);return db[_0xb064('0x3d')][_0xb064('0x45')](_0x7e76ce)['then'](handleEntityNotFound(_0x3b5733,null))[_0xb064('0x24')](respondWithResult(_0x3b5733,null))[_0xb064('0x41')](handleError(_0x3b5733,null));};exports[_0xb064('0x46')]=function(_0x29f1dd,_0x3e6292){return db[_0xb064('0x3d')]['create'](_0x29f1dd[_0xb064('0x47')],{})[_0xb064('0x24')](respondWithResult(_0x3e6292,0xc9))[_0xb064('0x41')](handleError(_0x3e6292,null));};exports['update']=function(_0x109e80,_0x9d6d00){if(_0x109e80[_0xb064('0x47')]['id']){delete _0x109e80[_0xb064('0x47')]['id'];}return db[_0xb064('0x3d')]['find']({'where':{'id':_0x109e80['params']['id']}})['then'](handleEntityNotFound(_0x9d6d00,null))[_0xb064('0x24')](saveUpdates(_0x109e80[_0xb064('0x47')],null))['then'](respondWithResult(_0x9d6d00,null))[_0xb064('0x41')](handleError(_0x9d6d00,null));};exports['destroy']=function(_0x2b87ac,_0x513dbb){return db[_0xb064('0x3d')][_0xb064('0x45')]({'where':{'id':_0x2b87ac[_0xb064('0x43')]['id']}})[_0xb064('0x24')](handleEntityNotFound(_0x513dbb,null))[_0xb064('0x24')](removeEntity(_0x513dbb,null))[_0xb064('0x41')](handleError(_0x513dbb,null));}; \ No newline at end of file +var _0x6c34=['fast-json-patch','request-promise','moment','util','path','fs-extra','squel','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','create','body','find','params','zip-dir'];(function(_0xce3797,_0x1671a3){var _0x7849f3=function(_0x396abc){while(--_0x396abc){_0xce3797['push'](_0xce3797['shift']());}};_0x7849f3(++_0x1671a3);}(_0x6c34,0x162));var _0x46c3=function(_0x44361b,_0x3c0f01){_0x44361b=_0x44361b-0x0;var _0x210220=_0x6c34[_0x44361b];return _0x210220;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x46c3('0x0'));var jsonpatch=require(_0x46c3('0x1'));var rp=require(_0x46c3('0x2'));var moment=require(_0x46c3('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x46c3('0x4'));var path=require(_0x46c3('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46c3('0x6'));var _=require('lodash');var squel=require(_0x46c3('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x46c3('0x8'));var toCsv=require(_0x46c3('0x9'));var querystring=require(_0x46c3('0xa'));var Papa=require(_0x46c3('0xb'));var Redis=require('ioredis');var authService=require(_0x46c3('0xc'));var qs=require(_0x46c3('0xd'));var as=require(_0x46c3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46c3('0xf'))(_0x46c3('0x10'));var utils=require(_0x46c3('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x46c3('0x12'));var db=require(_0x46c3('0x13'))['db'];function respondWithStatusCode(_0x3af895,_0x3421ae){_0x3421ae=_0x3421ae||0xcc;return function(_0x1d12ae){if(_0x1d12ae){return _0x3af895['sendStatus'](_0x3421ae);}return _0x3af895[_0x46c3('0x14')](_0x3421ae)[_0x46c3('0x15')]();};}function respondWithResult(_0x23a446,_0x9eaf5c){_0x9eaf5c=_0x9eaf5c||0xc8;return function(_0x54673f){if(_0x54673f){return _0x23a446['status'](_0x9eaf5c)[_0x46c3('0x16')](_0x54673f);}};}function respondWithFilteredResult(_0x4347be,_0x14a447){return function(_0x339ee9){if(_0x339ee9){var _0x4043fd=typeof _0x14a447[_0x46c3('0x17')]===_0x46c3('0x18')&&typeof _0x14a447[_0x46c3('0x19')]===_0x46c3('0x18');var _0x21533a=_0x339ee9[_0x46c3('0x1a')];var _0x222747=_0x4043fd?0x0:_0x14a447[_0x46c3('0x17')];var _0x1f86f9=_0x4043fd?_0x339ee9['count']:_0x14a447[_0x46c3('0x17')]+_0x14a447[_0x46c3('0x19')];var _0x46b69d;if(_0x1f86f9>=_0x21533a){_0x1f86f9=_0x21533a;_0x46b69d=0xc8;}else{_0x46b69d=0xce;}_0x4347be[_0x46c3('0x14')](_0x46b69d);return _0x4347be[_0x46c3('0x1b')](_0x46c3('0x1c'),_0x222747+'-'+_0x1f86f9+'/'+_0x21533a)[_0x46c3('0x16')](_0x339ee9);}return null;};}function patchUpdates(_0x13932a){return function(_0x1968f9){try{jsonpatch[_0x46c3('0x1d')](_0x1968f9,_0x13932a,!![]);}catch(_0xdd00dd){return BPromise[_0x46c3('0x1e')](_0xdd00dd);}return _0x1968f9[_0x46c3('0x1f')]();};}function saveUpdates(_0x37d982,_0x1a2250){return function(_0xde25d4){if(_0xde25d4){return _0xde25d4[_0x46c3('0x20')](_0x37d982)['then'](function(_0x2af16d){return _0x2af16d;});}return null;};}function removeEntity(_0x51233f,_0x3445e2){return function(_0x294e48){if(_0x294e48){return _0x294e48[_0x46c3('0x21')]()[_0x46c3('0x22')](function(){_0x51233f[_0x46c3('0x14')](0xcc)[_0x46c3('0x15')]();});}};}function handleEntityNotFound(_0xda4081,_0x1a3b44){return function(_0x23cf8c){if(!_0x23cf8c){_0xda4081[_0x46c3('0x23')](0x194);}return _0x23cf8c;};}function handleError(_0xbb60d0,_0xc56780){_0xc56780=_0xc56780||0x1f4;return function(_0x2b5fb5){logger[_0x46c3('0x24')](_0x2b5fb5[_0x46c3('0x25')]);if(_0x2b5fb5[_0x46c3('0x26')]){delete _0x2b5fb5[_0x46c3('0x26')];}_0xbb60d0[_0x46c3('0x14')](_0xc56780)[_0x46c3('0x27')](_0x2b5fb5);};}exports[_0x46c3('0x28')]=function(_0x575764,_0x5f4518){var _0x1cfefd={},_0x3281e0={},_0x4818e9={'count':0x0,'rows':[]};var _0x4e9aec=_[_0x46c3('0x29')](db[_0x46c3('0x2a')][_0x46c3('0x2b')],function(_0x117b5a){return{'name':_0x117b5a[_0x46c3('0x2c')],'type':_0x117b5a[_0x46c3('0x2d')][_0x46c3('0x2e')]};});_0x3281e0[_0x46c3('0x2f')]=_[_0x46c3('0x29')](_0x4e9aec,'name');_0x3281e0[_0x46c3('0x30')]=_[_0x46c3('0x31')](_0x575764[_0x46c3('0x30')]);_0x3281e0[_0x46c3('0x32')]=_[_0x46c3('0x33')](_0x3281e0[_0x46c3('0x2f')],_0x3281e0[_0x46c3('0x30')]);_0x1cfefd[_0x46c3('0x34')]=_[_0x46c3('0x33')](_0x3281e0['model'],qs['fields'](_0x575764['query']['fields']));_0x1cfefd[_0x46c3('0x34')]=_0x1cfefd[_0x46c3('0x34')][_0x46c3('0x35')]?_0x1cfefd[_0x46c3('0x34')]:_0x3281e0[_0x46c3('0x2f')];if(!_0x575764[_0x46c3('0x30')][_0x46c3('0x36')](_0x46c3('0x37'))){_0x1cfefd['limit']=qs[_0x46c3('0x19')](_0x575764[_0x46c3('0x30')][_0x46c3('0x19')]);_0x1cfefd[_0x46c3('0x17')]=qs[_0x46c3('0x17')](_0x575764['query'][_0x46c3('0x17')]);}_0x1cfefd['order']=qs[_0x46c3('0x38')](_0x575764[_0x46c3('0x30')]['sort']);_0x1cfefd[_0x46c3('0x39')]=qs[_0x46c3('0x32')](_[_0x46c3('0x3a')](_0x575764['query'],_0x3281e0[_0x46c3('0x32')]),_0x4e9aec);if(_0x575764[_0x46c3('0x30')][_0x46c3('0x3b')]){_0x1cfefd[_0x46c3('0x39')]=_[_0x46c3('0x3c')](_0x1cfefd[_0x46c3('0x39')],{'$or':_[_0x46c3('0x29')](_0x4e9aec,function(_0x1b4207){if(_0x1b4207[_0x46c3('0x2d')]!==_0x46c3('0x3d')){var _0x22b412={};_0x22b412[_0x1b4207[_0x46c3('0x26')]]={'$like':'%'+_0x575764[_0x46c3('0x30')][_0x46c3('0x3b')]+'%'};return _0x22b412;}})});}_0x1cfefd=_[_0x46c3('0x3c')]({},_0x1cfefd,_0x575764[_0x46c3('0x3e')]);var _0x345398={'where':_0x1cfefd[_0x46c3('0x39')]};return db[_0x46c3('0x2a')][_0x46c3('0x1a')](_0x345398)[_0x46c3('0x22')](function(_0x1e687e){_0x4818e9['count']=_0x1e687e;if(_0x575764[_0x46c3('0x30')][_0x46c3('0x3f')]){_0x1cfefd[_0x46c3('0x40')]=[{'all':!![]}];}return db[_0x46c3('0x2a')][_0x46c3('0x41')](_0x1cfefd);})[_0x46c3('0x22')](function(_0x130983){_0x4818e9['rows']=_0x130983;return _0x4818e9;})[_0x46c3('0x22')](respondWithFilteredResult(_0x5f4518,_0x1cfefd))['catch'](handleError(_0x5f4518,null));};exports['show']=function(_0x50cff2,_0x48ca53){var _0x4fe8fc={'raw':!![],'where':{'id':_0x50cff2['params']['id']}},_0x57bd95={};_0x57bd95['model']=_[_0x46c3('0x31')](db[_0x46c3('0x2a')][_0x46c3('0x2b')]);_0x57bd95['query']=_[_0x46c3('0x31')](_0x50cff2['query']);_0x57bd95[_0x46c3('0x32')]=_['intersection'](_0x57bd95[_0x46c3('0x2f')],_0x57bd95[_0x46c3('0x30')]);_0x4fe8fc[_0x46c3('0x34')]=_[_0x46c3('0x33')](_0x57bd95[_0x46c3('0x2f')],qs['fields'](_0x50cff2[_0x46c3('0x30')]['fields']));_0x4fe8fc[_0x46c3('0x34')]=_0x4fe8fc['attributes'][_0x46c3('0x35')]?_0x4fe8fc['attributes']:_0x57bd95[_0x46c3('0x2f')];if(_0x50cff2[_0x46c3('0x30')]['includeAll']){_0x4fe8fc['include']=[{'all':!![]}];}_0x4fe8fc=_[_0x46c3('0x3c')]({},_0x4fe8fc,_0x50cff2[_0x46c3('0x3e')]);return db[_0x46c3('0x2a')]['find'](_0x4fe8fc)[_0x46c3('0x22')](handleEntityNotFound(_0x48ca53,null))['then'](respondWithResult(_0x48ca53,null))[_0x46c3('0x42')](handleError(_0x48ca53,null));};exports[_0x46c3('0x43')]=function(_0x4c8eef,_0x47e27a){return db[_0x46c3('0x2a')][_0x46c3('0x43')](_0x4c8eef['body'],{})[_0x46c3('0x22')](respondWithResult(_0x47e27a,0xc9))[_0x46c3('0x42')](handleError(_0x47e27a,null));};exports[_0x46c3('0x20')]=function(_0x19f34b,_0x474c53){if(_0x19f34b[_0x46c3('0x44')]['id']){delete _0x19f34b[_0x46c3('0x44')]['id'];}return db[_0x46c3('0x2a')][_0x46c3('0x45')]({'where':{'id':_0x19f34b[_0x46c3('0x46')]['id']}})[_0x46c3('0x22')](handleEntityNotFound(_0x474c53,null))[_0x46c3('0x22')](saveUpdates(_0x19f34b[_0x46c3('0x44')],null))[_0x46c3('0x22')](respondWithResult(_0x474c53,null))[_0x46c3('0x42')](handleError(_0x474c53,null));};exports[_0x46c3('0x21')]=function(_0x101b74,_0x19dc54){return db[_0x46c3('0x2a')][_0x46c3('0x45')]({'where':{'id':_0x101b74[_0x46c3('0x46')]['id']}})[_0x46c3('0x22')](handleEntityNotFound(_0x19dc54,null))[_0x46c3('0x22')](removeEntity(_0x19dc54,null))['catch'](handleError(_0x19dc54,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2dc2a4b..b92d54b 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 _0xa988=['int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa988,0x1a7));var _0x8a98=function(_0x3a8b60,_0x2d341b){_0x3a8b60=_0x3a8b60-0x0;var _0x53c617=_0xa988[_0x3a8b60];return _0x53c617;};'use strict';var _=require(_0x8a98('0x0'));var util=require(_0x8a98('0x1'));var logger=require(_0x8a98('0x2'))(_0x8a98('0x3'));var moment=require(_0x8a98('0x4'));var BPromise=require('bluebird');var rp=require(_0x8a98('0x5'));var fs=require('fs');var path=require(_0x8a98('0x6'));var rimraf=require(_0x8a98('0x7'));var config=require(_0x8a98('0x8'));var attributes=require(_0x8a98('0x9'));module[_0x8a98('0xa')]=function(_0x3eb5cf,_0x3fcd06){return _0x3eb5cf['define'](_0x8a98('0xb'),attributes,{'tableName':_0x8a98('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8a98('0xd'),_0x8a98('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc74c=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xc74c,0x163));var _0xcc74=function(_0xecb6a7,_0x47f68f){_0xecb6a7=_0xecb6a7-0x0;var _0x1db1e4=_0xc74c[_0xecb6a7];return _0x1db1e4;};'use strict';var _=require(_0xcc74('0x0'));var util=require(_0xcc74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcc74('0x2'));var BPromise=require(_0xcc74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc74('0x4'));var rimraf=require(_0xcc74('0x5'));var config=require(_0xcc74('0x6'));var attributes=require(_0xcc74('0x7'));module[_0xcc74('0x8')]=function(_0x23c249,_0x425b73){return _0x23c249['define'](_0xcc74('0x9'),attributes,{'tableName':_0xcc74('0xa'),'paranoid':![],'indexes':[{'name':_0xcc74('0xb'),'fields':[_0xcc74('0xc'),_0xcc74('0xd')],'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 4934809..40f5a58 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 _0x7a54=['info','FreshsalesField,\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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x55c538,_0x24b75b){_0x55c538=_0x55c538-0x0;var _0x122da6=_0x7a54[_0x55c538];return _0x122da6;};'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')]('FreshsalesField,\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 _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x814b,0x1a2));var _0xb814=function(_0xe501ff,_0x955b7e){_0xe501ff=_0xe501ff-0x0;var _0x17135d=_0x814b[_0xe501ff];return _0x17135d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 16d7a8a..0306b26 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5e88a4,_0x1a80ad){var _0x1a5d6f=function(_0xe898f){while(--_0xe898f){_0x5e88a4['push'](_0x5e88a4['shift']());}};_0x1a5d6f(++_0x1a80ad);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +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(_0x59d17f,_0x1a3e87){var _0x24973b=function(_0x3cb4c7){while(--_0x3cb4c7){_0x59d17f['push'](_0x59d17f['shift']());}};_0x24973b(++_0x1a3e87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index fa67d4b..7bda8d8 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 _0xd01d=['exports','STRING','username','ENUM','integrationTab'];(function(_0x161514,_0xf203c1){var _0x230fc0=function(_0x11fe61){while(--_0x11fe61){_0x161514['push'](_0x161514['shift']());}};_0x230fc0(++_0xf203c1);}(_0xd01d,0xbe));var _0xdd01=function(_0x9e5921,_0x3adeb5){_0x9e5921=_0x9e5921-0x0;var _0x5b7cd6=_0xd01d[_0x9e5921];return _0x5b7cd6;};'use strict';var Sequelize=require('sequelize');module[_0xdd01('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdd01('0x1')]},'username':{'type':Sequelize[_0xdd01('0x1')],'unique':_0xdd01('0x2')},'remoteUri':{'type':Sequelize[_0xdd01('0x1')]},'password':{'type':Sequelize[_0xdd01('0x1')]},'clientId':{'type':Sequelize[_0xdd01('0x1')]},'clientSecret':{'type':Sequelize[_0xdd01('0x1')]},'securityToken':{'type':Sequelize[_0xdd01('0x1')]},'serverUrl':{'type':Sequelize[_0xdd01('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdd01('0x3')]('integrationTab','newTab'),'defaultValue':_0xdd01('0x4')}}; \ No newline at end of file +var _0xd798=['ENUM','integrationTab','newTab','STRING'];(function(_0x590fc8,_0x31fe0b){var _0x59f1ba=function(_0x3415fd){while(--_0x3415fd){_0x590fc8['push'](_0x590fc8['shift']());}};_0x59f1ba(++_0x31fe0b);}(_0xd798,0x77));var _0x8d79=function(_0x31d230,_0x7a1294){_0x31d230=_0x31d230-0x0;var _0x34d8a8=_0xd798[_0x31d230];return _0x34d8a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8d79('0x0')]},'username':{'type':Sequelize[_0x8d79('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8d79('0x0')]},'clientId':{'type':Sequelize[_0x8d79('0x0')]},'clientSecret':{'type':Sequelize[_0x8d79('0x0')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8d79('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x8d79('0x1')](_0x8d79('0x2'),_0x8d79('0x3')),'defaultValue':_0x8d79('0x2')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 79f6843..d5fd490 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 _0x67e4=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','create','body','params','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','lastIndexOf','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','string','int','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','False','false','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x67e4,0x161));var _0x467e=function(_0x2fd69d,_0xeb1037){_0x2fd69d=_0x2fd69d-0x0;var _0x5d5ef3=_0x67e4[_0x2fd69d];return _0x5d5ef3;};'use strict';var emlformat=require(_0x467e('0x0'));var rimraf=require(_0x467e('0x1'));var zipdir=require(_0x467e('0x2'));var jsonpatch=require(_0x467e('0x3'));var rp=require(_0x467e('0x4'));var moment=require(_0x467e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x467e('0x6'));var sox=require('sox');var csv=require(_0x467e('0x7'));var ejs=require(_0x467e('0x8'));var fs=require('fs');var fs_extra=require(_0x467e('0x9'));var _=require(_0x467e('0xa'));var squel=require(_0x467e('0xb'));var crypto=require('crypto');var jsforce=require(_0x467e('0xc'));var deskjs=require(_0x467e('0xd'));var toCsv=require(_0x467e('0x7'));var querystring=require('querystring');var Papa=require(_0x467e('0xe'));var Redis=require(_0x467e('0xf'));var authService=require(_0x467e('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x467e('0x11'));var logger=require(_0x467e('0x12'))(_0x467e('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x467e('0x14'));var db=require(_0x467e('0x15'))['db'];var integrations=require(_0x467e('0x16'));function respondWithStatusCode(_0x53473a,_0x2d6559){_0x2d6559=_0x2d6559||0xcc;return function(_0x4be769){if(_0x4be769){return _0x53473a[_0x467e('0x17')](_0x2d6559);}return _0x53473a[_0x467e('0x18')](_0x2d6559)[_0x467e('0x19')]();};}function respondWithResult(_0x53c1b0,_0x97ba1d){_0x97ba1d=_0x97ba1d||0xc8;return function(_0x1755b0){if(_0x1755b0){return _0x53c1b0[_0x467e('0x18')](_0x97ba1d)[_0x467e('0x1a')](_0x1755b0);}};}function respondWithFilteredResult(_0x13357f,_0x46d6c5){return function(_0x58c5e6){if(_0x58c5e6){var _0xf662c6=typeof _0x46d6c5[_0x467e('0x1b')]===_0x467e('0x1c')&&typeof _0x46d6c5[_0x467e('0x1d')]===_0x467e('0x1c');var _0x14b998=_0x58c5e6['count'];var _0x387888=_0xf662c6?0x0:_0x46d6c5['offset'];var _0x59e580=_0xf662c6?_0x58c5e6[_0x467e('0x1e')]:_0x46d6c5[_0x467e('0x1b')]+_0x46d6c5[_0x467e('0x1d')];var _0x1886e6;if(_0x59e580>=_0x14b998){_0x59e580=_0x14b998;_0x1886e6=0xc8;}else{_0x1886e6=0xce;}_0x13357f[_0x467e('0x18')](_0x1886e6);return _0x13357f[_0x467e('0x1f')]('Content-Range',_0x387888+'-'+_0x59e580+'/'+_0x14b998)[_0x467e('0x1a')](_0x58c5e6);}return null;};}function patchUpdates(_0x2e470a){return function(_0x44b225){try{jsonpatch['apply'](_0x44b225,_0x2e470a,!![]);}catch(_0x3b031b){return BPromise['reject'](_0x3b031b);}return _0x44b225['save']();};}function saveUpdates(_0x42df5e,_0x48fd44){return function(_0x2b0bbf){if(_0x2b0bbf){return _0x2b0bbf[_0x467e('0x20')](_0x42df5e)[_0x467e('0x21')](function(_0x537e63){return _0x537e63;});}return null;};}function removeEntity(_0x3ba9de,_0x3e2d68){return function(_0x3a4667){if(_0x3a4667){return _0x3a4667[_0x467e('0x22')]()[_0x467e('0x21')](function(){_0x3ba9de[_0x467e('0x18')](0xcc)[_0x467e('0x19')]();});}};}function handleEntityNotFound(_0x5ed6cf,_0x4ac06a){return function(_0x1349e3){if(!_0x1349e3){_0x5ed6cf[_0x467e('0x17')](0x194);}return _0x1349e3;};}function handleError(_0x2fe2ee,_0x438df7){_0x438df7=_0x438df7||0x1f4;return function(_0x3bb93){logger[_0x467e('0x23')](_0x3bb93[_0x467e('0x24')]);if(_0x3bb93[_0x467e('0x25')]){delete _0x3bb93[_0x467e('0x25')];}_0x2fe2ee['status'](_0x438df7)[_0x467e('0x26')](_0x3bb93);};}exports[_0x467e('0x27')]=function(_0x1247a4,_0x49e6ec){var _0x1f6378={},_0x231190={},_0x2ae71d={'count':0x0,'rows':[]};var _0x490638=_['map'](db[_0x467e('0x28')][_0x467e('0x29')],function(_0x44611a){return{'name':_0x44611a[_0x467e('0x2a')],'type':_0x44611a['type']['key']};});_0x231190['model']=_[_0x467e('0x2b')](_0x490638,_0x467e('0x25'));_0x231190[_0x467e('0x2c')]=_[_0x467e('0x2d')](_0x1247a4[_0x467e('0x2c')]);_0x231190['filters']=_['intersection'](_0x231190[_0x467e('0x2e')],_0x231190[_0x467e('0x2c')]);_0x1f6378[_0x467e('0x2f')]=_[_0x467e('0x30')](_0x231190[_0x467e('0x2e')],qs[_0x467e('0x31')](_0x1247a4['query'][_0x467e('0x31')]));_0x1f6378[_0x467e('0x2f')]=_0x1f6378[_0x467e('0x2f')][_0x467e('0x32')]?_0x1f6378['attributes']:_0x231190[_0x467e('0x2e')];if(!_0x1247a4[_0x467e('0x2c')][_0x467e('0x33')](_0x467e('0x34'))){_0x1f6378[_0x467e('0x1d')]=qs['limit'](_0x1247a4[_0x467e('0x2c')]['limit']);_0x1f6378['offset']=qs['offset'](_0x1247a4[_0x467e('0x2c')][_0x467e('0x1b')]);}_0x1f6378[_0x467e('0x35')]=qs[_0x467e('0x36')](_0x1247a4[_0x467e('0x2c')]['sort']);_0x1f6378[_0x467e('0x37')]=qs['filters'](_[_0x467e('0x38')](_0x1247a4[_0x467e('0x2c')],_0x231190[_0x467e('0x39')]),_0x490638);if(_0x1247a4[_0x467e('0x2c')]['filter']){_0x1f6378['where']=_[_0x467e('0x3a')](_0x1f6378[_0x467e('0x37')],{'$or':_[_0x467e('0x2b')](_0x490638,function(_0x1754b0){if(_0x1754b0[_0x467e('0x3b')]!=='VIRTUAL'){var _0x27b4f4={};_0x27b4f4[_0x1754b0[_0x467e('0x25')]]={'$like':'%'+_0x1247a4[_0x467e('0x2c')][_0x467e('0x3c')]+'%'};return _0x27b4f4;}})});}_0x1f6378=_[_0x467e('0x3a')]({},_0x1f6378,_0x1247a4[_0x467e('0x3d')]);var _0xaa8cd={'where':_0x1f6378[_0x467e('0x37')]};return db[_0x467e('0x28')][_0x467e('0x1e')](_0xaa8cd)[_0x467e('0x21')](function(_0x59fe9d){_0x2ae71d[_0x467e('0x1e')]=_0x59fe9d;if(_0x1247a4[_0x467e('0x2c')][_0x467e('0x3e')]){_0x1f6378[_0x467e('0x3f')]=[{'all':!![]}];}return db[_0x467e('0x28')][_0x467e('0x40')](_0x1f6378);})[_0x467e('0x21')](function(_0x2c338f){_0x2ae71d[_0x467e('0x41')]=_0x2c338f;return _0x2ae71d;})[_0x467e('0x21')](respondWithFilteredResult(_0x49e6ec,_0x1f6378))[_0x467e('0x42')](handleError(_0x49e6ec,null));};exports[_0x467e('0x43')]=function(_0x2c90e,_0x47fc1b){var _0x2f1a5d={'raw':![],'where':{'id':_0x2c90e['params']['id']}},_0x301b43={};_0x301b43[_0x467e('0x2e')]=_[_0x467e('0x2d')](db[_0x467e('0x28')][_0x467e('0x29')]);_0x301b43[_0x467e('0x2c')]=_[_0x467e('0x2d')](_0x2c90e[_0x467e('0x2c')]);_0x301b43['filters']=_[_0x467e('0x30')](_0x301b43[_0x467e('0x2e')],_0x301b43['query']);_0x2f1a5d[_0x467e('0x2f')]=_[_0x467e('0x30')](_0x301b43[_0x467e('0x2e')],qs[_0x467e('0x31')](_0x2c90e[_0x467e('0x2c')]['fields']));_0x2f1a5d[_0x467e('0x2f')]=_0x2f1a5d[_0x467e('0x2f')]['length']?_0x2f1a5d[_0x467e('0x2f')]:_0x301b43[_0x467e('0x2e')];if(_0x2c90e[_0x467e('0x2c')][_0x467e('0x3e')]){_0x2f1a5d[_0x467e('0x3f')]=[{'all':!![]}];}_0x2f1a5d=_[_0x467e('0x3a')]({},_0x2f1a5d,_0x2c90e['options']);return db[_0x467e('0x28')]['find'](_0x2f1a5d)[_0x467e('0x21')](handleEntityNotFound(_0x47fc1b,null))['then'](respondWithResult(_0x47fc1b,null))[_0x467e('0x42')](handleError(_0x47fc1b,null));};exports[_0x467e('0x44')]=function(_0x228478,_0x3f29f5){return db[_0x467e('0x28')]['create'](_0x228478[_0x467e('0x45')],{})['then'](respondWithResult(_0x3f29f5,0xc9))[_0x467e('0x42')](handleError(_0x3f29f5,null));};exports['update']=function(_0x2ac1ba,_0x23b445){if(_0x2ac1ba['body']['id']){delete _0x2ac1ba[_0x467e('0x45')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x2ac1ba[_0x467e('0x46')]['id']}})[_0x467e('0x21')](handleEntityNotFound(_0x23b445,null))[_0x467e('0x21')](saveUpdates(_0x2ac1ba[_0x467e('0x45')],null))[_0x467e('0x21')](respondWithResult(_0x23b445,null))[_0x467e('0x42')](handleError(_0x23b445,null));};exports[_0x467e('0x22')]=function(_0x2317fd,_0x234aaf){return db['SalesforceAccount'][_0x467e('0x47')]({'where':{'id':_0x2317fd[_0x467e('0x46')]['id']}})[_0x467e('0x21')](handleEntityNotFound(_0x234aaf,null))[_0x467e('0x21')](removeEntity(_0x234aaf,null))[_0x467e('0x42')](handleError(_0x234aaf,null));};exports[_0x467e('0x48')]=function(_0x42369f,_0x14af9b,_0x4f0b53){var _0x19c7e8={};var _0x29c52f={};var _0x2fd37f;var _0xebc482;return db[_0x467e('0x28')][_0x467e('0x49')]({'where':{'id':_0x42369f['params']['id']}})[_0x467e('0x21')](handleEntityNotFound(_0x14af9b,null))[_0x467e('0x21')](function(_0x44d34e){if(_0x44d34e){_0x2fd37f=_0x44d34e;_0x29c52f[_0x467e('0x2e')]=_[_0x467e('0x2d')](db[_0x467e('0x4a')][_0x467e('0x29')]);_0x29c52f[_0x467e('0x2c')]=_['keys'](_0x42369f[_0x467e('0x2c')]);_0x29c52f[_0x467e('0x39')]=_[_0x467e('0x30')](_0x29c52f[_0x467e('0x2e')],_0x29c52f[_0x467e('0x2c')]);_0x19c7e8[_0x467e('0x2f')]=_[_0x467e('0x30')](_0x29c52f['model'],qs[_0x467e('0x31')](_0x42369f[_0x467e('0x2c')][_0x467e('0x31')]));_0x19c7e8['attributes']=_0x19c7e8[_0x467e('0x2f')][_0x467e('0x32')]?_0x19c7e8['attributes']:_0x29c52f[_0x467e('0x2e')];_0x19c7e8['order']=qs[_0x467e('0x36')](_0x42369f[_0x467e('0x2c')][_0x467e('0x36')]);_0x19c7e8['where']=qs['filters'](_[_0x467e('0x38')](_0x42369f[_0x467e('0x2c')],_0x29c52f['filters']));if(_0x42369f[_0x467e('0x2c')][_0x467e('0x3c')]){_0x19c7e8[_0x467e('0x37')]=_[_0x467e('0x3a')](_0x19c7e8[_0x467e('0x37')],{'$or':_['map'](_0x19c7e8[_0x467e('0x2f')],function(_0x4629a5){var _0x48c4b2={};_0x48c4b2[_0x4629a5]={'$like':'%'+_0x42369f[_0x467e('0x2c')][_0x467e('0x3c')]+'%'};return _0x48c4b2;})});}_0x19c7e8=_[_0x467e('0x3a')]({},_0x19c7e8,_0x42369f[_0x467e('0x3d')]);return _0x2fd37f[_0x467e('0x48')](_0x19c7e8);}})['then'](function(_0x26e452){if(_0x26e452){_0xebc482=_0x26e452[_0x467e('0x32')];if(!_0x42369f['query'][_0x467e('0x33')](_0x467e('0x34'))){_0x19c7e8['limit']=qs['limit'](_0x42369f['query']['limit']);_0x19c7e8[_0x467e('0x1b')]=qs['offset'](_0x42369f['query'][_0x467e('0x1b')]);}return _0x2fd37f[_0x467e('0x48')](_0x19c7e8);}})[_0x467e('0x21')](function(_0x59b900){if(_0x59b900){return _0x59b900?{'count':_0xebc482,'rows':_0x59b900}:null;}})['then'](respondWithResult(_0x14af9b,null))[_0x467e('0x42')](handleError(_0x14af9b,null));};exports[_0x467e('0x4b')]=function(_0x225c39,_0x4935ee,_0x402c06){if(_0x225c39['body']['id']){delete _0x225c39[_0x467e('0x45')]['id'];}return db[_0x467e('0x28')][_0x467e('0x49')]({'where':{'id':_0x225c39[_0x467e('0x46')]['id']}})[_0x467e('0x21')](handleEntityNotFound(_0x4935ee,null))[_0x467e('0x21')](function(_0xfd4a2b){if(_0xfd4a2b){_0x225c39[_0x467e('0x45')][_0x467e('0x4c')]=_0xfd4a2b['id'];_0x225c39['body'][_0x467e('0x4d')]=integrations[_0x467e('0x4e')](_0x225c39[_0x467e('0x45')]['channel'],_0x225c39[_0x467e('0x45')][_0x467e('0x3b')]);_0x225c39['body'][_0x467e('0x4f')]=integrations[_0x467e('0x50')](_0x225c39[_0x467e('0x45')][_0x467e('0x51')],_0x225c39[_0x467e('0x45')]['type']);return db[_0x467e('0x4a')]['create'](_0x225c39[_0x467e('0x45')],{'include':[{'model':db[_0x467e('0x52')],'as':_0x467e('0x4d')},{'model':db['SalesforceField'],'as':_0x467e('0x4f')}]});}return null;})[_0x467e('0x21')](respondWithResult(_0x4935ee,null))[_0x467e('0x42')](handleError(_0x4935ee,null));};exports[_0x467e('0x53')]=function(_0x560c97,_0x2f9dac,_0x30877a){var _0x1e1fe2;var _0x3b2b0d='';var _0x5dc417=_0x467e('0x54');return db['SalesforceAccount']['findOne']({'where':{'id':_0x560c97[_0x467e('0x46')]['id']},'attributes':['id',_0x467e('0x55'),_0x467e('0x56'),_0x467e('0x57'),'username',_0x467e('0x58'),_0x467e('0x59')]})[_0x467e('0x21')](handleEntityNotFound(_0x2f9dac,null))['then'](function(_0x1d65b5){if(_0x1d65b5){_0x3b2b0d=_0x1d65b5[_0x467e('0x55')];var _0x51ec9f=_0x3b2b0d['slice'](-0x1);if(_0x51ec9f==='/'){_0x3b2b0d=_0x3b2b0d['substring'](0x0,_0x3b2b0d[_0x467e('0x5a')](_0x51ec9f));}_0x1e1fe2=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3b2b0d,'clientId':_0x1d65b5[_0x467e('0x56')],'clientSecret':_0x1d65b5[_0x467e('0x57')]}});return _0x1e1fe2[_0x467e('0x5b')](_0x1d65b5[_0x467e('0x5c')],_0x1d65b5[_0x467e('0x58')][_0x467e('0x5d')](_0x1d65b5[_0x467e('0x59')]));}})[_0x467e('0x21')](function(_0x4599e2){if(_0x4599e2){if(!_[_0x467e('0x5e')](_0x560c97['query'][_0x467e('0x5f')])){_0x5dc417=_0x560c97[_0x467e('0x2c')]['ticketType'];}return _0x1e1fe2[_0x467e('0x60')](_0x5dc417)[_0x467e('0x61')]();}})[_0x467e('0x21')](function(_0x2530b2){var _0xfba4e3=[_0x467e('0x62'),'ActivityDate','IsReminderSet',_0x467e('0x63'),_0x467e('0x64'),'Description'];var _0x31fd4a=[_0x467e('0x65'),_0x467e('0x66'),'picklist',_0x467e('0x67'),_0x467e('0x68'),_0x467e('0x69'),_0x467e('0x6a')];if(_0x2530b2){_[_0x467e('0x6b')](_0x2530b2['fields'],function(_0x463085){return _0xfba4e3[_0x467e('0x6c')](_0x463085[_0x467e('0x25')])||!_0x31fd4a[_0x467e('0x6c')](_0x463085[_0x467e('0x3b')]);});return{'count':_0x2530b2[_0x467e('0x31')]['length'],'rows':_[_0x467e('0x2b')](_0x2530b2[_0x467e('0x31')],function(_0x2078c5){return{'id':_0x2078c5[_0x467e('0x25')],'name':_0x2078c5[_0x467e('0x6d')],'custom':_0x2078c5[_0x467e('0x6e')],'options':_0x2078c5[_0x467e('0x6f')][_0x467e('0x32')]>0x0?_[_0x467e('0x2b')](_0x2078c5[_0x467e('0x6f')],function(_0x3be0f2){return{'name':_0x3be0f2['label'],'value':_0x3be0f2[_0x467e('0x70')]};}):_0x2078c5[_0x467e('0x3b')]==_0x467e('0x67')?[{'name':_0x467e('0x71'),'value':'true'},{'name':_0x467e('0x72'),'value':_0x467e('0x73')}]:[]};})};}})[_0x467e('0x21')](respondWithResult(_0x2f9dac,null))[_0x467e('0x42')](function(_0x55dfbb){var _0x42b474=_0x560c97[_0x467e('0x2c')][_0x467e('0x74')]?0x1f4:_0x55dfbb[_0x467e('0x75')]||0x1f4;logger[_0x467e('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x467e('0x53'),_0x42b474,JSON[_0x467e('0x76')](_0x55dfbb));delete _0x55dfbb['name'];if(_0x42b474===0x191){_0x42b474=0x190;}_0x2f9dac[_0x467e('0x18')](_0x42b474)[_0x467e('0x26')](_0x560c97['query'][_0x467e('0x74')]?{'message':_0x467e('0x77'),'statusCode':_0x55dfbb[_0x467e('0x75')]}:_0x55dfbb);});}; \ No newline at end of file +var _0x54fb=['channel','Descriptions','getDescriptions','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','boolean','email','textarea','remove','includes','label','custom','picklistValues','true','false','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','query','model','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','rows','catch','show','params','find','create','body','update','findOne','SalesforceConfiguration','order','pick','hasOwnProperty','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0x54fb,0x11f));var _0xb54f=function(_0x4ba961,_0x306042){_0x4ba961=_0x4ba961-0x0;var _0x47436b=_0x54fb[_0x4ba961];return _0x47436b;};'use strict';var emlformat=require(_0xb54f('0x0'));var rimraf=require(_0xb54f('0x1'));var zipdir=require(_0xb54f('0x2'));var jsonpatch=require(_0xb54f('0x3'));var rp=require(_0xb54f('0x4'));var moment=require('moment');var BPromise=require(_0xb54f('0x5'));var Mustache=require(_0xb54f('0x6'));var util=require(_0xb54f('0x7'));var path=require(_0xb54f('0x8'));var sox=require(_0xb54f('0x9'));var csv=require(_0xb54f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb54f('0xb'));var _=require(_0xb54f('0xc'));var squel=require(_0xb54f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb54f('0xe'));var toCsv=require(_0xb54f('0xa'));var querystring=require('querystring');var Papa=require(_0xb54f('0xf'));var Redis=require(_0xb54f('0x10'));var authService=require(_0xb54f('0x11'));var qs=require(_0xb54f('0x12'));var as=require(_0xb54f('0x13'));var hardwareService=require(_0xb54f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xb54f('0x15'));var config=require(_0xb54f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb54f('0x17'))['db'];var integrations=require(_0xb54f('0x18'));function respondWithStatusCode(_0x48bef2,_0x26513b){_0x26513b=_0x26513b||0xcc;return function(_0x936ab0){if(_0x936ab0){return _0x48bef2['sendStatus'](_0x26513b);}return _0x48bef2[_0xb54f('0x19')](_0x26513b)[_0xb54f('0x1a')]();};}function respondWithResult(_0x59dcef,_0x121348){_0x121348=_0x121348||0xc8;return function(_0x117df4){if(_0x117df4){return _0x59dcef[_0xb54f('0x19')](_0x121348)[_0xb54f('0x1b')](_0x117df4);}};}function respondWithFilteredResult(_0x120abf,_0x425f17){return function(_0x11006e){if(_0x11006e){var _0x149667=typeof _0x425f17[_0xb54f('0x1c')]==='undefined'&&typeof _0x425f17[_0xb54f('0x1d')]===_0xb54f('0x1e');var _0x48254f=_0x11006e['count'];var _0xb82c43=_0x149667?0x0:_0x425f17[_0xb54f('0x1c')];var _0x42d8a0=_0x149667?_0x11006e[_0xb54f('0x1f')]:_0x425f17[_0xb54f('0x1c')]+_0x425f17[_0xb54f('0x1d')];var _0x2b534f;if(_0x42d8a0>=_0x48254f){_0x42d8a0=_0x48254f;_0x2b534f=0xc8;}else{_0x2b534f=0xce;}_0x120abf[_0xb54f('0x19')](_0x2b534f);return _0x120abf['set'](_0xb54f('0x20'),_0xb82c43+'-'+_0x42d8a0+'/'+_0x48254f)[_0xb54f('0x1b')](_0x11006e);}return null;};}function patchUpdates(_0x560dce){return function(_0x1969fb){try{jsonpatch['apply'](_0x1969fb,_0x560dce,!![]);}catch(_0x85f2c9){return BPromise[_0xb54f('0x21')](_0x85f2c9);}return _0x1969fb[_0xb54f('0x22')]();};}function saveUpdates(_0x114984,_0x29aceb){return function(_0x26f5b0){if(_0x26f5b0){return _0x26f5b0['update'](_0x114984)[_0xb54f('0x23')](function(_0x129469){return _0x129469;});}return null;};}function removeEntity(_0x39b6b3,_0x33aea5){return function(_0x4384d7){if(_0x4384d7){return _0x4384d7[_0xb54f('0x24')]()[_0xb54f('0x23')](function(){_0x39b6b3['status'](0xcc)[_0xb54f('0x1a')]();});}};}function handleEntityNotFound(_0x2f4455,_0x4d294c){return function(_0x276c16){if(!_0x276c16){_0x2f4455['sendStatus'](0x194);}return _0x276c16;};}function handleError(_0x3522db,_0x3eaa78){_0x3eaa78=_0x3eaa78||0x1f4;return function(_0x3a192d){logger[_0xb54f('0x25')](_0x3a192d['stack']);if(_0x3a192d[_0xb54f('0x26')]){delete _0x3a192d['name'];}_0x3522db[_0xb54f('0x19')](_0x3eaa78)[_0xb54f('0x27')](_0x3a192d);};}exports[_0xb54f('0x28')]=function(_0x54135a,_0x363f39){var _0x382742={},_0x4d04ba={},_0x4bfcee={'count':0x0,'rows':[]};var _0x19e625=_[_0xb54f('0x29')](db['SalesforceAccount'][_0xb54f('0x2a')],function(_0x1f09a9){return{'name':_0x1f09a9[_0xb54f('0x2b')],'type':_0x1f09a9[_0xb54f('0x2c')][_0xb54f('0x2d')]};});_0x4d04ba['model']=_[_0xb54f('0x29')](_0x19e625,'name');_0x4d04ba['query']=_[_0xb54f('0x2e')](_0x54135a['query']);_0x4d04ba[_0xb54f('0x2f')]=_[_0xb54f('0x30')](_0x4d04ba['model'],_0x4d04ba[_0xb54f('0x31')]);_0x382742['attributes']=_[_0xb54f('0x30')](_0x4d04ba[_0xb54f('0x32')],qs[_0xb54f('0x33')](_0x54135a['query'][_0xb54f('0x33')]));_0x382742[_0xb54f('0x34')]=_0x382742[_0xb54f('0x34')][_0xb54f('0x35')]?_0x382742[_0xb54f('0x34')]:_0x4d04ba[_0xb54f('0x32')];if(!_0x54135a[_0xb54f('0x31')]['hasOwnProperty'](_0xb54f('0x36'))){_0x382742[_0xb54f('0x1d')]=qs[_0xb54f('0x1d')](_0x54135a[_0xb54f('0x31')][_0xb54f('0x1d')]);_0x382742[_0xb54f('0x1c')]=qs[_0xb54f('0x1c')](_0x54135a[_0xb54f('0x31')][_0xb54f('0x1c')]);}_0x382742['order']=qs[_0xb54f('0x37')](_0x54135a[_0xb54f('0x31')][_0xb54f('0x37')]);_0x382742[_0xb54f('0x38')]=qs[_0xb54f('0x2f')](_['pick'](_0x54135a[_0xb54f('0x31')],_0x4d04ba[_0xb54f('0x2f')]),_0x19e625);if(_0x54135a['query'][_0xb54f('0x39')]){_0x382742[_0xb54f('0x38')]=_[_0xb54f('0x3a')](_0x382742[_0xb54f('0x38')],{'$or':_[_0xb54f('0x29')](_0x19e625,function(_0x4f53be){if(_0x4f53be[_0xb54f('0x2c')]!==_0xb54f('0x3b')){var _0x4eadc9={};_0x4eadc9[_0x4f53be[_0xb54f('0x26')]]={'$like':'%'+_0x54135a[_0xb54f('0x31')][_0xb54f('0x39')]+'%'};return _0x4eadc9;}})});}_0x382742=_[_0xb54f('0x3a')]({},_0x382742,_0x54135a[_0xb54f('0x3c')]);var _0x1e6601={'where':_0x382742[_0xb54f('0x38')]};return db[_0xb54f('0x3d')]['count'](_0x1e6601)[_0xb54f('0x23')](function(_0x453d99){_0x4bfcee[_0xb54f('0x1f')]=_0x453d99;if(_0x54135a['query'][_0xb54f('0x3e')]){_0x382742[_0xb54f('0x3f')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x382742);})[_0xb54f('0x23')](function(_0x4a06d1){_0x4bfcee[_0xb54f('0x40')]=_0x4a06d1;return _0x4bfcee;})[_0xb54f('0x23')](respondWithFilteredResult(_0x363f39,_0x382742))[_0xb54f('0x41')](handleError(_0x363f39,null));};exports[_0xb54f('0x42')]=function(_0x404b8f,_0x149074){var _0x458294={'raw':![],'where':{'id':_0x404b8f[_0xb54f('0x43')]['id']}},_0x36a049={};_0x36a049['model']=_[_0xb54f('0x2e')](db[_0xb54f('0x3d')]['rawAttributes']);_0x36a049[_0xb54f('0x31')]=_[_0xb54f('0x2e')](_0x404b8f['query']);_0x36a049[_0xb54f('0x2f')]=_[_0xb54f('0x30')](_0x36a049[_0xb54f('0x32')],_0x36a049[_0xb54f('0x31')]);_0x458294['attributes']=_['intersection'](_0x36a049[_0xb54f('0x32')],qs[_0xb54f('0x33')](_0x404b8f[_0xb54f('0x31')]['fields']));_0x458294['attributes']=_0x458294['attributes']['length']?_0x458294['attributes']:_0x36a049['model'];if(_0x404b8f[_0xb54f('0x31')]['includeAll']){_0x458294['include']=[{'all':!![]}];}_0x458294=_[_0xb54f('0x3a')]({},_0x458294,_0x404b8f[_0xb54f('0x3c')]);return db[_0xb54f('0x3d')][_0xb54f('0x44')](_0x458294)['then'](handleEntityNotFound(_0x149074,null))[_0xb54f('0x23')](respondWithResult(_0x149074,null))[_0xb54f('0x41')](handleError(_0x149074,null));};exports[_0xb54f('0x45')]=function(_0x36225e,_0xd2ff35){return db[_0xb54f('0x3d')]['create'](_0x36225e[_0xb54f('0x46')],{})[_0xb54f('0x23')](respondWithResult(_0xd2ff35,0xc9))[_0xb54f('0x41')](handleError(_0xd2ff35,null));};exports[_0xb54f('0x47')]=function(_0x3d64c9,_0x5d622f){if(_0x3d64c9[_0xb54f('0x46')]['id']){delete _0x3d64c9[_0xb54f('0x46')]['id'];}return db[_0xb54f('0x3d')][_0xb54f('0x44')]({'where':{'id':_0x3d64c9['params']['id']}})[_0xb54f('0x23')](handleEntityNotFound(_0x5d622f,null))[_0xb54f('0x23')](saveUpdates(_0x3d64c9[_0xb54f('0x46')],null))['then'](respondWithResult(_0x5d622f,null))['catch'](handleError(_0x5d622f,null));};exports[_0xb54f('0x24')]=function(_0x3edefb,_0x546d33){return db['SalesforceAccount'][_0xb54f('0x44')]({'where':{'id':_0x3edefb[_0xb54f('0x43')]['id']}})[_0xb54f('0x23')](handleEntityNotFound(_0x546d33,null))['then'](removeEntity(_0x546d33,null))['catch'](handleError(_0x546d33,null));};exports['getConfigurations']=function(_0x37f30d,_0x252e7b,_0xf59782){var _0x196b8c={};var _0x48b95b={};var _0x1e1ecb;var _0xb1f8ad;return db[_0xb54f('0x3d')][_0xb54f('0x48')]({'where':{'id':_0x37f30d[_0xb54f('0x43')]['id']}})[_0xb54f('0x23')](handleEntityNotFound(_0x252e7b,null))['then'](function(_0x1c1359){if(_0x1c1359){_0x1e1ecb=_0x1c1359;_0x48b95b[_0xb54f('0x32')]=_[_0xb54f('0x2e')](db[_0xb54f('0x49')][_0xb54f('0x2a')]);_0x48b95b[_0xb54f('0x31')]=_[_0xb54f('0x2e')](_0x37f30d[_0xb54f('0x31')]);_0x48b95b[_0xb54f('0x2f')]=_['intersection'](_0x48b95b[_0xb54f('0x32')],_0x48b95b[_0xb54f('0x31')]);_0x196b8c[_0xb54f('0x34')]=_[_0xb54f('0x30')](_0x48b95b[_0xb54f('0x32')],qs['fields'](_0x37f30d[_0xb54f('0x31')][_0xb54f('0x33')]));_0x196b8c[_0xb54f('0x34')]=_0x196b8c[_0xb54f('0x34')][_0xb54f('0x35')]?_0x196b8c[_0xb54f('0x34')]:_0x48b95b[_0xb54f('0x32')];_0x196b8c[_0xb54f('0x4a')]=qs[_0xb54f('0x37')](_0x37f30d[_0xb54f('0x31')]['sort']);_0x196b8c['where']=qs[_0xb54f('0x2f')](_[_0xb54f('0x4b')](_0x37f30d[_0xb54f('0x31')],_0x48b95b[_0xb54f('0x2f')]));if(_0x37f30d[_0xb54f('0x31')][_0xb54f('0x39')]){_0x196b8c[_0xb54f('0x38')]=_[_0xb54f('0x3a')](_0x196b8c[_0xb54f('0x38')],{'$or':_[_0xb54f('0x29')](_0x196b8c[_0xb54f('0x34')],function(_0x214d1d){var _0x1279e1={};_0x1279e1[_0x214d1d]={'$like':'%'+_0x37f30d['query']['filter']+'%'};return _0x1279e1;})});}_0x196b8c=_[_0xb54f('0x3a')]({},_0x196b8c,_0x37f30d[_0xb54f('0x3c')]);return _0x1e1ecb['getConfigurations'](_0x196b8c);}})[_0xb54f('0x23')](function(_0x1baf6d){if(_0x1baf6d){_0xb1f8ad=_0x1baf6d[_0xb54f('0x35')];if(!_0x37f30d[_0xb54f('0x31')][_0xb54f('0x4c')](_0xb54f('0x36'))){_0x196b8c['limit']=qs['limit'](_0x37f30d['query'][_0xb54f('0x1d')]);_0x196b8c['offset']=qs[_0xb54f('0x1c')](_0x37f30d[_0xb54f('0x31')][_0xb54f('0x1c')]);}return _0x1e1ecb[_0xb54f('0x4d')](_0x196b8c);}})[_0xb54f('0x23')](function(_0x19e748){if(_0x19e748){return _0x19e748?{'count':_0xb1f8ad,'rows':_0x19e748}:null;}})['then'](respondWithResult(_0x252e7b,null))[_0xb54f('0x41')](handleError(_0x252e7b,null));};exports[_0xb54f('0x4e')]=function(_0x39d10c,_0x26a472,_0x5402e8){if(_0x39d10c[_0xb54f('0x46')]['id']){delete _0x39d10c['body']['id'];}return db[_0xb54f('0x3d')][_0xb54f('0x48')]({'where':{'id':_0x39d10c[_0xb54f('0x43')]['id']}})[_0xb54f('0x23')](handleEntityNotFound(_0x26a472,null))['then'](function(_0x18b5bc){if(_0x18b5bc){_0x39d10c[_0xb54f('0x46')][_0xb54f('0x4f')]=_0x18b5bc['id'];_0x39d10c['body'][_0xb54f('0x50')]=integrations[_0xb54f('0x51')](_0x39d10c[_0xb54f('0x46')][_0xb54f('0x52')],_0x39d10c[_0xb54f('0x46')][_0xb54f('0x2c')]);_0x39d10c['body'][_0xb54f('0x53')]=integrations[_0xb54f('0x54')](_0x39d10c[_0xb54f('0x46')][_0xb54f('0x52')],_0x39d10c['body'][_0xb54f('0x2c')]);return db[_0xb54f('0x49')][_0xb54f('0x45')](_0x39d10c[_0xb54f('0x46')],{'include':[{'model':db[_0xb54f('0x55')],'as':_0xb54f('0x50')},{'model':db[_0xb54f('0x55')],'as':_0xb54f('0x53')}]});}return null;})[_0xb54f('0x23')](respondWithResult(_0x26a472,null))['catch'](handleError(_0x26a472,null));};exports[_0xb54f('0x56')]=function(_0x4bc78c,_0xfa6a65,_0x44b74a){var _0x1e68f2;var _0x3b48f5='';var _0x100bbb='Task';return db[_0xb54f('0x3d')][_0xb54f('0x48')]({'where':{'id':_0x4bc78c[_0xb54f('0x43')]['id']},'attributes':['id',_0xb54f('0x57'),_0xb54f('0x58'),_0xb54f('0x59'),_0xb54f('0x5a'),_0xb54f('0x5b'),_0xb54f('0x5c')]})[_0xb54f('0x23')](handleEntityNotFound(_0xfa6a65,null))[_0xb54f('0x23')](function(_0x3db25f){if(_0x3db25f){_0x3b48f5=_0x3db25f[_0xb54f('0x57')];var _0x125b9b=_0x3b48f5[_0xb54f('0x5d')](-0x1);if(_0x125b9b==='/'){_0x3b48f5=_0x3b48f5[_0xb54f('0x5e')](0x0,_0x3b48f5[_0xb54f('0x5f')](_0x125b9b));}_0x1e68f2=new jsforce[(_0xb54f('0x60'))]({'oauth2':{'loginUrl':_0x3b48f5,'clientId':_0x3db25f[_0xb54f('0x58')],'clientSecret':_0x3db25f[_0xb54f('0x59')]}});return _0x1e68f2[_0xb54f('0x61')](_0x3db25f['username'],_0x3db25f['password'][_0xb54f('0x62')](_0x3db25f[_0xb54f('0x5c')]));}})[_0xb54f('0x23')](function(_0x2b3473){if(_0x2b3473){if(!_[_0xb54f('0x63')](_0x4bc78c[_0xb54f('0x31')][_0xb54f('0x64')])){_0x100bbb=_0x4bc78c[_0xb54f('0x31')][_0xb54f('0x64')];}return _0x1e68f2[_0xb54f('0x65')](_0x100bbb)[_0xb54f('0x66')]();}})[_0xb54f('0x23')](function(_0x195ab1){var _0x26a590=[_0xb54f('0x67'),_0xb54f('0x68'),_0xb54f('0x69'),_0xb54f('0x6a'),_0xb54f('0x6b'),_0xb54f('0x6c')];var _0x477e08=['string',_0xb54f('0x6d'),'picklist',_0xb54f('0x6e'),_0xb54f('0x6f'),_0xb54f('0x70'),'phone'];if(_0x195ab1){_[_0xb54f('0x71')](_0x195ab1[_0xb54f('0x33')],function(_0x4364de){return _0x26a590[_0xb54f('0x72')](_0x4364de[_0xb54f('0x26')])||!_0x477e08['includes'](_0x4364de[_0xb54f('0x2c')]);});return{'count':_0x195ab1[_0xb54f('0x33')][_0xb54f('0x35')],'rows':_[_0xb54f('0x29')](_0x195ab1[_0xb54f('0x33')],function(_0x3207d6){return{'id':_0x3207d6['name'],'name':_0x3207d6[_0xb54f('0x73')],'custom':_0x3207d6[_0xb54f('0x74')],'options':_0x3207d6[_0xb54f('0x75')]['length']>0x0?_[_0xb54f('0x29')](_0x3207d6[_0xb54f('0x75')],function(_0x21d3fd){return{'name':_0x21d3fd[_0xb54f('0x73')],'value':_0x21d3fd['value']};}):_0x3207d6['type']==_0xb54f('0x6e')?[{'name':'True','value':_0xb54f('0x76')},{'name':'False','value':_0xb54f('0x77')}]:[]};})};}})[_0xb54f('0x23')](respondWithResult(_0xfa6a65,null))[_0xb54f('0x41')](function(_0x2ca8e6){var _0x315b4e=_0x4bc78c['query'][_0xb54f('0x78')]?0x1f4:_0x2ca8e6['statusCode']||0x1f4;logger[_0xb54f('0x25')](_0xb54f('0x79'),_0xb54f('0x56'),_0x315b4e,JSON['stringify'](_0x2ca8e6));delete _0x2ca8e6[_0xb54f('0x26')];if(_0x315b4e===0x191){_0x315b4e=0x190;}_0xfa6a65[_0xb54f('0x19')](_0x315b4e)[_0xb54f('0x27')](_0x4bc78c[_0xb54f('0x31')][_0xb54f('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x2ca8e6[_0xb54f('0x7a')]}:_0x2ca8e6);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3cc72f1..5aa3ed1 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 _0x5212=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x3113ed,_0x4319b3){var _0x4fc29b=function(_0x5cb361){while(--_0x5cb361){_0x3113ed['push'](_0x3113ed['shift']());}};_0x4fc29b(++_0x4319b3);}(_0x5212,0x187));var _0x2521=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x5212[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x2521('0x0'));var util=require('util');var logger=require(_0x2521('0x1'))(_0x2521('0x2'));var moment=require(_0x2521('0x3'));var BPromise=require(_0x2521('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2521('0x5'));var rimraf=require(_0x2521('0x6'));var config=require(_0x2521('0x7'));var attributes=require(_0x2521('0x8'));var integrations=require(_0x2521('0x9'));module[_0x2521('0xa')]=function(_0x3c8c78,_0x5c2a4f){return _0x3c8c78[_0x2521('0xb')](_0x2521('0xc'),attributes,{'tableName':_0x2521('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73e8=['int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','exports','SalesforceAccount'];(function(_0x67e9ca,_0x419250){var _0x1b81d6=function(_0x483973){while(--_0x483973){_0x67e9ca['push'](_0x67e9ca['shift']());}};_0x1b81d6(++_0x419250);}(_0x73e8,0x151));var _0x873e=function(_0x29bcf4,_0x40c719){_0x29bcf4=_0x29bcf4-0x0;var _0x89d7c6=_0x73e8[_0x29bcf4];return _0x89d7c6;};'use strict';var _=require('lodash');var util=require(_0x873e('0x0'));var logger=require(_0x873e('0x1'))(_0x873e('0x2'));var moment=require(_0x873e('0x3'));var BPromise=require(_0x873e('0x4'));var rp=require(_0x873e('0x5'));var fs=require('fs');var path=require(_0x873e('0x6'));var rimraf=require(_0x873e('0x7'));var config=require('../../config/environment');var attributes=require(_0x873e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x873e('0x9')]=function(_0xc2f882,_0x5a47e9){return _0xc2f882['define'](_0x873e('0xa'),attributes,{'tableName':_0x873e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 993d46b..72ad198 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 _0x3a5a=['attributes','map','include','model','ShowSalesforceAccount','find','where','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw'];(function(_0x2fd613,_0x10c27f){var _0x469ed5=function(_0x58e97c){while(--_0x58e97c){_0x2fd613['push'](_0x2fd613['shift']());}};_0x469ed5(++_0x10c27f);}(_0x3a5a,0x167));var _0xa3a5=function(_0x4c21ee,_0x217ce3){_0x4c21ee=_0x4c21ee-0x0;var _0x34e9dc=_0x3a5a[_0x4c21ee];return _0x34e9dc;};'use strict';var _=require(_0xa3a5('0x0'));var util=require(_0xa3a5('0x1'));var moment=require(_0xa3a5('0x2'));var BPromise=require(_0xa3a5('0x3'));var rs=require(_0xa3a5('0x4'));var fs=require('fs');var Redis=require(_0xa3a5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3a5('0x6'));var logger=require(_0xa3a5('0x7'))(_0xa3a5('0x8'));var config=require(_0xa3a5('0x9'));var jayson=require(_0xa3a5('0xa'));var client=jayson['client'][_0xa3a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b7c7c,_0x19c2c4,_0x14606e){return new BPromise(function(_0x5cfd71,_0xc9c848){return client[_0xa3a5('0xc')](_0x2b7c7c,_0x14606e)[_0xa3a5('0xd')](function(_0x8f5838){logger[_0xa3a5('0xe')](_0xa3a5('0xf'),_0x19c2c4,_0xa3a5('0x10'));logger['debug'](_0xa3a5('0x11'),_0x19c2c4,'request\x20sent',JSON['stringify'](_0x8f5838));if(_0x8f5838[_0xa3a5('0x12')]){if(_0x8f5838[_0xa3a5('0x12')]['code']===0x1f4){logger[_0xa3a5('0x12')](_0xa3a5('0xf'),_0x19c2c4,_0x8f5838[_0xa3a5('0x12')]['message']);return _0xc9c848(_0x8f5838[_0xa3a5('0x12')][_0xa3a5('0x13')]);}logger[_0xa3a5('0x12')](_0xa3a5('0xf'),_0x19c2c4,_0x8f5838[_0xa3a5('0x12')][_0xa3a5('0x13')]);return _0x5cfd71(_0x8f5838[_0xa3a5('0x12')]['message']);}else{logger[_0xa3a5('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x19c2c4,'request\x20sent');_0x5cfd71(_0x8f5838[_0xa3a5('0x14')]['message']);}})[_0xa3a5('0x15')](function(_0xd2ad8b){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x19c2c4,_0xd2ad8b);_0xc9c848(_0xd2ad8b);});});}exports[_0xa3a5('0x16')]=function(_0x2bf684){var _0x40ca00=this;return new Promise(function(_0x3527fb,_0x1966ba){return db[_0xa3a5('0x17')]['findAll']({'raw':_0x2bf684[_0xa3a5('0x18')]?_0x2bf684[_0xa3a5('0x18')][_0xa3a5('0x19')]===undefined?!![]:![]:!![],'where':_0x2bf684['options']?_0x2bf684['options']['where']||null:null,'attributes':_0x2bf684[_0xa3a5('0x18')]?_0x2bf684[_0xa3a5('0x18')][_0xa3a5('0x1a')]||null:null,'limit':_0x2bf684[_0xa3a5('0x18')]?_0x2bf684['options']['limit']||null:null,'include':_0x2bf684['options']?_0x2bf684[_0xa3a5('0x18')]['include']?_[_0xa3a5('0x1b')](_0x2bf684[_0xa3a5('0x18')][_0xa3a5('0x1c')],function(_0x30d5ab){return{'model':db[_0x30d5ab[_0xa3a5('0x1d')]],'as':_0x30d5ab['as'],'attributes':_0x30d5ab[_0xa3a5('0x1a')],'include':_0x30d5ab['include']?_[_0xa3a5('0x1b')](_0x30d5ab[_0xa3a5('0x1c')],function(_0x31c2a4){return{'model':db[_0x31c2a4[_0xa3a5('0x1d')]],'as':_0x31c2a4['as'],'attributes':_0x31c2a4[_0xa3a5('0x1a')],'include':_0x31c2a4[_0xa3a5('0x1c')]?_[_0xa3a5('0x1b')](_0x31c2a4[_0xa3a5('0x1c')],function(_0x162413){return{'model':db[_0x162413['model']],'as':_0x162413['as'],'attributes':_0x162413[_0xa3a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x295c4a){logger[_0xa3a5('0xe')](_0xa3a5('0x16'),_0x2bf684);logger['debug'](_0xa3a5('0x16'),_0x2bf684,JSON['stringify'](_0x295c4a));_0x3527fb(_0x295c4a);})[_0xa3a5('0x15')](function(_0x119672){logger['error'](_0xa3a5('0x16'),_0x119672['message'],_0x2bf684);_0x1966ba(_0x40ca00[_0xa3a5('0x12')](0x1f4,_0x119672['message']));});});};exports[_0xa3a5('0x1e')]=function(_0xa8325b){var _0x2c7f64=this;return new Promise(function(_0x2f0575,_0x463f94){return db[_0xa3a5('0x17')][_0xa3a5('0x1f')]({'raw':_0xa8325b[_0xa3a5('0x18')]?_0xa8325b[_0xa3a5('0x18')][_0xa3a5('0x19')]===undefined?!![]:![]:!![],'where':_0xa8325b[_0xa3a5('0x18')]?_0xa8325b[_0xa3a5('0x18')][_0xa3a5('0x20')]||null:null,'attributes':_0xa8325b[_0xa3a5('0x18')]?_0xa8325b[_0xa3a5('0x18')][_0xa3a5('0x1a')]||null:null,'include':_0xa8325b[_0xa3a5('0x18')]?_0xa8325b['options'][_0xa3a5('0x1c')]?_[_0xa3a5('0x1b')](_0xa8325b[_0xa3a5('0x18')][_0xa3a5('0x1c')],function(_0x5949c3){return{'model':db[_0x5949c3[_0xa3a5('0x1d')]],'as':_0x5949c3['as'],'attributes':_0x5949c3[_0xa3a5('0x1a')],'include':_0x5949c3[_0xa3a5('0x1c')]?_['map'](_0x5949c3[_0xa3a5('0x1c')],function(_0x11f467){return{'model':db[_0x11f467[_0xa3a5('0x1d')]],'as':_0x11f467['as'],'attributes':_0x11f467[_0xa3a5('0x1a')],'include':_0x11f467[_0xa3a5('0x1c')]?_[_0xa3a5('0x1b')](_0x11f467[_0xa3a5('0x1c')],function(_0x696a86){return{'model':db[_0x696a86[_0xa3a5('0x1d')]],'as':_0x696a86['as'],'attributes':_0x696a86['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b3762){logger[_0xa3a5('0xe')]('ShowSalesforceAccount',_0xa8325b);logger[_0xa3a5('0x21')]('ShowSalesforceAccount',_0xa8325b,JSON[_0xa3a5('0x22')](_0x4b3762));_0x2f0575(_0x4b3762);})[_0xa3a5('0x15')](function(_0x393a75){logger[_0xa3a5('0x12')](_0xa3a5('0x1e'),_0x393a75[_0xa3a5('0x13')],_0xa8325b);_0x463f94(_0x2c7f64['error'](0x1f4,_0x393a75['message']));});});}; \ No newline at end of file +var _0xc3c1=['attributes','ShowSalesforceAccount','find','lodash','util','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','include','map','model'];(function(_0x2eee7d,_0x31c23f){var _0x230e5b=function(_0x51e3ae){while(--_0x51e3ae){_0x2eee7d['push'](_0x2eee7d['shift']());}};_0x230e5b(++_0x31c23f);}(_0xc3c1,0x111));var _0x1c3c=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xc3c1[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x1c3c('0x0'));var util=require(_0x1c3c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1c3c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1c3c('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x1c3c('0x4')][_0x1c3c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xd92598,_0x5787e4,_0x364f58){return new BPromise(function(_0x29dfa1,_0x455f95){return client[_0x1c3c('0x6')](_0xd92598,_0x364f58)[_0x1c3c('0x7')](function(_0x5ce0dc){logger[_0x1c3c('0x8')]('SalesforceAccount,\x20%s,\x20%s',_0x5787e4,_0x1c3c('0x9'));logger[_0x1c3c('0xa')](_0x1c3c('0xb'),_0x5787e4,_0x1c3c('0x9'),JSON[_0x1c3c('0xc')](_0x5ce0dc));if(_0x5ce0dc[_0x1c3c('0xd')]){if(_0x5ce0dc[_0x1c3c('0xd')]['code']===0x1f4){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x5787e4,_0x5ce0dc[_0x1c3c('0xd')][_0x1c3c('0xe')]);return _0x455f95(_0x5ce0dc[_0x1c3c('0xd')][_0x1c3c('0xe')]);}logger['error'](_0x1c3c('0xf'),_0x5787e4,_0x5ce0dc[_0x1c3c('0xd')][_0x1c3c('0xe')]);return _0x29dfa1(_0x5ce0dc[_0x1c3c('0xd')][_0x1c3c('0xe')]);}else{logger[_0x1c3c('0x8')](_0x1c3c('0xf'),_0x5787e4,'request\x20sent');_0x29dfa1(_0x5ce0dc[_0x1c3c('0x10')][_0x1c3c('0xe')]);}})[_0x1c3c('0x11')](function(_0x3039e9){logger[_0x1c3c('0xd')](_0x1c3c('0xf'),_0x5787e4,_0x3039e9);_0x455f95(_0x3039e9);});});}exports[_0x1c3c('0x12')]=function(_0x1d3b7a){var _0xcc2499=this;return new Promise(function(_0x82a3e8,_0x141642){return db[_0x1c3c('0x13')][_0x1c3c('0x14')]({'raw':_0x1d3b7a[_0x1c3c('0x15')]?_0x1d3b7a[_0x1c3c('0x15')][_0x1c3c('0x16')]===undefined?!![]:![]:!![],'where':_0x1d3b7a['options']?_0x1d3b7a[_0x1c3c('0x15')][_0x1c3c('0x17')]||null:null,'attributes':_0x1d3b7a['options']?_0x1d3b7a['options']['attributes']||null:null,'limit':_0x1d3b7a[_0x1c3c('0x15')]?_0x1d3b7a['options']['limit']||null:null,'include':_0x1d3b7a[_0x1c3c('0x15')]?_0x1d3b7a['options'][_0x1c3c('0x18')]?_[_0x1c3c('0x19')](_0x1d3b7a[_0x1c3c('0x15')][_0x1c3c('0x18')],function(_0x798c49){return{'model':db[_0x798c49[_0x1c3c('0x1a')]],'as':_0x798c49['as'],'attributes':_0x798c49[_0x1c3c('0x1b')],'include':_0x798c49['include']?_[_0x1c3c('0x19')](_0x798c49['include'],function(_0x11189f){return{'model':db[_0x11189f[_0x1c3c('0x1a')]],'as':_0x11189f['as'],'attributes':_0x11189f['attributes'],'include':_0x11189f['include']?_[_0x1c3c('0x19')](_0x11189f[_0x1c3c('0x18')],function(_0x335f34){return{'model':db[_0x335f34[_0x1c3c('0x1a')]],'as':_0x335f34['as'],'attributes':_0x335f34['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c3c('0x7')](function(_0xb7972c){logger[_0x1c3c('0x8')](_0x1c3c('0x12'),_0x1d3b7a);logger[_0x1c3c('0xa')](_0x1c3c('0x12'),_0x1d3b7a,JSON[_0x1c3c('0xc')](_0xb7972c));_0x82a3e8(_0xb7972c);})[_0x1c3c('0x11')](function(_0x158320){logger[_0x1c3c('0xd')](_0x1c3c('0x12'),_0x158320[_0x1c3c('0xe')],_0x1d3b7a);_0x141642(_0xcc2499[_0x1c3c('0xd')](0x1f4,_0x158320['message']));});});};exports[_0x1c3c('0x1c')]=function(_0x20438c){var _0x3a9888=this;return new Promise(function(_0x201745,_0x56261c){return db['SalesforceAccount'][_0x1c3c('0x1d')]({'raw':_0x20438c[_0x1c3c('0x15')]?_0x20438c[_0x1c3c('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x20438c[_0x1c3c('0x15')]?_0x20438c[_0x1c3c('0x15')][_0x1c3c('0x17')]||null:null,'attributes':_0x20438c['options']?_0x20438c['options'][_0x1c3c('0x1b')]||null:null,'include':_0x20438c['options']?_0x20438c[_0x1c3c('0x15')][_0x1c3c('0x18')]?_[_0x1c3c('0x19')](_0x20438c['options']['include'],function(_0x50b061){return{'model':db[_0x50b061[_0x1c3c('0x1a')]],'as':_0x50b061['as'],'attributes':_0x50b061[_0x1c3c('0x1b')],'include':_0x50b061['include']?_[_0x1c3c('0x19')](_0x50b061[_0x1c3c('0x18')],function(_0x37e091){return{'model':db[_0x37e091[_0x1c3c('0x1a')]],'as':_0x37e091['as'],'attributes':_0x37e091[_0x1c3c('0x1b')],'include':_0x37e091[_0x1c3c('0x18')]?_[_0x1c3c('0x19')](_0x37e091[_0x1c3c('0x18')],function(_0x2ec6a7){return{'model':db[_0x2ec6a7[_0x1c3c('0x1a')]],'as':_0x2ec6a7['as'],'attributes':_0x2ec6a7[_0x1c3c('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c7323){logger[_0x1c3c('0x8')](_0x1c3c('0x1c'),_0x20438c);logger[_0x1c3c('0xa')]('ShowSalesforceAccount',_0x20438c,JSON[_0x1c3c('0xc')](_0x1c7323));_0x201745(_0x1c7323);})[_0x1c3c('0x11')](function(_0x53a723){logger[_0x1c3c('0xd')](_0x1c3c('0x1c'),_0x53a723['message'],_0x20438c);_0x56261c(_0x3a9888['error'](0x1f4,_0x53a723[_0x1c3c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3a65633..1312082 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x1d9ba8,_0xcfab97){var _0x4d8eb4=function(_0xfb079b){while(--_0xfb079b){_0x1d9ba8['push'](_0x1d9ba8['shift']());}};_0x4d8eb4(++_0xcfab97);}(_0x2ef3,0xba));var _0x32ef=function(_0x4c2e8a,_0x2949e3){_0x4c2e8a=_0x4c2e8a-0x0;var _0x2bd181=_0x2ef3[_0x4c2e8a];return _0x2bd181;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _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(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xdb28,0x106));var _0x8db2=function(_0x30109f,_0x44d601){_0x30109f=_0x30109f-0x0;var _0x3439af=_0xdb28[_0x30109f];return _0x3439af;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d38cceb..7dbad94 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 _0x3b20=['Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task'];(function(_0x2b590a,_0x656e21){var _0x461c52=function(_0x2ba3d6){while(--_0x2ba3d6){_0x2b590a['push'](_0x2b590a['shift']());}};_0x461c52(++_0x656e21);}(_0x3b20,0x11b));var _0x03b2=function(_0x7d88a4,_0x2834d1){_0x7d88a4=_0x7d88a4-0x0;var _0x43d97e=_0x3b20[_0x7d88a4];return _0x43d97e;};'use strict';var Sequelize=require(_0x03b2('0x0'));module[_0x03b2('0x1')]={'name':{'type':Sequelize[_0x03b2('0x2')]},'description':{'type':Sequelize[_0x03b2('0x2')]},'ticketType':{'type':Sequelize[_0x03b2('0x3')](_0x03b2('0x4'),_0x03b2('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x03b2('0x3')](_0x03b2('0x6'),_0x03b2('0x7'),_0x03b2('0x8'),_0x03b2('0x9'),_0x03b2('0xa')),'defaultValue':_0x03b2('0x6')},'moduleCreate':{'type':Sequelize[_0x03b2('0x3')](_0x03b2('0xb'),_0x03b2('0x7'),'lead',_0x03b2('0xa')),'defaultValue':_0x03b2('0x8')},'leadId':{'type':Sequelize[_0x03b2('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x03b2('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x03b2('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x03b2('0x2')]}}; \ No newline at end of file +var _0x3360=['Task','ENUM','contact_lead','contact','lead','account_contact_lead','nothing','account','STRING','sequelize','exports'];(function(_0x12bee6,_0x32646b){var _0x769140=function(_0xed8718){while(--_0xed8718){_0x12bee6['push'](_0x12bee6['shift']());}};_0x769140(++_0x32646b);}(_0x3360,0x1d7));var _0x0336=function(_0x1c5490,_0x142e7b){_0x1c5490=_0x1c5490-0x0;var _0xd354e5=_0x3360[_0x1c5490];return _0xd354e5;};'use strict';var Sequelize=require(_0x0336('0x0'));module[_0x0336('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x0336('0x2'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x0336('0x3')](_0x0336('0x4'),_0x0336('0x5'),_0x0336('0x6'),_0x0336('0x7'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x0336('0x3')](_0x0336('0x8'),_0x0336('0x5'),_0x0336('0x6'),_0x0336('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x0336('0xa')]},'additionalSearchAccount':{'type':Sequelize[_0x0336('0xa')]},'additionalSearchContact':{'type':Sequelize[_0x0336('0xa')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 5dd6299..d7b3cd2 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 _0xc885=['find','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','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','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body'];(function(_0xa822a0,_0x38e2cc){var _0xaf7e66=function(_0x349fce){while(--_0x349fce){_0xa822a0['push'](_0xa822a0['shift']());}};_0xaf7e66(++_0x38e2cc);}(_0xc885,0xfc));var _0x5c88=function(_0x3a2f98,_0x2cf76f){_0x3a2f98=_0x3a2f98-0x0;var _0x343dad=_0xc885[_0x3a2f98];return _0x343dad;};'use strict';var emlformat=require(_0x5c88('0x0'));var rimraf=require(_0x5c88('0x1'));var zipdir=require(_0x5c88('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c88('0x3'));var moment=require('moment');var BPromise=require(_0x5c88('0x4'));var Mustache=require('mustache');var util=require(_0x5c88('0x5'));var path=require(_0x5c88('0x6'));var sox=require(_0x5c88('0x7'));var csv=require(_0x5c88('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c88('0x9'));var squel=require('squel');var crypto=require(_0x5c88('0xa'));var jsforce=require(_0x5c88('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5c88('0x8'));var querystring=require(_0x5c88('0xc'));var Papa=require(_0x5c88('0xd'));var Redis=require(_0x5c88('0xe'));var authService=require(_0x5c88('0xf'));var qs=require(_0x5c88('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c88('0x11'));var logger=require(_0x5c88('0x12'))(_0x5c88('0x13'));var utils=require(_0x5c88('0x14'));var config=require(_0x5c88('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c88('0x16'))['db'];function respondWithStatusCode(_0x7b5707,_0x1079d9){_0x1079d9=_0x1079d9||0xcc;return function(_0x13d78e){if(_0x13d78e){return _0x7b5707[_0x5c88('0x17')](_0x1079d9);}return _0x7b5707[_0x5c88('0x18')](_0x1079d9)[_0x5c88('0x19')]();};}function respondWithResult(_0x1660c2,_0x33a072){_0x33a072=_0x33a072||0xc8;return function(_0x4b9992){if(_0x4b9992){return _0x1660c2[_0x5c88('0x18')](_0x33a072)[_0x5c88('0x1a')](_0x4b9992);}};}function respondWithFilteredResult(_0x7546e0,_0xa4cb95){return function(_0x2e780e){if(_0x2e780e){var _0x1e92fc=typeof _0xa4cb95[_0x5c88('0x1b')]===_0x5c88('0x1c')&&typeof _0xa4cb95[_0x5c88('0x1d')]==='undefined';var _0x639f0b=_0x2e780e[_0x5c88('0x1e')];var _0x2c44d5=_0x1e92fc?0x0:_0xa4cb95[_0x5c88('0x1b')];var _0x5a677e=_0x1e92fc?_0x2e780e[_0x5c88('0x1e')]:_0xa4cb95[_0x5c88('0x1b')]+_0xa4cb95[_0x5c88('0x1d')];var _0x51a539;if(_0x5a677e>=_0x639f0b){_0x5a677e=_0x639f0b;_0x51a539=0xc8;}else{_0x51a539=0xce;}_0x7546e0[_0x5c88('0x18')](_0x51a539);return _0x7546e0[_0x5c88('0x1f')](_0x5c88('0x20'),_0x2c44d5+'-'+_0x5a677e+'/'+_0x639f0b)['json'](_0x2e780e);}return null;};}function patchUpdates(_0xc3f6ed){return function(_0x46a42e){try{jsonpatch[_0x5c88('0x21')](_0x46a42e,_0xc3f6ed,!![]);}catch(_0x55b4ea){return BPromise[_0x5c88('0x22')](_0x55b4ea);}return _0x46a42e[_0x5c88('0x23')]();};}function saveUpdates(_0x500026,_0x3d8917){return function(_0x50027c){if(_0x50027c){return _0x50027c[_0x5c88('0x24')](_0x500026)[_0x5c88('0x25')](function(_0x51938e){return _0x51938e;});}return null;};}function removeEntity(_0x798328,_0x134b45){return function(_0x3e6112){if(_0x3e6112){return _0x3e6112[_0x5c88('0x26')]()['then'](function(){_0x798328[_0x5c88('0x18')](0xcc)[_0x5c88('0x19')]();});}};}function handleEntityNotFound(_0x480ac7,_0x3182a5){return function(_0x52baa8){if(!_0x52baa8){_0x480ac7['sendStatus'](0x194);}return _0x52baa8;};}function handleError(_0x2f7e80,_0x1eecf2){_0x1eecf2=_0x1eecf2||0x1f4;return function(_0x4ceec7){logger[_0x5c88('0x27')](_0x4ceec7[_0x5c88('0x28')]);if(_0x4ceec7[_0x5c88('0x29')]){delete _0x4ceec7[_0x5c88('0x29')];}_0x2f7e80[_0x5c88('0x18')](_0x1eecf2)[_0x5c88('0x2a')](_0x4ceec7);};}exports[_0x5c88('0x2b')]=function(_0x3d0a81,_0x279cbc){var _0x3a258a={},_0x4e0e73={},_0x34a010={'count':0x0,'rows':[]};var _0x540567=_['map'](db[_0x5c88('0x2c')][_0x5c88('0x2d')],function(_0x43a08b){return{'name':_0x43a08b[_0x5c88('0x2e')],'type':_0x43a08b[_0x5c88('0x2f')][_0x5c88('0x30')]};});_0x4e0e73[_0x5c88('0x31')]=_[_0x5c88('0x32')](_0x540567,_0x5c88('0x29'));_0x4e0e73[_0x5c88('0x33')]=_[_0x5c88('0x34')](_0x3d0a81[_0x5c88('0x33')]);_0x4e0e73[_0x5c88('0x35')]=_['intersection'](_0x4e0e73['model'],_0x4e0e73['query']);_0x3a258a[_0x5c88('0x36')]=_[_0x5c88('0x37')](_0x4e0e73[_0x5c88('0x31')],qs[_0x5c88('0x38')](_0x3d0a81[_0x5c88('0x33')][_0x5c88('0x38')]));_0x3a258a[_0x5c88('0x36')]=_0x3a258a[_0x5c88('0x36')][_0x5c88('0x39')]?_0x3a258a[_0x5c88('0x36')]:_0x4e0e73[_0x5c88('0x31')];if(!_0x3d0a81[_0x5c88('0x33')][_0x5c88('0x3a')](_0x5c88('0x3b'))){_0x3a258a[_0x5c88('0x1d')]=qs['limit'](_0x3d0a81['query'][_0x5c88('0x1d')]);_0x3a258a['offset']=qs['offset'](_0x3d0a81[_0x5c88('0x33')][_0x5c88('0x1b')]);}_0x3a258a[_0x5c88('0x3c')]=qs[_0x5c88('0x3d')](_0x3d0a81[_0x5c88('0x33')][_0x5c88('0x3d')]);_0x3a258a[_0x5c88('0x3e')]=qs[_0x5c88('0x35')](_[_0x5c88('0x3f')](_0x3d0a81[_0x5c88('0x33')],_0x4e0e73[_0x5c88('0x35')]),_0x540567);if(_0x3d0a81[_0x5c88('0x33')][_0x5c88('0x40')]){_0x3a258a['where']=_[_0x5c88('0x41')](_0x3a258a[_0x5c88('0x3e')],{'$or':_[_0x5c88('0x32')](_0x540567,function(_0x24001a){if(_0x24001a['type']!==_0x5c88('0x42')){var _0x2d0e73={};_0x2d0e73[_0x24001a[_0x5c88('0x29')]]={'$like':'%'+_0x3d0a81[_0x5c88('0x33')][_0x5c88('0x40')]+'%'};return _0x2d0e73;}})});}_0x3a258a=_[_0x5c88('0x41')]({},_0x3a258a,_0x3d0a81[_0x5c88('0x43')]);var _0x2babc8={'where':_0x3a258a[_0x5c88('0x3e')]};return db[_0x5c88('0x2c')][_0x5c88('0x1e')](_0x2babc8)[_0x5c88('0x25')](function(_0x43b59f){_0x34a010[_0x5c88('0x1e')]=_0x43b59f;if(_0x3d0a81['query']['includeAll']){_0x3a258a[_0x5c88('0x44')]=[{'all':!![]}];}return db[_0x5c88('0x2c')]['findAll'](_0x3a258a);})[_0x5c88('0x25')](function(_0x1f2513){_0x34a010[_0x5c88('0x45')]=_0x1f2513;return _0x34a010;})[_0x5c88('0x25')](respondWithFilteredResult(_0x279cbc,_0x3a258a))[_0x5c88('0x46')](handleError(_0x279cbc,null));};exports[_0x5c88('0x47')]=function(_0x2f737c,_0x3e0ba8){var _0x3cc1fb={'raw':![],'where':{'id':_0x2f737c[_0x5c88('0x48')]['id']}},_0x523e9e={};_0x523e9e[_0x5c88('0x31')]=_[_0x5c88('0x34')](db[_0x5c88('0x2c')][_0x5c88('0x2d')]);_0x523e9e[_0x5c88('0x33')]=_['keys'](_0x2f737c[_0x5c88('0x33')]);_0x523e9e[_0x5c88('0x35')]=_[_0x5c88('0x37')](_0x523e9e[_0x5c88('0x31')],_0x523e9e['query']);_0x3cc1fb[_0x5c88('0x36')]=_[_0x5c88('0x37')](_0x523e9e[_0x5c88('0x31')],qs[_0x5c88('0x38')](_0x2f737c['query'][_0x5c88('0x38')]));_0x3cc1fb[_0x5c88('0x36')]=_0x3cc1fb[_0x5c88('0x36')][_0x5c88('0x39')]?_0x3cc1fb[_0x5c88('0x36')]:_0x523e9e[_0x5c88('0x31')];if(_0x2f737c[_0x5c88('0x33')][_0x5c88('0x49')]){_0x3cc1fb['include']=[{'all':!![]}];}_0x3cc1fb=_[_0x5c88('0x41')]({},_0x3cc1fb,_0x2f737c[_0x5c88('0x43')]);return db['SalesforceConfiguration']['find'](_0x3cc1fb)['then'](handleEntityNotFound(_0x3e0ba8,null))['then'](respondWithResult(_0x3e0ba8,null))[_0x5c88('0x46')](handleError(_0x3e0ba8,null));};exports[_0x5c88('0x4a')]=function(_0x6808b3,_0x809294){return db[_0x5c88('0x2c')][_0x5c88('0x4a')](_0x6808b3['body'],{})[_0x5c88('0x25')](respondWithResult(_0x809294,0xc9))[_0x5c88('0x46')](handleError(_0x809294,null));};exports['update']=function(_0xd09310,_0x545204){if(_0xd09310[_0x5c88('0x4b')]['id']){delete _0xd09310[_0x5c88('0x4b')]['id'];}return db[_0x5c88('0x2c')]['find']({'where':{'id':_0xd09310[_0x5c88('0x48')]['id']}})[_0x5c88('0x25')](handleEntityNotFound(_0x545204,null))[_0x5c88('0x25')](saveUpdates(_0xd09310[_0x5c88('0x4b')],null))['then'](respondWithResult(_0x545204,null))['catch'](handleError(_0x545204,null));};exports[_0x5c88('0x26')]=function(_0x1faf7a,_0x22da4c){return db[_0x5c88('0x2c')][_0x5c88('0x4c')]({'where':{'id':_0x1faf7a[_0x5c88('0x48')]['id']}})['then'](handleEntityNotFound(_0x22da4c,null))[_0x5c88('0x25')](removeEntity(_0x22da4c,null))['catch'](handleError(_0x22da4c,null));};exports[_0x5c88('0x4d')]=function(_0x3d46b2,_0x1a8833,_0x286d41){var _0x3f678e={};var _0x21d369={};var _0x47bb28;var _0x2cc611;return db[_0x5c88('0x2c')][_0x5c88('0x4e')]({'where':{'id':_0x3d46b2[_0x5c88('0x48')]['id']}})['then'](handleEntityNotFound(_0x1a8833,null))[_0x5c88('0x25')](function(_0x5e18ee){if(_0x5e18ee){_0x47bb28=_0x5e18ee;_0x21d369['model']=_[_0x5c88('0x34')](db[_0x5c88('0x4f')][_0x5c88('0x2d')]);_0x21d369['query']=_['keys'](_0x3d46b2[_0x5c88('0x33')]);_0x21d369[_0x5c88('0x35')]=_[_0x5c88('0x37')](_0x21d369[_0x5c88('0x31')],_0x21d369['query']);_0x3f678e[_0x5c88('0x36')]=_[_0x5c88('0x37')](_0x21d369[_0x5c88('0x31')],qs[_0x5c88('0x38')](_0x3d46b2['query'][_0x5c88('0x38')]));_0x3f678e[_0x5c88('0x36')]=_0x3f678e['attributes']['length']?_0x3f678e['attributes']:_0x21d369[_0x5c88('0x31')];_0x3f678e[_0x5c88('0x3c')]=qs['sort'](_0x3d46b2[_0x5c88('0x33')][_0x5c88('0x3d')]);_0x3f678e[_0x5c88('0x3e')]=qs['filters'](_['pick'](_0x3d46b2[_0x5c88('0x33')],_0x21d369[_0x5c88('0x35')]));if(_0x3d46b2['query'][_0x5c88('0x40')]){_0x3f678e[_0x5c88('0x3e')]=_[_0x5c88('0x41')](_0x3f678e[_0x5c88('0x3e')],{'$or':_['map'](_0x3f678e[_0x5c88('0x36')],function(_0x2d659d){var _0x5cd2bf={};_0x5cd2bf[_0x2d659d]={'$like':'%'+_0x3d46b2[_0x5c88('0x33')][_0x5c88('0x40')]+'%'};return _0x5cd2bf;})});}_0x3f678e=_[_0x5c88('0x41')]({},_0x3f678e,_0x3d46b2['options']);return _0x47bb28[_0x5c88('0x4d')](_0x3f678e);}})[_0x5c88('0x25')](function(_0x3bd674){if(_0x3bd674){_0x2cc611=_0x3bd674['length'];if(!_0x3d46b2[_0x5c88('0x33')][_0x5c88('0x3a')](_0x5c88('0x3b'))){_0x3f678e[_0x5c88('0x1d')]=qs[_0x5c88('0x1d')](_0x3d46b2[_0x5c88('0x33')][_0x5c88('0x1d')]);_0x3f678e[_0x5c88('0x1b')]=qs[_0x5c88('0x1b')](_0x3d46b2[_0x5c88('0x33')][_0x5c88('0x1b')]);}return _0x47bb28[_0x5c88('0x4d')](_0x3f678e);}})['then'](function(_0x4e51b4){if(_0x4e51b4){return _0x4e51b4?{'count':_0x2cc611,'rows':_0x4e51b4}:null;}})[_0x5c88('0x25')](respondWithResult(_0x1a8833,null))[_0x5c88('0x46')](handleError(_0x1a8833,null));};exports[_0x5c88('0x50')]=function(_0x375b22,_0x3b6906,_0x1ad858){var _0x38f871={};var _0x3dc056={};var _0x202271;var _0x4aa375;return db[_0x5c88('0x2c')][_0x5c88('0x4e')]({'where':{'id':_0x375b22['params']['id']}})[_0x5c88('0x25')](handleEntityNotFound(_0x3b6906,null))[_0x5c88('0x25')](function(_0x547c85){if(_0x547c85){_0x202271=_0x547c85;_0x3dc056[_0x5c88('0x31')]=_[_0x5c88('0x34')](db[_0x5c88('0x4f')][_0x5c88('0x2d')]);_0x3dc056[_0x5c88('0x33')]=_[_0x5c88('0x34')](_0x375b22[_0x5c88('0x33')]);_0x3dc056['filters']=_['intersection'](_0x3dc056[_0x5c88('0x31')],_0x3dc056['query']);_0x38f871[_0x5c88('0x36')]=_['intersection'](_0x3dc056[_0x5c88('0x31')],qs['fields'](_0x375b22[_0x5c88('0x33')][_0x5c88('0x38')]));_0x38f871[_0x5c88('0x36')]=_0x38f871['attributes'][_0x5c88('0x39')]?_0x38f871[_0x5c88('0x36')]:_0x3dc056[_0x5c88('0x31')];_0x38f871['order']=qs[_0x5c88('0x3d')](_0x375b22[_0x5c88('0x33')][_0x5c88('0x3d')]);_0x38f871['where']=qs['filters'](_[_0x5c88('0x3f')](_0x375b22['query'],_0x3dc056[_0x5c88('0x35')]));if(_0x375b22[_0x5c88('0x33')][_0x5c88('0x40')]){_0x38f871[_0x5c88('0x3e')]=_[_0x5c88('0x41')](_0x38f871['where'],{'$or':_['map'](_0x38f871[_0x5c88('0x36')],function(_0x5826e6){var _0x1671b7={};_0x1671b7[_0x5826e6]={'$like':'%'+_0x375b22[_0x5c88('0x33')][_0x5c88('0x40')]+'%'};return _0x1671b7;})});}_0x38f871=_[_0x5c88('0x41')]({},_0x38f871,_0x375b22[_0x5c88('0x43')]);return _0x202271['getSubjects'](_0x38f871);}})[_0x5c88('0x25')](function(_0x34db88){if(_0x34db88){_0x4aa375=_0x34db88[_0x5c88('0x39')];if(!_0x375b22[_0x5c88('0x33')][_0x5c88('0x3a')](_0x5c88('0x3b'))){_0x38f871[_0x5c88('0x1d')]=qs[_0x5c88('0x1d')](_0x375b22['query'][_0x5c88('0x1d')]);_0x38f871[_0x5c88('0x1b')]=qs['offset'](_0x375b22['query'][_0x5c88('0x1b')]);}return _0x202271[_0x5c88('0x50')](_0x38f871);}})[_0x5c88('0x25')](function(_0x597cbf){if(_0x597cbf){return _0x597cbf?{'count':_0x4aa375,'rows':_0x597cbf}:null;}})[_0x5c88('0x25')](respondWithResult(_0x3b6906,null))[_0x5c88('0x46')](handleError(_0x3b6906,null));};exports[_0x5c88('0x51')]=function(_0x2784aa,_0x31aa41,_0x41b033){var _0x49f148={};var _0x3d9303={};var _0x50f6ec;var _0xe1bf44;return db[_0x5c88('0x2c')]['findOne']({'where':{'id':_0x2784aa['params']['id']}})[_0x5c88('0x25')](handleEntityNotFound(_0x31aa41,null))['then'](function(_0x41f6a7){if(_0x41f6a7){_0x50f6ec=_0x41f6a7;_0x3d9303[_0x5c88('0x31')]=_[_0x5c88('0x34')](db[_0x5c88('0x4f')]['rawAttributes']);_0x3d9303[_0x5c88('0x33')]=_[_0x5c88('0x34')](_0x2784aa[_0x5c88('0x33')]);_0x3d9303['filters']=_[_0x5c88('0x37')](_0x3d9303[_0x5c88('0x31')],_0x3d9303['query']);_0x49f148[_0x5c88('0x36')]=_[_0x5c88('0x37')](_0x3d9303[_0x5c88('0x31')],qs[_0x5c88('0x38')](_0x2784aa[_0x5c88('0x33')][_0x5c88('0x38')]));_0x49f148[_0x5c88('0x36')]=_0x49f148[_0x5c88('0x36')][_0x5c88('0x39')]?_0x49f148[_0x5c88('0x36')]:_0x3d9303[_0x5c88('0x31')];_0x49f148['order']=qs[_0x5c88('0x3d')](_0x2784aa[_0x5c88('0x33')]['sort']);_0x49f148[_0x5c88('0x3e')]=qs['filters'](_['pick'](_0x2784aa[_0x5c88('0x33')],_0x3d9303[_0x5c88('0x35')]));if(_0x2784aa['query'][_0x5c88('0x40')]){_0x49f148['where']=_['merge'](_0x49f148[_0x5c88('0x3e')],{'$or':_[_0x5c88('0x32')](_0x49f148[_0x5c88('0x36')],function(_0x3fb5ad){var _0xc76d89={};_0xc76d89[_0x3fb5ad]={'$like':'%'+_0x2784aa[_0x5c88('0x33')][_0x5c88('0x40')]+'%'};return _0xc76d89;})});}_0x49f148=_[_0x5c88('0x41')]({},_0x49f148,_0x2784aa['options']);return _0x50f6ec[_0x5c88('0x51')](_0x49f148);}})[_0x5c88('0x25')](function(_0x127adb){if(_0x127adb){_0xe1bf44=_0x127adb['length'];if(!_0x2784aa[_0x5c88('0x33')][_0x5c88('0x3a')](_0x5c88('0x3b'))){_0x49f148[_0x5c88('0x1d')]=qs[_0x5c88('0x1d')](_0x2784aa['query'][_0x5c88('0x1d')]);_0x49f148[_0x5c88('0x1b')]=qs[_0x5c88('0x1b')](_0x2784aa[_0x5c88('0x33')][_0x5c88('0x1b')]);}return _0x50f6ec['getDescriptions'](_0x49f148);}})[_0x5c88('0x25')](function(_0x36a202){if(_0x36a202){return _0x36a202?{'count':_0xe1bf44,'rows':_0x36a202}:null;}})[_0x5c88('0x25')](respondWithResult(_0x31aa41,null))[_0x5c88('0x46')](handleError(_0x31aa41,null));}; \ No newline at end of file +var _0x26be=['map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','SalesforceField','pick','getSubjects','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name'];(function(_0x575a7f,_0x175b25){var _0x5abd15=function(_0x50e5ef){while(--_0x50e5ef){_0x575a7f['push'](_0x575a7f['shift']());}};_0x5abd15(++_0x175b25);}(_0x26be,0x108));var _0xe26b=function(_0x5584b2,_0x2ce3d6){_0x5584b2=_0x5584b2-0x0;var _0x41e183=_0x26be[_0x5584b2];return _0x41e183;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe26b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe26b('0x1'));var rp=require(_0xe26b('0x2'));var moment=require(_0xe26b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe26b('0x4'));var path=require(_0xe26b('0x5'));var sox=require(_0xe26b('0x6'));var csv=require('to-csv');var ejs=require(_0xe26b('0x7'));var fs=require('fs');var fs_extra=require(_0xe26b('0x8'));var _=require(_0xe26b('0x9'));var squel=require('squel');var crypto=require(_0xe26b('0xa'));var jsforce=require(_0xe26b('0xb'));var deskjs=require(_0xe26b('0xc'));var toCsv=require(_0xe26b('0xd'));var querystring=require(_0xe26b('0xe'));var Papa=require(_0xe26b('0xf'));var Redis=require(_0xe26b('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe26b('0x11'));var hardwareService=require(_0xe26b('0x12'));var logger=require(_0xe26b('0x13'))(_0xe26b('0x14'));var utils=require(_0xe26b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe26b('0x16'));var db=require(_0xe26b('0x17'))['db'];function respondWithStatusCode(_0x43deec,_0x279ea6){_0x279ea6=_0x279ea6||0xcc;return function(_0x412477){if(_0x412477){return _0x43deec['sendStatus'](_0x279ea6);}return _0x43deec['status'](_0x279ea6)[_0xe26b('0x18')]();};}function respondWithResult(_0x43f399,_0x5b6606){_0x5b6606=_0x5b6606||0xc8;return function(_0x4122c4){if(_0x4122c4){return _0x43f399[_0xe26b('0x19')](_0x5b6606)[_0xe26b('0x1a')](_0x4122c4);}};}function respondWithFilteredResult(_0x1292e9,_0x45cc3c){return function(_0x3ec5d6){if(_0x3ec5d6){var _0x423634=typeof _0x45cc3c[_0xe26b('0x1b')]===_0xe26b('0x1c')&&typeof _0x45cc3c['limit']===_0xe26b('0x1c');var _0x17f0cf=_0x3ec5d6['count'];var _0x2761cc=_0x423634?0x0:_0x45cc3c[_0xe26b('0x1b')];var _0x1f69fd=_0x423634?_0x3ec5d6[_0xe26b('0x1d')]:_0x45cc3c[_0xe26b('0x1b')]+_0x45cc3c[_0xe26b('0x1e')];var _0x265af0;if(_0x1f69fd>=_0x17f0cf){_0x1f69fd=_0x17f0cf;_0x265af0=0xc8;}else{_0x265af0=0xce;}_0x1292e9['status'](_0x265af0);return _0x1292e9['set'](_0xe26b('0x1f'),_0x2761cc+'-'+_0x1f69fd+'/'+_0x17f0cf)['json'](_0x3ec5d6);}return null;};}function patchUpdates(_0x494074){return function(_0x230067){try{jsonpatch[_0xe26b('0x20')](_0x230067,_0x494074,!![]);}catch(_0x3685f0){return BPromise[_0xe26b('0x21')](_0x3685f0);}return _0x230067['save']();};}function saveUpdates(_0x20167c,_0x4bdd6e){return function(_0x29030a){if(_0x29030a){return _0x29030a[_0xe26b('0x22')](_0x20167c)[_0xe26b('0x23')](function(_0x43d557){return _0x43d557;});}return null;};}function removeEntity(_0x5d17f8,_0x404415){return function(_0x33b2fa){if(_0x33b2fa){return _0x33b2fa[_0xe26b('0x24')]()[_0xe26b('0x23')](function(){_0x5d17f8['status'](0xcc)[_0xe26b('0x18')]();});}};}function handleEntityNotFound(_0x16ccf9,_0x85deff){return function(_0x3dce16){if(!_0x3dce16){_0x16ccf9['sendStatus'](0x194);}return _0x3dce16;};}function handleError(_0x3e25b1,_0xf45b3f){_0xf45b3f=_0xf45b3f||0x1f4;return function(_0x418568){logger[_0xe26b('0x25')](_0x418568[_0xe26b('0x26')]);if(_0x418568[_0xe26b('0x27')]){delete _0x418568[_0xe26b('0x27')];}_0x3e25b1[_0xe26b('0x19')](_0xf45b3f)['send'](_0x418568);};}exports['index']=function(_0x248a5e,_0xe0a20c){var _0x9f4fe1={},_0x31fd3c={},_0x199d41={'count':0x0,'rows':[]};var _0x421fd1=_[_0xe26b('0x28')](db[_0xe26b('0x29')][_0xe26b('0x2a')],function(_0x48de02){return{'name':_0x48de02[_0xe26b('0x2b')],'type':_0x48de02['type'][_0xe26b('0x2c')]};});_0x31fd3c[_0xe26b('0x2d')]=_[_0xe26b('0x28')](_0x421fd1,_0xe26b('0x27'));_0x31fd3c[_0xe26b('0x2e')]=_[_0xe26b('0x2f')](_0x248a5e[_0xe26b('0x2e')]);_0x31fd3c[_0xe26b('0x30')]=_[_0xe26b('0x31')](_0x31fd3c['model'],_0x31fd3c[_0xe26b('0x2e')]);_0x9f4fe1[_0xe26b('0x32')]=_['intersection'](_0x31fd3c['model'],qs[_0xe26b('0x33')](_0x248a5e[_0xe26b('0x2e')]['fields']));_0x9f4fe1['attributes']=_0x9f4fe1['attributes'][_0xe26b('0x34')]?_0x9f4fe1[_0xe26b('0x32')]:_0x31fd3c[_0xe26b('0x2d')];if(!_0x248a5e[_0xe26b('0x2e')][_0xe26b('0x35')](_0xe26b('0x36'))){_0x9f4fe1[_0xe26b('0x1e')]=qs[_0xe26b('0x1e')](_0x248a5e[_0xe26b('0x2e')][_0xe26b('0x1e')]);_0x9f4fe1[_0xe26b('0x1b')]=qs['offset'](_0x248a5e[_0xe26b('0x2e')][_0xe26b('0x1b')]);}_0x9f4fe1[_0xe26b('0x37')]=qs[_0xe26b('0x38')](_0x248a5e[_0xe26b('0x2e')][_0xe26b('0x38')]);_0x9f4fe1[_0xe26b('0x39')]=qs[_0xe26b('0x30')](_['pick'](_0x248a5e[_0xe26b('0x2e')],_0x31fd3c[_0xe26b('0x30')]),_0x421fd1);if(_0x248a5e[_0xe26b('0x2e')][_0xe26b('0x3a')]){_0x9f4fe1[_0xe26b('0x39')]=_[_0xe26b('0x3b')](_0x9f4fe1[_0xe26b('0x39')],{'$or':_['map'](_0x421fd1,function(_0x492729){if(_0x492729['type']!==_0xe26b('0x3c')){var _0x587820={};_0x587820[_0x492729[_0xe26b('0x27')]]={'$like':'%'+_0x248a5e['query']['filter']+'%'};return _0x587820;}})});}_0x9f4fe1=_['merge']({},_0x9f4fe1,_0x248a5e[_0xe26b('0x3d')]);var _0x2056e4={'where':_0x9f4fe1[_0xe26b('0x39')]};return db[_0xe26b('0x29')][_0xe26b('0x1d')](_0x2056e4)[_0xe26b('0x23')](function(_0x2bf2ed){_0x199d41[_0xe26b('0x1d')]=_0x2bf2ed;if(_0x248a5e[_0xe26b('0x2e')][_0xe26b('0x3e')]){_0x9f4fe1[_0xe26b('0x3f')]=[{'all':!![]}];}return db[_0xe26b('0x29')][_0xe26b('0x40')](_0x9f4fe1);})[_0xe26b('0x23')](function(_0x7dbcc1){_0x199d41[_0xe26b('0x41')]=_0x7dbcc1;return _0x199d41;})[_0xe26b('0x23')](respondWithFilteredResult(_0xe0a20c,_0x9f4fe1))[_0xe26b('0x42')](handleError(_0xe0a20c,null));};exports['show']=function(_0xd7bdac,_0x47158b){var _0x10178a={'raw':![],'where':{'id':_0xd7bdac[_0xe26b('0x43')]['id']}},_0xc877c9={};_0xc877c9[_0xe26b('0x2d')]=_[_0xe26b('0x2f')](db[_0xe26b('0x29')][_0xe26b('0x2a')]);_0xc877c9[_0xe26b('0x2e')]=_[_0xe26b('0x2f')](_0xd7bdac[_0xe26b('0x2e')]);_0xc877c9[_0xe26b('0x30')]=_['intersection'](_0xc877c9[_0xe26b('0x2d')],_0xc877c9[_0xe26b('0x2e')]);_0x10178a[_0xe26b('0x32')]=_[_0xe26b('0x31')](_0xc877c9[_0xe26b('0x2d')],qs[_0xe26b('0x33')](_0xd7bdac[_0xe26b('0x2e')]['fields']));_0x10178a[_0xe26b('0x32')]=_0x10178a['attributes'][_0xe26b('0x34')]?_0x10178a[_0xe26b('0x32')]:_0xc877c9['model'];if(_0xd7bdac[_0xe26b('0x2e')][_0xe26b('0x3e')]){_0x10178a[_0xe26b('0x3f')]=[{'all':!![]}];}_0x10178a=_[_0xe26b('0x3b')]({},_0x10178a,_0xd7bdac[_0xe26b('0x3d')]);return db[_0xe26b('0x29')][_0xe26b('0x44')](_0x10178a)[_0xe26b('0x23')](handleEntityNotFound(_0x47158b,null))['then'](respondWithResult(_0x47158b,null))[_0xe26b('0x42')](handleError(_0x47158b,null));};exports[_0xe26b('0x45')]=function(_0x2158cb,_0x41d438){return db[_0xe26b('0x29')][_0xe26b('0x45')](_0x2158cb[_0xe26b('0x46')],{})[_0xe26b('0x23')](respondWithResult(_0x41d438,0xc9))[_0xe26b('0x42')](handleError(_0x41d438,null));};exports[_0xe26b('0x22')]=function(_0x273579,_0xf799f8){if(_0x273579[_0xe26b('0x46')]['id']){delete _0x273579[_0xe26b('0x46')]['id'];}return db[_0xe26b('0x29')][_0xe26b('0x44')]({'where':{'id':_0x273579[_0xe26b('0x43')]['id']}})[_0xe26b('0x23')](handleEntityNotFound(_0xf799f8,null))[_0xe26b('0x23')](saveUpdates(_0x273579[_0xe26b('0x46')],null))[_0xe26b('0x23')](respondWithResult(_0xf799f8,null))[_0xe26b('0x42')](handleError(_0xf799f8,null));};exports[_0xe26b('0x24')]=function(_0x142922,_0x48db23){return db[_0xe26b('0x29')][_0xe26b('0x44')]({'where':{'id':_0x142922[_0xe26b('0x43')]['id']}})[_0xe26b('0x23')](handleEntityNotFound(_0x48db23,null))[_0xe26b('0x23')](removeEntity(_0x48db23,null))[_0xe26b('0x42')](handleError(_0x48db23,null));};exports[_0xe26b('0x47')]=function(_0x5a69fa,_0x149cee,_0xe02d0b){var _0x334fa4={};var _0x3458ea={};var _0x72c55b;var _0x4eab7c;return db['SalesforceConfiguration'][_0xe26b('0x48')]({'where':{'id':_0x5a69fa[_0xe26b('0x43')]['id']}})['then'](handleEntityNotFound(_0x149cee,null))[_0xe26b('0x23')](function(_0x3c8196){if(_0x3c8196){_0x72c55b=_0x3c8196;_0x3458ea[_0xe26b('0x2d')]=_['keys'](db[_0xe26b('0x49')][_0xe26b('0x2a')]);_0x3458ea[_0xe26b('0x2e')]=_[_0xe26b('0x2f')](_0x5a69fa[_0xe26b('0x2e')]);_0x3458ea['filters']=_['intersection'](_0x3458ea[_0xe26b('0x2d')],_0x3458ea['query']);_0x334fa4[_0xe26b('0x32')]=_[_0xe26b('0x31')](_0x3458ea['model'],qs[_0xe26b('0x33')](_0x5a69fa['query'][_0xe26b('0x33')]));_0x334fa4['attributes']=_0x334fa4[_0xe26b('0x32')][_0xe26b('0x34')]?_0x334fa4['attributes']:_0x3458ea[_0xe26b('0x2d')];_0x334fa4[_0xe26b('0x37')]=qs[_0xe26b('0x38')](_0x5a69fa['query']['sort']);_0x334fa4['where']=qs[_0xe26b('0x30')](_[_0xe26b('0x4a')](_0x5a69fa[_0xe26b('0x2e')],_0x3458ea['filters']));if(_0x5a69fa[_0xe26b('0x2e')]['filter']){_0x334fa4[_0xe26b('0x39')]=_[_0xe26b('0x3b')](_0x334fa4[_0xe26b('0x39')],{'$or':_['map'](_0x334fa4[_0xe26b('0x32')],function(_0x102ab0){var _0x37603e={};_0x37603e[_0x102ab0]={'$like':'%'+_0x5a69fa[_0xe26b('0x2e')][_0xe26b('0x3a')]+'%'};return _0x37603e;})});}_0x334fa4=_[_0xe26b('0x3b')]({},_0x334fa4,_0x5a69fa['options']);return _0x72c55b['getFields'](_0x334fa4);}})['then'](function(_0x4a63f6){if(_0x4a63f6){_0x4eab7c=_0x4a63f6['length'];if(!_0x5a69fa[_0xe26b('0x2e')][_0xe26b('0x35')](_0xe26b('0x36'))){_0x334fa4['limit']=qs[_0xe26b('0x1e')](_0x5a69fa[_0xe26b('0x2e')][_0xe26b('0x1e')]);_0x334fa4[_0xe26b('0x1b')]=qs['offset'](_0x5a69fa[_0xe26b('0x2e')][_0xe26b('0x1b')]);}return _0x72c55b[_0xe26b('0x47')](_0x334fa4);}})[_0xe26b('0x23')](function(_0x3e863c){if(_0x3e863c){return _0x3e863c?{'count':_0x4eab7c,'rows':_0x3e863c}:null;}})[_0xe26b('0x23')](respondWithResult(_0x149cee,null))[_0xe26b('0x42')](handleError(_0x149cee,null));};exports[_0xe26b('0x4b')]=function(_0x37271c,_0x5df6d3,_0xf7db0a){var _0xb871d1={};var _0x51dea5={};var _0x2236d6;var _0x8f7354;return db['SalesforceConfiguration'][_0xe26b('0x48')]({'where':{'id':_0x37271c['params']['id']}})[_0xe26b('0x23')](handleEntityNotFound(_0x5df6d3,null))[_0xe26b('0x23')](function(_0x43f87e){if(_0x43f87e){_0x2236d6=_0x43f87e;_0x51dea5[_0xe26b('0x2d')]=_[_0xe26b('0x2f')](db[_0xe26b('0x49')][_0xe26b('0x2a')]);_0x51dea5[_0xe26b('0x2e')]=_[_0xe26b('0x2f')](_0x37271c['query']);_0x51dea5[_0xe26b('0x30')]=_[_0xe26b('0x31')](_0x51dea5[_0xe26b('0x2d')],_0x51dea5[_0xe26b('0x2e')]);_0xb871d1['attributes']=_['intersection'](_0x51dea5[_0xe26b('0x2d')],qs[_0xe26b('0x33')](_0x37271c['query'][_0xe26b('0x33')]));_0xb871d1[_0xe26b('0x32')]=_0xb871d1['attributes'][_0xe26b('0x34')]?_0xb871d1['attributes']:_0x51dea5['model'];_0xb871d1[_0xe26b('0x37')]=qs[_0xe26b('0x38')](_0x37271c[_0xe26b('0x2e')][_0xe26b('0x38')]);_0xb871d1[_0xe26b('0x39')]=qs[_0xe26b('0x30')](_[_0xe26b('0x4a')](_0x37271c[_0xe26b('0x2e')],_0x51dea5[_0xe26b('0x30')]));if(_0x37271c[_0xe26b('0x2e')][_0xe26b('0x3a')]){_0xb871d1[_0xe26b('0x39')]=_['merge'](_0xb871d1[_0xe26b('0x39')],{'$or':_[_0xe26b('0x28')](_0xb871d1[_0xe26b('0x32')],function(_0x2ed16a){var _0x2cc0ff={};_0x2cc0ff[_0x2ed16a]={'$like':'%'+_0x37271c[_0xe26b('0x2e')]['filter']+'%'};return _0x2cc0ff;})});}_0xb871d1=_['merge']({},_0xb871d1,_0x37271c[_0xe26b('0x3d')]);return _0x2236d6['getSubjects'](_0xb871d1);}})[_0xe26b('0x23')](function(_0x2f2c51){if(_0x2f2c51){_0x8f7354=_0x2f2c51[_0xe26b('0x34')];if(!_0x37271c[_0xe26b('0x2e')][_0xe26b('0x35')]('nolimit')){_0xb871d1[_0xe26b('0x1e')]=qs['limit'](_0x37271c['query']['limit']);_0xb871d1[_0xe26b('0x1b')]=qs['offset'](_0x37271c['query'][_0xe26b('0x1b')]);}return _0x2236d6[_0xe26b('0x4b')](_0xb871d1);}})['then'](function(_0x3ece84){if(_0x3ece84){return _0x3ece84?{'count':_0x8f7354,'rows':_0x3ece84}:null;}})['then'](respondWithResult(_0x5df6d3,null))[_0xe26b('0x42')](handleError(_0x5df6d3,null));};exports['getDescriptions']=function(_0x19e840,_0x2c517a,_0x3a2c67){var _0x4bb48a={};var _0x37a030={};var _0x5b660e;var _0x57da71;return db['SalesforceConfiguration'][_0xe26b('0x48')]({'where':{'id':_0x19e840['params']['id']}})[_0xe26b('0x23')](handleEntityNotFound(_0x2c517a,null))[_0xe26b('0x23')](function(_0xf00774){if(_0xf00774){_0x5b660e=_0xf00774;_0x37a030[_0xe26b('0x2d')]=_[_0xe26b('0x2f')](db['SalesforceField'][_0xe26b('0x2a')]);_0x37a030['query']=_[_0xe26b('0x2f')](_0x19e840[_0xe26b('0x2e')]);_0x37a030[_0xe26b('0x30')]=_[_0xe26b('0x31')](_0x37a030[_0xe26b('0x2d')],_0x37a030[_0xe26b('0x2e')]);_0x4bb48a['attributes']=_[_0xe26b('0x31')](_0x37a030['model'],qs[_0xe26b('0x33')](_0x19e840[_0xe26b('0x2e')]['fields']));_0x4bb48a[_0xe26b('0x32')]=_0x4bb48a[_0xe26b('0x32')]['length']?_0x4bb48a[_0xe26b('0x32')]:_0x37a030[_0xe26b('0x2d')];_0x4bb48a[_0xe26b('0x37')]=qs[_0xe26b('0x38')](_0x19e840[_0xe26b('0x2e')]['sort']);_0x4bb48a[_0xe26b('0x39')]=qs['filters'](_['pick'](_0x19e840[_0xe26b('0x2e')],_0x37a030[_0xe26b('0x30')]));if(_0x19e840['query'][_0xe26b('0x3a')]){_0x4bb48a[_0xe26b('0x39')]=_[_0xe26b('0x3b')](_0x4bb48a[_0xe26b('0x39')],{'$or':_[_0xe26b('0x28')](_0x4bb48a['attributes'],function(_0x4bd2c3){var _0x88a1dc={};_0x88a1dc[_0x4bd2c3]={'$like':'%'+_0x19e840[_0xe26b('0x2e')][_0xe26b('0x3a')]+'%'};return _0x88a1dc;})});}_0x4bb48a=_[_0xe26b('0x3b')]({},_0x4bb48a,_0x19e840['options']);return _0x5b660e['getDescriptions'](_0x4bb48a);}})[_0xe26b('0x23')](function(_0x289aed){if(_0x289aed){_0x57da71=_0x289aed[_0xe26b('0x34')];if(!_0x19e840[_0xe26b('0x2e')][_0xe26b('0x35')](_0xe26b('0x36'))){_0x4bb48a['limit']=qs[_0xe26b('0x1e')](_0x19e840[_0xe26b('0x2e')]['limit']);_0x4bb48a[_0xe26b('0x1b')]=qs['offset'](_0x19e840[_0xe26b('0x2e')][_0xe26b('0x1b')]);}return _0x5b660e['getDescriptions'](_0x4bb48a);}})[_0xe26b('0x23')](function(_0x34ea44){if(_0x34ea44){return _0x34ea44?{'count':_0x57da71,'rows':_0x34ea44}:null;}})[_0xe26b('0x23')](respondWithResult(_0x2c517a,null))[_0xe26b('0x42')](handleError(_0x2c517a,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7d84275..55213ce 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 _0x6940=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util','../../config/logger','bluebird'];(function(_0x3d1752,_0x326854){var _0x14dd8b=function(_0x4a4737){while(--_0x4a4737){_0x3d1752['push'](_0x3d1752['shift']());}};_0x14dd8b(++_0x326854);}(_0x6940,0x1dc));var _0x0694=function(_0x564d10,_0x441426){_0x564d10=_0x564d10-0x0;var _0x3b0ce3=_0x6940[_0x564d10];return _0x3b0ce3;};'use strict';var _=require(_0x0694('0x0'));var util=require(_0x0694('0x1'));var logger=require(_0x0694('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0694('0x3'));var rp=require(_0x0694('0x4'));var fs=require('fs');var path=require(_0x0694('0x5'));var rimraf=require(_0x0694('0x6'));var config=require(_0x0694('0x7'));var attributes=require(_0x0694('0x8'));module[_0x0694('0x9')]=function(_0xa8d386,_0x10eaf8){return _0xa8d386[_0x0694('0xa')](_0x0694('0xb'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ab=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa4ab,0x9c));var _0xba4a=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0xa4ab[_0x3b6652];return _0x14d39f;};'use strict';var _=require(_0xba4a('0x0'));var util=require(_0xba4a('0x1'));var logger=require(_0xba4a('0x2'))(_0xba4a('0x3'));var moment=require(_0xba4a('0x4'));var BPromise=require(_0xba4a('0x5'));var rp=require(_0xba4a('0x6'));var fs=require('fs');var path=require(_0xba4a('0x7'));var rimraf=require(_0xba4a('0x8'));var config=require(_0xba4a('0x9'));var attributes=require(_0xba4a('0xa'));module['exports']=function(_0x3cf46b,_0x55a528){return _0x3cf46b['define'](_0xba4a('0xb'),attributes,{'tableName':_0xba4a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index d2ac877..b239835 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 _0x035c=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','request','then','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','util','bluebird'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x035c,0x1a0));var _0xc035=function(_0x4cc404,_0x26bea1){_0x4cc404=_0x4cc404-0x0;var _0x3389cf=_0x035c[_0x4cc404];return _0x3389cf;};'use strict';var _=require('lodash');var util=require(_0xc035('0x0'));var moment=require('moment');var BPromise=require(_0xc035('0x1'));var rs=require(_0xc035('0x2'));var fs=require('fs');var Redis=require(_0xc035('0x3'));var db=require(_0xc035('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc035('0x5'))('rpc');var config=require(_0xc035('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc035('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31ad23,_0x4d4685,_0x9caca2){return new BPromise(function(_0x4ec5c9,_0x19dbc5){return client[_0xc035('0x8')](_0x31ad23,_0x9caca2)[_0xc035('0x9')](function(_0x50fb3f){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4d4685,_0xc035('0xa'));logger['debug'](_0xc035('0xb'),_0x4d4685,_0xc035('0xa'),JSON[_0xc035('0xc')](_0x50fb3f));if(_0x50fb3f[_0xc035('0xd')]){if(_0x50fb3f[_0xc035('0xd')]['code']===0x1f4){logger[_0xc035('0xd')](_0xc035('0xe'),_0x4d4685,_0x50fb3f[_0xc035('0xd')][_0xc035('0xf')]);return _0x19dbc5(_0x50fb3f[_0xc035('0xd')][_0xc035('0xf')]);}logger[_0xc035('0xd')](_0xc035('0xe'),_0x4d4685,_0x50fb3f[_0xc035('0xd')][_0xc035('0xf')]);return _0x4ec5c9(_0x50fb3f[_0xc035('0xd')][_0xc035('0xf')]);}else{logger[_0xc035('0x10')](_0xc035('0xe'),_0x4d4685,'request\x20sent');_0x4ec5c9(_0x50fb3f[_0xc035('0x11')][_0xc035('0xf')]);}})[_0xc035('0x12')](function(_0x2ccac6){logger['error'](_0xc035('0xe'),_0x4d4685,_0x2ccac6);_0x19dbc5(_0x2ccac6);});});} \ No newline at end of file +var _0x84c2=['stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x28a6ad,_0x351697){var _0xbb804=function(_0x165d37){while(--_0x165d37){_0x28a6ad['push'](_0x28a6ad['shift']());}};_0xbb804(++_0x351697);}(_0x84c2,0x7c));var _0x284c=function(_0x151f23,_0x533521){_0x151f23=_0x151f23-0x0;var _0x3c13a7=_0x84c2[_0x151f23];return _0x3c13a7;};'use strict';var _=require(_0x284c('0x0'));var util=require(_0x284c('0x1'));var moment=require(_0x284c('0x2'));var BPromise=require(_0x284c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x284c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x284c('0x5'))('rpc');var config=require(_0x284c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x284c('0x7')][_0x284c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e4131,_0x54ce15,_0x4fff0d){return new BPromise(function(_0x61e660,_0x4ee59f){return client[_0x284c('0x9')](_0x2e4131,_0x4fff0d)[_0x284c('0xa')](function(_0x1a3c69){logger[_0x284c('0xb')](_0x284c('0xc'),_0x54ce15,_0x284c('0xd'));logger[_0x284c('0xe')](_0x284c('0xf'),_0x54ce15,'request\x20sent',JSON[_0x284c('0x10')](_0x1a3c69));if(_0x1a3c69[_0x284c('0x11')]){if(_0x1a3c69['error']['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x54ce15,_0x1a3c69[_0x284c('0x11')][_0x284c('0x12')]);return _0x4ee59f(_0x1a3c69[_0x284c('0x11')]['message']);}logger[_0x284c('0x11')](_0x284c('0xc'),_0x54ce15,_0x1a3c69['error'][_0x284c('0x12')]);return _0x61e660(_0x1a3c69['error'][_0x284c('0x12')]);}else{logger[_0x284c('0xb')](_0x284c('0xc'),_0x54ce15,'request\x20sent');_0x61e660(_0x1a3c69['result'][_0x284c('0x12')]);}})[_0x284c('0x13')](function(_0x2355a3){logger[_0x284c('0x11')](_0x284c('0xc'),_0x54ce15,_0x2355a3);_0x4ee59f(_0x2355a3);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index d8156ab..b1edf29 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 _0xb13c=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x476d70,_0x529390){var _0x30cd28=function(_0x4972ed){while(--_0x4972ed){_0x476d70['push'](_0x476d70['shift']());}};_0x30cd28(++_0x529390);}(_0xb13c,0x151));var _0xcb13=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xb13c[_0x1a7846];return _0x48049;};'use strict';var multer=require(_0xcb13('0x0'));var util=require(_0xcb13('0x1'));var path=require(_0xcb13('0x2'));var timeout=require(_0xcb13('0x3'));var express=require(_0xcb13('0x4'));var router=express[_0xcb13('0x5')]();var fs_extra=require(_0xcb13('0x6'));var auth=require(_0xcb13('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcb13('0x8'));var controller=require('./intSalesforceField.controller');router[_0xcb13('0x9')]('/',auth[_0xcb13('0xa')](),controller['index']);router['get'](_0xcb13('0xb'),auth[_0xcb13('0xa')](),controller[_0xcb13('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcb13('0xd')]);router[_0xcb13('0xe')](_0xcb13('0xb'),auth[_0xcb13('0xa')](),controller[_0xcb13('0xf')]);router[_0xcb13('0x10')](_0xcb13('0xb'),auth[_0xcb13('0xa')](),controller['destroy']);module[_0xcb13('0x11')]=router; \ No newline at end of file +var _0x58c4=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id'];(function(_0x5704b2,_0x43d817){var _0x188c8a=function(_0x4150f1){while(--_0x4150f1){_0x5704b2['push'](_0x5704b2['shift']());}};_0x188c8a(++_0x43d817);}(_0x58c4,0x1a7));var _0x458c=function(_0x287ff4,_0x49dc66){_0x287ff4=_0x287ff4-0x0;var _0x4c1ebb=_0x58c4[_0x287ff4];return _0x4c1ebb;};'use strict';var multer=require(_0x458c('0x0'));var util=require(_0x458c('0x1'));var path=require(_0x458c('0x2'));var timeout=require(_0x458c('0x3'));var express=require(_0x458c('0x4'));var router=express[_0x458c('0x5')]();var fs_extra=require(_0x458c('0x6'));var auth=require(_0x458c('0x7'));var interaction=require(_0x458c('0x8'));var config=require(_0x458c('0x9'));var controller=require('./intSalesforceField.controller');router[_0x458c('0xa')]('/',auth[_0x458c('0xb')](),controller[_0x458c('0xc')]);router[_0x458c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x458c('0xd')]('/',auth[_0x458c('0xb')](),controller[_0x458c('0xe')]);router[_0x458c('0xf')](_0x458c('0x10'),auth[_0x458c('0xb')](),controller[_0x458c('0x11')]);router[_0x458c('0x12')](_0x458c('0x10'),auth[_0x458c('0xb')](),controller['destroy']);module[_0x458c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b7dd17f..e4e3d6c 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 _0x460f=['ENUM','variable','sequelize','exports','picklist','STRING'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x460f,0x104));var _0xf460=function(_0x1e099f,_0x470a08){_0x1e099f=_0x1e099f-0x0;var _0x2027a3=_0x460f[_0x1e099f];return _0x2027a3;};'use strict';var Sequelize=require(_0xf460('0x0'));module[_0xf460('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue',_0xf460('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf460('0x3')]},'key':{'type':Sequelize[_0xf460('0x3')]},'keyType':{'type':Sequelize[_0xf460('0x4')]('string',_0xf460('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0xf460('0x3')]},'idField':{'type':Sequelize[_0xf460('0x3')]},'variableName':{'type':Sequelize[_0xf460('0x3')]}}; \ No newline at end of file +var _0x09f2=['sequelize','exports','ENUM','string','keyValue','picklist','STRING','variable','customVariable'];(function(_0x574440,_0x15fb7a){var _0x49970b=function(_0x1fad5e){while(--_0x1fad5e){_0x574440['push'](_0x574440['shift']());}};_0x49970b(++_0x15fb7a);}(_0x09f2,0xd8));var _0x209f=function(_0x2ee751,_0x3dc6ea){_0x2ee751=_0x2ee751-0x0;var _0x2362f0=_0x09f2[_0x2ee751];return _0x2362f0;};'use strict';var Sequelize=require(_0x209f('0x0'));module[_0x209f('0x1')]={'type':{'type':Sequelize[_0x209f('0x2')](_0x209f('0x3'),'variable','customVariable',_0x209f('0x4'),_0x209f('0x5')),'defaultValue':_0x209f('0x3')},'content':{'type':Sequelize[_0x209f('0x6')]},'key':{'type':Sequelize[_0x209f('0x6')]},'keyType':{'type':Sequelize[_0x209f('0x2')](_0x209f('0x3'),_0x209f('0x7'),_0x209f('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x209f('0x6')]},'variableName':{'type':Sequelize[_0x209f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index dbe3ad5..3724b3b 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 _0xd1cd=['SalesforceField','findAll','show','length','find','create','body','catch','update','params','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1cd,0xa6));var _0xdd1c=function(_0x55d0bd,_0x5cf488){_0x55d0bd=_0x55d0bd-0x0;var _0x1f60d5=_0xd1cd[_0x55d0bd];return _0x1f60d5;};'use strict';var emlformat=require(_0xdd1c('0x0'));var rimraf=require(_0xdd1c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd1c('0x2'));var rp=require('request-promise');var moment=require(_0xdd1c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdd1c('0x4'));var util=require('util');var path=require(_0xdd1c('0x5'));var sox=require(_0xdd1c('0x6'));var csv=require(_0xdd1c('0x7'));var ejs=require(_0xdd1c('0x8'));var fs=require('fs');var fs_extra=require(_0xdd1c('0x9'));var _=require(_0xdd1c('0xa'));var squel=require(_0xdd1c('0xb'));var crypto=require(_0xdd1c('0xc'));var jsforce=require(_0xdd1c('0xd'));var deskjs=require(_0xdd1c('0xe'));var toCsv=require(_0xdd1c('0x7'));var querystring=require(_0xdd1c('0xf'));var Papa=require(_0xdd1c('0x10'));var Redis=require(_0xdd1c('0x11'));var authService=require(_0xdd1c('0x12'));var qs=require(_0xdd1c('0x13'));var as=require(_0xdd1c('0x14'));var hardwareService=require(_0xdd1c('0x15'));var logger=require(_0xdd1c('0x16'))('api');var utils=require(_0xdd1c('0x17'));var config=require(_0xdd1c('0x18'));var licenseUtil=require(_0xdd1c('0x19'));var db=require(_0xdd1c('0x1a'))['db'];function respondWithStatusCode(_0x2cb70f,_0x44d09c){_0x44d09c=_0x44d09c||0xcc;return function(_0x3ed3b1){if(_0x3ed3b1){return _0x2cb70f[_0xdd1c('0x1b')](_0x44d09c);}return _0x2cb70f['status'](_0x44d09c)[_0xdd1c('0x1c')]();};}function respondWithResult(_0x1c229c,_0x146257){_0x146257=_0x146257||0xc8;return function(_0x4ef87b){if(_0x4ef87b){return _0x1c229c[_0xdd1c('0x1d')](_0x146257)[_0xdd1c('0x1e')](_0x4ef87b);}};}function respondWithFilteredResult(_0x3f6407,_0x494b66){return function(_0x210fb8){if(_0x210fb8){var _0x2f8227=typeof _0x494b66['offset']===_0xdd1c('0x1f')&&typeof _0x494b66[_0xdd1c('0x20')]===_0xdd1c('0x1f');var _0x207913=_0x210fb8[_0xdd1c('0x21')];var _0x3e6e1a=_0x2f8227?0x0:_0x494b66[_0xdd1c('0x22')];var _0x408b06=_0x2f8227?_0x210fb8[_0xdd1c('0x21')]:_0x494b66[_0xdd1c('0x22')]+_0x494b66[_0xdd1c('0x20')];var _0x8fe227;if(_0x408b06>=_0x207913){_0x408b06=_0x207913;_0x8fe227=0xc8;}else{_0x8fe227=0xce;}_0x3f6407[_0xdd1c('0x1d')](_0x8fe227);return _0x3f6407['set'](_0xdd1c('0x23'),_0x3e6e1a+'-'+_0x408b06+'/'+_0x207913)['json'](_0x210fb8);}return null;};}function patchUpdates(_0x4098ed){return function(_0x53f7ed){try{jsonpatch[_0xdd1c('0x24')](_0x53f7ed,_0x4098ed,!![]);}catch(_0x9cb24e){return BPromise[_0xdd1c('0x25')](_0x9cb24e);}return _0x53f7ed[_0xdd1c('0x26')]();};}function saveUpdates(_0x469f8,_0x2ea9ad){return function(_0x40a190){if(_0x40a190){return _0x40a190['update'](_0x469f8)[_0xdd1c('0x27')](function(_0x4e66b1){return _0x4e66b1;});}return null;};}function removeEntity(_0x2fbd10,_0xe3af69){return function(_0x1a9ccb){if(_0x1a9ccb){return _0x1a9ccb[_0xdd1c('0x28')]()['then'](function(){_0x2fbd10['status'](0xcc)[_0xdd1c('0x1c')]();});}};}function handleEntityNotFound(_0xecf407,_0x185240){return function(_0x13c782){if(!_0x13c782){_0xecf407[_0xdd1c('0x1b')](0x194);}return _0x13c782;};}function handleError(_0x4343a7,_0x49c77f){_0x49c77f=_0x49c77f||0x1f4;return function(_0x83e4a6){logger[_0xdd1c('0x29')](_0x83e4a6[_0xdd1c('0x2a')]);if(_0x83e4a6[_0xdd1c('0x2b')]){delete _0x83e4a6[_0xdd1c('0x2b')];}_0x4343a7['status'](_0x49c77f)[_0xdd1c('0x2c')](_0x83e4a6);};}exports[_0xdd1c('0x2d')]=function(_0x3755bb,_0x72fd7c){var _0x45900f={},_0x5ae67b={},_0x574c56={'count':0x0,'rows':[]};var _0x15b054=_[_0xdd1c('0x2e')](db['SalesforceField'][_0xdd1c('0x2f')],function(_0x3648b6){return{'name':_0x3648b6[_0xdd1c('0x30')],'type':_0x3648b6[_0xdd1c('0x31')][_0xdd1c('0x32')]};});_0x5ae67b[_0xdd1c('0x33')]=_['map'](_0x15b054,_0xdd1c('0x2b'));_0x5ae67b[_0xdd1c('0x34')]=_[_0xdd1c('0x35')](_0x3755bb[_0xdd1c('0x34')]);_0x5ae67b['filters']=_[_0xdd1c('0x36')](_0x5ae67b[_0xdd1c('0x33')],_0x5ae67b[_0xdd1c('0x34')]);_0x45900f['attributes']=_[_0xdd1c('0x36')](_0x5ae67b[_0xdd1c('0x33')],qs[_0xdd1c('0x37')](_0x3755bb[_0xdd1c('0x34')][_0xdd1c('0x37')]));_0x45900f['attributes']=_0x45900f[_0xdd1c('0x38')]['length']?_0x45900f[_0xdd1c('0x38')]:_0x5ae67b[_0xdd1c('0x33')];if(!_0x3755bb[_0xdd1c('0x34')]['hasOwnProperty']('nolimit')){_0x45900f[_0xdd1c('0x20')]=qs[_0xdd1c('0x20')](_0x3755bb[_0xdd1c('0x34')][_0xdd1c('0x20')]);_0x45900f[_0xdd1c('0x22')]=qs[_0xdd1c('0x22')](_0x3755bb['query'][_0xdd1c('0x22')]);}_0x45900f[_0xdd1c('0x39')]=qs[_0xdd1c('0x3a')](_0x3755bb[_0xdd1c('0x34')]['sort']);_0x45900f[_0xdd1c('0x3b')]=qs[_0xdd1c('0x3c')](_[_0xdd1c('0x3d')](_0x3755bb[_0xdd1c('0x34')],_0x5ae67b[_0xdd1c('0x3c')]),_0x15b054);if(_0x3755bb[_0xdd1c('0x34')][_0xdd1c('0x3e')]){_0x45900f['where']=_[_0xdd1c('0x3f')](_0x45900f[_0xdd1c('0x3b')],{'$or':_[_0xdd1c('0x2e')](_0x15b054,function(_0x4394fd){if(_0x4394fd['type']!==_0xdd1c('0x40')){var _0x52a055={};_0x52a055[_0x4394fd[_0xdd1c('0x2b')]]={'$like':'%'+_0x3755bb[_0xdd1c('0x34')][_0xdd1c('0x3e')]+'%'};return _0x52a055;}})});}_0x45900f=_[_0xdd1c('0x3f')]({},_0x45900f,_0x3755bb[_0xdd1c('0x41')]);var _0x5ab42a={'where':_0x45900f[_0xdd1c('0x3b')]};return db['SalesforceField'][_0xdd1c('0x21')](_0x5ab42a)['then'](function(_0x33250f){_0x574c56[_0xdd1c('0x21')]=_0x33250f;if(_0x3755bb[_0xdd1c('0x34')][_0xdd1c('0x42')]){_0x45900f[_0xdd1c('0x43')]=[{'all':!![]}];}return db[_0xdd1c('0x44')][_0xdd1c('0x45')](_0x45900f);})[_0xdd1c('0x27')](function(_0x3b01bf){_0x574c56['rows']=_0x3b01bf;return _0x574c56;})[_0xdd1c('0x27')](respondWithFilteredResult(_0x72fd7c,_0x45900f))['catch'](handleError(_0x72fd7c,null));};exports[_0xdd1c('0x46')]=function(_0x1e629f,_0x2d32c8){var _0x5da4e0={'raw':!![],'where':{'id':_0x1e629f['params']['id']}},_0x704840={};_0x704840[_0xdd1c('0x33')]=_[_0xdd1c('0x35')](db[_0xdd1c('0x44')]['rawAttributes']);_0x704840[_0xdd1c('0x34')]=_['keys'](_0x1e629f[_0xdd1c('0x34')]);_0x704840[_0xdd1c('0x3c')]=_[_0xdd1c('0x36')](_0x704840['model'],_0x704840[_0xdd1c('0x34')]);_0x5da4e0['attributes']=_[_0xdd1c('0x36')](_0x704840[_0xdd1c('0x33')],qs['fields'](_0x1e629f[_0xdd1c('0x34')]['fields']));_0x5da4e0[_0xdd1c('0x38')]=_0x5da4e0[_0xdd1c('0x38')][_0xdd1c('0x47')]?_0x5da4e0[_0xdd1c('0x38')]:_0x704840[_0xdd1c('0x33')];if(_0x1e629f[_0xdd1c('0x34')][_0xdd1c('0x42')]){_0x5da4e0[_0xdd1c('0x43')]=[{'all':!![]}];}_0x5da4e0=_['merge']({},_0x5da4e0,_0x1e629f[_0xdd1c('0x41')]);return db[_0xdd1c('0x44')][_0xdd1c('0x48')](_0x5da4e0)[_0xdd1c('0x27')](handleEntityNotFound(_0x2d32c8,null))['then'](respondWithResult(_0x2d32c8,null))['catch'](handleError(_0x2d32c8,null));};exports[_0xdd1c('0x49')]=function(_0x5a6462,_0x2c9fdb){return db[_0xdd1c('0x44')][_0xdd1c('0x49')](_0x5a6462[_0xdd1c('0x4a')],{})[_0xdd1c('0x27')](respondWithResult(_0x2c9fdb,0xc9))[_0xdd1c('0x4b')](handleError(_0x2c9fdb,null));};exports[_0xdd1c('0x4c')]=function(_0x59c338,_0x197c39){if(_0x59c338[_0xdd1c('0x4a')]['id']){delete _0x59c338['body']['id'];}return db[_0xdd1c('0x44')][_0xdd1c('0x48')]({'where':{'id':_0x59c338[_0xdd1c('0x4d')]['id']}})[_0xdd1c('0x27')](handleEntityNotFound(_0x197c39,null))[_0xdd1c('0x27')](saveUpdates(_0x59c338['body'],null))['then'](respondWithResult(_0x197c39,null))[_0xdd1c('0x4b')](handleError(_0x197c39,null));};exports['destroy']=function(_0x365236,_0x14a7e6){return db[_0xdd1c('0x44')][_0xdd1c('0x48')]({'where':{'id':_0x365236[_0xdd1c('0x4d')]['id']}})[_0xdd1c('0x27')](handleEntityNotFound(_0x14a7e6,null))[_0xdd1c('0x27')](removeEntity(_0x14a7e6,null))[_0xdd1c('0x4b')](handleError(_0x14a7e6,null));}; \ No newline at end of file +var _0xb2ad=['catch','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','limit','undefined','count','offset','status','set','Content-Range','json','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','includeAll','find'];(function(_0x585734,_0x48dab4){var _0x402561=function(_0xfd8d43){while(--_0xfd8d43){_0x585734['push'](_0x585734['shift']());}};_0x402561(++_0x48dab4);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x389789,_0x5034d3){_0x389789=_0x389789-0x0;var _0x59d691=_0xb2ad[_0x389789];return _0x59d691;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb2a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdb2a('0x1'));var rp=require(_0xdb2a('0x2'));var moment=require(_0xdb2a('0x3'));var BPromise=require(_0xdb2a('0x4'));var Mustache=require(_0xdb2a('0x5'));var util=require('util');var path=require(_0xdb2a('0x6'));var sox=require(_0xdb2a('0x7'));var csv=require(_0xdb2a('0x8'));var ejs=require(_0xdb2a('0x9'));var fs=require('fs');var fs_extra=require(_0xdb2a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb2a('0xb'));var jsforce=require(_0xdb2a('0xc'));var deskjs=require(_0xdb2a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdb2a('0xe'));var Papa=require(_0xdb2a('0xf'));var Redis=require('ioredis');var authService=require(_0xdb2a('0x10'));var qs=require(_0xdb2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb2a('0x12'))(_0xdb2a('0x13'));var utils=require(_0xdb2a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdb2a('0x15'));var db=require(_0xdb2a('0x16'))['db'];function respondWithStatusCode(_0x5c6688,_0x5f4a7b){_0x5f4a7b=_0x5f4a7b||0xcc;return function(_0x4e1cda){if(_0x4e1cda){return _0x5c6688[_0xdb2a('0x17')](_0x5f4a7b);}return _0x5c6688['status'](_0x5f4a7b)[_0xdb2a('0x18')]();};}function respondWithResult(_0x3c3ac3,_0x527af2){_0x527af2=_0x527af2||0xc8;return function(_0x33045a){if(_0x33045a){return _0x3c3ac3['status'](_0x527af2)['json'](_0x33045a);}};}function respondWithFilteredResult(_0x5d8282,_0x5dbbb1){return function(_0x8a580e){if(_0x8a580e){var _0x2df1fd=typeof _0x5dbbb1['offset']==='undefined'&&typeof _0x5dbbb1[_0xdb2a('0x19')]===_0xdb2a('0x1a');var _0x440dab=_0x8a580e[_0xdb2a('0x1b')];var _0x52508d=_0x2df1fd?0x0:_0x5dbbb1[_0xdb2a('0x1c')];var _0x2de4cf=_0x2df1fd?_0x8a580e[_0xdb2a('0x1b')]:_0x5dbbb1['offset']+_0x5dbbb1['limit'];var _0x424583;if(_0x2de4cf>=_0x440dab){_0x2de4cf=_0x440dab;_0x424583=0xc8;}else{_0x424583=0xce;}_0x5d8282[_0xdb2a('0x1d')](_0x424583);return _0x5d8282[_0xdb2a('0x1e')](_0xdb2a('0x1f'),_0x52508d+'-'+_0x2de4cf+'/'+_0x440dab)[_0xdb2a('0x20')](_0x8a580e);}return null;};}function patchUpdates(_0x5e6a59){return function(_0x5c3824){try{jsonpatch['apply'](_0x5c3824,_0x5e6a59,!![]);}catch(_0x444fcf){return BPromise['reject'](_0x444fcf);}return _0x5c3824['save']();};}function saveUpdates(_0x1e6985,_0x449fba){return function(_0x46910c){if(_0x46910c){return _0x46910c['update'](_0x1e6985)[_0xdb2a('0x21')](function(_0x871b44){return _0x871b44;});}return null;};}function removeEntity(_0x16035f,_0x391378){return function(_0x1f3d54){if(_0x1f3d54){return _0x1f3d54[_0xdb2a('0x22')]()['then'](function(){_0x16035f[_0xdb2a('0x1d')](0xcc)[_0xdb2a('0x18')]();});}};}function handleEntityNotFound(_0x5f00fb,_0x332911){return function(_0x3645e9){if(!_0x3645e9){_0x5f00fb[_0xdb2a('0x17')](0x194);}return _0x3645e9;};}function handleError(_0x28252e,_0x4dd822){_0x4dd822=_0x4dd822||0x1f4;return function(_0xc50c3d){logger[_0xdb2a('0x23')](_0xc50c3d[_0xdb2a('0x24')]);if(_0xc50c3d[_0xdb2a('0x25')]){delete _0xc50c3d['name'];}_0x28252e[_0xdb2a('0x1d')](_0x4dd822)[_0xdb2a('0x26')](_0xc50c3d);};}exports[_0xdb2a('0x27')]=function(_0x2b1c6d,_0x235c06){var _0x565889={},_0x852103={},_0x19e39c={'count':0x0,'rows':[]};var _0x42cc46=_[_0xdb2a('0x28')](db[_0xdb2a('0x29')][_0xdb2a('0x2a')],function(_0x134053){return{'name':_0x134053[_0xdb2a('0x2b')],'type':_0x134053[_0xdb2a('0x2c')][_0xdb2a('0x2d')]};});_0x852103[_0xdb2a('0x2e')]=_[_0xdb2a('0x28')](_0x42cc46,_0xdb2a('0x25'));_0x852103[_0xdb2a('0x2f')]=_[_0xdb2a('0x30')](_0x2b1c6d[_0xdb2a('0x2f')]);_0x852103[_0xdb2a('0x31')]=_[_0xdb2a('0x32')](_0x852103[_0xdb2a('0x2e')],_0x852103[_0xdb2a('0x2f')]);_0x565889['attributes']=_[_0xdb2a('0x32')](_0x852103[_0xdb2a('0x2e')],qs[_0xdb2a('0x33')](_0x2b1c6d['query'][_0xdb2a('0x33')]));_0x565889[_0xdb2a('0x34')]=_0x565889[_0xdb2a('0x34')][_0xdb2a('0x35')]?_0x565889[_0xdb2a('0x34')]:_0x852103[_0xdb2a('0x2e')];if(!_0x2b1c6d[_0xdb2a('0x2f')][_0xdb2a('0x36')](_0xdb2a('0x37'))){_0x565889[_0xdb2a('0x19')]=qs[_0xdb2a('0x19')](_0x2b1c6d[_0xdb2a('0x2f')][_0xdb2a('0x19')]);_0x565889[_0xdb2a('0x1c')]=qs[_0xdb2a('0x1c')](_0x2b1c6d['query'][_0xdb2a('0x1c')]);}_0x565889['order']=qs['sort'](_0x2b1c6d[_0xdb2a('0x2f')][_0xdb2a('0x38')]);_0x565889[_0xdb2a('0x39')]=qs[_0xdb2a('0x31')](_[_0xdb2a('0x3a')](_0x2b1c6d['query'],_0x852103['filters']),_0x42cc46);if(_0x2b1c6d[_0xdb2a('0x2f')]['filter']){_0x565889['where']=_[_0xdb2a('0x3b')](_0x565889[_0xdb2a('0x39')],{'$or':_[_0xdb2a('0x28')](_0x42cc46,function(_0x500616){if(_0x500616[_0xdb2a('0x2c')]!==_0xdb2a('0x3c')){var _0x2fa3e3={};_0x2fa3e3[_0x500616['name']]={'$like':'%'+_0x2b1c6d[_0xdb2a('0x2f')][_0xdb2a('0x3d')]+'%'};return _0x2fa3e3;}})});}_0x565889=_[_0xdb2a('0x3b')]({},_0x565889,_0x2b1c6d[_0xdb2a('0x3e')]);var _0x1efcf8={'where':_0x565889[_0xdb2a('0x39')]};return db[_0xdb2a('0x29')]['count'](_0x1efcf8)[_0xdb2a('0x21')](function(_0x170d7c){_0x19e39c[_0xdb2a('0x1b')]=_0x170d7c;if(_0x2b1c6d[_0xdb2a('0x2f')]['includeAll']){_0x565889[_0xdb2a('0x3f')]=[{'all':!![]}];}return db[_0xdb2a('0x29')]['findAll'](_0x565889);})[_0xdb2a('0x21')](function(_0x39c387){_0x19e39c[_0xdb2a('0x40')]=_0x39c387;return _0x19e39c;})[_0xdb2a('0x21')](respondWithFilteredResult(_0x235c06,_0x565889))['catch'](handleError(_0x235c06,null));};exports['show']=function(_0x4b14f8,_0x2e56b6){var _0x2c69d3={'raw':!![],'where':{'id':_0x4b14f8['params']['id']}},_0x54ffcc={};_0x54ffcc['model']=_['keys'](db[_0xdb2a('0x29')]['rawAttributes']);_0x54ffcc[_0xdb2a('0x2f')]=_[_0xdb2a('0x30')](_0x4b14f8[_0xdb2a('0x2f')]);_0x54ffcc[_0xdb2a('0x31')]=_['intersection'](_0x54ffcc[_0xdb2a('0x2e')],_0x54ffcc[_0xdb2a('0x2f')]);_0x2c69d3[_0xdb2a('0x34')]=_['intersection'](_0x54ffcc[_0xdb2a('0x2e')],qs[_0xdb2a('0x33')](_0x4b14f8[_0xdb2a('0x2f')][_0xdb2a('0x33')]));_0x2c69d3['attributes']=_0x2c69d3[_0xdb2a('0x34')]['length']?_0x2c69d3[_0xdb2a('0x34')]:_0x54ffcc['model'];if(_0x4b14f8['query'][_0xdb2a('0x41')]){_0x2c69d3[_0xdb2a('0x3f')]=[{'all':!![]}];}_0x2c69d3=_[_0xdb2a('0x3b')]({},_0x2c69d3,_0x4b14f8[_0xdb2a('0x3e')]);return db[_0xdb2a('0x29')][_0xdb2a('0x42')](_0x2c69d3)[_0xdb2a('0x21')](handleEntityNotFound(_0x2e56b6,null))['then'](respondWithResult(_0x2e56b6,null))[_0xdb2a('0x43')](handleError(_0x2e56b6,null));};exports[_0xdb2a('0x44')]=function(_0x1352a3,_0x300543){return db['SalesforceField'][_0xdb2a('0x44')](_0x1352a3[_0xdb2a('0x45')],{})['then'](respondWithResult(_0x300543,0xc9))[_0xdb2a('0x43')](handleError(_0x300543,null));};exports[_0xdb2a('0x46')]=function(_0x2daae5,_0x2079d4){if(_0x2daae5['body']['id']){delete _0x2daae5['body']['id'];}return db[_0xdb2a('0x29')]['find']({'where':{'id':_0x2daae5[_0xdb2a('0x47')]['id']}})['then'](handleEntityNotFound(_0x2079d4,null))[_0xdb2a('0x21')](saveUpdates(_0x2daae5[_0xdb2a('0x45')],null))[_0xdb2a('0x21')](respondWithResult(_0x2079d4,null))['catch'](handleError(_0x2079d4,null));};exports[_0xdb2a('0x22')]=function(_0x471013,_0x1ebf04){return db['SalesforceField'][_0xdb2a('0x42')]({'where':{'id':_0x471013['params']['id']}})[_0xdb2a('0x21')](handleEntityNotFound(_0x1ebf04,null))[_0xdb2a('0x21')](removeEntity(_0x1ebf04,null))['catch'](handleError(_0x1ebf04,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 28b02c9..f78f4e1 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 _0x74cd=['idField','FieldId','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index'];(function(_0x5cb11d,_0x3c9eda){var _0x565ef2=function(_0x3d1fba){while(--_0x3d1fba){_0x5cb11d['push'](_0x5cb11d['shift']());}};_0x565ef2(++_0x3c9eda);}(_0x74cd,0xa7));var _0xd74c=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x74cd[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0xd74c('0x0'));var util=require(_0xd74c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd74c('0x2'));var BPromise=require(_0xd74c('0x3'));var rp=require(_0xd74c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd74c('0x5'));var config=require(_0xd74c('0x6'));var attributes=require(_0xd74c('0x7'));module[_0xd74c('0x8')]=function(_0xa28e23,_0x55d8f6){return _0xa28e23[_0xd74c('0x9')](_0xd74c('0xa'),attributes,{'tableName':_0xd74c('0xb'),'paranoid':![],'indexes':[{'name':_0xd74c('0xc'),'fields':[_0xd74c('0xd'),_0xd74c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce45=['./intSalesforceField.attributes','exports','define','SalesforceField','idField','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x3d619b,_0x49e8d5){var _0x1d462c=function(_0xa4bc5e){while(--_0xa4bc5e){_0x3d619b['push'](_0x3d619b['shift']());}};_0x1d462c(++_0x49e8d5);}(_0xce45,0x7d));var _0x5ce4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xce45[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5ce4('0x0'))('api');var moment=require(_0x5ce4('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce4('0x2'));var rimraf=require(_0x5ce4('0x3'));var config=require(_0x5ce4('0x4'));var attributes=require(_0x5ce4('0x5'));module[_0x5ce4('0x6')]=function(_0x17bf04,_0x3ef22a){return _0x17bf04[_0x5ce4('0x7')](_0x5ce4('0x8'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x5ce4('0x9'),'FieldId'],'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 93714b5..ee7388f 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 _0xfecb=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0xfecb,0x1e3));var _0xbfec=function(_0x5bd7e5,_0x363131){_0x5bd7e5=_0x5bd7e5-0x0;var _0x4007d7=_0xfecb[_0x5bd7e5];return _0x4007d7;};'use strict';var _=require(_0xbfec('0x0'));var util=require(_0xbfec('0x1'));var moment=require(_0xbfec('0x2'));var BPromise=require(_0xbfec('0x3'));var rs=require(_0xbfec('0x4'));var fs=require('fs');var Redis=require(_0xbfec('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbfec('0x6'))(_0xbfec('0x7'));var config=require(_0xbfec('0x8'));var jayson=require(_0xbfec('0x9'));var client=jayson[_0xbfec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x531c1a,_0x1025f0,_0x18e62b){return new BPromise(function(_0xa03e25,_0x13950e){return client[_0xbfec('0xb')](_0x531c1a,_0x18e62b)[_0xbfec('0xc')](function(_0x5f4e85){logger['info'](_0xbfec('0xd'),_0x1025f0,_0xbfec('0xe'));logger[_0xbfec('0xf')](_0xbfec('0x10'),_0x1025f0,_0xbfec('0xe'),JSON[_0xbfec('0x11')](_0x5f4e85));if(_0x5f4e85['error']){if(_0x5f4e85['error'][_0xbfec('0x12')]===0x1f4){logger[_0xbfec('0x13')](_0xbfec('0xd'),_0x1025f0,_0x5f4e85[_0xbfec('0x13')]['message']);return _0x13950e(_0x5f4e85[_0xbfec('0x13')][_0xbfec('0x14')]);}logger[_0xbfec('0x13')](_0xbfec('0xd'),_0x1025f0,_0x5f4e85[_0xbfec('0x13')][_0xbfec('0x14')]);return _0xa03e25(_0x5f4e85[_0xbfec('0x13')][_0xbfec('0x14')]);}else{logger[_0xbfec('0x15')]('SalesforceField,\x20%s,\x20%s',_0x1025f0,_0xbfec('0xe'));_0xa03e25(_0x5f4e85[_0xbfec('0x16')]['message']);}})['catch'](function(_0x11f7ca){logger[_0xbfec('0x13')](_0xbfec('0xd'),_0x1025f0,_0x11f7ca);_0x13950e(_0x11f7ca);});});} \ No newline at end of file +var _0x3f0a=['../../config/logger','rpc','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1a300b,_0xa3a361){var _0x26065a=function(_0x3e6d56){while(--_0x3e6d56){_0x1a300b['push'](_0x1a300b['shift']());}};_0x26065a(++_0xa3a361);}(_0x3f0a,0x1b1));var _0xa3f0=function(_0x2a69ae,_0x8514fe){_0x2a69ae=_0x2a69ae-0x0;var _0x1e6d11=_0x3f0a[_0x2a69ae];return _0x1e6d11;};'use strict';var _=require(_0xa3f0('0x0'));var util=require(_0xa3f0('0x1'));var moment=require(_0xa3f0('0x2'));var BPromise=require(_0xa3f0('0x3'));var rs=require(_0xa3f0('0x4'));var fs=require('fs');var Redis=require(_0xa3f0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3f0('0x6'));var logger=require(_0xa3f0('0x7'))(_0xa3f0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa3f0('0x9')][_0xa3f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9e06,_0x27ead3,_0x3fd763){return new BPromise(function(_0x27bbee,_0x2aaf56){return client[_0xa3f0('0xb')](_0x3d9e06,_0x3fd763)[_0xa3f0('0xc')](function(_0x5294cf){logger[_0xa3f0('0xd')](_0xa3f0('0xe'),_0x27ead3,_0xa3f0('0xf'));logger[_0xa3f0('0x10')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x27ead3,_0xa3f0('0xf'),JSON['stringify'](_0x5294cf));if(_0x5294cf[_0xa3f0('0x11')]){if(_0x5294cf[_0xa3f0('0x11')][_0xa3f0('0x12')]===0x1f4){logger[_0xa3f0('0x11')]('SalesforceField,\x20%s,\x20%s',_0x27ead3,_0x5294cf[_0xa3f0('0x11')][_0xa3f0('0x13')]);return _0x2aaf56(_0x5294cf[_0xa3f0('0x11')][_0xa3f0('0x13')]);}logger[_0xa3f0('0x11')](_0xa3f0('0xe'),_0x27ead3,_0x5294cf[_0xa3f0('0x11')][_0xa3f0('0x13')]);return _0x27bbee(_0x5294cf[_0xa3f0('0x11')]['message']);}else{logger[_0xa3f0('0xd')](_0xa3f0('0xe'),_0x27ead3,_0xa3f0('0xf'));_0x27bbee(_0x5294cf[_0xa3f0('0x14')][_0xa3f0('0x13')]);}})[_0xa3f0('0x15')](function(_0x52ee14){logger[_0xa3f0('0x11')](_0xa3f0('0xe'),_0x27ead3,_0x52ee14);_0x2aaf56(_0x52ee14);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index e51ad36..f173529 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 _0xef38=['/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index'];(function(_0x4bd62c,_0x70959f){var _0x9e6d04=function(_0x4a401e){while(--_0x4a401e){_0x4bd62c['push'](_0x4bd62c['shift']());}};_0x9e6d04(++_0x70959f);}(_0xef38,0x122));var _0x8ef3=function(_0x4ff9f9,_0x54bf8c){_0x4ff9f9=_0x4ff9f9-0x0;var _0x45c57b=_0xef38[_0x4ff9f9];return _0x45c57b;};'use strict';var multer=require('multer');var util=require(_0x8ef3('0x0'));var path=require(_0x8ef3('0x1'));var timeout=require(_0x8ef3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ef3('0x3'));var auth=require(_0x8ef3('0x4'));var interaction=require(_0x8ef3('0x5'));var config=require(_0x8ef3('0x6'));var controller=require(_0x8ef3('0x7'));router['get']('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x9')]);router['get'](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xb')]);router[_0x8ef3('0xc')](_0x8ef3('0xd'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xe')]);router['get'](_0x8ef3('0xf'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x10')]);router[_0x8ef3('0x11')]('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x12')]);router[_0x8ef3('0x11')](_0x8ef3('0xd'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x13')]);router[_0x8ef3('0x14')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x15')]);router[_0x8ef3('0x16')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x17')]);module[_0x8ef3('0x18')]=router; \ No newline at end of file +var _0x1db3=['/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x59f1dd,_0x4328ec){var _0x14e459=function(_0x95973){while(--_0x95973){_0x59f1dd['push'](_0x59f1dd['shift']());}};_0x14e459(++_0x4328ec);}(_0x1db3,0x1e5));var _0x31db=function(_0x5ebdc4,_0x1f2f61){_0x5ebdc4=_0x5ebdc4-0x0;var _0x234bd2=_0x1db3[_0x5ebdc4];return _0x234bd2;};'use strict';var multer=require('multer');var util=require(_0x31db('0x0'));var path=require(_0x31db('0x1'));var timeout=require(_0x31db('0x2'));var express=require(_0x31db('0x3'));var router=express[_0x31db('0x4')]();var fs_extra=require(_0x31db('0x5'));var auth=require(_0x31db('0x6'));var interaction=require(_0x31db('0x7'));var config=require(_0x31db('0x8'));var controller=require(_0x31db('0x9'));router[_0x31db('0xa')]('/',auth[_0x31db('0xb')](),controller[_0x31db('0xc')]);router[_0x31db('0xa')](_0x31db('0xd'),auth[_0x31db('0xb')](),controller[_0x31db('0xe')]);router[_0x31db('0xa')](_0x31db('0xf'),auth['isAuthenticated'](),controller[_0x31db('0x10')]);router[_0x31db('0xa')](_0x31db('0x11'),auth[_0x31db('0xb')](),controller[_0x31db('0x12')]);router['post']('/',auth[_0x31db('0xb')](),controller[_0x31db('0x13')]);router[_0x31db('0x14')]('/:id/configurations',auth[_0x31db('0xb')](),controller[_0x31db('0x15')]);router[_0x31db('0x16')](_0x31db('0xd'),auth[_0x31db('0xb')](),controller[_0x31db('0x17')]);router['delete']('/:id',auth[_0x31db('0xb')](),controller['destroy']);module[_0x31db('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d7f8f5c..176d399 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 _0x75fa=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4f14c1,_0x41d1f8){var _0x9cb889=function(_0x48193d){while(--_0x48193d){_0x4f14c1['push'](_0x4f14c1['shift']());}};_0x9cb889(++_0x41d1f8);}(_0x75fa,0x65));var _0xa75f=function(_0x5ce18c,_0xa05fe9){_0x5ce18c=_0x5ce18c-0x0;var _0x29bbad=_0x75fa[_0x5ce18c];return _0x29bbad;};'use strict';var Sequelize=require(_0xa75f('0x0'));module[_0xa75f('0x1')]={'name':{'type':Sequelize[_0xa75f('0x2')]},'description':{'type':Sequelize[_0xa75f('0x2')]},'username':{'type':Sequelize[_0xa75f('0x2')],'unique':_0xa75f('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa75f('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xa75f('0x4')},'serverUrl':{'type':Sequelize[_0xa75f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa3b5=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4f3267,_0x5f04f9){var _0x228a2d=function(_0x42b02d){while(--_0x42b02d){_0x4f3267['push'](_0x4f3267['shift']());}};_0x228a2d(++_0x5f04f9);}(_0xa3b5,0xe7));var _0x5a3b=function(_0x2df4f2,_0x311156){_0x2df4f2=_0x2df4f2-0x0;var _0x3893e0=_0xa3b5[_0x2df4f2];return _0x3893e0;};'use strict';var Sequelize=require(_0x5a3b('0x0'));module[_0x5a3b('0x1')]={'name':{'type':Sequelize[_0x5a3b('0x2')]},'description':{'type':Sequelize[_0x5a3b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x5a3b('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5a3b('0x2')]},'remoteUri':{'type':Sequelize[_0x5a3b('0x2')],'unique':_0x5a3b('0x4')},'serverUrl':{'type':Sequelize[_0x5a3b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 260621c..f566309 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 _0xb6a7=['ServicenowAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','body','catch','destroy','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','Descriptions','channel','ServicenowConfiguration','create','ServicenowField','getFields','hold_reason','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','knowledge','order','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','work_end','resolved_at','approval_set','work_notes','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','correlation_id','location','password','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','label','push','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','true','false','sys_choice?sysparm_query=name=incident^element=','result','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index'];(function(_0x4363d0,_0x52508e){var _0x14d9bb=function(_0x143030){while(--_0x143030){_0x4363d0['push'](_0x4363d0['shift']());}};_0x14d9bb(++_0x52508e);}(_0xb6a7,0x13b));var _0x7b6a=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xb6a7[_0xd22d95];return _0x15d7a3;};'use strict';var emlformat=require(_0x7b6a('0x0'));var rimraf=require(_0x7b6a('0x1'));var zipdir=require(_0x7b6a('0x2'));var jsonpatch=require(_0x7b6a('0x3'));var rp=require(_0x7b6a('0x4'));var moment=require(_0x7b6a('0x5'));var BPromise=require(_0x7b6a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7b6a('0x7'));var sox=require(_0x7b6a('0x8'));var csv=require(_0x7b6a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b6a('0xa'));var _=require('lodash');var squel=require(_0x7b6a('0xb'));var crypto=require(_0x7b6a('0xc'));var jsforce=require(_0x7b6a('0xd'));var deskjs=require(_0x7b6a('0xe'));var toCsv=require(_0x7b6a('0x9'));var querystring=require(_0x7b6a('0xf'));var Papa=require(_0x7b6a('0x10'));var Redis=require(_0x7b6a('0x11'));var authService=require(_0x7b6a('0x12'));var qs=require(_0x7b6a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b6a('0x14'))('api');var utils=require(_0x7b6a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3bd6c9,_0x40d10a){_0x40d10a=_0x40d10a||0xcc;return function(_0x148046){if(_0x148046){return _0x3bd6c9['sendStatus'](_0x40d10a);}return _0x3bd6c9[_0x7b6a('0x16')](_0x40d10a)[_0x7b6a('0x17')]();};}function respondWithResult(_0x4f9557,_0x9c184){_0x9c184=_0x9c184||0xc8;return function(_0x410261){if(_0x410261){return _0x4f9557[_0x7b6a('0x16')](_0x9c184)['json'](_0x410261);}};}function respondWithFilteredResult(_0x59f33e,_0x3122f6){return function(_0x4738ce){if(_0x4738ce){var _0x115d68=typeof _0x3122f6[_0x7b6a('0x18')]===_0x7b6a('0x19')&&typeof _0x3122f6['limit']==='undefined';var _0x445f77=_0x4738ce[_0x7b6a('0x1a')];var _0x332144=_0x115d68?0x0:_0x3122f6[_0x7b6a('0x18')];var _0x1117b8=_0x115d68?_0x4738ce[_0x7b6a('0x1a')]:_0x3122f6[_0x7b6a('0x18')]+_0x3122f6[_0x7b6a('0x1b')];var _0x116c9a;if(_0x1117b8>=_0x445f77){_0x1117b8=_0x445f77;_0x116c9a=0xc8;}else{_0x116c9a=0xce;}_0x59f33e[_0x7b6a('0x16')](_0x116c9a);return _0x59f33e['set'](_0x7b6a('0x1c'),_0x332144+'-'+_0x1117b8+'/'+_0x445f77)[_0x7b6a('0x1d')](_0x4738ce);}return null;};}function patchUpdates(_0x46fc67){return function(_0xce90f3){try{jsonpatch[_0x7b6a('0x1e')](_0xce90f3,_0x46fc67,!![]);}catch(_0x57bdd5){return BPromise[_0x7b6a('0x1f')](_0x57bdd5);}return _0xce90f3[_0x7b6a('0x20')]();};}function saveUpdates(_0x114d33,_0x21b9a1){return function(_0x44f335){if(_0x44f335){return _0x44f335[_0x7b6a('0x21')](_0x114d33)[_0x7b6a('0x22')](function(_0x1ef356){return _0x1ef356;});}return null;};}function removeEntity(_0x5bbfc8,_0x481adf){return function(_0x565340){if(_0x565340){return _0x565340['destroy']()[_0x7b6a('0x22')](function(){_0x5bbfc8['status'](0xcc)[_0x7b6a('0x17')]();});}};}function handleEntityNotFound(_0x4a1484,_0x19343c){return function(_0x55e087){if(!_0x55e087){_0x4a1484[_0x7b6a('0x23')](0x194);}return _0x55e087;};}function handleError(_0x237a0d,_0x4cfb8a){_0x4cfb8a=_0x4cfb8a||0x1f4;return function(_0x103d88){logger[_0x7b6a('0x24')](_0x103d88[_0x7b6a('0x25')]);if(_0x103d88[_0x7b6a('0x26')]){delete _0x103d88[_0x7b6a('0x26')];}_0x237a0d['status'](_0x4cfb8a)[_0x7b6a('0x27')](_0x103d88);};}exports[_0x7b6a('0x28')]=function(_0x40386f,_0x2334c6){var _0x475375={},_0x14ec81={},_0x1ac8ad={'count':0x0,'rows':[]};var _0x4210e2=_['map'](db[_0x7b6a('0x29')][_0x7b6a('0x2a')],function(_0x4450e6){return{'name':_0x4450e6[_0x7b6a('0x2b')],'type':_0x4450e6[_0x7b6a('0x2c')][_0x7b6a('0x2d')]};});_0x14ec81[_0x7b6a('0x2e')]=_[_0x7b6a('0x2f')](_0x4210e2,'name');_0x14ec81[_0x7b6a('0x30')]=_[_0x7b6a('0x31')](_0x40386f[_0x7b6a('0x30')]);_0x14ec81[_0x7b6a('0x32')]=_[_0x7b6a('0x33')](_0x14ec81[_0x7b6a('0x2e')],_0x14ec81[_0x7b6a('0x30')]);_0x475375['attributes']=_[_0x7b6a('0x33')](_0x14ec81['model'],qs[_0x7b6a('0x34')](_0x40386f[_0x7b6a('0x30')][_0x7b6a('0x34')]));_0x475375[_0x7b6a('0x35')]=_0x475375[_0x7b6a('0x35')][_0x7b6a('0x36')]?_0x475375['attributes']:_0x14ec81[_0x7b6a('0x2e')];if(!_0x40386f[_0x7b6a('0x30')][_0x7b6a('0x37')](_0x7b6a('0x38'))){_0x475375['limit']=qs[_0x7b6a('0x1b')](_0x40386f[_0x7b6a('0x30')][_0x7b6a('0x1b')]);_0x475375[_0x7b6a('0x18')]=qs[_0x7b6a('0x18')](_0x40386f[_0x7b6a('0x30')][_0x7b6a('0x18')]);}_0x475375['order']=qs[_0x7b6a('0x39')](_0x40386f['query'][_0x7b6a('0x39')]);_0x475375[_0x7b6a('0x3a')]=qs[_0x7b6a('0x32')](_[_0x7b6a('0x3b')](_0x40386f[_0x7b6a('0x30')],_0x14ec81[_0x7b6a('0x32')]),_0x4210e2);if(_0x40386f[_0x7b6a('0x30')][_0x7b6a('0x3c')]){_0x475375['where']=_[_0x7b6a('0x3d')](_0x475375[_0x7b6a('0x3a')],{'$or':_['map'](_0x4210e2,function(_0x2451e5){if(_0x2451e5[_0x7b6a('0x2c')]!==_0x7b6a('0x3e')){var _0x400c57={};_0x400c57[_0x2451e5[_0x7b6a('0x26')]]={'$like':'%'+_0x40386f[_0x7b6a('0x30')]['filter']+'%'};return _0x400c57;}})});}_0x475375=_[_0x7b6a('0x3d')]({},_0x475375,_0x40386f[_0x7b6a('0x3f')]);var _0x229d95={'where':_0x475375[_0x7b6a('0x3a')]};return db['ServicenowAccount']['count'](_0x229d95)[_0x7b6a('0x22')](function(_0x38364f){_0x1ac8ad[_0x7b6a('0x1a')]=_0x38364f;if(_0x40386f[_0x7b6a('0x30')][_0x7b6a('0x40')]){_0x475375[_0x7b6a('0x41')]=[{'all':!![]}];}return db[_0x7b6a('0x29')]['findAll'](_0x475375);})[_0x7b6a('0x22')](function(_0x2b036b){_0x1ac8ad[_0x7b6a('0x42')]=_0x2b036b;return _0x1ac8ad;})[_0x7b6a('0x22')](respondWithFilteredResult(_0x2334c6,_0x475375))['catch'](handleError(_0x2334c6,null));};exports[_0x7b6a('0x43')]=function(_0x368095,_0x260cdc){var _0x9b253f={'raw':![],'where':{'id':_0x368095[_0x7b6a('0x44')]['id']}},_0x3b4d58={};_0x3b4d58[_0x7b6a('0x2e')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x3b4d58[_0x7b6a('0x30')]=_[_0x7b6a('0x31')](_0x368095[_0x7b6a('0x30')]);_0x3b4d58[_0x7b6a('0x32')]=_[_0x7b6a('0x33')](_0x3b4d58[_0x7b6a('0x2e')],_0x3b4d58['query']);_0x9b253f['attributes']=_[_0x7b6a('0x33')](_0x3b4d58[_0x7b6a('0x2e')],qs[_0x7b6a('0x34')](_0x368095['query'][_0x7b6a('0x34')]));_0x9b253f['attributes']=_0x9b253f[_0x7b6a('0x35')]['length']?_0x9b253f[_0x7b6a('0x35')]:_0x3b4d58['model'];if(_0x368095[_0x7b6a('0x30')]['includeAll']){_0x9b253f['include']=[{'all':!![]}];}_0x9b253f=_[_0x7b6a('0x3d')]({},_0x9b253f,_0x368095[_0x7b6a('0x3f')]);return db['ServicenowAccount'][_0x7b6a('0x45')](_0x9b253f)['then'](handleEntityNotFound(_0x260cdc,null))[_0x7b6a('0x22')](respondWithResult(_0x260cdc,null))['catch'](handleError(_0x260cdc,null));};exports['create']=function(_0x2a3979,_0x49c7de){return db[_0x7b6a('0x29')]['create'](_0x2a3979[_0x7b6a('0x46')],{})[_0x7b6a('0x22')](respondWithResult(_0x49c7de,0xc9))[_0x7b6a('0x47')](handleError(_0x49c7de,null));};exports[_0x7b6a('0x21')]=function(_0x246619,_0x225aa0){if(_0x246619['body']['id']){delete _0x246619[_0x7b6a('0x46')]['id'];}return db[_0x7b6a('0x29')][_0x7b6a('0x45')]({'where':{'id':_0x246619[_0x7b6a('0x44')]['id']}})[_0x7b6a('0x22')](handleEntityNotFound(_0x225aa0,null))[_0x7b6a('0x22')](saveUpdates(_0x246619['body'],null))[_0x7b6a('0x22')](respondWithResult(_0x225aa0,null))[_0x7b6a('0x47')](handleError(_0x225aa0,null));};exports[_0x7b6a('0x48')]=function(_0x2395e3,_0x298c81){return db['ServicenowAccount']['find']({'where':{'id':_0x2395e3[_0x7b6a('0x44')]['id']}})[_0x7b6a('0x22')](handleEntityNotFound(_0x298c81,null))['then'](removeEntity(_0x298c81,null))[_0x7b6a('0x47')](handleError(_0x298c81,null));};exports[_0x7b6a('0x49')]=function(_0x29cafa,_0xc71202,_0x1d36ff){var _0x30a467={};var _0xb976be={};var _0x58e6d9;var _0x255823;return db['ServicenowAccount'][_0x7b6a('0x4a')]({'where':{'id':_0x29cafa[_0x7b6a('0x44')]['id']}})['then'](handleEntityNotFound(_0xc71202,null))[_0x7b6a('0x22')](function(_0x3daf9f){if(_0x3daf9f){_0x58e6d9=_0x3daf9f;_0xb976be[_0x7b6a('0x2e')]=_['keys'](db['ServicenowConfiguration'][_0x7b6a('0x2a')]);_0xb976be['query']=_[_0x7b6a('0x31')](_0x29cafa[_0x7b6a('0x30')]);_0xb976be[_0x7b6a('0x32')]=_[_0x7b6a('0x33')](_0xb976be[_0x7b6a('0x2e')],_0xb976be[_0x7b6a('0x30')]);_0x30a467[_0x7b6a('0x35')]=_[_0x7b6a('0x33')](_0xb976be[_0x7b6a('0x2e')],qs[_0x7b6a('0x34')](_0x29cafa['query'][_0x7b6a('0x34')]));_0x30a467[_0x7b6a('0x35')]=_0x30a467['attributes'][_0x7b6a('0x36')]?_0x30a467[_0x7b6a('0x35')]:_0xb976be[_0x7b6a('0x2e')];_0x30a467['order']=qs['sort'](_0x29cafa['query'][_0x7b6a('0x39')]);_0x30a467[_0x7b6a('0x3a')]=qs[_0x7b6a('0x32')](_[_0x7b6a('0x3b')](_0x29cafa['query'],_0xb976be[_0x7b6a('0x32')]));if(_0x29cafa[_0x7b6a('0x30')]['filter']){_0x30a467['where']=_[_0x7b6a('0x3d')](_0x30a467[_0x7b6a('0x3a')],{'$or':_[_0x7b6a('0x2f')](_0x30a467['attributes'],function(_0x2b2c23){var _0x40edd0={};_0x40edd0[_0x2b2c23]={'$like':'%'+_0x29cafa[_0x7b6a('0x30')][_0x7b6a('0x3c')]+'%'};return _0x40edd0;})});}_0x30a467=_['merge']({},_0x30a467,_0x29cafa['options']);return _0x58e6d9[_0x7b6a('0x49')](_0x30a467);}})[_0x7b6a('0x22')](function(_0x2c8b6a){if(_0x2c8b6a){_0x255823=_0x2c8b6a[_0x7b6a('0x36')];if(!_0x29cafa['query'][_0x7b6a('0x37')](_0x7b6a('0x38'))){_0x30a467[_0x7b6a('0x1b')]=qs['limit'](_0x29cafa[_0x7b6a('0x30')]['limit']);_0x30a467[_0x7b6a('0x18')]=qs['offset'](_0x29cafa[_0x7b6a('0x30')]['offset']);}return _0x58e6d9['getConfigurations'](_0x30a467);}})['then'](function(_0x5e6945){if(_0x5e6945){return _0x5e6945?{'count':_0x255823,'rows':_0x5e6945}:null;}})[_0x7b6a('0x22')](respondWithResult(_0xc71202,null))['catch'](handleError(_0xc71202,null));};exports[_0x7b6a('0x4b')]=function(_0x48742f,_0xbe88e,_0x164728){if(_0x48742f['body']['id']){delete _0x48742f[_0x7b6a('0x46')]['id'];}return db[_0x7b6a('0x29')][_0x7b6a('0x4a')]({'where':{'id':_0x48742f[_0x7b6a('0x44')]['id']}})[_0x7b6a('0x22')](handleEntityNotFound(_0xbe88e,null))[_0x7b6a('0x22')](function(_0x9d9414){if(_0x9d9414){_0x48742f['body']['AccountId']=_0x9d9414['id'];_0x48742f[_0x7b6a('0x46')][_0x7b6a('0x4c')]=integrations[_0x7b6a('0x4d')](_0x48742f[_0x7b6a('0x46')]['channel'],_0x48742f['body'][_0x7b6a('0x2c')]);_0x48742f[_0x7b6a('0x46')][_0x7b6a('0x4e')]=integrations['getDescriptions'](_0x48742f[_0x7b6a('0x46')][_0x7b6a('0x4f')],_0x48742f[_0x7b6a('0x46')]['type']);return db[_0x7b6a('0x50')][_0x7b6a('0x51')](_0x48742f[_0x7b6a('0x46')],{'include':[{'model':db[_0x7b6a('0x52')],'as':_0x7b6a('0x4c')},{'model':db['ServicenowField'],'as':_0x7b6a('0x4e')}]});}return null;})['then'](respondWithResult(_0xbe88e,null))[_0x7b6a('0x47')](handleError(_0xbe88e,null));};exports[_0x7b6a('0x53')]=function(_0x33a981,_0x361d96,_0x38acf6){var _0x57f81c=['made_sla',_0x7b6a('0x54'),'knowledge',_0x7b6a('0x55'),_0x7b6a('0x56'),_0x7b6a('0x57'),_0x7b6a('0x58'),'severity',_0x7b6a('0x59')];var _0x2bddb7=[_0x7b6a('0x5a'),'made_sla',_0x7b6a('0x5b'),_0x7b6a('0x5c'),_0x7b6a('0x5d'),_0x7b6a('0x5e'),'child_incidents',_0x7b6a('0x54'),_0x7b6a('0x5f'),_0x7b6a('0x60'),_0x7b6a('0x61'),_0x7b6a('0x62'),_0x7b6a('0x63'),_0x7b6a('0x64'),_0x7b6a('0x65'),'sys_domain',_0x7b6a('0x66'),'sys_created_by',_0x7b6a('0x67'),_0x7b6a('0x68'),_0x7b6a('0x69'),_0x7b6a('0x6a'),_0x7b6a('0x6b'),'delivery_plan',_0x7b6a('0x6c'),_0x7b6a('0x6d'),_0x7b6a('0x6e'),_0x7b6a('0x6f'),_0x7b6a('0x70'),_0x7b6a('0x71'),_0x7b6a('0x72'),_0x7b6a('0x73'),'expected_start',_0x7b6a('0x74'),_0x7b6a('0x75'),'group_list',_0x7b6a('0x76'),'reopened_time',_0x7b6a('0x77'),'caller_id',_0x7b6a('0x78'),_0x7b6a('0x55'),_0x7b6a('0x79'),'short_description',_0x7b6a('0x56'),_0x7b6a('0x7a'),_0x7b6a('0x7b'),_0x7b6a('0x7c'),_0x7b6a('0x7d'),_0x7b6a('0x7e'),'additional_assignee_list',_0x7b6a('0x7f'),'calendar_duration',_0x7b6a('0x57'),'sys_class_name',_0x7b6a('0x80'),_0x7b6a('0x81'),_0x7b6a('0x82'),_0x7b6a('0x83'),_0x7b6a('0x84'),_0x7b6a('0x85'),_0x7b6a('0x86'),_0x7b6a('0x58'),_0x7b6a('0x87'),'problem_id',_0x7b6a('0x88'),_0x7b6a('0x89'),'activity_due',_0x7b6a('0x8a'),'severity','comments',_0x7b6a('0x8b'),_0x7b6a('0x8c'),_0x7b6a('0x8d'),_0x7b6a('0x8e'),_0x7b6a('0x8f'),'reopen_count',_0x7b6a('0x90'),'escalation','upon_approval',_0x7b6a('0x91'),_0x7b6a('0x92'),_0x7b6a('0x59')];var _0x33bc32='';var _0x1e2d9a='';var _0x4d5aed=[];var _0x58eeb7='';var _0x188c95='';var _0x28b2fb=[];var _0x636a7='';var _0x26e93c='';var _0x323cd9={};var _0x24def5='';return db[_0x7b6a('0x29')][_0x7b6a('0x4a')]({'where':{'id':_0x33a981['params']['id']},'attributes':['id','username',_0x7b6a('0x93'),_0x7b6a('0x94'),_0x7b6a('0x95'),_0x7b6a('0x96')]})[_0x7b6a('0x22')](handleEntityNotFound(_0x361d96,null))[_0x7b6a('0x22')](function(_0x44098a){if(_0x44098a){_0x24def5=_0x44098a[_0x7b6a('0x95')];var _0x3990fe=_0x24def5[_0x7b6a('0x97')](-0x1);if(_0x3990fe==='/'){_0x24def5=_0x24def5['substring'](0x0,_0x24def5[_0x7b6a('0x98')](_0x3990fe));}_0x26e93c=util['format'](_0x7b6a('0x99'),_0x24def5);_0x636a7=util[_0x7b6a('0x9a')](_0x7b6a('0x9b'),_0x24def5);_0x323cd9={'user':_0x44098a['username'],'pass':_0x44098a[_0x7b6a('0x93')]};var _0x1ae3f7={'method':_0x7b6a('0x9c'),'uri':_0x26e93c+_0x7b6a('0x9d'),'auth':_0x323cd9,'json':!![]};return rp(_0x1ae3f7);}})[_0x7b6a('0x22')](function(_0x2fc05e){if(_0x2fc05e['result'][_0x7b6a('0x36')]>0x0){_0x33bc32=_0x2fc05e['result'];}console[_0x7b6a('0x9e')](_0x7b6a('0x9f'),_0x33bc32);_0x28b2fb=[];_0x1e2d9a=Object[_0x7b6a('0xa0')]([],_0x33bc32);_['remove'](_0x1e2d9a,function(_0x340917){return!_0x57f81c[_0x7b6a('0xa1')](_0x340917['name']);});_0x1e2d9a['forEach'](function(_0x32d224){var _0x1c9e8e=createFieldObject(_0x636a7,_0x323cd9,_0x32d224['internalType'],_0x32d224['name'],_0x32d224[_0x7b6a('0xa2')],![]);_0x28b2fb[_0x7b6a('0xa3')](_0x1c9e8e);});return Promise[_0x7b6a('0xa4')](_0x28b2fb);})[_0x7b6a('0x22')](function(_0x3017f7){_0x4d5aed=_0x3017f7;_0x58eeb7=Object[_0x7b6a('0xa0')]([],_0x33bc32);console['log'](_0x7b6a('0xa5'),_0x33bc32);_[_0x7b6a('0xa6')](_0x58eeb7,function(_0x3b7f73){return _0x2bddb7[_0x7b6a('0xa1')](_0x3b7f73['name']);});console[_0x7b6a('0x9e')](_0x7b6a('0xa7'),_0x58eeb7);_0x28b2fb=[];_0x58eeb7['forEach'](function(_0x9175c4){var _0x389d19=createFieldObject(_0x636a7,_0x323cd9,_0x9175c4['internalType'],_0x9175c4['name'],_0x9175c4[_0x7b6a('0xa2')],!![]);_0x28b2fb[_0x7b6a('0xa3')](_0x389d19);});return Promise['all'](_0x28b2fb);})['then'](function(_0x2e0203){_0x188c95=_0x2e0203;var _0x46201f=_0x4d5aed['concat'](_0x188c95);return{'count':_0x46201f[_0x7b6a('0x36')],'rows':_0x46201f};})[_0x7b6a('0x22')](respondWithResult(_0x361d96,null))[_0x7b6a('0x47')](function(_0x243012){console[_0x7b6a('0x9e')](_0x7b6a('0xa8')+_0x243012);var _0x243cdb=_0x33a981['query'][_0x7b6a('0xa9')]?0x1f4:_0x243012['statusCode']||0x1f4;logger['error'](_0x243012[_0x7b6a('0x25')]);delete _0x243012['name'];if(_0x243cdb===0x191){_0x243cdb=0x190;}_0x361d96[_0x7b6a('0x16')](_0x243cdb)[_0x7b6a('0x27')](_0x33a981[_0x7b6a('0x30')]['test']?{'message':_0x7b6a('0xaa'),'statusCode':_0x243012[_0x7b6a('0xab')]}:_0x243012);});};function createFieldObject(_0x4c1382,_0xed3387,_0x38164c,_0x1492fd,_0x34b526,_0x51d5fa){return new Promise(function(_0x5986d7,_0x1b5734){var _0x7ce630={'id':_0x1492fd,'name':_0x34b526,'custom':_0x51d5fa};if(_0x38164c===_0x7b6a('0xac')){_0x7ce630[_0x7b6a('0x3f')]=[{'name':'True','value':_0x7b6a('0xad')},{'name':'False','value':_0x7b6a('0xae')}];_0x5986d7(_0x7ce630);}else{var _0x1567db={'method':_0x7b6a('0x9c'),'uri':_0x4c1382+_0x7b6a('0xaf')+_0x1492fd,'auth':_0xed3387,'json':!![]};return rp(_0x1567db)[_0x7b6a('0x22')](function(_0x2bfb84){var _0x4bb98b=[];if(_0x2bfb84[_0x7b6a('0xb0')][_0x7b6a('0x36')]>0x0){_0x2bfb84[_0x7b6a('0xb0')]['forEach'](function(_0x5460f8){if(_0x5460f8[_0x7b6a('0xb1')]==='false'){var _0x27d5c1={'name':_0x5460f8[_0x7b6a('0xa2')],'value':_0x5460f8['value']};_0x4bb98b['push'](_0x27d5c1);}});}_0x7ce630[_0x7b6a('0x3f')]=_0x4bb98b;if(_0x7ce630[_0x7b6a('0x3f')][_0x7b6a('0x36')]>0x0){_0x5986d7(_0x7ce630);}else{if(_0x51d5fa==![]){_0x5986d7();}else{_0x5986d7(_0x7ce630);}}});}});} \ No newline at end of file +var _0x8470=['incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','child_incidents','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','reopened_by','urgency','problem_id','company','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','sys_tags','escalation','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','stack','Wrong\x20credentials','True','true','False','inactive','false','value','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','status','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','include','find','create','body','update','params','findOne','ServicenowConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','hold_reason','knowledge','subcategory','close_code','notify'];(function(_0x4b3882,_0x4ec298){var _0x5b6632=function(_0x5b9f23){while(--_0x5b9f23){_0x4b3882['push'](_0x4b3882['shift']());}};_0x5b6632(++_0x4ec298);}(_0x8470,0x1dc));var _0x0847=function(_0x344be5,_0x10b628){_0x344be5=_0x344be5-0x0;var _0x105169=_0x8470[_0x344be5];return _0x105169;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0847('0x0'));var zipdir=require(_0x0847('0x1'));var jsonpatch=require(_0x0847('0x2'));var rp=require(_0x0847('0x3'));var moment=require(_0x0847('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0847('0x5'));var util=require(_0x0847('0x6'));var path=require(_0x0847('0x7'));var sox=require(_0x0847('0x8'));var csv=require('to-csv');var ejs=require(_0x0847('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0847('0xa'));var squel=require(_0x0847('0xb'));var crypto=require(_0x0847('0xc'));var jsforce=require(_0x0847('0xd'));var deskjs=require(_0x0847('0xe'));var toCsv=require(_0x0847('0xf'));var querystring=require('querystring');var Papa=require(_0x0847('0x10'));var Redis=require('ioredis');var authService=require(_0x0847('0x11'));var qs=require(_0x0847('0x12'));var as=require(_0x0847('0x13'));var hardwareService=require(_0x0847('0x14'));var logger=require(_0x0847('0x15'))(_0x0847('0x16'));var utils=require(_0x0847('0x17'));var config=require(_0x0847('0x18'));var licenseUtil=require(_0x0847('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0847('0x1a'));function respondWithStatusCode(_0x460274,_0x376bdd){_0x376bdd=_0x376bdd||0xcc;return function(_0x3fda76){if(_0x3fda76){return _0x460274[_0x0847('0x1b')](_0x376bdd);}return _0x460274['status'](_0x376bdd)['end']();};}function respondWithResult(_0x3ad9a2,_0x5415a6){_0x5415a6=_0x5415a6||0xc8;return function(_0xba7128){if(_0xba7128){return _0x3ad9a2['status'](_0x5415a6)['json'](_0xba7128);}};}function respondWithFilteredResult(_0x164a7a,_0x312447){return function(_0x21e657){if(_0x21e657){var _0x30967b=typeof _0x312447[_0x0847('0x1c')]==='undefined'&&typeof _0x312447['limit']===_0x0847('0x1d');var _0x4969d2=_0x21e657[_0x0847('0x1e')];var _0x3885af=_0x30967b?0x0:_0x312447['offset'];var _0x129d05=_0x30967b?_0x21e657[_0x0847('0x1e')]:_0x312447[_0x0847('0x1c')]+_0x312447[_0x0847('0x1f')];var _0x3b66e8;if(_0x129d05>=_0x4969d2){_0x129d05=_0x4969d2;_0x3b66e8=0xc8;}else{_0x3b66e8=0xce;}_0x164a7a['status'](_0x3b66e8);return _0x164a7a[_0x0847('0x20')](_0x0847('0x21'),_0x3885af+'-'+_0x129d05+'/'+_0x4969d2)[_0x0847('0x22')](_0x21e657);}return null;};}function patchUpdates(_0x2381b7){return function(_0x5a6723){try{jsonpatch[_0x0847('0x23')](_0x5a6723,_0x2381b7,!![]);}catch(_0x44515b){return BPromise[_0x0847('0x24')](_0x44515b);}return _0x5a6723[_0x0847('0x25')]();};}function saveUpdates(_0x220011,_0x54bf30){return function(_0x2cdd8d){if(_0x2cdd8d){return _0x2cdd8d['update'](_0x220011)[_0x0847('0x26')](function(_0x4b0f07){return _0x4b0f07;});}return null;};}function removeEntity(_0x252691,_0xb19bbd){return function(_0x4c6ca8){if(_0x4c6ca8){return _0x4c6ca8[_0x0847('0x27')]()[_0x0847('0x26')](function(){_0x252691[_0x0847('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3632ec,_0x464f90){return function(_0x5ac2f0){if(!_0x5ac2f0){_0x3632ec['sendStatus'](0x194);}return _0x5ac2f0;};}function handleError(_0x406161,_0x34d053){_0x34d053=_0x34d053||0x1f4;return function(_0x486b84){logger['error'](_0x486b84['stack']);if(_0x486b84[_0x0847('0x29')]){delete _0x486b84['name'];}_0x406161['status'](_0x34d053)[_0x0847('0x2a')](_0x486b84);};}exports[_0x0847('0x2b')]=function(_0x2e4741,_0x338cf0){var _0x37cc11={},_0x3fe8a7={},_0x422bd0={'count':0x0,'rows':[]};var _0x247fe2=_['map'](db[_0x0847('0x2c')][_0x0847('0x2d')],function(_0x4a01c5){return{'name':_0x4a01c5[_0x0847('0x2e')],'type':_0x4a01c5[_0x0847('0x2f')]['key']};});_0x3fe8a7['model']=_[_0x0847('0x30')](_0x247fe2,_0x0847('0x29'));_0x3fe8a7[_0x0847('0x31')]=_[_0x0847('0x32')](_0x2e4741['query']);_0x3fe8a7[_0x0847('0x33')]=_['intersection'](_0x3fe8a7[_0x0847('0x34')],_0x3fe8a7[_0x0847('0x31')]);_0x37cc11[_0x0847('0x35')]=_[_0x0847('0x36')](_0x3fe8a7['model'],qs[_0x0847('0x37')](_0x2e4741[_0x0847('0x31')][_0x0847('0x37')]));_0x37cc11[_0x0847('0x35')]=_0x37cc11[_0x0847('0x35')][_0x0847('0x38')]?_0x37cc11['attributes']:_0x3fe8a7[_0x0847('0x34')];if(!_0x2e4741['query'][_0x0847('0x39')](_0x0847('0x3a'))){_0x37cc11['limit']=qs[_0x0847('0x1f')](_0x2e4741['query']['limit']);_0x37cc11['offset']=qs[_0x0847('0x1c')](_0x2e4741[_0x0847('0x31')][_0x0847('0x1c')]);}_0x37cc11['order']=qs[_0x0847('0x3b')](_0x2e4741[_0x0847('0x31')][_0x0847('0x3b')]);_0x37cc11[_0x0847('0x3c')]=qs[_0x0847('0x33')](_[_0x0847('0x3d')](_0x2e4741[_0x0847('0x31')],_0x3fe8a7[_0x0847('0x33')]),_0x247fe2);if(_0x2e4741[_0x0847('0x31')][_0x0847('0x3e')]){_0x37cc11[_0x0847('0x3c')]=_[_0x0847('0x3f')](_0x37cc11['where'],{'$or':_[_0x0847('0x30')](_0x247fe2,function(_0x3eba1e){if(_0x3eba1e[_0x0847('0x2f')]!==_0x0847('0x40')){var _0x466b45={};_0x466b45[_0x3eba1e[_0x0847('0x29')]]={'$like':'%'+_0x2e4741[_0x0847('0x31')]['filter']+'%'};return _0x466b45;}})});}_0x37cc11=_[_0x0847('0x3f')]({},_0x37cc11,_0x2e4741[_0x0847('0x41')]);var _0x2160f7={'where':_0x37cc11[_0x0847('0x3c')]};return db[_0x0847('0x2c')][_0x0847('0x1e')](_0x2160f7)['then'](function(_0x182c44){_0x422bd0['count']=_0x182c44;if(_0x2e4741[_0x0847('0x31')][_0x0847('0x42')]){_0x37cc11['include']=[{'all':!![]}];}return db[_0x0847('0x2c')][_0x0847('0x43')](_0x37cc11);})['then'](function(_0x1e60bc){_0x422bd0['rows']=_0x1e60bc;return _0x422bd0;})[_0x0847('0x26')](respondWithFilteredResult(_0x338cf0,_0x37cc11))[_0x0847('0x44')](handleError(_0x338cf0,null));};exports['show']=function(_0x2b699b,_0x14086c){var _0x2e4bca={'raw':![],'where':{'id':_0x2b699b['params']['id']}},_0x2e220e={};_0x2e220e['model']=_[_0x0847('0x32')](db[_0x0847('0x2c')][_0x0847('0x2d')]);_0x2e220e[_0x0847('0x31')]=_[_0x0847('0x32')](_0x2b699b['query']);_0x2e220e[_0x0847('0x33')]=_['intersection'](_0x2e220e[_0x0847('0x34')],_0x2e220e[_0x0847('0x31')]);_0x2e4bca['attributes']=_[_0x0847('0x36')](_0x2e220e[_0x0847('0x34')],qs[_0x0847('0x37')](_0x2b699b['query'][_0x0847('0x37')]));_0x2e4bca[_0x0847('0x35')]=_0x2e4bca[_0x0847('0x35')][_0x0847('0x38')]?_0x2e4bca['attributes']:_0x2e220e[_0x0847('0x34')];if(_0x2b699b[_0x0847('0x31')][_0x0847('0x42')]){_0x2e4bca[_0x0847('0x45')]=[{'all':!![]}];}_0x2e4bca=_['merge']({},_0x2e4bca,_0x2b699b[_0x0847('0x41')]);return db[_0x0847('0x2c')][_0x0847('0x46')](_0x2e4bca)[_0x0847('0x26')](handleEntityNotFound(_0x14086c,null))[_0x0847('0x26')](respondWithResult(_0x14086c,null))[_0x0847('0x44')](handleError(_0x14086c,null));};exports[_0x0847('0x47')]=function(_0x4f9ef5,_0x40fb07){return db[_0x0847('0x2c')][_0x0847('0x47')](_0x4f9ef5[_0x0847('0x48')],{})[_0x0847('0x26')](respondWithResult(_0x40fb07,0xc9))[_0x0847('0x44')](handleError(_0x40fb07,null));};exports[_0x0847('0x49')]=function(_0x409aa5,_0x176126){if(_0x409aa5[_0x0847('0x48')]['id']){delete _0x409aa5[_0x0847('0x48')]['id'];}return db[_0x0847('0x2c')][_0x0847('0x46')]({'where':{'id':_0x409aa5['params']['id']}})[_0x0847('0x26')](handleEntityNotFound(_0x176126,null))['then'](saveUpdates(_0x409aa5[_0x0847('0x48')],null))[_0x0847('0x26')](respondWithResult(_0x176126,null))[_0x0847('0x44')](handleError(_0x176126,null));};exports[_0x0847('0x27')]=function(_0x34124d,_0xd2c94){return db[_0x0847('0x2c')][_0x0847('0x46')]({'where':{'id':_0x34124d[_0x0847('0x4a')]['id']}})[_0x0847('0x26')](handleEntityNotFound(_0xd2c94,null))['then'](removeEntity(_0xd2c94,null))['catch'](handleError(_0xd2c94,null));};exports['getConfigurations']=function(_0x4437e4,_0x4fce33,_0x4b8651){var _0x417da5={};var _0x29c4af={};var _0x2ddb68;var _0x5f0d8c;return db['ServicenowAccount'][_0x0847('0x4b')]({'where':{'id':_0x4437e4['params']['id']}})[_0x0847('0x26')](handleEntityNotFound(_0x4fce33,null))[_0x0847('0x26')](function(_0x1c9443){if(_0x1c9443){_0x2ddb68=_0x1c9443;_0x29c4af[_0x0847('0x34')]=_[_0x0847('0x32')](db[_0x0847('0x4c')]['rawAttributes']);_0x29c4af['query']=_['keys'](_0x4437e4[_0x0847('0x31')]);_0x29c4af['filters']=_['intersection'](_0x29c4af[_0x0847('0x34')],_0x29c4af[_0x0847('0x31')]);_0x417da5[_0x0847('0x35')]=_[_0x0847('0x36')](_0x29c4af[_0x0847('0x34')],qs[_0x0847('0x37')](_0x4437e4[_0x0847('0x31')][_0x0847('0x37')]));_0x417da5[_0x0847('0x35')]=_0x417da5[_0x0847('0x35')][_0x0847('0x38')]?_0x417da5[_0x0847('0x35')]:_0x29c4af[_0x0847('0x34')];_0x417da5[_0x0847('0x4d')]=qs[_0x0847('0x3b')](_0x4437e4['query'][_0x0847('0x3b')]);_0x417da5['where']=qs['filters'](_['pick'](_0x4437e4[_0x0847('0x31')],_0x29c4af[_0x0847('0x33')]));if(_0x4437e4[_0x0847('0x31')][_0x0847('0x3e')]){_0x417da5['where']=_[_0x0847('0x3f')](_0x417da5['where'],{'$or':_[_0x0847('0x30')](_0x417da5[_0x0847('0x35')],function(_0x52ffef){var _0x2de0ca={};_0x2de0ca[_0x52ffef]={'$like':'%'+_0x4437e4['query'][_0x0847('0x3e')]+'%'};return _0x2de0ca;})});}_0x417da5=_['merge']({},_0x417da5,_0x4437e4[_0x0847('0x41')]);return _0x2ddb68[_0x0847('0x4e')](_0x417da5);}})['then'](function(_0x34a0e9){if(_0x34a0e9){_0x5f0d8c=_0x34a0e9['length'];if(!_0x4437e4['query'][_0x0847('0x39')]('nolimit')){_0x417da5['limit']=qs['limit'](_0x4437e4[_0x0847('0x31')][_0x0847('0x1f')]);_0x417da5[_0x0847('0x1c')]=qs[_0x0847('0x1c')](_0x4437e4[_0x0847('0x31')][_0x0847('0x1c')]);}return _0x2ddb68['getConfigurations'](_0x417da5);}})[_0x0847('0x26')](function(_0x4953c8){if(_0x4953c8){return _0x4953c8?{'count':_0x5f0d8c,'rows':_0x4953c8}:null;}})['then'](respondWithResult(_0x4fce33,null))[_0x0847('0x44')](handleError(_0x4fce33,null));};exports[_0x0847('0x4f')]=function(_0x378565,_0x841bf0,_0x778ac1){if(_0x378565[_0x0847('0x48')]['id']){delete _0x378565[_0x0847('0x48')]['id'];}return db[_0x0847('0x2c')][_0x0847('0x4b')]({'where':{'id':_0x378565[_0x0847('0x4a')]['id']}})['then'](handleEntityNotFound(_0x841bf0,null))[_0x0847('0x26')](function(_0x51bc97){if(_0x51bc97){_0x378565[_0x0847('0x48')][_0x0847('0x50')]=_0x51bc97['id'];_0x378565[_0x0847('0x48')][_0x0847('0x51')]=integrations[_0x0847('0x52')](_0x378565[_0x0847('0x48')][_0x0847('0x53')],_0x378565[_0x0847('0x48')][_0x0847('0x2f')]);_0x378565[_0x0847('0x48')][_0x0847('0x54')]=integrations['getDescriptions'](_0x378565['body'][_0x0847('0x53')],_0x378565[_0x0847('0x48')][_0x0847('0x2f')]);return db[_0x0847('0x4c')][_0x0847('0x47')](_0x378565[_0x0847('0x48')],{'include':[{'model':db[_0x0847('0x55')],'as':_0x0847('0x51')},{'model':db['ServicenowField'],'as':_0x0847('0x54')}]});}return null;})[_0x0847('0x26')](respondWithResult(_0x841bf0,null))[_0x0847('0x44')](handleError(_0x841bf0,null));};exports['getFields']=function(_0x3fba66,_0x29b036,_0xcf49a9){var _0x5e406a=['made_sla',_0x0847('0x56'),_0x0847('0x57'),_0x0847('0x58'),_0x0847('0x59'),_0x0847('0x5a'),_0x0847('0x5b'),_0x0847('0x5c'),_0x0847('0x5d')];var _0x139814=[_0x0847('0x5e'),_0x0847('0x5f'),_0x0847('0x60'),_0x0847('0x61'),_0x0847('0x62'),'sys_updated_on',_0x0847('0x63'),_0x0847('0x56'),'approval_history','number',_0x0847('0x64'),_0x0847('0x65'),_0x0847('0x66'),_0x0847('0x67'),_0x0847('0x68'),_0x0847('0x69'),_0x0847('0x6a'),_0x0847('0x6b'),'knowledge','order',_0x0847('0x6c'),'closed_at',_0x0847('0x6d'),_0x0847('0x6e'),_0x0847('0x6f'),_0x0847('0x70'),_0x0847('0x71'),_0x0847('0x72'),_0x0847('0x73'),_0x0847('0x74'),'rfc',_0x0847('0x75'),_0x0847('0x76'),_0x0847('0x77'),_0x0847('0x78'),'group_list',_0x0847('0x79'),_0x0847('0x7a'),_0x0847('0x7b'),_0x0847('0x7c'),_0x0847('0x7d'),_0x0847('0x58'),_0x0847('0x7e'),_0x0847('0x7f'),'close_code',_0x0847('0x80'),'delivery_task',_0x0847('0x81'),_0x0847('0x82'),_0x0847('0x83'),_0x0847('0x84'),_0x0847('0x85'),_0x0847('0x86'),_0x0847('0x5a'),_0x0847('0x87'),_0x0847('0x88'),_0x0847('0x89'),'follow_up',_0x0847('0x8a'),'sys_id','contact_type',_0x0847('0x8b'),'incident_state',_0x0847('0x8c'),_0x0847('0x8d'),_0x0847('0x8e'),'reassignment_count','activity_due',_0x0847('0x8f'),_0x0847('0x5c'),_0x0847('0x90'),_0x0847('0x91'),_0x0847('0x92'),_0x0847('0x93'),'due_date',_0x0847('0x94'),'reopen_count',_0x0847('0x95'),_0x0847('0x96'),'upon_approval',_0x0847('0x97'),_0x0847('0x98'),_0x0847('0x5d')];var _0x38d16c='';var _0x205eb7='';var _0x517947=[];var _0x4df4e1='';var _0x1c6173='';var _0x19909d=[];var _0x1298aa='';var _0x2a6eeb='';var _0x239b74={};var _0x2dd3e7='';return db[_0x0847('0x2c')][_0x0847('0x4b')]({'where':{'id':_0x3fba66[_0x0847('0x4a')]['id']},'attributes':['id',_0x0847('0x99'),_0x0847('0x9a'),_0x0847('0x9b'),_0x0847('0x9c'),_0x0847('0x9d')]})['then'](handleEntityNotFound(_0x29b036,null))[_0x0847('0x26')](function(_0x5ca545){if(_0x5ca545){_0x2dd3e7=_0x5ca545[_0x0847('0x9c')];var _0x360397=_0x2dd3e7[_0x0847('0x9e')](-0x1);if(_0x360397==='/'){_0x2dd3e7=_0x2dd3e7[_0x0847('0x9f')](0x0,_0x2dd3e7[_0x0847('0xa0')](_0x360397));}_0x2a6eeb=util[_0x0847('0xa1')](_0x0847('0xa2'),_0x2dd3e7);_0x1298aa=util[_0x0847('0xa1')]('%s/api/now/table/',_0x2dd3e7);_0x239b74={'user':_0x5ca545['username'],'pass':_0x5ca545[_0x0847('0x9a')]};var _0x166824={'method':_0x0847('0xa3'),'uri':_0x2a6eeb+'incident?sysparm_display_value=all','auth':_0x239b74,'json':!![]};return rp(_0x166824);}})[_0x0847('0x26')](function(_0x5c1f68){if(_0x5c1f68['result'][_0x0847('0x38')]>0x0){_0x38d16c=_0x5c1f68[_0x0847('0xa4')];}console[_0x0847('0xa5')](_0x0847('0xa6'),_0x38d16c);_0x19909d=[];_0x205eb7=Object[_0x0847('0xa7')]([],_0x38d16c);_[_0x0847('0xa8')](_0x205eb7,function(_0xf0068e){return!_0x5e406a[_0x0847('0xa9')](_0xf0068e['name']);});_0x205eb7[_0x0847('0xaa')](function(_0x3fb59c){var _0x4dfdeb=createFieldObject(_0x1298aa,_0x239b74,_0x3fb59c[_0x0847('0xab')],_0x3fb59c['name'],_0x3fb59c[_0x0847('0xac')],![]);_0x19909d[_0x0847('0xad')](_0x4dfdeb);});return Promise[_0x0847('0xae')](_0x19909d);})[_0x0847('0x26')](function(_0x4c7136){_0x517947=_0x4c7136;_0x4df4e1=Object[_0x0847('0xa7')]([],_0x38d16c);console['log'](_0x0847('0xaf'),_0x38d16c);_['remove'](_0x4df4e1,function(_0x4921f5){return _0x139814['includes'](_0x4921f5[_0x0847('0x29')]);});console[_0x0847('0xa5')](_0x0847('0xb0'),_0x4df4e1);_0x19909d=[];_0x4df4e1['forEach'](function(_0x4e3c1f){var _0x5a9c8a=createFieldObject(_0x1298aa,_0x239b74,_0x4e3c1f['internalType'],_0x4e3c1f[_0x0847('0x29')],_0x4e3c1f[_0x0847('0xac')],!![]);_0x19909d[_0x0847('0xad')](_0x5a9c8a);});return Promise[_0x0847('0xae')](_0x19909d);})[_0x0847('0x26')](function(_0xb94376){_0x1c6173=_0xb94376;var _0x3610f6=_0x517947[_0x0847('0xb1')](_0x1c6173);return{'count':_0x3610f6[_0x0847('0x38')],'rows':_0x3610f6};})[_0x0847('0x26')](respondWithResult(_0x29b036,null))[_0x0847('0x44')](function(_0x5aa175){console[_0x0847('0xa5')](_0x0847('0xb2')+_0x5aa175);var _0x5134cf=_0x3fba66[_0x0847('0x31')][_0x0847('0xb3')]?0x1f4:_0x5aa175[_0x0847('0xb4')]||0x1f4;logger['error'](_0x5aa175[_0x0847('0xb5')]);delete _0x5aa175['name'];if(_0x5134cf===0x191){_0x5134cf=0x190;}_0x29b036[_0x0847('0x28')](_0x5134cf)[_0x0847('0x2a')](_0x3fba66[_0x0847('0x31')][_0x0847('0xb3')]?{'message':_0x0847('0xb6'),'statusCode':_0x5aa175[_0x0847('0xb4')]}:_0x5aa175);});};function createFieldObject(_0xfbe461,_0x212360,_0x139ae7,_0x64fd68,_0x218bf5,_0x1e776d){return new Promise(function(_0xf21e09,_0x33e3ae){var _0x346b84={'id':_0x64fd68,'name':_0x218bf5,'custom':_0x1e776d};if(_0x139ae7==='boolean'){_0x346b84['options']=[{'name':_0x0847('0xb7'),'value':_0x0847('0xb8')},{'name':_0x0847('0xb9'),'value':'false'}];_0xf21e09(_0x346b84);}else{var _0xcea965={'method':_0x0847('0xa3'),'uri':_0xfbe461+'sys_choice?sysparm_query=name=incident^element='+_0x64fd68,'auth':_0x212360,'json':!![]};return rp(_0xcea965)[_0x0847('0x26')](function(_0x3635a0){var _0x1977ec=[];if(_0x3635a0['result'][_0x0847('0x38')]>0x0){_0x3635a0[_0x0847('0xa4')][_0x0847('0xaa')](function(_0x481948){if(_0x481948[_0x0847('0xba')]===_0x0847('0xbb')){var _0x2f1646={'name':_0x481948['label'],'value':_0x481948[_0x0847('0xbc')]};_0x1977ec[_0x0847('0xad')](_0x2f1646);}});}_0x346b84[_0x0847('0x41')]=_0x1977ec;if(_0x346b84['options']['length']>0x0){_0xf21e09(_0x346b84);}else{if(_0x1e776d==![]){_0xf21e09();}else{_0xf21e09(_0x346b84);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 59cc853..5e5b2bc 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x355adc,_0xac51ab){_0x355adc=_0x355adc-0x0;var _0x4df04f=_0x7fbe[_0x355adc];return _0x4df04f;};'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'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf494,0x1c6));var _0x4f49=function(_0x1aab47,_0x4804e3){_0x1aab47=_0x1aab47-0x0;var _0x756ce1=_0xf494[_0x1aab47];return _0x756ce1;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));var integrations=require(_0x4f49('0xa'));module[_0x4f49('0xb')]=function(_0x413530,_0x42b0e8){return _0x413530['define']('ServicenowAccount',attributes,{'tableName':_0x4f49('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 28686f0..a939c20 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 _0xdb04=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowServicenowAccount','find','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2c5c93,_0x48c522){var _0x679866=function(_0x10dcae){while(--_0x10dcae){_0x2c5c93['push'](_0x2c5c93['shift']());}};_0x679866(++_0x48c522);}(_0xdb04,0x177));var _0x4db0=function(_0x5b8c4d,_0x297479){_0x5b8c4d=_0x5b8c4d-0x0;var _0x3adeac=_0xdb04[_0x5b8c4d];return _0x3adeac;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4db0('0x0'));var fs=require('fs');var Redis=require(_0x4db0('0x1'));var db=require(_0x4db0('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x4db0('0x3'))(_0x4db0('0x4'));var config=require(_0x4db0('0x5'));var jayson=require(_0x4db0('0x6'));var client=jayson[_0x4db0('0x7')][_0x4db0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4091a9,_0x461dbf,_0x78ecc6){return new BPromise(function(_0xf850b,_0x6878ce){return client[_0x4db0('0x9')](_0x4091a9,_0x78ecc6)[_0x4db0('0xa')](function(_0x5adb44){logger[_0x4db0('0xb')](_0x4db0('0xc'),_0x461dbf,_0x4db0('0xd'));logger[_0x4db0('0xe')](_0x4db0('0xf'),_0x461dbf,_0x4db0('0xd'),JSON[_0x4db0('0x10')](_0x5adb44));if(_0x5adb44['error']){if(_0x5adb44[_0x4db0('0x11')][_0x4db0('0x12')]===0x1f4){logger[_0x4db0('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x461dbf,_0x5adb44[_0x4db0('0x11')][_0x4db0('0x13')]);return _0x6878ce(_0x5adb44[_0x4db0('0x11')][_0x4db0('0x13')]);}logger['error'](_0x4db0('0xc'),_0x461dbf,_0x5adb44['error']['message']);return _0xf850b(_0x5adb44['error'][_0x4db0('0x13')]);}else{logger[_0x4db0('0xb')](_0x4db0('0xc'),_0x461dbf,_0x4db0('0xd'));_0xf850b(_0x5adb44[_0x4db0('0x14')]['message']);}})[_0x4db0('0x15')](function(_0x21efd8){logger[_0x4db0('0x11')](_0x4db0('0xc'),_0x461dbf,_0x21efd8);_0x6878ce(_0x21efd8);});});}exports[_0x4db0('0x16')]=function(_0x181377){var _0x539e1d=this;return new Promise(function(_0x39f7e5,_0x595d43){return db[_0x4db0('0x17')][_0x4db0('0x18')]({'raw':_0x181377[_0x4db0('0x19')]?_0x181377['options'][_0x4db0('0x1a')]===undefined?!![]:![]:!![],'where':_0x181377['options']?_0x181377[_0x4db0('0x19')][_0x4db0('0x1b')]||null:null,'attributes':_0x181377['options']?_0x181377['options'][_0x4db0('0x1c')]||null:null,'limit':_0x181377[_0x4db0('0x19')]?_0x181377[_0x4db0('0x19')][_0x4db0('0x1d')]||null:null,'include':_0x181377[_0x4db0('0x19')]?_0x181377[_0x4db0('0x19')][_0x4db0('0x1e')]?_[_0x4db0('0x1f')](_0x181377[_0x4db0('0x19')][_0x4db0('0x1e')],function(_0x1a201f){return{'model':db[_0x1a201f[_0x4db0('0x20')]],'as':_0x1a201f['as'],'attributes':_0x1a201f[_0x4db0('0x1c')],'include':_0x1a201f[_0x4db0('0x1e')]?_[_0x4db0('0x1f')](_0x1a201f[_0x4db0('0x1e')],function(_0x34c925){return{'model':db[_0x34c925[_0x4db0('0x20')]],'as':_0x34c925['as'],'attributes':_0x34c925['attributes'],'include':_0x34c925[_0x4db0('0x1e')]?_['map'](_0x34c925[_0x4db0('0x1e')],function(_0x12b078){return{'model':db[_0x12b078[_0x4db0('0x20')]],'as':_0x12b078['as'],'attributes':_0x12b078['attributes']};}):[]};}):[]};}):[]:[]})[_0x4db0('0xa')](function(_0x4c54c0){logger['info'](_0x4db0('0x16'),_0x181377);logger[_0x4db0('0xe')](_0x4db0('0x16'),_0x181377,JSON[_0x4db0('0x10')](_0x4c54c0));_0x39f7e5(_0x4c54c0);})[_0x4db0('0x15')](function(_0x4d2d51){logger[_0x4db0('0x11')](_0x4db0('0x16'),_0x4d2d51[_0x4db0('0x13')],_0x181377);_0x595d43(_0x539e1d[_0x4db0('0x11')](0x1f4,_0x4d2d51[_0x4db0('0x13')]));});});};exports[_0x4db0('0x21')]=function(_0x305224){var _0x4220f6=this;return new Promise(function(_0x4a82be,_0x2daad7){return db[_0x4db0('0x17')][_0x4db0('0x22')]({'raw':_0x305224[_0x4db0('0x19')]?_0x305224['options'][_0x4db0('0x1a')]===undefined?!![]:![]:!![],'where':_0x305224[_0x4db0('0x19')]?_0x305224[_0x4db0('0x19')][_0x4db0('0x1b')]||null:null,'attributes':_0x305224[_0x4db0('0x19')]?_0x305224['options'][_0x4db0('0x1c')]||null:null,'include':_0x305224[_0x4db0('0x19')]?_0x305224[_0x4db0('0x19')][_0x4db0('0x1e')]?_['map'](_0x305224[_0x4db0('0x19')]['include'],function(_0x412c5){return{'model':db[_0x412c5['model']],'as':_0x412c5['as'],'attributes':_0x412c5[_0x4db0('0x1c')],'include':_0x412c5['include']?_['map'](_0x412c5[_0x4db0('0x1e')],function(_0x37f8a8){return{'model':db[_0x37f8a8[_0x4db0('0x20')]],'as':_0x37f8a8['as'],'attributes':_0x37f8a8['attributes'],'include':_0x37f8a8[_0x4db0('0x1e')]?_[_0x4db0('0x1f')](_0x37f8a8[_0x4db0('0x1e')],function(_0x2c077f){return{'model':db[_0x2c077f[_0x4db0('0x20')]],'as':_0x2c077f['as'],'attributes':_0x2c077f[_0x4db0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4db0('0xa')](function(_0x7be7b8){logger[_0x4db0('0xb')](_0x4db0('0x21'),_0x305224);logger[_0x4db0('0xe')](_0x4db0('0x21'),_0x305224,JSON[_0x4db0('0x10')](_0x7be7b8));_0x4a82be(_0x7be7b8);})[_0x4db0('0x15')](function(_0x1adbed){logger[_0x4db0('0x11')](_0x4db0('0x21'),_0x1adbed[_0x4db0('0x13')],_0x305224);_0x2daad7(_0x4220f6[_0x4db0('0x11')](0x1f4,_0x1adbed['message']));});});}; \ No newline at end of file +var _0xf8a5=['error','message','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','map','include','model','debug','find','ShowServicenowAccount','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3b6cc1,_0x3b56e2){var _0xe59cfd=function(_0x27cfe0){while(--_0x27cfe0){_0x3b6cc1['push'](_0x3b6cc1['shift']());}};_0xe59cfd(++_0x3b56e2);}(_0xf8a5,0x6a));var _0x5f8a=function(_0x56c067,_0x1aca12){_0x56c067=_0x56c067-0x0;var _0x363198=_0xf8a5[_0x56c067];return _0x363198;};'use strict';var _=require('lodash');var util=require(_0x5f8a('0x0'));var moment=require(_0x5f8a('0x1'));var BPromise=require(_0x5f8a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f8a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5f8a('0x4'));var config=require(_0x5f8a('0x5'));var jayson=require(_0x5f8a('0x6'));var client=jayson['client'][_0x5f8a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bbd74,_0x301c77,_0x456840){return new BPromise(function(_0x819bb1,_0x918a9a){return client[_0x5f8a('0x8')](_0x1bbd74,_0x456840)[_0x5f8a('0x9')](function(_0x4d5926){logger['info'](_0x5f8a('0xa'),_0x301c77,_0x5f8a('0xb'));logger['debug'](_0x5f8a('0xc'),_0x301c77,_0x5f8a('0xb'),JSON[_0x5f8a('0xd')](_0x4d5926));if(_0x4d5926[_0x5f8a('0xe')]){if(_0x4d5926[_0x5f8a('0xe')]['code']===0x1f4){logger[_0x5f8a('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x301c77,_0x4d5926['error'][_0x5f8a('0xf')]);return _0x918a9a(_0x4d5926[_0x5f8a('0xe')][_0x5f8a('0xf')]);}logger[_0x5f8a('0xe')](_0x5f8a('0xa'),_0x301c77,_0x4d5926[_0x5f8a('0xe')][_0x5f8a('0xf')]);return _0x819bb1(_0x4d5926[_0x5f8a('0xe')][_0x5f8a('0xf')]);}else{logger['info'](_0x5f8a('0xa'),_0x301c77,_0x5f8a('0xb'));_0x819bb1(_0x4d5926[_0x5f8a('0x10')][_0x5f8a('0xf')]);}})[_0x5f8a('0x11')](function(_0x5d8930){logger[_0x5f8a('0xe')](_0x5f8a('0xa'),_0x301c77,_0x5d8930);_0x918a9a(_0x5d8930);});});}exports[_0x5f8a('0x12')]=function(_0x1f08bc){var _0xfc2c8f=this;return new Promise(function(_0x206d53,_0x6d91b3){return db[_0x5f8a('0x13')]['findAll']({'raw':_0x1f08bc[_0x5f8a('0x14')]?_0x1f08bc[_0x5f8a('0x14')][_0x5f8a('0x15')]===undefined?!![]:![]:!![],'where':_0x1f08bc[_0x5f8a('0x14')]?_0x1f08bc[_0x5f8a('0x14')][_0x5f8a('0x16')]||null:null,'attributes':_0x1f08bc[_0x5f8a('0x14')]?_0x1f08bc['options'][_0x5f8a('0x17')]||null:null,'limit':_0x1f08bc[_0x5f8a('0x14')]?_0x1f08bc[_0x5f8a('0x14')]['limit']||null:null,'include':_0x1f08bc[_0x5f8a('0x14')]?_0x1f08bc[_0x5f8a('0x14')]['include']?_[_0x5f8a('0x18')](_0x1f08bc[_0x5f8a('0x14')][_0x5f8a('0x19')],function(_0xe7b3b5){return{'model':db[_0xe7b3b5['model']],'as':_0xe7b3b5['as'],'attributes':_0xe7b3b5['attributes'],'include':_0xe7b3b5[_0x5f8a('0x19')]?_[_0x5f8a('0x18')](_0xe7b3b5[_0x5f8a('0x19')],function(_0x2c8961){return{'model':db[_0x2c8961[_0x5f8a('0x1a')]],'as':_0x2c8961['as'],'attributes':_0x2c8961[_0x5f8a('0x17')],'include':_0x2c8961[_0x5f8a('0x19')]?_['map'](_0x2c8961['include'],function(_0x3ab78f){return{'model':db[_0x3ab78f[_0x5f8a('0x1a')]],'as':_0x3ab78f['as'],'attributes':_0x3ab78f[_0x5f8a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5f8a('0x9')](function(_0x2aea1f){logger['info'](_0x5f8a('0x12'),_0x1f08bc);logger[_0x5f8a('0x1b')](_0x5f8a('0x12'),_0x1f08bc,JSON[_0x5f8a('0xd')](_0x2aea1f));_0x206d53(_0x2aea1f);})[_0x5f8a('0x11')](function(_0x11d7c5){logger[_0x5f8a('0xe')]('GetServicenowAccount',_0x11d7c5['message'],_0x1f08bc);_0x6d91b3(_0xfc2c8f[_0x5f8a('0xe')](0x1f4,_0x11d7c5[_0x5f8a('0xf')]));});});};exports['ShowServicenowAccount']=function(_0x1c2df0){var _0x589b58=this;return new Promise(function(_0x334119,_0x5bc259){return db[_0x5f8a('0x13')][_0x5f8a('0x1c')]({'raw':_0x1c2df0[_0x5f8a('0x14')]?_0x1c2df0[_0x5f8a('0x14')][_0x5f8a('0x15')]===undefined?!![]:![]:!![],'where':_0x1c2df0['options']?_0x1c2df0[_0x5f8a('0x14')][_0x5f8a('0x16')]||null:null,'attributes':_0x1c2df0[_0x5f8a('0x14')]?_0x1c2df0[_0x5f8a('0x14')][_0x5f8a('0x17')]||null:null,'include':_0x1c2df0[_0x5f8a('0x14')]?_0x1c2df0[_0x5f8a('0x14')][_0x5f8a('0x19')]?_[_0x5f8a('0x18')](_0x1c2df0[_0x5f8a('0x14')][_0x5f8a('0x19')],function(_0x5c47ff){return{'model':db[_0x5c47ff['model']],'as':_0x5c47ff['as'],'attributes':_0x5c47ff['attributes'],'include':_0x5c47ff[_0x5f8a('0x19')]?_[_0x5f8a('0x18')](_0x5c47ff[_0x5f8a('0x19')],function(_0x31e987){return{'model':db[_0x31e987[_0x5f8a('0x1a')]],'as':_0x31e987['as'],'attributes':_0x31e987[_0x5f8a('0x17')],'include':_0x31e987[_0x5f8a('0x19')]?_[_0x5f8a('0x18')](_0x31e987[_0x5f8a('0x19')],function(_0x38b3fe){return{'model':db[_0x38b3fe[_0x5f8a('0x1a')]],'as':_0x38b3fe['as'],'attributes':_0x38b3fe[_0x5f8a('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5f8a('0x9')](function(_0x2093f2){logger['info'](_0x5f8a('0x1d'),_0x1c2df0);logger[_0x5f8a('0x1b')](_0x5f8a('0x1d'),_0x1c2df0,JSON['stringify'](_0x2093f2));_0x334119(_0x2093f2);})[_0x5f8a('0x11')](function(_0x59f4fb){logger[_0x5f8a('0xe')](_0x5f8a('0x1d'),_0x59f4fb[_0x5f8a('0xf')],_0x1c2df0);_0x5bc259(_0x589b58[_0x5f8a('0xe')](0x1f4,_0x59f4fb[_0x5f8a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index cd7fbaf..7abb563 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 _0xf44f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','create','update','destroy','multer','util','path'];(function(_0x5547a2,_0x542329){var _0xee1b5c=function(_0x1494c4){while(--_0x1494c4){_0x5547a2['push'](_0x5547a2['shift']());}};_0xee1b5c(++_0x542329);}(_0xf44f,0xa5));var _0xff44=function(_0x101a56,_0xd53d5c){_0x101a56=_0x101a56-0x0;var _0x4487b4=_0xf44f[_0x101a56];return _0x4487b4;};'use strict';var multer=require(_0xff44('0x0'));var util=require(_0xff44('0x1'));var path=require(_0xff44('0x2'));var timeout=require(_0xff44('0x3'));var express=require(_0xff44('0x4'));var router=express[_0xff44('0x5')]();var fs_extra=require(_0xff44('0x6'));var auth=require(_0xff44('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xff44('0x8'));var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xff44('0x9')](),controller[_0xff44('0xa')]);router[_0xff44('0xb')](_0xff44('0xc'),auth[_0xff44('0x9')](),controller[_0xff44('0xd')]);router['get'](_0xff44('0xe'),auth[_0xff44('0x9')](),controller['getFields']);router[_0xff44('0xb')]('/:id/subjects',auth[_0xff44('0x9')](),controller[_0xff44('0xf')]);router['get'](_0xff44('0x10'),auth[_0xff44('0x9')](),controller[_0xff44('0x11')]);router['post']('/',auth[_0xff44('0x9')](),controller[_0xff44('0x12')]);router['put'](_0xff44('0xc'),auth[_0xff44('0x9')](),controller[_0xff44('0x13')]);router['delete']('/:id',auth[_0xff44('0x9')](),controller[_0xff44('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf9d1=['getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','/:id/subjects'];(function(_0x58cad4,_0x41e5cf){var _0x3e61e6=function(_0x5dba8e){while(--_0x5dba8e){_0x58cad4['push'](_0x58cad4['shift']());}};_0x3e61e6(++_0x41e5cf);}(_0xf9d1,0x1d5));var _0x1f9d=function(_0x3a7edb,_0x17914c){_0x3a7edb=_0x3a7edb-0x0;var _0x16a489=_0xf9d1[_0x3a7edb];return _0x16a489;};'use strict';var multer=require(_0x1f9d('0x0'));var util=require(_0x1f9d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1f9d('0x2'));var router=express[_0x1f9d('0x3')]();var fs_extra=require(_0x1f9d('0x4'));var auth=require(_0x1f9d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1f9d('0x6'));var controller=require(_0x1f9d('0x7'));router['get']('/',auth[_0x1f9d('0x8')](),controller[_0x1f9d('0x9')]);router[_0x1f9d('0xa')](_0x1f9d('0xb'),auth[_0x1f9d('0x8')](),controller[_0x1f9d('0xc')]);router[_0x1f9d('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1f9d('0xd')]);router[_0x1f9d('0xa')](_0x1f9d('0xe'),auth[_0x1f9d('0x8')](),controller[_0x1f9d('0xf')]);router[_0x1f9d('0xa')](_0x1f9d('0x10'),auth[_0x1f9d('0x8')](),controller[_0x1f9d('0x11')]);router['post']('/',auth[_0x1f9d('0x8')](),controller[_0x1f9d('0x12')]);router['put'](_0x1f9d('0xb'),auth[_0x1f9d('0x8')](),controller[_0x1f9d('0x13')]);router[_0x1f9d('0x14')](_0x1f9d('0xb'),auth[_0x1f9d('0x8')](),controller[_0x1f9d('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index f4a3967..4462338 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 _0xb067=['STRING','sequelize','exports'];(function(_0x1d5086,_0x4d03ce){var _0x47b618=function(_0xa6ed6a){while(--_0xa6ed6a){_0x1d5086['push'](_0x1d5086['shift']());}};_0x47b618(++_0x4d03ce);}(_0xb067,0xc1));var _0x7b06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb067[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7b06('0x0'));module[_0x7b06('0x1')]={'name':{'type':Sequelize[_0x7b06('0x2')]},'description':{'type':Sequelize[_0x7b06('0x2')]}}; \ No newline at end of file +var _0x8820=['sequelize','exports','STRING'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x8820,0x1ce));var _0x0882=function(_0x36e0bf,_0x5bff08){_0x36e0bf=_0x36e0bf-0x0;var _0x4d40d7=_0x8820[_0x36e0bf];return _0x4d40d7;};'use strict';var Sequelize=require(_0x0882('0x0'));module[_0x0882('0x1')]={'name':{'type':Sequelize[_0x0882('0x2')]},'description':{'type':Sequelize[_0x0882('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 2ba563a..71c25ef 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 _0x50a4=['where','filters','filter','VIRTUAL','merge','include','catch','show','fields','includeAll','find','create','body','update','getFields','findOne','params','ServicenowField','pick','options','getSubjects','getDescriptions','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x3a8f9e,_0x37dc88){var _0x4d8e8a=function(_0xd6a8ea){while(--_0xd6a8ea){_0x3a8f9e['push'](_0x3a8f9e['shift']());}};_0x4d8e8a(++_0x37dc88);}(_0x50a4,0xbd));var _0x450a=function(_0x4a66dc,_0x45a171){_0x4a66dc=_0x4a66dc-0x0;var _0x15b869=_0x50a4[_0x4a66dc];return _0x15b869;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x450a('0x0'));var jsonpatch=require(_0x450a('0x1'));var rp=require(_0x450a('0x2'));var moment=require(_0x450a('0x3'));var BPromise=require(_0x450a('0x4'));var Mustache=require(_0x450a('0x5'));var util=require(_0x450a('0x6'));var path=require(_0x450a('0x7'));var sox=require(_0x450a('0x8'));var csv=require(_0x450a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x450a('0xa'));var _=require(_0x450a('0xb'));var squel=require(_0x450a('0xc'));var crypto=require(_0x450a('0xd'));var jsforce=require(_0x450a('0xe'));var deskjs=require(_0x450a('0xf'));var toCsv=require(_0x450a('0x9'));var querystring=require(_0x450a('0x10'));var Papa=require(_0x450a('0x11'));var Redis=require(_0x450a('0x12'));var authService=require(_0x450a('0x13'));var qs=require(_0x450a('0x14'));var as=require(_0x450a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x450a('0x16'))(_0x450a('0x17'));var utils=require('../../config/utils');var config=require(_0x450a('0x18'));var licenseUtil=require(_0x450a('0x19'));var db=require(_0x450a('0x1a'))['db'];function respondWithStatusCode(_0x5b4033,_0x43ccc4){_0x43ccc4=_0x43ccc4||0xcc;return function(_0x1d93a6){if(_0x1d93a6){return _0x5b4033[_0x450a('0x1b')](_0x43ccc4);}return _0x5b4033[_0x450a('0x1c')](_0x43ccc4)['end']();};}function respondWithResult(_0x4f0c47,_0x4d4dc8){_0x4d4dc8=_0x4d4dc8||0xc8;return function(_0x18dee8){if(_0x18dee8){return _0x4f0c47[_0x450a('0x1c')](_0x4d4dc8)[_0x450a('0x1d')](_0x18dee8);}};}function respondWithFilteredResult(_0x173d9c,_0x37dead){return function(_0x46bd8d){if(_0x46bd8d){var _0xde45c5=typeof _0x37dead[_0x450a('0x1e')]===_0x450a('0x1f')&&typeof _0x37dead[_0x450a('0x20')]==='undefined';var _0x18947d=_0x46bd8d[_0x450a('0x21')];var _0x154e75=_0xde45c5?0x0:_0x37dead[_0x450a('0x1e')];var _0x1b966d=_0xde45c5?_0x46bd8d[_0x450a('0x21')]:_0x37dead[_0x450a('0x1e')]+_0x37dead['limit'];var _0x2755e7;if(_0x1b966d>=_0x18947d){_0x1b966d=_0x18947d;_0x2755e7=0xc8;}else{_0x2755e7=0xce;}_0x173d9c['status'](_0x2755e7);return _0x173d9c[_0x450a('0x22')](_0x450a('0x23'),_0x154e75+'-'+_0x1b966d+'/'+_0x18947d)['json'](_0x46bd8d);}return null;};}function patchUpdates(_0x2607c7){return function(_0x1a98d0){try{jsonpatch[_0x450a('0x24')](_0x1a98d0,_0x2607c7,!![]);}catch(_0x5e180f){return BPromise[_0x450a('0x25')](_0x5e180f);}return _0x1a98d0[_0x450a('0x26')]();};}function saveUpdates(_0x4e2be4,_0x446b44){return function(_0x455d1f){if(_0x455d1f){return _0x455d1f['update'](_0x4e2be4)[_0x450a('0x27')](function(_0x549a13){return _0x549a13;});}return null;};}function removeEntity(_0x43c70d,_0xdf1fd1){return function(_0x438734){if(_0x438734){return _0x438734[_0x450a('0x28')]()[_0x450a('0x27')](function(){_0x43c70d[_0x450a('0x1c')](0xcc)[_0x450a('0x29')]();});}};}function handleEntityNotFound(_0x4ecd26,_0x48e194){return function(_0x5b428d){if(!_0x5b428d){_0x4ecd26[_0x450a('0x1b')](0x194);}return _0x5b428d;};}function handleError(_0x4920ec,_0x502fc8){_0x502fc8=_0x502fc8||0x1f4;return function(_0x2aee08){logger[_0x450a('0x2a')](_0x2aee08[_0x450a('0x2b')]);if(_0x2aee08[_0x450a('0x2c')]){delete _0x2aee08[_0x450a('0x2c')];}_0x4920ec[_0x450a('0x1c')](_0x502fc8)['send'](_0x2aee08);};}exports['index']=function(_0x2cc804,_0x184ad8){var _0x1e618e={},_0x5c3c73={},_0x19b143={'count':0x0,'rows':[]};var _0x5e1b16=_[_0x450a('0x2d')](db[_0x450a('0x2e')][_0x450a('0x2f')],function(_0x5b94af){return{'name':_0x5b94af[_0x450a('0x30')],'type':_0x5b94af[_0x450a('0x31')][_0x450a('0x32')]};});_0x5c3c73[_0x450a('0x33')]=_['map'](_0x5e1b16,_0x450a('0x2c'));_0x5c3c73[_0x450a('0x34')]=_[_0x450a('0x35')](_0x2cc804[_0x450a('0x34')]);_0x5c3c73['filters']=_[_0x450a('0x36')](_0x5c3c73[_0x450a('0x33')],_0x5c3c73[_0x450a('0x34')]);_0x1e618e[_0x450a('0x37')]=_[_0x450a('0x36')](_0x5c3c73[_0x450a('0x33')],qs['fields'](_0x2cc804[_0x450a('0x34')]['fields']));_0x1e618e['attributes']=_0x1e618e[_0x450a('0x37')][_0x450a('0x38')]?_0x1e618e[_0x450a('0x37')]:_0x5c3c73[_0x450a('0x33')];if(!_0x2cc804['query'][_0x450a('0x39')](_0x450a('0x3a'))){_0x1e618e[_0x450a('0x20')]=qs[_0x450a('0x20')](_0x2cc804[_0x450a('0x34')][_0x450a('0x20')]);_0x1e618e[_0x450a('0x1e')]=qs[_0x450a('0x1e')](_0x2cc804['query']['offset']);}_0x1e618e['order']=qs[_0x450a('0x3b')](_0x2cc804[_0x450a('0x34')]['sort']);_0x1e618e[_0x450a('0x3c')]=qs[_0x450a('0x3d')](_['pick'](_0x2cc804[_0x450a('0x34')],_0x5c3c73['filters']),_0x5e1b16);if(_0x2cc804[_0x450a('0x34')][_0x450a('0x3e')]){_0x1e618e[_0x450a('0x3c')]=_['merge'](_0x1e618e[_0x450a('0x3c')],{'$or':_['map'](_0x5e1b16,function(_0x46a8dc){if(_0x46a8dc[_0x450a('0x31')]!==_0x450a('0x3f')){var _0x504dac={};_0x504dac[_0x46a8dc[_0x450a('0x2c')]]={'$like':'%'+_0x2cc804[_0x450a('0x34')][_0x450a('0x3e')]+'%'};return _0x504dac;}})});}_0x1e618e=_[_0x450a('0x40')]({},_0x1e618e,_0x2cc804['options']);var _0x5f2ad3={'where':_0x1e618e[_0x450a('0x3c')]};return db[_0x450a('0x2e')]['count'](_0x5f2ad3)['then'](function(_0x248842){_0x19b143[_0x450a('0x21')]=_0x248842;if(_0x2cc804[_0x450a('0x34')]['includeAll']){_0x1e618e[_0x450a('0x41')]=[{'all':!![]}];}return db[_0x450a('0x2e')]['findAll'](_0x1e618e);})[_0x450a('0x27')](function(_0x414c17){_0x19b143['rows']=_0x414c17;return _0x19b143;})['then'](respondWithFilteredResult(_0x184ad8,_0x1e618e))[_0x450a('0x42')](handleError(_0x184ad8,null));};exports[_0x450a('0x43')]=function(_0x59c855,_0x56fe59){var _0x45fa73={'raw':![],'where':{'id':_0x59c855['params']['id']}},_0x37b38b={};_0x37b38b[_0x450a('0x33')]=_[_0x450a('0x35')](db['ServicenowConfiguration'][_0x450a('0x2f')]);_0x37b38b['query']=_[_0x450a('0x35')](_0x59c855[_0x450a('0x34')]);_0x37b38b[_0x450a('0x3d')]=_['intersection'](_0x37b38b['model'],_0x37b38b['query']);_0x45fa73[_0x450a('0x37')]=_[_0x450a('0x36')](_0x37b38b[_0x450a('0x33')],qs[_0x450a('0x44')](_0x59c855[_0x450a('0x34')][_0x450a('0x44')]));_0x45fa73[_0x450a('0x37')]=_0x45fa73[_0x450a('0x37')][_0x450a('0x38')]?_0x45fa73['attributes']:_0x37b38b[_0x450a('0x33')];if(_0x59c855['query'][_0x450a('0x45')]){_0x45fa73['include']=[{'all':!![]}];}_0x45fa73=_['merge']({},_0x45fa73,_0x59c855['options']);return db['ServicenowConfiguration'][_0x450a('0x46')](_0x45fa73)[_0x450a('0x27')](handleEntityNotFound(_0x56fe59,null))[_0x450a('0x27')](respondWithResult(_0x56fe59,null))[_0x450a('0x42')](handleError(_0x56fe59,null));};exports[_0x450a('0x47')]=function(_0x193e3b,_0x3a4294){return db[_0x450a('0x2e')][_0x450a('0x47')](_0x193e3b[_0x450a('0x48')],{})[_0x450a('0x27')](respondWithResult(_0x3a4294,0xc9))['catch'](handleError(_0x3a4294,null));};exports[_0x450a('0x49')]=function(_0x27855c,_0x25b835){if(_0x27855c[_0x450a('0x48')]['id']){delete _0x27855c[_0x450a('0x48')]['id'];}return db[_0x450a('0x2e')][_0x450a('0x46')]({'where':{'id':_0x27855c['params']['id']}})[_0x450a('0x27')](handleEntityNotFound(_0x25b835,null))[_0x450a('0x27')](saveUpdates(_0x27855c[_0x450a('0x48')],null))[_0x450a('0x27')](respondWithResult(_0x25b835,null))[_0x450a('0x42')](handleError(_0x25b835,null));};exports[_0x450a('0x28')]=function(_0x1ed20c,_0x409c86){return db[_0x450a('0x2e')]['find']({'where':{'id':_0x1ed20c['params']['id']}})[_0x450a('0x27')](handleEntityNotFound(_0x409c86,null))['then'](removeEntity(_0x409c86,null))['catch'](handleError(_0x409c86,null));};exports[_0x450a('0x4a')]=function(_0x2b457a,_0x1c608e,_0x5d40fc){var _0x2a58e3={};var _0x41800b={};var _0x2932c2;var _0x14b0ca;return db[_0x450a('0x2e')][_0x450a('0x4b')]({'where':{'id':_0x2b457a[_0x450a('0x4c')]['id']}})[_0x450a('0x27')](handleEntityNotFound(_0x1c608e,null))[_0x450a('0x27')](function(_0x55577b){if(_0x55577b){_0x2932c2=_0x55577b;_0x41800b[_0x450a('0x33')]=_['keys'](db[_0x450a('0x4d')][_0x450a('0x2f')]);_0x41800b[_0x450a('0x34')]=_['keys'](_0x2b457a['query']);_0x41800b['filters']=_[_0x450a('0x36')](_0x41800b[_0x450a('0x33')],_0x41800b['query']);_0x2a58e3[_0x450a('0x37')]=_[_0x450a('0x36')](_0x41800b[_0x450a('0x33')],qs[_0x450a('0x44')](_0x2b457a['query'][_0x450a('0x44')]));_0x2a58e3['attributes']=_0x2a58e3[_0x450a('0x37')]['length']?_0x2a58e3[_0x450a('0x37')]:_0x41800b['model'];_0x2a58e3['order']=qs[_0x450a('0x3b')](_0x2b457a['query'][_0x450a('0x3b')]);_0x2a58e3['where']=qs[_0x450a('0x3d')](_[_0x450a('0x4e')](_0x2b457a['query'],_0x41800b['filters']));if(_0x2b457a[_0x450a('0x34')][_0x450a('0x3e')]){_0x2a58e3['where']=_[_0x450a('0x40')](_0x2a58e3['where'],{'$or':_[_0x450a('0x2d')](_0x2a58e3['attributes'],function(_0x304c87){var _0x1a1d25={};_0x1a1d25[_0x304c87]={'$like':'%'+_0x2b457a['query'][_0x450a('0x3e')]+'%'};return _0x1a1d25;})});}_0x2a58e3=_[_0x450a('0x40')]({},_0x2a58e3,_0x2b457a[_0x450a('0x4f')]);return _0x2932c2['getFields'](_0x2a58e3);}})[_0x450a('0x27')](function(_0x24389f){if(_0x24389f){_0x14b0ca=_0x24389f[_0x450a('0x38')];if(!_0x2b457a[_0x450a('0x34')][_0x450a('0x39')](_0x450a('0x3a'))){_0x2a58e3[_0x450a('0x20')]=qs[_0x450a('0x20')](_0x2b457a[_0x450a('0x34')][_0x450a('0x20')]);_0x2a58e3[_0x450a('0x1e')]=qs[_0x450a('0x1e')](_0x2b457a[_0x450a('0x34')]['offset']);}return _0x2932c2[_0x450a('0x4a')](_0x2a58e3);}})[_0x450a('0x27')](function(_0xf2b91b){if(_0xf2b91b){return _0xf2b91b?{'count':_0x14b0ca,'rows':_0xf2b91b}:null;}})[_0x450a('0x27')](respondWithResult(_0x1c608e,null))[_0x450a('0x42')](handleError(_0x1c608e,null));};exports[_0x450a('0x50')]=function(_0xa9c6aa,_0x38dd55,_0x185855){var _0x5c9cb0={};var _0x1625e4={};var _0x5f5926;var _0x34438e;return db[_0x450a('0x2e')]['findOne']({'where':{'id':_0xa9c6aa[_0x450a('0x4c')]['id']}})[_0x450a('0x27')](handleEntityNotFound(_0x38dd55,null))[_0x450a('0x27')](function(_0x45fb54){if(_0x45fb54){_0x5f5926=_0x45fb54;_0x1625e4[_0x450a('0x33')]=_['keys'](db[_0x450a('0x4d')][_0x450a('0x2f')]);_0x1625e4[_0x450a('0x34')]=_[_0x450a('0x35')](_0xa9c6aa['query']);_0x1625e4[_0x450a('0x3d')]=_[_0x450a('0x36')](_0x1625e4[_0x450a('0x33')],_0x1625e4[_0x450a('0x34')]);_0x5c9cb0[_0x450a('0x37')]=_[_0x450a('0x36')](_0x1625e4[_0x450a('0x33')],qs['fields'](_0xa9c6aa[_0x450a('0x34')][_0x450a('0x44')]));_0x5c9cb0['attributes']=_0x5c9cb0[_0x450a('0x37')][_0x450a('0x38')]?_0x5c9cb0[_0x450a('0x37')]:_0x1625e4[_0x450a('0x33')];_0x5c9cb0['order']=qs['sort'](_0xa9c6aa[_0x450a('0x34')][_0x450a('0x3b')]);_0x5c9cb0[_0x450a('0x3c')]=qs[_0x450a('0x3d')](_[_0x450a('0x4e')](_0xa9c6aa[_0x450a('0x34')],_0x1625e4['filters']));if(_0xa9c6aa['query']['filter']){_0x5c9cb0[_0x450a('0x3c')]=_[_0x450a('0x40')](_0x5c9cb0[_0x450a('0x3c')],{'$or':_[_0x450a('0x2d')](_0x5c9cb0[_0x450a('0x37')],function(_0x33ce40){var _0xf26473={};_0xf26473[_0x33ce40]={'$like':'%'+_0xa9c6aa[_0x450a('0x34')]['filter']+'%'};return _0xf26473;})});}_0x5c9cb0=_[_0x450a('0x40')]({},_0x5c9cb0,_0xa9c6aa[_0x450a('0x4f')]);return _0x5f5926[_0x450a('0x50')](_0x5c9cb0);}})[_0x450a('0x27')](function(_0x5ce622){if(_0x5ce622){_0x34438e=_0x5ce622[_0x450a('0x38')];if(!_0xa9c6aa['query'][_0x450a('0x39')]('nolimit')){_0x5c9cb0[_0x450a('0x20')]=qs[_0x450a('0x20')](_0xa9c6aa['query'][_0x450a('0x20')]);_0x5c9cb0[_0x450a('0x1e')]=qs[_0x450a('0x1e')](_0xa9c6aa[_0x450a('0x34')][_0x450a('0x1e')]);}return _0x5f5926[_0x450a('0x50')](_0x5c9cb0);}})[_0x450a('0x27')](function(_0x5815d1){if(_0x5815d1){return _0x5815d1?{'count':_0x34438e,'rows':_0x5815d1}:null;}})[_0x450a('0x27')](respondWithResult(_0x38dd55,null))['catch'](handleError(_0x38dd55,null));};exports[_0x450a('0x51')]=function(_0x43166e,_0x400f45,_0x4a9827){var _0x1e60db={};var _0x538b47={};var _0x4fb82b;var _0x462227;return db[_0x450a('0x2e')][_0x450a('0x4b')]({'where':{'id':_0x43166e[_0x450a('0x4c')]['id']}})[_0x450a('0x27')](handleEntityNotFound(_0x400f45,null))[_0x450a('0x27')](function(_0x149c6e){if(_0x149c6e){_0x4fb82b=_0x149c6e;_0x538b47['model']=_[_0x450a('0x35')](db[_0x450a('0x4d')][_0x450a('0x2f')]);_0x538b47[_0x450a('0x34')]=_[_0x450a('0x35')](_0x43166e[_0x450a('0x34')]);_0x538b47[_0x450a('0x3d')]=_[_0x450a('0x36')](_0x538b47[_0x450a('0x33')],_0x538b47[_0x450a('0x34')]);_0x1e60db[_0x450a('0x37')]=_[_0x450a('0x36')](_0x538b47[_0x450a('0x33')],qs[_0x450a('0x44')](_0x43166e[_0x450a('0x34')][_0x450a('0x44')]));_0x1e60db['attributes']=_0x1e60db[_0x450a('0x37')]['length']?_0x1e60db['attributes']:_0x538b47[_0x450a('0x33')];_0x1e60db[_0x450a('0x52')]=qs[_0x450a('0x3b')](_0x43166e[_0x450a('0x34')][_0x450a('0x3b')]);_0x1e60db['where']=qs['filters'](_[_0x450a('0x4e')](_0x43166e[_0x450a('0x34')],_0x538b47[_0x450a('0x3d')]));if(_0x43166e['query'][_0x450a('0x3e')]){_0x1e60db[_0x450a('0x3c')]=_[_0x450a('0x40')](_0x1e60db[_0x450a('0x3c')],{'$or':_[_0x450a('0x2d')](_0x1e60db[_0x450a('0x37')],function(_0x5b2d70){var _0x1f9a15={};_0x1f9a15[_0x5b2d70]={'$like':'%'+_0x43166e[_0x450a('0x34')]['filter']+'%'};return _0x1f9a15;})});}_0x1e60db=_[_0x450a('0x40')]({},_0x1e60db,_0x43166e[_0x450a('0x4f')]);return _0x4fb82b[_0x450a('0x51')](_0x1e60db);}})['then'](function(_0x45a5e4){if(_0x45a5e4){_0x462227=_0x45a5e4[_0x450a('0x38')];if(!_0x43166e[_0x450a('0x34')][_0x450a('0x39')](_0x450a('0x3a'))){_0x1e60db[_0x450a('0x20')]=qs['limit'](_0x43166e['query']['limit']);_0x1e60db[_0x450a('0x1e')]=qs[_0x450a('0x1e')](_0x43166e['query'][_0x450a('0x1e')]);}return _0x4fb82b['getDescriptions'](_0x1e60db);}})[_0x450a('0x27')](function(_0x46c541){if(_0x46c541){return _0x46c541?{'count':_0x462227,'rows':_0x46c541}:null;}})['then'](respondWithResult(_0x400f45,null))[_0x450a('0x42')](handleError(_0x400f45,null));}; \ No newline at end of file +var _0x9499=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','ServicenowField','getDescriptions','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis'];(function(_0x484da6,_0x10686f){var _0x4cbfb7=function(_0xed5b0e){while(--_0xed5b0e){_0x484da6['push'](_0x484da6['shift']());}};_0x4cbfb7(++_0x10686f);}(_0x9499,0xe0));var _0x9949=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9499[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x9949('0x0'));var rimraf=require(_0x9949('0x1'));var zipdir=require(_0x9949('0x2'));var jsonpatch=require(_0x9949('0x3'));var rp=require(_0x9949('0x4'));var moment=require(_0x9949('0x5'));var BPromise=require(_0x9949('0x6'));var Mustache=require(_0x9949('0x7'));var util=require(_0x9949('0x8'));var path=require(_0x9949('0x9'));var sox=require(_0x9949('0xa'));var csv=require('to-csv');var ejs=require(_0x9949('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9949('0xc'));var crypto=require(_0x9949('0xd'));var jsforce=require(_0x9949('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9949('0xf'));var querystring=require(_0x9949('0x10'));var Papa=require(_0x9949('0x11'));var Redis=require(_0x9949('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9949('0x13'));var as=require(_0x9949('0x14'));var hardwareService=require(_0x9949('0x15'));var logger=require(_0x9949('0x16'))(_0x9949('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9949('0x18'))['db'];function respondWithStatusCode(_0x4a0ab7,_0x5610ff){_0x5610ff=_0x5610ff||0xcc;return function(_0x4db152){if(_0x4db152){return _0x4a0ab7[_0x9949('0x19')](_0x5610ff);}return _0x4a0ab7['status'](_0x5610ff)[_0x9949('0x1a')]();};}function respondWithResult(_0x3b07c4,_0x392ed3){_0x392ed3=_0x392ed3||0xc8;return function(_0x520524){if(_0x520524){return _0x3b07c4[_0x9949('0x1b')](_0x392ed3)[_0x9949('0x1c')](_0x520524);}};}function respondWithFilteredResult(_0x19c180,_0x633467){return function(_0x53e604){if(_0x53e604){var _0x1bd1ff=typeof _0x633467['offset']===_0x9949('0x1d')&&typeof _0x633467[_0x9949('0x1e')]===_0x9949('0x1d');var _0x4b5a29=_0x53e604[_0x9949('0x1f')];var _0x1856e5=_0x1bd1ff?0x0:_0x633467[_0x9949('0x20')];var _0x587340=_0x1bd1ff?_0x53e604['count']:_0x633467[_0x9949('0x20')]+_0x633467['limit'];var _0x59d0cd;if(_0x587340>=_0x4b5a29){_0x587340=_0x4b5a29;_0x59d0cd=0xc8;}else{_0x59d0cd=0xce;}_0x19c180['status'](_0x59d0cd);return _0x19c180['set'](_0x9949('0x21'),_0x1856e5+'-'+_0x587340+'/'+_0x4b5a29)[_0x9949('0x1c')](_0x53e604);}return null;};}function patchUpdates(_0x67778){return function(_0x42e161){try{jsonpatch[_0x9949('0x22')](_0x42e161,_0x67778,!![]);}catch(_0xef5855){return BPromise[_0x9949('0x23')](_0xef5855);}return _0x42e161[_0x9949('0x24')]();};}function saveUpdates(_0x9be22,_0x328a8e){return function(_0x5c178c){if(_0x5c178c){return _0x5c178c[_0x9949('0x25')](_0x9be22)[_0x9949('0x26')](function(_0x56efb4){return _0x56efb4;});}return null;};}function removeEntity(_0x2a315b,_0x1a8900){return function(_0x819d14){if(_0x819d14){return _0x819d14[_0x9949('0x27')]()[_0x9949('0x26')](function(){_0x2a315b['status'](0xcc)[_0x9949('0x1a')]();});}};}function handleEntityNotFound(_0xd12746,_0xf107d4){return function(_0x371eb0){if(!_0x371eb0){_0xd12746[_0x9949('0x19')](0x194);}return _0x371eb0;};}function handleError(_0x2f4839,_0xb17d15){_0xb17d15=_0xb17d15||0x1f4;return function(_0xc67ecf){logger['error'](_0xc67ecf[_0x9949('0x28')]);if(_0xc67ecf[_0x9949('0x29')]){delete _0xc67ecf[_0x9949('0x29')];}_0x2f4839['status'](_0xb17d15)[_0x9949('0x2a')](_0xc67ecf);};}exports[_0x9949('0x2b')]=function(_0x436840,_0xc75fc4){var _0x24c2c4={},_0x5a6f5a={},_0x37610b={'count':0x0,'rows':[]};var _0x482678=_[_0x9949('0x2c')](db[_0x9949('0x2d')]['rawAttributes'],function(_0x1cffd6){return{'name':_0x1cffd6[_0x9949('0x2e')],'type':_0x1cffd6[_0x9949('0x2f')]['key']};});_0x5a6f5a[_0x9949('0x30')]=_[_0x9949('0x2c')](_0x482678,_0x9949('0x29'));_0x5a6f5a[_0x9949('0x31')]=_[_0x9949('0x32')](_0x436840[_0x9949('0x31')]);_0x5a6f5a[_0x9949('0x33')]=_[_0x9949('0x34')](_0x5a6f5a[_0x9949('0x30')],_0x5a6f5a[_0x9949('0x31')]);_0x24c2c4[_0x9949('0x35')]=_[_0x9949('0x34')](_0x5a6f5a[_0x9949('0x30')],qs[_0x9949('0x36')](_0x436840[_0x9949('0x31')][_0x9949('0x36')]));_0x24c2c4[_0x9949('0x35')]=_0x24c2c4['attributes'][_0x9949('0x37')]?_0x24c2c4[_0x9949('0x35')]:_0x5a6f5a[_0x9949('0x30')];if(!_0x436840[_0x9949('0x31')][_0x9949('0x38')](_0x9949('0x39'))){_0x24c2c4['limit']=qs['limit'](_0x436840['query'][_0x9949('0x1e')]);_0x24c2c4[_0x9949('0x20')]=qs[_0x9949('0x20')](_0x436840[_0x9949('0x31')]['offset']);}_0x24c2c4[_0x9949('0x3a')]=qs[_0x9949('0x3b')](_0x436840['query'][_0x9949('0x3b')]);_0x24c2c4[_0x9949('0x3c')]=qs[_0x9949('0x33')](_[_0x9949('0x3d')](_0x436840['query'],_0x5a6f5a[_0x9949('0x33')]),_0x482678);if(_0x436840['query'][_0x9949('0x3e')]){_0x24c2c4[_0x9949('0x3c')]=_[_0x9949('0x3f')](_0x24c2c4[_0x9949('0x3c')],{'$or':_[_0x9949('0x2c')](_0x482678,function(_0x1a2179){if(_0x1a2179['type']!=='VIRTUAL'){var _0x539d66={};_0x539d66[_0x1a2179[_0x9949('0x29')]]={'$like':'%'+_0x436840['query'][_0x9949('0x3e')]+'%'};return _0x539d66;}})});}_0x24c2c4=_['merge']({},_0x24c2c4,_0x436840['options']);var _0x3d41e6={'where':_0x24c2c4[_0x9949('0x3c')]};return db[_0x9949('0x2d')][_0x9949('0x1f')](_0x3d41e6)['then'](function(_0x5caf54){_0x37610b[_0x9949('0x1f')]=_0x5caf54;if(_0x436840[_0x9949('0x31')][_0x9949('0x40')]){_0x24c2c4[_0x9949('0x41')]=[{'all':!![]}];}return db[_0x9949('0x2d')][_0x9949('0x42')](_0x24c2c4);})[_0x9949('0x26')](function(_0x22a814){_0x37610b[_0x9949('0x43')]=_0x22a814;return _0x37610b;})[_0x9949('0x26')](respondWithFilteredResult(_0xc75fc4,_0x24c2c4))[_0x9949('0x44')](handleError(_0xc75fc4,null));};exports[_0x9949('0x45')]=function(_0x56f343,_0x324347){var _0x52879d={'raw':![],'where':{'id':_0x56f343[_0x9949('0x46')]['id']}},_0x248a31={};_0x248a31[_0x9949('0x30')]=_[_0x9949('0x32')](db[_0x9949('0x2d')][_0x9949('0x47')]);_0x248a31['query']=_[_0x9949('0x32')](_0x56f343[_0x9949('0x31')]);_0x248a31[_0x9949('0x33')]=_['intersection'](_0x248a31['model'],_0x248a31['query']);_0x52879d[_0x9949('0x35')]=_['intersection'](_0x248a31[_0x9949('0x30')],qs[_0x9949('0x36')](_0x56f343[_0x9949('0x31')][_0x9949('0x36')]));_0x52879d[_0x9949('0x35')]=_0x52879d['attributes'][_0x9949('0x37')]?_0x52879d['attributes']:_0x248a31[_0x9949('0x30')];if(_0x56f343['query'][_0x9949('0x40')]){_0x52879d[_0x9949('0x41')]=[{'all':!![]}];}_0x52879d=_[_0x9949('0x3f')]({},_0x52879d,_0x56f343['options']);return db['ServicenowConfiguration'][_0x9949('0x48')](_0x52879d)[_0x9949('0x26')](handleEntityNotFound(_0x324347,null))['then'](respondWithResult(_0x324347,null))['catch'](handleError(_0x324347,null));};exports[_0x9949('0x49')]=function(_0x19ea5e,_0x30ae4e){return db[_0x9949('0x2d')]['create'](_0x19ea5e['body'],{})[_0x9949('0x26')](respondWithResult(_0x30ae4e,0xc9))['catch'](handleError(_0x30ae4e,null));};exports[_0x9949('0x25')]=function(_0x3be1ba,_0x47d6b5){if(_0x3be1ba[_0x9949('0x4a')]['id']){delete _0x3be1ba[_0x9949('0x4a')]['id'];}return db['ServicenowConfiguration'][_0x9949('0x48')]({'where':{'id':_0x3be1ba[_0x9949('0x46')]['id']}})[_0x9949('0x26')](handleEntityNotFound(_0x47d6b5,null))[_0x9949('0x26')](saveUpdates(_0x3be1ba[_0x9949('0x4a')],null))[_0x9949('0x26')](respondWithResult(_0x47d6b5,null))[_0x9949('0x44')](handleError(_0x47d6b5,null));};exports[_0x9949('0x27')]=function(_0x104c0c,_0x300558){return db[_0x9949('0x2d')][_0x9949('0x48')]({'where':{'id':_0x104c0c[_0x9949('0x46')]['id']}})[_0x9949('0x26')](handleEntityNotFound(_0x300558,null))[_0x9949('0x26')](removeEntity(_0x300558,null))['catch'](handleError(_0x300558,null));};exports[_0x9949('0x4b')]=function(_0x49086e,_0x5b33c2,_0x102c29){var _0x2ffa32={};var _0xfa428b={};var _0x440432;var _0x1fb15b;return db['ServicenowConfiguration'][_0x9949('0x4c')]({'where':{'id':_0x49086e[_0x9949('0x46')]['id']}})[_0x9949('0x26')](handleEntityNotFound(_0x5b33c2,null))['then'](function(_0x2a4502){if(_0x2a4502){_0x440432=_0x2a4502;_0xfa428b['model']=_['keys'](db['ServicenowField'][_0x9949('0x47')]);_0xfa428b[_0x9949('0x31')]=_[_0x9949('0x32')](_0x49086e[_0x9949('0x31')]);_0xfa428b[_0x9949('0x33')]=_[_0x9949('0x34')](_0xfa428b[_0x9949('0x30')],_0xfa428b[_0x9949('0x31')]);_0x2ffa32[_0x9949('0x35')]=_[_0x9949('0x34')](_0xfa428b[_0x9949('0x30')],qs[_0x9949('0x36')](_0x49086e[_0x9949('0x31')][_0x9949('0x36')]));_0x2ffa32[_0x9949('0x35')]=_0x2ffa32['attributes'][_0x9949('0x37')]?_0x2ffa32[_0x9949('0x35')]:_0xfa428b[_0x9949('0x30')];_0x2ffa32[_0x9949('0x3a')]=qs[_0x9949('0x3b')](_0x49086e['query'][_0x9949('0x3b')]);_0x2ffa32[_0x9949('0x3c')]=qs['filters'](_[_0x9949('0x3d')](_0x49086e['query'],_0xfa428b[_0x9949('0x33')]));if(_0x49086e[_0x9949('0x31')]['filter']){_0x2ffa32[_0x9949('0x3c')]=_[_0x9949('0x3f')](_0x2ffa32[_0x9949('0x3c')],{'$or':_[_0x9949('0x2c')](_0x2ffa32[_0x9949('0x35')],function(_0x3d697b){var _0x47aef8={};_0x47aef8[_0x3d697b]={'$like':'%'+_0x49086e[_0x9949('0x31')][_0x9949('0x3e')]+'%'};return _0x47aef8;})});}_0x2ffa32=_[_0x9949('0x3f')]({},_0x2ffa32,_0x49086e['options']);return _0x440432[_0x9949('0x4b')](_0x2ffa32);}})[_0x9949('0x26')](function(_0x4b4b53){if(_0x4b4b53){_0x1fb15b=_0x4b4b53['length'];if(!_0x49086e['query']['hasOwnProperty']('nolimit')){_0x2ffa32['limit']=qs[_0x9949('0x1e')](_0x49086e[_0x9949('0x31')]['limit']);_0x2ffa32[_0x9949('0x20')]=qs[_0x9949('0x20')](_0x49086e[_0x9949('0x31')][_0x9949('0x20')]);}return _0x440432[_0x9949('0x4b')](_0x2ffa32);}})['then'](function(_0x5e278e){if(_0x5e278e){return _0x5e278e?{'count':_0x1fb15b,'rows':_0x5e278e}:null;}})[_0x9949('0x26')](respondWithResult(_0x5b33c2,null))['catch'](handleError(_0x5b33c2,null));};exports[_0x9949('0x4d')]=function(_0x2d84ae,_0x2244b7,_0x298924){var _0x67fea0={};var _0x23e3b1={};var _0x5d9ac2;var _0x6657f2;return db[_0x9949('0x2d')][_0x9949('0x4c')]({'where':{'id':_0x2d84ae[_0x9949('0x46')]['id']}})[_0x9949('0x26')](handleEntityNotFound(_0x2244b7,null))[_0x9949('0x26')](function(_0x53fcc4){if(_0x53fcc4){_0x5d9ac2=_0x53fcc4;_0x23e3b1['model']=_[_0x9949('0x32')](db[_0x9949('0x4e')]['rawAttributes']);_0x23e3b1[_0x9949('0x31')]=_[_0x9949('0x32')](_0x2d84ae[_0x9949('0x31')]);_0x23e3b1[_0x9949('0x33')]=_[_0x9949('0x34')](_0x23e3b1[_0x9949('0x30')],_0x23e3b1[_0x9949('0x31')]);_0x67fea0[_0x9949('0x35')]=_[_0x9949('0x34')](_0x23e3b1[_0x9949('0x30')],qs['fields'](_0x2d84ae[_0x9949('0x31')][_0x9949('0x36')]));_0x67fea0[_0x9949('0x35')]=_0x67fea0[_0x9949('0x35')]['length']?_0x67fea0[_0x9949('0x35')]:_0x23e3b1['model'];_0x67fea0['order']=qs[_0x9949('0x3b')](_0x2d84ae[_0x9949('0x31')]['sort']);_0x67fea0[_0x9949('0x3c')]=qs[_0x9949('0x33')](_[_0x9949('0x3d')](_0x2d84ae[_0x9949('0x31')],_0x23e3b1[_0x9949('0x33')]));if(_0x2d84ae['query'][_0x9949('0x3e')]){_0x67fea0['where']=_[_0x9949('0x3f')](_0x67fea0[_0x9949('0x3c')],{'$or':_['map'](_0x67fea0[_0x9949('0x35')],function(_0x29ba0e){var _0x3a924a={};_0x3a924a[_0x29ba0e]={'$like':'%'+_0x2d84ae['query']['filter']+'%'};return _0x3a924a;})});}_0x67fea0=_[_0x9949('0x3f')]({},_0x67fea0,_0x2d84ae['options']);return _0x5d9ac2[_0x9949('0x4d')](_0x67fea0);}})[_0x9949('0x26')](function(_0x7365b5){if(_0x7365b5){_0x6657f2=_0x7365b5[_0x9949('0x37')];if(!_0x2d84ae[_0x9949('0x31')]['hasOwnProperty'](_0x9949('0x39'))){_0x67fea0[_0x9949('0x1e')]=qs[_0x9949('0x1e')](_0x2d84ae[_0x9949('0x31')][_0x9949('0x1e')]);_0x67fea0[_0x9949('0x20')]=qs[_0x9949('0x20')](_0x2d84ae[_0x9949('0x31')][_0x9949('0x20')]);}return _0x5d9ac2[_0x9949('0x4d')](_0x67fea0);}})[_0x9949('0x26')](function(_0x8c5e9b){if(_0x8c5e9b){return _0x8c5e9b?{'count':_0x6657f2,'rows':_0x8c5e9b}:null;}})[_0x9949('0x26')](respondWithResult(_0x2244b7,null))[_0x9949('0x44')](handleError(_0x2244b7,null));};exports[_0x9949('0x4f')]=function(_0x55425f,_0x25e8d8,_0x59983f){var _0x3a48c4={};var _0x2c5aa2={};var _0xb3976a;var _0x4e9b2e;return db['ServicenowConfiguration'][_0x9949('0x4c')]({'where':{'id':_0x55425f[_0x9949('0x46')]['id']}})['then'](handleEntityNotFound(_0x25e8d8,null))[_0x9949('0x26')](function(_0x19c9cc){if(_0x19c9cc){_0xb3976a=_0x19c9cc;_0x2c5aa2[_0x9949('0x30')]=_['keys'](db[_0x9949('0x4e')]['rawAttributes']);_0x2c5aa2[_0x9949('0x31')]=_['keys'](_0x55425f['query']);_0x2c5aa2[_0x9949('0x33')]=_[_0x9949('0x34')](_0x2c5aa2['model'],_0x2c5aa2[_0x9949('0x31')]);_0x3a48c4[_0x9949('0x35')]=_['intersection'](_0x2c5aa2['model'],qs[_0x9949('0x36')](_0x55425f[_0x9949('0x31')][_0x9949('0x36')]));_0x3a48c4[_0x9949('0x35')]=_0x3a48c4[_0x9949('0x35')][_0x9949('0x37')]?_0x3a48c4[_0x9949('0x35')]:_0x2c5aa2[_0x9949('0x30')];_0x3a48c4[_0x9949('0x3a')]=qs['sort'](_0x55425f[_0x9949('0x31')][_0x9949('0x3b')]);_0x3a48c4['where']=qs[_0x9949('0x33')](_[_0x9949('0x3d')](_0x55425f['query'],_0x2c5aa2['filters']));if(_0x55425f[_0x9949('0x31')][_0x9949('0x3e')]){_0x3a48c4[_0x9949('0x3c')]=_[_0x9949('0x3f')](_0x3a48c4[_0x9949('0x3c')],{'$or':_[_0x9949('0x2c')](_0x3a48c4[_0x9949('0x35')],function(_0x19c35c){var _0x492fb9={};_0x492fb9[_0x19c35c]={'$like':'%'+_0x55425f['query'][_0x9949('0x3e')]+'%'};return _0x492fb9;})});}_0x3a48c4=_['merge']({},_0x3a48c4,_0x55425f[_0x9949('0x50')]);return _0xb3976a[_0x9949('0x4f')](_0x3a48c4);}})[_0x9949('0x26')](function(_0x34eb10){if(_0x34eb10){_0x4e9b2e=_0x34eb10[_0x9949('0x37')];if(!_0x55425f[_0x9949('0x31')][_0x9949('0x38')](_0x9949('0x39'))){_0x3a48c4[_0x9949('0x1e')]=qs[_0x9949('0x1e')](_0x55425f['query'][_0x9949('0x1e')]);_0x3a48c4[_0x9949('0x20')]=qs[_0x9949('0x20')](_0x55425f[_0x9949('0x31')]['offset']);}return _0xb3976a[_0x9949('0x4f')](_0x3a48c4);}})[_0x9949('0x26')](function(_0x23e076){if(_0x23e076){return _0x23e076?{'count':_0x4e9b2e,'rows':_0x23e076}:null;}})[_0x9949('0x26')](respondWithResult(_0x25e8d8,null))[_0x9949('0x44')](handleError(_0x25e8d8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e5df0b7..b370021 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 _0x6f75=['rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x323e4f,_0x901262){var _0x5bf6a1=function(_0x49d3a){while(--_0x49d3a){_0x323e4f['push'](_0x323e4f['shift']());}};_0x5bf6a1(++_0x901262);}(_0x6f75,0x71));var _0x56f7=function(_0x42157f,_0x2d7d1c){_0x42157f=_0x42157f-0x0;var _0x3b0e40=_0x6f75[_0x42157f];return _0x3b0e40;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var logger=require(_0x56f7('0x2'))(_0x56f7('0x3'));var moment=require(_0x56f7('0x4'));var BPromise=require(_0x56f7('0x5'));var rp=require(_0x56f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56f7('0x7'));var config=require(_0x56f7('0x8'));var attributes=require(_0x56f7('0x9'));module['exports']=function(_0x4d0f0c,_0x5da455){return _0x4d0f0c[_0x56f7('0xa')](_0x56f7('0xb'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63ad=['rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','util','../../config/logger','path'];(function(_0x4537b4,_0x188476){var _0x5ea5eb=function(_0x399783){while(--_0x399783){_0x4537b4['push'](_0x4537b4['shift']());}};_0x5ea5eb(++_0x188476);}(_0x63ad,0x7d));var _0xd63a=function(_0x5c2ae1,_0x219538){_0x5c2ae1=_0x5c2ae1-0x0;var _0x234373=_0x63ad[_0x5c2ae1];return _0x234373;};'use strict';var _=require('lodash');var util=require(_0xd63a('0x0'));var logger=require(_0xd63a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd63a('0x2'));var rimraf=require(_0xd63a('0x3'));var config=require('../../config/environment');var attributes=require(_0xd63a('0x4'));module[_0xd63a('0x5')]=function(_0x32e509,_0xcfe533){return _0x32e509[_0xd63a('0x6')](_0xd63a('0x7'),attributes,{'tableName':'int_servicenow_configurations','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 f7bb069..ac4bc01 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 _0xa7a8=['message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xf2b1e,_0x21aecd){var _0x5c1222=function(_0x122553){while(--_0x122553){_0xf2b1e['push'](_0xf2b1e['shift']());}};_0x5c1222(++_0x21aecd);}(_0xa7a8,0x183));var _0x8a7a=function(_0xa2dba3,_0x43578a){_0xa2dba3=_0xa2dba3-0x0;var _0x5e90fd=_0xa7a8[_0xa2dba3];return _0x5e90fd;};'use strict';var _=require(_0x8a7a('0x0'));var util=require('util');var moment=require(_0x8a7a('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a7a('0x2'));var fs=require('fs');var Redis=require(_0x8a7a('0x3'));var db=require(_0x8a7a('0x4'))['db'];var utils=require(_0x8a7a('0x5'));var logger=require(_0x8a7a('0x6'))(_0x8a7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8a7a('0x8'));var client=jayson[_0x8a7a('0x9')][_0x8a7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ce0c1,_0x3c2268,_0xfda3e8){return new BPromise(function(_0x3481da,_0x17c04c){return client[_0x8a7a('0xb')](_0x5ce0c1,_0xfda3e8)[_0x8a7a('0xc')](function(_0x3f4435){logger[_0x8a7a('0xd')](_0x8a7a('0xe'),_0x3c2268,'request\x20sent');logger[_0x8a7a('0xf')](_0x8a7a('0x10'),_0x3c2268,_0x8a7a('0x11'),JSON[_0x8a7a('0x12')](_0x3f4435));if(_0x3f4435[_0x8a7a('0x13')]){if(_0x3f4435[_0x8a7a('0x13')][_0x8a7a('0x14')]===0x1f4){logger['error'](_0x8a7a('0xe'),_0x3c2268,_0x3f4435['error'][_0x8a7a('0x15')]);return _0x17c04c(_0x3f4435['error'][_0x8a7a('0x15')]);}logger[_0x8a7a('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3c2268,_0x3f4435['error'][_0x8a7a('0x15')]);return _0x3481da(_0x3f4435[_0x8a7a('0x13')][_0x8a7a('0x15')]);}else{logger[_0x8a7a('0xd')](_0x8a7a('0xe'),_0x3c2268,_0x8a7a('0x11'));_0x3481da(_0x3f4435[_0x8a7a('0x16')][_0x8a7a('0x15')]);}})[_0x8a7a('0x17')](function(_0x55d693){logger[_0x8a7a('0x13')](_0x8a7a('0xe'),_0x3c2268,_0x55d693);_0x17c04c(_0x55d693);});});} \ No newline at end of file +var _0x60ed=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x52f2a2,_0x39aacf){var _0x13d2e5=function(_0x2615bd){while(--_0x2615bd){_0x52f2a2['push'](_0x52f2a2['shift']());}};_0x13d2e5(++_0x39aacf);}(_0x60ed,0x73));var _0xd60e=function(_0x486b2f,_0x2f1e95){_0x486b2f=_0x486b2f-0x0;var _0x2070d5=_0x60ed[_0x486b2f];return _0x2070d5;};'use strict';var _=require(_0xd60e('0x0'));var util=require(_0xd60e('0x1'));var moment=require(_0xd60e('0x2'));var BPromise=require(_0xd60e('0x3'));var rs=require(_0xd60e('0x4'));var fs=require('fs');var Redis=require(_0xd60e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd60e('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd60e('0x7')][_0xd60e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3adc23,_0x47b2bf,_0x7988cb){return new BPromise(function(_0xa3aac7,_0xc22bc1){return client['request'](_0x3adc23,_0x7988cb)[_0xd60e('0x9')](function(_0x1ca561){logger[_0xd60e('0xa')](_0xd60e('0xb'),_0x47b2bf,_0xd60e('0xc'));logger[_0xd60e('0xd')](_0xd60e('0xe'),_0x47b2bf,_0xd60e('0xc'),JSON['stringify'](_0x1ca561));if(_0x1ca561[_0xd60e('0xf')]){if(_0x1ca561[_0xd60e('0xf')][_0xd60e('0x10')]===0x1f4){logger[_0xd60e('0xf')](_0xd60e('0xb'),_0x47b2bf,_0x1ca561[_0xd60e('0xf')][_0xd60e('0x11')]);return _0xc22bc1(_0x1ca561['error'][_0xd60e('0x11')]);}logger['error'](_0xd60e('0xb'),_0x47b2bf,_0x1ca561[_0xd60e('0xf')][_0xd60e('0x11')]);return _0xa3aac7(_0x1ca561[_0xd60e('0xf')][_0xd60e('0x11')]);}else{logger[_0xd60e('0xa')](_0xd60e('0xb'),_0x47b2bf,_0xd60e('0xc'));_0xa3aac7(_0x1ca561['result'][_0xd60e('0x11')]);}})[_0xd60e('0x12')](function(_0x2dfb82){logger[_0xd60e('0xf')](_0xd60e('0xb'),_0x47b2bf,_0x2dfb82);_0xc22bc1(_0x2dfb82);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4e5f19f..0aa90f6 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 _0xf36b=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','show','post'];(function(_0x3102ae,_0x196aeb){var _0x34db16=function(_0x591858){while(--_0x591858){_0x3102ae['push'](_0x3102ae['shift']());}};_0x34db16(++_0x196aeb);}(_0xf36b,0x136));var _0xbf36=function(_0x2e2374,_0x4780de){_0x2e2374=_0x2e2374-0x0;var _0x20581b=_0xf36b[_0x2e2374];return _0x20581b;};'use strict';var multer=require(_0xbf36('0x0'));var util=require(_0xbf36('0x1'));var path=require(_0xbf36('0x2'));var timeout=require(_0xbf36('0x3'));var express=require(_0xbf36('0x4'));var router=express['Router']();var fs_extra=require(_0xbf36('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbf36('0x6'));var config=require('../../config/environment');var controller=require(_0xbf36('0x7'));router[_0xbf36('0x8')]('/',auth[_0xbf36('0x9')](),controller[_0xbf36('0xa')]);router[_0xbf36('0x8')]('/:id',auth[_0xbf36('0x9')](),controller[_0xbf36('0xb')]);router[_0xbf36('0xc')]('/',auth[_0xbf36('0x9')](),controller[_0xbf36('0xd')]);router[_0xbf36('0xe')]('/:id',auth[_0xbf36('0x9')](),controller[_0xbf36('0xf')]);router[_0xbf36('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xbf36('0x11')]);module[_0xbf36('0x12')]=router; \ No newline at end of file +var _0xa293=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x336e33,_0x527fa3){var _0x6c333a=function(_0x48dabd){while(--_0x48dabd){_0x336e33['push'](_0x336e33['shift']());}};_0x6c333a(++_0x527fa3);}(_0xa293,0x7f));var _0x3a29=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xa293[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x3a29('0x0'));var util=require(_0x3a29('0x1'));var path=require(_0x3a29('0x2'));var timeout=require(_0x3a29('0x3'));var express=require(_0x3a29('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3a29('0x5'));var config=require(_0x3a29('0x6'));var controller=require(_0x3a29('0x7'));router[_0x3a29('0x8')]('/',auth[_0x3a29('0x9')](),controller[_0x3a29('0xa')]);router[_0x3a29('0x8')](_0x3a29('0xb'),auth[_0x3a29('0x9')](),controller[_0x3a29('0xc')]);router['post']('/',auth[_0x3a29('0x9')](),controller[_0x3a29('0xd')]);router[_0x3a29('0xe')](_0x3a29('0xb'),auth[_0x3a29('0x9')](),controller[_0x3a29('0xf')]);router[_0x3a29('0x10')](_0x3a29('0xb'),auth[_0x3a29('0x9')](),controller['destroy']);module[_0x3a29('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 04161f5..2eab86f 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 _0x7a9b=['sequelize','exports','variable','customVariable','keyValue','string','STRING','ENUM','BOOLEAN'];(function(_0x47159c,_0x1c8216){var _0x454dbe=function(_0x2b54f7){while(--_0x2b54f7){_0x47159c['push'](_0x47159c['shift']());}};_0x454dbe(++_0x1c8216);}(_0x7a9b,0x87));var _0xb7a9=function(_0x67cc83,_0x4e94ef){_0x67cc83=_0x67cc83-0x0;var _0xbc79ae=_0x7a9b[_0x67cc83];return _0xbc79ae;};'use strict';var Sequelize=require(_0xb7a9('0x0'));module[_0xb7a9('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xb7a9('0x2'),_0xb7a9('0x3'),_0xb7a9('0x4'),'picklist'),'defaultValue':_0xb7a9('0x5')},'content':{'type':Sequelize[_0xb7a9('0x6')]},'key':{'type':Sequelize[_0xb7a9('0x6')]},'keyType':{'type':Sequelize[_0xb7a9('0x7')](_0xb7a9('0x5'),'variable',_0xb7a9('0x3'))},'keyContent':{'type':Sequelize[_0xb7a9('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb7a9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb7a9('0x6')]}}; \ No newline at end of file +var _0x4ef5=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','sequelize','exports'];(function(_0x58f20b,_0x277c99){var _0x480fce=function(_0x50965f){while(--_0x50965f){_0x58f20b['push'](_0x58f20b['shift']());}};_0x480fce(++_0x277c99);}(_0x4ef5,0x1c9));var _0x54ef=function(_0x1e5496,_0xc5ff9b){_0x1e5496=_0x1e5496-0x0;var _0x40ddf7=_0x4ef5[_0x1e5496];return _0x40ddf7;};'use strict';var Sequelize=require(_0x54ef('0x0'));module[_0x54ef('0x1')]={'type':{'type':Sequelize[_0x54ef('0x2')](_0x54ef('0x3'),'variable',_0x54ef('0x4'),_0x54ef('0x5'),_0x54ef('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x54ef('0x7')]},'key':{'type':Sequelize[_0x54ef('0x7')]},'keyType':{'type':Sequelize[_0x54ef('0x2')]('string',_0x54ef('0x8'),_0x54ef('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x54ef('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x54ef('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2b88aff..22735a1 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 _0x0fb8=['limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','length','find','create','catch','body','eml-format','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset'];(function(_0x448e55,_0x143d39){var _0xccb6aa=function(_0xcfac24){while(--_0xcfac24){_0x448e55['push'](_0x448e55['shift']());}};_0xccb6aa(++_0x143d39);}(_0x0fb8,0x1e7));var _0x80fb=function(_0x3e31e4,_0x1c6ae7){_0x3e31e4=_0x3e31e4-0x0;var _0x252fd5=_0x0fb8[_0x3e31e4];return _0x252fd5;};'use strict';var emlformat=require(_0x80fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x80fb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x80fb('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x80fb('0x3'));var util=require(_0x80fb('0x4'));var path=require('path');var sox=require(_0x80fb('0x5'));var csv=require(_0x80fb('0x6'));var ejs=require(_0x80fb('0x7'));var fs=require('fs');var fs_extra=require(_0x80fb('0x8'));var _=require(_0x80fb('0x9'));var squel=require(_0x80fb('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x80fb('0xb'));var toCsv=require(_0x80fb('0x6'));var querystring=require(_0x80fb('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x80fb('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x80fb('0xe'));var logger=require(_0x80fb('0xf'))(_0x80fb('0x10'));var utils=require(_0x80fb('0x11'));var config=require(_0x80fb('0x12'));var licenseUtil=require(_0x80fb('0x13'));var db=require(_0x80fb('0x14'))['db'];function respondWithStatusCode(_0x229620,_0x39e79c){_0x39e79c=_0x39e79c||0xcc;return function(_0x12b481){if(_0x12b481){return _0x229620['sendStatus'](_0x39e79c);}return _0x229620['status'](_0x39e79c)[_0x80fb('0x15')]();};}function respondWithResult(_0x350766,_0x1b1be7){_0x1b1be7=_0x1b1be7||0xc8;return function(_0x4e16cc){if(_0x4e16cc){return _0x350766['status'](_0x1b1be7)[_0x80fb('0x16')](_0x4e16cc);}};}function respondWithFilteredResult(_0x2e1127,_0x354e1d){return function(_0x55f4b0){if(_0x55f4b0){var _0x52877d=typeof _0x354e1d[_0x80fb('0x17')]==='undefined'&&typeof _0x354e1d[_0x80fb('0x18')]===_0x80fb('0x19');var _0x105793=_0x55f4b0[_0x80fb('0x1a')];var _0x3b59f1=_0x52877d?0x0:_0x354e1d[_0x80fb('0x17')];var _0x2a92c3=_0x52877d?_0x55f4b0[_0x80fb('0x1a')]:_0x354e1d[_0x80fb('0x17')]+_0x354e1d[_0x80fb('0x18')];var _0x42c5eb;if(_0x2a92c3>=_0x105793){_0x2a92c3=_0x105793;_0x42c5eb=0xc8;}else{_0x42c5eb=0xce;}_0x2e1127[_0x80fb('0x1b')](_0x42c5eb);return _0x2e1127[_0x80fb('0x1c')](_0x80fb('0x1d'),_0x3b59f1+'-'+_0x2a92c3+'/'+_0x105793)[_0x80fb('0x16')](_0x55f4b0);}return null;};}function patchUpdates(_0x16a098){return function(_0x4711f4){try{jsonpatch[_0x80fb('0x1e')](_0x4711f4,_0x16a098,!![]);}catch(_0x6b9d65){return BPromise[_0x80fb('0x1f')](_0x6b9d65);}return _0x4711f4[_0x80fb('0x20')]();};}function saveUpdates(_0x436239,_0x2d4eed){return function(_0x521fa9){if(_0x521fa9){return _0x521fa9[_0x80fb('0x21')](_0x436239)[_0x80fb('0x22')](function(_0x3f8c99){return _0x3f8c99;});}return null;};}function removeEntity(_0x223e5a,_0x875868){return function(_0x14f3dc){if(_0x14f3dc){return _0x14f3dc[_0x80fb('0x23')]()[_0x80fb('0x22')](function(){_0x223e5a['status'](0xcc)[_0x80fb('0x15')]();});}};}function handleEntityNotFound(_0x2de3d4,_0x204126){return function(_0x47bef5){if(!_0x47bef5){_0x2de3d4['sendStatus'](0x194);}return _0x47bef5;};}function handleError(_0x5ec1db,_0x359547){_0x359547=_0x359547||0x1f4;return function(_0x36125f){logger[_0x80fb('0x24')](_0x36125f[_0x80fb('0x25')]);if(_0x36125f[_0x80fb('0x26')]){delete _0x36125f[_0x80fb('0x26')];}_0x5ec1db[_0x80fb('0x1b')](_0x359547)[_0x80fb('0x27')](_0x36125f);};}exports[_0x80fb('0x28')]=function(_0x37994e,_0x40941d){var _0x35d60b={},_0x17b489={},_0x2c3a8f={'count':0x0,'rows':[]};var _0x22c13c=_[_0x80fb('0x29')](db[_0x80fb('0x2a')][_0x80fb('0x2b')],function(_0x23cd42){return{'name':_0x23cd42['fieldName'],'type':_0x23cd42[_0x80fb('0x2c')][_0x80fb('0x2d')]};});_0x17b489['model']=_[_0x80fb('0x29')](_0x22c13c,_0x80fb('0x26'));_0x17b489[_0x80fb('0x2e')]=_[_0x80fb('0x2f')](_0x37994e['query']);_0x17b489[_0x80fb('0x30')]=_[_0x80fb('0x31')](_0x17b489[_0x80fb('0x32')],_0x17b489[_0x80fb('0x2e')]);_0x35d60b[_0x80fb('0x33')]=_[_0x80fb('0x31')](_0x17b489['model'],qs[_0x80fb('0x34')](_0x37994e[_0x80fb('0x2e')]['fields']));_0x35d60b[_0x80fb('0x33')]=_0x35d60b['attributes']['length']?_0x35d60b[_0x80fb('0x33')]:_0x17b489['model'];if(!_0x37994e[_0x80fb('0x2e')][_0x80fb('0x35')](_0x80fb('0x36'))){_0x35d60b[_0x80fb('0x18')]=qs[_0x80fb('0x18')](_0x37994e[_0x80fb('0x2e')]['limit']);_0x35d60b[_0x80fb('0x17')]=qs[_0x80fb('0x17')](_0x37994e['query'][_0x80fb('0x17')]);}_0x35d60b[_0x80fb('0x37')]=qs['sort'](_0x37994e['query'][_0x80fb('0x38')]);_0x35d60b[_0x80fb('0x39')]=qs['filters'](_[_0x80fb('0x3a')](_0x37994e['query'],_0x17b489[_0x80fb('0x30')]),_0x22c13c);if(_0x37994e[_0x80fb('0x2e')][_0x80fb('0x3b')]){_0x35d60b['where']=_[_0x80fb('0x3c')](_0x35d60b[_0x80fb('0x39')],{'$or':_[_0x80fb('0x29')](_0x22c13c,function(_0x427563){if(_0x427563[_0x80fb('0x2c')]!=='VIRTUAL'){var _0x669962={};_0x669962[_0x427563[_0x80fb('0x26')]]={'$like':'%'+_0x37994e['query']['filter']+'%'};return _0x669962;}})});}_0x35d60b=_[_0x80fb('0x3c')]({},_0x35d60b,_0x37994e[_0x80fb('0x3d')]);var _0x1a8259={'where':_0x35d60b['where']};return db[_0x80fb('0x2a')][_0x80fb('0x1a')](_0x1a8259)[_0x80fb('0x22')](function(_0x56b18d){_0x2c3a8f['count']=_0x56b18d;if(_0x37994e[_0x80fb('0x2e')][_0x80fb('0x3e')]){_0x35d60b[_0x80fb('0x3f')]=[{'all':!![]}];}return db[_0x80fb('0x2a')][_0x80fb('0x40')](_0x35d60b);})['then'](function(_0x24c019){_0x2c3a8f[_0x80fb('0x41')]=_0x24c019;return _0x2c3a8f;})[_0x80fb('0x22')](respondWithFilteredResult(_0x40941d,_0x35d60b))['catch'](handleError(_0x40941d,null));};exports[_0x80fb('0x42')]=function(_0x2a1fd3,_0x2754c1){var _0x14ff2a={'raw':!![],'where':{'id':_0x2a1fd3[_0x80fb('0x43')]['id']}},_0x376778={};_0x376778[_0x80fb('0x32')]=_['keys'](db[_0x80fb('0x2a')][_0x80fb('0x2b')]);_0x376778[_0x80fb('0x2e')]=_[_0x80fb('0x2f')](_0x2a1fd3[_0x80fb('0x2e')]);_0x376778['filters']=_[_0x80fb('0x31')](_0x376778[_0x80fb('0x32')],_0x376778[_0x80fb('0x2e')]);_0x14ff2a[_0x80fb('0x33')]=_['intersection'](_0x376778[_0x80fb('0x32')],qs['fields'](_0x2a1fd3[_0x80fb('0x2e')][_0x80fb('0x34')]));_0x14ff2a[_0x80fb('0x33')]=_0x14ff2a['attributes'][_0x80fb('0x44')]?_0x14ff2a[_0x80fb('0x33')]:_0x376778['model'];if(_0x2a1fd3[_0x80fb('0x2e')]['includeAll']){_0x14ff2a[_0x80fb('0x3f')]=[{'all':!![]}];}_0x14ff2a=_['merge']({},_0x14ff2a,_0x2a1fd3[_0x80fb('0x3d')]);return db[_0x80fb('0x2a')][_0x80fb('0x45')](_0x14ff2a)[_0x80fb('0x22')](handleEntityNotFound(_0x2754c1,null))[_0x80fb('0x22')](respondWithResult(_0x2754c1,null))['catch'](handleError(_0x2754c1,null));};exports[_0x80fb('0x46')]=function(_0x484334,_0x163755){return db[_0x80fb('0x2a')][_0x80fb('0x46')](_0x484334['body'],{})[_0x80fb('0x22')](respondWithResult(_0x163755,0xc9))[_0x80fb('0x47')](handleError(_0x163755,null));};exports[_0x80fb('0x21')]=function(_0x117e34,_0x5bc619){if(_0x117e34[_0x80fb('0x48')]['id']){delete _0x117e34[_0x80fb('0x48')]['id'];}return db[_0x80fb('0x2a')][_0x80fb('0x45')]({'where':{'id':_0x117e34['params']['id']}})[_0x80fb('0x22')](handleEntityNotFound(_0x5bc619,null))[_0x80fb('0x22')](saveUpdates(_0x117e34['body'],null))[_0x80fb('0x22')](respondWithResult(_0x5bc619,null))[_0x80fb('0x47')](handleError(_0x5bc619,null));};exports[_0x80fb('0x23')]=function(_0x1ccf3f,_0x12b4b0){return db['ServicenowField'][_0x80fb('0x45')]({'where':{'id':_0x1ccf3f[_0x80fb('0x43')]['id']}})['then'](handleEntityNotFound(_0x12b4b0,null))['then'](removeEntity(_0x12b4b0,null))['catch'](handleError(_0x12b4b0,null));}; \ No newline at end of file +var _0x84c7=['merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','params','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x589d94,_0x535515){var _0x124ed8=function(_0x3ac327){while(--_0x3ac327){_0x589d94['push'](_0x589d94['shift']());}};_0x124ed8(++_0x535515);}(_0x84c7,0xa4));var _0x784c=function(_0x4ff53c,_0x221bf0){_0x4ff53c=_0x4ff53c-0x0;var _0x46b18f=_0x84c7[_0x4ff53c];return _0x46b18f;};'use strict';var emlformat=require(_0x784c('0x0'));var rimraf=require(_0x784c('0x1'));var zipdir=require(_0x784c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x784c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x784c('0x4'));var util=require(_0x784c('0x5'));var path=require(_0x784c('0x6'));var sox=require('sox');var csv=require(_0x784c('0x7'));var ejs=require(_0x784c('0x8'));var fs=require('fs');var fs_extra=require(_0x784c('0x9'));var _=require('lodash');var squel=require(_0x784c('0xa'));var crypto=require(_0x784c('0xb'));var jsforce=require(_0x784c('0xc'));var deskjs=require(_0x784c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x784c('0xe'));var Papa=require('papaparse');var Redis=require(_0x784c('0xf'));var authService=require(_0x784c('0x10'));var qs=require(_0x784c('0x11'));var as=require(_0x784c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x784c('0x13'))('api');var utils=require(_0x784c('0x14'));var config=require(_0x784c('0x15'));var licenseUtil=require(_0x784c('0x16'));var db=require(_0x784c('0x17'))['db'];function respondWithStatusCode(_0x15028c,_0x28510c){_0x28510c=_0x28510c||0xcc;return function(_0x511982){if(_0x511982){return _0x15028c['sendStatus'](_0x28510c);}return _0x15028c[_0x784c('0x18')](_0x28510c)['end']();};}function respondWithResult(_0x20623c,_0xf43f2){_0xf43f2=_0xf43f2||0xc8;return function(_0x4656a5){if(_0x4656a5){return _0x20623c[_0x784c('0x18')](_0xf43f2)['json'](_0x4656a5);}};}function respondWithFilteredResult(_0x45ad23,_0x4b97a6){return function(_0x3f7845){if(_0x3f7845){var _0x118da0=typeof _0x4b97a6['offset']===_0x784c('0x19')&&typeof _0x4b97a6['limit']===_0x784c('0x19');var _0xa7402e=_0x3f7845[_0x784c('0x1a')];var _0x2f0d67=_0x118da0?0x0:_0x4b97a6['offset'];var _0x436c95=_0x118da0?_0x3f7845['count']:_0x4b97a6[_0x784c('0x1b')]+_0x4b97a6[_0x784c('0x1c')];var _0x6a12e7;if(_0x436c95>=_0xa7402e){_0x436c95=_0xa7402e;_0x6a12e7=0xc8;}else{_0x6a12e7=0xce;}_0x45ad23['status'](_0x6a12e7);return _0x45ad23[_0x784c('0x1d')](_0x784c('0x1e'),_0x2f0d67+'-'+_0x436c95+'/'+_0xa7402e)[_0x784c('0x1f')](_0x3f7845);}return null;};}function patchUpdates(_0x3c14ee){return function(_0x2db7d1){try{jsonpatch[_0x784c('0x20')](_0x2db7d1,_0x3c14ee,!![]);}catch(_0x56f18e){return BPromise[_0x784c('0x21')](_0x56f18e);}return _0x2db7d1[_0x784c('0x22')]();};}function saveUpdates(_0x144c6b,_0x5d8d3d){return function(_0x3b048c){if(_0x3b048c){return _0x3b048c[_0x784c('0x23')](_0x144c6b)[_0x784c('0x24')](function(_0x786bdf){return _0x786bdf;});}return null;};}function removeEntity(_0x4c2ccf,_0x4d494c){return function(_0x3a97e2){if(_0x3a97e2){return _0x3a97e2[_0x784c('0x25')]()['then'](function(){_0x4c2ccf[_0x784c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17b111,_0x5a6835){return function(_0x3a268c){if(!_0x3a268c){_0x17b111[_0x784c('0x26')](0x194);}return _0x3a268c;};}function handleError(_0x4d8ed0,_0x434c88){_0x434c88=_0x434c88||0x1f4;return function(_0x36cfdc){logger[_0x784c('0x27')](_0x36cfdc[_0x784c('0x28')]);if(_0x36cfdc[_0x784c('0x29')]){delete _0x36cfdc[_0x784c('0x29')];}_0x4d8ed0[_0x784c('0x18')](_0x434c88)[_0x784c('0x2a')](_0x36cfdc);};}exports[_0x784c('0x2b')]=function(_0x1bdadf,_0x1a5524){var _0x56aeb0={},_0x495616={},_0xeef40={'count':0x0,'rows':[]};var _0x166138=_[_0x784c('0x2c')](db[_0x784c('0x2d')][_0x784c('0x2e')],function(_0xa9df5f){return{'name':_0xa9df5f[_0x784c('0x2f')],'type':_0xa9df5f[_0x784c('0x30')]['key']};});_0x495616[_0x784c('0x31')]=_[_0x784c('0x2c')](_0x166138,'name');_0x495616[_0x784c('0x32')]=_[_0x784c('0x33')](_0x1bdadf[_0x784c('0x32')]);_0x495616[_0x784c('0x34')]=_[_0x784c('0x35')](_0x495616[_0x784c('0x31')],_0x495616['query']);_0x56aeb0[_0x784c('0x36')]=_[_0x784c('0x35')](_0x495616['model'],qs['fields'](_0x1bdadf[_0x784c('0x32')][_0x784c('0x37')]));_0x56aeb0['attributes']=_0x56aeb0[_0x784c('0x36')][_0x784c('0x38')]?_0x56aeb0[_0x784c('0x36')]:_0x495616[_0x784c('0x31')];if(!_0x1bdadf[_0x784c('0x32')][_0x784c('0x39')](_0x784c('0x3a'))){_0x56aeb0[_0x784c('0x1c')]=qs[_0x784c('0x1c')](_0x1bdadf[_0x784c('0x32')][_0x784c('0x1c')]);_0x56aeb0[_0x784c('0x1b')]=qs['offset'](_0x1bdadf['query']['offset']);}_0x56aeb0[_0x784c('0x3b')]=qs['sort'](_0x1bdadf[_0x784c('0x32')][_0x784c('0x3c')]);_0x56aeb0[_0x784c('0x3d')]=qs[_0x784c('0x34')](_[_0x784c('0x3e')](_0x1bdadf['query'],_0x495616[_0x784c('0x34')]),_0x166138);if(_0x1bdadf[_0x784c('0x32')][_0x784c('0x3f')]){_0x56aeb0['where']=_[_0x784c('0x40')](_0x56aeb0['where'],{'$or':_['map'](_0x166138,function(_0x2e7d33){if(_0x2e7d33[_0x784c('0x30')]!==_0x784c('0x41')){var _0x23cebd={};_0x23cebd[_0x2e7d33[_0x784c('0x29')]]={'$like':'%'+_0x1bdadf[_0x784c('0x32')]['filter']+'%'};return _0x23cebd;}})});}_0x56aeb0=_['merge']({},_0x56aeb0,_0x1bdadf[_0x784c('0x42')]);var _0x1c94bb={'where':_0x56aeb0['where']};return db[_0x784c('0x2d')][_0x784c('0x1a')](_0x1c94bb)['then'](function(_0x3ca70a){_0xeef40[_0x784c('0x1a')]=_0x3ca70a;if(_0x1bdadf['query']['includeAll']){_0x56aeb0[_0x784c('0x43')]=[{'all':!![]}];}return db['ServicenowField'][_0x784c('0x44')](_0x56aeb0);})['then'](function(_0x1875fd){_0xeef40['rows']=_0x1875fd;return _0xeef40;})[_0x784c('0x24')](respondWithFilteredResult(_0x1a5524,_0x56aeb0))[_0x784c('0x45')](handleError(_0x1a5524,null));};exports[_0x784c('0x46')]=function(_0x176ad5,_0x28c896){var _0x3ffb37={'raw':!![],'where':{'id':_0x176ad5['params']['id']}},_0x1be0a5={};_0x1be0a5[_0x784c('0x31')]=_[_0x784c('0x33')](db[_0x784c('0x2d')][_0x784c('0x2e')]);_0x1be0a5[_0x784c('0x32')]=_[_0x784c('0x33')](_0x176ad5[_0x784c('0x32')]);_0x1be0a5[_0x784c('0x34')]=_[_0x784c('0x35')](_0x1be0a5[_0x784c('0x31')],_0x1be0a5['query']);_0x3ffb37[_0x784c('0x36')]=_[_0x784c('0x35')](_0x1be0a5[_0x784c('0x31')],qs[_0x784c('0x37')](_0x176ad5['query']['fields']));_0x3ffb37[_0x784c('0x36')]=_0x3ffb37['attributes'][_0x784c('0x38')]?_0x3ffb37['attributes']:_0x1be0a5[_0x784c('0x31')];if(_0x176ad5['query'][_0x784c('0x47')]){_0x3ffb37[_0x784c('0x43')]=[{'all':!![]}];}_0x3ffb37=_[_0x784c('0x40')]({},_0x3ffb37,_0x176ad5['options']);return db[_0x784c('0x2d')][_0x784c('0x48')](_0x3ffb37)[_0x784c('0x24')](handleEntityNotFound(_0x28c896,null))['then'](respondWithResult(_0x28c896,null))[_0x784c('0x45')](handleError(_0x28c896,null));};exports[_0x784c('0x49')]=function(_0x422de5,_0x1c0114){return db[_0x784c('0x2d')]['create'](_0x422de5[_0x784c('0x4a')],{})['then'](respondWithResult(_0x1c0114,0xc9))[_0x784c('0x45')](handleError(_0x1c0114,null));};exports[_0x784c('0x23')]=function(_0x2e62da,_0x34699b){if(_0x2e62da[_0x784c('0x4a')]['id']){delete _0x2e62da[_0x784c('0x4a')]['id'];}return db['ServicenowField']['find']({'where':{'id':_0x2e62da['params']['id']}})[_0x784c('0x24')](handleEntityNotFound(_0x34699b,null))[_0x784c('0x24')](saveUpdates(_0x2e62da['body'],null))[_0x784c('0x24')](respondWithResult(_0x34699b,null))[_0x784c('0x45')](handleError(_0x34699b,null));};exports['destroy']=function(_0x21591c,_0x527ecb){return db[_0x784c('0x2d')]['find']({'where':{'id':_0x21591c[_0x784c('0x4b')]['id']}})[_0x784c('0x24')](handleEntityNotFound(_0x527ecb,null))['then'](removeEntity(_0x527ecb,null))[_0x784c('0x45')](handleError(_0x527ecb,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 051ef38..22fd92d 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 _0x1288=['rimraf','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','../../config/logger','api','moment','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1288,0x1c4));var _0x8128=function(_0xa92ef6,_0x44cb1d){_0xa92ef6=_0xa92ef6-0x0;var _0x10207a=_0x1288[_0xa92ef6];return _0x10207a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8128('0x0'))(_0x8128('0x1'));var moment=require(_0x8128('0x2'));var BPromise=require('bluebird');var rp=require(_0x8128('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8128('0x4'));var config=require(_0x8128('0x5'));var attributes=require('./intServicenowField.attributes');module[_0x8128('0x6')]=function(_0x54cae7,_0x2d9714){return _0x54cae7[_0x8128('0x7')](_0x8128('0x8'),attributes,{'tableName':_0x8128('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x8128('0xa'),_0x8128('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f7d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x23e0db,_0x2ce6fc){var _0x1bad44=function(_0x489c8b){while(--_0x489c8b){_0x23e0db['push'](_0x23e0db['shift']());}};_0x1bad44(++_0x2ce6fc);}(_0x9f7d,0x143));var _0xd9f7=function(_0x1a2e02,_0x1cbc70){_0x1a2e02=_0x1a2e02-0x0;var _0x550bc5=_0x9f7d[_0x1a2e02];return _0x550bc5;};'use strict';var _=require(_0xd9f7('0x0'));var util=require(_0xd9f7('0x1'));var logger=require(_0xd9f7('0x2'))(_0xd9f7('0x3'));var moment=require(_0xd9f7('0x4'));var BPromise=require(_0xd9f7('0x5'));var rp=require(_0xd9f7('0x6'));var fs=require('fs');var path=require(_0xd9f7('0x7'));var rimraf=require(_0xd9f7('0x8'));var config=require(_0xd9f7('0x9'));var attributes=require(_0xd9f7('0xa'));module[_0xd9f7('0xb')]=function(_0x1c1ade,_0x3ff8a7){return _0x1c1ade[_0xd9f7('0xc')](_0xd9f7('0xd'),attributes,{'tableName':_0xd9f7('0xe'),'paranoid':![],'indexes':[{'name':_0xd9f7('0xf'),'fields':[_0xd9f7('0x10'),_0xd9f7('0x11')],'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 b850400..cb31942 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0xbdb7[_0x29e0eb];return _0x597d2d;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1238e0,_0x16bd9b){_0x1238e0=_0x1238e0-0x0;var _0x59dfc8=_0xbdb7[_0x1238e0];return _0x59dfc8;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fd4902b..631bacb 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(_0x4bb3ed,_0x3b38f5){var _0x1064d4=function(_0x24be01){while(--_0x24be01){_0x4bb3ed['push'](_0x4bb3ed['shift']());}};_0x1064d4(++_0x3b38f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x13289a,_0x464236){var _0x13d6be=function(_0x420049){while(--_0x420049){_0x13289a['push'](_0x13289a['shift']());}};_0x13d6be(++_0x464236);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 46a2ea2..e239935 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(_0xd341e4,_0x3f71f8){var _0x3acb1b=function(_0x3c3fae){while(--_0x3c3fae){_0xd341e4['push'](_0xd341e4['shift']());}};_0x3acb1b(++_0x3f71f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x104318,_0x9080eb){var _0x161104=function(_0x30582c){while(--_0x30582c){_0x104318['push'](_0x104318['shift']());}};_0x161104(++_0x9080eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 4583d47..7d4a533 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 _0x14ac=['send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','length','attributes','sort','where','filter','merge','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','SugarcrmConfiguration','order','pick','nolimit','catch','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','/service/v4_1/rest.php','get_module_fields','values','module_fields','remove','label','test','statusCode','status','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','limit','undefined','count','offset','set','json','reject','save','update','then','destroy','error','stack','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x14ac,0x13b));var _0xc14a=function(_0x567ffc,_0x2ef735){_0x567ffc=_0x567ffc-0x0;var _0x56180f=_0x14ac[_0x567ffc];return _0x56180f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc14a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc14a('0x1'));var moment=require(_0xc14a('0x2'));var BPromise=require(_0xc14a('0x3'));var Mustache=require(_0xc14a('0x4'));var util=require(_0xc14a('0x5'));var path=require(_0xc14a('0x6'));var sox=require(_0xc14a('0x7'));var csv=require('to-csv');var ejs=require(_0xc14a('0x8'));var fs=require('fs');var fs_extra=require(_0xc14a('0x9'));var _=require(_0xc14a('0xa'));var squel=require(_0xc14a('0xb'));var crypto=require(_0xc14a('0xc'));var jsforce=require(_0xc14a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc14a('0xe'));var querystring=require('querystring');var Papa=require(_0xc14a('0xf'));var Redis=require('ioredis');var authService=require(_0xc14a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc14a('0x11'));var hardwareService=require(_0xc14a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc14a('0x13'));var config=require(_0xc14a('0x14'));var licenseUtil=require(_0xc14a('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc14a('0x16'));function respondWithStatusCode(_0x83a1d3,_0x91c103){_0x91c103=_0x91c103||0xcc;return function(_0x6779cc){if(_0x6779cc){return _0x83a1d3[_0xc14a('0x17')](_0x91c103);}return _0x83a1d3['status'](_0x91c103)[_0xc14a('0x18')]();};}function respondWithResult(_0x492572,_0x10d288){_0x10d288=_0x10d288||0xc8;return function(_0x29e495){if(_0x29e495){return _0x492572['status'](_0x10d288)['json'](_0x29e495);}};}function respondWithFilteredResult(_0x2dd203,_0x556c14){return function(_0x23f59b){if(_0x23f59b){var _0x11df63=typeof _0x556c14['offset']==='undefined'&&typeof _0x556c14[_0xc14a('0x19')]===_0xc14a('0x1a');var _0x22e549=_0x23f59b[_0xc14a('0x1b')];var _0x33b7ec=_0x11df63?0x0:_0x556c14[_0xc14a('0x1c')];var _0x1c0c09=_0x11df63?_0x23f59b[_0xc14a('0x1b')]:_0x556c14[_0xc14a('0x1c')]+_0x556c14[_0xc14a('0x19')];var _0x17e470;if(_0x1c0c09>=_0x22e549){_0x1c0c09=_0x22e549;_0x17e470=0xc8;}else{_0x17e470=0xce;}_0x2dd203['status'](_0x17e470);return _0x2dd203[_0xc14a('0x1d')]('Content-Range',_0x33b7ec+'-'+_0x1c0c09+'/'+_0x22e549)[_0xc14a('0x1e')](_0x23f59b);}return null;};}function patchUpdates(_0x341aea){return function(_0x9d7a01){try{jsonpatch['apply'](_0x9d7a01,_0x341aea,!![]);}catch(_0x39f636){return BPromise[_0xc14a('0x1f')](_0x39f636);}return _0x9d7a01[_0xc14a('0x20')]();};}function saveUpdates(_0x3144c4,_0x276f61){return function(_0x594c89){if(_0x594c89){return _0x594c89[_0xc14a('0x21')](_0x3144c4)[_0xc14a('0x22')](function(_0xddcb32){return _0xddcb32;});}return null;};}function removeEntity(_0x1e8f4c,_0x518dfa){return function(_0xdedfa3){if(_0xdedfa3){return _0xdedfa3[_0xc14a('0x23')]()[_0xc14a('0x22')](function(){_0x1e8f4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x171967,_0x2ae3e7){return function(_0x3ef40a){if(!_0x3ef40a){_0x171967[_0xc14a('0x17')](0x194);}return _0x3ef40a;};}function handleError(_0x4a2463,_0x50f47c){_0x50f47c=_0x50f47c||0x1f4;return function(_0x215bf6){logger[_0xc14a('0x24')](_0x215bf6[_0xc14a('0x25')]);if(_0x215bf6[_0xc14a('0x26')]){delete _0x215bf6['name'];}_0x4a2463['status'](_0x50f47c)[_0xc14a('0x27')](_0x215bf6);};}exports[_0xc14a('0x28')]=function(_0x303934,_0x327bc7){var _0x3329a9={},_0x8aef2a={},_0x274b69={'count':0x0,'rows':[]};var _0x2a9dcd=_[_0xc14a('0x29')](db[_0xc14a('0x2a')][_0xc14a('0x2b')],function(_0xb76d9f){return{'name':_0xb76d9f[_0xc14a('0x2c')],'type':_0xb76d9f[_0xc14a('0x2d')]['key']};});_0x8aef2a[_0xc14a('0x2e')]=_[_0xc14a('0x29')](_0x2a9dcd,_0xc14a('0x26'));_0x8aef2a[_0xc14a('0x2f')]=_['keys'](_0x303934[_0xc14a('0x2f')]);_0x8aef2a[_0xc14a('0x30')]=_[_0xc14a('0x31')](_0x8aef2a[_0xc14a('0x2e')],_0x8aef2a[_0xc14a('0x2f')]);_0x3329a9['attributes']=_[_0xc14a('0x31')](_0x8aef2a[_0xc14a('0x2e')],qs['fields'](_0x303934[_0xc14a('0x2f')][_0xc14a('0x32')]));_0x3329a9['attributes']=_0x3329a9['attributes'][_0xc14a('0x33')]?_0x3329a9[_0xc14a('0x34')]:_0x8aef2a[_0xc14a('0x2e')];if(!_0x303934['query']['hasOwnProperty']('nolimit')){_0x3329a9[_0xc14a('0x19')]=qs[_0xc14a('0x19')](_0x303934[_0xc14a('0x2f')][_0xc14a('0x19')]);_0x3329a9[_0xc14a('0x1c')]=qs[_0xc14a('0x1c')](_0x303934[_0xc14a('0x2f')]['offset']);}_0x3329a9['order']=qs[_0xc14a('0x35')](_0x303934[_0xc14a('0x2f')][_0xc14a('0x35')]);_0x3329a9[_0xc14a('0x36')]=qs[_0xc14a('0x30')](_['pick'](_0x303934[_0xc14a('0x2f')],_0x8aef2a[_0xc14a('0x30')]),_0x2a9dcd);if(_0x303934[_0xc14a('0x2f')][_0xc14a('0x37')]){_0x3329a9[_0xc14a('0x36')]=_[_0xc14a('0x38')](_0x3329a9['where'],{'$or':_[_0xc14a('0x29')](_0x2a9dcd,function(_0x49d66f){if(_0x49d66f[_0xc14a('0x2d')]!=='VIRTUAL'){var _0x16b57a={};_0x16b57a[_0x49d66f['name']]={'$like':'%'+_0x303934['query'][_0xc14a('0x37')]+'%'};return _0x16b57a;}})});}_0x3329a9=_[_0xc14a('0x38')]({},_0x3329a9,_0x303934['options']);var _0x403951={'where':_0x3329a9[_0xc14a('0x36')]};return db[_0xc14a('0x2a')][_0xc14a('0x1b')](_0x403951)['then'](function(_0x38bf90){_0x274b69['count']=_0x38bf90;if(_0x303934[_0xc14a('0x2f')][_0xc14a('0x39')]){_0x3329a9[_0xc14a('0x3a')]=[{'all':!![]}];}return db[_0xc14a('0x2a')][_0xc14a('0x3b')](_0x3329a9);})[_0xc14a('0x22')](function(_0x4f7267){_0x274b69[_0xc14a('0x3c')]=_0x4f7267;return _0x274b69;})[_0xc14a('0x22')](respondWithFilteredResult(_0x327bc7,_0x3329a9))['catch'](handleError(_0x327bc7,null));};exports[_0xc14a('0x3d')]=function(_0x1e1fd5,_0x23bc0a){var _0x4c027c={'raw':![],'where':{'id':_0x1e1fd5[_0xc14a('0x3e')]['id']}},_0x54fd1d={};_0x54fd1d[_0xc14a('0x2e')]=_[_0xc14a('0x3f')](db[_0xc14a('0x2a')][_0xc14a('0x2b')]);_0x54fd1d[_0xc14a('0x2f')]=_[_0xc14a('0x3f')](_0x1e1fd5[_0xc14a('0x2f')]);_0x54fd1d[_0xc14a('0x30')]=_[_0xc14a('0x31')](_0x54fd1d[_0xc14a('0x2e')],_0x54fd1d['query']);_0x4c027c[_0xc14a('0x34')]=_[_0xc14a('0x31')](_0x54fd1d[_0xc14a('0x2e')],qs['fields'](_0x1e1fd5[_0xc14a('0x2f')][_0xc14a('0x32')]));_0x4c027c['attributes']=_0x4c027c[_0xc14a('0x34')][_0xc14a('0x33')]?_0x4c027c[_0xc14a('0x34')]:_0x54fd1d[_0xc14a('0x2e')];if(_0x1e1fd5['query'][_0xc14a('0x39')]){_0x4c027c['include']=[{'all':!![]}];}_0x4c027c=_[_0xc14a('0x38')]({},_0x4c027c,_0x1e1fd5[_0xc14a('0x40')]);return db['SugarcrmAccount'][_0xc14a('0x41')](_0x4c027c)[_0xc14a('0x22')](handleEntityNotFound(_0x23bc0a,null))[_0xc14a('0x22')](respondWithResult(_0x23bc0a,null))['catch'](handleError(_0x23bc0a,null));};exports[_0xc14a('0x42')]=function(_0x5ea64d,_0x16610b){return db['SugarcrmAccount'][_0xc14a('0x42')](_0x5ea64d[_0xc14a('0x43')],{})[_0xc14a('0x22')](respondWithResult(_0x16610b,0xc9))['catch'](handleError(_0x16610b,null));};exports[_0xc14a('0x21')]=function(_0x4e017a,_0x117a75){if(_0x4e017a[_0xc14a('0x43')]['id']){delete _0x4e017a[_0xc14a('0x43')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x4e017a[_0xc14a('0x3e')]['id']}})[_0xc14a('0x22')](handleEntityNotFound(_0x117a75,null))['then'](saveUpdates(_0x4e017a[_0xc14a('0x43')],null))[_0xc14a('0x22')](respondWithResult(_0x117a75,null))['catch'](handleError(_0x117a75,null));};exports['destroy']=function(_0x324c49,_0x54a833){return db[_0xc14a('0x2a')][_0xc14a('0x41')]({'where':{'id':_0x324c49[_0xc14a('0x3e')]['id']}})[_0xc14a('0x22')](handleEntityNotFound(_0x54a833,null))[_0xc14a('0x22')](removeEntity(_0x54a833,null))['catch'](handleError(_0x54a833,null));};exports[_0xc14a('0x44')]=function(_0x14404b,_0x317df4,_0x27bc1f){var _0x2dcfe1={};var _0x18737c={};var _0x48bbe8;var _0x36c6c0;return db[_0xc14a('0x2a')]['findOne']({'where':{'id':_0x14404b[_0xc14a('0x3e')]['id']}})[_0xc14a('0x22')](handleEntityNotFound(_0x317df4,null))[_0xc14a('0x22')](function(_0x5e3a14){if(_0x5e3a14){_0x48bbe8=_0x5e3a14;_0x18737c[_0xc14a('0x2e')]=_[_0xc14a('0x3f')](db[_0xc14a('0x45')][_0xc14a('0x2b')]);_0x18737c['query']=_[_0xc14a('0x3f')](_0x14404b[_0xc14a('0x2f')]);_0x18737c[_0xc14a('0x30')]=_[_0xc14a('0x31')](_0x18737c[_0xc14a('0x2e')],_0x18737c[_0xc14a('0x2f')]);_0x2dcfe1[_0xc14a('0x34')]=_['intersection'](_0x18737c[_0xc14a('0x2e')],qs[_0xc14a('0x32')](_0x14404b[_0xc14a('0x2f')][_0xc14a('0x32')]));_0x2dcfe1[_0xc14a('0x34')]=_0x2dcfe1[_0xc14a('0x34')][_0xc14a('0x33')]?_0x2dcfe1[_0xc14a('0x34')]:_0x18737c['model'];_0x2dcfe1[_0xc14a('0x46')]=qs[_0xc14a('0x35')](_0x14404b['query'][_0xc14a('0x35')]);_0x2dcfe1[_0xc14a('0x36')]=qs[_0xc14a('0x30')](_[_0xc14a('0x47')](_0x14404b['query'],_0x18737c['filters']));if(_0x14404b['query'][_0xc14a('0x37')]){_0x2dcfe1[_0xc14a('0x36')]=_['merge'](_0x2dcfe1[_0xc14a('0x36')],{'$or':_[_0xc14a('0x29')](_0x2dcfe1[_0xc14a('0x34')],function(_0x1a807d){var _0x10e268={};_0x10e268[_0x1a807d]={'$like':'%'+_0x14404b[_0xc14a('0x2f')][_0xc14a('0x37')]+'%'};return _0x10e268;})});}_0x2dcfe1=_[_0xc14a('0x38')]({},_0x2dcfe1,_0x14404b['options']);return _0x48bbe8[_0xc14a('0x44')](_0x2dcfe1);}})[_0xc14a('0x22')](function(_0x19966c){if(_0x19966c){_0x36c6c0=_0x19966c['length'];if(!_0x14404b[_0xc14a('0x2f')]['hasOwnProperty'](_0xc14a('0x48'))){_0x2dcfe1[_0xc14a('0x19')]=qs[_0xc14a('0x19')](_0x14404b[_0xc14a('0x2f')][_0xc14a('0x19')]);_0x2dcfe1['offset']=qs[_0xc14a('0x1c')](_0x14404b[_0xc14a('0x2f')][_0xc14a('0x1c')]);}return _0x48bbe8[_0xc14a('0x44')](_0x2dcfe1);}})[_0xc14a('0x22')](function(_0xde1335){if(_0xde1335){return _0xde1335?{'count':_0x36c6c0,'rows':_0xde1335}:null;}})[_0xc14a('0x22')](respondWithResult(_0x317df4,null))[_0xc14a('0x49')](handleError(_0x317df4,null));};exports[_0xc14a('0x4a')]=function(_0x4e1507,_0x5dcae7,_0x4d8c97){if(_0x4e1507[_0xc14a('0x43')]['id']){delete _0x4e1507[_0xc14a('0x43')]['id'];}return db[_0xc14a('0x2a')][_0xc14a('0x4b')]({'where':{'id':_0x4e1507[_0xc14a('0x3e')]['id']}})[_0xc14a('0x22')](handleEntityNotFound(_0x5dcae7,null))[_0xc14a('0x22')](function(_0x43171f){if(_0x43171f){_0x4e1507[_0xc14a('0x43')][_0xc14a('0x4c')]=_0x43171f['id'];_0x4e1507[_0xc14a('0x43')][_0xc14a('0x4d')]=integrations['getSubjects'](_0x4e1507[_0xc14a('0x43')]['channel'],_0x4e1507[_0xc14a('0x43')][_0xc14a('0x2d')]);_0x4e1507[_0xc14a('0x43')][_0xc14a('0x4e')]=integrations[_0xc14a('0x4f')](_0x4e1507[_0xc14a('0x43')]['channel'],_0x4e1507[_0xc14a('0x43')][_0xc14a('0x2d')]);return db[_0xc14a('0x45')][_0xc14a('0x42')](_0x4e1507['body'],{'include':[{'model':db[_0xc14a('0x50')],'as':_0xc14a('0x4d')},{'model':db[_0xc14a('0x50')],'as':_0xc14a('0x4e')}]});}return null;})['then'](respondWithResult(_0x5dcae7,null))[_0xc14a('0x49')](handleError(_0x5dcae7,null));};exports[_0xc14a('0x51')]=function(_0x35c1c6,_0x5c7d3b,_0x266eb0){var _0x16f9fb='';var _0x350dec=['id',_0xc14a('0x26'),_0xc14a('0x52'),_0xc14a('0x53'),_0xc14a('0x54'),_0xc14a('0x55'),_0xc14a('0x56'),_0xc14a('0x57'),_0xc14a('0x58'),_0xc14a('0x59'),_0xc14a('0x5a'),_0xc14a('0x5b')];return db[_0xc14a('0x2a')]['findOne']({'where':{'id':_0x35c1c6[_0xc14a('0x3e')]['id']},'attributes':['id',_0xc14a('0x5c'),_0xc14a('0x5d'),_0xc14a('0x5e')]})[_0xc14a('0x22')](handleEntityNotFound(_0x5c7d3b,null))[_0xc14a('0x22')](function(_0x140de5){if(_0x140de5){_0x16f9fb=_0x140de5[_0xc14a('0x5e')];var _0x537049=_0x16f9fb[_0xc14a('0x5f')](-0x1);if(_0x537049==='/'){_0x16f9fb=_0x16f9fb[_0xc14a('0x60')](0x0,_0x16f9fb[_0xc14a('0x61')](_0x537049));}return rp({'method':'POST','uri':util[_0xc14a('0x62')](_0xc14a('0x63'),_0x16f9fb,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc14a('0x64'),'input_type':_0xc14a('0x65'),'response_type':_0xc14a('0x65'),'rest_data':JSON[_0xc14a('0x66')]({'user_auth':{'user_name':_0x140de5[_0xc14a('0x5c')],'password':_0x140de5[_0xc14a('0x5d')],'encryption':_0xc14a('0x67')},'application':_0xc14a('0x68')})}});}})[_0xc14a('0x22')](function(_0x5986a0){if(_0x5986a0&&_0x5986a0['name']!==_0xc14a('0x69')&&_0x5986a0['name']!==_0xc14a('0x6a')){return rp({'method':_0xc14a('0x6b'),'uri':util[_0xc14a('0x62')](_0xc14a('0x63'),_0x16f9fb,_0xc14a('0x6c')),'json':!![],'form':{'method':_0xc14a('0x6d'),'input_type':_0xc14a('0x65'),'response_type':_0xc14a('0x65'),'rest_data':JSON[_0xc14a('0x66')]({'session':_0x5986a0['id'],'module_name':'Calls'})}})[_0xc14a('0x22')](function(_0x1acc30){if(_0x1acc30){var _0x5e154b=_[_0xc14a('0x6e')](_0x1acc30[_0xc14a('0x6f')]);_[_0xc14a('0x70')](_0x5e154b,function(_0x25f625){return _0x350dec['includes'](_0x25f625[_0xc14a('0x26')]);});return{'count':_0x5e154b[_0xc14a('0x33')],'rows':_[_0xc14a('0x29')](_0x5e154b,function(_0x46b9ea){return{'id':_0x46b9ea[_0xc14a('0x26')],'name':_0x46b9ea[_0xc14a('0x71')],'custom':_['endsWith'](_0x46b9ea['name'],'_c')?!![]:![],'options':_0x46b9ea[_0xc14a('0x40')]?_['map'](_[_0xc14a('0x6e')](_0x46b9ea[_0xc14a('0x40')]),function(_0x304e39){return{'name':_0x304e39['value'],'value':_0x304e39['name']};}):[]};})};}})['then'](respondWithResult(_0x5c7d3b,null))[_0xc14a('0x49')](function(_0x4b88d8){var _0x54cf25=_0x35c1c6[_0xc14a('0x2f')][_0xc14a('0x72')]?0x1f4:_0x4b88d8[_0xc14a('0x73')]||0x1f4;logger[_0xc14a('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xc14a('0x51'),_0x54cf25,JSON[_0xc14a('0x66')](_0x4b88d8));delete _0x4b88d8[_0xc14a('0x26')];if(_0x54cf25===0x191){_0x54cf25=0x190;}_0x5c7d3b[_0xc14a('0x74')](_0x54cf25)[_0xc14a('0x27')](_0x35c1c6[_0xc14a('0x2f')][_0xc14a('0x72')]?{'message':_0xc14a('0x75'),'statusCode':_0x4b88d8[_0xc14a('0x73')]}:_0x4b88d8);});}else{var _0x4492c3=0x1f4;_0x5c7d3b[_0xc14a('0x74')](_0x4492c3)['send']({'message':_0xc14a('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x9034=['lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','offset','count','json','update','then','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','nolimit','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring'];(function(_0x33ed1d,_0x4cc23d){var _0xe103f5=function(_0x5ec520){while(--_0x5ec520){_0x33ed1d['push'](_0x33ed1d['shift']());}};_0xe103f5(++_0x4cc23d);}(_0x9034,0x178));var _0x4903=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9034[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x4903('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4903('0x1'));var jsonpatch=require(_0x4903('0x2'));var rp=require(_0x4903('0x3'));var moment=require(_0x4903('0x4'));var BPromise=require(_0x4903('0x5'));var Mustache=require(_0x4903('0x6'));var util=require(_0x4903('0x7'));var path=require('path');var sox=require(_0x4903('0x8'));var csv=require(_0x4903('0x9'));var ejs=require(_0x4903('0xa'));var fs=require('fs');var fs_extra=require(_0x4903('0xb'));var _=require(_0x4903('0xc'));var squel=require(_0x4903('0xd'));var crypto=require('crypto');var jsforce=require(_0x4903('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4903('0xf'));var Papa=require('papaparse');var Redis=require(_0x4903('0x10'));var authService=require(_0x4903('0x11'));var qs=require(_0x4903('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4903('0x13'));var logger=require(_0x4903('0x14'))(_0x4903('0x15'));var utils=require(_0x4903('0x16'));var config=require(_0x4903('0x17'));var licenseUtil=require(_0x4903('0x18'));var db=require(_0x4903('0x19'))['db'];var integrations=require(_0x4903('0x1a'));function respondWithStatusCode(_0x575ae4,_0x4bdcee){_0x4bdcee=_0x4bdcee||0xcc;return function(_0x4547d0){if(_0x4547d0){return _0x575ae4[_0x4903('0x1b')](_0x4bdcee);}return _0x575ae4[_0x4903('0x1c')](_0x4bdcee)[_0x4903('0x1d')]();};}function respondWithResult(_0x233132,_0x35d992){_0x35d992=_0x35d992||0xc8;return function(_0x5df739){if(_0x5df739){return _0x233132['status'](_0x35d992)['json'](_0x5df739);}};}function respondWithFilteredResult(_0x274aac,_0xad5e76){return function(_0x2c659c){if(_0x2c659c){var _0x8bb29c=typeof _0xad5e76['offset']===_0x4903('0x1e')&&typeof _0xad5e76[_0x4903('0x1f')]==='undefined';var _0x20f2c9=_0x2c659c['count'];var _0x26d48a=_0x8bb29c?0x0:_0xad5e76[_0x4903('0x20')];var _0x2c2029=_0x8bb29c?_0x2c659c[_0x4903('0x21')]:_0xad5e76[_0x4903('0x20')]+_0xad5e76[_0x4903('0x1f')];var _0x5332ee;if(_0x2c2029>=_0x20f2c9){_0x2c2029=_0x20f2c9;_0x5332ee=0xc8;}else{_0x5332ee=0xce;}_0x274aac[_0x4903('0x1c')](_0x5332ee);return _0x274aac['set']('Content-Range',_0x26d48a+'-'+_0x2c2029+'/'+_0x20f2c9)[_0x4903('0x22')](_0x2c659c);}return null;};}function patchUpdates(_0x14e933){return function(_0x1a0e38){try{jsonpatch['apply'](_0x1a0e38,_0x14e933,!![]);}catch(_0x5e2ae3){return BPromise['reject'](_0x5e2ae3);}return _0x1a0e38['save']();};}function saveUpdates(_0x48e8e4,_0x68f9ba){return function(_0x67d7ff){if(_0x67d7ff){return _0x67d7ff[_0x4903('0x23')](_0x48e8e4)[_0x4903('0x24')](function(_0x5735fc){return _0x5735fc;});}return null;};}function removeEntity(_0x2518f9,_0x3b5a56){return function(_0x231e2e){if(_0x231e2e){return _0x231e2e['destroy']()['then'](function(){_0x2518f9[_0x4903('0x1c')](0xcc)[_0x4903('0x1d')]();});}};}function handleEntityNotFound(_0x1ff1fe,_0x4f9e42){return function(_0x2a7717){if(!_0x2a7717){_0x1ff1fe[_0x4903('0x1b')](0x194);}return _0x2a7717;};}function handleError(_0x311f13,_0x2a96e6){_0x2a96e6=_0x2a96e6||0x1f4;return function(_0x156b1d){logger[_0x4903('0x25')](_0x156b1d[_0x4903('0x26')]);if(_0x156b1d[_0x4903('0x27')]){delete _0x156b1d[_0x4903('0x27')];}_0x311f13['status'](_0x2a96e6)[_0x4903('0x28')](_0x156b1d);};}exports[_0x4903('0x29')]=function(_0x25ef2d,_0xaa9b0b){var _0xe03052={},_0x36b340={},_0x20a90e={'count':0x0,'rows':[]};var _0x58a2dc=_[_0x4903('0x2a')](db[_0x4903('0x2b')][_0x4903('0x2c')],function(_0x2afa58){return{'name':_0x2afa58[_0x4903('0x2d')],'type':_0x2afa58[_0x4903('0x2e')][_0x4903('0x2f')]};});_0x36b340['model']=_['map'](_0x58a2dc,'name');_0x36b340[_0x4903('0x30')]=_[_0x4903('0x31')](_0x25ef2d[_0x4903('0x30')]);_0x36b340[_0x4903('0x32')]=_[_0x4903('0x33')](_0x36b340[_0x4903('0x34')],_0x36b340[_0x4903('0x30')]);_0xe03052['attributes']=_[_0x4903('0x33')](_0x36b340[_0x4903('0x34')],qs[_0x4903('0x35')](_0x25ef2d['query'][_0x4903('0x35')]));_0xe03052['attributes']=_0xe03052['attributes']['length']?_0xe03052[_0x4903('0x36')]:_0x36b340['model'];if(!_0x25ef2d[_0x4903('0x30')]['hasOwnProperty']('nolimit')){_0xe03052['limit']=qs['limit'](_0x25ef2d[_0x4903('0x30')][_0x4903('0x1f')]);_0xe03052['offset']=qs[_0x4903('0x20')](_0x25ef2d[_0x4903('0x30')][_0x4903('0x20')]);}_0xe03052[_0x4903('0x37')]=qs[_0x4903('0x38')](_0x25ef2d[_0x4903('0x30')][_0x4903('0x38')]);_0xe03052[_0x4903('0x39')]=qs[_0x4903('0x32')](_[_0x4903('0x3a')](_0x25ef2d[_0x4903('0x30')],_0x36b340[_0x4903('0x32')]),_0x58a2dc);if(_0x25ef2d['query']['filter']){_0xe03052[_0x4903('0x39')]=_[_0x4903('0x3b')](_0xe03052[_0x4903('0x39')],{'$or':_['map'](_0x58a2dc,function(_0x57d09f){if(_0x57d09f[_0x4903('0x2e')]!=='VIRTUAL'){var _0x2508d1={};_0x2508d1[_0x57d09f[_0x4903('0x27')]]={'$like':'%'+_0x25ef2d[_0x4903('0x30')][_0x4903('0x3c')]+'%'};return _0x2508d1;}})});}_0xe03052=_[_0x4903('0x3b')]({},_0xe03052,_0x25ef2d[_0x4903('0x3d')]);var _0x548bd8={'where':_0xe03052[_0x4903('0x39')]};return db['SugarcrmAccount']['count'](_0x548bd8)['then'](function(_0x33dba2){_0x20a90e[_0x4903('0x21')]=_0x33dba2;if(_0x25ef2d[_0x4903('0x30')][_0x4903('0x3e')]){_0xe03052[_0x4903('0x3f')]=[{'all':!![]}];}return db[_0x4903('0x2b')][_0x4903('0x40')](_0xe03052);})[_0x4903('0x24')](function(_0x336f1b){_0x20a90e[_0x4903('0x41')]=_0x336f1b;return _0x20a90e;})[_0x4903('0x24')](respondWithFilteredResult(_0xaa9b0b,_0xe03052))[_0x4903('0x42')](handleError(_0xaa9b0b,null));};exports[_0x4903('0x43')]=function(_0x13f692,_0x55b796){var _0x4bb418={'raw':![],'where':{'id':_0x13f692[_0x4903('0x44')]['id']}},_0x189f9b={};_0x189f9b[_0x4903('0x34')]=_[_0x4903('0x31')](db[_0x4903('0x2b')][_0x4903('0x2c')]);_0x189f9b[_0x4903('0x30')]=_['keys'](_0x13f692['query']);_0x189f9b[_0x4903('0x32')]=_[_0x4903('0x33')](_0x189f9b[_0x4903('0x34')],_0x189f9b[_0x4903('0x30')]);_0x4bb418[_0x4903('0x36')]=_[_0x4903('0x33')](_0x189f9b['model'],qs[_0x4903('0x35')](_0x13f692[_0x4903('0x30')][_0x4903('0x35')]));_0x4bb418[_0x4903('0x36')]=_0x4bb418[_0x4903('0x36')][_0x4903('0x45')]?_0x4bb418[_0x4903('0x36')]:_0x189f9b['model'];if(_0x13f692[_0x4903('0x30')][_0x4903('0x3e')]){_0x4bb418['include']=[{'all':!![]}];}_0x4bb418=_['merge']({},_0x4bb418,_0x13f692['options']);return db['SugarcrmAccount']['find'](_0x4bb418)['then'](handleEntityNotFound(_0x55b796,null))['then'](respondWithResult(_0x55b796,null))['catch'](handleError(_0x55b796,null));};exports[_0x4903('0x46')]=function(_0x48921e,_0x52519f){return db[_0x4903('0x2b')]['create'](_0x48921e['body'],{})[_0x4903('0x24')](respondWithResult(_0x52519f,0xc9))[_0x4903('0x42')](handleError(_0x52519f,null));};exports[_0x4903('0x23')]=function(_0x24ed59,_0x3fdaa0){if(_0x24ed59[_0x4903('0x47')]['id']){delete _0x24ed59[_0x4903('0x47')]['id'];}return db[_0x4903('0x2b')][_0x4903('0x48')]({'where':{'id':_0x24ed59[_0x4903('0x44')]['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x3fdaa0,null))[_0x4903('0x24')](saveUpdates(_0x24ed59[_0x4903('0x47')],null))[_0x4903('0x24')](respondWithResult(_0x3fdaa0,null))[_0x4903('0x42')](handleError(_0x3fdaa0,null));};exports['destroy']=function(_0x2679cb,_0x4f307a){return db[_0x4903('0x2b')][_0x4903('0x48')]({'where':{'id':_0x2679cb[_0x4903('0x44')]['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x4f307a,null))[_0x4903('0x24')](removeEntity(_0x4f307a,null))['catch'](handleError(_0x4f307a,null));};exports[_0x4903('0x49')]=function(_0x1d0046,_0x2bf0f0,_0x3e51bc){var _0x2a0ed0={};var _0x5342e0={};var _0x177523;var _0xb46c45;return db[_0x4903('0x2b')][_0x4903('0x4a')]({'where':{'id':_0x1d0046['params']['id']}})[_0x4903('0x24')](handleEntityNotFound(_0x2bf0f0,null))['then'](function(_0x507552){if(_0x507552){_0x177523=_0x507552;_0x5342e0[_0x4903('0x34')]=_[_0x4903('0x31')](db[_0x4903('0x4b')]['rawAttributes']);_0x5342e0['query']=_[_0x4903('0x31')](_0x1d0046[_0x4903('0x30')]);_0x5342e0[_0x4903('0x32')]=_[_0x4903('0x33')](_0x5342e0['model'],_0x5342e0[_0x4903('0x30')]);_0x2a0ed0[_0x4903('0x36')]=_[_0x4903('0x33')](_0x5342e0[_0x4903('0x34')],qs[_0x4903('0x35')](_0x1d0046[_0x4903('0x30')][_0x4903('0x35')]));_0x2a0ed0['attributes']=_0x2a0ed0[_0x4903('0x36')]['length']?_0x2a0ed0[_0x4903('0x36')]:_0x5342e0[_0x4903('0x34')];_0x2a0ed0[_0x4903('0x37')]=qs[_0x4903('0x38')](_0x1d0046[_0x4903('0x30')]['sort']);_0x2a0ed0[_0x4903('0x39')]=qs[_0x4903('0x32')](_[_0x4903('0x3a')](_0x1d0046[_0x4903('0x30')],_0x5342e0[_0x4903('0x32')]));if(_0x1d0046[_0x4903('0x30')][_0x4903('0x3c')]){_0x2a0ed0[_0x4903('0x39')]=_[_0x4903('0x3b')](_0x2a0ed0['where'],{'$or':_[_0x4903('0x2a')](_0x2a0ed0[_0x4903('0x36')],function(_0x29ee32){var _0x3736e7={};_0x3736e7[_0x29ee32]={'$like':'%'+_0x1d0046[_0x4903('0x30')][_0x4903('0x3c')]+'%'};return _0x3736e7;})});}_0x2a0ed0=_[_0x4903('0x3b')]({},_0x2a0ed0,_0x1d0046[_0x4903('0x3d')]);return _0x177523[_0x4903('0x49')](_0x2a0ed0);}})[_0x4903('0x24')](function(_0x24f067){if(_0x24f067){_0xb46c45=_0x24f067[_0x4903('0x45')];if(!_0x1d0046['query'][_0x4903('0x4c')](_0x4903('0x4d'))){_0x2a0ed0[_0x4903('0x1f')]=qs[_0x4903('0x1f')](_0x1d0046[_0x4903('0x30')][_0x4903('0x1f')]);_0x2a0ed0[_0x4903('0x20')]=qs[_0x4903('0x20')](_0x1d0046[_0x4903('0x30')][_0x4903('0x20')]);}return _0x177523[_0x4903('0x49')](_0x2a0ed0);}})[_0x4903('0x24')](function(_0x29dc85){if(_0x29dc85){return _0x29dc85?{'count':_0xb46c45,'rows':_0x29dc85}:null;}})['then'](respondWithResult(_0x2bf0f0,null))[_0x4903('0x42')](handleError(_0x2bf0f0,null));};exports['addConfiguration']=function(_0x395ff0,_0x12b0af,_0x30bda6){if(_0x395ff0[_0x4903('0x47')]['id']){delete _0x395ff0[_0x4903('0x47')]['id'];}return db['SugarcrmAccount'][_0x4903('0x4a')]({'where':{'id':_0x395ff0[_0x4903('0x44')]['id']}})['then'](handleEntityNotFound(_0x12b0af,null))['then'](function(_0x3a660e){if(_0x3a660e){_0x395ff0[_0x4903('0x47')]['AccountId']=_0x3a660e['id'];_0x395ff0[_0x4903('0x47')][_0x4903('0x4e')]=integrations[_0x4903('0x4f')](_0x395ff0[_0x4903('0x47')][_0x4903('0x50')],_0x395ff0[_0x4903('0x47')][_0x4903('0x2e')]);_0x395ff0[_0x4903('0x47')][_0x4903('0x51')]=integrations['getDescriptions'](_0x395ff0[_0x4903('0x47')][_0x4903('0x50')],_0x395ff0[_0x4903('0x47')][_0x4903('0x2e')]);return db[_0x4903('0x4b')][_0x4903('0x46')](_0x395ff0[_0x4903('0x47')],{'include':[{'model':db['SugarcrmField'],'as':_0x4903('0x4e')},{'model':db[_0x4903('0x52')],'as':'Descriptions'}]});}return null;})[_0x4903('0x24')](respondWithResult(_0x12b0af,null))[_0x4903('0x42')](handleError(_0x12b0af,null));};exports[_0x4903('0x53')]=function(_0x39cfad,_0x5c3e5b,_0x451448){var _0x3ef71c='';var _0x32bfa4=['id',_0x4903('0x27'),_0x4903('0x54'),_0x4903('0x55'),_0x4903('0x56'),_0x4903('0x57'),'duration_hours','duration_minutes',_0x4903('0x58'),_0x4903('0x59'),_0x4903('0x5a'),_0x4903('0x5b')];return db[_0x4903('0x2b')]['findOne']({'where':{'id':_0x39cfad[_0x4903('0x44')]['id']},'attributes':['id',_0x4903('0x5c'),_0x4903('0x5d'),_0x4903('0x5e')]})[_0x4903('0x24')](handleEntityNotFound(_0x5c3e5b,null))[_0x4903('0x24')](function(_0xd358f2){if(_0xd358f2){_0x3ef71c=_0xd358f2[_0x4903('0x5e')];var _0x247690=_0x3ef71c['slice'](-0x1);if(_0x247690==='/'){_0x3ef71c=_0x3ef71c[_0x4903('0x5f')](0x0,_0x3ef71c[_0x4903('0x60')](_0x247690));}return rp({'method':_0x4903('0x61'),'uri':util[_0x4903('0x62')](_0x4903('0x63'),_0x3ef71c,_0x4903('0x64')),'json':!![],'form':{'method':_0x4903('0x65'),'input_type':'JSON','response_type':_0x4903('0x66'),'rest_data':JSON[_0x4903('0x67')]({'user_auth':{'user_name':_0xd358f2[_0x4903('0x5c')],'password':_0xd358f2[_0x4903('0x5d')],'encryption':_0x4903('0x68')},'application':_0x4903('0x69')})}});}})[_0x4903('0x24')](function(_0x5b187e){if(_0x5b187e&&_0x5b187e[_0x4903('0x27')]!==_0x4903('0x6a')&&_0x5b187e['name']!=='Password\x20Expired'){return rp({'method':_0x4903('0x61'),'uri':util[_0x4903('0x62')](_0x4903('0x63'),_0x3ef71c,_0x4903('0x64')),'json':!![],'form':{'method':_0x4903('0x6b'),'input_type':'JSON','response_type':_0x4903('0x66'),'rest_data':JSON[_0x4903('0x67')]({'session':_0x5b187e['id'],'module_name':_0x4903('0x6c')})}})[_0x4903('0x24')](function(_0x1afe05){if(_0x1afe05){var _0x271cb3=_[_0x4903('0x6d')](_0x1afe05[_0x4903('0x6e')]);_['remove'](_0x271cb3,function(_0x50af35){return _0x32bfa4[_0x4903('0x6f')](_0x50af35[_0x4903('0x27')]);});return{'count':_0x271cb3['length'],'rows':_[_0x4903('0x2a')](_0x271cb3,function(_0x35e7a2){return{'id':_0x35e7a2[_0x4903('0x27')],'name':_0x35e7a2[_0x4903('0x70')],'custom':_[_0x4903('0x71')](_0x35e7a2[_0x4903('0x27')],'_c')?!![]:![],'options':_0x35e7a2[_0x4903('0x3d')]?_[_0x4903('0x2a')](_[_0x4903('0x6d')](_0x35e7a2['options']),function(_0x3d2f9b){return{'name':_0x3d2f9b[_0x4903('0x72')],'value':_0x3d2f9b['name']};}):[]};})};}})[_0x4903('0x24')](respondWithResult(_0x5c3e5b,null))[_0x4903('0x42')](function(_0x2c2deb){var _0x4d0733=_0x39cfad[_0x4903('0x30')][_0x4903('0x73')]?0x1f4:_0x2c2deb[_0x4903('0x74')]||0x1f4;logger[_0x4903('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x4903('0x53'),_0x4d0733,JSON[_0x4903('0x67')](_0x2c2deb));delete _0x2c2deb['name'];if(_0x4d0733===0x191){_0x4d0733=0x190;}_0x5c3e5b[_0x4903('0x1c')](_0x4d0733)['send'](_0x39cfad[_0x4903('0x30')][_0x4903('0x73')]?{'message':_0x4903('0x75'),'statusCode':_0x2c2deb[_0x4903('0x74')]}:_0x2c2deb);});}else{var _0x448d7a=0x1f4;_0x5c3e5b['status'](_0x448d7a)[_0x4903('0x28')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index f84ae7e..833e946 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 _0x7899=['request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','int_sugarcrm_accounts','util','api','moment','bluebird'];(function(_0x58f36a,_0x38de87){var _0x2f43d6=function(_0x517831){while(--_0x517831){_0x58f36a['push'](_0x58f36a['shift']());}};_0x2f43d6(++_0x38de87);}(_0x7899,0x167));var _0x9789=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x7899[_0x210d7f];return _0x42d687;};'use strict';var _=require('lodash');var util=require(_0x9789('0x0'));var logger=require('../../config/logger')(_0x9789('0x1'));var moment=require(_0x9789('0x2'));var BPromise=require(_0x9789('0x3'));var rp=require(_0x9789('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9789('0x5'));var config=require(_0x9789('0x6'));var attributes=require(_0x9789('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x509c4c,_0x427c33){return _0x509c4c[_0x9789('0x8')](_0x9789('0x9'),attributes,{'tableName':_0x9789('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c5b=['rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','path'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0x2c5b,0x193));var _0xb2c5=function(_0x496a28,_0x4b3bb7){_0x496a28=_0x496a28-0x0;var _0x334cad=_0x2c5b[_0x496a28];return _0x334cad;};'use strict';var _=require(_0xb2c5('0x0'));var util=require('util');var logger=require(_0xb2c5('0x1'))(_0xb2c5('0x2'));var moment=require(_0xb2c5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2c5('0x4'));var rimraf=require(_0xb2c5('0x5'));var config=require(_0xb2c5('0x6'));var attributes=require(_0xb2c5('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb2c5('0x8')]=function(_0xc08d26,_0x449204){return _0xc08d26[_0xb2c5('0x9')](_0xb2c5('0xa'),attributes,{'tableName':_0xb2c5('0xb'),'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 b8f057d..c0cebdb 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 _0x5dba=['result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','model','map','find','then','ShowSugarcrmAccount','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x258588,_0x241b90){var _0x57ef9d=function(_0x2d4f5d){while(--_0x2d4f5d){_0x258588['push'](_0x258588['shift']());}};_0x57ef9d(++_0x241b90);}(_0x5dba,0x177));var _0xa5db=function(_0xb5fb77,_0x2ec122){_0xb5fb77=_0xb5fb77-0x0;var _0x3f4101=_0x5dba[_0xb5fb77];return _0x3f4101;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa5db('0x0'));var BPromise=require(_0xa5db('0x1'));var rs=require(_0xa5db('0x2'));var fs=require('fs');var Redis=require(_0xa5db('0x3'));var db=require(_0xa5db('0x4'))['db'];var utils=require(_0xa5db('0x5'));var logger=require(_0xa5db('0x6'))(_0xa5db('0x7'));var config=require(_0xa5db('0x8'));var jayson=require(_0xa5db('0x9'));var client=jayson[_0xa5db('0xa')][_0xa5db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x670e64,_0xebc031,_0xf59cb8){return new BPromise(function(_0xaff2b4,_0x3b62ba){return client[_0xa5db('0xc')](_0x670e64,_0xf59cb8)['then'](function(_0x1f984a){logger[_0xa5db('0xd')](_0xa5db('0xe'),_0xebc031,'request\x20sent');logger[_0xa5db('0xf')](_0xa5db('0x10'),_0xebc031,'request\x20sent',JSON[_0xa5db('0x11')](_0x1f984a));if(_0x1f984a[_0xa5db('0x12')]){if(_0x1f984a[_0xa5db('0x12')]['code']===0x1f4){logger['error'](_0xa5db('0xe'),_0xebc031,_0x1f984a[_0xa5db('0x12')][_0xa5db('0x13')]);return _0x3b62ba(_0x1f984a[_0xa5db('0x12')][_0xa5db('0x13')]);}logger[_0xa5db('0x12')](_0xa5db('0xe'),_0xebc031,_0x1f984a[_0xa5db('0x12')][_0xa5db('0x13')]);return _0xaff2b4(_0x1f984a[_0xa5db('0x12')][_0xa5db('0x13')]);}else{logger[_0xa5db('0xd')](_0xa5db('0xe'),_0xebc031,_0xa5db('0x14'));_0xaff2b4(_0x1f984a[_0xa5db('0x15')][_0xa5db('0x13')]);}})[_0xa5db('0x16')](function(_0x339977){logger[_0xa5db('0x12')](_0xa5db('0xe'),_0xebc031,_0x339977);_0x3b62ba(_0x339977);});});}exports[_0xa5db('0x17')]=function(_0x57384b){var _0x58152b=this;return new Promise(function(_0x313882,_0xb236d8){return db[_0xa5db('0x18')][_0xa5db('0x19')]({'raw':_0x57384b[_0xa5db('0x1a')]?_0x57384b[_0xa5db('0x1a')][_0xa5db('0x1b')]===undefined?!![]:![]:!![],'where':_0x57384b['options']?_0x57384b[_0xa5db('0x1a')][_0xa5db('0x1c')]||null:null,'attributes':_0x57384b[_0xa5db('0x1a')]?_0x57384b[_0xa5db('0x1a')][_0xa5db('0x1d')]||null:null,'limit':_0x57384b[_0xa5db('0x1a')]?_0x57384b['options']['limit']||null:null,'include':_0x57384b[_0xa5db('0x1a')]?_0x57384b[_0xa5db('0x1a')][_0xa5db('0x1e')]?_['map'](_0x57384b[_0xa5db('0x1a')][_0xa5db('0x1e')],function(_0xb9c678){return{'model':db[_0xb9c678[_0xa5db('0x1f')]],'as':_0xb9c678['as'],'attributes':_0xb9c678[_0xa5db('0x1d')],'include':_0xb9c678['include']?_[_0xa5db('0x20')](_0xb9c678[_0xa5db('0x1e')],function(_0x1d19e5){return{'model':db[_0x1d19e5[_0xa5db('0x1f')]],'as':_0x1d19e5['as'],'attributes':_0x1d19e5[_0xa5db('0x1d')],'include':_0x1d19e5[_0xa5db('0x1e')]?_[_0xa5db('0x20')](_0x1d19e5[_0xa5db('0x1e')],function(_0x161b09){return{'model':db[_0x161b09[_0xa5db('0x1f')]],'as':_0x161b09['as'],'attributes':_0x161b09[_0xa5db('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55b8f6){logger[_0xa5db('0xd')]('GetSugarcrmAccount',_0x57384b);logger['debug'](_0xa5db('0x17'),_0x57384b,JSON[_0xa5db('0x11')](_0x55b8f6));_0x313882(_0x55b8f6);})[_0xa5db('0x16')](function(_0x863375){logger[_0xa5db('0x12')](_0xa5db('0x17'),_0x863375[_0xa5db('0x13')],_0x57384b);_0xb236d8(_0x58152b['error'](0x1f4,_0x863375['message']));});});};exports['ShowSugarcrmAccount']=function(_0x477cbf){var _0x2955a6=this;return new Promise(function(_0x4b3311,_0x37ee8b){return db[_0xa5db('0x18')][_0xa5db('0x21')]({'raw':_0x477cbf['options']?_0x477cbf[_0xa5db('0x1a')][_0xa5db('0x1b')]===undefined?!![]:![]:!![],'where':_0x477cbf['options']?_0x477cbf['options'][_0xa5db('0x1c')]||null:null,'attributes':_0x477cbf[_0xa5db('0x1a')]?_0x477cbf[_0xa5db('0x1a')]['attributes']||null:null,'include':_0x477cbf[_0xa5db('0x1a')]?_0x477cbf['options'][_0xa5db('0x1e')]?_['map'](_0x477cbf[_0xa5db('0x1a')][_0xa5db('0x1e')],function(_0x178e50){return{'model':db[_0x178e50[_0xa5db('0x1f')]],'as':_0x178e50['as'],'attributes':_0x178e50[_0xa5db('0x1d')],'include':_0x178e50['include']?_['map'](_0x178e50['include'],function(_0x1828cf){return{'model':db[_0x1828cf['model']],'as':_0x1828cf['as'],'attributes':_0x1828cf[_0xa5db('0x1d')],'include':_0x1828cf[_0xa5db('0x1e')]?_[_0xa5db('0x20')](_0x1828cf['include'],function(_0x45ea57){return{'model':db[_0x45ea57['model']],'as':_0x45ea57['as'],'attributes':_0x45ea57['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5db('0x22')](function(_0x2ef86c){logger[_0xa5db('0xd')]('ShowSugarcrmAccount',_0x477cbf);logger[_0xa5db('0xf')](_0xa5db('0x23'),_0x477cbf,JSON[_0xa5db('0x11')](_0x2ef86c));_0x4b3311(_0x2ef86c);})[_0xa5db('0x16')](function(_0x7a4c17){logger[_0xa5db('0x12')](_0xa5db('0x23'),_0x7a4c17['message'],_0x477cbf);_0x37ee8b(_0x2955a6[_0xa5db('0x12')](0x1f4,_0x7a4c17[_0xa5db('0x13')]));});});}; \ No newline at end of file +var _0x80cf=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','SugarcrmAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','GetSugarcrmAccount','ShowSugarcrmAccount','util','moment','ioredis'];(function(_0x45b479,_0x3e6574){var _0x1c3cbe=function(_0xd53e52){while(--_0xd53e52){_0x45b479['push'](_0x45b479['shift']());}};_0x1c3cbe(++_0x3e6574);}(_0x80cf,0x15d));var _0xf80c=function(_0x1ec8e2,_0x43a12b){_0x1ec8e2=_0x1ec8e2-0x0;var _0x407621=_0x80cf[_0x1ec8e2];return _0x407621;};'use strict';var _=require('lodash');var util=require(_0xf80c('0x0'));var moment=require(_0xf80c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf80c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf80c('0x3'));var logger=require(_0xf80c('0x4'))('rpc');var config=require(_0xf80c('0x5'));var jayson=require(_0xf80c('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x10bf50,_0x119be0,_0x7e5a3b){return new BPromise(function(_0x374bdd,_0x223b09){return client[_0xf80c('0x7')](_0x10bf50,_0x7e5a3b)[_0xf80c('0x8')](function(_0xa6929e){logger[_0xf80c('0x9')](_0xf80c('0xa'),_0x119be0,'request\x20sent');logger['debug'](_0xf80c('0xb'),_0x119be0,'request\x20sent',JSON[_0xf80c('0xc')](_0xa6929e));if(_0xa6929e['error']){if(_0xa6929e[_0xf80c('0xd')][_0xf80c('0xe')]===0x1f4){logger['error'](_0xf80c('0xa'),_0x119be0,_0xa6929e['error'][_0xf80c('0xf')]);return _0x223b09(_0xa6929e[_0xf80c('0xd')][_0xf80c('0xf')]);}logger['error'](_0xf80c('0xa'),_0x119be0,_0xa6929e[_0xf80c('0xd')]['message']);return _0x374bdd(_0xa6929e[_0xf80c('0xd')][_0xf80c('0xf')]);}else{logger['info'](_0xf80c('0xa'),_0x119be0,_0xf80c('0x10'));_0x374bdd(_0xa6929e[_0xf80c('0x11')][_0xf80c('0xf')]);}})[_0xf80c('0x12')](function(_0x3efe0a){logger[_0xf80c('0xd')](_0xf80c('0xa'),_0x119be0,_0x3efe0a);_0x223b09(_0x3efe0a);});});}exports['GetSugarcrmAccount']=function(_0x4edd22){var _0x20cb45=this;return new Promise(function(_0x1851e5,_0x2fb023){return db[_0xf80c('0x13')][_0xf80c('0x14')]({'raw':_0x4edd22[_0xf80c('0x15')]?_0x4edd22[_0xf80c('0x15')][_0xf80c('0x16')]===undefined?!![]:![]:!![],'where':_0x4edd22[_0xf80c('0x15')]?_0x4edd22[_0xf80c('0x15')][_0xf80c('0x17')]||null:null,'attributes':_0x4edd22[_0xf80c('0x15')]?_0x4edd22['options'][_0xf80c('0x18')]||null:null,'limit':_0x4edd22['options']?_0x4edd22[_0xf80c('0x15')][_0xf80c('0x19')]||null:null,'include':_0x4edd22['options']?_0x4edd22[_0xf80c('0x15')]['include']?_[_0xf80c('0x1a')](_0x4edd22[_0xf80c('0x15')][_0xf80c('0x1b')],function(_0xed9ce6){return{'model':db[_0xed9ce6[_0xf80c('0x1c')]],'as':_0xed9ce6['as'],'attributes':_0xed9ce6[_0xf80c('0x18')],'include':_0xed9ce6['include']?_['map'](_0xed9ce6[_0xf80c('0x1b')],function(_0x126ad4){return{'model':db[_0x126ad4[_0xf80c('0x1c')]],'as':_0x126ad4['as'],'attributes':_0x126ad4[_0xf80c('0x18')],'include':_0x126ad4[_0xf80c('0x1b')]?_['map'](_0x126ad4[_0xf80c('0x1b')],function(_0x4c7e3d){return{'model':db[_0x4c7e3d['model']],'as':_0x4c7e3d['as'],'attributes':_0x4c7e3d[_0xf80c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf80c('0x8')](function(_0x3121e5){logger[_0xf80c('0x9')]('GetSugarcrmAccount',_0x4edd22);logger[_0xf80c('0x1d')](_0xf80c('0x1e'),_0x4edd22,JSON[_0xf80c('0xc')](_0x3121e5));_0x1851e5(_0x3121e5);})[_0xf80c('0x12')](function(_0xf9785e){logger[_0xf80c('0xd')](_0xf80c('0x1e'),_0xf9785e[_0xf80c('0xf')],_0x4edd22);_0x2fb023(_0x20cb45[_0xf80c('0xd')](0x1f4,_0xf9785e[_0xf80c('0xf')]));});});};exports[_0xf80c('0x1f')]=function(_0x34f6dd){var _0xa8fa3f=this;return new Promise(function(_0x157f05,_0x12008c){return db[_0xf80c('0x13')]['find']({'raw':_0x34f6dd[_0xf80c('0x15')]?_0x34f6dd[_0xf80c('0x15')][_0xf80c('0x16')]===undefined?!![]:![]:!![],'where':_0x34f6dd[_0xf80c('0x15')]?_0x34f6dd[_0xf80c('0x15')][_0xf80c('0x17')]||null:null,'attributes':_0x34f6dd['options']?_0x34f6dd[_0xf80c('0x15')][_0xf80c('0x18')]||null:null,'include':_0x34f6dd['options']?_0x34f6dd['options'][_0xf80c('0x1b')]?_['map'](_0x34f6dd['options'][_0xf80c('0x1b')],function(_0x41a285){return{'model':db[_0x41a285[_0xf80c('0x1c')]],'as':_0x41a285['as'],'attributes':_0x41a285[_0xf80c('0x18')],'include':_0x41a285[_0xf80c('0x1b')]?_[_0xf80c('0x1a')](_0x41a285[_0xf80c('0x1b')],function(_0x4574f7){return{'model':db[_0x4574f7[_0xf80c('0x1c')]],'as':_0x4574f7['as'],'attributes':_0x4574f7[_0xf80c('0x18')],'include':_0x4574f7[_0xf80c('0x1b')]?_[_0xf80c('0x1a')](_0x4574f7[_0xf80c('0x1b')],function(_0x1c66cf){return{'model':db[_0x1c66cf[_0xf80c('0x1c')]],'as':_0x1c66cf['as'],'attributes':_0x1c66cf[_0xf80c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf80c('0x8')](function(_0xbfb66e){logger['info'](_0xf80c('0x1f'),_0x34f6dd);logger[_0xf80c('0x1d')](_0xf80c('0x1f'),_0x34f6dd,JSON['stringify'](_0xbfb66e));_0x157f05(_0xbfb66e);})[_0xf80c('0x12')](function(_0x495325){logger['error'](_0xf80c('0x1f'),_0x495325[_0xf80c('0xf')],_0x34f6dd);_0x12008c(_0xa8fa3f['error'](0x1f4,_0x495325['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 320b5ed..5044f67 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 _0x89d3=['isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id'];(function(_0x3dc795,_0x30ffda){var _0x524d37=function(_0x1ca2ce){while(--_0x1ca2ce){_0x3dc795['push'](_0x3dc795['shift']());}};_0x524d37(++_0x30ffda);}(_0x89d3,0x14f));var _0x389d=function(_0x332109,_0x474add){_0x332109=_0x332109-0x0;var _0x7a6ab2=_0x89d3[_0x332109];return _0x7a6ab2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x389d('0x0'));var timeout=require(_0x389d('0x1'));var express=require('express');var router=express[_0x389d('0x2')]();var fs_extra=require(_0x389d('0x3'));var auth=require(_0x389d('0x4'));var interaction=require(_0x389d('0x5'));var config=require(_0x389d('0x6'));var controller=require(_0x389d('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x389d('0x8')](_0x389d('0x9'),auth[_0x389d('0xa')](),controller['show']);router[_0x389d('0x8')](_0x389d('0xb'),auth['isAuthenticated'](),controller[_0x389d('0xc')]);router['get'](_0x389d('0xd'),auth[_0x389d('0xa')](),controller['getSubjects']);router[_0x389d('0x8')](_0x389d('0xe'),auth['isAuthenticated'](),controller[_0x389d('0xf')]);router[_0x389d('0x10')]('/',auth[_0x389d('0xa')](),controller[_0x389d('0x11')]);router[_0x389d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x389d('0x13')]);router[_0x389d('0x14')](_0x389d('0x9'),auth['isAuthenticated'](),controller[_0x389d('0x15')]);module[_0x389d('0x16')]=router; \ No newline at end of file +var _0x726f=['./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xff2cf,_0xa7d6c6){var _0x4a237b=function(_0x49b52c){while(--_0x49b52c){_0xff2cf['push'](_0xff2cf['shift']());}};_0x4a237b(++_0xa7d6c6);}(_0x726f,0x83));var _0xf726=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x726f[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var path=require(_0xf726('0x2'));var timeout=require('connect-timeout');var express=require(_0xf726('0x3'));var router=express[_0xf726('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf726('0x5'));var interaction=require(_0xf726('0x6'));var config=require('../../config/environment');var controller=require(_0xf726('0x7'));router[_0xf726('0x8')]('/',auth[_0xf726('0x9')](),controller[_0xf726('0xa')]);router[_0xf726('0x8')](_0xf726('0xb'),auth[_0xf726('0x9')](),controller[_0xf726('0xc')]);router['get'](_0xf726('0xd'),auth['isAuthenticated'](),controller[_0xf726('0xe')]);router[_0xf726('0x8')](_0xf726('0xf'),auth[_0xf726('0x9')](),controller[_0xf726('0x10')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf726('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf726('0x12')]);router[_0xf726('0x13')](_0xf726('0xb'),auth[_0xf726('0x9')](),controller['update']);router[_0xf726('0x14')](_0xf726('0xb'),auth[_0xf726('0x9')](),controller[_0xf726('0x15')]);module[_0xf726('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 36d7b08..51677f3 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 _0xc4c4=['sequelize','exports','STRING'];(function(_0x5bc18d,_0x4a1372){var _0x32a08e=function(_0x22d348){while(--_0x22d348){_0x5bc18d['push'](_0x5bc18d['shift']());}};_0x32a08e(++_0x4a1372);}(_0xc4c4,0x159));var _0x4c4c=function(_0x314079,_0x2b98a0){_0x314079=_0x314079-0x0;var _0x423351=_0xc4c4[_0x314079];return _0x423351;};'use strict';var Sequelize=require(_0x4c4c('0x0'));module[_0x4c4c('0x1')]={'name':{'type':Sequelize[_0x4c4c('0x2')]},'description':{'type':Sequelize[_0x4c4c('0x2')]}}; \ No newline at end of file +var _0xc54a=['sequelize','STRING'];(function(_0x501024,_0x1df381){var _0xbd0d55=function(_0x564a5e){while(--_0x564a5e){_0x501024['push'](_0x501024['shift']());}};_0xbd0d55(++_0x1df381);}(_0xc54a,0x180));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac54('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac54('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 93176fb..d609bf1 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 _0x445d=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','name','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','VIRTUAL','merge','options','SugarcrmConfiguration','include','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','SugarcrmField','order','hasOwnProperty','pick','getSubjects','getDescriptions','eml-format','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x445d,0x136));var _0xd445=function(_0x214692,_0x47e3c4){_0x214692=_0x214692-0x0;var _0x186b94=_0x445d[_0x214692];return _0x186b94;};'use strict';var emlformat=require(_0xd445('0x0'));var rimraf=require(_0xd445('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd445('0x2'));var rp=require(_0xd445('0x3'));var moment=require('moment');var BPromise=require(_0xd445('0x4'));var Mustache=require(_0xd445('0x5'));var util=require(_0xd445('0x6'));var path=require(_0xd445('0x7'));var sox=require(_0xd445('0x8'));var csv=require(_0xd445('0x9'));var ejs=require(_0xd445('0xa'));var fs=require('fs');var fs_extra=require(_0xd445('0xb'));var _=require(_0xd445('0xc'));var squel=require('squel');var crypto=require(_0xd445('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd445('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd445('0xf'));var Papa=require(_0xd445('0x10'));var Redis=require(_0xd445('0x11'));var authService=require(_0xd445('0x12'));var qs=require(_0xd445('0x13'));var as=require(_0xd445('0x14'));var hardwareService=require(_0xd445('0x15'));var logger=require(_0xd445('0x16'))(_0xd445('0x17'));var utils=require(_0xd445('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd445('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29871c,_0x59fe20){_0x59fe20=_0x59fe20||0xcc;return function(_0x5a9bd0){if(_0x5a9bd0){return _0x29871c[_0xd445('0x1a')](_0x59fe20);}return _0x29871c['status'](_0x59fe20)[_0xd445('0x1b')]();};}function respondWithResult(_0x5e8786,_0x9b00d6){_0x9b00d6=_0x9b00d6||0xc8;return function(_0x29384e){if(_0x29384e){return _0x5e8786['status'](_0x9b00d6)[_0xd445('0x1c')](_0x29384e);}};}function respondWithFilteredResult(_0x5d81d9,_0x38d28d){return function(_0x3a3c57){if(_0x3a3c57){var _0x31ced9=typeof _0x38d28d[_0xd445('0x1d')]===_0xd445('0x1e')&&typeof _0x38d28d[_0xd445('0x1f')]==='undefined';var _0x35253c=_0x3a3c57[_0xd445('0x20')];var _0x55fa7=_0x31ced9?0x0:_0x38d28d['offset'];var _0x1e99d3=_0x31ced9?_0x3a3c57['count']:_0x38d28d[_0xd445('0x1d')]+_0x38d28d[_0xd445('0x1f')];var _0x422799;if(_0x1e99d3>=_0x35253c){_0x1e99d3=_0x35253c;_0x422799=0xc8;}else{_0x422799=0xce;}_0x5d81d9[_0xd445('0x21')](_0x422799);return _0x5d81d9[_0xd445('0x22')](_0xd445('0x23'),_0x55fa7+'-'+_0x1e99d3+'/'+_0x35253c)['json'](_0x3a3c57);}return null;};}function patchUpdates(_0x22e7a7){return function(_0x22417a){try{jsonpatch[_0xd445('0x24')](_0x22417a,_0x22e7a7,!![]);}catch(_0x2aeea8){return BPromise['reject'](_0x2aeea8);}return _0x22417a[_0xd445('0x25')]();};}function saveUpdates(_0x10c44b,_0x11ccdd){return function(_0xb31dc9){if(_0xb31dc9){return _0xb31dc9['update'](_0x10c44b)[_0xd445('0x26')](function(_0x49ba32){return _0x49ba32;});}return null;};}function removeEntity(_0x4ede2b,_0x371fe5){return function(_0x5bc803){if(_0x5bc803){return _0x5bc803['destroy']()[_0xd445('0x26')](function(){_0x4ede2b[_0xd445('0x21')](0xcc)[_0xd445('0x1b')]();});}};}function handleEntityNotFound(_0x5dfdf4,_0x1b02d0){return function(_0x323a4a){if(!_0x323a4a){_0x5dfdf4['sendStatus'](0x194);}return _0x323a4a;};}function handleError(_0x1b5feb,_0x1035db){_0x1035db=_0x1035db||0x1f4;return function(_0xa02060){logger['error'](_0xa02060['stack']);if(_0xa02060[_0xd445('0x27')]){delete _0xa02060[_0xd445('0x27')];}_0x1b5feb['status'](_0x1035db)['send'](_0xa02060);};}exports[_0xd445('0x28')]=function(_0x58df93,_0x2bb39b){var _0x52d3c2={},_0x4bd58a={},_0x3121fc={'count':0x0,'rows':[]};var _0x106f1d=_['map'](db['SugarcrmConfiguration'][_0xd445('0x29')],function(_0x534c73){return{'name':_0x534c73['fieldName'],'type':_0x534c73[_0xd445('0x2a')][_0xd445('0x2b')]};});_0x4bd58a[_0xd445('0x2c')]=_[_0xd445('0x2d')](_0x106f1d,_0xd445('0x27'));_0x4bd58a['query']=_[_0xd445('0x2e')](_0x58df93[_0xd445('0x2f')]);_0x4bd58a[_0xd445('0x30')]=_[_0xd445('0x31')](_0x4bd58a[_0xd445('0x2c')],_0x4bd58a[_0xd445('0x2f')]);_0x52d3c2[_0xd445('0x32')]=_['intersection'](_0x4bd58a[_0xd445('0x2c')],qs[_0xd445('0x33')](_0x58df93[_0xd445('0x2f')][_0xd445('0x33')]));_0x52d3c2[_0xd445('0x32')]=_0x52d3c2[_0xd445('0x32')][_0xd445('0x34')]?_0x52d3c2[_0xd445('0x32')]:_0x4bd58a['model'];if(!_0x58df93[_0xd445('0x2f')]['hasOwnProperty'](_0xd445('0x35'))){_0x52d3c2['limit']=qs[_0xd445('0x1f')](_0x58df93[_0xd445('0x2f')][_0xd445('0x1f')]);_0x52d3c2[_0xd445('0x1d')]=qs[_0xd445('0x1d')](_0x58df93[_0xd445('0x2f')][_0xd445('0x1d')]);}_0x52d3c2['order']=qs[_0xd445('0x36')](_0x58df93[_0xd445('0x2f')]['sort']);_0x52d3c2[_0xd445('0x37')]=qs[_0xd445('0x30')](_['pick'](_0x58df93[_0xd445('0x2f')],_0x4bd58a['filters']),_0x106f1d);if(_0x58df93[_0xd445('0x2f')][_0xd445('0x38')]){_0x52d3c2[_0xd445('0x37')]=_['merge'](_0x52d3c2['where'],{'$or':_['map'](_0x106f1d,function(_0x32581d){if(_0x32581d[_0xd445('0x2a')]!==_0xd445('0x39')){var _0x40d845={};_0x40d845[_0x32581d[_0xd445('0x27')]]={'$like':'%'+_0x58df93[_0xd445('0x2f')]['filter']+'%'};return _0x40d845;}})});}_0x52d3c2=_[_0xd445('0x3a')]({},_0x52d3c2,_0x58df93[_0xd445('0x3b')]);var _0x46c46d={'where':_0x52d3c2[_0xd445('0x37')]};return db[_0xd445('0x3c')][_0xd445('0x20')](_0x46c46d)[_0xd445('0x26')](function(_0x3f6bf2){_0x3121fc[_0xd445('0x20')]=_0x3f6bf2;if(_0x58df93[_0xd445('0x2f')]['includeAll']){_0x52d3c2[_0xd445('0x3d')]=[{'all':!![]}];}return db[_0xd445('0x3c')]['findAll'](_0x52d3c2);})[_0xd445('0x26')](function(_0x5d201d){_0x3121fc[_0xd445('0x3e')]=_0x5d201d;return _0x3121fc;})[_0xd445('0x26')](respondWithFilteredResult(_0x2bb39b,_0x52d3c2))[_0xd445('0x3f')](handleError(_0x2bb39b,null));};exports[_0xd445('0x40')]=function(_0x55bcda,_0x3484fa){var _0x3b5ea7={'raw':![],'where':{'id':_0x55bcda[_0xd445('0x41')]['id']}},_0x279eca={};_0x279eca['model']=_[_0xd445('0x2e')](db[_0xd445('0x3c')][_0xd445('0x29')]);_0x279eca[_0xd445('0x2f')]=_[_0xd445('0x2e')](_0x55bcda[_0xd445('0x2f')]);_0x279eca['filters']=_[_0xd445('0x31')](_0x279eca[_0xd445('0x2c')],_0x279eca[_0xd445('0x2f')]);_0x3b5ea7[_0xd445('0x32')]=_[_0xd445('0x31')](_0x279eca[_0xd445('0x2c')],qs[_0xd445('0x33')](_0x55bcda[_0xd445('0x2f')][_0xd445('0x33')]));_0x3b5ea7[_0xd445('0x32')]=_0x3b5ea7[_0xd445('0x32')][_0xd445('0x34')]?_0x3b5ea7['attributes']:_0x279eca['model'];if(_0x55bcda['query'][_0xd445('0x42')]){_0x3b5ea7[_0xd445('0x3d')]=[{'all':!![]}];}_0x3b5ea7=_[_0xd445('0x3a')]({},_0x3b5ea7,_0x55bcda[_0xd445('0x3b')]);return db['SugarcrmConfiguration'][_0xd445('0x43')](_0x3b5ea7)['then'](handleEntityNotFound(_0x3484fa,null))[_0xd445('0x26')](respondWithResult(_0x3484fa,null))[_0xd445('0x3f')](handleError(_0x3484fa,null));};exports[_0xd445('0x44')]=function(_0x4a93f9,_0x5e8178){return db[_0xd445('0x3c')][_0xd445('0x44')](_0x4a93f9['body'],{})[_0xd445('0x26')](respondWithResult(_0x5e8178,0xc9))[_0xd445('0x3f')](handleError(_0x5e8178,null));};exports['update']=function(_0xad4f71,_0x56b823){if(_0xad4f71['body']['id']){delete _0xad4f71[_0xd445('0x45')]['id'];}return db[_0xd445('0x3c')][_0xd445('0x43')]({'where':{'id':_0xad4f71['params']['id']}})[_0xd445('0x26')](handleEntityNotFound(_0x56b823,null))['then'](saveUpdates(_0xad4f71['body'],null))[_0xd445('0x26')](respondWithResult(_0x56b823,null))[_0xd445('0x3f')](handleError(_0x56b823,null));};exports['destroy']=function(_0xabb6c1,_0x445ecf){return db[_0xd445('0x3c')][_0xd445('0x43')]({'where':{'id':_0xabb6c1[_0xd445('0x41')]['id']}})[_0xd445('0x26')](handleEntityNotFound(_0x445ecf,null))[_0xd445('0x26')](removeEntity(_0x445ecf,null))[_0xd445('0x3f')](handleError(_0x445ecf,null));};exports[_0xd445('0x46')]=function(_0x48a7a3,_0x44c165,_0x48213e){var _0x9c746f={};var _0x27f0e8={};var _0x45ffda;var _0x180215;return db[_0xd445('0x3c')][_0xd445('0x47')]({'where':{'id':_0x48a7a3[_0xd445('0x41')]['id']}})[_0xd445('0x26')](handleEntityNotFound(_0x44c165,null))[_0xd445('0x26')](function(_0xff1365){if(_0xff1365){_0x45ffda=_0xff1365;_0x27f0e8[_0xd445('0x2c')]=_[_0xd445('0x2e')](db[_0xd445('0x48')][_0xd445('0x29')]);_0x27f0e8[_0xd445('0x2f')]=_[_0xd445('0x2e')](_0x48a7a3[_0xd445('0x2f')]);_0x27f0e8[_0xd445('0x30')]=_[_0xd445('0x31')](_0x27f0e8[_0xd445('0x2c')],_0x27f0e8[_0xd445('0x2f')]);_0x9c746f['attributes']=_['intersection'](_0x27f0e8[_0xd445('0x2c')],qs['fields'](_0x48a7a3['query']['fields']));_0x9c746f['attributes']=_0x9c746f[_0xd445('0x32')][_0xd445('0x34')]?_0x9c746f[_0xd445('0x32')]:_0x27f0e8[_0xd445('0x2c')];_0x9c746f[_0xd445('0x49')]=qs[_0xd445('0x36')](_0x48a7a3[_0xd445('0x2f')][_0xd445('0x36')]);_0x9c746f[_0xd445('0x37')]=qs[_0xd445('0x30')](_['pick'](_0x48a7a3[_0xd445('0x2f')],_0x27f0e8['filters']));if(_0x48a7a3[_0xd445('0x2f')][_0xd445('0x38')]){_0x9c746f['where']=_['merge'](_0x9c746f['where'],{'$or':_[_0xd445('0x2d')](_0x9c746f['attributes'],function(_0x51f89c){var _0x129bee={};_0x129bee[_0x51f89c]={'$like':'%'+_0x48a7a3[_0xd445('0x2f')]['filter']+'%'};return _0x129bee;})});}_0x9c746f=_[_0xd445('0x3a')]({},_0x9c746f,_0x48a7a3['options']);return _0x45ffda[_0xd445('0x46')](_0x9c746f);}})[_0xd445('0x26')](function(_0x45e0ff){if(_0x45e0ff){_0x180215=_0x45e0ff['length'];if(!_0x48a7a3[_0xd445('0x2f')][_0xd445('0x4a')](_0xd445('0x35'))){_0x9c746f[_0xd445('0x1f')]=qs[_0xd445('0x1f')](_0x48a7a3['query'][_0xd445('0x1f')]);_0x9c746f['offset']=qs[_0xd445('0x1d')](_0x48a7a3[_0xd445('0x2f')][_0xd445('0x1d')]);}return _0x45ffda[_0xd445('0x46')](_0x9c746f);}})[_0xd445('0x26')](function(_0x3abb92){if(_0x3abb92){return _0x3abb92?{'count':_0x180215,'rows':_0x3abb92}:null;}})[_0xd445('0x26')](respondWithResult(_0x44c165,null))['catch'](handleError(_0x44c165,null));};exports['getSubjects']=function(_0x4fd5a8,_0x54a953,_0x2e3a01){var _0x18c715={};var _0x5c0cec={};var _0x1097a5;var _0x4ac970;return db[_0xd445('0x3c')]['findOne']({'where':{'id':_0x4fd5a8[_0xd445('0x41')]['id']}})[_0xd445('0x26')](handleEntityNotFound(_0x54a953,null))[_0xd445('0x26')](function(_0x551d69){if(_0x551d69){_0x1097a5=_0x551d69;_0x5c0cec[_0xd445('0x2c')]=_[_0xd445('0x2e')](db[_0xd445('0x48')][_0xd445('0x29')]);_0x5c0cec['query']=_[_0xd445('0x2e')](_0x4fd5a8['query']);_0x5c0cec[_0xd445('0x30')]=_['intersection'](_0x5c0cec[_0xd445('0x2c')],_0x5c0cec['query']);_0x18c715['attributes']=_['intersection'](_0x5c0cec[_0xd445('0x2c')],qs[_0xd445('0x33')](_0x4fd5a8[_0xd445('0x2f')]['fields']));_0x18c715[_0xd445('0x32')]=_0x18c715[_0xd445('0x32')]['length']?_0x18c715[_0xd445('0x32')]:_0x5c0cec['model'];_0x18c715[_0xd445('0x49')]=qs[_0xd445('0x36')](_0x4fd5a8['query']['sort']);_0x18c715[_0xd445('0x37')]=qs[_0xd445('0x30')](_[_0xd445('0x4b')](_0x4fd5a8[_0xd445('0x2f')],_0x5c0cec[_0xd445('0x30')]));if(_0x4fd5a8[_0xd445('0x2f')][_0xd445('0x38')]){_0x18c715[_0xd445('0x37')]=_[_0xd445('0x3a')](_0x18c715[_0xd445('0x37')],{'$or':_[_0xd445('0x2d')](_0x18c715[_0xd445('0x32')],function(_0x2e68a3){var _0x363b7e={};_0x363b7e[_0x2e68a3]={'$like':'%'+_0x4fd5a8[_0xd445('0x2f')][_0xd445('0x38')]+'%'};return _0x363b7e;})});}_0x18c715=_[_0xd445('0x3a')]({},_0x18c715,_0x4fd5a8[_0xd445('0x3b')]);return _0x1097a5[_0xd445('0x4c')](_0x18c715);}})['then'](function(_0x20d9f6){if(_0x20d9f6){_0x4ac970=_0x20d9f6[_0xd445('0x34')];if(!_0x4fd5a8[_0xd445('0x2f')][_0xd445('0x4a')](_0xd445('0x35'))){_0x18c715[_0xd445('0x1f')]=qs[_0xd445('0x1f')](_0x4fd5a8[_0xd445('0x2f')][_0xd445('0x1f')]);_0x18c715[_0xd445('0x1d')]=qs[_0xd445('0x1d')](_0x4fd5a8[_0xd445('0x2f')]['offset']);}return _0x1097a5[_0xd445('0x4c')](_0x18c715);}})[_0xd445('0x26')](function(_0x476cf1){if(_0x476cf1){return _0x476cf1?{'count':_0x4ac970,'rows':_0x476cf1}:null;}})[_0xd445('0x26')](respondWithResult(_0x54a953,null))['catch'](handleError(_0x54a953,null));};exports[_0xd445('0x4d')]=function(_0x16f797,_0x5d2db9,_0x5e65ff){var _0x2319db={};var _0x50cb86={};var _0x13f337;var _0x24ed8f;return db[_0xd445('0x3c')][_0xd445('0x47')]({'where':{'id':_0x16f797[_0xd445('0x41')]['id']}})[_0xd445('0x26')](handleEntityNotFound(_0x5d2db9,null))[_0xd445('0x26')](function(_0x5c5382){if(_0x5c5382){_0x13f337=_0x5c5382;_0x50cb86[_0xd445('0x2c')]=_[_0xd445('0x2e')](db[_0xd445('0x48')][_0xd445('0x29')]);_0x50cb86['query']=_['keys'](_0x16f797[_0xd445('0x2f')]);_0x50cb86[_0xd445('0x30')]=_[_0xd445('0x31')](_0x50cb86[_0xd445('0x2c')],_0x50cb86[_0xd445('0x2f')]);_0x2319db[_0xd445('0x32')]=_[_0xd445('0x31')](_0x50cb86[_0xd445('0x2c')],qs[_0xd445('0x33')](_0x16f797[_0xd445('0x2f')][_0xd445('0x33')]));_0x2319db[_0xd445('0x32')]=_0x2319db[_0xd445('0x32')][_0xd445('0x34')]?_0x2319db[_0xd445('0x32')]:_0x50cb86[_0xd445('0x2c')];_0x2319db['order']=qs[_0xd445('0x36')](_0x16f797[_0xd445('0x2f')][_0xd445('0x36')]);_0x2319db[_0xd445('0x37')]=qs[_0xd445('0x30')](_[_0xd445('0x4b')](_0x16f797[_0xd445('0x2f')],_0x50cb86[_0xd445('0x30')]));if(_0x16f797[_0xd445('0x2f')][_0xd445('0x38')]){_0x2319db[_0xd445('0x37')]=_[_0xd445('0x3a')](_0x2319db[_0xd445('0x37')],{'$or':_[_0xd445('0x2d')](_0x2319db[_0xd445('0x32')],function(_0x2c20f7){var _0x1bcd43={};_0x1bcd43[_0x2c20f7]={'$like':'%'+_0x16f797[_0xd445('0x2f')]['filter']+'%'};return _0x1bcd43;})});}_0x2319db=_[_0xd445('0x3a')]({},_0x2319db,_0x16f797[_0xd445('0x3b')]);return _0x13f337['getDescriptions'](_0x2319db);}})[_0xd445('0x26')](function(_0xef4c44){if(_0xef4c44){_0x24ed8f=_0xef4c44['length'];if(!_0x16f797[_0xd445('0x2f')]['hasOwnProperty'](_0xd445('0x35'))){_0x2319db['limit']=qs['limit'](_0x16f797['query']['limit']);_0x2319db[_0xd445('0x1d')]=qs[_0xd445('0x1d')](_0x16f797[_0xd445('0x2f')]['offset']);}return _0x13f337[_0xd445('0x4d')](_0x2319db);}})['then'](function(_0x54b2a6){if(_0x54b2a6){return _0x54b2a6?{'count':_0x24ed8f,'rows':_0x54b2a6}:null;}})['then'](respondWithResult(_0x5d2db9,null))['catch'](handleError(_0x5d2db9,null));}; \ No newline at end of file +var _0x7ffb=['map','SugarcrmConfiguration','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','update','body','params','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7ffb,0x1cb));var _0xb7ff=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x7ffb[_0x210718];return _0x541bfc;};'use strict';var emlformat=require(_0xb7ff('0x0'));var rimraf=require(_0xb7ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7ff('0x2'));var rp=require(_0xb7ff('0x3'));var moment=require(_0xb7ff('0x4'));var BPromise=require(_0xb7ff('0x5'));var Mustache=require(_0xb7ff('0x6'));var util=require(_0xb7ff('0x7'));var path=require(_0xb7ff('0x8'));var sox=require('sox');var csv=require(_0xb7ff('0x9'));var ejs=require(_0xb7ff('0xa'));var fs=require('fs');var fs_extra=require(_0xb7ff('0xb'));var _=require(_0xb7ff('0xc'));var squel=require('squel');var crypto=require(_0xb7ff('0xd'));var jsforce=require(_0xb7ff('0xe'));var deskjs=require(_0xb7ff('0xf'));var toCsv=require(_0xb7ff('0x9'));var querystring=require(_0xb7ff('0x10'));var Papa=require('papaparse');var Redis=require(_0xb7ff('0x11'));var authService=require(_0xb7ff('0x12'));var qs=require(_0xb7ff('0x13'));var as=require(_0xb7ff('0x14'));var hardwareService=require(_0xb7ff('0x15'));var logger=require(_0xb7ff('0x16'))(_0xb7ff('0x17'));var utils=require(_0xb7ff('0x18'));var config=require(_0xb7ff('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb7ff('0x1a'))['db'];function respondWithStatusCode(_0x453796,_0x23e4ba){_0x23e4ba=_0x23e4ba||0xcc;return function(_0x1ffdd6){if(_0x1ffdd6){return _0x453796['sendStatus'](_0x23e4ba);}return _0x453796['status'](_0x23e4ba)['end']();};}function respondWithResult(_0x56ee13,_0xbe9c1a){_0xbe9c1a=_0xbe9c1a||0xc8;return function(_0x46efdd){if(_0x46efdd){return _0x56ee13['status'](_0xbe9c1a)[_0xb7ff('0x1b')](_0x46efdd);}};}function respondWithFilteredResult(_0x4c4008,_0x3cbaf2){return function(_0x47e142){if(_0x47e142){var _0x3c0aa2=typeof _0x3cbaf2[_0xb7ff('0x1c')]===_0xb7ff('0x1d')&&typeof _0x3cbaf2[_0xb7ff('0x1e')]===_0xb7ff('0x1d');var _0x4717f0=_0x47e142[_0xb7ff('0x1f')];var _0x251082=_0x3c0aa2?0x0:_0x3cbaf2[_0xb7ff('0x1c')];var _0x7572be=_0x3c0aa2?_0x47e142['count']:_0x3cbaf2[_0xb7ff('0x1c')]+_0x3cbaf2[_0xb7ff('0x1e')];var _0x3307e8;if(_0x7572be>=_0x4717f0){_0x7572be=_0x4717f0;_0x3307e8=0xc8;}else{_0x3307e8=0xce;}_0x4c4008[_0xb7ff('0x20')](_0x3307e8);return _0x4c4008[_0xb7ff('0x21')]('Content-Range',_0x251082+'-'+_0x7572be+'/'+_0x4717f0)[_0xb7ff('0x1b')](_0x47e142);}return null;};}function patchUpdates(_0xef5045){return function(_0x560c9b){try{jsonpatch[_0xb7ff('0x22')](_0x560c9b,_0xef5045,!![]);}catch(_0x5f427c){return BPromise[_0xb7ff('0x23')](_0x5f427c);}return _0x560c9b[_0xb7ff('0x24')]();};}function saveUpdates(_0x5cac7e,_0x42b30c){return function(_0xd37f3b){if(_0xd37f3b){return _0xd37f3b['update'](_0x5cac7e)['then'](function(_0x3141a0){return _0x3141a0;});}return null;};}function removeEntity(_0x2a35a5,_0x3fafc3){return function(_0x288373){if(_0x288373){return _0x288373[_0xb7ff('0x25')]()[_0xb7ff('0x26')](function(){_0x2a35a5[_0xb7ff('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe20b,_0x2c1a84){return function(_0x1c6c99){if(!_0x1c6c99){_0x4fe20b[_0xb7ff('0x27')](0x194);}return _0x1c6c99;};}function handleError(_0x5c7b6a,_0x6d84a7){_0x6d84a7=_0x6d84a7||0x1f4;return function(_0x1197a8){logger[_0xb7ff('0x28')](_0x1197a8[_0xb7ff('0x29')]);if(_0x1197a8[_0xb7ff('0x2a')]){delete _0x1197a8[_0xb7ff('0x2a')];}_0x5c7b6a[_0xb7ff('0x20')](_0x6d84a7)[_0xb7ff('0x2b')](_0x1197a8);};}exports[_0xb7ff('0x2c')]=function(_0x37bef1,_0x3b6d76){var _0x36d3ec={},_0x1b7148={},_0x409304={'count':0x0,'rows':[]};var _0x3297d5=_[_0xb7ff('0x2d')](db[_0xb7ff('0x2e')]['rawAttributes'],function(_0x2d61e5){return{'name':_0x2d61e5['fieldName'],'type':_0x2d61e5['type'][_0xb7ff('0x2f')]};});_0x1b7148['model']=_[_0xb7ff('0x2d')](_0x3297d5,'name');_0x1b7148[_0xb7ff('0x30')]=_[_0xb7ff('0x31')](_0x37bef1[_0xb7ff('0x30')]);_0x1b7148[_0xb7ff('0x32')]=_[_0xb7ff('0x33')](_0x1b7148[_0xb7ff('0x34')],_0x1b7148[_0xb7ff('0x30')]);_0x36d3ec[_0xb7ff('0x35')]=_[_0xb7ff('0x33')](_0x1b7148[_0xb7ff('0x34')],qs[_0xb7ff('0x36')](_0x37bef1[_0xb7ff('0x30')]['fields']));_0x36d3ec[_0xb7ff('0x35')]=_0x36d3ec[_0xb7ff('0x35')][_0xb7ff('0x37')]?_0x36d3ec[_0xb7ff('0x35')]:_0x1b7148['model'];if(!_0x37bef1[_0xb7ff('0x30')][_0xb7ff('0x38')](_0xb7ff('0x39'))){_0x36d3ec[_0xb7ff('0x1e')]=qs['limit'](_0x37bef1['query']['limit']);_0x36d3ec[_0xb7ff('0x1c')]=qs[_0xb7ff('0x1c')](_0x37bef1[_0xb7ff('0x30')]['offset']);}_0x36d3ec[_0xb7ff('0x3a')]=qs[_0xb7ff('0x3b')](_0x37bef1['query'][_0xb7ff('0x3b')]);_0x36d3ec[_0xb7ff('0x3c')]=qs[_0xb7ff('0x32')](_[_0xb7ff('0x3d')](_0x37bef1['query'],_0x1b7148[_0xb7ff('0x32')]),_0x3297d5);if(_0x37bef1[_0xb7ff('0x30')][_0xb7ff('0x3e')]){_0x36d3ec[_0xb7ff('0x3c')]=_[_0xb7ff('0x3f')](_0x36d3ec[_0xb7ff('0x3c')],{'$or':_[_0xb7ff('0x2d')](_0x3297d5,function(_0x539b12){if(_0x539b12[_0xb7ff('0x40')]!==_0xb7ff('0x41')){var _0xe36e8f={};_0xe36e8f[_0x539b12[_0xb7ff('0x2a')]]={'$like':'%'+_0x37bef1[_0xb7ff('0x30')][_0xb7ff('0x3e')]+'%'};return _0xe36e8f;}})});}_0x36d3ec=_[_0xb7ff('0x3f')]({},_0x36d3ec,_0x37bef1[_0xb7ff('0x42')]);var _0x4e37ad={'where':_0x36d3ec[_0xb7ff('0x3c')]};return db['SugarcrmConfiguration'][_0xb7ff('0x1f')](_0x4e37ad)['then'](function(_0x4686df){_0x409304[_0xb7ff('0x1f')]=_0x4686df;if(_0x37bef1['query'][_0xb7ff('0x43')]){_0x36d3ec[_0xb7ff('0x44')]=[{'all':!![]}];}return db[_0xb7ff('0x2e')][_0xb7ff('0x45')](_0x36d3ec);})[_0xb7ff('0x26')](function(_0x4b1f76){_0x409304[_0xb7ff('0x46')]=_0x4b1f76;return _0x409304;})[_0xb7ff('0x26')](respondWithFilteredResult(_0x3b6d76,_0x36d3ec))[_0xb7ff('0x47')](handleError(_0x3b6d76,null));};exports[_0xb7ff('0x48')]=function(_0x41d715,_0x4c931b){var _0x52ae6f={'raw':![],'where':{'id':_0x41d715['params']['id']}},_0x291f1c={};_0x291f1c[_0xb7ff('0x34')]=_[_0xb7ff('0x31')](db[_0xb7ff('0x2e')][_0xb7ff('0x49')]);_0x291f1c[_0xb7ff('0x30')]=_[_0xb7ff('0x31')](_0x41d715[_0xb7ff('0x30')]);_0x291f1c[_0xb7ff('0x32')]=_['intersection'](_0x291f1c[_0xb7ff('0x34')],_0x291f1c[_0xb7ff('0x30')]);_0x52ae6f[_0xb7ff('0x35')]=_[_0xb7ff('0x33')](_0x291f1c[_0xb7ff('0x34')],qs[_0xb7ff('0x36')](_0x41d715[_0xb7ff('0x30')]['fields']));_0x52ae6f[_0xb7ff('0x35')]=_0x52ae6f[_0xb7ff('0x35')]['length']?_0x52ae6f['attributes']:_0x291f1c[_0xb7ff('0x34')];if(_0x41d715[_0xb7ff('0x30')]['includeAll']){_0x52ae6f[_0xb7ff('0x44')]=[{'all':!![]}];}_0x52ae6f=_[_0xb7ff('0x3f')]({},_0x52ae6f,_0x41d715[_0xb7ff('0x42')]);return db['SugarcrmConfiguration'][_0xb7ff('0x4a')](_0x52ae6f)[_0xb7ff('0x26')](handleEntityNotFound(_0x4c931b,null))[_0xb7ff('0x26')](respondWithResult(_0x4c931b,null))[_0xb7ff('0x47')](handleError(_0x4c931b,null));};exports[_0xb7ff('0x4b')]=function(_0x3429e6,_0x3ed1c0){return db['SugarcrmConfiguration'][_0xb7ff('0x4b')](_0x3429e6['body'],{})[_0xb7ff('0x26')](respondWithResult(_0x3ed1c0,0xc9))[_0xb7ff('0x47')](handleError(_0x3ed1c0,null));};exports[_0xb7ff('0x4c')]=function(_0x9c2f85,_0x1e3942){if(_0x9c2f85['body']['id']){delete _0x9c2f85[_0xb7ff('0x4d')]['id'];}return db[_0xb7ff('0x2e')][_0xb7ff('0x4a')]({'where':{'id':_0x9c2f85[_0xb7ff('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1e3942,null))[_0xb7ff('0x26')](saveUpdates(_0x9c2f85[_0xb7ff('0x4d')],null))[_0xb7ff('0x26')](respondWithResult(_0x1e3942,null))[_0xb7ff('0x47')](handleError(_0x1e3942,null));};exports[_0xb7ff('0x25')]=function(_0x45c928,_0x18052a){return db[_0xb7ff('0x2e')][_0xb7ff('0x4a')]({'where':{'id':_0x45c928['params']['id']}})['then'](handleEntityNotFound(_0x18052a,null))[_0xb7ff('0x26')](removeEntity(_0x18052a,null))[_0xb7ff('0x47')](handleError(_0x18052a,null));};exports[_0xb7ff('0x4f')]=function(_0x3244fa,_0x151bc1,_0x17ce75){var _0x39b963={};var _0x54edf5={};var _0x27b590;var _0x44d524;return db[_0xb7ff('0x2e')]['findOne']({'where':{'id':_0x3244fa[_0xb7ff('0x4e')]['id']}})[_0xb7ff('0x26')](handleEntityNotFound(_0x151bc1,null))[_0xb7ff('0x26')](function(_0x545ee5){if(_0x545ee5){_0x27b590=_0x545ee5;_0x54edf5['model']=_[_0xb7ff('0x31')](db[_0xb7ff('0x50')][_0xb7ff('0x49')]);_0x54edf5[_0xb7ff('0x30')]=_[_0xb7ff('0x31')](_0x3244fa['query']);_0x54edf5[_0xb7ff('0x32')]=_[_0xb7ff('0x33')](_0x54edf5[_0xb7ff('0x34')],_0x54edf5[_0xb7ff('0x30')]);_0x39b963[_0xb7ff('0x35')]=_[_0xb7ff('0x33')](_0x54edf5[_0xb7ff('0x34')],qs['fields'](_0x3244fa[_0xb7ff('0x30')][_0xb7ff('0x36')]));_0x39b963[_0xb7ff('0x35')]=_0x39b963[_0xb7ff('0x35')]['length']?_0x39b963[_0xb7ff('0x35')]:_0x54edf5[_0xb7ff('0x34')];_0x39b963[_0xb7ff('0x3a')]=qs['sort'](_0x3244fa['query']['sort']);_0x39b963[_0xb7ff('0x3c')]=qs[_0xb7ff('0x32')](_[_0xb7ff('0x3d')](_0x3244fa[_0xb7ff('0x30')],_0x54edf5[_0xb7ff('0x32')]));if(_0x3244fa[_0xb7ff('0x30')][_0xb7ff('0x3e')]){_0x39b963[_0xb7ff('0x3c')]=_[_0xb7ff('0x3f')](_0x39b963[_0xb7ff('0x3c')],{'$or':_[_0xb7ff('0x2d')](_0x39b963[_0xb7ff('0x35')],function(_0x60f6a6){var _0x293821={};_0x293821[_0x60f6a6]={'$like':'%'+_0x3244fa['query'][_0xb7ff('0x3e')]+'%'};return _0x293821;})});}_0x39b963=_[_0xb7ff('0x3f')]({},_0x39b963,_0x3244fa['options']);return _0x27b590[_0xb7ff('0x4f')](_0x39b963);}})[_0xb7ff('0x26')](function(_0x248d78){if(_0x248d78){_0x44d524=_0x248d78[_0xb7ff('0x37')];if(!_0x3244fa[_0xb7ff('0x30')][_0xb7ff('0x38')](_0xb7ff('0x39'))){_0x39b963[_0xb7ff('0x1e')]=qs[_0xb7ff('0x1e')](_0x3244fa[_0xb7ff('0x30')][_0xb7ff('0x1e')]);_0x39b963[_0xb7ff('0x1c')]=qs[_0xb7ff('0x1c')](_0x3244fa[_0xb7ff('0x30')][_0xb7ff('0x1c')]);}return _0x27b590[_0xb7ff('0x4f')](_0x39b963);}})['then'](function(_0x406dfc){if(_0x406dfc){return _0x406dfc?{'count':_0x44d524,'rows':_0x406dfc}:null;}})[_0xb7ff('0x26')](respondWithResult(_0x151bc1,null))[_0xb7ff('0x47')](handleError(_0x151bc1,null));};exports[_0xb7ff('0x51')]=function(_0x21216c,_0x748616,_0x2da83b){var _0x6d0db={};var _0x879c33={};var _0x155fa7;var _0x1cdf63;return db['SugarcrmConfiguration'][_0xb7ff('0x52')]({'where':{'id':_0x21216c['params']['id']}})[_0xb7ff('0x26')](handleEntityNotFound(_0x748616,null))[_0xb7ff('0x26')](function(_0x3d8063){if(_0x3d8063){_0x155fa7=_0x3d8063;_0x879c33[_0xb7ff('0x34')]=_['keys'](db[_0xb7ff('0x50')]['rawAttributes']);_0x879c33[_0xb7ff('0x30')]=_[_0xb7ff('0x31')](_0x21216c[_0xb7ff('0x30')]);_0x879c33['filters']=_[_0xb7ff('0x33')](_0x879c33['model'],_0x879c33[_0xb7ff('0x30')]);_0x6d0db[_0xb7ff('0x35')]=_['intersection'](_0x879c33[_0xb7ff('0x34')],qs[_0xb7ff('0x36')](_0x21216c[_0xb7ff('0x30')][_0xb7ff('0x36')]));_0x6d0db[_0xb7ff('0x35')]=_0x6d0db[_0xb7ff('0x35')][_0xb7ff('0x37')]?_0x6d0db['attributes']:_0x879c33[_0xb7ff('0x34')];_0x6d0db[_0xb7ff('0x3a')]=qs[_0xb7ff('0x3b')](_0x21216c[_0xb7ff('0x30')][_0xb7ff('0x3b')]);_0x6d0db[_0xb7ff('0x3c')]=qs[_0xb7ff('0x32')](_[_0xb7ff('0x3d')](_0x21216c[_0xb7ff('0x30')],_0x879c33[_0xb7ff('0x32')]));if(_0x21216c[_0xb7ff('0x30')][_0xb7ff('0x3e')]){_0x6d0db[_0xb7ff('0x3c')]=_[_0xb7ff('0x3f')](_0x6d0db[_0xb7ff('0x3c')],{'$or':_['map'](_0x6d0db[_0xb7ff('0x35')],function(_0x379ff9){var _0x21d854={};_0x21d854[_0x379ff9]={'$like':'%'+_0x21216c['query'][_0xb7ff('0x3e')]+'%'};return _0x21d854;})});}_0x6d0db=_['merge']({},_0x6d0db,_0x21216c['options']);return _0x155fa7[_0xb7ff('0x51')](_0x6d0db);}})[_0xb7ff('0x26')](function(_0x23c3c5){if(_0x23c3c5){_0x1cdf63=_0x23c3c5['length'];if(!_0x21216c[_0xb7ff('0x30')][_0xb7ff('0x38')](_0xb7ff('0x39'))){_0x6d0db[_0xb7ff('0x1e')]=qs['limit'](_0x21216c[_0xb7ff('0x30')]['limit']);_0x6d0db[_0xb7ff('0x1c')]=qs[_0xb7ff('0x1c')](_0x21216c[_0xb7ff('0x30')][_0xb7ff('0x1c')]);}return _0x155fa7[_0xb7ff('0x51')](_0x6d0db);}})[_0xb7ff('0x26')](function(_0x294303){if(_0x294303){return _0x294303?{'count':_0x1cdf63,'rows':_0x294303}:null;}})['then'](respondWithResult(_0x748616,null))['catch'](handleError(_0x748616,null));};exports['getDescriptions']=function(_0x390f59,_0x307198,_0x271cbe){var _0x45cdc7={};var _0x15b6d9={};var _0x29964f;var _0x1a9af3;return db[_0xb7ff('0x2e')]['findOne']({'where':{'id':_0x390f59[_0xb7ff('0x4e')]['id']}})[_0xb7ff('0x26')](handleEntityNotFound(_0x307198,null))[_0xb7ff('0x26')](function(_0x1daf83){if(_0x1daf83){_0x29964f=_0x1daf83;_0x15b6d9['model']=_[_0xb7ff('0x31')](db[_0xb7ff('0x50')][_0xb7ff('0x49')]);_0x15b6d9[_0xb7ff('0x30')]=_[_0xb7ff('0x31')](_0x390f59['query']);_0x15b6d9['filters']=_[_0xb7ff('0x33')](_0x15b6d9[_0xb7ff('0x34')],_0x15b6d9[_0xb7ff('0x30')]);_0x45cdc7[_0xb7ff('0x35')]=_[_0xb7ff('0x33')](_0x15b6d9[_0xb7ff('0x34')],qs['fields'](_0x390f59['query'][_0xb7ff('0x36')]));_0x45cdc7[_0xb7ff('0x35')]=_0x45cdc7['attributes'][_0xb7ff('0x37')]?_0x45cdc7[_0xb7ff('0x35')]:_0x15b6d9[_0xb7ff('0x34')];_0x45cdc7[_0xb7ff('0x3a')]=qs[_0xb7ff('0x3b')](_0x390f59[_0xb7ff('0x30')][_0xb7ff('0x3b')]);_0x45cdc7[_0xb7ff('0x3c')]=qs[_0xb7ff('0x32')](_[_0xb7ff('0x3d')](_0x390f59[_0xb7ff('0x30')],_0x15b6d9[_0xb7ff('0x32')]));if(_0x390f59['query'][_0xb7ff('0x3e')]){_0x45cdc7[_0xb7ff('0x3c')]=_['merge'](_0x45cdc7[_0xb7ff('0x3c')],{'$or':_[_0xb7ff('0x2d')](_0x45cdc7[_0xb7ff('0x35')],function(_0x1ee7b0){var _0x177581={};_0x177581[_0x1ee7b0]={'$like':'%'+_0x390f59['query'][_0xb7ff('0x3e')]+'%'};return _0x177581;})});}_0x45cdc7=_[_0xb7ff('0x3f')]({},_0x45cdc7,_0x390f59['options']);return _0x29964f[_0xb7ff('0x53')](_0x45cdc7);}})[_0xb7ff('0x26')](function(_0x54c08c){if(_0x54c08c){_0x1a9af3=_0x54c08c[_0xb7ff('0x37')];if(!_0x390f59[_0xb7ff('0x30')][_0xb7ff('0x38')](_0xb7ff('0x39'))){_0x45cdc7[_0xb7ff('0x1e')]=qs[_0xb7ff('0x1e')](_0x390f59[_0xb7ff('0x30')][_0xb7ff('0x1e')]);_0x45cdc7['offset']=qs[_0xb7ff('0x1c')](_0x390f59[_0xb7ff('0x30')][_0xb7ff('0x1c')]);}return _0x29964f[_0xb7ff('0x53')](_0x45cdc7);}})[_0xb7ff('0x26')](function(_0x4f9df4){if(_0x4f9df4){return _0x4f9df4?{'count':_0x1a9af3,'rows':_0x4f9df4}:null;}})[_0xb7ff('0x26')](respondWithResult(_0x307198,null))[_0xb7ff('0x47')](handleError(_0x307198,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5beb5b4..6748c05 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 _0x4c7c=['define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x35f2d0,_0x5b3d52){var _0x4f2a54=function(_0x45648f){while(--_0x45648f){_0x35f2d0['push'](_0x35f2d0['shift']());}};_0x4f2a54(++_0x5b3d52);}(_0x4c7c,0x139));var _0xc4c7=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x4c7c[_0x2a0183];return _0x158c3a;};'use strict';var _=require('lodash');var util=require(_0xc4c7('0x0'));var logger=require(_0xc4c7('0x1'))('api');var moment=require(_0xc4c7('0x2'));var BPromise=require(_0xc4c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c7('0x4'));var rimraf=require(_0xc4c7('0x5'));var config=require(_0xc4c7('0x6'));var attributes=require('./intSugarcrmConfiguration.attributes');module['exports']=function(_0x48ee10,_0x35272c){return _0x48ee10[_0xc4c7('0x7')](_0xc4c7('0x8'),attributes,{'tableName':_0xc4c7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3c4=['moment','request-promise','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api'];(function(_0x250416,_0x4255bd){var _0x4d4f14=function(_0x5b4036){while(--_0x5b4036){_0x250416['push'](_0x250416['shift']());}};_0x4d4f14(++_0x4255bd);}(_0xb3c4,0x10b));var _0x4b3c=function(_0x18aee7,_0x3b432f){_0x18aee7=_0x18aee7-0x0;var _0x4cbd28=_0xb3c4[_0x18aee7];return _0x4cbd28;};'use strict';var _=require(_0x4b3c('0x0'));var util=require(_0x4b3c('0x1'));var logger=require('../../config/logger')(_0x4b3c('0x2'));var moment=require(_0x4b3c('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b3c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x4b3c('0x5')]=function(_0x2bee6b,_0x183015){return _0x2bee6b[_0x4b3c('0x6')](_0x4b3c('0x7'),attributes,{'tableName':_0x4b3c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index fa8e06b..102c70c 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 _0xa284=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','util','moment'];(function(_0x10aaff,_0xedfe36){var _0x385857=function(_0x114670){while(--_0x114670){_0x10aaff['push'](_0x10aaff['shift']());}};_0x385857(++_0xedfe36);}(_0xa284,0xf0));var _0x4a28=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa284[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x4a28('0x0'));var moment=require(_0x4a28('0x1'));var BPromise=require(_0x4a28('0x2'));var rs=require(_0x4a28('0x3'));var fs=require('fs');var Redis=require(_0x4a28('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4a28('0x5'))(_0x4a28('0x6'));var config=require(_0x4a28('0x7'));var jayson=require(_0x4a28('0x8'));var client=jayson[_0x4a28('0x9')][_0x4a28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b29b,_0x349af4,_0x589c4b){return new BPromise(function(_0x345b9a,_0x44536b){return client[_0x4a28('0xb')](_0x43b29b,_0x589c4b)[_0x4a28('0xc')](function(_0x54fa2d){logger[_0x4a28('0xd')](_0x4a28('0xe'),_0x349af4,'request\x20sent');logger[_0x4a28('0xf')](_0x4a28('0x10'),_0x349af4,_0x4a28('0x11'),JSON[_0x4a28('0x12')](_0x54fa2d));if(_0x54fa2d['error']){if(_0x54fa2d[_0x4a28('0x13')]['code']===0x1f4){logger[_0x4a28('0x13')](_0x4a28('0xe'),_0x349af4,_0x54fa2d[_0x4a28('0x13')][_0x4a28('0x14')]);return _0x44536b(_0x54fa2d[_0x4a28('0x13')][_0x4a28('0x14')]);}logger[_0x4a28('0x13')](_0x4a28('0xe'),_0x349af4,_0x54fa2d[_0x4a28('0x13')][_0x4a28('0x14')]);return _0x345b9a(_0x54fa2d[_0x4a28('0x13')]['message']);}else{logger['info'](_0x4a28('0xe'),_0x349af4,_0x4a28('0x11'));_0x345b9a(_0x54fa2d['result'][_0x4a28('0x14')]);}})[_0x4a28('0x15')](function(_0x58240d){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x349af4,_0x58240d);_0x44536b(_0x58240d);});});} \ No newline at end of file +var _0xd198=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd198,0x10e));var _0x8d19=function(_0x236e98,_0x3c93cc){_0x236e98=_0x236e98-0x0;var _0x4d0037=_0xd198[_0x236e98];return _0x4d0037;};'use strict';var _=require(_0x8d19('0x0'));var util=require(_0x8d19('0x1'));var moment=require(_0x8d19('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d19('0x3'));var fs=require('fs');var Redis=require(_0x8d19('0x4'));var db=require(_0x8d19('0x5'))['db'];var utils=require(_0x8d19('0x6'));var logger=require(_0x8d19('0x7'))(_0x8d19('0x8'));var config=require(_0x8d19('0x9'));var jayson=require(_0x8d19('0xa'));var client=jayson[_0x8d19('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59c75b,_0x5621ca,_0x19c805){return new BPromise(function(_0x419a49,_0x5373ae){return client[_0x8d19('0xc')](_0x59c75b,_0x19c805)[_0x8d19('0xd')](function(_0x9cd4a7){logger['info'](_0x8d19('0xe'),_0x5621ca,'request\x20sent');logger[_0x8d19('0xf')](_0x8d19('0x10'),_0x5621ca,_0x8d19('0x11'),JSON['stringify'](_0x9cd4a7));if(_0x9cd4a7['error']){if(_0x9cd4a7[_0x8d19('0x12')]['code']===0x1f4){logger[_0x8d19('0x12')](_0x8d19('0xe'),_0x5621ca,_0x9cd4a7[_0x8d19('0x12')][_0x8d19('0x13')]);return _0x5373ae(_0x9cd4a7[_0x8d19('0x12')][_0x8d19('0x13')]);}logger[_0x8d19('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5621ca,_0x9cd4a7[_0x8d19('0x12')]['message']);return _0x419a49(_0x9cd4a7[_0x8d19('0x12')][_0x8d19('0x13')]);}else{logger[_0x8d19('0x14')](_0x8d19('0xe'),_0x5621ca,_0x8d19('0x11'));_0x419a49(_0x9cd4a7[_0x8d19('0x15')][_0x8d19('0x13')]);}})[_0x8d19('0x16')](function(_0x4dbed0){logger[_0x8d19('0x12')](_0x8d19('0xe'),_0x5621ca,_0x4dbed0);_0x5373ae(_0x4dbed0);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f82bc2b..57a4812 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 _0x68f9=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update'];(function(_0xce51e,_0x5d388f){var _0x442be7=function(_0x5aa87f){while(--_0x5aa87f){_0xce51e['push'](_0xce51e['shift']());}};_0x442be7(++_0x5d388f);}(_0x68f9,0x1d1));var _0x968f=function(_0x37a813,_0x13dca6){_0x37a813=_0x37a813-0x0;var _0x28a4fa=_0x68f9[_0x37a813];return _0x28a4fa;};'use strict';var multer=require(_0x968f('0x0'));var util=require(_0x968f('0x1'));var path=require(_0x968f('0x2'));var timeout=require(_0x968f('0x3'));var express=require('express');var router=express[_0x968f('0x4')]();var fs_extra=require(_0x968f('0x5'));var auth=require(_0x968f('0x6'));var interaction=require(_0x968f('0x7'));var config=require(_0x968f('0x8'));var controller=require(_0x968f('0x9'));router[_0x968f('0xa')]('/',auth['isAuthenticated'](),controller[_0x968f('0xb')]);router[_0x968f('0xa')]('/:id',auth[_0x968f('0xc')](),controller[_0x968f('0xd')]);router[_0x968f('0xe')]('/',auth[_0x968f('0xc')](),controller[_0x968f('0xf')]);router[_0x968f('0x10')](_0x968f('0x11'),auth['isAuthenticated'](),controller[_0x968f('0x12')]);router[_0x968f('0x13')]('/:id',auth[_0x968f('0xc')](),controller[_0x968f('0x14')]);module[_0x968f('0x15')]=router; \ No newline at end of file +var _0x1f56=['post','create','update','delete','util','path','connect-timeout','express','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated'];(function(_0x8e1994,_0x10d574){var _0x57385a=function(_0x136234){while(--_0x136234){_0x8e1994['push'](_0x8e1994['shift']());}};_0x57385a(++_0x10d574);}(_0x1f56,0xd6));var _0x61f5=function(_0x530781,_0x1e144f){_0x530781=_0x530781-0x0;var _0x579d06=_0x1f56[_0x530781];return _0x579d06;};'use strict';var multer=require('multer');var util=require(_0x61f5('0x0'));var path=require(_0x61f5('0x1'));var timeout=require(_0x61f5('0x2'));var express=require(_0x61f5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x61f5('0x4'));var controller=require(_0x61f5('0x5'));router[_0x61f5('0x6')]('/',auth['isAuthenticated'](),controller[_0x61f5('0x7')]);router['get'](_0x61f5('0x8'),auth[_0x61f5('0x9')](),controller['show']);router[_0x61f5('0xa')]('/',auth[_0x61f5('0x9')](),controller[_0x61f5('0xb')]);router['put'](_0x61f5('0x8'),auth['isAuthenticated'](),controller[_0x61f5('0xc')]);router[_0x61f5('0xd')](_0x61f5('0x8'),auth[_0x61f5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index fa19e21..0b1dc52 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 _0x7cc0=['string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x5be384,_0x1c9a66){var _0x3792b3=function(_0x46b040){while(--_0x46b040){_0x5be384['push'](_0x5be384['shift']());}};_0x3792b3(++_0x1c9a66);}(_0x7cc0,0x80));var _0x07cc=function(_0xe5e59d,_0x2833ab){_0xe5e59d=_0xe5e59d-0x0;var _0x1654cc=_0x7cc0[_0xe5e59d];return _0x1654cc;};'use strict';var Sequelize=require(_0x07cc('0x0'));module[_0x07cc('0x1')]={'type':{'type':Sequelize['ENUM'](_0x07cc('0x2'),'variable',_0x07cc('0x3'),_0x07cc('0x4'),_0x07cc('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x07cc('0x6')]},'key':{'type':Sequelize[_0x07cc('0x6')]},'keyType':{'type':Sequelize[_0x07cc('0x7')](_0x07cc('0x2'),_0x07cc('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x07cc('0x6')]},'idField':{'type':Sequelize[_0x07cc('0x6')]},'nameField':{'type':Sequelize[_0x07cc('0x6')]},'customField':{'type':Sequelize[_0x07cc('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdee6=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','string','STRING','variable'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xdee6,0xb5));var _0x6dee=function(_0x4e2e3c,_0x39ece3){_0x4e2e3c=_0x4e2e3c-0x0;var _0x5ee23e=_0xdee6[_0x4e2e3c];return _0x5ee23e;};'use strict';var Sequelize=require(_0x6dee('0x0'));module[_0x6dee('0x1')]={'type':{'type':Sequelize[_0x6dee('0x2')]('string','variable',_0x6dee('0x3'),_0x6dee('0x4'),_0x6dee('0x5')),'defaultValue':_0x6dee('0x6')},'content':{'type':Sequelize[_0x6dee('0x7')]},'key':{'type':Sequelize[_0x6dee('0x7')]},'keyType':{'type':Sequelize[_0x6dee('0x2')](_0x6dee('0x6'),_0x6dee('0x8'),_0x6dee('0x3'))},'keyContent':{'type':Sequelize[_0x6dee('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6dee('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6dee('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index f2ed1af..f58bfe8 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 _0x2894=['set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','type','VIRTUAL','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit'];(function(_0x206d44,_0x4f24ed){var _0x42f315=function(_0x3fba62){while(--_0x3fba62){_0x206d44['push'](_0x206d44['shift']());}};_0x42f315(++_0x4f24ed);}(_0x2894,0x1ba));var _0x4289=function(_0x496a45,_0x2de9b2){_0x496a45=_0x496a45-0x0;var _0x5a381f=_0x2894[_0x496a45];return _0x5a381f;};'use strict';var emlformat=require(_0x4289('0x0'));var rimraf=require(_0x4289('0x1'));var zipdir=require(_0x4289('0x2'));var jsonpatch=require(_0x4289('0x3'));var rp=require(_0x4289('0x4'));var moment=require(_0x4289('0x5'));var BPromise=require(_0x4289('0x6'));var Mustache=require(_0x4289('0x7'));var util=require('util');var path=require(_0x4289('0x8'));var sox=require(_0x4289('0x9'));var csv=require(_0x4289('0xa'));var ejs=require(_0x4289('0xb'));var fs=require('fs');var fs_extra=require(_0x4289('0xc'));var _=require('lodash');var squel=require(_0x4289('0xd'));var crypto=require(_0x4289('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4289('0xa'));var querystring=require(_0x4289('0xf'));var Papa=require(_0x4289('0x10'));var Redis=require(_0x4289('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4289('0x12'));var as=require(_0x4289('0x13'));var hardwareService=require(_0x4289('0x14'));var logger=require(_0x4289('0x15'))('api');var utils=require(_0x4289('0x16'));var config=require(_0x4289('0x17'));var licenseUtil=require(_0x4289('0x18'));var db=require(_0x4289('0x19'))['db'];function respondWithStatusCode(_0x27d4be,_0x38e719){_0x38e719=_0x38e719||0xcc;return function(_0x417ec4){if(_0x417ec4){return _0x27d4be['sendStatus'](_0x38e719);}return _0x27d4be[_0x4289('0x1a')](_0x38e719)[_0x4289('0x1b')]();};}function respondWithResult(_0x3f8d9d,_0x1cdb26){_0x1cdb26=_0x1cdb26||0xc8;return function(_0x5964a9){if(_0x5964a9){return _0x3f8d9d['status'](_0x1cdb26)['json'](_0x5964a9);}};}function respondWithFilteredResult(_0x53a98d,_0x7531b6){return function(_0x4591d3){if(_0x4591d3){var _0x224999=typeof _0x7531b6[_0x4289('0x1c')]==='undefined'&&typeof _0x7531b6['limit']===_0x4289('0x1d');var _0x10ee42=_0x4591d3[_0x4289('0x1e')];var _0x576020=_0x224999?0x0:_0x7531b6[_0x4289('0x1c')];var _0x4458dc=_0x224999?_0x4591d3['count']:_0x7531b6[_0x4289('0x1c')]+_0x7531b6[_0x4289('0x1f')];var _0x5a43fd;if(_0x4458dc>=_0x10ee42){_0x4458dc=_0x10ee42;_0x5a43fd=0xc8;}else{_0x5a43fd=0xce;}_0x53a98d[_0x4289('0x1a')](_0x5a43fd);return _0x53a98d[_0x4289('0x20')](_0x4289('0x21'),_0x576020+'-'+_0x4458dc+'/'+_0x10ee42)['json'](_0x4591d3);}return null;};}function patchUpdates(_0x47d2f1){return function(_0x44c005){try{jsonpatch[_0x4289('0x22')](_0x44c005,_0x47d2f1,!![]);}catch(_0x15a6a1){return BPromise[_0x4289('0x23')](_0x15a6a1);}return _0x44c005[_0x4289('0x24')]();};}function saveUpdates(_0x3da11f,_0x5a2f6e){return function(_0x54df75){if(_0x54df75){return _0x54df75[_0x4289('0x25')](_0x3da11f)[_0x4289('0x26')](function(_0x4c3fae){return _0x4c3fae;});}return null;};}function removeEntity(_0x10632e,_0x45fc9c){return function(_0x361893){if(_0x361893){return _0x361893[_0x4289('0x27')]()[_0x4289('0x26')](function(){_0x10632e[_0x4289('0x1a')](0xcc)[_0x4289('0x1b')]();});}};}function handleEntityNotFound(_0x124fe0,_0x21ec93){return function(_0xd895f2){if(!_0xd895f2){_0x124fe0[_0x4289('0x28')](0x194);}return _0xd895f2;};}function handleError(_0x84cc25,_0xf7e7ca){_0xf7e7ca=_0xf7e7ca||0x1f4;return function(_0xbd903c){logger[_0x4289('0x29')](_0xbd903c[_0x4289('0x2a')]);if(_0xbd903c[_0x4289('0x2b')]){delete _0xbd903c[_0x4289('0x2b')];}_0x84cc25['status'](_0xf7e7ca)[_0x4289('0x2c')](_0xbd903c);};}exports[_0x4289('0x2d')]=function(_0x170ab6,_0x3de747){var _0x109472={},_0x5c46f5={},_0x51dd73={'count':0x0,'rows':[]};var _0x6cfe17=_[_0x4289('0x2e')](db['SugarcrmField']['rawAttributes'],function(_0x3e7748){return{'name':_0x3e7748[_0x4289('0x2f')],'type':_0x3e7748['type'][_0x4289('0x30')]};});_0x5c46f5[_0x4289('0x31')]=_[_0x4289('0x2e')](_0x6cfe17,_0x4289('0x2b'));_0x5c46f5['query']=_[_0x4289('0x32')](_0x170ab6[_0x4289('0x33')]);_0x5c46f5[_0x4289('0x34')]=_['intersection'](_0x5c46f5['model'],_0x5c46f5[_0x4289('0x33')]);_0x109472[_0x4289('0x35')]=_[_0x4289('0x36')](_0x5c46f5[_0x4289('0x31')],qs[_0x4289('0x37')](_0x170ab6['query']['fields']));_0x109472[_0x4289('0x35')]=_0x109472[_0x4289('0x35')][_0x4289('0x38')]?_0x109472[_0x4289('0x35')]:_0x5c46f5[_0x4289('0x31')];if(!_0x170ab6['query'][_0x4289('0x39')](_0x4289('0x3a'))){_0x109472[_0x4289('0x1f')]=qs[_0x4289('0x1f')](_0x170ab6[_0x4289('0x33')]['limit']);_0x109472[_0x4289('0x1c')]=qs['offset'](_0x170ab6[_0x4289('0x33')][_0x4289('0x1c')]);}_0x109472[_0x4289('0x3b')]=qs[_0x4289('0x3c')](_0x170ab6[_0x4289('0x33')][_0x4289('0x3c')]);_0x109472['where']=qs[_0x4289('0x34')](_['pick'](_0x170ab6[_0x4289('0x33')],_0x5c46f5[_0x4289('0x34')]),_0x6cfe17);if(_0x170ab6['query'][_0x4289('0x3d')]){_0x109472['where']=_['merge'](_0x109472[_0x4289('0x3e')],{'$or':_['map'](_0x6cfe17,function(_0x36e336){if(_0x36e336[_0x4289('0x3f')]!==_0x4289('0x40')){var _0x36ecd9={};_0x36ecd9[_0x36e336[_0x4289('0x2b')]]={'$like':'%'+_0x170ab6[_0x4289('0x33')]['filter']+'%'};return _0x36ecd9;}})});}_0x109472=_['merge']({},_0x109472,_0x170ab6[_0x4289('0x41')]);var _0x420b67={'where':_0x109472[_0x4289('0x3e')]};return db[_0x4289('0x42')][_0x4289('0x1e')](_0x420b67)[_0x4289('0x26')](function(_0x5eb054){_0x51dd73[_0x4289('0x1e')]=_0x5eb054;if(_0x170ab6[_0x4289('0x33')][_0x4289('0x43')]){_0x109472[_0x4289('0x44')]=[{'all':!![]}];}return db[_0x4289('0x42')][_0x4289('0x45')](_0x109472);})[_0x4289('0x26')](function(_0x5c87a0){_0x51dd73[_0x4289('0x46')]=_0x5c87a0;return _0x51dd73;})[_0x4289('0x26')](respondWithFilteredResult(_0x3de747,_0x109472))[_0x4289('0x47')](handleError(_0x3de747,null));};exports[_0x4289('0x48')]=function(_0x1ef497,_0x1adf2b){var _0x13b4a3={'raw':!![],'where':{'id':_0x1ef497['params']['id']}},_0x384583={};_0x384583['model']=_['keys'](db[_0x4289('0x42')][_0x4289('0x49')]);_0x384583[_0x4289('0x33')]=_[_0x4289('0x32')](_0x1ef497['query']);_0x384583['filters']=_[_0x4289('0x36')](_0x384583['model'],_0x384583['query']);_0x13b4a3['attributes']=_[_0x4289('0x36')](_0x384583['model'],qs[_0x4289('0x37')](_0x1ef497[_0x4289('0x33')][_0x4289('0x37')]));_0x13b4a3[_0x4289('0x35')]=_0x13b4a3[_0x4289('0x35')]['length']?_0x13b4a3[_0x4289('0x35')]:_0x384583[_0x4289('0x31')];if(_0x1ef497[_0x4289('0x33')][_0x4289('0x43')]){_0x13b4a3[_0x4289('0x44')]=[{'all':!![]}];}_0x13b4a3=_[_0x4289('0x4a')]({},_0x13b4a3,_0x1ef497['options']);return db[_0x4289('0x42')][_0x4289('0x4b')](_0x13b4a3)['then'](handleEntityNotFound(_0x1adf2b,null))[_0x4289('0x26')](respondWithResult(_0x1adf2b,null))[_0x4289('0x47')](handleError(_0x1adf2b,null));};exports[_0x4289('0x4c')]=function(_0x27c4ae,_0x353315){return db[_0x4289('0x42')][_0x4289('0x4c')](_0x27c4ae['body'],{})[_0x4289('0x26')](respondWithResult(_0x353315,0xc9))[_0x4289('0x47')](handleError(_0x353315,null));};exports['update']=function(_0x78eed2,_0x2fc284){if(_0x78eed2[_0x4289('0x4d')]['id']){delete _0x78eed2['body']['id'];}return db[_0x4289('0x42')][_0x4289('0x4b')]({'where':{'id':_0x78eed2[_0x4289('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2fc284,null))['then'](saveUpdates(_0x78eed2[_0x4289('0x4d')],null))[_0x4289('0x26')](respondWithResult(_0x2fc284,null))[_0x4289('0x47')](handleError(_0x2fc284,null));};exports['destroy']=function(_0x53ae7f,_0x35f0d4){return db['SugarcrmField'][_0x4289('0x4b')]({'where':{'id':_0x53ae7f[_0x4289('0x4e')]['id']}})[_0x4289('0x26')](handleEntityNotFound(_0x35f0d4,null))['then'](removeEntity(_0x35f0d4,null))[_0x4289('0x47')](handleError(_0x35f0d4,null));}; \ No newline at end of file +var _0x9a89=['offset','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x9a89,0x72));var _0x99a8=function(_0x4dd728,_0x4835b5){_0x4dd728=_0x4dd728-0x0;var _0x273da0=_0x9a89[_0x4dd728];return _0x273da0;};'use strict';var emlformat=require(_0x99a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x99a8('0x1'));var rp=require(_0x99a8('0x2'));var moment=require('moment');var BPromise=require(_0x99a8('0x3'));var Mustache=require(_0x99a8('0x4'));var util=require(_0x99a8('0x5'));var path=require(_0x99a8('0x6'));var sox=require(_0x99a8('0x7'));var csv=require(_0x99a8('0x8'));var ejs=require(_0x99a8('0x9'));var fs=require('fs');var fs_extra=require(_0x99a8('0xa'));var _=require(_0x99a8('0xb'));var squel=require(_0x99a8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x99a8('0x8'));var querystring=require(_0x99a8('0xd'));var Papa=require(_0x99a8('0xe'));var Redis=require('ioredis');var authService=require(_0x99a8('0xf'));var qs=require(_0x99a8('0x10'));var as=require(_0x99a8('0x11'));var hardwareService=require(_0x99a8('0x12'));var logger=require(_0x99a8('0x13'))(_0x99a8('0x14'));var utils=require(_0x99a8('0x15'));var config=require(_0x99a8('0x16'));var licenseUtil=require(_0x99a8('0x17'));var db=require(_0x99a8('0x18'))['db'];function respondWithStatusCode(_0x2ade12,_0x456da0){_0x456da0=_0x456da0||0xcc;return function(_0x4f4f0f){if(_0x4f4f0f){return _0x2ade12[_0x99a8('0x19')](_0x456da0);}return _0x2ade12[_0x99a8('0x1a')](_0x456da0)[_0x99a8('0x1b')]();};}function respondWithResult(_0x3c35ad,_0x52e90f){_0x52e90f=_0x52e90f||0xc8;return function(_0x455735){if(_0x455735){return _0x3c35ad[_0x99a8('0x1a')](_0x52e90f)[_0x99a8('0x1c')](_0x455735);}};}function respondWithFilteredResult(_0x39a95a,_0x3064d3){return function(_0x218155){if(_0x218155){var _0x3e8af7=typeof _0x3064d3['offset']===_0x99a8('0x1d')&&typeof _0x3064d3[_0x99a8('0x1e')]===_0x99a8('0x1d');var _0x278122=_0x218155[_0x99a8('0x1f')];var _0x2390ef=_0x3e8af7?0x0:_0x3064d3[_0x99a8('0x20')];var _0x22efe1=_0x3e8af7?_0x218155[_0x99a8('0x1f')]:_0x3064d3['offset']+_0x3064d3[_0x99a8('0x1e')];var _0x54e54a;if(_0x22efe1>=_0x278122){_0x22efe1=_0x278122;_0x54e54a=0xc8;}else{_0x54e54a=0xce;}_0x39a95a[_0x99a8('0x1a')](_0x54e54a);return _0x39a95a[_0x99a8('0x21')](_0x99a8('0x22'),_0x2390ef+'-'+_0x22efe1+'/'+_0x278122)[_0x99a8('0x1c')](_0x218155);}return null;};}function patchUpdates(_0x44feb7){return function(_0x5de522){try{jsonpatch['apply'](_0x5de522,_0x44feb7,!![]);}catch(_0xe1b7b0){return BPromise[_0x99a8('0x23')](_0xe1b7b0);}return _0x5de522['save']();};}function saveUpdates(_0x1f4b25,_0x4a137b){return function(_0x7e2fcd){if(_0x7e2fcd){return _0x7e2fcd[_0x99a8('0x24')](_0x1f4b25)[_0x99a8('0x25')](function(_0xfe5093){return _0xfe5093;});}return null;};}function removeEntity(_0x3bdc2e,_0xefbcc8){return function(_0xa7ddbb){if(_0xa7ddbb){return _0xa7ddbb[_0x99a8('0x26')]()[_0x99a8('0x25')](function(){_0x3bdc2e[_0x99a8('0x1a')](0xcc)[_0x99a8('0x1b')]();});}};}function handleEntityNotFound(_0x5b7c26,_0x557b3e){return function(_0x5671cc){if(!_0x5671cc){_0x5b7c26[_0x99a8('0x19')](0x194);}return _0x5671cc;};}function handleError(_0x590fad,_0x4ba9b7){_0x4ba9b7=_0x4ba9b7||0x1f4;return function(_0xbf6c90){logger[_0x99a8('0x27')](_0xbf6c90[_0x99a8('0x28')]);if(_0xbf6c90[_0x99a8('0x29')]){delete _0xbf6c90['name'];}_0x590fad[_0x99a8('0x1a')](_0x4ba9b7)[_0x99a8('0x2a')](_0xbf6c90);};}exports[_0x99a8('0x2b')]=function(_0x166080,_0x3bcb36){var _0x3eafbe={},_0x3a9789={},_0x70f15={'count':0x0,'rows':[]};var _0x16712a=_[_0x99a8('0x2c')](db[_0x99a8('0x2d')][_0x99a8('0x2e')],function(_0xa485a8){return{'name':_0xa485a8[_0x99a8('0x2f')],'type':_0xa485a8[_0x99a8('0x30')][_0x99a8('0x31')]};});_0x3a9789[_0x99a8('0x32')]=_['map'](_0x16712a,_0x99a8('0x29'));_0x3a9789[_0x99a8('0x33')]=_[_0x99a8('0x34')](_0x166080['query']);_0x3a9789[_0x99a8('0x35')]=_[_0x99a8('0x36')](_0x3a9789['model'],_0x3a9789[_0x99a8('0x33')]);_0x3eafbe[_0x99a8('0x37')]=_[_0x99a8('0x36')](_0x3a9789['model'],qs[_0x99a8('0x38')](_0x166080['query'][_0x99a8('0x38')]));_0x3eafbe['attributes']=_0x3eafbe['attributes'][_0x99a8('0x39')]?_0x3eafbe[_0x99a8('0x37')]:_0x3a9789[_0x99a8('0x32')];if(!_0x166080[_0x99a8('0x33')]['hasOwnProperty']('nolimit')){_0x3eafbe[_0x99a8('0x1e')]=qs['limit'](_0x166080[_0x99a8('0x33')]['limit']);_0x3eafbe[_0x99a8('0x20')]=qs[_0x99a8('0x20')](_0x166080[_0x99a8('0x33')][_0x99a8('0x20')]);}_0x3eafbe['order']=qs[_0x99a8('0x3a')](_0x166080[_0x99a8('0x33')]['sort']);_0x3eafbe[_0x99a8('0x3b')]=qs[_0x99a8('0x35')](_['pick'](_0x166080[_0x99a8('0x33')],_0x3a9789['filters']),_0x16712a);if(_0x166080['query'][_0x99a8('0x3c')]){_0x3eafbe[_0x99a8('0x3b')]=_['merge'](_0x3eafbe[_0x99a8('0x3b')],{'$or':_['map'](_0x16712a,function(_0x23bfa3){if(_0x23bfa3[_0x99a8('0x30')]!==_0x99a8('0x3d')){var _0x4d206f={};_0x4d206f[_0x23bfa3[_0x99a8('0x29')]]={'$like':'%'+_0x166080[_0x99a8('0x33')][_0x99a8('0x3c')]+'%'};return _0x4d206f;}})});}_0x3eafbe=_[_0x99a8('0x3e')]({},_0x3eafbe,_0x166080[_0x99a8('0x3f')]);var _0x44377f={'where':_0x3eafbe[_0x99a8('0x3b')]};return db['SugarcrmField'][_0x99a8('0x1f')](_0x44377f)[_0x99a8('0x25')](function(_0x55fd13){_0x70f15[_0x99a8('0x1f')]=_0x55fd13;if(_0x166080[_0x99a8('0x33')][_0x99a8('0x40')]){_0x3eafbe['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x99a8('0x41')](_0x3eafbe);})[_0x99a8('0x25')](function(_0x132640){_0x70f15[_0x99a8('0x42')]=_0x132640;return _0x70f15;})['then'](respondWithFilteredResult(_0x3bcb36,_0x3eafbe))[_0x99a8('0x43')](handleError(_0x3bcb36,null));};exports[_0x99a8('0x44')]=function(_0x425e66,_0x2bddd7){var _0x5dac5a={'raw':!![],'where':{'id':_0x425e66[_0x99a8('0x45')]['id']}},_0x24c1e8={};_0x24c1e8[_0x99a8('0x32')]=_[_0x99a8('0x34')](db[_0x99a8('0x2d')][_0x99a8('0x2e')]);_0x24c1e8[_0x99a8('0x33')]=_[_0x99a8('0x34')](_0x425e66[_0x99a8('0x33')]);_0x24c1e8['filters']=_[_0x99a8('0x36')](_0x24c1e8[_0x99a8('0x32')],_0x24c1e8[_0x99a8('0x33')]);_0x5dac5a['attributes']=_[_0x99a8('0x36')](_0x24c1e8[_0x99a8('0x32')],qs['fields'](_0x425e66[_0x99a8('0x33')]['fields']));_0x5dac5a[_0x99a8('0x37')]=_0x5dac5a[_0x99a8('0x37')][_0x99a8('0x39')]?_0x5dac5a[_0x99a8('0x37')]:_0x24c1e8[_0x99a8('0x32')];if(_0x425e66[_0x99a8('0x33')]['includeAll']){_0x5dac5a['include']=[{'all':!![]}];}_0x5dac5a=_[_0x99a8('0x3e')]({},_0x5dac5a,_0x425e66['options']);return db[_0x99a8('0x2d')][_0x99a8('0x46')](_0x5dac5a)[_0x99a8('0x25')](handleEntityNotFound(_0x2bddd7,null))[_0x99a8('0x25')](respondWithResult(_0x2bddd7,null))[_0x99a8('0x43')](handleError(_0x2bddd7,null));};exports[_0x99a8('0x47')]=function(_0x995943,_0x5d40c8){return db['SugarcrmField']['create'](_0x995943[_0x99a8('0x48')],{})[_0x99a8('0x25')](respondWithResult(_0x5d40c8,0xc9))[_0x99a8('0x43')](handleError(_0x5d40c8,null));};exports['update']=function(_0xca7215,_0x6819f4){if(_0xca7215[_0x99a8('0x48')]['id']){delete _0xca7215[_0x99a8('0x48')]['id'];}return db[_0x99a8('0x2d')][_0x99a8('0x46')]({'where':{'id':_0xca7215['params']['id']}})[_0x99a8('0x25')](handleEntityNotFound(_0x6819f4,null))['then'](saveUpdates(_0xca7215[_0x99a8('0x48')],null))[_0x99a8('0x25')](respondWithResult(_0x6819f4,null))[_0x99a8('0x43')](handleError(_0x6819f4,null));};exports[_0x99a8('0x26')]=function(_0x2c2bc5,_0x109629){return db[_0x99a8('0x2d')][_0x99a8('0x46')]({'where':{'id':_0x2c2bc5['params']['id']}})['then'](handleEntityNotFound(_0x109629,null))['then'](removeEntity(_0x109629,null))[_0x99a8('0x43')](handleError(_0x109629,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 22133c4..d154e43 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 _0x34e1=['FieldId','api','bluebird','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','idField'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x34e1,0x1c4));var _0x134e=function(_0x3c2863,_0x1b2cee){_0x3c2863=_0x3c2863-0x0;var _0x2c3d27=_0x34e1[_0x3c2863];return _0x2c3d27;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x134e('0x0'));var moment=require('moment');var BPromise=require(_0x134e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x134e('0x2'));var rimraf=require(_0x134e('0x3'));var config=require('../../config/environment');var attributes=require(_0x134e('0x4'));module[_0x134e('0x5')]=function(_0x43dd27,_0xea22f6){return _0x43dd27[_0x134e('0x6')](_0x134e('0x7'),attributes,{'tableName':_0x134e('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x134e('0x9'),_0x134e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xef40=['../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','path','rimraf'];(function(_0x290d3b,_0xb7c790){var _0x318eaf=function(_0x4f906c){while(--_0x4f906c){_0x290d3b['push'](_0x290d3b['shift']());}};_0x318eaf(++_0xb7c790);}(_0xef40,0x1c8));var _0x0ef4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xef40[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0ef4('0x0'));var util=require('util');var logger=require(_0x0ef4('0x1'))(_0x0ef4('0x2'));var moment=require('moment');var BPromise=require(_0x0ef4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef4('0x4'));var rimraf=require(_0x0ef4('0x5'));var config=require(_0x0ef4('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0x0ef4('0x7')]=function(_0x538202,_0x17d8c4){return _0x538202[_0x0ef4('0x8')](_0x0ef4('0x9'),attributes,{'tableName':_0x0ef4('0xa'),'paranoid':![],'indexes':[{'name':_0x0ef4('0xb'),'fields':[_0x0ef4('0xc'),_0x0ef4('0xd')],'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 99f7419..29425ab 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 _0x552b=['request','then','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x552b,0xe6));var _0xb552=function(_0x12556a,_0x373c51){_0x12556a=_0x12556a-0x0;var _0x5e682c=_0x552b[_0x12556a];return _0x5e682c;};'use strict';var _=require(_0xb552('0x0'));var util=require(_0xb552('0x1'));var moment=require(_0xb552('0x2'));var BPromise=require(_0xb552('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb552('0x4'));var db=require(_0xb552('0x5'))['db'];var utils=require(_0xb552('0x6'));var logger=require(_0xb552('0x7'))(_0xb552('0x8'));var config=require(_0xb552('0x9'));var jayson=require(_0xb552('0xa'));var client=jayson[_0xb552('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a273a,_0x589cdc,_0x29a41a){return new BPromise(function(_0xb078ad,_0x553592){return client[_0xb552('0xc')](_0x1a273a,_0x29a41a)[_0xb552('0xd')](function(_0x194b94){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x589cdc,_0xb552('0xe'));logger['debug'](_0xb552('0xf'),_0x589cdc,_0xb552('0xe'),JSON[_0xb552('0x10')](_0x194b94));if(_0x194b94[_0xb552('0x11')]){if(_0x194b94[_0xb552('0x11')]['code']===0x1f4){logger[_0xb552('0x11')](_0xb552('0x12'),_0x589cdc,_0x194b94[_0xb552('0x11')][_0xb552('0x13')]);return _0x553592(_0x194b94[_0xb552('0x11')]['message']);}logger['error'](_0xb552('0x12'),_0x589cdc,_0x194b94['error'][_0xb552('0x13')]);return _0xb078ad(_0x194b94['error'][_0xb552('0x13')]);}else{logger['info'](_0xb552('0x12'),_0x589cdc,'request\x20sent');_0xb078ad(_0x194b94[_0xb552('0x14')]['message']);}})[_0xb552('0x15')](function(_0x262e4b){logger[_0xb552('0x11')](_0xb552('0x12'),_0x589cdc,_0x262e4b);_0x553592(_0x262e4b);});});} \ No newline at end of file +var _0x6572=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','randomstring'];(function(_0xe92d86,_0x1d7dc8){var _0x3f620b=function(_0x1ee2cc){while(--_0x1ee2cc){_0xe92d86['push'](_0xe92d86['shift']());}};_0x3f620b(++_0x1d7dc8);}(_0x6572,0x178));var _0x2657=function(_0xf68c7e,_0x64f474){_0xf68c7e=_0xf68c7e-0x0;var _0x1acc8f=_0x6572[_0xf68c7e];return _0x1acc8f;};'use strict';var _=require(_0x2657('0x0'));var util=require(_0x2657('0x1'));var moment=require(_0x2657('0x2'));var BPromise=require('bluebird');var rs=require(_0x2657('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2657('0x4'))['db'];var utils=require(_0x2657('0x5'));var logger=require(_0x2657('0x6'))(_0x2657('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2657('0x8')][_0x2657('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c7569,_0x446f92,_0x29e626){return new BPromise(function(_0x3fedb2,_0x2e35d7){return client[_0x2657('0xa')](_0x3c7569,_0x29e626)['then'](function(_0x366e83){logger[_0x2657('0xb')](_0x2657('0xc'),_0x446f92,_0x2657('0xd'));logger[_0x2657('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x446f92,'request\x20sent',JSON['stringify'](_0x366e83));if(_0x366e83[_0x2657('0xf')]){if(_0x366e83['error'][_0x2657('0x10')]===0x1f4){logger[_0x2657('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x446f92,_0x366e83['error'][_0x2657('0x11')]);return _0x2e35d7(_0x366e83[_0x2657('0xf')][_0x2657('0x11')]);}logger[_0x2657('0xf')](_0x2657('0xc'),_0x446f92,_0x366e83[_0x2657('0xf')]['message']);return _0x3fedb2(_0x366e83[_0x2657('0xf')][_0x2657('0x11')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x446f92,_0x2657('0xd'));_0x3fedb2(_0x366e83[_0x2657('0x12')][_0x2657('0x11')]);}})['catch'](function(_0xd55343){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x446f92,_0xd55343);_0x2e35d7(_0xd55343);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index cd96a58..33bd222 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 _0xe41f=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getFields','post','put','update','delete','destroy','multer','util'];(function(_0x4be559,_0x209fa6){var _0x401978=function(_0x2d7e6f){while(--_0x2d7e6f){_0x4be559['push'](_0x4be559['shift']());}};_0x401978(++_0x209fa6);}(_0xe41f,0x13e));var _0xfe41=function(_0x50dfa0,_0x1f4ae0){_0x50dfa0=_0x50dfa0-0x0;var _0x4fc79a=_0xe41f[_0x50dfa0];return _0x4fc79a;};'use strict';var multer=require(_0xfe41('0x0'));var util=require(_0xfe41('0x1'));var path=require(_0xfe41('0x2'));var timeout=require(_0xfe41('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfe41('0x4'));var interaction=require(_0xfe41('0x5'));var config=require(_0xfe41('0x6'));var controller=require(_0xfe41('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfe41('0x8')]);router['get'](_0xfe41('0x9'),auth[_0xfe41('0xa')](),controller[_0xfe41('0xb')]);router[_0xfe41('0xc')](_0xfe41('0xd'),auth[_0xfe41('0xa')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xfe41('0xe')]);router[_0xfe41('0xf')]('/',auth[_0xfe41('0xa')](),controller['create']);router[_0xfe41('0xf')](_0xfe41('0xd'),auth[_0xfe41('0xa')](),controller['addConfiguration']);router[_0xfe41('0x10')](_0xfe41('0x9'),auth['isAuthenticated'](),controller[_0xfe41('0x11')]);router[_0xfe41('0x12')](_0xfe41('0x9'),auth[_0xfe41('0xa')](),controller[_0xfe41('0x13')]);module['exports']=router; \ No newline at end of file +var _0x795a=['destroy','exports','util','path','express','fs-extra','../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','delete'];(function(_0xa2b534,_0x4c8503){var _0x58eea8=function(_0x576d12){while(--_0x576d12){_0xa2b534['push'](_0xa2b534['shift']());}};_0x58eea8(++_0x4c8503);}(_0x795a,0xa2));var _0xa795=function(_0x181c82,_0x26790b){_0x181c82=_0x181c82-0x0;var _0x4b4487=_0x795a[_0x181c82];return _0x4b4487;};'use strict';var multer=require('multer');var util=require(_0xa795('0x0'));var path=require(_0xa795('0x1'));var timeout=require('connect-timeout');var express=require(_0xa795('0x2'));var router=express['Router']();var fs_extra=require(_0xa795('0x3'));var auth=require(_0xa795('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa795('0x5'));router[_0xa795('0x6')]('/',auth[_0xa795('0x7')](),controller[_0xa795('0x8')]);router['get'](_0xa795('0x9'),auth['isAuthenticated'](),controller[_0xa795('0xa')]);router['get']('/:id/configurations',auth[_0xa795('0x7')](),controller[_0xa795('0xb')]);router[_0xa795('0x6')](_0xa795('0xc'),auth[_0xa795('0x7')](),controller[_0xa795('0xd')]);router[_0xa795('0xe')]('/',auth[_0xa795('0x7')](),controller['create']);router['post'](_0xa795('0xf'),auth[_0xa795('0x7')](),controller[_0xa795('0x10')]);router['put'](_0xa795('0x9'),auth[_0xa795('0x7')](),controller['update']);router[_0xa795('0x11')](_0xa795('0x9'),auth[_0xa795('0x7')](),controller[_0xa795('0x12')]);module[_0xa795('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3afa72c..8292815 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 _0xe6d0=['exports','STRING','HelpDesk','sequelize'];(function(_0x133b41,_0x29b73c){var _0x25ebee=function(_0x5c2159){while(--_0x5c2159){_0x133b41['push'](_0x133b41['shift']());}};_0x25ebee(++_0x29b73c);}(_0xe6d0,0x11f));var _0x0e6d=function(_0x5d1ebc,_0x4833c7){_0x5d1ebc=_0x5d1ebc-0x0;var _0x65e322=_0xe6d0[_0x5d1ebc];return _0x65e322;};'use strict';var Sequelize=require(_0x0e6d('0x0'));module[_0x0e6d('0x1')]={'name':{'type':Sequelize[_0x0e6d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0e6d('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0e6d('0x2')],'allowNull':![],'defaultValue':_0x0e6d('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0e6d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0e6d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa012=['HelpDesk','STRING'];(function(_0x534617,_0x41a7ba){var _0x516e6a=function(_0x2cbb81){while(--_0x2cbb81){_0x534617['push'](_0x534617['shift']());}};_0x516e6a(++_0x41a7ba);}(_0xa012,0xc5));var _0x2a01=function(_0x2ce05,_0x306b52){_0x2ce05=_0x2ce05-0x0;var _0x1c6341=_0xa012[_0x2ce05];return _0x1c6341;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2a01('0x0')]},'username':{'type':Sequelize[_0x2a01('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2a01('0x0')],'allowNull':![],'defaultValue':_0x2a01('0x1')},'remoteUri':{'type':Sequelize[_0x2a01('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2a01('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x2a01('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7f24a78..f0917ed 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 _0x7d25=['accessKey','remoteUri','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','GET','describe','result','sessionName','autogenerated','reference','owner','remove','false','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','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/license/util','../../components/integrations/configuration','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','name','send','index','VtigerAccount','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','getConfigurations','findOne','options','addConfiguration','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','username','moduleName'];(function(_0x5c4c2a,_0xebe14a){var _0x325521=function(_0x22688b){while(--_0x22688b){_0x5c4c2a['push'](_0x5c4c2a['shift']());}};_0x325521(++_0xebe14a);}(_0x7d25,0x106));var _0x57d2=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x7d25[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x57d2('0x0'));var rimraf=require(_0x57d2('0x1'));var zipdir=require(_0x57d2('0x2'));var jsonpatch=require(_0x57d2('0x3'));var rp=require(_0x57d2('0x4'));var moment=require(_0x57d2('0x5'));var BPromise=require(_0x57d2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x57d2('0x7'));var sox=require('sox');var csv=require(_0x57d2('0x8'));var ejs=require(_0x57d2('0x9'));var fs=require('fs');var fs_extra=require(_0x57d2('0xa'));var _=require(_0x57d2('0xb'));var squel=require(_0x57d2('0xc'));var crypto=require(_0x57d2('0xd'));var jsforce=require(_0x57d2('0xe'));var deskjs=require(_0x57d2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x57d2('0x10'));var Papa=require('papaparse');var Redis=require(_0x57d2('0x11'));var authService=require(_0x57d2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x57d2('0x13'));var hardwareService=require(_0x57d2('0x14'));var logger=require(_0x57d2('0x15'))(_0x57d2('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x57d2('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x57d2('0x18'));function respondWithStatusCode(_0x5765ab,_0x4f183f){_0x4f183f=_0x4f183f||0xcc;return function(_0x4fc8a9){if(_0x4fc8a9){return _0x5765ab['sendStatus'](_0x4f183f);}return _0x5765ab[_0x57d2('0x19')](_0x4f183f)['end']();};}function respondWithResult(_0x127b44,_0x56497d){_0x56497d=_0x56497d||0xc8;return function(_0x18bfe5){if(_0x18bfe5){return _0x127b44[_0x57d2('0x19')](_0x56497d)[_0x57d2('0x1a')](_0x18bfe5);}};}function respondWithFilteredResult(_0x59498b,_0x5226e4){return function(_0x5da953){if(_0x5da953){var _0x160585=typeof _0x5226e4[_0x57d2('0x1b')]==='undefined'&&typeof _0x5226e4[_0x57d2('0x1c')]==='undefined';var _0x2ced04=_0x5da953[_0x57d2('0x1d')];var _0x27d79e=_0x160585?0x0:_0x5226e4[_0x57d2('0x1b')];var _0x408be1=_0x160585?_0x5da953[_0x57d2('0x1d')]:_0x5226e4[_0x57d2('0x1b')]+_0x5226e4[_0x57d2('0x1c')];var _0x44d6b8;if(_0x408be1>=_0x2ced04){_0x408be1=_0x2ced04;_0x44d6b8=0xc8;}else{_0x44d6b8=0xce;}_0x59498b[_0x57d2('0x19')](_0x44d6b8);return _0x59498b[_0x57d2('0x1e')](_0x57d2('0x1f'),_0x27d79e+'-'+_0x408be1+'/'+_0x2ced04)[_0x57d2('0x1a')](_0x5da953);}return null;};}function patchUpdates(_0x2a57e1){return function(_0x557438){try{jsonpatch[_0x57d2('0x20')](_0x557438,_0x2a57e1,!![]);}catch(_0xdc8e38){return BPromise[_0x57d2('0x21')](_0xdc8e38);}return _0x557438[_0x57d2('0x22')]();};}function saveUpdates(_0xf97f0b,_0x4ca907){return function(_0xcc4ef6){if(_0xcc4ef6){return _0xcc4ef6['update'](_0xf97f0b)['then'](function(_0x7ef133){return _0x7ef133;});}return null;};}function removeEntity(_0x4e4f8f,_0x532059){return function(_0x4e6855){if(_0x4e6855){return _0x4e6855[_0x57d2('0x23')]()[_0x57d2('0x24')](function(){_0x4e4f8f[_0x57d2('0x19')](0xcc)[_0x57d2('0x25')]();});}};}function handleEntityNotFound(_0x29d2f1,_0x546b87){return function(_0x262dd1){if(!_0x262dd1){_0x29d2f1[_0x57d2('0x26')](0x194);}return _0x262dd1;};}function handleError(_0x10a78a,_0x5b5145){_0x5b5145=_0x5b5145||0x1f4;return function(_0x11a741){logger[_0x57d2('0x27')](_0x11a741['stack']);if(_0x11a741[_0x57d2('0x28')]){delete _0x11a741[_0x57d2('0x28')];}_0x10a78a[_0x57d2('0x19')](_0x5b5145)[_0x57d2('0x29')](_0x11a741);};}exports[_0x57d2('0x2a')]=function(_0x31799f,_0x245eba){var _0x452f76={},_0x32c5e2={},_0x2bba73={'count':0x0,'rows':[]};var _0xe44cc3=_['map'](db[_0x57d2('0x2b')][_0x57d2('0x2c')],function(_0x4d6d1){return{'name':_0x4d6d1[_0x57d2('0x2d')],'type':_0x4d6d1['type']['key']};});_0x32c5e2['model']=_[_0x57d2('0x2e')](_0xe44cc3,'name');_0x32c5e2[_0x57d2('0x2f')]=_[_0x57d2('0x30')](_0x31799f['query']);_0x32c5e2[_0x57d2('0x31')]=_[_0x57d2('0x32')](_0x32c5e2[_0x57d2('0x33')],_0x32c5e2[_0x57d2('0x2f')]);_0x452f76[_0x57d2('0x34')]=_[_0x57d2('0x32')](_0x32c5e2[_0x57d2('0x33')],qs[_0x57d2('0x35')](_0x31799f[_0x57d2('0x2f')][_0x57d2('0x35')]));_0x452f76[_0x57d2('0x34')]=_0x452f76[_0x57d2('0x34')]['length']?_0x452f76[_0x57d2('0x34')]:_0x32c5e2[_0x57d2('0x33')];if(!_0x31799f[_0x57d2('0x2f')]['hasOwnProperty'](_0x57d2('0x36'))){_0x452f76[_0x57d2('0x1c')]=qs[_0x57d2('0x1c')](_0x31799f[_0x57d2('0x2f')]['limit']);_0x452f76[_0x57d2('0x1b')]=qs['offset'](_0x31799f[_0x57d2('0x2f')][_0x57d2('0x1b')]);}_0x452f76[_0x57d2('0x37')]=qs['sort'](_0x31799f['query'][_0x57d2('0x38')]);_0x452f76['where']=qs[_0x57d2('0x31')](_[_0x57d2('0x39')](_0x31799f['query'],_0x32c5e2[_0x57d2('0x31')]),_0xe44cc3);if(_0x31799f[_0x57d2('0x2f')][_0x57d2('0x3a')]){_0x452f76[_0x57d2('0x3b')]=_['merge'](_0x452f76[_0x57d2('0x3b')],{'$or':_[_0x57d2('0x2e')](_0xe44cc3,function(_0x1960a2){if(_0x1960a2[_0x57d2('0x3c')]!==_0x57d2('0x3d')){var _0x10ecb2={};_0x10ecb2[_0x1960a2[_0x57d2('0x28')]]={'$like':'%'+_0x31799f[_0x57d2('0x2f')]['filter']+'%'};return _0x10ecb2;}})});}_0x452f76=_[_0x57d2('0x3e')]({},_0x452f76,_0x31799f['options']);var _0x4361f2={'where':_0x452f76[_0x57d2('0x3b')]};return db[_0x57d2('0x2b')]['count'](_0x4361f2)[_0x57d2('0x24')](function(_0x51923b){_0x2bba73['count']=_0x51923b;if(_0x31799f['query'][_0x57d2('0x3f')]){_0x452f76[_0x57d2('0x40')]=[{'all':!![]}];}return db[_0x57d2('0x2b')][_0x57d2('0x41')](_0x452f76);})['then'](function(_0x4bfeb0){_0x2bba73[_0x57d2('0x42')]=_0x4bfeb0;return _0x2bba73;})[_0x57d2('0x24')](respondWithFilteredResult(_0x245eba,_0x452f76))[_0x57d2('0x43')](handleError(_0x245eba,null));};exports[_0x57d2('0x44')]=function(_0x2ed81e,_0x4f54f5){var _0x41c5e3={'raw':![],'where':{'id':_0x2ed81e[_0x57d2('0x45')]['id']}},_0x25be15={};_0x25be15[_0x57d2('0x33')]=_[_0x57d2('0x30')](db['VtigerAccount'][_0x57d2('0x2c')]);_0x25be15[_0x57d2('0x2f')]=_[_0x57d2('0x30')](_0x2ed81e['query']);_0x25be15[_0x57d2('0x31')]=_[_0x57d2('0x32')](_0x25be15[_0x57d2('0x33')],_0x25be15[_0x57d2('0x2f')]);_0x41c5e3['attributes']=_[_0x57d2('0x32')](_0x25be15[_0x57d2('0x33')],qs[_0x57d2('0x35')](_0x2ed81e[_0x57d2('0x2f')][_0x57d2('0x35')]));_0x41c5e3['attributes']=_0x41c5e3[_0x57d2('0x34')][_0x57d2('0x46')]?_0x41c5e3['attributes']:_0x25be15[_0x57d2('0x33')];if(_0x2ed81e[_0x57d2('0x2f')][_0x57d2('0x3f')]){_0x41c5e3['include']=[{'all':!![]}];}_0x41c5e3=_[_0x57d2('0x3e')]({},_0x41c5e3,_0x2ed81e['options']);return db[_0x57d2('0x2b')]['find'](_0x41c5e3)[_0x57d2('0x24')](handleEntityNotFound(_0x4f54f5,null))['then'](respondWithResult(_0x4f54f5,null))[_0x57d2('0x43')](handleError(_0x4f54f5,null));};exports['create']=function(_0x33d676,_0x31ed59){return db[_0x57d2('0x2b')][_0x57d2('0x47')](_0x33d676[_0x57d2('0x48')],{})['then'](respondWithResult(_0x31ed59,0xc9))[_0x57d2('0x43')](handleError(_0x31ed59,null));};exports[_0x57d2('0x49')]=function(_0x4159bd,_0x5c3848){if(_0x4159bd[_0x57d2('0x48')]['id']){delete _0x4159bd['body']['id'];}return db[_0x57d2('0x2b')]['find']({'where':{'id':_0x4159bd[_0x57d2('0x45')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x5c3848,null))[_0x57d2('0x24')](saveUpdates(_0x4159bd[_0x57d2('0x48')],null))[_0x57d2('0x24')](respondWithResult(_0x5c3848,null))[_0x57d2('0x43')](handleError(_0x5c3848,null));};exports[_0x57d2('0x23')]=function(_0x392887,_0x4800fb){return db[_0x57d2('0x2b')]['find']({'where':{'id':_0x392887[_0x57d2('0x45')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x4800fb,null))[_0x57d2('0x24')](removeEntity(_0x4800fb,null))['catch'](handleError(_0x4800fb,null));};exports[_0x57d2('0x4a')]=function(_0x20439b,_0x1a101a,_0x35738c){var _0x2e2796={};var _0x2a9fd5={};var _0x7eb0a6;var _0x54ee22;return db[_0x57d2('0x2b')][_0x57d2('0x4b')]({'where':{'id':_0x20439b[_0x57d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a101a,null))[_0x57d2('0x24')](function(_0x198a72){if(_0x198a72){_0x7eb0a6=_0x198a72;_0x2a9fd5[_0x57d2('0x33')]=_['keys'](db['VtigerConfiguration'][_0x57d2('0x2c')]);_0x2a9fd5[_0x57d2('0x2f')]=_['keys'](_0x20439b[_0x57d2('0x2f')]);_0x2a9fd5[_0x57d2('0x31')]=_[_0x57d2('0x32')](_0x2a9fd5[_0x57d2('0x33')],_0x2a9fd5[_0x57d2('0x2f')]);_0x2e2796[_0x57d2('0x34')]=_[_0x57d2('0x32')](_0x2a9fd5[_0x57d2('0x33')],qs[_0x57d2('0x35')](_0x20439b['query'][_0x57d2('0x35')]));_0x2e2796[_0x57d2('0x34')]=_0x2e2796[_0x57d2('0x34')][_0x57d2('0x46')]?_0x2e2796[_0x57d2('0x34')]:_0x2a9fd5[_0x57d2('0x33')];_0x2e2796['order']=qs['sort'](_0x20439b[_0x57d2('0x2f')][_0x57d2('0x38')]);_0x2e2796[_0x57d2('0x3b')]=qs[_0x57d2('0x31')](_[_0x57d2('0x39')](_0x20439b[_0x57d2('0x2f')],_0x2a9fd5['filters']));if(_0x20439b[_0x57d2('0x2f')][_0x57d2('0x3a')]){_0x2e2796['where']=_[_0x57d2('0x3e')](_0x2e2796[_0x57d2('0x3b')],{'$or':_[_0x57d2('0x2e')](_0x2e2796['attributes'],function(_0x2724ef){var _0x560d83={};_0x560d83[_0x2724ef]={'$like':'%'+_0x20439b[_0x57d2('0x2f')][_0x57d2('0x3a')]+'%'};return _0x560d83;})});}_0x2e2796=_[_0x57d2('0x3e')]({},_0x2e2796,_0x20439b[_0x57d2('0x4c')]);return _0x7eb0a6[_0x57d2('0x4a')](_0x2e2796);}})[_0x57d2('0x24')](function(_0x2aff38){if(_0x2aff38){_0x54ee22=_0x2aff38[_0x57d2('0x46')];if(!_0x20439b[_0x57d2('0x2f')]['hasOwnProperty'](_0x57d2('0x36'))){_0x2e2796[_0x57d2('0x1c')]=qs[_0x57d2('0x1c')](_0x20439b[_0x57d2('0x2f')][_0x57d2('0x1c')]);_0x2e2796['offset']=qs[_0x57d2('0x1b')](_0x20439b['query'][_0x57d2('0x1b')]);}return _0x7eb0a6[_0x57d2('0x4a')](_0x2e2796);}})[_0x57d2('0x24')](function(_0x42aae3){if(_0x42aae3){return _0x42aae3?{'count':_0x54ee22,'rows':_0x42aae3}:null;}})[_0x57d2('0x24')](respondWithResult(_0x1a101a,null))[_0x57d2('0x43')](handleError(_0x1a101a,null));};exports[_0x57d2('0x4d')]=function(_0x7f310c,_0x27a97e,_0xb837c8){if(_0x7f310c[_0x57d2('0x48')]['id']){delete _0x7f310c[_0x57d2('0x48')]['id'];}return db[_0x57d2('0x2b')][_0x57d2('0x4b')]({'where':{'id':_0x7f310c[_0x57d2('0x45')]['id']}})[_0x57d2('0x24')](handleEntityNotFound(_0x27a97e,null))[_0x57d2('0x24')](function(_0x2c2fc2){if(_0x2c2fc2){_0x7f310c[_0x57d2('0x48')]['AccountId']=_0x2c2fc2['id'];_0x7f310c[_0x57d2('0x48')][_0x57d2('0x4e')]=integrations['getSubjects'](_0x7f310c['body'][_0x57d2('0x4f')],_0x7f310c[_0x57d2('0x48')][_0x57d2('0x3c')]);_0x7f310c[_0x57d2('0x48')][_0x57d2('0x50')]=integrations[_0x57d2('0x51')](_0x7f310c[_0x57d2('0x48')]['channel'],_0x7f310c[_0x57d2('0x48')][_0x57d2('0x3c')]);return db[_0x57d2('0x52')]['create'](_0x7f310c[_0x57d2('0x48')],{'include':[{'model':db[_0x57d2('0x53')],'as':_0x57d2('0x4e')},{'model':db[_0x57d2('0x53')],'as':_0x57d2('0x50')}]});}return null;})[_0x57d2('0x24')](respondWithResult(_0x27a97e,null))[_0x57d2('0x43')](handleError(_0x27a97e,null));};var md5=require('md5');exports['getFields']=function(_0x395963,_0x503c7e,_0x149573){var _0x3d5d64=null;var _0x10b696=null;var _0x41ee8f=null;var _0x5377c8=null;var _0x4103a5='';return db['VtigerAccount'][_0x57d2('0x4b')]({'where':{'id':_0x395963['params']['id']},'attributes':['id',_0x57d2('0x28'),_0x57d2('0x54'),'description',_0x57d2('0x55'),'remoteUri','serverUrl',_0x57d2('0x56')]})[_0x57d2('0x24')](handleEntityNotFound(_0x503c7e,null))[_0x57d2('0x24')](function(_0x2c779e){if(_0x2c779e){_0x3d5d64=_0x2c779e[_0x57d2('0x54')];_0x10b696=_0x2c779e['accessKey'];_0x41ee8f=_0x2c779e[_0x57d2('0x55')];_0x4103a5=_0x2c779e[_0x57d2('0x57')];var _0xfcc5da=_0x4103a5['slice'](-0x1);if(_0xfcc5da==='/'){_0x4103a5=_0x4103a5[_0x57d2('0x58')](0x0,_0x4103a5[_0x57d2('0x59')](_0xfcc5da));}_0x5377c8=util[_0x57d2('0x5a')](_0x57d2('0x5b'),_0x4103a5);var _0xc2d380={'method':'GET','uri':_0x5377c8,'qs':{'operation':_0x57d2('0x5c'),'username':_0x2c779e[_0x57d2('0x54')]},'json':!![]};return rp(_0xc2d380);}})[_0x57d2('0x24')](function(_0x539fa1){if(_0x539fa1[_0x57d2('0x5d')]){var _0x562f4b={'method':_0x57d2('0x5e'),'uri':_0x5377c8,'form':{'operation':_0x57d2('0x5f'),'username':_0x3d5d64,'accessKey':md5(_0x539fa1['result']['token']+_0x10b696)},'json':!![]};return rp(_0x562f4b);}})[_0x57d2('0x24')](function(_0x3bd3d5){if(_0x3bd3d5[_0x57d2('0x5d')]){var _0x44df77={'method':_0x57d2('0x60'),'uri':_0x5377c8,'qs':{'operation':_0x57d2('0x61'),'username':_0x3d5d64,'sessionName':_0x3bd3d5[_0x57d2('0x62')][_0x57d2('0x63')],'elementType':_0x41ee8f},'json':!![]};return rp(_0x44df77);}})[_0x57d2('0x24')](function(_0x478354){if(_0x478354['success']){var _0x5e159b=[_0x57d2('0x64'),_0x57d2('0x65'),_0x57d2('0x66')];_[_0x57d2('0x67')](_0x478354['result']['fields'],function(_0x2fe7be){return _0x5e159b['includes'](_0x2fe7be[_0x57d2('0x3c')][_0x57d2('0x28')]);});_[_0x57d2('0x67')](_0x478354[_0x57d2('0x62')][_0x57d2('0x35')],function(_0x297a1c){return _0x297a1c['editable']===_0x57d2('0x68');});return{'count':_0x478354[_0x57d2('0x62')]['fields'][_0x57d2('0x46')],'rows':_[_0x57d2('0x2e')](_0x478354[_0x57d2('0x62')][_0x57d2('0x35')],function(_0x103b85){return{'id':_0x103b85[_0x57d2('0x28')],'name':_0x103b85[_0x57d2('0x69')],'custom':_['startsWith'](_0x103b85[_0x57d2('0x28')],_0x57d2('0x6a'))?!![]:![],'options':_0x103b85[_0x57d2('0x3c')][_0x57d2('0x28')]===_0x57d2('0x6b')&&_0x103b85[_0x57d2('0x3c')][_0x57d2('0x6c')]['length']>0x0?_[_0x57d2('0x2e')](_0x103b85[_0x57d2('0x3c')][_0x57d2('0x6c')],function(_0x537702){return{'name':_0x537702[_0x57d2('0x69')],'value':_0x537702[_0x57d2('0x6d')]};}):[]};})};}})[_0x57d2('0x24')](respondWithResult(_0x503c7e,null))[_0x57d2('0x43')](function(_0x58e473){console['log'](_0x57d2('0x6e')+_0x58e473);var _0x3a82be=_0x395963['query'][_0x57d2('0x6f')]?0x1f4:_0x58e473[_0x57d2('0x70')]||0x1f4;logger['error'](_0x57d2('0x71'),_0x57d2('0x72'),_0x3a82be,JSON['stringify'](_0x58e473));delete _0x58e473[_0x57d2('0x28')];if(_0x3a82be===0x191){_0x3a82be=0x190;}_0x503c7e[_0x57d2('0x19')](_0x3a82be)['send'](_0x395963[_0x57d2('0x2f')][_0x57d2('0x6f')]?{'message':_0x57d2('0x73'),'statusCode':_0x58e473[_0x57d2('0x70')]}:_0x58e473);});}; \ No newline at end of file +var _0x6f45=['body','getConfigurations','findOne','VtigerConfiguration','order','addConfiguration','Subjects','getSubjects','channel','getDescriptions','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','result','token','describe','sessionName','reference','owner','remove','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create'];(function(_0x34081e,_0x41edc6){var _0x21191c=function(_0x466e52){while(--_0x466e52){_0x34081e['push'](_0x34081e['shift']());}};_0x21191c(++_0x41edc6);}(_0x6f45,0x120));var _0x56f4=function(_0x2bf66a,_0x3a16bc){_0x2bf66a=_0x2bf66a-0x0;var _0x5902c4=_0x6f45[_0x2bf66a];return _0x5902c4;};'use strict';var emlformat=require(_0x56f4('0x0'));var rimraf=require(_0x56f4('0x1'));var zipdir=require(_0x56f4('0x2'));var jsonpatch=require(_0x56f4('0x3'));var rp=require(_0x56f4('0x4'));var moment=require('moment');var BPromise=require(_0x56f4('0x5'));var Mustache=require('mustache');var util=require(_0x56f4('0x6'));var path=require(_0x56f4('0x7'));var sox=require(_0x56f4('0x8'));var csv=require(_0x56f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56f4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x56f4('0xb'));var jsforce=require(_0x56f4('0xc'));var deskjs=require(_0x56f4('0xd'));var toCsv=require(_0x56f4('0x9'));var querystring=require(_0x56f4('0xe'));var Papa=require(_0x56f4('0xf'));var Redis=require(_0x56f4('0x10'));var authService=require(_0x56f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x56f4('0x12'));var hardwareService=require(_0x56f4('0x13'));var logger=require(_0x56f4('0x14'))(_0x56f4('0x15'));var utils=require(_0x56f4('0x16'));var config=require(_0x56f4('0x17'));var licenseUtil=require(_0x56f4('0x18'));var db=require(_0x56f4('0x19'))['db'];var integrations=require(_0x56f4('0x1a'));function respondWithStatusCode(_0x3e4072,_0x182a5a){_0x182a5a=_0x182a5a||0xcc;return function(_0x2b71c4){if(_0x2b71c4){return _0x3e4072[_0x56f4('0x1b')](_0x182a5a);}return _0x3e4072[_0x56f4('0x1c')](_0x182a5a)[_0x56f4('0x1d')]();};}function respondWithResult(_0x11b14b,_0x532252){_0x532252=_0x532252||0xc8;return function(_0x441816){if(_0x441816){return _0x11b14b[_0x56f4('0x1c')](_0x532252)['json'](_0x441816);}};}function respondWithFilteredResult(_0x2a6d4d,_0x4544ea){return function(_0x36a8f1){if(_0x36a8f1){var _0x1ba54f=typeof _0x4544ea[_0x56f4('0x1e')]===_0x56f4('0x1f')&&typeof _0x4544ea[_0x56f4('0x20')]===_0x56f4('0x1f');var _0x4ca2e8=_0x36a8f1['count'];var _0x3e060b=_0x1ba54f?0x0:_0x4544ea[_0x56f4('0x1e')];var _0x3937c5=_0x1ba54f?_0x36a8f1[_0x56f4('0x21')]:_0x4544ea[_0x56f4('0x1e')]+_0x4544ea[_0x56f4('0x20')];var _0x58f684;if(_0x3937c5>=_0x4ca2e8){_0x3937c5=_0x4ca2e8;_0x58f684=0xc8;}else{_0x58f684=0xce;}_0x2a6d4d[_0x56f4('0x1c')](_0x58f684);return _0x2a6d4d[_0x56f4('0x22')](_0x56f4('0x23'),_0x3e060b+'-'+_0x3937c5+'/'+_0x4ca2e8)['json'](_0x36a8f1);}return null;};}function patchUpdates(_0x1f02b1){return function(_0x5b49e7){try{jsonpatch[_0x56f4('0x24')](_0x5b49e7,_0x1f02b1,!![]);}catch(_0x5208f6){return BPromise[_0x56f4('0x25')](_0x5208f6);}return _0x5b49e7[_0x56f4('0x26')]();};}function saveUpdates(_0x93cafd,_0xdfe525){return function(_0x5f1eb3){if(_0x5f1eb3){return _0x5f1eb3[_0x56f4('0x27')](_0x93cafd)[_0x56f4('0x28')](function(_0x3db82e){return _0x3db82e;});}return null;};}function removeEntity(_0x934d22,_0x529ee2){return function(_0x4be71b){if(_0x4be71b){return _0x4be71b[_0x56f4('0x29')]()[_0x56f4('0x28')](function(){_0x934d22[_0x56f4('0x1c')](0xcc)[_0x56f4('0x1d')]();});}};}function handleEntityNotFound(_0x375a33,_0xa424d0){return function(_0x3a7240){if(!_0x3a7240){_0x375a33[_0x56f4('0x1b')](0x194);}return _0x3a7240;};}function handleError(_0x8971e8,_0x4a549a){_0x4a549a=_0x4a549a||0x1f4;return function(_0x40aafe){logger[_0x56f4('0x2a')](_0x40aafe['stack']);if(_0x40aafe[_0x56f4('0x2b')]){delete _0x40aafe[_0x56f4('0x2b')];}_0x8971e8[_0x56f4('0x1c')](_0x4a549a)['send'](_0x40aafe);};}exports['index']=function(_0x21d272,_0x24f812){var _0x181c9f={},_0x180244={},_0x49bdf7={'count':0x0,'rows':[]};var _0x236cbd=_[_0x56f4('0x2c')](db[_0x56f4('0x2d')][_0x56f4('0x2e')],function(_0x42e1c0){return{'name':_0x42e1c0[_0x56f4('0x2f')],'type':_0x42e1c0[_0x56f4('0x30')][_0x56f4('0x31')]};});_0x180244[_0x56f4('0x32')]=_[_0x56f4('0x2c')](_0x236cbd,_0x56f4('0x2b'));_0x180244[_0x56f4('0x33')]=_[_0x56f4('0x34')](_0x21d272[_0x56f4('0x33')]);_0x180244[_0x56f4('0x35')]=_[_0x56f4('0x36')](_0x180244['model'],_0x180244[_0x56f4('0x33')]);_0x181c9f[_0x56f4('0x37')]=_['intersection'](_0x180244[_0x56f4('0x32')],qs['fields'](_0x21d272['query'][_0x56f4('0x38')]));_0x181c9f[_0x56f4('0x37')]=_0x181c9f[_0x56f4('0x37')][_0x56f4('0x39')]?_0x181c9f[_0x56f4('0x37')]:_0x180244[_0x56f4('0x32')];if(!_0x21d272['query'][_0x56f4('0x3a')](_0x56f4('0x3b'))){_0x181c9f['limit']=qs[_0x56f4('0x20')](_0x21d272[_0x56f4('0x33')]['limit']);_0x181c9f['offset']=qs[_0x56f4('0x1e')](_0x21d272['query'][_0x56f4('0x1e')]);}_0x181c9f['order']=qs[_0x56f4('0x3c')](_0x21d272['query']['sort']);_0x181c9f['where']=qs['filters'](_[_0x56f4('0x3d')](_0x21d272[_0x56f4('0x33')],_0x180244[_0x56f4('0x35')]),_0x236cbd);if(_0x21d272[_0x56f4('0x33')][_0x56f4('0x3e')]){_0x181c9f['where']=_[_0x56f4('0x3f')](_0x181c9f[_0x56f4('0x40')],{'$or':_[_0x56f4('0x2c')](_0x236cbd,function(_0x1a8971){if(_0x1a8971[_0x56f4('0x30')]!==_0x56f4('0x41')){var _0x59f431={};_0x59f431[_0x1a8971[_0x56f4('0x2b')]]={'$like':'%'+_0x21d272[_0x56f4('0x33')][_0x56f4('0x3e')]+'%'};return _0x59f431;}})});}_0x181c9f=_[_0x56f4('0x3f')]({},_0x181c9f,_0x21d272[_0x56f4('0x42')]);var _0x2071a2={'where':_0x181c9f[_0x56f4('0x40')]};return db[_0x56f4('0x2d')][_0x56f4('0x21')](_0x2071a2)['then'](function(_0x2ffd52){_0x49bdf7[_0x56f4('0x21')]=_0x2ffd52;if(_0x21d272['query'][_0x56f4('0x43')]){_0x181c9f[_0x56f4('0x44')]=[{'all':!![]}];}return db[_0x56f4('0x2d')][_0x56f4('0x45')](_0x181c9f);})[_0x56f4('0x28')](function(_0x387f27){_0x49bdf7['rows']=_0x387f27;return _0x49bdf7;})['then'](respondWithFilteredResult(_0x24f812,_0x181c9f))[_0x56f4('0x46')](handleError(_0x24f812,null));};exports[_0x56f4('0x47')]=function(_0x461024,_0x5d7414){var _0x398bb7={'raw':![],'where':{'id':_0x461024[_0x56f4('0x48')]['id']}},_0x24b1a1={};_0x24b1a1['model']=_[_0x56f4('0x34')](db[_0x56f4('0x2d')]['rawAttributes']);_0x24b1a1[_0x56f4('0x33')]=_[_0x56f4('0x34')](_0x461024[_0x56f4('0x33')]);_0x24b1a1['filters']=_[_0x56f4('0x36')](_0x24b1a1[_0x56f4('0x32')],_0x24b1a1[_0x56f4('0x33')]);_0x398bb7[_0x56f4('0x37')]=_[_0x56f4('0x36')](_0x24b1a1[_0x56f4('0x32')],qs[_0x56f4('0x38')](_0x461024[_0x56f4('0x33')]['fields']));_0x398bb7['attributes']=_0x398bb7[_0x56f4('0x37')]['length']?_0x398bb7[_0x56f4('0x37')]:_0x24b1a1[_0x56f4('0x32')];if(_0x461024[_0x56f4('0x33')][_0x56f4('0x43')]){_0x398bb7['include']=[{'all':!![]}];}_0x398bb7=_['merge']({},_0x398bb7,_0x461024[_0x56f4('0x42')]);return db[_0x56f4('0x2d')][_0x56f4('0x49')](_0x398bb7)[_0x56f4('0x28')](handleEntityNotFound(_0x5d7414,null))[_0x56f4('0x28')](respondWithResult(_0x5d7414,null))[_0x56f4('0x46')](handleError(_0x5d7414,null));};exports['create']=function(_0x16abc9,_0x4bf979){return db[_0x56f4('0x2d')][_0x56f4('0x4a')](_0x16abc9[_0x56f4('0x4b')],{})[_0x56f4('0x28')](respondWithResult(_0x4bf979,0xc9))[_0x56f4('0x46')](handleError(_0x4bf979,null));};exports[_0x56f4('0x27')]=function(_0x1f44fe,_0x242687){if(_0x1f44fe[_0x56f4('0x4b')]['id']){delete _0x1f44fe[_0x56f4('0x4b')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x1f44fe[_0x56f4('0x48')]['id']}})[_0x56f4('0x28')](handleEntityNotFound(_0x242687,null))[_0x56f4('0x28')](saveUpdates(_0x1f44fe[_0x56f4('0x4b')],null))['then'](respondWithResult(_0x242687,null))[_0x56f4('0x46')](handleError(_0x242687,null));};exports[_0x56f4('0x29')]=function(_0x24c699,_0x574366){return db['VtigerAccount'][_0x56f4('0x49')]({'where':{'id':_0x24c699[_0x56f4('0x48')]['id']}})[_0x56f4('0x28')](handleEntityNotFound(_0x574366,null))['then'](removeEntity(_0x574366,null))[_0x56f4('0x46')](handleError(_0x574366,null));};exports[_0x56f4('0x4c')]=function(_0x3e9b0a,_0x2f5159,_0x2543bd){var _0x461d6f={};var _0x100ff8={};var _0x400c56;var _0x3ab06a;return db[_0x56f4('0x2d')][_0x56f4('0x4d')]({'where':{'id':_0x3e9b0a['params']['id']}})[_0x56f4('0x28')](handleEntityNotFound(_0x2f5159,null))[_0x56f4('0x28')](function(_0x188dbe){if(_0x188dbe){_0x400c56=_0x188dbe;_0x100ff8[_0x56f4('0x32')]=_[_0x56f4('0x34')](db[_0x56f4('0x4e')][_0x56f4('0x2e')]);_0x100ff8[_0x56f4('0x33')]=_[_0x56f4('0x34')](_0x3e9b0a[_0x56f4('0x33')]);_0x100ff8[_0x56f4('0x35')]=_[_0x56f4('0x36')](_0x100ff8[_0x56f4('0x32')],_0x100ff8[_0x56f4('0x33')]);_0x461d6f[_0x56f4('0x37')]=_[_0x56f4('0x36')](_0x100ff8[_0x56f4('0x32')],qs['fields'](_0x3e9b0a[_0x56f4('0x33')][_0x56f4('0x38')]));_0x461d6f[_0x56f4('0x37')]=_0x461d6f[_0x56f4('0x37')][_0x56f4('0x39')]?_0x461d6f[_0x56f4('0x37')]:_0x100ff8[_0x56f4('0x32')];_0x461d6f[_0x56f4('0x4f')]=qs[_0x56f4('0x3c')](_0x3e9b0a['query'][_0x56f4('0x3c')]);_0x461d6f[_0x56f4('0x40')]=qs[_0x56f4('0x35')](_[_0x56f4('0x3d')](_0x3e9b0a[_0x56f4('0x33')],_0x100ff8[_0x56f4('0x35')]));if(_0x3e9b0a[_0x56f4('0x33')][_0x56f4('0x3e')]){_0x461d6f[_0x56f4('0x40')]=_['merge'](_0x461d6f[_0x56f4('0x40')],{'$or':_['map'](_0x461d6f['attributes'],function(_0xe6cd3c){var _0x1efbfd={};_0x1efbfd[_0xe6cd3c]={'$like':'%'+_0x3e9b0a['query'][_0x56f4('0x3e')]+'%'};return _0x1efbfd;})});}_0x461d6f=_[_0x56f4('0x3f')]({},_0x461d6f,_0x3e9b0a[_0x56f4('0x42')]);return _0x400c56['getConfigurations'](_0x461d6f);}})[_0x56f4('0x28')](function(_0x1d0367){if(_0x1d0367){_0x3ab06a=_0x1d0367[_0x56f4('0x39')];if(!_0x3e9b0a['query'][_0x56f4('0x3a')]('nolimit')){_0x461d6f[_0x56f4('0x20')]=qs[_0x56f4('0x20')](_0x3e9b0a[_0x56f4('0x33')][_0x56f4('0x20')]);_0x461d6f['offset']=qs[_0x56f4('0x1e')](_0x3e9b0a[_0x56f4('0x33')][_0x56f4('0x1e')]);}return _0x400c56[_0x56f4('0x4c')](_0x461d6f);}})[_0x56f4('0x28')](function(_0x1ec03e){if(_0x1ec03e){return _0x1ec03e?{'count':_0x3ab06a,'rows':_0x1ec03e}:null;}})['then'](respondWithResult(_0x2f5159,null))[_0x56f4('0x46')](handleError(_0x2f5159,null));};exports[_0x56f4('0x50')]=function(_0x2ecd1c,_0x386d3e,_0x48b6fa){if(_0x2ecd1c[_0x56f4('0x4b')]['id']){delete _0x2ecd1c[_0x56f4('0x4b')]['id'];}return db[_0x56f4('0x2d')][_0x56f4('0x4d')]({'where':{'id':_0x2ecd1c['params']['id']}})[_0x56f4('0x28')](handleEntityNotFound(_0x386d3e,null))[_0x56f4('0x28')](function(_0x6fa737){if(_0x6fa737){_0x2ecd1c[_0x56f4('0x4b')]['AccountId']=_0x6fa737['id'];_0x2ecd1c['body'][_0x56f4('0x51')]=integrations[_0x56f4('0x52')](_0x2ecd1c['body'][_0x56f4('0x53')],_0x2ecd1c[_0x56f4('0x4b')]['type']);_0x2ecd1c[_0x56f4('0x4b')]['Descriptions']=integrations[_0x56f4('0x54')](_0x2ecd1c['body'][_0x56f4('0x53')],_0x2ecd1c[_0x56f4('0x4b')][_0x56f4('0x30')]);return db[_0x56f4('0x4e')][_0x56f4('0x4a')](_0x2ecd1c[_0x56f4('0x4b')],{'include':[{'model':db['VtigerField'],'as':_0x56f4('0x51')},{'model':db['VtigerField'],'as':_0x56f4('0x55')}]});}return null;})['then'](respondWithResult(_0x386d3e,null))[_0x56f4('0x46')](handleError(_0x386d3e,null));};var md5=require(_0x56f4('0x56'));exports[_0x56f4('0x57')]=function(_0x29b40b,_0x364ccd,_0x463fcd){var _0x26dd9e=null;var _0x3dceaa=null;var _0x5687a7=null;var _0x1f5367=null;var _0x1b4810='';return db[_0x56f4('0x2d')][_0x56f4('0x4d')]({'where':{'id':_0x29b40b['params']['id']},'attributes':['id',_0x56f4('0x2b'),_0x56f4('0x58'),_0x56f4('0x59'),_0x56f4('0x5a'),_0x56f4('0x5b'),_0x56f4('0x5c'),_0x56f4('0x5d')]})['then'](handleEntityNotFound(_0x364ccd,null))[_0x56f4('0x28')](function(_0x2ad3cd){if(_0x2ad3cd){_0x26dd9e=_0x2ad3cd[_0x56f4('0x58')];_0x3dceaa=_0x2ad3cd[_0x56f4('0x5d')];_0x5687a7=_0x2ad3cd[_0x56f4('0x5a')];_0x1b4810=_0x2ad3cd[_0x56f4('0x5b')];var _0x2ac6b7=_0x1b4810[_0x56f4('0x5e')](-0x1);if(_0x2ac6b7==='/'){_0x1b4810=_0x1b4810[_0x56f4('0x5f')](0x0,_0x1b4810[_0x56f4('0x60')](_0x2ac6b7));}_0x1f5367=util[_0x56f4('0x61')](_0x56f4('0x62'),_0x1b4810);var _0x4d759f={'method':_0x56f4('0x63'),'uri':_0x1f5367,'qs':{'operation':_0x56f4('0x64'),'username':_0x2ad3cd[_0x56f4('0x58')]},'json':!![]};return rp(_0x4d759f);}})[_0x56f4('0x28')](function(_0x434618){if(_0x434618[_0x56f4('0x65')]){var _0x58cd8a={'method':'POST','uri':_0x1f5367,'form':{'operation':'login','username':_0x26dd9e,'accessKey':md5(_0x434618[_0x56f4('0x66')][_0x56f4('0x67')]+_0x3dceaa)},'json':!![]};return rp(_0x58cd8a);}})[_0x56f4('0x28')](function(_0x54cf8c){if(_0x54cf8c['success']){var _0x2da6d6={'method':_0x56f4('0x63'),'uri':_0x1f5367,'qs':{'operation':_0x56f4('0x68'),'username':_0x26dd9e,'sessionName':_0x54cf8c[_0x56f4('0x66')][_0x56f4('0x69')],'elementType':_0x5687a7},'json':!![]};return rp(_0x2da6d6);}})['then'](function(_0x36370f){if(_0x36370f[_0x56f4('0x65')]){var _0x12210c=['autogenerated',_0x56f4('0x6a'),_0x56f4('0x6b')];_[_0x56f4('0x6c')](_0x36370f[_0x56f4('0x66')][_0x56f4('0x38')],function(_0x2a5816){return _0x12210c['includes'](_0x2a5816[_0x56f4('0x30')][_0x56f4('0x2b')]);});_['remove'](_0x36370f[_0x56f4('0x66')][_0x56f4('0x38')],function(_0x469fd6){return _0x469fd6['editable']===_0x56f4('0x6d');});return{'count':_0x36370f[_0x56f4('0x66')][_0x56f4('0x38')]['length'],'rows':_[_0x56f4('0x2c')](_0x36370f['result'][_0x56f4('0x38')],function(_0x4e9d49){return{'id':_0x4e9d49[_0x56f4('0x2b')],'name':_0x4e9d49[_0x56f4('0x6e')],'custom':_['startsWith'](_0x4e9d49[_0x56f4('0x2b')],_0x56f4('0x6f'))?!![]:![],'options':_0x4e9d49[_0x56f4('0x30')][_0x56f4('0x2b')]==='picklist'&&_0x4e9d49[_0x56f4('0x30')][_0x56f4('0x70')][_0x56f4('0x39')]>0x0?_[_0x56f4('0x2c')](_0x4e9d49['type'][_0x56f4('0x70')],function(_0x261f27){return{'name':_0x261f27[_0x56f4('0x6e')],'value':_0x261f27[_0x56f4('0x71')]};}):[]};})};}})[_0x56f4('0x28')](respondWithResult(_0x364ccd,null))[_0x56f4('0x46')](function(_0x7d2765){console[_0x56f4('0x72')](_0x56f4('0x73')+_0x7d2765);var _0x2e0aff=_0x29b40b[_0x56f4('0x33')][_0x56f4('0x74')]?0x1f4:_0x7d2765[_0x56f4('0x75')]||0x1f4;logger[_0x56f4('0x2a')](_0x56f4('0x76'),_0x56f4('0x57'),_0x2e0aff,JSON[_0x56f4('0x77')](_0x7d2765));delete _0x7d2765[_0x56f4('0x2b')];if(_0x2e0aff===0x191){_0x2e0aff=0x190;}_0x364ccd[_0x56f4('0x1c')](_0x2e0aff)[_0x56f4('0x78')](_0x29b40b[_0x56f4('0x33')][_0x56f4('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x7d2765[_0x56f4('0x75')]}:_0x7d2765);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f939a51..72e5f78 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 _0x207e=['../../components/integrations/configuration','exports','define','VtigerAccount','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x52ba3d,_0x3ce09c){var _0x968ee9=function(_0x40f53b){while(--_0x40f53b){_0x52ba3d['push'](_0x52ba3d['shift']());}};_0x968ee9(++_0x3ce09c);}(_0x207e,0x12f));var _0xe207=function(_0x183e70,_0xc78a11){_0x183e70=_0x183e70-0x0;var _0x3a86a0=_0x207e[_0x183e70];return _0x3a86a0;};'use strict';var _=require('lodash');var util=require(_0xe207('0x0'));var logger=require(_0xe207('0x1'))(_0xe207('0x2'));var moment=require(_0xe207('0x3'));var BPromise=require(_0xe207('0x4'));var rp=require(_0xe207('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe207('0x6'));var config=require(_0xe207('0x7'));var attributes=require(_0xe207('0x8'));var integrations=require(_0xe207('0x9'));module[_0xe207('0xa')]=function(_0x1fba76,_0x2df909){return _0x1fba76[_0xe207('0xb')](_0xe207('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bea=['bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','util','../../config/logger','moment'];(function(_0x54de8e,_0x2c7347){var _0x1e45f6=function(_0x4267ab){while(--_0x4267ab){_0x54de8e['push'](_0x54de8e['shift']());}};_0x1e45f6(++_0x2c7347);}(_0x5bea,0x141));var _0xa5be=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5bea[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0xa5be('0x0'));var logger=require(_0xa5be('0x1'))('api');var moment=require(_0xa5be('0x2'));var BPromise=require(_0xa5be('0x3'));var rp=require(_0xa5be('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5be('0x5'));var config=require(_0xa5be('0x6'));var attributes=require(_0xa5be('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa5be('0x8')]=function(_0x45c013,_0x2cdab3){return _0x45c013['define']('VtigerAccount',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 1c37441..82e6dcc 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 _0x63a5=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','raw','options','where','attributes','limit','include','map','model','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0xd07878,_0x5c6aa9){var _0x317960=function(_0x3746d0){while(--_0x3746d0){_0xd07878['push'](_0xd07878['shift']());}};_0x317960(++_0x5c6aa9);}(_0x63a5,0x18e));var _0x563a=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x63a5[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2662f7,_0x4f89b4,_0x4d71a0){return new BPromise(function(_0x543920,_0xff1f59){return client[_0x563a('0x9')](_0x2662f7,_0x4d71a0)[_0x563a('0xa')](function(_0x606235){logger[_0x563a('0xb')](_0x563a('0xc'),_0x4f89b4,_0x563a('0xd'));logger[_0x563a('0xe')](_0x563a('0xf'),_0x4f89b4,_0x563a('0xd'),JSON[_0x563a('0x10')](_0x606235));if(_0x606235[_0x563a('0x11')]){if(_0x606235[_0x563a('0x11')][_0x563a('0x12')]===0x1f4){logger['error'](_0x563a('0xc'),_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0xff1f59(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}logger[_0x563a('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0x543920(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}else{logger['info']('VtigerAccount,\x20%s,\x20%s',_0x4f89b4,_0x563a('0xd'));_0x543920(_0x606235[_0x563a('0x14')]['message']);}})[_0x563a('0x15')](function(_0x43fb16){logger[_0x563a('0x11')](_0x563a('0xc'),_0x4f89b4,_0x43fb16);_0xff1f59(_0x43fb16);});});}exports['GetVtigerAccount']=function(_0x598693){var _0xe3d2bd=this;return new Promise(function(_0x422aaf,_0x54a3b4){return db['VtigerAccount']['findAll']({'raw':_0x598693['options']?_0x598693['options'][_0x563a('0x16')]===undefined?!![]:![]:!![],'where':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x18')]||null:null,'attributes':_0x598693['options']?_0x598693['options'][_0x563a('0x19')]||null:null,'limit':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x1a')]||null:null,'include':_0x598693[_0x563a('0x17')]?_0x598693[_0x563a('0x17')][_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x598693['options'][_0x563a('0x1b')],function(_0x5422f6){return{'model':db[_0x5422f6[_0x563a('0x1d')]],'as':_0x5422f6['as'],'attributes':_0x5422f6[_0x563a('0x19')],'include':_0x5422f6[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x5422f6[_0x563a('0x1b')],function(_0x1682ee){return{'model':db[_0x1682ee[_0x563a('0x1d')]],'as':_0x1682ee['as'],'attributes':_0x1682ee[_0x563a('0x19')],'include':_0x1682ee['include']?_[_0x563a('0x1c')](_0x1682ee[_0x563a('0x1b')],function(_0x2311f2){return{'model':db[_0x2311f2[_0x563a('0x1d')]],'as':_0x2311f2['as'],'attributes':_0x2311f2[_0x563a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x563a('0xa')](function(_0x1afdff){logger[_0x563a('0xb')](_0x563a('0x1e'),_0x598693);logger[_0x563a('0xe')](_0x563a('0x1e'),_0x598693,JSON[_0x563a('0x10')](_0x1afdff));_0x422aaf(_0x1afdff);})[_0x563a('0x15')](function(_0x7696c2){logger['error'](_0x563a('0x1e'),_0x7696c2[_0x563a('0x13')],_0x598693);_0x54a3b4(_0xe3d2bd[_0x563a('0x11')](0x1f4,_0x7696c2['message']));});});};exports[_0x563a('0x1f')]=function(_0x2e5c4b){var _0x3a59cb=this;return new Promise(function(_0x28a8f6,_0x166f89){return db[_0x563a('0x20')][_0x563a('0x21')]({'raw':_0x2e5c4b['options']?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x16')]===undefined?!![]:![]:!![],'where':_0x2e5c4b[_0x563a('0x17')]?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x18')]||null:null,'attributes':_0x2e5c4b['options']?_0x2e5c4b['options']['attributes']||null:null,'include':_0x2e5c4b['options']?_0x2e5c4b[_0x563a('0x17')][_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x2e5c4b[_0x563a('0x17')][_0x563a('0x1b')],function(_0x3dc83a){return{'model':db[_0x3dc83a['model']],'as':_0x3dc83a['as'],'attributes':_0x3dc83a['attributes'],'include':_0x3dc83a[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x3dc83a[_0x563a('0x1b')],function(_0x3a3423){return{'model':db[_0x3a3423[_0x563a('0x1d')]],'as':_0x3a3423['as'],'attributes':_0x3a3423[_0x563a('0x19')],'include':_0x3a3423[_0x563a('0x1b')]?_[_0x563a('0x1c')](_0x3a3423[_0x563a('0x1b')],function(_0x4d98be){return{'model':db[_0x4d98be[_0x563a('0x1d')]],'as':_0x4d98be['as'],'attributes':_0x4d98be[_0x563a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x563a('0xa')](function(_0xa334b7){logger[_0x563a('0xb')](_0x563a('0x1f'),_0x2e5c4b);logger['debug'](_0x563a('0x1f'),_0x2e5c4b,JSON[_0x563a('0x10')](_0xa334b7));_0x28a8f6(_0xa334b7);})[_0x563a('0x15')](function(_0x5abfe4){logger[_0x563a('0x11')]('ShowVtigerAccount',_0x5abfe4[_0x563a('0x13')],_0x2e5c4b);_0x166f89(_0x3a59cb[_0x563a('0x11')](0x1f4,_0x5abfe4['message']));});});}; \ No newline at end of file +var _0x76dc=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowVtigerAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','info','request\x20sent'];(function(_0x253389,_0x594791){var _0x489657=function(_0x4df533){while(--_0x4df533){_0x253389['push'](_0x253389['shift']());}};_0x489657(++_0x594791);}(_0x76dc,0x1f2));var _0xc76d=function(_0x5c8168,_0xe7325e){_0x5c8168=_0x5c8168-0x0;var _0x53079b=_0x76dc[_0x5c8168];return _0x53079b;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var moment=require(_0xc76d('0x2'));var BPromise=require(_0xc76d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc76d('0x4'));var db=require(_0xc76d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc76d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc76d('0x7'));var client=jayson[_0xc76d('0x8')][_0xc76d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4832bd,_0x4ce0bd,_0x119f38){return new BPromise(function(_0x114572,_0x18574f){return client['request'](_0x4832bd,_0x119f38)['then'](function(_0x1dc996){logger[_0xc76d('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4ce0bd,_0xc76d('0xb'));logger['debug'](_0xc76d('0xc'),_0x4ce0bd,_0xc76d('0xb'),JSON[_0xc76d('0xd')](_0x1dc996));if(_0x1dc996[_0xc76d('0xe')]){if(_0x1dc996[_0xc76d('0xe')][_0xc76d('0xf')]===0x1f4){logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);return _0x18574f(_0x1dc996[_0xc76d('0xe')][_0xc76d('0x11')]);}logger[_0xc76d('0xe')](_0xc76d('0x10'),_0x4ce0bd,_0x1dc996['error'][_0xc76d('0x11')]);return _0x114572(_0x1dc996[_0xc76d('0xe')]['message']);}else{logger[_0xc76d('0xa')](_0xc76d('0x10'),_0x4ce0bd,_0xc76d('0xb'));_0x114572(_0x1dc996[_0xc76d('0x12')]['message']);}})[_0xc76d('0x13')](function(_0x5d881c){logger['error'](_0xc76d('0x10'),_0x4ce0bd,_0x5d881c);_0x18574f(_0x5d881c);});});}exports[_0xc76d('0x14')]=function(_0x339623){var _0x23f3ca=this;return new Promise(function(_0xd1d16f,_0x4b0402){return db[_0xc76d('0x15')][_0xc76d('0x16')]({'raw':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x18')]===undefined?!![]:![]:!![],'where':_0x339623['options']?_0x339623[_0xc76d('0x17')][_0xc76d('0x19')]||null:null,'attributes':_0x339623['options']?_0x339623[_0xc76d('0x17')][_0xc76d('0x1a')]||null:null,'limit':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x1b')]||null:null,'include':_0x339623[_0xc76d('0x17')]?_0x339623[_0xc76d('0x17')][_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x339623[_0xc76d('0x17')][_0xc76d('0x1c')],function(_0x5de11f){return{'model':db[_0x5de11f[_0xc76d('0x1e')]],'as':_0x5de11f['as'],'attributes':_0x5de11f[_0xc76d('0x1a')],'include':_0x5de11f['include']?_[_0xc76d('0x1d')](_0x5de11f[_0xc76d('0x1c')],function(_0x55ca79){return{'model':db[_0x55ca79[_0xc76d('0x1e')]],'as':_0x55ca79['as'],'attributes':_0x55ca79[_0xc76d('0x1a')],'include':_0x55ca79[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x55ca79[_0xc76d('0x1c')],function(_0x1949c4){return{'model':db[_0x1949c4[_0xc76d('0x1e')]],'as':_0x1949c4['as'],'attributes':_0x1949c4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x285430){logger[_0xc76d('0xa')]('GetVtigerAccount',_0x339623);logger[_0xc76d('0x1f')](_0xc76d('0x14'),_0x339623,JSON[_0xc76d('0xd')](_0x285430));_0xd1d16f(_0x285430);})['catch'](function(_0x2039f4){logger['error'](_0xc76d('0x14'),_0x2039f4[_0xc76d('0x11')],_0x339623);_0x4b0402(_0x23f3ca['error'](0x1f4,_0x2039f4[_0xc76d('0x11')]));});});};exports[_0xc76d('0x20')]=function(_0x9ab96c){var _0x2cf501=this;return new Promise(function(_0x4feeda,_0x283e16){return db['VtigerAccount'][_0xc76d('0x21')]({'raw':_0x9ab96c['options']?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x18')]===undefined?!![]:![]:!![],'where':_0x9ab96c['options']?_0x9ab96c['options']['where']||null:null,'attributes':_0x9ab96c['options']?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x1a')]||null:null,'include':_0x9ab96c[_0xc76d('0x17')]?_0x9ab96c[_0xc76d('0x17')][_0xc76d('0x1c')]?_['map'](_0x9ab96c[_0xc76d('0x17')]['include'],function(_0x854920){return{'model':db[_0x854920['model']],'as':_0x854920['as'],'attributes':_0x854920[_0xc76d('0x1a')],'include':_0x854920[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x854920[_0xc76d('0x1c')],function(_0x2aa24d){return{'model':db[_0x2aa24d['model']],'as':_0x2aa24d['as'],'attributes':_0x2aa24d[_0xc76d('0x1a')],'include':_0x2aa24d[_0xc76d('0x1c')]?_[_0xc76d('0x1d')](_0x2aa24d['include'],function(_0x2f69c1){return{'model':db[_0x2f69c1[_0xc76d('0x1e')]],'as':_0x2f69c1['as'],'attributes':_0x2f69c1[_0xc76d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9cbf1e){logger[_0xc76d('0xa')](_0xc76d('0x20'),_0x9ab96c);logger[_0xc76d('0x1f')](_0xc76d('0x20'),_0x9ab96c,JSON[_0xc76d('0xd')](_0x9cbf1e));_0x4feeda(_0x9cbf1e);})['catch'](function(_0x518945){logger[_0xc76d('0xe')]('ShowVtigerAccount',_0x518945[_0xc76d('0x11')],_0x9ab96c);_0x283e16(_0x2cf501[_0xc76d('0xe')](0x1f4,_0x518945[_0xc76d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index badc9f0..4df168d 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 _0x92a7=['/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index'];(function(_0x1792fe,_0x46b85a){var _0x46d71e=function(_0x747001){while(--_0x747001){_0x1792fe['push'](_0x1792fe['shift']());}};_0x46d71e(++_0x46b85a);}(_0x92a7,0x153));var _0x792a=function(_0x2209ea,_0x15c2d2){_0x2209ea=_0x2209ea-0x0;var _0x1ef229=_0x92a7[_0x2209ea];return _0x1ef229;};'use strict';var multer=require(_0x792a('0x0'));var util=require(_0x792a('0x1'));var path=require(_0x792a('0x2'));var timeout=require(_0x792a('0x3'));var express=require(_0x792a('0x4'));var router=express['Router']();var fs_extra=require(_0x792a('0x5'));var auth=require(_0x792a('0x6'));var interaction=require(_0x792a('0x7'));var config=require(_0x792a('0x8'));var controller=require(_0x792a('0x9'));router['get']('/',auth[_0x792a('0xa')](),controller[_0x792a('0xb')]);router['get'](_0x792a('0xc'),auth['isAuthenticated'](),controller[_0x792a('0xd')]);router[_0x792a('0xe')](_0x792a('0xf'),auth[_0x792a('0xa')](),controller[_0x792a('0x10')]);router['get'](_0x792a('0x11'),auth[_0x792a('0xa')](),controller[_0x792a('0x12')]);router['get'](_0x792a('0x13'),auth[_0x792a('0xa')](),controller[_0x792a('0x14')]);router[_0x792a('0x15')]('/',auth[_0x792a('0xa')](),controller[_0x792a('0x16')]);router[_0x792a('0x17')](_0x792a('0xc'),auth[_0x792a('0xa')](),controller[_0x792a('0x18')]);router[_0x792a('0x19')](_0x792a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x792a('0x1a')]=router; \ No newline at end of file +var _0x1e93=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects','post','put'];(function(_0x55bb5c,_0x7e8b57){var _0x4de204=function(_0x9c4a8c){while(--_0x9c4a8c){_0x55bb5c['push'](_0x55bb5c['shift']());}};_0x4de204(++_0x7e8b57);}(_0x1e93,0x1e4));var _0x31e9=function(_0x104596,_0x50e630){_0x104596=_0x104596-0x0;var _0x148413=_0x1e93[_0x104596];return _0x148413;};'use strict';var multer=require(_0x31e9('0x0'));var util=require(_0x31e9('0x1'));var path=require(_0x31e9('0x2'));var timeout=require(_0x31e9('0x3'));var express=require(_0x31e9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x31e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31e9('0x6'));var controller=require(_0x31e9('0x7'));router[_0x31e9('0x8')]('/',auth[_0x31e9('0x9')](),controller['index']);router[_0x31e9('0x8')](_0x31e9('0xa'),auth['isAuthenticated'](),controller[_0x31e9('0xb')]);router[_0x31e9('0x8')]('/:id/fields',auth[_0x31e9('0x9')](),controller[_0x31e9('0xc')]);router[_0x31e9('0x8')](_0x31e9('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x31e9('0x8')]('/:id/descriptions',auth[_0x31e9('0x9')](),controller['getDescriptions']);router[_0x31e9('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x31e9('0xf')](_0x31e9('0xa'),auth[_0x31e9('0x9')](),controller[_0x31e9('0x10')]);router[_0x31e9('0x11')](_0x31e9('0xa'),auth[_0x31e9('0x9')](),controller[_0x31e9('0x12')]);module[_0x31e9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 31333fb..6f55368 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 _0x9e46=['STRING','sequelize','exports'];(function(_0x48ad4e,_0x2b0e9f){var _0x505b15=function(_0x513e70){while(--_0x513e70){_0x48ad4e['push'](_0x48ad4e['shift']());}};_0x505b15(++_0x2b0e9f);}(_0x9e46,0x16c));var _0x69e4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9e46[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x69e4('0x0'));module[_0x69e4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x69e4('0x2')]}}; \ No newline at end of file +var _0x89b8=['exports','STRING','sequelize'];(function(_0x39ea8b,_0x581de6){var _0x14b2bd=function(_0x239da9){while(--_0x239da9){_0x39ea8b['push'](_0x39ea8b['shift']());}};_0x14b2bd(++_0x581de6);}(_0x89b8,0xe6));var _0x889b=function(_0x705834,_0xe005b){_0x705834=_0x705834-0x0;var _0x38b1d6=_0x89b8[_0x705834];return _0x38b1d6;};'use strict';var Sequelize=require(_0x889b('0x0'));module[_0x889b('0x1')]={'name':{'type':Sequelize[_0x889b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 7525ade..62ac032 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 _0xb6cb=['filter','options','includeAll','include','rows','catch','params','length','find','create','body','getFields','VtigerField','order','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../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','apply','reject','save','update','then','destroy','error','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','where','merge','VIRTUAL'];(function(_0x1d0c7a,_0x39d7a8){var _0x3edec4=function(_0x3a97c4){while(--_0x3a97c4){_0x1d0c7a['push'](_0x1d0c7a['shift']());}};_0x3edec4(++_0x39d7a8);}(_0xb6cb,0x152));var _0xbb6c=function(_0x1b5d5f,_0x5ed766){_0x1b5d5f=_0x1b5d5f-0x0;var _0x3c9347=_0xb6cb[_0x1b5d5f];return _0x3c9347;};'use strict';var emlformat=require(_0xbb6c('0x0'));var rimraf=require(_0xbb6c('0x1'));var zipdir=require(_0xbb6c('0x2'));var jsonpatch=require(_0xbb6c('0x3'));var rp=require(_0xbb6c('0x4'));var moment=require(_0xbb6c('0x5'));var BPromise=require(_0xbb6c('0x6'));var Mustache=require('mustache');var util=require(_0xbb6c('0x7'));var path=require(_0xbb6c('0x8'));var sox=require('sox');var csv=require(_0xbb6c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb6c('0xa'));var _=require(_0xbb6c('0xb'));var squel=require(_0xbb6c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbb6c('0xd'));var toCsv=require(_0xbb6c('0x9'));var querystring=require(_0xbb6c('0xe'));var Papa=require(_0xbb6c('0xf'));var Redis=require('ioredis');var authService=require(_0xbb6c('0x10'));var qs=require(_0xbb6c('0x11'));var as=require(_0xbb6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb6c('0x13'))(_0xbb6c('0x14'));var utils=require(_0xbb6c('0x15'));var config=require(_0xbb6c('0x16'));var licenseUtil=require(_0xbb6c('0x17'));var db=require(_0xbb6c('0x18'))['db'];function respondWithStatusCode(_0x21177e,_0x156e9d){_0x156e9d=_0x156e9d||0xcc;return function(_0x1bf923){if(_0x1bf923){return _0x21177e[_0xbb6c('0x19')](_0x156e9d);}return _0x21177e[_0xbb6c('0x1a')](_0x156e9d)[_0xbb6c('0x1b')]();};}function respondWithResult(_0x5e7ea7,_0x40981e){_0x40981e=_0x40981e||0xc8;return function(_0x197fc3){if(_0x197fc3){return _0x5e7ea7[_0xbb6c('0x1a')](_0x40981e)[_0xbb6c('0x1c')](_0x197fc3);}};}function respondWithFilteredResult(_0x1aa15b,_0x29dd99){return function(_0x2a560e){if(_0x2a560e){var _0x19e9ac=typeof _0x29dd99[_0xbb6c('0x1d')]===_0xbb6c('0x1e')&&typeof _0x29dd99[_0xbb6c('0x1f')]===_0xbb6c('0x1e');var _0x39c91a=_0x2a560e['count'];var _0x33e347=_0x19e9ac?0x0:_0x29dd99['offset'];var _0x147db9=_0x19e9ac?_0x2a560e[_0xbb6c('0x20')]:_0x29dd99[_0xbb6c('0x1d')]+_0x29dd99['limit'];var _0x3204a6;if(_0x147db9>=_0x39c91a){_0x147db9=_0x39c91a;_0x3204a6=0xc8;}else{_0x3204a6=0xce;}_0x1aa15b[_0xbb6c('0x1a')](_0x3204a6);return _0x1aa15b['set']('Content-Range',_0x33e347+'-'+_0x147db9+'/'+_0x39c91a)['json'](_0x2a560e);}return null;};}function patchUpdates(_0x2dd204){return function(_0x11127c){try{jsonpatch[_0xbb6c('0x21')](_0x11127c,_0x2dd204,!![]);}catch(_0x34e241){return BPromise[_0xbb6c('0x22')](_0x34e241);}return _0x11127c[_0xbb6c('0x23')]();};}function saveUpdates(_0x41895e,_0x5ae8bd){return function(_0x4ccdd4){if(_0x4ccdd4){return _0x4ccdd4[_0xbb6c('0x24')](_0x41895e)[_0xbb6c('0x25')](function(_0x1abe1c){return _0x1abe1c;});}return null;};}function removeEntity(_0xe4f1e2,_0x1e470f){return function(_0x4bd744){if(_0x4bd744){return _0x4bd744[_0xbb6c('0x26')]()['then'](function(){_0xe4f1e2[_0xbb6c('0x1a')](0xcc)[_0xbb6c('0x1b')]();});}};}function handleEntityNotFound(_0x2045a3,_0x402b23){return function(_0x52cd4b){if(!_0x52cd4b){_0x2045a3['sendStatus'](0x194);}return _0x52cd4b;};}function handleError(_0x4361d0,_0x5c3c8c){_0x5c3c8c=_0x5c3c8c||0x1f4;return function(_0x59f0ef){logger[_0xbb6c('0x27')](_0x59f0ef[_0xbb6c('0x28')]);if(_0x59f0ef[_0xbb6c('0x29')]){delete _0x59f0ef['name'];}_0x4361d0[_0xbb6c('0x1a')](_0x5c3c8c)[_0xbb6c('0x2a')](_0x59f0ef);};}exports['index']=function(_0x2f2a97,_0x224460){var _0x4703fa={},_0x41bc0f={},_0x3f95af={'count':0x0,'rows':[]};var _0x1e6543=_['map'](db[_0xbb6c('0x2b')][_0xbb6c('0x2c')],function(_0x16d67b){return{'name':_0x16d67b[_0xbb6c('0x2d')],'type':_0x16d67b[_0xbb6c('0x2e')][_0xbb6c('0x2f')]};});_0x41bc0f['model']=_[_0xbb6c('0x30')](_0x1e6543,_0xbb6c('0x29'));_0x41bc0f[_0xbb6c('0x31')]=_[_0xbb6c('0x32')](_0x2f2a97[_0xbb6c('0x31')]);_0x41bc0f[_0xbb6c('0x33')]=_[_0xbb6c('0x34')](_0x41bc0f[_0xbb6c('0x35')],_0x41bc0f['query']);_0x4703fa[_0xbb6c('0x36')]=_[_0xbb6c('0x34')](_0x41bc0f['model'],qs['fields'](_0x2f2a97[_0xbb6c('0x31')][_0xbb6c('0x37')]));_0x4703fa[_0xbb6c('0x36')]=_0x4703fa[_0xbb6c('0x36')]['length']?_0x4703fa[_0xbb6c('0x36')]:_0x41bc0f['model'];if(!_0x2f2a97[_0xbb6c('0x31')][_0xbb6c('0x38')]('nolimit')){_0x4703fa['limit']=qs['limit'](_0x2f2a97[_0xbb6c('0x31')][_0xbb6c('0x1f')]);_0x4703fa[_0xbb6c('0x1d')]=qs[_0xbb6c('0x1d')](_0x2f2a97['query'][_0xbb6c('0x1d')]);}_0x4703fa['order']=qs[_0xbb6c('0x39')](_0x2f2a97['query'][_0xbb6c('0x39')]);_0x4703fa['where']=qs[_0xbb6c('0x33')](_[_0xbb6c('0x3a')](_0x2f2a97[_0xbb6c('0x31')],_0x41bc0f[_0xbb6c('0x33')]),_0x1e6543);if(_0x2f2a97[_0xbb6c('0x31')]['filter']){_0x4703fa[_0xbb6c('0x3b')]=_[_0xbb6c('0x3c')](_0x4703fa[_0xbb6c('0x3b')],{'$or':_['map'](_0x1e6543,function(_0xa7fc27){if(_0xa7fc27[_0xbb6c('0x2e')]!==_0xbb6c('0x3d')){var _0x5c8ddb={};_0x5c8ddb[_0xa7fc27[_0xbb6c('0x29')]]={'$like':'%'+_0x2f2a97[_0xbb6c('0x31')][_0xbb6c('0x3e')]+'%'};return _0x5c8ddb;}})});}_0x4703fa=_[_0xbb6c('0x3c')]({},_0x4703fa,_0x2f2a97[_0xbb6c('0x3f')]);var _0xd293a={'where':_0x4703fa['where']};return db[_0xbb6c('0x2b')][_0xbb6c('0x20')](_0xd293a)[_0xbb6c('0x25')](function(_0x9572f5){_0x3f95af[_0xbb6c('0x20')]=_0x9572f5;if(_0x2f2a97[_0xbb6c('0x31')][_0xbb6c('0x40')]){_0x4703fa[_0xbb6c('0x41')]=[{'all':!![]}];}return db[_0xbb6c('0x2b')]['findAll'](_0x4703fa);})[_0xbb6c('0x25')](function(_0x134d26){_0x3f95af[_0xbb6c('0x42')]=_0x134d26;return _0x3f95af;})[_0xbb6c('0x25')](respondWithFilteredResult(_0x224460,_0x4703fa))[_0xbb6c('0x43')](handleError(_0x224460,null));};exports['show']=function(_0x550ae7,_0x4d4bdb){var _0x4a0e92={'raw':![],'where':{'id':_0x550ae7[_0xbb6c('0x44')]['id']}},_0x5cd8fd={};_0x5cd8fd['model']=_[_0xbb6c('0x32')](db[_0xbb6c('0x2b')][_0xbb6c('0x2c')]);_0x5cd8fd[_0xbb6c('0x31')]=_['keys'](_0x550ae7['query']);_0x5cd8fd['filters']=_['intersection'](_0x5cd8fd[_0xbb6c('0x35')],_0x5cd8fd[_0xbb6c('0x31')]);_0x4a0e92['attributes']=_[_0xbb6c('0x34')](_0x5cd8fd[_0xbb6c('0x35')],qs[_0xbb6c('0x37')](_0x550ae7[_0xbb6c('0x31')][_0xbb6c('0x37')]));_0x4a0e92[_0xbb6c('0x36')]=_0x4a0e92[_0xbb6c('0x36')][_0xbb6c('0x45')]?_0x4a0e92[_0xbb6c('0x36')]:_0x5cd8fd['model'];if(_0x550ae7[_0xbb6c('0x31')]['includeAll']){_0x4a0e92[_0xbb6c('0x41')]=[{'all':!![]}];}_0x4a0e92=_[_0xbb6c('0x3c')]({},_0x4a0e92,_0x550ae7[_0xbb6c('0x3f')]);return db['VtigerConfiguration'][_0xbb6c('0x46')](_0x4a0e92)[_0xbb6c('0x25')](handleEntityNotFound(_0x4d4bdb,null))[_0xbb6c('0x25')](respondWithResult(_0x4d4bdb,null))[_0xbb6c('0x43')](handleError(_0x4d4bdb,null));};exports[_0xbb6c('0x47')]=function(_0x22ec28,_0x156c26){return db[_0xbb6c('0x2b')]['create'](_0x22ec28[_0xbb6c('0x48')],{})[_0xbb6c('0x25')](respondWithResult(_0x156c26,0xc9))[_0xbb6c('0x43')](handleError(_0x156c26,null));};exports[_0xbb6c('0x24')]=function(_0x5dab7c,_0x389a0a){if(_0x5dab7c[_0xbb6c('0x48')]['id']){delete _0x5dab7c['body']['id'];}return db[_0xbb6c('0x2b')]['find']({'where':{'id':_0x5dab7c[_0xbb6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x389a0a,null))[_0xbb6c('0x25')](saveUpdates(_0x5dab7c[_0xbb6c('0x48')],null))[_0xbb6c('0x25')](respondWithResult(_0x389a0a,null))[_0xbb6c('0x43')](handleError(_0x389a0a,null));};exports[_0xbb6c('0x26')]=function(_0x1020b1,_0x1d2e75){return db[_0xbb6c('0x2b')][_0xbb6c('0x46')]({'where':{'id':_0x1020b1[_0xbb6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d2e75,null))[_0xbb6c('0x25')](removeEntity(_0x1d2e75,null))['catch'](handleError(_0x1d2e75,null));};exports[_0xbb6c('0x49')]=function(_0x4f367b,_0x583ee3,_0x4ecda1){var _0xb16726={};var _0x53a89d={};var _0x541825;var _0x5887f6;return db[_0xbb6c('0x2b')]['findOne']({'where':{'id':_0x4f367b[_0xbb6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x583ee3,null))[_0xbb6c('0x25')](function(_0x13a815){if(_0x13a815){_0x541825=_0x13a815;_0x53a89d[_0xbb6c('0x35')]=_['keys'](db[_0xbb6c('0x4a')][_0xbb6c('0x2c')]);_0x53a89d['query']=_['keys'](_0x4f367b[_0xbb6c('0x31')]);_0x53a89d['filters']=_[_0xbb6c('0x34')](_0x53a89d['model'],_0x53a89d[_0xbb6c('0x31')]);_0xb16726[_0xbb6c('0x36')]=_['intersection'](_0x53a89d[_0xbb6c('0x35')],qs[_0xbb6c('0x37')](_0x4f367b['query']['fields']));_0xb16726[_0xbb6c('0x36')]=_0xb16726[_0xbb6c('0x36')]['length']?_0xb16726[_0xbb6c('0x36')]:_0x53a89d[_0xbb6c('0x35')];_0xb16726[_0xbb6c('0x4b')]=qs[_0xbb6c('0x39')](_0x4f367b[_0xbb6c('0x31')]['sort']);_0xb16726[_0xbb6c('0x3b')]=qs[_0xbb6c('0x33')](_[_0xbb6c('0x3a')](_0x4f367b[_0xbb6c('0x31')],_0x53a89d['filters']));if(_0x4f367b[_0xbb6c('0x31')][_0xbb6c('0x3e')]){_0xb16726['where']=_[_0xbb6c('0x3c')](_0xb16726[_0xbb6c('0x3b')],{'$or':_[_0xbb6c('0x30')](_0xb16726['attributes'],function(_0x509f20){var _0x556b15={};_0x556b15[_0x509f20]={'$like':'%'+_0x4f367b[_0xbb6c('0x31')][_0xbb6c('0x3e')]+'%'};return _0x556b15;})});}_0xb16726=_[_0xbb6c('0x3c')]({},_0xb16726,_0x4f367b[_0xbb6c('0x3f')]);return _0x541825['getFields'](_0xb16726);}})[_0xbb6c('0x25')](function(_0x1b2c0b){if(_0x1b2c0b){_0x5887f6=_0x1b2c0b[_0xbb6c('0x45')];if(!_0x4f367b['query'][_0xbb6c('0x38')]('nolimit')){_0xb16726[_0xbb6c('0x1f')]=qs[_0xbb6c('0x1f')](_0x4f367b[_0xbb6c('0x31')][_0xbb6c('0x1f')]);_0xb16726[_0xbb6c('0x1d')]=qs[_0xbb6c('0x1d')](_0x4f367b[_0xbb6c('0x31')]['offset']);}return _0x541825['getFields'](_0xb16726);}})['then'](function(_0x549be2){if(_0x549be2){return _0x549be2?{'count':_0x5887f6,'rows':_0x549be2}:null;}})[_0xbb6c('0x25')](respondWithResult(_0x583ee3,null))[_0xbb6c('0x43')](handleError(_0x583ee3,null));};exports[_0xbb6c('0x4c')]=function(_0x410e45,_0x1af403,_0x48e572){var _0x58fc31={};var _0x42b1bd={};var _0xaff329;var _0x4355aa;return db[_0xbb6c('0x2b')][_0xbb6c('0x4d')]({'where':{'id':_0x410e45['params']['id']}})[_0xbb6c('0x25')](handleEntityNotFound(_0x1af403,null))[_0xbb6c('0x25')](function(_0x2e879b){if(_0x2e879b){_0xaff329=_0x2e879b;_0x42b1bd[_0xbb6c('0x35')]=_[_0xbb6c('0x32')](db[_0xbb6c('0x4a')][_0xbb6c('0x2c')]);_0x42b1bd[_0xbb6c('0x31')]=_[_0xbb6c('0x32')](_0x410e45[_0xbb6c('0x31')]);_0x42b1bd[_0xbb6c('0x33')]=_[_0xbb6c('0x34')](_0x42b1bd['model'],_0x42b1bd[_0xbb6c('0x31')]);_0x58fc31[_0xbb6c('0x36')]=_['intersection'](_0x42b1bd[_0xbb6c('0x35')],qs[_0xbb6c('0x37')](_0x410e45[_0xbb6c('0x31')][_0xbb6c('0x37')]));_0x58fc31[_0xbb6c('0x36')]=_0x58fc31[_0xbb6c('0x36')][_0xbb6c('0x45')]?_0x58fc31[_0xbb6c('0x36')]:_0x42b1bd[_0xbb6c('0x35')];_0x58fc31['order']=qs[_0xbb6c('0x39')](_0x410e45['query']['sort']);_0x58fc31['where']=qs[_0xbb6c('0x33')](_[_0xbb6c('0x3a')](_0x410e45[_0xbb6c('0x31')],_0x42b1bd['filters']));if(_0x410e45[_0xbb6c('0x31')][_0xbb6c('0x3e')]){_0x58fc31[_0xbb6c('0x3b')]=_['merge'](_0x58fc31[_0xbb6c('0x3b')],{'$or':_[_0xbb6c('0x30')](_0x58fc31[_0xbb6c('0x36')],function(_0x555355){var _0x281ab1={};_0x281ab1[_0x555355]={'$like':'%'+_0x410e45[_0xbb6c('0x31')]['filter']+'%'};return _0x281ab1;})});}_0x58fc31=_[_0xbb6c('0x3c')]({},_0x58fc31,_0x410e45['options']);return _0xaff329['getSubjects'](_0x58fc31);}})[_0xbb6c('0x25')](function(_0x42f893){if(_0x42f893){_0x4355aa=_0x42f893[_0xbb6c('0x45')];if(!_0x410e45['query'][_0xbb6c('0x38')](_0xbb6c('0x4e'))){_0x58fc31[_0xbb6c('0x1f')]=qs['limit'](_0x410e45[_0xbb6c('0x31')][_0xbb6c('0x1f')]);_0x58fc31[_0xbb6c('0x1d')]=qs[_0xbb6c('0x1d')](_0x410e45[_0xbb6c('0x31')][_0xbb6c('0x1d')]);}return _0xaff329[_0xbb6c('0x4c')](_0x58fc31);}})[_0xbb6c('0x25')](function(_0x28bec7){if(_0x28bec7){return _0x28bec7?{'count':_0x4355aa,'rows':_0x28bec7}:null;}})['then'](respondWithResult(_0x1af403,null))[_0xbb6c('0x43')](handleError(_0x1af403,null));};exports[_0xbb6c('0x4f')]=function(_0x2cc191,_0x575fee,_0x50253c){var _0x4bbdc3={};var _0x486a1c={};var _0x156458;var _0x6490de;return db[_0xbb6c('0x2b')][_0xbb6c('0x4d')]({'where':{'id':_0x2cc191[_0xbb6c('0x44')]['id']}})[_0xbb6c('0x25')](handleEntityNotFound(_0x575fee,null))['then'](function(_0x51c67e){if(_0x51c67e){_0x156458=_0x51c67e;_0x486a1c[_0xbb6c('0x35')]=_[_0xbb6c('0x32')](db[_0xbb6c('0x4a')][_0xbb6c('0x2c')]);_0x486a1c[_0xbb6c('0x31')]=_[_0xbb6c('0x32')](_0x2cc191[_0xbb6c('0x31')]);_0x486a1c['filters']=_[_0xbb6c('0x34')](_0x486a1c['model'],_0x486a1c[_0xbb6c('0x31')]);_0x4bbdc3[_0xbb6c('0x36')]=_[_0xbb6c('0x34')](_0x486a1c['model'],qs['fields'](_0x2cc191[_0xbb6c('0x31')][_0xbb6c('0x37')]));_0x4bbdc3[_0xbb6c('0x36')]=_0x4bbdc3[_0xbb6c('0x36')][_0xbb6c('0x45')]?_0x4bbdc3[_0xbb6c('0x36')]:_0x486a1c[_0xbb6c('0x35')];_0x4bbdc3[_0xbb6c('0x4b')]=qs[_0xbb6c('0x39')](_0x2cc191['query'][_0xbb6c('0x39')]);_0x4bbdc3['where']=qs[_0xbb6c('0x33')](_[_0xbb6c('0x3a')](_0x2cc191[_0xbb6c('0x31')],_0x486a1c[_0xbb6c('0x33')]));if(_0x2cc191['query'][_0xbb6c('0x3e')]){_0x4bbdc3[_0xbb6c('0x3b')]=_[_0xbb6c('0x3c')](_0x4bbdc3[_0xbb6c('0x3b')],{'$or':_[_0xbb6c('0x30')](_0x4bbdc3['attributes'],function(_0x2e92c6){var _0x4f4fb1={};_0x4f4fb1[_0x2e92c6]={'$like':'%'+_0x2cc191[_0xbb6c('0x31')]['filter']+'%'};return _0x4f4fb1;})});}_0x4bbdc3=_['merge']({},_0x4bbdc3,_0x2cc191[_0xbb6c('0x3f')]);return _0x156458[_0xbb6c('0x4f')](_0x4bbdc3);}})['then'](function(_0x15c88b){if(_0x15c88b){_0x6490de=_0x15c88b[_0xbb6c('0x45')];if(!_0x2cc191[_0xbb6c('0x31')][_0xbb6c('0x38')](_0xbb6c('0x4e'))){_0x4bbdc3['limit']=qs[_0xbb6c('0x1f')](_0x2cc191[_0xbb6c('0x31')][_0xbb6c('0x1f')]);_0x4bbdc3[_0xbb6c('0x1d')]=qs[_0xbb6c('0x1d')](_0x2cc191[_0xbb6c('0x31')][_0xbb6c('0x1d')]);}return _0x156458[_0xbb6c('0x4f')](_0x4bbdc3);}})[_0xbb6c('0x25')](function(_0x370334){if(_0x370334){return _0x370334?{'count':_0x6490de,'rows':_0x370334}:null;}})['then'](respondWithResult(_0x575fee,null))[_0xbb6c('0x43')](handleError(_0x575fee,null));}; \ No newline at end of file +var _0x159b=['map','VtigerConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','apply','reject','save','update','then','error','name','send'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x159b,0x181));var _0xb159=function(_0x183046,_0x143537){_0x183046=_0x183046-0x0;var _0x513136=_0x159b[_0x183046];return _0x513136;};'use strict';var emlformat=require(_0xb159('0x0'));var rimraf=require(_0xb159('0x1'));var zipdir=require(_0xb159('0x2'));var jsonpatch=require(_0xb159('0x3'));var rp=require(_0xb159('0x4'));var moment=require(_0xb159('0x5'));var BPromise=require(_0xb159('0x6'));var Mustache=require(_0xb159('0x7'));var util=require('util');var path=require(_0xb159('0x8'));var sox=require(_0xb159('0x9'));var csv=require(_0xb159('0xa'));var ejs=require(_0xb159('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb159('0xc'));var squel=require(_0xb159('0xd'));var crypto=require(_0xb159('0xe'));var jsforce=require(_0xb159('0xf'));var deskjs=require(_0xb159('0x10'));var toCsv=require(_0xb159('0xa'));var querystring=require(_0xb159('0x11'));var Papa=require(_0xb159('0x12'));var Redis=require(_0xb159('0x13'));var authService=require(_0xb159('0x14'));var qs=require(_0xb159('0x15'));var as=require(_0xb159('0x16'));var hardwareService=require(_0xb159('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xb159('0x18'));var config=require(_0xb159('0x19'));var licenseUtil=require(_0xb159('0x1a'));var db=require(_0xb159('0x1b'))['db'];function respondWithStatusCode(_0x7bf9ca,_0x28fa46){_0x28fa46=_0x28fa46||0xcc;return function(_0x5cf1be){if(_0x5cf1be){return _0x7bf9ca[_0xb159('0x1c')](_0x28fa46);}return _0x7bf9ca['status'](_0x28fa46)[_0xb159('0x1d')]();};}function respondWithResult(_0x1471fa,_0x5b162a){_0x5b162a=_0x5b162a||0xc8;return function(_0x541a50){if(_0x541a50){return _0x1471fa[_0xb159('0x1e')](_0x5b162a)[_0xb159('0x1f')](_0x541a50);}};}function respondWithFilteredResult(_0x69c5e2,_0x5e755c){return function(_0x31b670){if(_0x31b670){var _0x20bbb8=typeof _0x5e755c['offset']===_0xb159('0x20')&&typeof _0x5e755c[_0xb159('0x21')]==='undefined';var _0x458621=_0x31b670['count'];var _0x331c64=_0x20bbb8?0x0:_0x5e755c[_0xb159('0x22')];var _0x48fa45=_0x20bbb8?_0x31b670['count']:_0x5e755c[_0xb159('0x22')]+_0x5e755c['limit'];var _0x10f211;if(_0x48fa45>=_0x458621){_0x48fa45=_0x458621;_0x10f211=0xc8;}else{_0x10f211=0xce;}_0x69c5e2[_0xb159('0x1e')](_0x10f211);return _0x69c5e2[_0xb159('0x23')](_0xb159('0x24'),_0x331c64+'-'+_0x48fa45+'/'+_0x458621)[_0xb159('0x1f')](_0x31b670);}return null;};}function patchUpdates(_0x3127d9){return function(_0x2affe8){try{jsonpatch[_0xb159('0x25')](_0x2affe8,_0x3127d9,!![]);}catch(_0x43a3c3){return BPromise[_0xb159('0x26')](_0x43a3c3);}return _0x2affe8[_0xb159('0x27')]();};}function saveUpdates(_0x2d6e2c,_0x37c55a){return function(_0x5d6bb9){if(_0x5d6bb9){return _0x5d6bb9[_0xb159('0x28')](_0x2d6e2c)['then'](function(_0x585afd){return _0x585afd;});}return null;};}function removeEntity(_0x15fcb0,_0x3ff1fe){return function(_0x24e3aa){if(_0x24e3aa){return _0x24e3aa['destroy']()[_0xb159('0x29')](function(){_0x15fcb0[_0xb159('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148571,_0x10cd78){return function(_0x43085d){if(!_0x43085d){_0x148571[_0xb159('0x1c')](0x194);}return _0x43085d;};}function handleError(_0x44a523,_0x2716b3){_0x2716b3=_0x2716b3||0x1f4;return function(_0x12f205){logger[_0xb159('0x2a')](_0x12f205['stack']);if(_0x12f205[_0xb159('0x2b')]){delete _0x12f205[_0xb159('0x2b')];}_0x44a523['status'](_0x2716b3)[_0xb159('0x2c')](_0x12f205);};}exports['index']=function(_0x5bd224,_0x591ba9){var _0x5d1773={},_0x59231b={},_0x3eb8b0={'count':0x0,'rows':[]};var _0x29d50e=_[_0xb159('0x2d')](db[_0xb159('0x2e')]['rawAttributes'],function(_0xdcb129){return{'name':_0xdcb129[_0xb159('0x2f')],'type':_0xdcb129[_0xb159('0x30')][_0xb159('0x31')]};});_0x59231b['model']=_[_0xb159('0x2d')](_0x29d50e,'name');_0x59231b[_0xb159('0x32')]=_[_0xb159('0x33')](_0x5bd224[_0xb159('0x32')]);_0x59231b[_0xb159('0x34')]=_[_0xb159('0x35')](_0x59231b[_0xb159('0x36')],_0x59231b[_0xb159('0x32')]);_0x5d1773[_0xb159('0x37')]=_['intersection'](_0x59231b[_0xb159('0x36')],qs[_0xb159('0x38')](_0x5bd224[_0xb159('0x32')][_0xb159('0x38')]));_0x5d1773[_0xb159('0x37')]=_0x5d1773['attributes'][_0xb159('0x39')]?_0x5d1773['attributes']:_0x59231b[_0xb159('0x36')];if(!_0x5bd224[_0xb159('0x32')][_0xb159('0x3a')](_0xb159('0x3b'))){_0x5d1773[_0xb159('0x21')]=qs[_0xb159('0x21')](_0x5bd224['query'][_0xb159('0x21')]);_0x5d1773[_0xb159('0x22')]=qs[_0xb159('0x22')](_0x5bd224[_0xb159('0x32')]['offset']);}_0x5d1773[_0xb159('0x3c')]=qs['sort'](_0x5bd224['query'][_0xb159('0x3d')]);_0x5d1773[_0xb159('0x3e')]=qs['filters'](_[_0xb159('0x3f')](_0x5bd224[_0xb159('0x32')],_0x59231b['filters']),_0x29d50e);if(_0x5bd224[_0xb159('0x32')][_0xb159('0x40')]){_0x5d1773[_0xb159('0x3e')]=_[_0xb159('0x41')](_0x5d1773[_0xb159('0x3e')],{'$or':_[_0xb159('0x2d')](_0x29d50e,function(_0x2bbba9){if(_0x2bbba9[_0xb159('0x30')]!==_0xb159('0x42')){var _0x4d4e92={};_0x4d4e92[_0x2bbba9[_0xb159('0x2b')]]={'$like':'%'+_0x5bd224[_0xb159('0x32')][_0xb159('0x40')]+'%'};return _0x4d4e92;}})});}_0x5d1773=_[_0xb159('0x41')]({},_0x5d1773,_0x5bd224['options']);var _0x46f7a7={'where':_0x5d1773[_0xb159('0x3e')]};return db[_0xb159('0x2e')][_0xb159('0x43')](_0x46f7a7)['then'](function(_0x8dc8cc){_0x3eb8b0[_0xb159('0x43')]=_0x8dc8cc;if(_0x5bd224[_0xb159('0x32')][_0xb159('0x44')]){_0x5d1773[_0xb159('0x45')]=[{'all':!![]}];}return db[_0xb159('0x2e')][_0xb159('0x46')](_0x5d1773);})['then'](function(_0x376c51){_0x3eb8b0[_0xb159('0x47')]=_0x376c51;return _0x3eb8b0;})[_0xb159('0x29')](respondWithFilteredResult(_0x591ba9,_0x5d1773))[_0xb159('0x48')](handleError(_0x591ba9,null));};exports[_0xb159('0x49')]=function(_0x406fc0,_0x3d8cbc){var _0x15f81c={'raw':![],'where':{'id':_0x406fc0[_0xb159('0x4a')]['id']}},_0x48a908={};_0x48a908[_0xb159('0x36')]=_[_0xb159('0x33')](db[_0xb159('0x2e')][_0xb159('0x4b')]);_0x48a908[_0xb159('0x32')]=_['keys'](_0x406fc0[_0xb159('0x32')]);_0x48a908[_0xb159('0x34')]=_[_0xb159('0x35')](_0x48a908[_0xb159('0x36')],_0x48a908['query']);_0x15f81c[_0xb159('0x37')]=_[_0xb159('0x35')](_0x48a908['model'],qs[_0xb159('0x38')](_0x406fc0[_0xb159('0x32')][_0xb159('0x38')]));_0x15f81c[_0xb159('0x37')]=_0x15f81c[_0xb159('0x37')]['length']?_0x15f81c[_0xb159('0x37')]:_0x48a908[_0xb159('0x36')];if(_0x406fc0[_0xb159('0x32')][_0xb159('0x44')]){_0x15f81c[_0xb159('0x45')]=[{'all':!![]}];}_0x15f81c=_[_0xb159('0x41')]({},_0x15f81c,_0x406fc0[_0xb159('0x4c')]);return db[_0xb159('0x2e')]['find'](_0x15f81c)['then'](handleEntityNotFound(_0x3d8cbc,null))[_0xb159('0x29')](respondWithResult(_0x3d8cbc,null))[_0xb159('0x48')](handleError(_0x3d8cbc,null));};exports[_0xb159('0x4d')]=function(_0x316e39,_0x1bf7d9){return db[_0xb159('0x2e')]['create'](_0x316e39[_0xb159('0x4e')],{})[_0xb159('0x29')](respondWithResult(_0x1bf7d9,0xc9))['catch'](handleError(_0x1bf7d9,null));};exports[_0xb159('0x28')]=function(_0x303e41,_0x32cdd9){if(_0x303e41[_0xb159('0x4e')]['id']){delete _0x303e41['body']['id'];}return db[_0xb159('0x2e')][_0xb159('0x4f')]({'where':{'id':_0x303e41[_0xb159('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32cdd9,null))[_0xb159('0x29')](saveUpdates(_0x303e41[_0xb159('0x4e')],null))['then'](respondWithResult(_0x32cdd9,null))[_0xb159('0x48')](handleError(_0x32cdd9,null));};exports[_0xb159('0x50')]=function(_0x1bf2f4,_0x2e8dbf){return db[_0xb159('0x2e')][_0xb159('0x4f')]({'where':{'id':_0x1bf2f4['params']['id']}})[_0xb159('0x29')](handleEntityNotFound(_0x2e8dbf,null))[_0xb159('0x29')](removeEntity(_0x2e8dbf,null))[_0xb159('0x48')](handleError(_0x2e8dbf,null));};exports[_0xb159('0x51')]=function(_0xe75331,_0x3afd99,_0x1e43ca){var _0x593c39={};var _0x2cc749={};var _0x3e26c6;var _0x11af19;return db['VtigerConfiguration'][_0xb159('0x52')]({'where':{'id':_0xe75331[_0xb159('0x4a')]['id']}})[_0xb159('0x29')](handleEntityNotFound(_0x3afd99,null))['then'](function(_0x3548d0){if(_0x3548d0){_0x3e26c6=_0x3548d0;_0x2cc749[_0xb159('0x36')]=_[_0xb159('0x33')](db[_0xb159('0x53')]['rawAttributes']);_0x2cc749['query']=_[_0xb159('0x33')](_0xe75331['query']);_0x2cc749[_0xb159('0x34')]=_['intersection'](_0x2cc749[_0xb159('0x36')],_0x2cc749[_0xb159('0x32')]);_0x593c39[_0xb159('0x37')]=_[_0xb159('0x35')](_0x2cc749['model'],qs['fields'](_0xe75331[_0xb159('0x32')][_0xb159('0x38')]));_0x593c39[_0xb159('0x37')]=_0x593c39[_0xb159('0x37')][_0xb159('0x39')]?_0x593c39[_0xb159('0x37')]:_0x2cc749[_0xb159('0x36')];_0x593c39[_0xb159('0x3c')]=qs[_0xb159('0x3d')](_0xe75331[_0xb159('0x32')][_0xb159('0x3d')]);_0x593c39[_0xb159('0x3e')]=qs[_0xb159('0x34')](_['pick'](_0xe75331[_0xb159('0x32')],_0x2cc749[_0xb159('0x34')]));if(_0xe75331[_0xb159('0x32')][_0xb159('0x40')]){_0x593c39[_0xb159('0x3e')]=_[_0xb159('0x41')](_0x593c39[_0xb159('0x3e')],{'$or':_[_0xb159('0x2d')](_0x593c39[_0xb159('0x37')],function(_0x2788e1){var _0x564d22={};_0x564d22[_0x2788e1]={'$like':'%'+_0xe75331[_0xb159('0x32')]['filter']+'%'};return _0x564d22;})});}_0x593c39=_['merge']({},_0x593c39,_0xe75331[_0xb159('0x4c')]);return _0x3e26c6[_0xb159('0x51')](_0x593c39);}})['then'](function(_0x3c3c77){if(_0x3c3c77){_0x11af19=_0x3c3c77[_0xb159('0x39')];if(!_0xe75331[_0xb159('0x32')][_0xb159('0x3a')](_0xb159('0x3b'))){_0x593c39[_0xb159('0x21')]=qs[_0xb159('0x21')](_0xe75331[_0xb159('0x32')][_0xb159('0x21')]);_0x593c39['offset']=qs[_0xb159('0x22')](_0xe75331[_0xb159('0x32')][_0xb159('0x22')]);}return _0x3e26c6[_0xb159('0x51')](_0x593c39);}})['then'](function(_0x1ac789){if(_0x1ac789){return _0x1ac789?{'count':_0x11af19,'rows':_0x1ac789}:null;}})[_0xb159('0x29')](respondWithResult(_0x3afd99,null))['catch'](handleError(_0x3afd99,null));};exports[_0xb159('0x54')]=function(_0x5e2e65,_0x33b8a3,_0x57d6c3){var _0x3115a0={};var _0x1eddcf={};var _0x1feff2;var _0x116c3e;return db[_0xb159('0x2e')][_0xb159('0x52')]({'where':{'id':_0x5e2e65[_0xb159('0x4a')]['id']}})[_0xb159('0x29')](handleEntityNotFound(_0x33b8a3,null))[_0xb159('0x29')](function(_0x59d06d){if(_0x59d06d){_0x1feff2=_0x59d06d;_0x1eddcf[_0xb159('0x36')]=_['keys'](db[_0xb159('0x53')][_0xb159('0x4b')]);_0x1eddcf['query']=_[_0xb159('0x33')](_0x5e2e65[_0xb159('0x32')]);_0x1eddcf[_0xb159('0x34')]=_[_0xb159('0x35')](_0x1eddcf['model'],_0x1eddcf[_0xb159('0x32')]);_0x3115a0[_0xb159('0x37')]=_[_0xb159('0x35')](_0x1eddcf['model'],qs[_0xb159('0x38')](_0x5e2e65[_0xb159('0x32')]['fields']));_0x3115a0['attributes']=_0x3115a0[_0xb159('0x37')][_0xb159('0x39')]?_0x3115a0[_0xb159('0x37')]:_0x1eddcf[_0xb159('0x36')];_0x3115a0[_0xb159('0x3c')]=qs[_0xb159('0x3d')](_0x5e2e65[_0xb159('0x32')]['sort']);_0x3115a0[_0xb159('0x3e')]=qs[_0xb159('0x34')](_[_0xb159('0x3f')](_0x5e2e65[_0xb159('0x32')],_0x1eddcf[_0xb159('0x34')]));if(_0x5e2e65['query'][_0xb159('0x40')]){_0x3115a0[_0xb159('0x3e')]=_['merge'](_0x3115a0[_0xb159('0x3e')],{'$or':_['map'](_0x3115a0[_0xb159('0x37')],function(_0x244d91){var _0x2b2525={};_0x2b2525[_0x244d91]={'$like':'%'+_0x5e2e65['query'][_0xb159('0x40')]+'%'};return _0x2b2525;})});}_0x3115a0=_[_0xb159('0x41')]({},_0x3115a0,_0x5e2e65[_0xb159('0x4c')]);return _0x1feff2[_0xb159('0x54')](_0x3115a0);}})[_0xb159('0x29')](function(_0x3aa7f6){if(_0x3aa7f6){_0x116c3e=_0x3aa7f6[_0xb159('0x39')];if(!_0x5e2e65['query'][_0xb159('0x3a')](_0xb159('0x3b'))){_0x3115a0['limit']=qs[_0xb159('0x21')](_0x5e2e65[_0xb159('0x32')][_0xb159('0x21')]);_0x3115a0[_0xb159('0x22')]=qs[_0xb159('0x22')](_0x5e2e65['query'][_0xb159('0x22')]);}return _0x1feff2[_0xb159('0x54')](_0x3115a0);}})['then'](function(_0x223ad5){if(_0x223ad5){return _0x223ad5?{'count':_0x116c3e,'rows':_0x223ad5}:null;}})['then'](respondWithResult(_0x33b8a3,null))[_0xb159('0x48')](handleError(_0x33b8a3,null));};exports['getDescriptions']=function(_0x286033,_0x198b68,_0x42739a){var _0x5b3fb7={};var _0x86fc3b={};var _0x2d1dee;var _0x5a99b9;return db['VtigerConfiguration'][_0xb159('0x52')]({'where':{'id':_0x286033[_0xb159('0x4a')]['id']}})[_0xb159('0x29')](handleEntityNotFound(_0x198b68,null))[_0xb159('0x29')](function(_0xb59095){if(_0xb59095){_0x2d1dee=_0xb59095;_0x86fc3b[_0xb159('0x36')]=_['keys'](db[_0xb159('0x53')]['rawAttributes']);_0x86fc3b[_0xb159('0x32')]=_['keys'](_0x286033[_0xb159('0x32')]);_0x86fc3b[_0xb159('0x34')]=_[_0xb159('0x35')](_0x86fc3b[_0xb159('0x36')],_0x86fc3b['query']);_0x5b3fb7[_0xb159('0x37')]=_[_0xb159('0x35')](_0x86fc3b[_0xb159('0x36')],qs[_0xb159('0x38')](_0x286033[_0xb159('0x32')][_0xb159('0x38')]));_0x5b3fb7['attributes']=_0x5b3fb7[_0xb159('0x37')][_0xb159('0x39')]?_0x5b3fb7['attributes']:_0x86fc3b['model'];_0x5b3fb7[_0xb159('0x3c')]=qs[_0xb159('0x3d')](_0x286033['query'][_0xb159('0x3d')]);_0x5b3fb7['where']=qs['filters'](_[_0xb159('0x3f')](_0x286033[_0xb159('0x32')],_0x86fc3b[_0xb159('0x34')]));if(_0x286033[_0xb159('0x32')][_0xb159('0x40')]){_0x5b3fb7[_0xb159('0x3e')]=_[_0xb159('0x41')](_0x5b3fb7[_0xb159('0x3e')],{'$or':_[_0xb159('0x2d')](_0x5b3fb7[_0xb159('0x37')],function(_0x37a1c7){var _0x4cf214={};_0x4cf214[_0x37a1c7]={'$like':'%'+_0x286033[_0xb159('0x32')]['filter']+'%'};return _0x4cf214;})});}_0x5b3fb7=_['merge']({},_0x5b3fb7,_0x286033['options']);return _0x2d1dee[_0xb159('0x55')](_0x5b3fb7);}})['then'](function(_0x68d1be){if(_0x68d1be){_0x5a99b9=_0x68d1be[_0xb159('0x39')];if(!_0x286033['query'][_0xb159('0x3a')]('nolimit')){_0x5b3fb7['limit']=qs[_0xb159('0x21')](_0x286033[_0xb159('0x32')]['limit']);_0x5b3fb7['offset']=qs[_0xb159('0x22')](_0x286033[_0xb159('0x32')][_0xb159('0x22')]);}return _0x2d1dee[_0xb159('0x55')](_0x5b3fb7);}})[_0xb159('0x29')](function(_0x265fcc){if(_0x265fcc){return _0x265fcc?{'count':_0x5a99b9,'rows':_0x265fcc}:null;}})[_0xb159('0x29')](respondWithResult(_0x198b68,null))[_0xb159('0x48')](handleError(_0x198b68,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 8e595e2..9df15d0 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 _0xc15b=['../../config/logger','api','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','lodash'];(function(_0x68fa6,_0x391986){var _0x42c8d7=function(_0xd7a9f6){while(--_0xd7a9f6){_0x68fa6['push'](_0x68fa6['shift']());}};_0x42c8d7(++_0x391986);}(_0xc15b,0x1ee));var _0xbc15=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc15b[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xbc15('0x0'));var util=require('util');var logger=require(_0xbc15('0x1'))(_0xbc15('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbc15('0x3'));var fs=require('fs');var path=require(_0xbc15('0x4'));var rimraf=require('rimraf');var config=require(_0xbc15('0x5'));var attributes=require(_0xbc15('0x6'));module[_0xbc15('0x7')]=function(_0x6e9392,_0x25f268){return _0x6e9392['define']('VtigerConfiguration',attributes,{'tableName':_0xbc15('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd2e=['VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x4f288e,_0x31286a){var _0x5087db=function(_0x1cbb9f){while(--_0x1cbb9f){_0x4f288e['push'](_0x4f288e['shift']());}};_0x5087db(++_0x31286a);}(_0xdd2e,0x9e));var _0xedd2=function(_0x5a9a13,_0x3f6cb5){_0x5a9a13=_0x5a9a13-0x0;var _0x26cc45=_0xdd2e[_0x5a9a13];return _0x26cc45;};'use strict';var _=require(_0xedd2('0x0'));var util=require('util');var logger=require(_0xedd2('0x1'))(_0xedd2('0x2'));var moment=require(_0xedd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xedd2('0x4'));var fs=require('fs');var path=require(_0xedd2('0x5'));var rimraf=require(_0xedd2('0x6'));var config=require(_0xedd2('0x7'));var attributes=require(_0xedd2('0x8'));module[_0xedd2('0x9')]=function(_0xa1ea4d,_0x1b39be){return _0xa1ea4d[_0xedd2('0xa')](_0xedd2('0xb'),attributes,{'tableName':_0xedd2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 9b0f54e..8ab59cf 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 _0x8b54=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x5ece4d,_0x1b8a2e){var _0x3b4f59=function(_0x378240){while(--_0x378240){_0x5ece4d['push'](_0x5ece4d['shift']());}};_0x3b4f59(++_0x1b8a2e);}(_0x8b54,0x67));var _0x48b5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b54[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x48b5('0x0'));var util=require(_0x48b5('0x1'));var moment=require('moment');var BPromise=require(_0x48b5('0x2'));var rs=require(_0x48b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48b5('0x4'))['db'];var utils=require(_0x48b5('0x5'));var logger=require(_0x48b5('0x6'))(_0x48b5('0x7'));var config=require(_0x48b5('0x8'));var jayson=require(_0x48b5('0x9'));var client=jayson[_0x48b5('0xa')][_0x48b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc7c93a,_0x1f30c2,_0x31ad3d){return new BPromise(function(_0x2c823f,_0x2770fc){return client[_0x48b5('0xc')](_0xc7c93a,_0x31ad3d)[_0x48b5('0xd')](function(_0xa09af9){logger[_0x48b5('0xe')](_0x48b5('0xf'),_0x1f30c2,_0x48b5('0x10'));logger['debug'](_0x48b5('0x11'),_0x1f30c2,'request\x20sent',JSON['stringify'](_0xa09af9));if(_0xa09af9[_0x48b5('0x12')]){if(_0xa09af9[_0x48b5('0x12')]['code']===0x1f4){logger[_0x48b5('0x12')](_0x48b5('0xf'),_0x1f30c2,_0xa09af9['error']['message']);return _0x2770fc(_0xa09af9[_0x48b5('0x12')]['message']);}logger[_0x48b5('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f30c2,_0xa09af9[_0x48b5('0x12')][_0x48b5('0x13')]);return _0x2c823f(_0xa09af9[_0x48b5('0x12')]['message']);}else{logger[_0x48b5('0xe')](_0x48b5('0xf'),_0x1f30c2,_0x48b5('0x10'));_0x2c823f(_0xa09af9['result'][_0x48b5('0x13')]);}})['catch'](function(_0x565067){logger['error'](_0x48b5('0xf'),_0x1f30c2,_0x565067);_0x2770fc(_0x565067);});});} \ No newline at end of file +var _0xee0d=['../../config/utils','jayson/promise','http','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee0d,0xb0));var _0xdee0=function(_0x56df12,_0x1fd0e5){_0x56df12=_0x56df12-0x0;var _0xe9c3a2=_0xee0d[_0x56df12];return _0xe9c3a2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdee0('0x0'));var BPromise=require(_0xdee0('0x1'));var rs=require(_0xdee0('0x2'));var fs=require('fs');var Redis=require(_0xdee0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdee0('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdee0('0x5'));var client=jayson['client'][_0xdee0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x51d231,_0x4fdf70,_0x52f01b){return new BPromise(function(_0x1751c1,_0x353597){return client['request'](_0x51d231,_0x52f01b)[_0xdee0('0x7')](function(_0x462d41){logger['info'](_0xdee0('0x8'),_0x4fdf70,_0xdee0('0x9'));logger[_0xdee0('0xa')](_0xdee0('0xb'),_0x4fdf70,_0xdee0('0x9'),JSON[_0xdee0('0xc')](_0x462d41));if(_0x462d41[_0xdee0('0xd')]){if(_0x462d41['error'][_0xdee0('0xe')]===0x1f4){logger[_0xdee0('0xd')](_0xdee0('0x8'),_0x4fdf70,_0x462d41[_0xdee0('0xd')][_0xdee0('0xf')]);return _0x353597(_0x462d41[_0xdee0('0xd')][_0xdee0('0xf')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4fdf70,_0x462d41[_0xdee0('0xd')][_0xdee0('0xf')]);return _0x1751c1(_0x462d41['error'][_0xdee0('0xf')]);}else{logger['info'](_0xdee0('0x8'),_0x4fdf70,_0xdee0('0x9'));_0x1751c1(_0x462d41[_0xdee0('0x10')][_0xdee0('0xf')]);}})[_0xdee0('0x11')](function(_0x19c164){logger[_0xdee0('0xd')](_0xdee0('0x8'),_0x4fdf70,_0x19c164);_0x353597(_0x19c164);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index c7bc9d5..89c1fa6 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 _0xa962=['destroy','multer','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','delete'];(function(_0x114be1,_0x5e2e55){var _0x4b3c6b=function(_0x3776f6){while(--_0x3776f6){_0x114be1['push'](_0x114be1['shift']());}};_0x4b3c6b(++_0x5e2e55);}(_0xa962,0x79));var _0x2a96=function(_0x59ece4,_0xce6de0){_0x59ece4=_0x59ece4-0x0;var _0x56a0ba=_0xa962[_0x59ece4];return _0x56a0ba;};'use strict';var multer=require(_0x2a96('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a96('0x1')]();var fs_extra=require(_0x2a96('0x2'));var auth=require(_0x2a96('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2a96('0x4'));var controller=require(_0x2a96('0x5'));router[_0x2a96('0x6')]('/',auth[_0x2a96('0x7')](),controller[_0x2a96('0x8')]);router[_0x2a96('0x6')](_0x2a96('0x9'),auth['isAuthenticated'](),controller[_0x2a96('0xa')]);router['post']('/',auth[_0x2a96('0x7')](),controller[_0x2a96('0xb')]);router[_0x2a96('0xc')](_0x2a96('0x9'),auth[_0x2a96('0x7')](),controller['update']);router[_0x2a96('0xd')](_0x2a96('0x9'),auth['isAuthenticated'](),controller[_0x2a96('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa48a=['Router','fs-extra','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa48a,0x74));var _0xaa48=function(_0x33f2ba,_0x2dfe6b){_0x33f2ba=_0x33f2ba-0x0;var _0x34a533=_0xa48a[_0x33f2ba];return _0x34a533;};'use strict';var multer=require(_0xaa48('0x0'));var util=require(_0xaa48('0x1'));var path=require(_0xaa48('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa48('0x3'));var router=express[_0xaa48('0x4')]();var fs_extra=require(_0xaa48('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa48('0x6'));var controller=require(_0xaa48('0x7'));router[_0xaa48('0x8')]('/',auth[_0xaa48('0x9')](),controller[_0xaa48('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xaa48('0xb')]);router[_0xaa48('0xc')]('/',auth['isAuthenticated'](),controller[_0xaa48('0xd')]);router[_0xaa48('0xe')]('/:id',auth[_0xaa48('0x9')](),controller[_0xaa48('0xf')]);router[_0xaa48('0x10')](_0xaa48('0x11'),auth[_0xaa48('0x9')](),controller[_0xaa48('0x12')]);module[_0xaa48('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 9bde6e9..2989aea 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 _0x95eb=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x95eb,0x18d));var _0xb95e=function(_0x321af2,_0x2e1584){_0x321af2=_0x321af2-0x0;var _0x2b3ec2=_0x95eb[_0x321af2];return _0x2b3ec2;};'use strict';var Sequelize=require(_0xb95e('0x0'));module[_0xb95e('0x1')]={'type':{'type':Sequelize[_0xb95e('0x2')](_0xb95e('0x3'),'variable',_0xb95e('0x4'),_0xb95e('0x5'),'picklist'),'defaultValue':_0xb95e('0x3')},'content':{'type':Sequelize[_0xb95e('0x6')]},'key':{'type':Sequelize[_0xb95e('0x6')]},'keyType':{'type':Sequelize[_0xb95e('0x2')](_0xb95e('0x3'),_0xb95e('0x7'),_0xb95e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb95e('0x6')]},'customField':{'type':Sequelize[_0xb95e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb95e('0x6')]}}; \ No newline at end of file +var _0x55bb=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x24ad5f,_0x4fcf81){var _0xabb54e=function(_0x3b4e86){while(--_0x3b4e86){_0x24ad5f['push'](_0x24ad5f['shift']());}};_0xabb54e(++_0x4fcf81);}(_0x55bb,0x1a4));var _0xb55b=function(_0x5912cd,_0x5cc626){_0x5912cd=_0x5912cd-0x0;var _0x357e80=_0x55bb[_0x5912cd];return _0x357e80;};'use strict';var Sequelize=require(_0xb55b('0x0'));module[_0xb55b('0x1')]={'type':{'type':Sequelize[_0xb55b('0x2')](_0xb55b('0x3'),_0xb55b('0x4'),_0xb55b('0x5'),_0xb55b('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb55b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xb55b('0x3'),'variable',_0xb55b('0x5'))},'keyContent':{'type':Sequelize[_0xb55b('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb55b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ac80c43..7f5db88 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 _0x2fe5=['to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VtigerField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x39db05,_0x3868d0){var _0x3f0e22=function(_0x532c4f){while(--_0x532c4f){_0x39db05['push'](_0x39db05['shift']());}};_0x3f0e22(++_0x3868d0);}(_0x2fe5,0xd5));var _0x52fe=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2fe5[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x52fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x52fe('0x1'));var jsonpatch=require(_0x52fe('0x2'));var rp=require(_0x52fe('0x3'));var moment=require(_0x52fe('0x4'));var BPromise=require(_0x52fe('0x5'));var Mustache=require(_0x52fe('0x6'));var util=require(_0x52fe('0x7'));var path=require('path');var sox=require(_0x52fe('0x8'));var csv=require(_0x52fe('0x9'));var ejs=require(_0x52fe('0xa'));var fs=require('fs');var fs_extra=require(_0x52fe('0xb'));var _=require('lodash');var squel=require(_0x52fe('0xc'));var crypto=require(_0x52fe('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x52fe('0x9'));var querystring=require(_0x52fe('0xe'));var Papa=require('papaparse');var Redis=require(_0x52fe('0xf'));var authService=require(_0x52fe('0x10'));var qs=require(_0x52fe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52fe('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x52fe('0x13'));var licenseUtil=require(_0x52fe('0x14'));var db=require(_0x52fe('0x15'))['db'];function respondWithStatusCode(_0x5f2f48,_0x2c3003){_0x2c3003=_0x2c3003||0xcc;return function(_0x61e1df){if(_0x61e1df){return _0x5f2f48[_0x52fe('0x16')](_0x2c3003);}return _0x5f2f48[_0x52fe('0x17')](_0x2c3003)['end']();};}function respondWithResult(_0x2a98c0,_0x23fca2){_0x23fca2=_0x23fca2||0xc8;return function(_0x1c78ee){if(_0x1c78ee){return _0x2a98c0['status'](_0x23fca2)['json'](_0x1c78ee);}};}function respondWithFilteredResult(_0x45e140,_0x58650f){return function(_0x1d9768){if(_0x1d9768){var _0x3607c7=typeof _0x58650f[_0x52fe('0x18')]===_0x52fe('0x19')&&typeof _0x58650f[_0x52fe('0x1a')]==='undefined';var _0x26801c=_0x1d9768[_0x52fe('0x1b')];var _0x48a5b6=_0x3607c7?0x0:_0x58650f['offset'];var _0x543e2d=_0x3607c7?_0x1d9768['count']:_0x58650f[_0x52fe('0x18')]+_0x58650f[_0x52fe('0x1a')];var _0x36ce10;if(_0x543e2d>=_0x26801c){_0x543e2d=_0x26801c;_0x36ce10=0xc8;}else{_0x36ce10=0xce;}_0x45e140[_0x52fe('0x17')](_0x36ce10);return _0x45e140[_0x52fe('0x1c')]('Content-Range',_0x48a5b6+'-'+_0x543e2d+'/'+_0x26801c)[_0x52fe('0x1d')](_0x1d9768);}return null;};}function patchUpdates(_0x4608dc){return function(_0x2c397d){try{jsonpatch[_0x52fe('0x1e')](_0x2c397d,_0x4608dc,!![]);}catch(_0x28d433){return BPromise[_0x52fe('0x1f')](_0x28d433);}return _0x2c397d[_0x52fe('0x20')]();};}function saveUpdates(_0x144c69,_0x50badf){return function(_0x2a3649){if(_0x2a3649){return _0x2a3649[_0x52fe('0x21')](_0x144c69)['then'](function(_0x1ebd44){return _0x1ebd44;});}return null;};}function removeEntity(_0x496735,_0x419b7c){return function(_0x4bb208){if(_0x4bb208){return _0x4bb208[_0x52fe('0x22')]()[_0x52fe('0x23')](function(){_0x496735[_0x52fe('0x17')](0xcc)[_0x52fe('0x24')]();});}};}function handleEntityNotFound(_0x1f583c,_0x180f48){return function(_0x2f7541){if(!_0x2f7541){_0x1f583c[_0x52fe('0x16')](0x194);}return _0x2f7541;};}function handleError(_0x24fcc2,_0x3e9bc1){_0x3e9bc1=_0x3e9bc1||0x1f4;return function(_0x1a93fb){logger[_0x52fe('0x25')](_0x1a93fb[_0x52fe('0x26')]);if(_0x1a93fb['name']){delete _0x1a93fb[_0x52fe('0x27')];}_0x24fcc2[_0x52fe('0x17')](_0x3e9bc1)[_0x52fe('0x28')](_0x1a93fb);};}exports[_0x52fe('0x29')]=function(_0xf2929d,_0x2185f1){var _0x42601b={},_0x366176={},_0x2d4aaf={'count':0x0,'rows':[]};var _0xc54f8e=_[_0x52fe('0x2a')](db[_0x52fe('0x2b')]['rawAttributes'],function(_0x3bfc58){return{'name':_0x3bfc58[_0x52fe('0x2c')],'type':_0x3bfc58[_0x52fe('0x2d')][_0x52fe('0x2e')]};});_0x366176[_0x52fe('0x2f')]=_['map'](_0xc54f8e,_0x52fe('0x27'));_0x366176[_0x52fe('0x30')]=_[_0x52fe('0x31')](_0xf2929d[_0x52fe('0x30')]);_0x366176['filters']=_[_0x52fe('0x32')](_0x366176[_0x52fe('0x2f')],_0x366176['query']);_0x42601b[_0x52fe('0x33')]=_[_0x52fe('0x32')](_0x366176[_0x52fe('0x2f')],qs[_0x52fe('0x34')](_0xf2929d[_0x52fe('0x30')][_0x52fe('0x34')]));_0x42601b[_0x52fe('0x33')]=_0x42601b[_0x52fe('0x33')][_0x52fe('0x35')]?_0x42601b['attributes']:_0x366176['model'];if(!_0xf2929d[_0x52fe('0x30')][_0x52fe('0x36')](_0x52fe('0x37'))){_0x42601b[_0x52fe('0x1a')]=qs[_0x52fe('0x1a')](_0xf2929d[_0x52fe('0x30')][_0x52fe('0x1a')]);_0x42601b[_0x52fe('0x18')]=qs[_0x52fe('0x18')](_0xf2929d['query'][_0x52fe('0x18')]);}_0x42601b[_0x52fe('0x38')]=qs[_0x52fe('0x39')](_0xf2929d[_0x52fe('0x30')][_0x52fe('0x39')]);_0x42601b[_0x52fe('0x3a')]=qs[_0x52fe('0x3b')](_['pick'](_0xf2929d[_0x52fe('0x30')],_0x366176[_0x52fe('0x3b')]),_0xc54f8e);if(_0xf2929d[_0x52fe('0x30')][_0x52fe('0x3c')]){_0x42601b[_0x52fe('0x3a')]=_[_0x52fe('0x3d')](_0x42601b[_0x52fe('0x3a')],{'$or':_[_0x52fe('0x2a')](_0xc54f8e,function(_0x38d3fa){if(_0x38d3fa[_0x52fe('0x2d')]!==_0x52fe('0x3e')){var _0x46bba0={};_0x46bba0[_0x38d3fa[_0x52fe('0x27')]]={'$like':'%'+_0xf2929d[_0x52fe('0x30')][_0x52fe('0x3c')]+'%'};return _0x46bba0;}})});}_0x42601b=_[_0x52fe('0x3d')]({},_0x42601b,_0xf2929d[_0x52fe('0x3f')]);var _0x51c578={'where':_0x42601b['where']};return db['VtigerField'][_0x52fe('0x1b')](_0x51c578)[_0x52fe('0x23')](function(_0x5b43b0){_0x2d4aaf[_0x52fe('0x1b')]=_0x5b43b0;if(_0xf2929d[_0x52fe('0x30')][_0x52fe('0x40')]){_0x42601b[_0x52fe('0x41')]=[{'all':!![]}];}return db[_0x52fe('0x2b')]['findAll'](_0x42601b);})['then'](function(_0x4c5583){_0x2d4aaf[_0x52fe('0x42')]=_0x4c5583;return _0x2d4aaf;})[_0x52fe('0x23')](respondWithFilteredResult(_0x2185f1,_0x42601b))['catch'](handleError(_0x2185f1,null));};exports[_0x52fe('0x43')]=function(_0x21da1f,_0x4efd99){var _0x4c801c={'raw':!![],'where':{'id':_0x21da1f[_0x52fe('0x44')]['id']}},_0x58b9f9={};_0x58b9f9[_0x52fe('0x2f')]=_[_0x52fe('0x31')](db[_0x52fe('0x2b')][_0x52fe('0x45')]);_0x58b9f9[_0x52fe('0x30')]=_['keys'](_0x21da1f[_0x52fe('0x30')]);_0x58b9f9[_0x52fe('0x3b')]=_['intersection'](_0x58b9f9['model'],_0x58b9f9[_0x52fe('0x30')]);_0x4c801c[_0x52fe('0x33')]=_['intersection'](_0x58b9f9[_0x52fe('0x2f')],qs['fields'](_0x21da1f[_0x52fe('0x30')][_0x52fe('0x34')]));_0x4c801c[_0x52fe('0x33')]=_0x4c801c[_0x52fe('0x33')][_0x52fe('0x35')]?_0x4c801c[_0x52fe('0x33')]:_0x58b9f9[_0x52fe('0x2f')];if(_0x21da1f[_0x52fe('0x30')][_0x52fe('0x40')]){_0x4c801c['include']=[{'all':!![]}];}_0x4c801c=_[_0x52fe('0x3d')]({},_0x4c801c,_0x21da1f['options']);return db[_0x52fe('0x2b')]['find'](_0x4c801c)['then'](handleEntityNotFound(_0x4efd99,null))[_0x52fe('0x23')](respondWithResult(_0x4efd99,null))[_0x52fe('0x46')](handleError(_0x4efd99,null));};exports[_0x52fe('0x47')]=function(_0x2efe68,_0x41bd7d){return db['VtigerField'][_0x52fe('0x47')](_0x2efe68['body'],{})[_0x52fe('0x23')](respondWithResult(_0x41bd7d,0xc9))['catch'](handleError(_0x41bd7d,null));};exports[_0x52fe('0x21')]=function(_0x4e0cf0,_0x3e8fe2){if(_0x4e0cf0[_0x52fe('0x48')]['id']){delete _0x4e0cf0[_0x52fe('0x48')]['id'];}return db[_0x52fe('0x2b')]['find']({'where':{'id':_0x4e0cf0[_0x52fe('0x44')]['id']}})[_0x52fe('0x23')](handleEntityNotFound(_0x3e8fe2,null))[_0x52fe('0x23')](saveUpdates(_0x4e0cf0['body'],null))[_0x52fe('0x23')](respondWithResult(_0x3e8fe2,null))[_0x52fe('0x46')](handleError(_0x3e8fe2,null));};exports[_0x52fe('0x22')]=function(_0x43057a,_0x16dc20){return db['VtigerField'][_0x52fe('0x49')]({'where':{'id':_0x43057a[_0x52fe('0x44')]['id']}})[_0x52fe('0x23')](handleEntityNotFound(_0x16dc20,null))[_0x52fe('0x23')](removeEntity(_0x16dc20,null))[_0x52fe('0x46')](handleError(_0x16dc20,null));}; \ No newline at end of file +var _0x4818=['index','map','rawAttributes','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','VtigerField','includeAll','include','findAll','rows','params','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','name','send'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x4818,0x145));var _0x8481=function(_0x10ef2c,_0x35bd6d){_0x10ef2c=_0x10ef2c-0x0;var _0x37ed40=_0x4818[_0x10ef2c];return _0x37ed40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8481('0x0'));var zipdir=require(_0x8481('0x1'));var jsonpatch=require(_0x8481('0x2'));var rp=require(_0x8481('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8481('0x4'));var util=require('util');var path=require(_0x8481('0x5'));var sox=require('sox');var csv=require(_0x8481('0x6'));var ejs=require(_0x8481('0x7'));var fs=require('fs');var fs_extra=require(_0x8481('0x8'));var _=require(_0x8481('0x9'));var squel=require(_0x8481('0xa'));var crypto=require(_0x8481('0xb'));var jsforce=require(_0x8481('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8481('0x6'));var querystring=require(_0x8481('0xd'));var Papa=require(_0x8481('0xe'));var Redis=require(_0x8481('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8481('0x10'));var as=require(_0x8481('0x11'));var hardwareService=require(_0x8481('0x12'));var logger=require('../../config/logger')(_0x8481('0x13'));var utils=require(_0x8481('0x14'));var config=require(_0x8481('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8481('0x16'))['db'];function respondWithStatusCode(_0x5148ef,_0x33baf6){_0x33baf6=_0x33baf6||0xcc;return function(_0x272c58){if(_0x272c58){return _0x5148ef[_0x8481('0x17')](_0x33baf6);}return _0x5148ef[_0x8481('0x18')](_0x33baf6)[_0x8481('0x19')]();};}function respondWithResult(_0x2313b7,_0x5590d5){_0x5590d5=_0x5590d5||0xc8;return function(_0x5f1a56){if(_0x5f1a56){return _0x2313b7[_0x8481('0x18')](_0x5590d5)[_0x8481('0x1a')](_0x5f1a56);}};}function respondWithFilteredResult(_0x553714,_0x1c22e6){return function(_0x4433cb){if(_0x4433cb){var _0x3dd10e=typeof _0x1c22e6[_0x8481('0x1b')]===_0x8481('0x1c')&&typeof _0x1c22e6[_0x8481('0x1d')]===_0x8481('0x1c');var _0x53fa95=_0x4433cb[_0x8481('0x1e')];var _0x15fe6a=_0x3dd10e?0x0:_0x1c22e6[_0x8481('0x1b')];var _0xd0a485=_0x3dd10e?_0x4433cb[_0x8481('0x1e')]:_0x1c22e6[_0x8481('0x1b')]+_0x1c22e6['limit'];var _0x47dc23;if(_0xd0a485>=_0x53fa95){_0xd0a485=_0x53fa95;_0x47dc23=0xc8;}else{_0x47dc23=0xce;}_0x553714['status'](_0x47dc23);return _0x553714[_0x8481('0x1f')]('Content-Range',_0x15fe6a+'-'+_0xd0a485+'/'+_0x53fa95)[_0x8481('0x1a')](_0x4433cb);}return null;};}function patchUpdates(_0x1c2336){return function(_0x373666){try{jsonpatch[_0x8481('0x20')](_0x373666,_0x1c2336,!![]);}catch(_0x38ba89){return BPromise[_0x8481('0x21')](_0x38ba89);}return _0x373666[_0x8481('0x22')]();};}function saveUpdates(_0xc6ac7a,_0x37f153){return function(_0xf549e9){if(_0xf549e9){return _0xf549e9[_0x8481('0x23')](_0xc6ac7a)['then'](function(_0xabb2a6){return _0xabb2a6;});}return null;};}function removeEntity(_0x4000ca,_0x35e9f7){return function(_0xc57762){if(_0xc57762){return _0xc57762[_0x8481('0x24')]()[_0x8481('0x25')](function(){_0x4000ca[_0x8481('0x18')](0xcc)[_0x8481('0x19')]();});}};}function handleEntityNotFound(_0x3fab49,_0x4cbad6){return function(_0xd4571d){if(!_0xd4571d){_0x3fab49[_0x8481('0x17')](0x194);}return _0xd4571d;};}function handleError(_0x520a8c,_0x5bb82e){_0x5bb82e=_0x5bb82e||0x1f4;return function(_0x2a2769){logger['error'](_0x2a2769['stack']);if(_0x2a2769[_0x8481('0x26')]){delete _0x2a2769[_0x8481('0x26')];}_0x520a8c['status'](_0x5bb82e)[_0x8481('0x27')](_0x2a2769);};}exports[_0x8481('0x28')]=function(_0x3812d0,_0x324ee0){var _0x5bc54e={},_0x5f0d58={},_0x1929a9={'count':0x0,'rows':[]};var _0xb978a8=_[_0x8481('0x29')](db['VtigerField'][_0x8481('0x2a')],function(_0x499259){return{'name':_0x499259['fieldName'],'type':_0x499259['type'][_0x8481('0x2b')]};});_0x5f0d58['model']=_[_0x8481('0x29')](_0xb978a8,'name');_0x5f0d58['query']=_[_0x8481('0x2c')](_0x3812d0[_0x8481('0x2d')]);_0x5f0d58[_0x8481('0x2e')]=_[_0x8481('0x2f')](_0x5f0d58['model'],_0x5f0d58[_0x8481('0x2d')]);_0x5bc54e[_0x8481('0x30')]=_['intersection'](_0x5f0d58['model'],qs['fields'](_0x3812d0['query'][_0x8481('0x31')]));_0x5bc54e['attributes']=_0x5bc54e[_0x8481('0x30')][_0x8481('0x32')]?_0x5bc54e[_0x8481('0x30')]:_0x5f0d58[_0x8481('0x33')];if(!_0x3812d0[_0x8481('0x2d')][_0x8481('0x34')](_0x8481('0x35'))){_0x5bc54e[_0x8481('0x1d')]=qs[_0x8481('0x1d')](_0x3812d0[_0x8481('0x2d')][_0x8481('0x1d')]);_0x5bc54e[_0x8481('0x1b')]=qs[_0x8481('0x1b')](_0x3812d0[_0x8481('0x2d')][_0x8481('0x1b')]);}_0x5bc54e[_0x8481('0x36')]=qs['sort'](_0x3812d0[_0x8481('0x2d')][_0x8481('0x37')]);_0x5bc54e[_0x8481('0x38')]=qs[_0x8481('0x2e')](_[_0x8481('0x39')](_0x3812d0[_0x8481('0x2d')],_0x5f0d58[_0x8481('0x2e')]),_0xb978a8);if(_0x3812d0['query']['filter']){_0x5bc54e[_0x8481('0x38')]=_['merge'](_0x5bc54e[_0x8481('0x38')],{'$or':_[_0x8481('0x29')](_0xb978a8,function(_0x36b9d8){if(_0x36b9d8[_0x8481('0x3a')]!==_0x8481('0x3b')){var _0x36f7fb={};_0x36f7fb[_0x36b9d8['name']]={'$like':'%'+_0x3812d0[_0x8481('0x2d')][_0x8481('0x3c')]+'%'};return _0x36f7fb;}})});}_0x5bc54e=_[_0x8481('0x3d')]({},_0x5bc54e,_0x3812d0[_0x8481('0x3e')]);var _0x3d0fdb={'where':_0x5bc54e[_0x8481('0x38')]};return db[_0x8481('0x3f')][_0x8481('0x1e')](_0x3d0fdb)['then'](function(_0x4b1ba0){_0x1929a9[_0x8481('0x1e')]=_0x4b1ba0;if(_0x3812d0['query'][_0x8481('0x40')]){_0x5bc54e[_0x8481('0x41')]=[{'all':!![]}];}return db['VtigerField'][_0x8481('0x42')](_0x5bc54e);})[_0x8481('0x25')](function(_0x3a04c4){_0x1929a9[_0x8481('0x43')]=_0x3a04c4;return _0x1929a9;})[_0x8481('0x25')](respondWithFilteredResult(_0x324ee0,_0x5bc54e))['catch'](handleError(_0x324ee0,null));};exports['show']=function(_0x24884e,_0x5f3ba5){var _0xe7905a={'raw':!![],'where':{'id':_0x24884e[_0x8481('0x44')]['id']}},_0x21a730={};_0x21a730[_0x8481('0x33')]=_[_0x8481('0x2c')](db['VtigerField'][_0x8481('0x2a')]);_0x21a730[_0x8481('0x2d')]=_[_0x8481('0x2c')](_0x24884e[_0x8481('0x2d')]);_0x21a730[_0x8481('0x2e')]=_['intersection'](_0x21a730[_0x8481('0x33')],_0x21a730[_0x8481('0x2d')]);_0xe7905a[_0x8481('0x30')]=_['intersection'](_0x21a730[_0x8481('0x33')],qs[_0x8481('0x31')](_0x24884e['query']['fields']));_0xe7905a[_0x8481('0x30')]=_0xe7905a[_0x8481('0x30')][_0x8481('0x32')]?_0xe7905a[_0x8481('0x30')]:_0x21a730[_0x8481('0x33')];if(_0x24884e['query'][_0x8481('0x40')]){_0xe7905a[_0x8481('0x41')]=[{'all':!![]}];}_0xe7905a=_[_0x8481('0x3d')]({},_0xe7905a,_0x24884e[_0x8481('0x3e')]);return db[_0x8481('0x3f')][_0x8481('0x45')](_0xe7905a)['then'](handleEntityNotFound(_0x5f3ba5,null))[_0x8481('0x25')](respondWithResult(_0x5f3ba5,null))[_0x8481('0x46')](handleError(_0x5f3ba5,null));};exports[_0x8481('0x47')]=function(_0x5ad4fa,_0x50fce0){return db['VtigerField'][_0x8481('0x47')](_0x5ad4fa[_0x8481('0x48')],{})[_0x8481('0x25')](respondWithResult(_0x50fce0,0xc9))[_0x8481('0x46')](handleError(_0x50fce0,null));};exports[_0x8481('0x23')]=function(_0x439d31,_0x2e0435){if(_0x439d31[_0x8481('0x48')]['id']){delete _0x439d31['body']['id'];}return db[_0x8481('0x3f')][_0x8481('0x45')]({'where':{'id':_0x439d31['params']['id']}})[_0x8481('0x25')](handleEntityNotFound(_0x2e0435,null))[_0x8481('0x25')](saveUpdates(_0x439d31['body'],null))[_0x8481('0x25')](respondWithResult(_0x2e0435,null))[_0x8481('0x46')](handleError(_0x2e0435,null));};exports[_0x8481('0x24')]=function(_0x347ebf,_0x223bdf){return db['VtigerField'][_0x8481('0x45')]({'where':{'id':_0x347ebf['params']['id']}})[_0x8481('0x25')](handleEntityNotFound(_0x223bdf,null))[_0x8481('0x25')](removeEntity(_0x223bdf,null))['catch'](handleError(_0x223bdf,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6f0124d..3081771 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 _0x4ad1=['request-promise','path','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','api','bluebird'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4ad1,0x14f));var _0x14ad=function(_0x32a43a,_0x2dbdd7){_0x32a43a=_0x32a43a-0x0;var _0x337bcc=_0x4ad1[_0x32a43a];return _0x337bcc;};'use strict';var _=require(_0x14ad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14ad('0x1'));var moment=require('moment');var BPromise=require(_0x14ad('0x2'));var rp=require(_0x14ad('0x3'));var fs=require('fs');var path=require(_0x14ad('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x14ad('0x5'));module[_0x14ad('0x6')]=function(_0x1abcf0,_0x2fc971){return _0x1abcf0[_0x14ad('0x7')](_0x14ad('0x8'),attributes,{'tableName':_0x14ad('0x9'),'paranoid':![],'indexes':[{'name':_0x14ad('0xa'),'fields':[_0x14ad('0xb'),_0x14ad('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d59=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./intVtigerField.attributes','define','VtigerField'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0x2d59,0x1b6));var _0x92d5=function(_0x5dbbf4,_0xb191f7){_0x5dbbf4=_0x5dbbf4-0x0;var _0x2d67cb=_0x2d59[_0x5dbbf4];return _0x2d67cb;};'use strict';var _=require(_0x92d5('0x0'));var util=require(_0x92d5('0x1'));var logger=require(_0x92d5('0x2'))(_0x92d5('0x3'));var moment=require('moment');var BPromise=require(_0x92d5('0x4'));var rp=require(_0x92d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x92d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x92d5('0x7'));module['exports']=function(_0x210ccf,_0x3dbdac){return _0x210ccf[_0x92d5('0x8')](_0x92d5('0x9'),attributes,{'tableName':_0x92d5('0xa'),'paranoid':![],'indexes':[{'name':_0x92d5('0xb'),'fields':[_0x92d5('0xc'),_0x92d5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 0954cba..a08a370 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 _0x7e65=['message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x243c78,_0x7ebdb3){var _0x286455=function(_0x58900c){while(--_0x58900c){_0x243c78['push'](_0x243c78['shift']());}};_0x286455(++_0x7ebdb3);}(_0x7e65,0x10a));var _0x57e6=function(_0x557cef,_0x355af6){_0x557cef=_0x557cef-0x0;var _0x3b7cc2=_0x7e65[_0x557cef];return _0x3b7cc2;};'use strict';var _=require(_0x57e6('0x0'));var util=require(_0x57e6('0x1'));var moment=require(_0x57e6('0x2'));var BPromise=require(_0x57e6('0x3'));var rs=require(_0x57e6('0x4'));var fs=require('fs');var Redis=require(_0x57e6('0x5'));var db=require(_0x57e6('0x6'))['db'];var utils=require(_0x57e6('0x7'));var logger=require(_0x57e6('0x8'))(_0x57e6('0x9'));var config=require(_0x57e6('0xa'));var jayson=require(_0x57e6('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x14a57b,_0x468096,_0x3c45bc){return new BPromise(function(_0x22a941,_0x233021){return client[_0x57e6('0xc')](_0x14a57b,_0x3c45bc)[_0x57e6('0xd')](function(_0x450396){logger['info'](_0x57e6('0xe'),_0x468096,'request\x20sent');logger[_0x57e6('0xf')](_0x57e6('0x10'),_0x468096,_0x57e6('0x11'),JSON[_0x57e6('0x12')](_0x450396));if(_0x450396[_0x57e6('0x13')]){if(_0x450396[_0x57e6('0x13')]['code']===0x1f4){logger[_0x57e6('0x13')](_0x57e6('0xe'),_0x468096,_0x450396['error'][_0x57e6('0x14')]);return _0x233021(_0x450396['error'][_0x57e6('0x14')]);}logger[_0x57e6('0x13')]('VtigerField,\x20%s,\x20%s',_0x468096,_0x450396[_0x57e6('0x13')][_0x57e6('0x14')]);return _0x22a941(_0x450396[_0x57e6('0x13')][_0x57e6('0x14')]);}else{logger[_0x57e6('0x15')](_0x57e6('0xe'),_0x468096,_0x57e6('0x11'));_0x22a941(_0x450396['result']['message']);}})['catch'](function(_0xd5816b){logger[_0x57e6('0x13')](_0x57e6('0xe'),_0x468096,_0xd5816b);_0x233021(_0xd5816b);});});} \ No newline at end of file +var _0xbe34=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2dd9c0,_0x5c6635){var _0x488ba0=function(_0x3f8861){while(--_0x3f8861){_0x2dd9c0['push'](_0x2dd9c0['shift']());}};_0x488ba0(++_0x5c6635);}(_0xbe34,0x191));var _0x4be3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbe34[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x4be3('0x0'));var moment=require(_0x4be3('0x1'));var BPromise=require(_0x4be3('0x2'));var rs=require(_0x4be3('0x3'));var fs=require('fs');var Redis=require(_0x4be3('0x4'));var db=require(_0x4be3('0x5'))['db'];var utils=require(_0x4be3('0x6'));var logger=require(_0x4be3('0x7'))(_0x4be3('0x8'));var config=require(_0x4be3('0x9'));var jayson=require(_0x4be3('0xa'));var client=jayson[_0x4be3('0xb')][_0x4be3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x375d2c,_0x3b578a,_0x1caab7){return new BPromise(function(_0x2fab76,_0x3c9d90){return client[_0x4be3('0xd')](_0x375d2c,_0x1caab7)[_0x4be3('0xe')](function(_0xbe6df7){logger['info'](_0x4be3('0xf'),_0x3b578a,_0x4be3('0x10'));logger[_0x4be3('0x11')](_0x4be3('0x12'),_0x3b578a,_0x4be3('0x10'),JSON[_0x4be3('0x13')](_0xbe6df7));if(_0xbe6df7[_0x4be3('0x14')]){if(_0xbe6df7[_0x4be3('0x14')][_0x4be3('0x15')]===0x1f4){logger[_0x4be3('0x14')](_0x4be3('0xf'),_0x3b578a,_0xbe6df7[_0x4be3('0x14')][_0x4be3('0x16')]);return _0x3c9d90(_0xbe6df7[_0x4be3('0x14')][_0x4be3('0x16')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x3b578a,_0xbe6df7[_0x4be3('0x14')][_0x4be3('0x16')]);return _0x2fab76(_0xbe6df7[_0x4be3('0x14')]['message']);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0x3b578a,_0x4be3('0x10'));_0x2fab76(_0xbe6df7['result'][_0x4be3('0x16')]);}})[_0x4be3('0x17')](function(_0xb8f2ed){logger[_0x4be3('0x14')](_0x4be3('0xf'),_0x3b578a,_0xb8f2ed);_0x3c9d90(_0xb8f2ed);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4e5e517..029e77f 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 _0xb8cd=['/:id','isAuthenticated','getConfigurations','post','create','/:id/configurations','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','index'];(function(_0x38226a,_0x18e31a){var _0x2fcd4a=function(_0x35ba36){while(--_0x35ba36){_0x38226a['push'](_0x38226a['shift']());}};_0x2fcd4a(++_0x18e31a);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x14d5d4,_0x306d19){_0x14d5d4=_0x14d5d4-0x0;var _0x50988a=_0xb8cd[_0x14d5d4];return _0x50988a;};'use strict';var multer=require(_0xdb8c('0x0'));var util=require(_0xdb8c('0x1'));var path=require(_0xdb8c('0x2'));var timeout=require(_0xdb8c('0x3'));var express=require(_0xdb8c('0x4'));var router=express['Router']();var fs_extra=require(_0xdb8c('0x5'));var auth=require(_0xdb8c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdb8c('0x7'));var controller=require(_0xdb8c('0x8'));router[_0xdb8c('0x9')]('/',auth['isAuthenticated'](),controller[_0xdb8c('0xa')]);router[_0xdb8c('0x9')](_0xdb8c('0xb'),auth[_0xdb8c('0xc')](),controller['show']);router[_0xdb8c('0x9')]('/:id/configurations',auth[_0xdb8c('0xc')](),controller[_0xdb8c('0xd')]);router[_0xdb8c('0x9')]('/:id/fields',auth[_0xdb8c('0xc')](),controller['getFields']);router[_0xdb8c('0xe')]('/',auth[_0xdb8c('0xc')](),controller[_0xdb8c('0xf')]);router[_0xdb8c('0xe')](_0xdb8c('0x10'),auth[_0xdb8c('0xc')](),controller[_0xdb8c('0x11')]);router[_0xdb8c('0x12')](_0xdb8c('0xb'),auth[_0xdb8c('0xc')](),controller[_0xdb8c('0x13')]);router[_0xdb8c('0x14')](_0xdb8c('0xb'),auth[_0xdb8c('0xc')](),controller['destroy']);module[_0xdb8c('0x15')]=router; \ No newline at end of file +var _0x2304=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','get','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','addConfiguration'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x2304,0x192));var _0x4230=function(_0x3ed5e5,_0x32705b){_0x3ed5e5=_0x3ed5e5-0x0;var _0x4510bb=_0x2304[_0x3ed5e5];return _0x4510bb;};'use strict';var multer=require(_0x4230('0x0'));var util=require(_0x4230('0x1'));var path=require(_0x4230('0x2'));var timeout=require(_0x4230('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4230('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4230('0x5'));var controller=require('./intZendeskAccount.controller');router[_0x4230('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4230('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x4230('0x7')]);router['get'](_0x4230('0x8'),auth['isAuthenticated'](),controller[_0x4230('0x9')]);router['get'](_0x4230('0xa'),auth[_0x4230('0xb')](),controller[_0x4230('0xc')]);router[_0x4230('0xd')]('/',auth['isAuthenticated'](),controller[_0x4230('0xe')]);router['post'](_0x4230('0x8'),auth['isAuthenticated'](),controller[_0x4230('0xf')]);router[_0x4230('0x10')](_0x4230('0x11'),auth[_0x4230('0xb')](),controller[_0x4230('0x12')]);router[_0x4230('0x13')](_0x4230('0x11'),auth[_0x4230('0xb')](),controller[_0x4230('0x14')]);module[_0x4230('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 6ff06c3..532fed0 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 _0x9f0e=['STRING','remoteUri','ENUM','password','integrationTab','sequelize','exports'];(function(_0x81a29c,_0x433615){var _0x1c2ed9=function(_0x100440){while(--_0x100440){_0x81a29c['push'](_0x81a29c['shift']());}};_0x1c2ed9(++_0x433615);}(_0x9f0e,0x116));var _0xe9f0=function(_0x39cac4,_0x82ce86){_0x39cac4=_0x39cac4-0x0;var _0x29bc6e=_0x9f0e[_0x39cac4];return _0x29bc6e;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe9f0('0x2')]},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'authType':{'type':Sequelize[_0xe9f0('0x4')](_0xe9f0('0x5'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe9f0('0x4')](_0xe9f0('0x6'),'newTab'),'defaultValue':_0xe9f0('0x6')}}; \ No newline at end of file +var _0x1298=['exports','STRING','username','remoteUri','password','token','ENUM','integrationTab','newTab'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x1298,0x19e));var _0x8129=function(_0x47846d,_0x4b674f){_0x47846d=_0x47846d-0x0;var _0x6121f7=_0x1298[_0x47846d];return _0x6121f7;};'use strict';var Sequelize=require('sequelize');module[_0x8129('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8129('0x1')]},'username':{'type':Sequelize[_0x8129('0x1')],'unique':_0x8129('0x2')},'password':{'type':Sequelize[_0x8129('0x1')]},'token':{'type':Sequelize[_0x8129('0x1')]},'remoteUri':{'type':Sequelize[_0x8129('0x1')],'unique':_0x8129('0x3')},'authType':{'type':Sequelize['ENUM'](_0x8129('0x4'),_0x8129('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8129('0x6')](_0x8129('0x7'),_0x8129('0x8')),'defaultValue':_0x8129('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 51aa3cf..d271980 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 _0x7916=['hasOwnProperty','order','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','update','body','getConfigurations','ZendeskConfiguration','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','findOne','password','token','remoteUri','slice','substring','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','username','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','limit','status','set','apply','save','then','destroy','error','name','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes'];(function(_0x1dd165,_0x3825c9){var _0x2dacb0=function(_0x135cfd){while(--_0x135cfd){_0x1dd165['push'](_0x1dd165['shift']());}};_0x2dacb0(++_0x3825c9);}(_0x7916,0x128));var _0x6791=function(_0xe6d890,_0x5be152){_0xe6d890=_0xe6d890-0x0;var _0x28d8be=_0x7916[_0xe6d890];return _0x28d8be;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];var integrations=require(_0x6791('0x17'));function respondWithStatusCode(_0x16c62b,_0x423e22){_0x423e22=_0x423e22||0xcc;return function(_0x11c730){if(_0x11c730){return _0x16c62b[_0x6791('0x18')](_0x423e22);}return _0x16c62b['status'](_0x423e22)['end']();};}function respondWithResult(_0x34b28d,_0x5122f9){_0x5122f9=_0x5122f9||0xc8;return function(_0x2a9151){if(_0x2a9151){return _0x34b28d['status'](_0x5122f9)[_0x6791('0x19')](_0x2a9151);}};}function respondWithFilteredResult(_0x163898,_0x517910){return function(_0x3e4792){if(_0x3e4792){var _0x4b80ed=typeof _0x517910[_0x6791('0x1a')]===_0x6791('0x1b')&&typeof _0x517910['limit']===_0x6791('0x1b');var _0x36d7a1=_0x3e4792['count'];var _0x1872f5=_0x4b80ed?0x0:_0x517910['offset'];var _0xe55dba=_0x4b80ed?_0x3e4792[_0x6791('0x1c')]:_0x517910[_0x6791('0x1a')]+_0x517910[_0x6791('0x1d')];var _0x25adbc;if(_0xe55dba>=_0x36d7a1){_0xe55dba=_0x36d7a1;_0x25adbc=0xc8;}else{_0x25adbc=0xce;}_0x163898[_0x6791('0x1e')](_0x25adbc);return _0x163898[_0x6791('0x1f')]('Content-Range',_0x1872f5+'-'+_0xe55dba+'/'+_0x36d7a1)[_0x6791('0x19')](_0x3e4792);}return null;};}function patchUpdates(_0x306acb){return function(_0x51368e){try{jsonpatch[_0x6791('0x20')](_0x51368e,_0x306acb,!![]);}catch(_0x3b57f0){return BPromise['reject'](_0x3b57f0);}return _0x51368e[_0x6791('0x21')]();};}function saveUpdates(_0x309610,_0x15b9ab){return function(_0x12d83b){if(_0x12d83b){return _0x12d83b['update'](_0x309610)[_0x6791('0x22')](function(_0x1b516d){return _0x1b516d;});}return null;};}function removeEntity(_0x4a8717,_0x53bb44){return function(_0x4b23bc){if(_0x4b23bc){return _0x4b23bc[_0x6791('0x23')]()['then'](function(){_0x4a8717[_0x6791('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a092,_0x496273){return function(_0x5cadc){if(!_0x5cadc){_0x54a092[_0x6791('0x18')](0x194);}return _0x5cadc;};}function handleError(_0xd49b84,_0x56a74e){_0x56a74e=_0x56a74e||0x1f4;return function(_0x3def2e){logger[_0x6791('0x24')](_0x3def2e['stack']);if(_0x3def2e[_0x6791('0x25')]){delete _0x3def2e['name'];}_0xd49b84[_0x6791('0x1e')](_0x56a74e)['send'](_0x3def2e);};}exports['index']=function(_0x270a1d,_0x551718){var _0x2f56a2={},_0x34b006={},_0x483d6c={'count':0x0,'rows':[]};var _0x240a9f=_[_0x6791('0x26')](db[_0x6791('0x27')][_0x6791('0x28')],function(_0x5d9d54){return{'name':_0x5d9d54['fieldName'],'type':_0x5d9d54[_0x6791('0x29')]['key']};});_0x34b006[_0x6791('0x2a')]=_[_0x6791('0x26')](_0x240a9f,_0x6791('0x25'));_0x34b006[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x270a1d[_0x6791('0x2b')]);_0x34b006[_0x6791('0x2d')]=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],_0x34b006[_0x6791('0x2b')]);_0x2f56a2['attributes']=_[_0x6791('0x2e')](_0x34b006[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x2f')]));_0x2f56a2[_0x6791('0x30')]=_0x2f56a2['attributes']['length']?_0x2f56a2['attributes']:_0x34b006[_0x6791('0x2a')];if(!_0x270a1d[_0x6791('0x2b')][_0x6791('0x31')]('nolimit')){_0x2f56a2['limit']=qs[_0x6791('0x1d')](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1d')]);_0x2f56a2[_0x6791('0x1a')]=qs['offset'](_0x270a1d[_0x6791('0x2b')][_0x6791('0x1a')]);}_0x2f56a2[_0x6791('0x32')]=qs['sort'](_0x270a1d[_0x6791('0x2b')]['sort']);_0x2f56a2['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x270a1d['query'],_0x34b006[_0x6791('0x2d')]),_0x240a9f);if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x34')]){_0x2f56a2[_0x6791('0x35')]=_[_0x6791('0x36')](_0x2f56a2['where'],{'$or':_[_0x6791('0x26')](_0x240a9f,function(_0xc95516){if(_0xc95516[_0x6791('0x29')]!=='VIRTUAL'){var _0x3a6062={};_0x3a6062[_0xc95516[_0x6791('0x25')]]={'$like':'%'+_0x270a1d[_0x6791('0x2b')]['filter']+'%'};return _0x3a6062;}})});}_0x2f56a2=_[_0x6791('0x36')]({},_0x2f56a2,_0x270a1d[_0x6791('0x37')]);var _0x13be81={'where':_0x2f56a2[_0x6791('0x35')]};return db['ZendeskAccount'][_0x6791('0x1c')](_0x13be81)[_0x6791('0x22')](function(_0x3e95b6){_0x483d6c[_0x6791('0x1c')]=_0x3e95b6;if(_0x270a1d[_0x6791('0x2b')][_0x6791('0x38')]){_0x2f56a2[_0x6791('0x39')]=[{'all':!![]}];}return db[_0x6791('0x27')][_0x6791('0x3a')](_0x2f56a2);})['then'](function(_0x52c03a){_0x483d6c[_0x6791('0x3b')]=_0x52c03a;return _0x483d6c;})[_0x6791('0x22')](respondWithFilteredResult(_0x551718,_0x2f56a2))['catch'](handleError(_0x551718,null));};exports[_0x6791('0x3c')]=function(_0x1c9913,_0x1c6803){var _0x3edb86={'raw':![],'where':{'id':_0x1c9913[_0x6791('0x3d')]['id']}},_0x1a922e={};_0x1a922e[_0x6791('0x2a')]=_['keys'](db[_0x6791('0x27')]['rawAttributes']);_0x1a922e[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x1c9913[_0x6791('0x2b')]);_0x1a922e[_0x6791('0x2d')]=_['intersection'](_0x1a922e[_0x6791('0x2a')],_0x1a922e[_0x6791('0x2b')]);_0x3edb86[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x1a922e[_0x6791('0x2a')],qs[_0x6791('0x2f')](_0x1c9913[_0x6791('0x2b')][_0x6791('0x2f')]));_0x3edb86['attributes']=_0x3edb86[_0x6791('0x30')][_0x6791('0x3e')]?_0x3edb86[_0x6791('0x30')]:_0x1a922e[_0x6791('0x2a')];if(_0x1c9913['query'][_0x6791('0x38')]){_0x3edb86[_0x6791('0x39')]=[{'all':!![]}];}_0x3edb86=_['merge']({},_0x3edb86,_0x1c9913[_0x6791('0x37')]);return db['ZendeskAccount'][_0x6791('0x3f')](_0x3edb86)[_0x6791('0x22')](handleEntityNotFound(_0x1c6803,null))[_0x6791('0x22')](respondWithResult(_0x1c6803,null))[_0x6791('0x40')](handleError(_0x1c6803,null));};exports[_0x6791('0x41')]=function(_0xb2a2,_0x4163f5){return db[_0x6791('0x27')][_0x6791('0x41')](_0xb2a2['body'],{})[_0x6791('0x22')](respondWithResult(_0x4163f5,0xc9))['catch'](handleError(_0x4163f5,null));};exports[_0x6791('0x42')]=function(_0x2bb86a,_0x276002){if(_0x2bb86a[_0x6791('0x43')]['id']){delete _0x2bb86a[_0x6791('0x43')]['id'];}return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x2bb86a[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x276002,null))[_0x6791('0x22')](saveUpdates(_0x2bb86a[_0x6791('0x43')],null))['then'](respondWithResult(_0x276002,null))[_0x6791('0x40')](handleError(_0x276002,null));};exports[_0x6791('0x23')]=function(_0x4ff9f4,_0x3df699){return db['ZendeskAccount'][_0x6791('0x3f')]({'where':{'id':_0x4ff9f4[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x3df699,null))[_0x6791('0x22')](removeEntity(_0x3df699,null))['catch'](handleError(_0x3df699,null));};exports[_0x6791('0x44')]=function(_0x243faf,_0x5655c8,_0x189b22){var _0x4370ab={};var _0x3a895b={};var _0x5df56e;var _0x355e97;return db[_0x6791('0x27')]['findOne']({'where':{'id':_0x243faf[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5655c8,null))['then'](function(_0x169531){if(_0x169531){_0x5df56e=_0x169531;_0x3a895b[_0x6791('0x2a')]=_[_0x6791('0x2c')](db[_0x6791('0x45')]['rawAttributes']);_0x3a895b[_0x6791('0x2b')]=_[_0x6791('0x2c')](_0x243faf[_0x6791('0x2b')]);_0x3a895b['filters']=_['intersection'](_0x3a895b[_0x6791('0x2a')],_0x3a895b[_0x6791('0x2b')]);_0x4370ab[_0x6791('0x30')]=_[_0x6791('0x2e')](_0x3a895b[_0x6791('0x2a')],qs['fields'](_0x243faf['query'][_0x6791('0x2f')]));_0x4370ab['attributes']=_0x4370ab['attributes'][_0x6791('0x3e')]?_0x4370ab[_0x6791('0x30')]:_0x3a895b[_0x6791('0x2a')];_0x4370ab[_0x6791('0x32')]=qs[_0x6791('0x46')](_0x243faf[_0x6791('0x2b')]['sort']);_0x4370ab['where']=qs[_0x6791('0x2d')](_[_0x6791('0x33')](_0x243faf['query'],_0x3a895b[_0x6791('0x2d')]));if(_0x243faf['query'][_0x6791('0x34')]){_0x4370ab[_0x6791('0x35')]=_['merge'](_0x4370ab[_0x6791('0x35')],{'$or':_[_0x6791('0x26')](_0x4370ab[_0x6791('0x30')],function(_0x49ed65){var _0x3ba679={};_0x3ba679[_0x49ed65]={'$like':'%'+_0x243faf[_0x6791('0x2b')][_0x6791('0x34')]+'%'};return _0x3ba679;})});}_0x4370ab=_[_0x6791('0x36')]({},_0x4370ab,_0x243faf[_0x6791('0x37')]);return _0x5df56e['getConfigurations'](_0x4370ab);}})['then'](function(_0x1a9acd){if(_0x1a9acd){_0x355e97=_0x1a9acd[_0x6791('0x3e')];if(!_0x243faf['query'][_0x6791('0x31')](_0x6791('0x47'))){_0x4370ab[_0x6791('0x1d')]=qs[_0x6791('0x1d')](_0x243faf[_0x6791('0x2b')][_0x6791('0x1d')]);_0x4370ab[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x243faf['query'][_0x6791('0x1a')]);}return _0x5df56e[_0x6791('0x44')](_0x4370ab);}})[_0x6791('0x22')](function(_0x1a9a2e){if(_0x1a9a2e){return _0x1a9a2e?{'count':_0x355e97,'rows':_0x1a9a2e}:null;}})['then'](respondWithResult(_0x5655c8,null))[_0x6791('0x40')](handleError(_0x5655c8,null));};exports[_0x6791('0x48')]=function(_0xa8a8dd,_0x5ca809,_0x205320){if(_0xa8a8dd[_0x6791('0x43')]['id']){delete _0xa8a8dd[_0x6791('0x43')]['id'];}return db[_0x6791('0x27')]['findOne']({'where':{'id':_0xa8a8dd[_0x6791('0x3d')]['id']}})[_0x6791('0x22')](handleEntityNotFound(_0x5ca809,null))['then'](function(_0x1114d4){if(_0x1114d4){_0xa8a8dd[_0x6791('0x43')][_0x6791('0x49')]=_0x1114d4['id'];_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4a')]=integrations[_0x6791('0x4b')](_0xa8a8dd['body'][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);_0xa8a8dd['body'][_0x6791('0x4d')]=integrations['getDescriptions'](_0xa8a8dd[_0x6791('0x43')][_0x6791('0x4c')],_0xa8a8dd[_0x6791('0x43')][_0x6791('0x29')]);return db[_0x6791('0x45')]['create'](_0xa8a8dd[_0x6791('0x43')],{'include':[{'model':db[_0x6791('0x4e')],'as':_0x6791('0x4a')},{'model':db[_0x6791('0x4e')],'as':'Descriptions'}]});}return null;})[_0x6791('0x22')](respondWithResult(_0x5ca809,null))[_0x6791('0x40')](handleError(_0x5ca809,null));};exports['getFields']=function(_0x34691c,_0x1fa44a,_0x567302){var _0x201465='';return db[_0x6791('0x27')][_0x6791('0x4f')]({'where':{'id':_0x34691c[_0x6791('0x3d')]['id']},'attributes':['id','username',_0x6791('0x50'),_0x6791('0x51'),'authType',_0x6791('0x52')]})[_0x6791('0x22')](handleEntityNotFound(_0x1fa44a,null))[_0x6791('0x22')](function(_0x20c736){if(_0x20c736){_0x201465=_0x20c736[_0x6791('0x52')];var _0x4ecf62=_0x201465[_0x6791('0x53')](-0x1);if(_0x4ecf62==='/'){_0x201465=_0x201465[_0x6791('0x54')](0x0,_0x201465['lastIndexOf'](_0x4ecf62));}var _0x4463ef={'method':_0x6791('0x55'),'uri':util[_0x6791('0x56')]('%s/%s',_0x201465,_0x6791('0x57')),'json':!![]};switch(_0x20c736[_0x6791('0x58')]){case _0x6791('0x50'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')](_0x6791('0x5a'),new Buffer(util[_0x6791('0x56')](_0x6791('0x5b'),_0x20c736['username'],_0x20c736[_0x6791('0x50')]))[_0x6791('0x5c')]('base64'))};break;case _0x6791('0x51'):_0x4463ef[_0x6791('0x59')]={'Authorization':util[_0x6791('0x56')]('Basic\x20%s',new Buffer(util[_0x6791('0x56')]('%s/token:%s',_0x20c736[_0x6791('0x5d')],_0x20c736[_0x6791('0x51')]))[_0x6791('0x5c')](_0x6791('0x5e')))};break;default:throw new db[(_0x6791('0x5f'))][(_0x6791('0x60'))](_0x6791('0x61'));}return rp(_0x4463ef);}})[_0x6791('0x22')](function(_0x23e0d3){if(_0x23e0d3){var _0x1fa853=[_0x6791('0x62'),_0x6791('0x63'),_0x6791('0x64'),_0x6791('0x65')];_[_0x6791('0x66')](_0x23e0d3[_0x6791('0x57')],function(_0x3b53b8){return _0x1fa853[_0x6791('0x67')](_0x3b53b8[_0x6791('0x29')]);});return{'count':_0x23e0d3['ticket_fields']['length'],'rows':_['map'](_0x23e0d3[_0x6791('0x57')],function(_0x31c1a8){return{'id':_0x31c1a8['id'],'name':_0x31c1a8[_0x6791('0x68')]>0x7?_0x31c1a8[_0x6791('0x69')]:_0x31c1a8[_0x6791('0x29')],'custom':_0x31c1a8[_0x6791('0x68')]>0x7?!![]:![],'options':_0x31c1a8[_0x6791('0x6a')]?_0x31c1a8[_0x6791('0x6a')]:_0x31c1a8[_0x6791('0x6b')]?_0x31c1a8[_0x6791('0x6b')]:[]};})};}})[_0x6791('0x22')](respondWithResult(_0x1fa44a,null))[_0x6791('0x40')](function(_0x44ec4d){var _0x4047b6=_0x34691c[_0x6791('0x2b')][_0x6791('0x6c')]?0x1f4:_0x44ec4d[_0x6791('0x6d')]||0x1f4;logger[_0x6791('0x24')](_0x6791('0x6e'),_0x6791('0x6f'),_0x4047b6,JSON[_0x6791('0x70')](_0x44ec4d));delete _0x44ec4d[_0x6791('0x25')];if(_0x4047b6===0x191){_0x4047b6=0x190;}_0x1fa44a[_0x6791('0x1e')](_0x4047b6)[_0x6791('0x71')](_0x34691c[_0x6791('0x2b')]['test']?{'message':_0x6791('0x72'),'statusCode':_0x44ec4d['statusCode']}:_0x44ec4d);});}; \ No newline at end of file +var _0x5423=['Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','then','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','ZendeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','type','Descriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','lastIndexOf','ticket_fields','headers','Basic\x20%s','format','%s:%s','base64','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x5423,0xe3));var _0x3542=function(_0x41e32d,_0x2e4342){_0x41e32d=_0x41e32d-0x0;var _0x471ede=_0x5423[_0x41e32d];return _0x471ede;};'use strict';var emlformat=require(_0x3542('0x0'));var rimraf=require(_0x3542('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3542('0x2'));var rp=require(_0x3542('0x3'));var moment=require('moment');var BPromise=require(_0x3542('0x4'));var Mustache=require(_0x3542('0x5'));var util=require(_0x3542('0x6'));var path=require(_0x3542('0x7'));var sox=require('sox');var csv=require(_0x3542('0x8'));var ejs=require(_0x3542('0x9'));var fs=require('fs');var fs_extra=require(_0x3542('0xa'));var _=require(_0x3542('0xb'));var squel=require(_0x3542('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3542('0xd'));var toCsv=require(_0x3542('0x8'));var querystring=require('querystring');var Papa=require(_0x3542('0xe'));var Redis=require(_0x3542('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3542('0x10'));var as=require(_0x3542('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3542('0x12'))(_0x3542('0x13'));var utils=require(_0x3542('0x14'));var config=require(_0x3542('0x15'));var licenseUtil=require(_0x3542('0x16'));var db=require(_0x3542('0x17'))['db'];var integrations=require(_0x3542('0x18'));function respondWithStatusCode(_0x43e977,_0x4ee86){_0x4ee86=_0x4ee86||0xcc;return function(_0x1a9062){if(_0x1a9062){return _0x43e977[_0x3542('0x19')](_0x4ee86);}return _0x43e977[_0x3542('0x1a')](_0x4ee86)[_0x3542('0x1b')]();};}function respondWithResult(_0x4bac5b,_0x14fe57){_0x14fe57=_0x14fe57||0xc8;return function(_0x4fb366){if(_0x4fb366){return _0x4bac5b[_0x3542('0x1a')](_0x14fe57)[_0x3542('0x1c')](_0x4fb366);}};}function respondWithFilteredResult(_0xc33d42,_0x546fbd){return function(_0x270312){if(_0x270312){var _0x177fb9=typeof _0x546fbd[_0x3542('0x1d')]==='undefined'&&typeof _0x546fbd[_0x3542('0x1e')]===_0x3542('0x1f');var _0x116859=_0x270312[_0x3542('0x20')];var _0x493d95=_0x177fb9?0x0:_0x546fbd[_0x3542('0x1d')];var _0x53d4aa=_0x177fb9?_0x270312[_0x3542('0x20')]:_0x546fbd[_0x3542('0x1d')]+_0x546fbd['limit'];var _0x1c6403;if(_0x53d4aa>=_0x116859){_0x53d4aa=_0x116859;_0x1c6403=0xc8;}else{_0x1c6403=0xce;}_0xc33d42[_0x3542('0x1a')](_0x1c6403);return _0xc33d42[_0x3542('0x21')](_0x3542('0x22'),_0x493d95+'-'+_0x53d4aa+'/'+_0x116859)[_0x3542('0x1c')](_0x270312);}return null;};}function patchUpdates(_0x4a7695){return function(_0x4a74b0){try{jsonpatch['apply'](_0x4a74b0,_0x4a7695,!![]);}catch(_0x17e3cf){return BPromise['reject'](_0x17e3cf);}return _0x4a74b0[_0x3542('0x23')]();};}function saveUpdates(_0x551645,_0x1d5f1e){return function(_0x55774d){if(_0x55774d){return _0x55774d['update'](_0x551645)[_0x3542('0x24')](function(_0xe3f983){return _0xe3f983;});}return null;};}function removeEntity(_0x5ae097,_0x5d05b2){return function(_0x3fc964){if(_0x3fc964){return _0x3fc964['destroy']()[_0x3542('0x24')](function(){_0x5ae097[_0x3542('0x1a')](0xcc)[_0x3542('0x1b')]();});}};}function handleEntityNotFound(_0x2f2e63,_0x298763){return function(_0xf1f7d0){if(!_0xf1f7d0){_0x2f2e63[_0x3542('0x19')](0x194);}return _0xf1f7d0;};}function handleError(_0x1e156e,_0x18dc6c){_0x18dc6c=_0x18dc6c||0x1f4;return function(_0x2841a1){logger[_0x3542('0x25')](_0x2841a1[_0x3542('0x26')]);if(_0x2841a1[_0x3542('0x27')]){delete _0x2841a1[_0x3542('0x27')];}_0x1e156e[_0x3542('0x1a')](_0x18dc6c)[_0x3542('0x28')](_0x2841a1);};}exports[_0x3542('0x29')]=function(_0x20eda1,_0x3bd666){var _0x5590a2={},_0x31ad47={},_0x35bbc9={'count':0x0,'rows':[]};var _0x2aec76=_['map'](db[_0x3542('0x2a')][_0x3542('0x2b')],function(_0x2e883a){return{'name':_0x2e883a[_0x3542('0x2c')],'type':_0x2e883a['type']['key']};});_0x31ad47[_0x3542('0x2d')]=_[_0x3542('0x2e')](_0x2aec76,_0x3542('0x27'));_0x31ad47[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x20eda1[_0x3542('0x2f')]);_0x31ad47[_0x3542('0x31')]=_['intersection'](_0x31ad47['model'],_0x31ad47[_0x3542('0x2f')]);_0x5590a2['attributes']=_['intersection'](_0x31ad47[_0x3542('0x2d')],qs['fields'](_0x20eda1['query'][_0x3542('0x32')]));_0x5590a2[_0x3542('0x33')]=_0x5590a2[_0x3542('0x33')]['length']?_0x5590a2[_0x3542('0x33')]:_0x31ad47['model'];if(!_0x20eda1[_0x3542('0x2f')][_0x3542('0x34')]('nolimit')){_0x5590a2[_0x3542('0x1e')]=qs['limit'](_0x20eda1[_0x3542('0x2f')][_0x3542('0x1e')]);_0x5590a2[_0x3542('0x1d')]=qs['offset'](_0x20eda1[_0x3542('0x2f')]['offset']);}_0x5590a2[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x20eda1[_0x3542('0x2f')][_0x3542('0x36')]);_0x5590a2[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x20eda1[_0x3542('0x2f')],_0x31ad47[_0x3542('0x31')]),_0x2aec76);if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]){_0x5590a2[_0x3542('0x37')]=_[_0x3542('0x3a')](_0x5590a2['where'],{'$or':_[_0x3542('0x2e')](_0x2aec76,function(_0x4a80ea){if(_0x4a80ea['type']!==_0x3542('0x3b')){var _0x3ffccc={};_0x3ffccc[_0x4a80ea[_0x3542('0x27')]]={'$like':'%'+_0x20eda1[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x3ffccc;}})});}_0x5590a2=_[_0x3542('0x3a')]({},_0x5590a2,_0x20eda1[_0x3542('0x3c')]);var _0x42e87a={'where':_0x5590a2['where']};return db[_0x3542('0x2a')]['count'](_0x42e87a)[_0x3542('0x24')](function(_0x2baa01){_0x35bbc9['count']=_0x2baa01;if(_0x20eda1[_0x3542('0x2f')][_0x3542('0x3d')]){_0x5590a2['include']=[{'all':!![]}];}return db[_0x3542('0x2a')][_0x3542('0x3e')](_0x5590a2);})['then'](function(_0x2682d0){_0x35bbc9[_0x3542('0x3f')]=_0x2682d0;return _0x35bbc9;})[_0x3542('0x24')](respondWithFilteredResult(_0x3bd666,_0x5590a2))[_0x3542('0x40')](handleError(_0x3bd666,null));};exports[_0x3542('0x41')]=function(_0xb12441,_0x2b54b9){var _0x4bf45a={'raw':![],'where':{'id':_0xb12441[_0x3542('0x42')]['id']}},_0x542e0c={};_0x542e0c[_0x3542('0x2d')]=_[_0x3542('0x30')](db[_0x3542('0x2a')][_0x3542('0x2b')]);_0x542e0c['query']=_[_0x3542('0x30')](_0xb12441['query']);_0x542e0c[_0x3542('0x31')]=_[_0x3542('0x43')](_0x542e0c[_0x3542('0x2d')],_0x542e0c['query']);_0x4bf45a[_0x3542('0x33')]=_[_0x3542('0x43')](_0x542e0c['model'],qs[_0x3542('0x32')](_0xb12441[_0x3542('0x2f')][_0x3542('0x32')]));_0x4bf45a[_0x3542('0x33')]=_0x4bf45a[_0x3542('0x33')][_0x3542('0x44')]?_0x4bf45a[_0x3542('0x33')]:_0x542e0c[_0x3542('0x2d')];if(_0xb12441['query']['includeAll']){_0x4bf45a['include']=[{'all':!![]}];}_0x4bf45a=_[_0x3542('0x3a')]({},_0x4bf45a,_0xb12441[_0x3542('0x3c')]);return db[_0x3542('0x2a')][_0x3542('0x45')](_0x4bf45a)[_0x3542('0x24')](handleEntityNotFound(_0x2b54b9,null))[_0x3542('0x24')](respondWithResult(_0x2b54b9,null))[_0x3542('0x40')](handleError(_0x2b54b9,null));};exports['create']=function(_0x157683,_0x14b960){return db[_0x3542('0x2a')][_0x3542('0x46')](_0x157683['body'],{})[_0x3542('0x24')](respondWithResult(_0x14b960,0xc9))[_0x3542('0x40')](handleError(_0x14b960,null));};exports['update']=function(_0x528f8c,_0x1fb253){if(_0x528f8c[_0x3542('0x47')]['id']){delete _0x528f8c[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x528f8c[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x1fb253,null))['then'](saveUpdates(_0x528f8c[_0x3542('0x47')],null))[_0x3542('0x24')](respondWithResult(_0x1fb253,null))[_0x3542('0x40')](handleError(_0x1fb253,null));};exports[_0x3542('0x48')]=function(_0x1ebc82,_0x28be34){return db[_0x3542('0x2a')][_0x3542('0x45')]({'where':{'id':_0x1ebc82[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x28be34,null))['then'](removeEntity(_0x28be34,null))[_0x3542('0x40')](handleError(_0x28be34,null));};exports['getConfigurations']=function(_0x5a798a,_0x572e7a,_0x286222){var _0xd5c5c3={};var _0x381885={};var _0x48cfc4;var _0x2db495;return db[_0x3542('0x2a')]['findOne']({'where':{'id':_0x5a798a[_0x3542('0x42')]['id']}})[_0x3542('0x24')](handleEntityNotFound(_0x572e7a,null))[_0x3542('0x24')](function(_0x196c59){if(_0x196c59){_0x48cfc4=_0x196c59;_0x381885[_0x3542('0x2d')]=_['keys'](db[_0x3542('0x49')][_0x3542('0x2b')]);_0x381885[_0x3542('0x2f')]=_[_0x3542('0x30')](_0x5a798a[_0x3542('0x2f')]);_0x381885['filters']=_['intersection'](_0x381885[_0x3542('0x2d')],_0x381885[_0x3542('0x2f')]);_0xd5c5c3[_0x3542('0x33')]=_['intersection'](_0x381885[_0x3542('0x2d')],qs[_0x3542('0x32')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x32')]));_0xd5c5c3[_0x3542('0x33')]=_0xd5c5c3['attributes']['length']?_0xd5c5c3[_0x3542('0x33')]:_0x381885['model'];_0xd5c5c3[_0x3542('0x35')]=qs[_0x3542('0x36')](_0x5a798a['query'][_0x3542('0x36')]);_0xd5c5c3[_0x3542('0x37')]=qs[_0x3542('0x31')](_[_0x3542('0x38')](_0x5a798a[_0x3542('0x2f')],_0x381885['filters']));if(_0x5a798a['query'][_0x3542('0x39')]){_0xd5c5c3['where']=_[_0x3542('0x3a')](_0xd5c5c3[_0x3542('0x37')],{'$or':_[_0x3542('0x2e')](_0xd5c5c3['attributes'],function(_0xd9c90c){var _0x1f8ddb={};_0x1f8ddb[_0xd9c90c]={'$like':'%'+_0x5a798a[_0x3542('0x2f')][_0x3542('0x39')]+'%'};return _0x1f8ddb;})});}_0xd5c5c3=_[_0x3542('0x3a')]({},_0xd5c5c3,_0x5a798a[_0x3542('0x3c')]);return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})[_0x3542('0x24')](function(_0x3ee446){if(_0x3ee446){_0x2db495=_0x3ee446[_0x3542('0x44')];if(!_0x5a798a[_0x3542('0x2f')][_0x3542('0x34')](_0x3542('0x4a'))){_0xd5c5c3['limit']=qs[_0x3542('0x1e')](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1e')]);_0xd5c5c3[_0x3542('0x1d')]=qs['offset'](_0x5a798a[_0x3542('0x2f')][_0x3542('0x1d')]);}return _0x48cfc4['getConfigurations'](_0xd5c5c3);}})['then'](function(_0x2908e5){if(_0x2908e5){return _0x2908e5?{'count':_0x2db495,'rows':_0x2908e5}:null;}})['then'](respondWithResult(_0x572e7a,null))[_0x3542('0x40')](handleError(_0x572e7a,null));};exports['addConfiguration']=function(_0x484204,_0x42a34a,_0x471408){if(_0x484204[_0x3542('0x47')]['id']){delete _0x484204[_0x3542('0x47')]['id'];}return db[_0x3542('0x2a')][_0x3542('0x4b')]({'where':{'id':_0x484204[_0x3542('0x42')]['id']}})['then'](handleEntityNotFound(_0x42a34a,null))[_0x3542('0x24')](function(_0xf1cf57){if(_0xf1cf57){_0x484204[_0x3542('0x47')][_0x3542('0x4c')]=_0xf1cf57['id'];_0x484204[_0x3542('0x47')]['Subjects']=integrations[_0x3542('0x4d')](_0x484204[_0x3542('0x47')][_0x3542('0x4e')],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);_0x484204[_0x3542('0x47')][_0x3542('0x50')]=integrations['getDescriptions'](_0x484204[_0x3542('0x47')]['channel'],_0x484204[_0x3542('0x47')][_0x3542('0x4f')]);return db[_0x3542('0x49')][_0x3542('0x46')](_0x484204['body'],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0x3542('0x51')],'as':_0x3542('0x50')}]});}return null;})[_0x3542('0x24')](respondWithResult(_0x42a34a,null))[_0x3542('0x40')](handleError(_0x42a34a,null));};exports[_0x3542('0x52')]=function(_0x2afc71,_0x3c84fa,_0x77f0af){var _0x2b0de0='';return db['ZendeskAccount'][_0x3542('0x4b')]({'where':{'id':_0x2afc71[_0x3542('0x42')]['id']},'attributes':['id',_0x3542('0x53'),_0x3542('0x54'),_0x3542('0x55'),'authType','remoteUri']})[_0x3542('0x24')](handleEntityNotFound(_0x3c84fa,null))[_0x3542('0x24')](function(_0x52c26d){if(_0x52c26d){_0x2b0de0=_0x52c26d[_0x3542('0x56')];var _0x4b5327=_0x2b0de0[_0x3542('0x57')](-0x1);if(_0x4b5327==='/'){_0x2b0de0=_0x2b0de0['substring'](0x0,_0x2b0de0[_0x3542('0x58')](_0x4b5327));}var _0x153e1b={'method':'GET','uri':util['format']('%s/%s',_0x2b0de0,_0x3542('0x59')),'json':!![]};switch(_0x52c26d['authType']){case _0x3542('0x54'):_0x153e1b[_0x3542('0x5a')]={'Authorization':util['format'](_0x3542('0x5b'),new Buffer(util[_0x3542('0x5c')](_0x3542('0x5d'),_0x52c26d['username'],_0x52c26d[_0x3542('0x54')]))['toString'](_0x3542('0x5e')))};break;case'token':_0x153e1b[_0x3542('0x5a')]={'Authorization':util[_0x3542('0x5c')](_0x3542('0x5b'),new Buffer(util['format'](_0x3542('0x5f'),_0x52c26d[_0x3542('0x53')],_0x52c26d[_0x3542('0x55')]))[_0x3542('0x60')]('base64'))};break;default:throw new db['Sequelize'][(_0x3542('0x61'))](_0x3542('0x62'));}return rp(_0x153e1b);}})[_0x3542('0x24')](function(_0xaa97d5){if(_0xaa97d5){var _0x191fdd=[_0x3542('0x63'),_0x3542('0x64'),_0x3542('0x65'),_0x3542('0x66')];_[_0x3542('0x67')](_0xaa97d5[_0x3542('0x59')],function(_0x1c318c){return _0x191fdd[_0x3542('0x68')](_0x1c318c[_0x3542('0x4f')]);});return{'count':_0xaa97d5[_0x3542('0x59')][_0x3542('0x44')],'rows':_[_0x3542('0x2e')](_0xaa97d5[_0x3542('0x59')],function(_0x4e04b6){return{'id':_0x4e04b6['id'],'name':_0x4e04b6[_0x3542('0x69')]>0x7?_0x4e04b6[_0x3542('0x6a')]:_0x4e04b6['type'],'custom':_0x4e04b6['position']>0x7?!![]:![],'options':_0x4e04b6[_0x3542('0x6b')]?_0x4e04b6[_0x3542('0x6b')]:_0x4e04b6[_0x3542('0x6c')]?_0x4e04b6[_0x3542('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3c84fa,null))[_0x3542('0x40')](function(_0x2d17ce){var _0x54e723=_0x2afc71[_0x3542('0x2f')]['test']?0x1f4:_0x2d17ce[_0x3542('0x6d')]||0x1f4;logger['error'](_0x3542('0x6e'),_0x3542('0x52'),_0x54e723,JSON[_0x3542('0x6f')](_0x2d17ce));delete _0x2d17ce[_0x3542('0x27')];if(_0x54e723===0x191){_0x54e723=0x190;}_0x3c84fa[_0x3542('0x1a')](_0x54e723)[_0x3542('0x28')](_0x2afc71[_0x3542('0x2f')]['test']?{'message':_0x3542('0x70'),'statusCode':_0x2d17ce['statusCode']}:_0x2d17ce);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a65de78..cc2a9cc 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 _0x14d6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger'];(function(_0x32be2b,_0x1d6719){var _0x1d4473=function(_0x5b3b2b){while(--_0x5b3b2b){_0x32be2b['push'](_0x32be2b['shift']());}};_0x1d4473(++_0x1d6719);}(_0x14d6,0x138));var _0x614d=function(_0x336faa,_0x4c7cc7){_0x336faa=_0x336faa-0x0;var _0xa01383=_0x14d6[_0x336faa];return _0xa01383;};'use strict';var _=require(_0x614d('0x0'));var util=require(_0x614d('0x1'));var logger=require(_0x614d('0x2'))(_0x614d('0x3'));var moment=require(_0x614d('0x4'));var BPromise=require(_0x614d('0x5'));var rp=require(_0x614d('0x6'));var fs=require('fs');var path=require(_0x614d('0x7'));var rimraf=require(_0x614d('0x8'));var config=require(_0x614d('0x9'));var attributes=require(_0x614d('0xa'));var integrations=require('../../components/integrations/configuration');module[_0x614d('0xb')]=function(_0x4f0a24,_0x1fb1e9){return _0x4f0a24[_0x614d('0xc')](_0x614d('0xd'),attributes,{'tableName':_0x614d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e30=['exports','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7e30,0xc5));var _0x07e3=function(_0x3f8a65,_0x405747){_0x3f8a65=_0x3f8a65-0x0;var _0x558655=_0x7e30[_0x3f8a65];return _0x558655;};'use strict';var _=require(_0x07e3('0x0'));var util=require(_0x07e3('0x1'));var logger=require(_0x07e3('0x2'))(_0x07e3('0x3'));var moment=require(_0x07e3('0x4'));var BPromise=require(_0x07e3('0x5'));var rp=require(_0x07e3('0x6'));var fs=require('fs');var path=require(_0x07e3('0x7'));var rimraf=require('rimraf');var config=require(_0x07e3('0x8'));var attributes=require(_0x07e3('0x9'));var integrations=require(_0x07e3('0xa'));module[_0x07e3('0xb')]=function(_0x54b806,_0x39f932){return _0x54b806['define']('ZendeskAccount',attributes,{'tableName':_0x07e3('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 e41ee1f..9ffadae 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 _0xdbb3=['error','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','raw','options','where','attributes','limit','map','include','model','stringify','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x495c52,_0x53c0cc){var _0x2b4bb2=function(_0x536d43){while(--_0x536d43){_0x495c52['push'](_0x495c52['shift']());}};_0x2b4bb2(++_0x53c0cc);}(_0xdbb3,0xbd));var _0x3dbb=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xdbb3[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x3dbb('0x0'));var util=require(_0x3dbb('0x1'));var moment=require(_0x3dbb('0x2'));var BPromise=require(_0x3dbb('0x3'));var rs=require(_0x3dbb('0x4'));var fs=require('fs');var Redis=require(_0x3dbb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3dbb('0x6'))(_0x3dbb('0x7'));var config=require(_0x3dbb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dbb('0x9')][_0x3dbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x560caf,_0x1ecadb,_0x1b39ce){return new BPromise(function(_0x1871a9,_0x2862a7){return client['request'](_0x560caf,_0x1b39ce)[_0x3dbb('0xb')](function(_0x3a2e50){logger['info'](_0x3dbb('0xc'),_0x1ecadb,_0x3dbb('0xd'));logger[_0x3dbb('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x1ecadb,_0x3dbb('0xd'),JSON['stringify'](_0x3a2e50));if(_0x3a2e50[_0x3dbb('0xf')]){if(_0x3a2e50[_0x3dbb('0xf')]['code']===0x1f4){logger[_0x3dbb('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x1ecadb,_0x3a2e50['error']['message']);return _0x2862a7(_0x3a2e50[_0x3dbb('0xf')][_0x3dbb('0x10')]);}logger[_0x3dbb('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x1ecadb,_0x3a2e50[_0x3dbb('0xf')][_0x3dbb('0x10')]);return _0x1871a9(_0x3a2e50['error']['message']);}else{logger[_0x3dbb('0x11')](_0x3dbb('0xc'),_0x1ecadb,_0x3dbb('0xd'));_0x1871a9(_0x3a2e50[_0x3dbb('0x12')]['message']);}})[_0x3dbb('0x13')](function(_0x590537){logger[_0x3dbb('0xf')](_0x3dbb('0xc'),_0x1ecadb,_0x590537);_0x2862a7(_0x590537);});});}exports[_0x3dbb('0x14')]=function(_0x398ec2){var _0x17591f=this;return new Promise(function(_0x2c6b14,_0x5d9854){return db[_0x3dbb('0x15')][_0x3dbb('0x16')]({'raw':_0x398ec2['options']?_0x398ec2['options'][_0x3dbb('0x17')]===undefined?!![]:![]:!![],'where':_0x398ec2[_0x3dbb('0x18')]?_0x398ec2['options'][_0x3dbb('0x19')]||null:null,'attributes':_0x398ec2['options']?_0x398ec2[_0x3dbb('0x18')][_0x3dbb('0x1a')]||null:null,'limit':_0x398ec2[_0x3dbb('0x18')]?_0x398ec2[_0x3dbb('0x18')][_0x3dbb('0x1b')]||null:null,'include':_0x398ec2['options']?_0x398ec2[_0x3dbb('0x18')]['include']?_[_0x3dbb('0x1c')](_0x398ec2['options'][_0x3dbb('0x1d')],function(_0xdf7f3d){return{'model':db[_0xdf7f3d['model']],'as':_0xdf7f3d['as'],'attributes':_0xdf7f3d['attributes'],'include':_0xdf7f3d[_0x3dbb('0x1d')]?_[_0x3dbb('0x1c')](_0xdf7f3d[_0x3dbb('0x1d')],function(_0x1f565c){return{'model':db[_0x1f565c['model']],'as':_0x1f565c['as'],'attributes':_0x1f565c[_0x3dbb('0x1a')],'include':_0x1f565c[_0x3dbb('0x1d')]?_[_0x3dbb('0x1c')](_0x1f565c[_0x3dbb('0x1d')],function(_0x18a1b6){return{'model':db[_0x18a1b6[_0x3dbb('0x1e')]],'as':_0x18a1b6['as'],'attributes':_0x18a1b6[_0x3dbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3dbb('0xb')](function(_0x7cd839){logger[_0x3dbb('0x11')]('GetZendeskAccount',_0x398ec2);logger['debug'](_0x3dbb('0x14'),_0x398ec2,JSON[_0x3dbb('0x1f')](_0x7cd839));_0x2c6b14(_0x7cd839);})['catch'](function(_0x42b4db){logger[_0x3dbb('0xf')]('GetZendeskAccount',_0x42b4db[_0x3dbb('0x10')],_0x398ec2);_0x5d9854(_0x17591f['error'](0x1f4,_0x42b4db['message']));});});};exports[_0x3dbb('0x20')]=function(_0x39b258){var _0x33e241=this;return new Promise(function(_0x4a9c9a,_0x52124a){return db[_0x3dbb('0x15')][_0x3dbb('0x21')]({'raw':_0x39b258[_0x3dbb('0x18')]?_0x39b258['options'][_0x3dbb('0x17')]===undefined?!![]:![]:!![],'where':_0x39b258['options']?_0x39b258[_0x3dbb('0x18')]['where']||null:null,'attributes':_0x39b258[_0x3dbb('0x18')]?_0x39b258[_0x3dbb('0x18')][_0x3dbb('0x1a')]||null:null,'include':_0x39b258[_0x3dbb('0x18')]?_0x39b258[_0x3dbb('0x18')][_0x3dbb('0x1d')]?_[_0x3dbb('0x1c')](_0x39b258[_0x3dbb('0x18')][_0x3dbb('0x1d')],function(_0x36e5ce){return{'model':db[_0x36e5ce[_0x3dbb('0x1e')]],'as':_0x36e5ce['as'],'attributes':_0x36e5ce[_0x3dbb('0x1a')],'include':_0x36e5ce[_0x3dbb('0x1d')]?_[_0x3dbb('0x1c')](_0x36e5ce[_0x3dbb('0x1d')],function(_0x3f8100){return{'model':db[_0x3f8100[_0x3dbb('0x1e')]],'as':_0x3f8100['as'],'attributes':_0x3f8100['attributes'],'include':_0x3f8100[_0x3dbb('0x1d')]?_[_0x3dbb('0x1c')](_0x3f8100['include'],function(_0xb871ba){return{'model':db[_0xb871ba[_0x3dbb('0x1e')]],'as':_0xb871ba['as'],'attributes':_0xb871ba[_0x3dbb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3dbb('0xb')](function(_0x129431){logger[_0x3dbb('0x11')]('ShowZendeskAccount',_0x39b258);logger[_0x3dbb('0xe')](_0x3dbb('0x20'),_0x39b258,JSON[_0x3dbb('0x1f')](_0x129431));_0x4a9c9a(_0x129431);})[_0x3dbb('0x13')](function(_0x33c106){logger['error'](_0x3dbb('0x20'),_0x33c106[_0x3dbb('0x10')],_0x39b258);_0x52124a(_0x33e241['error'](0x1f4,_0x33c106[_0x3dbb('0x10')]));});});}; \ No newline at end of file +var _0xc254=['code','ZendeskAccount,\x20%s,\x20%s','error','message','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','include','map','model','ShowZendeskAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xc254,0x1ed));var _0x4c25=function(_0x31a8eb,_0x3ceefb){_0x31a8eb=_0x31a8eb-0x0;var _0x81004b=_0xc254[_0x31a8eb];return _0x81004b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4c25('0x0'));var BPromise=require(_0x4c25('0x1'));var rs=require(_0x4c25('0x2'));var fs=require('fs');var Redis=require(_0x4c25('0x3'));var db=require(_0x4c25('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4c25('0x5'));var config=require(_0x4c25('0x6'));var jayson=require(_0x4c25('0x7'));var client=jayson[_0x4c25('0x8')][_0x4c25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ec8e5,_0x3be779,_0x556c92){return new BPromise(function(_0x2360c0,_0xff9f5b){return client[_0x4c25('0xa')](_0x3ec8e5,_0x556c92)[_0x4c25('0xb')](function(_0x108ef4){logger[_0x4c25('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x3be779,_0x4c25('0xd'));logger[_0x4c25('0xe')](_0x4c25('0xf'),_0x3be779,_0x4c25('0xd'),JSON[_0x4c25('0x10')](_0x108ef4));if(_0x108ef4['error']){if(_0x108ef4['error'][_0x4c25('0x11')]===0x1f4){logger['error'](_0x4c25('0x12'),_0x3be779,_0x108ef4[_0x4c25('0x13')]['message']);return _0xff9f5b(_0x108ef4[_0x4c25('0x13')]['message']);}logger[_0x4c25('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x3be779,_0x108ef4[_0x4c25('0x13')][_0x4c25('0x14')]);return _0x2360c0(_0x108ef4[_0x4c25('0x13')][_0x4c25('0x14')]);}else{logger[_0x4c25('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x3be779,_0x4c25('0xd'));_0x2360c0(_0x108ef4[_0x4c25('0x15')][_0x4c25('0x14')]);}})[_0x4c25('0x16')](function(_0x234735){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x3be779,_0x234735);_0xff9f5b(_0x234735);});});}exports[_0x4c25('0x17')]=function(_0x9b96ca){var _0xd1a8ba=this;return new Promise(function(_0x137143,_0x39e7e1){return db[_0x4c25('0x18')]['findAll']({'raw':_0x9b96ca['options']?_0x9b96ca[_0x4c25('0x19')][_0x4c25('0x1a')]===undefined?!![]:![]:!![],'where':_0x9b96ca['options']?_0x9b96ca[_0x4c25('0x19')][_0x4c25('0x1b')]||null:null,'attributes':_0x9b96ca[_0x4c25('0x19')]?_0x9b96ca[_0x4c25('0x19')][_0x4c25('0x1c')]||null:null,'limit':_0x9b96ca[_0x4c25('0x19')]?_0x9b96ca['options']['limit']||null:null,'include':_0x9b96ca[_0x4c25('0x19')]?_0x9b96ca['options'][_0x4c25('0x1d')]?_[_0x4c25('0x1e')](_0x9b96ca['options'][_0x4c25('0x1d')],function(_0x52bc21){return{'model':db[_0x52bc21['model']],'as':_0x52bc21['as'],'attributes':_0x52bc21[_0x4c25('0x1c')],'include':_0x52bc21[_0x4c25('0x1d')]?_[_0x4c25('0x1e')](_0x52bc21[_0x4c25('0x1d')],function(_0x807bf7){return{'model':db[_0x807bf7[_0x4c25('0x1f')]],'as':_0x807bf7['as'],'attributes':_0x807bf7[_0x4c25('0x1c')],'include':_0x807bf7[_0x4c25('0x1d')]?_['map'](_0x807bf7[_0x4c25('0x1d')],function(_0x42e8cb){return{'model':db[_0x42e8cb[_0x4c25('0x1f')]],'as':_0x42e8cb['as'],'attributes':_0x42e8cb[_0x4c25('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a3454){logger[_0x4c25('0xc')]('GetZendeskAccount',_0x9b96ca);logger[_0x4c25('0xe')](_0x4c25('0x17'),_0x9b96ca,JSON[_0x4c25('0x10')](_0x3a3454));_0x137143(_0x3a3454);})[_0x4c25('0x16')](function(_0x1448f){logger['error'](_0x4c25('0x17'),_0x1448f[_0x4c25('0x14')],_0x9b96ca);_0x39e7e1(_0xd1a8ba[_0x4c25('0x13')](0x1f4,_0x1448f[_0x4c25('0x14')]));});});};exports[_0x4c25('0x20')]=function(_0xcd6933){var _0xdd32af=this;return new Promise(function(_0x15df0c,_0x10bd9c){return db['ZendeskAccount'][_0x4c25('0x21')]({'raw':_0xcd6933[_0x4c25('0x19')]?_0xcd6933[_0x4c25('0x19')][_0x4c25('0x1a')]===undefined?!![]:![]:!![],'where':_0xcd6933[_0x4c25('0x19')]?_0xcd6933['options']['where']||null:null,'attributes':_0xcd6933[_0x4c25('0x19')]?_0xcd6933[_0x4c25('0x19')][_0x4c25('0x1c')]||null:null,'include':_0xcd6933['options']?_0xcd6933['options']['include']?_[_0x4c25('0x1e')](_0xcd6933['options'][_0x4c25('0x1d')],function(_0x57c47e){return{'model':db[_0x57c47e[_0x4c25('0x1f')]],'as':_0x57c47e['as'],'attributes':_0x57c47e[_0x4c25('0x1c')],'include':_0x57c47e['include']?_[_0x4c25('0x1e')](_0x57c47e[_0x4c25('0x1d')],function(_0x51eb78){return{'model':db[_0x51eb78['model']],'as':_0x51eb78['as'],'attributes':_0x51eb78[_0x4c25('0x1c')],'include':_0x51eb78[_0x4c25('0x1d')]?_[_0x4c25('0x1e')](_0x51eb78[_0x4c25('0x1d')],function(_0x49401d){return{'model':db[_0x49401d['model']],'as':_0x49401d['as'],'attributes':_0x49401d[_0x4c25('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4c25('0xb')](function(_0x51ba0b){logger[_0x4c25('0xc')](_0x4c25('0x20'),_0xcd6933);logger[_0x4c25('0xe')](_0x4c25('0x20'),_0xcd6933,JSON[_0x4c25('0x10')](_0x51ba0b));_0x15df0c(_0x51ba0b);})[_0x4c25('0x16')](function(_0x4ce3ac){logger[_0x4c25('0x13')](_0x4c25('0x20'),_0x4ce3ac[_0x4c25('0x14')],_0xcd6933);_0x10bd9c(_0xdd32af[_0x4c25('0x13')](0x1f4,_0x4ce3ac[_0x4c25('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 924acec..2f022db 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 _0x0713=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','setTags','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0xa381aa,_0xf4f835){var _0x1d091d=function(_0x4e59f6){while(--_0x4e59f6){_0xa381aa['push'](_0xa381aa['shift']());}};_0x1d091d(++_0xf4f835);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var controller=require(_0x3071('0x7'));router[_0x3071('0x8')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0x8')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0x8')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller['getFields']);router[_0x3071('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/descriptions',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x8')](_0x3071('0x11'),auth[_0x3071('0x9')](),controller['getTags']);router['post']('/',auth[_0x3071('0x9')](),controller['create']);router[_0x3071('0x12')](_0x3071('0x11'),auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['put'](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x14')]);router[_0x3071('0x15')](_0x3071('0xb'),auth[_0x3071('0x9')](),controller[_0x3071('0x16')]);module[_0x3071('0x17')]=router; \ No newline at end of file +var _0xf4eb=['put','update','delete','/:id','destroy','exports','multer','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','post','setTags'];(function(_0x5a6af9,_0x418dd5){var _0x2d71c8=function(_0x585409){while(--_0x585409){_0x5a6af9['push'](_0x5a6af9['shift']());}};_0x2d71c8(++_0x418dd5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3d1cc0,_0x360211){_0x3d1cc0=_0x3d1cc0-0x0;var _0x6e01ad=_0xf4eb[_0x3d1cc0];return _0x6e01ad;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var controller=require(_0xbf4e('0x4'));router[_0xbf4e('0x5')]('/',auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x7')]);router[_0xbf4e('0x5')]('/:id',auth[_0xbf4e('0x6')](),controller['show']);router['get'](_0xbf4e('0x8'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0x5')](_0xbf4e('0xa'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0xb')]);router['get']('/:id/descriptions',auth[_0xbf4e('0x6')](),controller['getDescriptions']);router[_0xbf4e('0x5')](_0xbf4e('0xc'),auth['isAuthenticated'](),controller[_0xbf4e('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0xe')]);router[_0xbf4e('0xf')](_0xbf4e('0xc'),auth[_0xbf4e('0x6')](),controller[_0xbf4e('0x10')]);router[_0xbf4e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xbf4e('0x12')]);router[_0xbf4e('0x13')](_0xbf4e('0x14'),auth['isAuthenticated'](),controller[_0xbf4e('0x15')]);module[_0xbf4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index a80f0f5..8989fcc 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 _0x9ad0=['exports','STRING','sequelize'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x9ad0,0xbf));var _0x09ad=function(_0x53c9ab,_0x292c5e){_0x53c9ab=_0x53c9ab-0x0;var _0x39f593=_0x9ad0[_0x53c9ab];return _0x39f593;};'use strict';var Sequelize=require(_0x09ad('0x0'));module[_0x09ad('0x1')]={'name':{'type':Sequelize[_0x09ad('0x2')]},'description':{'type':Sequelize[_0x09ad('0x2')]}}; \ No newline at end of file +var _0x5567=['exports','STRING'];(function(_0x850e8a,_0x44e1d7){var _0x2339eb=function(_0x9b4301){while(--_0x9b4301){_0x850e8a['push'](_0x850e8a['shift']());}};_0x2339eb(++_0x44e1d7);}(_0x5567,0x78));var _0x7556=function(_0x102b30,_0x4a8551){_0x102b30=_0x102b30-0x0;var _0x599fc6=_0x5567[_0x102b30];return _0x599fc6;};'use strict';var Sequelize=require('sequelize');module[_0x7556('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7556('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1c3ad89..77d3691 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 _0xeb09=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','save','then','destroy','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','show','params','length','includeAll','include','find','create','body','update','catch','getFields','nolimit','getSubjects','findOne','ZendeskField','getDescriptions','getTags','Tag','setTags','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1331cc,_0x4fb5d4){var _0x6cc5c8=function(_0x4040ef){while(--_0x4040ef){_0x1331cc['push'](_0x1331cc['shift']());}};_0x6cc5c8(++_0x4fb5d4);}(_0xeb09,0x94));var _0x9eb0=function(_0x188697,_0x1d006a){_0x188697=_0x188697-0x0;var _0x1dfa6c=_0xeb09[_0x188697];return _0x1dfa6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9eb0('0x0'));var zipdir=require(_0x9eb0('0x1'));var jsonpatch=require(_0x9eb0('0x2'));var rp=require(_0x9eb0('0x3'));var moment=require('moment');var BPromise=require(_0x9eb0('0x4'));var Mustache=require(_0x9eb0('0x5'));var util=require(_0x9eb0('0x6'));var path=require(_0x9eb0('0x7'));var sox=require(_0x9eb0('0x8'));var csv=require('to-csv');var ejs=require(_0x9eb0('0x9'));var fs=require('fs');var fs_extra=require(_0x9eb0('0xa'));var _=require(_0x9eb0('0xb'));var squel=require('squel');var crypto=require(_0x9eb0('0xc'));var jsforce=require(_0x9eb0('0xd'));var deskjs=require(_0x9eb0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9eb0('0xf'));var Papa=require(_0x9eb0('0x10'));var Redis=require(_0x9eb0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9eb0('0x12'));var as=require(_0x9eb0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9eb0('0x14'))(_0x9eb0('0x15'));var utils=require(_0x9eb0('0x16'));var config=require(_0x9eb0('0x17'));var licenseUtil=require(_0x9eb0('0x18'));var db=require(_0x9eb0('0x19'))['db'];function respondWithStatusCode(_0x463678,_0x26d59e){_0x26d59e=_0x26d59e||0xcc;return function(_0x49b712){if(_0x49b712){return _0x463678[_0x9eb0('0x1a')](_0x26d59e);}return _0x463678['status'](_0x26d59e)[_0x9eb0('0x1b')]();};}function respondWithResult(_0x121723,_0xc90ad){_0xc90ad=_0xc90ad||0xc8;return function(_0x5c722d){if(_0x5c722d){return _0x121723[_0x9eb0('0x1c')](_0xc90ad)[_0x9eb0('0x1d')](_0x5c722d);}};}function respondWithFilteredResult(_0x2c9d4a,_0x5c94cd){return function(_0x566d9f){if(_0x566d9f){var _0x344e08=typeof _0x5c94cd['offset']===_0x9eb0('0x1e')&&typeof _0x5c94cd['limit']==='undefined';var _0x28c845=_0x566d9f[_0x9eb0('0x1f')];var _0x55f460=_0x344e08?0x0:_0x5c94cd['offset'];var _0x4e4f3a=_0x344e08?_0x566d9f[_0x9eb0('0x1f')]:_0x5c94cd[_0x9eb0('0x20')]+_0x5c94cd[_0x9eb0('0x21')];var _0x4833e8;if(_0x4e4f3a>=_0x28c845){_0x4e4f3a=_0x28c845;_0x4833e8=0xc8;}else{_0x4833e8=0xce;}_0x2c9d4a[_0x9eb0('0x1c')](_0x4833e8);return _0x2c9d4a[_0x9eb0('0x22')]('Content-Range',_0x55f460+'-'+_0x4e4f3a+'/'+_0x28c845)[_0x9eb0('0x1d')](_0x566d9f);}return null;};}function patchUpdates(_0x3b4fb5){return function(_0x29c081){try{jsonpatch[_0x9eb0('0x23')](_0x29c081,_0x3b4fb5,!![]);}catch(_0x5972dc){return BPromise['reject'](_0x5972dc);}return _0x29c081[_0x9eb0('0x24')]();};}function saveUpdates(_0x2dbfbe,_0x59296b){return function(_0xdd7b2){if(_0xdd7b2){return _0xdd7b2['update'](_0x2dbfbe)[_0x9eb0('0x25')](function(_0x9028b5){return _0x9028b5;});}return null;};}function removeEntity(_0x39f273,_0x5c32f2){return function(_0x3b30b8){if(_0x3b30b8){return _0x3b30b8[_0x9eb0('0x26')]()[_0x9eb0('0x25')](function(){_0x39f273['status'](0xcc)[_0x9eb0('0x1b')]();});}};}function handleEntityNotFound(_0x1a7e2f,_0x121562){return function(_0x2e8756){if(!_0x2e8756){_0x1a7e2f[_0x9eb0('0x1a')](0x194);}return _0x2e8756;};}function handleError(_0x547b75,_0x246cbe){_0x246cbe=_0x246cbe||0x1f4;return function(_0x279f65){logger[_0x9eb0('0x27')](_0x279f65[_0x9eb0('0x28')]);if(_0x279f65[_0x9eb0('0x29')]){delete _0x279f65[_0x9eb0('0x29')];}_0x547b75[_0x9eb0('0x1c')](_0x246cbe)[_0x9eb0('0x2a')](_0x279f65);};}exports[_0x9eb0('0x2b')]=function(_0x2a5599,_0xd27f8f){var _0x2cc001={},_0x337ca2={},_0xd29179={'count':0x0,'rows':[]};var _0x536928=_['map'](db[_0x9eb0('0x2c')][_0x9eb0('0x2d')],function(_0x4b21f8){return{'name':_0x4b21f8[_0x9eb0('0x2e')],'type':_0x4b21f8[_0x9eb0('0x2f')][_0x9eb0('0x30')]};});_0x337ca2[_0x9eb0('0x31')]=_[_0x9eb0('0x32')](_0x536928,_0x9eb0('0x29'));_0x337ca2['query']=_[_0x9eb0('0x33')](_0x2a5599[_0x9eb0('0x34')]);_0x337ca2[_0x9eb0('0x35')]=_[_0x9eb0('0x36')](_0x337ca2[_0x9eb0('0x31')],_0x337ca2[_0x9eb0('0x34')]);_0x2cc001[_0x9eb0('0x37')]=_['intersection'](_0x337ca2[_0x9eb0('0x31')],qs['fields'](_0x2a5599[_0x9eb0('0x34')][_0x9eb0('0x38')]));_0x2cc001[_0x9eb0('0x37')]=_0x2cc001[_0x9eb0('0x37')]['length']?_0x2cc001[_0x9eb0('0x37')]:_0x337ca2['model'];if(!_0x2a5599[_0x9eb0('0x34')][_0x9eb0('0x39')]('nolimit')){_0x2cc001[_0x9eb0('0x21')]=qs[_0x9eb0('0x21')](_0x2a5599[_0x9eb0('0x34')]['limit']);_0x2cc001[_0x9eb0('0x20')]=qs[_0x9eb0('0x20')](_0x2a5599[_0x9eb0('0x34')][_0x9eb0('0x20')]);}_0x2cc001[_0x9eb0('0x3a')]=qs['sort'](_0x2a5599[_0x9eb0('0x34')][_0x9eb0('0x3b')]);_0x2cc001[_0x9eb0('0x3c')]=qs[_0x9eb0('0x35')](_[_0x9eb0('0x3d')](_0x2a5599[_0x9eb0('0x34')],_0x337ca2['filters']),_0x536928);if(_0x2a5599['query']['filter']){_0x2cc001[_0x9eb0('0x3c')]=_[_0x9eb0('0x3e')](_0x2cc001[_0x9eb0('0x3c')],{'$or':_[_0x9eb0('0x32')](_0x536928,function(_0x51d2e7){if(_0x51d2e7[_0x9eb0('0x2f')]!==_0x9eb0('0x3f')){var _0x31a212={};_0x31a212[_0x51d2e7[_0x9eb0('0x29')]]={'$like':'%'+_0x2a5599[_0x9eb0('0x34')][_0x9eb0('0x40')]+'%'};return _0x31a212;}})});}_0x2cc001=_[_0x9eb0('0x3e')]({},_0x2cc001,_0x2a5599[_0x9eb0('0x41')]);var _0x4dc00d={'where':_0x2cc001[_0x9eb0('0x3c')]};return db['ZendeskConfiguration'][_0x9eb0('0x1f')](_0x4dc00d)['then'](function(_0x4f71bc){_0xd29179[_0x9eb0('0x1f')]=_0x4f71bc;if(_0x2a5599[_0x9eb0('0x34')]['includeAll']){_0x2cc001['include']=[{'all':!![]}];}return db[_0x9eb0('0x2c')]['findAll'](_0x2cc001);})['then'](function(_0x4b6df8){_0xd29179[_0x9eb0('0x42')]=_0x4b6df8;return _0xd29179;})[_0x9eb0('0x25')](respondWithFilteredResult(_0xd27f8f,_0x2cc001))['catch'](handleError(_0xd27f8f,null));};exports[_0x9eb0('0x43')]=function(_0x57df1b,_0x5a219e){var _0x3b10a1={'raw':![],'where':{'id':_0x57df1b[_0x9eb0('0x44')]['id']}},_0x5c2423={};_0x5c2423['model']=_[_0x9eb0('0x33')](db['ZendeskConfiguration']['rawAttributes']);_0x5c2423['query']=_[_0x9eb0('0x33')](_0x57df1b[_0x9eb0('0x34')]);_0x5c2423['filters']=_[_0x9eb0('0x36')](_0x5c2423[_0x9eb0('0x31')],_0x5c2423['query']);_0x3b10a1['attributes']=_[_0x9eb0('0x36')](_0x5c2423[_0x9eb0('0x31')],qs[_0x9eb0('0x38')](_0x57df1b[_0x9eb0('0x34')][_0x9eb0('0x38')]));_0x3b10a1[_0x9eb0('0x37')]=_0x3b10a1[_0x9eb0('0x37')][_0x9eb0('0x45')]?_0x3b10a1[_0x9eb0('0x37')]:_0x5c2423[_0x9eb0('0x31')];if(_0x57df1b[_0x9eb0('0x34')][_0x9eb0('0x46')]){_0x3b10a1[_0x9eb0('0x47')]=[{'all':!![]}];}_0x3b10a1=_[_0x9eb0('0x3e')]({},_0x3b10a1,_0x57df1b[_0x9eb0('0x41')]);return db[_0x9eb0('0x2c')][_0x9eb0('0x48')](_0x3b10a1)[_0x9eb0('0x25')](handleEntityNotFound(_0x5a219e,null))[_0x9eb0('0x25')](respondWithResult(_0x5a219e,null))['catch'](handleError(_0x5a219e,null));};exports[_0x9eb0('0x49')]=function(_0x326390,_0x24166d){return db[_0x9eb0('0x2c')]['create'](_0x326390[_0x9eb0('0x4a')],{})[_0x9eb0('0x25')](respondWithResult(_0x24166d,0xc9))['catch'](handleError(_0x24166d,null));};exports[_0x9eb0('0x4b')]=function(_0x3c87bc,_0x2bf2e1){if(_0x3c87bc[_0x9eb0('0x4a')]['id']){delete _0x3c87bc['body']['id'];}return db['ZendeskConfiguration']['find']({'where':{'id':_0x3c87bc['params']['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x2bf2e1,null))['then'](saveUpdates(_0x3c87bc['body'],null))['then'](respondWithResult(_0x2bf2e1,null))[_0x9eb0('0x4c')](handleError(_0x2bf2e1,null));};exports[_0x9eb0('0x26')]=function(_0x207d9a,_0x4e8260){return db['ZendeskConfiguration']['find']({'where':{'id':_0x207d9a[_0x9eb0('0x44')]['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x4e8260,null))[_0x9eb0('0x25')](removeEntity(_0x4e8260,null))['catch'](handleError(_0x4e8260,null));};exports[_0x9eb0('0x4d')]=function(_0x3bdb03,_0x5dacd2,_0x478dda){var _0x332ae8={};var _0x32e426={};var _0xac69c2;var _0x11ed4a;return db[_0x9eb0('0x2c')]['findOne']({'where':{'id':_0x3bdb03['params']['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x5dacd2,null))[_0x9eb0('0x25')](function(_0x1975e2){if(_0x1975e2){_0xac69c2=_0x1975e2;_0x32e426[_0x9eb0('0x31')]=_[_0x9eb0('0x33')](db['ZendeskField'][_0x9eb0('0x2d')]);_0x32e426['query']=_[_0x9eb0('0x33')](_0x3bdb03['query']);_0x32e426[_0x9eb0('0x35')]=_[_0x9eb0('0x36')](_0x32e426[_0x9eb0('0x31')],_0x32e426['query']);_0x332ae8['attributes']=_[_0x9eb0('0x36')](_0x32e426[_0x9eb0('0x31')],qs[_0x9eb0('0x38')](_0x3bdb03['query']['fields']));_0x332ae8[_0x9eb0('0x37')]=_0x332ae8[_0x9eb0('0x37')][_0x9eb0('0x45')]?_0x332ae8[_0x9eb0('0x37')]:_0x32e426[_0x9eb0('0x31')];_0x332ae8[_0x9eb0('0x3a')]=qs[_0x9eb0('0x3b')](_0x3bdb03[_0x9eb0('0x34')][_0x9eb0('0x3b')]);_0x332ae8[_0x9eb0('0x3c')]=qs[_0x9eb0('0x35')](_[_0x9eb0('0x3d')](_0x3bdb03[_0x9eb0('0x34')],_0x32e426[_0x9eb0('0x35')]));if(_0x3bdb03[_0x9eb0('0x34')]['filter']){_0x332ae8['where']=_[_0x9eb0('0x3e')](_0x332ae8[_0x9eb0('0x3c')],{'$or':_['map'](_0x332ae8['attributes'],function(_0x3dfd1e){var _0x13047f={};_0x13047f[_0x3dfd1e]={'$like':'%'+_0x3bdb03[_0x9eb0('0x34')][_0x9eb0('0x40')]+'%'};return _0x13047f;})});}_0x332ae8=_['merge']({},_0x332ae8,_0x3bdb03[_0x9eb0('0x41')]);return _0xac69c2['getFields'](_0x332ae8);}})[_0x9eb0('0x25')](function(_0x2693e4){if(_0x2693e4){_0x11ed4a=_0x2693e4['length'];if(!_0x3bdb03['query'][_0x9eb0('0x39')](_0x9eb0('0x4e'))){_0x332ae8['limit']=qs[_0x9eb0('0x21')](_0x3bdb03['query'][_0x9eb0('0x21')]);_0x332ae8['offset']=qs[_0x9eb0('0x20')](_0x3bdb03[_0x9eb0('0x34')][_0x9eb0('0x20')]);}return _0xac69c2['getFields'](_0x332ae8);}})[_0x9eb0('0x25')](function(_0x5b9469){if(_0x5b9469){return _0x5b9469?{'count':_0x11ed4a,'rows':_0x5b9469}:null;}})[_0x9eb0('0x25')](respondWithResult(_0x5dacd2,null))[_0x9eb0('0x4c')](handleError(_0x5dacd2,null));};exports[_0x9eb0('0x4f')]=function(_0x28cc57,_0x190fdf,_0x554026){var _0x596003={};var _0x475c7e={};var _0xe87890;var _0xe827b6;return db[_0x9eb0('0x2c')][_0x9eb0('0x50')]({'where':{'id':_0x28cc57[_0x9eb0('0x44')]['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x190fdf,null))[_0x9eb0('0x25')](function(_0x2edb7d){if(_0x2edb7d){_0xe87890=_0x2edb7d;_0x475c7e['model']=_[_0x9eb0('0x33')](db[_0x9eb0('0x51')][_0x9eb0('0x2d')]);_0x475c7e['query']=_[_0x9eb0('0x33')](_0x28cc57[_0x9eb0('0x34')]);_0x475c7e[_0x9eb0('0x35')]=_[_0x9eb0('0x36')](_0x475c7e['model'],_0x475c7e[_0x9eb0('0x34')]);_0x596003[_0x9eb0('0x37')]=_['intersection'](_0x475c7e[_0x9eb0('0x31')],qs[_0x9eb0('0x38')](_0x28cc57[_0x9eb0('0x34')][_0x9eb0('0x38')]));_0x596003[_0x9eb0('0x37')]=_0x596003[_0x9eb0('0x37')][_0x9eb0('0x45')]?_0x596003[_0x9eb0('0x37')]:_0x475c7e[_0x9eb0('0x31')];_0x596003[_0x9eb0('0x3a')]=qs[_0x9eb0('0x3b')](_0x28cc57[_0x9eb0('0x34')][_0x9eb0('0x3b')]);_0x596003[_0x9eb0('0x3c')]=qs[_0x9eb0('0x35')](_[_0x9eb0('0x3d')](_0x28cc57[_0x9eb0('0x34')],_0x475c7e[_0x9eb0('0x35')]));if(_0x28cc57[_0x9eb0('0x34')]['filter']){_0x596003[_0x9eb0('0x3c')]=_[_0x9eb0('0x3e')](_0x596003[_0x9eb0('0x3c')],{'$or':_[_0x9eb0('0x32')](_0x596003[_0x9eb0('0x37')],function(_0x53b3bf){var _0x5e1fe2={};_0x5e1fe2[_0x53b3bf]={'$like':'%'+_0x28cc57[_0x9eb0('0x34')][_0x9eb0('0x40')]+'%'};return _0x5e1fe2;})});}_0x596003=_['merge']({},_0x596003,_0x28cc57[_0x9eb0('0x41')]);return _0xe87890[_0x9eb0('0x4f')](_0x596003);}})['then'](function(_0x40a517){if(_0x40a517){_0xe827b6=_0x40a517['length'];if(!_0x28cc57[_0x9eb0('0x34')][_0x9eb0('0x39')](_0x9eb0('0x4e'))){_0x596003[_0x9eb0('0x21')]=qs[_0x9eb0('0x21')](_0x28cc57[_0x9eb0('0x34')][_0x9eb0('0x21')]);_0x596003[_0x9eb0('0x20')]=qs['offset'](_0x28cc57[_0x9eb0('0x34')][_0x9eb0('0x20')]);}return _0xe87890[_0x9eb0('0x4f')](_0x596003);}})[_0x9eb0('0x25')](function(_0x341a34){if(_0x341a34){return _0x341a34?{'count':_0xe827b6,'rows':_0x341a34}:null;}})[_0x9eb0('0x25')](respondWithResult(_0x190fdf,null))['catch'](handleError(_0x190fdf,null));};exports[_0x9eb0('0x52')]=function(_0x16feee,_0x4caaf3,_0x30b4b2){var _0x55723c={};var _0x11c9d2={};var _0x5037bf;var _0x17d7c4;return db[_0x9eb0('0x2c')][_0x9eb0('0x50')]({'where':{'id':_0x16feee[_0x9eb0('0x44')]['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x4caaf3,null))[_0x9eb0('0x25')](function(_0x415d74){if(_0x415d74){_0x5037bf=_0x415d74;_0x11c9d2[_0x9eb0('0x31')]=_[_0x9eb0('0x33')](db[_0x9eb0('0x51')][_0x9eb0('0x2d')]);_0x11c9d2[_0x9eb0('0x34')]=_['keys'](_0x16feee['query']);_0x11c9d2[_0x9eb0('0x35')]=_[_0x9eb0('0x36')](_0x11c9d2[_0x9eb0('0x31')],_0x11c9d2[_0x9eb0('0x34')]);_0x55723c[_0x9eb0('0x37')]=_[_0x9eb0('0x36')](_0x11c9d2[_0x9eb0('0x31')],qs[_0x9eb0('0x38')](_0x16feee[_0x9eb0('0x34')][_0x9eb0('0x38')]));_0x55723c['attributes']=_0x55723c['attributes']['length']?_0x55723c['attributes']:_0x11c9d2[_0x9eb0('0x31')];_0x55723c[_0x9eb0('0x3a')]=qs[_0x9eb0('0x3b')](_0x16feee[_0x9eb0('0x34')][_0x9eb0('0x3b')]);_0x55723c[_0x9eb0('0x3c')]=qs[_0x9eb0('0x35')](_['pick'](_0x16feee[_0x9eb0('0x34')],_0x11c9d2[_0x9eb0('0x35')]));if(_0x16feee[_0x9eb0('0x34')][_0x9eb0('0x40')]){_0x55723c['where']=_['merge'](_0x55723c[_0x9eb0('0x3c')],{'$or':_[_0x9eb0('0x32')](_0x55723c[_0x9eb0('0x37')],function(_0x3890ef){var _0x40ef5e={};_0x40ef5e[_0x3890ef]={'$like':'%'+_0x16feee['query'][_0x9eb0('0x40')]+'%'};return _0x40ef5e;})});}_0x55723c=_[_0x9eb0('0x3e')]({},_0x55723c,_0x16feee[_0x9eb0('0x41')]);return _0x5037bf['getDescriptions'](_0x55723c);}})[_0x9eb0('0x25')](function(_0x584dc2){if(_0x584dc2){_0x17d7c4=_0x584dc2[_0x9eb0('0x45')];if(!_0x16feee[_0x9eb0('0x34')][_0x9eb0('0x39')]('nolimit')){_0x55723c[_0x9eb0('0x21')]=qs['limit'](_0x16feee['query'][_0x9eb0('0x21')]);_0x55723c[_0x9eb0('0x20')]=qs[_0x9eb0('0x20')](_0x16feee['query'][_0x9eb0('0x20')]);}return _0x5037bf['getDescriptions'](_0x55723c);}})[_0x9eb0('0x25')](function(_0x1e1886){if(_0x1e1886){return _0x1e1886?{'count':_0x17d7c4,'rows':_0x1e1886}:null;}})['then'](respondWithResult(_0x4caaf3,null))['catch'](handleError(_0x4caaf3,null));};exports[_0x9eb0('0x53')]=function(_0xdba149,_0x2f9797,_0x5ec5fd){var _0x3b071e={};var _0x233a61={};var _0x171a13;var _0x1ee4db;return db[_0x9eb0('0x2c')][_0x9eb0('0x50')]({'where':{'id':_0xdba149[_0x9eb0('0x44')]['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x2f9797,null))['then'](function(_0x41bd12){if(_0x41bd12){_0x171a13=_0x41bd12;_0x233a61[_0x9eb0('0x31')]=_[_0x9eb0('0x33')](db[_0x9eb0('0x54')]['rawAttributes']);_0x233a61['query']=_[_0x9eb0('0x33')](_0xdba149[_0x9eb0('0x34')]);_0x233a61['filters']=_[_0x9eb0('0x36')](_0x233a61[_0x9eb0('0x31')],_0x233a61[_0x9eb0('0x34')]);_0x3b071e['attributes']=_['intersection'](_0x233a61[_0x9eb0('0x31')],qs[_0x9eb0('0x38')](_0xdba149[_0x9eb0('0x34')][_0x9eb0('0x38')]));_0x3b071e[_0x9eb0('0x37')]=_0x3b071e[_0x9eb0('0x37')][_0x9eb0('0x45')]?_0x3b071e[_0x9eb0('0x37')]:_0x233a61['model'];_0x3b071e[_0x9eb0('0x3a')]=qs['sort'](_0xdba149[_0x9eb0('0x34')][_0x9eb0('0x3b')]);_0x3b071e[_0x9eb0('0x3c')]=qs[_0x9eb0('0x35')](_['pick'](_0xdba149['query'],_0x233a61['filters']));if(_0xdba149['query'][_0x9eb0('0x40')]){_0x3b071e[_0x9eb0('0x3c')]=_[_0x9eb0('0x3e')](_0x3b071e['where'],{'$or':_[_0x9eb0('0x32')](_0x3b071e['attributes'],function(_0xa54e7f){var _0x129863={};_0x129863[_0xa54e7f]={'$like':'%'+_0xdba149[_0x9eb0('0x34')][_0x9eb0('0x40')]+'%'};return _0x129863;})});}_0x3b071e=_['merge']({},_0x3b071e,_0xdba149['options']);return _0x171a13[_0x9eb0('0x53')](_0x3b071e);}})[_0x9eb0('0x25')](function(_0x1e9548){if(_0x1e9548){_0x1ee4db=_0x1e9548[_0x9eb0('0x45')];if(!_0xdba149[_0x9eb0('0x34')][_0x9eb0('0x39')](_0x9eb0('0x4e'))){_0x3b071e[_0x9eb0('0x21')]=qs[_0x9eb0('0x21')](_0xdba149['query']['limit']);_0x3b071e[_0x9eb0('0x20')]=qs[_0x9eb0('0x20')](_0xdba149[_0x9eb0('0x34')][_0x9eb0('0x20')]);}return _0x171a13[_0x9eb0('0x53')](_0x3b071e);}})[_0x9eb0('0x25')](function(_0x5444eb){if(_0x5444eb){return _0x5444eb?{'count':_0x1ee4db,'rows':_0x5444eb}:null;}})[_0x9eb0('0x25')](respondWithResult(_0x2f9797,null))[_0x9eb0('0x4c')](handleError(_0x2f9797,null));};exports[_0x9eb0('0x55')]=function(_0x423002,_0x3df30c,_0x5ee680){if(_0x423002[_0x9eb0('0x4a')]['id']){delete _0x423002[_0x9eb0('0x4a')]['id'];}return db[_0x9eb0('0x2c')][_0x9eb0('0x50')]({'where':{'id':_0x423002[_0x9eb0('0x44')]['id']}})[_0x9eb0('0x25')](handleEntityNotFound(_0x3df30c,null))[_0x9eb0('0x25')](function(_0x522a2e){if(_0x522a2e){return _0x522a2e[_0x9eb0('0x55')](_0x423002[_0x9eb0('0x4a')]['ids']||[]);}return null;})[_0x9eb0('0x25')](respondWithResult(_0x3df30c,null))[_0x9eb0('0x4c')](handleError(_0x3df30c,null));}; \ No newline at end of file +var _0x93c4=['filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../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','save','update','then','destroy','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2ab131,_0x8d2d5){var _0x5d3c9f=function(_0x112861){while(--_0x112861){_0x2ab131['push'](_0x2ab131['shift']());}};_0x5d3c9f(++_0x8d2d5);}(_0x93c4,0xbb));var _0x493c=function(_0x4789e1,_0x33a07e){_0x4789e1=_0x4789e1-0x0;var _0x2d4958=_0x93c4[_0x4789e1];return _0x2d4958;};'use strict';var emlformat=require(_0x493c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x493c('0x1'));var jsonpatch=require(_0x493c('0x2'));var rp=require('request-promise');var moment=require(_0x493c('0x3'));var BPromise=require(_0x493c('0x4'));var Mustache=require(_0x493c('0x5'));var util=require('util');var path=require(_0x493c('0x6'));var sox=require(_0x493c('0x7'));var csv=require(_0x493c('0x8'));var ejs=require(_0x493c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x493c('0xa'));var squel=require(_0x493c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x493c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x493c('0xd'));var Papa=require(_0x493c('0xe'));var Redis=require(_0x493c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x493c('0x10'));var as=require(_0x493c('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x493c('0x12'))('api');var utils=require(_0x493c('0x13'));var config=require(_0x493c('0x14'));var licenseUtil=require(_0x493c('0x15'));var db=require(_0x493c('0x16'))['db'];function respondWithStatusCode(_0x16dd6f,_0xbfacab){_0xbfacab=_0xbfacab||0xcc;return function(_0x47d27d){if(_0x47d27d){return _0x16dd6f[_0x493c('0x17')](_0xbfacab);}return _0x16dd6f[_0x493c('0x18')](_0xbfacab)[_0x493c('0x19')]();};}function respondWithResult(_0x79c819,_0x2d63b4){_0x2d63b4=_0x2d63b4||0xc8;return function(_0x21328e){if(_0x21328e){return _0x79c819[_0x493c('0x18')](_0x2d63b4)[_0x493c('0x1a')](_0x21328e);}};}function respondWithFilteredResult(_0x471c79,_0x442fc0){return function(_0x577500){if(_0x577500){var _0x85e7f9=typeof _0x442fc0[_0x493c('0x1b')]===_0x493c('0x1c')&&typeof _0x442fc0[_0x493c('0x1d')]===_0x493c('0x1c');var _0x5365fa=_0x577500[_0x493c('0x1e')];var _0x4472d6=_0x85e7f9?0x0:_0x442fc0['offset'];var _0x532782=_0x85e7f9?_0x577500[_0x493c('0x1e')]:_0x442fc0['offset']+_0x442fc0['limit'];var _0x1bf81c;if(_0x532782>=_0x5365fa){_0x532782=_0x5365fa;_0x1bf81c=0xc8;}else{_0x1bf81c=0xce;}_0x471c79[_0x493c('0x18')](_0x1bf81c);return _0x471c79[_0x493c('0x1f')](_0x493c('0x20'),_0x4472d6+'-'+_0x532782+'/'+_0x5365fa)[_0x493c('0x1a')](_0x577500);}return null;};}function patchUpdates(_0x3d1db8){return function(_0x3371a3){try{jsonpatch['apply'](_0x3371a3,_0x3d1db8,!![]);}catch(_0x2bd306){return BPromise['reject'](_0x2bd306);}return _0x3371a3[_0x493c('0x21')]();};}function saveUpdates(_0x3a8e0a,_0x353634){return function(_0x2978ba){if(_0x2978ba){return _0x2978ba[_0x493c('0x22')](_0x3a8e0a)[_0x493c('0x23')](function(_0x1f506a){return _0x1f506a;});}return null;};}function removeEntity(_0x1d9571,_0x2f876c){return function(_0x396886){if(_0x396886){return _0x396886[_0x493c('0x24')]()[_0x493c('0x23')](function(){_0x1d9571['status'](0xcc)[_0x493c('0x19')]();});}};}function handleEntityNotFound(_0x15d495,_0x35a9f0){return function(_0x58afcc){if(!_0x58afcc){_0x15d495[_0x493c('0x17')](0x194);}return _0x58afcc;};}function handleError(_0x4e07b4,_0x533173){_0x533173=_0x533173||0x1f4;return function(_0x22eaa9){logger['error'](_0x22eaa9[_0x493c('0x25')]);if(_0x22eaa9[_0x493c('0x26')]){delete _0x22eaa9['name'];}_0x4e07b4['status'](_0x533173)['send'](_0x22eaa9);};}exports[_0x493c('0x27')]=function(_0x3d1780,_0x2207d8){var _0x3cdc05={},_0x1e52d9={},_0x5fc08={'count':0x0,'rows':[]};var _0x2da152=_[_0x493c('0x28')](db[_0x493c('0x29')][_0x493c('0x2a')],function(_0x27d0b0){return{'name':_0x27d0b0[_0x493c('0x2b')],'type':_0x27d0b0[_0x493c('0x2c')][_0x493c('0x2d')]};});_0x1e52d9[_0x493c('0x2e')]=_[_0x493c('0x28')](_0x2da152,_0x493c('0x26'));_0x1e52d9[_0x493c('0x2f')]=_['keys'](_0x3d1780['query']);_0x1e52d9[_0x493c('0x30')]=_[_0x493c('0x31')](_0x1e52d9[_0x493c('0x2e')],_0x1e52d9['query']);_0x3cdc05[_0x493c('0x32')]=_[_0x493c('0x31')](_0x1e52d9['model'],qs[_0x493c('0x33')](_0x3d1780['query'][_0x493c('0x33')]));_0x3cdc05[_0x493c('0x32')]=_0x3cdc05[_0x493c('0x32')][_0x493c('0x34')]?_0x3cdc05[_0x493c('0x32')]:_0x1e52d9['model'];if(!_0x3d1780[_0x493c('0x2f')][_0x493c('0x35')](_0x493c('0x36'))){_0x3cdc05[_0x493c('0x1d')]=qs[_0x493c('0x1d')](_0x3d1780[_0x493c('0x2f')][_0x493c('0x1d')]);_0x3cdc05['offset']=qs[_0x493c('0x1b')](_0x3d1780[_0x493c('0x2f')]['offset']);}_0x3cdc05[_0x493c('0x37')]=qs[_0x493c('0x38')](_0x3d1780['query'][_0x493c('0x38')]);_0x3cdc05[_0x493c('0x39')]=qs[_0x493c('0x30')](_[_0x493c('0x3a')](_0x3d1780[_0x493c('0x2f')],_0x1e52d9[_0x493c('0x30')]),_0x2da152);if(_0x3d1780['query'][_0x493c('0x3b')]){_0x3cdc05[_0x493c('0x39')]=_['merge'](_0x3cdc05[_0x493c('0x39')],{'$or':_[_0x493c('0x28')](_0x2da152,function(_0x2260ec){if(_0x2260ec[_0x493c('0x2c')]!==_0x493c('0x3c')){var _0x3ca82a={};_0x3ca82a[_0x2260ec[_0x493c('0x26')]]={'$like':'%'+_0x3d1780[_0x493c('0x2f')][_0x493c('0x3b')]+'%'};return _0x3ca82a;}})});}_0x3cdc05=_['merge']({},_0x3cdc05,_0x3d1780[_0x493c('0x3d')]);var _0x4ee5a5={'where':_0x3cdc05[_0x493c('0x39')]};return db[_0x493c('0x29')][_0x493c('0x1e')](_0x4ee5a5)[_0x493c('0x23')](function(_0x121306){_0x5fc08[_0x493c('0x1e')]=_0x121306;if(_0x3d1780['query'][_0x493c('0x3e')]){_0x3cdc05[_0x493c('0x3f')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x493c('0x40')](_0x3cdc05);})[_0x493c('0x23')](function(_0x58c500){_0x5fc08[_0x493c('0x41')]=_0x58c500;return _0x5fc08;})[_0x493c('0x23')](respondWithFilteredResult(_0x2207d8,_0x3cdc05))[_0x493c('0x42')](handleError(_0x2207d8,null));};exports[_0x493c('0x43')]=function(_0x3fe06b,_0x4b19d8){var _0x210ae5={'raw':![],'where':{'id':_0x3fe06b[_0x493c('0x44')]['id']}},_0x531497={};_0x531497[_0x493c('0x2e')]=_[_0x493c('0x45')](db[_0x493c('0x29')]['rawAttributes']);_0x531497[_0x493c('0x2f')]=_[_0x493c('0x45')](_0x3fe06b[_0x493c('0x2f')]);_0x531497[_0x493c('0x30')]=_[_0x493c('0x31')](_0x531497[_0x493c('0x2e')],_0x531497[_0x493c('0x2f')]);_0x210ae5[_0x493c('0x32')]=_['intersection'](_0x531497[_0x493c('0x2e')],qs['fields'](_0x3fe06b['query']['fields']));_0x210ae5[_0x493c('0x32')]=_0x210ae5[_0x493c('0x32')]['length']?_0x210ae5[_0x493c('0x32')]:_0x531497[_0x493c('0x2e')];if(_0x3fe06b[_0x493c('0x2f')][_0x493c('0x3e')]){_0x210ae5[_0x493c('0x3f')]=[{'all':!![]}];}_0x210ae5=_[_0x493c('0x46')]({},_0x210ae5,_0x3fe06b[_0x493c('0x3d')]);return db[_0x493c('0x29')][_0x493c('0x47')](_0x210ae5)[_0x493c('0x23')](handleEntityNotFound(_0x4b19d8,null))['then'](respondWithResult(_0x4b19d8,null))[_0x493c('0x42')](handleError(_0x4b19d8,null));};exports['create']=function(_0x226829,_0x45ce1d){return db[_0x493c('0x29')][_0x493c('0x48')](_0x226829[_0x493c('0x49')],{})[_0x493c('0x23')](respondWithResult(_0x45ce1d,0xc9))[_0x493c('0x42')](handleError(_0x45ce1d,null));};exports['update']=function(_0x5bd860,_0x3661ea){if(_0x5bd860['body']['id']){delete _0x5bd860['body']['id'];}return db['ZendeskConfiguration'][_0x493c('0x47')]({'where':{'id':_0x5bd860['params']['id']}})[_0x493c('0x23')](handleEntityNotFound(_0x3661ea,null))[_0x493c('0x23')](saveUpdates(_0x5bd860[_0x493c('0x49')],null))[_0x493c('0x23')](respondWithResult(_0x3661ea,null))[_0x493c('0x42')](handleError(_0x3661ea,null));};exports['destroy']=function(_0x2a34fa,_0x3ef76b){return db['ZendeskConfiguration'][_0x493c('0x47')]({'where':{'id':_0x2a34fa[_0x493c('0x44')]['id']}})[_0x493c('0x23')](handleEntityNotFound(_0x3ef76b,null))[_0x493c('0x23')](removeEntity(_0x3ef76b,null))[_0x493c('0x42')](handleError(_0x3ef76b,null));};exports[_0x493c('0x4a')]=function(_0x47443a,_0x31b2fe,_0x58d807){var _0x1c084f={};var _0x2faadd={};var _0x1a65b1;var _0x2195d7;return db[_0x493c('0x29')][_0x493c('0x4b')]({'where':{'id':_0x47443a[_0x493c('0x44')]['id']}})['then'](handleEntityNotFound(_0x31b2fe,null))[_0x493c('0x23')](function(_0xe74ea1){if(_0xe74ea1){_0x1a65b1=_0xe74ea1;_0x2faadd[_0x493c('0x2e')]=_['keys'](db[_0x493c('0x4c')][_0x493c('0x2a')]);_0x2faadd[_0x493c('0x2f')]=_['keys'](_0x47443a[_0x493c('0x2f')]);_0x2faadd[_0x493c('0x30')]=_[_0x493c('0x31')](_0x2faadd['model'],_0x2faadd[_0x493c('0x2f')]);_0x1c084f[_0x493c('0x32')]=_[_0x493c('0x31')](_0x2faadd['model'],qs[_0x493c('0x33')](_0x47443a[_0x493c('0x2f')]['fields']));_0x1c084f[_0x493c('0x32')]=_0x1c084f['attributes']['length']?_0x1c084f[_0x493c('0x32')]:_0x2faadd[_0x493c('0x2e')];_0x1c084f['order']=qs[_0x493c('0x38')](_0x47443a['query'][_0x493c('0x38')]);_0x1c084f[_0x493c('0x39')]=qs[_0x493c('0x30')](_['pick'](_0x47443a[_0x493c('0x2f')],_0x2faadd[_0x493c('0x30')]));if(_0x47443a['query'][_0x493c('0x3b')]){_0x1c084f[_0x493c('0x39')]=_[_0x493c('0x46')](_0x1c084f['where'],{'$or':_[_0x493c('0x28')](_0x1c084f[_0x493c('0x32')],function(_0x328da7){var _0x210ee9={};_0x210ee9[_0x328da7]={'$like':'%'+_0x47443a[_0x493c('0x2f')][_0x493c('0x3b')]+'%'};return _0x210ee9;})});}_0x1c084f=_[_0x493c('0x46')]({},_0x1c084f,_0x47443a[_0x493c('0x3d')]);return _0x1a65b1[_0x493c('0x4a')](_0x1c084f);}})['then'](function(_0x4b8f44){if(_0x4b8f44){_0x2195d7=_0x4b8f44['length'];if(!_0x47443a[_0x493c('0x2f')][_0x493c('0x35')](_0x493c('0x36'))){_0x1c084f[_0x493c('0x1d')]=qs[_0x493c('0x1d')](_0x47443a[_0x493c('0x2f')][_0x493c('0x1d')]);_0x1c084f[_0x493c('0x1b')]=qs[_0x493c('0x1b')](_0x47443a[_0x493c('0x2f')][_0x493c('0x1b')]);}return _0x1a65b1[_0x493c('0x4a')](_0x1c084f);}})[_0x493c('0x23')](function(_0x24fba2){if(_0x24fba2){return _0x24fba2?{'count':_0x2195d7,'rows':_0x24fba2}:null;}})['then'](respondWithResult(_0x31b2fe,null))['catch'](handleError(_0x31b2fe,null));};exports[_0x493c('0x4d')]=function(_0x5b7f9b,_0x57baf2,_0xb15d5e){var _0x253830={};var _0x28db62={};var _0x35f963;var _0x73a4a8;return db[_0x493c('0x29')]['findOne']({'where':{'id':_0x5b7f9b[_0x493c('0x44')]['id']}})[_0x493c('0x23')](handleEntityNotFound(_0x57baf2,null))[_0x493c('0x23')](function(_0x9419b7){if(_0x9419b7){_0x35f963=_0x9419b7;_0x28db62['model']=_[_0x493c('0x45')](db['ZendeskField'][_0x493c('0x2a')]);_0x28db62[_0x493c('0x2f')]=_['keys'](_0x5b7f9b[_0x493c('0x2f')]);_0x28db62[_0x493c('0x30')]=_['intersection'](_0x28db62['model'],_0x28db62[_0x493c('0x2f')]);_0x253830[_0x493c('0x32')]=_[_0x493c('0x31')](_0x28db62[_0x493c('0x2e')],qs[_0x493c('0x33')](_0x5b7f9b['query'][_0x493c('0x33')]));_0x253830[_0x493c('0x32')]=_0x253830[_0x493c('0x32')][_0x493c('0x34')]?_0x253830[_0x493c('0x32')]:_0x28db62[_0x493c('0x2e')];_0x253830[_0x493c('0x37')]=qs[_0x493c('0x38')](_0x5b7f9b['query'][_0x493c('0x38')]);_0x253830[_0x493c('0x39')]=qs[_0x493c('0x30')](_[_0x493c('0x3a')](_0x5b7f9b[_0x493c('0x2f')],_0x28db62[_0x493c('0x30')]));if(_0x5b7f9b[_0x493c('0x2f')][_0x493c('0x3b')]){_0x253830[_0x493c('0x39')]=_[_0x493c('0x46')](_0x253830['where'],{'$or':_[_0x493c('0x28')](_0x253830[_0x493c('0x32')],function(_0x4f9a83){var _0x48d7d9={};_0x48d7d9[_0x4f9a83]={'$like':'%'+_0x5b7f9b[_0x493c('0x2f')][_0x493c('0x3b')]+'%'};return _0x48d7d9;})});}_0x253830=_[_0x493c('0x46')]({},_0x253830,_0x5b7f9b['options']);return _0x35f963[_0x493c('0x4d')](_0x253830);}})['then'](function(_0x53a87e){if(_0x53a87e){_0x73a4a8=_0x53a87e[_0x493c('0x34')];if(!_0x5b7f9b[_0x493c('0x2f')][_0x493c('0x35')](_0x493c('0x36'))){_0x253830[_0x493c('0x1d')]=qs['limit'](_0x5b7f9b[_0x493c('0x2f')][_0x493c('0x1d')]);_0x253830[_0x493c('0x1b')]=qs[_0x493c('0x1b')](_0x5b7f9b[_0x493c('0x2f')][_0x493c('0x1b')]);}return _0x35f963[_0x493c('0x4d')](_0x253830);}})[_0x493c('0x23')](function(_0x190fda){if(_0x190fda){return _0x190fda?{'count':_0x73a4a8,'rows':_0x190fda}:null;}})['then'](respondWithResult(_0x57baf2,null))[_0x493c('0x42')](handleError(_0x57baf2,null));};exports[_0x493c('0x4e')]=function(_0x38579e,_0xab5470,_0x4d32c0){var _0x4695b4={};var _0x3b3cd3={};var _0x108720;var _0x5adbd8;return db['ZendeskConfiguration'][_0x493c('0x4b')]({'where':{'id':_0x38579e[_0x493c('0x44')]['id']}})[_0x493c('0x23')](handleEntityNotFound(_0xab5470,null))[_0x493c('0x23')](function(_0x1e9f5d){if(_0x1e9f5d){_0x108720=_0x1e9f5d;_0x3b3cd3[_0x493c('0x2e')]=_[_0x493c('0x45')](db['ZendeskField'][_0x493c('0x2a')]);_0x3b3cd3['query']=_[_0x493c('0x45')](_0x38579e['query']);_0x3b3cd3[_0x493c('0x30')]=_[_0x493c('0x31')](_0x3b3cd3['model'],_0x3b3cd3['query']);_0x4695b4[_0x493c('0x32')]=_[_0x493c('0x31')](_0x3b3cd3[_0x493c('0x2e')],qs[_0x493c('0x33')](_0x38579e[_0x493c('0x2f')][_0x493c('0x33')]));_0x4695b4[_0x493c('0x32')]=_0x4695b4[_0x493c('0x32')][_0x493c('0x34')]?_0x4695b4[_0x493c('0x32')]:_0x3b3cd3[_0x493c('0x2e')];_0x4695b4['order']=qs[_0x493c('0x38')](_0x38579e[_0x493c('0x2f')][_0x493c('0x38')]);_0x4695b4[_0x493c('0x39')]=qs[_0x493c('0x30')](_[_0x493c('0x3a')](_0x38579e[_0x493c('0x2f')],_0x3b3cd3[_0x493c('0x30')]));if(_0x38579e[_0x493c('0x2f')][_0x493c('0x3b')]){_0x4695b4[_0x493c('0x39')]=_[_0x493c('0x46')](_0x4695b4[_0x493c('0x39')],{'$or':_['map'](_0x4695b4['attributes'],function(_0x34d5fa){var _0x48993f={};_0x48993f[_0x34d5fa]={'$like':'%'+_0x38579e[_0x493c('0x2f')][_0x493c('0x3b')]+'%'};return _0x48993f;})});}_0x4695b4=_[_0x493c('0x46')]({},_0x4695b4,_0x38579e[_0x493c('0x3d')]);return _0x108720['getDescriptions'](_0x4695b4);}})[_0x493c('0x23')](function(_0x5af5a7){if(_0x5af5a7){_0x5adbd8=_0x5af5a7[_0x493c('0x34')];if(!_0x38579e[_0x493c('0x2f')][_0x493c('0x35')]('nolimit')){_0x4695b4[_0x493c('0x1d')]=qs[_0x493c('0x1d')](_0x38579e[_0x493c('0x2f')][_0x493c('0x1d')]);_0x4695b4['offset']=qs['offset'](_0x38579e['query'][_0x493c('0x1b')]);}return _0x108720[_0x493c('0x4e')](_0x4695b4);}})[_0x493c('0x23')](function(_0x475892){if(_0x475892){return _0x475892?{'count':_0x5adbd8,'rows':_0x475892}:null;}})[_0x493c('0x23')](respondWithResult(_0xab5470,null))[_0x493c('0x42')](handleError(_0xab5470,null));};exports[_0x493c('0x4f')]=function(_0x249c06,_0x34b356,_0x18e11b){var _0x2aa6f9={};var _0x128404={};var _0x2f8bea;var _0x1af942;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x249c06['params']['id']}})[_0x493c('0x23')](handleEntityNotFound(_0x34b356,null))[_0x493c('0x23')](function(_0xa039ec){if(_0xa039ec){_0x2f8bea=_0xa039ec;_0x128404[_0x493c('0x2e')]=_['keys'](db['Tag'][_0x493c('0x2a')]);_0x128404['query']=_[_0x493c('0x45')](_0x249c06[_0x493c('0x2f')]);_0x128404[_0x493c('0x30')]=_['intersection'](_0x128404[_0x493c('0x2e')],_0x128404[_0x493c('0x2f')]);_0x2aa6f9[_0x493c('0x32')]=_['intersection'](_0x128404[_0x493c('0x2e')],qs[_0x493c('0x33')](_0x249c06[_0x493c('0x2f')][_0x493c('0x33')]));_0x2aa6f9[_0x493c('0x32')]=_0x2aa6f9[_0x493c('0x32')][_0x493c('0x34')]?_0x2aa6f9[_0x493c('0x32')]:_0x128404['model'];_0x2aa6f9[_0x493c('0x37')]=qs[_0x493c('0x38')](_0x249c06[_0x493c('0x2f')]['sort']);_0x2aa6f9[_0x493c('0x39')]=qs[_0x493c('0x30')](_[_0x493c('0x3a')](_0x249c06[_0x493c('0x2f')],_0x128404[_0x493c('0x30')]));if(_0x249c06[_0x493c('0x2f')][_0x493c('0x3b')]){_0x2aa6f9[_0x493c('0x39')]=_[_0x493c('0x46')](_0x2aa6f9[_0x493c('0x39')],{'$or':_[_0x493c('0x28')](_0x2aa6f9['attributes'],function(_0x2feda5){var _0x101f88={};_0x101f88[_0x2feda5]={'$like':'%'+_0x249c06[_0x493c('0x2f')]['filter']+'%'};return _0x101f88;})});}_0x2aa6f9=_[_0x493c('0x46')]({},_0x2aa6f9,_0x249c06[_0x493c('0x3d')]);return _0x2f8bea[_0x493c('0x4f')](_0x2aa6f9);}})[_0x493c('0x23')](function(_0x24ac8e){if(_0x24ac8e){_0x1af942=_0x24ac8e['length'];if(!_0x249c06[_0x493c('0x2f')][_0x493c('0x35')](_0x493c('0x36'))){_0x2aa6f9[_0x493c('0x1d')]=qs[_0x493c('0x1d')](_0x249c06[_0x493c('0x2f')][_0x493c('0x1d')]);_0x2aa6f9[_0x493c('0x1b')]=qs[_0x493c('0x1b')](_0x249c06[_0x493c('0x2f')][_0x493c('0x1b')]);}return _0x2f8bea[_0x493c('0x4f')](_0x2aa6f9);}})['then'](function(_0x981170){if(_0x981170){return _0x981170?{'count':_0x1af942,'rows':_0x981170}:null;}})[_0x493c('0x23')](respondWithResult(_0x34b356,null))['catch'](handleError(_0x34b356,null));};exports[_0x493c('0x50')]=function(_0x4795bd,_0x98daf3,_0x3a9ae3){if(_0x4795bd[_0x493c('0x49')]['id']){delete _0x4795bd[_0x493c('0x49')]['id'];}return db[_0x493c('0x29')][_0x493c('0x4b')]({'where':{'id':_0x4795bd['params']['id']}})[_0x493c('0x23')](handleEntityNotFound(_0x98daf3,null))[_0x493c('0x23')](function(_0x17a46e){if(_0x17a46e){return _0x17a46e[_0x493c('0x50')](_0x4795bd[_0x493c('0x49')][_0x493c('0x51')]||[]);}return null;})[_0x493c('0x23')](respondWithResult(_0x98daf3,null))[_0x493c('0x42')](handleError(_0x98daf3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 743bd0d..c00a707 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 _0xbbbc=['request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x4e0e9b,_0x45999e){_0x4e0e9b=_0x4e0e9b-0x0;var _0x4790b2=_0xbbbc[_0x4e0e9b];return _0x4790b2;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var logger=require(_0xcbbb('0x2'))(_0xcbbb('0x3'));var moment=require(_0xcbbb('0x4'));var BPromise=require(_0xcbbb('0x5'));var rp=require(_0xcbbb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbbb('0x7'));var config=require(_0xcbbb('0x8'));var attributes=require(_0xcbbb('0x9'));module[_0xcbbb('0xa')]=function(_0x43ff05,_0x4978a9){return _0x43ff05[_0xcbbb('0xb')](_0xcbbb('0xc'),attributes,{'tableName':_0xcbbb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7b4=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment'];(function(_0x1b92d1,_0x5756d7){var _0x514acc=function(_0x1fcb7c){while(--_0x1fcb7c){_0x1b92d1['push'](_0x1b92d1['shift']());}};_0x514acc(++_0x5756d7);}(_0xf7b4,0x152));var _0x4f7b=function(_0x3d807a,_0x17d648){_0x3d807a=_0x3d807a-0x0;var _0x250fb5=_0xf7b4[_0x3d807a];return _0x250fb5;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'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 198338c..235394a 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 _0xfc4c=['http','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4f3da4,_0x121375){var _0x1df1a1=function(_0x329dfc){while(--_0x329dfc){_0x4f3da4['push'](_0x4f3da4['shift']());}};_0x1df1a1(++_0x121375);}(_0xfc4c,0x1c3));var _0xcfc4=function(_0x378a28,_0x47044a){_0x378a28=_0x378a28-0x0;var _0x2e3ce9=_0xfc4c[_0x378a28];return _0x2e3ce9;};'use strict';var _=require(_0xcfc4('0x0'));var util=require(_0xcfc4('0x1'));var moment=require('moment');var BPromise=require(_0xcfc4('0x2'));var rs=require(_0xcfc4('0x3'));var fs=require('fs');var Redis=require(_0xcfc4('0x4'));var db=require(_0xcfc4('0x5'))['db'];var utils=require(_0xcfc4('0x6'));var logger=require(_0xcfc4('0x7'))('rpc');var config=require(_0xcfc4('0x8'));var jayson=require(_0xcfc4('0x9'));var client=jayson[_0xcfc4('0xa')][_0xcfc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x542a67,_0x3c1646,_0x472f4a){return new BPromise(function(_0x3d84ea,_0x3500fd){return client['request'](_0x542a67,_0x472f4a)[_0xcfc4('0xc')](function(_0x3768e2){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x3c1646,_0xcfc4('0xd'));logger[_0xcfc4('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3c1646,_0xcfc4('0xd'),JSON[_0xcfc4('0xf')](_0x3768e2));if(_0x3768e2['error']){if(_0x3768e2[_0xcfc4('0x10')][_0xcfc4('0x11')]===0x1f4){logger['error'](_0xcfc4('0x12'),_0x3c1646,_0x3768e2[_0xcfc4('0x10')][_0xcfc4('0x13')]);return _0x3500fd(_0x3768e2['error']['message']);}logger['error'](_0xcfc4('0x12'),_0x3c1646,_0x3768e2[_0xcfc4('0x10')][_0xcfc4('0x13')]);return _0x3d84ea(_0x3768e2[_0xcfc4('0x10')][_0xcfc4('0x13')]);}else{logger['info'](_0xcfc4('0x12'),_0x3c1646,'request\x20sent');_0x3d84ea(_0x3768e2[_0xcfc4('0x14')]['message']);}})[_0xcfc4('0x15')](function(_0x24bca6){logger[_0xcfc4('0x10')](_0xcfc4('0x12'),_0x3c1646,_0x24bca6);_0x3500fd(_0x24bca6);});});} \ No newline at end of file +var _0x50c7=['stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug'];(function(_0x1fd5eb,_0x235203){var _0x102365=function(_0x54de1f){while(--_0x54de1f){_0x1fd5eb['push'](_0x1fd5eb['shift']());}};_0x102365(++_0x235203);}(_0x50c7,0xcd));var _0x750c=function(_0x550288,_0xcbedb1){_0x550288=_0x550288-0x0;var _0x311d16=_0x50c7[_0x550288];return _0x311d16;};'use strict';var _=require('lodash');var util=require(_0x750c('0x0'));var moment=require(_0x750c('0x1'));var BPromise=require(_0x750c('0x2'));var rs=require(_0x750c('0x3'));var fs=require('fs');var Redis=require(_0x750c('0x4'));var db=require(_0x750c('0x5'))['db'];var utils=require(_0x750c('0x6'));var logger=require(_0x750c('0x7'))(_0x750c('0x8'));var config=require(_0x750c('0x9'));var jayson=require(_0x750c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d44f0,_0x1f0991,_0x41fc4c){return new BPromise(function(_0x128f16,_0x529996){return client['request'](_0x4d44f0,_0x41fc4c)[_0x750c('0xb')](function(_0x2fcb10){logger[_0x750c('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1f0991,_0x750c('0xd'));logger[_0x750c('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1f0991,_0x750c('0xd'),JSON[_0x750c('0xf')](_0x2fcb10));if(_0x2fcb10[_0x750c('0x10')]){if(_0x2fcb10[_0x750c('0x10')]['code']===0x1f4){logger['error'](_0x750c('0x11'),_0x1f0991,_0x2fcb10[_0x750c('0x10')][_0x750c('0x12')]);return _0x529996(_0x2fcb10[_0x750c('0x10')]['message']);}logger['error'](_0x750c('0x11'),_0x1f0991,_0x2fcb10['error'][_0x750c('0x12')]);return _0x128f16(_0x2fcb10[_0x750c('0x10')][_0x750c('0x12')]);}else{logger[_0x750c('0xc')](_0x750c('0x11'),_0x1f0991,_0x750c('0xd'));_0x128f16(_0x2fcb10[_0x750c('0x13')][_0x750c('0x12')]);}})['catch'](function(_0x37a616){logger['error'](_0x750c('0x11'),_0x1f0991,_0x37a616);_0x529996(_0x37a616);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4b92e99..248a19d 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 _0xc6c2=['util','path','express','fs-extra','../../components/interaction/service','./intZendeskField.controller','isAuthenticated','get','/:id','post','create','put','update','destroy','exports','multer'];(function(_0x392ec2,_0x4e9f85){var _0x16e517=function(_0x379e8b){while(--_0x379e8b){_0x392ec2['push'](_0x392ec2['shift']());}};_0x16e517(++_0x4e9f85);}(_0xc6c2,0x7f));var _0x2c6c=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0xc6c2[_0x7b5cdd];return _0x3a29ae;};'use strict';var multer=require(_0x2c6c('0x0'));var util=require(_0x2c6c('0x1'));var path=require(_0x2c6c('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c6c('0x3'));var router=express['Router']();var fs_extra=require(_0x2c6c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2c6c('0x5'));var config=require('../../config/environment');var controller=require(_0x2c6c('0x6'));router['get']('/',auth[_0x2c6c('0x7')](),controller['index']);router[_0x2c6c('0x8')](_0x2c6c('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x2c6c('0xa')]('/',auth[_0x2c6c('0x7')](),controller[_0x2c6c('0xb')]);router[_0x2c6c('0xc')](_0x2c6c('0x9'),auth[_0x2c6c('0x7')](),controller[_0x2c6c('0xd')]);router['delete']('/:id',auth[_0x2c6c('0x7')](),controller[_0x2c6c('0xe')]);module[_0x2c6c('0xf')]=router; \ No newline at end of file +var _0x6341=['index','show','post','create','/:id','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x6341,0xa0));var _0x1634=function(_0x6361ae,_0x327fe2){_0x6361ae=_0x6361ae-0x0;var _0x300fde=_0x6341[_0x6361ae];return _0x300fde;};'use strict';var multer=require('multer');var util=require(_0x1634('0x0'));var path=require(_0x1634('0x1'));var timeout=require('connect-timeout');var express=require(_0x1634('0x2'));var router=express[_0x1634('0x3')]();var fs_extra=require(_0x1634('0x4'));var auth=require(_0x1634('0x5'));var interaction=require(_0x1634('0x6'));var config=require(_0x1634('0x7'));var controller=require(_0x1634('0x8'));router[_0x1634('0x9')]('/',auth[_0x1634('0xa')](),controller[_0x1634('0xb')]);router[_0x1634('0x9')]('/:id',auth[_0x1634('0xa')](),controller[_0x1634('0xc')]);router[_0x1634('0xd')]('/',auth['isAuthenticated'](),controller[_0x1634('0xe')]);router['put'](_0x1634('0xf'),auth['isAuthenticated'](),controller[_0x1634('0x10')]);router[_0x1634('0x11')]('/:id',auth[_0x1634('0xa')](),controller[_0x1634('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 142fc7e..abdad55 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 _0x16c0=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x48b4bf,_0x427eb3){var _0x3e64c0=function(_0x3ea7c7){while(--_0x3ea7c7){_0x48b4bf['push'](_0x48b4bf['shift']());}};_0x3e64c0(++_0x427eb3);}(_0x16c0,0x1e5));var _0x016c=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x16c0[_0x5beda8];return _0x2aa042;};'use strict';var Sequelize=require(_0x016c('0x0'));module[_0x016c('0x1')]={'type':{'type':Sequelize[_0x016c('0x2')](_0x016c('0x3'),_0x016c('0x4'),_0x016c('0x5'),_0x016c('0x6'),_0x016c('0x7')),'defaultValue':_0x016c('0x3')},'content':{'type':Sequelize[_0x016c('0x8')]},'key':{'type':Sequelize[_0x016c('0x8')]},'keyType':{'type':Sequelize[_0x016c('0x2')](_0x016c('0x3'),_0x016c('0x4'),_0x016c('0x5'))},'keyContent':{'type':Sequelize[_0x016c('0x8')]},'idField':{'type':Sequelize[_0x016c('0x8')]},'nameField':{'type':Sequelize[_0x016c('0x8')]},'customField':{'type':Sequelize[_0x016c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9385=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','picklist'];(function(_0x47cd42,_0x4f129e){var _0x9f7132=function(_0x5e8bff){while(--_0x5e8bff){_0x47cd42['push'](_0x47cd42['shift']());}};_0x9f7132(++_0x4f129e);}(_0x9385,0x111));var _0x5938=function(_0x4183ee,_0x43d0fb){_0x4183ee=_0x4183ee-0x0;var _0xfa8f02=_0x9385[_0x4183ee];return _0xfa8f02;};'use strict';var Sequelize=require(_0x5938('0x0'));module[_0x5938('0x1')]={'type':{'type':Sequelize[_0x5938('0x2')]('string',_0x5938('0x3'),_0x5938('0x4'),'keyValue',_0x5938('0x5')),'defaultValue':_0x5938('0x6')},'content':{'type':Sequelize[_0x5938('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5938('0x2')](_0x5938('0x6'),_0x5938('0x3'),_0x5938('0x4'))},'keyContent':{'type':Sequelize[_0x5938('0x7')]},'idField':{'type':Sequelize[_0x5938('0x7')]},'nameField':{'type':Sequelize[_0x5938('0x7')]},'customField':{'type':Sequelize[_0x5938('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5938('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 22ce9d9..23a1880 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 _0x9d27=['ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','update','then','destroy','error','stack','send','index','map','ZendeskField','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','name','options','includeAll','catch','create','body','params','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x5586e0,_0xc8f704){var _0x29b13a=function(_0x327000){while(--_0x327000){_0x5586e0['push'](_0x5586e0['shift']());}};_0x29b13a(++_0xc8f704);}(_0x9d27,0xc2));var _0x79d2=function(_0x56928f,_0x229473){_0x56928f=_0x56928f-0x0;var _0x159b5d=_0x9d27[_0x56928f];return _0x159b5d;};'use strict';var emlformat=require(_0x79d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x79d2('0x1'));var jsonpatch=require(_0x79d2('0x2'));var rp=require(_0x79d2('0x3'));var moment=require(_0x79d2('0x4'));var BPromise=require(_0x79d2('0x5'));var Mustache=require(_0x79d2('0x6'));var util=require(_0x79d2('0x7'));var path=require(_0x79d2('0x8'));var sox=require('sox');var csv=require(_0x79d2('0x9'));var ejs=require(_0x79d2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x79d2('0xb'));var squel=require(_0x79d2('0xc'));var crypto=require(_0x79d2('0xd'));var jsforce=require(_0x79d2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x79d2('0x9'));var querystring=require('querystring');var Papa=require(_0x79d2('0xf'));var Redis=require(_0x79d2('0x10'));var authService=require(_0x79d2('0x11'));var qs=require(_0x79d2('0x12'));var as=require(_0x79d2('0x13'));var hardwareService=require(_0x79d2('0x14'));var logger=require('../../config/logger')(_0x79d2('0x15'));var utils=require(_0x79d2('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x126ed1,_0x59e37b){_0x59e37b=_0x59e37b||0xcc;return function(_0x5349f2){if(_0x5349f2){return _0x126ed1[_0x79d2('0x17')](_0x59e37b);}return _0x126ed1[_0x79d2('0x18')](_0x59e37b)[_0x79d2('0x19')]();};}function respondWithResult(_0x1e51f2,_0x43f731){_0x43f731=_0x43f731||0xc8;return function(_0x1e6095){if(_0x1e6095){return _0x1e51f2[_0x79d2('0x18')](_0x43f731)[_0x79d2('0x1a')](_0x1e6095);}};}function respondWithFilteredResult(_0x13c80e,_0x32b3ec){return function(_0x14d539){if(_0x14d539){var _0x36bb2d=typeof _0x32b3ec[_0x79d2('0x1b')]==='undefined'&&typeof _0x32b3ec[_0x79d2('0x1c')]==='undefined';var _0x11db48=_0x14d539[_0x79d2('0x1d')];var _0x48e6f7=_0x36bb2d?0x0:_0x32b3ec[_0x79d2('0x1b')];var _0x507b16=_0x36bb2d?_0x14d539['count']:_0x32b3ec[_0x79d2('0x1b')]+_0x32b3ec[_0x79d2('0x1c')];var _0x36c3e3;if(_0x507b16>=_0x11db48){_0x507b16=_0x11db48;_0x36c3e3=0xc8;}else{_0x36c3e3=0xce;}_0x13c80e[_0x79d2('0x18')](_0x36c3e3);return _0x13c80e['set'](_0x79d2('0x1e'),_0x48e6f7+'-'+_0x507b16+'/'+_0x11db48)[_0x79d2('0x1a')](_0x14d539);}return null;};}function patchUpdates(_0x55bbbd){return function(_0x2a2256){try{jsonpatch[_0x79d2('0x1f')](_0x2a2256,_0x55bbbd,!![]);}catch(_0x4c60c3){return BPromise['reject'](_0x4c60c3);}return _0x2a2256['save']();};}function saveUpdates(_0x34fdf0,_0x29d496){return function(_0xeb3be3){if(_0xeb3be3){return _0xeb3be3[_0x79d2('0x20')](_0x34fdf0)[_0x79d2('0x21')](function(_0x4fdbab){return _0x4fdbab;});}return null;};}function removeEntity(_0x54579e,_0x45a940){return function(_0xbb5e0a){if(_0xbb5e0a){return _0xbb5e0a[_0x79d2('0x22')]()['then'](function(){_0x54579e[_0x79d2('0x18')](0xcc)[_0x79d2('0x19')]();});}};}function handleEntityNotFound(_0x4c64e6,_0x230cf5){return function(_0x36b79c){if(!_0x36b79c){_0x4c64e6[_0x79d2('0x17')](0x194);}return _0x36b79c;};}function handleError(_0x1f0e26,_0x1200ca){_0x1200ca=_0x1200ca||0x1f4;return function(_0x5d0e67){logger[_0x79d2('0x23')](_0x5d0e67[_0x79d2('0x24')]);if(_0x5d0e67['name']){delete _0x5d0e67['name'];}_0x1f0e26['status'](_0x1200ca)[_0x79d2('0x25')](_0x5d0e67);};}exports[_0x79d2('0x26')]=function(_0x322480,_0x100bff){var _0x1e0b42={},_0x9ae921={},_0x29011e={'count':0x0,'rows':[]};var _0x507cf5=_[_0x79d2('0x27')](db[_0x79d2('0x28')][_0x79d2('0x29')],function(_0x3cb5e9){return{'name':_0x3cb5e9['fieldName'],'type':_0x3cb5e9['type'][_0x79d2('0x2a')]};});_0x9ae921['model']=_[_0x79d2('0x27')](_0x507cf5,'name');_0x9ae921[_0x79d2('0x2b')]=_[_0x79d2('0x2c')](_0x322480[_0x79d2('0x2b')]);_0x9ae921['filters']=_[_0x79d2('0x2d')](_0x9ae921[_0x79d2('0x2e')],_0x9ae921[_0x79d2('0x2b')]);_0x1e0b42[_0x79d2('0x2f')]=_['intersection'](_0x9ae921[_0x79d2('0x2e')],qs[_0x79d2('0x30')](_0x322480['query'][_0x79d2('0x30')]));_0x1e0b42[_0x79d2('0x2f')]=_0x1e0b42[_0x79d2('0x2f')][_0x79d2('0x31')]?_0x1e0b42['attributes']:_0x9ae921[_0x79d2('0x2e')];if(!_0x322480['query'][_0x79d2('0x32')](_0x79d2('0x33'))){_0x1e0b42[_0x79d2('0x1c')]=qs[_0x79d2('0x1c')](_0x322480['query']['limit']);_0x1e0b42[_0x79d2('0x1b')]=qs[_0x79d2('0x1b')](_0x322480[_0x79d2('0x2b')][_0x79d2('0x1b')]);}_0x1e0b42[_0x79d2('0x34')]=qs[_0x79d2('0x35')](_0x322480[_0x79d2('0x2b')][_0x79d2('0x35')]);_0x1e0b42[_0x79d2('0x36')]=qs[_0x79d2('0x37')](_[_0x79d2('0x38')](_0x322480[_0x79d2('0x2b')],_0x9ae921['filters']),_0x507cf5);if(_0x322480['query'][_0x79d2('0x39')]){_0x1e0b42[_0x79d2('0x36')]=_[_0x79d2('0x3a')](_0x1e0b42['where'],{'$or':_['map'](_0x507cf5,function(_0x23d0ed){if(_0x23d0ed[_0x79d2('0x3b')]!=='VIRTUAL'){var _0x374c8e={};_0x374c8e[_0x23d0ed[_0x79d2('0x3c')]]={'$like':'%'+_0x322480[_0x79d2('0x2b')][_0x79d2('0x39')]+'%'};return _0x374c8e;}})});}_0x1e0b42=_[_0x79d2('0x3a')]({},_0x1e0b42,_0x322480[_0x79d2('0x3d')]);var _0x240a66={'where':_0x1e0b42[_0x79d2('0x36')]};return db[_0x79d2('0x28')][_0x79d2('0x1d')](_0x240a66)['then'](function(_0x25526e){_0x29011e['count']=_0x25526e;if(_0x322480[_0x79d2('0x2b')][_0x79d2('0x3e')]){_0x1e0b42['include']=[{'all':!![]}];}return db[_0x79d2('0x28')]['findAll'](_0x1e0b42);})[_0x79d2('0x21')](function(_0x203496){_0x29011e['rows']=_0x203496;return _0x29011e;})['then'](respondWithFilteredResult(_0x100bff,_0x1e0b42))[_0x79d2('0x3f')](handleError(_0x100bff,null));};exports['show']=function(_0x4ae423,_0x2790b8){var _0x124bc0={'raw':!![],'where':{'id':_0x4ae423['params']['id']}},_0x543008={};_0x543008['model']=_['keys'](db[_0x79d2('0x28')][_0x79d2('0x29')]);_0x543008[_0x79d2('0x2b')]=_[_0x79d2('0x2c')](_0x4ae423[_0x79d2('0x2b')]);_0x543008['filters']=_[_0x79d2('0x2d')](_0x543008[_0x79d2('0x2e')],_0x543008[_0x79d2('0x2b')]);_0x124bc0[_0x79d2('0x2f')]=_[_0x79d2('0x2d')](_0x543008['model'],qs[_0x79d2('0x30')](_0x4ae423[_0x79d2('0x2b')][_0x79d2('0x30')]));_0x124bc0['attributes']=_0x124bc0[_0x79d2('0x2f')]['length']?_0x124bc0[_0x79d2('0x2f')]:_0x543008[_0x79d2('0x2e')];if(_0x4ae423[_0x79d2('0x2b')][_0x79d2('0x3e')]){_0x124bc0['include']=[{'all':!![]}];}_0x124bc0=_['merge']({},_0x124bc0,_0x4ae423[_0x79d2('0x3d')]);return db[_0x79d2('0x28')]['find'](_0x124bc0)['then'](handleEntityNotFound(_0x2790b8,null))[_0x79d2('0x21')](respondWithResult(_0x2790b8,null))[_0x79d2('0x3f')](handleError(_0x2790b8,null));};exports[_0x79d2('0x40')]=function(_0x6bc9d8,_0x2e318e){return db[_0x79d2('0x28')][_0x79d2('0x40')](_0x6bc9d8['body'],{})[_0x79d2('0x21')](respondWithResult(_0x2e318e,0xc9))[_0x79d2('0x3f')](handleError(_0x2e318e,null));};exports[_0x79d2('0x20')]=function(_0xb58fb7,_0x248d98){if(_0xb58fb7[_0x79d2('0x41')]['id']){delete _0xb58fb7[_0x79d2('0x41')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0xb58fb7[_0x79d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x248d98,null))[_0x79d2('0x21')](saveUpdates(_0xb58fb7['body'],null))[_0x79d2('0x21')](respondWithResult(_0x248d98,null))[_0x79d2('0x3f')](handleError(_0x248d98,null));};exports['destroy']=function(_0x4853ef,_0x2f292d){return db[_0x79d2('0x28')][_0x79d2('0x43')]({'where':{'id':_0x4853ef[_0x79d2('0x42')]['id']}})[_0x79d2('0x21')](handleEntityNotFound(_0x2f292d,null))[_0x79d2('0x21')](removeEntity(_0x2f292d,null))[_0x79d2('0x3f')](handleError(_0x2f292d,null));}; \ No newline at end of file +var _0xcdad=['type','VIRTUAL','options','includeAll','include','rows','length','find','catch','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x4fa378,_0x4dc5b4){var _0x2b8dc7=function(_0x49dfc3){while(--_0x49dfc3){_0x4fa378['push'](_0x4fa378['shift']());}};_0x2b8dc7(++_0x4dc5b4);}(_0xcdad,0x175));var _0xdcda=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xcdad[_0x1347f8];return _0x218368;};'use strict';var emlformat=require(_0xdcda('0x0'));var rimraf=require(_0xdcda('0x1'));var zipdir=require(_0xdcda('0x2'));var jsonpatch=require(_0xdcda('0x3'));var rp=require(_0xdcda('0x4'));var moment=require(_0xdcda('0x5'));var BPromise=require(_0xdcda('0x6'));var Mustache=require(_0xdcda('0x7'));var util=require('util');var path=require(_0xdcda('0x8'));var sox=require(_0xdcda('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdcda('0xa'));var _=require('lodash');var squel=require(_0xdcda('0xb'));var crypto=require(_0xdcda('0xc'));var jsforce=require(_0xdcda('0xd'));var deskjs=require(_0xdcda('0xe'));var toCsv=require(_0xdcda('0xf'));var querystring=require(_0xdcda('0x10'));var Papa=require(_0xdcda('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdcda('0x12'));var hardwareService=require(_0xdcda('0x13'));var logger=require('../../config/logger')(_0xdcda('0x14'));var utils=require('../../config/utils');var config=require(_0xdcda('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcda('0x16'))['db'];function respondWithStatusCode(_0x4a9838,_0x55ee46){_0x55ee46=_0x55ee46||0xcc;return function(_0x6a081f){if(_0x6a081f){return _0x4a9838[_0xdcda('0x17')](_0x55ee46);}return _0x4a9838[_0xdcda('0x18')](_0x55ee46)[_0xdcda('0x19')]();};}function respondWithResult(_0x189afd,_0x58f9a9){_0x58f9a9=_0x58f9a9||0xc8;return function(_0x574ef0){if(_0x574ef0){return _0x189afd[_0xdcda('0x18')](_0x58f9a9)[_0xdcda('0x1a')](_0x574ef0);}};}function respondWithFilteredResult(_0x67f3c2,_0xdfa6d9){return function(_0x3af0b5){if(_0x3af0b5){var _0x42d4ec=typeof _0xdfa6d9[_0xdcda('0x1b')]===_0xdcda('0x1c')&&typeof _0xdfa6d9[_0xdcda('0x1d')]===_0xdcda('0x1c');var _0x6823d1=_0x3af0b5[_0xdcda('0x1e')];var _0x338213=_0x42d4ec?0x0:_0xdfa6d9['offset'];var _0x4dda19=_0x42d4ec?_0x3af0b5[_0xdcda('0x1e')]:_0xdfa6d9[_0xdcda('0x1b')]+_0xdfa6d9['limit'];var _0x320238;if(_0x4dda19>=_0x6823d1){_0x4dda19=_0x6823d1;_0x320238=0xc8;}else{_0x320238=0xce;}_0x67f3c2[_0xdcda('0x18')](_0x320238);return _0x67f3c2[_0xdcda('0x1f')](_0xdcda('0x20'),_0x338213+'-'+_0x4dda19+'/'+_0x6823d1)['json'](_0x3af0b5);}return null;};}function patchUpdates(_0x4ef8fb){return function(_0x5d0288){try{jsonpatch[_0xdcda('0x21')](_0x5d0288,_0x4ef8fb,!![]);}catch(_0x237b4f){return BPromise['reject'](_0x237b4f);}return _0x5d0288[_0xdcda('0x22')]();};}function saveUpdates(_0x328a59,_0x582ea5){return function(_0x37fb41){if(_0x37fb41){return _0x37fb41['update'](_0x328a59)[_0xdcda('0x23')](function(_0x5090bb){return _0x5090bb;});}return null;};}function removeEntity(_0x177f34,_0x590e6d){return function(_0x491843){if(_0x491843){return _0x491843['destroy']()['then'](function(){_0x177f34[_0xdcda('0x18')](0xcc)[_0xdcda('0x19')]();});}};}function handleEntityNotFound(_0x15a6f0,_0x4d4118){return function(_0x1b66e9){if(!_0x1b66e9){_0x15a6f0['sendStatus'](0x194);}return _0x1b66e9;};}function handleError(_0x6a4c02,_0x1028b0){_0x1028b0=_0x1028b0||0x1f4;return function(_0x142573){logger[_0xdcda('0x24')](_0x142573[_0xdcda('0x25')]);if(_0x142573[_0xdcda('0x26')]){delete _0x142573['name'];}_0x6a4c02[_0xdcda('0x18')](_0x1028b0)['send'](_0x142573);};}exports[_0xdcda('0x27')]=function(_0x3bd870,_0x27ec4e){var _0x2cedee={},_0x4540ba={},_0x3306dc={'count':0x0,'rows':[]};var _0x2decdc=_[_0xdcda('0x28')](db[_0xdcda('0x29')][_0xdcda('0x2a')],function(_0x54ae13){return{'name':_0x54ae13[_0xdcda('0x2b')],'type':_0x54ae13['type'][_0xdcda('0x2c')]};});_0x4540ba[_0xdcda('0x2d')]=_[_0xdcda('0x28')](_0x2decdc,_0xdcda('0x26'));_0x4540ba[_0xdcda('0x2e')]=_[_0xdcda('0x2f')](_0x3bd870['query']);_0x4540ba[_0xdcda('0x30')]=_['intersection'](_0x4540ba['model'],_0x4540ba[_0xdcda('0x2e')]);_0x2cedee['attributes']=_[_0xdcda('0x31')](_0x4540ba[_0xdcda('0x2d')],qs['fields'](_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x32')]));_0x2cedee[_0xdcda('0x33')]=_0x2cedee['attributes']['length']?_0x2cedee[_0xdcda('0x33')]:_0x4540ba[_0xdcda('0x2d')];if(!_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x34')](_0xdcda('0x35'))){_0x2cedee[_0xdcda('0x1d')]=qs[_0xdcda('0x1d')](_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x1d')]);_0x2cedee[_0xdcda('0x1b')]=qs[_0xdcda('0x1b')](_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x1b')]);}_0x2cedee[_0xdcda('0x36')]=qs['sort'](_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x37')]);_0x2cedee[_0xdcda('0x38')]=qs[_0xdcda('0x30')](_['pick'](_0x3bd870[_0xdcda('0x2e')],_0x4540ba[_0xdcda('0x30')]),_0x2decdc);if(_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x39')]){_0x2cedee[_0xdcda('0x38')]=_[_0xdcda('0x3a')](_0x2cedee[_0xdcda('0x38')],{'$or':_['map'](_0x2decdc,function(_0x5f3f03){if(_0x5f3f03[_0xdcda('0x3b')]!==_0xdcda('0x3c')){var _0x231d04={};_0x231d04[_0x5f3f03[_0xdcda('0x26')]]={'$like':'%'+_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x39')]+'%'};return _0x231d04;}})});}_0x2cedee=_['merge']({},_0x2cedee,_0x3bd870[_0xdcda('0x3d')]);var _0xa20cf1={'where':_0x2cedee[_0xdcda('0x38')]};return db[_0xdcda('0x29')][_0xdcda('0x1e')](_0xa20cf1)[_0xdcda('0x23')](function(_0x333433){_0x3306dc[_0xdcda('0x1e')]=_0x333433;if(_0x3bd870[_0xdcda('0x2e')][_0xdcda('0x3e')]){_0x2cedee[_0xdcda('0x3f')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x2cedee);})[_0xdcda('0x23')](function(_0x2c298d){_0x3306dc[_0xdcda('0x40')]=_0x2c298d;return _0x3306dc;})[_0xdcda('0x23')](respondWithFilteredResult(_0x27ec4e,_0x2cedee))['catch'](handleError(_0x27ec4e,null));};exports['show']=function(_0x4a9293,_0x51bfc8){var _0x41d019={'raw':!![],'where':{'id':_0x4a9293['params']['id']}},_0x8a1943={};_0x8a1943[_0xdcda('0x2d')]=_['keys'](db['ZendeskField'][_0xdcda('0x2a')]);_0x8a1943[_0xdcda('0x2e')]=_[_0xdcda('0x2f')](_0x4a9293['query']);_0x8a1943[_0xdcda('0x30')]=_[_0xdcda('0x31')](_0x8a1943[_0xdcda('0x2d')],_0x8a1943[_0xdcda('0x2e')]);_0x41d019[_0xdcda('0x33')]=_[_0xdcda('0x31')](_0x8a1943['model'],qs[_0xdcda('0x32')](_0x4a9293[_0xdcda('0x2e')][_0xdcda('0x32')]));_0x41d019[_0xdcda('0x33')]=_0x41d019['attributes'][_0xdcda('0x41')]?_0x41d019[_0xdcda('0x33')]:_0x8a1943[_0xdcda('0x2d')];if(_0x4a9293[_0xdcda('0x2e')][_0xdcda('0x3e')]){_0x41d019[_0xdcda('0x3f')]=[{'all':!![]}];}_0x41d019=_['merge']({},_0x41d019,_0x4a9293[_0xdcda('0x3d')]);return db[_0xdcda('0x29')][_0xdcda('0x42')](_0x41d019)[_0xdcda('0x23')](handleEntityNotFound(_0x51bfc8,null))[_0xdcda('0x23')](respondWithResult(_0x51bfc8,null))[_0xdcda('0x43')](handleError(_0x51bfc8,null));};exports[_0xdcda('0x44')]=function(_0x3a7e9b,_0x42212c){return db[_0xdcda('0x29')][_0xdcda('0x44')](_0x3a7e9b[_0xdcda('0x45')],{})[_0xdcda('0x23')](respondWithResult(_0x42212c,0xc9))[_0xdcda('0x43')](handleError(_0x42212c,null));};exports['update']=function(_0x4f1433,_0x15cd68){if(_0x4f1433[_0xdcda('0x45')]['id']){delete _0x4f1433[_0xdcda('0x45')]['id'];}return db['ZendeskField'][_0xdcda('0x42')]({'where':{'id':_0x4f1433['params']['id']}})[_0xdcda('0x23')](handleEntityNotFound(_0x15cd68,null))['then'](saveUpdates(_0x4f1433[_0xdcda('0x45')],null))[_0xdcda('0x23')](respondWithResult(_0x15cd68,null))[_0xdcda('0x43')](handleError(_0x15cd68,null));};exports[_0xdcda('0x46')]=function(_0x429d8a,_0x9b04b8){return db[_0xdcda('0x29')]['find']({'where':{'id':_0x429d8a[_0xdcda('0x47')]['id']}})[_0xdcda('0x23')](handleEntityNotFound(_0x9b04b8,null))[_0xdcda('0x23')](removeEntity(_0x9b04b8,null))['catch'](handleError(_0x9b04b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 46270a9..2a3bc45 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 _0x4c03=['./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','api','moment','bluebird','path','../../config/environment'];(function(_0x5700d2,_0x59b5fa){var _0x25c1e0=function(_0x461b91){while(--_0x461b91){_0x5700d2['push'](_0x5700d2['shift']());}};_0x25c1e0(++_0x59b5fa);}(_0x4c03,0x119));var _0x34c0=function(_0x10c62b,_0x21f920){_0x10c62b=_0x10c62b-0x0;var _0x1f71fc=_0x4c03[_0x10c62b];return _0x1f71fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x34c0('0x0'));var moment=require(_0x34c0('0x1'));var BPromise=require(_0x34c0('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34c0('0x3'));var rimraf=require('rimraf');var config=require(_0x34c0('0x4'));var attributes=require(_0x34c0('0x5'));module[_0x34c0('0x6')]=function(_0x441b8d,_0x3b6ad3){return _0x441b8d[_0x34c0('0x7')](_0x34c0('0x8'),attributes,{'tableName':_0x34c0('0x9'),'paranoid':![],'indexes':[{'name':_0x34c0('0xa'),'fields':[_0x34c0('0xb'),_0x34c0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf653=['./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x38b348,_0xb807b3){var _0x4a21ff=function(_0x3fbb64){while(--_0x3fbb64){_0x38b348['push'](_0x38b348['shift']());}};_0x4a21ff(++_0xb807b3);}(_0xf653,0x177));var _0x3f65=function(_0x3a4294,_0x5b8ad3){_0x3a4294=_0x3a4294-0x0;var _0x326da8=_0xf653[_0x3a4294];return _0x326da8;};'use strict';var _=require(_0x3f65('0x0'));var util=require(_0x3f65('0x1'));var logger=require(_0x3f65('0x2'))(_0x3f65('0x3'));var moment=require(_0x3f65('0x4'));var BPromise=require(_0x3f65('0x5'));var rp=require(_0x3f65('0x6'));var fs=require('fs');var path=require(_0x3f65('0x7'));var rimraf=require(_0x3f65('0x8'));var config=require('../../config/environment');var attributes=require(_0x3f65('0x9'));module[_0x3f65('0xa')]=function(_0x4d85bb,_0xe06798){return _0x4d85bb[_0x3f65('0xb')](_0x3f65('0xc'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x3f65('0xd'),'fields':[_0x3f65('0xe'),_0x3f65('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index d190117..37ab664 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 _0xd347=['code','message','request\x20sent','lodash','util','moment','ioredis','../../config/logger','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','stringify','error'];(function(_0x4e6d8b,_0x40ea0d){var _0x39bacb=function(_0xd5d1dd){while(--_0xd5d1dd){_0x4e6d8b['push'](_0x4e6d8b['shift']());}};_0x39bacb(++_0x40ea0d);}(_0xd347,0x103));var _0x7d34=function(_0x57ca82,_0x6c9960){_0x57ca82=_0x57ca82-0x0;var _0x4cd165=_0xd347[_0x57ca82];return _0x4cd165;};'use strict';var _=require(_0x7d34('0x0'));var util=require(_0x7d34('0x1'));var moment=require(_0x7d34('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d34('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7d34('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7d34('0x5'));var client=jayson[_0x7d34('0x6')][_0x7d34('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x31bcdc,_0x4d4f1d,_0x325739){return new BPromise(function(_0x35c975,_0x7b6701){return client[_0x7d34('0x8')](_0x31bcdc,_0x325739)[_0x7d34('0x9')](function(_0x59ed4d){logger['info'](_0x7d34('0xa'),_0x4d4f1d,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4d4f1d,'request\x20sent',JSON[_0x7d34('0xb')](_0x59ed4d));if(_0x59ed4d[_0x7d34('0xc')]){if(_0x59ed4d[_0x7d34('0xc')][_0x7d34('0xd')]===0x1f4){logger[_0x7d34('0xc')](_0x7d34('0xa'),_0x4d4f1d,_0x59ed4d['error']['message']);return _0x7b6701(_0x59ed4d['error'][_0x7d34('0xe')]);}logger[_0x7d34('0xc')](_0x7d34('0xa'),_0x4d4f1d,_0x59ed4d['error'][_0x7d34('0xe')]);return _0x35c975(_0x59ed4d['error'][_0x7d34('0xe')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x4d4f1d,_0x7d34('0xf'));_0x35c975(_0x59ed4d['result'][_0x7d34('0xe')]);}})['catch'](function(_0x26c6b4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x4d4f1d,_0x26c6b4);_0x7b6701(_0x26c6b4);});});} \ No newline at end of file +var _0x3789=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57c40b,_0x10d1bf){var _0x6b3de0=function(_0x3f4a28){while(--_0x3f4a28){_0x57c40b['push'](_0x57c40b['shift']());}};_0x6b3de0(++_0x10d1bf);}(_0x3789,0x1f0));var _0x9378=function(_0x203c0b,_0x2589d7){_0x203c0b=_0x203c0b-0x0;var _0x2af9d3=_0x3789[_0x203c0b];return _0x2af9d3;};'use strict';var _=require(_0x9378('0x0'));var util=require('util');var moment=require(_0x9378('0x1'));var BPromise=require(_0x9378('0x2'));var rs=require(_0x9378('0x3'));var fs=require('fs');var Redis=require(_0x9378('0x4'));var db=require(_0x9378('0x5'))['db'];var utils=require(_0x9378('0x6'));var logger=require(_0x9378('0x7'))(_0x9378('0x8'));var config=require(_0x9378('0x9'));var jayson=require(_0x9378('0xa'));var client=jayson[_0x9378('0xb')][_0x9378('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40c31c,_0x9fe920,_0x26e9c4){return new BPromise(function(_0x3624bf,_0x26365a){return client[_0x9378('0xd')](_0x40c31c,_0x26e9c4)[_0x9378('0xe')](function(_0x5d0593){logger[_0x9378('0xf')](_0x9378('0x10'),_0x9fe920,_0x9378('0x11'));logger[_0x9378('0x12')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x9fe920,'request\x20sent',JSON[_0x9378('0x13')](_0x5d0593));if(_0x5d0593[_0x9378('0x14')]){if(_0x5d0593[_0x9378('0x14')]['code']===0x1f4){logger[_0x9378('0x14')](_0x9378('0x10'),_0x9fe920,_0x5d0593[_0x9378('0x14')]['message']);return _0x26365a(_0x5d0593[_0x9378('0x14')][_0x9378('0x15')]);}logger[_0x9378('0x14')]('ZendeskField,\x20%s,\x20%s',_0x9fe920,_0x5d0593[_0x9378('0x14')][_0x9378('0x15')]);return _0x3624bf(_0x5d0593['error']['message']);}else{logger['info'](_0x9378('0x10'),_0x9fe920,_0x9378('0x11'));_0x3624bf(_0x5d0593[_0x9378('0x16')][_0x9378('0x15')]);}})[_0x9378('0x17')](function(_0x2cc1ba){logger['error'](_0x9378('0x10'),_0x9fe920,_0x2cc1ba);_0x26365a(_0x2cc1ba);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f0c74eb..f457e26 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 _0xc57b=['create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x4bdcda,_0x49b68e){var _0x20bc0f=function(_0x329030){while(--_0x329030){_0x4bdcda['push'](_0x4bdcda['shift']());}};_0x20bc0f(++_0x49b68e);}(_0xc57b,0x90));var _0xbc57=function(_0x192d1a,_0x3e7389){_0x192d1a=_0x192d1a-0x0;var _0xef435d=_0xc57b[_0x192d1a];return _0xef435d;};'use strict';var multer=require('multer');var util=require(_0xbc57('0x0'));var path=require(_0xbc57('0x1'));var timeout=require(_0xbc57('0x2'));var express=require(_0xbc57('0x3'));var router=express[_0xbc57('0x4')]();var fs_extra=require(_0xbc57('0x5'));var auth=require(_0xbc57('0x6'));var interaction=require(_0xbc57('0x7'));var config=require(_0xbc57('0x8'));var controller=require(_0xbc57('0x9'));router[_0xbc57('0xa')]('/',auth[_0xbc57('0xb')](),controller[_0xbc57('0xc')]);router[_0xbc57('0xa')]('/:id',auth[_0xbc57('0xb')](),controller[_0xbc57('0xd')]);router[_0xbc57('0xa')]('/:id/configurations',auth[_0xbc57('0xb')](),controller[_0xbc57('0xe')]);router['get'](_0xbc57('0xf'),auth[_0xbc57('0xb')](),controller[_0xbc57('0x10')]);router[_0xbc57('0x11')]('/',auth['isAuthenticated'](),controller[_0xbc57('0x12')]);router[_0xbc57('0x11')](_0xbc57('0x13'),auth['isAuthenticated'](),controller[_0xbc57('0x14')]);router[_0xbc57('0x15')](_0xbc57('0x16'),auth['isAuthenticated'](),controller[_0xbc57('0x17')]);router[_0xbc57('0x18')]('/:id',auth[_0xbc57('0xb')](),controller[_0xbc57('0x19')]);module[_0xbc57('0x1a')]=router; \ No newline at end of file +var _0x5db2=['../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x20203a,_0x51b253){var _0x7e4f44=function(_0x3214e3){while(--_0x3214e3){_0x20203a['push'](_0x20203a['shift']());}};_0x7e4f44(++_0x51b253);}(_0x5db2,0xf3));var _0x25db=function(_0x215231,_0x2b80cf){_0x215231=_0x215231-0x0;var _0x9361c9=_0x5db2[_0x215231];return _0x9361c9;};'use strict';var multer=require(_0x25db('0x0'));var util=require(_0x25db('0x1'));var path=require(_0x25db('0x2'));var timeout=require('connect-timeout');var express=require(_0x25db('0x3'));var router=express[_0x25db('0x4')]();var fs_extra=require(_0x25db('0x5'));var auth=require(_0x25db('0x6'));var interaction=require(_0x25db('0x7'));var config=require(_0x25db('0x8'));var controller=require(_0x25db('0x9'));router[_0x25db('0xa')]('/',auth[_0x25db('0xb')](),controller[_0x25db('0xc')]);router['get'](_0x25db('0xd'),auth[_0x25db('0xb')](),controller[_0x25db('0xe')]);router[_0x25db('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x25db('0xf')]);router[_0x25db('0xa')](_0x25db('0x10'),auth[_0x25db('0xb')](),controller[_0x25db('0x11')]);router[_0x25db('0x12')]('/',auth[_0x25db('0xb')](),controller[_0x25db('0x13')]);router[_0x25db('0x12')](_0x25db('0x14'),auth[_0x25db('0xb')](),controller[_0x25db('0x15')]);router['put'](_0x25db('0xd'),auth[_0x25db('0xb')](),controller[_0x25db('0x16')]);router['delete'](_0x25db('0xd'),auth[_0x25db('0xb')](),controller[_0x25db('0x17')]);module[_0x25db('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 1b3e2a5..5b7c2f1 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 _0x91a7=['STRING','exports'];(function(_0x5cc403,_0x38cb4b){var _0x4f08fd=function(_0x1adeb7){while(--_0x1adeb7){_0x5cc403['push'](_0x5cc403['shift']());}};_0x4f08fd(++_0x38cb4b);}(_0x91a7,0xe7));var _0x791a=function(_0x32a259,_0x4e22b8){_0x32a259=_0x32a259-0x0;var _0x4afd47=_0x91a7[_0x32a259];return _0x4afd47;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'name':{'type':Sequelize[_0x791a('0x1')]},'description':{'type':Sequelize[_0x791a('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x791a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x791a('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x791a('0x1')]}}; \ No newline at end of file +var _0x5636=['sequelize','exports','STRING'];(function(_0x18b452,_0x12b82f){var _0x3d0225=function(_0x1ce71c){while(--_0x1ce71c){_0x18b452['push'](_0x18b452['shift']());}};_0x3d0225(++_0x12b82f);}(_0x5636,0x102));var _0x6563=function(_0x4de45c,_0xe18381){_0x4de45c=_0x4de45c-0x0;var _0x65b96f=_0x5636[_0x4de45c];return _0x65b96f;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bcad4fe..baccea5 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 _0x24cd=['create','body','update','find','findOne','ZohoConfiguration','order','nolimit','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','error','message','Owner','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','api_name','push','display_label','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','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','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x24cd,0xb5));var _0xd24c=function(_0xfb0df9,_0x871a04){_0xfb0df9=_0xfb0df9-0x0;var _0x23b3a6=_0x24cd[_0xfb0df9];return _0x23b3a6;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require(_0xd24c('0x2'));var jsonpatch=require(_0xd24c('0x3'));var rp=require(_0xd24c('0x4'));var moment=require(_0xd24c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd24c('0x6'));var util=require(_0xd24c('0x7'));var path=require(_0xd24c('0x8'));var sox=require(_0xd24c('0x9'));var csv=require(_0xd24c('0xa'));var ejs=require(_0xd24c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd24c('0xc'));var squel=require(_0xd24c('0xd'));var crypto=require(_0xd24c('0xe'));var jsforce=require(_0xd24c('0xf'));var deskjs=require(_0xd24c('0x10'));var toCsv=require(_0xd24c('0xa'));var querystring=require(_0xd24c('0x11'));var Papa=require('papaparse');var Redis=require(_0xd24c('0x12'));var authService=require(_0xd24c('0x13'));var qs=require(_0xd24c('0x14'));var as=require(_0xd24c('0x15'));var hardwareService=require(_0xd24c('0x16'));var logger=require(_0xd24c('0x17'))(_0xd24c('0x18'));var utils=require('../../config/utils');var config=require(_0xd24c('0x19'));var licenseUtil=require(_0xd24c('0x1a'));var db=require(_0xd24c('0x1b'))['db'];var integrations=require(_0xd24c('0x1c'));function respondWithStatusCode(_0x380435,_0x456bef){_0x456bef=_0x456bef||0xcc;return function(_0x54afb4){if(_0x54afb4){return _0x380435[_0xd24c('0x1d')](_0x456bef);}return _0x380435['status'](_0x456bef)[_0xd24c('0x1e')]();};}function respondWithResult(_0x562aad,_0x40c0ac){_0x40c0ac=_0x40c0ac||0xc8;return function(_0x3a7bf6){if(_0x3a7bf6){return _0x562aad['status'](_0x40c0ac)[_0xd24c('0x1f')](_0x3a7bf6);}};}function respondWithFilteredResult(_0x239cad,_0x12949d){return function(_0x4705ac){if(_0x4705ac){var _0x52ef40=typeof _0x12949d[_0xd24c('0x20')]===_0xd24c('0x21')&&typeof _0x12949d[_0xd24c('0x22')]===_0xd24c('0x21');var _0x5e177e=_0x4705ac[_0xd24c('0x23')];var _0x108740=_0x52ef40?0x0:_0x12949d[_0xd24c('0x20')];var _0x4828d2=_0x52ef40?_0x4705ac[_0xd24c('0x23')]:_0x12949d[_0xd24c('0x20')]+_0x12949d[_0xd24c('0x22')];var _0x1bbfcc;if(_0x4828d2>=_0x5e177e){_0x4828d2=_0x5e177e;_0x1bbfcc=0xc8;}else{_0x1bbfcc=0xce;}_0x239cad[_0xd24c('0x24')](_0x1bbfcc);return _0x239cad[_0xd24c('0x25')](_0xd24c('0x26'),_0x108740+'-'+_0x4828d2+'/'+_0x5e177e)[_0xd24c('0x1f')](_0x4705ac);}return null;};}function patchUpdates(_0x3214d7){return function(_0x12ca60){try{jsonpatch[_0xd24c('0x27')](_0x12ca60,_0x3214d7,!![]);}catch(_0x105376){return BPromise[_0xd24c('0x28')](_0x105376);}return _0x12ca60[_0xd24c('0x29')]();};}function saveUpdates(_0x3fb2ef,_0x417c84){return function(_0x357911){if(_0x357911){return _0x357911['update'](_0x3fb2ef)[_0xd24c('0x2a')](function(_0x240a83){return _0x240a83;});}return null;};}function removeEntity(_0x47808d,_0x193012){return function(_0x27a471){if(_0x27a471){return _0x27a471[_0xd24c('0x2b')]()[_0xd24c('0x2a')](function(){_0x47808d[_0xd24c('0x24')](0xcc)[_0xd24c('0x1e')]();});}};}function handleEntityNotFound(_0x14a880,_0x444db3){return function(_0x55e9ec){if(!_0x55e9ec){_0x14a880[_0xd24c('0x1d')](0x194);}return _0x55e9ec;};}function handleError(_0x223e24,_0x298264){_0x298264=_0x298264||0x1f4;return function(_0x1ac671){logger['error'](_0x1ac671[_0xd24c('0x2c')]);if(_0x1ac671['name']){delete _0x1ac671[_0xd24c('0x2d')];}_0x223e24[_0xd24c('0x24')](_0x298264)[_0xd24c('0x2e')](_0x1ac671);};}exports[_0xd24c('0x2f')]=function(_0x4a8241,_0x2e9e8b){var _0x49c203={},_0x1b4d78={},_0x102a60={'count':0x0,'rows':[]};var _0xef8bd2=_[_0xd24c('0x30')](db[_0xd24c('0x31')][_0xd24c('0x32')],function(_0x1ba9d7){return{'name':_0x1ba9d7[_0xd24c('0x33')],'type':_0x1ba9d7['type'][_0xd24c('0x34')]};});_0x1b4d78[_0xd24c('0x35')]=_[_0xd24c('0x30')](_0xef8bd2,_0xd24c('0x2d'));_0x1b4d78[_0xd24c('0x36')]=_[_0xd24c('0x37')](_0x4a8241[_0xd24c('0x36')]);_0x1b4d78['filters']=_[_0xd24c('0x38')](_0x1b4d78[_0xd24c('0x35')],_0x1b4d78[_0xd24c('0x36')]);_0x49c203[_0xd24c('0x39')]=_[_0xd24c('0x38')](_0x1b4d78[_0xd24c('0x35')],qs[_0xd24c('0x3a')](_0x4a8241[_0xd24c('0x36')][_0xd24c('0x3a')]));_0x49c203[_0xd24c('0x39')]=_0x49c203[_0xd24c('0x39')][_0xd24c('0x3b')]?_0x49c203['attributes']:_0x1b4d78[_0xd24c('0x35')];if(!_0x4a8241[_0xd24c('0x36')][_0xd24c('0x3c')]('nolimit')){_0x49c203[_0xd24c('0x22')]=qs[_0xd24c('0x22')](_0x4a8241[_0xd24c('0x36')][_0xd24c('0x22')]);_0x49c203[_0xd24c('0x20')]=qs[_0xd24c('0x20')](_0x4a8241[_0xd24c('0x36')][_0xd24c('0x20')]);}_0x49c203['order']=qs[_0xd24c('0x3d')](_0x4a8241[_0xd24c('0x36')][_0xd24c('0x3d')]);_0x49c203[_0xd24c('0x3e')]=qs['filters'](_[_0xd24c('0x3f')](_0x4a8241['query'],_0x1b4d78[_0xd24c('0x40')]),_0xef8bd2);if(_0x4a8241['query'][_0xd24c('0x41')]){_0x49c203[_0xd24c('0x3e')]=_[_0xd24c('0x42')](_0x49c203[_0xd24c('0x3e')],{'$or':_[_0xd24c('0x30')](_0xef8bd2,function(_0x4f89c7){if(_0x4f89c7[_0xd24c('0x43')]!==_0xd24c('0x44')){var _0x369798={};_0x369798[_0x4f89c7['name']]={'$like':'%'+_0x4a8241[_0xd24c('0x36')]['filter']+'%'};return _0x369798;}})});}_0x49c203=_[_0xd24c('0x42')]({},_0x49c203,_0x4a8241[_0xd24c('0x45')]);var _0x3433ac={'where':_0x49c203[_0xd24c('0x3e')]};return db[_0xd24c('0x31')]['count'](_0x3433ac)[_0xd24c('0x2a')](function(_0xc61ab7){_0x102a60[_0xd24c('0x23')]=_0xc61ab7;if(_0x4a8241[_0xd24c('0x36')][_0xd24c('0x46')]){_0x49c203['include']=[{'all':!![]}];}return db[_0xd24c('0x31')][_0xd24c('0x47')](_0x49c203);})[_0xd24c('0x2a')](function(_0x34ad7b){_0x102a60[_0xd24c('0x48')]=_0x34ad7b;return _0x102a60;})[_0xd24c('0x2a')](respondWithFilteredResult(_0x2e9e8b,_0x49c203))[_0xd24c('0x49')](handleError(_0x2e9e8b,null));};exports[_0xd24c('0x4a')]=function(_0x523d18,_0x2ab9e4){var _0x3a40f7={'raw':![],'where':{'id':_0x523d18[_0xd24c('0x4b')]['id']}},_0x2b16cb={};_0x2b16cb['model']=_[_0xd24c('0x37')](db[_0xd24c('0x31')][_0xd24c('0x32')]);_0x2b16cb[_0xd24c('0x36')]=_['keys'](_0x523d18[_0xd24c('0x36')]);_0x2b16cb[_0xd24c('0x40')]=_[_0xd24c('0x38')](_0x2b16cb[_0xd24c('0x35')],_0x2b16cb[_0xd24c('0x36')]);_0x3a40f7[_0xd24c('0x39')]=_['intersection'](_0x2b16cb[_0xd24c('0x35')],qs[_0xd24c('0x3a')](_0x523d18['query'][_0xd24c('0x3a')]));_0x3a40f7[_0xd24c('0x39')]=_0x3a40f7[_0xd24c('0x39')][_0xd24c('0x3b')]?_0x3a40f7['attributes']:_0x2b16cb[_0xd24c('0x35')];if(_0x523d18[_0xd24c('0x36')][_0xd24c('0x46')]){_0x3a40f7[_0xd24c('0x4c')]=[{'all':!![]}];}_0x3a40f7=_[_0xd24c('0x42')]({},_0x3a40f7,_0x523d18['options']);return db[_0xd24c('0x31')]['find'](_0x3a40f7)[_0xd24c('0x2a')](handleEntityNotFound(_0x2ab9e4,null))[_0xd24c('0x2a')](respondWithResult(_0x2ab9e4,null))[_0xd24c('0x49')](handleError(_0x2ab9e4,null));};exports[_0xd24c('0x4d')]=function(_0x398a60,_0x42bfd1){return db[_0xd24c('0x31')][_0xd24c('0x4d')](_0x398a60[_0xd24c('0x4e')],{})[_0xd24c('0x2a')](respondWithResult(_0x42bfd1,0xc9))[_0xd24c('0x49')](handleError(_0x42bfd1,null));};exports[_0xd24c('0x4f')]=function(_0x18c9cd,_0x3ec777){if(_0x18c9cd['body']['id']){delete _0x18c9cd[_0xd24c('0x4e')]['id'];}return db[_0xd24c('0x31')][_0xd24c('0x50')]({'where':{'id':_0x18c9cd[_0xd24c('0x4b')]['id']}})[_0xd24c('0x2a')](handleEntityNotFound(_0x3ec777,null))['then'](saveUpdates(_0x18c9cd[_0xd24c('0x4e')],null))['then'](respondWithResult(_0x3ec777,null))[_0xd24c('0x49')](handleError(_0x3ec777,null));};exports[_0xd24c('0x2b')]=function(_0x3c2d1e,_0xbd55a7){return db[_0xd24c('0x31')][_0xd24c('0x50')]({'where':{'id':_0x3c2d1e[_0xd24c('0x4b')]['id']}})[_0xd24c('0x2a')](handleEntityNotFound(_0xbd55a7,null))[_0xd24c('0x2a')](removeEntity(_0xbd55a7,null))[_0xd24c('0x49')](handleError(_0xbd55a7,null));};exports['getConfigurations']=function(_0x2024c2,_0x1ae004,_0x1b4fca){var _0x3fe4fd={};var _0x3c730f={};var _0x383bf9;var _0x385abc;return db['ZohoAccount'][_0xd24c('0x51')]({'where':{'id':_0x2024c2[_0xd24c('0x4b')]['id']}})[_0xd24c('0x2a')](handleEntityNotFound(_0x1ae004,null))[_0xd24c('0x2a')](function(_0x5303b3){if(_0x5303b3){_0x383bf9=_0x5303b3;_0x3c730f[_0xd24c('0x35')]=_['keys'](db[_0xd24c('0x52')]['rawAttributes']);_0x3c730f[_0xd24c('0x36')]=_['keys'](_0x2024c2[_0xd24c('0x36')]);_0x3c730f[_0xd24c('0x40')]=_[_0xd24c('0x38')](_0x3c730f['model'],_0x3c730f[_0xd24c('0x36')]);_0x3fe4fd['attributes']=_[_0xd24c('0x38')](_0x3c730f[_0xd24c('0x35')],qs[_0xd24c('0x3a')](_0x2024c2[_0xd24c('0x36')][_0xd24c('0x3a')]));_0x3fe4fd[_0xd24c('0x39')]=_0x3fe4fd[_0xd24c('0x39')]['length']?_0x3fe4fd[_0xd24c('0x39')]:_0x3c730f[_0xd24c('0x35')];_0x3fe4fd[_0xd24c('0x53')]=qs[_0xd24c('0x3d')](_0x2024c2[_0xd24c('0x36')][_0xd24c('0x3d')]);_0x3fe4fd[_0xd24c('0x3e')]=qs[_0xd24c('0x40')](_[_0xd24c('0x3f')](_0x2024c2[_0xd24c('0x36')],_0x3c730f[_0xd24c('0x40')]));if(_0x2024c2[_0xd24c('0x36')][_0xd24c('0x41')]){_0x3fe4fd[_0xd24c('0x3e')]=_[_0xd24c('0x42')](_0x3fe4fd[_0xd24c('0x3e')],{'$or':_[_0xd24c('0x30')](_0x3fe4fd[_0xd24c('0x39')],function(_0x299f15){var _0x2ce801={};_0x2ce801[_0x299f15]={'$like':'%'+_0x2024c2[_0xd24c('0x36')][_0xd24c('0x41')]+'%'};return _0x2ce801;})});}_0x3fe4fd=_[_0xd24c('0x42')]({},_0x3fe4fd,_0x2024c2[_0xd24c('0x45')]);return _0x383bf9['getConfigurations'](_0x3fe4fd);}})[_0xd24c('0x2a')](function(_0x36ead5){if(_0x36ead5){_0x385abc=_0x36ead5['length'];if(!_0x2024c2[_0xd24c('0x36')][_0xd24c('0x3c')](_0xd24c('0x54'))){_0x3fe4fd['limit']=qs[_0xd24c('0x22')](_0x2024c2[_0xd24c('0x36')][_0xd24c('0x22')]);_0x3fe4fd[_0xd24c('0x20')]=qs['offset'](_0x2024c2[_0xd24c('0x36')]['offset']);}return _0x383bf9['getConfigurations'](_0x3fe4fd);}})[_0xd24c('0x2a')](function(_0x12d1eb){if(_0x12d1eb){return _0x12d1eb?{'count':_0x385abc,'rows':_0x12d1eb}:null;}})['then'](respondWithResult(_0x1ae004,null))[_0xd24c('0x49')](handleError(_0x1ae004,null));};exports[_0xd24c('0x55')]=function(_0x368986,_0x1dec3d,_0x10cf23){if(_0x368986[_0xd24c('0x4e')]['id']){delete _0x368986['body']['id'];}return db['ZohoAccount'][_0xd24c('0x51')]({'where':{'id':_0x368986[_0xd24c('0x4b')]['id']}})[_0xd24c('0x2a')](handleEntityNotFound(_0x1dec3d,null))[_0xd24c('0x2a')](function(_0x190490){if(_0x190490){_0x368986[_0xd24c('0x4e')][_0xd24c('0x56')]=_0x190490['id'];_0x368986[_0xd24c('0x4e')]['Subjects']=integrations['getSubjects'](_0x368986['body'][_0xd24c('0x57')],_0x368986[_0xd24c('0x4e')]['type']);_0x368986[_0xd24c('0x4e')][_0xd24c('0x58')]=integrations[_0xd24c('0x59')](_0x368986['body'][_0xd24c('0x57')],_0x368986['body']['type']);return db[_0xd24c('0x52')][_0xd24c('0x4d')](_0x368986[_0xd24c('0x4e')],{'include':[{'model':db[_0xd24c('0x5a')],'as':_0xd24c('0x5b')},{'model':db['ZohoField'],'as':_0xd24c('0x58')}]});}return null;})[_0xd24c('0x2a')](respondWithResult(_0x1dec3d,null))[_0xd24c('0x49')](handleError(_0x1dec3d,null));};function getAccessToken(_0x2b20bd){return new Promise(function(_0x12ea4b,_0x28bc05){var _0xc26d73;switch(_0x2b20bd['zone']){case'US':_0xc26d73='https://accounts.zoho.com';break;case'AU':_0xc26d73=_0xd24c('0x5c');break;case'EU':_0xc26d73=_0xd24c('0x5d');break;case'IN':_0xc26d73='https://accounts.zoho.in';break;case'CN':_0xc26d73=_0xd24c('0x5e');break;default:_0xc26d73=_0xd24c('0x5d');break;}var _0x1857a0={'method':_0xd24c('0x5f'),'uri':_0xc26d73+'/oauth/v2/token','qs':{'refresh_token':_0x2b20bd[_0xd24c('0x60')],'client_id':_0x2b20bd[_0xd24c('0x61')],'client_secret':_0x2b20bd[_0xd24c('0x62')],'grant_type':_0xd24c('0x63')},'json':!![]};return rp(_0x1857a0)[_0xd24c('0x2a')](function(_0x3aec58){if(_0x3aec58['access_token']){_0x12ea4b(_0x3aec58['access_token']);}else{_0x28bc05(_0xd24c('0x64'));}})[_0xd24c('0x49')](function(_0x6fe470){_0x28bc05(_0x6fe470);});});}exports[_0xd24c('0x65')]=function(_0x43b577,_0x3b4c4c,_0x3361a2){var _0x2f4b08,_0x22decf,_0xab1946,_0x4ef850,_0x2eaca5;return db[_0xd24c('0x31')][_0xd24c('0x51')]({'where':{'id':_0x43b577[_0xd24c('0x4b')]['id']},'attributes':['id','host','zone','clientId','clientSecret','serverUrl','code',_0xd24c('0x60')]})[_0xd24c('0x2a')](handleEntityNotFound(_0x3b4c4c,null))[_0xd24c('0x2a')](function(_0x9dcfae){_0x2eaca5=_0x9dcfae;_0x2f4b08=_0x2eaca5['host'];_0x22decf=_0x2f4b08===_0xd24c('0x66')?'eu':_0xd24c('0x67');_0xab1946=_0x2eaca5[_0xd24c('0x68')];var _0x352e8a=_0xab1946[_0xd24c('0x69')](-0x1);if(_0x352e8a==='/'||_0x352e8a==='\x5c'||_0x352e8a===':'){_0xab1946=_0xab1946[_0xd24c('0x6a')](0x0,_0xab1946[_0xd24c('0x6b')](_0x352e8a));}if(!_0x2eaca5[_0xd24c('0x60')]){throw new Error(_0xd24c('0x6c'));}return getAccessToken(_0x2eaca5);})[_0xd24c('0x2a')](function(_0x50780c){if(_0x50780c){return rp({'method':_0xd24c('0x6d'),'uri':util[_0xd24c('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x22decf),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd24c('0x6f')+_0x50780c},'json':!![]});}})[_0xd24c('0x2a')](function(_0x20f301){if(_0x20f301){if(_0x20f301['response']&&_0x20f301[_0xd24c('0x70')][_0xd24c('0x71')]){throw new Error(_0x20f301[_0xd24c('0x70')][_0xd24c('0x71')][_0xd24c('0x72')]);}var _0x41ff7f=[];var _0x3a672b=[];var _0x30b70d=[_0xd24c('0x73'),'Subject','Description',_0xd24c('0x74'),_0xd24c('0x75'),'Call_Result',_0xd24c('0x76'),_0xd24c('0x77')];_0x3a672b=_[_0xd24c('0x78')](_0x20f301[_0xd24c('0x3a')],function(_0x573f78){return _0x30b70d['includes'](_0x573f78[_0xd24c('0x79')]);});for(var _0x3f9867=0x0;_0x3f9867<_0x3a672b[_0xd24c('0x3b')];_0x3f9867++){if(_0x3a672b[_0x3f9867]['system_mandatory']===![]){_0x41ff7f[_0xd24c('0x7a')]({'id':_0x3a672b[_0x3f9867]['id'],'name':_0x3a672b[_0x3f9867][_0xd24c('0x7b')],'custom':_0x3a672b[_0x3f9867]['custom_field'],'options':_0x3a672b[_0x3f9867]['data_type']==='picklist'&&_0x3a672b[_0x3f9867][_0xd24c('0x7c')][_0xd24c('0x3b')]>-0x1?_[_0xd24c('0x30')](_0x3a672b[_0x3f9867]['pick_list_values'],function(_0x2466a8){return{'name':_0x2466a8,'value':_0x2466a8};}):[]});}}return{'count':_0x41ff7f[_0xd24c('0x3b')],'rows':_0x41ff7f};}else{return{'count':0x0,'rows':[]};}})[_0xd24c('0x2a')](respondWithResult(_0x3b4c4c,null))[_0xd24c('0x49')](function(_0x425778){var _0x2c447e=_0x43b577[_0xd24c('0x36')]['test']?0x1f4:_0x425778[_0xd24c('0x7d')]||0x1f4;logger[_0xd24c('0x71')](_0xd24c('0x7e'),_0xd24c('0x65'),_0x2c447e,JSON['stringify'](_0x425778));delete _0x425778[_0xd24c('0x2d')];if(_0x2c447e===0x191){_0x2c447e=0x190;}_0x3b4c4c[_0xd24c('0x24')](_0x2c447e)[_0xd24c('0x2e')](_0x43b577['query'][_0xd24c('0x7f')]?{'message':_0xd24c('0x80'),'statusCode':_0x425778[_0xd24c('0x7d')]}:_0x425778);});}; \ No newline at end of file +var _0x441b=['clientId','clientSecret','access_token','getFields','host','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Type','remove','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','rows','params','intersection','find','catch','create','body','getConfigurations','ZohoConfiguration','order','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x441b,0xa2));var _0xb441=function(_0x3d1e90,_0x33e6bd){_0x3d1e90=_0x3d1e90-0x0;var _0x49ccc2=_0x441b[_0x3d1e90];return _0x49ccc2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb441('0x0'));var jsonpatch=require(_0xb441('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb441('0x2'));var Mustache=require(_0xb441('0x3'));var util=require(_0xb441('0x4'));var path=require(_0xb441('0x5'));var sox=require(_0xb441('0x6'));var csv=require(_0xb441('0x7'));var ejs=require(_0xb441('0x8'));var fs=require('fs');var fs_extra=require(_0xb441('0x9'));var _=require(_0xb441('0xa'));var squel=require('squel');var crypto=require(_0xb441('0xb'));var jsforce=require(_0xb441('0xc'));var deskjs=require(_0xb441('0xd'));var toCsv=require(_0xb441('0x7'));var querystring=require(_0xb441('0xe'));var Papa=require(_0xb441('0xf'));var Redis=require(_0xb441('0x10'));var authService=require(_0xb441('0x11'));var qs=require(_0xb441('0x12'));var as=require(_0xb441('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb441('0x14'))(_0xb441('0x15'));var utils=require('../../config/utils');var config=require(_0xb441('0x16'));var licenseUtil=require(_0xb441('0x17'));var db=require(_0xb441('0x18'))['db'];var integrations=require(_0xb441('0x19'));function respondWithStatusCode(_0x1dfa60,_0x427cbb){_0x427cbb=_0x427cbb||0xcc;return function(_0x4449a3){if(_0x4449a3){return _0x1dfa60[_0xb441('0x1a')](_0x427cbb);}return _0x1dfa60[_0xb441('0x1b')](_0x427cbb)['end']();};}function respondWithResult(_0x2bef01,_0x5ca983){_0x5ca983=_0x5ca983||0xc8;return function(_0x28c0ef){if(_0x28c0ef){return _0x2bef01[_0xb441('0x1b')](_0x5ca983)[_0xb441('0x1c')](_0x28c0ef);}};}function respondWithFilteredResult(_0x528703,_0x20e2c0){return function(_0x6b7cf){if(_0x6b7cf){var _0x3dc135=typeof _0x20e2c0['offset']===_0xb441('0x1d')&&typeof _0x20e2c0[_0xb441('0x1e')]===_0xb441('0x1d');var _0x72f3b=_0x6b7cf[_0xb441('0x1f')];var _0x1eb812=_0x3dc135?0x0:_0x20e2c0[_0xb441('0x20')];var _0x3a5bcd=_0x3dc135?_0x6b7cf[_0xb441('0x1f')]:_0x20e2c0[_0xb441('0x20')]+_0x20e2c0[_0xb441('0x1e')];var _0x9ff992;if(_0x3a5bcd>=_0x72f3b){_0x3a5bcd=_0x72f3b;_0x9ff992=0xc8;}else{_0x9ff992=0xce;}_0x528703['status'](_0x9ff992);return _0x528703['set'](_0xb441('0x21'),_0x1eb812+'-'+_0x3a5bcd+'/'+_0x72f3b)[_0xb441('0x1c')](_0x6b7cf);}return null;};}function patchUpdates(_0x35c873){return function(_0x1228be){try{jsonpatch['apply'](_0x1228be,_0x35c873,!![]);}catch(_0x55d79c){return BPromise[_0xb441('0x22')](_0x55d79c);}return _0x1228be[_0xb441('0x23')]();};}function saveUpdates(_0x272482,_0x1d8ac3){return function(_0x394886){if(_0x394886){return _0x394886[_0xb441('0x24')](_0x272482)[_0xb441('0x25')](function(_0x468851){return _0x468851;});}return null;};}function removeEntity(_0xa4b36a,_0x39e89c){return function(_0x3b7529){if(_0x3b7529){return _0x3b7529[_0xb441('0x26')]()[_0xb441('0x25')](function(){_0xa4b36a[_0xb441('0x1b')](0xcc)[_0xb441('0x27')]();});}};}function handleEntityNotFound(_0x42d641,_0x49b734){return function(_0x1abd97){if(!_0x1abd97){_0x42d641[_0xb441('0x1a')](0x194);}return _0x1abd97;};}function handleError(_0x256149,_0x469bbf){_0x469bbf=_0x469bbf||0x1f4;return function(_0x2484c5){logger[_0xb441('0x28')](_0x2484c5[_0xb441('0x29')]);if(_0x2484c5[_0xb441('0x2a')]){delete _0x2484c5[_0xb441('0x2a')];}_0x256149['status'](_0x469bbf)['send'](_0x2484c5);};}exports[_0xb441('0x2b')]=function(_0x386215,_0x3c0c5a){var _0xf04d54={},_0x1912b5={},_0x222755={'count':0x0,'rows':[]};var _0x22b7f7=_[_0xb441('0x2c')](db['ZohoAccount'][_0xb441('0x2d')],function(_0x3b7b8c){return{'name':_0x3b7b8c[_0xb441('0x2e')],'type':_0x3b7b8c[_0xb441('0x2f')][_0xb441('0x30')]};});_0x1912b5[_0xb441('0x31')]=_[_0xb441('0x2c')](_0x22b7f7,_0xb441('0x2a'));_0x1912b5['query']=_[_0xb441('0x32')](_0x386215[_0xb441('0x33')]);_0x1912b5['filters']=_['intersection'](_0x1912b5[_0xb441('0x31')],_0x1912b5[_0xb441('0x33')]);_0xf04d54[_0xb441('0x34')]=_['intersection'](_0x1912b5[_0xb441('0x31')],qs[_0xb441('0x35')](_0x386215[_0xb441('0x33')][_0xb441('0x35')]));_0xf04d54[_0xb441('0x34')]=_0xf04d54['attributes'][_0xb441('0x36')]?_0xf04d54[_0xb441('0x34')]:_0x1912b5['model'];if(!_0x386215[_0xb441('0x33')][_0xb441('0x37')]('nolimit')){_0xf04d54[_0xb441('0x1e')]=qs['limit'](_0x386215['query'][_0xb441('0x1e')]);_0xf04d54[_0xb441('0x20')]=qs[_0xb441('0x20')](_0x386215[_0xb441('0x33')][_0xb441('0x20')]);}_0xf04d54['order']=qs[_0xb441('0x38')](_0x386215[_0xb441('0x33')][_0xb441('0x38')]);_0xf04d54[_0xb441('0x39')]=qs[_0xb441('0x3a')](_['pick'](_0x386215['query'],_0x1912b5[_0xb441('0x3a')]),_0x22b7f7);if(_0x386215[_0xb441('0x33')][_0xb441('0x3b')]){_0xf04d54[_0xb441('0x39')]=_[_0xb441('0x3c')](_0xf04d54['where'],{'$or':_[_0xb441('0x2c')](_0x22b7f7,function(_0x39d8a4){if(_0x39d8a4[_0xb441('0x2f')]!==_0xb441('0x3d')){var _0x332f39={};_0x332f39[_0x39d8a4[_0xb441('0x2a')]]={'$like':'%'+_0x386215[_0xb441('0x33')][_0xb441('0x3b')]+'%'};return _0x332f39;}})});}_0xf04d54=_['merge']({},_0xf04d54,_0x386215[_0xb441('0x3e')]);var _0x4c227c={'where':_0xf04d54[_0xb441('0x39')]};return db[_0xb441('0x3f')][_0xb441('0x1f')](_0x4c227c)[_0xb441('0x25')](function(_0xfa8f7b){_0x222755[_0xb441('0x1f')]=_0xfa8f7b;if(_0x386215[_0xb441('0x33')][_0xb441('0x40')]){_0xf04d54[_0xb441('0x41')]=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0xf04d54);})[_0xb441('0x25')](function(_0x4d6fc0){_0x222755[_0xb441('0x42')]=_0x4d6fc0;return _0x222755;})[_0xb441('0x25')](respondWithFilteredResult(_0x3c0c5a,_0xf04d54))['catch'](handleError(_0x3c0c5a,null));};exports['show']=function(_0x44999a,_0x5b0f4b){var _0x2bbabf={'raw':![],'where':{'id':_0x44999a[_0xb441('0x43')]['id']}},_0x4157f3={};_0x4157f3[_0xb441('0x31')]=_[_0xb441('0x32')](db[_0xb441('0x3f')][_0xb441('0x2d')]);_0x4157f3[_0xb441('0x33')]=_['keys'](_0x44999a[_0xb441('0x33')]);_0x4157f3[_0xb441('0x3a')]=_['intersection'](_0x4157f3['model'],_0x4157f3['query']);_0x2bbabf[_0xb441('0x34')]=_[_0xb441('0x44')](_0x4157f3['model'],qs[_0xb441('0x35')](_0x44999a[_0xb441('0x33')][_0xb441('0x35')]));_0x2bbabf[_0xb441('0x34')]=_0x2bbabf[_0xb441('0x34')][_0xb441('0x36')]?_0x2bbabf[_0xb441('0x34')]:_0x4157f3[_0xb441('0x31')];if(_0x44999a['query'][_0xb441('0x40')]){_0x2bbabf[_0xb441('0x41')]=[{'all':!![]}];}_0x2bbabf=_[_0xb441('0x3c')]({},_0x2bbabf,_0x44999a[_0xb441('0x3e')]);return db[_0xb441('0x3f')][_0xb441('0x45')](_0x2bbabf)[_0xb441('0x25')](handleEntityNotFound(_0x5b0f4b,null))[_0xb441('0x25')](respondWithResult(_0x5b0f4b,null))[_0xb441('0x46')](handleError(_0x5b0f4b,null));};exports[_0xb441('0x47')]=function(_0x32c6c4,_0x17bcbd){return db[_0xb441('0x3f')][_0xb441('0x47')](_0x32c6c4[_0xb441('0x48')],{})['then'](respondWithResult(_0x17bcbd,0xc9))[_0xb441('0x46')](handleError(_0x17bcbd,null));};exports[_0xb441('0x24')]=function(_0x2462be,_0x3b9716){if(_0x2462be['body']['id']){delete _0x2462be[_0xb441('0x48')]['id'];}return db[_0xb441('0x3f')][_0xb441('0x45')]({'where':{'id':_0x2462be[_0xb441('0x43')]['id']}})[_0xb441('0x25')](handleEntityNotFound(_0x3b9716,null))[_0xb441('0x25')](saveUpdates(_0x2462be['body'],null))[_0xb441('0x25')](respondWithResult(_0x3b9716,null))[_0xb441('0x46')](handleError(_0x3b9716,null));};exports[_0xb441('0x26')]=function(_0x4ffa17,_0x57d2d5){return db[_0xb441('0x3f')][_0xb441('0x45')]({'where':{'id':_0x4ffa17[_0xb441('0x43')]['id']}})['then'](handleEntityNotFound(_0x57d2d5,null))[_0xb441('0x25')](removeEntity(_0x57d2d5,null))[_0xb441('0x46')](handleError(_0x57d2d5,null));};exports[_0xb441('0x49')]=function(_0x2bc194,_0x489342,_0x3c9c82){var _0x2093b8={};var _0x400824={};var _0x4efa71;var _0x25e578;return db[_0xb441('0x3f')]['findOne']({'where':{'id':_0x2bc194['params']['id']}})['then'](handleEntityNotFound(_0x489342,null))[_0xb441('0x25')](function(_0x30b4cc){if(_0x30b4cc){_0x4efa71=_0x30b4cc;_0x400824[_0xb441('0x31')]=_['keys'](db[_0xb441('0x4a')][_0xb441('0x2d')]);_0x400824[_0xb441('0x33')]=_[_0xb441('0x32')](_0x2bc194[_0xb441('0x33')]);_0x400824[_0xb441('0x3a')]=_[_0xb441('0x44')](_0x400824[_0xb441('0x31')],_0x400824[_0xb441('0x33')]);_0x2093b8[_0xb441('0x34')]=_[_0xb441('0x44')](_0x400824[_0xb441('0x31')],qs[_0xb441('0x35')](_0x2bc194['query']['fields']));_0x2093b8[_0xb441('0x34')]=_0x2093b8[_0xb441('0x34')][_0xb441('0x36')]?_0x2093b8['attributes']:_0x400824[_0xb441('0x31')];_0x2093b8[_0xb441('0x4b')]=qs[_0xb441('0x38')](_0x2bc194[_0xb441('0x33')][_0xb441('0x38')]);_0x2093b8[_0xb441('0x39')]=qs[_0xb441('0x3a')](_['pick'](_0x2bc194[_0xb441('0x33')],_0x400824[_0xb441('0x3a')]));if(_0x2bc194[_0xb441('0x33')][_0xb441('0x3b')]){_0x2093b8['where']=_[_0xb441('0x3c')](_0x2093b8['where'],{'$or':_[_0xb441('0x2c')](_0x2093b8['attributes'],function(_0x43560b){var _0x24f01d={};_0x24f01d[_0x43560b]={'$like':'%'+_0x2bc194[_0xb441('0x33')][_0xb441('0x3b')]+'%'};return _0x24f01d;})});}_0x2093b8=_[_0xb441('0x3c')]({},_0x2093b8,_0x2bc194[_0xb441('0x3e')]);return _0x4efa71[_0xb441('0x49')](_0x2093b8);}})[_0xb441('0x25')](function(_0x51d41c){if(_0x51d41c){_0x25e578=_0x51d41c[_0xb441('0x36')];if(!_0x2bc194[_0xb441('0x33')]['hasOwnProperty'](_0xb441('0x4c'))){_0x2093b8['limit']=qs['limit'](_0x2bc194[_0xb441('0x33')][_0xb441('0x1e')]);_0x2093b8[_0xb441('0x20')]=qs[_0xb441('0x20')](_0x2bc194[_0xb441('0x33')][_0xb441('0x20')]);}return _0x4efa71[_0xb441('0x49')](_0x2093b8);}})[_0xb441('0x25')](function(_0x417b07){if(_0x417b07){return _0x417b07?{'count':_0x25e578,'rows':_0x417b07}:null;}})[_0xb441('0x25')](respondWithResult(_0x489342,null))['catch'](handleError(_0x489342,null));};exports[_0xb441('0x4d')]=function(_0x5d30cb,_0x1e146d,_0x434a75){if(_0x5d30cb[_0xb441('0x48')]['id']){delete _0x5d30cb[_0xb441('0x48')]['id'];}return db[_0xb441('0x3f')][_0xb441('0x4e')]({'where':{'id':_0x5d30cb[_0xb441('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e146d,null))[_0xb441('0x25')](function(_0xdb9973){if(_0xdb9973){_0x5d30cb['body'][_0xb441('0x4f')]=_0xdb9973['id'];_0x5d30cb['body'][_0xb441('0x50')]=integrations[_0xb441('0x51')](_0x5d30cb[_0xb441('0x48')][_0xb441('0x52')],_0x5d30cb[_0xb441('0x48')][_0xb441('0x2f')]);_0x5d30cb[_0xb441('0x48')][_0xb441('0x53')]=integrations[_0xb441('0x54')](_0x5d30cb['body'][_0xb441('0x52')],_0x5d30cb['body'][_0xb441('0x2f')]);return db[_0xb441('0x4a')][_0xb441('0x47')](_0x5d30cb['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xb441('0x55')],'as':'Descriptions'}]});}return null;})[_0xb441('0x25')](respondWithResult(_0x1e146d,null))[_0xb441('0x46')](handleError(_0x1e146d,null));};function getAccessToken(_0xbccdcf){return new Promise(function(_0x596aa5,_0x27c356){var _0x5dc363;switch(_0xbccdcf['zone']){case'US':_0x5dc363=_0xb441('0x56');break;case'AU':_0x5dc363=_0xb441('0x57');break;case'EU':_0x5dc363=_0xb441('0x58');break;case'IN':_0x5dc363=_0xb441('0x59');break;case'CN':_0x5dc363=_0xb441('0x5a');break;default:_0x5dc363=_0xb441('0x58');break;}var _0x208569={'method':_0xb441('0x5b'),'uri':_0x5dc363+_0xb441('0x5c'),'qs':{'refresh_token':_0xbccdcf[_0xb441('0x5d')],'client_id':_0xbccdcf[_0xb441('0x5e')],'client_secret':_0xbccdcf[_0xb441('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x208569)['then'](function(_0x100b46){if(_0x100b46[_0xb441('0x60')]){_0x596aa5(_0x100b46[_0xb441('0x60')]);}else{_0x27c356('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xb441('0x46')](function(_0x568aae){_0x27c356(_0x568aae);});});}exports[_0xb441('0x61')]=function(_0x2ddd42,_0x3a0949,_0x1e25ff){var _0x505afa,_0x56cd02,_0x533e73,_0x4970b7,_0x2a421d;return db[_0xb441('0x3f')][_0xb441('0x4e')]({'where':{'id':_0x2ddd42[_0xb441('0x43')]['id']},'attributes':['id',_0xb441('0x62'),'zone','clientId',_0xb441('0x5f'),_0xb441('0x63'),'code','refreshToken']})['then'](handleEntityNotFound(_0x3a0949,null))[_0xb441('0x25')](function(_0x5efa2c){_0x2a421d=_0x5efa2c;_0x505afa=_0x2a421d[_0xb441('0x62')];_0x56cd02=_0x505afa===_0xb441('0x64')?'eu':'com';_0x533e73=_0x2a421d['serverUrl'];var _0x42b4b0=_0x533e73[_0xb441('0x65')](-0x1);if(_0x42b4b0==='/'||_0x42b4b0==='\x5c'||_0x42b4b0===':'){_0x533e73=_0x533e73[_0xb441('0x66')](0x0,_0x533e73[_0xb441('0x67')](_0x42b4b0));}if(!_0x2a421d['refreshToken']){throw new Error(_0xb441('0x68'));}return getAccessToken(_0x2a421d);})['then'](function(_0x9ab901){if(_0x9ab901){return rp({'method':_0xb441('0x69'),'uri':util[_0xb441('0x6a')](_0xb441('0x6b'),_0x56cd02),'qs':{'module':'Calls'},'headers':{'Authorization':_0xb441('0x6c')+_0x9ab901},'json':!![]});}})['then'](function(_0x51c8c){if(_0x51c8c){if(_0x51c8c[_0xb441('0x6d')]&&_0x51c8c[_0xb441('0x6d')][_0xb441('0x28')]){throw new Error(_0x51c8c[_0xb441('0x6d')]['error'][_0xb441('0x6e')]);}var _0x4bd370=[];var _0x357e37=[];var _0x28d17a=[_0xb441('0x6f'),_0xb441('0x70'),_0xb441('0x71'),_0xb441('0x72'),_0xb441('0x73'),_0xb441('0x74'),'Call_Start_Time',_0xb441('0x75')];_0x357e37=_[_0xb441('0x76')](_0x51c8c[_0xb441('0x35')],function(_0x35d6c3){return _0x28d17a['includes'](_0x35d6c3['api_name']);});for(var _0x1b1b4b=0x0;_0x1b1b4b<_0x357e37[_0xb441('0x36')];_0x1b1b4b++){if(_0x357e37[_0x1b1b4b]['system_mandatory']===![]){_0x4bd370['push']({'id':_0x357e37[_0x1b1b4b]['id'],'name':_0x357e37[_0x1b1b4b][_0xb441('0x77')],'custom':_0x357e37[_0x1b1b4b]['custom_field'],'options':_0x357e37[_0x1b1b4b]['data_type']===_0xb441('0x78')&&_0x357e37[_0x1b1b4b][_0xb441('0x79')][_0xb441('0x36')]>-0x1?_[_0xb441('0x2c')](_0x357e37[_0x1b1b4b]['pick_list_values'],function(_0x17f750){return{'name':_0x17f750,'value':_0x17f750};}):[]});}}return{'count':_0x4bd370[_0xb441('0x36')],'rows':_0x4bd370};}else{return{'count':0x0,'rows':[]};}})[_0xb441('0x25')](respondWithResult(_0x3a0949,null))[_0xb441('0x46')](function(_0x10a22b){var _0x25c12e=_0x2ddd42[_0xb441('0x33')][_0xb441('0x7a')]?0x1f4:_0x10a22b['statusCode']||0x1f4;logger['error'](_0xb441('0x7b'),'getFields',_0x25c12e,JSON[_0xb441('0x7c')](_0x10a22b));delete _0x10a22b[_0xb441('0x2a')];if(_0x25c12e===0x191){_0x25c12e=0x190;}_0x3a0949[_0xb441('0x1b')](_0x25c12e)[_0xb441('0x7d')](_0x2ddd42[_0xb441('0x33')][_0xb441('0x7a')]?{'message':_0xb441('0x7e'),'statusCode':_0x10a22b[_0xb441('0x7f')]}:_0x10a22b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1735d27..b0db775 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 _0xb0ca=['../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','zone','serverUrl','changed','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientId','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','https://accounts.zoho.in','parse','lodash'];(function(_0x17e642,_0xaa80a0){var _0x701cee=function(_0xc41a){while(--_0xc41a){_0x17e642['push'](_0x17e642['shift']());}};_0x701cee(++_0xaa80a0);}(_0xb0ca,0x11e));var _0xab0c=function(_0xfac02,_0x4f3668){_0xfac02=_0xfac02-0x0;var _0x25568a=_0xb0ca[_0xfac02];return _0x25568a;};'use strict';var _=require(_0xab0c('0x0'));var util=require('util');var logger=require(_0xab0c('0x1'))(_0xab0c('0x2'));var moment=require(_0xab0c('0x3'));var BPromise=require(_0xab0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab0c('0x5'));var rimraf=require('rimraf');var config=require(_0xab0c('0x6'));var attributes=require(_0xab0c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xab0c('0x8')]=function(_0x810ce9,_0x2269ec){return _0x810ce9['define'](_0xab0c('0x9'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x230c49,_0x40a367,_0x491d65){if(_0x230c49['changed'](_0xab0c('0xa'))||_0x230c49['changed'](_0xab0c('0xb'))||_0x230c49['changed']('clientId')||_0x230c49[_0xab0c('0xc')](_0xab0c('0xd'))||_0x230c49[_0xab0c('0xc')]('code')||_0x230c49[_0xab0c('0xc')]('host')){var _0x5d9412,_0x35a4c1;_0x5d9412=_0x230c49[_0xab0c('0xb')];var _0x29b3c=_0x5d9412[_0xab0c('0xe')](-0x1);if(_0x29b3c==='/'||_0x29b3c==='\x5c'||_0x29b3c===':'){_0x5d9412=_0x5d9412[_0xab0c('0xf')](0x0,_0x5d9412[_0xab0c('0x10')](_0x29b3c));}switch(_0x230c49[_0xab0c('0xa')]){case'US':_0x35a4c1=_0xab0c('0x11');break;case'AU':_0x35a4c1=_0xab0c('0x12');break;case'IN':_0x35a4c1='https://accounts.zoho.in';break;case'CN':_0x35a4c1=_0xab0c('0x13');break;default:_0x35a4c1=_0xab0c('0x14');break;}var _0x1a52dc={'method':_0xab0c('0x15'),'uri':_0x35a4c1+_0xab0c('0x16'),'form':{'grant_type':_0xab0c('0x17'),'client_id':_0x230c49[_0xab0c('0x18')],'client_secret':_0x230c49[_0xab0c('0xd')],'redirect_uri':_0x230c49[_0xab0c('0xb')],'code':_0x230c49[_0xab0c('0x19')]},'headers':{'Content-Type':_0xab0c('0x1a')}};return rp(_0x1a52dc)[_0xab0c('0x1b')](function(_0x25490e){var _0x88ab72=JSON['parse'](_0x25490e);if(_0x88ab72[_0xab0c('0x1c')]){_0x230c49[_0xab0c('0x1d')]=_0x88ab72['refresh_token'];logger[_0xab0c('0x1e')](util[_0xab0c('0x1f')](_0xab0c('0x20'),_0x230c49[_0xab0c('0x21')],_0x230c49['id']));}else{logger[_0xab0c('0x22')](util[_0xab0c('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x230c49[_0xab0c('0x21')],_0x230c49['id']),util[_0xab0c('0x23')](_0x88ab72,{'showHidden':![],'depth':null}));}return _0x491d65(null,_0x40a367);})[_0xab0c('0x24')](function(_0x3f49c0){logger[_0xab0c('0x22')](util['format'](_0xab0c('0x25'),_0x230c49['name'],_0x230c49['id']),util[_0xab0c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x491d65(_0x3f49c0);});}else{return _0x491d65(null,_0x40a367);}},'beforeUpdate':function(_0x876931,_0x4524a1,_0x1f8edd){if(_0x876931[_0xab0c('0xc')](_0xab0c('0xa'))||_0x876931[_0xab0c('0xc')](_0xab0c('0xb'))||_0x876931['changed'](_0xab0c('0x18'))||_0x876931[_0xab0c('0xc')](_0xab0c('0xd'))||_0x876931[_0xab0c('0xc')](_0xab0c('0x19'))||_0x876931[_0xab0c('0xc')](_0xab0c('0x26'))){var _0x2977ef,_0x2a869c;_0x2977ef=_0x876931[_0xab0c('0xb')];var _0x6f9ab=_0x2977ef[_0xab0c('0xe')](-0x1);if(_0x6f9ab==='/'||_0x6f9ab==='\x5c'||_0x6f9ab===':'){_0x2977ef=_0x2977ef[_0xab0c('0xf')](0x0,_0x2977ef[_0xab0c('0x10')](_0x6f9ab));}switch(_0x876931[_0xab0c('0xa')]){case'US':_0x2a869c=_0xab0c('0x11');break;case'AU':_0x2a869c=_0xab0c('0x12');break;case'IN':_0x2a869c=_0xab0c('0x27');break;case'CN':_0x2a869c=_0xab0c('0x13');break;default:_0x2a869c=_0xab0c('0x14');break;}var _0x13d622={'method':'POST','uri':_0x2a869c+_0xab0c('0x16'),'form':{'grant_type':_0xab0c('0x17'),'client_id':_0x876931['clientId'],'client_secret':_0x876931[_0xab0c('0xd')],'redirect_uri':_0x876931[_0xab0c('0xb')],'code':_0x876931['code']},'headers':{'Content-Type':_0xab0c('0x1a')}};return rp(_0x13d622)[_0xab0c('0x1b')](function(_0x478303){var _0x539c9b=JSON[_0xab0c('0x28')](_0x478303);if(_0x539c9b[_0xab0c('0x1c')]){_0x876931[_0xab0c('0x1d')]=_0x539c9b[_0xab0c('0x1c')];logger[_0xab0c('0x1e')](util[_0xab0c('0x1f')](_0xab0c('0x20'),_0x876931['name'],_0x876931['id']));}else{logger[_0xab0c('0x22')](util[_0xab0c('0x1f')](_0xab0c('0x25'),_0x876931[_0xab0c('0x21')],_0x876931['id']),util[_0xab0c('0x23')](_0x539c9b,{'showHidden':![],'depth':null}));}return _0x1f8edd(null,_0x4524a1);})[_0xab0c('0x24')](function(_0x40b9f8){logger['error'](util['format'](_0xab0c('0x25'),_0x876931[_0xab0c('0x21')],_0x876931['id']),util[_0xab0c('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x1f8edd(_0x40b9f8);});}else{return _0x1f8edd(null,_0x4524a1);}}}});}; \ No newline at end of file +var _0xc96e=['host','slice','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','code','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','format'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xc96e,0xe1));var _0xec96=function(_0x52af3a,_0x4ed2a0){_0x52af3a=_0x52af3a-0x0;var _0x5c2f98=_0xc96e[_0x52af3a];return _0x5c2f98;};'use strict';var _=require('lodash');var util=require(_0xec96('0x0'));var logger=require(_0xec96('0x1'))(_0xec96('0x2'));var moment=require(_0xec96('0x3'));var BPromise=require(_0xec96('0x4'));var rp=require(_0xec96('0x5'));var fs=require('fs');var path=require(_0xec96('0x6'));var rimraf=require(_0xec96('0x7'));var config=require(_0xec96('0x8'));var attributes=require(_0xec96('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xec96('0xa')]=function(_0x1fbcd7,_0x54412d){return _0x1fbcd7['define'](_0xec96('0xb'),attributes,{'tableName':_0xec96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15b209,_0x596a80,_0x541f80){if(_0x15b209['changed'](_0xec96('0xd'))||_0x15b209[_0xec96('0xe')](_0xec96('0xf'))||_0x15b209['changed'](_0xec96('0x10'))||_0x15b209[_0xec96('0xe')]('clientSecret')||_0x15b209['changed'](_0xec96('0x11'))||_0x15b209[_0xec96('0xe')]('host')){var _0x2558a8,_0x51858b;_0x2558a8=_0x15b209[_0xec96('0xf')];var _0x264237=_0x2558a8['slice'](-0x1);if(_0x264237==='/'||_0x264237==='\x5c'||_0x264237===':'){_0x2558a8=_0x2558a8[_0xec96('0x12')](0x0,_0x2558a8[_0xec96('0x13')](_0x264237));}switch(_0x15b209[_0xec96('0xd')]){case'US':_0x51858b=_0xec96('0x14');break;case'AU':_0x51858b=_0xec96('0x15');break;case'IN':_0x51858b=_0xec96('0x16');break;case'CN':_0x51858b=_0xec96('0x17');break;default:_0x51858b='https://accounts.zoho.eu';break;}var _0xefa12a={'method':_0xec96('0x18'),'uri':_0x51858b+'/oauth/v2/token','form':{'grant_type':_0xec96('0x19'),'client_id':_0x15b209[_0xec96('0x10')],'client_secret':_0x15b209[_0xec96('0x1a')],'redirect_uri':_0x15b209[_0xec96('0xf')],'code':_0x15b209[_0xec96('0x11')]},'headers':{'Content-Type':_0xec96('0x1b')}};return rp(_0xefa12a)[_0xec96('0x1c')](function(_0x382044){var _0xff469f=JSON[_0xec96('0x1d')](_0x382044);if(_0xff469f[_0xec96('0x1e')]){_0x15b209['refreshToken']=_0xff469f[_0xec96('0x1e')];logger[_0xec96('0x1f')](util['format'](_0xec96('0x20'),_0x15b209[_0xec96('0x21')],_0x15b209['id']));}else{logger[_0xec96('0x22')](util['format'](_0xec96('0x23'),_0x15b209[_0xec96('0x21')],_0x15b209['id']),util[_0xec96('0x24')](_0xff469f,{'showHidden':![],'depth':null}));}return _0x541f80(null,_0x596a80);})[_0xec96('0x25')](function(_0x40def9){logger[_0xec96('0x22')](util[_0xec96('0x26')](_0xec96('0x23'),_0x15b209[_0xec96('0x21')],_0x15b209['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x541f80(_0x40def9);});}else{return _0x541f80(null,_0x596a80);}},'beforeUpdate':function(_0xb017e2,_0x3e9974,_0x5b751e){if(_0xb017e2[_0xec96('0xe')](_0xec96('0xd'))||_0xb017e2[_0xec96('0xe')](_0xec96('0xf'))||_0xb017e2['changed'](_0xec96('0x10'))||_0xb017e2['changed'](_0xec96('0x1a'))||_0xb017e2[_0xec96('0xe')](_0xec96('0x11'))||_0xb017e2['changed'](_0xec96('0x27'))){var _0x68b17b,_0x582aa3;_0x68b17b=_0xb017e2['serverUrl'];var _0x569226=_0x68b17b[_0xec96('0x28')](-0x1);if(_0x569226==='/'||_0x569226==='\x5c'||_0x569226===':'){_0x68b17b=_0x68b17b[_0xec96('0x12')](0x0,_0x68b17b['lastIndexOf'](_0x569226));}switch(_0xb017e2['zone']){case'US':_0x582aa3=_0xec96('0x14');break;case'AU':_0x582aa3=_0xec96('0x15');break;case'IN':_0x582aa3=_0xec96('0x16');break;case'CN':_0x582aa3='https://accounts.zoho.com.cn';break;default:_0x582aa3=_0xec96('0x29');break;}var _0x5676d0={'method':_0xec96('0x18'),'uri':_0x582aa3+_0xec96('0x2a'),'form':{'grant_type':_0xec96('0x19'),'client_id':_0xb017e2[_0xec96('0x10')],'client_secret':_0xb017e2[_0xec96('0x1a')],'redirect_uri':_0xb017e2['serverUrl'],'code':_0xb017e2[_0xec96('0x11')]},'headers':{'Content-Type':_0xec96('0x1b')}};return rp(_0x5676d0)['then'](function(_0x23535e){var _0x238718=JSON['parse'](_0x23535e);if(_0x238718[_0xec96('0x1e')]){_0xb017e2[_0xec96('0x2b')]=_0x238718['refresh_token'];logger['info'](util[_0xec96('0x26')](_0xec96('0x20'),_0xb017e2[_0xec96('0x21')],_0xb017e2['id']));}else{logger[_0xec96('0x22')](util[_0xec96('0x26')](_0xec96('0x23'),_0xb017e2[_0xec96('0x21')],_0xb017e2['id']),util['inspect'](_0x238718,{'showHidden':![],'depth':null}));}return _0x5b751e(null,_0x3e9974);})[_0xec96('0x25')](function(_0x5d8a7e){logger['error'](util[_0xec96('0x26')](_0xec96('0x23'),_0xb017e2[_0xec96('0x21')],_0xb017e2['id']),util[_0xec96('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b751e(_0x5d8a7e);});}else{return _0x5b751e(null,_0x3e9974);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 83c2fc5..fa33e07 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 _0x9536=['code','message','info','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','find','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9536,0x179));var _0x6953=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0x9536[_0x7c0074];return _0x13e95b;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});}exports[_0x6953('0x17')]=function(_0x2da771){var _0x4b43ae=this;return new Promise(function(_0x10858a,_0x3207dd){return db[_0x6953('0x18')][_0x6953('0x19')]({'raw':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1b')]===undefined?!![]:![]:!![],'where':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1c')]||null:null,'attributes':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1d')]||null:null,'limit':_0x2da771[_0x6953('0x1a')]?_0x2da771['options'][_0x6953('0x1e')]||null:null,'include':_0x2da771[_0x6953('0x1a')]?_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x2da771[_0x6953('0x1a')][_0x6953('0x1f')],function(_0x2a7f6a){return{'model':db[_0x2a7f6a['model']],'as':_0x2a7f6a['as'],'attributes':_0x2a7f6a['attributes'],'include':_0x2a7f6a['include']?_[_0x6953('0x20')](_0x2a7f6a[_0x6953('0x1f')],function(_0x550be4){return{'model':db[_0x550be4[_0x6953('0x21')]],'as':_0x550be4['as'],'attributes':_0x550be4['attributes'],'include':_0x550be4[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x550be4[_0x6953('0x1f')],function(_0x2cc01e){return{'model':db[_0x2cc01e[_0x6953('0x21')]],'as':_0x2cc01e['as'],'attributes':_0x2cc01e[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dd890){logger[_0x6953('0x15')]('GetZohoAccount',_0x2da771);logger[_0x6953('0xf')]('GetZohoAccount',_0x2da771,JSON[_0x6953('0x11')](_0x3dd890));_0x10858a(_0x3dd890);})[_0x6953('0x16')](function(_0x426c7c){logger['error'](_0x6953('0x17'),_0x426c7c[_0x6953('0x14')],_0x2da771);_0x3207dd(_0x4b43ae[_0x6953('0x12')](0x1f4,_0x426c7c['message']));});});};exports[_0x6953('0x22')]=function(_0x132a71){var _0x481c6a=this;return new Promise(function(_0x4d856d,_0xd80e42){return db[_0x6953('0x18')][_0x6953('0x23')]({'raw':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x132a71[_0x6953('0x1a')]?_0x132a71['options'][_0x6953('0x1c')]||null:null,'attributes':_0x132a71[_0x6953('0x1a')]?_0x132a71['options']['attributes']||null:null,'include':_0x132a71[_0x6953('0x1a')]?_0x132a71[_0x6953('0x1a')][_0x6953('0x1f')]?_['map'](_0x132a71[_0x6953('0x1a')]['include'],function(_0x4e95f1){return{'model':db[_0x4e95f1['model']],'as':_0x4e95f1['as'],'attributes':_0x4e95f1['attributes'],'include':_0x4e95f1[_0x6953('0x1f')]?_[_0x6953('0x20')](_0x4e95f1[_0x6953('0x1f')],function(_0x11f316){return{'model':db[_0x11f316[_0x6953('0x21')]],'as':_0x11f316['as'],'attributes':_0x11f316[_0x6953('0x1d')],'include':_0x11f316['include']?_[_0x6953('0x20')](_0x11f316['include'],function(_0x199c67){return{'model':db[_0x199c67['model']],'as':_0x199c67['as'],'attributes':_0x199c67[_0x6953('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6953('0xc')](function(_0xd81149){logger[_0x6953('0x15')]('ShowZohoAccount',_0x132a71);logger[_0x6953('0xf')](_0x6953('0x22'),_0x132a71,JSON[_0x6953('0x11')](_0xd81149));_0x4d856d(_0xd81149);})[_0x6953('0x16')](function(_0x40b6ea){logger[_0x6953('0x12')](_0x6953('0x22'),_0x40b6ea[_0x6953('0x14')],_0x132a71);_0xd80e42(_0x481c6a[_0x6953('0x12')](0x1f4,_0x40b6ea[_0x6953('0x14')]));});});}; \ No newline at end of file +var _0x341c=['then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','limit','include','map','model','debug','ShowZohoAccount','find','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x2a00c2,_0x13611a){var _0xa5290e=function(_0xd4328c){while(--_0xd4328c){_0x2a00c2['push'](_0x2a00c2['shift']());}};_0xa5290e(++_0x13611a);}(_0x341c,0xcc));var _0xc341=function(_0xd62e7a,_0xac4f19){_0xd62e7a=_0xd62e7a-0x0;var _0x1bf0c8=_0x341c[_0xd62e7a];return _0x1bf0c8;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var moment=require(_0xc341('0x1'));var BPromise=require('bluebird');var rs=require(_0xc341('0x2'));var fs=require('fs');var Redis=require(_0xc341('0x3'));var db=require(_0xc341('0x4'))['db'];var utils=require(_0xc341('0x5'));var logger=require(_0xc341('0x6'))(_0xc341('0x7'));var config=require(_0xc341('0x8'));var jayson=require(_0xc341('0x9'));var client=jayson['client'][_0xc341('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13c5b4,_0x296387,_0x31ce96){return new BPromise(function(_0x3e83c9,_0x53aab7){return client[_0xc341('0xb')](_0x13c5b4,_0x31ce96)[_0xc341('0xc')](function(_0x3f08b0){logger[_0xc341('0xd')](_0xc341('0xe'),_0x296387,_0xc341('0xf'));logger['debug'](_0xc341('0x10'),_0x296387,_0xc341('0xf'),JSON[_0xc341('0x11')](_0x3f08b0));if(_0x3f08b0[_0xc341('0x12')]){if(_0x3f08b0[_0xc341('0x12')][_0xc341('0x13')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x296387,_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);return _0x53aab7(_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);}logger[_0xc341('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x296387,_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);return _0x3e83c9(_0x3f08b0[_0xc341('0x12')][_0xc341('0x14')]);}else{logger[_0xc341('0xd')](_0xc341('0xe'),_0x296387,_0xc341('0xf'));_0x3e83c9(_0x3f08b0[_0xc341('0x15')][_0xc341('0x14')]);}})[_0xc341('0x16')](function(_0x1d499c){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x296387,_0x1d499c);_0x53aab7(_0x1d499c);});});}exports[_0xc341('0x17')]=function(_0x19d0bc){var _0x2d9f4e=this;return new Promise(function(_0x31f1ae,_0x1017fc){return db[_0xc341('0x18')][_0xc341('0x19')]({'raw':_0x19d0bc[_0xc341('0x1a')]?_0x19d0bc[_0xc341('0x1a')][_0xc341('0x1b')]===undefined?!![]:![]:!![],'where':_0x19d0bc[_0xc341('0x1a')]?_0x19d0bc[_0xc341('0x1a')]['where']||null:null,'attributes':_0x19d0bc['options']?_0x19d0bc[_0xc341('0x1a')][_0xc341('0x1c')]||null:null,'limit':_0x19d0bc[_0xc341('0x1a')]?_0x19d0bc[_0xc341('0x1a')][_0xc341('0x1d')]||null:null,'include':_0x19d0bc[_0xc341('0x1a')]?_0x19d0bc['options'][_0xc341('0x1e')]?_[_0xc341('0x1f')](_0x19d0bc[_0xc341('0x1a')]['include'],function(_0x5c749b){return{'model':db[_0x5c749b[_0xc341('0x20')]],'as':_0x5c749b['as'],'attributes':_0x5c749b['attributes'],'include':_0x5c749b[_0xc341('0x1e')]?_[_0xc341('0x1f')](_0x5c749b[_0xc341('0x1e')],function(_0x36b60e){return{'model':db[_0x36b60e[_0xc341('0x20')]],'as':_0x36b60e['as'],'attributes':_0x36b60e['attributes'],'include':_0x36b60e[_0xc341('0x1e')]?_[_0xc341('0x1f')](_0x36b60e[_0xc341('0x1e')],function(_0x349380){return{'model':db[_0x349380[_0xc341('0x20')]],'as':_0x349380['as'],'attributes':_0x349380[_0xc341('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc341('0xc')](function(_0x51af9d){logger[_0xc341('0xd')](_0xc341('0x17'),_0x19d0bc);logger[_0xc341('0x21')](_0xc341('0x17'),_0x19d0bc,JSON[_0xc341('0x11')](_0x51af9d));_0x31f1ae(_0x51af9d);})[_0xc341('0x16')](function(_0x192611){logger[_0xc341('0x12')](_0xc341('0x17'),_0x192611['message'],_0x19d0bc);_0x1017fc(_0x2d9f4e[_0xc341('0x12')](0x1f4,_0x192611[_0xc341('0x14')]));});});};exports[_0xc341('0x22')]=function(_0x32185a){var _0x13c225=this;return new Promise(function(_0x2a3e7c,_0x1a7ab3){return db[_0xc341('0x18')][_0xc341('0x23')]({'raw':_0x32185a[_0xc341('0x1a')]?_0x32185a[_0xc341('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x32185a['options']?_0x32185a[_0xc341('0x1a')]['where']||null:null,'attributes':_0x32185a[_0xc341('0x1a')]?_0x32185a[_0xc341('0x1a')][_0xc341('0x1c')]||null:null,'include':_0x32185a[_0xc341('0x1a')]?_0x32185a[_0xc341('0x1a')][_0xc341('0x1e')]?_[_0xc341('0x1f')](_0x32185a[_0xc341('0x1a')][_0xc341('0x1e')],function(_0x5784dd){return{'model':db[_0x5784dd[_0xc341('0x20')]],'as':_0x5784dd['as'],'attributes':_0x5784dd[_0xc341('0x1c')],'include':_0x5784dd[_0xc341('0x1e')]?_[_0xc341('0x1f')](_0x5784dd[_0xc341('0x1e')],function(_0x59d6eb){return{'model':db[_0x59d6eb['model']],'as':_0x59d6eb['as'],'attributes':_0x59d6eb['attributes'],'include':_0x59d6eb[_0xc341('0x1e')]?_[_0xc341('0x1f')](_0x59d6eb[_0xc341('0x1e')],function(_0x1a6b85){return{'model':db[_0x1a6b85['model']],'as':_0x1a6b85['as'],'attributes':_0x1a6b85['attributes']};}):[]};}):[]};}):[]:[]})[_0xc341('0xc')](function(_0x424b6c){logger[_0xc341('0xd')](_0xc341('0x22'),_0x32185a);logger['debug'](_0xc341('0x22'),_0x32185a,JSON[_0xc341('0x11')](_0x424b6c));_0x2a3e7c(_0x424b6c);})['catch'](function(_0x882e09){logger['error'](_0xc341('0x22'),_0x882e09[_0xc341('0x14')],_0x32185a);_0x1a7ab3(_0x13c225[_0xc341('0x12')](0x1f4,_0x882e09[_0xc341('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 7f1091e..dbf9878 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 _0x5587=['/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x48c45e,_0x11e7cd){var _0x1ac21b=function(_0xd1620){while(--_0xd1620){_0x48c45e['push'](_0x48c45e['shift']());}};_0x1ac21b(++_0x11e7cd);}(_0x5587,0x13e));var _0x7558=function(_0x1bee3a,_0x44f0e5){_0x1bee3a=_0x1bee3a-0x0;var _0x380029=_0x5587[_0x1bee3a];return _0x380029;};'use strict';var multer=require(_0x7558('0x0'));var util=require(_0x7558('0x1'));var path=require('path');var timeout=require(_0x7558('0x2'));var express=require('express');var router=express[_0x7558('0x3')]();var fs_extra=require(_0x7558('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7558('0x5'));var config=require(_0x7558('0x6'));var controller=require(_0x7558('0x7'));router[_0x7558('0x8')]('/',auth[_0x7558('0x9')](),controller[_0x7558('0xa')]);router[_0x7558('0x8')](_0x7558('0xb'),auth[_0x7558('0x9')](),controller['show']);router[_0x7558('0x8')](_0x7558('0xc'),auth[_0x7558('0x9')](),controller[_0x7558('0xd')]);router[_0x7558('0x8')](_0x7558('0xe'),auth[_0x7558('0x9')](),controller['getSubjects']);router[_0x7558('0x8')]('/:id/descriptions',auth[_0x7558('0x9')](),controller[_0x7558('0xf')]);router[_0x7558('0x10')]('/',auth[_0x7558('0x9')](),controller[_0x7558('0x11')]);router[_0x7558('0x12')](_0x7558('0xb'),auth[_0x7558('0x9')](),controller['update']);router[_0x7558('0x13')](_0x7558('0xb'),auth[_0x7558('0x9')](),controller[_0x7558('0x14')]);module[_0x7558('0x15')]=router; \ No newline at end of file +var _0xb9d3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x32ab2f,_0x3eea13){var _0x13caf2=function(_0x4050e4){while(--_0x4050e4){_0x32ab2f['push'](_0x32ab2f['shift']());}};_0x13caf2(++_0x3eea13);}(_0xb9d3,0xd3));var _0x3b9d=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xb9d3[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0x3b9d('0x0'));var util=require('util');var path=require(_0x3b9d('0x1'));var timeout=require(_0x3b9d('0x2'));var express=require(_0x3b9d('0x3'));var router=express[_0x3b9d('0x4')]();var fs_extra=require(_0x3b9d('0x5'));var auth=require(_0x3b9d('0x6'));var interaction=require(_0x3b9d('0x7'));var config=require(_0x3b9d('0x8'));var controller=require(_0x3b9d('0x9'));router[_0x3b9d('0xa')]('/',auth[_0x3b9d('0xb')](),controller['index']);router[_0x3b9d('0xa')](_0x3b9d('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x3b9d('0xa')](_0x3b9d('0xd'),auth[_0x3b9d('0xb')](),controller[_0x3b9d('0xe')]);router[_0x3b9d('0xa')]('/:id/subjects',auth[_0x3b9d('0xb')](),controller[_0x3b9d('0xf')]);router['get'](_0x3b9d('0x10'),auth[_0x3b9d('0xb')](),controller[_0x3b9d('0x11')]);router[_0x3b9d('0x12')]('/',auth[_0x3b9d('0xb')](),controller[_0x3b9d('0x13')]);router[_0x3b9d('0x14')](_0x3b9d('0xc'),auth[_0x3b9d('0xb')](),controller[_0x3b9d('0x15')]);router['delete'](_0x3b9d('0xc'),auth[_0x3b9d('0xb')](),controller[_0x3b9d('0x16')]);module[_0x3b9d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e754399..72e3b50 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 _0xf344=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf344,0x98));var _0x4f34=function(_0x2dda78,_0xa92f2e){_0x2dda78=_0x2dda78-0x0;var _0x1724fa=_0xf344[_0x2dda78];return _0x1724fa;};'use strict';var Sequelize=require(_0x4f34('0x0'));module[_0x4f34('0x1')]={'name':{'type':Sequelize[_0x4f34('0x2')]},'moduleCreate':{'type':Sequelize[_0x4f34('0x3')](_0x4f34('0x4'),_0x4f34('0x5'),_0x4f34('0x6')),'defaultValue':_0x4f34('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4f34('0x7'),_0x4f34('0x5'),_0x4f34('0x4')),'defaultValue':_0x4f34('0x7')},'description':{'type':Sequelize[_0x4f34('0x2')]}}; \ No newline at end of file +var _0x89c9=['sequelize','exports','STRING','ENUM','lead','contact','nothing','contact_lead'];(function(_0x3517e0,_0x1d59aa){var _0x36d8cc=function(_0x8d102a){while(--_0x8d102a){_0x3517e0['push'](_0x3517e0['shift']());}};_0x36d8cc(++_0x1d59aa);}(_0x89c9,0xb0));var _0x989c=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0x89c9[_0x4a45b4];return _0x1a99c9;};'use strict';var Sequelize=require(_0x989c('0x0'));module[_0x989c('0x1')]={'name':{'type':Sequelize[_0x989c('0x2')]},'moduleCreate':{'type':Sequelize[_0x989c('0x3')](_0x989c('0x4'),_0x989c('0x5'),_0x989c('0x6')),'defaultValue':_0x989c('0x4')},'moduleSearch':{'type':Sequelize[_0x989c('0x3')]('contact_lead','contact','lead'),'defaultValue':_0x989c('0x7')},'description':{'type':Sequelize[_0x989c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4f48bd6..68e1c90 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 _0x4242=['getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','params','keys','includeAll','include','find','create','body','update','ZohoField','getFields','getSubjects','findOne'];(function(_0x3d69f9,_0x24daed){var _0x386964=function(_0x2d04fe){while(--_0x2d04fe){_0x3d69f9['push'](_0x3d69f9['shift']());}};_0x386964(++_0x24daed);}(_0x4242,0x151));var _0x2424=function(_0x357979,_0x23481f){_0x357979=_0x357979-0x0;var _0x5c71eb=_0x4242[_0x357979];return _0x5c71eb;};'use strict';var emlformat=require(_0x2424('0x0'));var rimraf=require(_0x2424('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2424('0x2'));var rp=require(_0x2424('0x3'));var moment=require(_0x2424('0x4'));var BPromise=require(_0x2424('0x5'));var Mustache=require(_0x2424('0x6'));var util=require(_0x2424('0x7'));var path=require(_0x2424('0x8'));var sox=require(_0x2424('0x9'));var csv=require(_0x2424('0xa'));var ejs=require(_0x2424('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2424('0xc'));var squel=require(_0x2424('0xd'));var crypto=require(_0x2424('0xe'));var jsforce=require(_0x2424('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2424('0xa'));var querystring=require(_0x2424('0x10'));var Papa=require(_0x2424('0x11'));var Redis=require(_0x2424('0x12'));var authService=require(_0x2424('0x13'));var qs=require(_0x2424('0x14'));var as=require(_0x2424('0x15'));var hardwareService=require(_0x2424('0x16'));var logger=require(_0x2424('0x17'))(_0x2424('0x18'));var utils=require(_0x2424('0x19'));var config=require(_0x2424('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2424('0x1b'))['db'];function respondWithStatusCode(_0x28984a,_0x1273af){_0x1273af=_0x1273af||0xcc;return function(_0x5e26de){if(_0x5e26de){return _0x28984a['sendStatus'](_0x1273af);}return _0x28984a[_0x2424('0x1c')](_0x1273af)[_0x2424('0x1d')]();};}function respondWithResult(_0x5d68a9,_0x486ace){_0x486ace=_0x486ace||0xc8;return function(_0x5a93d2){if(_0x5a93d2){return _0x5d68a9[_0x2424('0x1c')](_0x486ace)[_0x2424('0x1e')](_0x5a93d2);}};}function respondWithFilteredResult(_0x5ba5d5,_0x489131){return function(_0x3451ed){if(_0x3451ed){var _0x58c42a=typeof _0x489131['offset']===_0x2424('0x1f')&&typeof _0x489131[_0x2424('0x20')]==='undefined';var _0x346179=_0x3451ed[_0x2424('0x21')];var _0x3ecf08=_0x58c42a?0x0:_0x489131[_0x2424('0x22')];var _0x2aad68=_0x58c42a?_0x3451ed['count']:_0x489131[_0x2424('0x22')]+_0x489131[_0x2424('0x20')];var _0x1274e4;if(_0x2aad68>=_0x346179){_0x2aad68=_0x346179;_0x1274e4=0xc8;}else{_0x1274e4=0xce;}_0x5ba5d5['status'](_0x1274e4);return _0x5ba5d5[_0x2424('0x23')](_0x2424('0x24'),_0x3ecf08+'-'+_0x2aad68+'/'+_0x346179)[_0x2424('0x1e')](_0x3451ed);}return null;};}function patchUpdates(_0x43bc60){return function(_0x18b521){try{jsonpatch[_0x2424('0x25')](_0x18b521,_0x43bc60,!![]);}catch(_0x58c1b7){return BPromise['reject'](_0x58c1b7);}return _0x18b521[_0x2424('0x26')]();};}function saveUpdates(_0x163cad,_0x5e395e){return function(_0x42cca4){if(_0x42cca4){return _0x42cca4['update'](_0x163cad)[_0x2424('0x27')](function(_0x878da4){return _0x878da4;});}return null;};}function removeEntity(_0x503526,_0x5c3e23){return function(_0x30c316){if(_0x30c316){return _0x30c316[_0x2424('0x28')]()[_0x2424('0x27')](function(){_0x503526['status'](0xcc)[_0x2424('0x1d')]();});}};}function handleEntityNotFound(_0x55bfe8,_0x1c793a){return function(_0x2bd14c){if(!_0x2bd14c){_0x55bfe8[_0x2424('0x29')](0x194);}return _0x2bd14c;};}function handleError(_0x1776ff,_0x53e039){_0x53e039=_0x53e039||0x1f4;return function(_0x3050c0){logger[_0x2424('0x2a')](_0x3050c0[_0x2424('0x2b')]);if(_0x3050c0['name']){delete _0x3050c0['name'];}_0x1776ff['status'](_0x53e039)[_0x2424('0x2c')](_0x3050c0);};}exports['index']=function(_0x300efa,_0x328e3d){var _0x58f506={},_0x49d79e={},_0xd2074b={'count':0x0,'rows':[]};var _0x50d180=_[_0x2424('0x2d')](db[_0x2424('0x2e')][_0x2424('0x2f')],function(_0x3f8aff){return{'name':_0x3f8aff[_0x2424('0x30')],'type':_0x3f8aff[_0x2424('0x31')][_0x2424('0x32')]};});_0x49d79e['model']=_['map'](_0x50d180,_0x2424('0x33'));_0x49d79e['query']=_['keys'](_0x300efa[_0x2424('0x34')]);_0x49d79e[_0x2424('0x35')]=_[_0x2424('0x36')](_0x49d79e[_0x2424('0x37')],_0x49d79e[_0x2424('0x34')]);_0x58f506[_0x2424('0x38')]=_[_0x2424('0x36')](_0x49d79e[_0x2424('0x37')],qs[_0x2424('0x39')](_0x300efa[_0x2424('0x34')][_0x2424('0x39')]));_0x58f506[_0x2424('0x38')]=_0x58f506[_0x2424('0x38')][_0x2424('0x3a')]?_0x58f506[_0x2424('0x38')]:_0x49d79e[_0x2424('0x37')];if(!_0x300efa[_0x2424('0x34')][_0x2424('0x3b')](_0x2424('0x3c'))){_0x58f506['limit']=qs[_0x2424('0x20')](_0x300efa[_0x2424('0x34')][_0x2424('0x20')]);_0x58f506[_0x2424('0x22')]=qs[_0x2424('0x22')](_0x300efa[_0x2424('0x34')][_0x2424('0x22')]);}_0x58f506[_0x2424('0x3d')]=qs[_0x2424('0x3e')](_0x300efa[_0x2424('0x34')]['sort']);_0x58f506['where']=qs['filters'](_[_0x2424('0x3f')](_0x300efa['query'],_0x49d79e[_0x2424('0x35')]),_0x50d180);if(_0x300efa[_0x2424('0x34')][_0x2424('0x40')]){_0x58f506[_0x2424('0x41')]=_[_0x2424('0x42')](_0x58f506['where'],{'$or':_[_0x2424('0x2d')](_0x50d180,function(_0x685d78){if(_0x685d78[_0x2424('0x31')]!==_0x2424('0x43')){var _0x32dc79={};_0x32dc79[_0x685d78['name']]={'$like':'%'+_0x300efa[_0x2424('0x34')][_0x2424('0x40')]+'%'};return _0x32dc79;}})});}_0x58f506=_['merge']({},_0x58f506,_0x300efa[_0x2424('0x44')]);var _0x3dcf8d={'where':_0x58f506[_0x2424('0x41')]};return db['ZohoConfiguration'][_0x2424('0x21')](_0x3dcf8d)[_0x2424('0x27')](function(_0x498ac1){_0xd2074b['count']=_0x498ac1;if(_0x300efa[_0x2424('0x34')]['includeAll']){_0x58f506['include']=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x58f506);})[_0x2424('0x27')](function(_0x507937){_0xd2074b[_0x2424('0x45')]=_0x507937;return _0xd2074b;})[_0x2424('0x27')](respondWithFilteredResult(_0x328e3d,_0x58f506))[_0x2424('0x46')](handleError(_0x328e3d,null));};exports['show']=function(_0x2f715d,_0x3386df){var _0x2948a3={'raw':![],'where':{'id':_0x2f715d[_0x2424('0x47')]['id']}},_0x19761b={};_0x19761b['model']=_[_0x2424('0x48')](db['ZohoConfiguration'][_0x2424('0x2f')]);_0x19761b[_0x2424('0x34')]=_[_0x2424('0x48')](_0x2f715d['query']);_0x19761b[_0x2424('0x35')]=_[_0x2424('0x36')](_0x19761b[_0x2424('0x37')],_0x19761b[_0x2424('0x34')]);_0x2948a3[_0x2424('0x38')]=_['intersection'](_0x19761b[_0x2424('0x37')],qs['fields'](_0x2f715d[_0x2424('0x34')][_0x2424('0x39')]));_0x2948a3[_0x2424('0x38')]=_0x2948a3[_0x2424('0x38')][_0x2424('0x3a')]?_0x2948a3[_0x2424('0x38')]:_0x19761b[_0x2424('0x37')];if(_0x2f715d[_0x2424('0x34')][_0x2424('0x49')]){_0x2948a3[_0x2424('0x4a')]=[{'all':!![]}];}_0x2948a3=_[_0x2424('0x42')]({},_0x2948a3,_0x2f715d['options']);return db[_0x2424('0x2e')][_0x2424('0x4b')](_0x2948a3)['then'](handleEntityNotFound(_0x3386df,null))[_0x2424('0x27')](respondWithResult(_0x3386df,null))['catch'](handleError(_0x3386df,null));};exports[_0x2424('0x4c')]=function(_0x5ec23c,_0x53dd0b){return db[_0x2424('0x2e')]['create'](_0x5ec23c[_0x2424('0x4d')],{})[_0x2424('0x27')](respondWithResult(_0x53dd0b,0xc9))[_0x2424('0x46')](handleError(_0x53dd0b,null));};exports[_0x2424('0x4e')]=function(_0x26e015,_0x6ceb20){if(_0x26e015['body']['id']){delete _0x26e015[_0x2424('0x4d')]['id'];}return db['ZohoConfiguration'][_0x2424('0x4b')]({'where':{'id':_0x26e015[_0x2424('0x47')]['id']}})[_0x2424('0x27')](handleEntityNotFound(_0x6ceb20,null))['then'](saveUpdates(_0x26e015[_0x2424('0x4d')],null))[_0x2424('0x27')](respondWithResult(_0x6ceb20,null))[_0x2424('0x46')](handleError(_0x6ceb20,null));};exports[_0x2424('0x28')]=function(_0x393a65,_0x1e5242){return db[_0x2424('0x2e')][_0x2424('0x4b')]({'where':{'id':_0x393a65[_0x2424('0x47')]['id']}})[_0x2424('0x27')](handleEntityNotFound(_0x1e5242,null))[_0x2424('0x27')](removeEntity(_0x1e5242,null))['catch'](handleError(_0x1e5242,null));};exports['getFields']=function(_0x245378,_0xba003f,_0x39eede){var _0x3df297={};var _0xa846d4={};var _0x4b4d4a;var _0x5ae76b;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x245378[_0x2424('0x47')]['id']}})['then'](handleEntityNotFound(_0xba003f,null))[_0x2424('0x27')](function(_0x2f25eb){if(_0x2f25eb){_0x4b4d4a=_0x2f25eb;_0xa846d4[_0x2424('0x37')]=_[_0x2424('0x48')](db[_0x2424('0x4f')]['rawAttributes']);_0xa846d4[_0x2424('0x34')]=_['keys'](_0x245378[_0x2424('0x34')]);_0xa846d4[_0x2424('0x35')]=_['intersection'](_0xa846d4[_0x2424('0x37')],_0xa846d4[_0x2424('0x34')]);_0x3df297[_0x2424('0x38')]=_[_0x2424('0x36')](_0xa846d4[_0x2424('0x37')],qs[_0x2424('0x39')](_0x245378[_0x2424('0x34')][_0x2424('0x39')]));_0x3df297[_0x2424('0x38')]=_0x3df297[_0x2424('0x38')][_0x2424('0x3a')]?_0x3df297['attributes']:_0xa846d4[_0x2424('0x37')];_0x3df297[_0x2424('0x3d')]=qs[_0x2424('0x3e')](_0x245378['query'][_0x2424('0x3e')]);_0x3df297[_0x2424('0x41')]=qs['filters'](_[_0x2424('0x3f')](_0x245378[_0x2424('0x34')],_0xa846d4[_0x2424('0x35')]));if(_0x245378[_0x2424('0x34')][_0x2424('0x40')]){_0x3df297['where']=_[_0x2424('0x42')](_0x3df297[_0x2424('0x41')],{'$or':_['map'](_0x3df297['attributes'],function(_0x30855e){var _0x22e1c4={};_0x22e1c4[_0x30855e]={'$like':'%'+_0x245378[_0x2424('0x34')][_0x2424('0x40')]+'%'};return _0x22e1c4;})});}_0x3df297=_[_0x2424('0x42')]({},_0x3df297,_0x245378['options']);return _0x4b4d4a[_0x2424('0x50')](_0x3df297);}})[_0x2424('0x27')](function(_0x4d5d20){if(_0x4d5d20){_0x5ae76b=_0x4d5d20['length'];if(!_0x245378[_0x2424('0x34')]['hasOwnProperty'](_0x2424('0x3c'))){_0x3df297[_0x2424('0x20')]=qs[_0x2424('0x20')](_0x245378[_0x2424('0x34')]['limit']);_0x3df297[_0x2424('0x22')]=qs[_0x2424('0x22')](_0x245378['query']['offset']);}return _0x4b4d4a[_0x2424('0x50')](_0x3df297);}})[_0x2424('0x27')](function(_0x166b6a){if(_0x166b6a){return _0x166b6a?{'count':_0x5ae76b,'rows':_0x166b6a}:null;}})[_0x2424('0x27')](respondWithResult(_0xba003f,null))[_0x2424('0x46')](handleError(_0xba003f,null));};exports[_0x2424('0x51')]=function(_0x484f80,_0x1458a2,_0x4ca0c6){var _0x543382={};var _0x4fade6={};var _0x1a9d22;var _0x2e596e;return db[_0x2424('0x2e')][_0x2424('0x52')]({'where':{'id':_0x484f80[_0x2424('0x47')]['id']}})[_0x2424('0x27')](handleEntityNotFound(_0x1458a2,null))[_0x2424('0x27')](function(_0x16cbd5){if(_0x16cbd5){_0x1a9d22=_0x16cbd5;_0x4fade6[_0x2424('0x37')]=_['keys'](db[_0x2424('0x4f')][_0x2424('0x2f')]);_0x4fade6['query']=_['keys'](_0x484f80['query']);_0x4fade6[_0x2424('0x35')]=_[_0x2424('0x36')](_0x4fade6[_0x2424('0x37')],_0x4fade6[_0x2424('0x34')]);_0x543382[_0x2424('0x38')]=_['intersection'](_0x4fade6[_0x2424('0x37')],qs['fields'](_0x484f80['query']['fields']));_0x543382[_0x2424('0x38')]=_0x543382[_0x2424('0x38')][_0x2424('0x3a')]?_0x543382[_0x2424('0x38')]:_0x4fade6[_0x2424('0x37')];_0x543382['order']=qs[_0x2424('0x3e')](_0x484f80[_0x2424('0x34')]['sort']);_0x543382['where']=qs[_0x2424('0x35')](_[_0x2424('0x3f')](_0x484f80[_0x2424('0x34')],_0x4fade6['filters']));if(_0x484f80[_0x2424('0x34')][_0x2424('0x40')]){_0x543382[_0x2424('0x41')]=_['merge'](_0x543382['where'],{'$or':_['map'](_0x543382[_0x2424('0x38')],function(_0x8e28a8){var _0x19a430={};_0x19a430[_0x8e28a8]={'$like':'%'+_0x484f80[_0x2424('0x34')][_0x2424('0x40')]+'%'};return _0x19a430;})});}_0x543382=_['merge']({},_0x543382,_0x484f80['options']);return _0x1a9d22[_0x2424('0x51')](_0x543382);}})['then'](function(_0x5bda9a){if(_0x5bda9a){_0x2e596e=_0x5bda9a[_0x2424('0x3a')];if(!_0x484f80[_0x2424('0x34')][_0x2424('0x3b')](_0x2424('0x3c'))){_0x543382['limit']=qs['limit'](_0x484f80['query']['limit']);_0x543382['offset']=qs[_0x2424('0x22')](_0x484f80['query'][_0x2424('0x22')]);}return _0x1a9d22[_0x2424('0x51')](_0x543382);}})['then'](function(_0x430c85){if(_0x430c85){return _0x430c85?{'count':_0x2e596e,'rows':_0x430c85}:null;}})['then'](respondWithResult(_0x1458a2,null))[_0x2424('0x46')](handleError(_0x1458a2,null));};exports[_0x2424('0x53')]=function(_0x1896d7,_0x4faf8e,_0x1b64fe){var _0x4b483a={};var _0x310590={};var _0x48f0a1;var _0x41dd8c;return db[_0x2424('0x2e')][_0x2424('0x52')]({'where':{'id':_0x1896d7[_0x2424('0x47')]['id']}})[_0x2424('0x27')](handleEntityNotFound(_0x4faf8e,null))[_0x2424('0x27')](function(_0x1f16b4){if(_0x1f16b4){_0x48f0a1=_0x1f16b4;_0x310590[_0x2424('0x37')]=_[_0x2424('0x48')](db[_0x2424('0x4f')][_0x2424('0x2f')]);_0x310590['query']=_[_0x2424('0x48')](_0x1896d7['query']);_0x310590['filters']=_['intersection'](_0x310590[_0x2424('0x37')],_0x310590[_0x2424('0x34')]);_0x4b483a[_0x2424('0x38')]=_[_0x2424('0x36')](_0x310590[_0x2424('0x37')],qs[_0x2424('0x39')](_0x1896d7[_0x2424('0x34')]['fields']));_0x4b483a[_0x2424('0x38')]=_0x4b483a[_0x2424('0x38')][_0x2424('0x3a')]?_0x4b483a[_0x2424('0x38')]:_0x310590[_0x2424('0x37')];_0x4b483a['order']=qs['sort'](_0x1896d7[_0x2424('0x34')][_0x2424('0x3e')]);_0x4b483a[_0x2424('0x41')]=qs[_0x2424('0x35')](_['pick'](_0x1896d7['query'],_0x310590[_0x2424('0x35')]));if(_0x1896d7['query'][_0x2424('0x40')]){_0x4b483a[_0x2424('0x41')]=_['merge'](_0x4b483a['where'],{'$or':_[_0x2424('0x2d')](_0x4b483a['attributes'],function(_0x6d2cf){var _0x5c5a36={};_0x5c5a36[_0x6d2cf]={'$like':'%'+_0x1896d7[_0x2424('0x34')]['filter']+'%'};return _0x5c5a36;})});}_0x4b483a=_[_0x2424('0x42')]({},_0x4b483a,_0x1896d7['options']);return _0x48f0a1['getDescriptions'](_0x4b483a);}})['then'](function(_0x149bea){if(_0x149bea){_0x41dd8c=_0x149bea[_0x2424('0x3a')];if(!_0x1896d7[_0x2424('0x34')][_0x2424('0x3b')](_0x2424('0x3c'))){_0x4b483a[_0x2424('0x20')]=qs['limit'](_0x1896d7['query'][_0x2424('0x20')]);_0x4b483a[_0x2424('0x22')]=qs[_0x2424('0x22')](_0x1896d7[_0x2424('0x34')]['offset']);}return _0x48f0a1[_0x2424('0x53')](_0x4b483a);}})['then'](function(_0xbeef98){if(_0xbeef98){return _0xbeef98?{'count':_0x41dd8c,'rows':_0xbeef98}:null;}})[_0x2424('0x27')](respondWithResult(_0x4faf8e,null))['catch'](handleError(_0x4faf8e,null));}; \ No newline at end of file +var _0xfd7b=['filters','attributes','intersection','fields','query','length','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','findAll','catch','show','params','includeAll','include','find','create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','type','key','model','keys'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0xfd7b,0x72));var _0xbfd7=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xfd7b[_0x424501];return _0xb719af;};'use strict';var emlformat=require(_0xbfd7('0x0'));var rimraf=require(_0xbfd7('0x1'));var zipdir=require(_0xbfd7('0x2'));var jsonpatch=require(_0xbfd7('0x3'));var rp=require(_0xbfd7('0x4'));var moment=require('moment');var BPromise=require(_0xbfd7('0x5'));var Mustache=require(_0xbfd7('0x6'));var util=require('util');var path=require(_0xbfd7('0x7'));var sox=require(_0xbfd7('0x8'));var csv=require(_0xbfd7('0x9'));var ejs=require(_0xbfd7('0xa'));var fs=require('fs');var fs_extra=require(_0xbfd7('0xb'));var _=require(_0xbfd7('0xc'));var squel=require(_0xbfd7('0xd'));var crypto=require(_0xbfd7('0xe'));var jsforce=require(_0xbfd7('0xf'));var deskjs=require(_0xbfd7('0x10'));var toCsv=require(_0xbfd7('0x9'));var querystring=require('querystring');var Papa=require(_0xbfd7('0x11'));var Redis=require(_0xbfd7('0x12'));var authService=require(_0xbfd7('0x13'));var qs=require(_0xbfd7('0x14'));var as=require(_0xbfd7('0x15'));var hardwareService=require(_0xbfd7('0x16'));var logger=require(_0xbfd7('0x17'))(_0xbfd7('0x18'));var utils=require(_0xbfd7('0x19'));var config=require(_0xbfd7('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbfd7('0x1b'))['db'];function respondWithStatusCode(_0xbce78d,_0x49c785){_0x49c785=_0x49c785||0xcc;return function(_0x24a105){if(_0x24a105){return _0xbce78d['sendStatus'](_0x49c785);}return _0xbce78d['status'](_0x49c785)['end']();};}function respondWithResult(_0xdf46b6,_0x336210){_0x336210=_0x336210||0xc8;return function(_0x16bd75){if(_0x16bd75){return _0xdf46b6[_0xbfd7('0x1c')](_0x336210)[_0xbfd7('0x1d')](_0x16bd75);}};}function respondWithFilteredResult(_0x4e8488,_0x3b427a){return function(_0x4fe448){if(_0x4fe448){var _0x16f951=typeof _0x3b427a[_0xbfd7('0x1e')]==='undefined'&&typeof _0x3b427a[_0xbfd7('0x1f')]==='undefined';var _0x355793=_0x4fe448[_0xbfd7('0x20')];var _0x55f04c=_0x16f951?0x0:_0x3b427a[_0xbfd7('0x1e')];var _0x5068f2=_0x16f951?_0x4fe448[_0xbfd7('0x20')]:_0x3b427a['offset']+_0x3b427a[_0xbfd7('0x1f')];var _0x46cf64;if(_0x5068f2>=_0x355793){_0x5068f2=_0x355793;_0x46cf64=0xc8;}else{_0x46cf64=0xce;}_0x4e8488[_0xbfd7('0x1c')](_0x46cf64);return _0x4e8488[_0xbfd7('0x21')](_0xbfd7('0x22'),_0x55f04c+'-'+_0x5068f2+'/'+_0x355793)[_0xbfd7('0x1d')](_0x4fe448);}return null;};}function patchUpdates(_0x3078f5){return function(_0x26d24b){try{jsonpatch[_0xbfd7('0x23')](_0x26d24b,_0x3078f5,!![]);}catch(_0x2e7286){return BPromise['reject'](_0x2e7286);}return _0x26d24b[_0xbfd7('0x24')]();};}function saveUpdates(_0xfb5dc8,_0x242d40){return function(_0x5c6d02){if(_0x5c6d02){return _0x5c6d02[_0xbfd7('0x25')](_0xfb5dc8)[_0xbfd7('0x26')](function(_0x699672){return _0x699672;});}return null;};}function removeEntity(_0x188957,_0x2dcab0){return function(_0x247954){if(_0x247954){return _0x247954[_0xbfd7('0x27')]()[_0xbfd7('0x26')](function(){_0x188957[_0xbfd7('0x1c')](0xcc)[_0xbfd7('0x28')]();});}};}function handleEntityNotFound(_0x25ee36,_0x3f4137){return function(_0x75e7f1){if(!_0x75e7f1){_0x25ee36[_0xbfd7('0x29')](0x194);}return _0x75e7f1;};}function handleError(_0x4349b1,_0x13e5bf){_0x13e5bf=_0x13e5bf||0x1f4;return function(_0x21dd50){logger['error'](_0x21dd50[_0xbfd7('0x2a')]);if(_0x21dd50[_0xbfd7('0x2b')]){delete _0x21dd50[_0xbfd7('0x2b')];}_0x4349b1[_0xbfd7('0x1c')](_0x13e5bf)[_0xbfd7('0x2c')](_0x21dd50);};}exports['index']=function(_0x2d6ba3,_0x41003f){var _0x5607db={},_0x156572={},_0x160f83={'count':0x0,'rows':[]};var _0x397cfe=_['map'](db[_0xbfd7('0x2d')][_0xbfd7('0x2e')],function(_0x5a1891){return{'name':_0x5a1891[_0xbfd7('0x2f')],'type':_0x5a1891[_0xbfd7('0x30')][_0xbfd7('0x31')]};});_0x156572[_0xbfd7('0x32')]=_['map'](_0x397cfe,_0xbfd7('0x2b'));_0x156572['query']=_[_0xbfd7('0x33')](_0x2d6ba3['query']);_0x156572[_0xbfd7('0x34')]=_['intersection'](_0x156572[_0xbfd7('0x32')],_0x156572['query']);_0x5607db[_0xbfd7('0x35')]=_[_0xbfd7('0x36')](_0x156572['model'],qs[_0xbfd7('0x37')](_0x2d6ba3[_0xbfd7('0x38')][_0xbfd7('0x37')]));_0x5607db[_0xbfd7('0x35')]=_0x5607db[_0xbfd7('0x35')][_0xbfd7('0x39')]?_0x5607db[_0xbfd7('0x35')]:_0x156572['model'];if(!_0x2d6ba3[_0xbfd7('0x38')]['hasOwnProperty'](_0xbfd7('0x3a'))){_0x5607db[_0xbfd7('0x1f')]=qs['limit'](_0x2d6ba3[_0xbfd7('0x38')][_0xbfd7('0x1f')]);_0x5607db[_0xbfd7('0x1e')]=qs['offset'](_0x2d6ba3[_0xbfd7('0x38')][_0xbfd7('0x1e')]);}_0x5607db[_0xbfd7('0x3b')]=qs['sort'](_0x2d6ba3[_0xbfd7('0x38')][_0xbfd7('0x3c')]);_0x5607db[_0xbfd7('0x3d')]=qs[_0xbfd7('0x34')](_[_0xbfd7('0x3e')](_0x2d6ba3['query'],_0x156572['filters']),_0x397cfe);if(_0x2d6ba3['query']['filter']){_0x5607db[_0xbfd7('0x3d')]=_['merge'](_0x5607db[_0xbfd7('0x3d')],{'$or':_[_0xbfd7('0x3f')](_0x397cfe,function(_0x497565){if(_0x497565['type']!==_0xbfd7('0x40')){var _0x4fdd10={};_0x4fdd10[_0x497565[_0xbfd7('0x2b')]]={'$like':'%'+_0x2d6ba3[_0xbfd7('0x38')][_0xbfd7('0x41')]+'%'};return _0x4fdd10;}})});}_0x5607db=_[_0xbfd7('0x42')]({},_0x5607db,_0x2d6ba3[_0xbfd7('0x43')]);var _0x1deb7c={'where':_0x5607db[_0xbfd7('0x3d')]};return db[_0xbfd7('0x2d')][_0xbfd7('0x20')](_0x1deb7c)[_0xbfd7('0x26')](function(_0x5de50e){_0x160f83['count']=_0x5de50e;if(_0x2d6ba3['query']['includeAll']){_0x5607db['include']=[{'all':!![]}];}return db[_0xbfd7('0x2d')][_0xbfd7('0x44')](_0x5607db);})['then'](function(_0x2f531a){_0x160f83['rows']=_0x2f531a;return _0x160f83;})['then'](respondWithFilteredResult(_0x41003f,_0x5607db))[_0xbfd7('0x45')](handleError(_0x41003f,null));};exports[_0xbfd7('0x46')]=function(_0x57d44d,_0x345897){var _0xdefb73={'raw':![],'where':{'id':_0x57d44d[_0xbfd7('0x47')]['id']}},_0xa648be={};_0xa648be[_0xbfd7('0x32')]=_[_0xbfd7('0x33')](db[_0xbfd7('0x2d')][_0xbfd7('0x2e')]);_0xa648be[_0xbfd7('0x38')]=_[_0xbfd7('0x33')](_0x57d44d[_0xbfd7('0x38')]);_0xa648be[_0xbfd7('0x34')]=_[_0xbfd7('0x36')](_0xa648be[_0xbfd7('0x32')],_0xa648be[_0xbfd7('0x38')]);_0xdefb73[_0xbfd7('0x35')]=_[_0xbfd7('0x36')](_0xa648be[_0xbfd7('0x32')],qs[_0xbfd7('0x37')](_0x57d44d[_0xbfd7('0x38')][_0xbfd7('0x37')]));_0xdefb73[_0xbfd7('0x35')]=_0xdefb73['attributes'][_0xbfd7('0x39')]?_0xdefb73[_0xbfd7('0x35')]:_0xa648be['model'];if(_0x57d44d['query'][_0xbfd7('0x48')]){_0xdefb73[_0xbfd7('0x49')]=[{'all':!![]}];}_0xdefb73=_[_0xbfd7('0x42')]({},_0xdefb73,_0x57d44d[_0xbfd7('0x43')]);return db[_0xbfd7('0x2d')][_0xbfd7('0x4a')](_0xdefb73)['then'](handleEntityNotFound(_0x345897,null))[_0xbfd7('0x26')](respondWithResult(_0x345897,null))['catch'](handleError(_0x345897,null));};exports[_0xbfd7('0x4b')]=function(_0x503b1f,_0x2b4190){return db[_0xbfd7('0x2d')][_0xbfd7('0x4b')](_0x503b1f[_0xbfd7('0x4c')],{})[_0xbfd7('0x26')](respondWithResult(_0x2b4190,0xc9))[_0xbfd7('0x45')](handleError(_0x2b4190,null));};exports[_0xbfd7('0x25')]=function(_0x2373db,_0x3452ab){if(_0x2373db[_0xbfd7('0x4c')]['id']){delete _0x2373db[_0xbfd7('0x4c')]['id'];}return db[_0xbfd7('0x2d')][_0xbfd7('0x4a')]({'where':{'id':_0x2373db['params']['id']}})['then'](handleEntityNotFound(_0x3452ab,null))[_0xbfd7('0x26')](saveUpdates(_0x2373db[_0xbfd7('0x4c')],null))['then'](respondWithResult(_0x3452ab,null))[_0xbfd7('0x45')](handleError(_0x3452ab,null));};exports[_0xbfd7('0x27')]=function(_0x5a1051,_0x28d433){return db['ZohoConfiguration'][_0xbfd7('0x4a')]({'where':{'id':_0x5a1051['params']['id']}})['then'](handleEntityNotFound(_0x28d433,null))[_0xbfd7('0x26')](removeEntity(_0x28d433,null))[_0xbfd7('0x45')](handleError(_0x28d433,null));};exports[_0xbfd7('0x4d')]=function(_0x16b9c7,_0x216190,_0x51136b){var _0x38fc24={};var _0x1b51c9={};var _0x484e14;var _0xc6a344;return db['ZohoConfiguration'][_0xbfd7('0x4e')]({'where':{'id':_0x16b9c7[_0xbfd7('0x47')]['id']}})['then'](handleEntityNotFound(_0x216190,null))[_0xbfd7('0x26')](function(_0x4499d2){if(_0x4499d2){_0x484e14=_0x4499d2;_0x1b51c9['model']=_[_0xbfd7('0x33')](db[_0xbfd7('0x4f')]['rawAttributes']);_0x1b51c9[_0xbfd7('0x38')]=_['keys'](_0x16b9c7[_0xbfd7('0x38')]);_0x1b51c9[_0xbfd7('0x34')]=_[_0xbfd7('0x36')](_0x1b51c9['model'],_0x1b51c9[_0xbfd7('0x38')]);_0x38fc24[_0xbfd7('0x35')]=_[_0xbfd7('0x36')](_0x1b51c9['model'],qs[_0xbfd7('0x37')](_0x16b9c7[_0xbfd7('0x38')][_0xbfd7('0x37')]));_0x38fc24[_0xbfd7('0x35')]=_0x38fc24[_0xbfd7('0x35')][_0xbfd7('0x39')]?_0x38fc24[_0xbfd7('0x35')]:_0x1b51c9[_0xbfd7('0x32')];_0x38fc24[_0xbfd7('0x3b')]=qs['sort'](_0x16b9c7[_0xbfd7('0x38')][_0xbfd7('0x3c')]);_0x38fc24['where']=qs[_0xbfd7('0x34')](_[_0xbfd7('0x3e')](_0x16b9c7[_0xbfd7('0x38')],_0x1b51c9[_0xbfd7('0x34')]));if(_0x16b9c7[_0xbfd7('0x38')]['filter']){_0x38fc24[_0xbfd7('0x3d')]=_['merge'](_0x38fc24[_0xbfd7('0x3d')],{'$or':_[_0xbfd7('0x3f')](_0x38fc24[_0xbfd7('0x35')],function(_0x5c8d4e){var _0x91fafe={};_0x91fafe[_0x5c8d4e]={'$like':'%'+_0x16b9c7[_0xbfd7('0x38')][_0xbfd7('0x41')]+'%'};return _0x91fafe;})});}_0x38fc24=_[_0xbfd7('0x42')]({},_0x38fc24,_0x16b9c7[_0xbfd7('0x43')]);return _0x484e14['getFields'](_0x38fc24);}})[_0xbfd7('0x26')](function(_0xf8cd33){if(_0xf8cd33){_0xc6a344=_0xf8cd33[_0xbfd7('0x39')];if(!_0x16b9c7[_0xbfd7('0x38')][_0xbfd7('0x50')](_0xbfd7('0x3a'))){_0x38fc24['limit']=qs[_0xbfd7('0x1f')](_0x16b9c7[_0xbfd7('0x38')]['limit']);_0x38fc24[_0xbfd7('0x1e')]=qs[_0xbfd7('0x1e')](_0x16b9c7[_0xbfd7('0x38')][_0xbfd7('0x1e')]);}return _0x484e14[_0xbfd7('0x4d')](_0x38fc24);}})['then'](function(_0x1631a4){if(_0x1631a4){return _0x1631a4?{'count':_0xc6a344,'rows':_0x1631a4}:null;}})['then'](respondWithResult(_0x216190,null))['catch'](handleError(_0x216190,null));};exports['getSubjects']=function(_0x397ede,_0x52caeb,_0x15a78e){var _0x4c14a8={};var _0x4ea40e={};var _0x3305dd;var _0x548f55;return db[_0xbfd7('0x2d')][_0xbfd7('0x4e')]({'where':{'id':_0x397ede['params']['id']}})[_0xbfd7('0x26')](handleEntityNotFound(_0x52caeb,null))['then'](function(_0x462194){if(_0x462194){_0x3305dd=_0x462194;_0x4ea40e[_0xbfd7('0x32')]=_[_0xbfd7('0x33')](db[_0xbfd7('0x4f')][_0xbfd7('0x2e')]);_0x4ea40e[_0xbfd7('0x38')]=_[_0xbfd7('0x33')](_0x397ede[_0xbfd7('0x38')]);_0x4ea40e['filters']=_[_0xbfd7('0x36')](_0x4ea40e['model'],_0x4ea40e[_0xbfd7('0x38')]);_0x4c14a8['attributes']=_[_0xbfd7('0x36')](_0x4ea40e[_0xbfd7('0x32')],qs[_0xbfd7('0x37')](_0x397ede['query'][_0xbfd7('0x37')]));_0x4c14a8[_0xbfd7('0x35')]=_0x4c14a8[_0xbfd7('0x35')][_0xbfd7('0x39')]?_0x4c14a8[_0xbfd7('0x35')]:_0x4ea40e[_0xbfd7('0x32')];_0x4c14a8[_0xbfd7('0x3b')]=qs['sort'](_0x397ede[_0xbfd7('0x38')][_0xbfd7('0x3c')]);_0x4c14a8['where']=qs[_0xbfd7('0x34')](_[_0xbfd7('0x3e')](_0x397ede['query'],_0x4ea40e[_0xbfd7('0x34')]));if(_0x397ede[_0xbfd7('0x38')]['filter']){_0x4c14a8[_0xbfd7('0x3d')]=_[_0xbfd7('0x42')](_0x4c14a8[_0xbfd7('0x3d')],{'$or':_[_0xbfd7('0x3f')](_0x4c14a8[_0xbfd7('0x35')],function(_0x3a7a3e){var _0x660c2={};_0x660c2[_0x3a7a3e]={'$like':'%'+_0x397ede[_0xbfd7('0x38')][_0xbfd7('0x41')]+'%'};return _0x660c2;})});}_0x4c14a8=_[_0xbfd7('0x42')]({},_0x4c14a8,_0x397ede[_0xbfd7('0x43')]);return _0x3305dd[_0xbfd7('0x51')](_0x4c14a8);}})['then'](function(_0x50b8af){if(_0x50b8af){_0x548f55=_0x50b8af[_0xbfd7('0x39')];if(!_0x397ede[_0xbfd7('0x38')][_0xbfd7('0x50')](_0xbfd7('0x3a'))){_0x4c14a8['limit']=qs[_0xbfd7('0x1f')](_0x397ede[_0xbfd7('0x38')][_0xbfd7('0x1f')]);_0x4c14a8['offset']=qs[_0xbfd7('0x1e')](_0x397ede[_0xbfd7('0x38')][_0xbfd7('0x1e')]);}return _0x3305dd[_0xbfd7('0x51')](_0x4c14a8);}})[_0xbfd7('0x26')](function(_0x596b95){if(_0x596b95){return _0x596b95?{'count':_0x548f55,'rows':_0x596b95}:null;}})[_0xbfd7('0x26')](respondWithResult(_0x52caeb,null))[_0xbfd7('0x45')](handleError(_0x52caeb,null));};exports[_0xbfd7('0x52')]=function(_0x5be775,_0x1276f6,_0xb1d320){var _0x403cf8={};var _0x5619a2={};var _0x211b19;var _0x51a2c1;return db[_0xbfd7('0x2d')][_0xbfd7('0x4e')]({'where':{'id':_0x5be775[_0xbfd7('0x47')]['id']}})['then'](handleEntityNotFound(_0x1276f6,null))[_0xbfd7('0x26')](function(_0x5fdcf8){if(_0x5fdcf8){_0x211b19=_0x5fdcf8;_0x5619a2[_0xbfd7('0x32')]=_[_0xbfd7('0x33')](db[_0xbfd7('0x4f')][_0xbfd7('0x2e')]);_0x5619a2[_0xbfd7('0x38')]=_['keys'](_0x5be775[_0xbfd7('0x38')]);_0x5619a2[_0xbfd7('0x34')]=_[_0xbfd7('0x36')](_0x5619a2['model'],_0x5619a2[_0xbfd7('0x38')]);_0x403cf8[_0xbfd7('0x35')]=_[_0xbfd7('0x36')](_0x5619a2['model'],qs[_0xbfd7('0x37')](_0x5be775[_0xbfd7('0x38')][_0xbfd7('0x37')]));_0x403cf8[_0xbfd7('0x35')]=_0x403cf8[_0xbfd7('0x35')][_0xbfd7('0x39')]?_0x403cf8[_0xbfd7('0x35')]:_0x5619a2[_0xbfd7('0x32')];_0x403cf8['order']=qs['sort'](_0x5be775[_0xbfd7('0x38')]['sort']);_0x403cf8[_0xbfd7('0x3d')]=qs[_0xbfd7('0x34')](_[_0xbfd7('0x3e')](_0x5be775[_0xbfd7('0x38')],_0x5619a2[_0xbfd7('0x34')]));if(_0x5be775['query'][_0xbfd7('0x41')]){_0x403cf8[_0xbfd7('0x3d')]=_[_0xbfd7('0x42')](_0x403cf8['where'],{'$or':_[_0xbfd7('0x3f')](_0x403cf8['attributes'],function(_0x503790){var _0x121f94={};_0x121f94[_0x503790]={'$like':'%'+_0x5be775[_0xbfd7('0x38')]['filter']+'%'};return _0x121f94;})});}_0x403cf8=_['merge']({},_0x403cf8,_0x5be775[_0xbfd7('0x43')]);return _0x211b19[_0xbfd7('0x52')](_0x403cf8);}})[_0xbfd7('0x26')](function(_0x5a77b1){if(_0x5a77b1){_0x51a2c1=_0x5a77b1[_0xbfd7('0x39')];if(!_0x5be775[_0xbfd7('0x38')][_0xbfd7('0x50')](_0xbfd7('0x3a'))){_0x403cf8[_0xbfd7('0x1f')]=qs[_0xbfd7('0x1f')](_0x5be775[_0xbfd7('0x38')][_0xbfd7('0x1f')]);_0x403cf8[_0xbfd7('0x1e')]=qs['offset'](_0x5be775[_0xbfd7('0x38')][_0xbfd7('0x1e')]);}return _0x211b19[_0xbfd7('0x52')](_0x403cf8);}})[_0xbfd7('0x26')](function(_0xdab222){if(_0xdab222){return _0xdab222?{'count':_0x51a2c1,'rows':_0xdab222}:null;}})[_0xbfd7('0x26')](respondWithResult(_0x1276f6,null))[_0xbfd7('0x45')](handleError(_0x1276f6,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 5c65d23..d456cb6 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 _0x6ed3=['../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5b926f,_0x40f4da){var _0x33b2ea=function(_0x3a4643){while(--_0x3a4643){_0x5b926f['push'](_0x5b926f['shift']());}};_0x33b2ea(++_0x40f4da);}(_0x6ed3,0x17f));var _0x36ed=function(_0x1c31fa,_0x2925cb){_0x1c31fa=_0x1c31fa-0x0;var _0xdf751=_0x6ed3[_0x1c31fa];return _0xdf751;};'use strict';var _=require(_0x36ed('0x0'));var util=require(_0x36ed('0x1'));var logger=require(_0x36ed('0x2'))(_0x36ed('0x3'));var moment=require(_0x36ed('0x4'));var BPromise=require(_0x36ed('0x5'));var rp=require(_0x36ed('0x6'));var fs=require('fs');var path=require(_0x36ed('0x7'));var rimraf=require(_0x36ed('0x8'));var config=require(_0x36ed('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0x36ed('0xa')]=function(_0x365e0e,_0xf634a6){return _0x365e0e[_0x36ed('0xb')](_0x36ed('0xc'),attributes,{'tableName':_0x36ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee7f=['../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1c5bf5,_0x2be5ee){var _0x1c81b8=function(_0x584a5b){while(--_0x584a5b){_0x1c5bf5['push'](_0x1c5bf5['shift']());}};_0x1c81b8(++_0x2be5ee);}(_0xee7f,0x1b1));var _0xfee7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xee7f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfee7('0x0'));var util=require(_0xfee7('0x1'));var logger=require(_0xfee7('0x2'))(_0xfee7('0x3'));var moment=require(_0xfee7('0x4'));var BPromise=require(_0xfee7('0x5'));var rp=require(_0xfee7('0x6'));var fs=require('fs');var path=require(_0xfee7('0x7'));var rimraf=require(_0xfee7('0x8'));var config=require(_0xfee7('0x9'));var attributes=require(_0xfee7('0xa'));module['exports']=function(_0x57a7ff,_0x112b9e){return _0x57a7ff[_0xfee7('0xb')](_0xfee7('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index b9c177d..ffbda68 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 _0x6006=['http','request','then','request\x20sent','debug','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x59f0b4,_0x64a97c){var _0x43d524=function(_0x577e80){while(--_0x577e80){_0x59f0b4['push'](_0x59f0b4['shift']());}};_0x43d524(++_0x64a97c);}(_0x6006,0x74));var _0x6600=function(_0x42a6e3,_0x1d9a95){_0x42a6e3=_0x42a6e3-0x0;var _0x1b5796=_0x6006[_0x42a6e3];return _0x1b5796;};'use strict';var _=require('lodash');var util=require(_0x6600('0x0'));var moment=require(_0x6600('0x1'));var BPromise=require(_0x6600('0x2'));var rs=require(_0x6600('0x3'));var fs=require('fs');var Redis=require(_0x6600('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6600('0x5'));var logger=require(_0x6600('0x6'))(_0x6600('0x7'));var config=require(_0x6600('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6600('0x9')][_0x6600('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x498ba2,_0x576a29,_0x224b66){return new BPromise(function(_0x1e5be4,_0x4fca39){return client[_0x6600('0xb')](_0x498ba2,_0x224b66)[_0x6600('0xc')](function(_0x33e54e){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x576a29,_0x6600('0xd'));logger[_0x6600('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x576a29,_0x6600('0xd'),JSON['stringify'](_0x33e54e));if(_0x33e54e['error']){if(_0x33e54e[_0x6600('0xf')][_0x6600('0x10')]===0x1f4){logger[_0x6600('0xf')](_0x6600('0x11'),_0x576a29,_0x33e54e['error'][_0x6600('0x12')]);return _0x4fca39(_0x33e54e[_0x6600('0xf')]['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x576a29,_0x33e54e[_0x6600('0xf')]['message']);return _0x1e5be4(_0x33e54e['error'][_0x6600('0x12')]);}else{logger[_0x6600('0x13')](_0x6600('0x11'),_0x576a29,'request\x20sent');_0x1e5be4(_0x33e54e[_0x6600('0x14')][_0x6600('0x12')]);}})['catch'](function(_0x32664a){logger['error'](_0x6600('0x11'),_0x576a29,_0x32664a);_0x4fca39(_0x32664a);});});} \ No newline at end of file +var _0x0599=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5b2d8f,_0x53f9d4){var _0x2f1fdf=function(_0x1fd085){while(--_0x1fd085){_0x5b2d8f['push'](_0x5b2d8f['shift']());}};_0x2f1fdf(++_0x53f9d4);}(_0x0599,0x1c7));var _0x9059=function(_0x21cdff,_0x2fb117){_0x21cdff=_0x21cdff-0x0;var _0x4385bf=_0x0599[_0x21cdff];return _0x4385bf;};'use strict';var _=require('lodash');var util=require(_0x9059('0x0'));var moment=require(_0x9059('0x1'));var BPromise=require(_0x9059('0x2'));var rs=require(_0x9059('0x3'));var fs=require('fs');var Redis=require(_0x9059('0x4'));var db=require(_0x9059('0x5'))['db'];var utils=require(_0x9059('0x6'));var logger=require('../../config/logger')(_0x9059('0x7'));var config=require('../../config/environment');var jayson=require(_0x9059('0x8'));var client=jayson[_0x9059('0x9')][_0x9059('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ed75c,_0x1ebebe,_0x4921b4){return new BPromise(function(_0x20e139,_0x598f1e){return client[_0x9059('0xb')](_0x5ed75c,_0x4921b4)['then'](function(_0x5a72f7){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1ebebe,'request\x20sent');logger[_0x9059('0xc')](_0x9059('0xd'),_0x1ebebe,'request\x20sent',JSON[_0x9059('0xe')](_0x5a72f7));if(_0x5a72f7['error']){if(_0x5a72f7[_0x9059('0xf')][_0x9059('0x10')]===0x1f4){logger['error'](_0x9059('0x11'),_0x1ebebe,_0x5a72f7[_0x9059('0xf')][_0x9059('0x12')]);return _0x598f1e(_0x5a72f7['error'][_0x9059('0x12')]);}logger[_0x9059('0xf')](_0x9059('0x11'),_0x1ebebe,_0x5a72f7[_0x9059('0xf')][_0x9059('0x12')]);return _0x20e139(_0x5a72f7[_0x9059('0xf')][_0x9059('0x12')]);}else{logger[_0x9059('0x13')](_0x9059('0x11'),_0x1ebebe,_0x9059('0x14'));_0x20e139(_0x5a72f7[_0x9059('0x15')][_0x9059('0x12')]);}})[_0x9059('0x16')](function(_0x39811d){logger['error'](_0x9059('0x11'),_0x1ebebe,_0x39811d);_0x598f1e(_0x39811d);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 98debf1..4bdf123 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 _0x2f0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','express','Router','fs-extra'];(function(_0xb2cb6e,_0x43372f){var _0x4c7b96=function(_0x148df4){while(--_0x148df4){_0xb2cb6e['push'](_0xb2cb6e['shift']());}};_0x4c7b96(++_0x43372f);}(_0x2f0c,0x187));var _0xc2f0=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x2f0c[_0x49ad79];return _0xa4e38a;};'use strict';var multer=require(_0xc2f0('0x0'));var util=require(_0xc2f0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc2f0('0x2'));var router=express[_0xc2f0('0x3')]();var fs_extra=require(_0xc2f0('0x4'));var auth=require(_0xc2f0('0x5'));var interaction=require(_0xc2f0('0x6'));var config=require(_0xc2f0('0x7'));var controller=require('./intZohoField.controller');router[_0xc2f0('0x8')]('/',auth[_0xc2f0('0x9')](),controller[_0xc2f0('0xa')]);router['get'](_0xc2f0('0xb'),auth[_0xc2f0('0x9')](),controller[_0xc2f0('0xc')]);router[_0xc2f0('0xd')]('/',auth[_0xc2f0('0x9')](),controller[_0xc2f0('0xe')]);router[_0xc2f0('0xf')](_0xc2f0('0xb'),auth[_0xc2f0('0x9')](),controller[_0xc2f0('0x10')]);router['delete'](_0xc2f0('0xb'),auth[_0xc2f0('0x9')](),controller[_0xc2f0('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9cd9=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','create','put','update','delete','exports','multer','path','connect-timeout'];(function(_0x38a3d6,_0x52e305){var _0x3768d7=function(_0x1af8a9){while(--_0x1af8a9){_0x38a3d6['push'](_0x38a3d6['shift']());}};_0x3768d7(++_0x52e305);}(_0x9cd9,0x10b));var _0x99cd=function(_0x2028e6,_0x25c8db){_0x2028e6=_0x2028e6-0x0;var _0x9a9441=_0x9cd9[_0x2028e6];return _0x9a9441;};'use strict';var multer=require(_0x99cd('0x0'));var util=require('util');var path=require(_0x99cd('0x1'));var timeout=require(_0x99cd('0x2'));var express=require(_0x99cd('0x3'));var router=express[_0x99cd('0x4')]();var fs_extra=require(_0x99cd('0x5'));var auth=require(_0x99cd('0x6'));var interaction=require(_0x99cd('0x7'));var config=require(_0x99cd('0x8'));var controller=require(_0x99cd('0x9'));router[_0x99cd('0xa')]('/',auth[_0x99cd('0xb')](),controller['index']);router[_0x99cd('0xa')](_0x99cd('0xc'),auth[_0x99cd('0xb')](),controller['show']);router['post']('/',auth[_0x99cd('0xb')](),controller[_0x99cd('0xd')]);router[_0x99cd('0xe')]('/:id',auth[_0x99cd('0xb')](),controller[_0x99cd('0xf')]);router[_0x99cd('0x10')](_0x99cd('0xc'),auth[_0x99cd('0xb')](),controller['destroy']);module[_0x99cd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index bf36b7e..9763ae4 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 _0xac96=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xac96,0x10f));var _0x6ac9=function(_0x27463e,_0x157d81){_0x27463e=_0x27463e-0x0;var _0x16952a=_0xac96[_0x27463e];return _0x16952a;};'use strict';var Sequelize=require(_0x6ac9('0x0'));module[_0x6ac9('0x1')]={'type':{'type':Sequelize[_0x6ac9('0x2')](_0x6ac9('0x3'),'variable',_0x6ac9('0x4'),_0x6ac9('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6ac9('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6ac9('0x2')](_0x6ac9('0x3'),_0x6ac9('0x7'),_0x6ac9('0x4'))},'keyContent':{'type':Sequelize[_0x6ac9('0x6')]},'idField':{'type':Sequelize[_0x6ac9('0x6')]},'nameField':{'type':Sequelize[_0x6ac9('0x6')]},'customField':{'type':Sequelize[_0x6ac9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ac9('0x6')]}}; \ No newline at end of file +var _0xb92a=['picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0xa3b328,_0x4650e8){var _0x278f18=function(_0x36d52d){while(--_0x36d52d){_0xa3b328['push'](_0xa3b328['shift']());}};_0x278f18(++_0x4650e8);}(_0xb92a,0x194));var _0xab92=function(_0x3fd827,_0x2a2206){_0x3fd827=_0x3fd827-0x0;var _0x197eaf=_0xb92a[_0x3fd827];return _0x197eaf;};'use strict';var Sequelize=require(_0xab92('0x0'));module[_0xab92('0x1')]={'type':{'type':Sequelize[_0xab92('0x2')](_0xab92('0x3'),_0xab92('0x4'),'customVariable',_0xab92('0x5'),_0xab92('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab92('0x7')]},'key':{'type':Sequelize[_0xab92('0x7')]},'keyType':{'type':Sequelize[_0xab92('0x2')](_0xab92('0x3'),_0xab92('0x4'),_0xab92('0x8'))},'keyContent':{'type':Sequelize[_0xab92('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xab92('0x7')]},'customField':{'type':Sequelize[_0xab92('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index c480749..5f3add6 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 _0x62dd=['json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','order','where','filters','merge','VIRTUAL','filter','options','ZohoField','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end'];(function(_0x40a1e5,_0x20ff20){var _0x11cf81=function(_0x395b5b){while(--_0x395b5b){_0x40a1e5['push'](_0x40a1e5['shift']());}};_0x11cf81(++_0x20ff20);}(_0x62dd,0x10d));var _0xd62d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62dd[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd62d('0x0'));var rimraf=require(_0xd62d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd62d('0x2'));var rp=require(_0xd62d('0x3'));var moment=require('moment');var BPromise=require(_0xd62d('0x4'));var Mustache=require(_0xd62d('0x5'));var util=require('util');var path=require(_0xd62d('0x6'));var sox=require(_0xd62d('0x7'));var csv=require(_0xd62d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd62d('0x9'));var _=require(_0xd62d('0xa'));var squel=require(_0xd62d('0xb'));var crypto=require(_0xd62d('0xc'));var jsforce=require(_0xd62d('0xd'));var deskjs=require(_0xd62d('0xe'));var toCsv=require(_0xd62d('0x8'));var querystring=require(_0xd62d('0xf'));var Papa=require('papaparse');var Redis=require(_0xd62d('0x10'));var authService=require(_0xd62d('0x11'));var qs=require(_0xd62d('0x12'));var as=require(_0xd62d('0x13'));var hardwareService=require(_0xd62d('0x14'));var logger=require('../../config/logger')(_0xd62d('0x15'));var utils=require(_0xd62d('0x16'));var config=require(_0xd62d('0x17'));var licenseUtil=require(_0xd62d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a08a7,_0x3ee591){_0x3ee591=_0x3ee591||0xcc;return function(_0x53f2b5){if(_0x53f2b5){return _0x1a08a7['sendStatus'](_0x3ee591);}return _0x1a08a7[_0xd62d('0x19')](_0x3ee591)[_0xd62d('0x1a')]();};}function respondWithResult(_0x20f581,_0xa0ad30){_0xa0ad30=_0xa0ad30||0xc8;return function(_0x55acf9){if(_0x55acf9){return _0x20f581['status'](_0xa0ad30)[_0xd62d('0x1b')](_0x55acf9);}};}function respondWithFilteredResult(_0xce3d6d,_0x191ea2){return function(_0x1e8a91){if(_0x1e8a91){var _0x2310f8=typeof _0x191ea2[_0xd62d('0x1c')]===_0xd62d('0x1d')&&typeof _0x191ea2[_0xd62d('0x1e')]===_0xd62d('0x1d');var _0x508303=_0x1e8a91[_0xd62d('0x1f')];var _0x17b67e=_0x2310f8?0x0:_0x191ea2['offset'];var _0x39cddc=_0x2310f8?_0x1e8a91[_0xd62d('0x1f')]:_0x191ea2[_0xd62d('0x1c')]+_0x191ea2[_0xd62d('0x1e')];var _0x39bace;if(_0x39cddc>=_0x508303){_0x39cddc=_0x508303;_0x39bace=0xc8;}else{_0x39bace=0xce;}_0xce3d6d[_0xd62d('0x19')](_0x39bace);return _0xce3d6d['set']('Content-Range',_0x17b67e+'-'+_0x39cddc+'/'+_0x508303)[_0xd62d('0x1b')](_0x1e8a91);}return null;};}function patchUpdates(_0x1c3241){return function(_0x1784d9){try{jsonpatch[_0xd62d('0x20')](_0x1784d9,_0x1c3241,!![]);}catch(_0x50c279){return BPromise[_0xd62d('0x21')](_0x50c279);}return _0x1784d9[_0xd62d('0x22')]();};}function saveUpdates(_0x307615,_0x22e453){return function(_0x3106f8){if(_0x3106f8){return _0x3106f8[_0xd62d('0x23')](_0x307615)[_0xd62d('0x24')](function(_0x18c75e){return _0x18c75e;});}return null;};}function removeEntity(_0x2e991a,_0xe8940f){return function(_0x1cca8c){if(_0x1cca8c){return _0x1cca8c[_0xd62d('0x25')]()[_0xd62d('0x24')](function(){_0x2e991a['status'](0xcc)[_0xd62d('0x1a')]();});}};}function handleEntityNotFound(_0x1ca5d6,_0x164fe6){return function(_0x48ba12){if(!_0x48ba12){_0x1ca5d6[_0xd62d('0x26')](0x194);}return _0x48ba12;};}function handleError(_0x45522e,_0x29256c){_0x29256c=_0x29256c||0x1f4;return function(_0x80dffc){logger[_0xd62d('0x27')](_0x80dffc[_0xd62d('0x28')]);if(_0x80dffc[_0xd62d('0x29')]){delete _0x80dffc[_0xd62d('0x29')];}_0x45522e['status'](_0x29256c)[_0xd62d('0x2a')](_0x80dffc);};}exports[_0xd62d('0x2b')]=function(_0x1addbf,_0x11d4f3){var _0x1d00e4={},_0x12a3bf={},_0x196581={'count':0x0,'rows':[]};var _0x57a309=_['map'](db['ZohoField']['rawAttributes'],function(_0x13148a){return{'name':_0x13148a[_0xd62d('0x2c')],'type':_0x13148a[_0xd62d('0x2d')][_0xd62d('0x2e')]};});_0x12a3bf['model']=_[_0xd62d('0x2f')](_0x57a309,'name');_0x12a3bf['query']=_['keys'](_0x1addbf[_0xd62d('0x30')]);_0x12a3bf['filters']=_[_0xd62d('0x31')](_0x12a3bf[_0xd62d('0x32')],_0x12a3bf[_0xd62d('0x30')]);_0x1d00e4[_0xd62d('0x33')]=_[_0xd62d('0x31')](_0x12a3bf[_0xd62d('0x32')],qs[_0xd62d('0x34')](_0x1addbf[_0xd62d('0x30')][_0xd62d('0x34')]));_0x1d00e4[_0xd62d('0x33')]=_0x1d00e4['attributes']['length']?_0x1d00e4[_0xd62d('0x33')]:_0x12a3bf[_0xd62d('0x32')];if(!_0x1addbf[_0xd62d('0x30')][_0xd62d('0x35')]('nolimit')){_0x1d00e4[_0xd62d('0x1e')]=qs[_0xd62d('0x1e')](_0x1addbf[_0xd62d('0x30')][_0xd62d('0x1e')]);_0x1d00e4[_0xd62d('0x1c')]=qs[_0xd62d('0x1c')](_0x1addbf[_0xd62d('0x30')]['offset']);}_0x1d00e4[_0xd62d('0x36')]=qs['sort'](_0x1addbf[_0xd62d('0x30')]['sort']);_0x1d00e4[_0xd62d('0x37')]=qs[_0xd62d('0x38')](_['pick'](_0x1addbf[_0xd62d('0x30')],_0x12a3bf['filters']),_0x57a309);if(_0x1addbf['query']['filter']){_0x1d00e4[_0xd62d('0x37')]=_[_0xd62d('0x39')](_0x1d00e4[_0xd62d('0x37')],{'$or':_['map'](_0x57a309,function(_0x25a7ee){if(_0x25a7ee[_0xd62d('0x2d')]!==_0xd62d('0x3a')){var _0x24ec02={};_0x24ec02[_0x25a7ee['name']]={'$like':'%'+_0x1addbf[_0xd62d('0x30')][_0xd62d('0x3b')]+'%'};return _0x24ec02;}})});}_0x1d00e4=_[_0xd62d('0x39')]({},_0x1d00e4,_0x1addbf[_0xd62d('0x3c')]);var _0x38dfb6={'where':_0x1d00e4['where']};return db[_0xd62d('0x3d')][_0xd62d('0x1f')](_0x38dfb6)[_0xd62d('0x24')](function(_0x206d3f){_0x196581[_0xd62d('0x1f')]=_0x206d3f;if(_0x1addbf[_0xd62d('0x30')][_0xd62d('0x3e')]){_0x1d00e4[_0xd62d('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0xd62d('0x40')](_0x1d00e4);})[_0xd62d('0x24')](function(_0x4af98b){_0x196581[_0xd62d('0x41')]=_0x4af98b;return _0x196581;})['then'](respondWithFilteredResult(_0x11d4f3,_0x1d00e4))[_0xd62d('0x42')](handleError(_0x11d4f3,null));};exports[_0xd62d('0x43')]=function(_0x3d3d49,_0x65df66){var _0x4e94db={'raw':!![],'where':{'id':_0x3d3d49[_0xd62d('0x44')]['id']}},_0x5ae296={};_0x5ae296[_0xd62d('0x32')]=_[_0xd62d('0x45')](db['ZohoField'][_0xd62d('0x46')]);_0x5ae296[_0xd62d('0x30')]=_[_0xd62d('0x45')](_0x3d3d49[_0xd62d('0x30')]);_0x5ae296[_0xd62d('0x38')]=_[_0xd62d('0x31')](_0x5ae296['model'],_0x5ae296[_0xd62d('0x30')]);_0x4e94db[_0xd62d('0x33')]=_['intersection'](_0x5ae296[_0xd62d('0x32')],qs[_0xd62d('0x34')](_0x3d3d49['query'][_0xd62d('0x34')]));_0x4e94db[_0xd62d('0x33')]=_0x4e94db['attributes']['length']?_0x4e94db[_0xd62d('0x33')]:_0x5ae296[_0xd62d('0x32')];if(_0x3d3d49[_0xd62d('0x30')]['includeAll']){_0x4e94db[_0xd62d('0x3f')]=[{'all':!![]}];}_0x4e94db=_[_0xd62d('0x39')]({},_0x4e94db,_0x3d3d49[_0xd62d('0x3c')]);return db[_0xd62d('0x3d')][_0xd62d('0x47')](_0x4e94db)['then'](handleEntityNotFound(_0x65df66,null))[_0xd62d('0x24')](respondWithResult(_0x65df66,null))[_0xd62d('0x42')](handleError(_0x65df66,null));};exports[_0xd62d('0x48')]=function(_0x37fd1e,_0x5ca29a){return db[_0xd62d('0x3d')][_0xd62d('0x48')](_0x37fd1e[_0xd62d('0x49')],{})[_0xd62d('0x24')](respondWithResult(_0x5ca29a,0xc9))['catch'](handleError(_0x5ca29a,null));};exports[_0xd62d('0x23')]=function(_0x66d18c,_0x30702c){if(_0x66d18c['body']['id']){delete _0x66d18c[_0xd62d('0x49')]['id'];}return db[_0xd62d('0x3d')][_0xd62d('0x47')]({'where':{'id':_0x66d18c[_0xd62d('0x44')]['id']}})['then'](handleEntityNotFound(_0x30702c,null))[_0xd62d('0x24')](saveUpdates(_0x66d18c[_0xd62d('0x49')],null))[_0xd62d('0x24')](respondWithResult(_0x30702c,null))[_0xd62d('0x42')](handleError(_0x30702c,null));};exports[_0xd62d('0x25')]=function(_0x1362d1,_0x1386d7){return db[_0xd62d('0x3d')][_0xd62d('0x47')]({'where':{'id':_0x1362d1['params']['id']}})[_0xd62d('0x24')](handleEntityNotFound(_0x1386d7,null))[_0xd62d('0x24')](removeEntity(_0x1386d7,null))['catch'](handleError(_0x1386d7,null));}; \ No newline at end of file +var _0x0d7a=['index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','show','params','length','create','body','catch','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x280587,_0x4e9971){var _0x3b7543=function(_0x1e94de){while(--_0x1e94de){_0x280587['push'](_0x280587['shift']());}};_0x3b7543(++_0x4e9971);}(_0x0d7a,0x1e4));var _0xa0d7=function(_0x49ee37,_0x36dd00){_0x49ee37=_0x49ee37-0x0;var _0x228552=_0x0d7a[_0x49ee37];return _0x228552;};'use strict';var emlformat=require(_0xa0d7('0x0'));var rimraf=require(_0xa0d7('0x1'));var zipdir=require(_0xa0d7('0x2'));var jsonpatch=require(_0xa0d7('0x3'));var rp=require(_0xa0d7('0x4'));var moment=require(_0xa0d7('0x5'));var BPromise=require(_0xa0d7('0x6'));var Mustache=require(_0xa0d7('0x7'));var util=require(_0xa0d7('0x8'));var path=require('path');var sox=require(_0xa0d7('0x9'));var csv=require('to-csv');var ejs=require(_0xa0d7('0xa'));var fs=require('fs');var fs_extra=require(_0xa0d7('0xb'));var _=require('lodash');var squel=require(_0xa0d7('0xc'));var crypto=require('crypto');var jsforce=require(_0xa0d7('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa0d7('0xe'));var Papa=require(_0xa0d7('0xf'));var Redis=require(_0xa0d7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0d7('0x11'));var hardwareService=require(_0xa0d7('0x12'));var logger=require(_0xa0d7('0x13'))(_0xa0d7('0x14'));var utils=require('../../config/utils');var config=require(_0xa0d7('0x15'));var licenseUtil=require(_0xa0d7('0x16'));var db=require(_0xa0d7('0x17'))['db'];function respondWithStatusCode(_0x3b086f,_0x246c72){_0x246c72=_0x246c72||0xcc;return function(_0x4b6f67){if(_0x4b6f67){return _0x3b086f[_0xa0d7('0x18')](_0x246c72);}return _0x3b086f[_0xa0d7('0x19')](_0x246c72)[_0xa0d7('0x1a')]();};}function respondWithResult(_0x2d3146,_0x50d53d){_0x50d53d=_0x50d53d||0xc8;return function(_0x4f75e4){if(_0x4f75e4){return _0x2d3146[_0xa0d7('0x19')](_0x50d53d)[_0xa0d7('0x1b')](_0x4f75e4);}};}function respondWithFilteredResult(_0xa27275,_0xec3bbd){return function(_0x14089b){if(_0x14089b){var _0x25ac1d=typeof _0xec3bbd['offset']===_0xa0d7('0x1c')&&typeof _0xec3bbd[_0xa0d7('0x1d')]===_0xa0d7('0x1c');var _0x25ad5a=_0x14089b[_0xa0d7('0x1e')];var _0x55f487=_0x25ac1d?0x0:_0xec3bbd[_0xa0d7('0x1f')];var _0x2d10b9=_0x25ac1d?_0x14089b['count']:_0xec3bbd[_0xa0d7('0x1f')]+_0xec3bbd[_0xa0d7('0x1d')];var _0x88113d;if(_0x2d10b9>=_0x25ad5a){_0x2d10b9=_0x25ad5a;_0x88113d=0xc8;}else{_0x88113d=0xce;}_0xa27275[_0xa0d7('0x19')](_0x88113d);return _0xa27275['set'](_0xa0d7('0x20'),_0x55f487+'-'+_0x2d10b9+'/'+_0x25ad5a)[_0xa0d7('0x1b')](_0x14089b);}return null;};}function patchUpdates(_0x1980e8){return function(_0x3c60f5){try{jsonpatch[_0xa0d7('0x21')](_0x3c60f5,_0x1980e8,!![]);}catch(_0x520da6){return BPromise[_0xa0d7('0x22')](_0x520da6);}return _0x3c60f5[_0xa0d7('0x23')]();};}function saveUpdates(_0x262de5,_0x1f280d){return function(_0x174756){if(_0x174756){return _0x174756[_0xa0d7('0x24')](_0x262de5)[_0xa0d7('0x25')](function(_0x3fb274){return _0x3fb274;});}return null;};}function removeEntity(_0xef05cc,_0x169260){return function(_0x255ec7){if(_0x255ec7){return _0x255ec7['destroy']()[_0xa0d7('0x25')](function(){_0xef05cc['status'](0xcc)[_0xa0d7('0x1a')]();});}};}function handleEntityNotFound(_0x38e59d,_0x166217){return function(_0x5ac2dd){if(!_0x5ac2dd){_0x38e59d[_0xa0d7('0x18')](0x194);}return _0x5ac2dd;};}function handleError(_0x3eb645,_0x21587c){_0x21587c=_0x21587c||0x1f4;return function(_0x54eb86){logger[_0xa0d7('0x26')](_0x54eb86['stack']);if(_0x54eb86['name']){delete _0x54eb86[_0xa0d7('0x27')];}_0x3eb645[_0xa0d7('0x19')](_0x21587c)[_0xa0d7('0x28')](_0x54eb86);};}exports[_0xa0d7('0x29')]=function(_0x7819d0,_0x4d16ea){var _0x58d6af={},_0x3188db={},_0x91f3b={'count':0x0,'rows':[]};var _0x4c734f=_['map'](db['ZohoField'][_0xa0d7('0x2a')],function(_0x5185f3){return{'name':_0x5185f3[_0xa0d7('0x2b')],'type':_0x5185f3[_0xa0d7('0x2c')][_0xa0d7('0x2d')]};});_0x3188db[_0xa0d7('0x2e')]=_[_0xa0d7('0x2f')](_0x4c734f,_0xa0d7('0x27'));_0x3188db['query']=_[_0xa0d7('0x30')](_0x7819d0[_0xa0d7('0x31')]);_0x3188db[_0xa0d7('0x32')]=_['intersection'](_0x3188db[_0xa0d7('0x2e')],_0x3188db[_0xa0d7('0x31')]);_0x58d6af[_0xa0d7('0x33')]=_[_0xa0d7('0x34')](_0x3188db[_0xa0d7('0x2e')],qs[_0xa0d7('0x35')](_0x7819d0[_0xa0d7('0x31')][_0xa0d7('0x35')]));_0x58d6af[_0xa0d7('0x33')]=_0x58d6af['attributes']['length']?_0x58d6af[_0xa0d7('0x33')]:_0x3188db[_0xa0d7('0x2e')];if(!_0x7819d0[_0xa0d7('0x31')]['hasOwnProperty'](_0xa0d7('0x36'))){_0x58d6af['limit']=qs['limit'](_0x7819d0['query'][_0xa0d7('0x1d')]);_0x58d6af[_0xa0d7('0x1f')]=qs[_0xa0d7('0x1f')](_0x7819d0[_0xa0d7('0x31')][_0xa0d7('0x1f')]);}_0x58d6af[_0xa0d7('0x37')]=qs['sort'](_0x7819d0[_0xa0d7('0x31')][_0xa0d7('0x38')]);_0x58d6af[_0xa0d7('0x39')]=qs[_0xa0d7('0x32')](_['pick'](_0x7819d0[_0xa0d7('0x31')],_0x3188db[_0xa0d7('0x32')]),_0x4c734f);if(_0x7819d0[_0xa0d7('0x31')][_0xa0d7('0x3a')]){_0x58d6af[_0xa0d7('0x39')]=_[_0xa0d7('0x3b')](_0x58d6af['where'],{'$or':_[_0xa0d7('0x2f')](_0x4c734f,function(_0x1a5c41){if(_0x1a5c41['type']!==_0xa0d7('0x3c')){var _0x1b95fc={};_0x1b95fc[_0x1a5c41[_0xa0d7('0x27')]]={'$like':'%'+_0x7819d0['query'][_0xa0d7('0x3a')]+'%'};return _0x1b95fc;}})});}_0x58d6af=_['merge']({},_0x58d6af,_0x7819d0[_0xa0d7('0x3d')]);var _0x4f2a22={'where':_0x58d6af['where']};return db[_0xa0d7('0x3e')]['count'](_0x4f2a22)[_0xa0d7('0x25')](function(_0x27c758){_0x91f3b[_0xa0d7('0x1e')]=_0x27c758;if(_0x7819d0[_0xa0d7('0x31')][_0xa0d7('0x3f')]){_0x58d6af[_0xa0d7('0x40')]=[{'all':!![]}];}return db[_0xa0d7('0x3e')][_0xa0d7('0x41')](_0x58d6af);})[_0xa0d7('0x25')](function(_0x48cea2){_0x91f3b[_0xa0d7('0x42')]=_0x48cea2;return _0x91f3b;})[_0xa0d7('0x25')](respondWithFilteredResult(_0x4d16ea,_0x58d6af))['catch'](handleError(_0x4d16ea,null));};exports[_0xa0d7('0x43')]=function(_0x2c2c7a,_0x3eef8a){var _0x5f2b3b={'raw':!![],'where':{'id':_0x2c2c7a[_0xa0d7('0x44')]['id']}},_0x13e9d5={};_0x13e9d5[_0xa0d7('0x2e')]=_['keys'](db[_0xa0d7('0x3e')][_0xa0d7('0x2a')]);_0x13e9d5['query']=_[_0xa0d7('0x30')](_0x2c2c7a[_0xa0d7('0x31')]);_0x13e9d5[_0xa0d7('0x32')]=_[_0xa0d7('0x34')](_0x13e9d5['model'],_0x13e9d5[_0xa0d7('0x31')]);_0x5f2b3b[_0xa0d7('0x33')]=_['intersection'](_0x13e9d5[_0xa0d7('0x2e')],qs[_0xa0d7('0x35')](_0x2c2c7a['query'][_0xa0d7('0x35')]));_0x5f2b3b[_0xa0d7('0x33')]=_0x5f2b3b[_0xa0d7('0x33')][_0xa0d7('0x45')]?_0x5f2b3b[_0xa0d7('0x33')]:_0x13e9d5[_0xa0d7('0x2e')];if(_0x2c2c7a[_0xa0d7('0x31')]['includeAll']){_0x5f2b3b[_0xa0d7('0x40')]=[{'all':!![]}];}_0x5f2b3b=_[_0xa0d7('0x3b')]({},_0x5f2b3b,_0x2c2c7a[_0xa0d7('0x3d')]);return db['ZohoField']['find'](_0x5f2b3b)[_0xa0d7('0x25')](handleEntityNotFound(_0x3eef8a,null))['then'](respondWithResult(_0x3eef8a,null))['catch'](handleError(_0x3eef8a,null));};exports[_0xa0d7('0x46')]=function(_0x2b9875,_0x58fecc){return db[_0xa0d7('0x3e')][_0xa0d7('0x46')](_0x2b9875[_0xa0d7('0x47')],{})[_0xa0d7('0x25')](respondWithResult(_0x58fecc,0xc9))[_0xa0d7('0x48')](handleError(_0x58fecc,null));};exports[_0xa0d7('0x24')]=function(_0x26c63c,_0x31f125){if(_0x26c63c[_0xa0d7('0x47')]['id']){delete _0x26c63c[_0xa0d7('0x47')]['id'];}return db[_0xa0d7('0x3e')]['find']({'where':{'id':_0x26c63c['params']['id']}})[_0xa0d7('0x25')](handleEntityNotFound(_0x31f125,null))[_0xa0d7('0x25')](saveUpdates(_0x26c63c[_0xa0d7('0x47')],null))[_0xa0d7('0x25')](respondWithResult(_0x31f125,null))[_0xa0d7('0x48')](handleError(_0x31f125,null));};exports[_0xa0d7('0x49')]=function(_0x2dcfcb,_0x4a3844){return db[_0xa0d7('0x3e')][_0xa0d7('0x4a')]({'where':{'id':_0x2dcfcb[_0xa0d7('0x44')]['id']}})[_0xa0d7('0x25')](handleEntityNotFound(_0x4a3844,null))[_0xa0d7('0x25')](removeEntity(_0x4a3844,null))[_0xa0d7('0x48')](handleError(_0x4a3844,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 918e624..13608e8 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 _0x687b=['rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index','idField','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x2477db,_0x117831){var _0x239485=function(_0x20200b){while(--_0x20200b){_0x2477db['push'](_0x2477db['shift']());}};_0x239485(++_0x117831);}(_0x687b,0x14a));var _0xb687=function(_0x3986fc,_0x41fd49){_0x3986fc=_0x3986fc-0x0;var _0x514bd1=_0x687b[_0x3986fc];return _0x514bd1;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x44303b,_0x4fbb8a){var _0x22380c=function(_0x2f16e9){while(--_0x2f16e9){_0x44303b['push'](_0x44303b['shift']());}};_0x22380c(++_0x4fbb8a);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x369b33,_0x3006bd){_0x369b33=_0x369b33-0x0;var _0x501bb6=_0x0adf[_0x369b33];return _0x501bb6;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf0ad('0xd'),'fields':[_0xf0ad('0xe'),_0xf0ad('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index f7f5cf9..c2d2850 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 _0x9336=['result','catch','lodash','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','ZohoField,\x20%s,\x20%s','message'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9336,0x80));var _0x6933=function(_0x49f898,_0x477e33){_0x49f898=_0x49f898-0x0;var _0xeaf382=_0x9336[_0x49f898];return _0xeaf382;};'use strict';var _=require(_0x6933('0x0'));var util=require('util');var moment=require(_0x6933('0x1'));var BPromise=require(_0x6933('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6933('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6933('0x4'))('rpc');var config=require(_0x6933('0x5'));var jayson=require(_0x6933('0x6'));var client=jayson[_0x6933('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb64ec,_0x388aa1,_0x1aa4f2){return new BPromise(function(_0x10191c,_0x1b2352){return client[_0x6933('0x8')](_0xb64ec,_0x1aa4f2)[_0x6933('0x9')](function(_0x2663ea){logger[_0x6933('0xa')]('ZohoField,\x20%s,\x20%s',_0x388aa1,'request\x20sent');logger['debug'](_0x6933('0xb'),_0x388aa1,_0x6933('0xc'),JSON['stringify'](_0x2663ea));if(_0x2663ea[_0x6933('0xd')]){if(_0x2663ea[_0x6933('0xd')]['code']===0x1f4){logger[_0x6933('0xd')](_0x6933('0xe'),_0x388aa1,_0x2663ea[_0x6933('0xd')][_0x6933('0xf')]);return _0x1b2352(_0x2663ea[_0x6933('0xd')][_0x6933('0xf')]);}logger['error'](_0x6933('0xe'),_0x388aa1,_0x2663ea[_0x6933('0xd')]['message']);return _0x10191c(_0x2663ea[_0x6933('0xd')]['message']);}else{logger[_0x6933('0xa')](_0x6933('0xe'),_0x388aa1,'request\x20sent');_0x10191c(_0x2663ea[_0x6933('0x10')][_0x6933('0xf')]);}})[_0x6933('0x11')](function(_0x57153c){logger['error'](_0x6933('0xe'),_0x388aa1,_0x57153c);_0x1b2352(_0x57153c);});});} \ No newline at end of file +var _0x4ffe=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x32f193,_0x612afc){var _0x5bb92e=function(_0x555645){while(--_0x555645){_0x32f193['push'](_0x32f193['shift']());}};_0x5bb92e(++_0x612afc);}(_0x4ffe,0x11b));var _0xe4ff=function(_0x5775c4,_0x11631c){_0x5775c4=_0x5775c4-0x0;var _0xa2e3a1=_0x4ffe[_0x5775c4];return _0xa2e3a1;};'use strict';var _=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe4ff('0x2'));var fs=require('fs');var Redis=require(_0xe4ff('0x3'));var db=require(_0xe4ff('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe4ff('0x5'));var jayson=require(_0xe4ff('0x6'));var client=jayson['client'][_0xe4ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x373a9f,_0x54037c,_0x316e53){return new BPromise(function(_0x20800a,_0x1f558a){return client['request'](_0x373a9f,_0x316e53)[_0xe4ff('0x8')](function(_0x56a185){logger[_0xe4ff('0x9')](_0xe4ff('0xa'),_0x54037c,_0xe4ff('0xb'));logger[_0xe4ff('0xc')](_0xe4ff('0xd'),_0x54037c,'request\x20sent',JSON[_0xe4ff('0xe')](_0x56a185));if(_0x56a185[_0xe4ff('0xf')]){if(_0x56a185['error'][_0xe4ff('0x10')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x54037c,_0x56a185[_0xe4ff('0xf')][_0xe4ff('0x11')]);return _0x1f558a(_0x56a185[_0xe4ff('0xf')][_0xe4ff('0x11')]);}logger[_0xe4ff('0xf')](_0xe4ff('0xa'),_0x54037c,_0x56a185['error'][_0xe4ff('0x11')]);return _0x20800a(_0x56a185[_0xe4ff('0xf')]['message']);}else{logger[_0xe4ff('0x9')](_0xe4ff('0xa'),_0x54037c,_0xe4ff('0xb'));_0x20800a(_0x56a185[_0xe4ff('0x12')]['message']);}})[_0xe4ff('0x13')](function(_0x5773b2){logger[_0xe4ff('0xf')](_0xe4ff('0xa'),_0x54037c,_0x5773b2);_0x1f558a(_0x5773b2);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d97036f..34ee3b5 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x25a386,_0x4acd61){var _0x4d3d47=function(_0x2e4efb){while(--_0x2e4efb){_0x25a386['push'](_0x25a386['shift']());}};_0x4d3d47(++_0x4acd61);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x16aa87,_0x203397){var _0x207322=function(_0x55bb41){while(--_0x55bb41){_0x16aa87['push'](_0x16aa87['shift']());}};_0x207322(++_0x203397);}(_0xe706,0xa3));var _0x6e70=function(_0x180ac2,_0x219d65){_0x180ac2=_0x180ac2-0x0;var _0xfcaede=_0xe706[_0x180ac2];return _0xfcaede;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 29f8e79..4ad9e74 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 _0x1db3=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x17e0d5,_0x3a3d2e){var _0xe0b7a4=function(_0x679ae4){while(--_0x679ae4){_0x17e0d5['push'](_0x17e0d5['shift']());}};_0xe0b7a4(++_0x3a3d2e);}(_0x1db3,0x1e5));var _0x31db=function(_0x3b182b,_0x193ac5){_0x3b182b=_0x3b182b-0x0;var _0x1c59c7=_0x1db3[_0x3b182b];return _0x1c59c7;};'use strict';var Sequelize=require('sequelize');module[_0x31db('0x0')]={'name':{'type':Sequelize[_0x31db('0x1')],'allowNull':![],'unique':_0x31db('0x2')},'version':{'type':Sequelize[_0x31db('0x1')],'allowNull':![],'unique':_0x31db('0x2')},'main':{'type':Sequelize[_0x31db('0x1')],'defaultValue':_0x31db('0x3')},'filename':{'type':Sequelize[_0x31db('0x1')]},'path':{'type':Sequelize[_0x31db('0x1')]},'type':{'type':Sequelize[_0x31db('0x1')]},'size':{'type':Sequelize[_0x31db('0x4')]},'active':{'type':Sequelize[_0x31db('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x31db('0x1')]},'logo':{'type':Sequelize[_0x31db('0x1')]},'state':{'type':Sequelize[_0x31db('0x1')],'unique':_0x31db('0x6')},'description':{'type':Sequelize[_0x31db('0x1')]},'title':{'type':Sequelize[_0x31db('0x1')]},'remoteUri':{'type':Sequelize[_0x31db('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xf492=['unique_name_and_version','app.js','state','sequelize','STRING'];(function(_0x3a850e,_0x53ea18){var _0x52e7c6=function(_0x11343d){while(--_0x11343d){_0x3a850e['push'](_0x3a850e['shift']());}};_0x52e7c6(++_0x53ea18);}(_0xf492,0xb2));var _0x2f49=function(_0x5a73d0,_0x59ec9a){_0x5a73d0=_0x5a73d0-0x0;var _0x3c845a=_0xf492[_0x5a73d0];return _0x3c845a;};'use strict';var Sequelize=require(_0x2f49('0x0'));module['exports']={'name':{'type':Sequelize[_0x2f49('0x1')],'allowNull':![],'unique':_0x2f49('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x2f49('0x1')],'defaultValue':_0x2f49('0x3')},'filename':{'type':Sequelize[_0x2f49('0x1')]},'path':{'type':Sequelize[_0x2f49('0x1')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x2f49('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x2f49('0x1')],'unique':_0x2f49('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2f49('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x2f49('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 0c9eabd..e0532ee 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 _0x187d=['body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','destroy','error','stack','name','index','map','Integration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','where','filter','merge','includeAll','include','findAll','then','rows','catch','show','params','fields','options','find','create'];(function(_0x3ce301,_0x858468){var _0x323499=function(_0x789e5b){while(--_0x789e5b){_0x3ce301['push'](_0x3ce301['shift']());}};_0x323499(++_0x858468);}(_0x187d,0x93));var _0xd187=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x187d[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xd187('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd187('0x1'));var jsonpatch=require(_0xd187('0x2'));var rp=require(_0xd187('0x3'));var moment=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var Mustache=require(_0xd187('0x6'));var util=require('util');var path=require(_0xd187('0x7'));var sox=require(_0xd187('0x8'));var csv=require('to-csv');var ejs=require(_0xd187('0x9'));var fs=require('fs');var fs_extra=require(_0xd187('0xa'));var _=require(_0xd187('0xb'));var squel=require(_0xd187('0xc'));var crypto=require(_0xd187('0xd'));var jsforce=require(_0xd187('0xe'));var deskjs=require(_0xd187('0xf'));var toCsv=require(_0xd187('0x10'));var querystring=require('querystring');var Papa=require(_0xd187('0x11'));var Redis=require(_0xd187('0x12'));var authService=require(_0xd187('0x13'));var qs=require(_0xd187('0x14'));var as=require(_0xd187('0x15'));var hardwareService=require(_0xd187('0x16'));var logger=require('../../config/logger')(_0xd187('0x17'));var utils=require(_0xd187('0x18'));var config=require(_0xd187('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd187('0x1a'))['db'];function respondWithStatusCode(_0x4545cf,_0x32ba07){_0x32ba07=_0x32ba07||0xcc;return function(_0x59ee4a){if(_0x59ee4a){return _0x4545cf[_0xd187('0x1b')](_0x32ba07);}return _0x4545cf[_0xd187('0x1c')](_0x32ba07)[_0xd187('0x1d')]();};}function respondWithResult(_0x126d1a,_0x517b25){_0x517b25=_0x517b25||0xc8;return function(_0x39a927){if(_0x39a927){return _0x126d1a[_0xd187('0x1c')](_0x517b25)[_0xd187('0x1e')](_0x39a927);}};}function respondWithFilteredResult(_0x188cfe,_0x4c8f68){return function(_0x245d3e){if(_0x245d3e){var _0x52a208=typeof _0x4c8f68['offset']===_0xd187('0x1f')&&typeof _0x4c8f68['limit']==='undefined';var _0x207b36=_0x245d3e[_0xd187('0x20')];var _0x374fe0=_0x52a208?0x0:_0x4c8f68[_0xd187('0x21')];var _0x21df74=_0x52a208?_0x245d3e[_0xd187('0x20')]:_0x4c8f68[_0xd187('0x21')]+_0x4c8f68[_0xd187('0x22')];var _0x4f2f88;if(_0x21df74>=_0x207b36){_0x21df74=_0x207b36;_0x4f2f88=0xc8;}else{_0x4f2f88=0xce;}_0x188cfe[_0xd187('0x1c')](_0x4f2f88);return _0x188cfe[_0xd187('0x23')](_0xd187('0x24'),_0x374fe0+'-'+_0x21df74+'/'+_0x207b36)[_0xd187('0x1e')](_0x245d3e);}return null;};}function patchUpdates(_0x5204ee){return function(_0x2f7fb3){try{jsonpatch[_0xd187('0x25')](_0x2f7fb3,_0x5204ee,!![]);}catch(_0xc5bba5){return BPromise['reject'](_0xc5bba5);}return _0x2f7fb3['save']();};}function saveUpdates(_0x57cf1d,_0x435d94){return function(_0x33741d){if(_0x33741d){return _0x33741d[_0xd187('0x26')](_0x57cf1d)['then'](function(_0x2c07c8){return _0x2c07c8;});}return null;};}function removeEntity(_0x57186b,_0x145771){return function(_0x5a7a23){if(_0x5a7a23){return _0x5a7a23[_0xd187('0x27')]()['then'](function(){_0x57186b['status'](0xcc)[_0xd187('0x1d')]();});}};}function handleEntityNotFound(_0x4d992b,_0x12da33){return function(_0x598aa4){if(!_0x598aa4){_0x4d992b['sendStatus'](0x194);}return _0x598aa4;};}function handleError(_0x4eac6a,_0x848ddd){_0x848ddd=_0x848ddd||0x1f4;return function(_0xeff822){logger[_0xd187('0x28')](_0xeff822[_0xd187('0x29')]);if(_0xeff822['name']){delete _0xeff822[_0xd187('0x2a')];}_0x4eac6a[_0xd187('0x1c')](_0x848ddd)['send'](_0xeff822);};}exports[_0xd187('0x2b')]=function(_0x1c87ee,_0x34febe){var _0x4c50a5={},_0x15e2e8={},_0x56e292={'count':0x0,'rows':[]};var _0x263e31=_[_0xd187('0x2c')](db[_0xd187('0x2d')][_0xd187('0x2e')],function(_0x489f2e){return{'name':_0x489f2e[_0xd187('0x2f')],'type':_0x489f2e[_0xd187('0x30')]['key']};});_0x15e2e8['model']=_[_0xd187('0x2c')](_0x263e31,_0xd187('0x2a'));_0x15e2e8[_0xd187('0x31')]=_[_0xd187('0x32')](_0x1c87ee[_0xd187('0x31')]);_0x15e2e8[_0xd187('0x33')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],_0x15e2e8['query']);_0x4c50a5[_0xd187('0x36')]=_[_0xd187('0x34')](_0x15e2e8[_0xd187('0x35')],qs['fields'](_0x1c87ee[_0xd187('0x31')]['fields']));_0x4c50a5[_0xd187('0x36')]=_0x4c50a5[_0xd187('0x36')][_0xd187('0x37')]?_0x4c50a5['attributes']:_0x15e2e8['model'];if(!_0x1c87ee[_0xd187('0x31')][_0xd187('0x38')]('nolimit')){_0x4c50a5[_0xd187('0x22')]=qs[_0xd187('0x22')](_0x1c87ee[_0xd187('0x31')]['limit']);_0x4c50a5['offset']=qs[_0xd187('0x21')](_0x1c87ee[_0xd187('0x31')]['offset']);}_0x4c50a5['order']=qs['sort'](_0x1c87ee[_0xd187('0x31')]['sort']);_0x4c50a5[_0xd187('0x39')]=qs[_0xd187('0x33')](_['pick'](_0x1c87ee[_0xd187('0x31')],_0x15e2e8['filters']),_0x263e31);if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]){_0x4c50a5['where']=_[_0xd187('0x3b')](_0x4c50a5[_0xd187('0x39')],{'$or':_['map'](_0x263e31,function(_0x4399a5){if(_0x4399a5['type']!=='VIRTUAL'){var _0x26b06d={};_0x26b06d[_0x4399a5[_0xd187('0x2a')]]={'$like':'%'+_0x1c87ee[_0xd187('0x31')][_0xd187('0x3a')]+'%'};return _0x26b06d;}})});}_0x4c50a5=_[_0xd187('0x3b')]({},_0x4c50a5,_0x1c87ee['options']);var _0x8860c={'where':_0x4c50a5[_0xd187('0x39')]};return db[_0xd187('0x2d')]['count'](_0x8860c)['then'](function(_0x538c05){_0x56e292['count']=_0x538c05;if(_0x1c87ee[_0xd187('0x31')][_0xd187('0x3c')]){_0x4c50a5[_0xd187('0x3d')]=[{'all':!![]}];}return db[_0xd187('0x2d')][_0xd187('0x3e')](_0x4c50a5);})[_0xd187('0x3f')](function(_0x4699e1){_0x56e292[_0xd187('0x40')]=_0x4699e1;return _0x56e292;})['then'](respondWithFilteredResult(_0x34febe,_0x4c50a5))[_0xd187('0x41')](handleError(_0x34febe,null));};exports[_0xd187('0x42')]=function(_0x31d9d2,_0x51c7fc){var _0x21cbf6={'raw':![],'where':{'id':_0x31d9d2[_0xd187('0x43')]['id']}},_0x48c100={};_0x48c100[_0xd187('0x35')]=_[_0xd187('0x32')](db[_0xd187('0x2d')][_0xd187('0x2e')]);_0x48c100['query']=_[_0xd187('0x32')](_0x31d9d2[_0xd187('0x31')]);_0x48c100[_0xd187('0x33')]=_[_0xd187('0x34')](_0x48c100['model'],_0x48c100[_0xd187('0x31')]);_0x21cbf6[_0xd187('0x36')]=_['intersection'](_0x48c100[_0xd187('0x35')],qs[_0xd187('0x44')](_0x31d9d2['query']['fields']));_0x21cbf6[_0xd187('0x36')]=_0x21cbf6[_0xd187('0x36')]['length']?_0x21cbf6['attributes']:_0x48c100['model'];if(_0x31d9d2[_0xd187('0x31')][_0xd187('0x3c')]){_0x21cbf6[_0xd187('0x3d')]=[{'all':!![]}];}_0x21cbf6=_[_0xd187('0x3b')]({},_0x21cbf6,_0x31d9d2[_0xd187('0x45')]);return db[_0xd187('0x2d')][_0xd187('0x46')](_0x21cbf6)['then'](handleEntityNotFound(_0x51c7fc,null))[_0xd187('0x3f')](respondWithResult(_0x51c7fc,null))[_0xd187('0x41')](handleError(_0x51c7fc,null));};exports[_0xd187('0x47')]=function(_0x3ce4a1,_0x3f5def){return db[_0xd187('0x2d')][_0xd187('0x47')](_0x3ce4a1[_0xd187('0x48')],{})['then'](respondWithResult(_0x3f5def,0xc9))[_0xd187('0x41')](handleError(_0x3f5def,null));};exports[_0xd187('0x26')]=function(_0x4523c8,_0x1449d7){if(_0x4523c8[_0xd187('0x48')]['id']){delete _0x4523c8['body']['id'];}return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x4523c8['params']['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x1449d7,null))[_0xd187('0x3f')](saveUpdates(_0x4523c8['body'],null))['then'](respondWithResult(_0x1449d7,null))['catch'](handleError(_0x1449d7,null));};exports['destroy']=function(_0x473bef,_0x22f432){return db[_0xd187('0x2d')][_0xd187('0x46')]({'where':{'id':_0x473bef[_0xd187('0x43')]['id']}})[_0xd187('0x3f')](handleEntityNotFound(_0x22f432,null))[_0xd187('0x3f')](removeEntity(_0x22f432,null))['catch'](handleError(_0x22f432,null));}; \ No newline at end of file +var _0x1a85=['includeAll','find','create','body','params','destroy','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','pick','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','fields'];(function(_0x15c070,_0x10012d){var _0x3f81bb=function(_0x237443){while(--_0x237443){_0x15c070['push'](_0x15c070['shift']());}};_0x3f81bb(++_0x10012d);}(_0x1a85,0x178));var _0x51a8=function(_0x568039,_0x570f8e){_0x568039=_0x568039-0x0;var _0x1595fc=_0x1a85[_0x568039];return _0x1595fc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x24')]();});}};}function handleEntityNotFound(_0x18e2f3,_0x157554){return function(_0x2f2f05){if(!_0x2f2f05){_0x18e2f3[_0x51a8('0x17')](0x194);}return _0x2f2f05;};}function handleError(_0x1326a2,_0x5b3f49){_0x5b3f49=_0x5b3f49||0x1f4;return function(_0x273ce2){logger[_0x51a8('0x25')](_0x273ce2[_0x51a8('0x26')]);if(_0x273ce2[_0x51a8('0x27')]){delete _0x273ce2[_0x51a8('0x27')];}_0x1326a2[_0x51a8('0x18')](_0x5b3f49)[_0x51a8('0x28')](_0x273ce2);};}exports[_0x51a8('0x29')]=function(_0xec08ae,_0x4b5cda){var _0x20c6b5={},_0x347a02={},_0x4a1548={'count':0x0,'rows':[]};var _0x2f9d53=_['map'](db[_0x51a8('0x2a')][_0x51a8('0x2b')],function(_0x143f46){return{'name':_0x143f46[_0x51a8('0x2c')],'type':_0x143f46[_0x51a8('0x2d')]['key']};});_0x347a02[_0x51a8('0x2e')]=_['map'](_0x2f9d53,_0x51a8('0x27'));_0x347a02[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0xec08ae['query']);_0x347a02[_0x51a8('0x31')]=_['intersection'](_0x347a02[_0x51a8('0x2e')],_0x347a02[_0x51a8('0x2f')]);_0x20c6b5[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x347a02[_0x51a8('0x2e')],qs['fields'](_0xec08ae[_0x51a8('0x2f')]['fields']));_0x20c6b5[_0x51a8('0x32')]=_0x20c6b5[_0x51a8('0x32')][_0x51a8('0x34')]?_0x20c6b5['attributes']:_0x347a02[_0x51a8('0x2e')];if(!_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x35')](_0x51a8('0x36'))){_0x20c6b5[_0x51a8('0x1c')]=qs['limit'](_0xec08ae['query']['limit']);_0x20c6b5[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0xec08ae['query'][_0x51a8('0x1a')]);}_0x20c6b5['order']=qs[_0x51a8('0x37')](_0xec08ae[_0x51a8('0x2f')][_0x51a8('0x37')]);_0x20c6b5[_0x51a8('0x38')]=qs[_0x51a8('0x31')](_[_0x51a8('0x39')](_0xec08ae['query'],_0x347a02['filters']),_0x2f9d53);if(_0xec08ae[_0x51a8('0x2f')]['filter']){_0x20c6b5['where']=_['merge'](_0x20c6b5[_0x51a8('0x38')],{'$or':_[_0x51a8('0x3a')](_0x2f9d53,function(_0x3cbf97){if(_0x3cbf97['type']!==_0x51a8('0x3b')){var _0x25d772={};_0x25d772[_0x3cbf97[_0x51a8('0x27')]]={'$like':'%'+_0xec08ae[_0x51a8('0x2f')]['filter']+'%'};return _0x25d772;}})});}_0x20c6b5=_[_0x51a8('0x3c')]({},_0x20c6b5,_0xec08ae[_0x51a8('0x3d')]);var _0x1b0333={'where':_0x20c6b5['where']};return db[_0x51a8('0x2a')]['count'](_0x1b0333)[_0x51a8('0x23')](function(_0x1e637a){_0x4a1548[_0x51a8('0x1d')]=_0x1e637a;if(_0xec08ae[_0x51a8('0x2f')]['includeAll']){_0x20c6b5[_0x51a8('0x3e')]=[{'all':!![]}];}return db[_0x51a8('0x2a')][_0x51a8('0x3f')](_0x20c6b5);})[_0x51a8('0x23')](function(_0xa33fc){_0x4a1548[_0x51a8('0x40')]=_0xa33fc;return _0x4a1548;})[_0x51a8('0x23')](respondWithFilteredResult(_0x4b5cda,_0x20c6b5))[_0x51a8('0x41')](handleError(_0x4b5cda,null));};exports[_0x51a8('0x42')]=function(_0x4b8467,_0x22e6e6){var _0x2afb74={'raw':![],'where':{'id':_0x4b8467['params']['id']}},_0x4c7c67={};_0x4c7c67[_0x51a8('0x2e')]=_[_0x51a8('0x30')](db[_0x51a8('0x2a')][_0x51a8('0x2b')]);_0x4c7c67[_0x51a8('0x2f')]=_[_0x51a8('0x30')](_0x4b8467[_0x51a8('0x2f')]);_0x4c7c67[_0x51a8('0x31')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],_0x4c7c67['query']);_0x2afb74[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x4c7c67[_0x51a8('0x2e')],qs[_0x51a8('0x43')](_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x43')]));_0x2afb74['attributes']=_0x2afb74[_0x51a8('0x32')]['length']?_0x2afb74[_0x51a8('0x32')]:_0x4c7c67[_0x51a8('0x2e')];if(_0x4b8467[_0x51a8('0x2f')][_0x51a8('0x44')]){_0x2afb74[_0x51a8('0x3e')]=[{'all':!![]}];}_0x2afb74=_['merge']({},_0x2afb74,_0x4b8467['options']);return db[_0x51a8('0x2a')][_0x51a8('0x45')](_0x2afb74)[_0x51a8('0x23')](handleEntityNotFound(_0x22e6e6,null))[_0x51a8('0x23')](respondWithResult(_0x22e6e6,null))[_0x51a8('0x41')](handleError(_0x22e6e6,null));};exports['create']=function(_0x504a43,_0xcbd998){return db[_0x51a8('0x2a')][_0x51a8('0x46')](_0x504a43[_0x51a8('0x47')],{})[_0x51a8('0x23')](respondWithResult(_0xcbd998,0xc9))[_0x51a8('0x41')](handleError(_0xcbd998,null));};exports[_0x51a8('0x22')]=function(_0x1103a3,_0x301578){if(_0x1103a3['body']['id']){delete _0x1103a3['body']['id'];}return db['Integration'][_0x51a8('0x45')]({'where':{'id':_0x1103a3[_0x51a8('0x48')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x301578,null))['then'](saveUpdates(_0x1103a3[_0x51a8('0x47')],null))[_0x51a8('0x23')](respondWithResult(_0x301578,null))['catch'](handleError(_0x301578,null));};exports[_0x51a8('0x49')]=function(_0x4fb93c,_0x50a2f8){return db[_0x51a8('0x2a')][_0x51a8('0x45')]({'where':{'id':_0x4fb93c[_0x51a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x50a2f8,null))['then'](removeEntity(_0x50a2f8,null))[_0x51a8('0x41')](handleError(_0x50a2f8,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d2a2ecc..8a04a41 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 _0x96cd=['rimraf','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5f0509,_0x49b39e){var _0x3504bd=function(_0x1f7b96){while(--_0x1f7b96){_0x5f0509['push'](_0x5f0509['shift']());}};_0x3504bd(++_0x49b39e);}(_0x96cd,0x11e));var _0xd96c=function(_0x3692fa,_0x3b2bd3){_0x3692fa=_0x3692fa-0x0;var _0x3ff410=_0x96cd[_0x3692fa];return _0x3ff410;};'use strict';var _=require(_0xd96c('0x0'));var util=require(_0xd96c('0x1'));var logger=require(_0xd96c('0x2'))(_0xd96c('0x3'));var moment=require(_0xd96c('0x4'));var BPromise=require(_0xd96c('0x5'));var rp=require(_0xd96c('0x6'));var fs=require('fs');var path=require(_0xd96c('0x7'));var rimraf=require(_0xd96c('0x8'));var config=require('../../config/environment');var attributes=require(_0xd96c('0x9'));module[_0xd96c('0xa')]=function(_0x168262,_0x3fae10){return _0x168262[_0xd96c('0xb')](_0xd96c('0xc'),attributes,{'tableName':_0xd96c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca3a=['Integration','integrations','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./integration.attributes','define'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xca3a,0x115));var _0xaca3=function(_0x12b7d2,_0xe4fb32){_0x12b7d2=_0x12b7d2-0x0;var _0x454dd3=_0xca3a[_0x12b7d2];return _0x454dd3;};'use strict';var _=require(_0xaca3('0x0'));var util=require('util');var logger=require(_0xaca3('0x1'))(_0xaca3('0x2'));var moment=require(_0xaca3('0x3'));var BPromise=require(_0xaca3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaca3('0x5'));var config=require(_0xaca3('0x6'));var attributes=require(_0xaca3('0x7'));module['exports']=function(_0x31062d,_0x2f0424){return _0x31062d[_0xaca3('0x8')](_0xaca3('0x9'),attributes,{'tableName':_0xaca3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index f6d8526..db9e5e8 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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x212b5d,_0x318113){var _0xd29835=function(_0x39dc22){while(--_0x39dc22){_0x212b5d['push'](_0x212b5d['shift']());}};_0xd29835(++_0x318113);}(_0xadb5,0xad));var _0x5adb=function(_0x4e99cb,_0x2606d0){_0x4e99cb=_0x4e99cb-0x0;var _0x28f8d9=_0xadb5[_0x4e99cb];return _0x28f8d9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x59c7fa,_0x3b204e){var _0x4d1789=function(_0x5d9ba8){while(--_0x5d9ba8){_0x59c7fa['push'](_0x59c7fa['shift']());}};_0x4d1789(++_0x3b204e);}(_0x7880,0x1f4));var _0x0788=function(_0x4f7576,_0x138a8f){_0x4f7576=_0x4f7576-0x0;var _0x45d522=_0x7880[_0x4f7576];return _0x45d522;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 3676ed9..795ec96 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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x28e257,_0x34e982){var _0x74c799=function(_0x28ee70){while(--_0x28ee70){_0x28e257['push'](_0x28e257['shift']());}};_0x74c799(++_0x34e982);}(_0x955f,0x1eb));var _0xf955=function(_0x577fe1,_0xa58523){_0x577fe1=_0x577fe1-0x0;var _0x276a2a=_0x955f[_0x577fe1];return _0x276a2a;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4974e1,_0x1e8028){var _0x2793d8=function(_0x452836){while(--_0x452836){_0x4974e1['push'](_0x4974e1['shift']());}};_0x2793d8(++_0x1e8028);}(_0x4975,0x86));var _0x5497=function(_0x12b6c3,_0x148024){_0x12b6c3=_0x12b6c3-0x0;var _0x4adfa0=_0x4975[_0x12b6c3];return _0x4adfa0;};'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('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 88d3dde..38f2656 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 _0xd287=['DATE','BOOLEAN','TEXT','ENUM','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0x3de79b,_0x554cc9){var _0x2dd0af=function(_0x4bca2c){while(--_0x4bca2c){_0x3de79b['push'](_0x3de79b['shift']());}};_0x2dd0af(++_0x554cc9);}(_0xd287,0x84));var _0x7d28=function(_0x2082eb,_0x2c855a){_0x2082eb=_0x2082eb-0x0;var _0x1f6f61=_0xd287[_0x2082eb];return _0x1f6f61;};'use strict';var Sequelize=require(_0x7d28('0x0'));module['exports']={'integration':{'type':Sequelize[_0x7d28('0x1')]},'eventChannel':{'type':Sequelize[_0x7d28('0x1')]},'exitStatus':{'type':Sequelize[_0x7d28('0x1')]},'ticketId':{'type':Sequelize[_0x7d28('0x1')]},'integrationId':{'type':Sequelize[_0x7d28('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7d28('0x1')]},'calleridname':{'type':Sequelize[_0x7d28('0x1')]},'queue':{'type':Sequelize[_0x7d28('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7d28('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7d28('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7d28('0x3')]},'holdtime':{'type':Sequelize[_0x7d28('0x2')]},'agentcomplete':{'type':Sequelize[_0x7d28('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7d28('0x2')]},'agentacw':{'type':Sequelize[_0x7d28('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7d28('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x7d28('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7d28('0x3')]},'agentdump':{'type':Sequelize[_0x7d28('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x7d28('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x7d28('0x2')]},'channelstatedesc':{'type':Sequelize[_0x7d28('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7d28('0x1')]},'language':{'type':Sequelize[_0x7d28('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7d28('0x1')]},'priority':{'type':Sequelize[_0x7d28('0x1')]},'destchannel':{'type':Sequelize[_0x7d28('0x1')]},'destchannelstate':{'type':Sequelize[_0x7d28('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x7d28('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7d28('0x1')]},'destcalleridname':{'type':Sequelize[_0x7d28('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7d28('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7d28('0x1')]},'destlanguage':{'type':Sequelize[_0x7d28('0x1')]},'destaccountcode':{'type':Sequelize[_0x7d28('0x1')]},'destcontext':{'type':Sequelize[_0x7d28('0x1')]},'destexten':{'type':Sequelize[_0x7d28('0x1')]},'destpriority':{'type':Sequelize[_0x7d28('0x1')]},'destuniqueid':{'type':Sequelize[_0x7d28('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7d28('0x1')]},'subject':{'type':Sequelize[_0x7d28('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x7d28('0x1')]},'cc':{'type':Sequelize[_0x7d28('0x1')]},'attachment':{'type':Sequelize[_0x7d28('0x5')]},'html':{'type':Sequelize[_0x7d28('0x5')]},'text':{'type':Sequelize[_0x7d28('0x5')]},'status':{'type':Sequelize[_0x7d28('0x6')]('SENT','SENDING',_0x7d28('0x7'),_0x7d28('0x8'))},'url':{'type':Sequelize[_0x7d28('0x1')]},'app':{'type':Sequelize[_0x7d28('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd4c8=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED'];(function(_0xade558,_0x466b32){var _0x1c8491=function(_0x5ee8f1){while(--_0x5ee8f1){_0xade558['push'](_0xade558['shift']());}};_0x1c8491(++_0x466b32);}(_0xd4c8,0x1e4));var _0x8d4c=function(_0x43902f,_0x27940f){_0x43902f=_0x43902f-0x0;var _0x3a6467=_0xd4c8[_0x43902f];return _0x3a6467;};'use strict';var Sequelize=require(_0x8d4c('0x0'));module[_0x8d4c('0x1')]={'integration':{'type':Sequelize[_0x8d4c('0x2')]},'eventChannel':{'type':Sequelize[_0x8d4c('0x2')]},'exitStatus':{'type':Sequelize[_0x8d4c('0x2')]},'ticketId':{'type':Sequelize[_0x8d4c('0x2')]},'integrationId':{'type':Sequelize[_0x8d4c('0x3')]},'contacts':{'type':Sequelize[_0x8d4c('0x2')]},'uniqueid':{'type':Sequelize[_0x8d4c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8d4c('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8d4c('0x2')]},'membername':{'type':Sequelize[_0x8d4c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8d4c('0x4')]},'agentconnectAt':{'type':Sequelize[_0x8d4c('0x4')]},'holdtime':{'type':Sequelize[_0x8d4c('0x3')]},'agentcomplete':{'type':Sequelize[_0x8d4c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x8d4c('0x4')]},'talktime':{'type':Sequelize[_0x8d4c('0x3')]},'agentacw':{'type':Sequelize[_0x8d4c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8d4c('0x3')]},'reason':{'type':Sequelize[_0x8d4c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x8d4c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x8d4c('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x8d4c('0x4')]},'lastevent':{'type':Sequelize[_0x8d4c('0x2')]},'channel':{'type':Sequelize[_0x8d4c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x8d4c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8d4c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8d4c('0x2')]},'context':{'type':Sequelize[_0x8d4c('0x2')]},'exten':{'type':Sequelize[_0x8d4c('0x2')]},'priority':{'type':Sequelize[_0x8d4c('0x2')]},'destchannel':{'type':Sequelize[_0x8d4c('0x2')]},'destchannelstate':{'type':Sequelize[_0x8d4c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x8d4c('0x2')]},'destcalleridname':{'type':Sequelize[_0x8d4c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8d4c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x8d4c('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x8d4c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x8d4c('0x2')]},'destpriority':{'type':Sequelize[_0x8d4c('0x2')]},'destuniqueid':{'type':Sequelize[_0x8d4c('0x2')]},'messageId':{'type':Sequelize[_0x8d4c('0x2')]},'inReplyTo':{'type':Sequelize[_0x8d4c('0x2')]},'subject':{'type':Sequelize[_0x8d4c('0x2')]},'from':{'type':Sequelize[_0x8d4c('0x2')]},'to':{'type':Sequelize[_0x8d4c('0x2')]},'cc':{'type':Sequelize[_0x8d4c('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x8d4c('0x6')]},'text':{'type':Sequelize[_0x8d4c('0x6')]},'status':{'type':Sequelize['ENUM'](_0x8d4c('0x7'),_0x8d4c('0x8'),_0x8d4c('0x9'),_0x8d4c('0xa'))},'url':{'type':Sequelize[_0x8d4c('0x2')]},'app':{'type':Sequelize[_0x8d4c('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x8d4c('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a015c3e..55e44be 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 _0x5851=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','map','IntegrationReport','rawAttributes','type','keys','filters','intersection','model','query','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','includeAll','include','rows','catch','params','fields','find','create','update','body','describe','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x5851,0x10d));var _0x1585=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5851[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x1585('0x0'));var rimraf=require(_0x1585('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1585('0x2'));var BPromise=require(_0x1585('0x3'));var Mustache=require(_0x1585('0x4'));var util=require(_0x1585('0x5'));var path=require(_0x1585('0x6'));var sox=require(_0x1585('0x7'));var csv=require(_0x1585('0x8'));var ejs=require(_0x1585('0x9'));var fs=require('fs');var fs_extra=require(_0x1585('0xa'));var _=require(_0x1585('0xb'));var squel=require(_0x1585('0xc'));var crypto=require(_0x1585('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1585('0x8'));var querystring=require('querystring');var Papa=require(_0x1585('0xe'));var Redis=require('ioredis');var authService=require(_0x1585('0xf'));var qs=require(_0x1585('0x10'));var as=require(_0x1585('0x11'));var hardwareService=require(_0x1585('0x12'));var logger=require(_0x1585('0x13'))('api');var utils=require(_0x1585('0x14'));var config=require(_0x1585('0x15'));var licenseUtil=require(_0x1585('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x80939b,_0x3f9b9b){_0x3f9b9b=_0x3f9b9b||0xcc;return function(_0x3751dd){if(_0x3751dd){return _0x80939b[_0x1585('0x17')](_0x3f9b9b);}return _0x80939b[_0x1585('0x18')](_0x3f9b9b)[_0x1585('0x19')]();};}function respondWithResult(_0x4da27f,_0x2c9c9d){_0x2c9c9d=_0x2c9c9d||0xc8;return function(_0x27be81){if(_0x27be81){return _0x4da27f[_0x1585('0x18')](_0x2c9c9d)[_0x1585('0x1a')](_0x27be81);}};}function respondWithFilteredResult(_0x3ecef1,_0x2a9b48){return function(_0x195e2f){if(_0x195e2f){var _0xe28cb0=typeof _0x2a9b48[_0x1585('0x1b')]===_0x1585('0x1c')&&typeof _0x2a9b48[_0x1585('0x1d')]==='undefined';var _0x2c56af=_0x195e2f[_0x1585('0x1e')];var _0x144529=_0xe28cb0?0x0:_0x2a9b48[_0x1585('0x1b')];var _0x4d5823=_0xe28cb0?_0x195e2f['count']:_0x2a9b48['offset']+_0x2a9b48[_0x1585('0x1d')];var _0x2bb0c6;if(_0x4d5823>=_0x2c56af){_0x4d5823=_0x2c56af;_0x2bb0c6=0xc8;}else{_0x2bb0c6=0xce;}_0x3ecef1[_0x1585('0x18')](_0x2bb0c6);return _0x3ecef1[_0x1585('0x1f')](_0x1585('0x20'),_0x144529+'-'+_0x4d5823+'/'+_0x2c56af)[_0x1585('0x1a')](_0x195e2f);}return null;};}function patchUpdates(_0x1d6e6d){return function(_0x3c903b){try{jsonpatch[_0x1585('0x21')](_0x3c903b,_0x1d6e6d,!![]);}catch(_0x35b374){return BPromise[_0x1585('0x22')](_0x35b374);}return _0x3c903b[_0x1585('0x23')]();};}function saveUpdates(_0x465df9,_0x1307d0){return function(_0x3117e8){if(_0x3117e8){return _0x3117e8['update'](_0x465df9)[_0x1585('0x24')](function(_0x39254c){return _0x39254c;});}return null;};}function removeEntity(_0x33d69f,_0xd13389){return function(_0x5163d1){if(_0x5163d1){return _0x5163d1[_0x1585('0x25')]()[_0x1585('0x24')](function(){_0x33d69f['status'](0xcc)[_0x1585('0x19')]();});}};}function handleEntityNotFound(_0x4ffc5b,_0x341eba){return function(_0x4bd381){if(!_0x4bd381){_0x4ffc5b[_0x1585('0x17')](0x194);}return _0x4bd381;};}function handleError(_0x3d2ff8,_0x50dae4){_0x50dae4=_0x50dae4||0x1f4;return function(_0x2f1c7a){logger[_0x1585('0x26')](_0x2f1c7a[_0x1585('0x27')]);if(_0x2f1c7a['name']){delete _0x2f1c7a['name'];}_0x3d2ff8[_0x1585('0x18')](_0x50dae4)[_0x1585('0x28')](_0x2f1c7a);};}exports['index']=function(_0x353b1d,_0x5a979b){var _0x22fcb3={},_0x5d9a67={},_0xe89e8={'count':0x0,'rows':[]};var _0x1656fe=_[_0x1585('0x29')](db[_0x1585('0x2a')][_0x1585('0x2b')],function(_0x59cdf3){return{'name':_0x59cdf3['fieldName'],'type':_0x59cdf3[_0x1585('0x2c')]['key']};});_0x5d9a67['model']=_[_0x1585('0x29')](_0x1656fe,'name');_0x5d9a67['query']=_[_0x1585('0x2d')](_0x353b1d['query']);_0x5d9a67[_0x1585('0x2e')]=_[_0x1585('0x2f')](_0x5d9a67[_0x1585('0x30')],_0x5d9a67[_0x1585('0x31')]);_0x22fcb3['attributes']=_[_0x1585('0x2f')](_0x5d9a67['model'],qs['fields'](_0x353b1d[_0x1585('0x31')]['fields']));_0x22fcb3[_0x1585('0x32')]=_0x22fcb3[_0x1585('0x32')]['length']?_0x22fcb3['attributes']:_0x5d9a67[_0x1585('0x30')];if(!_0x353b1d['query'][_0x1585('0x33')](_0x1585('0x34'))){_0x22fcb3[_0x1585('0x1d')]=qs[_0x1585('0x1d')](_0x353b1d[_0x1585('0x31')]['limit']);_0x22fcb3[_0x1585('0x1b')]=qs[_0x1585('0x1b')](_0x353b1d[_0x1585('0x31')]['offset']);}_0x22fcb3[_0x1585('0x35')]=qs[_0x1585('0x36')](_0x353b1d[_0x1585('0x31')]['sort']);_0x22fcb3[_0x1585('0x37')]=qs[_0x1585('0x2e')](_[_0x1585('0x38')](_0x353b1d[_0x1585('0x31')],_0x5d9a67[_0x1585('0x2e')]),_0x1656fe);if(_0x353b1d[_0x1585('0x31')][_0x1585('0x39')]){_0x22fcb3[_0x1585('0x37')]=_[_0x1585('0x3a')](_0x22fcb3[_0x1585('0x37')],{'$or':_['map'](_0x1656fe,function(_0x2fcbb4){if(_0x2fcbb4[_0x1585('0x2c')]!=='VIRTUAL'){var _0x177a74={};_0x177a74[_0x2fcbb4[_0x1585('0x3b')]]={'$like':'%'+_0x353b1d[_0x1585('0x31')][_0x1585('0x39')]+'%'};return _0x177a74;}})});}_0x22fcb3=_[_0x1585('0x3a')]({},_0x22fcb3,_0x353b1d[_0x1585('0x3c')]);var _0xa70706={'where':_0x22fcb3[_0x1585('0x37')]};return db[_0x1585('0x2a')][_0x1585('0x1e')](_0xa70706)[_0x1585('0x24')](function(_0x3c1267){_0xe89e8[_0x1585('0x1e')]=_0x3c1267;if(_0x353b1d['query'][_0x1585('0x3d')]){_0x22fcb3[_0x1585('0x3e')]=[{'all':!![]}];}return db[_0x1585('0x2a')]['findAll'](_0x22fcb3);})[_0x1585('0x24')](function(_0x4ad778){_0xe89e8[_0x1585('0x3f')]=_0x4ad778;return _0xe89e8;})[_0x1585('0x24')](respondWithFilteredResult(_0x5a979b,_0x22fcb3))[_0x1585('0x40')](handleError(_0x5a979b,null));};exports['show']=function(_0x1b7643,_0x5b6fbe){var _0x1b5301={'raw':![],'where':{'id':_0x1b7643[_0x1585('0x41')]['id']}},_0xcc354c={};_0xcc354c[_0x1585('0x30')]=_[_0x1585('0x2d')](db[_0x1585('0x2a')]['rawAttributes']);_0xcc354c[_0x1585('0x31')]=_[_0x1585('0x2d')](_0x1b7643[_0x1585('0x31')]);_0xcc354c['filters']=_['intersection'](_0xcc354c[_0x1585('0x30')],_0xcc354c[_0x1585('0x31')]);_0x1b5301[_0x1585('0x32')]=_['intersection'](_0xcc354c[_0x1585('0x30')],qs[_0x1585('0x42')](_0x1b7643[_0x1585('0x31')]['fields']));_0x1b5301[_0x1585('0x32')]=_0x1b5301[_0x1585('0x32')]['length']?_0x1b5301['attributes']:_0xcc354c[_0x1585('0x30')];if(_0x1b7643['query'][_0x1585('0x3d')]){_0x1b5301['include']=[{'all':!![]}];}_0x1b5301=_[_0x1585('0x3a')]({},_0x1b5301,_0x1b7643[_0x1585('0x3c')]);return db[_0x1585('0x2a')][_0x1585('0x43')](_0x1b5301)['then'](handleEntityNotFound(_0x5b6fbe,null))[_0x1585('0x24')](respondWithResult(_0x5b6fbe,null))[_0x1585('0x40')](handleError(_0x5b6fbe,null));};exports[_0x1585('0x44')]=function(_0x3b1051,_0x967d4c){return db[_0x1585('0x2a')][_0x1585('0x44')](_0x3b1051['body'],{})[_0x1585('0x24')](respondWithResult(_0x967d4c,0xc9))[_0x1585('0x40')](handleError(_0x967d4c,null));};exports[_0x1585('0x45')]=function(_0x23ef3e,_0x27e721){if(_0x23ef3e[_0x1585('0x46')]['id']){delete _0x23ef3e['body']['id'];}return db['IntegrationReport'][_0x1585('0x43')]({'where':{'id':_0x23ef3e[_0x1585('0x41')]['id']}})[_0x1585('0x24')](handleEntityNotFound(_0x27e721,null))[_0x1585('0x24')](saveUpdates(_0x23ef3e[_0x1585('0x46')],null))[_0x1585('0x24')](respondWithResult(_0x27e721,null))[_0x1585('0x40')](handleError(_0x27e721,null));};exports[_0x1585('0x25')]=function(_0x498c23,_0x1a8d97){return db[_0x1585('0x2a')]['find']({'where':{'id':_0x498c23[_0x1585('0x41')]['id']}})[_0x1585('0x24')](handleEntityNotFound(_0x1a8d97,null))[_0x1585('0x24')](removeEntity(_0x1a8d97,null))['catch'](handleError(_0x1a8d97,null));};exports[_0x1585('0x47')]=function(_0x296a11,_0x506c08){return db[_0x1585('0x2a')][_0x1585('0x47')]()[_0x1585('0x24')](respondWithResult(_0x506c08,null))[_0x1585('0x40')](handleError(_0x506c08,null));}; \ No newline at end of file +var _0x87ad=['where','filters','VIRTUAL','filter','merge','options','IntegrationReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/utils','../../mysqldb','end','status','offset','undefined','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x87ad,0x183));var _0xd87a=function(_0x57f58a,_0x2a840c){_0x57f58a=_0x57f58a-0x0;var _0x3b745d=_0x87ad[_0x57f58a];return _0x3b745d;};'use strict';var emlformat=require(_0xd87a('0x0'));var rimraf=require(_0xd87a('0x1'));var zipdir=require(_0xd87a('0x2'));var jsonpatch=require(_0xd87a('0x3'));var rp=require(_0xd87a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd87a('0x5'));var util=require(_0xd87a('0x6'));var path=require(_0xd87a('0x7'));var sox=require(_0xd87a('0x8'));var csv=require(_0xd87a('0x9'));var ejs=require(_0xd87a('0xa'));var fs=require('fs');var fs_extra=require(_0xd87a('0xb'));var _=require(_0xd87a('0xc'));var squel=require(_0xd87a('0xd'));var crypto=require(_0xd87a('0xe'));var jsforce=require(_0xd87a('0xf'));var deskjs=require(_0xd87a('0x10'));var toCsv=require(_0xd87a('0x9'));var querystring=require(_0xd87a('0x11'));var Papa=require(_0xd87a('0x12'));var Redis=require(_0xd87a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd87a('0x14'));var as=require(_0xd87a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd87a('0x16'))('api');var utils=require(_0xd87a('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd87a('0x18'))['db'];function respondWithStatusCode(_0xc8b201,_0xa3fae9){_0xa3fae9=_0xa3fae9||0xcc;return function(_0x2caa4f){if(_0x2caa4f){return _0xc8b201['sendStatus'](_0xa3fae9);}return _0xc8b201['status'](_0xa3fae9)[_0xd87a('0x19')]();};}function respondWithResult(_0x3d41fa,_0x3e07ad){_0x3e07ad=_0x3e07ad||0xc8;return function(_0x48e661){if(_0x48e661){return _0x3d41fa[_0xd87a('0x1a')](_0x3e07ad)['json'](_0x48e661);}};}function respondWithFilteredResult(_0x115e0c,_0x2e62df){return function(_0x276574){if(_0x276574){var _0x221853=typeof _0x2e62df[_0xd87a('0x1b')]===_0xd87a('0x1c')&&typeof _0x2e62df['limit']==='undefined';var _0x5dce72=_0x276574[_0xd87a('0x1d')];var _0x35cbad=_0x221853?0x0:_0x2e62df[_0xd87a('0x1b')];var _0x40c704=_0x221853?_0x276574['count']:_0x2e62df[_0xd87a('0x1b')]+_0x2e62df['limit'];var _0x216e69;if(_0x40c704>=_0x5dce72){_0x40c704=_0x5dce72;_0x216e69=0xc8;}else{_0x216e69=0xce;}_0x115e0c[_0xd87a('0x1a')](_0x216e69);return _0x115e0c[_0xd87a('0x1e')](_0xd87a('0x1f'),_0x35cbad+'-'+_0x40c704+'/'+_0x5dce72)[_0xd87a('0x20')](_0x276574);}return null;};}function patchUpdates(_0x1dfec7){return function(_0x18d224){try{jsonpatch[_0xd87a('0x21')](_0x18d224,_0x1dfec7,!![]);}catch(_0x554e2b){return BPromise['reject'](_0x554e2b);}return _0x18d224['save']();};}function saveUpdates(_0x4cb624,_0x2bd2f7){return function(_0x330fc8){if(_0x330fc8){return _0x330fc8[_0xd87a('0x22')](_0x4cb624)[_0xd87a('0x23')](function(_0x4ae286){return _0x4ae286;});}return null;};}function removeEntity(_0x3fdbfe,_0x4429ff){return function(_0x5987d2){if(_0x5987d2){return _0x5987d2[_0xd87a('0x24')]()[_0xd87a('0x23')](function(){_0x3fdbfe[_0xd87a('0x1a')](0xcc)[_0xd87a('0x19')]();});}};}function handleEntityNotFound(_0x507d52,_0x5c0faf){return function(_0x517df9){if(!_0x517df9){_0x507d52['sendStatus'](0x194);}return _0x517df9;};}function handleError(_0x3c689f,_0x109dec){_0x109dec=_0x109dec||0x1f4;return function(_0x5d3293){logger[_0xd87a('0x25')](_0x5d3293[_0xd87a('0x26')]);if(_0x5d3293[_0xd87a('0x27')]){delete _0x5d3293['name'];}_0x3c689f['status'](_0x109dec)[_0xd87a('0x28')](_0x5d3293);};}exports[_0xd87a('0x29')]=function(_0x357750,_0x1c4620){var _0x4c1fe4={},_0x18d77a={},_0x4824d6={'count':0x0,'rows':[]};var _0x38c9a1=_[_0xd87a('0x2a')](db['IntegrationReport']['rawAttributes'],function(_0x32ac91){return{'name':_0x32ac91['fieldName'],'type':_0x32ac91[_0xd87a('0x2b')][_0xd87a('0x2c')]};});_0x18d77a['model']=_['map'](_0x38c9a1,'name');_0x18d77a[_0xd87a('0x2d')]=_[_0xd87a('0x2e')](_0x357750[_0xd87a('0x2d')]);_0x18d77a['filters']=_[_0xd87a('0x2f')](_0x18d77a[_0xd87a('0x30')],_0x18d77a['query']);_0x4c1fe4[_0xd87a('0x31')]=_[_0xd87a('0x2f')](_0x18d77a['model'],qs[_0xd87a('0x32')](_0x357750[_0xd87a('0x2d')][_0xd87a('0x32')]));_0x4c1fe4[_0xd87a('0x31')]=_0x4c1fe4['attributes'][_0xd87a('0x33')]?_0x4c1fe4[_0xd87a('0x31')]:_0x18d77a[_0xd87a('0x30')];if(!_0x357750[_0xd87a('0x2d')][_0xd87a('0x34')](_0xd87a('0x35'))){_0x4c1fe4[_0xd87a('0x36')]=qs[_0xd87a('0x36')](_0x357750[_0xd87a('0x2d')][_0xd87a('0x36')]);_0x4c1fe4[_0xd87a('0x1b')]=qs[_0xd87a('0x1b')](_0x357750['query'][_0xd87a('0x1b')]);}_0x4c1fe4[_0xd87a('0x37')]=qs[_0xd87a('0x38')](_0x357750[_0xd87a('0x2d')][_0xd87a('0x38')]);_0x4c1fe4[_0xd87a('0x39')]=qs['filters'](_['pick'](_0x357750[_0xd87a('0x2d')],_0x18d77a[_0xd87a('0x3a')]),_0x38c9a1);if(_0x357750[_0xd87a('0x2d')]['filter']){_0x4c1fe4[_0xd87a('0x39')]=_['merge'](_0x4c1fe4['where'],{'$or':_[_0xd87a('0x2a')](_0x38c9a1,function(_0x2cb38a){if(_0x2cb38a[_0xd87a('0x2b')]!==_0xd87a('0x3b')){var _0x1e6549={};_0x1e6549[_0x2cb38a[_0xd87a('0x27')]]={'$like':'%'+_0x357750[_0xd87a('0x2d')][_0xd87a('0x3c')]+'%'};return _0x1e6549;}})});}_0x4c1fe4=_[_0xd87a('0x3d')]({},_0x4c1fe4,_0x357750[_0xd87a('0x3e')]);var _0x3e3e61={'where':_0x4c1fe4[_0xd87a('0x39')]};return db[_0xd87a('0x3f')][_0xd87a('0x1d')](_0x3e3e61)[_0xd87a('0x23')](function(_0x480c58){_0x4824d6[_0xd87a('0x1d')]=_0x480c58;if(_0x357750[_0xd87a('0x2d')][_0xd87a('0x40')]){_0x4c1fe4[_0xd87a('0x41')]=[{'all':!![]}];}return db[_0xd87a('0x3f')][_0xd87a('0x42')](_0x4c1fe4);})[_0xd87a('0x23')](function(_0x18f65d){_0x4824d6[_0xd87a('0x43')]=_0x18f65d;return _0x4824d6;})[_0xd87a('0x23')](respondWithFilteredResult(_0x1c4620,_0x4c1fe4))[_0xd87a('0x44')](handleError(_0x1c4620,null));};exports['show']=function(_0x5db32e,_0x3f2d8b){var _0x2b7a67={'raw':![],'where':{'id':_0x5db32e[_0xd87a('0x45')]['id']}},_0x47e3f8={};_0x47e3f8['model']=_['keys'](db['IntegrationReport']['rawAttributes']);_0x47e3f8[_0xd87a('0x2d')]=_[_0xd87a('0x2e')](_0x5db32e['query']);_0x47e3f8['filters']=_['intersection'](_0x47e3f8[_0xd87a('0x30')],_0x47e3f8[_0xd87a('0x2d')]);_0x2b7a67['attributes']=_['intersection'](_0x47e3f8['model'],qs[_0xd87a('0x32')](_0x5db32e['query'][_0xd87a('0x32')]));_0x2b7a67[_0xd87a('0x31')]=_0x2b7a67[_0xd87a('0x31')][_0xd87a('0x33')]?_0x2b7a67[_0xd87a('0x31')]:_0x47e3f8['model'];if(_0x5db32e[_0xd87a('0x2d')][_0xd87a('0x40')]){_0x2b7a67[_0xd87a('0x41')]=[{'all':!![]}];}_0x2b7a67=_[_0xd87a('0x3d')]({},_0x2b7a67,_0x5db32e['options']);return db['IntegrationReport'][_0xd87a('0x46')](_0x2b7a67)['then'](handleEntityNotFound(_0x3f2d8b,null))[_0xd87a('0x23')](respondWithResult(_0x3f2d8b,null))[_0xd87a('0x44')](handleError(_0x3f2d8b,null));};exports[_0xd87a('0x47')]=function(_0x35c3c5,_0x3098da){return db['IntegrationReport'][_0xd87a('0x47')](_0x35c3c5[_0xd87a('0x48')],{})['then'](respondWithResult(_0x3098da,0xc9))[_0xd87a('0x44')](handleError(_0x3098da,null));};exports[_0xd87a('0x22')]=function(_0x317c21,_0x402c46){if(_0x317c21[_0xd87a('0x48')]['id']){delete _0x317c21[_0xd87a('0x48')]['id'];}return db['IntegrationReport'][_0xd87a('0x46')]({'where':{'id':_0x317c21['params']['id']}})['then'](handleEntityNotFound(_0x402c46,null))['then'](saveUpdates(_0x317c21[_0xd87a('0x48')],null))['then'](respondWithResult(_0x402c46,null))[_0xd87a('0x44')](handleError(_0x402c46,null));};exports['destroy']=function(_0x3077c0,_0x346ea6){return db[_0xd87a('0x3f')][_0xd87a('0x46')]({'where':{'id':_0x3077c0['params']['id']}})[_0xd87a('0x23')](handleEntityNotFound(_0x346ea6,null))[_0xd87a('0x23')](removeEntity(_0x346ea6,null))['catch'](handleError(_0x346ea6,null));};exports['describe']=function(_0x169d22,_0x16fad8){return db[_0xd87a('0x3f')][_0xd87a('0x49')]()[_0xd87a('0x23')](respondWithResult(_0x16fad8,null))[_0xd87a('0x44')](handleError(_0x16fad8,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2462dfe..cfb00d1 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 _0x888a=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash'];(function(_0x59bd64,_0x237f2b){var _0x378c0e=function(_0x24e2be){while(--_0x24e2be){_0x59bd64['push'](_0x59bd64['shift']());}};_0x378c0e(++_0x237f2b);}(_0x888a,0x11f));var _0xa888=function(_0xc9fd24,_0x13afcc){_0xc9fd24=_0xc9fd24-0x0;var _0x19107e=_0x888a[_0xc9fd24];return _0x19107e;};'use strict';var _=require(_0xa888('0x0'));var util=require('util');var logger=require(_0xa888('0x1'))(_0xa888('0x2'));var moment=require(_0xa888('0x3'));var BPromise=require('bluebird');var rp=require(_0xa888('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa888('0x5'));var config=require(_0xa888('0x6'));var attributes=require(_0xa888('0x7'));module[_0xa888('0x8')]=function(_0x29b311,_0x4d9e12){return _0x29b311[_0xa888('0x9')](_0xa888('0xa'),attributes,{'tableName':_0xa888('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e9f=['../../config/environment','./integrationReport.attributes','IntegrationReport','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x4e9f,0x107));var _0xf4e9=function(_0x218575,_0x4a6910){_0x218575=_0x218575-0x0;var _0x1da7f0=_0x4e9f[_0x218575];return _0x1da7f0;};'use strict';var _=require(_0xf4e9('0x0'));var util=require(_0xf4e9('0x1'));var logger=require('../../config/logger')(_0xf4e9('0x2'));var moment=require('moment');var BPromise=require(_0xf4e9('0x3'));var rp=require(_0xf4e9('0x4'));var fs=require('fs');var path=require(_0xf4e9('0x5'));var rimraf=require(_0xf4e9('0x6'));var config=require(_0xf4e9('0x7'));var attributes=require(_0xf4e9('0x8'));module['exports']=function(_0x3362b5,_0x5510b2){return _0x3362b5['define'](_0xf4e9('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 8a16423..008cb94 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x48423a,_0x203d08){var _0x75c887=function(_0x2a06b6){while(--_0x2a06b6){_0x48423a['push'](_0x48423a['shift']());}};_0x75c887(++_0x203d08);}(_0xabce,0x103));var _0xeabc=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xabce[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('IntegrationReport,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x397ef3,_0x2e5068){_0x397ef3=_0x397ef3-0x0;var _0x432104=_0x7a54[_0x397ef3];return _0x432104;};'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')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index a46d899..59f8d7e 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 _0x25ed=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0x488021,_0x4b493e){var _0x27a0e0=function(_0x589d95){while(--_0x589d95){_0x488021['push'](_0x488021['shift']());}};_0x27a0e0(++_0x4b493e);}(_0x25ed,0x1e8));var _0xd25e=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x25ed[_0xe2c95e];return _0x42ce6f;};'use strict';var multer=require(_0xd25e('0x0'));var util=require(_0xd25e('0x1'));var path=require('path');var timeout=require(_0xd25e('0x2'));var express=require(_0xd25e('0x3'));var router=express[_0xd25e('0x4')]();var fs_extra=require(_0xd25e('0x5'));var auth=require(_0xd25e('0x6'));var interaction=require(_0xd25e('0x7'));var config=require(_0xd25e('0x8'));var controller=require(_0xd25e('0x9'));router[_0xd25e('0xa')]('/',auth[_0xd25e('0xb')](),controller[_0xd25e('0xc')]);router[_0xd25e('0xa')](_0xd25e('0xd'),auth[_0xd25e('0xb')](),controller[_0xd25e('0xe')]);router['get'](_0xd25e('0xf'),auth[_0xd25e('0xb')](),controller[_0xd25e('0x10')]);router[_0xd25e('0x11')]('/',auth[_0xd25e('0xb')](),controller['create']);router['post']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xd25e('0x12')]);router[_0xd25e('0x11')](_0xd25e('0x13'),auth[_0xd25e('0xb')](),controller[_0xd25e('0x14')]);router[_0xd25e('0x15')](_0xd25e('0xd'),auth[_0xd25e('0xb')](),controller['update']);router['delete'](_0xd25e('0xd'),auth[_0xd25e('0xb')](),controller['destroy']);module[_0xd25e('0x16')]=router; \ No newline at end of file +var _0x14c5=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','update'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x14c5,0x1de));var _0x514c=function(_0x581d4a,_0x18ba03){_0x581d4a=_0x581d4a-0x0;var _0x3257a7=_0x14c5[_0x581d4a];return _0x3257a7;};'use strict';var multer=require(_0x514c('0x0'));var util=require(_0x514c('0x1'));var path=require(_0x514c('0x2'));var timeout=require('connect-timeout');var express=require(_0x514c('0x3'));var router=express[_0x514c('0x4')]();var fs_extra=require(_0x514c('0x5'));var auth=require(_0x514c('0x6'));var interaction=require(_0x514c('0x7'));var config=require(_0x514c('0x8'));var controller=require(_0x514c('0x9'));router[_0x514c('0xa')]('/',auth[_0x514c('0xb')](),controller['index']);router[_0x514c('0xa')](_0x514c('0xc'),auth[_0x514c('0xb')](),controller[_0x514c('0xd')]);router[_0x514c('0xa')](_0x514c('0xe'),auth[_0x514c('0xb')](),controller[_0x514c('0xf')]);router['post']('/',auth[_0x514c('0xb')](),controller[_0x514c('0x10')]);router[_0x514c('0x11')](_0x514c('0xe'),auth[_0x514c('0xb')](),controller[_0x514c('0x12')]);router[_0x514c('0x11')](_0x514c('0x13'),auth[_0x514c('0xb')](),controller[_0x514c('0x14')]);router['put'](_0x514c('0xc'),auth['isAuthenticated'](),controller[_0x514c('0x15')]);router[_0x514c('0x16')](_0x514c('0xc'),auth['isAuthenticated'](),controller[_0x514c('0x17')]);module[_0x514c('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index be1a74d..deaf3a8 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 _0x2518=['sequelize','exports','STRING'];(function(_0x349f72,_0x502f47){var _0x1125bd=function(_0x195723){while(--_0x195723){_0x349f72['push'](_0x349f72['shift']());}};_0x1125bd(++_0x502f47);}(_0x2518,0xcc));var _0x8251=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2518[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8251('0x0'));module[_0x8251('0x1')]={'name':{'type':Sequelize[_0x8251('0x2')]},'description':{'type':Sequelize[_0x8251('0x2')]},'interval':{'type':Sequelize[_0x8251('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x3ea0=['exports','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3ea0,0x1d3));var _0x03ea=function(_0x279755,_0x42ad77){_0x279755=_0x279755-0x0;var _0x138178=_0x3ea0[_0x279755];return _0x138178;};'use strict';var Sequelize=require(_0x03ea('0x0'));module[_0x03ea('0x1')]={'name':{'type':Sequelize[_0x03ea('0x2')]},'description':{'type':Sequelize[_0x03ea('0x2')]},'interval':{'type':Sequelize[_0x03ea('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f8475e5..aed3235 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 _0x62cf=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Intervals','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','type','model','query','filters','intersection','fields'];(function(_0x30a2d2,_0x34423d){var _0x3d59a3=function(_0x58c078){while(--_0x58c078){_0x30a2d2['push'](_0x30a2d2['shift']());}};_0x3d59a3(++_0x34423d);}(_0x62cf,0x193));var _0xf62c=function(_0x36bd61,_0x8eb3fc){_0x36bd61=_0x36bd61-0x0;var _0x33aa86=_0x62cf[_0x36bd61];return _0x33aa86;};'use strict';var emlformat=require(_0xf62c('0x0'));var rimraf=require(_0xf62c('0x1'));var zipdir=require(_0xf62c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf62c('0x3'));var BPromise=require(_0xf62c('0x4'));var Mustache=require(_0xf62c('0x5'));var util=require(_0xf62c('0x6'));var path=require(_0xf62c('0x7'));var sox=require(_0xf62c('0x8'));var csv=require(_0xf62c('0x9'));var ejs=require(_0xf62c('0xa'));var fs=require('fs');var fs_extra=require(_0xf62c('0xb'));var _=require(_0xf62c('0xc'));var squel=require(_0xf62c('0xd'));var crypto=require(_0xf62c('0xe'));var jsforce=require(_0xf62c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf62c('0x9'));var querystring=require(_0xf62c('0x10'));var Papa=require(_0xf62c('0x11'));var Redis=require(_0xf62c('0x12'));var authService=require(_0xf62c('0x13'));var qs=require(_0xf62c('0x14'));var as=require(_0xf62c('0x15'));var hardwareService=require(_0xf62c('0x16'));var logger=require(_0xf62c('0x17'))(_0xf62c('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf62c('0x19'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x4eb996,_0x557fbb){_0x557fbb=_0x557fbb||0xcc;return function(_0x6f3a78){if(_0x6f3a78){return _0x4eb996['sendStatus'](_0x557fbb);}return _0x4eb996[_0xf62c('0x1a')](_0x557fbb)[_0xf62c('0x1b')]();};}function respondWithResult(_0x179a44,_0x33d6d5){_0x33d6d5=_0x33d6d5||0xc8;return function(_0x2192ca){if(_0x2192ca){return _0x179a44['status'](_0x33d6d5)['json'](_0x2192ca);}};}function respondWithFilteredResult(_0x54ebd7,_0x31ff79){return function(_0x482cb7){if(_0x482cb7){var _0x518317=typeof _0x31ff79[_0xf62c('0x1c')]===_0xf62c('0x1d')&&typeof _0x31ff79[_0xf62c('0x1e')]===_0xf62c('0x1d');var _0x18280a=_0x482cb7[_0xf62c('0x1f')];var _0x12aeb9=_0x518317?0x0:_0x31ff79['offset'];var _0x42bae=_0x518317?_0x482cb7[_0xf62c('0x1f')]:_0x31ff79[_0xf62c('0x1c')]+_0x31ff79['limit'];var _0x4b20e3;if(_0x42bae>=_0x18280a){_0x42bae=_0x18280a;_0x4b20e3=0xc8;}else{_0x4b20e3=0xce;}_0x54ebd7[_0xf62c('0x1a')](_0x4b20e3);return _0x54ebd7[_0xf62c('0x20')]('Content-Range',_0x12aeb9+'-'+_0x42bae+'/'+_0x18280a)[_0xf62c('0x21')](_0x482cb7);}return null;};}function patchUpdates(_0x1aba8f){return function(_0x53efda){try{jsonpatch[_0xf62c('0x22')](_0x53efda,_0x1aba8f,!![]);}catch(_0x248bda){return BPromise[_0xf62c('0x23')](_0x248bda);}return _0x53efda[_0xf62c('0x24')]();};}function saveUpdates(_0x133b8a,_0x4f7483){return function(_0x10d0bf){if(_0x10d0bf){return _0x10d0bf[_0xf62c('0x25')](_0x133b8a)[_0xf62c('0x26')](function(_0x36f725){return _0x36f725;});}return null;};}function removeEntity(_0x17bbbb,_0x14fff8){return function(_0x4982b7){if(_0x4982b7){return _0x4982b7[_0xf62c('0x27')]()[_0xf62c('0x26')](function(){var _0x6d6878=_0x4982b7[_0xf62c('0x28')]({'plain':!![]});var _0xfb7e25=_0xf62c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0xfb7e25,'resourceId':_0x6d6878['id']}})[_0xf62c('0x26')](function(){return _0x4982b7;});})['then'](function(){_0x17bbbb[_0xf62c('0x1a')](0xcc)[_0xf62c('0x1b')]();});}};}function handleEntityNotFound(_0x5b287d,_0x2714b0){return function(_0x3bd504){if(!_0x3bd504){_0x5b287d[_0xf62c('0x2a')](0x194);}return _0x3bd504;};}function handleError(_0x1bc02a,_0x5aa446){_0x5aa446=_0x5aa446||0x1f4;return function(_0x401ee3){logger[_0xf62c('0x2b')](_0x401ee3[_0xf62c('0x2c')]);if(_0x401ee3['name']){delete _0x401ee3[_0xf62c('0x2d')];}_0x1bc02a[_0xf62c('0x1a')](_0x5aa446)[_0xf62c('0x2e')](_0x401ee3);};}exports[_0xf62c('0x2f')]=function(_0x28dd5d,_0x550eef){var _0x1a9166={},_0x1e9070={},_0x3380e1={'count':0x0,'rows':[]};var _0x1c5a09=_[_0xf62c('0x30')](db[_0xf62c('0x31')][_0xf62c('0x32')],function(_0x1c3209){return{'name':_0x1c3209['fieldName'],'type':_0x1c3209[_0xf62c('0x33')]['key']};});_0x1e9070[_0xf62c('0x34')]=_['map'](_0x1c5a09,'name');_0x1e9070[_0xf62c('0x35')]=_['keys'](_0x28dd5d[_0xf62c('0x35')]);_0x1e9070[_0xf62c('0x36')]=_[_0xf62c('0x37')](_0x1e9070[_0xf62c('0x34')],_0x1e9070[_0xf62c('0x35')]);_0x1a9166['attributes']=_[_0xf62c('0x37')](_0x1e9070[_0xf62c('0x34')],qs['fields'](_0x28dd5d['query'][_0xf62c('0x38')]));_0x1a9166[_0xf62c('0x39')]=_0x1a9166[_0xf62c('0x39')][_0xf62c('0x3a')]?_0x1a9166[_0xf62c('0x39')]:_0x1e9070[_0xf62c('0x34')];if(!_0x28dd5d[_0xf62c('0x35')][_0xf62c('0x3b')](_0xf62c('0x3c'))){_0x1a9166[_0xf62c('0x1e')]=qs[_0xf62c('0x1e')](_0x28dd5d['query'][_0xf62c('0x1e')]);_0x1a9166[_0xf62c('0x1c')]=qs[_0xf62c('0x1c')](_0x28dd5d[_0xf62c('0x35')][_0xf62c('0x1c')]);}_0x1a9166[_0xf62c('0x3d')]=qs['sort'](_0x28dd5d[_0xf62c('0x35')][_0xf62c('0x3e')]);_0x1a9166['where']=qs[_0xf62c('0x36')](_[_0xf62c('0x3f')](_0x28dd5d[_0xf62c('0x35')],_0x1e9070[_0xf62c('0x36')]),_0x1c5a09);if(_0x28dd5d[_0xf62c('0x35')][_0xf62c('0x40')]){_0x1a9166['where']=_[_0xf62c('0x41')](_0x1a9166[_0xf62c('0x42')],{'$or':_[_0xf62c('0x30')](_0x1c5a09,function(_0x1ab7fb){if(_0x1ab7fb[_0xf62c('0x33')]!=='VIRTUAL'){var _0x12d799={};_0x12d799[_0x1ab7fb[_0xf62c('0x2d')]]={'$like':'%'+_0x28dd5d['query'][_0xf62c('0x40')]+'%'};return _0x12d799;}})});}_0x1a9166=_[_0xf62c('0x41')]({},_0x1a9166,_0x28dd5d[_0xf62c('0x43')]);var _0x6c35db={'where':_0x1a9166[_0xf62c('0x42')]};return db[_0xf62c('0x31')][_0xf62c('0x1f')](_0x6c35db)[_0xf62c('0x26')](function(_0x19442b){_0x3380e1[_0xf62c('0x1f')]=_0x19442b;if(_0x28dd5d['query'][_0xf62c('0x44')]){_0x1a9166[_0xf62c('0x45')]=[{'all':!![]}];}return db[_0xf62c('0x31')][_0xf62c('0x46')](_0x1a9166);})[_0xf62c('0x26')](function(_0x21360e){_0x3380e1[_0xf62c('0x47')]=_0x21360e;return _0x3380e1;})[_0xf62c('0x26')](respondWithFilteredResult(_0x550eef,_0x1a9166))['catch'](handleError(_0x550eef,null));};exports[_0xf62c('0x48')]=function(_0x1a58dd,_0x5324c7){var _0x42e22b={'raw':!![],'where':{'id':_0x1a58dd[_0xf62c('0x49')]['id']}},_0x1d1e3c={};_0x1d1e3c[_0xf62c('0x34')]=_[_0xf62c('0x4a')](db['Interval'][_0xf62c('0x32')]);_0x1d1e3c[_0xf62c('0x35')]=_[_0xf62c('0x4a')](_0x1a58dd[_0xf62c('0x35')]);_0x1d1e3c[_0xf62c('0x36')]=_[_0xf62c('0x37')](_0x1d1e3c['model'],_0x1d1e3c['query']);_0x42e22b['attributes']=_[_0xf62c('0x37')](_0x1d1e3c[_0xf62c('0x34')],qs[_0xf62c('0x38')](_0x1a58dd[_0xf62c('0x35')][_0xf62c('0x38')]));_0x42e22b['attributes']=_0x42e22b[_0xf62c('0x39')][_0xf62c('0x3a')]?_0x42e22b['attributes']:_0x1d1e3c[_0xf62c('0x34')];if(_0x1a58dd['query'][_0xf62c('0x44')]){_0x42e22b[_0xf62c('0x45')]=[{'all':!![]}];}_0x42e22b=_[_0xf62c('0x41')]({},_0x42e22b,_0x1a58dd[_0xf62c('0x43')]);return db[_0xf62c('0x31')][_0xf62c('0x4b')](_0x42e22b)[_0xf62c('0x26')](handleEntityNotFound(_0x5324c7,null))[_0xf62c('0x26')](respondWithResult(_0x5324c7,null))['catch'](handleError(_0x5324c7,null));};exports[_0xf62c('0x4c')]=function(_0x5d8e3d,_0x45c1eb){return db[_0xf62c('0x31')][_0xf62c('0x4c')](_0x5d8e3d['body'],{})['then'](function(_0x2c33a9){var _0x230c13=_0x5d8e3d[_0xf62c('0x4d')][_0xf62c('0x28')]({'plain':!![]});if(!_0x230c13)throw new Error(_0xf62c('0x4e'));if(_0x230c13[_0xf62c('0x4f')]===_0xf62c('0x4d')){var _0x243d6a=_0x2c33a9[_0xf62c('0x28')]({'plain':!![]});var _0x5a0aba=_0xf62c('0x29');return db[_0xf62c('0x50')]['find']({'where':{'name':_0x5a0aba,'userProfileId':_0x230c13[_0xf62c('0x51')]},'raw':!![]})[_0xf62c('0x26')](function(_0x1916d1){if(_0x1916d1&&_0x1916d1['autoAssociation']===0x0){return db[_0xf62c('0x52')][_0xf62c('0x4c')]({'name':_0x243d6a[_0xf62c('0x2d')],'resourceId':_0x243d6a['id'],'type':_0x1916d1[_0xf62c('0x2d')],'sectionId':_0x1916d1['id']},{})[_0xf62c('0x26')](function(){return _0x2c33a9;});}else{return _0x2c33a9;}})[_0xf62c('0x53')](function(_0x43ce65){logger[_0xf62c('0x2b')](_0xf62c('0x54'),_0x43ce65);throw _0x43ce65;});}return _0x2c33a9;})[_0xf62c('0x26')](respondWithResult(_0x45c1eb,0xc9))[_0xf62c('0x53')](handleError(_0x45c1eb,null));};exports[_0xf62c('0x25')]=function(_0x43a087,_0x12cd65){if(_0x43a087[_0xf62c('0x55')]['id']){delete _0x43a087[_0xf62c('0x55')]['id'];}return db[_0xf62c('0x31')][_0xf62c('0x4b')]({'where':{'id':_0x43a087[_0xf62c('0x49')]['id']}})[_0xf62c('0x26')](handleEntityNotFound(_0x12cd65,null))[_0xf62c('0x26')](saveUpdates(_0x43a087['body'],null))[_0xf62c('0x26')](respondWithResult(_0x12cd65,null))['catch'](handleError(_0x12cd65,null));};exports['destroy']=function(_0x411372,_0x57d1dc){return db['Interval']['find']({'where':{'id':_0x411372['params']['id']}})[_0xf62c('0x26')](handleEntityNotFound(_0x57d1dc,null))[_0xf62c('0x26')](removeEntity(_0x57d1dc,null))[_0xf62c('0x53')](handleError(_0x57d1dc,null));};exports['addInterval']=function(_0x39f78e,_0x13fa1e,_0xf6ecf){if(_0x39f78e[_0xf62c('0x55')]['id']){delete _0x39f78e['body']['id'];}return db[_0xf62c('0x31')][_0xf62c('0x4b')]({'where':{'id':_0x39f78e[_0xf62c('0x49')]['id']}})[_0xf62c('0x26')](handleEntityNotFound(_0x13fa1e,null))[_0xf62c('0x26')](function(_0x260870){if(_0x260870){_0x39f78e[_0xf62c('0x55')][_0xf62c('0x56')]=_0x260870['id'];return db['Interval'][_0xf62c('0x4c')](_0x39f78e[_0xf62c('0x55')]);}})[_0xf62c('0x26')](respondWithResult(_0x13fa1e,null))[_0xf62c('0x53')](handleError(_0x13fa1e,null));};exports[_0xf62c('0x57')]=function(_0x326d25,_0x4685a5,_0x4043af){var _0x5cdebd={};var _0x6064c={};var _0x3bc70b;var _0x22a878;return db['Interval'][_0xf62c('0x58')]({'where':{'id':_0x326d25[_0xf62c('0x49')]['id']}})['then'](handleEntityNotFound(_0x4685a5,null))[_0xf62c('0x26')](function(_0x3ea20e){if(_0x3ea20e){_0x3bc70b=_0x3ea20e;_0x6064c[_0xf62c('0x34')]=_[_0xf62c('0x4a')](db[_0xf62c('0x31')][_0xf62c('0x32')]);_0x6064c[_0xf62c('0x35')]=_[_0xf62c('0x4a')](_0x326d25['query']);_0x6064c[_0xf62c('0x36')]=_[_0xf62c('0x37')](_0x6064c[_0xf62c('0x34')],_0x6064c[_0xf62c('0x35')]);_0x5cdebd[_0xf62c('0x39')]=_[_0xf62c('0x37')](_0x6064c[_0xf62c('0x34')],qs[_0xf62c('0x38')](_0x326d25[_0xf62c('0x35')]['fields']));_0x5cdebd[_0xf62c('0x39')]=_0x5cdebd[_0xf62c('0x39')][_0xf62c('0x3a')]?_0x5cdebd[_0xf62c('0x39')]:_0x6064c[_0xf62c('0x34')];_0x5cdebd[_0xf62c('0x3d')]=qs[_0xf62c('0x3e')](_0x326d25[_0xf62c('0x35')][_0xf62c('0x3e')]);_0x5cdebd[_0xf62c('0x42')]=qs['filters'](_[_0xf62c('0x3f')](_0x326d25['query'],_0x6064c[_0xf62c('0x36')]));if(_0x326d25['query']['filter']){_0x5cdebd[_0xf62c('0x42')]=_[_0xf62c('0x41')](_0x5cdebd[_0xf62c('0x42')],{'$or':_[_0xf62c('0x30')](_0x5cdebd[_0xf62c('0x39')],function(_0x24e447){var _0x31fbad={};_0x31fbad[_0x24e447]={'$like':'%'+_0x326d25[_0xf62c('0x35')][_0xf62c('0x40')]+'%'};return _0x31fbad;})});}_0x5cdebd=_[_0xf62c('0x41')]({},_0x5cdebd,_0x326d25['options']);return _0x3bc70b[_0xf62c('0x57')](_0x5cdebd);}})['then'](function(_0x484d3a){if(_0x484d3a){_0x22a878=_0x484d3a[_0xf62c('0x3a')];if(!_0x326d25[_0xf62c('0x35')][_0xf62c('0x3b')](_0xf62c('0x3c'))){_0x5cdebd[_0xf62c('0x1e')]=qs[_0xf62c('0x1e')](_0x326d25[_0xf62c('0x35')]['limit']);_0x5cdebd['offset']=qs[_0xf62c('0x1c')](_0x326d25[_0xf62c('0x35')][_0xf62c('0x1c')]);}return _0x3bc70b[_0xf62c('0x57')](_0x5cdebd);}})[_0xf62c('0x26')](function(_0x5171f0){if(_0x5171f0){return _0x5171f0?{'count':_0x22a878,'rows':_0x5171f0}:null;}})[_0xf62c('0x26')](respondWithResult(_0x4685a5,null))[_0xf62c('0x53')](handleError(_0x4685a5,null));};exports[_0xf62c('0x59')]=function(_0x3bfd94,_0x50d52c,_0x11e3ee){return db['Interval']['findOne']({'where':{'id':_0x3bfd94[_0xf62c('0x49')]['id']}})[_0xf62c('0x26')](handleEntityNotFound(_0x50d52c,null))[_0xf62c('0x26')](function(_0x3518e2){if(_0x3518e2){return db[_0xf62c('0x5a')][_0xf62c('0x5b')](function(_0x64bc43){return db[_0xf62c('0x31')][_0xf62c('0x27')]({'where':{'IntervalId':_0x3bfd94['params']['id']},'transaction':_0x64bc43})[_0xf62c('0x26')](function(_0x1c3290){var _0x57a3de=_['map'](_0x3bfd94[_0xf62c('0x55')],function(_0x411277){delete _0x411277['id'];_0x411277['IntervalId']=_0x3bfd94[_0xf62c('0x49')]['id'];return _0x411277;});return db['Interval']['bulkCreate'](_0x57a3de,{'transaction':_0x64bc43});});})[_0xf62c('0x26')](function(){return db[_0xf62c('0x31')][_0xf62c('0x46')]({'where':{'IntervalId':_0x3bfd94[_0xf62c('0x49')]['id']}});});}})['then'](respondWithResult(_0x50d52c,null))[_0xf62c('0x53')](handleError(_0x50d52c,null));}; \ No newline at end of file +var _0xfb99=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','undefined','count','offset','set','json','reject','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','Interval','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filters','merge','where','type','VIRTUAL','filter','options','includeAll','include','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getIntervals','findOne','pick','addIntervals','findAll','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','api'];(function(_0x1ddb93,_0x84f55e){var _0x4151b4=function(_0x3239df){while(--_0x3239df){_0x1ddb93['push'](_0x1ddb93['shift']());}};_0x4151b4(++_0x84f55e);}(_0xfb99,0x1e1));var _0x9fb9=function(_0x56a314,_0x4b4da8){_0x56a314=_0x56a314-0x0;var _0x490282=_0xfb99[_0x56a314];return _0x490282;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9fb9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fb9('0x1'));var moment=require(_0x9fb9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9fb9('0x3'));var util=require(_0x9fb9('0x4'));var path=require(_0x9fb9('0x5'));var sox=require('sox');var csv=require(_0x9fb9('0x6'));var ejs=require(_0x9fb9('0x7'));var fs=require('fs');var fs_extra=require(_0x9fb9('0x8'));var _=require(_0x9fb9('0x9'));var squel=require(_0x9fb9('0xa'));var crypto=require(_0x9fb9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fb9('0xc'));var toCsv=require(_0x9fb9('0x6'));var querystring=require('querystring');var Papa=require(_0x9fb9('0xd'));var Redis=require(_0x9fb9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9fb9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9fb9('0x10'));var utils=require(_0x9fb9('0x11'));var config=require(_0x9fb9('0x12'));var licenseUtil=require(_0x9fb9('0x13'));var db=require(_0x9fb9('0x14'))['db'];var extensions=require(_0x9fb9('0x15'));function respondWithStatusCode(_0x457764,_0x41a935){_0x41a935=_0x41a935||0xcc;return function(_0x2961df){if(_0x2961df){return _0x457764['sendStatus'](_0x41a935);}return _0x457764[_0x9fb9('0x16')](_0x41a935)[_0x9fb9('0x17')]();};}function respondWithResult(_0x648bd9,_0x31c5de){_0x31c5de=_0x31c5de||0xc8;return function(_0x11c096){if(_0x11c096){return _0x648bd9[_0x9fb9('0x16')](_0x31c5de)['json'](_0x11c096);}};}function respondWithFilteredResult(_0x102d86,_0x1f6673){return function(_0x1e6ec1){if(_0x1e6ec1){var _0x5a74af=typeof _0x1f6673['offset']===_0x9fb9('0x18')&&typeof _0x1f6673['limit']===_0x9fb9('0x18');var _0x49dad9=_0x1e6ec1[_0x9fb9('0x19')];var _0x3fbc7a=_0x5a74af?0x0:_0x1f6673['offset'];var _0x5e7273=_0x5a74af?_0x1e6ec1[_0x9fb9('0x19')]:_0x1f6673[_0x9fb9('0x1a')]+_0x1f6673['limit'];var _0x2ea6e2;if(_0x5e7273>=_0x49dad9){_0x5e7273=_0x49dad9;_0x2ea6e2=0xc8;}else{_0x2ea6e2=0xce;}_0x102d86[_0x9fb9('0x16')](_0x2ea6e2);return _0x102d86[_0x9fb9('0x1b')]('Content-Range',_0x3fbc7a+'-'+_0x5e7273+'/'+_0x49dad9)[_0x9fb9('0x1c')](_0x1e6ec1);}return null;};}function patchUpdates(_0x5aad85){return function(_0x3a41e7){try{jsonpatch['apply'](_0x3a41e7,_0x5aad85,!![]);}catch(_0x10db18){return BPromise[_0x9fb9('0x1d')](_0x10db18);}return _0x3a41e7[_0x9fb9('0x1e')]();};}function saveUpdates(_0x2ec7b0,_0x1a03f){return function(_0x276646){if(_0x276646){return _0x276646['update'](_0x2ec7b0)[_0x9fb9('0x1f')](function(_0x1ab6d9){return _0x1ab6d9;});}return null;};}function removeEntity(_0x2c187e,_0x3acc19){return function(_0x402658){if(_0x402658){return _0x402658[_0x9fb9('0x20')]()[_0x9fb9('0x1f')](function(){var _0x401183=_0x402658[_0x9fb9('0x21')]({'plain':!![]});var _0x463e36='Intervals';return db[_0x9fb9('0x22')][_0x9fb9('0x20')]({'where':{'type':_0x463e36,'resourceId':_0x401183['id']}})['then'](function(){return _0x402658;});})[_0x9fb9('0x1f')](function(){_0x2c187e['status'](0xcc)[_0x9fb9('0x17')]();});}};}function handleEntityNotFound(_0x2b3837,_0x5e3b4e){return function(_0x39d73c){if(!_0x39d73c){_0x2b3837[_0x9fb9('0x23')](0x194);}return _0x39d73c;};}function handleError(_0x28651d,_0x4e71ae){_0x4e71ae=_0x4e71ae||0x1f4;return function(_0x3dc626){logger['error'](_0x3dc626[_0x9fb9('0x24')]);if(_0x3dc626[_0x9fb9('0x25')]){delete _0x3dc626['name'];}_0x28651d[_0x9fb9('0x16')](_0x4e71ae)[_0x9fb9('0x26')](_0x3dc626);};}exports[_0x9fb9('0x27')]=function(_0x4ffaaa,_0x27cff7){var _0x10cc5a={},_0x431f22={},_0x2e48a5={'count':0x0,'rows':[]};var _0x20399a=_[_0x9fb9('0x28')](db[_0x9fb9('0x29')][_0x9fb9('0x2a')],function(_0x1a3f02){return{'name':_0x1a3f02[_0x9fb9('0x2b')],'type':_0x1a3f02['type']['key']};});_0x431f22[_0x9fb9('0x2c')]=_['map'](_0x20399a,_0x9fb9('0x25'));_0x431f22[_0x9fb9('0x2d')]=_[_0x9fb9('0x2e')](_0x4ffaaa[_0x9fb9('0x2d')]);_0x431f22['filters']=_[_0x9fb9('0x2f')](_0x431f22[_0x9fb9('0x2c')],_0x431f22[_0x9fb9('0x2d')]);_0x10cc5a[_0x9fb9('0x30')]=_['intersection'](_0x431f22[_0x9fb9('0x2c')],qs[_0x9fb9('0x31')](_0x4ffaaa[_0x9fb9('0x2d')][_0x9fb9('0x31')]));_0x10cc5a[_0x9fb9('0x30')]=_0x10cc5a[_0x9fb9('0x30')]['length']?_0x10cc5a[_0x9fb9('0x30')]:_0x431f22[_0x9fb9('0x2c')];if(!_0x4ffaaa[_0x9fb9('0x2d')][_0x9fb9('0x32')](_0x9fb9('0x33'))){_0x10cc5a[_0x9fb9('0x34')]=qs[_0x9fb9('0x34')](_0x4ffaaa[_0x9fb9('0x2d')][_0x9fb9('0x34')]);_0x10cc5a['offset']=qs['offset'](_0x4ffaaa['query']['offset']);}_0x10cc5a[_0x9fb9('0x35')]=qs[_0x9fb9('0x36')](_0x4ffaaa[_0x9fb9('0x2d')][_0x9fb9('0x36')]);_0x10cc5a['where']=qs[_0x9fb9('0x37')](_['pick'](_0x4ffaaa[_0x9fb9('0x2d')],_0x431f22['filters']),_0x20399a);if(_0x4ffaaa[_0x9fb9('0x2d')]['filter']){_0x10cc5a['where']=_[_0x9fb9('0x38')](_0x10cc5a[_0x9fb9('0x39')],{'$or':_['map'](_0x20399a,function(_0x31f2cb){if(_0x31f2cb[_0x9fb9('0x3a')]!==_0x9fb9('0x3b')){var _0x3f260f={};_0x3f260f[_0x31f2cb[_0x9fb9('0x25')]]={'$like':'%'+_0x4ffaaa[_0x9fb9('0x2d')][_0x9fb9('0x3c')]+'%'};return _0x3f260f;}})});}_0x10cc5a=_[_0x9fb9('0x38')]({},_0x10cc5a,_0x4ffaaa[_0x9fb9('0x3d')]);var _0x1c90f8={'where':_0x10cc5a[_0x9fb9('0x39')]};return db[_0x9fb9('0x29')][_0x9fb9('0x19')](_0x1c90f8)[_0x9fb9('0x1f')](function(_0x2ba722){_0x2e48a5[_0x9fb9('0x19')]=_0x2ba722;if(_0x4ffaaa[_0x9fb9('0x2d')][_0x9fb9('0x3e')]){_0x10cc5a[_0x9fb9('0x3f')]=[{'all':!![]}];}return db[_0x9fb9('0x29')]['findAll'](_0x10cc5a);})[_0x9fb9('0x1f')](function(_0x988685){_0x2e48a5['rows']=_0x988685;return _0x2e48a5;})[_0x9fb9('0x1f')](respondWithFilteredResult(_0x27cff7,_0x10cc5a))['catch'](handleError(_0x27cff7,null));};exports[_0x9fb9('0x40')]=function(_0x3f7f57,_0x2a721f){var _0xe6deac={'raw':!![],'where':{'id':_0x3f7f57['params']['id']}},_0x5a2efe={};_0x5a2efe[_0x9fb9('0x2c')]=_['keys'](db[_0x9fb9('0x29')][_0x9fb9('0x2a')]);_0x5a2efe[_0x9fb9('0x2d')]=_[_0x9fb9('0x2e')](_0x3f7f57[_0x9fb9('0x2d')]);_0x5a2efe[_0x9fb9('0x37')]=_[_0x9fb9('0x2f')](_0x5a2efe[_0x9fb9('0x2c')],_0x5a2efe[_0x9fb9('0x2d')]);_0xe6deac[_0x9fb9('0x30')]=_['intersection'](_0x5a2efe[_0x9fb9('0x2c')],qs[_0x9fb9('0x31')](_0x3f7f57[_0x9fb9('0x2d')][_0x9fb9('0x31')]));_0xe6deac[_0x9fb9('0x30')]=_0xe6deac['attributes'][_0x9fb9('0x41')]?_0xe6deac[_0x9fb9('0x30')]:_0x5a2efe['model'];if(_0x3f7f57[_0x9fb9('0x2d')][_0x9fb9('0x3e')]){_0xe6deac[_0x9fb9('0x3f')]=[{'all':!![]}];}_0xe6deac=_['merge']({},_0xe6deac,_0x3f7f57[_0x9fb9('0x3d')]);return db[_0x9fb9('0x29')][_0x9fb9('0x42')](_0xe6deac)[_0x9fb9('0x1f')](handleEntityNotFound(_0x2a721f,null))['then'](respondWithResult(_0x2a721f,null))[_0x9fb9('0x43')](handleError(_0x2a721f,null));};exports['create']=function(_0x337b61,_0x548a19){return db['Interval'][_0x9fb9('0x44')](_0x337b61[_0x9fb9('0x45')],{})[_0x9fb9('0x1f')](function(_0x345e6e){var _0x444035=_0x337b61[_0x9fb9('0x46')][_0x9fb9('0x21')]({'plain':!![]});if(!_0x444035)throw new Error(_0x9fb9('0x47'));if(_0x444035[_0x9fb9('0x48')]===_0x9fb9('0x46')){var _0x5e74f1=_0x345e6e['get']({'plain':!![]});var _0x1612e5=_0x9fb9('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x1612e5,'userProfileId':_0x444035[_0x9fb9('0x4a')]},'raw':!![]})[_0x9fb9('0x1f')](function(_0x32efd7){if(_0x32efd7&&_0x32efd7['autoAssociation']===0x0){return db[_0x9fb9('0x22')][_0x9fb9('0x44')]({'name':_0x5e74f1[_0x9fb9('0x25')],'resourceId':_0x5e74f1['id'],'type':_0x32efd7['name'],'sectionId':_0x32efd7['id']},{})[_0x9fb9('0x1f')](function(){return _0x345e6e;});}else{return _0x345e6e;}})['catch'](function(_0x21f8ab){logger['error'](_0x9fb9('0x4b'),_0x21f8ab);throw _0x21f8ab;});}return _0x345e6e;})[_0x9fb9('0x1f')](respondWithResult(_0x548a19,0xc9))[_0x9fb9('0x43')](handleError(_0x548a19,null));};exports[_0x9fb9('0x4c')]=function(_0x1ff19c,_0x29a16b){if(_0x1ff19c['body']['id']){delete _0x1ff19c[_0x9fb9('0x45')]['id'];}return db[_0x9fb9('0x29')]['find']({'where':{'id':_0x1ff19c['params']['id']}})[_0x9fb9('0x1f')](handleEntityNotFound(_0x29a16b,null))[_0x9fb9('0x1f')](saveUpdates(_0x1ff19c[_0x9fb9('0x45')],null))[_0x9fb9('0x1f')](respondWithResult(_0x29a16b,null))[_0x9fb9('0x43')](handleError(_0x29a16b,null));};exports[_0x9fb9('0x20')]=function(_0xee2cdb,_0x56fdf0){return db[_0x9fb9('0x29')][_0x9fb9('0x42')]({'where':{'id':_0xee2cdb[_0x9fb9('0x4d')]['id']}})[_0x9fb9('0x1f')](handleEntityNotFound(_0x56fdf0,null))[_0x9fb9('0x1f')](removeEntity(_0x56fdf0,null))[_0x9fb9('0x43')](handleError(_0x56fdf0,null));};exports['addInterval']=function(_0x2e8093,_0x5b7c9f,_0x56606e){if(_0x2e8093[_0x9fb9('0x45')]['id']){delete _0x2e8093[_0x9fb9('0x45')]['id'];}return db['Interval'][_0x9fb9('0x42')]({'where':{'id':_0x2e8093['params']['id']}})[_0x9fb9('0x1f')](handleEntityNotFound(_0x5b7c9f,null))[_0x9fb9('0x1f')](function(_0x21838d){if(_0x21838d){_0x2e8093[_0x9fb9('0x45')]['IntervalId']=_0x21838d['id'];return db[_0x9fb9('0x29')]['create'](_0x2e8093[_0x9fb9('0x45')]);}})[_0x9fb9('0x1f')](respondWithResult(_0x5b7c9f,null))[_0x9fb9('0x43')](handleError(_0x5b7c9f,null));};exports[_0x9fb9('0x4e')]=function(_0x336ff7,_0x35db9e,_0xe3c96d){var _0xc0577c={};var _0x190cb0={};var _0x5a189b;var _0x31bfcb;return db[_0x9fb9('0x29')][_0x9fb9('0x4f')]({'where':{'id':_0x336ff7[_0x9fb9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x35db9e,null))[_0x9fb9('0x1f')](function(_0xf539c2){if(_0xf539c2){_0x5a189b=_0xf539c2;_0x190cb0[_0x9fb9('0x2c')]=_['keys'](db['Interval'][_0x9fb9('0x2a')]);_0x190cb0[_0x9fb9('0x2d')]=_[_0x9fb9('0x2e')](_0x336ff7[_0x9fb9('0x2d')]);_0x190cb0['filters']=_['intersection'](_0x190cb0['model'],_0x190cb0[_0x9fb9('0x2d')]);_0xc0577c[_0x9fb9('0x30')]=_[_0x9fb9('0x2f')](_0x190cb0[_0x9fb9('0x2c')],qs['fields'](_0x336ff7['query'][_0x9fb9('0x31')]));_0xc0577c[_0x9fb9('0x30')]=_0xc0577c[_0x9fb9('0x30')][_0x9fb9('0x41')]?_0xc0577c[_0x9fb9('0x30')]:_0x190cb0['model'];_0xc0577c[_0x9fb9('0x35')]=qs[_0x9fb9('0x36')](_0x336ff7['query'][_0x9fb9('0x36')]);_0xc0577c['where']=qs[_0x9fb9('0x37')](_[_0x9fb9('0x50')](_0x336ff7[_0x9fb9('0x2d')],_0x190cb0[_0x9fb9('0x37')]));if(_0x336ff7[_0x9fb9('0x2d')][_0x9fb9('0x3c')]){_0xc0577c[_0x9fb9('0x39')]=_['merge'](_0xc0577c['where'],{'$or':_['map'](_0xc0577c[_0x9fb9('0x30')],function(_0x177c15){var _0x223d44={};_0x223d44[_0x177c15]={'$like':'%'+_0x336ff7[_0x9fb9('0x2d')]['filter']+'%'};return _0x223d44;})});}_0xc0577c=_[_0x9fb9('0x38')]({},_0xc0577c,_0x336ff7[_0x9fb9('0x3d')]);return _0x5a189b[_0x9fb9('0x4e')](_0xc0577c);}})[_0x9fb9('0x1f')](function(_0x53b943){if(_0x53b943){_0x31bfcb=_0x53b943[_0x9fb9('0x41')];if(!_0x336ff7[_0x9fb9('0x2d')][_0x9fb9('0x32')](_0x9fb9('0x33'))){_0xc0577c[_0x9fb9('0x34')]=qs[_0x9fb9('0x34')](_0x336ff7['query'][_0x9fb9('0x34')]);_0xc0577c[_0x9fb9('0x1a')]=qs[_0x9fb9('0x1a')](_0x336ff7[_0x9fb9('0x2d')][_0x9fb9('0x1a')]);}return _0x5a189b['getIntervals'](_0xc0577c);}})[_0x9fb9('0x1f')](function(_0x56b53e){if(_0x56b53e){return _0x56b53e?{'count':_0x31bfcb,'rows':_0x56b53e}:null;}})[_0x9fb9('0x1f')](respondWithResult(_0x35db9e,null))[_0x9fb9('0x43')](handleError(_0x35db9e,null));};exports[_0x9fb9('0x51')]=function(_0x55b421,_0x40767c,_0x322328){return db[_0x9fb9('0x29')][_0x9fb9('0x4f')]({'where':{'id':_0x55b421[_0x9fb9('0x4d')]['id']}})[_0x9fb9('0x1f')](handleEntityNotFound(_0x40767c,null))['then'](function(_0x22f189){if(_0x22f189){return db['sequelize']['transaction'](function(_0x348acd){return db['Interval']['destroy']({'where':{'IntervalId':_0x55b421[_0x9fb9('0x4d')]['id']},'transaction':_0x348acd})[_0x9fb9('0x1f')](function(_0x37aa73){var _0xc7f6f5=_['map'](_0x55b421['body'],function(_0x4b6bd3){delete _0x4b6bd3['id'];_0x4b6bd3['IntervalId']=_0x55b421[_0x9fb9('0x4d')]['id'];return _0x4b6bd3;});return db['Interval']['bulkCreate'](_0xc7f6f5,{'transaction':_0x348acd});});})[_0x9fb9('0x1f')](function(){return db[_0x9fb9('0x29')][_0x9fb9('0x52')]({'where':{'IntervalId':_0x55b421[_0x9fb9('0x4d')]['id']}});});}})[_0x9fb9('0x1f')](respondWithResult(_0x40767c,null))['catch'](handleError(_0x40767c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 15feadc..7ac4bc6 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 _0xc103=['Interval','tools_intervals','rewrite','interval','getIntervals','then','all','map','ifTime','reduce','exports','define'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0xc103,0xd6));var _0x3c10=function(_0x318282,_0xd54e1){_0x318282=_0x318282-0x0;var _0x4c4b86=_0xc103[_0x318282];return _0x4c4b86;};'use strict';var attributes=require('./interval.attributes');var extensions=require('../../components/extensions/rewrite');var iftime=require('../../utils/iftime')['iftime'];module[_0x3c10('0x0')]=function(_0x51d142){return _0x51d142[_0x3c10('0x1')](_0x3c10('0x2'),attributes,{'tableName':_0x3c10('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x279f6c){extensions[_0x3c10('0x4')](_0x51d142,_0x279f6c);},'afterBulkCreate':function(_0x58bbe1,_0x2737f6,_0x162c85){_0x162c85();extensions['rewrite'](_0x51d142,_0x58bbe1[0x0]);},'afterUpdate':function(_0x1e09ba){extensions['rewrite'](_0x51d142,_0x1e09ba);},'afterDestroy':function(_0x29fed1){extensions['rewrite'](_0x51d142,_0x29fed1);}},'instanceMethods':{'ifTime':function(_0x54a376=undefined,_0x40a89b=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x3c10('0x5')],_0x54a376,_0x40a89b);}else{return this[_0x3c10('0x6')]()[_0x3c10('0x7')](function(_0x144930){return Promise[_0x3c10('0x8')](_0x144930[_0x3c10('0x9')](function(_0x15b139){return _0x15b139[_0x3c10('0xa')](_0x54a376,_0x40a89b);}));})[_0x3c10('0x7')](function(_0x4c94fb){return _0x4c94fb[_0x3c10('0xb')](function(_0x3a85a8,_0x93e16b){return _0x3a85a8||_0x93e16b;},![]);});}}}});}; \ No newline at end of file +var _0xb8e7=['rewrite','string','interval','getIntervals','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals'];(function(_0x255554,_0x267e8a){var _0x54eef9=function(_0x188665){while(--_0x188665){_0x255554['push'](_0x255554['shift']());}};_0x54eef9(++_0x267e8a);}(_0xb8e7,0x70));var _0x7b8e=function(_0x49db4f,_0x2498bc){_0x49db4f=_0x49db4f-0x0;var _0x21e442=_0xb8e7[_0x49db4f];return _0x21e442;};'use strict';var attributes=require(_0x7b8e('0x0'));var extensions=require(_0x7b8e('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0x7b8e('0x2')]=function(_0x33a45f){return _0x33a45f[_0x7b8e('0x3')]('Interval',attributes,{'tableName':_0x7b8e('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e5068){extensions['rewrite'](_0x33a45f,_0x1e5068);},'afterBulkCreate':function(_0x14e84b,_0x52f4bd,_0x59c04e){_0x59c04e();extensions[_0x7b8e('0x5')](_0x33a45f,_0x14e84b[0x0]);},'afterUpdate':function(_0x2894dd){extensions[_0x7b8e('0x5')](_0x33a45f,_0x2894dd);},'afterDestroy':function(_0x1515f9){extensions[_0x7b8e('0x5')](_0x33a45f,_0x1515f9);}},'instanceMethods':{'ifTime':function(_0x2708e5=undefined,_0x473e2e=new Date()){if(typeof this['interval']===_0x7b8e('0x6')){return iftime(this[_0x7b8e('0x7')],_0x2708e5,_0x473e2e);}else{return this[_0x7b8e('0x8')]()['then'](function(_0x213927){return Promise['all'](_0x213927[_0x7b8e('0x9')](function(_0x2e1811){return _0x2e1811[_0x7b8e('0xa')](_0x2708e5,_0x473e2e);}));})[_0x7b8e('0xb')](function(_0x5c2c94){return _0x5c2c94[_0x7b8e('0xc')](function(_0x30e5dc,_0x8e9509){return _0x30e5dc||_0x8e9509;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index f6748f6..39f2b46 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 _0xd7ce=['catch','error','message','find','info','ShowInterval','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','isArray','intervals','IntervalIftime:\x20timezone\x20=\x20%s','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd7ce,0x173));var _0xed7c=function(_0x36feb2,_0x53abef){_0x36feb2=_0x36feb2-0x0;var _0x292b43=_0xd7ce[_0x36feb2];return _0x292b43;};'use strict';var _=require(_0xed7c('0x0'));var util=require(_0xed7c('0x1'));var db=require(_0xed7c('0x2'))['db'];var iftime=require(_0xed7c('0x3'))[_0xed7c('0x4')];var logger=require(_0xed7c('0x5'))('rpc');exports[_0xed7c('0x6')]=function(_0x57c33a){var _0x4aaf35=this;return new Promise(function(_0x12160e,_0x191016){return db['Interval'][_0xed7c('0x7')]({'raw':_0x57c33a[_0xed7c('0x8')]?_0x57c33a['options'][_0xed7c('0x9')]===undefined?!![]:![]:!![],'where':_0x57c33a[_0xed7c('0x8')]?_0x57c33a[_0xed7c('0x8')][_0xed7c('0xa')]||null:null,'attributes':_0x57c33a['options']?_0x57c33a['options'][_0xed7c('0xb')]||null:null,'limit':_0x57c33a[_0xed7c('0x8')]?_0x57c33a['options'][_0xed7c('0xc')]||null:null,'include':_0x57c33a[_0xed7c('0x8')]?_0x57c33a[_0xed7c('0x8')][_0xed7c('0xd')]?_[_0xed7c('0xe')](_0x57c33a[_0xed7c('0x8')][_0xed7c('0xd')],function(_0x268d52){return{'model':db[_0x268d52[_0xed7c('0xf')]],'as':_0x268d52['as'],'attributes':_0x268d52[_0xed7c('0xb')],'include':_0x268d52[_0xed7c('0xd')]?_[_0xed7c('0xe')](_0x268d52[_0xed7c('0xd')],function(_0xe5a064){return{'model':db[_0xe5a064[_0xed7c('0xf')]],'as':_0xe5a064['as'],'attributes':_0xe5a064[_0xed7c('0xb')],'include':_0xe5a064['include']?_[_0xed7c('0xe')](_0xe5a064[_0xed7c('0xd')],function(_0x210f7a){return{'model':db[_0x210f7a[_0xed7c('0xf')]],'as':_0x210f7a['as'],'attributes':_0x210f7a[_0xed7c('0xb')]};}):[]};}):[]};}):[]:[]})[_0xed7c('0x10')](function(_0x22de79){logger['info']('GetInterval',_0x57c33a);logger[_0xed7c('0x11')](_0xed7c('0x6'),_0x57c33a,JSON[_0xed7c('0x12')](_0x22de79));_0x12160e(_0x22de79);})[_0xed7c('0x13')](function(_0x4d41fb){logger[_0xed7c('0x14')](_0xed7c('0x6'),_0x4d41fb[_0xed7c('0x15')],_0x57c33a);_0x191016(_0x4aaf35[_0xed7c('0x14')](0x1f4,_0x4d41fb[_0xed7c('0x15')]));});});};exports['ShowInterval']=function(_0x473348){var _0x408468=this;return new Promise(function(_0x5425ee,_0x3c68b6){return db['Interval'][_0xed7c('0x16')]({'raw':_0x473348['options']?_0x473348[_0xed7c('0x8')][_0xed7c('0x9')]===undefined?!![]:![]:!![],'where':_0x473348[_0xed7c('0x8')]?_0x473348[_0xed7c('0x8')][_0xed7c('0xa')]||null:null,'attributes':_0x473348[_0xed7c('0x8')]?_0x473348[_0xed7c('0x8')]['attributes']||null:null,'include':_0x473348[_0xed7c('0x8')]?_0x473348[_0xed7c('0x8')][_0xed7c('0xd')]?_[_0xed7c('0xe')](_0x473348[_0xed7c('0x8')][_0xed7c('0xd')],function(_0x2d4bb5){return{'model':db[_0x2d4bb5['model']],'as':_0x2d4bb5['as'],'attributes':_0x2d4bb5[_0xed7c('0xb')],'include':_0x2d4bb5[_0xed7c('0xd')]?_[_0xed7c('0xe')](_0x2d4bb5[_0xed7c('0xd')],function(_0x4b2e6a){return{'model':db[_0x4b2e6a['model']],'as':_0x4b2e6a['as'],'attributes':_0x4b2e6a[_0xed7c('0xb')],'include':_0x4b2e6a[_0xed7c('0xd')]?_['map'](_0x4b2e6a[_0xed7c('0xd')],function(_0x533606){return{'model':db[_0x533606[_0xed7c('0xf')]],'as':_0x533606['as'],'attributes':_0x533606[_0xed7c('0xb')]};}):[]};}):[]};}):[]:[]})[_0xed7c('0x10')](function(_0x5c46e3){logger[_0xed7c('0x17')](_0xed7c('0x18'),_0x473348);logger[_0xed7c('0x11')](_0xed7c('0x18'),_0x473348,JSON[_0xed7c('0x12')](_0x5c46e3));_0x5425ee(_0x5c46e3);})['catch'](function(_0x29e44c){logger[_0xed7c('0x14')]('ShowInterval',_0x29e44c['message'],_0x473348);_0x3c68b6(_0x408468['error'](0x1f4,_0x29e44c['message']));});});};function checkArrayOfIntervals(_0x5471d7,_0x29879a){var _0x3c8046=[];return db['Interval']['findAll']({'where':{'id':_0x5471d7}})[_0xed7c('0x10')](function(_0x43c6c5){_0x3c8046=_0x43c6c5;return Promise[_0xed7c('0x19')](_0x3c8046['map'](function(_0x30ee1b){return _0x30ee1b[_0xed7c('0x1a')](_0x29879a);}));})['then'](function(_0x59e7d9){var _0x36900d=_0x59e7d9[_0xed7c('0x1b')](function(_0x17a972,_0xc55a55){return _0x17a972||_0xc55a55;},![]);logger[_0xed7c('0x17')](util[_0xed7c('0x1c')](_0xed7c('0x1d'),_0x3c8046[_0xed7c('0xe')](function(_0x450038){return _0x450038[_0xed7c('0x1e')];})[_0xed7c('0x1f')](',\x20'),_0x3c8046[_0xed7c('0xe')](function(_0x364f02){return _0x364f02['id'];})['join'](',\x20')));return _0x36900d;});}function checkSingleInterval(_0x173e48,_0x49b7ac){return db['Interval'][_0xed7c('0x20')](_0x173e48)['then'](function(_0x483bb7){if(_0x483bb7){logger['info'](util[_0xed7c('0x1c')](_0xed7c('0x21'),_0x483bb7[_0xed7c('0x1e')],_0x483bb7['id']));return _0x483bb7['ifTime'](_0x49b7ac);}});}exports[_0xed7c('0x22')]=function(_0xd0743c){var _0x566812=_0xd0743c['intervalIds'];var _0x5a773b=Array[_0xed7c('0x23')](_0xd0743c['intervals'])?_0xd0743c[_0xed7c('0x24')]:typeof _0xd0743c['intervals']==='string'?[_0xd0743c[_0xed7c('0x24')]]:[];var _0x9f7799=_0xd0743c['timezone']||undefined;var _0x49214c=![];if(_0x5a773b['length']){logger[_0xed7c('0x17')](util[_0xed7c('0x1c')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5a773b['join'](';\x20')));}if(_0x9f7799){logger[_0xed7c('0x17')](util[_0xed7c('0x1c')](_0xed7c('0x25'),_0x9f7799));}logger[_0xed7c('0x11')]('Iftime',_0x49214c);logger['silly'](_0xed7c('0x22'),_0xd0743c);return Promise[_0xed7c('0x26')]()[_0xed7c('0x10')](function(){if(Array[_0xed7c('0x23')](_0x566812)){return checkArrayOfIntervals(_0x566812,_0x9f7799);}else if(_0x566812){return checkSingleInterval(_0x566812,_0x9f7799);}})[_0xed7c('0x10')](function(_0x3d2d1a){var _0x3a7261=_0x5a773b[_0xed7c('0x1b')](function(_0x30f6b5,_0x3d9473){return _0x30f6b5||iftime(_0x3d9473,_0x9f7799);},![]);_0x49214c=_0x3d2d1a||_0x3a7261;return _0x49214c;})[_0xed7c('0x13')](function(_0x1ff6b4){logger[_0xed7c('0x14')]('IntervalIftime',_0xd0743c,_0x1ff6b4);throw this[_0xed7c('0x14')](0x1f4,_0x1ff6b4[_0xed7c('0x15')]);});}; \ No newline at end of file +var _0x119c=['IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','GetInterval','Interval','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','error','message','ShowInterval','info','catch','findAll','all','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s'];(function(_0x2f4d41,_0x525047){var _0x3b0bb2=function(_0x19960d){while(--_0x19960d){_0x2f4d41['push'](_0x2f4d41['shift']());}};_0x3b0bb2(++_0x525047);}(_0x119c,0xcc));var _0xc119=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x119c[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0xc119('0x0'));var util=require(_0xc119('0x1'));var db=require(_0xc119('0x2'))['db'];var iftime=require(_0xc119('0x3'))['iftime'];var logger=require(_0xc119('0x4'))('rpc');exports[_0xc119('0x5')]=function(_0x204d28){var _0x30ed2c=this;return new Promise(function(_0x2693da,_0x2f2ebe){return db[_0xc119('0x6')]['findAll']({'raw':_0x204d28[_0xc119('0x7')]?_0x204d28[_0xc119('0x7')][_0xc119('0x8')]===undefined?!![]:![]:!![],'where':_0x204d28[_0xc119('0x7')]?_0x204d28[_0xc119('0x7')][_0xc119('0x9')]||null:null,'attributes':_0x204d28[_0xc119('0x7')]?_0x204d28[_0xc119('0x7')][_0xc119('0xa')]||null:null,'limit':_0x204d28['options']?_0x204d28[_0xc119('0x7')][_0xc119('0xb')]||null:null,'include':_0x204d28['options']?_0x204d28[_0xc119('0x7')][_0xc119('0xc')]?_[_0xc119('0xd')](_0x204d28[_0xc119('0x7')][_0xc119('0xc')],function(_0x4a6a40){return{'model':db[_0x4a6a40[_0xc119('0xe')]],'as':_0x4a6a40['as'],'attributes':_0x4a6a40['attributes'],'include':_0x4a6a40[_0xc119('0xc')]?_['map'](_0x4a6a40[_0xc119('0xc')],function(_0x46206b){return{'model':db[_0x46206b[_0xc119('0xe')]],'as':_0x46206b['as'],'attributes':_0x46206b[_0xc119('0xa')],'include':_0x46206b['include']?_['map'](_0x46206b[_0xc119('0xc')],function(_0x131d56){return{'model':db[_0x131d56[_0xc119('0xe')]],'as':_0x131d56['as'],'attributes':_0x131d56['attributes']};}):[]};}):[]};}):[]:[]})[_0xc119('0xf')](function(_0x44d4db){logger['info'](_0xc119('0x5'),_0x204d28);logger[_0xc119('0x10')](_0xc119('0x5'),_0x204d28,JSON[_0xc119('0x11')](_0x44d4db));_0x2693da(_0x44d4db);})['catch'](function(_0x48a79e){logger[_0xc119('0x12')]('GetInterval',_0x48a79e[_0xc119('0x13')],_0x204d28);_0x2f2ebe(_0x30ed2c[_0xc119('0x12')](0x1f4,_0x48a79e['message']));});});};exports[_0xc119('0x14')]=function(_0x3b4654){var _0x10ee6c=this;return new Promise(function(_0xec179,_0x1b7358){return db[_0xc119('0x6')]['find']({'raw':_0x3b4654[_0xc119('0x7')]?_0x3b4654[_0xc119('0x7')][_0xc119('0x8')]===undefined?!![]:![]:!![],'where':_0x3b4654[_0xc119('0x7')]?_0x3b4654[_0xc119('0x7')][_0xc119('0x9')]||null:null,'attributes':_0x3b4654[_0xc119('0x7')]?_0x3b4654[_0xc119('0x7')]['attributes']||null:null,'include':_0x3b4654[_0xc119('0x7')]?_0x3b4654[_0xc119('0x7')][_0xc119('0xc')]?_[_0xc119('0xd')](_0x3b4654[_0xc119('0x7')][_0xc119('0xc')],function(_0x312087){return{'model':db[_0x312087[_0xc119('0xe')]],'as':_0x312087['as'],'attributes':_0x312087['attributes'],'include':_0x312087[_0xc119('0xc')]?_[_0xc119('0xd')](_0x312087[_0xc119('0xc')],function(_0xfaa968){return{'model':db[_0xfaa968['model']],'as':_0xfaa968['as'],'attributes':_0xfaa968['attributes'],'include':_0xfaa968['include']?_[_0xc119('0xd')](_0xfaa968[_0xc119('0xc')],function(_0x3e7a4c){return{'model':db[_0x3e7a4c['model']],'as':_0x3e7a4c['as'],'attributes':_0x3e7a4c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc119('0xf')](function(_0x5b3229){logger[_0xc119('0x15')](_0xc119('0x14'),_0x3b4654);logger[_0xc119('0x10')](_0xc119('0x14'),_0x3b4654,JSON['stringify'](_0x5b3229));_0xec179(_0x5b3229);})[_0xc119('0x16')](function(_0x15a303){logger['error']('ShowInterval',_0x15a303[_0xc119('0x13')],_0x3b4654);_0x1b7358(_0x10ee6c[_0xc119('0x12')](0x1f4,_0x15a303['message']));});});};function checkArrayOfIntervals(_0x690303,_0x8f82c8){var _0xb29ab2=[];return db[_0xc119('0x6')][_0xc119('0x17')]({'where':{'id':_0x690303}})[_0xc119('0xf')](function(_0x34f767){_0xb29ab2=_0x34f767;return Promise[_0xc119('0x18')](_0xb29ab2[_0xc119('0xd')](function(_0x15c645){return _0x15c645[_0xc119('0x19')](_0x8f82c8);}));})['then'](function(_0x46e8bc){var _0x259e0b=_0x46e8bc[_0xc119('0x1a')](function(_0x138052,_0x562582){return _0x138052||_0x562582;},![]);logger['info'](util[_0xc119('0x1b')](_0xc119('0x1c'),_0xb29ab2['map'](function(_0xd28175){return _0xd28175[_0xc119('0x1d')];})[_0xc119('0x1e')](',\x20'),_0xb29ab2['map'](function(_0x446314){return _0x446314['id'];})[_0xc119('0x1e')](',\x20')));return _0x259e0b;});}function checkSingleInterval(_0x1968bf,_0x1c399b){return db[_0xc119('0x6')]['findById'](_0x1968bf)[_0xc119('0xf')](function(_0x36d089){if(_0x36d089){logger[_0xc119('0x15')](util[_0xc119('0x1b')](_0xc119('0x1f'),_0x36d089[_0xc119('0x1d')],_0x36d089['id']));return _0x36d089['ifTime'](_0x1c399b);}});}exports[_0xc119('0x20')]=function(_0x49f03f){var _0x4dc10a=_0x49f03f['intervalIds'];var _0x3121c5=Array['isArray'](_0x49f03f['intervals'])?_0x49f03f['intervals']:typeof _0x49f03f[_0xc119('0x21')]==='string'?[_0x49f03f['intervals']]:[];var _0x184385=_0x49f03f['timezone']||undefined;var _0x274431=![];if(_0x3121c5[_0xc119('0x22')]){logger[_0xc119('0x15')](util[_0xc119('0x1b')](_0xc119('0x23'),_0x3121c5[_0xc119('0x1e')](';\x20')));}if(_0x184385){logger['info'](util['format'](_0xc119('0x24'),_0x184385));}logger[_0xc119('0x10')](_0xc119('0x25'),_0x274431);logger[_0xc119('0x26')](_0xc119('0x20'),_0x49f03f);return Promise[_0xc119('0x27')]()['then'](function(){if(Array['isArray'](_0x4dc10a)){return checkArrayOfIntervals(_0x4dc10a,_0x184385);}else if(_0x4dc10a){return checkSingleInterval(_0x4dc10a,_0x184385);}})[_0xc119('0xf')](function(_0x5a3082){var _0x256de3=_0x3121c5[_0xc119('0x1a')](function(_0x5c9409,_0x14809c){return _0x5c9409||iftime(_0x14809c,_0x184385);},![]);_0x274431=_0x5a3082||_0x256de3;return _0x274431;})[_0xc119('0x16')](function(_0x53adf4){logger[_0xc119('0x12')]('IntervalIftime',_0x49f03f,_0x53adf4);throw this[_0xc119('0x12')](0x1f4,_0x53adf4[_0xc119('0x13')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3993cfc..908a536 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x1749e5,_0x3181e6){var _0x2eb522=function(_0x36e5d9){while(--_0x36e5d9){_0x1749e5['push'](_0x1749e5['shift']());}};_0x2eb522(++_0x3181e6);}(_0xadb5,0xad));var _0x5adb=function(_0x2fe866,_0x280022){_0x2fe866=_0x2fe866-0x0;var _0x1d36d7=_0xadb5[_0x2fe866];return _0x1d36d7;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x34dab1,_0x2214f8){var _0x4c91a2=function(_0x265983){while(--_0x265983){_0x34dab1['push'](_0x34dab1['shift']());}};_0x4c91a2(++_0x2214f8);}(_0x2ef3,0xba));var _0x32ef=function(_0x495a4b,_0x286098){_0x495a4b=_0x495a4b-0x0;var _0x385494=_0x2ef3[_0x495a4b];return _0x385494;};'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 0990bc5..b7a490e 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 _0x993a=['Basic\x20','toString','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','connection','socket','remoteAddress','../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','customfield_11500','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x702ec5,_0x283b73){var _0x5e0035=function(_0xf2ac11){while(--_0xf2ac11){_0x702ec5['push'](_0x702ec5['shift']());}};_0x5e0035(++_0x283b73);}(_0x993a,0x64));var _0xa993=function(_0x354cd4,_0x410e70){_0x354cd4=_0x354cd4-0x0;var _0x332cca=_0x993a[_0x354cd4];return _0x332cca;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xa993('0x0'))('api');var USERNAME=_0xa993('0x1');var PASSWORD='3eAmWpBVP0';function openIssue(_0x438af0,_0x41aade){var _0x1618c5={'fields':{'project':{'key':_0x438af0[_0xa993('0x2')]||_0xa993('0x3')},'summary':(_0x438af0[_0xa993('0x4')]||_0xa993('0x5'))+_0xa993('0x6')+_0x438af0['ip'],'description':_0x438af0[_0xa993('0x7')]||JSON[_0xa993('0x8')](_0x438af0),'issuetype':{'name':_0x438af0['issuetype']||'Bug'}}};_0x1618c5['fields'][_0xa993('0x9')]=_0x438af0['email'];_0x1618c5[_0xa993('0xa')]['customfield_11501']=_0x438af0['oldToken'];_0x1618c5[_0xa993('0xa')][_0xa993('0xb')]=_0x438af0[_0xa993('0xc')];_0x1618c5['fields'][_0xa993('0xd')]=_0x438af0[_0xa993('0xe')];_0x1618c5[_0xa993('0xa')][_0xa993('0xf')]=_0x438af0[_0xa993('0x10')];_0x1618c5[_0xa993('0xa')][_0xa993('0x11')]=_0x438af0['ip'];var _0x2c4b91={'host':_0xa993('0x12'),'port':0x1bb,'path':_0xa993('0x13'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xa993('0x14')+new Buffer(USERNAME+':'+PASSWORD)[_0xa993('0x15')]('base64')}};var _0x289cac=JSON[_0xa993('0x8')](_0x1618c5);var _0x46dc95=https['request'](_0x2c4b91,function(_0x4c8619){_0x4c8619[_0xa993('0x16')](_0xa993('0x17'));var _0x4fbb22='';_0x4c8619['on'](_0xa993('0x18'),function(_0x4561b2){_0x4fbb22+=_0x4561b2;});_0x4c8619['on'](_0xa993('0x19'),function(){if(_0x41aade){return _0x41aade[_0xa993('0x1a')](_0x4c8619[_0xa993('0x1b')])[_0xa993('0x1c')](JSON[_0xa993('0x1d')](_0x4fbb22));}});});_0x46dc95['on'](_0xa993('0x1e'),function(_0x4fe2a8){if(_0x41aade){return _0x41aade[_0xa993('0x1a')](0x1f4)[_0xa993('0x1c')]({'errors':[{'message':_0xa993('0x1f'),'type':'api.jira'}]});}});_0x46dc95[_0xa993('0x20')](_0x289cac);_0x46dc95['end']();}exports[_0xa993('0x21')]=openIssue;exports[_0xa993('0x22')]=function(_0x577e15,_0x394d16){_0x577e15[_0xa993('0x23')]['ip']=_0x577e15[_0xa993('0x24')]['x-forwarded-for']||_0x577e15[_0xa993('0x25')]['remoteAddress']||_0x577e15[_0xa993('0x26')]['remoteAddress']||_0x577e15[_0xa993('0x25')]['socket'][_0xa993('0x27')];return openIssue(_0x577e15[_0xa993('0x23')],_0x394d16);}; \ No newline at end of file +var _0x5976=['POST','toString','base64','request','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','connection','remoteAddress','socket','body','../../config/logger','api','support','summary','Report','\x20from\x20','description','stringify','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x1fd4f0,_0x5bac6d){var _0x1cd3d4=function(_0x4ca2e0){while(--_0x4ca2e0){_0x1fd4f0['push'](_0x1fd4f0['shift']());}};_0x1cd3d4(++_0x5bac6d);}(_0x5976,0xfd));var _0x6597=function(_0x3a5461,_0x3aeaf5){_0x3a5461=_0x3a5461-0x0;var _0x484909=_0x5976[_0x3a5461];return _0x484909;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0x6597('0x0'))(_0x6597('0x1'));var USERNAME=_0x6597('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x27af4c,_0x80b57d){var _0x3e89dd={'fields':{'project':{'key':_0x27af4c['key']||'MOTGUI'},'summary':(_0x27af4c[_0x6597('0x3')]||_0x6597('0x4'))+_0x6597('0x5')+_0x27af4c['ip'],'description':_0x27af4c[_0x6597('0x6')]||JSON[_0x6597('0x7')](_0x27af4c),'issuetype':{'name':_0x27af4c['issuetype']||_0x6597('0x8')}}};_0x3e89dd[_0x6597('0x9')][_0x6597('0xa')]=_0x27af4c['email'];_0x3e89dd[_0x6597('0x9')][_0x6597('0xb')]=_0x27af4c[_0x6597('0xc')];_0x3e89dd[_0x6597('0x9')][_0x6597('0xd')]=_0x27af4c[_0x6597('0xe')];_0x3e89dd[_0x6597('0x9')]['customfield_11503']=_0x27af4c['name'];_0x3e89dd[_0x6597('0x9')][_0x6597('0xf')]=_0x27af4c[_0x6597('0x10')];_0x3e89dd[_0x6597('0x9')][_0x6597('0x11')]=_0x27af4c['ip'];var _0x430fdc={'host':_0x6597('0x12'),'port':0x1bb,'path':_0x6597('0x13'),'method':_0x6597('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x6597('0x15')](_0x6597('0x16'))}};var _0x2c02bc=JSON[_0x6597('0x7')](_0x3e89dd);var _0xa5e599=https[_0x6597('0x17')](_0x430fdc,function(_0x1abf16){_0x1abf16['setEncoding'](_0x6597('0x18'));var _0xf618c4='';_0x1abf16['on']('data',function(_0x2c078f){_0xf618c4+=_0x2c078f;});_0x1abf16['on'](_0x6597('0x19'),function(){if(_0x80b57d){return _0x80b57d[_0x6597('0x1a')](_0x1abf16[_0x6597('0x1b')])[_0x6597('0x1c')](JSON[_0x6597('0x1d')](_0xf618c4));}});});_0xa5e599['on'](_0x6597('0x1e'),function(_0x1518f9){if(_0x80b57d){return _0x80b57d['status'](0x1f4)['json']({'errors':[{'message':_0x6597('0x1f'),'type':_0x6597('0x20')}]});}});_0xa5e599[_0x6597('0x21')](_0x2c02bc);_0xa5e599[_0x6597('0x19')]();}exports[_0x6597('0x22')]=openIssue;exports['send']=function(_0x4c43b7,_0xe643ae){_0x4c43b7['body']['ip']=_0x4c43b7['headers']['x-forwarded-for']||_0x4c43b7[_0x6597('0x23')][_0x6597('0x24')]||_0x4c43b7['socket'][_0x6597('0x24')]||_0x4c43b7[_0x6597('0x23')][_0x6597('0x25')][_0x6597('0x24')];return openIssue(_0x4c43b7[_0x6597('0x26')],_0xe643ae);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7eb2cec..9653aea 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 _0xb903=['../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','isAuthenticated','describe','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x35df74,_0x1af5d0){var _0x46240b=function(_0xaf323e){while(--_0xaf323e){_0x35df74['push'](_0x35df74['shift']());}};_0x46240b(++_0x1af5d0);}(_0xb903,0x185));var _0x3b90=function(_0x4ff633,_0x38b3e8){_0x4ff633=_0x4ff633-0x0;var _0x34c178=_0xb903[_0x4ff633];return _0x34c178;};'use strict';var multer=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var path=require(_0x3b90('0x2'));var timeout=require(_0x3b90('0x3'));var express=require('express');var router=express[_0x3b90('0x4')]();var fs_extra=require(_0x3b90('0x5'));var auth=require(_0x3b90('0x6'));var interaction=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var controller=require(_0x3b90('0x9'));router[_0x3b90('0xa')]('/',auth['isAuthenticated'](),controller[_0x3b90('0xb')]);router['get']('/describe',auth[_0x3b90('0xc')](),controller[_0x3b90('0xd')]);router[_0x3b90('0xa')](_0x3b90('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3b90('0xe'),auth[_0x3b90('0xc')](),controller['update']);router[_0x3b90('0xf')](_0x3b90('0xe'),auth['isAuthenticated'](),controller[_0x3b90('0x10')]);module[_0x3b90('0x11')]=router; \ No newline at end of file +var _0x4522=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','path','connect-timeout','express','fs-extra'];(function(_0x503940,_0x88f90){var _0x5a10c2=function(_0x12a6bb){while(--_0x12a6bb){_0x503940['push'](_0x503940['shift']());}};_0x5a10c2(++_0x88f90);}(_0x4522,0x1a0));var _0x2452=function(_0x2875a5,_0x2a83d1){_0x2875a5=_0x2875a5-0x0;var _0x5cb141=_0x4522[_0x2875a5];return _0x5cb141;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2452('0x0'));var timeout=require(_0x2452('0x1'));var express=require(_0x2452('0x2'));var router=express['Router']();var fs_extra=require(_0x2452('0x3'));var auth=require(_0x2452('0x4'));var interaction=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var controller=require(_0x2452('0x7'));router[_0x2452('0x8')]('/',auth[_0x2452('0x9')](),controller[_0x2452('0xa')]);router[_0x2452('0x8')](_0x2452('0xb'),auth[_0x2452('0x9')](),controller[_0x2452('0xc')]);router[_0x2452('0x8')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2452('0xf')]);router['put']('/:id',auth[_0x2452('0x9')](),controller[_0x2452('0x10')]);router[_0x2452('0x11')](_0x2452('0xd'),auth[_0x2452('0x9')](),controller[_0x2452('0x12')]);module[_0x2452('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index dbb63e2..e435e1d 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x10b0d2,_0x31c8c2){_0x10b0d2=_0x10b0d2-0x0;var _0x5b10c1=_0x7a54[_0x10b0d2];return _0x5b10c1;};'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(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x54a206,_0x2281b5){_0x54a206=_0x54a206-0x0;var _0x44a310=_0x7a54[_0x54a206];return _0x44a310;};'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 0a1bb30..5b99280 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d17=['to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','update','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0x3012b0,_0x25bcb3){var _0x2ec6f2=function(_0x145355){while(--_0x145355){_0x3012b0['push'](_0x3012b0['shift']());}};_0x2ec6f2(++_0x25bcb3);}(_0x5d17,0x114));var _0x75d1=function(_0x354404,_0x141542){_0x354404=_0x354404-0x0;var _0x1c10f8=_0x5d17[_0x354404];return _0x1c10f8;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['JscriptyAnswerReport'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')](_0x12bd67['body'],{})['then'](respondWithResult(_0x16f744,0xc9))[_0x75d1('0x3e')](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x50def3,_0x2d380d){if(_0x50def3[_0x75d1('0x44')]['id']){delete _0x50def3[_0x75d1('0x44')]['id'];}return db['JscriptyAnswerReport'][_0x75d1('0x45')]({'where':{'id':_0x50def3[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x2d380d,null))[_0x75d1('0x24')](saveUpdates(_0x50def3[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x2d380d,null))[_0x75d1('0x3e')](handleError(_0x2d380d,null));};exports['destroy']=function(_0x1eaa66,_0x382195){return db[_0x75d1('0x28')][_0x75d1('0x45')]({'where':{'id':_0x1eaa66[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x382195,null))[_0x75d1('0x24')](removeEntity(_0x382195,null))['catch'](handleError(_0x382195,null));};exports[_0x75d1('0x46')]=function(_0x3af9c5,_0x42d587){return db['JscriptyAnswerReport'][_0x75d1('0x46')]()[_0x75d1('0x24')](respondWithResult(_0x42d587,null))[_0x75d1('0x3e')](handleError(_0x42d587,null));}; \ No newline at end of file +var _0x6f47=['undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset'];(function(_0x289d01,_0x3388dc){var _0x465dff=function(_0x1b7b32){while(--_0x1b7b32){_0x289d01['push'](_0x289d01['shift']());}};_0x465dff(++_0x3388dc);}(_0x6f47,0xc7));var _0x76f4=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x6f47[_0x173441];return _0x2423a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['map'](_0x1dea0e,'name');_0x30f02e[_0x76f4('0x2e')]=_[_0x76f4('0x2f')](_0x5346be[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2e')]);_0x10ddb4[_0x76f4('0x32')]=_[_0x76f4('0x31')](_0x30f02e[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5346be[_0x76f4('0x2e')]['fields']));_0x10ddb4['attributes']=_0x10ddb4['attributes']['length']?_0x10ddb4[_0x76f4('0x32')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2e')][_0x76f4('0x34')](_0x76f4('0x35'))){_0x10ddb4['limit']=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2e')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x30')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2e')],_0x30f02e[_0x76f4('0x30')]),_0x1dea0e);if(_0x5346be[_0x76f4('0x2e')][_0x76f4('0x3a')]){_0x10ddb4['where']=_[_0x76f4('0x3b')](_0x10ddb4[_0x76f4('0x38')],{'$or':_[_0x76f4('0x3c')](_0x1dea0e,function(_0x589637){if(_0x589637['type']!==_0x76f4('0x3d')){var _0x487926={};_0x487926[_0x589637[_0x76f4('0x27')]]={'$like':'%'+_0x5346be['query'][_0x76f4('0x3a')]+'%'};return _0x487926;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3e')]);var _0x378675={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x378675)[_0x76f4('0x23')](function(_0x16779e){_0x41dea4[_0x76f4('0x1c')]=_0x16779e;if(_0x5346be['query']['includeAll']){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x2b7dc8){_0x41dea4[_0x76f4('0x41')]=_0x2b7dc8;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))[_0x76f4('0x42')](handleError(_0x5b3f07,null));};exports[_0x76f4('0x43')]=function(_0x5b667b,_0xbc3d7e){var _0xe744af={'raw':!![],'where':{'id':_0x5b667b['params']['id']}},_0x4f0d1a={};_0x4f0d1a[_0x76f4('0x2d')]=_[_0x76f4('0x2f')](db[_0x76f4('0x29')][_0x76f4('0x44')]);_0x4f0d1a[_0x76f4('0x2e')]=_['keys'](_0x5b667b[_0x76f4('0x2e')]);_0x4f0d1a[_0x76f4('0x30')]=_[_0x76f4('0x31')](_0x4f0d1a[_0x76f4('0x2d')],_0x4f0d1a[_0x76f4('0x2e')]);_0xe744af[_0x76f4('0x32')]=_['intersection'](_0x4f0d1a[_0x76f4('0x2d')],qs[_0x76f4('0x33')](_0x5b667b[_0x76f4('0x2e')]['fields']));_0xe744af['attributes']=_0xe744af[_0x76f4('0x32')][_0x76f4('0x45')]?_0xe744af[_0x76f4('0x32')]:_0x4f0d1a[_0x76f4('0x2d')];if(_0x5b667b[_0x76f4('0x2e')]['includeAll']){_0xe744af['include']=[{'all':!![]}];}_0xe744af=_[_0x76f4('0x3b')]({},_0xe744af,_0x5b667b['options']);return db[_0x76f4('0x29')][_0x76f4('0x46')](_0xe744af)['then'](handleEntityNotFound(_0xbc3d7e,null))['then'](respondWithResult(_0xbc3d7e,null))[_0x76f4('0x42')](handleError(_0xbc3d7e,null));};exports[_0x76f4('0x47')]=function(_0x3f35ce,_0x217d3a){return db['JscriptyAnswerReport'][_0x76f4('0x47')](_0x3f35ce[_0x76f4('0x48')],{})[_0x76f4('0x23')](respondWithResult(_0x217d3a,0xc9))['catch'](handleError(_0x217d3a,null));};exports[_0x76f4('0x22')]=function(_0x6bbcf2,_0x535eca){if(_0x6bbcf2['body']['id']){delete _0x6bbcf2[_0x76f4('0x48')]['id'];}return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x6bbcf2[_0x76f4('0x49')]['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x535eca,null))['then'](saveUpdates(_0x6bbcf2[_0x76f4('0x48')],null))['then'](respondWithResult(_0x535eca,null))[_0x76f4('0x42')](handleError(_0x535eca,null));};exports[_0x76f4('0x24')]=function(_0x270baf,_0x5e9a45){return db[_0x76f4('0x29')][_0x76f4('0x46')]({'where':{'id':_0x270baf['params']['id']}})[_0x76f4('0x23')](handleEntityNotFound(_0x5e9a45,null))[_0x76f4('0x23')](removeEntity(_0x5e9a45,null))[_0x76f4('0x42')](handleError(_0x5e9a45,null));};exports[_0x76f4('0x4a')]=function(_0x40ff20,_0x479c4b){return db[_0x76f4('0x29')]['describe']()[_0x76f4('0x23')](respondWithResult(_0x479c4b,null))[_0x76f4('0x42')](handleError(_0x479c4b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 541b9e9..30867df 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 _0x30f0=['util','../../config/logger','api','request-promise','path','../../config/environment','define','JscriptyAnswerReport'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x30f0,0x180));var _0x030f=function(_0x17cdba,_0x5ba020){_0x17cdba=_0x17cdba-0x0;var _0x5d8796=_0x30f0[_0x17cdba];return _0x5d8796;};'use strict';var _=require('lodash');var util=require(_0x030f('0x0'));var logger=require(_0x030f('0x1'))(_0x030f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x030f('0x3'));var fs=require('fs');var path=require(_0x030f('0x4'));var rimraf=require('rimraf');var config=require(_0x030f('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x4b48d8,_0x2754c3){return _0x4b48d8[_0x030f('0x6')](_0x030f('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a60=['JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','bluebird','path','exports','define'];(function(_0x484933,_0x38001a){var _0x5059d9=function(_0x3c659e){while(--_0x3c659e){_0x484933['push'](_0x484933['shift']());}};_0x5059d9(++_0x38001a);}(_0x3a60,0x192));var _0x03a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a60[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x03a6('0x0'));var util=require('util');var logger=require(_0x03a6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x03a6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x03a6('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module[_0x03a6('0x4')]=function(_0x26e7cb,_0x2ecae3){return _0x26e7cb[_0x03a6('0x5')](_0x03a6('0x6'),attributes,{'tableName':_0x03a6('0x7'),'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 a4c16bb..e7270dd 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 _0x514d=['error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug'];(function(_0x1301aa,_0x4da5c4){var _0x5146a1=function(_0x417cd1){while(--_0x417cd1){_0x1301aa['push'](_0x1301aa['shift']());}};_0x5146a1(++_0x4da5c4);}(_0x514d,0xc9));var _0xd514=function(_0x5cce47,_0x52da88){_0x5cce47=_0x5cce47-0x0;var _0x27c6c3=_0x514d[_0x5cce47];return _0x27c6c3;};'use strict';var _=require(_0xd514('0x0'));var util=require('util');var moment=require(_0xd514('0x1'));var BPromise=require('bluebird');var rs=require(_0xd514('0x2'));var fs=require('fs');var Redis=require(_0xd514('0x3'));var db=require(_0xd514('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd514('0x5'))('rpc');var config=require(_0xd514('0x6'));var jayson=require(_0xd514('0x7'));var client=jayson[_0xd514('0x8')][_0xd514('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dc2f3,_0x331b42,_0x5e5118){return new BPromise(function(_0x30e592,_0x251923){return client[_0xd514('0xa')](_0x5dc2f3,_0x5e5118)[_0xd514('0xb')](function(_0x178b2a){logger[_0xd514('0xc')](_0xd514('0xd'),_0x331b42,'request\x20sent');logger[_0xd514('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x331b42,'request\x20sent',JSON['stringify'](_0x178b2a));if(_0x178b2a[_0xd514('0xf')]){if(_0x178b2a['error']['code']===0x1f4){logger['error'](_0xd514('0xd'),_0x331b42,_0x178b2a[_0xd514('0xf')][_0xd514('0x10')]);return _0x251923(_0x178b2a[_0xd514('0xf')][_0xd514('0x10')]);}logger[_0xd514('0xf')](_0xd514('0xd'),_0x331b42,_0x178b2a[_0xd514('0xf')][_0xd514('0x10')]);return _0x30e592(_0x178b2a[_0xd514('0xf')][_0xd514('0x10')]);}else{logger[_0xd514('0xc')](_0xd514('0xd'),_0x331b42,'request\x20sent');_0x30e592(_0x178b2a[_0xd514('0x11')][_0xd514('0x10')]);}})['catch'](function(_0xe74d59){logger[_0xd514('0xf')](_0xd514('0xd'),_0x331b42,_0xe74d59);_0x251923(_0xe74d59);});});} \ No newline at end of file +var _0x7e04=['code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x392991,_0x1f7ce9){var _0x3f9b68=function(_0x161044){while(--_0x161044){_0x392991['push'](_0x392991['shift']());}};_0x3f9b68(++_0x1f7ce9);}(_0x7e04,0xd6));var _0x47e0=function(_0x3a3baf,_0x2bd37c){_0x3a3baf=_0x3a3baf-0x0;var _0x5266bf=_0x7e04[_0x3a3baf];return _0x5266bf;};'use strict';var _=require(_0x47e0('0x0'));var util=require(_0x47e0('0x1'));var moment=require(_0x47e0('0x2'));var BPromise=require('bluebird');var rs=require(_0x47e0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x47e0('0x4'));var logger=require(_0x47e0('0x5'))('rpc');var config=require(_0x47e0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x47e0('0x7')][_0x47e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbcdc9c,_0x4c19a5,_0x5acee7){return new BPromise(function(_0x18f831,_0x2ac307){return client[_0x47e0('0x9')](_0xbcdc9c,_0x5acee7)['then'](function(_0x4d2e59){logger[_0x47e0('0xa')](_0x47e0('0xb'),_0x4c19a5,_0x47e0('0xc'));logger[_0x47e0('0xd')](_0x47e0('0xe'),_0x4c19a5,_0x47e0('0xc'),JSON[_0x47e0('0xf')](_0x4d2e59));if(_0x4d2e59['error']){if(_0x4d2e59[_0x47e0('0x10')][_0x47e0('0x11')]===0x1f4){logger[_0x47e0('0x10')](_0x47e0('0xb'),_0x4c19a5,_0x4d2e59['error'][_0x47e0('0x12')]);return _0x2ac307(_0x4d2e59[_0x47e0('0x10')][_0x47e0('0x12')]);}logger['error'](_0x47e0('0xb'),_0x4c19a5,_0x4d2e59[_0x47e0('0x10')][_0x47e0('0x12')]);return _0x18f831(_0x4d2e59[_0x47e0('0x10')][_0x47e0('0x12')]);}else{logger['info'](_0x47e0('0xb'),_0x4c19a5,'request\x20sent');_0x18f831(_0x4d2e59[_0x47e0('0x13')][_0x47e0('0x12')]);}})[_0x47e0('0x14')](function(_0x194854){logger[_0x47e0('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4c19a5,_0x194854);_0x2ac307(_0x194854);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index c9012bc..ce66592 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 _0xc78c=['getSessions','/:id/answers','getAnswers','30s','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','/:id','get','/:id/sessions'];(function(_0x2deac4,_0xc27a2b){var _0x1c0bda=function(_0x1deceb){while(--_0x1deceb){_0x2deac4['push'](_0x2deac4['shift']());}};_0x1c0bda(++_0xc27a2b);}(_0xc78c,0x180));var _0xcc78=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc78c[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xcc78('0x0'));var util=require(_0xcc78('0x1'));var path=require(_0xcc78('0x2'));var timeout=require(_0xcc78('0x3'));var express=require(_0xcc78('0x4'));var router=express[_0xcc78('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcc78('0x6'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xcc78('0x7')](),controller[_0xcc78('0x8')]);router['get'](_0xcc78('0x9'),auth[_0xcc78('0x7')](),controller['show']);router[_0xcc78('0xa')](_0xcc78('0xb'),auth[_0xcc78('0x7')](),controller[_0xcc78('0xc')]);router[_0xcc78('0xa')](_0xcc78('0xd'),auth[_0xcc78('0x7')](),controller[_0xcc78('0xe')]);router[_0xcc78('0xa')]('/:id/summary',auth[_0xcc78('0x7')](),timeout(_0xcc78('0xf')),controller['getSummary']);router[_0xcc78('0x10')]('/',auth[_0xcc78('0x7')](),controller[_0xcc78('0x11')]);router[_0xcc78('0x10')]('/:id/clone',auth[_0xcc78('0x7')](),controller['clone']);router[_0xcc78('0x12')](_0xcc78('0x9'),auth[_0xcc78('0x7')](),controller[_0xcc78('0x13')]);router[_0xcc78('0x14')](_0xcc78('0x9'),auth['isAuthenticated'](),controller[_0xcc78('0x15')]);module['exports']=router; \ No newline at end of file +var _0xecb8=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','put'];(function(_0x28997c,_0x1a8c0e){var _0x60f804=function(_0x1a8075){while(--_0x1a8075){_0x28997c['push'](_0x28997c['shift']());}};_0x60f804(++_0x1a8c0e);}(_0xecb8,0x1dd));var _0x8ecb=function(_0x4f37c9,_0x5ac4a3){_0x4f37c9=_0x4f37c9-0x0;var _0x11513b=_0xecb8[_0x4f37c9];return _0x11513b;};'use strict';var multer=require(_0x8ecb('0x0'));var util=require(_0x8ecb('0x1'));var path=require(_0x8ecb('0x2'));var timeout=require(_0x8ecb('0x3'));var express=require(_0x8ecb('0x4'));var router=express[_0x8ecb('0x5')]();var fs_extra=require(_0x8ecb('0x6'));var auth=require(_0x8ecb('0x7'));var interaction=require(_0x8ecb('0x8'));var config=require(_0x8ecb('0x9'));var controller=require('./jscriptyProject.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8ecb('0xa')]);router[_0x8ecb('0xb')](_0x8ecb('0xc'),auth[_0x8ecb('0xd')](),controller['show']);router['get'](_0x8ecb('0xe'),auth[_0x8ecb('0xd')](),controller[_0x8ecb('0xf')]);router[_0x8ecb('0xb')](_0x8ecb('0x10'),auth['isAuthenticated'](),controller[_0x8ecb('0x11')]);router[_0x8ecb('0xb')]('/:id/summary',auth[_0x8ecb('0xd')](),timeout(_0x8ecb('0x12')),controller[_0x8ecb('0x13')]);router[_0x8ecb('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8ecb('0x15'),auth[_0x8ecb('0xd')](),controller['clone']);router[_0x8ecb('0x16')](_0x8ecb('0xc'),auth[_0x8ecb('0xd')](),controller['update']);router[_0x8ecb('0x17')](_0x8ecb('0xc'),auth[_0x8ecb('0xd')](),controller['destroy']);module[_0x8ecb('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e442241..a008c03 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 _0x2e5b=['getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x574607,_0x19cafa){var _0x4547bf=function(_0x9a338d){while(--_0x9a338d){_0x574607['push'](_0x574607['shift']());}};_0x4547bf(++_0x19cafa);}(_0x2e5b,0x1f4));var _0xb2e5=function(_0xf91dd6,_0x48b78b){_0xf91dd6=_0xf91dd6-0x0;var _0x314e8a=_0x2e5b[_0xf91dd6];return _0x314e8a;};'use strict';var Sequelize=require(_0xb2e5('0x0'));var _=require(_0xb2e5('0x1'));var util=require(_0xb2e5('0x2'));module[_0xb2e5('0x3')]={'name':{'type':Sequelize[_0xb2e5('0x4')],'unique':'name'},'description':{'type':Sequelize[_0xb2e5('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xb2e5('0x5')),'set':function(_0x56e1f8){if(_[_0xb2e5('0x6')](_0x56e1f8)){this[_0xb2e5('0x7')](_0xb2e5('0x8'),JSON[_0xb2e5('0x9')](_0x56e1f8));}else if(_['isString'](_0x56e1f8)){this['setDataValue'](_0xb2e5('0x8'),_0x56e1f8);}else{this[_0xb2e5('0x7')](_0xb2e5('0x8'),util[_0xb2e5('0xa')](_0xb2e5('0xb'),this[_0xb2e5('0xc')](_0xb2e5('0xd'))||'',this[_0xb2e5('0xc')](_0xb2e5('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb2e5('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x4bfd=['formData','getDataValue','BOOLEAN','util','exports','name','TEXT','long','setDataValue','stringify'];(function(_0x70812d,_0x5c1495){var _0x4e5c35=function(_0x55521c){while(--_0x55521c){_0x70812d['push'](_0x70812d['shift']());}};_0x4e5c35(++_0x5c1495);}(_0x4bfd,0x99));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xd4bf('0x0'));module[_0xd4bf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd4bf('0x2')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xd4bf('0x3')](_0xd4bf('0x4')),'set':function(_0x9d524c){if(_['isObjectLike'](_0x9d524c)){this[_0xd4bf('0x5')]('formData',JSON[_0xd4bf('0x6')](_0x9d524c));}else if(_['isString'](_0x9d524c)){this[_0xd4bf('0x5')](_0xd4bf('0x7'),_0x9d524c);}else{this['setDataValue'](_0xd4bf('0x7'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xd4bf('0x2'))||'',this[_0xd4bf('0x8')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd4bf('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e4ba3d3..f546f88 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 _0xa486=['-createdAt','question','format','SessionId','questionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','then','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','Projects','autoAssociation','params','destroy','getSessions','JscriptySessionReport','ProjectId','getAnswers','findOne','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport'];(function(_0x4fd456,_0x2467c4){var _0xeeb5cf=function(_0x375954){while(--_0x375954){_0x4fd456['push'](_0x4fd456['shift']());}};_0xeeb5cf(++_0x2467c4);}(_0xa486,0x17d));var _0x6a48=function(_0x3bc661,_0xb034){_0x3bc661=_0x3bc661-0x0;var _0xb69fe5=_0xa486[_0x3bc661];return _0xb69fe5;};'use strict';var emlformat=require(_0x6a48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6a48('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a48('0x2'));var moment=require('moment');var BPromise=require(_0x6a48('0x3'));var Mustache=require(_0x6a48('0x4'));var util=require(_0x6a48('0x5'));var path=require(_0x6a48('0x6'));var sox=require(_0x6a48('0x7'));var csv=require(_0x6a48('0x8'));var ejs=require(_0x6a48('0x9'));var fs=require('fs');var fs_extra=require(_0x6a48('0xa'));var _=require(_0x6a48('0xb'));var squel=require(_0x6a48('0xc'));var crypto=require(_0x6a48('0xd'));var jsforce=require(_0x6a48('0xe'));var deskjs=require(_0x6a48('0xf'));var toCsv=require(_0x6a48('0x8'));var querystring=require(_0x6a48('0x10'));var Papa=require(_0x6a48('0x11'));var Redis=require('ioredis');var authService=require(_0x6a48('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6a48('0x13'));var hardwareService=require(_0x6a48('0x14'));var logger=require(_0x6a48('0x15'))(_0x6a48('0x16'));var utils=require(_0x6a48('0x17'));var config=require(_0x6a48('0x18'));var licenseUtil=require(_0x6a48('0x19'));var db=require(_0x6a48('0x1a'))['db'];function respondWithStatusCode(_0x3f099a,_0x3c5ef9){_0x3c5ef9=_0x3c5ef9||0xcc;return function(_0x1ef5c7){if(_0x1ef5c7){return _0x3f099a[_0x6a48('0x1b')](_0x3c5ef9);}return _0x3f099a[_0x6a48('0x1c')](_0x3c5ef9)[_0x6a48('0x1d')]();};}function respondWithResult(_0x4636e5,_0x9909af){_0x9909af=_0x9909af||0xc8;return function(_0xcbcb4b){if(_0xcbcb4b){return _0x4636e5[_0x6a48('0x1c')](_0x9909af)[_0x6a48('0x1e')](_0xcbcb4b);}};}function respondWithFilteredResult(_0x43f5fa,_0x3315c1){return function(_0x10867e){if(_0x10867e){var _0x231930=typeof _0x3315c1[_0x6a48('0x1f')]===_0x6a48('0x20')&&typeof _0x3315c1[_0x6a48('0x21')]===_0x6a48('0x20');var _0x20cab5=_0x10867e['count'];var _0xab0913=_0x231930?0x0:_0x3315c1[_0x6a48('0x1f')];var _0x152280=_0x231930?_0x10867e[_0x6a48('0x22')]:_0x3315c1['offset']+_0x3315c1[_0x6a48('0x21')];var _0x43a80d;if(_0x152280>=_0x20cab5){_0x152280=_0x20cab5;_0x43a80d=0xc8;}else{_0x43a80d=0xce;}_0x43f5fa[_0x6a48('0x1c')](_0x43a80d);return _0x43f5fa['set'](_0x6a48('0x23'),_0xab0913+'-'+_0x152280+'/'+_0x20cab5)[_0x6a48('0x1e')](_0x10867e);}return null;};}function patchUpdates(_0x426272){return function(_0x56fc96){try{jsonpatch[_0x6a48('0x24')](_0x56fc96,_0x426272,!![]);}catch(_0x24c549){return BPromise[_0x6a48('0x25')](_0x24c549);}return _0x56fc96[_0x6a48('0x26')]();};}function saveUpdates(_0x4ee111,_0x1afaf3){return function(_0x230220){if(_0x230220){return _0x230220['update'](_0x4ee111)['then'](function(_0x11b488){return _0x11b488;});}return null;};}function removeEntity(_0x31ed88,_0x4cb5d0){return function(_0x2eae9f){if(_0x2eae9f){return _0x2eae9f['destroy']()['then'](function(){var _0x4f38a2=_0x2eae9f['get']({'plain':!![]});var _0x2a14d5='Projects';return db[_0x6a48('0x27')]['destroy']({'where':{'type':_0x2a14d5,'resourceId':_0x4f38a2['id']}})['then'](function(){return _0x2eae9f;});})['then'](function(){_0x31ed88['status'](0xcc)[_0x6a48('0x1d')]();});}};}function handleEntityNotFound(_0x29cfd2,_0x2cb60e){return function(_0x20ecb0){if(!_0x20ecb0){_0x29cfd2['sendStatus'](0x194);}return _0x20ecb0;};}function handleError(_0x370bfe,_0x23cbf5){_0x23cbf5=_0x23cbf5||0x1f4;return function(_0xf450b){logger[_0x6a48('0x28')](_0xf450b['stack']);if(_0xf450b['name']){delete _0xf450b[_0x6a48('0x29')];}_0x370bfe[_0x6a48('0x1c')](_0x23cbf5)[_0x6a48('0x2a')](_0xf450b);};}exports[_0x6a48('0x2b')]=function(_0x437622,_0x5b01a4){var _0x16982f={},_0x5c8e3e={},_0x50e0e8={'count':0x0,'rows':[]};var _0x12ba71=_[_0x6a48('0x2c')](db[_0x6a48('0x2d')][_0x6a48('0x2e')],function(_0x24aa89){return{'name':_0x24aa89[_0x6a48('0x2f')],'type':_0x24aa89[_0x6a48('0x30')][_0x6a48('0x31')]};});_0x5c8e3e[_0x6a48('0x32')]=_[_0x6a48('0x2c')](_0x12ba71,_0x6a48('0x29'));_0x5c8e3e[_0x6a48('0x33')]=_['keys'](_0x437622[_0x6a48('0x33')]);_0x5c8e3e[_0x6a48('0x34')]=_[_0x6a48('0x35')](_0x5c8e3e['model'],_0x5c8e3e[_0x6a48('0x33')]);_0x16982f['attributes']=_[_0x6a48('0x35')](_0x5c8e3e['model'],qs[_0x6a48('0x36')](_0x437622[_0x6a48('0x33')][_0x6a48('0x36')]));_0x16982f['attributes']=_0x16982f[_0x6a48('0x37')][_0x6a48('0x38')]?_0x16982f['attributes']:_0x5c8e3e['model'];if(!_0x437622[_0x6a48('0x33')][_0x6a48('0x39')](_0x6a48('0x3a'))){_0x16982f[_0x6a48('0x21')]=qs[_0x6a48('0x21')](_0x437622[_0x6a48('0x33')][_0x6a48('0x21')]);_0x16982f[_0x6a48('0x1f')]=qs['offset'](_0x437622[_0x6a48('0x33')][_0x6a48('0x1f')]);}_0x16982f[_0x6a48('0x3b')]=qs[_0x6a48('0x3c')](_0x437622[_0x6a48('0x33')][_0x6a48('0x3c')]);_0x16982f[_0x6a48('0x3d')]=qs[_0x6a48('0x34')](_[_0x6a48('0x3e')](_0x437622[_0x6a48('0x33')],_0x5c8e3e[_0x6a48('0x34')]),_0x12ba71);if(_0x437622[_0x6a48('0x33')][_0x6a48('0x3f')]){_0x16982f[_0x6a48('0x3d')]=_['merge'](_0x16982f[_0x6a48('0x3d')],{'$or':_[_0x6a48('0x2c')](_0x12ba71,function(_0x57cf0b){if(_0x57cf0b[_0x6a48('0x30')]!==_0x6a48('0x40')){var _0x5b27e9={};_0x5b27e9[_0x57cf0b[_0x6a48('0x29')]]={'$like':'%'+_0x437622['query'][_0x6a48('0x3f')]+'%'};return _0x5b27e9;}})});}_0x16982f=_[_0x6a48('0x41')]({},_0x16982f,_0x437622[_0x6a48('0x42')]);var _0x93aeaf={'where':_0x16982f[_0x6a48('0x3d')]};return db[_0x6a48('0x2d')][_0x6a48('0x22')](_0x93aeaf)['then'](function(_0x5cbb47){_0x50e0e8[_0x6a48('0x22')]=_0x5cbb47;if(_0x437622[_0x6a48('0x33')]['includeAll']){_0x16982f[_0x6a48('0x43')]=[{'all':!![]}];}return db[_0x6a48('0x2d')]['findAll'](_0x16982f);})[_0x6a48('0x44')](function(_0x2abea4){_0x50e0e8[_0x6a48('0x45')]=_0x2abea4;return _0x50e0e8;})[_0x6a48('0x44')](respondWithFilteredResult(_0x5b01a4,_0x16982f))[_0x6a48('0x46')](handleError(_0x5b01a4,null));};exports['show']=function(_0x367701,_0x553dd5){var _0x5d1603={'raw':![],'where':{'id':_0x367701['params']['id']}},_0x1af9e8={};_0x1af9e8[_0x6a48('0x32')]=_['keys'](db[_0x6a48('0x2d')][_0x6a48('0x2e')]);_0x1af9e8[_0x6a48('0x33')]=_['keys'](_0x367701[_0x6a48('0x33')]);_0x1af9e8['filters']=_['intersection'](_0x1af9e8['model'],_0x1af9e8[_0x6a48('0x33')]);_0x5d1603['attributes']=_[_0x6a48('0x35')](_0x1af9e8[_0x6a48('0x32')],qs[_0x6a48('0x36')](_0x367701[_0x6a48('0x33')]['fields']));_0x5d1603[_0x6a48('0x37')]=_0x5d1603['attributes'][_0x6a48('0x38')]?_0x5d1603[_0x6a48('0x37')]:_0x1af9e8['model'];if(_0x367701['query'][_0x6a48('0x47')]){_0x5d1603[_0x6a48('0x43')]=[{'all':!![]}];}_0x5d1603=_['merge']({},_0x5d1603,_0x367701[_0x6a48('0x42')]);return db[_0x6a48('0x2d')][_0x6a48('0x48')](_0x5d1603)[_0x6a48('0x44')](handleEntityNotFound(_0x553dd5,null))[_0x6a48('0x44')](respondWithResult(_0x553dd5,null))[_0x6a48('0x46')](handleError(_0x553dd5,null));};exports[_0x6a48('0x49')]=function(_0x4b3cc1,_0x3227db){return db[_0x6a48('0x2d')]['create'](_0x4b3cc1[_0x6a48('0x4a')],{})[_0x6a48('0x44')](function(_0x46d9cb){var _0x3742f9=_0x4b3cc1[_0x6a48('0x4b')]['get']({'plain':!![]});if(!_0x3742f9)throw new Error(_0x6a48('0x4c'));if(_0x3742f9[_0x6a48('0x4d')]===_0x6a48('0x4b')){var _0xc66694=_0x46d9cb[_0x6a48('0x4e')]({'plain':!![]});var _0x56cddc='Projects';return db[_0x6a48('0x4f')][_0x6a48('0x48')]({'where':{'name':_0x56cddc,'userProfileId':_0x3742f9[_0x6a48('0x50')]},'raw':!![]})['then'](function(_0x62856f){if(_0x62856f&&_0x62856f['autoAssociation']===0x0){return db[_0x6a48('0x27')][_0x6a48('0x49')]({'name':_0xc66694['name'],'resourceId':_0xc66694['id'],'type':_0x62856f[_0x6a48('0x29')],'sectionId':_0x62856f['id']},{})[_0x6a48('0x44')](function(){return _0x46d9cb;});}else{return _0x46d9cb;}})[_0x6a48('0x46')](function(_0x2cfd79){logger[_0x6a48('0x28')](_0x6a48('0x51'),_0x2cfd79);throw _0x2cfd79;});}return _0x46d9cb;})[_0x6a48('0x44')](respondWithResult(_0x3227db,0xc9))['catch'](handleError(_0x3227db,null));};exports[_0x6a48('0x52')]=function(_0xd5f9ac,_0x58538b){var _0x5751ce={'where':{'id':_0xd5f9ac['params']['id']}},_0x4b1bf0={};_0x4b1bf0['model']=_[_0x6a48('0x53')](db['JscriptyProject'][_0x6a48('0x2e')]);_0x5751ce[_0x6a48('0x37')]=_[_0x6a48('0x35')](_0x4b1bf0['model'],qs[_0x6a48('0x36')](_0xd5f9ac[_0x6a48('0x33')][_0x6a48('0x36')]));_0x5751ce[_0x6a48('0x37')]=_0x5751ce[_0x6a48('0x37')][_0x6a48('0x38')]?_0x5751ce['attributes']:_0x4b1bf0[_0x6a48('0x32')];if(_0xd5f9ac[_0x6a48('0x33')][_0x6a48('0x47')]){_0x5751ce['include']=[{'all':!![]}];}_0x5751ce=_[_0x6a48('0x41')]({},_0x5751ce,_0xd5f9ac['options']);return db['JscriptyProject'][_0x6a48('0x48')](_0x5751ce)[_0x6a48('0x44')](handleEntityNotFound(_0x58538b,null))[_0x6a48('0x44')](function(_0x492174){if(_0x492174){var _0x4ca7c4=_0x492174[_0x6a48('0x4e')]({'plain':!![]});_0x4ca7c4=qs[_0x6a48('0x54')](_0x4ca7c4,['id',_0x6a48('0x55'),'updatedAt']);_0xd5f9ac[_0x6a48('0x4a')]=_[_0x6a48('0x54')](_0xd5f9ac['body'],['id',_0x6a48('0x55'),'updatedAt']);return db[_0x6a48('0x2d')][_0x6a48('0x49')](_[_0x6a48('0x41')](_0x4ca7c4,_0xd5f9ac[_0x6a48('0x4a')]),{'include':_0xd5f9ac[_0x6a48('0x33')][_0x6a48('0x47')]?[{'all':!![]}]:undefined})[_0x6a48('0x44')](function(_0x517603){var _0xcede73=_0xd5f9ac[_0x6a48('0x4b')][_0x6a48('0x4e')]({'plain':!![]});if(!_0xcede73)throw new Error(_0x6a48('0x4c'));if(_0xcede73[_0x6a48('0x4d')]===_0x6a48('0x4b')){var _0x37a6d3=_0x517603[_0x6a48('0x4e')]({'plain':!![]});var _0x232456=_0x6a48('0x56');return db[_0x6a48('0x4f')]['find']({'where':{'name':_0x232456,'userProfileId':_0xcede73[_0x6a48('0x50')]},'raw':!![]})[_0x6a48('0x44')](function(_0x27e689){if(_0x27e689&&_0x27e689[_0x6a48('0x57')]===0x0){return db[_0x6a48('0x27')][_0x6a48('0x49')]({'name':_0x37a6d3['name'],'resourceId':_0x37a6d3['id'],'type':_0x27e689['name'],'sectionId':_0x27e689['id']},{})['then'](function(){return _0x517603;});}else{return _0x517603;}})[_0x6a48('0x46')](function(_0x108042){logger[_0x6a48('0x28')](_0x6a48('0x51'),_0x108042);throw _0x108042;});}return _0x517603;});}})['then'](respondWithResult(_0x58538b,0xc9))[_0x6a48('0x46')](handleError(_0x58538b,null));};exports['update']=function(_0x17b6f0,_0x4231ce){if(_0x17b6f0[_0x6a48('0x4a')]['id']){delete _0x17b6f0[_0x6a48('0x4a')]['id'];}return db['JscriptyProject'][_0x6a48('0x48')]({'where':{'id':_0x17b6f0[_0x6a48('0x58')]['id']}})[_0x6a48('0x44')](handleEntityNotFound(_0x4231ce,null))[_0x6a48('0x44')](saveUpdates(_0x17b6f0[_0x6a48('0x4a')],null))[_0x6a48('0x44')](respondWithResult(_0x4231ce,null))[_0x6a48('0x46')](handleError(_0x4231ce,null));};exports[_0x6a48('0x59')]=function(_0x205d53,_0x36c8f0){return db[_0x6a48('0x2d')][_0x6a48('0x48')]({'where':{'id':_0x205d53[_0x6a48('0x58')]['id']}})[_0x6a48('0x44')](handleEntityNotFound(_0x36c8f0,null))[_0x6a48('0x44')](removeEntity(_0x36c8f0,null))[_0x6a48('0x46')](handleError(_0x36c8f0,null));};exports[_0x6a48('0x5a')]=function(_0x52454c,_0x14077a,_0x12a200){var _0x36b8ad={'raw':!![],'where':{}};var _0x1c5cdb={};var _0x17ea8a={'count':0x0,'rows':[]};return db[_0x6a48('0x2d')]['findOne']({'where':{'id':_0x52454c[_0x6a48('0x58')]['id']}})['then'](handleEntityNotFound(_0x14077a,null))[_0x6a48('0x44')](function(_0x14b281){if(_0x14b281){_0x1c5cdb['model']=_[_0x6a48('0x53')](db[_0x6a48('0x5b')]['rawAttributes']);_0x1c5cdb[_0x6a48('0x33')]=_['keys'](_0x52454c[_0x6a48('0x33')]);_0x1c5cdb['filters']=_[_0x6a48('0x35')](_0x1c5cdb[_0x6a48('0x32')],_0x1c5cdb[_0x6a48('0x33')]);_0x36b8ad['attributes']=_[_0x6a48('0x35')](_0x1c5cdb[_0x6a48('0x32')],qs['fields'](_0x52454c['query'][_0x6a48('0x36')]));_0x36b8ad['attributes']=_0x36b8ad['attributes']['length']?_0x36b8ad[_0x6a48('0x37')]:_0x1c5cdb[_0x6a48('0x32')];if(!_0x52454c[_0x6a48('0x33')][_0x6a48('0x39')](_0x6a48('0x3a'))){_0x36b8ad['limit']=qs[_0x6a48('0x21')](_0x52454c[_0x6a48('0x33')][_0x6a48('0x21')]);_0x36b8ad[_0x6a48('0x1f')]=qs[_0x6a48('0x1f')](_0x52454c[_0x6a48('0x33')][_0x6a48('0x1f')]);}_0x36b8ad[_0x6a48('0x3b')]=qs[_0x6a48('0x3c')](_0x52454c['query'][_0x6a48('0x3c')]);_0x36b8ad[_0x6a48('0x3d')]=qs[_0x6a48('0x34')](_[_0x6a48('0x3e')](_0x52454c['query'],_0x1c5cdb[_0x6a48('0x34')]));_0x36b8ad[_0x6a48('0x3d')][_0x6a48('0x5c')]=_0x14b281['id'];if(_0x52454c[_0x6a48('0x33')]['filter']){_0x36b8ad[_0x6a48('0x3d')]=_['merge'](_0x36b8ad[_0x6a48('0x3d')],{'$or':_[_0x6a48('0x2c')](_0x36b8ad['attributes'],function(_0x13a727){var _0x2524d6={};_0x2524d6[_0x13a727]={'$like':'%'+_0x52454c[_0x6a48('0x33')]['filter']+'%'};return _0x2524d6;})});}_0x36b8ad=_[_0x6a48('0x41')]({},_0x36b8ad,_0x52454c[_0x6a48('0x42')]);return db[_0x6a48('0x5b')][_0x6a48('0x22')]({'where':_0x36b8ad[_0x6a48('0x3d')]})[_0x6a48('0x44')](function(_0x2a86ea){_0x17ea8a[_0x6a48('0x22')]=_0x2a86ea;if(_0x52454c[_0x6a48('0x33')]['includeAll']){_0x36b8ad[_0x6a48('0x43')]=[{'all':!![]}];}return db[_0x6a48('0x5b')]['findAll'](_0x36b8ad);})[_0x6a48('0x44')](function(_0x4d7969){_0x17ea8a[_0x6a48('0x45')]=_0x4d7969;return _0x17ea8a;});}})[_0x6a48('0x44')](respondWithFilteredResult(_0x14077a,_0x36b8ad))[_0x6a48('0x46')](handleError(_0x14077a,null));};exports[_0x6a48('0x5d')]=function(_0x6a8675,_0x19c999,_0x4429fb){var _0x72c8e6={'raw':!![],'where':{}};var _0x3f5b63={};var _0x18580e={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x6a48('0x5e')]({'where':{'id':_0x6a8675[_0x6a48('0x58')]['id']}})[_0x6a48('0x44')](handleEntityNotFound(_0x19c999,null))[_0x6a48('0x44')](function(_0x3557f9){if(_0x3557f9){_0x3f5b63[_0x6a48('0x32')]=_[_0x6a48('0x53')](db['JscriptyAnswerReport']['rawAttributes']);_0x3f5b63[_0x6a48('0x33')]=_[_0x6a48('0x53')](_0x6a8675['query']);_0x3f5b63['filters']=_[_0x6a48('0x35')](_0x3f5b63[_0x6a48('0x32')],_0x3f5b63[_0x6a48('0x33')]);_0x72c8e6[_0x6a48('0x37')]=_[_0x6a48('0x35')](_0x3f5b63['model'],qs[_0x6a48('0x36')](_0x6a8675['query'][_0x6a48('0x36')]));_0x72c8e6[_0x6a48('0x37')]=_0x72c8e6[_0x6a48('0x37')][_0x6a48('0x38')]?_0x72c8e6[_0x6a48('0x37')]:_0x3f5b63[_0x6a48('0x32')];if(!_0x6a8675[_0x6a48('0x33')][_0x6a48('0x39')](_0x6a48('0x3a'))){_0x72c8e6[_0x6a48('0x21')]=qs[_0x6a48('0x21')](_0x6a8675['query'][_0x6a48('0x21')]);_0x72c8e6[_0x6a48('0x1f')]=qs[_0x6a48('0x1f')](_0x6a8675[_0x6a48('0x33')][_0x6a48('0x1f')]);}_0x72c8e6['order']=qs['sort'](_0x6a8675[_0x6a48('0x33')]['sort']);_0x72c8e6[_0x6a48('0x3d')]=qs[_0x6a48('0x34')](_[_0x6a48('0x3e')](_0x6a8675[_0x6a48('0x33')],_0x3f5b63[_0x6a48('0x34')]));_0x72c8e6['where']['ProjectId']=_0x3557f9['id'];if(_0x6a8675[_0x6a48('0x33')]['filter']){_0x72c8e6[_0x6a48('0x3d')]=_['merge'](_0x72c8e6[_0x6a48('0x3d')],{'$or':_[_0x6a48('0x2c')](_0x72c8e6[_0x6a48('0x37')],function(_0x208bae){var _0x5ce0e3={};_0x5ce0e3[_0x208bae]={'$like':'%'+_0x6a8675[_0x6a48('0x33')][_0x6a48('0x3f')]+'%'};return _0x5ce0e3;})});}_0x72c8e6=_[_0x6a48('0x41')]({},_0x72c8e6,_0x6a8675['options']);return db[_0x6a48('0x5f')][_0x6a48('0x22')]({'where':_0x72c8e6['where']})['then'](function(_0x1f5b67){_0x18580e[_0x6a48('0x22')]=_0x1f5b67;if(_0x6a8675['query']['includeAll']){_0x72c8e6[_0x6a48('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6a48('0x60')](_0x72c8e6);})[_0x6a48('0x44')](function(_0x3a5f9c){_0x18580e[_0x6a48('0x45')]=_0x3a5f9c;return _0x18580e;});}})[_0x6a48('0x44')](respondWithFilteredResult(_0x19c999,_0x72c8e6))[_0x6a48('0x46')](handleError(_0x19c999,null));};function char(_0x9318e4){return _0x6a48('0x61')===typeof _0x9318e4?String[_0x6a48('0x62')]['apply'](null,arguments):_0x9318e4;}function needsEncapsulation(_0x593302){return!!_0x593302&&(_0x593302[_0x6a48('0x63')]()['indexOf'](char(0xd))>=0x0||_0x593302[_0x6a48('0x63')]()[_0x6a48('0x64')](char(0xa))>=0x0||_0x593302[_0x6a48('0x63')]()[_0x6a48('0x64')](char(0x2c))>=0x0||_0x593302[_0x6a48('0x63')]()[_0x6a48('0x64')](char(0x22))>=0x0);}function encapsulate(_0x3e1c26){var _0x46355c=char(0x22),_0x59a53f='\x5c'+char(0x22),_0x2d181a=_0x3e1c26[_0x6a48('0x63')]()[_0x6a48('0x65')](new RegExp(_0x46355c,'g'),_0x59a53f);return _0x46355c+_0x2d181a+_0x46355c;}exports[_0x6a48('0x66')]=function(_0x4e58f0,_0x2e80d9,_0x413e4c){var _0x829ab0,_0x3a46ab;var _0x1d11d4={'where':{'ProjectId':_0x4e58f0['params']['id']}};if(_0x4e58f0[_0x6a48('0x33')][_0x6a48('0x67')]){_0x1d11d4['where'][_0x6a48('0x68')]=JSON[_0x6a48('0x69')](_0x4e58f0[_0x6a48('0x33')][_0x6a48('0x67')]);}return db[_0x6a48('0x5b')][_0x6a48('0x60')](_0x1d11d4)[_0x6a48('0x44')](handleEntityNotFound(_0x2e80d9,null))['then'](function(_0x3ab8d9){if(_0x3ab8d9){_0x829ab0=_0x3ab8d9;return db[_0x6a48('0x6a')][_0x6a48('0x60')]({'where':{'SessionId':{'$in':_[_0x6a48('0x2c')](_0x829ab0,'id')},'ProjectId':_0x4e58f0['params']['id']},'order':_0x6a48('0x6b')});}})[_0x6a48('0x44')](handleEntityNotFound(_0x2e80d9,null))[_0x6a48('0x44')](function(_0x23174a){if(_0x23174a){_0x3a46ab=_0x23174a;var _0x513e5c={};for(var _0x4aeb71=0x0,_0x3acfd7=_0x3a46ab[_0x6a48('0x38')];_0x4aeb71<_0x3acfd7;_0x4aeb71++){if(!_0x513e5c[_0x6a48('0x39')](_0x3a46ab[_0x4aeb71]['questionId'])){_0x513e5c[_0x3a46ab[_0x4aeb71]['questionId']]=needsEncapsulation(_0x3a46ab[_0x4aeb71][_0x6a48('0x6c')])?encapsulate(_0x3a46ab[_0x4aeb71][_0x6a48('0x6c')]):_0x3a46ab[_0x4aeb71][_0x6a48('0x6c')];}}var _0x5b57f5=[],_0x330a5d={};for(var _0x495bcc=0x0,_0x330dec=_0x829ab0[_0x6a48('0x38')];_0x495bcc<_0x330dec;_0x495bcc++){_0x330a5d={'ProjectId':_0x4e58f0[_0x6a48('0x58')]['id'],'SessionId':_0x829ab0[_0x495bcc]['id'],'StartTime':moment(_0x829ab0[_0x495bcc]['starttime'])[_0x6a48('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5b0d79=0x0,_0x7046d4=_0x3a46ab['length'];_0x5b0d79<_0x7046d4;_0x5b0d79++){if(_0x3a46ab[_0x5b0d79][_0x6a48('0x6e')]==_0x829ab0[_0x495bcc]['id']&&_0x513e5c[_0x6a48('0x39')](_0x3a46ab[_0x5b0d79][_0x6a48('0x6f')])){_0x330a5d[_0x513e5c[_0x3a46ab[_0x5b0d79][_0x6a48('0x6f')]]]=_0x3a46ab[_0x5b0d79][_0x6a48('0x70')];}}for(var _0x731f1f in _0x513e5c){if(!_0x330a5d[_0x6a48('0x39')](_0x513e5c[_0x731f1f])){_0x330a5d[_0x513e5c[_0x731f1f]]=null;}}_0x5b57f5[_0x6a48('0x71')](_0x330a5d);}return _0x5b57f5;}})['then'](function(_0x5b0137){if(!_[_0x6a48('0x72')](_0x5b0137)){var _0x43db01=toCsv(_0x5b0137);var _0x20e901=Date['now']();fs[_0x6a48('0x73')](util[_0x6a48('0x6d')](_0x6a48('0x74'),_0x4e58f0[_0x6a48('0x58')]['id'],_0x20e901),_0x43db01);_0x2e80d9['setHeader']('Content-disposition',_0x6a48('0x75')+util['format'](_0x6a48('0x76'),_0x4e58f0[_0x6a48('0x58')]['id'],_0x20e901));_0x2e80d9[_0x6a48('0x77')](_0x6a48('0x78'),_0x6a48('0x79'));return _0x2e80d9['download'](util[_0x6a48('0x6d')](_0x6a48('0x74'),_0x4e58f0[_0x6a48('0x58')]['id'],_0x20e901));}else{return _0x2e80d9[_0x6a48('0x1b')](0xcc);}})['catch'](handleError(_0x2e80d9,null));}; \ No newline at end of file +var _0xa24a=['pick','merge','VIRTUAL','options','includeAll','include','rows','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','find','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','filter','findAll','getAnswers','JscriptyAnswerReport','ProjectId','fromCharCode','indexOf','toString','replace','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Projects','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x13fd59,_0x2e05b1){var _0x2e6ce7=function(_0x519a4b){while(--_0x519a4b){_0x13fd59['push'](_0x13fd59['shift']());}};_0x2e6ce7(++_0x2e05b1);}(_0xa24a,0x1a2));var _0xaa24=function(_0x4f0cf4,_0x18bac8){_0x4f0cf4=_0x4f0cf4-0x0;var _0x7c59a3=_0xa24a[_0x4f0cf4];return _0x7c59a3;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require(_0xaa24('0x4'));var moment=require(_0xaa24('0x5'));var BPromise=require(_0xaa24('0x6'));var Mustache=require(_0xaa24('0x7'));var util=require(_0xaa24('0x8'));var path=require(_0xaa24('0x9'));var sox=require('sox');var csv=require(_0xaa24('0xa'));var ejs=require(_0xaa24('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa24('0xc'));var squel=require(_0xaa24('0xd'));var crypto=require('crypto');var jsforce=require(_0xaa24('0xe'));var deskjs=require(_0xaa24('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaa24('0x10'));var Redis=require(_0xaa24('0x11'));var authService=require(_0xaa24('0x12'));var qs=require(_0xaa24('0x13'));var as=require(_0xaa24('0x14'));var hardwareService=require(_0xaa24('0x15'));var logger=require(_0xaa24('0x16'))(_0xaa24('0x17'));var utils=require(_0xaa24('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa24('0x19'))['db'];function respondWithStatusCode(_0x5ed529,_0x238bd2){_0x238bd2=_0x238bd2||0xcc;return function(_0x2c44ac){if(_0x2c44ac){return _0x5ed529[_0xaa24('0x1a')](_0x238bd2);}return _0x5ed529[_0xaa24('0x1b')](_0x238bd2)['end']();};}function respondWithResult(_0x32e5b9,_0x414379){_0x414379=_0x414379||0xc8;return function(_0x472f5f){if(_0x472f5f){return _0x32e5b9[_0xaa24('0x1b')](_0x414379)[_0xaa24('0x1c')](_0x472f5f);}};}function respondWithFilteredResult(_0x5099f1,_0x2db740){return function(_0x4adb32){if(_0x4adb32){var _0xe6baa0=typeof _0x2db740[_0xaa24('0x1d')]===_0xaa24('0x1e')&&typeof _0x2db740[_0xaa24('0x1f')]===_0xaa24('0x1e');var _0x3bb589=_0x4adb32['count'];var _0x2c2df2=_0xe6baa0?0x0:_0x2db740[_0xaa24('0x1d')];var _0x4e1712=_0xe6baa0?_0x4adb32[_0xaa24('0x20')]:_0x2db740[_0xaa24('0x1d')]+_0x2db740[_0xaa24('0x1f')];var _0x17b573;if(_0x4e1712>=_0x3bb589){_0x4e1712=_0x3bb589;_0x17b573=0xc8;}else{_0x17b573=0xce;}_0x5099f1[_0xaa24('0x1b')](_0x17b573);return _0x5099f1[_0xaa24('0x21')](_0xaa24('0x22'),_0x2c2df2+'-'+_0x4e1712+'/'+_0x3bb589)[_0xaa24('0x1c')](_0x4adb32);}return null;};}function patchUpdates(_0x181c7e){return function(_0xc34093){try{jsonpatch[_0xaa24('0x23')](_0xc34093,_0x181c7e,!![]);}catch(_0x3da691){return BPromise[_0xaa24('0x24')](_0x3da691);}return _0xc34093['save']();};}function saveUpdates(_0x3bdf56,_0x5bac34){return function(_0x17e4e9){if(_0x17e4e9){return _0x17e4e9[_0xaa24('0x25')](_0x3bdf56)[_0xaa24('0x26')](function(_0x3c0858){return _0x3c0858;});}return null;};}function removeEntity(_0x5eb3fb,_0x5447c0){return function(_0x4f90a8){if(_0x4f90a8){return _0x4f90a8[_0xaa24('0x27')]()[_0xaa24('0x26')](function(){var _0x2a3d2b=_0x4f90a8[_0xaa24('0x28')]({'plain':!![]});var _0x4e6742=_0xaa24('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e6742,'resourceId':_0x2a3d2b['id']}})[_0xaa24('0x26')](function(){return _0x4f90a8;});})['then'](function(){_0x5eb3fb[_0xaa24('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f85f9,_0xc7d404){return function(_0x53a3c9){if(!_0x53a3c9){_0x1f85f9[_0xaa24('0x1a')](0x194);}return _0x53a3c9;};}function handleError(_0x42a720,_0x45d8dc){_0x45d8dc=_0x45d8dc||0x1f4;return function(_0x40dbdd){logger[_0xaa24('0x2a')](_0x40dbdd[_0xaa24('0x2b')]);if(_0x40dbdd[_0xaa24('0x2c')]){delete _0x40dbdd['name'];}_0x42a720['status'](_0x45d8dc)[_0xaa24('0x2d')](_0x40dbdd);};}exports[_0xaa24('0x2e')]=function(_0x506d00,_0x3e9943){var _0x345b9b={},_0x59c675={},_0x22af48={'count':0x0,'rows':[]};var _0x183cd0=_[_0xaa24('0x2f')](db[_0xaa24('0x30')][_0xaa24('0x31')],function(_0x39a532){return{'name':_0x39a532[_0xaa24('0x32')],'type':_0x39a532[_0xaa24('0x33')][_0xaa24('0x34')]};});_0x59c675[_0xaa24('0x35')]=_[_0xaa24('0x2f')](_0x183cd0,'name');_0x59c675[_0xaa24('0x36')]=_[_0xaa24('0x37')](_0x506d00[_0xaa24('0x36')]);_0x59c675[_0xaa24('0x38')]=_[_0xaa24('0x39')](_0x59c675['model'],_0x59c675[_0xaa24('0x36')]);_0x345b9b['attributes']=_['intersection'](_0x59c675[_0xaa24('0x35')],qs[_0xaa24('0x3a')](_0x506d00['query'][_0xaa24('0x3a')]));_0x345b9b[_0xaa24('0x3b')]=_0x345b9b[_0xaa24('0x3b')][_0xaa24('0x3c')]?_0x345b9b[_0xaa24('0x3b')]:_0x59c675[_0xaa24('0x35')];if(!_0x506d00['query'][_0xaa24('0x3d')](_0xaa24('0x3e'))){_0x345b9b[_0xaa24('0x1f')]=qs[_0xaa24('0x1f')](_0x506d00['query'][_0xaa24('0x1f')]);_0x345b9b[_0xaa24('0x1d')]=qs[_0xaa24('0x1d')](_0x506d00[_0xaa24('0x36')][_0xaa24('0x1d')]);}_0x345b9b[_0xaa24('0x3f')]=qs['sort'](_0x506d00[_0xaa24('0x36')][_0xaa24('0x40')]);_0x345b9b[_0xaa24('0x41')]=qs[_0xaa24('0x38')](_[_0xaa24('0x42')](_0x506d00[_0xaa24('0x36')],_0x59c675[_0xaa24('0x38')]),_0x183cd0);if(_0x506d00[_0xaa24('0x36')]['filter']){_0x345b9b[_0xaa24('0x41')]=_[_0xaa24('0x43')](_0x345b9b[_0xaa24('0x41')],{'$or':_[_0xaa24('0x2f')](_0x183cd0,function(_0x551753){if(_0x551753[_0xaa24('0x33')]!==_0xaa24('0x44')){var _0x9d025a={};_0x9d025a[_0x551753[_0xaa24('0x2c')]]={'$like':'%'+_0x506d00[_0xaa24('0x36')]['filter']+'%'};return _0x9d025a;}})});}_0x345b9b=_[_0xaa24('0x43')]({},_0x345b9b,_0x506d00[_0xaa24('0x45')]);var _0xb9cd52={'where':_0x345b9b[_0xaa24('0x41')]};return db['JscriptyProject'][_0xaa24('0x20')](_0xb9cd52)[_0xaa24('0x26')](function(_0x30fc9a){_0x22af48[_0xaa24('0x20')]=_0x30fc9a;if(_0x506d00['query'][_0xaa24('0x46')]){_0x345b9b[_0xaa24('0x47')]=[{'all':!![]}];}return db[_0xaa24('0x30')]['findAll'](_0x345b9b);})[_0xaa24('0x26')](function(_0x429b7c){_0x22af48[_0xaa24('0x48')]=_0x429b7c;return _0x22af48;})[_0xaa24('0x26')](respondWithFilteredResult(_0x3e9943,_0x345b9b))['catch'](handleError(_0x3e9943,null));};exports[_0xaa24('0x49')]=function(_0x1311eb,_0x4448c0){var _0x3b02e2={'raw':![],'where':{'id':_0x1311eb['params']['id']}},_0x4ffef9={};_0x4ffef9[_0xaa24('0x35')]=_[_0xaa24('0x37')](db[_0xaa24('0x30')]['rawAttributes']);_0x4ffef9[_0xaa24('0x36')]=_[_0xaa24('0x37')](_0x1311eb[_0xaa24('0x36')]);_0x4ffef9[_0xaa24('0x38')]=_[_0xaa24('0x39')](_0x4ffef9['model'],_0x4ffef9[_0xaa24('0x36')]);_0x3b02e2[_0xaa24('0x3b')]=_[_0xaa24('0x39')](_0x4ffef9['model'],qs[_0xaa24('0x3a')](_0x1311eb['query'][_0xaa24('0x3a')]));_0x3b02e2[_0xaa24('0x3b')]=_0x3b02e2[_0xaa24('0x3b')]['length']?_0x3b02e2[_0xaa24('0x3b')]:_0x4ffef9['model'];if(_0x1311eb[_0xaa24('0x36')]['includeAll']){_0x3b02e2[_0xaa24('0x47')]=[{'all':!![]}];}_0x3b02e2=_[_0xaa24('0x43')]({},_0x3b02e2,_0x1311eb['options']);return db[_0xaa24('0x30')]['find'](_0x3b02e2)['then'](handleEntityNotFound(_0x4448c0,null))[_0xaa24('0x26')](respondWithResult(_0x4448c0,null))['catch'](handleError(_0x4448c0,null));};exports[_0xaa24('0x4a')]=function(_0x375fc2,_0x1baa0d){return db[_0xaa24('0x30')][_0xaa24('0x4a')](_0x375fc2[_0xaa24('0x4b')],{})['then'](function(_0x44c4aa){var _0x1c29a1=_0x375fc2['user'][_0xaa24('0x28')]({'plain':!![]});if(!_0x1c29a1)throw new Error(_0xaa24('0x4c'));if(_0x1c29a1[_0xaa24('0x4d')]===_0xaa24('0x4e')){var _0x4805cd=_0x44c4aa[_0xaa24('0x28')]({'plain':!![]});var _0x1f7173=_0xaa24('0x29');return db[_0xaa24('0x4f')]['find']({'where':{'name':_0x1f7173,'userProfileId':_0x1c29a1['userProfileId']},'raw':!![]})['then'](function(_0xa4777d){if(_0xa4777d&&_0xa4777d[_0xaa24('0x50')]===0x0){return db[_0xaa24('0x51')][_0xaa24('0x4a')]({'name':_0x4805cd['name'],'resourceId':_0x4805cd['id'],'type':_0xa4777d['name'],'sectionId':_0xa4777d['id']},{})[_0xaa24('0x26')](function(){return _0x44c4aa;});}else{return _0x44c4aa;}})[_0xaa24('0x52')](function(_0x14e828){logger[_0xaa24('0x2a')](_0xaa24('0x53'),_0x14e828);throw _0x14e828;});}return _0x44c4aa;})[_0xaa24('0x26')](respondWithResult(_0x1baa0d,0xc9))[_0xaa24('0x52')](handleError(_0x1baa0d,null));};exports[_0xaa24('0x54')]=function(_0x3c4054,_0xabe8bf){var _0x344899={'where':{'id':_0x3c4054[_0xaa24('0x55')]['id']}},_0x493e42={};_0x493e42[_0xaa24('0x35')]=_['keys'](db['JscriptyProject'][_0xaa24('0x31')]);_0x344899['attributes']=_[_0xaa24('0x39')](_0x493e42[_0xaa24('0x35')],qs[_0xaa24('0x3a')](_0x3c4054[_0xaa24('0x36')][_0xaa24('0x3a')]));_0x344899[_0xaa24('0x3b')]=_0x344899[_0xaa24('0x3b')][_0xaa24('0x3c')]?_0x344899[_0xaa24('0x3b')]:_0x493e42['model'];if(_0x3c4054[_0xaa24('0x36')]['includeAll']){_0x344899['include']=[{'all':!![]}];}_0x344899=_[_0xaa24('0x43')]({},_0x344899,_0x3c4054['options']);return db['JscriptyProject'][_0xaa24('0x56')](_0x344899)[_0xaa24('0x26')](handleEntityNotFound(_0xabe8bf,null))[_0xaa24('0x26')](function(_0x126350){if(_0x126350){var _0x1074fb=_0x126350['get']({'plain':!![]});_0x1074fb=qs[_0xaa24('0x57')](_0x1074fb,['id',_0xaa24('0x58'),_0xaa24('0x59')]);_0x3c4054['body']=_[_0xaa24('0x57')](_0x3c4054[_0xaa24('0x4b')],['id',_0xaa24('0x58'),_0xaa24('0x59')]);return db[_0xaa24('0x30')][_0xaa24('0x4a')](_[_0xaa24('0x43')](_0x1074fb,_0x3c4054['body']),{'include':_0x3c4054['query'][_0xaa24('0x46')]?[{'all':!![]}]:undefined})[_0xaa24('0x26')](function(_0x2a598b){var _0x4c65ed=_0x3c4054[_0xaa24('0x4e')]['get']({'plain':!![]});if(!_0x4c65ed)throw new Error(_0xaa24('0x4c'));if(_0x4c65ed['role']==='user'){var _0x122c60=_0x2a598b['get']({'plain':!![]});var _0x31c372=_0xaa24('0x29');return db[_0xaa24('0x4f')]['find']({'where':{'name':_0x31c372,'userProfileId':_0x4c65ed['userProfileId']},'raw':!![]})['then'](function(_0x768a41){if(_0x768a41&&_0x768a41[_0xaa24('0x50')]===0x0){return db[_0xaa24('0x51')][_0xaa24('0x4a')]({'name':_0x122c60[_0xaa24('0x2c')],'resourceId':_0x122c60['id'],'type':_0x768a41[_0xaa24('0x2c')],'sectionId':_0x768a41['id']},{})[_0xaa24('0x26')](function(){return _0x2a598b;});}else{return _0x2a598b;}})[_0xaa24('0x52')](function(_0x42e964){logger[_0xaa24('0x2a')](_0xaa24('0x53'),_0x42e964);throw _0x42e964;});}return _0x2a598b;});}})[_0xaa24('0x26')](respondWithResult(_0xabe8bf,0xc9))[_0xaa24('0x52')](handleError(_0xabe8bf,null));};exports[_0xaa24('0x25')]=function(_0xad7105,_0x419150){if(_0xad7105[_0xaa24('0x4b')]['id']){delete _0xad7105[_0xaa24('0x4b')]['id'];}return db['JscriptyProject'][_0xaa24('0x56')]({'where':{'id':_0xad7105[_0xaa24('0x55')]['id']}})[_0xaa24('0x26')](handleEntityNotFound(_0x419150,null))['then'](saveUpdates(_0xad7105[_0xaa24('0x4b')],null))[_0xaa24('0x26')](respondWithResult(_0x419150,null))['catch'](handleError(_0x419150,null));};exports[_0xaa24('0x27')]=function(_0x583932,_0x123ea1){return db[_0xaa24('0x30')][_0xaa24('0x56')]({'where':{'id':_0x583932[_0xaa24('0x55')]['id']}})[_0xaa24('0x26')](handleEntityNotFound(_0x123ea1,null))[_0xaa24('0x26')](removeEntity(_0x123ea1,null))[_0xaa24('0x52')](handleError(_0x123ea1,null));};exports[_0xaa24('0x5a')]=function(_0x30d5e8,_0x187046,_0x345ef3){var _0x32ecfd={'raw':!![],'where':{}};var _0x1674e5={};var _0x1b72a1={'count':0x0,'rows':[]};return db[_0xaa24('0x30')][_0xaa24('0x5b')]({'where':{'id':_0x30d5e8[_0xaa24('0x55')]['id']}})[_0xaa24('0x26')](handleEntityNotFound(_0x187046,null))[_0xaa24('0x26')](function(_0x5649d1){if(_0x5649d1){_0x1674e5[_0xaa24('0x35')]=_[_0xaa24('0x37')](db[_0xaa24('0x5c')][_0xaa24('0x31')]);_0x1674e5[_0xaa24('0x36')]=_['keys'](_0x30d5e8[_0xaa24('0x36')]);_0x1674e5['filters']=_[_0xaa24('0x39')](_0x1674e5[_0xaa24('0x35')],_0x1674e5[_0xaa24('0x36')]);_0x32ecfd[_0xaa24('0x3b')]=_[_0xaa24('0x39')](_0x1674e5[_0xaa24('0x35')],qs[_0xaa24('0x3a')](_0x30d5e8['query'][_0xaa24('0x3a')]));_0x32ecfd[_0xaa24('0x3b')]=_0x32ecfd[_0xaa24('0x3b')][_0xaa24('0x3c')]?_0x32ecfd[_0xaa24('0x3b')]:_0x1674e5[_0xaa24('0x35')];if(!_0x30d5e8['query'][_0xaa24('0x3d')](_0xaa24('0x3e'))){_0x32ecfd['limit']=qs[_0xaa24('0x1f')](_0x30d5e8[_0xaa24('0x36')][_0xaa24('0x1f')]);_0x32ecfd[_0xaa24('0x1d')]=qs[_0xaa24('0x1d')](_0x30d5e8[_0xaa24('0x36')][_0xaa24('0x1d')]);}_0x32ecfd[_0xaa24('0x3f')]=qs['sort'](_0x30d5e8[_0xaa24('0x36')][_0xaa24('0x40')]);_0x32ecfd[_0xaa24('0x41')]=qs[_0xaa24('0x38')](_[_0xaa24('0x42')](_0x30d5e8[_0xaa24('0x36')],_0x1674e5['filters']));_0x32ecfd[_0xaa24('0x41')]['ProjectId']=_0x5649d1['id'];if(_0x30d5e8[_0xaa24('0x36')][_0xaa24('0x5d')]){_0x32ecfd['where']=_[_0xaa24('0x43')](_0x32ecfd[_0xaa24('0x41')],{'$or':_[_0xaa24('0x2f')](_0x32ecfd[_0xaa24('0x3b')],function(_0x1eaa24){var _0xb9e12e={};_0xb9e12e[_0x1eaa24]={'$like':'%'+_0x30d5e8[_0xaa24('0x36')][_0xaa24('0x5d')]+'%'};return _0xb9e12e;})});}_0x32ecfd=_['merge']({},_0x32ecfd,_0x30d5e8['options']);return db['JscriptySessionReport'][_0xaa24('0x20')]({'where':_0x32ecfd[_0xaa24('0x41')]})[_0xaa24('0x26')](function(_0x3210f4){_0x1b72a1[_0xaa24('0x20')]=_0x3210f4;if(_0x30d5e8['query'][_0xaa24('0x46')]){_0x32ecfd['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xaa24('0x5e')](_0x32ecfd);})[_0xaa24('0x26')](function(_0x2531ef){_0x1b72a1[_0xaa24('0x48')]=_0x2531ef;return _0x1b72a1;});}})['then'](respondWithFilteredResult(_0x187046,_0x32ecfd))[_0xaa24('0x52')](handleError(_0x187046,null));};exports[_0xaa24('0x5f')]=function(_0x1678b8,_0x2919f5,_0x192ea8){var _0x49fbc0={'raw':!![],'where':{}};var _0x2bfd61={};var _0x2c9e14={'count':0x0,'rows':[]};return db[_0xaa24('0x30')][_0xaa24('0x5b')]({'where':{'id':_0x1678b8[_0xaa24('0x55')]['id']}})[_0xaa24('0x26')](handleEntityNotFound(_0x2919f5,null))['then'](function(_0x4ec4e6){if(_0x4ec4e6){_0x2bfd61[_0xaa24('0x35')]=_['keys'](db[_0xaa24('0x60')]['rawAttributes']);_0x2bfd61[_0xaa24('0x36')]=_['keys'](_0x1678b8[_0xaa24('0x36')]);_0x2bfd61[_0xaa24('0x38')]=_[_0xaa24('0x39')](_0x2bfd61[_0xaa24('0x35')],_0x2bfd61['query']);_0x49fbc0[_0xaa24('0x3b')]=_[_0xaa24('0x39')](_0x2bfd61['model'],qs[_0xaa24('0x3a')](_0x1678b8[_0xaa24('0x36')][_0xaa24('0x3a')]));_0x49fbc0['attributes']=_0x49fbc0[_0xaa24('0x3b')]['length']?_0x49fbc0['attributes']:_0x2bfd61[_0xaa24('0x35')];if(!_0x1678b8[_0xaa24('0x36')][_0xaa24('0x3d')](_0xaa24('0x3e'))){_0x49fbc0[_0xaa24('0x1f')]=qs[_0xaa24('0x1f')](_0x1678b8[_0xaa24('0x36')][_0xaa24('0x1f')]);_0x49fbc0[_0xaa24('0x1d')]=qs[_0xaa24('0x1d')](_0x1678b8[_0xaa24('0x36')]['offset']);}_0x49fbc0[_0xaa24('0x3f')]=qs[_0xaa24('0x40')](_0x1678b8['query'][_0xaa24('0x40')]);_0x49fbc0[_0xaa24('0x41')]=qs[_0xaa24('0x38')](_[_0xaa24('0x42')](_0x1678b8[_0xaa24('0x36')],_0x2bfd61[_0xaa24('0x38')]));_0x49fbc0[_0xaa24('0x41')][_0xaa24('0x61')]=_0x4ec4e6['id'];if(_0x1678b8[_0xaa24('0x36')][_0xaa24('0x5d')]){_0x49fbc0[_0xaa24('0x41')]=_[_0xaa24('0x43')](_0x49fbc0[_0xaa24('0x41')],{'$or':_[_0xaa24('0x2f')](_0x49fbc0[_0xaa24('0x3b')],function(_0xca3ea2){var _0x1cd757={};_0x1cd757[_0xca3ea2]={'$like':'%'+_0x1678b8[_0xaa24('0x36')]['filter']+'%'};return _0x1cd757;})});}_0x49fbc0=_['merge']({},_0x49fbc0,_0x1678b8['options']);return db[_0xaa24('0x60')]['count']({'where':_0x49fbc0['where']})[_0xaa24('0x26')](function(_0x496524){_0x2c9e14[_0xaa24('0x20')]=_0x496524;if(_0x1678b8[_0xaa24('0x36')]['includeAll']){_0x49fbc0[_0xaa24('0x47')]=[{'all':!![]}];}return db[_0xaa24('0x60')][_0xaa24('0x5e')](_0x49fbc0);})[_0xaa24('0x26')](function(_0xc01d38){_0x2c9e14[_0xaa24('0x48')]=_0xc01d38;return _0x2c9e14;});}})[_0xaa24('0x26')](respondWithFilteredResult(_0x2919f5,_0x49fbc0))['catch'](handleError(_0x2919f5,null));};function char(_0x54fcb7){return'number'===typeof _0x54fcb7?String[_0xaa24('0x62')][_0xaa24('0x23')](null,arguments):_0x54fcb7;}function needsEncapsulation(_0x20d671){return!!_0x20d671&&(_0x20d671['toString']()[_0xaa24('0x63')](char(0xd))>=0x0||_0x20d671[_0xaa24('0x64')]()[_0xaa24('0x63')](char(0xa))>=0x0||_0x20d671['toString']()[_0xaa24('0x63')](char(0x2c))>=0x0||_0x20d671[_0xaa24('0x64')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x14c8de){var _0x4d71c6=char(0x22),_0x5d7ffa='\x5c'+char(0x22),_0x87ce9b=_0x14c8de[_0xaa24('0x64')]()[_0xaa24('0x65')](new RegExp(_0x4d71c6,'g'),_0x5d7ffa);return _0x4d71c6+_0x87ce9b+_0x4d71c6;}exports['getSummary']=function(_0x4d8e91,_0x4c972f,_0x46fe87){var _0x4a3d8f,_0x12badb;var _0x490b6a={'where':{'ProjectId':_0x4d8e91['params']['id']}};if(_0x4d8e91[_0xaa24('0x36')][_0xaa24('0x66')]){_0x490b6a[_0xaa24('0x41')][_0xaa24('0x67')]=JSON[_0xaa24('0x68')](_0x4d8e91[_0xaa24('0x36')]['startTime']);}return db['JscriptySessionReport'][_0xaa24('0x5e')](_0x490b6a)[_0xaa24('0x26')](handleEntityNotFound(_0x4c972f,null))[_0xaa24('0x26')](function(_0x3d69f6){if(_0x3d69f6){_0x4a3d8f=_0x3d69f6;return db['JscriptyQuestionReport'][_0xaa24('0x5e')]({'where':{'SessionId':{'$in':_['map'](_0x4a3d8f,'id')},'ProjectId':_0x4d8e91[_0xaa24('0x55')]['id']},'order':'-createdAt'});}})[_0xaa24('0x26')](handleEntityNotFound(_0x4c972f,null))['then'](function(_0x13626b){if(_0x13626b){_0x12badb=_0x13626b;var _0x2eeb89={};for(var _0xf9d34b=0x0,_0x523315=_0x12badb['length'];_0xf9d34b<_0x523315;_0xf9d34b++){if(!_0x2eeb89[_0xaa24('0x3d')](_0x12badb[_0xf9d34b][_0xaa24('0x69')])){_0x2eeb89[_0x12badb[_0xf9d34b][_0xaa24('0x69')]]=needsEncapsulation(_0x12badb[_0xf9d34b][_0xaa24('0x6a')])?encapsulate(_0x12badb[_0xf9d34b]['question']):_0x12badb[_0xf9d34b][_0xaa24('0x6a')];}}var _0x42168f=[],_0xf4a391={};for(var _0x326418=0x0,_0x544d22=_0x4a3d8f[_0xaa24('0x3c')];_0x326418<_0x544d22;_0x326418++){_0xf4a391={'ProjectId':_0x4d8e91[_0xaa24('0x55')]['id'],'SessionId':_0x4a3d8f[_0x326418]['id'],'StartTime':moment(_0x4a3d8f[_0x326418][_0xaa24('0x67')])[_0xaa24('0x6b')](_0xaa24('0x6c'))};for(var _0x11e775=0x0,_0x245451=_0x12badb['length'];_0x11e775<_0x245451;_0x11e775++){if(_0x12badb[_0x11e775][_0xaa24('0x6d')]==_0x4a3d8f[_0x326418]['id']&&_0x2eeb89['hasOwnProperty'](_0x12badb[_0x11e775][_0xaa24('0x69')])){_0xf4a391[_0x2eeb89[_0x12badb[_0x11e775][_0xaa24('0x69')]]]=_0x12badb[_0x11e775]['answer'];}}for(var _0x3e2d78 in _0x2eeb89){if(!_0xf4a391[_0xaa24('0x3d')](_0x2eeb89[_0x3e2d78])){_0xf4a391[_0x2eeb89[_0x3e2d78]]=null;}}_0x42168f[_0xaa24('0x6e')](_0xf4a391);}return _0x42168f;}})[_0xaa24('0x26')](function(_0x5af1c3){if(!_[_0xaa24('0x6f')](_0x5af1c3)){var _0x128104=toCsv(_0x5af1c3);var _0x4832b0=Date[_0xaa24('0x70')]();fs[_0xaa24('0x71')](util[_0xaa24('0x6b')](_0xaa24('0x72'),_0x4d8e91[_0xaa24('0x55')]['id'],_0x4832b0),_0x128104);_0x4c972f[_0xaa24('0x73')]('Content-disposition',_0xaa24('0x74')+util[_0xaa24('0x6b')](_0xaa24('0x75'),_0x4d8e91[_0xaa24('0x55')]['id'],_0x4832b0));_0x4c972f[_0xaa24('0x73')](_0xaa24('0x76'),_0xaa24('0x77'));return _0x4c972f[_0xaa24('0x78')](util[_0xaa24('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4d8e91['params']['id'],_0x4832b0));}else{return _0x4c972f[_0xaa24('0x1a')](0xcc);}})[_0xaa24('0x52')](handleError(_0x4c972f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e7480ab..f5fdfca 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 _0xa1a5=['bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','../../config/logger','api','moment'];(function(_0x2b5fc9,_0x2f2672){var _0x19b8b7=function(_0xc9aa4d){while(--_0xc9aa4d){_0x2b5fc9['push'](_0x2b5fc9['shift']());}};_0x19b8b7(++_0x2f2672);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x11cdb9,_0x2bc236){_0x11cdb9=_0x11cdb9-0x0;var _0x1880b6=_0xa1a5[_0x11cdb9];return _0x1880b6;};'use strict';var _=require(_0x5a1a('0x0'));var util=require('util');var logger=require(_0x5a1a('0x1'))(_0x5a1a('0x2'));var moment=require(_0x5a1a('0x3'));var BPromise=require(_0x5a1a('0x4'));var rp=require(_0x5a1a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a1a('0x6'));var config=require(_0x5a1a('0x7'));var attributes=require(_0x5a1a('0x8'));module[_0x5a1a('0x9')]=function(_0x1b718f,_0x27f71f){return _0x1b718f[_0x5a1a('0xa')]('JscriptyProject',attributes,{'tableName':_0x5a1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5455=['util','../../config/logger','api','moment','bluebird','request-promise','path','./jscriptyProject.attributes','exports','define','JscriptyProject'];(function(_0x1cac0d,_0x5282ff){var _0x166f0d=function(_0x1191c5){while(--_0x1191c5){_0x1cac0d['push'](_0x1cac0d['shift']());}};_0x166f0d(++_0x5282ff);}(_0x5455,0x197));var _0x5545=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x5455[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var util=require(_0x5545('0x0'));var logger=require(_0x5545('0x1'))(_0x5545('0x2'));var moment=require(_0x5545('0x3'));var BPromise=require(_0x5545('0x4'));var rp=require(_0x5545('0x5'));var fs=require('fs');var path=require(_0x5545('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5545('0x7'));module[_0x5545('0x8')]=function(_0x5c22f1,_0x5a6ac7){return _0x5c22f1[_0x5545('0x9')](_0x5545('0xa'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 08ca3a0..0059984 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4d2c98,_0x26819e){var _0x228929=function(_0x5564de){while(--_0x5564de){_0x4d2c98['push'](_0x4d2c98['shift']());}};_0x228929(++_0x26819e);}(_0xe706,0xa3));var _0x6e70=function(_0x1ce9ea,_0x32e6f4){_0x1ce9ea=_0x1ce9ea-0x0;var _0x2a95b9=_0xe706[_0x1ce9ea];return _0x2a95b9;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5cb367,_0x27ec9d){var _0x279365=function(_0x1d9d85){while(--_0x1d9d85){_0x5cb367['push'](_0x5cb367['shift']());}};_0x279365(++_0x27ec9d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a628720..e16477b 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 _0xe744=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0xe744,0x6b));var _0x4e74=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xe744[_0x565ed7];return _0x183ad7;};'use strict';var multer=require(_0x4e74('0x0'));var util=require(_0x4e74('0x1'));var path=require(_0x4e74('0x2'));var timeout=require(_0x4e74('0x3'));var express=require(_0x4e74('0x4'));var router=express[_0x4e74('0x5')]();var fs_extra=require(_0x4e74('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e74('0x7'));var controller=require(_0x4e74('0x8'));router[_0x4e74('0x9')]('/',auth[_0x4e74('0xa')](),controller[_0x4e74('0xb')]);router[_0x4e74('0x9')](_0x4e74('0xc'),auth[_0x4e74('0xa')](),controller[_0x4e74('0xd')]);router[_0x4e74('0x9')](_0x4e74('0xe'),auth[_0x4e74('0xa')](),controller[_0x4e74('0xf')]);router[_0x4e74('0x10')]('/',auth['isAuthenticated'](),controller[_0x4e74('0x11')]);router[_0x4e74('0x12')](_0x4e74('0xe'),auth[_0x4e74('0xa')](),controller[_0x4e74('0x13')]);router[_0x4e74('0x14')](_0x4e74('0xe'),auth[_0x4e74('0xa')](),controller[_0x4e74('0x15')]);module[_0x4e74('0x16')]=router; \ No newline at end of file +var _0xe127=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fa666,_0x252c0e){var _0x3c862c=function(_0x4241d7){while(--_0x4241d7){_0x1fa666['push'](_0x1fa666['shift']());}};_0x3c862c(++_0x252c0e);}(_0xe127,0xbe));var _0x7e12=function(_0x232ded,_0x29b9f4){_0x232ded=_0x232ded-0x0;var _0x4ae3a0=_0xe127[_0x232ded];return _0x4ae3a0;};'use strict';var multer=require(_0x7e12('0x0'));var util=require(_0x7e12('0x1'));var path=require(_0x7e12('0x2'));var timeout=require(_0x7e12('0x3'));var express=require(_0x7e12('0x4'));var router=express['Router']();var fs_extra=require(_0x7e12('0x5'));var auth=require(_0x7e12('0x6'));var interaction=require(_0x7e12('0x7'));var config=require(_0x7e12('0x8'));var controller=require(_0x7e12('0x9'));router[_0x7e12('0xa')]('/',auth[_0x7e12('0xb')](),controller[_0x7e12('0xc')]);router[_0x7e12('0xa')](_0x7e12('0xd'),auth[_0x7e12('0xb')](),controller[_0x7e12('0xe')]);router[_0x7e12('0xa')](_0x7e12('0xf'),auth[_0x7e12('0xb')](),controller['show']);router[_0x7e12('0x10')]('/',auth[_0x7e12('0xb')](),controller[_0x7e12('0x11')]);router[_0x7e12('0x12')](_0x7e12('0xf'),auth[_0x7e12('0xb')](),controller[_0x7e12('0x13')]);router[_0x7e12('0x14')](_0x7e12('0xf'),auth[_0x7e12('0xb')](),controller[_0x7e12('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 3620501..193aab6 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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x801cd2,_0x34c0b0){_0x801cd2=_0x801cd2-0x0;var _0x1c5122=_0x7a54[_0x801cd2];return _0x1c5122;};'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(_0x2cb1db,_0x360db9){_0x2cb1db=_0x2cb1db-0x0;var _0x39f318=_0x7a54[_0x2cb1db];return _0x39f318;};'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 7797cf3..e328ae3 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 _0x0e87=['merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','update','describe','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','destroy','then','end','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x0e87,0x135));var _0x70e8=function(_0x3cadf7,_0x21d7c1){_0x3cadf7=_0x3cadf7-0x0;var _0x4a4431=_0x0e87[_0x3cadf7];return _0x4a4431;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x70e8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x70e8('0x1'));var rp=require('request-promise');var moment=require(_0x70e8('0x2'));var BPromise=require(_0x70e8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x70e8('0x4'));var csv=require(_0x70e8('0x5'));var ejs=require(_0x70e8('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x70e8('0x7'));var squel=require(_0x70e8('0x8'));var crypto=require(_0x70e8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x70e8('0xa'));var toCsv=require(_0x70e8('0x5'));var querystring=require('querystring');var Papa=require(_0x70e8('0xb'));var Redis=require(_0x70e8('0xc'));var authService=require(_0x70e8('0xd'));var qs=require(_0x70e8('0xe'));var as=require(_0x70e8('0xf'));var hardwareService=require(_0x70e8('0x10'));var logger=require(_0x70e8('0x11'))(_0x70e8('0x12'));var utils=require(_0x70e8('0x13'));var config=require(_0x70e8('0x14'));var licenseUtil=require(_0x70e8('0x15'));var db=require(_0x70e8('0x16'))['db'];function respondWithStatusCode(_0x821a3d,_0x2f02df){_0x2f02df=_0x2f02df||0xcc;return function(_0x45f97a){if(_0x45f97a){return _0x821a3d[_0x70e8('0x17')](_0x2f02df);}return _0x821a3d['status'](_0x2f02df)['end']();};}function respondWithResult(_0x1cc8ab,_0x17ff1f){_0x17ff1f=_0x17ff1f||0xc8;return function(_0x2faf6c){if(_0x2faf6c){return _0x1cc8ab['status'](_0x17ff1f)[_0x70e8('0x18')](_0x2faf6c);}};}function respondWithFilteredResult(_0x315029,_0xcebc8b){return function(_0x2a2a0e){if(_0x2a2a0e){var _0x54c5f1=typeof _0xcebc8b[_0x70e8('0x19')]===_0x70e8('0x1a')&&typeof _0xcebc8b[_0x70e8('0x1b')]===_0x70e8('0x1a');var _0xa93109=_0x2a2a0e[_0x70e8('0x1c')];var _0x1bf0bd=_0x54c5f1?0x0:_0xcebc8b[_0x70e8('0x19')];var _0x1c87f8=_0x54c5f1?_0x2a2a0e['count']:_0xcebc8b[_0x70e8('0x19')]+_0xcebc8b['limit'];var _0x416946;if(_0x1c87f8>=_0xa93109){_0x1c87f8=_0xa93109;_0x416946=0xc8;}else{_0x416946=0xce;}_0x315029[_0x70e8('0x1d')](_0x416946);return _0x315029[_0x70e8('0x1e')]('Content-Range',_0x1bf0bd+'-'+_0x1c87f8+'/'+_0xa93109)['json'](_0x2a2a0e);}return null;};}function patchUpdates(_0x1cc90f){return function(_0xa2c3d8){try{jsonpatch[_0x70e8('0x1f')](_0xa2c3d8,_0x1cc90f,!![]);}catch(_0x32f6fa){return BPromise[_0x70e8('0x20')](_0x32f6fa);}return _0xa2c3d8['save']();};}function saveUpdates(_0x4a4dc5,_0x3eb552){return function(_0x102b2a){if(_0x102b2a){return _0x102b2a['update'](_0x4a4dc5)['then'](function(_0x41d283){return _0x41d283;});}return null;};}function removeEntity(_0x3d8160,_0x1b9bfc){return function(_0x2f6b89){if(_0x2f6b89){return _0x2f6b89[_0x70e8('0x21')]()[_0x70e8('0x22')](function(){_0x3d8160[_0x70e8('0x1d')](0xcc)[_0x70e8('0x23')]();});}};}function handleEntityNotFound(_0x5eab32,_0x518deb){return function(_0x2890d2){if(!_0x2890d2){_0x5eab32[_0x70e8('0x17')](0x194);}return _0x2890d2;};}function handleError(_0x290537,_0x211202){_0x211202=_0x211202||0x1f4;return function(_0x5eea67){logger[_0x70e8('0x24')](_0x5eea67[_0x70e8('0x25')]);if(_0x5eea67[_0x70e8('0x26')]){delete _0x5eea67['name'];}_0x290537[_0x70e8('0x1d')](_0x211202)[_0x70e8('0x27')](_0x5eea67);};}exports['index']=function(_0x468d56,_0x1ded77){var _0xcab688={},_0x1b828d={},_0x1a699c={'count':0x0,'rows':[]};var _0x343352=_[_0x70e8('0x28')](db[_0x70e8('0x29')][_0x70e8('0x2a')],function(_0x271cef){return{'name':_0x271cef[_0x70e8('0x2b')],'type':_0x271cef[_0x70e8('0x2c')][_0x70e8('0x2d')]};});_0x1b828d['model']=_['map'](_0x343352,_0x70e8('0x26'));_0x1b828d[_0x70e8('0x2e')]=_[_0x70e8('0x2f')](_0x468d56[_0x70e8('0x2e')]);_0x1b828d['filters']=_[_0x70e8('0x30')](_0x1b828d[_0x70e8('0x31')],_0x1b828d[_0x70e8('0x2e')]);_0xcab688[_0x70e8('0x32')]=_[_0x70e8('0x30')](_0x1b828d[_0x70e8('0x31')],qs[_0x70e8('0x33')](_0x468d56[_0x70e8('0x2e')][_0x70e8('0x33')]));_0xcab688[_0x70e8('0x32')]=_0xcab688[_0x70e8('0x32')][_0x70e8('0x34')]?_0xcab688['attributes']:_0x1b828d[_0x70e8('0x31')];if(!_0x468d56[_0x70e8('0x2e')][_0x70e8('0x35')](_0x70e8('0x36'))){_0xcab688['limit']=qs[_0x70e8('0x1b')](_0x468d56[_0x70e8('0x2e')][_0x70e8('0x1b')]);_0xcab688[_0x70e8('0x19')]=qs['offset'](_0x468d56[_0x70e8('0x2e')][_0x70e8('0x19')]);}_0xcab688[_0x70e8('0x37')]=qs[_0x70e8('0x38')](_0x468d56['query'][_0x70e8('0x38')]);_0xcab688[_0x70e8('0x39')]=qs[_0x70e8('0x3a')](_[_0x70e8('0x3b')](_0x468d56[_0x70e8('0x2e')],_0x1b828d['filters']),_0x343352);if(_0x468d56[_0x70e8('0x2e')][_0x70e8('0x3c')]){_0xcab688[_0x70e8('0x39')]=_[_0x70e8('0x3d')](_0xcab688[_0x70e8('0x39')],{'$or':_[_0x70e8('0x28')](_0x343352,function(_0x1b2b1c){if(_0x1b2b1c[_0x70e8('0x2c')]!==_0x70e8('0x3e')){var _0x55303c={};_0x55303c[_0x1b2b1c[_0x70e8('0x26')]]={'$like':'%'+_0x468d56[_0x70e8('0x2e')][_0x70e8('0x3c')]+'%'};return _0x55303c;}})});}_0xcab688=_[_0x70e8('0x3d')]({},_0xcab688,_0x468d56[_0x70e8('0x3f')]);var _0x4c5012={'where':_0xcab688[_0x70e8('0x39')]};return db['JscriptyQuestionReport'][_0x70e8('0x1c')](_0x4c5012)[_0x70e8('0x22')](function(_0x2f6029){_0x1a699c[_0x70e8('0x1c')]=_0x2f6029;if(_0x468d56[_0x70e8('0x2e')][_0x70e8('0x40')]){_0xcab688[_0x70e8('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x70e8('0x42')](_0xcab688);})['then'](function(_0x3afba5){_0x1a699c['rows']=_0x3afba5;return _0x1a699c;})['then'](respondWithFilteredResult(_0x1ded77,_0xcab688))['catch'](handleError(_0x1ded77,null));};exports[_0x70e8('0x43')]=function(_0x1760b3,_0x4e07f6){var _0xfbc6d1={'raw':!![],'where':{'id':_0x1760b3[_0x70e8('0x44')]['id']}},_0x11ea49={};_0x11ea49[_0x70e8('0x31')]=_['keys'](db[_0x70e8('0x29')]['rawAttributes']);_0x11ea49[_0x70e8('0x2e')]=_[_0x70e8('0x2f')](_0x1760b3['query']);_0x11ea49[_0x70e8('0x3a')]=_[_0x70e8('0x30')](_0x11ea49['model'],_0x11ea49[_0x70e8('0x2e')]);_0xfbc6d1[_0x70e8('0x32')]=_['intersection'](_0x11ea49[_0x70e8('0x31')],qs[_0x70e8('0x33')](_0x1760b3[_0x70e8('0x2e')][_0x70e8('0x33')]));_0xfbc6d1[_0x70e8('0x32')]=_0xfbc6d1[_0x70e8('0x32')][_0x70e8('0x34')]?_0xfbc6d1[_0x70e8('0x32')]:_0x11ea49[_0x70e8('0x31')];if(_0x1760b3[_0x70e8('0x2e')][_0x70e8('0x40')]){_0xfbc6d1[_0x70e8('0x41')]=[{'all':!![]}];}_0xfbc6d1=_[_0x70e8('0x3d')]({},_0xfbc6d1,_0x1760b3[_0x70e8('0x3f')]);return db['JscriptyQuestionReport'][_0x70e8('0x45')](_0xfbc6d1)[_0x70e8('0x22')](handleEntityNotFound(_0x4e07f6,null))['then'](respondWithResult(_0x4e07f6,null))[_0x70e8('0x46')](handleError(_0x4e07f6,null));};exports['create']=function(_0x64d446,_0x2239ab){return db[_0x70e8('0x29')]['create'](_0x64d446[_0x70e8('0x47')],{})[_0x70e8('0x22')](respondWithResult(_0x2239ab,0xc9))['catch'](handleError(_0x2239ab,null));};exports[_0x70e8('0x48')]=function(_0x3cd403,_0x5c45cc){if(_0x3cd403[_0x70e8('0x47')]['id']){delete _0x3cd403[_0x70e8('0x47')]['id'];}return db[_0x70e8('0x29')][_0x70e8('0x45')]({'where':{'id':_0x3cd403[_0x70e8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c45cc,null))[_0x70e8('0x22')](saveUpdates(_0x3cd403[_0x70e8('0x47')],null))['then'](respondWithResult(_0x5c45cc,null))['catch'](handleError(_0x5c45cc,null));};exports['destroy']=function(_0x122306,_0x5be9bf){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x122306[_0x70e8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5be9bf,null))[_0x70e8('0x22')](removeEntity(_0x5be9bf,null))['catch'](handleError(_0x5be9bf,null));};exports[_0x70e8('0x49')]=function(_0x503703,_0x5510a8){return db[_0x70e8('0x29')][_0x70e8('0x49')]()[_0x70e8('0x22')](respondWithResult(_0x5510a8,null))['catch'](handleError(_0x5510a8,null));}; \ No newline at end of file +var _0xbb22=['catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','find'];(function(_0x2fd481,_0x5f11de){var _0x4cf32f=function(_0x4afae4){while(--_0x4afae4){_0x2fd481['push'](_0x2fd481['shift']());}};_0x4cf32f(++_0x5f11de);}(_0xbb22,0xe8));var _0x2bb2=function(_0x1a7eff,_0x3c4d2c){_0x1a7eff=_0x1a7eff-0x0;var _0x5e9e63=_0xbb22[_0x1a7eff];return _0x5e9e63;};'use strict';var emlformat=require(_0x2bb2('0x0'));var rimraf=require(_0x2bb2('0x1'));var zipdir=require(_0x2bb2('0x2'));var jsonpatch=require(_0x2bb2('0x3'));var rp=require(_0x2bb2('0x4'));var moment=require(_0x2bb2('0x5'));var BPromise=require(_0x2bb2('0x6'));var Mustache=require(_0x2bb2('0x7'));var util=require(_0x2bb2('0x8'));var path=require(_0x2bb2('0x9'));var sox=require(_0x2bb2('0xa'));var csv=require(_0x2bb2('0xb'));var ejs=require(_0x2bb2('0xc'));var fs=require('fs');var fs_extra=require(_0x2bb2('0xd'));var _=require('lodash');var squel=require(_0x2bb2('0xe'));var crypto=require(_0x2bb2('0xf'));var jsforce=require(_0x2bb2('0x10'));var deskjs=require(_0x2bb2('0x11'));var toCsv=require(_0x2bb2('0xb'));var querystring=require(_0x2bb2('0x12'));var Papa=require(_0x2bb2('0x13'));var Redis=require(_0x2bb2('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x2bb2('0x15'));var as=require(_0x2bb2('0x16'));var hardwareService=require(_0x2bb2('0x17'));var logger=require(_0x2bb2('0x18'))('api');var utils=require(_0x2bb2('0x19'));var config=require(_0x2bb2('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x2bb2('0x1b'))['db'];function respondWithStatusCode(_0x34cf9c,_0x4f3a2a){_0x4f3a2a=_0x4f3a2a||0xcc;return function(_0x4c9810){if(_0x4c9810){return _0x34cf9c[_0x2bb2('0x1c')](_0x4f3a2a);}return _0x34cf9c[_0x2bb2('0x1d')](_0x4f3a2a)['end']();};}function respondWithResult(_0x19db69,_0x9b1865){_0x9b1865=_0x9b1865||0xc8;return function(_0x20b757){if(_0x20b757){return _0x19db69[_0x2bb2('0x1d')](_0x9b1865)['json'](_0x20b757);}};}function respondWithFilteredResult(_0x535ca9,_0x22f1eb){return function(_0x1b04ac){if(_0x1b04ac){var _0x5b983c=typeof _0x22f1eb[_0x2bb2('0x1e')]==='undefined'&&typeof _0x22f1eb['limit']==='undefined';var _0x20ebce=_0x1b04ac[_0x2bb2('0x1f')];var _0x4dfd62=_0x5b983c?0x0:_0x22f1eb['offset'];var _0x87cd04=_0x5b983c?_0x1b04ac[_0x2bb2('0x1f')]:_0x22f1eb['offset']+_0x22f1eb[_0x2bb2('0x20')];var _0x23f253;if(_0x87cd04>=_0x20ebce){_0x87cd04=_0x20ebce;_0x23f253=0xc8;}else{_0x23f253=0xce;}_0x535ca9['status'](_0x23f253);return _0x535ca9[_0x2bb2('0x21')](_0x2bb2('0x22'),_0x4dfd62+'-'+_0x87cd04+'/'+_0x20ebce)[_0x2bb2('0x23')](_0x1b04ac);}return null;};}function patchUpdates(_0x57df82){return function(_0x3fd04f){try{jsonpatch[_0x2bb2('0x24')](_0x3fd04f,_0x57df82,!![]);}catch(_0x577eef){return BPromise[_0x2bb2('0x25')](_0x577eef);}return _0x3fd04f['save']();};}function saveUpdates(_0x111353,_0x207518){return function(_0x3e5b5c){if(_0x3e5b5c){return _0x3e5b5c[_0x2bb2('0x26')](_0x111353)[_0x2bb2('0x27')](function(_0x188c04){return _0x188c04;});}return null;};}function removeEntity(_0x801a4c,_0x11073a){return function(_0x416540){if(_0x416540){return _0x416540[_0x2bb2('0x28')]()[_0x2bb2('0x27')](function(){_0x801a4c['status'](0xcc)[_0x2bb2('0x29')]();});}};}function handleEntityNotFound(_0x4074a3,_0x5f75df){return function(_0x10c31b){if(!_0x10c31b){_0x4074a3[_0x2bb2('0x1c')](0x194);}return _0x10c31b;};}function handleError(_0x46c299,_0x3eba55){_0x3eba55=_0x3eba55||0x1f4;return function(_0x32d17b){logger[_0x2bb2('0x2a')](_0x32d17b[_0x2bb2('0x2b')]);if(_0x32d17b[_0x2bb2('0x2c')]){delete _0x32d17b[_0x2bb2('0x2c')];}_0x46c299[_0x2bb2('0x1d')](_0x3eba55)[_0x2bb2('0x2d')](_0x32d17b);};}exports[_0x2bb2('0x2e')]=function(_0x53fcb4,_0x2370a4){var _0x17ff47={},_0x5104a1={},_0x31bdaa={'count':0x0,'rows':[]};var _0x46707e=_[_0x2bb2('0x2f')](db[_0x2bb2('0x30')][_0x2bb2('0x31')],function(_0x3c9c7a){return{'name':_0x3c9c7a[_0x2bb2('0x32')],'type':_0x3c9c7a[_0x2bb2('0x33')][_0x2bb2('0x34')]};});_0x5104a1[_0x2bb2('0x35')]=_[_0x2bb2('0x2f')](_0x46707e,'name');_0x5104a1[_0x2bb2('0x36')]=_['keys'](_0x53fcb4[_0x2bb2('0x36')]);_0x5104a1[_0x2bb2('0x37')]=_[_0x2bb2('0x38')](_0x5104a1[_0x2bb2('0x35')],_0x5104a1['query']);_0x17ff47['attributes']=_[_0x2bb2('0x38')](_0x5104a1['model'],qs['fields'](_0x53fcb4[_0x2bb2('0x36')][_0x2bb2('0x39')]));_0x17ff47[_0x2bb2('0x3a')]=_0x17ff47['attributes'][_0x2bb2('0x3b')]?_0x17ff47[_0x2bb2('0x3a')]:_0x5104a1[_0x2bb2('0x35')];if(!_0x53fcb4[_0x2bb2('0x36')][_0x2bb2('0x3c')](_0x2bb2('0x3d'))){_0x17ff47[_0x2bb2('0x20')]=qs[_0x2bb2('0x20')](_0x53fcb4[_0x2bb2('0x36')][_0x2bb2('0x20')]);_0x17ff47[_0x2bb2('0x1e')]=qs[_0x2bb2('0x1e')](_0x53fcb4['query'][_0x2bb2('0x1e')]);}_0x17ff47[_0x2bb2('0x3e')]=qs[_0x2bb2('0x3f')](_0x53fcb4[_0x2bb2('0x36')][_0x2bb2('0x3f')]);_0x17ff47[_0x2bb2('0x40')]=qs[_0x2bb2('0x37')](_['pick'](_0x53fcb4[_0x2bb2('0x36')],_0x5104a1['filters']),_0x46707e);if(_0x53fcb4['query'][_0x2bb2('0x41')]){_0x17ff47['where']=_[_0x2bb2('0x42')](_0x17ff47[_0x2bb2('0x40')],{'$or':_[_0x2bb2('0x2f')](_0x46707e,function(_0x151205){if(_0x151205[_0x2bb2('0x33')]!==_0x2bb2('0x43')){var _0x398d29={};_0x398d29[_0x151205[_0x2bb2('0x2c')]]={'$like':'%'+_0x53fcb4[_0x2bb2('0x36')][_0x2bb2('0x41')]+'%'};return _0x398d29;}})});}_0x17ff47=_[_0x2bb2('0x42')]({},_0x17ff47,_0x53fcb4[_0x2bb2('0x44')]);var _0x22aac8={'where':_0x17ff47[_0x2bb2('0x40')]};return db['JscriptyQuestionReport'][_0x2bb2('0x1f')](_0x22aac8)[_0x2bb2('0x27')](function(_0x2ee3ab){_0x31bdaa['count']=_0x2ee3ab;if(_0x53fcb4['query'][_0x2bb2('0x45')]){_0x17ff47[_0x2bb2('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x17ff47);})[_0x2bb2('0x27')](function(_0x183ddf){_0x31bdaa['rows']=_0x183ddf;return _0x31bdaa;})[_0x2bb2('0x27')](respondWithFilteredResult(_0x2370a4,_0x17ff47))['catch'](handleError(_0x2370a4,null));};exports['show']=function(_0x5f05fb,_0x6a1d14){var _0x2854c0={'raw':!![],'where':{'id':_0x5f05fb['params']['id']}},_0x3032a3={};_0x3032a3[_0x2bb2('0x35')]=_['keys'](db[_0x2bb2('0x30')]['rawAttributes']);_0x3032a3['query']=_['keys'](_0x5f05fb[_0x2bb2('0x36')]);_0x3032a3['filters']=_[_0x2bb2('0x38')](_0x3032a3['model'],_0x3032a3['query']);_0x2854c0['attributes']=_[_0x2bb2('0x38')](_0x3032a3['model'],qs[_0x2bb2('0x39')](_0x5f05fb[_0x2bb2('0x36')][_0x2bb2('0x39')]));_0x2854c0[_0x2bb2('0x3a')]=_0x2854c0[_0x2bb2('0x3a')]['length']?_0x2854c0[_0x2bb2('0x3a')]:_0x3032a3[_0x2bb2('0x35')];if(_0x5f05fb[_0x2bb2('0x36')][_0x2bb2('0x45')]){_0x2854c0[_0x2bb2('0x46')]=[{'all':!![]}];}_0x2854c0=_[_0x2bb2('0x42')]({},_0x2854c0,_0x5f05fb[_0x2bb2('0x44')]);return db[_0x2bb2('0x30')][_0x2bb2('0x47')](_0x2854c0)[_0x2bb2('0x27')](handleEntityNotFound(_0x6a1d14,null))['then'](respondWithResult(_0x6a1d14,null))[_0x2bb2('0x48')](handleError(_0x6a1d14,null));};exports['create']=function(_0xc0beeb,_0xf627db){return db[_0x2bb2('0x30')]['create'](_0xc0beeb[_0x2bb2('0x49')],{})['then'](respondWithResult(_0xf627db,0xc9))[_0x2bb2('0x48')](handleError(_0xf627db,null));};exports[_0x2bb2('0x26')]=function(_0x42d2a8,_0x19c2c9){if(_0x42d2a8['body']['id']){delete _0x42d2a8['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x42d2a8['params']['id']}})[_0x2bb2('0x27')](handleEntityNotFound(_0x19c2c9,null))[_0x2bb2('0x27')](saveUpdates(_0x42d2a8[_0x2bb2('0x49')],null))[_0x2bb2('0x27')](respondWithResult(_0x19c2c9,null))[_0x2bb2('0x48')](handleError(_0x19c2c9,null));};exports[_0x2bb2('0x28')]=function(_0x4672aa,_0x3b5f7f){return db['JscriptyQuestionReport'][_0x2bb2('0x47')]({'where':{'id':_0x4672aa[_0x2bb2('0x4a')]['id']}})[_0x2bb2('0x27')](handleEntityNotFound(_0x3b5f7f,null))[_0x2bb2('0x27')](removeEntity(_0x3b5f7f,null))[_0x2bb2('0x48')](handleError(_0x3b5f7f,null));};exports[_0x2bb2('0x4b')]=function(_0x2b7f6b,_0x3b6b79){return db[_0x2bb2('0x30')]['describe']()[_0x2bb2('0x27')](respondWithResult(_0x3b6b79,null))[_0x2bb2('0x48')](handleError(_0x3b6b79,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 2553778..cea7fcf 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 _0x67dc=['lodash','util','api','moment','bluebird','path','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x67dc,0xdc));var _0xc67d=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x67dc[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xc67d('0x0'));var util=require(_0xc67d('0x1'));var logger=require('../../config/logger')(_0xc67d('0x2'));var moment=require(_0xc67d('0x3'));var BPromise=require(_0xc67d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc67d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc67d('0x6'));module[_0xc67d('0x7')]=function(_0x4c7d22,_0x4d1ada){return _0x4c7d22[_0xc67d('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0xc67d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf5d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','util'];(function(_0x33c056,_0x40c095){var _0x31e666=function(_0x25beb3){while(--_0x25beb3){_0x33c056['push'](_0x33c056['shift']());}};_0x31e666(++_0x40c095);}(_0xcf5d,0x132));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdcf5('0x0'));var util=require(_0xdcf5('0x1'));var logger=require(_0xdcf5('0x2'))(_0xdcf5('0x3'));var moment=require(_0xdcf5('0x4'));var BPromise=require(_0xdcf5('0x5'));var rp=require(_0xdcf5('0x6'));var fs=require('fs');var path=require(_0xdcf5('0x7'));var rimraf=require(_0xdcf5('0x8'));var config=require(_0xdcf5('0x9'));var attributes=require(_0xdcf5('0xa'));module[_0xdcf5('0xb')]=function(_0x1177c6,_0x196e3f){return _0x1177c6[_0xdcf5('0xc')]('JscriptyQuestionReport',attributes,{'tableName':_0xdcf5('0xd'),'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 30eb1b2..429f9f0 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 _0x3f6f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3f6f,0x8a));var _0xf3f6=function(_0x5bdea9,_0x33f532){_0x5bdea9=_0x5bdea9-0x0;var _0x16eead=_0x3f6f[_0x5bdea9];return _0x16eead;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3f6('0x0'));var BPromise=require(_0xf3f6('0x1'));var rs=require(_0xf3f6('0x2'));var fs=require('fs');var Redis=require(_0xf3f6('0x3'));var db=require(_0xf3f6('0x4'))['db'];var utils=require(_0xf3f6('0x5'));var logger=require(_0xf3f6('0x6'))('rpc');var config=require(_0xf3f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf3f6('0x8')][_0xf3f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x74f387,_0x2076bb,_0x515e00){return new BPromise(function(_0x1f6ecc,_0x32d558){return client[_0xf3f6('0xa')](_0x74f387,_0x515e00)[_0xf3f6('0xb')](function(_0x32f9ee){logger[_0xf3f6('0xc')](_0xf3f6('0xd'),_0x2076bb,'request\x20sent');logger[_0xf3f6('0xe')](_0xf3f6('0xf'),_0x2076bb,_0xf3f6('0x10'),JSON[_0xf3f6('0x11')](_0x32f9ee));if(_0x32f9ee['error']){if(_0x32f9ee[_0xf3f6('0x12')][_0xf3f6('0x13')]===0x1f4){logger[_0xf3f6('0x12')](_0xf3f6('0xd'),_0x2076bb,_0x32f9ee['error'][_0xf3f6('0x14')]);return _0x32d558(_0x32f9ee[_0xf3f6('0x12')]['message']);}logger[_0xf3f6('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2076bb,_0x32f9ee[_0xf3f6('0x12')][_0xf3f6('0x14')]);return _0x1f6ecc(_0x32f9ee[_0xf3f6('0x12')]['message']);}else{logger[_0xf3f6('0xc')](_0xf3f6('0xd'),_0x2076bb,'request\x20sent');_0x1f6ecc(_0x32f9ee[_0xf3f6('0x15')]['message']);}})[_0xf3f6('0x16')](function(_0x5e7ca9){logger[_0xf3f6('0x12')](_0xf3f6('0xd'),_0x2076bb,_0x5e7ca9);_0x32d558(_0x5e7ca9);});});} \ No newline at end of file +var _0x3ea2=['JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1324bd,_0x2e28f7){var _0x3ddf48=function(_0x14843c){while(--_0x14843c){_0x1324bd['push'](_0x1324bd['shift']());}};_0x3ddf48(++_0x2e28f7);}(_0x3ea2,0x14b));var _0x23ea=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0x3ea2[_0x3cafb8];return _0x4b7f85;};'use strict';var _=require(_0x23ea('0x0'));var util=require(_0x23ea('0x1'));var moment=require(_0x23ea('0x2'));var BPromise=require(_0x23ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x23ea('0x4'));var db=require(_0x23ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23ea('0x6'))(_0x23ea('0x7'));var config=require(_0x23ea('0x8'));var jayson=require(_0x23ea('0x9'));var client=jayson[_0x23ea('0xa')][_0x23ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e83de,_0x271a62,_0x293e5a){return new BPromise(function(_0x59f7da,_0xc3225c){return client['request'](_0x5e83de,_0x293e5a)[_0x23ea('0xc')](function(_0x5c5ae8){logger[_0x23ea('0xd')](_0x23ea('0xe'),_0x271a62,_0x23ea('0xf'));logger[_0x23ea('0x10')](_0x23ea('0x11'),_0x271a62,_0x23ea('0xf'),JSON['stringify'](_0x5c5ae8));if(_0x5c5ae8['error']){if(_0x5c5ae8['error'][_0x23ea('0x12')]===0x1f4){logger[_0x23ea('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x271a62,_0x5c5ae8[_0x23ea('0x13')][_0x23ea('0x14')]);return _0xc3225c(_0x5c5ae8[_0x23ea('0x13')][_0x23ea('0x14')]);}logger[_0x23ea('0x13')](_0x23ea('0xe'),_0x271a62,_0x5c5ae8[_0x23ea('0x13')][_0x23ea('0x14')]);return _0x59f7da(_0x5c5ae8[_0x23ea('0x13')]['message']);}else{logger[_0x23ea('0xd')](_0x23ea('0xe'),_0x271a62,_0x23ea('0xf'));_0x59f7da(_0x5c5ae8[_0x23ea('0x15')][_0x23ea('0x14')]);}})[_0x23ea('0x16')](function(_0xa5e43c){logger['error'](_0x23ea('0xe'),_0x271a62,_0xa5e43c);_0xc3225c(_0xa5e43c);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9df532a..c5b387f 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 _0x4171=['../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','post','create','put','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x5cade0,_0x5e5eef){var _0x10d5ff=function(_0x1d0f8f){while(--_0x1d0f8f){_0x5cade0['push'](_0x5cade0['shift']());}};_0x10d5ff(++_0x5e5eef);}(_0x4171,0x177));var _0x1417=function(_0xc1fa0d,_0x110a3f){_0xc1fa0d=_0xc1fa0d-0x0;var _0x537a74=_0x4171[_0xc1fa0d];return _0x537a74;};'use strict';var multer=require(_0x1417('0x0'));var util=require(_0x1417('0x1'));var path=require(_0x1417('0x2'));var timeout=require(_0x1417('0x3'));var express=require('express');var router=express[_0x1417('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1417('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1417('0x6'));var controller=require(_0x1417('0x7'));router[_0x1417('0x8')]('/',auth[_0x1417('0x9')](),controller[_0x1417('0xa')]);router[_0x1417('0x8')](_0x1417('0xb'),auth[_0x1417('0x9')](),controller['describe']);router[_0x1417('0x8')](_0x1417('0xc'),auth['isAuthenticated'](),controller[_0x1417('0xd')]);router['get'](_0x1417('0xe'),auth[_0x1417('0x9')](),controller['getQuestions']);router[_0x1417('0xf')]('/',auth[_0x1417('0x9')](),controller[_0x1417('0x10')]);router[_0x1417('0x11')](_0x1417('0xc'),auth['isAuthenticated'](),controller[_0x1417('0x12')]);router[_0x1417('0x13')]('/:id',auth[_0x1417('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8e01=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','describe','/:id','show','get','getQuestions','post','create','update','delete'];(function(_0x3c20c9,_0x49d60c){var _0x173dc3=function(_0x112999){while(--_0x112999){_0x3c20c9['push'](_0x3c20c9['shift']());}};_0x173dc3(++_0x49d60c);}(_0x8e01,0x6b));var _0x18e0=function(_0xfba8c5,_0x59f156){_0xfba8c5=_0xfba8c5-0x0;var _0x3d8c82=_0x8e01[_0xfba8c5];return _0x3d8c82;};'use strict';var multer=require('multer');var util=require(_0x18e0('0x0'));var path=require(_0x18e0('0x1'));var timeout=require(_0x18e0('0x2'));var express=require(_0x18e0('0x3'));var router=express[_0x18e0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x18e0('0x5'));var config=require(_0x18e0('0x6'));var controller=require(_0x18e0('0x7'));router['get']('/',auth[_0x18e0('0x8')](),controller[_0x18e0('0x9')]);router['get']('/describe',auth[_0x18e0('0x8')](),controller[_0x18e0('0xa')]);router['get'](_0x18e0('0xb'),auth[_0x18e0('0x8')](),controller[_0x18e0('0xc')]);router[_0x18e0('0xd')]('/:id/questions',auth[_0x18e0('0x8')](),controller[_0x18e0('0xe')]);router[_0x18e0('0xf')]('/',auth[_0x18e0('0x8')](),controller[_0x18e0('0x10')]);router['put'](_0x18e0('0xb'),auth[_0x18e0('0x8')](),controller[_0x18e0('0x11')]);router[_0x18e0('0x12')](_0x18e0('0xb'),auth[_0x18e0('0x8')](),controller[_0x18e0('0x13')]);module[_0x18e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 675a735..06d40ca 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 _0x43d6=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x43d6,0xfc));var _0x643d=function(_0x2a6e77,_0x5506a2){_0x2a6e77=_0x2a6e77-0x0;var _0x27689c=_0x43d6[_0x2a6e77];return _0x27689c;};'use strict';var moment=require(_0x643d('0x0'));var Sequelize=require(_0x643d('0x1'));module[_0x643d('0x2')]={'starttime':{'type':Sequelize[_0x643d('0x3')],'set':function(_0x975bc){this[_0x643d('0x4')]('starttime',_0x975bc);this[_0x643d('0x4')](_0x643d('0x5'),moment()[_0x643d('0x6')](_0x643d('0x7')));}},'endtime':{'type':Sequelize[_0x643d('0x3')]},'membername':{'type':Sequelize[_0x643d('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x643d('0x8')]},'uniqueid':{'type':Sequelize[_0x643d('0x8')]},'calleridname':{'type':Sequelize[_0x643d('0x8')]},'calleridnum':{'type':Sequelize[_0x643d('0x8')]},'completed':{'type':Sequelize[_0x643d('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x9811=['STRING','BOOLEAN','sequelize','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2c6229,_0x31548f){var _0x4ce5ee=function(_0x17279a){while(--_0x17279a){_0x2c6229['push'](_0x2c6229['shift']());}};_0x4ce5ee(++_0x31548f);}(_0x9811,0x92));var _0x1981=function(_0x196ee8,_0xdb9c49){_0x196ee8=_0x196ee8-0x0;var _0x24bba1=_0x9811[_0x196ee8];return _0x24bba1;};'use strict';var moment=require('moment');var Sequelize=require(_0x1981('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x1981('0x1')],'set':function(_0x387f9d){this[_0x1981('0x2')](_0x1981('0x3'),_0x387f9d);this[_0x1981('0x2')](_0x1981('0x4'),moment()[_0x1981('0x5')](_0x1981('0x6')));}},'endtime':{'type':Sequelize[_0x1981('0x1')]},'membername':{'type':Sequelize[_0x1981('0x7')]},'projectname':{'type':Sequelize[_0x1981('0x7')]},'queue':{'type':Sequelize[_0x1981('0x7')]},'uniqueid':{'type':Sequelize[_0x1981('0x7')]},'calleridname':{'type':Sequelize[_0x1981('0x7')]},'calleridnum':{'type':Sequelize[_0x1981('0x7')]},'completed':{'type':Sequelize[_0x1981('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 6831a28..0ba227b 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 _0x1833=['mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','nolimit','sort','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x27fe1b,_0x12244f){var _0x30748a=function(_0x3d152b){while(--_0x3d152b){_0x27fe1b['push'](_0x27fe1b['shift']());}};_0x30748a(++_0x12244f);}(_0x1833,0x1db));var _0x3183=function(_0x8dc025,_0x438ff5){_0x8dc025=_0x8dc025-0x0;var _0x371ba6=_0x1833[_0x8dc025];return _0x371ba6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3183('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3183('0x1'));var rp=require(_0x3183('0x2'));var moment=require(_0x3183('0x3'));var BPromise=require(_0x3183('0x4'));var Mustache=require(_0x3183('0x5'));var util=require(_0x3183('0x6'));var path=require('path');var sox=require(_0x3183('0x7'));var csv=require('to-csv');var ejs=require(_0x3183('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3183('0x9'));var squel=require(_0x3183('0xa'));var crypto=require(_0x3183('0xb'));var jsforce=require(_0x3183('0xc'));var deskjs=require(_0x3183('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3183('0xe'));var Papa=require(_0x3183('0xf'));var Redis=require('ioredis');var authService=require(_0x3183('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3183('0x11'));var logger=require(_0x3183('0x12'))(_0x3183('0x13'));var utils=require(_0x3183('0x14'));var config=require(_0x3183('0x15'));var licenseUtil=require(_0x3183('0x16'));var db=require(_0x3183('0x17'))['db'];function respondWithStatusCode(_0x486a28,_0x90cc27){_0x90cc27=_0x90cc27||0xcc;return function(_0x3bc2f9){if(_0x3bc2f9){return _0x486a28[_0x3183('0x18')](_0x90cc27);}return _0x486a28[_0x3183('0x19')](_0x90cc27)[_0x3183('0x1a')]();};}function respondWithResult(_0x512e40,_0x116aba){_0x116aba=_0x116aba||0xc8;return function(_0x31674d){if(_0x31674d){return _0x512e40[_0x3183('0x19')](_0x116aba)['json'](_0x31674d);}};}function respondWithFilteredResult(_0x5f3b2b,_0x2f13a6){return function(_0x4f98e4){if(_0x4f98e4){var _0x4e9340=typeof _0x2f13a6[_0x3183('0x1b')]===_0x3183('0x1c')&&typeof _0x2f13a6[_0x3183('0x1d')]==='undefined';var _0x2279c0=_0x4f98e4[_0x3183('0x1e')];var _0xc1c927=_0x4e9340?0x0:_0x2f13a6[_0x3183('0x1b')];var _0x22962f=_0x4e9340?_0x4f98e4[_0x3183('0x1e')]:_0x2f13a6[_0x3183('0x1b')]+_0x2f13a6[_0x3183('0x1d')];var _0x334d44;if(_0x22962f>=_0x2279c0){_0x22962f=_0x2279c0;_0x334d44=0xc8;}else{_0x334d44=0xce;}_0x5f3b2b['status'](_0x334d44);return _0x5f3b2b[_0x3183('0x1f')](_0x3183('0x20'),_0xc1c927+'-'+_0x22962f+'/'+_0x2279c0)['json'](_0x4f98e4);}return null;};}function patchUpdates(_0x21d74c){return function(_0x20aef5){try{jsonpatch[_0x3183('0x21')](_0x20aef5,_0x21d74c,!![]);}catch(_0x59024b){return BPromise[_0x3183('0x22')](_0x59024b);}return _0x20aef5[_0x3183('0x23')]();};}function saveUpdates(_0x114e09,_0x3e53ca){return function(_0x1ebf01){if(_0x1ebf01){return _0x1ebf01[_0x3183('0x24')](_0x114e09)[_0x3183('0x25')](function(_0x5d47f3){return _0x5d47f3;});}return null;};}function removeEntity(_0x21885e,_0x65f5c5){return function(_0xabbf4c){if(_0xabbf4c){return _0xabbf4c[_0x3183('0x26')]()[_0x3183('0x25')](function(){_0x21885e[_0x3183('0x19')](0xcc)[_0x3183('0x1a')]();});}};}function handleEntityNotFound(_0x5a17cd,_0x736f24){return function(_0x4b7d56){if(!_0x4b7d56){_0x5a17cd[_0x3183('0x18')](0x194);}return _0x4b7d56;};}function handleError(_0x4d1125,_0x1ea870){_0x1ea870=_0x1ea870||0x1f4;return function(_0x19e357){logger[_0x3183('0x27')](_0x19e357[_0x3183('0x28')]);if(_0x19e357[_0x3183('0x29')]){delete _0x19e357[_0x3183('0x29')];}_0x4d1125[_0x3183('0x19')](_0x1ea870)[_0x3183('0x2a')](_0x19e357);};}exports[_0x3183('0x2b')]=function(_0x49d610,_0x2a0e4e){var _0x5479c8={},_0x113ea8={},_0x40e98f={'count':0x0,'rows':[]};var _0x49556f=_['map'](db['JscriptySessionReport'][_0x3183('0x2c')],function(_0xb080b9){return{'name':_0xb080b9['fieldName'],'type':_0xb080b9['type'][_0x3183('0x2d')]};});_0x113ea8[_0x3183('0x2e')]=_[_0x3183('0x2f')](_0x49556f,_0x3183('0x29'));_0x113ea8[_0x3183('0x30')]=_[_0x3183('0x31')](_0x49d610[_0x3183('0x30')]);_0x113ea8[_0x3183('0x32')]=_[_0x3183('0x33')](_0x113ea8[_0x3183('0x2e')],_0x113ea8[_0x3183('0x30')]);_0x5479c8[_0x3183('0x34')]=_[_0x3183('0x33')](_0x113ea8['model'],qs[_0x3183('0x35')](_0x49d610[_0x3183('0x30')][_0x3183('0x35')]));_0x5479c8[_0x3183('0x34')]=_0x5479c8['attributes'][_0x3183('0x36')]?_0x5479c8[_0x3183('0x34')]:_0x113ea8[_0x3183('0x2e')];if(!_0x49d610[_0x3183('0x30')][_0x3183('0x37')]('nolimit')){_0x5479c8[_0x3183('0x1d')]=qs[_0x3183('0x1d')](_0x49d610[_0x3183('0x30')][_0x3183('0x1d')]);_0x5479c8[_0x3183('0x1b')]=qs[_0x3183('0x1b')](_0x49d610['query'][_0x3183('0x1b')]);}_0x5479c8[_0x3183('0x38')]=qs['sort'](_0x49d610[_0x3183('0x30')]['sort']);_0x5479c8[_0x3183('0x39')]=qs['filters'](_[_0x3183('0x3a')](_0x49d610[_0x3183('0x30')],_0x113ea8[_0x3183('0x32')]),_0x49556f);if(_0x49d610[_0x3183('0x30')][_0x3183('0x3b')]){_0x5479c8['where']=_[_0x3183('0x3c')](_0x5479c8[_0x3183('0x39')],{'$or':_['map'](_0x49556f,function(_0x21298c){if(_0x21298c[_0x3183('0x3d')]!==_0x3183('0x3e')){var _0x2aadb0={};_0x2aadb0[_0x21298c['name']]={'$like':'%'+_0x49d610[_0x3183('0x30')]['filter']+'%'};return _0x2aadb0;}})});}_0x5479c8=_[_0x3183('0x3c')]({},_0x5479c8,_0x49d610[_0x3183('0x3f')]);var _0x3c139a={'where':_0x5479c8['where']};return db[_0x3183('0x40')][_0x3183('0x1e')](_0x3c139a)[_0x3183('0x25')](function(_0x308287){_0x40e98f[_0x3183('0x1e')]=_0x308287;if(_0x49d610[_0x3183('0x30')][_0x3183('0x41')]){_0x5479c8[_0x3183('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x3183('0x43')](_0x5479c8);})[_0x3183('0x25')](function(_0xaf0f87){_0x40e98f[_0x3183('0x44')]=_0xaf0f87;return _0x40e98f;})[_0x3183('0x25')](respondWithFilteredResult(_0x2a0e4e,_0x5479c8))[_0x3183('0x45')](handleError(_0x2a0e4e,null));};exports['show']=function(_0x24eed3,_0x93f483){var _0x4e0e3f={'raw':!![],'where':{'id':_0x24eed3[_0x3183('0x46')]['id']}},_0x12e05f={};_0x12e05f[_0x3183('0x2e')]=_[_0x3183('0x31')](db[_0x3183('0x40')][_0x3183('0x2c')]);_0x12e05f['query']=_[_0x3183('0x31')](_0x24eed3['query']);_0x12e05f['filters']=_['intersection'](_0x12e05f[_0x3183('0x2e')],_0x12e05f[_0x3183('0x30')]);_0x4e0e3f[_0x3183('0x34')]=_['intersection'](_0x12e05f['model'],qs[_0x3183('0x35')](_0x24eed3['query'][_0x3183('0x35')]));_0x4e0e3f[_0x3183('0x34')]=_0x4e0e3f[_0x3183('0x34')][_0x3183('0x36')]?_0x4e0e3f['attributes']:_0x12e05f['model'];if(_0x24eed3[_0x3183('0x30')][_0x3183('0x41')]){_0x4e0e3f[_0x3183('0x42')]=[{'all':!![]}];}_0x4e0e3f=_[_0x3183('0x3c')]({},_0x4e0e3f,_0x24eed3[_0x3183('0x3f')]);return db[_0x3183('0x40')][_0x3183('0x47')](_0x4e0e3f)['then'](handleEntityNotFound(_0x93f483,null))[_0x3183('0x25')](respondWithResult(_0x93f483,null))['catch'](handleError(_0x93f483,null));};exports[_0x3183('0x48')]=function(_0x304cd9,_0x2ff141){return db[_0x3183('0x40')]['create'](_0x304cd9[_0x3183('0x49')],{})[_0x3183('0x25')](respondWithResult(_0x2ff141,0xc9))['catch'](handleError(_0x2ff141,null));};exports[_0x3183('0x24')]=function(_0x5f2bef,_0x30320f){if(_0x5f2bef[_0x3183('0x49')]['id']){delete _0x5f2bef[_0x3183('0x49')]['id'];}return db[_0x3183('0x40')][_0x3183('0x47')]({'where':{'id':_0x5f2bef[_0x3183('0x46')]['id']}})['then'](handleEntityNotFound(_0x30320f,null))['then'](saveUpdates(_0x5f2bef['body'],null))[_0x3183('0x25')](respondWithResult(_0x30320f,null))[_0x3183('0x45')](handleError(_0x30320f,null));};exports[_0x3183('0x26')]=function(_0x58823f,_0x44f845){return db[_0x3183('0x40')][_0x3183('0x47')]({'where':{'id':_0x58823f[_0x3183('0x46')]['id']}})[_0x3183('0x25')](handleEntityNotFound(_0x44f845,null))[_0x3183('0x25')](removeEntity(_0x44f845,null))[_0x3183('0x45')](handleError(_0x44f845,null));};exports[_0x3183('0x4a')]=function(_0x2a5857,_0xd747c4){return db[_0x3183('0x40')][_0x3183('0x4a')]()[_0x3183('0x25')](respondWithResult(_0xd747c4,null))[_0x3183('0x45')](handleError(_0xd747c4,null));};exports[_0x3183('0x4b')]=function(_0x37f013,_0x26a7de,_0x1fdf2e){var _0x395bb2={'raw':!![],'where':{}};var _0x4115d4={};var _0x29c104={'count':0x0,'rows':[]};return db[_0x3183('0x40')][_0x3183('0x4c')]({'where':{'id':_0x37f013[_0x3183('0x46')]['id']}})[_0x3183('0x25')](handleEntityNotFound(_0x26a7de,null))[_0x3183('0x25')](function(_0x46a26e){if(_0x46a26e){_0x4115d4[_0x3183('0x2e')]=_[_0x3183('0x31')](db[_0x3183('0x4d')][_0x3183('0x2c')]);_0x4115d4[_0x3183('0x30')]=_[_0x3183('0x31')](_0x37f013[_0x3183('0x30')]);_0x4115d4['filters']=_[_0x3183('0x33')](_0x4115d4['model'],_0x4115d4[_0x3183('0x30')]);_0x395bb2[_0x3183('0x34')]=_['intersection'](_0x4115d4[_0x3183('0x2e')],qs['fields'](_0x37f013[_0x3183('0x30')][_0x3183('0x35')]));_0x395bb2[_0x3183('0x34')]=_0x395bb2[_0x3183('0x34')][_0x3183('0x36')]?_0x395bb2['attributes']:_0x4115d4[_0x3183('0x2e')];if(!_0x37f013[_0x3183('0x30')][_0x3183('0x37')](_0x3183('0x4e'))){_0x395bb2[_0x3183('0x1d')]=qs['limit'](_0x37f013[_0x3183('0x30')][_0x3183('0x1d')]);_0x395bb2[_0x3183('0x1b')]=qs[_0x3183('0x1b')](_0x37f013[_0x3183('0x30')]['offset']);}_0x395bb2[_0x3183('0x38')]=qs[_0x3183('0x4f')](_0x37f013['query'][_0x3183('0x4f')]);_0x395bb2['where']=qs[_0x3183('0x32')](_[_0x3183('0x3a')](_0x37f013[_0x3183('0x30')],_0x4115d4[_0x3183('0x32')]));_0x395bb2[_0x3183('0x39')]['SessionId']=_0x46a26e['id'];if(_0x37f013[_0x3183('0x30')][_0x3183('0x3b')]){_0x395bb2[_0x3183('0x39')]=_[_0x3183('0x3c')](_0x395bb2[_0x3183('0x39')],{'$or':_[_0x3183('0x2f')](_0x395bb2[_0x3183('0x34')],function(_0x5e9b36){var _0x3c0698={};_0x3c0698[_0x5e9b36]={'$like':'%'+_0x37f013[_0x3183('0x30')][_0x3183('0x3b')]+'%'};return _0x3c0698;})});}_0x395bb2=_['merge']({},_0x395bb2,_0x37f013['options']);return db['JscriptyQuestionReport'][_0x3183('0x1e')]({'where':_0x395bb2[_0x3183('0x39')]})[_0x3183('0x25')](function(_0x57554a){_0x29c104['count']=_0x57554a;if(_0x37f013[_0x3183('0x30')][_0x3183('0x41')]){_0x395bb2[_0x3183('0x42')]=[{'all':!![]}];}return db[_0x3183('0x4d')][_0x3183('0x43')](_0x395bb2);})['then'](function(_0x467ee6){_0x29c104[_0x3183('0x44')]=_0x467ee6;return _0x29c104;});}})['then'](respondWithFilteredResult(_0x26a7de,_0x395bb2))['catch'](handleError(_0x26a7de,null));}; \ No newline at end of file +var _0x3ff8=['where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','find','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3ff8,0x142));var _0x83ff=function(_0xb54b31,_0x4ac97c){_0xb54b31=_0xb54b31-0x0;var _0x49d88b=_0x3ff8[_0xb54b31];return _0x49d88b;};'use strict';var emlformat=require(_0x83ff('0x0'));var rimraf=require(_0x83ff('0x1'));var zipdir=require(_0x83ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x83ff('0x3'));var BPromise=require(_0x83ff('0x4'));var Mustache=require(_0x83ff('0x5'));var util=require(_0x83ff('0x6'));var path=require('path');var sox=require(_0x83ff('0x7'));var csv=require(_0x83ff('0x8'));var ejs=require(_0x83ff('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x83ff('0xa'));var crypto=require(_0x83ff('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x83ff('0x8'));var querystring=require(_0x83ff('0xc'));var Papa=require(_0x83ff('0xd'));var Redis=require(_0x83ff('0xe'));var authService=require(_0x83ff('0xf'));var qs=require(_0x83ff('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83ff('0x11'));var logger=require('../../config/logger')(_0x83ff('0x12'));var utils=require(_0x83ff('0x13'));var config=require(_0x83ff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x83ff('0x15'))['db'];function respondWithStatusCode(_0x3ccd07,_0x45cb44){_0x45cb44=_0x45cb44||0xcc;return function(_0x204718){if(_0x204718){return _0x3ccd07[_0x83ff('0x16')](_0x45cb44);}return _0x3ccd07[_0x83ff('0x17')](_0x45cb44)['end']();};}function respondWithResult(_0x2ebdb1,_0x464635){_0x464635=_0x464635||0xc8;return function(_0x7b9dea){if(_0x7b9dea){return _0x2ebdb1[_0x83ff('0x17')](_0x464635)[_0x83ff('0x18')](_0x7b9dea);}};}function respondWithFilteredResult(_0x2b9eb0,_0x5bfb93){return function(_0x1dc125){if(_0x1dc125){var _0x4853a1=typeof _0x5bfb93[_0x83ff('0x19')]===_0x83ff('0x1a')&&typeof _0x5bfb93['limit']==='undefined';var _0x10dd81=_0x1dc125['count'];var _0x549117=_0x4853a1?0x0:_0x5bfb93[_0x83ff('0x19')];var _0x293d30=_0x4853a1?_0x1dc125[_0x83ff('0x1b')]:_0x5bfb93['offset']+_0x5bfb93[_0x83ff('0x1c')];var _0x2bbba7;if(_0x293d30>=_0x10dd81){_0x293d30=_0x10dd81;_0x2bbba7=0xc8;}else{_0x2bbba7=0xce;}_0x2b9eb0[_0x83ff('0x17')](_0x2bbba7);return _0x2b9eb0[_0x83ff('0x1d')](_0x83ff('0x1e'),_0x549117+'-'+_0x293d30+'/'+_0x10dd81)['json'](_0x1dc125);}return null;};}function patchUpdates(_0xcd6a2){return function(_0x316000){try{jsonpatch['apply'](_0x316000,_0xcd6a2,!![]);}catch(_0x46068b){return BPromise[_0x83ff('0x1f')](_0x46068b);}return _0x316000['save']();};}function saveUpdates(_0x539e25,_0x52de1b){return function(_0x516287){if(_0x516287){return _0x516287[_0x83ff('0x20')](_0x539e25)[_0x83ff('0x21')](function(_0x2c70dd){return _0x2c70dd;});}return null;};}function removeEntity(_0x3d0ae5,_0x3d6cbc){return function(_0x5c597b){if(_0x5c597b){return _0x5c597b[_0x83ff('0x22')]()[_0x83ff('0x21')](function(){_0x3d0ae5['status'](0xcc)[_0x83ff('0x23')]();});}};}function handleEntityNotFound(_0x76c4db,_0x42c765){return function(_0x18428f){if(!_0x18428f){_0x76c4db[_0x83ff('0x16')](0x194);}return _0x18428f;};}function handleError(_0x4ab5d5,_0x54c863){_0x54c863=_0x54c863||0x1f4;return function(_0x24c963){logger[_0x83ff('0x24')](_0x24c963[_0x83ff('0x25')]);if(_0x24c963[_0x83ff('0x26')]){delete _0x24c963[_0x83ff('0x26')];}_0x4ab5d5[_0x83ff('0x17')](_0x54c863)[_0x83ff('0x27')](_0x24c963);};}exports[_0x83ff('0x28')]=function(_0x479e39,_0x4c272f){var _0x15ebaf={},_0x2e9867={},_0x5270d9={'count':0x0,'rows':[]};var _0x2d9f01=_['map'](db[_0x83ff('0x29')][_0x83ff('0x2a')],function(_0x14eab7){return{'name':_0x14eab7[_0x83ff('0x2b')],'type':_0x14eab7[_0x83ff('0x2c')]['key']};});_0x2e9867[_0x83ff('0x2d')]=_[_0x83ff('0x2e')](_0x2d9f01,_0x83ff('0x26'));_0x2e9867['query']=_[_0x83ff('0x2f')](_0x479e39[_0x83ff('0x30')]);_0x2e9867[_0x83ff('0x31')]=_[_0x83ff('0x32')](_0x2e9867[_0x83ff('0x2d')],_0x2e9867['query']);_0x15ebaf[_0x83ff('0x33')]=_[_0x83ff('0x32')](_0x2e9867[_0x83ff('0x2d')],qs[_0x83ff('0x34')](_0x479e39[_0x83ff('0x30')][_0x83ff('0x34')]));_0x15ebaf[_0x83ff('0x33')]=_0x15ebaf[_0x83ff('0x33')][_0x83ff('0x35')]?_0x15ebaf[_0x83ff('0x33')]:_0x2e9867['model'];if(!_0x479e39[_0x83ff('0x30')][_0x83ff('0x36')](_0x83ff('0x37'))){_0x15ebaf['limit']=qs[_0x83ff('0x1c')](_0x479e39[_0x83ff('0x30')]['limit']);_0x15ebaf['offset']=qs[_0x83ff('0x19')](_0x479e39[_0x83ff('0x30')]['offset']);}_0x15ebaf[_0x83ff('0x38')]=qs[_0x83ff('0x39')](_0x479e39['query'][_0x83ff('0x39')]);_0x15ebaf[_0x83ff('0x3a')]=qs[_0x83ff('0x31')](_['pick'](_0x479e39[_0x83ff('0x30')],_0x2e9867[_0x83ff('0x31')]),_0x2d9f01);if(_0x479e39[_0x83ff('0x30')][_0x83ff('0x3b')]){_0x15ebaf[_0x83ff('0x3a')]=_[_0x83ff('0x3c')](_0x15ebaf[_0x83ff('0x3a')],{'$or':_[_0x83ff('0x2e')](_0x2d9f01,function(_0x1853c0){if(_0x1853c0['type']!==_0x83ff('0x3d')){var _0xb3e31d={};_0xb3e31d[_0x1853c0[_0x83ff('0x26')]]={'$like':'%'+_0x479e39[_0x83ff('0x30')][_0x83ff('0x3b')]+'%'};return _0xb3e31d;}})});}_0x15ebaf=_[_0x83ff('0x3c')]({},_0x15ebaf,_0x479e39[_0x83ff('0x3e')]);var _0x23da15={'where':_0x15ebaf['where']};return db[_0x83ff('0x29')]['count'](_0x23da15)['then'](function(_0x551783){_0x5270d9['count']=_0x551783;if(_0x479e39['query'][_0x83ff('0x3f')]){_0x15ebaf[_0x83ff('0x40')]=[{'all':!![]}];}return db[_0x83ff('0x29')][_0x83ff('0x41')](_0x15ebaf);})['then'](function(_0x20138f){_0x5270d9['rows']=_0x20138f;return _0x5270d9;})['then'](respondWithFilteredResult(_0x4c272f,_0x15ebaf))[_0x83ff('0x42')](handleError(_0x4c272f,null));};exports['show']=function(_0x5c9078,_0x570561){var _0x2b27b8={'raw':!![],'where':{'id':_0x5c9078[_0x83ff('0x43')]['id']}},_0x12722d={};_0x12722d['model']=_[_0x83ff('0x2f')](db[_0x83ff('0x29')][_0x83ff('0x2a')]);_0x12722d['query']=_[_0x83ff('0x2f')](_0x5c9078[_0x83ff('0x30')]);_0x12722d[_0x83ff('0x31')]=_['intersection'](_0x12722d[_0x83ff('0x2d')],_0x12722d[_0x83ff('0x30')]);_0x2b27b8['attributes']=_[_0x83ff('0x32')](_0x12722d[_0x83ff('0x2d')],qs[_0x83ff('0x34')](_0x5c9078[_0x83ff('0x30')][_0x83ff('0x34')]));_0x2b27b8[_0x83ff('0x33')]=_0x2b27b8[_0x83ff('0x33')][_0x83ff('0x35')]?_0x2b27b8[_0x83ff('0x33')]:_0x12722d[_0x83ff('0x2d')];if(_0x5c9078[_0x83ff('0x30')][_0x83ff('0x3f')]){_0x2b27b8[_0x83ff('0x40')]=[{'all':!![]}];}_0x2b27b8=_[_0x83ff('0x3c')]({},_0x2b27b8,_0x5c9078[_0x83ff('0x3e')]);return db[_0x83ff('0x29')]['find'](_0x2b27b8)[_0x83ff('0x21')](handleEntityNotFound(_0x570561,null))['then'](respondWithResult(_0x570561,null))['catch'](handleError(_0x570561,null));};exports[_0x83ff('0x44')]=function(_0x25c315,_0x225288){return db[_0x83ff('0x29')]['create'](_0x25c315['body'],{})[_0x83ff('0x21')](respondWithResult(_0x225288,0xc9))[_0x83ff('0x42')](handleError(_0x225288,null));};exports[_0x83ff('0x20')]=function(_0x51cd8b,_0x199986){if(_0x51cd8b['body']['id']){delete _0x51cd8b['body']['id'];}return db[_0x83ff('0x29')][_0x83ff('0x45')]({'where':{'id':_0x51cd8b[_0x83ff('0x43')]['id']}})['then'](handleEntityNotFound(_0x199986,null))['then'](saveUpdates(_0x51cd8b[_0x83ff('0x46')],null))[_0x83ff('0x21')](respondWithResult(_0x199986,null))[_0x83ff('0x42')](handleError(_0x199986,null));};exports[_0x83ff('0x22')]=function(_0x5a5f37,_0x111956){return db['JscriptySessionReport'][_0x83ff('0x45')]({'where':{'id':_0x5a5f37[_0x83ff('0x43')]['id']}})[_0x83ff('0x21')](handleEntityNotFound(_0x111956,null))[_0x83ff('0x21')](removeEntity(_0x111956,null))[_0x83ff('0x42')](handleError(_0x111956,null));};exports[_0x83ff('0x47')]=function(_0x164744,_0x161edb){return db[_0x83ff('0x29')][_0x83ff('0x47')]()[_0x83ff('0x21')](respondWithResult(_0x161edb,null))[_0x83ff('0x42')](handleError(_0x161edb,null));};exports[_0x83ff('0x48')]=function(_0x21b594,_0x19eb52,_0x27f927){var _0x57e9da={'raw':!![],'where':{}};var _0x4e9502={};var _0x237f06={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x83ff('0x49')]({'where':{'id':_0x21b594['params']['id']}})[_0x83ff('0x21')](handleEntityNotFound(_0x19eb52,null))[_0x83ff('0x21')](function(_0x110dd3){if(_0x110dd3){_0x4e9502[_0x83ff('0x2d')]=_[_0x83ff('0x2f')](db[_0x83ff('0x4a')][_0x83ff('0x2a')]);_0x4e9502['query']=_[_0x83ff('0x2f')](_0x21b594['query']);_0x4e9502[_0x83ff('0x31')]=_[_0x83ff('0x32')](_0x4e9502[_0x83ff('0x2d')],_0x4e9502[_0x83ff('0x30')]);_0x57e9da['attributes']=_['intersection'](_0x4e9502['model'],qs[_0x83ff('0x34')](_0x21b594[_0x83ff('0x30')][_0x83ff('0x34')]));_0x57e9da[_0x83ff('0x33')]=_0x57e9da[_0x83ff('0x33')][_0x83ff('0x35')]?_0x57e9da[_0x83ff('0x33')]:_0x4e9502['model'];if(!_0x21b594['query'][_0x83ff('0x36')]('nolimit')){_0x57e9da[_0x83ff('0x1c')]=qs[_0x83ff('0x1c')](_0x21b594[_0x83ff('0x30')]['limit']);_0x57e9da['offset']=qs[_0x83ff('0x19')](_0x21b594['query'][_0x83ff('0x19')]);}_0x57e9da[_0x83ff('0x38')]=qs[_0x83ff('0x39')](_0x21b594['query'][_0x83ff('0x39')]);_0x57e9da[_0x83ff('0x3a')]=qs[_0x83ff('0x31')](_['pick'](_0x21b594[_0x83ff('0x30')],_0x4e9502[_0x83ff('0x31')]));_0x57e9da['where'][_0x83ff('0x4b')]=_0x110dd3['id'];if(_0x21b594['query'][_0x83ff('0x3b')]){_0x57e9da[_0x83ff('0x3a')]=_[_0x83ff('0x3c')](_0x57e9da[_0x83ff('0x3a')],{'$or':_['map'](_0x57e9da['attributes'],function(_0x58281a){var _0x2bedb2={};_0x2bedb2[_0x58281a]={'$like':'%'+_0x21b594[_0x83ff('0x30')]['filter']+'%'};return _0x2bedb2;})});}_0x57e9da=_[_0x83ff('0x3c')]({},_0x57e9da,_0x21b594['options']);return db[_0x83ff('0x4a')]['count']({'where':_0x57e9da[_0x83ff('0x3a')]})[_0x83ff('0x21')](function(_0x33647a){_0x237f06[_0x83ff('0x1b')]=_0x33647a;if(_0x21b594[_0x83ff('0x30')][_0x83ff('0x3f')]){_0x57e9da[_0x83ff('0x40')]=[{'all':!![]}];}return db[_0x83ff('0x4a')][_0x83ff('0x41')](_0x57e9da);})['then'](function(_0x25de9e){_0x237f06['rows']=_0x25de9e;return _0x237f06;});}})[_0x83ff('0x21')](respondWithFilteredResult(_0x19eb52,_0x57e9da))['catch'](handleError(_0x19eb52,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 24eec7b..e75caea 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 _0x1db9=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x1ca4cc,_0x402c23){var _0x108010=function(_0x4c5082){while(--_0x4c5082){_0x1ca4cc['push'](_0x1ca4cc['shift']());}};_0x108010(++_0x402c23);}(_0x1db9,0x176));var _0x91db=function(_0x3e520f,_0x5608e3){_0x3e520f=_0x3e520f-0x0;var _0x38b37e=_0x1db9[_0x3e520f];return _0x38b37e;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dfd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x385713,_0xbe2a41){var _0x619260=function(_0x2c67cc){while(--_0x2c67cc){_0x385713['push'](_0x385713['shift']());}};_0x619260(++_0xbe2a41);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var logger=require(_0xd7df('0x2'))(_0xd7df('0x3'));var moment=require(_0xd7df('0x4'));var BPromise=require(_0xd7df('0x5'));var rp=require(_0xd7df('0x6'));var fs=require('fs');var path=require(_0xd7df('0x7'));var rimraf=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var attributes=require(_0xd7df('0xa'));module[_0xd7df('0xb')]=function(_0x36cf0f,_0x39ce98){return _0x36cf0f[_0xd7df('0xc')](_0xd7df('0xd'),attributes,{'tableName':_0xd7df('0xe'),'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 791bbe4..3e10200 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 _0xfb11=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfb11[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fb1('0x4'));var logger=require('../../config/logger')(_0x1fb1('0x5'));var config=require(_0x1fb1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1fb1('0x7')][_0x1fb1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c098d,_0x1859da,_0x2596c2){return new BPromise(function(_0x34e61a,_0x236b20){return client[_0x1fb1('0x9')](_0x4c098d,_0x2596c2)[_0x1fb1('0xa')](function(_0x438d15){logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,_0x1fb1('0xd'));logger['debug'](_0x1fb1('0xe'),_0x1859da,'request\x20sent',JSON[_0x1fb1('0xf')](_0x438d15));if(_0x438d15['error']){if(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x11')]===0x1f4){logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x236b20(_0x438d15['error'][_0x1fb1('0x12')]);}logger[_0x1fb1('0x10')](_0x1fb1('0xc'),_0x1859da,_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);return _0x34e61a(_0x438d15[_0x1fb1('0x10')][_0x1fb1('0x12')]);}else{logger[_0x1fb1('0xb')](_0x1fb1('0xc'),_0x1859da,'request\x20sent');_0x34e61a(_0x438d15['result'][_0x1fb1('0x12')]);}})[_0x1fb1('0x13')](function(_0x3924ab){logger['error'](_0x1fb1('0xc'),_0x1859da,_0x3924ab);_0x236b20(_0x3924ab);});});} \ No newline at end of file +var _0xb44a=['moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','info','catch'];(function(_0x262a27,_0x54d899){var _0x382363=function(_0x5d3d4c){while(--_0x5d3d4c){_0x262a27['push'](_0x262a27['shift']());}};_0x382363(++_0x54d899);}(_0xb44a,0x1c2));var _0xab44=function(_0x31b350,_0x5be290){_0x31b350=_0x31b350-0x0;var _0x1870dc=_0xb44a[_0x31b350];return _0x1870dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xab44('0x0'));var BPromise=require('bluebird');var rs=require(_0xab44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xab44('0x2'));var logger=require('../../config/logger')(_0xab44('0x3'));var config=require(_0xab44('0x4'));var jayson=require(_0xab44('0x5'));var client=jayson[_0xab44('0x6')][_0xab44('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3303b1,_0x3ead8d,_0x495825){return new BPromise(function(_0x137a8c,_0x133a6d){return client[_0xab44('0x8')](_0x3303b1,_0x495825)[_0xab44('0x9')](function(_0xa14367){logger['info'](_0xab44('0xa'),_0x3ead8d,'request\x20sent');logger[_0xab44('0xb')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x3ead8d,'request\x20sent',JSON[_0xab44('0xc')](_0xa14367));if(_0xa14367[_0xab44('0xd')]){if(_0xa14367[_0xab44('0xd')][_0xab44('0xe')]===0x1f4){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0xa14367['error']['message']);return _0x133a6d(_0xa14367[_0xab44('0xd')]['message']);}logger[_0xab44('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ead8d,_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);return _0x137a8c(_0xa14367[_0xab44('0xd')][_0xab44('0xf')]);}else{logger[_0xab44('0x10')](_0xab44('0xa'),_0x3ead8d,'request\x20sent');_0x137a8c(_0xa14367['result'][_0xab44('0xf')]);}})[_0xab44('0x11')](function(_0x14fe36){logger[_0xab44('0xd')](_0xab44('0xa'),_0x3ead8d,_0x14fe36);_0x133a6d(_0x14fe36);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 55387c2..4a0d3f2 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 _0x9960=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','put','isAuthenticated','update','/download_log_file','downloadLogFile'];(function(_0x3ff2f9,_0x544ba1){var _0x3b0913=function(_0x554288){while(--_0x554288){_0x3ff2f9['push'](_0x3ff2f9['shift']());}};_0x3b0913(++_0x544ba1);}(_0x9960,0x15a));var _0x0996=function(_0x6f96e6,_0x23ea02){_0x6f96e6=_0x6f96e6-0x0;var _0xec6891=_0x9960[_0x6f96e6];return _0xec6891;};'use strict';var multer=require(_0x0996('0x0'));var util=require('util');var path=require(_0x0996('0x1'));var timeout=require(_0x0996('0x2'));var express=require('express');var router=express[_0x0996('0x3')]();var fs_extra=require(_0x0996('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0996('0x5'));var config=require(_0x0996('0x6'));var controller=require('./license.controller');router[_0x0996('0x7')]('/',controller[_0x0996('0x8')]);router[_0x0996('0x9')]('/:id',auth[_0x0996('0xa')](),controller[_0x0996('0xb')]);router['get'](_0x0996('0xc'),auth[_0x0996('0xa')](),controller[_0x0996('0xd')]);module[_0x0996('0xe')]=router; \ No newline at end of file +var _0xffda=['express','fs-extra','../../config/environment','./license.controller','get','index','isAuthenticated','/download_log_file','downloadLogFile','exports','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xffda,0x15a));var _0xaffd=function(_0x40ba7f,_0x1a1f13){_0x40ba7f=_0x40ba7f-0x0;var _0x1b3dd5=_0xffda[_0x40ba7f];return _0x1b3dd5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaffd('0x0'));var timeout=require(_0xaffd('0x1'));var express=require(_0xaffd('0x2'));var router=express['Router']();var fs_extra=require(_0xaffd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaffd('0x4'));var controller=require(_0xaffd('0x5'));router[_0xaffd('0x6')]('/',controller[_0xaffd('0x7')]);router['put']('/:id',auth[_0xaffd('0x8')](),controller['update']);router[_0xaffd('0x6')](_0xaffd('0x9'),auth['isAuthenticated'](),controller[_0xaffd('0xa')]);module[_0xaffd('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index acefd36..d170524 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 _0x4162=['exports','TEXT','STRING'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x4162,0x105));var _0x2416=function(_0xfe0e2c,_0x41cf42){_0xfe0e2c=_0xfe0e2c-0x0;var _0x314ae1=_0x4162[_0xfe0e2c];return _0x314ae1;};'use strict';var Sequelize=require('sequelize');module[_0x2416('0x0')]={'license':{'type':Sequelize[_0x2416('0x1')]},'data1':{'type':Sequelize[_0x2416('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb45f=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb45f,0x126));var _0xfb45=function(_0x322374,_0x35fc92){_0x322374=_0x322374-0x0;var _0x14254e=_0xb45f[_0x322374];return _0x14254e;};'use strict';var Sequelize=require(_0xfb45('0x0'));module[_0xfb45('0x1')]={'license':{'type':Sequelize[_0xfb45('0x2')]},'data1':{'type':Sequelize[_0xfb45('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0xfb45('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 4c305e7..ca1756d 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 _0xa903=['keys','filters','intersection','fields','attributes','length','merge','options','catch','body','find','params','get','checkLicense','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','text/plain','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','model','License','rawAttributes','query'];(function(_0xe9af31,_0x5ec5ee){var _0x186c21=function(_0x19f773){while(--_0x19f773){_0xe9af31['push'](_0xe9af31['shift']());}};_0x186c21(++_0x5ec5ee);}(_0xa903,0x1b4));var _0x3a90=function(_0x3cf35a,_0x12009b){_0x3cf35a=_0x3cf35a-0x0;var _0x39d741=_0xa903[_0x3cf35a];return _0x39d741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a90('0x0'));var zipdir=require(_0x3a90('0x1'));var jsonpatch=require(_0x3a90('0x2'));var rp=require(_0x3a90('0x3'));var moment=require(_0x3a90('0x4'));var BPromise=require(_0x3a90('0x5'));var Mustache=require('mustache');var util=require(_0x3a90('0x6'));var path=require(_0x3a90('0x7'));var sox=require(_0x3a90('0x8'));var csv=require(_0x3a90('0x9'));var ejs=require(_0x3a90('0xa'));var fs=require('fs');var fs_extra=require(_0x3a90('0xb'));var _=require('lodash');var squel=require(_0x3a90('0xc'));var crypto=require(_0x3a90('0xd'));var jsforce=require(_0x3a90('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3a90('0x9'));var querystring=require(_0x3a90('0xf'));var Papa=require('papaparse');var Redis=require(_0x3a90('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a90('0x11'));var hardwareService=require(_0x3a90('0x12'));var logger=require('../../config/logger')(_0x3a90('0x13'));var utils=require('../../config/utils');var config=require(_0x3a90('0x14'));var licenseUtil=require(_0x3a90('0x15'));var db=require(_0x3a90('0x16'))['db'];function respondWithStatusCode(_0x144df5,_0x141430){_0x141430=_0x141430||0xcc;return function(_0x38e69f){if(_0x38e69f){return _0x144df5[_0x3a90('0x17')](_0x141430);}return _0x144df5[_0x3a90('0x18')](_0x141430)[_0x3a90('0x19')]();};}function respondWithResult(_0x44d484,_0xa7e364){_0xa7e364=_0xa7e364||0xc8;return function(_0x32c72b){if(_0x32c72b){return _0x44d484[_0x3a90('0x18')](_0xa7e364)[_0x3a90('0x1a')](_0x32c72b);}};}function respondWithFilteredResult(_0x54dafe,_0x428795){return function(_0x44eb1b){if(_0x44eb1b){var _0x4c53cc=typeof _0x428795['offset']===_0x3a90('0x1b')&&typeof _0x428795['limit']===_0x3a90('0x1b');var _0x44e65b=_0x44eb1b[_0x3a90('0x1c')];var _0x1467d3=_0x4c53cc?0x0:_0x428795[_0x3a90('0x1d')];var _0x1cc3bd=_0x4c53cc?_0x44eb1b[_0x3a90('0x1c')]:_0x428795[_0x3a90('0x1d')]+_0x428795[_0x3a90('0x1e')];var _0x194e17;if(_0x1cc3bd>=_0x44e65b){_0x1cc3bd=_0x44e65b;_0x194e17=0xc8;}else{_0x194e17=0xce;}_0x54dafe[_0x3a90('0x18')](_0x194e17);return _0x54dafe[_0x3a90('0x1f')](_0x3a90('0x20'),_0x1467d3+'-'+_0x1cc3bd+'/'+_0x44e65b)['json'](_0x44eb1b);}return null;};}function patchUpdates(_0x270654){return function(_0x1259b7){try{jsonpatch[_0x3a90('0x21')](_0x1259b7,_0x270654,!![]);}catch(_0x210ae9){return BPromise[_0x3a90('0x22')](_0x210ae9);}return _0x1259b7[_0x3a90('0x23')]();};}function saveUpdates(_0x5475b6,_0x3ad726){return function(_0x511092){if(_0x511092){return _0x511092[_0x3a90('0x24')](_0x5475b6)[_0x3a90('0x25')](function(_0x114fe7){return _0x114fe7;});}return null;};}function removeEntity(_0x792ec,_0x1ff878){return function(_0xf83a61){if(_0xf83a61){return _0xf83a61[_0x3a90('0x26')]()['then'](function(){_0x792ec[_0x3a90('0x18')](0xcc)[_0x3a90('0x19')]();});}};}function handleEntityNotFound(_0x420816,_0x124ab7){return function(_0x12b1f1){if(!_0x12b1f1){_0x420816[_0x3a90('0x17')](0x194);}return _0x12b1f1;};}function handleError(_0x3a6dd8,_0x578790){_0x578790=_0x578790||0x1f4;return function(_0x33517c){logger[_0x3a90('0x27')](_0x33517c[_0x3a90('0x28')]);if(_0x33517c[_0x3a90('0x29')]){delete _0x33517c[_0x3a90('0x29')];}_0x3a6dd8[_0x3a90('0x18')](_0x578790)['send'](_0x33517c);};}var utilLicense=require(_0x3a90('0x15'));exports[_0x3a90('0x2a')]=function(_0x39adf5,_0x5ee332){var _0xa2e52e={'raw':!![],'where':{'id':0x1}},_0xa4a5c8={};_0xa4a5c8[_0x3a90('0x2b')]=_['keys'](db[_0x3a90('0x2c')][_0x3a90('0x2d')]);_0xa4a5c8[_0x3a90('0x2e')]=_[_0x3a90('0x2f')](_0x39adf5['query']);_0xa4a5c8[_0x3a90('0x30')]=_[_0x3a90('0x31')](_0xa4a5c8[_0x3a90('0x2b')],_0xa4a5c8[_0x3a90('0x2e')]);_0xa2e52e['attributes']=_[_0x3a90('0x31')](_0xa4a5c8[_0x3a90('0x2b')],qs['fields'](_0x39adf5[_0x3a90('0x2e')][_0x3a90('0x32')]));_0xa2e52e[_0x3a90('0x33')]=_0xa2e52e['attributes'][_0x3a90('0x34')]?_0xa2e52e[_0x3a90('0x33')]:_0xa4a5c8[_0x3a90('0x2b')];_0xa2e52e=_[_0x3a90('0x35')]({},_0xa2e52e,_0x39adf5[_0x3a90('0x36')]);return utilLicense['getLicense'](_0xa2e52e)[_0x3a90('0x25')](respondWithResult(_0x5ee332,null))[_0x3a90('0x37')](handleError(_0x5ee332,null));};exports[_0x3a90('0x24')]=function(_0x43ca34,_0x28a822){if(_0x43ca34[_0x3a90('0x38')]['id']){delete _0x43ca34['body']['id'];}return db['License'][_0x3a90('0x39')]({'where':{'id':_0x43ca34[_0x3a90('0x3a')]['id']}})[_0x3a90('0x25')](handleEntityNotFound(_0x28a822,null))[_0x3a90('0x25')](function(_0x1439d9){var _0x52a638=_0x1439d9[_0x3a90('0x3b')]({'plain':!![]});return utilLicense[_0x3a90('0x3c')](_0x52a638,_0x43ca34['body']['key']);})[_0x3a90('0x25')](function(_0x311a0f){if(!_0x311a0f['demo']){return saveUpdates(_0x43ca34['body'],null);}return _0x311a0f;})[_0x3a90('0x25')](respondWithResult(_0x28a822,null))[_0x3a90('0x37')](handleError(_0x28a822,null));};exports[_0x3a90('0x3d')]=function(_0x420323,_0x13fb79){var _0x20b68e=_0x3a90('0x3e');var _0x20d04d=path[_0x3a90('0x3f')](_0x3a90('0x40'),_0x3a90('0x41'),'xcally',_0x20b68e);_0x13fb79[_0x3a90('0x42')](_0x3a90('0x43'),'attachment;\x20filename='+_0x20b68e);_0x13fb79['set']('Content-Type',_0x3a90('0x44'));_0x13fb79['download'](_0x20d04d);}; \ No newline at end of file +var _0xdce5=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','../../config/license/util','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','length','merge','options','getLicense','catch','update','body','find','params','get','key','demo','downloadLogFile','license-info.log','join','/var','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdce5,0x84));var _0x5dce=function(_0xcd410a,_0x2f320f){_0xcd410a=_0xcd410a-0x0;var _0x4c61bb=_0xdce5[_0xcd410a];return _0x4c61bb;};'use strict';var emlformat=require(_0x5dce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5dce('0x1'));var jsonpatch=require(_0x5dce('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5dce('0x3'));var Mustache=require('mustache');var util=require(_0x5dce('0x4'));var path=require(_0x5dce('0x5'));var sox=require(_0x5dce('0x6'));var csv=require(_0x5dce('0x7'));var ejs=require(_0x5dce('0x8'));var fs=require('fs');var fs_extra=require(_0x5dce('0x9'));var _=require(_0x5dce('0xa'));var squel=require(_0x5dce('0xb'));var crypto=require(_0x5dce('0xc'));var jsforce=require(_0x5dce('0xd'));var deskjs=require(_0x5dce('0xe'));var toCsv=require(_0x5dce('0x7'));var querystring=require('querystring');var Papa=require(_0x5dce('0xf'));var Redis=require(_0x5dce('0x10'));var authService=require(_0x5dce('0x11'));var qs=require(_0x5dce('0x12'));var as=require(_0x5dce('0x13'));var hardwareService=require(_0x5dce('0x14'));var logger=require(_0x5dce('0x15'))(_0x5dce('0x16'));var utils=require(_0x5dce('0x17'));var config=require(_0x5dce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5dce('0x19'))['db'];function respondWithStatusCode(_0x4c9109,_0xa312ec){_0xa312ec=_0xa312ec||0xcc;return function(_0xcea089){if(_0xcea089){return _0x4c9109[_0x5dce('0x1a')](_0xa312ec);}return _0x4c9109[_0x5dce('0x1b')](_0xa312ec)['end']();};}function respondWithResult(_0x15aa3e,_0x4c0136){_0x4c0136=_0x4c0136||0xc8;return function(_0x10f51a){if(_0x10f51a){return _0x15aa3e[_0x5dce('0x1b')](_0x4c0136)[_0x5dce('0x1c')](_0x10f51a);}};}function respondWithFilteredResult(_0x3380eb,_0x27ba52){return function(_0x4e5d47){if(_0x4e5d47){var _0x3f8ced=typeof _0x27ba52['offset']===_0x5dce('0x1d')&&typeof _0x27ba52[_0x5dce('0x1e')]===_0x5dce('0x1d');var _0x119b69=_0x4e5d47[_0x5dce('0x1f')];var _0x438160=_0x3f8ced?0x0:_0x27ba52[_0x5dce('0x20')];var _0x5a1819=_0x3f8ced?_0x4e5d47[_0x5dce('0x1f')]:_0x27ba52[_0x5dce('0x20')]+_0x27ba52[_0x5dce('0x1e')];var _0xc42cce;if(_0x5a1819>=_0x119b69){_0x5a1819=_0x119b69;_0xc42cce=0xc8;}else{_0xc42cce=0xce;}_0x3380eb[_0x5dce('0x1b')](_0xc42cce);return _0x3380eb[_0x5dce('0x21')](_0x5dce('0x22'),_0x438160+'-'+_0x5a1819+'/'+_0x119b69)[_0x5dce('0x1c')](_0x4e5d47);}return null;};}function patchUpdates(_0x4f9632){return function(_0x2e3389){try{jsonpatch[_0x5dce('0x23')](_0x2e3389,_0x4f9632,!![]);}catch(_0x1b6796){return BPromise[_0x5dce('0x24')](_0x1b6796);}return _0x2e3389['save']();};}function saveUpdates(_0x13c1f8,_0x2b7ace){return function(_0x4122f7){if(_0x4122f7){return _0x4122f7['update'](_0x13c1f8)[_0x5dce('0x25')](function(_0x3cb2fe){return _0x3cb2fe;});}return null;};}function removeEntity(_0x33a868,_0x4d757c){return function(_0x5ae933){if(_0x5ae933){return _0x5ae933[_0x5dce('0x26')]()[_0x5dce('0x25')](function(){_0x33a868[_0x5dce('0x1b')](0xcc)[_0x5dce('0x27')]();});}};}function handleEntityNotFound(_0x45c3d1,_0x17123e){return function(_0x115267){if(!_0x115267){_0x45c3d1[_0x5dce('0x1a')](0x194);}return _0x115267;};}function handleError(_0x46ef4b,_0x4c053d){_0x4c053d=_0x4c053d||0x1f4;return function(_0x445f86){logger['error'](_0x445f86[_0x5dce('0x28')]);if(_0x445f86[_0x5dce('0x29')]){delete _0x445f86[_0x5dce('0x29')];}_0x46ef4b[_0x5dce('0x1b')](_0x4c053d)[_0x5dce('0x2a')](_0x445f86);};}var utilLicense=require(_0x5dce('0x2b'));exports[_0x5dce('0x2c')]=function(_0x3c43c9,_0x5d73d3){var _0x2be881={'raw':!![],'where':{'id':0x1}},_0x4cbe83={};_0x4cbe83[_0x5dce('0x2d')]=_[_0x5dce('0x2e')](db[_0x5dce('0x2f')][_0x5dce('0x30')]);_0x4cbe83[_0x5dce('0x31')]=_[_0x5dce('0x2e')](_0x3c43c9[_0x5dce('0x31')]);_0x4cbe83[_0x5dce('0x32')]=_[_0x5dce('0x33')](_0x4cbe83[_0x5dce('0x2d')],_0x4cbe83[_0x5dce('0x31')]);_0x2be881[_0x5dce('0x34')]=_['intersection'](_0x4cbe83[_0x5dce('0x2d')],qs['fields'](_0x3c43c9[_0x5dce('0x31')]['fields']));_0x2be881[_0x5dce('0x34')]=_0x2be881[_0x5dce('0x34')][_0x5dce('0x35')]?_0x2be881['attributes']:_0x4cbe83[_0x5dce('0x2d')];_0x2be881=_[_0x5dce('0x36')]({},_0x2be881,_0x3c43c9[_0x5dce('0x37')]);return utilLicense[_0x5dce('0x38')](_0x2be881)[_0x5dce('0x25')](respondWithResult(_0x5d73d3,null))[_0x5dce('0x39')](handleError(_0x5d73d3,null));};exports[_0x5dce('0x3a')]=function(_0x40bd41,_0x259882){if(_0x40bd41[_0x5dce('0x3b')]['id']){delete _0x40bd41[_0x5dce('0x3b')]['id'];}return db[_0x5dce('0x2f')][_0x5dce('0x3c')]({'where':{'id':_0x40bd41[_0x5dce('0x3d')]['id']}})['then'](handleEntityNotFound(_0x259882,null))[_0x5dce('0x25')](function(_0x54eb9f){var _0x495a2a=_0x54eb9f[_0x5dce('0x3e')]({'plain':!![]});return utilLicense['checkLicense'](_0x495a2a,_0x40bd41[_0x5dce('0x3b')][_0x5dce('0x3f')]);})[_0x5dce('0x25')](function(_0x202748){if(!_0x202748[_0x5dce('0x40')]){return saveUpdates(_0x40bd41[_0x5dce('0x3b')],null);}return _0x202748;})[_0x5dce('0x25')](respondWithResult(_0x259882,null))['catch'](handleError(_0x259882,null));};exports[_0x5dce('0x41')]=function(_0x5a4963,_0x326942){var _0x2aa0bb=_0x5dce('0x42');var _0x55a355=path[_0x5dce('0x43')](_0x5dce('0x44'),'log','xcally',_0x2aa0bb);_0x326942['setHeader']('Content-disposition','attachment;\x20filename='+_0x2aa0bb);_0x326942['set'](_0x5dce('0x45'),_0x5dce('0x46'));_0x326942['download'](_0x55a355);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 39d11c3..663b9d0 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 _0x2bcc=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','define','license'];(function(_0x2146dc,_0x5736a0){var _0x958647=function(_0xca09d){while(--_0xca09d){_0x2146dc['push'](_0x2146dc['shift']());}};_0x958647(++_0x5736a0);}(_0x2bcc,0xbd));var _0xc2bc=function(_0x5e24ad,_0x256b41){_0x5e24ad=_0x5e24ad-0x0;var _0xda92c0=_0x2bcc[_0x5e24ad];return _0xda92c0;};'use strict';var _=require('lodash');var util=require(_0xc2bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc2bc('0x1'));var BPromise=require(_0xc2bc('0x2'));var rp=require(_0xc2bc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc2bc('0x4'));var config=require(_0xc2bc('0x5'));var attributes=require(_0xc2bc('0x6'));module['exports']=function(_0x3036da,_0x57d721){return _0x3036da[_0xc2bc('0x7')]('License',attributes,{'tableName':_0xc2bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa149=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','define','License','license','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa149,0xb5));var _0x9a14=function(_0x1bda7d,_0x803618){_0x1bda7d=_0x1bda7d-0x0;var _0x7ebf01=_0xa149[_0x1bda7d];return _0x7ebf01;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))(_0x9a14('0x3'));var moment=require(_0x9a14('0x4'));var BPromise=require(_0x9a14('0x5'));var rp=require(_0x9a14('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a14('0x7'));var config=require(_0x9a14('0x8'));var attributes=require(_0x9a14('0x9'));module['exports']=function(_0x37d32f,_0x2fdb28){return _0x37d32f[_0x9a14('0xa')](_0x9a14('0xb'),attributes,{'tableName':_0x9a14('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 757a8f0..66f4062 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 _0x245e=['message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x592e08,_0x3936c9){var _0x4184f9=function(_0x48e893){while(--_0x48e893){_0x592e08['push'](_0x592e08['shift']());}};_0x4184f9(++_0x3936c9);}(_0x245e,0x192));var _0xe245=function(_0x214df1,_0x424c52){_0x214df1=_0x214df1-0x0;var _0x32216c=_0x245e[_0x214df1];return _0x32216c;};'use strict';var _=require(_0xe245('0x0'));var util=require(_0xe245('0x1'));var moment=require(_0xe245('0x2'));var BPromise=require('bluebird');var rs=require(_0xe245('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe245('0x4'))['db'];var utils=require(_0xe245('0x5'));var logger=require('../../config/logger')(_0xe245('0x6'));var config=require(_0xe245('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe245('0x8')][_0xe245('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8a33,_0x3f9ff1,_0x199643){return new BPromise(function(_0x35ae77,_0xcb6c56){return client[_0xe245('0xa')](_0x2c8a33,_0x199643)[_0xe245('0xb')](function(_0x12bd24){logger['info'](_0xe245('0xc'),_0x3f9ff1,'request\x20sent');logger[_0xe245('0xd')](_0xe245('0xe'),_0x3f9ff1,_0xe245('0xf'),JSON[_0xe245('0x10')](_0x12bd24));if(_0x12bd24[_0xe245('0x11')]){if(_0x12bd24[_0xe245('0x11')]['code']===0x1f4){logger['error'](_0xe245('0xc'),_0x3f9ff1,_0x12bd24[_0xe245('0x11')][_0xe245('0x12')]);return _0xcb6c56(_0x12bd24[_0xe245('0x11')]['message']);}logger['error']('License,\x20%s,\x20%s',_0x3f9ff1,_0x12bd24['error'][_0xe245('0x12')]);return _0x35ae77(_0x12bd24['error'][_0xe245('0x12')]);}else{logger[_0xe245('0x13')](_0xe245('0xc'),_0x3f9ff1,_0xe245('0xf'));_0x35ae77(_0x12bd24['result'][_0xe245('0x12')]);}})[_0xe245('0x14')](function(_0x195798){logger[_0xe245('0x11')](_0xe245('0xc'),_0x3f9ff1,_0x195798);_0xcb6c56(_0x195798);});});} \ No newline at end of file +var _0xdf63=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring'];(function(_0x1e373c,_0x426350){var _0x3f6878=function(_0x471af2){while(--_0x471af2){_0x1e373c['push'](_0x1e373c['shift']());}};_0x3f6878(++_0x426350);}(_0xdf63,0xc1));var _0x3df6=function(_0x11e001,_0xb3367b){_0x11e001=_0x11e001-0x0;var _0x417419=_0xdf63[_0x11e001];return _0x417419;};'use strict';var _=require(_0x3df6('0x0'));var util=require(_0x3df6('0x1'));var moment=require(_0x3df6('0x2'));var BPromise=require(_0x3df6('0x3'));var rs=require(_0x3df6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3df6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3df6('0x6'))(_0x3df6('0x7'));var config=require(_0x3df6('0x8'));var jayson=require(_0x3df6('0x9'));var client=jayson[_0x3df6('0xa')][_0x3df6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1187cf,_0x53e352,_0x15ce53){return new BPromise(function(_0x474bca,_0x16dfc9){return client[_0x3df6('0xc')](_0x1187cf,_0x15ce53)['then'](function(_0x323611){logger[_0x3df6('0xd')](_0x3df6('0xe'),_0x53e352,'request\x20sent');logger[_0x3df6('0xf')](_0x3df6('0x10'),_0x53e352,'request\x20sent',JSON[_0x3df6('0x11')](_0x323611));if(_0x323611[_0x3df6('0x12')]){if(_0x323611[_0x3df6('0x12')]['code']===0x1f4){logger[_0x3df6('0x12')](_0x3df6('0xe'),_0x53e352,_0x323611[_0x3df6('0x12')][_0x3df6('0x13')]);return _0x16dfc9(_0x323611[_0x3df6('0x12')][_0x3df6('0x13')]);}logger['error'](_0x3df6('0xe'),_0x53e352,_0x323611[_0x3df6('0x12')][_0x3df6('0x13')]);return _0x474bca(_0x323611[_0x3df6('0x12')][_0x3df6('0x13')]);}else{logger[_0x3df6('0xd')]('License,\x20%s,\x20%s',_0x53e352,_0x3df6('0x14'));_0x474bca(_0x323611[_0x3df6('0x15')][_0x3df6('0x13')]);}})['catch'](function(_0x122903){logger[_0x3df6('0x12')](_0x3df6('0xe'),_0x53e352,_0x122903);_0x16dfc9(_0x122903);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index d3d3555..bd850b2 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 _0xd968=['update','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','create','addSmtp','addInteraction','addApplications','send','addAgents','put'];(function(_0x5d4db8,_0x4ad01b){var _0x415548=function(_0x7ae456){while(--_0x7ae456){_0x5d4db8['push'](_0x5d4db8['shift']());}};_0x415548(++_0x4ad01b);}(_0xd968,0x1bf));var _0x8d96=function(_0x4cbb83,_0x458799){_0x4cbb83=_0x4cbb83-0x0;var _0x1a56ab=_0xd968[_0x4cbb83];return _0x1a56ab;};'use strict';var multer=require(_0x8d96('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8d96('0x1'));var express=require(_0x8d96('0x2'));var router=express['Router']();var fs_extra=require(_0x8d96('0x3'));var auth=require(_0x8d96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8d96('0x5'));var controller=require(_0x8d96('0x6'));router['get']('/',auth[_0x8d96('0x7')](),controller[_0x8d96('0x8')]);router['get']('/describe',auth[_0x8d96('0x7')](),controller[_0x8d96('0x9')]);router[_0x8d96('0xa')](_0x8d96('0xb'),auth[_0x8d96('0x7')](),controller[_0x8d96('0xc')]);router[_0x8d96('0xa')](_0x8d96('0xd'),auth[_0x8d96('0x7')](),controller[_0x8d96('0xe')]);router[_0x8d96('0xa')](_0x8d96('0xf'),auth['isAuthenticated'](),controller[_0x8d96('0x10')]);router['get'](_0x8d96('0x11'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x12')]);router['get']('/:id/out_servers',auth[_0x8d96('0x7')](),controller['getSmtp']);router[_0x8d96('0xa')](_0x8d96('0x13'),auth['isAuthenticated'](),controller[_0x8d96('0x14')]);router[_0x8d96('0xa')](_0x8d96('0x15'),auth['isAuthenticated'](),controller[_0x8d96('0x16')]);router[_0x8d96('0xa')]('/:id/messages',auth[_0x8d96('0x7')](),controller[_0x8d96('0x17')]);router[_0x8d96('0xa')](_0x8d96('0x18'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x19')]);router[_0x8d96('0xa')](_0x8d96('0x1a'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x1b')]);router[_0x8d96('0x1c')](_0x8d96('0xd'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x1d')]);router[_0x8d96('0x1c')](_0x8d96('0xf'),auth[_0x8d96('0x7')](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0x8d96('0x1e')]);router[_0x8d96('0x1c')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router['post']('/:id/out_servers',auth[_0x8d96('0x7')](),controller[_0x8d96('0x1f')]);router[_0x8d96('0x1c')](_0x8d96('0x13'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x20')]);router[_0x8d96('0x1c')](_0x8d96('0x15'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x21')]);router[_0x8d96('0x1c')]('/:id/send',auth['isAuthenticated'](),controller[_0x8d96('0x22')]);router['post']('/:id/users',auth[_0x8d96('0x7')](),controller[_0x8d96('0x23')]);router[_0x8d96('0x24')](_0x8d96('0xb'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x25')]);router['delete']('/:id/dispositions',auth[_0x8d96('0x7')](),controller['removeDispositions']);router[_0x8d96('0x26')]('/:id/canned_answers',auth[_0x8d96('0x7')](),controller['removeAnswers']);router[_0x8d96('0x26')](_0x8d96('0x11'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x27')]);router['delete']('/:id/out_servers',auth[_0x8d96('0x7')](),controller[_0x8d96('0x28')]);router[_0x8d96('0x26')](_0x8d96('0xb'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x29')]);router[_0x8d96('0x26')](_0x8d96('0x1a'),auth[_0x8d96('0x7')](),controller[_0x8d96('0x2a')]);module[_0x8d96('0x2b')]=router; \ No newline at end of file +var _0x6b76=['/:id/messages','getMessages','/:id/verify','getAgents','post','addDisposition','/:id/interactions','addApplications','/:id/send','/:id/users','addAgents','put','delete','removeDispositions','removeAnswers','/:id/in_servers','destroy','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/out_servers','getSmtp','getInteractions','/:id/applications'];(function(_0x443609,_0x2af171){var _0x2cc80f=function(_0x20036a){while(--_0x20036a){_0x443609['push'](_0x443609['shift']());}};_0x2cc80f(++_0x2af171);}(_0x6b76,0xb3));var _0x66b7=function(_0x24f84a,_0x273dc8){_0x24f84a=_0x24f84a-0x0;var _0xb081c2=_0x6b76[_0x24f84a];return _0xb081c2;};'use strict';var multer=require(_0x66b7('0x0'));var util=require('util');var path=require(_0x66b7('0x1'));var timeout=require('connect-timeout');var express=require(_0x66b7('0x2'));var router=express[_0x66b7('0x3')]();var fs_extra=require(_0x66b7('0x4'));var auth=require(_0x66b7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x66b7('0x6'));var controller=require(_0x66b7('0x7'));router[_0x66b7('0x8')]('/',auth[_0x66b7('0x9')](),controller[_0x66b7('0xa')]);router[_0x66b7('0x8')]('/describe',auth[_0x66b7('0x9')](),controller['describe']);router[_0x66b7('0x8')](_0x66b7('0xb'),auth['isAuthenticated'](),controller[_0x66b7('0xc')]);router[_0x66b7('0x8')](_0x66b7('0xd'),auth[_0x66b7('0x9')](),controller[_0x66b7('0xe')]);router[_0x66b7('0x8')](_0x66b7('0xf'),auth[_0x66b7('0x9')](),controller[_0x66b7('0x10')]);router['get']('/:id/in_servers',auth[_0x66b7('0x9')](),controller['getImap']);router[_0x66b7('0x8')](_0x66b7('0x11'),auth[_0x66b7('0x9')](),controller[_0x66b7('0x12')]);router[_0x66b7('0x8')]('/:id/interactions',auth[_0x66b7('0x9')](),controller[_0x66b7('0x13')]);router[_0x66b7('0x8')](_0x66b7('0x14'),auth[_0x66b7('0x9')](),controller['getApplications']);router[_0x66b7('0x8')](_0x66b7('0x15'),auth['isAuthenticated'](),controller[_0x66b7('0x16')]);router['get'](_0x66b7('0x17'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x66b7('0x8')]('/:id/users',auth[_0x66b7('0x9')](),controller[_0x66b7('0x18')]);router[_0x66b7('0x19')](_0x66b7('0xd'),auth['isAuthenticated'](),controller[_0x66b7('0x1a')]);router['post'](_0x66b7('0xf'),auth[_0x66b7('0x9')](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x66b7('0x19')]('/:id/in_servers',auth[_0x66b7('0x9')](),controller['addImap']);router[_0x66b7('0x19')]('/:id/out_servers',auth[_0x66b7('0x9')](),controller['addSmtp']);router[_0x66b7('0x19')](_0x66b7('0x1b'),auth[_0x66b7('0x9')](),controller['addInteraction']);router[_0x66b7('0x19')]('/:id/applications',auth[_0x66b7('0x9')](),controller[_0x66b7('0x1c')]);router[_0x66b7('0x19')](_0x66b7('0x1d'),auth[_0x66b7('0x9')](),controller['send']);router[_0x66b7('0x19')](_0x66b7('0x1e'),auth[_0x66b7('0x9')](),controller[_0x66b7('0x1f')]);router[_0x66b7('0x20')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x66b7('0x21')](_0x66b7('0xd'),auth[_0x66b7('0x9')](),controller[_0x66b7('0x22')]);router[_0x66b7('0x21')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x66b7('0x23')]);router[_0x66b7('0x21')](_0x66b7('0x24'),auth[_0x66b7('0x9')](),controller['removeImap']);router['delete'](_0x66b7('0x11'),auth[_0x66b7('0x9')](),controller['removeSmtp']);router[_0x66b7('0x21')](_0x66b7('0xb'),auth[_0x66b7('0x9')](),controller[_0x66b7('0x25')]);router[_0x66b7('0x21')](_0x66b7('0x1e'),auth[_0x66b7('0x9')](),controller[_0x66b7('0x26')]);module[_0x66b7('0x27')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7733c7a..5eb9234 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 _0x2bc0=['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}}','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','yahoo','outlook365','getDataValue','custom','provider'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x2bc0,0x1d4));var _0x02bc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2bc0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x02bc('0x0'));module[_0x02bc('0x1')]={'description':{'type':Sequelize[_0x02bc('0x2')]},'name':{'type':Sequelize[_0x02bc('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x02bc('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x02bc('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x02bc('0x4')]},'markAsUnread':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x02bc('0x5')},'fontSize':{'type':Sequelize[_0x02bc('0x6')](0x2)[_0x02bc('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x02bc('0x4')],'defaultValue':function(){return _0x02bc('0x8');}},'notificationSound':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x02bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x02bc('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x02bc('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x02bc('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[_0x02bc('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5e4df3){if(!_0x5e4df3)this[_0x02bc('0x9')](_0x02bc('0xa'),null);this[_0x02bc('0x9')]('mandatoryDisposition',_0x5e4df3);}},'provider':{'type':Sequelize[_0x02bc('0xb')](_0x02bc('0xc'),'hotmail',_0x02bc('0xd'),_0x02bc('0xe')),'defaultValue':null,'get':function(){var _0xd5eee=this[_0x02bc('0xf')]('provider');return _0xd5eee||_0x02bc('0x10');},'set':function(_0x27a88f){if(_0x27a88f===_0x02bc('0x10')){_0x27a88f=null;}return this[_0x02bc('0x9')](_0x02bc('0x11'),_0x27a88f);}}}; \ No newline at end of file +var _0xe8c7=['provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xe8c7,0xdf));var _0x7e8c=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xe8c7[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x7e8c('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7e8c('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x7e8c('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7e8c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7e8c('0x3')]},'markAsUnread':{'type':Sequelize[_0x7e8c('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7e8c('0x1')],'allowNull':![],'defaultValue':_0x7e8c('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x7e8c('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7e8c('0x6');}},'notificationSound':{'type':Sequelize[_0x7e8c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e8c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7e8c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7e8c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7e8c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e8c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e8c('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7e8c('0x2')],'defaultValue':![],'comment':_0x7e8c('0x8'),'set':function(_0x452352){if(!_0x452352)this['setDataValue'](_0x7e8c('0x9'),null);this[_0x7e8c('0xa')](_0x7e8c('0xb'),_0x452352);}},'provider':{'type':Sequelize[_0x7e8c('0xc')](_0x7e8c('0xd'),'hotmail',_0x7e8c('0xe'),'outlook365'),'defaultValue':null,'get':function(){var _0x107acf=this['getDataValue'](_0x7e8c('0xf'));return _0x107acf||_0x7e8c('0x10');},'set':function(_0x293dee){if(_0x293dee===_0x7e8c('0x10')){_0x293dee=null;}return this[_0x7e8c('0xa')](_0x7e8c('0xf'),_0x293dee);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4f1fedf..446c482 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 _0x7656=['yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','authentication','Imap','Smtp','Pause','mandatoryDispositionPause','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','MailAccount','includeAll','include','findAll','catch','show','params','MailServerIn','MailServerOut','rawAttributes','body','custom','provider','find','Mail\x20Account\x20not\x20found','service','describe','Disposition','create','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','key','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','MailMessage','$gte','split','format','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','name','gmail','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com'];(function(_0x4a7c18,_0x103341){var _0x171c14=function(_0x2de69c){while(--_0x2de69c){_0x4a7c18['push'](_0x4a7c18['shift']());}};_0x171c14(++_0x103341);}(_0x7656,0x98));var _0x6765=function(_0x2660de,_0x52a72d){_0x2660de=_0x2660de-0x0;var _0x41365e=_0x7656[_0x2660de];return _0x41365e;};'use strict';var moment=require(_0x6765('0x0'));var BPromise=require(_0x6765('0x1'));var util=require(_0x6765('0x2'));var path=require(_0x6765('0x3'));var _=require(_0x6765('0x4'));var juice=require(_0x6765('0x5'));var Redis=require('ioredis');var qs=require(_0x6765('0x6'));var logger=require(_0x6765('0x7'))('api');var config=require(_0x6765('0x8'));var db=require(_0x6765('0x9'))['db'];config[_0x6765('0xa')]=_[_0x6765('0xb')](config[_0x6765('0xa')],{'host':_0x6765('0xc'),'port':0x18eb});var socket=require(_0x6765('0xd'))(new Redis(config['redis']));require(_0x6765('0xe'))[_0x6765('0xf')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x6765('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x30e990,_0x514371,_0x5035db,_0x1f2c3a){return new BPromise(function(_0x2be985,_0x579157){var _0xca2264=_0x1f2c3a||client;return _0xca2264['request'](_0x30e990,_0x5035db)[_0x6765('0x11')](function(_0x43e7f5){logger['info'](_0x6765('0x12'),_0x514371,_0x6765('0x13'));logger[_0x6765('0x14')](_0x6765('0x15'),_0x514371,'request\x20sent',JSON[_0x6765('0x16')](_0x43e7f5));if(_0x43e7f5[_0x6765('0x17')]){if(_0x43e7f5[_0x6765('0x17')][_0x6765('0x18')]===0x1f4){logger[_0x6765('0x17')](_0x6765('0x12'),_0x514371,_0x43e7f5[_0x6765('0x17')][_0x6765('0x19')]);return _0x579157(_0x43e7f5['error']['message']);}logger[_0x6765('0x17')](_0x6765('0x12'),_0x514371,_0x43e7f5[_0x6765('0x17')][_0x6765('0x19')]);return _0x2be985(_0x43e7f5['error']['message']);}else{logger[_0x6765('0x1a')](_0x6765('0x12'),_0x514371,_0x6765('0x13'));_0x2be985(_0x43e7f5[_0x6765('0x1b')][_0x6765('0x19')]);}})['catch'](function(_0x195ddc){logger[_0x6765('0x17')](_0x6765('0x12'),_0x514371,_0x195ddc);_0x579157(_0x195ddc);});});}function respondWithStatusCode(_0x2bee64,_0x29ac76){_0x29ac76=_0x29ac76||0xcc;return function(_0x189856){if(_0x189856){return _0x2bee64[_0x6765('0x1c')](_0x29ac76);}return _0x2bee64[_0x6765('0x1d')](_0x29ac76)[_0x6765('0x1e')]();};}function respondWithResult(_0x2ed762,_0x2add36){_0x2add36=_0x2add36||0xc8;return function(_0x4568ff){if(_0x4568ff){return _0x2ed762[_0x6765('0x1d')](_0x2add36)[_0x6765('0x1f')](_0x4568ff);}};}function respondWithFilteredResult(_0x4c3354,_0x2309fb){return function(_0x4a2d61){if(_0x4a2d61){var _0x28b47c=typeof _0x2309fb[_0x6765('0x20')]===_0x6765('0x21')&&typeof _0x2309fb[_0x6765('0x22')]==='undefined';var _0x36bf9c=_0x4a2d61[_0x6765('0x23')];var _0x565041=_0x28b47c?0x0:_0x2309fb[_0x6765('0x20')];var _0x1714c5=_0x28b47c?_0x4a2d61[_0x6765('0x23')]:_0x2309fb[_0x6765('0x20')]+_0x2309fb['limit'];var _0x4b99d0;if(_0x1714c5>=_0x36bf9c){_0x1714c5=_0x36bf9c;_0x4b99d0=0xc8;}else{_0x4b99d0=0xce;}_0x4c3354[_0x6765('0x1d')](_0x4b99d0);return _0x4c3354[_0x6765('0x24')](_0x6765('0x25'),_0x565041+'-'+_0x1714c5+'/'+_0x36bf9c)[_0x6765('0x1f')](_0x4a2d61);}return null;};}function saveUpdates(_0xf68e30){return function(_0x222eb4){if(_0x222eb4){return _0x222eb4[_0x6765('0x26')](_0xf68e30)['then'](function(_0x1de850){return _0x1de850;});}return null;};}function removeEntity(_0x4b6d0d){return function(_0x606d7b){if(_0x606d7b){return _0x606d7b[_0x6765('0x27')]()[_0x6765('0x11')](function(){var _0x2ee2de=_0x606d7b[_0x6765('0x28')]({'plain':!![]});var _0x94fed2=_0x6765('0x29');return db[_0x6765('0x2a')][_0x6765('0x27')]({'where':{'type':_0x94fed2,'resourceId':_0x2ee2de['id']}})[_0x6765('0x11')](function(){return _0x606d7b;});})[_0x6765('0x11')](function(){_0x4b6d0d['status'](0xcc)[_0x6765('0x1e')]();});}};}function handleEntityNotFound(_0x953d1b){return function(_0x2c6bbb){if(!_0x2c6bbb){_0x953d1b[_0x6765('0x1c')](0x194);}return _0x2c6bbb;};}function handleError(_0x2abf1b,_0x3cb386){_0x3cb386=_0x3cb386||0x1f4;return function(_0x2daeb6){logger[_0x6765('0x17')](_0x2daeb6['stack']);if(_0x2daeb6[_0x6765('0x2b')]){delete _0x2daeb6[_0x6765('0x2b')];}_0x2abf1b[_0x6765('0x1d')](_0x3cb386)['send'](_0x2daeb6);};}function getImapHost(_0x3e1efa){switch(_0x3e1efa){case _0x6765('0x2c'):return'imap.gmail.com';case'yahoo':return _0x6765('0x2d');case'hotmail':return _0x6765('0x2e');case _0x6765('0x2f'):return _0x6765('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3e1efa);}function getSmtpHost(_0x2e3e50){switch(_0x2e3e50){case'gmail':return _0x6765('0x31');case _0x6765('0x32'):return _0x6765('0x33');case'hotmail':return _0x6765('0x34');case'outlook365':return _0x6765('0x35');}throw new Error(_0x6765('0x36'),_0x2e3e50);}function getAuthenticationOptions(_0x590375,_0x20650c){var _0x5999a6={};var _0x531bf0={};if(_0x590375){_0x5999a6['user']=_0x531bf0[_0x6765('0x37')]=_0x20650c[_0x6765('0x38')];_0x5999a6[_0x6765('0x39')]=_0x531bf0[_0x6765('0x3a')]=_0x20650c[_0x6765('0x39')];if(_0x20650c[_0x6765('0x3b')]){_0x5999a6[_0x6765('0x3b')]=_0x531bf0[_0x6765('0x3b')]=!![];_0x5999a6[_0x6765('0x3c')]=_0x531bf0[_0x6765('0x3c')]=_0x20650c[_0x6765('0x3c')];_0x5999a6[_0x6765('0x39')]=_0x531bf0['pass']=null;}else{_0x5999a6[_0x6765('0x3c')]=_0x531bf0[_0x6765('0x3c')]=null;}_0x5999a6[_0x6765('0x3d')]=getImapHost(_0x590375);_0x5999a6[_0x6765('0x3e')]=0x3e1;_0x531bf0[_0x6765('0x3d')]=getSmtpHost(_0x590375);_0x531bf0[_0x6765('0x3e')]=0x24b;_0x531bf0[_0x6765('0x3f')]=![];_0x5999a6['service']=_0x531bf0['service']=null;}else{if(_0x20650c[_0x6765('0x40')]){_0x5999a6[_0x6765('0x37')]=_0x531bf0[_0x6765('0x37')]=_0x20650c[_0x6765('0x38')];_0x5999a6[_0x6765('0x39')]=_0x531bf0['pass']=_0x20650c[_0x6765('0x39')];}else{_0x5999a6[_0x6765('0x40')]=_0x531bf0[_0x6765('0x40')]=![];_0x5999a6[_0x6765('0x37')]=_0x531bf0[_0x6765('0x37')]=null;_0x5999a6[_0x6765('0x39')]=_0x531bf0[_0x6765('0x3a')]=null;}_0x5999a6[_0x6765('0x3d')]=_0x20650c[_0x6765('0x41')]['host'];_0x5999a6[_0x6765('0x3e')]=_0x20650c['Imap']['port'];_0x531bf0[_0x6765('0x3d')]=_0x20650c['Smtp']['host'];_0x531bf0[_0x6765('0x3e')]=_0x20650c[_0x6765('0x42')][_0x6765('0x3e')];}return{'Imap':_0x5999a6,'Smtp':_0x531bf0};}exports['index']=function(_0x4f67bf,_0x286e46){var _0x54ebf1={'include':[{'model':db['MailServerIn'],'as':_0x6765('0x41')},{'model':db['MailServerOut'],'as':_0x6765('0x42')},{'model':db[_0x6765('0x43')],'as':_0x6765('0x44')}]},_0xf6929={},_0x541ec2={'count':0x0,'rows':[]};var _0x48951f=_[_0x6765('0x45')](db['MailAccount']['rawAttributes'],function(_0x41282c){return{'name':_0x41282c[_0x6765('0x46')],'type':_0x41282c[_0x6765('0x47')]['key']};});_0xf6929[_0x6765('0x48')]=_[_0x6765('0x45')](_0x48951f,_0x6765('0x2b'));_0xf6929[_0x6765('0x49')]=_[_0x6765('0x4a')](_0x4f67bf[_0x6765('0x49')]);_0xf6929['filters']=_['intersection'](_0xf6929['model'],_0xf6929[_0x6765('0x49')]);_0x54ebf1['attributes']=_[_0x6765('0x4b')](_0xf6929[_0x6765('0x48')],qs[_0x6765('0x4c')](_0x4f67bf[_0x6765('0x49')][_0x6765('0x4c')]));_0x54ebf1[_0x6765('0x4d')]=_0x54ebf1[_0x6765('0x4d')][_0x6765('0x4e')]?_0x54ebf1[_0x6765('0x4d')]:_0xf6929[_0x6765('0x48')];if(!_0x4f67bf[_0x6765('0x49')][_0x6765('0x4f')](_0x6765('0x50'))){_0x54ebf1['limit']=qs[_0x6765('0x22')](_0x4f67bf[_0x6765('0x49')]['limit']);_0x54ebf1[_0x6765('0x20')]=qs[_0x6765('0x20')](_0x4f67bf[_0x6765('0x49')][_0x6765('0x20')]);}_0x54ebf1[_0x6765('0x51')]=qs[_0x6765('0x52')](_0x4f67bf[_0x6765('0x49')][_0x6765('0x52')]);_0x54ebf1[_0x6765('0x53')]=qs[_0x6765('0x54')](_['pick'](_0x4f67bf[_0x6765('0x49')],_0xf6929[_0x6765('0x54')]),_0x48951f);if(_0x4f67bf['query'][_0x6765('0x55')]){_0x54ebf1['where']=_[_0x6765('0x56')](_0x54ebf1[_0x6765('0x53')],{'$or':_[_0x6765('0x45')](_0x48951f,function(_0x3a7ad6){if(_0x3a7ad6[_0x6765('0x47')]!==_0x6765('0x57')){var _0x3e1122={};_0x3e1122[_0x3a7ad6[_0x6765('0x2b')]]={'$like':'%'+_0x4f67bf[_0x6765('0x49')][_0x6765('0x55')]+'%'};return _0x3e1122;}})});}_0x54ebf1=_[_0x6765('0x56')]({},_0x54ebf1,_0x4f67bf[_0x6765('0x58')]);var _0x3804a7={'where':_0x54ebf1[_0x6765('0x53')]};return db[_0x6765('0x59')][_0x6765('0x23')](_0x3804a7)[_0x6765('0x11')](function(_0x28fe42){_0x541ec2[_0x6765('0x23')]=_0x28fe42;if(_0x4f67bf['query'][_0x6765('0x5a')]){_0x54ebf1[_0x6765('0x5b')]=[{'all':!![]}];}return db[_0x6765('0x59')][_0x6765('0x5c')](_0x54ebf1);})[_0x6765('0x11')](function(_0x53ca80){_0x541ec2['rows']=_0x53ca80;return _0x541ec2;})[_0x6765('0x11')](respondWithFilteredResult(_0x286e46,_0x54ebf1))[_0x6765('0x5d')](handleError(_0x286e46,null));};exports[_0x6765('0x5e')]=function(_0x2432aa,_0x31e39d){var _0x60753b={'raw':![],'where':{'id':_0x2432aa[_0x6765('0x5f')]['id']},'include':[{'model':db[_0x6765('0x60')],'as':_0x6765('0x41')},{'model':db[_0x6765('0x61')],'as':_0x6765('0x42')},{'model':db[_0x6765('0x43')],'as':_0x6765('0x44')}]},_0x50818e={};_0x50818e[_0x6765('0x48')]=_[_0x6765('0x4a')](db[_0x6765('0x59')][_0x6765('0x62')]);_0x50818e[_0x6765('0x49')]=_[_0x6765('0x4a')](_0x2432aa[_0x6765('0x49')]);_0x50818e[_0x6765('0x54')]=_['intersection'](_0x50818e[_0x6765('0x48')],_0x50818e[_0x6765('0x49')]);_0x60753b['attributes']=_['intersection'](_0x50818e[_0x6765('0x48')],qs['fields'](_0x2432aa[_0x6765('0x49')][_0x6765('0x4c')]));_0x60753b[_0x6765('0x4d')]=_0x60753b['attributes']['length']?_0x60753b['attributes']:_0x50818e['model'];if(_0x2432aa[_0x6765('0x49')][_0x6765('0x5a')]){_0x60753b[_0x6765('0x5b')]=[{'all':!![]}];}_0x60753b=_['merge']({},_0x60753b,_0x2432aa[_0x6765('0x58')]);return db['MailAccount']['find'](_0x60753b)['then'](handleEntityNotFound(_0x31e39d,null))['then'](respondWithResult(_0x31e39d,null))[_0x6765('0x5d')](handleError(_0x31e39d,null));};exports[_0x6765('0x26')]=function(_0x37e451,_0x243ea2){if(_0x37e451['body']['id']){delete _0x37e451['body']['id'];}var _0x306786=_0x37e451[_0x6765('0x63')]['provider']===_0x6765('0x64')?null:_0x37e451[_0x6765('0x63')][_0x6765('0x65')];var _0x513d55=_0x37e451['body'][_0x6765('0x41')]||{};var _0xd79508=_0x37e451[_0x6765('0x63')][_0x6765('0x42')]||{};if(_0x306786){_0x513d55[_0x6765('0x3d')]=getImapHost(_0x306786);_0x513d55[_0x6765('0x3e')]=0x3e1;_0xd79508[_0x6765('0x3d')]=getSmtpHost(_0x306786);_0xd79508['port']=0x24b;_0xd79508['secure']=![];}if(_0xd79508['modernAuthentication']){_0xd79508[_0x6765('0x3f')]=![];}else{_0xd79508['CloudProviderId']=null;}if(!_0x513d55[_0x6765('0x3b')])_0x513d55[_0x6765('0x3c')]=null;_0x37e451['body'][_0x6765('0x41')]=_0x513d55;_0x37e451[_0x6765('0x63')][_0x6765('0x42')]=_0xd79508;return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x37e451[_0x6765('0x5f')]['id']},'include':[{'model':db[_0x6765('0x60')],'as':_0x6765('0x41')},{'model':db[_0x6765('0x61')],'as':_0x6765('0x42')},{'model':db[_0x6765('0x43')],'as':_0x6765('0x44')}]})[_0x6765('0x11')](handleEntityNotFound(_0x243ea2,null))[_0x6765('0x11')](function(_0x2cf3fd){if(!_0x2cf3fd)throw new Error(_0x6765('0x67'));if(_0x2cf3fd[_0x6765('0x68')])delete _0x37e451[_0x6765('0x63')][_0x6765('0x41')];return _0x2cf3fd;})[_0x6765('0x11')](saveUpdates(_0x37e451[_0x6765('0x63')],null))[_0x6765('0x11')](function(_0x316850){if(!_0x37e451['body'][_0x6765('0x41')])return _0x316850;return db[_0x6765('0x60')][_0x6765('0x26')](_0x37e451[_0x6765('0x63')][_0x6765('0x41')],{'where':{'MailAccountId':_0x316850['id']}})['then'](function(){return _0x316850;});})[_0x6765('0x11')](function(_0xb6c4e3){if(!_0x37e451[_0x6765('0x63')]['Smtp'])return _0xb6c4e3;return db[_0x6765('0x61')][_0x6765('0x26')](_0x37e451[_0x6765('0x63')][_0x6765('0x42')],{'where':{'MailAccountId':_0xb6c4e3['id']}})[_0x6765('0x11')](function(){return _0xb6c4e3;});})[_0x6765('0x11')](respondWithResult(_0x243ea2,null))[_0x6765('0x5d')](handleError(_0x243ea2,null));};exports[_0x6765('0x69')]=function(_0x168cb5,_0x3c7499){return db[_0x6765('0x59')][_0x6765('0x69')]()[_0x6765('0x11')](respondWithResult(_0x3c7499,null))[_0x6765('0x5d')](handleError(_0x3c7499,null));};exports['addDisposition']=function(_0x5aae4a,_0x166979){if(_0x5aae4a[_0x6765('0x63')]['id']){delete _0x5aae4a['body']['id'];}return db['MailAccount'][_0x6765('0x66')]({'where':{'id':_0x5aae4a['params']['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x166979,null))[_0x6765('0x11')](function(_0x5679be){if(_0x5679be){_0x5aae4a[_0x6765('0x63')]['MailAccountId']=_0x5679be['id'];return db[_0x6765('0x6a')][_0x6765('0x6b')](_0x5aae4a[_0x6765('0x63')]);}})[_0x6765('0x11')](respondWithResult(_0x166979,null))[_0x6765('0x5d')](handleError(_0x166979,null));};exports[_0x6765('0x6c')]=function(_0x405bc0,_0x1ae908){var _0x456da2={'raw':![],'where':{}};var _0x230998={};var _0x20ec2f={'count':0x0,'rows':[]};return db[_0x6765('0x59')][_0x6765('0x6d')]({'where':{'id':_0x405bc0[_0x6765('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1ae908,null))[_0x6765('0x11')](function(_0x2629af){if(_0x2629af){_0x230998['model']=_[_0x6765('0x4a')](db[_0x6765('0x6a')][_0x6765('0x62')]);_0x230998[_0x6765('0x49')]=_[_0x6765('0x4a')](_0x405bc0['query']);_0x230998[_0x6765('0x54')]=_[_0x6765('0x4b')](_0x230998[_0x6765('0x48')],_0x230998[_0x6765('0x49')]);_0x456da2[_0x6765('0x4d')]=_[_0x6765('0x4b')](_0x230998[_0x6765('0x48')],qs['fields'](_0x405bc0[_0x6765('0x49')][_0x6765('0x4c')]));_0x456da2[_0x6765('0x4d')]=_0x456da2[_0x6765('0x4d')][_0x6765('0x4e')]?_0x456da2[_0x6765('0x4d')]:_0x230998['model'];if(!_0x405bc0[_0x6765('0x49')][_0x6765('0x4f')](_0x6765('0x50'))){_0x456da2[_0x6765('0x22')]=qs[_0x6765('0x22')](_0x405bc0['query'][_0x6765('0x22')]);_0x456da2['offset']=qs['offset'](_0x405bc0[_0x6765('0x49')]['offset']);}_0x456da2[_0x6765('0x51')]=qs[_0x6765('0x52')](_0x405bc0[_0x6765('0x49')][_0x6765('0x52')]);_0x456da2[_0x6765('0x53')]=qs[_0x6765('0x54')](_[_0x6765('0x6e')](_0x405bc0['query'],_0x230998[_0x6765('0x54')]));_0x456da2[_0x6765('0x53')]['MailAccountId']=_0x2629af['id'];if(_0x405bc0[_0x6765('0x49')][_0x6765('0x55')]){_0x456da2[_0x6765('0x53')]=_[_0x6765('0x56')](_0x456da2[_0x6765('0x53')],{'$or':_['map'](_0x456da2['attributes'],function(_0x483d33){var _0x538997={};_0x538997[_0x483d33]={'$like':'%'+_0x405bc0['query'][_0x6765('0x55')]+'%'};return _0x538997;})});}_0x456da2=_[_0x6765('0x56')]({},_0x456da2,_0x405bc0['options']);return db[_0x6765('0x6a')][_0x6765('0x23')]({'where':_0x456da2[_0x6765('0x53')]})[_0x6765('0x11')](function(_0x3fd845){_0x20ec2f[_0x6765('0x23')]=_0x3fd845;if(_0x405bc0['query'][_0x6765('0x5a')]){_0x456da2[_0x6765('0x5b')]=[{'all':!![]}];}return db[_0x6765('0x6a')]['findAll'](_0x456da2);})[_0x6765('0x11')](function(_0x423902){_0x20ec2f[_0x6765('0x6f')]=_0x423902;return _0x20ec2f;});}})[_0x6765('0x11')](respondWithFilteredResult(_0x1ae908,_0x456da2))[_0x6765('0x5d')](handleError(_0x1ae908,null));};exports[_0x6765('0x70')]=function(_0x581ce3,_0xa30bb3){return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x581ce3[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0xa30bb3,null))[_0x6765('0x11')](function(_0x4ec4c2){if(_0x4ec4c2){return _0x4ec4c2['removeDispositions'](_0x581ce3[_0x6765('0x49')][_0x6765('0x71')]);}})[_0x6765('0x11')](respondWithStatusCode(_0xa30bb3,null))[_0x6765('0x5d')](handleError(_0xa30bb3,null));};exports[_0x6765('0x72')]=function(_0x2c0172,_0x1f414f){if(_0x2c0172[_0x6765('0x63')]['id']){delete _0x2c0172[_0x6765('0x63')]['id'];}return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x2c0172[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x1f414f,null))[_0x6765('0x11')](function(_0xdec499){if(_0xdec499){_0x2c0172[_0x6765('0x63')][_0x6765('0x73')]=_0xdec499['id'];return db[_0x6765('0x74')][_0x6765('0x6b')](_0x2c0172[_0x6765('0x63')]);}})[_0x6765('0x11')](respondWithResult(_0x1f414f,null))[_0x6765('0x5d')](handleError(_0x1f414f,null));};exports[_0x6765('0x75')]=function(_0x46bce9,_0x178bb1){var _0x26e3b2={'raw':![],'where':{}};var _0x3b7be4={};var _0x1c0660={'count':0x0,'rows':[]};return db[_0x6765('0x59')]['findOne']({'where':{'id':_0x46bce9[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x178bb1,null))[_0x6765('0x11')](function(_0x2e39a4){if(_0x2e39a4){_0x3b7be4['model']=_[_0x6765('0x4a')](db['CannedAnswer'][_0x6765('0x62')]);_0x3b7be4[_0x6765('0x49')]=_[_0x6765('0x4a')](_0x46bce9[_0x6765('0x49')]);_0x3b7be4[_0x6765('0x54')]=_[_0x6765('0x4b')](_0x3b7be4[_0x6765('0x48')],_0x3b7be4[_0x6765('0x49')]);_0x26e3b2[_0x6765('0x4d')]=_['intersection'](_0x3b7be4['model'],qs[_0x6765('0x4c')](_0x46bce9[_0x6765('0x49')]['fields']));_0x26e3b2[_0x6765('0x4d')]=_0x26e3b2['attributes'][_0x6765('0x4e')]?_0x26e3b2[_0x6765('0x4d')]:_0x3b7be4[_0x6765('0x48')];if(!_0x46bce9[_0x6765('0x49')][_0x6765('0x4f')]('nolimit')){_0x26e3b2[_0x6765('0x22')]=qs['limit'](_0x46bce9[_0x6765('0x49')][_0x6765('0x22')]);_0x26e3b2[_0x6765('0x20')]=qs['offset'](_0x46bce9['query'][_0x6765('0x20')]);}_0x26e3b2[_0x6765('0x51')]=qs[_0x6765('0x52')](_0x46bce9[_0x6765('0x49')][_0x6765('0x52')]);_0x26e3b2[_0x6765('0x53')]=qs[_0x6765('0x54')](_[_0x6765('0x6e')](_0x46bce9['query'],_0x3b7be4[_0x6765('0x54')]));_0x26e3b2[_0x6765('0x53')][_0x6765('0x73')]=_0x2e39a4['id'];if(_0x46bce9[_0x6765('0x49')][_0x6765('0x55')]){_0x26e3b2['where']=_[_0x6765('0x56')](_0x26e3b2['where'],{'$or':_[_0x6765('0x45')](_0x26e3b2[_0x6765('0x4d')],function(_0x48005a){var _0x414067={};_0x414067[_0x48005a]={'$like':'%'+_0x46bce9[_0x6765('0x49')][_0x6765('0x55')]+'%'};return _0x414067;})});}_0x26e3b2=_[_0x6765('0x56')]({},_0x26e3b2,_0x46bce9[_0x6765('0x58')]);return db[_0x6765('0x74')][_0x6765('0x23')]({'where':_0x26e3b2[_0x6765('0x53')]})[_0x6765('0x11')](function(_0x59d1e1){_0x1c0660[_0x6765('0x23')]=_0x59d1e1;if(_0x46bce9[_0x6765('0x49')][_0x6765('0x5a')]){_0x26e3b2[_0x6765('0x5b')]=[{'all':!![]}];}return db[_0x6765('0x74')][_0x6765('0x5c')](_0x26e3b2);})['then'](function(_0x381a84){_0x1c0660['rows']=_0x381a84;return _0x1c0660;});}})['then'](respondWithFilteredResult(_0x178bb1,_0x26e3b2))[_0x6765('0x5d')](handleError(_0x178bb1,null));};exports[_0x6765('0x76')]=function(_0x4deedd,_0x2a60a2){return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x4deedd[_0x6765('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a60a2,null))[_0x6765('0x11')](function(_0x34f30f){if(_0x34f30f){return _0x34f30f[_0x6765('0x76')](_0x4deedd[_0x6765('0x49')]['ids']);}})[_0x6765('0x11')](respondWithStatusCode(_0x2a60a2,null))[_0x6765('0x5d')](handleError(_0x2a60a2,null));};exports[_0x6765('0x6b')]=function(_0x34a636,_0x4ce870){var _0x378906={'name':_0x34a636[_0x6765('0x63')][_0x6765('0x2b')],'key':_0x34a636[_0x6765('0x63')][_0x6765('0x77')],'provider':_0x34a636[_0x6765('0x63')]['provider']===_0x6765('0x64')?null:_0x34a636['body'][_0x6765('0x65')],'email':_0x34a636['body'][_0x6765('0x78')],'ListId':_0x34a636[_0x6765('0x63')]['ListId'],'active':!_[_0x6765('0x79')](_0x34a636[_0x6765('0x63')][_0x6765('0x7a')])?_0x34a636[_0x6765('0x63')][_0x6765('0x7a')]:!![],'description':_0x34a636['body'][_0x6765('0x7b')]||null};var _0x1e06cc=getAuthenticationOptions(_0x378906[_0x6765('0x65')],_0x34a636['body']);_0x378906[_0x6765('0x41')]=_0x1e06cc['Imap'];_0x378906[_0x6765('0x42')]=_0x1e06cc[_0x6765('0x42')];return db[_0x6765('0x59')][_0x6765('0x6b')](_0x378906,{'include':[{'model':db[_0x6765('0x61')],'as':_0x6765('0x42')},{'model':db[_0x6765('0x60')],'as':_0x6765('0x41')}]})['then'](function(_0x2cc640){var _0x3c0471=_0x34a636['user'][_0x6765('0x28')]({'plain':!![]});if(!_0x3c0471)throw new Error(_0x6765('0x7c'));if(_0x3c0471[_0x6765('0x7d')]===_0x6765('0x37')){var _0x5a6339=_0x2cc640[_0x6765('0x28')]({'plain':!![]});return db[_0x6765('0x7e')][_0x6765('0x66')]({'where':{'name':_0x6765('0x29'),'userProfileId':_0x3c0471[_0x6765('0x7f')]},'raw':!![]})[_0x6765('0x11')](function(_0x1163ae){if(_0x1163ae&&_0x1163ae[_0x6765('0x80')]===0x0){return db[_0x6765('0x2a')][_0x6765('0x6b')]({'name':_0x5a6339[_0x6765('0x2b')],'resourceId':_0x5a6339['id'],'type':_0x1163ae[_0x6765('0x2b')],'sectionId':_0x1163ae['id']},{})[_0x6765('0x11')](function(){return _0x2cc640;});}else{return _0x2cc640;}})['catch'](function(_0x15dce6){logger[_0x6765('0x17')](_0x6765('0x81'),_0x15dce6);throw _0x15dce6;});}return _0x2cc640;})[_0x6765('0x11')](respondWithResult(_0x4ce870,0xc9))['catch'](handleError(_0x4ce870,null));};exports[_0x6765('0x82')]=function(_0x2e38f5,_0x1cdd6a){return db['MailAccount'][_0x6765('0x6d')]({'where':{'id':_0x2e38f5[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x1cdd6a,null))[_0x6765('0x11')](function(_0x2636c2){if(_0x2636c2){return _0x2636c2[_0x6765('0x82')]();}return null;})['then'](respondWithResult(_0x1cdd6a,null))[_0x6765('0x5d')](handleError(_0x1cdd6a,null));};exports['addImap']=function(_0xb71939,_0x9a011f){if(_0xb71939[_0x6765('0x63')]['id']){delete _0xb71939[_0x6765('0x63')]['id'];}return db[_0x6765('0x59')]['find']({'where':{'id':_0xb71939['params']['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x9a011f,null))[_0x6765('0x11')](function(_0x4c5857){if(_0x4c5857){_0xb71939['body'][_0x6765('0x73')]=_0x4c5857['id'];return db[_0x6765('0x60')][_0x6765('0x6b')](_0xb71939[_0x6765('0x63')]);}})[_0x6765('0x11')](respondWithResult(_0x9a011f,null))[_0x6765('0x5d')](handleError(_0x9a011f,null));};exports[_0x6765('0x83')]=function(_0x426b8e,_0x8e812c){return db[_0x6765('0x59')][_0x6765('0x6d')]({'where':{'id':_0x426b8e[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x8e812c,null))[_0x6765('0x11')](function(_0x2ef7e3){if(_0x2ef7e3){return _0x2ef7e3[_0x6765('0x84')](null);}return null;})[_0x6765('0x11')](respondWithStatusCode(_0x8e812c,null))[_0x6765('0x5d')](handleError(_0x8e812c,null));};exports['getSmtp']=function(_0x1b072c,_0x2c0436){return db['MailAccount'][_0x6765('0x6d')]({'where':{'id':_0x1b072c[_0x6765('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2c0436,null))[_0x6765('0x11')](function(_0x5e1291){if(_0x5e1291){return _0x5e1291['getSmtp']();}return null;})[_0x6765('0x11')](respondWithResult(_0x2c0436,null))[_0x6765('0x5d')](handleError(_0x2c0436,null));};exports[_0x6765('0x85')]=function(_0xf7fbe7,_0x41a1d9){if(_0xf7fbe7[_0x6765('0x63')]['id']){delete _0xf7fbe7[_0x6765('0x63')]['id'];}return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0xf7fbe7[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x41a1d9,null))[_0x6765('0x11')](function(_0x3433b3){if(_0x3433b3){_0xf7fbe7[_0x6765('0x63')][_0x6765('0x73')]=_0x3433b3['id'];return db[_0x6765('0x61')][_0x6765('0x6b')](_0xf7fbe7[_0x6765('0x63')]);}})[_0x6765('0x11')](respondWithResult(_0x41a1d9,null))['catch'](handleError(_0x41a1d9,null));};exports[_0x6765('0x86')]=function(_0x430828,_0x346560){return db[_0x6765('0x59')][_0x6765('0x6d')]({'where':{'id':_0x430828['params']['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x346560,null))[_0x6765('0x11')](function(_0x125637){if(_0x125637){return _0x125637[_0x6765('0x87')](null);}return null;})['then'](respondWithStatusCode(_0x346560,null))[_0x6765('0x5d')](handleError(_0x346560,null));};exports[_0x6765('0x88')]=function(_0x21183c,_0x11ca67){return db[_0x6765('0x89')][_0x6765('0x66')]({'where':{'id':_0x21183c[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x11ca67,null))[_0x6765('0x11')](function(_0x5ae3dd){if(_0x5ae3dd){return _0x5ae3dd[_0x6765('0x88')](_0x21183c[_0x6765('0x63')][_0x6765('0x71')],_['omit'](_0x21183c['body'],['ids','id'])||{});}})[_0x6765('0x11')](respondWithResult(_0x11ca67,null))[_0x6765('0x5d')](handleError(_0x11ca67,null));};exports[_0x6765('0x8a')]=function(_0x5c0823,_0xf4b2e7){var _0x1bce9d={'raw':![],'where':{}};var _0x1a8674={};var _0x45ca87={'count':0x0,'rows':[]};return db[_0x6765('0x59')]['findOne']({'where':{'id':_0x5c0823[_0x6765('0x5f')]['id']}})['then'](handleEntityNotFound(_0xf4b2e7,null))[_0x6765('0x11')](function(_0x3cdd4c){if(_0x3cdd4c){_0x1a8674[_0x6765('0x48')]=_[_0x6765('0x4a')](db[_0x6765('0x89')][_0x6765('0x62')]);_0x1a8674['query']=_[_0x6765('0x4a')](_0x5c0823[_0x6765('0x49')]);_0x1a8674['filters']=_[_0x6765('0x4b')](_0x1a8674[_0x6765('0x48')],_0x1a8674[_0x6765('0x49')]);_0x1bce9d['attributes']=_[_0x6765('0x4b')](_0x1a8674[_0x6765('0x48')],qs[_0x6765('0x4c')](_0x5c0823[_0x6765('0x49')]['fields']));_0x1bce9d[_0x6765('0x4d')]=_0x1bce9d[_0x6765('0x4d')][_0x6765('0x4e')]?_0x1bce9d[_0x6765('0x4d')]:_0x1a8674[_0x6765('0x48')];if(!_0x5c0823['query'][_0x6765('0x4f')](_0x6765('0x50'))){_0x1bce9d[_0x6765('0x22')]=qs[_0x6765('0x22')](_0x5c0823[_0x6765('0x49')][_0x6765('0x22')]);_0x1bce9d[_0x6765('0x20')]=qs[_0x6765('0x20')](_0x5c0823['query'][_0x6765('0x20')]);}_0x1bce9d[_0x6765('0x51')]=qs[_0x6765('0x52')](_0x5c0823[_0x6765('0x49')]['sort']);_0x1bce9d[_0x6765('0x53')]=qs[_0x6765('0x54')](_[_0x6765('0x6e')](_0x5c0823[_0x6765('0x49')],_0x1a8674['filters']));_0x1bce9d[_0x6765('0x53')][_0x6765('0x73')]=_0x3cdd4c['id'];if(_0x5c0823[_0x6765('0x49')][_0x6765('0x55')]){_0x1bce9d[_0x6765('0x53')]=_['merge'](_0x1bce9d[_0x6765('0x53')],{'$or':_[_0x6765('0x45')](_0x1bce9d[_0x6765('0x4d')],function(_0x1012ba){var _0x8c5b29={};_0x8c5b29[_0x1012ba]={'$like':'%'+_0x5c0823[_0x6765('0x49')][_0x6765('0x55')]+'%'};return _0x8c5b29;})});}_0x1bce9d=_['merge']({},_0x1bce9d,_0x5c0823[_0x6765('0x58')]);return db[_0x6765('0x89')][_0x6765('0x23')]({'where':_0x1bce9d[_0x6765('0x53')]})[_0x6765('0x11')](function(_0x3d0de2){_0x45ca87[_0x6765('0x23')]=_0x3d0de2;if(_0x5c0823[_0x6765('0x49')][_0x6765('0x5a')]){_0x1bce9d['include']=[{'model':db[_0x6765('0x8b')],'as':_0x6765('0x8c'),'required':![]},{'model':db[_0x6765('0x8d')],'as':_0x6765('0x8e'),'attributes':[_0x6765('0x2b'),_0x6765('0x8f'),_0x6765('0x90')],'required':![]},{'model':db[_0x6765('0x91')],'as':'Tags','attributes':['id',_0x6765('0x2b'),_0x6765('0x92')],'where':_0x5c0823[_0x6765('0x49')][_0x6765('0x93')]?{'id':_0x5c0823[_0x6765('0x49')][_0x6765('0x93')]}:undefined,'required':_0x5c0823['query'][_0x6765('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x6765('0x5c')](_0x1bce9d);})['then'](function(_0x1fafa9){_0x45ca87[_0x6765('0x6f')]=_0x1fafa9;return _0x45ca87;});}})[_0x6765('0x11')](respondWithFilteredResult(_0xf4b2e7,_0x1bce9d))[_0x6765('0x5d')](handleError(_0xf4b2e7,null));};exports['addApplications']=function addApplications(_0x405a0f,_0x360b81){var _0x39cfb4=_0x405a0f[_0x6765('0x5f')]['id'];var _0x266a7c=_0x405a0f[_0x6765('0x63')];var _0x362e23=0xc8;var _0x4890cd=null;return db[_0x6765('0x94')][_0x6765('0x95')]({'isolationLevel':db[_0x6765('0x94')][_0x6765('0x96')][_0x6765('0x97')]['READ_COMMITTED']},function(_0x3880ac){return db['MailAccount'][_0x6765('0x6d')]({'where':{'id':_0x39cfb4},'transaction':_0x3880ac})[_0x6765('0x11')](function(_0x2211f6){if(_0x2211f6){return db['MailApplication'][_0x6765('0x27')]({'where':{'MailAccountId':_0x39cfb4},'transaction':_0x3880ac})[_0x6765('0x11')](function(){var _0x3580ea=_['map'](_0x266a7c,function(_0x568015){_0x568015['MailAccountId']=_0x39cfb4;return _0x568015;});return db[_0x6765('0x98')][_0x6765('0x99')](_0x3580ea,{'transaction':_0x3880ac});});}else{_0x362e23=0x194;_0x4890cd=[];}});})[_0x6765('0x11')](function(){if(_0x362e23!==0x194){return db[_0x6765('0x98')][_0x6765('0x9a')]({'where':{'MailAccountId':_0x39cfb4},'order':_0x6765('0x9b')})[_0x6765('0x11')](function(_0x2d6052){_0x4890cd=_0x2d6052;});}})[_0x6765('0x5d')](function(_0x41404b){_0x362e23=0x1f4;logger[_0x6765('0x17')](_0x41404b[_0x6765('0x9c')]);if(_0x41404b['name']){delete _0x41404b['name'];}_0x4890cd=_0x41404b;})[_0x6765('0x9d')](function(){if(_0x4890cd===null){_0x360b81['sendStatus'](_0x362e23);}else{if(_0x362e23===0x1f4){_0x360b81['status'](_0x362e23)[_0x6765('0x9e')](_0x4890cd);}else{_0x360b81[_0x6765('0x1d')](_0x362e23)[_0x6765('0x1f')](_0x4890cd);}}});};exports[_0x6765('0x9f')]=function(_0x3e5d2d,_0x1cc26){var _0x8897af={};var _0x3ddbc6={};var _0x1153e0;var _0x2fdeca;return db['MailAccount'][_0x6765('0x6d')]({'where':{'id':_0x3e5d2d[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x1cc26,null))['then'](function(_0xc0b195){if(_0xc0b195){_0x1153e0=_0xc0b195;_0x3ddbc6[_0x6765('0x48')]=_[_0x6765('0x4a')](db[_0x6765('0x98')][_0x6765('0x62')]);_0x3ddbc6[_0x6765('0x49')]=_[_0x6765('0x4a')](_0x3e5d2d[_0x6765('0x49')]);_0x3ddbc6[_0x6765('0x54')]=_[_0x6765('0x4b')](_0x3ddbc6[_0x6765('0x48')],_0x3ddbc6[_0x6765('0x49')]);_0x8897af[_0x6765('0x4d')]=_[_0x6765('0x4b')](_0x3ddbc6[_0x6765('0x48')],qs[_0x6765('0x4c')](_0x3e5d2d[_0x6765('0x49')][_0x6765('0x4c')]));_0x8897af['attributes']=_0x8897af[_0x6765('0x4d')][_0x6765('0x4e')]?_0x8897af['attributes']:_0x3ddbc6[_0x6765('0x48')];_0x8897af[_0x6765('0x51')]=qs[_0x6765('0x52')](_0x3e5d2d['query']['sort']);_0x8897af[_0x6765('0x53')]=qs['filters'](_[_0x6765('0x6e')](_0x3e5d2d[_0x6765('0x49')],_0x3ddbc6[_0x6765('0x54')]));if(_0x3e5d2d[_0x6765('0x49')][_0x6765('0x55')]){_0x8897af[_0x6765('0x53')]=_['merge'](_0x8897af['where'],{'$or':_[_0x6765('0x45')](_0x8897af['attributes'],function(_0x68f25){var _0x3e1c75={};_0x3e1c75[_0x68f25]={'$like':'%'+_0x3e5d2d[_0x6765('0x49')][_0x6765('0x55')]+'%'};return _0x3e1c75;})});}_0x8897af=_['merge']({},_0x8897af,_0x3e5d2d[_0x6765('0x58')]);return _0x1153e0['getApplications'](_0x8897af);}})['then'](function(_0x297829){if(_0x297829){_0x2fdeca=_0x297829[_0x6765('0x4e')];if(!_0x3e5d2d['query'][_0x6765('0x4f')](_0x6765('0x50'))){_0x8897af['limit']=qs[_0x6765('0x22')](_0x3e5d2d['query'][_0x6765('0x22')]);_0x8897af[_0x6765('0x20')]=qs[_0x6765('0x20')](_0x3e5d2d[_0x6765('0x49')][_0x6765('0x20')]);}return _0x1153e0[_0x6765('0x9f')](_0x8897af);}})[_0x6765('0x11')](function(_0x14192f){if(_0x14192f){return _0x14192f?{'count':_0x2fdeca,'rows':_0x14192f}:null;}})[_0x6765('0x11')](respondWithResult(_0x1cc26,null))[_0x6765('0x5d')](handleError(_0x1cc26,null));};exports['getMessages']=function(_0xab3bb,_0x6a32df){var _0x23385f={'raw':!![],'where':{}};var _0x211cde={};var _0x142158={'count':0x0,'rows':[]};return db[_0x6765('0x59')][_0x6765('0x6d')]({'where':{'id':_0xab3bb[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x6a32df,null))[_0x6765('0x11')](function(_0x4277c1){if(_0x4277c1){_0x211cde['model']=_[_0x6765('0x4a')](db[_0x6765('0xa0')]['rawAttributes']);_0x211cde[_0x6765('0x49')]=_[_0x6765('0x4a')](_0xab3bb[_0x6765('0x49')]);_0x211cde[_0x6765('0x54')]=_['intersection'](_0x211cde[_0x6765('0x48')],_0x211cde['query']);_0x23385f[_0x6765('0x4d')]=_['intersection'](_0x211cde[_0x6765('0x48')],qs[_0x6765('0x4c')](_0xab3bb[_0x6765('0x49')][_0x6765('0x4c')]));_0x23385f[_0x6765('0x4d')]=_0x23385f[_0x6765('0x4d')][_0x6765('0x4e')]?_0x23385f[_0x6765('0x4d')]:_0x211cde['model'];if(!_0xab3bb[_0x6765('0x49')][_0x6765('0x4f')](_0x6765('0x50'))){_0x23385f[_0x6765('0x22')]=qs['limit'](_0xab3bb[_0x6765('0x49')][_0x6765('0x22')]);_0x23385f[_0x6765('0x20')]=qs['offset'](_0xab3bb['query'][_0x6765('0x20')]);}_0x23385f['order']=qs[_0x6765('0x52')](_0xab3bb[_0x6765('0x49')][_0x6765('0x52')]);_0x23385f[_0x6765('0x53')]=qs[_0x6765('0x54')](_['pick'](_0xab3bb[_0x6765('0x49')],_0x211cde[_0x6765('0x54')]));_0x23385f[_0x6765('0x53')]['MailAccountId']=_0x4277c1['id'];if(_0xab3bb[_0x6765('0x49')][_0x6765('0x55')]){_0x23385f[_0x6765('0x53')]=_[_0x6765('0x56')](_0x23385f['where'],{'$or':_[_0x6765('0x45')](_0x23385f[_0x6765('0x4d')],function(_0x2d210f){var _0x768216={};_0x768216[_0x2d210f]={'$like':'%'+_0xab3bb[_0x6765('0x49')]['filter']+'%'};return _0x768216;})});}if(_0xab3bb['query']['$gte']){var _0x499f99=_0xab3bb['query'][_0x6765('0xa1')][_0x6765('0xa2')](',');var _0x1bf340={};_0x1bf340[_0x499f99[0x0]]={'$gte':moment(_0x499f99[0x1])[_0x6765('0xa3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23385f[_0x6765('0x53')]=_[_0x6765('0x56')](_0x23385f[_0x6765('0x53')],_0x1bf340);}_0x23385f=_[_0x6765('0x56')]({},_0x23385f,_0xab3bb[_0x6765('0x58')]);return db[_0x6765('0xa0')][_0x6765('0x23')]({'where':_0x23385f[_0x6765('0x53')]})[_0x6765('0x11')](function(_0x505290){_0x142158[_0x6765('0x23')]=_0x505290;if(_0xab3bb[_0x6765('0x49')][_0x6765('0x5a')]){_0x23385f['include']=[{'all':!![]}];}return db[_0x6765('0xa0')][_0x6765('0x5c')](_0x23385f);})['then'](function(_0x50db07){if(_0xab3bb[_0x6765('0x49')][_0x6765('0xa4')]===_0x6765('0xa5')){for(var _0x358d42=0x0;_0x358d42<_0x50db07[_0x6765('0x4e')];_0x358d42++){_0x50db07[_0x358d42][_0x6765('0x63')]=juice(_0x50db07[_0x358d42][_0x6765('0x63')]);}}_0x142158[_0x6765('0x6f')]=_0x50db07;return _0x142158;});}})[_0x6765('0x11')](respondWithFilteredResult(_0x6a32df,_0x23385f))[_0x6765('0x5d')](handleError(_0x6a32df,null));};exports[_0x6765('0x9e')]=function(_0x4b88c2,_0x5e9b9a){var _0x1a2f23,_0x2766f2={},_0x1313bf;if(_0x4b88c2['body']['to']){_0x1313bf=_0x4b88c2[_0x6765('0x63')]['to']['split'](',')[0x0];}return db[_0x6765('0x59')]['find']({'where':{'id':_0x4b88c2[_0x6765('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0x6765('0xa6'),'include':[{'model':db[_0x6765('0x8b')],'as':_0x6765('0xa7'),'where':{'email':_0x1313bf},'limit':0x1,'order':[[_0x6765('0xa8'),_0x6765('0xa9')]]}]},{'model':db[_0x6765('0x61')],'as':_0x6765('0x42'),'raw':!![],'include':[{'model':db[_0x6765('0xaa')],'as':_0x6765('0xaa'),'raw':!![]}]}]})[_0x6765('0x11')](handleEntityNotFound(_0x5e9b9a,null))[_0x6765('0x11')](function(_0x56e8f0){if(!_0x56e8f0)return;_0x1a2f23=_0x56e8f0;if(!_0x56e8f0[_0x6765('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x6765('0x79')](_0x4b88c2[_0x6765('0x63')][_0x6765('0xab')])){_0x4b88c2['body']['from']=util[_0x6765('0xa3')](_0x6765('0xac'),_0x56e8f0[_0x6765('0x2b')],_0x56e8f0[_0x6765('0x78')]||_0x56e8f0[_0x6765('0x42')][_0x6765('0x37')]);}if(_0x4b88c2[_0x6765('0x63')][_0x6765('0xad')]&&_0x4b88c2[_0x6765('0x63')][_0x6765('0xad')][_0x6765('0x4e')]){for(var _0x22ca3c=0x0;_0x22ca3c<_0x4b88c2[_0x6765('0x63')][_0x6765('0xad')][_0x6765('0x4e')];_0x22ca3c+=0x1){_0x4b88c2[_0x6765('0x63')][_0x6765('0xad')][_0x22ca3c]={'filename':_0x4b88c2[_0x6765('0x63')][_0x6765('0xad')][_0x22ca3c][_0x6765('0x2b')],'path':path[_0x6765('0xae')](config[_0x6765('0xaf')],_0x6765('0xb0'),_0x4b88c2[_0x6765('0x63')][_0x6765('0xad')][_0x22ca3c][_0x6765('0xb1')])};}}var _0x599773=_0x56e8f0[_0x6765('0xb2')]();return respondWithRpcPromise(_0x6765('0xb3'),_0x6765('0xb4'),{'account':_0x599773,'message':_0x4b88c2['body']});})[_0x6765('0x11')](function(_0x376685){if(!_0x376685)return;_0x2766f2=_0x376685;if(!_0x1a2f23['List'])throw new Error(_0x6765('0xb5'));if(_0x1a2f23[_0x6765('0xa6')][_0x6765('0xa7')]['length'])return _0x1a2f23[_0x6765('0xa6')][_0x6765('0xa7')][0x0];return db[_0x6765('0x8b')]['create'](_[_0x6765('0xb')](_0x4b88c2[_0x6765('0x63')],{'firstName':_0x4b88c2[_0x6765('0x63')]['to'],'email':_0x4b88c2[_0x6765('0x63')]['to'],'phone':_0x4b88c2[_0x6765('0x63')]['to'],'ListId':_0x1a2f23['ListId']}));})['then'](function(_0x4fdaff){if(!_0x4fdaff)return;var _0x2a41c9={'UserId':_0x4b88c2['user']['id'],'ContactId':_0x4fdaff['id'],'MailAccountId':_0x1a2f23['id'],'inReplyTo':_0x2766f2[_0x6765('0xb6')],'to':_0x4b88c2[_0x6765('0x63')][_0x6765('0xab')],'cc':_0x4b88c2['body']['cc'],'subject':_0x4b88c2[_0x6765('0x63')]['subject'],'attach':_0x4b88c2[_0x6765('0x63')][_0x6765('0xb7')],'firstMsgDirection':_0x6765('0xb8'),'lastMsgAt':moment()['format'](_0x6765('0xb9')),'lastMsgDirection':_0x6765('0xb8'),'Messages':[_['merge'](_0x4b88c2['body'],{'messageId':_0x2766f2[_0x6765('0xb6')],'sentAt':moment()[_0x6765('0xa3')](_0x6765('0xb9')),'read':!![],'MailAccountId':_0x1a2f23['id'],'UserId':_0x4b88c2[_0x6765('0x37')]['id'],'ContactId':_0x4fdaff['id']})]};if(_0x4b88c2[_0x6765('0x63')][_0x6765('0xba')]){_0x2a41c9=_[_0x6765('0x56')](_0x2a41c9,_0x4b88c2['body'][_0x6765('0xba')]);}return db[_0x6765('0x89')][_0x6765('0x6b')](_0x2a41c9,{'include':[{'model':db[_0x6765('0xa0')],'as':_0x6765('0xbb')}]});})['then'](respondWithResult(_0x5e9b9a,null))[_0x6765('0x5d')](handleError(_0x5e9b9a,null));};exports[_0x6765('0xbc')]=function(_0x3f4b0d,_0x5721e7){return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x3f4b0d[_0x6765('0x5f')]['id']},'include':[{'model':db[_0x6765('0x61')],'as':_0x6765('0x42'),'raw':!![],'include':[{'model':db[_0x6765('0xaa')],'as':'CloudProvider','raw':!![]}]}]})[_0x6765('0x11')](handleEntityNotFound(_0x5721e7,null))['then'](function(_0x3c4a7e){if(!_0x3c4a7e[_0x6765('0x42')])return;var _0x27a234=_0x3c4a7e[_0x6765('0xb2')]();return respondWithRpcPromise(_0x6765('0xbd'),_0x6765('0xbc'),{'account':_0x27a234});})['then'](respondWithResult(_0x5721e7,null))['catch'](handleError(_0x5721e7,null));};exports[_0x6765('0x27')]=function(_0x19d5a2,_0xdeb673){return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x19d5a2[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0xdeb673,null))['then'](function(_0x1ba05e){if(_0x1ba05e&&_0x1ba05e['service']){throw new db[(_0x6765('0xbe'))][(_0x6765('0xbf'))](_0x6765('0xc0'));}return _0x1ba05e;})[_0x6765('0x11')](removeEntity(_0xdeb673,null))[_0x6765('0x5d')](handleError(_0xdeb673,null));};exports[_0x6765('0xc1')]=function(_0x3f2643,_0x7b267c){return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x3f2643[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x7b267c,null))[_0x6765('0x11')](function(_0x4e22cd){if(_0x4e22cd){return _0x4e22cd[_0x6765('0xc1')](_0x3f2643[_0x6765('0x63')][_0x6765('0x71')],_[_0x6765('0xc2')](_0x3f2643[_0x6765('0x63')],[_0x6765('0x71'),'id'])||{})[_0x6765('0xc3')](function(_0x55ebb6){for(var _0xac9f2e=0x0;_0xac9f2e<_0x3f2643[_0x6765('0x63')][_0x6765('0x71')][_0x6765('0x4e')];_0xac9f2e+=0x1){socket[_0x6765('0xc4')](_0x6765('0xc5'),{'UserId':Number(_0x3f2643[_0x6765('0x63')][_0x6765('0x71')][_0xac9f2e]),'MailAccountId':Number(_0x3f2643[_0x6765('0x5f')]['id'])});}return _0x55ebb6;});}})[_0x6765('0x11')](respondWithResult(_0x7b267c,null))[_0x6765('0x5d')](handleError(_0x7b267c,null));};exports[_0x6765('0xc6')]=function(_0x54e5a1,_0x597f51){return db[_0x6765('0x59')][_0x6765('0x66')]({'where':{'id':_0x54e5a1[_0x6765('0x5f')]['id']}})['then'](handleEntityNotFound(_0x597f51,null))[_0x6765('0x11')](function(_0x290559){if(_0x290559){return _0x290559[_0x6765('0xc6')](_0x54e5a1['query'][_0x6765('0x71')])['then'](function(){if(_[_0x6765('0xc7')](_0x54e5a1['query']['ids'])){for(var _0x504b10=0x0;_0x504b10<_0x54e5a1[_0x6765('0x49')]['ids'][_0x6765('0x4e')];_0x504b10+=0x1){socket[_0x6765('0xc4')](_0x6765('0xc8'),{'UserId':Number(_0x54e5a1[_0x6765('0x49')][_0x6765('0x71')][_0x504b10]),'MailAccountId':Number(_0x54e5a1[_0x6765('0x5f')]['id'])});}}else{socket[_0x6765('0xc4')](_0x6765('0xc8'),{'UserId':Number(_0x54e5a1['query'][_0x6765('0x71')]),'MailAccountId':Number(_0x54e5a1[_0x6765('0x5f')]['id'])});}});}})[_0x6765('0x11')](respondWithStatusCode(_0x597f51,null))[_0x6765('0x5d')](handleError(_0x597f51,null));};exports[_0x6765('0xc9')]=function(_0x1daf79,_0x2c55e2){var _0x4a337d={};var _0x1bdd76={};var _0x24df51;var _0x1550fc;return db[_0x6765('0x59')][_0x6765('0x6d')]({'where':{'id':_0x1daf79[_0x6765('0x5f')]['id']}})[_0x6765('0x11')](handleEntityNotFound(_0x2c55e2,null))[_0x6765('0x11')](function(_0x4d3f2a){if(_0x4d3f2a){_0x24df51=_0x4d3f2a;_0x1bdd76[_0x6765('0x48')]=_[_0x6765('0x4a')](db[_0x6765('0x8d')][_0x6765('0x62')]);_0x1bdd76[_0x6765('0x49')]=_[_0x6765('0x4a')](_0x1daf79[_0x6765('0x49')]);_0x1bdd76['filters']=_[_0x6765('0x4b')](_0x1bdd76[_0x6765('0x48')],_0x1bdd76[_0x6765('0x49')]);_0x4a337d[_0x6765('0x4d')]=_['intersection'](_0x1bdd76['model'],qs[_0x6765('0x4c')](_0x1daf79[_0x6765('0x49')][_0x6765('0x4c')]));_0x4a337d[_0x6765('0x4d')]=_0x4a337d['attributes']['length']?_0x4a337d[_0x6765('0x4d')]:_0x1bdd76[_0x6765('0x48')];_0x4a337d[_0x6765('0x51')]=qs[_0x6765('0x52')](_0x1daf79[_0x6765('0x49')][_0x6765('0x52')]);_0x4a337d[_0x6765('0x53')]=qs['filters'](_[_0x6765('0x6e')](_0x1daf79[_0x6765('0x49')],_0x1bdd76[_0x6765('0x54')]));if(_0x1daf79[_0x6765('0x49')]['filter']){_0x4a337d[_0x6765('0x53')]=_['merge'](_0x4a337d[_0x6765('0x53')],{'$or':_[_0x6765('0x45')](_0x4a337d[_0x6765('0x4d')],function(_0x26318e){var _0x38a174={};_0x38a174[_0x26318e]={'$like':'%'+_0x1daf79['query'][_0x6765('0x55')]+'%'};return _0x38a174;})});}_0x4a337d=_[_0x6765('0x56')]({},_0x4a337d,_0x1daf79['options']);return _0x24df51[_0x6765('0xc9')](_0x4a337d);}})['then'](function(_0xe97dd8){if(_0xe97dd8){_0x1550fc=_0xe97dd8['length'];if(!_0x1daf79[_0x6765('0x49')][_0x6765('0x4f')](_0x6765('0x50'))){_0x4a337d[_0x6765('0x22')]=qs[_0x6765('0x22')](_0x1daf79[_0x6765('0x49')][_0x6765('0x22')]);_0x4a337d['offset']=qs[_0x6765('0x20')](_0x1daf79[_0x6765('0x49')][_0x6765('0x20')]);}return _0x24df51[_0x6765('0xc9')](_0x4a337d);}})['then'](function(_0x1574a1){if(_0x1574a1){return _0x1574a1?{'count':_0x1550fc,'rows':_0x1574a1}:null;}})['then'](respondWithResult(_0x2c55e2,null))['catch'](handleError(_0x2c55e2,null));}; \ No newline at end of file +var _0xc22e=['CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','CmList','List','Contacts','DESC','CloudProvider','from','email','attachments','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','emit','userMailAccount:remove','getAgents','moment','util','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','update','destroy','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','MailAccount','count','includeAll','findAll','rows','show','params','MailServerIn','include','options','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','create','CannedAnswer','removeAnswers','isNil','active','description','get','role','userProfileId','autoAssociation','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction'];(function(_0x5e1248,_0x530ae4){var _0x48ea5e=function(_0x10b270){while(--_0x10b270){_0x5e1248['push'](_0x5e1248['shift']());}};_0x48ea5e(++_0x530ae4);}(_0xc22e,0xf6));var _0xec22=function(_0x23cfac,_0x4fc225){_0x23cfac=_0x23cfac-0x0;var _0x4b2b1f=_0xc22e[_0x23cfac];return _0x4b2b1f;};'use strict';var moment=require(_0xec22('0x0'));var BPromise=require('bluebird');var util=require(_0xec22('0x1'));var path=require(_0xec22('0x2'));var _=require('lodash');var juice=require(_0xec22('0x3'));var Redis=require(_0xec22('0x4'));var qs=require(_0xec22('0x5'));var logger=require(_0xec22('0x6'))(_0xec22('0x7'));var config=require(_0xec22('0x8'));var db=require(_0xec22('0x9'))['db'];config[_0xec22('0xa')]=_[_0xec22('0xb')](config[_0xec22('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xec22('0xc'))(new Redis(config[_0xec22('0xa')]));require(_0xec22('0xd'))[_0xec22('0xe')](socket);var jayson=require(_0xec22('0xf'));var client=jayson[_0xec22('0x10')][_0xec22('0x11')]({'port':0x232b});function respondWithRpcPromise(_0x1e4b9f,_0x29815f,_0x53f2b5,_0x27f03f){return new BPromise(function(_0x351173,_0x4f7cb1){var _0x4a1e30=_0x27f03f||client;return _0x4a1e30[_0xec22('0x12')](_0x1e4b9f,_0x53f2b5)[_0xec22('0x13')](function(_0x10d570){logger[_0xec22('0x14')](_0xec22('0x15'),_0x29815f,_0xec22('0x16'));logger[_0xec22('0x17')](_0xec22('0x18'),_0x29815f,_0xec22('0x16'),JSON[_0xec22('0x19')](_0x10d570));if(_0x10d570[_0xec22('0x1a')]){if(_0x10d570['error'][_0xec22('0x1b')]===0x1f4){logger[_0xec22('0x1a')](_0xec22('0x15'),_0x29815f,_0x10d570[_0xec22('0x1a')][_0xec22('0x1c')]);return _0x4f7cb1(_0x10d570['error'][_0xec22('0x1c')]);}logger[_0xec22('0x1a')](_0xec22('0x15'),_0x29815f,_0x10d570[_0xec22('0x1a')][_0xec22('0x1c')]);return _0x351173(_0x10d570[_0xec22('0x1a')]['message']);}else{logger[_0xec22('0x14')](_0xec22('0x15'),_0x29815f,'request\x20sent');_0x351173(_0x10d570[_0xec22('0x1d')][_0xec22('0x1c')]);}})[_0xec22('0x1e')](function(_0x137106){logger[_0xec22('0x1a')](_0xec22('0x15'),_0x29815f,_0x137106);_0x4f7cb1(_0x137106);});});}function respondWithStatusCode(_0x2bd746,_0x5e0ea0){_0x5e0ea0=_0x5e0ea0||0xcc;return function(_0x37eb4b){if(_0x37eb4b){return _0x2bd746[_0xec22('0x1f')](_0x5e0ea0);}return _0x2bd746[_0xec22('0x20')](_0x5e0ea0)[_0xec22('0x21')]();};}function respondWithResult(_0xc24946,_0x543b1d){_0x543b1d=_0x543b1d||0xc8;return function(_0x228955){if(_0x228955){return _0xc24946['status'](_0x543b1d)[_0xec22('0x22')](_0x228955);}};}function respondWithFilteredResult(_0x2923a8,_0x441db3){return function(_0x2f77d7){if(_0x2f77d7){var _0x378d8e=typeof _0x441db3[_0xec22('0x23')]===_0xec22('0x24')&&typeof _0x441db3[_0xec22('0x25')]===_0xec22('0x24');var _0x5d2e05=_0x2f77d7['count'];var _0x3e06b6=_0x378d8e?0x0:_0x441db3[_0xec22('0x23')];var _0x56b60c=_0x378d8e?_0x2f77d7['count']:_0x441db3[_0xec22('0x23')]+_0x441db3[_0xec22('0x25')];var _0x28269f;if(_0x56b60c>=_0x5d2e05){_0x56b60c=_0x5d2e05;_0x28269f=0xc8;}else{_0x28269f=0xce;}_0x2923a8[_0xec22('0x20')](_0x28269f);return _0x2923a8['set'](_0xec22('0x26'),_0x3e06b6+'-'+_0x56b60c+'/'+_0x5d2e05)['json'](_0x2f77d7);}return null;};}function saveUpdates(_0x31c59d){return function(_0x1d65aa){if(_0x1d65aa){return _0x1d65aa[_0xec22('0x27')](_0x31c59d)[_0xec22('0x13')](function(_0xb98d86){return _0xb98d86;});}return null;};}function removeEntity(_0x1d0f90){return function(_0x1e9ac1){if(_0x1e9ac1){return _0x1e9ac1[_0xec22('0x28')]()['then'](function(){var _0xda24f4=_0x1e9ac1['get']({'plain':!![]});var _0x34e97c=_0xec22('0x29');return db['UserProfileResource'][_0xec22('0x28')]({'where':{'type':_0x34e97c,'resourceId':_0xda24f4['id']}})['then'](function(){return _0x1e9ac1;});})[_0xec22('0x13')](function(){_0x1d0f90[_0xec22('0x20')](0xcc)[_0xec22('0x21')]();});}};}function handleEntityNotFound(_0x495d7e){return function(_0x37e111){if(!_0x37e111){_0x495d7e['sendStatus'](0x194);}return _0x37e111;};}function handleError(_0x8ad587,_0x3afa24){_0x3afa24=_0x3afa24||0x1f4;return function(_0x4cdcea){logger[_0xec22('0x1a')](_0x4cdcea[_0xec22('0x2a')]);if(_0x4cdcea[_0xec22('0x2b')]){delete _0x4cdcea['name'];}_0x8ad587[_0xec22('0x20')](_0x3afa24)[_0xec22('0x2c')](_0x4cdcea);};}function getImapHost(_0x16fb62){switch(_0x16fb62){case _0xec22('0x2d'):return _0xec22('0x2e');case _0xec22('0x2f'):return'imap.mail.yahoo.com';case _0xec22('0x30'):return _0xec22('0x31');case _0xec22('0x32'):return _0xec22('0x33');}throw new Error('Unknown\x20email\x20service\x20provider',_0x16fb62);}function getSmtpHost(_0x21f213){switch(_0x21f213){case _0xec22('0x2d'):return _0xec22('0x34');case _0xec22('0x2f'):return _0xec22('0x35');case'hotmail':return _0xec22('0x36');case _0xec22('0x32'):return _0xec22('0x37');}throw new Error('Unknown\x20email\x20service\x20provider',_0x21f213);}function getAuthenticationOptions(_0x1e8495,_0x3fb950){var _0x320866={};var _0x52802c={};if(_0x1e8495){_0x320866[_0xec22('0x38')]=_0x52802c[_0xec22('0x38')]=_0x3fb950[_0xec22('0x39')];_0x320866[_0xec22('0x3a')]=_0x52802c[_0xec22('0x3b')]=_0x3fb950[_0xec22('0x3a')];if(_0x3fb950['modernAuthentication']){_0x320866[_0xec22('0x3c')]=_0x52802c[_0xec22('0x3c')]=!![];_0x320866[_0xec22('0x3d')]=_0x52802c[_0xec22('0x3d')]=_0x3fb950['CloudProviderId'];_0x320866[_0xec22('0x3a')]=_0x52802c['pass']=null;}else{_0x320866['CloudProviderId']=_0x52802c['CloudProviderId']=null;}_0x320866[_0xec22('0x3e')]=getImapHost(_0x1e8495);_0x320866[_0xec22('0x3f')]=0x3e1;_0x52802c[_0xec22('0x3e')]=getSmtpHost(_0x1e8495);_0x52802c['port']=0x24b;_0x52802c[_0xec22('0x40')]=![];_0x320866['service']=_0x52802c[_0xec22('0x41')]=null;}else{if(_0x3fb950['authentication']){_0x320866['user']=_0x52802c[_0xec22('0x38')]=_0x3fb950[_0xec22('0x39')];_0x320866['password']=_0x52802c[_0xec22('0x3b')]=_0x3fb950['password'];}else{_0x320866[_0xec22('0x42')]=_0x52802c['authentication']=![];_0x320866[_0xec22('0x38')]=_0x52802c[_0xec22('0x38')]=null;_0x320866[_0xec22('0x3a')]=_0x52802c['pass']=null;}_0x320866['host']=_0x3fb950[_0xec22('0x43')][_0xec22('0x3e')];_0x320866[_0xec22('0x3f')]=_0x3fb950['Imap']['port'];_0x52802c[_0xec22('0x3e')]=_0x3fb950['Smtp'][_0xec22('0x3e')];_0x52802c['port']=_0x3fb950[_0xec22('0x44')]['port'];}return{'Imap':_0x320866,'Smtp':_0x52802c};}exports['index']=function(_0xa25da5,_0x203fa8){var _0xc4e61a={'include':[{'model':db['MailServerIn'],'as':_0xec22('0x43')},{'model':db[_0xec22('0x45')],'as':_0xec22('0x44')},{'model':db[_0xec22('0x46')],'as':_0xec22('0x47')}]},_0x213127={},_0x100851={'count':0x0,'rows':[]};var _0x175a02=_[_0xec22('0x48')](db['MailAccount'][_0xec22('0x49')],function(_0x3a0edd){return{'name':_0x3a0edd[_0xec22('0x4a')],'type':_0x3a0edd[_0xec22('0x4b')][_0xec22('0x4c')]};});_0x213127[_0xec22('0x4d')]=_[_0xec22('0x48')](_0x175a02,_0xec22('0x2b'));_0x213127[_0xec22('0x4e')]=_[_0xec22('0x4f')](_0xa25da5[_0xec22('0x4e')]);_0x213127[_0xec22('0x50')]=_[_0xec22('0x51')](_0x213127[_0xec22('0x4d')],_0x213127['query']);_0xc4e61a[_0xec22('0x52')]=_[_0xec22('0x51')](_0x213127[_0xec22('0x4d')],qs[_0xec22('0x53')](_0xa25da5[_0xec22('0x4e')][_0xec22('0x53')]));_0xc4e61a[_0xec22('0x52')]=_0xc4e61a[_0xec22('0x52')][_0xec22('0x54')]?_0xc4e61a[_0xec22('0x52')]:_0x213127[_0xec22('0x4d')];if(!_0xa25da5[_0xec22('0x4e')][_0xec22('0x55')](_0xec22('0x56'))){_0xc4e61a[_0xec22('0x25')]=qs[_0xec22('0x25')](_0xa25da5[_0xec22('0x4e')][_0xec22('0x25')]);_0xc4e61a[_0xec22('0x23')]=qs[_0xec22('0x23')](_0xa25da5[_0xec22('0x4e')]['offset']);}_0xc4e61a[_0xec22('0x57')]=qs['sort'](_0xa25da5[_0xec22('0x4e')][_0xec22('0x58')]);_0xc4e61a['where']=qs['filters'](_[_0xec22('0x59')](_0xa25da5[_0xec22('0x4e')],_0x213127[_0xec22('0x50')]),_0x175a02);if(_0xa25da5[_0xec22('0x4e')][_0xec22('0x5a')]){_0xc4e61a[_0xec22('0x5b')]=_['merge'](_0xc4e61a['where'],{'$or':_['map'](_0x175a02,function(_0x21060a){if(_0x21060a[_0xec22('0x4b')]!==_0xec22('0x5c')){var _0x757f3d={};_0x757f3d[_0x21060a[_0xec22('0x2b')]]={'$like':'%'+_0xa25da5['query'][_0xec22('0x5a')]+'%'};return _0x757f3d;}})});}_0xc4e61a=_[_0xec22('0x5d')]({},_0xc4e61a,_0xa25da5['options']);var _0x139f46={'where':_0xc4e61a[_0xec22('0x5b')]};return db[_0xec22('0x5e')][_0xec22('0x5f')](_0x139f46)[_0xec22('0x13')](function(_0x58c56d){_0x100851['count']=_0x58c56d;if(_0xa25da5[_0xec22('0x4e')][_0xec22('0x60')]){_0xc4e61a['include']=[{'all':!![]}];}return db[_0xec22('0x5e')][_0xec22('0x61')](_0xc4e61a);})[_0xec22('0x13')](function(_0x399619){_0x100851[_0xec22('0x62')]=_0x399619;return _0x100851;})[_0xec22('0x13')](respondWithFilteredResult(_0x203fa8,_0xc4e61a))[_0xec22('0x1e')](handleError(_0x203fa8,null));};exports[_0xec22('0x63')]=function(_0x1a31dd,_0x363d10){var _0x13e566={'raw':![],'where':{'id':_0x1a31dd[_0xec22('0x64')]['id']},'include':[{'model':db[_0xec22('0x65')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xec22('0x44')},{'model':db[_0xec22('0x46')],'as':_0xec22('0x47')}]},_0x29473f={};_0x29473f[_0xec22('0x4d')]=_[_0xec22('0x4f')](db[_0xec22('0x5e')]['rawAttributes']);_0x29473f[_0xec22('0x4e')]=_[_0xec22('0x4f')](_0x1a31dd[_0xec22('0x4e')]);_0x29473f[_0xec22('0x50')]=_[_0xec22('0x51')](_0x29473f['model'],_0x29473f[_0xec22('0x4e')]);_0x13e566[_0xec22('0x52')]=_['intersection'](_0x29473f[_0xec22('0x4d')],qs[_0xec22('0x53')](_0x1a31dd['query']['fields']));_0x13e566['attributes']=_0x13e566['attributes'][_0xec22('0x54')]?_0x13e566['attributes']:_0x29473f[_0xec22('0x4d')];if(_0x1a31dd['query'][_0xec22('0x60')]){_0x13e566[_0xec22('0x66')]=[{'all':!![]}];}_0x13e566=_['merge']({},_0x13e566,_0x1a31dd[_0xec22('0x67')]);return db['MailAccount'][_0xec22('0x68')](_0x13e566)[_0xec22('0x13')](handleEntityNotFound(_0x363d10,null))['then'](respondWithResult(_0x363d10,null))[_0xec22('0x1e')](handleError(_0x363d10,null));};exports[_0xec22('0x27')]=function(_0x3e451f,_0x1df00f){if(_0x3e451f[_0xec22('0x69')]['id']){delete _0x3e451f[_0xec22('0x69')]['id'];}var _0x2a7851=_0x3e451f[_0xec22('0x69')][_0xec22('0x6a')]===_0xec22('0x6b')?null:_0x3e451f['body'][_0xec22('0x6a')];var _0x3bc477=_0x3e451f['body']['Imap']||{};var _0x58d507=_0x3e451f[_0xec22('0x69')][_0xec22('0x44')]||{};if(_0x2a7851){_0x3bc477[_0xec22('0x3e')]=getImapHost(_0x2a7851);_0x3bc477[_0xec22('0x3f')]=0x3e1;_0x58d507['host']=getSmtpHost(_0x2a7851);_0x58d507['port']=0x24b;_0x58d507[_0xec22('0x40')]=![];}if(_0x58d507[_0xec22('0x3c')]){_0x58d507['secure']=![];}else{_0x58d507[_0xec22('0x3d')]=null;}if(!_0x3bc477['modernAuthentication'])_0x3bc477['CloudProviderId']=null;_0x3e451f['body'][_0xec22('0x43')]=_0x3bc477;_0x3e451f[_0xec22('0x69')][_0xec22('0x44')]=_0x58d507;return db[_0xec22('0x5e')]['find']({'where':{'id':_0x3e451f[_0xec22('0x64')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xec22('0x43')},{'model':db[_0xec22('0x45')],'as':'Smtp'},{'model':db[_0xec22('0x46')],'as':_0xec22('0x47')}]})[_0xec22('0x13')](handleEntityNotFound(_0x1df00f,null))[_0xec22('0x13')](function(_0x1948bd){if(!_0x1948bd)throw new Error(_0xec22('0x6c'));if(_0x1948bd[_0xec22('0x41')])delete _0x3e451f[_0xec22('0x69')][_0xec22('0x43')];return _0x1948bd;})[_0xec22('0x13')](saveUpdates(_0x3e451f[_0xec22('0x69')],null))['then'](function(_0x4ce2e7){if(!_0x3e451f[_0xec22('0x69')][_0xec22('0x43')])return _0x4ce2e7;return db[_0xec22('0x65')]['update'](_0x3e451f['body'][_0xec22('0x43')],{'where':{'MailAccountId':_0x4ce2e7['id']}})[_0xec22('0x13')](function(){return _0x4ce2e7;});})[_0xec22('0x13')](function(_0x2c4b13){if(!_0x3e451f[_0xec22('0x69')][_0xec22('0x44')])return _0x2c4b13;return db['MailServerOut']['update'](_0x3e451f['body']['Smtp'],{'where':{'MailAccountId':_0x2c4b13['id']}})[_0xec22('0x13')](function(){return _0x2c4b13;});})[_0xec22('0x13')](respondWithResult(_0x1df00f,null))[_0xec22('0x1e')](handleError(_0x1df00f,null));};exports[_0xec22('0x6d')]=function(_0x261836,_0xd5c943){return db[_0xec22('0x5e')][_0xec22('0x6d')]()['then'](respondWithResult(_0xd5c943,null))[_0xec22('0x1e')](handleError(_0xd5c943,null));};exports['addDisposition']=function(_0xa9c474,_0x72cf11){if(_0xa9c474[_0xec22('0x69')]['id']){delete _0xa9c474['body']['id'];}return db[_0xec22('0x5e')][_0xec22('0x68')]({'where':{'id':_0xa9c474['params']['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x72cf11,null))['then'](function(_0x46c48c){if(_0x46c48c){_0xa9c474[_0xec22('0x69')][_0xec22('0x6e')]=_0x46c48c['id'];return db[_0xec22('0x6f')]['create'](_0xa9c474[_0xec22('0x69')]);}})[_0xec22('0x13')](respondWithResult(_0x72cf11,null))[_0xec22('0x1e')](handleError(_0x72cf11,null));};exports[_0xec22('0x70')]=function(_0x35c712,_0xd8ba29){var _0x57ed9a={'raw':![],'where':{}};var _0x3f37f7={};var _0x2c5f49={'count':0x0,'rows':[]};return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x35c712[_0xec22('0x64')]['id']}})['then'](handleEntityNotFound(_0xd8ba29,null))[_0xec22('0x13')](function(_0x2e5033){if(_0x2e5033){_0x3f37f7[_0xec22('0x4d')]=_[_0xec22('0x4f')](db[_0xec22('0x6f')][_0xec22('0x49')]);_0x3f37f7[_0xec22('0x4e')]=_['keys'](_0x35c712['query']);_0x3f37f7[_0xec22('0x50')]=_['intersection'](_0x3f37f7['model'],_0x3f37f7[_0xec22('0x4e')]);_0x57ed9a[_0xec22('0x52')]=_[_0xec22('0x51')](_0x3f37f7['model'],qs['fields'](_0x35c712['query'][_0xec22('0x53')]));_0x57ed9a['attributes']=_0x57ed9a['attributes'][_0xec22('0x54')]?_0x57ed9a[_0xec22('0x52')]:_0x3f37f7[_0xec22('0x4d')];if(!_0x35c712['query'][_0xec22('0x55')](_0xec22('0x56'))){_0x57ed9a[_0xec22('0x25')]=qs[_0xec22('0x25')](_0x35c712[_0xec22('0x4e')][_0xec22('0x25')]);_0x57ed9a['offset']=qs[_0xec22('0x23')](_0x35c712[_0xec22('0x4e')][_0xec22('0x23')]);}_0x57ed9a[_0xec22('0x57')]=qs[_0xec22('0x58')](_0x35c712['query'][_0xec22('0x58')]);_0x57ed9a['where']=qs[_0xec22('0x50')](_[_0xec22('0x59')](_0x35c712[_0xec22('0x4e')],_0x3f37f7[_0xec22('0x50')]));_0x57ed9a[_0xec22('0x5b')][_0xec22('0x6e')]=_0x2e5033['id'];if(_0x35c712[_0xec22('0x4e')]['filter']){_0x57ed9a[_0xec22('0x5b')]=_[_0xec22('0x5d')](_0x57ed9a[_0xec22('0x5b')],{'$or':_['map'](_0x57ed9a[_0xec22('0x52')],function(_0x13eba4){var _0x51a9f3={};_0x51a9f3[_0x13eba4]={'$like':'%'+_0x35c712['query']['filter']+'%'};return _0x51a9f3;})});}_0x57ed9a=_[_0xec22('0x5d')]({},_0x57ed9a,_0x35c712[_0xec22('0x67')]);return db['Disposition'][_0xec22('0x5f')]({'where':_0x57ed9a['where']})[_0xec22('0x13')](function(_0x1d31e8){_0x2c5f49[_0xec22('0x5f')]=_0x1d31e8;if(_0x35c712[_0xec22('0x4e')]['includeAll']){_0x57ed9a[_0xec22('0x66')]=[{'all':!![]}];}return db[_0xec22('0x6f')][_0xec22('0x61')](_0x57ed9a);})['then'](function(_0x3851b5){_0x2c5f49[_0xec22('0x62')]=_0x3851b5;return _0x2c5f49;});}})[_0xec22('0x13')](respondWithFilteredResult(_0xd8ba29,_0x57ed9a))['catch'](handleError(_0xd8ba29,null));};exports[_0xec22('0x72')]=function(_0x588666,_0x55f981){return db[_0xec22('0x5e')]['find']({'where':{'id':_0x588666[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x55f981,null))[_0xec22('0x13')](function(_0x447c5b){if(_0x447c5b){return _0x447c5b[_0xec22('0x72')](_0x588666[_0xec22('0x4e')][_0xec22('0x73')]);}})[_0xec22('0x13')](respondWithStatusCode(_0x55f981,null))[_0xec22('0x1e')](handleError(_0x55f981,null));};exports['addAnswer']=function(_0x13073a,_0x44d3a0){if(_0x13073a[_0xec22('0x69')]['id']){delete _0x13073a[_0xec22('0x69')]['id'];}return db[_0xec22('0x5e')]['find']({'where':{'id':_0x13073a[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x44d3a0,null))[_0xec22('0x13')](function(_0xbeb897){if(_0xbeb897){_0x13073a[_0xec22('0x69')][_0xec22('0x6e')]=_0xbeb897['id'];return db['CannedAnswer'][_0xec22('0x74')](_0x13073a['body']);}})[_0xec22('0x13')](respondWithResult(_0x44d3a0,null))['catch'](handleError(_0x44d3a0,null));};exports['getAnswers']=function(_0x21af57,_0x3f5e75){var _0x26027c={'raw':![],'where':{}};var _0x563b9b={};var _0x7cfa3f={'count':0x0,'rows':[]};return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x21af57[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x3f5e75,null))[_0xec22('0x13')](function(_0x1d720b){if(_0x1d720b){_0x563b9b[_0xec22('0x4d')]=_[_0xec22('0x4f')](db[_0xec22('0x75')][_0xec22('0x49')]);_0x563b9b[_0xec22('0x4e')]=_['keys'](_0x21af57[_0xec22('0x4e')]);_0x563b9b[_0xec22('0x50')]=_['intersection'](_0x563b9b[_0xec22('0x4d')],_0x563b9b[_0xec22('0x4e')]);_0x26027c[_0xec22('0x52')]=_[_0xec22('0x51')](_0x563b9b[_0xec22('0x4d')],qs[_0xec22('0x53')](_0x21af57[_0xec22('0x4e')][_0xec22('0x53')]));_0x26027c[_0xec22('0x52')]=_0x26027c[_0xec22('0x52')][_0xec22('0x54')]?_0x26027c[_0xec22('0x52')]:_0x563b9b[_0xec22('0x4d')];if(!_0x21af57[_0xec22('0x4e')][_0xec22('0x55')]('nolimit')){_0x26027c[_0xec22('0x25')]=qs[_0xec22('0x25')](_0x21af57['query'][_0xec22('0x25')]);_0x26027c[_0xec22('0x23')]=qs[_0xec22('0x23')](_0x21af57['query']['offset']);}_0x26027c[_0xec22('0x57')]=qs[_0xec22('0x58')](_0x21af57['query'][_0xec22('0x58')]);_0x26027c['where']=qs['filters'](_[_0xec22('0x59')](_0x21af57[_0xec22('0x4e')],_0x563b9b[_0xec22('0x50')]));_0x26027c[_0xec22('0x5b')]['MailAccountId']=_0x1d720b['id'];if(_0x21af57[_0xec22('0x4e')][_0xec22('0x5a')]){_0x26027c[_0xec22('0x5b')]=_[_0xec22('0x5d')](_0x26027c[_0xec22('0x5b')],{'$or':_[_0xec22('0x48')](_0x26027c[_0xec22('0x52')],function(_0x14c1e4){var _0x4452d1={};_0x4452d1[_0x14c1e4]={'$like':'%'+_0x21af57[_0xec22('0x4e')][_0xec22('0x5a')]+'%'};return _0x4452d1;})});}_0x26027c=_['merge']({},_0x26027c,_0x21af57[_0xec22('0x67')]);return db[_0xec22('0x75')]['count']({'where':_0x26027c[_0xec22('0x5b')]})[_0xec22('0x13')](function(_0x5eca84){_0x7cfa3f['count']=_0x5eca84;if(_0x21af57[_0xec22('0x4e')][_0xec22('0x60')]){_0x26027c[_0xec22('0x66')]=[{'all':!![]}];}return db[_0xec22('0x75')][_0xec22('0x61')](_0x26027c);})[_0xec22('0x13')](function(_0x2ba457){_0x7cfa3f['rows']=_0x2ba457;return _0x7cfa3f;});}})[_0xec22('0x13')](respondWithFilteredResult(_0x3f5e75,_0x26027c))['catch'](handleError(_0x3f5e75,null));};exports['removeAnswers']=function(_0x5164d8,_0x18e1bd){return db[_0xec22('0x5e')][_0xec22('0x68')]({'where':{'id':_0x5164d8[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x18e1bd,null))['then'](function(_0x555e32){if(_0x555e32){return _0x555e32[_0xec22('0x76')](_0x5164d8[_0xec22('0x4e')][_0xec22('0x73')]);}})[_0xec22('0x13')](respondWithStatusCode(_0x18e1bd,null))[_0xec22('0x1e')](handleError(_0x18e1bd,null));};exports['create']=function(_0x3a0396,_0x3096a4){var _0x945afc={'name':_0x3a0396['body'][_0xec22('0x2b')],'key':_0x3a0396[_0xec22('0x69')][_0xec22('0x4c')],'provider':_0x3a0396[_0xec22('0x69')][_0xec22('0x6a')]===_0xec22('0x6b')?null:_0x3a0396['body'][_0xec22('0x6a')],'email':_0x3a0396[_0xec22('0x69')]['email'],'ListId':_0x3a0396[_0xec22('0x69')]['ListId'],'active':!_[_0xec22('0x77')](_0x3a0396[_0xec22('0x69')][_0xec22('0x78')])?_0x3a0396['body']['active']:!![],'description':_0x3a0396[_0xec22('0x69')][_0xec22('0x79')]||null};var _0x4862da=getAuthenticationOptions(_0x945afc[_0xec22('0x6a')],_0x3a0396[_0xec22('0x69')]);_0x945afc['Imap']=_0x4862da['Imap'];_0x945afc[_0xec22('0x44')]=_0x4862da[_0xec22('0x44')];return db['MailAccount'][_0xec22('0x74')](_0x945afc,{'include':[{'model':db['MailServerOut'],'as':_0xec22('0x44')},{'model':db[_0xec22('0x65')],'as':'Imap'}]})[_0xec22('0x13')](function(_0x3db1e4){var _0x3459ce=_0x3a0396[_0xec22('0x38')][_0xec22('0x7a')]({'plain':!![]});if(!_0x3459ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3459ce[_0xec22('0x7b')]===_0xec22('0x38')){var _0x1fa92a=_0x3db1e4[_0xec22('0x7a')]({'plain':!![]});return db['UserProfileSection'][_0xec22('0x68')]({'where':{'name':_0xec22('0x29'),'userProfileId':_0x3459ce[_0xec22('0x7c')]},'raw':!![]})[_0xec22('0x13')](function(_0x55a066){if(_0x55a066&&_0x55a066[_0xec22('0x7d')]===0x0){return db['UserProfileResource'][_0xec22('0x74')]({'name':_0x1fa92a['name'],'resourceId':_0x1fa92a['id'],'type':_0x55a066[_0xec22('0x2b')],'sectionId':_0x55a066['id']},{})['then'](function(){return _0x3db1e4;});}else{return _0x3db1e4;}})[_0xec22('0x1e')](function(_0x40465c){logger[_0xec22('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40465c);throw _0x40465c;});}return _0x3db1e4;})[_0xec22('0x13')](respondWithResult(_0x3096a4,0xc9))[_0xec22('0x1e')](handleError(_0x3096a4,null));};exports[_0xec22('0x7e')]=function(_0x35eeee,_0x5a5d70){return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x35eeee[_0xec22('0x64')]['id']}})['then'](handleEntityNotFound(_0x5a5d70,null))['then'](function(_0x19c863){if(_0x19c863){return _0x19c863['getImap']();}return null;})[_0xec22('0x13')](respondWithResult(_0x5a5d70,null))[_0xec22('0x1e')](handleError(_0x5a5d70,null));};exports[_0xec22('0x7f')]=function(_0xadaa83,_0x1d444a){if(_0xadaa83['body']['id']){delete _0xadaa83[_0xec22('0x69')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xadaa83['params']['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x1d444a,null))[_0xec22('0x13')](function(_0x3b9bed){if(_0x3b9bed){_0xadaa83[_0xec22('0x69')]['MailAccountId']=_0x3b9bed['id'];return db['MailServerIn'][_0xec22('0x74')](_0xadaa83[_0xec22('0x69')]);}})[_0xec22('0x13')](respondWithResult(_0x1d444a,null))[_0xec22('0x1e')](handleError(_0x1d444a,null));};exports['removeImap']=function(_0x242954,_0x24f9de){return db[_0xec22('0x5e')]['findOne']({'where':{'id':_0x242954[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x24f9de,null))[_0xec22('0x13')](function(_0x402fc2){if(_0x402fc2){return _0x402fc2[_0xec22('0x80')](null);}return null;})[_0xec22('0x13')](respondWithStatusCode(_0x24f9de,null))[_0xec22('0x1e')](handleError(_0x24f9de,null));};exports[_0xec22('0x81')]=function(_0x5afbc6,_0xe78c11){return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x5afbc6['params']['id']}})[_0xec22('0x13')](handleEntityNotFound(_0xe78c11,null))[_0xec22('0x13')](function(_0x310e2d){if(_0x310e2d){return _0x310e2d[_0xec22('0x81')]();}return null;})[_0xec22('0x13')](respondWithResult(_0xe78c11,null))[_0xec22('0x1e')](handleError(_0xe78c11,null));};exports[_0xec22('0x82')]=function(_0x3bbc6b,_0x336e67){if(_0x3bbc6b[_0xec22('0x69')]['id']){delete _0x3bbc6b[_0xec22('0x69')]['id'];}return db[_0xec22('0x5e')]['find']({'where':{'id':_0x3bbc6b[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x336e67,null))[_0xec22('0x13')](function(_0x1c9380){if(_0x1c9380){_0x3bbc6b[_0xec22('0x69')]['MailAccountId']=_0x1c9380['id'];return db[_0xec22('0x45')][_0xec22('0x74')](_0x3bbc6b[_0xec22('0x69')]);}})[_0xec22('0x13')](respondWithResult(_0x336e67,null))[_0xec22('0x1e')](handleError(_0x336e67,null));};exports[_0xec22('0x83')]=function(_0x59093e,_0x178003){return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x59093e[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x178003,null))[_0xec22('0x13')](function(_0x151f46){if(_0x151f46){return _0x151f46[_0xec22('0x84')](null);}return null;})[_0xec22('0x13')](respondWithStatusCode(_0x178003,null))[_0xec22('0x1e')](handleError(_0x178003,null));};exports['addInteraction']=function(_0x3d3d5e,_0x3d3b3d){return db['MailInteraction']['find']({'where':{'id':_0x3d3d5e[_0xec22('0x64')]['id']}})['then'](handleEntityNotFound(_0x3d3b3d,null))[_0xec22('0x13')](function(_0x1beac8){if(_0x1beac8){return _0x1beac8[_0xec22('0x85')](_0x3d3d5e[_0xec22('0x69')][_0xec22('0x73')],_['omit'](_0x3d3d5e['body'],[_0xec22('0x73'),'id'])||{});}})[_0xec22('0x13')](respondWithResult(_0x3d3b3d,null))[_0xec22('0x1e')](handleError(_0x3d3b3d,null));};exports[_0xec22('0x86')]=function(_0x4a0a18,_0x553e7f){var _0x13908a={'raw':![],'where':{}};var _0x4ff257={};var _0x3193af={'count':0x0,'rows':[]};return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x4a0a18[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x553e7f,null))[_0xec22('0x13')](function(_0x12a18e){if(_0x12a18e){_0x4ff257['model']=_[_0xec22('0x4f')](db[_0xec22('0x87')][_0xec22('0x49')]);_0x4ff257[_0xec22('0x4e')]=_[_0xec22('0x4f')](_0x4a0a18['query']);_0x4ff257['filters']=_['intersection'](_0x4ff257[_0xec22('0x4d')],_0x4ff257[_0xec22('0x4e')]);_0x13908a[_0xec22('0x52')]=_[_0xec22('0x51')](_0x4ff257[_0xec22('0x4d')],qs[_0xec22('0x53')](_0x4a0a18[_0xec22('0x4e')][_0xec22('0x53')]));_0x13908a['attributes']=_0x13908a[_0xec22('0x52')][_0xec22('0x54')]?_0x13908a['attributes']:_0x4ff257[_0xec22('0x4d')];if(!_0x4a0a18[_0xec22('0x4e')]['hasOwnProperty'](_0xec22('0x56'))){_0x13908a['limit']=qs[_0xec22('0x25')](_0x4a0a18[_0xec22('0x4e')][_0xec22('0x25')]);_0x13908a[_0xec22('0x23')]=qs[_0xec22('0x23')](_0x4a0a18[_0xec22('0x4e')][_0xec22('0x23')]);}_0x13908a[_0xec22('0x57')]=qs[_0xec22('0x58')](_0x4a0a18[_0xec22('0x4e')][_0xec22('0x58')]);_0x13908a[_0xec22('0x5b')]=qs[_0xec22('0x50')](_[_0xec22('0x59')](_0x4a0a18['query'],_0x4ff257[_0xec22('0x50')]));_0x13908a[_0xec22('0x5b')][_0xec22('0x6e')]=_0x12a18e['id'];if(_0x4a0a18[_0xec22('0x4e')][_0xec22('0x5a')]){_0x13908a[_0xec22('0x5b')]=_[_0xec22('0x5d')](_0x13908a[_0xec22('0x5b')],{'$or':_[_0xec22('0x48')](_0x13908a[_0xec22('0x52')],function(_0x58f4cc){var _0x5774b2={};_0x5774b2[_0x58f4cc]={'$like':'%'+_0x4a0a18[_0xec22('0x4e')][_0xec22('0x5a')]+'%'};return _0x5774b2;})});}_0x13908a=_[_0xec22('0x5d')]({},_0x13908a,_0x4a0a18['options']);return db['MailInteraction'][_0xec22('0x5f')]({'where':_0x13908a['where']})[_0xec22('0x13')](function(_0x405a12){_0x3193af[_0xec22('0x5f')]=_0x405a12;if(_0x4a0a18[_0xec22('0x4e')][_0xec22('0x60')]){_0x13908a[_0xec22('0x66')]=[{'model':db[_0xec22('0x88')],'as':_0xec22('0x89'),'required':![]},{'model':db[_0xec22('0x8a')],'as':_0xec22('0x8b'),'attributes':[_0xec22('0x2b'),'fullname',_0xec22('0x8c')],'required':![]},{'model':db[_0xec22('0x8d')],'as':_0xec22('0x8e'),'attributes':['id','name',_0xec22('0x8f')],'where':_0x4a0a18['query'][_0xec22('0x90')]?{'id':_0x4a0a18[_0xec22('0x4e')][_0xec22('0x90')]}:undefined,'required':_0x4a0a18['query'][_0xec22('0x90')]?!![]:![]}];}return db[_0xec22('0x87')][_0xec22('0x61')](_0x13908a);})['then'](function(_0xc421a1){_0x3193af['rows']=_0xc421a1;return _0x3193af;});}})['then'](respondWithFilteredResult(_0x553e7f,_0x13908a))[_0xec22('0x1e')](handleError(_0x553e7f,null));};exports[_0xec22('0x91')]=function addApplications(_0x15a40f,_0x2dfe2e){var _0x57d855=_0x15a40f[_0xec22('0x64')]['id'];var _0x54974d=_0x15a40f[_0xec22('0x69')];var _0x19bf51=0xc8;var _0x13ecf6=null;return db[_0xec22('0x92')][_0xec22('0x93')]({'isolationLevel':db['sequelize'][_0xec22('0x94')][_0xec22('0x95')]['READ_COMMITTED']},function(_0x261df6){return db[_0xec22('0x5e')][_0xec22('0x71')]({'where':{'id':_0x57d855},'transaction':_0x261df6})[_0xec22('0x13')](function(_0x48fac9){if(_0x48fac9){return db['MailApplication'][_0xec22('0x28')]({'where':{'MailAccountId':_0x57d855},'transaction':_0x261df6})[_0xec22('0x13')](function(){var _0x25b821=_[_0xec22('0x48')](_0x54974d,function(_0x1717f9){_0x1717f9[_0xec22('0x6e')]=_0x57d855;return _0x1717f9;});return db[_0xec22('0x96')][_0xec22('0x97')](_0x25b821,{'transaction':_0x261df6});});}else{_0x19bf51=0x194;_0x13ecf6=[];}});})[_0xec22('0x13')](function(){if(_0x19bf51!==0x194){return db[_0xec22('0x96')][_0xec22('0x98')]({'where':{'MailAccountId':_0x57d855},'order':_0xec22('0x99')})[_0xec22('0x13')](function(_0x546871){_0x13ecf6=_0x546871;});}})[_0xec22('0x1e')](function(_0x57bf07){_0x19bf51=0x1f4;logger[_0xec22('0x1a')](_0x57bf07[_0xec22('0x2a')]);if(_0x57bf07[_0xec22('0x2b')]){delete _0x57bf07['name'];}_0x13ecf6=_0x57bf07;})['finally'](function(){if(_0x13ecf6===null){_0x2dfe2e[_0xec22('0x1f')](_0x19bf51);}else{if(_0x19bf51===0x1f4){_0x2dfe2e[_0xec22('0x20')](_0x19bf51)['send'](_0x13ecf6);}else{_0x2dfe2e[_0xec22('0x20')](_0x19bf51)[_0xec22('0x22')](_0x13ecf6);}}});};exports[_0xec22('0x9a')]=function(_0x228c55,_0x267777){var _0x2998f2={};var _0x1b7039={};var _0x5afc8d;var _0x200f98;return db['MailAccount'][_0xec22('0x71')]({'where':{'id':_0x228c55[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x267777,null))[_0xec22('0x13')](function(_0x388b6a){if(_0x388b6a){_0x5afc8d=_0x388b6a;_0x1b7039[_0xec22('0x4d')]=_[_0xec22('0x4f')](db[_0xec22('0x96')][_0xec22('0x49')]);_0x1b7039['query']=_[_0xec22('0x4f')](_0x228c55[_0xec22('0x4e')]);_0x1b7039['filters']=_['intersection'](_0x1b7039[_0xec22('0x4d')],_0x1b7039[_0xec22('0x4e')]);_0x2998f2[_0xec22('0x52')]=_[_0xec22('0x51')](_0x1b7039['model'],qs['fields'](_0x228c55[_0xec22('0x4e')][_0xec22('0x53')]));_0x2998f2['attributes']=_0x2998f2[_0xec22('0x52')][_0xec22('0x54')]?_0x2998f2[_0xec22('0x52')]:_0x1b7039[_0xec22('0x4d')];_0x2998f2['order']=qs[_0xec22('0x58')](_0x228c55[_0xec22('0x4e')]['sort']);_0x2998f2[_0xec22('0x5b')]=qs[_0xec22('0x50')](_[_0xec22('0x59')](_0x228c55[_0xec22('0x4e')],_0x1b7039[_0xec22('0x50')]));if(_0x228c55[_0xec22('0x4e')]['filter']){_0x2998f2[_0xec22('0x5b')]=_[_0xec22('0x5d')](_0x2998f2[_0xec22('0x5b')],{'$or':_['map'](_0x2998f2[_0xec22('0x52')],function(_0x9c63ca){var _0xfc4e70={};_0xfc4e70[_0x9c63ca]={'$like':'%'+_0x228c55[_0xec22('0x4e')][_0xec22('0x5a')]+'%'};return _0xfc4e70;})});}_0x2998f2=_[_0xec22('0x5d')]({},_0x2998f2,_0x228c55['options']);return _0x5afc8d[_0xec22('0x9a')](_0x2998f2);}})[_0xec22('0x13')](function(_0x244d72){if(_0x244d72){_0x200f98=_0x244d72[_0xec22('0x54')];if(!_0x228c55[_0xec22('0x4e')][_0xec22('0x55')]('nolimit')){_0x2998f2[_0xec22('0x25')]=qs[_0xec22('0x25')](_0x228c55[_0xec22('0x4e')][_0xec22('0x25')]);_0x2998f2[_0xec22('0x23')]=qs[_0xec22('0x23')](_0x228c55[_0xec22('0x4e')][_0xec22('0x23')]);}return _0x5afc8d[_0xec22('0x9a')](_0x2998f2);}})[_0xec22('0x13')](function(_0x758663){if(_0x758663){return _0x758663?{'count':_0x200f98,'rows':_0x758663}:null;}})[_0xec22('0x13')](respondWithResult(_0x267777,null))[_0xec22('0x1e')](handleError(_0x267777,null));};exports[_0xec22('0x9b')]=function(_0x51874b,_0x568fa4){var _0x559cc7={'raw':!![],'where':{}};var _0x3563f5={};var _0x10c4f1={'count':0x0,'rows':[]};return db['MailAccount'][_0xec22('0x71')]({'where':{'id':_0x51874b[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x568fa4,null))[_0xec22('0x13')](function(_0x5c08dc){if(_0x5c08dc){_0x3563f5[_0xec22('0x4d')]=_['keys'](db['MailMessage']['rawAttributes']);_0x3563f5[_0xec22('0x4e')]=_[_0xec22('0x4f')](_0x51874b['query']);_0x3563f5[_0xec22('0x50')]=_[_0xec22('0x51')](_0x3563f5['model'],_0x3563f5[_0xec22('0x4e')]);_0x559cc7[_0xec22('0x52')]=_[_0xec22('0x51')](_0x3563f5[_0xec22('0x4d')],qs['fields'](_0x51874b[_0xec22('0x4e')]['fields']));_0x559cc7[_0xec22('0x52')]=_0x559cc7[_0xec22('0x52')][_0xec22('0x54')]?_0x559cc7[_0xec22('0x52')]:_0x3563f5[_0xec22('0x4d')];if(!_0x51874b[_0xec22('0x4e')][_0xec22('0x55')](_0xec22('0x56'))){_0x559cc7[_0xec22('0x25')]=qs[_0xec22('0x25')](_0x51874b['query']['limit']);_0x559cc7[_0xec22('0x23')]=qs['offset'](_0x51874b['query'][_0xec22('0x23')]);}_0x559cc7['order']=qs[_0xec22('0x58')](_0x51874b[_0xec22('0x4e')][_0xec22('0x58')]);_0x559cc7['where']=qs[_0xec22('0x50')](_[_0xec22('0x59')](_0x51874b[_0xec22('0x4e')],_0x3563f5['filters']));_0x559cc7[_0xec22('0x5b')][_0xec22('0x6e')]=_0x5c08dc['id'];if(_0x51874b['query'][_0xec22('0x5a')]){_0x559cc7[_0xec22('0x5b')]=_['merge'](_0x559cc7['where'],{'$or':_[_0xec22('0x48')](_0x559cc7[_0xec22('0x52')],function(_0x39c672){var _0x4b0e40={};_0x4b0e40[_0x39c672]={'$like':'%'+_0x51874b[_0xec22('0x4e')][_0xec22('0x5a')]+'%'};return _0x4b0e40;})});}if(_0x51874b[_0xec22('0x4e')][_0xec22('0x9c')]){var _0x652af1=_0x51874b[_0xec22('0x4e')][_0xec22('0x9c')]['split'](',');var _0x2d67a6={};_0x2d67a6[_0x652af1[0x0]]={'$gte':moment(_0x652af1[0x1])[_0xec22('0x9d')](_0xec22('0x9e'))};_0x559cc7[_0xec22('0x5b')]=_[_0xec22('0x5d')](_0x559cc7[_0xec22('0x5b')],_0x2d67a6);}_0x559cc7=_[_0xec22('0x5d')]({},_0x559cc7,_0x51874b[_0xec22('0x67')]);return db['MailMessage'][_0xec22('0x5f')]({'where':_0x559cc7['where']})[_0xec22('0x13')](function(_0x260293){_0x10c4f1[_0xec22('0x5f')]=_0x260293;if(_0x51874b[_0xec22('0x4e')]['includeAll']){_0x559cc7[_0xec22('0x66')]=[{'all':!![]}];}return db[_0xec22('0x9f')]['findAll'](_0x559cc7);})['then'](function(_0x5effa1){if(_0x51874b['query'][_0xec22('0xa0')]===_0xec22('0xa1')){for(var _0x261382=0x0;_0x261382<_0x5effa1[_0xec22('0x54')];_0x261382++){_0x5effa1[_0x261382][_0xec22('0x69')]=juice(_0x5effa1[_0x261382][_0xec22('0x69')]);}}_0x10c4f1[_0xec22('0x62')]=_0x5effa1;return _0x10c4f1;});}})[_0xec22('0x13')](respondWithFilteredResult(_0x568fa4,_0x559cc7))[_0xec22('0x1e')](handleError(_0x568fa4,null));};exports[_0xec22('0x2c')]=function(_0x562026,_0x144976){var _0x561a9c,_0x548dd5={},_0xba85e2;if(_0x562026['body']['to']){_0xba85e2=_0x562026[_0xec22('0x69')]['to'][_0xec22('0xa2')](',')[0x0];}return db[_0xec22('0x5e')][_0xec22('0x68')]({'where':{'id':_0x562026[_0xec22('0x64')]['id']},'include':[{'model':db[_0xec22('0xa3')],'as':_0xec22('0xa4'),'include':[{'model':db[_0xec22('0x88')],'as':_0xec22('0xa5'),'where':{'email':_0xba85e2},'limit':0x1,'order':[['updatedAt',_0xec22('0xa6')]]}]},{'model':db[_0xec22('0x45')],'as':_0xec22('0x44'),'raw':!![],'include':[{'model':db[_0xec22('0xa7')],'as':_0xec22('0xa7'),'raw':!![]}]}]})[_0xec22('0x13')](handleEntityNotFound(_0x144976,null))[_0xec22('0x13')](function(_0x358f87){if(!_0x358f87)return;_0x561a9c=_0x358f87;if(!_0x358f87[_0xec22('0x44')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xec22('0x77')](_0x562026['body']['from'])){_0x562026['body'][_0xec22('0xa8')]=util[_0xec22('0x9d')]('%s\x20<%s>',_0x358f87['name'],_0x358f87[_0xec22('0xa9')]||_0x358f87['Smtp'][_0xec22('0x38')]);}if(_0x562026[_0xec22('0x69')][_0xec22('0xaa')]&&_0x562026['body'][_0xec22('0xaa')]['length']){for(var _0x298198=0x0;_0x298198<_0x562026[_0xec22('0x69')][_0xec22('0xaa')][_0xec22('0x54')];_0x298198+=0x1){_0x562026[_0xec22('0x69')][_0xec22('0xaa')][_0x298198]={'filename':_0x562026[_0xec22('0x69')][_0xec22('0xaa')][_0x298198][_0xec22('0x2b')],'path':path['join'](config['root'],_0xec22('0xab'),_0x562026['body']['attachments'][_0x298198]['basename'])};}}var _0x5ca320=_0x358f87[_0xec22('0xac')]();return respondWithRpcPromise(_0xec22('0xad'),'sendMail',{'account':_0x5ca320,'message':_0x562026[_0xec22('0x69')]});})['then'](function(_0x5a8098){if(!_0x5a8098)return;_0x548dd5=_0x5a8098;if(!_0x561a9c['List'])throw new Error(_0xec22('0xae'));if(_0x561a9c[_0xec22('0xa4')][_0xec22('0xa5')][_0xec22('0x54')])return _0x561a9c[_0xec22('0xa4')][_0xec22('0xa5')][0x0];return db[_0xec22('0x88')][_0xec22('0x74')](_['defaults'](_0x562026[_0xec22('0x69')],{'firstName':_0x562026[_0xec22('0x69')]['to'],'email':_0x562026[_0xec22('0x69')]['to'],'phone':_0x562026[_0xec22('0x69')]['to'],'ListId':_0x561a9c['ListId']}));})[_0xec22('0x13')](function(_0x28cb79){if(!_0x28cb79)return;var _0x1d98b8={'UserId':_0x562026[_0xec22('0x38')]['id'],'ContactId':_0x28cb79['id'],'MailAccountId':_0x561a9c['id'],'inReplyTo':_0x548dd5[_0xec22('0xaf')],'to':_0x562026[_0xec22('0x69')][_0xec22('0xa8')],'cc':_0x562026['body']['cc'],'subject':_0x562026[_0xec22('0x69')]['subject'],'attach':_0x562026[_0xec22('0x69')][_0xec22('0xb0')],'firstMsgDirection':_0xec22('0xb1'),'lastMsgAt':moment()[_0xec22('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xec22('0xb1'),'Messages':[_[_0xec22('0x5d')](_0x562026[_0xec22('0x69')],{'messageId':_0x548dd5['messageId'],'sentAt':moment()[_0xec22('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x561a9c['id'],'UserId':_0x562026['user']['id'],'ContactId':_0x28cb79['id']})]};if(_0x562026[_0xec22('0x69')][_0xec22('0xb2')]){_0x1d98b8=_[_0xec22('0x5d')](_0x1d98b8,_0x562026['body'][_0xec22('0xb2')]);}return db[_0xec22('0x87')][_0xec22('0x74')](_0x1d98b8,{'include':[{'model':db[_0xec22('0x9f')],'as':_0xec22('0xb3')}]});})[_0xec22('0x13')](respondWithResult(_0x144976,null))[_0xec22('0x1e')](handleError(_0x144976,null));};exports[_0xec22('0xb4')]=function(_0x31f166,_0x4a4eb6){return db['MailAccount'][_0xec22('0x68')]({'where':{'id':_0x31f166[_0xec22('0x64')]['id']},'include':[{'model':db[_0xec22('0x45')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})[_0xec22('0x13')](handleEntityNotFound(_0x4a4eb6,null))['then'](function(_0x361e43){if(!_0x361e43[_0xec22('0x44')])return;var _0x587c2e=_0x361e43[_0xec22('0xac')]();return respondWithRpcPromise('VerifySmtp',_0xec22('0xb4'),{'account':_0x587c2e});})['then'](respondWithResult(_0x4a4eb6,null))[_0xec22('0x1e')](handleError(_0x4a4eb6,null));};exports[_0xec22('0x28')]=function(_0x39adea,_0x50ca77){return db[_0xec22('0x5e')]['find']({'where':{'id':_0x39adea[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x50ca77,null))[_0xec22('0x13')](function(_0x553461){if(_0x553461&&_0x553461[_0xec22('0x41')]){throw new db[(_0xec22('0xb5'))]['ValidationError'](_0xec22('0xb6'));}return _0x553461;})[_0xec22('0x13')](removeEntity(_0x50ca77,null))['catch'](handleError(_0x50ca77,null));};exports[_0xec22('0xb7')]=function(_0x11dda1,_0x3c2e39){return db[_0xec22('0x5e')]['find']({'where':{'id':_0x11dda1[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x3c2e39,null))[_0xec22('0x13')](function(_0x58058e){if(_0x58058e){return _0x58058e[_0xec22('0xb7')](_0x11dda1[_0xec22('0x69')][_0xec22('0x73')],_[_0xec22('0xb8')](_0x11dda1[_0xec22('0x69')],[_0xec22('0x73'),'id'])||{})[_0xec22('0xb9')](function(_0x2ef3ac){for(var _0x3ad396=0x0;_0x3ad396<_0x11dda1[_0xec22('0x69')]['ids']['length'];_0x3ad396+=0x1){socket['emit'](_0xec22('0xba'),{'UserId':Number(_0x11dda1[_0xec22('0x69')]['ids'][_0x3ad396]),'MailAccountId':Number(_0x11dda1['params']['id'])});}return _0x2ef3ac;});}})['then'](respondWithResult(_0x3c2e39,null))[_0xec22('0x1e')](handleError(_0x3c2e39,null));};exports[_0xec22('0xbb')]=function(_0x43ac58,_0x363df2){return db[_0xec22('0x5e')]['find']({'where':{'id':_0x43ac58[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x363df2,null))[_0xec22('0x13')](function(_0x2c3c77){if(_0x2c3c77){return _0x2c3c77[_0xec22('0xbb')](_0x43ac58[_0xec22('0x4e')]['ids'])[_0xec22('0x13')](function(){if(_['isArray'](_0x43ac58['query'][_0xec22('0x73')])){for(var _0x40f437=0x0;_0x40f437<_0x43ac58[_0xec22('0x4e')]['ids'][_0xec22('0x54')];_0x40f437+=0x1){socket[_0xec22('0xbc')](_0xec22('0xbd'),{'UserId':Number(_0x43ac58['query'][_0xec22('0x73')][_0x40f437]),'MailAccountId':Number(_0x43ac58['params']['id'])});}}else{socket[_0xec22('0xbc')](_0xec22('0xbd'),{'UserId':Number(_0x43ac58[_0xec22('0x4e')][_0xec22('0x73')]),'MailAccountId':Number(_0x43ac58[_0xec22('0x64')]['id'])});}});}})[_0xec22('0x13')](respondWithStatusCode(_0x363df2,null))[_0xec22('0x1e')](handleError(_0x363df2,null));};exports[_0xec22('0xbe')]=function(_0x5dfa87,_0x36426a){var _0x21ab7f={};var _0x249d9c={};var _0x5223bb;var _0x4f0c68;return db['MailAccount'][_0xec22('0x71')]({'where':{'id':_0x5dfa87[_0xec22('0x64')]['id']}})[_0xec22('0x13')](handleEntityNotFound(_0x36426a,null))[_0xec22('0x13')](function(_0x2391d8){if(_0x2391d8){_0x5223bb=_0x2391d8;_0x249d9c[_0xec22('0x4d')]=_[_0xec22('0x4f')](db[_0xec22('0x8a')][_0xec22('0x49')]);_0x249d9c['query']=_[_0xec22('0x4f')](_0x5dfa87[_0xec22('0x4e')]);_0x249d9c['filters']=_[_0xec22('0x51')](_0x249d9c[_0xec22('0x4d')],_0x249d9c['query']);_0x21ab7f[_0xec22('0x52')]=_['intersection'](_0x249d9c[_0xec22('0x4d')],qs['fields'](_0x5dfa87[_0xec22('0x4e')][_0xec22('0x53')]));_0x21ab7f[_0xec22('0x52')]=_0x21ab7f[_0xec22('0x52')]['length']?_0x21ab7f[_0xec22('0x52')]:_0x249d9c['model'];_0x21ab7f[_0xec22('0x57')]=qs['sort'](_0x5dfa87[_0xec22('0x4e')]['sort']);_0x21ab7f[_0xec22('0x5b')]=qs[_0xec22('0x50')](_[_0xec22('0x59')](_0x5dfa87[_0xec22('0x4e')],_0x249d9c[_0xec22('0x50')]));if(_0x5dfa87[_0xec22('0x4e')][_0xec22('0x5a')]){_0x21ab7f[_0xec22('0x5b')]=_[_0xec22('0x5d')](_0x21ab7f['where'],{'$or':_[_0xec22('0x48')](_0x21ab7f[_0xec22('0x52')],function(_0x411762){var _0x1187f7={};_0x1187f7[_0x411762]={'$like':'%'+_0x5dfa87[_0xec22('0x4e')][_0xec22('0x5a')]+'%'};return _0x1187f7;})});}_0x21ab7f=_[_0xec22('0x5d')]({},_0x21ab7f,_0x5dfa87[_0xec22('0x67')]);return _0x5223bb['getAgents'](_0x21ab7f);}})[_0xec22('0x13')](function(_0x73fdfe){if(_0x73fdfe){_0x4f0c68=_0x73fdfe['length'];if(!_0x5dfa87['query'][_0xec22('0x55')](_0xec22('0x56'))){_0x21ab7f[_0xec22('0x25')]=qs[_0xec22('0x25')](_0x5dfa87[_0xec22('0x4e')][_0xec22('0x25')]);_0x21ab7f['offset']=qs[_0xec22('0x23')](_0x5dfa87['query'][_0xec22('0x23')]);}return _0x5223bb['getAgents'](_0x21ab7f);}})[_0xec22('0x13')](function(_0x47771c){if(_0x47771c){return _0x47771c?{'count':_0x4f0c68,'rows':_0x47771c}:null;}})[_0xec22('0x13')](respondWithResult(_0x36426a,null))[_0xec22('0x1e')](handleError(_0x36426a,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 840356e..d10f8bb 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 _0x11d1=['remove','emit','hasOwnProperty','hook','events','MailAccount','setMaxListeners','save'];(function(_0x24a67c,_0x49e8ff){var _0x26e79b=function(_0x535faf){while(--_0x535faf){_0x24a67c['push'](_0x24a67c['shift']());}};_0x26e79b(++_0x49e8ff);}(_0x11d1,0x184));var _0x111d=function(_0x318dba,_0x3ff78c){_0x318dba=_0x318dba-0x0;var _0x3cf931=_0x11d1[_0x318dba];return _0x3cf931;};'use strict';var EventEmitter=require(_0x111d('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x111d('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x111d('0x2')](0x0);var events={'afterCreate':_0x111d('0x3'),'afterUpdate':'update','afterDestroy':_0x111d('0x4')};function emitEvent(_0x119e36){return function(_0x3d763a,_0x5657c6,_0x2cc0fb){MailAccountEvents[_0x111d('0x5')](_0x119e36+':'+_0x3d763a['id'],_0x3d763a);MailAccountEvents[_0x111d('0x5')](_0x119e36,_0x3d763a);_0x2cc0fb(null);};}for(var e in events){if(events[_0x111d('0x6')](e)){var event=events[e];MailAccount[_0x111d('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xbdc2=['events','../../mysqldb','MailAccount','setMaxListeners','remove','emit','hook','exports'];(function(_0x2a1c9b,_0x5039f0){var _0x3b6f01=function(_0x51414b){while(--_0x51414b){_0x2a1c9b['push'](_0x2a1c9b['shift']());}};_0x3b6f01(++_0x5039f0);}(_0xbdc2,0x148));var _0x2bdc=function(_0x3efd24,_0x307e53){_0x3efd24=_0x3efd24-0x0;var _0x5df6f2=_0xbdc2[_0x3efd24];return _0x5df6f2;};'use strict';var EventEmitter=require(_0x2bdc('0x0'));var MailAccount=require(_0x2bdc('0x1'))['db'][_0x2bdc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2bdc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2bdc('0x4')};function emitEvent(_0x1d9116){return function(_0x522434,_0x1855bd,_0x378db8){MailAccountEvents['emit'](_0x1d9116+':'+_0x522434['id'],_0x522434);MailAccountEvents[_0x2bdc('0x5')](_0x1d9116,_0x522434);_0x378db8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2bdc('0x6')](e,emitEvent(event));}}module[_0x2bdc('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 473e80b..10f440c 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 _0x78b6=['OAuth2','user','pass','exports','MailAccount','mail_accounts','provider','custom','service','host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x9d374b,_0x54aef8){var _0x5686b0=function(_0x588ea1){while(--_0x588ea1){_0x9d374b['push'](_0x9d374b['shift']());}};_0x5686b0(++_0x54aef8);}(_0x78b6,0xc9));var _0x678b=function(_0x20410e,_0x11ea83){_0x20410e=_0x20410e-0x0;var _0x18e1cc=_0x78b6[_0x20410e];return _0x18e1cc;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x678b('0x0')]=function(_0x7f6fb7){return _0x7f6fb7['define'](_0x678b('0x1'),attributes,{'tableName':_0x678b('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x51be91=this;var _0x49f0fb={'id':_0x51be91['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51be91[_0x678b('0x3')]!==_0x678b('0x4')){_0x49f0fb[_0x678b('0x5')]=_0x51be91['provider'];}else{_0x49f0fb['host']=_0x51be91['Smtp'][_0x678b('0x6')];_0x49f0fb[_0x678b('0x7')]=_0x51be91[_0x678b('0x8')][_0x678b('0x7')];_0x49f0fb[_0x678b('0x9')]=_0x51be91['Smtp']['secure'];}if(_0x51be91[_0x678b('0x8')][_0x678b('0xa')]){if(_0x51be91[_0x678b('0x8')][_0x678b('0xb')]){if(!_0x51be91['Smtp'][_0x678b('0xc')])throw new Error(_0x678b('0xd'));_0x49f0fb[_0x678b('0xe')]={'type':_0x678b('0xf'),'user':_0x51be91[_0x678b('0x8')]['user'],'accessToken':_0x51be91[_0x678b('0x8')][_0x678b('0xc')]['data5']};}else{_0x49f0fb['auth']={'user':_0x51be91[_0x678b('0x8')][_0x678b('0x10')],'pass':_0x51be91[_0x678b('0x8')][_0x678b('0x11')]};}}return _0x49f0fb;}}});}; \ No newline at end of file +var _0x7eab=['port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','define','MailAccount','mail_accounts','provider','custom','host','Smtp'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7eab,0x89));var _0xb7ea=function(_0x2fe2f4,_0x159383){_0x2fe2f4=_0x2fe2f4-0x0;var _0x3232a3=_0x7eab[_0x2fe2f4];return _0x3232a3;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x2a8d4e){return _0x2a8d4e[_0xb7ea('0x0')](_0xb7ea('0x1'),attributes,{'tableName':_0xb7ea('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3db25f=this;var _0x4e78a6={'id':_0x3db25f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3db25f[_0xb7ea('0x3')]!==_0xb7ea('0x4')){_0x4e78a6['service']=_0x3db25f['provider'];}else{_0x4e78a6[_0xb7ea('0x5')]=_0x3db25f[_0xb7ea('0x6')][_0xb7ea('0x5')];_0x4e78a6[_0xb7ea('0x7')]=_0x3db25f[_0xb7ea('0x6')][_0xb7ea('0x7')];_0x4e78a6['secure']=_0x3db25f['Smtp'][_0xb7ea('0x8')];}if(_0x3db25f[_0xb7ea('0x6')]['authentication']){if(_0x3db25f[_0xb7ea('0x6')][_0xb7ea('0x9')]){if(!_0x3db25f['Smtp'][_0xb7ea('0xa')])throw new Error(_0xb7ea('0xb'));_0x4e78a6[_0xb7ea('0xc')]={'type':'OAuth2','user':_0x3db25f[_0xb7ea('0x6')][_0xb7ea('0xd')],'accessToken':_0x3db25f[_0xb7ea('0x6')][_0xb7ea('0xa')][_0xb7ea('0xe')]};}else{_0x4e78a6[_0xb7ea('0xc')]={'user':_0x3db25f['Smtp'][_0xb7ea('0xd')],'pass':_0x3db25f[_0xb7ea('0x6')][_0xb7ea('0xf')]};}}return _0x4e78a6;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index fbee305..6a8ae62 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 _0xc492=['waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./mailAccount.socket','register','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','model','map','then','debug','catch','find','smtp','setDataValue','getSmtpOptions','ShowMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','body','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','account','CmList','List','DESC','MailApplication','CloudProvider','get','omit','Applications','applications','orderBy','priority','asc','autoclose','length','close','*,*,*,*','Contacts','create','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','YYYY-MM-DD\x20HH:mm:ss','interaction','created','MailMessage','originTo','originCc','bcc','ChatWebsiteId','Email','Attachment','Attachments','UserId','User','unshift','agent','name'];(function(_0x1911ed,_0x4e8c73){var _0x11edaa=function(_0x216008){while(--_0x216008){_0x1911ed['push'](_0x1911ed['shift']());}};_0x11edaa(++_0x4e8c73);}(_0xc492,0xd7));var _0x2c49=function(_0x4ddb14,_0x4226cf){_0x4ddb14=_0x4ddb14-0x0;var _0x3efac4=_0xc492[_0x4ddb14];return _0x3efac4;};'use strict';var _=require(_0x2c49('0x0'));var moment=require(_0x2c49('0x1'));var BPromise=require(_0x2c49('0x2'));var rs=require('randomstring');var Redis=require('ioredis');var db=require(_0x2c49('0x3'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x2c49('0x4'));var jayson=require(_0x2c49('0x5'));var client=jayson['client'][_0x2c49('0x6')]({'port':0x232c});config['redis']=_[_0x2c49('0x7')](config[_0x2c49('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c49('0x9'))(new Redis(config[_0x2c49('0x8')]));require(_0x2c49('0xa'))[_0x2c49('0xb')](socket);function respondWithRpcPromise(_0x326287,_0x5684e5,_0x3d3e2a){return new BPromise(function(_0x4f64f2,_0x493cd2){return client['request'](_0x326287,_0x3d3e2a)['then'](function(_0x39cc64){logger['info'](_0x2c49('0xc'),_0x5684e5,_0x2c49('0xd'));logger['debug'](_0x2c49('0xe'),_0x5684e5,_0x2c49('0xd'),JSON[_0x2c49('0xf')](_0x39cc64));if(_0x39cc64[_0x2c49('0x10')]){if(_0x39cc64[_0x2c49('0x10')][_0x2c49('0x11')]===0x1f4){logger['error'](_0x2c49('0xc'),_0x5684e5,_0x39cc64[_0x2c49('0x10')][_0x2c49('0x12')]);return _0x493cd2(_0x39cc64[_0x2c49('0x10')][_0x2c49('0x12')]);}logger['error'](_0x2c49('0xc'),_0x5684e5,_0x39cc64[_0x2c49('0x10')][_0x2c49('0x12')]);return _0x4f64f2(_0x39cc64[_0x2c49('0x10')][_0x2c49('0x12')]);}else{logger[_0x2c49('0x13')](_0x2c49('0xc'),_0x5684e5,_0x2c49('0xd'));_0x4f64f2(_0x39cc64[_0x2c49('0x14')][_0x2c49('0x12')]);}})['catch'](function(_0x3001af){logger[_0x2c49('0x10')](_0x2c49('0xc'),_0x5684e5,_0x3001af);_0x493cd2(_0x3001af);});});}exports[_0x2c49('0x15')]=function(_0x4793d5){var _0x1392dc=this;return new Promise(function(_0x578c07,_0xc7b6cc){return db[_0x2c49('0x16')]['findAll']({'raw':_0x4793d5['options']?_0x4793d5[_0x2c49('0x17')][_0x2c49('0x18')]===undefined?!![]:![]:!![],'where':_0x4793d5[_0x2c49('0x17')]?_0x4793d5[_0x2c49('0x17')][_0x2c49('0x19')]||null:null,'attributes':_0x4793d5[_0x2c49('0x17')]?_0x4793d5[_0x2c49('0x17')][_0x2c49('0x1a')]||null:null,'limit':_0x4793d5[_0x2c49('0x17')]?_0x4793d5['options'][_0x2c49('0x1b')]||null:null,'include':_0x4793d5[_0x2c49('0x17')]?_0x4793d5[_0x2c49('0x17')][_0x2c49('0x1c')]?_['map'](_0x4793d5[_0x2c49('0x17')][_0x2c49('0x1c')],function(_0x3a35b4){return{'model':db[_0x3a35b4[_0x2c49('0x1d')]],'as':_0x3a35b4['as'],'attributes':_0x3a35b4['attributes'],'include':_0x3a35b4[_0x2c49('0x1c')]?_[_0x2c49('0x1e')](_0x3a35b4[_0x2c49('0x1c')],function(_0x50da06){return{'model':db[_0x50da06[_0x2c49('0x1d')]],'as':_0x50da06['as'],'attributes':_0x50da06[_0x2c49('0x1a')],'include':_0x50da06['include']?_[_0x2c49('0x1e')](_0x50da06['include'],function(_0x517085){return{'model':db[_0x517085[_0x2c49('0x1d')]],'as':_0x517085['as'],'attributes':_0x517085['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c49('0x1f')](function(_0x4d9334){logger[_0x2c49('0x13')](_0x2c49('0x15'),_0x4793d5);logger[_0x2c49('0x20')](_0x2c49('0x15'),_0x4793d5,JSON[_0x2c49('0xf')](_0x4d9334));_0x578c07(_0x4d9334);})[_0x2c49('0x21')](function(_0x131c06){logger[_0x2c49('0x10')](_0x2c49('0x15'),_0x131c06[_0x2c49('0x12')],_0x4793d5);_0xc7b6cc(_0x1392dc['error'](0x1f4,_0x131c06[_0x2c49('0x12')]));});});};exports['ShowMailAccount']=function(_0x20ebca){var _0x3a4912=this;return new Promise(function(_0x1df70f,_0xdaed9b){return db[_0x2c49('0x16')][_0x2c49('0x22')]({'raw':_0x20ebca[_0x2c49('0x17')]?_0x20ebca[_0x2c49('0x17')][_0x2c49('0x18')]===undefined?!![]:![]:!![],'where':_0x20ebca[_0x2c49('0x17')]?_0x20ebca[_0x2c49('0x17')][_0x2c49('0x19')]||null:null,'attributes':_0x20ebca[_0x2c49('0x17')]?_0x20ebca[_0x2c49('0x17')]['attributes']||null:null,'include':_0x20ebca['options']?_0x20ebca[_0x2c49('0x17')][_0x2c49('0x1c')]?_['map'](_0x20ebca[_0x2c49('0x17')][_0x2c49('0x1c')],function(_0x14aeea){return{'model':db[_0x14aeea[_0x2c49('0x1d')]],'as':_0x14aeea['as'],'attributes':_0x14aeea[_0x2c49('0x1a')],'include':_0x14aeea[_0x2c49('0x1c')]?_[_0x2c49('0x1e')](_0x14aeea[_0x2c49('0x1c')],function(_0x4ed053){return{'model':db[_0x4ed053[_0x2c49('0x1d')]],'as':_0x4ed053['as'],'attributes':_0x4ed053[_0x2c49('0x1a')],'include':_0x4ed053['include']?_[_0x2c49('0x1e')](_0x4ed053[_0x2c49('0x1c')],function(_0xddfe1a){return{'model':db[_0xddfe1a['model']],'as':_0xddfe1a['as'],'attributes':_0xddfe1a[_0x2c49('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2c49('0x1f')](function(_0x343f42){if(_0x20ebca[_0x2c49('0x17')][_0x2c49('0x23')]===!![])_0x343f42[_0x2c49('0x24')]('smtpOptions',_0x343f42[_0x2c49('0x25')]());logger[_0x2c49('0x13')]('ShowMailAccount',_0x20ebca);logger[_0x2c49('0x20')](_0x2c49('0x26'),_0x20ebca,JSON['stringify'](_0x343f42));_0x1df70f(_0x343f42);})[_0x2c49('0x21')](function(_0x5893d3){logger[_0x2c49('0x10')](_0x2c49('0x26'),_0x5893d3[_0x2c49('0x12')],_0x20ebca);_0xdaed9b(_0x3a4912['error'](0x1f4,_0x5893d3[_0x2c49('0x12')]));});});};exports['NotifyMailAccount']=function(_0x343d0d){var _0x25ad4e=this;return new Promise(function(_0x24e53a,_0x1288c1){var _0x3385d6={'body':_0x343d0d['body'],'channel':_0x2c49('0x27')};var _0xcabaa1=_[_0x2c49('0x28')](_[_0x2c49('0x29')](db[_0x2c49('0x2a')][_0x2c49('0x2b')]),[_0x2c49('0x2c'),_0x2c49('0x2d'),'CompanyId',_0x2c49('0x2e')]);var _0x30e892=![];if(_0x343d0d['body']['id']){delete _0x343d0d[_0x2c49('0x2f')]['id'];}if(_[_0x2c49('0x30')](_0x343d0d['body'][_0x2c49('0x31')])){return _0x1288c1(_0x25ad4e['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x343d0d['body'][_0x2c49('0x2f')])||_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x2f')]===''){return _0x1288c1(_0x25ad4e[_0x2c49('0x10')](0x1f4,_0x2c49('0x32')));}if(_['isNil'](_0x343d0d['body']['mapKey'])){return _0x1288c1(_0x25ad4e['error'](0x1f4,_0x2c49('0x33')+_0xcabaa1));}if(!_['includes'](_0xcabaa1,_0x343d0d[_0x2c49('0x2f')]['mapKey'])){return _0x1288c1(_0x25ad4e['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xcabaa1));}var _0x1d4d7b={};_0x1d4d7b[_0x343d0d['body'][_0x2c49('0x34')]]=_0x343d0d[_0x2c49('0x2f')]['from'];return db['MailAccount'][_0x2c49('0x22')]({'where':{'id':_0x343d0d[_0x2c49('0x35')]['id']},'include':[{'model':db[_0x2c49('0x36')],'as':_0x2c49('0x37'),'include':[{'model':db[_0x2c49('0x2a')],'as':'Contacts','where':_0x1d4d7b,'limit':0x1,'order':[['updatedAt',_0x2c49('0x38')]]}]},{'model':db[_0x2c49('0x39')],'as':'Applications'},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x2c49('0x3a')],'as':_0x2c49('0x3a')}]}]})[_0x2c49('0x1f')](function(_0x55e4cd){if(_0x55e4cd&&_0x55e4cd[_0x2c49('0x37')]){var _0xea11c4=_0x55e4cd[_0x2c49('0x3b')]({'plain':!![]});_0x3385d6[_0x2c49('0x35')]=_[_0x2c49('0x3c')](_0xea11c4,[_0x2c49('0x3d'),_0x2c49('0x37')]);_0x3385d6['account']['smtpOptions']=_0x55e4cd['getSmtpOptions']();_0x3385d6[_0x2c49('0x3e')]=_0xea11c4[_0x2c49('0x3d')];_0x3385d6['list']=_0xea11c4[_0x2c49('0x37')];_0x3385d6[_0x2c49('0x3e')]=_[_0x2c49('0x3f')](_0x3385d6[_0x2c49('0x3e')],[_0x2c49('0x40')],[_0x2c49('0x41')]);if(_0x3385d6[_0x2c49('0x35')]&&_0x3385d6[_0x2c49('0x35')][_0x2c49('0x42')]){_0x3385d6[_0x2c49('0x3e')]['push']({'id':0x0,'priority':_0x3385d6[_0x2c49('0x3e')][_0x2c49('0x43')]+0x1,'app':_0x2c49('0x44'),'appdata':'autoclose','interval':_0x2c49('0x45')});}if(_0x3385d6[_0x2c49('0x35')]['Applications']){delete _0x3385d6[_0x2c49('0x35')][_0x2c49('0x3d')];}if(_0x3385d6[_0x2c49('0x35')][_0x2c49('0x37')]){delete _0x3385d6['account'][_0x2c49('0x37')];}if(_0xea11c4[_0x2c49('0x37')][_0x2c49('0x46')][_0x2c49('0x43')]){return _0xea11c4['List'][_0x2c49('0x46')][0x0];}var _0xef3e7e=_[_0x2c49('0x7')](_0x343d0d[_0x2c49('0x2f')],{'firstName':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x31')],'ListId':_0xea11c4[_0x2c49('0x2e')]});_0xef3e7e[_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x34')]]=_0x343d0d['body']['from'];return db[_0x2c49('0x2a')][_0x2c49('0x47')](_0xef3e7e);}else{throw new Error('List\x20not\x20found');}})[_0x2c49('0x1f')](function(_0x5a9c5f){_0x3385d6[_0x2c49('0x48')]=_0x5a9c5f;if(_0x5a9c5f){if(!_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x49')]){_0x343d0d[_0x2c49('0x2f')]['message'][_0x2c49('0x49')]=rs[_0x2c49('0x4a')]()+'\x20'+_0x343d0d[_0x2c49('0x2f')]['message'][_0x2c49('0x31')];}var _0x19ed1e={'ContactId':_0x5a9c5f['id'],'MailAccountId':_0x343d0d['account']['id'],'inReplyTo':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')]['messageId'],'to':_0x343d0d[_0x2c49('0x2f')]['message'][_0x2c49('0x31')],'cc':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')]['cc'],'subject':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x4b')],'attach':_0x343d0d['body'][_0x2c49('0x12')][_0x2c49('0x4c')],'lastMsgAt':moment()[_0x2c49('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x2c49('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x343d0d['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x2c49('0x4f'),'attributes':[_0x2c49('0x49')],'where':{'messageId':_0x343d0d[_0x2c49('0x2f')]['message'][_0x2c49('0x50')]}}]})['then'](function(_0x50456d){if(_0x50456d){return[_0x50456d,![]];}return db['MailInteraction']['create'](_0x19ed1e)['then'](function(_0x127dea){return[_0x127dea,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0xc5202e,_0x557b68){if(_0xc5202e){_0x30e892=_0x557b68;if(!_0x557b68){return _0xc5202e['update']({'inReplyTo':_0x343d0d['body'][_0x2c49('0x12')][_0x2c49('0x49')],'to':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x31')],'cc':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')]['cc'],'subject':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x4b')],'attach':_0xc5202e[_0x2c49('0x4c')]?_0xc5202e[_0x2c49('0x4c')]:_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x4c')],'substatus':null,'substatusAt':moment()['format'](_0x2c49('0x51')),'lastMsgAt':moment()[_0x2c49('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0xc5202e;}}})[_0x2c49('0x1f')](function(_0xac4060){_0x3385d6[_0x2c49('0x52')]=_0xac4060[_0x2c49('0x3b')]({'plain':!![]});_0x3385d6[_0x2c49('0x52')][_0x2c49('0x53')]=_0x30e892;return db[_0x2c49('0x54')][_0x2c49('0x47')]({'body':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x2f')],'MailAccountId':_0x343d0d[_0x2c49('0x35')]['id'],'MailInteractionId':_0xac4060['id'],'direction':'in','ContactId':_0x3385d6[_0x2c49('0x48')]['id'],'messageId':_0x343d0d['body'][_0x2c49('0x12')][_0x2c49('0x49')],'from':_0x343d0d[_0x2c49('0x2f')]['message']['from'],'to':_0x343d0d['body']['message']['to'],'cc':_0x343d0d['body'][_0x2c49('0x12')]['cc'],'subject':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x4b')],'attach':_0x343d0d['body'][_0x2c49('0x12')][_0x2c49('0x4c')],'Attachments':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')]['attachments'],'originTo':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x55')],'originCc':_0x343d0d[_0x2c49('0x2f')]['message'][_0x2c49('0x56')],'bcc':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')][_0x2c49('0x57')],'ChatWebsiteId':_0x343d0d['body'][_0x2c49('0x12')][_0x2c49('0x58')]||null,'originChannel':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')]['originChannel']||_0x2c49('0x59'),'ChatOfflineMessageId':_0x343d0d[_0x2c49('0x2f')][_0x2c49('0x12')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x2c49('0x5a')],'as':_0x2c49('0x5b')}]});})[_0x2c49('0x1f')](function(_0x34874b){_0x3385d6[_0x2c49('0x12')]=_0x34874b;if(!_0x3385d6[_0x2c49('0x52')][_0x2c49('0x5c')]){return;}return db[_0x2c49('0x5d')][_0x2c49('0x22')]({'attributes':['id','name'],'where':{'id':_0x3385d6[_0x2c49('0x52')][_0x2c49('0x5c')]}});})[_0x2c49('0x1f')](function(_0x16fd93){if(_0x16fd93){_0x3385d6[_0x2c49('0x3e')][_0x2c49('0x5e')]({'id':0x0,'priority':0x0,'app':_0x2c49('0x5f'),'appdata':_0x16fd93[_0x2c49('0x60')]+','+(_0x3385d6['account'][_0x2c49('0x61')]||0xa),'interval':_0x2c49('0x45')});}if(!_0x3385d6[_0x2c49('0x52')]['queueId']){return;}return db[_0x2c49('0x62')]['find']({'attributes':['id',_0x2c49('0x60')],'where':{'id':_0x3385d6['interaction'][_0x2c49('0x63')]}});})[_0x2c49('0x1f')](function(_0xeec6d){if(_0xeec6d){_0x3385d6[_0x2c49('0x3e')][_0x2c49('0x5e')]({'id':0x0,'priority':0x1,'app':_0x2c49('0x64'),'appdata':_0xeec6d[_0x2c49('0x60')]+','+(_0x3385d6['account'][_0x2c49('0x65')]||0x12c),'interval':_0x2c49('0x45')});}return respondWithRpcPromise(_0x2c49('0x66'),_0x2c49('0x67'),_0x3385d6);})[_0x2c49('0x1f')](function(_0x19a496){_0x24e53a(_0x19a496);})[_0x2c49('0x21')](function(_0x451005){_0x1288c1(_0x25ad4e[_0x2c49('0x10')](0x1f4,_0x451005[_0x2c49('0x12')]));});});}; \ No newline at end of file +var _0xee3c=['localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','List','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','length','create','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','update','attach','interaction','get','created','MailMessage','attachments','originTo','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2d3a48,_0x5d84f7){var _0x5569af=function(_0x2353f7){while(--_0x2353f7){_0x2d3a48['push'](_0x2d3a48['shift']());}};_0x5569af(++_0x5d84f7);}(_0xee3c,0x14a));var _0xcee3=function(_0x518ba1,_0x54ff90){_0x518ba1=_0x518ba1-0x0;var _0x517896=_0xee3c[_0x518ba1];return _0x517896;};'use strict';var _=require(_0xcee3('0x0'));var moment=require(_0xcee3('0x1'));var BPromise=require(_0xcee3('0x2'));var rs=require(_0xcee3('0x3'));var Redis=require(_0xcee3('0x4'));var db=require(_0xcee3('0x5'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0xcee3('0x6'));var jayson=require(_0xcee3('0x7'));var client=jayson[_0xcee3('0x8')][_0xcee3('0x9')]({'port':0x232c});config[_0xcee3('0xa')]=_[_0xcee3('0xb')](config[_0xcee3('0xa')],{'host':_0xcee3('0xc'),'port':0x18eb});var socket=require(_0xcee3('0xd'))(new Redis(config[_0xcee3('0xa')]));require(_0xcee3('0xe'))[_0xcee3('0xf')](socket);function respondWithRpcPromise(_0x861421,_0x81de8e,_0x15d2af){return new BPromise(function(_0x507d8c,_0x1ed6a6){return client[_0xcee3('0x10')](_0x861421,_0x15d2af)[_0xcee3('0x11')](function(_0x2790ba){logger[_0xcee3('0x12')](_0xcee3('0x13'),_0x81de8e,'request\x20sent');logger[_0xcee3('0x14')](_0xcee3('0x15'),_0x81de8e,_0xcee3('0x16'),JSON[_0xcee3('0x17')](_0x2790ba));if(_0x2790ba[_0xcee3('0x18')]){if(_0x2790ba['error'][_0xcee3('0x19')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x81de8e,_0x2790ba['error'][_0xcee3('0x1a')]);return _0x1ed6a6(_0x2790ba[_0xcee3('0x18')]['message']);}logger['error'](_0xcee3('0x13'),_0x81de8e,_0x2790ba['error'][_0xcee3('0x1a')]);return _0x507d8c(_0x2790ba['error'][_0xcee3('0x1a')]);}else{logger[_0xcee3('0x12')]('MailAccount,\x20%s,\x20%s',_0x81de8e,_0xcee3('0x16'));_0x507d8c(_0x2790ba[_0xcee3('0x1b')][_0xcee3('0x1a')]);}})[_0xcee3('0x1c')](function(_0x50bf6e){logger[_0xcee3('0x18')](_0xcee3('0x13'),_0x81de8e,_0x50bf6e);_0x1ed6a6(_0x50bf6e);});});}exports[_0xcee3('0x1d')]=function(_0x11bf37){var _0x52f4d7=this;return new Promise(function(_0x254de7,_0xf2f32){return db[_0xcee3('0x1e')][_0xcee3('0x1f')]({'raw':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x21')]===undefined?!![]:![]:!![],'where':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x22')]||null:null,'attributes':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x23')]||null:null,'limit':_0x11bf37['options']?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x24')]||null:null,'include':_0x11bf37[_0xcee3('0x20')]?_0x11bf37[_0xcee3('0x20')][_0xcee3('0x25')]?_['map'](_0x11bf37['options'][_0xcee3('0x25')],function(_0x5b92ba){return{'model':db[_0x5b92ba['model']],'as':_0x5b92ba['as'],'attributes':_0x5b92ba[_0xcee3('0x23')],'include':_0x5b92ba['include']?_[_0xcee3('0x26')](_0x5b92ba[_0xcee3('0x25')],function(_0x19a15e){return{'model':db[_0x19a15e['model']],'as':_0x19a15e['as'],'attributes':_0x19a15e[_0xcee3('0x23')],'include':_0x19a15e['include']?_[_0xcee3('0x26')](_0x19a15e['include'],function(_0x2c2d48){return{'model':db[_0x2c2d48[_0xcee3('0x27')]],'as':_0x2c2d48['as'],'attributes':_0x2c2d48['attributes']};}):[]};}):[]};}):[]:[]})[_0xcee3('0x11')](function(_0x1efb1b){logger['info'](_0xcee3('0x1d'),_0x11bf37);logger['debug']('GetMailAccount',_0x11bf37,JSON[_0xcee3('0x17')](_0x1efb1b));_0x254de7(_0x1efb1b);})['catch'](function(_0x22e342){logger[_0xcee3('0x18')](_0xcee3('0x1d'),_0x22e342[_0xcee3('0x1a')],_0x11bf37);_0xf2f32(_0x52f4d7[_0xcee3('0x18')](0x1f4,_0x22e342[_0xcee3('0x1a')]));});});};exports[_0xcee3('0x28')]=function(_0x5ce5be){var _0x298a29=this;return new Promise(function(_0x56f705,_0x74019c){return db[_0xcee3('0x1e')][_0xcee3('0x29')]({'raw':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x21')]===undefined?!![]:![]:!![],'where':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')]['where']||null:null,'attributes':_0x5ce5be[_0xcee3('0x20')]?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x23')]||null:null,'include':_0x5ce5be['options']?_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x25')]?_['map'](_0x5ce5be[_0xcee3('0x20')]['include'],function(_0x2a4996){return{'model':db[_0x2a4996['model']],'as':_0x2a4996['as'],'attributes':_0x2a4996['attributes'],'include':_0x2a4996[_0xcee3('0x25')]?_['map'](_0x2a4996[_0xcee3('0x25')],function(_0x322e05){return{'model':db[_0x322e05[_0xcee3('0x27')]],'as':_0x322e05['as'],'attributes':_0x322e05[_0xcee3('0x23')],'include':_0x322e05['include']?_['map'](_0x322e05[_0xcee3('0x25')],function(_0x45feca){return{'model':db[_0x45feca['model']],'as':_0x45feca['as'],'attributes':_0x45feca[_0xcee3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xcee3('0x11')](function(_0x55081a){if(_0x5ce5be[_0xcee3('0x20')][_0xcee3('0x2a')]===!![])_0x55081a[_0xcee3('0x2b')](_0xcee3('0x2c'),_0x55081a[_0xcee3('0x2d')]());logger[_0xcee3('0x12')]('ShowMailAccount',_0x5ce5be);logger[_0xcee3('0x14')](_0xcee3('0x28'),_0x5ce5be,JSON[_0xcee3('0x17')](_0x55081a));_0x56f705(_0x55081a);})[_0xcee3('0x1c')](function(_0x3ea90f){logger[_0xcee3('0x18')](_0xcee3('0x28'),_0x3ea90f['message'],_0x5ce5be);_0x74019c(_0x298a29[_0xcee3('0x18')](0x1f4,_0x3ea90f[_0xcee3('0x1a')]));});});};exports[_0xcee3('0x2e')]=function(_0x51aae6){var _0x45dab9=this;return new Promise(function(_0x436961,_0x5a7c9f){var _0x305bfa={'body':_0x51aae6[_0xcee3('0x2f')],'channel':_0xcee3('0x30')};var _0x5b4b40=_[_0xcee3('0x31')](_[_0xcee3('0x32')](db[_0xcee3('0x33')][_0xcee3('0x34')]),[_0xcee3('0x35'),'updatedAt','CompanyId',_0xcee3('0x36')]);var _0x41cd61=![];if(_0x51aae6[_0xcee3('0x2f')]['id']){delete _0x51aae6[_0xcee3('0x2f')]['id'];}if(_[_0xcee3('0x37')](_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xcee3('0x37')](_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')])||_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')]===''){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x39')));}if(_['isNil'](_0x51aae6[_0xcee3('0x2f')]['mapKey'])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x3a')+_0x5b4b40));}if(!_['includes'](_0x5b4b40,_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')])){return _0x5a7c9f(_0x45dab9[_0xcee3('0x18')](0x1f4,_0xcee3('0x3c')+_0x5b4b40));}var _0x12d32e={};_0x12d32e[_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')]]=_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')];return db[_0xcee3('0x1e')]['find']({'where':{'id':_0x51aae6[_0xcee3('0x3d')]['id']},'include':[{'model':db[_0xcee3('0x3e')],'as':'List','include':[{'model':db[_0xcee3('0x33')],'as':_0xcee3('0x3f'),'where':_0x12d32e,'limit':0x1,'order':[[_0xcee3('0x40'),_0xcee3('0x41')]]}]},{'model':db[_0xcee3('0x42')],'as':_0xcee3('0x43')},{'model':db[_0xcee3('0x44')],'as':'Smtp','include':[{'model':db[_0xcee3('0x45')],'as':_0xcee3('0x45')}]}]})[_0xcee3('0x11')](function(_0x27022b){if(_0x27022b&&_0x27022b[_0xcee3('0x46')]){var _0x2a0b71=_0x27022b['get']({'plain':!![]});_0x305bfa[_0xcee3('0x3d')]=_['omit'](_0x2a0b71,[_0xcee3('0x43'),_0xcee3('0x46')]);_0x305bfa[_0xcee3('0x3d')]['smtpOptions']=_0x27022b['getSmtpOptions']();_0x305bfa[_0xcee3('0x47')]=_0x2a0b71[_0xcee3('0x43')];_0x305bfa['list']=_0x2a0b71[_0xcee3('0x46')];_0x305bfa['applications']=_[_0xcee3('0x48')](_0x305bfa[_0xcee3('0x47')],[_0xcee3('0x49')],[_0xcee3('0x4a')]);if(_0x305bfa['account']&&_0x305bfa['account']['autoclose']){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x4b')]({'id':0x0,'priority':_0x305bfa[_0xcee3('0x47')]['length']+0x1,'app':_0xcee3('0x4c'),'appdata':_0xcee3('0x4d'),'interval':_0xcee3('0x4e')});}if(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x43')]){delete _0x305bfa[_0xcee3('0x3d')][_0xcee3('0x43')];}if(_0x305bfa['account']['List']){delete _0x305bfa[_0xcee3('0x3d')]['List'];}if(_0x2a0b71['List']['Contacts'][_0xcee3('0x4f')]){return _0x2a0b71[_0xcee3('0x46')][_0xcee3('0x3f')][0x0];}var _0x295451=_[_0xcee3('0xb')](_0x51aae6['body'],{'firstName':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')],'ListId':_0x2a0b71[_0xcee3('0x36')]});_0x295451[_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x3b')]]=_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x38')];return db[_0xcee3('0x33')][_0xcee3('0x50')](_0x295451);}else{throw new Error('List\x20not\x20found');}})[_0xcee3('0x11')](function(_0x2e7a8d){_0x305bfa[_0xcee3('0x51')]=_0x2e7a8d;if(_0x2e7a8d){if(!_0x51aae6['body'][_0xcee3('0x1a')]['messageId']){_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x52')]=rs[_0xcee3('0x53')]()+'\x20'+_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x38')];}var _0x46f817={'ContactId':_0x2e7a8d['id'],'MailAccountId':_0x51aae6['account']['id'],'inReplyTo':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x52')],'to':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x38')],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x54')],'attach':_0x51aae6['body']['message']['attach'],'lastMsgAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x51aae6[_0xcee3('0x3d')]['id']},'include':[{'model':db['MailMessage'],'as':_0xcee3('0x57'),'attributes':[_0xcee3('0x52')],'where':{'messageId':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x58')]}}]})[_0xcee3('0x11')](function(_0x1b5d89){if(_0x1b5d89){return[_0x1b5d89,![]];}return db['MailInteraction']['create'](_0x46f817)[_0xcee3('0x11')](function(_0x9d6ffd){return[_0x9d6ffd,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x22e6b9,_0x3ce8ad){if(_0x22e6b9){_0x41cd61=_0x3ce8ad;if(!_0x3ce8ad){return _0x22e6b9[_0xcee3('0x59')]({'inReplyTo':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['messageId'],'to':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['from'],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x54')],'attach':_0x22e6b9[_0xcee3('0x5a')]?_0x22e6b9['attach']:_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x5a')],'substatus':null,'substatusAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgAt':moment()[_0xcee3('0x55')](_0xcee3('0x56')),'lastMsgDirection':'in'});}else{return _0x22e6b9;}}})[_0xcee3('0x11')](function(_0x1cb05d){_0x305bfa[_0xcee3('0x5b')]=_0x1cb05d[_0xcee3('0x5c')]({'plain':!![]});_0x305bfa['interaction'][_0xcee3('0x5d')]=_0x41cd61;return db[_0xcee3('0x5e')][_0xcee3('0x50')]({'body':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x2f')],'MailAccountId':_0x51aae6['account']['id'],'MailInteractionId':_0x1cb05d['id'],'direction':'in','ContactId':_0x305bfa[_0xcee3('0x51')]['id'],'messageId':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['messageId'],'from':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['from'],'to':_0x51aae6['body'][_0xcee3('0x1a')]['to'],'cc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['cc'],'subject':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x54')],'attach':_0x51aae6[_0xcee3('0x2f')]['message']['attach'],'Attachments':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x5f')],'originTo':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x60')],'originCc':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')]['originCc'],'bcc':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x61')],'ChatWebsiteId':_0x51aae6[_0xcee3('0x2f')]['message'][_0xcee3('0x62')]||null,'originChannel':_0x51aae6[_0xcee3('0x2f')][_0xcee3('0x1a')][_0xcee3('0x63')]||_0xcee3('0x64'),'ChatOfflineMessageId':_0x51aae6['body'][_0xcee3('0x1a')][_0xcee3('0x65')]||null},{'include':[{'model':db[_0xcee3('0x66')],'as':'Attachments'}]});})['then'](function(_0x23cd22){_0x305bfa[_0xcee3('0x1a')]=_0x23cd22;if(!_0x305bfa[_0xcee3('0x5b')][_0xcee3('0x67')]){return;}return db[_0xcee3('0x68')]['find']({'attributes':['id',_0xcee3('0x69')],'where':{'id':_0x305bfa['interaction']['UserId']}});})['then'](function(_0x237a9d){if(_0x237a9d){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x6a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x237a9d[_0xcee3('0x69')]+','+(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x6b')]||0xa),'interval':_0xcee3('0x4e')});}if(!_0x305bfa[_0xcee3('0x5b')][_0xcee3('0x6c')]){return;}return db[_0xcee3('0x6d')][_0xcee3('0x29')]({'attributes':['id',_0xcee3('0x69')],'where':{'id':_0x305bfa['interaction'][_0xcee3('0x6c')]}});})[_0xcee3('0x11')](function(_0x513fce){if(_0x513fce){_0x305bfa[_0xcee3('0x47')][_0xcee3('0x6a')]({'id':0x0,'priority':0x1,'app':_0xcee3('0x6e'),'appdata':_0x513fce[_0xcee3('0x69')]+','+(_0x305bfa[_0xcee3('0x3d')][_0xcee3('0x6f')]||0x12c),'interval':_0xcee3('0x4e')});}return respondWithRpcPromise(_0xcee3('0x70'),_0xcee3('0x71'),_0x305bfa);})[_0xcee3('0x11')](function(_0x17cb5c){_0x436961(_0x17cb5c);})[_0xcee3('0x1c')](function(_0x51d3cf){_0x5a7c9f(_0x45dab9['error'](0x1f4,_0x51d3cf['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 0fed552..8a64f24 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 _0x9b85=['length','./mailAccount.events','save','update','removeListener','register'];(function(_0x243543,_0x505023){var _0x5da9a0=function(_0x2067f2){while(--_0x2067f2){_0x243543['push'](_0x243543['shift']());}};_0x5da9a0(++_0x505023);}(_0x9b85,0x12d));var _0x59b8=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9b85[_0x5447fd];return _0x15b28a;};'use strict';var MailAccountEvents=require(_0x59b8('0x0'));var events=[_0x59b8('0x1'),'remove',_0x59b8('0x2')];function createListener(_0x332a8c,_0x5cbde1){return function(_0xa4837c){_0x5cbde1['emit'](_0x332a8c,_0xa4837c);};}function removeListener(_0x1ed5bc,_0x3867d3){return function(){MailAccountEvents[_0x59b8('0x3')](_0x1ed5bc,_0x3867d3);};}exports[_0x59b8('0x4')]=function(_0x232b3a){for(var _0x1ebe8a=0x0,_0x4b2e9d=events[_0x59b8('0x5')];_0x1ebe8a<_0x4b2e9d;_0x1ebe8a++){var _0x18c8dc=events[_0x1ebe8a];var _0x1b4cc7=createListener('mailAccount:'+_0x18c8dc,_0x232b3a);MailAccountEvents['on'](_0x18c8dc,_0x1b4cc7);}}; \ No newline at end of file +var _0xa702=['register','length','mailAccount:','./mailAccount.events','save','remove','update'];(function(_0x3e1d48,_0x171785){var _0x19c714=function(_0x502da1){while(--_0x502da1){_0x3e1d48['push'](_0x3e1d48['shift']());}};_0x19c714(++_0x171785);}(_0xa702,0x1ae));var _0x2a70=function(_0x58ca65,_0x4a4560){_0x58ca65=_0x58ca65-0x0;var _0x2ed1c4=_0xa702[_0x58ca65];return _0x2ed1c4;};'use strict';var MailAccountEvents=require(_0x2a70('0x0'));var events=[_0x2a70('0x1'),_0x2a70('0x2'),_0x2a70('0x3')];function createListener(_0x3fd554,_0x53128e){return function(_0x40c062){_0x53128e['emit'](_0x3fd554,_0x40c062);};}function removeListener(_0x55c9b2,_0x3c1629){return function(){MailAccountEvents['removeListener'](_0x55c9b2,_0x3c1629);};}exports[_0x2a70('0x4')]=function(_0x16cdc3){for(var _0x4b2915=0x0,_0x54e5a2=events[_0x2a70('0x5')];_0x4b2915<_0x54e5a2;_0x4b2915++){var _0x261c54=events[_0x4b2915];var _0x51e726=createListener(_0x2a70('0x6')+_0x261c54,_0x16cdc3);MailAccountEvents['on'](_0x261c54,_0x51e726);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index edce7f5..9cafd91 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 _0xe1cc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x25d7ad,_0xfd098d){var _0xc5b046=function(_0x566159){while(--_0x566159){_0x25d7ad['push'](_0x25d7ad['shift']());}};_0xc5b046(++_0xfd098d);}(_0xe1cc,0x193));var _0xce1c=function(_0x150157,_0x499632){_0x150157=_0x150157-0x0;var _0x4995d1=_0xe1cc[_0x150157];return _0x4995d1;};'use strict';var multer=require(_0xce1c('0x0'));var util=require(_0xce1c('0x1'));var path=require('path');var timeout=require(_0xce1c('0x2'));var express=require(_0xce1c('0x3'));var router=express[_0xce1c('0x4')]();var fs_extra=require(_0xce1c('0x5'));var auth=require(_0xce1c('0x6'));var interaction=require(_0xce1c('0x7'));var config=require(_0xce1c('0x8'));var controller=require(_0xce1c('0x9'));router['get'](_0xce1c('0xa'),auth[_0xce1c('0xb')](),controller[_0xce1c('0xc')]);router[_0xce1c('0xd')](_0xce1c('0xa'),auth[_0xce1c('0xb')](),controller[_0xce1c('0xe')]);router[_0xce1c('0xf')](_0xce1c('0xa'),auth[_0xce1c('0xb')](),controller['destroy']);module[_0xce1c('0x10')]=router; \ No newline at end of file +var _0x255f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout'];(function(_0x311582,_0x402341){var _0x1c3541=function(_0x2574fc){while(--_0x2574fc){_0x311582['push'](_0x311582['shift']());}};_0x1c3541(++_0x402341);}(_0x255f,0x1a1));var _0xf255=function(_0x17c3cb,_0x2fab9b){_0x17c3cb=_0x17c3cb-0x0;var _0x59f56b=_0x255f[_0x17c3cb];return _0x59f56b;};'use strict';var multer=require(_0xf255('0x0'));var util=require(_0xf255('0x1'));var path=require('path');var timeout=require(_0xf255('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf255('0x3'));var interaction=require(_0xf255('0x4'));var config=require(_0xf255('0x5'));var controller=require('./mailApplication.controller');router[_0xf255('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf255('0x7')](_0xf255('0x8'),auth['isAuthenticated'](),controller[_0xf255('0x9')]);router[_0xf255('0xa')](_0xf255('0x8'),auth[_0xf255('0xb')](),controller[_0xf255('0xc')]);module[_0xf255('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 404a3c0..e15c45e 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 _0x3f2b=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x5a4233,_0x1778af){var _0x1d04f6=function(_0x2144e1){while(--_0x2144e1){_0x5a4233['push'](_0x5a4233['shift']());}};_0x1d04f6(++_0x1778af);}(_0x3f2b,0xaf));var _0xb3f2=function(_0x27a41b,_0x118770){_0x27a41b=_0x27a41b-0x0;var _0x1a77b4=_0x3f2b[_0x27a41b];return _0x1a77b4;};'use strict';var Sequelize=require(_0xb3f2('0x0'));module[_0xb3f2('0x1')]={'priority':{'type':Sequelize[_0xb3f2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb3f2('0x3')],'allowNull':![],'defaultValue':_0xb3f2('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb3f2('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x21dc=['*,*,*,*','sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x4bebdb,_0x295d82){var _0xf1c964=function(_0x8c87b1){while(--_0x8c87b1){_0x4bebdb['push'](_0x4bebdb['shift']());}};_0xf1c964(++_0x295d82);}(_0x21dc,0x151));var _0xc21d=function(_0x40cf58,_0x2c4366){_0x40cf58=_0x40cf58-0x0;var _0x3758ee=_0x21dc[_0x40cf58];return _0x3758ee;};'use strict';var Sequelize=require(_0xc21d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc21d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc21d('0x2')],'allowNull':![],'defaultValue':_0xc21d('0x3')},'appdata':{'type':Sequelize[_0xc21d('0x4')]()},'description':{'type':Sequelize[_0xc21d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc21d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 2aaa638..337cb85 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0xaa88[_0x29e2af];return _0x1ea06a;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));}; \ No newline at end of file +var _0xcb91=['send','show','params','keys','rawAttributes','query','intersection','attributes','fields','length','model','includeAll','include','merge','options','MailApplication','find','catch','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name'];(function(_0x5ac3c0,_0x4c7d91){var _0x32588d=function(_0x5b43c8){while(--_0x5b43c8){_0x5ac3c0['push'](_0x5ac3c0['shift']());}};_0x32588d(++_0x4c7d91);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xcb91[_0x14a862];return _0x245eb5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){_0x27db16[_0x1cb9('0x17')](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x69b4c8,_0x44d3c4){return function(_0x43a100){if(!_0x43a100){_0x69b4c8['sendStatus'](0x194);}return _0x43a100;};}function handleError(_0x195f16,_0x9df250){_0x9df250=_0x9df250||0x1f4;return function(_0x4c8d76){logger[_0x1cb9('0x24')](_0x4c8d76[_0x1cb9('0x25')]);if(_0x4c8d76[_0x1cb9('0x26')]){delete _0x4c8d76[_0x1cb9('0x26')];}_0x195f16[_0x1cb9('0x17')](_0x9df250)[_0x1cb9('0x27')](_0x4c8d76);};}exports[_0x1cb9('0x28')]=function(_0xb644b3,_0x41e5c2){var _0x9de64b={'raw':!![],'where':{'id':_0xb644b3[_0x1cb9('0x29')]['id']}},_0x48888d={};_0x48888d['model']=_[_0x1cb9('0x2a')](db['MailApplication'][_0x1cb9('0x2b')]);_0x48888d[_0x1cb9('0x2c')]=_[_0x1cb9('0x2a')](_0xb644b3[_0x1cb9('0x2c')]);_0x48888d['filters']=_[_0x1cb9('0x2d')](_0x48888d['model'],_0x48888d[_0x1cb9('0x2c')]);_0x9de64b[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x48888d['model'],qs[_0x1cb9('0x2f')](_0xb644b3['query'][_0x1cb9('0x2f')]));_0x9de64b['attributes']=_0x9de64b[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x9de64b[_0x1cb9('0x2e')]:_0x48888d[_0x1cb9('0x31')];if(_0xb644b3['query'][_0x1cb9('0x32')]){_0x9de64b[_0x1cb9('0x33')]=[{'all':!![]}];}_0x9de64b=_[_0x1cb9('0x34')]({},_0x9de64b,_0xb644b3[_0x1cb9('0x35')]);return db[_0x1cb9('0x36')][_0x1cb9('0x37')](_0x9de64b)[_0x1cb9('0x22')](handleEntityNotFound(_0x41e5c2,null))[_0x1cb9('0x22')](respondWithResult(_0x41e5c2,null))[_0x1cb9('0x38')](handleError(_0x41e5c2,null));};exports[_0x1cb9('0x21')]=function(_0x294eec,_0x26b950){if(_0x294eec[_0x1cb9('0x39')]['id']){delete _0x294eec['body']['id'];}return db['MailApplication'][_0x1cb9('0x37')]({'where':{'id':_0x294eec[_0x1cb9('0x29')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x26b950,null))[_0x1cb9('0x22')](saveUpdates(_0x294eec[_0x1cb9('0x39')],null))[_0x1cb9('0x22')](respondWithResult(_0x26b950,null))[_0x1cb9('0x38')](handleError(_0x26b950,null));};exports[_0x1cb9('0x23')]=function(_0x4d3e39,_0x2aa59b){return db[_0x1cb9('0x36')][_0x1cb9('0x37')]({'where':{'id':_0x4d3e39['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2aa59b,null))['then'](removeEntity(_0x2aa59b,null))[_0x1cb9('0x38')](handleError(_0x2aa59b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 60c2bfe..a0357df 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 _0x0a3d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0xc97abc,_0x5aef51){var _0x4d39eb=function(_0x179626){while(--_0x179626){_0xc97abc['push'](_0xc97abc['shift']());}};_0x4d39eb(++_0x5aef51);}(_0x0a3d,0x157));var _0xd0a3=function(_0x25b8f9,_0x5964b4){_0x25b8f9=_0x25b8f9-0x0;var _0x330d07=_0x0a3d[_0x25b8f9];return _0x330d07;};'use strict';var _=require(_0xd0a3('0x0'));var util=require(_0xd0a3('0x1'));var logger=require(_0xd0a3('0x2'))(_0xd0a3('0x3'));var moment=require('moment');var BPromise=require(_0xd0a3('0x4'));var rp=require(_0xd0a3('0x5'));var fs=require('fs');var path=require(_0xd0a3('0x6'));var rimraf=require(_0xd0a3('0x7'));var config=require(_0xd0a3('0x8'));var attributes=require('./mailApplication.attributes');module[_0xd0a3('0x9')]=function(_0x234123,_0xbd8ab0){return _0x234123[_0xd0a3('0xa')](_0xd0a3('0xb'),attributes,{'tableName':_0xd0a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd0a3('0xd'),'collate':_0xd0a3('0xe')});}; \ No newline at end of file +var _0xded1=['utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailApplication','mail_applications','utf8mb4'];(function(_0x5b77da,_0x261c70){var _0x30daf8=function(_0x416948){while(--_0x416948){_0x5b77da['push'](_0x5b77da['shift']());}};_0x30daf8(++_0x261c70);}(_0xded1,0x160));var _0x1ded=function(_0x434179,_0x21181f){_0x434179=_0x434179-0x0;var _0xac926f=_0xded1[_0x434179];return _0xac926f;};'use strict';var _=require('lodash');var util=require(_0x1ded('0x0'));var logger=require('../../config/logger')(_0x1ded('0x1'));var moment=require(_0x1ded('0x2'));var BPromise=require(_0x1ded('0x3'));var rp=require(_0x1ded('0x4'));var fs=require('fs');var path=require(_0x1ded('0x5'));var rimraf=require(_0x1ded('0x6'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x1ded('0x7')]=function(_0x597d0e,_0x58baeb){return _0x597d0e[_0x1ded('0x8')](_0x1ded('0x9'),attributes,{'tableName':_0x1ded('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ded('0xb'),'collate':_0x1ded('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 45f8b62..a034b0e 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 _0x595b=['client','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2bf8ac,_0x4226be){var _0x3ef094=function(_0x3a5ec0){while(--_0x3a5ec0){_0x2bf8ac['push'](_0x2bf8ac['shift']());}};_0x3ef094(++_0x4226be);}(_0x595b,0x1c6));var _0xb595=function(_0x113108,_0x1445b1){_0x113108=_0x113108-0x0;var _0x19fd86=_0x595b[_0x113108];return _0x19fd86;};'use strict';var _=require(_0xb595('0x0'));var util=require(_0xb595('0x1'));var moment=require(_0xb595('0x2'));var BPromise=require(_0xb595('0x3'));var rs=require(_0xb595('0x4'));var fs=require('fs');var Redis=require(_0xb595('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb595('0x6'));var logger=require(_0xb595('0x7'))(_0xb595('0x8'));var config=require(_0xb595('0x9'));var jayson=require(_0xb595('0xa'));var client=jayson[_0xb595('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2db584,_0x4376ce,_0x5971b9){return new BPromise(function(_0x58f9a8,_0x5d20f9){return client['request'](_0x2db584,_0x5971b9)[_0xb595('0xc')](function(_0x4e6ac9){logger['info'](_0xb595('0xd'),_0x4376ce,'request\x20sent');logger[_0xb595('0xe')](_0xb595('0xf'),_0x4376ce,_0xb595('0x10'),JSON[_0xb595('0x11')](_0x4e6ac9));if(_0x4e6ac9[_0xb595('0x12')]){if(_0x4e6ac9['error']['code']===0x1f4){logger[_0xb595('0x12')]('MailApplication,\x20%s,\x20%s',_0x4376ce,_0x4e6ac9['error'][_0xb595('0x13')]);return _0x5d20f9(_0x4e6ac9[_0xb595('0x12')][_0xb595('0x13')]);}logger['error'](_0xb595('0xd'),_0x4376ce,_0x4e6ac9['error']['message']);return _0x58f9a8(_0x4e6ac9[_0xb595('0x12')][_0xb595('0x13')]);}else{logger[_0xb595('0x14')](_0xb595('0xd'),_0x4376ce,_0xb595('0x10'));_0x58f9a8(_0x4e6ac9['result'][_0xb595('0x13')]);}})['catch'](function(_0x201974){logger['error'](_0xb595('0xd'),_0x4376ce,_0x201974);_0x5d20f9(_0x201974);});});}exports['UpdateMailApplication']=function(_0x2bc2a){var _0x40ed90=this;return new Promise(function(_0x23adde,_0x818ff7){return db[_0xb595('0x15')][_0xb595('0x16')](_0x2bc2a[_0xb595('0x17')],{'raw':_0x2bc2a[_0xb595('0x18')]?_0x2bc2a[_0xb595('0x18')][_0xb595('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bc2a['options']?_0x2bc2a[_0xb595('0x18')][_0xb595('0x1a')]||null:null,'attributes':_0x2bc2a[_0xb595('0x18')]?_0x2bc2a[_0xb595('0x18')][_0xb595('0x1b')]||null:null,'limit':_0x2bc2a[_0xb595('0x18')]?_0x2bc2a[_0xb595('0x18')][_0xb595('0x1c')]||null:null})[_0xb595('0xc')](function(_0x56379c){logger[_0xb595('0x14')](_0xb595('0x1d'),_0x2bc2a);logger[_0xb595('0xe')](_0xb595('0x1d'),_0x2bc2a,JSON[_0xb595('0x11')](_0x56379c));_0x23adde(_0x56379c);})[_0xb595('0x1e')](function(_0x288b62){logger['error'](_0xb595('0x1d'),_0x288b62[_0xb595('0x13')],_0x2bc2a);_0x818ff7(_0x40ed90['error'](0x1f4,_0x288b62['message']));});});}; \ No newline at end of file +var _0x749d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','update','options','raw','where','limit','debug','lodash','util','moment'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0x749d,0x185));var _0xd749=function(_0x16348e,_0x31a912){_0x16348e=_0x16348e-0x0;var _0x2adfeb=_0x749d[_0x16348e];return _0x2adfeb;};'use strict';var _=require(_0xd749('0x0'));var util=require(_0xd749('0x1'));var moment=require(_0xd749('0x2'));var BPromise=require(_0xd749('0x3'));var rs=require(_0xd749('0x4'));var fs=require('fs');var Redis=require(_0xd749('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd749('0x6'));var logger=require(_0xd749('0x7'))(_0xd749('0x8'));var config=require('../../config/environment');var jayson=require(_0xd749('0x9'));var client=jayson[_0xd749('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2620ab,_0x3dc35b,_0x1d5fd3){return new BPromise(function(_0x1dc3e1,_0x48067e){return client['request'](_0x2620ab,_0x1d5fd3)['then'](function(_0x238c5b){logger[_0xd749('0xb')](_0xd749('0xc'),_0x3dc35b,_0xd749('0xd'));logger['debug'](_0xd749('0xe'),_0x3dc35b,_0xd749('0xd'),JSON[_0xd749('0xf')](_0x238c5b));if(_0x238c5b['error']){if(_0x238c5b[_0xd749('0x10')][_0xd749('0x11')]===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x3dc35b,_0x238c5b[_0xd749('0x10')][_0xd749('0x12')]);return _0x48067e(_0x238c5b[_0xd749('0x10')][_0xd749('0x12')]);}logger[_0xd749('0x10')](_0xd749('0xc'),_0x3dc35b,_0x238c5b[_0xd749('0x10')][_0xd749('0x12')]);return _0x1dc3e1(_0x238c5b[_0xd749('0x10')][_0xd749('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x3dc35b,_0xd749('0xd'));_0x1dc3e1(_0x238c5b[_0xd749('0x13')][_0xd749('0x12')]);}})[_0xd749('0x14')](function(_0x7d8897){logger[_0xd749('0x10')]('MailApplication,\x20%s,\x20%s',_0x3dc35b,_0x7d8897);_0x48067e(_0x7d8897);});});}exports[_0xd749('0x15')]=function(_0x3cce09){var _0x5da2e6=this;return new Promise(function(_0x26269b,_0x1ad0a5){return db['MailApplication'][_0xd749('0x16')](_0x3cce09['body'],{'raw':_0x3cce09[_0xd749('0x17')]?_0x3cce09[_0xd749('0x17')][_0xd749('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cce09[_0xd749('0x17')]?_0x3cce09[_0xd749('0x17')][_0xd749('0x19')]||null:null,'attributes':_0x3cce09[_0xd749('0x17')]?_0x3cce09[_0xd749('0x17')]['attributes']||null:null,'limit':_0x3cce09[_0xd749('0x17')]?_0x3cce09[_0xd749('0x17')][_0xd749('0x1a')]||null:null})['then'](function(_0x3bf27a){logger[_0xd749('0xb')]('UpdateMailApplication',_0x3cce09);logger[_0xd749('0x1b')](_0xd749('0x15'),_0x3cce09,JSON[_0xd749('0xf')](_0x3bf27a));_0x26269b(_0x3bf27a);})[_0xd749('0x14')](function(_0x5343b5){logger[_0xd749('0x10')](_0xd749('0x15'),_0x5343b5[_0xd749('0x12')],_0x3cce09);_0x1ad0a5(_0x5da2e6[_0xd749('0x10')](0x1f4,_0x5343b5[_0xd749('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8652d77..53edbea 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 _0xad49=['addTags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','describe','/:id','show','get','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags'];(function(_0xff3f97,_0x3901a7){var _0x3b3f51=function(_0x518b14){while(--_0x518b14){_0xff3f97['push'](_0xff3f97['shift']());}};_0x3b3f51(++_0x3901a7);}(_0xad49,0xd4));var _0x9ad4=function(_0x5e512d,_0x277ab2){_0x5e512d=_0x5e512d-0x0;var _0x1ba719=_0xad49[_0x5e512d];return _0x1ba719;};'use strict';var express=require(_0x9ad4('0x0'));var router=express[_0x9ad4('0x1')]();var auth=require(_0x9ad4('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x9ad4('0x3'));router['get']('/',auth[_0x9ad4('0x4')](),controller[_0x9ad4('0x5')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9ad4('0x6')]);router['get'](_0x9ad4('0x7'),auth[_0x9ad4('0x4')](),controller[_0x9ad4('0x8')]);router[_0x9ad4('0x9')](_0x9ad4('0xa'),auth[_0x9ad4('0x4')](),controller[_0x9ad4('0xb')]);router[_0x9ad4('0x9')](_0x9ad4('0xc'),auth[_0x9ad4('0x4')](),controller[_0x9ad4('0xd')]);router[_0x9ad4('0xe')]('/',auth[_0x9ad4('0x4')](),controller[_0x9ad4('0xf')]);router[_0x9ad4('0xe')](_0x9ad4('0xa'),auth[_0x9ad4('0x4')](),controller[_0x9ad4('0x10')]);router[_0x9ad4('0xe')](_0x9ad4('0x11'),auth[_0x9ad4('0x4')](),interaction['tracked'](_0x9ad4('0x12'),_0x9ad4('0x13')),controller[_0x9ad4('0x14')]);router[_0x9ad4('0x15')](_0x9ad4('0x7'),auth[_0x9ad4('0x4')](),interaction[_0x9ad4('0x16')](_0x9ad4('0x12'),_0x9ad4('0x17')),controller[_0x9ad4('0x18')]);router[_0x9ad4('0x19')]('/:id',auth[_0x9ad4('0x4')](),interaction[_0x9ad4('0x16')](_0x9ad4('0x12'),_0x9ad4('0x1a')),controller[_0x9ad4('0x1b')]);router[_0x9ad4('0x19')](_0x9ad4('0x11'),auth[_0x9ad4('0x4')](),controller[_0x9ad4('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2ec2=['update','delete','mailinteraction:destroy','destroy','removeTags','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','mail','tracked'];(function(_0x30b85d,_0x37483b){var _0x1f8c05=function(_0x4e26a6){while(--_0x4e26a6){_0x30b85d['push'](_0x30b85d['shift']());}};_0x1f8c05(++_0x37483b);}(_0x2ec2,0xb4));var _0x22ec=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x2ec2[_0x18b344];return _0x5ef6bb;};'use strict';var express=require(_0x22ec('0x0'));var router=express[_0x22ec('0x1')]();var auth=require(_0x22ec('0x2'));var interaction=require(_0x22ec('0x3'));var controller=require('./mailInteraction.controller');router[_0x22ec('0x4')]('/',auth[_0x22ec('0x5')](),controller[_0x22ec('0x6')]);router['get'](_0x22ec('0x7'),auth[_0x22ec('0x5')](),controller[_0x22ec('0x8')]);router[_0x22ec('0x4')](_0x22ec('0x9'),auth[_0x22ec('0x5')](),controller['show']);router[_0x22ec('0x4')](_0x22ec('0xa'),auth[_0x22ec('0x5')](),controller[_0x22ec('0xb')]);router['get'](_0x22ec('0xc'),auth[_0x22ec('0x5')](),controller[_0x22ec('0xd')]);router[_0x22ec('0xe')]('/',auth[_0x22ec('0x5')](),controller[_0x22ec('0xf')]);router[_0x22ec('0xe')](_0x22ec('0xa'),auth['isAuthenticated'](),controller[_0x22ec('0x10')]);router[_0x22ec('0xe')](_0x22ec('0x11'),auth[_0x22ec('0x5')](),interaction['tracked'](_0x22ec('0x12'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0x22ec('0x9'),auth[_0x22ec('0x5')](),interaction[_0x22ec('0x13')](_0x22ec('0x12'),'mailinteraction:update'),controller[_0x22ec('0x14')]);router[_0x22ec('0x15')](_0x22ec('0x9'),auth[_0x22ec('0x5')](),interaction['tracked']('mail',_0x22ec('0x16')),controller[_0x22ec('0x17')]);router[_0x22ec('0x15')](_0x22ec('0x11'),auth['isAuthenticated'](),controller[_0x22ec('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index d8001b0..51172c8 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 _0xba79=['INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x4445c4,_0x5539d4){var _0x480f2e=function(_0x5c83c0){while(--_0x5c83c0){_0x4445c4['push'](_0x4445c4['shift']());}};_0x480f2e(++_0x5539d4);}(_0xba79,0xfb));var _0x9ba7=function(_0x47e4b4,_0x2a7d70){_0x47e4b4=_0x47e4b4-0x0;var _0x311b79=_0xba79[_0x47e4b4];return _0x311b79;};'use strict';var Sequelize=require(_0x9ba7('0x0'));var iconv=require('iconv');module[_0x9ba7('0x1')]={'closed':{'type':Sequelize[_0x9ba7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ba7('0x3')]},'disposition':{'type':Sequelize[_0x9ba7('0x4')]},'secondDisposition':{'type':Sequelize[_0x9ba7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9ba7('0x4')]},'note':{'type':Sequelize[_0x9ba7('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9ba7('0x4')]},'cc':{'type':Sequelize[_0x9ba7('0x5')](_0x9ba7('0x6'))},'subject':{'type':Sequelize[_0x9ba7('0x5')]()},'attach':{'type':Sequelize[_0x9ba7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9ba7('0x7')]('in',_0x9ba7('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9ba7('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9ba7('0x7')]('in',_0x9ba7('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9ba7('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9ba7('0x9')]}}; \ No newline at end of file +var _0x96f8=['TEXT','long','BOOLEAN','out','ENUM','sequelize','iconv','exports','DATE','STRING'];(function(_0x429ea5,_0x94873d){var _0x374eed=function(_0x568113){while(--_0x568113){_0x429ea5['push'](_0x429ea5['shift']());}};_0x374eed(++_0x94873d);}(_0x96f8,0xcd));var _0x896f=function(_0x455b28,_0x2b28d2){_0x455b28=_0x455b28-0x0;var _0x2bc6e9=_0x96f8[_0x455b28];return _0x2bc6e9;};'use strict';var Sequelize=require(_0x896f('0x0'));var iconv=require(_0x896f('0x1'));module[_0x896f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x896f('0x3')]},'disposition':{'type':Sequelize[_0x896f('0x4')]},'secondDisposition':{'type':Sequelize[_0x896f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x896f('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x896f('0x5')](_0x896f('0x6'))},'subject':{'type':Sequelize[_0x896f('0x5')]()},'attach':{'type':Sequelize[_0x896f('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x896f('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x896f('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x896f('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x896f('0x9')]('in',_0x896f('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 53c2609..2a632de 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 _0x4735=['files','tmp','root','server','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','from','bcc','createdAt','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','readFileSync','build','writeFileSync','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','show','params','keys','MailInteraction','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','destroy','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','spread','Tag','color','emit','removeTags','download','toString','join'];(function(_0x2ed345,_0x59c3c2){var _0x1e812c=function(_0xdb7f76){while(--_0xdb7f76){_0x2ed345['push'](_0x2ed345['shift']());}};_0x1e812c(++_0x59c3c2);}(_0x4735,0xf9));var _0x5473=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0x4735[_0x5c4444];return _0x20d93d;};'use strict';var emlformat=require(_0x5473('0x0'));var rimraf=require(_0x5473('0x1'));var zipdir=require(_0x5473('0x2'));var moment=require(_0x5473('0x3'));var BPromise=require(_0x5473('0x4'));var util=require('util');var path=require('path');var fs=require('fs');var _=require('lodash');var juice=require(_0x5473('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x5473('0x6'));var logger=require(_0x5473('0x7'))(_0x5473('0x8'));var config=require(_0x5473('0x9'));var db=require(_0x5473('0xa'))['db'];var htmlEntities=require(_0x5473('0xb'));config[_0x5473('0xc')]=_[_0x5473('0xd')](config[_0x5473('0xc')],{'host':_0x5473('0xe'),'port':0x18eb});var socket=require(_0x5473('0xf'))(new Redis(config[_0x5473('0xc')]));require(_0x5473('0x10'))['register'](socket);function respondWithStatusCode(_0x1ac472,_0x58f49c){_0x58f49c=_0x58f49c||0xcc;return function(_0x32290b){if(_0x32290b){return _0x1ac472[_0x5473('0x11')](_0x58f49c);}return _0x1ac472[_0x5473('0x12')](_0x58f49c)[_0x5473('0x13')]();};}function respondWithResult(_0x1bf5a3,_0x1e7b95){_0x1e7b95=_0x1e7b95||0xc8;return function(_0x43a3f9){if(_0x43a3f9){return _0x1bf5a3[_0x5473('0x12')](_0x1e7b95)[_0x5473('0x14')](_0x43a3f9);}};}function respondWithFilteredResult(_0x1bef5b,_0x33ba31){return function(_0x1450d6){if(_0x1450d6){var _0x3fcdbc=typeof _0x33ba31[_0x5473('0x15')]===_0x5473('0x16')&&typeof _0x33ba31['limit']===_0x5473('0x16');var _0x2d13fe=_0x1450d6[_0x5473('0x17')];var _0x3e3322=_0x3fcdbc?0x0:_0x33ba31['offset'];var _0x68ce8a=_0x3fcdbc?_0x1450d6[_0x5473('0x17')]:_0x33ba31[_0x5473('0x15')]+_0x33ba31[_0x5473('0x18')];var _0x54e56b;if(_0x68ce8a>=_0x2d13fe){_0x68ce8a=_0x2d13fe;_0x54e56b=0xc8;}else{_0x54e56b=0xce;}_0x1bef5b['status'](_0x54e56b);return _0x1bef5b[_0x5473('0x19')](_0x5473('0x1a'),_0x3e3322+'-'+_0x68ce8a+'/'+_0x2d13fe)[_0x5473('0x14')](_0x1450d6);}return null;};}function saveUpdates(_0x15c411){return function(_0x1b2e71){if(_0x1b2e71){return _0x1b2e71[_0x5473('0x1b')](_0x15c411)[_0x5473('0x1c')](function(_0x4ddc06){return _0x4ddc06;});}return null;};}function removeEntity(_0x59f67b){return function(_0x4e0996){if(_0x4e0996){return _0x4e0996['destroy']()[_0x5473('0x1c')](function(){_0x59f67b[_0x5473('0x12')](0xcc)[_0x5473('0x13')]();});}};}function handleEntityNotFound(_0x459685){return function(_0x2a3115){if(!_0x2a3115){_0x459685['sendStatus'](0x194);}return _0x2a3115;};}function handleError(_0x67b890,_0x3bdc9c){_0x3bdc9c=_0x3bdc9c||0x1f4;return function(_0x214ce6){logger[_0x5473('0x1d')](_0x214ce6[_0x5473('0x1e')]);if(_0x214ce6[_0x5473('0x1f')]){delete _0x214ce6[_0x5473('0x1f')];}_0x67b890[_0x5473('0x12')](_0x3bdc9c)[_0x5473('0x20')](_0x214ce6);};}exports['index']=function(_0x4c4a76,_0x3dc94f){var _0x1df047={};var _0x397ad2=_[_0x5473('0x21')](db['MailInteraction'][_0x5473('0x22')],function(_0x62ab2){return{'name':_0x62ab2[_0x5473('0x23')],'type':_0x62ab2[_0x5473('0x24')][_0x5473('0x25')]};});_0x1df047=qs[_0x5473('0x26')](_0x397ad2,_0x4c4a76);return interaction[_0x5473('0x27')]('mail',_0x4c4a76[_0x5473('0x28')],_0x4c4a76[_0x5473('0x29')],_0x1df047,_0x397ad2)['then'](respondWithFilteredResult(_0x3dc94f,_0x1df047))['catch'](handleError(_0x3dc94f,null));};exports[_0x5473('0x2a')]=function(_0x1a3652,_0xa99703){var _0x312c47={'raw':![],'where':{'id':_0x1a3652[_0x5473('0x2b')]['id']}},_0x5ee3e1={};_0x5ee3e1['model']=_[_0x5473('0x2c')](db[_0x5473('0x2d')][_0x5473('0x22')]);_0x5ee3e1[_0x5473('0x28')]=_[_0x5473('0x2c')](_0x1a3652[_0x5473('0x28')]);_0x5ee3e1[_0x5473('0x2e')]=_[_0x5473('0x2f')](_0x5ee3e1[_0x5473('0x30')],_0x5ee3e1[_0x5473('0x28')]);_0x312c47[_0x5473('0x31')]=_[_0x5473('0x2f')](_0x5ee3e1[_0x5473('0x30')],qs[_0x5473('0x32')](_0x1a3652['query'][_0x5473('0x32')]));_0x312c47['attributes']=_0x312c47['attributes'][_0x5473('0x33')]?_0x312c47[_0x5473('0x31')]:_0x5ee3e1[_0x5473('0x30')];if(_0x1a3652[_0x5473('0x28')][_0x5473('0x34')]){_0x312c47[_0x5473('0x35')]=[{'all':!![]}];}_0x312c47=_[_0x5473('0x36')]({},_0x312c47,_0x1a3652[_0x5473('0x37')]);return db[_0x5473('0x2d')][_0x5473('0x38')](_0x312c47)[_0x5473('0x1c')](handleEntityNotFound(_0xa99703,null))[_0x5473('0x1c')](respondWithResult(_0xa99703,null))[_0x5473('0x39')](handleError(_0xa99703,null));};exports[_0x5473('0x3a')]=function(_0x84ac31,_0x1eac3b){return db['MailInteraction'][_0x5473('0x3a')](_0x84ac31['body'],{})[_0x5473('0x1c')](respondWithResult(_0x1eac3b,0xc9))[_0x5473('0x39')](handleError(_0x1eac3b,null));};exports[_0x5473('0x1b')]=function(_0x161b26,_0x81c903){if(_0x161b26[_0x5473('0x3b')]['id']){delete _0x161b26[_0x5473('0x3b')]['id'];}return db[_0x5473('0x2d')]['find']({'where':{'id':_0x161b26[_0x5473('0x2b')]['id']}})['then'](handleEntityNotFound(_0x81c903,null))['then'](saveUpdates(_0x161b26[_0x5473('0x3b')],null))[_0x5473('0x1c')](respondWithResult(_0x81c903,null))['catch'](handleError(_0x81c903,null));};exports[_0x5473('0x3c')]=function(_0xf0b6ea,_0x44061f){return db['MailInteraction'][_0x5473('0x38')]({'where':{'id':_0xf0b6ea[_0x5473('0x2b')]['id']}})[_0x5473('0x1c')](handleEntityNotFound(_0x44061f,null))[_0x5473('0x1c')](removeEntity(_0x44061f,null))[_0x5473('0x39')](handleError(_0x44061f,null));};exports[_0x5473('0x3d')]=function(_0x44070a,_0x3e6a2e){return db[_0x5473('0x2d')][_0x5473('0x3d')]()[_0x5473('0x1c')](respondWithResult(_0x3e6a2e,null))['catch'](handleError(_0x3e6a2e,null));};exports[_0x5473('0x3e')]=function(_0x4c9f19,_0x24692d){return db[_0x5473('0x3f')]['find']({'where':{'id':_0x4c9f19[_0x5473('0x2b')]['id']}})[_0x5473('0x1c')](handleEntityNotFound(_0x24692d,null))[_0x5473('0x1c')](function(_0x102e7c){if(_0x102e7c){return _0x102e7c[_0x5473('0x3e')](_0x4c9f19['body'][_0x5473('0x40')],_[_0x5473('0x41')](_0x4c9f19['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x24692d,null))['catch'](handleError(_0x24692d,null));};exports[_0x5473('0x42')]=function(_0x3fc9a8,_0xffb69e){var _0x2adc06={'raw':![],'where':{}};var _0xb142dd={};var _0x365ef5={'count':0x0,'rows':[]};return db[_0x5473('0x2d')][_0x5473('0x43')]({'where':{'id':_0x3fc9a8[_0x5473('0x2b')]['id']}})[_0x5473('0x1c')](handleEntityNotFound(_0xffb69e,null))[_0x5473('0x1c')](function(_0x2169fe){if(_0x2169fe){_0xb142dd[_0x5473('0x30')]=_[_0x5473('0x2c')](db['MailMessage'][_0x5473('0x22')]);_0xb142dd['query']=_[_0x5473('0x2c')](_0x3fc9a8[_0x5473('0x28')]);_0xb142dd[_0x5473('0x2e')]=_[_0x5473('0x2f')](_0xb142dd['model'],_0xb142dd[_0x5473('0x28')]);_0x2adc06['attributes']=_[_0x5473('0x2f')](_0xb142dd[_0x5473('0x30')],qs['fields'](_0x3fc9a8[_0x5473('0x28')][_0x5473('0x32')]));_0x2adc06[_0x5473('0x31')]=_0x2adc06[_0x5473('0x31')]['length']?_0x2adc06[_0x5473('0x31')]:_0xb142dd[_0x5473('0x30')];if(!_0x3fc9a8[_0x5473('0x28')][_0x5473('0x44')](_0x5473('0x45'))){_0x2adc06[_0x5473('0x18')]=qs[_0x5473('0x18')](_0x3fc9a8[_0x5473('0x28')]['limit']);_0x2adc06[_0x5473('0x15')]=qs[_0x5473('0x15')](_0x3fc9a8[_0x5473('0x28')]['offset']);}_0x2adc06['order']=qs[_0x5473('0x46')](_0x3fc9a8[_0x5473('0x28')][_0x5473('0x46')]);_0x2adc06[_0x5473('0x47')]=qs['filters'](_['pick'](_0x3fc9a8['query'],_0xb142dd[_0x5473('0x2e')]));_0x2adc06[_0x5473('0x47')]['MailInteractionId']=_0x2169fe['id'];if(_0x3fc9a8[_0x5473('0x28')][_0x5473('0x48')]){_0x2adc06[_0x5473('0x47')]=_[_0x5473('0x36')](_0x2adc06[_0x5473('0x47')],{'$or':_['map'](_0x2adc06[_0x5473('0x31')],function(_0x50d774){var _0x5d3b2c={};_0x5d3b2c[_0x50d774]={'$like':'%'+_0x3fc9a8[_0x5473('0x28')][_0x5473('0x48')]+'%'};return _0x5d3b2c;})});}if(_0x3fc9a8[_0x5473('0x28')][_0x5473('0x49')]){var _0x4b8ef1=_0x3fc9a8[_0x5473('0x28')][_0x5473('0x49')]['split'](',');var _0x3a8584={};_0x3a8584[_0x4b8ef1[0x0]]={'$gte':moment(_0x4b8ef1[0x1])[_0x5473('0x4a')](_0x5473('0x4b'))};_0x2adc06['where']=_[_0x5473('0x36')](_0x2adc06[_0x5473('0x47')],_0x3a8584);}_0x2adc06=_[_0x5473('0x36')]({},_0x2adc06,_0x3fc9a8[_0x5473('0x37')]);return db[_0x5473('0x3f')][_0x5473('0x17')]({'where':_0x2adc06[_0x5473('0x47')]})['then'](function(_0x419ae6){_0x365ef5[_0x5473('0x17')]=_0x419ae6;if(_0x3fc9a8[_0x5473('0x28')][_0x5473('0x34')]){_0x2adc06[_0x5473('0x35')]=[{'all':!![]}];}return db[_0x5473('0x3f')][_0x5473('0x27')](_0x2adc06);})['then'](function(_0x161b1c){if(_0x3fc9a8['query'][_0x5473('0x4c')]===_0x5473('0x4d')){for(var _0x2cbcb8=0x0;_0x2cbcb8<_0x161b1c[_0x5473('0x33')];_0x2cbcb8++){_0x161b1c[_0x2cbcb8][_0x5473('0x3b')]=juice(_0x161b1c[_0x2cbcb8][_0x5473('0x3b')]);}}_0x365ef5[_0x5473('0x4e')]=_0x161b1c;return _0x365ef5;});}})[_0x5473('0x1c')](respondWithFilteredResult(_0xffb69e,_0x2adc06))[_0x5473('0x39')](handleError(_0xffb69e,null));};exports['addTags']=function(_0x41536d,_0x5ab269){return db['MailInteraction'][_0x5473('0x38')]({'where':{'id':_0x41536d[_0x5473('0x2b')]['id']}})[_0x5473('0x1c')](handleEntityNotFound(_0x5ab269,null))['then'](function(_0x3e04ee){if(_0x3e04ee){return _0x3e04ee['setTags'](_0x41536d['body'][_0x5473('0x40')],_[_0x5473('0x41')](_0x41536d[_0x5473('0x3b')],[_0x5473('0x40'),'id'])||{})[_0x5473('0x4f')](function(){return db[_0x5473('0x50')]['findAll']({'attributes':['id',_0x5473('0x1f'),_0x5473('0x51')],'where':{'id':_0x41536d['body'][_0x5473('0x40')]}});})[_0x5473('0x1c')](function(_0x555f83){socket[_0x5473('0x52')]('mailInteractionTags:save',{'id':Number(_0x41536d[_0x5473('0x2b')]['id']),'tags':_0x555f83||[]});return{'id':Number(_0x41536d[_0x5473('0x2b')]['id']),'tags':_0x555f83||[]};});}})['then'](respondWithResult(_0x5ab269,null))[_0x5473('0x39')](handleError(_0x5ab269,null));};exports[_0x5473('0x53')]=function(_0x4ebadb,_0x396fb3){return db['MailInteraction'][_0x5473('0x38')]({'where':{'id':_0x4ebadb[_0x5473('0x2b')]['id']}})[_0x5473('0x1c')](handleEntityNotFound(_0x396fb3,null))[_0x5473('0x1c')](function(_0x2299fd){if(_0x2299fd){return _0x2299fd[_0x5473('0x53')](_0x4ebadb[_0x5473('0x28')][_0x5473('0x40')]);}})[_0x5473('0x1c')](respondWithStatusCode(_0x396fb3,null))['catch'](handleError(_0x396fb3,null));};exports[_0x5473('0x54')]=function(_0x4f2fd5,_0x39a83a){var _0x575ecf=moment()['unix']()[_0x5473('0x55')]();var _0x2eab28=path[_0x5473('0x56')](config['root'],'server',_0x5473('0x57'),_0x5473('0x58'));var _0x32007a=path[_0x5473('0x56')](config[_0x5473('0x59')],_0x5473('0x5a'),_0x5473('0x57'),'attachments');var _0x2038af=path[_0x5473('0x56')](_0x2eab28,_0x575ecf);var _0x4b1028=util['format'](_0x5473('0x5b'),_0x4f2fd5[_0x5473('0x2b')]['id'],_0x575ecf);var _0x347ff9=path[_0x5473('0x56')](_0x2eab28,_0x4b1028);var _0x25e7ba=[];if(_0x4f2fd5['query'][_0x5473('0x5c')]){_0x25e7ba[_0x5473('0x5d')]({'model':db[_0x5473('0x5e')],'as':_0x5473('0x5f'),'raw':!![]});}var _0x54de7b=[{'model':db['MailMessage'],'as':_0x5473('0x60'),'attributes':['id',_0x5473('0x3b'),_0x5473('0x61'),'to','cc',_0x5473('0x62'),'subject',_0x5473('0x63')],'where':{'secret':![]},'order':qs[_0x5473('0x46')]('id'),'include':_0x25e7ba}];return db[_0x5473('0x2d')][_0x5473('0x38')]({'where':{'id':_0x4f2fd5[_0x5473('0x2b')]['id']},'include':_0x54de7b})[_0x5473('0x1c')](handleEntityNotFound(_0x39a83a,null))[_0x5473('0x1c')](function(_0x4a393d){if(_0x4a393d&&_0x4a393d[_0x5473('0x60')]){var _0x2fd8dd=_0x4a393d['get']({'plain':!![]});fs[_0x5473('0x64')](_0x2038af);return BPromise[_0x5473('0x65')](_0x2fd8dd[_0x5473('0x60')],function(_0x1b8666,_0xf5f86c){var _0x57cf52={'from':_0x1b8666[_0x5473('0x61')],'to':_0x1b8666['to']||_0x5473('0x66'),'subject':_0x1b8666['subject'],'html':htmlEntities[_0x5473('0x67')](_0x1b8666[_0x5473('0x3b')]),'headers':{'Date':moment(_0x1b8666[_0x5473('0x63')])[_0x5473('0x4a')](_0x5473('0x68'))},'attachments':[]};if(_0x1b8666['cc']){_0x57cf52['headers']['Cc']=_0x1b8666['cc'];}if(_0x1b8666[_0x5473('0x62')]){_0x57cf52[_0x5473('0x69')][_0x5473('0x6a')]=_0x1b8666['bcc'];}return new BPromise(function(_0x47fc52,_0x35449c){if(_0x1b8666[_0x5473('0x5f')]){for(var _0x1006fd=0x0;_0x1006fd<_0x1b8666[_0x5473('0x5f')][_0x5473('0x33')];_0x1006fd++){var _0x2b5712=_0x1b8666['Attachments'][_0x1006fd];var _0x184da3=path[_0x5473('0x56')](_0x32007a,_0x2b5712[_0x5473('0x6b')]);if(fs['existsSync'](_0x184da3)){_0x57cf52[_0x5473('0x5c')][_0x5473('0x5d')]({'name':_0x2b5712[_0x5473('0x1f')],'contentType':_0x2b5712['type'],'data':fs[_0x5473('0x6c')](_0x184da3)});}}}emlformat[_0x5473('0x6d')](_0x57cf52,function(_0x357795,_0x144de0){if(_0x357795)return _0x35449c(_0x357795);fs[_0x5473('0x6e')](path[_0x5473('0x56')](_0x2038af,util['format']('message%d.eml',_0xf5f86c)),_0x144de0);return _0x47fc52(_0x144de0);});});})[_0x5473('0x1c')](function(){return new BPromise(function(_0x53f65c,_0x4b693f){zipdir(_0x2038af,{'saveTo':_0x347ff9},function(_0x1ce60d,_0x13be4b){if(_0x1ce60d)return _0x4b693f(_0x1ce60d);return _0x53f65c(_0x13be4b);});})[_0x5473('0x1c')](function(){return new BPromise(function(_0x31e3bc,_0x2bf885){rimraf(_0x2038af,function(_0x1648c5){if(_0x1648c5)_0x2bf885(_0x1648c5);return _0x31e3bc();});});})[_0x5473('0x1c')](function(){return _0x39a83a[_0x5473('0x54')](_0x347ff9,_0x4b1028,function(_0x3470ac){if(!_0x3470ac)fs[_0x5473('0x6f')](_0x347ff9);});});});}else{return _0x39a83a[_0x5473('0x11')](0xc8);}})[_0x5473('0x39')](handleError(_0x39a83a,null));}; \ No newline at end of file +var _0x9914=['MailInteraction','keys','filters','intersection','model','attributes','fields','length','includeAll','include','find','create','body','describe','MailMessage','addMessage','omit','ids','getMessages','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','inlineCss','true','setTags','spread','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','mkdirSync','from','missing.recipient@your.company.com','format','headers','Bcc','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','then','end','error','name','send','map','rawAttributes','fieldName','type','key','getOptions','query','user','catch','params'];(function(_0x2b678d,_0x521dd6){var _0xd14d71=function(_0x502f5b){while(--_0x502f5b){_0x2b678d['push'](_0x2b678d['shift']());}};_0xd14d71(++_0x521dd6);}(_0x9914,0xb2));var _0x4991=function(_0x4741aa,_0x521cb5){_0x4741aa=_0x4741aa-0x0;var _0x23d9aa=_0x9914[_0x4741aa];return _0x23d9aa;};'use strict';var emlformat=require(_0x4991('0x0'));var rimraf=require(_0x4991('0x1'));var zipdir=require('zip-dir');var moment=require(_0x4991('0x2'));var BPromise=require(_0x4991('0x3'));var util=require(_0x4991('0x4'));var path=require(_0x4991('0x5'));var fs=require('fs');var _=require(_0x4991('0x6'));var juice=require('juice');var Redis=require(_0x4991('0x7'));var interaction=require(_0x4991('0x8'));var qs=require(_0x4991('0x9'));var logger=require('../../config/logger')(_0x4991('0xa'));var config=require(_0x4991('0xb'));var db=require(_0x4991('0xc'))['db'];var htmlEntities=require(_0x4991('0xd'));config[_0x4991('0xe')]=_[_0x4991('0xf')](config['redis'],{'host':_0x4991('0x10'),'port':0x18eb});var socket=require(_0x4991('0x11'))(new Redis(config['redis']));require(_0x4991('0x12'))['register'](socket);function respondWithStatusCode(_0x330d26,_0x448a61){_0x448a61=_0x448a61||0xcc;return function(_0x1c3ff4){if(_0x1c3ff4){return _0x330d26[_0x4991('0x13')](_0x448a61);}return _0x330d26['status'](_0x448a61)['end']();};}function respondWithResult(_0x44d663,_0x247a74){_0x247a74=_0x247a74||0xc8;return function(_0x9b4a89){if(_0x9b4a89){return _0x44d663[_0x4991('0x14')](_0x247a74)[_0x4991('0x15')](_0x9b4a89);}};}function respondWithFilteredResult(_0x2673e3,_0x1d53c3){return function(_0x277d99){if(_0x277d99){var _0x38b5d0=typeof _0x1d53c3[_0x4991('0x16')]==='undefined'&&typeof _0x1d53c3[_0x4991('0x17')]===_0x4991('0x18');var _0x3d9f9a=_0x277d99[_0x4991('0x19')];var _0x49b514=_0x38b5d0?0x0:_0x1d53c3['offset'];var _0x4ae5f3=_0x38b5d0?_0x277d99[_0x4991('0x19')]:_0x1d53c3[_0x4991('0x16')]+_0x1d53c3[_0x4991('0x17')];var _0x56e5b1;if(_0x4ae5f3>=_0x3d9f9a){_0x4ae5f3=_0x3d9f9a;_0x56e5b1=0xc8;}else{_0x56e5b1=0xce;}_0x2673e3[_0x4991('0x14')](_0x56e5b1);return _0x2673e3[_0x4991('0x1a')](_0x4991('0x1b'),_0x49b514+'-'+_0x4ae5f3+'/'+_0x3d9f9a)[_0x4991('0x15')](_0x277d99);}return null;};}function saveUpdates(_0x428d74){return function(_0x23a28d){if(_0x23a28d){return _0x23a28d[_0x4991('0x1c')](_0x428d74)['then'](function(_0x5c0164){return _0x5c0164;});}return null;};}function removeEntity(_0x25ab39){return function(_0x452eef){if(_0x452eef){return _0x452eef['destroy']()[_0x4991('0x1d')](function(){_0x25ab39[_0x4991('0x14')](0xcc)[_0x4991('0x1e')]();});}};}function handleEntityNotFound(_0x506864){return function(_0x10b221){if(!_0x10b221){_0x506864[_0x4991('0x13')](0x194);}return _0x10b221;};}function handleError(_0x12df49,_0x19c144){_0x19c144=_0x19c144||0x1f4;return function(_0x887b53){logger[_0x4991('0x1f')](_0x887b53['stack']);if(_0x887b53[_0x4991('0x20')]){delete _0x887b53[_0x4991('0x20')];}_0x12df49[_0x4991('0x14')](_0x19c144)[_0x4991('0x21')](_0x887b53);};}exports['index']=function(_0x3848ae,_0x57f4ee){var _0x371282={};var _0x10982f=_[_0x4991('0x22')](db['MailInteraction'][_0x4991('0x23')],function(_0x14bea8){return{'name':_0x14bea8[_0x4991('0x24')],'type':_0x14bea8[_0x4991('0x25')][_0x4991('0x26')]};});_0x371282=qs[_0x4991('0x27')](_0x10982f,_0x3848ae);return interaction['findAll']('mail',_0x3848ae[_0x4991('0x28')],_0x3848ae[_0x4991('0x29')],_0x371282,_0x10982f)[_0x4991('0x1d')](respondWithFilteredResult(_0x57f4ee,_0x371282))[_0x4991('0x2a')](handleError(_0x57f4ee,null));};exports['show']=function(_0xed9fc5,_0x396760){var _0x1e8d88={'raw':![],'where':{'id':_0xed9fc5[_0x4991('0x2b')]['id']}},_0x25af28={};_0x25af28['model']=_['keys'](db[_0x4991('0x2c')]['rawAttributes']);_0x25af28[_0x4991('0x28')]=_[_0x4991('0x2d')](_0xed9fc5[_0x4991('0x28')]);_0x25af28[_0x4991('0x2e')]=_[_0x4991('0x2f')](_0x25af28[_0x4991('0x30')],_0x25af28[_0x4991('0x28')]);_0x1e8d88[_0x4991('0x31')]=_[_0x4991('0x2f')](_0x25af28[_0x4991('0x30')],qs['fields'](_0xed9fc5['query'][_0x4991('0x32')]));_0x1e8d88[_0x4991('0x31')]=_0x1e8d88[_0x4991('0x31')][_0x4991('0x33')]?_0x1e8d88[_0x4991('0x31')]:_0x25af28['model'];if(_0xed9fc5[_0x4991('0x28')][_0x4991('0x34')]){_0x1e8d88[_0x4991('0x35')]=[{'all':!![]}];}_0x1e8d88=_['merge']({},_0x1e8d88,_0xed9fc5['options']);return db[_0x4991('0x2c')][_0x4991('0x36')](_0x1e8d88)[_0x4991('0x1d')](handleEntityNotFound(_0x396760,null))[_0x4991('0x1d')](respondWithResult(_0x396760,null))['catch'](handleError(_0x396760,null));};exports[_0x4991('0x37')]=function(_0x397cfa,_0x497a30){return db['MailInteraction']['create'](_0x397cfa['body'],{})[_0x4991('0x1d')](respondWithResult(_0x497a30,0xc9))['catch'](handleError(_0x497a30,null));};exports[_0x4991('0x1c')]=function(_0x33713f,_0x1dac5a){if(_0x33713f[_0x4991('0x38')]['id']){delete _0x33713f[_0x4991('0x38')]['id'];}return db[_0x4991('0x2c')][_0x4991('0x36')]({'where':{'id':_0x33713f[_0x4991('0x2b')]['id']}})[_0x4991('0x1d')](handleEntityNotFound(_0x1dac5a,null))['then'](saveUpdates(_0x33713f[_0x4991('0x38')],null))['then'](respondWithResult(_0x1dac5a,null))[_0x4991('0x2a')](handleError(_0x1dac5a,null));};exports['destroy']=function(_0x248b80,_0x4bea48){return db[_0x4991('0x2c')][_0x4991('0x36')]({'where':{'id':_0x248b80[_0x4991('0x2b')]['id']}})[_0x4991('0x1d')](handleEntityNotFound(_0x4bea48,null))[_0x4991('0x1d')](removeEntity(_0x4bea48,null))[_0x4991('0x2a')](handleError(_0x4bea48,null));};exports[_0x4991('0x39')]=function(_0x4f3944,_0x2cbbc3){return db[_0x4991('0x2c')]['describe']()[_0x4991('0x1d')](respondWithResult(_0x2cbbc3,null))[_0x4991('0x2a')](handleError(_0x2cbbc3,null));};exports['addMessage']=function(_0xdccd8b,_0x2108af){return db[_0x4991('0x3a')][_0x4991('0x36')]({'where':{'id':_0xdccd8b[_0x4991('0x2b')]['id']}})[_0x4991('0x1d')](handleEntityNotFound(_0x2108af,null))[_0x4991('0x1d')](function(_0x5b76d1){if(_0x5b76d1){return _0x5b76d1[_0x4991('0x3b')](_0xdccd8b[_0x4991('0x38')]['ids'],_[_0x4991('0x3c')](_0xdccd8b[_0x4991('0x38')],[_0x4991('0x3d'),'id'])||{});}})[_0x4991('0x1d')](respondWithResult(_0x2108af,null))[_0x4991('0x2a')](handleError(_0x2108af,null));};exports[_0x4991('0x3e')]=function(_0x4f3793,_0x188e30){var _0x5402b8={'raw':![],'where':{}};var _0x5ccce6={};var _0x25e3f9={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x4f3793[_0x4991('0x2b')]['id']}})[_0x4991('0x1d')](handleEntityNotFound(_0x188e30,null))[_0x4991('0x1d')](function(_0x3c2f5d){if(_0x3c2f5d){_0x5ccce6[_0x4991('0x30')]=_[_0x4991('0x2d')](db[_0x4991('0x3a')][_0x4991('0x23')]);_0x5ccce6['query']=_['keys'](_0x4f3793[_0x4991('0x28')]);_0x5ccce6[_0x4991('0x2e')]=_[_0x4991('0x2f')](_0x5ccce6[_0x4991('0x30')],_0x5ccce6[_0x4991('0x28')]);_0x5402b8['attributes']=_[_0x4991('0x2f')](_0x5ccce6[_0x4991('0x30')],qs[_0x4991('0x32')](_0x4f3793[_0x4991('0x28')]['fields']));_0x5402b8[_0x4991('0x31')]=_0x5402b8['attributes'][_0x4991('0x33')]?_0x5402b8[_0x4991('0x31')]:_0x5ccce6['model'];if(!_0x4f3793[_0x4991('0x28')][_0x4991('0x3f')](_0x4991('0x40'))){_0x5402b8[_0x4991('0x17')]=qs[_0x4991('0x17')](_0x4f3793[_0x4991('0x28')][_0x4991('0x17')]);_0x5402b8[_0x4991('0x16')]=qs['offset'](_0x4f3793[_0x4991('0x28')][_0x4991('0x16')]);}_0x5402b8['order']=qs['sort'](_0x4f3793[_0x4991('0x28')][_0x4991('0x41')]);_0x5402b8[_0x4991('0x42')]=qs[_0x4991('0x2e')](_[_0x4991('0x43')](_0x4f3793['query'],_0x5ccce6['filters']));_0x5402b8['where'][_0x4991('0x44')]=_0x3c2f5d['id'];if(_0x4f3793[_0x4991('0x28')][_0x4991('0x45')]){_0x5402b8[_0x4991('0x42')]=_[_0x4991('0x46')](_0x5402b8[_0x4991('0x42')],{'$or':_[_0x4991('0x22')](_0x5402b8['attributes'],function(_0x64f793){var _0x598297={};_0x598297[_0x64f793]={'$like':'%'+_0x4f3793[_0x4991('0x28')][_0x4991('0x45')]+'%'};return _0x598297;})});}if(_0x4f3793[_0x4991('0x28')]['$gte']){var _0x2a1c0f=_0x4f3793[_0x4991('0x28')][_0x4991('0x47')][_0x4991('0x48')](',');var _0x41bfe2={};_0x41bfe2[_0x2a1c0f[0x0]]={'$gte':moment(_0x2a1c0f[0x1])['format'](_0x4991('0x49'))};_0x5402b8[_0x4991('0x42')]=_[_0x4991('0x46')](_0x5402b8[_0x4991('0x42')],_0x41bfe2);}_0x5402b8=_['merge']({},_0x5402b8,_0x4f3793[_0x4991('0x4a')]);return db['MailMessage']['count']({'where':_0x5402b8[_0x4991('0x42')]})[_0x4991('0x1d')](function(_0x82e3b3){_0x25e3f9['count']=_0x82e3b3;if(_0x4f3793['query'][_0x4991('0x34')]){_0x5402b8['include']=[{'all':!![]}];}return db[_0x4991('0x3a')][_0x4991('0x4b')](_0x5402b8);})['then'](function(_0x335d72){if(_0x4f3793[_0x4991('0x28')][_0x4991('0x4c')]===_0x4991('0x4d')){for(var _0x51fb6e=0x0;_0x51fb6e<_0x335d72['length'];_0x51fb6e++){_0x335d72[_0x51fb6e][_0x4991('0x38')]=juice(_0x335d72[_0x51fb6e][_0x4991('0x38')]);}}_0x25e3f9['rows']=_0x335d72;return _0x25e3f9;});}})[_0x4991('0x1d')](respondWithFilteredResult(_0x188e30,_0x5402b8))[_0x4991('0x2a')](handleError(_0x188e30,null));};exports['addTags']=function(_0x538d4e,_0x1dac24){return db['MailInteraction']['find']({'where':{'id':_0x538d4e[_0x4991('0x2b')]['id']}})[_0x4991('0x1d')](handleEntityNotFound(_0x1dac24,null))[_0x4991('0x1d')](function(_0x37da84){if(_0x37da84){return _0x37da84[_0x4991('0x4e')](_0x538d4e[_0x4991('0x38')][_0x4991('0x3d')],_[_0x4991('0x3c')](_0x538d4e[_0x4991('0x38')],[_0x4991('0x3d'),'id'])||{})[_0x4991('0x4f')](function(){return db['Tag'][_0x4991('0x4b')]({'attributes':['id','name',_0x4991('0x50')],'where':{'id':_0x538d4e[_0x4991('0x38')][_0x4991('0x3d')]}});})[_0x4991('0x1d')](function(_0x110e0c){socket[_0x4991('0x51')](_0x4991('0x52'),{'id':Number(_0x538d4e[_0x4991('0x2b')]['id']),'tags':_0x110e0c||[]});return{'id':Number(_0x538d4e['params']['id']),'tags':_0x110e0c||[]};});}})[_0x4991('0x1d')](respondWithResult(_0x1dac24,null))['catch'](handleError(_0x1dac24,null));};exports[_0x4991('0x53')]=function(_0x116ee8,_0x30580e){return db[_0x4991('0x2c')]['find']({'where':{'id':_0x116ee8['params']['id']}})['then'](handleEntityNotFound(_0x30580e,null))['then'](function(_0x1267a5){if(_0x1267a5){return _0x1267a5[_0x4991('0x53')](_0x116ee8[_0x4991('0x28')]['ids']);}})[_0x4991('0x1d')](respondWithStatusCode(_0x30580e,null))['catch'](handleError(_0x30580e,null));};exports['download']=function(_0x15cf40,_0x57537d){var _0x46b05b=moment()[_0x4991('0x54')]()[_0x4991('0x55')]();var _0xe6a299=path[_0x4991('0x56')](config['root'],_0x4991('0x57'),'files',_0x4991('0x58'));var _0x1c3fc8=path[_0x4991('0x56')](config[_0x4991('0x59')],_0x4991('0x57'),_0x4991('0x5a'),_0x4991('0x5b'));var _0x1f33f3=path[_0x4991('0x56')](_0xe6a299,_0x46b05b);var _0x34cd8a=util['format'](_0x4991('0x5c'),_0x15cf40['params']['id'],_0x46b05b);var _0x124280=path[_0x4991('0x56')](_0xe6a299,_0x34cd8a);var _0x2daa77=[];if(_0x15cf40[_0x4991('0x28')]['attachments']){_0x2daa77['push']({'model':db[_0x4991('0x5d')],'as':_0x4991('0x5e'),'raw':!![]});}var _0x24c753=[{'model':db[_0x4991('0x3a')],'as':_0x4991('0x5f'),'attributes':['id','body','from','to','cc',_0x4991('0x60'),_0x4991('0x61'),_0x4991('0x62')],'where':{'secret':![]},'order':qs[_0x4991('0x41')]('id'),'include':_0x2daa77}];return db[_0x4991('0x2c')][_0x4991('0x36')]({'where':{'id':_0x15cf40['params']['id']},'include':_0x24c753})['then'](handleEntityNotFound(_0x57537d,null))[_0x4991('0x1d')](function(_0x3c185a){if(_0x3c185a&&_0x3c185a['Messages']){var _0x3a042a=_0x3c185a['get']({'plain':!![]});fs[_0x4991('0x63')](_0x1f33f3);return BPromise['each'](_0x3a042a['Messages'],function(_0x37f964,_0xcf733d){var _0x215666={'from':_0x37f964[_0x4991('0x64')],'to':_0x37f964['to']||_0x4991('0x65'),'subject':_0x37f964['subject'],'html':htmlEntities['decode'](_0x37f964[_0x4991('0x38')]),'headers':{'Date':moment(_0x37f964['createdAt'])[_0x4991('0x66')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x37f964['cc']){_0x215666[_0x4991('0x67')]['Cc']=_0x37f964['cc'];}if(_0x37f964[_0x4991('0x60')]){_0x215666['headers'][_0x4991('0x68')]=_0x37f964[_0x4991('0x60')];}return new BPromise(function(_0x31cb9e,_0x24c953){if(_0x37f964[_0x4991('0x5e')]){for(var _0xc70a9b=0x0;_0xc70a9b<_0x37f964[_0x4991('0x5e')]['length'];_0xc70a9b++){var _0x3605f4=_0x37f964['Attachments'][_0xc70a9b];var _0xe4fd7=path[_0x4991('0x56')](_0x1c3fc8,_0x3605f4['basename']);if(fs[_0x4991('0x69')](_0xe4fd7)){_0x215666['attachments']['push']({'name':_0x3605f4[_0x4991('0x20')],'contentType':_0x3605f4[_0x4991('0x25')],'data':fs[_0x4991('0x6a')](_0xe4fd7)});}}}emlformat[_0x4991('0x6b')](_0x215666,function(_0xee558f,_0x2fbc38){if(_0xee558f)return _0x24c953(_0xee558f);fs['writeFileSync'](path[_0x4991('0x56')](_0x1f33f3,util[_0x4991('0x66')](_0x4991('0x6c'),_0xcf733d)),_0x2fbc38);return _0x31cb9e(_0x2fbc38);});});})[_0x4991('0x1d')](function(){return new BPromise(function(_0x6aa4e3,_0x50560c){zipdir(_0x1f33f3,{'saveTo':_0x124280},function(_0x48b9da,_0x37b7a3){if(_0x48b9da)return _0x50560c(_0x48b9da);return _0x6aa4e3(_0x37b7a3);});})[_0x4991('0x1d')](function(){return new BPromise(function(_0x46f66e,_0x43b8ec){rimraf(_0x1f33f3,function(_0x24044c){if(_0x24044c)_0x43b8ec(_0x24044c);return _0x46f66e();});});})[_0x4991('0x1d')](function(){return _0x57537d[_0x4991('0x6d')](_0x124280,_0x34cd8a,function(_0x4ccdbc){if(!_0x4ccdbc)fs[_0x4991('0x6e')](_0x124280);});});});}else{return _0x57537d['sendStatus'](0xc8);}})[_0x4991('0x2a')](handleError(_0x57537d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1ffa44a..67c029c 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 _0xb9dc=['hook','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x51361c,_0x3ac7f6){var _0xafa94b=function(_0x2886ba){while(--_0x2886ba){_0x51361c['push'](_0x51361c['shift']());}};_0xafa94b(++_0x3ac7f6);}(_0xb9dc,0x145));var _0xcb9d=function(_0x133468,_0x31fb74){_0x133468=_0x133468-0x0;var _0x230724=_0xb9dc[_0x133468];return _0x230724;};'use strict';var EventEmitter=require(_0xcb9d('0x0'));var MailInteraction=require(_0xcb9d('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xcb9d('0x1'))['db'][_0xcb9d('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xcb9d('0x3')](0x0);var events={'afterCreate':_0xcb9d('0x4'),'afterUpdate':'update','afterDestroy':_0xcb9d('0x5')};function emitEvent(_0x3a75b5){return function(_0x24d2d4,_0x4f39c7,_0x3c752a){_0x24d2d4[_0xcb9d('0x6')]({'attributes':['id'],'raw':!![]})[_0xcb9d('0x7')](function(_0x54199b){_0x24d2d4['setDataValue'](_0xcb9d('0x8'),_0x54199b[_0xcb9d('0x9')](function(_0xa9de29){return{'id':_0xa9de29['id']};}));return MailMessage[_0xcb9d('0xa')]({'where':{'MailInteractionId':_0x24d2d4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcb9d('0x7')](function(_0xd65780){_0x24d2d4[_0xcb9d('0xb')](_0xcb9d('0xc'),_0xd65780[_0xcb9d('0xd')]);MailInteractionEvents[_0xcb9d('0xe')](_0x3a75b5+':'+_0x24d2d4['id'],_0x24d2d4);MailInteractionEvents[_0xcb9d('0xe')](_0x3a75b5,_0x24d2d4);_0x3c752a(null);})[_0xcb9d('0xf')](_0x3c752a(null));};}for(var e in events){if(events[_0xcb9d('0x10')](e)){var event=events[e];MailInteraction[_0xcb9d('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x6d49=['events','../../mysqldb','MailMessage','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x10a6d7,_0x1c6d0c){var _0x179e59=function(_0x1bdb7c){while(--_0x1bdb7c){_0x10a6d7['push'](_0x10a6d7['shift']());}};_0x179e59(++_0x1c6d0c);}(_0x6d49,0x1b0));var _0x96d4=function(_0x193159,_0x18fc4c){_0x193159=_0x193159-0x0;var _0x24bb0e=_0x6d49[_0x193159];return _0x24bb0e;};'use strict';var EventEmitter=require(_0x96d4('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x96d4('0x1'))['db'][_0x96d4('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x96d4('0x3'),'afterDestroy':_0x96d4('0x4')};function emitEvent(_0x42ae06){return function(_0x9bedf2,_0x269209,_0x5339c8){_0x9bedf2['getUsers']({'attributes':['id'],'raw':!![]})[_0x96d4('0x5')](function(_0x244eea){_0x9bedf2[_0x96d4('0x6')](_0x96d4('0x7'),_0x244eea[_0x96d4('0x8')](function(_0x134b1d){return{'id':_0x134b1d['id']};}));return MailMessage[_0x96d4('0x9')]({'where':{'MailInteractionId':_0x9bedf2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x96d4('0x5')](function(_0x467b0c){_0x9bedf2[_0x96d4('0x6')](_0x96d4('0xa'),_0x467b0c[_0x96d4('0xb')]);MailInteractionEvents[_0x96d4('0xc')](_0x42ae06+':'+_0x9bedf2['id'],_0x9bedf2);MailInteractionEvents[_0x96d4('0xc')](_0x42ae06,_0x9bedf2);_0x5339c8(null);})[_0x96d4('0xd')](_0x5339c8(null));};}for(var e in events){if(events[_0x96d4('0xe')](e)){var event=events[e];MailInteraction[_0x96d4('0xf')](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 7997349..d21ccc7 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 _0x56b7=['then','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','closedAt','models','MailMessage','update'];(function(_0x50cd1d,_0x44addb){var _0x145afd=function(_0x2164d7){while(--_0x2164d7){_0x50cd1d['push'](_0x50cd1d['shift']());}};_0x145afd(++_0x44addb);}(_0x56b7,0x1a5));var _0x756b=function(_0x5ebe63,_0x2956bc){_0x5ebe63=_0x5ebe63-0x0;var _0x1f91ee=_0x56b7[_0x5ebe63];return _0x1f91ee;};'use strict';var _=require(_0x756b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x756b('0x1'));var moment=require(_0x756b('0x2'));var BPromise=require('bluebird');var rp=require(_0x756b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x756b('0x4')]=function(_0xe7cbe9,_0x5dad74){return _0xe7cbe9[_0x756b('0x5')](_0x756b('0x6'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x756b('0x7'),'fields':['subject','to'],'type':_0x756b('0x8')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x51a48d,_0x22677a,_0x2a4fa9){if(_0x51a48d[_0x756b('0x9')]){_0x51a48d[_0x756b('0xa')]=moment()[_0x756b('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x51a48d['closed']){_0x51a48d['closedAt']=moment()[_0x756b('0xb')](_0x756b('0xc'));}_0x2a4fa9(null,_0x22677a);},'beforeUpdate':function(_0x44f8d4,_0x4454c2,_0x339ab6){if(_0x44f8d4[_0x756b('0xd')](_0x756b('0x9'))){_0x44f8d4[_0x756b('0xa')]=_0x44f8d4[_0x756b('0x9')]?moment()[_0x756b('0xb')](_0x756b('0xc')):null;}if(_0x44f8d4[_0x756b('0xd')](_0x756b('0xe'))){_0x44f8d4[_0x756b('0xf')]=moment()[_0x756b('0xb')](_0x756b('0xc'));_0x44f8d4[_0x756b('0x9')]=null;_0x44f8d4['substatusAt']=null;}_0x339ab6(null,_0x44f8d4);},'afterUpdate':function(_0x309f00,_0x3899ef,_0x36afd8){var _0xe3046c=_0xe7cbe9[_0x756b('0x10')];var _0x43aa88=_0x309f00['get']({'plain':!![]});if(_0x43aa88[_0x756b('0xe')]){return _0xe3046c[_0x756b('0x11')][_0x756b('0x12')]({'read':!![]},{'where':{'MailInteractionId':_0x43aa88['id']}})[_0x756b('0x13')](function(){_0x36afd8();})['catch'](function(_0x2fee21){_0x36afd8(_0x2fee21);});}else{_0x36afd8();}}},'charset':_0x756b('0x14'),'collate':_0x756b('0x15')});}; \ No newline at end of file +var _0xb20e=['closed','closedAt','format','changed','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x450ad5,_0x43becc){var _0x6a97d3=function(_0x33a51a){while(--_0x33a51a){_0x450ad5['push'](_0x450ad5['shift']());}};_0x6a97d3(++_0x43becc);}(_0xb20e,0x193));var _0xeb20=function(_0x481cdd,_0x10365b){_0x481cdd=_0x481cdd-0x0;var _0x2b70a4=_0xb20e[_0x481cdd];return _0x2b70a4;};'use strict';var _=require(_0xeb20('0x0'));var util=require('util');var logger=require(_0xeb20('0x1'))(_0xeb20('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeb20('0x3'));var fs=require('fs');var path=require(_0xeb20('0x4'));var rimraf=require(_0xeb20('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb20('0x6'));module[_0xeb20('0x7')]=function(_0x4a25be,_0x4bc3a8){return _0x4a25be[_0xeb20('0x8')](_0xeb20('0x9'),attributes,{'tableName':_0xeb20('0xa'),'paranoid':![],'indexes':[{'name':_0xeb20('0xb'),'fields':[_0xeb20('0xc'),'to'],'type':_0xeb20('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3fc874,_0x443f9b,_0x5da617){if(_0x3fc874[_0xeb20('0xe')]){_0x3fc874[_0xeb20('0xf')]=moment()['format'](_0xeb20('0x10'));}if(_0x3fc874[_0xeb20('0x11')]){_0x3fc874[_0xeb20('0x12')]=moment()[_0xeb20('0x13')](_0xeb20('0x10'));}_0x5da617(null,_0x443f9b);},'beforeUpdate':function(_0x2b74cb,_0x3e3762,_0x403454){if(_0x2b74cb[_0xeb20('0x14')](_0xeb20('0xe'))){_0x2b74cb[_0xeb20('0xf')]=_0x2b74cb[_0xeb20('0xe')]?moment()[_0xeb20('0x13')](_0xeb20('0x10')):null;}if(_0x2b74cb['changed']('closed')){_0x2b74cb[_0xeb20('0x12')]=moment()[_0xeb20('0x13')](_0xeb20('0x10'));_0x2b74cb[_0xeb20('0xe')]=null;_0x2b74cb[_0xeb20('0xf')]=null;}_0x403454(null,_0x2b74cb);},'afterUpdate':function(_0x350f5e,_0x356efa,_0xafb139){var _0x504f2c=_0x4a25be[_0xeb20('0x15')];var _0x15af12=_0x350f5e['get']({'plain':!![]});if(_0x15af12[_0xeb20('0x11')]){return _0x504f2c[_0xeb20('0x16')][_0xeb20('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x15af12['id']}})[_0xeb20('0x18')](function(){_0xafb139();})[_0xeb20('0x19')](function(_0xc070f2){_0xafb139(_0xc070f2);});}else{_0xafb139();}}},'charset':_0xeb20('0x1a'),'collate':_0xeb20('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 82c5568..cdca20f 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 _0x8f5c=['addTags','body','ids','omit','spread','AddTags','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','limit','AddTagsToMailInteraction'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x8f5c,0x177));var _0xc8f5=function(_0x529f1c,_0x437ed1){_0x529f1c=_0x529f1c-0x0;var _0x4d57ab=_0x8f5c[_0x529f1c];return _0x4d57ab;};'use strict';var _=require(_0xc8f5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8f5('0x1'));var fs=require('fs');var Redis=require(_0xc8f5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f5('0x3'));var logger=require(_0xc8f5('0x4'))(_0xc8f5('0x5'));var config=require(_0xc8f5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc8f5('0x7')][_0xc8f5('0x8')]({'port':0x232a});config[_0xc8f5('0x9')]=_[_0xc8f5('0xa')](config[_0xc8f5('0x9')],{'host':_0xc8f5('0xb'),'port':0x18eb});var socket=require(_0xc8f5('0xc'))(new Redis(config[_0xc8f5('0x9')]));require(_0xc8f5('0xd'))['register'](socket);function respondWithRpcPromise(_0x2d0647,_0x46ddc9,_0x59355c){return new BPromise(function(_0x5b6966,_0x1d8965){return client['request'](_0x2d0647,_0x59355c)[_0xc8f5('0xe')](function(_0x5117dd){logger[_0xc8f5('0xf')](_0xc8f5('0x10'),_0x46ddc9,_0xc8f5('0x11'));logger[_0xc8f5('0x12')](_0xc8f5('0x13'),_0x46ddc9,_0xc8f5('0x11'),JSON[_0xc8f5('0x14')](_0x5117dd));if(_0x5117dd[_0xc8f5('0x15')]){if(_0x5117dd[_0xc8f5('0x15')][_0xc8f5('0x16')]===0x1f4){logger[_0xc8f5('0x15')]('MailInteraction,\x20%s,\x20%s',_0x46ddc9,_0x5117dd['error'][_0xc8f5('0x17')]);return _0x1d8965(_0x5117dd['error']['message']);}logger[_0xc8f5('0x15')](_0xc8f5('0x10'),_0x46ddc9,_0x5117dd[_0xc8f5('0x15')]['message']);return _0x5b6966(_0x5117dd[_0xc8f5('0x15')][_0xc8f5('0x17')]);}else{logger['info'](_0xc8f5('0x10'),_0x46ddc9,_0xc8f5('0x11'));_0x5b6966(_0x5117dd[_0xc8f5('0x18')][_0xc8f5('0x17')]);}})[_0xc8f5('0x19')](function(_0x3a5162){logger[_0xc8f5('0x15')](_0xc8f5('0x10'),_0x46ddc9,_0x3a5162);_0x1d8965(_0x3a5162);});});}exports[_0xc8f5('0x1a')]=function(_0x1cce6f){var _0xab21b7=this;return new Promise(function(_0x3b81d0,_0x12e2bc){return db[_0xc8f5('0x1b')][_0xc8f5('0x1c')](_0x1cce6f['body'],{'raw':_0x1cce6f['options']?_0x1cce6f[_0xc8f5('0x1d')][_0xc8f5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cce6f[_0xc8f5('0x1d')]?_0x1cce6f[_0xc8f5('0x1d')][_0xc8f5('0x1f')]||null:null,'attributes':_0x1cce6f[_0xc8f5('0x1d')]?_0x1cce6f[_0xc8f5('0x1d')][_0xc8f5('0x20')]||null:null,'limit':_0x1cce6f['options']?_0x1cce6f[_0xc8f5('0x1d')][_0xc8f5('0x21')]||null:null})[_0xc8f5('0xe')](function(_0x26b5a3){logger[_0xc8f5('0xf')](_0xc8f5('0x1a'),_0x1cce6f);logger[_0xc8f5('0x12')]('UpdateMailInteraction',_0x1cce6f,JSON[_0xc8f5('0x14')](_0x26b5a3));_0x3b81d0(_0x26b5a3);})[_0xc8f5('0x19')](function(_0x4a7b57){logger[_0xc8f5('0x15')](_0xc8f5('0x1a'),_0x4a7b57[_0xc8f5('0x17')],_0x1cce6f);_0x12e2bc(_0xab21b7[_0xc8f5('0x15')](0x1f4,_0x4a7b57[_0xc8f5('0x17')]));});});};exports[_0xc8f5('0x22')]=function(_0x26084c){return new Promise(function(_0x38b49f,_0x1e3239){return db[_0xc8f5('0x1b')]['find']({'where':_0x26084c[_0xc8f5('0x1d')]?_0x26084c[_0xc8f5('0x1d')]['where']||null:null})[_0xc8f5('0xe')](function(_0x4bbedb){if(_0x4bbedb){return _0x4bbedb[_0xc8f5('0x23')](_0x26084c[_0xc8f5('0x24')][_0xc8f5('0x25')],_[_0xc8f5('0x26')](_0x26084c[_0xc8f5('0x24')],[_0xc8f5('0x25'),'id'])||{});}})[_0xc8f5('0x27')](function(_0x3afd5a){logger[_0xc8f5('0xf')](_0xc8f5('0x28'),_0x26084c);logger[_0xc8f5('0x12')]('AddTags',_0x26084c,JSON['stringify'](_0x3afd5a));_0x38b49f(_0x3afd5a);})[_0xc8f5('0x19')](function(_0x54ac30){logger['error'](_0xc8f5('0x28'),_0x54ac30['message'],_0x26084c);_0x1e3239(_this[_0xc8f5('0x15')](0x1f4,_0x54ac30[_0xc8f5('0x17')]));});});}; \ No newline at end of file +var _0x17ed=['localhost','socket.io-emitter','./mailInteraction.socket','register','request','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','then','stringify','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x24e118,_0x8d841f){var _0x5a149a=function(_0x15ff7a){while(--_0x15ff7a){_0x24e118['push'](_0x24e118['shift']());}};_0x5a149a(++_0x8d841f);}(_0x17ed,0xeb));var _0xd17e=function(_0x477433,_0x2c06b5){_0x477433=_0x477433-0x0;var _0x33191f=_0x17ed[_0x477433];return _0x33191f;};'use strict';var _=require('lodash');var util=require(_0xd17e('0x0'));var moment=require(_0xd17e('0x1'));var BPromise=require(_0xd17e('0x2'));var rs=require(_0xd17e('0x3'));var fs=require('fs');var Redis=require(_0xd17e('0x4'));var db=require(_0xd17e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd17e('0x6'))(_0xd17e('0x7'));var config=require(_0xd17e('0x8'));var jayson=require(_0xd17e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd17e('0xa')]=_['defaults'](config[_0xd17e('0xa')],{'host':_0xd17e('0xb'),'port':0x18eb});var socket=require(_0xd17e('0xc'))(new Redis(config[_0xd17e('0xa')]));require(_0xd17e('0xd'))[_0xd17e('0xe')](socket);function respondWithRpcPromise(_0x4b8813,_0xa89dd8,_0x4b7837){return new BPromise(function(_0x43e49c,_0x155e23){return client[_0xd17e('0xf')](_0x4b8813,_0x4b7837)['then'](function(_0x1447aa){logger[_0xd17e('0x10')]('MailInteraction,\x20%s,\x20%s',_0xa89dd8,_0xd17e('0x11'));logger[_0xd17e('0x12')](_0xd17e('0x13'),_0xa89dd8,'request\x20sent',JSON['stringify'](_0x1447aa));if(_0x1447aa[_0xd17e('0x14')]){if(_0x1447aa['error']['code']===0x1f4){logger['error'](_0xd17e('0x15'),_0xa89dd8,_0x1447aa[_0xd17e('0x14')][_0xd17e('0x16')]);return _0x155e23(_0x1447aa['error'][_0xd17e('0x16')]);}logger[_0xd17e('0x14')](_0xd17e('0x15'),_0xa89dd8,_0x1447aa[_0xd17e('0x14')]['message']);return _0x43e49c(_0x1447aa[_0xd17e('0x14')][_0xd17e('0x16')]);}else{logger[_0xd17e('0x10')]('MailInteraction,\x20%s,\x20%s',_0xa89dd8,_0xd17e('0x11'));_0x43e49c(_0x1447aa[_0xd17e('0x17')][_0xd17e('0x16')]);}})[_0xd17e('0x18')](function(_0x3f3666){logger['error'](_0xd17e('0x15'),_0xa89dd8,_0x3f3666);_0x155e23(_0x3f3666);});});}exports[_0xd17e('0x19')]=function(_0x571eaa){var _0x985eb8=this;return new Promise(function(_0x552a46,_0x24fea2){return db[_0xd17e('0x1a')][_0xd17e('0x1b')](_0x571eaa[_0xd17e('0x1c')],{'raw':_0x571eaa[_0xd17e('0x1d')]?_0x571eaa['options'][_0xd17e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x571eaa[_0xd17e('0x1d')]?_0x571eaa[_0xd17e('0x1d')][_0xd17e('0x1f')]||null:null,'attributes':_0x571eaa[_0xd17e('0x1d')]?_0x571eaa[_0xd17e('0x1d')][_0xd17e('0x20')]||null:null,'limit':_0x571eaa[_0xd17e('0x1d')]?_0x571eaa[_0xd17e('0x1d')]['limit']||null:null})[_0xd17e('0x21')](function(_0xc3897e){logger[_0xd17e('0x10')](_0xd17e('0x19'),_0x571eaa);logger[_0xd17e('0x12')](_0xd17e('0x19'),_0x571eaa,JSON[_0xd17e('0x22')](_0xc3897e));_0x552a46(_0xc3897e);})[_0xd17e('0x18')](function(_0x5c3004){logger['error'](_0xd17e('0x19'),_0x5c3004[_0xd17e('0x16')],_0x571eaa);_0x24fea2(_0x985eb8[_0xd17e('0x14')](0x1f4,_0x5c3004[_0xd17e('0x16')]));});});};exports[_0xd17e('0x23')]=function(_0x412a47){return new Promise(function(_0x26734d,_0x1ebed8){return db['MailInteraction'][_0xd17e('0x24')]({'where':_0x412a47['options']?_0x412a47[_0xd17e('0x1d')]['where']||null:null})[_0xd17e('0x21')](function(_0x1fb181){if(_0x1fb181){return _0x1fb181[_0xd17e('0x25')](_0x412a47[_0xd17e('0x1c')]['ids'],_['omit'](_0x412a47[_0xd17e('0x1c')],[_0xd17e('0x26'),'id'])||{});}})[_0xd17e('0x27')](function(_0x302996){logger['info'](_0xd17e('0x28'),_0x412a47);logger[_0xd17e('0x12')](_0xd17e('0x28'),_0x412a47,JSON[_0xd17e('0x22')](_0x302996));_0x26734d(_0x302996);})[_0xd17e('0x18')](function(_0x1bbccf){logger[_0xd17e('0x14')]('AddTags',_0x1bbccf['message'],_0x412a47);_0x1ebed8(_this[_0xd17e('0x14')](0x1f4,_0x1bbccf[_0xd17e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index a4f5e48..3cba288 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 _0x0c8e=['register','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0xe89b42,_0x2ccbd6){var _0x5e605b=function(_0xffc3fb){while(--_0xffc3fb){_0xe89b42['push'](_0xe89b42['shift']());}};_0x5e605b(++_0x2ccbd6);}(_0x0c8e,0x17a));var _0xe0c8=function(_0x5b5ae7,_0x1e1544){_0x5b5ae7=_0x5b5ae7-0x0;var _0x4b6ac4=_0x0c8e[_0x5b5ae7];return _0x4b6ac4;};'use strict';var MailInteractionEvents=require(_0xe0c8('0x0'));var events=[_0xe0c8('0x1'),_0xe0c8('0x2'),_0xe0c8('0x3')];function createListener(_0x32d5ab,_0x25cb15){return function(_0x4ca398){_0x25cb15[_0xe0c8('0x4')](_0x32d5ab,_0x4ca398);};}function removeListener(_0x2bc746,_0x56ed63){return function(){MailInteractionEvents[_0xe0c8('0x5')](_0x2bc746,_0x56ed63);};}exports[_0xe0c8('0x6')]=function(_0x3aba40){for(var _0x340ddf=0x0,_0x2af9d7=events['length'];_0x340ddf<_0x2af9d7;_0x340ddf++){var _0x549c44=events[_0x340ddf];var _0x18b407=createListener(_0xe0c8('0x7')+_0x549c44,_0x3aba40);MailInteractionEvents['on'](_0x549c44,_0x18b407);}}; \ No newline at end of file +var _0x7a9e=['register','length','remove','update','emit','removeListener'];(function(_0x855981,_0x408ef4){var _0x3bcf44=function(_0x158b1d){while(--_0x158b1d){_0x855981['push'](_0x855981['shift']());}};_0x3bcf44(++_0x408ef4);}(_0x7a9e,0x7a));var _0xe7a9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7a9e[_0x57b54c];return _0x59cc19;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xe7a9('0x0'),_0xe7a9('0x1')];function createListener(_0x5aa819,_0x335c7e){return function(_0x580ba7){_0x335c7e[_0xe7a9('0x2')](_0x5aa819,_0x580ba7);};}function removeListener(_0x135a4a,_0x29bffd){return function(){MailInteractionEvents[_0xe7a9('0x3')](_0x135a4a,_0x29bffd);};}exports[_0xe7a9('0x4')]=function(_0x14376a){for(var _0x4e5240=0x0,_0x449a04=events[_0xe7a9('0x5')];_0x4e5240<_0x449a04;_0x4e5240++){var _0x1355bf=events[_0x4e5240];var _0x374491=createListener('mailInteraction:'+_0x1355bf,_0x14376a);MailInteractionEvents['on'](_0x1355bf,_0x374491);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 3f9dbc3..9a3c4cf 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x289e=['express','Router','./mailInteractionHasTag.controller','get','isAuthenticated','describe'];(function(_0x2d48e4,_0x5e29f0){var _0x2bbd58=function(_0x2433b4){while(--_0x2433b4){_0x2d48e4['push'](_0x2d48e4['shift']());}};_0x2bbd58(++_0x5e29f0);}(_0x289e,0xea));var _0xe289=function(_0x3d5d27,_0x5477ac){_0x3d5d27=_0x3d5d27-0x0;var _0x4dcacc=_0x289e[_0x3d5d27];return _0x4dcacc;};'use strict';var express=require(_0xe289('0x0'));var router=express[_0xe289('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xe289('0x2'));router[_0xe289('0x3')]('/describe',auth[_0xe289('0x4')](),controller[_0xe289('0x5')]);module['exports']=router; \ No newline at end of file +var _0x8a87=['isAuthenticated','describe','express','./mailInteractionHasTag.controller','/describe'];(function(_0x3d9f4b,_0x3ea5f7){var _0x5a26e6=function(_0x4c7f40){while(--_0x4c7f40){_0x3d9f4b['push'](_0x3d9f4b['shift']());}};_0x5a26e6(++_0x3ea5f7);}(_0x8a87,0x6b));var _0x78a8=function(_0x47c53e,_0x35f7f3){_0x47c53e=_0x47c53e-0x0;var _0x306afd=_0x8a87[_0x47c53e];return _0x306afd;};'use strict';var express=require(_0x78a8('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x78a8('0x1'));router['get'](_0x78a8('0x2'),auth[_0x78a8('0x3')](),controller[_0x78a8('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 62a1f5c..ee5496e 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1b4077,_0x3fcfc9){var _0x506e29=function(_0x50daeb){while(--_0x50daeb){_0x1b4077['push'](_0x1b4077['shift']());}};_0x506e29(++_0x3fcfc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x193675,_0x38eb2b){var _0x3e7761=function(_0x4ff923){while(--_0x4ff923){_0x193675['push'](_0x193675['shift']());}};_0x3e7761(++_0x38eb2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 5e2d70a..1f6b5ec 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa565=['sequelize','exports','INTEGER'];(function(_0x27f919,_0xb8d042){var _0x5c90c4=function(_0x2f437e){while(--_0x2f437e){_0x27f919['push'](_0x27f919['shift']());}};_0x5c90c4(++_0xb8d042);}(_0xa565,0x156));var _0x5a56=function(_0x4184d7,_0x31723a){_0x4184d7=_0x4184d7-0x0;var _0x440019=_0xa565[_0x4184d7];return _0x440019;};'use strict';var Sequelize=require(_0x5a56('0x0'));module[_0x5a56('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x5a56('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x0147=['sequelize','INTEGER'];(function(_0x479800,_0xeb9990){var _0x357c80=function(_0x41830d){while(--_0x41830d){_0x479800['push'](_0x479800['shift']());}};_0x357c80(++_0xeb9990);}(_0x0147,0xe6));var _0x7014=function(_0x30bdd9,_0x2167d5){_0x30bdd9=_0x30bdd9-0x0;var _0x274549=_0x0147[_0x30bdd9];return _0x274549;};'use strict';var Sequelize=require(_0x7014('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0x7014('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index ae81f88..28b9ccb 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x541b=['define','mail_interaction_has_tags','./mailInteractionHasTag','exports'];(function(_0x4ed383,_0x5cd212){var _0x135bf3=function(_0x3096e4){while(--_0x3096e4){_0x4ed383['push'](_0x4ed383['shift']());}};_0x135bf3(++_0x5cd212);}(_0x541b,0x166));var _0xb541=function(_0x375f55,_0x2a53ce){_0x375f55=_0x375f55-0x0;var _0x1c0b23=_0x541b[_0x375f55];return _0x1c0b23;};'use strict';var attributes=require(_0xb541('0x0'));module[_0xb541('0x1')]=function(_0x178197){return _0x178197[_0xb541('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0xb541('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3072=['mail_interaction_has_tags','define'];(function(_0x70cb42,_0x1ded0a){var _0x47b99d=function(_0x3248b0){while(--_0x3248b0){_0x70cb42['push'](_0x70cb42['shift']());}};_0x47b99d(++_0x1ded0a);}(_0x3072,0xd1));var _0x2307=function(_0x3a9b38,_0x1a2480){_0x3a9b38=_0x3a9b38-0x0;var _0x2a3269=_0x3072[_0x3a9b38];return _0x2a3269;};'use strict';var attributes=require('./mailInteractionHasTag');module['exports']=function(_0x3ffdca){return _0x3ffdca[_0x2307('0x0')]('MailInteractionHasTag',attributes,{'tableName':_0x2307('0x1'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ff1e7c9..0f1170d 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 _0x462e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','post','tracked','mailmessage:create','create','put','accept','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x495cd3,_0x75132c){var _0xb85bf3=function(_0x2d45cb){while(--_0x2d45cb){_0x495cd3['push'](_0x495cd3['shift']());}};_0xb85bf3(++_0x75132c);}(_0x462e,0x13c));var _0xe462=function(_0x42c8f6,_0x36f7a5){_0x42c8f6=_0x42c8f6-0x0;var _0x38a6fd=_0x462e[_0x42c8f6];return _0x38a6fd;};'use strict';var multer=require(_0xe462('0x0'));var util=require(_0xe462('0x1'));var path=require(_0xe462('0x2'));var timeout=require(_0xe462('0x3'));var express=require(_0xe462('0x4'));var router=express['Router']();var fs_extra=require(_0xe462('0x5'));var auth=require(_0xe462('0x6'));var interaction=require(_0xe462('0x7'));var config=require(_0xe462('0x8'));var controller=require('./mailMessage.controller');router[_0xe462('0x9')]('/',auth[_0xe462('0xa')](),controller[_0xe462('0xb')]);router[_0xe462('0x9')](_0xe462('0xc'),auth['isAuthenticated'](),controller[_0xe462('0xd')]);router[_0xe462('0x9')](_0xe462('0xe'),auth[_0xe462('0xa')](),controller['show']);router[_0xe462('0x9')](_0xe462('0xf'),auth[_0xe462('0xa')](),controller['download']);router[_0xe462('0x10')]('/',auth[_0xe462('0xa')](),interaction[_0xe462('0x11')]('mail',_0xe462('0x12')),controller[_0xe462('0x13')]);router[_0xe462('0x14')]('/:id',auth[_0xe462('0xa')](),controller['update']);router[_0xe462('0x14')]('/:id/accept',auth[_0xe462('0xa')](),controller[_0xe462('0x15')]);router[_0xe462('0x14')]('/:id/reject',auth[_0xe462('0xa')](),controller['reject']);router[_0xe462('0x16')]('/:id',auth[_0xe462('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1752=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x236007,_0x3f90c0){var _0x5e34cb=function(_0x34799e){while(--_0x34799e){_0x236007['push'](_0x236007['shift']());}};_0x5e34cb(++_0x3f90c0);}(_0x1752,0xa5));var _0x2175=function(_0x3bee11,_0x3f2d0a){_0x3bee11=_0x3bee11-0x0;var _0x3b67b=_0x1752[_0x3bee11];return _0x3b67b;};'use strict';var multer=require('multer');var util=require(_0x2175('0x0'));var path=require(_0x2175('0x1'));var timeout=require(_0x2175('0x2'));var express=require(_0x2175('0x3'));var router=express[_0x2175('0x4')]();var fs_extra=require(_0x2175('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var controller=require(_0x2175('0x8'));router[_0x2175('0x9')]('/',auth[_0x2175('0xa')](),controller[_0x2175('0xb')]);router[_0x2175('0x9')](_0x2175('0xc'),auth[_0x2175('0xa')](),controller[_0x2175('0xd')]);router['get'](_0x2175('0xe'),auth[_0x2175('0xa')](),controller[_0x2175('0xf')]);router[_0x2175('0x9')](_0x2175('0x10'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x2175('0xa')](),interaction['tracked']('mail','mailmessage:create'),controller['create']);router[_0x2175('0x11')]('/:id',auth[_0x2175('0xa')](),controller[_0x2175('0x12')]);router['put'](_0x2175('0x13'),auth[_0x2175('0xa')](),controller[_0x2175('0x14')]);router[_0x2175('0x11')](_0x2175('0x15'),auth[_0x2175('0xa')](),controller[_0x2175('0x16')]);router[_0x2175('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x2175('0x18')]);module[_0x2175('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 6cc55bb..36e4fae 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 _0x96fd=['long','BOOLEAN','ENUM','out','STRING','DATE','Email','sequelize','lodash','TEXT'];(function(_0x5c4af1,_0x58cf2e){var _0xecf57d=function(_0x2b4144){while(--_0x2b4144){_0x5c4af1['push'](_0x5c4af1['shift']());}};_0xecf57d(++_0x58cf2e);}(_0x96fd,0x147));var _0xd96f=function(_0xe6259a,_0x2355b3){_0xe6259a=_0xe6259a-0x0;var _0x369a82=_0x96fd[_0xe6259a];return _0x369a82;};'use strict';var Sequelize=require(_0xd96f('0x0'));var _=require(_0xd96f('0x1'));module['exports']={'body':{'type':Sequelize[_0xd96f('0x2')](_0xd96f('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xd96f('0x2')]('medium')},'read':{'type':Sequelize[_0xd96f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd96f('0x5')]('in',_0xd96f('0x6')),'defaultValue':_0xd96f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xd96f('0x7')]},'to':{'type':Sequelize[_0xd96f('0x2')](_0xd96f('0x3'))},'cc':{'type':Sequelize[_0xd96f('0x2')](_0xd96f('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xd96f('0x2')]},'sentAt':{'type':Sequelize[_0xd96f('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd96f('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xd96f('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xd96f('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xd96f('0x3'))},'originChannel':{'type':Sequelize[_0xd96f('0x5')](_0xd96f('0x9'),'Chat'),'defaultValue':_0xd96f('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x3273=['TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','sequelize','lodash','exports'];(function(_0x2bd6d9,_0x2071cb){var _0x4b4929=function(_0x41a57b){while(--_0x41a57b){_0x2bd6d9['push'](_0x2bd6d9['shift']());}};_0x4b4929(++_0x2071cb);}(_0x3273,0xf9));var _0x3327=function(_0x5dfd65,_0x1ad889){_0x5dfd65=_0x5dfd65-0x0;var _0x47f853=_0x3273[_0x5dfd65];return _0x47f853;};'use strict';var Sequelize=require(_0x3327('0x0'));var _=require(_0x3327('0x1'));module[_0x3327('0x2')]={'body':{'type':Sequelize[_0x3327('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3327('0x3')](_0x3327('0x4'))},'read':{'type':Sequelize[_0x3327('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3327('0x6')]('in',_0x3327('0x7')),'defaultValue':_0x3327('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3327('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3327('0x8')]},'to':{'type':Sequelize[_0x3327('0x3')]('long')},'cc':{'type':Sequelize[_0x3327('0x3')](_0x3327('0x9'))},'bcc':{'type':Sequelize['TEXT'](_0x3327('0x9'))},'subject':{'type':Sequelize[_0x3327('0x3')]},'sentAt':{'type':Sequelize[_0x3327('0xa')]},'attach':{'type':Sequelize[_0x3327('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3327('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3327('0xa')]},'originTo':{'type':Sequelize[_0x3327('0x3')](_0x3327('0x9'))},'originCc':{'type':Sequelize[_0x3327('0x3')](_0x3327('0x9'))},'originChannel':{'type':Sequelize[_0x3327('0x6')]('Email','Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index d72afbc..aabdf2d 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 _0x2bfe=['defaults','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','offset','count','limit','set','Content-Range','destroy','sendStatus','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','MailMessage','includeAll','include','findAll','rows','show','params','find','update','body','describe','create','direction','out','secret','split','MailAccount','findOne','List','CmContact','Contacts','updatedAt','DESC','Smtp','CloudProvider','attachments','join','root','server/files/attachments','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','user','agent','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','role','RejectMessage','rejectMessage','sequelize','Sequelize','reject','fromString','rejectmessage','download','unix','server','tmp','message-%s.eml','from','createdAt','Attachment','Attachments','subject','decode','bcc','headers','Bcc','basename','existsSync','push','writeFileSync','unlinkSync','eml-format','util','path','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb'];(function(_0x3bd7c5,_0x272ae9){var _0x423e00=function(_0x474fb5){while(--_0x474fb5){_0x3bd7c5['push'](_0x3bd7c5['shift']());}};_0x423e00(++_0x272ae9);}(_0x2bfe,0x126));var _0xe2bf=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x2bfe[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0xe2bf('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xe2bf('0x1'));var path=require(_0xe2bf('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0xe2bf('0x3'));var qs=require(_0xe2bf('0x4'));var logger=require(_0xe2bf('0x5'))(_0xe2bf('0x6'));var interaction_log=require(_0xe2bf('0x5'))(_0xe2bf('0x7'));var config=require(_0xe2bf('0x8'));var db=require(_0xe2bf('0x9'))['db'];config['redis']=_[_0xe2bf('0xa')](config[_0xe2bf('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe2bf('0xc'))(new Redis(config[_0xe2bf('0xb')]));var htmlEntities=require(_0xe2bf('0xd'));require(_0xe2bf('0xe'))[_0xe2bf('0xf')](socket);var jayson=require(_0xe2bf('0x10'));var client=jayson[_0xe2bf('0x11')][_0xe2bf('0x12')]({'port':0x232c});var client9003=jayson[_0xe2bf('0x11')]['http']({'port':0x232b});var client9002=jayson[_0xe2bf('0x11')][_0xe2bf('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x5c7bba,_0x41f701,_0x7789c2,_0x3cf6b5){return new BPromise(function(_0xbb55b7,_0x4643c7){var _0x30c33d=_0x3cf6b5||client;return _0x30c33d['request'](_0x5c7bba,_0x7789c2)[_0xe2bf('0x13')](function(_0x1a29d2){logger[_0xe2bf('0x14')](_0xe2bf('0x15'),_0x41f701,_0xe2bf('0x16'));logger[_0xe2bf('0x17')](_0xe2bf('0x18'),_0x41f701,_0xe2bf('0x16'),JSON[_0xe2bf('0x19')](_0x1a29d2));if(_0x1a29d2[_0xe2bf('0x1a')]){if(_0x1a29d2['error']['code']===0x1f4){logger[_0xe2bf('0x1a')](_0xe2bf('0x15'),_0x41f701,_0x1a29d2['error']['message']);return _0x4643c7(_0x1a29d2[_0xe2bf('0x1a')][_0xe2bf('0x1b')]);}logger['error'](_0xe2bf('0x15'),_0x41f701,_0x1a29d2[_0xe2bf('0x1a')][_0xe2bf('0x1b')]);return _0xbb55b7(_0x1a29d2[_0xe2bf('0x1a')][_0xe2bf('0x1b')]);}else{logger[_0xe2bf('0x14')](_0xe2bf('0x15'),_0x41f701,_0xe2bf('0x16'));_0xbb55b7(_0x1a29d2[_0xe2bf('0x1c')][_0xe2bf('0x1b')]);}})[_0xe2bf('0x1d')](function(_0x4f8a41){logger['error'](_0xe2bf('0x15'),_0x41f701,_0x4f8a41);_0x4643c7(_0x4f8a41);});});}function respondWithResult(_0x5efe2c,_0x210727){_0x210727=_0x210727||0xc8;return function(_0x631258){if(_0x631258){return _0x5efe2c[_0xe2bf('0x1e')](_0x210727)['json'](_0x631258);}};}function respondWithFilteredResult(_0x351c95,_0x145dc0){return function(_0x1cd5c5){if(_0x1cd5c5){var _0x2b2193=typeof _0x145dc0[_0xe2bf('0x1f')]==='undefined'&&typeof _0x145dc0['limit']==='undefined';var _0x2d792f=_0x1cd5c5[_0xe2bf('0x20')];var _0x51f06b=_0x2b2193?0x0:_0x145dc0[_0xe2bf('0x1f')];var _0xda2e0a=_0x2b2193?_0x1cd5c5['count']:_0x145dc0[_0xe2bf('0x1f')]+_0x145dc0[_0xe2bf('0x21')];var _0x2e1a99;if(_0xda2e0a>=_0x2d792f){_0xda2e0a=_0x2d792f;_0x2e1a99=0xc8;}else{_0x2e1a99=0xce;}_0x351c95['status'](_0x2e1a99);return _0x351c95[_0xe2bf('0x22')](_0xe2bf('0x23'),_0x51f06b+'-'+_0xda2e0a+'/'+_0x2d792f)['json'](_0x1cd5c5);}return null;};}function saveUpdates(_0xb4accc){return function(_0x524f23){if(_0x524f23){return _0x524f23['update'](_0xb4accc)[_0xe2bf('0x13')](function(_0x445225){return _0x445225;});}return null;};}function removeEntity(_0xa34feb){return function(_0x2fcf4d){if(_0x2fcf4d){return _0x2fcf4d[_0xe2bf('0x24')]()[_0xe2bf('0x13')](function(){_0xa34feb[_0xe2bf('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53da39){return function(_0x4db6c2){if(!_0x4db6c2){_0x53da39[_0xe2bf('0x25')](0x194);}return _0x4db6c2;};}function handleError(_0x3ad23c,_0x6f14e9){_0x6f14e9=_0x6f14e9||0x1f4;return function(_0x3fe206){logger['error'](_0x3fe206['stack']);if(_0x3fe206['name']){delete _0x3fe206[_0xe2bf('0x26')];}_0x3ad23c[_0xe2bf('0x1e')](_0x6f14e9)['send'](_0x3fe206);};}exports[_0xe2bf('0x27')]=function(_0x455eeb,_0x462da1){var _0x1f05bc={},_0x5544c2={},_0x1a44ea={'count':0x0,'rows':[]};var _0x40c0c6=_[_0xe2bf('0x28')](db['MailMessage'][_0xe2bf('0x29')],function(_0x38d7b5){return{'name':_0x38d7b5[_0xe2bf('0x2a')],'type':_0x38d7b5[_0xe2bf('0x2b')][_0xe2bf('0x2c')]};});_0x5544c2['model']=_[_0xe2bf('0x28')](_0x40c0c6,_0xe2bf('0x26'));_0x5544c2[_0xe2bf('0x2d')]=_[_0xe2bf('0x2e')](_0x455eeb[_0xe2bf('0x2d')]);_0x5544c2[_0xe2bf('0x2f')]=_[_0xe2bf('0x30')](_0x5544c2[_0xe2bf('0x31')],_0x5544c2[_0xe2bf('0x2d')]);_0x1f05bc['attributes']=_['intersection'](_0x5544c2[_0xe2bf('0x31')],qs[_0xe2bf('0x32')](_0x455eeb[_0xe2bf('0x2d')]['fields']));_0x1f05bc[_0xe2bf('0x33')]=_0x1f05bc[_0xe2bf('0x33')][_0xe2bf('0x34')]?_0x1f05bc[_0xe2bf('0x33')]:_0x5544c2[_0xe2bf('0x31')];if(!_0x455eeb[_0xe2bf('0x2d')][_0xe2bf('0x35')](_0xe2bf('0x36'))){_0x1f05bc[_0xe2bf('0x21')]=qs[_0xe2bf('0x21')](_0x455eeb[_0xe2bf('0x2d')]['limit']);_0x1f05bc[_0xe2bf('0x1f')]=qs['offset'](_0x455eeb[_0xe2bf('0x2d')]['offset']);}_0x1f05bc[_0xe2bf('0x37')]=qs[_0xe2bf('0x38')](_0x455eeb[_0xe2bf('0x2d')][_0xe2bf('0x38')]);_0x1f05bc[_0xe2bf('0x39')]=qs[_0xe2bf('0x2f')](_['pick'](_0x455eeb[_0xe2bf('0x2d')],_0x5544c2[_0xe2bf('0x2f')]),_0x40c0c6);if(_0x455eeb[_0xe2bf('0x2d')]['filter']){_0x1f05bc[_0xe2bf('0x39')]=_[_0xe2bf('0x3a')](_0x1f05bc[_0xe2bf('0x39')],{'$or':_[_0xe2bf('0x28')](_0x40c0c6,function(_0x3404e0){if(_0x3404e0[_0xe2bf('0x2b')]!==_0xe2bf('0x3b')){var _0x5aff9f={};_0x5aff9f[_0x3404e0[_0xe2bf('0x26')]]={'$like':'%'+_0x455eeb[_0xe2bf('0x2d')]['filter']+'%'};return _0x5aff9f;}})});}_0x1f05bc=_[_0xe2bf('0x3a')]({},_0x1f05bc,_0x455eeb['options']);var _0x26fdf7={'where':_0x1f05bc[_0xe2bf('0x39')]};return db[_0xe2bf('0x3c')][_0xe2bf('0x20')](_0x26fdf7)[_0xe2bf('0x13')](function(_0x55d474){_0x1a44ea[_0xe2bf('0x20')]=_0x55d474;if(_0x455eeb[_0xe2bf('0x2d')][_0xe2bf('0x3d')]){_0x1f05bc[_0xe2bf('0x3e')]=[{'all':!![]}];}return db['MailMessage'][_0xe2bf('0x3f')](_0x1f05bc);})['then'](function(_0x5c2c61){_0x1a44ea[_0xe2bf('0x40')]=_0x5c2c61;return _0x1a44ea;})[_0xe2bf('0x13')](respondWithFilteredResult(_0x462da1,_0x1f05bc))[_0xe2bf('0x1d')](handleError(_0x462da1,null));};exports[_0xe2bf('0x41')]=function(_0x2278a8,_0x130dbd){var _0x4a4366={'raw':!![],'where':{'id':_0x2278a8[_0xe2bf('0x42')]['id']}},_0x2c167a={};_0x2c167a['model']=_[_0xe2bf('0x2e')](db['MailMessage']['rawAttributes']);_0x2c167a[_0xe2bf('0x2d')]=_[_0xe2bf('0x2e')](_0x2278a8[_0xe2bf('0x2d')]);_0x2c167a[_0xe2bf('0x2f')]=_[_0xe2bf('0x30')](_0x2c167a[_0xe2bf('0x31')],_0x2c167a['query']);_0x4a4366[_0xe2bf('0x33')]=_[_0xe2bf('0x30')](_0x2c167a['model'],qs[_0xe2bf('0x32')](_0x2278a8[_0xe2bf('0x2d')][_0xe2bf('0x32')]));_0x4a4366[_0xe2bf('0x33')]=_0x4a4366['attributes'][_0xe2bf('0x34')]?_0x4a4366[_0xe2bf('0x33')]:_0x2c167a[_0xe2bf('0x31')];if(_0x2278a8['query'][_0xe2bf('0x3d')]){_0x4a4366[_0xe2bf('0x3e')]=[{'all':!![]}];}_0x4a4366=_['merge']({},_0x4a4366,_0x2278a8['options']);return db[_0xe2bf('0x3c')][_0xe2bf('0x43')](_0x4a4366)[_0xe2bf('0x13')](handleEntityNotFound(_0x130dbd,null))['then'](respondWithResult(_0x130dbd,null))['catch'](handleError(_0x130dbd,null));};exports[_0xe2bf('0x44')]=function(_0x411797,_0x48de12){if(_0x411797['body']['id']){delete _0x411797[_0xe2bf('0x45')]['id'];}return db[_0xe2bf('0x3c')]['find']({'where':{'id':_0x411797[_0xe2bf('0x42')]['id']}})[_0xe2bf('0x13')](handleEntityNotFound(_0x48de12,null))[_0xe2bf('0x13')](saveUpdates(_0x411797[_0xe2bf('0x45')],null))[_0xe2bf('0x13')](respondWithResult(_0x48de12,null))[_0xe2bf('0x1d')](handleError(_0x48de12,null));};exports[_0xe2bf('0x24')]=function(_0x1e795f,_0x3f6565){return db[_0xe2bf('0x3c')][_0xe2bf('0x43')]({'where':{'id':_0x1e795f[_0xe2bf('0x42')]['id']}})[_0xe2bf('0x13')](handleEntityNotFound(_0x3f6565,null))[_0xe2bf('0x13')](removeEntity(_0x3f6565,null))['catch'](handleError(_0x3f6565,null));};exports[_0xe2bf('0x46')]=function(_0x4faf23,_0x9db285){return db['MailMessage']['describe']()[_0xe2bf('0x13')](respondWithResult(_0x9db285,null))[_0xe2bf('0x1d')](handleError(_0x9db285,null));};exports[_0xe2bf('0x47')]=function(_0x2ff2ad,_0x50592a){return db['MailMessage'][_0xe2bf('0x47')](_0x2ff2ad['body'])[_0xe2bf('0x13')](function(_0x16a866){if(_0x16a866){if(_0x16a866[_0xe2bf('0x48')]===_0xe2bf('0x49')&&!_0x16a866[_0xe2bf('0x4a')]){var _0x19b520,_0x8dafe1,_0x5913a0;if(_0x2ff2ad[_0xe2bf('0x45')]['to']){_0x8dafe1=_0x2ff2ad[_0xe2bf('0x45')]['to'][_0xe2bf('0x4b')](',')[0x0];}return db[_0xe2bf('0x4c')][_0xe2bf('0x4d')]({'where':{'id':_0x16a866['MailAccountId']},'include':[{'model':db['CmList'],'as':_0xe2bf('0x4e'),'include':[{'model':db[_0xe2bf('0x4f')],'as':_0xe2bf('0x50'),'where':{'email':_0x8dafe1},'limit':0x1,'order':[[_0xe2bf('0x51'),_0xe2bf('0x52')]]}]},{'model':db['MailServerOut'],'as':_0xe2bf('0x53'),'raw':!![],'include':[{'model':db[_0xe2bf('0x54')],'as':_0xe2bf('0x54'),'raw':!![]}]}]})[_0xe2bf('0x13')](function(_0x11b2f0){_0x19b520=_0x11b2f0;if(!_0x19b520||!_0x19b520[_0xe2bf('0x53')])return;var _0x5f58fb=_0x19b520['getSmtpOptions']();if(_0x2ff2ad[_0xe2bf('0x45')]['attachments']&&_0x2ff2ad[_0xe2bf('0x45')][_0xe2bf('0x55')][_0xe2bf('0x34')]){for(var _0x4b7b4a=0x0;_0x4b7b4a<_0x2ff2ad[_0xe2bf('0x45')][_0xe2bf('0x55')][_0xe2bf('0x34')];_0x4b7b4a+=0x1){_0x2ff2ad[_0xe2bf('0x45')][_0xe2bf('0x55')][_0x4b7b4a]={'filename':_0x2ff2ad['body'][_0xe2bf('0x55')][_0x4b7b4a][_0xe2bf('0x26')],'path':path[_0xe2bf('0x56')](config[_0xe2bf('0x57')],_0xe2bf('0x58'),_0x2ff2ad[_0xe2bf('0x45')][_0xe2bf('0x55')][_0x4b7b4a]['basename'])};}}_0x5913a0={'account':_0x5f58fb,'message':_0x2ff2ad['body']};return;})[_0xe2bf('0x13')](function(){if(_0x19b520[_0xe2bf('0x4e')]){if(_0x19b520[_0xe2bf('0x4e')][_0xe2bf('0x50')][_0xe2bf('0x34')]){return _0x19b520['List'][_0xe2bf('0x50')][0x0];}else{return db[_0xe2bf('0x4f')][_0xe2bf('0x47')](_['defaults'](_0x2ff2ad[_0xe2bf('0x45')],{'firstName':_0x2ff2ad[_0xe2bf('0x45')]['to'],'email':_0x2ff2ad[_0xe2bf('0x45')]['to'],'phone':_0x2ff2ad['body']['to'],'ListId':_0x19b520[_0xe2bf('0x59')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xe2bf('0x13')](function(){if(_0x5913a0){return respondWithRpcPromise(_0xe2bf('0x5a'),_0xe2bf('0x5b'),_0x5913a0,client9003)[_0xe2bf('0x13')](function(_0x49f911){return _0x16a866[_0xe2bf('0x44')]({'read':!![],'messageId':_0x49f911[_0xe2bf('0x5c')],'sentAt':moment()[_0xe2bf('0x5d')](_0xe2bf('0x5e'))});})['catch'](function(_0x29dca3){logger['error']('%s',JSON[_0xe2bf('0x19')](_0x29dca3));return _0x16a866;});}return _0x16a866;});}return _0x16a866;}})[_0xe2bf('0x13')](respondWithResult(_0x50592a,0xc9))['catch'](handleError(_0x50592a,null));};exports[_0xe2bf('0x5f')]=function(_0x3b92e6,_0x5095a1){var _0x13e8ec={'agent':{},'channel':_0xe2bf('0x60')};if(_0x3b92e6[_0xe2bf('0x45')]['id']){delete _0x3b92e6[_0xe2bf('0x45')]['id'];}_0x3b92e6[_0xe2bf('0x45')][_0xe2bf('0x61')]=!![];_0x3b92e6[_0xe2bf('0x45')]['readAt']=moment()[_0xe2bf('0x5d')](_0xe2bf('0x5e'));_0x3b92e6[_0xe2bf('0x45')]['UserId']=_0x3b92e6[_0xe2bf('0x45')][_0xe2bf('0x62')]||_0x3b92e6[_0xe2bf('0x63')]['id'];_0x13e8ec[_0xe2bf('0x64')]['id']=_0x3b92e6[_0xe2bf('0x45')][_0xe2bf('0x62')];return db[_0xe2bf('0x3c')][_0xe2bf('0x43')]({'where':{'id':_0x3b92e6[_0xe2bf('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5095a1,null))[_0xe2bf('0x13')](saveUpdates(_0x3b92e6[_0xe2bf('0x45')],null))['then'](function(_0x387dba){if(_0x387dba){_0x13e8ec[_0xe2bf('0x1b')]=_0x387dba['get']({'plain':!![]});return db[_0xe2bf('0x65')][_0xe2bf('0x43')]({'where':{'id':_0x387dba[_0xe2bf('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x5095a1,null))[_0xe2bf('0x13')](function(_0x128698){if(_0x128698){return _0x128698[_0xe2bf('0x44')]({'UserId':_0x3b92e6[_0xe2bf('0x45')][_0xe2bf('0x62')],'read1stAt':_[_0xe2bf('0x67')](_0x128698[_0xe2bf('0x68')])?moment()['format'](_0xe2bf('0x5e')):undefined});}return null;})[_0xe2bf('0x13')](function(_0x14004d){if(_0x14004d){_0x13e8ec[_0xe2bf('0x69')]=_0x14004d[_0xe2bf('0x6a')]({'plain':!![]});interaction_log[_0xe2bf('0x14')](_0xe2bf('0x6b'),_0x3b92e6[_0xe2bf('0x63')]['id'],_0x3b92e6[_0xe2bf('0x63')][_0xe2bf('0x26')],_0x3b92e6[_0xe2bf('0x63')]['role'],_0x13e8ec[_0xe2bf('0x69')]['id'],_0x3b92e6[_0xe2bf('0x45')]?JSON[_0xe2bf('0x19')](_0x3b92e6[_0xe2bf('0x45')]):'null');return respondWithRpcPromise('AcceptMessage',_0xe2bf('0x6c'),_0x13e8ec);}return null;})[_0xe2bf('0x13')](function(_0x1c9fbb){var _0x194590=_0xe2bf('0x6d')+_0x1c9fbb[_0xe2bf('0x1b')][_0xe2bf('0x6e')];return db['sequelize']['query'](_0x194590,{'type':db['Sequelize'][_0xe2bf('0x6f')][_0xe2bf('0x70')],'raw':!![]})[_0xe2bf('0x13')](function(_0x4b4811){return _0x4b4811;});})[_0xe2bf('0x13')](function(_0x51ef58){if(_0x51ef58){_0x13e8ec['message'][_0xe2bf('0x71')]=_0x51ef58[0x0];if(!_0x3b92e6[_0xe2bf('0x45')]['UserId'])return;return db[_0xe2bf('0x72')][_0xe2bf('0x43')]({'where':{'id':_0x3b92e6[_0xe2bf('0x45')]['UserId'],'role':'agent'},'attributes':['id','name','fullname',_0xe2bf('0x73'),_0xe2bf('0x74')],'raw':!![]});}return null;})[_0xe2bf('0x13')](function(_0x314a33){if(!_0x314a33)return null;_0x13e8ec[_0xe2bf('0x1b')]['agent']=_0x314a33;return _0x13e8ec;})[_0xe2bf('0x13')](function(_0x5aa385){if(_0x5aa385){if(_0x3b92e6[_0xe2bf('0x45')][_0xe2bf('0x75')]){_0x13e8ec['message'][_0xe2bf('0x76')]=util[_0xe2bf('0x5d')](_0xe2bf('0x77'),_0x3b92e6[_0xe2bf('0x63')][_0xe2bf('0x26')]);_0x13e8ec['message'][_0xe2bf('0x78')]=_0x13e8ec[_0xe2bf('0x78')];_0x13e8ec['message'][_0xe2bf('0x79')]=_0x13e8ec[_0xe2bf('0x78')];_0x13e8ec[_0xe2bf('0x1b')][_0xe2bf('0x7a')]=_0xe2bf('0x5f');_0x13e8ec[_0xe2bf('0x1b')]['body']=htmlToText['fromString'](_0x13e8ec[_0xe2bf('0x1b')][_0xe2bf('0x45')]);return respondWithRpcPromise(_0xe2bf('0x7b'),'EventManager',{'event':_0xe2bf('0x7c'),'message':_0x13e8ec[_0xe2bf('0x1b')]},client9002)[_0xe2bf('0x13')](function(){return _0x13e8ec;});}return _0x13e8ec;}return null;})[_0xe2bf('0x13')](respondWithResult(_0x5095a1,null))[_0xe2bf('0x1d')](handleError(_0x5095a1,null));};exports['reject']=function(_0x2dd329,_0x40df20){var _0x5e5c6d={'agent':{},'channel':'mail'};if(_0x2dd329[_0xe2bf('0x45')]['id']){delete _0x2dd329[_0xe2bf('0x45')]['id'];}_0x2dd329[_0xe2bf('0x45')][_0xe2bf('0x62')]=_0x2dd329[_0xe2bf('0x45')]['UserId']||_0x2dd329[_0xe2bf('0x63')]['id'];_0x5e5c6d[_0xe2bf('0x64')]['id']=_0x2dd329[_0xe2bf('0x45')]['UserId'];return db[_0xe2bf('0x3c')][_0xe2bf('0x43')]({'where':{'id':_0x2dd329[_0xe2bf('0x42')]['id'],'UserId':null}})[_0xe2bf('0x13')](handleEntityNotFound(_0x40df20,null))[_0xe2bf('0x13')](function(_0x5a01c6){if(_0x5a01c6){_0x5e5c6d[_0xe2bf('0x1b')]=_0x5a01c6[_0xe2bf('0x6a')]({'plain':!![]});return db['MailInteraction'][_0xe2bf('0x43')]({'where':{'id':_0x5a01c6['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x40df20,null))['then'](function(_0x327ccb){if(_0x327ccb){_0x5e5c6d[_0xe2bf('0x69')]=_0x327ccb[_0xe2bf('0x6a')]({'plain':!![]});interaction_log[_0xe2bf('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2dd329[_0xe2bf('0x63')]['id'],_0x2dd329[_0xe2bf('0x63')][_0xe2bf('0x26')],_0x2dd329[_0xe2bf('0x63')][_0xe2bf('0x7d')],_0x5e5c6d[_0xe2bf('0x69')]['id'],_0x2dd329[_0xe2bf('0x45')]?JSON[_0xe2bf('0x19')](_0x2dd329[_0xe2bf('0x45')]):'null');return respondWithRpcPromise(_0xe2bf('0x7e'),_0xe2bf('0x7f'),_0x5e5c6d);}return null;})[_0xe2bf('0x13')](function(_0x45bceb){var _0x293de9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x45bceb[_0xe2bf('0x1b')]['ContactId'];return db[_0xe2bf('0x80')]['query'](_0x293de9,{'type':db[_0xe2bf('0x81')][_0xe2bf('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x3a1fae){return _0x3a1fae;});})[_0xe2bf('0x13')](function(_0x4b624e){if(_0x4b624e){_0x5e5c6d[_0xe2bf('0x1b')][_0xe2bf('0x71')]=_0x4b624e[0x0];if(!_0x2dd329[_0xe2bf('0x45')]['UserId'])return;return db[_0xe2bf('0x72')][_0xe2bf('0x43')]({'where':{'id':_0x2dd329[_0xe2bf('0x45')][_0xe2bf('0x62')],'role':_0xe2bf('0x64')},'attributes':['id',_0xe2bf('0x26'),'fullname',_0xe2bf('0x73'),_0xe2bf('0x74')],'raw':!![]});}return null;})[_0xe2bf('0x13')](function(_0x109eb8){if(!_0x109eb8)return null;_0x5e5c6d[_0xe2bf('0x1b')][_0xe2bf('0x64')]=_0x109eb8;return _0x5e5c6d;})['then'](function(_0x5ab87d){if(_0x5ab87d){_0x5ab87d[_0xe2bf('0x1b')][_0xe2bf('0x76')]=util[_0xe2bf('0x5d')](_0xe2bf('0x77'),_0x2dd329['user'][_0xe2bf('0x26')]);_0x5ab87d[_0xe2bf('0x1b')][_0xe2bf('0x78')]=_0x5e5c6d['channel'];_0x5ab87d[_0xe2bf('0x1b')]['motionChannel']=_0x5e5c6d[_0xe2bf('0x78')];_0x5ab87d[_0xe2bf('0x1b')][_0xe2bf('0x7a')]=_0xe2bf('0x82');_0x5ab87d[_0xe2bf('0x1b')]['body']=htmlToText[_0xe2bf('0x83')](_0x5e5c6d[_0xe2bf('0x1b')][_0xe2bf('0x45')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xe2bf('0x84'),'message':_0x5ab87d['message']},client9002);return _0x5e5c6d;}return null;})['then'](respondWithResult(_0x40df20,null))[_0xe2bf('0x1d')](handleError(_0x40df20,null));};exports[_0xe2bf('0x85')]=function(_0x225a0b,_0x38eb56){var _0x52eb4c=moment()[_0xe2bf('0x86')]()['toString']();var _0x44d87d=path['join'](config['root'],_0xe2bf('0x87'),'files',_0xe2bf('0x88'));var _0x5436ce=path[_0xe2bf('0x56')](config[_0xe2bf('0x57')],'server','files',_0xe2bf('0x55'));var _0x14593b=util['format'](_0xe2bf('0x89'),_0x52eb4c);return db[_0xe2bf('0x3c')][_0xe2bf('0x43')]({'where':{'id':_0x225a0b[_0xe2bf('0x42')]['id']},'attributes':['id',_0xe2bf('0x45'),_0xe2bf('0x8a'),'to','cc','bcc','subject',_0xe2bf('0x8b')],'include':_0x225a0b[_0xe2bf('0x2d')][_0xe2bf('0x55')]?[{'model':db[_0xe2bf('0x8c')],'as':_0xe2bf('0x8d')}]:undefined})[_0xe2bf('0x13')](handleEntityNotFound(_0x38eb56,null))[_0xe2bf('0x13')](function(_0x61be83){if(_0x61be83){var _0x263c1b=_0x61be83;var _0x9974c4={'from':_0x263c1b[_0xe2bf('0x8a')],'to':_0x263c1b['to'],'subject':_0x263c1b[_0xe2bf('0x8e')],'html':htmlEntities[_0xe2bf('0x8f')](_0x263c1b[_0xe2bf('0x45')]),'headers':{'Date':moment(_0x263c1b[_0xe2bf('0x8b')])[_0xe2bf('0x5d')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x61be83['cc']){_0x9974c4['headers']['Cc']=_0x61be83['cc'];}if(_0x61be83[_0xe2bf('0x90')]){_0x9974c4[_0xe2bf('0x91')][_0xe2bf('0x92')]=_0x61be83[_0xe2bf('0x90')];}return new BPromise(function(_0x2c678b,_0x4f0f68){if(_0x61be83[_0xe2bf('0x8d')]){for(var _0x2e8e5f=0x0;_0x2e8e5f<_0x61be83[_0xe2bf('0x8d')][_0xe2bf('0x34')];_0x2e8e5f++){var _0x4ed849=_0x61be83[_0xe2bf('0x8d')][_0x2e8e5f];var _0x54b74a=path[_0xe2bf('0x56')](_0x5436ce,_0x4ed849[_0xe2bf('0x93')]);if(fs[_0xe2bf('0x94')](_0x54b74a)){_0x9974c4['attachments'][_0xe2bf('0x95')]({'name':_0x4ed849[_0xe2bf('0x26')],'contentType':_0x4ed849[_0xe2bf('0x2b')],'data':fs['readFileSync'](_0x54b74a)});}}}emlformat['build'](_0x9974c4,function(_0x35e925,_0x415114){if(_0x35e925)return _0x4f0f68(_0x35e925);fs[_0xe2bf('0x96')](path['join'](_0x44d87d,_0x14593b),_0x415114);return _0x2c678b(_0x415114);});});}})[_0xe2bf('0x13')](function(_0x1b01f4){if(_0x1b01f4){return _0x38eb56[_0xe2bf('0x85')](path['join'](_0x44d87d,_0x14593b),_0x14593b,function(_0x15bc77){if(!_0x15bc77)fs[_0xe2bf('0x97')](path['join'](_0x44d87d,_0x14593b));});}})['catch'](handleError(_0x38eb56,null));}; \ No newline at end of file +var _0x47fa=['acceptmessage','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','QueryTypes','contact','reject','EventManager','rejectmessage','download','unix','toString','files','tmp','root','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','util','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','register','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','undefined','limit','count','offset','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','length','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','updatedAt','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','Contacts','defaults','List\x20not\x20found','SendMail','sendMail','messageId','accept','read','format','UserId','user','agent','get','MailInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0x47fa,0xba));var _0xa47f=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0x47fa[_0x59616b];return _0x5c4523;};'use strict';var emlformat=require(_0xa47f('0x0'));var moment=require(_0xa47f('0x1'));var BPromise=require(_0xa47f('0x2'));var util=require(_0xa47f('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require(_0xa47f('0x4'));var htmlToText=require(_0xa47f('0x5'));var qs=require(_0xa47f('0x6'));var logger=require(_0xa47f('0x7'))(_0xa47f('0x8'));var interaction_log=require('../../config/logger')(_0xa47f('0x9'));var config=require('../../config/environment');var db=require(_0xa47f('0xa'))['db'];config['redis']=_['defaults'](config[_0xa47f('0xb')],{'host':_0xa47f('0xc'),'port':0x18eb});var socket=require(_0xa47f('0xd'))(new Redis(config[_0xa47f('0xb')]));var htmlEntities=require(_0xa47f('0xe'));require('./mailMessage.socket')[_0xa47f('0xf')](socket);var jayson=require(_0xa47f('0x10'));var client=jayson['client'][_0xa47f('0x11')]({'port':0x232c});var client9003=jayson['client'][_0xa47f('0x11')]({'port':0x232b});var client9002=jayson[_0xa47f('0x12')][_0xa47f('0x11')]({'port':0x232a});function respondWithRpcPromise(_0xe6dff5,_0x5dfc3c,_0xf98780,_0x26fdd1){return new BPromise(function(_0x3bc2d5,_0x57c128){var _0x2da381=_0x26fdd1||client;return _0x2da381[_0xa47f('0x13')](_0xe6dff5,_0xf98780)[_0xa47f('0x14')](function(_0x341bf6){logger[_0xa47f('0x15')](_0xa47f('0x16'),_0x5dfc3c,_0xa47f('0x17'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x5dfc3c,_0xa47f('0x17'),JSON[_0xa47f('0x18')](_0x341bf6));if(_0x341bf6[_0xa47f('0x19')]){if(_0x341bf6[_0xa47f('0x19')][_0xa47f('0x1a')]===0x1f4){logger[_0xa47f('0x19')](_0xa47f('0x16'),_0x5dfc3c,_0x341bf6['error'][_0xa47f('0x1b')]);return _0x57c128(_0x341bf6[_0xa47f('0x19')][_0xa47f('0x1b')]);}logger[_0xa47f('0x19')](_0xa47f('0x16'),_0x5dfc3c,_0x341bf6[_0xa47f('0x19')][_0xa47f('0x1b')]);return _0x3bc2d5(_0x341bf6[_0xa47f('0x19')]['message']);}else{logger['info'](_0xa47f('0x16'),_0x5dfc3c,_0xa47f('0x17'));_0x3bc2d5(_0x341bf6[_0xa47f('0x1c')][_0xa47f('0x1b')]);}})[_0xa47f('0x1d')](function(_0x232037){logger[_0xa47f('0x19')]('MailMessage,\x20%s,\x20%s',_0x5dfc3c,_0x232037);_0x57c128(_0x232037);});});}function respondWithResult(_0x4e5b1e,_0x4026cf){_0x4026cf=_0x4026cf||0xc8;return function(_0x4923d5){if(_0x4923d5){return _0x4e5b1e[_0xa47f('0x1e')](_0x4026cf)['json'](_0x4923d5);}};}function respondWithFilteredResult(_0x284b8c,_0x1351d8){return function(_0x459531){if(_0x459531){var _0xf5285d=typeof _0x1351d8['offset']===_0xa47f('0x1f')&&typeof _0x1351d8[_0xa47f('0x20')]==='undefined';var _0x26cf89=_0x459531[_0xa47f('0x21')];var _0x439fec=_0xf5285d?0x0:_0x1351d8[_0xa47f('0x22')];var _0x3d93c4=_0xf5285d?_0x459531[_0xa47f('0x21')]:_0x1351d8[_0xa47f('0x22')]+_0x1351d8[_0xa47f('0x20')];var _0x4943f1;if(_0x3d93c4>=_0x26cf89){_0x3d93c4=_0x26cf89;_0x4943f1=0xc8;}else{_0x4943f1=0xce;}_0x284b8c[_0xa47f('0x1e')](_0x4943f1);return _0x284b8c['set']('Content-Range',_0x439fec+'-'+_0x3d93c4+'/'+_0x26cf89)['json'](_0x459531);}return null;};}function saveUpdates(_0x3720c2){return function(_0x1d951b){if(_0x1d951b){return _0x1d951b[_0xa47f('0x23')](_0x3720c2)[_0xa47f('0x14')](function(_0x402c30){return _0x402c30;});}return null;};}function removeEntity(_0x1e5912){return function(_0x1499f1){if(_0x1499f1){return _0x1499f1[_0xa47f('0x24')]()[_0xa47f('0x14')](function(){_0x1e5912['status'](0xcc)[_0xa47f('0x25')]();});}};}function handleEntityNotFound(_0x1d37c4){return function(_0x59e8cb){if(!_0x59e8cb){_0x1d37c4[_0xa47f('0x26')](0x194);}return _0x59e8cb;};}function handleError(_0x55d909,_0xc854f){_0xc854f=_0xc854f||0x1f4;return function(_0x3d38ff){logger[_0xa47f('0x19')](_0x3d38ff[_0xa47f('0x27')]);if(_0x3d38ff[_0xa47f('0x28')]){delete _0x3d38ff[_0xa47f('0x28')];}_0x55d909[_0xa47f('0x1e')](_0xc854f)[_0xa47f('0x29')](_0x3d38ff);};}exports[_0xa47f('0x2a')]=function(_0x2ee442,_0x595c5d){var _0x57eeaf={},_0x3c772d={},_0x24d723={'count':0x0,'rows':[]};var _0x27de41=_[_0xa47f('0x2b')](db[_0xa47f('0x2c')]['rawAttributes'],function(_0x438ae3){return{'name':_0x438ae3[_0xa47f('0x2d')],'type':_0x438ae3[_0xa47f('0x2e')]['key']};});_0x3c772d[_0xa47f('0x2f')]=_['map'](_0x27de41,_0xa47f('0x28'));_0x3c772d['query']=_[_0xa47f('0x30')](_0x2ee442['query']);_0x3c772d[_0xa47f('0x31')]=_[_0xa47f('0x32')](_0x3c772d[_0xa47f('0x2f')],_0x3c772d[_0xa47f('0x33')]);_0x57eeaf[_0xa47f('0x34')]=_[_0xa47f('0x32')](_0x3c772d['model'],qs[_0xa47f('0x35')](_0x2ee442[_0xa47f('0x33')]['fields']));_0x57eeaf[_0xa47f('0x34')]=_0x57eeaf[_0xa47f('0x34')]['length']?_0x57eeaf[_0xa47f('0x34')]:_0x3c772d[_0xa47f('0x2f')];if(!_0x2ee442[_0xa47f('0x33')][_0xa47f('0x36')]('nolimit')){_0x57eeaf[_0xa47f('0x20')]=qs['limit'](_0x2ee442[_0xa47f('0x33')]['limit']);_0x57eeaf[_0xa47f('0x22')]=qs['offset'](_0x2ee442['query'][_0xa47f('0x22')]);}_0x57eeaf[_0xa47f('0x37')]=qs[_0xa47f('0x38')](_0x2ee442[_0xa47f('0x33')]['sort']);_0x57eeaf[_0xa47f('0x39')]=qs['filters'](_['pick'](_0x2ee442[_0xa47f('0x33')],_0x3c772d['filters']),_0x27de41);if(_0x2ee442[_0xa47f('0x33')][_0xa47f('0x3a')]){_0x57eeaf['where']=_[_0xa47f('0x3b')](_0x57eeaf[_0xa47f('0x39')],{'$or':_[_0xa47f('0x2b')](_0x27de41,function(_0x3baaa8){if(_0x3baaa8[_0xa47f('0x2e')]!==_0xa47f('0x3c')){var _0x411995={};_0x411995[_0x3baaa8[_0xa47f('0x28')]]={'$like':'%'+_0x2ee442[_0xa47f('0x33')][_0xa47f('0x3a')]+'%'};return _0x411995;}})});}_0x57eeaf=_[_0xa47f('0x3b')]({},_0x57eeaf,_0x2ee442[_0xa47f('0x3d')]);var _0x22dc6a={'where':_0x57eeaf['where']};return db['MailMessage'][_0xa47f('0x21')](_0x22dc6a)[_0xa47f('0x14')](function(_0x39d57e){_0x24d723[_0xa47f('0x21')]=_0x39d57e;if(_0x2ee442[_0xa47f('0x33')][_0xa47f('0x3e')]){_0x57eeaf[_0xa47f('0x3f')]=[{'all':!![]}];}return db[_0xa47f('0x2c')]['findAll'](_0x57eeaf);})[_0xa47f('0x14')](function(_0x4380f4){_0x24d723[_0xa47f('0x40')]=_0x4380f4;return _0x24d723;})['then'](respondWithFilteredResult(_0x595c5d,_0x57eeaf))['catch'](handleError(_0x595c5d,null));};exports['show']=function(_0x1998e0,_0x4c034b){var _0xea86ac={'raw':!![],'where':{'id':_0x1998e0[_0xa47f('0x41')]['id']}},_0x45c49b={};_0x45c49b[_0xa47f('0x2f')]=_['keys'](db[_0xa47f('0x2c')][_0xa47f('0x42')]);_0x45c49b[_0xa47f('0x33')]=_[_0xa47f('0x30')](_0x1998e0['query']);_0x45c49b[_0xa47f('0x31')]=_['intersection'](_0x45c49b[_0xa47f('0x2f')],_0x45c49b[_0xa47f('0x33')]);_0xea86ac[_0xa47f('0x34')]=_[_0xa47f('0x32')](_0x45c49b[_0xa47f('0x2f')],qs[_0xa47f('0x35')](_0x1998e0[_0xa47f('0x33')][_0xa47f('0x35')]));_0xea86ac[_0xa47f('0x34')]=_0xea86ac[_0xa47f('0x34')][_0xa47f('0x43')]?_0xea86ac['attributes']:_0x45c49b[_0xa47f('0x2f')];if(_0x1998e0[_0xa47f('0x33')][_0xa47f('0x3e')]){_0xea86ac[_0xa47f('0x3f')]=[{'all':!![]}];}_0xea86ac=_[_0xa47f('0x3b')]({},_0xea86ac,_0x1998e0[_0xa47f('0x3d')]);return db[_0xa47f('0x2c')][_0xa47f('0x44')](_0xea86ac)['then'](handleEntityNotFound(_0x4c034b,null))['then'](respondWithResult(_0x4c034b,null))[_0xa47f('0x1d')](handleError(_0x4c034b,null));};exports['update']=function(_0x3a5721,_0x13d395){if(_0x3a5721[_0xa47f('0x45')]['id']){delete _0x3a5721[_0xa47f('0x45')]['id'];}return db[_0xa47f('0x2c')][_0xa47f('0x44')]({'where':{'id':_0x3a5721[_0xa47f('0x41')]['id']}})[_0xa47f('0x14')](handleEntityNotFound(_0x13d395,null))[_0xa47f('0x14')](saveUpdates(_0x3a5721[_0xa47f('0x45')],null))[_0xa47f('0x14')](respondWithResult(_0x13d395,null))[_0xa47f('0x1d')](handleError(_0x13d395,null));};exports[_0xa47f('0x24')]=function(_0x480e48,_0x52b32e){return db['MailMessage']['find']({'where':{'id':_0x480e48[_0xa47f('0x41')]['id']}})[_0xa47f('0x14')](handleEntityNotFound(_0x52b32e,null))[_0xa47f('0x14')](removeEntity(_0x52b32e,null))[_0xa47f('0x1d')](handleError(_0x52b32e,null));};exports[_0xa47f('0x46')]=function(_0x2acf40,_0x56f7dd){return db['MailMessage'][_0xa47f('0x46')]()[_0xa47f('0x14')](respondWithResult(_0x56f7dd,null))[_0xa47f('0x1d')](handleError(_0x56f7dd,null));};exports[_0xa47f('0x47')]=function(_0x4a1010,_0x301a60){return db[_0xa47f('0x2c')][_0xa47f('0x47')](_0x4a1010[_0xa47f('0x45')])[_0xa47f('0x14')](function(_0x725004){if(_0x725004){if(_0x725004[_0xa47f('0x48')]===_0xa47f('0x49')&&!_0x725004[_0xa47f('0x4a')]){var _0x2d4ceb,_0x31dd5d,_0x376afd;if(_0x4a1010[_0xa47f('0x45')]['to']){_0x31dd5d=_0x4a1010[_0xa47f('0x45')]['to'][_0xa47f('0x4b')](',')[0x0];}return db[_0xa47f('0x4c')][_0xa47f('0x4d')]({'where':{'id':_0x725004[_0xa47f('0x4e')]},'include':[{'model':db[_0xa47f('0x4f')],'as':_0xa47f('0x50'),'include':[{'model':db[_0xa47f('0x51')],'as':'Contacts','where':{'email':_0x31dd5d},'limit':0x1,'order':[[_0xa47f('0x52'),_0xa47f('0x53')]]}]},{'model':db['MailServerOut'],'as':_0xa47f('0x54'),'raw':!![],'include':[{'model':db[_0xa47f('0x55')],'as':_0xa47f('0x55'),'raw':!![]}]}]})['then'](function(_0x567712){_0x2d4ceb=_0x567712;if(!_0x2d4ceb||!_0x2d4ceb['Smtp'])return;var _0x3efa25=_0x2d4ceb[_0xa47f('0x56')]();if(_0x4a1010['body'][_0xa47f('0x57')]&&_0x4a1010[_0xa47f('0x45')][_0xa47f('0x57')][_0xa47f('0x43')]){for(var _0xe82590=0x0;_0xe82590<_0x4a1010[_0xa47f('0x45')][_0xa47f('0x57')]['length'];_0xe82590+=0x1){_0x4a1010['body']['attachments'][_0xe82590]={'filename':_0x4a1010[_0xa47f('0x45')]['attachments'][_0xe82590][_0xa47f('0x28')],'path':path[_0xa47f('0x58')](config['root'],_0xa47f('0x59'),_0x4a1010[_0xa47f('0x45')][_0xa47f('0x57')][_0xe82590][_0xa47f('0x5a')])};}}_0x376afd={'account':_0x3efa25,'message':_0x4a1010[_0xa47f('0x45')]};return;})[_0xa47f('0x14')](function(){if(_0x2d4ceb['List']){if(_0x2d4ceb[_0xa47f('0x50')][_0xa47f('0x5b')][_0xa47f('0x43')]){return _0x2d4ceb[_0xa47f('0x50')][_0xa47f('0x5b')][0x0];}else{return db[_0xa47f('0x51')][_0xa47f('0x47')](_[_0xa47f('0x5c')](_0x4a1010['body'],{'firstName':_0x4a1010[_0xa47f('0x45')]['to'],'email':_0x4a1010[_0xa47f('0x45')]['to'],'phone':_0x4a1010[_0xa47f('0x45')]['to'],'ListId':_0x2d4ceb['ListId']}));}}else{throw new Error(_0xa47f('0x5d'));}})['then'](function(){if(_0x376afd){return respondWithRpcPromise(_0xa47f('0x5e'),_0xa47f('0x5f'),_0x376afd,client9003)[_0xa47f('0x14')](function(_0x30cd59){return _0x725004[_0xa47f('0x23')]({'read':!![],'messageId':_0x30cd59[_0xa47f('0x60')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0xe18fd9){logger[_0xa47f('0x19')]('%s',JSON[_0xa47f('0x18')](_0xe18fd9));return _0x725004;});}return _0x725004;});}return _0x725004;}})['then'](respondWithResult(_0x301a60,0xc9))[_0xa47f('0x1d')](handleError(_0x301a60,null));};exports[_0xa47f('0x61')]=function(_0xcd0334,_0x1dee61){var _0x5cb39b={'agent':{},'channel':'mail'};if(_0xcd0334[_0xa47f('0x45')]['id']){delete _0xcd0334[_0xa47f('0x45')]['id'];}_0xcd0334['body'][_0xa47f('0x62')]=!![];_0xcd0334[_0xa47f('0x45')]['readAt']=moment()[_0xa47f('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0xcd0334[_0xa47f('0x45')][_0xa47f('0x64')]=_0xcd0334[_0xa47f('0x45')][_0xa47f('0x64')]||_0xcd0334[_0xa47f('0x65')]['id'];_0x5cb39b[_0xa47f('0x66')]['id']=_0xcd0334['body']['UserId'];return db[_0xa47f('0x2c')][_0xa47f('0x44')]({'where':{'id':_0xcd0334['params']['id'],'UserId':null}})[_0xa47f('0x14')](handleEntityNotFound(_0x1dee61,null))['then'](saveUpdates(_0xcd0334['body'],null))['then'](function(_0x5bb45f){if(_0x5bb45f){_0x5cb39b[_0xa47f('0x1b')]=_0x5bb45f[_0xa47f('0x67')]({'plain':!![]});return db[_0xa47f('0x68')]['find']({'where':{'id':_0x5bb45f['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1dee61,null))[_0xa47f('0x14')](function(_0x13c1c9){if(_0x13c1c9){return _0x13c1c9[_0xa47f('0x23')]({'UserId':_0xcd0334[_0xa47f('0x45')][_0xa47f('0x64')],'read1stAt':_['isNil'](_0x13c1c9[_0xa47f('0x69')])?moment()[_0xa47f('0x63')](_0xa47f('0x6a')):undefined});}return null;})['then'](function(_0x4025af){if(_0x4025af){_0x5cb39b['interaction']=_0x4025af['get']({'plain':!![]});interaction_log['info'](_0xa47f('0x6b'),_0xcd0334[_0xa47f('0x65')]['id'],_0xcd0334[_0xa47f('0x65')][_0xa47f('0x28')],_0xcd0334[_0xa47f('0x65')][_0xa47f('0x6c')],_0x5cb39b[_0xa47f('0x6d')]['id'],_0xcd0334[_0xa47f('0x45')]?JSON['stringify'](_0xcd0334[_0xa47f('0x45')]):_0xa47f('0x6e'));return respondWithRpcPromise('AcceptMessage',_0xa47f('0x6f'),_0x5cb39b);}return null;})['then'](function(_0x3a2d7e){var _0x1ee7d0=_0xa47f('0x70')+_0x3a2d7e[_0xa47f('0x1b')][_0xa47f('0x71')];return db[_0xa47f('0x72')]['query'](_0x1ee7d0,{'type':db['Sequelize']['QueryTypes'][_0xa47f('0x73')],'raw':!![]})[_0xa47f('0x14')](function(_0x5037df){return _0x5037df;});})[_0xa47f('0x14')](function(_0xa8a6aa){if(_0xa8a6aa){_0x5cb39b[_0xa47f('0x1b')]['contact']=_0xa8a6aa[0x0];if(!_0xcd0334['body'][_0xa47f('0x64')])return;return db[_0xa47f('0x74')]['find']({'where':{'id':_0xcd0334['body'][_0xa47f('0x64')],'role':_0xa47f('0x66')},'attributes':['id',_0xa47f('0x28'),_0xa47f('0x75'),'email',_0xa47f('0x76')],'raw':!![]});}return null;})['then'](function(_0x284d2a){if(!_0x284d2a)return null;_0x5cb39b['message'][_0xa47f('0x66')]=_0x284d2a;return _0x5cb39b;})[_0xa47f('0x14')](function(_0x113946){if(_0x113946){if(_0xcd0334[_0xa47f('0x45')][_0xa47f('0x77')]){_0x5cb39b[_0xa47f('0x1b')][_0xa47f('0x78')]=util[_0xa47f('0x63')](_0xa47f('0x79'),_0xcd0334[_0xa47f('0x65')][_0xa47f('0x28')]);_0x5cb39b[_0xa47f('0x1b')]['channel']=_0x5cb39b[_0xa47f('0x7a')];_0x5cb39b[_0xa47f('0x1b')][_0xa47f('0x7b')]=_0x5cb39b[_0xa47f('0x7a')];_0x5cb39b['message'][_0xa47f('0x7c')]=_0xa47f('0x61');_0x5cb39b[_0xa47f('0x1b')][_0xa47f('0x45')]=htmlToText[_0xa47f('0x7d')](_0x5cb39b[_0xa47f('0x1b')]['body']);return respondWithRpcPromise('EventManager','EventManager',{'event':_0xa47f('0x7e'),'message':_0x5cb39b[_0xa47f('0x1b')]},client9002)[_0xa47f('0x14')](function(){return _0x5cb39b;});}return _0x5cb39b;}return null;})['then'](respondWithResult(_0x1dee61,null))[_0xa47f('0x1d')](handleError(_0x1dee61,null));};exports['reject']=function(_0x58d8f2,_0x51d36f){var _0x4751e7={'agent':{},'channel':_0xa47f('0x7f')};if(_0x58d8f2['body']['id']){delete _0x58d8f2[_0xa47f('0x45')]['id'];}_0x58d8f2[_0xa47f('0x45')][_0xa47f('0x64')]=_0x58d8f2[_0xa47f('0x45')][_0xa47f('0x64')]||_0x58d8f2[_0xa47f('0x65')]['id'];_0x4751e7['agent']['id']=_0x58d8f2[_0xa47f('0x45')][_0xa47f('0x64')];return db[_0xa47f('0x2c')][_0xa47f('0x44')]({'where':{'id':_0x58d8f2[_0xa47f('0x41')]['id'],'UserId':null}})[_0xa47f('0x14')](handleEntityNotFound(_0x51d36f,null))[_0xa47f('0x14')](function(_0x48a76e){if(_0x48a76e){_0x4751e7[_0xa47f('0x1b')]=_0x48a76e['get']({'plain':!![]});return db[_0xa47f('0x68')][_0xa47f('0x44')]({'where':{'id':_0x48a76e[_0xa47f('0x80')]}});}return null;})[_0xa47f('0x14')](handleEntityNotFound(_0x51d36f,null))[_0xa47f('0x14')](function(_0x3d52ee){if(_0x3d52ee){_0x4751e7['interaction']=_0x3d52ee[_0xa47f('0x67')]({'plain':!![]});interaction_log[_0xa47f('0x15')](_0xa47f('0x81'),_0x58d8f2[_0xa47f('0x65')]['id'],_0x58d8f2['user'][_0xa47f('0x28')],_0x58d8f2[_0xa47f('0x65')][_0xa47f('0x6c')],_0x4751e7[_0xa47f('0x6d')]['id'],_0x58d8f2[_0xa47f('0x45')]?JSON[_0xa47f('0x18')](_0x58d8f2[_0xa47f('0x45')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4751e7);}return null;})[_0xa47f('0x14')](function(_0x7a4acc){var _0x344027='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7a4acc[_0xa47f('0x1b')][_0xa47f('0x71')];return db[_0xa47f('0x72')][_0xa47f('0x33')](_0x344027,{'type':db[_0xa47f('0x82')][_0xa47f('0x83')][_0xa47f('0x73')],'raw':!![]})[_0xa47f('0x14')](function(_0x2e10da){return _0x2e10da;});})['then'](function(_0x7ba79c){if(_0x7ba79c){_0x4751e7[_0xa47f('0x1b')][_0xa47f('0x84')]=_0x7ba79c[0x0];if(!_0x58d8f2[_0xa47f('0x45')][_0xa47f('0x64')])return;return db['User']['find']({'where':{'id':_0x58d8f2[_0xa47f('0x45')][_0xa47f('0x64')],'role':_0xa47f('0x66')},'attributes':['id',_0xa47f('0x28'),_0xa47f('0x75'),'email',_0xa47f('0x76')],'raw':!![]});}return null;})[_0xa47f('0x14')](function(_0x484d5a){if(!_0x484d5a)return null;_0x4751e7['message'][_0xa47f('0x66')]=_0x484d5a;return _0x4751e7;})['then'](function(_0x1b6a4b){if(_0x1b6a4b){_0x1b6a4b[_0xa47f('0x1b')][_0xa47f('0x78')]=util[_0xa47f('0x63')](_0xa47f('0x79'),_0x58d8f2[_0xa47f('0x65')][_0xa47f('0x28')]);_0x1b6a4b[_0xa47f('0x1b')][_0xa47f('0x7a')]=_0x4751e7[_0xa47f('0x7a')];_0x1b6a4b[_0xa47f('0x1b')][_0xa47f('0x7b')]=_0x4751e7['channel'];_0x1b6a4b[_0xa47f('0x1b')][_0xa47f('0x7c')]=_0xa47f('0x85');_0x1b6a4b[_0xa47f('0x1b')][_0xa47f('0x45')]=htmlToText[_0xa47f('0x7d')](_0x4751e7[_0xa47f('0x1b')][_0xa47f('0x45')]);respondWithRpcPromise(_0xa47f('0x86'),_0xa47f('0x86'),{'event':_0xa47f('0x87'),'message':_0x1b6a4b[_0xa47f('0x1b')]},client9002);return _0x4751e7;}return null;})[_0xa47f('0x14')](respondWithResult(_0x51d36f,null))[_0xa47f('0x1d')](handleError(_0x51d36f,null));};exports[_0xa47f('0x88')]=function(_0x5d173c,_0x1b1722){var _0x39f413=moment()[_0xa47f('0x89')]()[_0xa47f('0x8a')]();var _0x391dd6=path['join'](config['root'],'server',_0xa47f('0x8b'),_0xa47f('0x8c'));var _0x20f397=path[_0xa47f('0x58')](config[_0xa47f('0x8d')],'server','files',_0xa47f('0x57'));var _0x106b6a=util[_0xa47f('0x63')]('message-%s.eml',_0x39f413);return db[_0xa47f('0x2c')]['find']({'where':{'id':_0x5d173c[_0xa47f('0x41')]['id']},'attributes':['id',_0xa47f('0x45'),_0xa47f('0x8e'),'to','cc','bcc',_0xa47f('0x8f'),_0xa47f('0x90')],'include':_0x5d173c[_0xa47f('0x33')][_0xa47f('0x57')]?[{'model':db[_0xa47f('0x91')],'as':_0xa47f('0x92')}]:undefined})['then'](handleEntityNotFound(_0x1b1722,null))[_0xa47f('0x14')](function(_0x3f263c){if(_0x3f263c){var _0x3be7eb=_0x3f263c;var _0x4051cd={'from':_0x3be7eb['from'],'to':_0x3be7eb['to'],'subject':_0x3be7eb[_0xa47f('0x8f')],'html':htmlEntities[_0xa47f('0x93')](_0x3be7eb[_0xa47f('0x45')]),'headers':{'Date':moment(_0x3be7eb['createdAt'])[_0xa47f('0x63')](_0xa47f('0x94'))},'attachments':[]};if(_0x3f263c['cc']){_0x4051cd[_0xa47f('0x95')]['Cc']=_0x3f263c['cc'];}if(_0x3f263c[_0xa47f('0x96')]){_0x4051cd['headers']['Bcc']=_0x3f263c[_0xa47f('0x96')];}return new BPromise(function(_0x5da765,_0x24f5d9){if(_0x3f263c[_0xa47f('0x92')]){for(var _0x5d87f2=0x0;_0x5d87f2<_0x3f263c[_0xa47f('0x92')][_0xa47f('0x43')];_0x5d87f2++){var _0x5ad0a5=_0x3f263c['Attachments'][_0x5d87f2];var _0x132402=path['join'](_0x20f397,_0x5ad0a5[_0xa47f('0x5a')]);if(fs[_0xa47f('0x97')](_0x132402)){_0x4051cd[_0xa47f('0x57')][_0xa47f('0x98')]({'name':_0x5ad0a5[_0xa47f('0x28')],'contentType':_0x5ad0a5[_0xa47f('0x2e')],'data':fs[_0xa47f('0x99')](_0x132402)});}}}emlformat[_0xa47f('0x9a')](_0x4051cd,function(_0x4f0a6e,_0x150590){if(_0x4f0a6e)return _0x24f5d9(_0x4f0a6e);fs['writeFileSync'](path[_0xa47f('0x58')](_0x391dd6,_0x106b6a),_0x150590);return _0x5da765(_0x150590);});});}})[_0xa47f('0x14')](function(_0x78a30f){if(_0x78a30f){return _0x1b1722['download'](path[_0xa47f('0x58')](_0x391dd6,_0x106b6a),_0x106b6a,function(_0x8e46e0){if(!_0x8e46e0)fs[_0xa47f('0x9b')](path[_0xa47f('0x58')](_0x391dd6,_0x106b6a));});}})[_0xa47f('0x1d')](handleError(_0x1b1722,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 170ca85..d81ff03 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 _0x3572=['update','emit','hasOwnProperty','exports','events','../../mysqldb','save'];(function(_0x44427f,_0x3e05f2){var _0x535756=function(_0xbfca29){while(--_0xbfca29){_0x44427f['push'](_0x44427f['shift']());}};_0x535756(++_0x3e05f2);}(_0x3572,0x17e));var _0x2357=function(_0x26031c,_0x39fb00){_0x26031c=_0x26031c-0x0;var _0x3a2f0b=_0x3572[_0x26031c];return _0x3a2f0b;};'use strict';var EventEmitter=require(_0x2357('0x0'));var MailMessage=require(_0x2357('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2357('0x2'),'afterUpdate':_0x2357('0x3'),'afterDestroy':'remove'};function emitEvent(_0x297021){return function(_0x505538,_0x3447a7,_0x53a99f){MailMessageEvents[_0x2357('0x4')](_0x297021+':'+_0x505538['id'],_0x505538);MailMessageEvents[_0x2357('0x4')](_0x297021,_0x505538);_0x53a99f(null);};}for(var e in events){if(events[_0x2357('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x2357('0x6')]=MailMessageEvents; \ No newline at end of file +var _0xd5c8=['save','remove','emit','hook','exports','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd5c8,0x19d));var _0x8d5c=function(_0x562faf,_0x102bcc){_0x562faf=_0x562faf-0x0;var _0x22c1f6=_0xd5c8[_0x562faf];return _0x22c1f6;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x8d5c('0x0'))['db'][_0x8d5c('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8d5c('0x2')](0x0);var events={'afterCreate':_0x8d5c('0x3'),'afterUpdate':'update','afterDestroy':_0x8d5c('0x4')};function emitEvent(_0x2c150d){return function(_0x5e98a9,_0x451ce7,_0x3630e2){MailMessageEvents['emit'](_0x2c150d+':'+_0x5e98a9['id'],_0x5e98a9);MailMessageEvents[_0x8d5c('0x5')](_0x2c150d,_0x5e98a9);_0x3630e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8d5c('0x6')](e,emitEvent(event));}}module[_0x8d5c('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 e508633..f6c81c8 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 _0xc8e7=['fromString','models','get','direction','toLowerCase','secret','isNil','MailInteraction','findOne','MailInteractionId','update','createdAt','error','utf8mb4_unicode_ci','util','api','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body'];(function(_0x5da56b,_0xf50708){var _0x26d1dd=function(_0x54966b){while(--_0x54966b){_0x5da56b['push'](_0x5da56b['shift']());}};_0x26d1dd(++_0xf50708);}(_0xc8e7,0xe0));var _0x7c8e=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0xc8e7[_0x4f431d];return _0x4f31e1;};'use strict';var _=require('lodash');var util=require(_0x7c8e('0x0'));var logger=require('../../config/logger')(_0x7c8e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c8e('0x2'));var htmlToText=require(_0x7c8e('0x3'));var fs=require('fs');var path=require(_0x7c8e('0x4'));var rimraf=require(_0x7c8e('0x5'));var config=require(_0x7c8e('0x6'));var attributes=require(_0x7c8e('0x7'));module['exports']=function(_0x2cc01c,_0x1678db){return _0x2cc01c[_0x7c8e('0x8')](_0x7c8e('0x9'),attributes,{'tableName':_0x7c8e('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7c8e('0xb')]},{'name':_0x7c8e('0xc'),'fields':[_0x7c8e('0xd'),_0x7c8e('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f30f1,_0xef8a97,_0x5dd890){if(_0x5f30f1[_0x7c8e('0xf')]){_0x5f30f1[_0x7c8e('0xd')]=htmlToText[_0x7c8e('0x10')](_0x5f30f1[_0x7c8e('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5dd890(null,_0xef8a97);},'afterCreate':function(_0xd47d62,_0x227cf8,_0x353c97){var _0x538376=_0x2cc01c[_0x7c8e('0x11')];var _0x26059e=_0xd47d62[_0x7c8e('0x12')]({'plain':!![]});if(_0x26059e[_0x7c8e('0x13')][_0x7c8e('0x14')]()==='in'||_0x26059e['direction'][_0x7c8e('0x14')]()==='out'&&!_0x26059e[_0x7c8e('0x15')]&&!_[_0x7c8e('0x16')](_0x26059e['UserId'])){_0x538376[_0x7c8e('0x17')][_0x7c8e('0x18')]({'where':{'id':_0x26059e[_0x7c8e('0x19')]}})['then'](function(_0x83cd){if(_0x83cd){_0x83cd[_0x7c8e('0x1a')]({'lastMsgAt':_0x26059e[_0x7c8e('0x1b')],'lastMsgDirection':_0x26059e['direction']['toLowerCase']()});}})['catch'](function(_0x582316){console[_0x7c8e('0x1c')](_0x582316);});}_0x353c97();}},'charset':'utf8mb4','collate':_0x7c8e('0x1d')});}; \ No newline at end of file +var _0x5c6e=['UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','html-to-text','../../config/environment','./mailMessage.attributes','mail_messages','messageId','fti_mail_messages','FULLTEXT','body','models','get','direction','toLowerCase','out'];(function(_0x3e199b,_0x3148ff){var _0x15ea7c=function(_0x5dac5e){while(--_0x5dac5e){_0x3e199b['push'](_0x3e199b['shift']());}};_0x15ea7c(++_0x3148ff);}(_0x5c6e,0x110));var _0xe5c6=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0x5c6e[_0x3a7634];return _0x23bbe9;};'use strict';var _=require(_0xe5c6('0x0'));var util=require(_0xe5c6('0x1'));var logger=require('../../config/logger')(_0xe5c6('0x2'));var moment=require(_0xe5c6('0x3'));var BPromise=require('bluebird');var rp=require(_0xe5c6('0x4'));var htmlToText=require(_0xe5c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe5c6('0x6'));var attributes=require(_0xe5c6('0x7'));module['exports']=function(_0x1a4999,_0x1cdd0a){return _0x1a4999['define']('MailMessage',attributes,{'tableName':_0xe5c6('0x8'),'paranoid':![],'indexes':[{'name':_0xe5c6('0x9'),'fields':[_0xe5c6('0x9')]},{'name':_0xe5c6('0xa'),'fields':['plainBody','subject'],'type':_0xe5c6('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x375c17,_0x56efb8,_0x10f67d){if(_0x375c17['body']){_0x375c17['plainBody']=htmlToText['fromString'](_0x375c17[_0xe5c6('0xc')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x10f67d(null,_0x56efb8);},'afterCreate':function(_0x43d589,_0x1017fd,_0x7061a2){var _0xed61e9=_0x1a4999[_0xe5c6('0xd')];var _0x4724e7=_0x43d589[_0xe5c6('0xe')]({'plain':!![]});if(_0x4724e7[_0xe5c6('0xf')]['toLowerCase']()==='in'||_0x4724e7[_0xe5c6('0xf')][_0xe5c6('0x10')]()===_0xe5c6('0x11')&&!_0x4724e7['secret']&&!_['isNil'](_0x4724e7[_0xe5c6('0x12')])){_0xed61e9[_0xe5c6('0x13')][_0xe5c6('0x14')]({'where':{'id':_0x4724e7[_0xe5c6('0x15')]}})[_0xe5c6('0x16')](function(_0x5efe71){if(_0x5efe71){_0x5efe71[_0xe5c6('0x17')]({'lastMsgAt':_0x4724e7[_0xe5c6('0x18')],'lastMsgDirection':_0x4724e7['direction']['toLowerCase']()});}})[_0xe5c6('0x19')](function(_0x25115f){console[_0xe5c6('0x1a')](_0x25115f);});}_0x7061a2();}},'charset':_0xe5c6('0x1b'),'collate':_0xe5c6('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index aeffdca..3082e01 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 _0xb03e=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','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','create','body','options'];(function(_0x1af433,_0x4f2e5b){var _0x34188f=function(_0x2c4319){while(--_0x2c4319){_0x1af433['push'](_0x1af433['shift']());}};_0x34188f(++_0x4f2e5b);}(_0xb03e,0x1eb));var _0xeb03=function(_0x4fc55e,_0x1dde4e){_0x4fc55e=_0x4fc55e-0x0;var _0x5d54b9=_0xb03e[_0x4fc55e];return _0x5d54b9;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});config[_0xeb03('0xc')]=_[_0xeb03('0xd')](config[_0xeb03('0xc')],{'host':_0xeb03('0xe'),'port':0x18eb});var socket=require(_0xeb03('0xf'))(new Redis(config[_0xeb03('0xc')]));require('./mailMessage.socket')[_0xeb03('0x10')](socket);function respondWithRpcPromise(_0x99f4e2,_0x14cfa0,_0x4f5013){return new BPromise(function(_0x31af2c,_0x48af4f){return client[_0xeb03('0x11')](_0x99f4e2,_0x4f5013)[_0xeb03('0x12')](function(_0x3de728){logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));logger[_0xeb03('0x16')](_0xeb03('0x17'),_0x14cfa0,_0xeb03('0x15'),JSON[_0xeb03('0x18')](_0x3de728));if(_0x3de728[_0xeb03('0x19')]){if(_0x3de728[_0xeb03('0x19')]['code']===0x1f4){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);return _0x48af4f(_0x3de728['error'][_0xeb03('0x1a')]);}logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728['error'][_0xeb03('0x1a')]);return _0x31af2c(_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);}else{logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));_0x31af2c(_0x3de728[_0xeb03('0x1b')][_0xeb03('0x1a')]);}})[_0xeb03('0x1c')](function(_0x469d25){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x469d25);_0x48af4f(_0x469d25);});});}exports[_0xeb03('0x1d')]=function(_0x19bddf){var _0x4d307c=this;return new Promise(function(_0x1bea3f,_0x3855dd){return db[_0xeb03('0x1e')][_0xeb03('0x1f')](_0x19bddf[_0xeb03('0x20')],{'raw':_0x19bddf[_0xeb03('0x21')]?_0x19bddf[_0xeb03('0x21')][_0xeb03('0x22')]===undefined?!![]:![]:!![]})[_0xeb03('0x12')](function(_0x5a704b){logger[_0xeb03('0x13')](_0xeb03('0x1d'),_0x19bddf);logger[_0xeb03('0x16')](_0xeb03('0x1d'),_0x19bddf,JSON[_0xeb03('0x18')](_0x5a704b));_0x1bea3f(_0x5a704b);})['catch'](function(_0x638353){logger[_0xeb03('0x19')](_0xeb03('0x1d'),_0x638353[_0xeb03('0x1a')],_0x19bddf);_0x3855dd(_0x4d307c[_0xeb03('0x19')](0x1f4,_0x638353[_0xeb03('0x1a')]));});});}; \ No newline at end of file +var _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x2bc326,_0x473cf8){var _0x43722e=function(_0x4dd559){while(--_0x4dd559){_0x2bc326['push'](_0x2bc326['shift']());}};_0x43722e(++_0x473cf8);}(_0x1399,0x16c));var _0x9139=function(_0x222711,_0x555389){_0x222711=_0x222711-0x0;var _0x112699=_0x1399[_0x222711];return _0x112699;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 1c9de0b..1a116f4 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 _0x56d8=['length','mailMessage:','./mailMessage.events','update','emit'];(function(_0x1673f1,_0x16f559){var _0x140170=function(_0x94ec6d){while(--_0x94ec6d){_0x1673f1['push'](_0x1673f1['shift']());}};_0x140170(++_0x16f559);}(_0x56d8,0x1a1));var _0x856d=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x56d8[_0x29b609];return _0x54c952;};'use strict';var MailMessageEvents=require(_0x856d('0x0'));var events=['save','remove',_0x856d('0x1')];function createListener(_0x45b2b4,_0x21237b){return function(_0x2d9eb4){_0x21237b[_0x856d('0x2')](_0x45b2b4,_0x2d9eb4);};}function removeListener(_0x301bf6,_0x6c9777){return function(){MailMessageEvents['removeListener'](_0x301bf6,_0x6c9777);};}exports['register']=function(_0xdd3b7c){for(var _0x333e7e=0x0,_0x2ce2d3=events[_0x856d('0x3')];_0x333e7e<_0x2ce2d3;_0x333e7e++){var _0x593fbd=events[_0x333e7e];var _0x4b0f64=createListener(_0x856d('0x4')+_0x593fbd,_0xdd3b7c);MailMessageEvents['on'](_0x593fbd,_0x4b0f64);}}; \ No newline at end of file +var _0xc305=['removeListener','length','mailMessage:','./mailMessage.events','update','emit'];(function(_0x2b713c,_0x1a5f8e){var _0x2f0170=function(_0x3ed881){while(--_0x3ed881){_0x2b713c['push'](_0x2b713c['shift']());}};_0x2f0170(++_0x1a5f8e);}(_0xc305,0xcf));var _0x5c30=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0xc305[_0x1f62c3];return _0x385c1c;};'use strict';var MailMessageEvents=require(_0x5c30('0x0'));var events=['save','remove',_0x5c30('0x1')];function createListener(_0x200645,_0x5b6fbc){return function(_0x330e4b){_0x5b6fbc[_0x5c30('0x2')](_0x200645,_0x330e4b);};}function removeListener(_0x388cc5,_0x19b07c){return function(){MailMessageEvents[_0x5c30('0x3')](_0x388cc5,_0x19b07c);};}exports['register']=function(_0x311c48){for(var _0x295b5b=0x0,_0x175135=events[_0x5c30('0x4')];_0x295b5b<_0x175135;_0x295b5b++){var _0x3d6598=events[_0x295b5b];var _0x1d6f15=createListener(_0x5c30('0x5')+_0x3d6598,_0x311c48);MailMessageEvents['on'](_0x3d6598,_0x1d6f15);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 882b03d..f9c3d77 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 _0xee76=['update','delete','removeTeams','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','getMembers','/:id/teams','/:id/users','getAgents','post','create','put','/:id'];(function(_0x5cb4f4,_0x10b186){var _0xac3306=function(_0x789921){while(--_0x789921){_0x5cb4f4['push'](_0x5cb4f4['shift']());}};_0xac3306(++_0x10b186);}(_0xee76,0xac));var _0x6ee7=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0xee76[_0x3f807d];return _0x45ad62;};'use strict';var multer=require(_0x6ee7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ee7('0x1'));var express=require('express');var router=express[_0x6ee7('0x2')]();var fs_extra=require(_0x6ee7('0x3'));var auth=require(_0x6ee7('0x4'));var interaction=require(_0x6ee7('0x5'));var config=require('../../config/environment');var controller=require(_0x6ee7('0x6'));router['get']('/',auth[_0x6ee7('0x7')](),controller[_0x6ee7('0x8')]);router[_0x6ee7('0x9')](_0x6ee7('0xa'),auth[_0x6ee7('0x7')](),controller[_0x6ee7('0xb')]);router[_0x6ee7('0x9')]('/:id',auth[_0x6ee7('0x7')](),controller['show']);router[_0x6ee7('0x9')]('/:id/members',auth[_0x6ee7('0x7')](),controller[_0x6ee7('0xc')]);router['get'](_0x6ee7('0xd'),auth[_0x6ee7('0x7')](),controller['getTeams']);router[_0x6ee7('0x9')](_0x6ee7('0xe'),auth['isAuthenticated'](),controller[_0x6ee7('0xf')]);router[_0x6ee7('0x10')]('/',auth[_0x6ee7('0x7')](),controller[_0x6ee7('0x11')]);router[_0x6ee7('0x10')]('/:id/teams',auth[_0x6ee7('0x7')](),controller['addTeams']);router[_0x6ee7('0x10')](_0x6ee7('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6ee7('0x12')](_0x6ee7('0x13'),auth[_0x6ee7('0x7')](),controller[_0x6ee7('0x14')]);router['delete'](_0x6ee7('0x13'),auth['isAuthenticated'](),controller['destroy']);router[_0x6ee7('0x15')](_0x6ee7('0xd'),auth[_0x6ee7('0x7')](),controller[_0x6ee7('0x16')]);router[_0x6ee7('0x15')]('/:id/users',auth[_0x6ee7('0x7')](),controller['removeAgents']);module[_0x6ee7('0x17')]=router; \ No newline at end of file +var _0xa8f7=['removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','show','getMembers','/:id/teams','create','post','addAgents','put','/:id','update','destroy','delete','/:id/users'];(function(_0x462f2b,_0x337220){var _0x1308e7=function(_0x5e8a02){while(--_0x5e8a02){_0x462f2b['push'](_0x462f2b['shift']());}};_0x1308e7(++_0x337220);}(_0xa8f7,0x11a));var _0x7a8f=function(_0x164621,_0xe6a879){_0x164621=_0x164621-0x0;var _0x4132e9=_0xa8f7[_0x164621];return _0x4132e9;};'use strict';var multer=require('multer');var util=require(_0x7a8f('0x0'));var path=require(_0x7a8f('0x1'));var timeout=require(_0x7a8f('0x2'));var express=require(_0x7a8f('0x3'));var router=express[_0x7a8f('0x4')]();var fs_extra=require(_0x7a8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7a8f('0x6'));var config=require(_0x7a8f('0x7'));var controller=require(_0x7a8f('0x8'));router[_0x7a8f('0x9')]('/',auth['isAuthenticated'](),controller[_0x7a8f('0xa')]);router[_0x7a8f('0x9')](_0x7a8f('0xb'),auth[_0x7a8f('0xc')](),controller[_0x7a8f('0xd')]);router[_0x7a8f('0x9')]('/:id',auth[_0x7a8f('0xc')](),controller[_0x7a8f('0xe')]);router[_0x7a8f('0x9')]('/:id/members',auth[_0x7a8f('0xc')](),controller[_0x7a8f('0xf')]);router[_0x7a8f('0x9')](_0x7a8f('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x7a8f('0x9')]('/:id/users',auth[_0x7a8f('0xc')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7a8f('0x11')]);router[_0x7a8f('0x12')](_0x7a8f('0x10'),auth[_0x7a8f('0xc')](),controller['addTeams']);router[_0x7a8f('0x12')]('/:id/users',auth[_0x7a8f('0xc')](),controller[_0x7a8f('0x13')]);router[_0x7a8f('0x14')](_0x7a8f('0x15'),auth['isAuthenticated'](),controller[_0x7a8f('0x16')]);router['delete'](_0x7a8f('0x15'),auth[_0x7a8f('0xc')](),controller[_0x7a8f('0x17')]);router[_0x7a8f('0x18')]('/:id/teams',auth[_0x7a8f('0xc')](),controller['removeTeams']);router['delete'](_0x7a8f('0x19'),auth['isAuthenticated'](),controller[_0x7a8f('0x1a')]);module[_0x7a8f('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 2fe848a..5eec33c 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 _0xa7b6=['ENUM','rrmemory','beepall','sequelize','exports','STRING','name'];(function(_0x7a0d91,_0x37e8f6){var _0x41e771=function(_0x11c648){while(--_0x11c648){_0x7a0d91['push'](_0x7a0d91['shift']());}};_0x41e771(++_0x37e8f6);}(_0xa7b6,0xea));var _0x6a7b=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0xa7b6[_0x408e38];return _0x426b0e;};'use strict';var Sequelize=require(_0x6a7b('0x0'));module[_0x6a7b('0x1')]={'name':{'type':Sequelize[_0x6a7b('0x2')],'unique':_0x6a7b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6a7b('0x4')](_0x6a7b('0x5'),_0x6a7b('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x50e8=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5e2a2d,_0x3fd79f){var _0x352a1a=function(_0x20b308){while(--_0x20b308){_0x5e2a2d['push'](_0x5e2a2d['shift']());}};_0x352a1a(++_0x3fd79f);}(_0x50e8,0x11f));var _0x850e=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x50e8[_0x267c52];return _0x46c47b;};'use strict';var Sequelize=require(_0x850e('0x0'));module[_0x850e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x850e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x850e('0x3')]},'timeout':{'type':Sequelize[_0x850e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x850e('0x5')](_0x850e('0x6'),_0x850e('0x7'),_0x850e('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 20e019b..28a40f9 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 _0xe2b8=['sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','includes','union','compact','value','isEmpty','removeAgents','userMailQueue: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','register','status','end','undefined','limit','count','offset','set','Content-Range','json','update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','map','MailQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','show','params','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','order','sort','filter','findAndCountAll','UserId','agent','mailPause','format','%s/%s','createdAt','updatedAt','getTeams','Team','pick','nolimit','addTeams','ids','User','Agents','online','voicePause'];(function(_0x212348,_0x55415c){var _0x1696e9=function(_0x2b87cb){while(--_0x2b87cb){_0x212348['push'](_0x212348['shift']());}};_0x1696e9(++_0x55415c);}(_0xe2b8,0x184));var _0x8e2b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xe2b8[_0x32f7d7];return _0x133d09;};'use strict';var BPromise=require(_0x8e2b('0x0'));var util=require(_0x8e2b('0x1'));var _=require(_0x8e2b('0x2'));var squel=require(_0x8e2b('0x3'));var Redis=require(_0x8e2b('0x4'));var qs=require(_0x8e2b('0x5'));var logger=require(_0x8e2b('0x6'))(_0x8e2b('0x7'));var config=require(_0x8e2b('0x8'));var db=require(_0x8e2b('0x9'))['db'];config[_0x8e2b('0xa')]=_[_0x8e2b('0xb')](config[_0x8e2b('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8e2b('0xc'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x8e2b('0xd')](socket);function respondWithStatusCode(_0x5af133,_0x45a9f9){_0x45a9f9=_0x45a9f9||0xcc;return function(_0x1122af){if(_0x1122af){return _0x5af133['sendStatus'](_0x45a9f9);}return _0x5af133[_0x8e2b('0xe')](_0x45a9f9)[_0x8e2b('0xf')]();};}function respondWithResult(_0x3a6ad4,_0x30c8c0){_0x30c8c0=_0x30c8c0||0xc8;return function(_0x3298b8){if(_0x3298b8){return _0x3a6ad4['status'](_0x30c8c0)['json'](_0x3298b8);}};}function respondWithFilteredResult(_0x26b432,_0x3a7265){return function(_0x30e8b9){if(_0x30e8b9){var _0x33dcf5=typeof _0x3a7265['offset']===_0x8e2b('0x10')&&typeof _0x3a7265[_0x8e2b('0x11')]===_0x8e2b('0x10');var _0x21ce80=_0x30e8b9[_0x8e2b('0x12')];var _0x2b10f8=_0x33dcf5?0x0:_0x3a7265[_0x8e2b('0x13')];var _0x481291=_0x33dcf5?_0x30e8b9['count']:_0x3a7265['offset']+_0x3a7265['limit'];var _0x7eb8e1;if(_0x481291>=_0x21ce80){_0x481291=_0x21ce80;_0x7eb8e1=0xc8;}else{_0x7eb8e1=0xce;}_0x26b432['status'](_0x7eb8e1);return _0x26b432[_0x8e2b('0x14')](_0x8e2b('0x15'),_0x2b10f8+'-'+_0x481291+'/'+_0x21ce80)[_0x8e2b('0x16')](_0x30e8b9);}return null;};}function saveUpdates(_0x47437f){return function(_0x42d62b){if(_0x42d62b){return _0x42d62b[_0x8e2b('0x17')](_0x47437f)['then'](function(_0x1a93c4){return _0x1a93c4;});}return null;};}function removeEntity(_0x3a2afd){return function(_0x5c1567){if(_0x5c1567){return _0x5c1567[_0x8e2b('0x18')]()[_0x8e2b('0x19')](function(){var _0x2b2e5e=_0x5c1567[_0x8e2b('0x1a')]({'plain':!![]});var _0x48b65f='MailQueues';return db[_0x8e2b('0x1b')]['destroy']({'where':{'type':_0x48b65f,'resourceId':_0x2b2e5e['id']}})['then'](function(){return _0x5c1567;});})[_0x8e2b('0x19')](function(){_0x3a2afd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f477){return function(_0x1613b4){if(!_0x1613b4){_0x17f477[_0x8e2b('0x1c')](0x194);}return _0x1613b4;};}function handleError(_0x22c890,_0x55ccc5){_0x55ccc5=_0x55ccc5||0x1f4;return function(_0x431dcd){logger[_0x8e2b('0x1d')](_0x431dcd[_0x8e2b('0x1e')]);if(_0x431dcd[_0x8e2b('0x1f')]){delete _0x431dcd[_0x8e2b('0x1f')];}_0x22c890[_0x8e2b('0xe')](_0x55ccc5)[_0x8e2b('0x20')](_0x431dcd);};}exports['index']=function(_0x24ff73,_0x5cccff){var _0x14257c={};var _0x548317={'count':0x0,'rows':[]};var _0x30fa3d=_[_0x8e2b('0x21')](db[_0x8e2b('0x22')][_0x8e2b('0x23')],function(_0x2026e0){return{'name':_0x2026e0['fieldName'],'type':_0x2026e0[_0x8e2b('0x24')][_0x8e2b('0x25')]};});_0x14257c=qs[_0x8e2b('0x26')](_0x30fa3d,_0x24ff73);var _0x401763={'where':_0x14257c[_0x8e2b('0x27')]};return db[_0x8e2b('0x22')][_0x8e2b('0x12')](_0x401763)[_0x8e2b('0x19')](function(_0x5d0597){_0x548317[_0x8e2b('0x12')]=_0x5d0597;_0x14257c[_0x8e2b('0x28')]=qs[_0x8e2b('0x28')](_0x24ff73[_0x8e2b('0x29')]);return db['MailQueue'][_0x8e2b('0x2a')](_0x14257c);})[_0x8e2b('0x19')](function(_0x1ccad1){_0x548317[_0x8e2b('0x2b')]=_0x1ccad1;return _0x548317;})['then'](respondWithFilteredResult(_0x5cccff,_0x14257c))['catch'](handleError(_0x5cccff,null));};exports[_0x8e2b('0x2c')]=function(_0x266382,_0x3b166d){var _0x50b399={'raw':!![],'where':{'id':_0x266382[_0x8e2b('0x2d')]['id']}},_0x4cbede={};_0x4cbede[_0x8e2b('0x2e')]=_[_0x8e2b('0x2f')](db[_0x8e2b('0x22')][_0x8e2b('0x23')]);_0x4cbede[_0x8e2b('0x29')]=_[_0x8e2b('0x2f')](_0x266382[_0x8e2b('0x29')]);_0x4cbede[_0x8e2b('0x30')]=_['intersection'](_0x4cbede[_0x8e2b('0x2e')],_0x4cbede[_0x8e2b('0x29')]);_0x50b399[_0x8e2b('0x31')]=_[_0x8e2b('0x32')](_0x4cbede[_0x8e2b('0x2e')],qs[_0x8e2b('0x33')](_0x266382[_0x8e2b('0x29')]['fields']));_0x50b399['attributes']=_0x50b399['attributes'][_0x8e2b('0x34')]?_0x50b399['attributes']:_0x4cbede[_0x8e2b('0x2e')];if(_0x266382[_0x8e2b('0x29')][_0x8e2b('0x35')]){_0x50b399[_0x8e2b('0x28')]=[{'all':!![]}];}_0x50b399=_[_0x8e2b('0x36')]({},_0x50b399,_0x266382[_0x8e2b('0x37')]);return db['MailQueue'][_0x8e2b('0x38')](_0x50b399)[_0x8e2b('0x19')](handleEntityNotFound(_0x3b166d,null))[_0x8e2b('0x19')](respondWithResult(_0x3b166d,null))[_0x8e2b('0x39')](handleError(_0x3b166d,null));};exports[_0x8e2b('0x3a')]=function(_0x5c7601,_0xafbc89){return db[_0x8e2b('0x22')][_0x8e2b('0x3a')](_0x5c7601[_0x8e2b('0x3b')],{})[_0x8e2b('0x19')](function(_0x20d0fe){var _0x1fb321=_0x5c7601[_0x8e2b('0x3c')][_0x8e2b('0x1a')]({'plain':!![]});if(!_0x1fb321)throw new Error(_0x8e2b('0x3d'));if(_0x1fb321[_0x8e2b('0x3e')]===_0x8e2b('0x3c')){var _0x165671=_0x20d0fe['get']({'plain':!![]});var _0x2b12b6=_0x8e2b('0x3f');return db['UserProfileSection']['find']({'where':{'name':_0x2b12b6,'userProfileId':_0x1fb321[_0x8e2b('0x40')]},'raw':!![]})[_0x8e2b('0x19')](function(_0x319bcf){if(_0x319bcf&&_0x319bcf['autoAssociation']===0x0){return db[_0x8e2b('0x1b')]['create']({'name':_0x165671[_0x8e2b('0x1f')],'resourceId':_0x165671['id'],'type':_0x319bcf[_0x8e2b('0x1f')],'sectionId':_0x319bcf['id']},{})['then'](function(){return _0x20d0fe;});}else{return _0x20d0fe;}})[_0x8e2b('0x39')](function(_0x2cf239){logger[_0x8e2b('0x1d')](_0x8e2b('0x41'),_0x2cf239);throw _0x2cf239;});}return _0x20d0fe;})['then'](respondWithResult(_0xafbc89,0xc9))[_0x8e2b('0x39')](handleError(_0xafbc89,null));};exports[_0x8e2b('0x17')]=function(_0x3ce192,_0x473361){if(_0x3ce192[_0x8e2b('0x3b')]['id']){delete _0x3ce192[_0x8e2b('0x3b')]['id'];}return db[_0x8e2b('0x22')][_0x8e2b('0x38')]({'where':{'id':_0x3ce192[_0x8e2b('0x2d')]['id']}})[_0x8e2b('0x19')](handleEntityNotFound(_0x473361,null))['then'](saveUpdates(_0x3ce192[_0x8e2b('0x3b')],null))['then'](respondWithResult(_0x473361,null))[_0x8e2b('0x39')](handleError(_0x473361,null));};exports['destroy']=function(_0x545a00,_0x4e8da4){return db[_0x8e2b('0x22')][_0x8e2b('0x38')]({'where':{'id':_0x545a00[_0x8e2b('0x2d')]['id']}})[_0x8e2b('0x19')](handleEntityNotFound(_0x4e8da4,null))['then'](removeEntity(_0x4e8da4,null))[_0x8e2b('0x39')](handleError(_0x4e8da4,null));};exports[_0x8e2b('0x42')]=function(_0x23f75d,_0x155f2f){return db[_0x8e2b('0x22')]['describe']()[_0x8e2b('0x19')](respondWithResult(_0x155f2f,null))[_0x8e2b('0x39')](handleError(_0x155f2f,null));};exports[_0x8e2b('0x43')]=function(_0x488ec8,_0x1a5f25){var _0x55506a={'raw':!![],'where':{}},_0x3f188f={},_0x34e156;return db[_0x8e2b('0x22')][_0x8e2b('0x44')]({'where':{'id':_0x488ec8['params']['id']}})[_0x8e2b('0x19')](handleEntityNotFound(_0x1a5f25,null))[_0x8e2b('0x19')](function(_0x558bec){if(_0x558bec){_0x34e156=_0x558bec['get']({'plain':!![]});_0x3f188f[_0x8e2b('0x2e')]=_[_0x8e2b('0x2f')](db[_0x8e2b('0x45')][_0x8e2b('0x23')]);_0x3f188f['query']=_['keys'](_0x488ec8['query']);_0x3f188f[_0x8e2b('0x30')]=_[_0x8e2b('0x32')](_0x3f188f[_0x8e2b('0x2e')],_0x3f188f[_0x8e2b('0x29')]);_0x55506a['attributes']=_['intersection'](_0x3f188f[_0x8e2b('0x2e')],qs[_0x8e2b('0x33')](_0x488ec8['query']['fields']));_0x55506a['attributes']=_0x55506a[_0x8e2b('0x31')][_0x8e2b('0x34')]?_0x55506a[_0x8e2b('0x31')]:_0x3f188f[_0x8e2b('0x2e')];if(!_0x488ec8[_0x8e2b('0x29')][_0x8e2b('0x46')]('nolimit')){_0x55506a[_0x8e2b('0x11')]=qs['limit'](_0x488ec8['query'][_0x8e2b('0x11')]);_0x55506a[_0x8e2b('0x13')]=qs[_0x8e2b('0x13')](_0x488ec8[_0x8e2b('0x29')][_0x8e2b('0x13')]);}_0x55506a[_0x8e2b('0x47')]=qs[_0x8e2b('0x48')](_0x488ec8['query'][_0x8e2b('0x48')]);_0x55506a[_0x8e2b('0x27')]=qs[_0x8e2b('0x30')](_['pick'](_0x488ec8[_0x8e2b('0x29')],_0x3f188f[_0x8e2b('0x30')]));_0x55506a[_0x8e2b('0x27')]['MailQueueId']=_0x558bec['id'];if(_0x488ec8['query'][_0x8e2b('0x49')]){_0x55506a[_0x8e2b('0x27')]=_[_0x8e2b('0x36')](_0x55506a[_0x8e2b('0x27')],{'$or':_[_0x8e2b('0x21')](_0x55506a['attributes'],function(_0x2a4b9a){var _0x4a3882={};_0x4a3882[_0x2a4b9a]={'$like':'%'+_0x488ec8[_0x8e2b('0x29')][_0x8e2b('0x49')]+'%'};return _0x4a3882;})});}_0x55506a=_['merge']({},_0x55506a,_0x488ec8[_0x8e2b('0x37')]);return db[_0x8e2b('0x45')][_0x8e2b('0x2a')](_0x55506a);}})['then'](function(_0x5ad9ec){if(_0x5ad9ec){return db['User'][_0x8e2b('0x4a')]({'where':{'id':_['map'](_0x5ad9ec,_0x8e2b('0x4b')),'role':_0x8e2b('0x4c')},'attributes':['id','name',_0x8e2b('0x4d'),'updatedAt','createdAt']});}})[_0x8e2b('0x19')](function(_0x5c2d0e){if(_0x5c2d0e){return{'count':_0x5c2d0e[_0x8e2b('0x12')],'rows':_['map'](_0x5c2d0e[_0x8e2b('0x2b')],function(_0x3d1ff2){return{'membername':_0x3d1ff2[_0x8e2b('0x1f')],'UserId':_0x3d1ff2['id'],'queue_name':_0x34e156[_0x8e2b('0x1f')],'MailQueueId':_0x34e156['id'],'interface':util[_0x8e2b('0x4e')](_0x8e2b('0x4f'),'SIP',_0x3d1ff2[_0x8e2b('0x1f')]),'penalty':0x0,'paused':_0x3d1ff2[_0x8e2b('0x4d')],'createdAt':_0x3d1ff2[_0x8e2b('0x50')],'updatedAt':_0x3d1ff2[_0x8e2b('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1a5f25,_0x55506a))[_0x8e2b('0x39')](handleError(_0x1a5f25,null));};exports[_0x8e2b('0x52')]=function(_0x579928,_0xc3cfa6){var _0x3f600e={};var _0x322d25={};var _0x5f0ee6;var _0x56a2de;return db['MailQueue'][_0x8e2b('0x44')]({'where':{'id':_0x579928['params']['id']}})[_0x8e2b('0x19')](handleEntityNotFound(_0xc3cfa6,null))[_0x8e2b('0x19')](function(_0x7a505c){if(_0x7a505c){_0x5f0ee6=_0x7a505c;_0x322d25[_0x8e2b('0x2e')]=_[_0x8e2b('0x2f')](db[_0x8e2b('0x53')][_0x8e2b('0x23')]);_0x322d25[_0x8e2b('0x29')]=_['keys'](_0x579928['query']);_0x322d25['filters']=_['intersection'](_0x322d25[_0x8e2b('0x2e')],_0x322d25[_0x8e2b('0x29')]);_0x3f600e[_0x8e2b('0x31')]=_[_0x8e2b('0x32')](_0x322d25[_0x8e2b('0x2e')],qs[_0x8e2b('0x33')](_0x579928[_0x8e2b('0x29')]['fields']));_0x3f600e[_0x8e2b('0x31')]=_0x3f600e[_0x8e2b('0x31')][_0x8e2b('0x34')]?_0x3f600e['attributes']:_0x322d25[_0x8e2b('0x2e')];_0x3f600e['order']=qs[_0x8e2b('0x48')](_0x579928[_0x8e2b('0x29')]['sort']);_0x3f600e[_0x8e2b('0x27')]=qs[_0x8e2b('0x30')](_[_0x8e2b('0x54')](_0x579928[_0x8e2b('0x29')],_0x322d25[_0x8e2b('0x30')]));if(_0x579928[_0x8e2b('0x29')][_0x8e2b('0x49')]){_0x3f600e[_0x8e2b('0x27')]=_[_0x8e2b('0x36')](_0x3f600e['where'],{'$or':_['map'](_0x3f600e[_0x8e2b('0x31')],function(_0x265cc1){var _0x429832={};_0x429832[_0x265cc1]={'$like':'%'+_0x579928[_0x8e2b('0x29')][_0x8e2b('0x49')]+'%'};return _0x429832;})});}_0x3f600e=_[_0x8e2b('0x36')]({},_0x3f600e,_0x579928[_0x8e2b('0x37')]);return _0x5f0ee6[_0x8e2b('0x52')](_0x3f600e);}})[_0x8e2b('0x19')](function(_0x2f7278){if(_0x2f7278){_0x56a2de=_0x2f7278[_0x8e2b('0x34')];if(!_0x579928[_0x8e2b('0x29')]['hasOwnProperty'](_0x8e2b('0x55'))){_0x3f600e[_0x8e2b('0x11')]=qs[_0x8e2b('0x11')](_0x579928[_0x8e2b('0x29')]['limit']);_0x3f600e['offset']=qs[_0x8e2b('0x13')](_0x579928[_0x8e2b('0x29')][_0x8e2b('0x13')]);}return _0x5f0ee6[_0x8e2b('0x52')](_0x3f600e);}})['then'](function(_0x403f79){if(_0x403f79){return _0x403f79?{'count':_0x56a2de,'rows':_0x403f79}:null;}})['then'](respondWithResult(_0xc3cfa6,null))[_0x8e2b('0x39')](handleError(_0xc3cfa6,null));};exports[_0x8e2b('0x56')]=function(_0x370cf6,_0x3594cc){var _0x4b65d6=_0x370cf6[_0x8e2b('0x3b')][_0x8e2b('0x57')];return db[_0x8e2b('0x53')][_0x8e2b('0x2a')]({'where':{'id':_0x4b65d6},'attributes':['id'],'include':[{'model':db[_0x8e2b('0x58')],'as':_0x8e2b('0x59'),'attributes':['id',_0x8e2b('0x1f'),_0x8e2b('0x5a'),_0x8e2b('0x5b'),'interface'],'raw':!![]}]})[_0x8e2b('0x19')](function(_0x1b980e){if(_0x1b980e){var _0x34b05b=_['flatMap'](_0x1b980e,function(_0x2b56a6){var _0x260bb9=_0x2b56a6[_0x8e2b('0x1a')]({'plain':!![]});return _0x260bb9[_0x8e2b('0x59')];});return db['MailQueue']['find']({'where':{'id':_0x370cf6[_0x8e2b('0x2d')]['id']}})['then'](function(_0x30cfc5){return db[_0x8e2b('0x5c')][_0x8e2b('0x5d')](function(_0x5cb397){return _0x30cfc5[_0x8e2b('0x56')](_0x4b65d6,{'transaction':_0x5cb397})[_0x8e2b('0x19')](function(){return BPromise[_0x8e2b('0x5e')](_0x34b05b,function(_0x575ef1){return db[_0x8e2b('0x45')][_0x8e2b('0x5f')]({'where':{'UserId':_0x575ef1['id'],'MailQueueId':_0x370cf6[_0x8e2b('0x2d')]['id']},'transaction':_0x5cb397});});})['then'](function(){_0x34b05b[_0x8e2b('0x60')](function(_0x58f631){socket[_0x8e2b('0x61')](_0x8e2b('0x62'),{'UserId':_0x58f631['id'],'MailQueueId':_0x30cfc5['id']});});});});});}})[_0x8e2b('0x19')](respondWithStatusCode(_0x3594cc,null))['catch'](handleError(_0x3594cc,null));};exports[_0x8e2b('0x63')]=function(_0x198529,_0x42ddc8){return db['Team'][_0x8e2b('0x2a')]({'where':{'id':_0x198529[_0x8e2b('0x29')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8e2b('0x58')],'as':_0x8e2b('0x59'),'attributes':['id'],'raw':!![]}]})[_0x8e2b('0x19')](handleEntityNotFound(_0x42ddc8,null))[_0x8e2b('0x19')](function(_0x5b9892){var _0xdde1c5=_[_0x8e2b('0x21')](_0x5b9892,'id');var _0x35a638=[];var _0x25d8b8=[];var _0x4c76c7=squel[_0x8e2b('0x64')]();_0x4c76c7['field'](_0x8e2b('0x65'))[_0x8e2b('0x66')]('team_has_mail_queues','tq')['join'](_0x8e2b('0x67'),'ut',_0x8e2b('0x68'))['where'](_0x8e2b('0x69'),_0x198529[_0x8e2b('0x2d')]['id']);for(var _0x3e3280=0x0;_0x3e3280<_0x5b9892[_0x8e2b('0x34')];_0x3e3280+=0x1){let _0x55f7cd=_0x5b9892[_0x3e3280];for(var _0x498bd0=0x0;_0x498bd0<_0x55f7cd[_0x8e2b('0x59')]['length'];_0x498bd0+=0x1){let _0x408e5f=_0x55f7cd['Agents'][_0x498bd0];var _0x412f15=_0x4c76c7[_0x8e2b('0x6a')]();_0x412f15[_0x8e2b('0x27')]('ut.UserId\x20=\x20?',_0x408e5f['id']);_0x25d8b8['push'](db[_0x8e2b('0x5c')][_0x8e2b('0x29')](_0x412f15[_0x8e2b('0x6b')](),{'type':db[_0x8e2b('0x5c')]['QueryTypes']['SELECT']})[_0x8e2b('0x19')](function(_0x2cb111){if(_0x2cb111[_0x8e2b('0x34')]===0x1){return _0x408e5f['id'];}else{var _0x18e9b2=_['every'](_[_0x8e2b('0x21')](_0x2cb111,'TeamId'),function(_0x48e80b){return _[_0x8e2b('0x6c')](_0xdde1c5,_0x48e80b);});if(_0x18e9b2){return _0x408e5f['id'];}}}));}}return BPromise['all'](_0x25d8b8)[_0x8e2b('0x19')](function(_0x491da8){_0x35a638=_(_0x35a638)[_0x8e2b('0x6d')](_0x491da8)[_0x8e2b('0x6e')]()[_0x8e2b('0x6f')]();return db[_0x8e2b('0x22')][_0x8e2b('0x38')]({'where':{'id':_0x198529['params']['id']}})[_0x8e2b('0x19')](function(_0x2a1298){return db[_0x8e2b('0x5c')]['transaction'](function(_0x80ff36){return _0x2a1298[_0x8e2b('0x63')](_0x198529['query'][_0x8e2b('0x57')],{'transaction':_0x80ff36})['then'](function(){if(!_[_0x8e2b('0x70')](_0x35a638)){return _0x2a1298[_0x8e2b('0x71')](_0x35a638,{'transaction':_0x80ff36});}})[_0x8e2b('0x19')](function(){_0x35a638[_0x8e2b('0x60')](function(_0xd98790){socket['emit'](_0x8e2b('0x72'),{'UserId':_0xd98790,'MailQueueId':_0x2a1298['id']});});});});});});})[_0x8e2b('0x19')](respondWithStatusCode(_0x42ddc8,null))['catch'](handleError(_0x42ddc8,null));};exports['addAgents']=function(_0x300413,_0x154d40){return db[_0x8e2b('0x22')][_0x8e2b('0x38')]({'where':{'id':_0x300413[_0x8e2b('0x2d')]['id']}})[_0x8e2b('0x19')](handleEntityNotFound(_0x154d40,null))[_0x8e2b('0x19')](function(_0x4bc8db){if(_0x4bc8db){return _0x4bc8db[_0x8e2b('0x73')](_0x300413[_0x8e2b('0x3b')][_0x8e2b('0x57')],_[_0x8e2b('0x74')](_0x300413[_0x8e2b('0x3b')],['ids','id'])||{})[_0x8e2b('0x75')](function(_0x28ef80){for(var _0x36bfbe=0x0;_0x36bfbe<_0x300413[_0x8e2b('0x3b')][_0x8e2b('0x57')][_0x8e2b('0x34')];_0x36bfbe+=0x1){socket[_0x8e2b('0x61')](_0x8e2b('0x62'),{'UserId':Number(_0x300413['body'][_0x8e2b('0x57')][_0x36bfbe]),'MailQueueId':Number(_0x300413[_0x8e2b('0x2d')]['id'])});}return _0x28ef80;});}})[_0x8e2b('0x19')](respondWithResult(_0x154d40,null))[_0x8e2b('0x39')](handleError(_0x154d40,null));};exports[_0x8e2b('0x71')]=function(_0x3b08b3,_0x4d5655){return db[_0x8e2b('0x22')][_0x8e2b('0x38')]({'where':{'id':_0x3b08b3[_0x8e2b('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4d5655,null))[_0x8e2b('0x19')](function(_0x4776b4){if(_0x4776b4){return _0x4776b4[_0x8e2b('0x71')](_0x3b08b3['query'][_0x8e2b('0x57')])[_0x8e2b('0x19')](function(){if(_[_0x8e2b('0x76')](_0x3b08b3[_0x8e2b('0x29')][_0x8e2b('0x57')])){for(var _0x8ee0a9=0x0;_0x8ee0a9<_0x3b08b3[_0x8e2b('0x29')]['ids']['length'];_0x8ee0a9+=0x1){socket[_0x8e2b('0x61')](_0x8e2b('0x72'),{'UserId':Number(_0x3b08b3[_0x8e2b('0x29')][_0x8e2b('0x57')][_0x8ee0a9]),'MailQueueId':Number(_0x3b08b3['params']['id'])});}}else{socket[_0x8e2b('0x61')](_0x8e2b('0x72'),{'UserId':Number(_0x3b08b3['query'][_0x8e2b('0x57')]),'MailQueueId':Number(_0x3b08b3[_0x8e2b('0x2d')]['id'])});}});}})[_0x8e2b('0x19')](respondWithStatusCode(_0x4d5655,null))[_0x8e2b('0x39')](handleError(_0x4d5655,null));};exports[_0x8e2b('0x77')]=function(_0x2b4662,_0x2ed0f2){var _0x96c523={};var _0x37eda7={};var _0x106f4c;var _0x524604;return db['MailQueue'][_0x8e2b('0x44')]({'where':{'id':_0x2b4662[_0x8e2b('0x2d')]['id']}})[_0x8e2b('0x19')](handleEntityNotFound(_0x2ed0f2,null))[_0x8e2b('0x19')](function(_0x559813){if(_0x559813){_0x106f4c=_0x559813;_0x37eda7[_0x8e2b('0x2e')]=_[_0x8e2b('0x2f')](db[_0x8e2b('0x58')][_0x8e2b('0x23')]);_0x37eda7[_0x8e2b('0x29')]=_['keys'](_0x2b4662['query']);_0x37eda7[_0x8e2b('0x30')]=_[_0x8e2b('0x32')](_0x37eda7[_0x8e2b('0x2e')],_0x37eda7[_0x8e2b('0x29')]);_0x96c523[_0x8e2b('0x31')]=_[_0x8e2b('0x32')](_0x37eda7['model'],qs[_0x8e2b('0x33')](_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x33')]));_0x96c523[_0x8e2b('0x31')]=_0x96c523['attributes'][_0x8e2b('0x34')]?_0x96c523[_0x8e2b('0x31')]:_0x37eda7[_0x8e2b('0x2e')];_0x96c523[_0x8e2b('0x47')]=qs[_0x8e2b('0x48')](_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x48')]);_0x96c523[_0x8e2b('0x27')]=qs['filters'](_[_0x8e2b('0x54')](_0x2b4662['query'],_0x37eda7[_0x8e2b('0x30')]));if(_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x49')]){_0x96c523[_0x8e2b('0x27')]=_['merge'](_0x96c523[_0x8e2b('0x27')],{'$or':_[_0x8e2b('0x21')](_0x96c523[_0x8e2b('0x31')],function(_0x422f5e){var _0x3d78ae={};_0x3d78ae[_0x422f5e]={'$like':'%'+_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x49')]+'%'};return _0x3d78ae;})});}_0x96c523=_[_0x8e2b('0x36')]({},_0x96c523,_0x2b4662['options']);return _0x106f4c[_0x8e2b('0x77')](_0x96c523);}})[_0x8e2b('0x19')](function(_0x5e0227){if(_0x5e0227){_0x524604=_0x5e0227['length'];if(!_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x46')](_0x8e2b('0x55'))){_0x96c523['limit']=qs['limit'](_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x11')]);_0x96c523[_0x8e2b('0x13')]=qs[_0x8e2b('0x13')](_0x2b4662[_0x8e2b('0x29')][_0x8e2b('0x13')]);}return _0x106f4c[_0x8e2b('0x77')](_0x96c523);}})['then'](function(_0x2a8393){if(_0x2a8393){return _0x2a8393?{'count':_0x524604,'rows':_0x2a8393}:null;}})[_0x8e2b('0x19')](respondWithResult(_0x2ed0f2,null))[_0x8e2b('0x39')](handleError(_0x2ed0f2,null));}; \ No newline at end of file +var _0x470f=['rawAttributes','length','getTeams','addTeams','ids','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MailQueues','destroy','error','stack','name','send','index','map','MailQueue','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','model','filters','attributes','fields','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','keys','UserMailQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','merge','findAll','User','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','Team'];(function(_0x266294,_0x4abaee){var _0x1d1ac2=function(_0xfe909d){while(--_0xfe909d){_0x266294['push'](_0x266294['shift']());}};_0x1d1ac2(++_0x4abaee);}(_0x470f,0x193));var _0xf470=function(_0xa0c9a4,_0x2299cd){_0xa0c9a4=_0xa0c9a4-0x0;var _0x4d6c9e=_0x470f[_0xa0c9a4];return _0x4d6c9e;};'use strict';var BPromise=require(_0xf470('0x0'));var util=require('util');var _=require(_0xf470('0x1'));var squel=require(_0xf470('0x2'));var Redis=require(_0xf470('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xf470('0x4'))(_0xf470('0x5'));var config=require(_0xf470('0x6'));var db=require('../../mysqldb')['db'];config[_0xf470('0x7')]=_[_0xf470('0x8')](config[_0xf470('0x7')],{'host':_0xf470('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0xf470('0xa')](socket);function respondWithStatusCode(_0x359039,_0x3b3625){_0x3b3625=_0x3b3625||0xcc;return function(_0x39c727){if(_0x39c727){return _0x359039[_0xf470('0xb')](_0x3b3625);}return _0x359039['status'](_0x3b3625)[_0xf470('0xc')]();};}function respondWithResult(_0x468bdf,_0x5a38be){_0x5a38be=_0x5a38be||0xc8;return function(_0x3b197b){if(_0x3b197b){return _0x468bdf[_0xf470('0xd')](_0x5a38be)[_0xf470('0xe')](_0x3b197b);}};}function respondWithFilteredResult(_0x48b9b9,_0x113592){return function(_0x2b388b){if(_0x2b388b){var _0xb1d08d=typeof _0x113592[_0xf470('0xf')]==='undefined'&&typeof _0x113592['limit']===_0xf470('0x10');var _0xd1b4a4=_0x2b388b['count'];var _0x17050e=_0xb1d08d?0x0:_0x113592['offset'];var _0x29c0bd=_0xb1d08d?_0x2b388b[_0xf470('0x11')]:_0x113592[_0xf470('0xf')]+_0x113592[_0xf470('0x12')];var _0x4c04b3;if(_0x29c0bd>=_0xd1b4a4){_0x29c0bd=_0xd1b4a4;_0x4c04b3=0xc8;}else{_0x4c04b3=0xce;}_0x48b9b9['status'](_0x4c04b3);return _0x48b9b9[_0xf470('0x13')](_0xf470('0x14'),_0x17050e+'-'+_0x29c0bd+'/'+_0xd1b4a4)['json'](_0x2b388b);}return null;};}function saveUpdates(_0x59f353){return function(_0x2e2317){if(_0x2e2317){return _0x2e2317[_0xf470('0x15')](_0x59f353)['then'](function(_0x3d17bd){return _0x3d17bd;});}return null;};}function removeEntity(_0x4c25d1){return function(_0x14f0cc){if(_0x14f0cc){return _0x14f0cc['destroy']()[_0xf470('0x16')](function(){var _0x14caab=_0x14f0cc[_0xf470('0x17')]({'plain':!![]});var _0xee43f7=_0xf470('0x18');return db['UserProfileResource'][_0xf470('0x19')]({'where':{'type':_0xee43f7,'resourceId':_0x14caab['id']}})[_0xf470('0x16')](function(){return _0x14f0cc;});})[_0xf470('0x16')](function(){_0x4c25d1['status'](0xcc)[_0xf470('0xc')]();});}};}function handleEntityNotFound(_0x23e447){return function(_0xb328ed){if(!_0xb328ed){_0x23e447[_0xf470('0xb')](0x194);}return _0xb328ed;};}function handleError(_0x5b7786,_0x110d4a){_0x110d4a=_0x110d4a||0x1f4;return function(_0x306277){logger[_0xf470('0x1a')](_0x306277[_0xf470('0x1b')]);if(_0x306277[_0xf470('0x1c')]){delete _0x306277[_0xf470('0x1c')];}_0x5b7786['status'](_0x110d4a)[_0xf470('0x1d')](_0x306277);};}exports[_0xf470('0x1e')]=function(_0x3cd1d2,_0x215658){var _0x4046c5={};var _0x11ab80={'count':0x0,'rows':[]};var _0x1de190=_[_0xf470('0x1f')](db[_0xf470('0x20')]['rawAttributes'],function(_0x1d13d9){return{'name':_0x1d13d9[_0xf470('0x21')],'type':_0x1d13d9[_0xf470('0x22')][_0xf470('0x23')]};});_0x4046c5=qs[_0xf470('0x24')](_0x1de190,_0x3cd1d2);var _0x48e5d4={'where':_0x4046c5[_0xf470('0x25')]};return db[_0xf470('0x20')]['count'](_0x48e5d4)[_0xf470('0x16')](function(_0x30ec24){_0x11ab80[_0xf470('0x11')]=_0x30ec24;_0x4046c5[_0xf470('0x26')]=qs[_0xf470('0x26')](_0x3cd1d2[_0xf470('0x27')]);return db['MailQueue']['findAll'](_0x4046c5);})[_0xf470('0x16')](function(_0x4cd027){_0x11ab80[_0xf470('0x28')]=_0x4cd027;return _0x11ab80;})['then'](respondWithFilteredResult(_0x215658,_0x4046c5))[_0xf470('0x29')](handleError(_0x215658,null));};exports[_0xf470('0x2a')]=function(_0x440cda,_0x8cfe54){var _0x47314d={'raw':!![],'where':{'id':_0x440cda[_0xf470('0x2b')]['id']}},_0x214338={};_0x214338[_0xf470('0x2c')]=_['keys'](db['MailQueue']['rawAttributes']);_0x214338[_0xf470('0x27')]=_['keys'](_0x440cda[_0xf470('0x27')]);_0x214338[_0xf470('0x2d')]=_['intersection'](_0x214338[_0xf470('0x2c')],_0x214338[_0xf470('0x27')]);_0x47314d[_0xf470('0x2e')]=_['intersection'](_0x214338[_0xf470('0x2c')],qs[_0xf470('0x2f')](_0x440cda[_0xf470('0x27')]['fields']));_0x47314d[_0xf470('0x2e')]=_0x47314d['attributes']['length']?_0x47314d['attributes']:_0x214338[_0xf470('0x2c')];if(_0x440cda[_0xf470('0x27')][_0xf470('0x30')]){_0x47314d[_0xf470('0x26')]=[{'all':!![]}];}_0x47314d=_['merge']({},_0x47314d,_0x440cda[_0xf470('0x31')]);return db[_0xf470('0x20')][_0xf470('0x32')](_0x47314d)[_0xf470('0x16')](handleEntityNotFound(_0x8cfe54,null))['then'](respondWithResult(_0x8cfe54,null))[_0xf470('0x29')](handleError(_0x8cfe54,null));};exports['create']=function(_0x5e6d65,_0x401faf){return db[_0xf470('0x20')][_0xf470('0x33')](_0x5e6d65[_0xf470('0x34')],{})[_0xf470('0x16')](function(_0x4f9960){var _0x1dc0ef=_0x5e6d65[_0xf470('0x35')][_0xf470('0x17')]({'plain':!![]});if(!_0x1dc0ef)throw new Error(_0xf470('0x36'));if(_0x1dc0ef[_0xf470('0x37')]===_0xf470('0x35')){var _0x5a3063=_0x4f9960[_0xf470('0x17')]({'plain':!![]});var _0xf94d2d=_0xf470('0x18');return db[_0xf470('0x38')][_0xf470('0x32')]({'where':{'name':_0xf94d2d,'userProfileId':_0x1dc0ef[_0xf470('0x39')]},'raw':!![]})[_0xf470('0x16')](function(_0x138ab4){if(_0x138ab4&&_0x138ab4['autoAssociation']===0x0){return db[_0xf470('0x3a')][_0xf470('0x33')]({'name':_0x5a3063[_0xf470('0x1c')],'resourceId':_0x5a3063['id'],'type':_0x138ab4[_0xf470('0x1c')],'sectionId':_0x138ab4['id']},{})[_0xf470('0x16')](function(){return _0x4f9960;});}else{return _0x4f9960;}})[_0xf470('0x29')](function(_0x4e02e3){logger[_0xf470('0x1a')](_0xf470('0x3b'),_0x4e02e3);throw _0x4e02e3;});}return _0x4f9960;})[_0xf470('0x16')](respondWithResult(_0x401faf,0xc9))['catch'](handleError(_0x401faf,null));};exports[_0xf470('0x15')]=function(_0x2a4ead,_0x5d1896){if(_0x2a4ead[_0xf470('0x34')]['id']){delete _0x2a4ead[_0xf470('0x34')]['id'];}return db[_0xf470('0x20')][_0xf470('0x32')]({'where':{'id':_0x2a4ead[_0xf470('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d1896,null))[_0xf470('0x16')](saveUpdates(_0x2a4ead[_0xf470('0x34')],null))[_0xf470('0x16')](respondWithResult(_0x5d1896,null))[_0xf470('0x29')](handleError(_0x5d1896,null));};exports['destroy']=function(_0x67897d,_0x56be18){return db[_0xf470('0x20')]['find']({'where':{'id':_0x67897d[_0xf470('0x2b')]['id']}})['then'](handleEntityNotFound(_0x56be18,null))[_0xf470('0x16')](removeEntity(_0x56be18,null))['catch'](handleError(_0x56be18,null));};exports[_0xf470('0x3c')]=function(_0x1f63ae,_0x2abc9e){return db[_0xf470('0x20')][_0xf470('0x3c')]()[_0xf470('0x16')](respondWithResult(_0x2abc9e,null))[_0xf470('0x29')](handleError(_0x2abc9e,null));};exports[_0xf470('0x3d')]=function(_0x1c7ded,_0x9f3ce2){var _0x5c605d={'raw':!![],'where':{}},_0x2f75bf={},_0x6f2a46;return db[_0xf470('0x20')][_0xf470('0x3e')]({'where':{'id':_0x1c7ded[_0xf470('0x2b')]['id']}})[_0xf470('0x16')](handleEntityNotFound(_0x9f3ce2,null))['then'](function(_0x50c5c0){if(_0x50c5c0){_0x6f2a46=_0x50c5c0[_0xf470('0x17')]({'plain':!![]});_0x2f75bf[_0xf470('0x2c')]=_[_0xf470('0x3f')](db[_0xf470('0x40')]['rawAttributes']);_0x2f75bf[_0xf470('0x27')]=_[_0xf470('0x3f')](_0x1c7ded['query']);_0x2f75bf['filters']=_[_0xf470('0x41')](_0x2f75bf['model'],_0x2f75bf[_0xf470('0x27')]);_0x5c605d[_0xf470('0x2e')]=_['intersection'](_0x2f75bf[_0xf470('0x2c')],qs[_0xf470('0x2f')](_0x1c7ded[_0xf470('0x27')][_0xf470('0x2f')]));_0x5c605d[_0xf470('0x2e')]=_0x5c605d['attributes']['length']?_0x5c605d[_0xf470('0x2e')]:_0x2f75bf[_0xf470('0x2c')];if(!_0x1c7ded[_0xf470('0x27')][_0xf470('0x42')](_0xf470('0x43'))){_0x5c605d['limit']=qs[_0xf470('0x12')](_0x1c7ded[_0xf470('0x27')][_0xf470('0x12')]);_0x5c605d['offset']=qs[_0xf470('0xf')](_0x1c7ded['query'][_0xf470('0xf')]);}_0x5c605d[_0xf470('0x44')]=qs[_0xf470('0x45')](_0x1c7ded[_0xf470('0x27')][_0xf470('0x45')]);_0x5c605d[_0xf470('0x25')]=qs['filters'](_[_0xf470('0x46')](_0x1c7ded[_0xf470('0x27')],_0x2f75bf[_0xf470('0x2d')]));_0x5c605d[_0xf470('0x25')][_0xf470('0x47')]=_0x50c5c0['id'];if(_0x1c7ded[_0xf470('0x27')][_0xf470('0x48')]){_0x5c605d[_0xf470('0x25')]=_[_0xf470('0x49')](_0x5c605d[_0xf470('0x25')],{'$or':_[_0xf470('0x1f')](_0x5c605d[_0xf470('0x2e')],function(_0x1a44e7){var _0x30f8b9={};_0x30f8b9[_0x1a44e7]={'$like':'%'+_0x1c7ded[_0xf470('0x27')][_0xf470('0x48')]+'%'};return _0x30f8b9;})});}_0x5c605d=_[_0xf470('0x49')]({},_0x5c605d,_0x1c7ded[_0xf470('0x31')]);return db[_0xf470('0x40')][_0xf470('0x4a')](_0x5c605d);}})[_0xf470('0x16')](function(_0x26550a){if(_0x26550a){return db[_0xf470('0x4b')][_0xf470('0x4c')]({'where':{'id':_['map'](_0x26550a,_0xf470('0x4d')),'role':_0xf470('0x4e')},'attributes':['id',_0xf470('0x1c'),_0xf470('0x4f'),'updatedAt',_0xf470('0x50')]});}})[_0xf470('0x16')](function(_0xb8c7e0){if(_0xb8c7e0){return{'count':_0xb8c7e0[_0xf470('0x11')],'rows':_['map'](_0xb8c7e0['rows'],function(_0x4e5920){return{'membername':_0x4e5920[_0xf470('0x1c')],'UserId':_0x4e5920['id'],'queue_name':_0x6f2a46['name'],'MailQueueId':_0x6f2a46['id'],'interface':util['format'](_0xf470('0x51'),_0xf470('0x52'),_0x4e5920['name']),'penalty':0x0,'paused':_0x4e5920[_0xf470('0x4f')],'createdAt':_0x4e5920[_0xf470('0x50')],'updatedAt':_0x4e5920[_0xf470('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf470('0x16')](respondWithFilteredResult(_0x9f3ce2,_0x5c605d))[_0xf470('0x29')](handleError(_0x9f3ce2,null));};exports['getTeams']=function(_0x28f900,_0x5e7e5a){var _0x23c553={};var _0x197270={};var _0x54f4b6;var _0x3c8759;return db[_0xf470('0x20')][_0xf470('0x3e')]({'where':{'id':_0x28f900[_0xf470('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5e7e5a,null))['then'](function(_0x4a23a5){if(_0x4a23a5){_0x54f4b6=_0x4a23a5;_0x197270[_0xf470('0x2c')]=_[_0xf470('0x3f')](db[_0xf470('0x54')][_0xf470('0x55')]);_0x197270['query']=_['keys'](_0x28f900[_0xf470('0x27')]);_0x197270[_0xf470('0x2d')]=_[_0xf470('0x41')](_0x197270[_0xf470('0x2c')],_0x197270[_0xf470('0x27')]);_0x23c553['attributes']=_[_0xf470('0x41')](_0x197270[_0xf470('0x2c')],qs[_0xf470('0x2f')](_0x28f900[_0xf470('0x27')]['fields']));_0x23c553[_0xf470('0x2e')]=_0x23c553[_0xf470('0x2e')][_0xf470('0x56')]?_0x23c553[_0xf470('0x2e')]:_0x197270[_0xf470('0x2c')];_0x23c553[_0xf470('0x44')]=qs[_0xf470('0x45')](_0x28f900[_0xf470('0x27')][_0xf470('0x45')]);_0x23c553['where']=qs[_0xf470('0x2d')](_['pick'](_0x28f900[_0xf470('0x27')],_0x197270[_0xf470('0x2d')]));if(_0x28f900[_0xf470('0x27')][_0xf470('0x48')]){_0x23c553['where']=_[_0xf470('0x49')](_0x23c553[_0xf470('0x25')],{'$or':_['map'](_0x23c553['attributes'],function(_0x400712){var _0x4a444d={};_0x4a444d[_0x400712]={'$like':'%'+_0x28f900[_0xf470('0x27')]['filter']+'%'};return _0x4a444d;})});}_0x23c553=_[_0xf470('0x49')]({},_0x23c553,_0x28f900[_0xf470('0x31')]);return _0x54f4b6[_0xf470('0x57')](_0x23c553);}})[_0xf470('0x16')](function(_0xa738f1){if(_0xa738f1){_0x3c8759=_0xa738f1[_0xf470('0x56')];if(!_0x28f900[_0xf470('0x27')][_0xf470('0x42')](_0xf470('0x43'))){_0x23c553['limit']=qs[_0xf470('0x12')](_0x28f900[_0xf470('0x27')][_0xf470('0x12')]);_0x23c553[_0xf470('0xf')]=qs[_0xf470('0xf')](_0x28f900[_0xf470('0x27')][_0xf470('0xf')]);}return _0x54f4b6[_0xf470('0x57')](_0x23c553);}})[_0xf470('0x16')](function(_0x55e3eb){if(_0x55e3eb){return _0x55e3eb?{'count':_0x3c8759,'rows':_0x55e3eb}:null;}})[_0xf470('0x16')](respondWithResult(_0x5e7e5a,null))[_0xf470('0x29')](handleError(_0x5e7e5a,null));};exports[_0xf470('0x58')]=function(_0x3e91ca,_0x455a99){var _0x1c3228=_0x3e91ca['body'][_0xf470('0x59')];return db['Team'][_0xf470('0x4a')]({'where':{'id':_0x1c3228},'attributes':['id'],'include':[{'model':db[_0xf470('0x4b')],'as':'Agents','attributes':['id',_0xf470('0x1c'),'online','voicePause',_0xf470('0x5a')],'raw':!![]}]})[_0xf470('0x16')](function(_0x39cebb){if(_0x39cebb){var _0x4ca190=_[_0xf470('0x5b')](_0x39cebb,function(_0x8f0552){var _0x994d4=_0x8f0552[_0xf470('0x17')]({'plain':!![]});return _0x994d4[_0xf470('0x5c')];});return db[_0xf470('0x20')][_0xf470('0x32')]({'where':{'id':_0x3e91ca[_0xf470('0x2b')]['id']}})['then'](function(_0x54205e){return db[_0xf470('0x5d')][_0xf470('0x5e')](function(_0x4112e7){return _0x54205e[_0xf470('0x58')](_0x1c3228,{'transaction':_0x4112e7})[_0xf470('0x16')](function(){return BPromise[_0xf470('0x5f')](_0x4ca190,function(_0x3c413c){return db[_0xf470('0x40')][_0xf470('0x60')]({'where':{'UserId':_0x3c413c['id'],'MailQueueId':_0x3e91ca[_0xf470('0x2b')]['id']},'transaction':_0x4112e7});});})[_0xf470('0x16')](function(){_0x4ca190[_0xf470('0x61')](function(_0x25f142){socket[_0xf470('0x62')](_0xf470('0x63'),{'UserId':_0x25f142['id'],'MailQueueId':_0x54205e['id']});});});});});}})[_0xf470('0x16')](respondWithStatusCode(_0x455a99,null))[_0xf470('0x29')](handleError(_0x455a99,null));};exports['removeTeams']=function(_0x2ae843,_0x1e5229){return db['Team'][_0xf470('0x4a')]({'where':{'id':_0x2ae843[_0xf470('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf470('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1e5229,null))['then'](function(_0x4d8035){var _0x4801dd=_[_0xf470('0x1f')](_0x4d8035,'id');var _0x4fcbe1=[];var _0x110713=[];var _0x402bbd=squel['select']();_0x402bbd['field'](_0xf470('0x64'))['from']('team_has_mail_queues','tq')[_0xf470('0x65')]('user_has_teams','ut',_0xf470('0x66'))[_0xf470('0x25')](_0xf470('0x67'),_0x2ae843['params']['id']);for(var _0x40345b=0x0;_0x40345b<_0x4d8035[_0xf470('0x56')];_0x40345b+=0x1){let _0x45085d=_0x4d8035[_0x40345b];for(var _0x5c83e1=0x0;_0x5c83e1<_0x45085d[_0xf470('0x5c')][_0xf470('0x56')];_0x5c83e1+=0x1){let _0x94e931=_0x45085d['Agents'][_0x5c83e1];var _0x405af5=_0x402bbd[_0xf470('0x68')]();_0x405af5[_0xf470('0x25')]('ut.UserId\x20=\x20?',_0x94e931['id']);_0x110713[_0xf470('0x69')](db[_0xf470('0x5d')][_0xf470('0x27')](_0x405af5[_0xf470('0x6a')](),{'type':db[_0xf470('0x5d')][_0xf470('0x6b')]['SELECT']})[_0xf470('0x16')](function(_0x10b5ee){if(_0x10b5ee[_0xf470('0x56')]===0x1){return _0x94e931['id'];}else{var _0x401e1e=_['every'](_['map'](_0x10b5ee,_0xf470('0x6c')),function(_0x19fbf5){return _[_0xf470('0x6d')](_0x4801dd,_0x19fbf5);});if(_0x401e1e){return _0x94e931['id'];}}}));}}return BPromise[_0xf470('0x6e')](_0x110713)[_0xf470('0x16')](function(_0x3469b7){_0x4fcbe1=_(_0x4fcbe1)[_0xf470('0x6f')](_0x3469b7)['compact']()[_0xf470('0x70')]();return db[_0xf470('0x20')][_0xf470('0x32')]({'where':{'id':_0x2ae843[_0xf470('0x2b')]['id']}})['then'](function(_0xf700f7){return db['sequelize'][_0xf470('0x5e')](function(_0x156d03){return _0xf700f7[_0xf470('0x71')](_0x2ae843[_0xf470('0x27')][_0xf470('0x59')],{'transaction':_0x156d03})['then'](function(){if(!_[_0xf470('0x72')](_0x4fcbe1)){return _0xf700f7[_0xf470('0x73')](_0x4fcbe1,{'transaction':_0x156d03});}})[_0xf470('0x16')](function(){_0x4fcbe1[_0xf470('0x61')](function(_0x3020f1){socket['emit'](_0xf470('0x74'),{'UserId':_0x3020f1,'MailQueueId':_0xf700f7['id']});});});});});});})['then'](respondWithStatusCode(_0x1e5229,null))[_0xf470('0x29')](handleError(_0x1e5229,null));};exports[_0xf470('0x75')]=function(_0x36ab75,_0x28f077){return db['MailQueue'][_0xf470('0x32')]({'where':{'id':_0x36ab75['params']['id']}})[_0xf470('0x16')](handleEntityNotFound(_0x28f077,null))[_0xf470('0x16')](function(_0x49690b){if(_0x49690b){return _0x49690b[_0xf470('0x75')](_0x36ab75[_0xf470('0x34')][_0xf470('0x59')],_[_0xf470('0x76')](_0x36ab75[_0xf470('0x34')],[_0xf470('0x59'),'id'])||{})[_0xf470('0x77')](function(_0x5e1eca){for(var _0x124179=0x0;_0x124179<_0x36ab75[_0xf470('0x34')][_0xf470('0x59')]['length'];_0x124179+=0x1){socket[_0xf470('0x62')](_0xf470('0x63'),{'UserId':Number(_0x36ab75[_0xf470('0x34')][_0xf470('0x59')][_0x124179]),'MailQueueId':Number(_0x36ab75['params']['id'])});}return _0x5e1eca;});}})[_0xf470('0x16')](respondWithResult(_0x28f077,null))[_0xf470('0x29')](handleError(_0x28f077,null));};exports[_0xf470('0x73')]=function(_0x3e6f95,_0x185554){return db[_0xf470('0x20')][_0xf470('0x32')]({'where':{'id':_0x3e6f95[_0xf470('0x2b')]['id']}})[_0xf470('0x16')](handleEntityNotFound(_0x185554,null))[_0xf470('0x16')](function(_0x3fb2aa){if(_0x3fb2aa){return _0x3fb2aa['removeAgents'](_0x3e6f95['query'][_0xf470('0x59')])[_0xf470('0x16')](function(){if(_[_0xf470('0x78')](_0x3e6f95[_0xf470('0x27')][_0xf470('0x59')])){for(var _0x473b5d=0x0;_0x473b5d<_0x3e6f95[_0xf470('0x27')]['ids']['length'];_0x473b5d+=0x1){socket['emit'](_0xf470('0x74'),{'UserId':Number(_0x3e6f95[_0xf470('0x27')][_0xf470('0x59')][_0x473b5d]),'MailQueueId':Number(_0x3e6f95[_0xf470('0x2b')]['id'])});}}else{socket['emit'](_0xf470('0x74'),{'UserId':Number(_0x3e6f95['query'][_0xf470('0x59')]),'MailQueueId':Number(_0x3e6f95[_0xf470('0x2b')]['id'])});}});}})[_0xf470('0x16')](respondWithStatusCode(_0x185554,null))[_0xf470('0x29')](handleError(_0x185554,null));};exports['getAgents']=function(_0x3734dd,_0x3bbca6){var _0x41dc07={};var _0x22128f={};var _0x573e38;var _0x5c1a64;return db[_0xf470('0x20')]['findOne']({'where':{'id':_0x3734dd['params']['id']}})['then'](handleEntityNotFound(_0x3bbca6,null))[_0xf470('0x16')](function(_0x4865a0){if(_0x4865a0){_0x573e38=_0x4865a0;_0x22128f[_0xf470('0x2c')]=_[_0xf470('0x3f')](db[_0xf470('0x4b')][_0xf470('0x55')]);_0x22128f[_0xf470('0x27')]=_[_0xf470('0x3f')](_0x3734dd[_0xf470('0x27')]);_0x22128f['filters']=_['intersection'](_0x22128f[_0xf470('0x2c')],_0x22128f[_0xf470('0x27')]);_0x41dc07[_0xf470('0x2e')]=_[_0xf470('0x41')](_0x22128f[_0xf470('0x2c')],qs[_0xf470('0x2f')](_0x3734dd[_0xf470('0x27')][_0xf470('0x2f')]));_0x41dc07['attributes']=_0x41dc07[_0xf470('0x2e')][_0xf470('0x56')]?_0x41dc07[_0xf470('0x2e')]:_0x22128f[_0xf470('0x2c')];_0x41dc07[_0xf470('0x44')]=qs[_0xf470('0x45')](_0x3734dd['query'][_0xf470('0x45')]);_0x41dc07[_0xf470('0x25')]=qs[_0xf470('0x2d')](_[_0xf470('0x46')](_0x3734dd[_0xf470('0x27')],_0x22128f['filters']));if(_0x3734dd[_0xf470('0x27')]['filter']){_0x41dc07[_0xf470('0x25')]=_['merge'](_0x41dc07[_0xf470('0x25')],{'$or':_['map'](_0x41dc07['attributes'],function(_0x255606){var _0xd78bd5={};_0xd78bd5[_0x255606]={'$like':'%'+_0x3734dd[_0xf470('0x27')]['filter']+'%'};return _0xd78bd5;})});}_0x41dc07=_[_0xf470('0x49')]({},_0x41dc07,_0x3734dd[_0xf470('0x31')]);return _0x573e38['getAgents'](_0x41dc07);}})[_0xf470('0x16')](function(_0x1a72d4){if(_0x1a72d4){_0x5c1a64=_0x1a72d4[_0xf470('0x56')];if(!_0x3734dd[_0xf470('0x27')][_0xf470('0x42')]('nolimit')){_0x41dc07[_0xf470('0x12')]=qs[_0xf470('0x12')](_0x3734dd[_0xf470('0x27')]['limit']);_0x41dc07[_0xf470('0xf')]=qs['offset'](_0x3734dd['query']['offset']);}return _0x573e38[_0xf470('0x79')](_0x41dc07);}})[_0xf470('0x16')](function(_0x50dec7){if(_0x50dec7){return _0x50dec7?{'count':_0x5c1a64,'rows':_0x50dec7}:null;}})['then'](respondWithResult(_0x3bbca6,null))[_0xf470('0x29')](handleError(_0x3bbca6,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index e32a576..8f3e454 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 _0xe00b=['hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x23f19e,_0x4d583b){var _0x2a95d4=function(_0x5bb558){while(--_0x5bb558){_0x23f19e['push'](_0x23f19e['shift']());}};_0x2a95d4(++_0x4d583b);}(_0xe00b,0x160));var _0xbe00=function(_0x304c7b,_0xa9dca2){_0x304c7b=_0x304c7b-0x0;var _0x498eec=_0xe00b[_0x304c7b];return _0x498eec;};'use strict';var EventEmitter=require(_0xbe00('0x0'));var MailQueue=require(_0xbe00('0x1'))['db'][_0xbe00('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbe00('0x3')](0x0);var events={'afterCreate':_0xbe00('0x4'),'afterUpdate':_0xbe00('0x5'),'afterDestroy':_0xbe00('0x6')};function emitEvent(_0x5c5888){return function(_0x53e206,_0x21bbf9,_0x396ffc){MailQueueEvents[_0xbe00('0x7')](_0x5c5888+':'+_0x53e206['id'],_0x53e206);MailQueueEvents['emit'](_0x5c5888,_0x53e206);_0x396ffc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xbe00('0x8')](e,emitEvent(event));}}module[_0xbe00('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x5b85=['setMaxListeners','save','update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x5b85,0x102));var _0x55b8=function(_0x26b65a,_0x2abe39){_0x26b65a=_0x26b65a-0x0;var _0x7c8322=_0x5b85[_0x26b65a];return _0x7c8322;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x55b8('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x55b8('0x1')](0x0);var events={'afterCreate':_0x55b8('0x2'),'afterUpdate':_0x55b8('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5cfb7c){return function(_0x2b1fc6,_0x4183e2,_0xd6482a){MailQueueEvents[_0x55b8('0x4')](_0x5cfb7c+':'+_0x2b1fc6['id'],_0x2b1fc6);MailQueueEvents[_0x55b8('0x4')](_0x5cfb7c,_0x2b1fc6);_0xd6482a(null);};}for(var e in events){if(events[_0x55b8('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x55b8('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 439dfc3..2834b70 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 _0x6b73=['request-promise','path','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','util','api','moment','bluebird'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0x6b73,0x1bf));var _0x36b7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b73[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x36b7('0x0'));var logger=require('../../config/logger')(_0x36b7('0x1'));var moment=require(_0x36b7('0x2'));var BPromise=require(_0x36b7('0x3'));var rp=require(_0x36b7('0x4'));var fs=require('fs');var path=require(_0x36b7('0x5'));var rimraf=require('rimraf');var config=require(_0x36b7('0x6'));var attributes=require(_0x36b7('0x7'));module['exports']=function(_0x294189,_0x16dbf3){return _0x294189[_0x36b7('0x8')](_0x36b7('0x9'),attributes,{'tableName':_0x36b7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8816=['mail_queues','lodash','../../config/logger','api','request-promise','path','exports','MailQueue'];(function(_0x2d1cb6,_0x4b4e67){var _0x3d6986=function(_0x4089cb){while(--_0x4089cb){_0x2d1cb6['push'](_0x2d1cb6['shift']());}};_0x3d6986(++_0x4b4e67);}(_0x8816,0x111));var _0x6881=function(_0x2cb8f5,_0x5d15b1){_0x2cb8f5=_0x2cb8f5-0x0;var _0x3afe40=_0x8816[_0x2cb8f5];return _0x3afe40;};'use strict';var _=require(_0x6881('0x0'));var util=require('util');var logger=require(_0x6881('0x1'))(_0x6881('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6881('0x3'));var fs=require('fs');var path=require(_0x6881('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x6881('0x5')]=function(_0x3ad64d,_0x191a46){return _0x3ad64d['define'](_0x6881('0x6'),attributes,{'tableName':_0x6881('0x7'),'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 9631af7..64489d1 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 _0xaa69=['http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','model','attributes','debug','ShowMailQueue','find','map','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3f9606,_0x5b0a04){var _0x4487d6=function(_0xc2dbd5){while(--_0xc2dbd5){_0x3f9606['push'](_0x3f9606['shift']());}};_0x4487d6(++_0x5b0a04);}(_0xaa69,0xa1));var _0x9aa6=function(_0xab6b53,_0x17c189){_0xab6b53=_0xab6b53-0x0;var _0x28dd1b=_0xaa69[_0xab6b53];return _0x28dd1b;};'use strict';var _=require(_0x9aa6('0x0'));var util=require(_0x9aa6('0x1'));var moment=require(_0x9aa6('0x2'));var BPromise=require(_0x9aa6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9aa6('0x4'))['db'];var utils=require(_0x9aa6('0x5'));var logger=require(_0x9aa6('0x6'))(_0x9aa6('0x7'));var config=require(_0x9aa6('0x8'));var jayson=require(_0x9aa6('0x9'));var client=jayson[_0x9aa6('0xa')][_0x9aa6('0xb')]({'port':0x232a});config['redis']=_[_0x9aa6('0xc')](config[_0x9aa6('0xd')],{'host':_0x9aa6('0xe'),'port':0x18eb});var socket=require(_0x9aa6('0xf'))(new Redis(config[_0x9aa6('0xd')]));require(_0x9aa6('0x10'))['register'](socket);function respondWithRpcPromise(_0x3bb364,_0xae74b4,_0x18e03e){return new BPromise(function(_0x15fd65,_0x19dc49){return client[_0x9aa6('0x11')](_0x3bb364,_0x18e03e)[_0x9aa6('0x12')](function(_0x44c5de){logger[_0x9aa6('0x13')](_0x9aa6('0x14'),_0xae74b4,'request\x20sent');logger['debug'](_0x9aa6('0x15'),_0xae74b4,'request\x20sent',JSON[_0x9aa6('0x16')](_0x44c5de));if(_0x44c5de[_0x9aa6('0x17')]){if(_0x44c5de['error'][_0x9aa6('0x18')]===0x1f4){logger[_0x9aa6('0x17')](_0x9aa6('0x14'),_0xae74b4,_0x44c5de[_0x9aa6('0x17')][_0x9aa6('0x19')]);return _0x19dc49(_0x44c5de[_0x9aa6('0x17')][_0x9aa6('0x19')]);}logger[_0x9aa6('0x17')](_0x9aa6('0x14'),_0xae74b4,_0x44c5de[_0x9aa6('0x17')][_0x9aa6('0x19')]);return _0x15fd65(_0x44c5de['error']['message']);}else{logger[_0x9aa6('0x13')](_0x9aa6('0x14'),_0xae74b4,_0x9aa6('0x1a'));_0x15fd65(_0x44c5de[_0x9aa6('0x1b')][_0x9aa6('0x19')]);}})[_0x9aa6('0x1c')](function(_0x46211c){logger[_0x9aa6('0x17')](_0x9aa6('0x14'),_0xae74b4,_0x46211c);_0x19dc49(_0x46211c);});});}exports[_0x9aa6('0x1d')]=function(_0x127151){var _0x2b0689=this;return new Promise(function(_0x1150d5,_0x4cf581){return db[_0x9aa6('0x1e')][_0x9aa6('0x1f')]({'raw':_0x127151['options']?_0x127151[_0x9aa6('0x20')][_0x9aa6('0x21')]===undefined?!![]:![]:!![],'where':_0x127151[_0x9aa6('0x20')]?_0x127151[_0x9aa6('0x20')][_0x9aa6('0x22')]||null:null,'attributes':_0x127151[_0x9aa6('0x20')]?_0x127151[_0x9aa6('0x20')]['attributes']||null:null,'limit':_0x127151[_0x9aa6('0x20')]?_0x127151[_0x9aa6('0x20')][_0x9aa6('0x23')]||null:null,'include':_0x127151[_0x9aa6('0x20')]?_0x127151[_0x9aa6('0x20')][_0x9aa6('0x24')]?_['map'](_0x127151['options'][_0x9aa6('0x24')],function(_0x116d42){return{'model':db[_0x116d42[_0x9aa6('0x25')]],'as':_0x116d42['as'],'attributes':_0x116d42[_0x9aa6('0x26')],'include':_0x116d42['include']?_['map'](_0x116d42[_0x9aa6('0x24')],function(_0x2bb75b){return{'model':db[_0x2bb75b['model']],'as':_0x2bb75b['as'],'attributes':_0x2bb75b['attributes'],'include':_0x2bb75b[_0x9aa6('0x24')]?_['map'](_0x2bb75b[_0x9aa6('0x24')],function(_0x5202cc){return{'model':db[_0x5202cc[_0x9aa6('0x25')]],'as':_0x5202cc['as'],'attributes':_0x5202cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x9aa6('0x12')](function(_0x47dd3e){logger['info'](_0x9aa6('0x1d'),_0x127151);logger[_0x9aa6('0x27')](_0x9aa6('0x1d'),_0x127151,JSON[_0x9aa6('0x16')](_0x47dd3e));_0x1150d5(_0x47dd3e);})[_0x9aa6('0x1c')](function(_0x98e3c0){logger['error'](_0x9aa6('0x1d'),_0x98e3c0[_0x9aa6('0x19')],_0x127151);_0x4cf581(_0x2b0689[_0x9aa6('0x17')](0x1f4,_0x98e3c0['message']));});});};exports[_0x9aa6('0x28')]=function(_0x57db71){var _0x443de4=this;return new Promise(function(_0x295904,_0x126469){return db[_0x9aa6('0x1e')][_0x9aa6('0x29')]({'raw':_0x57db71['options']?_0x57db71[_0x9aa6('0x20')][_0x9aa6('0x21')]===undefined?!![]:![]:!![],'where':_0x57db71[_0x9aa6('0x20')]?_0x57db71[_0x9aa6('0x20')][_0x9aa6('0x22')]||null:null,'attributes':_0x57db71[_0x9aa6('0x20')]?_0x57db71[_0x9aa6('0x20')][_0x9aa6('0x26')]||null:null,'include':_0x57db71[_0x9aa6('0x20')]?_0x57db71['options'][_0x9aa6('0x24')]?_[_0x9aa6('0x2a')](_0x57db71[_0x9aa6('0x20')][_0x9aa6('0x24')],function(_0x44c832){return{'model':db[_0x44c832[_0x9aa6('0x25')]],'as':_0x44c832['as'],'attributes':_0x44c832['attributes'],'include':_0x44c832[_0x9aa6('0x24')]?_[_0x9aa6('0x2a')](_0x44c832['include'],function(_0x196ddd){return{'model':db[_0x196ddd[_0x9aa6('0x25')]],'as':_0x196ddd['as'],'attributes':_0x196ddd[_0x9aa6('0x26')],'include':_0x196ddd['include']?_[_0x9aa6('0x2a')](_0x196ddd[_0x9aa6('0x24')],function(_0x35d8c1){return{'model':db[_0x35d8c1[_0x9aa6('0x25')]],'as':_0x35d8c1['as'],'attributes':_0x35d8c1[_0x9aa6('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46965a){logger['info'](_0x9aa6('0x28'),_0x57db71);logger[_0x9aa6('0x27')](_0x9aa6('0x28'),_0x57db71,JSON[_0x9aa6('0x16')](_0x46965a));_0x295904(_0x46965a);})[_0x9aa6('0x1c')](function(_0x260513){logger[_0x9aa6('0x17')](_0x9aa6('0x28'),_0x260513['message'],_0x57db71);_0x126469(_0x443de4[_0x9aa6('0x17')](0x1f4,_0x260513[_0x9aa6('0x19')]));});});}; \ No newline at end of file +var _0x1306=['code','MailQueue,\x20%s,\x20%s','message','result','catch','GetMailQueue','MailQueue','findAll','raw','options','where','limit','include','attributes','map','model','find','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x1a0f3a,_0x3f82c3){var _0x152ebf=function(_0x2d33ea){while(--_0x2d33ea){_0x1a0f3a['push'](_0x1a0f3a['shift']());}};_0x152ebf(++_0x3f82c3);}(_0x1306,0x17a));var _0x6130=function(_0xa16512,_0x537b0f){_0xa16512=_0xa16512-0x0;var _0x141776=_0x1306[_0xa16512];return _0x141776;};'use strict';var _=require(_0x6130('0x0'));var util=require(_0x6130('0x1'));var moment=require(_0x6130('0x2'));var BPromise=require(_0x6130('0x3'));var rs=require(_0x6130('0x4'));var fs=require('fs');var Redis=require(_0x6130('0x5'));var db=require(_0x6130('0x6'))['db'];var utils=require(_0x6130('0x7'));var logger=require(_0x6130('0x8'))(_0x6130('0x9'));var config=require(_0x6130('0xa'));var jayson=require(_0x6130('0xb'));var client=jayson[_0x6130('0xc')][_0x6130('0xd')]({'port':0x232a});config[_0x6130('0xe')]=_[_0x6130('0xf')](config[_0x6130('0xe')],{'host':_0x6130('0x10'),'port':0x18eb});var socket=require(_0x6130('0x11'))(new Redis(config[_0x6130('0xe')]));require(_0x6130('0x12'))[_0x6130('0x13')](socket);function respondWithRpcPromise(_0xb9c7e6,_0x34d1a6,_0x2d06a5){return new BPromise(function(_0x107d80,_0xcaf732){return client[_0x6130('0x14')](_0xb9c7e6,_0x2d06a5)[_0x6130('0x15')](function(_0x583072){logger[_0x6130('0x16')]('MailQueue,\x20%s,\x20%s',_0x34d1a6,_0x6130('0x17'));logger[_0x6130('0x18')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x34d1a6,_0x6130('0x17'),JSON[_0x6130('0x19')](_0x583072));if(_0x583072[_0x6130('0x1a')]){if(_0x583072[_0x6130('0x1a')][_0x6130('0x1b')]===0x1f4){logger[_0x6130('0x1a')](_0x6130('0x1c'),_0x34d1a6,_0x583072[_0x6130('0x1a')][_0x6130('0x1d')]);return _0xcaf732(_0x583072[_0x6130('0x1a')][_0x6130('0x1d')]);}logger[_0x6130('0x1a')](_0x6130('0x1c'),_0x34d1a6,_0x583072[_0x6130('0x1a')][_0x6130('0x1d')]);return _0x107d80(_0x583072[_0x6130('0x1a')]['message']);}else{logger['info'](_0x6130('0x1c'),_0x34d1a6,'request\x20sent');_0x107d80(_0x583072[_0x6130('0x1e')][_0x6130('0x1d')]);}})[_0x6130('0x1f')](function(_0x2c83b0){logger[_0x6130('0x1a')]('MailQueue,\x20%s,\x20%s',_0x34d1a6,_0x2c83b0);_0xcaf732(_0x2c83b0);});});}exports[_0x6130('0x20')]=function(_0x4d4b4b){var _0x41fa14=this;return new Promise(function(_0x41f56a,_0x18bb78){return db[_0x6130('0x21')][_0x6130('0x22')]({'raw':_0x4d4b4b['options']?_0x4d4b4b['options'][_0x6130('0x23')]===undefined?!![]:![]:!![],'where':_0x4d4b4b['options']?_0x4d4b4b[_0x6130('0x24')][_0x6130('0x25')]||null:null,'attributes':_0x4d4b4b['options']?_0x4d4b4b['options']['attributes']||null:null,'limit':_0x4d4b4b[_0x6130('0x24')]?_0x4d4b4b['options'][_0x6130('0x26')]||null:null,'include':_0x4d4b4b['options']?_0x4d4b4b['options']['include']?_['map'](_0x4d4b4b['options'][_0x6130('0x27')],function(_0x1ba07d){return{'model':db[_0x1ba07d['model']],'as':_0x1ba07d['as'],'attributes':_0x1ba07d[_0x6130('0x28')],'include':_0x1ba07d['include']?_[_0x6130('0x29')](_0x1ba07d['include'],function(_0x5787a6){return{'model':db[_0x5787a6[_0x6130('0x2a')]],'as':_0x5787a6['as'],'attributes':_0x5787a6[_0x6130('0x28')],'include':_0x5787a6[_0x6130('0x27')]?_[_0x6130('0x29')](_0x5787a6[_0x6130('0x27')],function(_0x392386){return{'model':db[_0x392386[_0x6130('0x2a')]],'as':_0x392386['as'],'attributes':_0x392386[_0x6130('0x28')]};}):[]};}):[]};}):[]:[]})[_0x6130('0x15')](function(_0x5809e4){logger['info'](_0x6130('0x20'),_0x4d4b4b);logger[_0x6130('0x18')](_0x6130('0x20'),_0x4d4b4b,JSON[_0x6130('0x19')](_0x5809e4));_0x41f56a(_0x5809e4);})[_0x6130('0x1f')](function(_0x4e068c){logger[_0x6130('0x1a')](_0x6130('0x20'),_0x4e068c[_0x6130('0x1d')],_0x4d4b4b);_0x18bb78(_0x41fa14[_0x6130('0x1a')](0x1f4,_0x4e068c[_0x6130('0x1d')]));});});};exports['ShowMailQueue']=function(_0x248324){var _0x600c28=this;return new Promise(function(_0x165407,_0x4b0c9c){return db[_0x6130('0x21')][_0x6130('0x2b')]({'raw':_0x248324[_0x6130('0x24')]?_0x248324[_0x6130('0x24')][_0x6130('0x23')]===undefined?!![]:![]:!![],'where':_0x248324[_0x6130('0x24')]?_0x248324[_0x6130('0x24')][_0x6130('0x25')]||null:null,'attributes':_0x248324[_0x6130('0x24')]?_0x248324['options'][_0x6130('0x28')]||null:null,'include':_0x248324['options']?_0x248324['options']['include']?_[_0x6130('0x29')](_0x248324[_0x6130('0x24')][_0x6130('0x27')],function(_0x3b5270){return{'model':db[_0x3b5270[_0x6130('0x2a')]],'as':_0x3b5270['as'],'attributes':_0x3b5270[_0x6130('0x28')],'include':_0x3b5270[_0x6130('0x27')]?_[_0x6130('0x29')](_0x3b5270['include'],function(_0x36a91e){return{'model':db[_0x36a91e[_0x6130('0x2a')]],'as':_0x36a91e['as'],'attributes':_0x36a91e['attributes'],'include':_0x36a91e[_0x6130('0x27')]?_[_0x6130('0x29')](_0x36a91e[_0x6130('0x27')],function(_0x5874cd){return{'model':db[_0x5874cd[_0x6130('0x2a')]],'as':_0x5874cd['as'],'attributes':_0x5874cd[_0x6130('0x28')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f3798){logger[_0x6130('0x16')](_0x6130('0x2c'),_0x248324);logger[_0x6130('0x18')]('ShowMailQueue',_0x248324,JSON['stringify'](_0x5f3798));_0x165407(_0x5f3798);})[_0x6130('0x1f')](function(_0x94a76){logger[_0x6130('0x1a')](_0x6130('0x2c'),_0x94a76[_0x6130('0x1d')],_0x248324);_0x4b0c9c(_0x600c28[_0x6130('0x1a')](0x1f4,_0x94a76[_0x6130('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ad431a7..d802acf 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 _0xe98f=['removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update','emit'];(function(_0x5cb12d,_0xcc461d){var _0x5cc5d4=function(_0x154803){while(--_0x154803){_0x5cb12d['push'](_0x5cb12d['shift']());}};_0x5cc5d4(++_0xcc461d);}(_0xe98f,0xc1));var _0xfe98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe98f[_0x4b369d];return _0x571a98;};'use strict';var MailQueueEvents=require(_0xfe98('0x0'));var events=[_0xfe98('0x1'),_0xfe98('0x2'),_0xfe98('0x3')];function createListener(_0x14c270,_0x2b97bc){return function(_0x5e7952){_0x2b97bc[_0xfe98('0x4')](_0x14c270,_0x5e7952);};}function removeListener(_0x1b7274,_0x13f20b){return function(){MailQueueEvents[_0xfe98('0x5')](_0x1b7274,_0x13f20b);};}exports[_0xfe98('0x6')]=function(_0x5ecf48){for(var _0x52f9fa=0x0,_0x4c7c15=events[_0xfe98('0x7')];_0x52f9fa<_0x4c7c15;_0x52f9fa++){var _0x2bf726=events[_0x52f9fa];var _0x85632d=createListener(_0xfe98('0x8')+_0x2bf726,_0x5ecf48);MailQueueEvents['on'](_0x2bf726,_0x85632d);}}; \ No newline at end of file +var _0xa9d6=['./mailQueue.events','save','remove','update','emit','removeListener','register','length','mailQueue:'];(function(_0x489ea2,_0x2df9bb){var _0xcb5c6b=function(_0x70024){while(--_0x70024){_0x489ea2['push'](_0x489ea2['shift']());}};_0xcb5c6b(++_0x2df9bb);}(_0xa9d6,0x1ef));var _0x6a9d=function(_0x152e43,_0x23715d){_0x152e43=_0x152e43-0x0;var _0x4fd1ac=_0xa9d6[_0x152e43];return _0x4fd1ac;};'use strict';var MailQueueEvents=require(_0x6a9d('0x0'));var events=[_0x6a9d('0x1'),_0x6a9d('0x2'),_0x6a9d('0x3')];function createListener(_0x3fa9fe,_0x3e2efe){return function(_0x13cdb4){_0x3e2efe[_0x6a9d('0x4')](_0x3fa9fe,_0x13cdb4);};}function removeListener(_0x328b0e,_0xa1c7f9){return function(){MailQueueEvents[_0x6a9d('0x5')](_0x328b0e,_0xa1c7f9);};}exports[_0x6a9d('0x6')]=function(_0x51b14c){for(var _0x1615aa=0x0,_0xe04900=events[_0x6a9d('0x7')];_0x1615aa<_0xe04900;_0x1615aa++){var _0x47d959=events[_0x1615aa];var _0x2905ec=createListener(_0x6a9d('0x8')+_0x47d959,_0x51b14c);MailQueueEvents['on'](_0x47d959,_0x2905ec);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c8a1a31..9247993 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 _0xcfe0=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','post','put','/:id','update','delete'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xcfe0,0x12d));var _0x0cfe=function(_0x973100,_0x4e68fd){_0x973100=_0x973100-0x0;var _0x30b27a=_0xcfe0[_0x973100];return _0x30b27a;};'use strict';var multer=require(_0x0cfe('0x0'));var util=require(_0x0cfe('0x1'));var path=require(_0x0cfe('0x2'));var timeout=require(_0x0cfe('0x3'));var express=require(_0x0cfe('0x4'));var router=express[_0x0cfe('0x5')]();var fs_extra=require(_0x0cfe('0x6'));var auth=require(_0x0cfe('0x7'));var interaction=require(_0x0cfe('0x8'));var config=require(_0x0cfe('0x9'));var controller=require(_0x0cfe('0xa'));router['get']('/',auth[_0x0cfe('0xb')](),controller[_0x0cfe('0xc')]);router[_0x0cfe('0xd')](_0x0cfe('0xe'),auth['isAuthenticated'](),controller[_0x0cfe('0xf')]);router[_0x0cfe('0xd')]('/:id',auth[_0x0cfe('0xb')](),controller['show']);router[_0x0cfe('0x10')]('/',auth[_0x0cfe('0xb')](),controller['create']);router[_0x0cfe('0x11')](_0x0cfe('0x12'),auth['isAuthenticated'](),controller[_0x0cfe('0x13')]);router[_0x0cfe('0x14')]('/:id',auth[_0x0cfe('0xb')](),controller[_0x0cfe('0x15')]);module[_0x0cfe('0x16')]=router; \ No newline at end of file +var _0xf858=['get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller'];(function(_0x239d20,_0x449242){var _0x1ff4c1=function(_0x5516e7){while(--_0x5516e7){_0x239d20['push'](_0x239d20['shift']());}};_0x1ff4c1(++_0x449242);}(_0xf858,0x14d));var _0x8f85=function(_0x447209,_0x28cf3d){_0x447209=_0x447209-0x0;var _0x37a12e=_0xf858[_0x447209];return _0x37a12e;};'use strict';var multer=require(_0x8f85('0x0'));var util=require(_0x8f85('0x1'));var path=require(_0x8f85('0x2'));var timeout=require(_0x8f85('0x3'));var express=require(_0x8f85('0x4'));var router=express['Router']();var fs_extra=require(_0x8f85('0x5'));var auth=require(_0x8f85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8f85('0x7'));var controller=require(_0x8f85('0x8'));router[_0x8f85('0x9')]('/',auth[_0x8f85('0xa')](),controller[_0x8f85('0xb')]);router[_0x8f85('0x9')]('/describe',auth[_0x8f85('0xa')](),controller['describe']);router[_0x8f85('0x9')](_0x8f85('0xc'),auth[_0x8f85('0xa')](),controller[_0x8f85('0xd')]);router[_0x8f85('0xe')]('/',auth[_0x8f85('0xa')](),controller[_0x8f85('0xf')]);router['put'](_0x8f85('0xc'),auth[_0x8f85('0xa')](),controller['update']);router[_0x8f85('0x10')](_0x8f85('0xc'),auth[_0x8f85('0xa')](),controller[_0x8f85('0x11')]);module[_0x8f85('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2e1fb2f..dbd2bba 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 _0x0269=['exports','STRING','DATE','moment'];(function(_0x3cdb9e,_0x43fe8e){var _0xd1c078=function(_0x219a2d){while(--_0x219a2d){_0x3cdb9e['push'](_0x3cdb9e['shift']());}};_0xd1c078(++_0x43fe8e);}(_0x0269,0x8f));var _0x9026=function(_0x4e65d4,_0x257a37){_0x4e65d4=_0x4e65d4-0x0;var _0x1dc707=_0x0269[_0x4e65d4];return _0x1dc707;};'use strict';var moment=require(_0x9026('0x0'));var Sequelize=require('sequelize');module[_0x9026('0x1')]={'uniqueid':{'type':Sequelize[_0x9026('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9026('0x2')]},'joinAt':{'type':Sequelize[_0x9026('0x3')]},'leaveAt':{'type':Sequelize[_0x9026('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9026('0x3')]},'reason':{'type':Sequelize[_0x9026('0x2')]}}; \ No newline at end of file +var _0x54f3=['DATE','exports','STRING'];(function(_0x45a193,_0x497b0a){var _0x226ff2=function(_0x358523){while(--_0x358523){_0x45a193['push'](_0x45a193['shift']());}};_0x226ff2(++_0x497b0a);}(_0x54f3,0x16c));var _0x354f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x54f3[_0xfae23b];return _0x200640;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x354f('0x0')]={'uniqueid':{'type':Sequelize[_0x354f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x354f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x354f('0x2')]},'acceptAt':{'type':Sequelize[_0x354f('0x2')]},'exitAt':{'type':Sequelize[_0x354f('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 8ba0b90..d47263e 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 _0xb44a=['options','rows','catch','show','params','includeAll','merge','create','body','find','destroy','describe','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send','MailQueueReport','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','type','VIRTUAL'];(function(_0x2a58a2,_0xdf53f5){var _0x394bc6=function(_0x1825d3){while(--_0x1825d3){_0x2a58a2['push'](_0x2a58a2['shift']());}};_0x394bc6(++_0xdf53f5);}(_0xb44a,0x1c2));var _0xab44=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0xb44a[_0x5c2a2b];return _0x19921f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];function respondWithStatusCode(_0x237c26,_0x52d282){_0x52d282=_0x52d282||0xcc;return function(_0x57fcff){if(_0x57fcff){return _0x237c26[_0xab44('0x16')](_0x52d282);}return _0x237c26['status'](_0x52d282)[_0xab44('0x17')]();};}function respondWithResult(_0x5ae369,_0x25f611){_0x25f611=_0x25f611||0xc8;return function(_0x15b98a){if(_0x15b98a){return _0x5ae369[_0xab44('0x18')](_0x25f611)[_0xab44('0x19')](_0x15b98a);}};}function respondWithFilteredResult(_0x31404d,_0x41701b){return function(_0x4875df){if(_0x4875df){var _0x51251b=typeof _0x41701b[_0xab44('0x1a')]===_0xab44('0x1b')&&typeof _0x41701b[_0xab44('0x1c')]===_0xab44('0x1b');var _0xffdfbc=_0x4875df[_0xab44('0x1d')];var _0x354b09=_0x51251b?0x0:_0x41701b[_0xab44('0x1a')];var _0x310b15=_0x51251b?_0x4875df[_0xab44('0x1d')]:_0x41701b[_0xab44('0x1a')]+_0x41701b['limit'];var _0xb779bb;if(_0x310b15>=_0xffdfbc){_0x310b15=_0xffdfbc;_0xb779bb=0xc8;}else{_0xb779bb=0xce;}_0x31404d[_0xab44('0x18')](_0xb779bb);return _0x31404d[_0xab44('0x1e')](_0xab44('0x1f'),_0x354b09+'-'+_0x310b15+'/'+_0xffdfbc)[_0xab44('0x19')](_0x4875df);}return null;};}function patchUpdates(_0x5123b1){return function(_0xcd426){try{jsonpatch['apply'](_0xcd426,_0x5123b1,!![]);}catch(_0x1f7311){return BPromise[_0xab44('0x20')](_0x1f7311);}return _0xcd426[_0xab44('0x21')]();};}function saveUpdates(_0x355083,_0x486317){return function(_0x3a2b1d){if(_0x3a2b1d){return _0x3a2b1d[_0xab44('0x22')](_0x355083)[_0xab44('0x23')](function(_0x3b17d5){return _0x3b17d5;});}return null;};}function removeEntity(_0x11f0b,_0x402950){return function(_0x43f1c6){if(_0x43f1c6){return _0x43f1c6['destroy']()['then'](function(){_0x11f0b[_0xab44('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2439f3,_0x5a7269){return function(_0x2a1bbc){if(!_0x2a1bbc){_0x2439f3['sendStatus'](0x194);}return _0x2a1bbc;};}function handleError(_0x531583,_0x8e60fa){_0x8e60fa=_0x8e60fa||0x1f4;return function(_0x25287b){logger[_0xab44('0x24')](_0x25287b[_0xab44('0x25')]);if(_0x25287b[_0xab44('0x26')]){delete _0x25287b['name'];}_0x531583[_0xab44('0x18')](_0x8e60fa)[_0xab44('0x27')](_0x25287b);};}exports['index']=function(_0x887b0d,_0xebb7d1){var _0x21131e={},_0x1cd486={},_0x4550c8={'count':0x0,'rows':[]};var _0xdc50a1=_['map'](db[_0xab44('0x28')][_0xab44('0x29')],function(_0x36f9b6){return{'name':_0x36f9b6['fieldName'],'type':_0x36f9b6['type'][_0xab44('0x2a')]};});_0x1cd486['model']=_['map'](_0xdc50a1,_0xab44('0x26'));_0x1cd486[_0xab44('0x2b')]=_[_0xab44('0x2c')](_0x887b0d[_0xab44('0x2b')]);_0x1cd486[_0xab44('0x2d')]=_[_0xab44('0x2e')](_0x1cd486[_0xab44('0x2f')],_0x1cd486[_0xab44('0x2b')]);_0x21131e[_0xab44('0x30')]=_[_0xab44('0x2e')](_0x1cd486[_0xab44('0x2f')],qs[_0xab44('0x31')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x31')]));_0x21131e['attributes']=_0x21131e['attributes'][_0xab44('0x32')]?_0x21131e[_0xab44('0x30')]:_0x1cd486['model'];if(!_0x887b0d[_0xab44('0x2b')][_0xab44('0x33')](_0xab44('0x34'))){_0x21131e[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x1c')]);_0x21131e[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x1a')]);}_0x21131e[_0xab44('0x35')]=qs[_0xab44('0x36')](_0x887b0d[_0xab44('0x2b')][_0xab44('0x36')]);_0x21131e[_0xab44('0x37')]=qs[_0xab44('0x2d')](_[_0xab44('0x38')](_0x887b0d['query'],_0x1cd486[_0xab44('0x2d')]),_0xdc50a1);if(_0x887b0d[_0xab44('0x2b')][_0xab44('0x39')]){_0x21131e[_0xab44('0x37')]=_['merge'](_0x21131e[_0xab44('0x37')],{'$or':_[_0xab44('0x3a')](_0xdc50a1,function(_0xcd077a){if(_0xcd077a[_0xab44('0x3b')]!==_0xab44('0x3c')){var _0x4f5cf3={};_0x4f5cf3[_0xcd077a[_0xab44('0x26')]]={'$like':'%'+_0x887b0d[_0xab44('0x2b')][_0xab44('0x39')]+'%'};return _0x4f5cf3;}})});}_0x21131e=_['merge']({},_0x21131e,_0x887b0d[_0xab44('0x3d')]);var _0x1e26de={'where':_0x21131e[_0xab44('0x37')]};return db[_0xab44('0x28')][_0xab44('0x1d')](_0x1e26de)['then'](function(_0x1de52d){_0x4550c8['count']=_0x1de52d;if(_0x887b0d[_0xab44('0x2b')]['includeAll']){_0x21131e['include']=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x21131e);})['then'](function(_0x120585){_0x4550c8[_0xab44('0x3e')]=_0x120585;return _0x4550c8;})[_0xab44('0x23')](respondWithFilteredResult(_0xebb7d1,_0x21131e))[_0xab44('0x3f')](handleError(_0xebb7d1,null));};exports[_0xab44('0x40')]=function(_0xf3f37a,_0x19d20d){var _0x33641e={'raw':!![],'where':{'id':_0xf3f37a[_0xab44('0x41')]['id']}},_0x4429e6={};_0x4429e6['model']=_[_0xab44('0x2c')](db[_0xab44('0x28')][_0xab44('0x29')]);_0x4429e6[_0xab44('0x2b')]=_['keys'](_0xf3f37a[_0xab44('0x2b')]);_0x4429e6[_0xab44('0x2d')]=_[_0xab44('0x2e')](_0x4429e6[_0xab44('0x2f')],_0x4429e6[_0xab44('0x2b')]);_0x33641e[_0xab44('0x30')]=_['intersection'](_0x4429e6['model'],qs[_0xab44('0x31')](_0xf3f37a[_0xab44('0x2b')][_0xab44('0x31')]));_0x33641e[_0xab44('0x30')]=_0x33641e[_0xab44('0x30')]['length']?_0x33641e[_0xab44('0x30')]:_0x4429e6[_0xab44('0x2f')];if(_0xf3f37a[_0xab44('0x2b')][_0xab44('0x42')]){_0x33641e['include']=[{'all':!![]}];}_0x33641e=_[_0xab44('0x43')]({},_0x33641e,_0xf3f37a[_0xab44('0x3d')]);return db[_0xab44('0x28')]['find'](_0x33641e)[_0xab44('0x23')](handleEntityNotFound(_0x19d20d,null))[_0xab44('0x23')](respondWithResult(_0x19d20d,null))[_0xab44('0x3f')](handleError(_0x19d20d,null));};exports[_0xab44('0x44')]=function(_0x4eeb65,_0x13892d){return db['MailQueueReport'][_0xab44('0x44')](_0x4eeb65[_0xab44('0x45')],{})[_0xab44('0x23')](respondWithResult(_0x13892d,0xc9))[_0xab44('0x3f')](handleError(_0x13892d,null));};exports['update']=function(_0x328891,_0x5497a3){if(_0x328891[_0xab44('0x45')]['id']){delete _0x328891[_0xab44('0x45')]['id'];}return db[_0xab44('0x28')][_0xab44('0x46')]({'where':{'id':_0x328891[_0xab44('0x41')]['id']}})['then'](handleEntityNotFound(_0x5497a3,null))[_0xab44('0x23')](saveUpdates(_0x328891['body'],null))[_0xab44('0x23')](respondWithResult(_0x5497a3,null))[_0xab44('0x3f')](handleError(_0x5497a3,null));};exports[_0xab44('0x47')]=function(_0x50b705,_0x4463f1){return db[_0xab44('0x28')][_0xab44('0x46')]({'where':{'id':_0x50b705[_0xab44('0x41')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x4463f1,null))['then'](removeEntity(_0x4463f1,null))['catch'](handleError(_0x4463f1,null));};exports[_0xab44('0x48')]=function(_0x1b18fb,_0xaa00a1){return db['MailQueueReport'][_0xab44('0x48')]()[_0xab44('0x23')](respondWithResult(_0xaa00a1,null))[_0xab44('0x3f')](handleError(_0xaa00a1,null));}; \ No newline at end of file +var _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 80667ab..681eb96 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 _0xce2a=['report_mail_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','MailQueueReport'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0xce2a,0xd3));var _0xace2=function(_0x29d802,_0x2467fe){_0x29d802=_0x29d802-0x0;var _0x289829=_0xce2a[_0x29d802];return _0x289829;};'use strict';var _=require('lodash');var util=require(_0xace2('0x0'));var logger=require(_0xace2('0x1'))(_0xace2('0x2'));var moment=require('moment');var BPromise=require(_0xace2('0x3'));var rp=require(_0xace2('0x4'));var fs=require('fs');var path=require(_0xace2('0x5'));var rimraf=require('rimraf');var config=require(_0xace2('0x6'));var attributes=require('./mailQueueReport.attributes');module[_0xace2('0x7')]=function(_0x25fdde,_0x5b68c3){return _0x25fdde['define'](_0xace2('0x8'),attributes,{'tableName':_0xace2('0x9'),'paranoid':![],'indexes':[{'name':_0xace2('0xa'),'fields':[_0xace2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8de=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x3069b3,_0x35049a){var _0x33c845=function(_0x236f99){while(--_0x236f99){_0x3069b3['push'](_0x3069b3['shift']());}};_0x33c845(++_0x35049a);}(_0xb8de,0xa7));var _0xeb8d=function(_0x4aa09f,_0x25f755){_0x4aa09f=_0x4aa09f-0x0;var _0x3089af=_0xb8de[_0x4aa09f];return _0x3089af;};'use strict';var _=require(_0xeb8d('0x0'));var util=require(_0xeb8d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xeb8d('0x2'));var BPromise=require(_0xeb8d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb8d('0x4'));var rimraf=require(_0xeb8d('0x5'));var config=require(_0xeb8d('0x6'));var attributes=require(_0xeb8d('0x7'));module[_0xeb8d('0x8')]=function(_0x1d8416,_0x3c5f15){return _0x1d8416[_0xeb8d('0x9')](_0xeb8d('0xa'),attributes,{'tableName':_0xeb8d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xeb8d('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 aa23697..98bb941 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 _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x57baae,_0x4fbee0){var _0x33dde6=function(_0xb00c7b){while(--_0xb00c7b){_0x57baae['push'](_0x57baae['shift']());}};_0x33dde6(++_0x4fbee0);}(_0x2ef3,0xba));var _0x32ef=function(_0x333dbc,_0x325287){_0x333dbc=_0x333dbc-0x0;var _0x1d7444=_0x2ef3[_0x333dbc];return _0x1d7444;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x2ef3,0xba));var _0x32ef=function(_0x3e77cd,_0x5b4a2d){_0x3e77cd=_0x3e77cd-0x0;var _0x8707c4=_0x2ef3[_0x3e77cd];return _0x8707c4;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 7af28ba..133b2ea 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x56f15d,_0x3ac7c1){var _0x448170=function(_0x54bc9e){while(--_0x54bc9e){_0x56f15d['push'](_0x56f15d['shift']());}};_0x448170(++_0x3ac7c1);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f538e,_0x5a4b56){_0x4f538e=_0x4f538e-0x0;var _0x3f09ac=_0xedd9[_0x4f538e];return _0x3f09ac;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x385359,_0x325c57){var _0x2ea4dd=function(_0x1bcf4f){while(--_0x1bcf4f){_0x385359['push'](_0x385359['shift']());}};_0x2ea4dd(++_0x325c57);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ade62dc..0f4b7ac 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 _0x4017=['STRING','BOOLEAN','INBOX','INTEGER','sequelize','exports'];(function(_0x531e45,_0x20fcce){var _0x969fa0=function(_0x3c6064){while(--_0x3c6064){_0x531e45['push'](_0x531e45['shift']());}};_0x969fa0(++_0x20fcce);}(_0x4017,0x70));var _0x7401=function(_0x31a8f7,_0x5894f1){_0x31a8f7=_0x31a8f7-0x0;var _0x42558e=_0x4017[_0x31a8f7];return _0x42558e;};'use strict';var Sequelize=require(_0x7401('0x0'));module[_0x7401('0x1')]={'description':{'type':Sequelize[_0x7401('0x2')]},'host':{'type':Sequelize[_0x7401('0x2')]},'authentication':{'type':Sequelize[_0x7401('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7401('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x7401('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x7401('0x2')],'defaultValue':_0x7401('0x4')},'connTimeout':{'type':Sequelize[_0x7401('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x7401('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3a41=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0x2a92fb,_0x3fbd10){var _0x140468=function(_0x3a34b3){while(--_0x3a34b3){_0x2a92fb['push'](_0x2a92fb['shift']());}};_0x140468(++_0x3fbd10);}(_0x3a41,0x151));var _0x13a4=function(_0x15eb63,_0xd3f629){_0x15eb63=_0x15eb63-0x0;var _0x19fc81=_0x3a41[_0x15eb63];return _0x19fc81;};'use strict';var Sequelize=require(_0x13a4('0x0'));module['exports']={'description':{'type':Sequelize[_0x13a4('0x1')]},'host':{'type':Sequelize[_0x13a4('0x1')]},'authentication':{'type':Sequelize[_0x13a4('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x13a4('0x1')]},'password':{'type':Sequelize[_0x13a4('0x1')]},'port':{'type':Sequelize[_0x13a4('0x3')]},'tls':{'type':Sequelize[_0x13a4('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x13a4('0x1')],'defaultValue':_0x13a4('0x4')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x13a4('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x13a4('0x1')]},'modernAuthentication':{'type':Sequelize[_0x13a4('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f9540e2..fb9f8d9 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 _0xb91e=['define','MailServerIn','mail_servers_in','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0xb91e,0x100));var _0xeb91=function(_0x358c04,_0x13459f){_0x358c04=_0x358c04-0x0;var _0x58666d=_0xb91e[_0x358c04];return _0x58666d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb91('0x0'))(_0xeb91('0x1'));var moment=require('moment');var BPromise=require(_0xeb91('0x2'));var rp=require(_0xeb91('0x3'));var fs=require('fs');var path=require(_0xeb91('0x4'));var rimraf=require(_0xeb91('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb91('0x6'));module[_0xeb91('0x7')]=function(_0x2a716a,_0x335fea){return _0x2a716a[_0xeb91('0x8')](_0xeb91('0x9'),attributes,{'tableName':_0xeb91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bb8=['mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x38a162,_0x4396b2){var _0x1f622b=function(_0x3b3a60){while(--_0x3b3a60){_0x38a162['push'](_0x38a162['shift']());}};_0x1f622b(++_0x4396b2);}(_0x1bb8,0xe5));var _0x81bb=function(_0x39204d,_0x1e3861){_0x39204d=_0x39204d-0x0;var _0x15b0bf=_0x1bb8[_0x39204d];return _0x15b0bf;};'use strict';var _=require(_0x81bb('0x0'));var util=require(_0x81bb('0x1'));var logger=require(_0x81bb('0x2'))(_0x81bb('0x3'));var moment=require(_0x81bb('0x4'));var BPromise=require(_0x81bb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81bb('0x6'));var rimraf=require('rimraf');var config=require(_0x81bb('0x7'));var attributes=require(_0x81bb('0x8'));module['exports']=function(_0x3c2924,_0x51b17a){return _0x3c2924[_0x81bb('0x9')](_0x81bb('0xa'),attributes,{'tableName':_0x81bb('0xb'),'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 5304574..829bdad 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 _0x4f6f=['result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x43a710,_0x482f5b){var _0x47e675=function(_0x5b49d0){while(--_0x5b49d0){_0x43a710['push'](_0x43a710['shift']());}};_0x47e675(++_0x482f5b);}(_0x4f6f,0x157));var _0xf4f6=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x4f6f[_0x17406e];return _0x2bfc5a;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var moment=require(_0xf4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4f6('0x4'))['db'];var utils=require(_0xf4f6('0x5'));var logger=require('../../config/logger')(_0xf4f6('0x6'));var config=require(_0xf4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf4f6('0x8')][_0xf4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dc7b9,_0x4fa106,_0x106455){return new BPromise(function(_0x592fa6,_0x483c82){return client[_0xf4f6('0xa')](_0x2dc7b9,_0x106455)[_0xf4f6('0xb')](function(_0x34bc5d){logger[_0xf4f6('0xc')](_0xf4f6('0xd'),_0x4fa106,_0xf4f6('0xe'));logger['debug'](_0xf4f6('0xf'),_0x4fa106,_0xf4f6('0xe'),JSON[_0xf4f6('0x10')](_0x34bc5d));if(_0x34bc5d[_0xf4f6('0x11')]){if(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x12')]===0x1f4){logger['error'](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d[_0xf4f6('0x11')]['message']);return _0x483c82(_0x34bc5d['error'][_0xf4f6('0x13')]);}logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x34bc5d['error'][_0xf4f6('0x13')]);return _0x592fa6(_0x34bc5d[_0xf4f6('0x11')][_0xf4f6('0x13')]);}else{logger['info'](_0xf4f6('0xd'),_0x4fa106,'request\x20sent');_0x592fa6(_0x34bc5d[_0xf4f6('0x14')][_0xf4f6('0x13')]);}})[_0xf4f6('0x15')](function(_0x522af3){logger[_0xf4f6('0x11')](_0xf4f6('0xd'),_0x4fa106,_0x522af3);_0x483c82(_0x522af3);});});}exports[_0xf4f6('0x16')]=function(_0x4e1d2a){var _0x3d5019=this;return new Promise(function(_0x4cb047,_0x109095){return db[_0xf4f6('0x17')][_0xf4f6('0x18')]({'raw':_0x4e1d2a['options']?_0x4e1d2a[_0xf4f6('0x19')][_0xf4f6('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e1d2a[_0xf4f6('0x19')]?_0x4e1d2a[_0xf4f6('0x19')][_0xf4f6('0x1b')]||null:null,'attributes':_0x4e1d2a[_0xf4f6('0x19')]?_0x4e1d2a[_0xf4f6('0x19')][_0xf4f6('0x1c')]||null:null,'limit':_0x4e1d2a[_0xf4f6('0x19')]?_0x4e1d2a[_0xf4f6('0x19')][_0xf4f6('0x1d')]||null:null,'include':_0x4e1d2a['options']?_0x4e1d2a[_0xf4f6('0x19')][_0xf4f6('0x1e')]?_[_0xf4f6('0x1f')](_0x4e1d2a['options'][_0xf4f6('0x1e')],function(_0x45b5fb){return{'model':db[_0x45b5fb['model']],'as':_0x45b5fb['as'],'attributes':_0x45b5fb[_0xf4f6('0x1c')],'include':_0x45b5fb[_0xf4f6('0x1e')]?_[_0xf4f6('0x1f')](_0x45b5fb['include'],function(_0x32af7b){return{'model':db[_0x32af7b[_0xf4f6('0x20')]],'as':_0x32af7b['as'],'attributes':_0x32af7b[_0xf4f6('0x1c')],'include':_0x32af7b[_0xf4f6('0x1e')]?_['map'](_0x32af7b[_0xf4f6('0x1e')],function(_0x330ec1){return{'model':db[_0x330ec1[_0xf4f6('0x20')]],'as':_0x330ec1['as'],'attributes':_0x330ec1[_0xf4f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf4f6('0xb')](function(_0x2edc23){logger[_0xf4f6('0xc')](_0xf4f6('0x16'),_0x4e1d2a);logger['debug'](_0xf4f6('0x16'),_0x4e1d2a,JSON[_0xf4f6('0x10')](_0x2edc23));_0x4cb047(_0x2edc23);})[_0xf4f6('0x15')](function(_0x59490b){logger[_0xf4f6('0x11')](_0xf4f6('0x16'),_0x59490b[_0xf4f6('0x13')],_0x4e1d2a);_0x109095(_0x3d5019[_0xf4f6('0x11')](0x1f4,_0x59490b[_0xf4f6('0x13')]));});});}; \ No newline at end of file +var _0x6343=['jayson/promise','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','MailServerIn','findAll','options','where','attributes','limit','include','map','model','GetMailServerIn','stringify','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0x6343,0x1e9));var _0x3634=function(_0x2012c4,_0x51f3cb){_0x2012c4=_0x2012c4-0x0;var _0x4f7671=_0x6343[_0x2012c4];return _0x4f7671;};'use strict';var _=require('lodash');var util=require(_0x3634('0x0'));var moment=require(_0x3634('0x1'));var BPromise=require(_0x3634('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3634('0x3'))['db'];var utils=require(_0x3634('0x4'));var logger=require(_0x3634('0x5'))('rpc');var config=require(_0x3634('0x6'));var jayson=require(_0x3634('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5410d3,_0x1514b6,_0x25775d){return new BPromise(function(_0x151c89,_0x3089eb){return client[_0x3634('0x8')](_0x5410d3,_0x25775d)[_0x3634('0x9')](function(_0x30f0fe){logger[_0x3634('0xa')](_0x3634('0xb'),_0x1514b6,_0x3634('0xc'));logger[_0x3634('0xd')](_0x3634('0xe'),_0x1514b6,'request\x20sent',JSON['stringify'](_0x30f0fe));if(_0x30f0fe['error']){if(_0x30f0fe['error'][_0x3634('0xf')]===0x1f4){logger['error'](_0x3634('0xb'),_0x1514b6,_0x30f0fe[_0x3634('0x10')][_0x3634('0x11')]);return _0x3089eb(_0x30f0fe[_0x3634('0x10')][_0x3634('0x11')]);}logger[_0x3634('0x10')](_0x3634('0xb'),_0x1514b6,_0x30f0fe['error']['message']);return _0x151c89(_0x30f0fe['error']['message']);}else{logger[_0x3634('0xa')](_0x3634('0xb'),_0x1514b6,'request\x20sent');_0x151c89(_0x30f0fe[_0x3634('0x12')][_0x3634('0x11')]);}})[_0x3634('0x13')](function(_0x414a46){logger[_0x3634('0x10')](_0x3634('0xb'),_0x1514b6,_0x414a46);_0x3089eb(_0x414a46);});});}exports['GetMailServerIn']=function(_0x6bc093){var _0x4d8cd7=this;return new Promise(function(_0x137ea4,_0x2da11a){return db[_0x3634('0x14')][_0x3634('0x15')]({'raw':_0x6bc093[_0x3634('0x16')]?_0x6bc093[_0x3634('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x6bc093[_0x3634('0x16')]?_0x6bc093[_0x3634('0x16')][_0x3634('0x17')]||null:null,'attributes':_0x6bc093[_0x3634('0x16')]?_0x6bc093[_0x3634('0x16')][_0x3634('0x18')]||null:null,'limit':_0x6bc093[_0x3634('0x16')]?_0x6bc093['options'][_0x3634('0x19')]||null:null,'include':_0x6bc093[_0x3634('0x16')]?_0x6bc093[_0x3634('0x16')][_0x3634('0x1a')]?_['map'](_0x6bc093[_0x3634('0x16')][_0x3634('0x1a')],function(_0x54350c){return{'model':db[_0x54350c['model']],'as':_0x54350c['as'],'attributes':_0x54350c[_0x3634('0x18')],'include':_0x54350c[_0x3634('0x1a')]?_[_0x3634('0x1b')](_0x54350c['include'],function(_0x2dbdfb){return{'model':db[_0x2dbdfb[_0x3634('0x1c')]],'as':_0x2dbdfb['as'],'attributes':_0x2dbdfb[_0x3634('0x18')],'include':_0x2dbdfb['include']?_[_0x3634('0x1b')](_0x2dbdfb['include'],function(_0x4c1dca){return{'model':db[_0x4c1dca[_0x3634('0x1c')]],'as':_0x4c1dca['as'],'attributes':_0x4c1dca[_0x3634('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3634('0x9')](function(_0x39abd8){logger[_0x3634('0xa')](_0x3634('0x1d'),_0x6bc093);logger[_0x3634('0xd')](_0x3634('0x1d'),_0x6bc093,JSON[_0x3634('0x1e')](_0x39abd8));_0x137ea4(_0x39abd8);})[_0x3634('0x13')](function(_0xeabd0d){logger['error']('GetMailServerIn',_0xeabd0d[_0x3634('0x11')],_0x6bc093);_0x2da11a(_0x4d8cd7[_0x3634('0x10')](0x1f4,_0xeabd0d[_0x3634('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 393f218..13622cb 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7a54,0x106));var _0x47a5=function(_0x2ad50d,_0x187098){_0x2ad50d=_0x2ad50d-0x0;var _0x132014=_0x7a54[_0x2ad50d];return _0x132014;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x7a54,0x106));var _0x47a5=function(_0x14f5d0,_0x140816){_0x14f5d0=_0x14f5d0-0x0;var _0x1af7e9=_0x7a54[_0x14f5d0];return _0x1af7e9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index e4a41b9..238626b 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 _0xed3c=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x1b6582,_0xd738f9){var _0x107805=function(_0x369233){while(--_0x369233){_0x1b6582['push'](_0x1b6582['shift']());}};_0x107805(++_0xd738f9);}(_0xed3c,0x1a6));var _0xced3=function(_0x48ace4,_0x3ecb6d){_0x48ace4=_0x48ace4-0x0;var _0x1605a1=_0xed3c[_0x48ace4];return _0x1605a1;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'description':{'type':Sequelize[_0xced3('0x2')]},'host':{'type':Sequelize[_0xced3('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xced3('0x2')]},'port':{'type':Sequelize[_0xced3('0x3')]},'secure':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xced3('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa74f=['BOOLEAN','STRING','INTEGER'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa74f,0x9a));var _0xfa74=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xa74f[_0x5f519b];return _0x2461e2;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xfa74('0x0')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xfa74('0x0')]},'port':{'type':Sequelize[_0xfa74('0x1')]},'secure':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xfa74('0x0')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 98e6bb6..61195a6 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 _0xc42a=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc42a,0x128));var _0xac42=function(_0x384afa,_0x4cb260){_0x384afa=_0x384afa-0x0;var _0xced5aa=_0xc42a[_0x384afa];return _0xced5aa;};'use strict';var emlformat=require(_0xac42('0x0'));var rimraf=require(_0xac42('0x1'));var zipdir=require(_0xac42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xac42('0x3'));var Mustache=require(_0xac42('0x4'));var util=require(_0xac42('0x5'));var path=require(_0xac42('0x6'));var sox=require(_0xac42('0x7'));var csv=require('to-csv');var ejs=require(_0xac42('0x8'));var fs=require('fs');var fs_extra=require(_0xac42('0x9'));var _=require(_0xac42('0xa'));var squel=require(_0xac42('0xb'));var crypto=require(_0xac42('0xc'));var jsforce=require(_0xac42('0xd'));var deskjs=require(_0xac42('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac42('0xf'));var Redis=require(_0xac42('0x10'));var authService=require(_0xac42('0x11'));var qs=require(_0xac42('0x12'));var as=require(_0xac42('0x13'));var hardwareService=require(_0xac42('0x14'));var logger=require(_0xac42('0x15'))(_0xac42('0x16'));var utils=require(_0xac42('0x17'));var config=require(_0xac42('0x18'));var licenseUtil=require(_0xac42('0x19'));var db=require(_0xac42('0x1a'))['db'];function respondWithStatusCode(_0x43cebb,_0x134a27){_0x134a27=_0x134a27||0xcc;return function(_0x2a288b){if(_0x2a288b){return _0x43cebb['sendStatus'](_0x134a27);}return _0x43cebb[_0xac42('0x1b')](_0x134a27)[_0xac42('0x1c')]();};}function respondWithResult(_0x4976f9,_0x111ebf){_0x111ebf=_0x111ebf||0xc8;return function(_0x2d4655){if(_0x2d4655){return _0x4976f9['status'](_0x111ebf)['json'](_0x2d4655);}};}function respondWithFilteredResult(_0x14b396,_0x5f126e){return function(_0x22433e){if(_0x22433e){var _0x13640d=typeof _0x5f126e['offset']===_0xac42('0x1d')&&typeof _0x5f126e[_0xac42('0x1e')]==='undefined';var _0xd19e4c=_0x22433e['count'];var _0x4ef3af=_0x13640d?0x0:_0x5f126e[_0xac42('0x1f')];var _0xad1dcb=_0x13640d?_0x22433e[_0xac42('0x20')]:_0x5f126e['offset']+_0x5f126e['limit'];var _0x1a284d;if(_0xad1dcb>=_0xd19e4c){_0xad1dcb=_0xd19e4c;_0x1a284d=0xc8;}else{_0x1a284d=0xce;}_0x14b396[_0xac42('0x1b')](_0x1a284d);return _0x14b396['set'](_0xac42('0x21'),_0x4ef3af+'-'+_0xad1dcb+'/'+_0xd19e4c)[_0xac42('0x22')](_0x22433e);}return null;};}function patchUpdates(_0x4a71a4){return function(_0x5ac7a7){try{jsonpatch[_0xac42('0x23')](_0x5ac7a7,_0x4a71a4,!![]);}catch(_0xb7bd5f){return BPromise[_0xac42('0x24')](_0xb7bd5f);}return _0x5ac7a7['save']();};}function saveUpdates(_0x1aaabe,_0x1ff38f){return function(_0xf51802){if(_0xf51802){return _0xf51802[_0xac42('0x25')](_0x1aaabe)['then'](function(_0x402dff){return _0x402dff;});}return null;};}function removeEntity(_0x5420ed,_0x2c7d69){return function(_0x1e922b){if(_0x1e922b){return _0x1e922b[_0xac42('0x26')]()['then'](function(){_0x5420ed[_0xac42('0x1b')](0xcc)[_0xac42('0x1c')]();});}};}function handleEntityNotFound(_0x3e0ffb,_0x131d22){return function(_0x49a1e3){if(!_0x49a1e3){_0x3e0ffb[_0xac42('0x27')](0x194);}return _0x49a1e3;};}function handleError(_0x3e84ec,_0x1481b4){_0x1481b4=_0x1481b4||0x1f4;return function(_0x14fa27){logger[_0xac42('0x28')](_0x14fa27[_0xac42('0x29')]);if(_0x14fa27[_0xac42('0x2a')]){delete _0x14fa27[_0xac42('0x2a')];}_0x3e84ec[_0xac42('0x1b')](_0x1481b4)[_0xac42('0x2b')](_0x14fa27);};}exports[_0xac42('0x2c')]=function(_0x32f7fe,_0x59f4bc){var _0x2bd0b7={},_0x244e72={},_0x1c222a={'count':0x0,'rows':[]};var _0x46f4c3=_[_0xac42('0x2d')](db[_0xac42('0x2e')][_0xac42('0x2f')],function(_0x571e72){return{'name':_0x571e72[_0xac42('0x30')],'type':_0x571e72[_0xac42('0x31')][_0xac42('0x32')]};});_0x244e72[_0xac42('0x33')]=_['map'](_0x46f4c3,_0xac42('0x2a'));_0x244e72['query']=_[_0xac42('0x34')](_0x32f7fe[_0xac42('0x35')]);_0x244e72['filters']=_[_0xac42('0x36')](_0x244e72['model'],_0x244e72['query']);_0x2bd0b7[_0xac42('0x37')]=_[_0xac42('0x36')](_0x244e72[_0xac42('0x33')],qs[_0xac42('0x38')](_0x32f7fe['query'][_0xac42('0x38')]));_0x2bd0b7['attributes']=_0x2bd0b7[_0xac42('0x37')][_0xac42('0x39')]?_0x2bd0b7[_0xac42('0x37')]:_0x244e72[_0xac42('0x33')];if(!_0x32f7fe['query'][_0xac42('0x3a')](_0xac42('0x3b'))){_0x2bd0b7['limit']=qs['limit'](_0x32f7fe[_0xac42('0x35')][_0xac42('0x1e')]);_0x2bd0b7['offset']=qs['offset'](_0x32f7fe[_0xac42('0x35')]['offset']);}_0x2bd0b7['order']=qs[_0xac42('0x3c')](_0x32f7fe['query'][_0xac42('0x3c')]);_0x2bd0b7['where']=qs[_0xac42('0x3d')](_[_0xac42('0x3e')](_0x32f7fe[_0xac42('0x35')],_0x244e72['filters']),_0x46f4c3);if(_0x32f7fe[_0xac42('0x35')]['filter']){_0x2bd0b7[_0xac42('0x3f')]=_[_0xac42('0x40')](_0x2bd0b7[_0xac42('0x3f')],{'$or':_['map'](_0x46f4c3,function(_0x25c9d1){if(_0x25c9d1[_0xac42('0x31')]!==_0xac42('0x41')){var _0x4f6589={};_0x4f6589[_0x25c9d1['name']]={'$like':'%'+_0x32f7fe[_0xac42('0x35')][_0xac42('0x42')]+'%'};return _0x4f6589;}})});}_0x2bd0b7=_['merge']({},_0x2bd0b7,_0x32f7fe['options']);var _0x51a587={'where':_0x2bd0b7[_0xac42('0x3f')]};return db[_0xac42('0x2e')]['count'](_0x51a587)[_0xac42('0x43')](function(_0x9a91e9){_0x1c222a[_0xac42('0x20')]=_0x9a91e9;if(_0x32f7fe['query'][_0xac42('0x44')]){_0x2bd0b7[_0xac42('0x45')]=[{'all':!![]}];}return db[_0xac42('0x2e')][_0xac42('0x46')](_0x2bd0b7);})[_0xac42('0x43')](function(_0x25274f){_0x1c222a[_0xac42('0x47')]=_0x25274f;return _0x1c222a;})[_0xac42('0x43')](respondWithFilteredResult(_0x59f4bc,_0x2bd0b7))['catch'](handleError(_0x59f4bc,null));};exports[_0xac42('0x48')]=function(_0x1c8067,_0x48a633){var _0x32990e={'raw':!![],'where':{'id':_0x1c8067['params']['id']}},_0x479029={};_0x479029[_0xac42('0x33')]=_[_0xac42('0x34')](db[_0xac42('0x2e')][_0xac42('0x2f')]);_0x479029['query']=_[_0xac42('0x34')](_0x1c8067[_0xac42('0x35')]);_0x479029[_0xac42('0x3d')]=_['intersection'](_0x479029['model'],_0x479029['query']);_0x32990e[_0xac42('0x37')]=_[_0xac42('0x36')](_0x479029[_0xac42('0x33')],qs['fields'](_0x1c8067[_0xac42('0x35')][_0xac42('0x38')]));_0x32990e[_0xac42('0x37')]=_0x32990e[_0xac42('0x37')][_0xac42('0x39')]?_0x32990e['attributes']:_0x479029[_0xac42('0x33')];if(_0x1c8067['query'][_0xac42('0x44')]){_0x32990e[_0xac42('0x45')]=[{'all':!![]}];}_0x32990e=_[_0xac42('0x40')]({},_0x32990e,_0x1c8067[_0xac42('0x49')]);return db['MailServerOut'][_0xac42('0x4a')](_0x32990e)[_0xac42('0x43')](handleEntityNotFound(_0x48a633,null))['then'](respondWithResult(_0x48a633,null))[_0xac42('0x4b')](handleError(_0x48a633,null));};exports[_0xac42('0x4c')]=function(_0x4f92b4,_0x5e18c5){return db[_0xac42('0x2e')]['create'](_0x4f92b4[_0xac42('0x4d')],{})['then'](respondWithResult(_0x5e18c5,0xc9))[_0xac42('0x4b')](handleError(_0x5e18c5,null));};exports[_0xac42('0x25')]=function(_0x854e7b,_0x13c416){if(_0x854e7b['body']['id']){delete _0x854e7b[_0xac42('0x4d')]['id'];}return db['MailServerOut'][_0xac42('0x4a')]({'where':{'id':_0x854e7b[_0xac42('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13c416,null))['then'](saveUpdates(_0x854e7b['body'],null))[_0xac42('0x43')](respondWithResult(_0x13c416,null))[_0xac42('0x4b')](handleError(_0x13c416,null));};exports['destroy']=function(_0x3f3b18,_0x16bb53){return db[_0xac42('0x2e')][_0xac42('0x4a')]({'where':{'id':_0x3f3b18[_0xac42('0x4e')]['id']}})[_0xac42('0x43')](handleEntityNotFound(_0x16bb53,null))[_0xac42('0x43')](removeEntity(_0x16bb53,null))[_0xac42('0x4b')](handleError(_0x16bb53,null));}; \ No newline at end of file +var _0x16ab=['keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','nolimit','sort','pick','filters','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x4655a3,_0x25ad7d){var _0x1dfa29=function(_0x2a6475){while(--_0x2a6475){_0x4655a3['push'](_0x4655a3['shift']());}};_0x1dfa29(++_0x25ad7d);}(_0x16ab,0xe6));var _0xb16a=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x16ab[_0x1cc8fe];return _0x230054;};'use strict';var emlformat=require(_0xb16a('0x0'));var rimraf=require(_0xb16a('0x1'));var zipdir=require(_0xb16a('0x2'));var jsonpatch=require(_0xb16a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb16a('0x4'));var Mustache=require(_0xb16a('0x5'));var util=require(_0xb16a('0x6'));var path=require(_0xb16a('0x7'));var sox=require(_0xb16a('0x8'));var csv=require(_0xb16a('0x9'));var ejs=require(_0xb16a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb16a('0xb'));var squel=require(_0xb16a('0xc'));var crypto=require(_0xb16a('0xd'));var jsforce=require(_0xb16a('0xe'));var deskjs=require(_0xb16a('0xf'));var toCsv=require(_0xb16a('0x9'));var querystring=require(_0xb16a('0x10'));var Papa=require(_0xb16a('0x11'));var Redis=require(_0xb16a('0x12'));var authService=require(_0xb16a('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb16a('0x14'))(_0xb16a('0x15'));var utils=require(_0xb16a('0x16'));var config=require(_0xb16a('0x17'));var licenseUtil=require(_0xb16a('0x18'));var db=require(_0xb16a('0x19'))['db'];function respondWithStatusCode(_0x568978,_0x532e4b){_0x532e4b=_0x532e4b||0xcc;return function(_0x293f5d){if(_0x293f5d){return _0x568978[_0xb16a('0x1a')](_0x532e4b);}return _0x568978['status'](_0x532e4b)[_0xb16a('0x1b')]();};}function respondWithResult(_0x3ba05c,_0x146221){_0x146221=_0x146221||0xc8;return function(_0x4f1deb){if(_0x4f1deb){return _0x3ba05c[_0xb16a('0x1c')](_0x146221)[_0xb16a('0x1d')](_0x4f1deb);}};}function respondWithFilteredResult(_0x1ed83d,_0xa3842c){return function(_0x3e2586){if(_0x3e2586){var _0x125aaa=typeof _0xa3842c[_0xb16a('0x1e')]===_0xb16a('0x1f')&&typeof _0xa3842c[_0xb16a('0x20')]===_0xb16a('0x1f');var _0x500a03=_0x3e2586[_0xb16a('0x21')];var _0x21f01c=_0x125aaa?0x0:_0xa3842c[_0xb16a('0x1e')];var _0x30b019=_0x125aaa?_0x3e2586[_0xb16a('0x21')]:_0xa3842c[_0xb16a('0x1e')]+_0xa3842c[_0xb16a('0x20')];var _0x1430f5;if(_0x30b019>=_0x500a03){_0x30b019=_0x500a03;_0x1430f5=0xc8;}else{_0x1430f5=0xce;}_0x1ed83d[_0xb16a('0x1c')](_0x1430f5);return _0x1ed83d[_0xb16a('0x22')]('Content-Range',_0x21f01c+'-'+_0x30b019+'/'+_0x500a03)[_0xb16a('0x1d')](_0x3e2586);}return null;};}function patchUpdates(_0x1c5857){return function(_0x2ca862){try{jsonpatch[_0xb16a('0x23')](_0x2ca862,_0x1c5857,!![]);}catch(_0x33b1f8){return BPromise[_0xb16a('0x24')](_0x33b1f8);}return _0x2ca862[_0xb16a('0x25')]();};}function saveUpdates(_0x193ef8,_0x872ab3){return function(_0x2ef1a5){if(_0x2ef1a5){return _0x2ef1a5[_0xb16a('0x26')](_0x193ef8)[_0xb16a('0x27')](function(_0x413cf5){return _0x413cf5;});}return null;};}function removeEntity(_0x2e30b3,_0x1b6902){return function(_0x8e221c){if(_0x8e221c){return _0x8e221c[_0xb16a('0x28')]()[_0xb16a('0x27')](function(){_0x2e30b3['status'](0xcc)[_0xb16a('0x1b')]();});}};}function handleEntityNotFound(_0x19d44a,_0x2f125e){return function(_0x4b2b64){if(!_0x4b2b64){_0x19d44a['sendStatus'](0x194);}return _0x4b2b64;};}function handleError(_0x23bdcd,_0x5e25e4){_0x5e25e4=_0x5e25e4||0x1f4;return function(_0x7f1f11){logger['error'](_0x7f1f11[_0xb16a('0x29')]);if(_0x7f1f11[_0xb16a('0x2a')]){delete _0x7f1f11[_0xb16a('0x2a')];}_0x23bdcd['status'](_0x5e25e4)['send'](_0x7f1f11);};}exports[_0xb16a('0x2b')]=function(_0x520c7f,_0x5142f9){var _0x75a06d={},_0xe9ce7f={},_0x4e2f88={'count':0x0,'rows':[]};var _0x504373=_['map'](db[_0xb16a('0x2c')][_0xb16a('0x2d')],function(_0x1bc1f1){return{'name':_0x1bc1f1[_0xb16a('0x2e')],'type':_0x1bc1f1[_0xb16a('0x2f')][_0xb16a('0x30')]};});_0xe9ce7f[_0xb16a('0x31')]=_[_0xb16a('0x32')](_0x504373,_0xb16a('0x2a'));_0xe9ce7f[_0xb16a('0x33')]=_['keys'](_0x520c7f['query']);_0xe9ce7f['filters']=_[_0xb16a('0x34')](_0xe9ce7f[_0xb16a('0x31')],_0xe9ce7f[_0xb16a('0x33')]);_0x75a06d['attributes']=_[_0xb16a('0x34')](_0xe9ce7f[_0xb16a('0x31')],qs[_0xb16a('0x35')](_0x520c7f['query'][_0xb16a('0x35')]));_0x75a06d['attributes']=_0x75a06d[_0xb16a('0x36')][_0xb16a('0x37')]?_0x75a06d['attributes']:_0xe9ce7f[_0xb16a('0x31')];if(!_0x520c7f[_0xb16a('0x33')]['hasOwnProperty'](_0xb16a('0x38'))){_0x75a06d[_0xb16a('0x20')]=qs[_0xb16a('0x20')](_0x520c7f[_0xb16a('0x33')][_0xb16a('0x20')]);_0x75a06d[_0xb16a('0x1e')]=qs[_0xb16a('0x1e')](_0x520c7f[_0xb16a('0x33')]['offset']);}_0x75a06d['order']=qs['sort'](_0x520c7f['query'][_0xb16a('0x39')]);_0x75a06d['where']=qs['filters'](_[_0xb16a('0x3a')](_0x520c7f[_0xb16a('0x33')],_0xe9ce7f[_0xb16a('0x3b')]),_0x504373);if(_0x520c7f[_0xb16a('0x33')]['filter']){_0x75a06d['where']=_[_0xb16a('0x3c')](_0x75a06d[_0xb16a('0x3d')],{'$or':_[_0xb16a('0x32')](_0x504373,function(_0x1f2469){if(_0x1f2469[_0xb16a('0x2f')]!==_0xb16a('0x3e')){var _0x51114f={};_0x51114f[_0x1f2469[_0xb16a('0x2a')]]={'$like':'%'+_0x520c7f[_0xb16a('0x33')]['filter']+'%'};return _0x51114f;}})});}_0x75a06d=_['merge']({},_0x75a06d,_0x520c7f[_0xb16a('0x3f')]);var _0x30f590={'where':_0x75a06d[_0xb16a('0x3d')]};return db['MailServerOut'][_0xb16a('0x21')](_0x30f590)[_0xb16a('0x27')](function(_0x364993){_0x4e2f88[_0xb16a('0x21')]=_0x364993;if(_0x520c7f['query'][_0xb16a('0x40')]){_0x75a06d[_0xb16a('0x41')]=[{'all':!![]}];}return db[_0xb16a('0x2c')][_0xb16a('0x42')](_0x75a06d);})[_0xb16a('0x27')](function(_0x215118){_0x4e2f88[_0xb16a('0x43')]=_0x215118;return _0x4e2f88;})[_0xb16a('0x27')](respondWithFilteredResult(_0x5142f9,_0x75a06d))[_0xb16a('0x44')](handleError(_0x5142f9,null));};exports[_0xb16a('0x45')]=function(_0x242672,_0x53ae1b){var _0x4366d0={'raw':!![],'where':{'id':_0x242672['params']['id']}},_0xe45a7a={};_0xe45a7a[_0xb16a('0x31')]=_['keys'](db[_0xb16a('0x2c')][_0xb16a('0x2d')]);_0xe45a7a['query']=_[_0xb16a('0x46')](_0x242672[_0xb16a('0x33')]);_0xe45a7a[_0xb16a('0x3b')]=_['intersection'](_0xe45a7a[_0xb16a('0x31')],_0xe45a7a[_0xb16a('0x33')]);_0x4366d0[_0xb16a('0x36')]=_[_0xb16a('0x34')](_0xe45a7a[_0xb16a('0x31')],qs[_0xb16a('0x35')](_0x242672[_0xb16a('0x33')]['fields']));_0x4366d0['attributes']=_0x4366d0[_0xb16a('0x36')][_0xb16a('0x37')]?_0x4366d0[_0xb16a('0x36')]:_0xe45a7a[_0xb16a('0x31')];if(_0x242672[_0xb16a('0x33')]['includeAll']){_0x4366d0['include']=[{'all':!![]}];}_0x4366d0=_[_0xb16a('0x3c')]({},_0x4366d0,_0x242672[_0xb16a('0x3f')]);return db['MailServerOut'][_0xb16a('0x47')](_0x4366d0)[_0xb16a('0x27')](handleEntityNotFound(_0x53ae1b,null))['then'](respondWithResult(_0x53ae1b,null))['catch'](handleError(_0x53ae1b,null));};exports['create']=function(_0xf06f53,_0x149439){return db[_0xb16a('0x2c')][_0xb16a('0x48')](_0xf06f53[_0xb16a('0x49')],{})[_0xb16a('0x27')](respondWithResult(_0x149439,0xc9))[_0xb16a('0x44')](handleError(_0x149439,null));};exports[_0xb16a('0x26')]=function(_0x346e10,_0x28757d){if(_0x346e10['body']['id']){delete _0x346e10[_0xb16a('0x49')]['id'];}return db[_0xb16a('0x2c')][_0xb16a('0x47')]({'where':{'id':_0x346e10[_0xb16a('0x4a')]['id']}})[_0xb16a('0x27')](handleEntityNotFound(_0x28757d,null))['then'](saveUpdates(_0x346e10[_0xb16a('0x49')],null))['then'](respondWithResult(_0x28757d,null))[_0xb16a('0x44')](handleError(_0x28757d,null));};exports[_0xb16a('0x28')]=function(_0x3e1593,_0x236df3){return db[_0xb16a('0x2c')]['find']({'where':{'id':_0x3e1593[_0xb16a('0x4a')]['id']}})[_0xb16a('0x27')](handleEntityNotFound(_0x236df3,null))[_0xb16a('0x27')](removeEntity(_0x236df3,null))[_0xb16a('0x44')](handleError(_0x236df3,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1681e02..cb2c00d 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 _0x74c1=['mail_servers_out','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x546c39,_0x398532){var _0x3cbc74=function(_0x42c9e9){while(--_0x42c9e9){_0x546c39['push'](_0x546c39['shift']());}};_0x3cbc74(++_0x398532);}(_0x74c1,0xc7));var _0x174c=function(_0x330889,_0x534cdb){_0x330889=_0x330889-0x0;var _0x1f2911=_0x74c1[_0x330889];return _0x1f2911;};'use strict';var _=require(_0x174c('0x0'));var util=require(_0x174c('0x1'));var logger=require(_0x174c('0x2'))('api');var moment=require(_0x174c('0x3'));var BPromise=require(_0x174c('0x4'));var rp=require(_0x174c('0x5'));var fs=require('fs');var path=require(_0x174c('0x6'));var rimraf=require('rimraf');var config=require(_0x174c('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x174c('0x8')]=function(_0x1e51c4,_0x396959){return _0x1e51c4[_0x174c('0x9')]('MailServerOut',attributes,{'tableName':_0x174c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3791=['../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x528d27,_0xd48bdf){var _0x3bbd1f=function(_0xa7633){while(--_0xa7633){_0x528d27['push'](_0x528d27['shift']());}};_0x3bbd1f(++_0xd48bdf);}(_0x3791,0x88));var _0x1379=function(_0x360ece,_0x32f202){_0x360ece=_0x360ece-0x0;var _0x5f4ff8=_0x3791[_0x360ece];return _0x5f4ff8;};'use strict';var _=require(_0x1379('0x0'));var util=require(_0x1379('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1379('0x2'));var BPromise=require(_0x1379('0x3'));var rp=require(_0x1379('0x4'));var fs=require('fs');var path=require(_0x1379('0x5'));var rimraf=require(_0x1379('0x6'));var config=require(_0x1379('0x7'));var attributes=require(_0x1379('0x8'));module[_0x1379('0x9')]=function(_0x5d9b92,_0x36a1f8){return _0x5d9b92[_0x1379('0xa')](_0x1379('0xb'),attributes,{'tableName':_0x1379('0xc'),'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 15bf0fb..52959ac 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(_0x154a0a,_0x96977b){var _0x550392=function(_0xf5f946){while(--_0xf5f946){_0x154a0a['push'](_0x154a0a['shift']());}};_0x550392(++_0x96977b);}(_0x2ef3,0xba));var _0x32ef=function(_0x221ce2,_0x4871f0){_0x221ce2=_0x221ce2-0x0;var _0x274631=_0x2ef3[_0x221ce2];return _0x274631;};'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 _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4a1375,_0x5a6374){var _0x236ec8=function(_0x141bb6){while(--_0x141bb6){_0x4a1375['push'](_0x4a1375['shift']());}};_0x236ec8(++_0x5a6374);}(_0x1261,0x144));var _0x1126=function(_0x4b1bb0,_0x7dc32b){_0x4b1bb0=_0x4b1bb0-0x0;var _0x549407=_0x1261[_0x4b1bb0];return _0x549407;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 8c708f6..7f6b783 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 _0x26b9=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller','get'];(function(_0x23b035,_0x38d7dd){var _0x114848=function(_0x3130e7){while(--_0x3130e7){_0x23b035['push'](_0x23b035['shift']());}};_0x114848(++_0x38d7dd);}(_0x26b9,0xe2));var _0x926b=function(_0x2bb787,_0x41bf02){_0x2bb787=_0x2bb787-0x0;var _0x425b33=_0x26b9[_0x2bb787];return _0x425b33;};'use strict';var multer=require(_0x926b('0x0'));var util=require('util');var path=require(_0x926b('0x1'));var timeout=require(_0x926b('0x2'));var express=require('express');var router=express[_0x926b('0x3')]();var fs_extra=require(_0x926b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x926b('0x5'));var config=require('../../config/environment');var controller=require(_0x926b('0x6'));router[_0x926b('0x7')]('/',auth[_0x926b('0x8')](),controller['index']);router[_0x926b('0x7')](_0x926b('0x9'),auth[_0x926b('0x8')](),controller[_0x926b('0xa')]);router[_0x926b('0x7')](_0x926b('0xb'),auth[_0x926b('0x8')](),controller[_0x926b('0xc')]);router[_0x926b('0xd')]('/',auth[_0x926b('0x8')](),controller[_0x926b('0xe')]);router[_0x926b('0xf')](_0x926b('0xb'),auth[_0x926b('0x8')](),controller[_0x926b('0x10')]);router[_0x926b('0x11')]('/:id',auth[_0x926b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc28e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util'];(function(_0x6107d,_0x374ead){var _0xa6f1ac=function(_0x3caae0){while(--_0x3caae0){_0x6107d['push'](_0x6107d['shift']());}};_0xa6f1ac(++_0x374ead);}(_0xc28e,0x139));var _0xec28=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc28e[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0xec28('0x0'));var util=require(_0xec28('0x1'));var path=require(_0xec28('0x2'));var timeout=require(_0xec28('0x3'));var express=require('express');var router=express[_0xec28('0x4')]();var fs_extra=require(_0xec28('0x5'));var auth=require(_0xec28('0x6'));var interaction=require(_0xec28('0x7'));var config=require('../../config/environment');var controller=require(_0xec28('0x8'));router[_0xec28('0x9')]('/',auth[_0xec28('0xa')](),controller[_0xec28('0xb')]);router['get'](_0xec28('0xc'),auth[_0xec28('0xa')](),controller[_0xec28('0xd')]);router[_0xec28('0x9')]('/:id',auth[_0xec28('0xa')](),controller[_0xec28('0xe')]);router[_0xec28('0xf')]('/',auth[_0xec28('0xa')](),controller[_0xec28('0x10')]);router[_0xec28('0x11')](_0xec28('0x12'),auth[_0xec28('0xa')](),controller['update']);router['delete'](_0xec28('0x12'),auth[_0xec28('0xa')](),controller[_0xec28('0x13')]);module[_0xec28('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 09c70d8..9f18f4e 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 _0x326f=['name','STRING','sequelize'];(function(_0x1489b2,_0x42823f){var _0x16611d=function(_0x567f07){while(--_0x567f07){_0x1489b2['push'](_0x1489b2['shift']());}};_0x16611d(++_0x42823f);}(_0x326f,0xd1));var _0xf326=function(_0xabf4e2,_0x5a8296){_0xabf4e2=_0xabf4e2-0x0;var _0x226405=_0x326f[_0xabf4e2];return _0x226405;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf326('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf326('0x2')]}}; \ No newline at end of file +var _0x0af5=['STRING','name','exports'];(function(_0x10d0f0,_0x1eba3d){var _0x93e308=function(_0x388548){while(--_0x388548){_0x10d0f0['push'](_0x10d0f0['shift']());}};_0x93e308(++_0x1eba3d);}(_0x0af5,0x158));var _0x50af=function(_0xdf4147,_0x3117b7){_0xdf4147=_0xdf4147-0x0;var _0x49b154=_0x0af5[_0xdf4147];return _0x49b154;};'use strict';var Sequelize=require('sequelize');module[_0x50af('0x0')]={'name':{'type':Sequelize[_0x50af('0x1')],'unique':_0x50af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x50af('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 4104fe9..d66bc13 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 _0xf66f=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','model'];(function(_0x802997,_0x5534a2){var _0x35c641=function(_0x22c4f2){while(--_0x22c4f2){_0x802997['push'](_0x802997['shift']());}};_0x35c641(++_0x5534a2);}(_0xf66f,0x1d8));var _0xff66=function(_0x37628a,_0x92e3c6){_0x37628a=_0x37628a-0x0;var _0x1cf2bf=_0xf66f[_0x37628a];return _0x1cf2bf;};'use strict';var emlformat=require(_0xff66('0x0'));var rimraf=require(_0xff66('0x1'));var zipdir=require(_0xff66('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xff66('0x3'));var BPromise=require(_0xff66('0x4'));var Mustache=require(_0xff66('0x5'));var util=require('util');var path=require(_0xff66('0x6'));var sox=require(_0xff66('0x7'));var csv=require('to-csv');var ejs=require(_0xff66('0x8'));var fs=require('fs');var fs_extra=require(_0xff66('0x9'));var _=require('lodash');var squel=require(_0xff66('0xa'));var crypto=require(_0xff66('0xb'));var jsforce=require(_0xff66('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff66('0xd'));var Papa=require(_0xff66('0xe'));var Redis=require(_0xff66('0xf'));var authService=require(_0xff66('0x10'));var qs=require(_0xff66('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff66('0x12'))(_0xff66('0x13'));var utils=require('../../config/utils');var config=require(_0xff66('0x14'));var licenseUtil=require(_0xff66('0x15'));var db=require(_0xff66('0x16'))['db'];function respondWithStatusCode(_0x3c3713,_0x887f7c){_0x887f7c=_0x887f7c||0xcc;return function(_0x396b6d){if(_0x396b6d){return _0x3c3713[_0xff66('0x17')](_0x887f7c);}return _0x3c3713[_0xff66('0x18')](_0x887f7c)[_0xff66('0x19')]();};}function respondWithResult(_0x20318b,_0x4ded0c){_0x4ded0c=_0x4ded0c||0xc8;return function(_0xfbebc8){if(_0xfbebc8){return _0x20318b[_0xff66('0x18')](_0x4ded0c)['json'](_0xfbebc8);}};}function respondWithFilteredResult(_0x27037a,_0x119ae3){return function(_0x5e5b0d){if(_0x5e5b0d){var _0xba85ed=typeof _0x119ae3['offset']===_0xff66('0x1a')&&typeof _0x119ae3['limit']===_0xff66('0x1a');var _0x2d2093=_0x5e5b0d[_0xff66('0x1b')];var _0x55e1c5=_0xba85ed?0x0:_0x119ae3[_0xff66('0x1c')];var _0x5ccb3a=_0xba85ed?_0x5e5b0d[_0xff66('0x1b')]:_0x119ae3['offset']+_0x119ae3['limit'];var _0x384a28;if(_0x5ccb3a>=_0x2d2093){_0x5ccb3a=_0x2d2093;_0x384a28=0xc8;}else{_0x384a28=0xce;}_0x27037a[_0xff66('0x18')](_0x384a28);return _0x27037a['set'](_0xff66('0x1d'),_0x55e1c5+'-'+_0x5ccb3a+'/'+_0x2d2093)[_0xff66('0x1e')](_0x5e5b0d);}return null;};}function patchUpdates(_0x186320){return function(_0x946f0c){try{jsonpatch['apply'](_0x946f0c,_0x186320,!![]);}catch(_0x203732){return BPromise[_0xff66('0x1f')](_0x203732);}return _0x946f0c[_0xff66('0x20')]();};}function saveUpdates(_0x34d448,_0x47dd62){return function(_0x473bb2){if(_0x473bb2){return _0x473bb2[_0xff66('0x21')](_0x34d448)['then'](function(_0x3fc7fa){return _0x3fc7fa;});}return null;};}function removeEntity(_0x328cd0,_0x3e83d3){return function(_0x578a75){if(_0x578a75){return _0x578a75[_0xff66('0x22')]()[_0xff66('0x23')](function(){_0x328cd0[_0xff66('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc170cf,_0x5d2aa9){return function(_0x361d64){if(!_0x361d64){_0xc170cf[_0xff66('0x17')](0x194);}return _0x361d64;};}function handleError(_0x27debe,_0x11c7a4){_0x11c7a4=_0x11c7a4||0x1f4;return function(_0x51df3f){logger[_0xff66('0x24')](_0x51df3f[_0xff66('0x25')]);if(_0x51df3f[_0xff66('0x26')]){delete _0x51df3f[_0xff66('0x26')];}_0x27debe['status'](_0x11c7a4)[_0xff66('0x27')](_0x51df3f);};}exports[_0xff66('0x28')]=function(_0x5df954,_0x101147){var _0x1df32f={},_0x21e3cc={},_0x1bdb97={'count':0x0,'rows':[]};var _0x2dc9db=_[_0xff66('0x29')](db[_0xff66('0x2a')][_0xff66('0x2b')],function(_0x229fad){return{'name':_0x229fad[_0xff66('0x2c')],'type':_0x229fad['type']['key']};});_0x21e3cc[_0xff66('0x2d')]=_[_0xff66('0x29')](_0x2dc9db,'name');_0x21e3cc[_0xff66('0x2e')]=_[_0xff66('0x2f')](_0x5df954[_0xff66('0x2e')]);_0x21e3cc[_0xff66('0x30')]=_['intersection'](_0x21e3cc[_0xff66('0x2d')],_0x21e3cc['query']);_0x1df32f[_0xff66('0x31')]=_[_0xff66('0x32')](_0x21e3cc[_0xff66('0x2d')],qs[_0xff66('0x33')](_0x5df954[_0xff66('0x2e')][_0xff66('0x33')]));_0x1df32f[_0xff66('0x31')]=_0x1df32f[_0xff66('0x31')][_0xff66('0x34')]?_0x1df32f[_0xff66('0x31')]:_0x21e3cc[_0xff66('0x2d')];if(!_0x5df954[_0xff66('0x2e')][_0xff66('0x35')](_0xff66('0x36'))){_0x1df32f[_0xff66('0x37')]=qs[_0xff66('0x37')](_0x5df954[_0xff66('0x2e')][_0xff66('0x37')]);_0x1df32f[_0xff66('0x1c')]=qs[_0xff66('0x1c')](_0x5df954[_0xff66('0x2e')]['offset']);}_0x1df32f[_0xff66('0x38')]=qs['sort'](_0x5df954[_0xff66('0x2e')][_0xff66('0x39')]);_0x1df32f[_0xff66('0x3a')]=qs[_0xff66('0x30')](_['pick'](_0x5df954['query'],_0x21e3cc['filters']),_0x2dc9db);if(_0x5df954[_0xff66('0x2e')][_0xff66('0x3b')]){_0x1df32f[_0xff66('0x3a')]=_['merge'](_0x1df32f['where'],{'$or':_['map'](_0x2dc9db,function(_0x197c79){if(_0x197c79[_0xff66('0x3c')]!==_0xff66('0x3d')){var _0x313362={};_0x313362[_0x197c79[_0xff66('0x26')]]={'$like':'%'+_0x5df954['query'][_0xff66('0x3b')]+'%'};return _0x313362;}})});}_0x1df32f=_[_0xff66('0x3e')]({},_0x1df32f,_0x5df954[_0xff66('0x3f')]);var _0xa127e7={'where':_0x1df32f[_0xff66('0x3a')]};return db[_0xff66('0x2a')][_0xff66('0x1b')](_0xa127e7)[_0xff66('0x23')](function(_0x320cff){_0x1bdb97[_0xff66('0x1b')]=_0x320cff;if(_0x5df954[_0xff66('0x2e')][_0xff66('0x40')]){_0x1df32f['include']=[{'all':!![]}];}return db['MailSubstatus'][_0xff66('0x41')](_0x1df32f);})[_0xff66('0x23')](function(_0x1cf065){_0x1bdb97[_0xff66('0x42')]=_0x1cf065;return _0x1bdb97;})['then'](respondWithFilteredResult(_0x101147,_0x1df32f))['catch'](handleError(_0x101147,null));};exports[_0xff66('0x43')]=function(_0x53b3a4,_0x54a86c){var _0x4c06f8={'raw':!![],'where':{'id':_0x53b3a4['params']['id']}},_0xd2038a={};_0xd2038a[_0xff66('0x2d')]=_[_0xff66('0x2f')](db[_0xff66('0x2a')][_0xff66('0x2b')]);_0xd2038a['query']=_['keys'](_0x53b3a4[_0xff66('0x2e')]);_0xd2038a[_0xff66('0x30')]=_['intersection'](_0xd2038a[_0xff66('0x2d')],_0xd2038a[_0xff66('0x2e')]);_0x4c06f8[_0xff66('0x31')]=_[_0xff66('0x32')](_0xd2038a[_0xff66('0x2d')],qs[_0xff66('0x33')](_0x53b3a4['query'][_0xff66('0x33')]));_0x4c06f8[_0xff66('0x31')]=_0x4c06f8[_0xff66('0x31')][_0xff66('0x34')]?_0x4c06f8[_0xff66('0x31')]:_0xd2038a[_0xff66('0x2d')];if(_0x53b3a4[_0xff66('0x2e')]['includeAll']){_0x4c06f8['include']=[{'all':!![]}];}_0x4c06f8=_[_0xff66('0x3e')]({},_0x4c06f8,_0x53b3a4['options']);return db[_0xff66('0x2a')][_0xff66('0x44')](_0x4c06f8)['then'](handleEntityNotFound(_0x54a86c,null))[_0xff66('0x23')](respondWithResult(_0x54a86c,null))[_0xff66('0x45')](handleError(_0x54a86c,null));};exports[_0xff66('0x46')]=function(_0x495a0d,_0x6b10e2){return db[_0xff66('0x2a')]['create'](_0x495a0d[_0xff66('0x47')],{})[_0xff66('0x23')](respondWithResult(_0x6b10e2,0xc9))['catch'](handleError(_0x6b10e2,null));};exports['update']=function(_0x19ef53,_0x4cbc23){if(_0x19ef53[_0xff66('0x47')]['id']){delete _0x19ef53[_0xff66('0x47')]['id'];}return db[_0xff66('0x2a')][_0xff66('0x44')]({'where':{'id':_0x19ef53[_0xff66('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cbc23,null))[_0xff66('0x23')](saveUpdates(_0x19ef53[_0xff66('0x47')],null))[_0xff66('0x23')](respondWithResult(_0x4cbc23,null))['catch'](handleError(_0x4cbc23,null));};exports[_0xff66('0x22')]=function(_0x48868f,_0x512fbb){return db[_0xff66('0x2a')][_0xff66('0x44')]({'where':{'id':_0x48868f[_0xff66('0x48')]['id']}})[_0xff66('0x23')](handleEntityNotFound(_0x512fbb,null))['then'](removeEntity(_0x512fbb,null))[_0xff66('0x45')](handleError(_0x512fbb,null));};exports['describe']=function(_0x29df1c,_0x1a8525){return db[_0xff66('0x2a')][_0xff66('0x49')]()[_0xff66('0x23')](respondWithResult(_0x1a8525,null))[_0xff66('0x45')](handleError(_0x1a8525,null));}; \ No newline at end of file +var _0x2645=['merge','VIRTUAL','filter','options','MailSubstatus','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','send','type','key','query','filters','intersection','model','attributes','fields','order','sort','pick','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2645,0x1c1));var _0x5264=function(_0x41a57e,_0x26ac40){_0x41a57e=_0x41a57e-0x0;var _0x4f91ee=_0x2645[_0x41a57e];return _0x4f91ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5264('0x0'));var zipdir=require(_0x5264('0x1'));var jsonpatch=require(_0x5264('0x2'));var rp=require(_0x5264('0x3'));var moment=require(_0x5264('0x4'));var BPromise=require(_0x5264('0x5'));var Mustache=require(_0x5264('0x6'));var util=require(_0x5264('0x7'));var path=require(_0x5264('0x8'));var sox=require(_0x5264('0x9'));var csv=require('to-csv');var ejs=require(_0x5264('0xa'));var fs=require('fs');var fs_extra=require(_0x5264('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5264('0xc'));var jsforce=require(_0x5264('0xd'));var deskjs=require(_0x5264('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5264('0xf'));var Papa=require(_0x5264('0x10'));var Redis=require(_0x5264('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5264('0x12'));var as=require(_0x5264('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5264('0x14'))(_0x5264('0x15'));var utils=require(_0x5264('0x16'));var config=require(_0x5264('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5264('0x18'))['db'];function respondWithStatusCode(_0x513e7d,_0x123ffb){_0x123ffb=_0x123ffb||0xcc;return function(_0x2205f8){if(_0x2205f8){return _0x513e7d[_0x5264('0x19')](_0x123ffb);}return _0x513e7d[_0x5264('0x1a')](_0x123ffb)['end']();};}function respondWithResult(_0x50acb9,_0x187c45){_0x187c45=_0x187c45||0xc8;return function(_0x3e1a08){if(_0x3e1a08){return _0x50acb9[_0x5264('0x1a')](_0x187c45)[_0x5264('0x1b')](_0x3e1a08);}};}function respondWithFilteredResult(_0x25601c,_0x4126c1){return function(_0x3c0a19){if(_0x3c0a19){var _0x176b49=typeof _0x4126c1['offset']==='undefined'&&typeof _0x4126c1[_0x5264('0x1c')]===_0x5264('0x1d');var _0x700e0b=_0x3c0a19[_0x5264('0x1e')];var _0x15eeb5=_0x176b49?0x0:_0x4126c1[_0x5264('0x1f')];var _0x15d9f4=_0x176b49?_0x3c0a19[_0x5264('0x1e')]:_0x4126c1['offset']+_0x4126c1['limit'];var _0x318ebe;if(_0x15d9f4>=_0x700e0b){_0x15d9f4=_0x700e0b;_0x318ebe=0xc8;}else{_0x318ebe=0xce;}_0x25601c[_0x5264('0x1a')](_0x318ebe);return _0x25601c[_0x5264('0x20')]('Content-Range',_0x15eeb5+'-'+_0x15d9f4+'/'+_0x700e0b)[_0x5264('0x1b')](_0x3c0a19);}return null;};}function patchUpdates(_0x260d52){return function(_0x55a6d3){try{jsonpatch[_0x5264('0x21')](_0x55a6d3,_0x260d52,!![]);}catch(_0x38bb0d){return BPromise[_0x5264('0x22')](_0x38bb0d);}return _0x55a6d3[_0x5264('0x23')]();};}function saveUpdates(_0x4a473b,_0x3a64d8){return function(_0x21e1b4){if(_0x21e1b4){return _0x21e1b4[_0x5264('0x24')](_0x4a473b)[_0x5264('0x25')](function(_0x41ace3){return _0x41ace3;});}return null;};}function removeEntity(_0x52aee4,_0x53fef2){return function(_0xe2c7e6){if(_0xe2c7e6){return _0xe2c7e6[_0x5264('0x26')]()['then'](function(){_0x52aee4[_0x5264('0x1a')](0xcc)[_0x5264('0x27')]();});}};}function handleEntityNotFound(_0x216dc3,_0x1535ca){return function(_0x3e117a){if(!_0x3e117a){_0x216dc3[_0x5264('0x19')](0x194);}return _0x3e117a;};}function handleError(_0x174bee,_0x3c1562){_0x3c1562=_0x3c1562||0x1f4;return function(_0x3e5d55){logger['error'](_0x3e5d55[_0x5264('0x28')]);if(_0x3e5d55[_0x5264('0x29')]){delete _0x3e5d55[_0x5264('0x29')];}_0x174bee[_0x5264('0x1a')](_0x3c1562)[_0x5264('0x2a')](_0x3e5d55);};}exports['index']=function(_0x336978,_0x40a466){var _0x24dcb2={},_0x32d5ad={},_0x23258d={'count':0x0,'rows':[]};var _0x35ad1a=_['map'](db['MailSubstatus']['rawAttributes'],function(_0x36b054){return{'name':_0x36b054['fieldName'],'type':_0x36b054[_0x5264('0x2b')][_0x5264('0x2c')]};});_0x32d5ad['model']=_['map'](_0x35ad1a,'name');_0x32d5ad[_0x5264('0x2d')]=_['keys'](_0x336978[_0x5264('0x2d')]);_0x32d5ad[_0x5264('0x2e')]=_[_0x5264('0x2f')](_0x32d5ad[_0x5264('0x30')],_0x32d5ad[_0x5264('0x2d')]);_0x24dcb2[_0x5264('0x31')]=_[_0x5264('0x2f')](_0x32d5ad['model'],qs['fields'](_0x336978['query'][_0x5264('0x32')]));_0x24dcb2['attributes']=_0x24dcb2[_0x5264('0x31')]['length']?_0x24dcb2[_0x5264('0x31')]:_0x32d5ad[_0x5264('0x30')];if(!_0x336978[_0x5264('0x2d')]['hasOwnProperty']('nolimit')){_0x24dcb2['limit']=qs[_0x5264('0x1c')](_0x336978[_0x5264('0x2d')][_0x5264('0x1c')]);_0x24dcb2[_0x5264('0x1f')]=qs['offset'](_0x336978[_0x5264('0x2d')][_0x5264('0x1f')]);}_0x24dcb2[_0x5264('0x33')]=qs[_0x5264('0x34')](_0x336978[_0x5264('0x2d')][_0x5264('0x34')]);_0x24dcb2['where']=qs[_0x5264('0x2e')](_[_0x5264('0x35')](_0x336978[_0x5264('0x2d')],_0x32d5ad[_0x5264('0x2e')]),_0x35ad1a);if(_0x336978[_0x5264('0x2d')]['filter']){_0x24dcb2[_0x5264('0x36')]=_[_0x5264('0x37')](_0x24dcb2[_0x5264('0x36')],{'$or':_['map'](_0x35ad1a,function(_0x4b927f){if(_0x4b927f[_0x5264('0x2b')]!==_0x5264('0x38')){var _0x51b900={};_0x51b900[_0x4b927f[_0x5264('0x29')]]={'$like':'%'+_0x336978[_0x5264('0x2d')][_0x5264('0x39')]+'%'};return _0x51b900;}})});}_0x24dcb2=_['merge']({},_0x24dcb2,_0x336978[_0x5264('0x3a')]);var _0x15d366={'where':_0x24dcb2[_0x5264('0x36')]};return db[_0x5264('0x3b')][_0x5264('0x1e')](_0x15d366)['then'](function(_0x3ba247){_0x23258d['count']=_0x3ba247;if(_0x336978[_0x5264('0x2d')][_0x5264('0x3c')]){_0x24dcb2[_0x5264('0x3d')]=[{'all':!![]}];}return db[_0x5264('0x3b')][_0x5264('0x3e')](_0x24dcb2);})[_0x5264('0x25')](function(_0x13b4eb){_0x23258d['rows']=_0x13b4eb;return _0x23258d;})[_0x5264('0x25')](respondWithFilteredResult(_0x40a466,_0x24dcb2))[_0x5264('0x3f')](handleError(_0x40a466,null));};exports[_0x5264('0x40')]=function(_0x1a070f,_0x1db7d8){var _0x8356b4={'raw':!![],'where':{'id':_0x1a070f[_0x5264('0x41')]['id']}},_0xb626d={};_0xb626d['model']=_[_0x5264('0x42')](db[_0x5264('0x3b')][_0x5264('0x43')]);_0xb626d[_0x5264('0x2d')]=_[_0x5264('0x42')](_0x1a070f[_0x5264('0x2d')]);_0xb626d[_0x5264('0x2e')]=_[_0x5264('0x2f')](_0xb626d['model'],_0xb626d[_0x5264('0x2d')]);_0x8356b4[_0x5264('0x31')]=_['intersection'](_0xb626d[_0x5264('0x30')],qs[_0x5264('0x32')](_0x1a070f[_0x5264('0x2d')][_0x5264('0x32')]));_0x8356b4['attributes']=_0x8356b4[_0x5264('0x31')][_0x5264('0x44')]?_0x8356b4[_0x5264('0x31')]:_0xb626d[_0x5264('0x30')];if(_0x1a070f[_0x5264('0x2d')]['includeAll']){_0x8356b4['include']=[{'all':!![]}];}_0x8356b4=_[_0x5264('0x37')]({},_0x8356b4,_0x1a070f['options']);return db['MailSubstatus']['find'](_0x8356b4)[_0x5264('0x25')](handleEntityNotFound(_0x1db7d8,null))[_0x5264('0x25')](respondWithResult(_0x1db7d8,null))[_0x5264('0x3f')](handleError(_0x1db7d8,null));};exports['create']=function(_0x11361c,_0x5525ba){return db[_0x5264('0x3b')]['create'](_0x11361c['body'],{})[_0x5264('0x25')](respondWithResult(_0x5525ba,0xc9))[_0x5264('0x3f')](handleError(_0x5525ba,null));};exports['update']=function(_0x38830e,_0x4d7c7f){if(_0x38830e[_0x5264('0x45')]['id']){delete _0x38830e['body']['id'];}return db[_0x5264('0x3b')][_0x5264('0x46')]({'where':{'id':_0x38830e[_0x5264('0x41')]['id']}})[_0x5264('0x25')](handleEntityNotFound(_0x4d7c7f,null))[_0x5264('0x25')](saveUpdates(_0x38830e[_0x5264('0x45')],null))[_0x5264('0x25')](respondWithResult(_0x4d7c7f,null))[_0x5264('0x3f')](handleError(_0x4d7c7f,null));};exports[_0x5264('0x26')]=function(_0x57b0fd,_0x1eaa97){return db[_0x5264('0x3b')][_0x5264('0x46')]({'where':{'id':_0x57b0fd['params']['id']}})[_0x5264('0x25')](handleEntityNotFound(_0x1eaa97,null))[_0x5264('0x25')](removeEntity(_0x1eaa97,null))[_0x5264('0x3f')](handleError(_0x1eaa97,null));};exports[_0x5264('0x47')]=function(_0x284abb,_0x5d35e5){return db[_0x5264('0x3b')]['describe']()['then'](respondWithResult(_0x5d35e5,null))[_0x5264('0x3f')](handleError(_0x5d35e5,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 5542c70..154c766 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 _0x209a=['events','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x209a,0xf5));var _0xa209=function(_0x21f6c8,_0x34e523){_0x21f6c8=_0x21f6c8-0x0;var _0x515d5f=_0x209a[_0x21f6c8];return _0x515d5f;};'use strict';var EventEmitter=require(_0xa209('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xa209('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xa209('0x2')](0x0);var events={'afterUpdate':_0xa209('0x3')};function emitEvent(_0x1ea35b){return function(_0xe43365,_0x26be49,_0x5e9b31){MailSubstatusEvents[_0xa209('0x4')](_0x1ea35b+':'+_0xe43365['id'],_0xe43365);MailSubstatusEvents[_0xa209('0x4')](_0x1ea35b,_0xe43365);_0x5e9b31(null);};}for(var e in events){if(events[_0xa209('0x5')](e)){var event=events[e];MailSubstatus[_0xa209('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x3fe0=['hasOwnProperty','hook','exports','events','../../mysqldb','emit'];(function(_0x56f09c,_0x4ab886){var _0xbb8dfd=function(_0x457899){while(--_0x457899){_0x56f09c['push'](_0x56f09c['shift']());}};_0xbb8dfd(++_0x4ab886);}(_0x3fe0,0xe1));var _0x03fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3fe0[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x03fe('0x0'));var MailSubstatus=require(_0x03fe('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x3b116f){return function(_0x237c02,_0x88f2a8,_0x3b0bf7){MailSubstatusEvents[_0x03fe('0x2')](_0x3b116f+':'+_0x237c02['id'],_0x237c02);MailSubstatusEvents['emit'](_0x3b116f,_0x237c02);_0x3b0bf7(null);};}for(var e in events){if(events[_0x03fe('0x3')](e)){var event=events[e];MailSubstatus[_0x03fe('0x4')](e,emitEvent(event));}}module[_0x03fe('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index aa9ebd9..79403de 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 _0x9d95=['models','define','mail_substatuses','update','name','mailSubstatus','then','./mailSubstatus.attributes','exports'];(function(_0x3b3e0e,_0x149b72){var _0x5ad65c=function(_0x401b50){while(--_0x401b50){_0x3b3e0e['push'](_0x3b3e0e['shift']());}};_0x5ad65c(++_0x149b72);}(_0x9d95,0xcd));var _0x59d9=function(_0x191e85,_0x4747d8){_0x191e85=_0x191e85-0x0;var _0x2ed524=_0x9d95[_0x191e85];return _0x2ed524;};'use strict';var attributes=require(_0x59d9('0x0'));module[_0x59d9('0x1')]=function(_0x22e1fb){var _0x4ee03d=_0x22e1fb[_0x59d9('0x2')];return _0x22e1fb[_0x59d9('0x3')]('MailSubstatus',attributes,{'tableName':_0x59d9('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x58e17e,_0x3d507e,_0x441222){return _0x4ee03d['Condition'][_0x59d9('0x5')]({'value':_0x58e17e[_0x59d9('0x6')]},{'where':{'field':_0x59d9('0x7'),'value':_0x58e17e['_previousDataValues'][_0x59d9('0x6')]}})[_0x59d9('0x8')](function(){_0x441222();})['catch'](function(_0x59baf3){_0x441222(_0x59baf3);});}}});}; \ No newline at end of file +var _0xc606=['then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues'];(function(_0x50d053,_0x2bb23b){var _0x13b972=function(_0x2d69a1){while(--_0x2d69a1){_0x50d053['push'](_0x50d053['shift']());}};_0x13b972(++_0x2bb23b);}(_0xc606,0x1e6));var _0x6c60=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0xc606[_0x680821];return _0x3f132c;};'use strict';var attributes=require(_0x6c60('0x0'));module[_0x6c60('0x1')]=function(_0x3968f6){var _0x52d0de=_0x3968f6[_0x6c60('0x2')];return _0x3968f6[_0x6c60('0x3')]('MailSubstatus',attributes,{'tableName':_0x6c60('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x524da3,_0x277494,_0x27b1da){return _0x52d0de[_0x6c60('0x5')]['update']({'value':_0x524da3[_0x6c60('0x6')]},{'where':{'field':_0x6c60('0x7'),'value':_0x524da3[_0x6c60('0x8')][_0x6c60('0x6')]}})[_0x6c60('0x9')](function(){_0x27b1da();})[_0x6c60('0xa')](function(_0x529c8b){_0x27b1da(_0x529c8b);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 963cf46..85f9113 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 _0x82e4=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent'];(function(_0x317a2a,_0x8a0a1c){var _0x3e75e8=function(_0x16937c){while(--_0x16937c){_0x317a2a['push'](_0x317a2a['shift']());}};_0x3e75e8(++_0x8a0a1c);}(_0x82e4,0xd1));var _0x482e=function(_0x38987f,_0xc79720){_0x38987f=_0x38987f-0x0;var _0x4cb697=_0x82e4[_0x38987f];return _0x4cb697;};'use strict';var _=require(_0x482e('0x0'));var util=require(_0x482e('0x1'));var moment=require('moment');var BPromise=require(_0x482e('0x2'));var rs=require(_0x482e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x482e('0x4'))('rpc');var config=require(_0x482e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x482e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xefb1e5,_0x11caa5,_0x5ed955){return new BPromise(function(_0x53206d,_0xbcef93){return client[_0x482e('0x7')](_0xefb1e5,_0x5ed955)[_0x482e('0x8')](function(_0x1e12cf){logger[_0x482e('0x9')](_0x482e('0xa'),_0x11caa5,_0x482e('0xb'));logger[_0x482e('0xc')](_0x482e('0xd'),_0x11caa5,_0x482e('0xb'),JSON[_0x482e('0xe')](_0x1e12cf));if(_0x1e12cf['error']){if(_0x1e12cf['error']['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x11caa5,_0x1e12cf[_0x482e('0xf')]['message']);return _0xbcef93(_0x1e12cf[_0x482e('0xf')][_0x482e('0x10')]);}logger['error'](_0x482e('0xa'),_0x11caa5,_0x1e12cf[_0x482e('0xf')][_0x482e('0x10')]);return _0x53206d(_0x1e12cf[_0x482e('0xf')]['message']);}else{logger[_0x482e('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x11caa5,_0x482e('0xb'));_0x53206d(_0x1e12cf['result']['message']);}})['catch'](function(_0x2c0b40){logger[_0x482e('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x11caa5,_0x2c0b40);_0xbcef93(_0x2c0b40);});});} \ No newline at end of file +var _0x5cbd=['error','code','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5cbd,0x1d9));var _0xd5cb=function(_0x298cfa,_0x17bc0c){_0x298cfa=_0x298cfa-0x0;var _0x4d8771=_0x5cbd[_0x298cfa];return _0x4d8771;};'use strict';var _=require('lodash');var util=require(_0xd5cb('0x0'));var moment=require(_0xd5cb('0x1'));var BPromise=require(_0xd5cb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5cb('0x3'));var db=require(_0xd5cb('0x4'))['db'];var utils=require(_0xd5cb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd5cb('0x6'));var client=jayson['client'][_0xd5cb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x363e0f,_0x53c51f,_0x34726c){return new BPromise(function(_0x1af92b,_0x374e24){return client[_0xd5cb('0x8')](_0x363e0f,_0x34726c)['then'](function(_0x2ff77a){logger['info'](_0xd5cb('0x9'),_0x53c51f,_0xd5cb('0xa'));logger[_0xd5cb('0xb')](_0xd5cb('0xc'),_0x53c51f,_0xd5cb('0xa'),JSON['stringify'](_0x2ff77a));if(_0x2ff77a[_0xd5cb('0xd')]){if(_0x2ff77a[_0xd5cb('0xd')][_0xd5cb('0xe')]===0x1f4){logger['error'](_0xd5cb('0x9'),_0x53c51f,_0x2ff77a[_0xd5cb('0xd')][_0xd5cb('0xf')]);return _0x374e24(_0x2ff77a[_0xd5cb('0xd')]['message']);}logger[_0xd5cb('0xd')](_0xd5cb('0x9'),_0x53c51f,_0x2ff77a[_0xd5cb('0xd')][_0xd5cb('0xf')]);return _0x1af92b(_0x2ff77a[_0xd5cb('0xd')][_0xd5cb('0xf')]);}else{logger[_0xd5cb('0x10')](_0xd5cb('0x9'),_0x53c51f,_0xd5cb('0xa'));_0x1af92b(_0x2ff77a[_0xd5cb('0x11')]['message']);}})['catch'](function(_0x3255d4){logger[_0xd5cb('0xd')](_0xd5cb('0x9'),_0x53c51f,_0x3255d4);_0x374e24(_0x3255d4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 1eee318..ea7c491 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 _0x522e=['describe','/:id','show','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./mailTransferReport.controller','index','get','isAuthenticated'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x522e,0x1d1));var _0xe522=function(_0x299cea,_0x3267f5){_0x299cea=_0x299cea-0x0;var _0x482f3f=_0x522e[_0x299cea];return _0x482f3f;};'use strict';var multer=require(_0xe522('0x0'));var util=require(_0xe522('0x1'));var path=require(_0xe522('0x2'));var timeout=require('connect-timeout');var express=require(_0xe522('0x3'));var router=express[_0xe522('0x4')]();var fs_extra=require(_0xe522('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe522('0x6'));var config=require('../../config/environment');var controller=require(_0xe522('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe522('0x8')]);router[_0xe522('0x9')]('/describe',auth[_0xe522('0xa')](),controller[_0xe522('0xb')]);router[_0xe522('0x9')](_0xe522('0xc'),auth[_0xe522('0xa')](),controller[_0xe522('0xd')]);router['post']('/',auth[_0xe522('0xa')](),controller['create']);router['put'](_0xe522('0xc'),auth[_0xe522('0xa')](),controller['update']);router[_0xe522('0xe')](_0xe522('0xc'),auth['isAuthenticated'](),controller[_0xe522('0xf')]);module[_0xe522('0x10')]=router; \ No newline at end of file +var _0xa1af=['get','index','/describe','isAuthenticated','describe','/:id','post','create','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller'];(function(_0x141310,_0x196d1d){var _0x30032a=function(_0x1128a8){while(--_0x1128a8){_0x141310['push'](_0x141310['shift']());}};_0x30032a(++_0x196d1d);}(_0xa1af,0xa8));var _0xfa1a=function(_0x3c66ea,_0x6ddf1f){_0x3c66ea=_0x3c66ea-0x0;var _0x120784=_0xa1af[_0x3c66ea];return _0x120784;};'use strict';var multer=require(_0xfa1a('0x0'));var util=require(_0xfa1a('0x1'));var path=require(_0xfa1a('0x2'));var timeout=require(_0xfa1a('0x3'));var express=require('express');var router=express[_0xfa1a('0x4')]();var fs_extra=require(_0xfa1a('0x5'));var auth=require(_0xfa1a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfa1a('0x7'));router[_0xfa1a('0x8')]('/',auth['isAuthenticated'](),controller[_0xfa1a('0x9')]);router['get'](_0xfa1a('0xa'),auth[_0xfa1a('0xb')](),controller[_0xfa1a('0xc')]);router['get'](_0xfa1a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfa1a('0xe')]('/',auth[_0xfa1a('0xb')](),controller[_0xfa1a('0xf')]);router['put'](_0xfa1a('0xd'),auth[_0xfa1a('0xb')](),controller['update']);router['delete'](_0xfa1a('0xd'),auth[_0xfa1a('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 70d91f6..6023ff4 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x1e9b82,_0x149177){var _0x4afca3=function(_0x489636){while(--_0x489636){_0x1e9b82['push'](_0x1e9b82['shift']());}};_0x4afca3(++_0x149177);}(_0x008c,0x188));var _0xc008=function(_0x388caa,_0x7bc7b8){_0x388caa=_0x388caa-0x0;var _0x5ecbe6=_0x008c[_0x388caa];return _0x5ecbe6;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x1ccbc6,_0x1525c5){var _0x27e215=function(_0x2c826a){while(--_0x2c826a){_0x1ccbc6['push'](_0x1ccbc6['shift']());}};_0x27e215(++_0x1525c5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xcb91[_0x27ddf5];return _0x26e74a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 91031d6..e13cd1e 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 _0x6f5a=['ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','then','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0x6f5a,0xdf));var _0xa6f5=function(_0x4e1c2f,_0x390067){_0x4e1c2f=_0x4e1c2f-0x0;var _0x5bb43b=_0x6f5a[_0x4e1c2f];return _0x5bb43b;};'use strict';var emlformat=require(_0xa6f5('0x0'));var rimraf=require(_0xa6f5('0x1'));var zipdir=require(_0xa6f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6f5('0x3'));var moment=require(_0xa6f5('0x4'));var BPromise=require(_0xa6f5('0x5'));var Mustache=require(_0xa6f5('0x6'));var util=require(_0xa6f5('0x7'));var path=require(_0xa6f5('0x8'));var sox=require(_0xa6f5('0x9'));var csv=require(_0xa6f5('0xa'));var ejs=require(_0xa6f5('0xb'));var fs=require('fs');var fs_extra=require(_0xa6f5('0xc'));var _=require('lodash');var squel=require(_0xa6f5('0xd'));var crypto=require('crypto');var jsforce=require(_0xa6f5('0xe'));var deskjs=require(_0xa6f5('0xf'));var toCsv=require(_0xa6f5('0xa'));var querystring=require(_0xa6f5('0x10'));var Papa=require('papaparse');var Redis=require(_0xa6f5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa6f5('0x12'));var as=require(_0xa6f5('0x13'));var hardwareService=require(_0xa6f5('0x14'));var logger=require(_0xa6f5('0x15'))(_0xa6f5('0x16'));var utils=require(_0xa6f5('0x17'));var config=require(_0xa6f5('0x18'));var licenseUtil=require(_0xa6f5('0x19'));var db=require(_0xa6f5('0x1a'))['db'];function respondWithStatusCode(_0x24204b,_0x1394a7){_0x1394a7=_0x1394a7||0xcc;return function(_0x2a0c1e){if(_0x2a0c1e){return _0x24204b[_0xa6f5('0x1b')](_0x1394a7);}return _0x24204b[_0xa6f5('0x1c')](_0x1394a7)[_0xa6f5('0x1d')]();};}function respondWithResult(_0x4ec218,_0x652841){_0x652841=_0x652841||0xc8;return function(_0x2079c1){if(_0x2079c1){return _0x4ec218[_0xa6f5('0x1c')](_0x652841)['json'](_0x2079c1);}};}function respondWithFilteredResult(_0x2f2da9,_0xc9c7ec){return function(_0x5a2709){if(_0x5a2709){var _0x341b57=typeof _0xc9c7ec[_0xa6f5('0x1e')]===_0xa6f5('0x1f')&&typeof _0xc9c7ec['limit']===_0xa6f5('0x1f');var _0x46ef97=_0x5a2709[_0xa6f5('0x20')];var _0x57d9d8=_0x341b57?0x0:_0xc9c7ec['offset'];var _0x4c8bee=_0x341b57?_0x5a2709[_0xa6f5('0x20')]:_0xc9c7ec[_0xa6f5('0x1e')]+_0xc9c7ec[_0xa6f5('0x21')];var _0x3c331a;if(_0x4c8bee>=_0x46ef97){_0x4c8bee=_0x46ef97;_0x3c331a=0xc8;}else{_0x3c331a=0xce;}_0x2f2da9[_0xa6f5('0x1c')](_0x3c331a);return _0x2f2da9[_0xa6f5('0x22')]('Content-Range',_0x57d9d8+'-'+_0x4c8bee+'/'+_0x46ef97)[_0xa6f5('0x23')](_0x5a2709);}return null;};}function patchUpdates(_0x3257d8){return function(_0x3c007b){try{jsonpatch[_0xa6f5('0x24')](_0x3c007b,_0x3257d8,!![]);}catch(_0x13c392){return BPromise[_0xa6f5('0x25')](_0x13c392);}return _0x3c007b[_0xa6f5('0x26')]();};}function saveUpdates(_0x4a1329,_0x4e508a){return function(_0x6092ae){if(_0x6092ae){return _0x6092ae[_0xa6f5('0x27')](_0x4a1329)['then'](function(_0x532cb2){return _0x532cb2;});}return null;};}function removeEntity(_0x34e66a,_0x48cfc2){return function(_0x3be057){if(_0x3be057){return _0x3be057[_0xa6f5('0x28')]()[_0xa6f5('0x29')](function(){_0x34e66a[_0xa6f5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0da8,_0x282889){return function(_0x229e0b){if(!_0x229e0b){_0x1b0da8['sendStatus'](0x194);}return _0x229e0b;};}function handleError(_0x12047e,_0x5a19e2){_0x5a19e2=_0x5a19e2||0x1f4;return function(_0x325381){logger[_0xa6f5('0x2a')](_0x325381[_0xa6f5('0x2b')]);if(_0x325381[_0xa6f5('0x2c')]){delete _0x325381['name'];}_0x12047e['status'](_0x5a19e2)['send'](_0x325381);};}exports[_0xa6f5('0x2d')]=function(_0xde5345,_0x102571){var _0xa7b782={},_0x42503c={},_0xa5d452={'count':0x0,'rows':[]};var _0x4e40f5=_[_0xa6f5('0x2e')](db[_0xa6f5('0x2f')][_0xa6f5('0x30')],function(_0x17cae7){return{'name':_0x17cae7[_0xa6f5('0x31')],'type':_0x17cae7[_0xa6f5('0x32')][_0xa6f5('0x33')]};});_0x42503c['model']=_[_0xa6f5('0x2e')](_0x4e40f5,_0xa6f5('0x2c'));_0x42503c['query']=_['keys'](_0xde5345[_0xa6f5('0x34')]);_0x42503c['filters']=_[_0xa6f5('0x35')](_0x42503c[_0xa6f5('0x36')],_0x42503c[_0xa6f5('0x34')]);_0xa7b782[_0xa6f5('0x37')]=_[_0xa6f5('0x35')](_0x42503c['model'],qs[_0xa6f5('0x38')](_0xde5345[_0xa6f5('0x34')]['fields']));_0xa7b782[_0xa6f5('0x37')]=_0xa7b782[_0xa6f5('0x37')]['length']?_0xa7b782[_0xa6f5('0x37')]:_0x42503c[_0xa6f5('0x36')];if(!_0xde5345['query']['hasOwnProperty'](_0xa6f5('0x39'))){_0xa7b782['limit']=qs[_0xa6f5('0x21')](_0xde5345[_0xa6f5('0x34')]['limit']);_0xa7b782['offset']=qs[_0xa6f5('0x1e')](_0xde5345[_0xa6f5('0x34')][_0xa6f5('0x1e')]);}_0xa7b782[_0xa6f5('0x3a')]=qs['sort'](_0xde5345[_0xa6f5('0x34')]['sort']);_0xa7b782[_0xa6f5('0x3b')]=qs['filters'](_[_0xa6f5('0x3c')](_0xde5345[_0xa6f5('0x34')],_0x42503c[_0xa6f5('0x3d')]),_0x4e40f5);if(_0xde5345[_0xa6f5('0x34')][_0xa6f5('0x3e')]){_0xa7b782['where']=_[_0xa6f5('0x3f')](_0xa7b782[_0xa6f5('0x3b')],{'$or':_[_0xa6f5('0x2e')](_0x4e40f5,function(_0x2ef814){if(_0x2ef814['type']!==_0xa6f5('0x40')){var _0x4f5700={};_0x4f5700[_0x2ef814['name']]={'$like':'%'+_0xde5345[_0xa6f5('0x34')][_0xa6f5('0x3e')]+'%'};return _0x4f5700;}})});}_0xa7b782=_['merge']({},_0xa7b782,_0xde5345[_0xa6f5('0x41')]);var _0xc5976d={'where':_0xa7b782[_0xa6f5('0x3b')]};return db[_0xa6f5('0x2f')]['count'](_0xc5976d)[_0xa6f5('0x29')](function(_0x58da99){_0xa5d452['count']=_0x58da99;if(_0xde5345[_0xa6f5('0x34')][_0xa6f5('0x42')]){_0xa7b782[_0xa6f5('0x43')]=[{'all':!![]}];}return db[_0xa6f5('0x2f')]['findAll'](_0xa7b782);})['then'](function(_0x5867e9){_0xa5d452[_0xa6f5('0x44')]=_0x5867e9;return _0xa5d452;})['then'](respondWithFilteredResult(_0x102571,_0xa7b782))['catch'](handleError(_0x102571,null));};exports[_0xa6f5('0x45')]=function(_0x4147c1,_0x47b4b8){var _0x2e4a3e={'raw':!![],'where':{'id':_0x4147c1[_0xa6f5('0x46')]['id']}},_0x10e3e9={};_0x10e3e9['model']=_[_0xa6f5('0x47')](db[_0xa6f5('0x2f')][_0xa6f5('0x30')]);_0x10e3e9[_0xa6f5('0x34')]=_[_0xa6f5('0x47')](_0x4147c1[_0xa6f5('0x34')]);_0x10e3e9['filters']=_['intersection'](_0x10e3e9[_0xa6f5('0x36')],_0x10e3e9[_0xa6f5('0x34')]);_0x2e4a3e[_0xa6f5('0x37')]=_[_0xa6f5('0x35')](_0x10e3e9['model'],qs[_0xa6f5('0x38')](_0x4147c1[_0xa6f5('0x34')][_0xa6f5('0x38')]));_0x2e4a3e['attributes']=_0x2e4a3e[_0xa6f5('0x37')][_0xa6f5('0x48')]?_0x2e4a3e[_0xa6f5('0x37')]:_0x10e3e9[_0xa6f5('0x36')];if(_0x4147c1[_0xa6f5('0x34')][_0xa6f5('0x42')]){_0x2e4a3e[_0xa6f5('0x43')]=[{'all':!![]}];}_0x2e4a3e=_[_0xa6f5('0x3f')]({},_0x2e4a3e,_0x4147c1[_0xa6f5('0x41')]);return db[_0xa6f5('0x2f')][_0xa6f5('0x49')](_0x2e4a3e)[_0xa6f5('0x29')](handleEntityNotFound(_0x47b4b8,null))[_0xa6f5('0x29')](respondWithResult(_0x47b4b8,null))[_0xa6f5('0x4a')](handleError(_0x47b4b8,null));};exports[_0xa6f5('0x4b')]=function(_0x4856c6,_0x5e8555){return db['MailTransferReport'][_0xa6f5('0x4b')](_0x4856c6['body'],{})[_0xa6f5('0x29')](respondWithResult(_0x5e8555,0xc9))[_0xa6f5('0x4a')](handleError(_0x5e8555,null));};exports['update']=function(_0x5d41c1,_0x477497){if(_0x5d41c1[_0xa6f5('0x4c')]['id']){delete _0x5d41c1[_0xa6f5('0x4c')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x5d41c1[_0xa6f5('0x46')]['id']}})[_0xa6f5('0x29')](handleEntityNotFound(_0x477497,null))[_0xa6f5('0x29')](saveUpdates(_0x5d41c1[_0xa6f5('0x4c')],null))[_0xa6f5('0x29')](respondWithResult(_0x477497,null))[_0xa6f5('0x4a')](handleError(_0x477497,null));};exports[_0xa6f5('0x28')]=function(_0x8766e2,_0x47b646){return db[_0xa6f5('0x2f')][_0xa6f5('0x49')]({'where':{'id':_0x8766e2['params']['id']}})[_0xa6f5('0x29')](handleEntityNotFound(_0x47b646,null))[_0xa6f5('0x29')](removeEntity(_0x47b646,null))[_0xa6f5('0x4a')](handleError(_0x47b646,null));};exports[_0xa6f5('0x4d')]=function(_0x4a11be,_0x36cca5){return db[_0xa6f5('0x2f')][_0xa6f5('0x4d')]()[_0xa6f5('0x29')](respondWithResult(_0x36cca5,null))[_0xa6f5('0x4a')](handleError(_0x36cca5,null));}; \ No newline at end of file +var _0x643f=['create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','MailTransferReport','key','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','catch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x643f,0x133));var _0xf643=function(_0x11b6e9,_0x144376){_0x11b6e9=_0x11b6e9-0x0;var _0x20e413=_0x643f[_0x11b6e9];return _0x20e413;};'use strict';var emlformat=require(_0xf643('0x0'));var rimraf=require(_0xf643('0x1'));var zipdir=require(_0xf643('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf643('0x3'));var moment=require(_0xf643('0x4'));var BPromise=require(_0xf643('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf643('0x6'));var sox=require(_0xf643('0x7'));var csv=require(_0xf643('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf643('0x9'));var squel=require(_0xf643('0xa'));var crypto=require(_0xf643('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf643('0xc'));var toCsv=require(_0xf643('0x8'));var querystring=require(_0xf643('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf643('0xe'));var qs=require(_0xf643('0xf'));var as=require(_0xf643('0x10'));var hardwareService=require(_0xf643('0x11'));var logger=require(_0xf643('0x12'))(_0xf643('0x13'));var utils=require(_0xf643('0x14'));var config=require(_0xf643('0x15'));var licenseUtil=require(_0xf643('0x16'));var db=require(_0xf643('0x17'))['db'];function respondWithStatusCode(_0x367caf,_0x81ddde){_0x81ddde=_0x81ddde||0xcc;return function(_0x5b6d68){if(_0x5b6d68){return _0x367caf[_0xf643('0x18')](_0x81ddde);}return _0x367caf[_0xf643('0x19')](_0x81ddde)[_0xf643('0x1a')]();};}function respondWithResult(_0x28e425,_0x4f46d8){_0x4f46d8=_0x4f46d8||0xc8;return function(_0x3cab2c){if(_0x3cab2c){return _0x28e425[_0xf643('0x19')](_0x4f46d8)[_0xf643('0x1b')](_0x3cab2c);}};}function respondWithFilteredResult(_0x56b6c0,_0x826899){return function(_0x12689a){if(_0x12689a){var _0x2190e9=typeof _0x826899[_0xf643('0x1c')]===_0xf643('0x1d')&&typeof _0x826899[_0xf643('0x1e')]===_0xf643('0x1d');var _0x19fbc1=_0x12689a[_0xf643('0x1f')];var _0x577fd7=_0x2190e9?0x0:_0x826899[_0xf643('0x1c')];var _0x304bc8=_0x2190e9?_0x12689a[_0xf643('0x1f')]:_0x826899[_0xf643('0x1c')]+_0x826899['limit'];var _0x5e2531;if(_0x304bc8>=_0x19fbc1){_0x304bc8=_0x19fbc1;_0x5e2531=0xc8;}else{_0x5e2531=0xce;}_0x56b6c0['status'](_0x5e2531);return _0x56b6c0[_0xf643('0x20')](_0xf643('0x21'),_0x577fd7+'-'+_0x304bc8+'/'+_0x19fbc1)[_0xf643('0x1b')](_0x12689a);}return null;};}function patchUpdates(_0x19bd71){return function(_0x517927){try{jsonpatch['apply'](_0x517927,_0x19bd71,!![]);}catch(_0x47b348){return BPromise[_0xf643('0x22')](_0x47b348);}return _0x517927[_0xf643('0x23')]();};}function saveUpdates(_0xaf0320,_0x35f8d5){return function(_0x47a787){if(_0x47a787){return _0x47a787[_0xf643('0x24')](_0xaf0320)['then'](function(_0x4c6d66){return _0x4c6d66;});}return null;};}function removeEntity(_0x40cc4e,_0x47f8ca){return function(_0x17ddf4){if(_0x17ddf4){return _0x17ddf4[_0xf643('0x25')]()[_0xf643('0x26')](function(){_0x40cc4e[_0xf643('0x19')](0xcc)[_0xf643('0x1a')]();});}};}function handleEntityNotFound(_0x23428b,_0x2e78f5){return function(_0x30d4be){if(!_0x30d4be){_0x23428b[_0xf643('0x18')](0x194);}return _0x30d4be;};}function handleError(_0x211d15,_0x448148){_0x448148=_0x448148||0x1f4;return function(_0x43f1ce){logger[_0xf643('0x27')](_0x43f1ce[_0xf643('0x28')]);if(_0x43f1ce['name']){delete _0x43f1ce[_0xf643('0x29')];}_0x211d15[_0xf643('0x19')](_0x448148)[_0xf643('0x2a')](_0x43f1ce);};}exports[_0xf643('0x2b')]=function(_0x318981,_0x24895f){var _0xb9f230={},_0x5c1786={},_0x46db7c={'count':0x0,'rows':[]};var _0x3606f2=_[_0xf643('0x2c')](db[_0xf643('0x2d')]['rawAttributes'],function(_0x1d123f){return{'name':_0x1d123f['fieldName'],'type':_0x1d123f['type'][_0xf643('0x2e')]};});_0x5c1786[_0xf643('0x2f')]=_[_0xf643('0x2c')](_0x3606f2,'name');_0x5c1786['query']=_['keys'](_0x318981['query']);_0x5c1786[_0xf643('0x30')]=_['intersection'](_0x5c1786[_0xf643('0x2f')],_0x5c1786['query']);_0xb9f230['attributes']=_[_0xf643('0x31')](_0x5c1786[_0xf643('0x2f')],qs[_0xf643('0x32')](_0x318981[_0xf643('0x33')]['fields']));_0xb9f230[_0xf643('0x34')]=_0xb9f230[_0xf643('0x34')][_0xf643('0x35')]?_0xb9f230[_0xf643('0x34')]:_0x5c1786[_0xf643('0x2f')];if(!_0x318981[_0xf643('0x33')][_0xf643('0x36')](_0xf643('0x37'))){_0xb9f230[_0xf643('0x1e')]=qs[_0xf643('0x1e')](_0x318981[_0xf643('0x33')][_0xf643('0x1e')]);_0xb9f230[_0xf643('0x1c')]=qs[_0xf643('0x1c')](_0x318981[_0xf643('0x33')][_0xf643('0x1c')]);}_0xb9f230['order']=qs[_0xf643('0x38')](_0x318981[_0xf643('0x33')]['sort']);_0xb9f230[_0xf643('0x39')]=qs[_0xf643('0x30')](_[_0xf643('0x3a')](_0x318981[_0xf643('0x33')],_0x5c1786[_0xf643('0x30')]),_0x3606f2);if(_0x318981[_0xf643('0x33')][_0xf643('0x3b')]){_0xb9f230[_0xf643('0x39')]=_[_0xf643('0x3c')](_0xb9f230['where'],{'$or':_[_0xf643('0x2c')](_0x3606f2,function(_0x51d1ab){if(_0x51d1ab['type']!==_0xf643('0x3d')){var _0xc9a988={};_0xc9a988[_0x51d1ab[_0xf643('0x29')]]={'$like':'%'+_0x318981['query'][_0xf643('0x3b')]+'%'};return _0xc9a988;}})});}_0xb9f230=_[_0xf643('0x3c')]({},_0xb9f230,_0x318981[_0xf643('0x3e')]);var _0x45e215={'where':_0xb9f230[_0xf643('0x39')]};return db[_0xf643('0x2d')][_0xf643('0x1f')](_0x45e215)[_0xf643('0x26')](function(_0x2c9693){_0x46db7c[_0xf643('0x1f')]=_0x2c9693;if(_0x318981[_0xf643('0x33')][_0xf643('0x3f')]){_0xb9f230['include']=[{'all':!![]}];}return db[_0xf643('0x2d')][_0xf643('0x40')](_0xb9f230);})['then'](function(_0x2ccebe){_0x46db7c[_0xf643('0x41')]=_0x2ccebe;return _0x46db7c;})[_0xf643('0x26')](respondWithFilteredResult(_0x24895f,_0xb9f230))['catch'](handleError(_0x24895f,null));};exports[_0xf643('0x42')]=function(_0x4aa9da,_0x3f7895){var _0x1bf39d={'raw':!![],'where':{'id':_0x4aa9da[_0xf643('0x43')]['id']}},_0x2e1ddb={};_0x2e1ddb[_0xf643('0x2f')]=_[_0xf643('0x44')](db[_0xf643('0x2d')][_0xf643('0x45')]);_0x2e1ddb['query']=_[_0xf643('0x44')](_0x4aa9da['query']);_0x2e1ddb[_0xf643('0x30')]=_[_0xf643('0x31')](_0x2e1ddb[_0xf643('0x2f')],_0x2e1ddb[_0xf643('0x33')]);_0x1bf39d[_0xf643('0x34')]=_[_0xf643('0x31')](_0x2e1ddb[_0xf643('0x2f')],qs['fields'](_0x4aa9da[_0xf643('0x33')]['fields']));_0x1bf39d[_0xf643('0x34')]=_0x1bf39d['attributes'][_0xf643('0x35')]?_0x1bf39d[_0xf643('0x34')]:_0x2e1ddb[_0xf643('0x2f')];if(_0x4aa9da[_0xf643('0x33')]['includeAll']){_0x1bf39d[_0xf643('0x46')]=[{'all':!![]}];}_0x1bf39d=_[_0xf643('0x3c')]({},_0x1bf39d,_0x4aa9da[_0xf643('0x3e')]);return db[_0xf643('0x2d')][_0xf643('0x47')](_0x1bf39d)['then'](handleEntityNotFound(_0x3f7895,null))['then'](respondWithResult(_0x3f7895,null))[_0xf643('0x48')](handleError(_0x3f7895,null));};exports[_0xf643('0x49')]=function(_0x51a9cb,_0x1fb37e){return db[_0xf643('0x2d')]['create'](_0x51a9cb['body'],{})[_0xf643('0x26')](respondWithResult(_0x1fb37e,0xc9))['catch'](handleError(_0x1fb37e,null));};exports[_0xf643('0x24')]=function(_0x40f14c,_0x430c27){if(_0x40f14c[_0xf643('0x4a')]['id']){delete _0x40f14c[_0xf643('0x4a')]['id'];}return db['MailTransferReport'][_0xf643('0x47')]({'where':{'id':_0x40f14c[_0xf643('0x43')]['id']}})['then'](handleEntityNotFound(_0x430c27,null))[_0xf643('0x26')](saveUpdates(_0x40f14c['body'],null))['then'](respondWithResult(_0x430c27,null))[_0xf643('0x48')](handleError(_0x430c27,null));};exports[_0xf643('0x25')]=function(_0x57e697,_0x43cdc2){return db[_0xf643('0x2d')][_0xf643('0x47')]({'where':{'id':_0x57e697['params']['id']}})[_0xf643('0x26')](handleEntityNotFound(_0x43cdc2,null))[_0xf643('0x26')](removeEntity(_0x43cdc2,null))[_0xf643('0x48')](handleError(_0x43cdc2,null));};exports[_0xf643('0x4b')]=function(_0x90340d,_0x13d41f){return db[_0xf643('0x2d')][_0xf643('0x4b')]()[_0xf643('0x26')](respondWithResult(_0x13d41f,null))[_0xf643('0x48')](handleError(_0x13d41f,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2956566..4faefdb 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 _0xeb3a=['exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x3d6078,_0x43dee8){var _0x446603=function(_0x15a30b){while(--_0x15a30b){_0x3d6078['push'](_0x3d6078['shift']());}};_0x446603(++_0x43dee8);}(_0xeb3a,0x12f));var _0xaeb3=function(_0x29a62e,_0x33e5e7){_0x29a62e=_0x29a62e-0x0;var _0x51e0f4=_0xeb3a[_0x29a62e];return _0x51e0f4;};'use strict';var _=require(_0xaeb3('0x0'));var util=require(_0xaeb3('0x1'));var logger=require(_0xaeb3('0x2'))(_0xaeb3('0x3'));var moment=require(_0xaeb3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaeb3('0x5'));var rimraf=require(_0xaeb3('0x6'));var config=require(_0xaeb3('0x7'));var attributes=require(_0xaeb3('0x8'));module[_0xaeb3('0x9')]=function(_0x45d14c,_0x1fdc7c){return _0x45d14c[_0xaeb3('0xa')]('MailTransferReport',attributes,{'tableName':_0xaeb3('0xb'),'paranoid':![],'indexes':[{'name':_0xaeb3('0xc'),'fields':[_0xaeb3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79a8=['request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x4a9ff2,_0x37aece){var _0x297736=function(_0x26fd68){while(--_0x26fd68){_0x4a9ff2['push'](_0x4a9ff2['shift']());}};_0x297736(++_0x37aece);}(_0x79a8,0x1d0));var _0x879a=function(_0x35a0e2,_0x302ad1){_0x35a0e2=_0x35a0e2-0x0;var _0x31ea9a=_0x79a8[_0x35a0e2];return _0x31ea9a;};'use strict';var _=require(_0x879a('0x0'));var util=require('util');var logger=require(_0x879a('0x1'))(_0x879a('0x2'));var moment=require(_0x879a('0x3'));var BPromise=require('bluebird');var rp=require(_0x879a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var attributes=require(_0x879a('0x7'));module[_0x879a('0x8')]=function(_0x1808f1,_0x3cb89c){return _0x1808f1[_0x879a('0x9')](_0x879a('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x879a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 8536b1a..799320b 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 _0x453c=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','lodash','util'];(function(_0xedd8c0,_0x56dd41){var _0x8fdceb=function(_0x231e63){while(--_0x231e63){_0xedd8c0['push'](_0xedd8c0['shift']());}};_0x8fdceb(++_0x56dd41);}(_0x453c,0xa6));var _0xc453=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x453c[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0xc453('0x0'));var util=require(_0xc453('0x1'));var moment=require('moment');var BPromise=require(_0xc453('0x2'));var rs=require(_0xc453('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc453('0x4'))['db'];var utils=require(_0xc453('0x5'));var logger=require('../../config/logger')(_0xc453('0x6'));var config=require(_0xc453('0x7'));var jayson=require(_0xc453('0x8'));var client=jayson[_0xc453('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x438864,_0x3a8de9,_0x4795de){return new BPromise(function(_0x89a7c6,_0x3329f0){return client[_0xc453('0xa')](_0x438864,_0x4795de)[_0xc453('0xb')](function(_0x35c732){logger[_0xc453('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x3a8de9,_0xc453('0xd'));logger[_0xc453('0xe')](_0xc453('0xf'),_0x3a8de9,_0xc453('0xd'),JSON[_0xc453('0x10')](_0x35c732));if(_0x35c732[_0xc453('0x11')]){if(_0x35c732[_0xc453('0x11')]['code']===0x1f4){logger[_0xc453('0x11')](_0xc453('0x12'),_0x3a8de9,_0x35c732['error'][_0xc453('0x13')]);return _0x3329f0(_0x35c732[_0xc453('0x11')][_0xc453('0x13')]);}logger[_0xc453('0x11')](_0xc453('0x12'),_0x3a8de9,_0x35c732[_0xc453('0x11')]['message']);return _0x89a7c6(_0x35c732['error']['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x3a8de9,_0xc453('0xd'));_0x89a7c6(_0x35c732[_0xc453('0x14')][_0xc453('0x13')]);}})['catch'](function(_0xdc2ad1){logger[_0xc453('0x11')](_0xc453('0x12'),_0x3a8de9,_0xdc2ad1);_0x3329f0(_0xdc2ad1);});});} \ No newline at end of file +var _0xe524=['request\x20sent','debug','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','info'];(function(_0x1e844b,_0x562168){var _0x4092f3=function(_0x3e0ca8){while(--_0x3e0ca8){_0x1e844b['push'](_0x1e844b['shift']());}};_0x4092f3(++_0x562168);}(_0xe524,0x1b1));var _0x4e52=function(_0x1dbe24,_0x302a70){_0x1dbe24=_0x1dbe24-0x0;var _0x5a2e2d=_0xe524[_0x1dbe24];return _0x5a2e2d;};'use strict';var _=require('lodash');var util=require(_0x4e52('0x0'));var moment=require('moment');var BPromise=require(_0x4e52('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e52('0x2'));var db=require(_0x4e52('0x3'))['db'];var utils=require(_0x4e52('0x4'));var logger=require(_0x4e52('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4e52('0x6')][_0x4e52('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x22c9a7,_0x138e9b,_0x805d1){return new BPromise(function(_0x106296,_0x3f11d3){return client['request'](_0x22c9a7,_0x805d1)['then'](function(_0x2e8f71){logger[_0x4e52('0x8')]('MailTransferReport,\x20%s,\x20%s',_0x138e9b,_0x4e52('0x9'));logger[_0x4e52('0xa')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x138e9b,_0x4e52('0x9'),JSON[_0x4e52('0xb')](_0x2e8f71));if(_0x2e8f71[_0x4e52('0xc')]){if(_0x2e8f71[_0x4e52('0xc')]['code']===0x1f4){logger['error'](_0x4e52('0xd'),_0x138e9b,_0x2e8f71[_0x4e52('0xc')][_0x4e52('0xe')]);return _0x3f11d3(_0x2e8f71[_0x4e52('0xc')][_0x4e52('0xe')]);}logger[_0x4e52('0xc')](_0x4e52('0xd'),_0x138e9b,_0x2e8f71['error'][_0x4e52('0xe')]);return _0x106296(_0x2e8f71[_0x4e52('0xc')][_0x4e52('0xe')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x138e9b,'request\x20sent');_0x106296(_0x2e8f71[_0x4e52('0xf')][_0x4e52('0xe')]);}})[_0x4e52('0x10')](function(_0x3f2d47){logger[_0x4e52('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x138e9b,_0x3f2d47);_0x3f11d3(_0x3f2d47);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 902d7f8..445bd99 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 _0x8564=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x167214,_0x5b8e77){var _0x400713=function(_0x436f62){while(--_0x436f62){_0x167214['push'](_0x167214['shift']());}};_0x400713(++_0x5b8e77);}(_0x8564,0x15f));var _0x4856=function(_0x51988f,_0x59c9f4){_0x51988f=_0x51988f-0x0;var _0x3f48fe=_0x8564[_0x51988f];return _0x3f48fe;};'use strict';var multer=require(_0x4856('0x0'));var util=require(_0x4856('0x1'));var path=require('path');var timeout=require(_0x4856('0x2'));var express=require('express');var router=express[_0x4856('0x3')]();var fs_extra=require(_0x4856('0x4'));var auth=require(_0x4856('0x5'));var interaction=require(_0x4856('0x6'));var config=require('../../config/environment');var controller=require(_0x4856('0x7'));router[_0x4856('0x8')]('/',auth[_0x4856('0x9')](),controller[_0x4856('0xa')]);router[_0x4856('0x8')](_0x4856('0xb'),auth['isAuthenticated'](),controller[_0x4856('0xc')]);router[_0x4856('0x8')](_0x4856('0xd'),auth[_0x4856('0x9')](),controller[_0x4856('0xe')]);router[_0x4856('0xf')]('/',auth[_0x4856('0x9')](),controller[_0x4856('0x10')]);router[_0x4856('0x11')](_0x4856('0xd'),auth[_0x4856('0x9')](),controller[_0x4856('0x12')]);router[_0x4856('0x13')](_0x4856('0xd'),auth[_0x4856('0x9')](),controller[_0x4856('0x14')]);module[_0x4856('0x15')]=router; \ No newline at end of file +var _0x7a2e=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','create','put','update','destroy','multer','util','express'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0x7a2e,0x8d));var _0xe7a2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7a2e[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xe7a2('0x0'));var util=require(_0xe7a2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe7a2('0x2'));var router=express['Router']();var fs_extra=require(_0xe7a2('0x3'));var auth=require(_0xe7a2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe7a2('0x5'));var controller=require('./memberReport.controller');router[_0xe7a2('0x6')]('/',auth[_0xe7a2('0x7')](),controller['index']);router[_0xe7a2('0x6')](_0xe7a2('0x8'),auth[_0xe7a2('0x7')](),controller['describe']);router[_0xe7a2('0x6')](_0xe7a2('0x9'),auth[_0xe7a2('0x7')](),controller[_0xe7a2('0xa')]);router[_0xe7a2('0xb')]('/',auth['isAuthenticated'](),controller[_0xe7a2('0xc')]);router[_0xe7a2('0xd')](_0xe7a2('0x9'),auth[_0xe7a2('0x7')](),controller[_0xe7a2('0xe')]);router['delete'](_0xe7a2('0x9'),auth[_0xe7a2('0x7')](),controller[_0xe7a2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 2929e58..e12af69 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 _0xbe1e=['talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','seconds','exitAt','talk:[start]'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbe1e,0xb8));var _0xebe1=function(_0x428411,_0x15b7f6){_0x428411=_0x428411-0x0;var _0x52a8fc=_0xbe1e[_0x428411];return _0x52a8fc;};'use strict';var Sequelize=require(_0xebe1('0x0'));var moment=require(_0xebe1('0x1'));module[_0xebe1('0x2')]={'channel':{'type':Sequelize[_0xebe1('0x3')]},'membername':{'type':Sequelize[_0xebe1('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xebe1('0x4')},'duration':{'type':Sequelize[_0xebe1('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xebe1('0x6')],'set':function(_0x4199a3){var _0x12aa5a=moment(_0x4199a3);var _0x269ad3=moment(this[_0xebe1('0x7')]('enterAt'));var _0x290e22=_0x12aa5a['diff'](_0x269ad3,_0xebe1('0x8'));this['setDataValue'](_0xebe1('0x9'),_0x4199a3);this['setDataValue']('duration',_0x290e22>=0x0?_0x290e22:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xebe1('0x3')],'comment':_0xebe1('0xa')},'data3':{'type':Sequelize['STRING'],'comment':_0xebe1('0xb')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0xebe1('0xc')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xebe1('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6832=['LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x6832,0x1be));var _0x2683=function(_0x15dac1,_0x3368f3){_0x15dac1=_0x15dac1-0x0;var _0x24cbfe=_0x6832[_0x15dac1];return _0x24cbfe;};'use strict';var Sequelize=require(_0x2683('0x0'));var moment=require(_0x2683('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2683('0x2')]},'interface':{'type':Sequelize[_0x2683('0x2')]},'type':{'type':Sequelize[_0x2683('0x2')],'defaultValue':_0x2683('0x3'),'comment':_0x2683('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x2683('0x5')]},'exitAt':{'type':Sequelize[_0x2683('0x5')],'set':function(_0x2a9f99){var _0x3a61c3=moment(_0x2a9f99);var _0x4e2d31=moment(this[_0x2683('0x6')](_0x2683('0x7')));var _0x41a426=_0x3a61c3[_0x2683('0x8')](_0x4e2d31,'seconds');this[_0x2683('0x9')]('exitAt',_0x2a9f99);this['setDataValue'](_0x2683('0xa'),_0x41a426>=0x0?_0x41a426:null);}},'data1':{'type':Sequelize[_0x2683('0x2')],'comment':_0x2683('0xb')},'data2':{'type':Sequelize[_0x2683('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x2683('0x2')],'comment':_0x2683('0xc')},'data4':{'type':Sequelize[_0x2683('0x2')],'comment':_0x2683('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x2683('0xe')},'role':{'type':Sequelize[_0x2683('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x2683('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 8ba638a..c53703b 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x539ce2,_0x54efa0){_0x539ce2=_0x539ce2-0x0;var _0x1c85b0=_0x55ca[_0x539ce2];return _0x1c85b0;};'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(_0x5c5e95,_0x740a18){var _0x55c9aa=function(_0x52c94e){while(--_0x52c94e){_0x5c5e95['push'](_0x5c5e95['shift']());}};_0x55c9aa(++_0x740a18);}(_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 07f0282..e34ea2d 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 _0x8212=['exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x102c7b,_0x4764d0){var _0x3ced4b=function(_0x399dcc){while(--_0x399dcc){_0x102c7b['push'](_0x102c7b['shift']());}};_0x3ced4b(++_0x4764d0);}(_0x8212,0xbb));var _0x2821=function(_0x14f55c,_0x2adaaf){_0x14f55c=_0x14f55c-0x0;var _0x513e7a=_0x8212[_0x14f55c];return _0x513e7a;};'use strict';var _=require(_0x2821('0x0'));var util=require(_0x2821('0x1'));var logger=require(_0x2821('0x2'))(_0x2821('0x3'));var moment=require('moment');var BPromise=require(_0x2821('0x4'));var rp=require(_0x2821('0x5'));var fs=require('fs');var path=require(_0x2821('0x6'));var rimraf=require('rimraf');var config=require(_0x2821('0x7'));var attributes=require('./memberReport.attributes');module[_0x2821('0x8')]=function(_0x42f324,_0x3a7b86){return _0x42f324[_0x2821('0x9')](_0x2821('0xa'),attributes,{'tableName':_0x2821('0xb'),'paranoid':![],'indexes':[{'name':_0x2821('0xc'),'fields':[_0x2821('0xd'),_0x2821('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x63f2=['bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment'];(function(_0x3c430b,_0xaeb96d){var _0x54b8d8=function(_0x2cb3ad){while(--_0x2cb3ad){_0x3c430b['push'](_0x3c430b['shift']());}};_0x54b8d8(++_0xaeb96d);}(_0x63f2,0x19b));var _0x263f=function(_0x47e124,_0x1a60ae){_0x47e124=_0x47e124-0x0;var _0x4d8797=_0x63f2[_0x47e124];return _0x4d8797;};'use strict';var _=require(_0x263f('0x0'));var util=require(_0x263f('0x1'));var logger=require(_0x263f('0x2'))(_0x263f('0x3'));var moment=require(_0x263f('0x4'));var BPromise=require(_0x263f('0x5'));var rp=require(_0x263f('0x6'));var fs=require('fs');var path=require(_0x263f('0x7'));var rimraf=require(_0x263f('0x8'));var config=require('../../config/environment');var attributes=require(_0x263f('0x9'));module[_0x263f('0xa')]=function(_0x4c13d7,_0x4551c2){return _0x4c13d7[_0x263f('0xb')](_0x263f('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x263f('0xd'),'fields':[_0x263f('0xe'),_0x263f('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 7b85374..eb61f10 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 _0xbd36=['error','code','MemberReport,\x20%s,\x20%s','message','result','catch','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','GetMemberReport','create','then','CreateMemberReport','UpdateMemberReport','update','body','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbd36,0x65));var _0x6bd3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd36[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6bd3('0x0'));var util=require(_0x6bd3('0x1'));var moment=require(_0x6bd3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bd3('0x3'));var db=require(_0x6bd3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6bd3('0x5'))(_0x6bd3('0x6'));var config=require(_0x6bd3('0x7'));var jayson=require(_0x6bd3('0x8'));var client=jayson['client'][_0x6bd3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x173035,_0x221ec0,_0x1b4148){return new BPromise(function(_0x1b2946,_0x3db900){return client[_0x6bd3('0xa')](_0x173035,_0x1b4148)['then'](function(_0x516c47){logger[_0x6bd3('0xb')]('MemberReport,\x20%s,\x20%s',_0x221ec0,_0x6bd3('0xc'));logger[_0x6bd3('0xd')](_0x6bd3('0xe'),_0x221ec0,_0x6bd3('0xc'),JSON[_0x6bd3('0xf')](_0x516c47));if(_0x516c47['error']){if(_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x11')]===0x1f4){logger['error'](_0x6bd3('0x12'),_0x221ec0,_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x13')]);return _0x3db900(_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x13')]);}logger[_0x6bd3('0x10')](_0x6bd3('0x12'),_0x221ec0,_0x516c47[_0x6bd3('0x10')]['message']);return _0x1b2946(_0x516c47[_0x6bd3('0x10')][_0x6bd3('0x13')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0x221ec0,'request\x20sent');_0x1b2946(_0x516c47[_0x6bd3('0x14')]['message']);}})[_0x6bd3('0x15')](function(_0x3aa000){logger[_0x6bd3('0x10')](_0x6bd3('0x12'),_0x221ec0,_0x3aa000);_0x3db900(_0x3aa000);});});}exports['GetMemberReport']=function(_0x573656){var _0xa72c2d=this;return new Promise(function(_0x769de8,_0xf0f85a){return db[_0x6bd3('0x16')][_0x6bd3('0x17')]({'raw':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x19')]===undefined?!![]:![]:!![],'where':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1a')]||null:null,'attributes':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1b')]||null:null,'limit':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1c')]||null:null,'include':_0x573656[_0x6bd3('0x18')]?_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1d')]?_['map'](_0x573656[_0x6bd3('0x18')][_0x6bd3('0x1d')],function(_0x28b9a9){return{'model':db[_0x28b9a9['model']],'as':_0x28b9a9['as'],'attributes':_0x28b9a9[_0x6bd3('0x1b')],'include':_0x28b9a9[_0x6bd3('0x1d')]?_[_0x6bd3('0x1e')](_0x28b9a9[_0x6bd3('0x1d')],function(_0xa8c894){return{'model':db[_0xa8c894[_0x6bd3('0x1f')]],'as':_0xa8c894['as'],'attributes':_0xa8c894[_0x6bd3('0x1b')],'include':_0xa8c894[_0x6bd3('0x1d')]?_['map'](_0xa8c894[_0x6bd3('0x1d')],function(_0x585f4e){return{'model':db[_0x585f4e[_0x6bd3('0x1f')]],'as':_0x585f4e['as'],'attributes':_0x585f4e[_0x6bd3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26ffc5){logger[_0x6bd3('0xb')](_0x6bd3('0x20'),_0x573656);logger[_0x6bd3('0xd')](_0x6bd3('0x20'),_0x573656,JSON[_0x6bd3('0xf')](_0x26ffc5));_0x769de8(_0x26ffc5);})[_0x6bd3('0x15')](function(_0x552628){logger[_0x6bd3('0x10')](_0x6bd3('0x20'),_0x552628[_0x6bd3('0x13')],_0x573656);_0xf0f85a(_0xa72c2d[_0x6bd3('0x10')](0x1f4,_0x552628['message']));});});};exports['CreateMemberReport']=function(_0x5e65b7){var _0x418281=this;return new Promise(function(_0xf10a80,_0x5f0883){return db[_0x6bd3('0x16')][_0x6bd3('0x21')](_0x5e65b7['body'],{'raw':_0x5e65b7[_0x6bd3('0x18')]?_0x5e65b7[_0x6bd3('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6bd3('0x22')](function(_0x283cb4){logger[_0x6bd3('0xb')]('CreateMemberReport',_0x5e65b7);logger[_0x6bd3('0xd')](_0x6bd3('0x23'),_0x5e65b7,JSON['stringify'](_0x283cb4));_0xf10a80(_0x283cb4);})[_0x6bd3('0x15')](function(_0x4fc175){logger[_0x6bd3('0x10')](_0x6bd3('0x23'),_0x4fc175[_0x6bd3('0x13')],_0x5e65b7);_0x5f0883(_0x418281[_0x6bd3('0x10')](0x1f4,_0x4fc175[_0x6bd3('0x13')]));});});};exports[_0x6bd3('0x24')]=function(_0x1ea2ef){var _0x5cffdb=this;return new Promise(function(_0x1261a7,_0x32b844){return db[_0x6bd3('0x16')][_0x6bd3('0x25')](_0x1ea2ef[_0x6bd3('0x26')],{'raw':_0x1ea2ef[_0x6bd3('0x18')]?_0x1ea2ef[_0x6bd3('0x18')][_0x6bd3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ea2ef[_0x6bd3('0x18')]?_0x1ea2ef[_0x6bd3('0x18')][_0x6bd3('0x1a')]||null:null,'attributes':_0x1ea2ef['options']?_0x1ea2ef['options'][_0x6bd3('0x1b')]||null:null,'limit':_0x1ea2ef[_0x6bd3('0x18')]?_0x1ea2ef[_0x6bd3('0x18')][_0x6bd3('0x1c')]||null:null})['then'](function(_0x30c3bb){logger['info'](_0x6bd3('0x24'),_0x1ea2ef);logger[_0x6bd3('0xd')]('UpdateMemberReport',_0x1ea2ef,JSON[_0x6bd3('0xf')](_0x30c3bb));_0x1261a7(_0x30c3bb);})[_0x6bd3('0x15')](function(_0x30d29a){logger[_0x6bd3('0x10')](_0x6bd3('0x24'),_0x30d29a['message'],_0x1ea2ef);_0x32b844(_0x5cffdb[_0x6bd3('0x10')](0x1f4,_0x30d29a[_0x6bd3('0x13')]));});});}; \ No newline at end of file +var _0x9120=['CreateMemberReport','MemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','options','raw','where','limit','include','map','attributes','model'];(function(_0x31218c,_0x28ae34){var _0x13e4ab=function(_0x3e0521){while(--_0x3e0521){_0x31218c['push'](_0x31218c['shift']());}};_0x13e4ab(++_0x28ae34);}(_0x9120,0x1b3));var _0x0912=function(_0x32a0fb,_0xfd5f90){_0x32a0fb=_0x32a0fb-0x0;var _0x41eafe=_0x9120[_0x32a0fb];return _0x41eafe;};'use strict';var _=require(_0x0912('0x0'));var util=require(_0x0912('0x1'));var moment=require(_0x0912('0x2'));var BPromise=require(_0x0912('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0912('0x4'))['db'];var utils=require(_0x0912('0x5'));var logger=require(_0x0912('0x6'))(_0x0912('0x7'));var config=require(_0x0912('0x8'));var jayson=require(_0x0912('0x9'));var client=jayson['client'][_0x0912('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x345969,_0x438bb2,_0x564522){return new BPromise(function(_0x674709,_0x4383c7){return client[_0x0912('0xb')](_0x345969,_0x564522)[_0x0912('0xc')](function(_0x1532bd){logger['info'](_0x0912('0xd'),_0x438bb2,_0x0912('0xe'));logger[_0x0912('0xf')](_0x0912('0x10'),_0x438bb2,'request\x20sent',JSON[_0x0912('0x11')](_0x1532bd));if(_0x1532bd['error']){if(_0x1532bd[_0x0912('0x12')][_0x0912('0x13')]===0x1f4){logger[_0x0912('0x12')](_0x0912('0xd'),_0x438bb2,_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);return _0x4383c7(_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);}logger[_0x0912('0x12')](_0x0912('0xd'),_0x438bb2,_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);return _0x674709(_0x1532bd[_0x0912('0x12')][_0x0912('0x14')]);}else{logger[_0x0912('0x15')]('MemberReport,\x20%s,\x20%s',_0x438bb2,'request\x20sent');_0x674709(_0x1532bd[_0x0912('0x16')]['message']);}})[_0x0912('0x17')](function(_0x5cd19f){logger[_0x0912('0x12')]('MemberReport,\x20%s,\x20%s',_0x438bb2,_0x5cd19f);_0x4383c7(_0x5cd19f);});});}exports[_0x0912('0x18')]=function(_0x5eace1){var _0x22befd=this;return new Promise(function(_0x5357db,_0x495e2e){return db['MemberReport']['findAll']({'raw':_0x5eace1[_0x0912('0x19')]?_0x5eace1['options'][_0x0912('0x1a')]===undefined?!![]:![]:!![],'where':_0x5eace1[_0x0912('0x19')]?_0x5eace1['options'][_0x0912('0x1b')]||null:null,'attributes':_0x5eace1[_0x0912('0x19')]?_0x5eace1[_0x0912('0x19')]['attributes']||null:null,'limit':_0x5eace1['options']?_0x5eace1[_0x0912('0x19')][_0x0912('0x1c')]||null:null,'include':_0x5eace1[_0x0912('0x19')]?_0x5eace1[_0x0912('0x19')][_0x0912('0x1d')]?_[_0x0912('0x1e')](_0x5eace1[_0x0912('0x19')][_0x0912('0x1d')],function(_0xca7f8b){return{'model':db[_0xca7f8b['model']],'as':_0xca7f8b['as'],'attributes':_0xca7f8b[_0x0912('0x1f')],'include':_0xca7f8b[_0x0912('0x1d')]?_[_0x0912('0x1e')](_0xca7f8b['include'],function(_0x4a938e){return{'model':db[_0x4a938e[_0x0912('0x20')]],'as':_0x4a938e['as'],'attributes':_0x4a938e['attributes'],'include':_0x4a938e['include']?_[_0x0912('0x1e')](_0x4a938e[_0x0912('0x1d')],function(_0x4d45d2){return{'model':db[_0x4d45d2[_0x0912('0x20')]],'as':_0x4d45d2['as'],'attributes':_0x4d45d2[_0x0912('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0912('0xc')](function(_0x2c8e48){logger[_0x0912('0x15')]('GetMemberReport',_0x5eace1);logger[_0x0912('0xf')](_0x0912('0x18'),_0x5eace1,JSON['stringify'](_0x2c8e48));_0x5357db(_0x2c8e48);})[_0x0912('0x17')](function(_0x3428a9){logger[_0x0912('0x12')]('GetMemberReport',_0x3428a9[_0x0912('0x14')],_0x5eace1);_0x495e2e(_0x22befd[_0x0912('0x12')](0x1f4,_0x3428a9[_0x0912('0x14')]));});});};exports[_0x0912('0x21')]=function(_0x5a30d8){var _0x448fa3=this;return new Promise(function(_0x195c08,_0x2a9282){return db[_0x0912('0x22')][_0x0912('0x23')](_0x5a30d8[_0x0912('0x24')],{'raw':_0x5a30d8['options']?_0x5a30d8['options'][_0x0912('0x1a')]===undefined?!![]:![]:!![]})[_0x0912('0xc')](function(_0x485c3d){logger['info'](_0x0912('0x21'),_0x5a30d8);logger[_0x0912('0xf')](_0x0912('0x21'),_0x5a30d8,JSON[_0x0912('0x11')](_0x485c3d));_0x195c08(_0x485c3d);})[_0x0912('0x17')](function(_0x933d56){logger[_0x0912('0x12')](_0x0912('0x21'),_0x933d56['message'],_0x5a30d8);_0x2a9282(_0x448fa3['error'](0x1f4,_0x933d56[_0x0912('0x14')]));});});};exports[_0x0912('0x25')]=function(_0x49628d){var _0x2f2448=this;return new Promise(function(_0x271a9c,_0x39a152){return db[_0x0912('0x22')][_0x0912('0x26')](_0x49628d[_0x0912('0x24')],{'raw':_0x49628d[_0x0912('0x19')]?_0x49628d[_0x0912('0x19')][_0x0912('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49628d['options']?_0x49628d[_0x0912('0x19')][_0x0912('0x1b')]||null:null,'attributes':_0x49628d[_0x0912('0x19')]?_0x49628d[_0x0912('0x19')][_0x0912('0x1f')]||null:null,'limit':_0x49628d[_0x0912('0x19')]?_0x49628d[_0x0912('0x19')]['limit']||null:null})[_0x0912('0xc')](function(_0x4aef9a){logger['info']('UpdateMemberReport',_0x49628d);logger[_0x0912('0xf')](_0x0912('0x25'),_0x49628d,JSON['stringify'](_0x4aef9a));_0x271a9c(_0x4aef9a);})[_0x0912('0x17')](function(_0x200399){logger[_0x0912('0x12')]('UpdateMemberReport',_0x200399[_0x0912('0x14')],_0x49628d);_0x39a152(_0x2f2448[_0x0912('0x12')](0x1f4,_0x200399['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5e7eada..e271264 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 _0xe364=['get','index','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./migration.controller'];(function(_0xfd75c7,_0x4b6dd2){var _0x2b106e=function(_0x25f784){while(--_0x25f784){_0xfd75c7['push'](_0xfd75c7['shift']());}};_0x2b106e(++_0x4b6dd2);}(_0xe364,0x1ed));var _0x4e36=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xe364[_0x3b632f];return _0x10e788;};'use strict';var multer=require(_0x4e36('0x0'));var util=require('util');var path=require(_0x4e36('0x1'));var timeout=require(_0x4e36('0x2'));var express=require(_0x4e36('0x3'));var router=express['Router']();var fs_extra=require(_0x4e36('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e36('0x5'));var controller=require(_0x4e36('0x6'));router[_0x4e36('0x7')]('/',controller[_0x4e36('0x8')]);module[_0x4e36('0x9')]=router; \ No newline at end of file +var _0xa63f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa63f,0x1b6));var _0xfa63=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0xa63f[_0x2aee2f];return _0x19337f;};'use strict';var multer=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var path=require(_0xfa63('0x2'));var timeout=require(_0xfa63('0x3'));var express=require(_0xfa63('0x4'));var router=express[_0xfa63('0x5')]();var fs_extra=require(_0xfa63('0x6'));var auth=require(_0xfa63('0x7'));var interaction=require(_0xfa63('0x8'));var config=require(_0xfa63('0x9'));var controller=require('./migration.controller');router['get']('/',controller[_0xfa63('0xa')]);module[_0xfa63('0xb')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d4f1334..f6834ba 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 _0x1443=['sequelize','exports','STRING','version'];(function(_0x4bd676,_0x355a13){var _0x4f679c=function(_0x10d329){while(--_0x10d329){_0x4bd676['push'](_0x4bd676['shift']());}};_0x4f679c(++_0x355a13);}(_0x1443,0xc4));var _0x3144=function(_0xc789dc,_0x50da9c){_0xc789dc=_0xc789dc-0x0;var _0x3fd09d=_0x1443[_0xc789dc];return _0x3fd09d;};'use strict';var Sequelize=require(_0x3144('0x0'));module[_0x3144('0x1')]={'version':{'type':Sequelize[_0x3144('0x2')],'unique':_0x3144('0x3')}}; \ No newline at end of file +var _0xdd62=['exports','STRING','version','sequelize'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xdd62,0x6b));var _0x2dd6=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xdd62[_0x1e7b16];return _0x37fadc;};'use strict';var Sequelize=require(_0x2dd6('0x0'));module[_0x2dd6('0x1')]={'version':{'type':Sequelize[_0x2dd6('0x2')],'unique':_0x2dd6('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 437658b..1540462 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 _0x820a=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Migration','include','findAll','rows','catch','eml-format','rimraf','request-promise','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x1fa707,_0x376e43){var _0x35a0a7=function(_0x686860){while(--_0x686860){_0x1fa707['push'](_0x1fa707['shift']());}};_0x35a0a7(++_0x376e43);}(_0x820a,0x187));var _0xa820=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x820a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa820('0x0'));var rimraf=require(_0xa820('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa820('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa820('0x3'));var util=require(_0xa820('0x4'));var path=require(_0xa820('0x5'));var sox=require('sox');var csv=require(_0xa820('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa820('0x7'));var _=require(_0xa820('0x8'));var squel=require(_0xa820('0x9'));var crypto=require(_0xa820('0xa'));var jsforce=require(_0xa820('0xb'));var deskjs=require(_0xa820('0xc'));var toCsv=require(_0xa820('0x6'));var querystring=require(_0xa820('0xd'));var Papa=require(_0xa820('0xe'));var Redis=require('ioredis');var authService=require(_0xa820('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa820('0x10'));var logger=require(_0xa820('0x11'))(_0xa820('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa820('0x13'));var db=require(_0xa820('0x14'))['db'];function respondWithStatusCode(_0x267967,_0x6184){_0x6184=_0x6184||0xcc;return function(_0x306a39){if(_0x306a39){return _0x267967[_0xa820('0x15')](_0x6184);}return _0x267967[_0xa820('0x16')](_0x6184)['end']();};}function respondWithResult(_0x2a943d,_0x1a6c06){_0x1a6c06=_0x1a6c06||0xc8;return function(_0x315780){if(_0x315780){return _0x2a943d[_0xa820('0x16')](_0x1a6c06)[_0xa820('0x17')](_0x315780);}};}function respondWithFilteredResult(_0x4720da,_0x1e287e){return function(_0xb3da75){if(_0xb3da75){var _0x1750bd=typeof _0x1e287e[_0xa820('0x18')]===_0xa820('0x19')&&typeof _0x1e287e[_0xa820('0x1a')]===_0xa820('0x19');var _0x17bc3c=_0xb3da75[_0xa820('0x1b')];var _0x300513=_0x1750bd?0x0:_0x1e287e[_0xa820('0x18')];var _0x30c01f=_0x1750bd?_0xb3da75[_0xa820('0x1b')]:_0x1e287e[_0xa820('0x18')]+_0x1e287e['limit'];var _0x22a12a;if(_0x30c01f>=_0x17bc3c){_0x30c01f=_0x17bc3c;_0x22a12a=0xc8;}else{_0x22a12a=0xce;}_0x4720da[_0xa820('0x16')](_0x22a12a);return _0x4720da[_0xa820('0x1c')](_0xa820('0x1d'),_0x300513+'-'+_0x30c01f+'/'+_0x17bc3c)['json'](_0xb3da75);}return null;};}function patchUpdates(_0x4b7878){return function(_0x8ebc70){try{jsonpatch[_0xa820('0x1e')](_0x8ebc70,_0x4b7878,!![]);}catch(_0x27c84e){return BPromise[_0xa820('0x1f')](_0x27c84e);}return _0x8ebc70[_0xa820('0x20')]();};}function saveUpdates(_0x4ac26b,_0x1cb132){return function(_0xdf721d){if(_0xdf721d){return _0xdf721d[_0xa820('0x21')](_0x4ac26b)[_0xa820('0x22')](function(_0x527115){return _0x527115;});}return null;};}function removeEntity(_0x2d4c65,_0x57a751){return function(_0x1622fc){if(_0x1622fc){return _0x1622fc[_0xa820('0x23')]()[_0xa820('0x22')](function(){_0x2d4c65[_0xa820('0x16')](0xcc)[_0xa820('0x24')]();});}};}function handleEntityNotFound(_0x28b921,_0x17f99d){return function(_0x467df6){if(!_0x467df6){_0x28b921[_0xa820('0x15')](0x194);}return _0x467df6;};}function handleError(_0x2001d1,_0x39c3cd){_0x39c3cd=_0x39c3cd||0x1f4;return function(_0xd86204){logger[_0xa820('0x25')](_0xd86204[_0xa820('0x26')]);if(_0xd86204[_0xa820('0x27')]){delete _0xd86204[_0xa820('0x27')];}_0x2001d1[_0xa820('0x16')](_0x39c3cd)[_0xa820('0x28')](_0xd86204);};}exports[_0xa820('0x29')]=function(_0x12f087,_0x330246){var _0x2a8514={},_0x2b9621={},_0x4e7e93={'count':0x0,'rows':[]};var _0x3503bb=_[_0xa820('0x2a')](db['Migration'][_0xa820('0x2b')],function(_0x210afc){return{'name':_0x210afc[_0xa820('0x2c')],'type':_0x210afc[_0xa820('0x2d')][_0xa820('0x2e')]};});_0x2b9621['model']=_[_0xa820('0x2a')](_0x3503bb,'name');_0x2b9621[_0xa820('0x2f')]=_[_0xa820('0x30')](_0x12f087['query']);_0x2b9621[_0xa820('0x31')]=_[_0xa820('0x32')](_0x2b9621[_0xa820('0x33')],_0x2b9621[_0xa820('0x2f')]);_0x2a8514['attributes']=_[_0xa820('0x32')](_0x2b9621[_0xa820('0x33')],qs[_0xa820('0x34')](_0x12f087[_0xa820('0x2f')]['fields']));_0x2a8514[_0xa820('0x35')]=_0x2a8514[_0xa820('0x35')][_0xa820('0x36')]?_0x2a8514['attributes']:_0x2b9621['model'];if(!_0x12f087['query'][_0xa820('0x37')](_0xa820('0x38'))){_0x2a8514[_0xa820('0x1a')]=qs[_0xa820('0x1a')](_0x12f087[_0xa820('0x2f')][_0xa820('0x1a')]);_0x2a8514['offset']=qs[_0xa820('0x18')](_0x12f087[_0xa820('0x2f')][_0xa820('0x18')]);}_0x2a8514['order']=qs['sort'](_0x12f087[_0xa820('0x2f')][_0xa820('0x39')]);_0x2a8514[_0xa820('0x3a')]=qs[_0xa820('0x31')](_[_0xa820('0x3b')](_0x12f087['query'],_0x2b9621[_0xa820('0x31')]),_0x3503bb);if(_0x12f087[_0xa820('0x2f')][_0xa820('0x3c')]){_0x2a8514[_0xa820('0x3a')]=_[_0xa820('0x3d')](_0x2a8514[_0xa820('0x3a')],{'$or':_[_0xa820('0x2a')](_0x3503bb,function(_0x1778b0){if(_0x1778b0['type']!==_0xa820('0x3e')){var _0x3d0878={};_0x3d0878[_0x1778b0[_0xa820('0x27')]]={'$like':'%'+_0x12f087[_0xa820('0x2f')][_0xa820('0x3c')]+'%'};return _0x3d0878;}})});}_0x2a8514=_[_0xa820('0x3d')]({},_0x2a8514,_0x12f087[_0xa820('0x3f')]);var _0x47f6f8={'where':_0x2a8514[_0xa820('0x3a')]};return db[_0xa820('0x40')][_0xa820('0x1b')](_0x47f6f8)[_0xa820('0x22')](function(_0x4d3d2f){_0x4e7e93[_0xa820('0x1b')]=_0x4d3d2f;if(_0x12f087['query']['includeAll']){_0x2a8514[_0xa820('0x41')]=[{'all':!![]}];}return db[_0xa820('0x40')][_0xa820('0x42')](_0x2a8514);})[_0xa820('0x22')](function(_0x11aeb1){_0x4e7e93[_0xa820('0x43')]=_0x11aeb1;return _0x4e7e93;})[_0xa820('0x22')](respondWithFilteredResult(_0x330246,_0x2a8514))[_0xa820('0x44')](handleError(_0x330246,null));}; \ No newline at end of file +var _0xdcd4=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','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','offset','limit','undefined','count','set','apply','reject','save','update','then','error','name','index','map','Migration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir'];(function(_0xd20566,_0x1f7a62){var _0x15fcbc=function(_0x562340){while(--_0x562340){_0xd20566['push'](_0xd20566['shift']());}};_0x15fcbc(++_0x1f7a62);}(_0xdcd4,0x1b3));var _0x4dcd=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdcd4[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x4dcd('0x0'));var rimraf=require(_0x4dcd('0x1'));var zipdir=require(_0x4dcd('0x2'));var jsonpatch=require(_0x4dcd('0x3'));var rp=require(_0x4dcd('0x4'));var moment=require('moment');var BPromise=require(_0x4dcd('0x5'));var Mustache=require(_0x4dcd('0x6'));var util=require(_0x4dcd('0x7'));var path=require(_0x4dcd('0x8'));var sox=require(_0x4dcd('0x9'));var csv=require('to-csv');var ejs=require(_0x4dcd('0xa'));var fs=require('fs');var fs_extra=require(_0x4dcd('0xb'));var _=require(_0x4dcd('0xc'));var squel=require(_0x4dcd('0xd'));var crypto=require(_0x4dcd('0xe'));var jsforce=require(_0x4dcd('0xf'));var deskjs=require(_0x4dcd('0x10'));var toCsv=require(_0x4dcd('0x11'));var querystring=require(_0x4dcd('0x12'));var Papa=require(_0x4dcd('0x13'));var Redis=require(_0x4dcd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x4dcd('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dcd('0x16'));var logger=require(_0x4dcd('0x17'))(_0x4dcd('0x18'));var utils=require(_0x4dcd('0x19'));var config=require(_0x4dcd('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4dcd('0x1b'))['db'];function respondWithStatusCode(_0x4b5944,_0x246c2a){_0x246c2a=_0x246c2a||0xcc;return function(_0x3b4c93){if(_0x3b4c93){return _0x4b5944[_0x4dcd('0x1c')](_0x246c2a);}return _0x4b5944[_0x4dcd('0x1d')](_0x246c2a)[_0x4dcd('0x1e')]();};}function respondWithResult(_0x1e2aa9,_0x30a1ec){_0x30a1ec=_0x30a1ec||0xc8;return function(_0xc50e6c){if(_0xc50e6c){return _0x1e2aa9[_0x4dcd('0x1d')](_0x30a1ec)[_0x4dcd('0x1f')](_0xc50e6c);}};}function respondWithFilteredResult(_0x1ef4be,_0x5a7f76){return function(_0x362b68){if(_0x362b68){var _0x5f129f=typeof _0x5a7f76[_0x4dcd('0x20')]==='undefined'&&typeof _0x5a7f76[_0x4dcd('0x21')]===_0x4dcd('0x22');var _0x58cd42=_0x362b68['count'];var _0x4764b9=_0x5f129f?0x0:_0x5a7f76[_0x4dcd('0x20')];var _0x548b2b=_0x5f129f?_0x362b68[_0x4dcd('0x23')]:_0x5a7f76[_0x4dcd('0x20')]+_0x5a7f76[_0x4dcd('0x21')];var _0x1f991b;if(_0x548b2b>=_0x58cd42){_0x548b2b=_0x58cd42;_0x1f991b=0xc8;}else{_0x1f991b=0xce;}_0x1ef4be[_0x4dcd('0x1d')](_0x1f991b);return _0x1ef4be[_0x4dcd('0x24')]('Content-Range',_0x4764b9+'-'+_0x548b2b+'/'+_0x58cd42)['json'](_0x362b68);}return null;};}function patchUpdates(_0x21bd1f){return function(_0x127045){try{jsonpatch[_0x4dcd('0x25')](_0x127045,_0x21bd1f,!![]);}catch(_0x4d0f5b){return BPromise[_0x4dcd('0x26')](_0x4d0f5b);}return _0x127045[_0x4dcd('0x27')]();};}function saveUpdates(_0x31cdbb,_0x3edebf){return function(_0xaafeba){if(_0xaafeba){return _0xaafeba[_0x4dcd('0x28')](_0x31cdbb)[_0x4dcd('0x29')](function(_0x112f68){return _0x112f68;});}return null;};}function removeEntity(_0x421e60,_0x496be7){return function(_0x18fce6){if(_0x18fce6){return _0x18fce6['destroy']()['then'](function(){_0x421e60[_0x4dcd('0x1d')](0xcc)[_0x4dcd('0x1e')]();});}};}function handleEntityNotFound(_0x13c105,_0x13de99){return function(_0x47b3b1){if(!_0x47b3b1){_0x13c105[_0x4dcd('0x1c')](0x194);}return _0x47b3b1;};}function handleError(_0x1c83a1,_0x1d91b3){_0x1d91b3=_0x1d91b3||0x1f4;return function(_0x2cd4e8){logger[_0x4dcd('0x2a')](_0x2cd4e8['stack']);if(_0x2cd4e8[_0x4dcd('0x2b')]){delete _0x2cd4e8[_0x4dcd('0x2b')];}_0x1c83a1[_0x4dcd('0x1d')](_0x1d91b3)['send'](_0x2cd4e8);};}exports[_0x4dcd('0x2c')]=function(_0x1b4f5b,_0x33f582){var _0x3112c9={},_0x11902f={},_0x11022e={'count':0x0,'rows':[]};var _0x34cede=_[_0x4dcd('0x2d')](db[_0x4dcd('0x2e')][_0x4dcd('0x2f')],function(_0x7a1954){return{'name':_0x7a1954[_0x4dcd('0x30')],'type':_0x7a1954[_0x4dcd('0x31')][_0x4dcd('0x32')]};});_0x11902f['model']=_[_0x4dcd('0x2d')](_0x34cede,_0x4dcd('0x2b'));_0x11902f['query']=_[_0x4dcd('0x33')](_0x1b4f5b[_0x4dcd('0x34')]);_0x11902f[_0x4dcd('0x35')]=_[_0x4dcd('0x36')](_0x11902f[_0x4dcd('0x37')],_0x11902f[_0x4dcd('0x34')]);_0x3112c9[_0x4dcd('0x38')]=_[_0x4dcd('0x36')](_0x11902f[_0x4dcd('0x37')],qs[_0x4dcd('0x39')](_0x1b4f5b[_0x4dcd('0x34')][_0x4dcd('0x39')]));_0x3112c9['attributes']=_0x3112c9[_0x4dcd('0x38')][_0x4dcd('0x3a')]?_0x3112c9['attributes']:_0x11902f['model'];if(!_0x1b4f5b[_0x4dcd('0x34')]['hasOwnProperty'](_0x4dcd('0x3b'))){_0x3112c9[_0x4dcd('0x21')]=qs[_0x4dcd('0x21')](_0x1b4f5b[_0x4dcd('0x34')][_0x4dcd('0x21')]);_0x3112c9[_0x4dcd('0x20')]=qs[_0x4dcd('0x20')](_0x1b4f5b[_0x4dcd('0x34')][_0x4dcd('0x20')]);}_0x3112c9[_0x4dcd('0x3c')]=qs[_0x4dcd('0x3d')](_0x1b4f5b[_0x4dcd('0x34')][_0x4dcd('0x3d')]);_0x3112c9[_0x4dcd('0x3e')]=qs[_0x4dcd('0x35')](_[_0x4dcd('0x3f')](_0x1b4f5b[_0x4dcd('0x34')],_0x11902f[_0x4dcd('0x35')]),_0x34cede);if(_0x1b4f5b['query'][_0x4dcd('0x40')]){_0x3112c9[_0x4dcd('0x3e')]=_[_0x4dcd('0x41')](_0x3112c9['where'],{'$or':_[_0x4dcd('0x2d')](_0x34cede,function(_0x39484d){if(_0x39484d['type']!==_0x4dcd('0x42')){var _0x4c9ac4={};_0x4c9ac4[_0x39484d[_0x4dcd('0x2b')]]={'$like':'%'+_0x1b4f5b[_0x4dcd('0x34')][_0x4dcd('0x40')]+'%'};return _0x4c9ac4;}})});}_0x3112c9=_['merge']({},_0x3112c9,_0x1b4f5b[_0x4dcd('0x43')]);var _0x4dfae8={'where':_0x3112c9['where']};return db[_0x4dcd('0x2e')][_0x4dcd('0x23')](_0x4dfae8)[_0x4dcd('0x29')](function(_0xffad47){_0x11022e[_0x4dcd('0x23')]=_0xffad47;if(_0x1b4f5b[_0x4dcd('0x34')][_0x4dcd('0x44')]){_0x3112c9[_0x4dcd('0x45')]=[{'all':!![]}];}return db[_0x4dcd('0x2e')][_0x4dcd('0x46')](_0x3112c9);})[_0x4dcd('0x29')](function(_0x4ccd36){_0x11022e[_0x4dcd('0x47')]=_0x4ccd36;return _0x11022e;})[_0x4dcd('0x29')](respondWithFilteredResult(_0x33f582,_0x3112c9))[_0x4dcd('0x48')](handleError(_0x33f582,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index e5ef479..934bb36 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 _0x338a=['Migration','migrations','lodash','path','rimraf','../../config/environment','./migration.attributes','define'];(function(_0x3ac54b,_0x391040){var _0x3bd6c5=function(_0x53d351){while(--_0x53d351){_0x3ac54b['push'](_0x3ac54b['shift']());}};_0x3bd6c5(++_0x391040);}(_0x338a,0x7a));var _0xa338=function(_0x3953bd,_0x17601a){_0x3953bd=_0x3953bd-0x0;var _0xeeb1cc=_0x338a[_0x3953bd];return _0xeeb1cc;};'use strict';var _=require(_0xa338('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa338('0x1'));var rimraf=require(_0xa338('0x2'));var config=require(_0xa338('0x3'));var attributes=require(_0xa338('0x4'));module['exports']=function(_0x487217,_0x2e1815){return _0x487217[_0xa338('0x5')](_0xa338('0x6'),attributes,{'tableName':_0xa338('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a54=['bluebird','request-promise','path','exports','define','Migration','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a54,0x126));var _0x45a5=function(_0x11a46e,_0x50686f){_0x11a46e=_0x11a46e-0x0;var _0x14a904=_0x5a54[_0x11a46e];return _0x14a904;};'use strict';var _=require(_0x45a5('0x0'));var util=require(_0x45a5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x45a5('0x2'));var BPromise=require(_0x45a5('0x3'));var rp=require(_0x45a5('0x4'));var fs=require('fs');var path=require(_0x45a5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x45a5('0x6')]=function(_0x425da7,_0x479471){return _0x425da7[_0x45a5('0x7')](_0x45a5('0x8'),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 85ec372..f15abfa 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 _0x3c0d=['request\x20sent','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0x5a2cca,_0x287e30){var _0x1619a8=function(_0x15409f){while(--_0x15409f){_0x5a2cca['push'](_0x5a2cca['shift']());}};_0x1619a8(++_0x287e30);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x4f595d,_0x2c0258){_0x4f595d=_0x4f595d-0x0;var _0x31e4e8=_0x3c0d[_0x4f595d];return _0x31e4e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd3c0('0x0'));var rs=require(_0xd3c0('0x1'));var fs=require('fs');var Redis=require(_0xd3c0('0x2'));var db=require(_0xd3c0('0x3'))['db'];var utils=require(_0xd3c0('0x4'));var logger=require(_0xd3c0('0x5'))(_0xd3c0('0x6'));var config=require(_0xd3c0('0x7'));var jayson=require(_0xd3c0('0x8'));var client=jayson['client'][_0xd3c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fa5f,_0x6308e2,_0x10f804){return new BPromise(function(_0x2c37b8,_0x2d11d5){return client[_0xd3c0('0xa')](_0x47fa5f,_0x10f804)[_0xd3c0('0xb')](function(_0x2be3c0){logger[_0xd3c0('0xc')](_0xd3c0('0xd'),_0x6308e2,_0xd3c0('0xe'));logger['debug'](_0xd3c0('0xf'),_0x6308e2,_0xd3c0('0xe'),JSON['stringify'](_0x2be3c0));if(_0x2be3c0['error']){if(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x11')]===0x1f4){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0['error'][_0xd3c0('0x12')]);return _0x2d11d5(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}logger['error'](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);return _0x2c37b8(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}else{logger[_0xd3c0('0xc')]('Migration,\x20%s,\x20%s',_0x6308e2,'request\x20sent');_0x2c37b8(_0x2be3c0[_0xd3c0('0x13')][_0xd3c0('0x12')]);}})['catch'](function(_0x3e9b6b){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x3e9b6b);_0x2d11d5(_0x3e9b6b);});});} \ No newline at end of file +var _0xcd60=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x55fd40,_0x225b77){var _0x7979f1=function(_0x1d21c1){while(--_0x1d21c1){_0x55fd40['push'](_0x55fd40['shift']());}};_0x7979f1(++_0x225b77);}(_0xcd60,0xf0));var _0x0cd6=function(_0x55b3a3,_0x5c6409){_0x55b3a3=_0x55b3a3-0x0;var _0xb84e40=_0xcd60[_0x55b3a3];return _0xb84e40;};'use strict';var _=require(_0x0cd6('0x0'));var util=require(_0x0cd6('0x1'));var moment=require(_0x0cd6('0x2'));var BPromise=require(_0x0cd6('0x3'));var rs=require(_0x0cd6('0x4'));var fs=require('fs');var Redis=require(_0x0cd6('0x5'));var db=require(_0x0cd6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0cd6('0x7'))(_0x0cd6('0x8'));var config=require(_0x0cd6('0x9'));var jayson=require(_0x0cd6('0xa'));var client=jayson[_0x0cd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ceb47,_0x460833,_0x47c8b2){return new BPromise(function(_0x4714bf,_0x4fb298){return client[_0x0cd6('0xc')](_0x2ceb47,_0x47c8b2)[_0x0cd6('0xd')](function(_0x14f396){logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,'request\x20sent');logger[_0x0cd6('0x10')](_0x0cd6('0x11'),_0x460833,_0x0cd6('0x12'),JSON[_0x0cd6('0x13')](_0x14f396));if(_0x14f396[_0x0cd6('0x14')]){if(_0x14f396['error']['code']===0x1f4){logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')]['message']);return _0x4fb298(_0x14f396[_0x0cd6('0x14')]['message']);}logger[_0x0cd6('0x14')](_0x0cd6('0xf'),_0x460833,_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);return _0x4714bf(_0x14f396[_0x0cd6('0x14')][_0x0cd6('0x15')]);}else{logger[_0x0cd6('0xe')](_0x0cd6('0xf'),_0x460833,_0x0cd6('0x12'));_0x4714bf(_0x14f396[_0x0cd6('0x16')][_0x0cd6('0x15')]);}})[_0x0cd6('0x17')](function(_0x30d35c){logger[_0x0cd6('0x14')]('Migration,\x20%s,\x20%s',_0x460833,_0x30d35c);_0x4fb298(_0x30d35c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 01831b4..b0542f9 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 _0x0628=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','post','create'];(function(_0xe5a56c,_0x266cad){var _0x324fb5=function(_0x1061b2){while(--_0x1061b2){_0xe5a56c['push'](_0xe5a56c['shift']());}};_0x324fb5(++_0x266cad);}(_0x0628,0x15c));var _0x8062=function(_0x3707d7,_0x16e3b2){_0x3707d7=_0x3707d7-0x0;var _0x20f06c=_0x0628[_0x3707d7];return _0x20f06c;};'use strict';var multer=require(_0x8062('0x0'));var util=require(_0x8062('0x1'));var path=require('path');var timeout=require(_0x8062('0x2'));var express=require(_0x8062('0x3'));var router=express[_0x8062('0x4')]();var fs_extra=require(_0x8062('0x5'));var auth=require(_0x8062('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8062('0x7'));var controller=require('./network.controller');router[_0x8062('0x8')]('/',auth[_0x8062('0x9')](),controller[_0x8062('0xa')]);router[_0x8062('0x8')]('/:id',auth[_0x8062('0x9')](),controller['show']);router[_0x8062('0xb')]('/',auth[_0x8062('0x9')](),controller[_0x8062('0xc')]);router[_0x8062('0xd')](_0x8062('0xe'),auth['isAuthenticated'](),controller[_0x8062('0xf')]);router[_0x8062('0x10')](_0x8062('0xe'),auth['isAuthenticated'](),controller[_0x8062('0x11')]);module[_0x8062('0x12')]=router; \ No newline at end of file +var _0x47c5=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x3a6b78,_0x2d62be){var _0x4943d4=function(_0x33ab64){while(--_0x33ab64){_0x3a6b78['push'](_0x3a6b78['shift']());}};_0x4943d4(++_0x2d62be);}(_0x47c5,0x165));var _0x547c=function(_0xd28119,_0x2a8097){_0xd28119=_0xd28119-0x0;var _0x418b38=_0x47c5[_0xd28119];return _0x418b38;};'use strict';var multer=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var path=require(_0x547c('0x2'));var timeout=require(_0x547c('0x3'));var express=require(_0x547c('0x4'));var router=express[_0x547c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x547c('0x6'));var interaction=require(_0x547c('0x7'));var config=require('../../config/environment');var controller=require(_0x547c('0x8'));router[_0x547c('0x9')]('/',auth['isAuthenticated'](),controller[_0x547c('0xa')]);router[_0x547c('0x9')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0xd')]);router[_0x547c('0xe')]('/',auth[_0x547c('0xc')](),controller[_0x547c('0xf')]);router[_0x547c('0x10')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0x11')]);router[_0x547c('0x12')](_0x547c('0xb'),auth[_0x547c('0xc')](),controller[_0x547c('0x13')]);module[_0x547c('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index aa470bc..a97e315 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 _0xc75b=['stun','turn','STRING','sequelize','exports','localnet'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc75b,0x1b3));var _0xbc75=function(_0x1eccdd,_0x2eaf16){_0x1eccdd=_0x1eccdd-0x0;var _0x3fa3e0=_0xc75b[_0x1eccdd];return _0x3fa3e0;};'use strict';var Sequelize=require(_0xbc75('0x0'));module[_0xbc75('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbc75('0x2'),'externip',_0xbc75('0x3'),_0xbc75('0x4'))},'value':{'type':Sequelize[_0xbc75('0x5')]},'username':{'type':Sequelize[_0xbc75('0x5')]},'password':{'type':Sequelize[_0xbc75('0x5')]}}; \ No newline at end of file +var _0xc286=['externip','stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc286,0x6c));var _0x6c28=function(_0x51f115,_0x78d0f6){_0x51f115=_0x51f115-0x0;var _0x5259dc=_0xc286[_0x51f115];return _0x5259dc;};'use strict';var Sequelize=require(_0x6c28('0x0'));module[_0x6c28('0x1')]={'type':{'type':Sequelize[_0x6c28('0x2')](_0x6c28('0x3'),_0x6c28('0x4'),_0x6c28('0x5'),_0x6c28('0x6'))},'value':{'type':Sequelize[_0x6c28('0x7')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x6c28('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 038e9c2..4fcb745 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 _0x0006=['params','update','TURN','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','destroy','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','then','end','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','model','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','include','create','body','toUpperCase','STUN','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','readFileSync','join','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','format','chan_sip.so','find'];(function(_0x1a7253,_0x28fd20){var _0x1fc611=function(_0x340443){while(--_0x340443){_0x1a7253['push'](_0x1a7253['shift']());}};_0x1fc611(++_0x28fd20);}(_0x0006,0x1ba));var _0x6000=function(_0x408ad0,_0x212b64){_0x408ad0=_0x408ad0-0x0;var _0x15077b=_0x0006[_0x408ad0];return _0x15077b;};'use strict';var util=require(_0x6000('0x0'));var path=require(_0x6000('0x1'));var ejs=require(_0x6000('0x2'));var fs=require('fs');var _=require(_0x6000('0x3'));var qs=require(_0x6000('0x4'));var logger=require(_0x6000('0x5'))(_0x6000('0x6'));var config=require('../../config/environment');var db=require(_0x6000('0x7'))['db'];var jayson=require(_0x6000('0x8'));var client=jayson[_0x6000('0x9')][_0x6000('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5843d5,_0x1e9881,_0x5c0a2e,_0x400947){return new Promise(function(_0x50f8ff,_0x4c86e6){var _0x7e07a3=_0x400947||client;return _0x7e07a3['request'](_0x5843d5,_0x5c0a2e)['then'](function(_0x4eaf8a){logger[_0x6000('0xb')](_0x6000('0xc'),_0x1e9881,_0x6000('0xd'));logger[_0x6000('0xe')](_0x6000('0xf'),_0x1e9881,_0x6000('0xd'),JSON['stringify'](_0x4eaf8a));if(_0x4eaf8a['error']){if(_0x4eaf8a['error']['code']===0x1f4){logger[_0x6000('0x10')](_0x6000('0xc'),_0x1e9881,_0x4eaf8a[_0x6000('0x10')][_0x6000('0x11')]);return _0x4c86e6(_0x4eaf8a[_0x6000('0x10')]['message']);}logger[_0x6000('0x10')](_0x6000('0xc'),_0x1e9881,_0x4eaf8a[_0x6000('0x10')][_0x6000('0x11')]);return _0x50f8ff(_0x4eaf8a[_0x6000('0x10')][_0x6000('0x11')]);}else{logger[_0x6000('0xb')](_0x6000('0xc'),_0x1e9881,_0x6000('0xd'));_0x50f8ff(_0x4eaf8a[_0x6000('0x12')][_0x6000('0x11')]);}})[_0x6000('0x13')](function(_0x321607){logger[_0x6000('0x10')](_0x6000('0xc'),_0x1e9881,_0x321607);_0x4c86e6(_0x321607);});});}function respondWithResult(_0x4e8792,_0x2ab44b){_0x2ab44b=_0x2ab44b||0xc8;return function(_0xdf8bab){if(_0xdf8bab){return _0x4e8792[_0x6000('0x14')](_0x2ab44b)[_0x6000('0x15')](_0xdf8bab);}};}function respondWithFilteredResult(_0x34f6fa,_0x34a53c){return function(_0x2f691f){if(_0x2f691f){var _0xdf4e2e=typeof _0x34a53c[_0x6000('0x16')]===_0x6000('0x17')&&typeof _0x34a53c[_0x6000('0x18')]==='undefined';var _0x47e36e=_0x2f691f[_0x6000('0x19')];var _0x360c8b=_0xdf4e2e?0x0:_0x34a53c[_0x6000('0x16')];var _0x15c466=_0xdf4e2e?_0x2f691f[_0x6000('0x19')]:_0x34a53c[_0x6000('0x16')]+_0x34a53c['limit'];var _0x179907;if(_0x15c466>=_0x47e36e){_0x15c466=_0x47e36e;_0x179907=0xc8;}else{_0x179907=0xce;}_0x34f6fa[_0x6000('0x14')](_0x179907);return _0x34f6fa[_0x6000('0x1a')](_0x6000('0x1b'),_0x360c8b+'-'+_0x15c466+'/'+_0x47e36e)[_0x6000('0x15')](_0x2f691f);}return null;};}function saveUpdates(_0x11c948){return function(_0x3cae4d){if(_0x3cae4d){return _0x3cae4d['update'](_0x11c948)[_0x6000('0x1c')](function(_0x10d1e8){return _0x10d1e8;});}return null;};}function removeEntity(_0x24df64){return function(_0x2d82d5){if(_0x2d82d5){return _0x2d82d5['destroy']()[_0x6000('0x1c')](function(){_0x24df64[_0x6000('0x14')](0xcc)[_0x6000('0x1d')]();});}};}function handleEntityNotFound(_0x4a2ddd){return function(_0x70be4a){if(!_0x70be4a){_0x4a2ddd[_0x6000('0x1e')](0x194);}return _0x70be4a;};}function handleError(_0x38cb1b,_0x1d42c8){_0x1d42c8=_0x1d42c8||0x1f4;return function(_0x519de4){logger[_0x6000('0x10')](_0x519de4[_0x6000('0x1f')]);if(_0x519de4[_0x6000('0x20')]){delete _0x519de4[_0x6000('0x20')];}_0x38cb1b[_0x6000('0x14')](_0x1d42c8)[_0x6000('0x21')](_0x519de4);};}exports['index']=function(_0x2edf05,_0x1319e){var _0xfca66b={},_0x26bd82={},_0x52a4c8={'count':0x0,'rows':[]};var _0x5816c4=_[_0x6000('0x22')](db[_0x6000('0x23')][_0x6000('0x24')],function(_0x27b67e){return{'name':_0x27b67e[_0x6000('0x25')],'type':_0x27b67e['type'][_0x6000('0x26')]};});_0x26bd82['model']=_[_0x6000('0x22')](_0x5816c4,_0x6000('0x20'));_0x26bd82[_0x6000('0x27')]=_[_0x6000('0x28')](_0x2edf05[_0x6000('0x27')]);_0x26bd82['filters']=_[_0x6000('0x29')](_0x26bd82['model'],_0x26bd82[_0x6000('0x27')]);_0xfca66b[_0x6000('0x2a')]=_[_0x6000('0x29')](_0x26bd82['model'],qs[_0x6000('0x2b')](_0x2edf05[_0x6000('0x27')][_0x6000('0x2b')]));_0xfca66b[_0x6000('0x2a')]=_0xfca66b[_0x6000('0x2a')]['length']?_0xfca66b[_0x6000('0x2a')]:_0x26bd82[_0x6000('0x2c')];if(!_0x2edf05['query'][_0x6000('0x2d')]('nolimit')){_0xfca66b[_0x6000('0x18')]=qs[_0x6000('0x18')](_0x2edf05[_0x6000('0x27')][_0x6000('0x18')]);_0xfca66b['offset']=qs[_0x6000('0x16')](_0x2edf05['query'][_0x6000('0x16')]);}_0xfca66b[_0x6000('0x2e')]=qs[_0x6000('0x2f')](_0x2edf05[_0x6000('0x27')][_0x6000('0x2f')]);_0xfca66b[_0x6000('0x30')]=qs[_0x6000('0x31')](_[_0x6000('0x32')](_0x2edf05['query'],_0x26bd82[_0x6000('0x31')]),_0x5816c4);if(_0x2edf05[_0x6000('0x27')][_0x6000('0x33')]){_0xfca66b[_0x6000('0x30')]=_['merge'](_0xfca66b[_0x6000('0x30')],{'$or':_[_0x6000('0x22')](_0x5816c4,function(_0x3493e3){if(_0x3493e3[_0x6000('0x34')]!==_0x6000('0x35')){var _0xa11d32={};_0xa11d32[_0x3493e3[_0x6000('0x20')]]={'$like':'%'+_0x2edf05[_0x6000('0x27')][_0x6000('0x33')]+'%'};return _0xa11d32;}})});}_0xfca66b=_[_0x6000('0x36')]({},_0xfca66b,_0x2edf05[_0x6000('0x37')]);var _0x37b49f={'where':_0xfca66b[_0x6000('0x30')]};return db[_0x6000('0x23')]['count'](_0x37b49f)['then'](function(_0x5a2d30){_0x52a4c8[_0x6000('0x19')]=_0x5a2d30;if(_0x2edf05[_0x6000('0x27')][_0x6000('0x38')]){_0xfca66b['include']=[{'all':!![]}];}return db['Network'][_0x6000('0x39')](_0xfca66b);})[_0x6000('0x1c')](function(_0x5ea306){_0x52a4c8[_0x6000('0x3a')]=_0x5ea306;return _0x52a4c8;})[_0x6000('0x1c')](respondWithFilteredResult(_0x1319e,_0xfca66b))[_0x6000('0x13')](handleError(_0x1319e,null));};exports[_0x6000('0x3b')]=function(_0x36d42c,_0x32deea){var _0x284c8f={'raw':!![],'where':{'id':_0x36d42c['params']['id']}},_0x5e4380={};_0x5e4380[_0x6000('0x2c')]=_[_0x6000('0x28')](db[_0x6000('0x23')][_0x6000('0x24')]);_0x5e4380['query']=_['keys'](_0x36d42c[_0x6000('0x27')]);_0x5e4380['filters']=_[_0x6000('0x29')](_0x5e4380[_0x6000('0x2c')],_0x5e4380[_0x6000('0x27')]);_0x284c8f[_0x6000('0x2a')]=_['intersection'](_0x5e4380[_0x6000('0x2c')],qs[_0x6000('0x2b')](_0x36d42c[_0x6000('0x27')]['fields']));_0x284c8f[_0x6000('0x2a')]=_0x284c8f[_0x6000('0x2a')]['length']?_0x284c8f[_0x6000('0x2a')]:_0x5e4380[_0x6000('0x2c')];if(_0x36d42c['query'][_0x6000('0x38')]){_0x284c8f[_0x6000('0x3c')]=[{'all':!![]}];}_0x284c8f=_[_0x6000('0x36')]({},_0x284c8f,_0x36d42c[_0x6000('0x37')]);return db['Network']['find'](_0x284c8f)[_0x6000('0x1c')](handleEntityNotFound(_0x32deea,null))['then'](respondWithResult(_0x32deea,null))['catch'](handleError(_0x32deea,null));};exports['create']=function(_0x2bc9f9,_0x2407db){var _0x154251;return db['Network'][_0x6000('0x3d')](_0x2bc9f9[_0x6000('0x3e')],{'raw':!![]})[_0x6000('0x1c')](function(_0x2cdfa8){_0x154251=_0x2cdfa8;return db[_0x6000('0x23')]['findAll']({'where':{'type':_0x2bc9f9['body']['type']},'raw':!![]});})[_0x6000('0x1c')](function(_0x328318){if(_0x154251[_0x6000('0x34')][_0x6000('0x3f')]()==_0x6000('0x40')){var _0x3eaec3=fs['readFileSync'](path['join'](config['root'],_0x6000('0x41')),_0x6000('0x42'));var _0x278f99=ejs[_0x6000('0x43')](_0x3eaec3,{'networks':_0x328318||[]});fs['writeFileSync'](_0x6000('0x44'),_0x278f99);return respondWithRpcPromise('Reload',_0x6000('0x3d'),{'module':_0x6000('0x45')});}else if(_0x154251['type'][_0x6000('0x3f')]()=='TURN'){var _0x31d6b8=fs[_0x6000('0x46')](path[_0x6000('0x47')](config[_0x6000('0x48')],_0x6000('0x49')),'utf8');var _0x4283b4=ejs[_0x6000('0x43')](_0x31d6b8,{'networks':_0x328318||[]});fs[_0x6000('0x4a')](_0x6000('0x4b'),_0x4283b4);return respondWithRpcPromise(_0x6000('0x4c'),_0x6000('0x3d'),{'module':_0x6000('0x45')});}else{var _0x26dfff=fs[_0x6000('0x46')](path['join'](config[_0x6000('0x48')],'server/files/templates/network.ejs'),_0x6000('0x42'));var _0x263326=ejs[_0x6000('0x43')](_0x26dfff,{'networks':_0x328318||[]});fs['writeFileSync'](util[_0x6000('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2bc9f9['body'][_0x6000('0x34')]['toLowerCase']()),_0x263326);return respondWithRpcPromise(_0x6000('0x4c'),_0x6000('0x3d'),{'module':_0x6000('0x4e')});}})[_0x6000('0x1c')](function(){return _0x154251;})[_0x6000('0x1c')](respondWithResult(_0x2407db,0xc9))[_0x6000('0x13')](handleError(_0x2407db,null));};exports['update']=function(_0x1b3081,_0x40d26d){var _0x1f709c;return db[_0x6000('0x23')][_0x6000('0x4f')]({'where':{'id':_0x1b3081[_0x6000('0x50')]['id']}})[_0x6000('0x1c')](handleEntityNotFound(_0x40d26d,null))[_0x6000('0x1c')](saveUpdates(_0x1b3081[_0x6000('0x3e')],null))['then'](function(_0x46d59c){if(_0x46d59c){_0x1f709c=_0x46d59c;return db[_0x6000('0x23')][_0x6000('0x39')]({'where':{'type':_0x1f709c['type']},'raw':!![]});}return null;})[_0x6000('0x1c')](function(_0x2ab75c){if(_0x1f709c['type']['toUpperCase']()==_0x6000('0x40')){var _0x384f29=fs[_0x6000('0x46')](path[_0x6000('0x47')](config[_0x6000('0x48')],_0x6000('0x41')),_0x6000('0x42'));var _0x43fa3f=ejs[_0x6000('0x43')](_0x384f29,{'networks':_0x2ab75c||[]});fs[_0x6000('0x4a')]('/etc/asterisk/stun_xcally.conf',_0x43fa3f);return respondWithRpcPromise(_0x6000('0x4c'),_0x6000('0x51'),{'module':_0x6000('0x45')});}else if(_0x1f709c[_0x6000('0x34')][_0x6000('0x3f')]()==_0x6000('0x52')){var _0xb27197=fs[_0x6000('0x46')](path[_0x6000('0x47')](config['root'],_0x6000('0x49')),_0x6000('0x42'));var _0xc35222=ejs[_0x6000('0x43')](_0xb27197,{'networks':_0x2ab75c||[]});fs[_0x6000('0x4a')]('/etc/asterisk/turn_xcally.conf',_0xc35222);return respondWithRpcPromise(_0x6000('0x4c'),_0x6000('0x51'),{'module':_0x6000('0x45')});}else{var _0x112127=fs[_0x6000('0x46')](path['join'](config[_0x6000('0x48')],_0x6000('0x53')),_0x6000('0x42'));var _0x3435b6=ejs[_0x6000('0x43')](_0x112127,{'networks':_0x2ab75c||[]});fs[_0x6000('0x4a')](util[_0x6000('0x4d')](_0x6000('0x54'),_0x1b3081[_0x6000('0x3e')][_0x6000('0x34')][_0x6000('0x55')]()),_0x3435b6);return respondWithRpcPromise(_0x6000('0x4c'),'update',{'module':_0x6000('0x4e')});}})['then'](function(_0x501277){if(_0x501277){return _0x1f709c;}return null;})[_0x6000('0x1c')](respondWithResult(_0x40d26d,null))[_0x6000('0x13')](handleError(_0x40d26d,null));};exports[_0x6000('0x56')]=function(_0x40a569,_0x5bcdaa){var _0x538f85;return db[_0x6000('0x23')]['find']({'where':{'id':_0x40a569[_0x6000('0x50')]['id']}})[_0x6000('0x1c')](function(_0x75ede8){_0x538f85=_0x75ede8;return _0x75ede8;})[_0x6000('0x1c')](handleEntityNotFound(_0x5bcdaa,null))[_0x6000('0x1c')](removeEntity(_0x5bcdaa,null))[_0x6000('0x1c')](function(){if(_0x538f85){return db[_0x6000('0x23')][_0x6000('0x39')]({'where':{'type':_0x538f85[_0x6000('0x34')]},'raw':!![]});}})[_0x6000('0x1c')](function(_0x19ebdd){if(_0x538f85[_0x6000('0x34')]['toUpperCase']()==_0x6000('0x40')){var _0x507f3e=fs[_0x6000('0x46')](path[_0x6000('0x47')](config[_0x6000('0x48')],'server/files/templates/stun_multiple.ejs'),_0x6000('0x42'));var _0x4bc6a6=ejs[_0x6000('0x43')](_0x507f3e,{'networks':_0x19ebdd||[]});fs[_0x6000('0x4a')](_0x6000('0x44'),_0x4bc6a6);return respondWithRpcPromise(_0x6000('0x4c'),'destroy',{'module':_0x6000('0x45')});}else if(_0x538f85[_0x6000('0x34')][_0x6000('0x3f')]()=='TURN'){var _0x97c331=fs[_0x6000('0x46')](path['join'](config[_0x6000('0x48')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1dde10=ejs[_0x6000('0x43')](_0x97c331,{'networks':_0x19ebdd||[]});fs[_0x6000('0x4a')](_0x6000('0x4b'),_0x1dde10);return respondWithRpcPromise(_0x6000('0x4c'),_0x6000('0x56'),{'module':_0x6000('0x45')});}else{var _0x4215da=fs[_0x6000('0x46')](path[_0x6000('0x47')](config[_0x6000('0x48')],_0x6000('0x53')),_0x6000('0x42'));var _0x517907=ejs[_0x6000('0x43')](_0x4215da,{'networks':_0x19ebdd||[]});fs[_0x6000('0x4a')](util[_0x6000('0x4d')](_0x6000('0x54'),_0x538f85[_0x6000('0x34')][_0x6000('0x55')]()),_0x517907);return respondWithRpcPromise(_0x6000('0x4c'),_0x6000('0x56'),{'module':_0x6000('0x4e')});}})[_0x6000('0x13')](handleError(_0x5bcdaa,null));}; \ No newline at end of file +var _0x8572=['limit','undefined','count','status','set','Content-Range','update','destroy','end','sendStatus','name','send','index','map','Network','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','include','rows','show','rawAttributes','length','includeAll','merge','find','create','findAll','body','toUpperCase','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','params','STUN','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/turn_xcally.conf','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','catch','json','offset'];(function(_0x2d2e1f,_0x92052c){var _0x4ec7e4=function(_0x585201){while(--_0x585201){_0x2d2e1f['push'](_0x2d2e1f['shift']());}};_0x4ec7e4(++_0x92052c);}(_0x8572,0xf1));var _0x2857=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x8572[_0x231e16];return _0x570a7c;};'use strict';var util=require('util');var path=require('path');var ejs=require(_0x2857('0x0'));var fs=require('fs');var _=require('lodash');var qs=require(_0x2857('0x1'));var logger=require(_0x2857('0x2'))(_0x2857('0x3'));var config=require(_0x2857('0x4'));var db=require(_0x2857('0x5'))['db'];var jayson=require(_0x2857('0x6'));var client=jayson[_0x2857('0x7')][_0x2857('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27e1e7,_0x42dacc,_0x4585ef,_0x4b6d6b){return new Promise(function(_0x36802f,_0x209b64){var _0x1a0d98=_0x4b6d6b||client;return _0x1a0d98[_0x2857('0x9')](_0x27e1e7,_0x4585ef)[_0x2857('0xa')](function(_0x23263d){logger[_0x2857('0xb')]('Network,\x20%s,\x20%s',_0x42dacc,'request\x20sent');logger[_0x2857('0xc')](_0x2857('0xd'),_0x42dacc,_0x2857('0xe'),JSON[_0x2857('0xf')](_0x23263d));if(_0x23263d[_0x2857('0x10')]){if(_0x23263d[_0x2857('0x10')][_0x2857('0x11')]===0x1f4){logger[_0x2857('0x10')](_0x2857('0x12'),_0x42dacc,_0x23263d[_0x2857('0x10')]['message']);return _0x209b64(_0x23263d['error'][_0x2857('0x13')]);}logger[_0x2857('0x10')](_0x2857('0x12'),_0x42dacc,_0x23263d[_0x2857('0x10')][_0x2857('0x13')]);return _0x36802f(_0x23263d[_0x2857('0x10')][_0x2857('0x13')]);}else{logger[_0x2857('0xb')](_0x2857('0x12'),_0x42dacc,_0x2857('0xe'));_0x36802f(_0x23263d['result'][_0x2857('0x13')]);}})[_0x2857('0x14')](function(_0x1056fc){logger['error'](_0x2857('0x12'),_0x42dacc,_0x1056fc);_0x209b64(_0x1056fc);});});}function respondWithResult(_0x5ec11e,_0x413e69){_0x413e69=_0x413e69||0xc8;return function(_0x193a10){if(_0x193a10){return _0x5ec11e['status'](_0x413e69)[_0x2857('0x15')](_0x193a10);}};}function respondWithFilteredResult(_0x55f244,_0x294a5a){return function(_0x32242b){if(_0x32242b){var _0x1dacbe=typeof _0x294a5a[_0x2857('0x16')]==='undefined'&&typeof _0x294a5a[_0x2857('0x17')]===_0x2857('0x18');var _0x9937cd=_0x32242b[_0x2857('0x19')];var _0x47c787=_0x1dacbe?0x0:_0x294a5a[_0x2857('0x16')];var _0x40980c=_0x1dacbe?_0x32242b[_0x2857('0x19')]:_0x294a5a['offset']+_0x294a5a['limit'];var _0x1bf402;if(_0x40980c>=_0x9937cd){_0x40980c=_0x9937cd;_0x1bf402=0xc8;}else{_0x1bf402=0xce;}_0x55f244[_0x2857('0x1a')](_0x1bf402);return _0x55f244[_0x2857('0x1b')](_0x2857('0x1c'),_0x47c787+'-'+_0x40980c+'/'+_0x9937cd)[_0x2857('0x15')](_0x32242b);}return null;};}function saveUpdates(_0x3056cf){return function(_0x1ea004){if(_0x1ea004){return _0x1ea004[_0x2857('0x1d')](_0x3056cf)[_0x2857('0xa')](function(_0x521894){return _0x521894;});}return null;};}function removeEntity(_0x7ab76a){return function(_0x5ad3d2){if(_0x5ad3d2){return _0x5ad3d2[_0x2857('0x1e')]()[_0x2857('0xa')](function(){_0x7ab76a[_0x2857('0x1a')](0xcc)[_0x2857('0x1f')]();});}};}function handleEntityNotFound(_0x1f4c37){return function(_0x1ce102){if(!_0x1ce102){_0x1f4c37[_0x2857('0x20')](0x194);}return _0x1ce102;};}function handleError(_0x592eb3,_0x1302c3){_0x1302c3=_0x1302c3||0x1f4;return function(_0x11ad01){logger[_0x2857('0x10')](_0x11ad01['stack']);if(_0x11ad01[_0x2857('0x21')]){delete _0x11ad01[_0x2857('0x21')];}_0x592eb3[_0x2857('0x1a')](_0x1302c3)[_0x2857('0x22')](_0x11ad01);};}exports[_0x2857('0x23')]=function(_0x414f1e,_0x1df6bf){var _0x128f7e={},_0x3df229={},_0x59f799={'count':0x0,'rows':[]};var _0x3903cd=_[_0x2857('0x24')](db[_0x2857('0x25')]['rawAttributes'],function(_0x3fbd0e){return{'name':_0x3fbd0e[_0x2857('0x26')],'type':_0x3fbd0e['type']['key']};});_0x3df229[_0x2857('0x27')]=_[_0x2857('0x24')](_0x3903cd,_0x2857('0x21'));_0x3df229['query']=_[_0x2857('0x28')](_0x414f1e[_0x2857('0x29')]);_0x3df229[_0x2857('0x2a')]=_[_0x2857('0x2b')](_0x3df229[_0x2857('0x27')],_0x3df229['query']);_0x128f7e[_0x2857('0x2c')]=_[_0x2857('0x2b')](_0x3df229[_0x2857('0x27')],qs[_0x2857('0x2d')](_0x414f1e[_0x2857('0x29')][_0x2857('0x2d')]));_0x128f7e[_0x2857('0x2c')]=_0x128f7e[_0x2857('0x2c')]['length']?_0x128f7e[_0x2857('0x2c')]:_0x3df229[_0x2857('0x27')];if(!_0x414f1e[_0x2857('0x29')][_0x2857('0x2e')](_0x2857('0x2f'))){_0x128f7e['limit']=qs[_0x2857('0x17')](_0x414f1e[_0x2857('0x29')][_0x2857('0x17')]);_0x128f7e[_0x2857('0x16')]=qs[_0x2857('0x16')](_0x414f1e[_0x2857('0x29')][_0x2857('0x16')]);}_0x128f7e[_0x2857('0x30')]=qs[_0x2857('0x31')](_0x414f1e[_0x2857('0x29')][_0x2857('0x31')]);_0x128f7e['where']=qs['filters'](_[_0x2857('0x32')](_0x414f1e[_0x2857('0x29')],_0x3df229[_0x2857('0x2a')]),_0x3903cd);if(_0x414f1e[_0x2857('0x29')][_0x2857('0x33')]){_0x128f7e[_0x2857('0x34')]=_['merge'](_0x128f7e['where'],{'$or':_[_0x2857('0x24')](_0x3903cd,function(_0x4605f0){if(_0x4605f0[_0x2857('0x35')]!==_0x2857('0x36')){var _0x49196b={};_0x49196b[_0x4605f0[_0x2857('0x21')]]={'$like':'%'+_0x414f1e[_0x2857('0x29')]['filter']+'%'};return _0x49196b;}})});}_0x128f7e=_['merge']({},_0x128f7e,_0x414f1e[_0x2857('0x37')]);var _0x26e9ed={'where':_0x128f7e['where']};return db[_0x2857('0x25')]['count'](_0x26e9ed)[_0x2857('0xa')](function(_0x2cc4d1){_0x59f799[_0x2857('0x19')]=_0x2cc4d1;if(_0x414f1e[_0x2857('0x29')]['includeAll']){_0x128f7e[_0x2857('0x38')]=[{'all':!![]}];}return db[_0x2857('0x25')]['findAll'](_0x128f7e);})['then'](function(_0x54ba01){_0x59f799[_0x2857('0x39')]=_0x54ba01;return _0x59f799;})[_0x2857('0xa')](respondWithFilteredResult(_0x1df6bf,_0x128f7e))[_0x2857('0x14')](handleError(_0x1df6bf,null));};exports[_0x2857('0x3a')]=function(_0x5c8864,_0x149b68){var _0x6d30fe={'raw':!![],'where':{'id':_0x5c8864['params']['id']}},_0x4eedde={};_0x4eedde[_0x2857('0x27')]=_['keys'](db[_0x2857('0x25')][_0x2857('0x3b')]);_0x4eedde[_0x2857('0x29')]=_[_0x2857('0x28')](_0x5c8864[_0x2857('0x29')]);_0x4eedde[_0x2857('0x2a')]=_[_0x2857('0x2b')](_0x4eedde['model'],_0x4eedde[_0x2857('0x29')]);_0x6d30fe[_0x2857('0x2c')]=_[_0x2857('0x2b')](_0x4eedde[_0x2857('0x27')],qs['fields'](_0x5c8864['query'][_0x2857('0x2d')]));_0x6d30fe['attributes']=_0x6d30fe[_0x2857('0x2c')][_0x2857('0x3c')]?_0x6d30fe['attributes']:_0x4eedde[_0x2857('0x27')];if(_0x5c8864[_0x2857('0x29')][_0x2857('0x3d')]){_0x6d30fe[_0x2857('0x38')]=[{'all':!![]}];}_0x6d30fe=_[_0x2857('0x3e')]({},_0x6d30fe,_0x5c8864[_0x2857('0x37')]);return db[_0x2857('0x25')][_0x2857('0x3f')](_0x6d30fe)['then'](handleEntityNotFound(_0x149b68,null))[_0x2857('0xa')](respondWithResult(_0x149b68,null))[_0x2857('0x14')](handleError(_0x149b68,null));};exports[_0x2857('0x40')]=function(_0x494b7f,_0x5aa7dd){var _0x6d85f8;return db[_0x2857('0x25')]['create'](_0x494b7f['body'],{'raw':!![]})['then'](function(_0x5a5383){_0x6d85f8=_0x5a5383;return db[_0x2857('0x25')][_0x2857('0x41')]({'where':{'type':_0x494b7f[_0x2857('0x42')][_0x2857('0x35')]},'raw':!![]});})[_0x2857('0xa')](function(_0x22ac27){if(_0x6d85f8[_0x2857('0x35')][_0x2857('0x43')]()=='STUN'){var _0x486c0e=fs[_0x2857('0x44')](path['join'](config[_0x2857('0x45')],_0x2857('0x46')),_0x2857('0x47'));var _0x1a3bba=ejs[_0x2857('0x48')](_0x486c0e,{'networks':_0x22ac27||[]});fs[_0x2857('0x49')](_0x2857('0x4a'),_0x1a3bba);return respondWithRpcPromise(_0x2857('0x4b'),_0x2857('0x40'),{'module':_0x2857('0x4c')});}else if(_0x6d85f8[_0x2857('0x35')]['toUpperCase']()==_0x2857('0x4d')){var _0x254c2a=fs[_0x2857('0x44')](path[_0x2857('0x4e')](config['root'],_0x2857('0x4f')),_0x2857('0x47'));var _0x584900=ejs[_0x2857('0x48')](_0x254c2a,{'networks':_0x22ac27||[]});fs[_0x2857('0x49')]('/etc/asterisk/turn_xcally.conf',_0x584900);return respondWithRpcPromise(_0x2857('0x4b'),_0x2857('0x40'),{'module':_0x2857('0x4c')});}else{var _0x35a08e=fs['readFileSync'](path[_0x2857('0x4e')](config['root'],_0x2857('0x50')),'utf8');var _0x1c5b84=ejs['render'](_0x35a08e,{'networks':_0x22ac27||[]});fs[_0x2857('0x49')](util[_0x2857('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x494b7f['body'][_0x2857('0x35')][_0x2857('0x52')]()),_0x1c5b84);return respondWithRpcPromise(_0x2857('0x4b'),_0x2857('0x40'),{'module':_0x2857('0x53')});}})[_0x2857('0xa')](function(){return _0x6d85f8;})['then'](respondWithResult(_0x5aa7dd,0xc9))[_0x2857('0x14')](handleError(_0x5aa7dd,null));};exports[_0x2857('0x1d')]=function(_0x3398a8,_0x252823){var _0x105989;return db['Network'][_0x2857('0x3f')]({'where':{'id':_0x3398a8[_0x2857('0x54')]['id']}})[_0x2857('0xa')](handleEntityNotFound(_0x252823,null))[_0x2857('0xa')](saveUpdates(_0x3398a8['body'],null))['then'](function(_0x37511e){if(_0x37511e){_0x105989=_0x37511e;return db['Network']['findAll']({'where':{'type':_0x105989[_0x2857('0x35')]},'raw':!![]});}return null;})[_0x2857('0xa')](function(_0xe97d32){if(_0x105989[_0x2857('0x35')][_0x2857('0x43')]()==_0x2857('0x55')){var _0x1a7afd=fs[_0x2857('0x44')](path['join'](config[_0x2857('0x45')],_0x2857('0x46')),_0x2857('0x47'));var _0x3289b6=ejs['render'](_0x1a7afd,{'networks':_0xe97d32||[]});fs[_0x2857('0x49')](_0x2857('0x4a'),_0x3289b6);return respondWithRpcPromise('Reload',_0x2857('0x1d'),{'module':_0x2857('0x4c')});}else if(_0x105989['type'][_0x2857('0x43')]()==_0x2857('0x4d')){var _0x66d9b8=fs[_0x2857('0x44')](path[_0x2857('0x4e')](config[_0x2857('0x45')],_0x2857('0x4f')),_0x2857('0x47'));var _0x26c4a8=ejs['render'](_0x66d9b8,{'networks':_0xe97d32||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x26c4a8);return respondWithRpcPromise('Reload',_0x2857('0x1d'),{'module':_0x2857('0x4c')});}else{var _0x2bae2e=fs[_0x2857('0x44')](path[_0x2857('0x4e')](config[_0x2857('0x45')],'server/files/templates/network.ejs'),_0x2857('0x47'));var _0x358a24=ejs[_0x2857('0x48')](_0x2bae2e,{'networks':_0xe97d32||[]});fs['writeFileSync'](util[_0x2857('0x51')](_0x2857('0x56'),_0x3398a8['body'][_0x2857('0x35')]['toLowerCase']()),_0x358a24);return respondWithRpcPromise(_0x2857('0x4b'),_0x2857('0x1d'),{'module':_0x2857('0x53')});}})[_0x2857('0xa')](function(_0x3c5e88){if(_0x3c5e88){return _0x105989;}return null;})[_0x2857('0xa')](respondWithResult(_0x252823,null))[_0x2857('0x14')](handleError(_0x252823,null));};exports[_0x2857('0x1e')]=function(_0x1849eb,_0x3885e4){var _0x2bd390;return db[_0x2857('0x25')]['find']({'where':{'id':_0x1849eb[_0x2857('0x54')]['id']}})[_0x2857('0xa')](function(_0xb1023a){_0x2bd390=_0xb1023a;return _0xb1023a;})[_0x2857('0xa')](handleEntityNotFound(_0x3885e4,null))['then'](removeEntity(_0x3885e4,null))['then'](function(){if(_0x2bd390){return db[_0x2857('0x25')]['findAll']({'where':{'type':_0x2bd390[_0x2857('0x35')]},'raw':!![]});}})[_0x2857('0xa')](function(_0x56ab4a){if(_0x2bd390[_0x2857('0x35')]['toUpperCase']()==_0x2857('0x55')){var _0x1eec0d=fs[_0x2857('0x44')](path[_0x2857('0x4e')](config[_0x2857('0x45')],_0x2857('0x46')),_0x2857('0x47'));var _0x4e3c1d=ejs[_0x2857('0x48')](_0x1eec0d,{'networks':_0x56ab4a||[]});fs[_0x2857('0x49')](_0x2857('0x4a'),_0x4e3c1d);return respondWithRpcPromise(_0x2857('0x4b'),_0x2857('0x1e'),{'module':_0x2857('0x4c')});}else if(_0x2bd390['type'][_0x2857('0x43')]()=='TURN'){var _0x3e7877=fs[_0x2857('0x44')](path[_0x2857('0x4e')](config[_0x2857('0x45')],_0x2857('0x4f')),_0x2857('0x47'));var _0x37cc45=ejs[_0x2857('0x48')](_0x3e7877,{'networks':_0x56ab4a||[]});fs[_0x2857('0x49')](_0x2857('0x57'),_0x37cc45);return respondWithRpcPromise(_0x2857('0x4b'),_0x2857('0x1e'),{'module':_0x2857('0x4c')});}else{var _0x267ea6=fs['readFileSync'](path[_0x2857('0x4e')](config['root'],_0x2857('0x50')),_0x2857('0x47'));var _0x569516=ejs[_0x2857('0x48')](_0x267ea6,{'networks':_0x56ab4a||[]});fs['writeFileSync'](util[_0x2857('0x51')](_0x2857('0x56'),_0x2bd390[_0x2857('0x35')][_0x2857('0x52')]()),_0x569516);return respondWithRpcPromise(_0x2857('0x4b'),'destroy',{'module':_0x2857('0x53')});}})[_0x2857('0x14')](handleError(_0x3885e4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 89e84d9..426bdb4 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 _0xd3d1=['../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x3882d7,_0x566a50){var _0x566333=function(_0x4d1111){while(--_0x4d1111){_0x3882d7['push'](_0x3882d7['shift']());}};_0x566333(++_0x566a50);}(_0xd3d1,0x172));var _0x1d3d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd3d1[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1d3d('0x2'));var BPromise=require(_0x1d3d('0x3'));var rp=require(_0x1d3d('0x4'));var fs=require('fs');var path=require(_0x1d3d('0x5'));var rimraf=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var attributes=require(_0x1d3d('0x8'));module[_0x1d3d('0x9')]=function(_0x1cbe06,_0x449475){return _0x1cbe06[_0x1d3d('0xa')](_0x1d3d('0xb'),attributes,{'tableName':_0x1d3d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe57=['Network','network','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x75d34e,_0x49a418){var _0x325207=function(_0xf1c2d9){while(--_0xf1c2d9){_0x75d34e['push'](_0x75d34e['shift']());}};_0x325207(++_0x49a418);}(_0xfe57,0x195));var _0x7fe5=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xfe57[_0x228641];return _0x5d5d78;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7fe5('0x2'));var BPromise=require(_0x7fe5('0x3'));var rp=require(_0x7fe5('0x4'));var fs=require('fs');var path=require(_0x7fe5('0x5'));var rimraf=require(_0x7fe5('0x6'));var config=require(_0x7fe5('0x7'));var attributes=require(_0x7fe5('0x8'));module[_0x7fe5('0x9')]=function(_0x22e850,_0x188cfb){return _0x22e850[_0x7fe5('0xa')](_0x7fe5('0xb'),attributes,{'tableName':_0x7fe5('0xc'),'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 c662a30..ccc672f 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5d773a,_0x1b9ba8){var _0x1eb263=function(_0x16110e){while(--_0x16110e){_0x5d773a['push'](_0x5d773a['shift']());}};_0x1eb263(++_0x1b9ba8);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x367f20,_0x3eee2f){_0x367f20=_0x367f20-0x0;var _0x125c7b=_0x7a54[_0x367f20];return _0x125c7b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8480153..fe635da 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 _0x02ce=['addApplications','addAgents','send','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/users','getAgents','post','addDisposition','addAnswer','notify'];(function(_0x148d33,_0x28099e){var _0x74ab23=function(_0x1d2258){while(--_0x1d2258){_0x148d33['push'](_0x148d33['shift']());}};_0x74ab23(++_0x28099e);}(_0x02ce,0x1ac));var _0xe02c=function(_0x1bba4d,_0x8f0bda){_0x1bba4d=_0x1bba4d-0x0;var _0x195321=_0x02ce[_0x1bba4d];return _0x195321;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var fs_extra=require(_0xe02c('0x4'));var auth=require(_0xe02c('0x5'));var interaction=require(_0xe02c('0x6'));var config=require(_0xe02c('0x7'));var controller=require(_0xe02c('0x8'));router[_0xe02c('0x9')]('/',auth[_0xe02c('0xa')](),controller[_0xe02c('0xb')]);router[_0xe02c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe02c('0xc')]);router[_0xe02c('0x9')](_0xe02c('0xd'),auth[_0xe02c('0xa')](),controller[_0xe02c('0xe')]);router[_0xe02c('0x9')](_0xe02c('0xf'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x10')]);router[_0xe02c('0x9')](_0xe02c('0x11'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x12')]);router[_0xe02c('0x9')](_0xe02c('0x13'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x14')]);router[_0xe02c('0x9')]('/:id/interactions',auth[_0xe02c('0xa')](),controller['getInteractions']);router['get'](_0xe02c('0x15'),auth['isAuthenticated'](),controller[_0xe02c('0x16')]);router['post']('/',auth[_0xe02c('0xa')](),controller['create']);router[_0xe02c('0x17')](_0xe02c('0xf'),auth['isAuthenticated'](),controller[_0xe02c('0x18')]);router[_0xe02c('0x17')]('/:id/canned_answers',auth[_0xe02c('0xa')](),controller[_0xe02c('0x19')]);router['post']('/:id/notify',controller[_0xe02c('0x1a')]);router['post'](_0xe02c('0x13'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x1b')]);router[_0xe02c('0x17')](_0xe02c('0x15'),auth['isAuthenticated'](),controller[_0xe02c('0x1c')]);router['post']('/:id/send',auth[_0xe02c('0xa')](),controller[_0xe02c('0x1d')]);router['put'](_0xe02c('0xd'),auth[_0xe02c('0xa')](),controller['update']);router[_0xe02c('0x1e')](_0xe02c('0xd'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x1f')]);router[_0xe02c('0x1e')](_0xe02c('0xf'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x20')]);router[_0xe02c('0x1e')](_0xe02c('0x11'),auth[_0xe02c('0xa')](),controller['removeAnswers']);router[_0xe02c('0x1e')](_0xe02c('0x15'),auth[_0xe02c('0xa')](),controller[_0xe02c('0x21')]);module[_0xe02c('0x22')]=router; \ No newline at end of file +var _0xb145=['addAnswer','/:id/applications','addApplications','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition'];(function(_0x4092c4,_0x14d046){var _0x270885=function(_0x1d47fa){while(--_0x1d47fa){_0x4092c4['push'](_0x4092c4['shift']());}};_0x270885(++_0x14d046);}(_0xb145,0xa3));var _0x5b14=function(_0x443dc0,_0x4c2e2a){_0x443dc0=_0x443dc0-0x0;var _0x1a4092=_0xb145[_0x443dc0];return _0x1a4092;};'use strict';var multer=require('multer');var util=require(_0x5b14('0x0'));var path=require(_0x5b14('0x1'));var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require('../../config/environment');var controller=require(_0x5b14('0x8'));router[_0x5b14('0x9')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0xb')]);router['get'](_0x5b14('0xc'),auth[_0x5b14('0xa')](),controller[_0x5b14('0xd')]);router[_0x5b14('0x9')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0xf')]);router[_0x5b14('0x9')]('/:id/dispositions',auth[_0x5b14('0xa')](),controller[_0x5b14('0x10')]);router[_0x5b14('0x9')](_0x5b14('0x11'),auth[_0x5b14('0xa')](),controller['getAnswers']);router[_0x5b14('0x9')]('/:id/applications',auth[_0x5b14('0xa')](),controller[_0x5b14('0x12')]);router[_0x5b14('0x9')](_0x5b14('0x13'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x14')]);router['get'](_0x5b14('0x15'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x16')]);router[_0x5b14('0x17')]('/',auth[_0x5b14('0xa')](),controller[_0x5b14('0x18')]);router[_0x5b14('0x17')](_0x5b14('0x19'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x1a')]);router[_0x5b14('0x17')](_0x5b14('0x11'),auth['isAuthenticated'](),controller[_0x5b14('0x1b')]);router['post']('/:id/notify',controller['notify']);router[_0x5b14('0x17')](_0x5b14('0x1c'),auth[_0x5b14('0xa')](),controller[_0x5b14('0x1d')]);router[_0x5b14('0x17')](_0x5b14('0x15'),auth[_0x5b14('0xa')](),controller['addAgents']);router['post']('/:id/send',auth[_0x5b14('0xa')](),controller[_0x5b14('0x1e')]);router[_0x5b14('0x1f')](_0x5b14('0xe'),auth['isAuthenticated'](),controller[_0x5b14('0x20')]);router[_0x5b14('0x21')]('/:id',auth[_0x5b14('0xa')](),controller[_0x5b14('0x22')]);router['delete'](_0x5b14('0x19'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x5b14('0xa')](),controller[_0x5b14('0x23')]);router[_0x5b14('0x21')]('/:id/users',auth[_0x5b14('0xa')](),controller[_0x5b14('0x24')]);module[_0x5b14('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 0c997de..bd84742 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 _0x504f=['INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x1b9f48,_0x1dc262){var _0x5710e0=function(_0x49479b){while(--_0x49479b){_0x1b9f48['push'](_0x1b9f48['shift']());}};_0x5710e0(++_0x1dc262);}(_0x504f,0x1a0));var _0xf504=function(_0x281646,_0x165713){_0x281646=_0x281646-0x0;var _0x5b5457=_0x504f[_0x281646];return _0x5b5457;};'use strict';var Sequelize=require(_0xf504('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xf504('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf504('0x2')]();}},'replyUri':{'type':Sequelize[_0xf504('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf504('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf504('0x3');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf504('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf504('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf504('0x1')]},'queueTransfer':{'type':Sequelize[_0xf504('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf504('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf504('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf504('0x6')},'mandatoryDisposition':{'type':Sequelize[_0xf504('0x5')],'defaultValue':![],'comment':_0xf504('0x7'),'set':function(_0x3701a4){if(!_0x3701a4)this[_0xf504('0x8')]('mandatoryDispositionPauseId',null);this[_0xf504('0x8')](_0xf504('0x9'),_0x3701a4);}}}; \ No newline at end of file +var _0x6a5d=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','generate','STRING','TEXT','BOOLEAN'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0x6a5d,0x1d9));var _0xd6a5=function(_0x4a7163,_0x573ac4){_0x4a7163=_0x4a7163-0x0;var _0x2e474f=_0x6a5d[_0x4a7163];return _0x2e474f;};'use strict';var Sequelize=require(_0xd6a5('0x0'));var rs=require(_0xd6a5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd6a5('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xd6a5('0x3')]();}},'replyUri':{'type':Sequelize[_0xd6a5('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xd6a5('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd6a5('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd6a5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd6a5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xd6a5('0x4')]},'queueTransfer':{'type':Sequelize[_0xd6a5('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd6a5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd6a5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd6a5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xd6a5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xd6a5('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x243969){if(!_0x243969)this[_0xd6a5('0x9')](_0xd6a5('0xa'),null);this['setDataValue'](_0xd6a5('0xb'),_0x243969);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index a0b939f..12e35a5 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 _0xa69a=['Content-Range','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','params','keys','options','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','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','List','account','list','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','applications','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','sequelize','Transaction','bulkCreate','findAndCountAll','stack','getApplications','getInteractions','Owner','internal','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','User','out','spread','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set'];(function(_0x355869,_0x1d1626){var _0x3b2735=function(_0x1d7998){while(--_0x1d7998){_0x355869['push'](_0x355869['shift']());}};_0x3b2735(++_0x1d1626);}(_0xa69a,0x8e));var _0xaa69=function(_0xabd77f,_0xec6b80){_0xabd77f=_0xabd77f-0x0;var _0x3bbec4=_0xa69a[_0xabd77f];return _0x3bbec4;};'use strict';var emlformat=require(_0xaa69('0x0'));var rimraf=require(_0xaa69('0x1'));var zipdir=require(_0xaa69('0x2'));var jsonpatch=require(_0xaa69('0x3'));var rp=require(_0xaa69('0x4'));var moment=require(_0xaa69('0x5'));var BPromise=require(_0xaa69('0x6'));var Mustache=require(_0xaa69('0x7'));var util=require(_0xaa69('0x8'));var path=require(_0xaa69('0x9'));var sox=require(_0xaa69('0xa'));var csv=require(_0xaa69('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa69('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa69('0xd'));var deskjs=require(_0xaa69('0xe'));var toCsv=require(_0xaa69('0xb'));var querystring=require(_0xaa69('0xf'));var Papa=require(_0xaa69('0x10'));var Redis=require(_0xaa69('0x11'));var authService=require(_0xaa69('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaa69('0x13'));var hardwareService=require(_0xaa69('0x14'));var logger=require('../../config/logger')(_0xaa69('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa69('0x16'));var db=require(_0xaa69('0x17'))['db'];config[_0xaa69('0x18')]=_['defaults'](config[_0xaa69('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa69('0x19'))(new Redis(config[_0xaa69('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xaa69('0x1a'));var client=jayson[_0xaa69('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0xaa69('0x1b')][_0xaa69('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4b037d,_0x676f44,_0x29c5cf,_0x31d2cf){return new BPromise(function(_0x3085f2,_0x50d116){var _0x35c0f8=_0x31d2cf||client;return _0x35c0f8[_0xaa69('0x1d')](_0x4b037d,_0x29c5cf)[_0xaa69('0x1e')](function(_0x29d4fb){logger['info'](_0xaa69('0x1f'),_0x676f44,_0xaa69('0x20'));logger['debug'](_0xaa69('0x21'),_0x676f44,_0xaa69('0x20'),JSON[_0xaa69('0x22')](_0x29d4fb));if(_0x29d4fb['error']){if(_0x29d4fb[_0xaa69('0x23')][_0xaa69('0x24')]===0x1f4){logger[_0xaa69('0x23')](_0xaa69('0x1f'),_0x676f44,_0x29d4fb[_0xaa69('0x23')]['message']);return _0x50d116(_0x29d4fb[_0xaa69('0x23')]['message']);}logger['error'](_0xaa69('0x1f'),_0x676f44,_0x29d4fb['error'][_0xaa69('0x25')]);return _0x3085f2(_0x29d4fb[_0xaa69('0x23')]['message']);}else{logger[_0xaa69('0x26')](_0xaa69('0x1f'),_0x676f44,_0xaa69('0x20'));_0x3085f2(_0x29d4fb[_0xaa69('0x27')][_0xaa69('0x25')]);}})[_0xaa69('0x28')](function(_0x127c05){logger[_0xaa69('0x23')](_0xaa69('0x1f'),_0x676f44,_0x127c05);_0x50d116(_0x127c05);});});}function respondWithStatusCode(_0x28af49,_0x5f4d60){_0x5f4d60=_0x5f4d60||0xcc;return function(_0x1024cd){if(_0x1024cd){return _0x28af49[_0xaa69('0x29')](_0x5f4d60);}return _0x28af49[_0xaa69('0x2a')](_0x5f4d60)[_0xaa69('0x2b')]();};}function respondWithResult(_0x38af63,_0x5eb2b6){_0x5eb2b6=_0x5eb2b6||0xc8;return function(_0x2f6645){if(_0x2f6645){return _0x38af63[_0xaa69('0x2a')](_0x5eb2b6)[_0xaa69('0x2c')](_0x2f6645);}};}function respondWithFilteredResult(_0x31fc5a,_0x148713){return function(_0x2feb88){if(_0x2feb88){var _0x3cb50a=typeof _0x148713['offset']==='undefined'&&typeof _0x148713['limit']==='undefined';var _0xc602ac=_0x2feb88[_0xaa69('0x2d')];var _0xb7ec0d=_0x3cb50a?0x0:_0x148713[_0xaa69('0x2e')];var _0x442997=_0x3cb50a?_0x2feb88[_0xaa69('0x2d')]:_0x148713[_0xaa69('0x2e')]+_0x148713['limit'];var _0x1d728f;if(_0x442997>=_0xc602ac){_0x442997=_0xc602ac;_0x1d728f=0xc8;}else{_0x1d728f=0xce;}_0x31fc5a[_0xaa69('0x2a')](_0x1d728f);return _0x31fc5a[_0xaa69('0x2f')](_0xaa69('0x30'),_0xb7ec0d+'-'+_0x442997+'/'+_0xc602ac)[_0xaa69('0x2c')](_0x2feb88);}return null;};}function patchUpdates(_0x4c23fe){return function(_0x1e8d0a){try{jsonpatch[_0xaa69('0x31')](_0x1e8d0a,_0x4c23fe,!![]);}catch(_0x588d65){return BPromise[_0xaa69('0x32')](_0x588d65);}return _0x1e8d0a[_0xaa69('0x33')]();};}function saveUpdates(_0x345754,_0x528545){return function(_0x2315c4){if(_0x2315c4){return _0x2315c4['update'](_0x345754)[_0xaa69('0x1e')](function(_0x52b63c){return _0x52b63c;});}return null;};}function removeEntity(_0x3ab167,_0x5e08a2){return function(_0x4a8b3f){if(_0x4a8b3f){return _0x4a8b3f['destroy']()[_0xaa69('0x1e')](function(){var _0x554fec=_0x4a8b3f[_0xaa69('0x34')]({'plain':!![]});var _0x5168fe=_0xaa69('0x35');return db[_0xaa69('0x36')][_0xaa69('0x37')]({'where':{'type':_0x5168fe,'resourceId':_0x554fec['id']}})[_0xaa69('0x1e')](function(){return _0x4a8b3f;});})[_0xaa69('0x1e')](function(){_0x3ab167[_0xaa69('0x2a')](0xcc)[_0xaa69('0x2b')]();});}};}function handleEntityNotFound(_0x4ae698,_0x3865a8){return function(_0x371a05){if(!_0x371a05){_0x4ae698['sendStatus'](0x194);}return _0x371a05;};}function handleError(_0x5a1467,_0x2c20f7){_0x2c20f7=_0x2c20f7||0x1f4;return function(_0x3c9b8b){logger[_0xaa69('0x23')](_0x3c9b8b['stack']);if(_0x3c9b8b[_0xaa69('0x38')]){delete _0x3c9b8b['name'];}_0x5a1467[_0xaa69('0x2a')](_0x2c20f7)[_0xaa69('0x39')](_0x3c9b8b);};}exports[_0xaa69('0x3a')]=function(_0x3803b0,_0x2a643c){var _0x31cd47={'include':[{'model':db[_0xaa69('0x3b')],'as':_0xaa69('0x3c')}]},_0x1b3345={},_0x4481fa={'count':0x0,'rows':[]};var _0x19192d=_['map'](db[_0xaa69('0x3d')][_0xaa69('0x3e')],function(_0x5c91ca){return{'name':_0x5c91ca[_0xaa69('0x3f')],'type':_0x5c91ca['type'][_0xaa69('0x40')]};});_0x1b3345[_0xaa69('0x41')]=_[_0xaa69('0x42')](_0x19192d,'name');_0x1b3345[_0xaa69('0x43')]=_['keys'](_0x3803b0['query']);_0x1b3345['filters']=_[_0xaa69('0x44')](_0x1b3345[_0xaa69('0x41')],_0x1b3345[_0xaa69('0x43')]);_0x31cd47['attributes']=_[_0xaa69('0x44')](_0x1b3345[_0xaa69('0x41')],qs[_0xaa69('0x45')](_0x3803b0['query'][_0xaa69('0x45')]));_0x31cd47[_0xaa69('0x46')]=_0x31cd47[_0xaa69('0x46')][_0xaa69('0x47')]?_0x31cd47[_0xaa69('0x46')]:_0x1b3345[_0xaa69('0x41')];if(!_0x3803b0[_0xaa69('0x43')][_0xaa69('0x48')](_0xaa69('0x49'))){_0x31cd47['limit']=qs[_0xaa69('0x4a')](_0x3803b0[_0xaa69('0x43')][_0xaa69('0x4a')]);_0x31cd47[_0xaa69('0x2e')]=qs[_0xaa69('0x2e')](_0x3803b0[_0xaa69('0x43')][_0xaa69('0x2e')]);}_0x31cd47[_0xaa69('0x4b')]=qs['sort'](_0x3803b0['query'][_0xaa69('0x4c')]);_0x31cd47['where']=qs[_0xaa69('0x4d')](_[_0xaa69('0x4e')](_0x3803b0['query'],_0x1b3345['filters']),_0x19192d);if(_0x3803b0['query'][_0xaa69('0x4f')]){_0x31cd47[_0xaa69('0x50')]=_[_0xaa69('0x51')](_0x31cd47[_0xaa69('0x50')],{'$or':_[_0xaa69('0x42')](_0x19192d,function(_0x149401){if(_0x149401[_0xaa69('0x52')]!==_0xaa69('0x53')){var _0x2df417={};_0x2df417[_0x149401[_0xaa69('0x38')]]={'$like':'%'+_0x3803b0[_0xaa69('0x43')][_0xaa69('0x4f')]+'%'};return _0x2df417;}})});}_0x31cd47=_[_0xaa69('0x51')]({},_0x31cd47,_0x3803b0['options']);var _0x1a21cf={'where':_0x31cd47[_0xaa69('0x50')]};return db['OpenchannelAccount'][_0xaa69('0x2d')](_0x1a21cf)[_0xaa69('0x1e')](function(_0x4c25c3){_0x4481fa[_0xaa69('0x2d')]=_0x4c25c3;if(_0x3803b0[_0xaa69('0x43')][_0xaa69('0x54')]){_0x31cd47[_0xaa69('0x55')]=[{'all':!![]}];}return db[_0xaa69('0x3d')]['findAll'](_0x31cd47);})[_0xaa69('0x1e')](function(_0x15c419){_0x4481fa['rows']=_0x15c419;return _0x4481fa;})['then'](respondWithFilteredResult(_0x2a643c,_0x31cd47))[_0xaa69('0x28')](handleError(_0x2a643c,null));};exports['show']=function(_0x161fd1,_0x433577){var _0x453a5b={'raw':![],'where':{'id':_0x161fd1[_0xaa69('0x56')]['id']},'include':[{'model':db[_0xaa69('0x3b')],'as':_0xaa69('0x3c')}]},_0x39417a={};_0x39417a[_0xaa69('0x41')]=_['keys'](db[_0xaa69('0x3d')][_0xaa69('0x3e')]);_0x39417a[_0xaa69('0x43')]=_[_0xaa69('0x57')](_0x161fd1[_0xaa69('0x43')]);_0x39417a[_0xaa69('0x4d')]=_[_0xaa69('0x44')](_0x39417a[_0xaa69('0x41')],_0x39417a[_0xaa69('0x43')]);_0x453a5b[_0xaa69('0x46')]=_[_0xaa69('0x44')](_0x39417a['model'],qs[_0xaa69('0x45')](_0x161fd1['query'][_0xaa69('0x45')]));_0x453a5b[_0xaa69('0x46')]=_0x453a5b['attributes'][_0xaa69('0x47')]?_0x453a5b[_0xaa69('0x46')]:_0x39417a[_0xaa69('0x41')];if(_0x161fd1['query'][_0xaa69('0x54')]){_0x453a5b[_0xaa69('0x55')]=[{'all':!![]}];}_0x453a5b=_['merge']({},_0x453a5b,_0x161fd1[_0xaa69('0x58')]);return db[_0xaa69('0x3d')][_0xaa69('0x59')](_0x453a5b)[_0xaa69('0x1e')](handleEntityNotFound(_0x433577,null))[_0xaa69('0x1e')](respondWithResult(_0x433577,null))['catch'](handleError(_0x433577,null));};exports[_0xaa69('0x5a')]=function(_0x307622,_0x1fe148){return db[_0xaa69('0x3d')]['create'](_0x307622[_0xaa69('0x5b')],{})[_0xaa69('0x1e')](function(_0x42ed78){var _0x530d31=_0x307622['user'][_0xaa69('0x34')]({'plain':!![]});if(!_0x530d31)throw new Error(_0xaa69('0x5c'));if(_0x530d31[_0xaa69('0x5d')]===_0xaa69('0x5e')){var _0x696125=_0x42ed78[_0xaa69('0x34')]({'plain':!![]});var _0x27a5fc=_0xaa69('0x35');return db[_0xaa69('0x5f')]['find']({'where':{'name':_0x27a5fc,'userProfileId':_0x530d31[_0xaa69('0x60')]},'raw':!![]})[_0xaa69('0x1e')](function(_0x1d295a){if(_0x1d295a&&_0x1d295a[_0xaa69('0x61')]===0x0){return db['UserProfileResource'][_0xaa69('0x5a')]({'name':_0x696125[_0xaa69('0x38')],'resourceId':_0x696125['id'],'type':_0x1d295a[_0xaa69('0x38')],'sectionId':_0x1d295a['id']},{})[_0xaa69('0x1e')](function(){return _0x42ed78;});}else{return _0x42ed78;}})[_0xaa69('0x28')](function(_0x1ac1c6){logger['error'](_0xaa69('0x62'),_0x1ac1c6);throw _0x1ac1c6;});}return _0x42ed78;})['then'](respondWithResult(_0x1fe148,0xc9))[_0xaa69('0x28')](handleError(_0x1fe148,null));};exports[_0xaa69('0x63')]=function(_0x412e6b,_0x220d9a){if(_0x412e6b['body']['id']){delete _0x412e6b[_0xaa69('0x5b')]['id'];}return db[_0xaa69('0x3d')][_0xaa69('0x59')]({'where':{'id':_0x412e6b[_0xaa69('0x56')]['id']},'include':[{'model':db[_0xaa69('0x3b')],'as':_0xaa69('0x3c')}]})[_0xaa69('0x1e')](handleEntityNotFound(_0x220d9a,null))[_0xaa69('0x1e')](saveUpdates(_0x412e6b[_0xaa69('0x5b')],null))[_0xaa69('0x1e')](respondWithResult(_0x220d9a,null))[_0xaa69('0x28')](handleError(_0x220d9a,null));};exports['destroy']=function(_0xe8ab12,_0x21351e){return db[_0xaa69('0x3d')][_0xaa69('0x59')]({'where':{'id':_0xe8ab12[_0xaa69('0x56')]['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x21351e,null))['then'](removeEntity(_0x21351e,null))[_0xaa69('0x28')](handleError(_0x21351e,null));};exports['describe']=function(_0x42b68a,_0xfd3077){return db['OpenchannelAccount'][_0xaa69('0x64')]()[_0xaa69('0x1e')](respondWithResult(_0xfd3077,null))[_0xaa69('0x28')](handleError(_0xfd3077,null));};exports['addDisposition']=function(_0x2a7abd,_0x67cc16,_0x1dd4ed){if(_0x2a7abd[_0xaa69('0x5b')]['id']){delete _0x2a7abd[_0xaa69('0x5b')]['id'];}return db['OpenchannelAccount'][_0xaa69('0x59')]({'where':{'id':_0x2a7abd['params']['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x67cc16,null))['then'](function(_0x18bbc6){if(_0x18bbc6){_0x2a7abd[_0xaa69('0x5b')][_0xaa69('0x65')]=_0x18bbc6['id'];return db[_0xaa69('0x66')]['create'](_0x2a7abd[_0xaa69('0x5b')]);}})['then'](respondWithResult(_0x67cc16,null))[_0xaa69('0x28')](handleError(_0x67cc16,null));};exports[_0xaa69('0x67')]=function(_0x5dd80b,_0x42eb58,_0x17b1b7){var _0x36eb6a={'raw':![],'where':{}};var _0x1f4c9a={};var _0x42c355={'count':0x0,'rows':[]};return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x5dd80b['params']['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x42eb58,null))[_0xaa69('0x1e')](function(_0x5c0b1d){if(_0x5c0b1d){_0x1f4c9a[_0xaa69('0x41')]=_[_0xaa69('0x57')](db[_0xaa69('0x66')]['rawAttributes']);_0x1f4c9a[_0xaa69('0x43')]=_[_0xaa69('0x57')](_0x5dd80b[_0xaa69('0x43')]);_0x1f4c9a[_0xaa69('0x4d')]=_[_0xaa69('0x44')](_0x1f4c9a['model'],_0x1f4c9a['query']);_0x36eb6a[_0xaa69('0x46')]=_['intersection'](_0x1f4c9a[_0xaa69('0x41')],qs[_0xaa69('0x45')](_0x5dd80b[_0xaa69('0x43')][_0xaa69('0x45')]));_0x36eb6a['attributes']=_0x36eb6a[_0xaa69('0x46')][_0xaa69('0x47')]?_0x36eb6a['attributes']:_0x1f4c9a[_0xaa69('0x41')];if(!_0x5dd80b[_0xaa69('0x43')][_0xaa69('0x48')]('nolimit')){_0x36eb6a[_0xaa69('0x4a')]=qs['limit'](_0x5dd80b[_0xaa69('0x43')][_0xaa69('0x4a')]);_0x36eb6a[_0xaa69('0x2e')]=qs[_0xaa69('0x2e')](_0x5dd80b[_0xaa69('0x43')][_0xaa69('0x2e')]);}_0x36eb6a[_0xaa69('0x4b')]=qs[_0xaa69('0x4c')](_0x5dd80b[_0xaa69('0x43')][_0xaa69('0x4c')]);_0x36eb6a[_0xaa69('0x50')]=qs[_0xaa69('0x4d')](_[_0xaa69('0x4e')](_0x5dd80b['query'],_0x1f4c9a[_0xaa69('0x4d')]));_0x36eb6a[_0xaa69('0x50')][_0xaa69('0x65')]=_0x5c0b1d['id'];if(_0x5dd80b['query']['filter']){_0x36eb6a[_0xaa69('0x50')]=_['merge'](_0x36eb6a[_0xaa69('0x50')],{'$or':_[_0xaa69('0x42')](_0x36eb6a['attributes'],function(_0x485079){var _0x1159e0={};_0x1159e0[_0x485079]={'$like':'%'+_0x5dd80b[_0xaa69('0x43')][_0xaa69('0x4f')]+'%'};return _0x1159e0;})});}_0x36eb6a=_['merge']({},_0x36eb6a,_0x5dd80b['options']);return db[_0xaa69('0x66')][_0xaa69('0x2d')]({'where':_0x36eb6a[_0xaa69('0x50')]})['then'](function(_0x3a4eb1){_0x42c355[_0xaa69('0x2d')]=_0x3a4eb1;if(_0x5dd80b[_0xaa69('0x43')]['includeAll']){_0x36eb6a[_0xaa69('0x55')]=[{'all':!![]}];}return db[_0xaa69('0x66')][_0xaa69('0x69')](_0x36eb6a);})[_0xaa69('0x1e')](function(_0x1a5dde){_0x42c355['rows']=_0x1a5dde;return _0x42c355;});}})[_0xaa69('0x1e')](respondWithFilteredResult(_0x42eb58,_0x36eb6a))['catch'](handleError(_0x42eb58,null));};exports[_0xaa69('0x6a')]=function(_0x1e2b12,_0x13aa42,_0x1277a3){return db['OpenchannelAccount'][_0xaa69('0x59')]({'where':{'id':_0x1e2b12[_0xaa69('0x56')]['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x13aa42,null))['then'](function(_0x23b31e){if(_0x23b31e){return _0x23b31e[_0xaa69('0x6a')](_0x1e2b12[_0xaa69('0x43')][_0xaa69('0x6b')]);}})[_0xaa69('0x1e')](respondWithStatusCode(_0x13aa42,null))['catch'](handleError(_0x13aa42,null));};exports[_0xaa69('0x6c')]=function(_0x388255,_0x2c0618,_0x4722f3){if(_0x388255[_0xaa69('0x5b')]['id']){delete _0x388255[_0xaa69('0x5b')]['id'];}return db[_0xaa69('0x3d')]['find']({'where':{'id':_0x388255[_0xaa69('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c0618,null))[_0xaa69('0x1e')](function(_0x582be4){if(_0x582be4){_0x388255[_0xaa69('0x5b')]['OpenchannelAccountId']=_0x582be4['id'];return db[_0xaa69('0x6d')]['create'](_0x388255['body']);}})['then'](respondWithResult(_0x2c0618,null))['catch'](handleError(_0x2c0618,null));};exports[_0xaa69('0x6e')]=function(_0x29a94b,_0x21b19c,_0x2a88c8){var _0x45abb9={'raw':![],'where':{}};var _0xfe58a8={};var _0x27bc60={'count':0x0,'rows':[]};return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x29a94b['params']['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x21b19c,null))[_0xaa69('0x1e')](function(_0x178c24){if(_0x178c24){_0xfe58a8[_0xaa69('0x41')]=_[_0xaa69('0x57')](db[_0xaa69('0x6d')][_0xaa69('0x3e')]);_0xfe58a8[_0xaa69('0x43')]=_[_0xaa69('0x57')](_0x29a94b[_0xaa69('0x43')]);_0xfe58a8[_0xaa69('0x4d')]=_[_0xaa69('0x44')](_0xfe58a8['model'],_0xfe58a8[_0xaa69('0x43')]);_0x45abb9[_0xaa69('0x46')]=_['intersection'](_0xfe58a8[_0xaa69('0x41')],qs['fields'](_0x29a94b[_0xaa69('0x43')]['fields']));_0x45abb9[_0xaa69('0x46')]=_0x45abb9[_0xaa69('0x46')][_0xaa69('0x47')]?_0x45abb9[_0xaa69('0x46')]:_0xfe58a8[_0xaa69('0x41')];if(!_0x29a94b['query'][_0xaa69('0x48')](_0xaa69('0x49'))){_0x45abb9[_0xaa69('0x4a')]=qs[_0xaa69('0x4a')](_0x29a94b['query'][_0xaa69('0x4a')]);_0x45abb9[_0xaa69('0x2e')]=qs['offset'](_0x29a94b[_0xaa69('0x43')][_0xaa69('0x2e')]);}_0x45abb9['order']=qs[_0xaa69('0x4c')](_0x29a94b[_0xaa69('0x43')][_0xaa69('0x4c')]);_0x45abb9[_0xaa69('0x50')]=qs['filters'](_[_0xaa69('0x4e')](_0x29a94b['query'],_0xfe58a8[_0xaa69('0x4d')]));_0x45abb9[_0xaa69('0x50')][_0xaa69('0x65')]=_0x178c24['id'];if(_0x29a94b[_0xaa69('0x43')][_0xaa69('0x4f')]){_0x45abb9[_0xaa69('0x50')]=_[_0xaa69('0x51')](_0x45abb9[_0xaa69('0x50')],{'$or':_[_0xaa69('0x42')](_0x45abb9[_0xaa69('0x46')],function(_0x534c2f){var _0x6a37d6={};_0x6a37d6[_0x534c2f]={'$like':'%'+_0x29a94b[_0xaa69('0x43')]['filter']+'%'};return _0x6a37d6;})});}_0x45abb9=_[_0xaa69('0x51')]({},_0x45abb9,_0x29a94b[_0xaa69('0x58')]);return db[_0xaa69('0x6d')][_0xaa69('0x2d')]({'where':_0x45abb9[_0xaa69('0x50')]})[_0xaa69('0x1e')](function(_0x530bf9){_0x27bc60[_0xaa69('0x2d')]=_0x530bf9;if(_0x29a94b[_0xaa69('0x43')][_0xaa69('0x54')]){_0x45abb9[_0xaa69('0x55')]=[{'all':!![]}];}return db[_0xaa69('0x6d')][_0xaa69('0x69')](_0x45abb9);})[_0xaa69('0x1e')](function(_0x1be5e8){_0x27bc60[_0xaa69('0x6f')]=_0x1be5e8;return _0x27bc60;});}})[_0xaa69('0x1e')](respondWithFilteredResult(_0x21b19c,_0x45abb9))['catch'](handleError(_0x21b19c,null));};exports[_0xaa69('0x70')]=function(_0x3ad2d3,_0x5376a0,_0x105a1e){return db[_0xaa69('0x3d')]['find']({'where':{'id':_0x3ad2d3['params']['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x5376a0,null))['then'](function(_0xbf8ce4){if(_0xbf8ce4){return _0xbf8ce4[_0xaa69('0x70')](_0x3ad2d3['query'][_0xaa69('0x6b')]);}})[_0xaa69('0x1e')](respondWithStatusCode(_0x5376a0,null))['catch'](handleError(_0x5376a0,null));};exports[_0xaa69('0x71')]=function(_0x3660c5,_0x4abf31,_0x499b43){var _0x29a52b={'body':_0x3660c5['body'],'channel':_0xaa69('0x72')};var _0x18d8f0=[];var _0x398e39=[];var _0x481d0b={};var _0x105dc8=![];return db[_0xaa69('0x73')]['describe']()[_0xaa69('0x1e')](function(_0x5ec40e){if(!_0x5ec40e){throw new db['Sequelize'][(_0xaa69('0x74'))](_0xaa69('0x75'));}_0x18d8f0=_[_0xaa69('0x76')](_['keys'](_0x5ec40e),[_0xaa69('0x77'),'updatedAt']);_0x398e39=_[_0xaa69('0x76')](_['keys'](_0x5ec40e),[_0xaa69('0x77'),'updatedAt',_0xaa69('0x78'),_0xaa69('0x79')]);if(_0x3660c5[_0xaa69('0x5b')]['id']){delete _0x3660c5[_0xaa69('0x5b')]['id'];}if(_[_0xaa69('0x7a')](_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x7b')])){throw new db[(_0xaa69('0x7c'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x5b')])||_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x5b')]===''){throw new db['Sequelize'][(_0xaa69('0x74'))](_0xaa69('0x7d'));}if(_[_0xaa69('0x7a')](_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x7e')])){throw new db[(_0xaa69('0x7c'))][(_0xaa69('0x74'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x398e39);}if(!_[_0xaa69('0x7f')](_0x398e39,_0x3660c5['body'][_0xaa69('0x7e')])){throw new db['Sequelize']['ValidationError'](_0xaa69('0x80')+_0x398e39);}_0x481d0b[_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x7e')]]=_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x7b')];})['then'](function(){return db[_0xaa69('0x3d')][_0xaa69('0x59')]({'where':{'id':_0x3660c5['params']['id']},'include':[{'model':db[_0xaa69('0x81')],'as':'List','include':[{'model':db['CmContact'],'as':_0xaa69('0x82'),'where':_0x481d0b,'limit':0x1,'order':[[_0xaa69('0x83'),_0xaa69('0x84')]]}]},{'model':db[_0xaa69('0x85')],'as':_0xaa69('0x86')}]});})[_0xaa69('0x1e')](handleEntityNotFound(_0x4abf31,null))[_0xaa69('0x1e')](function(_0x27e1c2){if(_0x27e1c2&&_0x27e1c2[_0xaa69('0x87')]){_0x29a52b[_0xaa69('0x88')]=_0x27e1c2;_0x29a52b['applications']=_0x27e1c2[_0xaa69('0x86')];_0x29a52b[_0xaa69('0x89')]=_0x27e1c2[_0xaa69('0x87')];_0x29a52b['applications']=_[_0xaa69('0x8a')](_0x29a52b['applications'],[_0xaa69('0x8b')],[_0xaa69('0x8c')]);if(_0x29a52b[_0xaa69('0x88')]['Applications']){delete _0x29a52b['account'][_0xaa69('0x86')];}if(_0x29a52b[_0xaa69('0x88')][_0xaa69('0x87')]&&_0x29a52b[_0xaa69('0x88')]['List'][_0xaa69('0x82')][_0xaa69('0x47')]){return _0x29a52b[_0xaa69('0x88')]['List'][_0xaa69('0x82')][0x0];}var _0x16ab26=_[_0xaa69('0x8d')](_0x3660c5[_0xaa69('0x5b')],{'firstName':_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x7b')],'ListId':_0x27e1c2[_0xaa69('0x79')]});_0x16ab26[_0x3660c5['body'][_0xaa69('0x7e')]]=_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x7b')];return db['CmContact']['create'](_0x16ab26,{'fields':_0x18d8f0,'raw':!![]});}})[_0xaa69('0x1e')](handleEntityNotFound(_0x4abf31,null))[_0xaa69('0x1e')](function(_0x58405e){_0x29a52b[_0xaa69('0x8e')]=_0x58405e;if(_0x58405e){var _0x2b6732={'ContactId':_0x58405e['id'],'OpenchannelAccountId':_0x3660c5[_0xaa69('0x56')]['id'],'from':(_0x58405e[_0xaa69('0x8f')]||'')+'\x20'+(_0x58405e[_0xaa69('0x90')]||'')};var _0x739fc={'OpenchannelAccountId':_0x3660c5[_0xaa69('0x56')]['id'],'closed':![]};if(_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x91')]){_0x739fc[_0xaa69('0x91')]=_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x91')];return db[_0xaa69('0x92')][_0xaa69('0x59')]({'where':_0x739fc})[_0xaa69('0x1e')](function(_0x48cb38){if(_0x48cb38){return[_0x48cb38,![]];}_0x2b6732[_0xaa69('0x91')]=_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x91')];_0x2b6732[_0xaa69('0x93')]=_0x3660c5[_0xaa69('0x5b')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0x2b6732)[_0xaa69('0x1e')](function(_0xba25f5){return[_0xba25f5,!![]];});});}else{_0x739fc[_0xaa69('0x91')]=null;}_0x739fc[_0xaa69('0x94')]=_0x58405e['id'];return db[_0xaa69('0x92')][_0xaa69('0x59')]({'where':_0x739fc})['then'](function(_0x56a5d9){if(_0x56a5d9){return[_0x56a5d9,![]];}return db[_0xaa69('0x92')][_0xaa69('0x5a')](_0x2b6732)[_0xaa69('0x1e')](function(_0x19ac2a){return[_0x19ac2a,!![]];});});}})['spread'](function(_0x43112f,_0x2bf0c9){if(_0x43112f){_0x105dc8=_0x2bf0c9;if(!_0x2bf0c9){var _0x117ab3={'from':(_0x29a52b[_0xaa69('0x8e')][_0xaa69('0x8f')]||'')+'\x20'+(_0x29a52b[_0xaa69('0x8e')][_0xaa69('0x90')]||'')};if(_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x91')]&&_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x95')]&&_0x3660c5[_0xaa69('0x5b')]['threadId']!=_0x3660c5[_0xaa69('0x5b')]['messageId']){_0x117ab3[_0xaa69('0x91')]=_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x95')];}return _0x43112f[_0xaa69('0x63')](_0x117ab3);}else{return _0x43112f;}}})[_0xaa69('0x1e')](function(_0x55d2a3){_0x29a52b[_0xaa69('0x96')]=_0x55d2a3[_0xaa69('0x34')]({'plain':!![]});_0x29a52b[_0xaa69('0x96')][_0xaa69('0x97')]=_0x105dc8;if(_0x29a52b[_0xaa69('0x96')][_0xaa69('0x97')]){if(_0x29a52b['account']['autoclose']){_0x29a52b[_0xaa69('0x98')][_0xaa69('0x99')]({'id':0x0,'priority':_0x29a52b[_0xaa69('0x98')][_0xaa69('0x47')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xaa69('0x9a')});}}return db[_0xaa69('0x9b')]['create']({'body':_0x3660c5['body'][_0xaa69('0x5b')],'OpenchannelAccountId':_0x3660c5[_0xaa69('0x56')]['id'],'OpenchannelInteractionId':_0x55d2a3['id'],'direction':'in','ContactId':_0x29a52b['contact']['id'],'AttachmentId':_0x3660c5[_0xaa69('0x5b')][_0xaa69('0x9c')]});})[_0xaa69('0x1e')](function(_0x42e298){_0x29a52b['message']=_0x42e298;if(!_0x29a52b[_0xaa69('0x96')]['UserId'])return;return db['User']['find']({'attributes':['id',_0xaa69('0x38')],'where':{'id':_0x29a52b[_0xaa69('0x96')][_0xaa69('0x9d')]}});})[_0xaa69('0x1e')](function(_0x4655a4){if(_0x4655a4){_0x29a52b[_0xaa69('0x98')][_0xaa69('0x9e')]({'id':0x0,'priority':0x0,'app':_0xaa69('0x9f'),'appdata':_0x4655a4[_0xaa69('0x38')]+','+(_0x29a52b['account'][_0xaa69('0xa0')]||0xa),'interval':_0xaa69('0x9a')});}if(!_0x29a52b[_0xaa69('0x96')][_0xaa69('0xa1')])return;return db[_0xaa69('0xa2')]['find']({'attributes':['id',_0xaa69('0x38')],'where':{'id':_0x29a52b[_0xaa69('0x96')]['queueId']}});})['then'](function(_0x5a9f6f){if(_0x5a9f6f){_0x29a52b[_0xaa69('0x98')][_0xaa69('0x9e')]({'id':0x0,'priority':0x1,'app':_0xaa69('0xa3'),'appdata':_0x5a9f6f[_0xaa69('0x38')]+','+(_0x29a52b[_0xaa69('0x88')][_0xaa69('0xa4')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xaa69('0xa5'),'startRouting',_0x29a52b);})[_0xaa69('0x1e')](function(_0xc7496d){respondWithRpcPromise(_0xaa69('0xa6'),_0xaa69('0xa6'),{'event':_0xaa69('0x71'),'message':_0xc7496d},client9002);return _0xc7496d;})[_0xaa69('0x1e')](respondWithResult(_0x4abf31,null))['catch'](handleError(_0x4abf31,null));};exports['addApplications']=function(_0x4d6518,_0x380fd7){var _0x4e8cfb=_0x4d6518[_0xaa69('0x56')]['id'];var _0x37c732=_0x4d6518[_0xaa69('0x5b')];var _0x3c0d9f=0xc8;var _0x4c2a10=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xaa69('0xa7')][_0xaa69('0xa8')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x14bb9d){return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x4e8cfb},'transaction':_0x14bb9d})[_0xaa69('0x1e')](function(_0x42c661){if(_0x42c661){return db['OpenchannelApplication'][_0xaa69('0x37')]({'where':{'OpenchannelAccountId':_0x4e8cfb},'transaction':_0x14bb9d})[_0xaa69('0x1e')](function(){var _0x3b2bc2=_[_0xaa69('0x42')](_0x37c732,function(_0xab5485){_0xab5485[_0xaa69('0x65')]=_0x4e8cfb;return _0xab5485;});return db[_0xaa69('0x85')][_0xaa69('0xa9')](_0x3b2bc2,{'transaction':_0x14bb9d});});}else{_0x3c0d9f=0x194;_0x4c2a10=[];}});})[_0xaa69('0x1e')](function(){if(_0x3c0d9f!==0x194){return db['OpenchannelApplication'][_0xaa69('0xaa')]({'where':{'OpenchannelAccountId':_0x4e8cfb},'order':_0xaa69('0x8b')})[_0xaa69('0x1e')](function(_0x220d2a){_0x4c2a10=_0x220d2a;});}})[_0xaa69('0x28')](function(_0x232282){_0x3c0d9f=0x1f4;logger[_0xaa69('0x23')](_0x232282[_0xaa69('0xab')]);if(_0x232282[_0xaa69('0x38')]){delete _0x232282[_0xaa69('0x38')];}_0x4c2a10=_0x232282;})['finally'](function(){if(_0x4c2a10===null){_0x380fd7['sendStatus'](_0x3c0d9f);}else{if(_0x3c0d9f===0x1f4){_0x380fd7[_0xaa69('0x2a')](_0x3c0d9f)[_0xaa69('0x39')](_0x4c2a10);}else{_0x380fd7[_0xaa69('0x2a')](_0x3c0d9f)[_0xaa69('0x2c')](_0x4c2a10);}}});};exports[_0xaa69('0xac')]=function(_0x3a8d72,_0x2f2b48,_0x2c1790){var _0x28bb59={};var _0x1b2f88={};var _0x3418a8;var _0x4329d8;return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x3a8d72[_0xaa69('0x56')]['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x2f2b48,null))[_0xaa69('0x1e')](function(_0x22b495){if(_0x22b495){_0x3418a8=_0x22b495;_0x1b2f88[_0xaa69('0x41')]=_[_0xaa69('0x57')](db[_0xaa69('0x85')][_0xaa69('0x3e')]);_0x1b2f88[_0xaa69('0x43')]=_['keys'](_0x3a8d72[_0xaa69('0x43')]);_0x1b2f88[_0xaa69('0x4d')]=_[_0xaa69('0x44')](_0x1b2f88[_0xaa69('0x41')],_0x1b2f88[_0xaa69('0x43')]);_0x28bb59[_0xaa69('0x46')]=_[_0xaa69('0x44')](_0x1b2f88['model'],qs['fields'](_0x3a8d72['query'][_0xaa69('0x45')]));_0x28bb59[_0xaa69('0x46')]=_0x28bb59[_0xaa69('0x46')][_0xaa69('0x47')]?_0x28bb59['attributes']:_0x1b2f88[_0xaa69('0x41')];_0x28bb59[_0xaa69('0x4b')]=qs[_0xaa69('0x4c')](_0x3a8d72[_0xaa69('0x43')][_0xaa69('0x4c')]);_0x28bb59['where']=qs['filters'](_[_0xaa69('0x4e')](_0x3a8d72['query'],_0x1b2f88[_0xaa69('0x4d')]));if(_0x3a8d72[_0xaa69('0x43')][_0xaa69('0x4f')]){_0x28bb59['where']=_[_0xaa69('0x51')](_0x28bb59[_0xaa69('0x50')],{'$or':_['map'](_0x28bb59[_0xaa69('0x46')],function(_0x2889bb){var _0x16f082={};_0x16f082[_0x2889bb]={'$like':'%'+_0x3a8d72[_0xaa69('0x43')]['filter']+'%'};return _0x16f082;})});}_0x28bb59=_['merge']({},_0x28bb59,_0x3a8d72[_0xaa69('0x58')]);return _0x3418a8[_0xaa69('0xac')](_0x28bb59);}})[_0xaa69('0x1e')](function(_0x27b680){if(_0x27b680){_0x4329d8=_0x27b680[_0xaa69('0x47')];if(!_0x3a8d72[_0xaa69('0x43')][_0xaa69('0x48')]('nolimit')){_0x28bb59[_0xaa69('0x4a')]=qs[_0xaa69('0x4a')](_0x3a8d72[_0xaa69('0x43')][_0xaa69('0x4a')]);_0x28bb59[_0xaa69('0x2e')]=qs['offset'](_0x3a8d72[_0xaa69('0x43')][_0xaa69('0x2e')]);}return _0x3418a8[_0xaa69('0xac')](_0x28bb59);}})[_0xaa69('0x1e')](function(_0x1487bd){if(_0x1487bd){return _0x1487bd?{'count':_0x4329d8,'rows':_0x1487bd}:null;}})['then'](respondWithResult(_0x2f2b48,null))[_0xaa69('0x28')](handleError(_0x2f2b48,null));};exports[_0xaa69('0xad')]=function(_0x3f0823,_0x1254f6,_0x461f68){var _0xcb3226={'raw':![],'where':{}};var _0x29816e={};var _0x3107ec={'count':0x0,'rows':[]};return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x3f0823['params']['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x1254f6,null))[_0xaa69('0x1e')](function(_0x2b2423){if(_0x2b2423){_0x29816e[_0xaa69('0x41')]=_[_0xaa69('0x57')](db[_0xaa69('0x92')][_0xaa69('0x3e')]);_0x29816e[_0xaa69('0x43')]=_[_0xaa69('0x57')](_0x3f0823[_0xaa69('0x43')]);_0x29816e[_0xaa69('0x4d')]=_[_0xaa69('0x44')](_0x29816e[_0xaa69('0x41')],_0x29816e['query']);_0xcb3226[_0xaa69('0x46')]=_[_0xaa69('0x44')](_0x29816e[_0xaa69('0x41')],qs['fields'](_0x3f0823[_0xaa69('0x43')][_0xaa69('0x45')]));_0xcb3226[_0xaa69('0x46')]=_0xcb3226[_0xaa69('0x46')][_0xaa69('0x47')]?_0xcb3226[_0xaa69('0x46')]:_0x29816e[_0xaa69('0x41')];if(!_0x3f0823[_0xaa69('0x43')][_0xaa69('0x48')](_0xaa69('0x49'))){_0xcb3226[_0xaa69('0x4a')]=qs[_0xaa69('0x4a')](_0x3f0823[_0xaa69('0x43')][_0xaa69('0x4a')]);_0xcb3226[_0xaa69('0x2e')]=qs[_0xaa69('0x2e')](_0x3f0823[_0xaa69('0x43')]['offset']);}_0xcb3226[_0xaa69('0x4b')]=qs['sort'](_0x3f0823[_0xaa69('0x43')][_0xaa69('0x4c')]);_0xcb3226['where']=qs[_0xaa69('0x4d')](_[_0xaa69('0x4e')](_0x3f0823[_0xaa69('0x43')],_0x29816e[_0xaa69('0x4d')]));_0xcb3226[_0xaa69('0x50')][_0xaa69('0x65')]=_0x2b2423['id'];if(_0x3f0823[_0xaa69('0x43')]['filter']){_0xcb3226[_0xaa69('0x50')]=_['merge'](_0xcb3226[_0xaa69('0x50')],{'$or':_[_0xaa69('0x42')](_0xcb3226[_0xaa69('0x46')],function(_0x32babc){var _0x5ad708={};_0x5ad708[_0x32babc]={'$like':'%'+_0x3f0823[_0xaa69('0x43')][_0xaa69('0x4f')]+'%'};return _0x5ad708;})});}_0xcb3226=_[_0xaa69('0x51')]({},_0xcb3226,_0x3f0823[_0xaa69('0x58')]);return db[_0xaa69('0x92')][_0xaa69('0x2d')]({'where':_0xcb3226['where']})[_0xaa69('0x1e')](function(_0x9825d2){_0x3107ec[_0xaa69('0x2d')]=_0x9825d2;if(_0x3f0823[_0xaa69('0x43')][_0xaa69('0x54')]){_0xcb3226[_0xaa69('0x55')]=[{'model':db[_0xaa69('0x73')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xaa69('0xae'),'attributes':[_0xaa69('0x38'),'fullname',_0xaa69('0xaf')],'required':![]},{'model':db['Tag'],'as':_0xaa69('0xb0'),'attributes':['id',_0xaa69('0x38'),_0xaa69('0xb1')],'where':_0x3f0823['query'][_0xaa69('0xb2')]?{'id':_0x3f0823[_0xaa69('0x43')][_0xaa69('0xb2')]}:undefined,'required':_0x3f0823[_0xaa69('0x43')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xaa69('0x69')](_0xcb3226);})[_0xaa69('0x1e')](function(_0x4b63c7){_0x3107ec[_0xaa69('0x6f')]=_0x4b63c7;return _0x3107ec;});}})[_0xaa69('0x1e')](respondWithFilteredResult(_0x1254f6,_0xcb3226))[_0xaa69('0x28')](handleError(_0x1254f6,null));};exports['addAgents']=function(_0x2a34b5,_0x501a6d,_0x32ddb9){return db[_0xaa69('0x3d')][_0xaa69('0x59')]({'where':{'id':_0x2a34b5[_0xaa69('0x56')]['id']}})['then'](handleEntityNotFound(_0x501a6d,null))[_0xaa69('0x1e')](function(_0x1186a3){if(_0x1186a3){return _0x1186a3[_0xaa69('0xb3')](_0x2a34b5[_0xaa69('0x5b')][_0xaa69('0x6b')],_[_0xaa69('0xb4')](_0x2a34b5[_0xaa69('0x5b')],[_0xaa69('0x6b'),'id'])||{})['spread'](function(_0x48b6e4){for(var _0x401143=0x0;_0x401143<_0x2a34b5['body']['ids'][_0xaa69('0x47')];_0x401143+=0x1){socket[_0xaa69('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x2a34b5[_0xaa69('0x5b')][_0xaa69('0x6b')][_0x401143]),'OpenchannelAccountId':Number(_0x2a34b5[_0xaa69('0x56')]['id'])});}return _0x48b6e4;});}})['then'](respondWithResult(_0x501a6d,null))[_0xaa69('0x28')](handleError(_0x501a6d,null));};exports['removeAgents']=function(_0x5f042b,_0x3386f3,_0x2a5cad){return db[_0xaa69('0x3d')][_0xaa69('0x59')]({'where':{'id':_0x5f042b[_0xaa69('0x56')]['id']}})[_0xaa69('0x1e')](handleEntityNotFound(_0x3386f3,null))[_0xaa69('0x1e')](function(_0x53e6fa){if(_0x53e6fa){return _0x53e6fa[_0xaa69('0xb6')](_0x5f042b[_0xaa69('0x43')][_0xaa69('0x6b')])[_0xaa69('0x1e')](function(){if(_['isArray'](_0x5f042b[_0xaa69('0x43')][_0xaa69('0x6b')])){for(var _0x3d128a=0x0;_0x3d128a<_0x5f042b[_0xaa69('0x43')][_0xaa69('0x6b')]['length'];_0x3d128a+=0x1){socket[_0xaa69('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x5f042b[_0xaa69('0x43')][_0xaa69('0x6b')][_0x3d128a]),'OpenchannelAccountId':Number(_0x5f042b[_0xaa69('0x56')]['id'])});}}else{socket[_0xaa69('0xb5')](_0xaa69('0xb7'),{'UserId':Number(_0x5f042b[_0xaa69('0x43')][_0xaa69('0x6b')]),'OpenchannelAccountId':Number(_0x5f042b['params']['id'])});}});}})[_0xaa69('0x1e')](respondWithStatusCode(_0x3386f3,null))['catch'](handleError(_0x3386f3,null));};exports[_0xaa69('0xb8')]=function(_0x109828,_0x57106c,_0x4279c5){var _0x294f7b={};var _0x4e874f={};var _0x2e14b1;var _0x10fd19;return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x109828[_0xaa69('0x56')]['id']}})['then'](handleEntityNotFound(_0x57106c,null))[_0xaa69('0x1e')](function(_0x2d8655){if(_0x2d8655){_0x2e14b1=_0x2d8655;_0x4e874f[_0xaa69('0x41')]=_[_0xaa69('0x57')](db[_0xaa69('0xb9')][_0xaa69('0x3e')]);_0x4e874f[_0xaa69('0x43')]=_[_0xaa69('0x57')](_0x109828[_0xaa69('0x43')]);_0x4e874f[_0xaa69('0x4d')]=_[_0xaa69('0x44')](_0x4e874f['model'],_0x4e874f['query']);_0x294f7b[_0xaa69('0x46')]=_['intersection'](_0x4e874f[_0xaa69('0x41')],qs[_0xaa69('0x45')](_0x109828[_0xaa69('0x43')][_0xaa69('0x45')]));_0x294f7b[_0xaa69('0x46')]=_0x294f7b['attributes']['length']?_0x294f7b['attributes']:_0x4e874f[_0xaa69('0x41')];_0x294f7b[_0xaa69('0x4b')]=qs[_0xaa69('0x4c')](_0x109828[_0xaa69('0x43')][_0xaa69('0x4c')]);_0x294f7b[_0xaa69('0x50')]=qs[_0xaa69('0x4d')](_[_0xaa69('0x4e')](_0x109828[_0xaa69('0x43')],_0x4e874f[_0xaa69('0x4d')]));if(_0x109828['query'][_0xaa69('0x4f')]){_0x294f7b[_0xaa69('0x50')]=_['merge'](_0x294f7b[_0xaa69('0x50')],{'$or':_['map'](_0x294f7b[_0xaa69('0x46')],function(_0x82e9d1){var _0x32d957={};_0x32d957[_0x82e9d1]={'$like':'%'+_0x109828[_0xaa69('0x43')]['filter']+'%'};return _0x32d957;})});}_0x294f7b=_['merge']({},_0x294f7b,_0x109828[_0xaa69('0x58')]);return _0x2e14b1[_0xaa69('0xb8')](_0x294f7b);}})[_0xaa69('0x1e')](function(_0x2ead34){if(_0x2ead34){_0x10fd19=_0x2ead34[_0xaa69('0x47')];if(!_0x109828[_0xaa69('0x43')]['hasOwnProperty'](_0xaa69('0x49'))){_0x294f7b[_0xaa69('0x4a')]=qs[_0xaa69('0x4a')](_0x109828[_0xaa69('0x43')][_0xaa69('0x4a')]);_0x294f7b['offset']=qs['offset'](_0x109828[_0xaa69('0x43')]['offset']);}return _0x2e14b1[_0xaa69('0xb8')](_0x294f7b);}})[_0xaa69('0x1e')](function(_0xeae880){if(_0xeae880){return _0xeae880?{'count':_0x10fd19,'rows':_0xeae880}:null;}})[_0xaa69('0x1e')](respondWithResult(_0x57106c,null))[_0xaa69('0x28')](handleError(_0x57106c,null));};exports[_0xaa69('0x39')]=function(_0x50d6be,_0xa4b5aa,_0x519f1a){var _0x1499c8,_0x489a42,_0x1cd4ae;if(_[_0xaa69('0x7a')](_0x50d6be[_0xaa69('0x5b')][_0xaa69('0x5b')])||_0x50d6be[_0xaa69('0x5b')][_0xaa69('0x5b')]===''){throw new db[(_0xaa69('0x7c'))]['ValidationError'](_0xaa69('0x7d'));}if(_[_0xaa69('0x7a')](_0x50d6be[_0xaa69('0x5b')]['to'])){}_0x1499c8=_0x50d6be['body']['to'];return db[_0xaa69('0x3d')][_0xaa69('0x68')]({'where':{'id':_0x50d6be[_0xaa69('0x56')]['id']}})['then'](handleEntityNotFound(_0xa4b5aa,null))[_0xaa69('0x1e')](function(_0x244183){if(_0x244183){return db['OpenchannelAccount'][_0xaa69('0x59')]({'where':{'id':_0x244183['id']},'include':[{'model':db[_0xaa69('0x81')],'as':_0xaa69('0x87'),'include':[{'model':db[_0xaa69('0x73')],'as':_0xaa69('0x82'),'where':{[_0x244183[_0xaa69('0x7e')]]:_0x1499c8},'limit':0x1,'order':[[_0xaa69('0x83'),_0xaa69('0x84')]]}]}]})[_0xaa69('0x1e')](handleEntityNotFound(_0xa4b5aa,null))[_0xaa69('0x1e')](function(_0xdfd477){if(_0xdfd477&&_0xdfd477[_0xaa69('0x87')]){_0x489a42=_0xdfd477[_0xaa69('0x34')]({'plain':!![]});if(_0x489a42[_0xaa69('0x87')]&&_0x489a42[_0xaa69('0x87')][_0xaa69('0x82')][_0xaa69('0x47')]){return _0x489a42[_0xaa69('0x87')][_0xaa69('0x82')][0x0];}return db['CmContact']['create'](_['defaults'](_0x50d6be[_0xaa69('0x5b')],{'firstName':_0x1499c8,[_0xdfd477[_0xaa69('0x7e')]]:_0x1499c8,'phone':_0x1499c8,'ListId':_0x489a42['ListId']}));}})['then'](handleEntityNotFound(_0xa4b5aa,null))[_0xaa69('0x1e')](function(_0x4df41b){if(_0x4df41b){_0x1cd4ae=_0x4df41b;return db[_0xaa69('0x92')][_0xaa69('0x59')]({'where':{'ContactId':_0x1cd4ae['id'],'closed':![],'OpenchannelAccountId':_0x489a42['id']}})[_0xaa69('0x1e')](function(_0x511366){if(_0x511366){return[_0x511366,![]];}return db[_0xaa69('0x92')][_0xaa69('0x5a')]({'UserId':_0x50d6be[_0xaa69('0x5e')]['id'],'ContactId':_0x1cd4ae['id'],'OpenchannelAccountId':_0x489a42['id'],'lastMsgDirection':_0xaa69('0xba'),'firstMsgDirection':_0xaa69('0xba'),'Messages':[_['merge'](_0x50d6be['body'],{'read':![],'body':_0x50d6be[_0xaa69('0x5b')][_0xaa69('0x5b')],'OpenchannelAccountId':_0x489a42['id'],'UserId':_0x50d6be[_0xaa69('0x5e')]['id'],'ContactId':_0x1cd4ae['id']})]},{'include':[{'model':db[_0xaa69('0x9b')],'as':'Messages'}]})[_0xaa69('0x1e')](function(_0x1f00cf){return[_0x1f00cf,!![]];});});}})[_0xaa69('0xbb')](function(_0x5e3f95,_0x1d7a84){if(_0x1d7a84){return _0x5e3f95;}return db[_0xaa69('0x9b')]['create'](_[_0xaa69('0x51')](_0x50d6be[_0xaa69('0x5b')],{'read':![],'body':_0x50d6be[_0xaa69('0x5b')][_0xaa69('0x5b')],'OpenchannelAccountId':_0x489a42['id'],'OpenchannelInteractionId':_0x5e3f95['id'],'UserId':_0x50d6be[_0xaa69('0x5e')]['id'],'ContactId':_0x1cd4ae['id']}))[_0xaa69('0x1e')](function(_0x640138){_0x5e3f95[_0xaa69('0xbc')][_0xaa69('0xbd')]=[];_0x5e3f95[_0xaa69('0xbc')][_0xaa69('0xbd')][_0xaa69('0x99')](_0x640138[_0xaa69('0xbc')]);return _0x5e3f95;});});}})[_0xaa69('0x1e')](respondWithResult(_0xa4b5aa,null))[_0xaa69('0x28')](handleError(_0xa4b5aa,null));}; \ No newline at end of file +var _0x66f4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','then','name','send','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','contact','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','lastName','messageId','interaction','created','autoclose','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','startRouting','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','push','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x440323,_0x88c593){var _0x5cf6de=function(_0x1b9b4d){while(--_0x1b9b4d){_0x440323['push'](_0x440323['shift']());}};_0x5cf6de(++_0x88c593);}(_0x66f4,0xb4));var _0x466f=function(_0x3ae605,_0x50fe07){_0x3ae605=_0x3ae605-0x0;var _0x19191a=_0x66f4[_0x3ae605];return _0x19191a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x466f('0x0'));var zipdir=require(_0x466f('0x1'));var jsonpatch=require(_0x466f('0x2'));var rp=require(_0x466f('0x3'));var moment=require(_0x466f('0x4'));var BPromise=require(_0x466f('0x5'));var Mustache=require(_0x466f('0x6'));var util=require(_0x466f('0x7'));var path=require(_0x466f('0x8'));var sox=require('sox');var csv=require(_0x466f('0x9'));var ejs=require(_0x466f('0xa'));var fs=require('fs');var fs_extra=require(_0x466f('0xb'));var _=require(_0x466f('0xc'));var squel=require('squel');var crypto=require(_0x466f('0xd'));var jsforce=require(_0x466f('0xe'));var deskjs=require(_0x466f('0xf'));var toCsv=require(_0x466f('0x9'));var querystring=require(_0x466f('0x10'));var Papa=require(_0x466f('0x11'));var Redis=require('ioredis');var authService=require(_0x466f('0x12'));var qs=require(_0x466f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x466f('0x14'));var logger=require(_0x466f('0x15'))(_0x466f('0x16'));var utils=require(_0x466f('0x17'));var config=require(_0x466f('0x18'));var licenseUtil=require(_0x466f('0x19'));var db=require(_0x466f('0x1a'))['db'];config[_0x466f('0x1b')]=_[_0x466f('0x1c')](config[_0x466f('0x1b')],{'host':_0x466f('0x1d'),'port':0x18eb});var socket=require(_0x466f('0x1e'))(new Redis(config[_0x466f('0x1b')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x466f('0x1f'));var client=jayson[_0x466f('0x20')][_0x466f('0x21')]({'port':0x232c});var client9002=jayson[_0x466f('0x20')][_0x466f('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5d869c,_0xf685b6,_0x2c6649,_0x590cae){return new BPromise(function(_0x3e634a,_0xe40a8d){var _0x356ade=_0x590cae||client;return _0x356ade[_0x466f('0x22')](_0x5d869c,_0x2c6649)['then'](function(_0x4ca395){logger[_0x466f('0x23')](_0x466f('0x24'),_0xf685b6,_0x466f('0x25'));logger[_0x466f('0x26')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xf685b6,'request\x20sent',JSON['stringify'](_0x4ca395));if(_0x4ca395['error']){if(_0x4ca395['error'][_0x466f('0x27')]===0x1f4){logger[_0x466f('0x28')](_0x466f('0x24'),_0xf685b6,_0x4ca395[_0x466f('0x28')][_0x466f('0x29')]);return _0xe40a8d(_0x4ca395[_0x466f('0x28')][_0x466f('0x29')]);}logger[_0x466f('0x28')](_0x466f('0x24'),_0xf685b6,_0x4ca395[_0x466f('0x28')]['message']);return _0x3e634a(_0x4ca395[_0x466f('0x28')][_0x466f('0x29')]);}else{logger['info'](_0x466f('0x24'),_0xf685b6,_0x466f('0x25'));_0x3e634a(_0x4ca395[_0x466f('0x2a')][_0x466f('0x29')]);}})[_0x466f('0x2b')](function(_0x4cc38e){logger['error'](_0x466f('0x24'),_0xf685b6,_0x4cc38e);_0xe40a8d(_0x4cc38e);});});}function respondWithStatusCode(_0x182883,_0x30f6c4){_0x30f6c4=_0x30f6c4||0xcc;return function(_0x28d703){if(_0x28d703){return _0x182883[_0x466f('0x2c')](_0x30f6c4);}return _0x182883[_0x466f('0x2d')](_0x30f6c4)[_0x466f('0x2e')]();};}function respondWithResult(_0xfe6b1b,_0x5020f9){_0x5020f9=_0x5020f9||0xc8;return function(_0x1b2840){if(_0x1b2840){return _0xfe6b1b[_0x466f('0x2d')](_0x5020f9)[_0x466f('0x2f')](_0x1b2840);}};}function respondWithFilteredResult(_0x13baea,_0x553d3a){return function(_0x6012eb){if(_0x6012eb){var _0x2e9f76=typeof _0x553d3a[_0x466f('0x30')]===_0x466f('0x31')&&typeof _0x553d3a[_0x466f('0x32')]==='undefined';var _0x533bac=_0x6012eb[_0x466f('0x33')];var _0x3dbc2e=_0x2e9f76?0x0:_0x553d3a[_0x466f('0x30')];var _0x4c4f4d=_0x2e9f76?_0x6012eb['count']:_0x553d3a['offset']+_0x553d3a[_0x466f('0x32')];var _0x4ef5f6;if(_0x4c4f4d>=_0x533bac){_0x4c4f4d=_0x533bac;_0x4ef5f6=0xc8;}else{_0x4ef5f6=0xce;}_0x13baea[_0x466f('0x2d')](_0x4ef5f6);return _0x13baea[_0x466f('0x34')](_0x466f('0x35'),_0x3dbc2e+'-'+_0x4c4f4d+'/'+_0x533bac)[_0x466f('0x2f')](_0x6012eb);}return null;};}function patchUpdates(_0x3a6d3c){return function(_0x5622b1){try{jsonpatch[_0x466f('0x36')](_0x5622b1,_0x3a6d3c,!![]);}catch(_0x27db6a){return BPromise[_0x466f('0x37')](_0x27db6a);}return _0x5622b1[_0x466f('0x38')]();};}function saveUpdates(_0x382021,_0x120fd8){return function(_0xc9542f){if(_0xc9542f){return _0xc9542f['update'](_0x382021)['then'](function(_0x1d377b){return _0x1d377b;});}return null;};}function removeEntity(_0x1012d7,_0x580f57){return function(_0x143f6d){if(_0x143f6d){return _0x143f6d['destroy']()['then'](function(){var _0x2307b5=_0x143f6d[_0x466f('0x39')]({'plain':!![]});var _0x3f927a=_0x466f('0x3a');return db[_0x466f('0x3b')][_0x466f('0x3c')]({'where':{'type':_0x3f927a,'resourceId':_0x2307b5['id']}})[_0x466f('0x3d')](function(){return _0x143f6d;});})['then'](function(){_0x1012d7['status'](0xcc)[_0x466f('0x2e')]();});}};}function handleEntityNotFound(_0x10d64b,_0x25f8fe){return function(_0x5c92fa){if(!_0x5c92fa){_0x10d64b[_0x466f('0x2c')](0x194);}return _0x5c92fa;};}function handleError(_0x1814ec,_0x5026ad){_0x5026ad=_0x5026ad||0x1f4;return function(_0x126b03){logger[_0x466f('0x28')](_0x126b03['stack']);if(_0x126b03[_0x466f('0x3e')]){delete _0x126b03[_0x466f('0x3e')];}_0x1814ec['status'](_0x5026ad)[_0x466f('0x3f')](_0x126b03);};}exports[_0x466f('0x40')]=function(_0xe8dd06,_0x2661fa){var _0x2c5363={'include':[{'model':db['Pause'],'as':_0x466f('0x41')}]},_0x2789d1={},_0x1dfa85={'count':0x0,'rows':[]};var _0xa3cc40=_[_0x466f('0x42')](db[_0x466f('0x43')][_0x466f('0x44')],function(_0x3abc89){return{'name':_0x3abc89[_0x466f('0x45')],'type':_0x3abc89[_0x466f('0x46')][_0x466f('0x47')]};});_0x2789d1[_0x466f('0x48')]=_['map'](_0xa3cc40,_0x466f('0x3e'));_0x2789d1['query']=_[_0x466f('0x49')](_0xe8dd06['query']);_0x2789d1['filters']=_[_0x466f('0x4a')](_0x2789d1[_0x466f('0x48')],_0x2789d1[_0x466f('0x4b')]);_0x2c5363[_0x466f('0x4c')]=_[_0x466f('0x4a')](_0x2789d1[_0x466f('0x48')],qs[_0x466f('0x4d')](_0xe8dd06[_0x466f('0x4b')][_0x466f('0x4d')]));_0x2c5363[_0x466f('0x4c')]=_0x2c5363[_0x466f('0x4c')][_0x466f('0x4e')]?_0x2c5363['attributes']:_0x2789d1[_0x466f('0x48')];if(!_0xe8dd06[_0x466f('0x4b')][_0x466f('0x4f')](_0x466f('0x50'))){_0x2c5363['limit']=qs[_0x466f('0x32')](_0xe8dd06[_0x466f('0x4b')][_0x466f('0x32')]);_0x2c5363[_0x466f('0x30')]=qs[_0x466f('0x30')](_0xe8dd06[_0x466f('0x4b')]['offset']);}_0x2c5363[_0x466f('0x51')]=qs[_0x466f('0x52')](_0xe8dd06[_0x466f('0x4b')][_0x466f('0x52')]);_0x2c5363[_0x466f('0x53')]=qs[_0x466f('0x54')](_['pick'](_0xe8dd06[_0x466f('0x4b')],_0x2789d1[_0x466f('0x54')]),_0xa3cc40);if(_0xe8dd06[_0x466f('0x4b')][_0x466f('0x55')]){_0x2c5363[_0x466f('0x53')]=_[_0x466f('0x56')](_0x2c5363[_0x466f('0x53')],{'$or':_[_0x466f('0x42')](_0xa3cc40,function(_0x1f5ac2){if(_0x1f5ac2['type']!==_0x466f('0x57')){var _0xcf7108={};_0xcf7108[_0x1f5ac2[_0x466f('0x3e')]]={'$like':'%'+_0xe8dd06[_0x466f('0x4b')]['filter']+'%'};return _0xcf7108;}})});}_0x2c5363=_[_0x466f('0x56')]({},_0x2c5363,_0xe8dd06[_0x466f('0x58')]);var _0x59c8f7={'where':_0x2c5363[_0x466f('0x53')]};return db[_0x466f('0x43')][_0x466f('0x33')](_0x59c8f7)['then'](function(_0x3c0eef){_0x1dfa85[_0x466f('0x33')]=_0x3c0eef;if(_0xe8dd06[_0x466f('0x4b')][_0x466f('0x59')]){_0x2c5363[_0x466f('0x5a')]=[{'all':!![]}];}return db[_0x466f('0x43')][_0x466f('0x5b')](_0x2c5363);})[_0x466f('0x3d')](function(_0x1ee618){_0x1dfa85[_0x466f('0x5c')]=_0x1ee618;return _0x1dfa85;})['then'](respondWithFilteredResult(_0x2661fa,_0x2c5363))[_0x466f('0x2b')](handleError(_0x2661fa,null));};exports['show']=function(_0xaf834a,_0x5926a2){var _0x1659c6={'raw':![],'where':{'id':_0xaf834a[_0x466f('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x466f('0x41')}]},_0x7c1587={};_0x7c1587['model']=_['keys'](db[_0x466f('0x43')]['rawAttributes']);_0x7c1587[_0x466f('0x4b')]=_[_0x466f('0x49')](_0xaf834a[_0x466f('0x4b')]);_0x7c1587['filters']=_[_0x466f('0x4a')](_0x7c1587[_0x466f('0x48')],_0x7c1587[_0x466f('0x4b')]);_0x1659c6['attributes']=_['intersection'](_0x7c1587[_0x466f('0x48')],qs['fields'](_0xaf834a[_0x466f('0x4b')][_0x466f('0x4d')]));_0x1659c6[_0x466f('0x4c')]=_0x1659c6[_0x466f('0x4c')][_0x466f('0x4e')]?_0x1659c6[_0x466f('0x4c')]:_0x7c1587[_0x466f('0x48')];if(_0xaf834a[_0x466f('0x4b')][_0x466f('0x59')]){_0x1659c6[_0x466f('0x5a')]=[{'all':!![]}];}_0x1659c6=_[_0x466f('0x56')]({},_0x1659c6,_0xaf834a['options']);return db[_0x466f('0x43')]['find'](_0x1659c6)[_0x466f('0x3d')](handleEntityNotFound(_0x5926a2,null))['then'](respondWithResult(_0x5926a2,null))[_0x466f('0x2b')](handleError(_0x5926a2,null));};exports[_0x466f('0x5e')]=function(_0x400d8f,_0x898a66){return db['OpenchannelAccount'][_0x466f('0x5e')](_0x400d8f[_0x466f('0x5f')],{})['then'](function(_0x5da871){var _0x8af8ce=_0x400d8f[_0x466f('0x60')][_0x466f('0x39')]({'plain':!![]});if(!_0x8af8ce)throw new Error(_0x466f('0x61'));if(_0x8af8ce[_0x466f('0x62')]===_0x466f('0x60')){var _0x140c9f=_0x5da871['get']({'plain':!![]});var _0x5ee2a4='OpenchannelAccounts';return db['UserProfileSection'][_0x466f('0x63')]({'where':{'name':_0x5ee2a4,'userProfileId':_0x8af8ce[_0x466f('0x64')]},'raw':!![]})[_0x466f('0x3d')](function(_0x3bc1a5){if(_0x3bc1a5&&_0x3bc1a5[_0x466f('0x65')]===0x0){return db['UserProfileResource'][_0x466f('0x5e')]({'name':_0x140c9f['name'],'resourceId':_0x140c9f['id'],'type':_0x3bc1a5[_0x466f('0x3e')],'sectionId':_0x3bc1a5['id']},{})['then'](function(){return _0x5da871;});}else{return _0x5da871;}})[_0x466f('0x2b')](function(_0x333fc1){logger[_0x466f('0x28')](_0x466f('0x66'),_0x333fc1);throw _0x333fc1;});}return _0x5da871;})[_0x466f('0x3d')](respondWithResult(_0x898a66,0xc9))[_0x466f('0x2b')](handleError(_0x898a66,null));};exports[_0x466f('0x67')]=function(_0x51e43e,_0x56467b){if(_0x51e43e['body']['id']){delete _0x51e43e[_0x466f('0x5f')]['id'];}return db[_0x466f('0x43')][_0x466f('0x63')]({'where':{'id':_0x51e43e['params']['id']},'include':[{'model':db[_0x466f('0x68')],'as':_0x466f('0x41')}]})[_0x466f('0x3d')](handleEntityNotFound(_0x56467b,null))[_0x466f('0x3d')](saveUpdates(_0x51e43e[_0x466f('0x5f')],null))[_0x466f('0x3d')](respondWithResult(_0x56467b,null))[_0x466f('0x2b')](handleError(_0x56467b,null));};exports[_0x466f('0x3c')]=function(_0x257f0f,_0x2fab2e){return db['OpenchannelAccount'][_0x466f('0x63')]({'where':{'id':_0x257f0f[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x2fab2e,null))[_0x466f('0x3d')](removeEntity(_0x2fab2e,null))[_0x466f('0x2b')](handleError(_0x2fab2e,null));};exports[_0x466f('0x69')]=function(_0x5c535c,_0x2c9d90){return db[_0x466f('0x43')][_0x466f('0x69')]()['then'](respondWithResult(_0x2c9d90,null))[_0x466f('0x2b')](handleError(_0x2c9d90,null));};exports[_0x466f('0x6a')]=function(_0x3bf77b,_0x52046c,_0x3a6a62){if(_0x3bf77b[_0x466f('0x5f')]['id']){delete _0x3bf77b[_0x466f('0x5f')]['id'];}return db[_0x466f('0x43')]['find']({'where':{'id':_0x3bf77b[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x52046c,null))[_0x466f('0x3d')](function(_0x494180){if(_0x494180){_0x3bf77b[_0x466f('0x5f')][_0x466f('0x6b')]=_0x494180['id'];return db[_0x466f('0x6c')]['create'](_0x3bf77b[_0x466f('0x5f')]);}})[_0x466f('0x3d')](respondWithResult(_0x52046c,null))[_0x466f('0x2b')](handleError(_0x52046c,null));};exports[_0x466f('0x6d')]=function(_0x5163af,_0x39ca9e,_0xfef85c){var _0x52d761={'raw':![],'where':{}};var _0x5a2ee1={};var _0x2ccd3b={'count':0x0,'rows':[]};return db[_0x466f('0x43')]['findOne']({'where':{'id':_0x5163af[_0x466f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x39ca9e,null))[_0x466f('0x3d')](function(_0x3f57a9){if(_0x3f57a9){_0x5a2ee1[_0x466f('0x48')]=_[_0x466f('0x49')](db[_0x466f('0x6c')][_0x466f('0x44')]);_0x5a2ee1['query']=_[_0x466f('0x49')](_0x5163af[_0x466f('0x4b')]);_0x5a2ee1[_0x466f('0x54')]=_[_0x466f('0x4a')](_0x5a2ee1['model'],_0x5a2ee1[_0x466f('0x4b')]);_0x52d761[_0x466f('0x4c')]=_[_0x466f('0x4a')](_0x5a2ee1['model'],qs['fields'](_0x5163af[_0x466f('0x4b')][_0x466f('0x4d')]));_0x52d761[_0x466f('0x4c')]=_0x52d761[_0x466f('0x4c')][_0x466f('0x4e')]?_0x52d761[_0x466f('0x4c')]:_0x5a2ee1[_0x466f('0x48')];if(!_0x5163af[_0x466f('0x4b')][_0x466f('0x4f')](_0x466f('0x50'))){_0x52d761['limit']=qs[_0x466f('0x32')](_0x5163af[_0x466f('0x4b')][_0x466f('0x32')]);_0x52d761[_0x466f('0x30')]=qs[_0x466f('0x30')](_0x5163af[_0x466f('0x4b')][_0x466f('0x30')]);}_0x52d761[_0x466f('0x51')]=qs[_0x466f('0x52')](_0x5163af['query']['sort']);_0x52d761['where']=qs[_0x466f('0x54')](_[_0x466f('0x6e')](_0x5163af['query'],_0x5a2ee1[_0x466f('0x54')]));_0x52d761[_0x466f('0x53')][_0x466f('0x6b')]=_0x3f57a9['id'];if(_0x5163af[_0x466f('0x4b')][_0x466f('0x55')]){_0x52d761[_0x466f('0x53')]=_['merge'](_0x52d761[_0x466f('0x53')],{'$or':_[_0x466f('0x42')](_0x52d761[_0x466f('0x4c')],function(_0x5b8cbd){var _0x14f6bd={};_0x14f6bd[_0x5b8cbd]={'$like':'%'+_0x5163af[_0x466f('0x4b')][_0x466f('0x55')]+'%'};return _0x14f6bd;})});}_0x52d761=_['merge']({},_0x52d761,_0x5163af[_0x466f('0x58')]);return db[_0x466f('0x6c')][_0x466f('0x33')]({'where':_0x52d761['where']})[_0x466f('0x3d')](function(_0x4cad6e){_0x2ccd3b['count']=_0x4cad6e;if(_0x5163af[_0x466f('0x4b')][_0x466f('0x59')]){_0x52d761[_0x466f('0x5a')]=[{'all':!![]}];}return db[_0x466f('0x6c')]['findAll'](_0x52d761);})[_0x466f('0x3d')](function(_0x34fe4a){_0x2ccd3b[_0x466f('0x5c')]=_0x34fe4a;return _0x2ccd3b;});}})[_0x466f('0x3d')](respondWithFilteredResult(_0x39ca9e,_0x52d761))[_0x466f('0x2b')](handleError(_0x39ca9e,null));};exports[_0x466f('0x6f')]=function(_0x368046,_0x857939,_0x55cdb2){return db[_0x466f('0x43')]['find']({'where':{'id':_0x368046['params']['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x857939,null))[_0x466f('0x3d')](function(_0x3e96fe){if(_0x3e96fe){return _0x3e96fe['removeDispositions'](_0x368046[_0x466f('0x4b')][_0x466f('0x70')]);}})[_0x466f('0x3d')](respondWithStatusCode(_0x857939,null))['catch'](handleError(_0x857939,null));};exports[_0x466f('0x71')]=function(_0x330c48,_0x4346cb,_0x3be5b9){if(_0x330c48[_0x466f('0x5f')]['id']){delete _0x330c48['body']['id'];}return db[_0x466f('0x43')][_0x466f('0x63')]({'where':{'id':_0x330c48[_0x466f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4346cb,null))[_0x466f('0x3d')](function(_0x8de131){if(_0x8de131){_0x330c48[_0x466f('0x5f')][_0x466f('0x6b')]=_0x8de131['id'];return db[_0x466f('0x72')][_0x466f('0x5e')](_0x330c48[_0x466f('0x5f')]);}})[_0x466f('0x3d')](respondWithResult(_0x4346cb,null))[_0x466f('0x2b')](handleError(_0x4346cb,null));};exports[_0x466f('0x73')]=function(_0x1cc49e,_0x623a05,_0x706214){var _0x51ee9f={'raw':![],'where':{}};var _0x28e29d={};var _0x207169={'count':0x0,'rows':[]};return db[_0x466f('0x43')][_0x466f('0x74')]({'where':{'id':_0x1cc49e[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x623a05,null))[_0x466f('0x3d')](function(_0x244ebd){if(_0x244ebd){_0x28e29d[_0x466f('0x48')]=_[_0x466f('0x49')](db[_0x466f('0x72')][_0x466f('0x44')]);_0x28e29d[_0x466f('0x4b')]=_['keys'](_0x1cc49e['query']);_0x28e29d[_0x466f('0x54')]=_[_0x466f('0x4a')](_0x28e29d[_0x466f('0x48')],_0x28e29d[_0x466f('0x4b')]);_0x51ee9f[_0x466f('0x4c')]=_[_0x466f('0x4a')](_0x28e29d[_0x466f('0x48')],qs[_0x466f('0x4d')](_0x1cc49e['query'][_0x466f('0x4d')]));_0x51ee9f[_0x466f('0x4c')]=_0x51ee9f['attributes'][_0x466f('0x4e')]?_0x51ee9f[_0x466f('0x4c')]:_0x28e29d[_0x466f('0x48')];if(!_0x1cc49e[_0x466f('0x4b')]['hasOwnProperty'](_0x466f('0x50'))){_0x51ee9f[_0x466f('0x32')]=qs[_0x466f('0x32')](_0x1cc49e['query']['limit']);_0x51ee9f[_0x466f('0x30')]=qs[_0x466f('0x30')](_0x1cc49e['query'][_0x466f('0x30')]);}_0x51ee9f['order']=qs[_0x466f('0x52')](_0x1cc49e['query'][_0x466f('0x52')]);_0x51ee9f[_0x466f('0x53')]=qs['filters'](_['pick'](_0x1cc49e[_0x466f('0x4b')],_0x28e29d[_0x466f('0x54')]));_0x51ee9f[_0x466f('0x53')]['OpenchannelAccountId']=_0x244ebd['id'];if(_0x1cc49e['query'][_0x466f('0x55')]){_0x51ee9f['where']=_[_0x466f('0x56')](_0x51ee9f[_0x466f('0x53')],{'$or':_[_0x466f('0x42')](_0x51ee9f[_0x466f('0x4c')],function(_0x3ee16a){var _0x3cbc74={};_0x3cbc74[_0x3ee16a]={'$like':'%'+_0x1cc49e[_0x466f('0x4b')][_0x466f('0x55')]+'%'};return _0x3cbc74;})});}_0x51ee9f=_[_0x466f('0x56')]({},_0x51ee9f,_0x1cc49e[_0x466f('0x58')]);return db[_0x466f('0x72')][_0x466f('0x33')]({'where':_0x51ee9f[_0x466f('0x53')]})[_0x466f('0x3d')](function(_0xc123e6){_0x207169[_0x466f('0x33')]=_0xc123e6;if(_0x1cc49e[_0x466f('0x4b')][_0x466f('0x59')]){_0x51ee9f[_0x466f('0x5a')]=[{'all':!![]}];}return db['CannedAnswer'][_0x466f('0x5b')](_0x51ee9f);})[_0x466f('0x3d')](function(_0xd59c2e){_0x207169[_0x466f('0x5c')]=_0xd59c2e;return _0x207169;});}})[_0x466f('0x3d')](respondWithFilteredResult(_0x623a05,_0x51ee9f))[_0x466f('0x2b')](handleError(_0x623a05,null));};exports[_0x466f('0x75')]=function(_0x4cd33c,_0x2ac8c0,_0xdbb6ca){return db[_0x466f('0x43')][_0x466f('0x63')]({'where':{'id':_0x4cd33c[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x2ac8c0,null))[_0x466f('0x3d')](function(_0x9fc8b7){if(_0x9fc8b7){return _0x9fc8b7['removeAnswers'](_0x4cd33c[_0x466f('0x4b')][_0x466f('0x70')]);}})[_0x466f('0x3d')](respondWithStatusCode(_0x2ac8c0,null))[_0x466f('0x2b')](handleError(_0x2ac8c0,null));};exports[_0x466f('0x76')]=function(_0x15d0b3,_0x497d42,_0x2add12){var _0x1976ad={'body':_0x15d0b3[_0x466f('0x5f')],'channel':'openchannel'};var _0x51b849=[];var _0x39d13d=[];var _0x5453eb={};var _0x2ce472=![];return db[_0x466f('0x77')][_0x466f('0x69')]()['then'](function(_0x1ebd40){if(!_0x1ebd40){throw new db[(_0x466f('0x78'))][(_0x466f('0x79'))](_0x466f('0x7a'));}_0x51b849=_['difference'](_['keys'](_0x1ebd40),[_0x466f('0x7b'),_0x466f('0x7c')]);_0x39d13d=_['difference'](_[_0x466f('0x49')](_0x1ebd40),[_0x466f('0x7b'),'updatedAt','CompanyId',_0x466f('0x7d')]);if(_0x15d0b3[_0x466f('0x5f')]['id']){delete _0x15d0b3[_0x466f('0x5f')]['id'];}if(_['isNil'](_0x15d0b3['body'][_0x466f('0x7e')])){throw new db[(_0x466f('0x78'))][(_0x466f('0x79'))](_0x466f('0x7f'));}if(_[_0x466f('0x80')](_0x15d0b3[_0x466f('0x5f')][_0x466f('0x5f')])||_0x15d0b3[_0x466f('0x5f')]['body']===''){throw new db[(_0x466f('0x78'))][(_0x466f('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x466f('0x80')](_0x15d0b3['body'][_0x466f('0x81')])){throw new db[(_0x466f('0x78'))][(_0x466f('0x79'))](_0x466f('0x82')+_0x39d13d);}if(!_[_0x466f('0x83')](_0x39d13d,_0x15d0b3[_0x466f('0x5f')]['mapKey'])){throw new db[(_0x466f('0x78'))][(_0x466f('0x79'))](_0x466f('0x84')+_0x39d13d);}_0x5453eb[_0x15d0b3[_0x466f('0x5f')][_0x466f('0x81')]]=_0x15d0b3[_0x466f('0x5f')][_0x466f('0x7e')];})['then'](function(){return db[_0x466f('0x43')]['find']({'where':{'id':_0x15d0b3['params']['id']},'include':[{'model':db['CmList'],'as':_0x466f('0x85'),'include':[{'model':db[_0x466f('0x77')],'as':_0x466f('0x86'),'where':_0x5453eb,'limit':0x1,'order':[[_0x466f('0x7c'),_0x466f('0x87')]]}]},{'model':db[_0x466f('0x88')],'as':_0x466f('0x89')}]});})[_0x466f('0x3d')](handleEntityNotFound(_0x497d42,null))[_0x466f('0x3d')](function(_0xbb9532){if(_0xbb9532&&_0xbb9532[_0x466f('0x85')]){_0x1976ad[_0x466f('0x8a')]=_0xbb9532;_0x1976ad[_0x466f('0x8b')]=_0xbb9532[_0x466f('0x89')];_0x1976ad[_0x466f('0x8c')]=_0xbb9532[_0x466f('0x85')];_0x1976ad[_0x466f('0x8b')]=_['orderBy'](_0x1976ad[_0x466f('0x8b')],[_0x466f('0x8d')],[_0x466f('0x8e')]);if(_0x1976ad['account'][_0x466f('0x89')]){delete _0x1976ad['account']['Applications'];}if(_0x1976ad[_0x466f('0x8a')][_0x466f('0x85')]&&_0x1976ad['account'][_0x466f('0x85')]['Contacts'][_0x466f('0x4e')]){return _0x1976ad[_0x466f('0x8a')][_0x466f('0x85')][_0x466f('0x86')][0x0];}var _0x2f4523=_[_0x466f('0x1c')](_0x15d0b3['body'],{'firstName':_0x15d0b3[_0x466f('0x5f')][_0x466f('0x7e')],'ListId':_0xbb9532['ListId']});_0x2f4523[_0x15d0b3['body']['mapKey']]=_0x15d0b3[_0x466f('0x5f')][_0x466f('0x7e')];return db[_0x466f('0x77')][_0x466f('0x5e')](_0x2f4523,{'fields':_0x51b849,'raw':!![]});}})[_0x466f('0x3d')](handleEntityNotFound(_0x497d42,null))[_0x466f('0x3d')](function(_0x477b50){_0x1976ad[_0x466f('0x8f')]=_0x477b50;if(_0x477b50){var _0x276d5d={'ContactId':_0x477b50['id'],'OpenchannelAccountId':_0x15d0b3['params']['id'],'from':(_0x477b50[_0x466f('0x90')]||'')+'\x20'+(_0x477b50['lastName']||'')};var _0x5c4cb3={'OpenchannelAccountId':_0x15d0b3[_0x466f('0x5d')]['id'],'closed':![]};if(_0x15d0b3[_0x466f('0x5f')]['threadId']){_0x5c4cb3[_0x466f('0x91')]=_0x15d0b3[_0x466f('0x5f')][_0x466f('0x91')];return db['OpenchannelInteraction']['find']({'where':_0x5c4cb3})['then'](function(_0x26a593){if(_0x26a593){return[_0x26a593,![]];}_0x276d5d[_0x466f('0x91')]=_0x15d0b3[_0x466f('0x5f')][_0x466f('0x91')];_0x276d5d[_0x466f('0x92')]=_0x15d0b3[_0x466f('0x5f')][_0x466f('0x92')];return db[_0x466f('0x93')][_0x466f('0x5e')](_0x276d5d)['then'](function(_0xcc884c){return[_0xcc884c,!![]];});});}else{_0x5c4cb3[_0x466f('0x91')]=null;}_0x5c4cb3[_0x466f('0x94')]=_0x477b50['id'];return db[_0x466f('0x93')][_0x466f('0x63')]({'where':_0x5c4cb3})[_0x466f('0x3d')](function(_0x329868){if(_0x329868){return[_0x329868,![]];}return db[_0x466f('0x93')][_0x466f('0x5e')](_0x276d5d)[_0x466f('0x3d')](function(_0x2402ae){return[_0x2402ae,!![]];});});}})[_0x466f('0x95')](function(_0xb618d8,_0x523669){if(_0xb618d8){_0x2ce472=_0x523669;if(!_0x523669){var _0x1f0e61={'from':(_0x1976ad[_0x466f('0x8f')]['firstName']||'')+'\x20'+(_0x1976ad[_0x466f('0x8f')][_0x466f('0x96')]||'')};if(_0x15d0b3[_0x466f('0x5f')]['threadId']&&_0x15d0b3[_0x466f('0x5f')][_0x466f('0x97')]&&_0x15d0b3['body'][_0x466f('0x91')]!=_0x15d0b3['body'][_0x466f('0x97')]){_0x1f0e61[_0x466f('0x91')]=_0x15d0b3[_0x466f('0x5f')][_0x466f('0x97')];}return _0xb618d8[_0x466f('0x67')](_0x1f0e61);}else{return _0xb618d8;}}})[_0x466f('0x3d')](function(_0x5a4b1f){_0x1976ad['interaction']=_0x5a4b1f[_0x466f('0x39')]({'plain':!![]});_0x1976ad[_0x466f('0x98')][_0x466f('0x99')]=_0x2ce472;if(_0x1976ad['interaction'][_0x466f('0x99')]){if(_0x1976ad[_0x466f('0x8a')][_0x466f('0x9a')]){_0x1976ad[_0x466f('0x8b')]['push']({'id':0x0,'priority':_0x1976ad[_0x466f('0x8b')][_0x466f('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x466f('0x9b')});}}return db[_0x466f('0x9c')][_0x466f('0x5e')]({'body':_0x15d0b3[_0x466f('0x5f')]['body'],'OpenchannelAccountId':_0x15d0b3[_0x466f('0x5d')]['id'],'OpenchannelInteractionId':_0x5a4b1f['id'],'direction':'in','ContactId':_0x1976ad['contact']['id'],'AttachmentId':_0x15d0b3[_0x466f('0x5f')][_0x466f('0x9d')]});})[_0x466f('0x3d')](function(_0x16f82c){_0x1976ad[_0x466f('0x29')]=_0x16f82c;if(!_0x1976ad['interaction'][_0x466f('0x9e')])return;return db[_0x466f('0x9f')][_0x466f('0x63')]({'attributes':['id',_0x466f('0x3e')],'where':{'id':_0x1976ad[_0x466f('0x98')]['UserId']}});})[_0x466f('0x3d')](function(_0x22a996){if(_0x22a996){_0x1976ad[_0x466f('0x8b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x466f('0xa0'),'appdata':_0x22a996[_0x466f('0x3e')]+','+(_0x1976ad[_0x466f('0x8a')][_0x466f('0xa1')]||0xa),'interval':_0x466f('0x9b')});}if(!_0x1976ad[_0x466f('0x98')][_0x466f('0xa2')])return;return db[_0x466f('0xa3')][_0x466f('0x63')]({'attributes':['id','name'],'where':{'id':_0x1976ad['interaction'][_0x466f('0xa2')]}});})['then'](function(_0x4e3abe){if(_0x4e3abe){_0x1976ad[_0x466f('0x8b')][_0x466f('0xa4')]({'id':0x0,'priority':0x1,'app':_0x466f('0xa5'),'appdata':_0x4e3abe[_0x466f('0x3e')]+','+(_0x1976ad[_0x466f('0x8a')][_0x466f('0xa6')]||0x12c),'interval':_0x466f('0x9b')});}return respondWithRpcPromise('Start',_0x466f('0xa7'),_0x1976ad);})['then'](function(_0x3687f4){respondWithRpcPromise('EventManager',_0x466f('0xa8'),{'event':'notify','message':_0x3687f4},client9002);return _0x3687f4;})['then'](respondWithResult(_0x497d42,null))[_0x466f('0x2b')](handleError(_0x497d42,null));};exports[_0x466f('0xa9')]=function(_0x1b1403,_0x4f1b1d){var _0x341c70=_0x1b1403[_0x466f('0x5d')]['id'];var _0x276696=_0x1b1403[_0x466f('0x5f')];var _0x12a71d=0xc8;var _0x205efe=null;return db[_0x466f('0xaa')][_0x466f('0xab')]({'isolationLevel':db['sequelize']['Transaction'][_0x466f('0xac')][_0x466f('0xad')]},function(_0x2b788f){return db['OpenchannelAccount'][_0x466f('0x74')]({'where':{'id':_0x341c70},'transaction':_0x2b788f})[_0x466f('0x3d')](function(_0x116608){if(_0x116608){return db[_0x466f('0x88')][_0x466f('0x3c')]({'where':{'OpenchannelAccountId':_0x341c70},'transaction':_0x2b788f})[_0x466f('0x3d')](function(){var _0x1255e8=_[_0x466f('0x42')](_0x276696,function(_0x212c78){_0x212c78[_0x466f('0x6b')]=_0x341c70;return _0x212c78;});return db[_0x466f('0x88')]['bulkCreate'](_0x1255e8,{'transaction':_0x2b788f});});}else{_0x12a71d=0x194;_0x205efe=[];}});})[_0x466f('0x3d')](function(){if(_0x12a71d!==0x194){return db[_0x466f('0x88')][_0x466f('0xae')]({'where':{'OpenchannelAccountId':_0x341c70},'order':_0x466f('0x8d')})[_0x466f('0x3d')](function(_0x8db310){_0x205efe=_0x8db310;});}})[_0x466f('0x2b')](function(_0x3ddf5e){_0x12a71d=0x1f4;logger['error'](_0x3ddf5e[_0x466f('0xaf')]);if(_0x3ddf5e[_0x466f('0x3e')]){delete _0x3ddf5e[_0x466f('0x3e')];}_0x205efe=_0x3ddf5e;})[_0x466f('0xb0')](function(){if(_0x205efe===null){_0x4f1b1d[_0x466f('0x2c')](_0x12a71d);}else{if(_0x12a71d===0x1f4){_0x4f1b1d[_0x466f('0x2d')](_0x12a71d)['send'](_0x205efe);}else{_0x4f1b1d['status'](_0x12a71d)['json'](_0x205efe);}}});};exports[_0x466f('0xb1')]=function(_0x1965af,_0x2b1b8a,_0x44c203){var _0x2f421f={};var _0x4bc646={};var _0xd9a648;var _0x29cb1d;return db[_0x466f('0x43')]['findOne']({'where':{'id':_0x1965af[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x2b1b8a,null))[_0x466f('0x3d')](function(_0x1d8585){if(_0x1d8585){_0xd9a648=_0x1d8585;_0x4bc646[_0x466f('0x48')]=_[_0x466f('0x49')](db[_0x466f('0x88')][_0x466f('0x44')]);_0x4bc646[_0x466f('0x4b')]=_['keys'](_0x1965af[_0x466f('0x4b')]);_0x4bc646['filters']=_['intersection'](_0x4bc646[_0x466f('0x48')],_0x4bc646[_0x466f('0x4b')]);_0x2f421f[_0x466f('0x4c')]=_['intersection'](_0x4bc646[_0x466f('0x48')],qs['fields'](_0x1965af[_0x466f('0x4b')][_0x466f('0x4d')]));_0x2f421f[_0x466f('0x4c')]=_0x2f421f[_0x466f('0x4c')][_0x466f('0x4e')]?_0x2f421f['attributes']:_0x4bc646[_0x466f('0x48')];_0x2f421f['order']=qs[_0x466f('0x52')](_0x1965af[_0x466f('0x4b')][_0x466f('0x52')]);_0x2f421f['where']=qs['filters'](_[_0x466f('0x6e')](_0x1965af[_0x466f('0x4b')],_0x4bc646[_0x466f('0x54')]));if(_0x1965af['query'][_0x466f('0x55')]){_0x2f421f[_0x466f('0x53')]=_['merge'](_0x2f421f[_0x466f('0x53')],{'$or':_[_0x466f('0x42')](_0x2f421f[_0x466f('0x4c')],function(_0x363205){var _0x4cd97e={};_0x4cd97e[_0x363205]={'$like':'%'+_0x1965af[_0x466f('0x4b')][_0x466f('0x55')]+'%'};return _0x4cd97e;})});}_0x2f421f=_[_0x466f('0x56')]({},_0x2f421f,_0x1965af['options']);return _0xd9a648[_0x466f('0xb1')](_0x2f421f);}})[_0x466f('0x3d')](function(_0x15e737){if(_0x15e737){_0x29cb1d=_0x15e737[_0x466f('0x4e')];if(!_0x1965af[_0x466f('0x4b')]['hasOwnProperty'](_0x466f('0x50'))){_0x2f421f[_0x466f('0x32')]=qs[_0x466f('0x32')](_0x1965af[_0x466f('0x4b')][_0x466f('0x32')]);_0x2f421f[_0x466f('0x30')]=qs[_0x466f('0x30')](_0x1965af['query'][_0x466f('0x30')]);}return _0xd9a648['getApplications'](_0x2f421f);}})[_0x466f('0x3d')](function(_0x311f1b){if(_0x311f1b){return _0x311f1b?{'count':_0x29cb1d,'rows':_0x311f1b}:null;}})[_0x466f('0x3d')](respondWithResult(_0x2b1b8a,null))[_0x466f('0x2b')](handleError(_0x2b1b8a,null));};exports[_0x466f('0xb2')]=function(_0x31f01f,_0x543e89,_0x217e6d){var _0x3badf3={'raw':![],'where':{}};var _0x578bef={};var _0x1d31a4={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x31f01f[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x543e89,null))[_0x466f('0x3d')](function(_0x5d6a36){if(_0x5d6a36){_0x578bef[_0x466f('0x48')]=_[_0x466f('0x49')](db[_0x466f('0x93')][_0x466f('0x44')]);_0x578bef[_0x466f('0x4b')]=_[_0x466f('0x49')](_0x31f01f['query']);_0x578bef[_0x466f('0x54')]=_[_0x466f('0x4a')](_0x578bef[_0x466f('0x48')],_0x578bef['query']);_0x3badf3[_0x466f('0x4c')]=_['intersection'](_0x578bef['model'],qs[_0x466f('0x4d')](_0x31f01f[_0x466f('0x4b')]['fields']));_0x3badf3['attributes']=_0x3badf3[_0x466f('0x4c')][_0x466f('0x4e')]?_0x3badf3[_0x466f('0x4c')]:_0x578bef[_0x466f('0x48')];if(!_0x31f01f[_0x466f('0x4b')]['hasOwnProperty'](_0x466f('0x50'))){_0x3badf3['limit']=qs[_0x466f('0x32')](_0x31f01f[_0x466f('0x4b')][_0x466f('0x32')]);_0x3badf3['offset']=qs[_0x466f('0x30')](_0x31f01f['query'][_0x466f('0x30')]);}_0x3badf3[_0x466f('0x51')]=qs[_0x466f('0x52')](_0x31f01f[_0x466f('0x4b')][_0x466f('0x52')]);_0x3badf3[_0x466f('0x53')]=qs[_0x466f('0x54')](_[_0x466f('0x6e')](_0x31f01f[_0x466f('0x4b')],_0x578bef[_0x466f('0x54')]));_0x3badf3['where']['OpenchannelAccountId']=_0x5d6a36['id'];if(_0x31f01f[_0x466f('0x4b')][_0x466f('0x55')]){_0x3badf3['where']=_[_0x466f('0x56')](_0x3badf3[_0x466f('0x53')],{'$or':_['map'](_0x3badf3[_0x466f('0x4c')],function(_0x208fda){var _0x446e8f={};_0x446e8f[_0x208fda]={'$like':'%'+_0x31f01f['query'][_0x466f('0x55')]+'%'};return _0x446e8f;})});}_0x3badf3=_['merge']({},_0x3badf3,_0x31f01f['options']);return db[_0x466f('0x93')]['count']({'where':_0x3badf3[_0x466f('0x53')]})[_0x466f('0x3d')](function(_0x8bf2e1){_0x1d31a4['count']=_0x8bf2e1;if(_0x31f01f[_0x466f('0x4b')][_0x466f('0x59')]){_0x3badf3[_0x466f('0x5a')]=[{'model':db['CmContact'],'as':_0x466f('0xb3'),'required':![]},{'model':db[_0x466f('0x9f')],'as':_0x466f('0xb4'),'attributes':[_0x466f('0x3e'),'fullname','internal'],'required':![]},{'model':db[_0x466f('0xb5')],'as':'Tags','attributes':['id',_0x466f('0x3e'),_0x466f('0xb6')],'where':_0x31f01f[_0x466f('0x4b')]['tag']?{'id':_0x31f01f[_0x466f('0x4b')][_0x466f('0xb7')]}:undefined,'required':_0x31f01f[_0x466f('0x4b')][_0x466f('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x466f('0x5b')](_0x3badf3);})[_0x466f('0x3d')](function(_0x2ef4c1){_0x1d31a4[_0x466f('0x5c')]=_0x2ef4c1;return _0x1d31a4;});}})[_0x466f('0x3d')](respondWithFilteredResult(_0x543e89,_0x3badf3))['catch'](handleError(_0x543e89,null));};exports['addAgents']=function(_0x220c03,_0x39bbe1,_0x16bb79){return db['OpenchannelAccount']['find']({'where':{'id':_0x220c03['params']['id']}})['then'](handleEntityNotFound(_0x39bbe1,null))[_0x466f('0x3d')](function(_0x57ad44){if(_0x57ad44){return _0x57ad44[_0x466f('0xb8')](_0x220c03['body'][_0x466f('0x70')],_[_0x466f('0xb9')](_0x220c03['body'],[_0x466f('0x70'),'id'])||{})[_0x466f('0x95')](function(_0x5d8c30){for(var _0x523597=0x0;_0x523597<_0x220c03[_0x466f('0x5f')][_0x466f('0x70')][_0x466f('0x4e')];_0x523597+=0x1){socket[_0x466f('0xba')]('userOpenchannelAccount:save',{'UserId':Number(_0x220c03[_0x466f('0x5f')][_0x466f('0x70')][_0x523597]),'OpenchannelAccountId':Number(_0x220c03['params']['id'])});}return _0x5d8c30;});}})['then'](respondWithResult(_0x39bbe1,null))[_0x466f('0x2b')](handleError(_0x39bbe1,null));};exports[_0x466f('0xbb')]=function(_0x75ff14,_0x5d04f3,_0x40553f){return db['OpenchannelAccount'][_0x466f('0x63')]({'where':{'id':_0x75ff14[_0x466f('0x5d')]['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x5d04f3,null))[_0x466f('0x3d')](function(_0x5291c5){if(_0x5291c5){return _0x5291c5[_0x466f('0xbb')](_0x75ff14[_0x466f('0x4b')][_0x466f('0x70')])[_0x466f('0x3d')](function(){if(_[_0x466f('0xbc')](_0x75ff14[_0x466f('0x4b')][_0x466f('0x70')])){for(var _0x3a02a6=0x0;_0x3a02a6<_0x75ff14['query'][_0x466f('0x70')]['length'];_0x3a02a6+=0x1){socket[_0x466f('0xba')]('userOpenchannelAccount:remove',{'UserId':Number(_0x75ff14[_0x466f('0x4b')][_0x466f('0x70')][_0x3a02a6]),'OpenchannelAccountId':Number(_0x75ff14['params']['id'])});}}else{socket[_0x466f('0xba')](_0x466f('0xbd'),{'UserId':Number(_0x75ff14[_0x466f('0x4b')][_0x466f('0x70')]),'OpenchannelAccountId':Number(_0x75ff14[_0x466f('0x5d')]['id'])});}});}})[_0x466f('0x3d')](respondWithStatusCode(_0x5d04f3,null))['catch'](handleError(_0x5d04f3,null));};exports[_0x466f('0xbe')]=function(_0x7c7249,_0xe88b4c,_0x584106){var _0x58611a={};var _0x45b45f={};var _0x32c841;var _0x668382;return db[_0x466f('0x43')][_0x466f('0x74')]({'where':{'id':_0x7c7249['params']['id']}})['then'](handleEntityNotFound(_0xe88b4c,null))[_0x466f('0x3d')](function(_0x24f49a){if(_0x24f49a){_0x32c841=_0x24f49a;_0x45b45f['model']=_['keys'](db['User'][_0x466f('0x44')]);_0x45b45f['query']=_['keys'](_0x7c7249[_0x466f('0x4b')]);_0x45b45f[_0x466f('0x54')]=_['intersection'](_0x45b45f['model'],_0x45b45f[_0x466f('0x4b')]);_0x58611a[_0x466f('0x4c')]=_[_0x466f('0x4a')](_0x45b45f['model'],qs['fields'](_0x7c7249['query']['fields']));_0x58611a[_0x466f('0x4c')]=_0x58611a['attributes'][_0x466f('0x4e')]?_0x58611a[_0x466f('0x4c')]:_0x45b45f[_0x466f('0x48')];_0x58611a[_0x466f('0x51')]=qs[_0x466f('0x52')](_0x7c7249[_0x466f('0x4b')]['sort']);_0x58611a['where']=qs[_0x466f('0x54')](_[_0x466f('0x6e')](_0x7c7249[_0x466f('0x4b')],_0x45b45f[_0x466f('0x54')]));if(_0x7c7249[_0x466f('0x4b')]['filter']){_0x58611a[_0x466f('0x53')]=_[_0x466f('0x56')](_0x58611a[_0x466f('0x53')],{'$or':_[_0x466f('0x42')](_0x58611a[_0x466f('0x4c')],function(_0x4c0262){var _0x309194={};_0x309194[_0x4c0262]={'$like':'%'+_0x7c7249[_0x466f('0x4b')][_0x466f('0x55')]+'%'};return _0x309194;})});}_0x58611a=_[_0x466f('0x56')]({},_0x58611a,_0x7c7249[_0x466f('0x58')]);return _0x32c841[_0x466f('0xbe')](_0x58611a);}})[_0x466f('0x3d')](function(_0x4dcf1f){if(_0x4dcf1f){_0x668382=_0x4dcf1f['length'];if(!_0x7c7249[_0x466f('0x4b')][_0x466f('0x4f')](_0x466f('0x50'))){_0x58611a['limit']=qs[_0x466f('0x32')](_0x7c7249[_0x466f('0x4b')][_0x466f('0x32')]);_0x58611a[_0x466f('0x30')]=qs[_0x466f('0x30')](_0x7c7249[_0x466f('0x4b')][_0x466f('0x30')]);}return _0x32c841[_0x466f('0xbe')](_0x58611a);}})[_0x466f('0x3d')](function(_0x24d39a){if(_0x24d39a){return _0x24d39a?{'count':_0x668382,'rows':_0x24d39a}:null;}})[_0x466f('0x3d')](respondWithResult(_0xe88b4c,null))[_0x466f('0x2b')](handleError(_0xe88b4c,null));};exports[_0x466f('0x3f')]=function(_0x33555f,_0x482370,_0x2be19f){var _0x3abaed,_0x5f578c,_0x4ded30;if(_['isNil'](_0x33555f['body'][_0x466f('0x5f')])||_0x33555f[_0x466f('0x5f')][_0x466f('0x5f')]===''){throw new db[(_0x466f('0x78'))][(_0x466f('0x79'))](_0x466f('0xbf'));}if(_[_0x466f('0x80')](_0x33555f[_0x466f('0x5f')]['to'])){}_0x3abaed=_0x33555f['body']['to'];return db[_0x466f('0x43')][_0x466f('0x74')]({'where':{'id':_0x33555f['params']['id']}})[_0x466f('0x3d')](handleEntityNotFound(_0x482370,null))[_0x466f('0x3d')](function(_0x135072){if(_0x135072){return db[_0x466f('0x43')][_0x466f('0x63')]({'where':{'id':_0x135072['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x466f('0x86'),'where':{[_0x135072[_0x466f('0x81')]]:_0x3abaed},'limit':0x1,'order':[[_0x466f('0x7c'),'DESC']]}]}]})[_0x466f('0x3d')](handleEntityNotFound(_0x482370,null))[_0x466f('0x3d')](function(_0x5f42de){if(_0x5f42de&&_0x5f42de['List']){_0x5f578c=_0x5f42de[_0x466f('0x39')]({'plain':!![]});if(_0x5f578c[_0x466f('0x85')]&&_0x5f578c[_0x466f('0x85')][_0x466f('0x86')][_0x466f('0x4e')]){return _0x5f578c[_0x466f('0x85')]['Contacts'][0x0];}return db['CmContact'][_0x466f('0x5e')](_['defaults'](_0x33555f['body'],{'firstName':_0x3abaed,[_0x5f42de[_0x466f('0x81')]]:_0x3abaed,'phone':_0x3abaed,'ListId':_0x5f578c[_0x466f('0x7d')]}));}})['then'](handleEntityNotFound(_0x482370,null))[_0x466f('0x3d')](function(_0x1e6d3a){if(_0x1e6d3a){_0x4ded30=_0x1e6d3a;return db[_0x466f('0x93')][_0x466f('0x63')]({'where':{'ContactId':_0x4ded30['id'],'closed':![],'OpenchannelAccountId':_0x5f578c['id']}})[_0x466f('0x3d')](function(_0x3fcaa5){if(_0x3fcaa5){return[_0x3fcaa5,![]];}return db[_0x466f('0x93')][_0x466f('0x5e')]({'UserId':_0x33555f['user']['id'],'ContactId':_0x4ded30['id'],'OpenchannelAccountId':_0x5f578c['id'],'lastMsgDirection':_0x466f('0xc0'),'firstMsgDirection':_0x466f('0xc0'),'Messages':[_[_0x466f('0x56')](_0x33555f[_0x466f('0x5f')],{'read':![],'body':_0x33555f[_0x466f('0x5f')][_0x466f('0x5f')],'OpenchannelAccountId':_0x5f578c['id'],'UserId':_0x33555f[_0x466f('0x60')]['id'],'ContactId':_0x4ded30['id']})]},{'include':[{'model':db[_0x466f('0x9c')],'as':_0x466f('0xc1')}]})[_0x466f('0x3d')](function(_0x3cd85f){return[_0x3cd85f,!![]];});});}})[_0x466f('0x95')](function(_0x38b966,_0x3d8a98){if(_0x3d8a98){return _0x38b966;}return db[_0x466f('0x9c')][_0x466f('0x5e')](_[_0x466f('0x56')](_0x33555f[_0x466f('0x5f')],{'read':![],'body':_0x33555f[_0x466f('0x5f')]['body'],'OpenchannelAccountId':_0x5f578c['id'],'OpenchannelInteractionId':_0x38b966['id'],'UserId':_0x33555f[_0x466f('0x60')]['id'],'ContactId':_0x4ded30['id']}))[_0x466f('0x3d')](function(_0x518d60){_0x38b966[_0x466f('0xc2')][_0x466f('0xc1')]=[];_0x38b966[_0x466f('0xc2')][_0x466f('0xc1')][_0x466f('0xc3')](_0x518d60[_0x466f('0xc2')]);return _0x38b966;});});}})[_0x466f('0x3d')](respondWithResult(_0x482370,null))[_0x466f('0x2b')](handleError(_0x482370,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index cd3db80..8f5fd2c 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 _0x1339=['update','remove','emit','hasOwnProperty','exports','OpenchannelAccount','setMaxListeners','save'];(function(_0x1b9a4e,_0x2cf115){var _0x28a12b=function(_0x423000){while(--_0x423000){_0x1b9a4e['push'](_0x1b9a4e['shift']());}};_0x28a12b(++_0x2cf115);}(_0x1339,0x1ed));var _0x9133=function(_0x440638,_0x40be73){_0x440638=_0x440638-0x0;var _0x1db66d=_0x1339[_0x440638];return _0x1db66d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x9133('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x9133('0x1')](0x0);var events={'afterCreate':_0x9133('0x2'),'afterUpdate':_0x9133('0x3'),'afterDestroy':_0x9133('0x4')};function emitEvent(_0x192d48){return function(_0x176e80,_0x110c51,_0x558345){OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48+':'+_0x176e80['id'],_0x176e80);OpenchannelAccountEvents[_0x9133('0x5')](_0x192d48,_0x176e80);_0x558345(null);};}for(var e in events){if(events[_0x9133('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x9133('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x13f6=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x26f1bc,_0x263067){var _0x30e19c=function(_0x20d4c7){while(--_0x20d4c7){_0x26f1bc['push'](_0x26f1bc['shift']());}};_0x30e19c(++_0x263067);}(_0x13f6,0x124));var _0x613f=function(_0x21488b,_0x1188ef){_0x21488b=_0x21488b-0x0;var _0x4378ee=_0x13f6[_0x21488b];return _0x4378ee;};'use strict';var EventEmitter=require(_0x613f('0x0'));var OpenchannelAccount=require(_0x613f('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x613f('0x2'),'afterUpdate':_0x613f('0x3'),'afterDestroy':_0x613f('0x4')};function emitEvent(_0x5414ff){return function(_0x179f6e,_0x1e01e3,_0x20af2f){OpenchannelAccountEvents['emit'](_0x5414ff+':'+_0x179f6e['id'],_0x179f6e);OpenchannelAccountEvents[_0x613f('0x5')](_0x5414ff,_0x179f6e);_0x20af2f(null);};}for(var e in events){if(events[_0x613f('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index df71750..ec76e1a 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(_0x95ad38,_0x58dabd){var _0x55e297=function(_0x188682){while(--_0x188682){_0x95ad38['push'](_0x95ad38['shift']());}};_0x55e297(++_0x58dabd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x5cd45e,_0x5c5f28){var _0x45ba2f=function(_0x469566){while(--_0x469566){_0x5cd45e['push'](_0x5cd45e['shift']());}};_0x45ba2f(++_0x5c5f28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 c51d877..e3a9d36 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 _0x235a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x235a,0x1ef));var _0xa235=function(_0x4058c8,_0x1ddb02){_0x4058c8=_0x4058c8-0x0;var _0x3f51e8=_0x235a[_0x4058c8];return _0x3f51e8;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});config['redis']=_[_0xa235('0xc')](config[_0xa235('0xd')],{'host':_0xa235('0xe'),'port':0x18eb});var socket=require(_0xa235('0xf'))(new Redis(config['redis']));require(_0xa235('0x10'))['register'](socket);function respondWithRpcPromise(_0x560eb1,_0x10bb4f,_0x504b60){return new BPromise(function(_0xbde1c7,_0x535bb9){return client['request'](_0x560eb1,_0x504b60)['then'](function(_0x464a85){logger[_0xa235('0x11')](_0xa235('0x12'),_0x10bb4f,_0xa235('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x10bb4f,'request\x20sent',JSON[_0xa235('0x14')](_0x464a85));if(_0x464a85[_0xa235('0x15')]){if(_0x464a85[_0xa235('0x15')][_0xa235('0x16')]===0x1f4){logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);return _0x535bb9(_0x464a85[_0xa235('0x15')]['message']);}logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);return _0xbde1c7(_0x464a85[_0xa235('0x15')][_0xa235('0x17')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x10bb4f,_0xa235('0x13'));_0xbde1c7(_0x464a85[_0xa235('0x18')][_0xa235('0x17')]);}})['catch'](function(_0x40b4a9){logger[_0xa235('0x15')](_0xa235('0x12'),_0x10bb4f,_0x40b4a9);_0x535bb9(_0x40b4a9);});});} \ No newline at end of file +var _0x1339=['OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x1339,0x1ed));var _0x9133=function(_0x4d978d,_0x425a5a){_0x4d978d=_0x4d978d-0x0;var _0x4efb21=_0x1339[_0x4d978d];return _0x4efb21;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});config['redis']=_[_0x9133('0xb')](config[_0x9133('0xc')],{'host':_0x9133('0xd'),'port':0x18eb});var socket=require(_0x9133('0xe'))(new Redis(config[_0x9133('0xc')]));require(_0x9133('0xf'))[_0x9133('0x10')](socket);function respondWithRpcPromise(_0x245134,_0x10a9e4,_0xd588c){return new BPromise(function(_0x4c4517,_0x3f9650){return client[_0x9133('0x11')](_0x245134,_0xd588c)[_0x9133('0x12')](function(_0x452481){logger[_0x9133('0x13')](_0x9133('0x14'),_0x10a9e4,'request\x20sent');logger[_0x9133('0x15')](_0x9133('0x16'),_0x10a9e4,'request\x20sent',JSON['stringify'](_0x452481));if(_0x452481[_0x9133('0x17')]){if(_0x452481['error'][_0x9133('0x18')]===0x1f4){logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481[_0x9133('0x17')][_0x9133('0x19')]);return _0x3f9650(_0x452481[_0x9133('0x17')]['message']);}logger[_0x9133('0x17')](_0x9133('0x14'),_0x10a9e4,_0x452481['error'][_0x9133('0x19')]);return _0x4c4517(_0x452481[_0x9133('0x17')][_0x9133('0x19')]);}else{logger[_0x9133('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x9133('0x1a'));_0x4c4517(_0x452481['result'][_0x9133('0x19')]);}})['catch'](function(_0x115ee8){logger[_0x9133('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x10a9e4,_0x115ee8);_0x3f9650(_0x115ee8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 93b60e0..eb6f601 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 _0x41bb=['save','update','emit','removeListener','register','./openchannelAccount.events'];(function(_0x5d316a,_0x54ab38){var _0x1e4d22=function(_0x1a166b){while(--_0x1a166b){_0x5d316a['push'](_0x5d316a['shift']());}};_0x1e4d22(++_0x54ab38);}(_0x41bb,0xc5));var _0xb41b=function(_0x3dc68b,_0xb1f4ac){_0x3dc68b=_0x3dc68b-0x0;var _0x2d00bb=_0x41bb[_0x3dc68b];return _0x2d00bb;};'use strict';var OpenchannelAccountEvents=require(_0xb41b('0x0'));var events=[_0xb41b('0x1'),'remove',_0xb41b('0x2')];function createListener(_0x4d5578,_0x30ea75){return function(_0x1c9d36){_0x30ea75[_0xb41b('0x3')](_0x4d5578,_0x1c9d36);};}function removeListener(_0x448c8e,_0x4ee21b){return function(){OpenchannelAccountEvents[_0xb41b('0x4')](_0x448c8e,_0x4ee21b);};}exports[_0xb41b('0x5')]=function(_0x2dbaa3){for(var _0x50bc62=0x0,_0x5455ce=events['length'];_0x50bc62<_0x5455ce;_0x50bc62++){var _0x2704f0=events[_0x50bc62];var _0x29c30d=createListener('openchannelAccount:'+_0x2704f0,_0x2dbaa3);OpenchannelAccountEvents['on'](_0x2704f0,_0x29c30d);}}; \ No newline at end of file +var _0x55e0=['emit','removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','update'];(function(_0x57a5e5,_0x18b0d6){var _0x354012=function(_0x34d87b){while(--_0x34d87b){_0x57a5e5['push'](_0x57a5e5['shift']());}};_0x354012(++_0x18b0d6);}(_0x55e0,0xdc));var _0x055e=function(_0x14dcc9,_0x19ac97){_0x14dcc9=_0x14dcc9-0x0;var _0x410bed=_0x55e0[_0x14dcc9];return _0x410bed;};'use strict';var OpenchannelAccountEvents=require(_0x055e('0x0'));var events=[_0x055e('0x1'),_0x055e('0x2'),_0x055e('0x3')];function createListener(_0x5b82b9,_0x578882){return function(_0x3a2ee6){_0x578882[_0x055e('0x4')](_0x5b82b9,_0x3a2ee6);};}function removeListener(_0x33cd7b,_0x2773e4){return function(){OpenchannelAccountEvents[_0x055e('0x5')](_0x33cd7b,_0x2773e4);};}exports[_0x055e('0x6')]=function(_0x490ee1){for(var _0x5239f6=0x0,_0x4384ff=events['length'];_0x5239f6<_0x4384ff;_0x5239f6++){var _0x8e7824=events[_0x5239f6];var _0x3c4cf=createListener(_0x055e('0x7')+_0x8e7824,_0x490ee1);OpenchannelAccountEvents['on'](_0x8e7824,_0x3c4cf);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index ea5bc28..96cd066 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 _0x0977=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x32e649,_0x228649){var _0x14d386=function(_0x3fb3ed){while(--_0x3fb3ed){_0x32e649['push'](_0x32e649['shift']());}};_0x14d386(++_0x228649);}(_0x0977,0x193));var _0x7097=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0977[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x7097('0x0'));var util=require(_0x7097('0x1'));var path=require(_0x7097('0x2'));var timeout=require(_0x7097('0x3'));var express=require('express');var router=express[_0x7097('0x4')]();var fs_extra=require(_0x7097('0x5'));var auth=require(_0x7097('0x6'));var interaction=require(_0x7097('0x7'));var config=require('../../config/environment');var controller=require(_0x7097('0x8'));router[_0x7097('0x9')]('/',auth[_0x7097('0xa')](),controller[_0x7097('0xb')]);router[_0x7097('0x9')](_0x7097('0xc'),auth['isAuthenticated'](),controller[_0x7097('0xd')]);router[_0x7097('0xe')]('/',auth[_0x7097('0xa')](),controller['create']);router['put'](_0x7097('0xc'),auth['isAuthenticated'](),controller[_0x7097('0xf')]);router[_0x7097('0x10')](_0x7097('0xc'),auth[_0x7097('0xa')](),controller[_0x7097('0x11')]);module[_0x7097('0x12')]=router; \ No newline at end of file +var _0x1039=['show','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x11f793,_0x581546){var _0x59b2db=function(_0x356b97){while(--_0x356b97){_0x11f793['push'](_0x11f793['shift']());}};_0x59b2db(++_0x581546);}(_0x1039,0xea));var _0x9103=function(_0x256dcd,_0x4345b9){_0x256dcd=_0x256dcd-0x0;var _0x1977de=_0x1039[_0x256dcd];return _0x1977de;};'use strict';var multer=require(_0x9103('0x0'));var util=require(_0x9103('0x1'));var path=require(_0x9103('0x2'));var timeout=require(_0x9103('0x3'));var express=require(_0x9103('0x4'));var router=express['Router']();var fs_extra=require(_0x9103('0x5'));var auth=require(_0x9103('0x6'));var interaction=require(_0x9103('0x7'));var config=require(_0x9103('0x8'));var controller=require(_0x9103('0x9'));router[_0x9103('0xa')]('/',auth[_0x9103('0xb')](),controller[_0x9103('0xc')]);router[_0x9103('0xa')]('/:id',auth[_0x9103('0xb')](),controller[_0x9103('0xd')]);router['post']('/',auth[_0x9103('0xb')](),controller[_0x9103('0xe')]);router['put'](_0x9103('0xf'),auth[_0x9103('0xb')](),controller[_0x9103('0x10')]);router[_0x9103('0x11')](_0x9103('0xf'),auth[_0x9103('0xb')](),controller['destroy']);module[_0x9103('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 06f38c1..4a36361 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 _0xf237=['TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x11b296,_0x52e35c){var _0x388461=function(_0x3f43e6){while(--_0x3f43e6){_0x11b296['push'](_0x11b296['shift']());}};_0x388461(++_0x52e35c);}(_0xf237,0x1c6));var _0x7f23=function(_0x49c55d,_0x756a7d){_0x49c55d=_0x49c55d-0x0;var _0x2349d5=_0xf237[_0x49c55d];return _0x2349d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7f23('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7f23('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7f23('0x2')]()},'description':{'type':Sequelize[_0x7f23('0x1')]},'interval':{'type':Sequelize[_0x7f23('0x1')],'defaultValue':_0x7f23('0x3')}}; \ No newline at end of file +var _0x38cc=['noop','TEXT','*,*,*,*','INTEGER','STRING'];(function(_0x123cee,_0x3403db){var _0x272716=function(_0x3a6c19){while(--_0x3a6c19){_0x123cee['push'](_0x123cee['shift']());}};_0x272716(++_0x3403db);}(_0x38cc,0x170));var _0xc38c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x38cc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xc38c('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xc38c('0x1')],'allowNull':![],'defaultValue':_0xc38c('0x2')},'appdata':{'type':Sequelize[_0xc38c('0x3')]()},'description':{'type':Sequelize[_0xc38c('0x1')]},'interval':{'type':Sequelize[_0xc38c('0x1')],'defaultValue':_0xc38c('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index bc455ea..8ac6370 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 _0x732d=['includeAll','findAll','rows','show','create','catch','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options'];(function(_0x1749be,_0xea882c){var _0x201d41=function(_0x30da6a){while(--_0x30da6a){_0x1749be['push'](_0x1749be['shift']());}};_0x201d41(++_0xea882c);}(_0x732d,0x131));var _0xd732=function(_0x30b660,_0x18454a){_0x30b660=_0x30b660-0x0;var _0x33453f=_0x732d[_0x30b660];return _0x33453f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd732('0x0'));var zipdir=require(_0xd732('0x1'));var jsonpatch=require(_0xd732('0x2'));var rp=require(_0xd732('0x3'));var moment=require(_0xd732('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd732('0x5'));var util=require(_0xd732('0x6'));var path=require(_0xd732('0x7'));var sox=require(_0xd732('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd732('0x9'));var _=require(_0xd732('0xa'));var squel=require(_0xd732('0xb'));var crypto=require(_0xd732('0xc'));var jsforce=require(_0xd732('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd732('0xe'));var querystring=require(_0xd732('0xf'));var Papa=require('papaparse');var Redis=require(_0xd732('0x10'));var authService=require(_0xd732('0x11'));var qs=require(_0xd732('0x12'));var as=require(_0xd732('0x13'));var hardwareService=require(_0xd732('0x14'));var logger=require(_0xd732('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd732('0x16'));var licenseUtil=require(_0xd732('0x17'));var db=require(_0xd732('0x18'))['db'];function respondWithStatusCode(_0x29a134,_0xcac0ee){_0xcac0ee=_0xcac0ee||0xcc;return function(_0x3ba68b){if(_0x3ba68b){return _0x29a134[_0xd732('0x19')](_0xcac0ee);}return _0x29a134[_0xd732('0x1a')](_0xcac0ee)[_0xd732('0x1b')]();};}function respondWithResult(_0x5e28bf,_0x503092){_0x503092=_0x503092||0xc8;return function(_0x3b3dc3){if(_0x3b3dc3){return _0x5e28bf[_0xd732('0x1a')](_0x503092)[_0xd732('0x1c')](_0x3b3dc3);}};}function respondWithFilteredResult(_0x350783,_0x31e114){return function(_0x31561a){if(_0x31561a){var _0x4a0428=typeof _0x31e114['offset']===_0xd732('0x1d')&&typeof _0x31e114[_0xd732('0x1e')]===_0xd732('0x1d');var _0x5d4330=_0x31561a[_0xd732('0x1f')];var _0x4daa40=_0x4a0428?0x0:_0x31e114[_0xd732('0x20')];var _0x3f8cc4=_0x4a0428?_0x31561a['count']:_0x31e114['offset']+_0x31e114[_0xd732('0x1e')];var _0x366cd7;if(_0x3f8cc4>=_0x5d4330){_0x3f8cc4=_0x5d4330;_0x366cd7=0xc8;}else{_0x366cd7=0xce;}_0x350783['status'](_0x366cd7);return _0x350783[_0xd732('0x21')](_0xd732('0x22'),_0x4daa40+'-'+_0x3f8cc4+'/'+_0x5d4330)[_0xd732('0x1c')](_0x31561a);}return null;};}function patchUpdates(_0x4c297c){return function(_0x226319){try{jsonpatch[_0xd732('0x23')](_0x226319,_0x4c297c,!![]);}catch(_0x496133){return BPromise[_0xd732('0x24')](_0x496133);}return _0x226319['save']();};}function saveUpdates(_0x34cfe8,_0xb7a677){return function(_0xed559f){if(_0xed559f){return _0xed559f[_0xd732('0x25')](_0x34cfe8)[_0xd732('0x26')](function(_0x53e858){return _0x53e858;});}return null;};}function removeEntity(_0x2dc876,_0x1916c1){return function(_0x4b51a3){if(_0x4b51a3){return _0x4b51a3[_0xd732('0x27')]()['then'](function(){_0x2dc876[_0xd732('0x1a')](0xcc)[_0xd732('0x1b')]();});}};}function handleEntityNotFound(_0x4b4c04,_0x5a45a9){return function(_0x20df01){if(!_0x20df01){_0x4b4c04[_0xd732('0x19')](0x194);}return _0x20df01;};}function handleError(_0x146b14,_0x4905c3){_0x4905c3=_0x4905c3||0x1f4;return function(_0x48251d){logger['error'](_0x48251d[_0xd732('0x28')]);if(_0x48251d['name']){delete _0x48251d['name'];}_0x146b14[_0xd732('0x1a')](_0x4905c3)['send'](_0x48251d);};}exports[_0xd732('0x29')]=function(_0x27d1dd,_0x22422a){var _0x548a6e={},_0x59e86d={},_0x5e8eaa={'count':0x0,'rows':[]};var _0x1899df=_[_0xd732('0x2a')](db[_0xd732('0x2b')][_0xd732('0x2c')],function(_0x22f9fa){return{'name':_0x22f9fa[_0xd732('0x2d')],'type':_0x22f9fa[_0xd732('0x2e')][_0xd732('0x2f')]};});_0x59e86d[_0xd732('0x30')]=_[_0xd732('0x2a')](_0x1899df,_0xd732('0x31'));_0x59e86d['query']=_[_0xd732('0x32')](_0x27d1dd[_0xd732('0x33')]);_0x59e86d[_0xd732('0x34')]=_['intersection'](_0x59e86d[_0xd732('0x30')],_0x59e86d[_0xd732('0x33')]);_0x548a6e['attributes']=_[_0xd732('0x35')](_0x59e86d[_0xd732('0x30')],qs[_0xd732('0x36')](_0x27d1dd['query']['fields']));_0x548a6e[_0xd732('0x37')]=_0x548a6e[_0xd732('0x37')][_0xd732('0x38')]?_0x548a6e[_0xd732('0x37')]:_0x59e86d[_0xd732('0x30')];if(!_0x27d1dd[_0xd732('0x33')][_0xd732('0x39')]('nolimit')){_0x548a6e[_0xd732('0x1e')]=qs[_0xd732('0x1e')](_0x27d1dd[_0xd732('0x33')][_0xd732('0x1e')]);_0x548a6e[_0xd732('0x20')]=qs[_0xd732('0x20')](_0x27d1dd[_0xd732('0x33')][_0xd732('0x20')]);}_0x548a6e[_0xd732('0x3a')]=qs[_0xd732('0x3b')](_0x27d1dd[_0xd732('0x33')][_0xd732('0x3b')]);_0x548a6e[_0xd732('0x3c')]=qs['filters'](_[_0xd732('0x3d')](_0x27d1dd[_0xd732('0x33')],_0x59e86d[_0xd732('0x34')]),_0x1899df);if(_0x27d1dd['query'][_0xd732('0x3e')]){_0x548a6e[_0xd732('0x3c')]=_['merge'](_0x548a6e['where'],{'$or':_[_0xd732('0x2a')](_0x1899df,function(_0x2c74bb){if(_0x2c74bb['type']!=='VIRTUAL'){var _0xcaaa19={};_0xcaaa19[_0x2c74bb[_0xd732('0x31')]]={'$like':'%'+_0x27d1dd[_0xd732('0x33')][_0xd732('0x3e')]+'%'};return _0xcaaa19;}})});}_0x548a6e=_[_0xd732('0x3f')]({},_0x548a6e,_0x27d1dd[_0xd732('0x40')]);var _0x3351da={'where':_0x548a6e['where']};return db[_0xd732('0x2b')][_0xd732('0x1f')](_0x3351da)[_0xd732('0x26')](function(_0xca4b3c){_0x5e8eaa[_0xd732('0x1f')]=_0xca4b3c;if(_0x27d1dd[_0xd732('0x33')][_0xd732('0x41')]){_0x548a6e['include']=[{'all':!![]}];}return db[_0xd732('0x2b')][_0xd732('0x42')](_0x548a6e);})[_0xd732('0x26')](function(_0x39ace7){_0x5e8eaa[_0xd732('0x43')]=_0x39ace7;return _0x5e8eaa;})[_0xd732('0x26')](respondWithFilteredResult(_0x22422a,_0x548a6e))['catch'](handleError(_0x22422a,null));};exports[_0xd732('0x44')]=function(_0x2ed244,_0x303ab2){var _0x5e30dc={'raw':!![],'where':{'id':_0x2ed244['params']['id']}},_0xcd7ee5={};_0xcd7ee5[_0xd732('0x30')]=_['keys'](db[_0xd732('0x2b')][_0xd732('0x2c')]);_0xcd7ee5[_0xd732('0x33')]=_[_0xd732('0x32')](_0x2ed244[_0xd732('0x33')]);_0xcd7ee5[_0xd732('0x34')]=_[_0xd732('0x35')](_0xcd7ee5[_0xd732('0x30')],_0xcd7ee5['query']);_0x5e30dc[_0xd732('0x37')]=_[_0xd732('0x35')](_0xcd7ee5[_0xd732('0x30')],qs[_0xd732('0x36')](_0x2ed244['query'][_0xd732('0x36')]));_0x5e30dc[_0xd732('0x37')]=_0x5e30dc[_0xd732('0x37')][_0xd732('0x38')]?_0x5e30dc[_0xd732('0x37')]:_0xcd7ee5[_0xd732('0x30')];if(_0x2ed244[_0xd732('0x33')][_0xd732('0x41')]){_0x5e30dc['include']=[{'all':!![]}];}_0x5e30dc=_['merge']({},_0x5e30dc,_0x2ed244[_0xd732('0x40')]);return db[_0xd732('0x2b')]['find'](_0x5e30dc)[_0xd732('0x26')](handleEntityNotFound(_0x303ab2,null))['then'](respondWithResult(_0x303ab2,null))['catch'](handleError(_0x303ab2,null));};exports[_0xd732('0x45')]=function(_0x5460b1,_0x20fcfd){return db[_0xd732('0x2b')]['create'](_0x5460b1['body'],{})['then'](respondWithResult(_0x20fcfd,0xc9))[_0xd732('0x46')](handleError(_0x20fcfd,null));};exports[_0xd732('0x25')]=function(_0x41f584,_0x3c0488){if(_0x41f584[_0xd732('0x47')]['id']){delete _0x41f584[_0xd732('0x47')]['id'];}return db[_0xd732('0x2b')][_0xd732('0x48')]({'where':{'id':_0x41f584[_0xd732('0x49')]['id']}})[_0xd732('0x26')](handleEntityNotFound(_0x3c0488,null))[_0xd732('0x26')](saveUpdates(_0x41f584[_0xd732('0x47')],null))[_0xd732('0x26')](respondWithResult(_0x3c0488,null))[_0xd732('0x46')](handleError(_0x3c0488,null));};exports[_0xd732('0x27')]=function(_0x2076c0,_0x599123){return db[_0xd732('0x2b')][_0xd732('0x48')]({'where':{'id':_0x2076c0[_0xd732('0x49')]['id']}})[_0xd732('0x26')](handleEntityNotFound(_0x599123,null))[_0xd732('0x26')](removeEntity(_0x599123,null))[_0xd732('0x46')](handleError(_0x599123,null));}; \ No newline at end of file +var _0x4593=['json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','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','../../mysqldb','sendStatus','status'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x4593,0x15f));var _0x3459=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x4593[_0x3cae69];return _0x3128eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3459('0x0'));var zipdir=require(_0x3459('0x1'));var jsonpatch=require(_0x3459('0x2'));var rp=require(_0x3459('0x3'));var moment=require(_0x3459('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3459('0x5'));var ejs=require(_0x3459('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3459('0x7'));var squel=require(_0x3459('0x8'));var crypto=require(_0x3459('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3459('0xa'));var toCsv=require(_0x3459('0x5'));var querystring=require(_0x3459('0xb'));var Papa=require(_0x3459('0xc'));var Redis=require(_0x3459('0xd'));var authService=require(_0x3459('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3459('0xf'));var hardwareService=require(_0x3459('0x10'));var logger=require(_0x3459('0x11'))(_0x3459('0x12'));var utils=require(_0x3459('0x13'));var config=require(_0x3459('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3459('0x15'))['db'];function respondWithStatusCode(_0x3134b8,_0x35cafb){_0x35cafb=_0x35cafb||0xcc;return function(_0x9a990d){if(_0x9a990d){return _0x3134b8[_0x3459('0x16')](_0x35cafb);}return _0x3134b8[_0x3459('0x17')](_0x35cafb)['end']();};}function respondWithResult(_0x291343,_0x8a0e4f){_0x8a0e4f=_0x8a0e4f||0xc8;return function(_0x5f33cd){if(_0x5f33cd){return _0x291343['status'](_0x8a0e4f)[_0x3459('0x18')](_0x5f33cd);}};}function respondWithFilteredResult(_0x4c9e0f,_0x1c68ef){return function(_0x513fac){if(_0x513fac){var _0x14e6e6=typeof _0x1c68ef['offset']==='undefined'&&typeof _0x1c68ef[_0x3459('0x19')]===_0x3459('0x1a');var _0x5622d4=_0x513fac[_0x3459('0x1b')];var _0x110362=_0x14e6e6?0x0:_0x1c68ef[_0x3459('0x1c')];var _0x454892=_0x14e6e6?_0x513fac['count']:_0x1c68ef[_0x3459('0x1c')]+_0x1c68ef[_0x3459('0x19')];var _0x3fde1f;if(_0x454892>=_0x5622d4){_0x454892=_0x5622d4;_0x3fde1f=0xc8;}else{_0x3fde1f=0xce;}_0x4c9e0f['status'](_0x3fde1f);return _0x4c9e0f[_0x3459('0x1d')](_0x3459('0x1e'),_0x110362+'-'+_0x454892+'/'+_0x5622d4)[_0x3459('0x18')](_0x513fac);}return null;};}function patchUpdates(_0x411bda){return function(_0xfcba7){try{jsonpatch[_0x3459('0x1f')](_0xfcba7,_0x411bda,!![]);}catch(_0x2cea01){return BPromise[_0x3459('0x20')](_0x2cea01);}return _0xfcba7[_0x3459('0x21')]();};}function saveUpdates(_0x5d4ddc,_0x440324){return function(_0x659180){if(_0x659180){return _0x659180[_0x3459('0x22')](_0x5d4ddc)[_0x3459('0x23')](function(_0x2eb3b9){return _0x2eb3b9;});}return null;};}function removeEntity(_0x4c3b6d,_0x5f4016){return function(_0x4ca792){if(_0x4ca792){return _0x4ca792[_0x3459('0x24')]()[_0x3459('0x23')](function(){_0x4c3b6d[_0x3459('0x17')](0xcc)[_0x3459('0x25')]();});}};}function handleEntityNotFound(_0x4b04ab,_0x5bd9e9){return function(_0x373b52){if(!_0x373b52){_0x4b04ab[_0x3459('0x16')](0x194);}return _0x373b52;};}function handleError(_0xb73f84,_0x19b5b6){_0x19b5b6=_0x19b5b6||0x1f4;return function(_0x37ccd3){logger[_0x3459('0x26')](_0x37ccd3[_0x3459('0x27')]);if(_0x37ccd3['name']){delete _0x37ccd3[_0x3459('0x28')];}_0xb73f84[_0x3459('0x17')](_0x19b5b6)[_0x3459('0x29')](_0x37ccd3);};}exports[_0x3459('0x2a')]=function(_0x4e41bf,_0x51cf2f){var _0x1fb6cc={},_0x351c51={},_0x3f70b={'count':0x0,'rows':[]};var _0x62f9f0=_[_0x3459('0x2b')](db[_0x3459('0x2c')][_0x3459('0x2d')],function(_0x2d6154){return{'name':_0x2d6154[_0x3459('0x2e')],'type':_0x2d6154[_0x3459('0x2f')][_0x3459('0x30')]};});_0x351c51[_0x3459('0x31')]=_['map'](_0x62f9f0,_0x3459('0x28'));_0x351c51[_0x3459('0x32')]=_[_0x3459('0x33')](_0x4e41bf[_0x3459('0x32')]);_0x351c51[_0x3459('0x34')]=_[_0x3459('0x35')](_0x351c51['model'],_0x351c51[_0x3459('0x32')]);_0x1fb6cc['attributes']=_[_0x3459('0x35')](_0x351c51['model'],qs['fields'](_0x4e41bf[_0x3459('0x32')][_0x3459('0x36')]));_0x1fb6cc[_0x3459('0x37')]=_0x1fb6cc[_0x3459('0x37')][_0x3459('0x38')]?_0x1fb6cc[_0x3459('0x37')]:_0x351c51[_0x3459('0x31')];if(!_0x4e41bf[_0x3459('0x32')][_0x3459('0x39')](_0x3459('0x3a'))){_0x1fb6cc[_0x3459('0x19')]=qs['limit'](_0x4e41bf[_0x3459('0x32')][_0x3459('0x19')]);_0x1fb6cc[_0x3459('0x1c')]=qs[_0x3459('0x1c')](_0x4e41bf[_0x3459('0x32')][_0x3459('0x1c')]);}_0x1fb6cc['order']=qs[_0x3459('0x3b')](_0x4e41bf[_0x3459('0x32')][_0x3459('0x3b')]);_0x1fb6cc[_0x3459('0x3c')]=qs['filters'](_[_0x3459('0x3d')](_0x4e41bf[_0x3459('0x32')],_0x351c51[_0x3459('0x34')]),_0x62f9f0);if(_0x4e41bf[_0x3459('0x32')][_0x3459('0x3e')]){_0x1fb6cc[_0x3459('0x3c')]=_['merge'](_0x1fb6cc[_0x3459('0x3c')],{'$or':_[_0x3459('0x2b')](_0x62f9f0,function(_0x482b2b){if(_0x482b2b[_0x3459('0x2f')]!=='VIRTUAL'){var _0x54a565={};_0x54a565[_0x482b2b[_0x3459('0x28')]]={'$like':'%'+_0x4e41bf[_0x3459('0x32')][_0x3459('0x3e')]+'%'};return _0x54a565;}})});}_0x1fb6cc=_[_0x3459('0x3f')]({},_0x1fb6cc,_0x4e41bf[_0x3459('0x40')]);var _0x12572e={'where':_0x1fb6cc['where']};return db['OpenchannelApplication'][_0x3459('0x1b')](_0x12572e)[_0x3459('0x23')](function(_0x533fa6){_0x3f70b[_0x3459('0x1b')]=_0x533fa6;if(_0x4e41bf[_0x3459('0x32')][_0x3459('0x41')]){_0x1fb6cc['include']=[{'all':!![]}];}return db[_0x3459('0x2c')][_0x3459('0x42')](_0x1fb6cc);})['then'](function(_0x115646){_0x3f70b[_0x3459('0x43')]=_0x115646;return _0x3f70b;})[_0x3459('0x23')](respondWithFilteredResult(_0x51cf2f,_0x1fb6cc))['catch'](handleError(_0x51cf2f,null));};exports[_0x3459('0x44')]=function(_0x31bfcb,_0x340bb1){var _0x29610f={'raw':!![],'where':{'id':_0x31bfcb[_0x3459('0x45')]['id']}},_0x52c7d7={};_0x52c7d7[_0x3459('0x31')]=_['keys'](db[_0x3459('0x2c')]['rawAttributes']);_0x52c7d7['query']=_[_0x3459('0x33')](_0x31bfcb[_0x3459('0x32')]);_0x52c7d7['filters']=_[_0x3459('0x35')](_0x52c7d7[_0x3459('0x31')],_0x52c7d7['query']);_0x29610f['attributes']=_['intersection'](_0x52c7d7[_0x3459('0x31')],qs[_0x3459('0x36')](_0x31bfcb[_0x3459('0x32')][_0x3459('0x36')]));_0x29610f['attributes']=_0x29610f[_0x3459('0x37')][_0x3459('0x38')]?_0x29610f[_0x3459('0x37')]:_0x52c7d7[_0x3459('0x31')];if(_0x31bfcb[_0x3459('0x32')]['includeAll']){_0x29610f[_0x3459('0x46')]=[{'all':!![]}];}_0x29610f=_[_0x3459('0x3f')]({},_0x29610f,_0x31bfcb[_0x3459('0x40')]);return db[_0x3459('0x2c')][_0x3459('0x47')](_0x29610f)['then'](handleEntityNotFound(_0x340bb1,null))[_0x3459('0x23')](respondWithResult(_0x340bb1,null))[_0x3459('0x48')](handleError(_0x340bb1,null));};exports['create']=function(_0x4debb0,_0x40bfbf){return db[_0x3459('0x2c')][_0x3459('0x49')](_0x4debb0[_0x3459('0x4a')],{})[_0x3459('0x23')](respondWithResult(_0x40bfbf,0xc9))[_0x3459('0x48')](handleError(_0x40bfbf,null));};exports[_0x3459('0x22')]=function(_0x49184c,_0x397203){if(_0x49184c[_0x3459('0x4a')]['id']){delete _0x49184c['body']['id'];}return db[_0x3459('0x2c')][_0x3459('0x47')]({'where':{'id':_0x49184c[_0x3459('0x45')]['id']}})[_0x3459('0x23')](handleEntityNotFound(_0x397203,null))[_0x3459('0x23')](saveUpdates(_0x49184c[_0x3459('0x4a')],null))['then'](respondWithResult(_0x397203,null))[_0x3459('0x48')](handleError(_0x397203,null));};exports[_0x3459('0x24')]=function(_0x4bfb46,_0x4cb6c2){return db['OpenchannelApplication'][_0x3459('0x47')]({'where':{'id':_0x4bfb46[_0x3459('0x45')]['id']}})[_0x3459('0x23')](handleEntityNotFound(_0x4cb6c2,null))[_0x3459('0x23')](removeEntity(_0x4cb6c2,null))[_0x3459('0x48')](handleError(_0x4cb6c2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5f7e128..239add2 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 _0x07c5=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4d0a38,_0x250363){var _0x3c9435=function(_0x4d0c0e){while(--_0x4d0c0e){_0x4d0a38['push'](_0x4d0a38['shift']());}};_0x3c9435(++_0x250363);}(_0x07c5,0xa8));var _0x507c=function(_0x1e8b39,_0x54ffea){_0x1e8b39=_0x1e8b39-0x0;var _0x27c470=_0x07c5[_0x1e8b39];return _0x27c470;};'use strict';var _=require(_0x507c('0x0'));var util=require('util');var logger=require(_0x507c('0x1'))(_0x507c('0x2'));var moment=require(_0x507c('0x3'));var BPromise=require('bluebird');var rp=require(_0x507c('0x4'));var fs=require('fs');var path=require(_0x507c('0x5'));var rimraf=require(_0x507c('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0x507c('0x7')]=function(_0x147d9a,_0x89133c){return _0x147d9a[_0x507c('0x8')](_0x507c('0x9'),attributes,{'tableName':_0x507c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x507c('0xb'),'collate':_0x507c('0xc')});}; \ No newline at end of file +var _0xa356=['api','moment','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x174a87,_0xec9b92){var _0x41d0ea=function(_0x5e1767){while(--_0x5e1767){_0x174a87['push'](_0x174a87['shift']());}};_0x41d0ea(++_0xec9b92);}(_0xa356,0x1dd));var _0x6a35=function(_0x15b5bd,_0x32088e){_0x15b5bd=_0x15b5bd-0x0;var _0x38459b=_0xa356[_0x15b5bd];return _0x38459b;};'use strict';var _=require(_0x6a35('0x0'));var util=require(_0x6a35('0x1'));var logger=require(_0x6a35('0x2'))(_0x6a35('0x3'));var moment=require(_0x6a35('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a35('0x5'));var fs=require('fs');var path=require(_0x6a35('0x6'));var rimraf=require(_0x6a35('0x7'));var config=require(_0x6a35('0x8'));var attributes=require(_0x6a35('0x9'));module[_0x6a35('0xa')]=function(_0x35e577,_0x4277e5){return _0x35e577[_0x6a35('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x6a35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6a35('0xd'),'collate':_0x6a35('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 72d225b..49e2cbd 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 _0x3a94=['http','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','OpenchannelApplication','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x3a94,0xd0));var _0x43a9=function(_0x4c937c,_0x16359b){_0x4c937c=_0x4c937c-0x0;var _0x4601ea=_0x3a94[_0x4c937c];return _0x4601ea;};'use strict';var _=require(_0x43a9('0x0'));var util=require(_0x43a9('0x1'));var moment=require(_0x43a9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43a9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x43a9('0x4'));var logger=require('../../config/logger')(_0x43a9('0x5'));var config=require(_0x43a9('0x6'));var jayson=require(_0x43a9('0x7'));var client=jayson['client'][_0x43a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3caa6d,_0x4cc3e0,_0x40e638){return new BPromise(function(_0x317893,_0x285dcd){return client['request'](_0x3caa6d,_0x40e638)[_0x43a9('0x9')](function(_0x17631d){logger[_0x43a9('0xa')](_0x43a9('0xb'),_0x4cc3e0,'request\x20sent');logger[_0x43a9('0xc')](_0x43a9('0xd'),_0x4cc3e0,_0x43a9('0xe'),JSON[_0x43a9('0xf')](_0x17631d));if(_0x17631d[_0x43a9('0x10')]){if(_0x17631d[_0x43a9('0x10')]['code']===0x1f4){logger[_0x43a9('0x10')](_0x43a9('0xb'),_0x4cc3e0,_0x17631d['error'][_0x43a9('0x11')]);return _0x285dcd(_0x17631d[_0x43a9('0x10')][_0x43a9('0x11')]);}logger[_0x43a9('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x4cc3e0,_0x17631d[_0x43a9('0x10')][_0x43a9('0x11')]);return _0x317893(_0x17631d['error'][_0x43a9('0x11')]);}else{logger['info'](_0x43a9('0xb'),_0x4cc3e0,_0x43a9('0xe'));_0x317893(_0x17631d['result'][_0x43a9('0x11')]);}})[_0x43a9('0x12')](function(_0x107554){logger[_0x43a9('0x10')](_0x43a9('0xb'),_0x4cc3e0,_0x107554);_0x285dcd(_0x107554);});});}exports['UpdateOpenchannelApplication']=function(_0x763fe1){var _0x2f9051=this;return new Promise(function(_0x26806f,_0x20ac9c){return db[_0x43a9('0x13')]['update'](_0x763fe1[_0x43a9('0x14')],{'raw':_0x763fe1[_0x43a9('0x15')]?_0x763fe1[_0x43a9('0x15')][_0x43a9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x763fe1[_0x43a9('0x15')]?_0x763fe1[_0x43a9('0x15')][_0x43a9('0x17')]||null:null,'attributes':_0x763fe1[_0x43a9('0x15')]?_0x763fe1[_0x43a9('0x15')][_0x43a9('0x18')]||null:null,'limit':_0x763fe1[_0x43a9('0x15')]?_0x763fe1['options'][_0x43a9('0x19')]||null:null})[_0x43a9('0x9')](function(_0x502c53){logger[_0x43a9('0xa')](_0x43a9('0x1a'),_0x763fe1);logger[_0x43a9('0xc')](_0x43a9('0x1a'),_0x763fe1,JSON['stringify'](_0x502c53));_0x26806f(_0x502c53);})[_0x43a9('0x12')](function(_0x151a43){logger[_0x43a9('0x10')](_0x43a9('0x1a'),_0x151a43[_0x43a9('0x11')],_0x763fe1);_0x20ac9c(_0x2f9051[_0x43a9('0x10')](0x1f4,_0x151a43[_0x43a9('0x11')]));});});}; \ No newline at end of file +var _0x4a48=['error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','update','options','raw','where','attributes','UpdateOpenchannelApplication','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x227289,_0x1010e9){var _0x10f334=function(_0x19b5bc){while(--_0x19b5bc){_0x227289['push'](_0x227289['shift']());}};_0x10f334(++_0x1010e9);}(_0x4a48,0x67));var _0x84a4=function(_0x3eba74,_0x2b61d0){_0x3eba74=_0x3eba74-0x0;var _0xdce41e=_0x4a48[_0x3eba74];return _0xdce41e;};'use strict';var _=require(_0x84a4('0x0'));var util=require(_0x84a4('0x1'));var moment=require(_0x84a4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x84a4('0x3'));var db=require(_0x84a4('0x4'))['db'];var utils=require(_0x84a4('0x5'));var logger=require(_0x84a4('0x6'))(_0x84a4('0x7'));var config=require(_0x84a4('0x8'));var jayson=require(_0x84a4('0x9'));var client=jayson['client'][_0x84a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xef0a6f,_0x251673,_0x3768a6){return new BPromise(function(_0x59a4ab,_0x25a3ce){return client[_0x84a4('0xb')](_0xef0a6f,_0x3768a6)[_0x84a4('0xc')](function(_0x2cd23c){logger[_0x84a4('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x251673,'request\x20sent');logger['debug'](_0x84a4('0xe'),_0x251673,_0x84a4('0xf'),JSON[_0x84a4('0x10')](_0x2cd23c));if(_0x2cd23c[_0x84a4('0x11')]){if(_0x2cd23c['error'][_0x84a4('0x12')]===0x1f4){logger[_0x84a4('0x11')](_0x84a4('0x13'),_0x251673,_0x2cd23c[_0x84a4('0x11')][_0x84a4('0x14')]);return _0x25a3ce(_0x2cd23c[_0x84a4('0x11')]['message']);}logger[_0x84a4('0x11')](_0x84a4('0x13'),_0x251673,_0x2cd23c[_0x84a4('0x11')][_0x84a4('0x14')]);return _0x59a4ab(_0x2cd23c['error'][_0x84a4('0x14')]);}else{logger['info'](_0x84a4('0x13'),_0x251673,'request\x20sent');_0x59a4ab(_0x2cd23c[_0x84a4('0x15')][_0x84a4('0x14')]);}})[_0x84a4('0x16')](function(_0x3d71a6){logger[_0x84a4('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x251673,_0x3d71a6);_0x25a3ce(_0x3d71a6);});});}exports['UpdateOpenchannelApplication']=function(_0xdd2474){var _0x17f8db=this;return new Promise(function(_0x11270b,_0x314d0e){return db['OpenchannelApplication'][_0x84a4('0x17')](_0xdd2474['body'],{'raw':_0xdd2474[_0x84a4('0x18')]?_0xdd2474[_0x84a4('0x18')][_0x84a4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdd2474[_0x84a4('0x18')]?_0xdd2474[_0x84a4('0x18')][_0x84a4('0x1a')]||null:null,'attributes':_0xdd2474[_0x84a4('0x18')]?_0xdd2474[_0x84a4('0x18')][_0x84a4('0x1b')]||null:null,'limit':_0xdd2474[_0x84a4('0x18')]?_0xdd2474[_0x84a4('0x18')]['limit']||null:null})[_0x84a4('0xc')](function(_0x5a2c59){logger[_0x84a4('0xd')](_0x84a4('0x1c'),_0xdd2474);logger[_0x84a4('0x1d')](_0x84a4('0x1c'),_0xdd2474,JSON[_0x84a4('0x10')](_0x5a2c59));_0x11270b(_0x5a2c59);})[_0x84a4('0x16')](function(_0x393400){logger['error'](_0x84a4('0x1c'),_0x393400[_0x84a4('0x14')],_0xdd2474);_0x314d0e(_0x17f8db[_0x84a4('0x11')](0x1f4,_0x393400[_0x84a4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index ac3e1c9..68e7a8d 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 _0x380a=['./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4e38eb,_0x34b24f){var _0x48df1a=function(_0x2be9dc){while(--_0x2be9dc){_0x4e38eb['push'](_0x4e38eb['shift']());}};_0x48df1a(++_0x34b24f);}(_0x380a,0x1aa));var _0xa380=function(_0x5d115e,_0x35ce96){_0x5d115e=_0x5d115e-0x0;var _0x420939=_0x380a[_0x5d115e];return _0x420939;};'use strict';var multer=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var path=require(_0xa380('0x2'));var timeout=require(_0xa380('0x3'));var express=require(_0xa380('0x4'));var router=express[_0xa380('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa380('0x6'));var config=require(_0xa380('0x7'));var controller=require(_0xa380('0x8'));router[_0xa380('0x9')]('/',auth[_0xa380('0xa')](),controller[_0xa380('0xb')]);router['get'](_0xa380('0xc'),auth[_0xa380('0xa')](),controller[_0xa380('0xd')]);router[_0xa380('0x9')](_0xa380('0xe'),auth[_0xa380('0xa')](),controller[_0xa380('0xf')]);router[_0xa380('0x9')](_0xa380('0x10'),auth[_0xa380('0xa')](),controller['getMessages']);router[_0xa380('0x9')]('/:id/download',auth[_0xa380('0xa')](),controller[_0xa380('0x11')]);router['post']('/',auth[_0xa380('0xa')](),controller['create']);router['post'](_0xa380('0x10'),auth[_0xa380('0xa')](),controller['addMessage']);router[_0xa380('0x12')](_0xa380('0x13'),auth['isAuthenticated'](),interaction[_0xa380('0x14')](_0xa380('0x15'),_0xa380('0x16')),controller[_0xa380('0x17')]);router[_0xa380('0x18')](_0xa380('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xa380('0x15'),'openchannelinteraction:update'),controller[_0xa380('0x19')]);router['delete'](_0xa380('0xe'),auth[_0xa380('0xa')](),interaction[_0xa380('0x14')](_0xa380('0x15'),_0xa380('0x1a')),controller[_0xa380('0x1b')]);router[_0xa380('0x1c')](_0xa380('0x13'),auth[_0xa380('0xa')](),controller[_0xa380('0x1d')]);module[_0xa380('0x1e')]=router; \ No newline at end of file +var _0x3aba=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','update','delete','tracked','openchannelinteraction:destroy','removeTags'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x3aba,0x14b));var _0xa3ab=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x3aba[_0x2ed8f3];return _0x525a55;};'use strict';var multer=require(_0xa3ab('0x0'));var util=require(_0xa3ab('0x1'));var path=require('path');var timeout=require(_0xa3ab('0x2'));var express=require(_0xa3ab('0x3'));var router=express[_0xa3ab('0x4')]();var fs_extra=require(_0xa3ab('0x5'));var auth=require(_0xa3ab('0x6'));var interaction=require(_0xa3ab('0x7'));var config=require(_0xa3ab('0x8'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0xa3ab('0x9')](),controller[_0xa3ab('0xa')]);router[_0xa3ab('0xb')]('/describe',auth[_0xa3ab('0x9')](),controller[_0xa3ab('0xc')]);router['get'](_0xa3ab('0xd'),auth['isAuthenticated'](),controller[_0xa3ab('0xe')]);router[_0xa3ab('0xb')](_0xa3ab('0xf'),auth[_0xa3ab('0x9')](),controller[_0xa3ab('0x10')]);router[_0xa3ab('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0xa3ab('0x11')]);router[_0xa3ab('0x12')]('/',auth[_0xa3ab('0x9')](),controller[_0xa3ab('0x13')]);router[_0xa3ab('0x12')]('/:id/messages',auth[_0xa3ab('0x9')](),controller['addMessage']);router[_0xa3ab('0x12')](_0xa3ab('0x14'),auth[_0xa3ab('0x9')](),interaction['tracked'](_0xa3ab('0x15'),_0xa3ab('0x16')),controller['addTags']);router['put']('/:id',auth[_0xa3ab('0x9')](),interaction['tracked']('openchannel',_0xa3ab('0x17')),controller[_0xa3ab('0x18')]);router[_0xa3ab('0x19')](_0xa3ab('0xd'),auth[_0xa3ab('0x9')](),interaction[_0xa3ab('0x1a')](_0xa3ab('0x15'),_0xa3ab('0x1b')),controller['destroy']);router[_0xa3ab('0x19')](_0xa3ab('0x14'),auth[_0xa3ab('0x9')](),controller[_0xa3ab('0x1c')]);module[_0xa3ab('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5f27e2c..4021fdf 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 _0x0901=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x0901,0x134));var _0x1090=function(_0x321fb5,_0x4c86bc){_0x321fb5=_0x321fb5-0x0;var _0x27c548=_0x0901[_0x321fb5];return _0x27c548;};'use strict';var Sequelize=require(_0x1090('0x0'));module[_0x1090('0x1')]={'closed':{'type':Sequelize[_0x1090('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1090('0x3')]},'disposition':{'type':Sequelize[_0x1090('0x4')]},'secondDisposition':{'type':Sequelize[_0x1090('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1090('0x3')]},'threadId':{'type':Sequelize[_0x1090('0x4')]},'externalUrl':{'type':Sequelize[_0x1090('0x4')]},'lastMsgAt':{'type':Sequelize[_0x1090('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1090('0x5')]('in',_0x1090('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1090('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1090('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1090('0x7')]}}; \ No newline at end of file +var _0xd786=['STRING','out','ENUM','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x1fc8f0,_0x177b1e){var _0x4e4c07=function(_0x27516b){while(--_0x27516b){_0x1fc8f0['push'](_0x1fc8f0['shift']());}};_0x4e4c07(++_0x177b1e);}(_0xd786,0x1dc));var _0x6d78=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xd786[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x6d78('0x0'));module[_0x6d78('0x1')]={'closed':{'type':Sequelize[_0x6d78('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d78('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6d78('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6d78('0x4')]},'note':{'type':Sequelize[_0x6d78('0x4')]},'read1stAt':{'type':Sequelize[_0x6d78('0x3')]},'threadId':{'type':Sequelize[_0x6d78('0x4')]},'externalUrl':{'type':Sequelize[_0x6d78('0x4')]},'lastMsgAt':{'type':Sequelize[_0x6d78('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d78('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x6d78('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x6d78('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x6d78('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6d78('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 3e69d9a..6eb3118 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 _0x5d3b=['toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','Account','get','mkdirSync','Openchannel','Owner','closed','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','out','System','value','views','downloadInteraction.ejs','.pdf','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','then','destroy','end','error','name','send','map','OpenchannelInteraction','rawAttributes','type','key','getOptions','openchannel','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','update','describe','addMessage','OpenchannelMessage','ids','omit','findOne','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix'];(function(_0x5d07d3,_0x3e919a){var _0x443812=function(_0x43de4f){while(--_0x43de4f){_0x5d07d3['push'](_0x5d07d3['shift']());}};_0x443812(++_0x3e919a);}(_0x5d3b,0xa6));var _0xb5d3=function(_0x118abb,_0x488541){_0x118abb=_0x118abb-0x0;var _0x204ea0=_0x5d3b[_0x118abb];return _0x204ea0;};'use strict';var rimraf=require(_0xb5d3('0x0'));var zipdir=require(_0xb5d3('0x1'));var moment=require(_0xb5d3('0x2'));var util=require(_0xb5d3('0x3'));var path=require(_0xb5d3('0x4'));var ejs=require(_0xb5d3('0x5'));var fs=require('fs');var _=require(_0xb5d3('0x6'));var Redis=require(_0xb5d3('0x7'));var interaction=require(_0xb5d3('0x8'));var qs=require(_0xb5d3('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0xb5d3('0xa'))(_0xb5d3('0xb'));var config=require(_0xb5d3('0xc'));var db=require(_0xb5d3('0xd'))['db'];config[_0xb5d3('0xe')]=_[_0xb5d3('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb5d3('0x10'))(new Redis(config[_0xb5d3('0xe')]));require(_0xb5d3('0x11'))[_0xb5d3('0x12')](socket);function respondWithStatusCode(_0x13e627,_0x3a3a64){_0x3a3a64=_0x3a3a64||0xcc;return function(_0x5e2202){if(_0x5e2202){return _0x13e627[_0xb5d3('0x13')](_0x3a3a64);}return _0x13e627['status'](_0x3a3a64)['end']();};}function respondWithResult(_0x39f2e0,_0x4cdd74){_0x4cdd74=_0x4cdd74||0xc8;return function(_0x83e9a9){if(_0x83e9a9){return _0x39f2e0[_0xb5d3('0x14')](_0x4cdd74)[_0xb5d3('0x15')](_0x83e9a9);}};}function respondWithFilteredResult(_0x35d248,_0x4608f0){return function(_0x2a80df){if(_0x2a80df){var _0x26ec23=typeof _0x4608f0[_0xb5d3('0x16')]===_0xb5d3('0x17')&&typeof _0x4608f0[_0xb5d3('0x18')]===_0xb5d3('0x17');var _0x3144ed=_0x2a80df[_0xb5d3('0x19')];var _0x5a53a5=_0x26ec23?0x0:_0x4608f0[_0xb5d3('0x16')];var _0x21af3f=_0x26ec23?_0x2a80df[_0xb5d3('0x19')]:_0x4608f0['offset']+_0x4608f0[_0xb5d3('0x18')];var _0x5b0762;if(_0x21af3f>=_0x3144ed){_0x21af3f=_0x3144ed;_0x5b0762=0xc8;}else{_0x5b0762=0xce;}_0x35d248[_0xb5d3('0x14')](_0x5b0762);return _0x35d248[_0xb5d3('0x1a')]('Content-Range',_0x5a53a5+'-'+_0x21af3f+'/'+_0x3144ed)[_0xb5d3('0x15')](_0x2a80df);}return null;};}function saveUpdates(_0x414260){return function(_0x4661cb){if(_0x4661cb){return _0x4661cb['update'](_0x414260)[_0xb5d3('0x1b')](function(_0x4f3c99){return _0x4f3c99;});}return null;};}function removeEntity(_0x900b65){return function(_0x26e4a4){if(_0x26e4a4){return _0x26e4a4[_0xb5d3('0x1c')]()['then'](function(){_0x900b65[_0xb5d3('0x14')](0xcc)[_0xb5d3('0x1d')]();});}};}function handleEntityNotFound(_0x11a770){return function(_0x59806d){if(!_0x59806d){_0x11a770[_0xb5d3('0x13')](0x194);}return _0x59806d;};}function handleError(_0x265345,_0xdd39d0){_0xdd39d0=_0xdd39d0||0x1f4;return function(_0x122d25){logger[_0xb5d3('0x1e')](_0x122d25['stack']);if(_0x122d25[_0xb5d3('0x1f')]){delete _0x122d25[_0xb5d3('0x1f')];}_0x265345[_0xb5d3('0x14')](_0xdd39d0)[_0xb5d3('0x20')](_0x122d25);};}exports['index']=function(_0x4213b8,_0x299dbc){var _0x3185f9={};var _0x5f240c=_[_0xb5d3('0x21')](db[_0xb5d3('0x22')][_0xb5d3('0x23')],function(_0x307a67){return{'name':_0x307a67['fieldName'],'type':_0x307a67[_0xb5d3('0x24')][_0xb5d3('0x25')]};});_0x3185f9=qs[_0xb5d3('0x26')](_0x5f240c,_0x4213b8);return interaction['findAll'](_0xb5d3('0x27'),_0x4213b8[_0xb5d3('0x28')],_0x4213b8[_0xb5d3('0x29')],_0x3185f9,_0x5f240c)['then'](respondWithFilteredResult(_0x299dbc,_0x3185f9))[_0xb5d3('0x2a')](handleError(_0x299dbc,null));};exports[_0xb5d3('0x2b')]=function(_0x45909e,_0x1858b9){var _0x5874f9={};if(_0x45909e['query'][_0xb5d3('0x24')]&&_0x45909e[_0xb5d3('0x28')][_0xb5d3('0x24')]===_0xb5d3('0x2c')){_0x5874f9[_0xb5d3('0x2c')]=_0x45909e[_0xb5d3('0x2d')]['id'];}else{_0x5874f9['id']=_0x45909e[_0xb5d3('0x2d')]['id'];}var _0x15d02c={'raw':![],'where':_0x5874f9},_0x28058e={};_0x28058e[_0xb5d3('0x2e')]=_[_0xb5d3('0x2f')](db[_0xb5d3('0x22')][_0xb5d3('0x23')]);_0x28058e[_0xb5d3('0x28')]=_[_0xb5d3('0x2f')](_0x45909e[_0xb5d3('0x28')]);_0x28058e[_0xb5d3('0x30')]=_[_0xb5d3('0x31')](_0x28058e[_0xb5d3('0x2e')],_0x28058e['query']);_0x15d02c[_0xb5d3('0x32')]=_['intersection'](_0x28058e[_0xb5d3('0x2e')],qs[_0xb5d3('0x33')](_0x45909e[_0xb5d3('0x28')][_0xb5d3('0x33')]));_0x15d02c[_0xb5d3('0x32')]=_0x15d02c[_0xb5d3('0x32')][_0xb5d3('0x34')]?_0x15d02c['attributes']:_0x28058e[_0xb5d3('0x2e')];if(_0x45909e[_0xb5d3('0x28')][_0xb5d3('0x35')]){_0x15d02c[_0xb5d3('0x36')]=[{'all':!![]}];}_0x15d02c=_[_0xb5d3('0x37')]({},_0x15d02c,_0x45909e[_0xb5d3('0x38')]);return db[_0xb5d3('0x22')][_0xb5d3('0x39')](_0x15d02c)[_0xb5d3('0x1b')](handleEntityNotFound(_0x1858b9,null))['then'](respondWithResult(_0x1858b9,null))['catch'](handleError(_0x1858b9,null));};exports['create']=function(_0x7daa2d,_0x563aec){return db[_0xb5d3('0x22')]['create'](_0x7daa2d[_0xb5d3('0x3a')],{})[_0xb5d3('0x1b')](respondWithResult(_0x563aec,0xc9))[_0xb5d3('0x2a')](handleError(_0x563aec,null));};exports[_0xb5d3('0x3b')]=function(_0x1d6cbd,_0x530d59){if(_0x1d6cbd[_0xb5d3('0x3a')]['id']){delete _0x1d6cbd[_0xb5d3('0x3a')]['id'];}return db[_0xb5d3('0x22')]['find']({'where':{'id':_0x1d6cbd[_0xb5d3('0x2d')]['id']}})[_0xb5d3('0x1b')](handleEntityNotFound(_0x530d59,null))['then'](saveUpdates(_0x1d6cbd[_0xb5d3('0x3a')],null))[_0xb5d3('0x1b')](respondWithResult(_0x530d59,null))['catch'](handleError(_0x530d59,null));};exports[_0xb5d3('0x1c')]=function(_0x23c118,_0xc80682){return db[_0xb5d3('0x22')][_0xb5d3('0x39')]({'where':{'id':_0x23c118[_0xb5d3('0x2d')]['id']}})[_0xb5d3('0x1b')](handleEntityNotFound(_0xc80682,null))[_0xb5d3('0x1b')](removeEntity(_0xc80682,null))[_0xb5d3('0x2a')](handleError(_0xc80682,null));};exports[_0xb5d3('0x3c')]=function(_0x3f73ad,_0x1746b6){return db['OpenchannelInteraction']['describe']()[_0xb5d3('0x1b')](respondWithResult(_0x1746b6,null))[_0xb5d3('0x2a')](handleError(_0x1746b6,null));};exports[_0xb5d3('0x3d')]=function(_0x3e1523,_0x7ab686){return db[_0xb5d3('0x3e')][_0xb5d3('0x39')]({'where':{'id':_0x3e1523[_0xb5d3('0x2d')]['id']}})[_0xb5d3('0x1b')](handleEntityNotFound(_0x7ab686,null))[_0xb5d3('0x1b')](function(_0x3b311e){if(_0x3b311e){return _0x3b311e[_0xb5d3('0x3d')](_0x3e1523[_0xb5d3('0x3a')][_0xb5d3('0x3f')],_[_0xb5d3('0x40')](_0x3e1523[_0xb5d3('0x3a')],[_0xb5d3('0x3f'),'id'])||{});}})[_0xb5d3('0x1b')](respondWithResult(_0x7ab686,null))['catch'](handleError(_0x7ab686,null));};exports['getMessages']=function(_0xc50b93,_0x1ff134){var _0x4df38e={'raw':![],'where':{}};var _0x3c57c6={};var _0x54332d={'count':0x0,'rows':[]};return db[_0xb5d3('0x22')][_0xb5d3('0x41')]({'where':{'id':_0xc50b93[_0xb5d3('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1ff134,null))[_0xb5d3('0x1b')](function(_0x5ea922){if(_0x5ea922){_0x3c57c6[_0xb5d3('0x2e')]=_['keys'](db[_0xb5d3('0x3e')][_0xb5d3('0x23')]);_0x3c57c6['query']=_['keys'](_0xc50b93[_0xb5d3('0x28')]);_0x3c57c6[_0xb5d3('0x30')]=_[_0xb5d3('0x31')](_0x3c57c6[_0xb5d3('0x2e')],_0x3c57c6[_0xb5d3('0x28')]);_0x4df38e[_0xb5d3('0x32')]=_[_0xb5d3('0x31')](_0x3c57c6[_0xb5d3('0x2e')],qs[_0xb5d3('0x33')](_0xc50b93[_0xb5d3('0x28')]['fields']));_0x4df38e['attributes']=_0x4df38e[_0xb5d3('0x32')][_0xb5d3('0x34')]?_0x4df38e[_0xb5d3('0x32')]:_0x3c57c6[_0xb5d3('0x2e')];if(!_0xc50b93[_0xb5d3('0x28')]['hasOwnProperty']('nolimit')){_0x4df38e[_0xb5d3('0x18')]=qs[_0xb5d3('0x18')](_0xc50b93[_0xb5d3('0x28')]['limit']);_0x4df38e[_0xb5d3('0x16')]=qs[_0xb5d3('0x16')](_0xc50b93[_0xb5d3('0x28')][_0xb5d3('0x16')]);}_0x4df38e[_0xb5d3('0x42')]=qs['sort'](_0xc50b93[_0xb5d3('0x28')][_0xb5d3('0x43')]);_0x4df38e[_0xb5d3('0x44')]=qs[_0xb5d3('0x30')](_[_0xb5d3('0x45')](_0xc50b93[_0xb5d3('0x28')],_0x3c57c6[_0xb5d3('0x30')]));_0x4df38e[_0xb5d3('0x44')]['OpenchannelInteractionId']=_0x5ea922['id'];if(_0xc50b93['query'][_0xb5d3('0x46')]){_0x4df38e[_0xb5d3('0x44')]=_[_0xb5d3('0x37')](_0x4df38e[_0xb5d3('0x44')],{'$or':_[_0xb5d3('0x21')](_0x4df38e[_0xb5d3('0x32')],function(_0x2473c7){var _0x652547={};_0x652547[_0x2473c7]={'$like':'%'+_0xc50b93[_0xb5d3('0x28')]['filter']+'%'};return _0x652547;})});}if(_0xc50b93['query']['$gte']){var _0x202c6b=_0xc50b93['query'][_0xb5d3('0x47')][_0xb5d3('0x48')](',');var _0x3ba8f4={};_0x3ba8f4[_0x202c6b[0x0]]={'$gte':moment(_0x202c6b[0x1])[_0xb5d3('0x49')](_0xb5d3('0x4a'))};_0x4df38e[_0xb5d3('0x44')]=_[_0xb5d3('0x37')](_0x4df38e['where'],_0x3ba8f4);}_0x4df38e=_[_0xb5d3('0x37')]({},_0x4df38e,_0xc50b93[_0xb5d3('0x38')]);return db[_0xb5d3('0x3e')][_0xb5d3('0x19')]({'where':_0x4df38e['where']})[_0xb5d3('0x1b')](function(_0x528a9c){_0x54332d['count']=_0x528a9c;if(_0xc50b93[_0xb5d3('0x28')][_0xb5d3('0x35')]){_0x4df38e[_0xb5d3('0x36')]=[{'all':!![]}];}return db[_0xb5d3('0x3e')][_0xb5d3('0x4b')](_0x4df38e);})[_0xb5d3('0x1b')](function(_0x39e988){_0x54332d[_0xb5d3('0x4c')]=_0x39e988;return _0x54332d;});}})[_0xb5d3('0x1b')](respondWithFilteredResult(_0x1ff134,_0x4df38e))[_0xb5d3('0x2a')](handleError(_0x1ff134,null));};exports['addTags']=function(_0x23d081,_0xcc660a){return db[_0xb5d3('0x22')][_0xb5d3('0x39')]({'where':{'id':_0x23d081[_0xb5d3('0x2d')]['id']}})[_0xb5d3('0x1b')](handleEntityNotFound(_0xcc660a,null))[_0xb5d3('0x1b')](function(_0x30b186){if(_0x30b186){return _0x30b186['setTags'](_0x23d081['body'][_0xb5d3('0x3f')],_[_0xb5d3('0x40')](_0x23d081[_0xb5d3('0x3a')],[_0xb5d3('0x3f'),'id'])||{})[_0xb5d3('0x4d')](function(){return db['Tag'][_0xb5d3('0x4b')]({'attributes':['id','name',_0xb5d3('0x4e')],'where':{'id':_0x23d081[_0xb5d3('0x3a')][_0xb5d3('0x3f')]}});})['then'](function(_0x2ac7bf){socket[_0xb5d3('0x4f')](_0xb5d3('0x50'),{'id':Number(_0x23d081[_0xb5d3('0x2d')]['id']),'tags':_0x2ac7bf||[]});return{'id':Number(_0x23d081[_0xb5d3('0x2d')]['id']),'tags':_0x2ac7bf||[]};});}})[_0xb5d3('0x1b')](respondWithResult(_0xcc660a,null))[_0xb5d3('0x2a')](handleError(_0xcc660a,null));};exports[_0xb5d3('0x51')]=function(_0x5ad592,_0x19ec0c){return db[_0xb5d3('0x22')][_0xb5d3('0x39')]({'where':{'id':_0x5ad592['params']['id']}})[_0xb5d3('0x1b')](handleEntityNotFound(_0x19ec0c,null))[_0xb5d3('0x1b')](function(_0x2011e6){if(_0x2011e6){return _0x2011e6[_0xb5d3('0x51')](_0x5ad592[_0xb5d3('0x28')][_0xb5d3('0x3f')]);}})['then'](respondWithStatusCode(_0x19ec0c,null))[_0xb5d3('0x2a')](handleError(_0x19ec0c,null));};exports[_0xb5d3('0x52')]=function(_0x175f69,_0x26fad3){var _0x17a871=moment()[_0xb5d3('0x53')]()[_0xb5d3('0x54')]();var _0x14e78d=path[_0xb5d3('0x55')](config[_0xb5d3('0x56')],_0xb5d3('0x57'),_0xb5d3('0x58'),_0xb5d3('0x59'));var _0x10b47f=path[_0xb5d3('0x55')](config[_0xb5d3('0x56')],_0xb5d3('0x57'),_0xb5d3('0x58'),_0xb5d3('0x5a'));var _0x98f0a7=path[_0xb5d3('0x55')](_0x14e78d,_0x17a871);var _0x54bb11=util[_0xb5d3('0x49')](_0xb5d3('0x5b'),_0x175f69[_0xb5d3('0x2d')]['id'],_0x17a871);var _0x317e6a=path[_0xb5d3('0x55')](_0x14e78d,_0x54bb11);var _0x448c14=[];_0x448c14[_0xb5d3('0x5c')]({'model':db[_0xb5d3('0x5d')],'as':_0xb5d3('0x5d'),'attributes':['id',_0xb5d3('0x5e')],'raw':!![]});_0x448c14[_0xb5d3('0x5c')]({'model':db['CmContact'],'as':_0xb5d3('0x5f'),'attributes':['id',_0xb5d3('0x60'),_0xb5d3('0x61')],'raw':!![]});if(_0x175f69['query'][_0xb5d3('0x5a')]){_0x448c14[_0xb5d3('0x5c')]({'model':db[_0xb5d3('0x62')],'as':_0xb5d3('0x62'),'raw':!![]});}var _0x5a8c49=[{'model':db[_0xb5d3('0x3e')],'as':_0xb5d3('0x63'),'attributes':['id','body',_0xb5d3('0x64'),'direction',_0xb5d3('0x65'),_0xb5d3('0x66')],'include':_0x448c14}];_0x5a8c49[_0xb5d3('0x5c')]({'model':db['OpenchannelAccount'],'as':_0xb5d3('0x67'),'attributes':['id',_0xb5d3('0x1f')]});_0x5a8c49[_0xb5d3('0x5c')]({'model':db[_0xb5d3('0x5d')],'as':'Owner','attributes':['id',_0xb5d3('0x5e')]});return db['OpenchannelInteraction'][_0xb5d3('0x39')]({'where':{'id':_0x175f69[_0xb5d3('0x2d')]['id']},'include':_0x5a8c49})[_0xb5d3('0x1b')](handleEntityNotFound(_0x26fad3,null))[_0xb5d3('0x1b')](function(_0x3fe7e3){if(_0x3fe7e3){var _0x334b5a=_0x3fe7e3[_0xb5d3('0x68')]({'plain':!![]});fs[_0xb5d3('0x69')](_0x98f0a7);var _0xc03a31={'channel':_0xb5d3('0x6a'),'account':_0x334b5a[_0xb5d3('0x67')][_0xb5d3('0x1f')],'agent':_0x334b5a['Owner']?_0x334b5a[_0xb5d3('0x6b')][_0xb5d3('0x5e')]:'N.A.','createdAt':moment(_0x334b5a[_0xb5d3('0x64')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb5d3('0x54')](),'closedAt':_0x334b5a[_0xb5d3('0x6c')]?moment(_0x334b5a[_0xb5d3('0x6d')])['format'](_0xb5d3('0x4a'))[_0xb5d3('0x54')]():'','disposition':_0x334b5a[_0xb5d3('0x6e')],'visibility':_0x334b5a[_0xb5d3('0x6f')]?_0xb5d3('0x70'):_0xb5d3('0x71'),'messages':_(_0x334b5a[_0xb5d3('0x63')])[_0xb5d3('0x46')]({'secret':![]})[_0xb5d3('0x21')](function(_0x3e6dd1){if(_0x3e6dd1[_0xb5d3('0x62')]){var _0x2fd06a=path[_0xb5d3('0x55')](_0x10b47f,_0x3e6dd1[_0xb5d3('0x62')][_0xb5d3('0x72')]);if(fs['existsSync'](_0x2fd06a)){fs[_0xb5d3('0x73')](_0x2fd06a)[_0xb5d3('0x74')](fs[_0xb5d3('0x75')](path[_0xb5d3('0x55')](_0x98f0a7,_0x3e6dd1['Attachment'][_0xb5d3('0x72')])));}}return{'date':moment(_0x3e6dd1[_0xb5d3('0x64')])[_0xb5d3('0x49')](_0xb5d3('0x4a'))['toString'](),'sender':_0x3e6dd1['direction']===_0xb5d3('0x76')?_0x3e6dd1['User']?_0x3e6dd1[_0xb5d3('0x5d')][_0xb5d3('0x5e')]:_0xb5d3('0x77'):_0x3e6dd1['Contact']['firstName']+(_0x3e6dd1[_0xb5d3('0x5f')][_0xb5d3('0x61')]?'\x20'+_0x3e6dd1['Contact'][_0xb5d3('0x61')]:''),'body':_0x3e6dd1[_0xb5d3('0x62')]?_0x3e6dd1[_0xb5d3('0x62')][_0xb5d3('0x72')]:_0x3e6dd1['body'],'direction':_0x3e6dd1['direction']===_0xb5d3('0x76')?'A':'C','secret':_0x3e6dd1[_0xb5d3('0x65')],'read':_0x3e6dd1[_0xb5d3('0x66')],'attachment':_0x3e6dd1[_0xb5d3('0x62')]};})[_0xb5d3('0x78')]()};return ejs['renderFile'](path[_0xb5d3('0x55')](config[_0xb5d3('0x56')],_0xb5d3('0x57'),_0xb5d3('0x79'),_0xb5d3('0x7a')),{'interaction':_0xc03a31})['then'](function(_0x4f64bc){var _0x588388=path[_0xb5d3('0x55')](_0x98f0a7,'transcript-'+_0x334b5a['id']+'-'+_0x17a871+_0xb5d3('0x7b'));var _0x12331d={'path':_0x588388,'channel':_0xb5d3('0x6a'),'interactionId':_0x334b5a['id']};return pdf['createPdfFromHTML'](_0x4f64bc,_0x12331d);})[_0xb5d3('0x1b')](function(){return new Promise(function(_0x5027a4,_0x4f92ca){zipdir(_0x98f0a7,{'saveTo':_0x317e6a},function(_0x1cdbc0,_0x6b9dd){if(_0x1cdbc0)return _0x4f92ca(_0x1cdbc0);return _0x5027a4(_0x6b9dd);});})[_0xb5d3('0x1b')](function(){return new Promise(function(_0x45afa6,_0x2da9e4){rimraf(_0x98f0a7,function(_0x2c9323){if(_0x2c9323)_0x2da9e4(_0x2c9323);return _0x45afa6();});});})[_0xb5d3('0x1b')](function(){return _0x26fad3['download'](_0x317e6a,_0x54bb11,function(_0x4bf3b4){if(_0x4bf3b4){logger['error'](_0xb5d3('0x7c'),_0x4bf3b4);}else{fs['unlinkSync'](_0x317e6a);}});});});}else{return _0x26fad3[_0xb5d3('0x13')](0xc8);}})[_0xb5d3('0x2a')](handleError(_0x26fad3,null));}; \ No newline at end of file +var _0x5bcb=['undefined','count','set','Content-Range','destroy','then','sendStatus','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','query','catch','from','params','model','keys','filters','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','includeAll','findAll','rows','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','User','fullname','CmContact','Contact','lastName','push','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','threadId','Public','Private','pipe','createWriteStream','basename','direction','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','limit'];(function(_0x124fdf,_0x5b2a07){var _0x5402db=function(_0x40dd4d){while(--_0x40dd4d){_0x124fdf['push'](_0x124fdf['shift']());}};_0x5402db(++_0x5b2a07);}(_0x5bcb,0x1da));var _0xb5bc=function(_0xd10ed7,_0x49c553){_0xd10ed7=_0xd10ed7-0x0;var _0x47d67c=_0x5bcb[_0xd10ed7];return _0x47d67c;};'use strict';var rimraf=require(_0xb5bc('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb5bc('0x1'));var util=require(_0xb5bc('0x2'));var path=require('path');var ejs=require(_0xb5bc('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb5bc('0x4'));var interaction=require('../../components/interaction/service');var qs=require(_0xb5bc('0x5'));var pdf=require(_0xb5bc('0x6'));var logger=require('../../config/logger')('api');var config=require(_0xb5bc('0x7'));var db=require(_0xb5bc('0x8'))['db'];config[_0xb5bc('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb5bc('0xa'))(new Redis(config[_0xb5bc('0x9')]));require(_0xb5bc('0xb'))[_0xb5bc('0xc')](socket);function respondWithStatusCode(_0x29d4f3,_0x228f70){_0x228f70=_0x228f70||0xcc;return function(_0x44b48d){if(_0x44b48d){return _0x29d4f3['sendStatus'](_0x228f70);}return _0x29d4f3[_0xb5bc('0xd')](_0x228f70)[_0xb5bc('0xe')]();};}function respondWithResult(_0x1c4b67,_0x3cf588){_0x3cf588=_0x3cf588||0xc8;return function(_0x537b22){if(_0x537b22){return _0x1c4b67[_0xb5bc('0xd')](_0x3cf588)[_0xb5bc('0xf')](_0x537b22);}};}function respondWithFilteredResult(_0x6bd117,_0x330c37){return function(_0x1014c5){if(_0x1014c5){var _0x2aea63=typeof _0x330c37[_0xb5bc('0x10')]==='undefined'&&typeof _0x330c37[_0xb5bc('0x11')]===_0xb5bc('0x12');var _0x3fadd6=_0x1014c5[_0xb5bc('0x13')];var _0x4a457d=_0x2aea63?0x0:_0x330c37[_0xb5bc('0x10')];var _0x2d3f64=_0x2aea63?_0x1014c5['count']:_0x330c37[_0xb5bc('0x10')]+_0x330c37[_0xb5bc('0x11')];var _0x4c116b;if(_0x2d3f64>=_0x3fadd6){_0x2d3f64=_0x3fadd6;_0x4c116b=0xc8;}else{_0x4c116b=0xce;}_0x6bd117['status'](_0x4c116b);return _0x6bd117[_0xb5bc('0x14')](_0xb5bc('0x15'),_0x4a457d+'-'+_0x2d3f64+'/'+_0x3fadd6)[_0xb5bc('0xf')](_0x1014c5);}return null;};}function saveUpdates(_0x3cc399){return function(_0x3b332f){if(_0x3b332f){return _0x3b332f['update'](_0x3cc399)['then'](function(_0x8d41a2){return _0x8d41a2;});}return null;};}function removeEntity(_0x2d3c12){return function(_0x489c95){if(_0x489c95){return _0x489c95[_0xb5bc('0x16')]()[_0xb5bc('0x17')](function(){_0x2d3c12[_0xb5bc('0xd')](0xcc)[_0xb5bc('0xe')]();});}};}function handleEntityNotFound(_0x4a66bf){return function(_0x2e4035){if(!_0x2e4035){_0x4a66bf[_0xb5bc('0x18')](0x194);}return _0x2e4035;};}function handleError(_0x1d7bd1,_0xaa49f1){_0xaa49f1=_0xaa49f1||0x1f4;return function(_0x40888f){logger['error'](_0x40888f[_0xb5bc('0x19')]);if(_0x40888f[_0xb5bc('0x1a')]){delete _0x40888f['name'];}_0x1d7bd1[_0xb5bc('0xd')](_0xaa49f1)[_0xb5bc('0x1b')](_0x40888f);};}exports[_0xb5bc('0x1c')]=function(_0x4b5e9a,_0x28e5ba){var _0x389f99={};var _0x4fafed=_[_0xb5bc('0x1d')](db[_0xb5bc('0x1e')][_0xb5bc('0x1f')],function(_0x130cb9){return{'name':_0x130cb9[_0xb5bc('0x20')],'type':_0x130cb9[_0xb5bc('0x21')]['key']};});_0x389f99=qs['getOptions'](_0x4fafed,_0x4b5e9a);return interaction['findAll']('openchannel',_0x4b5e9a[_0xb5bc('0x22')],_0x4b5e9a['user'],_0x389f99,_0x4fafed)[_0xb5bc('0x17')](respondWithFilteredResult(_0x28e5ba,_0x389f99))[_0xb5bc('0x23')](handleError(_0x28e5ba,null));};exports['show']=function(_0x2653bf,_0x1f4302){var _0x56e8ba={};if(_0x2653bf['query'][_0xb5bc('0x21')]&&_0x2653bf[_0xb5bc('0x22')][_0xb5bc('0x21')]===_0xb5bc('0x24')){_0x56e8ba[_0xb5bc('0x24')]=_0x2653bf[_0xb5bc('0x25')]['id'];}else{_0x56e8ba['id']=_0x2653bf[_0xb5bc('0x25')]['id'];}var _0xcb1698={'raw':![],'where':_0x56e8ba},_0x41cace={};_0x41cace[_0xb5bc('0x26')]=_[_0xb5bc('0x27')](db[_0xb5bc('0x1e')][_0xb5bc('0x1f')]);_0x41cace[_0xb5bc('0x22')]=_[_0xb5bc('0x27')](_0x2653bf[_0xb5bc('0x22')]);_0x41cace[_0xb5bc('0x28')]=_[_0xb5bc('0x29')](_0x41cace['model'],_0x41cace[_0xb5bc('0x22')]);_0xcb1698[_0xb5bc('0x2a')]=_['intersection'](_0x41cace[_0xb5bc('0x26')],qs[_0xb5bc('0x2b')](_0x2653bf[_0xb5bc('0x22')][_0xb5bc('0x2b')]));_0xcb1698[_0xb5bc('0x2a')]=_0xcb1698[_0xb5bc('0x2a')][_0xb5bc('0x2c')]?_0xcb1698[_0xb5bc('0x2a')]:_0x41cace[_0xb5bc('0x26')];if(_0x2653bf[_0xb5bc('0x22')]['includeAll']){_0xcb1698[_0xb5bc('0x2d')]=[{'all':!![]}];}_0xcb1698=_[_0xb5bc('0x2e')]({},_0xcb1698,_0x2653bf[_0xb5bc('0x2f')]);return db[_0xb5bc('0x1e')][_0xb5bc('0x30')](_0xcb1698)['then'](handleEntityNotFound(_0x1f4302,null))[_0xb5bc('0x17')](respondWithResult(_0x1f4302,null))[_0xb5bc('0x23')](handleError(_0x1f4302,null));};exports[_0xb5bc('0x31')]=function(_0x5df7c9,_0x2e6adb){return db[_0xb5bc('0x1e')][_0xb5bc('0x31')](_0x5df7c9['body'],{})['then'](respondWithResult(_0x2e6adb,0xc9))[_0xb5bc('0x23')](handleError(_0x2e6adb,null));};exports['update']=function(_0x6e31f,_0x4030be){if(_0x6e31f[_0xb5bc('0x32')]['id']){delete _0x6e31f[_0xb5bc('0x32')]['id'];}return db[_0xb5bc('0x1e')][_0xb5bc('0x30')]({'where':{'id':_0x6e31f[_0xb5bc('0x25')]['id']}})[_0xb5bc('0x17')](handleEntityNotFound(_0x4030be,null))['then'](saveUpdates(_0x6e31f['body'],null))[_0xb5bc('0x17')](respondWithResult(_0x4030be,null))[_0xb5bc('0x23')](handleError(_0x4030be,null));};exports[_0xb5bc('0x16')]=function(_0x3f7103,_0x3d4e4b){return db[_0xb5bc('0x1e')][_0xb5bc('0x30')]({'where':{'id':_0x3f7103[_0xb5bc('0x25')]['id']}})['then'](handleEntityNotFound(_0x3d4e4b,null))['then'](removeEntity(_0x3d4e4b,null))[_0xb5bc('0x23')](handleError(_0x3d4e4b,null));};exports[_0xb5bc('0x33')]=function(_0x2a718c,_0x137912){return db[_0xb5bc('0x1e')]['describe']()[_0xb5bc('0x17')](respondWithResult(_0x137912,null))[_0xb5bc('0x23')](handleError(_0x137912,null));};exports[_0xb5bc('0x34')]=function(_0x525fec,_0x50b951){return db[_0xb5bc('0x35')][_0xb5bc('0x30')]({'where':{'id':_0x525fec[_0xb5bc('0x25')]['id']}})[_0xb5bc('0x17')](handleEntityNotFound(_0x50b951,null))[_0xb5bc('0x17')](function(_0x515651){if(_0x515651){return _0x515651[_0xb5bc('0x34')](_0x525fec[_0xb5bc('0x32')][_0xb5bc('0x36')],_['omit'](_0x525fec[_0xb5bc('0x32')],[_0xb5bc('0x36'),'id'])||{});}})['then'](respondWithResult(_0x50b951,null))[_0xb5bc('0x23')](handleError(_0x50b951,null));};exports[_0xb5bc('0x37')]=function(_0x4ef2a5,_0x2f5cc9){var _0x412402={'raw':![],'where':{}};var _0x4bde49={};var _0x495055={'count':0x0,'rows':[]};return db[_0xb5bc('0x1e')]['findOne']({'where':{'id':_0x4ef2a5['params']['id']}})[_0xb5bc('0x17')](handleEntityNotFound(_0x2f5cc9,null))[_0xb5bc('0x17')](function(_0x4d0ab8){if(_0x4d0ab8){_0x4bde49['model']=_['keys'](db[_0xb5bc('0x35')][_0xb5bc('0x1f')]);_0x4bde49[_0xb5bc('0x22')]=_[_0xb5bc('0x27')](_0x4ef2a5['query']);_0x4bde49[_0xb5bc('0x28')]=_[_0xb5bc('0x29')](_0x4bde49[_0xb5bc('0x26')],_0x4bde49['query']);_0x412402['attributes']=_[_0xb5bc('0x29')](_0x4bde49[_0xb5bc('0x26')],qs[_0xb5bc('0x2b')](_0x4ef2a5[_0xb5bc('0x22')][_0xb5bc('0x2b')]));_0x412402[_0xb5bc('0x2a')]=_0x412402[_0xb5bc('0x2a')][_0xb5bc('0x2c')]?_0x412402['attributes']:_0x4bde49[_0xb5bc('0x26')];if(!_0x4ef2a5[_0xb5bc('0x22')]['hasOwnProperty'](_0xb5bc('0x38'))){_0x412402[_0xb5bc('0x11')]=qs['limit'](_0x4ef2a5[_0xb5bc('0x22')][_0xb5bc('0x11')]);_0x412402[_0xb5bc('0x10')]=qs['offset'](_0x4ef2a5[_0xb5bc('0x22')][_0xb5bc('0x10')]);}_0x412402[_0xb5bc('0x39')]=qs[_0xb5bc('0x3a')](_0x4ef2a5[_0xb5bc('0x22')][_0xb5bc('0x3a')]);_0x412402[_0xb5bc('0x3b')]=qs[_0xb5bc('0x28')](_[_0xb5bc('0x3c')](_0x4ef2a5[_0xb5bc('0x22')],_0x4bde49[_0xb5bc('0x28')]));_0x412402['where'][_0xb5bc('0x3d')]=_0x4d0ab8['id'];if(_0x4ef2a5[_0xb5bc('0x22')][_0xb5bc('0x3e')]){_0x412402[_0xb5bc('0x3b')]=_['merge'](_0x412402[_0xb5bc('0x3b')],{'$or':_[_0xb5bc('0x1d')](_0x412402[_0xb5bc('0x2a')],function(_0x17133f){var _0x52678e={};_0x52678e[_0x17133f]={'$like':'%'+_0x4ef2a5[_0xb5bc('0x22')][_0xb5bc('0x3e')]+'%'};return _0x52678e;})});}if(_0x4ef2a5['query'][_0xb5bc('0x3f')]){var _0x6b25e5=_0x4ef2a5[_0xb5bc('0x22')]['$gte'][_0xb5bc('0x40')](',');var _0x50fb9a={};_0x50fb9a[_0x6b25e5[0x0]]={'$gte':moment(_0x6b25e5[0x1])[_0xb5bc('0x41')]('YYYY-MM-DD\x20HH:mm:ss')};_0x412402[_0xb5bc('0x3b')]=_[_0xb5bc('0x2e')](_0x412402[_0xb5bc('0x3b')],_0x50fb9a);}_0x412402=_['merge']({},_0x412402,_0x4ef2a5['options']);return db[_0xb5bc('0x35')]['count']({'where':_0x412402['where']})['then'](function(_0x483245){_0x495055[_0xb5bc('0x13')]=_0x483245;if(_0x4ef2a5['query'][_0xb5bc('0x42')]){_0x412402[_0xb5bc('0x2d')]=[{'all':!![]}];}return db[_0xb5bc('0x35')][_0xb5bc('0x43')](_0x412402);})[_0xb5bc('0x17')](function(_0x2a9806){_0x495055[_0xb5bc('0x44')]=_0x2a9806;return _0x495055;});}})[_0xb5bc('0x17')](respondWithFilteredResult(_0x2f5cc9,_0x412402))[_0xb5bc('0x23')](handleError(_0x2f5cc9,null));};exports['addTags']=function(_0x1f7ca8,_0x25eae4){return db[_0xb5bc('0x1e')][_0xb5bc('0x30')]({'where':{'id':_0x1f7ca8[_0xb5bc('0x25')]['id']}})[_0xb5bc('0x17')](handleEntityNotFound(_0x25eae4,null))['then'](function(_0x4331e3){if(_0x4331e3){return _0x4331e3[_0xb5bc('0x45')](_0x1f7ca8['body'][_0xb5bc('0x36')],_['omit'](_0x1f7ca8[_0xb5bc('0x32')],[_0xb5bc('0x36'),'id'])||{})[_0xb5bc('0x46')](function(){return db[_0xb5bc('0x47')]['findAll']({'attributes':['id',_0xb5bc('0x1a'),_0xb5bc('0x48')],'where':{'id':_0x1f7ca8[_0xb5bc('0x32')]['ids']}});})[_0xb5bc('0x17')](function(_0x5a1d35){socket[_0xb5bc('0x49')]('openchannelInteractionTags:save',{'id':Number(_0x1f7ca8[_0xb5bc('0x25')]['id']),'tags':_0x5a1d35||[]});return{'id':Number(_0x1f7ca8[_0xb5bc('0x25')]['id']),'tags':_0x5a1d35||[]};});}})[_0xb5bc('0x17')](respondWithResult(_0x25eae4,null))['catch'](handleError(_0x25eae4,null));};exports['removeTags']=function(_0x19e858,_0x58ccf6){return db['OpenchannelInteraction']['find']({'where':{'id':_0x19e858['params']['id']}})[_0xb5bc('0x17')](handleEntityNotFound(_0x58ccf6,null))[_0xb5bc('0x17')](function(_0x381e8e){if(_0x381e8e){return _0x381e8e[_0xb5bc('0x4a')](_0x19e858['query'][_0xb5bc('0x36')]);}})[_0xb5bc('0x17')](respondWithStatusCode(_0x58ccf6,null))['catch'](handleError(_0x58ccf6,null));};exports[_0xb5bc('0x4b')]=function(_0x554b87,_0x523dfb){var _0x1aa788=moment()[_0xb5bc('0x4c')]()[_0xb5bc('0x4d')]();var _0x4e19dc=path[_0xb5bc('0x4e')](config['root'],'server',_0xb5bc('0x4f'),_0xb5bc('0x50'));var _0x29aa43=path[_0xb5bc('0x4e')](config[_0xb5bc('0x51')],_0xb5bc('0x52'),_0xb5bc('0x4f'),_0xb5bc('0x53'));var _0x326af7=path[_0xb5bc('0x4e')](_0x4e19dc,_0x1aa788);var _0x250366=util['format'](_0xb5bc('0x54'),_0x554b87['params']['id'],_0x1aa788);var _0x4a4da2=path[_0xb5bc('0x4e')](_0x4e19dc,_0x250366);var _0x3724a1=[];_0x3724a1['push']({'model':db['User'],'as':_0xb5bc('0x55'),'attributes':['id',_0xb5bc('0x56')],'raw':!![]});_0x3724a1['push']({'model':db[_0xb5bc('0x57')],'as':_0xb5bc('0x58'),'attributes':['id','firstName',_0xb5bc('0x59')],'raw':!![]});if(_0x554b87[_0xb5bc('0x22')][_0xb5bc('0x53')]){_0x3724a1[_0xb5bc('0x5a')]({'model':db[_0xb5bc('0x5b')],'as':_0xb5bc('0x5b'),'raw':!![]});}var _0x541c26=[{'model':db[_0xb5bc('0x35')],'as':_0xb5bc('0x5c'),'attributes':['id',_0xb5bc('0x32'),_0xb5bc('0x5d'),'direction',_0xb5bc('0x5e'),_0xb5bc('0x5f')],'include':_0x3724a1}];_0x541c26['push']({'model':db[_0xb5bc('0x60')],'as':_0xb5bc('0x61'),'attributes':['id',_0xb5bc('0x1a')]});_0x541c26[_0xb5bc('0x5a')]({'model':db[_0xb5bc('0x55')],'as':_0xb5bc('0x62'),'attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x554b87[_0xb5bc('0x25')]['id']},'include':_0x541c26})[_0xb5bc('0x17')](handleEntityNotFound(_0x523dfb,null))['then'](function(_0x3e0a37){if(_0x3e0a37){var _0x3c695e=_0x3e0a37[_0xb5bc('0x63')]({'plain':!![]});fs[_0xb5bc('0x64')](_0x326af7);var _0xab3913={'channel':_0xb5bc('0x65'),'account':_0x3c695e[_0xb5bc('0x61')][_0xb5bc('0x1a')],'agent':_0x3c695e[_0xb5bc('0x62')]?_0x3c695e[_0xb5bc('0x62')][_0xb5bc('0x56')]:'N.A.','createdAt':moment(_0x3c695e[_0xb5bc('0x5d')])[_0xb5bc('0x41')](_0xb5bc('0x66'))[_0xb5bc('0x4d')](),'closedAt':_0x3c695e[_0xb5bc('0x67')]?moment(_0x3c695e[_0xb5bc('0x68')])[_0xb5bc('0x41')](_0xb5bc('0x66'))[_0xb5bc('0x4d')]():'','disposition':_0x3c695e['disposition'],'visibility':_0x3c695e[_0xb5bc('0x69')]?_0xb5bc('0x6a'):_0xb5bc('0x6b'),'messages':_(_0x3c695e[_0xb5bc('0x5c')])[_0xb5bc('0x3e')]({'secret':![]})[_0xb5bc('0x1d')](function(_0x239e53){if(_0x239e53[_0xb5bc('0x5b')]){var _0xebd3cf=path[_0xb5bc('0x4e')](_0x29aa43,_0x239e53[_0xb5bc('0x5b')]['basename']);if(fs['existsSync'](_0xebd3cf)){fs['createReadStream'](_0xebd3cf)[_0xb5bc('0x6c')](fs[_0xb5bc('0x6d')](path[_0xb5bc('0x4e')](_0x326af7,_0x239e53[_0xb5bc('0x5b')][_0xb5bc('0x6e')])));}}return{'date':moment(_0x239e53[_0xb5bc('0x5d')])[_0xb5bc('0x41')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb5bc('0x4d')](),'sender':_0x239e53[_0xb5bc('0x6f')]===_0xb5bc('0x70')?_0x239e53['User']?_0x239e53['User'][_0xb5bc('0x56')]:_0xb5bc('0x71'):_0x239e53[_0xb5bc('0x58')][_0xb5bc('0x72')]+(_0x239e53[_0xb5bc('0x58')][_0xb5bc('0x59')]?'\x20'+_0x239e53['Contact']['lastName']:''),'body':_0x239e53[_0xb5bc('0x5b')]?_0x239e53[_0xb5bc('0x5b')][_0xb5bc('0x6e')]:_0x239e53['body'],'direction':_0x239e53[_0xb5bc('0x6f')]===_0xb5bc('0x70')?'A':'C','secret':_0x239e53[_0xb5bc('0x5e')],'read':_0x239e53[_0xb5bc('0x5f')],'attachment':_0x239e53['Attachment']};})[_0xb5bc('0x73')]()};return ejs[_0xb5bc('0x74')](path[_0xb5bc('0x4e')](config['root'],'server',_0xb5bc('0x75'),_0xb5bc('0x76')),{'interaction':_0xab3913})[_0xb5bc('0x17')](function(_0x4aaa33){var _0x4e43a7=path[_0xb5bc('0x4e')](_0x326af7,'transcript-'+_0x3c695e['id']+'-'+_0x1aa788+_0xb5bc('0x77'));var _0x456565={'path':_0x4e43a7,'channel':_0xb5bc('0x65'),'interactionId':_0x3c695e['id']};return pdf['createPdfFromHTML'](_0x4aaa33,_0x456565);})[_0xb5bc('0x17')](function(){return new Promise(function(_0x27e112,_0x389320){zipdir(_0x326af7,{'saveTo':_0x4a4da2},function(_0x5019b6,_0x11add4){if(_0x5019b6)return _0x389320(_0x5019b6);return _0x27e112(_0x11add4);});})[_0xb5bc('0x17')](function(){return new Promise(function(_0x32f211,_0x25ba75){rimraf(_0x326af7,function(_0x320c75){if(_0x320c75)_0x25ba75(_0x320c75);return _0x32f211();});});})[_0xb5bc('0x17')](function(){return _0x523dfb[_0xb5bc('0x4b')](_0x4a4da2,_0x250366,function(_0x327912){if(_0x327912){logger[_0xb5bc('0x78')](_0xb5bc('0x79'),_0x327912);}else{fs[_0xb5bc('0x7a')](_0x4a4da2);}});});});}else{return _0x523dfb[_0xb5bc('0x18')](0xc8);}})[_0xb5bc('0x23')](handleError(_0x523dfb,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 33f6982..b87d496 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 _0x4557=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4557,0x197));var _0x7455=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4557[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x7455('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x7455('0x1')];var OpenchannelMessage=require(_0x7455('0x2'))['db'][_0x7455('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7455('0x4')](0x0);var events={'afterCreate':_0x7455('0x5'),'afterUpdate':'update','afterDestroy':_0x7455('0x6')};function emitEvent(_0x5a03c0){return function(_0x13d831,_0x309934,_0x140384){_0x13d831[_0x7455('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xdc50e2){_0x13d831[_0x7455('0x8')]('Users',_0xdc50e2[_0x7455('0x9')](function(_0x40c186){return{'id':_0x40c186['id']};}));return OpenchannelMessage[_0x7455('0xa')]({'where':{'OpenchannelInteractionId':_0x13d831['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7455('0xb')](function(_0x2a7808){_0x13d831['setDataValue'](_0x7455('0xc'),_0x2a7808[_0x7455('0xd')]);OpenchannelInteractionEvents[_0x7455('0xe')](_0x5a03c0+':'+_0x13d831['id'],_0x13d831);OpenchannelInteractionEvents[_0x7455('0xe')](_0x5a03c0,_0x13d831);_0x140384(null);})[_0x7455('0xf')](_0x140384(null));};}for(var e in events){if(events[_0x7455('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x7455('0x11')](e,emitEvent(event));}}module[_0x7455('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x157f=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save'];(function(_0x114b7c,_0xc4b93b){var _0x47185f=function(_0x5b4cfa){while(--_0x5b4cfa){_0x114b7c['push'](_0x114b7c['shift']());}};_0x47185f(++_0xc4b93b);}(_0x157f,0xfe));var _0xf157=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x157f[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xf157('0x0'));var OpenchannelInteraction=require(_0xf157('0x1'))['db'][_0xf157('0x2')];var OpenchannelMessage=require(_0xf157('0x1'))['db'][_0xf157('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xf157('0x4')](0x0);var events={'afterCreate':_0xf157('0x5'),'afterUpdate':_0xf157('0x6'),'afterDestroy':_0xf157('0x7')};function emitEvent(_0x47c4ea){return function(_0x7ee72,_0x10e187,_0x2190b3){_0x7ee72[_0xf157('0x8')]({'attributes':['id'],'raw':!![]})[_0xf157('0x9')](function(_0x456fdf){_0x7ee72[_0xf157('0xa')](_0xf157('0xb'),_0x456fdf[_0xf157('0xc')](function(_0x143ca2){return{'id':_0x143ca2['id']};}));return OpenchannelMessage[_0xf157('0xd')]({'where':{'OpenchannelInteractionId':_0x7ee72['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf157('0x9')](function(_0x44b6eb){_0x7ee72[_0xf157('0xa')](_0xf157('0xe'),_0x44b6eb[_0xf157('0xf')]);OpenchannelInteractionEvents['emit'](_0x47c4ea+':'+_0x7ee72['id'],_0x7ee72);OpenchannelInteractionEvents[_0xf157('0x10')](_0x47c4ea,_0x7ee72);_0x2190b3(null);})[_0xf157('0x11')](_0x2190b3(null));};}for(var e in events){if(events[_0xf157('0x12')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xf157('0x13')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 1e061ed..4c273f1 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 _0x6d6f=['path','rimraf','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x27bbf4,_0x19866e){var _0x1b55ac=function(_0x42e5f6){while(--_0x42e5f6){_0x27bbf4['push'](_0x27bbf4['shift']());}};_0x1b55ac(++_0x19866e);}(_0x6d6f,0xb6));var _0xf6d6=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x6d6f[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0xf6d6('0x0'));var util=require(_0xf6d6('0x1'));var logger=require(_0xf6d6('0x2'))('api');var moment=require(_0xf6d6('0x3'));var BPromise=require(_0xf6d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6d6('0x5'));var rimraf=require(_0xf6d6('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6d6('0x7'));module[_0xf6d6('0x8')]=function(_0x94f8e5,_0x5590a5){return _0x94f8e5['define'](_0xf6d6('0x9'),attributes,{'tableName':_0xf6d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf6d6('0xb'),'collate':_0xf6d6('0xc'),'hooks':{'beforeUpdate':function(_0x395a77,_0x272df5,_0x5d0542){if(_0x395a77[_0xf6d6('0xd')](_0xf6d6('0xe'))){_0x395a77['closedAt']=moment()[_0xf6d6('0xf')](_0xf6d6('0x10'));}_0x5d0542(null,_0x395a77);}}});}; \ No newline at end of file +var _0x2888=['changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4'];(function(_0x45789a,_0x1894c7){var _0x1f58e3=function(_0x29e05a){while(--_0x29e05a){_0x45789a['push'](_0x45789a['shift']());}};_0x1f58e3(++_0x1894c7);}(_0x2888,0x102));var _0x8288=function(_0x59a701,_0x2a5936){_0x59a701=_0x59a701-0x0;var _0x2ee66d=_0x2888[_0x59a701];return _0x2ee66d;};'use strict';var _=require(_0x8288('0x0'));var util=require(_0x8288('0x1'));var logger=require(_0x8288('0x2'))(_0x8288('0x3'));var moment=require(_0x8288('0x4'));var BPromise=require('bluebird');var rp=require(_0x8288('0x5'));var fs=require('fs');var path=require(_0x8288('0x6'));var rimraf=require(_0x8288('0x7'));var config=require(_0x8288('0x8'));var attributes=require(_0x8288('0x9'));module['exports']=function(_0x99cf18,_0x5bb122){return _0x99cf18[_0x8288('0xa')](_0x8288('0xb'),attributes,{'tableName':_0x8288('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8288('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5477a1,_0x11f42e,_0x327984){if(_0x5477a1[_0x8288('0xe')]('closed')){_0x5477a1['closedAt']=moment()[_0x8288('0xf')](_0x8288('0x10'));}_0x327984(null,_0x5477a1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6a1bbf8..12db26a 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 _0xe18b=['body','options','raw','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','addTags','ids','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update'];(function(_0x550ab1,_0x24f687){var _0x107ccc=function(_0x5a251f){while(--_0x5a251f){_0x550ab1['push'](_0x550ab1['shift']());}};_0x107ccc(++_0x24f687);}(_0xe18b,0xac));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbe18('0x0'));var moment=require('moment');var BPromise=require(_0xbe18('0x1'));var rs=require(_0xbe18('0x2'));var fs=require('fs');var Redis=require(_0xbe18('0x3'));var db=require(_0xbe18('0x4'))['db'];var utils=require(_0xbe18('0x5'));var logger=require(_0xbe18('0x6'))('rpc');var config=require(_0xbe18('0x7'));var jayson=require(_0xbe18('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xbe18('0x9')](config[_0xbe18('0xa')],{'host':_0xbe18('0xb'),'port':0x18eb});var socket=require(_0xbe18('0xc'))(new Redis(config[_0xbe18('0xa')]));require('./openchannelInteraction.socket')[_0xbe18('0xd')](socket);function respondWithRpcPromise(_0x25d1d8,_0x42b802,_0x45acac){return new BPromise(function(_0x57046f,_0x4a2a11){return client[_0xbe18('0xe')](_0x25d1d8,_0x45acac)[_0xbe18('0xf')](function(_0x19d262){logger[_0xbe18('0x10')](_0xbe18('0x11'),_0x42b802,_0xbe18('0x12'));logger[_0xbe18('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x42b802,_0xbe18('0x12'),JSON[_0xbe18('0x14')](_0x19d262));if(_0x19d262[_0xbe18('0x15')]){if(_0x19d262['error'][_0xbe18('0x16')]===0x1f4){logger[_0xbe18('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x42b802,_0x19d262[_0xbe18('0x15')][_0xbe18('0x17')]);return _0x4a2a11(_0x19d262[_0xbe18('0x15')][_0xbe18('0x17')]);}logger[_0xbe18('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x42b802,_0x19d262[_0xbe18('0x15')][_0xbe18('0x17')]);return _0x57046f(_0x19d262[_0xbe18('0x15')][_0xbe18('0x17')]);}else{logger[_0xbe18('0x10')](_0xbe18('0x11'),_0x42b802,'request\x20sent');_0x57046f(_0x19d262[_0xbe18('0x18')][_0xbe18('0x17')]);}})['catch'](function(_0x5d70b2){logger[_0xbe18('0x15')](_0xbe18('0x11'),_0x42b802,_0x5d70b2);_0x4a2a11(_0x5d70b2);});});}exports[_0xbe18('0x19')]=function(_0x527539){var _0x1d8e62=this;return new Promise(function(_0x5c779b,_0x263aca){return db[_0xbe18('0x1a')][_0xbe18('0x1b')](_0x527539[_0xbe18('0x1c')],{'raw':_0x527539[_0xbe18('0x1d')]?_0x527539[_0xbe18('0x1d')][_0xbe18('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x527539['options']?_0x527539[_0xbe18('0x1d')][_0xbe18('0x1f')]||null:null,'attributes':_0x527539[_0xbe18('0x1d')]?_0x527539['options'][_0xbe18('0x20')]||null:null,'limit':_0x527539[_0xbe18('0x1d')]?_0x527539[_0xbe18('0x1d')][_0xbe18('0x21')]||null:null})['then'](function(_0x425479){logger['info']('UpdateOpenchannelInteraction',_0x527539);logger[_0xbe18('0x13')]('UpdateOpenchannelInteraction',_0x527539,JSON[_0xbe18('0x14')](_0x425479));_0x5c779b(_0x425479);})[_0xbe18('0x22')](function(_0xeaff20){logger[_0xbe18('0x15')]('UpdateOpenchannelInteraction',_0xeaff20[_0xbe18('0x17')],_0x527539);_0x263aca(_0x1d8e62[_0xbe18('0x15')](0x1f4,_0xeaff20[_0xbe18('0x17')]));});});};exports[_0xbe18('0x23')]=function(_0x2d9d0b){return new Promise(function(_0x39c71e,_0x435804){return db[_0xbe18('0x1a')][_0xbe18('0x24')]({'where':_0x2d9d0b[_0xbe18('0x1d')]?_0x2d9d0b[_0xbe18('0x1d')][_0xbe18('0x1f')]||null:null})['then'](function(_0x406d5e){if(_0x406d5e){return _0x406d5e[_0xbe18('0x25')](_0x2d9d0b['body'][_0xbe18('0x26')],_['omit'](_0x2d9d0b[_0xbe18('0x1c')],['ids','id'])||{});}})['spread'](function(_0x3f3375){logger[_0xbe18('0x10')](_0xbe18('0x27'),_0x2d9d0b);logger[_0xbe18('0x13')](_0xbe18('0x27'),_0x2d9d0b,JSON[_0xbe18('0x14')](_0x3f3375));_0x39c71e(_0x3f3375);})['catch'](function(_0x26cbcf){logger['error'](_0xbe18('0x27'),_0x26cbcf['message'],_0x2d9d0b);_0x435804(_this[_0xbe18('0x15')](0x1f4,_0x26cbcf['message']));});});}; \ No newline at end of file +var _0x76a4=['debug','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','update','options','raw','where','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','body','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','defaults','socket.io-emitter','redis','register','then','info','request\x20sent'];(function(_0x185179,_0x1d791c){var _0x51588b=function(_0x83320){while(--_0x83320){_0x185179['push'](_0x185179['shift']());}};_0x51588b(++_0x1d791c);}(_0x76a4,0x175));var _0x476a=function(_0x18af2f,_0x48f3e1){_0x18af2f=_0x18af2f-0x0;var _0x207c23=_0x76a4[_0x18af2f];return _0x207c23;};'use strict';var _=require(_0x476a('0x0'));var util=require(_0x476a('0x1'));var moment=require('moment');var BPromise=require(_0x476a('0x2'));var rs=require(_0x476a('0x3'));var fs=require('fs');var Redis=require(_0x476a('0x4'));var db=require(_0x476a('0x5'))['db'];var utils=require(_0x476a('0x6'));var logger=require(_0x476a('0x7'))(_0x476a('0x8'));var config=require('../../config/environment');var jayson=require(_0x476a('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x476a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x476a('0xb'))(new Redis(config[_0x476a('0xc')]));require('./openchannelInteraction.socket')[_0x476a('0xd')](socket);function respondWithRpcPromise(_0x284fe4,_0x3ac50c,_0x232dcd){return new BPromise(function(_0x14e27f,_0x290122){return client['request'](_0x284fe4,_0x232dcd)[_0x476a('0xe')](function(_0x411699){logger[_0x476a('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3ac50c,_0x476a('0x10'));logger[_0x476a('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x3ac50c,_0x476a('0x10'),JSON['stringify'](_0x411699));if(_0x411699[_0x476a('0x12')]){if(_0x411699[_0x476a('0x12')][_0x476a('0x13')]===0x1f4){logger[_0x476a('0x12')](_0x476a('0x14'),_0x3ac50c,_0x411699['error']['message']);return _0x290122(_0x411699['error'][_0x476a('0x15')]);}logger[_0x476a('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3ac50c,_0x411699[_0x476a('0x12')]['message']);return _0x14e27f(_0x411699[_0x476a('0x12')][_0x476a('0x15')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x3ac50c,_0x476a('0x10'));_0x14e27f(_0x411699[_0x476a('0x16')][_0x476a('0x15')]);}})[_0x476a('0x17')](function(_0x380cc5){logger[_0x476a('0x12')](_0x476a('0x14'),_0x3ac50c,_0x380cc5);_0x290122(_0x380cc5);});});}exports[_0x476a('0x18')]=function(_0x3491cb){var _0x369018=this;return new Promise(function(_0x3533b3,_0x27582a){return db['OpenchannelInteraction'][_0x476a('0x19')](_0x3491cb['body'],{'raw':_0x3491cb[_0x476a('0x1a')]?_0x3491cb['options'][_0x476a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3491cb[_0x476a('0x1a')]?_0x3491cb['options'][_0x476a('0x1c')]||null:null,'attributes':_0x3491cb[_0x476a('0x1a')]?_0x3491cb[_0x476a('0x1a')]['attributes']||null:null,'limit':_0x3491cb[_0x476a('0x1a')]?_0x3491cb[_0x476a('0x1a')][_0x476a('0x1d')]||null:null})[_0x476a('0xe')](function(_0x16f9a3){logger[_0x476a('0xf')](_0x476a('0x18'),_0x3491cb);logger['debug'](_0x476a('0x18'),_0x3491cb,JSON[_0x476a('0x1e')](_0x16f9a3));_0x3533b3(_0x16f9a3);})['catch'](function(_0x146bb7){logger[_0x476a('0x12')](_0x476a('0x18'),_0x146bb7[_0x476a('0x15')],_0x3491cb);_0x27582a(_0x369018[_0x476a('0x12')](0x1f4,_0x146bb7[_0x476a('0x15')]));});});};exports[_0x476a('0x1f')]=function(_0x42b6dd){return new Promise(function(_0xe6dd3,_0x3140b5){return db[_0x476a('0x20')][_0x476a('0x21')]({'where':_0x42b6dd[_0x476a('0x1a')]?_0x42b6dd[_0x476a('0x1a')]['where']||null:null})[_0x476a('0xe')](function(_0x222c2b){if(_0x222c2b){return _0x222c2b[_0x476a('0x22')](_0x42b6dd[_0x476a('0x23')][_0x476a('0x24')],_[_0x476a('0x25')](_0x42b6dd[_0x476a('0x23')],[_0x476a('0x24'),'id'])||{});}})['spread'](function(_0x2c8c97){logger[_0x476a('0xf')](_0x476a('0x26'),_0x42b6dd);logger[_0x476a('0x11')](_0x476a('0x26'),_0x42b6dd,JSON[_0x476a('0x1e')](_0x2c8c97));_0xe6dd3(_0x2c8c97);})[_0x476a('0x17')](function(_0x44d13b){logger['error']('AddTags',_0x44d13b[_0x476a('0x15')],_0x42b6dd);_0x3140b5(_this[_0x476a('0x12')](0x1f4,_0x44d13b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e39b93f..929a195 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 _0xf34b=['save','emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x6eb833,_0x2bb5e5){var _0xdfc38c=function(_0x13c4a4){while(--_0x13c4a4){_0x6eb833['push'](_0x6eb833['shift']());}};_0xdfc38c(++_0x2bb5e5);}(_0xf34b,0x1d4));var _0xbf34=function(_0x31b808,_0x5656ad){_0x31b808=_0x31b808-0x0;var _0x191e21=_0xf34b[_0x31b808];return _0x191e21;};'use strict';var OpenchannelInteractionEvents=require(_0xbf34('0x0'));var events=[_0xbf34('0x1'),'remove','update'];function createListener(_0x185e9c,_0x1f1718){return function(_0x3b75de){_0x1f1718[_0xbf34('0x2')](_0x185e9c,_0x3b75de);};}function removeListener(_0x392c91,_0xce7de9){return function(){OpenchannelInteractionEvents[_0xbf34('0x3')](_0x392c91,_0xce7de9);};}exports[_0xbf34('0x4')]=function(_0x4e571b){for(var _0x23ebe=0x0,_0x141213=events[_0xbf34('0x5')];_0x23ebe<_0x141213;_0x23ebe++){var _0x1dfcfa=events[_0x23ebe];var _0x195224=createListener(_0xbf34('0x6')+_0x1dfcfa,_0x4e571b);OpenchannelInteractionEvents['on'](_0x1dfcfa,_0x195224);}}; \ No newline at end of file +var _0x364d=['openchannelInteraction:','./openchannelInteraction.events','save','update','register','length'];(function(_0x2c031c,_0x3a5da6){var _0x297a9a=function(_0x4acfb6){while(--_0x4acfb6){_0x2c031c['push'](_0x2c031c['shift']());}};_0x297a9a(++_0x3a5da6);}(_0x364d,0xfd));var _0xd364=function(_0x178885,_0x5814d9){_0x178885=_0x178885-0x0;var _0x345695=_0x364d[_0x178885];return _0x345695;};'use strict';var OpenchannelInteractionEvents=require(_0xd364('0x0'));var events=[_0xd364('0x1'),'remove',_0xd364('0x2')];function createListener(_0x5b1e16,_0x399311){return function(_0x4defb5){_0x399311['emit'](_0x5b1e16,_0x4defb5);};}function removeListener(_0x2a099e,_0x5893cc){return function(){OpenchannelInteractionEvents['removeListener'](_0x2a099e,_0x5893cc);};}exports[_0xd364('0x3')]=function(_0x590efa){for(var _0x4fbd51=0x0,_0x3a045a=events[_0xd364('0x4')];_0x4fbd51<_0x3a045a;_0x4fbd51++){var _0x147f0c=events[_0x4fbd51];var _0x1b6825=createListener(_0xd364('0x5')+_0x147f0c,_0x590efa);OpenchannelInteractionEvents['on'](_0x147f0c,_0x1b6825);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6f64d94..ede4364 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x4a05a2,_0x46f343){var _0x557e0b=function(_0x30e156){while(--_0x30e156){_0x4a05a2['push'](_0x4a05a2['shift']());}};_0x557e0b(++_0x46f343);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x58fb9f,_0x560e16){var _0x2ee234=function(_0x188b0b){while(--_0x188b0b){_0x58fb9f['push'](_0x58fb9f['shift']());}};_0x2ee234(++_0x560e16);}(_0xe706,0xa3));var _0x6e70=function(_0x2a2166,_0x3a077f){_0x2a2166=_0x2a2166-0x0;var _0x3bcf50=_0xe706[_0x2a2166];return _0x3bcf50;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0b1d654..6e9b76a 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 _0x351d=['BOOLEAN','ENUM','out','DATE','sequelize','TEXT','medium'];(function(_0x45806b,_0x53eeae){var _0x3e228e=function(_0x3ee031){while(--_0x3ee031){_0x45806b['push'](_0x45806b['shift']());}};_0x3e228e(++_0x53eeae);}(_0x351d,0x90));var _0xd351=function(_0xf1da32,_0x7ab55b){_0xf1da32=_0xf1da32-0x0;var _0x5803ff=_0x351d[_0xf1da32];return _0x5803ff;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'body':{'type':Sequelize[_0xd351('0x1')](_0xd351('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd351('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd351('0x4')]('in','out'),'defaultValue':_0xd351('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd351('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd351('0x1')]}}; \ No newline at end of file +var _0x4fad=['out','DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x2288c2,_0x217b9a){var _0xb2d86d=function(_0x33c747){while(--_0x33c747){_0x2288c2['push'](_0x2288c2['shift']());}};_0xb2d86d(++_0x217b9a);}(_0x4fad,0xcb));var _0xd4fa=function(_0x5964ca,_0x2a7f19){_0x5964ca=_0x5964ca-0x0;var _0x212464=_0x4fad[_0x5964ca];return _0x212464;};'use strict';var Sequelize=require(_0xd4fa('0x0'));module[_0xd4fa('0x1')]={'body':{'type':Sequelize[_0xd4fa('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd4fa('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd4fa('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd4fa('0x4')]('in',_0xd4fa('0x5')),'defaultValue':_0xd4fa('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd4fa('0x6')]},'providerName':{'type':Sequelize[_0xd4fa('0x7')]},'providerResponse':{'type':Sequelize[_0xd4fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 4f46fdd..27139cf 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 _0xe0bb=['request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','OpenchannelMessage','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','includeAll','include','params','options','find','create','body','describe','../../config/logger','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','event','EventManager','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','internal','interface','motionChannel','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0bb,0x15e));var _0xbe0b=function(_0x3aaef5,_0x16cdc8){_0x3aaef5=_0x3aaef5-0x0;var _0x4c0ed5=_0xe0bb[_0x3aaef5];return _0x4c0ed5;};'use strict';var emlformat=require(_0xbe0b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe0b('0x1'));var jsonpatch=require(_0xbe0b('0x2'));var rp=require(_0xbe0b('0x3'));var moment=require(_0xbe0b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbe0b('0x5'));var util=require(_0xbe0b('0x6'));var path=require('path');var sox=require(_0xbe0b('0x7'));var csv=require(_0xbe0b('0x8'));var ejs=require(_0xbe0b('0x9'));var fs=require('fs');var fs_extra=require(_0xbe0b('0xa'));var _=require(_0xbe0b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbe0b('0xc'));var toCsv=require(_0xbe0b('0x8'));var querystring=require(_0xbe0b('0xd'));var Papa=require(_0xbe0b('0xe'));var Redis=require('ioredis');var authService=require(_0xbe0b('0xf'));var qs=require(_0xbe0b('0x10'));var as=require(_0xbe0b('0x11'));var hardwareService=require(_0xbe0b('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xbe0b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbe0b('0x14'));var db=require(_0xbe0b('0x15'))['db'];config[_0xbe0b('0x16')]=_['defaults'](config[_0xbe0b('0x16')],{'host':_0xbe0b('0x17'),'port':0x18eb});var socket=require(_0xbe0b('0x18'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xbe0b('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbe0b('0x1a')][_0xbe0b('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xbe0b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x59ef42,_0x2cc5ed,_0x2504a2,_0x50dcca){return new BPromise(function(_0x26f8e7,_0x356dbe){var _0x20854f=_0x50dcca||client;return _0x20854f['request'](_0x59ef42,_0x2504a2)[_0xbe0b('0x1c')](function(_0x4ab055){logger[_0xbe0b('0x1d')](_0xbe0b('0x1e'),_0x2cc5ed,_0xbe0b('0x1f'));logger['debug'](_0xbe0b('0x20'),_0x2cc5ed,'request\x20sent',JSON[_0xbe0b('0x21')](_0x4ab055));if(_0x4ab055['error']){if(_0x4ab055[_0xbe0b('0x22')]['code']===0x1f4){logger[_0xbe0b('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x2cc5ed,_0x4ab055[_0xbe0b('0x22')][_0xbe0b('0x23')]);return _0x356dbe(_0x4ab055[_0xbe0b('0x22')][_0xbe0b('0x23')]);}logger[_0xbe0b('0x22')](_0xbe0b('0x1e'),_0x2cc5ed,_0x4ab055[_0xbe0b('0x22')][_0xbe0b('0x23')]);return _0x26f8e7(_0x4ab055[_0xbe0b('0x22')][_0xbe0b('0x23')]);}else{logger[_0xbe0b('0x1d')](_0xbe0b('0x1e'),_0x2cc5ed,_0xbe0b('0x1f'));_0x26f8e7(_0x4ab055[_0xbe0b('0x24')][_0xbe0b('0x23')]);}})[_0xbe0b('0x25')](function(_0x1ac7b6){logger[_0xbe0b('0x22')](_0xbe0b('0x1e'),_0x2cc5ed,_0x1ac7b6);_0x356dbe(_0x1ac7b6);});});}function respondWithStatusCode(_0x403c3f,_0x19f390){_0x19f390=_0x19f390||0xcc;return function(_0x2689dd){if(_0x2689dd){return _0x403c3f[_0xbe0b('0x26')](_0x19f390);}return _0x403c3f['status'](_0x19f390)[_0xbe0b('0x27')]();};}function respondWithResult(_0x7cecce,_0x177983){_0x177983=_0x177983||0xc8;return function(_0x2f32f8){if(_0x2f32f8){return _0x7cecce[_0xbe0b('0x28')](_0x177983)['json'](_0x2f32f8);}};}function respondWithFilteredResult(_0x716d56,_0x2aceae){return function(_0x193e5e){if(_0x193e5e){var _0x4f4d2e=typeof _0x2aceae[_0xbe0b('0x29')]===_0xbe0b('0x2a')&&typeof _0x2aceae['limit']===_0xbe0b('0x2a');var _0x45fbe6=_0x193e5e['count'];var _0x21b89a=_0x4f4d2e?0x0:_0x2aceae[_0xbe0b('0x29')];var _0x7e9f08=_0x4f4d2e?_0x193e5e[_0xbe0b('0x2b')]:_0x2aceae[_0xbe0b('0x29')]+_0x2aceae[_0xbe0b('0x2c')];var _0x2a2e0e;if(_0x7e9f08>=_0x45fbe6){_0x7e9f08=_0x45fbe6;_0x2a2e0e=0xc8;}else{_0x2a2e0e=0xce;}_0x716d56['status'](_0x2a2e0e);return _0x716d56[_0xbe0b('0x2d')](_0xbe0b('0x2e'),_0x21b89a+'-'+_0x7e9f08+'/'+_0x45fbe6)[_0xbe0b('0x2f')](_0x193e5e);}return null;};}function patchUpdates(_0x2acceb){return function(_0x48267c){try{jsonpatch[_0xbe0b('0x30')](_0x48267c,_0x2acceb,!![]);}catch(_0x3f20a1){return BPromise[_0xbe0b('0x31')](_0x3f20a1);}return _0x48267c[_0xbe0b('0x32')]();};}function saveUpdates(_0x524530,_0x407986){return function(_0x469e0a){if(_0x469e0a){return _0x469e0a[_0xbe0b('0x33')](_0x524530)['then'](function(_0xfee773){return _0xfee773;});}return null;};}function removeEntity(_0x1761de,_0x11e4d3){return function(_0x361c77){if(_0x361c77){return _0x361c77[_0xbe0b('0x34')]()[_0xbe0b('0x1c')](function(){_0x1761de['status'](0xcc)[_0xbe0b('0x27')]();});}};}function handleEntityNotFound(_0x23056d,_0x736bb2){return function(_0x206211){if(!_0x206211){_0x23056d['sendStatus'](0x194);}return _0x206211;};}function handleError(_0x3d26ee,_0x15e8a7){_0x15e8a7=_0x15e8a7||0x1f4;return function(_0x5a0233){logger[_0xbe0b('0x22')](_0x5a0233['stack']);if(_0x5a0233['name']){delete _0x5a0233[_0xbe0b('0x35')];}_0x3d26ee[_0xbe0b('0x28')](_0x15e8a7)[_0xbe0b('0x36')](_0x5a0233);};}exports['index']=function(_0x5c68bc,_0x44a906){var _0x46bc77={},_0x342758={},_0x57fbf0={'count':0x0,'rows':[]};var _0x90a587=_['map'](db[_0xbe0b('0x37')][_0xbe0b('0x38')],function(_0x1c4600){return{'name':_0x1c4600[_0xbe0b('0x39')],'type':_0x1c4600[_0xbe0b('0x3a')][_0xbe0b('0x3b')]};});_0x342758[_0xbe0b('0x3c')]=_[_0xbe0b('0x3d')](_0x90a587,_0xbe0b('0x35'));_0x342758['query']=_[_0xbe0b('0x3e')](_0x5c68bc[_0xbe0b('0x3f')]);_0x342758[_0xbe0b('0x40')]=_['intersection'](_0x342758[_0xbe0b('0x3c')],_0x342758[_0xbe0b('0x3f')]);_0x46bc77[_0xbe0b('0x41')]=_[_0xbe0b('0x42')](_0x342758[_0xbe0b('0x3c')],qs[_0xbe0b('0x43')](_0x5c68bc['query']['fields']));_0x46bc77['attributes']=_0x46bc77['attributes'][_0xbe0b('0x44')]?_0x46bc77['attributes']:_0x342758['model'];if(!_0x5c68bc[_0xbe0b('0x3f')][_0xbe0b('0x45')](_0xbe0b('0x46'))){_0x46bc77['limit']=qs[_0xbe0b('0x2c')](_0x5c68bc[_0xbe0b('0x3f')]['limit']);_0x46bc77[_0xbe0b('0x29')]=qs[_0xbe0b('0x29')](_0x5c68bc[_0xbe0b('0x3f')]['offset']);}_0x46bc77[_0xbe0b('0x47')]=qs[_0xbe0b('0x48')](_0x5c68bc['query']['sort']);_0x46bc77['where']=qs['filters'](_[_0xbe0b('0x49')](_0x5c68bc[_0xbe0b('0x3f')],_0x342758[_0xbe0b('0x40')]),_0x90a587);if(_0x5c68bc[_0xbe0b('0x3f')]['filter']){_0x46bc77[_0xbe0b('0x4a')]=_['merge'](_0x46bc77[_0xbe0b('0x4a')],{'$or':_[_0xbe0b('0x3d')](_0x90a587,function(_0x25e820){if(_0x25e820[_0xbe0b('0x3a')]!==_0xbe0b('0x4b')){var _0x4dca58={};_0x4dca58[_0x25e820[_0xbe0b('0x35')]]={'$like':'%'+_0x5c68bc[_0xbe0b('0x3f')][_0xbe0b('0x4c')]+'%'};return _0x4dca58;}})});}_0x46bc77=_[_0xbe0b('0x4d')]({},_0x46bc77,_0x5c68bc['options']);var _0xeeb3cc={'where':_0x46bc77[_0xbe0b('0x4a')]};return db['OpenchannelMessage'][_0xbe0b('0x2b')](_0xeeb3cc)[_0xbe0b('0x1c')](function(_0x1d9deb){_0x57fbf0[_0xbe0b('0x2b')]=_0x1d9deb;if(_0x5c68bc[_0xbe0b('0x3f')][_0xbe0b('0x4e')]){_0x46bc77[_0xbe0b('0x4f')]=[{'all':!![]}];}return db[_0xbe0b('0x37')]['findAll'](_0x46bc77);})['then'](function(_0x542866){_0x57fbf0['rows']=_0x542866;return _0x57fbf0;})[_0xbe0b('0x1c')](respondWithFilteredResult(_0x44a906,_0x46bc77))['catch'](handleError(_0x44a906,null));};exports['show']=function(_0x1013c8,_0xcc9154){var _0x254a2b={'raw':!![],'where':{'id':_0x1013c8[_0xbe0b('0x50')]['id']}},_0x12f96c={};_0x12f96c[_0xbe0b('0x3c')]=_['keys'](db[_0xbe0b('0x37')]['rawAttributes']);_0x12f96c[_0xbe0b('0x3f')]=_[_0xbe0b('0x3e')](_0x1013c8[_0xbe0b('0x3f')]);_0x12f96c[_0xbe0b('0x40')]=_[_0xbe0b('0x42')](_0x12f96c[_0xbe0b('0x3c')],_0x12f96c[_0xbe0b('0x3f')]);_0x254a2b[_0xbe0b('0x41')]=_[_0xbe0b('0x42')](_0x12f96c['model'],qs['fields'](_0x1013c8[_0xbe0b('0x3f')][_0xbe0b('0x43')]));_0x254a2b[_0xbe0b('0x41')]=_0x254a2b[_0xbe0b('0x41')]['length']?_0x254a2b[_0xbe0b('0x41')]:_0x12f96c[_0xbe0b('0x3c')];if(_0x1013c8[_0xbe0b('0x3f')][_0xbe0b('0x4e')]){_0x254a2b[_0xbe0b('0x4f')]=[{'all':!![]}];}_0x254a2b=_['merge']({},_0x254a2b,_0x1013c8[_0xbe0b('0x51')]);return db[_0xbe0b('0x37')][_0xbe0b('0x52')](_0x254a2b)[_0xbe0b('0x1c')](handleEntityNotFound(_0xcc9154,null))[_0xbe0b('0x1c')](respondWithResult(_0xcc9154,null))[_0xbe0b('0x25')](handleError(_0xcc9154,null));};exports[_0xbe0b('0x53')]=function(_0x3e736b,_0x2ad505){return db[_0xbe0b('0x37')][_0xbe0b('0x53')](_0x3e736b[_0xbe0b('0x54')],{})[_0xbe0b('0x1c')](respondWithResult(_0x2ad505,0xc9))[_0xbe0b('0x25')](handleError(_0x2ad505,null));};exports[_0xbe0b('0x33')]=function(_0x346f16,_0x58c2fd){if(_0x346f16[_0xbe0b('0x54')]['id']){delete _0x346f16[_0xbe0b('0x54')]['id'];}return db[_0xbe0b('0x37')]['find']({'where':{'id':_0x346f16[_0xbe0b('0x50')]['id']}})[_0xbe0b('0x1c')](handleEntityNotFound(_0x58c2fd,null))[_0xbe0b('0x1c')](saveUpdates(_0x346f16[_0xbe0b('0x54')],null))['then'](respondWithResult(_0x58c2fd,null))[_0xbe0b('0x25')](handleError(_0x58c2fd,null));};exports[_0xbe0b('0x34')]=function(_0x2573aa,_0x2b4591){return db[_0xbe0b('0x37')]['find']({'where':{'id':_0x2573aa[_0xbe0b('0x50')]['id']}})[_0xbe0b('0x1c')](handleEntityNotFound(_0x2b4591,null))[_0xbe0b('0x1c')](removeEntity(_0x2b4591,null))['catch'](handleError(_0x2b4591,null));};exports[_0xbe0b('0x55')]=function(_0x45153f,_0x38034a){return db[_0xbe0b('0x37')]['describe']()['then'](respondWithResult(_0x38034a,null))[_0xbe0b('0x25')](handleError(_0x38034a,null));};var interaction_log=require(_0xbe0b('0x56'))('openchannel-interactions');exports[_0xbe0b('0x57')]=function(_0x1a809b,_0xce4ee8,_0x110ebe){var _0x42e6c3={'agent':{},'channel':'openchannel'};if(_0x1a809b[_0xbe0b('0x54')]['id']){delete _0x1a809b[_0xbe0b('0x54')]['id'];}_0x1a809b[_0xbe0b('0x54')][_0xbe0b('0x58')]=!![];_0x1a809b[_0xbe0b('0x54')]['readAt']=moment()[_0xbe0b('0x59')](_0xbe0b('0x5a'));_0x1a809b[_0xbe0b('0x54')][_0xbe0b('0x5b')]=_0x1a809b[_0xbe0b('0x54')][_0xbe0b('0x5b')]||_0x1a809b[_0xbe0b('0x5c')]['id'];_0x42e6c3[_0xbe0b('0x5d')]['id']=_0x1a809b[_0xbe0b('0x54')][_0xbe0b('0x5b')];return db['OpenchannelMessage'][_0xbe0b('0x52')]({'where':{'id':_0x1a809b['params']['id'],'UserId':null}})[_0xbe0b('0x1c')](handleEntityNotFound(_0xce4ee8,null))['then'](saveUpdates(_0x1a809b[_0xbe0b('0x54')],null))[_0xbe0b('0x1c')](function(_0x3b348b){if(_0x3b348b){_0x42e6c3['message']=_0x3b348b[_0xbe0b('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0xbe0b('0x52')]({'where':{'id':_0x3b348b[_0xbe0b('0x5f')]}});}return null;})[_0xbe0b('0x1c')](handleEntityNotFound(_0xce4ee8,null))[_0xbe0b('0x1c')](function(_0x3b9f17){if(_0x3b9f17){return _0x3b9f17[_0xbe0b('0x33')]({'UserId':_0x1a809b[_0xbe0b('0x54')]['UserId'],'read1stAt':_[_0xbe0b('0x60')](_0x3b9f17[_0xbe0b('0x61')])?moment()['format'](_0xbe0b('0x5a')):undefined});}return null;})[_0xbe0b('0x1c')](function(_0x59a881){if(_0x59a881){_0x42e6c3[_0xbe0b('0x62')]=_0x59a881[_0xbe0b('0x5e')]({'plain':!![]});interaction_log[_0xbe0b('0x1d')](_0xbe0b('0x63'),_0x1a809b['user']['id'],_0x1a809b['user'][_0xbe0b('0x35')],_0x1a809b[_0xbe0b('0x5c')][_0xbe0b('0x64')],_0x42e6c3['interaction']['id'],_0x1a809b['body']?JSON['stringify'](_0x1a809b[_0xbe0b('0x54')]):_0xbe0b('0x65'));return respondWithRpcPromise(_0xbe0b('0x66'),_0xbe0b('0x67'),_0x42e6c3);}return null;})[_0xbe0b('0x1c')](function(_0x4d18cb){var _0x20f1c1=_0xbe0b('0x68')+_0x4d18cb[_0xbe0b('0x23')][_0xbe0b('0x69')];return db['sequelize'][_0xbe0b('0x3f')](_0x20f1c1,{'type':db[_0xbe0b('0x6a')][_0xbe0b('0x6b')][_0xbe0b('0x6c')],'raw':!![]})[_0xbe0b('0x1c')](function(_0x43575e){return _0x43575e;});})[_0xbe0b('0x1c')](function(_0x52b4d1){if(_0x52b4d1){_0x42e6c3[_0xbe0b('0x23')][_0xbe0b('0x6d')]=_0x52b4d1[0x0];if(!_0x1a809b[_0xbe0b('0x54')]['UserId'])return;return db[_0xbe0b('0x6e')]['find']({'where':{'id':_0x1a809b[_0xbe0b('0x54')][_0xbe0b('0x5b')],'role':_0xbe0b('0x5d')},'attributes':['id',_0xbe0b('0x35'),_0xbe0b('0x6f'),_0xbe0b('0x70'),'internal'],'raw':!![]});}return null;})['then'](function(_0x42fb7f){if(!_0x42fb7f)return null;_0x42e6c3[_0xbe0b('0x23')][_0xbe0b('0x5d')]=_0x42fb7f;return _0x42e6c3;})[_0xbe0b('0x1c')](function(_0x550171){if(_0x550171){if(_0x1a809b['body'][_0xbe0b('0x71')]){_0x42e6c3['message']['interface']=util[_0xbe0b('0x59')](_0xbe0b('0x72'),_0x1a809b[_0xbe0b('0x5c')][_0xbe0b('0x35')]);_0x42e6c3[_0xbe0b('0x23')]['channel']=_0x42e6c3[_0xbe0b('0x73')];_0x42e6c3[_0xbe0b('0x23')]['motionChannel']=_0x42e6c3[_0xbe0b('0x73')];_0x42e6c3[_0xbe0b('0x23')][_0xbe0b('0x74')]=_0xbe0b('0x57');return respondWithRpcPromise(_0xbe0b('0x75'),_0xbe0b('0x75'),{'event':'acceptmessage','message':_0x42e6c3[_0xbe0b('0x23')]},client9002)['then'](function(){return _0x42e6c3;});}return _0x42e6c3;}return null;})[_0xbe0b('0x1c')](respondWithResult(_0xce4ee8,null))[_0xbe0b('0x25')](handleError(_0xce4ee8,null));};var interaction_log=require(_0xbe0b('0x56'))('openchannel-interactions');exports[_0xbe0b('0x31')]=function(_0x6e59f5,_0x2af8d1,_0x1692d0){var _0x153daf={'agent':{},'channel':'openchannel'};if(_0x6e59f5['body']['id']){delete _0x6e59f5[_0xbe0b('0x54')]['id'];}_0x6e59f5[_0xbe0b('0x54')][_0xbe0b('0x5b')]=_0x6e59f5[_0xbe0b('0x54')][_0xbe0b('0x5b')]||_0x6e59f5[_0xbe0b('0x5c')]['id'];_0x153daf['agent']['id']=_0x6e59f5['body'][_0xbe0b('0x5b')];return db[_0xbe0b('0x37')][_0xbe0b('0x52')]({'where':{'id':_0x6e59f5[_0xbe0b('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2af8d1,null))[_0xbe0b('0x1c')](function(_0x37b899){if(_0x37b899){_0x153daf[_0xbe0b('0x23')]=_0x37b899[_0xbe0b('0x5e')]({'plain':!![]});return db[_0xbe0b('0x76')][_0xbe0b('0x52')]({'where':{'id':_0x37b899[_0xbe0b('0x5f')]}});}return null;})[_0xbe0b('0x1c')](handleEntityNotFound(_0x2af8d1,null))['then'](function(_0x5b9d1a){if(_0x5b9d1a){_0x153daf[_0xbe0b('0x62')]=_0x5b9d1a[_0xbe0b('0x5e')]({'plain':!![]});interaction_log[_0xbe0b('0x1d')](_0xbe0b('0x77'),_0x6e59f5[_0xbe0b('0x5c')]['id'],_0x6e59f5['user'][_0xbe0b('0x35')],_0x6e59f5[_0xbe0b('0x5c')][_0xbe0b('0x64')],_0x153daf['interaction']['id'],_0x6e59f5[_0xbe0b('0x54')]?JSON[_0xbe0b('0x21')](_0x6e59f5['body']):_0xbe0b('0x65'));return respondWithRpcPromise(_0xbe0b('0x78'),_0xbe0b('0x79'),_0x153daf);}return null;})[_0xbe0b('0x1c')](function(_0x16d0a6){var _0x4a1b57=_0xbe0b('0x68')+_0x16d0a6[_0xbe0b('0x23')][_0xbe0b('0x69')];return db[_0xbe0b('0x7a')][_0xbe0b('0x3f')](_0x4a1b57,{'type':db[_0xbe0b('0x6a')][_0xbe0b('0x6b')][_0xbe0b('0x6c')],'raw':!![]})[_0xbe0b('0x1c')](function(_0x132231){return _0x132231;});})[_0xbe0b('0x1c')](function(_0x34874f){if(_0x34874f){_0x153daf['message']['contact']=_0x34874f[0x0];if(!_0x6e59f5['body'][_0xbe0b('0x5b')])return;return db[_0xbe0b('0x6e')][_0xbe0b('0x52')]({'where':{'id':_0x6e59f5[_0xbe0b('0x54')][_0xbe0b('0x5b')],'role':_0xbe0b('0x5d')},'attributes':['id',_0xbe0b('0x35'),_0xbe0b('0x6f'),_0xbe0b('0x70'),_0xbe0b('0x7b')],'raw':!![]});}return null;})[_0xbe0b('0x1c')](function(_0x2e7ba5){if(!_0x2e7ba5)return null;_0x153daf[_0xbe0b('0x23')][_0xbe0b('0x5d')]=_0x2e7ba5;return _0x153daf;})['then'](function(_0x4089a6){if(_0x4089a6){_0x4089a6[_0xbe0b('0x23')][_0xbe0b('0x7c')]=util[_0xbe0b('0x59')]('SIP/%s',_0x6e59f5[_0xbe0b('0x5c')][_0xbe0b('0x35')]);_0x4089a6[_0xbe0b('0x23')][_0xbe0b('0x73')]=_0x153daf['channel'];_0x4089a6['message'][_0xbe0b('0x7d')]=_0x153daf['channel'];_0x4089a6[_0xbe0b('0x23')][_0xbe0b('0x74')]='reject';respondWithRpcPromise('EventManager',_0xbe0b('0x75'),{'event':_0xbe0b('0x7e'),'message':_0x4089a6[_0xbe0b('0x23')]},client9002);return _0x153daf;}return null;})[_0xbe0b('0x1c')](respondWithResult(_0x2af8d1,null))['catch'](handleError(_0x2af8d1,null));}; \ No newline at end of file +var _0x39ed=['papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','status','end','json','offset','undefined','limit','count','set','reject','update','destroy','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','sort','where','pick','filter','merge','options','include','length','includeAll','find','create','body','params','describe','openchannel-interactions','accept','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','format','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','internal','manual','interface','channel','motionChannel','event','EventManager','RejectMessage','contact','User','fullname','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x563b5b,_0x5d5a3c){var _0x5449d1=function(_0x44f173){while(--_0x44f173){_0x563b5b['push'](_0x563b5b['shift']());}};_0x5449d1(++_0x5d5a3c);}(_0x39ed,0x155));var _0xd39e=function(_0x2b41f3,_0x44a859){_0x2b41f3=_0x2b41f3-0x0;var _0x298fff=_0x39ed[_0x2b41f3];return _0x298fff;};'use strict';var emlformat=require(_0xd39e('0x0'));var rimraf=require(_0xd39e('0x1'));var zipdir=require(_0xd39e('0x2'));var jsonpatch=require(_0xd39e('0x3'));var rp=require(_0xd39e('0x4'));var moment=require(_0xd39e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd39e('0x6'));var path=require(_0xd39e('0x7'));var sox=require(_0xd39e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd39e('0x9'));var _=require(_0xd39e('0xa'));var squel=require(_0xd39e('0xb'));var crypto=require(_0xd39e('0xc'));var jsforce=require(_0xd39e('0xd'));var deskjs=require(_0xd39e('0xe'));var toCsv=require(_0xd39e('0xf'));var querystring=require('querystring');var Papa=require(_0xd39e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd39e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd39e('0x12'));var logger=require(_0xd39e('0x13'))('api');var utils=require(_0xd39e('0x14'));var config=require(_0xd39e('0x15'));var licenseUtil=require(_0xd39e('0x16'));var db=require('../../mysqldb')['db'];config[_0xd39e('0x17')]=_[_0xd39e('0x18')](config['redis'],{'host':_0xd39e('0x19'),'port':0x18eb});var socket=require(_0xd39e('0x1a'))(new Redis(config['redis']));require(_0xd39e('0x1b'))['register'](socket);var jayson=require(_0xd39e('0x1c'));var client=jayson[_0xd39e('0x1d')][_0xd39e('0x1e')]({'port':0x232c});var client9002=jayson[_0xd39e('0x1d')][_0xd39e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3aecf9,_0x510637,_0x156fc8,_0x373693){return new BPromise(function(_0x5ec6d9,_0x4a19af){var _0x487e89=_0x373693||client;return _0x487e89['request'](_0x3aecf9,_0x156fc8)[_0xd39e('0x1f')](function(_0xa54780){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x510637,_0xd39e('0x20'));logger[_0xd39e('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x510637,'request\x20sent',JSON[_0xd39e('0x22')](_0xa54780));if(_0xa54780[_0xd39e('0x23')]){if(_0xa54780[_0xd39e('0x23')]['code']===0x1f4){logger[_0xd39e('0x23')](_0xd39e('0x24'),_0x510637,_0xa54780[_0xd39e('0x23')]['message']);return _0x4a19af(_0xa54780['error'][_0xd39e('0x25')]);}logger[_0xd39e('0x23')](_0xd39e('0x24'),_0x510637,_0xa54780['error']['message']);return _0x5ec6d9(_0xa54780[_0xd39e('0x23')][_0xd39e('0x25')]);}else{logger[_0xd39e('0x26')](_0xd39e('0x24'),_0x510637,_0xd39e('0x20'));_0x5ec6d9(_0xa54780[_0xd39e('0x27')][_0xd39e('0x25')]);}})[_0xd39e('0x28')](function(_0x58bd51){logger[_0xd39e('0x23')](_0xd39e('0x24'),_0x510637,_0x58bd51);_0x4a19af(_0x58bd51);});});}function respondWithStatusCode(_0x49b731,_0x3776d1){_0x3776d1=_0x3776d1||0xcc;return function(_0x679dae){if(_0x679dae){return _0x49b731['sendStatus'](_0x3776d1);}return _0x49b731[_0xd39e('0x29')](_0x3776d1)[_0xd39e('0x2a')]();};}function respondWithResult(_0x17a747,_0x421ef0){_0x421ef0=_0x421ef0||0xc8;return function(_0x25002f){if(_0x25002f){return _0x17a747['status'](_0x421ef0)[_0xd39e('0x2b')](_0x25002f);}};}function respondWithFilteredResult(_0x26bb6d,_0xee0e03){return function(_0x4e0481){if(_0x4e0481){var _0x8f4f18=typeof _0xee0e03[_0xd39e('0x2c')]===_0xd39e('0x2d')&&typeof _0xee0e03[_0xd39e('0x2e')]==='undefined';var _0x1b03c0=_0x4e0481[_0xd39e('0x2f')];var _0x4984a0=_0x8f4f18?0x0:_0xee0e03[_0xd39e('0x2c')];var _0x1107b8=_0x8f4f18?_0x4e0481[_0xd39e('0x2f')]:_0xee0e03[_0xd39e('0x2c')]+_0xee0e03[_0xd39e('0x2e')];var _0x44b534;if(_0x1107b8>=_0x1b03c0){_0x1107b8=_0x1b03c0;_0x44b534=0xc8;}else{_0x44b534=0xce;}_0x26bb6d[_0xd39e('0x29')](_0x44b534);return _0x26bb6d[_0xd39e('0x30')]('Content-Range',_0x4984a0+'-'+_0x1107b8+'/'+_0x1b03c0)[_0xd39e('0x2b')](_0x4e0481);}return null;};}function patchUpdates(_0x186db0){return function(_0xfea70b){try{jsonpatch['apply'](_0xfea70b,_0x186db0,!![]);}catch(_0x217478){return BPromise[_0xd39e('0x31')](_0x217478);}return _0xfea70b['save']();};}function saveUpdates(_0xe12ce0,_0x56c4f7){return function(_0x246fe1){if(_0x246fe1){return _0x246fe1[_0xd39e('0x32')](_0xe12ce0)[_0xd39e('0x1f')](function(_0x241189){return _0x241189;});}return null;};}function removeEntity(_0x59593d,_0x54281a){return function(_0x4fc918){if(_0x4fc918){return _0x4fc918[_0xd39e('0x33')]()[_0xd39e('0x1f')](function(){_0x59593d[_0xd39e('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2abd42,_0x2a613e){return function(_0x12ab4b){if(!_0x12ab4b){_0x2abd42[_0xd39e('0x34')](0x194);}return _0x12ab4b;};}function handleError(_0x218957,_0x559943){_0x559943=_0x559943||0x1f4;return function(_0x5bc93e){logger[_0xd39e('0x23')](_0x5bc93e[_0xd39e('0x35')]);if(_0x5bc93e[_0xd39e('0x36')]){delete _0x5bc93e[_0xd39e('0x36')];}_0x218957[_0xd39e('0x29')](_0x559943)['send'](_0x5bc93e);};}exports[_0xd39e('0x37')]=function(_0x584b6f,_0x331488){var _0x2b0f30={},_0x163877={},_0x39442b={'count':0x0,'rows':[]};var _0x448f8c=_[_0xd39e('0x38')](db[_0xd39e('0x39')][_0xd39e('0x3a')],function(_0x5cb68a){return{'name':_0x5cb68a[_0xd39e('0x3b')],'type':_0x5cb68a[_0xd39e('0x3c')][_0xd39e('0x3d')]};});_0x163877['model']=_[_0xd39e('0x38')](_0x448f8c,_0xd39e('0x36'));_0x163877[_0xd39e('0x3e')]=_[_0xd39e('0x3f')](_0x584b6f[_0xd39e('0x3e')]);_0x163877[_0xd39e('0x40')]=_[_0xd39e('0x41')](_0x163877['model'],_0x163877[_0xd39e('0x3e')]);_0x2b0f30[_0xd39e('0x42')]=_[_0xd39e('0x41')](_0x163877[_0xd39e('0x43')],qs[_0xd39e('0x44')](_0x584b6f[_0xd39e('0x3e')]['fields']));_0x2b0f30[_0xd39e('0x42')]=_0x2b0f30['attributes']['length']?_0x2b0f30[_0xd39e('0x42')]:_0x163877[_0xd39e('0x43')];if(!_0x584b6f[_0xd39e('0x3e')]['hasOwnProperty'](_0xd39e('0x45'))){_0x2b0f30[_0xd39e('0x2e')]=qs[_0xd39e('0x2e')](_0x584b6f[_0xd39e('0x3e')]['limit']);_0x2b0f30['offset']=qs[_0xd39e('0x2c')](_0x584b6f['query'][_0xd39e('0x2c')]);}_0x2b0f30['order']=qs[_0xd39e('0x46')](_0x584b6f[_0xd39e('0x3e')][_0xd39e('0x46')]);_0x2b0f30[_0xd39e('0x47')]=qs[_0xd39e('0x40')](_[_0xd39e('0x48')](_0x584b6f[_0xd39e('0x3e')],_0x163877[_0xd39e('0x40')]),_0x448f8c);if(_0x584b6f[_0xd39e('0x3e')][_0xd39e('0x49')]){_0x2b0f30[_0xd39e('0x47')]=_['merge'](_0x2b0f30[_0xd39e('0x47')],{'$or':_[_0xd39e('0x38')](_0x448f8c,function(_0x151a33){if(_0x151a33[_0xd39e('0x3c')]!=='VIRTUAL'){var _0x57628f={};_0x57628f[_0x151a33[_0xd39e('0x36')]]={'$like':'%'+_0x584b6f[_0xd39e('0x3e')][_0xd39e('0x49')]+'%'};return _0x57628f;}})});}_0x2b0f30=_[_0xd39e('0x4a')]({},_0x2b0f30,_0x584b6f[_0xd39e('0x4b')]);var _0x373fb3={'where':_0x2b0f30[_0xd39e('0x47')]};return db[_0xd39e('0x39')][_0xd39e('0x2f')](_0x373fb3)[_0xd39e('0x1f')](function(_0x2be7e9){_0x39442b[_0xd39e('0x2f')]=_0x2be7e9;if(_0x584b6f[_0xd39e('0x3e')]['includeAll']){_0x2b0f30[_0xd39e('0x4c')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x2b0f30);})[_0xd39e('0x1f')](function(_0x75c984){_0x39442b['rows']=_0x75c984;return _0x39442b;})['then'](respondWithFilteredResult(_0x331488,_0x2b0f30))[_0xd39e('0x28')](handleError(_0x331488,null));};exports['show']=function(_0x3b56bc,_0x488778){var _0x8b8d4b={'raw':!![],'where':{'id':_0x3b56bc['params']['id']}},_0x1b94ce={};_0x1b94ce[_0xd39e('0x43')]=_[_0xd39e('0x3f')](db['OpenchannelMessage']['rawAttributes']);_0x1b94ce[_0xd39e('0x3e')]=_['keys'](_0x3b56bc[_0xd39e('0x3e')]);_0x1b94ce['filters']=_[_0xd39e('0x41')](_0x1b94ce['model'],_0x1b94ce[_0xd39e('0x3e')]);_0x8b8d4b['attributes']=_['intersection'](_0x1b94ce[_0xd39e('0x43')],qs[_0xd39e('0x44')](_0x3b56bc[_0xd39e('0x3e')][_0xd39e('0x44')]));_0x8b8d4b[_0xd39e('0x42')]=_0x8b8d4b['attributes'][_0xd39e('0x4d')]?_0x8b8d4b[_0xd39e('0x42')]:_0x1b94ce[_0xd39e('0x43')];if(_0x3b56bc['query'][_0xd39e('0x4e')]){_0x8b8d4b[_0xd39e('0x4c')]=[{'all':!![]}];}_0x8b8d4b=_[_0xd39e('0x4a')]({},_0x8b8d4b,_0x3b56bc[_0xd39e('0x4b')]);return db[_0xd39e('0x39')][_0xd39e('0x4f')](_0x8b8d4b)['then'](handleEntityNotFound(_0x488778,null))[_0xd39e('0x1f')](respondWithResult(_0x488778,null))['catch'](handleError(_0x488778,null));};exports[_0xd39e('0x50')]=function(_0x4cedb3,_0x43dab2){return db['OpenchannelMessage']['create'](_0x4cedb3[_0xd39e('0x51')],{})[_0xd39e('0x1f')](respondWithResult(_0x43dab2,0xc9))[_0xd39e('0x28')](handleError(_0x43dab2,null));};exports[_0xd39e('0x32')]=function(_0x5866fa,_0x2c2af8){if(_0x5866fa[_0xd39e('0x51')]['id']){delete _0x5866fa[_0xd39e('0x51')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x5866fa['params']['id']}})[_0xd39e('0x1f')](handleEntityNotFound(_0x2c2af8,null))[_0xd39e('0x1f')](saveUpdates(_0x5866fa[_0xd39e('0x51')],null))[_0xd39e('0x1f')](respondWithResult(_0x2c2af8,null))[_0xd39e('0x28')](handleError(_0x2c2af8,null));};exports[_0xd39e('0x33')]=function(_0x26b80f,_0x2b5f16){return db[_0xd39e('0x39')][_0xd39e('0x4f')]({'where':{'id':_0x26b80f[_0xd39e('0x52')]['id']}})[_0xd39e('0x1f')](handleEntityNotFound(_0x2b5f16,null))[_0xd39e('0x1f')](removeEntity(_0x2b5f16,null))[_0xd39e('0x28')](handleError(_0x2b5f16,null));};exports[_0xd39e('0x53')]=function(_0x2860f7,_0x5b60f6){return db[_0xd39e('0x39')][_0xd39e('0x53')]()[_0xd39e('0x1f')](respondWithResult(_0x5b60f6,null))['catch'](handleError(_0x5b60f6,null));};var interaction_log=require(_0xd39e('0x13'))(_0xd39e('0x54'));exports[_0xd39e('0x55')]=function(_0x40cf4,_0x3eb301,_0x2c5c34){var _0x10f207={'agent':{},'channel':'openchannel'};if(_0x40cf4[_0xd39e('0x51')]['id']){delete _0x40cf4[_0xd39e('0x51')]['id'];}_0x40cf4[_0xd39e('0x51')]['read']=!![];_0x40cf4[_0xd39e('0x51')]['readAt']=moment()['format'](_0xd39e('0x56'));_0x40cf4[_0xd39e('0x51')][_0xd39e('0x57')]=_0x40cf4['body'][_0xd39e('0x57')]||_0x40cf4[_0xd39e('0x58')]['id'];_0x10f207[_0xd39e('0x59')]['id']=_0x40cf4[_0xd39e('0x51')][_0xd39e('0x57')];return db[_0xd39e('0x39')][_0xd39e('0x4f')]({'where':{'id':_0x40cf4[_0xd39e('0x52')]['id'],'UserId':null}})[_0xd39e('0x1f')](handleEntityNotFound(_0x3eb301,null))['then'](saveUpdates(_0x40cf4['body'],null))[_0xd39e('0x1f')](function(_0x197746){if(_0x197746){_0x10f207[_0xd39e('0x25')]=_0x197746[_0xd39e('0x5a')]({'plain':!![]});return db[_0xd39e('0x5b')]['find']({'where':{'id':_0x197746['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3eb301,null))['then'](function(_0x369b37){if(_0x369b37){return _0x369b37[_0xd39e('0x32')]({'UserId':_0x40cf4['body'][_0xd39e('0x57')],'read1stAt':_['isNil'](_0x369b37['read1stAt'])?moment()[_0xd39e('0x5c')](_0xd39e('0x56')):undefined});}return null;})[_0xd39e('0x1f')](function(_0x14c13e){if(_0x14c13e){_0x10f207['interaction']=_0x14c13e['get']({'plain':!![]});interaction_log[_0xd39e('0x26')](_0xd39e('0x5d'),_0x40cf4[_0xd39e('0x58')]['id'],_0x40cf4[_0xd39e('0x58')][_0xd39e('0x36')],_0x40cf4['user'][_0xd39e('0x5e')],_0x10f207[_0xd39e('0x5f')]['id'],_0x40cf4[_0xd39e('0x51')]?JSON[_0xd39e('0x22')](_0x40cf4['body']):_0xd39e('0x60'));return respondWithRpcPromise(_0xd39e('0x61'),_0xd39e('0x62'),_0x10f207);}return null;})[_0xd39e('0x1f')](function(_0x37c3c7){var _0x20816f=_0xd39e('0x63')+_0x37c3c7[_0xd39e('0x25')][_0xd39e('0x64')];return db[_0xd39e('0x65')][_0xd39e('0x3e')](_0x20816f,{'type':db[_0xd39e('0x66')][_0xd39e('0x67')][_0xd39e('0x68')],'raw':!![]})[_0xd39e('0x1f')](function(_0x37da34){return _0x37da34;});})[_0xd39e('0x1f')](function(_0x2a1ed5){if(_0x2a1ed5){_0x10f207[_0xd39e('0x25')]['contact']=_0x2a1ed5[0x0];if(!_0x40cf4['body'][_0xd39e('0x57')])return;return db['User'][_0xd39e('0x4f')]({'where':{'id':_0x40cf4['body'][_0xd39e('0x57')],'role':_0xd39e('0x59')},'attributes':['id',_0xd39e('0x36'),'fullname',_0xd39e('0x69'),_0xd39e('0x6a')],'raw':!![]});}return null;})[_0xd39e('0x1f')](function(_0xec4237){if(!_0xec4237)return null;_0x10f207[_0xd39e('0x25')][_0xd39e('0x59')]=_0xec4237;return _0x10f207;})[_0xd39e('0x1f')](function(_0x815d08){if(_0x815d08){if(_0x40cf4[_0xd39e('0x51')][_0xd39e('0x6b')]){_0x10f207[_0xd39e('0x25')][_0xd39e('0x6c')]=util[_0xd39e('0x5c')]('SIP/%s',_0x40cf4[_0xd39e('0x58')][_0xd39e('0x36')]);_0x10f207['message'][_0xd39e('0x6d')]=_0x10f207[_0xd39e('0x6d')];_0x10f207[_0xd39e('0x25')][_0xd39e('0x6e')]=_0x10f207['channel'];_0x10f207[_0xd39e('0x25')][_0xd39e('0x6f')]=_0xd39e('0x55');return respondWithRpcPromise('EventManager',_0xd39e('0x70'),{'event':'acceptmessage','message':_0x10f207[_0xd39e('0x25')]},client9002)[_0xd39e('0x1f')](function(){return _0x10f207;});}return _0x10f207;}return null;})[_0xd39e('0x1f')](respondWithResult(_0x3eb301,null))[_0xd39e('0x28')](handleError(_0x3eb301,null));};var interaction_log=require(_0xd39e('0x13'))(_0xd39e('0x54'));exports['reject']=function(_0x39b34e,_0x30ae42,_0x14cac4){var _0x4afec1={'agent':{},'channel':'openchannel'};if(_0x39b34e[_0xd39e('0x51')]['id']){delete _0x39b34e[_0xd39e('0x51')]['id'];}_0x39b34e[_0xd39e('0x51')][_0xd39e('0x57')]=_0x39b34e[_0xd39e('0x51')][_0xd39e('0x57')]||_0x39b34e[_0xd39e('0x58')]['id'];_0x4afec1[_0xd39e('0x59')]['id']=_0x39b34e['body'][_0xd39e('0x57')];return db[_0xd39e('0x39')]['find']({'where':{'id':_0x39b34e[_0xd39e('0x52')]['id'],'UserId':null}})[_0xd39e('0x1f')](handleEntityNotFound(_0x30ae42,null))[_0xd39e('0x1f')](function(_0x32cfad){if(_0x32cfad){_0x4afec1[_0xd39e('0x25')]=_0x32cfad[_0xd39e('0x5a')]({'plain':!![]});return db['OpenchannelInteraction'][_0xd39e('0x4f')]({'where':{'id':_0x32cfad['OpenchannelInteractionId']}});}return null;})[_0xd39e('0x1f')](handleEntityNotFound(_0x30ae42,null))[_0xd39e('0x1f')](function(_0x455396){if(_0x455396){_0x4afec1[_0xd39e('0x5f')]=_0x455396[_0xd39e('0x5a')]({'plain':!![]});interaction_log[_0xd39e('0x26')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x39b34e[_0xd39e('0x58')]['id'],_0x39b34e[_0xd39e('0x58')][_0xd39e('0x36')],_0x39b34e['user'][_0xd39e('0x5e')],_0x4afec1[_0xd39e('0x5f')]['id'],_0x39b34e['body']?JSON[_0xd39e('0x22')](_0x39b34e[_0xd39e('0x51')]):_0xd39e('0x60'));return respondWithRpcPromise(_0xd39e('0x71'),'rejectMessage',_0x4afec1);}return null;})['then'](function(_0x5aaaa8){var _0x50f36b=_0xd39e('0x63')+_0x5aaaa8['message'][_0xd39e('0x64')];return db[_0xd39e('0x65')][_0xd39e('0x3e')](_0x50f36b,{'type':db[_0xd39e('0x66')][_0xd39e('0x67')][_0xd39e('0x68')],'raw':!![]})[_0xd39e('0x1f')](function(_0x4d7338){return _0x4d7338;});})[_0xd39e('0x1f')](function(_0x12fdd8){if(_0x12fdd8){_0x4afec1[_0xd39e('0x25')][_0xd39e('0x72')]=_0x12fdd8[0x0];if(!_0x39b34e[_0xd39e('0x51')][_0xd39e('0x57')])return;return db[_0xd39e('0x73')][_0xd39e('0x4f')]({'where':{'id':_0x39b34e[_0xd39e('0x51')][_0xd39e('0x57')],'role':'agent'},'attributes':['id',_0xd39e('0x36'),_0xd39e('0x74'),_0xd39e('0x69'),_0xd39e('0x6a')],'raw':!![]});}return null;})['then'](function(_0x3b7a5f){if(!_0x3b7a5f)return null;_0x4afec1[_0xd39e('0x25')][_0xd39e('0x59')]=_0x3b7a5f;return _0x4afec1;})[_0xd39e('0x1f')](function(_0x15875f){if(_0x15875f){_0x15875f[_0xd39e('0x25')][_0xd39e('0x6c')]=util['format'](_0xd39e('0x75'),_0x39b34e['user'][_0xd39e('0x36')]);_0x15875f[_0xd39e('0x25')][_0xd39e('0x6d')]=_0x4afec1['channel'];_0x15875f[_0xd39e('0x25')][_0xd39e('0x6e')]=_0x4afec1['channel'];_0x15875f[_0xd39e('0x25')][_0xd39e('0x6f')]=_0xd39e('0x31');respondWithRpcPromise(_0xd39e('0x70'),_0xd39e('0x70'),{'event':_0xd39e('0x76'),'message':_0x15875f[_0xd39e('0x25')]},client9002);return _0x4afec1;}return null;})['then'](respondWithResult(_0x30ae42,null))['catch'](handleError(_0x30ae42,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index bafe092..ac300ef 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 _0x5366=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','update'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0x5366,0x1a3));var _0x6536=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x5366[_0x334841];return _0x5beb4b;};'use strict';var EventEmitter=require(_0x6536('0x0'));var OpenchannelMessage=require(_0x6536('0x1'))['db'][_0x6536('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6536('0x3'),'afterDestroy':_0x6536('0x4')};function emitEvent(_0x2c2873){return function(_0x48bb96,_0x3da40c,_0x4364de){OpenchannelMessageEvents[_0x6536('0x5')](_0x2c2873+':'+_0x48bb96['id'],_0x48bb96);OpenchannelMessageEvents[_0x6536('0x5')](_0x2c2873,_0x48bb96);_0x4364de(null);};}for(var e in events){if(events[_0x6536('0x6')](e)){var event=events[e];OpenchannelMessage[_0x6536('0x7')](e,emitEvent(event));}}module[_0x6536('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x1575=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x20f75c,_0x1d7774){var _0xea52d9=function(_0x3f4cae){while(--_0x3f4cae){_0x20f75c['push'](_0x20f75c['shift']());}};_0xea52d9(++_0x1d7774);}(_0x1575,0x9b));var _0x5157=function(_0x2d088e,_0x4cf89f){_0x2d088e=_0x2d088e-0x0;var _0x31166c=_0x1575[_0x2d088e];return _0x31166c;};'use strict';var EventEmitter=require(_0x5157('0x0'));var OpenchannelMessage=require(_0x5157('0x1'))['db'][_0x5157('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5157('0x3')](0x0);var events={'afterCreate':_0x5157('0x4'),'afterUpdate':'update','afterDestroy':_0x5157('0x5')};function emitEvent(_0x203527){return function(_0x5c5e5d,_0x34c7a,_0x25b260){OpenchannelMessageEvents['emit'](_0x203527+':'+_0x5c5e5d['id'],_0x5c5e5d);OpenchannelMessageEvents[_0x5157('0x6')](_0x203527,_0x5c5e5d);_0x25b260(null);};}for(var e in events){if(events[_0x5157('0x7')](e)){var event=events[e];OpenchannelMessage[_0x5157('0x8')](e,emitEvent(event));}}module[_0x5157('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c496263..e16fc36 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 _0x819d=['toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteractionId','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','Contact','POST','method','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','error','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','get','direction'];(function(_0x202fc0,_0x33aaab){var _0xa66398=function(_0x57c602){while(--_0x57c602){_0x202fc0['push'](_0x202fc0['shift']());}};_0xa66398(++_0x33aaab);}(_0x819d,0xc7));var _0xd819=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x819d[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xd819('0x0'));var util=require(_0xd819('0x1'));var logger=require(_0xd819('0x2'))(_0xd819('0x3'));var moment=require(_0xd819('0x4'));var BPromise=require(_0xd819('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd819('0x6'));var rimraf=require(_0xd819('0x7'));var config=require(_0xd819('0x8'));var attributes=require(_0xd819('0x9'));module[_0xd819('0xa')]=function(_0x13c47e,_0x42ac85){return _0x13c47e['define'](_0xd819('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xd819('0xc'),'fields':[_0xd819('0xd')],'type':_0xd819('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11496a,_0x2175de,_0x19be38){var _0x2799c0=_0x13c47e['models'];var _0x9bfdab=_0x11496a[_0xd819('0xf')]({'plain':!![]});if(_0x9bfdab[_0xd819('0x10')][_0xd819('0x11')]()==='in'||_0x9bfdab['direction']['toLowerCase']()===_0xd819('0x12')&&!_0x9bfdab[_0xd819('0x13')]&&!_[_0xd819('0x14')](_0x9bfdab[_0xd819('0x15')])){_0x2799c0[_0xd819('0x16')][_0xd819('0x17')]({'where':{'id':_0x9bfdab['OpenchannelInteractionId']}})[_0xd819('0x18')](function(_0xff2371){if(_0xff2371){_0xff2371[_0xd819('0x19')]({'lastMsgAt':_0x9bfdab[_0xd819('0x1a')],'lastMsgDirection':_0x9bfdab[_0xd819('0x10')][_0xd819('0x11')]()});}})[_0xd819('0x1b')](function(_0x1129ae){console['error'](_0x1129ae);});}if(_0x9bfdab[_0xd819('0x10')]===_0xd819('0x12')&&!_0x9bfdab['secret']){var _0x1eff7d;_0x2799c0[_0xd819('0x1c')][_0xd819('0x1d')]()[_0xd819('0x18')](function(_0xff04e0){return _0x2799c0[_0xd819('0x1e')][_0xd819('0x1f')]({'where':{'id':_0x9bfdab[_0xd819('0x20')]},'include':[{'model':_0x2799c0[_0xd819('0x16')],'as':'Interactions','where':{'id':_0x9bfdab[_0xd819('0x21')]},'limit':0x1,'include':[{'model':_0x2799c0['CmContact'],'as':'Contact','attributes':_['keys'](_0xff04e0)}]}]});})[_0xd819('0x18')](function(_0x4687f0){_0x1eff7d=_0x4687f0['get']({'plain':!![]});if(_0x1eff7d&&_0x1eff7d[_0xd819('0x22')]){logger[_0xd819('0x23')](_0xd819('0x24'),'afterCreate',util[_0xd819('0x25')](_0xd819('0x26'),_0x9bfdab['id'],_0x1eff7d['replyUri']));if(_0x1eff7d['Interactions']&&_0x1eff7d[_0xd819('0x27')][_0xd819('0x28')]){_0x9bfdab['Interaction']=_[_0xd819('0x29')](_0x1eff7d[_0xd819('0x27')][0x0],_0xd819('0x2a'));_0x9bfdab[_0xd819('0x2a')]=_0x1eff7d[_0xd819('0x27')][0x0][_0xd819('0x2a')];}var _0x2175de={'method':_0xd819('0x2b'),'uri':encodeURI(_0x1eff7d[_0xd819('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2175de[_0xd819('0x2c')]){case _0xd819('0x2d'):_0x2175de['qs']=_0x9bfdab;break;case _0xd819('0x2b'):_0x2175de['body']=_0x9bfdab;break;}return rp(_0x2175de)['then'](function(_0x5207a4){logger[_0xd819('0x23')](_0xd819('0x24'),_0xd819('0x2e'),util[_0xd819('0x25')](_0xd819('0x2f'),_0x9bfdab['id'],_0x1eff7d[_0xd819('0x22')]));if(_0x5207a4['body'][_0xd819('0x30')]&&_0x5207a4[_0xd819('0xd')][_0xd819('0x30')]!=_0x9bfdab[_0xd819('0x31')][_0xd819('0x30')]){return _0x2799c0['OpenchannelInteraction'][_0xd819('0x19')]({'threadId':_0x5207a4['body'][_0xd819('0x30')]},{'where':{'id':_0x9bfdab[_0xd819('0x31')]['id']}});}else{return;}})[_0xd819('0x18')](function(){return _0x11496a['update']({'read':!![]});})[_0xd819('0x1b')](function(_0x57e61e){logger[_0xd819('0x32')](_0xd819('0x24'),_0xd819('0x2e'),util[_0xd819('0x33')](_0x57e61e,{'showHidden':![],'depth':null}));_0x19be38();});}else{_0x19be38();}})[_0xd819('0x34')](function(){_0x19be38();});}else{_0x19be38();}}},'charset':'utf8mb4','collate':_0xd819('0x35')});}; \ No newline at end of file +var _0xb24a=['info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','secret','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','Interactions','Contact','keys','replyUri'];(function(_0x2fc81a,_0x5861a7){var _0x776c2a=function(_0x4582ab){while(--_0x4582ab){_0x2fc81a['push'](_0x2fc81a['shift']());}};_0x776c2a(++_0x5861a7);}(_0xb24a,0x70));var _0xab24=function(_0x54dcad,_0x554f46){_0x54dcad=_0x54dcad-0x0;var _0x537c56=_0xb24a[_0x54dcad];return _0x537c56;};'use strict';var _=require('lodash');var util=require(_0xab24('0x0'));var logger=require(_0xab24('0x1'))('api');var moment=require(_0xab24('0x2'));var BPromise=require('bluebird');var rp=require(_0xab24('0x3'));var fs=require('fs');var path=require(_0xab24('0x4'));var rimraf=require(_0xab24('0x5'));var config=require(_0xab24('0x6'));var attributes=require(_0xab24('0x7'));module[_0xab24('0x8')]=function(_0x406762,_0x4ea9d9){return _0x406762[_0xab24('0x9')](_0xab24('0xa'),attributes,{'tableName':_0xab24('0xb'),'paranoid':![],'indexes':[{'name':_0xab24('0xc'),'fields':[_0xab24('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x541a7a,_0x14d2f4,_0x5938cd){var _0x56ea65=_0x406762[_0xab24('0xe')];var _0x118cf9=_0x541a7a[_0xab24('0xf')]({'plain':!![]});if(_0x118cf9[_0xab24('0x10')][_0xab24('0x11')]()==='in'||_0x118cf9[_0xab24('0x10')]['toLowerCase']()==='out'&&!_0x118cf9[_0xab24('0x12')]&&!_['isNil'](_0x118cf9['UserId'])){_0x56ea65[_0xab24('0x13')][_0xab24('0x14')]({'where':{'id':_0x118cf9[_0xab24('0x15')]}})[_0xab24('0x16')](function(_0x3a5c9e){if(_0x3a5c9e){_0x3a5c9e[_0xab24('0x17')]({'lastMsgAt':_0x118cf9[_0xab24('0x18')],'lastMsgDirection':_0x118cf9[_0xab24('0x10')][_0xab24('0x11')]()});}})[_0xab24('0x19')](function(_0x14e826){console[_0xab24('0x1a')](_0x14e826);});}if(_0x118cf9[_0xab24('0x10')]===_0xab24('0x1b')&&!_0x118cf9['secret']){var _0x27fc29;_0x56ea65[_0xab24('0x1c')]['describe']()[_0xab24('0x16')](function(_0x565e85){return _0x56ea65[_0xab24('0x1d')][_0xab24('0x1e')]({'where':{'id':_0x118cf9['OpenchannelAccountId']},'include':[{'model':_0x56ea65[_0xab24('0x13')],'as':_0xab24('0x1f'),'where':{'id':_0x118cf9[_0xab24('0x15')]},'limit':0x1,'include':[{'model':_0x56ea65[_0xab24('0x1c')],'as':_0xab24('0x20'),'attributes':_[_0xab24('0x21')](_0x565e85)}]}]});})['then'](function(_0x4a2cde){_0x27fc29=_0x4a2cde[_0xab24('0xf')]({'plain':!![]});if(_0x27fc29&&_0x27fc29[_0xab24('0x22')]){logger[_0xab24('0x23')](_0xab24('0x24'),'afterCreate',util[_0xab24('0x25')](_0xab24('0x26'),_0x118cf9['id'],_0x27fc29[_0xab24('0x22')]));if(_0x27fc29[_0xab24('0x1f')]&&_0x27fc29[_0xab24('0x1f')]['length']){_0x118cf9[_0xab24('0x27')]=_[_0xab24('0x28')](_0x27fc29[_0xab24('0x1f')][0x0],'Contact');_0x118cf9[_0xab24('0x20')]=_0x27fc29[_0xab24('0x1f')][0x0][_0xab24('0x20')];}var _0x14d2f4={'method':_0xab24('0x29'),'uri':encodeURI(_0x27fc29[_0xab24('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x14d2f4['method']){case _0xab24('0x2a'):_0x14d2f4['qs']=_0x118cf9;break;case _0xab24('0x29'):_0x14d2f4[_0xab24('0xd')]=_0x118cf9;break;}return rp(_0x14d2f4)['then'](function(_0x55f896){logger[_0xab24('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xab24('0x25')](_0xab24('0x2b'),_0x118cf9['id'],_0x27fc29[_0xab24('0x22')]));if(_0x55f896['body'][_0xab24('0x2c')]&&_0x55f896[_0xab24('0xd')][_0xab24('0x2c')]!=_0x118cf9[_0xab24('0x27')][_0xab24('0x2c')]){return _0x56ea65[_0xab24('0x13')][_0xab24('0x17')]({'threadId':_0x55f896['body'][_0xab24('0x2c')]},{'where':{'id':_0x118cf9[_0xab24('0x27')]['id']}});}else{return;}})[_0xab24('0x16')](function(){return _0x541a7a[_0xab24('0x17')]({'read':!![]});})[_0xab24('0x19')](function(_0x203ea1){logger[_0xab24('0x1a')](_0xab24('0x24'),_0xab24('0x2d'),util[_0xab24('0x2e')](_0x203ea1,{'showHidden':![],'depth':null}));_0x5938cd();});}else{_0x5938cd();}})['finally'](function(){_0x5938cd();});}else{_0x5938cd();}}},'charset':_0xab24('0x2f'),'collate':_0xab24('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index caa2924..d4e2d46 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b16ba,_0x5820c8){var _0x512457=function(_0x11fd6d){while(--_0x11fd6d){_0x4b16ba['push'](_0x4b16ba['shift']());}};_0x512457(++_0x5820c8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x572382,_0x1cffda){_0x572382=_0x572382-0x0;var _0x2a1ddf=_0x5f2f[_0x572382];return _0x2a1ddf;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x204361,_0x292ace){var _0x4fcb7a=function(_0x3e41de){while(--_0x3e41de){_0x204361['push'](_0x204361['shift']());}};_0x4fcb7a(++_0x292ace);}(_0x7a54,0x106));var _0x47a5=function(_0xc0b304,_0x4d8b4f){_0xc0b304=_0xc0b304-0x0;var _0x4c62a5=_0x7a54[_0xc0b304];return _0x4c62a5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index df2efe2..f47dfbc 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 _0x334b=['update','register','length','openchannelMessage:','save','remove'];(function(_0x411b68,_0x52e768){var _0x41ff90=function(_0x2ab602){while(--_0x2ab602){_0x411b68['push'](_0x411b68['shift']());}};_0x41ff90(++_0x52e768);}(_0x334b,0x154));var _0xb334=function(_0x233f64,_0xe37017){_0x233f64=_0x233f64-0x0;var _0x3e2a00=_0x334b[_0x233f64];return _0x3e2a00;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xb334('0x0'),_0xb334('0x1'),_0xb334('0x2')];function createListener(_0x304cd4,_0x1a9baa){return function(_0xd33a82){_0x1a9baa['emit'](_0x304cd4,_0xd33a82);};}function removeListener(_0x185532,_0x3f58e0){return function(){OpenchannelMessageEvents['removeListener'](_0x185532,_0x3f58e0);};}exports[_0xb334('0x3')]=function(_0x3852ef){for(var _0x25a420=0x0,_0x52fef0=events[_0xb334('0x4')];_0x25a420<_0x52fef0;_0x25a420++){var _0x39c658=events[_0x25a420];var _0x408c14=createListener(_0xb334('0x5')+_0x39c658,_0x3852ef);OpenchannelMessageEvents['on'](_0x39c658,_0x408c14);}}; \ No newline at end of file +var _0x5084=['remove','update','emit','removeListener','register','length','./openchannelMessage.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5084,0xde));var _0x4508=function(_0x1723da,_0x2b7616){_0x1723da=_0x1723da-0x0;var _0x453a98=_0x5084[_0x1723da];return _0x453a98;};'use strict';var OpenchannelMessageEvents=require(_0x4508('0x0'));var events=[_0x4508('0x1'),_0x4508('0x2'),_0x4508('0x3')];function createListener(_0xaff6d3,_0x4bb8e6){return function(_0x14e13c){_0x4bb8e6[_0x4508('0x4')](_0xaff6d3,_0x14e13c);};}function removeListener(_0x42cf45,_0x565a6b){return function(){OpenchannelMessageEvents[_0x4508('0x5')](_0x42cf45,_0x565a6b);};}exports[_0x4508('0x6')]=function(_0x1f8250){for(var _0x5b8491=0x0,_0x2c8b6a=events[_0x4508('0x7')];_0x5b8491<_0x2c8b6a;_0x5b8491++){var _0x13d6d1=events[_0x5b8491];var _0xd8c555=createListener('openchannelMessage:'+_0x13d6d1,_0x1f8250);OpenchannelMessageEvents['on'](_0x13d6d1,_0xd8c555);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 81cd05f..23de131 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 _0x4859=['addTeams','delete','destroy','removeAgents','exports','util','connect-timeout','fs-extra','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','/describe','describe','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x353cbe,_0x291111){var _0x4611be=function(_0x51a3b8){while(--_0x51a3b8){_0x353cbe['push'](_0x353cbe['shift']());}};_0x4611be(++_0x291111);}(_0x4859,0xad));var _0x9485=function(_0x21856d,_0x4ba81f){_0x21856d=_0x21856d-0x0;var _0xe2424=_0x4859[_0x21856d];return _0xe2424;};'use strict';var multer=require('multer');var util=require(_0x9485('0x0'));var path=require('path');var timeout=require(_0x9485('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9485('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9485('0x3'));var config=require('../../config/environment');var controller=require(_0x9485('0x4'));router['get']('/',auth[_0x9485('0x5')](),controller['index']);router['get'](_0x9485('0x6'),auth[_0x9485('0x5')](),controller[_0x9485('0x7')]);router['get'](_0x9485('0x8'),auth[_0x9485('0x5')](),controller[_0x9485('0x9')]);router[_0x9485('0xa')](_0x9485('0xb'),auth[_0x9485('0x5')](),controller[_0x9485('0xc')]);router[_0x9485('0xa')](_0x9485('0xd'),auth[_0x9485('0x5')](),controller[_0x9485('0xe')]);router[_0x9485('0xa')](_0x9485('0xf'),auth['isAuthenticated'](),controller[_0x9485('0x10')]);router[_0x9485('0x11')]('/',auth[_0x9485('0x5')](),controller[_0x9485('0x12')]);router[_0x9485('0x11')]('/:id/teams',auth[_0x9485('0x5')](),controller[_0x9485('0x13')]);router['post'](_0x9485('0xf'),auth[_0x9485('0x5')](),controller['addAgents']);router['put'](_0x9485('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x9485('0x14')](_0x9485('0x8'),auth[_0x9485('0x5')](),controller[_0x9485('0x15')]);router[_0x9485('0x14')](_0x9485('0xd'),auth[_0x9485('0x5')](),controller['removeTeams']);router[_0x9485('0x14')](_0x9485('0xf'),auth[_0x9485('0x5')](),controller[_0x9485('0x16')]);module[_0x9485('0x17')]=router; \ No newline at end of file +var _0x3762=['update','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','addAgents','put'];(function(_0xd1f1d4,_0x31e9e1){var _0x62aab1=function(_0x196006){while(--_0x196006){_0xd1f1d4['push'](_0xd1f1d4['shift']());}};_0x62aab1(++_0x31e9e1);}(_0x3762,0x92));var _0x2376=function(_0x3a6210,_0x4674a7){_0x3a6210=_0x3a6210-0x0;var _0xa861ba=_0x3762[_0x3a6210];return _0xa861ba;};'use strict';var multer=require(_0x2376('0x0'));var util=require(_0x2376('0x1'));var path=require(_0x2376('0x2'));var timeout=require('connect-timeout');var express=require(_0x2376('0x3'));var router=express['Router']();var fs_extra=require(_0x2376('0x4'));var auth=require(_0x2376('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2376('0x6'));router[_0x2376('0x7')]('/',auth[_0x2376('0x8')](),controller[_0x2376('0x9')]);router['get'](_0x2376('0xa'),auth[_0x2376('0x8')](),controller[_0x2376('0xb')]);router[_0x2376('0x7')]('/:id',auth[_0x2376('0x8')](),controller['show']);router[_0x2376('0x7')](_0x2376('0xc'),auth[_0x2376('0x8')](),controller[_0x2376('0xd')]);router[_0x2376('0x7')](_0x2376('0xe'),auth['isAuthenticated'](),controller[_0x2376('0xf')]);router['get']('/:id/users',auth[_0x2376('0x8')](),controller[_0x2376('0x10')]);router['post']('/',auth[_0x2376('0x8')](),controller[_0x2376('0x11')]);router[_0x2376('0x12')](_0x2376('0xe'),auth['isAuthenticated'](),controller[_0x2376('0x13')]);router['post']('/:id/users',auth[_0x2376('0x8')](),controller[_0x2376('0x14')]);router[_0x2376('0x15')]('/:id',auth[_0x2376('0x8')](),controller[_0x2376('0x16')]);router[_0x2376('0x17')]('/:id',auth[_0x2376('0x8')](),controller[_0x2376('0x18')]);router[_0x2376('0x17')](_0x2376('0xe'),auth[_0x2376('0x8')](),controller['removeTeams']);router['delete'](_0x2376('0x19'),auth[_0x2376('0x8')](),controller[_0x2376('0x1a')]);module[_0x2376('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5b61b38..cb51b8e 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 _0x2621=['sequelize','exports','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2621,0x111));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1262('0x0'));module[_0x1262('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1262('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1262('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1262('0x4')](_0x1262('0x5'),'beepall',_0x1262('0x6'))}}; \ No newline at end of file +var _0xed35=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x132886,_0x1b56cb){var _0x333c46=function(_0x28aa59){while(--_0x28aa59){_0x132886['push'](_0x132886['shift']());}};_0x333c46(++_0x1b56cb);}(_0xed35,0x16c));var _0x5ed3=function(_0x5e9fcc,_0x41599b){_0x5e9fcc=_0x5e9fcc-0x0;var _0x39ef2f=_0xed35[_0x5e9fcc];return _0x39ef2f;};'use strict';var Sequelize=require(_0x5ed3('0x0'));module[_0x5ed3('0x1')]={'name':{'type':Sequelize[_0x5ed3('0x2')],'unique':_0x5ed3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5ed3('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5ed3('0x5'),_0x5ed3('0x6'),_0x5ed3('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a6c3c6a..73ce998 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 _0x0eae=['../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','rows','catch','show','params','model','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','update','body','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','sort','where','OpenchannelQueueId','filter','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','openchannelPause','getTeams','keys','Team','order','pick','addTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','omit','userOpenchannelQueue:save','isArray','getAgents','nolimit','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x0eae,0x1e5));var _0xe0ea=function(_0x4f21c4,_0x960024){_0x4f21c4=_0x4f21c4-0x0;var _0x2f9fa6=_0x0eae[_0x4f21c4];return _0x2f9fa6;};'use strict';var BPromise=require(_0xe0ea('0x0'));var util=require(_0xe0ea('0x1'));var _=require(_0xe0ea('0x2'));var squel=require(_0xe0ea('0x3'));var Redis=require(_0xe0ea('0x4'));var qs=require(_0xe0ea('0x5'));var logger=require(_0xe0ea('0x6'))('api');var config=require(_0xe0ea('0x7'));var db=require(_0xe0ea('0x8'))['db'];config['redis']=_[_0xe0ea('0x9')](config[_0xe0ea('0xa')],{'host':_0xe0ea('0xb'),'port':0x18eb});var socket=require(_0xe0ea('0xc'))(new Redis(config[_0xe0ea('0xa')]));require('./openchannelQueue.socket')[_0xe0ea('0xd')](socket);function respondWithStatusCode(_0x2f9bd4,_0x1344a8){_0x1344a8=_0x1344a8||0xcc;return function(_0x4798e4){if(_0x4798e4){return _0x2f9bd4[_0xe0ea('0xe')](_0x1344a8);}return _0x2f9bd4[_0xe0ea('0xf')](_0x1344a8)[_0xe0ea('0x10')]();};}function respondWithResult(_0x151491,_0x4a4612){_0x4a4612=_0x4a4612||0xc8;return function(_0x1bbd8e){if(_0x1bbd8e){return _0x151491[_0xe0ea('0xf')](_0x4a4612)[_0xe0ea('0x11')](_0x1bbd8e);}};}function respondWithFilteredResult(_0x4bf414,_0x164dc6){return function(_0x2f8ab8){if(_0x2f8ab8){var _0x344e32=typeof _0x164dc6[_0xe0ea('0x12')]===_0xe0ea('0x13')&&typeof _0x164dc6['limit']===_0xe0ea('0x13');var _0x5d2eaf=_0x2f8ab8['count'];var _0x648f96=_0x344e32?0x0:_0x164dc6[_0xe0ea('0x12')];var _0x13cd72=_0x344e32?_0x2f8ab8[_0xe0ea('0x14')]:_0x164dc6[_0xe0ea('0x12')]+_0x164dc6[_0xe0ea('0x15')];var _0x2e1554;if(_0x13cd72>=_0x5d2eaf){_0x13cd72=_0x5d2eaf;_0x2e1554=0xc8;}else{_0x2e1554=0xce;}_0x4bf414['status'](_0x2e1554);return _0x4bf414['set'](_0xe0ea('0x16'),_0x648f96+'-'+_0x13cd72+'/'+_0x5d2eaf)[_0xe0ea('0x11')](_0x2f8ab8);}return null;};}function saveUpdates(_0x434bf1){return function(_0x2b2c6e){if(_0x2b2c6e){return _0x2b2c6e['update'](_0x434bf1)[_0xe0ea('0x17')](function(_0xf4e156){return _0xf4e156;});}return null;};}function removeEntity(_0x271717){return function(_0x81b791){if(_0x81b791){return _0x81b791[_0xe0ea('0x18')]()[_0xe0ea('0x17')](function(){var _0x4baa3d=_0x81b791[_0xe0ea('0x19')]({'plain':!![]});var _0x4c84c6='OpenchannelQueues';return db[_0xe0ea('0x1a')][_0xe0ea('0x18')]({'where':{'type':_0x4c84c6,'resourceId':_0x4baa3d['id']}})['then'](function(){return _0x81b791;});})[_0xe0ea('0x17')](function(){_0x271717[_0xe0ea('0xf')](0xcc)[_0xe0ea('0x10')]();});}};}function handleEntityNotFound(_0x234aad){return function(_0x1106f1){if(!_0x1106f1){_0x234aad[_0xe0ea('0xe')](0x194);}return _0x1106f1;};}function handleError(_0x44d4f2,_0x1363a8){_0x1363a8=_0x1363a8||0x1f4;return function(_0x42edbd){logger[_0xe0ea('0x1b')](_0x42edbd[_0xe0ea('0x1c')]);if(_0x42edbd[_0xe0ea('0x1d')]){delete _0x42edbd[_0xe0ea('0x1d')];}_0x44d4f2[_0xe0ea('0xf')](_0x1363a8)['send'](_0x42edbd);};}exports['index']=function(_0x4a6332,_0x5ca508){var _0x6860e9={};var _0x48068f={'count':0x0,'rows':[]};var _0x2eebce=_[_0xe0ea('0x1e')](db[_0xe0ea('0x1f')][_0xe0ea('0x20')],function(_0x4712f2){return{'name':_0x4712f2[_0xe0ea('0x21')],'type':_0x4712f2[_0xe0ea('0x22')][_0xe0ea('0x23')]};});_0x6860e9=qs[_0xe0ea('0x24')](_0x2eebce,_0x4a6332);var _0x589a64={'where':_0x6860e9['where']};return db[_0xe0ea('0x1f')]['count'](_0x589a64)[_0xe0ea('0x17')](function(_0x21e5d6){_0x48068f[_0xe0ea('0x14')]=_0x21e5d6;_0x6860e9['include']=qs[_0xe0ea('0x25')](_0x4a6332['query']);return db[_0xe0ea('0x1f')][_0xe0ea('0x26')](_0x6860e9);})[_0xe0ea('0x17')](function(_0x3e2eb0){_0x48068f[_0xe0ea('0x27')]=_0x3e2eb0;return _0x48068f;})[_0xe0ea('0x17')](respondWithFilteredResult(_0x5ca508,_0x6860e9))[_0xe0ea('0x28')](handleError(_0x5ca508,null));};exports[_0xe0ea('0x29')]=function(_0x1f500b,_0x4e7c3c){var _0x38a62b={'raw':!![],'where':{'id':_0x1f500b[_0xe0ea('0x2a')]['id']}},_0x6ac3a={};_0x6ac3a[_0xe0ea('0x2b')]=_['keys'](db[_0xe0ea('0x1f')]['rawAttributes']);_0x6ac3a[_0xe0ea('0x2c')]=_['keys'](_0x1f500b[_0xe0ea('0x2c')]);_0x6ac3a[_0xe0ea('0x2d')]=_[_0xe0ea('0x2e')](_0x6ac3a['model'],_0x6ac3a[_0xe0ea('0x2c')]);_0x38a62b[_0xe0ea('0x2f')]=_[_0xe0ea('0x2e')](_0x6ac3a['model'],qs['fields'](_0x1f500b[_0xe0ea('0x2c')][_0xe0ea('0x30')]));_0x38a62b['attributes']=_0x38a62b[_0xe0ea('0x2f')][_0xe0ea('0x31')]?_0x38a62b['attributes']:_0x6ac3a[_0xe0ea('0x2b')];if(_0x1f500b['query'][_0xe0ea('0x32')]){_0x38a62b['include']=[{'all':!![]}];}_0x38a62b=_[_0xe0ea('0x33')]({},_0x38a62b,_0x1f500b[_0xe0ea('0x34')]);return db['OpenchannelQueue'][_0xe0ea('0x35')](_0x38a62b)[_0xe0ea('0x17')](handleEntityNotFound(_0x4e7c3c,null))[_0xe0ea('0x17')](respondWithResult(_0x4e7c3c,null))[_0xe0ea('0x28')](handleError(_0x4e7c3c,null));};exports[_0xe0ea('0x36')]=function(_0x42fa8a,_0x4087f0){return db[_0xe0ea('0x1f')][_0xe0ea('0x36')](_0x42fa8a['body'],{})['then'](function(_0x23488a){var _0x189ec9=_0x42fa8a[_0xe0ea('0x37')][_0xe0ea('0x19')]({'plain':!![]});if(!_0x189ec9)throw new Error(_0xe0ea('0x38'));if(_0x189ec9['role']===_0xe0ea('0x37')){var _0x5dcf39=_0x23488a[_0xe0ea('0x19')]({'plain':!![]});var _0x94e06c=_0xe0ea('0x39');return db[_0xe0ea('0x3a')][_0xe0ea('0x35')]({'where':{'name':_0x94e06c,'userProfileId':_0x189ec9[_0xe0ea('0x3b')]},'raw':!![]})[_0xe0ea('0x17')](function(_0x2e8e9d){if(_0x2e8e9d&&_0x2e8e9d[_0xe0ea('0x3c')]===0x0){return db[_0xe0ea('0x1a')][_0xe0ea('0x36')]({'name':_0x5dcf39[_0xe0ea('0x1d')],'resourceId':_0x5dcf39['id'],'type':_0x2e8e9d[_0xe0ea('0x1d')],'sectionId':_0x2e8e9d['id']},{})[_0xe0ea('0x17')](function(){return _0x23488a;});}else{return _0x23488a;}})['catch'](function(_0x49ff98){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49ff98);throw _0x49ff98;});}return _0x23488a;})[_0xe0ea('0x17')](respondWithResult(_0x4087f0,0xc9))[_0xe0ea('0x28')](handleError(_0x4087f0,null));};exports[_0xe0ea('0x3d')]=function(_0x3936f1,_0x85c5fb){if(_0x3936f1['body']['id']){delete _0x3936f1[_0xe0ea('0x3e')]['id'];}return db['OpenchannelQueue'][_0xe0ea('0x35')]({'where':{'id':_0x3936f1['params']['id']}})['then'](handleEntityNotFound(_0x85c5fb,null))['then'](saveUpdates(_0x3936f1[_0xe0ea('0x3e')],null))['then'](respondWithResult(_0x85c5fb,null))['catch'](handleError(_0x85c5fb,null));};exports[_0xe0ea('0x18')]=function(_0x2981fa,_0x5eecaa){return db['OpenchannelQueue'][_0xe0ea('0x35')]({'where':{'id':_0x2981fa[_0xe0ea('0x2a')]['id']}})[_0xe0ea('0x17')](handleEntityNotFound(_0x5eecaa,null))['then'](removeEntity(_0x5eecaa,null))['catch'](handleError(_0x5eecaa,null));};exports['describe']=function(_0x200265,_0xa3def0){return db[_0xe0ea('0x1f')]['describe']()['then'](respondWithResult(_0xa3def0,null))[_0xe0ea('0x28')](handleError(_0xa3def0,null));};exports[_0xe0ea('0x3f')]=function(_0x31121e,_0xcf0414){var _0x5027de={'raw':!![],'where':{}},_0x3e1024={},_0x214b78;return db[_0xe0ea('0x1f')][_0xe0ea('0x40')]({'where':{'id':_0x31121e[_0xe0ea('0x2a')]['id']}})[_0xe0ea('0x17')](handleEntityNotFound(_0xcf0414,null))['then'](function(_0x226da3){if(_0x226da3){_0x214b78=_0x226da3[_0xe0ea('0x19')]({'plain':!![]});_0x3e1024[_0xe0ea('0x2b')]=_['keys'](db[_0xe0ea('0x41')][_0xe0ea('0x20')]);_0x3e1024[_0xe0ea('0x2c')]=_['keys'](_0x31121e[_0xe0ea('0x2c')]);_0x3e1024['filters']=_[_0xe0ea('0x2e')](_0x3e1024[_0xe0ea('0x2b')],_0x3e1024['query']);_0x5027de[_0xe0ea('0x2f')]=_[_0xe0ea('0x2e')](_0x3e1024[_0xe0ea('0x2b')],qs[_0xe0ea('0x30')](_0x31121e[_0xe0ea('0x2c')][_0xe0ea('0x30')]));_0x5027de[_0xe0ea('0x2f')]=_0x5027de['attributes'][_0xe0ea('0x31')]?_0x5027de[_0xe0ea('0x2f')]:_0x3e1024['model'];if(!_0x31121e['query'][_0xe0ea('0x42')]('nolimit')){_0x5027de[_0xe0ea('0x15')]=qs[_0xe0ea('0x15')](_0x31121e[_0xe0ea('0x2c')]['limit']);_0x5027de[_0xe0ea('0x12')]=qs[_0xe0ea('0x12')](_0x31121e[_0xe0ea('0x2c')]['offset']);}_0x5027de['order']=qs[_0xe0ea('0x43')](_0x31121e[_0xe0ea('0x2c')][_0xe0ea('0x43')]);_0x5027de[_0xe0ea('0x44')]=qs[_0xe0ea('0x2d')](_['pick'](_0x31121e[_0xe0ea('0x2c')],_0x3e1024[_0xe0ea('0x2d')]));_0x5027de[_0xe0ea('0x44')][_0xe0ea('0x45')]=_0x226da3['id'];if(_0x31121e[_0xe0ea('0x2c')][_0xe0ea('0x46')]){_0x5027de['where']=_['merge'](_0x5027de[_0xe0ea('0x44')],{'$or':_[_0xe0ea('0x1e')](_0x5027de['attributes'],function(_0xfeb692){var _0x1362ca={};_0x1362ca[_0xfeb692]={'$like':'%'+_0x31121e[_0xe0ea('0x2c')]['filter']+'%'};return _0x1362ca;})});}_0x5027de=_['merge']({},_0x5027de,_0x31121e[_0xe0ea('0x34')]);return db[_0xe0ea('0x41')]['findAll'](_0x5027de);}})[_0xe0ea('0x17')](function(_0x58679a){if(_0x58679a){return db['User'][_0xe0ea('0x47')]({'where':{'id':_['map'](_0x58679a,_0xe0ea('0x48')),'role':_0xe0ea('0x49')},'attributes':['id',_0xe0ea('0x1d'),'openchannelPause',_0xe0ea('0x4a'),_0xe0ea('0x4b')]});}})[_0xe0ea('0x17')](function(_0x2fb748){if(_0x2fb748){return{'count':_0x2fb748[_0xe0ea('0x14')],'rows':_['map'](_0x2fb748[_0xe0ea('0x27')],function(_0x4b16d7){return{'membername':_0x4b16d7['name'],'UserId':_0x4b16d7['id'],'queue_name':_0x214b78[_0xe0ea('0x1d')],'OpenchannelQueueId':_0x214b78['id'],'interface':util[_0xe0ea('0x4c')]('%s/%s',_0xe0ea('0x4d'),_0x4b16d7[_0xe0ea('0x1d')]),'penalty':0x0,'paused':_0x4b16d7[_0xe0ea('0x4e')],'createdAt':_0x4b16d7['createdAt'],'updatedAt':_0x4b16d7[_0xe0ea('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0ea('0x17')](respondWithFilteredResult(_0xcf0414,_0x5027de))['catch'](handleError(_0xcf0414,null));};exports[_0xe0ea('0x4f')]=function(_0x385901,_0xad6932){var _0x4daac3={};var _0x1db344={};var _0x2f13e7;var _0x7146f2;return db['OpenchannelQueue'][_0xe0ea('0x40')]({'where':{'id':_0x385901[_0xe0ea('0x2a')]['id']}})['then'](handleEntityNotFound(_0xad6932,null))[_0xe0ea('0x17')](function(_0x2f5df6){if(_0x2f5df6){_0x2f13e7=_0x2f5df6;_0x1db344[_0xe0ea('0x2b')]=_[_0xe0ea('0x50')](db[_0xe0ea('0x51')][_0xe0ea('0x20')]);_0x1db344['query']=_[_0xe0ea('0x50')](_0x385901[_0xe0ea('0x2c')]);_0x1db344[_0xe0ea('0x2d')]=_[_0xe0ea('0x2e')](_0x1db344[_0xe0ea('0x2b')],_0x1db344[_0xe0ea('0x2c')]);_0x4daac3['attributes']=_['intersection'](_0x1db344[_0xe0ea('0x2b')],qs[_0xe0ea('0x30')](_0x385901[_0xe0ea('0x2c')]['fields']));_0x4daac3[_0xe0ea('0x2f')]=_0x4daac3['attributes'][_0xe0ea('0x31')]?_0x4daac3[_0xe0ea('0x2f')]:_0x1db344['model'];_0x4daac3[_0xe0ea('0x52')]=qs[_0xe0ea('0x43')](_0x385901['query'][_0xe0ea('0x43')]);_0x4daac3[_0xe0ea('0x44')]=qs['filters'](_[_0xe0ea('0x53')](_0x385901[_0xe0ea('0x2c')],_0x1db344[_0xe0ea('0x2d')]));if(_0x385901[_0xe0ea('0x2c')][_0xe0ea('0x46')]){_0x4daac3['where']=_[_0xe0ea('0x33')](_0x4daac3[_0xe0ea('0x44')],{'$or':_['map'](_0x4daac3[_0xe0ea('0x2f')],function(_0x306736){var _0x46a3a8={};_0x46a3a8[_0x306736]={'$like':'%'+_0x385901[_0xe0ea('0x2c')][_0xe0ea('0x46')]+'%'};return _0x46a3a8;})});}_0x4daac3=_[_0xe0ea('0x33')]({},_0x4daac3,_0x385901[_0xe0ea('0x34')]);return _0x2f13e7[_0xe0ea('0x4f')](_0x4daac3);}})[_0xe0ea('0x17')](function(_0x2fc959){if(_0x2fc959){_0x7146f2=_0x2fc959[_0xe0ea('0x31')];if(!_0x385901['query'][_0xe0ea('0x42')]('nolimit')){_0x4daac3[_0xe0ea('0x15')]=qs[_0xe0ea('0x15')](_0x385901[_0xe0ea('0x2c')][_0xe0ea('0x15')]);_0x4daac3[_0xe0ea('0x12')]=qs[_0xe0ea('0x12')](_0x385901[_0xe0ea('0x2c')][_0xe0ea('0x12')]);}return _0x2f13e7[_0xe0ea('0x4f')](_0x4daac3);}})[_0xe0ea('0x17')](function(_0x33273a){if(_0x33273a){return _0x33273a?{'count':_0x7146f2,'rows':_0x33273a}:null;}})[_0xe0ea('0x17')](respondWithResult(_0xad6932,null))[_0xe0ea('0x28')](handleError(_0xad6932,null));};exports[_0xe0ea('0x54')]=function(_0x539ce7,_0x18ac00){var _0x362bec=_0x539ce7['body'][_0xe0ea('0x55')];return db[_0xe0ea('0x51')]['findAll']({'where':{'id':_0x362bec},'attributes':['id'],'include':[{'model':db[_0xe0ea('0x56')],'as':_0xe0ea('0x57'),'attributes':['id',_0xe0ea('0x1d'),'online',_0xe0ea('0x58'),_0xe0ea('0x59')],'raw':!![]}]})['then'](function(_0x137ed6){if(_0x137ed6){var _0x13def8=_[_0xe0ea('0x5a')](_0x137ed6,function(_0x30c529){var _0x53f389=_0x30c529[_0xe0ea('0x19')]({'plain':!![]});return _0x53f389[_0xe0ea('0x57')];});return db[_0xe0ea('0x1f')][_0xe0ea('0x35')]({'where':{'id':_0x539ce7['params']['id']}})[_0xe0ea('0x17')](function(_0x263e38){return db[_0xe0ea('0x5b')][_0xe0ea('0x5c')](function(_0x57a7c5){return _0x263e38[_0xe0ea('0x54')](_0x362bec,{'transaction':_0x57a7c5})[_0xe0ea('0x17')](function(){return BPromise[_0xe0ea('0x5d')](_0x13def8,function(_0x283bf5){return db[_0xe0ea('0x41')][_0xe0ea('0x5e')]({'where':{'UserId':_0x283bf5['id'],'OpenchannelQueueId':_0x539ce7[_0xe0ea('0x2a')]['id']},'transaction':_0x57a7c5});});})[_0xe0ea('0x17')](function(){_0x13def8[_0xe0ea('0x5f')](function(_0x4c68c0){socket[_0xe0ea('0x60')]('userOpenchannelQueue:save',{'UserId':_0x4c68c0['id'],'OpenchannelQueueId':_0x263e38['id']});});});});});}})['then'](respondWithStatusCode(_0x18ac00,null))[_0xe0ea('0x28')](handleError(_0x18ac00,null));};exports[_0xe0ea('0x61')]=function(_0x4dc534,_0x49ed68){return db[_0xe0ea('0x51')][_0xe0ea('0x26')]({'where':{'id':_0x4dc534[_0xe0ea('0x2c')][_0xe0ea('0x55')]},'attributes':['id'],'include':[{'model':db[_0xe0ea('0x56')],'as':_0xe0ea('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x49ed68,null))[_0xe0ea('0x17')](function(_0x34ba21){var _0x6aebaa=_[_0xe0ea('0x1e')](_0x34ba21,'id');var _0x480699=[];var _0x2ffa16=[];var _0x37dedb=squel[_0xe0ea('0x62')]();_0x37dedb[_0xe0ea('0x63')](_0xe0ea('0x64'))[_0xe0ea('0x65')](_0xe0ea('0x66'),'tq')[_0xe0ea('0x67')](_0xe0ea('0x68'),'ut',_0xe0ea('0x69'))[_0xe0ea('0x44')]('OpenchannelQueueId\x20=\x20?',_0x4dc534[_0xe0ea('0x2a')]['id']);for(var _0x2b127d=0x0;_0x2b127d<_0x34ba21[_0xe0ea('0x31')];_0x2b127d+=0x1){let _0x4f12a3=_0x34ba21[_0x2b127d];for(var _0x544832=0x0;_0x544832<_0x4f12a3[_0xe0ea('0x57')]['length'];_0x544832+=0x1){let _0x3cf6c3=_0x4f12a3[_0xe0ea('0x57')][_0x544832];var _0x21b195=_0x37dedb[_0xe0ea('0x6a')]();_0x21b195[_0xe0ea('0x44')]('ut.UserId\x20=\x20?',_0x3cf6c3['id']);_0x2ffa16['push'](db[_0xe0ea('0x5b')][_0xe0ea('0x2c')](_0x21b195[_0xe0ea('0x6b')](),{'type':db['sequelize'][_0xe0ea('0x6c')][_0xe0ea('0x6d')]})[_0xe0ea('0x17')](function(_0x3264bd){if(_0x3264bd[_0xe0ea('0x31')]===0x1){return _0x3cf6c3['id'];}else{var _0x3f2c14=_['every'](_[_0xe0ea('0x1e')](_0x3264bd,_0xe0ea('0x6e')),function(_0x155fac){return _[_0xe0ea('0x6f')](_0x6aebaa,_0x155fac);});if(_0x3f2c14){return _0x3cf6c3['id'];}}}));}}return BPromise['all'](_0x2ffa16)[_0xe0ea('0x17')](function(_0x2c3364){_0x480699=_(_0x480699)[_0xe0ea('0x70')](_0x2c3364)[_0xe0ea('0x71')]()[_0xe0ea('0x72')]();return db[_0xe0ea('0x1f')]['find']({'where':{'id':_0x4dc534['params']['id']}})[_0xe0ea('0x17')](function(_0x1047df){return db[_0xe0ea('0x5b')]['transaction'](function(_0x1d83fb){return _0x1047df[_0xe0ea('0x61')](_0x4dc534[_0xe0ea('0x2c')][_0xe0ea('0x55')],{'transaction':_0x1d83fb})[_0xe0ea('0x17')](function(){if(!_[_0xe0ea('0x73')](_0x480699)){return _0x1047df[_0xe0ea('0x74')](_0x480699,{'transaction':_0x1d83fb});}})[_0xe0ea('0x17')](function(){_0x480699[_0xe0ea('0x5f')](function(_0x231763){socket[_0xe0ea('0x60')](_0xe0ea('0x75'),{'UserId':_0x231763,'OpenchannelQueueId':_0x1047df['id']});});});});});});})[_0xe0ea('0x17')](respondWithStatusCode(_0x49ed68,null))[_0xe0ea('0x28')](handleError(_0x49ed68,null));};exports['addAgents']=function(_0x48a868,_0x159bd6){return db[_0xe0ea('0x1f')][_0xe0ea('0x35')]({'where':{'id':_0x48a868['params']['id']}})['then'](handleEntityNotFound(_0x159bd6,null))['then'](function(_0x3bcba5){if(_0x3bcba5){return _0x3bcba5['addAgents'](_0x48a868[_0xe0ea('0x3e')]['ids'],_[_0xe0ea('0x76')](_0x48a868['body'],[_0xe0ea('0x55'),'id'])||{})['spread'](function(_0x42a249){for(var _0x5c20e8=0x0;_0x5c20e8<_0x48a868[_0xe0ea('0x3e')][_0xe0ea('0x55')]['length'];_0x5c20e8+=0x1){socket[_0xe0ea('0x60')](_0xe0ea('0x77'),{'UserId':Number(_0x48a868[_0xe0ea('0x3e')]['ids'][_0x5c20e8]),'OpenchannelQueueId':Number(_0x48a868[_0xe0ea('0x2a')]['id'])});}return _0x42a249;});}})[_0xe0ea('0x17')](respondWithResult(_0x159bd6,null))['catch'](handleError(_0x159bd6,null));};exports[_0xe0ea('0x74')]=function(_0x5c3908,_0x2f5120){return db[_0xe0ea('0x1f')][_0xe0ea('0x35')]({'where':{'id':_0x5c3908[_0xe0ea('0x2a')]['id']}})[_0xe0ea('0x17')](handleEntityNotFound(_0x2f5120,null))[_0xe0ea('0x17')](function(_0x3b9dc3){if(_0x3b9dc3){return _0x3b9dc3[_0xe0ea('0x74')](_0x5c3908[_0xe0ea('0x2c')][_0xe0ea('0x55')])['then'](function(){if(_[_0xe0ea('0x78')](_0x5c3908[_0xe0ea('0x2c')][_0xe0ea('0x55')])){for(var _0x5b39fe=0x0;_0x5b39fe<_0x5c3908[_0xe0ea('0x2c')][_0xe0ea('0x55')][_0xe0ea('0x31')];_0x5b39fe+=0x1){socket[_0xe0ea('0x60')](_0xe0ea('0x75'),{'UserId':Number(_0x5c3908[_0xe0ea('0x2c')]['ids'][_0x5b39fe]),'OpenchannelQueueId':Number(_0x5c3908[_0xe0ea('0x2a')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x5c3908[_0xe0ea('0x2c')][_0xe0ea('0x55')]),'OpenchannelQueueId':Number(_0x5c3908[_0xe0ea('0x2a')]['id'])});}});}})[_0xe0ea('0x17')](respondWithStatusCode(_0x2f5120,null))[_0xe0ea('0x28')](handleError(_0x2f5120,null));};exports[_0xe0ea('0x79')]=function(_0x52c47b,_0x5434f3){var _0x3a4e6f={};var _0x29e2e4={};var _0x5d7d85;var _0x377c5c;return db['OpenchannelQueue'][_0xe0ea('0x40')]({'where':{'id':_0x52c47b[_0xe0ea('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5434f3,null))['then'](function(_0x2ad122){if(_0x2ad122){_0x5d7d85=_0x2ad122;_0x29e2e4[_0xe0ea('0x2b')]=_[_0xe0ea('0x50')](db[_0xe0ea('0x56')][_0xe0ea('0x20')]);_0x29e2e4[_0xe0ea('0x2c')]=_[_0xe0ea('0x50')](_0x52c47b[_0xe0ea('0x2c')]);_0x29e2e4['filters']=_[_0xe0ea('0x2e')](_0x29e2e4[_0xe0ea('0x2b')],_0x29e2e4[_0xe0ea('0x2c')]);_0x3a4e6f[_0xe0ea('0x2f')]=_['intersection'](_0x29e2e4[_0xe0ea('0x2b')],qs[_0xe0ea('0x30')](_0x52c47b[_0xe0ea('0x2c')]['fields']));_0x3a4e6f[_0xe0ea('0x2f')]=_0x3a4e6f[_0xe0ea('0x2f')][_0xe0ea('0x31')]?_0x3a4e6f[_0xe0ea('0x2f')]:_0x29e2e4[_0xe0ea('0x2b')];_0x3a4e6f[_0xe0ea('0x52')]=qs['sort'](_0x52c47b[_0xe0ea('0x2c')]['sort']);_0x3a4e6f['where']=qs[_0xe0ea('0x2d')](_[_0xe0ea('0x53')](_0x52c47b[_0xe0ea('0x2c')],_0x29e2e4['filters']));if(_0x52c47b['query']['filter']){_0x3a4e6f[_0xe0ea('0x44')]=_[_0xe0ea('0x33')](_0x3a4e6f['where'],{'$or':_[_0xe0ea('0x1e')](_0x3a4e6f[_0xe0ea('0x2f')],function(_0x543553){var _0x2049ad={};_0x2049ad[_0x543553]={'$like':'%'+_0x52c47b[_0xe0ea('0x2c')]['filter']+'%'};return _0x2049ad;})});}_0x3a4e6f=_[_0xe0ea('0x33')]({},_0x3a4e6f,_0x52c47b[_0xe0ea('0x34')]);return _0x5d7d85['getAgents'](_0x3a4e6f);}})[_0xe0ea('0x17')](function(_0x235f44){if(_0x235f44){_0x377c5c=_0x235f44['length'];if(!_0x52c47b[_0xe0ea('0x2c')][_0xe0ea('0x42')](_0xe0ea('0x7a'))){_0x3a4e6f[_0xe0ea('0x15')]=qs['limit'](_0x52c47b[_0xe0ea('0x2c')]['limit']);_0x3a4e6f[_0xe0ea('0x12')]=qs[_0xe0ea('0x12')](_0x52c47b[_0xe0ea('0x2c')]['offset']);}return _0x5d7d85[_0xe0ea('0x79')](_0x3a4e6f);}})[_0xe0ea('0x17')](function(_0x1a7184){if(_0x1a7184){return _0x1a7184?{'count':_0x377c5c,'rows':_0x1a7184}:null;}})[_0xe0ea('0x17')](respondWithResult(_0x5434f3,null))[_0xe0ea('0x28')](handleError(_0x5434f3,null));}; \ No newline at end of file +var _0x4b4f=['QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','name','send','index','map','OpenchannelQueue','type','key','include','query','findAll','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','User','UserId','agent','updatedAt','openchannelPause','createdAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x4b4f,0x183));var _0xf4b4=function(_0x1f39c9,_0x39ca18){_0x1f39c9=_0x1f39c9-0x0;var _0x5627d7=_0x4b4f[_0x1f39c9];return _0x5627d7;};'use strict';var BPromise=require(_0xf4b4('0x0'));var util=require(_0xf4b4('0x1'));var _=require('lodash');var squel=require(_0xf4b4('0x2'));var Redis=require(_0xf4b4('0x3'));var qs=require(_0xf4b4('0x4'));var logger=require(_0xf4b4('0x5'))(_0xf4b4('0x6'));var config=require(_0xf4b4('0x7'));var db=require(_0xf4b4('0x8'))['db'];config[_0xf4b4('0x9')]=_[_0xf4b4('0xa')](config[_0xf4b4('0x9')],{'host':_0xf4b4('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4b4('0x9')]));require('./openchannelQueue.socket')[_0xf4b4('0xc')](socket);function respondWithStatusCode(_0x56ba32,_0x520a41){_0x520a41=_0x520a41||0xcc;return function(_0x34292e){if(_0x34292e){return _0x56ba32[_0xf4b4('0xd')](_0x520a41);}return _0x56ba32[_0xf4b4('0xe')](_0x520a41)['end']();};}function respondWithResult(_0x4034cc,_0x34daaa){_0x34daaa=_0x34daaa||0xc8;return function(_0x4c8001){if(_0x4c8001){return _0x4034cc[_0xf4b4('0xe')](_0x34daaa)[_0xf4b4('0xf')](_0x4c8001);}};}function respondWithFilteredResult(_0x5da053,_0x11362e){return function(_0x2c2fbb){if(_0x2c2fbb){var _0x237b09=typeof _0x11362e['offset']===_0xf4b4('0x10')&&typeof _0x11362e['limit']===_0xf4b4('0x10');var _0x4ee7db=_0x2c2fbb[_0xf4b4('0x11')];var _0x6ba7f6=_0x237b09?0x0:_0x11362e[_0xf4b4('0x12')];var _0x3d7846=_0x237b09?_0x2c2fbb[_0xf4b4('0x11')]:_0x11362e[_0xf4b4('0x12')]+_0x11362e[_0xf4b4('0x13')];var _0x572b32;if(_0x3d7846>=_0x4ee7db){_0x3d7846=_0x4ee7db;_0x572b32=0xc8;}else{_0x572b32=0xce;}_0x5da053[_0xf4b4('0xe')](_0x572b32);return _0x5da053[_0xf4b4('0x14')](_0xf4b4('0x15'),_0x6ba7f6+'-'+_0x3d7846+'/'+_0x4ee7db)[_0xf4b4('0xf')](_0x2c2fbb);}return null;};}function saveUpdates(_0x303b5a){return function(_0x35af51){if(_0x35af51){return _0x35af51['update'](_0x303b5a)[_0xf4b4('0x16')](function(_0x39a1d8){return _0x39a1d8;});}return null;};}function removeEntity(_0x45e7a7){return function(_0xe2f5bb){if(_0xe2f5bb){return _0xe2f5bb[_0xf4b4('0x17')]()[_0xf4b4('0x16')](function(){var _0x311efa=_0xe2f5bb[_0xf4b4('0x18')]({'plain':!![]});var _0x33778a=_0xf4b4('0x19');return db[_0xf4b4('0x1a')]['destroy']({'where':{'type':_0x33778a,'resourceId':_0x311efa['id']}})[_0xf4b4('0x16')](function(){return _0xe2f5bb;});})[_0xf4b4('0x16')](function(){_0x45e7a7[_0xf4b4('0xe')](0xcc)[_0xf4b4('0x1b')]();});}};}function handleEntityNotFound(_0x2fb546){return function(_0x36362a){if(!_0x36362a){_0x2fb546[_0xf4b4('0xd')](0x194);}return _0x36362a;};}function handleError(_0x349df4,_0x5a660c){_0x5a660c=_0x5a660c||0x1f4;return function(_0x3bf9f7){logger[_0xf4b4('0x1c')](_0x3bf9f7['stack']);if(_0x3bf9f7[_0xf4b4('0x1d')]){delete _0x3bf9f7[_0xf4b4('0x1d')];}_0x349df4[_0xf4b4('0xe')](_0x5a660c)[_0xf4b4('0x1e')](_0x3bf9f7);};}exports[_0xf4b4('0x1f')]=function(_0x378e99,_0x21042a){var _0x50ab88={};var _0x29b89b={'count':0x0,'rows':[]};var _0x346818=_[_0xf4b4('0x20')](db[_0xf4b4('0x21')]['rawAttributes'],function(_0x287abe){return{'name':_0x287abe['fieldName'],'type':_0x287abe[_0xf4b4('0x22')][_0xf4b4('0x23')]};});_0x50ab88=qs['getOptions'](_0x346818,_0x378e99);var _0x39884c={'where':_0x50ab88['where']};return db['OpenchannelQueue'][_0xf4b4('0x11')](_0x39884c)[_0xf4b4('0x16')](function(_0x5149b9){_0x29b89b[_0xf4b4('0x11')]=_0x5149b9;_0x50ab88[_0xf4b4('0x24')]=qs[_0xf4b4('0x24')](_0x378e99[_0xf4b4('0x25')]);return db[_0xf4b4('0x21')][_0xf4b4('0x26')](_0x50ab88);})[_0xf4b4('0x16')](function(_0x38158e){_0x29b89b[_0xf4b4('0x27')]=_0x38158e;return _0x29b89b;})[_0xf4b4('0x16')](respondWithFilteredResult(_0x21042a,_0x50ab88))[_0xf4b4('0x28')](handleError(_0x21042a,null));};exports[_0xf4b4('0x29')]=function(_0x5362bf,_0x2d6430){var _0x323b56={'raw':!![],'where':{'id':_0x5362bf[_0xf4b4('0x2a')]['id']}},_0x2b2848={};_0x2b2848[_0xf4b4('0x2b')]=_[_0xf4b4('0x2c')](db['OpenchannelQueue'][_0xf4b4('0x2d')]);_0x2b2848[_0xf4b4('0x25')]=_[_0xf4b4('0x2c')](_0x5362bf[_0xf4b4('0x25')]);_0x2b2848[_0xf4b4('0x2e')]=_[_0xf4b4('0x2f')](_0x2b2848[_0xf4b4('0x2b')],_0x2b2848[_0xf4b4('0x25')]);_0x323b56[_0xf4b4('0x30')]=_[_0xf4b4('0x2f')](_0x2b2848[_0xf4b4('0x2b')],qs[_0xf4b4('0x31')](_0x5362bf[_0xf4b4('0x25')]['fields']));_0x323b56[_0xf4b4('0x30')]=_0x323b56[_0xf4b4('0x30')][_0xf4b4('0x32')]?_0x323b56['attributes']:_0x2b2848[_0xf4b4('0x2b')];if(_0x5362bf[_0xf4b4('0x25')][_0xf4b4('0x33')]){_0x323b56['include']=[{'all':!![]}];}_0x323b56=_[_0xf4b4('0x34')]({},_0x323b56,_0x5362bf[_0xf4b4('0x35')]);return db[_0xf4b4('0x21')][_0xf4b4('0x36')](_0x323b56)[_0xf4b4('0x16')](handleEntityNotFound(_0x2d6430,null))['then'](respondWithResult(_0x2d6430,null))[_0xf4b4('0x28')](handleError(_0x2d6430,null));};exports['create']=function(_0x667951,_0x3a8a03){return db['OpenchannelQueue'][_0xf4b4('0x37')](_0x667951['body'],{})[_0xf4b4('0x16')](function(_0x2cca20){var _0x30a3fa=_0x667951[_0xf4b4('0x38')][_0xf4b4('0x18')]({'plain':!![]});if(!_0x30a3fa)throw new Error(_0xf4b4('0x39'));if(_0x30a3fa[_0xf4b4('0x3a')]===_0xf4b4('0x38')){var _0x52b28e=_0x2cca20[_0xf4b4('0x18')]({'plain':!![]});var _0x9041f='OpenchannelQueues';return db[_0xf4b4('0x3b')][_0xf4b4('0x36')]({'where':{'name':_0x9041f,'userProfileId':_0x30a3fa['userProfileId']},'raw':!![]})['then'](function(_0x296514){if(_0x296514&&_0x296514[_0xf4b4('0x3c')]===0x0){return db[_0xf4b4('0x1a')][_0xf4b4('0x37')]({'name':_0x52b28e[_0xf4b4('0x1d')],'resourceId':_0x52b28e['id'],'type':_0x296514[_0xf4b4('0x1d')],'sectionId':_0x296514['id']},{})[_0xf4b4('0x16')](function(){return _0x2cca20;});}else{return _0x2cca20;}})[_0xf4b4('0x28')](function(_0x400058){logger[_0xf4b4('0x1c')](_0xf4b4('0x3d'),_0x400058);throw _0x400058;});}return _0x2cca20;})[_0xf4b4('0x16')](respondWithResult(_0x3a8a03,0xc9))[_0xf4b4('0x28')](handleError(_0x3a8a03,null));};exports[_0xf4b4('0x3e')]=function(_0x2d981e,_0x241a43){if(_0x2d981e['body']['id']){delete _0x2d981e[_0xf4b4('0x3f')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x2d981e[_0xf4b4('0x2a')]['id']}})[_0xf4b4('0x16')](handleEntityNotFound(_0x241a43,null))[_0xf4b4('0x16')](saveUpdates(_0x2d981e[_0xf4b4('0x3f')],null))[_0xf4b4('0x16')](respondWithResult(_0x241a43,null))[_0xf4b4('0x28')](handleError(_0x241a43,null));};exports[_0xf4b4('0x17')]=function(_0x5a9fee,_0x411fd2){return db['OpenchannelQueue'][_0xf4b4('0x36')]({'where':{'id':_0x5a9fee['params']['id']}})[_0xf4b4('0x16')](handleEntityNotFound(_0x411fd2,null))[_0xf4b4('0x16')](removeEntity(_0x411fd2,null))['catch'](handleError(_0x411fd2,null));};exports[_0xf4b4('0x40')]=function(_0x30b699,_0x3975bc){return db[_0xf4b4('0x21')][_0xf4b4('0x40')]()['then'](respondWithResult(_0x3975bc,null))[_0xf4b4('0x28')](handleError(_0x3975bc,null));};exports[_0xf4b4('0x41')]=function(_0x4bdbf2,_0x172d97){var _0x2a6198={'raw':!![],'where':{}},_0x40afd9={},_0x4fe0b6;return db[_0xf4b4('0x21')][_0xf4b4('0x42')]({'where':{'id':_0x4bdbf2[_0xf4b4('0x2a')]['id']}})[_0xf4b4('0x16')](handleEntityNotFound(_0x172d97,null))['then'](function(_0x368b7b){if(_0x368b7b){_0x4fe0b6=_0x368b7b[_0xf4b4('0x18')]({'plain':!![]});_0x40afd9[_0xf4b4('0x2b')]=_[_0xf4b4('0x2c')](db[_0xf4b4('0x43')][_0xf4b4('0x2d')]);_0x40afd9[_0xf4b4('0x25')]=_[_0xf4b4('0x2c')](_0x4bdbf2[_0xf4b4('0x25')]);_0x40afd9[_0xf4b4('0x2e')]=_[_0xf4b4('0x2f')](_0x40afd9['model'],_0x40afd9[_0xf4b4('0x25')]);_0x2a6198[_0xf4b4('0x30')]=_[_0xf4b4('0x2f')](_0x40afd9[_0xf4b4('0x2b')],qs[_0xf4b4('0x31')](_0x4bdbf2[_0xf4b4('0x25')][_0xf4b4('0x31')]));_0x2a6198['attributes']=_0x2a6198[_0xf4b4('0x30')][_0xf4b4('0x32')]?_0x2a6198[_0xf4b4('0x30')]:_0x40afd9[_0xf4b4('0x2b')];if(!_0x4bdbf2[_0xf4b4('0x25')][_0xf4b4('0x44')](_0xf4b4('0x45'))){_0x2a6198['limit']=qs['limit'](_0x4bdbf2[_0xf4b4('0x25')]['limit']);_0x2a6198[_0xf4b4('0x12')]=qs['offset'](_0x4bdbf2['query'][_0xf4b4('0x12')]);}_0x2a6198[_0xf4b4('0x46')]=qs[_0xf4b4('0x47')](_0x4bdbf2[_0xf4b4('0x25')]['sort']);_0x2a6198[_0xf4b4('0x48')]=qs[_0xf4b4('0x2e')](_[_0xf4b4('0x49')](_0x4bdbf2[_0xf4b4('0x25')],_0x40afd9[_0xf4b4('0x2e')]));_0x2a6198[_0xf4b4('0x48')][_0xf4b4('0x4a')]=_0x368b7b['id'];if(_0x4bdbf2[_0xf4b4('0x25')]['filter']){_0x2a6198[_0xf4b4('0x48')]=_['merge'](_0x2a6198[_0xf4b4('0x48')],{'$or':_[_0xf4b4('0x20')](_0x2a6198[_0xf4b4('0x30')],function(_0x4194eb){var _0x50498d={};_0x50498d[_0x4194eb]={'$like':'%'+_0x4bdbf2[_0xf4b4('0x25')][_0xf4b4('0x4b')]+'%'};return _0x50498d;})});}_0x2a6198=_['merge']({},_0x2a6198,_0x4bdbf2[_0xf4b4('0x35')]);return db[_0xf4b4('0x43')][_0xf4b4('0x26')](_0x2a6198);}})['then'](function(_0x415535){if(_0x415535){return db[_0xf4b4('0x4c')]['findAndCountAll']({'where':{'id':_[_0xf4b4('0x20')](_0x415535,_0xf4b4('0x4d')),'role':_0xf4b4('0x4e')},'attributes':['id','name','openchannelPause',_0xf4b4('0x4f'),'createdAt']});}})[_0xf4b4('0x16')](function(_0x3ce94e){if(_0x3ce94e){return{'count':_0x3ce94e[_0xf4b4('0x11')],'rows':_[_0xf4b4('0x20')](_0x3ce94e['rows'],function(_0x111c73){return{'membername':_0x111c73[_0xf4b4('0x1d')],'UserId':_0x111c73['id'],'queue_name':_0x4fe0b6[_0xf4b4('0x1d')],'OpenchannelQueueId':_0x4fe0b6['id'],'interface':util['format']('%s/%s','SIP',_0x111c73['name']),'penalty':0x0,'paused':_0x111c73[_0xf4b4('0x50')],'createdAt':_0x111c73[_0xf4b4('0x51')],'updatedAt':_0x111c73[_0xf4b4('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf4b4('0x16')](respondWithFilteredResult(_0x172d97,_0x2a6198))[_0xf4b4('0x28')](handleError(_0x172d97,null));};exports['getTeams']=function(_0x4fef4e,_0x4e022c){var _0x12d30b={};var _0x518d73={};var _0x54813b;var _0x470fcf;return db['OpenchannelQueue'][_0xf4b4('0x42')]({'where':{'id':_0x4fef4e[_0xf4b4('0x2a')]['id']}})[_0xf4b4('0x16')](handleEntityNotFound(_0x4e022c,null))['then'](function(_0x13a755){if(_0x13a755){_0x54813b=_0x13a755;_0x518d73[_0xf4b4('0x2b')]=_[_0xf4b4('0x2c')](db[_0xf4b4('0x52')][_0xf4b4('0x2d')]);_0x518d73[_0xf4b4('0x25')]=_[_0xf4b4('0x2c')](_0x4fef4e[_0xf4b4('0x25')]);_0x518d73[_0xf4b4('0x2e')]=_[_0xf4b4('0x2f')](_0x518d73[_0xf4b4('0x2b')],_0x518d73[_0xf4b4('0x25')]);_0x12d30b[_0xf4b4('0x30')]=_['intersection'](_0x518d73['model'],qs[_0xf4b4('0x31')](_0x4fef4e['query'][_0xf4b4('0x31')]));_0x12d30b[_0xf4b4('0x30')]=_0x12d30b[_0xf4b4('0x30')][_0xf4b4('0x32')]?_0x12d30b[_0xf4b4('0x30')]:_0x518d73['model'];_0x12d30b[_0xf4b4('0x46')]=qs[_0xf4b4('0x47')](_0x4fef4e[_0xf4b4('0x25')]['sort']);_0x12d30b['where']=qs[_0xf4b4('0x2e')](_[_0xf4b4('0x49')](_0x4fef4e[_0xf4b4('0x25')],_0x518d73[_0xf4b4('0x2e')]));if(_0x4fef4e[_0xf4b4('0x25')]['filter']){_0x12d30b[_0xf4b4('0x48')]=_[_0xf4b4('0x34')](_0x12d30b[_0xf4b4('0x48')],{'$or':_[_0xf4b4('0x20')](_0x12d30b['attributes'],function(_0x3248e0){var _0x4a1246={};_0x4a1246[_0x3248e0]={'$like':'%'+_0x4fef4e[_0xf4b4('0x25')][_0xf4b4('0x4b')]+'%'};return _0x4a1246;})});}_0x12d30b=_[_0xf4b4('0x34')]({},_0x12d30b,_0x4fef4e[_0xf4b4('0x35')]);return _0x54813b[_0xf4b4('0x53')](_0x12d30b);}})[_0xf4b4('0x16')](function(_0x37cd2b){if(_0x37cd2b){_0x470fcf=_0x37cd2b[_0xf4b4('0x32')];if(!_0x4fef4e[_0xf4b4('0x25')][_0xf4b4('0x44')](_0xf4b4('0x45'))){_0x12d30b[_0xf4b4('0x13')]=qs[_0xf4b4('0x13')](_0x4fef4e[_0xf4b4('0x25')][_0xf4b4('0x13')]);_0x12d30b[_0xf4b4('0x12')]=qs[_0xf4b4('0x12')](_0x4fef4e['query']['offset']);}return _0x54813b[_0xf4b4('0x53')](_0x12d30b);}})[_0xf4b4('0x16')](function(_0x2432c7){if(_0x2432c7){return _0x2432c7?{'count':_0x470fcf,'rows':_0x2432c7}:null;}})[_0xf4b4('0x16')](respondWithResult(_0x4e022c,null))['catch'](handleError(_0x4e022c,null));};exports[_0xf4b4('0x54')]=function(_0x3ee8f8,_0x1f0c1e){var _0x1be9a8=_0x3ee8f8[_0xf4b4('0x3f')][_0xf4b4('0x55')];return db[_0xf4b4('0x52')]['findAll']({'where':{'id':_0x1be9a8},'attributes':['id'],'include':[{'model':db[_0xf4b4('0x4c')],'as':_0xf4b4('0x56'),'attributes':['id',_0xf4b4('0x1d'),_0xf4b4('0x57'),_0xf4b4('0x58'),_0xf4b4('0x59')],'raw':!![]}]})[_0xf4b4('0x16')](function(_0x4b62c3){if(_0x4b62c3){var _0x3c24b8=_[_0xf4b4('0x5a')](_0x4b62c3,function(_0x5f1456){var _0x4c2721=_0x5f1456['get']({'plain':!![]});return _0x4c2721[_0xf4b4('0x56')];});return db[_0xf4b4('0x21')][_0xf4b4('0x36')]({'where':{'id':_0x3ee8f8[_0xf4b4('0x2a')]['id']}})[_0xf4b4('0x16')](function(_0x25c69f){return db[_0xf4b4('0x5b')][_0xf4b4('0x5c')](function(_0x42646a){return _0x25c69f['addTeams'](_0x1be9a8,{'transaction':_0x42646a})[_0xf4b4('0x16')](function(){return BPromise[_0xf4b4('0x5d')](_0x3c24b8,function(_0xcbd072){return db[_0xf4b4('0x43')]['findOrCreate']({'where':{'UserId':_0xcbd072['id'],'OpenchannelQueueId':_0x3ee8f8[_0xf4b4('0x2a')]['id']},'transaction':_0x42646a});});})[_0xf4b4('0x16')](function(){_0x3c24b8[_0xf4b4('0x5e')](function(_0x41aac4){socket[_0xf4b4('0x5f')](_0xf4b4('0x60'),{'UserId':_0x41aac4['id'],'OpenchannelQueueId':_0x25c69f['id']});});});});});}})[_0xf4b4('0x16')](respondWithStatusCode(_0x1f0c1e,null))[_0xf4b4('0x28')](handleError(_0x1f0c1e,null));};exports[_0xf4b4('0x61')]=function(_0x1ea92,_0x21136a){return db[_0xf4b4('0x52')][_0xf4b4('0x26')]({'where':{'id':_0x1ea92[_0xf4b4('0x25')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf4b4('0x4c')],'as':_0xf4b4('0x56'),'attributes':['id'],'raw':!![]}]})[_0xf4b4('0x16')](handleEntityNotFound(_0x21136a,null))['then'](function(_0x30728d){var _0x5c7ebd=_['map'](_0x30728d,'id');var _0x52e260=[];var _0x3bc3e1=[];var _0x19ab91=squel[_0xf4b4('0x62')]();_0x19ab91[_0xf4b4('0x63')](_0xf4b4('0x64'))[_0xf4b4('0x65')](_0xf4b4('0x66'),'tq')[_0xf4b4('0x67')](_0xf4b4('0x68'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xf4b4('0x69'),_0x1ea92['params']['id']);for(var _0x159fca=0x0;_0x159fca<_0x30728d[_0xf4b4('0x32')];_0x159fca+=0x1){let _0x305766=_0x30728d[_0x159fca];for(var _0x45d4fa=0x0;_0x45d4fa<_0x305766[_0xf4b4('0x56')]['length'];_0x45d4fa+=0x1){let _0x40e4f8=_0x305766[_0xf4b4('0x56')][_0x45d4fa];var _0x264707=_0x19ab91[_0xf4b4('0x6a')]();_0x264707[_0xf4b4('0x48')]('ut.UserId\x20=\x20?',_0x40e4f8['id']);_0x3bc3e1[_0xf4b4('0x6b')](db[_0xf4b4('0x5b')][_0xf4b4('0x25')](_0x264707[_0xf4b4('0x6c')](),{'type':db[_0xf4b4('0x5b')][_0xf4b4('0x6d')][_0xf4b4('0x6e')]})[_0xf4b4('0x16')](function(_0x12d888){if(_0x12d888[_0xf4b4('0x32')]===0x1){return _0x40e4f8['id'];}else{var _0x1bd938=_['every'](_[_0xf4b4('0x20')](_0x12d888,_0xf4b4('0x6f')),function(_0xbb869c){return _[_0xf4b4('0x70')](_0x5c7ebd,_0xbb869c);});if(_0x1bd938){return _0x40e4f8['id'];}}}));}}return BPromise[_0xf4b4('0x71')](_0x3bc3e1)[_0xf4b4('0x16')](function(_0x1ee161){_0x52e260=_(_0x52e260)['union'](_0x1ee161)[_0xf4b4('0x72')]()[_0xf4b4('0x73')]();return db[_0xf4b4('0x21')]['find']({'where':{'id':_0x1ea92[_0xf4b4('0x2a')]['id']}})[_0xf4b4('0x16')](function(_0x834a4c){return db[_0xf4b4('0x5b')]['transaction'](function(_0x46a6a5){return _0x834a4c[_0xf4b4('0x61')](_0x1ea92[_0xf4b4('0x25')]['ids'],{'transaction':_0x46a6a5})[_0xf4b4('0x16')](function(){if(!_[_0xf4b4('0x74')](_0x52e260)){return _0x834a4c[_0xf4b4('0x75')](_0x52e260,{'transaction':_0x46a6a5});}})[_0xf4b4('0x16')](function(){_0x52e260['forEach'](function(_0x6a68aa){socket['emit'](_0xf4b4('0x76'),{'UserId':_0x6a68aa,'OpenchannelQueueId':_0x834a4c['id']});});});});});});})[_0xf4b4('0x16')](respondWithStatusCode(_0x21136a,null))[_0xf4b4('0x28')](handleError(_0x21136a,null));};exports[_0xf4b4('0x77')]=function(_0x182491,_0x57120f){return db['OpenchannelQueue'][_0xf4b4('0x36')]({'where':{'id':_0x182491[_0xf4b4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x57120f,null))['then'](function(_0x3cd495){if(_0x3cd495){return _0x3cd495[_0xf4b4('0x77')](_0x182491[_0xf4b4('0x3f')][_0xf4b4('0x55')],_[_0xf4b4('0x78')](_0x182491['body'],[_0xf4b4('0x55'),'id'])||{})[_0xf4b4('0x79')](function(_0x231804){for(var _0xb514c0=0x0;_0xb514c0<_0x182491[_0xf4b4('0x3f')]['ids'][_0xf4b4('0x32')];_0xb514c0+=0x1){socket[_0xf4b4('0x5f')](_0xf4b4('0x60'),{'UserId':Number(_0x182491[_0xf4b4('0x3f')][_0xf4b4('0x55')][_0xb514c0]),'OpenchannelQueueId':Number(_0x182491[_0xf4b4('0x2a')]['id'])});}return _0x231804;});}})[_0xf4b4('0x16')](respondWithResult(_0x57120f,null))[_0xf4b4('0x28')](handleError(_0x57120f,null));};exports[_0xf4b4('0x75')]=function(_0x1dd88d,_0x51b78c){return db[_0xf4b4('0x21')][_0xf4b4('0x36')]({'where':{'id':_0x1dd88d[_0xf4b4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x51b78c,null))[_0xf4b4('0x16')](function(_0x477c43){if(_0x477c43){return _0x477c43[_0xf4b4('0x75')](_0x1dd88d[_0xf4b4('0x25')]['ids'])[_0xf4b4('0x16')](function(){if(_[_0xf4b4('0x7a')](_0x1dd88d[_0xf4b4('0x25')][_0xf4b4('0x55')])){for(var _0x31310e=0x0;_0x31310e<_0x1dd88d[_0xf4b4('0x25')][_0xf4b4('0x55')]['length'];_0x31310e+=0x1){socket['emit'](_0xf4b4('0x76'),{'UserId':Number(_0x1dd88d['query'][_0xf4b4('0x55')][_0x31310e]),'OpenchannelQueueId':Number(_0x1dd88d[_0xf4b4('0x2a')]['id'])});}}else{socket[_0xf4b4('0x5f')](_0xf4b4('0x76'),{'UserId':Number(_0x1dd88d[_0xf4b4('0x25')][_0xf4b4('0x55')]),'OpenchannelQueueId':Number(_0x1dd88d[_0xf4b4('0x2a')]['id'])});}});}})[_0xf4b4('0x16')](respondWithStatusCode(_0x51b78c,null))[_0xf4b4('0x28')](handleError(_0x51b78c,null));};exports[_0xf4b4('0x7b')]=function(_0x2a5a13,_0x2a974a){var _0x5c35ec={};var _0x2e0571={};var _0x5a9ffd;var _0x491a6b;return db[_0xf4b4('0x21')][_0xf4b4('0x42')]({'where':{'id':_0x2a5a13[_0xf4b4('0x2a')]['id']}})[_0xf4b4('0x16')](handleEntityNotFound(_0x2a974a,null))[_0xf4b4('0x16')](function(_0x268e06){if(_0x268e06){_0x5a9ffd=_0x268e06;_0x2e0571[_0xf4b4('0x2b')]=_[_0xf4b4('0x2c')](db[_0xf4b4('0x4c')][_0xf4b4('0x2d')]);_0x2e0571['query']=_[_0xf4b4('0x2c')](_0x2a5a13['query']);_0x2e0571[_0xf4b4('0x2e')]=_[_0xf4b4('0x2f')](_0x2e0571['model'],_0x2e0571[_0xf4b4('0x25')]);_0x5c35ec[_0xf4b4('0x30')]=_[_0xf4b4('0x2f')](_0x2e0571[_0xf4b4('0x2b')],qs[_0xf4b4('0x31')](_0x2a5a13['query'][_0xf4b4('0x31')]));_0x5c35ec['attributes']=_0x5c35ec['attributes'][_0xf4b4('0x32')]?_0x5c35ec['attributes']:_0x2e0571[_0xf4b4('0x2b')];_0x5c35ec[_0xf4b4('0x46')]=qs[_0xf4b4('0x47')](_0x2a5a13[_0xf4b4('0x25')][_0xf4b4('0x47')]);_0x5c35ec[_0xf4b4('0x48')]=qs[_0xf4b4('0x2e')](_[_0xf4b4('0x49')](_0x2a5a13['query'],_0x2e0571['filters']));if(_0x2a5a13[_0xf4b4('0x25')][_0xf4b4('0x4b')]){_0x5c35ec['where']=_[_0xf4b4('0x34')](_0x5c35ec[_0xf4b4('0x48')],{'$or':_[_0xf4b4('0x20')](_0x5c35ec['attributes'],function(_0x2c10f5){var _0x174ab2={};_0x174ab2[_0x2c10f5]={'$like':'%'+_0x2a5a13[_0xf4b4('0x25')]['filter']+'%'};return _0x174ab2;})});}_0x5c35ec=_[_0xf4b4('0x34')]({},_0x5c35ec,_0x2a5a13[_0xf4b4('0x35')]);return _0x5a9ffd[_0xf4b4('0x7b')](_0x5c35ec);}})[_0xf4b4('0x16')](function(_0xe2cbc){if(_0xe2cbc){_0x491a6b=_0xe2cbc['length'];if(!_0x2a5a13[_0xf4b4('0x25')][_0xf4b4('0x44')](_0xf4b4('0x45'))){_0x5c35ec['limit']=qs[_0xf4b4('0x13')](_0x2a5a13[_0xf4b4('0x25')][_0xf4b4('0x13')]);_0x5c35ec[_0xf4b4('0x12')]=qs[_0xf4b4('0x12')](_0x2a5a13[_0xf4b4('0x25')]['offset']);}return _0x5a9ffd[_0xf4b4('0x7b')](_0x5c35ec);}})[_0xf4b4('0x16')](function(_0x378278){if(_0x378278){return _0x378278?{'count':_0x491a6b,'rows':_0x378278}:null;}})[_0xf4b4('0x16')](respondWithResult(_0x2a974a,null))[_0xf4b4('0x28')](handleError(_0x2a974a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 55694c2..23db8c9 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 _0x4cb8=['remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x550c34,_0x24725e){var _0x5b91f6=function(_0x43bc66){while(--_0x43bc66){_0x550c34['push'](_0x550c34['shift']());}};_0x5b91f6(++_0x24725e);}(_0x4cb8,0x9c));var _0x84cb=function(_0x188eaf,_0x46bd1c){_0x188eaf=_0x188eaf-0x0;var _0x5e9e64=_0x4cb8[_0x188eaf];return _0x5e9e64;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x84cb('0x0'))['db'][_0x84cb('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x84cb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x84cb('0x3'),'afterDestroy':_0x84cb('0x4')};function emitEvent(_0x34d60a){return function(_0x1f4d9f,_0x37d1e8,_0x148454){OpenchannelQueueEvents['emit'](_0x34d60a+':'+_0x1f4d9f['id'],_0x1f4d9f);OpenchannelQueueEvents[_0x84cb('0x5')](_0x34d60a,_0x1f4d9f);_0x148454(null);};}for(var e in events){if(events[_0x84cb('0x6')](e)){var event=events[e];OpenchannelQueue[_0x84cb('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x89ad=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','save'];(function(_0x357607,_0x321cdb){var _0x473cf6=function(_0x1f6a8e){while(--_0x1f6a8e){_0x357607['push'](_0x357607['shift']());}};_0x473cf6(++_0x321cdb);}(_0x89ad,0xdd));var _0xd89a=function(_0x5cb834,_0x1e3619){_0x5cb834=_0x5cb834-0x0;var _0x418cd5=_0x89ad[_0x5cb834];return _0x418cd5;};'use strict';var EventEmitter=require(_0xd89a('0x0'));var OpenchannelQueue=require(_0xd89a('0x1'))['db'][_0xd89a('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd89a('0x3'),'afterUpdate':_0xd89a('0x4'),'afterDestroy':_0xd89a('0x5')};function emitEvent(_0x3f0b8a){return function(_0x121b08,_0x5d5c67,_0x25bb22){OpenchannelQueueEvents[_0xd89a('0x6')](_0x3f0b8a+':'+_0x121b08['id'],_0x121b08);OpenchannelQueueEvents[_0xd89a('0x6')](_0x3f0b8a,_0x121b08);_0x25bb22(null);};}for(var e in events){if(events[_0xd89a('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xd89a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b5686ed..6818cd4 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 _0x616d=['OpenchannelQueue','lodash','util','../../config/logger','moment','path','rimraf','./openchannelQueue.attributes','exports','define'];(function(_0x2dff78,_0x5c57fc){var _0x29bdcc=function(_0x4005aa){while(--_0x4005aa){_0x2dff78['push'](_0x2dff78['shift']());}};_0x29bdcc(++_0x5c57fc);}(_0x616d,0x1b9));var _0xd616=function(_0x500ea9,_0x4add67){_0x500ea9=_0x500ea9-0x0;var _0x2cd5a2=_0x616d[_0x500ea9];return _0x2cd5a2;};'use strict';var _=require(_0xd616('0x0'));var util=require(_0xd616('0x1'));var logger=require(_0xd616('0x2'))('api');var moment=require(_0xd616('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd616('0x4'));var rimraf=require(_0xd616('0x5'));var config=require('../../config/environment');var attributes=require(_0xd616('0x6'));module[_0xd616('0x7')]=function(_0xb84c8a,_0x4fb36b){return _0xb84c8a[_0xd616('0x8')](_0xd616('0x9'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18a9=['../../config/logger','api','bluebird','exports','define','OpenchannelQueue','openchannel_queues','lodash','util'];(function(_0x2cc8a6,_0x151896){var _0x5b6f45=function(_0xcabeb6){while(--_0xcabeb6){_0x2cc8a6['push'](_0x2cc8a6['shift']());}};_0x5b6f45(++_0x151896);}(_0x18a9,0x1ed));var _0x918a=function(_0x3c34d3,_0x586c2d){_0x3c34d3=_0x3c34d3-0x0;var _0x15bd5f=_0x18a9[_0x3c34d3];return _0x15bd5f;};'use strict';var _=require(_0x918a('0x0'));var util=require(_0x918a('0x1'));var logger=require(_0x918a('0x2'))(_0x918a('0x3'));var moment=require('moment');var BPromise=require(_0x918a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x918a('0x5')]=function(_0x17adcf,_0x34e1d6){return _0x17adcf[_0x918a('0x6')](_0x918a('0x7'),attributes,{'tableName':_0x918a('0x8'),'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 a6a03f7..5fda4ec 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 _0xf474=['then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','options','where','attributes','include','map','model','ShowOpenchannelQueue','OpenchannelQueue','find','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xf474,0x89));var _0x4f47=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xf474[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x4f47('0x0'));var util=require(_0x4f47('0x1'));var moment=require('moment');var BPromise=require(_0x4f47('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f47('0x3'))['db'];var utils=require(_0x4f47('0x4'));var logger=require(_0x4f47('0x5'))(_0x4f47('0x6'));var config=require(_0x4f47('0x7'));var jayson=require(_0x4f47('0x8'));var client=jayson[_0x4f47('0x9')][_0x4f47('0xa')]({'port':0x232a});config[_0x4f47('0xb')]=_[_0x4f47('0xc')](config[_0x4f47('0xb')],{'host':_0x4f47('0xd'),'port':0x18eb});var socket=require(_0x4f47('0xe'))(new Redis(config[_0x4f47('0xb')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x5ac6a5,_0x10f1d8,_0x4c14f3){return new BPromise(function(_0x598797,_0x4ecb67){return client['request'](_0x5ac6a5,_0x4c14f3)[_0x4f47('0xf')](function(_0x2c5970){logger['info'](_0x4f47('0x10'),_0x10f1d8,_0x4f47('0x11'));logger[_0x4f47('0x12')](_0x4f47('0x13'),_0x10f1d8,_0x4f47('0x11'),JSON[_0x4f47('0x14')](_0x2c5970));if(_0x2c5970['error']){if(_0x2c5970[_0x4f47('0x15')][_0x4f47('0x16')]===0x1f4){logger[_0x4f47('0x15')](_0x4f47('0x10'),_0x10f1d8,_0x2c5970[_0x4f47('0x15')][_0x4f47('0x17')]);return _0x4ecb67(_0x2c5970['error'][_0x4f47('0x17')]);}logger[_0x4f47('0x15')](_0x4f47('0x10'),_0x10f1d8,_0x2c5970[_0x4f47('0x15')][_0x4f47('0x17')]);return _0x598797(_0x2c5970['error'][_0x4f47('0x17')]);}else{logger[_0x4f47('0x18')](_0x4f47('0x10'),_0x10f1d8,_0x4f47('0x11'));_0x598797(_0x2c5970[_0x4f47('0x19')][_0x4f47('0x17')]);}})[_0x4f47('0x1a')](function(_0x1c9ca8){logger[_0x4f47('0x15')](_0x4f47('0x10'),_0x10f1d8,_0x1c9ca8);_0x4ecb67(_0x1c9ca8);});});}exports[_0x4f47('0x1b')]=function(_0x4fbff0){var _0x47c3b8=this;return new Promise(function(_0x481cd6,_0x4a576e){return db['OpenchannelQueue']['findAll']({'raw':_0x4fbff0[_0x4f47('0x1c')]?_0x4fbff0['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fbff0[_0x4f47('0x1c')]?_0x4fbff0['options'][_0x4f47('0x1d')]||null:null,'attributes':_0x4fbff0[_0x4f47('0x1c')]?_0x4fbff0[_0x4f47('0x1c')][_0x4f47('0x1e')]||null:null,'limit':_0x4fbff0[_0x4f47('0x1c')]?_0x4fbff0[_0x4f47('0x1c')]['limit']||null:null,'include':_0x4fbff0[_0x4f47('0x1c')]?_0x4fbff0[_0x4f47('0x1c')][_0x4f47('0x1f')]?_[_0x4f47('0x20')](_0x4fbff0[_0x4f47('0x1c')]['include'],function(_0x366519){return{'model':db[_0x366519['model']],'as':_0x366519['as'],'attributes':_0x366519['attributes'],'include':_0x366519[_0x4f47('0x1f')]?_[_0x4f47('0x20')](_0x366519['include'],function(_0x2706fc){return{'model':db[_0x2706fc[_0x4f47('0x21')]],'as':_0x2706fc['as'],'attributes':_0x2706fc[_0x4f47('0x1e')],'include':_0x2706fc[_0x4f47('0x1f')]?_[_0x4f47('0x20')](_0x2706fc[_0x4f47('0x1f')],function(_0x2a6903){return{'model':db[_0x2a6903['model']],'as':_0x2a6903['as'],'attributes':_0x2a6903[_0x4f47('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x180ed6){logger[_0x4f47('0x18')](_0x4f47('0x1b'),_0x4fbff0);logger['debug'](_0x4f47('0x1b'),_0x4fbff0,JSON['stringify'](_0x180ed6));_0x481cd6(_0x180ed6);})['catch'](function(_0x2c3279){logger['error']('GetOpenchannelQueue',_0x2c3279['message'],_0x4fbff0);_0x4a576e(_0x47c3b8[_0x4f47('0x15')](0x1f4,_0x2c3279[_0x4f47('0x17')]));});});};exports[_0x4f47('0x22')]=function(_0x4700b8){var _0x48d2cb=this;return new Promise(function(_0x3d8704,_0x3f47eb){return db[_0x4f47('0x23')][_0x4f47('0x24')]({'raw':_0x4700b8[_0x4f47('0x1c')]?_0x4700b8['options'][_0x4f47('0x25')]===undefined?!![]:![]:!![],'where':_0x4700b8[_0x4f47('0x1c')]?_0x4700b8['options'][_0x4f47('0x1d')]||null:null,'attributes':_0x4700b8['options']?_0x4700b8[_0x4f47('0x1c')]['attributes']||null:null,'include':_0x4700b8[_0x4f47('0x1c')]?_0x4700b8[_0x4f47('0x1c')]['include']?_[_0x4f47('0x20')](_0x4700b8[_0x4f47('0x1c')][_0x4f47('0x1f')],function(_0x5784f3){return{'model':db[_0x5784f3[_0x4f47('0x21')]],'as':_0x5784f3['as'],'attributes':_0x5784f3['attributes'],'include':_0x5784f3[_0x4f47('0x1f')]?_[_0x4f47('0x20')](_0x5784f3[_0x4f47('0x1f')],function(_0x68e999){return{'model':db[_0x68e999[_0x4f47('0x21')]],'as':_0x68e999['as'],'attributes':_0x68e999['attributes'],'include':_0x68e999[_0x4f47('0x1f')]?_[_0x4f47('0x20')](_0x68e999[_0x4f47('0x1f')],function(_0x8830a8){return{'model':db[_0x8830a8[_0x4f47('0x21')]],'as':_0x8830a8['as'],'attributes':_0x8830a8[_0x4f47('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e38d3){logger[_0x4f47('0x18')](_0x4f47('0x22'),_0x4700b8);logger['debug'](_0x4f47('0x22'),_0x4700b8,JSON[_0x4f47('0x14')](_0x2e38d3));_0x3d8704(_0x2e38d3);})[_0x4f47('0x1a')](function(_0x2e5612){logger[_0x4f47('0x15')](_0x4f47('0x22'),_0x2e5612[_0x4f47('0x17')],_0x4700b8);_0x3f47eb(_0x48d2cb['error'](0x1f4,_0x2e5612[_0x4f47('0x17')]));});});}; \ No newline at end of file +var _0x5a19=['defaults','redis','localhost','socket.io-emitter','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2ecb0f,_0x5581e5){var _0xaec662=function(_0x3d20f5){while(--_0x3d20f5){_0x2ecb0f['push'](_0x2ecb0f['shift']());}};_0xaec662(++_0x5581e5);}(_0x5a19,0x69));var _0x95a1=function(_0x388679,_0x502313){_0x388679=_0x388679-0x0;var _0x3392fa=_0x5a19[_0x388679];return _0x3392fa;};'use strict';var _=require(_0x95a1('0x0'));var util=require('util');var moment=require(_0x95a1('0x1'));var BPromise=require(_0x95a1('0x2'));var rs=require(_0x95a1('0x3'));var fs=require('fs');var Redis=require(_0x95a1('0x4'));var db=require(_0x95a1('0x5'))['db'];var utils=require(_0x95a1('0x6'));var logger=require(_0x95a1('0x7'))(_0x95a1('0x8'));var config=require(_0x95a1('0x9'));var jayson=require(_0x95a1('0xa'));var client=jayson[_0x95a1('0xb')]['http']({'port':0x232a});config['redis']=_[_0x95a1('0xc')](config[_0x95a1('0xd')],{'host':_0x95a1('0xe'),'port':0x18eb});var socket=require(_0x95a1('0xf'))(new Redis(config[_0x95a1('0xd')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x29b95e,_0x126fa3,_0x518abe){return new BPromise(function(_0x5ecd65,_0x39d734){return client['request'](_0x29b95e,_0x518abe)[_0x95a1('0x10')](function(_0x2037d7){logger[_0x95a1('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x126fa3,'request\x20sent');logger[_0x95a1('0x12')](_0x95a1('0x13'),_0x126fa3,_0x95a1('0x14'),JSON[_0x95a1('0x15')](_0x2037d7));if(_0x2037d7[_0x95a1('0x16')]){if(_0x2037d7[_0x95a1('0x16')]['code']===0x1f4){logger[_0x95a1('0x16')](_0x95a1('0x17'),_0x126fa3,_0x2037d7[_0x95a1('0x16')][_0x95a1('0x18')]);return _0x39d734(_0x2037d7[_0x95a1('0x16')][_0x95a1('0x18')]);}logger[_0x95a1('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x126fa3,_0x2037d7[_0x95a1('0x16')][_0x95a1('0x18')]);return _0x5ecd65(_0x2037d7[_0x95a1('0x16')]['message']);}else{logger[_0x95a1('0x11')](_0x95a1('0x17'),_0x126fa3,_0x95a1('0x14'));_0x5ecd65(_0x2037d7['result']['message']);}})[_0x95a1('0x19')](function(_0x371ff2){logger[_0x95a1('0x16')](_0x95a1('0x17'),_0x126fa3,_0x371ff2);_0x39d734(_0x371ff2);});});}exports[_0x95a1('0x1a')]=function(_0x37c516){var _0x568661=this;return new Promise(function(_0x41a260,_0x13100b){return db[_0x95a1('0x1b')][_0x95a1('0x1c')]({'raw':_0x37c516[_0x95a1('0x1d')]?_0x37c516[_0x95a1('0x1d')][_0x95a1('0x1e')]===undefined?!![]:![]:!![],'where':_0x37c516[_0x95a1('0x1d')]?_0x37c516[_0x95a1('0x1d')]['where']||null:null,'attributes':_0x37c516['options']?_0x37c516[_0x95a1('0x1d')][_0x95a1('0x1f')]||null:null,'limit':_0x37c516[_0x95a1('0x1d')]?_0x37c516[_0x95a1('0x1d')][_0x95a1('0x20')]||null:null,'include':_0x37c516[_0x95a1('0x1d')]?_0x37c516[_0x95a1('0x1d')][_0x95a1('0x21')]?_[_0x95a1('0x22')](_0x37c516[_0x95a1('0x1d')][_0x95a1('0x21')],function(_0xc969c0){return{'model':db[_0xc969c0['model']],'as':_0xc969c0['as'],'attributes':_0xc969c0[_0x95a1('0x1f')],'include':_0xc969c0[_0x95a1('0x21')]?_[_0x95a1('0x22')](_0xc969c0[_0x95a1('0x21')],function(_0x3a1689){return{'model':db[_0x3a1689[_0x95a1('0x23')]],'as':_0x3a1689['as'],'attributes':_0x3a1689[_0x95a1('0x1f')],'include':_0x3a1689[_0x95a1('0x21')]?_[_0x95a1('0x22')](_0x3a1689[_0x95a1('0x21')],function(_0x4e25da){return{'model':db[_0x4e25da[_0x95a1('0x23')]],'as':_0x4e25da['as'],'attributes':_0x4e25da[_0x95a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x95a1('0x10')](function(_0x47b027){logger['info'](_0x95a1('0x1a'),_0x37c516);logger['debug']('GetOpenchannelQueue',_0x37c516,JSON[_0x95a1('0x15')](_0x47b027));_0x41a260(_0x47b027);})['catch'](function(_0x249807){logger[_0x95a1('0x16')]('GetOpenchannelQueue',_0x249807[_0x95a1('0x18')],_0x37c516);_0x13100b(_0x568661[_0x95a1('0x16')](0x1f4,_0x249807['message']));});});};exports['ShowOpenchannelQueue']=function(_0x2c1eb6){var _0x1eb350=this;return new Promise(function(_0x1509d8,_0x3fe560){return db['OpenchannelQueue'][_0x95a1('0x24')]({'raw':_0x2c1eb6[_0x95a1('0x1d')]?_0x2c1eb6[_0x95a1('0x1d')][_0x95a1('0x1e')]===undefined?!![]:![]:!![],'where':_0x2c1eb6[_0x95a1('0x1d')]?_0x2c1eb6[_0x95a1('0x1d')][_0x95a1('0x25')]||null:null,'attributes':_0x2c1eb6['options']?_0x2c1eb6[_0x95a1('0x1d')][_0x95a1('0x1f')]||null:null,'include':_0x2c1eb6[_0x95a1('0x1d')]?_0x2c1eb6[_0x95a1('0x1d')][_0x95a1('0x21')]?_[_0x95a1('0x22')](_0x2c1eb6['options'][_0x95a1('0x21')],function(_0xc233c9){return{'model':db[_0xc233c9[_0x95a1('0x23')]],'as':_0xc233c9['as'],'attributes':_0xc233c9[_0x95a1('0x1f')],'include':_0xc233c9['include']?_[_0x95a1('0x22')](_0xc233c9[_0x95a1('0x21')],function(_0x4b3893){return{'model':db[_0x4b3893['model']],'as':_0x4b3893['as'],'attributes':_0x4b3893[_0x95a1('0x1f')],'include':_0x4b3893['include']?_['map'](_0x4b3893[_0x95a1('0x21')],function(_0x34e5ae){return{'model':db[_0x34e5ae[_0x95a1('0x23')]],'as':_0x34e5ae['as'],'attributes':_0x34e5ae[_0x95a1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x95a1('0x10')](function(_0x2fb77d){logger['info'](_0x95a1('0x26'),_0x2c1eb6);logger['debug'](_0x95a1('0x26'),_0x2c1eb6,JSON['stringify'](_0x2fb77d));_0x1509d8(_0x2fb77d);})[_0x95a1('0x19')](function(_0x310639){logger['error'](_0x95a1('0x26'),_0x310639[_0x95a1('0x18')],_0x2c1eb6);_0x3fe560(_0x1eb350[_0x95a1('0x16')](0x1f4,_0x310639[_0x95a1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index ba10b10..d2dc42c 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 _0x7dc1=['emit','length','./openchannelQueue.events','update'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7dc1,0x92));var _0x17dc=function(_0x13e0e8,_0xd5681c){_0x13e0e8=_0x13e0e8-0x0;var _0x37079e=_0x7dc1[_0x13e0e8];return _0x37079e;};'use strict';var OpenchannelQueueEvents=require(_0x17dc('0x0'));var events=['save','remove',_0x17dc('0x1')];function createListener(_0x4ee438,_0x125d29){return function(_0x39ef6c){_0x125d29[_0x17dc('0x2')](_0x4ee438,_0x39ef6c);};}function removeListener(_0x5bcaff,_0x38debb){return function(){OpenchannelQueueEvents['removeListener'](_0x5bcaff,_0x38debb);};}exports['register']=function(_0x11aeb5){for(var _0xa748f9=0x0,_0x4113ab=events[_0x17dc('0x3')];_0xa748f9<_0x4113ab;_0xa748f9++){var _0x3cbd04=events[_0xa748f9];var _0x4582c7=createListener('openchannelQueue:'+_0x3cbd04,_0x11aeb5);OpenchannelQueueEvents['on'](_0x3cbd04,_0x4582c7);}}; \ No newline at end of file +var _0x031d=['update','emit','removeListener','register','length','remove'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x031d,0x8f));var _0xd031=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x031d[_0x1e081a];return _0x428209;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save',_0xd031('0x0'),_0xd031('0x1')];function createListener(_0x168d01,_0x183993){return function(_0x3d6d2c){_0x183993[_0xd031('0x2')](_0x168d01,_0x3d6d2c);};}function removeListener(_0x1d86cf,_0x3531ec){return function(){OpenchannelQueueEvents[_0xd031('0x3')](_0x1d86cf,_0x3531ec);};}exports[_0xd031('0x4')]=function(_0x162b3f){for(var _0x29fa79=0x0,_0x37f8d4=events[_0xd031('0x5')];_0x29fa79<_0x37f8d4;_0x29fa79++){var _0x407747=events[_0x29fa79];var _0x5a74f6=createListener('openchannelQueue:'+_0x407747,_0x162b3f);OpenchannelQueueEvents['on'](_0x407747,_0x5a74f6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ccc2a9a..8dd0ef4 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 _0x2cbe=['get','/describe','describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index'];(function(_0x12c280,_0x51dd07){var _0x3638d3=function(_0x53b273){while(--_0x53b273){_0x12c280['push'](_0x12c280['shift']());}};_0x3638d3(++_0x51dd07);}(_0x2cbe,0x73));var _0xe2cb=function(_0x408e38,_0x23cda8){_0x408e38=_0x408e38-0x0;var _0x426b0e=_0x2cbe[_0x408e38];return _0x426b0e;};'use strict';var multer=require('multer');var util=require(_0xe2cb('0x0'));var path=require(_0xe2cb('0x1'));var timeout=require(_0xe2cb('0x2'));var express=require(_0xe2cb('0x3'));var router=express['Router']();var fs_extra=require(_0xe2cb('0x4'));var auth=require(_0xe2cb('0x5'));var interaction=require(_0xe2cb('0x6'));var config=require(_0xe2cb('0x7'));var controller=require(_0xe2cb('0x8'));router['get']('/',auth[_0xe2cb('0x9')](),controller[_0xe2cb('0xa')]);router[_0xe2cb('0xb')](_0xe2cb('0xc'),auth[_0xe2cb('0x9')](),controller[_0xe2cb('0xd')]);router[_0xe2cb('0xb')](_0xe2cb('0xe'),auth['isAuthenticated'](),controller[_0xe2cb('0xf')]);router['post']('/',auth[_0xe2cb('0x9')](),controller['create']);router[_0xe2cb('0x10')](_0xe2cb('0xe'),auth[_0xe2cb('0x9')](),controller[_0xe2cb('0x11')]);router[_0xe2cb('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe2cb('0x13')]);module[_0xe2cb('0x14')]=router; \ No newline at end of file +var _0x8cfa=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','create','put','update','delete'];(function(_0x4a6edd,_0x1a4557){var _0x500ae9=function(_0x4bb92d){while(--_0x4bb92d){_0x4a6edd['push'](_0x4a6edd['shift']());}};_0x500ae9(++_0x1a4557);}(_0x8cfa,0x1a4));var _0xa8cf=function(_0x537044,_0x4de18f){_0x537044=_0x537044-0x0;var _0x5ba75e=_0x8cfa[_0x537044];return _0x5ba75e;};'use strict';var multer=require('multer');var util=require(_0xa8cf('0x0'));var path=require(_0xa8cf('0x1'));var timeout=require(_0xa8cf('0x2'));var express=require(_0xa8cf('0x3'));var router=express[_0xa8cf('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa8cf('0x5'));var interaction=require(_0xa8cf('0x6'));var config=require('../../config/environment');var controller=require(_0xa8cf('0x7'));router[_0xa8cf('0x8')]('/',auth[_0xa8cf('0x9')](),controller[_0xa8cf('0xa')]);router[_0xa8cf('0x8')]('/describe',auth[_0xa8cf('0x9')](),controller[_0xa8cf('0xb')]);router[_0xa8cf('0x8')](_0xa8cf('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa8cf('0xd')]);router[_0xa8cf('0xe')](_0xa8cf('0xc'),auth[_0xa8cf('0x9')](),controller[_0xa8cf('0xf')]);router[_0xa8cf('0x10')]('/:id',auth[_0xa8cf('0x9')](),controller[_0xa8cf('0x11')]);module[_0xa8cf('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index aca8b6a..a21b1f4 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 _0xe2f9=['DATE','exports','STRING'];(function(_0x452a21,_0x65d17d){var _0x2b0051=function(_0x323f07){while(--_0x323f07){_0x452a21['push'](_0x452a21['shift']());}};_0x2b0051(++_0x65d17d);}(_0xe2f9,0x7c));var _0x9e2f=function(_0x34f8d1,_0x2cf375){_0x34f8d1=_0x34f8d1-0x0;var _0x482cfb=_0xe2f9[_0x34f8d1];return _0x482cfb;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x9e2f('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9e2f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9e2f('0x2')]},'exitAt':{'type':Sequelize[_0x9e2f('0x2')]},'reason':{'type':Sequelize[_0x9e2f('0x1')]}}; \ No newline at end of file +var _0xb99d=['moment','exports','STRING','DATE'];(function(_0x248481,_0x32afd5){var _0x1cf886=function(_0x125f94){while(--_0x125f94){_0x248481['push'](_0x248481['shift']());}};_0x1cf886(++_0x32afd5);}(_0xb99d,0xb8));var _0xdb99=function(_0x413cce,_0x641580){_0x413cce=_0x413cce-0x0;var _0x2661a8=_0xb99d[_0x413cce];return _0x2661a8;};'use strict';var moment=require(_0xdb99('0x0'));var Sequelize=require('sequelize');module[_0xdb99('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdb99('0x2')]},'joinAt':{'type':Sequelize[_0xdb99('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdb99('0x3')]},'exitAt':{'type':Sequelize[_0xdb99('0x3')]},'reason':{'type':Sequelize[_0xdb99('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 300bf85..5d2f877 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 _0x7c91=['merge','map','VIRTUAL','options','count','includeAll','include','findAll','catch','show','intersection','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','nolimit','sort','pick','filter','where'];(function(_0x37f62c,_0x305583){var _0x46423c=function(_0x5b37bb){while(--_0x5b37bb){_0x37f62c['push'](_0x37f62c['shift']());}};_0x46423c(++_0x305583);}(_0x7c91,0x1cc));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x17c9('0x0'));var rimraf=require(_0x17c9('0x1'));var zipdir=require(_0x17c9('0x2'));var jsonpatch=require(_0x17c9('0x3'));var rp=require(_0x17c9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x17c9('0x5'));var util=require(_0x17c9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x17c9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x17c9('0x8'));var squel=require('squel');var crypto=require(_0x17c9('0x9'));var jsforce=require(_0x17c9('0xa'));var deskjs=require(_0x17c9('0xb'));var toCsv=require(_0x17c9('0x7'));var querystring=require(_0x17c9('0xc'));var Papa=require('papaparse');var Redis=require(_0x17c9('0xd'));var authService=require(_0x17c9('0xe'));var qs=require(_0x17c9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x17c9('0x10'));var logger=require(_0x17c9('0x11'))(_0x17c9('0x12'));var utils=require(_0x17c9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x17c9('0x14'));var db=require(_0x17c9('0x15'))['db'];function respondWithStatusCode(_0x11595a,_0x5944b4){_0x5944b4=_0x5944b4||0xcc;return function(_0x3b219b){if(_0x3b219b){return _0x11595a[_0x17c9('0x16')](_0x5944b4);}return _0x11595a[_0x17c9('0x17')](_0x5944b4)[_0x17c9('0x18')]();};}function respondWithResult(_0xe72bc7,_0x527633){_0x527633=_0x527633||0xc8;return function(_0x3b9593){if(_0x3b9593){return _0xe72bc7['status'](_0x527633)[_0x17c9('0x19')](_0x3b9593);}};}function respondWithFilteredResult(_0x215d32,_0x23627a){return function(_0x37f577){if(_0x37f577){var _0x3ec866=typeof _0x23627a[_0x17c9('0x1a')]===_0x17c9('0x1b')&&typeof _0x23627a[_0x17c9('0x1c')]===_0x17c9('0x1b');var _0x54b71e=_0x37f577['count'];var _0x4b7c3c=_0x3ec866?0x0:_0x23627a['offset'];var _0x29a7f9=_0x3ec866?_0x37f577['count']:_0x23627a[_0x17c9('0x1a')]+_0x23627a[_0x17c9('0x1c')];var _0x547c39;if(_0x29a7f9>=_0x54b71e){_0x29a7f9=_0x54b71e;_0x547c39=0xc8;}else{_0x547c39=0xce;}_0x215d32['status'](_0x547c39);return _0x215d32[_0x17c9('0x1d')](_0x17c9('0x1e'),_0x4b7c3c+'-'+_0x29a7f9+'/'+_0x54b71e)[_0x17c9('0x19')](_0x37f577);}return null;};}function patchUpdates(_0x4bb78e){return function(_0x1bd427){try{jsonpatch[_0x17c9('0x1f')](_0x1bd427,_0x4bb78e,!![]);}catch(_0x326364){return BPromise[_0x17c9('0x20')](_0x326364);}return _0x1bd427[_0x17c9('0x21')]();};}function saveUpdates(_0x5b9cba,_0x1aef2f){return function(_0x56b5ed){if(_0x56b5ed){return _0x56b5ed[_0x17c9('0x22')](_0x5b9cba)[_0x17c9('0x23')](function(_0x1594a3){return _0x1594a3;});}return null;};}function removeEntity(_0x4833e1,_0x247ef9){return function(_0x192c37){if(_0x192c37){return _0x192c37[_0x17c9('0x24')]()['then'](function(){_0x4833e1[_0x17c9('0x17')](0xcc)[_0x17c9('0x18')]();});}};}function handleEntityNotFound(_0x76ac6d,_0x2a25d8){return function(_0x1f135d){if(!_0x1f135d){_0x76ac6d['sendStatus'](0x194);}return _0x1f135d;};}function handleError(_0x25915d,_0x521932){_0x521932=_0x521932||0x1f4;return function(_0x2ad3da){logger[_0x17c9('0x25')](_0x2ad3da[_0x17c9('0x26')]);if(_0x2ad3da[_0x17c9('0x27')]){delete _0x2ad3da[_0x17c9('0x27')];}_0x25915d[_0x17c9('0x17')](_0x521932)[_0x17c9('0x28')](_0x2ad3da);};}exports[_0x17c9('0x29')]=function(_0x1fa564,_0x187337){var _0x39cc5c={},_0x1752f2={},_0x20a0b3={'count':0x0,'rows':[]};var _0x560fda=_['map'](db[_0x17c9('0x2a')][_0x17c9('0x2b')],function(_0x43a441){return{'name':_0x43a441['fieldName'],'type':_0x43a441[_0x17c9('0x2c')][_0x17c9('0x2d')]};});_0x1752f2[_0x17c9('0x2e')]=_['map'](_0x560fda,'name');_0x1752f2[_0x17c9('0x2f')]=_[_0x17c9('0x30')](_0x1fa564['query']);_0x1752f2[_0x17c9('0x31')]=_['intersection'](_0x1752f2['model'],_0x1752f2[_0x17c9('0x2f')]);_0x39cc5c['attributes']=_['intersection'](_0x1752f2[_0x17c9('0x2e')],qs[_0x17c9('0x32')](_0x1fa564['query']['fields']));_0x39cc5c[_0x17c9('0x33')]=_0x39cc5c[_0x17c9('0x33')][_0x17c9('0x34')]?_0x39cc5c['attributes']:_0x1752f2['model'];if(!_0x1fa564[_0x17c9('0x2f')]['hasOwnProperty'](_0x17c9('0x35'))){_0x39cc5c[_0x17c9('0x1c')]=qs[_0x17c9('0x1c')](_0x1fa564['query'][_0x17c9('0x1c')]);_0x39cc5c['offset']=qs['offset'](_0x1fa564[_0x17c9('0x2f')]['offset']);}_0x39cc5c['order']=qs['sort'](_0x1fa564[_0x17c9('0x2f')][_0x17c9('0x36')]);_0x39cc5c['where']=qs['filters'](_[_0x17c9('0x37')](_0x1fa564[_0x17c9('0x2f')],_0x1752f2[_0x17c9('0x31')]),_0x560fda);if(_0x1fa564[_0x17c9('0x2f')][_0x17c9('0x38')]){_0x39cc5c[_0x17c9('0x39')]=_[_0x17c9('0x3a')](_0x39cc5c[_0x17c9('0x39')],{'$or':_[_0x17c9('0x3b')](_0x560fda,function(_0x3ae59b){if(_0x3ae59b[_0x17c9('0x2c')]!==_0x17c9('0x3c')){var _0x2b4c95={};_0x2b4c95[_0x3ae59b[_0x17c9('0x27')]]={'$like':'%'+_0x1fa564[_0x17c9('0x2f')]['filter']+'%'};return _0x2b4c95;}})});}_0x39cc5c=_[_0x17c9('0x3a')]({},_0x39cc5c,_0x1fa564[_0x17c9('0x3d')]);var _0x4930ac={'where':_0x39cc5c[_0x17c9('0x39')]};return db[_0x17c9('0x2a')][_0x17c9('0x3e')](_0x4930ac)['then'](function(_0x49b582){_0x20a0b3[_0x17c9('0x3e')]=_0x49b582;if(_0x1fa564[_0x17c9('0x2f')][_0x17c9('0x3f')]){_0x39cc5c[_0x17c9('0x40')]=[{'all':!![]}];}return db[_0x17c9('0x2a')][_0x17c9('0x41')](_0x39cc5c);})['then'](function(_0x159a67){_0x20a0b3['rows']=_0x159a67;return _0x20a0b3;})[_0x17c9('0x23')](respondWithFilteredResult(_0x187337,_0x39cc5c))[_0x17c9('0x42')](handleError(_0x187337,null));};exports[_0x17c9('0x43')]=function(_0x41aeeb,_0x1e8461){var _0x882ef3={'raw':!![],'where':{'id':_0x41aeeb['params']['id']}},_0x780331={};_0x780331[_0x17c9('0x2e')]=_[_0x17c9('0x30')](db['OpenchannelQueueReport'][_0x17c9('0x2b')]);_0x780331['query']=_['keys'](_0x41aeeb['query']);_0x780331['filters']=_[_0x17c9('0x44')](_0x780331[_0x17c9('0x2e')],_0x780331[_0x17c9('0x2f')]);_0x882ef3[_0x17c9('0x33')]=_[_0x17c9('0x44')](_0x780331[_0x17c9('0x2e')],qs['fields'](_0x41aeeb[_0x17c9('0x2f')][_0x17c9('0x32')]));_0x882ef3[_0x17c9('0x33')]=_0x882ef3[_0x17c9('0x33')][_0x17c9('0x34')]?_0x882ef3['attributes']:_0x780331[_0x17c9('0x2e')];if(_0x41aeeb['query'][_0x17c9('0x3f')]){_0x882ef3[_0x17c9('0x40')]=[{'all':!![]}];}_0x882ef3=_[_0x17c9('0x3a')]({},_0x882ef3,_0x41aeeb['options']);return db[_0x17c9('0x2a')][_0x17c9('0x45')](_0x882ef3)[_0x17c9('0x23')](handleEntityNotFound(_0x1e8461,null))['then'](respondWithResult(_0x1e8461,null))[_0x17c9('0x42')](handleError(_0x1e8461,null));};exports[_0x17c9('0x46')]=function(_0x464ec2,_0x3c68f4){return db['OpenchannelQueueReport'][_0x17c9('0x46')](_0x464ec2[_0x17c9('0x47')],{})[_0x17c9('0x23')](respondWithResult(_0x3c68f4,0xc9))['catch'](handleError(_0x3c68f4,null));};exports[_0x17c9('0x22')]=function(_0x22536a,_0x43defa){if(_0x22536a[_0x17c9('0x47')]['id']){delete _0x22536a[_0x17c9('0x47')]['id'];}return db[_0x17c9('0x2a')][_0x17c9('0x45')]({'where':{'id':_0x22536a[_0x17c9('0x48')]['id']}})[_0x17c9('0x23')](handleEntityNotFound(_0x43defa,null))[_0x17c9('0x23')](saveUpdates(_0x22536a[_0x17c9('0x47')],null))['then'](respondWithResult(_0x43defa,null))[_0x17c9('0x42')](handleError(_0x43defa,null));};exports[_0x17c9('0x24')]=function(_0x107474,_0x35aa1c){return db[_0x17c9('0x2a')][_0x17c9('0x45')]({'where':{'id':_0x107474[_0x17c9('0x48')]['id']}})['then'](handleEntityNotFound(_0x35aa1c,null))[_0x17c9('0x23')](removeEntity(_0x35aa1c,null))['catch'](handleError(_0x35aa1c,null));};exports[_0x17c9('0x49')]=function(_0x13dd29,_0x333296){return db[_0x17c9('0x2a')]['describe']()[_0x17c9('0x23')](respondWithResult(_0x333296,null))['catch'](handleError(_0x333296,null));}; \ No newline at end of file +var _0x983d=['findAll','rows','show','params','includeAll','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','end','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','include'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x983d,0x1d3));var _0xd983=function(_0x40d1bf,_0x2c4ebc){_0x40d1bf=_0x40d1bf-0x0;var _0x61d3c0=_0x983d[_0x40d1bf];return _0x61d3c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd983('0x0'));var zipdir=require(_0xd983('0x1'));var jsonpatch=require(_0xd983('0x2'));var rp=require(_0xd983('0x3'));var moment=require(_0xd983('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd983('0x5'));var util=require(_0xd983('0x6'));var path=require(_0xd983('0x7'));var sox=require('sox');var csv=require(_0xd983('0x8'));var ejs=require(_0xd983('0x9'));var fs=require('fs');var fs_extra=require(_0xd983('0xa'));var _=require(_0xd983('0xb'));var squel=require(_0xd983('0xc'));var crypto=require(_0xd983('0xd'));var jsforce=require(_0xd983('0xe'));var deskjs=require(_0xd983('0xf'));var toCsv=require(_0xd983('0x8'));var querystring=require(_0xd983('0x10'));var Papa=require(_0xd983('0x11'));var Redis=require(_0xd983('0x12'));var authService=require(_0xd983('0x13'));var qs=require(_0xd983('0x14'));var as=require(_0xd983('0x15'));var hardwareService=require(_0xd983('0x16'));var logger=require(_0xd983('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd983('0x18'));var db=require(_0xd983('0x19'))['db'];function respondWithStatusCode(_0x87037d,_0x36f540){_0x36f540=_0x36f540||0xcc;return function(_0x574fb7){if(_0x574fb7){return _0x87037d[_0xd983('0x1a')](_0x36f540);}return _0x87037d[_0xd983('0x1b')](_0x36f540)['end']();};}function respondWithResult(_0x469927,_0x2a494e){_0x2a494e=_0x2a494e||0xc8;return function(_0x528031){if(_0x528031){return _0x469927[_0xd983('0x1b')](_0x2a494e)[_0xd983('0x1c')](_0x528031);}};}function respondWithFilteredResult(_0xa29ca9,_0x3f0020){return function(_0x185437){if(_0x185437){var _0x380a80=typeof _0x3f0020['offset']===_0xd983('0x1d')&&typeof _0x3f0020[_0xd983('0x1e')]===_0xd983('0x1d');var _0x2aef05=_0x185437[_0xd983('0x1f')];var _0x513bd8=_0x380a80?0x0:_0x3f0020[_0xd983('0x20')];var _0x162438=_0x380a80?_0x185437[_0xd983('0x1f')]:_0x3f0020['offset']+_0x3f0020[_0xd983('0x1e')];var _0x430c9c;if(_0x162438>=_0x2aef05){_0x162438=_0x2aef05;_0x430c9c=0xc8;}else{_0x430c9c=0xce;}_0xa29ca9[_0xd983('0x1b')](_0x430c9c);return _0xa29ca9[_0xd983('0x21')](_0xd983('0x22'),_0x513bd8+'-'+_0x162438+'/'+_0x2aef05)[_0xd983('0x1c')](_0x185437);}return null;};}function patchUpdates(_0xa9ab3c){return function(_0x320014){try{jsonpatch[_0xd983('0x23')](_0x320014,_0xa9ab3c,!![]);}catch(_0x224fc8){return BPromise[_0xd983('0x24')](_0x224fc8);}return _0x320014['save']();};}function saveUpdates(_0x76f85c,_0x5c4382){return function(_0x5b5a95){if(_0x5b5a95){return _0x5b5a95[_0xd983('0x25')](_0x76f85c)['then'](function(_0x1ae0e3){return _0x1ae0e3;});}return null;};}function removeEntity(_0x24161b,_0x471cec){return function(_0x5643f4){if(_0x5643f4){return _0x5643f4['destroy']()[_0xd983('0x26')](function(){_0x24161b[_0xd983('0x1b')](0xcc)[_0xd983('0x27')]();});}};}function handleEntityNotFound(_0x521e4d,_0x55bafa){return function(_0x291937){if(!_0x291937){_0x521e4d['sendStatus'](0x194);}return _0x291937;};}function handleError(_0x674f89,_0x2bdb6f){_0x2bdb6f=_0x2bdb6f||0x1f4;return function(_0x196e66){logger['error'](_0x196e66['stack']);if(_0x196e66[_0xd983('0x28')]){delete _0x196e66[_0xd983('0x28')];}_0x674f89['status'](_0x2bdb6f)[_0xd983('0x29')](_0x196e66);};}exports['index']=function(_0x509427,_0x5a4e55){var _0x22f567={},_0x52314d={},_0x4e3535={'count':0x0,'rows':[]};var _0x54b818=_[_0xd983('0x2a')](db[_0xd983('0x2b')][_0xd983('0x2c')],function(_0x3a3743){return{'name':_0x3a3743[_0xd983('0x2d')],'type':_0x3a3743[_0xd983('0x2e')][_0xd983('0x2f')]};});_0x52314d[_0xd983('0x30')]=_['map'](_0x54b818,'name');_0x52314d[_0xd983('0x31')]=_[_0xd983('0x32')](_0x509427[_0xd983('0x31')]);_0x52314d[_0xd983('0x33')]=_[_0xd983('0x34')](_0x52314d[_0xd983('0x30')],_0x52314d[_0xd983('0x31')]);_0x22f567[_0xd983('0x35')]=_['intersection'](_0x52314d['model'],qs[_0xd983('0x36')](_0x509427['query'][_0xd983('0x36')]));_0x22f567['attributes']=_0x22f567[_0xd983('0x35')]['length']?_0x22f567[_0xd983('0x35')]:_0x52314d['model'];if(!_0x509427[_0xd983('0x31')][_0xd983('0x37')](_0xd983('0x38'))){_0x22f567[_0xd983('0x1e')]=qs[_0xd983('0x1e')](_0x509427[_0xd983('0x31')][_0xd983('0x1e')]);_0x22f567[_0xd983('0x20')]=qs[_0xd983('0x20')](_0x509427[_0xd983('0x31')][_0xd983('0x20')]);}_0x22f567['order']=qs['sort'](_0x509427[_0xd983('0x31')][_0xd983('0x39')]);_0x22f567['where']=qs[_0xd983('0x33')](_[_0xd983('0x3a')](_0x509427[_0xd983('0x31')],_0x52314d['filters']),_0x54b818);if(_0x509427[_0xd983('0x31')]['filter']){_0x22f567['where']=_[_0xd983('0x3b')](_0x22f567[_0xd983('0x3c')],{'$or':_[_0xd983('0x2a')](_0x54b818,function(_0x164fe1){if(_0x164fe1['type']!==_0xd983('0x3d')){var _0x47ad6c={};_0x47ad6c[_0x164fe1[_0xd983('0x28')]]={'$like':'%'+_0x509427[_0xd983('0x31')][_0xd983('0x3e')]+'%'};return _0x47ad6c;}})});}_0x22f567=_[_0xd983('0x3b')]({},_0x22f567,_0x509427[_0xd983('0x3f')]);var _0x38730f={'where':_0x22f567[_0xd983('0x3c')]};return db[_0xd983('0x2b')][_0xd983('0x1f')](_0x38730f)['then'](function(_0xdfd784){_0x4e3535[_0xd983('0x1f')]=_0xdfd784;if(_0x509427[_0xd983('0x31')]['includeAll']){_0x22f567[_0xd983('0x40')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xd983('0x41')](_0x22f567);})[_0xd983('0x26')](function(_0x4a627f){_0x4e3535[_0xd983('0x42')]=_0x4a627f;return _0x4e3535;})[_0xd983('0x26')](respondWithFilteredResult(_0x5a4e55,_0x22f567))['catch'](handleError(_0x5a4e55,null));};exports[_0xd983('0x43')]=function(_0x4ea277,_0x31b67b){var _0x3d9c9b={'raw':!![],'where':{'id':_0x4ea277[_0xd983('0x44')]['id']}},_0x5a0f3c={};_0x5a0f3c[_0xd983('0x30')]=_[_0xd983('0x32')](db[_0xd983('0x2b')]['rawAttributes']);_0x5a0f3c[_0xd983('0x31')]=_[_0xd983('0x32')](_0x4ea277['query']);_0x5a0f3c[_0xd983('0x33')]=_[_0xd983('0x34')](_0x5a0f3c['model'],_0x5a0f3c[_0xd983('0x31')]);_0x3d9c9b[_0xd983('0x35')]=_['intersection'](_0x5a0f3c[_0xd983('0x30')],qs[_0xd983('0x36')](_0x4ea277[_0xd983('0x31')][_0xd983('0x36')]));_0x3d9c9b[_0xd983('0x35')]=_0x3d9c9b['attributes']['length']?_0x3d9c9b[_0xd983('0x35')]:_0x5a0f3c[_0xd983('0x30')];if(_0x4ea277[_0xd983('0x31')][_0xd983('0x45')]){_0x3d9c9b[_0xd983('0x40')]=[{'all':!![]}];}_0x3d9c9b=_[_0xd983('0x3b')]({},_0x3d9c9b,_0x4ea277['options']);return db[_0xd983('0x2b')][_0xd983('0x46')](_0x3d9c9b)['then'](handleEntityNotFound(_0x31b67b,null))[_0xd983('0x26')](respondWithResult(_0x31b67b,null))[_0xd983('0x47')](handleError(_0x31b67b,null));};exports[_0xd983('0x48')]=function(_0x4edda7,_0x5d88c2){return db['OpenchannelQueueReport']['create'](_0x4edda7[_0xd983('0x49')],{})['then'](respondWithResult(_0x5d88c2,0xc9))[_0xd983('0x47')](handleError(_0x5d88c2,null));};exports[_0xd983('0x25')]=function(_0x70eea0,_0x445caa){if(_0x70eea0[_0xd983('0x49')]['id']){delete _0x70eea0[_0xd983('0x49')]['id'];}return db[_0xd983('0x2b')][_0xd983('0x46')]({'where':{'id':_0x70eea0[_0xd983('0x44')]['id']}})[_0xd983('0x26')](handleEntityNotFound(_0x445caa,null))['then'](saveUpdates(_0x70eea0[_0xd983('0x49')],null))[_0xd983('0x26')](respondWithResult(_0x445caa,null))['catch'](handleError(_0x445caa,null));};exports[_0xd983('0x4a')]=function(_0x36cdb6,_0x45ad6c){return db[_0xd983('0x2b')]['find']({'where':{'id':_0x36cdb6[_0xd983('0x44')]['id']}})[_0xd983('0x26')](handleEntityNotFound(_0x45ad6c,null))[_0xd983('0x26')](removeEntity(_0x45ad6c,null))[_0xd983('0x47')](handleError(_0x45ad6c,null));};exports[_0xd983('0x4b')]=function(_0x4c1079,_0x891dd2){return db[_0xd983('0x2b')][_0xd983('0x4b')]()[_0xd983('0x26')](respondWithResult(_0x891dd2,null))['catch'](handleError(_0x891dd2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d22ef5c..3aa4e22 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x10edc2,_0x5b3bd1){var _0x3d4478=function(_0x42441b){while(--_0x42441b){_0x10edc2['push'](_0x10edc2['shift']());}};_0x3d4478(++_0x5b3bd1);}(_0x2ef3,0xba));var _0x32ef=function(_0x378fd9,_0x20452a){_0x378fd9=_0x378fd9-0x0;var _0x4c7fb1=_0x2ef3[_0x378fd9];return _0x4c7fb1;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x46dba9,_0x24e8a6){var _0x5f36af=function(_0x5226c4){while(--_0x5226c4){_0x46dba9['push'](_0x46dba9['shift']());}};_0x5f36af(++_0x24e8a6);}(_0x1261,0x144));var _0x1126=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x1261[_0x3ea913];return _0x2b4f28;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 1fad754..b969590 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 _0x9158=['where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','update'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x9158,0x16e));var _0x8915=function(_0x1215f2,_0x2d570a){_0x1215f2=_0x1215f2-0x0;var _0x19d125=_0x9158[_0x1215f2];return _0x19d125;};'use strict';var _=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var moment=require(_0x8915('0x2'));var BPromise=require('bluebird');var rs=require(_0x8915('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8915('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8915('0x5'));var config=require(_0x8915('0x6'));var jayson=require(_0x8915('0x7'));var client=jayson[_0x8915('0x8')][_0x8915('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ff3d,_0x33abdd,_0x100d72){return new BPromise(function(_0x50d1f8,_0x41be04){return client[_0x8915('0xa')](_0x20ff3d,_0x100d72)[_0x8915('0xb')](function(_0x1a5403){logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x33abdd,_0x8915('0xe'),JSON[_0x8915('0xf')](_0x1a5403));if(_0x1a5403[_0x8915('0x10')]){if(_0x1a5403[_0x8915('0x10')][_0x8915('0x11')]===0x1f4){logger[_0x8915('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x33abdd,_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);return _0x41be04(_0x1a5403['error'][_0x8915('0x12')]);}logger['error'](_0x8915('0xd'),_0x33abdd,_0x1a5403['error'][_0x8915('0x12')]);return _0x50d1f8(_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);}else{logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));_0x50d1f8(_0x1a5403[_0x8915('0x13')][_0x8915('0x12')]);}})[_0x8915('0x14')](function(_0x3f541c){logger[_0x8915('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x33abdd,_0x3f541c);_0x41be04(_0x3f541c);});});}exports[_0x8915('0x15')]=function(_0x913dc){var _0x5ccd36=this;return new Promise(function(_0x5987d4,_0x17bb6c){return db[_0x8915('0x16')][_0x8915('0x17')](_0x913dc[_0x8915('0x18')],{'raw':_0x913dc[_0x8915('0x19')]?_0x913dc[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![]})[_0x8915('0xb')](function(_0x511dcd){logger['info'](_0x8915('0x15'),_0x913dc);logger[_0x8915('0x1b')](_0x8915('0x15'),_0x913dc,JSON[_0x8915('0xf')](_0x511dcd));_0x5987d4(_0x511dcd);})['catch'](function(_0x2eebe1){logger[_0x8915('0x10')](_0x8915('0x15'),_0x2eebe1[_0x8915('0x12')],_0x913dc);_0x17bb6c(_0x5ccd36[_0x8915('0x10')](0x1f4,_0x2eebe1[_0x8915('0x12')]));});});};exports[_0x8915('0x1c')]=function(_0x2568d8){var _0x5c061d=this;return new Promise(function(_0x4159c9,_0x4e5973){return db[_0x8915('0x16')][_0x8915('0x1d')](_0x2568d8['body'],{'raw':_0x2568d8[_0x8915('0x19')]?_0x2568d8[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2568d8[_0x8915('0x19')]?_0x2568d8[_0x8915('0x19')][_0x8915('0x1e')]||null:null,'attributes':_0x2568d8[_0x8915('0x19')]?_0x2568d8['options'][_0x8915('0x1f')]||null:null,'limit':_0x2568d8[_0x8915('0x19')]?_0x2568d8['options'][_0x8915('0x20')]||null:null})['then'](function(_0x3b133c){logger['info'](_0x8915('0x1c'),_0x2568d8);logger[_0x8915('0x1b')]('UpdateOpenchannelQueueReport',_0x2568d8,JSON[_0x8915('0xf')](_0x3b133c));_0x4159c9(_0x3b133c);})[_0x8915('0x14')](function(_0x18296c){logger[_0x8915('0x10')](_0x8915('0x1c'),_0x18296c['message'],_0x2568d8);_0x4e5973(_0x5c061d[_0x8915('0x10')](0x1f4,_0x18296c['message']));});});}; \ No newline at end of file +var _0xa866=['catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result'];(function(_0x2a4e5c,_0x5542e5){var _0x4198b0=function(_0x5e5c7b){while(--_0x5e5c7b){_0x2a4e5c['push'](_0x2a4e5c['shift']());}};_0x4198b0(++_0x5542e5);}(_0xa866,0x6a));var _0x6a86=function(_0x5933df,_0x41068d){_0x5933df=_0x5933df-0x0;var _0xebf784=_0xa866[_0x5933df];return _0xebf784;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});}exports['CreateOpenchannelQueueReport']=function(_0x50024d){var _0x11fe3b=this;return new Promise(function(_0x535fd9,_0x588a2f){return db[_0x6a86('0x17')][_0x6a86('0x18')](_0x50024d[_0x6a86('0x19')],{'raw':_0x50024d['options']?_0x50024d[_0x6a86('0x1a')][_0x6a86('0x1b')]===undefined?!![]:![]:!![]})[_0x6a86('0xc')](function(_0x262bf5){logger[_0x6a86('0xd')](_0x6a86('0x1c'),_0x50024d);logger['debug']('CreateOpenchannelQueueReport',_0x50024d,JSON['stringify'](_0x262bf5));_0x535fd9(_0x262bf5);})[_0x6a86('0x16')](function(_0x2007c7){logger[_0x6a86('0x12')](_0x6a86('0x1c'),_0x2007c7['message'],_0x50024d);_0x588a2f(_0x11fe3b[_0x6a86('0x12')](0x1f4,_0x2007c7[_0x6a86('0x14')]));});});};exports[_0x6a86('0x1d')]=function(_0x3f2b70){var _0x19382d=this;return new Promise(function(_0x1c41a7,_0x46f6c7){return db[_0x6a86('0x17')][_0x6a86('0x1e')](_0x3f2b70['body'],{'raw':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')]['where']||null:null,'attributes':_0x3f2b70[_0x6a86('0x1a')]?_0x3f2b70[_0x6a86('0x1a')][_0x6a86('0x1f')]||null:null,'limit':_0x3f2b70['options']?_0x3f2b70[_0x6a86('0x1a')]['limit']||null:null})['then'](function(_0x4d8bf0){logger[_0x6a86('0xd')](_0x6a86('0x1d'),_0x3f2b70);logger[_0x6a86('0xf')]('UpdateOpenchannelQueueReport',_0x3f2b70,JSON[_0x6a86('0x11')](_0x4d8bf0));_0x1c41a7(_0x4d8bf0);})[_0x6a86('0x16')](function(_0x1bb745){logger[_0x6a86('0x12')]('UpdateOpenchannelQueueReport',_0x1bb745[_0x6a86('0x14')],_0x3f2b70);_0x46f6c7(_0x19382d['error'](0x1f4,_0x1bb745[_0x6a86('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cead70e..fc7e894 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 _0x0e9d=['Router','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e9d,0x1d0));var _0xd0e9=function(_0x195076,_0x3e2bce){_0x195076=_0x195076-0x0;var _0x514541=_0x0e9d[_0x195076];return _0x514541;};'use strict';var multer=require('multer');var util=require(_0xd0e9('0x0'));var path=require(_0xd0e9('0x1'));var timeout=require(_0xd0e9('0x2'));var express=require(_0xd0e9('0x3'));var router=express[_0xd0e9('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd0e9('0x5'));router[_0xd0e9('0x6')]('/',auth['isAuthenticated'](),controller[_0xd0e9('0x7')]);router[_0xd0e9('0x6')](_0xd0e9('0x8'),auth[_0xd0e9('0x9')](),controller[_0xd0e9('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd0e9('0xb')]('/',auth[_0xd0e9('0x9')](),controller[_0xd0e9('0xc')]);router[_0xd0e9('0xd')](_0xd0e9('0xe'),auth[_0xd0e9('0x9')](),controller[_0xd0e9('0xf')]);router['delete'](_0xd0e9('0xe'),auth[_0xd0e9('0x9')](),controller[_0xd0e9('0x10')]);module[_0xd0e9('0x11')]=router; \ No newline at end of file +var _0x7b72=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','show','put','destroy','exports','path','express','Router'];(function(_0x53000a,_0x4c01af){var _0x27c1ac=function(_0x202c05){while(--_0x202c05){_0x53000a['push'](_0x53000a['shift']());}};_0x27c1ac(++_0x4c01af);}(_0x7b72,0xbd));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x27b7('0x0'));var timeout=require('connect-timeout');var express=require(_0x27b7('0x1'));var router=express[_0x27b7('0x2')]();var fs_extra=require(_0x27b7('0x3'));var auth=require(_0x27b7('0x4'));var interaction=require(_0x27b7('0x5'));var config=require(_0x27b7('0x6'));var controller=require(_0x27b7('0x7'));router[_0x27b7('0x8')]('/',auth[_0x27b7('0x9')](),controller[_0x27b7('0xa')]);router[_0x27b7('0x8')]('/describe',auth[_0x27b7('0x9')](),controller['describe']);router[_0x27b7('0x8')](_0x27b7('0xb'),auth['isAuthenticated'](),controller[_0x27b7('0xc')]);router['post']('/',auth[_0x27b7('0x9')](),controller['create']);router[_0x27b7('0xd')]('/:id',auth[_0x27b7('0x9')](),controller['update']);router['delete'](_0x27b7('0xb'),auth[_0x27b7('0x9')](),controller[_0x27b7('0xe')]);module[_0x27b7('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index cec69f6..a824761 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x464211,_0x51814a){var _0x2a0f74=function(_0x185584){while(--_0x185584){_0x464211['push'](_0x464211['shift']());}};_0x2a0f74(++_0x51814a);}(_0x70e0,0x17b));var _0x070e=function(_0x15c4db,_0x4d8f7e){_0x15c4db=_0x15c4db-0x0;var _0x12a31a=_0x70e0[_0x15c4db];return _0x12a31a;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5dac21,_0x39ebc2){var _0x700935=function(_0x388be3){while(--_0x388be3){_0x5dac21['push'](_0x5dac21['shift']());}};_0x700935(++_0x39ebc2);}(_0xedd9,0xfc));var _0x9edd=function(_0x2829a2,_0x32047b){_0x2829a2=_0x2829a2-0x0;var _0x3e4b17=_0xedd9[_0x2829a2];return _0x3e4b17;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 76d8678..7391158 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 _0xa023=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelTransferReport','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','type','model','query'];(function(_0x126c1c,_0xfd21ad){var _0x555111=function(_0x155198){while(--_0x155198){_0x126c1c['push'](_0x126c1c['shift']());}};_0x555111(++_0xfd21ad);}(_0xa023,0xf9));var _0x3a02=function(_0x2a1f67,_0x5aa54a){_0x2a1f67=_0x2a1f67-0x0;var _0x9c73b=_0xa023[_0x2a1f67];return _0x9c73b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a02('0x0'));var zipdir=require(_0x3a02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3a02('0x2'));var BPromise=require(_0x3a02('0x3'));var Mustache=require('mustache');var util=require(_0x3a02('0x4'));var path=require(_0x3a02('0x5'));var sox=require(_0x3a02('0x6'));var csv=require(_0x3a02('0x7'));var ejs=require(_0x3a02('0x8'));var fs=require('fs');var fs_extra=require(_0x3a02('0x9'));var _=require(_0x3a02('0xa'));var squel=require(_0x3a02('0xb'));var crypto=require(_0x3a02('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3a02('0xd'));var toCsv=require(_0x3a02('0x7'));var querystring=require('querystring');var Papa=require(_0x3a02('0xe'));var Redis=require(_0x3a02('0xf'));var authService=require(_0x3a02('0x10'));var qs=require(_0x3a02('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a02('0x12'));var logger=require('../../config/logger')(_0x3a02('0x13'));var utils=require('../../config/utils');var config=require(_0x3a02('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a02('0x15'))['db'];function respondWithStatusCode(_0x8afcd4,_0x4ee645){_0x4ee645=_0x4ee645||0xcc;return function(_0x219792){if(_0x219792){return _0x8afcd4[_0x3a02('0x16')](_0x4ee645);}return _0x8afcd4[_0x3a02('0x17')](_0x4ee645)['end']();};}function respondWithResult(_0x17faa5,_0x44fff6){_0x44fff6=_0x44fff6||0xc8;return function(_0xe12417){if(_0xe12417){return _0x17faa5[_0x3a02('0x17')](_0x44fff6)[_0x3a02('0x18')](_0xe12417);}};}function respondWithFilteredResult(_0x3251ab,_0x4d8796){return function(_0x1d933d){if(_0x1d933d){var _0x398b18=typeof _0x4d8796[_0x3a02('0x19')]==='undefined'&&typeof _0x4d8796[_0x3a02('0x1a')]===_0x3a02('0x1b');var _0x547ed6=_0x1d933d[_0x3a02('0x1c')];var _0x2a9d3f=_0x398b18?0x0:_0x4d8796['offset'];var _0x44a5a2=_0x398b18?_0x1d933d[_0x3a02('0x1c')]:_0x4d8796[_0x3a02('0x19')]+_0x4d8796[_0x3a02('0x1a')];var _0x147a25;if(_0x44a5a2>=_0x547ed6){_0x44a5a2=_0x547ed6;_0x147a25=0xc8;}else{_0x147a25=0xce;}_0x3251ab['status'](_0x147a25);return _0x3251ab[_0x3a02('0x1d')](_0x3a02('0x1e'),_0x2a9d3f+'-'+_0x44a5a2+'/'+_0x547ed6)[_0x3a02('0x18')](_0x1d933d);}return null;};}function patchUpdates(_0x39c7b5){return function(_0x30c638){try{jsonpatch[_0x3a02('0x1f')](_0x30c638,_0x39c7b5,!![]);}catch(_0x5306b7){return BPromise['reject'](_0x5306b7);}return _0x30c638[_0x3a02('0x20')]();};}function saveUpdates(_0x2a949d,_0x20ba40){return function(_0x4c8e9c){if(_0x4c8e9c){return _0x4c8e9c[_0x3a02('0x21')](_0x2a949d)[_0x3a02('0x22')](function(_0x1c2726){return _0x1c2726;});}return null;};}function removeEntity(_0x4abf9e,_0x3feb88){return function(_0x15ba7a){if(_0x15ba7a){return _0x15ba7a[_0x3a02('0x23')]()['then'](function(){_0x4abf9e[_0x3a02('0x17')](0xcc)[_0x3a02('0x24')]();});}};}function handleEntityNotFound(_0x208290,_0x584baf){return function(_0x386272){if(!_0x386272){_0x208290[_0x3a02('0x16')](0x194);}return _0x386272;};}function handleError(_0x5576aa,_0x181d84){_0x181d84=_0x181d84||0x1f4;return function(_0x1f45c0){logger[_0x3a02('0x25')](_0x1f45c0[_0x3a02('0x26')]);if(_0x1f45c0[_0x3a02('0x27')]){delete _0x1f45c0[_0x3a02('0x27')];}_0x5576aa['status'](_0x181d84)[_0x3a02('0x28')](_0x1f45c0);};}exports[_0x3a02('0x29')]=function(_0x2c3a0f,_0x1c4934){var _0x4f953e={},_0x2949eb={},_0x3af636={'count':0x0,'rows':[]};var _0x3efe51=_[_0x3a02('0x2a')](db['OpenchannelTransferReport'][_0x3a02('0x2b')],function(_0x304d25){return{'name':_0x304d25['fieldName'],'type':_0x304d25[_0x3a02('0x2c')]['key']};});_0x2949eb[_0x3a02('0x2d')]=_[_0x3a02('0x2a')](_0x3efe51,_0x3a02('0x27'));_0x2949eb[_0x3a02('0x2e')]=_[_0x3a02('0x2f')](_0x2c3a0f[_0x3a02('0x2e')]);_0x2949eb[_0x3a02('0x30')]=_[_0x3a02('0x31')](_0x2949eb[_0x3a02('0x2d')],_0x2949eb['query']);_0x4f953e[_0x3a02('0x32')]=_[_0x3a02('0x31')](_0x2949eb[_0x3a02('0x2d')],qs[_0x3a02('0x33')](_0x2c3a0f[_0x3a02('0x2e')][_0x3a02('0x33')]));_0x4f953e[_0x3a02('0x32')]=_0x4f953e['attributes'][_0x3a02('0x34')]?_0x4f953e[_0x3a02('0x32')]:_0x2949eb[_0x3a02('0x2d')];if(!_0x2c3a0f['query'][_0x3a02('0x35')](_0x3a02('0x36'))){_0x4f953e[_0x3a02('0x1a')]=qs[_0x3a02('0x1a')](_0x2c3a0f[_0x3a02('0x2e')][_0x3a02('0x1a')]);_0x4f953e['offset']=qs[_0x3a02('0x19')](_0x2c3a0f[_0x3a02('0x2e')]['offset']);}_0x4f953e[_0x3a02('0x37')]=qs['sort'](_0x2c3a0f[_0x3a02('0x2e')][_0x3a02('0x38')]);_0x4f953e[_0x3a02('0x39')]=qs[_0x3a02('0x30')](_[_0x3a02('0x3a')](_0x2c3a0f[_0x3a02('0x2e')],_0x2949eb[_0x3a02('0x30')]),_0x3efe51);if(_0x2c3a0f['query'][_0x3a02('0x3b')]){_0x4f953e[_0x3a02('0x39')]=_[_0x3a02('0x3c')](_0x4f953e[_0x3a02('0x39')],{'$or':_[_0x3a02('0x2a')](_0x3efe51,function(_0x319100){if(_0x319100['type']!==_0x3a02('0x3d')){var _0x711df7={};_0x711df7[_0x319100[_0x3a02('0x27')]]={'$like':'%'+_0x2c3a0f[_0x3a02('0x2e')][_0x3a02('0x3b')]+'%'};return _0x711df7;}})});}_0x4f953e=_['merge']({},_0x4f953e,_0x2c3a0f['options']);var _0x288ce5={'where':_0x4f953e[_0x3a02('0x39')]};return db[_0x3a02('0x3e')][_0x3a02('0x1c')](_0x288ce5)[_0x3a02('0x22')](function(_0x402b7a){_0x3af636[_0x3a02('0x1c')]=_0x402b7a;if(_0x2c3a0f[_0x3a02('0x2e')][_0x3a02('0x3f')]){_0x4f953e[_0x3a02('0x40')]=[{'all':!![]}];}return db[_0x3a02('0x3e')][_0x3a02('0x41')](_0x4f953e);})[_0x3a02('0x22')](function(_0xa4c9d3){_0x3af636[_0x3a02('0x42')]=_0xa4c9d3;return _0x3af636;})[_0x3a02('0x22')](respondWithFilteredResult(_0x1c4934,_0x4f953e))['catch'](handleError(_0x1c4934,null));};exports['show']=function(_0x17e4ef,_0x3ec87c){var _0x3eeac9={'raw':!![],'where':{'id':_0x17e4ef[_0x3a02('0x43')]['id']}},_0x58ac92={};_0x58ac92[_0x3a02('0x2d')]=_['keys'](db[_0x3a02('0x3e')][_0x3a02('0x2b')]);_0x58ac92[_0x3a02('0x2e')]=_[_0x3a02('0x2f')](_0x17e4ef[_0x3a02('0x2e')]);_0x58ac92[_0x3a02('0x30')]=_['intersection'](_0x58ac92[_0x3a02('0x2d')],_0x58ac92['query']);_0x3eeac9[_0x3a02('0x32')]=_['intersection'](_0x58ac92[_0x3a02('0x2d')],qs[_0x3a02('0x33')](_0x17e4ef['query'][_0x3a02('0x33')]));_0x3eeac9[_0x3a02('0x32')]=_0x3eeac9[_0x3a02('0x32')][_0x3a02('0x34')]?_0x3eeac9[_0x3a02('0x32')]:_0x58ac92['model'];if(_0x17e4ef[_0x3a02('0x2e')][_0x3a02('0x3f')]){_0x3eeac9[_0x3a02('0x40')]=[{'all':!![]}];}_0x3eeac9=_[_0x3a02('0x3c')]({},_0x3eeac9,_0x17e4ef[_0x3a02('0x44')]);return db[_0x3a02('0x3e')][_0x3a02('0x45')](_0x3eeac9)[_0x3a02('0x22')](handleEntityNotFound(_0x3ec87c,null))[_0x3a02('0x22')](respondWithResult(_0x3ec87c,null))[_0x3a02('0x46')](handleError(_0x3ec87c,null));};exports[_0x3a02('0x47')]=function(_0xf7ca1,_0x7b184c){return db['OpenchannelTransferReport'][_0x3a02('0x47')](_0xf7ca1[_0x3a02('0x48')],{})[_0x3a02('0x22')](respondWithResult(_0x7b184c,0xc9))[_0x3a02('0x46')](handleError(_0x7b184c,null));};exports[_0x3a02('0x21')]=function(_0x2ffa5b,_0x4424c8){if(_0x2ffa5b['body']['id']){delete _0x2ffa5b[_0x3a02('0x48')]['id'];}return db[_0x3a02('0x3e')][_0x3a02('0x45')]({'where':{'id':_0x2ffa5b[_0x3a02('0x43')]['id']}})['then'](handleEntityNotFound(_0x4424c8,null))[_0x3a02('0x22')](saveUpdates(_0x2ffa5b[_0x3a02('0x48')],null))[_0x3a02('0x22')](respondWithResult(_0x4424c8,null))[_0x3a02('0x46')](handleError(_0x4424c8,null));};exports[_0x3a02('0x23')]=function(_0x18e1ce,_0x3d2caa){return db[_0x3a02('0x3e')]['find']({'where':{'id':_0x18e1ce['params']['id']}})[_0x3a02('0x22')](handleEntityNotFound(_0x3d2caa,null))[_0x3a02('0x22')](removeEntity(_0x3d2caa,null))[_0x3a02('0x46')](handleError(_0x3d2caa,null));};exports['describe']=function(_0x10c3f8,_0x38f766){return db[_0x3a02('0x3e')][_0x3a02('0x49')]()['then'](respondWithResult(_0x38f766,null))[_0x3a02('0x46')](handleError(_0x38f766,null));}; \ No newline at end of file +var _0xe0c9=['apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','OpenchannelTransferReport','includeAll','include','findAll','catch','show','params','keys','intersection','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','json'];(function(_0x1dfb4f,_0x550be0){var _0x547b48=function(_0x12c345){while(--_0x12c345){_0x1dfb4f['push'](_0x1dfb4f['shift']());}};_0x547b48(++_0x550be0);}(_0xe0c9,0x199));var _0x9e0c=function(_0x45bf0f,_0x2b1117){_0x45bf0f=_0x45bf0f-0x0;var _0x4b469d=_0xe0c9[_0x45bf0f];return _0x4b469d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e0c('0x0'));var zipdir=require(_0x9e0c('0x1'));var jsonpatch=require(_0x9e0c('0x2'));var rp=require('request-promise');var moment=require(_0x9e0c('0x3'));var BPromise=require(_0x9e0c('0x4'));var Mustache=require(_0x9e0c('0x5'));var util=require(_0x9e0c('0x6'));var path=require(_0x9e0c('0x7'));var sox=require(_0x9e0c('0x8'));var csv=require(_0x9e0c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e0c('0xa'));var squel=require(_0x9e0c('0xb'));var crypto=require(_0x9e0c('0xc'));var jsforce=require(_0x9e0c('0xd'));var deskjs=require(_0x9e0c('0xe'));var toCsv=require(_0x9e0c('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e0c('0xf'));var authService=require(_0x9e0c('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9e0c('0x11'));var utils=require(_0x9e0c('0x12'));var config=require(_0x9e0c('0x13'));var licenseUtil=require(_0x9e0c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35cac1,_0x8ac451){_0x8ac451=_0x8ac451||0xcc;return function(_0xacb26){if(_0xacb26){return _0x35cac1[_0x9e0c('0x15')](_0x8ac451);}return _0x35cac1[_0x9e0c('0x16')](_0x8ac451)['end']();};}function respondWithResult(_0x471159,_0x48a794){_0x48a794=_0x48a794||0xc8;return function(_0x57e415){if(_0x57e415){return _0x471159['status'](_0x48a794)['json'](_0x57e415);}};}function respondWithFilteredResult(_0x132ebc,_0x22036d){return function(_0x2dbd57){if(_0x2dbd57){var _0x1b3acb=typeof _0x22036d['offset']===_0x9e0c('0x17')&&typeof _0x22036d[_0x9e0c('0x18')]===_0x9e0c('0x17');var _0x556aae=_0x2dbd57[_0x9e0c('0x19')];var _0x35940c=_0x1b3acb?0x0:_0x22036d[_0x9e0c('0x1a')];var _0x2f0438=_0x1b3acb?_0x2dbd57['count']:_0x22036d['offset']+_0x22036d[_0x9e0c('0x18')];var _0x73714e;if(_0x2f0438>=_0x556aae){_0x2f0438=_0x556aae;_0x73714e=0xc8;}else{_0x73714e=0xce;}_0x132ebc[_0x9e0c('0x16')](_0x73714e);return _0x132ebc[_0x9e0c('0x1b')]('Content-Range',_0x35940c+'-'+_0x2f0438+'/'+_0x556aae)[_0x9e0c('0x1c')](_0x2dbd57);}return null;};}function patchUpdates(_0x55d66b){return function(_0x51b928){try{jsonpatch[_0x9e0c('0x1d')](_0x51b928,_0x55d66b,!![]);}catch(_0x3aecbe){return BPromise[_0x9e0c('0x1e')](_0x3aecbe);}return _0x51b928[_0x9e0c('0x1f')]();};}function saveUpdates(_0x1f2ea1,_0x27692e){return function(_0x34f4cd){if(_0x34f4cd){return _0x34f4cd[_0x9e0c('0x20')](_0x1f2ea1)[_0x9e0c('0x21')](function(_0xd5f2ea){return _0xd5f2ea;});}return null;};}function removeEntity(_0x875a9b,_0x3ce476){return function(_0x235ebb){if(_0x235ebb){return _0x235ebb[_0x9e0c('0x22')]()[_0x9e0c('0x21')](function(){_0x875a9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d495b,_0x38ae4f){return function(_0x4db741){if(!_0x4db741){_0x1d495b[_0x9e0c('0x15')](0x194);}return _0x4db741;};}function handleError(_0x26bb21,_0x726685){_0x726685=_0x726685||0x1f4;return function(_0x4264d){logger[_0x9e0c('0x23')](_0x4264d[_0x9e0c('0x24')]);if(_0x4264d['name']){delete _0x4264d['name'];}_0x26bb21[_0x9e0c('0x16')](_0x726685)[_0x9e0c('0x25')](_0x4264d);};}exports[_0x9e0c('0x26')]=function(_0x9bb3ae,_0x1d6be5){var _0x5e6bfd={},_0x2103ec={},_0x11d7eb={'count':0x0,'rows':[]};var _0x1c1249=_[_0x9e0c('0x27')](db['OpenchannelTransferReport'][_0x9e0c('0x28')],function(_0x5faf53){return{'name':_0x5faf53[_0x9e0c('0x29')],'type':_0x5faf53[_0x9e0c('0x2a')][_0x9e0c('0x2b')]};});_0x2103ec[_0x9e0c('0x2c')]=_['map'](_0x1c1249,_0x9e0c('0x2d'));_0x2103ec[_0x9e0c('0x2e')]=_['keys'](_0x9bb3ae[_0x9e0c('0x2e')]);_0x2103ec[_0x9e0c('0x2f')]=_['intersection'](_0x2103ec[_0x9e0c('0x2c')],_0x2103ec['query']);_0x5e6bfd[_0x9e0c('0x30')]=_['intersection'](_0x2103ec['model'],qs[_0x9e0c('0x31')](_0x9bb3ae['query'][_0x9e0c('0x31')]));_0x5e6bfd['attributes']=_0x5e6bfd['attributes'][_0x9e0c('0x32')]?_0x5e6bfd[_0x9e0c('0x30')]:_0x2103ec['model'];if(!_0x9bb3ae[_0x9e0c('0x2e')][_0x9e0c('0x33')](_0x9e0c('0x34'))){_0x5e6bfd[_0x9e0c('0x18')]=qs['limit'](_0x9bb3ae[_0x9e0c('0x2e')][_0x9e0c('0x18')]);_0x5e6bfd[_0x9e0c('0x1a')]=qs[_0x9e0c('0x1a')](_0x9bb3ae[_0x9e0c('0x2e')][_0x9e0c('0x1a')]);}_0x5e6bfd['order']=qs['sort'](_0x9bb3ae['query'][_0x9e0c('0x35')]);_0x5e6bfd['where']=qs['filters'](_[_0x9e0c('0x36')](_0x9bb3ae['query'],_0x2103ec[_0x9e0c('0x2f')]),_0x1c1249);if(_0x9bb3ae[_0x9e0c('0x2e')][_0x9e0c('0x37')]){_0x5e6bfd[_0x9e0c('0x38')]=_[_0x9e0c('0x39')](_0x5e6bfd[_0x9e0c('0x38')],{'$or':_[_0x9e0c('0x27')](_0x1c1249,function(_0x16cf52){if(_0x16cf52[_0x9e0c('0x2a')]!==_0x9e0c('0x3a')){var _0x5b662d={};_0x5b662d[_0x16cf52['name']]={'$like':'%'+_0x9bb3ae[_0x9e0c('0x2e')][_0x9e0c('0x37')]+'%'};return _0x5b662d;}})});}_0x5e6bfd=_[_0x9e0c('0x39')]({},_0x5e6bfd,_0x9bb3ae['options']);var _0x6429ad={'where':_0x5e6bfd['where']};return db[_0x9e0c('0x3b')][_0x9e0c('0x19')](_0x6429ad)['then'](function(_0x521245){_0x11d7eb[_0x9e0c('0x19')]=_0x521245;if(_0x9bb3ae['query'][_0x9e0c('0x3c')]){_0x5e6bfd[_0x9e0c('0x3d')]=[{'all':!![]}];}return db[_0x9e0c('0x3b')][_0x9e0c('0x3e')](_0x5e6bfd);})['then'](function(_0x38d3b5){_0x11d7eb['rows']=_0x38d3b5;return _0x11d7eb;})[_0x9e0c('0x21')](respondWithFilteredResult(_0x1d6be5,_0x5e6bfd))[_0x9e0c('0x3f')](handleError(_0x1d6be5,null));};exports[_0x9e0c('0x40')]=function(_0x3bd728,_0x3a9d99){var _0x2f310a={'raw':!![],'where':{'id':_0x3bd728[_0x9e0c('0x41')]['id']}},_0x33b452={};_0x33b452[_0x9e0c('0x2c')]=_[_0x9e0c('0x42')](db[_0x9e0c('0x3b')]['rawAttributes']);_0x33b452['query']=_[_0x9e0c('0x42')](_0x3bd728[_0x9e0c('0x2e')]);_0x33b452[_0x9e0c('0x2f')]=_[_0x9e0c('0x43')](_0x33b452[_0x9e0c('0x2c')],_0x33b452['query']);_0x2f310a[_0x9e0c('0x30')]=_[_0x9e0c('0x43')](_0x33b452[_0x9e0c('0x2c')],qs['fields'](_0x3bd728['query'][_0x9e0c('0x31')]));_0x2f310a[_0x9e0c('0x30')]=_0x2f310a[_0x9e0c('0x30')]['length']?_0x2f310a['attributes']:_0x33b452[_0x9e0c('0x2c')];if(_0x3bd728[_0x9e0c('0x2e')][_0x9e0c('0x3c')]){_0x2f310a[_0x9e0c('0x3d')]=[{'all':!![]}];}_0x2f310a=_[_0x9e0c('0x39')]({},_0x2f310a,_0x3bd728[_0x9e0c('0x44')]);return db[_0x9e0c('0x3b')][_0x9e0c('0x45')](_0x2f310a)[_0x9e0c('0x21')](handleEntityNotFound(_0x3a9d99,null))['then'](respondWithResult(_0x3a9d99,null))[_0x9e0c('0x3f')](handleError(_0x3a9d99,null));};exports['create']=function(_0x19df55,_0x3ac48e){return db[_0x9e0c('0x3b')][_0x9e0c('0x46')](_0x19df55[_0x9e0c('0x47')],{})[_0x9e0c('0x21')](respondWithResult(_0x3ac48e,0xc9))[_0x9e0c('0x3f')](handleError(_0x3ac48e,null));};exports[_0x9e0c('0x20')]=function(_0x615114,_0x5f0c23){if(_0x615114[_0x9e0c('0x47')]['id']){delete _0x615114['body']['id'];}return db['OpenchannelTransferReport'][_0x9e0c('0x45')]({'where':{'id':_0x615114[_0x9e0c('0x41')]['id']}})[_0x9e0c('0x21')](handleEntityNotFound(_0x5f0c23,null))[_0x9e0c('0x21')](saveUpdates(_0x615114['body'],null))['then'](respondWithResult(_0x5f0c23,null))['catch'](handleError(_0x5f0c23,null));};exports['destroy']=function(_0x31d39a,_0xfd3cf9){return db['OpenchannelTransferReport'][_0x9e0c('0x45')]({'where':{'id':_0x31d39a[_0x9e0c('0x41')]['id']}})['then'](handleEntityNotFound(_0xfd3cf9,null))['then'](removeEntity(_0xfd3cf9,null))[_0x9e0c('0x3f')](handleError(_0xfd3cf9,null));};exports['describe']=function(_0x5b23e3,_0x2f113e){return db[_0x9e0c('0x3b')][_0x9e0c('0x48')]()[_0x9e0c('0x21')](respondWithResult(_0x2f113e,null))['catch'](handleError(_0x2f113e,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 04b7ad8..4d1c0e8 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 _0x72b9=['moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','../../config/logger'];(function(_0x224fa2,_0x140565){var _0x800c0=function(_0x1ec95e){while(--_0x1ec95e){_0x224fa2['push'](_0x224fa2['shift']());}};_0x800c0(++_0x140565);}(_0x72b9,0x1a0));var _0x972b=function(_0xb6e43,_0x1568fc){_0xb6e43=_0xb6e43-0x0;var _0x47c40f=_0x72b9[_0xb6e43];return _0x47c40f;};'use strict';var _=require(_0x972b('0x0'));var util=require('util');var logger=require(_0x972b('0x1'))('api');var moment=require(_0x972b('0x2'));var BPromise=require(_0x972b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x972b('0x4'));var rimraf=require(_0x972b('0x5'));var config=require(_0x972b('0x6'));var attributes=require(_0x972b('0x7'));module['exports']=function(_0x16daf1,_0x274a1e){return _0x16daf1[_0x972b('0x8')](_0x972b('0x9'),attributes,{'tableName':_0x972b('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd0=['../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x4be8fd,_0x2512e7){var _0xf096a9=function(_0x413b03){while(--_0x413b03){_0x4be8fd['push'](_0x4be8fd['shift']());}};_0xf096a9(++_0x2512e7);}(_0x0cd0,0x1bc));var _0x00cd=function(_0x56d51b,_0x140737){_0x56d51b=_0x56d51b-0x0;var _0x3dc788=_0x0cd0[_0x56d51b];return _0x3dc788;};'use strict';var _=require(_0x00cd('0x0'));var util=require(_0x00cd('0x1'));var logger=require(_0x00cd('0x2'))('api');var moment=require(_0x00cd('0x3'));var BPromise=require(_0x00cd('0x4'));var rp=require(_0x00cd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x00cd('0x6'));var config=require(_0x00cd('0x7'));var attributes=require(_0x00cd('0x8'));module[_0x00cd('0x9')]=function(_0x270b74,_0x3e3e1d){return _0x270b74['define'](_0x00cd('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index f320347..956f38b 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 _0x1d25=['request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x158ff7,_0x51cfc5){var _0x330e53=function(_0x35e7bd){while(--_0x35e7bd){_0x158ff7['push'](_0x158ff7['shift']());}};_0x330e53(++_0x51cfc5);}(_0x1d25,0xba));var _0x51d2=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x1d25[_0x1daaa9];return _0x1dd221;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var moment=require(_0x51d2('0x2'));var BPromise=require(_0x51d2('0x3'));var rs=require(_0x51d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51d2('0x5'))['db'];var utils=require(_0x51d2('0x6'));var logger=require('../../config/logger')(_0x51d2('0x7'));var config=require(_0x51d2('0x8'));var jayson=require(_0x51d2('0x9'));var client=jayson[_0x51d2('0xa')][_0x51d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6956,_0x56edda,_0x18e8a9){return new BPromise(function(_0x5a6b5f,_0x419156){return client['request'](_0x2e6956,_0x18e8a9)['then'](function(_0x30d7d0){logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));logger['debug'](_0x51d2('0xf'),_0x56edda,_0x51d2('0xe'),JSON[_0x51d2('0x10')](_0x30d7d0));if(_0x30d7d0[_0x51d2('0x11')]){if(_0x30d7d0[_0x51d2('0x11')]['code']===0x1f4){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0['error']['message']);return _0x419156(_0x30d7d0[_0x51d2('0x11')][_0x51d2('0x12')]);}logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0[_0x51d2('0x11')]['message']);return _0x5a6b5f(_0x30d7d0[_0x51d2('0x11')]['message']);}else{logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));_0x5a6b5f(_0x30d7d0['result'][_0x51d2('0x12')]);}})[_0x51d2('0x13')](function(_0x14a682){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x14a682);_0x419156(_0x14a682);});});} \ No newline at end of file +var _0x5b20=['OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x44c490,_0x3b699a){var _0x3f78dc=function(_0x4ee75e){while(--_0x4ee75e){_0x44c490['push'](_0x44c490['shift']());}};_0x3f78dc(++_0x3b699a);}(_0x5b20,0x86));var _0x05b2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5b20[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var moment=require(_0x05b2('0x2'));var BPromise=require(_0x05b2('0x3'));var rs=require(_0x05b2('0x4'));var fs=require('fs');var Redis=require(_0x05b2('0x5'));var db=require(_0x05b2('0x6'))['db'];var utils=require(_0x05b2('0x7'));var logger=require(_0x05b2('0x8'))(_0x05b2('0x9'));var config=require(_0x05b2('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x05b2('0xb')][_0x05b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x541855,_0x24f11f,_0x43cd94){return new BPromise(function(_0x3be69a,_0x1b66e4){return client[_0x05b2('0xd')](_0x541855,_0x43cd94)[_0x05b2('0xe')](function(_0xfe6680){logger[_0x05b2('0xf')](_0x05b2('0x10'),_0x24f11f,_0x05b2('0x11'));logger[_0x05b2('0x12')](_0x05b2('0x13'),_0x24f11f,_0x05b2('0x11'),JSON[_0x05b2('0x14')](_0xfe6680));if(_0xfe6680[_0x05b2('0x15')]){if(_0xfe6680[_0x05b2('0x15')]['code']===0x1f4){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);return _0x1b66e4(_0xfe6680['error'][_0x05b2('0x16')]);}logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0xfe6680['error']['message']);return _0x3be69a(_0xfe6680[_0x05b2('0x15')][_0x05b2('0x16')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x24f11f,_0x05b2('0x11'));_0x3be69a(_0xfe6680[_0x05b2('0x17')][_0x05b2('0x16')]);}})[_0x05b2('0x18')](function(_0x234843){logger[_0x05b2('0x15')](_0x05b2('0x10'),_0x24f11f,_0x234843);_0x1b66e4(_0x234843);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index f816773..b6c979c 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 _0xb73e=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','destroy','multer','path'];(function(_0x5e761b,_0x355e38){var _0x98502c=function(_0x4e52d5){while(--_0x4e52d5){_0x5e761b['push'](_0x5e761b['shift']());}};_0x98502c(++_0x355e38);}(_0xb73e,0x184));var _0xeb73=function(_0x1a19b4,_0x1c084f){_0x1a19b4=_0x1a19b4-0x0;var _0x4ae8ac=_0xb73e[_0x1a19b4];return _0x4ae8ac;};'use strict';var multer=require(_0xeb73('0x0'));var util=require('util');var path=require(_0xeb73('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb73('0x2')]();var fs_extra=require(_0xeb73('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xeb73('0x4'));var config=require(_0xeb73('0x5'));var controller=require('./pause.controller');router[_0xeb73('0x6')]('/',auth[_0xeb73('0x7')](),controller[_0xeb73('0x8')]);router['get'](_0xeb73('0x9'),auth[_0xeb73('0x7')](),controller['show']);router[_0xeb73('0xa')]('/',auth['isAuthenticated'](),controller[_0xeb73('0xb')]);router[_0xeb73('0xc')](_0xeb73('0x9'),auth[_0xeb73('0x7')](),controller[_0xeb73('0xd')]);router['delete'](_0xeb73('0x9'),auth['isAuthenticated'](),controller[_0xeb73('0xe')]);module['exports']=router; \ No newline at end of file +var _0x210b=['../../components/interaction/service','./pause.controller','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x48e6c9,_0x46c2fd){var _0xf3f800=function(_0x4ce308){while(--_0x4ce308){_0x48e6c9['push'](_0x48e6c9['shift']());}};_0xf3f800(++_0x46c2fd);}(_0x210b,0xfa));var _0xb210=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x210b[_0xcfd89f];return _0x59acd4;};'use strict';var multer=require('multer');var util=require(_0xb210('0x0'));var path=require(_0xb210('0x1'));var timeout=require('connect-timeout');var express=require(_0xb210('0x2'));var router=express[_0xb210('0x3')]();var fs_extra=require(_0xb210('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb210('0x5'));var config=require('../../config/environment');var controller=require(_0xb210('0x6'));router['get']('/',auth[_0xb210('0x7')](),controller[_0xb210('0x8')]);router['get'](_0xb210('0x9'),auth[_0xb210('0x7')](),controller[_0xb210('0xa')]);router[_0xb210('0xb')]('/',auth[_0xb210('0x7')](),controller[_0xb210('0xc')]);router[_0xb210('0xd')](_0xb210('0x9'),auth[_0xb210('0x7')](),controller[_0xb210('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb210('0xf')]);module[_0xb210('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index c58385b..2cd31df 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 _0xe845=['sequelize','STRING','name'];(function(_0x56f905,_0x31ed80){var _0x1f0cfb=function(_0x1c3b15){while(--_0x1c3b15){_0x56f905['push'](_0x56f905['shift']());}};_0x1f0cfb(++_0x31ed80);}(_0xe845,0x1d7));var _0x5e84=function(_0x3dd00d,_0x437dcc){_0x3dd00d=_0x3dd00d-0x0;var _0x422141=_0xe845[_0x3dd00d];return _0x422141;};'use strict';var Sequelize=require(_0x5e84('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e84('0x1')],'unique':_0x5e84('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x5e84('0x1')]}}; \ No newline at end of file +var _0x2a69=['exports','STRING','name'];(function(_0x445d4a,_0x239cc2){var _0x21260d=function(_0x152d0a){while(--_0x152d0a){_0x445d4a['push'](_0x445d4a['shift']());}};_0x21260d(++_0x239cc2);}(_0x2a69,0xd8));var _0x92a6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2a69[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x92a6('0x0')]={'name':{'type':Sequelize[_0x92a6('0x1')],'unique':_0x92a6('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x92a6('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f605b82..3a5fb75 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 _0xbc8a=['sendStatus','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','Pauses','UserProfileResource'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xbc8a,0x1a9));var _0xabc8=function(_0x449cee,_0x3d88b0){_0x449cee=_0x449cee-0x0;var _0x58de0a=_0xbc8a[_0x449cee];return _0x58de0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xabc8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xabc8('0x2'));var path=require(_0xabc8('0x3'));var sox=require(_0xabc8('0x4'));var csv=require(_0xabc8('0x5'));var ejs=require(_0xabc8('0x6'));var fs=require('fs');var fs_extra=require(_0xabc8('0x7'));var _=require(_0xabc8('0x8'));var squel=require(_0xabc8('0x9'));var crypto=require(_0xabc8('0xa'));var jsforce=require(_0xabc8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xabc8('0x5'));var querystring=require(_0xabc8('0xc'));var Papa=require(_0xabc8('0xd'));var Redis=require(_0xabc8('0xe'));var authService=require(_0xabc8('0xf'));var qs=require(_0xabc8('0x10'));var as=require(_0xabc8('0x11'));var hardwareService=require(_0xabc8('0x12'));var logger=require(_0xabc8('0x13'))('api');var utils=require(_0xabc8('0x14'));var config=require(_0xabc8('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x267dcc,_0xa63306){_0xa63306=_0xa63306||0xcc;return function(_0x1d9012){if(_0x1d9012){return _0x267dcc['sendStatus'](_0xa63306);}return _0x267dcc[_0xabc8('0x16')](_0xa63306)[_0xabc8('0x17')]();};}function respondWithResult(_0x2f8ea8,_0x23a3e9){_0x23a3e9=_0x23a3e9||0xc8;return function(_0x4cadfe){if(_0x4cadfe){return _0x2f8ea8['status'](_0x23a3e9)[_0xabc8('0x18')](_0x4cadfe);}};}function respondWithFilteredResult(_0x27293b,_0x3df695){return function(_0x4e2075){if(_0x4e2075){var _0x561db9=typeof _0x3df695[_0xabc8('0x19')]===_0xabc8('0x1a')&&typeof _0x3df695[_0xabc8('0x1b')]===_0xabc8('0x1a');var _0x10a42e=_0x4e2075[_0xabc8('0x1c')];var _0x1ecf14=_0x561db9?0x0:_0x3df695['offset'];var _0x55378f=_0x561db9?_0x4e2075['count']:_0x3df695[_0xabc8('0x19')]+_0x3df695[_0xabc8('0x1b')];var _0x384702;if(_0x55378f>=_0x10a42e){_0x55378f=_0x10a42e;_0x384702=0xc8;}else{_0x384702=0xce;}_0x27293b[_0xabc8('0x16')](_0x384702);return _0x27293b['set']('Content-Range',_0x1ecf14+'-'+_0x55378f+'/'+_0x10a42e)['json'](_0x4e2075);}return null;};}function patchUpdates(_0x1c2a7c){return function(_0x16312d){try{jsonpatch[_0xabc8('0x1d')](_0x16312d,_0x1c2a7c,!![]);}catch(_0x69f486){return BPromise[_0xabc8('0x1e')](_0x69f486);}return _0x16312d[_0xabc8('0x1f')]();};}function saveUpdates(_0x5f389c,_0x1e4808){return function(_0x1a2934){if(_0x1a2934){return _0x1a2934[_0xabc8('0x20')](_0x5f389c)[_0xabc8('0x21')](function(_0x219e78){return _0x219e78;});}return null;};}function removeEntity(_0x533130,_0x1e39dd){return function(_0xfce708){if(_0xfce708){return _0xfce708[_0xabc8('0x22')]()[_0xabc8('0x21')](function(){var _0x4a8a22=_0xfce708['get']({'plain':!![]});var _0x345bb7=_0xabc8('0x23');return db[_0xabc8('0x24')][_0xabc8('0x22')]({'where':{'type':_0x345bb7,'resourceId':_0x4a8a22['id']}})['then'](function(){return _0xfce708;});})[_0xabc8('0x21')](function(){_0x533130['status'](0xcc)[_0xabc8('0x17')]();});}};}function handleEntityNotFound(_0x43b4c2,_0xac77c5){return function(_0x3bfde9){if(!_0x3bfde9){_0x43b4c2[_0xabc8('0x25')](0x194);}return _0x3bfde9;};}function handleError(_0x16d726,_0x2711a6){_0x2711a6=_0x2711a6||0x1f4;return function(_0x406b40){logger['error'](_0x406b40[_0xabc8('0x26')]);if(_0x406b40[_0xabc8('0x27')]){delete _0x406b40[_0xabc8('0x27')];}_0x16d726[_0xabc8('0x16')](_0x2711a6)[_0xabc8('0x28')](_0x406b40);};}exports[_0xabc8('0x29')]=function(_0xa6946,_0x3100cc){var _0x24102a={},_0x171ae0={},_0x4a2e9b={'count':0x0,'rows':[]};var _0x268743=_[_0xabc8('0x2a')](db[_0xabc8('0x2b')][_0xabc8('0x2c')],function(_0x4c8050){return{'name':_0x4c8050[_0xabc8('0x2d')],'type':_0x4c8050[_0xabc8('0x2e')][_0xabc8('0x2f')]};});_0x171ae0['model']=_[_0xabc8('0x2a')](_0x268743,_0xabc8('0x27'));_0x171ae0['query']=_[_0xabc8('0x30')](_0xa6946['query']);_0x171ae0[_0xabc8('0x31')]=_[_0xabc8('0x32')](_0x171ae0[_0xabc8('0x33')],_0x171ae0[_0xabc8('0x34')]);_0x24102a[_0xabc8('0x35')]=_[_0xabc8('0x32')](_0x171ae0['model'],qs[_0xabc8('0x36')](_0xa6946['query']['fields']));_0x24102a['attributes']=_0x24102a['attributes']['length']?_0x24102a['attributes']:_0x171ae0[_0xabc8('0x33')];if(!_0xa6946[_0xabc8('0x34')]['hasOwnProperty']('nolimit')){_0x24102a[_0xabc8('0x1b')]=qs[_0xabc8('0x1b')](_0xa6946[_0xabc8('0x34')][_0xabc8('0x1b')]);_0x24102a[_0xabc8('0x19')]=qs[_0xabc8('0x19')](_0xa6946[_0xabc8('0x34')][_0xabc8('0x19')]);}_0x24102a['order']=qs[_0xabc8('0x37')](_0xa6946[_0xabc8('0x34')]['sort']);_0x24102a[_0xabc8('0x38')]=qs[_0xabc8('0x31')](_['pick'](_0xa6946['query'],_0x171ae0['filters']),_0x268743);if(_0xa6946[_0xabc8('0x34')][_0xabc8('0x39')]){_0x24102a[_0xabc8('0x38')]=_[_0xabc8('0x3a')](_0x24102a['where'],{'$or':_[_0xabc8('0x2a')](_0x268743,function(_0x2215ac){if(_0x2215ac[_0xabc8('0x2e')]!==_0xabc8('0x3b')){var _0x71eba8={};_0x71eba8[_0x2215ac[_0xabc8('0x27')]]={'$like':'%'+_0xa6946['query'][_0xabc8('0x39')]+'%'};return _0x71eba8;}})});}_0x24102a=_[_0xabc8('0x3a')]({},_0x24102a,_0xa6946[_0xabc8('0x3c')]);var _0x3d68b3={'where':_0x24102a['where']};return db[_0xabc8('0x2b')][_0xabc8('0x1c')](_0x3d68b3)[_0xabc8('0x21')](function(_0x345426){_0x4a2e9b[_0xabc8('0x1c')]=_0x345426;if(_0xa6946[_0xabc8('0x34')][_0xabc8('0x3d')]){_0x24102a[_0xabc8('0x3e')]=[{'all':!![]}];}return db[_0xabc8('0x2b')][_0xabc8('0x3f')](_0x24102a);})[_0xabc8('0x21')](function(_0xd2a19f){_0x4a2e9b[_0xabc8('0x40')]=_0xd2a19f;return _0x4a2e9b;})[_0xabc8('0x21')](respondWithFilteredResult(_0x3100cc,_0x24102a))[_0xabc8('0x41')](handleError(_0x3100cc,null));};exports['show']=function(_0x24eaf0,_0x44be18){var _0x12eb41={'raw':!![],'where':{'id':_0x24eaf0[_0xabc8('0x42')]['id']}},_0x32db34={};_0x32db34[_0xabc8('0x33')]=_[_0xabc8('0x30')](db['Pause'][_0xabc8('0x2c')]);_0x32db34[_0xabc8('0x34')]=_[_0xabc8('0x30')](_0x24eaf0[_0xabc8('0x34')]);_0x32db34[_0xabc8('0x31')]=_[_0xabc8('0x32')](_0x32db34[_0xabc8('0x33')],_0x32db34[_0xabc8('0x34')]);_0x12eb41['attributes']=_[_0xabc8('0x32')](_0x32db34[_0xabc8('0x33')],qs[_0xabc8('0x36')](_0x24eaf0[_0xabc8('0x34')]['fields']));_0x12eb41[_0xabc8('0x35')]=_0x12eb41[_0xabc8('0x35')][_0xabc8('0x43')]?_0x12eb41[_0xabc8('0x35')]:_0x32db34[_0xabc8('0x33')];if(_0x24eaf0[_0xabc8('0x34')]['includeAll']){_0x12eb41[_0xabc8('0x3e')]=[{'all':!![]}];}_0x12eb41=_['merge']({},_0x12eb41,_0x24eaf0[_0xabc8('0x3c')]);return db[_0xabc8('0x2b')][_0xabc8('0x44')](_0x12eb41)[_0xabc8('0x21')](handleEntityNotFound(_0x44be18,null))[_0xabc8('0x21')](respondWithResult(_0x44be18,null))[_0xabc8('0x41')](handleError(_0x44be18,null));};exports[_0xabc8('0x45')]=function(_0x33c06d,_0x59efbe){return db['Pause'][_0xabc8('0x45')](_0x33c06d[_0xabc8('0x46')],{})['then'](function(_0x12a335){var _0x8d69d9=_0x33c06d[_0xabc8('0x47')][_0xabc8('0x48')]({'plain':!![]});if(!_0x8d69d9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x8d69d9['role']===_0xabc8('0x47')){var _0x47432a=_0x12a335[_0xabc8('0x48')]({'plain':!![]});var _0x4c094a='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x4c094a,'userProfileId':_0x8d69d9[_0xabc8('0x49')]},'raw':!![]})[_0xabc8('0x21')](function(_0x24da71){if(_0x24da71&&_0x24da71[_0xabc8('0x4a')]===0x0){return db[_0xabc8('0x24')][_0xabc8('0x45')]({'name':_0x47432a['name'],'resourceId':_0x47432a['id'],'type':_0x24da71[_0xabc8('0x27')],'sectionId':_0x24da71['id']},{})['then'](function(){return _0x12a335;});}else{return _0x12a335;}})['catch'](function(_0x5699af){logger[_0xabc8('0x4b')](_0xabc8('0x4c'),_0x5699af);throw _0x5699af;});}return _0x12a335;})[_0xabc8('0x21')](respondWithResult(_0x59efbe,0xc9))[_0xabc8('0x41')](handleError(_0x59efbe,null));};exports[_0xabc8('0x20')]=function(_0x160ba0,_0x4d9310){if(_0x160ba0[_0xabc8('0x46')]['id']){delete _0x160ba0[_0xabc8('0x46')]['id'];}return db[_0xabc8('0x2b')]['find']({'where':{'id':_0x160ba0[_0xabc8('0x42')]['id']}})[_0xabc8('0x21')](handleEntityNotFound(_0x4d9310,null))[_0xabc8('0x21')](saveUpdates(_0x160ba0[_0xabc8('0x46')],null))[_0xabc8('0x21')](respondWithResult(_0x4d9310,null))[_0xabc8('0x41')](handleError(_0x4d9310,null));};exports[_0xabc8('0x22')]=function(_0x13c534,_0x2437f8){return db[_0xabc8('0x2b')][_0xabc8('0x44')]({'where':{'id':_0x13c534[_0xabc8('0x42')]['id']}})[_0xabc8('0x21')](handleEntityNotFound(_0x2437f8,null))[_0xabc8('0x21')](removeEntity(_0x2437f8,null))['catch'](handleError(_0x2437f8,null));}; \ No newline at end of file +var _0xdb42=['key','model','keys','query','intersection','attributes','length','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','autoAssociation','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','destroy','get','then','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type'];(function(_0x39c7b9,_0x51b800){var _0x2fa62f=function(_0x4fbe09){while(--_0x4fbe09){_0x39c7b9['push'](_0x39c7b9['shift']());}};_0x2fa62f(++_0x51b800);}(_0xdb42,0xb0));var _0x2db4=function(_0x353337,_0x20aac5){_0x353337=_0x353337-0x0;var _0x393c33=_0xdb42[_0x353337];return _0x393c33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2db4('0x0'));var zipdir=require(_0x2db4('0x1'));var jsonpatch=require(_0x2db4('0x2'));var rp=require('request-promise');var moment=require(_0x2db4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2db4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2db4('0x5'));var csv=require(_0x2db4('0x6'));var ejs=require(_0x2db4('0x7'));var fs=require('fs');var fs_extra=require(_0x2db4('0x8'));var _=require(_0x2db4('0x9'));var squel=require(_0x2db4('0xa'));var crypto=require(_0x2db4('0xb'));var jsforce=require(_0x2db4('0xc'));var deskjs=require(_0x2db4('0xd'));var toCsv=require(_0x2db4('0x6'));var querystring=require('querystring');var Papa=require(_0x2db4('0xe'));var Redis=require(_0x2db4('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2db4('0x10'));var hardwareService=require(_0x2db4('0x11'));var logger=require('../../config/logger')(_0x2db4('0x12'));var utils=require(_0x2db4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2db4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c27ee,_0x15f1eb){_0x15f1eb=_0x15f1eb||0xcc;return function(_0x67392){if(_0x67392){return _0x1c27ee[_0x2db4('0x15')](_0x15f1eb);}return _0x1c27ee[_0x2db4('0x16')](_0x15f1eb)[_0x2db4('0x17')]();};}function respondWithResult(_0x303f6c,_0x2100ab){_0x2100ab=_0x2100ab||0xc8;return function(_0x2bffa7){if(_0x2bffa7){return _0x303f6c[_0x2db4('0x16')](_0x2100ab)[_0x2db4('0x18')](_0x2bffa7);}};}function respondWithFilteredResult(_0x50d51b,_0x2313c4){return function(_0x4824cc){if(_0x4824cc){var _0x44ab76=typeof _0x2313c4[_0x2db4('0x19')]==='undefined'&&typeof _0x2313c4[_0x2db4('0x1a')]===_0x2db4('0x1b');var _0x4f2a1b=_0x4824cc[_0x2db4('0x1c')];var _0x2edb34=_0x44ab76?0x0:_0x2313c4[_0x2db4('0x19')];var _0x468ac4=_0x44ab76?_0x4824cc[_0x2db4('0x1c')]:_0x2313c4[_0x2db4('0x19')]+_0x2313c4[_0x2db4('0x1a')];var _0xfc525e;if(_0x468ac4>=_0x4f2a1b){_0x468ac4=_0x4f2a1b;_0xfc525e=0xc8;}else{_0xfc525e=0xce;}_0x50d51b['status'](_0xfc525e);return _0x50d51b[_0x2db4('0x1d')]('Content-Range',_0x2edb34+'-'+_0x468ac4+'/'+_0x4f2a1b)['json'](_0x4824cc);}return null;};}function patchUpdates(_0x2a5cbf){return function(_0x507cb1){try{jsonpatch['apply'](_0x507cb1,_0x2a5cbf,!![]);}catch(_0x5193bf){return BPromise[_0x2db4('0x1e')](_0x5193bf);}return _0x507cb1[_0x2db4('0x1f')]();};}function saveUpdates(_0x541295,_0x395564){return function(_0x406189){if(_0x406189){return _0x406189[_0x2db4('0x20')](_0x541295)['then'](function(_0x14e832){return _0x14e832;});}return null;};}function removeEntity(_0x4ad89d,_0x38887a){return function(_0x12c2be){if(_0x12c2be){return _0x12c2be[_0x2db4('0x21')]()['then'](function(){var _0x9e9ac0=_0x12c2be[_0x2db4('0x22')]({'plain':!![]});var _0x3cf8ee='Pauses';return db['UserProfileResource'][_0x2db4('0x21')]({'where':{'type':_0x3cf8ee,'resourceId':_0x9e9ac0['id']}})[_0x2db4('0x23')](function(){return _0x12c2be;});})['then'](function(){_0x4ad89d[_0x2db4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa08900,_0x4fe57f){return function(_0x1f8808){if(!_0x1f8808){_0xa08900[_0x2db4('0x15')](0x194);}return _0x1f8808;};}function handleError(_0x4e5fff,_0x10a594){_0x10a594=_0x10a594||0x1f4;return function(_0x4196c6){logger[_0x2db4('0x24')](_0x4196c6[_0x2db4('0x25')]);if(_0x4196c6[_0x2db4('0x26')]){delete _0x4196c6[_0x2db4('0x26')];}_0x4e5fff[_0x2db4('0x16')](_0x10a594)[_0x2db4('0x27')](_0x4196c6);};}exports[_0x2db4('0x28')]=function(_0x3a484a,_0x205d99){var _0x1745b1={},_0xcd4473={},_0x539189={'count':0x0,'rows':[]};var _0x493505=_[_0x2db4('0x29')](db[_0x2db4('0x2a')][_0x2db4('0x2b')],function(_0x19bb7d){return{'name':_0x19bb7d[_0x2db4('0x2c')],'type':_0x19bb7d[_0x2db4('0x2d')][_0x2db4('0x2e')]};});_0xcd4473[_0x2db4('0x2f')]=_['map'](_0x493505,_0x2db4('0x26'));_0xcd4473['query']=_[_0x2db4('0x30')](_0x3a484a[_0x2db4('0x31')]);_0xcd4473['filters']=_[_0x2db4('0x32')](_0xcd4473[_0x2db4('0x2f')],_0xcd4473[_0x2db4('0x31')]);_0x1745b1[_0x2db4('0x33')]=_[_0x2db4('0x32')](_0xcd4473[_0x2db4('0x2f')],qs['fields'](_0x3a484a[_0x2db4('0x31')]['fields']));_0x1745b1[_0x2db4('0x33')]=_0x1745b1[_0x2db4('0x33')][_0x2db4('0x34')]?_0x1745b1[_0x2db4('0x33')]:_0xcd4473[_0x2db4('0x2f')];if(!_0x3a484a[_0x2db4('0x31')]['hasOwnProperty']('nolimit')){_0x1745b1[_0x2db4('0x1a')]=qs[_0x2db4('0x1a')](_0x3a484a[_0x2db4('0x31')][_0x2db4('0x1a')]);_0x1745b1[_0x2db4('0x19')]=qs[_0x2db4('0x19')](_0x3a484a[_0x2db4('0x31')][_0x2db4('0x19')]);}_0x1745b1['order']=qs[_0x2db4('0x35')](_0x3a484a[_0x2db4('0x31')][_0x2db4('0x35')]);_0x1745b1[_0x2db4('0x36')]=qs[_0x2db4('0x37')](_[_0x2db4('0x38')](_0x3a484a[_0x2db4('0x31')],_0xcd4473[_0x2db4('0x37')]),_0x493505);if(_0x3a484a[_0x2db4('0x31')]['filter']){_0x1745b1[_0x2db4('0x36')]=_['merge'](_0x1745b1[_0x2db4('0x36')],{'$or':_['map'](_0x493505,function(_0x21edb7){if(_0x21edb7[_0x2db4('0x2d')]!==_0x2db4('0x39')){var _0x29c276={};_0x29c276[_0x21edb7[_0x2db4('0x26')]]={'$like':'%'+_0x3a484a['query'][_0x2db4('0x3a')]+'%'};return _0x29c276;}})});}_0x1745b1=_[_0x2db4('0x3b')]({},_0x1745b1,_0x3a484a[_0x2db4('0x3c')]);var _0x1296a9={'where':_0x1745b1[_0x2db4('0x36')]};return db[_0x2db4('0x2a')][_0x2db4('0x1c')](_0x1296a9)[_0x2db4('0x23')](function(_0xc87ea){_0x539189['count']=_0xc87ea;if(_0x3a484a[_0x2db4('0x31')][_0x2db4('0x3d')]){_0x1745b1[_0x2db4('0x3e')]=[{'all':!![]}];}return db['Pause'][_0x2db4('0x3f')](_0x1745b1);})[_0x2db4('0x23')](function(_0x2df1d7){_0x539189['rows']=_0x2df1d7;return _0x539189;})['then'](respondWithFilteredResult(_0x205d99,_0x1745b1))[_0x2db4('0x40')](handleError(_0x205d99,null));};exports[_0x2db4('0x41')]=function(_0x280a02,_0x49ba6c){var _0x302b81={'raw':!![],'where':{'id':_0x280a02['params']['id']}},_0x1ab187={};_0x1ab187['model']=_[_0x2db4('0x30')](db[_0x2db4('0x2a')][_0x2db4('0x2b')]);_0x1ab187[_0x2db4('0x31')]=_[_0x2db4('0x30')](_0x280a02['query']);_0x1ab187['filters']=_[_0x2db4('0x32')](_0x1ab187['model'],_0x1ab187[_0x2db4('0x31')]);_0x302b81[_0x2db4('0x33')]=_[_0x2db4('0x32')](_0x1ab187['model'],qs['fields'](_0x280a02[_0x2db4('0x31')]['fields']));_0x302b81['attributes']=_0x302b81['attributes'][_0x2db4('0x34')]?_0x302b81[_0x2db4('0x33')]:_0x1ab187['model'];if(_0x280a02[_0x2db4('0x31')][_0x2db4('0x3d')]){_0x302b81[_0x2db4('0x3e')]=[{'all':!![]}];}_0x302b81=_['merge']({},_0x302b81,_0x280a02[_0x2db4('0x3c')]);return db[_0x2db4('0x2a')][_0x2db4('0x42')](_0x302b81)[_0x2db4('0x23')](handleEntityNotFound(_0x49ba6c,null))[_0x2db4('0x23')](respondWithResult(_0x49ba6c,null))[_0x2db4('0x40')](handleError(_0x49ba6c,null));};exports[_0x2db4('0x43')]=function(_0x349643,_0x3988a5){return db[_0x2db4('0x2a')][_0x2db4('0x43')](_0x349643[_0x2db4('0x44')],{})[_0x2db4('0x23')](function(_0x5453a3){var _0x53af9e=_0x349643['user'][_0x2db4('0x22')]({'plain':!![]});if(!_0x53af9e)throw new Error(_0x2db4('0x45'));if(_0x53af9e[_0x2db4('0x46')]==='user'){var _0x2103c7=_0x5453a3[_0x2db4('0x22')]({'plain':!![]});var _0x4a2f24=_0x2db4('0x47');return db['UserProfileSection'][_0x2db4('0x42')]({'where':{'name':_0x4a2f24,'userProfileId':_0x53af9e['userProfileId']},'raw':!![]})[_0x2db4('0x23')](function(_0xad2d9f){if(_0xad2d9f&&_0xad2d9f[_0x2db4('0x48')]===0x0){return db['UserProfileResource'][_0x2db4('0x43')]({'name':_0x2103c7[_0x2db4('0x26')],'resourceId':_0x2103c7['id'],'type':_0xad2d9f[_0x2db4('0x26')],'sectionId':_0xad2d9f['id']},{})[_0x2db4('0x23')](function(){return _0x5453a3;});}else{return _0x5453a3;}})[_0x2db4('0x40')](function(_0x1ac056){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ac056);throw _0x1ac056;});}return _0x5453a3;})[_0x2db4('0x23')](respondWithResult(_0x3988a5,0xc9))['catch'](handleError(_0x3988a5,null));};exports[_0x2db4('0x20')]=function(_0x2db69b,_0x16be3a){if(_0x2db69b[_0x2db4('0x44')]['id']){delete _0x2db69b[_0x2db4('0x44')]['id'];}return db[_0x2db4('0x2a')][_0x2db4('0x42')]({'where':{'id':_0x2db69b[_0x2db4('0x49')]['id']}})[_0x2db4('0x23')](handleEntityNotFound(_0x16be3a,null))[_0x2db4('0x23')](saveUpdates(_0x2db69b[_0x2db4('0x44')],null))[_0x2db4('0x23')](respondWithResult(_0x16be3a,null))[_0x2db4('0x40')](handleError(_0x16be3a,null));};exports[_0x2db4('0x21')]=function(_0x50ff62,_0x163b07){return db[_0x2db4('0x2a')][_0x2db4('0x42')]({'where':{'id':_0x50ff62[_0x2db4('0x49')]['id']}})['then'](handleEntityNotFound(_0x163b07,null))[_0x2db4('0x23')](removeEntity(_0x163b07,null))['catch'](handleError(_0x163b07,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5a2aba6..4224529 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','Pause','tools_pauses','lodash','util'];(function(_0x4eefa1,_0x1f5a8b){var _0x468fc2=function(_0xcf9c4e){while(--_0xcf9c4e){_0x4eefa1['push'](_0x4eefa1['shift']());}};_0x468fc2(++_0x1f5a8b);}(_0x5fab,0x177));var _0xb5fa=function(_0x205e56,_0x366e77){_0x205e56=_0x205e56-0x0;var _0x489d5d=_0x5fab[_0x205e56];return _0x489d5d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x3db7ed,_0x569cdc){var _0x496e6c=function(_0x394a6e){while(--_0x394a6e){_0x3db7ed['push'](_0x3db7ed['shift']());}};_0x496e6c(++_0x569cdc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x5fc3[_0x4c260a];return _0x17bbdd;};'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 diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index faae75a..c0e2eca 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(_0x2b8552,_0x8b69a4){var _0x47d3d4=function(_0x3a998e){while(--_0x3a998e){_0x2b8552['push'](_0x2b8552['shift']());}};_0x47d3d4(++_0x8b69a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x1a58a9,_0xe32406){_0x1a58a9=_0x1a58a9-0x0;var _0x45449b=_0xb10b[_0x1a58a9];return _0x45449b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0xfd7137,_0x4c0c39){var _0x755914=function(_0x172fcb){while(--_0x172fcb){_0xfd7137['push'](_0xfd7137['shift']());}};_0x755914(++_0x4c0c39);}(_0x7a54,0x106));var _0x47a5=function(_0xc025a9,_0xb4fa78){_0xc025a9=_0xc025a9-0x0;var _0x57b7fd=_0x7a54[_0xc025a9];return _0x57b7fd;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index ade94d6..f9a38c2 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 _0xb43b=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','/webhook','webhookGet','get','/:id','isAuthenticated','/:id/download','download','diskStorage','join','server/files/plugins','originalname','format','basename','extname','file','webhookPost','put','delete','exports','multer'];(function(_0x352de7,_0x42d665){var _0x76cff2=function(_0x4e9f7c){while(--_0x4e9f7c){_0x352de7['push'](_0x352de7['shift']());}};_0x76cff2(++_0x42d665);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1daefa,_0x1d5822){_0x1daefa=_0x1daefa-0x0;var _0xae5555=_0xb43b[_0x1daefa];return _0xae5555;};'use strict';var multer=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var path=require('path');var timeout=require(_0xbb43('0x2'));var express=require(_0xbb43('0x3'));var router=express[_0xbb43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbb43('0x5'));var interaction=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var controller=require(_0xbb43('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xbb43('0x9')]);router['get'](_0xbb43('0xa'),controller[_0xbb43('0xb')]);router[_0xbb43('0xc')](_0xbb43('0xd'),auth[_0xbb43('0xe')](),controller['show']);router[_0xbb43('0xc')](_0xbb43('0xf'),auth['isAuthenticated'](),controller[_0xbb43('0x10')]);var upload=multer({'storage':multer[_0xbb43('0x11')]({'destination':function(_0xd37cdf,_0x5e3611,_0xfac791){_0xfac791(null,path[_0xbb43('0x12')](config['root'],_0xbb43('0x13')));},'filename':function(_0x2a5a4d,_0x50e2c0,_0x578392){_0x50e2c0[_0xbb43('0x14')]=_0x50e2c0['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x578392(null,util[_0xbb43('0x15')]('%s-%s%s',path[_0xbb43('0x16')](_0x50e2c0[_0xbb43('0x14')],path['extname'](_0x50e2c0['originalname'])),Date['now'](),path[_0xbb43('0x17')](_0x50e2c0[_0xbb43('0x14')])));}})});router['post']('/',upload['single'](_0xbb43('0x18')),controller['upload']);router['post'](_0xbb43('0xa'),controller[_0xbb43('0x19')]);router[_0xbb43('0x1a')]('/:id',auth[_0xbb43('0xe')](),controller['update']);router[_0xbb43('0x1b')](_0xbb43('0xd'),auth['isAuthenticated'](),controller['delete']);module[_0xbb43('0x1c')]=router; \ No newline at end of file +var _0x4fdb=['server/files/plugins','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','/webhook','webhookGet','get','show','/:id/download','download','diskStorage','root'];(function(_0x425b19,_0x2dcf14){var _0x15ecab=function(_0x317d46){while(--_0x317d46){_0x425b19['push'](_0x425b19['shift']());}};_0x15ecab(++_0x2dcf14);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x25fca4,_0xca789c){_0x25fca4=_0x25fca4-0x0;var _0x45aea4=_0x4fdb[_0x25fca4];return _0x45aea4;};'use strict';var multer=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var path=require(_0xb4fd('0x2'));var timeout=require(_0xb4fd('0x3'));var express=require(_0xb4fd('0x4'));var router=express[_0xb4fd('0x5')]();var fs_extra=require(_0xb4fd('0x6'));var auth=require(_0xb4fd('0x7'));var interaction=require(_0xb4fd('0x8'));var config=require('../../config/environment');var controller=require(_0xb4fd('0x9'));router['get']('/',auth[_0xb4fd('0xa')](),controller['index']);router['get'](_0xb4fd('0xb'),controller[_0xb4fd('0xc')]);router[_0xb4fd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xb4fd('0xe')]);router[_0xb4fd('0xd')](_0xb4fd('0xf'),auth['isAuthenticated'](),controller[_0xb4fd('0x10')]);var upload=multer({'storage':multer[_0xb4fd('0x11')]({'destination':function(_0x2148db,_0x23b08f,_0x306bd4){_0x306bd4(null,path['join'](config[_0xb4fd('0x12')],_0xb4fd('0x13')));},'filename':function(_0x2e8ee1,_0x120c2e,_0x5ba7e1){_0x120c2e[_0xb4fd('0x14')]=_0x120c2e[_0xb4fd('0x14')][_0xb4fd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5ba7e1(null,util['format'](_0xb4fd('0x16'),path[_0xb4fd('0x17')](_0x120c2e[_0xb4fd('0x14')],path[_0xb4fd('0x18')](_0x120c2e[_0xb4fd('0x14')])),Date[_0xb4fd('0x19')](),path[_0xb4fd('0x18')](_0x120c2e['originalname'])));}})});router[_0xb4fd('0x1a')]('/',upload[_0xb4fd('0x1b')](_0xb4fd('0x1c')),controller[_0xb4fd('0x1d')]);router[_0xb4fd('0x1a')](_0xb4fd('0xb'),controller[_0xb4fd('0x1e')]);router[_0xb4fd('0x1f')](_0xb4fd('0x20'),auth[_0xb4fd('0xa')](),controller[_0xb4fd('0x21')]);router['delete']('/:id',auth['isAuthenticated'](),controller['delete']);module[_0xb4fd('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d11f78b..55a4e84 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 _0x94ab=['always','sequelize','STRING','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never'];(function(_0x45a6b6,_0x582dbe){var _0x4d0579=function(_0x57a0d9){while(--_0x57a0d9){_0x45a6b6['push'](_0x45a6b6['shift']());}};_0x4d0579(++_0x582dbe);}(_0x94ab,0x137));var _0xb94a=function(_0xbf006e,_0x3ebc52){_0xbf006e=_0xbf006e-0x0;var _0xea96a4=_0x94ab[_0xbf006e];return _0xea96a4;};'use strict';var Sequelize=require(_0xb94a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb94a('0x1')]},'type':{'type':Sequelize['ENUM']('html',_0xb94a('0x2'))},'description':{'type':Sequelize[_0xb94a('0x3')]},'version':{'type':Sequelize[_0xb94a('0x3')]},'path':{'type':Sequelize[_0xb94a('0x1')],'comment':_0xb94a('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb94a('0x5')},'sidebar':{'type':Sequelize['ENUM'](_0xb94a('0x6'),_0xb94a('0x7'),'always',_0xb94a('0x8')),'defaultValue':_0xb94a('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xb94a('0x1')]},'adminUrl':{'type':Sequelize[_0xb94a('0x1')]},'agentUrl':{'type':Sequelize[_0xb94a('0x1')]},'scriptName':{'type':Sequelize[_0xb94a('0x1')]},'scriptPath':{'type':Sequelize[_0xb94a('0x1')]}}; \ No newline at end of file +var _0xa2a1=['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','adminOnly','agentOnly','always','never'];(function(_0x40addd,_0xcbb2ba){var _0x5aacd8=function(_0x289daa){while(--_0x289daa){_0x40addd['push'](_0x40addd['shift']());}};_0x5aacd8(++_0xcbb2ba);}(_0xa2a1,0x16d));var _0x1a2a=function(_0x139f63,_0x172987){_0x139f63=_0x139f63-0x0;var _0x4d9cf9=_0xa2a1[_0x139f63];return _0x4d9cf9;};'use strict';var Sequelize=require(_0x1a2a('0x0'));module[_0x1a2a('0x1')]={'name':{'type':Sequelize[_0x1a2a('0x2')]},'type':{'type':Sequelize[_0x1a2a('0x3')](_0x1a2a('0x4'),_0x1a2a('0x5'))},'description':{'type':Sequelize[_0x1a2a('0x6')]},'version':{'type':Sequelize[_0x1a2a('0x6')]},'path':{'type':Sequelize[_0x1a2a('0x2')],'comment':_0x1a2a('0x7')},'active':{'type':Sequelize[_0x1a2a('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x1a2a('0x3')](_0x1a2a('0x9'),_0x1a2a('0xa'),_0x1a2a('0xb'),_0x1a2a('0xc')),'defaultValue':_0x1a2a('0xb'),'comment':_0x1a2a('0xd')},'icon':{'type':Sequelize[_0x1a2a('0x2')]},'adminUrl':{'type':Sequelize[_0x1a2a('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x1a2a('0x2')]},'scriptPath':{'type':Sequelize[_0x1a2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 4c20100..745d3d4 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 _0x8ce5=['../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','get','Plugins','destroy','end','error','name','send','index','map','Plugin','fieldName','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','always','icon','icon-apps','admin','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','script','test','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','headers','content-length','content-type','endsWith','statusCode','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8ce5,0x134));var _0x58ce=function(_0x55657e,_0xbc6faa){_0x55657e=_0x55657e-0x0;var _0x328a53=_0x8ce5[_0x55657e];return _0x328a53;};'use strict';var emlformat=require(_0x58ce('0x0'));var rimraf=require(_0x58ce('0x1'));var zipdir=require(_0x58ce('0x2'));var jsonpatch=require(_0x58ce('0x3'));var rp=require(_0x58ce('0x4'));var moment=require('moment');var BPromise=require(_0x58ce('0x5'));var Mustache=require('mustache');var util=require(_0x58ce('0x6'));var path=require(_0x58ce('0x7'));var sox=require(_0x58ce('0x8'));var csv=require(_0x58ce('0x9'));var ejs=require(_0x58ce('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x58ce('0xb'));var crypto=require(_0x58ce('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x58ce('0x9'));var querystring=require(_0x58ce('0xd'));var Papa=require(_0x58ce('0xe'));var extract=require(_0x58ce('0xf'));var rimraf=require(_0x58ce('0x1'));var archiver=require(_0x58ce('0x10'));var Redis=require(_0x58ce('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x58ce('0x12'));var as=require(_0x58ce('0x13'));var hardwareService=require(_0x58ce('0x14'));var logger=require(_0x58ce('0x15'))('api');var utils=require(_0x58ce('0x16'));var config=require(_0x58ce('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x58ce('0x18'))['db'];config[_0x58ce('0x19')]=_[_0x58ce('0x1a')](config[_0x58ce('0x19')],{'host':_0x58ce('0x1b'),'port':0x18eb});var socket=require(_0x58ce('0x1c'))(new Redis(config[_0x58ce('0x19')]));require(_0x58ce('0x1d'))['register'](socket);function respondWithStatusCode(_0x2e428b,_0x246409){_0x246409=_0x246409||0xcc;return function(_0x2241a7){if(_0x2241a7){return _0x2e428b[_0x58ce('0x1e')](_0x246409);}return _0x2e428b[_0x58ce('0x1f')](_0x246409)['end']();};}function respondWithResult(_0x2758d3,_0x4a775d){_0x4a775d=_0x4a775d||0xc8;return function(_0x395166){if(_0x395166){return _0x2758d3[_0x58ce('0x1f')](_0x4a775d)[_0x58ce('0x20')](_0x395166);}};}function respondWithFilteredResult(_0x5a5c8b,_0x4f71fb){return function(_0x18c724){if(_0x18c724){var _0x4832ed=typeof _0x4f71fb['offset']===_0x58ce('0x21')&&typeof _0x4f71fb['limit']===_0x58ce('0x21');var _0x20255f=_0x18c724[_0x58ce('0x22')];var _0x597ade=_0x4832ed?0x0:_0x4f71fb[_0x58ce('0x23')];var _0x419a34=_0x4832ed?_0x18c724[_0x58ce('0x22')]:_0x4f71fb['offset']+_0x4f71fb[_0x58ce('0x24')];var _0x23897d;if(_0x419a34>=_0x20255f){_0x419a34=_0x20255f;_0x23897d=0xc8;}else{_0x23897d=0xce;}_0x5a5c8b['status'](_0x23897d);return _0x5a5c8b[_0x58ce('0x25')](_0x58ce('0x26'),_0x597ade+'-'+_0x419a34+'/'+_0x20255f)[_0x58ce('0x20')](_0x18c724);}return null;};}function patchUpdates(_0x5192b5){return function(_0x2147d4){try{jsonpatch[_0x58ce('0x27')](_0x2147d4,_0x5192b5,!![]);}catch(_0x20e7bb){return BPromise[_0x58ce('0x28')](_0x20e7bb);}return _0x2147d4['save']();};}function saveUpdates(_0x439245,_0x48ff38){return function(_0x149ea2){if(_0x149ea2){return _0x149ea2['update'](_0x439245)[_0x58ce('0x29')](function(_0x37f109){return _0x37f109;});}return null;};}function removeEntity(_0x6b632b,_0x2b4812){return function(_0x9fb7f2){if(_0x9fb7f2){return _0x9fb7f2['destroy']()[_0x58ce('0x29')](function(){var _0x32974b=_0x9fb7f2[_0x58ce('0x2a')]({'plain':!![]});var _0x1220fc=_0x58ce('0x2b');return db['UserProfileResource'][_0x58ce('0x2c')]({'where':{'type':_0x1220fc,'resourceId':_0x32974b['id']}})[_0x58ce('0x29')](function(){return _0x9fb7f2;});})['then'](function(){_0x6b632b[_0x58ce('0x1f')](0xcc)[_0x58ce('0x2d')]();});}};}function handleEntityNotFound(_0x393702,_0x215051){return function(_0x46e270){if(!_0x46e270){_0x393702[_0x58ce('0x1e')](0x194);}return _0x46e270;};}function handleError(_0x48ea56,_0x4ac686){_0x4ac686=_0x4ac686||0x1f4;return function(_0x36e0d9){logger[_0x58ce('0x2e')](_0x36e0d9['stack']);if(_0x36e0d9[_0x58ce('0x2f')]){delete _0x36e0d9[_0x58ce('0x2f')];}_0x48ea56[_0x58ce('0x1f')](_0x4ac686)[_0x58ce('0x30')](_0x36e0d9);};}exports[_0x58ce('0x31')]=function(_0x1fc6ef,_0x37bd24){var _0xaf04ca={},_0x5259da={},_0x44a49f={'count':0x0,'rows':[]};var _0x35c87e=_[_0x58ce('0x32')](db[_0x58ce('0x33')]['rawAttributes'],function(_0x291dbe){return{'name':_0x291dbe[_0x58ce('0x34')],'type':_0x291dbe['type']['key']};});_0x5259da[_0x58ce('0x35')]=_[_0x58ce('0x32')](_0x35c87e,'name');_0x5259da['query']=_[_0x58ce('0x36')](_0x1fc6ef['query']);_0x5259da[_0x58ce('0x37')]=_[_0x58ce('0x38')](_0x5259da['model'],_0x5259da[_0x58ce('0x39')]);_0xaf04ca[_0x58ce('0x3a')]=_[_0x58ce('0x38')](_0x5259da['model'],qs['fields'](_0x1fc6ef[_0x58ce('0x39')][_0x58ce('0x3b')]));_0xaf04ca[_0x58ce('0x3a')]=_0xaf04ca[_0x58ce('0x3a')][_0x58ce('0x3c')]?_0xaf04ca['attributes']:_0x5259da[_0x58ce('0x35')];if(!_0x1fc6ef['query']['hasOwnProperty'](_0x58ce('0x3d'))){_0xaf04ca[_0x58ce('0x24')]=qs[_0x58ce('0x24')](_0x1fc6ef[_0x58ce('0x39')][_0x58ce('0x24')]);_0xaf04ca[_0x58ce('0x23')]=qs['offset'](_0x1fc6ef[_0x58ce('0x39')]['offset']);}_0xaf04ca[_0x58ce('0x3e')]=qs[_0x58ce('0x3f')](_0x1fc6ef[_0x58ce('0x39')][_0x58ce('0x3f')]);_0xaf04ca['where']=qs['filters'](_['pick'](_0x1fc6ef['query'],_0x5259da[_0x58ce('0x37')]),_0x35c87e);if(_0x1fc6ef['query'][_0x58ce('0x40')]){_0xaf04ca[_0x58ce('0x41')]=_[_0x58ce('0x42')](_0xaf04ca[_0x58ce('0x41')],{'$or':_['map'](_0x35c87e,function(_0x444003){if(_0x444003[_0x58ce('0x43')]!==_0x58ce('0x44')){var _0x41ab3b={};_0x41ab3b[_0x444003[_0x58ce('0x2f')]]={'$like':'%'+_0x1fc6ef['query'][_0x58ce('0x40')]+'%'};return _0x41ab3b;}})});}_0xaf04ca=_['merge']({},_0xaf04ca,_0x1fc6ef[_0x58ce('0x45')]);var _0x2bbad1={'where':_0xaf04ca[_0x58ce('0x41')]};return db['Plugin'][_0x58ce('0x22')](_0x2bbad1)[_0x58ce('0x29')](function(_0x203487){_0x44a49f['count']=_0x203487;if(_0x1fc6ef['query'][_0x58ce('0x46')]){_0xaf04ca[_0x58ce('0x47')]=[{'all':!![]}];}return db[_0x58ce('0x33')][_0x58ce('0x48')](_0xaf04ca);})['then'](function(_0x5c98d6){_0x44a49f[_0x58ce('0x49')]=_0x5c98d6;return _0x44a49f;})[_0x58ce('0x29')](respondWithFilteredResult(_0x37bd24,_0xaf04ca))[_0x58ce('0x4a')](handleError(_0x37bd24,null));};exports[_0x58ce('0x4b')]=function(_0xfd0c9c,_0x441086){var _0x3f4803={'raw':!![],'where':{'id':_0xfd0c9c[_0x58ce('0x4c')]['id']}},_0x6c1aa9={};_0x6c1aa9[_0x58ce('0x35')]=_[_0x58ce('0x36')](db['Plugin']['rawAttributes']);_0x6c1aa9[_0x58ce('0x39')]=_[_0x58ce('0x36')](_0xfd0c9c[_0x58ce('0x39')]);_0x6c1aa9[_0x58ce('0x37')]=_['intersection'](_0x6c1aa9['model'],_0x6c1aa9[_0x58ce('0x39')]);_0x3f4803[_0x58ce('0x3a')]=_[_0x58ce('0x38')](_0x6c1aa9['model'],qs['fields'](_0xfd0c9c[_0x58ce('0x39')]['fields']));_0x3f4803[_0x58ce('0x3a')]=_0x3f4803[_0x58ce('0x3a')][_0x58ce('0x3c')]?_0x3f4803['attributes']:_0x6c1aa9[_0x58ce('0x35')];if(_0xfd0c9c['query'][_0x58ce('0x46')]){_0x3f4803[_0x58ce('0x47')]=[{'all':!![]}];}_0x3f4803=_[_0x58ce('0x42')]({},_0x3f4803,_0xfd0c9c['options']);return db[_0x58ce('0x33')][_0x58ce('0x4d')](_0x3f4803)[_0x58ce('0x29')](handleEntityNotFound(_0x441086,null))[_0x58ce('0x29')](respondWithResult(_0x441086,null))[_0x58ce('0x4a')](handleError(_0x441086,null));};exports[_0x58ce('0x4e')]=function(_0x476c6a,_0x281cd3,_0x468dc6){return db[_0x58ce('0x33')][_0x58ce('0x4d')]({'where':{'id':_0x476c6a['params']['id']},'attributes':[_0x58ce('0x2f'),'path'],'raw':!![]})[_0x58ce('0x29')](handleEntityNotFound(_0x281cd3,null))[_0x58ce('0x29')](function(_0x4c3c70){if(_0x4c3c70){var _0x4ce14e=path[_0x58ce('0x4f')](config[_0x58ce('0x50')],_0x58ce('0x51'),util[_0x58ce('0x52')](_0x58ce('0x53'),path[_0x58ce('0x54')](_0x4c3c70[_0x58ce('0x7')])));var _0x4339a8=fs[_0x58ce('0x55')](_0x4ce14e);var _0x4df040=archiver('zip',{'zlib':{'level':0x9}});_0x4df040['on'](_0x58ce('0x56'),function(_0x37ff61){if(_0x37ff61[_0x58ce('0x57')]===_0x58ce('0x58')){logger[_0x58ce('0x2e')](_0x37ff61);}else{throw new db['Sequelize']['Error'](_0x58ce('0x59'));}});_0x4df040['on'](_0x58ce('0x2e'),function(_0x56083b){throw new db[(_0x58ce('0x5a'))][(_0x58ce('0x5b'))](_0x58ce('0x59'));});_0x4df040[_0x58ce('0x5c')](_0x4339a8);_0x4df040[_0x58ce('0x5d')](_0x58ce('0x5e'),{'cwd':path['join'](config['root'],_0x58ce('0x51'),path[_0x58ce('0x5f')](_0x4c3c70[_0x58ce('0x7')])),'ignore':[path[_0x58ce('0x4f')](path['basename'](_0x4c3c70[_0x58ce('0x7')]),_0x58ce('0x60')),path['join'](path[_0x58ce('0x54')](_0x4c3c70[_0x58ce('0x7')]),_0x58ce('0x61'))],'nodir':!![]})[_0x58ce('0x62')]();_0x4339a8['on'](_0x58ce('0x63'),function(){if(!fs[_0x58ce('0x64')](_0x4ce14e)){throw new db[(_0x58ce('0x5a'))][(_0x58ce('0x5b'))](_0x58ce('0x65'));}return _0x281cd3['download'](_0x4ce14e,util[_0x58ce('0x52')]('%s.zip',path['basename'](_0x4c3c70['path'])),function(_0x4c8fe8){if(_0x4c8fe8){throw new db[(_0x58ce('0x5a'))]['Error'](_0x58ce('0x66'));}fs[_0x58ce('0x67')](_0x4ce14e);logger['info'](_0x58ce('0x68'));logger[_0x58ce('0x69')](_0x58ce('0x6a'));});});}return null;})[_0x58ce('0x4a')](handleError(_0x281cd3,null));};exports['upload']=function(_0x13c393,_0x56b46f,_0x2dbb3b){var _0x4afd6e=path[_0x58ce('0x54')](_0x13c393['file'][_0x58ce('0x6b')],path[_0x58ce('0x6c')](_0x13c393[_0x58ce('0x6d')][_0x58ce('0x6b')]));var _0x10dbda=path[_0x58ce('0x4f')](config[_0x58ce('0x50')],'server/files/plugins',_0x13c393[_0x58ce('0x6d')][_0x58ce('0x6b')]);var _0x362c8d=path[_0x58ce('0x4f')](config[_0x58ce('0x50')],_0x58ce('0x51'),_0x4afd6e);logger[_0x58ce('0x69')](_0x58ce('0x6e'),_0x10dbda);logger['info'](_0x58ce('0x6f'),_0x362c8d);try{fs[_0x58ce('0x70')](_0x10dbda,parseInt(_0x58ce('0x71'),0x8));extract(_0x10dbda,{'dir':_0x362c8d},function(_0xbe2d95){if(_0xbe2d95){logger['error'](_0xbe2d95);handleError(_0xbe2d95,!![]);};var _0x3d9f7a=fs[_0x58ce('0x72')](_0x362c8d);if(_0x3d9f7a['length']>0x1){removeReferences(_0x10dbda,_0x362c8d);logger[_0x58ce('0x2e')]('Invalid\x20plugin\x20structure');return _0x2dbb3b(new Error(_0x58ce('0x73')));}var _0x2b073b=fs[_0x58ce('0x74')](path[_0x58ce('0x4f')](_0x362c8d,_0x3d9f7a[0x0]));if(_0x2b073b['isFile']()){removeReferences(_0x10dbda,_0x362c8d);logger[_0x58ce('0x2e')](_0x58ce('0x73'));return _0x2dbb3b(new Error(_0x58ce('0x73')));}if(_0x2b073b[_0x58ce('0x75')]()){var _0x4253a4=fs['readdirSync'](path[_0x58ce('0x4f')](_0x362c8d,_0x3d9f7a[0x0]));if(_0x4253a4[_0x58ce('0x3c')]===0x0){removeReferences(_0x10dbda,_0x362c8d);logger[_0x58ce('0x2e')](_0x58ce('0x73'));return _0x2dbb3b(new Error(_0x58ce('0x73')));}var _0x16eb8d=_0x4253a4['some'](function(_0x1db2c9){return _0x1db2c9==='manifest.json';});if(!_0x16eb8d){return _0x2dbb3b(new Error(_0x58ce('0x76')));}var _0x1907f6=fs[_0x58ce('0x77')](path[_0x58ce('0x4f')](_0x362c8d,_0x3d9f7a[0x0],_0x58ce('0x78')));var _0x1b78a3=JSON['parse'](_0x1907f6);if('undefined'==typeof _0x1b78a3['name']){return _0x2dbb3b(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x58ce('0x21')==typeof _0x1b78a3[_0x58ce('0x43')]){return _0x2dbb3b(new Error(_0x58ce('0x79')));}if(_0x58ce('0x21')==typeof _0x1b78a3[_0x58ce('0x7a')]){return _0x2dbb3b(new Error(_0x58ce('0x7b')));}if(_0x58ce('0x21')==typeof _0x1b78a3[_0x58ce('0x7c')]){return _0x2dbb3b(new Error(_0x58ce('0x7d')));}if(_0x1b78a3[_0x58ce('0x43')]===_0x58ce('0x7e')){if(_0x58ce('0x21')==typeof _0x1b78a3['parameters'][_0x58ce('0x7f')]){return _0x2dbb3b(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x58ce('0x21')==typeof _0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x7f')]['admin']&&_0x58ce('0x21')==typeof _0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x7f')]['agent']){return _0x2dbb3b(new Error(_0x58ce('0x80')));}}else if(_0x1b78a3[_0x58ce('0x43')]==='script'){if('undefined'==typeof _0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x81')]){return _0x2dbb3b(new Error(_0x58ce('0x82')));}if(_0x58ce('0x21')==typeof _0x1b78a3[_0x58ce('0x7c')]['scriptPath']){return _0x2dbb3b(new Error(_0x58ce('0x83')));}}else{return _0x2dbb3b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1a4951=_0x1b78a3[_0x58ce('0x2f')];var _0x44a992=_0x1b78a3['description'];var _0x300f6c=_0x1b78a3[_0x58ce('0x43')];var _0x24ed76=_0x1b78a3['sidebar']?_0x1b78a3['sidebar']:_0x58ce('0x84');var _0x582198=_0x1b78a3[_0x58ce('0x85')]?_0x1b78a3['icon']:_0x58ce('0x86');var _0x6518bb='';var _0x3d7c9d='';var _0xc3fce3='';var _0x41dbc5='';var _0x26e8f7=_0x1b78a3['version'];if(_0x300f6c===_0x58ce('0x7e')){if(_0x58ce('0x21')!=typeof _0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x7f')][_0x58ce('0x87')]){var _0x509a43=_0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x509a43)){_0x6518bb=path[_0x58ce('0x4f')]('plugins',_0x4afd6e,_0x3d9f7a[0x0],_0x509a43);}else{_0x6518bb=_0x509a43;}}else{logger['info'](_0x58ce('0x88'));}if('undefined'!=typeof _0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x7f')][_0x58ce('0x89')]){var _0x10149f=_0x1b78a3['parameters'][_0x58ce('0x7f')][_0x58ce('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x10149f)){_0x3d7c9d=path['join'](_0x58ce('0x8a'),_0x4afd6e,_0x3d9f7a[0x0],_0x10149f);}else{_0x3d7c9d=_0x10149f;}}else{logger[_0x58ce('0x69')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x300f6c===_0x58ce('0x8b')){_0xc3fce3=_0x1b78a3['parameters']['scriptName'];_0x41dbc5=_0x1b78a3[_0x58ce('0x7c')]['scriptPath'];if(_0x58ce('0x21')!=typeof _0x1b78a3[_0x58ce('0x7c')][_0x58ce('0x7f')]){if(_0x58ce('0x21')!=typeof _0x1b78a3['parameters'][_0x58ce('0x7f')][_0x58ce('0x87')]){var _0x509a43=_0x1b78a3[_0x58ce('0x7c')]['views'][_0x58ce('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x58ce('0x8c')](_0x509a43)){_0x6518bb=path[_0x58ce('0x4f')](_0x58ce('0x8a'),_0x4afd6e,_0x3d9f7a[0x0],_0x509a43);}else{_0x6518bb=_0x509a43;}}if('undefined'!=typeof _0x1b78a3['parameters'][_0x58ce('0x7f')][_0x58ce('0x89')]){var _0x10149f=_0x1b78a3[_0x58ce('0x7c')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x10149f)){_0x3d7c9d=path[_0x58ce('0x4f')](_0x58ce('0x8a'),_0x4afd6e,_0x3d9f7a[0x0],_0x10149f);}else{_0x3d7c9d=_0x10149f;}}}}var _0x3ab3c1={'name':_0x1a4951,'description':_0x44a992,'path':path[_0x58ce('0x4f')](_0x4afd6e,_0x3d9f7a[0x0]),'type':_0x300f6c,'sidebar':_0x24ed76,'icon':_0x582198,'adminUrl':_0x6518bb,'agentUrl':_0x3d7c9d,'scriptName':_0xc3fce3,'scriptPath':_0x41dbc5,'version':_0x26e8f7};removeReferences(_0x10dbda,null);return db[_0x58ce('0x33')][_0x58ce('0x8d')](_0x3ab3c1)[_0x58ce('0x29')](function(_0x2052e9){var _0x5c9cfc={'role':_0x13c393[_0x58ce('0x8e')]['role'],'userProfileId':_0x13c393[_0x58ce('0x8e')][_0x58ce('0x8f')]};if(!_0x5c9cfc)throw new Error(_0x58ce('0x90'));if(_0x5c9cfc[_0x58ce('0x91')]===_0x58ce('0x92')){var _0x13ff45=_0x2052e9[_0x58ce('0x2a')]({'plain':!![]});return db[_0x58ce('0x93')][_0x58ce('0x4d')]({'where':{'name':_0x58ce('0x2b'),'userProfileId':_0x5c9cfc['userProfileId']},'raw':!![]})['then'](function(_0x3cacd3){if(_0x3cacd3&&_0x3cacd3[_0x58ce('0x94')]===0x0){return db['UserProfileResource']['create']({'name':_0x13ff45[_0x58ce('0x2f')],'resourceId':_0x13ff45['id'],'type':_0x3cacd3[_0x58ce('0x2f')],'sectionId':_0x3cacd3['id']},{})[_0x58ce('0x29')](function(){return _0x2052e9;});}else{return _0x2052e9;}})['catch'](function(_0x201fa0){logger[_0x58ce('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x201fa0);throw _0x201fa0;});}return _0x2052e9;})['then'](respondWithResult(_0x56b46f,null))['catch'](handleError(_0x56b46f,null));}});}catch(_0x34689e){_0x56b46f[_0x58ce('0x1f')](0x1f4)[_0x58ce('0x30')](_0x34689e);}};function removeReferences(_0x4b159c,_0x2205a9){try{if(_0x4b159c){fs[_0x58ce('0x67')](_0x4b159c);logger['info'](_0x58ce('0x95'));}if(_0x2205a9){rimraf(_0x2205a9,function(){});logger[_0x58ce('0x69')]('Extracted\x20folder\x20removed');}}catch(_0x282b4a){logger[_0x58ce('0x2e')](_0x282b4a);}}exports['update']=function(_0x46419c,_0x144a7a,_0xa8397){return db[_0x58ce('0x33')]['find']({'where':{'id':_0x46419c['params']['id']}})['then'](handleEntityNotFound(_0x144a7a,null))[_0x58ce('0x29')](saveUpdates(_0x46419c[_0x58ce('0x8e')],null))[_0x58ce('0x29')](respondWithResult(_0x144a7a,null))[_0x58ce('0x4a')](handleError(_0x144a7a,null));};exports[_0x58ce('0x96')]=function(_0x4f949b,_0x399c46,_0x45726b){return db[_0x58ce('0x33')][_0x58ce('0x4d')]({'where':{'id':_0x4f949b[_0x58ce('0x4c')]['id']}})[_0x58ce('0x29')](function(_0x3b89a7){if(_0x3b89a7){return _0x3b89a7[_0x58ce('0x2c')]();}})[_0x58ce('0x29')](function(_0x1799ed){rimraf(path[_0x58ce('0x4f')](config['root'],_0x58ce('0x51'),path[_0x58ce('0x5f')](_0x1799ed[_0x58ce('0x7')])),function(){});return _0x1799ed;})[_0x58ce('0x29')](handleEntityNotFound(_0x399c46,null))[_0x58ce('0x29')](respondWithStatusCode(_0x399c46,null))[_0x58ce('0x4a')](handleError(_0x399c46,null));};exports[_0x58ce('0x97')]=function(_0x48fb24,_0x1e8966,_0xb8a9a){return BPromise[_0x58ce('0x98')]()[_0x58ce('0x29')](function(){if(!_0x48fb24[_0x58ce('0x39')][_0x58ce('0x7')]){throw new Error(_0x58ce('0x99'));}if(!_0x48fb24['query'][_0x58ce('0x9a')]){throw new Error(_0x58ce('0x9b'));}var _0x1bc3c4=_0x48fb24[_0x58ce('0x39')][_0x58ce('0x9c')]?_0x48fb24[_0x58ce('0x39')]['hostname']+':'+_0x48fb24[_0x58ce('0x39')][_0x58ce('0x9a')]:'http://localhost:'+_0x48fb24['query']['port'];var _0x40d08a=_0x48fb24[_0x58ce('0x39')][_0x58ce('0x20')]?_0x48fb24[_0x58ce('0x39')]['json']:!![];var _0x1c3927=_0x48fb24[_0x58ce('0x39')]['encoding']?_0x48fb24[_0x58ce('0x39')][_0x58ce('0x9d')]:null;var _0x106b53={'method':_0x48fb24[_0x58ce('0x9e')],'uri':util[_0x58ce('0x52')]('%s%s',_0x1bc3c4,_0x48fb24[_0x58ce('0x39')][_0x58ce('0x7')]),'json':_0x40d08a,'resolveWithFullResponse':!![],'encoding':_0x1c3927,'qs':_0x48fb24[_0x58ce('0x39')]};if(_0x48fb24[_0x58ce('0x9f')]){_0x106b53[_0x58ce('0x9f')]=_0x48fb24[_0x58ce('0x9f')];if(_0x106b53[_0x58ce('0x9f')]['content-length']){delete _0x106b53[_0x58ce('0x9f')][_0x58ce('0xa0')];}}if(_0x106b53[_0x58ce('0x9f')][_0x58ce('0xa1')]){delete _0x106b53['headers'][_0x58ce('0xa1')];}return rp(_0x106b53);})['then'](function(_0x16cebc){if(_0x16cebc){_0x1e8966['set'](_0x16cebc[_0x58ce('0x9f')]);logger[_0x58ce('0x69')](_0x16cebc[_0x58ce('0x8e')]);if(_[_0x58ce('0xa2')](_0x48fb24[_0x58ce('0x39')][_0x58ce('0x7')],_0x58ce('0x4e'))&&_0x16cebc[_0x58ce('0xa3')]==0x1f4){return _0x1e8966[_0x58ce('0x1e')](_0x16cebc[_0x58ce('0xa3')]);}else{return _0x1e8966[_0x58ce('0x1f')](_0x16cebc[_0x58ce('0xa3')])['send'](_0x16cebc[_0x58ce('0x8e')]);}}else{return _0x1e8966[_0x58ce('0x1e')](0xc8);}})[_0x58ce('0x4a')](handleError(_0x1e8966,null));};exports['webhookPost']=function(_0x4d86e7,_0x35c840,_0xfb541a){return BPromise[_0x58ce('0x98')]()['then'](function(){if(!_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x7')]){throw new Error(_0x58ce('0x99'));}if(!_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x27385d=_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x9c')]?_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x9c')]+':'+_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x9a')]:'http://localhost:'+_0x4d86e7['query']['port'];var _0xbd15a3=_0x4d86e7['query'][_0x58ce('0x20')]?_0x4d86e7['query'][_0x58ce('0x20')]:!![];var _0x1e6fa5=_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x9d')]?_0x4d86e7['query'][_0x58ce('0x9d')]:null;var _0x4dd88f={'method':_0x4d86e7[_0x58ce('0x9e')],'uri':util['format'](_0x58ce('0xa4'),_0x27385d,_0x4d86e7[_0x58ce('0x39')][_0x58ce('0x7')]),'json':_0xbd15a3,'resolveWithFullResponse':!![],'encoding':_0x1e6fa5,'body':_0x4d86e7[_0x58ce('0x8e')]};if(_0x4d86e7[_0x58ce('0x9f')]){_0x4dd88f[_0x58ce('0x9f')]=_0x4d86e7[_0x58ce('0x9f')];if(_0x4dd88f['headers']['content-length']){delete _0x4dd88f[_0x58ce('0x9f')][_0x58ce('0xa0')];}}if(_0x4dd88f[_0x58ce('0x9f')][_0x58ce('0xa1')]){delete _0x4dd88f[_0x58ce('0x9f')][_0x58ce('0xa1')];}return rp(_0x4dd88f);})[_0x58ce('0x29')](function(_0x454672){if(_0x454672){_0x35c840[_0x58ce('0x25')](_0x454672['headers']);logger[_0x58ce('0x69')](_0x454672[_0x58ce('0x8e')]);return _0x35c840[_0x58ce('0x1f')](_0x454672[_0x58ce('0xa3')])[_0x58ce('0x30')](_0x454672['body']);}else{return _0x35c840[_0x58ce('0x1e')](0xc8);}})[_0x58ce('0x4a')](handleError(_0x35c840,null));}; \ No newline at end of file +var _0xb917=['Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','views','parameters','admin','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','http://localhost:','content-type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','Plugins','UserProfileResource','destroy','error','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','fields','find','catch','download','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','dirname','attachments/**/*','finalize','close','existsSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb917,0xf6));var _0x7b91=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb917[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7b91('0x0'));var rimraf=require(_0x7b91('0x1'));var zipdir=require(_0x7b91('0x2'));var jsonpatch=require(_0x7b91('0x3'));var rp=require(_0x7b91('0x4'));var moment=require(_0x7b91('0x5'));var BPromise=require(_0x7b91('0x6'));var Mustache=require(_0x7b91('0x7'));var util=require(_0x7b91('0x8'));var path=require('path');var sox=require(_0x7b91('0x9'));var csv=require(_0x7b91('0xa'));var ejs=require(_0x7b91('0xb'));var fs=require('fs');var fs_extra=require(_0x7b91('0xc'));var _=require(_0x7b91('0xd'));var squel=require(_0x7b91('0xe'));var crypto=require(_0x7b91('0xf'));var jsforce=require(_0x7b91('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7b91('0xa'));var querystring=require(_0x7b91('0x11'));var Papa=require(_0x7b91('0x12'));var extract=require(_0x7b91('0x13'));var rimraf=require(_0x7b91('0x1'));var archiver=require(_0x7b91('0x14'));var Redis=require(_0x7b91('0x15'));var authService=require(_0x7b91('0x16'));var qs=require(_0x7b91('0x17'));var as=require(_0x7b91('0x18'));var hardwareService=require(_0x7b91('0x19'));var logger=require('../../config/logger')(_0x7b91('0x1a'));var utils=require(_0x7b91('0x1b'));var config=require(_0x7b91('0x1c'));var licenseUtil=require(_0x7b91('0x1d'));var db=require('../../mysqldb')['db'];config[_0x7b91('0x1e')]=_[_0x7b91('0x1f')](config[_0x7b91('0x1e')],{'host':_0x7b91('0x20'),'port':0x18eb});var socket=require(_0x7b91('0x21'))(new Redis(config[_0x7b91('0x1e')]));require(_0x7b91('0x22'))['register'](socket);function respondWithStatusCode(_0x4a39e7,_0x235238){_0x235238=_0x235238||0xcc;return function(_0x4730fe){if(_0x4730fe){return _0x4a39e7[_0x7b91('0x23')](_0x235238);}return _0x4a39e7[_0x7b91('0x24')](_0x235238)[_0x7b91('0x25')]();};}function respondWithResult(_0x535fb8,_0x3477ab){_0x3477ab=_0x3477ab||0xc8;return function(_0x3d373e){if(_0x3d373e){return _0x535fb8['status'](_0x3477ab)[_0x7b91('0x26')](_0x3d373e);}};}function respondWithFilteredResult(_0x182b4a,_0x51df9f){return function(_0x1fe2d0){if(_0x1fe2d0){var _0x499966=typeof _0x51df9f[_0x7b91('0x27')]==='undefined'&&typeof _0x51df9f[_0x7b91('0x28')]==='undefined';var _0x58c283=_0x1fe2d0[_0x7b91('0x29')];var _0x20bb56=_0x499966?0x0:_0x51df9f[_0x7b91('0x27')];var _0x86b926=_0x499966?_0x1fe2d0['count']:_0x51df9f[_0x7b91('0x27')]+_0x51df9f['limit'];var _0x2f6ee1;if(_0x86b926>=_0x58c283){_0x86b926=_0x58c283;_0x2f6ee1=0xc8;}else{_0x2f6ee1=0xce;}_0x182b4a[_0x7b91('0x24')](_0x2f6ee1);return _0x182b4a[_0x7b91('0x2a')](_0x7b91('0x2b'),_0x20bb56+'-'+_0x86b926+'/'+_0x58c283)['json'](_0x1fe2d0);}return null;};}function patchUpdates(_0x3f82ef){return function(_0x425083){try{jsonpatch[_0x7b91('0x2c')](_0x425083,_0x3f82ef,!![]);}catch(_0x47adfe){return BPromise[_0x7b91('0x2d')](_0x47adfe);}return _0x425083[_0x7b91('0x2e')]();};}function saveUpdates(_0x13d784,_0x191fa4){return function(_0x367414){if(_0x367414){return _0x367414[_0x7b91('0x2f')](_0x13d784)[_0x7b91('0x30')](function(_0x3f1ba6){return _0x3f1ba6;});}return null;};}function removeEntity(_0x2ec7ec,_0x3899d7){return function(_0x20f804){if(_0x20f804){return _0x20f804['destroy']()[_0x7b91('0x30')](function(){var _0x2e0dad=_0x20f804['get']({'plain':!![]});var _0x3ef53a=_0x7b91('0x31');return db[_0x7b91('0x32')][_0x7b91('0x33')]({'where':{'type':_0x3ef53a,'resourceId':_0x2e0dad['id']}})[_0x7b91('0x30')](function(){return _0x20f804;});})[_0x7b91('0x30')](function(){_0x2ec7ec['status'](0xcc)[_0x7b91('0x25')]();});}};}function handleEntityNotFound(_0x18531c,_0x19daa9){return function(_0x5c5729){if(!_0x5c5729){_0x18531c[_0x7b91('0x23')](0x194);}return _0x5c5729;};}function handleError(_0x5c3e96,_0x357276){_0x357276=_0x357276||0x1f4;return function(_0x2b483f){logger[_0x7b91('0x34')](_0x2b483f['stack']);if(_0x2b483f[_0x7b91('0x35')]){delete _0x2b483f[_0x7b91('0x35')];}_0x5c3e96['status'](_0x357276)[_0x7b91('0x36')](_0x2b483f);};}exports[_0x7b91('0x37')]=function(_0x552e43,_0x17e081){var _0x10cc4a={},_0x170210={},_0x216629={'count':0x0,'rows':[]};var _0x54aaab=_['map'](db[_0x7b91('0x38')][_0x7b91('0x39')],function(_0xa29766){return{'name':_0xa29766[_0x7b91('0x3a')],'type':_0xa29766[_0x7b91('0x3b')][_0x7b91('0x3c')]};});_0x170210[_0x7b91('0x3d')]=_[_0x7b91('0x3e')](_0x54aaab,_0x7b91('0x35'));_0x170210['query']=_[_0x7b91('0x3f')](_0x552e43[_0x7b91('0x40')]);_0x170210[_0x7b91('0x41')]=_[_0x7b91('0x42')](_0x170210[_0x7b91('0x3d')],_0x170210['query']);_0x10cc4a[_0x7b91('0x43')]=_[_0x7b91('0x42')](_0x170210[_0x7b91('0x3d')],qs['fields'](_0x552e43['query']['fields']));_0x10cc4a[_0x7b91('0x43')]=_0x10cc4a['attributes'][_0x7b91('0x44')]?_0x10cc4a[_0x7b91('0x43')]:_0x170210['model'];if(!_0x552e43[_0x7b91('0x40')][_0x7b91('0x45')](_0x7b91('0x46'))){_0x10cc4a['limit']=qs[_0x7b91('0x28')](_0x552e43[_0x7b91('0x40')][_0x7b91('0x28')]);_0x10cc4a[_0x7b91('0x27')]=qs[_0x7b91('0x27')](_0x552e43['query'][_0x7b91('0x27')]);}_0x10cc4a[_0x7b91('0x47')]=qs[_0x7b91('0x48')](_0x552e43['query'][_0x7b91('0x48')]);_0x10cc4a[_0x7b91('0x49')]=qs[_0x7b91('0x41')](_['pick'](_0x552e43[_0x7b91('0x40')],_0x170210[_0x7b91('0x41')]),_0x54aaab);if(_0x552e43[_0x7b91('0x40')][_0x7b91('0x4a')]){_0x10cc4a[_0x7b91('0x49')]=_['merge'](_0x10cc4a[_0x7b91('0x49')],{'$or':_[_0x7b91('0x3e')](_0x54aaab,function(_0x22cf31){if(_0x22cf31[_0x7b91('0x3b')]!=='VIRTUAL'){var _0x281b58={};_0x281b58[_0x22cf31['name']]={'$like':'%'+_0x552e43['query'][_0x7b91('0x4a')]+'%'};return _0x281b58;}})});}_0x10cc4a=_[_0x7b91('0x4b')]({},_0x10cc4a,_0x552e43[_0x7b91('0x4c')]);var _0x3b39a7={'where':_0x10cc4a[_0x7b91('0x49')]};return db[_0x7b91('0x38')]['count'](_0x3b39a7)[_0x7b91('0x30')](function(_0x4f69c7){_0x216629['count']=_0x4f69c7;if(_0x552e43[_0x7b91('0x40')][_0x7b91('0x4d')]){_0x10cc4a[_0x7b91('0x4e')]=[{'all':!![]}];}return db[_0x7b91('0x38')]['findAll'](_0x10cc4a);})[_0x7b91('0x30')](function(_0x3c057f){_0x216629[_0x7b91('0x4f')]=_0x3c057f;return _0x216629;})[_0x7b91('0x30')](respondWithFilteredResult(_0x17e081,_0x10cc4a))['catch'](handleError(_0x17e081,null));};exports[_0x7b91('0x50')]=function(_0x337ea2,_0x481989){var _0x3931d6={'raw':!![],'where':{'id':_0x337ea2[_0x7b91('0x51')]['id']}},_0x458f95={};_0x458f95['model']=_[_0x7b91('0x3f')](db['Plugin']['rawAttributes']);_0x458f95[_0x7b91('0x40')]=_['keys'](_0x337ea2['query']);_0x458f95[_0x7b91('0x41')]=_[_0x7b91('0x42')](_0x458f95[_0x7b91('0x3d')],_0x458f95[_0x7b91('0x40')]);_0x3931d6[_0x7b91('0x43')]=_[_0x7b91('0x42')](_0x458f95[_0x7b91('0x3d')],qs[_0x7b91('0x52')](_0x337ea2[_0x7b91('0x40')]['fields']));_0x3931d6[_0x7b91('0x43')]=_0x3931d6['attributes'][_0x7b91('0x44')]?_0x3931d6[_0x7b91('0x43')]:_0x458f95[_0x7b91('0x3d')];if(_0x337ea2[_0x7b91('0x40')]['includeAll']){_0x3931d6['include']=[{'all':!![]}];}_0x3931d6=_[_0x7b91('0x4b')]({},_0x3931d6,_0x337ea2['options']);return db[_0x7b91('0x38')][_0x7b91('0x53')](_0x3931d6)[_0x7b91('0x30')](handleEntityNotFound(_0x481989,null))['then'](respondWithResult(_0x481989,null))[_0x7b91('0x54')](handleError(_0x481989,null));};exports[_0x7b91('0x55')]=function(_0x5b4d3c,_0x4b97c0,_0x14e133){return db[_0x7b91('0x38')][_0x7b91('0x53')]({'where':{'id':_0x5b4d3c[_0x7b91('0x51')]['id']},'attributes':[_0x7b91('0x35'),_0x7b91('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x4b97c0,null))['then'](function(_0x313904){if(_0x313904){var _0x2db8f3=path[_0x7b91('0x57')](config[_0x7b91('0x58')],_0x7b91('0x59'),util[_0x7b91('0x5a')](_0x7b91('0x5b'),path[_0x7b91('0x5c')](_0x313904[_0x7b91('0x56')])));var _0x2bb95=fs[_0x7b91('0x5d')](_0x2db8f3);var _0x3409de=archiver(_0x7b91('0x5e'),{'zlib':{'level':0x9}});_0x3409de['on']('warning',function(_0x2ccc00){if(_0x2ccc00[_0x7b91('0x5f')]===_0x7b91('0x60')){logger['error'](_0x2ccc00);}else{throw new db['Sequelize'][(_0x7b91('0x61'))](_0x7b91('0x62'));}});_0x3409de['on'](_0x7b91('0x34'),function(_0xe9dcf2){throw new db[(_0x7b91('0x63'))][(_0x7b91('0x61'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x3409de['pipe'](_0x2bb95);_0x3409de[_0x7b91('0x64')]('**/*',{'cwd':path[_0x7b91('0x57')](config[_0x7b91('0x58')],'server/files/plugins',path[_0x7b91('0x65')](_0x313904[_0x7b91('0x56')])),'ignore':[path[_0x7b91('0x57')](path[_0x7b91('0x5c')](_0x313904[_0x7b91('0x56')]),'node_modules/**/*'),path[_0x7b91('0x57')](path['basename'](_0x313904[_0x7b91('0x56')]),_0x7b91('0x66'))],'nodir':!![]})[_0x7b91('0x67')]();_0x2bb95['on'](_0x7b91('0x68'),function(){if(!fs[_0x7b91('0x69')](_0x2db8f3)){throw new db[(_0x7b91('0x63'))][(_0x7b91('0x61'))](_0x7b91('0x6a'));}return _0x4b97c0[_0x7b91('0x55')](_0x2db8f3,util[_0x7b91('0x5a')](_0x7b91('0x5b'),path[_0x7b91('0x5c')](_0x313904[_0x7b91('0x56')])),function(_0x3e58d9){if(_0x3e58d9){throw new db[(_0x7b91('0x63'))][(_0x7b91('0x61'))](_0x7b91('0x6b'));}fs[_0x7b91('0x6c')](_0x2db8f3);logger['info'](_0x7b91('0x6d'));logger[_0x7b91('0x6e')](_0x7b91('0x6f'));});});}return null;})[_0x7b91('0x54')](handleError(_0x4b97c0,null));};exports['upload']=function(_0x2c5e6e,_0x1186fe,_0x3f924a){var _0xc8e0a3=path[_0x7b91('0x5c')](_0x2c5e6e[_0x7b91('0x70')][_0x7b91('0x71')],path[_0x7b91('0x72')](_0x2c5e6e[_0x7b91('0x70')]['filename']));var _0x429696=path[_0x7b91('0x57')](config[_0x7b91('0x58')],_0x7b91('0x59'),_0x2c5e6e[_0x7b91('0x70')][_0x7b91('0x71')]);var _0xb7970b=path[_0x7b91('0x57')](config[_0x7b91('0x58')],_0x7b91('0x59'),_0xc8e0a3);logger[_0x7b91('0x6e')](_0x7b91('0x73'),_0x429696);logger[_0x7b91('0x6e')]('Plugin\x20upload\x20destination:\x20%s',_0xb7970b);try{fs[_0x7b91('0x74')](_0x429696,parseInt(_0x7b91('0x75'),0x8));extract(_0x429696,{'dir':_0xb7970b},function(_0x44c4bf){if(_0x44c4bf){logger['error'](_0x44c4bf);handleError(_0x44c4bf,!![]);};var _0x170774=fs[_0x7b91('0x76')](_0xb7970b);if(_0x170774['length']>0x1){removeReferences(_0x429696,_0xb7970b);logger['error']('Invalid\x20plugin\x20structure');return _0x3f924a(new Error(_0x7b91('0x77')));}var _0x2d7ea2=fs[_0x7b91('0x78')](path['join'](_0xb7970b,_0x170774[0x0]));if(_0x2d7ea2[_0x7b91('0x79')]()){removeReferences(_0x429696,_0xb7970b);logger[_0x7b91('0x34')](_0x7b91('0x77'));return _0x3f924a(new Error(_0x7b91('0x77')));}if(_0x2d7ea2[_0x7b91('0x7a')]()){var _0x2dcfe8=fs[_0x7b91('0x76')](path[_0x7b91('0x57')](_0xb7970b,_0x170774[0x0]));if(_0x2dcfe8[_0x7b91('0x44')]===0x0){removeReferences(_0x429696,_0xb7970b);logger['error'](_0x7b91('0x77'));return _0x3f924a(new Error(_0x7b91('0x77')));}var _0x1d4ad9=_0x2dcfe8[_0x7b91('0x7b')](function(_0x27b86f){return _0x27b86f===_0x7b91('0x7c');});if(!_0x1d4ad9){return _0x3f924a(new Error(_0x7b91('0x7d')));}var _0x3cb70f=fs['readFileSync'](path[_0x7b91('0x57')](_0xb7970b,_0x170774[0x0],_0x7b91('0x7c')));var _0x1d5bf5=JSON[_0x7b91('0x7e')](_0x3cb70f);if(_0x7b91('0x7f')==typeof _0x1d5bf5['name']){return _0x3f924a(new Error(_0x7b91('0x80')));}if('undefined'==typeof _0x1d5bf5[_0x7b91('0x3b')]){return _0x3f924a(new Error(_0x7b91('0x81')));}if(_0x7b91('0x7f')==typeof _0x1d5bf5[_0x7b91('0x82')]){return _0x3f924a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x7b91('0x7f')==typeof _0x1d5bf5['parameters']){return _0x3f924a(new Error(_0x7b91('0x83')));}if(_0x1d5bf5[_0x7b91('0x3b')]===_0x7b91('0x84')){if('undefined'==typeof _0x1d5bf5['parameters'][_0x7b91('0x85')]){return _0x3f924a(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')][_0x7b91('0x87')]&&'undefined'==typeof _0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')]['agent']){return _0x3f924a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1d5bf5['type']==='script'){if(_0x7b91('0x7f')==typeof _0x1d5bf5['parameters'][_0x7b91('0x88')]){return _0x3f924a(new Error(_0x7b91('0x89')));}if(_0x7b91('0x7f')==typeof _0x1d5bf5['parameters'][_0x7b91('0x8a')]){return _0x3f924a(new Error(_0x7b91('0x8b')));}}else{return _0x3f924a(new Error(_0x7b91('0x8c')));}var _0x1ad6d7=_0x1d5bf5['name'];var _0x46df13=_0x1d5bf5['description'];var _0x5350ec=_0x1d5bf5[_0x7b91('0x3b')];var _0x23e4cf=_0x1d5bf5[_0x7b91('0x8d')]?_0x1d5bf5[_0x7b91('0x8d')]:_0x7b91('0x8e');var _0x39a8e5=_0x1d5bf5['icon']?_0x1d5bf5['icon']:_0x7b91('0x8f');var _0x21025d='';var _0x4139f9='';var _0x503124='';var _0x324759='';var _0x523cd2=_0x1d5bf5['version'];if(_0x5350ec===_0x7b91('0x84')){if(_0x7b91('0x7f')!=typeof _0x1d5bf5['parameters'][_0x7b91('0x85')][_0x7b91('0x87')]){var _0x5e9b0c=_0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')][_0x7b91('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x7b91('0x90')](_0x5e9b0c)){_0x21025d=path[_0x7b91('0x57')](_0x7b91('0x91'),_0xc8e0a3,_0x170774[0x0],_0x5e9b0c);}else{_0x21025d=_0x5e9b0c;}}else{logger['info'](_0x7b91('0x92'));}if(_0x7b91('0x7f')!=typeof _0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')][_0x7b91('0x93')]){var _0x532f21=_0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')][_0x7b91('0x93')];if(!/^(f|ht)tps?:\/\//i[_0x7b91('0x90')](_0x532f21)){_0x4139f9=path[_0x7b91('0x57')](_0x7b91('0x91'),_0xc8e0a3,_0x170774[0x0],_0x532f21);}else{_0x4139f9=_0x532f21;}}else{logger['info'](_0x7b91('0x94'));}}else if(_0x5350ec===_0x7b91('0x95')){_0x503124=_0x1d5bf5['parameters']['scriptName'];_0x324759=_0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x8a')];if(_0x7b91('0x7f')!=typeof _0x1d5bf5[_0x7b91('0x86')]['views']){if(_0x7b91('0x7f')!=typeof _0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')][_0x7b91('0x87')]){var _0x5e9b0c=_0x1d5bf5[_0x7b91('0x86')]['views'][_0x7b91('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5e9b0c)){_0x21025d=path[_0x7b91('0x57')](_0x7b91('0x91'),_0xc8e0a3,_0x170774[0x0],_0x5e9b0c);}else{_0x21025d=_0x5e9b0c;}}if(_0x7b91('0x7f')!=typeof _0x1d5bf5['parameters'][_0x7b91('0x85')]['agent']){var _0x532f21=_0x1d5bf5[_0x7b91('0x86')][_0x7b91('0x85')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x532f21)){_0x4139f9=path[_0x7b91('0x57')]('plugins',_0xc8e0a3,_0x170774[0x0],_0x532f21);}else{_0x4139f9=_0x532f21;}}}}var _0x4ec12d={'name':_0x1ad6d7,'description':_0x46df13,'path':path[_0x7b91('0x57')](_0xc8e0a3,_0x170774[0x0]),'type':_0x5350ec,'sidebar':_0x23e4cf,'icon':_0x39a8e5,'adminUrl':_0x21025d,'agentUrl':_0x4139f9,'scriptName':_0x503124,'scriptPath':_0x324759,'version':_0x523cd2};removeReferences(_0x429696,null);return db[_0x7b91('0x38')][_0x7b91('0x96')](_0x4ec12d)[_0x7b91('0x30')](function(_0x2e53f3){var _0x554524={'role':_0x2c5e6e[_0x7b91('0x97')][_0x7b91('0x98')],'userProfileId':_0x2c5e6e[_0x7b91('0x97')][_0x7b91('0x99')]};if(!_0x554524)throw new Error(_0x7b91('0x9a'));if(_0x554524['role']===_0x7b91('0x9b')){var _0x507d4d=_0x2e53f3['get']({'plain':!![]});return db['UserProfileSection'][_0x7b91('0x53')]({'where':{'name':_0x7b91('0x31'),'userProfileId':_0x554524[_0x7b91('0x99')]},'raw':!![]})[_0x7b91('0x30')](function(_0x288927){if(_0x288927&&_0x288927[_0x7b91('0x9c')]===0x0){return db[_0x7b91('0x32')]['create']({'name':_0x507d4d[_0x7b91('0x35')],'resourceId':_0x507d4d['id'],'type':_0x288927[_0x7b91('0x35')],'sectionId':_0x288927['id']},{})[_0x7b91('0x30')](function(){return _0x2e53f3;});}else{return _0x2e53f3;}})[_0x7b91('0x54')](function(_0x5b8eda){logger['error'](_0x7b91('0x9d'),_0x5b8eda);throw _0x5b8eda;});}return _0x2e53f3;})[_0x7b91('0x30')](respondWithResult(_0x1186fe,null))['catch'](handleError(_0x1186fe,null));}});}catch(_0x3c2e77){_0x1186fe[_0x7b91('0x24')](0x1f4)[_0x7b91('0x36')](_0x3c2e77);}};function removeReferences(_0x23512a,_0xb1a402){try{if(_0x23512a){fs[_0x7b91('0x6c')](_0x23512a);logger[_0x7b91('0x6e')](_0x7b91('0x9e'));}if(_0xb1a402){rimraf(_0xb1a402,function(){});logger[_0x7b91('0x6e')](_0x7b91('0x9f'));}}catch(_0x529c55){logger[_0x7b91('0x34')](_0x529c55);}}exports['update']=function(_0xb7fdba,_0x3ed6ee,_0x414161){return db[_0x7b91('0x38')][_0x7b91('0x53')]({'where':{'id':_0xb7fdba[_0x7b91('0x51')]['id']}})[_0x7b91('0x30')](handleEntityNotFound(_0x3ed6ee,null))['then'](saveUpdates(_0xb7fdba[_0x7b91('0x97')],null))[_0x7b91('0x30')](respondWithResult(_0x3ed6ee,null))['catch'](handleError(_0x3ed6ee,null));};exports[_0x7b91('0xa0')]=function(_0x13baa0,_0x2d8e95,_0x1b1dee){return db[_0x7b91('0x38')]['find']({'where':{'id':_0x13baa0['params']['id']}})[_0x7b91('0x30')](function(_0x35b48e){if(_0x35b48e){return _0x35b48e['destroy']();}})[_0x7b91('0x30')](function(_0x40758d){rimraf(path[_0x7b91('0x57')](config[_0x7b91('0x58')],_0x7b91('0x59'),path[_0x7b91('0x65')](_0x40758d['path'])),function(){});return _0x40758d;})[_0x7b91('0x30')](handleEntityNotFound(_0x2d8e95,null))[_0x7b91('0x30')](respondWithStatusCode(_0x2d8e95,null))[_0x7b91('0x54')](handleError(_0x2d8e95,null));};exports['webhookGet']=function(_0x4f0287,_0x2f8bc1,_0x26be3a){return BPromise[_0x7b91('0xa1')]()['then'](function(){if(!_0x4f0287['query'][_0x7b91('0x56')]){throw new Error(_0x7b91('0xa2'));}if(!_0x4f0287['query'][_0x7b91('0xa3')]){throw new Error(_0x7b91('0xa4'));}var _0x3342fe=_0x4f0287[_0x7b91('0x40')][_0x7b91('0xa5')]?_0x4f0287['query'][_0x7b91('0xa5')]+':'+_0x4f0287[_0x7b91('0x40')][_0x7b91('0xa3')]:'http://localhost:'+_0x4f0287[_0x7b91('0x40')][_0x7b91('0xa3')];var _0x5a1d90=_0x4f0287[_0x7b91('0x40')][_0x7b91('0x26')]?_0x4f0287[_0x7b91('0x40')][_0x7b91('0x26')]:!![];var _0x43df00=_0x4f0287[_0x7b91('0x40')][_0x7b91('0xa6')]?_0x4f0287[_0x7b91('0x40')][_0x7b91('0xa6')]:null;var _0x2e3aaa={'method':_0x4f0287[_0x7b91('0xa7')],'uri':util['format'](_0x7b91('0xa8'),_0x3342fe,_0x4f0287[_0x7b91('0x40')]['path']),'json':_0x5a1d90,'resolveWithFullResponse':!![],'encoding':_0x43df00,'qs':_0x4f0287['query']};if(_0x4f0287[_0x7b91('0xa9')]){_0x2e3aaa[_0x7b91('0xa9')]=_0x4f0287[_0x7b91('0xa9')];if(_0x2e3aaa[_0x7b91('0xa9')][_0x7b91('0xaa')]){delete _0x2e3aaa[_0x7b91('0xa9')][_0x7b91('0xaa')];}}if(_0x2e3aaa[_0x7b91('0xa9')]['content-type']){delete _0x2e3aaa[_0x7b91('0xa9')]['content-type'];}return rp(_0x2e3aaa);})[_0x7b91('0x30')](function(_0x298a16){if(_0x298a16){_0x2f8bc1['set'](_0x298a16['headers']);logger['info'](_0x298a16[_0x7b91('0x97')]);if(_[_0x7b91('0xab')](_0x4f0287[_0x7b91('0x40')][_0x7b91('0x56')],_0x7b91('0x55'))&&_0x298a16[_0x7b91('0xac')]==0x1f4){return _0x2f8bc1[_0x7b91('0x23')](_0x298a16[_0x7b91('0xac')]);}else{return _0x2f8bc1[_0x7b91('0x24')](_0x298a16[_0x7b91('0xac')])[_0x7b91('0x36')](_0x298a16[_0x7b91('0x97')]);}}else{return _0x2f8bc1[_0x7b91('0x23')](0xc8);}})[_0x7b91('0x54')](handleError(_0x2f8bc1,null));};exports[_0x7b91('0xad')]=function(_0x554e3b,_0x1ffda0,_0x3ebf5d){return BPromise[_0x7b91('0xa1')]()[_0x7b91('0x30')](function(){if(!_0x554e3b[_0x7b91('0x40')][_0x7b91('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x554e3b[_0x7b91('0x40')][_0x7b91('0xa3')]){throw new Error(_0x7b91('0xa4'));}var _0x30032e=_0x554e3b['query'][_0x7b91('0xa5')]?_0x554e3b[_0x7b91('0x40')][_0x7b91('0xa5')]+':'+_0x554e3b[_0x7b91('0x40')][_0x7b91('0xa3')]:_0x7b91('0xae')+_0x554e3b['query']['port'];var _0x5d67c8=_0x554e3b[_0x7b91('0x40')][_0x7b91('0x26')]?_0x554e3b[_0x7b91('0x40')][_0x7b91('0x26')]:!![];var _0x3c8d73=_0x554e3b[_0x7b91('0x40')][_0x7b91('0xa6')]?_0x554e3b['query'][_0x7b91('0xa6')]:null;var _0x41e569={'method':_0x554e3b['method'],'uri':util[_0x7b91('0x5a')]('%s%s',_0x30032e,_0x554e3b[_0x7b91('0x40')][_0x7b91('0x56')]),'json':_0x5d67c8,'resolveWithFullResponse':!![],'encoding':_0x3c8d73,'body':_0x554e3b[_0x7b91('0x97')]};if(_0x554e3b[_0x7b91('0xa9')]){_0x41e569[_0x7b91('0xa9')]=_0x554e3b[_0x7b91('0xa9')];if(_0x41e569[_0x7b91('0xa9')]['content-length']){delete _0x41e569[_0x7b91('0xa9')][_0x7b91('0xaa')];}}if(_0x41e569[_0x7b91('0xa9')]['content-type']){delete _0x41e569['headers'][_0x7b91('0xaf')];}return rp(_0x41e569);})[_0x7b91('0x30')](function(_0x43bb90){if(_0x43bb90){_0x1ffda0[_0x7b91('0x2a')](_0x43bb90[_0x7b91('0xa9')]);logger[_0x7b91('0x6e')](_0x43bb90[_0x7b91('0x97')]);return _0x1ffda0['status'](_0x43bb90[_0x7b91('0xac')])[_0x7b91('0x36')](_0x43bb90[_0x7b91('0x97')]);}else{return _0x1ffda0[_0x7b91('0x23')](0xc8);}})[_0x7b91('0x54')](handleError(_0x1ffda0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 60f87c2..81f3b13 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 _0x2f74=['save','update','remove','hasOwnProperty','hook','exports','events','Plugin','setMaxListeners'];(function(_0x5de3b0,_0x8b3ad1){var _0xa0198d=function(_0x546493){while(--_0x546493){_0x5de3b0['push'](_0x5de3b0['shift']());}};_0xa0198d(++_0x8b3ad1);}(_0x2f74,0x7b));var _0x42f7=function(_0x547302,_0x5c1853){_0x547302=_0x547302-0x0;var _0x120aa6=_0x2f74[_0x547302];return _0x120aa6;};'use strict';var EventEmitter=require(_0x42f7('0x0'));var Plugin=require('../../mysqldb')['db'][_0x42f7('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x42f7('0x2')](0x0);var events={'afterCreate':_0x42f7('0x3'),'afterUpdate':_0x42f7('0x4'),'afterDestroy':_0x42f7('0x5')};function emitEvent(_0x3fcf64){return function(_0x43a650,_0x16d639,_0x5159d7){PluginEvents['emit'](_0x3fcf64+':'+_0x43a650['id'],_0x43a650);PluginEvents['emit'](_0x3fcf64,_0x43a650);_0x5159d7(null);};}for(var e in events){if(events[_0x42f7('0x6')](e)){var event=events[e];Plugin[_0x42f7('0x7')](e,emitEvent(event));}}module[_0x42f7('0x8')]=PluginEvents; \ No newline at end of file +var _0xfd2e=['events','Plugin','save','remove','hasOwnProperty'];(function(_0x54825e,_0x127d0e){var _0x3e07e9=function(_0x35930b){while(--_0x35930b){_0x54825e['push'](_0x54825e['shift']());}};_0x3e07e9(++_0x127d0e);}(_0xfd2e,0x6e));var _0xefd2=function(_0x27b9da,_0x224fbf){_0x27b9da=_0x27b9da-0x0;var _0x2be9b5=_0xfd2e[_0x27b9da];return _0x2be9b5;};'use strict';var EventEmitter=require(_0xefd2('0x0'));var Plugin=require('../../mysqldb')['db'][_0xefd2('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xefd2('0x2'),'afterUpdate':'update','afterDestroy':_0xefd2('0x3')};function emitEvent(_0x1c75dd){return function(_0x2b6511,_0x11d644,_0x2e095c){PluginEvents['emit'](_0x1c75dd+':'+_0x2b6511['id'],_0x2b6511);PluginEvents['emit'](_0x1c75dd,_0x2b6511);_0x2e095c(null);};}for(var e in events){if(events[_0xefd2('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index b261427..46a9579 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 _0x539f=['Plugin','plugins','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x919bbb,_0x55ef48){var _0x40971a=function(_0xc823b6){while(--_0xc823b6){_0x919bbb['push'](_0x919bbb['shift']());}};_0x40971a(++_0x55ef48);}(_0x539f,0xde));var _0xf539=function(_0x1eea0d,_0x3ee4ad){_0x1eea0d=_0x1eea0d-0x0;var _0x39d98c=_0x539f[_0x1eea0d];return _0x39d98c;};'use strict';var _=require('lodash');var util=require(_0xf539('0x0'));var logger=require(_0xf539('0x1'))('api');var moment=require(_0xf539('0x2'));var BPromise=require(_0xf539('0x3'));var rp=require(_0xf539('0x4'));var fs=require('fs');var path=require(_0xf539('0x5'));var rimraf=require('rimraf');var config=require(_0xf539('0x6'));var attributes=require('./plugin.attributes');module[_0xf539('0x7')]=function(_0x3c14a8,_0x13fc6b){return _0x3c14a8['define'](_0xf539('0x8'),attributes,{'tableName':_0xf539('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc389=['bluebird','request-promise','rimraf','define','Plugin','plugins','util','../../config/logger','api','moment'];(function(_0x5068cb,_0x50ea15){var _0x12f94d=function(_0x58d322){while(--_0x58d322){_0x5068cb['push'](_0x5068cb['shift']());}};_0x12f94d(++_0x50ea15);}(_0xc389,0x164));var _0x9c38=function(_0x5cb57e,_0x52bb88){_0x5cb57e=_0x5cb57e-0x0;var _0x4f75b4=_0xc389[_0x5cb57e];return _0x4f75b4;};'use strict';var _=require('lodash');var util=require(_0x9c38('0x0'));var logger=require(_0x9c38('0x1'))(_0x9c38('0x2'));var moment=require(_0x9c38('0x3'));var BPromise=require(_0x9c38('0x4'));var rp=require(_0x9c38('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c38('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module['exports']=function(_0x52fe77,_0x2ef172){return _0x52fe77[_0x9c38('0x7')](_0x9c38('0x8'),attributes,{'tableName':_0x9c38('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 514cdae..e9c196d 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 _0xa621=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreatePlugin','Plugin','create','options','raw','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa621,0xf3));var _0x1a62=function(_0xdb98f0,_0x12d521){_0xdb98f0=_0xdb98f0-0x0;var _0x5affc4=_0xa621[_0xdb98f0];return _0x5affc4;};'use strict';var _=require(_0x1a62('0x0'));var util=require(_0x1a62('0x1'));var moment=require(_0x1a62('0x2'));var BPromise=require(_0x1a62('0x3'));var rs=require(_0x1a62('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a62('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a62('0x6'))(_0x1a62('0x7'));var config=require(_0x1a62('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1a62('0x9')]({'port':0x232a});config[_0x1a62('0xa')]=_[_0x1a62('0xb')](config[_0x1a62('0xa')],{'host':_0x1a62('0xc'),'port':0x18eb});var socket=require(_0x1a62('0xd'))(new Redis(config['redis']));require(_0x1a62('0xe'))['register'](socket);function respondWithRpcPromise(_0x267abe,_0xaca485,_0x1b9ecb){return new BPromise(function(_0x72bff8,_0x5d65cc){return client[_0x1a62('0xf')](_0x267abe,_0x1b9ecb)[_0x1a62('0x10')](function(_0x4c53b4){logger['info'](_0x1a62('0x11'),_0xaca485,_0x1a62('0x12'));logger['debug'](_0x1a62('0x13'),_0xaca485,_0x1a62('0x12'),JSON[_0x1a62('0x14')](_0x4c53b4));if(_0x4c53b4[_0x1a62('0x15')]){if(_0x4c53b4[_0x1a62('0x15')]['code']===0x1f4){logger[_0x1a62('0x15')](_0x1a62('0x11'),_0xaca485,_0x4c53b4[_0x1a62('0x15')][_0x1a62('0x16')]);return _0x5d65cc(_0x4c53b4['error'][_0x1a62('0x16')]);}logger['error'](_0x1a62('0x11'),_0xaca485,_0x4c53b4[_0x1a62('0x15')][_0x1a62('0x16')]);return _0x72bff8(_0x4c53b4[_0x1a62('0x15')]['message']);}else{logger[_0x1a62('0x17')](_0x1a62('0x11'),_0xaca485,'request\x20sent');_0x72bff8(_0x4c53b4[_0x1a62('0x18')]['message']);}})['catch'](function(_0x404831){logger['error'](_0x1a62('0x11'),_0xaca485,_0x404831);_0x5d65cc(_0x404831);});});}exports[_0x1a62('0x19')]=function(_0x54882a){var _0x3821d7=this;return new Promise(function(_0x15829f,_0x15328b){return db[_0x1a62('0x1a')][_0x1a62('0x1b')](_0x54882a['body'],{'raw':_0x54882a[_0x1a62('0x1c')]?_0x54882a[_0x1a62('0x1c')][_0x1a62('0x1d')]===undefined?!![]:![]:!![]})[_0x1a62('0x10')](function(_0x30bced){logger[_0x1a62('0x17')]('CreatePlugin',_0x54882a);logger[_0x1a62('0x1e')](_0x1a62('0x19'),_0x54882a,JSON[_0x1a62('0x14')](_0x30bced));_0x15829f(_0x30bced);})['catch'](function(_0x1ee867){logger[_0x1a62('0x15')](_0x1a62('0x19'),_0x1ee867['message'],_0x54882a);_0x15328b(_0x3821d7['error'](0x1f4,_0x1ee867[_0x1a62('0x16')]));});});}; \ No newline at end of file +var _0x9153=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./plugin.socket','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','message','result','Plugin','body','options','raw','CreatePlugin','catch','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9153,0xd8));var _0x3915=function(_0xa42f5d,_0x1199fb){_0xa42f5d=_0xa42f5d-0x0;var _0x35780c=_0x9153[_0xa42f5d];return _0x35780c;};'use strict';var _=require(_0x3915('0x0'));var util=require(_0x3915('0x1'));var moment=require(_0x3915('0x2'));var BPromise=require(_0x3915('0x3'));var rs=require(_0x3915('0x4'));var fs=require('fs');var Redis=require(_0x3915('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3915('0x6'));var logger=require(_0x3915('0x7'))(_0x3915('0x8'));var config=require(_0x3915('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3915('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3915('0xb')](config[_0x3915('0xc')],{'host':_0x3915('0xd'),'port':0x18eb});var socket=require(_0x3915('0xe'))(new Redis(config['redis']));require(_0x3915('0xf'))['register'](socket);function respondWithRpcPromise(_0x510897,_0x3287c3,_0x227e6c){return new BPromise(function(_0x46bdb0,_0x3f5a4a){return client[_0x3915('0x10')](_0x510897,_0x227e6c)[_0x3915('0x11')](function(_0x431067){logger[_0x3915('0x12')](_0x3915('0x13'),_0x3287c3,_0x3915('0x14'));logger['debug'](_0x3915('0x15'),_0x3287c3,_0x3915('0x14'),JSON['stringify'](_0x431067));if(_0x431067[_0x3915('0x16')]){if(_0x431067['error']['code']===0x1f4){logger[_0x3915('0x16')](_0x3915('0x13'),_0x3287c3,_0x431067[_0x3915('0x16')][_0x3915('0x17')]);return _0x3f5a4a(_0x431067['error'][_0x3915('0x17')]);}logger[_0x3915('0x16')](_0x3915('0x13'),_0x3287c3,_0x431067[_0x3915('0x16')][_0x3915('0x17')]);return _0x46bdb0(_0x431067['error'][_0x3915('0x17')]);}else{logger[_0x3915('0x12')](_0x3915('0x13'),_0x3287c3,_0x3915('0x14'));_0x46bdb0(_0x431067[_0x3915('0x18')][_0x3915('0x17')]);}})['catch'](function(_0x44c866){logger['error']('Plugin,\x20%s,\x20%s',_0x3287c3,_0x44c866);_0x3f5a4a(_0x44c866);});});}exports['CreatePlugin']=function(_0x27c8b3){var _0x42af5a=this;return new Promise(function(_0xc3e40b,_0x55e896){return db[_0x3915('0x19')]['create'](_0x27c8b3[_0x3915('0x1a')],{'raw':_0x27c8b3[_0x3915('0x1b')]?_0x27c8b3['options'][_0x3915('0x1c')]===undefined?!![]:![]:!![]})[_0x3915('0x11')](function(_0x3d2df2){logger[_0x3915('0x12')](_0x3915('0x1d'),_0x27c8b3);logger['debug'](_0x3915('0x1d'),_0x27c8b3,JSON['stringify'](_0x3d2df2));_0xc3e40b(_0x3d2df2);})[_0x3915('0x1e')](function(_0x5bdcd5){logger[_0x3915('0x16')](_0x3915('0x1d'),_0x5bdcd5[_0x3915('0x17')],_0x27c8b3);_0x55e896(_0x42af5a[_0x3915('0x16')](0x1f4,_0x5bdcd5[_0x3915('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index bbe4066..728e104 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 _0x0730=['length','plugin:','save','remove','update','register'];(function(_0x1c869b,_0xa0eb94){var _0x48cc4c=function(_0x374eaf){while(--_0x374eaf){_0x1c869b['push'](_0x1c869b['shift']());}};_0x48cc4c(++_0xa0eb94);}(_0x0730,0x1dc));var _0x0073=function(_0x39a4aa,_0x4d088e){_0x39a4aa=_0x39a4aa-0x0;var _0x10b9cb=_0x0730[_0x39a4aa];return _0x10b9cb;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x0073('0x0'),_0x0073('0x1'),_0x0073('0x2')];function createListener(_0x3f8ef2,_0xf3d8a5){return function(_0x28d0fa){_0xf3d8a5['emit'](_0x3f8ef2,_0x28d0fa);};}function removeListener(_0xbf4a9c,_0x387c90){return function(){PluginEvents['removeListener'](_0xbf4a9c,_0x387c90);};}exports[_0x0073('0x3')]=function(_0x10a838){for(var _0x5f545e=0x0,_0x2522d7=events[_0x0073('0x4')];_0x5f545e<_0x2522d7;_0x5f545e++){var _0x62a395=events[_0x5f545e];var _0x1938ec=createListener(_0x0073('0x5')+_0x62a395,_0x10a838);PluginEvents['on'](_0x62a395,_0x1938ec);}}; \ No newline at end of file +var _0x6d27=['removeListener','plugin:','./plugin.events','remove','update','emit'];(function(_0x2f075b,_0x4a88b2){var _0x21b8bf=function(_0x15f86a){while(--_0x15f86a){_0x2f075b['push'](_0x2f075b['shift']());}};_0x21b8bf(++_0x4a88b2);}(_0x6d27,0x152));var _0x76d2=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x6d27[_0x42245d];return _0x4b211a;};'use strict';var PluginEvents=require(_0x76d2('0x0'));var events=['save',_0x76d2('0x1'),_0x76d2('0x2')];function createListener(_0x1512f2,_0x57245b){return function(_0xda25c2){_0x57245b[_0x76d2('0x3')](_0x1512f2,_0xda25c2);};}function removeListener(_0x3b23c0,_0xceae9){return function(){PluginEvents[_0x76d2('0x4')](_0x3b23c0,_0xceae9);};}exports['register']=function(_0x124901){for(var _0x1fb91a=0x0,_0x598e2e=events['length'];_0x1fb91a<_0x598e2e;_0x1fb91a++){var _0x294605=events[_0x1fb91a];var _0x2e010f=createListener(_0x76d2('0x5')+_0x294605,_0x124901);PluginEvents['on'](_0x294605,_0x2e010f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index c6b304d..695e4c4 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(_0x5ae6e2,_0x31f32b){var _0x231a12=function(_0x139a71){while(--_0x139a71){_0x5ae6e2['push'](_0x5ae6e2['shift']());}};_0x231a12(++_0x31f32b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x459820,_0x1b8e1d){var _0xafadeb=function(_0x248210){while(--_0x248210){_0x459820['push'](_0x459820['shift']());}};_0xafadeb(++_0x1b8e1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 fdc6bef..9159867 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 _0xca66=['reject','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','script','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','lodash','api','path','child_process','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xca66,0x8b));var _0x6ca6=function(_0x287b2b,_0xbd74c0){_0x287b2b=_0x287b2b-0x0;var _0x3bf10f=_0xca66[_0x287b2b];return _0x3bf10f;};'use strict';var _=require(_0x6ca6('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x6ca6('0x1'));var path=require(_0x6ca6('0x2'));var exec=require(_0x6ca6('0x3'))['exec'];var BPromise=require(_0x6ca6('0x4'));function handleEntityNotFound(_0x4b1a10,_0x3ab489){return function(_0x5569aa){if(!_0x5569aa){_0x4b1a10[_0x6ca6('0x5')](0x194);;}return _0x5569aa;};}function respondWithResult(_0x27d8c6,_0x34836f){_0x34836f=_0x34836f||0xc8;return function(_0x44019c){if(_0x44019c){return _0x27d8c6[_0x6ca6('0x6')](_0x34836f)[_0x6ca6('0x7')](_0x44019c);}return null;};}function handleError(_0x27d280,_0x4f5651){_0x4f5651=_0x4f5651||0x1f4;return function(_0xf69e0f){logger[_0x6ca6('0x8')](_0xf69e0f[_0x6ca6('0x9')]);if(_0xf69e0f[_0x6ca6('0xa')]){delete _0xf69e0f[_0x6ca6('0xa')];}_0x27d280[_0x6ca6('0x6')](_0x4f5651)[_0x6ca6('0xb')](_0xf69e0f);};}function execChildProcess(){return new BPromise(function(_0x55a626,_0x38678e){exec(_0x6ca6('0xc'),function(_0x25d276,_0x46b795,_0x444243){logger[_0x6ca6('0xd')](_0x46b795);logger['info'](_0x444243);if(_0x25d276){logger[_0x6ca6('0x8')](_0x25d276);return _0x38678e(_0x25d276);}return _0x55a626(_0x46b795);});});}exports[_0x6ca6('0xe')]=function(_0x55238b,_0x412986){return pm2[_0x6ca6('0xf')]()[_0x6ca6('0x10')](function(_0x3570f1){if(_0x3570f1){var _0xc774c=_[_0x6ca6('0x11')](_0x3570f1,function(_0x4c053a){return _0x4c053a['name']==='express'||_0x4c053a[_0x6ca6('0xa')]===_0x6ca6('0x12');});return{'rows':_0xc774c,'count':_0xc774c[_0x6ca6('0x13')]};}return null;})[_0x6ca6('0x10')](respondWithResult(_0x412986,null))[_0x6ca6('0x14')](handleError(_0x412986,null));};exports[_0x6ca6('0x15')]=function(_0x25dc6c,_0x4f056d){return pm2[_0x6ca6('0x16')](_0x25dc6c[_0x6ca6('0x17')]['id'])[_0x6ca6('0x10')](respondWithResult(_0x4f056d,null))[_0x6ca6('0x10')](handleEntityNotFound(_0x4f056d,null))[_0x6ca6('0x14')](handleError(_0x4f056d,null));};exports[_0x6ca6('0x18')]=function(_0x16a3d7,_0x251072){if(_0x16a3d7[_0x6ca6('0x19')][_0x6ca6('0xa')]&&_0x16a3d7[_0x6ca6('0x19')]['script']){var _0x28a982=path[_0x6ca6('0x1a')](__dirname,_0x6ca6('0x1b'),_0x16a3d7[_0x6ca6('0x19')][_0x6ca6('0x1c')]);var _0x438694=process['cwd']();process[_0x6ca6('0x1d')](path[_0x6ca6('0x1e')](_0x28a982));return execChildProcess()['then'](function(_0x4927c1){process[_0x6ca6('0x1d')](_0x438694);return pm2[_0x6ca6('0x1f')]({'name':_0x16a3d7[_0x6ca6('0x19')][_0x6ca6('0xa')],'script':_0x28a982});})[_0x6ca6('0x10')](function(_0x541122){pm2[_0x6ca6('0x20')]();return _0x541122[0x0];})[_0x6ca6('0x10')](respondWithResult(_0x251072,0xc9))[_0x6ca6('0x14')](handleError(_0x251072,null));}else{return _0x251072[_0x6ca6('0x6')](0x1f4)[_0x6ca6('0xb')]({'message':_0x6ca6('0x21')});}};exports[_0x6ca6('0x22')]=function(_0x2a1e2d,_0x516daf){if(_0x2a1e2d['body']['id']){delete _0x2a1e2d[_0x6ca6('0x19')]['id'];}var _0x9467bd={'online':_0x6ca6('0x23'),'stopped':_0x6ca6('0x24')};if(_0x9467bd['hasOwnProperty'](_0x2a1e2d['body'][_0x6ca6('0x6')])){return pm2[_0x9467bd[_0x2a1e2d['body']['status']]](_0x2a1e2d[_0x6ca6('0x17')]['id'])[_0x6ca6('0x10')](respondWithResult(_0x516daf,0xc8))['catch'](handleError(_0x516daf,null));}else{return _0x516daf[_0x6ca6('0x6')](0x1f4)[_0x6ca6('0xb')]({'message':_0x6ca6('0x25')});}};exports[_0x6ca6('0x26')]=function(_0x484411,_0x28af50){if(_0x484411[_0x6ca6('0x19')]['id']){delete _0x484411[_0x6ca6('0x19')]['id'];}if(_0x484411[_0x6ca6('0x17')]['id']){return pm2['delete'](_0x484411[_0x6ca6('0x17')]['id'])[_0x6ca6('0x10')](function(_0x3c4af8){pm2[_0x6ca6('0x20')]();return _0x3c4af8[0x0];})['then'](respondWithResult(_0x28af50,null))['catch'](handleError(_0x28af50,null));}else{return _0x28af50['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x3667=['lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','join','script','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','restart','hasOwnProperty','params','destroy','delete'];(function(_0x20fc86,_0x5e450a){var _0x19df9e=function(_0x229eb7){while(--_0x229eb7){_0x20fc86['push'](_0x20fc86['shift']());}};_0x19df9e(++_0x5e450a);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var pm2=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var path=require(_0x7366('0x4'));var exec=require('child_process')[_0x7366('0x5')];var BPromise=require(_0x7366('0x6'));function handleEntityNotFound(_0x4b32a7,_0x27726b){return function(_0x22bfc0){if(!_0x22bfc0){_0x4b32a7[_0x7366('0x7')](0x194);;}return _0x22bfc0;};}function respondWithResult(_0x1c0cf4,_0x101e3d){_0x101e3d=_0x101e3d||0xc8;return function(_0x589397){if(_0x589397){return _0x1c0cf4[_0x7366('0x8')](_0x101e3d)[_0x7366('0x9')](_0x589397);}return null;};}function handleError(_0x2dd32b,_0x26e9a9){_0x26e9a9=_0x26e9a9||0x1f4;return function(_0x171fe2){logger[_0x7366('0xa')](_0x171fe2[_0x7366('0xb')]);if(_0x171fe2[_0x7366('0xc')]){delete _0x171fe2[_0x7366('0xc')];}_0x2dd32b[_0x7366('0x8')](_0x26e9a9)[_0x7366('0xd')](_0x171fe2);};}function execChildProcess(){return new BPromise(function(_0x2d7e38,_0x57ea7f){exec(_0x7366('0xe'),function(_0x2694fc,_0xbcd488,_0x4718db){logger[_0x7366('0xf')](_0xbcd488);logger[_0x7366('0xf')](_0x4718db);if(_0x2694fc){logger[_0x7366('0xa')](_0x2694fc);return _0x57ea7f(_0x2694fc);}return _0x2d7e38(_0xbcd488);});});}exports[_0x7366('0x10')]=function(_0x37e47e,_0x1813b7){return pm2[_0x7366('0x11')]()[_0x7366('0x12')](function(_0x27500c){if(_0x27500c){var _0x22562f=_[_0x7366('0x13')](_0x27500c,function(_0x4dd111){return _0x4dd111[_0x7366('0xc')]===_0x7366('0x14')||_0x4dd111[_0x7366('0xc')]===_0x7366('0x15');});return{'rows':_0x22562f,'count':_0x22562f[_0x7366('0x16')]};}return null;})[_0x7366('0x12')](respondWithResult(_0x1813b7,null))[_0x7366('0x17')](handleError(_0x1813b7,null));};exports[_0x7366('0x18')]=function(_0x83e5d5,_0x41113f){return pm2[_0x7366('0x19')](_0x83e5d5['params']['id'])[_0x7366('0x12')](respondWithResult(_0x41113f,null))['then'](handleEntityNotFound(_0x41113f,null))[_0x7366('0x17')](handleError(_0x41113f,null));};exports[_0x7366('0x1a')]=function(_0x3f23cd,_0x52b43e){if(_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')]&&_0x3f23cd[_0x7366('0x1b')]['script']){var _0x16e038=path[_0x7366('0x1c')](__dirname,'../../files/plugins',_0x3f23cd[_0x7366('0x1b')][_0x7366('0x1d')]);var _0xaab659=process[_0x7366('0x1e')]();process[_0x7366('0x1f')](path[_0x7366('0x20')](_0x16e038));return execChildProcess()[_0x7366('0x12')](function(_0x22ed7e){process[_0x7366('0x1f')](_0xaab659);return pm2[_0x7366('0x21')]({'name':_0x3f23cd[_0x7366('0x1b')][_0x7366('0xc')],'script':_0x16e038});})[_0x7366('0x12')](function(_0x563b22){pm2[_0x7366('0x22')]();return _0x563b22[0x0];})['then'](respondWithResult(_0x52b43e,0xc9))[_0x7366('0x17')](handleError(_0x52b43e,null));}else{return _0x52b43e['status'](0x1f4)['send']({'message':_0x7366('0x23')});}};exports['update']=function(_0x254374,_0x4ac138){if(_0x254374[_0x7366('0x1b')]['id']){delete _0x254374[_0x7366('0x1b')]['id'];}var _0x5c37e2={'online':_0x7366('0x24'),'stopped':'stop'};if(_0x5c37e2[_0x7366('0x25')](_0x254374[_0x7366('0x1b')]['status'])){return pm2[_0x5c37e2[_0x254374[_0x7366('0x1b')]['status']]](_0x254374[_0x7366('0x26')]['id'])[_0x7366('0x12')](respondWithResult(_0x4ac138,0xc8))[_0x7366('0x17')](handleError(_0x4ac138,null));}else{return _0x4ac138[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20status'});}};exports[_0x7366('0x27')]=function(_0x447807,_0x538d42){if(_0x447807['body']['id']){delete _0x447807['body']['id'];}if(_0x447807['params']['id']){return pm2[_0x7366('0x28')](_0x447807[_0x7366('0x26')]['id'])[_0x7366('0x12')](function(_0x15286a){pm2['dump']();return _0x15286a[0x0];})[_0x7366('0x12')](respondWithResult(_0x538d42,null))[_0x7366('0x17')](handleError(_0x538d42,null));}else{return _0x538d42[_0x7366('0x8')](0x1f4)[_0x7366('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index cacc02a..bb47bdd 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 _0x0454=['getAgents','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x343865,_0x2fd864){var _0x2bc6b9=function(_0x424d98){while(--_0x424d98){_0x343865['push'](_0x343865['shift']());}};_0x2bc6b9(++_0x2fd864);}(_0x0454,0x1f3));var _0x4045=function(_0x4074e2,_0x2854bf){_0x4074e2=_0x4074e2-0x0;var _0x1b8baf=_0x0454[_0x4074e2];return _0x1b8baf;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4045('0x0'));var controller=require(_0x4045('0x1'));router[_0x4045('0x2')](_0x4045('0x3'),auth[_0x4045('0x4')](),controller[_0x4045('0x5')]);router[_0x4045('0x2')]('/queues',auth[_0x4045('0x4')](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x6ab3=['/agents','isAuthenticated','get','exports','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0x6ab3,0x84));var _0x36ab=function(_0x290492,_0x18cfad){_0x290492=_0x290492-0x0;var _0x52b5bf=_0x6ab3[_0x290492];return _0x52b5bf;};'use strict';var express=require(_0x36ab('0x0'));var router=express[_0x36ab('0x1')]();var auth=require(_0x36ab('0x2'));var controller=require(_0x36ab('0x3'));router['get'](_0x36ab('0x4'),auth[_0x36ab('0x5')](),controller['getAgents']);router[_0x36ab('0x6')]('/queues',auth[_0x36ab('0x5')](),controller['getQueues']);module[_0x36ab('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 8eb3cbc..1f65f43 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 _0x2da0=['outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','initializeQueues','catch','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','APIBadRequestError','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','query','globalQueueFilter','pause','*pause','resolve','then','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter','getUpdatedSortOptions','fields','join','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','role','agent','getOptions','raw','length','push','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','assign','omit','UserProfile','getResources','findAndCountAll','find','globalStatus','getAgentStatus','voice','voiceStatus','Status','getRealtimeAgentsQueryFields','pick','format','startCase','key','name'];(function(_0x151dee,_0x3f620f){var _0x36879b=function(_0x5a7c23){while(--_0x5a7c23){_0x151dee['push'](_0x151dee['shift']());}};_0x36879b(++_0x3f620f);}(_0x2da0,0x101));var _0x02da=function(_0x1220b9,_0xa70210){_0x1220b9=_0x1220b9-0x0;var _0x74dbe2=_0x2da0[_0x1220b9];return _0x74dbe2;};'use strict';var _=require('lodash');var util=require(_0x02da('0x0'));var rta=require(_0x02da('0x1'));var rtq=require(_0x02da('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0x02da('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0x02da('0x4')];var APIHandleError=require(_0x02da('0x5'))[_0x02da('0x6')];function respondWithFilteredResult(_0x34de64,_0x12835a){return function(_0x2f4feb){if(_0x2f4feb){var _0x4985be=typeof _0x12835a[_0x02da('0x7')]===_0x02da('0x8')&&typeof _0x12835a[_0x02da('0x9')]==='undefined';var _0x6a17af=_0x2f4feb['count'];var _0x1712ac=_0x4985be?0x0:_0x12835a[_0x02da('0x7')];var _0xf2fc90=_0x4985be?_0x2f4feb[_0x02da('0xa')]:_0x12835a[_0x02da('0x7')]+_0x12835a['limit'];var _0x65a329;if(_0xf2fc90>=_0x6a17af){_0xf2fc90=_0x6a17af;_0x65a329=0xc8;}else{_0x65a329=0xce;}_0x34de64[_0x02da('0xb')](_0x65a329);return _0x34de64[_0x02da('0xc')](_0x02da('0xd'),_0x1712ac+'-'+_0xf2fc90+'/'+_0x6a17af)[_0x02da('0xe')](_0x2f4feb);}return null;};}exports[_0x02da('0xf')]=function(_0x529c77,_0x1bea8b){var _0x2db2a0={'count':0x0,'rows':[]};var _0x389303={};var _0x406f54;var _0x490508=utils['getChannels']();var _0x2ae5a3;var _0x44dc45;var _0x3e9f1a=_0x529c77[_0x02da('0x10')][_0x02da('0x11')];var _0x5850e0=_0x529c77[_0x02da('0x10')]['globalStatusFilter'];var _0x35373c=_0x529c77[_0x02da('0x10')]['pauseTypeFilter'];var _0x2e3fa2=_0x5850e0===_0x02da('0x12')||_0x5850e0===_0x02da('0x13')?!![]:![];var _0x59639d=[];var _0x516047;var _0x539bd5;Promise[_0x02da('0x14')]()[_0x02da('0x15')](function(){if(_0x529c77[_0x02da('0x10')][_0x02da('0x16')]){if(!utils[_0x02da('0x17')](_0x529c77[_0x02da('0x10')]['channel'])){throw new APIBadRequestError(util['format'](_0x02da('0x18'),_0x529c77['query'][_0x02da('0x16')]));}_0x406f54=_0x529c77[_0x02da('0x10')]['channel'][_0x02da('0x19')]();}if(!_0x529c77[_0x02da('0x10')][_0x02da('0x1a')]||!_0x529c77['query'][_0x02da('0x1a')][_0x02da('0x1b')]('globalStatus')){_0x529c77['query'][_0x02da('0x1a')]=rta[_0x02da('0x1c')](_0x529c77[_0x02da('0x10')][_0x02da('0x1a')]);return;}var _0x2e6e71=rta[_0x02da('0x1d')](_0x529c77['query']['sort']);_0x529c77[_0x02da('0x10')][_0x02da('0x1a')]=_0x2e6e71[_0x02da('0x1e')][_0x02da('0x1f')](',');_0x516047=_0x2e6e71['order'];})[_0x02da('0x15')](function(){if(!_0x3e9f1a){return[];}return rta[_0x02da('0x20')](_0x3e9f1a,_0x406f54);})['then'](function(_0x308427){_0x59639d=_0x308427;return rta[_0x02da('0x21')]();})[_0x02da('0x15')](function(_0x447c15){_0x44dc45=_0x447c15[_0x02da('0x22')];if((!_0x5850e0||_0x2e3fa2)&&!_0x516047){return _0x59639d;}if(_0x516047&&!_0x5850e0){return rta[_0x02da('0x23')](_0x44dc45,_0x59639d,_0x516047);}else{return rta[_0x02da('0x24')](_0x44dc45,_0x59639d,_0x5850e0);}})[_0x02da('0x15')](function(_0x20c987){_0x59639d=_0x20c987;var _0x79c37=![];if(_0x59639d['length']===0x0){if(_0x3e9f1a||_0x5850e0){_0x79c37=!![];}if(_0x2e3fa2){_0x79c37=![];}}if(_0x79c37){return _0x2db2a0;}var _0x59435b=_[_0x02da('0x25')](db[_0x02da('0x26')][_0x02da('0x27')],function(_0x2c096a){return{'name':_0x2c096a[_0x02da('0x28')],'type':_0x2c096a[_0x02da('0x29')]['key']};});_0x529c77['query'][_0x02da('0x2a')]=_0x02da('0x2b');_0x389303=qs[_0x02da('0x2c')](_0x59435b,_0x529c77);_0x389303[_0x02da('0x2d')]=!![];var _0x37efd3=[];if(_0x59639d[_0x02da('0x2e')]>0x0){_0x37efd3[_0x02da('0x2f')]({'id':{'$in':_0x59639d}});if(_0x516047&&!_0x5850e0){_0x539bd5=[db['sequelize'][_0x02da('0x30')](_0x02da('0x31')+_0x59639d+')')];_0x389303['order']=_0x539bd5;}}if(_0x2e3fa2){_0x490508['forEach'](function(_0x5ee847){var _0x384ae6=!![];if(_0x5850e0===_0x02da('0x13')&&_0x406f54!==_0x5ee847){_0x384ae6=![];}_0x37efd3[_0x02da('0x2f')]({[_0x5ee847+'Pause']:_0x384ae6});});if(_0x35373c){_0x37efd3['push']({'pauseType':_0x35373c});}}else if(_0x5850e0){_0x490508[_0x02da('0x32')](function(_0x5ec098){_0x37efd3[_0x02da('0x2f')]({[_0x5ec098+_0x02da('0x33')]:![]});});}_0x389303[_0x02da('0x34')]=_[_0x02da('0x35')](_0x389303[_0x02da('0x34')],{'$and':_0x37efd3});if(_0x529c77[_0x02da('0x36')][_0x02da('0x2a')]===_0x02da('0x36')){var _0x34bc26={'params':{'id':_0x529c77[_0x02da('0x36')][_0x02da('0x37')]},'query':{'section':_0x02da('0x38'),'role':_0x02da('0x2b'),'raw':!![],'ids':_0x59639d,'customSorting':_0x539bd5}};if(_0x529c77[_0x02da('0x10')][_0x02da('0x39')]){_0x34bc26[_0x02da('0x10')][_0x02da('0x39')]=!![];}if(_0x2e3fa2){_0x34bc26[_0x02da('0x10')]['extraQueryConditions']=_0x37efd3;}_0x34bc26[_0x02da('0x10')]=Object[_0x02da('0x3a')](_0x34bc26[_0x02da('0x10')],_[_0x02da('0x3b')](_0x529c77['query'],'id'));return db[_0x02da('0x3c')][_0x02da('0x3d')](_0x34bc26);}return db[_0x02da('0x26')][_0x02da('0x3e')](_0x389303);})[_0x02da('0x15')](function(_0x10dbf2){_0x2db2a0[_0x02da('0xa')]=_0x10dbf2[_0x02da('0xa')];_0x2ae5a3=_0x10dbf2[_0x02da('0x22')];return _0x2ae5a3[_0x02da('0x25')](function(_0x1be5e2){var _0x168430=_[_0x02da('0x3f')](_0x44dc45,['id',_0x1be5e2['id']]);if(_0x168430){var _0xdc56c=rta['filterAgentAttributes'](_0x168430);_[_0x02da('0x35')](_0x1be5e2,_0xdc56c);}_0x1be5e2[_0x02da('0x40')]=rta[_0x02da('0x41')](_0x1be5e2);if(_0x1be5e2[_0x02da('0x40')][_0x02da('0x1b')](_0x02da('0x12'))){_0x490508[_0x02da('0x32')](function(_0x370d8b){if(_0x1be5e2[_0x370d8b+_0x02da('0x33')]){if(_0x370d8b===_0x02da('0x42')){if(_0x1be5e2['voiceStatus']!=='talking'){_0x1be5e2[_0x02da('0x43')]=_0x02da('0x12');}}else{_0x1be5e2[_0x370d8b+_0x02da('0x44')]='pause';}}});}return _0x1be5e2;});})['then'](function(_0x13b03b){if(!_0x516047||_0x539bd5){return _0x13b03b;}return rta['sortAgentsByStatus'](_0x13b03b,_0x516047);})['then'](function(_0x110014){var _0x367fc9=rta[_0x02da('0x45')]();_0x2db2a0['rows']=_0x110014[_0x02da('0x25')](function(_0x11917d){return _[_0x02da('0x46')](_0x11917d,_0x367fc9);});return _0x2db2a0;})[_0x02da('0x15')](respondWithFilteredResult(_0x1bea8b,_0x389303))['catch'](APIHandleError(_0x1bea8b));};exports['getQueues']=function(_0x4318f9,_0x8b9bdc){var _0x564c95={'count':0x0,'rows':[]};var _0xfcccd0={};var _0x4dd33f;var _0x5aa255;var _0x48aa5e;Promise[_0x02da('0x14')]()['then'](function(){if(_0x4318f9[_0x02da('0x10')][_0x02da('0x16')]){if(!utils[_0x02da('0x17')](_0x4318f9[_0x02da('0x10')][_0x02da('0x16')])){throw new APIBadRequestError(util[_0x02da('0x47')](_0x02da('0x18'),_0x4318f9[_0x02da('0x10')]['channel']));}_0x4dd33f=_0x4318f9[_0x02da('0x10')]['channel'][_0x02da('0x19')]();}var _0x418f8c=_[_0x02da('0x48')](_0x4dd33f)+'Queue';var _0x5a55ca=_[_0x02da('0x25')](db[_0x418f8c][_0x02da('0x27')],function(_0x4437b6){return{'name':_0x4437b6[_0x02da('0x28')],'type':_0x4437b6[_0x02da('0x29')][_0x02da('0x49')]};});if(!_0x4318f9['query'][_0x02da('0x1e')]){var _0x1db667=['id',_0x02da('0x4a')];if(_0x4dd33f===_0x02da('0x42')){_0x1db667[_0x02da('0x2f')](_0x02da('0x29'));if(_0x4318f9[_0x02da('0x10')]['type']===_0x02da('0x4b')){_0x1db667['push']([_0x02da('0x4c'),_0x02da('0x4d')]);}}_0x4318f9[_0x02da('0x10')]['fields']=_0x1db667['join'](',');}_0xfcccd0=qs['getOptions'](_0x5a55ca,_0x4318f9);if(_0x4318f9['user'][_0x02da('0x2a')]===_0x02da('0x36')){var _0xe90e76={'params':{'id':_0x4318f9[_0x02da('0x36')][_0x02da('0x37')]},'query':{'section':_0x4dd33f===_0x02da('0x42')&&_0x4318f9['query'][_0x02da('0x29')]===_0x02da('0x4b')?_0x02da('0x4e'):_[_0x02da('0x48')](_0x4dd33f)+_0x02da('0x4f'),'type':_0x4318f9[_0x02da('0x10')][_0x02da('0x29')],'nolimit':!![],'sort':_0x02da('0x4a'),'filter':_0x4318f9[_0x02da('0x10')][_0x02da('0x50')]}};_0xe90e76['query']=Object[_0x02da('0x3a')](_0xe90e76[_0x02da('0x10')],_0x4318f9[_0x02da('0x10')]);delete _0xe90e76[_0x02da('0x10')]['id'];return db[_0x02da('0x3c')][_0x02da('0x3d')](_0xe90e76);}return db[_0x418f8c][_0x02da('0x3e')](_0xfcccd0);})[_0x02da('0x15')](function(_0x4fe75b){_0x564c95['count']=_0x4fe75b[_0x02da('0xa')];_0x5aa255=_0x4fe75b[_0x02da('0x22')];return rtq['getRealtimeQueues'](_0x4318f9,_0x4dd33f);})[_0x02da('0x15')](function(_0xf6183a){_0x48aa5e=_0xf6183a['rows'];return rtq[_0x02da('0x51')](_0x5aa255,_0x48aa5e,_0x4dd33f,_0x4318f9['query'][_0x02da('0x29')]);})[_0x02da('0x15')](function(_0x2e5e59){_0x564c95[_0x02da('0x22')]=_0x2e5e59;return _0x564c95;})[_0x02da('0x15')](respondWithFilteredResult(_0x8b9bdc,_0xfcccd0))[_0x02da('0x52')](APIHandleError(_0x8b9bdc));}; \ No newline at end of file +var _0x2922=['join','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','push','sequelize','forEach','Pause','where','merge','user','Agents','online','extraQueryConditions','omit','UserProfile','getResources','findAndCountAll','rows','map','filterAgentAttributes','globalStatus','getAgentStatus','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','toLowerCase','Queue','type','fields','name','dialActive','dialMethod','userProfileId','outbound','QueueCampaigns','Queues','filter','assign','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','undefined','limit','offset','count','status','set','Content-Range','getAgents','query','globalQueueFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','validateSortParameter'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2922,0x1dd));var _0x2292=function(_0x4adbb2,_0x257580){_0x4adbb2=_0x4adbb2-0x0;var _0x724b18=_0x2922[_0x4adbb2];return _0x724b18;};'use strict';var _=require('lodash');var util=require(_0x2292('0x0'));var rta=require(_0x2292('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x2292('0x2'));var utils=require(_0x2292('0x3'));var db=require(_0x2292('0x4'))['db'];var APIBadRequestError=require(_0x2292('0x5'))[_0x2292('0x6')];var APIHandleError=require(_0x2292('0x5'))['handleError'];function respondWithFilteredResult(_0x585f26,_0x5577b9){return function(_0x2ac1d5){if(_0x2ac1d5){var _0x5168e8=typeof _0x5577b9['offset']===_0x2292('0x7')&&typeof _0x5577b9[_0x2292('0x8')]===_0x2292('0x7');var _0x5ec88a=_0x2ac1d5['count'];var _0x54bf44=_0x5168e8?0x0:_0x5577b9[_0x2292('0x9')];var _0x4cd285=_0x5168e8?_0x2ac1d5[_0x2292('0xa')]:_0x5577b9[_0x2292('0x9')]+_0x5577b9[_0x2292('0x8')];var _0x3b3b75;if(_0x4cd285>=_0x5ec88a){_0x4cd285=_0x5ec88a;_0x3b3b75=0xc8;}else{_0x3b3b75=0xce;}_0x585f26[_0x2292('0xb')](_0x3b3b75);return _0x585f26[_0x2292('0xc')](_0x2292('0xd'),_0x54bf44+'-'+_0x4cd285+'/'+_0x5ec88a)['json'](_0x2ac1d5);}return null;};}exports[_0x2292('0xe')]=function(_0xf7e1a0,_0x35cfa5){var _0x514437={'count':0x0,'rows':[]};var _0x515489={};var _0x128acf;var _0x49b065=utils['getChannels']();var _0x2981ee;var _0x3355bf;var _0x4e154b=_0xf7e1a0[_0x2292('0xf')][_0x2292('0x10')];var _0x360781=_0xf7e1a0['query']['globalStatusFilter'];var _0x5a0f0f=_0xf7e1a0[_0x2292('0xf')]['pauseTypeFilter'];var _0x5737d6=_0x360781===_0x2292('0x11')||_0x360781===_0x2292('0x12')?!![]:![];var _0x16d8e2=[];var _0x39d11f;var _0xdd4afe;Promise[_0x2292('0x13')]()[_0x2292('0x14')](function(){if(_0xf7e1a0[_0x2292('0xf')][_0x2292('0x15')]){if(!utils[_0x2292('0x16')](_0xf7e1a0[_0x2292('0xf')][_0x2292('0x15')])){throw new APIBadRequestError(util[_0x2292('0x17')](_0x2292('0x18'),_0xf7e1a0['query']['channel']));}_0x128acf=_0xf7e1a0[_0x2292('0xf')][_0x2292('0x15')]['toLowerCase']();}if(!_0xf7e1a0[_0x2292('0xf')][_0x2292('0x19')]||!_0xf7e1a0[_0x2292('0xf')][_0x2292('0x19')]['includes']('globalStatus')){_0xf7e1a0['query'][_0x2292('0x19')]=rta[_0x2292('0x1a')](_0xf7e1a0['query'][_0x2292('0x19')]);return;}var _0x364c6a=rta['getUpdatedSortOptions'](_0xf7e1a0[_0x2292('0xf')]['sort']);_0xf7e1a0[_0x2292('0xf')]['sort']=_0x364c6a['fields'][_0x2292('0x1b')](',');_0x39d11f=_0x364c6a['order'];})[_0x2292('0x14')](function(){if(!_0x4e154b){return[];}return rta[_0x2292('0x1c')](_0x4e154b,_0x128acf);})[_0x2292('0x14')](function(_0x45afda){_0x16d8e2=_0x45afda;return rta[_0x2292('0x1d')]();})[_0x2292('0x14')](function(_0x12a875){_0x3355bf=_0x12a875['rows'];if((!_0x360781||_0x5737d6)&&!_0x39d11f){return _0x16d8e2;}if(_0x39d11f&&!_0x360781){return rta[_0x2292('0x1e')](_0x3355bf,_0x16d8e2,_0x39d11f);}else{return rta[_0x2292('0x1f')](_0x3355bf,_0x16d8e2,_0x360781);}})[_0x2292('0x14')](function(_0x5e97d5){_0x16d8e2=_0x5e97d5;var _0x39bbe8=![];if(_0x16d8e2[_0x2292('0x20')]===0x0){if(_0x4e154b||_0x360781){_0x39bbe8=!![];}if(_0x5737d6){_0x39bbe8=![];}}if(_0x39bbe8){return _0x514437;}var _0x3c1041=_['map'](db[_0x2292('0x21')][_0x2292('0x22')],function(_0x329191){return{'name':_0x329191[_0x2292('0x23')],'type':_0x329191['type'][_0x2292('0x24')]};});_0xf7e1a0[_0x2292('0xf')][_0x2292('0x25')]=_0x2292('0x26');_0x515489=qs[_0x2292('0x27')](_0x3c1041,_0xf7e1a0);_0x515489[_0x2292('0x28')]=!![];var _0x138b2f=[];if(_0x16d8e2['length']>0x0){_0x138b2f[_0x2292('0x29')]({'id':{'$in':_0x16d8e2}});if(_0x39d11f&&!_0x360781){_0xdd4afe=[db[_0x2292('0x2a')]['literal']('FIELD(id,'+_0x16d8e2+')')];_0x515489['order']=_0xdd4afe;}}if(_0x5737d6){_0x49b065[_0x2292('0x2b')](function(_0x5ac117){var _0x5d069e=!![];if(_0x360781==='*pause'&&_0x128acf!==_0x5ac117){_0x5d069e=![];}_0x138b2f[_0x2292('0x29')]({[_0x5ac117+_0x2292('0x2c')]:_0x5d069e});});if(_0x5a0f0f){_0x138b2f[_0x2292('0x29')]({'pauseType':_0x5a0f0f});}}else if(_0x360781){_0x49b065[_0x2292('0x2b')](function(_0x2819fd){_0x138b2f[_0x2292('0x29')]({[_0x2819fd+_0x2292('0x2c')]:![]});});}_0x515489[_0x2292('0x2d')]=_[_0x2292('0x2e')](_0x515489[_0x2292('0x2d')],{'$and':_0x138b2f});if(_0xf7e1a0[_0x2292('0x2f')][_0x2292('0x25')]===_0x2292('0x2f')){var _0xc1e22={'params':{'id':_0xf7e1a0[_0x2292('0x2f')]['userProfileId']},'query':{'section':_0x2292('0x30'),'role':_0x2292('0x26'),'raw':!![],'ids':_0x16d8e2,'customSorting':_0xdd4afe}};if(_0xf7e1a0[_0x2292('0xf')][_0x2292('0x31')]){_0xc1e22[_0x2292('0xf')][_0x2292('0x31')]=!![];}if(_0x5737d6){_0xc1e22[_0x2292('0xf')][_0x2292('0x32')]=_0x138b2f;}_0xc1e22[_0x2292('0xf')]=Object['assign'](_0xc1e22[_0x2292('0xf')],_[_0x2292('0x33')](_0xf7e1a0[_0x2292('0xf')],'id'));return db[_0x2292('0x34')][_0x2292('0x35')](_0xc1e22);}return db[_0x2292('0x21')][_0x2292('0x36')](_0x515489);})[_0x2292('0x14')](function(_0x12a4cd){_0x514437[_0x2292('0xa')]=_0x12a4cd[_0x2292('0xa')];_0x2981ee=_0x12a4cd[_0x2292('0x37')];return _0x2981ee[_0x2292('0x38')](function(_0x451521){var _0x5a49e9=_['find'](_0x3355bf,['id',_0x451521['id']]);if(_0x5a49e9){var _0x4a42d1=rta[_0x2292('0x39')](_0x5a49e9);_[_0x2292('0x2e')](_0x451521,_0x4a42d1);}_0x451521[_0x2292('0x3a')]=rta[_0x2292('0x3b')](_0x451521);if(_0x451521[_0x2292('0x3a')][_0x2292('0x3c')](_0x2292('0x11'))){_0x49b065['forEach'](function(_0x5306a3){if(_0x451521[_0x5306a3+_0x2292('0x2c')]){if(_0x5306a3===_0x2292('0x3d')){if(_0x451521[_0x2292('0x3e')]!==_0x2292('0x3f')){_0x451521['voiceStatus']=_0x2292('0x11');}}else{_0x451521[_0x5306a3+_0x2292('0x40')]='pause';}}});}return _0x451521;});})[_0x2292('0x14')](function(_0x378da6){if(!_0x39d11f||_0xdd4afe){return _0x378da6;}return rta[_0x2292('0x41')](_0x378da6,_0x39d11f);})['then'](function(_0x4f6443){var _0x78ca8e=rta[_0x2292('0x42')]();_0x514437[_0x2292('0x37')]=_0x4f6443[_0x2292('0x38')](function(_0x8820ac){return _['pick'](_0x8820ac,_0x78ca8e);});return _0x514437;})[_0x2292('0x14')](respondWithFilteredResult(_0x35cfa5,_0x515489))[_0x2292('0x43')](APIHandleError(_0x35cfa5));};exports[_0x2292('0x44')]=function(_0x1ff654,_0x53eea0){var _0x347c0c={'count':0x0,'rows':[]};var _0x4069f4={};var _0x6caeb2;var _0x20bafc;var _0x211950;Promise[_0x2292('0x13')]()[_0x2292('0x14')](function(){if(_0x1ff654[_0x2292('0xf')][_0x2292('0x15')]){if(!utils[_0x2292('0x16')](_0x1ff654['query'][_0x2292('0x15')])){throw new APIBadRequestError(util[_0x2292('0x17')](_0x2292('0x18'),_0x1ff654[_0x2292('0xf')][_0x2292('0x15')]));}_0x6caeb2=_0x1ff654[_0x2292('0xf')]['channel'][_0x2292('0x45')]();}var _0x23aefb=_['startCase'](_0x6caeb2)+_0x2292('0x46');var _0x2dda47=_[_0x2292('0x38')](db[_0x23aefb][_0x2292('0x22')],function(_0x25db8c){return{'name':_0x25db8c[_0x2292('0x23')],'type':_0x25db8c[_0x2292('0x47')][_0x2292('0x24')]};});if(!_0x1ff654[_0x2292('0xf')][_0x2292('0x48')]){var _0xb916f3=['id',_0x2292('0x49')];if(_0x6caeb2===_0x2292('0x3d')){_0xb916f3[_0x2292('0x29')](_0x2292('0x47'));if(_0x1ff654[_0x2292('0xf')][_0x2292('0x47')]==='outbound'){_0xb916f3[_0x2292('0x29')]([_0x2292('0x4a'),_0x2292('0x4b')]);}}_0x1ff654['query'][_0x2292('0x48')]=_0xb916f3[_0x2292('0x1b')](',');}_0x4069f4=qs[_0x2292('0x27')](_0x2dda47,_0x1ff654);if(_0x1ff654[_0x2292('0x2f')][_0x2292('0x25')]===_0x2292('0x2f')){var _0x3d6574={'params':{'id':_0x1ff654[_0x2292('0x2f')][_0x2292('0x4c')]},'query':{'section':_0x6caeb2==='voice'&&_0x1ff654[_0x2292('0xf')][_0x2292('0x47')]===_0x2292('0x4d')?_0x2292('0x4e'):_['startCase'](_0x6caeb2)+_0x2292('0x4f'),'type':_0x1ff654[_0x2292('0xf')]['type'],'nolimit':!![],'sort':_0x2292('0x49'),'filter':_0x1ff654['query'][_0x2292('0x50')]}};_0x3d6574[_0x2292('0xf')]=Object[_0x2292('0x51')](_0x3d6574['query'],_0x1ff654[_0x2292('0xf')]);delete _0x3d6574[_0x2292('0xf')]['id'];return db[_0x2292('0x34')][_0x2292('0x35')](_0x3d6574);}return db[_0x23aefb][_0x2292('0x36')](_0x4069f4);})[_0x2292('0x14')](function(_0x55e707){_0x347c0c[_0x2292('0xa')]=_0x55e707[_0x2292('0xa')];_0x20bafc=_0x55e707[_0x2292('0x37')];return rtq[_0x2292('0x52')](_0x1ff654,_0x6caeb2);})['then'](function(_0x3f62f2){_0x211950=_0x3f62f2['rows'];return rtq[_0x2292('0x53')](_0x20bafc,_0x211950,_0x6caeb2,_0x1ff654[_0x2292('0xf')]['type']);})['then'](function(_0x300ff5){_0x347c0c[_0x2292('0x37')]=_0x300ff5;return _0x347c0c;})['then'](respondWithFilteredResult(_0x53eea0,_0x4069f4))[_0x2292('0x43')](APIHandleError(_0x53eea0));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f296a1c..3aef669 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x583682,_0x3ab782){var _0xcbad4c=function(_0x2d9058){while(--_0x2d9058){_0x583682['push'](_0x583682['shift']());}};_0xcbad4c(++_0x3ab782);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x31f6ad,_0x41f09c){var _0x130bfc=function(_0x4cac06){while(--_0x4cac06){_0x31f6ad['push'](_0x31f6ad['shift']());}};_0x130bfc(++_0x41f09c);}(_0x70e0,0x17b));var _0x070e=function(_0x31cb6f,_0x5bae5a){_0x31cb6f=_0x31cb6f-0x0;var _0xa99709=_0x70e0[_0x31cb6f];return _0xa99709;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index b017657..5195472 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 _0x975f=['DATE','sequelize','INTEGER','STRING'];(function(_0x3a179f,_0x2a93a5){var _0x4a04dc=function(_0x41f0f3){while(--_0x41f0f3){_0x3a179f['push'](_0x3a179f['shift']());}};_0x4a04dc(++_0x2a93a5);}(_0x975f,0x191));var _0xf975=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x975f[_0x296897];return _0x2b44ab;};'use strict';var Sequelize=require(_0xf975('0x0'));module['exports']={'state':{'type':Sequelize[_0xf975('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xf975('0x2')]},'scheduledat':{'type':Sequelize[_0xf975('0x3')]},'uniqueid':{'type':Sequelize[_0xf975('0x2')]},'starttime':{'type':Sequelize[_0xf975('0x3')]},'responsetime':{'type':Sequelize[_0xf975('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf975('0x2')]},'campaigntype':{'type':Sequelize[_0xf975('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x02b6=['STRING','DATE','sequelize','INTEGER'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x02b6,0xfe));var _0x602b=function(_0xd7b72c,_0x3a1e5e){_0xd7b72c=_0xd7b72c-0x0;var _0x5a9d44=_0x02b6[_0xd7b72c];return _0x5a9d44;};'use strict';var Sequelize=require(_0x602b('0x0'));module['exports']={'state':{'type':Sequelize[_0x602b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x602b('0x2')]},'scheduledat':{'type':Sequelize[_0x602b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x602b('0x3')]},'ringtime':{'type':Sequelize[_0x602b('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x602b('0x2')]},'campaigntype':{'type':Sequelize[_0x602b('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index e37a6c6..c533159 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 _0x5fec=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','ReportAgentPreview','report_agent_preview'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0x5fec,0x1dd));var _0xc5fe=function(_0x469291,_0x5b6328){_0x469291=_0x469291-0x0;var _0x5eaf63=_0x5fec[_0x469291];return _0x5eaf63;};'use strict';var _=require(_0xc5fe('0x0'));var util=require('util');var logger=require(_0xc5fe('0x1'))(_0xc5fe('0x2'));var moment=require(_0xc5fe('0x3'));var BPromise=require(_0xc5fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5fe('0x5'));var rimraf=require(_0xc5fe('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x5a487b,_0x270795){return _0x5a487b['define'](_0xc5fe('0x7'),attributes,{'tableName':_0xc5fe('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba9e=['report_agent_preview','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview'];(function(_0x4d8db1,_0x141f8a){var _0x25fd9a=function(_0x244cf9){while(--_0x244cf9){_0x4d8db1['push'](_0x4d8db1['shift']());}};_0x25fd9a(++_0x141f8a);}(_0xba9e,0x1e5));var _0xeba9=function(_0x1fd139,_0x358767){_0x1fd139=_0x1fd139-0x0;var _0x354a9d=_0xba9e[_0x1fd139];return _0x354a9d;};'use strict';var _=require(_0xeba9('0x0'));var util=require('util');var logger=require(_0xeba9('0x1'))(_0xeba9('0x2'));var moment=require(_0xeba9('0x3'));var BPromise=require('bluebird');var rp=require(_0xeba9('0x4'));var fs=require('fs');var path=require(_0xeba9('0x5'));var rimraf=require('rimraf');var config=require(_0xeba9('0x6'));var attributes=require(_0xeba9('0x7'));module[_0xeba9('0x8')]=function(_0x369388,_0x50f7aa){return _0x369388['define'](_0xeba9('0x9'),attributes,{'tableName':_0xeba9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 0a20c9a..f92f560 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 _0x2a52=['create','body','options','raw','then','stringify','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','message','result','CreateReportAgentPreview'];(function(_0x1e4a4a,_0x625229){var _0x215c1d=function(_0x2d6a79){while(--_0x2d6a79){_0x1e4a4a['push'](_0x1e4a4a['shift']());}};_0x215c1d(++_0x625229);}(_0x2a52,0xef));var _0x22a5=function(_0x3d5d10,_0x5a8cfa){_0x3d5d10=_0x3d5d10-0x0;var _0x43e1fa=_0x2a52[_0x3d5d10];return _0x43e1fa;};'use strict';var _=require(_0x22a5('0x0'));var util=require(_0x22a5('0x1'));var moment=require(_0x22a5('0x2'));var BPromise=require(_0x22a5('0x3'));var rs=require(_0x22a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x22a5('0x5'));var logger=require(_0x22a5('0x6'))(_0x22a5('0x7'));var config=require(_0x22a5('0x8'));var jayson=require(_0x22a5('0x9'));var client=jayson[_0x22a5('0xa')][_0x22a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x112a53,_0x3e663b,_0x40b7f6){return new BPromise(function(_0xea1c45,_0x47902d){return client[_0x22a5('0xc')](_0x112a53,_0x40b7f6)['then'](function(_0x5c1685){logger[_0x22a5('0xd')](_0x22a5('0xe'),_0x3e663b,_0x22a5('0xf'));logger[_0x22a5('0x10')](_0x22a5('0x11'),_0x3e663b,_0x22a5('0xf'),JSON['stringify'](_0x5c1685));if(_0x5c1685[_0x22a5('0x12')]){if(_0x5c1685[_0x22a5('0x12')]['code']===0x1f4){logger['error'](_0x22a5('0xe'),_0x3e663b,_0x5c1685[_0x22a5('0x12')][_0x22a5('0x13')]);return _0x47902d(_0x5c1685['error'][_0x22a5('0x13')]);}logger['error'](_0x22a5('0xe'),_0x3e663b,_0x5c1685[_0x22a5('0x12')]['message']);return _0xea1c45(_0x5c1685[_0x22a5('0x12')]['message']);}else{logger[_0x22a5('0xd')](_0x22a5('0xe'),_0x3e663b,_0x22a5('0xf'));_0xea1c45(_0x5c1685[_0x22a5('0x14')][_0x22a5('0x13')]);}})['catch'](function(_0x3a8525){logger[_0x22a5('0x12')](_0x22a5('0xe'),_0x3e663b,_0x3a8525);_0x47902d(_0x3a8525);});});}exports[_0x22a5('0x15')]=function(_0x978504){var _0x3cb837=this;return new Promise(function(_0x571d78,_0x3d88ac){return db['ReportAgentPreview'][_0x22a5('0x16')](_0x978504[_0x22a5('0x17')],{'raw':_0x978504[_0x22a5('0x18')]?_0x978504[_0x22a5('0x18')][_0x22a5('0x19')]===undefined?!![]:![]:!![]})[_0x22a5('0x1a')](function(_0x371db2){logger['info'](_0x22a5('0x15'),_0x978504);logger[_0x22a5('0x10')](_0x22a5('0x15'),_0x978504,JSON[_0x22a5('0x1b')](_0x371db2));_0x571d78(_0x371db2);})[_0x22a5('0x1c')](function(_0x39cb26){logger[_0x22a5('0x12')]('CreateReportAgentPreview',_0x39cb26[_0x22a5('0x13')],_0x978504);_0x3d88ac(_0x3cb837[_0x22a5('0x12')](0x1f4,_0x39cb26[_0x22a5('0x13')]));});});}; \ No newline at end of file +var _0xb711=['stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch','CreateReportAgentPreview','create','body','options','raw','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3875b1,_0x47cf1a){var _0x1e9c55=function(_0xc8e89b){while(--_0xc8e89b){_0x3875b1['push'](_0x3875b1['shift']());}};_0x1e9c55(++_0x47cf1a);}(_0xb711,0x8b));var _0x1b71=function(_0x54f38a,_0x12a765){_0x54f38a=_0x54f38a-0x0;var _0x49322d=_0xb711[_0x54f38a];return _0x49322d;};'use strict';var _=require(_0x1b71('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1b71('0x1'));var fs=require('fs');var Redis=require(_0x1b71('0x2'));var db=require(_0x1b71('0x3'))['db'];var utils=require(_0x1b71('0x4'));var logger=require('../../config/logger')(_0x1b71('0x5'));var config=require(_0x1b71('0x6'));var jayson=require(_0x1b71('0x7'));var client=jayson[_0x1b71('0x8')][_0x1b71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11435c,_0x3b3eef,_0xb38e12){return new BPromise(function(_0x19cfea,_0x536a24){return client['request'](_0x11435c,_0xb38e12)[_0x1b71('0xa')](function(_0x49f45a){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3b3eef,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x3b3eef,'request\x20sent',JSON[_0x1b71('0xb')](_0x49f45a));if(_0x49f45a[_0x1b71('0xc')]){if(_0x49f45a['error'][_0x1b71('0xd')]===0x1f4){logger[_0x1b71('0xc')](_0x1b71('0xe'),_0x3b3eef,_0x49f45a['error']['message']);return _0x536a24(_0x49f45a[_0x1b71('0xc')]['message']);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3b3eef,_0x49f45a[_0x1b71('0xc')][_0x1b71('0xf')]);return _0x19cfea(_0x49f45a['error']['message']);}else{logger[_0x1b71('0x10')](_0x1b71('0xe'),_0x3b3eef,'request\x20sent');_0x19cfea(_0x49f45a[_0x1b71('0x11')][_0x1b71('0xf')]);}})[_0x1b71('0x12')](function(_0x2d8c47){logger[_0x1b71('0xc')](_0x1b71('0xe'),_0x3b3eef,_0x2d8c47);_0x536a24(_0x2d8c47);});});}exports[_0x1b71('0x13')]=function(_0x23e1d7){var _0x451a49=this;return new Promise(function(_0x3d50d1,_0x2b3b58){return db['ReportAgentPreview'][_0x1b71('0x14')](_0x23e1d7[_0x1b71('0x15')],{'raw':_0x23e1d7[_0x1b71('0x16')]?_0x23e1d7[_0x1b71('0x16')][_0x1b71('0x17')]===undefined?!![]:![]:!![]})[_0x1b71('0xa')](function(_0x3d68ac){logger[_0x1b71('0x10')](_0x1b71('0x13'),_0x23e1d7);logger[_0x1b71('0x18')](_0x1b71('0x13'),_0x23e1d7,JSON[_0x1b71('0xb')](_0x3d68ac));_0x3d50d1(_0x3d68ac);})[_0x1b71('0x12')](function(_0x273248){logger[_0x1b71('0xc')](_0x1b71('0x13'),_0x273248[_0x1b71('0xf')],_0x23e1d7);_0x2b3b58(_0x451a49[_0x1b71('0xc')](0x1f4,_0x273248[_0x1b71('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 4586255..98f831e 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 _0x345e=['chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','multer','util','path','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/mail/queues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify'];(function(_0x3b3d09,_0x2f159d){var _0x51d9f1=function(_0x36a962){while(--_0x36a962){_0x3b3d09['push'](_0x3b3d09['shift']());}};_0x51d9f1(++_0x2f159d);}(_0x345e,0x156));var _0xe345=function(_0x4882c0,_0x4ed793){_0x4882c0=_0x4882c0-0x0;var _0x2fd6e2=_0x345e[_0x4882c0];return _0x2fd6e2;};'use strict';var multer=require(_0xe345('0x0'));var util=require(_0xe345('0x1'));var path=require(_0xe345('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe345('0x3'));var controller=require(_0xe345('0x4'));router[_0xe345('0x5')](_0xe345('0x6'),auth[_0xe345('0x7')](),controller[_0xe345('0x8')]);router[_0xe345('0x5')](_0xe345('0x9'),auth[_0xe345('0x7')](),controller[_0xe345('0xa')]);router[_0xe345('0x5')](_0xe345('0xb'),auth[_0xe345('0x7')](),controller[_0xe345('0xc')]);router[_0xe345('0x5')]('/voice/queues',auth[_0xe345('0x7')](),controller[_0xe345('0xd')]);router['get']('/chat/queues',auth[_0xe345('0x7')](),controller['chatQueues']);router[_0xe345('0x5')](_0xe345('0xe'),auth[_0xe345('0x7')](),controller['mailQueues']);router[_0xe345('0x5')](_0xe345('0xf'),auth['isAuthenticated'](),controller[_0xe345('0x10')]);router[_0xe345('0x5')](_0xe345('0x11'),auth[_0xe345('0x7')](),controller[_0xe345('0x12')]);router[_0xe345('0x5')](_0xe345('0x13'),auth[_0xe345('0x7')](),controller[_0xe345('0x14')]);router[_0xe345('0x5')](_0xe345('0x15'),auth[_0xe345('0x7')](),controller[_0xe345('0x16')]);router[_0xe345('0x5')](_0xe345('0x17'),auth[_0xe345('0x7')](),controller[_0xe345('0x18')]);router['get'](_0xe345('0x19'),auth[_0xe345('0x7')](),controller[_0xe345('0x1a')]);router[_0xe345('0x5')](_0xe345('0x1b'),auth[_0xe345('0x7')](),controller['voiceQueuesChannels']);router[_0xe345('0x5')](_0xe345('0x1c'),auth[_0xe345('0x7')](),controller[_0xe345('0x1d')]);router['get'](_0xe345('0x1e'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xe345('0x5')](_0xe345('0x1f'),auth['isAuthenticated'](),controller[_0xe345('0x20')]);router['get'](_0xe345('0x21'),auth[_0xe345('0x7')](),controller['showVoiceQueues']);router[_0xe345('0x22')](_0xe345('0x21'),auth[_0xe345('0x7')](),controller[_0xe345('0x23')]);router[_0xe345('0x5')]('/outbound',auth['isAuthenticated'](),controller[_0xe345('0x24')]);router[_0xe345('0x5')](_0xe345('0x25'),auth[_0xe345('0x7')](),controller[_0xe345('0x26')]);router[_0xe345('0x5')](_0xe345('0x27'),auth[_0xe345('0x7')](),controller[_0xe345('0x28')]);router[_0xe345('0x22')](_0xe345('0x29'),auth[_0xe345('0x7')](),controller[_0xe345('0x2a')]);router[_0xe345('0x5')](_0xe345('0x2b'),auth['isAuthenticated'](),controller[_0xe345('0x2c')]);router[_0xe345('0x5')](_0xe345('0x2d'),auth[_0xe345('0x7')](),controller['trunks']);router[_0xe345('0x5')](_0xe345('0x2e'),auth[_0xe345('0x7')](),controller[_0xe345('0x2f')]);router[_0xe345('0x5')]('/fax/accounts',auth[_0xe345('0x7')](),controller[_0xe345('0x30')]);router[_0xe345('0x5')](_0xe345('0x31'),auth['isAuthenticated'](),controller[_0xe345('0x32')]);router[_0xe345('0x5')](_0xe345('0x33'),auth[_0xe345('0x7')](),controller[_0xe345('0x34')]);router[_0xe345('0x5')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe345('0x35')]);router[_0xe345('0x5')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xe345('0x5')](_0xe345('0x36'),auth['isAuthenticated'](),controller[_0xe345('0x37')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xe345('0x7')](),controller[_0xe345('0x38')]);router[_0xe345('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe345('0x39')]);router[_0xe345('0x3a')]('/mail/queues/:id/notify',auth[_0xe345('0x7')](),controller[_0xe345('0x3b')](_0xe345('0x3c')));router[_0xe345('0x5')]('/mail/queues/:id',auth[_0xe345('0x7')](),controller[_0xe345('0x3d')]);router['post'](_0xe345('0x3e'),auth[_0xe345('0x7')](),controller[_0xe345('0x3b')](_0xe345('0x3f')));router[_0xe345('0x5')](_0xe345('0x40'),auth[_0xe345('0x7')](),controller[_0xe345('0x41')]);router[_0xe345('0x3a')]('/fax/queues/:id/notify',auth[_0xe345('0x7')](),controller['queueNotify']('fax'));router[_0xe345('0x5')](_0xe345('0x42'),auth[_0xe345('0x7')](),controller[_0xe345('0x43')]);router[_0xe345('0x3a')](_0xe345('0x44'),auth[_0xe345('0x7')](),controller[_0xe345('0x3b')](_0xe345('0x45')));router[_0xe345('0x5')](_0xe345('0x46'),auth['isAuthenticated'](),controller[_0xe345('0x47')]);router['post'](_0xe345('0x48'),auth[_0xe345('0x7')](),controller[_0xe345('0x3b')](_0xe345('0x49')));router[_0xe345('0x3a')](_0xe345('0x4a'),auth[_0xe345('0x7')](),controller[_0xe345('0x3b')](_0xe345('0x4b')));router[_0xe345('0x5')](_0xe345('0x4c'),auth['isAuthenticated'](),controller[_0xe345('0x4d')]);router['get'](_0xe345('0x4e'),auth[_0xe345('0x7')](),controller['showWhatsappQueues']);router[_0xe345('0x3a')](_0xe345('0x4f'),auth[_0xe345('0x7')](),controller[_0xe345('0x50')]);module['exports']=router; \ No newline at end of file +var _0xcf2b=['/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','Router','../../components/auth/service','./rpc.controller','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0xcf2b,0x77));var _0xbcf2=function(_0x3c3698,_0xa0bf08){_0x3c3698=_0x3c3698-0x0;var _0x4e6637=_0xcf2b[_0x3c3698];return _0x4e6637;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require('express');var router=express[_0xbcf2('0x0')]();var auth=require(_0xbcf2('0x1'));var controller=require(_0xbcf2('0x2'));router['get']('/voice/channels',auth[_0xbcf2('0x3')](),controller['voiceChannels']);router['get'](_0xbcf2('0x4'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x5')]);router[_0xbcf2('0x6')](_0xbcf2('0x7'),auth[_0xbcf2('0x3')](),controller['voiceChannelStopMixMonitor']);router[_0xbcf2('0x6')](_0xbcf2('0x8'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x9')]);router[_0xbcf2('0x6')](_0xbcf2('0xa'),auth[_0xbcf2('0x3')](),controller['chatQueues']);router[_0xbcf2('0x6')](_0xbcf2('0xb'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0xc')]);router[_0xbcf2('0x6')](_0xbcf2('0xd'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0xe')]);router[_0xbcf2('0x6')]('/openchannel/queues',auth[_0xbcf2('0x3')](),controller[_0xbcf2('0xf')]);router['get'](_0xbcf2('0x10'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x11')]);router[_0xbcf2('0x6')](_0xbcf2('0x12'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x13')]);router[_0xbcf2('0x6')](_0xbcf2('0x14'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x15')]);router[_0xbcf2('0x6')](_0xbcf2('0x16'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x17')]);router[_0xbcf2('0x6')](_0xbcf2('0x18'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x19')]);router[_0xbcf2('0x6')](_0xbcf2('0x1a'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x1b')]);router[_0xbcf2('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router[_0xbcf2('0x6')](_0xbcf2('0x1c'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x1d')]);router[_0xbcf2('0x6')](_0xbcf2('0x1e'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x1f')]);router[_0xbcf2('0x20')](_0xbcf2('0x1e'),auth[_0xbcf2('0x3')](),controller['updateVoiceQueue']);router[_0xbcf2('0x6')](_0xbcf2('0x21'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x22')]);router['get'](_0xbcf2('0x23'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x24')]);router[_0xbcf2('0x6')](_0xbcf2('0x25'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x26')]);router['put'](_0xbcf2('0x27'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x28')]);router[_0xbcf2('0x6')]('/telephones',auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x29')]);router[_0xbcf2('0x6')](_0xbcf2('0x2a'),auth[_0xbcf2('0x3')](),controller['trunks']);router[_0xbcf2('0x6')](_0xbcf2('0x2b'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x2c')]);router[_0xbcf2('0x6')](_0xbcf2('0x2d'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x2e')]);router[_0xbcf2('0x6')](_0xbcf2('0x2f'),auth['isAuthenticated'](),controller[_0xbcf2('0x30')]);router['get']('/mail/queues/waitinginteractions',auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x31')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x32')]);router[_0xbcf2('0x6')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xbcf2('0x33')]);router[_0xbcf2('0x6')](_0xbcf2('0x34'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x35')]);router[_0xbcf2('0x6')](_0xbcf2('0x36'),auth[_0xbcf2('0x3')](),controller['whatsappQueuesWaitingInteractions']);router['get']('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xbcf2('0x37')]);router['post'](_0xbcf2('0x38'),auth[_0xbcf2('0x3')](),controller['queueNotify'](_0xbcf2('0x39')));router[_0xbcf2('0x6')](_0xbcf2('0x3a'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x3b')]);router[_0xbcf2('0x3c')](_0xbcf2('0x3d'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x3e')](_0xbcf2('0x3f')));router['get'](_0xbcf2('0x40'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x41')]);router[_0xbcf2('0x3c')](_0xbcf2('0x42'),auth['isAuthenticated'](),controller['queueNotify'](_0xbcf2('0x43')));router[_0xbcf2('0x6')](_0xbcf2('0x44'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x45')]);router[_0xbcf2('0x3c')]('/openchannel/queues/:id/notify',auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x3e')](_0xbcf2('0x46')));router[_0xbcf2('0x6')](_0xbcf2('0x47'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x48')]);router[_0xbcf2('0x3c')](_0xbcf2('0x49'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x3e')]('sms'));router[_0xbcf2('0x3c')](_0xbcf2('0x4a'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x3e')](_0xbcf2('0x4b')));router['get'](_0xbcf2('0x4c'),auth[_0xbcf2('0x3')](),controller['showSmsQueues']);router[_0xbcf2('0x6')](_0xbcf2('0x4d'),auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x4e')]);router[_0xbcf2('0x3c')]('/agents/:id/notify',auth[_0xbcf2('0x3')](),controller[_0xbcf2('0x4f')]);module[_0xbcf2('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7e54648..d4bfb80 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x5cae7f,_0x109aa9){var _0x1daf35=function(_0x2de408){while(--_0x2de408){_0x5cae7f['push'](_0x5cae7f['shift']());}};_0x1daf35(++_0x109aa9);}(_0xe706,0xa3));var _0x6e70=function(_0xbb6c6b,_0x38a86c){_0xbb6c6b=_0xbb6c6b-0x0;var _0x9ca7de=_0xe706[_0xbb6c6b];return _0x9ca7de;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x4c7d27,_0x569cc1){var _0x39b471=function(_0x24258a){while(--_0x24258a){_0x4c7d27['push'](_0x4c7d27['shift']());}};_0x39b471(++_0x569cc1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index efb9ef6..1587d34 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 _0x1dce=['get','/:id','run','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated'];(function(_0x1da778,_0x39d34c){var _0x87ed15=function(_0xbb966f){while(--_0xbb966f){_0x1da778['push'](_0x1da778['shift']());}};_0x87ed15(++_0x39d34c);}(_0x1dce,0x1b8));var _0xe1dc=function(_0x22aa36,_0x3826bc){_0x22aa36=_0x22aa36-0x0;var _0x113a30=_0x1dce[_0x22aa36];return _0x113a30;};'use strict';var multer=require(_0xe1dc('0x0'));var util=require('util');var path=require(_0xe1dc('0x1'));var timeout=require(_0xe1dc('0x2'));var express=require(_0xe1dc('0x3'));var router=express[_0xe1dc('0x4')]();var fs_extra=require(_0xe1dc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe1dc('0x6'));var config=require(_0xe1dc('0x7'));var controller=require(_0xe1dc('0x8'));router['get']('/',auth[_0xe1dc('0x9')](),controller['index']);router[_0xe1dc('0xa')](_0xe1dc('0xb'),auth[_0xe1dc('0x9')](),controller['show']);router[_0xe1dc('0xa')]('/:id/run',auth[_0xe1dc('0x9')](),controller[_0xe1dc('0xc')]);router['post']('/',auth[_0xe1dc('0x9')](),controller[_0xe1dc('0xd')]);router['put']('/:id',auth[_0xe1dc('0x9')](),controller[_0xe1dc('0xe')]);router[_0xe1dc('0xf')](_0xe1dc('0xb'),auth[_0xe1dc('0x9')](),controller[_0xe1dc('0x10')]);module[_0xe1dc('0x11')]=router; \ No newline at end of file +var _0xb721=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','/:id/run','run','post','create','exports','multer','path'];(function(_0x5b94ca,_0x518ff4){var _0x3a2d17=function(_0x5d3e31){while(--_0x5d3e31){_0x5b94ca['push'](_0x5b94ca['shift']());}};_0x3a2d17(++_0x518ff4);}(_0xb721,0x154));var _0x1b72=function(_0x1a9b94,_0x4d763e){_0x1a9b94=_0x1a9b94-0x0;var _0x379102=_0xb721[_0x1a9b94];return _0x379102;};'use strict';var multer=require(_0x1b72('0x0'));var util=require('util');var path=require(_0x1b72('0x1'));var timeout=require(_0x1b72('0x2'));var express=require(_0x1b72('0x3'));var router=express[_0x1b72('0x4')]();var fs_extra=require(_0x1b72('0x5'));var auth=require(_0x1b72('0x6'));var interaction=require(_0x1b72('0x7'));var config=require('../../config/environment');var controller=require(_0x1b72('0x8'));router[_0x1b72('0x9')]('/',auth['isAuthenticated'](),controller[_0x1b72('0xa')]);router['get'](_0x1b72('0xb'),auth[_0x1b72('0xc')](),controller['show']);router[_0x1b72('0x9')](_0x1b72('0xd'),auth[_0x1b72('0xc')](),controller[_0x1b72('0xe')]);router[_0x1b72('0xf')]('/',auth[_0x1b72('0xc')](),controller[_0x1b72('0x10')]);router['put'](_0x1b72('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1b72('0xb'),auth[_0x1b72('0xc')](),controller['destroy']);module[_0x1b72('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 830b247..1155216 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 _0xa3fa=['minutes','days','csv','pdf','xlsx','custom','default','TEXT','BOOLEAN','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x4d131e,_0x1f9e91){var _0x49bebb=function(_0x1d3ce2){while(--_0x1d3ce2){_0x4d131e['push'](_0x4d131e['shift']());}};_0x49bebb(++_0x1f9e91);}(_0xa3fa,0x15d));var _0xaa3f=function(_0x477cd0,_0x5500f8){_0x477cd0=_0x477cd0-0x0;var _0x8eb1f7=_0xa3fa[_0x477cd0];return _0x8eb1f7;};'use strict';var Sequelize=require(_0xaa3f('0x0'));module[_0xaa3f('0x1')]={'name':{'type':Sequelize[_0xaa3f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xaa3f('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaa3f('0x3')},'startAt':{'type':Sequelize[_0xaa3f('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xaa3f('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xaa3f('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xaa3f('0x6')](_0xaa3f('0x7'),_0xaa3f('0x8'),_0xaa3f('0x9'),_0xaa3f('0xa'),'days','hours',_0xaa3f('0xb')),'allowNull':![],'defaultValue':_0xaa3f('0xc')},'output':{'type':Sequelize[_0xaa3f('0x6')](_0xaa3f('0xd'),_0xaa3f('0xe'),_0xaa3f('0xf')),'allowNull':![],'defaultValue':_0xaa3f('0xd')},'type':{'type':Sequelize[_0xaa3f('0x6')](_0xaa3f('0x10'),_0xaa3f('0x11')),'allowNull':![],'defaultValue':_0xaa3f('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xaa3f('0x2')]},'cc':{'type':Sequelize[_0xaa3f('0x12')]},'bcc':{'type':Sequelize[_0xaa3f('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xaa3f('0x13')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5631=['default','custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','pdf','xlsx','csv'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x5631,0x154));var _0x1563=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x5631[_0x5519a9];return _0x32f2cc;};'use strict';var Sequelize=require(_0x1563('0x0'));module[_0x1563('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1563('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x1563('0x2')],'allowNull':![],'defaultValue':_0x1563('0x3')},'startAt':{'type':Sequelize[_0x1563('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x1563('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x1563('0x6')](_0x1563('0x7'),_0x1563('0x8'),_0x1563('0x9'),_0x1563('0xa'),_0x1563('0xb'),_0x1563('0xc'),_0x1563('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x1563('0x6')]('csv',_0x1563('0xe'),_0x1563('0xf')),'allowNull':![],'defaultValue':_0x1563('0x10')},'type':{'type':Sequelize[_0x1563('0x6')]('custom',_0x1563('0x11')),'allowNull':![],'defaultValue':_0x1563('0x12')},'sendMail':{'type':Sequelize[_0x1563('0x13')],'defaultValue':![]},'email':{'type':Sequelize[_0x1563('0x2')]},'cc':{'type':Sequelize[_0x1563('0x14')]},'bcc':{'type':Sequelize[_0x1563('0x14')]},'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 e7103f1..6b5edb8 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 _0x082f=['params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','moment','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/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','Schedule','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x082f,0xfc));var _0xf082=function(_0x3d8502,_0x5b23b4){_0x3d8502=_0x3d8502-0x0;var _0x2e8073=_0x082f[_0x3d8502];return _0x2e8073;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf082('0x0'));var zipdir=require(_0xf082('0x1'));var jsonpatch=require(_0xf082('0x2'));var rp=require('request-promise');var moment=require(_0xf082('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf082('0x4'));var ejs=require(_0xf082('0x5'));var fs=require('fs');var fs_extra=require(_0xf082('0x6'));var _=require(_0xf082('0x7'));var squel=require(_0xf082('0x8'));var crypto=require(_0xf082('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xf082('0xa'));var toCsv=require(_0xf082('0x4'));var querystring=require(_0xf082('0xb'));var Papa=require(_0xf082('0xc'));var Redis=require(_0xf082('0xd'));var authService=require(_0xf082('0xe'));var qs=require(_0xf082('0xf'));var as=require(_0xf082('0x10'));var hardwareService=require(_0xf082('0x11'));var logger=require(_0xf082('0x12'))(_0xf082('0x13'));var utils=require('../../config/utils');var config=require(_0xf082('0x14'));var licenseUtil=require(_0xf082('0x15'));var db=require(_0xf082('0x16'))['db'];function respondWithStatusCode(_0x5c92e8,_0x43a6dd){_0x43a6dd=_0x43a6dd||0xcc;return function(_0x4c20cb){if(_0x4c20cb){return _0x5c92e8['sendStatus'](_0x43a6dd);}return _0x5c92e8[_0xf082('0x17')](_0x43a6dd)[_0xf082('0x18')]();};}function respondWithResult(_0x461a7d,_0x2bfbfa){_0x2bfbfa=_0x2bfbfa||0xc8;return function(_0x175aa1){if(_0x175aa1){return _0x461a7d[_0xf082('0x17')](_0x2bfbfa)['json'](_0x175aa1);}};}function respondWithFilteredResult(_0x216b06,_0x219b18){return function(_0xbc5bf5){if(_0xbc5bf5){var _0xb72df=typeof _0x219b18[_0xf082('0x19')]==='undefined'&&typeof _0x219b18[_0xf082('0x1a')]===_0xf082('0x1b');var _0x3f76a7=_0xbc5bf5[_0xf082('0x1c')];var _0x579933=_0xb72df?0x0:_0x219b18[_0xf082('0x19')];var _0x32d878=_0xb72df?_0xbc5bf5[_0xf082('0x1c')]:_0x219b18[_0xf082('0x19')]+_0x219b18[_0xf082('0x1a')];var _0x22c208;if(_0x32d878>=_0x3f76a7){_0x32d878=_0x3f76a7;_0x22c208=0xc8;}else{_0x22c208=0xce;}_0x216b06[_0xf082('0x17')](_0x22c208);return _0x216b06[_0xf082('0x1d')]('Content-Range',_0x579933+'-'+_0x32d878+'/'+_0x3f76a7)['json'](_0xbc5bf5);}return null;};}function patchUpdates(_0xf35172){return function(_0x45a2c0){try{jsonpatch[_0xf082('0x1e')](_0x45a2c0,_0xf35172,!![]);}catch(_0x51b64c){return BPromise[_0xf082('0x1f')](_0x51b64c);}return _0x45a2c0[_0xf082('0x20')]();};}function saveUpdates(_0x396124,_0x49459a){return function(_0x36b48f){if(_0x36b48f){return _0x36b48f[_0xf082('0x21')](_0x396124)[_0xf082('0x22')](function(_0x1cf191){return _0x1cf191;});}return null;};}function removeEntity(_0x5bded6,_0x30d19e){return function(_0x4dbac5){if(_0x4dbac5){return _0x4dbac5[_0xf082('0x23')]()[_0xf082('0x22')](function(){var _0x731a53=_0x4dbac5[_0xf082('0x24')]({'plain':!![]});var _0x5306b8='Scheduler';return db[_0xf082('0x25')][_0xf082('0x23')]({'where':{'type':_0x5306b8,'resourceId':_0x731a53['id']}})[_0xf082('0x22')](function(){return _0x4dbac5;});})[_0xf082('0x22')](function(){_0x5bded6[_0xf082('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b582f,_0x2247ad){return function(_0x435b8e){if(!_0x435b8e){_0x5b582f[_0xf082('0x26')](0x194);}return _0x435b8e;};}function handleError(_0x62b6d1,_0xaebad0){_0xaebad0=_0xaebad0||0x1f4;return function(_0xa1c7f8){logger[_0xf082('0x27')](_0xa1c7f8['stack']);if(_0xa1c7f8[_0xf082('0x28')]){delete _0xa1c7f8['name'];}_0x62b6d1[_0xf082('0x17')](_0xaebad0)[_0xf082('0x29')](_0xa1c7f8);};}exports[_0xf082('0x2a')]=function(_0xe2b603,_0x573026){var _0x34c07b={},_0x16eb6b={},_0x65ad55={'count':0x0,'rows':[]};var _0x3c02d7=_[_0xf082('0x2b')](db['Schedule'][_0xf082('0x2c')],function(_0x10da1f){return{'name':_0x10da1f['fieldName'],'type':_0x10da1f[_0xf082('0x2d')][_0xf082('0x2e')]};});_0x16eb6b[_0xf082('0x2f')]=_[_0xf082('0x2b')](_0x3c02d7,_0xf082('0x28'));_0x16eb6b[_0xf082('0x30')]=_[_0xf082('0x31')](_0xe2b603[_0xf082('0x30')]);_0x16eb6b['filters']=_[_0xf082('0x32')](_0x16eb6b[_0xf082('0x2f')],_0x16eb6b[_0xf082('0x30')]);_0x34c07b['attributes']=_[_0xf082('0x32')](_0x16eb6b['model'],qs[_0xf082('0x33')](_0xe2b603['query'][_0xf082('0x33')]));_0x34c07b[_0xf082('0x34')]=_0x34c07b[_0xf082('0x34')][_0xf082('0x35')]?_0x34c07b[_0xf082('0x34')]:_0x16eb6b[_0xf082('0x2f')];if(!_0xe2b603['query'][_0xf082('0x36')](_0xf082('0x37'))){_0x34c07b[_0xf082('0x1a')]=qs[_0xf082('0x1a')](_0xe2b603[_0xf082('0x30')][_0xf082('0x1a')]);_0x34c07b[_0xf082('0x19')]=qs['offset'](_0xe2b603['query'][_0xf082('0x19')]);}_0x34c07b['order']=qs[_0xf082('0x38')](_0xe2b603[_0xf082('0x30')]['sort']);_0x34c07b['where']=qs[_0xf082('0x39')](_[_0xf082('0x3a')](_0xe2b603[_0xf082('0x30')],_0x16eb6b[_0xf082('0x39')]),_0x3c02d7);if(_0xe2b603[_0xf082('0x30')]['filter']){_0x34c07b[_0xf082('0x3b')]=_[_0xf082('0x3c')](_0x34c07b['where'],{'$or':_[_0xf082('0x2b')](_0x3c02d7,function(_0x12ea95){if(_0x12ea95[_0xf082('0x2d')]!==_0xf082('0x3d')){var _0x48c42d={};_0x48c42d[_0x12ea95[_0xf082('0x28')]]={'$like':'%'+_0xe2b603[_0xf082('0x30')][_0xf082('0x3e')]+'%'};return _0x48c42d;}})});}_0x34c07b=_[_0xf082('0x3c')]({},_0x34c07b,_0xe2b603['options']);var _0x23ac76={'where':_0x34c07b[_0xf082('0x3b')]};return db[_0xf082('0x3f')][_0xf082('0x1c')](_0x23ac76)[_0xf082('0x22')](function(_0x39304b){_0x65ad55['count']=_0x39304b;if(_0xe2b603['query'][_0xf082('0x40')]){_0x34c07b[_0xf082('0x41')]=[{'all':!![]}];}return db['Schedule'][_0xf082('0x42')](_0x34c07b);})[_0xf082('0x22')](function(_0xf3e1ae){_0x65ad55[_0xf082('0x43')]=_0xf3e1ae;return _0x65ad55;})[_0xf082('0x22')](respondWithFilteredResult(_0x573026,_0x34c07b))[_0xf082('0x44')](handleError(_0x573026,null));};exports[_0xf082('0x45')]=function(_0x560074,_0x44c7b3){var _0x2749e5={'raw':![],'where':{'id':_0x560074['params']['id']}},_0x3949c7={};_0x3949c7[_0xf082('0x2f')]=_[_0xf082('0x31')](db[_0xf082('0x3f')][_0xf082('0x2c')]);_0x3949c7['query']=_['keys'](_0x560074['query']);_0x3949c7[_0xf082('0x39')]=_['intersection'](_0x3949c7[_0xf082('0x2f')],_0x3949c7['query']);_0x2749e5['attributes']=_[_0xf082('0x32')](_0x3949c7['model'],qs['fields'](_0x560074[_0xf082('0x30')]['fields']));_0x2749e5[_0xf082('0x34')]=_0x2749e5[_0xf082('0x34')][_0xf082('0x35')]?_0x2749e5[_0xf082('0x34')]:_0x3949c7[_0xf082('0x2f')];if(_0x560074['query'][_0xf082('0x40')]){_0x2749e5['include']=[{'all':!![]}];}_0x2749e5=_['merge']({},_0x2749e5,_0x560074['options']);return db[_0xf082('0x3f')][_0xf082('0x46')](_0x2749e5)['then'](handleEntityNotFound(_0x44c7b3,null))[_0xf082('0x22')](respondWithResult(_0x44c7b3,null))['catch'](handleError(_0x44c7b3,null));};exports[_0xf082('0x47')]=function(_0x4b4627,_0x1da658){return db[_0xf082('0x3f')][_0xf082('0x47')](_0x4b4627[_0xf082('0x48')],{})[_0xf082('0x22')](function(_0x10101a){var _0x4b42a8=_0x4b4627[_0xf082('0x49')][_0xf082('0x24')]({'plain':!![]});if(!_0x4b42a8)throw new Error(_0xf082('0x4a'));if(_0x4b42a8[_0xf082('0x4b')]===_0xf082('0x49')){var _0x107fbd=_0x10101a['get']({'plain':!![]});var _0x13d61b=_0xf082('0x4c');return db[_0xf082('0x4d')][_0xf082('0x46')]({'where':{'name':_0x13d61b,'userProfileId':_0x4b42a8[_0xf082('0x4e')]},'raw':!![]})['then'](function(_0x16ee90){if(_0x16ee90&&_0x16ee90[_0xf082('0x4f')]===0x0){return db['UserProfileResource'][_0xf082('0x47')]({'name':_0x107fbd[_0xf082('0x28')],'resourceId':_0x107fbd['id'],'type':_0x16ee90['name'],'sectionId':_0x16ee90['id']},{})['then'](function(){return _0x10101a;});}else{return _0x10101a;}})[_0xf082('0x44')](function(_0x41a4ed){logger[_0xf082('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41a4ed);throw _0x41a4ed;});}return _0x10101a;})[_0xf082('0x22')](respondWithResult(_0x1da658,0xc9))[_0xf082('0x44')](handleError(_0x1da658,null));};exports['update']=function(_0x14c20e,_0x34aded){if(_0x14c20e[_0xf082('0x48')]['id']){delete _0x14c20e[_0xf082('0x48')]['id'];}return db['Schedule'][_0xf082('0x46')]({'where':{'id':_0x14c20e[_0xf082('0x50')]['id']}})['then'](handleEntityNotFound(_0x34aded,null))[_0xf082('0x22')](saveUpdates(_0x14c20e[_0xf082('0x48')],null))[_0xf082('0x22')](respondWithResult(_0x34aded,null))[_0xf082('0x44')](handleError(_0x34aded,null));};exports[_0xf082('0x23')]=function(_0x3b75d6,_0x4fc221){return db[_0xf082('0x3f')][_0xf082('0x46')]({'where':{'id':_0x3b75d6['params']['id']}})[_0xf082('0x22')](handleEntityNotFound(_0x4fc221,null))['then'](removeEntity(_0x4fc221,null))[_0xf082('0x44')](handleError(_0x4fc221,null));};exports[_0xf082('0x51')]=function(_0x29358f,_0x3f2e11,_0x590cbe){var _0x41e4b0=require(_0xf082('0x52'));return db[_0xf082('0x3f')]['find']({'where':{'id':_0x29358f[_0xf082('0x50')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3f2e11,null))[_0xf082('0x22')](function(){_0x41e4b0['run'](_0x29358f[_0xf082('0x50')]['id']);})['then'](respondWithStatusCode(_0x3f2e11,null))['catch'](handleError(_0x3f2e11,null));}; \ No newline at end of file +var _0x52b0=['set','Content-Range','apply','save','update','then','destroy','get','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','rimraf','zip-dir','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x37f12d,_0x431996){var _0x43f0b7=function(_0x50adda){while(--_0x50adda){_0x37f12d['push'](_0x37f12d['shift']());}};_0x43f0b7(++_0x431996);}(_0x52b0,0x89));var _0x052b=function(_0x427350,_0x2d5577){_0x427350=_0x427350-0x0;var _0x529c78=_0x52b0[_0x427350];return _0x529c78;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x052b('0x0'));var zipdir=require(_0x052b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x052b('0x2'));var BPromise=require(_0x052b('0x3'));var Mustache=require(_0x052b('0x4'));var util=require(_0x052b('0x5'));var path=require(_0x052b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x052b('0x7'));var _=require(_0x052b('0x8'));var squel=require('squel');var crypto=require(_0x052b('0x9'));var jsforce=require(_0x052b('0xa'));var deskjs=require(_0x052b('0xb'));var toCsv=require(_0x052b('0xc'));var querystring=require(_0x052b('0xd'));var Papa=require(_0x052b('0xe'));var Redis=require(_0x052b('0xf'));var authService=require(_0x052b('0x10'));var qs=require(_0x052b('0x11'));var as=require(_0x052b('0x12'));var hardwareService=require(_0x052b('0x13'));var logger=require(_0x052b('0x14'))(_0x052b('0x15'));var utils=require(_0x052b('0x16'));var config=require(_0x052b('0x17'));var licenseUtil=require(_0x052b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x542543,_0x547aec){_0x547aec=_0x547aec||0xcc;return function(_0xa625f3){if(_0xa625f3){return _0x542543[_0x052b('0x19')](_0x547aec);}return _0x542543[_0x052b('0x1a')](_0x547aec)[_0x052b('0x1b')]();};}function respondWithResult(_0x3a0562,_0x2ea50b){_0x2ea50b=_0x2ea50b||0xc8;return function(_0x2ed467){if(_0x2ed467){return _0x3a0562[_0x052b('0x1a')](_0x2ea50b)[_0x052b('0x1c')](_0x2ed467);}};}function respondWithFilteredResult(_0xe91585,_0x2fa5e6){return function(_0x437839){if(_0x437839){var _0x511c48=typeof _0x2fa5e6['offset']===_0x052b('0x1d')&&typeof _0x2fa5e6[_0x052b('0x1e')]===_0x052b('0x1d');var _0x23ed56=_0x437839[_0x052b('0x1f')];var _0x58e65a=_0x511c48?0x0:_0x2fa5e6['offset'];var _0x2fdb55=_0x511c48?_0x437839[_0x052b('0x1f')]:_0x2fa5e6[_0x052b('0x20')]+_0x2fa5e6['limit'];var _0x544903;if(_0x2fdb55>=_0x23ed56){_0x2fdb55=_0x23ed56;_0x544903=0xc8;}else{_0x544903=0xce;}_0xe91585['status'](_0x544903);return _0xe91585[_0x052b('0x21')](_0x052b('0x22'),_0x58e65a+'-'+_0x2fdb55+'/'+_0x23ed56)[_0x052b('0x1c')](_0x437839);}return null;};}function patchUpdates(_0x594ca8){return function(_0x4b1d09){try{jsonpatch[_0x052b('0x23')](_0x4b1d09,_0x594ca8,!![]);}catch(_0x446ff9){return BPromise['reject'](_0x446ff9);}return _0x4b1d09[_0x052b('0x24')]();};}function saveUpdates(_0x4ffaa6,_0x55efe1){return function(_0x7946a2){if(_0x7946a2){return _0x7946a2[_0x052b('0x25')](_0x4ffaa6)[_0x052b('0x26')](function(_0x14c22a){return _0x14c22a;});}return null;};}function removeEntity(_0x346010,_0xaba0bf){return function(_0x469ab0){if(_0x469ab0){return _0x469ab0[_0x052b('0x27')]()['then'](function(){var _0x382bb9=_0x469ab0[_0x052b('0x28')]({'plain':!![]});var _0x399d4f='Scheduler';return db['UserProfileResource'][_0x052b('0x27')]({'where':{'type':_0x399d4f,'resourceId':_0x382bb9['id']}})[_0x052b('0x26')](function(){return _0x469ab0;});})[_0x052b('0x26')](function(){_0x346010['status'](0xcc)[_0x052b('0x1b')]();});}};}function handleEntityNotFound(_0x39ff44,_0x20e633){return function(_0x182d50){if(!_0x182d50){_0x39ff44[_0x052b('0x19')](0x194);}return _0x182d50;};}function handleError(_0x4f6eb6,_0x1c9e59){_0x1c9e59=_0x1c9e59||0x1f4;return function(_0x12565e){logger[_0x052b('0x29')](_0x12565e[_0x052b('0x2a')]);if(_0x12565e[_0x052b('0x2b')]){delete _0x12565e[_0x052b('0x2b')];}_0x4f6eb6['status'](_0x1c9e59)[_0x052b('0x2c')](_0x12565e);};}exports[_0x052b('0x2d')]=function(_0x1ec3b7,_0x21178e){var _0x21d46c={},_0x2d624f={},_0x14b324={'count':0x0,'rows':[]};var _0x29c557=_[_0x052b('0x2e')](db[_0x052b('0x2f')][_0x052b('0x30')],function(_0x735fcc){return{'name':_0x735fcc[_0x052b('0x31')],'type':_0x735fcc['type'][_0x052b('0x32')]};});_0x2d624f[_0x052b('0x33')]=_[_0x052b('0x2e')](_0x29c557,'name');_0x2d624f[_0x052b('0x34')]=_[_0x052b('0x35')](_0x1ec3b7[_0x052b('0x34')]);_0x2d624f[_0x052b('0x36')]=_['intersection'](_0x2d624f[_0x052b('0x33')],_0x2d624f[_0x052b('0x34')]);_0x21d46c[_0x052b('0x37')]=_[_0x052b('0x38')](_0x2d624f[_0x052b('0x33')],qs[_0x052b('0x39')](_0x1ec3b7[_0x052b('0x34')][_0x052b('0x39')]));_0x21d46c[_0x052b('0x37')]=_0x21d46c[_0x052b('0x37')][_0x052b('0x3a')]?_0x21d46c[_0x052b('0x37')]:_0x2d624f[_0x052b('0x33')];if(!_0x1ec3b7['query'][_0x052b('0x3b')](_0x052b('0x3c'))){_0x21d46c[_0x052b('0x1e')]=qs[_0x052b('0x1e')](_0x1ec3b7[_0x052b('0x34')]['limit']);_0x21d46c[_0x052b('0x20')]=qs[_0x052b('0x20')](_0x1ec3b7['query'][_0x052b('0x20')]);}_0x21d46c[_0x052b('0x3d')]=qs['sort'](_0x1ec3b7['query'][_0x052b('0x3e')]);_0x21d46c[_0x052b('0x3f')]=qs[_0x052b('0x36')](_['pick'](_0x1ec3b7[_0x052b('0x34')],_0x2d624f['filters']),_0x29c557);if(_0x1ec3b7['query'][_0x052b('0x40')]){_0x21d46c[_0x052b('0x3f')]=_['merge'](_0x21d46c[_0x052b('0x3f')],{'$or':_['map'](_0x29c557,function(_0x470ea6){if(_0x470ea6[_0x052b('0x41')]!==_0x052b('0x42')){var _0x1b4e7a={};_0x1b4e7a[_0x470ea6['name']]={'$like':'%'+_0x1ec3b7['query'][_0x052b('0x40')]+'%'};return _0x1b4e7a;}})});}_0x21d46c=_[_0x052b('0x43')]({},_0x21d46c,_0x1ec3b7[_0x052b('0x44')]);var _0x4c0d05={'where':_0x21d46c['where']};return db[_0x052b('0x2f')][_0x052b('0x1f')](_0x4c0d05)['then'](function(_0x34397c){_0x14b324[_0x052b('0x1f')]=_0x34397c;if(_0x1ec3b7['query'][_0x052b('0x45')]){_0x21d46c[_0x052b('0x46')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x21d46c);})[_0x052b('0x26')](function(_0x1b012e){_0x14b324['rows']=_0x1b012e;return _0x14b324;})['then'](respondWithFilteredResult(_0x21178e,_0x21d46c))[_0x052b('0x47')](handleError(_0x21178e,null));};exports[_0x052b('0x48')]=function(_0x2b8b7c,_0x52cb0b){var _0x212052={'raw':![],'where':{'id':_0x2b8b7c[_0x052b('0x49')]['id']}},_0x21e088={};_0x21e088['model']=_[_0x052b('0x35')](db[_0x052b('0x2f')][_0x052b('0x30')]);_0x21e088[_0x052b('0x34')]=_[_0x052b('0x35')](_0x2b8b7c[_0x052b('0x34')]);_0x21e088[_0x052b('0x36')]=_[_0x052b('0x38')](_0x21e088[_0x052b('0x33')],_0x21e088[_0x052b('0x34')]);_0x212052[_0x052b('0x37')]=_[_0x052b('0x38')](_0x21e088[_0x052b('0x33')],qs['fields'](_0x2b8b7c[_0x052b('0x34')]['fields']));_0x212052['attributes']=_0x212052[_0x052b('0x37')][_0x052b('0x3a')]?_0x212052[_0x052b('0x37')]:_0x21e088['model'];if(_0x2b8b7c['query'][_0x052b('0x45')]){_0x212052[_0x052b('0x46')]=[{'all':!![]}];}_0x212052=_['merge']({},_0x212052,_0x2b8b7c[_0x052b('0x44')]);return db[_0x052b('0x2f')][_0x052b('0x4a')](_0x212052)[_0x052b('0x26')](handleEntityNotFound(_0x52cb0b,null))['then'](respondWithResult(_0x52cb0b,null))[_0x052b('0x47')](handleError(_0x52cb0b,null));};exports[_0x052b('0x4b')]=function(_0x19d011,_0x9f5b69){return db['Schedule'][_0x052b('0x4b')](_0x19d011[_0x052b('0x4c')],{})['then'](function(_0x3628ad){var _0x4a9ac6=_0x19d011[_0x052b('0x4d')][_0x052b('0x28')]({'plain':!![]});if(!_0x4a9ac6)throw new Error(_0x052b('0x4e'));if(_0x4a9ac6[_0x052b('0x4f')]==='user'){var _0x4e44fb=_0x3628ad[_0x052b('0x28')]({'plain':!![]});var _0x3f2c2a=_0x052b('0x50');return db[_0x052b('0x51')][_0x052b('0x4a')]({'where':{'name':_0x3f2c2a,'userProfileId':_0x4a9ac6['userProfileId']},'raw':!![]})[_0x052b('0x26')](function(_0x43a944){if(_0x43a944&&_0x43a944[_0x052b('0x52')]===0x0){return db['UserProfileResource'][_0x052b('0x4b')]({'name':_0x4e44fb['name'],'resourceId':_0x4e44fb['id'],'type':_0x43a944[_0x052b('0x2b')],'sectionId':_0x43a944['id']},{})[_0x052b('0x26')](function(){return _0x3628ad;});}else{return _0x3628ad;}})[_0x052b('0x47')](function(_0x545126){logger[_0x052b('0x29')](_0x052b('0x53'),_0x545126);throw _0x545126;});}return _0x3628ad;})[_0x052b('0x26')](respondWithResult(_0x9f5b69,0xc9))[_0x052b('0x47')](handleError(_0x9f5b69,null));};exports[_0x052b('0x25')]=function(_0x305dce,_0x45ccb5){if(_0x305dce[_0x052b('0x4c')]['id']){delete _0x305dce[_0x052b('0x4c')]['id'];}return db[_0x052b('0x2f')][_0x052b('0x4a')]({'where':{'id':_0x305dce[_0x052b('0x49')]['id']}})['then'](handleEntityNotFound(_0x45ccb5,null))['then'](saveUpdates(_0x305dce[_0x052b('0x4c')],null))['then'](respondWithResult(_0x45ccb5,null))[_0x052b('0x47')](handleError(_0x45ccb5,null));};exports['destroy']=function(_0x59ad26,_0xc85468){return db[_0x052b('0x2f')][_0x052b('0x4a')]({'where':{'id':_0x59ad26[_0x052b('0x49')]['id']}})[_0x052b('0x26')](handleEntityNotFound(_0xc85468,null))[_0x052b('0x26')](removeEntity(_0xc85468,null))[_0x052b('0x47')](handleError(_0xc85468,null));};exports[_0x052b('0x54')]=function(_0x4f6e91,_0x1ae78f,_0x3ac969){var _0x2c0baa=require('../../config/schedule');return db[_0x052b('0x2f')][_0x052b('0x4a')]({'where':{'id':_0x4f6e91[_0x052b('0x49')]['id']},'raw':!![]})[_0x052b('0x26')](handleEntityNotFound(_0x1ae78f,null))[_0x052b('0x26')](function(){_0x2c0baa['run'](_0x4f6e91[_0x052b('0x49')]['id']);})[_0x052b('0x26')](respondWithStatusCode(_0x1ae78f,null))[_0x052b('0x47')](handleError(_0x1ae78f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index fde0050..07d7a8b 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 _0xc6de=['util','../../config/logger','moment','bluebird','path','../../config/environment','./schedule.attributes','exports','define','tools_schedules'];(function(_0x5b14d7,_0x10b373){var _0x1eb341=function(_0x2d0955){while(--_0x2d0955){_0x5b14d7['push'](_0x5b14d7['shift']());}};_0x1eb341(++_0x10b373);}(_0xc6de,0x64));var _0xec6d=function(_0x4fabbe,_0xc514f3){_0x4fabbe=_0x4fabbe-0x0;var _0x5510dd=_0xc6de[_0x4fabbe];return _0x5510dd;};'use strict';var _=require('lodash');var util=require(_0xec6d('0x0'));var logger=require(_0xec6d('0x1'))('api');var moment=require(_0xec6d('0x2'));var BPromise=require(_0xec6d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec6d('0x4'));var rimraf=require('rimraf');var config=require(_0xec6d('0x5'));var attributes=require(_0xec6d('0x6'));module[_0xec6d('0x7')]=function(_0x45b67c,_0x67435f){return _0x45b67c[_0xec6d('0x8')]('Schedule',attributes,{'tableName':_0xec6d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cb6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules'];(function(_0xb5926,_0x470b9e){var _0x5d1a18=function(_0x37afc1){while(--_0x37afc1){_0xb5926['push'](_0xb5926['shift']());}};_0x5d1a18(++_0x470b9e);}(_0x8cb6,0x1a4));var _0x68cb=function(_0x5832be,_0x382b95){_0x5832be=_0x5832be-0x0;var _0x5d0088=_0x8cb6[_0x5832be];return _0x5d0088;};'use strict';var _=require(_0x68cb('0x0'));var util=require(_0x68cb('0x1'));var logger=require(_0x68cb('0x2'))(_0x68cb('0x3'));var moment=require(_0x68cb('0x4'));var BPromise=require(_0x68cb('0x5'));var rp=require(_0x68cb('0x6'));var fs=require('fs');var path=require(_0x68cb('0x7'));var rimraf=require(_0x68cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x68cb('0x9'));module[_0x68cb('0xa')]=function(_0x1afc79,_0x1219c2){return _0x1afc79[_0x68cb('0xb')](_0x68cb('0xc'),attributes,{'tableName':_0x68cb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index a1b980a..e3b50af 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 _0x4cca=['Schedule,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x481df5,_0x216652){var _0x32726e=function(_0x2133f4){while(--_0x2133f4){_0x481df5['push'](_0x481df5['shift']());}};_0x32726e(++_0x216652);}(_0x4cca,0x189));var _0xa4cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4cca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa4cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa4cc('0x1'));var rs=require(_0xa4cc('0x2'));var fs=require('fs');var Redis=require(_0xa4cc('0x3'));var db=require(_0xa4cc('0x4'))['db'];var utils=require(_0xa4cc('0x5'));var logger=require(_0xa4cc('0x6'))(_0xa4cc('0x7'));var config=require(_0xa4cc('0x8'));var jayson=require(_0xa4cc('0x9'));var client=jayson[_0xa4cc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f5b20,_0x105814,_0x246660){return new BPromise(function(_0x249869,_0x3dd36b){return client[_0xa4cc('0xb')](_0x1f5b20,_0x246660)[_0xa4cc('0xc')](function(_0x27a265){logger[_0xa4cc('0xd')]('Schedule,\x20%s,\x20%s',_0x105814,'request\x20sent');logger[_0xa4cc('0xe')](_0xa4cc('0xf'),_0x105814,_0xa4cc('0x10'),JSON[_0xa4cc('0x11')](_0x27a265));if(_0x27a265[_0xa4cc('0x12')]){if(_0x27a265['error'][_0xa4cc('0x13')]===0x1f4){logger[_0xa4cc('0x12')]('Schedule,\x20%s,\x20%s',_0x105814,_0x27a265[_0xa4cc('0x12')][_0xa4cc('0x14')]);return _0x3dd36b(_0x27a265[_0xa4cc('0x12')][_0xa4cc('0x14')]);}logger[_0xa4cc('0x12')]('Schedule,\x20%s,\x20%s',_0x105814,_0x27a265[_0xa4cc('0x12')][_0xa4cc('0x14')]);return _0x249869(_0x27a265[_0xa4cc('0x12')][_0xa4cc('0x14')]);}else{logger['info'](_0xa4cc('0x15'),_0x105814,_0xa4cc('0x10'));_0x249869(_0x27a265[_0xa4cc('0x16')]['message']);}})['catch'](function(_0x3881a8){logger[_0xa4cc('0x12')](_0xa4cc('0x15'),_0x105814,_0x3881a8);_0x3dd36b(_0x3881a8);});});} \ No newline at end of file +var _0xe1ca=['info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','Schedule,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x229b99,_0xb6a166){var _0x13e10c=function(_0x166e54){while(--_0x166e54){_0x229b99['push'](_0x229b99['shift']());}};_0x13e10c(++_0xb6a166);}(_0xe1ca,0x9d));var _0xae1c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe1ca[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xae1c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xae1c('0x1'));var rs=require(_0xae1c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xae1c('0x3'));var logger=require(_0xae1c('0x4'))('rpc');var config=require(_0xae1c('0x5'));var jayson=require(_0xae1c('0x6'));var client=jayson[_0xae1c('0x7')][_0xae1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1596ac,_0x5a46c2,_0x1c9bfd){return new BPromise(function(_0x5581ce,_0x1230b7){return client[_0xae1c('0x9')](_0x1596ac,_0x1c9bfd)[_0xae1c('0xa')](function(_0x41bbc8){logger[_0xae1c('0xb')]('Schedule,\x20%s,\x20%s',_0x5a46c2,_0xae1c('0xc'));logger[_0xae1c('0xd')](_0xae1c('0xe'),_0x5a46c2,_0xae1c('0xc'),JSON[_0xae1c('0xf')](_0x41bbc8));if(_0x41bbc8[_0xae1c('0x10')]){if(_0x41bbc8[_0xae1c('0x10')]['code']===0x1f4){logger[_0xae1c('0x10')](_0xae1c('0x11'),_0x5a46c2,_0x41bbc8[_0xae1c('0x10')][_0xae1c('0x12')]);return _0x1230b7(_0x41bbc8[_0xae1c('0x10')][_0xae1c('0x12')]);}logger[_0xae1c('0x10')](_0xae1c('0x11'),_0x5a46c2,_0x41bbc8[_0xae1c('0x10')][_0xae1c('0x12')]);return _0x5581ce(_0x41bbc8[_0xae1c('0x10')][_0xae1c('0x12')]);}else{logger[_0xae1c('0xb')](_0xae1c('0x11'),_0x5a46c2,_0xae1c('0xc'));_0x5581ce(_0x41bbc8[_0xae1c('0x13')][_0xae1c('0x12')]);}})[_0xae1c('0x14')](function(_0x3a7af2){logger['error'](_0xae1c('0x11'),_0x5a46c2,_0x3a7af2);_0x1230b7(_0x3a7af2);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b8627ef..ca0bb56 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 _0xa21e=['put','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','/:id/download','create'];(function(_0x59d35d,_0x181ca6){var _0x125c5f=function(_0x587488){while(--_0x587488){_0x59d35d['push'](_0x59d35d['shift']());}};_0x125c5f(++_0x181ca6);}(_0xa21e,0xee));var _0xea21=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xa21e[_0x1177d5];return _0xc3ddc2;};'use strict';var multer=require(_0xea21('0x0'));var util=require(_0xea21('0x1'));var path=require('path');var timeout=require(_0xea21('0x2'));var express=require('express');var router=express[_0xea21('0x3')]();var fs_extra=require(_0xea21('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xea21('0x5'));var config=require(_0xea21('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xea21('0x7')](),controller[_0xea21('0x8')]);router[_0xea21('0x9')](_0xea21('0xa'),auth[_0xea21('0x7')](),controller['describe']);router['get']('/:id',auth[_0xea21('0x7')](),controller[_0xea21('0xb')]);router[_0xea21('0x9')](_0xea21('0xc'),auth[_0xea21('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xea21('0xd')]);router[_0xea21('0xe')](_0xea21('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xea21('0xf'),auth[_0xea21('0x7')](),controller[_0xea21('0x10')]);module[_0xea21('0x11')]=router; \ No newline at end of file +var _0xea0e=['../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x17c8cc,_0x5e5647){var _0x3db4eb=function(_0x2082db){while(--_0x2082db){_0x17c8cc['push'](_0x17c8cc['shift']());}};_0x3db4eb(++_0x5e5647);}(_0xea0e,0xf7));var _0xeea0=function(_0x1de340,_0x566300){_0x1de340=_0x1de340-0x0;var _0x1ff29e=_0xea0e[_0x1de340];return _0x1ff29e;};'use strict';var multer=require(_0xeea0('0x0'));var util=require(_0xeea0('0x1'));var path=require(_0xeea0('0x2'));var timeout=require(_0xeea0('0x3'));var express=require('express');var router=express[_0xeea0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xeea0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeea0('0x6'));var controller=require(_0xeea0('0x7'));router[_0xeea0('0x8')]('/',auth[_0xeea0('0x9')](),controller[_0xeea0('0xa')]);router[_0xeea0('0x8')](_0xeea0('0xb'),auth[_0xeea0('0x9')](),controller[_0xeea0('0xc')]);router[_0xeea0('0x8')]('/:id',auth[_0xeea0('0x9')](),controller[_0xeea0('0xd')]);router['get'](_0xeea0('0xe'),auth[_0xeea0('0x9')](),controller[_0xeea0('0xf')]);router[_0xeea0('0x10')]('/',auth[_0xeea0('0x9')](),controller[_0xeea0('0x11')]);router['put'](_0xeea0('0x12'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x13')]);router[_0xeea0('0x14')](_0xeea0('0x12'),auth[_0xeea0('0x9')](),controller[_0xeea0('0x15')]);module[_0xeea0('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 0147b9b..362214c 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 _0xf8f2=['MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x5ac94b,_0x18510f){_0x5ac94b=_0x5ac94b-0x0;var _0x604c52=_0xf8f2[_0x5ac94b];return _0x604c52;};'use strict';var Sequelize=require(_0x2f8f('0x0'));var moment=require(_0x2f8f('0x1'));var path=require(_0x2f8f('0x2'));var config=require(_0x2f8f('0x3'));module['exports']={'format':{'type':Sequelize[_0x2f8f('0x4')],'get':function(){return this[_0x2f8f('0x5')](_0x2f8f('0x6'))?path[_0x2f8f('0x7')](this[_0x2f8f('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x2f8f('0x8')]},'channel':{'type':Sequelize[_0x2f8f('0x8')]},'value':{'type':Sequelize[_0x2f8f('0x8')],'set':function(_0x107748){var _0x590ff4=_0x107748[_0x2f8f('0x9')](/\\/g,'/');this[_0x2f8f('0xa')](_0x2f8f('0x6'),_0x590ff4);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2f8f('0xb')],'set':function(_0x1ce821){this[_0x2f8f('0xa')](_0x2f8f('0xc'),moment()['subtract'](_0x1ce821,'ms'));this[_0x2f8f('0xa')](_0x2f8f('0xd'),moment());this['setDataValue'](_0x2f8f('0xe'),_0x1ce821);}},'startedAt':{'type':Sequelize[_0x2f8f('0xf')],'get':function(){return moment(this[_0x2f8f('0x5')](_0x2f8f('0xc')))['format'](_0x2f8f('0x10'))[_0x2f8f('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2f8f('0xd')))[_0x2f8f('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x2f8f('0x11')]();}},'createdAt':{'type':Sequelize[_0x2f8f('0xf')],'get':function(){return moment(this[_0x2f8f('0x5')](_0x2f8f('0x13')))[_0x2f8f('0x12')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2f8f('0x14')))[_0x2f8f('0x12')](_0x2f8f('0x10'))[_0x2f8f('0x11')]();}}}; \ No newline at end of file +var _0xab54=['setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','path','../../config/environment','exports','VIRTUAL','value','STRING','replace'];(function(_0x321ccf,_0x2e780d){var _0x3a9a2a=function(_0x3291c2){while(--_0x3291c2){_0x321ccf['push'](_0x321ccf['shift']());}};_0x3a9a2a(++_0x2e780d);}(_0xab54,0x115));var _0x4ab5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab54[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4ab5('0x0'));var path=require(_0x4ab5('0x1'));var config=require(_0x4ab5('0x2'));module[_0x4ab5('0x3')]={'format':{'type':Sequelize[_0x4ab5('0x4')],'get':function(){return this['getDataValue'](_0x4ab5('0x5'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x4ab5('0x6')]},'channel':{'type':Sequelize[_0x4ab5('0x6')]},'value':{'type':Sequelize['STRING'],'set':function(_0x2c39fe){var _0x5c8c61=_0x2c39fe[_0x4ab5('0x7')](/\\/g,'/');this[_0x4ab5('0x8')](_0x4ab5('0x5'),_0x5c8c61);}},'rating':{'type':Sequelize[_0x4ab5('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x58e6a7){this['setDataValue'](_0x4ab5('0xa'),moment()[_0x4ab5('0xb')](_0x58e6a7,'ms'));this['setDataValue'](_0x4ab5('0xc'),moment());this[_0x4ab5('0x8')]('duration',_0x58e6a7);}},'startedAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')](_0x4ab5('0xa')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}},'closedAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')](_0x4ab5('0xc')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}},'createdAt':{'type':Sequelize[_0x4ab5('0xd')],'get':function(){return moment(this[_0x4ab5('0xe')]('createdAt'))[_0x4ab5('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x4ab5('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x4ab5('0x12')))[_0x4ab5('0xf')](_0x4ab5('0x10'))[_0x4ab5('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 287cc3c..7386894 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 _0x032e=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','send','rawAttributes','fieldName','type','model','differenceBy','map','format','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ScreenRecording','rows','catch','show','find','create','body','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end'];(function(_0x56c3e9,_0x13dca4){var _0x11dfd5=function(_0xc03bb){while(--_0xc03bb){_0x56c3e9['push'](_0x56c3e9['shift']());}};_0x11dfd5(++_0x13dca4);}(_0x032e,0x124));var _0xe032=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x032e[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0xe032('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe032('0x1'));var jsonpatch=require(_0xe032('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe032('0x3'));var Mustache=require(_0xe032('0x4'));var util=require(_0xe032('0x5'));var path=require(_0xe032('0x6'));var sox=require(_0xe032('0x7'));var csv=require(_0xe032('0x8'));var ejs=require(_0xe032('0x9'));var fs=require('fs');var fs_extra=require(_0xe032('0xa'));var _=require(_0xe032('0xb'));var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0x8'));var querystring=require(_0xe032('0x10'));var Papa=require(_0xe032('0x11'));var Redis=require(_0xe032('0x12'));var authService=require(_0xe032('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe032('0x14'));var hardwareService=require(_0xe032('0x15'));var logger=require(_0xe032('0x16'))(_0xe032('0x17'));var utils=require(_0xe032('0x18'));var config=require(_0xe032('0x19'));var licenseUtil=require(_0xe032('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x646979,_0x266d71){_0x266d71=_0x266d71||0xcc;return function(_0x28c2b6){if(_0x28c2b6){return _0x646979[_0xe032('0x1b')](_0x266d71);}return _0x646979['status'](_0x266d71)[_0xe032('0x1c')]();};}function respondWithResult(_0x2e267b,_0x176547){_0x176547=_0x176547||0xc8;return function(_0x422e96){if(_0x422e96){return _0x2e267b[_0xe032('0x1d')](_0x176547)[_0xe032('0x1e')](_0x422e96);}};}function respondWithFilteredResult(_0x2bf528,_0x4da5b7){return function(_0x231c35){if(_0x231c35){var _0x749018=typeof _0x4da5b7[_0xe032('0x1f')]===_0xe032('0x20')&&typeof _0x4da5b7[_0xe032('0x21')]===_0xe032('0x20');var _0x4cdab3=_0x231c35[_0xe032('0x22')];var _0x25cedb=_0x749018?0x0:_0x4da5b7[_0xe032('0x1f')];var _0x41d2a5=_0x749018?_0x231c35[_0xe032('0x22')]:_0x4da5b7['offset']+_0x4da5b7['limit'];var _0x484e6c;if(_0x41d2a5>=_0x4cdab3){_0x41d2a5=_0x4cdab3;_0x484e6c=0xc8;}else{_0x484e6c=0xce;}_0x2bf528[_0xe032('0x1d')](_0x484e6c);return _0x2bf528['set'](_0xe032('0x23'),_0x25cedb+'-'+_0x41d2a5+'/'+_0x4cdab3)[_0xe032('0x1e')](_0x231c35);}return null;};}function patchUpdates(_0x3f0257){return function(_0x2aa342){try{jsonpatch[_0xe032('0x24')](_0x2aa342,_0x3f0257,!![]);}catch(_0x256f71){return BPromise[_0xe032('0x25')](_0x256f71);}return _0x2aa342['save']();};}function saveUpdates(_0x32f8b6,_0x866c81){return function(_0x232e8f){if(_0x232e8f){return _0x232e8f[_0xe032('0x26')](_0x32f8b6)[_0xe032('0x27')](function(_0x33d89a){return _0x33d89a;});}return null;};}function removeEntity(_0x22831a,_0xe89aa7){return function(_0x499da5){if(_0x499da5){return _0x499da5['destroy']()['then'](function(){_0x22831a[_0xe032('0x1d')](0xcc)[_0xe032('0x1c')]();});}};}function handleEntityNotFound(_0x302559,_0x2a56e5){return function(_0x2bfe8f){if(!_0x2bfe8f){_0x302559[_0xe032('0x1b')](0x194);}return _0x2bfe8f;};}function handleError(_0x36ece7,_0x2b6ffa){_0x2b6ffa=_0x2b6ffa||0x1f4;return function(_0x4dcbf1){logger[_0xe032('0x28')](_0x4dcbf1['stack']);if(_0x4dcbf1[_0xe032('0x29')]){delete _0x4dcbf1[_0xe032('0x29')];}_0x36ece7[_0xe032('0x1d')](_0x2b6ffa)[_0xe032('0x2a')](_0x4dcbf1);};}exports['index']=function(_0x5573e4,_0x3e2575){var _0x38e7ea={},_0x469290={},_0xae116e={'count':0x0,'rows':[]};var _0x4e8b72=_['map'](db['ScreenRecording'][_0xe032('0x2b')],function(_0x1dd34f){return{'name':_0x1dd34f[_0xe032('0x2c')],'type':_0x1dd34f[_0xe032('0x2d')]['key']};});_0x469290[_0xe032('0x2e')]=_[_0xe032('0x2f')](_[_0xe032('0x30')](_0x4e8b72,_0xe032('0x29')),[_0xe032('0x31')]);_0x469290['query']=_[_0xe032('0x32')](_0x5573e4[_0xe032('0x33')]);_0x469290[_0xe032('0x34')]=_[_0xe032('0x35')](_0x469290['model'],_0x469290[_0xe032('0x33')]);_0x38e7ea['attributes']=_[_0xe032('0x35')](_0x469290['model'],qs[_0xe032('0x36')](_0x5573e4['query'][_0xe032('0x36')]));_0x38e7ea['attributes']=_0x38e7ea[_0xe032('0x37')][_0xe032('0x38')]?_0x38e7ea['attributes']:_0x469290[_0xe032('0x2e')];if(!_0x5573e4[_0xe032('0x33')][_0xe032('0x39')](_0xe032('0x3a'))){_0x38e7ea['limit']=qs[_0xe032('0x21')](_0x5573e4['query'][_0xe032('0x21')]);_0x38e7ea[_0xe032('0x1f')]=qs['offset'](_0x5573e4[_0xe032('0x33')][_0xe032('0x1f')]);}_0x38e7ea['order']=qs[_0xe032('0x3b')](_0x5573e4[_0xe032('0x33')][_0xe032('0x3b')]);_0x38e7ea[_0xe032('0x3c')]=qs[_0xe032('0x34')](_[_0xe032('0x3d')](_0x5573e4[_0xe032('0x33')],_0x469290[_0xe032('0x34')]),_0x4e8b72);if(_0x5573e4[_0xe032('0x33')][_0xe032('0x3e')]){_0x38e7ea[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x38e7ea[_0xe032('0x3c')],{'$or':_[_0xe032('0x30')](_0x4e8b72,function(_0x39af44){if(_0x39af44[_0xe032('0x2d')]!==_0xe032('0x40')){var _0x555914={};_0x555914[_0x39af44[_0xe032('0x29')]]={'$like':'%'+_0x5573e4['query'][_0xe032('0x3e')]+'%'};return _0x555914;}})});}_0x38e7ea=_[_0xe032('0x3f')]({},_0x38e7ea,_0x5573e4[_0xe032('0x41')]);var _0x119790={'where':_0x38e7ea[_0xe032('0x3c')]};return db['ScreenRecording'][_0xe032('0x22')](_0x119790)['then'](function(_0x46ea84){_0xae116e['count']=_0x46ea84;if(_0x5573e4[_0xe032('0x33')][_0xe032('0x42')]){_0x38e7ea[_0xe032('0x43')]=[{'all':!![]}];}return db[_0xe032('0x44')]['findAll'](_0x38e7ea);})[_0xe032('0x27')](function(_0x5a6450){_0xae116e[_0xe032('0x45')]=_0x5a6450;return _0xae116e;})[_0xe032('0x27')](respondWithFilteredResult(_0x3e2575,_0x38e7ea))[_0xe032('0x46')](handleError(_0x3e2575,null));};exports[_0xe032('0x47')]=function(_0x4b58eb,_0x513b0c){var _0x45345d={'raw':![],'where':{'id':_0x4b58eb['params']['id']}},_0x203021={};_0x203021[_0xe032('0x2e')]=_[_0xe032('0x32')](db[_0xe032('0x44')][_0xe032('0x2b')]);_0x203021[_0xe032('0x33')]=_['keys'](_0x4b58eb[_0xe032('0x33')]);_0x203021[_0xe032('0x34')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],_0x203021[_0xe032('0x33')]);_0x45345d[_0xe032('0x37')]=_[_0xe032('0x35')](_0x203021[_0xe032('0x2e')],qs['fields'](_0x4b58eb['query'][_0xe032('0x36')]));_0x45345d['attributes']=_0x45345d[_0xe032('0x37')][_0xe032('0x38')]?_0x45345d[_0xe032('0x37')]:_0x203021[_0xe032('0x2e')];if(_0x4b58eb[_0xe032('0x33')][_0xe032('0x42')]){_0x45345d[_0xe032('0x43')]=[{'all':!![]}];}_0x45345d=_[_0xe032('0x3f')]({},_0x45345d,_0x4b58eb[_0xe032('0x41')]);return db['ScreenRecording'][_0xe032('0x48')](_0x45345d)['then'](handleEntityNotFound(_0x513b0c,null))['then'](respondWithResult(_0x513b0c,null))[_0xe032('0x46')](handleError(_0x513b0c,null));};exports[_0xe032('0x49')]=function(_0x62bfc8,_0x1e54d3){return db['ScreenRecording'][_0xe032('0x49')](_0x62bfc8[_0xe032('0x4a')],{})[_0xe032('0x27')](respondWithResult(_0x1e54d3,0xc9))[_0xe032('0x46')](handleError(_0x1e54d3,null));};exports[_0xe032('0x26')]=function(_0x233d9e,_0x3774bc){if(_0x233d9e['body']['id']){delete _0x233d9e[_0xe032('0x4a')]['id'];}delete _0x233d9e[_0xe032('0x4a')]['duration'];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4b')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4c')];delete _0x233d9e[_0xe032('0x4a')][_0xe032('0x4d')];return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x233d9e[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](handleEntityNotFound(_0x3774bc,null))[_0xe032('0x27')](saveUpdates(_0x233d9e[_0xe032('0x4a')],null))[_0xe032('0x27')](respondWithResult(_0x3774bc,null))[_0xe032('0x46')](handleError(_0x3774bc,null));};exports['describe']=function(_0x1c8b32,_0x53c8b2){return db[_0xe032('0x44')][_0xe032('0x4f')]()[_0xe032('0x27')](respondWithResult(_0x53c8b2,null))[_0xe032('0x46')](handleError(_0x53c8b2,null));};exports[_0xe032('0x50')]=function(_0x1b7a91,_0x2e29d3,_0xa98ee6){var _0x16c91e=require(_0xe032('0x51'));var _0x1b9012=![];var _0x564fe0={};if(_0x1b7a91[_0xe032('0x33')][_0xe032('0x2d')]&&_0x1b7a91['query'][_0xe032('0x2d')]==='uniqueid'){_0x564fe0[_0xe032('0x52')]=_0x1b7a91[_0xe032('0x4e')]['id'];}else{_0x564fe0['id']=_0x1b7a91[_0xe032('0x4e')]['id'];}return db[_0xe032('0x44')][_0xe032('0x48')]({'where':_0x564fe0,'attributes':['id','value'],'raw':!![]})[_0xe032('0x27')](handleEntityNotFound(_0x2e29d3,null))[_0xe032('0x27')](function(_0x1e1277){if(_0x1e1277){var _0x21a32f=path[_0xe032('0x53')](config[_0xe032('0x54')],_0xe032('0x55'),_0x1e1277['value']);var _0x3f46c0=util[_0xe032('0x31')](_0xe032('0x56'),_0x21a32f);if(fs[_0xe032('0x57')](_0x3f46c0)){_0x1b9012=!![];return _0x16c91e[_0xe032('0x58')](_0x3f46c0,_0x21a32f,config[_0xe032('0x59')][_0xe032('0x5a')])[_0xe032('0x27')](function(){return _0x1e1277;});}return _0x1e1277;}})[_0xe032('0x27')](function(_0x54c0b0){if(_0x54c0b0){var _0x795a58=path[_0xe032('0x53')](config[_0xe032('0x54')],'server/files/screen_recordings',_0x54c0b0[_0xe032('0x4d')]);if(!fs[_0xe032('0x57')](_0x795a58)){throw new db['Sequelize'][(_0xe032('0x5b'))](_0xe032('0x5c'));}if(_0x54c0b0[_0xe032('0x5d')]){return _0x2e29d3[_0xe032('0x50')](_0x795a58,_0x54c0b0[_0xe032('0x5d')]+path[_0xe032('0x5e')](_0x795a58),function(){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}else{return _0x2e29d3[_0xe032('0x50')](_0x795a58,function(_0x1aa18e){if(_0x1b9012){fs[_0xe032('0x5f')](_0x795a58);}});}}})[_0xe032('0x46')](function(_0x505986){if(_0x505986[_0xe032('0x60')]===_0xe032('0x5c')){_0x2e29d3[_0xe032('0x1d')](0x194)[_0xe032('0x2a')](_0xe032('0x61'));}else{return handleError(_0x2e29d3,null);}});};exports['destroy']=function(_0x2b6ef8,_0x55e6b0){return db[_0xe032('0x44')][_0xe032('0x48')]({'where':{'id':_0x2b6ef8[_0xe032('0x4e')]['id']}})[_0xe032('0x27')](function(_0x3c5eb8){if(_[_0xe032('0x62')](_0x3c5eb8)){throw new ReferenceError(_0xe032('0x63'));}return _0x3c5eb8;})[_0xe032('0x27')](function(_0x22fd01){var _0x536510=path['join'](config['root'],_0xe032('0x55'),_0x22fd01[_0xe032('0x4d')]);logger[_0xe032('0x64')](_0xe032('0x65'),_0x536510);if(!_[_0xe032('0x62')](_0x22fd01[_0xe032('0x4d')])&&fs['existsSync'](_0x536510)){logger[_0xe032('0x64')](_0xe032('0x66')+_0x536510+_0xe032('0x67'));fs['unlinkSync'](_0x536510);}_0x536510=_0x536510+_0xe032('0x68');if(!_['isNil'](_0x22fd01[_0xe032('0x4d')])&&fs[_0xe032('0x57')](_0x536510)){logger['info']('File:\x20\x22'+_0x536510+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe032('0x69')](_0x536510);}return _0x22fd01;})['then'](function(_0x5157f7){if(!_0x5157f7)throw new InternalError();return _0x5157f7[_0xe032('0x6a')]();})[_0xe032('0x27')](function(){_0x55e6b0[_0xe032('0x1d')](0xcc)['end']();})[_0xe032('0x46')](handleError(_0x55e6b0,null));}; \ No newline at end of file +var _0xd0bb=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','fieldName','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','duration','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x1d1da3,_0x387863){_0x1d1da3=_0x1d1da3-0x0;var _0x4ea3b1=_0xd0bb[_0x1d1da3];return _0x4ea3b1;};'use strict';var emlformat=require(_0xbd0b('0x0'));var rimraf=require(_0xbd0b('0x1'));var zipdir=require(_0xbd0b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd0b('0x3'));var moment=require('moment');var BPromise=require(_0xbd0b('0x4'));var Mustache=require(_0xbd0b('0x5'));var util=require('util');var path=require(_0xbd0b('0x6'));var sox=require('sox');var csv=require(_0xbd0b('0x7'));var ejs=require(_0xbd0b('0x8'));var fs=require('fs');var fs_extra=require(_0xbd0b('0x9'));var _=require(_0xbd0b('0xa'));var squel=require(_0xbd0b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbd0b('0xc'));var deskjs=require(_0xbd0b('0xd'));var toCsv=require(_0xbd0b('0x7'));var querystring=require(_0xbd0b('0xe'));var Papa=require(_0xbd0b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd0b('0x10'));var as=require(_0xbd0b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd0b('0x12'))(_0xbd0b('0x13'));var utils=require('../../config/utils');var config=require(_0xbd0b('0x14'));var licenseUtil=require(_0xbd0b('0x15'));var db=require(_0xbd0b('0x16'))['db'];function respondWithStatusCode(_0x315ed9,_0x2621bf){_0x2621bf=_0x2621bf||0xcc;return function(_0x42a96b){if(_0x42a96b){return _0x315ed9[_0xbd0b('0x17')](_0x2621bf);}return _0x315ed9[_0xbd0b('0x18')](_0x2621bf)[_0xbd0b('0x19')]();};}function respondWithResult(_0x1c10c1,_0x2d4664){_0x2d4664=_0x2d4664||0xc8;return function(_0x57077a){if(_0x57077a){return _0x1c10c1[_0xbd0b('0x18')](_0x2d4664)['json'](_0x57077a);}};}function respondWithFilteredResult(_0x4a8014,_0x36d1ca){return function(_0x4c0e52){if(_0x4c0e52){var _0x3183cf=typeof _0x36d1ca[_0xbd0b('0x1a')]===_0xbd0b('0x1b')&&typeof _0x36d1ca['limit']==='undefined';var _0x2136ef=_0x4c0e52[_0xbd0b('0x1c')];var _0x1f2a6e=_0x3183cf?0x0:_0x36d1ca[_0xbd0b('0x1a')];var _0x1c0a7c=_0x3183cf?_0x4c0e52[_0xbd0b('0x1c')]:_0x36d1ca['offset']+_0x36d1ca[_0xbd0b('0x1d')];var _0x49499f;if(_0x1c0a7c>=_0x2136ef){_0x1c0a7c=_0x2136ef;_0x49499f=0xc8;}else{_0x49499f=0xce;}_0x4a8014[_0xbd0b('0x18')](_0x49499f);return _0x4a8014[_0xbd0b('0x1e')](_0xbd0b('0x1f'),_0x1f2a6e+'-'+_0x1c0a7c+'/'+_0x2136ef)[_0xbd0b('0x20')](_0x4c0e52);}return null;};}function patchUpdates(_0x4b312d){return function(_0x403c91){try{jsonpatch[_0xbd0b('0x21')](_0x403c91,_0x4b312d,!![]);}catch(_0x40b021){return BPromise['reject'](_0x40b021);}return _0x403c91[_0xbd0b('0x22')]();};}function saveUpdates(_0x560db4,_0xc66b8){return function(_0x3c4938){if(_0x3c4938){return _0x3c4938[_0xbd0b('0x23')](_0x560db4)[_0xbd0b('0x24')](function(_0x297c85){return _0x297c85;});}return null;};}function removeEntity(_0x539359,_0x75909f){return function(_0x58a721){if(_0x58a721){return _0x58a721[_0xbd0b('0x25')]()[_0xbd0b('0x24')](function(){_0x539359[_0xbd0b('0x18')](0xcc)[_0xbd0b('0x19')]();});}};}function handleEntityNotFound(_0xfd9f82,_0xb06342){return function(_0x4fe9ed){if(!_0x4fe9ed){_0xfd9f82[_0xbd0b('0x17')](0x194);}return _0x4fe9ed;};}function handleError(_0x1b46a3,_0x33b752){_0x33b752=_0x33b752||0x1f4;return function(_0x1b5a00){logger[_0xbd0b('0x26')](_0x1b5a00[_0xbd0b('0x27')]);if(_0x1b5a00['name']){delete _0x1b5a00[_0xbd0b('0x28')];}_0x1b46a3[_0xbd0b('0x18')](_0x33b752)[_0xbd0b('0x29')](_0x1b5a00);};}exports['index']=function(_0x4dfe76,_0x2187a5){var _0x684b09={},_0x14e5a3={},_0xf4ba04={'count':0x0,'rows':[]};var _0x4e2149=_[_0xbd0b('0x2a')](db[_0xbd0b('0x2b')]['rawAttributes'],function(_0x45f7d6){return{'name':_0x45f7d6[_0xbd0b('0x2c')],'type':_0x45f7d6['type']['key']};});_0x14e5a3[_0xbd0b('0x2d')]=_[_0xbd0b('0x2e')](_['map'](_0x4e2149,_0xbd0b('0x28')),[_0xbd0b('0x2f')]);_0x14e5a3[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x30')]);_0x14e5a3[_0xbd0b('0x32')]=_['intersection'](_0x14e5a3[_0xbd0b('0x2d')],_0x14e5a3[_0xbd0b('0x30')]);_0x684b09[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0x14e5a3[_0xbd0b('0x2d')],qs[_0xbd0b('0x35')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x684b09[_0xbd0b('0x33')]=_0x684b09[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x684b09[_0xbd0b('0x33')]:_0x14e5a3[_0xbd0b('0x2d')];if(!_0x4dfe76[_0xbd0b('0x30')]['hasOwnProperty'](_0xbd0b('0x37'))){_0x684b09[_0xbd0b('0x1d')]=qs['limit'](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1d')]);_0x684b09[_0xbd0b('0x1a')]=qs[_0xbd0b('0x1a')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x1a')]);}_0x684b09['order']=qs[_0xbd0b('0x38')](_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x38')]);_0x684b09[_0xbd0b('0x39')]=qs[_0xbd0b('0x32')](_['pick'](_0x4dfe76['query'],_0x14e5a3[_0xbd0b('0x32')]),_0x4e2149);if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]){_0x684b09[_0xbd0b('0x39')]=_['merge'](_0x684b09['where'],{'$or':_[_0xbd0b('0x2a')](_0x4e2149,function(_0x4d8237){if(_0x4d8237[_0xbd0b('0x3b')]!==_0xbd0b('0x3c')){var _0x3f34dc={};_0x3f34dc[_0x4d8237[_0xbd0b('0x28')]]={'$like':'%'+_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3a')]+'%'};return _0x3f34dc;}})});}_0x684b09=_[_0xbd0b('0x3d')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x3e')]);var _0x2acc9f={'where':_0x684b09[_0xbd0b('0x39')]};return db[_0xbd0b('0x2b')][_0xbd0b('0x1c')](_0x2acc9f)[_0xbd0b('0x24')](function(_0x425c8a){_0xf4ba04[_0xbd0b('0x1c')]=_0x425c8a;if(_0x4dfe76[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x684b09[_0xbd0b('0x40')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbd0b('0x41')](_0x684b09);})[_0xbd0b('0x24')](function(_0x89b5ea){_0xf4ba04[_0xbd0b('0x42')]=_0x89b5ea;return _0xf4ba04;})[_0xbd0b('0x24')](respondWithFilteredResult(_0x2187a5,_0x684b09))[_0xbd0b('0x43')](handleError(_0x2187a5,null));};exports[_0xbd0b('0x44')]=function(_0x1b4497,_0x2a1a1d){var _0x4d72f={'raw':![],'where':{'id':_0x1b4497[_0xbd0b('0x45')]['id']}},_0xa252a2={};_0xa252a2['model']=_[_0xbd0b('0x31')](db['ScreenRecording']['rawAttributes']);_0xa252a2[_0xbd0b('0x30')]=_[_0xbd0b('0x31')](_0x1b4497[_0xbd0b('0x30')]);_0xa252a2['filters']=_[_0xbd0b('0x34')](_0xa252a2[_0xbd0b('0x2d')],_0xa252a2[_0xbd0b('0x30')]);_0x4d72f[_0xbd0b('0x33')]=_[_0xbd0b('0x34')](_0xa252a2['model'],qs[_0xbd0b('0x35')](_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x35')]));_0x4d72f[_0xbd0b('0x33')]=_0x4d72f[_0xbd0b('0x33')][_0xbd0b('0x36')]?_0x4d72f['attributes']:_0xa252a2[_0xbd0b('0x2d')];if(_0x1b4497[_0xbd0b('0x30')][_0xbd0b('0x3f')]){_0x4d72f[_0xbd0b('0x40')]=[{'all':!![]}];}_0x4d72f=_[_0xbd0b('0x3d')]({},_0x4d72f,_0x1b4497[_0xbd0b('0x3e')]);return db[_0xbd0b('0x2b')][_0xbd0b('0x46')](_0x4d72f)[_0xbd0b('0x24')](handleEntityNotFound(_0x2a1a1d,null))[_0xbd0b('0x24')](respondWithResult(_0x2a1a1d,null))[_0xbd0b('0x43')](handleError(_0x2a1a1d,null));};exports[_0xbd0b('0x47')]=function(_0x222ee1,_0x30f77e){return db[_0xbd0b('0x2b')][_0xbd0b('0x47')](_0x222ee1[_0xbd0b('0x48')],{})[_0xbd0b('0x24')](respondWithResult(_0x30f77e,0xc9))[_0xbd0b('0x43')](handleError(_0x30f77e,null));};exports[_0xbd0b('0x23')]=function(_0x3cfb52,_0xbd64e2){if(_0x3cfb52[_0xbd0b('0x48')]['id']){delete _0x3cfb52['body']['id'];}delete _0x3cfb52[_0xbd0b('0x48')][_0xbd0b('0x49')];delete _0x3cfb52['body']['createdAt'];delete _0x3cfb52['body'][_0xbd0b('0x4a')];delete _0x3cfb52['body'][_0xbd0b('0x4b')];return db[_0xbd0b('0x2b')][_0xbd0b('0x46')]({'where':{'id':_0x3cfb52[_0xbd0b('0x45')]['id']}})['then'](handleEntityNotFound(_0xbd64e2,null))[_0xbd0b('0x24')](saveUpdates(_0x3cfb52['body'],null))[_0xbd0b('0x24')](respondWithResult(_0xbd64e2,null))['catch'](handleError(_0xbd64e2,null));};exports['describe']=function(_0x80d89a,_0x22f741){return db[_0xbd0b('0x2b')][_0xbd0b('0x4c')]()[_0xbd0b('0x24')](respondWithResult(_0x22f741,null))[_0xbd0b('0x43')](handleError(_0x22f741,null));};exports[_0xbd0b('0x4d')]=function(_0x2a7252,_0x4cc013,_0x48a78c){var _0x2d13fd=require(_0xbd0b('0x4e'));var _0x5094bd=![];var _0x514985={};if(_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]&&_0x2a7252[_0xbd0b('0x30')][_0xbd0b('0x3b')]==='uniqueid'){_0x514985[_0xbd0b('0x4f')]=_0x2a7252[_0xbd0b('0x45')]['id'];}else{_0x514985['id']=_0x2a7252[_0xbd0b('0x45')]['id'];}return db[_0xbd0b('0x2b')]['find']({'where':_0x514985,'attributes':['id',_0xbd0b('0x4b')],'raw':!![]})[_0xbd0b('0x24')](handleEntityNotFound(_0x4cc013,null))['then'](function(_0x122a19){if(_0x122a19){var _0x1ea443=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],_0xbd0b('0x52'),_0x122a19[_0xbd0b('0x4b')]);var _0x3a526a=util[_0xbd0b('0x2f')]('%s.cypher',_0x1ea443);if(fs[_0xbd0b('0x53')](_0x3a526a)){_0x5094bd=!![];return _0x2d13fd[_0xbd0b('0x54')](_0x3a526a,_0x1ea443,config[_0xbd0b('0x55')][_0xbd0b('0x56')])[_0xbd0b('0x24')](function(){return _0x122a19;});}return _0x122a19;}})[_0xbd0b('0x24')](function(_0x49b7a6){if(_0x49b7a6){var _0x570648=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x49b7a6[_0xbd0b('0x4b')]);if(!fs[_0xbd0b('0x53')](_0x570648)){throw new db[(_0xbd0b('0x57'))][(_0xbd0b('0x58'))](_0xbd0b('0x59'));}if(_0x49b7a6['filename']){return _0x4cc013[_0xbd0b('0x4d')](_0x570648,_0x49b7a6[_0xbd0b('0x5a')]+path[_0xbd0b('0x5b')](_0x570648),function(){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}else{return _0x4cc013[_0xbd0b('0x4d')](_0x570648,function(_0xa08f72){if(_0x5094bd){fs[_0xbd0b('0x5c')](_0x570648);}});}}})[_0xbd0b('0x43')](function(_0x429534){if(_0x429534[_0xbd0b('0x5d')]===_0xbd0b('0x59')){_0x4cc013[_0xbd0b('0x18')](0x194)[_0xbd0b('0x29')](_0xbd0b('0x5e'));}else{return handleError(_0x4cc013,null);}});};exports[_0xbd0b('0x25')]=function(_0x1fefd5,_0x1e0beb){return db['ScreenRecording'][_0xbd0b('0x46')]({'where':{'id':_0x1fefd5[_0xbd0b('0x45')]['id']}})[_0xbd0b('0x24')](function(_0x2c935c){if(_['isNil'](_0x2c935c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2c935c;})[_0xbd0b('0x24')](function(_0x45c6b5){var _0x4317f0=path[_0xbd0b('0x50')](config[_0xbd0b('0x51')],'server/files/screen_recordings',_0x45c6b5[_0xbd0b('0x4b')]);logger['info'](_0xbd0b('0x5f'),_0x4317f0);if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs[_0xbd0b('0x53')](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbd0b('0x63')](_0x4317f0);}_0x4317f0=_0x4317f0+_0xbd0b('0x64');if(!_[_0xbd0b('0x60')](_0x45c6b5[_0xbd0b('0x4b')])&&fs['existsSync'](_0x4317f0)){logger[_0xbd0b('0x61')](_0xbd0b('0x62')+_0x4317f0+_0xbd0b('0x65'));fs[_0xbd0b('0x63')](_0x4317f0);}return _0x45c6b5;})[_0xbd0b('0x24')](function(_0x4df3df){if(!_0x4df3df)throw new InternalError();return _0x4df3df['destroy']();})[_0xbd0b('0x24')](function(){_0x1e0beb['status'](0xcc)[_0xbd0b('0x19')]();})[_0xbd0b('0x43')](handleError(_0x1e0beb,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 11dae40..4bef5a6 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 _0x4765=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4765,0x184));var _0x5476=function(_0x32d4b6,_0x1af25c){_0x32d4b6=_0x32d4b6-0x0;var _0x270634=_0x4765[_0x32d4b6];return _0x270634;};'use strict';var _=require(_0x5476('0x0'));var util=require(_0x5476('0x1'));var logger=require(_0x5476('0x2'))(_0x5476('0x3'));var moment=require('moment');var BPromise=require(_0x5476('0x4'));var rp=require(_0x5476('0x5'));var fs=require('fs');var path=require(_0x5476('0x6'));var rimraf=require(_0x5476('0x7'));var config=require(_0x5476('0x8'));var attributes=require(_0x5476('0x9'));module[_0x5476('0xa')]=function(_0x1356c0,_0x40d5b2){return _0x1356c0[_0x5476('0xb')](_0x5476('0xc'),attributes,{'tableName':_0x5476('0xd'),'paranoid':![],'indexes':[{'name':_0x5476('0xe'),'fields':[_0x5476('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9f2=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x180659,_0xa1b1c4){var _0x224761=function(_0xe29201){while(--_0xe29201){_0x180659['push'](_0x180659['shift']());}};_0x224761(++_0xa1b1c4);}(_0xb9f2,0x119));var _0x2b9f=function(_0x381c63,_0x1beaa0){_0x381c63=_0x381c63-0x0;var _0x8a9389=_0xb9f2[_0x381c63];return _0x8a9389;};'use strict';var _=require(_0x2b9f('0x0'));var util=require(_0x2b9f('0x1'));var logger=require(_0x2b9f('0x2'))(_0x2b9f('0x3'));var moment=require(_0x2b9f('0x4'));var BPromise=require(_0x2b9f('0x5'));var rp=require(_0x2b9f('0x6'));var fs=require('fs');var path=require(_0x2b9f('0x7'));var rimraf=require(_0x2b9f('0x8'));var config=require(_0x2b9f('0x9'));var attributes=require(_0x2b9f('0xa'));module[_0x2b9f('0xb')]=function(_0x3302d7,_0x4d7ced){return _0x3302d7[_0x2b9f('0xc')]('ScreenRecording',attributes,{'tableName':_0x2b9f('0xd'),'paranoid':![],'indexes':[{'name':_0x2b9f('0xe'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 90c23c5..45707df 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 _0x9038=['stringify','error','message','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s'];(function(_0x3d563c,_0x1166e3){var _0x32522d=function(_0x5a5a54){while(--_0x5a5a54){_0x3d563c['push'](_0x3d563c['shift']());}};_0x32522d(++_0x1166e3);}(_0x9038,0x7d));var _0x8903=function(_0x41d8a0,_0x36c9e1){_0x41d8a0=_0x41d8a0-0x0;var _0x59d220=_0x9038[_0x41d8a0];return _0x59d220;};'use strict';var _=require(_0x8903('0x0'));var util=require(_0x8903('0x1'));var moment=require(_0x8903('0x2'));var BPromise=require('bluebird');var rs=require(_0x8903('0x3'));var fs=require('fs');var Redis=require(_0x8903('0x4'));var db=require(_0x8903('0x5'))['db'];var utils=require(_0x8903('0x6'));var logger=require(_0x8903('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8903('0x8'));var client=jayson[_0x8903('0x9')][_0x8903('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d9068,_0x4c51e1,_0x37f800){return new BPromise(function(_0x2aacf1,_0x5663e4){return client[_0x8903('0xb')](_0x1d9068,_0x37f800)[_0x8903('0xc')](function(_0x557354){logger[_0x8903('0xd')](_0x8903('0xe'),_0x4c51e1,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4c51e1,'request\x20sent',JSON[_0x8903('0xf')](_0x557354));if(_0x557354['error']){if(_0x557354[_0x8903('0x10')]['code']===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x4c51e1,_0x557354[_0x8903('0x10')][_0x8903('0x11')]);return _0x5663e4(_0x557354[_0x8903('0x10')][_0x8903('0x11')]);}logger[_0x8903('0x10')](_0x8903('0xe'),_0x4c51e1,_0x557354['error'][_0x8903('0x11')]);return _0x2aacf1(_0x557354['error'][_0x8903('0x11')]);}else{logger['info'](_0x8903('0xe'),_0x4c51e1,_0x8903('0x12'));_0x2aacf1(_0x557354['result'][_0x8903('0x11')]);}})[_0x8903('0x13')](function(_0xcbf6c6){logger[_0x8903('0x10')](_0x8903('0xe'),_0x4c51e1,_0xcbf6c6);_0x5663e4(_0xcbf6c6);});});} \ No newline at end of file +var _0xf73a=['catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ScreenRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x309408,_0x9b92d8){var _0x1cf56b=function(_0x5543d1){while(--_0x5543d1){_0x309408['push'](_0x309408['shift']());}};_0x1cf56b(++_0x9b92d8);}(_0xf73a,0x166));var _0xaf73=function(_0x12f01a,_0x5a8227){_0x12f01a=_0x12f01a-0x0;var _0x521c28=_0xf73a[_0x12f01a];return _0x521c28;};'use strict';var _=require('lodash');var util=require(_0xaf73('0x0'));var moment=require(_0xaf73('0x1'));var BPromise=require('bluebird');var rs=require(_0xaf73('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf73('0x3'))['db'];var utils=require(_0xaf73('0x4'));var logger=require('../../config/logger')(_0xaf73('0x5'));var config=require(_0xaf73('0x6'));var jayson=require(_0xaf73('0x7'));var client=jayson[_0xaf73('0x8')][_0xaf73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x143ba6,_0x4bd4ec,_0x8cd2c7){return new BPromise(function(_0x4e9794,_0x5476c4){return client[_0xaf73('0xa')](_0x143ba6,_0x8cd2c7)[_0xaf73('0xb')](function(_0x386ae0){logger['info'](_0xaf73('0xc'),_0x4bd4ec,'request\x20sent');logger[_0xaf73('0xd')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x4bd4ec,_0xaf73('0xe'),JSON[_0xaf73('0xf')](_0x386ae0));if(_0x386ae0[_0xaf73('0x10')]){if(_0x386ae0[_0xaf73('0x10')][_0xaf73('0x11')]===0x1f4){logger[_0xaf73('0x10')](_0xaf73('0xc'),_0x4bd4ec,_0x386ae0[_0xaf73('0x10')]['message']);return _0x5476c4(_0x386ae0['error']['message']);}logger[_0xaf73('0x10')](_0xaf73('0xc'),_0x4bd4ec,_0x386ae0[_0xaf73('0x10')][_0xaf73('0x12')]);return _0x4e9794(_0x386ae0[_0xaf73('0x10')][_0xaf73('0x12')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x4bd4ec,_0xaf73('0xe'));_0x4e9794(_0x386ae0[_0xaf73('0x13')][_0xaf73('0x12')]);}})[_0xaf73('0x14')](function(_0x312418){logger[_0xaf73('0x10')](_0xaf73('0xc'),_0x4bd4ec,_0x312418);_0x5476c4(_0x312418);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 9c1ba8a..9c2cb28 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 _0xfb0c=['%s%s','preferred','extname','/:id/preferred','addPreferred','favicon','addFavicon','put','update','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','logo','post','/:id/logo','single','file','addLogo','logologin','originalname','addLogoLogin'];(function(_0x40e263,_0xad0ad2){var _0x234986=function(_0x1fbe15){while(--_0x1fbe15){_0x40e263['push'](_0x40e263['shift']());}};_0x234986(++_0xad0ad2);}(_0xfb0c,0x1c1));var _0xcfb0=function(_0x51fb84,_0x1c7f04){_0x51fb84=_0x51fb84-0x0;var _0x1ac65f=_0xfb0c[_0x51fb84];return _0x1ac65f;};'use strict';var multer=require(_0xcfb0('0x0'));var util=require(_0xcfb0('0x1'));var path=require(_0xcfb0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcfb0('0x3')]();var fs_extra=require(_0xcfb0('0x4'));var auth=require(_0xcfb0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcfb0('0x6'));var controller=require(_0xcfb0('0x7'));router[_0xcfb0('0x8')]('/',auth[_0xcfb0('0x9')](),controller[_0xcfb0('0xa')]);router[_0xcfb0('0x8')](_0xcfb0('0xb'),controller['getDate']);router[_0xcfb0('0x8')](_0xcfb0('0xc'),controller[_0xcfb0('0xd')]);router[_0xcfb0('0x8')]('/:id/logo',controller[_0xcfb0('0xe')]);router[_0xcfb0('0x8')](_0xcfb0('0xf'),controller[_0xcfb0('0x10')]);router[_0xcfb0('0x8')](_0xcfb0('0x11'),controller[_0xcfb0('0x12')]);router[_0xcfb0('0x8')]('/:id/preferred',controller[_0xcfb0('0x13')]);router[_0xcfb0('0x8')](_0xcfb0('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0xcfb0('0x15')]({'destination':function(_0x18070d,_0x33393,_0x172e9a){_0x172e9a(null,path[_0xcfb0('0x16')](config[_0xcfb0('0x17')],_0xcfb0('0x18')));},'filename':function(_0x25c488,_0x523787,_0x4c6b79){_0x4c6b79(null,util[_0xcfb0('0x19')]('%s%s',_0xcfb0('0x1a'),path['extname'](_0x523787['originalname'])));}})});router[_0xcfb0('0x1b')](_0xcfb0('0x1c'),upload[_0xcfb0('0x1d')](_0xcfb0('0x1e')),controller[_0xcfb0('0x1f')]);var upload=multer({'storage':multer[_0xcfb0('0x15')]({'destination':function(_0x4b06f6,_0x394d4e,_0x1ddc6a){_0x1ddc6a(null,path[_0xcfb0('0x16')](config[_0xcfb0('0x17')],'server/files/images/logos/'));},'filename':function(_0x5426ab,_0x551824,_0x10d825){_0x10d825(null,util[_0xcfb0('0x19')]('%s%s',_0xcfb0('0x20'),path['extname'](_0x551824[_0xcfb0('0x21')])));}})});router['post'](_0xcfb0('0xf'),upload[_0xcfb0('0x1d')](_0xcfb0('0x1e')),controller[_0xcfb0('0x22')]);var upload=multer({'storage':multer[_0xcfb0('0x15')]({'destination':function(_0x2dc316,_0x210fee,_0x5a9317){_0x5a9317(null,path[_0xcfb0('0x16')](config[_0xcfb0('0x17')],_0xcfb0('0x18')));},'filename':function(_0xc44bae,_0xfa6049,_0x449c4e){_0x449c4e(null,util[_0xcfb0('0x19')](_0xcfb0('0x23'),_0xcfb0('0x24'),path[_0xcfb0('0x25')](_0xfa6049[_0xcfb0('0x21')])));}})});router['post'](_0xcfb0('0x26'),upload[_0xcfb0('0x1d')](_0xcfb0('0x1e')),controller[_0xcfb0('0x27')]);var upload=multer({'storage':multer[_0xcfb0('0x15')]({'destination':function(_0x20efb3,_0x539ec4,_0x175505){_0x175505(null,path['join'](config['root'],_0xcfb0('0x18')));},'filename':function(_0x5da29b,_0x4b4423,_0x501a61){_0x501a61(null,util[_0xcfb0('0x19')](_0xcfb0('0x23'),_0xcfb0('0x28'),path[_0xcfb0('0x25')](_0x4b4423[_0xcfb0('0x21')])));}})});router['post'](_0xcfb0('0x14'),upload[_0xcfb0('0x1d')](_0xcfb0('0x1e')),controller[_0xcfb0('0x29')]);router[_0xcfb0('0x2a')](_0xcfb0('0xc'),auth[_0xcfb0('0x9')](),controller[_0xcfb0('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xfae6=['format','logo','extname','originalname','post','single','file','server/files/images/logos/','logologin','addLogoLogin','%s%s','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/now','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root'];(function(_0x20ab38,_0x4bf6f2){var _0x1c489e=function(_0x26c915){while(--_0x26c915){_0x20ab38['push'](_0x20ab38['shift']());}};_0x1c489e(++_0x4bf6f2);}(_0xfae6,0x138));var _0x6fae=function(_0x153449,_0x1e1a30){_0x153449=_0x153449-0x0;var _0x503edb=_0xfae6[_0x153449];return _0x503edb;};'use strict';var multer=require(_0x6fae('0x0'));var util=require(_0x6fae('0x1'));var path=require(_0x6fae('0x2'));var timeout=require(_0x6fae('0x3'));var express=require(_0x6fae('0x4'));var router=express['Router']();var fs_extra=require(_0x6fae('0x5'));var auth=require(_0x6fae('0x6'));var interaction=require(_0x6fae('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x6fae('0x8')]('/',auth[_0x6fae('0x9')](),controller[_0x6fae('0xa')]);router[_0x6fae('0x8')](_0x6fae('0xb'),controller['getDate']);router['get'](_0x6fae('0xc'),controller[_0x6fae('0xd')]);router['get'](_0x6fae('0xe'),controller[_0x6fae('0xf')]);router[_0x6fae('0x8')](_0x6fae('0x10'),controller[_0x6fae('0x11')]);router[_0x6fae('0x8')]('/:id/gdpr',controller['gdpr']);router[_0x6fae('0x8')](_0x6fae('0x12'),controller['getPreferred']);router[_0x6fae('0x8')](_0x6fae('0x13'),controller[_0x6fae('0x14')]);var upload=multer({'storage':multer[_0x6fae('0x15')]({'destination':function(_0x39169c,_0x4703e3,_0x2a0ec4){_0x2a0ec4(null,path[_0x6fae('0x16')](config[_0x6fae('0x17')],'server/files/images/logos/'));},'filename':function(_0xc5d922,_0x285bf4,_0x1a4020){_0x1a4020(null,util[_0x6fae('0x18')]('%s%s',_0x6fae('0x19'),path[_0x6fae('0x1a')](_0x285bf4[_0x6fae('0x1b')])));}})});router[_0x6fae('0x1c')](_0x6fae('0xe'),upload[_0x6fae('0x1d')](_0x6fae('0x1e')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf912bb,_0x2eaafc,_0x4b9e55){_0x4b9e55(null,path[_0x6fae('0x16')](config[_0x6fae('0x17')],_0x6fae('0x1f')));},'filename':function(_0x3cc1e0,_0x344c4e,_0x5d5537){_0x5d5537(null,util['format']('%s%s',_0x6fae('0x20'),path[_0x6fae('0x1a')](_0x344c4e[_0x6fae('0x1b')])));}})});router[_0x6fae('0x1c')](_0x6fae('0x10'),upload[_0x6fae('0x1d')](_0x6fae('0x1e')),controller[_0x6fae('0x21')]);var upload=multer({'storage':multer[_0x6fae('0x15')]({'destination':function(_0x5b71c1,_0x5c208b,_0x1dc31f){_0x1dc31f(null,path[_0x6fae('0x16')](config['root'],_0x6fae('0x1f')));},'filename':function(_0x500772,_0x3b7fa0,_0x12bf82){_0x12bf82(null,util[_0x6fae('0x18')](_0x6fae('0x22'),_0x6fae('0x23'),path['extname'](_0x3b7fa0[_0x6fae('0x1b')])));}})});router[_0x6fae('0x1c')](_0x6fae('0x12'),upload['single'](_0x6fae('0x1e')),controller[_0x6fae('0x24')]);var upload=multer({'storage':multer[_0x6fae('0x15')]({'destination':function(_0x101ca7,_0x3fa933,_0x52011d){_0x52011d(null,path['join'](config[_0x6fae('0x17')],_0x6fae('0x1f')));},'filename':function(_0x5293b9,_0x4a7174,_0x579243){_0x579243(null,util['format'](_0x6fae('0x22'),_0x6fae('0x25'),path[_0x6fae('0x1a')](_0x4a7174['originalname'])));}})});router[_0x6fae('0x1c')](_0x6fae('0x13'),upload[_0x6fae('0x1d')]('file'),controller[_0x6fae('0x26')]);router[_0x6fae('0x27')](_0x6fae('0xc'),auth['isAuthenticated'](),controller[_0x6fae('0x28')]);module[_0x6fae('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 34c0636..3513ed9 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 _0x2d34=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','exports','min_internal','INTEGER'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0x2d34,0x1d1));var _0x42d3=function(_0x5c262a,_0x212d55){_0x5c262a=_0x5c262a-0x0;var _0x298600=_0x2d34[_0x5c262a];return _0x298600;};'use strict';var Sequelize=require('sequelize');module[_0x42d3('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x42d3('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x42d3('0x2')](0xb),'unique':_0x42d3('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x42d3('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x42d3('0x4')],'defaultValue':_0x42d3('0x5')},'logo':{'type':Sequelize[_0x42d3('0x4')]},'defaultLogo':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x42d3('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x42d3('0x4')]},'turnaddr':{'type':Sequelize[_0x42d3('0x4')]},'turnusername':{'type':Sequelize[_0x42d3('0x4')]},'turnpassword':{'type':Sequelize[_0x42d3('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x42d3('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x42d3('0x4')],'defaultValue':_0x42d3('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x42d3('0x4')]},'defaultPreferred':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x42d3('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x42d3('0x2')]},'transcribeRegion':{'type':Sequelize[_0x42d3('0x4')]},'sentiment':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x42d3('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x42d3('0x4')]},'bucket':{'type':Sequelize[_0x42d3('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x42d3('0x2')](0x2)[_0x42d3('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x42d3('0x2')](0x2)[_0x42d3('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x42d3('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x42d3('0x2')](0x2)[_0x42d3('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x42d3('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x42d3('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xae4b=['https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','min_mailbox','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN'];(function(_0xd85a3a,_0x12a9d2){var _0x3bee06=function(_0x42c465){while(--_0x42c465){_0xd85a3a['push'](_0xd85a3a['shift']());}};_0x3bee06(++_0x12a9d2);}(_0xae4b,0x18e));var _0xbae4=function(_0x352cec,_0x9b459f){_0x352cec=_0x352cec-0x0;var _0x333d77=_0xae4b[_0x352cec];return _0x333d77;};'use strict';var Sequelize=require(_0xbae4('0x0'));module[_0xbae4('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xbae4('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xbae4('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xbae4('0x4')],'defaultValue':_0xbae4('0x5')},'logo':{'type':Sequelize[_0xbae4('0x4')]},'defaultLogo':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xbae4('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xbae4('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xbae4('0x4')]},'turnaddr':{'type':Sequelize[_0xbae4('0x4')]},'turnusername':{'type':Sequelize[_0xbae4('0x4')]},'turnpassword':{'type':Sequelize[_0xbae4('0x4')]},'pageTitle':{'type':Sequelize[_0xbae4('0x4')]},'defaultPageTitle':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xbae4('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xbae4('0x4')],'defaultValue':_0xbae4('0x7')},'enableEmailPreview':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xbae4('0x4')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xbae4('0x4')]},'defaultFavicon':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xbae4('0x4')]},'sentiment':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xbae4('0x3')]},'sentimentRegion':{'type':Sequelize[_0xbae4('0x4')]},'language':{'type':Sequelize[_0xbae4('0x4')]},'bucket':{'type':Sequelize[_0xbae4('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xbae4('0x3')](0x2)[_0xbae4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xbae4('0x3')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xbae4('0x3')](0x2)[_0xbae4('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xbae4('0x3')](0x2)[_0xbae4('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xbae4('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xbae4('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ca122d4..027e0d0 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 _0xd976=['getLicense','preferred','defaultLogo','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','custom','default_logo.svg','Sequelize','download','defaultLoginLogo','defaultPreferred','default_loginLogo.svg','ValidationError','gdpr','securePassword','getPreferred','favicon','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','eml-format','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','apply','save','destroy','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','length','find','update','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos'];(function(_0x37037a,_0xfaa9d2){var _0x26ace0=function(_0x5a96b8){while(--_0x5a96b8){_0x37037a['push'](_0x37037a['shift']());}};_0x26ace0(++_0xfaa9d2);}(_0xd976,0x179));var _0x6d97=function(_0x52fc84,_0x1f84c7){_0x52fc84=_0x52fc84-0x0;var _0x19c3e6=_0xd976[_0x52fc84];return _0x19c3e6;};'use strict';var emlformat=require(_0x6d97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d97('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d97('0x2'));var moment=require('moment');var BPromise=require(_0x6d97('0x3'));var Mustache=require('mustache');var util=require(_0x6d97('0x4'));var path=require('path');var sox=require(_0x6d97('0x5'));var csv=require('to-csv');var ejs=require(_0x6d97('0x6'));var fs=require('fs');var fs_extra=require(_0x6d97('0x7'));var _=require(_0x6d97('0x8'));var squel=require(_0x6d97('0x9'));var crypto=require('crypto');var jsforce=require(_0x6d97('0xa'));var deskjs=require(_0x6d97('0xb'));var toCsv=require(_0x6d97('0xc'));var querystring=require(_0x6d97('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d97('0xe'));var as=require(_0x6d97('0xf'));var hardwareService=require(_0x6d97('0x10'));var logger=require(_0x6d97('0x11'))(_0x6d97('0x12'));var utils=require(_0x6d97('0x13'));var config=require(_0x6d97('0x14'));var licenseUtil=require(_0x6d97('0x15'));var db=require(_0x6d97('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x6d97('0x17')][_0x6d97('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2ca76e,_0x55ae41,_0xf70975,_0x18fb77){return new BPromise(function(_0x53f38d,_0x25229b){var _0x11fecb=_0x18fb77||client;return _0x11fecb['request'](_0x2ca76e,_0xf70975)[_0x6d97('0x19')](function(_0x358966){logger[_0x6d97('0x1a')](_0x6d97('0x1b'),_0x55ae41,_0x6d97('0x1c'));logger[_0x6d97('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x55ae41,_0x6d97('0x1c'),JSON[_0x6d97('0x1e')](_0x358966));if(_0x358966[_0x6d97('0x1f')]){if(_0x358966[_0x6d97('0x1f')][_0x6d97('0x20')]===0x1f4){logger['error'](_0x6d97('0x1b'),_0x55ae41,_0x358966[_0x6d97('0x1f')][_0x6d97('0x21')]);return _0x25229b(_0x358966['error'][_0x6d97('0x21')]);}logger[_0x6d97('0x1f')]('Setting,\x20%s,\x20%s',_0x55ae41,_0x358966[_0x6d97('0x1f')][_0x6d97('0x21')]);return _0x53f38d(_0x358966[_0x6d97('0x1f')][_0x6d97('0x21')]);}else{logger[_0x6d97('0x1a')](_0x6d97('0x1b'),_0x55ae41,'request\x20sent');_0x53f38d(_0x358966[_0x6d97('0x22')][_0x6d97('0x21')]);}})[_0x6d97('0x23')](function(_0x51ac10){logger['error'](_0x6d97('0x1b'),_0x55ae41,_0x51ac10);_0x25229b(_0x51ac10);});});}function respondWithStatusCode(_0x31c800,_0x48d97c){_0x48d97c=_0x48d97c||0xcc;return function(_0x1f59b4){if(_0x1f59b4){return _0x31c800[_0x6d97('0x24')](_0x48d97c);}return _0x31c800[_0x6d97('0x25')](_0x48d97c)['end']();};}function respondWithResult(_0xe053bd,_0x10e967){_0x10e967=_0x10e967||0xc8;return function(_0x39299f){if(_0x39299f){return _0xe053bd[_0x6d97('0x25')](_0x10e967)['json'](_0x39299f);}};}function respondWithFilteredResult(_0x4729be,_0x186102){return function(_0x113f47){if(_0x113f47){var _0x52a5e4=typeof _0x186102[_0x6d97('0x26')]===_0x6d97('0x27')&&typeof _0x186102['limit']==='undefined';var _0xc0b8bd=_0x113f47['count'];var _0x4abb13=_0x52a5e4?0x0:_0x186102[_0x6d97('0x26')];var _0x39cb85=_0x52a5e4?_0x113f47['count']:_0x186102[_0x6d97('0x26')]+_0x186102['limit'];var _0x1a8075;if(_0x39cb85>=_0xc0b8bd){_0x39cb85=_0xc0b8bd;_0x1a8075=0xc8;}else{_0x1a8075=0xce;}_0x4729be['status'](_0x1a8075);return _0x4729be['set']('Content-Range',_0x4abb13+'-'+_0x39cb85+'/'+_0xc0b8bd)['json'](_0x113f47);}return null;};}function patchUpdates(_0x5a3ad0){return function(_0x67615b){try{jsonpatch[_0x6d97('0x28')](_0x67615b,_0x5a3ad0,!![]);}catch(_0x239b93){return BPromise['reject'](_0x239b93);}return _0x67615b[_0x6d97('0x29')]();};}function saveUpdates(_0x1f7bf4,_0xc725ac){return function(_0x24a75d){if(_0x24a75d){return _0x24a75d['update'](_0x1f7bf4)[_0x6d97('0x19')](function(_0x4b261e){return _0x4b261e;});}return null;};}function removeEntity(_0x40ed34,_0x1a7168){return function(_0x418694){if(_0x418694){return _0x418694[_0x6d97('0x2a')]()[_0x6d97('0x19')](function(){_0x40ed34[_0x6d97('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x128a93,_0x10dec1){return function(_0x80a23c){if(!_0x80a23c){_0x128a93[_0x6d97('0x24')](0x194);}return _0x80a23c;};}function handleError(_0x27bdaf,_0x22e30e){_0x22e30e=_0x22e30e||0x1f4;return function(_0x5c4706){logger[_0x6d97('0x1f')](_0x5c4706['stack']);if(_0x5c4706[_0x6d97('0x2b')]){delete _0x5c4706[_0x6d97('0x2b')];}_0x27bdaf['status'](_0x22e30e)[_0x6d97('0x2c')](_0x5c4706);};}exports[_0x6d97('0x2d')]=function(_0x4dc447,_0x3bc4d5){var _0x469c3c={},_0x38bb07={},_0x39c83a={'count':0x0,'rows':[]};var _0x4d3fd4=_[_0x6d97('0x2e')](db[_0x6d97('0x2f')]['rawAttributes'],function(_0x13a103){return{'name':_0x13a103[_0x6d97('0x30')],'type':_0x13a103[_0x6d97('0x31')][_0x6d97('0x32')]};});_0x38bb07[_0x6d97('0x33')]=_['map'](_0x4d3fd4,_0x6d97('0x2b'));_0x38bb07[_0x6d97('0x34')]=_[_0x6d97('0x35')](_0x4dc447[_0x6d97('0x34')]);_0x38bb07['filters']=_[_0x6d97('0x36')](_0x38bb07[_0x6d97('0x33')],_0x38bb07[_0x6d97('0x34')]);_0x469c3c[_0x6d97('0x37')]=_[_0x6d97('0x36')](_0x38bb07['model'],qs[_0x6d97('0x38')](_0x4dc447[_0x6d97('0x34')]['fields']));_0x469c3c[_0x6d97('0x37')]=_0x469c3c[_0x6d97('0x37')]['length']?_0x469c3c['attributes']:_0x38bb07[_0x6d97('0x33')];if(!_0x4dc447[_0x6d97('0x34')][_0x6d97('0x39')](_0x6d97('0x3a'))){_0x469c3c['limit']=qs[_0x6d97('0x3b')](_0x4dc447[_0x6d97('0x34')][_0x6d97('0x3b')]);_0x469c3c[_0x6d97('0x26')]=qs[_0x6d97('0x26')](_0x4dc447[_0x6d97('0x34')]['offset']);}_0x469c3c[_0x6d97('0x3c')]=qs['sort'](_0x4dc447[_0x6d97('0x34')][_0x6d97('0x3d')]);_0x469c3c[_0x6d97('0x3e')]=qs[_0x6d97('0x3f')](_[_0x6d97('0x40')](_0x4dc447[_0x6d97('0x34')],_0x38bb07[_0x6d97('0x3f')]),_0x4d3fd4);if(_0x4dc447[_0x6d97('0x34')][_0x6d97('0x41')]){_0x469c3c[_0x6d97('0x3e')]=_[_0x6d97('0x42')](_0x469c3c['where'],{'$or':_['map'](_0x4d3fd4,function(_0x25646e){if(_0x25646e[_0x6d97('0x31')]!==_0x6d97('0x43')){var _0x4c2933={};_0x4c2933[_0x25646e[_0x6d97('0x2b')]]={'$like':'%'+_0x4dc447[_0x6d97('0x34')][_0x6d97('0x41')]+'%'};return _0x4c2933;}})});}_0x469c3c=_[_0x6d97('0x42')]({},_0x469c3c,_0x4dc447[_0x6d97('0x44')]);var _0x190334={'where':_0x469c3c[_0x6d97('0x3e')]};return db['Setting'][_0x6d97('0x45')](_0x190334)[_0x6d97('0x19')](function(_0x5cad2a){_0x39c83a[_0x6d97('0x45')]=_0x5cad2a;if(_0x4dc447[_0x6d97('0x34')][_0x6d97('0x46')]){_0x469c3c[_0x6d97('0x47')]=[{'all':!![]}];}return db[_0x6d97('0x2f')][_0x6d97('0x48')](_0x469c3c);})['then'](function(_0x43eb49){_0x39c83a[_0x6d97('0x49')]=_0x43eb49;return _0x39c83a;})['then'](respondWithFilteredResult(_0x3bc4d5,_0x469c3c))['catch'](handleError(_0x3bc4d5,null));};exports['show']=function(_0x18b153,_0x5614c2){var _0x4947a9={'raw':![],'where':{'id':_0x18b153[_0x6d97('0x4a')]['id']}},_0x398b40={};_0x398b40[_0x6d97('0x33')]=_[_0x6d97('0x35')](db['Setting']['rawAttributes']);_0x398b40[_0x6d97('0x34')]=_[_0x6d97('0x35')](_0x18b153['query']);_0x398b40[_0x6d97('0x3f')]=_['intersection'](_0x398b40['model'],_0x398b40[_0x6d97('0x34')]);_0x4947a9['attributes']=_[_0x6d97('0x36')](_0x398b40[_0x6d97('0x33')],qs['fields'](_0x18b153[_0x6d97('0x34')]['fields']));_0x4947a9[_0x6d97('0x37')]=_0x4947a9['attributes'][_0x6d97('0x4b')]?_0x4947a9['attributes']:_0x398b40[_0x6d97('0x33')];if(_0x18b153[_0x6d97('0x34')][_0x6d97('0x46')]){_0x4947a9[_0x6d97('0x47')]=[{'all':!![]}];}_0x4947a9=_[_0x6d97('0x42')]({},_0x4947a9,_0x18b153[_0x6d97('0x44')]);return db['Setting'][_0x6d97('0x4c')](_0x4947a9)[_0x6d97('0x19')](handleEntityNotFound(_0x5614c2,null))[_0x6d97('0x19')](respondWithResult(_0x5614c2,null))[_0x6d97('0x23')](handleError(_0x5614c2,null));};exports[_0x6d97('0x4d')]=function(_0x5f4300,_0x2633e9){if(_0x5f4300[_0x6d97('0x4e')]['id']){delete _0x5f4300[_0x6d97('0x4e')]['id'];}return db[_0x6d97('0x2f')]['find']({'where':{'id':_0x5f4300[_0x6d97('0x4a')]['id']}})[_0x6d97('0x19')](handleEntityNotFound(_0x2633e9,null))[_0x6d97('0x19')](saveUpdates(_0x5f4300[_0x6d97('0x4e')],null))['then'](respondWithResult(_0x2633e9,null))[_0x6d97('0x23')](handleError(_0x2633e9,null));};exports[_0x6d97('0x4f')]=function(_0x33507c,_0x192d66,_0x2f3bec){if(_0x33507c[_0x6d97('0x50')]&&_0x33507c[_0x6d97('0x50')]['filename']){_0x33507c[_0x6d97('0x4e')][_0x6d97('0x51')]=_0x33507c['file'][_0x6d97('0x52')];}return db[_0x6d97('0x2f')]['find']({'where':{'id':_0x33507c[_0x6d97('0x4a')]['id']}})[_0x6d97('0x19')](handleEntityNotFound(_0x192d66,null))[_0x6d97('0x19')](saveUpdates(_0x33507c[_0x6d97('0x4e')],null))[_0x6d97('0x19')](respondWithResult(_0x192d66,null))[_0x6d97('0x23')](handleError(_0x192d66,null));};exports[_0x6d97('0x53')]=function(_0x12cc4f,_0x1b0121,_0x333ae0){if(_0x12cc4f[_0x6d97('0x50')]&&_0x12cc4f[_0x6d97('0x50')][_0x6d97('0x52')]){_0x12cc4f['body'][_0x6d97('0x54')]=_0x12cc4f['file'][_0x6d97('0x52')];}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x12cc4f[_0x6d97('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b0121,null))[_0x6d97('0x19')](saveUpdates(_0x12cc4f['body'],null))['then'](respondWithResult(_0x1b0121,null))[_0x6d97('0x23')](handleError(_0x1b0121,null));};var utilLicense=require('../../config/license/util');exports[_0x6d97('0x55')]=function(_0x106420,_0x563305,_0x27bfdd){var _0x1b55b1=_0x6d97('0x56');var _0x454ed1={'custom':![]};return utilLicense[_0x6d97('0x57')]()['then'](function(_0x4f8a9a){if(_0x4f8a9a){_0x454ed1=_0x4f8a9a;}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x106420[_0x6d97('0x4a')]['id']},'attributes':[_0x6d97('0x51'),_0x6d97('0x54'),_0x6d97('0x58'),'favicon',_0x6d97('0x59'),'defaultLoginLogo','defaultPreferred',_0x6d97('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x563305,null))['then'](function(_0x7a07bc){if(_0x7a07bc){var _0x360051=_0x7a07bc[_0x6d97('0x51')]&&fs[_0x6d97('0x5b')](path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x1b55b1,_[_0x6d97('0x5e')](_0x7a07bc[_0x6d97('0x51')])))?path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x1b55b1,_[_0x6d97('0x5e')](_0x7a07bc[_0x6d97('0x51')])):path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x1b55b1,_[_0x6d97('0x5e')]('default_logo.svg'));var _0xab0d36=_0x6d97('0x5f')+_[_0x6d97('0x60')](_0x6d97('0x51'));if(_0x7a07bc[_0xab0d36]||!_0x454ed1[_0x6d97('0x61')]){_0x360051=path['join'](config[_0x6d97('0x5d')],_0x1b55b1,_[_0x6d97('0x5e')](_0x6d97('0x62')));}if(!fs[_0x6d97('0x5b')](_0x360051)){throw new db[(_0x6d97('0x63'))]['ValidationError'](_[_0x6d97('0x60')]('logo')+'\x20not\x20found');}return _0x563305[_0x6d97('0x64')](_0x360051);}})[_0x6d97('0x23')](handleError(_0x563305,null));};var utilLicense=require(_0x6d97('0x15'));exports['getLogoLogin']=function(_0x494ffd,_0x2acc39,_0x134b03){var _0x1f06c2='server/files/images/logos';var _0x5d873e={'custom':![]};return utilLicense['getLicense']()[_0x6d97('0x19')](function(_0x285cfc){if(_0x285cfc){_0x5d873e=_0x285cfc;}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x494ffd[_0x6d97('0x4a')]['id']},'attributes':['logo','loginLogo',_0x6d97('0x58'),'favicon',_0x6d97('0x59'),_0x6d97('0x65'),_0x6d97('0x66'),_0x6d97('0x5a')],'raw':!![]});})[_0x6d97('0x19')](handleEntityNotFound(_0x2acc39,null))['then'](function(_0x2b9e13){if(_0x2b9e13){var _0x52dc84=_0x2b9e13['loginLogo']&&fs[_0x6d97('0x5b')](path['join'](config['root'],_0x1f06c2,_[_0x6d97('0x5e')](_0x2b9e13[_0x6d97('0x54')])))?path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x1f06c2,_[_0x6d97('0x5e')](_0x2b9e13[_0x6d97('0x54')])):path['join'](config[_0x6d97('0x5d')],_0x1f06c2,_[_0x6d97('0x5e')](_0x6d97('0x67')));var _0x21f666=_0x6d97('0x5f')+_[_0x6d97('0x60')](_0x6d97('0x54'));if(_0x2b9e13[_0x21f666]||!_0x5d873e[_0x6d97('0x61')]){_0x52dc84=path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x1f06c2,_[_0x6d97('0x5e')](_0x6d97('0x67')));}if(!fs[_0x6d97('0x5b')](_0x52dc84)){throw new db['Sequelize'][(_0x6d97('0x68'))](_[_0x6d97('0x60')](_0x6d97('0x54'))+'\x20not\x20found');}return _0x2acc39[_0x6d97('0x64')](_0x52dc84);}})['catch'](handleError(_0x2acc39,null));};exports[_0x6d97('0x69')]=function(_0x33ef97,_0x442646){return db['Setting'][_0x6d97('0x4c')]({'where':{'id':_0x33ef97[_0x6d97('0x4a')]['id']},'attributes':[_0x6d97('0x6a')]})['then'](respondWithResult(_0x442646,null))['catch'](handleError(_0x442646,null));};exports['addPreferred']=function(_0x3ed72a,_0x5ab1c4,_0x1cedbb){if(_0x3ed72a[_0x6d97('0x50')]&&_0x3ed72a['file'][_0x6d97('0x52')]){_0x3ed72a[_0x6d97('0x4e')][_0x6d97('0x58')]=_0x3ed72a['file']['filename'];}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x3ed72a[_0x6d97('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5ab1c4,null))[_0x6d97('0x19')](saveUpdates(_0x3ed72a[_0x6d97('0x4e')],null))[_0x6d97('0x19')](respondWithResult(_0x5ab1c4,null))[_0x6d97('0x23')](handleError(_0x5ab1c4,null));};var utilLicense=require(_0x6d97('0x15'));exports[_0x6d97('0x6b')]=function(_0x385be2,_0x15f6c3,_0x4b1314){var _0x5b2264=_0x6d97('0x56');var _0x402707={'custom':![]};return utilLicense['getLicense']()[_0x6d97('0x19')](function(_0x24865b){if(_0x24865b){_0x402707=_0x24865b;}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x385be2[_0x6d97('0x4a')]['id']},'attributes':['logo',_0x6d97('0x54'),_0x6d97('0x58'),_0x6d97('0x6c'),_0x6d97('0x59'),_0x6d97('0x65'),'defaultPreferred',_0x6d97('0x5a')],'raw':!![]});})[_0x6d97('0x19')](handleEntityNotFound(_0x15f6c3,null))[_0x6d97('0x19')](function(_0x51dad5){if(_0x51dad5){var _0x384320=_0x51dad5['preferred']&&fs[_0x6d97('0x5b')](path[_0x6d97('0x5c')](config['root'],_0x5b2264,_['toLower'](_0x51dad5[_0x6d97('0x58')])))?path['join'](config[_0x6d97('0x5d')],_0x5b2264,_[_0x6d97('0x5e')](_0x51dad5[_0x6d97('0x58')])):path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x5b2264,_[_0x6d97('0x5e')](_0x6d97('0x6d')));var _0x4e8c76=_0x6d97('0x5f')+_[_0x6d97('0x60')](_0x6d97('0x58'));if(_0x51dad5[_0x4e8c76]||!_0x402707[_0x6d97('0x61')]||!_0x402707[_0x6d97('0x58')]){_0x384320=path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x5b2264,_[_0x6d97('0x5e')](_0x6d97('0x6d')));}if(!fs[_0x6d97('0x5b')](_0x384320)){throw new db[(_0x6d97('0x63'))][(_0x6d97('0x68'))](_[_0x6d97('0x60')](_0x6d97('0x58'))+_0x6d97('0x6e'));}return _0x15f6c3[_0x6d97('0x64')](_0x384320);}})[_0x6d97('0x23')](handleError(_0x15f6c3,null));};exports[_0x6d97('0x6f')]=function(_0x386e3f,_0x568324,_0x2a2288){if(_0x386e3f[_0x6d97('0x50')]&&_0x386e3f[_0x6d97('0x50')][_0x6d97('0x52')]){_0x386e3f[_0x6d97('0x4e')][_0x6d97('0x6c')]=_0x386e3f[_0x6d97('0x50')][_0x6d97('0x52')];}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x386e3f[_0x6d97('0x4a')]['id']}})['then'](handleEntityNotFound(_0x568324,null))['then'](saveUpdates(_0x386e3f['body'],null))[_0x6d97('0x19')](respondWithResult(_0x568324,null))[_0x6d97('0x23')](handleError(_0x568324,null));};var utilLicense=require(_0x6d97('0x15'));exports[_0x6d97('0x70')]=function(_0x3d9958,_0x25a759,_0x2026d4){var _0x33e17a=_0x6d97('0x56');var _0x33ffac={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x255f6d){if(_0x255f6d){_0x33ffac=_0x255f6d;}return db[_0x6d97('0x2f')][_0x6d97('0x4c')]({'where':{'id':_0x3d9958['params']['id']},'attributes':[_0x6d97('0x51'),_0x6d97('0x54'),_0x6d97('0x58'),_0x6d97('0x6c'),'defaultLogo',_0x6d97('0x65'),_0x6d97('0x66'),_0x6d97('0x5a')],'raw':!![]});})[_0x6d97('0x19')](handleEntityNotFound(_0x25a759,null))[_0x6d97('0x19')](function(_0x5cd2fe){if(_0x5cd2fe){var _0x2667bb=_0x5cd2fe[_0x6d97('0x6c')]&&fs[_0x6d97('0x5b')](path['join'](config['root'],_0x33e17a,_[_0x6d97('0x5e')](_0x5cd2fe[_0x6d97('0x6c')])))?path[_0x6d97('0x5c')](config['root'],_0x33e17a,_['toLower'](_0x5cd2fe['favicon'])):path['join'](config[_0x6d97('0x5d')],_0x33e17a,_['toLower'](_0x6d97('0x71')));var _0x5da8b7='default'+_[_0x6d97('0x60')](_0x6d97('0x6c'));if(_0x5cd2fe[_0x5da8b7]||!_0x33ffac[_0x6d97('0x61')]){_0x2667bb=path[_0x6d97('0x5c')](config[_0x6d97('0x5d')],_0x33e17a,_[_0x6d97('0x5e')](_0x6d97('0x71')));}if(!fs[_0x6d97('0x5b')](_0x2667bb)){throw new db[(_0x6d97('0x63'))]['ValidationError'](_[_0x6d97('0x60')](_0x6d97('0x6c'))+_0x6d97('0x6e'));}return _0x25a759[_0x6d97('0x64')](_0x2667bb);}})[_0x6d97('0x23')](handleError(_0x25a759,null));};exports['getDate']=function(_0x10574b,_0xc69a7c){var _0x233be3={'offset':moment()['utcOffset']()};_0x233be3['now']=moment()[_0x6d97('0x72')](_0x233be3['offset'])[_0x6d97('0x73')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xc69a7c['status'](0xc8)[_0x6d97('0x2c')](_0x233be3);}; \ No newline at end of file +var _0xaa0b=['map','Setting','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','stack','name','send','index'];(function(_0xaaf2e2,_0x19d28a){var _0x28bc36=function(_0x53bdb5){while(--_0x53bdb5){_0xaaf2e2['push'](_0xaaf2e2['shift']());}};_0x28bc36(++_0x19d28a);}(_0xaa0b,0x1b1));var _0xbaa0=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xaa0b[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xbaa0('0x0'));var rimraf=require(_0xbaa0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbaa0('0x2'));var rp=require(_0xbaa0('0x3'));var moment=require(_0xbaa0('0x4'));var BPromise=require(_0xbaa0('0x5'));var Mustache=require('mustache');var util=require(_0xbaa0('0x6'));var path=require(_0xbaa0('0x7'));var sox=require(_0xbaa0('0x8'));var csv=require(_0xbaa0('0x9'));var ejs=require(_0xbaa0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbaa0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbaa0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbaa0('0x9'));var querystring=require('querystring');var Papa=require(_0xbaa0('0xd'));var Redis=require(_0xbaa0('0xe'));var authService=require(_0xbaa0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaa0('0x10'))(_0xbaa0('0x11'));var utils=require(_0xbaa0('0x12'));var config=require(_0xbaa0('0x13'));var licenseUtil=require(_0xbaa0('0x14'));var db=require(_0xbaa0('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xbaa0('0x16')][_0xbaa0('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x59d008,_0x520433,_0x5bb732,_0x3d5d2f){return new BPromise(function(_0x757dd,_0x415bad){var _0x1514a8=_0x3d5d2f||client;return _0x1514a8['request'](_0x59d008,_0x5bb732)[_0xbaa0('0x18')](function(_0x27ac47){logger[_0xbaa0('0x19')](_0xbaa0('0x1a'),_0x520433,_0xbaa0('0x1b'));logger[_0xbaa0('0x1c')](_0xbaa0('0x1d'),_0x520433,_0xbaa0('0x1b'),JSON['stringify'](_0x27ac47));if(_0x27ac47[_0xbaa0('0x1e')]){if(_0x27ac47[_0xbaa0('0x1e')]['code']===0x1f4){logger[_0xbaa0('0x1e')](_0xbaa0('0x1a'),_0x520433,_0x27ac47[_0xbaa0('0x1e')][_0xbaa0('0x1f')]);return _0x415bad(_0x27ac47[_0xbaa0('0x1e')][_0xbaa0('0x1f')]);}logger[_0xbaa0('0x1e')]('Setting,\x20%s,\x20%s',_0x520433,_0x27ac47[_0xbaa0('0x1e')]['message']);return _0x757dd(_0x27ac47['error']['message']);}else{logger[_0xbaa0('0x19')](_0xbaa0('0x1a'),_0x520433,_0xbaa0('0x1b'));_0x757dd(_0x27ac47['result'][_0xbaa0('0x1f')]);}})[_0xbaa0('0x20')](function(_0x1abc26){logger[_0xbaa0('0x1e')](_0xbaa0('0x1a'),_0x520433,_0x1abc26);_0x415bad(_0x1abc26);});});}function respondWithStatusCode(_0x18bd1d,_0x4c5273){_0x4c5273=_0x4c5273||0xcc;return function(_0x4660cc){if(_0x4660cc){return _0x18bd1d[_0xbaa0('0x21')](_0x4c5273);}return _0x18bd1d[_0xbaa0('0x22')](_0x4c5273)[_0xbaa0('0x23')]();};}function respondWithResult(_0x53af0e,_0x32a212){_0x32a212=_0x32a212||0xc8;return function(_0x2d0296){if(_0x2d0296){return _0x53af0e['status'](_0x32a212)[_0xbaa0('0x24')](_0x2d0296);}};}function respondWithFilteredResult(_0x90686c,_0x3945a5){return function(_0x38a73f){if(_0x38a73f){var _0x5511b2=typeof _0x3945a5[_0xbaa0('0x25')]===_0xbaa0('0x26')&&typeof _0x3945a5[_0xbaa0('0x27')]===_0xbaa0('0x26');var _0x3fb767=_0x38a73f[_0xbaa0('0x28')];var _0x34629f=_0x5511b2?0x0:_0x3945a5['offset'];var _0x1254bc=_0x5511b2?_0x38a73f[_0xbaa0('0x28')]:_0x3945a5[_0xbaa0('0x25')]+_0x3945a5[_0xbaa0('0x27')];var _0x16a2a7;if(_0x1254bc>=_0x3fb767){_0x1254bc=_0x3fb767;_0x16a2a7=0xc8;}else{_0x16a2a7=0xce;}_0x90686c[_0xbaa0('0x22')](_0x16a2a7);return _0x90686c[_0xbaa0('0x29')](_0xbaa0('0x2a'),_0x34629f+'-'+_0x1254bc+'/'+_0x3fb767)[_0xbaa0('0x24')](_0x38a73f);}return null;};}function patchUpdates(_0x11acde){return function(_0x28ecf0){try{jsonpatch[_0xbaa0('0x2b')](_0x28ecf0,_0x11acde,!![]);}catch(_0x24afc9){return BPromise[_0xbaa0('0x2c')](_0x24afc9);}return _0x28ecf0[_0xbaa0('0x2d')]();};}function saveUpdates(_0x1dc128,_0x4034db){return function(_0x18a224){if(_0x18a224){return _0x18a224[_0xbaa0('0x2e')](_0x1dc128)[_0xbaa0('0x18')](function(_0x1d3e18){return _0x1d3e18;});}return null;};}function removeEntity(_0x2f1eb3,_0x3271cc){return function(_0x2b9cc6){if(_0x2b9cc6){return _0x2b9cc6['destroy']()[_0xbaa0('0x18')](function(){_0x2f1eb3[_0xbaa0('0x22')](0xcc)[_0xbaa0('0x23')]();});}};}function handleEntityNotFound(_0x22d7a8,_0x13524f){return function(_0xbc1315){if(!_0xbc1315){_0x22d7a8['sendStatus'](0x194);}return _0xbc1315;};}function handleError(_0x51f0c6,_0x59ae7d){_0x59ae7d=_0x59ae7d||0x1f4;return function(_0x4de842){logger[_0xbaa0('0x1e')](_0x4de842[_0xbaa0('0x2f')]);if(_0x4de842[_0xbaa0('0x30')]){delete _0x4de842[_0xbaa0('0x30')];}_0x51f0c6[_0xbaa0('0x22')](_0x59ae7d)[_0xbaa0('0x31')](_0x4de842);};}exports[_0xbaa0('0x32')]=function(_0x2205d7,_0x4312cc){var _0xeb86da={},_0x12dc15={},_0x61fb23={'count':0x0,'rows':[]};var _0x4b2892=_[_0xbaa0('0x33')](db[_0xbaa0('0x34')][_0xbaa0('0x35')],function(_0x59a6dd){return{'name':_0x59a6dd[_0xbaa0('0x36')],'type':_0x59a6dd[_0xbaa0('0x37')]['key']};});_0x12dc15['model']=_[_0xbaa0('0x33')](_0x4b2892,'name');_0x12dc15[_0xbaa0('0x38')]=_[_0xbaa0('0x39')](_0x2205d7['query']);_0x12dc15[_0xbaa0('0x3a')]=_[_0xbaa0('0x3b')](_0x12dc15[_0xbaa0('0x3c')],_0x12dc15[_0xbaa0('0x38')]);_0xeb86da[_0xbaa0('0x3d')]=_[_0xbaa0('0x3b')](_0x12dc15[_0xbaa0('0x3c')],qs[_0xbaa0('0x3e')](_0x2205d7[_0xbaa0('0x38')][_0xbaa0('0x3e')]));_0xeb86da[_0xbaa0('0x3d')]=_0xeb86da[_0xbaa0('0x3d')][_0xbaa0('0x3f')]?_0xeb86da[_0xbaa0('0x3d')]:_0x12dc15[_0xbaa0('0x3c')];if(!_0x2205d7[_0xbaa0('0x38')][_0xbaa0('0x40')](_0xbaa0('0x41'))){_0xeb86da[_0xbaa0('0x27')]=qs[_0xbaa0('0x27')](_0x2205d7[_0xbaa0('0x38')][_0xbaa0('0x27')]);_0xeb86da[_0xbaa0('0x25')]=qs[_0xbaa0('0x25')](_0x2205d7['query']['offset']);}_0xeb86da[_0xbaa0('0x42')]=qs[_0xbaa0('0x43')](_0x2205d7[_0xbaa0('0x38')]['sort']);_0xeb86da[_0xbaa0('0x44')]=qs[_0xbaa0('0x3a')](_['pick'](_0x2205d7[_0xbaa0('0x38')],_0x12dc15['filters']),_0x4b2892);if(_0x2205d7[_0xbaa0('0x38')][_0xbaa0('0x45')]){_0xeb86da['where']=_['merge'](_0xeb86da[_0xbaa0('0x44')],{'$or':_[_0xbaa0('0x33')](_0x4b2892,function(_0x141c9f){if(_0x141c9f[_0xbaa0('0x37')]!==_0xbaa0('0x46')){var _0x5e5668={};_0x5e5668[_0x141c9f[_0xbaa0('0x30')]]={'$like':'%'+_0x2205d7['query'][_0xbaa0('0x45')]+'%'};return _0x5e5668;}})});}_0xeb86da=_[_0xbaa0('0x47')]({},_0xeb86da,_0x2205d7[_0xbaa0('0x48')]);var _0x12d9b9={'where':_0xeb86da[_0xbaa0('0x44')]};return db[_0xbaa0('0x34')][_0xbaa0('0x28')](_0x12d9b9)[_0xbaa0('0x18')](function(_0x50a950){_0x61fb23[_0xbaa0('0x28')]=_0x50a950;if(_0x2205d7[_0xbaa0('0x38')][_0xbaa0('0x49')]){_0xeb86da[_0xbaa0('0x4a')]=[{'all':!![]}];}return db[_0xbaa0('0x34')][_0xbaa0('0x4b')](_0xeb86da);})[_0xbaa0('0x18')](function(_0x2365b6){_0x61fb23[_0xbaa0('0x4c')]=_0x2365b6;return _0x61fb23;})[_0xbaa0('0x18')](respondWithFilteredResult(_0x4312cc,_0xeb86da))[_0xbaa0('0x20')](handleError(_0x4312cc,null));};exports[_0xbaa0('0x4d')]=function(_0x272d2e,_0x1ff354){var _0x24ab82={'raw':![],'where':{'id':_0x272d2e[_0xbaa0('0x4e')]['id']}},_0x153e7a={};_0x153e7a[_0xbaa0('0x3c')]=_[_0xbaa0('0x39')](db[_0xbaa0('0x34')][_0xbaa0('0x35')]);_0x153e7a[_0xbaa0('0x38')]=_['keys'](_0x272d2e['query']);_0x153e7a[_0xbaa0('0x3a')]=_[_0xbaa0('0x3b')](_0x153e7a['model'],_0x153e7a[_0xbaa0('0x38')]);_0x24ab82[_0xbaa0('0x3d')]=_[_0xbaa0('0x3b')](_0x153e7a[_0xbaa0('0x3c')],qs[_0xbaa0('0x3e')](_0x272d2e[_0xbaa0('0x38')][_0xbaa0('0x3e')]));_0x24ab82['attributes']=_0x24ab82['attributes'][_0xbaa0('0x3f')]?_0x24ab82[_0xbaa0('0x3d')]:_0x153e7a[_0xbaa0('0x3c')];if(_0x272d2e[_0xbaa0('0x38')][_0xbaa0('0x49')]){_0x24ab82[_0xbaa0('0x4a')]=[{'all':!![]}];}_0x24ab82=_[_0xbaa0('0x47')]({},_0x24ab82,_0x272d2e[_0xbaa0('0x48')]);return db['Setting'][_0xbaa0('0x4f')](_0x24ab82)['then'](handleEntityNotFound(_0x1ff354,null))[_0xbaa0('0x18')](respondWithResult(_0x1ff354,null))[_0xbaa0('0x20')](handleError(_0x1ff354,null));};exports['update']=function(_0x4ed175,_0xd97ae7){if(_0x4ed175[_0xbaa0('0x50')]['id']){delete _0x4ed175[_0xbaa0('0x50')]['id'];}return db['Setting'][_0xbaa0('0x4f')]({'where':{'id':_0x4ed175[_0xbaa0('0x4e')]['id']}})[_0xbaa0('0x18')](handleEntityNotFound(_0xd97ae7,null))[_0xbaa0('0x18')](saveUpdates(_0x4ed175[_0xbaa0('0x50')],null))[_0xbaa0('0x18')](respondWithResult(_0xd97ae7,null))[_0xbaa0('0x20')](handleError(_0xd97ae7,null));};exports[_0xbaa0('0x51')]=function(_0x48271d,_0x5d309d,_0x12dce2){if(_0x48271d[_0xbaa0('0x52')]&&_0x48271d[_0xbaa0('0x52')][_0xbaa0('0x53')]){_0x48271d['body'][_0xbaa0('0x54')]=_0x48271d['file'][_0xbaa0('0x53')];}return db[_0xbaa0('0x34')][_0xbaa0('0x4f')]({'where':{'id':_0x48271d['params']['id']}})[_0xbaa0('0x18')](handleEntityNotFound(_0x5d309d,null))[_0xbaa0('0x18')](saveUpdates(_0x48271d[_0xbaa0('0x50')],null))['then'](respondWithResult(_0x5d309d,null))[_0xbaa0('0x20')](handleError(_0x5d309d,null));};exports[_0xbaa0('0x55')]=function(_0x273210,_0x1c6170,_0x22b17c){if(_0x273210[_0xbaa0('0x52')]&&_0x273210['file'][_0xbaa0('0x53')]){_0x273210['body'][_0xbaa0('0x56')]=_0x273210[_0xbaa0('0x52')]['filename'];}return db['Setting'][_0xbaa0('0x4f')]({'where':{'id':_0x273210[_0xbaa0('0x4e')]['id']}})[_0xbaa0('0x18')](handleEntityNotFound(_0x1c6170,null))[_0xbaa0('0x18')](saveUpdates(_0x273210[_0xbaa0('0x50')],null))[_0xbaa0('0x18')](respondWithResult(_0x1c6170,null))['catch'](handleError(_0x1c6170,null));};var utilLicense=require(_0xbaa0('0x14'));exports['getLogo']=function(_0x6cb3d,_0x3a7dfc,_0x432c30){var _0x2b8ca2=_0xbaa0('0x57');var _0x2dc7c9={'custom':![]};return utilLicense[_0xbaa0('0x58')]()['then'](function(_0x67e7f1){if(_0x67e7f1){_0x2dc7c9=_0x67e7f1;}return db[_0xbaa0('0x34')][_0xbaa0('0x4f')]({'where':{'id':_0x6cb3d[_0xbaa0('0x4e')]['id']},'attributes':[_0xbaa0('0x54'),_0xbaa0('0x56'),_0xbaa0('0x59'),_0xbaa0('0x5a'),'defaultLogo',_0xbaa0('0x5b'),_0xbaa0('0x5c'),_0xbaa0('0x5d')],'raw':!![]});})[_0xbaa0('0x18')](handleEntityNotFound(_0x3a7dfc,null))[_0xbaa0('0x18')](function(_0x364a93){if(_0x364a93){var _0x20de74=_0x364a93[_0xbaa0('0x54')]&&fs[_0xbaa0('0x5e')](path['join'](config[_0xbaa0('0x5f')],_0x2b8ca2,_[_0xbaa0('0x60')](_0x364a93['logo'])))?path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x2b8ca2,_[_0xbaa0('0x60')](_0x364a93[_0xbaa0('0x54')])):path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x2b8ca2,_['toLower']('default_logo.svg'));var _0x13e325='default'+_[_0xbaa0('0x62')](_0xbaa0('0x54'));if(_0x364a93[_0x13e325]||!_0x2dc7c9[_0xbaa0('0x63')]){_0x20de74=path['join'](config['root'],_0x2b8ca2,_[_0xbaa0('0x60')](_0xbaa0('0x64')));}if(!fs[_0xbaa0('0x5e')](_0x20de74)){throw new db['Sequelize'][(_0xbaa0('0x65'))](_[_0xbaa0('0x62')](_0xbaa0('0x54'))+_0xbaa0('0x66'));}return _0x3a7dfc[_0xbaa0('0x67')](_0x20de74);}})[_0xbaa0('0x20')](handleError(_0x3a7dfc,null));};var utilLicense=require(_0xbaa0('0x14'));exports[_0xbaa0('0x68')]=function(_0x1b48c6,_0x36e93a,_0x178a1c){var _0x52e47d=_0xbaa0('0x57');var _0x576437={'custom':![]};return utilLicense[_0xbaa0('0x58')]()[_0xbaa0('0x18')](function(_0x2ba0e3){if(_0x2ba0e3){_0x576437=_0x2ba0e3;}return db[_0xbaa0('0x34')]['find']({'where':{'id':_0x1b48c6[_0xbaa0('0x4e')]['id']},'attributes':[_0xbaa0('0x54'),_0xbaa0('0x56'),_0xbaa0('0x59'),_0xbaa0('0x5a'),_0xbaa0('0x69'),_0xbaa0('0x5b'),_0xbaa0('0x5c'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x36e93a,null))[_0xbaa0('0x18')](function(_0x53b936){if(_0x53b936){var _0x2805f0=_0x53b936[_0xbaa0('0x56')]&&fs[_0xbaa0('0x5e')](path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x52e47d,_[_0xbaa0('0x60')](_0x53b936[_0xbaa0('0x56')])))?path['join'](config[_0xbaa0('0x5f')],_0x52e47d,_[_0xbaa0('0x60')](_0x53b936[_0xbaa0('0x56')])):path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x52e47d,_[_0xbaa0('0x60')](_0xbaa0('0x6a')));var _0xa4e031='default'+_[_0xbaa0('0x62')](_0xbaa0('0x56'));if(_0x53b936[_0xa4e031]||!_0x576437['custom']){_0x2805f0=path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x52e47d,_[_0xbaa0('0x60')](_0xbaa0('0x6a')));}if(!fs[_0xbaa0('0x5e')](_0x2805f0)){throw new db[(_0xbaa0('0x6b'))][(_0xbaa0('0x65'))](_[_0xbaa0('0x62')](_0xbaa0('0x56'))+_0xbaa0('0x66'));}return _0x36e93a[_0xbaa0('0x67')](_0x2805f0);}})['catch'](handleError(_0x36e93a,null));};exports[_0xbaa0('0x6c')]=function(_0x596264,_0x4f3630){return db[_0xbaa0('0x34')]['find']({'where':{'id':_0x596264[_0xbaa0('0x4e')]['id']},'attributes':[_0xbaa0('0x6d')]})[_0xbaa0('0x18')](respondWithResult(_0x4f3630,null))[_0xbaa0('0x20')](handleError(_0x4f3630,null));};exports[_0xbaa0('0x6e')]=function(_0x531468,_0x18edac,_0x4d83b8){if(_0x531468[_0xbaa0('0x52')]&&_0x531468[_0xbaa0('0x52')]['filename']){_0x531468[_0xbaa0('0x50')]['preferred']=_0x531468[_0xbaa0('0x52')][_0xbaa0('0x53')];}return db['Setting'][_0xbaa0('0x4f')]({'where':{'id':_0x531468[_0xbaa0('0x4e')]['id']}})[_0xbaa0('0x18')](handleEntityNotFound(_0x18edac,null))[_0xbaa0('0x18')](saveUpdates(_0x531468['body'],null))[_0xbaa0('0x18')](respondWithResult(_0x18edac,null))['catch'](handleError(_0x18edac,null));};var utilLicense=require(_0xbaa0('0x14'));exports[_0xbaa0('0x6f')]=function(_0x65d26a,_0x3b9cd4,_0x403ff8){var _0x34605c='server/files/images/logos';var _0x7474db={'custom':![]};return utilLicense['getLicense']()[_0xbaa0('0x18')](function(_0x138c6b){if(_0x138c6b){_0x7474db=_0x138c6b;}return db[_0xbaa0('0x34')]['find']({'where':{'id':_0x65d26a[_0xbaa0('0x4e')]['id']},'attributes':[_0xbaa0('0x54'),'loginLogo',_0xbaa0('0x59'),_0xbaa0('0x5a'),_0xbaa0('0x69'),_0xbaa0('0x5b'),_0xbaa0('0x5c'),_0xbaa0('0x5d')],'raw':!![]});})[_0xbaa0('0x18')](handleEntityNotFound(_0x3b9cd4,null))[_0xbaa0('0x18')](function(_0x1f1f57){if(_0x1f1f57){var _0x52ca77=_0x1f1f57['preferred']&&fs[_0xbaa0('0x5e')](path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x34605c,_[_0xbaa0('0x60')](_0x1f1f57['preferred'])))?path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x34605c,_[_0xbaa0('0x60')](_0x1f1f57[_0xbaa0('0x59')])):path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0x34605c,_['toLower'](_0xbaa0('0x70')));var _0xbaaa24='default'+_['upperFirst']('preferred');if(_0x1f1f57[_0xbaaa24]||!_0x7474db[_0xbaa0('0x63')]||!_0x7474db[_0xbaa0('0x59')]){_0x52ca77=path['join'](config[_0xbaa0('0x5f')],_0x34605c,_[_0xbaa0('0x60')](_0xbaa0('0x70')));}if(!fs[_0xbaa0('0x5e')](_0x52ca77)){throw new db[(_0xbaa0('0x6b'))]['ValidationError'](_[_0xbaa0('0x62')](_0xbaa0('0x59'))+'\x20not\x20found');}return _0x3b9cd4[_0xbaa0('0x67')](_0x52ca77);}})['catch'](handleError(_0x3b9cd4,null));};exports[_0xbaa0('0x71')]=function(_0x48275a,_0x42dd0f,_0x5b4cd8){if(_0x48275a[_0xbaa0('0x52')]&&_0x48275a[_0xbaa0('0x52')]['filename']){_0x48275a[_0xbaa0('0x50')][_0xbaa0('0x5a')]=_0x48275a['file']['filename'];}return db[_0xbaa0('0x34')][_0xbaa0('0x4f')]({'where':{'id':_0x48275a[_0xbaa0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x42dd0f,null))['then'](saveUpdates(_0x48275a[_0xbaa0('0x50')],null))[_0xbaa0('0x18')](respondWithResult(_0x42dd0f,null))[_0xbaa0('0x20')](handleError(_0x42dd0f,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x173568,_0x4521ba,_0xcb4f55){var _0xf6b105=_0xbaa0('0x57');var _0x3fdef6={'custom':![]};return utilLicense[_0xbaa0('0x58')]()[_0xbaa0('0x18')](function(_0x338e5d){if(_0x338e5d){_0x3fdef6=_0x338e5d;}return db[_0xbaa0('0x34')][_0xbaa0('0x4f')]({'where':{'id':_0x173568[_0xbaa0('0x4e')]['id']},'attributes':[_0xbaa0('0x54'),_0xbaa0('0x56'),_0xbaa0('0x59'),'favicon',_0xbaa0('0x69'),_0xbaa0('0x5b'),_0xbaa0('0x5c'),_0xbaa0('0x5d')],'raw':!![]});})[_0xbaa0('0x18')](handleEntityNotFound(_0x4521ba,null))['then'](function(_0x463149){if(_0x463149){var _0x19ade9=_0x463149[_0xbaa0('0x5a')]&&fs[_0xbaa0('0x5e')](path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0xf6b105,_[_0xbaa0('0x60')](_0x463149[_0xbaa0('0x5a')])))?path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0xf6b105,_['toLower'](_0x463149['favicon'])):path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0xf6b105,_['toLower']('default_favicon.ico'));var _0x263980=_0xbaa0('0x72')+_[_0xbaa0('0x62')](_0xbaa0('0x5a'));if(_0x463149[_0x263980]||!_0x3fdef6['custom']){_0x19ade9=path[_0xbaa0('0x61')](config[_0xbaa0('0x5f')],_0xf6b105,_[_0xbaa0('0x60')](_0xbaa0('0x73')));}if(!fs[_0xbaa0('0x5e')](_0x19ade9)){throw new db[(_0xbaa0('0x6b'))][(_0xbaa0('0x65'))](_[_0xbaa0('0x62')](_0xbaa0('0x5a'))+_0xbaa0('0x66'));}return _0x4521ba[_0xbaa0('0x67')](_0x19ade9);}})[_0xbaa0('0x20')](handleError(_0x4521ba,null));};exports[_0xbaa0('0x74')]=function(_0x3a9355,_0xd37b44){var _0x309236={'offset':moment()[_0xbaa0('0x75')]()};_0x309236[_0xbaa0('0x76')]=moment()[_0xbaa0('0x75')](_0x309236[_0xbaa0('0x25')])[_0xbaa0('0x77')](_0xbaa0('0x78'));return _0xd37b44['status'](0xc8)[_0xbaa0('0x31')](_0x309236);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 93492d6..8e3c4fb 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 _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x55ca,0x126));var _0xa55c=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x55ca[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xfbc3dc,_0x3a7830){var _0x48c818=function(_0x5e3a9b){while(--_0x5e3a9b){_0xfbc3dc['push'](_0xfbc3dc['shift']());}};_0x48c818(++_0x3a7830);}(_0x008c,0x188));var _0xc008=function(_0x383c94,_0x2c7402){_0x383c94=_0x383c94-0x0;var _0x149b61=_0x008c[_0x383c94];return _0x149b61;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 6f45e8e..b5ff60c 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 _0x9784=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','Setting','find','options','attributes','include','map','model','ShowSetting','debug','catch'];(function(_0x2ae3da,_0x142cb9){var _0x500d96=function(_0x252cbf){while(--_0x252cbf){_0x2ae3da['push'](_0x2ae3da['shift']());}};_0x500d96(++_0x142cb9);}(_0x9784,0xe7));var _0x4978=function(_0x22bdcb,_0x47e77e){_0x22bdcb=_0x22bdcb-0x0;var _0x1de11c=_0x9784[_0x22bdcb];return _0x1de11c;};'use strict';var _=require(_0x4978('0x0'));var util=require(_0x4978('0x1'));var moment=require('moment');var BPromise=require(_0x4978('0x2'));var rs=require(_0x4978('0x3'));var fs=require('fs');var Redis=require(_0x4978('0x4'));var db=require(_0x4978('0x5'))['db'];var utils=require(_0x4978('0x6'));var logger=require(_0x4978('0x7'))(_0x4978('0x8'));var config=require(_0x4978('0x9'));var jayson=require(_0x4978('0xa'));var client=jayson[_0x4978('0xb')][_0x4978('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9a298e,_0x48446d,_0x56604b){return new BPromise(function(_0x485cf0,_0x265ec5){return client[_0x4978('0xd')](_0x9a298e,_0x56604b)[_0x4978('0xe')](function(_0x29d4f5){logger[_0x4978('0xf')]('Setting,\x20%s,\x20%s',_0x48446d,_0x4978('0x10'));logger['debug'](_0x4978('0x11'),_0x48446d,_0x4978('0x10'),JSON[_0x4978('0x12')](_0x29d4f5));if(_0x29d4f5['error']){if(_0x29d4f5[_0x4978('0x13')]['code']===0x1f4){logger[_0x4978('0x13')](_0x4978('0x14'),_0x48446d,_0x29d4f5[_0x4978('0x13')][_0x4978('0x15')]);return _0x265ec5(_0x29d4f5[_0x4978('0x13')][_0x4978('0x15')]);}logger['error'](_0x4978('0x14'),_0x48446d,_0x29d4f5['error']['message']);return _0x485cf0(_0x29d4f5[_0x4978('0x13')][_0x4978('0x15')]);}else{logger[_0x4978('0xf')]('Setting,\x20%s,\x20%s',_0x48446d,'request\x20sent');_0x485cf0(_0x29d4f5[_0x4978('0x16')]['message']);}})['catch'](function(_0x36fd4d){logger[_0x4978('0x13')](_0x4978('0x14'),_0x48446d,_0x36fd4d);_0x265ec5(_0x36fd4d);});});}exports['ShowSetting']=function(_0x5c6719){var _0x40f930=this;return new Promise(function(_0x554784,_0x5d3575){return db[_0x4978('0x17')][_0x4978('0x18')]({'raw':_0x5c6719[_0x4978('0x19')]?_0x5c6719['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c6719[_0x4978('0x19')]?_0x5c6719[_0x4978('0x19')]['where']||null:null,'attributes':_0x5c6719[_0x4978('0x19')]?_0x5c6719[_0x4978('0x19')][_0x4978('0x1a')]||null:null,'include':_0x5c6719['options']?_0x5c6719['options'][_0x4978('0x1b')]?_[_0x4978('0x1c')](_0x5c6719['options']['include'],function(_0x5bb1e0){return{'model':db[_0x5bb1e0[_0x4978('0x1d')]],'as':_0x5bb1e0['as'],'attributes':_0x5bb1e0['attributes'],'include':_0x5bb1e0['include']?_[_0x4978('0x1c')](_0x5bb1e0[_0x4978('0x1b')],function(_0x30a5cb){return{'model':db[_0x30a5cb[_0x4978('0x1d')]],'as':_0x30a5cb['as'],'attributes':_0x30a5cb[_0x4978('0x1a')],'include':_0x30a5cb[_0x4978('0x1b')]?_[_0x4978('0x1c')](_0x30a5cb[_0x4978('0x1b')],function(_0x251437){return{'model':db[_0x251437[_0x4978('0x1d')]],'as':_0x251437['as'],'attributes':_0x251437[_0x4978('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x122e9b){logger[_0x4978('0xf')](_0x4978('0x1e'),_0x5c6719);logger[_0x4978('0x1f')](_0x4978('0x1e'),_0x5c6719,JSON[_0x4978('0x12')](_0x122e9b));_0x554784(_0x122e9b);})[_0x4978('0x20')](function(_0x3503ba){logger[_0x4978('0x13')](_0x4978('0x1e'),_0x3503ba['message'],_0x5c6719);_0x5d3575(_0x40f930[_0x4978('0x13')](0x1f4,_0x3503ba[_0x4978('0x15')]));});});}; \ No newline at end of file +var _0xdffe=['request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','find','options','raw','where','attributes','include','map','model','info','ShowSetting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56735a,_0x311842){var _0x1a6231=function(_0x391cb2){while(--_0x391cb2){_0x56735a['push'](_0x56735a['shift']());}};_0x1a6231(++_0x311842);}(_0xdffe,0x16a));var _0xedff=function(_0x11de83,_0x49e1c1){_0x11de83=_0x11de83-0x0;var _0x45bdb0=_0xdffe[_0x11de83];return _0x45bdb0;};'use strict';var _=require('lodash');var util=require(_0xedff('0x0'));var moment=require(_0xedff('0x1'));var BPromise=require(_0xedff('0x2'));var rs=require(_0xedff('0x3'));var fs=require('fs');var Redis=require(_0xedff('0x4'));var db=require(_0xedff('0x5'))['db'];var utils=require(_0xedff('0x6'));var logger=require(_0xedff('0x7'))(_0xedff('0x8'));var config=require(_0xedff('0x9'));var jayson=require(_0xedff('0xa'));var client=jayson[_0xedff('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x417c44,_0x147879,_0xfb3f27){return new BPromise(function(_0x4b2019,_0x5c51e4){return client[_0xedff('0xc')](_0x417c44,_0xfb3f27)[_0xedff('0xd')](function(_0x390ed1){logger['info'](_0xedff('0xe'),_0x147879,_0xedff('0xf'));logger[_0xedff('0x10')](_0xedff('0x11'),_0x147879,_0xedff('0xf'),JSON[_0xedff('0x12')](_0x390ed1));if(_0x390ed1[_0xedff('0x13')]){if(_0x390ed1[_0xedff('0x13')][_0xedff('0x14')]===0x1f4){logger[_0xedff('0x13')](_0xedff('0xe'),_0x147879,_0x390ed1['error']['message']);return _0x5c51e4(_0x390ed1['error'][_0xedff('0x15')]);}logger['error'](_0xedff('0xe'),_0x147879,_0x390ed1[_0xedff('0x13')][_0xedff('0x15')]);return _0x4b2019(_0x390ed1[_0xedff('0x13')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x147879,_0xedff('0xf'));_0x4b2019(_0x390ed1[_0xedff('0x16')][_0xedff('0x15')]);}})[_0xedff('0x17')](function(_0x4e4d91){logger[_0xedff('0x13')](_0xedff('0xe'),_0x147879,_0x4e4d91);_0x5c51e4(_0x4e4d91);});});}exports['ShowSetting']=function(_0x1038fd){var _0x2f2319=this;return new Promise(function(_0x10a989,_0x29a548){return db['Setting'][_0xedff('0x18')]({'raw':_0x1038fd[_0xedff('0x19')]?_0x1038fd[_0xedff('0x19')][_0xedff('0x1a')]===undefined?!![]:![]:!![],'where':_0x1038fd[_0xedff('0x19')]?_0x1038fd[_0xedff('0x19')][_0xedff('0x1b')]||null:null,'attributes':_0x1038fd[_0xedff('0x19')]?_0x1038fd[_0xedff('0x19')][_0xedff('0x1c')]||null:null,'include':_0x1038fd[_0xedff('0x19')]?_0x1038fd['options'][_0xedff('0x1d')]?_[_0xedff('0x1e')](_0x1038fd[_0xedff('0x19')][_0xedff('0x1d')],function(_0x2363f5){return{'model':db[_0x2363f5[_0xedff('0x1f')]],'as':_0x2363f5['as'],'attributes':_0x2363f5[_0xedff('0x1c')],'include':_0x2363f5[_0xedff('0x1d')]?_['map'](_0x2363f5[_0xedff('0x1d')],function(_0x3c6837){return{'model':db[_0x3c6837[_0xedff('0x1f')]],'as':_0x3c6837['as'],'attributes':_0x3c6837['attributes'],'include':_0x3c6837[_0xedff('0x1d')]?_[_0xedff('0x1e')](_0x3c6837[_0xedff('0x1d')],function(_0xee2d8e){return{'model':db[_0xee2d8e[_0xedff('0x1f')]],'as':_0xee2d8e['as'],'attributes':_0xee2d8e[_0xedff('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xedff('0xd')](function(_0x3345a6){logger[_0xedff('0x20')](_0xedff('0x21'),_0x1038fd);logger['debug']('ShowSetting',_0x1038fd,JSON['stringify'](_0x3345a6));_0x10a989(_0x3345a6);})['catch'](function(_0x5502e8){logger[_0xedff('0x13')](_0xedff('0x21'),_0x5502e8[_0xedff('0x15')],_0x1038fd);_0x29a548(_0x2f2319[_0xedff('0x13')](0x1f4,_0x5502e8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index b480a01..f4ca32d 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x9906ff,_0x471c43){var _0x143a16=function(_0x261d87){while(--_0x261d87){_0x9906ff['push'](_0x9906ff['shift']());}};_0x143a16(++_0x471c43);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x404458,_0x320912){var _0x5313c9=function(_0x495af9){while(--_0x495af9){_0x404458['push'](_0x404458['shift']());}};_0x5313c9(++_0x320912);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 9d876e7..cfb7c8b 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 _0xb18b=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x533643,_0x5a0aeb){var _0x145ebf=function(_0x317eff){while(--_0x317eff){_0x533643['push'](_0x533643['shift']());}};_0x145ebf(++_0x5a0aeb);}(_0xb18b,0x67));var _0xbb18=function(_0x2fcda2,_0x428a8e){_0x2fcda2=_0x2fcda2-0x0;var _0x466965=_0xb18b[_0x2fcda2];return _0x466965;};'use strict';var Sequelize=require(_0xbb18('0x0'));var rs=require(_0xbb18('0x1'));module[_0xbb18('0x2')]={'name':{'type':Sequelize[_0xbb18('0x3')],'unique':_0xbb18('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xbb18('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xbb18('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xbb18('0x3')],'defaultValue':function(){return rs[_0xbb18('0x5')]();}},'phone':{'type':Sequelize[_0xbb18('0x3')]},'type':{'type':Sequelize[_0xbb18('0x6')](_0xbb18('0x7'),_0xbb18('0x8'),_0xbb18('0x9'),_0xbb18('0xa'),_0xbb18('0xb'),'clickatell','bandwidth',_0xbb18('0xc'),_0xbb18('0xd'),_0xbb18('0xe'))},'accountSid':{'type':Sequelize[_0xbb18('0x3')]},'authId':{'type':Sequelize[_0xbb18('0x3')]},'authToken':{'type':Sequelize[_0xbb18('0x3')]},'smsMethod':{'type':Sequelize[_0xbb18('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbb18('0x3')]},'password':{'type':Sequelize[_0xbb18('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xbb18('0x3')]},'accountId':{'type':Sequelize[_0xbb18('0x3')]},'senderString':{'type':Sequelize[_0xbb18('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbb18('0xf')],'defaultValue':function(){return _0xbb18('0x10');}},'notificationSound':{'type':Sequelize[_0xbb18('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbb18('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbb18('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbb18('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb18('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbb18('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb18('0x12')],'comment':_0xbb18('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbb18('0x14'),'set':function(_0xd27c33){if(!_0xd27c33)this[_0xbb18('0x15')](_0xbb18('0x16'),null);this[_0xbb18('0x15')](_0xbb18('0x17'),_0xd27c33);}}}; \ No newline at end of file +var _0x6ef3=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','skebby','connectel','plivo','clickatell','bandwidth','infobip','intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x318dbf,_0x5a8009){var _0x21b92e=function(_0x36eda4){while(--_0x36eda4){_0x318dbf['push'](_0x318dbf['shift']());}};_0x21b92e(++_0x5a8009);}(_0x6ef3,0x15b));var _0x36ef=function(_0x38a26d,_0x19ba99){_0x38a26d=_0x38a26d-0x0;var _0xd90c30=_0x6ef3[_0x38a26d];return _0xd90c30;};'use strict';var Sequelize=require(_0x36ef('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x36ef('0x1')],'unique':_0x36ef('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x36ef('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x36ef('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x36ef('0x3')]();}},'phone':{'type':Sequelize[_0x36ef('0x1')]},'type':{'type':Sequelize[_0x36ef('0x4')]('twilio',_0x36ef('0x5'),_0x36ef('0x6'),'clicksend',_0x36ef('0x7'),_0x36ef('0x8'),_0x36ef('0x9'),'csc',_0x36ef('0xa'),_0x36ef('0xb'))},'accountSid':{'type':Sequelize[_0x36ef('0x1')]},'authId':{'type':Sequelize[_0x36ef('0x1')]},'authToken':{'type':Sequelize[_0x36ef('0x1')]},'smsMethod':{'type':Sequelize[_0x36ef('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x36ef('0x1')]},'password':{'type':Sequelize[_0x36ef('0x1')]},'apiKey':{'type':Sequelize[_0x36ef('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x36ef('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x36ef('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x36ef('0xc');}},'notificationSound':{'type':Sequelize[_0x36ef('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x36ef('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x36ef('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x36ef('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x36ef('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x36ef('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x36ef('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x36ef('0xe')],'comment':_0x36ef('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x36ef('0x10'),'set':function(_0x22f9db){if(!_0x22f9db)this[_0x36ef('0x11')](_0x36ef('0x12'),null);this[_0x36ef('0x11')](_0x36ef('0x13'),_0x22f9db);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 404ff64..86c7d61 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 _0x7cc1=['util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','reject','update','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','filter','options','include','findAll','rows','show','includeAll','find','create','user','role','SmsAccounts','UserProfileSection','userProfileId','autoAssociation','body','params','destroy','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','pick','SmsAccountId','removeDispositions','ids','CannedAnswer','removeAnswers','notify','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','Body','messageId','MessageSid','sender','text','connectel','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','debug','twilio','set','text/xml','send','json','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','Messages','dataValues','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','clickatell','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','spread','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x7cc1,0x1ca));var _0x17cc=function(_0x47fbad,_0x50be8b){_0x47fbad=_0x47fbad-0x0;var _0x397fee=_0x7cc1[_0x47fbad];return _0x397fee;};'use strict';var emlformat=require(_0x17cc('0x0'));var rimraf=require(_0x17cc('0x1'));var zipdir=require(_0x17cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x17cc('0x3'));var moment=require(_0x17cc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x17cc('0x5'));var util=require(_0x17cc('0x6'));var path=require(_0x17cc('0x7'));var sox=require(_0x17cc('0x8'));var csv=require(_0x17cc('0x9'));var ejs=require(_0x17cc('0xa'));var fs=require('fs');var fs_extra=require(_0x17cc('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x17cc('0xc'));var jsforce=require(_0x17cc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x17cc('0x9'));var querystring=require(_0x17cc('0xe'));var Papa=require(_0x17cc('0xf'));var Redis=require(_0x17cc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x17cc('0x11'));var as=require(_0x17cc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x17cc('0x13'));var config=require(_0x17cc('0x14'));var licenseUtil=require(_0x17cc('0x15'));var db=require('../../mysqldb')['db'];config[_0x17cc('0x16')]=_[_0x17cc('0x17')](config[_0x17cc('0x16')],{'host':_0x17cc('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x17cc('0x16')]));require('./smsAccount.socket')[_0x17cc('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x17cc('0x1a')][_0x17cc('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2b6e52,_0x1aa48f,_0x5428f1,_0x6dc45a){return new BPromise(function(_0x5ce950,_0xbf558){var _0x53f97e=_0x6dc45a||client;return _0x53f97e[_0x17cc('0x1c')](_0x2b6e52,_0x5428f1)[_0x17cc('0x1d')](function(_0x24c322){logger[_0x17cc('0x1e')](_0x17cc('0x1f'),_0x1aa48f,'request\x20sent');logger['debug'](_0x17cc('0x20'),_0x1aa48f,'request\x20sent',JSON[_0x17cc('0x21')](_0x24c322));if(_0x24c322[_0x17cc('0x22')]){if(_0x24c322[_0x17cc('0x22')][_0x17cc('0x23')]===0x1f4){logger[_0x17cc('0x22')](_0x17cc('0x1f'),_0x1aa48f,_0x24c322[_0x17cc('0x22')][_0x17cc('0x24')]);return _0xbf558(_0x24c322[_0x17cc('0x22')][_0x17cc('0x24')]);}logger[_0x17cc('0x22')](_0x17cc('0x1f'),_0x1aa48f,_0x24c322['error'][_0x17cc('0x24')]);return _0x5ce950(_0x24c322[_0x17cc('0x22')][_0x17cc('0x24')]);}else{logger[_0x17cc('0x1e')](_0x17cc('0x1f'),_0x1aa48f,_0x17cc('0x25'));_0x5ce950(_0x24c322['result'][_0x17cc('0x24')]);}})[_0x17cc('0x26')](function(_0x4633d5){logger[_0x17cc('0x22')](_0x17cc('0x1f'),_0x1aa48f,_0x4633d5);_0xbf558(_0x4633d5);});});}function respondWithStatusCode(_0x2a15a3,_0x3e9684){_0x3e9684=_0x3e9684||0xcc;return function(_0x4f1c6f){if(_0x4f1c6f){return _0x2a15a3[_0x17cc('0x27')](_0x3e9684);}return _0x2a15a3[_0x17cc('0x28')](_0x3e9684)[_0x17cc('0x29')]();};}function respondWithResult(_0x1d3848,_0x26a770){_0x26a770=_0x26a770||0xc8;return function(_0x3b361a){if(_0x3b361a){return _0x1d3848[_0x17cc('0x28')](_0x26a770)['json'](_0x3b361a);}};}function respondWithFilteredResult(_0x5ef062,_0x27d8e0){return function(_0x13bd03){if(_0x13bd03){var _0x43ed10=typeof _0x27d8e0[_0x17cc('0x2a')]==='undefined'&&typeof _0x27d8e0[_0x17cc('0x2b')]===_0x17cc('0x2c');var _0x4ace7b=_0x13bd03[_0x17cc('0x2d')];var _0x205aa3=_0x43ed10?0x0:_0x27d8e0[_0x17cc('0x2a')];var _0x2ed66c=_0x43ed10?_0x13bd03['count']:_0x27d8e0[_0x17cc('0x2a')]+_0x27d8e0[_0x17cc('0x2b')];var _0x442a66;if(_0x2ed66c>=_0x4ace7b){_0x2ed66c=_0x4ace7b;_0x442a66=0xc8;}else{_0x442a66=0xce;}_0x5ef062[_0x17cc('0x28')](_0x442a66);return _0x5ef062['set'](_0x17cc('0x2e'),_0x205aa3+'-'+_0x2ed66c+'/'+_0x4ace7b)['json'](_0x13bd03);}return null;};}function patchUpdates(_0xbe603a){return function(_0x2c41f8){try{jsonpatch['apply'](_0x2c41f8,_0xbe603a,!![]);}catch(_0x35ad5e){return BPromise[_0x17cc('0x2f')](_0x35ad5e);}return _0x2c41f8['save']();};}function saveUpdates(_0x1ce14f,_0x28da30){return function(_0x4b877f){if(_0x4b877f){return _0x4b877f[_0x17cc('0x30')](_0x1ce14f)[_0x17cc('0x1d')](function(_0xf4e723){return _0xf4e723;});}return null;};}function removeEntity(_0x1ccb77,_0x9dc601){return function(_0x180aee){if(_0x180aee){return _0x180aee['destroy']()['then'](function(){var _0x3abed8=_0x180aee[_0x17cc('0x31')]({'plain':!![]});var _0x668000='SmsAccounts';return db[_0x17cc('0x32')]['destroy']({'where':{'type':_0x668000,'resourceId':_0x3abed8['id']}})[_0x17cc('0x1d')](function(){return _0x180aee;});})[_0x17cc('0x1d')](function(){_0x1ccb77[_0x17cc('0x28')](0xcc)[_0x17cc('0x29')]();});}};}function handleEntityNotFound(_0x346476,_0x4bfd00){return function(_0x23cf15){if(!_0x23cf15){_0x346476[_0x17cc('0x27')](0x194);}return _0x23cf15;};}function handleError(_0x287132,_0x3d101f){_0x3d101f=_0x3d101f||0x1f4;return function(_0x3e76ec){logger[_0x17cc('0x22')](_0x3e76ec[_0x17cc('0x33')]);if(_0x3e76ec[_0x17cc('0x34')]){delete _0x3e76ec[_0x17cc('0x34')];}_0x287132[_0x17cc('0x28')](_0x3d101f)['send'](_0x3e76ec);};}exports[_0x17cc('0x35')]=function(_0x1a294b,_0x5da551){var _0x39e61a={'include':[{'model':db[_0x17cc('0x36')],'as':_0x17cc('0x37')}]},_0x5bfbbd={},_0x32e62e={'count':0x0,'rows':[]};var _0x402609=_[_0x17cc('0x38')](db[_0x17cc('0x39')][_0x17cc('0x3a')],function(_0x346673){return{'name':_0x346673[_0x17cc('0x3b')],'type':_0x346673['type']['key']};});_0x5bfbbd[_0x17cc('0x3c')]=_['map'](_0x402609,_0x17cc('0x34'));_0x5bfbbd[_0x17cc('0x3d')]=_[_0x17cc('0x3e')](_0x1a294b[_0x17cc('0x3d')]);_0x5bfbbd[_0x17cc('0x3f')]=_[_0x17cc('0x40')](_0x5bfbbd['model'],_0x5bfbbd[_0x17cc('0x3d')]);_0x39e61a[_0x17cc('0x41')]=_[_0x17cc('0x40')](_0x5bfbbd['model'],qs[_0x17cc('0x42')](_0x1a294b['query']['fields']));_0x39e61a[_0x17cc('0x41')]=_0x39e61a[_0x17cc('0x41')][_0x17cc('0x43')]?_0x39e61a['attributes']:_0x5bfbbd['model'];if(!_0x1a294b[_0x17cc('0x3d')][_0x17cc('0x44')]('nolimit')){_0x39e61a[_0x17cc('0x2b')]=qs[_0x17cc('0x2b')](_0x1a294b[_0x17cc('0x3d')][_0x17cc('0x2b')]);_0x39e61a['offset']=qs['offset'](_0x1a294b[_0x17cc('0x3d')][_0x17cc('0x2a')]);}_0x39e61a[_0x17cc('0x45')]=qs[_0x17cc('0x46')](_0x1a294b[_0x17cc('0x3d')]['sort']);_0x39e61a['where']=qs[_0x17cc('0x3f')](_['pick'](_0x1a294b['query'],_0x5bfbbd[_0x17cc('0x3f')]),_0x402609);if(_0x1a294b[_0x17cc('0x3d')]['filter']){_0x39e61a[_0x17cc('0x47')]=_[_0x17cc('0x48')](_0x39e61a[_0x17cc('0x47')],{'$or':_[_0x17cc('0x38')](_0x402609,function(_0x3e09fc){if(_0x3e09fc[_0x17cc('0x49')]!=='VIRTUAL'){var _0x12ae48={};_0x12ae48[_0x3e09fc[_0x17cc('0x34')]]={'$like':'%'+_0x1a294b[_0x17cc('0x3d')][_0x17cc('0x4a')]+'%'};return _0x12ae48;}})});}_0x39e61a=_['merge']({},_0x39e61a,_0x1a294b[_0x17cc('0x4b')]);var _0x371422={'where':_0x39e61a['where']};return db['SmsAccount'][_0x17cc('0x2d')](_0x371422)[_0x17cc('0x1d')](function(_0x3a7a14){_0x32e62e[_0x17cc('0x2d')]=_0x3a7a14;if(_0x1a294b[_0x17cc('0x3d')]['includeAll']){_0x39e61a[_0x17cc('0x4c')]=[{'all':!![]}];}return db[_0x17cc('0x39')][_0x17cc('0x4d')](_0x39e61a);})[_0x17cc('0x1d')](function(_0x3cab50){_0x32e62e[_0x17cc('0x4e')]=_0x3cab50;return _0x32e62e;})['then'](respondWithFilteredResult(_0x5da551,_0x39e61a))[_0x17cc('0x26')](handleError(_0x5da551,null));};exports[_0x17cc('0x4f')]=function(_0x50df90,_0x1e4fa4){var _0x562793={'raw':![],'where':{'id':_0x50df90['params']['id']},'include':[{'model':db[_0x17cc('0x36')],'as':_0x17cc('0x37')}]},_0x16eb94={};_0x16eb94[_0x17cc('0x3c')]=_[_0x17cc('0x3e')](db[_0x17cc('0x39')][_0x17cc('0x3a')]);_0x16eb94[_0x17cc('0x3d')]=_['keys'](_0x50df90[_0x17cc('0x3d')]);_0x16eb94[_0x17cc('0x3f')]=_['intersection'](_0x16eb94[_0x17cc('0x3c')],_0x16eb94['query']);_0x562793[_0x17cc('0x41')]=_[_0x17cc('0x40')](_0x16eb94[_0x17cc('0x3c')],qs[_0x17cc('0x42')](_0x50df90[_0x17cc('0x3d')][_0x17cc('0x42')]));_0x562793[_0x17cc('0x41')]=_0x562793['attributes'][_0x17cc('0x43')]?_0x562793[_0x17cc('0x41')]:_0x16eb94[_0x17cc('0x3c')];if(_0x50df90[_0x17cc('0x3d')][_0x17cc('0x50')]){_0x562793[_0x17cc('0x4c')]=[{'all':!![]}];}_0x562793=_[_0x17cc('0x48')]({},_0x562793,_0x50df90[_0x17cc('0x4b')]);return db[_0x17cc('0x39')][_0x17cc('0x51')](_0x562793)['then'](handleEntityNotFound(_0x1e4fa4,null))['then'](respondWithResult(_0x1e4fa4,null))[_0x17cc('0x26')](handleError(_0x1e4fa4,null));};exports[_0x17cc('0x52')]=function(_0x1877ed,_0x78b723){return db[_0x17cc('0x39')][_0x17cc('0x52')](_0x1877ed['body'],{})[_0x17cc('0x1d')](function(_0x283c1a){var _0x469bfe=_0x1877ed[_0x17cc('0x53')]['get']({'plain':!![]});if(!_0x469bfe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x469bfe[_0x17cc('0x54')]===_0x17cc('0x53')){var _0x1b6d22=_0x283c1a[_0x17cc('0x31')]({'plain':!![]});var _0x1738ed=_0x17cc('0x55');return db[_0x17cc('0x56')]['find']({'where':{'name':_0x1738ed,'userProfileId':_0x469bfe[_0x17cc('0x57')]},'raw':!![]})[_0x17cc('0x1d')](function(_0x4a09b5){if(_0x4a09b5&&_0x4a09b5[_0x17cc('0x58')]===0x0){return db[_0x17cc('0x32')][_0x17cc('0x52')]({'name':_0x1b6d22['name'],'resourceId':_0x1b6d22['id'],'type':_0x4a09b5[_0x17cc('0x34')],'sectionId':_0x4a09b5['id']},{})[_0x17cc('0x1d')](function(){return _0x283c1a;});}else{return _0x283c1a;}})[_0x17cc('0x26')](function(_0x5b9473){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b9473);throw _0x5b9473;});}return _0x283c1a;})[_0x17cc('0x1d')](respondWithResult(_0x78b723,0xc9))['catch'](handleError(_0x78b723,null));};exports['update']=function(_0x5492ef,_0x238085){if(_0x5492ef[_0x17cc('0x59')]['id']){delete _0x5492ef['body']['id'];}return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x5492ef[_0x17cc('0x5a')]['id']},'include':[{'model':db[_0x17cc('0x36')],'as':_0x17cc('0x37')}]})[_0x17cc('0x1d')](handleEntityNotFound(_0x238085,null))[_0x17cc('0x1d')](saveUpdates(_0x5492ef[_0x17cc('0x59')],null))['then'](respondWithResult(_0x238085,null))[_0x17cc('0x26')](handleError(_0x238085,null));};exports[_0x17cc('0x5b')]=function(_0xe6eddb,_0x4c34cc){return db[_0x17cc('0x39')]['find']({'where':{'id':_0xe6eddb[_0x17cc('0x5a')]['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x4c34cc,null))[_0x17cc('0x1d')](removeEntity(_0x4c34cc,null))['catch'](handleError(_0x4c34cc,null));};exports[_0x17cc('0x5c')]=function(_0x313d29,_0x501c5f){return db[_0x17cc('0x39')][_0x17cc('0x5c')]()['then'](respondWithResult(_0x501c5f,null))[_0x17cc('0x26')](handleError(_0x501c5f,null));};exports[_0x17cc('0x5d')]=function(_0x55dfb6,_0x1c78be,_0x2bc60c){if(_0x55dfb6[_0x17cc('0x59')]['id']){delete _0x55dfb6[_0x17cc('0x59')]['id'];}return db['SmsAccount'][_0x17cc('0x51')]({'where':{'id':_0x55dfb6['params']['id']}})['then'](handleEntityNotFound(_0x1c78be,null))[_0x17cc('0x1d')](function(_0x488de1){if(_0x488de1){_0x55dfb6[_0x17cc('0x59')]['SmsAccountId']=_0x488de1['id'];return db[_0x17cc('0x5e')][_0x17cc('0x52')](_0x55dfb6[_0x17cc('0x59')]);}})[_0x17cc('0x1d')](respondWithResult(_0x1c78be,null))[_0x17cc('0x26')](handleError(_0x1c78be,null));};exports[_0x17cc('0x5f')]=function(_0x2694a4,_0x4e2df3,_0x5882fe){var _0x35ff83={'raw':![],'where':{}};var _0x49f7d0={};var _0x32f19c={'count':0x0,'rows':[]};return db[_0x17cc('0x39')][_0x17cc('0x60')]({'where':{'id':_0x2694a4[_0x17cc('0x5a')]['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x4e2df3,null))['then'](function(_0x461444){if(_0x461444){_0x49f7d0['model']=_[_0x17cc('0x3e')](db[_0x17cc('0x5e')]['rawAttributes']);_0x49f7d0[_0x17cc('0x3d')]=_['keys'](_0x2694a4[_0x17cc('0x3d')]);_0x49f7d0[_0x17cc('0x3f')]=_['intersection'](_0x49f7d0[_0x17cc('0x3c')],_0x49f7d0[_0x17cc('0x3d')]);_0x35ff83[_0x17cc('0x41')]=_[_0x17cc('0x40')](_0x49f7d0[_0x17cc('0x3c')],qs[_0x17cc('0x42')](_0x2694a4[_0x17cc('0x3d')][_0x17cc('0x42')]));_0x35ff83[_0x17cc('0x41')]=_0x35ff83[_0x17cc('0x41')]['length']?_0x35ff83['attributes']:_0x49f7d0[_0x17cc('0x3c')];if(!_0x2694a4[_0x17cc('0x3d')][_0x17cc('0x44')](_0x17cc('0x61'))){_0x35ff83[_0x17cc('0x2b')]=qs[_0x17cc('0x2b')](_0x2694a4[_0x17cc('0x3d')][_0x17cc('0x2b')]);_0x35ff83['offset']=qs[_0x17cc('0x2a')](_0x2694a4[_0x17cc('0x3d')]['offset']);}_0x35ff83['order']=qs[_0x17cc('0x46')](_0x2694a4[_0x17cc('0x3d')][_0x17cc('0x46')]);_0x35ff83[_0x17cc('0x47')]=qs[_0x17cc('0x3f')](_[_0x17cc('0x62')](_0x2694a4[_0x17cc('0x3d')],_0x49f7d0['filters']));_0x35ff83[_0x17cc('0x47')][_0x17cc('0x63')]=_0x461444['id'];if(_0x2694a4[_0x17cc('0x3d')][_0x17cc('0x4a')]){_0x35ff83[_0x17cc('0x47')]=_['merge'](_0x35ff83[_0x17cc('0x47')],{'$or':_[_0x17cc('0x38')](_0x35ff83[_0x17cc('0x41')],function(_0x432ae2){var _0x3a01ab={};_0x3a01ab[_0x432ae2]={'$like':'%'+_0x2694a4[_0x17cc('0x3d')][_0x17cc('0x4a')]+'%'};return _0x3a01ab;})});}_0x35ff83=_[_0x17cc('0x48')]({},_0x35ff83,_0x2694a4[_0x17cc('0x4b')]);return db['Disposition'][_0x17cc('0x2d')]({'where':_0x35ff83[_0x17cc('0x47')]})[_0x17cc('0x1d')](function(_0x54ca9c){_0x32f19c[_0x17cc('0x2d')]=_0x54ca9c;if(_0x2694a4[_0x17cc('0x3d')]['includeAll']){_0x35ff83['include']=[{'all':!![]}];}return db[_0x17cc('0x5e')][_0x17cc('0x4d')](_0x35ff83);})[_0x17cc('0x1d')](function(_0x18031f){_0x32f19c[_0x17cc('0x4e')]=_0x18031f;return _0x32f19c;});}})[_0x17cc('0x1d')](respondWithFilteredResult(_0x4e2df3,_0x35ff83))[_0x17cc('0x26')](handleError(_0x4e2df3,null));};exports[_0x17cc('0x64')]=function(_0x25fbd4,_0x47717b,_0x5dda50){return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x25fbd4['params']['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x47717b,null))['then'](function(_0x1098ad){if(_0x1098ad){return _0x1098ad[_0x17cc('0x64')](_0x25fbd4[_0x17cc('0x3d')][_0x17cc('0x65')]);}})['then'](respondWithStatusCode(_0x47717b,null))[_0x17cc('0x26')](handleError(_0x47717b,null));};exports['addAnswer']=function(_0x45623c,_0x43bb36,_0x530133){if(_0x45623c[_0x17cc('0x59')]['id']){delete _0x45623c['body']['id'];}return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x45623c['params']['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x43bb36,null))[_0x17cc('0x1d')](function(_0x1d7c7d){if(_0x1d7c7d){_0x45623c['body'][_0x17cc('0x63')]=_0x1d7c7d['id'];return db[_0x17cc('0x66')][_0x17cc('0x52')](_0x45623c[_0x17cc('0x59')]);}})['then'](respondWithResult(_0x43bb36,null))['catch'](handleError(_0x43bb36,null));};exports['getAnswers']=function(_0xfd633d,_0x42ee9a,_0x2a05ff){var _0x30b28d={'raw':![],'where':{}};var _0x53c870={};var _0x1e02fa={'count':0x0,'rows':[]};return db[_0x17cc('0x39')][_0x17cc('0x60')]({'where':{'id':_0xfd633d[_0x17cc('0x5a')]['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x42ee9a,null))[_0x17cc('0x1d')](function(_0x4818d2){if(_0x4818d2){_0x53c870[_0x17cc('0x3c')]=_['keys'](db[_0x17cc('0x66')][_0x17cc('0x3a')]);_0x53c870['query']=_[_0x17cc('0x3e')](_0xfd633d[_0x17cc('0x3d')]);_0x53c870['filters']=_[_0x17cc('0x40')](_0x53c870[_0x17cc('0x3c')],_0x53c870['query']);_0x30b28d[_0x17cc('0x41')]=_[_0x17cc('0x40')](_0x53c870[_0x17cc('0x3c')],qs[_0x17cc('0x42')](_0xfd633d[_0x17cc('0x3d')][_0x17cc('0x42')]));_0x30b28d[_0x17cc('0x41')]=_0x30b28d[_0x17cc('0x41')][_0x17cc('0x43')]?_0x30b28d['attributes']:_0x53c870['model'];if(!_0xfd633d[_0x17cc('0x3d')][_0x17cc('0x44')]('nolimit')){_0x30b28d[_0x17cc('0x2b')]=qs['limit'](_0xfd633d[_0x17cc('0x3d')][_0x17cc('0x2b')]);_0x30b28d[_0x17cc('0x2a')]=qs['offset'](_0xfd633d['query']['offset']);}_0x30b28d['order']=qs[_0x17cc('0x46')](_0xfd633d['query'][_0x17cc('0x46')]);_0x30b28d['where']=qs[_0x17cc('0x3f')](_['pick'](_0xfd633d[_0x17cc('0x3d')],_0x53c870['filters']));_0x30b28d[_0x17cc('0x47')][_0x17cc('0x63')]=_0x4818d2['id'];if(_0xfd633d[_0x17cc('0x3d')][_0x17cc('0x4a')]){_0x30b28d[_0x17cc('0x47')]=_[_0x17cc('0x48')](_0x30b28d[_0x17cc('0x47')],{'$or':_[_0x17cc('0x38')](_0x30b28d[_0x17cc('0x41')],function(_0xaf69cc){var _0x56002d={};_0x56002d[_0xaf69cc]={'$like':'%'+_0xfd633d[_0x17cc('0x3d')]['filter']+'%'};return _0x56002d;})});}_0x30b28d=_[_0x17cc('0x48')]({},_0x30b28d,_0xfd633d[_0x17cc('0x4b')]);return db[_0x17cc('0x66')]['count']({'where':_0x30b28d['where']})['then'](function(_0x1841fb){_0x1e02fa[_0x17cc('0x2d')]=_0x1841fb;if(_0xfd633d[_0x17cc('0x3d')]['includeAll']){_0x30b28d[_0x17cc('0x4c')]=[{'all':!![]}];}return db[_0x17cc('0x66')]['findAll'](_0x30b28d);})[_0x17cc('0x1d')](function(_0x30d9e7){_0x1e02fa[_0x17cc('0x4e')]=_0x30d9e7;return _0x1e02fa;});}})[_0x17cc('0x1d')](respondWithFilteredResult(_0x42ee9a,_0x30b28d))[_0x17cc('0x26')](handleError(_0x42ee9a,null));};exports[_0x17cc('0x67')]=function(_0x7c0736,_0x55b590,_0x1ae683){return db['SmsAccount'][_0x17cc('0x51')]({'where':{'id':_0x7c0736[_0x17cc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x55b590,null))[_0x17cc('0x1d')](function(_0x4b5333){if(_0x4b5333){return _0x4b5333['removeAnswers'](_0x7c0736[_0x17cc('0x3d')][_0x17cc('0x65')]);}})[_0x17cc('0x1d')](respondWithStatusCode(_0x55b590,null))[_0x17cc('0x26')](handleError(_0x55b590,null));};exports[_0x17cc('0x68')]=function(_0x14cc5e,_0x5eb3f7,_0x3adb7e){var _0xff8541={'channel':'sms'};var _0x25ab1e=[];var _0x4484d8=[];var _0x486af5={};return db[_0x17cc('0x39')]['find']({'where':{'id':_0x14cc5e[_0x17cc('0x5a')]['id']},'include':[{'model':db[_0x17cc('0x69')],'as':'Applications'}]})[_0x17cc('0x1d')](handleEntityNotFound(_0x5eb3f7,null))['then'](function(_0x363cde){_0xff8541['account']=_0x363cde;_0xff8541[_0x17cc('0x6a')]=_[_0x17cc('0x6b')](_0x363cde[_0x17cc('0x6c')],[_0x17cc('0x6d')],[_0x17cc('0x6e')]);if(_0xff8541[_0x17cc('0x6f')][_0x17cc('0x6c')]){delete _0xff8541['account']['Applications'];}return db[_0x17cc('0x70')][_0x17cc('0x5c')]();})[_0x17cc('0x1d')](function(_0x4d0dfd){if(!_0x4d0dfd){throw new db['Sequelize'][(_0x17cc('0x71'))](_0x17cc('0x72'));}_0x25ab1e=_[_0x17cc('0x73')](_[_0x17cc('0x3e')](_0x4d0dfd),[_0x17cc('0x74'),_0x17cc('0x75')]);_0x4484d8=_[_0x17cc('0x73')](_[_0x17cc('0x3e')](_0x4d0dfd),['createdAt',_0x17cc('0x75'),_0x17cc('0x76'),_0x17cc('0x77')]);_0xff8541[_0x17cc('0x59')]={'mapKey':_0x17cc('0x78')};if(_0xff8541[_0x17cc('0x6f')][_0x17cc('0x49')]){switch(_0xff8541[_0x17cc('0x6f')]['type']){case'twilio':_0xff8541[_0x17cc('0x59')][_0x17cc('0x79')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x7a')];_0xff8541['body'][_0x17cc('0x59')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x7b')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x7c')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x7d')];break;case'skebby':_0xff8541[_0x17cc('0x59')][_0x17cc('0x79')]='+'+_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x7e')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x7f')];break;case _0x17cc('0x80'):_0xff8541['body'][_0x17cc('0x79')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x79')];_0xff8541[_0x17cc('0x59')]['body']=_0x14cc5e[_0x17cc('0x59')]['message'];break;case'clicksend':_0xff8541[_0x17cc('0x59')]['from']=_0x14cc5e['body'][_0x17cc('0x79')];_0xff8541['body']['body']=_0x14cc5e[_0x17cc('0x59')]['body'];_0xff8541[_0x17cc('0x59')][_0x17cc('0x7c')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x81')];break;case _0x17cc('0x82'):_0xff8541[_0x17cc('0x59')][_0x17cc('0x79')]=_0x14cc5e['body'][_0x17cc('0x7a')];_0xff8541[_0x17cc('0x59')]['body']=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x83')];_0xff8541[_0x17cc('0x59')]['messageId']=_0x14cc5e[_0x17cc('0x59')]['MessageUUID'];break;case _0x17cc('0x84'):_0xff8541[_0x17cc('0x59')][_0x17cc('0x79')]='+'+_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x85')][0x0][_0x17cc('0x79')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x85')][0x0]['text'];_0xff8541[_0x17cc('0x59')][_0x17cc('0x7c')]=_0x14cc5e['body'][_0x17cc('0x85')][0x0][_0x17cc('0x7c')];break;case _0x17cc('0x86'):_0xff8541['body']['from']=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x87')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x88')]['message'];break;case'clickatell':_0xff8541['body'][_0x17cc('0x79')]=_0x14cc5e['body'][_0x17cc('0x89')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')]=_0x14cc5e['body'][_0x17cc('0x7f')];_0xff8541['body']['messageId']=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x8a')];break;case _0x17cc('0x8b'):_0xff8541[_0x17cc('0x59')]['messageId']=_0x14cc5e[_0x17cc('0x59')][0x0]['message']['id'];_0xff8541[_0x17cc('0x59')]['from']=_0x14cc5e[_0x17cc('0x59')][0x0][_0x17cc('0x24')][_0x17cc('0x79')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')]=_0x14cc5e['body'][0x0][_0x17cc('0x24')]['text'];break;case _0x17cc('0x8c'):_0xff8541[_0x17cc('0x59')][_0x17cc('0x79')]=_0x14cc5e[_0x17cc('0x59')][_0x17cc('0x79')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')]=_0x14cc5e['body'][_0x17cc('0x24')];_0xff8541[_0x17cc('0x59')][_0x17cc('0x7c')]=_0x14cc5e['body']['refid'];break;}}if(_0xff8541['body']['id']){delete _0xff8541[_0x17cc('0x59')]['id'];}if(_[_0x17cc('0x8d')](_0xff8541['body'][_0x17cc('0x79')])){throw new db[(_0x17cc('0x8e'))][(_0x17cc('0x71'))](_0x17cc('0x8f'));}if(_[_0x17cc('0x8d')](_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')])||_0xff8541['body']['body']===''){throw new db[(_0x17cc('0x8e'))][(_0x17cc('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x17cc('0x8d')](_0xff8541[_0x17cc('0x59')][_0x17cc('0x90')])){throw new db[(_0x17cc('0x8e'))][(_0x17cc('0x71'))](_0x17cc('0x91')+_0x4484d8);}if(!_[_0x17cc('0x92')](_0x4484d8,_0xff8541[_0x17cc('0x59')][_0x17cc('0x90')])){throw new db[(_0x17cc('0x8e'))][(_0x17cc('0x71'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4484d8);}_0x486af5[_0xff8541[_0x17cc('0x59')][_0x17cc('0x90')]]=_0xff8541[_0x17cc('0x59')]['from'];return db[_0x17cc('0x93')]['find']({'where':{'id':_0xff8541[_0x17cc('0x6f')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x17cc('0x94'),'where':_0x486af5,'limit':0x1,'order':[['updatedAt',_0x17cc('0x95')]]}]});})[_0x17cc('0x1d')](handleEntityNotFound(_0x5eb3f7,null))['then'](function(_0x3ab567){if(_0x3ab567){_0xff8541[_0x17cc('0x96')]=_[_0x17cc('0x97')](_0x3ab567,[_0x17cc('0x94')]);if(_0x3ab567['Contacts'][_0x17cc('0x43')]){return _0x3ab567[_0x17cc('0x94')][0x0];}var _0x697be2=_['defaults'](_0xff8541[_0x17cc('0x59')],{'firstName':_0xff8541['body'][_0x17cc('0x79')],'ListId':_0x3ab567['id']});_0x697be2[_0xff8541[_0x17cc('0x59')][_0x17cc('0x90')]]=_0xff8541[_0x17cc('0x59')]['from'];return db[_0x17cc('0x70')]['create'](_0x697be2,{'fields':_0x25ab1e,'raw':!![]});}})[_0x17cc('0x1d')](handleEntityNotFound(_0x5eb3f7,null))[_0x17cc('0x1d')](function(_0x29c012){if(_0x29c012){_0xff8541['contact']=_0x29c012;var _0x375d1c={'ContactId':_0x29c012['id'],'phone':_0xff8541[_0x17cc('0x59')]['from'],'SmsAccountId':_0x14cc5e[_0x17cc('0x5a')]['id']};var _0x177fb7={'ContactId':_0x29c012['id'],'SmsAccountId':_0x14cc5e[_0x17cc('0x5a')]['id'],'closed':![]};return db[_0x17cc('0x98')][_0x17cc('0x51')]({'where':_0x177fb7})[_0x17cc('0x1d')](function(_0x12badc){if(_0x12badc){return[_0x12badc,![]];}return db[_0x17cc('0x98')][_0x17cc('0x52')](_0x375d1c)['then'](function(_0x402e2f){return[_0x402e2f,!![]];});});}})['spread'](function(_0x797b67,_0x259d1e){_0xff8541['interaction']=_0x797b67['get']({'plain':!![]});_0xff8541[_0x17cc('0x99')][_0x17cc('0x9a')]=![];if(_0x259d1e){if(_0xff8541[_0x17cc('0x6f')][_0x17cc('0x9b')]){_0xff8541[_0x17cc('0x6a')][_0x17cc('0x9c')]({'id':0x0,'priority':_0xff8541[_0x17cc('0x6a')][_0x17cc('0x43')]+0x1,'app':_0x17cc('0x9d'),'appdata':_0x17cc('0x9e'),'interval':_0x17cc('0x9f')});}_0xff8541[_0x17cc('0x99')][_0x17cc('0x9a')]=!![];}return db[_0x17cc('0xa0')]['create']({'phone':_0xff8541[_0x17cc('0x59')]['from'],'messageId':_0xff8541[_0x17cc('0x59')][_0x17cc('0x7c')],'body':_0xff8541[_0x17cc('0x59')][_0x17cc('0x59')],'SmsAccountId':_0x14cc5e['params']['id'],'SmsInteractionId':_0x797b67['id'],'direction':'in','ContactId':_0x797b67[_0x17cc('0xa1')],'AttachmentId':_0xff8541[_0x17cc('0x59')][_0x17cc('0xa2')]});})[_0x17cc('0x1d')](function(_0x1f5b00){_0xff8541[_0x17cc('0x24')]=_0x1f5b00;if(!_0xff8541['interaction'][_0x17cc('0xa3')])return;return db[_0x17cc('0xa4')][_0x17cc('0x51')]({'attributes':['id','name'],'where':{'id':_0xff8541[_0x17cc('0x99')]['UserId']}});})[_0x17cc('0x1d')](function(_0x284986){if(_0x284986){_0xff8541[_0x17cc('0x6a')][_0x17cc('0xa5')]({'id':0x0,'priority':0x0,'app':_0x17cc('0xa6'),'appdata':_0x284986[_0x17cc('0x34')]+','+(_0xff8541[_0x17cc('0x6f')][_0x17cc('0xa7')]||0xa),'interval':'*,*,*,*'});}if(!_0xff8541[_0x17cc('0x99')]['queueId'])return;return db['SmsQueue'][_0x17cc('0x51')]({'attributes':['id',_0x17cc('0x34')],'where':{'id':_0xff8541['interaction'][_0x17cc('0xa8')]}});})[_0x17cc('0x1d')](function(_0x55ee6b){if(_0x55ee6b){_0xff8541['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x17cc('0xa9'),'appdata':_0x55ee6b[_0x17cc('0x34')]+','+(_0xff8541['account'][_0x17cc('0xaa')]||0x12c),'interval':_0x17cc('0x9f')});}return respondWithRpcPromise(_0x17cc('0xab'),_0x17cc('0xac'),_0xff8541);})[_0x17cc('0x1d')](function(_0x4603e1){if(_0x4603e1){var _0x12cffb=0xc8;var _0x2607ad='receiveMessage';logger[_0x17cc('0x1e')](_0x17cc('0x20'),_0x2607ad,_0x12cffb,_0x17cc('0xad'));logger[_0x17cc('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2607ad,_0x12cffb,_0x17cc('0xad'),JSON['stringify'](_0x4603e1));if(_0xff8541[_0x17cc('0x6f')][_0x17cc('0x49')]===_0x17cc('0xaf')){return _0x5eb3f7['status'](_0x12cffb)[_0x17cc('0xb0')]('Content-Type',_0x17cc('0xb1'))[_0x17cc('0xb2')]('\x0a');}else{return _0x5eb3f7[_0x17cc('0x28')](_0x12cffb)[_0x17cc('0xb3')](_0x4603e1);}}})[_0x17cc('0x26')](handleError(_0x5eb3f7,null));};exports[_0x17cc('0xb4')]=function(_0x1d137d,_0x36d639){var _0x2463cb=_0x1d137d['params']['id'];var _0xe70783=_0x1d137d[_0x17cc('0x59')];var _0xdeb1f0=0xc8;var _0x3f51a2=null;return db[_0x17cc('0xb5')]['transaction']({'isolationLevel':db[_0x17cc('0xb5')][_0x17cc('0xb6')][_0x17cc('0xb7')][_0x17cc('0xb8')]},function(_0xcd6bcd){return db[_0x17cc('0x39')]['findOne']({'where':{'id':_0x2463cb},'transaction':_0xcd6bcd})[_0x17cc('0x1d')](function(_0x924201){if(_0x924201){return db['SmsApplication'][_0x17cc('0x5b')]({'where':{'SmsAccountId':_0x2463cb},'transaction':_0xcd6bcd})[_0x17cc('0x1d')](function(){var _0x550043=_['map'](_0xe70783,function(_0x25a44a){_0x25a44a[_0x17cc('0x63')]=_0x2463cb;return _0x25a44a;});return db['SmsApplication'][_0x17cc('0xb9')](_0x550043,{'transaction':_0xcd6bcd});});}else{_0xdeb1f0=0x194;_0x3f51a2=[];}});})[_0x17cc('0x1d')](function(){if(_0xdeb1f0!==0x194){return db['SmsApplication'][_0x17cc('0xba')]({'where':{'SmsAccountId':_0x2463cb},'order':'priority'})[_0x17cc('0x1d')](function(_0x31462c){_0x3f51a2=_0x31462c;});}})['catch'](function(_0x4e09b9){_0xdeb1f0=0x1f4;logger[_0x17cc('0x22')](_0x4e09b9[_0x17cc('0x33')]);if(_0x4e09b9[_0x17cc('0x34')]){delete _0x4e09b9[_0x17cc('0x34')];}_0x3f51a2=_0x4e09b9;})[_0x17cc('0xbb')](function(){if(_0x3f51a2===null){_0x36d639[_0x17cc('0x27')](_0xdeb1f0);}else{if(_0xdeb1f0===0x1f4){_0x36d639['status'](_0xdeb1f0)[_0x17cc('0xb2')](_0x3f51a2);}else{_0x36d639['status'](_0xdeb1f0)['json'](_0x3f51a2);}}});};exports[_0x17cc('0xbc')]=function(_0x536243,_0x2aa8be,_0x57448c){var _0x43d36d={};var _0x268ea5={};var _0x27bf17;var _0x429fce;return db[_0x17cc('0x39')][_0x17cc('0x60')]({'where':{'id':_0x536243[_0x17cc('0x5a')]['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x2aa8be,null))[_0x17cc('0x1d')](function(_0x541e91){if(_0x541e91){_0x27bf17=_0x541e91;_0x268ea5['model']=_[_0x17cc('0x3e')](db['SmsApplication'][_0x17cc('0x3a')]);_0x268ea5[_0x17cc('0x3d')]=_[_0x17cc('0x3e')](_0x536243[_0x17cc('0x3d')]);_0x268ea5[_0x17cc('0x3f')]=_[_0x17cc('0x40')](_0x268ea5['model'],_0x268ea5[_0x17cc('0x3d')]);_0x43d36d[_0x17cc('0x41')]=_[_0x17cc('0x40')](_0x268ea5[_0x17cc('0x3c')],qs['fields'](_0x536243['query']['fields']));_0x43d36d[_0x17cc('0x41')]=_0x43d36d[_0x17cc('0x41')][_0x17cc('0x43')]?_0x43d36d[_0x17cc('0x41')]:_0x268ea5['model'];_0x43d36d['order']=qs[_0x17cc('0x46')](_0x536243[_0x17cc('0x3d')][_0x17cc('0x46')]);_0x43d36d[_0x17cc('0x47')]=qs[_0x17cc('0x3f')](_[_0x17cc('0x62')](_0x536243[_0x17cc('0x3d')],_0x268ea5[_0x17cc('0x3f')]));if(_0x536243['query'][_0x17cc('0x4a')]){_0x43d36d[_0x17cc('0x47')]=_[_0x17cc('0x48')](_0x43d36d[_0x17cc('0x47')],{'$or':_[_0x17cc('0x38')](_0x43d36d[_0x17cc('0x41')],function(_0x3cadc9){var _0x184cb1={};_0x184cb1[_0x3cadc9]={'$like':'%'+_0x536243[_0x17cc('0x3d')]['filter']+'%'};return _0x184cb1;})});}_0x43d36d=_[_0x17cc('0x48')]({},_0x43d36d,_0x536243['options']);return _0x27bf17[_0x17cc('0xbc')](_0x43d36d);}})['then'](function(_0xc5c2f4){if(_0xc5c2f4){_0x429fce=_0xc5c2f4[_0x17cc('0x43')];if(!_0x536243[_0x17cc('0x3d')][_0x17cc('0x44')](_0x17cc('0x61'))){_0x43d36d['limit']=qs[_0x17cc('0x2b')](_0x536243[_0x17cc('0x3d')][_0x17cc('0x2b')]);_0x43d36d[_0x17cc('0x2a')]=qs['offset'](_0x536243[_0x17cc('0x3d')][_0x17cc('0x2a')]);}return _0x27bf17[_0x17cc('0xbc')](_0x43d36d);}})[_0x17cc('0x1d')](function(_0x2d043a){if(_0x2d043a){return _0x2d043a?{'count':_0x429fce,'rows':_0x2d043a}:null;}})['then'](respondWithResult(_0x2aa8be,null))['catch'](handleError(_0x2aa8be,null));};exports[_0x17cc('0xbd')]=function(_0x209d18,_0x267514,_0x4d94b9){var _0x1420c4={'raw':![],'where':{}};var _0x5a13fe={};var _0x1c8c58={'count':0x0,'rows':[]};return db[_0x17cc('0x39')][_0x17cc('0x60')]({'where':{'id':_0x209d18[_0x17cc('0x5a')]['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x267514,null))[_0x17cc('0x1d')](function(_0xc79289){if(_0xc79289){_0x5a13fe[_0x17cc('0x3c')]=_[_0x17cc('0x3e')](db[_0x17cc('0x98')][_0x17cc('0x3a')]);_0x5a13fe[_0x17cc('0x3d')]=_[_0x17cc('0x3e')](_0x209d18[_0x17cc('0x3d')]);_0x5a13fe[_0x17cc('0x3f')]=_['intersection'](_0x5a13fe['model'],_0x5a13fe['query']);_0x1420c4[_0x17cc('0x41')]=_[_0x17cc('0x40')](_0x5a13fe[_0x17cc('0x3c')],qs[_0x17cc('0x42')](_0x209d18[_0x17cc('0x3d')][_0x17cc('0x42')]));_0x1420c4[_0x17cc('0x41')]=_0x1420c4[_0x17cc('0x41')][_0x17cc('0x43')]?_0x1420c4['attributes']:_0x5a13fe[_0x17cc('0x3c')];if(!_0x209d18[_0x17cc('0x3d')][_0x17cc('0x44')](_0x17cc('0x61'))){_0x1420c4[_0x17cc('0x2b')]=qs[_0x17cc('0x2b')](_0x209d18[_0x17cc('0x3d')][_0x17cc('0x2b')]);_0x1420c4[_0x17cc('0x2a')]=qs['offset'](_0x209d18['query'][_0x17cc('0x2a')]);}_0x1420c4['order']=qs['sort'](_0x209d18[_0x17cc('0x3d')]['sort']);_0x1420c4[_0x17cc('0x47')]=qs[_0x17cc('0x3f')](_['pick'](_0x209d18['query'],_0x5a13fe[_0x17cc('0x3f')]));_0x1420c4[_0x17cc('0x47')]['SmsAccountId']=_0xc79289['id'];if(_0x209d18['query'][_0x17cc('0x4a')]){_0x1420c4['where']=_[_0x17cc('0x48')](_0x1420c4['where'],{'$or':_[_0x17cc('0x38')](_0x1420c4[_0x17cc('0x41')],function(_0x18c316){var _0x3ca349={};_0x3ca349[_0x18c316]={'$like':'%'+_0x209d18[_0x17cc('0x3d')][_0x17cc('0x4a')]+'%'};return _0x3ca349;})});}_0x1420c4=_[_0x17cc('0x48')]({},_0x1420c4,_0x209d18[_0x17cc('0x4b')]);return db[_0x17cc('0x98')]['count']({'where':_0x1420c4[_0x17cc('0x47')]})[_0x17cc('0x1d')](function(_0x4098e1){_0x1c8c58[_0x17cc('0x2d')]=_0x4098e1;if(_0x209d18[_0x17cc('0x3d')][_0x17cc('0x50')]){_0x1420c4[_0x17cc('0x4c')]=[{'model':db[_0x17cc('0x70')],'as':_0x17cc('0xbe'),'required':![]},{'model':db[_0x17cc('0xa4')],'as':_0x17cc('0xbf'),'attributes':['name',_0x17cc('0xc0'),_0x17cc('0xc1')],'required':![]},{'model':db[_0x17cc('0xc2')],'as':_0x17cc('0xc3'),'attributes':['id',_0x17cc('0x34'),_0x17cc('0xc4')],'where':_0x209d18[_0x17cc('0x3d')][_0x17cc('0xc5')]?{'id':_0x209d18['query'][_0x17cc('0xc5')]}:undefined,'required':_0x209d18[_0x17cc('0x3d')][_0x17cc('0xc5')]?!![]:![]}];}return db[_0x17cc('0x98')][_0x17cc('0x4d')](_0x1420c4);})[_0x17cc('0x1d')](function(_0x27f7b3){_0x1c8c58[_0x17cc('0x4e')]=_0x27f7b3;return _0x1c8c58;});}})[_0x17cc('0x1d')](respondWithFilteredResult(_0x267514,_0x1420c4))['catch'](handleError(_0x267514,null));};exports['send']=function(_0x98178b,_0x30d8d9,_0x9f29ef){var _0x25c21d,_0x1b6624,_0x403ed4;if(_[_0x17cc('0x8d')](_0x98178b['body'][_0x17cc('0x59')])||_0x98178b[_0x17cc('0x59')]['body']===''){throw new db[(_0x17cc('0x8e'))][(_0x17cc('0x71'))](_0x17cc('0xc6'));}if(_['isNil'](_0x98178b[_0x17cc('0x59')]['to'])){throw new db[(_0x17cc('0x8e'))][(_0x17cc('0x71'))](_0x17cc('0xc7'));}_0x25c21d=_0x98178b['body']['to'];return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x98178b[_0x17cc('0x5a')]['id']},'include':[{'model':db[_0x17cc('0x93')],'as':_0x17cc('0xc8'),'include':[{'model':db[_0x17cc('0x70')],'as':'Contacts','where':{'mobile':_0x25c21d},'limit':0x1,'order':[[_0x17cc('0x75'),_0x17cc('0x95')]]}]}]})[_0x17cc('0x1d')](handleEntityNotFound(_0x30d8d9,null))[_0x17cc('0x1d')](function(_0x4c7c11){if(_0x4c7c11&&_0x4c7c11['List']){_0x1b6624=_0x4c7c11['get']({'plain':!![]});if(_0x1b6624['List']&&_0x1b6624[_0x17cc('0xc8')][_0x17cc('0x94')][_0x17cc('0x43')]){return _0x1b6624['List'][_0x17cc('0x94')][0x0];}return db[_0x17cc('0x70')]['create'](_['defaults'](_0x98178b[_0x17cc('0x59')],{'firstName':_0x25c21d,'mobile':_0x25c21d,'phone':_0x25c21d,'ListId':_0x1b6624[_0x17cc('0x77')]}));}})[_0x17cc('0x1d')](handleEntityNotFound(_0x30d8d9,null))[_0x17cc('0x1d')](function(_0x19cf3f){if(_0x19cf3f){_0x403ed4=_0x19cf3f;return db['SmsInteraction'][_0x17cc('0x51')]({'where':{'ContactId':_0x403ed4['id'],'closed':![],'SmsAccountId':_0x1b6624['id']}})[_0x17cc('0x1d')](function(_0x213f18){if(_0x213f18){return[_0x213f18,![]];}return db[_0x17cc('0x98')][_0x17cc('0x52')]({'UserId':_0x98178b[_0x17cc('0x53')]['id'],'ContactId':_0x403ed4['id'],'SmsAccountId':_0x1b6624['id'],'phone':_0x25c21d,'firstMsgDirection':'out','Messages':[_[_0x17cc('0x48')](_0x98178b['body'],{'read':![],'body':_0x98178b[_0x17cc('0x59')][_0x17cc('0x59')],'phone':_0x25c21d,'SmsAccountId':_0x1b6624['id'],'UserId':_0x98178b['user']['id'],'ContactId':_0x403ed4['id']})]},{'include':[{'model':db[_0x17cc('0xa0')],'as':_0x17cc('0xc9')}]})[_0x17cc('0x1d')](function(_0x46963d){return[_0x46963d,!![]];});});}})['spread'](function(_0x47910f,_0xa4ce1c){if(_0xa4ce1c){return _0x47910f;}return db[_0x17cc('0xa0')]['create'](_[_0x17cc('0x48')](_0x98178b['body'],{'read':![],'body':_0x98178b[_0x17cc('0x59')][_0x17cc('0x59')],'phone':_0x25c21d,'SmsAccountId':_0x1b6624['id'],'SmsInteractionId':_0x47910f['id'],'UserId':_0x98178b[_0x17cc('0x53')]['id'],'ContactId':_0x403ed4['id']}))['then'](function(_0x34192c){_0x47910f[_0x17cc('0xca')][_0x17cc('0xc9')]=[];_0x47910f[_0x17cc('0xca')][_0x17cc('0xc9')][_0x17cc('0x9c')](_0x34192c['dataValues']);return _0x47910f;});})[_0x17cc('0x1d')](respondWithResult(_0x30d8d9,null))['catch'](handleError(_0x30d8d9,null));};exports[_0x17cc('0x28')]=function(_0x10a3a2,_0x2589b3,_0xb1c892){if(_0x10a3a2[_0x17cc('0x59')]['id']){delete _0x10a3a2[_0x17cc('0x59')]['id'];}var _0x8fe665,_0x33e71c,_0x5bfea9;return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x10a3a2['params']['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x2589b3,null))['then'](function(_0x36e521){if(_0x36e521){_0x5bfea9=_0x36e521;logger[_0x17cc('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x17cc('0x28'),_0x17cc('0xcb'),_0x36e521[_0x17cc('0x49')],util['inspect'](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));switch(_0x36e521[_0x17cc('0x49')]){case _0x17cc('0xcc'):if(_0x10a3a2['body'][_0x17cc('0xcd')]&&_0x10a3a2[_0x17cc('0x59')][_0x17cc('0x28')]){_0x33e71c=_0x10a3a2[_0x17cc('0x59')]['status'];return db[_0x17cc('0xa0')][_0x17cc('0x51')]({'where':{'messageId':_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xcd')]}});}break;case _0x17cc('0x80'):if(_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xce')]&&_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xcf')]){_0x33e71c=_0x10a3a2['body'][_0x17cc('0xcf')];return db['SmsMessage'][_0x17cc('0x51')]({'where':{'messageId':_0x10a3a2[_0x17cc('0x59')]['requestid']}});}break;case _0x17cc('0xd0'):if(_0x10a3a2[_0x17cc('0x59')][_0x17cc('0x81')]&&_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xd1')]){_0x33e71c=_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xd1')];return db[_0x17cc('0xa0')][_0x17cc('0x51')]({'where':{'messageId':_0x10a3a2[_0x17cc('0x59')]['message_id']}});}break;case _0x17cc('0x84'):var _0x312a42=_0x10a3a2['body'][_0x17cc('0x85')][0x0];if(_0x312a42[_0x17cc('0x7c')]&&_0x312a42[_0x17cc('0x28')][_0x17cc('0xd2')]===_0x17cc('0xd3')){_0x33e71c=_0x312a42[_0x17cc('0x28')]['groupName'];return db['SmsMessage'][_0x17cc('0x51')]({'where':{'messageId':_0x312a42['messageId']}});}break;case _0x17cc('0xd4'):if(_0x10a3a2[_0x17cc('0x59')]['messageId']&&_0x10a3a2['body'][_0x17cc('0x28')]){_0x33e71c=_0x10a3a2[_0x17cc('0x59')][_0x17cc('0x28')];return db['SmsMessage'][_0x17cc('0x51')]({'where':{'messageId':_0x10a3a2[_0x17cc('0x59')][_0x17cc('0x7c')]}});}break;case _0x17cc('0x8b'):if(_0x10a3a2[_0x17cc('0x59')][0x0][_0x17cc('0x24')]['id']){_0x33e71c=_0x10a3a2[_0x17cc('0x59')][0x0][_0x17cc('0x49')];return db['SmsMessage'][_0x17cc('0x51')]({'where':{'messageId':_0x10a3a2[_0x17cc('0x59')][0x0][_0x17cc('0x24')]['id']}});}break;case _0x17cc('0x8c'):if(_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xd5')]&&_0x10a3a2[_0x17cc('0x59')]['status']){_0x33e71c=_0x10a3a2['body'][_0x17cc('0x28')];return db[_0x17cc('0xa0')]['find']({'where':{'messageId':_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x2589b3,null))[_0x17cc('0x1d')](function(_0x2f7ad4){if(_0x2f7ad4){_0x8fe665=_0x2f7ad4;switch(_0x5bfea9['type']){case _0x17cc('0xcc'):if(_0x33e71c===_0x17cc('0xd3')){return _0x8fe665[_0x17cc('0x30')]({'read':!![]});}else{logger[_0x17cc('0x22')](_0x17cc('0x20'),_0x17cc('0x28'),_0x17cc('0xcc'),util['inspect'](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));}break;case _0x17cc('0x80'):if(_0x33e71c==='1'){return _0x8fe665['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x17cc('0x28'),'skebby',util[_0x17cc('0xd6')](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));}break;case _0x17cc('0xd0'):if(!_0x10a3a2[_0x17cc('0x59')][_0x17cc('0xd7')]&&_0x33e71c>=0xc8&&_0x33e71c<=0xce){return _0x8fe665[_0x17cc('0x30')]({'read':!![]});}else{logger['error'](_0x17cc('0x20'),'status',_0x17cc('0xd0'),util['inspect'](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));}break;case _0x17cc('0x84'):var _0x4cc83d=_0x10a3a2['body'][_0x17cc('0x85')][0x0];if(_0x4cc83d[_0x17cc('0x28')][_0x17cc('0xd2')]===_0x17cc('0xd3')){return _0x8fe665[_0x17cc('0x30')]({'read':!![]});}else{logger[_0x17cc('0x22')](_0x17cc('0x20'),_0x17cc('0x28'),_0x17cc('0x84'),util['inspect'](_0x10a3a2['body'],{'showHidden':![],'depth':null}));}break;case _0x17cc('0xd4'):if(_0x33e71c==_0x17cc('0xd8')||_0x33e71c==_0x17cc('0xd9')){return _0x8fe665['update']({'read':!![]});}else{logger[_0x17cc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x17cc('0x28'),'clickatell',util[_0x17cc('0xd6')](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x33e71c==_0x17cc('0xda')){return _0x8fe665[_0x17cc('0x30')]({'read':!![]});}else{logger[_0x17cc('0x22')](_0x17cc('0x20'),_0x17cc('0x28'),'bandwidth',util[_0x17cc('0xd6')](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));}break;case _0x17cc('0x8c'):if(_0x33e71c===_0x17cc('0xdb')||_0x33e71c===_0x17cc('0xdc')){return _0x8fe665[_0x17cc('0x30')]({'read':!![]});}else{logger[_0x17cc('0x22')](_0x17cc('0x20'),'status',_0x17cc('0x8c'),util[_0x17cc('0xd6')](_0x10a3a2[_0x17cc('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x8fe665;}})[_0x17cc('0x1d')](respondWithResult(_0x2589b3,null))[_0x17cc('0x26')](handleError(_0x2589b3,null));};exports[_0x17cc('0xdd')]=function(_0x48a146,_0x1669be,_0x1219da){var _0x5e0c24,_0x3b44e5,_0x7f86d3;return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x48a146[_0x17cc('0x5a')]['id']}})[_0x17cc('0x1d')](handleEntityNotFound(_0x1669be,null))[_0x17cc('0x1d')](function(_0x434b79){if(_0x434b79){_0x7f86d3=_0x434b79;logger[_0x17cc('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x17cc('0x28'),_0x17cc('0xcb'),_0x434b79[_0x17cc('0x49')],util[_0x17cc('0xd6')](_0x48a146[_0x17cc('0x3d')],{'showHidden':![],'depth':null}));switch(_0x434b79['type']){case _0x17cc('0x86'):if(_0x48a146[_0x17cc('0x3d')][_0x17cc('0xde')]&&_0x48a146[_0x17cc('0x3d')]['state']){_0x3b44e5=_0x48a146[_0x17cc('0x3d')][_0x17cc('0xdf')];return db[_0x17cc('0xa0')]['find']({'where':{'messageId':_0x48a146['query'][_0x17cc('0xde')]}});}break;}}})[_0x17cc('0x1d')](handleEntityNotFound(_0x1669be,null))[_0x17cc('0x1d')](function(_0x5c6df8){if(_0x5c6df8){_0x5e0c24=_0x5c6df8;switch(_0x7f86d3[_0x17cc('0x49')]){case'csc':if(_0x3b44e5==='2'||_0x3b44e5==='6'){return _0x5e0c24[_0x17cc('0x30')]({'read':!![]});}else{logger[_0x17cc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util[_0x17cc('0xd6')](_0x48a146[_0x17cc('0x3d')],{'showHidden':![],'depth':null}));};break;}return _0x5e0c24;}})[_0x17cc('0x1d')](respondWithResult(_0x1669be,null))[_0x17cc('0x26')](handleError(_0x1669be,null));};exports[_0x17cc('0xe0')]=function(_0x3b3ff7,_0x3b0f95,_0xbb427b){return db[_0x17cc('0x39')][_0x17cc('0x51')]({'where':{'id':_0x3b3ff7['params']['id']}})['then'](handleEntityNotFound(_0x3b0f95,null))[_0x17cc('0x1d')](function(_0x341ccf){if(_0x341ccf){return _0x341ccf['addAgents'](_0x3b3ff7['body']['ids'],_[_0x17cc('0x97')](_0x3b3ff7['body'],[_0x17cc('0x65'),'id'])||{})[_0x17cc('0xe1')](function(_0x1bca49){for(var _0x1b9878=0x0;_0x1b9878<_0x3b3ff7[_0x17cc('0x59')][_0x17cc('0x65')][_0x17cc('0x43')];_0x1b9878+=0x1){socket[_0x17cc('0xe2')](_0x17cc('0xe3'),{'UserId':Number(_0x3b3ff7[_0x17cc('0x59')]['ids'][_0x1b9878]),'SmsAccountId':Number(_0x3b3ff7['params']['id'])});}return _0x1bca49;});}})['then'](respondWithResult(_0x3b0f95,null))[_0x17cc('0x26')](handleError(_0x3b0f95,null));};exports['removeAgents']=function(_0x3137d4,_0x125c9e,_0x5375a6){return db[_0x17cc('0x39')]['find']({'where':{'id':_0x3137d4['params']['id']}})['then'](handleEntityNotFound(_0x125c9e,null))[_0x17cc('0x1d')](function(_0x561269){if(_0x561269){return _0x561269[_0x17cc('0xe4')](_0x3137d4[_0x17cc('0x3d')][_0x17cc('0x65')])[_0x17cc('0x1d')](function(){if(_[_0x17cc('0xe5')](_0x3137d4[_0x17cc('0x3d')][_0x17cc('0x65')])){for(var _0x31a755=0x0;_0x31a755<_0x3137d4['query'][_0x17cc('0x65')][_0x17cc('0x43')];_0x31a755+=0x1){socket[_0x17cc('0xe2')](_0x17cc('0xe6'),{'UserId':Number(_0x3137d4[_0x17cc('0x3d')][_0x17cc('0x65')][_0x31a755]),'SmsAccountId':Number(_0x3137d4[_0x17cc('0x5a')]['id'])});}}else{socket[_0x17cc('0xe2')](_0x17cc('0xe6'),{'UserId':Number(_0x3137d4['query'][_0x17cc('0x65')]),'SmsAccountId':Number(_0x3137d4[_0x17cc('0x5a')]['id'])});}});}})[_0x17cc('0x1d')](respondWithStatusCode(_0x125c9e,null))[_0x17cc('0x26')](handleError(_0x125c9e,null));};exports[_0x17cc('0xe7')]=function(_0x58526a,_0x296600,_0x55af31){var _0x2c44a2={};var _0x4f8e58={};var _0xa50174;var _0x44f88c;return db[_0x17cc('0x39')][_0x17cc('0x60')]({'where':{'id':_0x58526a[_0x17cc('0x5a')]['id']}})['then'](handleEntityNotFound(_0x296600,null))[_0x17cc('0x1d')](function(_0x5626d2){if(_0x5626d2){_0xa50174=_0x5626d2;_0x4f8e58[_0x17cc('0x3c')]=_[_0x17cc('0x3e')](db['User'][_0x17cc('0x3a')]);_0x4f8e58['query']=_[_0x17cc('0x3e')](_0x58526a[_0x17cc('0x3d')]);_0x4f8e58[_0x17cc('0x3f')]=_[_0x17cc('0x40')](_0x4f8e58[_0x17cc('0x3c')],_0x4f8e58[_0x17cc('0x3d')]);_0x2c44a2[_0x17cc('0x41')]=_['intersection'](_0x4f8e58[_0x17cc('0x3c')],qs[_0x17cc('0x42')](_0x58526a['query'][_0x17cc('0x42')]));_0x2c44a2[_0x17cc('0x41')]=_0x2c44a2['attributes'][_0x17cc('0x43')]?_0x2c44a2['attributes']:_0x4f8e58['model'];_0x2c44a2[_0x17cc('0x45')]=qs['sort'](_0x58526a['query']['sort']);_0x2c44a2[_0x17cc('0x47')]=qs[_0x17cc('0x3f')](_[_0x17cc('0x62')](_0x58526a[_0x17cc('0x3d')],_0x4f8e58[_0x17cc('0x3f')]));if(_0x58526a[_0x17cc('0x3d')][_0x17cc('0x4a')]){_0x2c44a2[_0x17cc('0x47')]=_[_0x17cc('0x48')](_0x2c44a2[_0x17cc('0x47')],{'$or':_[_0x17cc('0x38')](_0x2c44a2[_0x17cc('0x41')],function(_0x3bcc1c){var _0x4675d8={};_0x4675d8[_0x3bcc1c]={'$like':'%'+_0x58526a[_0x17cc('0x3d')]['filter']+'%'};return _0x4675d8;})});}_0x2c44a2=_['merge']({},_0x2c44a2,_0x58526a[_0x17cc('0x4b')]);return _0xa50174['getAgents'](_0x2c44a2);}})[_0x17cc('0x1d')](function(_0x483625){if(_0x483625){_0x44f88c=_0x483625[_0x17cc('0x43')];if(!_0x58526a[_0x17cc('0x3d')]['hasOwnProperty'](_0x17cc('0x61'))){_0x2c44a2[_0x17cc('0x2b')]=qs[_0x17cc('0x2b')](_0x58526a[_0x17cc('0x3d')][_0x17cc('0x2b')]);_0x2c44a2[_0x17cc('0x2a')]=qs['offset'](_0x58526a[_0x17cc('0x3d')][_0x17cc('0x2a')]);}return _0xa50174[_0x17cc('0xe7')](_0x2c44a2);}})[_0x17cc('0x1d')](function(_0x2f009f){if(_0x2f009f){return _0x2f009f?{'count':_0x44f88c,'rows':_0x2f009f}:null;}})['then'](respondWithResult(_0x296600,null))[_0x17cc('0x26')](handleError(_0x296600,null));}; \ No newline at end of file +var _0xdb11=['DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','register','jayson/promise','http','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','offset','undefined','count','Content-Range','json','save','update','then','destroy','get','SmsAccounts','end','stack','name','index','SmsAccount','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','where','filters','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','mandatoryDispositionPause','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Pause','describe','addDisposition','SmsAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','pick','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','Body','MessageSid','skebby','from','sender','text','messageId','message_id','plivo','From','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','getApplications','options','getInteractions','Contact','Owner','fullname','Tag','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','inspect','skebby_dispatch_id','connectel','statusInt','requestid','clicksend','status_code'];(function(_0x5a9055,_0x48668d){var _0x24a9ae=function(_0x9c8b6c){while(--_0x9c8b6c){_0x5a9055['push'](_0x5a9055['shift']());}};_0x24a9ae(++_0x48668d);}(_0xdb11,0x1f1));var _0x1db1=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xdb11[_0x18abd2];return _0x1dcad6;};'use strict';var emlformat=require(_0x1db1('0x0'));var rimraf=require(_0x1db1('0x1'));var zipdir=require(_0x1db1('0x2'));var jsonpatch=require(_0x1db1('0x3'));var rp=require(_0x1db1('0x4'));var moment=require('moment');var BPromise=require(_0x1db1('0x5'));var Mustache=require(_0x1db1('0x6'));var util=require('util');var path=require(_0x1db1('0x7'));var sox=require(_0x1db1('0x8'));var csv=require(_0x1db1('0x9'));var ejs=require(_0x1db1('0xa'));var fs=require('fs');var fs_extra=require(_0x1db1('0xb'));var _=require(_0x1db1('0xc'));var squel=require(_0x1db1('0xd'));var crypto=require(_0x1db1('0xe'));var jsforce=require(_0x1db1('0xf'));var deskjs=require(_0x1db1('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1db1('0x11'));var Papa=require(_0x1db1('0x12'));var Redis=require(_0x1db1('0x13'));var authService=require(_0x1db1('0x14'));var qs=require(_0x1db1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1db1('0x16'))(_0x1db1('0x17'));var utils=require(_0x1db1('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1db1('0x19'));var db=require(_0x1db1('0x1a'))['db'];config[_0x1db1('0x1b')]=_[_0x1db1('0x1c')](config[_0x1db1('0x1b')],{'host':_0x1db1('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1db1('0x1e'))[_0x1db1('0x1f')](socket);var jayson=require(_0x1db1('0x20'));var client=jayson['client'][_0x1db1('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x4456a5,_0x3293b7,_0x2f6894,_0x450afb){return new BPromise(function(_0x2b43dc,_0x171739){var _0x2a0894=_0x450afb||client;return _0x2a0894[_0x1db1('0x22')](_0x4456a5,_0x2f6894)['then'](function(_0x42d7d6){logger['info'](_0x1db1('0x23'),_0x3293b7,_0x1db1('0x24'));logger[_0x1db1('0x25')](_0x1db1('0x26'),_0x3293b7,_0x1db1('0x24'),JSON[_0x1db1('0x27')](_0x42d7d6));if(_0x42d7d6['error']){if(_0x42d7d6[_0x1db1('0x28')][_0x1db1('0x29')]===0x1f4){logger['error'](_0x1db1('0x23'),_0x3293b7,_0x42d7d6[_0x1db1('0x28')][_0x1db1('0x2a')]);return _0x171739(_0x42d7d6[_0x1db1('0x28')][_0x1db1('0x2a')]);}logger[_0x1db1('0x28')](_0x1db1('0x23'),_0x3293b7,_0x42d7d6[_0x1db1('0x28')][_0x1db1('0x2a')]);return _0x2b43dc(_0x42d7d6[_0x1db1('0x28')]['message']);}else{logger[_0x1db1('0x2b')](_0x1db1('0x23'),_0x3293b7,_0x1db1('0x24'));_0x2b43dc(_0x42d7d6[_0x1db1('0x2c')][_0x1db1('0x2a')]);}})[_0x1db1('0x2d')](function(_0x5942b0){logger[_0x1db1('0x28')]('SmsAccount,\x20%s,\x20%s',_0x3293b7,_0x5942b0);_0x171739(_0x5942b0);});});}function respondWithStatusCode(_0x233872,_0x57e128){_0x57e128=_0x57e128||0xcc;return function(_0x1f257b){if(_0x1f257b){return _0x233872[_0x1db1('0x2e')](_0x57e128);}return _0x233872[_0x1db1('0x2f')](_0x57e128)['end']();};}function respondWithResult(_0x1c0fc0,_0x296ef3){_0x296ef3=_0x296ef3||0xc8;return function(_0x378f1){if(_0x378f1){return _0x1c0fc0[_0x1db1('0x2f')](_0x296ef3)['json'](_0x378f1);}};}function respondWithFilteredResult(_0x390434,_0x27002a){return function(_0x507d47){if(_0x507d47){var _0x511b6f=typeof _0x27002a[_0x1db1('0x30')]===_0x1db1('0x31')&&typeof _0x27002a['limit']===_0x1db1('0x31');var _0x5195b0=_0x507d47[_0x1db1('0x32')];var _0x1daaf0=_0x511b6f?0x0:_0x27002a[_0x1db1('0x30')];var _0x31fee6=_0x511b6f?_0x507d47['count']:_0x27002a[_0x1db1('0x30')]+_0x27002a['limit'];var _0x3de064;if(_0x31fee6>=_0x5195b0){_0x31fee6=_0x5195b0;_0x3de064=0xc8;}else{_0x3de064=0xce;}_0x390434['status'](_0x3de064);return _0x390434['set'](_0x1db1('0x33'),_0x1daaf0+'-'+_0x31fee6+'/'+_0x5195b0)[_0x1db1('0x34')](_0x507d47);}return null;};}function patchUpdates(_0x492736){return function(_0xf28c9c){try{jsonpatch['apply'](_0xf28c9c,_0x492736,!![]);}catch(_0x1876d3){return BPromise['reject'](_0x1876d3);}return _0xf28c9c[_0x1db1('0x35')]();};}function saveUpdates(_0x4db244,_0x1153e9){return function(_0x1b9527){if(_0x1b9527){return _0x1b9527[_0x1db1('0x36')](_0x4db244)[_0x1db1('0x37')](function(_0x569c7b){return _0x569c7b;});}return null;};}function removeEntity(_0x499a16,_0x117ab9){return function(_0x42248a){if(_0x42248a){return _0x42248a[_0x1db1('0x38')]()[_0x1db1('0x37')](function(){var _0x5ca601=_0x42248a[_0x1db1('0x39')]({'plain':!![]});var _0x1f93e2=_0x1db1('0x3a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1f93e2,'resourceId':_0x5ca601['id']}})[_0x1db1('0x37')](function(){return _0x42248a;});})[_0x1db1('0x37')](function(){_0x499a16[_0x1db1('0x2f')](0xcc)[_0x1db1('0x3b')]();});}};}function handleEntityNotFound(_0x5cdf82,_0x372143){return function(_0x234337){if(!_0x234337){_0x5cdf82['sendStatus'](0x194);}return _0x234337;};}function handleError(_0x2c8d0c,_0x5262b3){_0x5262b3=_0x5262b3||0x1f4;return function(_0x2312ea){logger['error'](_0x2312ea[_0x1db1('0x3c')]);if(_0x2312ea[_0x1db1('0x3d')]){delete _0x2312ea['name'];}_0x2c8d0c[_0x1db1('0x2f')](_0x5262b3)['send'](_0x2312ea);};}exports[_0x1db1('0x3e')]=function(_0x5490fd,_0x4b450a){var _0x358b84={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4d0afa={},_0x5d1971={'count':0x0,'rows':[]};var _0x5d2e02=_['map'](db[_0x1db1('0x3f')][_0x1db1('0x40')],function(_0x3f3616){return{'name':_0x3f3616[_0x1db1('0x41')],'type':_0x3f3616[_0x1db1('0x42')][_0x1db1('0x43')]};});_0x4d0afa[_0x1db1('0x44')]=_[_0x1db1('0x45')](_0x5d2e02,_0x1db1('0x3d'));_0x4d0afa['query']=_[_0x1db1('0x46')](_0x5490fd[_0x1db1('0x47')]);_0x4d0afa['filters']=_[_0x1db1('0x48')](_0x4d0afa[_0x1db1('0x44')],_0x4d0afa[_0x1db1('0x47')]);_0x358b84['attributes']=_['intersection'](_0x4d0afa[_0x1db1('0x44')],qs[_0x1db1('0x49')](_0x5490fd['query'][_0x1db1('0x49')]));_0x358b84['attributes']=_0x358b84['attributes'][_0x1db1('0x4a')]?_0x358b84[_0x1db1('0x4b')]:_0x4d0afa[_0x1db1('0x44')];if(!_0x5490fd[_0x1db1('0x47')][_0x1db1('0x4c')](_0x1db1('0x4d'))){_0x358b84[_0x1db1('0x4e')]=qs[_0x1db1('0x4e')](_0x5490fd[_0x1db1('0x47')][_0x1db1('0x4e')]);_0x358b84[_0x1db1('0x30')]=qs[_0x1db1('0x30')](_0x5490fd[_0x1db1('0x47')]['offset']);}_0x358b84['order']=qs[_0x1db1('0x4f')](_0x5490fd[_0x1db1('0x47')][_0x1db1('0x4f')]);_0x358b84[_0x1db1('0x50')]=qs[_0x1db1('0x51')](_['pick'](_0x5490fd['query'],_0x4d0afa['filters']),_0x5d2e02);if(_0x5490fd[_0x1db1('0x47')][_0x1db1('0x52')]){_0x358b84[_0x1db1('0x50')]=_['merge'](_0x358b84['where'],{'$or':_[_0x1db1('0x45')](_0x5d2e02,function(_0x3ab183){if(_0x3ab183['type']!==_0x1db1('0x53')){var _0x5cb16e={};_0x5cb16e[_0x3ab183[_0x1db1('0x3d')]]={'$like':'%'+_0x5490fd['query'][_0x1db1('0x52')]+'%'};return _0x5cb16e;}})});}_0x358b84=_[_0x1db1('0x54')]({},_0x358b84,_0x5490fd['options']);var _0x38a969={'where':_0x358b84[_0x1db1('0x50')]};return db['SmsAccount'][_0x1db1('0x32')](_0x38a969)['then'](function(_0x456f2a){_0x5d1971[_0x1db1('0x32')]=_0x456f2a;if(_0x5490fd[_0x1db1('0x47')][_0x1db1('0x55')]){_0x358b84['include']=[{'all':!![]}];}return db[_0x1db1('0x3f')][_0x1db1('0x56')](_0x358b84);})[_0x1db1('0x37')](function(_0x4e3daf){_0x5d1971[_0x1db1('0x57')]=_0x4e3daf;return _0x5d1971;})[_0x1db1('0x37')](respondWithFilteredResult(_0x4b450a,_0x358b84))[_0x1db1('0x2d')](handleError(_0x4b450a,null));};exports[_0x1db1('0x58')]=function(_0x3b8f6c,_0x57a5df){var _0x1935dc={'raw':![],'where':{'id':_0x3b8f6c[_0x1db1('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x1db1('0x5a')}]},_0x39ca63={};_0x39ca63[_0x1db1('0x44')]=_[_0x1db1('0x46')](db['SmsAccount'][_0x1db1('0x40')]);_0x39ca63['query']=_['keys'](_0x3b8f6c[_0x1db1('0x47')]);_0x39ca63[_0x1db1('0x51')]=_[_0x1db1('0x48')](_0x39ca63['model'],_0x39ca63[_0x1db1('0x47')]);_0x1935dc['attributes']=_[_0x1db1('0x48')](_0x39ca63[_0x1db1('0x44')],qs['fields'](_0x3b8f6c['query'][_0x1db1('0x49')]));_0x1935dc[_0x1db1('0x4b')]=_0x1935dc['attributes'][_0x1db1('0x4a')]?_0x1935dc[_0x1db1('0x4b')]:_0x39ca63[_0x1db1('0x44')];if(_0x3b8f6c[_0x1db1('0x47')][_0x1db1('0x55')]){_0x1935dc[_0x1db1('0x5b')]=[{'all':!![]}];}_0x1935dc=_[_0x1db1('0x54')]({},_0x1935dc,_0x3b8f6c['options']);return db[_0x1db1('0x3f')]['find'](_0x1935dc)['then'](handleEntityNotFound(_0x57a5df,null))['then'](respondWithResult(_0x57a5df,null))[_0x1db1('0x2d')](handleError(_0x57a5df,null));};exports[_0x1db1('0x5c')]=function(_0xe94bb7,_0x590b56){return db[_0x1db1('0x3f')]['create'](_0xe94bb7[_0x1db1('0x5d')],{})['then'](function(_0xa54a5){var _0x1c052a=_0xe94bb7[_0x1db1('0x5e')][_0x1db1('0x39')]({'plain':!![]});if(!_0x1c052a)throw new Error(_0x1db1('0x5f'));if(_0x1c052a['role']===_0x1db1('0x5e')){var _0x11cacd=_0xa54a5['get']({'plain':!![]});var _0x51d30b=_0x1db1('0x3a');return db[_0x1db1('0x60')][_0x1db1('0x61')]({'where':{'name':_0x51d30b,'userProfileId':_0x1c052a[_0x1db1('0x62')]},'raw':!![]})[_0x1db1('0x37')](function(_0x4bb24e){if(_0x4bb24e&&_0x4bb24e[_0x1db1('0x63')]===0x0){return db[_0x1db1('0x64')][_0x1db1('0x5c')]({'name':_0x11cacd[_0x1db1('0x3d')],'resourceId':_0x11cacd['id'],'type':_0x4bb24e[_0x1db1('0x3d')],'sectionId':_0x4bb24e['id']},{})[_0x1db1('0x37')](function(){return _0xa54a5;});}else{return _0xa54a5;}})[_0x1db1('0x2d')](function(_0x19286d){logger[_0x1db1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19286d);throw _0x19286d;});}return _0xa54a5;})['then'](respondWithResult(_0x590b56,0xc9))[_0x1db1('0x2d')](handleError(_0x590b56,null));};exports['update']=function(_0x26e005,_0x3fc0e1){if(_0x26e005['body']['id']){delete _0x26e005[_0x1db1('0x5d')]['id'];}return db['SmsAccount'][_0x1db1('0x61')]({'where':{'id':_0x26e005[_0x1db1('0x59')]['id']},'include':[{'model':db[_0x1db1('0x65')],'as':_0x1db1('0x5a')}]})['then'](handleEntityNotFound(_0x3fc0e1,null))[_0x1db1('0x37')](saveUpdates(_0x26e005[_0x1db1('0x5d')],null))['then'](respondWithResult(_0x3fc0e1,null))[_0x1db1('0x2d')](handleError(_0x3fc0e1,null));};exports[_0x1db1('0x38')]=function(_0x4f809f,_0xbc9d59){return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x4f809f[_0x1db1('0x59')]['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0xbc9d59,null))[_0x1db1('0x37')](removeEntity(_0xbc9d59,null))['catch'](handleError(_0xbc9d59,null));};exports[_0x1db1('0x66')]=function(_0x3a4365,_0x58996e){return db[_0x1db1('0x3f')][_0x1db1('0x66')]()[_0x1db1('0x37')](respondWithResult(_0x58996e,null))['catch'](handleError(_0x58996e,null));};exports[_0x1db1('0x67')]=function(_0x275a27,_0xd61626,_0x2c568d){if(_0x275a27[_0x1db1('0x5d')]['id']){delete _0x275a27['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x275a27[_0x1db1('0x59')]['id']}})['then'](handleEntityNotFound(_0xd61626,null))[_0x1db1('0x37')](function(_0x1d4dbb){if(_0x1d4dbb){_0x275a27[_0x1db1('0x5d')][_0x1db1('0x68')]=_0x1d4dbb['id'];return db[_0x1db1('0x69')][_0x1db1('0x5c')](_0x275a27[_0x1db1('0x5d')]);}})[_0x1db1('0x37')](respondWithResult(_0xd61626,null))[_0x1db1('0x2d')](handleError(_0xd61626,null));};exports[_0x1db1('0x6a')]=function(_0x36222d,_0xe2bbcd,_0x4965d8){var _0x2b1586={'raw':![],'where':{}};var _0x136983={};var _0x4ff25e={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x36222d[_0x1db1('0x59')]['id']}})['then'](handleEntityNotFound(_0xe2bbcd,null))[_0x1db1('0x37')](function(_0x2d85af){if(_0x2d85af){_0x136983[_0x1db1('0x44')]=_['keys'](db[_0x1db1('0x69')]['rawAttributes']);_0x136983['query']=_[_0x1db1('0x46')](_0x36222d[_0x1db1('0x47')]);_0x136983[_0x1db1('0x51')]=_[_0x1db1('0x48')](_0x136983[_0x1db1('0x44')],_0x136983[_0x1db1('0x47')]);_0x2b1586[_0x1db1('0x4b')]=_[_0x1db1('0x48')](_0x136983[_0x1db1('0x44')],qs['fields'](_0x36222d['query'][_0x1db1('0x49')]));_0x2b1586[_0x1db1('0x4b')]=_0x2b1586[_0x1db1('0x4b')]['length']?_0x2b1586[_0x1db1('0x4b')]:_0x136983[_0x1db1('0x44')];if(!_0x36222d[_0x1db1('0x47')][_0x1db1('0x4c')](_0x1db1('0x4d'))){_0x2b1586['limit']=qs[_0x1db1('0x4e')](_0x36222d[_0x1db1('0x47')][_0x1db1('0x4e')]);_0x2b1586['offset']=qs[_0x1db1('0x30')](_0x36222d['query'][_0x1db1('0x30')]);}_0x2b1586[_0x1db1('0x6b')]=qs[_0x1db1('0x4f')](_0x36222d[_0x1db1('0x47')][_0x1db1('0x4f')]);_0x2b1586[_0x1db1('0x50')]=qs[_0x1db1('0x51')](_['pick'](_0x36222d['query'],_0x136983['filters']));_0x2b1586['where'][_0x1db1('0x68')]=_0x2d85af['id'];if(_0x36222d[_0x1db1('0x47')][_0x1db1('0x52')]){_0x2b1586[_0x1db1('0x50')]=_[_0x1db1('0x54')](_0x2b1586['where'],{'$or':_[_0x1db1('0x45')](_0x2b1586['attributes'],function(_0x535cc1){var _0x4c01fd={};_0x4c01fd[_0x535cc1]={'$like':'%'+_0x36222d['query'][_0x1db1('0x52')]+'%'};return _0x4c01fd;})});}_0x2b1586=_[_0x1db1('0x54')]({},_0x2b1586,_0x36222d['options']);return db[_0x1db1('0x69')][_0x1db1('0x32')]({'where':_0x2b1586[_0x1db1('0x50')]})[_0x1db1('0x37')](function(_0x2a1b6f){_0x4ff25e[_0x1db1('0x32')]=_0x2a1b6f;if(_0x36222d[_0x1db1('0x47')][_0x1db1('0x55')]){_0x2b1586[_0x1db1('0x5b')]=[{'all':!![]}];}return db[_0x1db1('0x69')]['findAll'](_0x2b1586);})['then'](function(_0x4e7a93){_0x4ff25e[_0x1db1('0x57')]=_0x4e7a93;return _0x4ff25e;});}})[_0x1db1('0x37')](respondWithFilteredResult(_0xe2bbcd,_0x2b1586))['catch'](handleError(_0xe2bbcd,null));};exports[_0x1db1('0x6c')]=function(_0x58581e,_0x543462,_0x3e6632){return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x58581e[_0x1db1('0x59')]['id']}})['then'](handleEntityNotFound(_0x543462,null))[_0x1db1('0x37')](function(_0x2628d2){if(_0x2628d2){return _0x2628d2[_0x1db1('0x6c')](_0x58581e['query'][_0x1db1('0x6d')]);}})[_0x1db1('0x37')](respondWithStatusCode(_0x543462,null))[_0x1db1('0x2d')](handleError(_0x543462,null));};exports[_0x1db1('0x6e')]=function(_0x41f44c,_0x2dfb36,_0x3a6627){if(_0x41f44c[_0x1db1('0x5d')]['id']){delete _0x41f44c['body']['id'];}return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x41f44c[_0x1db1('0x59')]['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x2dfb36,null))[_0x1db1('0x37')](function(_0x226a6c){if(_0x226a6c){_0x41f44c[_0x1db1('0x5d')][_0x1db1('0x68')]=_0x226a6c['id'];return db[_0x1db1('0x6f')][_0x1db1('0x5c')](_0x41f44c['body']);}})[_0x1db1('0x37')](respondWithResult(_0x2dfb36,null))['catch'](handleError(_0x2dfb36,null));};exports[_0x1db1('0x70')]=function(_0x577c70,_0x155b3d,_0x57af6d){var _0x57e1ed={'raw':![],'where':{}};var _0x321b65={};var _0x4db4fc={'count':0x0,'rows':[]};return db[_0x1db1('0x3f')][_0x1db1('0x71')]({'where':{'id':_0x577c70['params']['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x155b3d,null))['then'](function(_0x4678ce){if(_0x4678ce){_0x321b65[_0x1db1('0x44')]=_['keys'](db[_0x1db1('0x6f')][_0x1db1('0x40')]);_0x321b65[_0x1db1('0x47')]=_[_0x1db1('0x46')](_0x577c70[_0x1db1('0x47')]);_0x321b65['filters']=_[_0x1db1('0x48')](_0x321b65[_0x1db1('0x44')],_0x321b65['query']);_0x57e1ed[_0x1db1('0x4b')]=_[_0x1db1('0x48')](_0x321b65['model'],qs[_0x1db1('0x49')](_0x577c70['query'][_0x1db1('0x49')]));_0x57e1ed[_0x1db1('0x4b')]=_0x57e1ed['attributes'][_0x1db1('0x4a')]?_0x57e1ed[_0x1db1('0x4b')]:_0x321b65[_0x1db1('0x44')];if(!_0x577c70[_0x1db1('0x47')][_0x1db1('0x4c')]('nolimit')){_0x57e1ed['limit']=qs[_0x1db1('0x4e')](_0x577c70['query'][_0x1db1('0x4e')]);_0x57e1ed[_0x1db1('0x30')]=qs[_0x1db1('0x30')](_0x577c70[_0x1db1('0x47')][_0x1db1('0x30')]);}_0x57e1ed[_0x1db1('0x6b')]=qs[_0x1db1('0x4f')](_0x577c70['query'][_0x1db1('0x4f')]);_0x57e1ed[_0x1db1('0x50')]=qs[_0x1db1('0x51')](_[_0x1db1('0x72')](_0x577c70[_0x1db1('0x47')],_0x321b65['filters']));_0x57e1ed['where'][_0x1db1('0x68')]=_0x4678ce['id'];if(_0x577c70[_0x1db1('0x47')][_0x1db1('0x52')]){_0x57e1ed[_0x1db1('0x50')]=_[_0x1db1('0x54')](_0x57e1ed[_0x1db1('0x50')],{'$or':_[_0x1db1('0x45')](_0x57e1ed[_0x1db1('0x4b')],function(_0x450ca6){var _0x203cfe={};_0x203cfe[_0x450ca6]={'$like':'%'+_0x577c70[_0x1db1('0x47')]['filter']+'%'};return _0x203cfe;})});}_0x57e1ed=_['merge']({},_0x57e1ed,_0x577c70['options']);return db[_0x1db1('0x6f')][_0x1db1('0x32')]({'where':_0x57e1ed[_0x1db1('0x50')]})['then'](function(_0x2579af){_0x4db4fc[_0x1db1('0x32')]=_0x2579af;if(_0x577c70[_0x1db1('0x47')][_0x1db1('0x55')]){_0x57e1ed[_0x1db1('0x5b')]=[{'all':!![]}];}return db[_0x1db1('0x6f')][_0x1db1('0x56')](_0x57e1ed);})[_0x1db1('0x37')](function(_0x465ab9){_0x4db4fc[_0x1db1('0x57')]=_0x465ab9;return _0x4db4fc;});}})[_0x1db1('0x37')](respondWithFilteredResult(_0x155b3d,_0x57e1ed))[_0x1db1('0x2d')](handleError(_0x155b3d,null));};exports['removeAnswers']=function(_0x3128d3,_0x1c03d5,_0x4fcd61){return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x3128d3['params']['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x1c03d5,null))[_0x1db1('0x37')](function(_0x3f44fc){if(_0x3f44fc){return _0x3f44fc['removeAnswers'](_0x3128d3['query'][_0x1db1('0x6d')]);}})[_0x1db1('0x37')](respondWithStatusCode(_0x1c03d5,null))['catch'](handleError(_0x1c03d5,null));};exports[_0x1db1('0x73')]=function(_0x2b3f1b,_0xd14a72,_0x2eba23){var _0x5c05a9={'channel':_0x1db1('0x74')};var _0x2bbe94=[];var _0x4b4e39=[];var _0x18ec41={};return db['SmsAccount'][_0x1db1('0x61')]({'where':{'id':_0x2b3f1b[_0x1db1('0x59')]['id']},'include':[{'model':db[_0x1db1('0x75')],'as':_0x1db1('0x76')}]})[_0x1db1('0x37')](handleEntityNotFound(_0xd14a72,null))[_0x1db1('0x37')](function(_0x1faf25){_0x5c05a9[_0x1db1('0x77')]=_0x1faf25;_0x5c05a9[_0x1db1('0x78')]=_[_0x1db1('0x79')](_0x1faf25[_0x1db1('0x76')],[_0x1db1('0x7a')],['asc']);if(_0x5c05a9[_0x1db1('0x77')]['Applications']){delete _0x5c05a9['account'][_0x1db1('0x76')];}return db[_0x1db1('0x7b')][_0x1db1('0x66')]();})['then'](function(_0x463767){if(!_0x463767){throw new db[(_0x1db1('0x7c'))][(_0x1db1('0x7d'))](_0x1db1('0x7e'));}_0x2bbe94=_['difference'](_['keys'](_0x463767),[_0x1db1('0x7f'),_0x1db1('0x80')]);_0x4b4e39=_[_0x1db1('0x81')](_['keys'](_0x463767),[_0x1db1('0x7f'),_0x1db1('0x80'),_0x1db1('0x82'),_0x1db1('0x83')]);_0x5c05a9['body']={'mapKey':_0x1db1('0x84')};if(_0x5c05a9[_0x1db1('0x77')]['type']){switch(_0x5c05a9[_0x1db1('0x77')][_0x1db1('0x42')]){case'twilio':_0x5c05a9[_0x1db1('0x5d')]['from']=_0x2b3f1b[_0x1db1('0x5d')]['From'];_0x5c05a9['body']['body']=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x85')];_0x5c05a9[_0x1db1('0x5d')]['messageId']=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x86')];break;case _0x1db1('0x87'):_0x5c05a9['body'][_0x1db1('0x88')]='+'+_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x89')];_0x5c05a9['body'][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x8a')];break;case'connectel':_0x5c05a9['body']['from']=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x88')];_0x5c05a9['body'][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x2a')];break;case'clicksend':_0x5c05a9['body'][_0x1db1('0x88')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x88')];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')]['body'];_0x5c05a9['body'][_0x1db1('0x8b')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x8c')];break;case _0x1db1('0x8d'):_0x5c05a9['body'][_0x1db1('0x88')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x8e')];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')]['Text'];_0x5c05a9['body']['messageId']=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x8f')];break;case _0x1db1('0x90'):_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')]='+'+_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x91')][0x0][_0x1db1('0x88')];_0x5c05a9['body'][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')]['results'][0x0][_0x1db1('0x8a')];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x8b')]=_0x2b3f1b[_0x1db1('0x5d')]['results'][0x0][_0x1db1('0x8b')];break;case _0x1db1('0x92'):_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')]=_0x2b3f1b[_0x1db1('0x5d')]['originatingAddress'];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x93')]['message'];break;case _0x1db1('0x94'):_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x95')];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x8a')];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x8b')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x96')];break;case _0x1db1('0x97'):_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x8b')]=_0x2b3f1b[_0x1db1('0x5d')][0x0][_0x1db1('0x2a')]['id'];_0x5c05a9['body'][_0x1db1('0x88')]=_0x2b3f1b[_0x1db1('0x5d')][0x0][_0x1db1('0x2a')]['from'];_0x5c05a9[_0x1db1('0x5d')]['body']=_0x2b3f1b[_0x1db1('0x5d')][0x0][_0x1db1('0x2a')][_0x1db1('0x8a')];break;case _0x1db1('0x98'):_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x88')];_0x5c05a9['body'][_0x1db1('0x5d')]=_0x2b3f1b[_0x1db1('0x5d')][_0x1db1('0x2a')];_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x8b')]=_0x2b3f1b['body']['refid'];break;}}if(_0x5c05a9[_0x1db1('0x5d')]['id']){delete _0x5c05a9[_0x1db1('0x5d')]['id'];}if(_[_0x1db1('0x99')](_0x5c05a9['body'][_0x1db1('0x88')])){throw new db[(_0x1db1('0x7c'))]['ValidationError'](_0x1db1('0x9a'));}if(_[_0x1db1('0x99')](_0x5c05a9[_0x1db1('0x5d')]['body'])||_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x5d')]===''){throw new db['Sequelize'][(_0x1db1('0x7d'))](_0x1db1('0x9b'));}if(_[_0x1db1('0x99')](_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x9c')])){throw new db[(_0x1db1('0x7c'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b4e39);}if(!_['includes'](_0x4b4e39,_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x9c')])){throw new db[(_0x1db1('0x7c'))][(_0x1db1('0x7d'))](_0x1db1('0x9d')+_0x4b4e39);}_0x18ec41[_0x5c05a9['body'][_0x1db1('0x9c')]]=_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')];return db[_0x1db1('0x9e')][_0x1db1('0x61')]({'where':{'id':_0x5c05a9[_0x1db1('0x77')][_0x1db1('0x83')]},'include':[{'model':db[_0x1db1('0x7b')],'as':_0x1db1('0x9f'),'where':_0x18ec41,'limit':0x1,'order':[['updatedAt',_0x1db1('0xa0')]]}]});})[_0x1db1('0x37')](handleEntityNotFound(_0xd14a72,null))[_0x1db1('0x37')](function(_0x464dce){if(_0x464dce){_0x5c05a9[_0x1db1('0xa1')]=_[_0x1db1('0xa2')](_0x464dce,[_0x1db1('0x9f')]);if(_0x464dce[_0x1db1('0x9f')]['length']){return _0x464dce['Contacts'][0x0];}var _0x597f77=_['defaults'](_0x5c05a9[_0x1db1('0x5d')],{'firstName':_0x5c05a9['body'][_0x1db1('0x88')],'ListId':_0x464dce['id']});_0x597f77[_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x9c')]]=_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')];return db[_0x1db1('0x7b')]['create'](_0x597f77,{'fields':_0x2bbe94,'raw':!![]});}})[_0x1db1('0x37')](handleEntityNotFound(_0xd14a72,null))[_0x1db1('0x37')](function(_0x479de0){if(_0x479de0){_0x5c05a9[_0x1db1('0xa3')]=_0x479de0;var _0x310b14={'ContactId':_0x479de0['id'],'phone':_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x88')],'SmsAccountId':_0x2b3f1b[_0x1db1('0x59')]['id']};var _0x59b5e1={'ContactId':_0x479de0['id'],'SmsAccountId':_0x2b3f1b[_0x1db1('0x59')]['id'],'closed':![]};return db[_0x1db1('0xa4')][_0x1db1('0x61')]({'where':_0x59b5e1})['then'](function(_0x29e67a){if(_0x29e67a){return[_0x29e67a,![]];}return db[_0x1db1('0xa4')][_0x1db1('0x5c')](_0x310b14)[_0x1db1('0x37')](function(_0x460bff){return[_0x460bff,!![]];});});}})[_0x1db1('0xa5')](function(_0x43448f,_0x11ae8c){_0x5c05a9[_0x1db1('0xa6')]=_0x43448f[_0x1db1('0x39')]({'plain':!![]});_0x5c05a9['interaction'][_0x1db1('0xa7')]=![];if(_0x11ae8c){if(_0x5c05a9[_0x1db1('0x77')][_0x1db1('0xa8')]){_0x5c05a9[_0x1db1('0x78')]['push']({'id':0x0,'priority':_0x5c05a9[_0x1db1('0x78')][_0x1db1('0x4a')]+0x1,'app':_0x1db1('0xa9'),'appdata':'unmanaged','interval':_0x1db1('0xaa')});}_0x5c05a9['interaction'][_0x1db1('0xa7')]=!![];}return db[_0x1db1('0xab')][_0x1db1('0x5c')]({'phone':_0x5c05a9[_0x1db1('0x5d')]['from'],'messageId':_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0x8b')],'body':_0x5c05a9['body'][_0x1db1('0x5d')],'SmsAccountId':_0x2b3f1b[_0x1db1('0x59')]['id'],'SmsInteractionId':_0x43448f['id'],'direction':'in','ContactId':_0x43448f[_0x1db1('0xac')],'AttachmentId':_0x5c05a9[_0x1db1('0x5d')][_0x1db1('0xad')]});})[_0x1db1('0x37')](function(_0x225b4c){_0x5c05a9[_0x1db1('0x2a')]=_0x225b4c;if(!_0x5c05a9[_0x1db1('0xa6')][_0x1db1('0xae')])return;return db[_0x1db1('0xaf')][_0x1db1('0x61')]({'attributes':['id',_0x1db1('0x3d')],'where':{'id':_0x5c05a9['interaction'][_0x1db1('0xae')]}});})['then'](function(_0x534660){if(_0x534660){_0x5c05a9[_0x1db1('0x78')][_0x1db1('0xb0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x534660[_0x1db1('0x3d')]+','+(_0x5c05a9[_0x1db1('0x77')][_0x1db1('0xb1')]||0xa),'interval':'*,*,*,*'});}if(!_0x5c05a9[_0x1db1('0xa6')][_0x1db1('0xb2')])return;return db[_0x1db1('0xb3')][_0x1db1('0x61')]({'attributes':['id',_0x1db1('0x3d')],'where':{'id':_0x5c05a9[_0x1db1('0xa6')][_0x1db1('0xb2')]}});})['then'](function(_0x5b4cb5){if(_0x5b4cb5){_0x5c05a9[_0x1db1('0x78')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5b4cb5[_0x1db1('0x3d')]+','+(_0x5c05a9[_0x1db1('0x77')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1db1('0xaa')});}return respondWithRpcPromise(_0x1db1('0xb4'),_0x1db1('0xb5'),_0x5c05a9);})[_0x1db1('0x37')](function(_0x30e02b){if(_0x30e02b){var _0x5064a3=0xc8;var _0x5b7906=_0x1db1('0xb6');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b7906,_0x5064a3,_0x1db1('0xb7'));logger['debug'](_0x1db1('0xb8'),_0x5b7906,_0x5064a3,_0x1db1('0xb7'),JSON[_0x1db1('0x27')](_0x30e02b));if(_0x5c05a9[_0x1db1('0x77')][_0x1db1('0x42')]===_0x1db1('0xb9')){return _0xd14a72[_0x1db1('0x2f')](_0x5064a3)[_0x1db1('0xba')](_0x1db1('0xbb'),_0x1db1('0xbc'))[_0x1db1('0xbd')](_0x1db1('0xbe'));}else{return _0xd14a72[_0x1db1('0x2f')](_0x5064a3)[_0x1db1('0x34')](_0x30e02b);}}})['catch'](handleError(_0xd14a72,null));};exports[_0x1db1('0xbf')]=function(_0x42c21f,_0x56caba){var _0xf29eb0=_0x42c21f[_0x1db1('0x59')]['id'];var _0x57bfbd=_0x42c21f[_0x1db1('0x5d')];var _0x22b945=0xc8;var _0x25d2a9=null;return db[_0x1db1('0xc0')][_0x1db1('0xc1')]({'isolationLevel':db[_0x1db1('0xc0')][_0x1db1('0xc2')][_0x1db1('0xc3')][_0x1db1('0xc4')]},function(_0x20cac0){return db[_0x1db1('0x3f')][_0x1db1('0x71')]({'where':{'id':_0xf29eb0},'transaction':_0x20cac0})['then'](function(_0x244f25){if(_0x244f25){return db[_0x1db1('0x75')][_0x1db1('0x38')]({'where':{'SmsAccountId':_0xf29eb0},'transaction':_0x20cac0})[_0x1db1('0x37')](function(){var _0xef26ff=_[_0x1db1('0x45')](_0x57bfbd,function(_0x1816e0){_0x1816e0[_0x1db1('0x68')]=_0xf29eb0;return _0x1816e0;});return db[_0x1db1('0x75')][_0x1db1('0xc5')](_0xef26ff,{'transaction':_0x20cac0});});}else{_0x22b945=0x194;_0x25d2a9=[];}});})[_0x1db1('0x37')](function(){if(_0x22b945!==0x194){return db[_0x1db1('0x75')][_0x1db1('0xc6')]({'where':{'SmsAccountId':_0xf29eb0},'order':_0x1db1('0x7a')})[_0x1db1('0x37')](function(_0x2774ee){_0x25d2a9=_0x2774ee;});}})[_0x1db1('0x2d')](function(_0x567040){_0x22b945=0x1f4;logger[_0x1db1('0x28')](_0x567040[_0x1db1('0x3c')]);if(_0x567040[_0x1db1('0x3d')]){delete _0x567040[_0x1db1('0x3d')];}_0x25d2a9=_0x567040;})['finally'](function(){if(_0x25d2a9===null){_0x56caba[_0x1db1('0x2e')](_0x22b945);}else{if(_0x22b945===0x1f4){_0x56caba[_0x1db1('0x2f')](_0x22b945)[_0x1db1('0xbd')](_0x25d2a9);}else{_0x56caba['status'](_0x22b945)[_0x1db1('0x34')](_0x25d2a9);}}});};exports[_0x1db1('0xc7')]=function(_0x3aff44,_0x27cd12,_0x2917f9){var _0x1bcb2c={};var _0x5b18b8={};var _0x59d56a;var _0x1abe2a;return db['SmsAccount'][_0x1db1('0x71')]({'where':{'id':_0x3aff44[_0x1db1('0x59')]['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x27cd12,null))[_0x1db1('0x37')](function(_0x5bc0bd){if(_0x5bc0bd){_0x59d56a=_0x5bc0bd;_0x5b18b8[_0x1db1('0x44')]=_['keys'](db[_0x1db1('0x75')][_0x1db1('0x40')]);_0x5b18b8[_0x1db1('0x47')]=_[_0x1db1('0x46')](_0x3aff44[_0x1db1('0x47')]);_0x5b18b8[_0x1db1('0x51')]=_[_0x1db1('0x48')](_0x5b18b8[_0x1db1('0x44')],_0x5b18b8['query']);_0x1bcb2c[_0x1db1('0x4b')]=_[_0x1db1('0x48')](_0x5b18b8[_0x1db1('0x44')],qs['fields'](_0x3aff44['query'][_0x1db1('0x49')]));_0x1bcb2c[_0x1db1('0x4b')]=_0x1bcb2c[_0x1db1('0x4b')][_0x1db1('0x4a')]?_0x1bcb2c[_0x1db1('0x4b')]:_0x5b18b8['model'];_0x1bcb2c[_0x1db1('0x6b')]=qs[_0x1db1('0x4f')](_0x3aff44[_0x1db1('0x47')][_0x1db1('0x4f')]);_0x1bcb2c[_0x1db1('0x50')]=qs[_0x1db1('0x51')](_[_0x1db1('0x72')](_0x3aff44[_0x1db1('0x47')],_0x5b18b8[_0x1db1('0x51')]));if(_0x3aff44[_0x1db1('0x47')][_0x1db1('0x52')]){_0x1bcb2c[_0x1db1('0x50')]=_['merge'](_0x1bcb2c['where'],{'$or':_[_0x1db1('0x45')](_0x1bcb2c['attributes'],function(_0x56786f){var _0x506ad2={};_0x506ad2[_0x56786f]={'$like':'%'+_0x3aff44[_0x1db1('0x47')]['filter']+'%'};return _0x506ad2;})});}_0x1bcb2c=_[_0x1db1('0x54')]({},_0x1bcb2c,_0x3aff44[_0x1db1('0xc8')]);return _0x59d56a[_0x1db1('0xc7')](_0x1bcb2c);}})[_0x1db1('0x37')](function(_0x8dabc8){if(_0x8dabc8){_0x1abe2a=_0x8dabc8[_0x1db1('0x4a')];if(!_0x3aff44[_0x1db1('0x47')][_0x1db1('0x4c')](_0x1db1('0x4d'))){_0x1bcb2c[_0x1db1('0x4e')]=qs[_0x1db1('0x4e')](_0x3aff44[_0x1db1('0x47')][_0x1db1('0x4e')]);_0x1bcb2c['offset']=qs[_0x1db1('0x30')](_0x3aff44[_0x1db1('0x47')][_0x1db1('0x30')]);}return _0x59d56a[_0x1db1('0xc7')](_0x1bcb2c);}})[_0x1db1('0x37')](function(_0x31ef3f){if(_0x31ef3f){return _0x31ef3f?{'count':_0x1abe2a,'rows':_0x31ef3f}:null;}})[_0x1db1('0x37')](respondWithResult(_0x27cd12,null))[_0x1db1('0x2d')](handleError(_0x27cd12,null));};exports[_0x1db1('0xc9')]=function(_0x1775cc,_0x576601,_0x41559f){var _0x1f47d8={'raw':![],'where':{}};var _0x18d338={};var _0x1663d3={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1db1('0x71')]({'where':{'id':_0x1775cc['params']['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x576601,null))[_0x1db1('0x37')](function(_0xbd01bd){if(_0xbd01bd){_0x18d338['model']=_[_0x1db1('0x46')](db[_0x1db1('0xa4')]['rawAttributes']);_0x18d338[_0x1db1('0x47')]=_[_0x1db1('0x46')](_0x1775cc['query']);_0x18d338[_0x1db1('0x51')]=_[_0x1db1('0x48')](_0x18d338[_0x1db1('0x44')],_0x18d338[_0x1db1('0x47')]);_0x1f47d8[_0x1db1('0x4b')]=_[_0x1db1('0x48')](_0x18d338[_0x1db1('0x44')],qs[_0x1db1('0x49')](_0x1775cc[_0x1db1('0x47')]['fields']));_0x1f47d8[_0x1db1('0x4b')]=_0x1f47d8[_0x1db1('0x4b')][_0x1db1('0x4a')]?_0x1f47d8[_0x1db1('0x4b')]:_0x18d338['model'];if(!_0x1775cc[_0x1db1('0x47')][_0x1db1('0x4c')]('nolimit')){_0x1f47d8[_0x1db1('0x4e')]=qs[_0x1db1('0x4e')](_0x1775cc[_0x1db1('0x47')][_0x1db1('0x4e')]);_0x1f47d8['offset']=qs['offset'](_0x1775cc['query']['offset']);}_0x1f47d8['order']=qs[_0x1db1('0x4f')](_0x1775cc['query']['sort']);_0x1f47d8[_0x1db1('0x50')]=qs[_0x1db1('0x51')](_[_0x1db1('0x72')](_0x1775cc['query'],_0x18d338[_0x1db1('0x51')]));_0x1f47d8[_0x1db1('0x50')]['SmsAccountId']=_0xbd01bd['id'];if(_0x1775cc[_0x1db1('0x47')][_0x1db1('0x52')]){_0x1f47d8[_0x1db1('0x50')]=_[_0x1db1('0x54')](_0x1f47d8[_0x1db1('0x50')],{'$or':_['map'](_0x1f47d8['attributes'],function(_0x19e5c1){var _0xcb283c={};_0xcb283c[_0x19e5c1]={'$like':'%'+_0x1775cc[_0x1db1('0x47')][_0x1db1('0x52')]+'%'};return _0xcb283c;})});}_0x1f47d8=_[_0x1db1('0x54')]({},_0x1f47d8,_0x1775cc[_0x1db1('0xc8')]);return db[_0x1db1('0xa4')][_0x1db1('0x32')]({'where':_0x1f47d8['where']})[_0x1db1('0x37')](function(_0x578a3b){_0x1663d3[_0x1db1('0x32')]=_0x578a3b;if(_0x1775cc[_0x1db1('0x47')][_0x1db1('0x55')]){_0x1f47d8[_0x1db1('0x5b')]=[{'model':db[_0x1db1('0x7b')],'as':_0x1db1('0xca'),'required':![]},{'model':db[_0x1db1('0xaf')],'as':_0x1db1('0xcb'),'attributes':['name',_0x1db1('0xcc'),'internal'],'required':![]},{'model':db[_0x1db1('0xcd')],'as':'Tags','attributes':['id',_0x1db1('0x3d'),_0x1db1('0xce')],'where':_0x1775cc[_0x1db1('0x47')][_0x1db1('0xcf')]?{'id':_0x1775cc['query'][_0x1db1('0xcf')]}:undefined,'required':_0x1775cc[_0x1db1('0x47')][_0x1db1('0xcf')]?!![]:![]}];}return db[_0x1db1('0xa4')][_0x1db1('0x56')](_0x1f47d8);})[_0x1db1('0x37')](function(_0x50c7a0){_0x1663d3[_0x1db1('0x57')]=_0x50c7a0;return _0x1663d3;});}})['then'](respondWithFilteredResult(_0x576601,_0x1f47d8))['catch'](handleError(_0x576601,null));};exports['send']=function(_0x4fa91d,_0x3f8de0,_0x654517){var _0x6df188,_0x3fef0c,_0x4b7b06;if(_['isNil'](_0x4fa91d['body'][_0x1db1('0x5d')])||_0x4fa91d[_0x1db1('0x5d')][_0x1db1('0x5d')]===''){throw new db[(_0x1db1('0x7c'))][(_0x1db1('0x7d'))](_0x1db1('0x9b'));}if(_[_0x1db1('0x99')](_0x4fa91d[_0x1db1('0x5d')]['to'])){throw new db[(_0x1db1('0x7c'))][(_0x1db1('0x7d'))](_0x1db1('0xd0'));}_0x6df188=_0x4fa91d['body']['to'];return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x4fa91d[_0x1db1('0x59')]['id']},'include':[{'model':db[_0x1db1('0x9e')],'as':_0x1db1('0xd1'),'include':[{'model':db[_0x1db1('0x7b')],'as':_0x1db1('0x9f'),'where':{'mobile':_0x6df188},'limit':0x1,'order':[[_0x1db1('0x80'),_0x1db1('0xa0')]]}]}]})[_0x1db1('0x37')](handleEntityNotFound(_0x3f8de0,null))['then'](function(_0x2dd74b){if(_0x2dd74b&&_0x2dd74b[_0x1db1('0xd1')]){_0x3fef0c=_0x2dd74b['get']({'plain':!![]});if(_0x3fef0c[_0x1db1('0xd1')]&&_0x3fef0c[_0x1db1('0xd1')][_0x1db1('0x9f')][_0x1db1('0x4a')]){return _0x3fef0c[_0x1db1('0xd1')]['Contacts'][0x0];}return db[_0x1db1('0x7b')][_0x1db1('0x5c')](_[_0x1db1('0x1c')](_0x4fa91d[_0x1db1('0x5d')],{'firstName':_0x6df188,'mobile':_0x6df188,'phone':_0x6df188,'ListId':_0x3fef0c['ListId']}));}})[_0x1db1('0x37')](handleEntityNotFound(_0x3f8de0,null))[_0x1db1('0x37')](function(_0xe97b87){if(_0xe97b87){_0x4b7b06=_0xe97b87;return db['SmsInteraction'][_0x1db1('0x61')]({'where':{'ContactId':_0x4b7b06['id'],'closed':![],'SmsAccountId':_0x3fef0c['id']}})['then'](function(_0x28185e){if(_0x28185e){return[_0x28185e,![]];}return db[_0x1db1('0xa4')][_0x1db1('0x5c')]({'UserId':_0x4fa91d[_0x1db1('0x5e')]['id'],'ContactId':_0x4b7b06['id'],'SmsAccountId':_0x3fef0c['id'],'phone':_0x6df188,'firstMsgDirection':_0x1db1('0xd2'),'Messages':[_[_0x1db1('0x54')](_0x4fa91d[_0x1db1('0x5d')],{'read':![],'body':_0x4fa91d[_0x1db1('0x5d')][_0x1db1('0x5d')],'phone':_0x6df188,'SmsAccountId':_0x3fef0c['id'],'UserId':_0x4fa91d[_0x1db1('0x5e')]['id'],'ContactId':_0x4b7b06['id']})]},{'include':[{'model':db[_0x1db1('0xab')],'as':'Messages'}]})[_0x1db1('0x37')](function(_0x486581){return[_0x486581,!![]];});});}})[_0x1db1('0xa5')](function(_0x57b163,_0x4ac188){if(_0x4ac188){return _0x57b163;}return db['SmsMessage']['create'](_['merge'](_0x4fa91d[_0x1db1('0x5d')],{'read':![],'body':_0x4fa91d[_0x1db1('0x5d')][_0x1db1('0x5d')],'phone':_0x6df188,'SmsAccountId':_0x3fef0c['id'],'SmsInteractionId':_0x57b163['id'],'UserId':_0x4fa91d[_0x1db1('0x5e')]['id'],'ContactId':_0x4b7b06['id']}))[_0x1db1('0x37')](function(_0x1f9730){_0x57b163[_0x1db1('0xd3')][_0x1db1('0xd4')]=[];_0x57b163['dataValues'][_0x1db1('0xd4')]['push'](_0x1f9730['dataValues']);return _0x57b163;});})[_0x1db1('0x37')](respondWithResult(_0x3f8de0,null))[_0x1db1('0x2d')](handleError(_0x3f8de0,null));};exports[_0x1db1('0x2f')]=function(_0x1937d7,_0x3af387,_0x24b838){if(_0x1937d7[_0x1db1('0x5d')]['id']){delete _0x1937d7['body']['id'];}var _0x49eadb,_0x2c4b95,_0x242b5c;return db['SmsAccount'][_0x1db1('0x61')]({'where':{'id':_0x1937d7['params']['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x3af387,null))[_0x1db1('0x37')](function(_0x33a8c7){if(_0x33a8c7){_0x242b5c=_0x33a8c7;logger[_0x1db1('0x25')](_0x1db1('0x26'),_0x1db1('0x2f'),'received\x20delivery\x20report\x20from',_0x33a8c7[_0x1db1('0x42')],util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));switch(_0x33a8c7[_0x1db1('0x42')]){case'skebby':if(_0x1937d7['body'][_0x1db1('0xd6')]&&_0x1937d7[_0x1db1('0x5d')][_0x1db1('0x2f')]){_0x2c4b95=_0x1937d7['body'][_0x1db1('0x2f')];return db[_0x1db1('0xab')][_0x1db1('0x61')]({'where':{'messageId':_0x1937d7['body'][_0x1db1('0xd6')]}});}break;case _0x1db1('0xd7'):if(_0x1937d7[_0x1db1('0x5d')]['requestid']&&_0x1937d7[_0x1db1('0x5d')][_0x1db1('0xd8')]){_0x2c4b95=_0x1937d7['body']['statusInt'];return db[_0x1db1('0xab')][_0x1db1('0x61')]({'where':{'messageId':_0x1937d7[_0x1db1('0x5d')][_0x1db1('0xd9')]}});}break;case _0x1db1('0xda'):if(_0x1937d7[_0x1db1('0x5d')]['message_id']&&_0x1937d7['body'][_0x1db1('0xdb')]){_0x2c4b95=_0x1937d7['body'][_0x1db1('0xdb')];return db[_0x1db1('0xab')][_0x1db1('0x61')]({'where':{'messageId':_0x1937d7[_0x1db1('0x5d')]['message_id']}});}break;case _0x1db1('0x90'):var _0x2a7296=_0x1937d7[_0x1db1('0x5d')][_0x1db1('0x91')][0x0];if(_0x2a7296[_0x1db1('0x8b')]&&_0x2a7296[_0x1db1('0x2f')]['groupName']===_0x1db1('0xdc')){_0x2c4b95=_0x2a7296[_0x1db1('0x2f')][_0x1db1('0xdd')];return db['SmsMessage']['find']({'where':{'messageId':_0x2a7296[_0x1db1('0x8b')]}});}break;case _0x1db1('0x94'):if(_0x1937d7[_0x1db1('0x5d')][_0x1db1('0x8b')]&&_0x1937d7[_0x1db1('0x5d')]['status']){_0x2c4b95=_0x1937d7['body']['status'];return db[_0x1db1('0xab')]['find']({'where':{'messageId':_0x1937d7['body'][_0x1db1('0x8b')]}});}break;case _0x1db1('0x97'):if(_0x1937d7[_0x1db1('0x5d')][0x0][_0x1db1('0x2a')]['id']){_0x2c4b95=_0x1937d7[_0x1db1('0x5d')][0x0][_0x1db1('0x42')];return db['SmsMessage'][_0x1db1('0x61')]({'where':{'messageId':_0x1937d7[_0x1db1('0x5d')][0x0]['message']['id']}});}break;case _0x1db1('0x98'):if(_0x1937d7[_0x1db1('0x5d')][_0x1db1('0xde')]&&_0x1937d7[_0x1db1('0x5d')][_0x1db1('0x2f')]){_0x2c4b95=_0x1937d7[_0x1db1('0x5d')][_0x1db1('0x2f')];return db[_0x1db1('0xab')][_0x1db1('0x61')]({'where':{'messageId':_0x1937d7[_0x1db1('0x5d')][_0x1db1('0xde')]}});}break;}}})[_0x1db1('0x37')](handleEntityNotFound(_0x3af387,null))[_0x1db1('0x37')](function(_0x13cfc9){if(_0x13cfc9){_0x49eadb=_0x13cfc9;switch(_0x242b5c[_0x1db1('0x42')]){case _0x1db1('0x87'):if(_0x2c4b95==='DELIVERED'){return _0x49eadb[_0x1db1('0x36')]({'read':!![]});}else{logger[_0x1db1('0x28')](_0x1db1('0x26'),_0x1db1('0x2f'),_0x1db1('0x87'),util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1db1('0xd7'):if(_0x2c4b95==='1'){return _0x49eadb[_0x1db1('0x36')]({'read':!![]});}else{logger[_0x1db1('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1db1('0x2f'),_0x1db1('0x87'),util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1db1('0xda'):if(!_0x1937d7[_0x1db1('0x5d')][_0x1db1('0xdf')]&&_0x2c4b95>=0xc8&&_0x2c4b95<=0xce){return _0x49eadb['update']({'read':!![]});}else{logger[_0x1db1('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1db1('0x2f'),_0x1db1('0xda'),util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1db1('0x90'):var _0x350df6=_0x1937d7[_0x1db1('0x5d')]['results'][0x0];if(_0x350df6['status'][_0x1db1('0xdd')]===_0x1db1('0xdc')){return _0x49eadb['update']({'read':!![]});}else{logger[_0x1db1('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1db1('0x2f'),_0x1db1('0x90'),util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2c4b95==_0x1db1('0xe0')||_0x2c4b95==_0x1db1('0xe1')){return _0x49eadb[_0x1db1('0x36')]({'read':!![]});}else{logger[_0x1db1('0x28')](_0x1db1('0x26'),_0x1db1('0x2f'),'clickatell',util['inspect'](_0x1937d7['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x2c4b95=='message-delivered'){return _0x49eadb[_0x1db1('0x36')]({'read':!![]});}else{logger['error'](_0x1db1('0x26'),'status',_0x1db1('0x97'),util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1db1('0x98'):if(_0x2c4b95===_0x1db1('0xe2')||_0x2c4b95===_0x1db1('0xe3')){return _0x49eadb[_0x1db1('0x36')]({'read':!![]});}else{logger[_0x1db1('0x28')](_0x1db1('0x26'),_0x1db1('0x2f'),_0x1db1('0x98'),util[_0x1db1('0xd5')](_0x1937d7[_0x1db1('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x49eadb;}})[_0x1db1('0x37')](respondWithResult(_0x3af387,null))[_0x1db1('0x2d')](handleError(_0x3af387,null));};exports[_0x1db1('0xe4')]=function(_0x746636,_0x45cb8a,_0x4002f9){var _0x492cb1,_0x5c9df6,_0x3bf451;return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x746636[_0x1db1('0x59')]['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x45cb8a,null))[_0x1db1('0x37')](function(_0xb75eac){if(_0xb75eac){_0x3bf451=_0xb75eac;logger[_0x1db1('0x25')](_0x1db1('0x26'),_0x1db1('0x2f'),_0x1db1('0xe5'),_0xb75eac[_0x1db1('0x42')],util[_0x1db1('0xd5')](_0x746636[_0x1db1('0x47')],{'showHidden':![],'depth':null}));switch(_0xb75eac[_0x1db1('0x42')]){case _0x1db1('0x92'):if(_0x746636[_0x1db1('0x47')][_0x1db1('0xe6')]&&_0x746636[_0x1db1('0x47')]['state']){_0x5c9df6=_0x746636['query'][_0x1db1('0xe7')];return db[_0x1db1('0xab')][_0x1db1('0x61')]({'where':{'messageId':_0x746636['query']['message-id']}});}break;}}})['then'](handleEntityNotFound(_0x45cb8a,null))[_0x1db1('0x37')](function(_0x296ab4){if(_0x296ab4){_0x492cb1=_0x296ab4;switch(_0x3bf451[_0x1db1('0x42')]){case _0x1db1('0x92'):if(_0x5c9df6==='2'||_0x5c9df6==='6'){return _0x492cb1['update']({'read':!![]});}else{logger[_0x1db1('0x28')](_0x1db1('0x26'),_0x1db1('0x2f'),_0x1db1('0x92'),util[_0x1db1('0xd5')](_0x746636['query'],{'showHidden':![],'depth':null}));};break;}return _0x492cb1;}})[_0x1db1('0x37')](respondWithResult(_0x45cb8a,null))[_0x1db1('0x2d')](handleError(_0x45cb8a,null));};exports[_0x1db1('0xe8')]=function(_0xa3cc01,_0x5a65b1,_0x20cafe){return db['SmsAccount']['find']({'where':{'id':_0xa3cc01[_0x1db1('0x59')]['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x5a65b1,null))[_0x1db1('0x37')](function(_0x2265b2){if(_0x2265b2){return _0x2265b2[_0x1db1('0xe8')](_0xa3cc01['body']['ids'],_[_0x1db1('0xa2')](_0xa3cc01[_0x1db1('0x5d')],[_0x1db1('0x6d'),'id'])||{})[_0x1db1('0xa5')](function(_0x1a6d2b){for(var _0x4925ae=0x0;_0x4925ae<_0xa3cc01[_0x1db1('0x5d')][_0x1db1('0x6d')][_0x1db1('0x4a')];_0x4925ae+=0x1){socket[_0x1db1('0xe9')](_0x1db1('0xea'),{'UserId':Number(_0xa3cc01[_0x1db1('0x5d')][_0x1db1('0x6d')][_0x4925ae]),'SmsAccountId':Number(_0xa3cc01[_0x1db1('0x59')]['id'])});}return _0x1a6d2b;});}})['then'](respondWithResult(_0x5a65b1,null))[_0x1db1('0x2d')](handleError(_0x5a65b1,null));};exports[_0x1db1('0xeb')]=function(_0x55df6f,_0x357adf,_0x199a39){return db[_0x1db1('0x3f')][_0x1db1('0x61')]({'where':{'id':_0x55df6f['params']['id']}})['then'](handleEntityNotFound(_0x357adf,null))[_0x1db1('0x37')](function(_0x259cae){if(_0x259cae){return _0x259cae['removeAgents'](_0x55df6f['query'][_0x1db1('0x6d')])['then'](function(){if(_[_0x1db1('0xec')](_0x55df6f[_0x1db1('0x47')][_0x1db1('0x6d')])){for(var _0x2bc6b8=0x0;_0x2bc6b8<_0x55df6f[_0x1db1('0x47')]['ids'][_0x1db1('0x4a')];_0x2bc6b8+=0x1){socket['emit'](_0x1db1('0xed'),{'UserId':Number(_0x55df6f[_0x1db1('0x47')][_0x1db1('0x6d')][_0x2bc6b8]),'SmsAccountId':Number(_0x55df6f[_0x1db1('0x59')]['id'])});}}else{socket[_0x1db1('0xe9')]('userSmsAccount:remove',{'UserId':Number(_0x55df6f[_0x1db1('0x47')][_0x1db1('0x6d')]),'SmsAccountId':Number(_0x55df6f['params']['id'])});}});}})[_0x1db1('0x37')](respondWithStatusCode(_0x357adf,null))['catch'](handleError(_0x357adf,null));};exports[_0x1db1('0xee')]=function(_0xfcde3f,_0x58478e,_0x7a916e){var _0x58f6b3={};var _0x63a00d={};var _0x29c1c4;var _0x178a8;return db[_0x1db1('0x3f')][_0x1db1('0x71')]({'where':{'id':_0xfcde3f[_0x1db1('0x59')]['id']}})[_0x1db1('0x37')](handleEntityNotFound(_0x58478e,null))[_0x1db1('0x37')](function(_0x569879){if(_0x569879){_0x29c1c4=_0x569879;_0x63a00d[_0x1db1('0x44')]=_['keys'](db[_0x1db1('0xaf')][_0x1db1('0x40')]);_0x63a00d['query']=_[_0x1db1('0x46')](_0xfcde3f[_0x1db1('0x47')]);_0x63a00d['filters']=_['intersection'](_0x63a00d[_0x1db1('0x44')],_0x63a00d[_0x1db1('0x47')]);_0x58f6b3[_0x1db1('0x4b')]=_[_0x1db1('0x48')](_0x63a00d[_0x1db1('0x44')],qs['fields'](_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x49')]));_0x58f6b3[_0x1db1('0x4b')]=_0x58f6b3['attributes'][_0x1db1('0x4a')]?_0x58f6b3[_0x1db1('0x4b')]:_0x63a00d['model'];_0x58f6b3['order']=qs[_0x1db1('0x4f')](_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x4f')]);_0x58f6b3[_0x1db1('0x50')]=qs[_0x1db1('0x51')](_[_0x1db1('0x72')](_0xfcde3f[_0x1db1('0x47')],_0x63a00d[_0x1db1('0x51')]));if(_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x52')]){_0x58f6b3['where']=_[_0x1db1('0x54')](_0x58f6b3[_0x1db1('0x50')],{'$or':_[_0x1db1('0x45')](_0x58f6b3['attributes'],function(_0x450675){var _0x16c179={};_0x16c179[_0x450675]={'$like':'%'+_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x52')]+'%'};return _0x16c179;})});}_0x58f6b3=_[_0x1db1('0x54')]({},_0x58f6b3,_0xfcde3f['options']);return _0x29c1c4['getAgents'](_0x58f6b3);}})['then'](function(_0x8c8d52){if(_0x8c8d52){_0x178a8=_0x8c8d52[_0x1db1('0x4a')];if(!_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x4c')](_0x1db1('0x4d'))){_0x58f6b3[_0x1db1('0x4e')]=qs['limit'](_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x4e')]);_0x58f6b3[_0x1db1('0x30')]=qs[_0x1db1('0x30')](_0xfcde3f[_0x1db1('0x47')][_0x1db1('0x30')]);}return _0x29c1c4[_0x1db1('0xee')](_0x58f6b3);}})['then'](function(_0x55789b){if(_0x55789b){return _0x55789b?{'count':_0x178a8,'rows':_0x55789b}:null;}})[_0x1db1('0x37')](respondWithResult(_0x58478e,null))['catch'](handleError(_0x58478e,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 169e00d..db29b8b 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 _0x0446=['../../mysqldb','SmsAccount','setMaxListeners','update','emit','exports','events'];(function(_0x668e1e,_0x14b340){var _0x4ca4bf=function(_0x2a5189){while(--_0x2a5189){_0x668e1e['push'](_0x668e1e['shift']());}};_0x4ca4bf(++_0x14b340);}(_0x0446,0xa7));var _0x6044=function(_0x31e8dc,_0xf8ff87){_0x31e8dc=_0x31e8dc-0x0;var _0x1afbe0=_0x0446[_0x31e8dc];return _0x1afbe0;};'use strict';var EventEmitter=require(_0x6044('0x0'));var SmsAccount=require(_0x6044('0x1'))['db'][_0x6044('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6044('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6044('0x4'),'afterDestroy':'remove'};function emitEvent(_0x25b372){return function(_0x48abcd,_0x4e99be,_0x25e0ce){SmsAccountEvents[_0x6044('0x5')](_0x25b372+':'+_0x48abcd['id'],_0x48abcd);SmsAccountEvents[_0x6044('0x5')](_0x25b372,_0x48abcd);_0x25e0ce(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x6044('0x6')]=SmsAccountEvents; \ No newline at end of file +var _0xb921=['hasOwnProperty','exports','events','SmsAccount','save','update','emit'];(function(_0x3e4539,_0x3811e0){var _0x18469c=function(_0x1f619b){while(--_0x1f619b){_0x3e4539['push'](_0x3e4539['shift']());}};_0x18469c(++_0x3811e0);}(_0xb921,0xb8));var _0x1b92=function(_0x155e04,_0x28cd61){_0x155e04=_0x155e04-0x0;var _0x4590d0=_0xb921[_0x155e04];return _0x4590d0;};'use strict';var EventEmitter=require(_0x1b92('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x1b92('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1b92('0x2'),'afterUpdate':_0x1b92('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51c7c7){return function(_0x4afd47,_0x26c3ba,_0x32483f){SmsAccountEvents[_0x1b92('0x4')](_0x51c7c7+':'+_0x4afd47['id'],_0x4afd47);SmsAccountEvents['emit'](_0x51c7c7,_0x4afd47);_0x32483f(null);};}for(var e in events){if(events[_0x1b92('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x1b92('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 58b7be5..78f1801 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 _0x9c85=['lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','define','SmsAccount'];(function(_0x563a49,_0x15b9c2){var _0x331a3d=function(_0x33d8a4){while(--_0x33d8a4){_0x563a49['push'](_0x563a49['shift']());}};_0x331a3d(++_0x15b9c2);}(_0x9c85,0xfc));var _0x59c8=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x9c85[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x59c8('0x0'));var util=require(_0x59c8('0x1'));var logger=require(_0x59c8('0x2'))('api');var moment=require(_0x59c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59c8('0x4'));var rimraf=require(_0x59c8('0x5'));var config=require(_0x59c8('0x6'));var attributes=require('./smsAccount.attributes');module['exports']=function(_0x5eef57,_0x17c9f9){return _0x5eef57[_0x59c8('0x7')](_0x59c8('0x8'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5816=['../../config/logger','api','bluebird','path','../../config/environment','exports','SmsAccount','sms_accounts','util'];(function(_0x359f5f,_0x505e79){var _0x2b5611=function(_0x36bab0){while(--_0x36bab0){_0x359f5f['push'](_0x359f5f['shift']());}};_0x2b5611(++_0x505e79);}(_0x5816,0xa1));var _0x6581=function(_0x465b18,_0x2bc166){_0x465b18=_0x465b18-0x0;var _0x5d8f8d=_0x5816[_0x465b18];return _0x5d8f8d;};'use strict';var _=require('lodash');var util=require(_0x6581('0x0'));var logger=require(_0x6581('0x1'))(_0x6581('0x2'));var moment=require('moment');var BPromise=require(_0x6581('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6581('0x4'));var rimraf=require('rimraf');var config=require(_0x6581('0x5'));var attributes=require('./smsAccount.attributes');module[_0x6581('0x6')]=function(_0xb96474,_0x3c5651){return _0xb96474['define'](_0x6581('0x7'),attributes,{'tableName':_0x6581('0x8'),'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 5725a76..b05da80 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 _0xaffe=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','stringify','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xaffe,0x170));var _0xeaff=function(_0x25718d,_0x1ee268){_0x25718d=_0x25718d-0x0;var _0x1c1a65=_0xaffe[_0x25718d];return _0x1c1a65;};'use strict';var _=require('lodash');var util=require(_0xeaff('0x0'));var moment=require('moment');var BPromise=require(_0xeaff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaff('0x2'))['db'];var utils=require(_0xeaff('0x3'));var logger=require(_0xeaff('0x4'))(_0xeaff('0x5'));var config=require(_0xeaff('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeaff('0x7')]['http']({'port':0x232a});config[_0xeaff('0x8')]=_[_0xeaff('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeaff('0xa'))(new Redis(config[_0xeaff('0x8')]));require(_0xeaff('0xb'))[_0xeaff('0xc')](socket);function respondWithRpcPromise(_0x181598,_0x3a197f,_0x22b9b3){return new BPromise(function(_0x42825f,_0x119ec3){return client[_0xeaff('0xd')](_0x181598,_0x22b9b3)[_0xeaff('0xe')](function(_0x597f9c){logger[_0xeaff('0xf')](_0xeaff('0x10'),_0x3a197f,_0xeaff('0x11'));logger[_0xeaff('0x12')](_0xeaff('0x13'),_0x3a197f,_0xeaff('0x11'),JSON['stringify'](_0x597f9c));if(_0x597f9c[_0xeaff('0x14')]){if(_0x597f9c[_0xeaff('0x14')]['code']===0x1f4){logger['error'](_0xeaff('0x10'),_0x3a197f,_0x597f9c[_0xeaff('0x14')]['message']);return _0x119ec3(_0x597f9c['error'][_0xeaff('0x15')]);}logger[_0xeaff('0x14')](_0xeaff('0x10'),_0x3a197f,_0x597f9c['error']['message']);return _0x42825f(_0x597f9c['error'][_0xeaff('0x15')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x3a197f,'request\x20sent');_0x42825f(_0x597f9c[_0xeaff('0x16')][_0xeaff('0x15')]);}})[_0xeaff('0x17')](function(_0x185067){logger[_0xeaff('0x14')]('SmsAccount,\x20%s,\x20%s',_0x3a197f,_0x185067);_0x119ec3(_0x185067);});});}exports[_0xeaff('0x18')]=function(_0x3c2559){var _0x4b7701=this;return new Promise(function(_0x156e03,_0x568a5d){return db[_0xeaff('0x19')][_0xeaff('0x1a')]({'raw':_0x3c2559[_0xeaff('0x1b')]?_0x3c2559[_0xeaff('0x1b')][_0xeaff('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c2559[_0xeaff('0x1b')]?_0x3c2559[_0xeaff('0x1b')][_0xeaff('0x1d')]||null:null,'attributes':_0x3c2559['options']?_0x3c2559[_0xeaff('0x1b')][_0xeaff('0x1e')]||null:null,'include':_0x3c2559[_0xeaff('0x1b')]?_0x3c2559[_0xeaff('0x1b')][_0xeaff('0x1f')]?_['map'](_0x3c2559[_0xeaff('0x1b')][_0xeaff('0x1f')],function(_0x10e40b){return{'model':db[_0x10e40b[_0xeaff('0x20')]],'as':_0x10e40b['as'],'attributes':_0x10e40b[_0xeaff('0x1e')],'include':_0x10e40b[_0xeaff('0x1f')]?_['map'](_0x10e40b[_0xeaff('0x1f')],function(_0x221d84){return{'model':db[_0x221d84[_0xeaff('0x20')]],'as':_0x221d84['as'],'attributes':_0x221d84[_0xeaff('0x1e')],'include':_0x221d84[_0xeaff('0x1f')]?_[_0xeaff('0x21')](_0x221d84['include'],function(_0x1156e1){return{'model':db[_0x1156e1[_0xeaff('0x20')]],'as':_0x1156e1['as'],'attributes':_0x1156e1['attributes']};}):[]};}):[]};}):[]:[]})[_0xeaff('0xe')](function(_0x4d35e4){logger[_0xeaff('0xf')](_0xeaff('0x18'),_0x3c2559);logger['debug'](_0xeaff('0x18'),_0x3c2559,JSON[_0xeaff('0x22')](_0x4d35e4));_0x156e03(_0x4d35e4);})[_0xeaff('0x17')](function(_0x17de95){logger[_0xeaff('0x14')](_0xeaff('0x18'),_0x17de95[_0xeaff('0x15')],_0x3c2559);_0x568a5d(_0x4b7701['error'](0x1f4,_0x17de95[_0xeaff('0x15')]));});});}; \ No newline at end of file +var _0x3224=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model','lodash','util','randomstring'];(function(_0x3cc6bb,_0x3f6595){var _0x44d861=function(_0x270b7a){while(--_0x270b7a){_0x3cc6bb['push'](_0x3cc6bb['shift']());}};_0x44d861(++_0x3f6595);}(_0x3224,0x100));var _0x4322=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x3224[_0x49aa7d];return _0xdd0d26;};'use strict';var _=require(_0x4322('0x0'));var util=require(_0x4322('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4322('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4322('0x3'))['db'];var utils=require(_0x4322('0x4'));var logger=require(_0x4322('0x5'))(_0x4322('0x6'));var config=require(_0x4322('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4322('0x8')][_0x4322('0x9')]({'port':0x232a});config[_0x4322('0xa')]=_[_0x4322('0xb')](config['redis'],{'host':_0x4322('0xc'),'port':0x18eb});var socket=require(_0x4322('0xd'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x17ba8b,_0x17b722,_0x5bcf06){return new BPromise(function(_0x23c262,_0x1a774c){return client[_0x4322('0xe')](_0x17ba8b,_0x5bcf06)[_0x4322('0xf')](function(_0x4e6760){logger[_0x4322('0x10')](_0x4322('0x11'),_0x17b722,_0x4322('0x12'));logger[_0x4322('0x13')](_0x4322('0x14'),_0x17b722,_0x4322('0x12'),JSON[_0x4322('0x15')](_0x4e6760));if(_0x4e6760['error']){if(_0x4e6760['error'][_0x4322('0x16')]===0x1f4){logger['error'](_0x4322('0x11'),_0x17b722,_0x4e6760[_0x4322('0x17')][_0x4322('0x18')]);return _0x1a774c(_0x4e6760[_0x4322('0x17')][_0x4322('0x18')]);}logger[_0x4322('0x17')]('SmsAccount,\x20%s,\x20%s',_0x17b722,_0x4e6760['error'][_0x4322('0x18')]);return _0x23c262(_0x4e6760[_0x4322('0x17')]['message']);}else{logger['info'](_0x4322('0x11'),_0x17b722,_0x4322('0x12'));_0x23c262(_0x4e6760[_0x4322('0x19')][_0x4322('0x18')]);}})[_0x4322('0x1a')](function(_0xae163d){logger['error']('SmsAccount,\x20%s,\x20%s',_0x17b722,_0xae163d);_0x1a774c(_0xae163d);});});}exports[_0x4322('0x1b')]=function(_0x2546f2){var _0x2d4cfa=this;return new Promise(function(_0x8dd17e,_0x324725){return db[_0x4322('0x1c')][_0x4322('0x1d')]({'raw':_0x2546f2[_0x4322('0x1e')]?_0x2546f2[_0x4322('0x1e')][_0x4322('0x1f')]===undefined?!![]:![]:!![],'where':_0x2546f2[_0x4322('0x1e')]?_0x2546f2[_0x4322('0x1e')][_0x4322('0x20')]||null:null,'attributes':_0x2546f2[_0x4322('0x1e')]?_0x2546f2[_0x4322('0x1e')][_0x4322('0x21')]||null:null,'include':_0x2546f2['options']?_0x2546f2[_0x4322('0x1e')]['include']?_[_0x4322('0x22')](_0x2546f2[_0x4322('0x1e')][_0x4322('0x23')],function(_0x37c13){return{'model':db[_0x37c13[_0x4322('0x24')]],'as':_0x37c13['as'],'attributes':_0x37c13[_0x4322('0x21')],'include':_0x37c13[_0x4322('0x23')]?_[_0x4322('0x22')](_0x37c13[_0x4322('0x23')],function(_0x5d0e20){return{'model':db[_0x5d0e20['model']],'as':_0x5d0e20['as'],'attributes':_0x5d0e20[_0x4322('0x21')],'include':_0x5d0e20['include']?_['map'](_0x5d0e20['include'],function(_0x10022b){return{'model':db[_0x10022b[_0x4322('0x24')]],'as':_0x10022b['as'],'attributes':_0x10022b[_0x4322('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4322('0xf')](function(_0x38061d){logger[_0x4322('0x10')](_0x4322('0x1b'),_0x2546f2);logger[_0x4322('0x13')](_0x4322('0x1b'),_0x2546f2,JSON['stringify'](_0x38061d));_0x8dd17e(_0x38061d);})[_0x4322('0x1a')](function(_0x3aac52){logger[_0x4322('0x17')](_0x4322('0x1b'),_0x3aac52[_0x4322('0x18')],_0x2546f2);_0x324725(_0x2d4cfa[_0x4322('0x17')](0x1f4,_0x3aac52[_0x4322('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 5945aef..d54a9d4 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 35cb6f9..0042c8a 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x82157d,_0x5dce81){var _0x5db636=function(_0x475229){while(--_0x475229){_0x82157d['push'](_0x82157d['shift']());}};_0x5db636(++_0x5dce81);}(_0x008c,0x188));var _0xc008=function(_0x25446b,_0x5d05aa){_0x25446b=_0x25446b-0x0;var _0x11409e=_0x008c[_0x25446b];return _0x11409e;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1f9edb,_0x120d6d){var _0x4074d9=function(_0xbf109){while(--_0xbf109){_0x1f9edb['push'](_0x1f9edb['shift']());}};_0x4074d9(++_0x120d6d);}(_0x34e8,0x12c));var _0x834e=function(_0x5cbfc4,_0x53f02f){_0x5cbfc4=_0x5cbfc4-0x0;var _0x4157d8=_0x34e8[_0x5cbfc4];return _0x4157d8;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d216267..430f20c 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 _0x99e1=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x40d078,_0x541e13){var _0x52c06b=function(_0x151fb5){while(--_0x151fb5){_0x40d078['push'](_0x40d078['shift']());}};_0x52c06b(++_0x541e13);}(_0x99e1,0xb7));var _0x199e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x99e1[_0x1cfa0d];return _0xe33279;};'use strict';var Sequelize=require(_0x199e('0x0'));module[_0x199e('0x1')]={'priority':{'type':Sequelize[_0x199e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x199e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x199e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x199e('0x5')}}; \ No newline at end of file +var _0xcef5=['TEXT','*,*,*,*','sequelize','STRING'];(function(_0x5d829d,_0x14680a){var _0x25a70f=function(_0x51e77c){while(--_0x51e77c){_0x5d829d['push'](_0x5d829d['shift']());}};_0x25a70f(++_0x14680a);}(_0xcef5,0x1c6));var _0x5cef=function(_0x4f61b9,_0x839784){_0x4f61b9=_0x4f61b9-0x0;var _0x3b37a1=_0xcef5[_0x4f61b9];return _0x3b37a1;};'use strict';var Sequelize=require(_0x5cef('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5cef('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5cef('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5cef('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 9f98459..a6c0218 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 _0xb1bf=['includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options'];(function(_0x2f5fb3,_0x3c8f4d){var _0x3e3478=function(_0x2b0fdb){while(--_0x2b0fdb){_0x2f5fb3['push'](_0x2f5fb3['shift']());}};_0x3e3478(++_0x3c8f4d);}(_0xb1bf,0x178));var _0xfb1b=function(_0x145f44,_0x3256b8){_0x145f44=_0x145f44-0x0;var _0x41c854=_0xb1bf[_0x145f44];return _0x41c854;};'use strict';var emlformat=require(_0xfb1b('0x0'));var rimraf=require(_0xfb1b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb1b('0x2'));var rp=require('request-promise');var moment=require(_0xfb1b('0x3'));var BPromise=require(_0xfb1b('0x4'));var Mustache=require(_0xfb1b('0x5'));var util=require(_0xfb1b('0x6'));var path=require(_0xfb1b('0x7'));var sox=require(_0xfb1b('0x8'));var csv=require('to-csv');var ejs=require(_0xfb1b('0x9'));var fs=require('fs');var fs_extra=require(_0xfb1b('0xa'));var _=require('lodash');var squel=require(_0xfb1b('0xb'));var crypto=require(_0xfb1b('0xc'));var jsforce=require(_0xfb1b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb1b('0xe'));var authService=require(_0xfb1b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfb1b('0x10'));var hardwareService=require(_0xfb1b('0x11'));var logger=require(_0xfb1b('0x12'))('api');var utils=require(_0xfb1b('0x13'));var config=require(_0xfb1b('0x14'));var licenseUtil=require(_0xfb1b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x355241,_0x203bbc){_0x203bbc=_0x203bbc||0xcc;return function(_0x223ff0){if(_0x223ff0){return _0x355241[_0xfb1b('0x16')](_0x203bbc);}return _0x355241[_0xfb1b('0x17')](_0x203bbc)[_0xfb1b('0x18')]();};}function respondWithResult(_0x3c5544,_0xa42e66){_0xa42e66=_0xa42e66||0xc8;return function(_0x25359c){if(_0x25359c){return _0x3c5544[_0xfb1b('0x17')](_0xa42e66)[_0xfb1b('0x19')](_0x25359c);}};}function respondWithFilteredResult(_0x53262b,_0x42d730){return function(_0x2d22e0){if(_0x2d22e0){var _0x17f3b7=typeof _0x42d730[_0xfb1b('0x1a')]===_0xfb1b('0x1b')&&typeof _0x42d730[_0xfb1b('0x1c')]==='undefined';var _0x1db821=_0x2d22e0[_0xfb1b('0x1d')];var _0x2c1f00=_0x17f3b7?0x0:_0x42d730[_0xfb1b('0x1a')];var _0x16388b=_0x17f3b7?_0x2d22e0[_0xfb1b('0x1d')]:_0x42d730[_0xfb1b('0x1a')]+_0x42d730[_0xfb1b('0x1c')];var _0x3e735f;if(_0x16388b>=_0x1db821){_0x16388b=_0x1db821;_0x3e735f=0xc8;}else{_0x3e735f=0xce;}_0x53262b[_0xfb1b('0x17')](_0x3e735f);return _0x53262b[_0xfb1b('0x1e')]('Content-Range',_0x2c1f00+'-'+_0x16388b+'/'+_0x1db821)['json'](_0x2d22e0);}return null;};}function patchUpdates(_0x1f264c){return function(_0x3bfd1b){try{jsonpatch[_0xfb1b('0x1f')](_0x3bfd1b,_0x1f264c,!![]);}catch(_0x1eb3a2){return BPromise['reject'](_0x1eb3a2);}return _0x3bfd1b[_0xfb1b('0x20')]();};}function saveUpdates(_0x5bd05b,_0x58c86a){return function(_0x4084a8){if(_0x4084a8){return _0x4084a8[_0xfb1b('0x21')](_0x5bd05b)['then'](function(_0x516d57){return _0x516d57;});}return null;};}function removeEntity(_0x1fd584,_0x439dd5){return function(_0x1d01c4){if(_0x1d01c4){return _0x1d01c4[_0xfb1b('0x22')]()[_0xfb1b('0x23')](function(){_0x1fd584[_0xfb1b('0x17')](0xcc)[_0xfb1b('0x18')]();});}};}function handleEntityNotFound(_0x2f16f0,_0x5bc6e6){return function(_0x57ec41){if(!_0x57ec41){_0x2f16f0[_0xfb1b('0x16')](0x194);}return _0x57ec41;};}function handleError(_0x3c87fa,_0x21bb07){_0x21bb07=_0x21bb07||0x1f4;return function(_0x4376e9){logger[_0xfb1b('0x24')](_0x4376e9[_0xfb1b('0x25')]);if(_0x4376e9[_0xfb1b('0x26')]){delete _0x4376e9[_0xfb1b('0x26')];}_0x3c87fa[_0xfb1b('0x17')](_0x21bb07)[_0xfb1b('0x27')](_0x4376e9);};}exports[_0xfb1b('0x28')]=function(_0x13fb7b,_0x51dfa3){var _0x25bf9b={},_0x2a81c5={},_0x48bf4b={'count':0x0,'rows':[]};var _0x163c21=_[_0xfb1b('0x29')](db[_0xfb1b('0x2a')][_0xfb1b('0x2b')],function(_0x2aa358){return{'name':_0x2aa358[_0xfb1b('0x2c')],'type':_0x2aa358[_0xfb1b('0x2d')]['key']};});_0x2a81c5['model']=_[_0xfb1b('0x29')](_0x163c21,_0xfb1b('0x26'));_0x2a81c5[_0xfb1b('0x2e')]=_['keys'](_0x13fb7b[_0xfb1b('0x2e')]);_0x2a81c5[_0xfb1b('0x2f')]=_['intersection'](_0x2a81c5[_0xfb1b('0x30')],_0x2a81c5[_0xfb1b('0x2e')]);_0x25bf9b[_0xfb1b('0x31')]=_[_0xfb1b('0x32')](_0x2a81c5['model'],qs[_0xfb1b('0x33')](_0x13fb7b[_0xfb1b('0x2e')]['fields']));_0x25bf9b[_0xfb1b('0x31')]=_0x25bf9b[_0xfb1b('0x31')][_0xfb1b('0x34')]?_0x25bf9b[_0xfb1b('0x31')]:_0x2a81c5['model'];if(!_0x13fb7b[_0xfb1b('0x2e')][_0xfb1b('0x35')](_0xfb1b('0x36'))){_0x25bf9b[_0xfb1b('0x1c')]=qs['limit'](_0x13fb7b[_0xfb1b('0x2e')][_0xfb1b('0x1c')]);_0x25bf9b[_0xfb1b('0x1a')]=qs[_0xfb1b('0x1a')](_0x13fb7b[_0xfb1b('0x2e')][_0xfb1b('0x1a')]);}_0x25bf9b[_0xfb1b('0x37')]=qs[_0xfb1b('0x38')](_0x13fb7b[_0xfb1b('0x2e')][_0xfb1b('0x38')]);_0x25bf9b[_0xfb1b('0x39')]=qs[_0xfb1b('0x2f')](_[_0xfb1b('0x3a')](_0x13fb7b[_0xfb1b('0x2e')],_0x2a81c5[_0xfb1b('0x2f')]),_0x163c21);if(_0x13fb7b['query']['filter']){_0x25bf9b['where']=_[_0xfb1b('0x3b')](_0x25bf9b['where'],{'$or':_[_0xfb1b('0x29')](_0x163c21,function(_0x3b1079){if(_0x3b1079[_0xfb1b('0x2d')]!==_0xfb1b('0x3c')){var _0x24258a={};_0x24258a[_0x3b1079[_0xfb1b('0x26')]]={'$like':'%'+_0x13fb7b[_0xfb1b('0x2e')]['filter']+'%'};return _0x24258a;}})});}_0x25bf9b=_[_0xfb1b('0x3b')]({},_0x25bf9b,_0x13fb7b[_0xfb1b('0x3d')]);var _0x4608c2={'where':_0x25bf9b[_0xfb1b('0x39')]};return db['SmsApplication'][_0xfb1b('0x1d')](_0x4608c2)[_0xfb1b('0x23')](function(_0x56c57a){_0x48bf4b[_0xfb1b('0x1d')]=_0x56c57a;if(_0x13fb7b[_0xfb1b('0x2e')][_0xfb1b('0x3e')]){_0x25bf9b[_0xfb1b('0x3f')]=[{'all':!![]}];}return db[_0xfb1b('0x2a')][_0xfb1b('0x40')](_0x25bf9b);})[_0xfb1b('0x23')](function(_0x19ed57){_0x48bf4b[_0xfb1b('0x41')]=_0x19ed57;return _0x48bf4b;})['then'](respondWithFilteredResult(_0x51dfa3,_0x25bf9b))[_0xfb1b('0x42')](handleError(_0x51dfa3,null));};exports[_0xfb1b('0x43')]=function(_0x5c6786,_0x4db7be){var _0x44e31f={'raw':!![],'where':{'id':_0x5c6786[_0xfb1b('0x44')]['id']}},_0xfe9e67={};_0xfe9e67['model']=_[_0xfb1b('0x45')](db[_0xfb1b('0x2a')][_0xfb1b('0x2b')]);_0xfe9e67['query']=_[_0xfb1b('0x45')](_0x5c6786[_0xfb1b('0x2e')]);_0xfe9e67[_0xfb1b('0x2f')]=_[_0xfb1b('0x32')](_0xfe9e67[_0xfb1b('0x30')],_0xfe9e67[_0xfb1b('0x2e')]);_0x44e31f['attributes']=_[_0xfb1b('0x32')](_0xfe9e67[_0xfb1b('0x30')],qs[_0xfb1b('0x33')](_0x5c6786[_0xfb1b('0x2e')][_0xfb1b('0x33')]));_0x44e31f['attributes']=_0x44e31f[_0xfb1b('0x31')]['length']?_0x44e31f[_0xfb1b('0x31')]:_0xfe9e67[_0xfb1b('0x30')];if(_0x5c6786[_0xfb1b('0x2e')][_0xfb1b('0x3e')]){_0x44e31f[_0xfb1b('0x3f')]=[{'all':!![]}];}_0x44e31f=_[_0xfb1b('0x3b')]({},_0x44e31f,_0x5c6786[_0xfb1b('0x3d')]);return db[_0xfb1b('0x2a')]['find'](_0x44e31f)[_0xfb1b('0x23')](handleEntityNotFound(_0x4db7be,null))[_0xfb1b('0x23')](respondWithResult(_0x4db7be,null))[_0xfb1b('0x42')](handleError(_0x4db7be,null));};exports[_0xfb1b('0x46')]=function(_0x4c854a,_0x274ec4){return db[_0xfb1b('0x2a')][_0xfb1b('0x46')](_0x4c854a[_0xfb1b('0x47')],{})[_0xfb1b('0x23')](respondWithResult(_0x274ec4,0xc9))[_0xfb1b('0x42')](handleError(_0x274ec4,null));};exports[_0xfb1b('0x21')]=function(_0x1476bb,_0x3a363f){if(_0x1476bb['body']['id']){delete _0x1476bb[_0xfb1b('0x47')]['id'];}return db['SmsApplication'][_0xfb1b('0x48')]({'where':{'id':_0x1476bb[_0xfb1b('0x44')]['id']}})[_0xfb1b('0x23')](handleEntityNotFound(_0x3a363f,null))[_0xfb1b('0x23')](saveUpdates(_0x1476bb['body'],null))[_0xfb1b('0x23')](respondWithResult(_0x3a363f,null))[_0xfb1b('0x42')](handleError(_0x3a363f,null));};exports[_0xfb1b('0x22')]=function(_0x5d136f,_0x1007ba){return db[_0xfb1b('0x2a')][_0xfb1b('0x48')]({'where':{'id':_0x5d136f[_0xfb1b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1007ba,null))[_0xfb1b('0x23')](removeEntity(_0x1007ba,null))['catch'](handleError(_0x1007ba,null));}; \ No newline at end of file +var _0x1d29=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','then','end','error','stack','name','map','SmsApplication','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x2a3dc2,_0x5af766){var _0x44515c=function(_0x11db29){while(--_0x11db29){_0x2a3dc2['push'](_0x2a3dc2['shift']());}};_0x44515c(++_0x5af766);}(_0x1d29,0x16e));var _0x91d2=function(_0x9cda45,_0xb96ab0){_0x9cda45=_0x9cda45-0x0;var _0x45a8e5=_0x1d29[_0x9cda45];return _0x45a8e5;};'use strict';var emlformat=require(_0x91d2('0x0'));var rimraf=require(_0x91d2('0x1'));var zipdir=require(_0x91d2('0x2'));var jsonpatch=require(_0x91d2('0x3'));var rp=require(_0x91d2('0x4'));var moment=require(_0x91d2('0x5'));var BPromise=require(_0x91d2('0x6'));var Mustache=require(_0x91d2('0x7'));var util=require(_0x91d2('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x91d2('0x9'));var ejs=require(_0x91d2('0xa'));var fs=require('fs');var fs_extra=require(_0x91d2('0xb'));var _=require(_0x91d2('0xc'));var squel=require(_0x91d2('0xd'));var crypto=require(_0x91d2('0xe'));var jsforce=require(_0x91d2('0xf'));var deskjs=require(_0x91d2('0x10'));var toCsv=require(_0x91d2('0x9'));var querystring=require(_0x91d2('0x11'));var Papa=require('papaparse');var Redis=require(_0x91d2('0x12'));var authService=require(_0x91d2('0x13'));var qs=require(_0x91d2('0x14'));var as=require(_0x91d2('0x15'));var hardwareService=require(_0x91d2('0x16'));var logger=require(_0x91d2('0x17'))(_0x91d2('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91d2('0x19'))['db'];function respondWithStatusCode(_0x48f5d5,_0x4b489d){_0x4b489d=_0x4b489d||0xcc;return function(_0x2c07fd){if(_0x2c07fd){return _0x48f5d5[_0x91d2('0x1a')](_0x4b489d);}return _0x48f5d5[_0x91d2('0x1b')](_0x4b489d)['end']();};}function respondWithResult(_0x3cb0b8,_0x51bf0f){_0x51bf0f=_0x51bf0f||0xc8;return function(_0x413e11){if(_0x413e11){return _0x3cb0b8[_0x91d2('0x1b')](_0x51bf0f)['json'](_0x413e11);}};}function respondWithFilteredResult(_0x3c568b,_0x8370cc){return function(_0x4adef8){if(_0x4adef8){var _0x1db1ca=typeof _0x8370cc['offset']===_0x91d2('0x1c')&&typeof _0x8370cc[_0x91d2('0x1d')]===_0x91d2('0x1c');var _0x1357ca=_0x4adef8[_0x91d2('0x1e')];var _0x3df36f=_0x1db1ca?0x0:_0x8370cc[_0x91d2('0x1f')];var _0x5326dc=_0x1db1ca?_0x4adef8['count']:_0x8370cc[_0x91d2('0x1f')]+_0x8370cc[_0x91d2('0x1d')];var _0x505ce8;if(_0x5326dc>=_0x1357ca){_0x5326dc=_0x1357ca;_0x505ce8=0xc8;}else{_0x505ce8=0xce;}_0x3c568b[_0x91d2('0x1b')](_0x505ce8);return _0x3c568b[_0x91d2('0x20')](_0x91d2('0x21'),_0x3df36f+'-'+_0x5326dc+'/'+_0x1357ca)[_0x91d2('0x22')](_0x4adef8);}return null;};}function patchUpdates(_0x3d1b46){return function(_0xb14056){try{jsonpatch['apply'](_0xb14056,_0x3d1b46,!![]);}catch(_0x90b2a){return BPromise[_0x91d2('0x23')](_0x90b2a);}return _0xb14056[_0x91d2('0x24')]();};}function saveUpdates(_0x419fdc,_0x5df362){return function(_0x531ede){if(_0x531ede){return _0x531ede[_0x91d2('0x25')](_0x419fdc)['then'](function(_0x4b2b07){return _0x4b2b07;});}return null;};}function removeEntity(_0xda831e,_0x5c4408){return function(_0x4f8936){if(_0x4f8936){return _0x4f8936['destroy']()[_0x91d2('0x26')](function(){_0xda831e[_0x91d2('0x1b')](0xcc)[_0x91d2('0x27')]();});}};}function handleEntityNotFound(_0x73645f,_0x43bda1){return function(_0x51badc){if(!_0x51badc){_0x73645f['sendStatus'](0x194);}return _0x51badc;};}function handleError(_0x19120f,_0x4dc61e){_0x4dc61e=_0x4dc61e||0x1f4;return function(_0x3bb9c4){logger[_0x91d2('0x28')](_0x3bb9c4[_0x91d2('0x29')]);if(_0x3bb9c4['name']){delete _0x3bb9c4[_0x91d2('0x2a')];}_0x19120f[_0x91d2('0x1b')](_0x4dc61e)['send'](_0x3bb9c4);};}exports['index']=function(_0x4aaacf,_0x490670){var _0x5f03a1={},_0x3834ac={},_0x230a4a={'count':0x0,'rows':[]};var _0xb84f91=_[_0x91d2('0x2b')](db[_0x91d2('0x2c')][_0x91d2('0x2d')],function(_0x5582e8){return{'name':_0x5582e8[_0x91d2('0x2e')],'type':_0x5582e8['type'][_0x91d2('0x2f')]};});_0x3834ac['model']=_['map'](_0xb84f91,_0x91d2('0x2a'));_0x3834ac[_0x91d2('0x30')]=_[_0x91d2('0x31')](_0x4aaacf[_0x91d2('0x30')]);_0x3834ac[_0x91d2('0x32')]=_[_0x91d2('0x33')](_0x3834ac[_0x91d2('0x34')],_0x3834ac[_0x91d2('0x30')]);_0x5f03a1[_0x91d2('0x35')]=_[_0x91d2('0x33')](_0x3834ac['model'],qs[_0x91d2('0x36')](_0x4aaacf[_0x91d2('0x30')]['fields']));_0x5f03a1['attributes']=_0x5f03a1['attributes']['length']?_0x5f03a1['attributes']:_0x3834ac[_0x91d2('0x34')];if(!_0x4aaacf[_0x91d2('0x30')][_0x91d2('0x37')](_0x91d2('0x38'))){_0x5f03a1[_0x91d2('0x1d')]=qs['limit'](_0x4aaacf[_0x91d2('0x30')][_0x91d2('0x1d')]);_0x5f03a1[_0x91d2('0x1f')]=qs[_0x91d2('0x1f')](_0x4aaacf['query'][_0x91d2('0x1f')]);}_0x5f03a1[_0x91d2('0x39')]=qs[_0x91d2('0x3a')](_0x4aaacf[_0x91d2('0x30')]['sort']);_0x5f03a1[_0x91d2('0x3b')]=qs['filters'](_[_0x91d2('0x3c')](_0x4aaacf[_0x91d2('0x30')],_0x3834ac['filters']),_0xb84f91);if(_0x4aaacf['query'][_0x91d2('0x3d')]){_0x5f03a1[_0x91d2('0x3b')]=_[_0x91d2('0x3e')](_0x5f03a1['where'],{'$or':_[_0x91d2('0x2b')](_0xb84f91,function(_0x34a1ab){if(_0x34a1ab[_0x91d2('0x3f')]!==_0x91d2('0x40')){var _0x19fa20={};_0x19fa20[_0x34a1ab[_0x91d2('0x2a')]]={'$like':'%'+_0x4aaacf[_0x91d2('0x30')][_0x91d2('0x3d')]+'%'};return _0x19fa20;}})});}_0x5f03a1=_[_0x91d2('0x3e')]({},_0x5f03a1,_0x4aaacf[_0x91d2('0x41')]);var _0x5f2b00={'where':_0x5f03a1['where']};return db[_0x91d2('0x2c')][_0x91d2('0x1e')](_0x5f2b00)[_0x91d2('0x26')](function(_0x5401da){_0x230a4a[_0x91d2('0x1e')]=_0x5401da;if(_0x4aaacf[_0x91d2('0x30')]['includeAll']){_0x5f03a1[_0x91d2('0x42')]=[{'all':!![]}];}return db[_0x91d2('0x2c')][_0x91d2('0x43')](_0x5f03a1);})[_0x91d2('0x26')](function(_0x34c5f5){_0x230a4a[_0x91d2('0x44')]=_0x34c5f5;return _0x230a4a;})[_0x91d2('0x26')](respondWithFilteredResult(_0x490670,_0x5f03a1))[_0x91d2('0x45')](handleError(_0x490670,null));};exports[_0x91d2('0x46')]=function(_0x15a592,_0x1a7983){var _0xa12022={'raw':!![],'where':{'id':_0x15a592[_0x91d2('0x47')]['id']}},_0x29d500={};_0x29d500[_0x91d2('0x34')]=_['keys'](db['SmsApplication']['rawAttributes']);_0x29d500['query']=_[_0x91d2('0x31')](_0x15a592[_0x91d2('0x30')]);_0x29d500[_0x91d2('0x32')]=_[_0x91d2('0x33')](_0x29d500[_0x91d2('0x34')],_0x29d500['query']);_0xa12022['attributes']=_['intersection'](_0x29d500[_0x91d2('0x34')],qs[_0x91d2('0x36')](_0x15a592[_0x91d2('0x30')][_0x91d2('0x36')]));_0xa12022[_0x91d2('0x35')]=_0xa12022[_0x91d2('0x35')][_0x91d2('0x48')]?_0xa12022[_0x91d2('0x35')]:_0x29d500[_0x91d2('0x34')];if(_0x15a592[_0x91d2('0x30')][_0x91d2('0x49')]){_0xa12022['include']=[{'all':!![]}];}_0xa12022=_[_0x91d2('0x3e')]({},_0xa12022,_0x15a592['options']);return db['SmsApplication'][_0x91d2('0x4a')](_0xa12022)[_0x91d2('0x26')](handleEntityNotFound(_0x1a7983,null))[_0x91d2('0x26')](respondWithResult(_0x1a7983,null))['catch'](handleError(_0x1a7983,null));};exports['create']=function(_0x841624,_0x24485f){return db[_0x91d2('0x2c')]['create'](_0x841624[_0x91d2('0x4b')],{})[_0x91d2('0x26')](respondWithResult(_0x24485f,0xc9))[_0x91d2('0x45')](handleError(_0x24485f,null));};exports['update']=function(_0x3cd6c5,_0xc39fb9){if(_0x3cd6c5[_0x91d2('0x4b')]['id']){delete _0x3cd6c5[_0x91d2('0x4b')]['id'];}return db[_0x91d2('0x2c')][_0x91d2('0x4a')]({'where':{'id':_0x3cd6c5[_0x91d2('0x47')]['id']}})[_0x91d2('0x26')](handleEntityNotFound(_0xc39fb9,null))[_0x91d2('0x26')](saveUpdates(_0x3cd6c5['body'],null))['then'](respondWithResult(_0xc39fb9,null))[_0x91d2('0x45')](handleError(_0xc39fb9,null));};exports[_0x91d2('0x4c')]=function(_0x3a3a2,_0x21d26d){return db[_0x91d2('0x2c')][_0x91d2('0x4a')]({'where':{'id':_0x3a3a2['params']['id']}})[_0x91d2('0x26')](handleEntityNotFound(_0x21d26d,null))[_0x91d2('0x26')](removeEntity(_0x21d26d,null))[_0x91d2('0x45')](handleError(_0x21d26d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index df23c5c..162ccca 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 _0x1a22=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','rimraf'];(function(_0x2e7829,_0x16fa8f){var _0x55521c=function(_0x1ace9e){while(--_0x1ace9e){_0x2e7829['push'](_0x2e7829['shift']());}};_0x55521c(++_0x16fa8f);}(_0x1a22,0xcc));var _0x21a2=function(_0x3e1829,_0xc8ccda){_0x3e1829=_0x3e1829-0x0;var _0x129345=_0x1a22[_0x3e1829];return _0x129345;};'use strict';var _=require(_0x21a2('0x0'));var util=require(_0x21a2('0x1'));var logger=require(_0x21a2('0x2'))(_0x21a2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x21a2('0x4'));var rimraf=require(_0x21a2('0x5'));var config=require(_0x21a2('0x6'));var attributes=require(_0x21a2('0x7'));module[_0x21a2('0x8')]=function(_0x29b461,_0x2b950c){return _0x29b461[_0x21a2('0x9')](_0x21a2('0xa'),attributes,{'tableName':_0x21a2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x21a2('0xc'),'collate':_0x21a2('0xd')});}; \ No newline at end of file +var _0x3a57=['exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsApplication.attributes'];(function(_0x38c773,_0x199a45){var _0x196e46=function(_0x51e23e){while(--_0x51e23e){_0x38c773['push'](_0x38c773['shift']());}};_0x196e46(++_0x199a45);}(_0x3a57,0xaf));var _0x73a5=function(_0x3508b6,_0xb0cff3){_0x3508b6=_0x3508b6-0x0;var _0x2bc9de=_0x3a57[_0x3508b6];return _0x2bc9de;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x73a5('0x0'))(_0x73a5('0x1'));var moment=require(_0x73a5('0x2'));var BPromise=require(_0x73a5('0x3'));var rp=require(_0x73a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73a5('0x5'));var config=require('../../config/environment');var attributes=require(_0x73a5('0x6'));module[_0x73a5('0x7')]=function(_0x5c7981,_0x28f3b7){return _0x5c7981[_0x73a5('0x8')](_0x73a5('0x9'),attributes,{'tableName':_0x73a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x73a5('0xb'),'collate':_0x73a5('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 71843ee..325b2c1 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 _0xf777=['http','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4cc50b,_0x144ca2){var _0x56f240=function(_0x1dc6b9){while(--_0x1dc6b9){_0x4cc50b['push'](_0x4cc50b['shift']());}};_0x56f240(++_0x144ca2);}(_0xf777,0x1e9));var _0x7f77=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf777[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var moment=require(_0x7f77('0x2'));var BPromise=require(_0x7f77('0x3'));var rs=require(_0x7f77('0x4'));var fs=require('fs');var Redis=require(_0x7f77('0x5'));var db=require(_0x7f77('0x6'))['db'];var utils=require(_0x7f77('0x7'));var logger=require(_0x7f77('0x8'))('rpc');var config=require(_0x7f77('0x9'));var jayson=require(_0x7f77('0xa'));var client=jayson['client'][_0x7f77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53df7d,_0x7bfea,_0x598934){return new BPromise(function(_0x87bd54,_0x322466){return client[_0x7f77('0xc')](_0x53df7d,_0x598934)[_0x7f77('0xd')](function(_0xc8bbae){logger['info']('SmsApplication,\x20%s,\x20%s',_0x7bfea,_0x7f77('0xe'));logger[_0x7f77('0xf')](_0x7f77('0x10'),_0x7bfea,_0x7f77('0xe'),JSON[_0x7f77('0x11')](_0xc8bbae));if(_0xc8bbae['error']){if(_0xc8bbae[_0x7f77('0x12')][_0x7f77('0x13')]===0x1f4){logger[_0x7f77('0x12')](_0x7f77('0x14'),_0x7bfea,_0xc8bbae[_0x7f77('0x12')]['message']);return _0x322466(_0xc8bbae['error'][_0x7f77('0x15')]);}logger[_0x7f77('0x12')](_0x7f77('0x14'),_0x7bfea,_0xc8bbae[_0x7f77('0x12')][_0x7f77('0x15')]);return _0x87bd54(_0xc8bbae[_0x7f77('0x12')][_0x7f77('0x15')]);}else{logger[_0x7f77('0x16')](_0x7f77('0x14'),_0x7bfea,_0x7f77('0xe'));_0x87bd54(_0xc8bbae[_0x7f77('0x17')][_0x7f77('0x15')]);}})[_0x7f77('0x18')](function(_0x3f96e9){logger[_0x7f77('0x12')](_0x7f77('0x14'),_0x7bfea,_0x3f96e9);_0x322466(_0x3f96e9);});});} \ No newline at end of file +var _0x3e94=['rpc','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x15a306,_0xb3968c){var _0x5d4f1b=function(_0x369035){while(--_0x369035){_0x15a306['push'](_0x15a306['shift']());}};_0x5d4f1b(++_0xb3968c);}(_0x3e94,0x67));var _0x43e9=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x3e94[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b35f1,_0x1183a0,_0x2989fe){return new BPromise(function(_0x287aaf,_0x510ee7){return client[_0x43e9('0xa')](_0x4b35f1,_0x2989fe)[_0x43e9('0xb')](function(_0x43d6e8){logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));logger[_0x43e9('0xf')](_0x43e9('0x10'),_0x1183a0,_0x43e9('0xe'),JSON['stringify'](_0x43d6e8));if(_0x43d6e8[_0x43e9('0x11')]){if(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x12')]===0x1f4){logger['error'](_0x43e9('0xd'),_0x1183a0,_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);return _0x510ee7(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}logger['error']('SmsApplication,\x20%s,\x20%s',_0x1183a0,_0x43d6e8[_0x43e9('0x11')]['message']);return _0x287aaf(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}else{logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));_0x287aaf(_0x43d6e8[_0x43e9('0x14')][_0x43e9('0x13')]);}})[_0x43e9('0x15')](function(_0x3f7164){logger[_0x43e9('0x11')](_0x43e9('0xd'),_0x1183a0,_0x3f7164);_0x510ee7(_0x3f7164);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index fb078a8..65316f8 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 _0xe605=['./smsInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','/:id','update','delete','smsinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x52a717,_0x4b0066){var _0x45f2f2=function(_0x94ae49){while(--_0x94ae49){_0x52a717['push'](_0x52a717['shift']());}};_0x45f2f2(++_0x4b0066);}(_0xe605,0x92));var _0x5e60=function(_0x284ee2,_0x38fe54){_0x284ee2=_0x284ee2-0x0;var _0x3c2448=_0xe605[_0x284ee2];return _0x3c2448;};'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')]('/describe',auth[_0x5e60('0xb')](),controller['describe']);router['get']('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x13')]);router[_0x5e60('0x12')](_0x5e60('0x14'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),_0x5e60('0x17')),controller[_0x5e60('0x18')]);router['put'](_0x5e60('0x19'),auth['isAuthenticated'](),interaction[_0x5e60('0x15')](_0x5e60('0x16'),'smsinteraction:update'),controller[_0x5e60('0x1a')]);router[_0x5e60('0x1b')](_0x5e60('0x19'),auth[_0x5e60('0xb')](),interaction['tracked'](_0x5e60('0x16'),_0x5e60('0x1c')),controller['destroy']);router[_0x5e60('0x1b')](_0x5e60('0x14'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x1d')]);module[_0x5e60('0x1e')]=router; \ No newline at end of file +var _0x14a0=['/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','addTags','put','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','/describe','describe','getMessages'];(function(_0x2444f6,_0x39d0a4){var _0x339075=function(_0x537bb2){while(--_0x537bb2){_0x2444f6['push'](_0x2444f6['shift']());}};_0x339075(++_0x39d0a4);}(_0x14a0,0x8e));var _0x014a=function(_0x29d172,_0x130406){_0x29d172=_0x29d172-0x0;var _0xf0fbea=_0x14a0[_0x29d172];return _0xf0fbea;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['get']('/:id',auth[_0x014a('0x9')](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['get'](_0x014a('0xd'),auth[_0x014a('0x9')](),controller['download']);router[_0x014a('0xe')]('/',auth[_0x014a('0x9')](),controller[_0x014a('0xf')]);router[_0x014a('0xe')](_0x014a('0x10'),auth[_0x014a('0x9')](),controller[_0x014a('0x11')]);router[_0x014a('0xe')](_0x014a('0x12'),auth[_0x014a('0x9')](),interaction[_0x014a('0x13')](_0x014a('0x14'),'smsinteraction:addtags'),controller[_0x014a('0x15')]);router[_0x014a('0x16')]('/:id',auth[_0x014a('0x9')](),interaction[_0x014a('0x13')]('sms',_0x014a('0x17')),controller[_0x014a('0x18')]);router[_0x014a('0x19')](_0x014a('0x1a'),auth[_0x014a('0x9')](),interaction[_0x014a('0x13')](_0x014a('0x14'),_0x014a('0x1b')),controller[_0x014a('0x1c')]);router[_0x014a('0x19')](_0x014a('0x12'),auth[_0x014a('0x9')](),controller[_0x014a('0x1d')]);module[_0x014a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 083e53b..40278e4 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 _0x27fb=['exports','DATE','STRING','out','ENUM','BOOLEAN','sequelize','moment'];(function(_0x500502,_0x59101d){var _0x4f713b=function(_0x182f50){while(--_0x182f50){_0x500502['push'](_0x500502['shift']());}};_0x4f713b(++_0x59101d);}(_0x27fb,0x1de));var _0xb27f=function(_0x1df9f4,_0x27c693){_0x1df9f4=_0x1df9f4-0x0;var _0x29f9c5=_0x27fb[_0x1df9f4];return _0x29f9c5;};'use strict';var Sequelize=require(_0xb27f('0x0'));var moment=require(_0xb27f('0x1'));module[_0xb27f('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb27f('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb27f('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb27f('0x4')]},'note':{'type':Sequelize[_0xb27f('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb27f('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xb27f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb27f('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb27f('0x6')]('in',_0xb27f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb27f('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x215d=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x3a35ec,_0x42babf){var _0x44842d=function(_0x1bf3ec){while(--_0x1bf3ec){_0x3a35ec['push'](_0x3a35ec['shift']());}};_0x44842d(++_0x42babf);}(_0x215d,0x187));var _0xd215=function(_0x6fec6f,_0x82e152){_0x6fec6f=_0x6fec6f-0x0;var _0x5e0ce5=_0x215d[_0x6fec6f];return _0x5e0ce5;};'use strict';var Sequelize=require(_0xd215('0x0'));var moment=require('moment');module[_0xd215('0x1')]={'closed':{'type':Sequelize[_0xd215('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd215('0x3')]},'disposition':{'type':Sequelize[_0xd215('0x4')]},'secondDisposition':{'type':Sequelize[_0xd215('0x4')]},'thirdDisposition':{'type':Sequelize[_0xd215('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd215('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd215('0x5')]('in',_0xd215('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd215('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd215('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xd215('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c10aff8..8711af2 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 _0xeecb=['renderFile','views','downloadInteraction.ejs','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','limit','undefined','count','offset','Content-Range','update','then','destroy','end','name','send','index','fieldName','type','findAll','query','catch','show','params','model','keys','SmsInteraction','rawAttributes','filters','intersection','attributes','fields','length','include','merge','options','find','body','describe','addMessage','ids','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','omit','Tag','emit','smsInteractionTags:save','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','Account','get','mkdirSync','Sms','Owner','N.A.','closed','closedAt','out','System','read','value'];(function(_0x772b80,_0x39b2be){var _0x30b292=function(_0x599382){while(--_0x599382){_0x772b80['push'](_0x772b80['shift']());}};_0x30b292(++_0x39b2be);}(_0xeecb,0x7d));var _0xbeec=function(_0x19f727,_0x28224e){_0x19f727=_0x19f727-0x0;var _0x412836=_0xeecb[_0x19f727];return _0x412836;};'use strict';var rimraf=require(_0xbeec('0x0'));var zipdir=require(_0xbeec('0x1'));var moment=require('moment');var BPromise=require(_0xbeec('0x2'));var util=require(_0xbeec('0x3'));var path=require(_0xbeec('0x4'));var ejs=require(_0xbeec('0x5'));var fs=require('fs');var _=require(_0xbeec('0x6'));var Redis=require('ioredis');var interaction=require(_0xbeec('0x7'));var qs=require(_0xbeec('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xbeec('0x9'))('api');var config=require(_0xbeec('0xa'));var db=require('../../mysqldb')['db'];config[_0xbeec('0xb')]=_[_0xbeec('0xc')](config['redis'],{'host':_0xbeec('0xd'),'port':0x18eb});var socket=require(_0xbeec('0xe'))(new Redis(config[_0xbeec('0xb')]));require(_0xbeec('0xf'))[_0xbeec('0x10')](socket);function respondWithStatusCode(_0x43a5bf,_0x5e53c1){_0x5e53c1=_0x5e53c1||0xcc;return function(_0x401fd3){if(_0x401fd3){return _0x43a5bf[_0xbeec('0x11')](_0x5e53c1);}return _0x43a5bf['status'](_0x5e53c1)['end']();};}function respondWithResult(_0x40823f,_0x1e8040){_0x1e8040=_0x1e8040||0xc8;return function(_0x5819dc){if(_0x5819dc){return _0x40823f[_0xbeec('0x12')](_0x1e8040)[_0xbeec('0x13')](_0x5819dc);}};}function respondWithFilteredResult(_0x5f251c,_0x46c4d6){return function(_0x268bb8){if(_0x268bb8){var _0xd065ae=typeof _0x46c4d6['offset']==='undefined'&&typeof _0x46c4d6[_0xbeec('0x14')]===_0xbeec('0x15');var _0x58de92=_0x268bb8[_0xbeec('0x16')];var _0x383ca4=_0xd065ae?0x0:_0x46c4d6[_0xbeec('0x17')];var _0x248656=_0xd065ae?_0x268bb8[_0xbeec('0x16')]:_0x46c4d6[_0xbeec('0x17')]+_0x46c4d6[_0xbeec('0x14')];var _0x45df33;if(_0x248656>=_0x58de92){_0x248656=_0x58de92;_0x45df33=0xc8;}else{_0x45df33=0xce;}_0x5f251c[_0xbeec('0x12')](_0x45df33);return _0x5f251c['set'](_0xbeec('0x18'),_0x383ca4+'-'+_0x248656+'/'+_0x58de92)['json'](_0x268bb8);}return null;};}function saveUpdates(_0x2e3321){return function(_0x1aeb86){if(_0x1aeb86){return _0x1aeb86[_0xbeec('0x19')](_0x2e3321)[_0xbeec('0x1a')](function(_0x3e1c69){return _0x3e1c69;});}return null;};}function removeEntity(_0x2c12e0){return function(_0x257c75){if(_0x257c75){return _0x257c75[_0xbeec('0x1b')]()[_0xbeec('0x1a')](function(){_0x2c12e0[_0xbeec('0x12')](0xcc)[_0xbeec('0x1c')]();});}};}function handleEntityNotFound(_0x43f6a8){return function(_0x3b3ef5){if(!_0x3b3ef5){_0x43f6a8[_0xbeec('0x11')](0x194);}return _0x3b3ef5;};}function handleError(_0x53ce2e,_0x315427){_0x315427=_0x315427||0x1f4;return function(_0x3bfff7){logger['error'](_0x3bfff7['stack']);if(_0x3bfff7[_0xbeec('0x1d')]){delete _0x3bfff7['name'];}_0x53ce2e['status'](_0x315427)[_0xbeec('0x1e')](_0x3bfff7);};}exports[_0xbeec('0x1f')]=function(_0x220c82,_0xfe0363){var _0x5c8959={};var _0x290f19=_['map'](db['SmsInteraction']['rawAttributes'],function(_0x38c530){return{'name':_0x38c530[_0xbeec('0x20')],'type':_0x38c530[_0xbeec('0x21')]['key']};});_0x5c8959=qs['getOptions'](_0x290f19,_0x220c82);return interaction[_0xbeec('0x22')]('sms',_0x220c82[_0xbeec('0x23')],_0x220c82['user'],_0x5c8959,_0x290f19)['then'](respondWithFilteredResult(_0xfe0363,_0x5c8959))[_0xbeec('0x24')](handleError(_0xfe0363,null));};exports[_0xbeec('0x25')]=function(_0x37f26,_0x432e13){var _0x1fbda8={'raw':![],'where':{'id':_0x37f26[_0xbeec('0x26')]['id']}},_0x49e79f={};_0x49e79f[_0xbeec('0x27')]=_[_0xbeec('0x28')](db[_0xbeec('0x29')][_0xbeec('0x2a')]);_0x49e79f[_0xbeec('0x23')]=_[_0xbeec('0x28')](_0x37f26['query']);_0x49e79f[_0xbeec('0x2b')]=_[_0xbeec('0x2c')](_0x49e79f['model'],_0x49e79f[_0xbeec('0x23')]);_0x1fbda8[_0xbeec('0x2d')]=_['intersection'](_0x49e79f[_0xbeec('0x27')],qs['fields'](_0x37f26[_0xbeec('0x23')][_0xbeec('0x2e')]));_0x1fbda8[_0xbeec('0x2d')]=_0x1fbda8[_0xbeec('0x2d')][_0xbeec('0x2f')]?_0x1fbda8[_0xbeec('0x2d')]:_0x49e79f[_0xbeec('0x27')];if(_0x37f26[_0xbeec('0x23')]['includeAll']){_0x1fbda8[_0xbeec('0x30')]=[{'all':!![]}];}_0x1fbda8=_[_0xbeec('0x31')]({},_0x1fbda8,_0x37f26[_0xbeec('0x32')]);return db[_0xbeec('0x29')][_0xbeec('0x33')](_0x1fbda8)[_0xbeec('0x1a')](handleEntityNotFound(_0x432e13,null))['then'](respondWithResult(_0x432e13,null))[_0xbeec('0x24')](handleError(_0x432e13,null));};exports['create']=function(_0x49bd8a,_0x4a4da9){return db[_0xbeec('0x29')]['create'](_0x49bd8a[_0xbeec('0x34')],{})[_0xbeec('0x1a')](respondWithResult(_0x4a4da9,0xc9))[_0xbeec('0x24')](handleError(_0x4a4da9,null));};exports[_0xbeec('0x19')]=function(_0x1e359d,_0x214942){if(_0x1e359d[_0xbeec('0x34')]['id']){delete _0x1e359d[_0xbeec('0x34')]['id'];}return db['SmsInteraction'][_0xbeec('0x33')]({'where':{'id':_0x1e359d[_0xbeec('0x26')]['id']}})[_0xbeec('0x1a')](handleEntityNotFound(_0x214942,null))[_0xbeec('0x1a')](saveUpdates(_0x1e359d[_0xbeec('0x34')],null))[_0xbeec('0x1a')](respondWithResult(_0x214942,null))[_0xbeec('0x24')](handleError(_0x214942,null));};exports[_0xbeec('0x1b')]=function(_0x2669b3,_0x5794a6){return db[_0xbeec('0x29')]['find']({'where':{'id':_0x2669b3[_0xbeec('0x26')]['id']}})[_0xbeec('0x1a')](handleEntityNotFound(_0x5794a6,null))[_0xbeec('0x1a')](removeEntity(_0x5794a6,null))[_0xbeec('0x24')](handleError(_0x5794a6,null));};exports[_0xbeec('0x35')]=function(_0x56bedf,_0x582155){return db[_0xbeec('0x29')][_0xbeec('0x35')]()[_0xbeec('0x1a')](respondWithResult(_0x582155,null))[_0xbeec('0x24')](handleError(_0x582155,null));};exports['addMessage']=function(_0x480c74,_0x4b60a9){return db['SmsMessage'][_0xbeec('0x33')]({'where':{'id':_0x480c74[_0xbeec('0x26')]['id']}})[_0xbeec('0x1a')](handleEntityNotFound(_0x4b60a9,null))[_0xbeec('0x1a')](function(_0x5cdaca){if(_0x5cdaca){return _0x5cdaca[_0xbeec('0x36')](_0x480c74['body'][_0xbeec('0x37')],_['omit'](_0x480c74[_0xbeec('0x34')],[_0xbeec('0x37'),'id'])||{});}})[_0xbeec('0x1a')](respondWithResult(_0x4b60a9,null))[_0xbeec('0x24')](handleError(_0x4b60a9,null));};exports[_0xbeec('0x38')]=function(_0x5794e9,_0x5e7184){var _0x4fb079={'raw':![],'where':{}};var _0x3c541d={};var _0xa5283b={'count':0x0,'rows':[]};return db[_0xbeec('0x29')][_0xbeec('0x39')]({'where':{'id':_0x5794e9[_0xbeec('0x26')]['id']}})[_0xbeec('0x1a')](handleEntityNotFound(_0x5e7184,null))[_0xbeec('0x1a')](function(_0x33718f){if(_0x33718f){_0x3c541d[_0xbeec('0x27')]=_['keys'](db[_0xbeec('0x3a')][_0xbeec('0x2a')]);_0x3c541d['query']=_[_0xbeec('0x28')](_0x5794e9[_0xbeec('0x23')]);_0x3c541d[_0xbeec('0x2b')]=_[_0xbeec('0x2c')](_0x3c541d[_0xbeec('0x27')],_0x3c541d[_0xbeec('0x23')]);_0x4fb079[_0xbeec('0x2d')]=_['intersection'](_0x3c541d[_0xbeec('0x27')],qs[_0xbeec('0x2e')](_0x5794e9['query'][_0xbeec('0x2e')]));_0x4fb079[_0xbeec('0x2d')]=_0x4fb079['attributes'][_0xbeec('0x2f')]?_0x4fb079[_0xbeec('0x2d')]:_0x3c541d[_0xbeec('0x27')];if(!_0x5794e9[_0xbeec('0x23')][_0xbeec('0x3b')](_0xbeec('0x3c'))){_0x4fb079['limit']=qs['limit'](_0x5794e9[_0xbeec('0x23')][_0xbeec('0x14')]);_0x4fb079['offset']=qs[_0xbeec('0x17')](_0x5794e9[_0xbeec('0x23')]['offset']);}_0x4fb079[_0xbeec('0x3d')]=qs[_0xbeec('0x3e')](_0x5794e9['query'][_0xbeec('0x3e')]);_0x4fb079[_0xbeec('0x3f')]=qs[_0xbeec('0x2b')](_[_0xbeec('0x40')](_0x5794e9[_0xbeec('0x23')],_0x3c541d['filters']));_0x4fb079[_0xbeec('0x3f')][_0xbeec('0x41')]=_0x33718f['id'];if(_0x5794e9[_0xbeec('0x23')][_0xbeec('0x42')]){_0x4fb079[_0xbeec('0x3f')]=_[_0xbeec('0x31')](_0x4fb079[_0xbeec('0x3f')],{'$or':_[_0xbeec('0x43')](_0x4fb079[_0xbeec('0x2d')],function(_0xb0fde8){var _0x5ad3d5={};_0x5ad3d5[_0xb0fde8]={'$like':'%'+_0x5794e9[_0xbeec('0x23')][_0xbeec('0x42')]+'%'};return _0x5ad3d5;})});}if(_0x5794e9[_0xbeec('0x23')][_0xbeec('0x44')]){var _0x116d08=_0x5794e9[_0xbeec('0x23')]['$gte']['split'](',');var _0x5e3c48={};_0x5e3c48[_0x116d08[0x0]]={'$gte':moment(_0x116d08[0x1])[_0xbeec('0x45')](_0xbeec('0x46'))};_0x4fb079['where']=_[_0xbeec('0x31')](_0x4fb079[_0xbeec('0x3f')],_0x5e3c48);}_0x4fb079=_['merge']({},_0x4fb079,_0x5794e9[_0xbeec('0x32')]);return db[_0xbeec('0x3a')][_0xbeec('0x16')]({'where':_0x4fb079[_0xbeec('0x3f')]})['then'](function(_0x1aca42){_0xa5283b[_0xbeec('0x16')]=_0x1aca42;if(_0x5794e9[_0xbeec('0x23')][_0xbeec('0x47')]){_0x4fb079[_0xbeec('0x30')]=[{'all':!![]}];}return db[_0xbeec('0x3a')][_0xbeec('0x22')](_0x4fb079);})[_0xbeec('0x1a')](function(_0x1cd7e2){_0xa5283b[_0xbeec('0x48')]=_0x1cd7e2;return _0xa5283b;});}})[_0xbeec('0x1a')](respondWithFilteredResult(_0x5e7184,_0x4fb079))[_0xbeec('0x24')](handleError(_0x5e7184,null));};exports['addTags']=function(_0x12204a,_0x24c644){return db[_0xbeec('0x29')]['find']({'where':{'id':_0x12204a['params']['id']}})[_0xbeec('0x1a')](handleEntityNotFound(_0x24c644,null))[_0xbeec('0x1a')](function(_0xfed810){if(_0xfed810){return _0xfed810[_0xbeec('0x49')](_0x12204a[_0xbeec('0x34')][_0xbeec('0x37')],_[_0xbeec('0x4a')](_0x12204a[_0xbeec('0x34')],['ids','id'])||{})['spread'](function(){return db[_0xbeec('0x4b')]['findAll']({'attributes':['id',_0xbeec('0x1d'),'color'],'where':{'id':_0x12204a[_0xbeec('0x34')][_0xbeec('0x37')]}});})[_0xbeec('0x1a')](function(_0x451c62){socket[_0xbeec('0x4c')](_0xbeec('0x4d'),{'id':Number(_0x12204a[_0xbeec('0x26')]['id']),'tags':_0x451c62||[]});return{'id':Number(_0x12204a[_0xbeec('0x26')]['id']),'tags':_0x451c62||[]};});}})[_0xbeec('0x1a')](respondWithResult(_0x24c644,null))[_0xbeec('0x24')](handleError(_0x24c644,null));};exports['removeTags']=function(_0x4c2ea2,_0x57aaa4){return db[_0xbeec('0x29')][_0xbeec('0x33')]({'where':{'id':_0x4c2ea2[_0xbeec('0x26')]['id']}})[_0xbeec('0x1a')](handleEntityNotFound(_0x57aaa4,null))[_0xbeec('0x1a')](function(_0x230608){if(_0x230608){return _0x230608['removeTags'](_0x4c2ea2[_0xbeec('0x23')][_0xbeec('0x37')]);}})[_0xbeec('0x1a')](respondWithStatusCode(_0x57aaa4,null))[_0xbeec('0x24')](handleError(_0x57aaa4,null));};exports['download']=function(_0x2c644b,_0x237697){var _0x491aff=moment()[_0xbeec('0x4e')]()[_0xbeec('0x4f')]();var _0x17f9d3=path[_0xbeec('0x50')](config[_0xbeec('0x51')],_0xbeec('0x52'),_0xbeec('0x53'),'tmp');var _0x4da617=path[_0xbeec('0x50')](_0x17f9d3,_0x491aff);var _0x401063=util['format'](_0xbeec('0x54'),_0x2c644b[_0xbeec('0x26')]['id'],_0x491aff);var _0xe1a393=path[_0xbeec('0x50')](_0x17f9d3,_0x401063);var _0x1e49f7=[];_0x1e49f7[_0xbeec('0x55')]({'model':db['User'],'as':_0xbeec('0x56'),'attributes':['id',_0xbeec('0x57')],'raw':!![]});_0x1e49f7[_0xbeec('0x55')]({'model':db[_0xbeec('0x58')],'as':_0xbeec('0x59'),'attributes':['id',_0xbeec('0x5a'),_0xbeec('0x5b')],'raw':!![]});var _0x39ef23=[{'model':db['SmsMessage'],'as':_0xbeec('0x5c'),'attributes':['id',_0xbeec('0x34'),_0xbeec('0x5d'),_0xbeec('0x5e'),'secret','read'],'include':_0x1e49f7}];_0x39ef23['push']({'model':db['SmsAccount'],'as':_0xbeec('0x5f'),'attributes':['id',_0xbeec('0x1d')]});_0x39ef23[_0xbeec('0x55')]({'model':db['User'],'as':'Owner','attributes':['id',_0xbeec('0x57')]});return db[_0xbeec('0x29')][_0xbeec('0x33')]({'where':{'id':_0x2c644b[_0xbeec('0x26')]['id']},'include':_0x39ef23})[_0xbeec('0x1a')](handleEntityNotFound(_0x237697,null))[_0xbeec('0x1a')](function(_0x32c8f6){if(_0x32c8f6){var _0x5a871b=_0x32c8f6[_0xbeec('0x60')]({'plain':!![]});fs[_0xbeec('0x61')](_0x4da617);var _0x37ed9b={'channel':_0xbeec('0x62'),'account':_0x5a871b['Account']['name'],'agent':_0x5a871b[_0xbeec('0x63')]?_0x5a871b[_0xbeec('0x63')]['fullname']:_0xbeec('0x64'),'createdAt':moment(_0x5a871b['createdAt'])['format'](_0xbeec('0x46'))[_0xbeec('0x4f')](),'closedAt':_0x5a871b[_0xbeec('0x65')]?moment(_0x5a871b[_0xbeec('0x66')])['format'](_0xbeec('0x46'))['toString']():'','disposition':_0x5a871b['disposition'],'messages':_(_0x5a871b[_0xbeec('0x5c')])[_0xbeec('0x42')]({'secret':![]})['map'](function(_0x343abc){return{'date':moment(_0x343abc[_0xbeec('0x5d')])['format'](_0xbeec('0x46'))['toString'](),'sender':_0x343abc['direction']===_0xbeec('0x67')?_0x343abc[_0xbeec('0x56')]?_0x343abc['User'][_0xbeec('0x57')]:_0xbeec('0x68'):_0x343abc[_0xbeec('0x59')][_0xbeec('0x5a')]+(_0x343abc['Contact']['lastName']?'\x20'+_0x343abc[_0xbeec('0x59')][_0xbeec('0x5b')]:''),'body':_0x343abc[_0xbeec('0x34')],'direction':_0x343abc[_0xbeec('0x5e')]===_0xbeec('0x67')?'A':'C','secret':_0x343abc['secret'],'read':_0x343abc[_0xbeec('0x69')]};})[_0xbeec('0x6a')]()};return ejs[_0xbeec('0x6b')](path['join'](config[_0xbeec('0x51')],_0xbeec('0x52'),_0xbeec('0x6c'),_0xbeec('0x6d')),{'interaction':_0x37ed9b})[_0xbeec('0x1a')](function(_0x1e0858){var _0x55d30e=path[_0xbeec('0x50')](_0x4da617,_0xbeec('0x6e')+_0x5a871b['id']+'-'+_0x491aff+_0xbeec('0x6f'));var _0x503899={'path':_0x55d30e,'channel':'Sms','interactionId':_0x5a871b['id']};return pdf['createPdfFromHTML'](_0x1e0858,_0x503899);})[_0xbeec('0x1a')](function(){return new BPromise(function(_0x1cbbec,_0x3d9ea1){zipdir(_0x4da617,{'saveTo':_0xe1a393},function(_0x37638e,_0xc445d4){if(_0x37638e)return _0x3d9ea1(_0x37638e);return _0x1cbbec(_0xc445d4);});})[_0xbeec('0x1a')](function(){return new BPromise(function(_0xd8482f,_0x1aec4e){rimraf(_0x4da617,function(_0x211746){if(_0x211746)_0x1aec4e(_0x211746);return _0xd8482f();});});})[_0xbeec('0x1a')](function(){return _0x237697[_0xbeec('0x70')](_0xe1a393,_0x401063,function(_0x438a8a){if(_0x438a8a){console[_0xbeec('0x71')](_0xbeec('0x72'),_0x438a8a);}else{fs[_0xbeec('0x73')](_0xe1a393);}});});});}else{return _0x237697[_0xbeec('0x11')](0xc8);}})[_0xbeec('0x24')](handleError(_0x237697,null));}; \ No newline at end of file +var _0xd112=['moment','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','undefined','limit','offset','Content-Range','json','update','then','destroy','error','name','send','index','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','omit','findOne','SmsMessage','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','map','$gte','split','count','rows','addTags','setTags','ids','spread','Tag','color','removeTags','download','unix','toString','join','root','files','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','Account','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','out','System','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','rimraf'];(function(_0x25bf68,_0x175021){var _0x503c5f=function(_0x34dca0){while(--_0x34dca0){_0x25bf68['push'](_0x25bf68['shift']());}};_0x503c5f(++_0x175021);}(_0xd112,0x76));var _0x2d11=function(_0x4572c7,_0x49785c){_0x4572c7=_0x4572c7-0x0;var _0x573aa1=_0xd112[_0x4572c7];return _0x573aa1;};'use strict';var rimraf=require(_0x2d11('0x0'));var zipdir=require('zip-dir');var moment=require(_0x2d11('0x1'));var BPromise=require('bluebird');var util=require(_0x2d11('0x2'));var path=require(_0x2d11('0x3'));var ejs=require(_0x2d11('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x2d11('0x5'));var qs=require(_0x2d11('0x6'));var pdf=require(_0x2d11('0x7'));var logger=require(_0x2d11('0x8'))(_0x2d11('0x9'));var config=require(_0x2d11('0xa'));var db=require(_0x2d11('0xb'))['db'];config['redis']=_[_0x2d11('0xc')](config[_0x2d11('0xd')],{'host':_0x2d11('0xe'),'port':0x18eb});var socket=require(_0x2d11('0xf'))(new Redis(config['redis']));require(_0x2d11('0x10'))[_0x2d11('0x11')](socket);function respondWithStatusCode(_0x420dd5,_0xbc2b0b){_0xbc2b0b=_0xbc2b0b||0xcc;return function(_0x180596){if(_0x180596){return _0x420dd5[_0x2d11('0x12')](_0xbc2b0b);}return _0x420dd5[_0x2d11('0x13')](_0xbc2b0b)[_0x2d11('0x14')]();};}function respondWithResult(_0x3dedd6,_0x103888){_0x103888=_0x103888||0xc8;return function(_0x94a2e5){if(_0x94a2e5){return _0x3dedd6[_0x2d11('0x13')](_0x103888)['json'](_0x94a2e5);}};}function respondWithFilteredResult(_0x4da8f6,_0x17d1b4){return function(_0x370a5c){if(_0x370a5c){var _0x6f422b=typeof _0x17d1b4['offset']===_0x2d11('0x15')&&typeof _0x17d1b4[_0x2d11('0x16')]==='undefined';var _0x539d91=_0x370a5c['count'];var _0x100259=_0x6f422b?0x0:_0x17d1b4[_0x2d11('0x17')];var _0x2feef3=_0x6f422b?_0x370a5c['count']:_0x17d1b4[_0x2d11('0x17')]+_0x17d1b4['limit'];var _0x31fb46;if(_0x2feef3>=_0x539d91){_0x2feef3=_0x539d91;_0x31fb46=0xc8;}else{_0x31fb46=0xce;}_0x4da8f6[_0x2d11('0x13')](_0x31fb46);return _0x4da8f6['set'](_0x2d11('0x18'),_0x100259+'-'+_0x2feef3+'/'+_0x539d91)[_0x2d11('0x19')](_0x370a5c);}return null;};}function saveUpdates(_0x4d7754){return function(_0x4270dd){if(_0x4270dd){return _0x4270dd[_0x2d11('0x1a')](_0x4d7754)[_0x2d11('0x1b')](function(_0xf822b6){return _0xf822b6;});}return null;};}function removeEntity(_0x292688){return function(_0x5eb60c){if(_0x5eb60c){return _0x5eb60c[_0x2d11('0x1c')]()[_0x2d11('0x1b')](function(){_0x292688[_0x2d11('0x13')](0xcc)[_0x2d11('0x14')]();});}};}function handleEntityNotFound(_0x4bfc75){return function(_0x3a2916){if(!_0x3a2916){_0x4bfc75[_0x2d11('0x12')](0x194);}return _0x3a2916;};}function handleError(_0x17c01c,_0x12ec1c){_0x12ec1c=_0x12ec1c||0x1f4;return function(_0x3a3ac2){logger[_0x2d11('0x1d')](_0x3a3ac2['stack']);if(_0x3a3ac2['name']){delete _0x3a3ac2[_0x2d11('0x1e')];}_0x17c01c['status'](_0x12ec1c)[_0x2d11('0x1f')](_0x3a3ac2);};}exports[_0x2d11('0x20')]=function(_0x231b24,_0x29c180){var _0x2f367d={};var _0x3e6914=_['map'](db[_0x2d11('0x21')][_0x2d11('0x22')],function(_0x279556){return{'name':_0x279556[_0x2d11('0x23')],'type':_0x279556[_0x2d11('0x24')]['key']};});_0x2f367d=qs[_0x2d11('0x25')](_0x3e6914,_0x231b24);return interaction[_0x2d11('0x26')](_0x2d11('0x27'),_0x231b24[_0x2d11('0x28')],_0x231b24[_0x2d11('0x29')],_0x2f367d,_0x3e6914)[_0x2d11('0x1b')](respondWithFilteredResult(_0x29c180,_0x2f367d))[_0x2d11('0x2a')](handleError(_0x29c180,null));};exports[_0x2d11('0x2b')]=function(_0x30b20e,_0x48c630){var _0x13ab1b={'raw':![],'where':{'id':_0x30b20e[_0x2d11('0x2c')]['id']}},_0x235faa={};_0x235faa[_0x2d11('0x2d')]=_['keys'](db['SmsInteraction'][_0x2d11('0x22')]);_0x235faa[_0x2d11('0x28')]=_[_0x2d11('0x2e')](_0x30b20e['query']);_0x235faa[_0x2d11('0x2f')]=_[_0x2d11('0x30')](_0x235faa['model'],_0x235faa[_0x2d11('0x28')]);_0x13ab1b[_0x2d11('0x31')]=_[_0x2d11('0x30')](_0x235faa[_0x2d11('0x2d')],qs[_0x2d11('0x32')](_0x30b20e[_0x2d11('0x28')]['fields']));_0x13ab1b[_0x2d11('0x31')]=_0x13ab1b['attributes'][_0x2d11('0x33')]?_0x13ab1b[_0x2d11('0x31')]:_0x235faa['model'];if(_0x30b20e[_0x2d11('0x28')][_0x2d11('0x34')]){_0x13ab1b[_0x2d11('0x35')]=[{'all':!![]}];}_0x13ab1b=_[_0x2d11('0x36')]({},_0x13ab1b,_0x30b20e[_0x2d11('0x37')]);return db['SmsInteraction'][_0x2d11('0x38')](_0x13ab1b)[_0x2d11('0x1b')](handleEntityNotFound(_0x48c630,null))[_0x2d11('0x1b')](respondWithResult(_0x48c630,null))['catch'](handleError(_0x48c630,null));};exports[_0x2d11('0x39')]=function(_0x2aeee4,_0x166141){return db[_0x2d11('0x21')]['create'](_0x2aeee4[_0x2d11('0x3a')],{})[_0x2d11('0x1b')](respondWithResult(_0x166141,0xc9))['catch'](handleError(_0x166141,null));};exports['update']=function(_0x465a19,_0x567a35){if(_0x465a19[_0x2d11('0x3a')]['id']){delete _0x465a19['body']['id'];}return db['SmsInteraction'][_0x2d11('0x38')]({'where':{'id':_0x465a19['params']['id']}})[_0x2d11('0x1b')](handleEntityNotFound(_0x567a35,null))['then'](saveUpdates(_0x465a19[_0x2d11('0x3a')],null))['then'](respondWithResult(_0x567a35,null))[_0x2d11('0x2a')](handleError(_0x567a35,null));};exports['destroy']=function(_0x111a19,_0x420550){return db[_0x2d11('0x21')][_0x2d11('0x38')]({'where':{'id':_0x111a19[_0x2d11('0x2c')]['id']}})[_0x2d11('0x1b')](handleEntityNotFound(_0x420550,null))[_0x2d11('0x1b')](removeEntity(_0x420550,null))['catch'](handleError(_0x420550,null));};exports[_0x2d11('0x3b')]=function(_0x58c714,_0xd1ad50){return db[_0x2d11('0x21')]['describe']()[_0x2d11('0x1b')](respondWithResult(_0xd1ad50,null))['catch'](handleError(_0xd1ad50,null));};exports[_0x2d11('0x3c')]=function(_0x4257f2,_0x24b25d){return db['SmsMessage'][_0x2d11('0x38')]({'where':{'id':_0x4257f2[_0x2d11('0x2c')]['id']}})[_0x2d11('0x1b')](handleEntityNotFound(_0x24b25d,null))[_0x2d11('0x1b')](function(_0x275038){if(_0x275038){return _0x275038[_0x2d11('0x3c')](_0x4257f2[_0x2d11('0x3a')]['ids'],_[_0x2d11('0x3d')](_0x4257f2[_0x2d11('0x3a')],['ids','id'])||{});}})[_0x2d11('0x1b')](respondWithResult(_0x24b25d,null))[_0x2d11('0x2a')](handleError(_0x24b25d,null));};exports['getMessages']=function(_0x20a80a,_0x1c52dc){var _0x2426d0={'raw':![],'where':{}};var _0x33336d={};var _0x5c95a9={'count':0x0,'rows':[]};return db[_0x2d11('0x21')][_0x2d11('0x3e')]({'where':{'id':_0x20a80a['params']['id']}})['then'](handleEntityNotFound(_0x1c52dc,null))[_0x2d11('0x1b')](function(_0x106544){if(_0x106544){_0x33336d[_0x2d11('0x2d')]=_['keys'](db[_0x2d11('0x3f')][_0x2d11('0x22')]);_0x33336d[_0x2d11('0x28')]=_[_0x2d11('0x2e')](_0x20a80a[_0x2d11('0x28')]);_0x33336d[_0x2d11('0x2f')]=_[_0x2d11('0x30')](_0x33336d[_0x2d11('0x2d')],_0x33336d[_0x2d11('0x28')]);_0x2426d0[_0x2d11('0x31')]=_[_0x2d11('0x30')](_0x33336d[_0x2d11('0x2d')],qs[_0x2d11('0x32')](_0x20a80a['query'][_0x2d11('0x32')]));_0x2426d0[_0x2d11('0x31')]=_0x2426d0[_0x2d11('0x31')][_0x2d11('0x33')]?_0x2426d0[_0x2d11('0x31')]:_0x33336d[_0x2d11('0x2d')];if(!_0x20a80a[_0x2d11('0x28')][_0x2d11('0x40')](_0x2d11('0x41'))){_0x2426d0['limit']=qs[_0x2d11('0x16')](_0x20a80a[_0x2d11('0x28')][_0x2d11('0x16')]);_0x2426d0[_0x2d11('0x17')]=qs[_0x2d11('0x17')](_0x20a80a[_0x2d11('0x28')][_0x2d11('0x17')]);}_0x2426d0['order']=qs['sort'](_0x20a80a[_0x2d11('0x28')][_0x2d11('0x42')]);_0x2426d0[_0x2d11('0x43')]=qs[_0x2d11('0x2f')](_['pick'](_0x20a80a[_0x2d11('0x28')],_0x33336d['filters']));_0x2426d0['where'][_0x2d11('0x44')]=_0x106544['id'];if(_0x20a80a['query'][_0x2d11('0x45')]){_0x2426d0['where']=_[_0x2d11('0x36')](_0x2426d0[_0x2d11('0x43')],{'$or':_[_0x2d11('0x46')](_0x2426d0[_0x2d11('0x31')],function(_0x17001f){var _0x3a394e={};_0x3a394e[_0x17001f]={'$like':'%'+_0x20a80a[_0x2d11('0x28')]['filter']+'%'};return _0x3a394e;})});}if(_0x20a80a[_0x2d11('0x28')][_0x2d11('0x47')]){var _0x2655cd=_0x20a80a[_0x2d11('0x28')][_0x2d11('0x47')][_0x2d11('0x48')](',');var _0x32552a={};_0x32552a[_0x2655cd[0x0]]={'$gte':moment(_0x2655cd[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2426d0['where']=_[_0x2d11('0x36')](_0x2426d0[_0x2d11('0x43')],_0x32552a);}_0x2426d0=_[_0x2d11('0x36')]({},_0x2426d0,_0x20a80a[_0x2d11('0x37')]);return db[_0x2d11('0x3f')][_0x2d11('0x49')]({'where':_0x2426d0[_0x2d11('0x43')]})[_0x2d11('0x1b')](function(_0x214ea9){_0x5c95a9[_0x2d11('0x49')]=_0x214ea9;if(_0x20a80a[_0x2d11('0x28')]['includeAll']){_0x2426d0[_0x2d11('0x35')]=[{'all':!![]}];}return db[_0x2d11('0x3f')][_0x2d11('0x26')](_0x2426d0);})['then'](function(_0x542438){_0x5c95a9[_0x2d11('0x4a')]=_0x542438;return _0x5c95a9;});}})['then'](respondWithFilteredResult(_0x1c52dc,_0x2426d0))[_0x2d11('0x2a')](handleError(_0x1c52dc,null));};exports[_0x2d11('0x4b')]=function(_0x1bd087,_0x378349){return db[_0x2d11('0x21')][_0x2d11('0x38')]({'where':{'id':_0x1bd087[_0x2d11('0x2c')]['id']}})['then'](handleEntityNotFound(_0x378349,null))[_0x2d11('0x1b')](function(_0x4326bd){if(_0x4326bd){return _0x4326bd[_0x2d11('0x4c')](_0x1bd087[_0x2d11('0x3a')][_0x2d11('0x4d')],_['omit'](_0x1bd087['body'],[_0x2d11('0x4d'),'id'])||{})[_0x2d11('0x4e')](function(){return db[_0x2d11('0x4f')][_0x2d11('0x26')]({'attributes':['id',_0x2d11('0x1e'),_0x2d11('0x50')],'where':{'id':_0x1bd087['body'][_0x2d11('0x4d')]}});})[_0x2d11('0x1b')](function(_0x502e42){socket['emit']('smsInteractionTags:save',{'id':Number(_0x1bd087[_0x2d11('0x2c')]['id']),'tags':_0x502e42||[]});return{'id':Number(_0x1bd087['params']['id']),'tags':_0x502e42||[]};});}})[_0x2d11('0x1b')](respondWithResult(_0x378349,null))[_0x2d11('0x2a')](handleError(_0x378349,null));};exports[_0x2d11('0x51')]=function(_0x1951bb,_0x1dedc3){return db[_0x2d11('0x21')][_0x2d11('0x38')]({'where':{'id':_0x1951bb['params']['id']}})[_0x2d11('0x1b')](handleEntityNotFound(_0x1dedc3,null))[_0x2d11('0x1b')](function(_0x3435e9){if(_0x3435e9){return _0x3435e9['removeTags'](_0x1951bb[_0x2d11('0x28')][_0x2d11('0x4d')]);}})[_0x2d11('0x1b')](respondWithStatusCode(_0x1dedc3,null))['catch'](handleError(_0x1dedc3,null));};exports[_0x2d11('0x52')]=function(_0x27589c,_0x4c956b){var _0x32c10b=moment()[_0x2d11('0x53')]()[_0x2d11('0x54')]();var _0x1acbbd=path[_0x2d11('0x55')](config[_0x2d11('0x56')],'server',_0x2d11('0x57'),_0x2d11('0x58'));var _0x2e9e74=path[_0x2d11('0x55')](_0x1acbbd,_0x32c10b);var _0x4abbf5=util[_0x2d11('0x59')](_0x2d11('0x5a'),_0x27589c[_0x2d11('0x2c')]['id'],_0x32c10b);var _0x4a8ead=path['join'](_0x1acbbd,_0x4abbf5);var _0x2c9549=[];_0x2c9549[_0x2d11('0x5b')]({'model':db[_0x2d11('0x5c')],'as':_0x2d11('0x5c'),'attributes':['id',_0x2d11('0x5d')],'raw':!![]});_0x2c9549[_0x2d11('0x5b')]({'model':db[_0x2d11('0x5e')],'as':_0x2d11('0x5f'),'attributes':['id',_0x2d11('0x60'),_0x2d11('0x61')],'raw':!![]});var _0x9101f7=[{'model':db[_0x2d11('0x3f')],'as':_0x2d11('0x62'),'attributes':['id',_0x2d11('0x3a'),_0x2d11('0x63'),_0x2d11('0x64'),_0x2d11('0x65'),_0x2d11('0x66')],'include':_0x2c9549}];_0x9101f7['push']({'model':db['SmsAccount'],'as':_0x2d11('0x67'),'attributes':['id',_0x2d11('0x1e')]});_0x9101f7[_0x2d11('0x5b')]({'model':db[_0x2d11('0x5c')],'as':'Owner','attributes':['id',_0x2d11('0x5d')]});return db['SmsInteraction'][_0x2d11('0x38')]({'where':{'id':_0x27589c[_0x2d11('0x2c')]['id']},'include':_0x9101f7})[_0x2d11('0x1b')](handleEntityNotFound(_0x4c956b,null))['then'](function(_0x3e02fd){if(_0x3e02fd){var _0x1e1f8d=_0x3e02fd[_0x2d11('0x68')]({'plain':!![]});fs[_0x2d11('0x69')](_0x2e9e74);var _0x2c1163={'channel':'Sms','account':_0x1e1f8d[_0x2d11('0x67')][_0x2d11('0x1e')],'agent':_0x1e1f8d['Owner']?_0x1e1f8d['Owner']['fullname']:_0x2d11('0x6a'),'createdAt':moment(_0x1e1f8d[_0x2d11('0x63')])[_0x2d11('0x59')](_0x2d11('0x6b'))[_0x2d11('0x54')](),'closedAt':_0x1e1f8d[_0x2d11('0x6c')]?moment(_0x1e1f8d['closedAt'])[_0x2d11('0x59')](_0x2d11('0x6b'))[_0x2d11('0x54')]():'','disposition':_0x1e1f8d[_0x2d11('0x6d')],'messages':_(_0x1e1f8d[_0x2d11('0x62')])[_0x2d11('0x45')]({'secret':![]})[_0x2d11('0x46')](function(_0x33518b){return{'date':moment(_0x33518b[_0x2d11('0x63')])[_0x2d11('0x59')](_0x2d11('0x6b'))[_0x2d11('0x54')](),'sender':_0x33518b['direction']===_0x2d11('0x6e')?_0x33518b['User']?_0x33518b[_0x2d11('0x5c')][_0x2d11('0x5d')]:_0x2d11('0x6f'):_0x33518b[_0x2d11('0x5f')]['firstName']+(_0x33518b['Contact'][_0x2d11('0x61')]?'\x20'+_0x33518b[_0x2d11('0x5f')]['lastName']:''),'body':_0x33518b[_0x2d11('0x3a')],'direction':_0x33518b[_0x2d11('0x64')]===_0x2d11('0x6e')?'A':'C','secret':_0x33518b['secret'],'read':_0x33518b[_0x2d11('0x66')]};})['value']()};return ejs[_0x2d11('0x70')](path[_0x2d11('0x55')](config[_0x2d11('0x56')],'server',_0x2d11('0x71'),_0x2d11('0x72')),{'interaction':_0x2c1163})['then'](function(_0x4b6cfa){var _0x14bd4d=path[_0x2d11('0x55')](_0x2e9e74,'transcript-'+_0x1e1f8d['id']+'-'+_0x32c10b+_0x2d11('0x73'));var _0x157156={'path':_0x14bd4d,'channel':'Sms','interactionId':_0x1e1f8d['id']};return pdf[_0x2d11('0x74')](_0x4b6cfa,_0x157156);})[_0x2d11('0x1b')](function(){return new BPromise(function(_0x4ed041,_0x4bc749){zipdir(_0x2e9e74,{'saveTo':_0x4a8ead},function(_0x4096a3,_0x2bcf6d){if(_0x4096a3)return _0x4bc749(_0x4096a3);return _0x4ed041(_0x2bcf6d);});})[_0x2d11('0x1b')](function(){return new BPromise(function(_0x4364e4,_0x5c2c79){rimraf(_0x2e9e74,function(_0x4c8dbf){if(_0x4c8dbf)_0x5c2c79(_0x4c8dbf);return _0x4364e4();});});})[_0x2d11('0x1b')](function(){return _0x4c956b[_0x2d11('0x52')](_0x4a8ead,_0x4abbf5,function(_0x1efb8a){if(_0x1efb8a){console[_0x2d11('0x75')](_0x2d11('0x76'),_0x1efb8a);}else{fs['unlinkSync'](_0x4a8ead);}});});});}else{return _0x4c956b['sendStatus'](0xc8);}})['catch'](handleError(_0x4c956b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index da5de44..f916dfe 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 _0xab40=['remove','then','setDataValue','Users','unreadMessages','length','emit','catch','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x5cfaef,_0x4f2375){var _0x4e6690=function(_0x13c900){while(--_0x13c900){_0x5cfaef['push'](_0x5cfaef['shift']());}};_0x4e6690(++_0x4f2375);}(_0xab40,0xcd));var _0x0ab4=function(_0x24d444,_0x3e4566){_0x24d444=_0x24d444-0x0;var _0x1a9daf=_0xab40[_0x24d444];return _0x1a9daf;};'use strict';var EventEmitter=require(_0x0ab4('0x0'));var SmsInteraction=require(_0x0ab4('0x1'))['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x0ab4('0x2')](0x0);var events={'afterCreate':_0x0ab4('0x3'),'afterUpdate':_0x0ab4('0x4'),'afterDestroy':_0x0ab4('0x5')};function emitEvent(_0x14634a){return function(_0x57fac1,_0x5f01aa,_0x28b17a){_0x57fac1['getUsers']({'attributes':['id'],'raw':!![]})[_0x0ab4('0x6')](function(_0x46d16a){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x8'),_0x46d16a['map'](function(_0x55263d){return{'id':_0x55263d['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x57fac1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0ab4('0x6')](function(_0x30e726){_0x57fac1[_0x0ab4('0x7')](_0x0ab4('0x9'),_0x30e726[_0x0ab4('0xa')]);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a+':'+_0x57fac1['id'],_0x57fac1);SmsInteractionEvents[_0x0ab4('0xb')](_0x14634a,_0x57fac1);_0x28b17a(null);})[_0x0ab4('0xc')](_0x28b17a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x0ab4('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0xf61e=['exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x4df592,_0x4cd928){var _0x1cd705=function(_0x3d77cb){while(--_0x3d77cb){_0x4df592['push'](_0x4df592['shift']());}};_0x1cd705(++_0x4cd928);}(_0xf61e,0x191));var _0xef61=function(_0x48e7ea,_0x3290b5){_0x48e7ea=_0x48e7ea-0x0;var _0x3ece3d=_0xf61e[_0x48e7ea];return _0x3ece3d;};'use strict';var EventEmitter=require(_0xef61('0x0'));var SmsInteraction=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var SmsMessage=require(_0xef61('0x1'))['db'][_0xef61('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xef61('0x4')](0x0);var events={'afterCreate':_0xef61('0x5'),'afterUpdate':_0xef61('0x6'),'afterDestroy':_0xef61('0x7')};function emitEvent(_0x14122a){return function(_0x239fa9,_0x45a18d,_0x5b00b2){_0x239fa9[_0xef61('0x8')]({'attributes':['id'],'raw':!![]})[_0xef61('0x9')](function(_0x4f0cc5){_0x239fa9[_0xef61('0xa')](_0xef61('0xb'),_0x4f0cc5[_0xef61('0xc')](function(_0x4dba00){return{'id':_0x4dba00['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x239fa9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef61('0x9')](function(_0x2e28c7){_0x239fa9[_0xef61('0xa')](_0xef61('0xd'),_0x2e28c7[_0xef61('0xe')]);SmsInteractionEvents[_0xef61('0xf')](_0x14122a+':'+_0x239fa9['id'],_0x239fa9);SmsInteractionEvents[_0xef61('0xf')](_0x14122a,_0x239fa9);_0x5b00b2(null);})[_0xef61('0x10')](_0x5b00b2(null));};}for(var e in events){if(events[_0xef61('0x11')](e)){var event=events[e];SmsInteraction[_0xef61('0x12')](e,emitEvent(event));}}module[_0xef61('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 11a091c..de89e42 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 _0xcb0c=['request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4d74f9,_0x53421d){var _0xcb39b4=function(_0x4eba77){while(--_0x4eba77){_0x4d74f9['push'](_0x4d74f9['shift']());}};_0xcb39b4(++_0x53421d);}(_0xcb0c,0x1bc));var _0xccb0=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xcb0c[_0x1d70db];return _0x3060c6;};'use strict';var _=require(_0xccb0('0x0'));var util=require(_0xccb0('0x1'));var logger=require(_0xccb0('0x2'))(_0xccb0('0x3'));var moment=require(_0xccb0('0x4'));var BPromise=require(_0xccb0('0x5'));var rp=require(_0xccb0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccb0('0x7'));var config=require(_0xccb0('0x8'));var attributes=require(_0xccb0('0x9'));module[_0xccb0('0xa')]=function(_0x556b70,_0x4db8c5){return _0x556b70[_0xccb0('0xb')](_0xccb0('0xc'),attributes,{'tableName':_0xccb0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x484bae,_0x38b6d0,_0xc44fc8){if(_0x484bae[_0xccb0('0xe')](_0xccb0('0xf'))){_0x484bae[_0xccb0('0x10')]=moment()['format'](_0xccb0('0x11'));}_0xc44fc8(null,_0x484bae);}}});}; \ No newline at end of file +var _0xaf95=['bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x46ce9d,_0xa564b0){var _0x1639c4=function(_0x1f59a2){while(--_0x1f59a2){_0x46ce9d['push'](_0x46ce9d['shift']());}};_0x1639c4(++_0xa564b0);}(_0xaf95,0x177));var _0x5af9=function(_0x6d0b17,_0x221ac0){_0x6d0b17=_0x6d0b17-0x0;var _0x1ee7f3=_0xaf95[_0x6d0b17];return _0x1ee7f3;};'use strict';var _=require(_0x5af9('0x0'));var util=require(_0x5af9('0x1'));var logger=require(_0x5af9('0x2'))(_0x5af9('0x3'));var moment=require(_0x5af9('0x4'));var BPromise=require(_0x5af9('0x5'));var rp=require(_0x5af9('0x6'));var fs=require('fs');var path=require(_0x5af9('0x7'));var rimraf=require(_0x5af9('0x8'));var config=require(_0x5af9('0x9'));var attributes=require(_0x5af9('0xa'));module[_0x5af9('0xb')]=function(_0x3cfbd5,_0x2b845f){return _0x3cfbd5[_0x5af9('0xc')]('SmsInteraction',attributes,{'tableName':_0x5af9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x393959,_0x53f799,_0x7062ea){if(_0x393959[_0x5af9('0xe')](_0x5af9('0xf'))){_0x393959[_0x5af9('0x10')]=moment()[_0x5af9('0x11')](_0x5af9('0x12'));}_0x7062ea(null,_0x393959);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index af86ed2..ee703b0 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 _0x93a3=['error','code','message','result','UpdateSmsInteraction','body','options','raw','attributes','limit','stringify','catch','AddTagsToSmsInteraction','SmsInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c274e,_0x4ac782){var _0x4a9ea8=function(_0x3c6a9a){while(--_0x3c6a9a){_0x5c274e['push'](_0x5c274e['shift']());}};_0x4a9ea8(++_0x4ac782);}(_0x93a3,0x6d));var _0x393a=function(_0x33c974,_0x1e1e4a){_0x33c974=_0x33c974-0x0;var _0x4211bc=_0x93a3[_0x33c974];return _0x4211bc;};'use strict';var _=require(_0x393a('0x0'));var util=require(_0x393a('0x1'));var moment=require(_0x393a('0x2'));var BPromise=require(_0x393a('0x3'));var rs=require(_0x393a('0x4'));var fs=require('fs');var Redis=require(_0x393a('0x5'));var db=require(_0x393a('0x6'))['db'];var utils=require(_0x393a('0x7'));var logger=require('../../config/logger')(_0x393a('0x8'));var config=require(_0x393a('0x9'));var jayson=require(_0x393a('0xa'));var client=jayson[_0x393a('0xb')][_0x393a('0xc')]({'port':0x232a});config[_0x393a('0xd')]=_[_0x393a('0xe')](config['redis'],{'host':_0x393a('0xf'),'port':0x18eb});var socket=require(_0x393a('0x10'))(new Redis(config[_0x393a('0xd')]));require('./smsInteraction.socket')[_0x393a('0x11')](socket);function respondWithRpcPromise(_0xf1319,_0x2a97c0,_0x4b91ca){return new BPromise(function(_0x194db9,_0x34147d){return client['request'](_0xf1319,_0x4b91ca)[_0x393a('0x12')](function(_0x54760d){logger[_0x393a('0x13')](_0x393a('0x14'),_0x2a97c0,_0x393a('0x15'));logger[_0x393a('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2a97c0,_0x393a('0x15'),JSON['stringify'](_0x54760d));if(_0x54760d[_0x393a('0x17')]){if(_0x54760d[_0x393a('0x17')][_0x393a('0x18')]===0x1f4){logger[_0x393a('0x17')](_0x393a('0x14'),_0x2a97c0,_0x54760d[_0x393a('0x17')][_0x393a('0x19')]);return _0x34147d(_0x54760d[_0x393a('0x17')][_0x393a('0x19')]);}logger[_0x393a('0x17')](_0x393a('0x14'),_0x2a97c0,_0x54760d[_0x393a('0x17')][_0x393a('0x19')]);return _0x194db9(_0x54760d[_0x393a('0x17')][_0x393a('0x19')]);}else{logger['info'](_0x393a('0x14'),_0x2a97c0,_0x393a('0x15'));_0x194db9(_0x54760d[_0x393a('0x1a')][_0x393a('0x19')]);}})['catch'](function(_0xd79f0d){logger[_0x393a('0x17')](_0x393a('0x14'),_0x2a97c0,_0xd79f0d);_0x34147d(_0xd79f0d);});});}exports[_0x393a('0x1b')]=function(_0x3d17dd){var _0x448b18=this;return new Promise(function(_0x89e114,_0x821fed){return db['SmsInteraction']['update'](_0x3d17dd[_0x393a('0x1c')],{'raw':_0x3d17dd[_0x393a('0x1d')]?_0x3d17dd[_0x393a('0x1d')][_0x393a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d17dd[_0x393a('0x1d')]?_0x3d17dd[_0x393a('0x1d')]['where']||null:null,'attributes':_0x3d17dd['options']?_0x3d17dd[_0x393a('0x1d')][_0x393a('0x1f')]||null:null,'limit':_0x3d17dd['options']?_0x3d17dd['options'][_0x393a('0x20')]||null:null})['then'](function(_0x529a62){logger[_0x393a('0x13')]('UpdateSmsInteraction',_0x3d17dd);logger[_0x393a('0x16')]('UpdateSmsInteraction',_0x3d17dd,JSON[_0x393a('0x21')](_0x529a62));_0x89e114(_0x529a62);})[_0x393a('0x22')](function(_0x164f08){logger[_0x393a('0x17')]('UpdateSmsInteraction',_0x164f08[_0x393a('0x19')],_0x3d17dd);_0x821fed(_0x448b18['error'](0x1f4,_0x164f08[_0x393a('0x19')]));});});};exports[_0x393a('0x23')]=function(_0x45833d){return new Promise(function(_0x3563a6,_0x2d875d){return db[_0x393a('0x24')][_0x393a('0x25')]({'where':_0x45833d[_0x393a('0x1d')]?_0x45833d['options'][_0x393a('0x26')]||null:null})[_0x393a('0x12')](function(_0x3c4866){if(_0x3c4866){return _0x3c4866[_0x393a('0x27')](_0x45833d[_0x393a('0x1c')][_0x393a('0x28')],_[_0x393a('0x29')](_0x45833d[_0x393a('0x1c')],[_0x393a('0x28'),'id'])||{});}})[_0x393a('0x2a')](function(_0x5299bf){logger['info'](_0x393a('0x2b'),_0x45833d);logger[_0x393a('0x16')](_0x393a('0x2b'),_0x45833d,JSON['stringify'](_0x5299bf));_0x3563a6(_0x5299bf);})[_0x393a('0x22')](function(_0x4344fe){logger[_0x393a('0x17')](_0x393a('0x2b'),_0x4344fe[_0x393a('0x19')],_0x45833d);_0x2d875d(_this[_0x393a('0x17')](0x1f4,_0x4344fe[_0x393a('0x19')]));});});}; \ No newline at end of file +var _0x3de7=['error','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','info','AddTagsToSmsInteraction','find','ids','spread','AddTags','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','redis','socket.io-emitter','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1296c9,_0x17b2de){var _0x170dd5=function(_0x46121d){while(--_0x46121d){_0x1296c9['push'](_0x1296c9['shift']());}};_0x170dd5(++_0x17b2de);}(_0x3de7,0x7b));var _0x73de=function(_0x26297c,_0x25e593){_0x26297c=_0x26297c-0x0;var _0x47c4c1=_0x3de7[_0x26297c];return _0x47c4c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73de('0x0'));var BPromise=require(_0x73de('0x1'));var rs=require(_0x73de('0x2'));var fs=require('fs');var Redis=require(_0x73de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x73de('0x4'));var logger=require(_0x73de('0x5'))(_0x73de('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x73de('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x73de('0x8'))(new Redis(config['redis']));require(_0x73de('0x9'))[_0x73de('0xa')](socket);function respondWithRpcPromise(_0x5416e9,_0x515b51,_0x461de1){return new BPromise(function(_0x1dae52,_0x328668){return client['request'](_0x5416e9,_0x461de1)[_0x73de('0xb')](function(_0x22735f){logger['info'](_0x73de('0xc'),_0x515b51,_0x73de('0xd'));logger[_0x73de('0xe')](_0x73de('0xf'),_0x515b51,_0x73de('0xd'),JSON[_0x73de('0x10')](_0x22735f));if(_0x22735f[_0x73de('0x11')]){if(_0x22735f[_0x73de('0x11')]['code']===0x1f4){logger['error'](_0x73de('0xc'),_0x515b51,_0x22735f[_0x73de('0x11')][_0x73de('0x12')]);return _0x328668(_0x22735f[_0x73de('0x11')][_0x73de('0x12')]);}logger[_0x73de('0x11')](_0x73de('0xc'),_0x515b51,_0x22735f[_0x73de('0x11')]['message']);return _0x1dae52(_0x22735f[_0x73de('0x11')][_0x73de('0x12')]);}else{logger['info'](_0x73de('0xc'),_0x515b51,_0x73de('0xd'));_0x1dae52(_0x22735f[_0x73de('0x13')]['message']);}})[_0x73de('0x14')](function(_0xaf7fc8){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x515b51,_0xaf7fc8);_0x328668(_0xaf7fc8);});});}exports[_0x73de('0x15')]=function(_0x27bd86){var _0x8c2d07=this;return new Promise(function(_0x3506d6,_0x2f6d3e){return db[_0x73de('0x16')]['update'](_0x27bd86[_0x73de('0x17')],{'raw':_0x27bd86[_0x73de('0x18')]?_0x27bd86['options'][_0x73de('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27bd86[_0x73de('0x18')]?_0x27bd86[_0x73de('0x18')][_0x73de('0x1a')]||null:null,'attributes':_0x27bd86[_0x73de('0x18')]?_0x27bd86['options'][_0x73de('0x1b')]||null:null,'limit':_0x27bd86[_0x73de('0x18')]?_0x27bd86[_0x73de('0x18')][_0x73de('0x1c')]||null:null})[_0x73de('0xb')](function(_0x58d466){logger[_0x73de('0x1d')](_0x73de('0x15'),_0x27bd86);logger['debug']('UpdateSmsInteraction',_0x27bd86,JSON[_0x73de('0x10')](_0x58d466));_0x3506d6(_0x58d466);})[_0x73de('0x14')](function(_0x39afcf){logger[_0x73de('0x11')](_0x73de('0x15'),_0x39afcf[_0x73de('0x12')],_0x27bd86);_0x2f6d3e(_0x8c2d07[_0x73de('0x11')](0x1f4,_0x39afcf['message']));});});};exports[_0x73de('0x1e')]=function(_0x3bb6f3){return new Promise(function(_0x3d6a2e,_0x186a01){return db[_0x73de('0x16')][_0x73de('0x1f')]({'where':_0x3bb6f3[_0x73de('0x18')]?_0x3bb6f3[_0x73de('0x18')][_0x73de('0x1a')]||null:null})[_0x73de('0xb')](function(_0x31fca2){if(_0x31fca2){return _0x31fca2['addTags'](_0x3bb6f3[_0x73de('0x17')]['ids'],_['omit'](_0x3bb6f3[_0x73de('0x17')],[_0x73de('0x20'),'id'])||{});}})[_0x73de('0x21')](function(_0x137bc1){logger[_0x73de('0x1d')](_0x73de('0x22'),_0x3bb6f3);logger['debug']('AddTags',_0x3bb6f3,JSON['stringify'](_0x137bc1));_0x3d6a2e(_0x137bc1);})[_0x73de('0x14')](function(_0x4437ff){logger[_0x73de('0x11')](_0x73de('0x22'),_0x4437ff[_0x73de('0x12')],_0x3bb6f3);_0x186a01(_this[_0x73de('0x11')](0x1f4,_0x4437ff['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 10c0c1a..2526863 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 _0xf4fe=['length','smsInteraction:','./smsInteraction.events','update','emit','removeListener'];(function(_0x54f6a6,_0xde810f){var _0x37a293=function(_0x3dad2c){while(--_0x3dad2c){_0x54f6a6['push'](_0x54f6a6['shift']());}};_0x37a293(++_0xde810f);}(_0xf4fe,0x80));var _0xef4f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf4fe[_0x31e29a];return _0x32d892;};'use strict';var SmsInteractionEvents=require(_0xef4f('0x0'));var events=['save','remove',_0xef4f('0x1')];function createListener(_0x3283b3,_0x2ed220){return function(_0x2b89ee){_0x2ed220[_0xef4f('0x2')](_0x3283b3,_0x2b89ee);};}function removeListener(_0x1e3c37,_0x32015f){return function(){SmsInteractionEvents[_0xef4f('0x3')](_0x1e3c37,_0x32015f);};}exports['register']=function(_0x137748){for(var _0x2eadaf=0x0,_0x2555c4=events[_0xef4f('0x4')];_0x2eadaf<_0x2555c4;_0x2eadaf++){var _0x5e85ac=events[_0x2eadaf];var _0x5a3e83=createListener(_0xef4f('0x5')+_0x5e85ac,_0x137748);SmsInteractionEvents['on'](_0x5e85ac,_0x5a3e83);}}; \ No newline at end of file +var _0x38b5=['./smsInteraction.events','save','remove','update','removeListener','length'];(function(_0x51eb02,_0x51b7d6){var _0x2d90a5=function(_0x49a187){while(--_0x49a187){_0x51eb02['push'](_0x51eb02['shift']());}};_0x2d90a5(++_0x51b7d6);}(_0x38b5,0x1a4));var _0x538b=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0x38b5[_0x967959];return _0x5c4489;};'use strict';var SmsInteractionEvents=require(_0x538b('0x0'));var events=[_0x538b('0x1'),_0x538b('0x2'),_0x538b('0x3')];function createListener(_0x3546b3,_0x3722a7){return function(_0x54ad24){_0x3722a7['emit'](_0x3546b3,_0x54ad24);};}function removeListener(_0x19652f,_0x2a450c){return function(){SmsInteractionEvents[_0x538b('0x4')](_0x19652f,_0x2a450c);};}exports['register']=function(_0x32dc72){for(var _0x545f95=0x0,_0x3930ee=events[_0x538b('0x5')];_0x545f95<_0x3930ee;_0x545f95++){var _0x397415=events[_0x545f95];var _0x3a7dd7=createListener('smsInteraction:'+_0x397415,_0x32dc72);SmsInteractionEvents['on'](_0x397415,_0x3a7dd7);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 056124c..ad1cc60 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 _0xfe85=['isAuthenticated','/:id','post','tracked','sms','/:id/status','put','update','/:id/accept','reject','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4d22ba,_0x48e8f5){var _0x4b83d2=function(_0x676d41){while(--_0x676d41){_0x4d22ba['push'](_0x4d22ba['shift']());}};_0x4b83d2(++_0x48e8f5);}(_0xfe85,0x75));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5fe8('0x0'));var path=require(_0x5fe8('0x1'));var timeout=require(_0x5fe8('0x2'));var express=require('express');var router=express[_0x5fe8('0x3')]();var fs_extra=require(_0x5fe8('0x4'));var auth=require(_0x5fe8('0x5'));var interaction=require(_0x5fe8('0x6'));var config=require(_0x5fe8('0x7'));var controller=require('./smsMessage.controller');router[_0x5fe8('0x8')]('/',auth[_0x5fe8('0x9')](),controller['index']);router['get']('/describe',auth[_0x5fe8('0x9')](),controller['describe']);router[_0x5fe8('0x8')](_0x5fe8('0xa'),auth[_0x5fe8('0x9')](),controller['show']);router[_0x5fe8('0xb')]('/',auth[_0x5fe8('0x9')](),interaction[_0x5fe8('0xc')](_0x5fe8('0xd'),'smsmessage:create'),controller['create']);router[_0x5fe8('0xb')](_0x5fe8('0xe'),controller['status']);router[_0x5fe8('0xf')](_0x5fe8('0xa'),auth['isAuthenticated'](),controller[_0x5fe8('0x10')]);router[_0x5fe8('0xf')](_0x5fe8('0x11'),auth[_0x5fe8('0x9')](),controller['accept']);router['put']('/:id/reject',auth[_0x5fe8('0x9')](),controller[_0x5fe8('0x12')]);router[_0x5fe8('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5fe8('0x14')]=router; \ No newline at end of file +var _0x90ad=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','isAuthenticated','index','/describe','describe','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer'];(function(_0x12849e,_0x3f9cce){var _0xaec77b=function(_0x35ccb4){while(--_0x35ccb4){_0x12849e['push'](_0x12849e['shift']());}};_0xaec77b(++_0x3f9cce);}(_0x90ad,0x195));var _0xd90a=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x90ad[_0x2c0dc0];return _0x4c0990;};'use strict';var multer=require(_0xd90a('0x0'));var util=require(_0xd90a('0x1'));var path=require(_0xd90a('0x2'));var timeout=require(_0xd90a('0x3'));var express=require(_0xd90a('0x4'));var router=express['Router']();var fs_extra=require(_0xd90a('0x5'));var auth=require(_0xd90a('0x6'));var interaction=require(_0xd90a('0x7'));var config=require('../../config/environment');var controller=require(_0xd90a('0x8'));router['get']('/',auth[_0xd90a('0x9')](),controller[_0xd90a('0xa')]);router['get'](_0xd90a('0xb'),auth[_0xd90a('0x9')](),controller[_0xd90a('0xc')]);router['get']('/:id',auth[_0xd90a('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0xd90a('0xd')](_0xd90a('0xe'),_0xd90a('0xf')),controller[_0xd90a('0x10')]);router['post'](_0xd90a('0x11'),controller[_0xd90a('0x12')]);router[_0xd90a('0x13')](_0xd90a('0x14'),auth[_0xd90a('0x9')](),controller[_0xd90a('0x15')]);router[_0xd90a('0x13')](_0xd90a('0x16'),auth[_0xd90a('0x9')](),controller[_0xd90a('0x17')]);router['put'](_0xd90a('0x18'),auth[_0xd90a('0x9')](),controller[_0xd90a('0x19')]);router[_0xd90a('0x1a')](_0xd90a('0x14'),auth[_0xd90a('0x9')](),controller[_0xd90a('0x1b')]);module[_0xd90a('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 7b6141a..4ff4344 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 _0xf45b=['TEXT','medium','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x650e11,_0x284f86){var _0x1a9b47=function(_0x6e15e3){while(--_0x6e15e3){_0x650e11['push'](_0x650e11['shift']());}};_0x1a9b47(++_0x284f86);}(_0xf45b,0x13e));var _0xbf45=function(_0x3cc82b,_0x259747){_0x3cc82b=_0x3cc82b-0x0;var _0x4d2e83=_0xf45b[_0x3cc82b];return _0x4d2e83;};'use strict';var Sequelize=require(_0xbf45('0x0'));module[_0xbf45('0x1')]={'body':{'type':Sequelize[_0xbf45('0x2')](_0xbf45('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xbf45('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbf45('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xbf45('0x6')]},'secret':{'type':Sequelize[_0xbf45('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xbf45('0x2')]}}; \ No newline at end of file +var _0xcc62=['ENUM','out','STRING','sequelize','TEXT','BOOLEAN'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xcc62,0x10b));var _0x2cc6=function(_0x9311f8,_0x526261){_0x9311f8=_0x9311f8-0x0;var _0x40894b=_0xcc62[_0x9311f8];return _0x40894b;};'use strict';var Sequelize=require(_0x2cc6('0x0'));module['exports']={'body':{'type':Sequelize[_0x2cc6('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x2cc6('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2cc6('0x3')]('in','out'),'defaultValue':_0x2cc6('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2cc6('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x2cc6('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2cc6('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 1898796..691d0e2 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 _0xcf3d=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','status','stack','name','index','map','SmsMessage','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','show','params','keys','intersection','find','create','body','destroy','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','isNil','read1stAt','get','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','internal','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','User','fullname','email','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','inspect','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../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','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x533310,_0x195e58){var _0x65c4a6=function(_0x632209){while(--_0x632209){_0x533310['push'](_0x533310['shift']());}};_0x65c4a6(++_0x195e58);}(_0xcf3d,0x19e));var _0xdcf3=function(_0x1c1310,_0x58de7d){_0x1c1310=_0x1c1310-0x0;var _0x24430f=_0xcf3d[_0x1c1310];return _0x24430f;};'use strict';var emlformat=require(_0xdcf3('0x0'));var rimraf=require(_0xdcf3('0x1'));var zipdir=require(_0xdcf3('0x2'));var jsonpatch=require(_0xdcf3('0x3'));var rp=require('request-promise');var moment=require(_0xdcf3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdcf3('0x5'));var util=require(_0xdcf3('0x6'));var path=require(_0xdcf3('0x7'));var sox=require(_0xdcf3('0x8'));var csv=require(_0xdcf3('0x9'));var ejs=require(_0xdcf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf3('0xb'));var squel=require('squel');var crypto=require(_0xdcf3('0xc'));var jsforce=require(_0xdcf3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdcf3('0xe'));var Redis=require(_0xdcf3('0xf'));var authService=require(_0xdcf3('0x10'));var qs=require(_0xdcf3('0x11'));var as=require(_0xdcf3('0x12'));var hardwareService=require(_0xdcf3('0x13'));var logger=require(_0xdcf3('0x14'))(_0xdcf3('0x15'));var utils=require(_0xdcf3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdcf3('0x17'));var db=require(_0xdcf3('0x18'))['db'];config['redis']=_[_0xdcf3('0x19')](config[_0xdcf3('0x1a')],{'host':_0xdcf3('0x1b'),'port':0x18eb});var socket=require(_0xdcf3('0x1c'))(new Redis(config['redis']));require(_0xdcf3('0x1d'))[_0xdcf3('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xdcf3('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xdcf3('0x1f')][_0xdcf3('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1af727,_0x2c5436,_0x5d6a28,_0x379bce){return new BPromise(function(_0x24cce5,_0x5bf5c4){var _0xc64c2a=_0x379bce||client;return _0xc64c2a[_0xdcf3('0x21')](_0x1af727,_0x5d6a28)[_0xdcf3('0x22')](function(_0x3cbee9){logger[_0xdcf3('0x23')](_0xdcf3('0x24'),_0x2c5436,_0xdcf3('0x25'));logger[_0xdcf3('0x26')](_0xdcf3('0x27'),_0x2c5436,_0xdcf3('0x25'),JSON[_0xdcf3('0x28')](_0x3cbee9));if(_0x3cbee9['error']){if(_0x3cbee9['error'][_0xdcf3('0x29')]===0x1f4){logger[_0xdcf3('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x2c5436,_0x3cbee9['error'][_0xdcf3('0x2b')]);return _0x5bf5c4(_0x3cbee9['error']['message']);}logger[_0xdcf3('0x2a')](_0xdcf3('0x24'),_0x2c5436,_0x3cbee9[_0xdcf3('0x2a')]['message']);return _0x24cce5(_0x3cbee9[_0xdcf3('0x2a')]['message']);}else{logger[_0xdcf3('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2c5436,_0xdcf3('0x25'));_0x24cce5(_0x3cbee9[_0xdcf3('0x2c')][_0xdcf3('0x2b')]);}})[_0xdcf3('0x2d')](function(_0x5b6fc3){logger[_0xdcf3('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x2c5436,_0x5b6fc3);_0x5bf5c4(_0x5b6fc3);});});}function respondWithStatusCode(_0x968801,_0x3fbd96){_0x3fbd96=_0x3fbd96||0xcc;return function(_0x7df45){if(_0x7df45){return _0x968801[_0xdcf3('0x2e')](_0x3fbd96);}return _0x968801['status'](_0x3fbd96)[_0xdcf3('0x2f')]();};}function respondWithResult(_0x5d9320,_0x5c3ad7){_0x5c3ad7=_0x5c3ad7||0xc8;return function(_0x47efc8){if(_0x47efc8){return _0x5d9320['status'](_0x5c3ad7)[_0xdcf3('0x30')](_0x47efc8);}};}function respondWithFilteredResult(_0x4cd417,_0x3165a5){return function(_0x56964c){if(_0x56964c){var _0x3b34a5=typeof _0x3165a5['offset']===_0xdcf3('0x31')&&typeof _0x3165a5[_0xdcf3('0x32')]===_0xdcf3('0x31');var _0x28d918=_0x56964c[_0xdcf3('0x33')];var _0x377083=_0x3b34a5?0x0:_0x3165a5[_0xdcf3('0x34')];var _0xd846f9=_0x3b34a5?_0x56964c[_0xdcf3('0x33')]:_0x3165a5[_0xdcf3('0x34')]+_0x3165a5[_0xdcf3('0x32')];var _0x511746;if(_0xd846f9>=_0x28d918){_0xd846f9=_0x28d918;_0x511746=0xc8;}else{_0x511746=0xce;}_0x4cd417['status'](_0x511746);return _0x4cd417[_0xdcf3('0x35')](_0xdcf3('0x36'),_0x377083+'-'+_0xd846f9+'/'+_0x28d918)[_0xdcf3('0x30')](_0x56964c);}return null;};}function patchUpdates(_0x3b8301){return function(_0x4e138c){try{jsonpatch[_0xdcf3('0x37')](_0x4e138c,_0x3b8301,!![]);}catch(_0xa757bc){return BPromise[_0xdcf3('0x38')](_0xa757bc);}return _0x4e138c[_0xdcf3('0x39')]();};}function saveUpdates(_0x568f05,_0x2e408b){return function(_0x5e421c){if(_0x5e421c){return _0x5e421c[_0xdcf3('0x3a')](_0x568f05)[_0xdcf3('0x22')](function(_0x2a6f31){return _0x2a6f31;});}return null;};}function removeEntity(_0x105804,_0xfe0a7c){return function(_0x315c43){if(_0x315c43){return _0x315c43['destroy']()[_0xdcf3('0x22')](function(){_0x105804[_0xdcf3('0x3b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3da760,_0xd90d1b){return function(_0x5a20ca){if(!_0x5a20ca){_0x3da760[_0xdcf3('0x2e')](0x194);}return _0x5a20ca;};}function handleError(_0x4021aa,_0x11c974){_0x11c974=_0x11c974||0x1f4;return function(_0x406d65){logger['error'](_0x406d65[_0xdcf3('0x3c')]);if(_0x406d65[_0xdcf3('0x3d')]){delete _0x406d65['name'];}_0x4021aa['status'](_0x11c974)['send'](_0x406d65);};}exports[_0xdcf3('0x3e')]=function(_0x33229d,_0x25903e){var _0x477c61={},_0x10d2e1={},_0x2eb26a={'count':0x0,'rows':[]};var _0x26a119=_[_0xdcf3('0x3f')](db[_0xdcf3('0x40')]['rawAttributes'],function(_0x48d9bb){return{'name':_0x48d9bb[_0xdcf3('0x41')],'type':_0x48d9bb['type'][_0xdcf3('0x42')]};});_0x10d2e1[_0xdcf3('0x43')]=_['map'](_0x26a119,'name');_0x10d2e1[_0xdcf3('0x44')]=_['keys'](_0x33229d['query']);_0x10d2e1[_0xdcf3('0x45')]=_['intersection'](_0x10d2e1[_0xdcf3('0x43')],_0x10d2e1[_0xdcf3('0x44')]);_0x477c61[_0xdcf3('0x46')]=_['intersection'](_0x10d2e1[_0xdcf3('0x43')],qs[_0xdcf3('0x47')](_0x33229d[_0xdcf3('0x44')][_0xdcf3('0x47')]));_0x477c61[_0xdcf3('0x46')]=_0x477c61[_0xdcf3('0x46')][_0xdcf3('0x48')]?_0x477c61['attributes']:_0x10d2e1[_0xdcf3('0x43')];if(!_0x33229d[_0xdcf3('0x44')][_0xdcf3('0x49')]('nolimit')){_0x477c61[_0xdcf3('0x32')]=qs[_0xdcf3('0x32')](_0x33229d['query'][_0xdcf3('0x32')]);_0x477c61[_0xdcf3('0x34')]=qs['offset'](_0x33229d[_0xdcf3('0x44')][_0xdcf3('0x34')]);}_0x477c61[_0xdcf3('0x4a')]=qs[_0xdcf3('0x4b')](_0x33229d['query'][_0xdcf3('0x4b')]);_0x477c61['where']=qs[_0xdcf3('0x45')](_[_0xdcf3('0x4c')](_0x33229d[_0xdcf3('0x44')],_0x10d2e1[_0xdcf3('0x45')]),_0x26a119);if(_0x33229d[_0xdcf3('0x44')][_0xdcf3('0x4d')]){_0x477c61[_0xdcf3('0x4e')]=_[_0xdcf3('0x4f')](_0x477c61['where'],{'$or':_[_0xdcf3('0x3f')](_0x26a119,function(_0x309a2b){if(_0x309a2b[_0xdcf3('0x50')]!=='VIRTUAL'){var _0x4d171d={};_0x4d171d[_0x309a2b[_0xdcf3('0x3d')]]={'$like':'%'+_0x33229d[_0xdcf3('0x44')][_0xdcf3('0x4d')]+'%'};return _0x4d171d;}})});}_0x477c61=_[_0xdcf3('0x4f')]({},_0x477c61,_0x33229d[_0xdcf3('0x51')]);var _0x5d11cf={'where':_0x477c61[_0xdcf3('0x4e')]};return db['SmsMessage']['count'](_0x5d11cf)[_0xdcf3('0x22')](function(_0x256b77){_0x2eb26a[_0xdcf3('0x33')]=_0x256b77;if(_0x33229d[_0xdcf3('0x44')][_0xdcf3('0x52')]){_0x477c61[_0xdcf3('0x53')]=[{'all':!![]}];}return db['SmsMessage'][_0xdcf3('0x54')](_0x477c61);})[_0xdcf3('0x22')](function(_0x1b96b9){_0x2eb26a[_0xdcf3('0x55')]=_0x1b96b9;return _0x2eb26a;})['then'](respondWithFilteredResult(_0x25903e,_0x477c61))[_0xdcf3('0x2d')](handleError(_0x25903e,null));};exports[_0xdcf3('0x56')]=function(_0x2bfada,_0x362e1b){var _0x2fce7e={'raw':!![],'where':{'id':_0x2bfada[_0xdcf3('0x57')]['id']}},_0x45c529={};_0x45c529[_0xdcf3('0x43')]=_[_0xdcf3('0x58')](db['SmsMessage']['rawAttributes']);_0x45c529[_0xdcf3('0x44')]=_[_0xdcf3('0x58')](_0x2bfada[_0xdcf3('0x44')]);_0x45c529['filters']=_[_0xdcf3('0x59')](_0x45c529['model'],_0x45c529[_0xdcf3('0x44')]);_0x2fce7e['attributes']=_[_0xdcf3('0x59')](_0x45c529[_0xdcf3('0x43')],qs[_0xdcf3('0x47')](_0x2bfada[_0xdcf3('0x44')]['fields']));_0x2fce7e[_0xdcf3('0x46')]=_0x2fce7e[_0xdcf3('0x46')]['length']?_0x2fce7e[_0xdcf3('0x46')]:_0x45c529[_0xdcf3('0x43')];if(_0x2bfada[_0xdcf3('0x44')][_0xdcf3('0x52')]){_0x2fce7e[_0xdcf3('0x53')]=[{'all':!![]}];}_0x2fce7e=_['merge']({},_0x2fce7e,_0x2bfada[_0xdcf3('0x51')]);return db[_0xdcf3('0x40')][_0xdcf3('0x5a')](_0x2fce7e)[_0xdcf3('0x22')](handleEntityNotFound(_0x362e1b,null))[_0xdcf3('0x22')](respondWithResult(_0x362e1b,null))['catch'](handleError(_0x362e1b,null));};exports[_0xdcf3('0x5b')]=function(_0x3639ef,_0x4ca59e){return db['SmsMessage']['create'](_0x3639ef['body'],{})[_0xdcf3('0x22')](respondWithResult(_0x4ca59e,0xc9))[_0xdcf3('0x2d')](handleError(_0x4ca59e,null));};exports[_0xdcf3('0x3a')]=function(_0x4b3455,_0x2d3dfa){if(_0x4b3455['body']['id']){delete _0x4b3455[_0xdcf3('0x5c')]['id'];}return db['SmsMessage'][_0xdcf3('0x5a')]({'where':{'id':_0x4b3455[_0xdcf3('0x57')]['id']}})[_0xdcf3('0x22')](handleEntityNotFound(_0x2d3dfa,null))[_0xdcf3('0x22')](saveUpdates(_0x4b3455[_0xdcf3('0x5c')],null))[_0xdcf3('0x22')](respondWithResult(_0x2d3dfa,null))[_0xdcf3('0x2d')](handleError(_0x2d3dfa,null));};exports[_0xdcf3('0x5d')]=function(_0x237f43,_0x3fd8a0){return db[_0xdcf3('0x40')][_0xdcf3('0x5a')]({'where':{'id':_0x237f43[_0xdcf3('0x57')]['id']}})[_0xdcf3('0x22')](handleEntityNotFound(_0x3fd8a0,null))[_0xdcf3('0x22')](removeEntity(_0x3fd8a0,null))[_0xdcf3('0x2d')](handleError(_0x3fd8a0,null));};exports[_0xdcf3('0x5e')]=function(_0x783235,_0x1745ec){return db[_0xdcf3('0x40')]['describe']()['then'](respondWithResult(_0x1745ec,null))[_0xdcf3('0x2d')](handleError(_0x1745ec,null));};var interaction_log=require(_0xdcf3('0x14'))(_0xdcf3('0x5f'));exports[_0xdcf3('0x60')]=function(_0x4fa00a,_0x62409d,_0x53a612){var _0x295b3b={'agent':{},'channel':_0xdcf3('0x61')};if(_0x4fa00a[_0xdcf3('0x5c')]['id']){delete _0x4fa00a[_0xdcf3('0x5c')]['id'];}_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x62')]=!![];_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x63')]=moment()[_0xdcf3('0x64')](_0xdcf3('0x65'));_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x66')]=_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x66')]||_0x4fa00a['user']['id'];_0x295b3b['agent']['id']=_0x4fa00a[_0xdcf3('0x5c')]['UserId'];return db[_0xdcf3('0x40')][_0xdcf3('0x5a')]({'where':{'id':_0x4fa00a[_0xdcf3('0x57')]['id'],'UserId':null}})[_0xdcf3('0x22')](handleEntityNotFound(_0x62409d,null))[_0xdcf3('0x22')](saveUpdates(_0x4fa00a[_0xdcf3('0x5c')],null))['then'](function(_0x394312){if(_0x394312){_0x295b3b[_0xdcf3('0x2b')]=_0x394312['get']({'plain':!![]});return db[_0xdcf3('0x67')][_0xdcf3('0x5a')]({'where':{'id':_0x394312['SmsInteractionId']}});}return null;})[_0xdcf3('0x22')](handleEntityNotFound(_0x62409d,null))[_0xdcf3('0x22')](function(_0x46941b){if(_0x46941b){return _0x46941b[_0xdcf3('0x3a')]({'UserId':_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x66')],'read1stAt':_[_0xdcf3('0x68')](_0x46941b[_0xdcf3('0x69')])?moment()[_0xdcf3('0x64')](_0xdcf3('0x65')):undefined});}return null;})[_0xdcf3('0x22')](function(_0x353af3){if(_0x353af3){_0x295b3b['interaction']=_0x353af3[_0xdcf3('0x6a')]({'plain':!![]});interaction_log[_0xdcf3('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fa00a[_0xdcf3('0x6b')]['id'],_0x4fa00a[_0xdcf3('0x6b')][_0xdcf3('0x3d')],_0x4fa00a[_0xdcf3('0x6b')][_0xdcf3('0x6c')],_0x295b3b[_0xdcf3('0x6d')]['id'],_0x4fa00a['body']?JSON[_0xdcf3('0x28')](_0x4fa00a['body']):_0xdcf3('0x6e'));return respondWithRpcPromise(_0xdcf3('0x6f'),_0xdcf3('0x70'),_0x295b3b);}return null;})[_0xdcf3('0x22')](function(_0x52ec71){var _0x155574=_0xdcf3('0x71')+_0x52ec71[_0xdcf3('0x2b')]['ContactId'];return db[_0xdcf3('0x72')][_0xdcf3('0x44')](_0x155574,{'type':db[_0xdcf3('0x73')][_0xdcf3('0x74')][_0xdcf3('0x75')],'raw':!![]})[_0xdcf3('0x22')](function(_0x4bfcd9){return _0x4bfcd9;});})[_0xdcf3('0x22')](function(_0x578f82){if(_0x578f82){_0x295b3b[_0xdcf3('0x2b')][_0xdcf3('0x76')]=_0x578f82[0x0];if(!_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x66')])return;return db['User'][_0xdcf3('0x5a')]({'where':{'id':_0x4fa00a[_0xdcf3('0x5c')][_0xdcf3('0x66')],'role':_0xdcf3('0x77')},'attributes':['id',_0xdcf3('0x3d'),'fullname','email',_0xdcf3('0x78')],'raw':!![]});}return null;})[_0xdcf3('0x22')](function(_0x2608cf){if(!_0x2608cf)return null;_0x295b3b[_0xdcf3('0x2b')][_0xdcf3('0x77')]=_0x2608cf;return _0x295b3b;})[_0xdcf3('0x22')](function(_0x591512){if(_0x591512){if(_0x4fa00a[_0xdcf3('0x5c')]['manual']){_0x295b3b[_0xdcf3('0x2b')]['interface']=util[_0xdcf3('0x64')](_0xdcf3('0x79'),_0x4fa00a[_0xdcf3('0x6b')][_0xdcf3('0x3d')]);_0x295b3b[_0xdcf3('0x2b')][_0xdcf3('0x7a')]=_0x295b3b[_0xdcf3('0x7a')];_0x295b3b['message'][_0xdcf3('0x7b')]=_0x295b3b[_0xdcf3('0x7a')];_0x295b3b['message']['event']=_0xdcf3('0x60');return respondWithRpcPromise('EventManager',_0xdcf3('0x7c'),{'event':_0xdcf3('0x7d'),'message':_0x295b3b[_0xdcf3('0x2b')]},client9002)[_0xdcf3('0x22')](function(){return _0x295b3b;});}return _0x295b3b;}return null;})[_0xdcf3('0x22')](respondWithResult(_0x62409d,null))[_0xdcf3('0x2d')](handleError(_0x62409d,null));};var interaction_log=require(_0xdcf3('0x14'))(_0xdcf3('0x5f'));exports[_0xdcf3('0x38')]=function(_0x1e5be3,_0x439158,_0x5b5279){var _0x333562={'agent':{},'channel':_0xdcf3('0x61')};if(_0x1e5be3[_0xdcf3('0x5c')]['id']){delete _0x1e5be3['body']['id'];}_0x1e5be3[_0xdcf3('0x5c')][_0xdcf3('0x66')]=_0x1e5be3[_0xdcf3('0x5c')][_0xdcf3('0x66')]||_0x1e5be3[_0xdcf3('0x6b')]['id'];_0x333562['agent']['id']=_0x1e5be3['body'][_0xdcf3('0x66')];return db['SmsMessage'][_0xdcf3('0x5a')]({'where':{'id':_0x1e5be3[_0xdcf3('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x439158,null))[_0xdcf3('0x22')](function(_0x444122){if(_0x444122){_0x333562[_0xdcf3('0x2b')]=_0x444122['get']({'plain':!![]});return db[_0xdcf3('0x67')][_0xdcf3('0x5a')]({'where':{'id':_0x444122['SmsInteractionId']}});}return null;})[_0xdcf3('0x22')](handleEntityNotFound(_0x439158,null))[_0xdcf3('0x22')](function(_0x3a1f32){if(_0x3a1f32){_0x333562['interaction']=_0x3a1f32[_0xdcf3('0x6a')]({'plain':!![]});interaction_log[_0xdcf3('0x23')](_0xdcf3('0x7e'),_0x1e5be3['user']['id'],_0x1e5be3[_0xdcf3('0x6b')][_0xdcf3('0x3d')],_0x1e5be3[_0xdcf3('0x6b')][_0xdcf3('0x6c')],_0x333562[_0xdcf3('0x6d')]['id'],_0x1e5be3['body']?JSON['stringify'](_0x1e5be3['body']):'null');return respondWithRpcPromise(_0xdcf3('0x7f'),_0xdcf3('0x80'),_0x333562);}return null;})['then'](function(_0x52757c){var _0x5c0cea=_0xdcf3('0x71')+_0x52757c[_0xdcf3('0x2b')][_0xdcf3('0x81')];return db[_0xdcf3('0x72')]['query'](_0x5c0cea,{'type':db[_0xdcf3('0x73')][_0xdcf3('0x74')][_0xdcf3('0x75')],'raw':!![]})[_0xdcf3('0x22')](function(_0x17465d){return _0x17465d;});})[_0xdcf3('0x22')](function(_0x564dd1){if(_0x564dd1){_0x333562[_0xdcf3('0x2b')][_0xdcf3('0x76')]=_0x564dd1[0x0];if(!_0x1e5be3[_0xdcf3('0x5c')][_0xdcf3('0x66')])return;return db[_0xdcf3('0x82')][_0xdcf3('0x5a')]({'where':{'id':_0x1e5be3[_0xdcf3('0x5c')][_0xdcf3('0x66')],'role':_0xdcf3('0x77')},'attributes':['id',_0xdcf3('0x3d'),_0xdcf3('0x83'),_0xdcf3('0x84'),_0xdcf3('0x78')],'raw':!![]});}return null;})[_0xdcf3('0x22')](function(_0x329084){if(!_0x329084)return null;_0x333562['message'][_0xdcf3('0x77')]=_0x329084;return _0x333562;})[_0xdcf3('0x22')](function(_0x512393){if(_0x512393){_0x512393[_0xdcf3('0x2b')][_0xdcf3('0x85')]=util[_0xdcf3('0x64')](_0xdcf3('0x79'),_0x1e5be3[_0xdcf3('0x6b')][_0xdcf3('0x3d')]);_0x512393['message'][_0xdcf3('0x7a')]=_0x333562[_0xdcf3('0x7a')];_0x512393[_0xdcf3('0x2b')][_0xdcf3('0x7b')]=_0x333562[_0xdcf3('0x7a')];_0x512393[_0xdcf3('0x2b')]['event']=_0xdcf3('0x38');respondWithRpcPromise(_0xdcf3('0x7c'),_0xdcf3('0x7c'),{'event':_0xdcf3('0x86'),'message':_0x512393[_0xdcf3('0x2b')]},client9002);return _0x333562;}return null;})[_0xdcf3('0x22')](respondWithResult(_0x439158,null))[_0xdcf3('0x2d')](handleError(_0x439158,null));};exports[_0xdcf3('0x3b')]=function(_0x557e7f,_0x48b9ec,_0x245680){if(_0x557e7f[_0xdcf3('0x5c')]['id']){delete _0x557e7f['body']['id'];}var _0x4a8f15;return db[_0xdcf3('0x40')][_0xdcf3('0x5a')]({'where':{'id':_0x557e7f[_0xdcf3('0x57')]['id']}})[_0xdcf3('0x22')](handleEntityNotFound(_0x48b9ec,null))[_0xdcf3('0x22')](function(_0x15f94d){if(_0x15f94d){_0x4a8f15=_0x15f94d;return db[_0xdcf3('0x87')][_0xdcf3('0x5a')]({'where':{'id':_0x15f94d[_0xdcf3('0x88')]}});}})[_0xdcf3('0x22')](handleEntityNotFound(_0x48b9ec,null))[_0xdcf3('0x22')](function(_0x5e1ed4){if(_0x5e1ed4){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xdcf3('0x89'),_0x5e1ed4[_0xdcf3('0x50')],util['inspect'](_0x557e7f[_0xdcf3('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5e1ed4['type']){case _0xdcf3('0x8a'):if(_0x557e7f[_0xdcf3('0x5c')][_0xdcf3('0x8b')]&&_0x557e7f[_0xdcf3('0x5c')]['MessageSid']===_0x4a8f15[_0xdcf3('0x8c')]){return _0x4a8f15[_0xdcf3('0x3a')]({'read':!![]});}else{logger['error'](_0xdcf3('0x8d'),_0xdcf3('0x3b'),'twilio',util['inspect'](_0x557e7f[_0xdcf3('0x5c')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x557e7f['body']['MessageUUID']&&_0x557e7f['body'][_0xdcf3('0x8e')]===_0x4a8f15[_0xdcf3('0x8c')]&&_[_0xdcf3('0x8f')]([_0xdcf3('0x90'),_0xdcf3('0x91')],_0x557e7f[_0xdcf3('0x5c')][_0xdcf3('0x92')])>=0x0){return _0x4a8f15[_0xdcf3('0x3a')]({'read':!![]});}else{logger[_0xdcf3('0x2a')](_0xdcf3('0x8d'),_0xdcf3('0x3b'),_0xdcf3('0x93'),util[_0xdcf3('0x94')](_0x557e7f[_0xdcf3('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xdcf3('0x95'):var _0x222036=_0x557e7f['body']['results'][0x0];if(_0x222036[_0xdcf3('0x3b')]['groupName']===_0xdcf3('0x96')){return _0x4a8f15[_0xdcf3('0x3a')]({'read':!![]});}else{logger['error'](_0xdcf3('0x8d'),_0xdcf3('0x3b'),'infobip',util[_0xdcf3('0x94')](_0x557e7f['body'],{'showHidden':![],'depth':null}));}break;}return _0x4a8f15;}})[_0xdcf3('0x22')](respondWithResult(_0x48b9ec,null))[_0xdcf3('0x2d')](handleError(_0x48b9ec,null));}; \ No newline at end of file +var _0xf1d4=['findAll','rows','fields','length','find','create','body','params','destroy','describe','../../config/logger','readAt','format','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE: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','ContactId','sequelize','QueryTypes','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','sms-interactions','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','contact','rejectmessage','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','request','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','end','offset','undefined','count','set','json','reject','save','update','then','sendStatus','stack','name','map','SmsMessage','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','options','includeAll','include'];(function(_0x479d88,_0x193fa7){var _0x469923=function(_0x544155){while(--_0x544155){_0x479d88['push'](_0x479d88['shift']());}};_0x469923(++_0x193fa7);}(_0xf1d4,0x158));var _0x4f1d=function(_0x5e1e42,_0x5359e9){_0x5e1e42=_0x5e1e42-0x0;var _0x33aa70=_0xf1d4[_0x5e1e42];return _0x33aa70;};'use strict';var emlformat=require(_0x4f1d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4f1d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f1d('0x2'));var moment=require(_0x4f1d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4f1d('0x4'));var util=require(_0x4f1d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4f1d('0x6'));var ejs=require(_0x4f1d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f1d('0x8'));var squel=require(_0x4f1d('0x9'));var crypto=require(_0x4f1d('0xa'));var jsforce=require(_0x4f1d('0xb'));var deskjs=require(_0x4f1d('0xc'));var toCsv=require(_0x4f1d('0x6'));var querystring=require(_0x4f1d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4f1d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x4f1d('0xf'));var hardwareService=require(_0x4f1d('0x10'));var logger=require('../../config/logger')(_0x4f1d('0x11'));var utils=require(_0x4f1d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f1d('0x13'))['db'];config['redis']=_[_0x4f1d('0x14')](config[_0x4f1d('0x15')],{'host':_0x4f1d('0x16'),'port':0x18eb});var socket=require(_0x4f1d('0x17'))(new Redis(config[_0x4f1d('0x15')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x4f1d('0x18'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x4f1d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5081e3,_0x46aa61,_0x590ba4,_0x3e9e79){return new BPromise(function(_0x53a39f,_0x2e8bc7){var _0x85a4b5=_0x3e9e79||client;return _0x85a4b5[_0x4f1d('0x1a')](_0x5081e3,_0x590ba4)['then'](function(_0x1d418b){logger[_0x4f1d('0x1b')](_0x4f1d('0x1c'),_0x46aa61,'request\x20sent');logger[_0x4f1d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x46aa61,_0x4f1d('0x1e'),JSON['stringify'](_0x1d418b));if(_0x1d418b[_0x4f1d('0x1f')]){if(_0x1d418b['error'][_0x4f1d('0x20')]===0x1f4){logger[_0x4f1d('0x1f')](_0x4f1d('0x1c'),_0x46aa61,_0x1d418b[_0x4f1d('0x1f')][_0x4f1d('0x21')]);return _0x2e8bc7(_0x1d418b[_0x4f1d('0x1f')]['message']);}logger[_0x4f1d('0x1f')](_0x4f1d('0x1c'),_0x46aa61,_0x1d418b[_0x4f1d('0x1f')][_0x4f1d('0x21')]);return _0x53a39f(_0x1d418b['error'][_0x4f1d('0x21')]);}else{logger[_0x4f1d('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x46aa61,_0x4f1d('0x1e'));_0x53a39f(_0x1d418b[_0x4f1d('0x22')][_0x4f1d('0x21')]);}})[_0x4f1d('0x23')](function(_0x3fd3dc){logger[_0x4f1d('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x46aa61,_0x3fd3dc);_0x2e8bc7(_0x3fd3dc);});});}function respondWithStatusCode(_0x21bdad,_0x22a201){_0x22a201=_0x22a201||0xcc;return function(_0x4f7431){if(_0x4f7431){return _0x21bdad['sendStatus'](_0x22a201);}return _0x21bdad[_0x4f1d('0x24')](_0x22a201)[_0x4f1d('0x25')]();};}function respondWithResult(_0x14a8bf,_0x114673){_0x114673=_0x114673||0xc8;return function(_0x4d43ca){if(_0x4d43ca){return _0x14a8bf[_0x4f1d('0x24')](_0x114673)['json'](_0x4d43ca);}};}function respondWithFilteredResult(_0x50625d,_0x4525eb){return function(_0xce9adf){if(_0xce9adf){var _0x4eabb0=typeof _0x4525eb[_0x4f1d('0x26')]==='undefined'&&typeof _0x4525eb['limit']===_0x4f1d('0x27');var _0x7894a6=_0xce9adf[_0x4f1d('0x28')];var _0x456618=_0x4eabb0?0x0:_0x4525eb[_0x4f1d('0x26')];var _0x446865=_0x4eabb0?_0xce9adf[_0x4f1d('0x28')]:_0x4525eb[_0x4f1d('0x26')]+_0x4525eb['limit'];var _0x2505ae;if(_0x446865>=_0x7894a6){_0x446865=_0x7894a6;_0x2505ae=0xc8;}else{_0x2505ae=0xce;}_0x50625d[_0x4f1d('0x24')](_0x2505ae);return _0x50625d[_0x4f1d('0x29')]('Content-Range',_0x456618+'-'+_0x446865+'/'+_0x7894a6)[_0x4f1d('0x2a')](_0xce9adf);}return null;};}function patchUpdates(_0x2614b2){return function(_0x498898){try{jsonpatch['apply'](_0x498898,_0x2614b2,!![]);}catch(_0x33e45e){return BPromise[_0x4f1d('0x2b')](_0x33e45e);}return _0x498898[_0x4f1d('0x2c')]();};}function saveUpdates(_0x4a3f37,_0x23008b){return function(_0x2f84a1){if(_0x2f84a1){return _0x2f84a1[_0x4f1d('0x2d')](_0x4a3f37)[_0x4f1d('0x2e')](function(_0x468186){return _0x468186;});}return null;};}function removeEntity(_0x5cf370,_0x964dfd){return function(_0x5ce2ef){if(_0x5ce2ef){return _0x5ce2ef['destroy']()[_0x4f1d('0x2e')](function(){_0x5cf370[_0x4f1d('0x24')](0xcc)[_0x4f1d('0x25')]();});}};}function handleEntityNotFound(_0x311fad,_0x467c9b){return function(_0x510adb){if(!_0x510adb){_0x311fad[_0x4f1d('0x2f')](0x194);}return _0x510adb;};}function handleError(_0x56d88a,_0xbed0ea){_0xbed0ea=_0xbed0ea||0x1f4;return function(_0x31dd93){logger[_0x4f1d('0x1f')](_0x31dd93[_0x4f1d('0x30')]);if(_0x31dd93[_0x4f1d('0x31')]){delete _0x31dd93[_0x4f1d('0x31')];}_0x56d88a[_0x4f1d('0x24')](_0xbed0ea)['send'](_0x31dd93);};}exports['index']=function(_0x4e3da6,_0x214869){var _0xb78f8d={},_0x1f1f5b={},_0x126c7d={'count':0x0,'rows':[]};var _0x534384=_[_0x4f1d('0x32')](db[_0x4f1d('0x33')][_0x4f1d('0x34')],function(_0x57622b){return{'name':_0x57622b[_0x4f1d('0x35')],'type':_0x57622b[_0x4f1d('0x36')][_0x4f1d('0x37')]};});_0x1f1f5b[_0x4f1d('0x38')]=_['map'](_0x534384,'name');_0x1f1f5b['query']=_[_0x4f1d('0x39')](_0x4e3da6[_0x4f1d('0x3a')]);_0x1f1f5b['filters']=_['intersection'](_0x1f1f5b[_0x4f1d('0x38')],_0x1f1f5b[_0x4f1d('0x3a')]);_0xb78f8d[_0x4f1d('0x3b')]=_[_0x4f1d('0x3c')](_0x1f1f5b[_0x4f1d('0x38')],qs['fields'](_0x4e3da6[_0x4f1d('0x3a')]['fields']));_0xb78f8d['attributes']=_0xb78f8d[_0x4f1d('0x3b')]['length']?_0xb78f8d[_0x4f1d('0x3b')]:_0x1f1f5b[_0x4f1d('0x38')];if(!_0x4e3da6[_0x4f1d('0x3a')][_0x4f1d('0x3d')](_0x4f1d('0x3e'))){_0xb78f8d[_0x4f1d('0x3f')]=qs['limit'](_0x4e3da6['query'][_0x4f1d('0x3f')]);_0xb78f8d[_0x4f1d('0x26')]=qs[_0x4f1d('0x26')](_0x4e3da6[_0x4f1d('0x3a')][_0x4f1d('0x26')]);}_0xb78f8d[_0x4f1d('0x40')]=qs[_0x4f1d('0x41')](_0x4e3da6['query'][_0x4f1d('0x41')]);_0xb78f8d[_0x4f1d('0x42')]=qs[_0x4f1d('0x43')](_[_0x4f1d('0x44')](_0x4e3da6[_0x4f1d('0x3a')],_0x1f1f5b[_0x4f1d('0x43')]),_0x534384);if(_0x4e3da6[_0x4f1d('0x3a')]['filter']){_0xb78f8d[_0x4f1d('0x42')]=_[_0x4f1d('0x45')](_0xb78f8d[_0x4f1d('0x42')],{'$or':_[_0x4f1d('0x32')](_0x534384,function(_0xb9c0e2){if(_0xb9c0e2[_0x4f1d('0x36')]!=='VIRTUAL'){var _0x33167a={};_0x33167a[_0xb9c0e2['name']]={'$like':'%'+_0x4e3da6[_0x4f1d('0x3a')]['filter']+'%'};return _0x33167a;}})});}_0xb78f8d=_['merge']({},_0xb78f8d,_0x4e3da6[_0x4f1d('0x46')]);var _0x431327={'where':_0xb78f8d[_0x4f1d('0x42')]};return db[_0x4f1d('0x33')][_0x4f1d('0x28')](_0x431327)[_0x4f1d('0x2e')](function(_0x44013a){_0x126c7d[_0x4f1d('0x28')]=_0x44013a;if(_0x4e3da6[_0x4f1d('0x3a')][_0x4f1d('0x47')]){_0xb78f8d[_0x4f1d('0x48')]=[{'all':!![]}];}return db[_0x4f1d('0x33')][_0x4f1d('0x49')](_0xb78f8d);})['then'](function(_0x4bb00f){_0x126c7d[_0x4f1d('0x4a')]=_0x4bb00f;return _0x126c7d;})[_0x4f1d('0x2e')](respondWithFilteredResult(_0x214869,_0xb78f8d))[_0x4f1d('0x23')](handleError(_0x214869,null));};exports['show']=function(_0x6a5568,_0x2ab294){var _0x971fdb={'raw':!![],'where':{'id':_0x6a5568['params']['id']}},_0x32d1f3={};_0x32d1f3[_0x4f1d('0x38')]=_[_0x4f1d('0x39')](db[_0x4f1d('0x33')][_0x4f1d('0x34')]);_0x32d1f3[_0x4f1d('0x3a')]=_['keys'](_0x6a5568[_0x4f1d('0x3a')]);_0x32d1f3[_0x4f1d('0x43')]=_[_0x4f1d('0x3c')](_0x32d1f3[_0x4f1d('0x38')],_0x32d1f3[_0x4f1d('0x3a')]);_0x971fdb[_0x4f1d('0x3b')]=_['intersection'](_0x32d1f3[_0x4f1d('0x38')],qs[_0x4f1d('0x4b')](_0x6a5568[_0x4f1d('0x3a')][_0x4f1d('0x4b')]));_0x971fdb['attributes']=_0x971fdb[_0x4f1d('0x3b')][_0x4f1d('0x4c')]?_0x971fdb[_0x4f1d('0x3b')]:_0x32d1f3[_0x4f1d('0x38')];if(_0x6a5568['query'][_0x4f1d('0x47')]){_0x971fdb[_0x4f1d('0x48')]=[{'all':!![]}];}_0x971fdb=_[_0x4f1d('0x45')]({},_0x971fdb,_0x6a5568[_0x4f1d('0x46')]);return db[_0x4f1d('0x33')][_0x4f1d('0x4d')](_0x971fdb)[_0x4f1d('0x2e')](handleEntityNotFound(_0x2ab294,null))[_0x4f1d('0x2e')](respondWithResult(_0x2ab294,null))['catch'](handleError(_0x2ab294,null));};exports[_0x4f1d('0x4e')]=function(_0x5a3aa1,_0x54a69e){return db[_0x4f1d('0x33')][_0x4f1d('0x4e')](_0x5a3aa1['body'],{})[_0x4f1d('0x2e')](respondWithResult(_0x54a69e,0xc9))[_0x4f1d('0x23')](handleError(_0x54a69e,null));};exports[_0x4f1d('0x2d')]=function(_0x57f9ef,_0x138030){if(_0x57f9ef[_0x4f1d('0x4f')]['id']){delete _0x57f9ef[_0x4f1d('0x4f')]['id'];}return db[_0x4f1d('0x33')][_0x4f1d('0x4d')]({'where':{'id':_0x57f9ef[_0x4f1d('0x50')]['id']}})['then'](handleEntityNotFound(_0x138030,null))['then'](saveUpdates(_0x57f9ef[_0x4f1d('0x4f')],null))['then'](respondWithResult(_0x138030,null))[_0x4f1d('0x23')](handleError(_0x138030,null));};exports[_0x4f1d('0x51')]=function(_0x4fadeb,_0x28f9e6){return db['SmsMessage'][_0x4f1d('0x4d')]({'where':{'id':_0x4fadeb['params']['id']}})['then'](handleEntityNotFound(_0x28f9e6,null))[_0x4f1d('0x2e')](removeEntity(_0x28f9e6,null))[_0x4f1d('0x23')](handleError(_0x28f9e6,null));};exports[_0x4f1d('0x52')]=function(_0x3453d3,_0x24bf61){return db[_0x4f1d('0x33')]['describe']()['then'](respondWithResult(_0x24bf61,null))[_0x4f1d('0x23')](handleError(_0x24bf61,null));};var interaction_log=require(_0x4f1d('0x53'))('sms-interactions');exports['accept']=function(_0x591b3d,_0x3fb623,_0x1db90c){var _0x5574b5={'agent':{},'channel':'sms'};if(_0x591b3d[_0x4f1d('0x4f')]['id']){delete _0x591b3d[_0x4f1d('0x4f')]['id'];}_0x591b3d['body']['read']=!![];_0x591b3d[_0x4f1d('0x4f')][_0x4f1d('0x54')]=moment()[_0x4f1d('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x591b3d['body'][_0x4f1d('0x56')]=_0x591b3d[_0x4f1d('0x4f')]['UserId']||_0x591b3d['user']['id'];_0x5574b5[_0x4f1d('0x57')]['id']=_0x591b3d[_0x4f1d('0x4f')][_0x4f1d('0x56')];return db[_0x4f1d('0x33')]['find']({'where':{'id':_0x591b3d[_0x4f1d('0x50')]['id'],'UserId':null}})[_0x4f1d('0x2e')](handleEntityNotFound(_0x3fb623,null))['then'](saveUpdates(_0x591b3d[_0x4f1d('0x4f')],null))[_0x4f1d('0x2e')](function(_0xea4681){if(_0xea4681){_0x5574b5['message']=_0xea4681[_0x4f1d('0x58')]({'plain':!![]});return db[_0x4f1d('0x59')]['find']({'where':{'id':_0xea4681[_0x4f1d('0x5a')]}});}return null;})[_0x4f1d('0x2e')](handleEntityNotFound(_0x3fb623,null))[_0x4f1d('0x2e')](function(_0x33330b){if(_0x33330b){return _0x33330b['update']({'UserId':_0x591b3d[_0x4f1d('0x4f')][_0x4f1d('0x56')],'read1stAt':_[_0x4f1d('0x5b')](_0x33330b[_0x4f1d('0x5c')])?moment()[_0x4f1d('0x55')](_0x4f1d('0x5d')):undefined});}return null;})[_0x4f1d('0x2e')](function(_0x5a36ff){if(_0x5a36ff){_0x5574b5[_0x4f1d('0x5e')]=_0x5a36ff[_0x4f1d('0x58')]({'plain':!![]});interaction_log[_0x4f1d('0x1b')](_0x4f1d('0x5f'),_0x591b3d[_0x4f1d('0x60')]['id'],_0x591b3d['user'][_0x4f1d('0x31')],_0x591b3d['user'][_0x4f1d('0x61')],_0x5574b5[_0x4f1d('0x5e')]['id'],_0x591b3d[_0x4f1d('0x4f')]?JSON[_0x4f1d('0x62')](_0x591b3d[_0x4f1d('0x4f')]):_0x4f1d('0x63'));return respondWithRpcPromise(_0x4f1d('0x64'),_0x4f1d('0x65'),_0x5574b5);}return null;})[_0x4f1d('0x2e')](function(_0x2a3676){var _0x46d9ae=_0x4f1d('0x66')+_0x2a3676[_0x4f1d('0x21')][_0x4f1d('0x67')];return db[_0x4f1d('0x68')][_0x4f1d('0x3a')](_0x46d9ae,{'type':db['Sequelize'][_0x4f1d('0x69')]['SELECT'],'raw':!![]})[_0x4f1d('0x2e')](function(_0x52f860){return _0x52f860;});})['then'](function(_0x9b7184){if(_0x9b7184){_0x5574b5[_0x4f1d('0x21')]['contact']=_0x9b7184[0x0];if(!_0x591b3d[_0x4f1d('0x4f')][_0x4f1d('0x56')])return;return db['User'][_0x4f1d('0x4d')]({'where':{'id':_0x591b3d['body'][_0x4f1d('0x56')],'role':_0x4f1d('0x57')},'attributes':['id',_0x4f1d('0x31'),_0x4f1d('0x6a'),_0x4f1d('0x6b'),_0x4f1d('0x6c')],'raw':!![]});}return null;})[_0x4f1d('0x2e')](function(_0x3c7d8a){if(!_0x3c7d8a)return null;_0x5574b5[_0x4f1d('0x21')][_0x4f1d('0x57')]=_0x3c7d8a;return _0x5574b5;})[_0x4f1d('0x2e')](function(_0x1d1d5c){if(_0x1d1d5c){if(_0x591b3d[_0x4f1d('0x4f')][_0x4f1d('0x6d')]){_0x5574b5[_0x4f1d('0x21')][_0x4f1d('0x6e')]=util['format'](_0x4f1d('0x6f'),_0x591b3d[_0x4f1d('0x60')][_0x4f1d('0x31')]);_0x5574b5[_0x4f1d('0x21')]['channel']=_0x5574b5['channel'];_0x5574b5[_0x4f1d('0x21')]['motionChannel']=_0x5574b5[_0x4f1d('0x70')];_0x5574b5[_0x4f1d('0x21')]['event']='accept';return respondWithRpcPromise(_0x4f1d('0x71'),_0x4f1d('0x71'),{'event':'acceptmessage','message':_0x5574b5[_0x4f1d('0x21')]},client9002)[_0x4f1d('0x2e')](function(){return _0x5574b5;});}return _0x5574b5;}return null;})[_0x4f1d('0x2e')](respondWithResult(_0x3fb623,null))[_0x4f1d('0x23')](handleError(_0x3fb623,null));};var interaction_log=require('../../config/logger')(_0x4f1d('0x72'));exports['reject']=function(_0x2b0cb6,_0x356872,_0x3beb96){var _0x1755d8={'agent':{},'channel':_0x4f1d('0x73')};if(_0x2b0cb6[_0x4f1d('0x4f')]['id']){delete _0x2b0cb6[_0x4f1d('0x4f')]['id'];}_0x2b0cb6[_0x4f1d('0x4f')][_0x4f1d('0x56')]=_0x2b0cb6[_0x4f1d('0x4f')][_0x4f1d('0x56')]||_0x2b0cb6[_0x4f1d('0x60')]['id'];_0x1755d8['agent']['id']=_0x2b0cb6[_0x4f1d('0x4f')][_0x4f1d('0x56')];return db['SmsMessage']['find']({'where':{'id':_0x2b0cb6[_0x4f1d('0x50')]['id'],'UserId':null}})[_0x4f1d('0x2e')](handleEntityNotFound(_0x356872,null))[_0x4f1d('0x2e')](function(_0x3b6fcd){if(_0x3b6fcd){_0x1755d8[_0x4f1d('0x21')]=_0x3b6fcd[_0x4f1d('0x58')]({'plain':!![]});return db['SmsInteraction'][_0x4f1d('0x4d')]({'where':{'id':_0x3b6fcd[_0x4f1d('0x5a')]}});}return null;})[_0x4f1d('0x2e')](handleEntityNotFound(_0x356872,null))[_0x4f1d('0x2e')](function(_0x14688d){if(_0x14688d){_0x1755d8[_0x4f1d('0x5e')]=_0x14688d[_0x4f1d('0x58')]({'plain':!![]});interaction_log[_0x4f1d('0x1b')](_0x4f1d('0x74'),_0x2b0cb6[_0x4f1d('0x60')]['id'],_0x2b0cb6[_0x4f1d('0x60')][_0x4f1d('0x31')],_0x2b0cb6['user'][_0x4f1d('0x61')],_0x1755d8[_0x4f1d('0x5e')]['id'],_0x2b0cb6['body']?JSON[_0x4f1d('0x62')](_0x2b0cb6[_0x4f1d('0x4f')]):'null');return respondWithRpcPromise(_0x4f1d('0x75'),_0x4f1d('0x76'),_0x1755d8);}return null;})[_0x4f1d('0x2e')](function(_0x55aac4){var _0xe3aa30='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x55aac4[_0x4f1d('0x21')][_0x4f1d('0x67')];return db[_0x4f1d('0x68')][_0x4f1d('0x3a')](_0xe3aa30,{'type':db[_0x4f1d('0x77')][_0x4f1d('0x69')]['SELECT'],'raw':!![]})[_0x4f1d('0x2e')](function(_0xe33cbb){return _0xe33cbb;});})[_0x4f1d('0x2e')](function(_0x4d0b05){if(_0x4d0b05){_0x1755d8[_0x4f1d('0x21')][_0x4f1d('0x78')]=_0x4d0b05[0x0];if(!_0x2b0cb6[_0x4f1d('0x4f')]['UserId'])return;return db['User'][_0x4f1d('0x4d')]({'where':{'id':_0x2b0cb6[_0x4f1d('0x4f')]['UserId'],'role':_0x4f1d('0x57')},'attributes':['id',_0x4f1d('0x31'),_0x4f1d('0x6a'),_0x4f1d('0x6b'),_0x4f1d('0x6c')],'raw':!![]});}return null;})[_0x4f1d('0x2e')](function(_0x2facf6){if(!_0x2facf6)return null;_0x1755d8['message'][_0x4f1d('0x57')]=_0x2facf6;return _0x1755d8;})[_0x4f1d('0x2e')](function(_0x16124a){if(_0x16124a){_0x16124a[_0x4f1d('0x21')][_0x4f1d('0x6e')]=util[_0x4f1d('0x55')](_0x4f1d('0x6f'),_0x2b0cb6['user'][_0x4f1d('0x31')]);_0x16124a[_0x4f1d('0x21')]['channel']=_0x1755d8['channel'];_0x16124a[_0x4f1d('0x21')]['motionChannel']=_0x1755d8[_0x4f1d('0x70')];_0x16124a[_0x4f1d('0x21')]['event']=_0x4f1d('0x2b');respondWithRpcPromise('EventManager',_0x4f1d('0x71'),{'event':_0x4f1d('0x79'),'message':_0x16124a[_0x4f1d('0x21')]},client9002);return _0x1755d8;}return null;})['then'](respondWithResult(_0x356872,null))[_0x4f1d('0x23')](handleError(_0x356872,null));};exports[_0x4f1d('0x24')]=function(_0x2e9ad0,_0x11eae1,_0x3516c4){if(_0x2e9ad0[_0x4f1d('0x4f')]['id']){delete _0x2e9ad0[_0x4f1d('0x4f')]['id'];}var _0x39f0c4;return db['SmsMessage'][_0x4f1d('0x4d')]({'where':{'id':_0x2e9ad0[_0x4f1d('0x50')]['id']}})[_0x4f1d('0x2e')](handleEntityNotFound(_0x11eae1,null))[_0x4f1d('0x2e')](function(_0x21e701){if(_0x21e701){_0x39f0c4=_0x21e701;return db['SmsAccount']['find']({'where':{'id':_0x21e701[_0x4f1d('0x7a')]}});}})['then'](handleEntityNotFound(_0x11eae1,null))[_0x4f1d('0x2e')](function(_0xc68a3c){if(_0xc68a3c){logger[_0x4f1d('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4f1d('0x24'),'received\x20delivery\x20report\x20from',_0xc68a3c[_0x4f1d('0x36')],util[_0x4f1d('0x7b')](_0x2e9ad0[_0x4f1d('0x4f')],{'showHidden':![],'depth':null}));switch(_0xc68a3c['type']){case'twilio':if(_0x2e9ad0['body'][_0x4f1d('0x7c')]&&_0x2e9ad0['body'][_0x4f1d('0x7c')]===_0x39f0c4[_0x4f1d('0x7d')]){return _0x39f0c4[_0x4f1d('0x2d')]({'read':!![]});}else{logger['error'](_0x4f1d('0x7e'),_0x4f1d('0x24'),_0x4f1d('0x7f'),util[_0x4f1d('0x7b')](_0x2e9ad0['body'],{'showHidden':![],'depth':null}));}break;case _0x4f1d('0x80'):if(_0x2e9ad0[_0x4f1d('0x4f')][_0x4f1d('0x81')]&&_0x2e9ad0[_0x4f1d('0x4f')][_0x4f1d('0x81')]===_0x39f0c4[_0x4f1d('0x7d')]&&_[_0x4f1d('0x82')]([_0x4f1d('0x83'),_0x4f1d('0x84')],_0x2e9ad0[_0x4f1d('0x4f')][_0x4f1d('0x85')])>=0x0){return _0x39f0c4[_0x4f1d('0x2d')]({'read':!![]});}else{logger['error'](_0x4f1d('0x7e'),_0x4f1d('0x24'),_0x4f1d('0x86'),util[_0x4f1d('0x7b')](_0x2e9ad0['body'],{'showHidden':![],'depth':null}));}break;case _0x4f1d('0x87'):var _0x285ed8=_0x2e9ad0['body'][_0x4f1d('0x88')][0x0];if(_0x285ed8['status'][_0x4f1d('0x89')]===_0x4f1d('0x8a')){return _0x39f0c4[_0x4f1d('0x2d')]({'read':!![]});}else{logger[_0x4f1d('0x1f')](_0x4f1d('0x7e'),_0x4f1d('0x24'),'infobip',util[_0x4f1d('0x7b')](_0x2e9ad0[_0x4f1d('0x4f')],{'showHidden':![],'depth':null}));}break;}return _0x39f0c4;}})[_0x4f1d('0x2e')](respondWithResult(_0x11eae1,null))[_0x4f1d('0x23')](handleError(_0x11eae1,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 34632fb..7498ea6 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 _0x32b5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','SmsMessage'];(function(_0x495df5,_0x180ac8){var _0x2a51b7=function(_0x2426fd){while(--_0x2426fd){_0x495df5['push'](_0x495df5['shift']());}};_0x2a51b7(++_0x180ac8);}(_0x32b5,0x1e8));var _0x532b=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x32b5[_0xa1e3e3];return _0xc980e9;};'use strict';var EventEmitter=require(_0x532b('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x532b('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x532b('0x2')](0x0);var events={'afterCreate':_0x532b('0x3'),'afterUpdate':_0x532b('0x4'),'afterDestroy':_0x532b('0x5')};function emitEvent(_0x3c1d1b){return function(_0x5a183e,_0x59c687,_0x4c2917){SmsMessageEvents[_0x532b('0x6')](_0x3c1d1b+':'+_0x5a183e['id'],_0x5a183e);SmsMessageEvents['emit'](_0x3c1d1b,_0x5a183e);_0x4c2917(null);};}for(var e in events){if(events[_0x532b('0x7')](e)){var event=events[e];SmsMessage[_0x532b('0x8')](e,emitEvent(event));}}module[_0x532b('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x4ece=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5131bb,_0x1bcd9c){var _0x1a497b=function(_0x740767){while(--_0x740767){_0x5131bb['push'](_0x5131bb['shift']());}};_0x1a497b(++_0x1bcd9c);}(_0x4ece,0xd3));var _0xe4ec=function(_0x309b5e,_0x440f7f){_0x309b5e=_0x309b5e-0x0;var _0x4ef921=_0x4ece[_0x309b5e];return _0x4ef921;};'use strict';var EventEmitter=require(_0xe4ec('0x0'));var SmsMessage=require(_0xe4ec('0x1'))['db'][_0xe4ec('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe4ec('0x3')](0x0);var events={'afterCreate':_0xe4ec('0x4'),'afterUpdate':_0xe4ec('0x5'),'afterDestroy':_0xe4ec('0x6')};function emitEvent(_0x177aa8){return function(_0xf20967,_0x2c2723,_0x5bbf26){SmsMessageEvents[_0xe4ec('0x7')](_0x177aa8+':'+_0xf20967['id'],_0xf20967);SmsMessageEvents[_0xe4ec('0x7')](_0x177aa8,_0xf20967);_0x5bbf26(null);};}for(var e in events){if(events[_0xe4ec('0x8')](e)){var event=events[e];SmsMessage[_0xe4ec('0x9')](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 7047a1d..2dcb7f6 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 _0x75bb=['SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','GET','split','POST','user_key','session_key','total_sent','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','timestamp','keys','sort','length','md5','digest','signature=','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75bb,0x146));var _0xb75b=function(_0x528687,_0x55bc89){_0x528687=_0x528687-0x0;var _0x31e7ab=_0x75bb[_0x528687];return _0x31e7ab;};'use strict';var _=require('lodash');var util=require(_0xb75b('0x0'));var logger=require(_0xb75b('0x1'))(_0xb75b('0x2'));var moment=require(_0xb75b('0x3'));var BPromise=require(_0xb75b('0x4'));var rp=require(_0xb75b('0x5'));var fs=require('fs');var path=require(_0xb75b('0x6'));var rimraf=require('rimraf');var config=require(_0xb75b('0x7'));var attributes=require(_0xb75b('0x8'));module[_0xb75b('0x9')]=function(_0x23c096,_0x274d98){return _0x23c096[_0xb75b('0xa')](_0xb75b('0xb'),attributes,{'tableName':_0xb75b('0xc'),'paranoid':![],'indexes':[{'name':_0xb75b('0xd'),'fields':[_0xb75b('0xd')]},{'name':_0xb75b('0xe'),'fields':[_0xb75b('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ee3e1,_0x597011,_0x64846a){var _0x29f961=_0x23c096[_0xb75b('0x10')];var _0x42605b=_0x1ee3e1[_0xb75b('0x11')]({'plain':!![]});if(_0x42605b[_0xb75b('0x12')][_0xb75b('0x13')]()==='in'||_0x42605b['direction'][_0xb75b('0x13')]()===_0xb75b('0x14')&&!_0x42605b[_0xb75b('0x15')]&&!_[_0xb75b('0x16')](_0x42605b[_0xb75b('0x17')])&&!_[_0xb75b('0x16')](_0x42605b[_0xb75b('0x18')])){_0x29f961[_0xb75b('0x19')][_0xb75b('0x1a')]({'where':{'id':_0x42605b['SmsInteractionId']}})[_0xb75b('0x1b')](function(_0x1d8397){if(_0x1d8397){_0x1d8397[_0xb75b('0x1c')]({'lastMsgAt':_0x42605b['createdAt'],'lastMsgDirection':_0x42605b[_0xb75b('0x12')]['toLowerCase']()});}})[_0xb75b('0x1d')](function(_0x2232be){console['error'](_0x2232be);});}if(_0x42605b['direction']==='out'&&!_0x42605b[_0xb75b('0x15')]){var _0x5c5595;_0x29f961[_0xb75b('0x1e')][_0xb75b('0x1f')]({'where':{'id':_0x42605b[_0xb75b('0x20')]},'raw':!![]})['then'](function(_0x16f2a8){_0x5c5595=_0x16f2a8;if(_0x5c5595&&_0x5c5595['type']){switch(_0x5c5595[_0xb75b('0x21')]){case'twilio':var _0x5de8ed=require(_0xb75b('0x22'));if(_0x5c5595[_0xb75b('0x23')]&&_0x5c5595['authToken']&&_0x5c5595[_0xb75b('0x24')]){var _0x381c80=new _0x5de8ed(_0x5c5595[_0xb75b('0x23')],_0x5c5595[_0xb75b('0x25')]);_0x381c80[_0xb75b('0x26')][_0xb75b('0x27')]({'body':_0x42605b[_0xb75b('0xf')],'to':_0x42605b['phone'],'from':_0x5c5595[_0xb75b('0x24')],'statusCallback':_0x5c5595[_0xb75b('0x28')]+_0xb75b('0x29')+_0x42605b['id']+_0xb75b('0x2a')+_0x5c5595[_0xb75b('0x2b')]})[_0xb75b('0x1b')](function(_0x16de6e){if(_0x16de6e[_0xb75b('0x2c')]){return _0x1ee3e1['update']({'messageId':_0x16de6e[_0xb75b('0x2c')]});}})[_0xb75b('0x1d')](function(_0x50e658){logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),'twilio',util['inspect'](_0x50e658,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x22'),_0xb75b('0x30'));}break;case _0xb75b('0x31'):var _0x1da305=_0xb75b('0x32');if(_0x5c5595[_0xb75b('0x33')]&&_0x5c5595[_0xb75b('0x34')]){var _0x464220={'recipient':[_0x42605b['phone']],'message':_0x42605b[_0xb75b('0xf')],'message_type':_0x5c5595[_0xb75b('0x35')]};if(_0x5c5595[_0xb75b('0x35')]&&_0x5c5595[_0xb75b('0x35')]!=='SI'){_0x464220[_0xb75b('0x36')]=_0x5c5595['phone'];}var _0x48d108={'url':_0x1da305+_0xb75b('0x37')+_0x5c5595[_0xb75b('0x33')]+'&password='+_0x5c5595['password'],'method':_0xb75b('0x38')};rp(_0x48d108)[_0xb75b('0x1b')](function(_0x37611c){var _0x329f70=_0x37611c[_0xb75b('0x39')](';');var _0x92dbe4={'user_key':_0x329f70[0x0],'session_key':_0x329f70[0x1]};_0x48d108={'url':_0x1da305+'sms','method':_0xb75b('0x3a'),'headers':{'user_key':_0x92dbe4[_0xb75b('0x3b')],'Session_key':_0x92dbe4[_0xb75b('0x3c')]},'json':!![],'body':_0x464220};return rp(_0x48d108);})['then'](function(_0x31e0b8){if(_0x31e0b8[_0xb75b('0x3d')]>=0x1){var _0x1243fc={'messageId':_0x31e0b8['internal_order_id']};if(_0x5c5595[_0xb75b('0x35')]!=='GP'||!_0x5c5595[_0xb75b('0x3e')]){_0x1243fc[_0xb75b('0x3f')]=!![];}return _0x1ee3e1['update'](_0x1243fc);}else{return logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb75b('0x31'),util[_0xb75b('0x40')](_0x31e0b8,{'showHidden':![],'depth':null}));}})[_0xb75b('0x1d')](function(_0x528839){return logger['error'](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x31'),util[_0xb75b('0x40')](_0x528839,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x31'),_0xb75b('0x41'));}break;case _0xb75b('0x42'):if(_0x5c5595[_0xb75b('0x25')]){var _0x1d4290={'recipient':_0x42605b[_0xb75b('0x24')],'message':_0x42605b[_0xb75b('0xf')],'sender':_0x5c5595[_0xb75b('0x43')]||_0x5c5595[_0xb75b('0x24')],'authorization':_0x5c5595['authToken']};var _0x597011={'method':'POST','uri':_0xb75b('0x44'),'body':_0x1d4290,'json':!![]};rp(_0x597011)[_0xb75b('0x1b')](function(_0x1f3396){var _0x1b1a33={'messageId':_0x1f3396[_0xb75b('0x45')]};if(!_0x5c5595[_0xb75b('0x3e')]){_0x1b1a33[_0xb75b('0x3f')]=!![];}return _0x1ee3e1[_0xb75b('0x1c')](_0x1b1a33);})['catch'](function(_0x52994e){logger['error'](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x42'),util[_0xb75b('0x40')](_0x52994e,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb75b('0x2f'),_0xb75b('0x42'),'Missing\x20parameters:\x20authToken');}break;case _0xb75b('0x46'):if(_0x5c5595['username']&&_0x5c5595[_0xb75b('0x34')]){var _0x1d4290={'messages':[{'source':_0xb75b('0x47'),'to':_0x42605b[_0xb75b('0x24')],'body':_0x42605b[_0xb75b('0xf')],'from':_0x5c5595[_0xb75b('0x43')]||_0x5c5595[_0xb75b('0x24')]}]};var _0x48f6ab=util[_0xb75b('0x48')](_0xb75b('0x49'),_0x5c5595['username'],_0x5c5595[_0xb75b('0x34')]);var _0x597011={'method':_0xb75b('0x3a'),'uri':_0xb75b('0x4a'),'body':_0x1d4290,'headers':{'Authorization':util[_0xb75b('0x48')](_0xb75b('0x4b'),new Buffer(_0x48f6ab)[_0xb75b('0x4c')](_0xb75b('0x4d')))},'json':!![]};rp(_0x597011)[_0xb75b('0x1b')](function(_0x7484ac){if(_0x7484ac[_0xb75b('0x4e')]>=0xc8&&_0x7484ac[_0xb75b('0x4e')]<=0xce){if(_0x7484ac[_0xb75b('0x4f')]&&_0x7484ac['data'][_0xb75b('0x50')]>0x0){var _0x511e2c=_['head'](_0x7484ac[_0xb75b('0x4f')][_0xb75b('0x26')]);var _0x3ffe6f={'messageId':_0x511e2c[_0xb75b('0x51')]};if(!_0x5c5595[_0xb75b('0x3e')]){_0x3ffe6f[_0xb75b('0x3f')]=!![];}return _0x1ee3e1['update'](_0x3ffe6f);}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),'clickSend',util[_0xb75b('0x40')](_0x7484ac,{'showHidden':![],'depth':null}));}}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x52'),util['inspect'](_0x7484ac,{'showHidden':![],'depth':null}));}})[_0xb75b('0x1d')](function(_0x3e704){logger[_0xb75b('0x2d')](_0xb75b('0x2e'),'afterCreate','clickSend',util['inspect'](_0x3e704,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x5c5595[_0xb75b('0x53')]&&_0x5c5595[_0xb75b('0x25')]){var _0x1d4290={'dst':_0x42605b['phone'],'text':_0x42605b[_0xb75b('0xf')],'src':_0x5c5595[_0xb75b('0x43')]||_0x5c5595['phone'],'url':_0x5c5595[_0xb75b('0x28')]+_0xb75b('0x29')+_0x42605b['id']+'/status?token='+_0x5c5595[_0xb75b('0x2b')]};var _0x48f6ab=util['format']('%s:%s',_0x5c5595[_0xb75b('0x53')],_0x5c5595[_0xb75b('0x25')]);var _0x597011={'method':_0xb75b('0x3a'),'uri':util[_0xb75b('0x48')](_0xb75b('0x54'),_0x5c5595[_0xb75b('0x53')]),'body':_0x1d4290,'headers':{'Authorization':util[_0xb75b('0x48')]('Basic\x20%s',new Buffer(_0x48f6ab)['toString'](_0xb75b('0x4d')))},'json':!![]};rp(_0x597011)[_0xb75b('0x1b')](function(_0x3b5649){var _0x4e3405={'messageId':_0x3b5649['message_uuid'][0x0]};return _0x1ee3e1[_0xb75b('0x1c')](_0x4e3405);})[_0xb75b('0x1d')](function(_0x24b7b2){logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x55'),util[_0xb75b('0x40')](_0x24b7b2,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x55'),_0xb75b('0x56'));}break;case _0xb75b('0x57'):if(_0x5c5595[_0xb75b('0x33')]&&_0x5c5595[_0xb75b('0x34')]){if(_0x5c5595[_0xb75b('0x58')]){var _0x59d403={'method':_0xb75b('0x3a'),'uri':_0x5c5595[_0xb75b('0x58')]+_0xb75b('0x59'),'body':{'username':_0x5c5595[_0xb75b('0x33')],'password':_0x5c5595[_0xb75b('0x34')]},'json':!![]};return rp(_0x59d403)[_0xb75b('0x1b')](function(_0x4f4080){var _0x4fcd3d={'method':'POST','uri':_0x5c5595['baseUrl']+_0xb75b('0x5a'),'body':{'messages':[{'from':_0x5c5595[_0xb75b('0x24')],'destinations':[{'to':_0x42605b[_0xb75b('0x24')]}],'text':_0x42605b[_0xb75b('0xf')],'notifyUrl':_0x5c5595[_0xb75b('0x28')]+_0xb75b('0x29')+_0x42605b['id']+_0xb75b('0x2a')+_0x5c5595['token'],'notifyContentType':'application/json','callbackData':_0x5c5595['phone']+';'+_0x42605b[_0xb75b('0xf')]}]},'headers':{'Authorization':_0xb75b('0x5b')+_0x4f4080['token']},'json':!![]};return rp(_0x4fcd3d)[_0xb75b('0x1b')](function(_0x3bf2da){if(_0x3bf2da['messages']){var _0x1d8c69={'messageId':_0x3bf2da['messages'][0x0][_0xb75b('0xd')]};if(!_0x5c5595[_0xb75b('0x3e')]){_0x1d8c69[_0xb75b('0x3f')]=!![];}return _0x1ee3e1[_0xb75b('0x1c')](_0x1d8c69);}else{return logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb75b('0x2f'),_0xb75b('0x57'),util[_0xb75b('0x40')](_0x3bf2da,{'showHidden':![],'depth':null}));}});})[_0xb75b('0x1d')](function(_0x533ccd){return logger[_0xb75b('0x2d')](_0xb75b('0x2e'),'afterCreate',_0xb75b('0x57'),util['inspect'](_0x533ccd,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x57'),_0xb75b('0x5c'));}}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x57'),_0xb75b('0x41'));}break;case'csc':var _0x54c2ea=require(_0xb75b('0x5d'));if(_0x5c5595[_0xb75b('0x5e')]){var _0x5c7154={};_0x5c7154['login']=_0x5c5595[_0xb75b('0x33')];_0x5c7154[_0xb75b('0x24')]=_0x42605b[_0xb75b('0x24')];_0x5c7154[_0xb75b('0x36')]=_0x5c5595[_0xb75b('0x24')];_0x5c7154['text']=_0x42605b[_0xb75b('0xf')];_0x5c7154[_0xb75b('0x5f')]=+new Date();var _0x21ca17='';var _0x20d736='';var _0x2c8c65=Object[_0xb75b('0x60')](_0x5c7154);_0x2c8c65[_0xb75b('0x61')]();for(var _0x3f0625=0x0;_0x3f0625<_0x2c8c65[_0xb75b('0x62')];_0x3f0625++){if(_0x21ca17!=''){_0x21ca17+='&';}_0x21ca17+=_0x2c8c65[_0x3f0625]+'='+encodeURIComponent(_0x5c7154[_0x2c8c65[_0x3f0625]]);_0x20d736+=_0x5c7154[_0x2c8c65[_0x3f0625]];}_0x20d736+=_0x5c5595['apiKey'];_0x20d736=_0x54c2ea['createHash'](_0xb75b('0x63'))[_0xb75b('0x1c')](_0x20d736)[_0xb75b('0x64')]('hex');if(_0x21ca17!==''){_0x21ca17+='&';}_0x21ca17+=_0xb75b('0x65')+_0x20d736;var _0x48d108={'method':_0xb75b('0x38'),'uri':_0x5c5595['baseUrl']+'/external/get/send.php?'+_0x21ca17,'json':!![]};return rp(_0x48d108)[_0xb75b('0x1b')](function(_0x2c998f){var _0xeb57ab=Object[_0xb75b('0x60')](_0x2c998f);if(_0x2c998f[_0xeb57ab[0x0]][_0xb75b('0x2d')]&&parseInt(_0x2c998f[_0xeb57ab[0x0]][_0xb75b('0x2d')])===0x0){var _0x197290={'messageId':_0x2c998f[_0xeb57ab[0x0]]['id_sms']};if(!_0x5c5595['deliveryReport']){_0x197290[_0xb75b('0x3f')]=!![];}return _0x1ee3e1['update'](_0x197290);}else{return logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb75b('0x2f'),'csc',util[_0xb75b('0x40')](_0x2c998f[_0xb75b('0x2d')],{'showHidden':![],'depth':null}));}})[_0xb75b('0x1d')](function(_0x1d2334){return logger['error'](_0xb75b('0x2e'),_0xb75b('0x2f'),_0xb75b('0x66'),util[_0xb75b('0x40')](_0x1d2334,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),'csc',_0xb75b('0x67'));}break;case _0xb75b('0x68'):if(_0x5c5595['apiKey']){var _0x90d2c2={'method':'POST','uri':_0xb75b('0x69'),'headers':{'Authorization':_0x5c5595[_0xb75b('0x5e')]},'body':{'content':_0x42605b[_0xb75b('0xf')],'to':[_0x42605b[_0xb75b('0x24')]],'from':_0x5c5595[_0xb75b('0x24')],'binary':![],'clientMessageId':_0xb75b('0x6a'),'charset':_0xb75b('0x6b')},'json':!![]};rp(_0x90d2c2)['then'](function(_0x38289d){if(!_0x38289d[_0xb75b('0x2d')]){var _0x53f1cd={'messageId':_0x38289d[_0xb75b('0x26')][0x0]['apiMessageId']};if(!_0x5c5595[_0xb75b('0x3e')]){_0x53f1cd[_0xb75b('0x3f')]=!![];}return _0x1ee3e1['update'](_0x53f1cd);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb75b('0x68'),util[_0xb75b('0x40')](_0x38289d['error'],{'showHidden':![],'depth':null}));}})[_0xb75b('0x1d')](function(_0x3096f6){return logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb75b('0x2f'),_0xb75b('0x68'),util[_0xb75b('0x40')](_0x3096f6,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case _0xb75b('0x6c'):if(_0x5c5595['username']&&_0x5c5595[_0xb75b('0x34')]){var _0x48f6ab=util[_0xb75b('0x48')](_0xb75b('0x49'),_0x5c5595[_0xb75b('0x33')],_0x5c5595[_0xb75b('0x34')]);var _0x597011={'method':_0xb75b('0x3a'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5c5595[_0xb75b('0x6d')]+_0xb75b('0x6e'),'body':{'to':[_0x42605b[_0xb75b('0x24')]],'text':_0x42605b[_0xb75b('0xf')],'from':_0x5c5595[_0xb75b('0x24')],'applicationId':_0x5c5595['applicationId']},'headers':{'Authorization':util[_0xb75b('0x48')](_0xb75b('0x4b'),new Buffer(_0x48f6ab)[_0xb75b('0x4c')](_0xb75b('0x4d')))},'json':!![]};rp(_0x597011)[_0xb75b('0x1b')](function(_0x198037){if(_0x198037['id']){var _0x67a731={'messageId':_0x198037['id']};return _0x1ee3e1[_0xb75b('0x1c')](_0x67a731);}else{logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xb75b('0x6c'),util[_0xb75b('0x40')](_0x198037,{'showHidden':![],'depth':null}));}})[_0xb75b('0x1d')](function(_0x1351f1){logger[_0xb75b('0x2d')](_0xb75b('0x2e'),'afterCreate',_0xb75b('0x6c'),util[_0xb75b('0x40')](_0x1351f1,{'showHidden':![],'depth':null}));});}else{logger[_0xb75b('0x2d')](_0xb75b('0x2e'),'afterCreate','bandwidth',_0xb75b('0x41'));}break;case _0xb75b('0x6f'):if(_0x5c5595['apiKey']){var _0x30ddb2={};var _0x48d108={'method':_0xb75b('0x3a'),'uri':_0xb75b('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x5c5595['apiKey'],'Content-Type':_0xb75b('0x71')},'body':{'from':_0x5c5595['phone'],'to':_0x42605b['phone'],'text':_0x42605b[_0xb75b('0xf')]},'json':!![]};return rp(_0x48d108)[_0xb75b('0x1b')](function(_0xfeb969){if(_0xfeb969[_0xb75b('0x72')]==0xca){_0x30ddb2['message']=_0xfeb969;var _0x59334d={'method':_0xb75b('0x3a'),'uri':_0xb75b('0x73'),'headers':{'Authorization':_0xb75b('0x74')+_0x5c5595[_0xb75b('0x5e')],'Content-Type':_0xb75b('0x71')},'body':{'refid':_0x30ddb2[_0xb75b('0x75')][_0xb75b('0x76')]},'json':!![]};return rp(_0x59334d)[_0xb75b('0x1b')](function(_0x5aa5e8){_0x30ddb2[_0xb75b('0x77')]=_0x5aa5e8;var _0x38c367={'messageId':_0x30ddb2[_0xb75b('0x75')][_0xb75b('0x76')],'read':!![]};return _0x1ee3e1['update'](_0x38c367);});}else{return logger[_0xb75b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0xb75b('0x40')](_0xfeb969,{'showHidden':![],'depth':null}));}})['catch'](function(_0x46f0e2){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb75b('0x2f'),_0xb75b('0x6f'),util[_0xb75b('0x40')](_0x46f0e2,{'showHidden':![],'depth':null}));});}else{return logger[_0xb75b('0x2d')](_0xb75b('0x2e'),_0xb75b('0x2f'),'intelepeer',_0xb75b('0x78'));}break;}}})[_0xb75b('0x79')](function(){_0x64846a();});}else{_0x64846a();}}},'charset':_0xb75b('0x7a'),'collate':_0xb75b('0x7b')});}; \ No newline at end of file +var _0x422d=['application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','digest','hex','signature=','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','update','createdAt','catch','error','type','twilio','accountSid','authToken','messages','create','phone','remote','/api/sms/messages/','/status?token=','token','then','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','clicksend','username','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0x422d,0x11a));var _0xd422=function(_0xa1a8ff,_0x405d8b){_0xa1a8ff=_0xa1a8ff-0x0;var _0x439f93=_0x422d[_0xa1a8ff];return _0x439f93;};'use strict';var _=require(_0xd422('0x0'));var util=require('util');var logger=require(_0xd422('0x1'))('api');var moment=require(_0xd422('0x2'));var BPromise=require('bluebird');var rp=require(_0xd422('0x3'));var fs=require('fs');var path=require(_0xd422('0x4'));var rimraf=require(_0xd422('0x5'));var config=require(_0xd422('0x6'));var attributes=require('./smsMessage.attributes');module[_0xd422('0x7')]=function(_0x3eee12,_0x320fe2){return _0x3eee12[_0xd422('0x8')](_0xd422('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xd422('0xa'),'fields':[_0xd422('0xa')]},{'name':'fti_sms_messages','fields':[_0xd422('0xb')],'type':_0xd422('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3923,_0x11907d,_0xc3cb01){var _0x43c988=_0x3eee12[_0xd422('0xd')];var _0x4d818a=_0x5a3923[_0xd422('0xe')]({'plain':!![]});if(_0x4d818a[_0xd422('0xf')][_0xd422('0x10')]()==='in'||_0x4d818a[_0xd422('0xf')]['toLowerCase']()===_0xd422('0x11')&&!_0x4d818a[_0xd422('0x12')]&&!_[_0xd422('0x13')](_0x4d818a[_0xd422('0x14')])&&!_[_0xd422('0x13')](_0x4d818a['SmsInteractionId'])){_0x43c988[_0xd422('0x15')][_0xd422('0x16')]({'where':{'id':_0x4d818a[_0xd422('0x17')]}})['then'](function(_0x5d91e1){if(_0x5d91e1){_0x5d91e1[_0xd422('0x18')]({'lastMsgAt':_0x4d818a[_0xd422('0x19')],'lastMsgDirection':_0x4d818a[_0xd422('0xf')][_0xd422('0x10')]()});}})[_0xd422('0x1a')](function(_0x1f364f){console[_0xd422('0x1b')](_0x1f364f);});}if(_0x4d818a['direction']==='out'&&!_0x4d818a['secret']){var _0x471431;_0x43c988['SmsAccount']['find']({'where':{'id':_0x4d818a['SmsAccountId']},'raw':!![]})['then'](function(_0x47317b){_0x471431=_0x47317b;if(_0x471431&&_0x471431[_0xd422('0x1c')]){switch(_0x471431[_0xd422('0x1c')]){case _0xd422('0x1d'):var _0x5206b2=require(_0xd422('0x1d'));if(_0x471431[_0xd422('0x1e')]&&_0x471431[_0xd422('0x1f')]&&_0x471431['phone']){var _0x1d929c=new _0x5206b2(_0x471431['accountSid'],_0x471431[_0xd422('0x1f')]);_0x1d929c[_0xd422('0x20')][_0xd422('0x21')]({'body':_0x4d818a[_0xd422('0xb')],'to':_0x4d818a[_0xd422('0x22')],'from':_0x471431[_0xd422('0x22')],'statusCallback':_0x471431[_0xd422('0x23')]+_0xd422('0x24')+_0x4d818a['id']+_0xd422('0x25')+_0x471431[_0xd422('0x26')]})[_0xd422('0x27')](function(_0x124e56){if(_0x124e56[_0xd422('0x28')]){return _0x5a3923['update']({'messageId':_0x124e56[_0xd422('0x28')]});}})[_0xd422('0x1a')](function(_0x27de9f){logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),_0xd422('0x1d'),util[_0xd422('0x2a')](_0x27de9f,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')](_0xd422('0x2b'),'afterCreate',_0xd422('0x1d'),_0xd422('0x2c'));}break;case _0xd422('0x2d'):var _0x4f373d='https://api.skebby.it/API/v1.0/REST/';if(_0x471431['username']&&_0x471431[_0xd422('0x2e')]){var _0x14224f={'recipient':[_0x4d818a[_0xd422('0x22')]],'message':_0x4d818a[_0xd422('0xb')],'message_type':_0x471431[_0xd422('0x2f')]};if(_0x471431[_0xd422('0x2f')]&&_0x471431[_0xd422('0x2f')]!=='SI'){_0x14224f[_0xd422('0x30')]=_0x471431[_0xd422('0x22')];}var _0x30b744={'url':_0x4f373d+_0xd422('0x31')+_0x471431['username']+_0xd422('0x32')+_0x471431[_0xd422('0x2e')],'method':_0xd422('0x33')};rp(_0x30b744)[_0xd422('0x27')](function(_0xe8efe0){var _0x4626e2=_0xe8efe0[_0xd422('0x34')](';');var _0x4d429c={'user_key':_0x4626e2[0x0],'session_key':_0x4626e2[0x1]};_0x30b744={'url':_0x4f373d+_0xd422('0x35'),'method':_0xd422('0x36'),'headers':{'user_key':_0x4d429c[_0xd422('0x37')],'Session_key':_0x4d429c[_0xd422('0x38')]},'json':!![],'body':_0x14224f};return rp(_0x30b744);})[_0xd422('0x27')](function(_0x26d0ea){if(_0x26d0ea[_0xd422('0x39')]>=0x1){var _0x163300={'messageId':_0x26d0ea[_0xd422('0x3a')]};if(_0x471431[_0xd422('0x2f')]!=='GP'||!_0x471431['deliveryReport']){_0x163300[_0xd422('0x3b')]=!![];}return _0x5a3923['update'](_0x163300);}else{return logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x2d'),util['inspect'](_0x26d0ea,{'showHidden':![],'depth':null}));}})[_0xd422('0x1a')](function(_0x3b3f66){return logger['error'](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x2d'),util[_0xd422('0x2a')](_0x3b3f66,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xd422('0x3c'):if(_0x471431[_0xd422('0x1f')]){var _0x24fe65={'recipient':_0x4d818a[_0xd422('0x22')],'message':_0x4d818a['body'],'sender':_0x471431['senderString']||_0x471431['phone'],'authorization':_0x471431[_0xd422('0x1f')]};var _0x11907d={'method':_0xd422('0x36'),'uri':_0xd422('0x3d'),'body':_0x24fe65,'json':!![]};rp(_0x11907d)['then'](function(_0x4614b0){var _0xfc0fd2={'messageId':_0x4614b0[_0xd422('0x3e')]};if(!_0x471431[_0xd422('0x3f')]){_0xfc0fd2[_0xd422('0x3b')]=!![];}return _0x5a3923[_0xd422('0x18')](_0xfc0fd2);})[_0xd422('0x1a')](function(_0x57f873){logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x3c'),util['inspect'](_0x57f873,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0xd422('0x40'):if(_0x471431[_0xd422('0x41')]&&_0x471431[_0xd422('0x2e')]){var _0x24fe65={'messages':[{'source':'xCALLY\x20Motion','to':_0x4d818a[_0xd422('0x22')],'body':_0x4d818a[_0xd422('0xb')],'from':_0x471431[_0xd422('0x42')]||_0x471431['phone']}]};var _0x5a9fa1=util[_0xd422('0x43')](_0xd422('0x44'),_0x471431['username'],_0x471431['password']);var _0x11907d={'method':_0xd422('0x36'),'uri':_0xd422('0x45'),'body':_0x24fe65,'headers':{'Authorization':util[_0xd422('0x43')](_0xd422('0x46'),new Buffer(_0x5a9fa1)['toString'](_0xd422('0x47')))},'json':!![]};rp(_0x11907d)['then'](function(_0x38624b){if(_0x38624b[_0xd422('0x48')]>=0xc8&&_0x38624b['http_code']<=0xce){if(_0x38624b[_0xd422('0x49')]&&_0x38624b[_0xd422('0x49')][_0xd422('0x4a')]>0x0){var _0x420794=_[_0xd422('0x4b')](_0x38624b[_0xd422('0x49')][_0xd422('0x20')]);var _0x3826fb={'messageId':_0x420794[_0xd422('0x4c')]};if(!_0x471431['deliveryReport']){_0x3826fb[_0xd422('0x3b')]=!![];}return _0x5a3923[_0xd422('0x18')](_0x3826fb);}else{logger['error'](_0xd422('0x2b'),'afterCreate','clickSend',util['inspect'](_0x38624b,{'showHidden':![],'depth':null}));}}else{logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd422('0x4d'),util['inspect'](_0x38624b,{'showHidden':![],'depth':null}));}})[_0xd422('0x1a')](function(_0x5041bb){logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x4d'),util[_0xd422('0x2a')](_0x5041bb,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x4d'),_0xd422('0x4e'));}break;case _0xd422('0x4f'):if(_0x471431[_0xd422('0x50')]&&_0x471431[_0xd422('0x1f')]){var _0x24fe65={'dst':_0x4d818a[_0xd422('0x22')],'text':_0x4d818a[_0xd422('0xb')],'src':_0x471431[_0xd422('0x42')]||_0x471431[_0xd422('0x22')],'url':_0x471431[_0xd422('0x23')]+_0xd422('0x24')+_0x4d818a['id']+_0xd422('0x25')+_0x471431['token']};var _0x5a9fa1=util['format'](_0xd422('0x44'),_0x471431['authId'],_0x471431[_0xd422('0x1f')]);var _0x11907d={'method':'POST','uri':util[_0xd422('0x43')](_0xd422('0x51'),_0x471431[_0xd422('0x50')]),'body':_0x24fe65,'headers':{'Authorization':util[_0xd422('0x43')]('Basic\x20%s',new Buffer(_0x5a9fa1)[_0xd422('0x52')](_0xd422('0x47')))},'json':!![]};rp(_0x11907d)['then'](function(_0x3a9cca){var _0xacda3c={'messageId':_0x3a9cca[_0xd422('0x53')][0x0]};return _0x5a3923[_0xd422('0x18')](_0xacda3c);})[_0xd422('0x1a')](function(_0x470716){logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),_0xd422('0x4f'),util[_0xd422('0x2a')](_0x470716,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x471431[_0xd422('0x41')]&&_0x471431[_0xd422('0x2e')]){if(_0x471431[_0xd422('0x54')]){var _0x45cda8={'method':_0xd422('0x36'),'uri':_0x471431['baseUrl']+_0xd422('0x55'),'body':{'username':_0x471431[_0xd422('0x41')],'password':_0x471431['password']},'json':!![]};return rp(_0x45cda8)['then'](function(_0x2ac1ed){var _0x5eb394={'method':'POST','uri':_0x471431['baseUrl']+_0xd422('0x56'),'body':{'messages':[{'from':_0x471431['phone'],'destinations':[{'to':_0x4d818a['phone']}],'text':_0x4d818a[_0xd422('0xb')],'notifyUrl':_0x471431['remote']+_0xd422('0x24')+_0x4d818a['id']+_0xd422('0x25')+_0x471431[_0xd422('0x26')],'notifyContentType':_0xd422('0x57'),'callbackData':_0x471431[_0xd422('0x22')]+';'+_0x4d818a[_0xd422('0xb')]}]},'headers':{'Authorization':_0xd422('0x58')+_0x2ac1ed[_0xd422('0x26')]},'json':!![]};return rp(_0x5eb394)[_0xd422('0x27')](function(_0x19ceff){if(_0x19ceff[_0xd422('0x20')]){var _0x58f35e={'messageId':_0x19ceff[_0xd422('0x20')][0x0]['messageId']};if(!_0x471431[_0xd422('0x3f')]){_0x58f35e[_0xd422('0x3b')]=!![];}return _0x5a3923[_0xd422('0x18')](_0x58f35e);}else{return logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),'infobip',util['inspect'](_0x19ceff,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x590082){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0xd422('0x2a')](_0x590082,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x59'),_0xd422('0x5a'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),_0xd422('0x59'),_0xd422('0x4e'));}break;case'csc':var _0x34d073=require(_0xd422('0x5b'));if(_0x471431[_0xd422('0x5c')]){var _0x3dfab0={};_0x3dfab0[_0xd422('0x5d')]=_0x471431[_0xd422('0x41')];_0x3dfab0['phone']=_0x4d818a['phone'];_0x3dfab0['sender']=_0x471431['phone'];_0x3dfab0[_0xd422('0x5e')]=_0x4d818a[_0xd422('0xb')];_0x3dfab0[_0xd422('0x5f')]=+new Date();var _0x32249a='';var _0x67bd9e='';var _0xa52299=Object[_0xd422('0x60')](_0x3dfab0);_0xa52299[_0xd422('0x61')]();for(var _0x5cfa34=0x0;_0x5cfa34<_0xa52299['length'];_0x5cfa34++){if(_0x32249a!=''){_0x32249a+='&';}_0x32249a+=_0xa52299[_0x5cfa34]+'='+encodeURIComponent(_0x3dfab0[_0xa52299[_0x5cfa34]]);_0x67bd9e+=_0x3dfab0[_0xa52299[_0x5cfa34]];}_0x67bd9e+=_0x471431[_0xd422('0x5c')];_0x67bd9e=_0x34d073[_0xd422('0x62')](_0xd422('0x63'))[_0xd422('0x18')](_0x67bd9e)[_0xd422('0x64')](_0xd422('0x65'));if(_0x32249a!==''){_0x32249a+='&';}_0x32249a+=_0xd422('0x66')+_0x67bd9e;var _0x30b744={'method':_0xd422('0x33'),'uri':_0x471431[_0xd422('0x54')]+'/external/get/send.php?'+_0x32249a,'json':!![]};return rp(_0x30b744)[_0xd422('0x27')](function(_0x396730){var _0x5b4046=Object[_0xd422('0x60')](_0x396730);if(_0x396730[_0x5b4046[0x0]]['error']&&parseInt(_0x396730[_0x5b4046[0x0]][_0xd422('0x1b')])===0x0){var _0x541fdc={'messageId':_0x396730[_0x5b4046[0x0]][_0xd422('0x67')]};if(!_0x471431[_0xd422('0x3f')]){_0x541fdc[_0xd422('0x3b')]=!![];}return _0x5a3923['update'](_0x541fdc);}else{return logger[_0xd422('0x1b')](_0xd422('0x2b'),'afterCreate',_0xd422('0x68'),util[_0xd422('0x2a')](_0x396730['error'],{'showHidden':![],'depth':null}));}})[_0xd422('0x1a')](function(_0x51f376){return logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x68'),util[_0xd422('0x2a')](_0x51f376,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')](_0xd422('0x2b'),'afterCreate',_0xd422('0x68'),_0xd422('0x69'));}break;case _0xd422('0x6a'):if(_0x471431[_0xd422('0x5c')]){var _0xe723f9={'method':_0xd422('0x36'),'uri':_0xd422('0x6b'),'headers':{'Authorization':_0x471431[_0xd422('0x5c')]},'body':{'content':_0x4d818a[_0xd422('0xb')],'to':[_0x4d818a[_0xd422('0x22')]],'from':_0x471431[_0xd422('0x22')],'binary':![],'clientMessageId':'uuid','charset':_0xd422('0x6c')},'json':!![]};rp(_0xe723f9)[_0xd422('0x27')](function(_0x107a12){if(!_0x107a12[_0xd422('0x1b')]){var _0x17568c={'messageId':_0x107a12[_0xd422('0x20')][0x0]['apiMessageId']};if(!_0x471431[_0xd422('0x3f')]){_0x17568c[_0xd422('0x3b')]=!![];}return _0x5a3923[_0xd422('0x18')](_0x17568c);}else{return logger[_0xd422('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),_0xd422('0x6a'),util[_0xd422('0x2a')](_0x107a12[_0xd422('0x1b')],{'showHidden':![],'depth':null}));}})[_0xd422('0x1a')](function(_0x33d792){return logger[_0xd422('0x1b')](_0xd422('0x2b'),'afterCreate',_0xd422('0x6a'),util[_0xd422('0x2a')](_0x33d792,{'showHidden':![],'depth':null}));});}else{logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x6a'),_0xd422('0x69'));}break;case _0xd422('0x6d'):if(_0x471431[_0xd422('0x41')]&&_0x471431[_0xd422('0x2e')]){var _0x5a9fa1=util[_0xd422('0x43')](_0xd422('0x44'),_0x471431[_0xd422('0x41')],_0x471431[_0xd422('0x2e')]);var _0x11907d={'method':_0xd422('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x471431[_0xd422('0x6e')]+_0xd422('0x6f'),'body':{'to':[_0x4d818a[_0xd422('0x22')]],'text':_0x4d818a[_0xd422('0xb')],'from':_0x471431[_0xd422('0x22')],'applicationId':_0x471431[_0xd422('0x70')]},'headers':{'Authorization':util['format'](_0xd422('0x46'),new Buffer(_0x5a9fa1)['toString'](_0xd422('0x47')))},'json':!![]};rp(_0x11907d)['then'](function(_0x58fbb6){if(_0x58fbb6['id']){var _0x472e0f={'messageId':_0x58fbb6['id']};return _0x5a3923[_0xd422('0x18')](_0x472e0f);}else{logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x6d'),util[_0xd422('0x2a')](_0x58fbb6,{'showHidden':![],'depth':null}));}})[_0xd422('0x1a')](function(_0x490407){logger['error'](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x6d'),util['inspect'](_0x490407,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd422('0x71'):if(_0x471431[_0xd422('0x5c')]){var _0x42989c={};var _0x30b744={'method':_0xd422('0x36'),'uri':_0xd422('0x72'),'headers':{'Authorization':_0xd422('0x73')+_0x471431[_0xd422('0x5c')],'Content-Type':_0xd422('0x57')},'body':{'from':_0x471431[_0xd422('0x22')],'to':_0x4d818a[_0xd422('0x22')],'text':_0x4d818a[_0xd422('0xb')]},'json':!![]};return rp(_0x30b744)[_0xd422('0x27')](function(_0x315b80){if(_0x315b80[_0xd422('0x74')]==0xca){_0x42989c[_0xd422('0x75')]=_0x315b80;var _0x1428cc={'method':_0xd422('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xd422('0x73')+_0x471431[_0xd422('0x5c')],'Content-Type':_0xd422('0x57')},'body':{'refid':_0x42989c[_0xd422('0x75')][_0xd422('0x76')]},'json':!![]};return rp(_0x1428cc)['then'](function(_0xb504f5){_0x42989c[_0xd422('0x77')]=_0xb504f5;var _0x26a8b9={'messageId':_0x42989c[_0xd422('0x75')][_0xd422('0x76')],'read':!![]};return _0x5a3923[_0xd422('0x18')](_0x26a8b9);});}else{return logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),_0xd422('0x71'),util[_0xd422('0x2a')](_0x315b80,{'showHidden':![],'depth':null}));}})[_0xd422('0x1a')](function(_0x4acfbf){return logger[_0xd422('0x1b')](_0xd422('0x2b'),_0xd422('0x29'),'intelepeer',util[_0xd422('0x2a')](_0x4acfbf,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd422('0x29'),_0xd422('0x71'),'Token\x20not\x20received');}break;}}})[_0xd422('0x78')](function(){_0xc3cb01();});}else{_0xc3cb01();}}},'charset':_0xd422('0x79'),'collate':_0xd422('0x7a')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 5f6f2c7..d83695a 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 _0x0a82=['socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x511e82,_0x5c8e7b){var _0x32bc8e=function(_0xc02fd5){while(--_0xc02fd5){_0x511e82['push'](_0x511e82['shift']());}};_0x32bc8e(++_0x5c8e7b);}(_0x0a82,0x1a5));var _0x20a8=function(_0x356ede,_0x5ee66c){_0x356ede=_0x356ede-0x0;var _0x106ac5=_0x0a82[_0x356ede];return _0x106ac5;};'use strict';var _=require(_0x20a8('0x0'));var util=require(_0x20a8('0x1'));var moment=require(_0x20a8('0x2'));var BPromise=require(_0x20a8('0x3'));var rs=require(_0x20a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x20a8('0x5'));var logger=require(_0x20a8('0x6'))('rpc');var config=require(_0x20a8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x20a8('0x8')][_0x20a8('0x9')]({'port':0x232a});config[_0x20a8('0xa')]=_[_0x20a8('0xb')](config[_0x20a8('0xa')],{'host':_0x20a8('0xc'),'port':0x18eb});var socket=require(_0x20a8('0xd'))(new Redis(config[_0x20a8('0xa')]));require(_0x20a8('0xe'))['register'](socket);function respondWithRpcPromise(_0x2445e0,_0x4b12d8,_0x4760df){return new BPromise(function(_0x3c0b89,_0x2ee608){return client[_0x20a8('0xf')](_0x2445e0,_0x4760df)[_0x20a8('0x10')](function(_0x1290b1){logger['info'](_0x20a8('0x11'),_0x4b12d8,_0x20a8('0x12'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x4b12d8,'request\x20sent',JSON['stringify'](_0x1290b1));if(_0x1290b1[_0x20a8('0x13')]){if(_0x1290b1[_0x20a8('0x13')][_0x20a8('0x14')]===0x1f4){logger[_0x20a8('0x13')](_0x20a8('0x11'),_0x4b12d8,_0x1290b1[_0x20a8('0x13')][_0x20a8('0x15')]);return _0x2ee608(_0x1290b1[_0x20a8('0x13')][_0x20a8('0x15')]);}logger['error'](_0x20a8('0x11'),_0x4b12d8,_0x1290b1[_0x20a8('0x13')][_0x20a8('0x15')]);return _0x3c0b89(_0x1290b1['error']['message']);}else{logger[_0x20a8('0x16')](_0x20a8('0x11'),_0x4b12d8,'request\x20sent');_0x3c0b89(_0x1290b1[_0x20a8('0x17')][_0x20a8('0x15')]);}})[_0x20a8('0x18')](function(_0x34a124){logger['error'](_0x20a8('0x11'),_0x4b12d8,_0x34a124);_0x2ee608(_0x34a124);});});}exports[_0x20a8('0x19')]=function(_0x435081){var _0x118b3a=this;return new Promise(function(_0x53f623,_0x12f9b2){return db[_0x20a8('0x1a')][_0x20a8('0x1b')](_0x435081[_0x20a8('0x1c')],{'raw':_0x435081['options']?_0x435081[_0x20a8('0x1d')][_0x20a8('0x1e')]===undefined?!![]:![]:!![]})[_0x20a8('0x10')](function(_0x3ead91){logger['info'](_0x20a8('0x19'),_0x435081);logger['debug']('CreateSmsMessage',_0x435081,JSON['stringify'](_0x3ead91));_0x53f623(_0x3ead91);})['catch'](function(_0x322f76){logger[_0x20a8('0x13')]('CreateSmsMessage',_0x322f76[_0x20a8('0x15')],_0x435081);_0x12f9b2(_0x118b3a['error'](0x1f4,_0x322f76['message']));});});}; \ No newline at end of file +var _0x44ac=['options','raw','then','CreateSmsMessage','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SmsMessage','create','body'];(function(_0x471e0b,_0x26cd81){var _0x1fa8be=function(_0x1b2e3a){while(--_0x1b2e3a){_0x471e0b['push'](_0x471e0b['shift']());}};_0x1fa8be(++_0x26cd81);}(_0x44ac,0x1e4));var _0xc44a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x44ac[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xc44a('0x0'));var util=require('util');var moment=require(_0xc44a('0x1'));var BPromise=require(_0xc44a('0x2'));var rs=require(_0xc44a('0x3'));var fs=require('fs');var Redis=require(_0xc44a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc44a('0x5'))('rpc');var config=require(_0xc44a('0x6'));var jayson=require(_0xc44a('0x7'));var client=jayson[_0xc44a('0x8')][_0xc44a('0x9')]({'port':0x232a});config[_0xc44a('0xa')]=_[_0xc44a('0xb')](config[_0xc44a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc44a('0xc'))(new Redis(config['redis']));require(_0xc44a('0xd'))[_0xc44a('0xe')](socket);function respondWithRpcPromise(_0x411c4c,_0x28eb70,_0x1b33ee){return new BPromise(function(_0x6d0a8c,_0x37ef4d){return client[_0xc44a('0xf')](_0x411c4c,_0x1b33ee)['then'](function(_0x486333){logger[_0xc44a('0x10')](_0xc44a('0x11'),_0x28eb70,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x28eb70,_0xc44a('0x12'),JSON[_0xc44a('0x13')](_0x486333));if(_0x486333[_0xc44a('0x14')]){if(_0x486333[_0xc44a('0x14')][_0xc44a('0x15')]===0x1f4){logger[_0xc44a('0x14')]('SmsMessage,\x20%s,\x20%s',_0x28eb70,_0x486333['error'][_0xc44a('0x16')]);return _0x37ef4d(_0x486333[_0xc44a('0x14')][_0xc44a('0x16')]);}logger[_0xc44a('0x14')]('SmsMessage,\x20%s,\x20%s',_0x28eb70,_0x486333[_0xc44a('0x14')][_0xc44a('0x16')]);return _0x6d0a8c(_0x486333[_0xc44a('0x14')][_0xc44a('0x16')]);}else{logger[_0xc44a('0x10')](_0xc44a('0x11'),_0x28eb70,_0xc44a('0x12'));_0x6d0a8c(_0x486333[_0xc44a('0x17')][_0xc44a('0x16')]);}})[_0xc44a('0x18')](function(_0x27f22d){logger['error'](_0xc44a('0x11'),_0x28eb70,_0x27f22d);_0x37ef4d(_0x27f22d);});});}exports['CreateSmsMessage']=function(_0x14b3c3){var _0x53c73b=this;return new Promise(function(_0x2e69e3,_0x55158b){return db[_0xc44a('0x19')][_0xc44a('0x1a')](_0x14b3c3[_0xc44a('0x1b')],{'raw':_0x14b3c3[_0xc44a('0x1c')]?_0x14b3c3[_0xc44a('0x1c')][_0xc44a('0x1d')]===undefined?!![]:![]:!![]})[_0xc44a('0x1e')](function(_0x14e4c7){logger[_0xc44a('0x10')](_0xc44a('0x1f'),_0x14b3c3);logger['debug']('CreateSmsMessage',_0x14b3c3,JSON[_0xc44a('0x13')](_0x14e4c7));_0x2e69e3(_0x14e4c7);})[_0xc44a('0x18')](function(_0x319f5d){logger[_0xc44a('0x14')]('CreateSmsMessage',_0x319f5d[_0xc44a('0x16')],_0x14b3c3);_0x55158b(_0x53c73b[_0xc44a('0x14')](0x1f4,_0x319f5d[_0xc44a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9bb16d8..4683925 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 _0xae74=['removeListener','register','smsMessage:','save','remove','update','emit'];(function(_0x2a453b,_0x479c50){var _0x132f79=function(_0x5e3d83){while(--_0x5e3d83){_0x2a453b['push'](_0x2a453b['shift']());}};_0x132f79(++_0x479c50);}(_0xae74,0x6c));var _0x4ae7=function(_0x25cec8,_0x2cc3c1){_0x25cec8=_0x25cec8-0x0;var _0xfbb367=_0xae74[_0x25cec8];return _0xfbb367;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x4ae7('0x0'),_0x4ae7('0x1'),_0x4ae7('0x2')];function createListener(_0x296bf0,_0x7a4c9e){return function(_0x2a5f4f){_0x7a4c9e[_0x4ae7('0x3')](_0x296bf0,_0x2a5f4f);};}function removeListener(_0xcfdbb0,_0x3707d4){return function(){SmsMessageEvents[_0x4ae7('0x4')](_0xcfdbb0,_0x3707d4);};}exports[_0x4ae7('0x5')]=function(_0x56632d){for(var _0x500c15=0x0,_0x35a165=events['length'];_0x500c15<_0x35a165;_0x500c15++){var _0x5651a0=events[_0x500c15];var _0x153924=createListener(_0x4ae7('0x6')+_0x5651a0,_0x56632d);SmsMessageEvents['on'](_0x5651a0,_0x153924);}}; \ No newline at end of file +var _0x48fd=['./smsMessage.events','save','remove','removeListener','register'];(function(_0x3a7edd,_0xbc5870){var _0x2623ff=function(_0xca2839){while(--_0xca2839){_0x3a7edd['push'](_0x3a7edd['shift']());}};_0x2623ff(++_0xbc5870);}(_0x48fd,0x87));var _0xd48f=function(_0x4a5231,_0x470bca){_0x4a5231=_0x4a5231-0x0;var _0x456b65=_0x48fd[_0x4a5231];return _0x456b65;};'use strict';var SmsMessageEvents=require(_0xd48f('0x0'));var events=[_0xd48f('0x1'),_0xd48f('0x2'),'update'];function createListener(_0x2fdcce,_0x29cc11){return function(_0x5d9317){_0x29cc11['emit'](_0x2fdcce,_0x5d9317);};}function removeListener(_0x408aae,_0x5c6537){return function(){SmsMessageEvents[_0xd48f('0x3')](_0x408aae,_0x5c6537);};}exports[_0xd48f('0x4')]=function(_0x5cb37a){for(var _0x25eb67=0x0,_0x584f2b=events['length'];_0x25eb67<_0x584f2b;_0x25eb67++){var _0x2964c3=events[_0x25eb67];var _0x496f92=createListener('smsMessage:'+_0x2964c3,_0x5cb37a);SmsMessageEvents['on'](_0x2964c3,_0x496f92);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 1178526..5db1a71 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 _0x3d04=['/:id/teams','removeAgents','exports','multer','path','connect-timeout','express','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','destroy','delete'];(function(_0x5be1af,_0x32300d){var _0x58dce0=function(_0x371bea){while(--_0x371bea){_0x5be1af['push'](_0x5be1af['shift']());}};_0x58dce0(++_0x32300d);}(_0x3d04,0xe3));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x43d0('0x0'));var util=require('util');var path=require(_0x43d0('0x1'));var timeout=require(_0x43d0('0x2'));var express=require(_0x43d0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x43d0('0x4'));var config=require('../../config/environment');var controller=require(_0x43d0('0x5'));router[_0x43d0('0x6')]('/',auth[_0x43d0('0x7')](),controller[_0x43d0('0x8')]);router[_0x43d0('0x6')](_0x43d0('0x9'),auth[_0x43d0('0x7')](),controller[_0x43d0('0xa')]);router[_0x43d0('0x6')](_0x43d0('0xb'),auth[_0x43d0('0x7')](),controller[_0x43d0('0xc')]);router['get'](_0x43d0('0xd'),auth[_0x43d0('0x7')](),controller[_0x43d0('0xe')]);router[_0x43d0('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x43d0('0xf')]);router['get'](_0x43d0('0x10'),auth[_0x43d0('0x7')](),controller[_0x43d0('0x11')]);router[_0x43d0('0x12')]('/',auth[_0x43d0('0x7')](),controller['create']);router[_0x43d0('0x12')]('/:id/teams',auth[_0x43d0('0x7')](),controller[_0x43d0('0x13')]);router[_0x43d0('0x12')](_0x43d0('0x10'),auth[_0x43d0('0x7')](),controller[_0x43d0('0x14')]);router[_0x43d0('0x15')](_0x43d0('0xb'),auth['isAuthenticated'](),controller[_0x43d0('0x16')]);router['delete']('/:id',auth[_0x43d0('0x7')](),controller[_0x43d0('0x17')]);router[_0x43d0('0x18')](_0x43d0('0x19'),auth[_0x43d0('0x7')](),controller['removeTeams']);router[_0x43d0('0x18')](_0x43d0('0x10'),auth[_0x43d0('0x7')](),controller[_0x43d0('0x1a')]);module[_0x43d0('0x1b')]=router; \ No newline at end of file +var _0x60ff=['getAgents','post','create','addAgents','put','delete','/:id/teams','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','getMembers','getTeams','/:id/users'];(function(_0xbfbcea,_0x5a1521){var _0x103fed=function(_0x1fea97){while(--_0x1fea97){_0xbfbcea['push'](_0xbfbcea['shift']());}};_0x103fed(++_0x5a1521);}(_0x60ff,0x1ec));var _0xf60f=function(_0x1d9a67,_0x48c709){_0x1d9a67=_0x1d9a67-0x0;var _0x2712b1=_0x60ff[_0x1d9a67];return _0x2712b1;};'use strict';var multer=require(_0xf60f('0x0'));var util=require(_0xf60f('0x1'));var path=require('path');var timeout=require(_0xf60f('0x2'));var express=require('express');var router=express[_0xf60f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf60f('0x4'));var interaction=require(_0xf60f('0x5'));var config=require(_0xf60f('0x6'));var controller=require('./smsQueue.controller');router[_0xf60f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf60f('0x7')]('/describe',auth[_0xf60f('0x8')](),controller[_0xf60f('0x9')]);router[_0xf60f('0x7')](_0xf60f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xf60f('0x7')]('/:id/members',auth[_0xf60f('0x8')](),controller[_0xf60f('0xb')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0xf60f('0xc')]);router[_0xf60f('0x7')](_0xf60f('0xd'),auth[_0xf60f('0x8')](),controller[_0xf60f('0xe')]);router[_0xf60f('0xf')]('/',auth[_0xf60f('0x8')](),controller[_0xf60f('0x10')]);router[_0xf60f('0xf')]('/:id/teams',auth[_0xf60f('0x8')](),controller['addTeams']);router[_0xf60f('0xf')](_0xf60f('0xd'),auth['isAuthenticated'](),controller[_0xf60f('0x11')]);router[_0xf60f('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf60f('0x13')](_0xf60f('0xa'),auth[_0xf60f('0x8')](),controller['destroy']);router[_0xf60f('0x13')](_0xf60f('0x14'),auth[_0xf60f('0x8')](),controller['removeTeams']);router[_0xf60f('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xf60f('0x15')]);module[_0xf60f('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 48ef735..7494b60 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 _0x39c1=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2d1023,_0x1e72b3){var _0x1e22f6=function(_0x54809c){while(--_0x54809c){_0x2d1023['push'](_0x2d1023['shift']());}};_0x1e22f6(++_0x1e72b3);}(_0x39c1,0x1f1));var _0x139c=function(_0x42540c,_0x27ca3b){_0x42540c=_0x42540c-0x0;var _0x1a27dc=_0x39c1[_0x42540c];return _0x1a27dc;};'use strict';var Sequelize=require(_0x139c('0x0'));module[_0x139c('0x1')]={'name':{'type':Sequelize[_0x139c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x139c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x139c('0x4')](_0x139c('0x5'),_0x139c('0x6'),_0x139c('0x7'))}}; \ No newline at end of file +var _0xcda3=['exports','STRING','name','INTEGER','ENUM','beepall','roundrobin'];(function(_0xf6bb7d,_0x8af4f5){var _0x132764=function(_0x4f6309){while(--_0x4f6309){_0xf6bb7d['push'](_0xf6bb7d['shift']());}};_0x132764(++_0x8af4f5);}(_0xcda3,0x1ce));var _0x3cda=function(_0x438685,_0x4ec0c0){_0x438685=_0x438685-0x0;var _0x41cca2=_0xcda3[_0x438685];return _0x41cca2;};'use strict';var Sequelize=require('sequelize');module[_0x3cda('0x0')]={'name':{'type':Sequelize[_0x3cda('0x1')],'unique':_0x3cda('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3cda('0x1')]},'timeout':{'type':Sequelize[_0x3cda('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3cda('0x4')]('rrmemory',_0x3cda('0x5'),_0x3cda('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fb79142..50fb9c7 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x128d64,_0xb21a70){var _0x6605c=function(_0x10a166){while(--_0x10a166){_0x128d64['push'](_0x128d64['shift']());}};_0x6605c(++_0xb21a70);}(_0x2ef3,0xba));var _0x32ef=function(_0x30f61c,_0x113092){_0x30f61c=_0x30f61c-0x0;var _0x1c01ed=_0x2ef3[_0x30f61c];return _0x1c01ed;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x4b189d,_0xeb32c){var _0x2dd116=function(_0x224775){while(--_0x224775){_0x4b189d['push'](_0x4b189d['shift']());}};_0x2dd116(++_0xeb32c);}(_0x2ef3,0xba));var _0x32ef=function(_0x471539,_0x1ed4d6){_0x471539=_0x471539-0x0;var _0x2c587f=_0x2ef3[_0x471539];return _0x2c587f;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 0d10511..fa59f72 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 _0xd535=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x16ca74,_0x529802){var _0x4227e5=function(_0x2908f8){while(--_0x2908f8){_0x16ca74['push'](_0x16ca74['shift']());}};_0x4227e5(++_0x529802);}(_0xd535,0x161));var _0x5d53=function(_0x49fd25,_0x43d442){_0x49fd25=_0x49fd25-0x0;var _0x3fc05c=_0xd535[_0x49fd25];return _0x3fc05c;};'use strict';var EventEmitter=require(_0x5d53('0x0'));var SmsQueue=require(_0x5d53('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d53('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5177af){return function(_0x300c2a,_0x43a935,_0x3d8ac8){SmsQueueEvents[_0x5d53('0x3')](_0x5177af+':'+_0x300c2a['id'],_0x300c2a);SmsQueueEvents[_0x5d53('0x3')](_0x5177af,_0x300c2a);_0x3d8ac8(null);};}for(var e in events){if(events[_0x5d53('0x4')](e)){var event=events[e];SmsQueue[_0x5d53('0x5')](e,emitEvent(event));}}module[_0x5d53('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x12b5=['../../mysqldb','SmsQueue','setMaxListeners','save','update','emit','exports','events'];(function(_0x55d58c,_0x2bb1a1){var _0x4a22de=function(_0xd82d2e){while(--_0xd82d2e){_0x55d58c['push'](_0x55d58c['shift']());}};_0x4a22de(++_0x2bb1a1);}(_0x12b5,0xff));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x512b('0x0'));var SmsQueue=require(_0x512b('0x1'))['db'][_0x512b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x512b('0x3')](0x0);var events={'afterCreate':_0x512b('0x4'),'afterUpdate':_0x512b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x127213){return function(_0x3e8155,_0xf64163,_0x1a6c80){SmsQueueEvents[_0x512b('0x6')](_0x127213+':'+_0x3e8155['id'],_0x3e8155);SmsQueueEvents[_0x512b('0x6')](_0x127213,_0x3e8155);_0x1a6c80(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x512b('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6b264d3..1cf7493 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 _0x39f8=['moment','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','util','../../config/logger','api'];(function(_0x1cda4d,_0x227fab){var _0x4a1fa9=function(_0x3badd6){while(--_0x3badd6){_0x1cda4d['push'](_0x1cda4d['shift']());}};_0x4a1fa9(++_0x227fab);}(_0x39f8,0x17e));var _0x839f=function(_0x5a19f8,_0x32af6b){_0x5a19f8=_0x5a19f8-0x0;var _0x4f5ae5=_0x39f8[_0x5a19f8];return _0x4f5ae5;};'use strict';var _=require('lodash');var util=require(_0x839f('0x0'));var logger=require(_0x839f('0x1'))(_0x839f('0x2'));var moment=require(_0x839f('0x3'));var BPromise=require('bluebird');var rp=require(_0x839f('0x4'));var fs=require('fs');var path=require(_0x839f('0x5'));var rimraf=require('rimraf');var config=require(_0x839f('0x6'));var attributes=require(_0x839f('0x7'));module[_0x839f('0x8')]=function(_0x5dd02b,_0x512aae){return _0x5dd02b[_0x839f('0x9')](_0x839f('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64d0=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x64d0,0x11e));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x064d('0x0'));var util=require('util');var logger=require(_0x064d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x064d('0x2'));var rp=require(_0x064d('0x3'));var fs=require('fs');var path=require(_0x064d('0x4'));var rimraf=require(_0x064d('0x5'));var config=require(_0x064d('0x6'));var attributes=require(_0x064d('0x7'));module[_0x064d('0x8')]=function(_0x3838e7,_0x3d37fa){return _0x3838e7[_0x064d('0x9')](_0x064d('0xa'),attributes,{'tableName':_0x064d('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 46c25de..d9df9e4 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 _0x7f59=['where','attributes','limit','map','include','model','find','ShowSmsQueue','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsQueue.socket','register','then','info','SmsQueue,\x20%s,\x20%s','debug','stringify','error','code','message','result','GetSmsQueue','SmsQueue','options','raw'];(function(_0x212509,_0x495254){var _0x3525a1=function(_0x1ca97c){while(--_0x1ca97c){_0x212509['push'](_0x212509['shift']());}};_0x3525a1(++_0x495254);}(_0x7f59,0x1c5));var _0x97f5=function(_0x4c8b92,_0x28beea){_0x4c8b92=_0x4c8b92-0x0;var _0x41a481=_0x7f59[_0x4c8b92];return _0x41a481;};'use strict';var _=require(_0x97f5('0x0'));var util=require('util');var moment=require(_0x97f5('0x1'));var BPromise=require(_0x97f5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97f5('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x97f5('0x4'))(_0x97f5('0x5'));var config=require(_0x97f5('0x6'));var jayson=require(_0x97f5('0x7'));var client=jayson[_0x97f5('0x8')][_0x97f5('0x9')]({'port':0x232a});config['redis']=_[_0x97f5('0xa')](config[_0x97f5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x97f5('0xc'))(new Redis(config['redis']));require(_0x97f5('0xd'))[_0x97f5('0xe')](socket);function respondWithRpcPromise(_0x29d82a,_0x267244,_0x376643){return new BPromise(function(_0x2f8932,_0x4165fa){return client['request'](_0x29d82a,_0x376643)[_0x97f5('0xf')](function(_0x3c5746){logger[_0x97f5('0x10')](_0x97f5('0x11'),_0x267244,'request\x20sent');logger[_0x97f5('0x12')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x267244,'request\x20sent',JSON[_0x97f5('0x13')](_0x3c5746));if(_0x3c5746[_0x97f5('0x14')]){if(_0x3c5746[_0x97f5('0x14')][_0x97f5('0x15')]===0x1f4){logger[_0x97f5('0x14')](_0x97f5('0x11'),_0x267244,_0x3c5746[_0x97f5('0x14')][_0x97f5('0x16')]);return _0x4165fa(_0x3c5746[_0x97f5('0x14')][_0x97f5('0x16')]);}logger['error'](_0x97f5('0x11'),_0x267244,_0x3c5746[_0x97f5('0x14')][_0x97f5('0x16')]);return _0x2f8932(_0x3c5746[_0x97f5('0x14')][_0x97f5('0x16')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x267244,'request\x20sent');_0x2f8932(_0x3c5746[_0x97f5('0x17')][_0x97f5('0x16')]);}})['catch'](function(_0x34ab24){logger['error'](_0x97f5('0x11'),_0x267244,_0x34ab24);_0x4165fa(_0x34ab24);});});}exports[_0x97f5('0x18')]=function(_0x226e6c){var _0x5c541c=this;return new Promise(function(_0x201c0d,_0x56af4f){return db[_0x97f5('0x19')]['findAll']({'raw':_0x226e6c[_0x97f5('0x1a')]?_0x226e6c[_0x97f5('0x1a')][_0x97f5('0x1b')]===undefined?!![]:![]:!![],'where':_0x226e6c[_0x97f5('0x1a')]?_0x226e6c['options'][_0x97f5('0x1c')]||null:null,'attributes':_0x226e6c[_0x97f5('0x1a')]?_0x226e6c[_0x97f5('0x1a')][_0x97f5('0x1d')]||null:null,'limit':_0x226e6c[_0x97f5('0x1a')]?_0x226e6c[_0x97f5('0x1a')][_0x97f5('0x1e')]||null:null,'include':_0x226e6c[_0x97f5('0x1a')]?_0x226e6c['options']['include']?_[_0x97f5('0x1f')](_0x226e6c[_0x97f5('0x1a')][_0x97f5('0x20')],function(_0x4319a4){return{'model':db[_0x4319a4[_0x97f5('0x21')]],'as':_0x4319a4['as'],'attributes':_0x4319a4[_0x97f5('0x1d')],'include':_0x4319a4[_0x97f5('0x20')]?_[_0x97f5('0x1f')](_0x4319a4['include'],function(_0x221671){return{'model':db[_0x221671[_0x97f5('0x21')]],'as':_0x221671['as'],'attributes':_0x221671['attributes'],'include':_0x221671[_0x97f5('0x20')]?_[_0x97f5('0x1f')](_0x221671[_0x97f5('0x20')],function(_0x2c04f6){return{'model':db[_0x2c04f6[_0x97f5('0x21')]],'as':_0x2c04f6['as'],'attributes':_0x2c04f6[_0x97f5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97f5('0xf')](function(_0x150e5a){logger[_0x97f5('0x10')](_0x97f5('0x18'),_0x226e6c);logger[_0x97f5('0x12')](_0x97f5('0x18'),_0x226e6c,JSON[_0x97f5('0x13')](_0x150e5a));_0x201c0d(_0x150e5a);})['catch'](function(_0x2b1940){logger[_0x97f5('0x14')]('GetSmsQueue',_0x2b1940[_0x97f5('0x16')],_0x226e6c);_0x56af4f(_0x5c541c[_0x97f5('0x14')](0x1f4,_0x2b1940[_0x97f5('0x16')]));});});};exports['ShowSmsQueue']=function(_0x4e3406){var _0x304d16=this;return new Promise(function(_0x1b246f,_0xad00ad){return db[_0x97f5('0x19')][_0x97f5('0x22')]({'raw':_0x4e3406['options']?_0x4e3406[_0x97f5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4e3406['options']?_0x4e3406[_0x97f5('0x1a')][_0x97f5('0x1c')]||null:null,'attributes':_0x4e3406[_0x97f5('0x1a')]?_0x4e3406[_0x97f5('0x1a')]['attributes']||null:null,'include':_0x4e3406[_0x97f5('0x1a')]?_0x4e3406[_0x97f5('0x1a')][_0x97f5('0x20')]?_['map'](_0x4e3406['options'][_0x97f5('0x20')],function(_0x47ca45){return{'model':db[_0x47ca45[_0x97f5('0x21')]],'as':_0x47ca45['as'],'attributes':_0x47ca45[_0x97f5('0x1d')],'include':_0x47ca45[_0x97f5('0x20')]?_['map'](_0x47ca45[_0x97f5('0x20')],function(_0x42c71f){return{'model':db[_0x42c71f[_0x97f5('0x21')]],'as':_0x42c71f['as'],'attributes':_0x42c71f[_0x97f5('0x1d')],'include':_0x42c71f[_0x97f5('0x20')]?_[_0x97f5('0x1f')](_0x42c71f['include'],function(_0x495d1f){return{'model':db[_0x495d1f['model']],'as':_0x495d1f['as'],'attributes':_0x495d1f[_0x97f5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x97f5('0xf')](function(_0x5ce358){logger['info'](_0x97f5('0x23'),_0x4e3406);logger[_0x97f5('0x12')](_0x97f5('0x23'),_0x4e3406,JSON[_0x97f5('0x13')](_0x5ce358));_0x1b246f(_0x5ce358);})[_0x97f5('0x24')](function(_0x5cbc60){logger[_0x97f5('0x14')](_0x97f5('0x23'),_0x5cbc60[_0x97f5('0x16')],_0x4e3406);_0xad00ad(_0x304d16[_0x97f5('0x14')](0x1f4,_0x5cbc60[_0x97f5('0x16')]));});});}; \ No newline at end of file +var _0xbf95=['SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','attributes','limit','include','model','map','GetSmsQueue','ShowSmsQueue','SmsQueue','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./smsQueue.socket','register','request','then','request\x20sent','debug'];(function(_0x36fe46,_0x40010c){var _0x4d2e9c=function(_0x2dfa20){while(--_0x2dfa20){_0x36fe46['push'](_0x36fe46['shift']());}};_0x4d2e9c(++_0x40010c);}(_0xbf95,0x68));var _0x5bf9=function(_0x5c861d,_0xed9768){_0x5c861d=_0x5c861d-0x0;var _0x42eac5=_0xbf95[_0x5c861d];return _0x42eac5;};'use strict';var _=require(_0x5bf9('0x0'));var util=require('util');var moment=require(_0x5bf9('0x1'));var BPromise=require(_0x5bf9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bf9('0x3'));var db=require(_0x5bf9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bf9('0x5'))(_0x5bf9('0x6'));var config=require(_0x5bf9('0x7'));var jayson=require(_0x5bf9('0x8'));var client=jayson[_0x5bf9('0x9')][_0x5bf9('0xa')]({'port':0x232a});config[_0x5bf9('0xb')]=_[_0x5bf9('0xc')](config[_0x5bf9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5bf9('0xb')]));require(_0x5bf9('0xd'))[_0x5bf9('0xe')](socket);function respondWithRpcPromise(_0x479b71,_0x1e7598,_0x1a5baa){return new BPromise(function(_0x546186,_0x3263c3){return client[_0x5bf9('0xf')](_0x479b71,_0x1a5baa)[_0x5bf9('0x10')](function(_0x14b59a){logger['info']('SmsQueue,\x20%s,\x20%s',_0x1e7598,_0x5bf9('0x11'));logger[_0x5bf9('0x12')](_0x5bf9('0x13'),_0x1e7598,_0x5bf9('0x11'),JSON[_0x5bf9('0x14')](_0x14b59a));if(_0x14b59a[_0x5bf9('0x15')]){if(_0x14b59a['error'][_0x5bf9('0x16')]===0x1f4){logger[_0x5bf9('0x15')](_0x5bf9('0x17'),_0x1e7598,_0x14b59a['error']['message']);return _0x3263c3(_0x14b59a[_0x5bf9('0x15')][_0x5bf9('0x18')]);}logger[_0x5bf9('0x15')]('SmsQueue,\x20%s,\x20%s',_0x1e7598,_0x14b59a[_0x5bf9('0x15')][_0x5bf9('0x18')]);return _0x546186(_0x14b59a['error'][_0x5bf9('0x18')]);}else{logger[_0x5bf9('0x19')](_0x5bf9('0x17'),_0x1e7598,_0x5bf9('0x11'));_0x546186(_0x14b59a[_0x5bf9('0x1a')][_0x5bf9('0x18')]);}})[_0x5bf9('0x1b')](function(_0x1ecdce){logger['error'](_0x5bf9('0x17'),_0x1e7598,_0x1ecdce);_0x3263c3(_0x1ecdce);});});}exports['GetSmsQueue']=function(_0x1408ce){var _0x44292c=this;return new Promise(function(_0x2f3b9c,_0xf955d9){return db['SmsQueue'][_0x5bf9('0x1c')]({'raw':_0x1408ce[_0x5bf9('0x1d')]?_0x1408ce[_0x5bf9('0x1d')][_0x5bf9('0x1e')]===undefined?!![]:![]:!![],'where':_0x1408ce['options']?_0x1408ce[_0x5bf9('0x1d')]['where']||null:null,'attributes':_0x1408ce[_0x5bf9('0x1d')]?_0x1408ce['options'][_0x5bf9('0x1f')]||null:null,'limit':_0x1408ce['options']?_0x1408ce['options'][_0x5bf9('0x20')]||null:null,'include':_0x1408ce[_0x5bf9('0x1d')]?_0x1408ce[_0x5bf9('0x1d')][_0x5bf9('0x21')]?_['map'](_0x1408ce['options'][_0x5bf9('0x21')],function(_0x2be179){return{'model':db[_0x2be179['model']],'as':_0x2be179['as'],'attributes':_0x2be179[_0x5bf9('0x1f')],'include':_0x2be179[_0x5bf9('0x21')]?_['map'](_0x2be179[_0x5bf9('0x21')],function(_0x46249f){return{'model':db[_0x46249f[_0x5bf9('0x22')]],'as':_0x46249f['as'],'attributes':_0x46249f[_0x5bf9('0x1f')],'include':_0x46249f[_0x5bf9('0x21')]?_[_0x5bf9('0x23')](_0x46249f[_0x5bf9('0x21')],function(_0x14f3b5){return{'model':db[_0x14f3b5[_0x5bf9('0x22')]],'as':_0x14f3b5['as'],'attributes':_0x14f3b5['attributes']};}):[]};}):[]};}):[]:[]})[_0x5bf9('0x10')](function(_0x3e47ea){logger['info'](_0x5bf9('0x24'),_0x1408ce);logger[_0x5bf9('0x12')]('GetSmsQueue',_0x1408ce,JSON['stringify'](_0x3e47ea));_0x2f3b9c(_0x3e47ea);})[_0x5bf9('0x1b')](function(_0x52c95a){logger[_0x5bf9('0x15')](_0x5bf9('0x24'),_0x52c95a['message'],_0x1408ce);_0xf955d9(_0x44292c[_0x5bf9('0x15')](0x1f4,_0x52c95a[_0x5bf9('0x18')]));});});};exports[_0x5bf9('0x25')]=function(_0x3b8cdd){var _0x35130a=this;return new Promise(function(_0x446770,_0x5d4e74){return db[_0x5bf9('0x26')][_0x5bf9('0x27')]({'raw':_0x3b8cdd[_0x5bf9('0x1d')]?_0x3b8cdd[_0x5bf9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3b8cdd[_0x5bf9('0x1d')]?_0x3b8cdd['options'][_0x5bf9('0x28')]||null:null,'attributes':_0x3b8cdd[_0x5bf9('0x1d')]?_0x3b8cdd[_0x5bf9('0x1d')]['attributes']||null:null,'include':_0x3b8cdd[_0x5bf9('0x1d')]?_0x3b8cdd['options'][_0x5bf9('0x21')]?_['map'](_0x3b8cdd[_0x5bf9('0x1d')][_0x5bf9('0x21')],function(_0x4bf42d){return{'model':db[_0x4bf42d[_0x5bf9('0x22')]],'as':_0x4bf42d['as'],'attributes':_0x4bf42d['attributes'],'include':_0x4bf42d['include']?_[_0x5bf9('0x23')](_0x4bf42d['include'],function(_0x5c3c9b){return{'model':db[_0x5c3c9b[_0x5bf9('0x22')]],'as':_0x5c3c9b['as'],'attributes':_0x5c3c9b[_0x5bf9('0x1f')],'include':_0x5c3c9b[_0x5bf9('0x21')]?_[_0x5bf9('0x23')](_0x5c3c9b[_0x5bf9('0x21')],function(_0x2092a7){return{'model':db[_0x2092a7['model']],'as':_0x2092a7['as'],'attributes':_0x2092a7[_0x5bf9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1351){logger[_0x5bf9('0x19')](_0x5bf9('0x25'),_0x3b8cdd);logger[_0x5bf9('0x12')](_0x5bf9('0x25'),_0x3b8cdd,JSON[_0x5bf9('0x14')](_0x3c1351));_0x446770(_0x3c1351);})[_0x5bf9('0x1b')](function(_0x3a16b8){logger['error']('ShowSmsQueue',_0x3a16b8[_0x5bf9('0x18')],_0x3b8cdd);_0x5d4e74(_0x35130a[_0x5bf9('0x15')](0x1f4,_0x3a16b8[_0x5bf9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9fe3a1f..82863d9 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 _0x49ab=['emit','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x5259a9,_0x59547a){var _0x334dc3=function(_0x192d7b){while(--_0x192d7b){_0x5259a9['push'](_0x5259a9['shift']());}};_0x334dc3(++_0x59547a);}(_0x49ab,0x1f4));var _0xb49a=function(_0x50f900,_0x506e73){_0x50f900=_0x50f900-0x0;var _0x497f12=_0x49ab[_0x50f900];return _0x497f12;};'use strict';var SmsQueueEvents=require(_0xb49a('0x0'));var events=[_0xb49a('0x1'),_0xb49a('0x2'),_0xb49a('0x3')];function createListener(_0x56778a,_0x3226ca){return function(_0x5d2474){_0x3226ca[_0xb49a('0x4')](_0x56778a,_0x5d2474);};}function removeListener(_0x2fb1ee,_0x4c3b41){return function(){SmsQueueEvents['removeListener'](_0x2fb1ee,_0x4c3b41);};}exports[_0xb49a('0x5')]=function(_0x1bfb43){for(var _0x43683d=0x0,_0x57c147=events[_0xb49a('0x6')];_0x43683d<_0x57c147;_0x43683d++){var _0x211e48=events[_0x43683d];var _0x26bd84=createListener(_0xb49a('0x7')+_0x211e48,_0x1bfb43);SmsQueueEvents['on'](_0x211e48,_0x26bd84);}}; \ No newline at end of file +var _0x8436=['save','remove','update','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x11d78d,_0x365ac8){var _0xc9e72a=function(_0x13ca12){while(--_0x13ca12){_0x11d78d['push'](_0x11d78d['shift']());}};_0xc9e72a(++_0x365ac8);}(_0x8436,0x107));var _0x6843=function(_0x443295,_0x150f4c){_0x443295=_0x443295-0x0;var _0x52d00c=_0x8436[_0x443295];return _0x52d00c;};'use strict';var SmsQueueEvents=require(_0x6843('0x0'));var events=[_0x6843('0x1'),_0x6843('0x2'),_0x6843('0x3')];function createListener(_0x47cb05,_0x3c552a){return function(_0x32fb34){_0x3c552a['emit'](_0x47cb05,_0x32fb34);};}function removeListener(_0x3b7b7c,_0x49ad16){return function(){SmsQueueEvents[_0x6843('0x4')](_0x3b7b7c,_0x49ad16);};}exports[_0x6843('0x5')]=function(_0x62f062){for(var _0x272a55=0x0,_0x43902c=events[_0x6843('0x6')];_0x272a55<_0x43902c;_0x272a55++){var _0x1f54af=events[_0x272a55];var _0x16ebd2=createListener(_0x6843('0x7')+_0x1f54af,_0x62f062);SmsQueueEvents['on'](_0x1f54af,_0x16ebd2);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b9e7069..5819038 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 _0x05dc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','destroy','exports','util','express','Router','fs-extra'];(function(_0x506d17,_0x8d0ed3){var _0x56f2ae=function(_0x2cb034){while(--_0x2cb034){_0x506d17['push'](_0x506d17['shift']());}};_0x56f2ae(++_0x8d0ed3);}(_0x05dc,0x178));var _0xc05d=function(_0x2ac992,_0x37c877){_0x2ac992=_0x2ac992-0x0;var _0x223c9d=_0x05dc[_0x2ac992];return _0x223c9d;};'use strict';var multer=require('multer');var util=require(_0xc05d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc05d('0x1'));var router=express[_0xc05d('0x2')]();var fs_extra=require(_0xc05d('0x3'));var auth=require(_0xc05d('0x4'));var interaction=require(_0xc05d('0x5'));var config=require(_0xc05d('0x6'));var controller=require(_0xc05d('0x7'));router[_0xc05d('0x8')]('/',auth[_0xc05d('0x9')](),controller[_0xc05d('0xa')]);router[_0xc05d('0x8')]('/describe',auth[_0xc05d('0x9')](),controller[_0xc05d('0xb')]);router[_0xc05d('0x8')](_0xc05d('0xc'),auth[_0xc05d('0x9')](),controller[_0xc05d('0xd')]);router[_0xc05d('0xe')]('/',auth[_0xc05d('0x9')](),controller[_0xc05d('0xf')]);router[_0xc05d('0x10')](_0xc05d('0xc'),auth[_0xc05d('0x9')](),controller['update']);router['delete'](_0xc05d('0xc'),auth['isAuthenticated'](),controller[_0xc05d('0x11')]);module[_0xc05d('0x12')]=router; \ No newline at end of file +var _0x9e78=['./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5712c9,_0x3a6be3){var _0x3a4202=function(_0x19cb1d){while(--_0x19cb1d){_0x5712c9['push'](_0x5712c9['shift']());}};_0x3a4202(++_0x3a6be3);}(_0x9e78,0x14e));var _0x89e7=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x9e78[_0x3ce2c4];return _0x4047c1;};'use strict';var multer=require(_0x89e7('0x0'));var util=require('util');var path=require(_0x89e7('0x1'));var timeout=require(_0x89e7('0x2'));var express=require(_0x89e7('0x3'));var router=express['Router']();var fs_extra=require(_0x89e7('0x4'));var auth=require(_0x89e7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89e7('0x6'));router[_0x89e7('0x7')]('/',auth['isAuthenticated'](),controller[_0x89e7('0x8')]);router[_0x89e7('0x7')](_0x89e7('0x9'),auth[_0x89e7('0xa')](),controller[_0x89e7('0xb')]);router[_0x89e7('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x89e7('0xc')]);router[_0x89e7('0xd')]('/',auth[_0x89e7('0xa')](),controller['create']);router[_0x89e7('0xe')](_0x89e7('0xf'),auth[_0x89e7('0xa')](),controller[_0x89e7('0x10')]);router[_0x89e7('0x11')](_0x89e7('0xf'),auth[_0x89e7('0xa')](),controller[_0x89e7('0x12')]);module[_0x89e7('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 63fdb7a..1104b39 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 _0xd333=['DATE','exports','STRING'];(function(_0x1b1656,_0x1000c5){var _0x1f22b2=function(_0x7b1118){while(--_0x7b1118){_0x1b1656['push'](_0x1b1656['shift']());}};_0x1f22b2(++_0x1000c5);}(_0xd333,0x106));var _0x3d33=function(_0x4c9940,_0x2f1082){_0x4c9940=_0x4c9940-0x0;var _0x2dcf82=_0xd333[_0x4c9940];return _0x2dcf82;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x3d33('0x0')]={'uniqueid':{'type':Sequelize[_0x3d33('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3d33('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3d33('0x2')]},'exitAt':{'type':Sequelize[_0x3d33('0x2')]},'reason':{'type':Sequelize[_0x3d33('0x1')]}}; \ No newline at end of file +var _0x666b=['DATE','moment','sequelize','exports','STRING'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x666b,0x1b9));var _0xb666=function(_0x52975d,_0x127968){_0x52975d=_0x52975d-0x0;var _0x3baabc=_0x666b[_0x52975d];return _0x3baabc;};'use strict';var moment=require(_0xb666('0x0'));var Sequelize=require(_0xb666('0x1'));module[_0xb666('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb666('0x3')]},'joinAt':{'type':Sequelize[_0xb666('0x4')]},'leaveAt':{'type':Sequelize[_0xb666('0x4')]},'acceptAt':{'type':Sequelize[_0xb666('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 36c7641..f71ac5e 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 _0xa63f=['../../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','then','stack','name','send','index','map','SmsQueueReport','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','catch','show','params','keys','include','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xb8f4bf,_0x4a3bea){var _0x67f664=function(_0x2ba891){while(--_0x2ba891){_0xb8f4bf['push'](_0xb8f4bf['shift']());}};_0x67f664(++_0x4a3bea);}(_0xa63f,0x101));var _0xfa63=function(_0x38a6c6,_0x4062ca){_0x38a6c6=_0x38a6c6-0x0;var _0x142f0a=_0xa63f[_0x38a6c6];return _0x142f0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfa63('0x0'));var zipdir=require(_0xfa63('0x1'));var jsonpatch=require(_0xfa63('0x2'));var rp=require(_0xfa63('0x3'));var moment=require(_0xfa63('0x4'));var BPromise=require(_0xfa63('0x5'));var Mustache=require(_0xfa63('0x6'));var util=require(_0xfa63('0x7'));var path=require(_0xfa63('0x8'));var sox=require(_0xfa63('0x9'));var csv=require(_0xfa63('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa63('0xb'));var _=require(_0xfa63('0xc'));var squel=require('squel');var crypto=require(_0xfa63('0xd'));var jsforce=require(_0xfa63('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xfa63('0xa'));var querystring=require('querystring');var Papa=require(_0xfa63('0xf'));var Redis=require(_0xfa63('0x10'));var authService=require(_0xfa63('0x11'));var qs=require(_0xfa63('0x12'));var as=require(_0xfa63('0x13'));var hardwareService=require(_0xfa63('0x14'));var logger=require('../../config/logger')(_0xfa63('0x15'));var utils=require(_0xfa63('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xfa63('0x17'));var db=require(_0xfa63('0x18'))['db'];function respondWithStatusCode(_0x170ab0,_0x2edf4a){_0x2edf4a=_0x2edf4a||0xcc;return function(_0x6f93c4){if(_0x6f93c4){return _0x170ab0[_0xfa63('0x19')](_0x2edf4a);}return _0x170ab0[_0xfa63('0x1a')](_0x2edf4a)[_0xfa63('0x1b')]();};}function respondWithResult(_0x24faca,_0x36af08){_0x36af08=_0x36af08||0xc8;return function(_0x1bb2b2){if(_0x1bb2b2){return _0x24faca[_0xfa63('0x1a')](_0x36af08)[_0xfa63('0x1c')](_0x1bb2b2);}};}function respondWithFilteredResult(_0x4677d8,_0x5408b2){return function(_0x335e3e){if(_0x335e3e){var _0x477a29=typeof _0x5408b2[_0xfa63('0x1d')]===_0xfa63('0x1e')&&typeof _0x5408b2[_0xfa63('0x1f')]===_0xfa63('0x1e');var _0x4e2470=_0x335e3e[_0xfa63('0x20')];var _0x3bd5b4=_0x477a29?0x0:_0x5408b2['offset'];var _0x3c1325=_0x477a29?_0x335e3e[_0xfa63('0x20')]:_0x5408b2[_0xfa63('0x1d')]+_0x5408b2['limit'];var _0x9cc916;if(_0x3c1325>=_0x4e2470){_0x3c1325=_0x4e2470;_0x9cc916=0xc8;}else{_0x9cc916=0xce;}_0x4677d8[_0xfa63('0x1a')](_0x9cc916);return _0x4677d8['set'](_0xfa63('0x21'),_0x3bd5b4+'-'+_0x3c1325+'/'+_0x4e2470)[_0xfa63('0x1c')](_0x335e3e);}return null;};}function patchUpdates(_0x41704f){return function(_0x12fe70){try{jsonpatch[_0xfa63('0x22')](_0x12fe70,_0x41704f,!![]);}catch(_0x51e5f0){return BPromise[_0xfa63('0x23')](_0x51e5f0);}return _0x12fe70['save']();};}function saveUpdates(_0xa53fe8,_0x2f16dc){return function(_0xb4174e){if(_0xb4174e){return _0xb4174e['update'](_0xa53fe8)[_0xfa63('0x24')](function(_0x49687e){return _0x49687e;});}return null;};}function removeEntity(_0x337458,_0x17ee43){return function(_0x54ed62){if(_0x54ed62){return _0x54ed62['destroy']()[_0xfa63('0x24')](function(){_0x337458[_0xfa63('0x1a')](0xcc)[_0xfa63('0x1b')]();});}};}function handleEntityNotFound(_0x1a6e7c,_0x1f61ac){return function(_0x1b7c61){if(!_0x1b7c61){_0x1a6e7c['sendStatus'](0x194);}return _0x1b7c61;};}function handleError(_0x14004e,_0x3d5f7e){_0x3d5f7e=_0x3d5f7e||0x1f4;return function(_0x3b9208){logger['error'](_0x3b9208[_0xfa63('0x25')]);if(_0x3b9208[_0xfa63('0x26')]){delete _0x3b9208['name'];}_0x14004e[_0xfa63('0x1a')](_0x3d5f7e)[_0xfa63('0x27')](_0x3b9208);};}exports[_0xfa63('0x28')]=function(_0x160930,_0x4aa622){var _0x1d5faf={},_0x5bd4b7={},_0xce918={'count':0x0,'rows':[]};var _0x37f582=_[_0xfa63('0x29')](db[_0xfa63('0x2a')]['rawAttributes'],function(_0x143f8c){return{'name':_0x143f8c['fieldName'],'type':_0x143f8c[_0xfa63('0x2b')][_0xfa63('0x2c')]};});_0x5bd4b7[_0xfa63('0x2d')]=_[_0xfa63('0x29')](_0x37f582,_0xfa63('0x26'));_0x5bd4b7['query']=_['keys'](_0x160930['query']);_0x5bd4b7[_0xfa63('0x2e')]=_[_0xfa63('0x2f')](_0x5bd4b7[_0xfa63('0x2d')],_0x5bd4b7[_0xfa63('0x30')]);_0x1d5faf[_0xfa63('0x31')]=_['intersection'](_0x5bd4b7[_0xfa63('0x2d')],qs[_0xfa63('0x32')](_0x160930['query']['fields']));_0x1d5faf[_0xfa63('0x31')]=_0x1d5faf['attributes'][_0xfa63('0x33')]?_0x1d5faf[_0xfa63('0x31')]:_0x5bd4b7[_0xfa63('0x2d')];if(!_0x160930['query']['hasOwnProperty'](_0xfa63('0x34'))){_0x1d5faf['limit']=qs[_0xfa63('0x1f')](_0x160930[_0xfa63('0x30')][_0xfa63('0x1f')]);_0x1d5faf['offset']=qs[_0xfa63('0x1d')](_0x160930[_0xfa63('0x30')][_0xfa63('0x1d')]);}_0x1d5faf[_0xfa63('0x35')]=qs[_0xfa63('0x36')](_0x160930['query'][_0xfa63('0x36')]);_0x1d5faf[_0xfa63('0x37')]=qs[_0xfa63('0x2e')](_['pick'](_0x160930[_0xfa63('0x30')],_0x5bd4b7[_0xfa63('0x2e')]),_0x37f582);if(_0x160930[_0xfa63('0x30')]['filter']){_0x1d5faf[_0xfa63('0x37')]=_[_0xfa63('0x38')](_0x1d5faf[_0xfa63('0x37')],{'$or':_[_0xfa63('0x29')](_0x37f582,function(_0x5d3431){if(_0x5d3431[_0xfa63('0x2b')]!==_0xfa63('0x39')){var _0x56ae94={};_0x56ae94[_0x5d3431[_0xfa63('0x26')]]={'$like':'%'+_0x160930['query'][_0xfa63('0x3a')]+'%'};return _0x56ae94;}})});}_0x1d5faf=_['merge']({},_0x1d5faf,_0x160930[_0xfa63('0x3b')]);var _0xdec960={'where':_0x1d5faf[_0xfa63('0x37')]};return db[_0xfa63('0x2a')]['count'](_0xdec960)[_0xfa63('0x24')](function(_0x3787b2){_0xce918[_0xfa63('0x20')]=_0x3787b2;if(_0x160930[_0xfa63('0x30')][_0xfa63('0x3c')]){_0x1d5faf['include']=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x1d5faf);})[_0xfa63('0x24')](function(_0x4a75f1){_0xce918['rows']=_0x4a75f1;return _0xce918;})[_0xfa63('0x24')](respondWithFilteredResult(_0x4aa622,_0x1d5faf))[_0xfa63('0x3d')](handleError(_0x4aa622,null));};exports[_0xfa63('0x3e')]=function(_0x52f3cc,_0x254249){var _0x4c1be2={'raw':!![],'where':{'id':_0x52f3cc[_0xfa63('0x3f')]['id']}},_0x340d8c={};_0x340d8c[_0xfa63('0x2d')]=_['keys'](db[_0xfa63('0x2a')]['rawAttributes']);_0x340d8c[_0xfa63('0x30')]=_[_0xfa63('0x40')](_0x52f3cc[_0xfa63('0x30')]);_0x340d8c[_0xfa63('0x2e')]=_[_0xfa63('0x2f')](_0x340d8c[_0xfa63('0x2d')],_0x340d8c[_0xfa63('0x30')]);_0x4c1be2[_0xfa63('0x31')]=_['intersection'](_0x340d8c[_0xfa63('0x2d')],qs[_0xfa63('0x32')](_0x52f3cc[_0xfa63('0x30')][_0xfa63('0x32')]));_0x4c1be2['attributes']=_0x4c1be2['attributes'][_0xfa63('0x33')]?_0x4c1be2[_0xfa63('0x31')]:_0x340d8c[_0xfa63('0x2d')];if(_0x52f3cc[_0xfa63('0x30')][_0xfa63('0x3c')]){_0x4c1be2[_0xfa63('0x41')]=[{'all':!![]}];}_0x4c1be2=_[_0xfa63('0x38')]({},_0x4c1be2,_0x52f3cc['options']);return db[_0xfa63('0x2a')]['find'](_0x4c1be2)[_0xfa63('0x24')](handleEntityNotFound(_0x254249,null))[_0xfa63('0x24')](respondWithResult(_0x254249,null))['catch'](handleError(_0x254249,null));};exports['create']=function(_0x271d95,_0x88bf87){return db[_0xfa63('0x2a')]['create'](_0x271d95['body'],{})[_0xfa63('0x24')](respondWithResult(_0x88bf87,0xc9))['catch'](handleError(_0x88bf87,null));};exports['update']=function(_0x516af8,_0x36a20a){if(_0x516af8[_0xfa63('0x42')]['id']){delete _0x516af8[_0xfa63('0x42')]['id'];}return db[_0xfa63('0x2a')][_0xfa63('0x43')]({'where':{'id':_0x516af8[_0xfa63('0x3f')]['id']}})[_0xfa63('0x24')](handleEntityNotFound(_0x36a20a,null))[_0xfa63('0x24')](saveUpdates(_0x516af8[_0xfa63('0x42')],null))[_0xfa63('0x24')](respondWithResult(_0x36a20a,null))[_0xfa63('0x3d')](handleError(_0x36a20a,null));};exports[_0xfa63('0x44')]=function(_0x276205,_0x539cb8){return db['SmsQueueReport']['find']({'where':{'id':_0x276205['params']['id']}})[_0xfa63('0x24')](handleEntityNotFound(_0x539cb8,null))['then'](removeEntity(_0x539cb8,null))[_0xfa63('0x3d')](handleError(_0x539cb8,null));};exports['describe']=function(_0x41eeb6,_0x20f118){return db[_0xfa63('0x2a')]['describe']()[_0xfa63('0x24')](respondWithResult(_0x20f118,null))[_0xfa63('0x3d')](handleError(_0x20f118,null));}; \ No newline at end of file +var _0xe297=['eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','lodash','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','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','describe'];(function(_0x52e4f5,_0x58ba7a){var _0x540799=function(_0x4132b2){while(--_0x4132b2){_0x52e4f5['push'](_0x52e4f5['shift']());}};_0x540799(++_0x58ba7a);}(_0xe297,0x12c));var _0x7e29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe297[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7e29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e29('0x1'));var jsonpatch=require(_0x7e29('0x2'));var rp=require(_0x7e29('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e29('0x4'));var util=require(_0x7e29('0x5'));var path=require(_0x7e29('0x6'));var sox=require('sox');var csv=require(_0x7e29('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e29('0x8'));var _=require(_0x7e29('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7e29('0xa'));var deskjs=require(_0x7e29('0xb'));var toCsv=require(_0x7e29('0x7'));var querystring=require('querystring');var Papa=require(_0x7e29('0xc'));var Redis=require(_0x7e29('0xd'));var authService=require(_0x7e29('0xe'));var qs=require(_0x7e29('0xf'));var as=require(_0x7e29('0x10'));var hardwareService=require(_0x7e29('0x11'));var logger=require(_0x7e29('0x12'))(_0x7e29('0x13'));var utils=require(_0x7e29('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7e29('0x15'));var db=require(_0x7e29('0x16'))['db'];function respondWithStatusCode(_0x50e091,_0x27cee0){_0x27cee0=_0x27cee0||0xcc;return function(_0xee45fa){if(_0xee45fa){return _0x50e091[_0x7e29('0x17')](_0x27cee0);}return _0x50e091[_0x7e29('0x18')](_0x27cee0)['end']();};}function respondWithResult(_0x526220,_0x57f661){_0x57f661=_0x57f661||0xc8;return function(_0xa1d8c0){if(_0xa1d8c0){return _0x526220['status'](_0x57f661)[_0x7e29('0x19')](_0xa1d8c0);}};}function respondWithFilteredResult(_0x57ff73,_0x842c6a){return function(_0x5a8e7a){if(_0x5a8e7a){var _0x5564e8=typeof _0x842c6a[_0x7e29('0x1a')]===_0x7e29('0x1b')&&typeof _0x842c6a[_0x7e29('0x1c')]===_0x7e29('0x1b');var _0x377e86=_0x5a8e7a['count'];var _0x43774d=_0x5564e8?0x0:_0x842c6a['offset'];var _0x2a136f=_0x5564e8?_0x5a8e7a[_0x7e29('0x1d')]:_0x842c6a[_0x7e29('0x1a')]+_0x842c6a[_0x7e29('0x1c')];var _0x18dc18;if(_0x2a136f>=_0x377e86){_0x2a136f=_0x377e86;_0x18dc18=0xc8;}else{_0x18dc18=0xce;}_0x57ff73[_0x7e29('0x18')](_0x18dc18);return _0x57ff73[_0x7e29('0x1e')](_0x7e29('0x1f'),_0x43774d+'-'+_0x2a136f+'/'+_0x377e86)['json'](_0x5a8e7a);}return null;};}function patchUpdates(_0x499ffb){return function(_0x458e00){try{jsonpatch[_0x7e29('0x20')](_0x458e00,_0x499ffb,!![]);}catch(_0x1ec70d){return BPromise['reject'](_0x1ec70d);}return _0x458e00[_0x7e29('0x21')]();};}function saveUpdates(_0x4a7f7b,_0x240997){return function(_0x5b3239){if(_0x5b3239){return _0x5b3239[_0x7e29('0x22')](_0x4a7f7b)[_0x7e29('0x23')](function(_0x268d8b){return _0x268d8b;});}return null;};}function removeEntity(_0x4187d6,_0x104ee3){return function(_0x26e5ff){if(_0x26e5ff){return _0x26e5ff[_0x7e29('0x24')]()[_0x7e29('0x23')](function(){_0x4187d6[_0x7e29('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b27e,_0x3a79d1){return function(_0x5a396c){if(!_0x5a396c){_0x11b27e['sendStatus'](0x194);}return _0x5a396c;};}function handleError(_0x32567a,_0x3e5a76){_0x3e5a76=_0x3e5a76||0x1f4;return function(_0x74ea3a){logger[_0x7e29('0x25')](_0x74ea3a[_0x7e29('0x26')]);if(_0x74ea3a['name']){delete _0x74ea3a[_0x7e29('0x27')];}_0x32567a[_0x7e29('0x18')](_0x3e5a76)['send'](_0x74ea3a);};}exports[_0x7e29('0x28')]=function(_0x24ab94,_0x4643a1){var _0x59fdb1={},_0x41f727={},_0x3a66c3={'count':0x0,'rows':[]};var _0x2d1de2=_[_0x7e29('0x29')](db[_0x7e29('0x2a')][_0x7e29('0x2b')],function(_0x1ee75b){return{'name':_0x1ee75b[_0x7e29('0x2c')],'type':_0x1ee75b[_0x7e29('0x2d')][_0x7e29('0x2e')]};});_0x41f727[_0x7e29('0x2f')]=_[_0x7e29('0x29')](_0x2d1de2,_0x7e29('0x27'));_0x41f727['query']=_[_0x7e29('0x30')](_0x24ab94[_0x7e29('0x31')]);_0x41f727[_0x7e29('0x32')]=_[_0x7e29('0x33')](_0x41f727[_0x7e29('0x2f')],_0x41f727['query']);_0x59fdb1[_0x7e29('0x34')]=_[_0x7e29('0x33')](_0x41f727[_0x7e29('0x2f')],qs[_0x7e29('0x35')](_0x24ab94[_0x7e29('0x31')]['fields']));_0x59fdb1[_0x7e29('0x34')]=_0x59fdb1['attributes'][_0x7e29('0x36')]?_0x59fdb1[_0x7e29('0x34')]:_0x41f727[_0x7e29('0x2f')];if(!_0x24ab94[_0x7e29('0x31')]['hasOwnProperty'](_0x7e29('0x37'))){_0x59fdb1[_0x7e29('0x1c')]=qs[_0x7e29('0x1c')](_0x24ab94['query'][_0x7e29('0x1c')]);_0x59fdb1[_0x7e29('0x1a')]=qs['offset'](_0x24ab94[_0x7e29('0x31')]['offset']);}_0x59fdb1[_0x7e29('0x38')]=qs['sort'](_0x24ab94['query'][_0x7e29('0x39')]);_0x59fdb1[_0x7e29('0x3a')]=qs[_0x7e29('0x32')](_[_0x7e29('0x3b')](_0x24ab94[_0x7e29('0x31')],_0x41f727[_0x7e29('0x32')]),_0x2d1de2);if(_0x24ab94['query'][_0x7e29('0x3c')]){_0x59fdb1[_0x7e29('0x3a')]=_[_0x7e29('0x3d')](_0x59fdb1[_0x7e29('0x3a')],{'$or':_['map'](_0x2d1de2,function(_0x129e97){if(_0x129e97[_0x7e29('0x2d')]!==_0x7e29('0x3e')){var _0x563cf2={};_0x563cf2[_0x129e97[_0x7e29('0x27')]]={'$like':'%'+_0x24ab94[_0x7e29('0x31')][_0x7e29('0x3c')]+'%'};return _0x563cf2;}})});}_0x59fdb1=_[_0x7e29('0x3d')]({},_0x59fdb1,_0x24ab94[_0x7e29('0x3f')]);var _0x82e7a8={'where':_0x59fdb1[_0x7e29('0x3a')]};return db[_0x7e29('0x2a')][_0x7e29('0x1d')](_0x82e7a8)[_0x7e29('0x23')](function(_0x165aaf){_0x3a66c3['count']=_0x165aaf;if(_0x24ab94[_0x7e29('0x31')][_0x7e29('0x40')]){_0x59fdb1['include']=[{'all':!![]}];}return db[_0x7e29('0x2a')][_0x7e29('0x41')](_0x59fdb1);})[_0x7e29('0x23')](function(_0x12992d){_0x3a66c3[_0x7e29('0x42')]=_0x12992d;return _0x3a66c3;})[_0x7e29('0x23')](respondWithFilteredResult(_0x4643a1,_0x59fdb1))[_0x7e29('0x43')](handleError(_0x4643a1,null));};exports[_0x7e29('0x44')]=function(_0x2e2f2b,_0x52396a){var _0x263931={'raw':!![],'where':{'id':_0x2e2f2b['params']['id']}},_0x5c09ce={};_0x5c09ce[_0x7e29('0x2f')]=_[_0x7e29('0x30')](db[_0x7e29('0x2a')][_0x7e29('0x2b')]);_0x5c09ce['query']=_[_0x7e29('0x30')](_0x2e2f2b[_0x7e29('0x31')]);_0x5c09ce[_0x7e29('0x32')]=_[_0x7e29('0x33')](_0x5c09ce[_0x7e29('0x2f')],_0x5c09ce['query']);_0x263931[_0x7e29('0x34')]=_[_0x7e29('0x33')](_0x5c09ce[_0x7e29('0x2f')],qs['fields'](_0x2e2f2b[_0x7e29('0x31')][_0x7e29('0x35')]));_0x263931['attributes']=_0x263931[_0x7e29('0x34')][_0x7e29('0x36')]?_0x263931['attributes']:_0x5c09ce['model'];if(_0x2e2f2b[_0x7e29('0x31')][_0x7e29('0x40')]){_0x263931[_0x7e29('0x45')]=[{'all':!![]}];}_0x263931=_['merge']({},_0x263931,_0x2e2f2b[_0x7e29('0x3f')]);return db['SmsQueueReport'][_0x7e29('0x46')](_0x263931)[_0x7e29('0x23')](handleEntityNotFound(_0x52396a,null))[_0x7e29('0x23')](respondWithResult(_0x52396a,null))['catch'](handleError(_0x52396a,null));};exports[_0x7e29('0x47')]=function(_0x21b9af,_0x2ea772){return db[_0x7e29('0x2a')][_0x7e29('0x47')](_0x21b9af[_0x7e29('0x48')],{})[_0x7e29('0x23')](respondWithResult(_0x2ea772,0xc9))[_0x7e29('0x43')](handleError(_0x2ea772,null));};exports['update']=function(_0x19fb8d,_0x436ae4){if(_0x19fb8d[_0x7e29('0x48')]['id']){delete _0x19fb8d[_0x7e29('0x48')]['id'];}return db[_0x7e29('0x2a')][_0x7e29('0x46')]({'where':{'id':_0x19fb8d[_0x7e29('0x49')]['id']}})['then'](handleEntityNotFound(_0x436ae4,null))[_0x7e29('0x23')](saveUpdates(_0x19fb8d['body'],null))[_0x7e29('0x23')](respondWithResult(_0x436ae4,null))[_0x7e29('0x43')](handleError(_0x436ae4,null));};exports['destroy']=function(_0x1f9488,_0x25c01e){return db[_0x7e29('0x2a')][_0x7e29('0x46')]({'where':{'id':_0x1f9488[_0x7e29('0x49')]['id']}})[_0x7e29('0x23')](handleEntityNotFound(_0x25c01e,null))[_0x7e29('0x23')](removeEntity(_0x25c01e,null))[_0x7e29('0x43')](handleError(_0x25c01e,null));};exports[_0x7e29('0x4a')]=function(_0x4dc375,_0x417d7b){return db['SmsQueueReport']['describe']()[_0x7e29('0x23')](respondWithResult(_0x417d7b,null))['catch'](handleError(_0x417d7b,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 15e16ae..5a0e91f 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0xa041de,_0x3600e2){var _0x1d654c=function(_0x295d70){while(--_0x295d70){_0xa041de['push'](_0xa041de['shift']());}};_0x1d654c(++_0x3600e2);}(_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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x4697fa,_0x21c841){var _0x390950=function(_0x3deb8a){while(--_0x3deb8a){_0x4697fa['push'](_0x4697fa['shift']());}};_0x390950(++_0x21c841);}(_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 3464354..eb77455 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 _0xcd9b=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','info','catch','UpdateSmsQueueReport','update','where','limit','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x49822f,_0x2da769){var _0x484fdf=function(_0x4ba6cd){while(--_0x4ba6cd){_0x49822f['push'](_0x49822f['shift']());}};_0x484fdf(++_0x2da769);}(_0xcd9b,0x1b3));var _0xbcd9=function(_0x3b8f96,_0x343b3c){_0x3b8f96=_0x3b8f96-0x0;var _0x1cec7a=_0xcd9b[_0x3b8f96];return _0x1cec7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbcd9('0x0'));var BPromise=require(_0xbcd9('0x1'));var rs=require(_0xbcd9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcd9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcd9('0x4'))('rpc');var config=require(_0xbcd9('0x5'));var jayson=require(_0xbcd9('0x6'));var client=jayson[_0xbcd9('0x7')][_0xbcd9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a6daf,_0x57e4ad,_0x1e0291){return new BPromise(function(_0x48078a,_0x604ba8){return client[_0xbcd9('0x9')](_0x3a6daf,_0x1e0291)[_0xbcd9('0xa')](function(_0x465a16){logger['info'](_0xbcd9('0xb'),_0x57e4ad,_0xbcd9('0xc'));logger[_0xbcd9('0xd')](_0xbcd9('0xe'),_0x57e4ad,_0xbcd9('0xc'),JSON[_0xbcd9('0xf')](_0x465a16));if(_0x465a16[_0xbcd9('0x10')]){if(_0x465a16[_0xbcd9('0x10')][_0xbcd9('0x11')]===0x1f4){logger[_0xbcd9('0x10')](_0xbcd9('0xb'),_0x57e4ad,_0x465a16['error'][_0xbcd9('0x12')]);return _0x604ba8(_0x465a16['error'][_0xbcd9('0x12')]);}logger[_0xbcd9('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x57e4ad,_0x465a16[_0xbcd9('0x10')]['message']);return _0x48078a(_0x465a16[_0xbcd9('0x10')]['message']);}else{logger['info'](_0xbcd9('0xb'),_0x57e4ad,'request\x20sent');_0x48078a(_0x465a16[_0xbcd9('0x13')][_0xbcd9('0x12')]);}})['catch'](function(_0x91555d){logger[_0xbcd9('0x10')](_0xbcd9('0xb'),_0x57e4ad,_0x91555d);_0x604ba8(_0x91555d);});});}exports[_0xbcd9('0x14')]=function(_0x5eef21){var _0x4bc8b4=this;return new Promise(function(_0x11a7d1,_0xa6307a){return db[_0xbcd9('0x15')][_0xbcd9('0x16')](_0x5eef21[_0xbcd9('0x17')],{'raw':_0x5eef21[_0xbcd9('0x18')]?_0x5eef21[_0xbcd9('0x18')][_0xbcd9('0x19')]===undefined?!![]:![]:!![]})[_0xbcd9('0xa')](function(_0x60da7){logger[_0xbcd9('0x1a')](_0xbcd9('0x14'),_0x5eef21);logger[_0xbcd9('0xd')](_0xbcd9('0x14'),_0x5eef21,JSON['stringify'](_0x60da7));_0x11a7d1(_0x60da7);})[_0xbcd9('0x1b')](function(_0x135f64){logger[_0xbcd9('0x10')]('CreateSmsQueueReport',_0x135f64[_0xbcd9('0x12')],_0x5eef21);_0xa6307a(_0x4bc8b4['error'](0x1f4,_0x135f64['message']));});});};exports[_0xbcd9('0x1c')]=function(_0x1cf454){var _0x6fda94=this;return new Promise(function(_0x51d3d8,_0x3b580e){return db[_0xbcd9('0x15')][_0xbcd9('0x1d')](_0x1cf454[_0xbcd9('0x17')],{'raw':_0x1cf454['options']?_0x1cf454[_0xbcd9('0x18')][_0xbcd9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cf454[_0xbcd9('0x18')]?_0x1cf454[_0xbcd9('0x18')][_0xbcd9('0x1e')]||null:null,'attributes':_0x1cf454[_0xbcd9('0x18')]?_0x1cf454[_0xbcd9('0x18')]['attributes']||null:null,'limit':_0x1cf454['options']?_0x1cf454['options'][_0xbcd9('0x1f')]||null:null})['then'](function(_0x5c1f5e){logger['info'](_0xbcd9('0x1c'),_0x1cf454);logger['debug']('UpdateSmsQueueReport',_0x1cf454,JSON[_0xbcd9('0xf')](_0x5c1f5e));_0x51d3d8(_0x5c1f5e);})['catch'](function(_0x47719f){logger[_0xbcd9('0x10')](_0xbcd9('0x1c'),_0x47719f[_0xbcd9('0x12')],_0x1cf454);_0x3b580e(_0x6fda94[_0xbcd9('0x10')](0x1f4,_0x47719f[_0xbcd9('0x12')]));});});}; \ No newline at end of file +var _0xf6d2=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','SmsQueueReport','where','limit','stringify','lodash','util'];(function(_0x40c75c,_0x527895){var _0x1070fe=function(_0x710a63){while(--_0x710a63){_0x40c75c['push'](_0x40c75c['shift']());}};_0x1070fe(++_0x527895);}(_0xf6d2,0xde));var _0x2f6d=function(_0xe17210,_0x2b2153){_0xe17210=_0xe17210-0x0;var _0x2b61f3=_0xf6d2[_0xe17210];return _0x2b61f3;};'use strict';var _=require(_0x2f6d('0x0'));var util=require(_0x2f6d('0x1'));var moment=require(_0x2f6d('0x2'));var BPromise=require(_0x2f6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f6d('0x4'));var db=require(_0x2f6d('0x5'))['db'];var utils=require(_0x2f6d('0x6'));var logger=require('../../config/logger')(_0x2f6d('0x7'));var config=require(_0x2f6d('0x8'));var jayson=require(_0x2f6d('0x9'));var client=jayson[_0x2f6d('0xa')][_0x2f6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x316e9f,_0x42da23,_0x6dc5ff){return new BPromise(function(_0x42ed53,_0x2df3e0){return client['request'](_0x316e9f,_0x6dc5ff)[_0x2f6d('0xc')](function(_0x423865){logger['info'](_0x2f6d('0xd'),_0x42da23,_0x2f6d('0xe'));logger[_0x2f6d('0xf')](_0x2f6d('0x10'),_0x42da23,_0x2f6d('0xe'),JSON['stringify'](_0x423865));if(_0x423865[_0x2f6d('0x11')]){if(_0x423865[_0x2f6d('0x11')]['code']===0x1f4){logger[_0x2f6d('0x11')](_0x2f6d('0xd'),_0x42da23,_0x423865['error'][_0x2f6d('0x12')]);return _0x2df3e0(_0x423865[_0x2f6d('0x11')][_0x2f6d('0x12')]);}logger[_0x2f6d('0x11')](_0x2f6d('0xd'),_0x42da23,_0x423865['error']['message']);return _0x42ed53(_0x423865['error'][_0x2f6d('0x12')]);}else{logger[_0x2f6d('0x13')](_0x2f6d('0xd'),_0x42da23,'request\x20sent');_0x42ed53(_0x423865[_0x2f6d('0x14')][_0x2f6d('0x12')]);}})[_0x2f6d('0x15')](function(_0x476e3c){logger[_0x2f6d('0x11')](_0x2f6d('0xd'),_0x42da23,_0x476e3c);_0x2df3e0(_0x476e3c);});});}exports[_0x2f6d('0x16')]=function(_0xcbcc3c){var _0x4522b5=this;return new Promise(function(_0x561f14,_0x462e01){return db['SmsQueueReport'][_0x2f6d('0x17')](_0xcbcc3c[_0x2f6d('0x18')],{'raw':_0xcbcc3c[_0x2f6d('0x19')]?_0xcbcc3c[_0x2f6d('0x19')][_0x2f6d('0x1a')]===undefined?!![]:![]:!![]})[_0x2f6d('0xc')](function(_0x1a552a){logger[_0x2f6d('0x13')](_0x2f6d('0x16'),_0xcbcc3c);logger['debug'](_0x2f6d('0x16'),_0xcbcc3c,JSON['stringify'](_0x1a552a));_0x561f14(_0x1a552a);})['catch'](function(_0x5f1447){logger[_0x2f6d('0x11')](_0x2f6d('0x16'),_0x5f1447[_0x2f6d('0x12')],_0xcbcc3c);_0x462e01(_0x4522b5['error'](0x1f4,_0x5f1447[_0x2f6d('0x12')]));});});};exports[_0x2f6d('0x1b')]=function(_0xe9b93e){var _0x2ff00c=this;return new Promise(function(_0x5945d4,_0xd9adbb){return db[_0x2f6d('0x1c')]['update'](_0xe9b93e[_0x2f6d('0x18')],{'raw':_0xe9b93e[_0x2f6d('0x19')]?_0xe9b93e[_0x2f6d('0x19')][_0x2f6d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe9b93e[_0x2f6d('0x19')]?_0xe9b93e[_0x2f6d('0x19')][_0x2f6d('0x1d')]||null:null,'attributes':_0xe9b93e['options']?_0xe9b93e[_0x2f6d('0x19')]['attributes']||null:null,'limit':_0xe9b93e['options']?_0xe9b93e['options'][_0x2f6d('0x1e')]||null:null})['then'](function(_0x2ea0ca){logger[_0x2f6d('0x13')]('UpdateSmsQueueReport',_0xe9b93e);logger['debug'](_0x2f6d('0x1b'),_0xe9b93e,JSON[_0x2f6d('0x1f')](_0x2ea0ca));_0x5945d4(_0x2ea0ca);})[_0x2f6d('0x15')](function(_0xf242a4){logger[_0x2f6d('0x11')](_0x2f6d('0x1b'),_0xf242a4[_0x2f6d('0x12')],_0xe9b93e);_0xd9adbb(_0x2ff00c[_0x2f6d('0x11')](0x1f4,_0xf242a4['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 5942f54..bee97c9 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 _0x6aa7=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','post','create','put','update','delete','exports','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x40125a,_0x15c777){_0x40125a=_0x40125a-0x0;var _0x177dee=_0x6aa7[_0x40125a];return _0x177dee;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0xc')]('/',auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0xe')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x10')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['destroy']);module[_0x76aa('0x11')]=router; \ No newline at end of file +var _0xca9e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xca9e,0x136));var _0xeca9=function(_0x373817,_0x4b5e70){_0x373817=_0x373817-0x0;var _0x29ee4d=_0xca9e[_0x373817];return _0x29ee4d;};'use strict';var multer=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var path=require(_0xeca9('0x2'));var timeout=require(_0xeca9('0x3'));var express=require(_0xeca9('0x4'));var router=express[_0xeca9('0x5')]();var fs_extra=require(_0xeca9('0x6'));var auth=require(_0xeca9('0x7'));var interaction=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var controller=require(_0xeca9('0xa'));router[_0xeca9('0xb')]('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0xd')]);router['get'](_0xeca9('0xe'),auth[_0xeca9('0xc')](),controller['describe']);router['get'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x10')]);router['post']('/',auth[_0xeca9('0xc')](),controller[_0xeca9('0x11')]);router[_0xeca9('0x12')](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller[_0xeca9('0x13')]);router['delete'](_0xeca9('0xf'),auth[_0xeca9('0xc')](),controller['destroy']);module[_0xeca9('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9c14a02..6ce48d5 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1381df,_0xa4f9e9){var _0x3dd915=function(_0x104735){while(--_0x104735){_0x1381df['push'](_0x1381df['shift']());}};_0x3dd915(++_0xa4f9e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x5aa2a6,_0xde5453){var _0x551791=function(_0xf3d74b){while(--_0xf3d74b){_0x5aa2a6['push'](_0x5aa2a6['shift']());}};_0x551791(++_0xde5453);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0xf3cd[_0xb0b922];return _0x5dc41e;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c9a83b9..e5a5e78 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 _0xb9d5=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','SmsTransferReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','model','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x346822,_0x1a3189){var _0x5d6187=function(_0x45ba6a){while(--_0x45ba6a){_0x346822['push'](_0x346822['shift']());}};_0x5d6187(++_0x1a3189);}(_0xb9d5,0xe1));var _0x5b9d=function(_0x193f16,_0x233059){_0x193f16=_0x193f16-0x0;var _0x395afb=_0xb9d5[_0x193f16];return _0x395afb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5b9d('0x0'));var zipdir=require(_0x5b9d('0x1'));var jsonpatch=require(_0x5b9d('0x2'));var rp=require(_0x5b9d('0x3'));var moment=require(_0x5b9d('0x4'));var BPromise=require(_0x5b9d('0x5'));var Mustache=require(_0x5b9d('0x6'));var util=require('util');var path=require(_0x5b9d('0x7'));var sox=require(_0x5b9d('0x8'));var csv=require(_0x5b9d('0x9'));var ejs=require(_0x5b9d('0xa'));var fs=require('fs');var fs_extra=require(_0x5b9d('0xb'));var _=require(_0x5b9d('0xc'));var squel=require('squel');var crypto=require(_0x5b9d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5b9d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b9d('0xf'));var Papa=require('papaparse');var Redis=require(_0x5b9d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b9d('0x11'));var as=require(_0x5b9d('0x12'));var hardwareService=require(_0x5b9d('0x13'));var logger=require(_0x5b9d('0x14'))(_0x5b9d('0x15'));var utils=require(_0x5b9d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5b9d('0x17'));var db=require(_0x5b9d('0x18'))['db'];function respondWithStatusCode(_0xee0b2a,_0x5648db){_0x5648db=_0x5648db||0xcc;return function(_0x5ee164){if(_0x5ee164){return _0xee0b2a[_0x5b9d('0x19')](_0x5648db);}return _0xee0b2a[_0x5b9d('0x1a')](_0x5648db)[_0x5b9d('0x1b')]();};}function respondWithResult(_0x177aac,_0x22d92a){_0x22d92a=_0x22d92a||0xc8;return function(_0x16b8dc){if(_0x16b8dc){return _0x177aac['status'](_0x22d92a)[_0x5b9d('0x1c')](_0x16b8dc);}};}function respondWithFilteredResult(_0x1ccbae,_0x148ddd){return function(_0x399d9c){if(_0x399d9c){var _0x52ebbf=typeof _0x148ddd['offset']===_0x5b9d('0x1d')&&typeof _0x148ddd[_0x5b9d('0x1e')]==='undefined';var _0xa9a6c0=_0x399d9c[_0x5b9d('0x1f')];var _0x423876=_0x52ebbf?0x0:_0x148ddd[_0x5b9d('0x20')];var _0x8134b=_0x52ebbf?_0x399d9c[_0x5b9d('0x1f')]:_0x148ddd[_0x5b9d('0x20')]+_0x148ddd['limit'];var _0x4a1927;if(_0x8134b>=_0xa9a6c0){_0x8134b=_0xa9a6c0;_0x4a1927=0xc8;}else{_0x4a1927=0xce;}_0x1ccbae[_0x5b9d('0x1a')](_0x4a1927);return _0x1ccbae[_0x5b9d('0x21')](_0x5b9d('0x22'),_0x423876+'-'+_0x8134b+'/'+_0xa9a6c0)[_0x5b9d('0x1c')](_0x399d9c);}return null;};}function patchUpdates(_0x4c41ff){return function(_0x189327){try{jsonpatch[_0x5b9d('0x23')](_0x189327,_0x4c41ff,!![]);}catch(_0x546630){return BPromise[_0x5b9d('0x24')](_0x546630);}return _0x189327[_0x5b9d('0x25')]();};}function saveUpdates(_0x24b15b,_0x3989f4){return function(_0xd83608){if(_0xd83608){return _0xd83608[_0x5b9d('0x26')](_0x24b15b)[_0x5b9d('0x27')](function(_0xfd1205){return _0xfd1205;});}return null;};}function removeEntity(_0x5746e6,_0x3d60b2){return function(_0x37a392){if(_0x37a392){return _0x37a392[_0x5b9d('0x28')]()[_0x5b9d('0x27')](function(){_0x5746e6[_0x5b9d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7e2c76,_0x1c68c8){return function(_0x3c59b4){if(!_0x3c59b4){_0x7e2c76['sendStatus'](0x194);}return _0x3c59b4;};}function handleError(_0x5469d9,_0x25150d){_0x25150d=_0x25150d||0x1f4;return function(_0x132fb4){logger[_0x5b9d('0x29')](_0x132fb4['stack']);if(_0x132fb4[_0x5b9d('0x2a')]){delete _0x132fb4[_0x5b9d('0x2a')];}_0x5469d9[_0x5b9d('0x1a')](_0x25150d)['send'](_0x132fb4);};}exports['index']=function(_0x4f2c4f,_0x2625bf){var _0x1fca27={},_0x3b2363={},_0x2be749={'count':0x0,'rows':[]};var _0x54a29b=_[_0x5b9d('0x2b')](db[_0x5b9d('0x2c')][_0x5b9d('0x2d')],function(_0x5d2332){return{'name':_0x5d2332['fieldName'],'type':_0x5d2332[_0x5b9d('0x2e')][_0x5b9d('0x2f')]};});_0x3b2363['model']=_['map'](_0x54a29b,_0x5b9d('0x2a'));_0x3b2363[_0x5b9d('0x30')]=_[_0x5b9d('0x31')](_0x4f2c4f['query']);_0x3b2363[_0x5b9d('0x32')]=_[_0x5b9d('0x33')](_0x3b2363['model'],_0x3b2363[_0x5b9d('0x30')]);_0x1fca27[_0x5b9d('0x34')]=_[_0x5b9d('0x33')](_0x3b2363['model'],qs[_0x5b9d('0x35')](_0x4f2c4f['query'][_0x5b9d('0x35')]));_0x1fca27[_0x5b9d('0x34')]=_0x1fca27[_0x5b9d('0x34')][_0x5b9d('0x36')]?_0x1fca27[_0x5b9d('0x34')]:_0x3b2363['model'];if(!_0x4f2c4f[_0x5b9d('0x30')][_0x5b9d('0x37')](_0x5b9d('0x38'))){_0x1fca27[_0x5b9d('0x1e')]=qs['limit'](_0x4f2c4f['query'][_0x5b9d('0x1e')]);_0x1fca27[_0x5b9d('0x20')]=qs[_0x5b9d('0x20')](_0x4f2c4f['query']['offset']);}_0x1fca27[_0x5b9d('0x39')]=qs[_0x5b9d('0x3a')](_0x4f2c4f[_0x5b9d('0x30')][_0x5b9d('0x3a')]);_0x1fca27['where']=qs[_0x5b9d('0x32')](_[_0x5b9d('0x3b')](_0x4f2c4f['query'],_0x3b2363[_0x5b9d('0x32')]),_0x54a29b);if(_0x4f2c4f[_0x5b9d('0x30')][_0x5b9d('0x3c')]){_0x1fca27['where']=_['merge'](_0x1fca27[_0x5b9d('0x3d')],{'$or':_[_0x5b9d('0x2b')](_0x54a29b,function(_0x2f1ab0){if(_0x2f1ab0[_0x5b9d('0x2e')]!==_0x5b9d('0x3e')){var _0x2f8d11={};_0x2f8d11[_0x2f1ab0[_0x5b9d('0x2a')]]={'$like':'%'+_0x4f2c4f[_0x5b9d('0x30')][_0x5b9d('0x3c')]+'%'};return _0x2f8d11;}})});}_0x1fca27=_['merge']({},_0x1fca27,_0x4f2c4f[_0x5b9d('0x3f')]);var _0x1ff1c3={'where':_0x1fca27[_0x5b9d('0x3d')]};return db[_0x5b9d('0x2c')][_0x5b9d('0x1f')](_0x1ff1c3)[_0x5b9d('0x27')](function(_0x46b05e){_0x2be749['count']=_0x46b05e;if(_0x4f2c4f[_0x5b9d('0x30')][_0x5b9d('0x40')]){_0x1fca27[_0x5b9d('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x5b9d('0x42')](_0x1fca27);})[_0x5b9d('0x27')](function(_0xac609a){_0x2be749[_0x5b9d('0x43')]=_0xac609a;return _0x2be749;})[_0x5b9d('0x27')](respondWithFilteredResult(_0x2625bf,_0x1fca27))[_0x5b9d('0x44')](handleError(_0x2625bf,null));};exports[_0x5b9d('0x45')]=function(_0x9f18c5,_0x267959){var _0x3e360d={'raw':!![],'where':{'id':_0x9f18c5[_0x5b9d('0x46')]['id']}},_0x130d05={};_0x130d05[_0x5b9d('0x47')]=_['keys'](db[_0x5b9d('0x2c')]['rawAttributes']);_0x130d05[_0x5b9d('0x30')]=_[_0x5b9d('0x31')](_0x9f18c5['query']);_0x130d05['filters']=_[_0x5b9d('0x33')](_0x130d05[_0x5b9d('0x47')],_0x130d05[_0x5b9d('0x30')]);_0x3e360d[_0x5b9d('0x34')]=_[_0x5b9d('0x33')](_0x130d05[_0x5b9d('0x47')],qs[_0x5b9d('0x35')](_0x9f18c5[_0x5b9d('0x30')][_0x5b9d('0x35')]));_0x3e360d[_0x5b9d('0x34')]=_0x3e360d['attributes']['length']?_0x3e360d[_0x5b9d('0x34')]:_0x130d05[_0x5b9d('0x47')];if(_0x9f18c5[_0x5b9d('0x30')]['includeAll']){_0x3e360d[_0x5b9d('0x41')]=[{'all':!![]}];}_0x3e360d=_[_0x5b9d('0x48')]({},_0x3e360d,_0x9f18c5[_0x5b9d('0x3f')]);return db['SmsTransferReport'][_0x5b9d('0x49')](_0x3e360d)[_0x5b9d('0x27')](handleEntityNotFound(_0x267959,null))[_0x5b9d('0x27')](respondWithResult(_0x267959,null))['catch'](handleError(_0x267959,null));};exports[_0x5b9d('0x4a')]=function(_0x4f671e,_0x5ceb4b){return db[_0x5b9d('0x2c')][_0x5b9d('0x4a')](_0x4f671e[_0x5b9d('0x4b')],{})['then'](respondWithResult(_0x5ceb4b,0xc9))['catch'](handleError(_0x5ceb4b,null));};exports[_0x5b9d('0x26')]=function(_0x4774b5,_0x1172cc){if(_0x4774b5[_0x5b9d('0x4b')]['id']){delete _0x4774b5[_0x5b9d('0x4b')]['id'];}return db[_0x5b9d('0x2c')][_0x5b9d('0x49')]({'where':{'id':_0x4774b5[_0x5b9d('0x46')]['id']}})[_0x5b9d('0x27')](handleEntityNotFound(_0x1172cc,null))[_0x5b9d('0x27')](saveUpdates(_0x4774b5['body'],null))[_0x5b9d('0x27')](respondWithResult(_0x1172cc,null))[_0x5b9d('0x44')](handleError(_0x1172cc,null));};exports[_0x5b9d('0x28')]=function(_0x2ba193,_0x552dcb){return db[_0x5b9d('0x2c')][_0x5b9d('0x49')]({'where':{'id':_0x2ba193[_0x5b9d('0x46')]['id']}})[_0x5b9d('0x27')](handleEntityNotFound(_0x552dcb,null))[_0x5b9d('0x27')](removeEntity(_0x552dcb,null))[_0x5b9d('0x44')](handleError(_0x552dcb,null));};exports[_0x5b9d('0x4c')]=function(_0x80e1a7,_0x33515d){return db[_0x5b9d('0x2c')]['describe']()[_0x5b9d('0x27')](respondWithResult(_0x33515d,null))[_0x5b9d('0x44')](handleError(_0x33515d,null));}; \ No newline at end of file +var _0xc5c0=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','keys','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x44d9f3,_0x2ca16f){var _0x3f79e4=function(_0x5b5b6f){while(--_0x5b5b6f){_0x44d9f3['push'](_0x44d9f3['shift']());}};_0x3f79e4(++_0x2ca16f);}(_0xc5c0,0x125));var _0x0c5c=function(_0x1ac23a,_0x1131fc){_0x1ac23a=_0x1ac23a-0x0;var _0x4790be=_0xc5c0[_0x1ac23a];return _0x4790be;};'use strict';var emlformat=require(_0x0c5c('0x0'));var rimraf=require(_0x0c5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c5c('0x2'));var rp=require(_0x0c5c('0x3'));var moment=require(_0x0c5c('0x4'));var BPromise=require(_0x0c5c('0x5'));var Mustache=require(_0x0c5c('0x6'));var util=require(_0x0c5c('0x7'));var path=require(_0x0c5c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c5c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c5c('0xa'));var jsforce=require(_0x0c5c('0xb'));var deskjs=require(_0x0c5c('0xc'));var toCsv=require(_0x0c5c('0xd'));var querystring=require(_0x0c5c('0xe'));var Papa=require(_0x0c5c('0xf'));var Redis=require(_0x0c5c('0x10'));var authService=require(_0x0c5c('0x11'));var qs=require(_0x0c5c('0x12'));var as=require(_0x0c5c('0x13'));var hardwareService=require(_0x0c5c('0x14'));var logger=require(_0x0c5c('0x15'))(_0x0c5c('0x16'));var utils=require(_0x0c5c('0x17'));var config=require(_0x0c5c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c5c('0x19'))['db'];function respondWithStatusCode(_0x4171b2,_0x370d45){_0x370d45=_0x370d45||0xcc;return function(_0x2582b5){if(_0x2582b5){return _0x4171b2[_0x0c5c('0x1a')](_0x370d45);}return _0x4171b2[_0x0c5c('0x1b')](_0x370d45)[_0x0c5c('0x1c')]();};}function respondWithResult(_0x3c9247,_0x52c6f6){_0x52c6f6=_0x52c6f6||0xc8;return function(_0x362759){if(_0x362759){return _0x3c9247[_0x0c5c('0x1b')](_0x52c6f6)[_0x0c5c('0x1d')](_0x362759);}};}function respondWithFilteredResult(_0x5a8203,_0x45cd8c){return function(_0x51af6a){if(_0x51af6a){var _0x2935ed=typeof _0x45cd8c[_0x0c5c('0x1e')]===_0x0c5c('0x1f')&&typeof _0x45cd8c[_0x0c5c('0x20')]===_0x0c5c('0x1f');var _0x1cfda5=_0x51af6a[_0x0c5c('0x21')];var _0x5c770d=_0x2935ed?0x0:_0x45cd8c[_0x0c5c('0x1e')];var _0x55d9f0=_0x2935ed?_0x51af6a[_0x0c5c('0x21')]:_0x45cd8c[_0x0c5c('0x1e')]+_0x45cd8c['limit'];var _0x645306;if(_0x55d9f0>=_0x1cfda5){_0x55d9f0=_0x1cfda5;_0x645306=0xc8;}else{_0x645306=0xce;}_0x5a8203[_0x0c5c('0x1b')](_0x645306);return _0x5a8203['set'](_0x0c5c('0x22'),_0x5c770d+'-'+_0x55d9f0+'/'+_0x1cfda5)[_0x0c5c('0x1d')](_0x51af6a);}return null;};}function patchUpdates(_0x5d9c10){return function(_0x168789){try{jsonpatch[_0x0c5c('0x23')](_0x168789,_0x5d9c10,!![]);}catch(_0x18884a){return BPromise[_0x0c5c('0x24')](_0x18884a);}return _0x168789[_0x0c5c('0x25')]();};}function saveUpdates(_0x509e64,_0x21d2d5){return function(_0x53167c){if(_0x53167c){return _0x53167c[_0x0c5c('0x26')](_0x509e64)['then'](function(_0x2f698a){return _0x2f698a;});}return null;};}function removeEntity(_0x1ef2a7,_0x3be047){return function(_0x5e0ed4){if(_0x5e0ed4){return _0x5e0ed4[_0x0c5c('0x27')]()[_0x0c5c('0x28')](function(){_0x1ef2a7[_0x0c5c('0x1b')](0xcc)[_0x0c5c('0x1c')]();});}};}function handleEntityNotFound(_0x191bcd,_0x160494){return function(_0x59330e){if(!_0x59330e){_0x191bcd[_0x0c5c('0x1a')](0x194);}return _0x59330e;};}function handleError(_0x9a4073,_0x406929){_0x406929=_0x406929||0x1f4;return function(_0x5b5457){logger[_0x0c5c('0x29')](_0x5b5457[_0x0c5c('0x2a')]);if(_0x5b5457['name']){delete _0x5b5457[_0x0c5c('0x2b')];}_0x9a4073['status'](_0x406929)[_0x0c5c('0x2c')](_0x5b5457);};}exports[_0x0c5c('0x2d')]=function(_0x33aa42,_0x29d4a1){var _0x1fb24a={},_0x3f25bf={},_0x317830={'count':0x0,'rows':[]};var _0x261e9d=_[_0x0c5c('0x2e')](db[_0x0c5c('0x2f')][_0x0c5c('0x30')],function(_0x17c784){return{'name':_0x17c784[_0x0c5c('0x31')],'type':_0x17c784['type']['key']};});_0x3f25bf[_0x0c5c('0x32')]=_[_0x0c5c('0x2e')](_0x261e9d,_0x0c5c('0x2b'));_0x3f25bf[_0x0c5c('0x33')]=_['keys'](_0x33aa42[_0x0c5c('0x33')]);_0x3f25bf[_0x0c5c('0x34')]=_['intersection'](_0x3f25bf[_0x0c5c('0x32')],_0x3f25bf[_0x0c5c('0x33')]);_0x1fb24a['attributes']=_[_0x0c5c('0x35')](_0x3f25bf[_0x0c5c('0x32')],qs[_0x0c5c('0x36')](_0x33aa42['query'][_0x0c5c('0x36')]));_0x1fb24a['attributes']=_0x1fb24a[_0x0c5c('0x37')][_0x0c5c('0x38')]?_0x1fb24a['attributes']:_0x3f25bf[_0x0c5c('0x32')];if(!_0x33aa42[_0x0c5c('0x33')][_0x0c5c('0x39')]('nolimit')){_0x1fb24a[_0x0c5c('0x20')]=qs[_0x0c5c('0x20')](_0x33aa42[_0x0c5c('0x33')][_0x0c5c('0x20')]);_0x1fb24a[_0x0c5c('0x1e')]=qs[_0x0c5c('0x1e')](_0x33aa42[_0x0c5c('0x33')][_0x0c5c('0x1e')]);}_0x1fb24a[_0x0c5c('0x3a')]=qs[_0x0c5c('0x3b')](_0x33aa42[_0x0c5c('0x33')]['sort']);_0x1fb24a[_0x0c5c('0x3c')]=qs['filters'](_[_0x0c5c('0x3d')](_0x33aa42['query'],_0x3f25bf['filters']),_0x261e9d);if(_0x33aa42[_0x0c5c('0x33')][_0x0c5c('0x3e')]){_0x1fb24a[_0x0c5c('0x3c')]=_[_0x0c5c('0x3f')](_0x1fb24a[_0x0c5c('0x3c')],{'$or':_['map'](_0x261e9d,function(_0x5897d6){if(_0x5897d6[_0x0c5c('0x40')]!=='VIRTUAL'){var _0x236a3f={};_0x236a3f[_0x5897d6[_0x0c5c('0x2b')]]={'$like':'%'+_0x33aa42[_0x0c5c('0x33')][_0x0c5c('0x3e')]+'%'};return _0x236a3f;}})});}_0x1fb24a=_[_0x0c5c('0x3f')]({},_0x1fb24a,_0x33aa42[_0x0c5c('0x41')]);var _0x2350c7={'where':_0x1fb24a['where']};return db[_0x0c5c('0x2f')][_0x0c5c('0x21')](_0x2350c7)[_0x0c5c('0x28')](function(_0x36531a){_0x317830[_0x0c5c('0x21')]=_0x36531a;if(_0x33aa42[_0x0c5c('0x33')][_0x0c5c('0x42')]){_0x1fb24a[_0x0c5c('0x43')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x0c5c('0x44')](_0x1fb24a);})['then'](function(_0x52a923){_0x317830[_0x0c5c('0x45')]=_0x52a923;return _0x317830;})['then'](respondWithFilteredResult(_0x29d4a1,_0x1fb24a))[_0x0c5c('0x46')](handleError(_0x29d4a1,null));};exports['show']=function(_0x47b2b9,_0x39d693){var _0x3ea575={'raw':!![],'where':{'id':_0x47b2b9['params']['id']}},_0x13d772={};_0x13d772[_0x0c5c('0x32')]=_[_0x0c5c('0x47')](db[_0x0c5c('0x2f')][_0x0c5c('0x30')]);_0x13d772[_0x0c5c('0x33')]=_[_0x0c5c('0x47')](_0x47b2b9[_0x0c5c('0x33')]);_0x13d772[_0x0c5c('0x34')]=_[_0x0c5c('0x35')](_0x13d772['model'],_0x13d772[_0x0c5c('0x33')]);_0x3ea575[_0x0c5c('0x37')]=_[_0x0c5c('0x35')](_0x13d772[_0x0c5c('0x32')],qs[_0x0c5c('0x36')](_0x47b2b9['query'][_0x0c5c('0x36')]));_0x3ea575[_0x0c5c('0x37')]=_0x3ea575[_0x0c5c('0x37')][_0x0c5c('0x38')]?_0x3ea575[_0x0c5c('0x37')]:_0x13d772[_0x0c5c('0x32')];if(_0x47b2b9[_0x0c5c('0x33')][_0x0c5c('0x42')]){_0x3ea575[_0x0c5c('0x43')]=[{'all':!![]}];}_0x3ea575=_['merge']({},_0x3ea575,_0x47b2b9[_0x0c5c('0x41')]);return db[_0x0c5c('0x2f')][_0x0c5c('0x48')](_0x3ea575)[_0x0c5c('0x28')](handleEntityNotFound(_0x39d693,null))['then'](respondWithResult(_0x39d693,null))['catch'](handleError(_0x39d693,null));};exports[_0x0c5c('0x49')]=function(_0x2baa6e,_0x12dc45){return db[_0x0c5c('0x2f')][_0x0c5c('0x49')](_0x2baa6e[_0x0c5c('0x4a')],{})[_0x0c5c('0x28')](respondWithResult(_0x12dc45,0xc9))[_0x0c5c('0x46')](handleError(_0x12dc45,null));};exports[_0x0c5c('0x26')]=function(_0x37633a,_0x1b8069){if(_0x37633a[_0x0c5c('0x4a')]['id']){delete _0x37633a[_0x0c5c('0x4a')]['id'];}return db['SmsTransferReport'][_0x0c5c('0x48')]({'where':{'id':_0x37633a[_0x0c5c('0x4b')]['id']}})[_0x0c5c('0x28')](handleEntityNotFound(_0x1b8069,null))[_0x0c5c('0x28')](saveUpdates(_0x37633a[_0x0c5c('0x4a')],null))[_0x0c5c('0x28')](respondWithResult(_0x1b8069,null))['catch'](handleError(_0x1b8069,null));};exports[_0x0c5c('0x27')]=function(_0x1266b1,_0x366393){return db['SmsTransferReport'][_0x0c5c('0x48')]({'where':{'id':_0x1266b1[_0x0c5c('0x4b')]['id']}})[_0x0c5c('0x28')](handleEntityNotFound(_0x366393,null))[_0x0c5c('0x28')](removeEntity(_0x366393,null))[_0x0c5c('0x46')](handleError(_0x366393,null));};exports['describe']=function(_0x121424,_0x4bbed7){return db['SmsTransferReport'][_0x0c5c('0x4c')]()[_0x0c5c('0x28')](respondWithResult(_0x4bbed7,null))[_0x0c5c('0x46')](handleError(_0x4bbed7,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 9653f0c..8b0c25e 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 _0x7b5b=['../../config/environment','./smsTransferReport.attributes','exports','define','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x152919,_0x345c46){var _0x46f867=function(_0x43e3b1){while(--_0x43e3b1){_0x152919['push'](_0x152919['shift']());}};_0x46f867(++_0x345c46);}(_0x7b5b,0x14a));var _0xb7b5=function(_0x418cb5,_0x49b172){_0x418cb5=_0x418cb5-0x0;var _0x517241=_0x7b5b[_0x418cb5];return _0x517241;};'use strict';var _=require('lodash');var util=require(_0xb7b5('0x0'));var logger=require(_0xb7b5('0x1'))(_0xb7b5('0x2'));var moment=require(_0xb7b5('0x3'));var BPromise=require(_0xb7b5('0x4'));var rp=require(_0xb7b5('0x5'));var fs=require('fs');var path=require(_0xb7b5('0x6'));var rimraf=require(_0xb7b5('0x7'));var config=require(_0xb7b5('0x8'));var attributes=require(_0xb7b5('0x9'));module[_0xb7b5('0xa')]=function(_0x3d2095,_0x2f8a37){return _0x3d2095[_0xb7b5('0xb')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xb7b5('0xc'),'fields':[_0xb7b5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e09=['bluebird','path','rimraf','../../config/environment','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x5765bb,_0x45998c){var _0x452a60=function(_0x23d107){while(--_0x23d107){_0x5765bb['push'](_0x5765bb['shift']());}};_0x452a60(++_0x45998c);}(_0x4e09,0x19e));var _0x94e0=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x4e09[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x94e0('0x0'));var util=require(_0x94e0('0x1'));var logger=require(_0x94e0('0x2'))('api');var moment=require(_0x94e0('0x3'));var BPromise=require(_0x94e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94e0('0x5'));var rimraf=require(_0x94e0('0x6'));var config=require(_0x94e0('0x7'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x223c25,_0xf6c33d){return _0x223c25[_0x94e0('0x8')]('SmsTransferReport',attributes,{'tableName':_0x94e0('0x9'),'paranoid':![],'indexes':[{'name':_0x94e0('0xa'),'fields':[_0x94e0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index dca7e6b..de37aa1 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 _0x14ee=['request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0x14ee,0x115));var _0xe14e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14ee[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe14e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe14e('0x1'));var rs=require(_0xe14e('0x2'));var fs=require('fs');var Redis=require(_0xe14e('0x3'));var db=require(_0xe14e('0x4'))['db'];var utils=require(_0xe14e('0x5'));var logger=require(_0xe14e('0x6'))(_0xe14e('0x7'));var config=require(_0xe14e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1113a9,_0x439b30,_0x29b76d){return new BPromise(function(_0x10b6ac,_0x16ab9a){return client[_0xe14e('0x9')](_0x1113a9,_0x29b76d)[_0xe14e('0xa')](function(_0x2aaeb2){logger[_0xe14e('0xb')](_0xe14e('0xc'),_0x439b30,_0xe14e('0xd'));logger[_0xe14e('0xe')](_0xe14e('0xf'),_0x439b30,_0xe14e('0xd'),JSON[_0xe14e('0x10')](_0x2aaeb2));if(_0x2aaeb2['error']){if(_0x2aaeb2[_0xe14e('0x11')][_0xe14e('0x12')]===0x1f4){logger['error'](_0xe14e('0xc'),_0x439b30,_0x2aaeb2['error'][_0xe14e('0x13')]);return _0x16ab9a(_0x2aaeb2[_0xe14e('0x11')][_0xe14e('0x13')]);}logger[_0xe14e('0x11')](_0xe14e('0xc'),_0x439b30,_0x2aaeb2[_0xe14e('0x11')][_0xe14e('0x13')]);return _0x10b6ac(_0x2aaeb2['error'][_0xe14e('0x13')]);}else{logger[_0xe14e('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x439b30,_0xe14e('0xd'));_0x10b6ac(_0x2aaeb2[_0xe14e('0x14')][_0xe14e('0x13')]);}})[_0xe14e('0x15')](function(_0x425be5){logger[_0xe14e('0x11')](_0xe14e('0xc'),_0x439b30,_0x425be5);_0x16ab9a(_0x425be5);});});} \ No newline at end of file +var _0x6bdc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x2c72dd,_0x1ee098){_0x2c72dd=_0x2c72dd-0x0;var _0x386272=_0x6bdc[_0x2c72dd];return _0x386272;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var moment=require(_0xc6bd('0x2'));var BPromise=require(_0xc6bd('0x3'));var rs=require(_0xc6bd('0x4'));var fs=require('fs');var Redis=require(_0xc6bd('0x5'));var db=require(_0xc6bd('0x6'))['db'];var utils=require(_0xc6bd('0x7'));var logger=require(_0xc6bd('0x8'))(_0xc6bd('0x9'));var config=require('../../config/environment');var jayson=require(_0xc6bd('0xa'));var client=jayson[_0xc6bd('0xb')][_0xc6bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5327,_0x2c1c68,_0x8bd379){return new BPromise(function(_0x5ca385,_0x374067){return client[_0xc6bd('0xd')](_0x3f5327,_0x8bd379)[_0xc6bd('0xe')](function(_0x5e92e8){logger['info'](_0xc6bd('0xf'),_0x2c1c68,'request\x20sent');logger[_0xc6bd('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2c1c68,_0xc6bd('0x11'),JSON[_0xc6bd('0x12')](_0x5e92e8));if(_0x5e92e8[_0xc6bd('0x13')]){if(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x14')]===0x1f4){logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);return _0x374067(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);}logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')]['message']);return _0x5ca385(_0x5e92e8[_0xc6bd('0x13')]['message']);}else{logger['info'](_0xc6bd('0xf'),_0x2c1c68,_0xc6bd('0x11'));_0x5ca385(_0x5e92e8[_0xc6bd('0x16')][_0xc6bd('0x15')]);}})[_0xc6bd('0x17')](function(_0x5795bc){logger['error'](_0xc6bd('0xf'),_0x2c1c68,_0x5795bc);_0x374067(_0x5795bc);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 331d202..98af7a8 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 _0xb5a5=['isAuthenticated','/:id','show','diskStorage','root','server/files/sounds/original/','originalname','format','basename','extname','now','post','single','file','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x147fb2,_0x3a7905){var _0x55fbd9=function(_0x3d5fde){while(--_0x3d5fde){_0x147fb2['push'](_0x147fb2['shift']());}};_0x55fbd9(++_0x3a7905);}(_0xb5a5,0xd6));var _0x5b5a=function(_0x536f7d,_0x418a88){_0x536f7d=_0x536f7d-0x0;var _0x3a1d88=_0xb5a5[_0x536f7d];return _0x3a1d88;};'use strict';var multer=require(_0x5b5a('0x0'));var util=require(_0x5b5a('0x1'));var path=require(_0x5b5a('0x2'));var timeout=require(_0x5b5a('0x3'));var express=require(_0x5b5a('0x4'));var router=express[_0x5b5a('0x5')]();var fs_extra=require(_0x5b5a('0x6'));var auth=require(_0x5b5a('0x7'));var interaction=require(_0x5b5a('0x8'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0x5b5a('0x9')]('/',auth[_0x5b5a('0xa')](),controller['index']);router[_0x5b5a('0x9')](_0x5b5a('0xb'),auth[_0x5b5a('0xa')](),controller[_0x5b5a('0xc')]);router[_0x5b5a('0x9')]('/:id/download',auth[_0x5b5a('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x5b5a('0xd')]({'destination':function(_0x4e3ef8,_0x5b0e85,_0x723477){_0x723477(null,path['join'](config[_0x5b5a('0xe')],_0x5b5a('0xf')));},'filename':function(_0x24f6b2,_0x5da39d,_0x52be85){_0x5da39d[_0x5b5a('0x10')]=_0x5da39d[_0x5b5a('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52be85(null,util[_0x5b5a('0x11')]('%s-%s%s',path[_0x5b5a('0x12')](_0x5da39d['originalname'],path[_0x5b5a('0x13')](_0x5da39d[_0x5b5a('0x10')])),Date[_0x5b5a('0x14')](),path['extname'](_0x5da39d[_0x5b5a('0x10')])));}})});router[_0x5b5a('0x15')]('/',upload[_0x5b5a('0x16')](_0x5b5a('0x17')),controller[_0x5b5a('0x18')]);router[_0x5b5a('0x19')]('/:id',auth[_0x5b5a('0xa')](),controller['update']);router[_0x5b5a('0x1a')](_0x5b5a('0xb'),auth[_0x5b5a('0xa')](),controller[_0x5b5a('0x1a')]);module[_0x5b5a('0x1b')]=router; \ No newline at end of file +var _0x08d5=['index','get','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','format','extname','post','single','file','put','update','delete','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x08d5,0xbc));var _0x508d=function(_0x3d4277,_0x33b44a){_0x3d4277=_0x3d4277-0x0;var _0x49a998=_0x08d5[_0x3d4277];return _0x49a998;};'use strict';var multer=require(_0x508d('0x0'));var util=require(_0x508d('0x1'));var path=require('path');var timeout=require(_0x508d('0x2'));var express=require(_0x508d('0x3'));var router=express[_0x508d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x508d('0x5'));var config=require(_0x508d('0x6'));var controller=require(_0x508d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x508d('0x8')]);router[_0x508d('0x9')](_0x508d('0xa'),auth[_0x508d('0xb')](),controller[_0x508d('0xc')]);router[_0x508d('0x9')](_0x508d('0xd'),auth['isAuthenticated'](),controller[_0x508d('0xe')]);var upload=multer({'storage':multer[_0x508d('0xf')]({'destination':function(_0x10ac6c,_0x3ad49f,_0xa21342){_0xa21342(null,path[_0x508d('0x10')](config[_0x508d('0x11')],_0x508d('0x12')));},'filename':function(_0x2474c5,_0x490169,_0x40140f){_0x490169[_0x508d('0x13')]=_0x490169[_0x508d('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40140f(null,util[_0x508d('0x14')]('%s-%s%s',path['basename'](_0x490169[_0x508d('0x13')],path['extname'](_0x490169['originalname'])),Date['now'](),path[_0x508d('0x15')](_0x490169[_0x508d('0x13')])));}})});router[_0x508d('0x16')]('/',upload[_0x508d('0x17')](_0x508d('0x18')),controller['create']);router[_0x508d('0x19')](_0x508d('0xa'),auth[_0x508d('0xb')](),controller[_0x508d('0x1a')]);router['delete'](_0x508d('0xa'),auth[_0x508d('0xb')](),controller[_0x508d('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 98e836b..818f695 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 _0x6d79=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x6d79,0xe1));var _0x96d7=function(_0x4d71b4,_0x1aa9de){_0x4d71b4=_0x4d71b4-0x0;var _0x1ded12=_0x6d79[_0x4d71b4];return _0x1ded12;};'use strict';var Sequelize=require(_0x96d7('0x0'));module[_0x96d7('0x1')]={'name':{'type':Sequelize[_0x96d7('0x2')],'unique':_0x96d7('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x96d7('0x2')]},'display_name':{'type':Sequelize[_0x96d7('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x96d7('0x2')]},'original_format':{'type':Sequelize[_0x96d7('0x2')]},'original_duration':{'type':Sequelize[_0x96d7('0x4')]},'original_sampleCount':{'type':Sequelize[_0x96d7('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x96d7('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x96d7('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x96d7('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe9c7=['sequelize','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x5cd0f0,_0x318f8a){var _0x41fa3e=function(_0x53ad5d){while(--_0x53ad5d){_0x5cd0f0['push'](_0x5cd0f0['shift']());}};_0x41fa3e(++_0x318f8a);}(_0xe9c7,0xe6));var _0x7e9c=function(_0x455de5,_0x17346a){_0x455de5=_0x455de5-0x0;var _0x3091d7=_0xe9c7[_0x455de5];return _0x3091d7;};'use strict';var Sequelize=require(_0x7e9c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x7e9c('0x1')]},'display_name':{'type':Sequelize[_0x7e9c('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7e9c('0x1')]},'original_format':{'type':Sequelize[_0x7e9c('0x1')]},'original_duration':{'type':Sequelize[_0x7e9c('0x2')]},'original_sampleCount':{'type':Sequelize[_0x7e9c('0x3')]},'original_channelCount':{'type':Sequelize[_0x7e9c('0x4')]},'original_bitRate':{'type':Sequelize[_0x7e9c('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7e9c('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x7e9c('0x3')]},'converted_channelCount':{'type':Sequelize[_0x7e9c('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x7e9c('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 82d74e1..0c83df9 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 _0xb42e=['sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','get','Sounds','then','error','stack','name','send','index','map','Sound','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','download','find','save_name','converted_format','join','root','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x50436f,_0x2e3f35){var _0x536873=function(_0x37b12e){while(--_0x37b12e){_0x50436f['push'](_0x50436f['shift']());}};_0x536873(++_0x2e3f35);}(_0xb42e,0x6f));var _0xeb42=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0xb42e[_0x29c3b2];return _0x4b3aa7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb42('0x0'));var zipdir=require(_0xeb42('0x1'));var jsonpatch=require(_0xeb42('0x2'));var rp=require(_0xeb42('0x3'));var moment=require(_0xeb42('0x4'));var BPromise=require(_0xeb42('0x5'));var Mustache=require(_0xeb42('0x6'));var util=require(_0xeb42('0x7'));var path=require(_0xeb42('0x8'));var sox=require(_0xeb42('0x9'));var csv=require(_0xeb42('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb42('0xb'));var squel=require(_0xeb42('0xc'));var crypto=require(_0xeb42('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xeb42('0xe'));var toCsv=require(_0xeb42('0xa'));var querystring=require(_0xeb42('0xf'));var Papa=require(_0xeb42('0x10'));var Redis=require(_0xeb42('0x11'));var authService=require(_0xeb42('0x12'));var qs=require(_0xeb42('0x13'));var as=require(_0xeb42('0x14'));var hardwareService=require(_0xeb42('0x15'));var logger=require(_0xeb42('0x16'))(_0xeb42('0x17'));var utils=require('../../config/utils');var config=require(_0xeb42('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xeb42('0x19'))['db'];function respondWithStatusCode(_0x188b19,_0x51ea6c){_0x51ea6c=_0x51ea6c||0xcc;return function(_0x453de0){if(_0x453de0){return _0x188b19[_0xeb42('0x1a')](_0x51ea6c);}return _0x188b19['status'](_0x51ea6c)[_0xeb42('0x1b')]();};}function respondWithResult(_0x416464,_0xec962d){_0xec962d=_0xec962d||0xc8;return function(_0x6d6047){if(_0x6d6047){return _0x416464[_0xeb42('0x1c')](_0xec962d)[_0xeb42('0x1d')](_0x6d6047);}};}function respondWithFilteredResult(_0x4bd338,_0x460dfe){return function(_0x4cd0de){if(_0x4cd0de){var _0x49c22a=typeof _0x460dfe['offset']===_0xeb42('0x1e')&&typeof _0x460dfe[_0xeb42('0x1f')]===_0xeb42('0x1e');var _0x34c92e=_0x4cd0de[_0xeb42('0x20')];var _0x3fb37b=_0x49c22a?0x0:_0x460dfe['offset'];var _0x1b00db=_0x49c22a?_0x4cd0de[_0xeb42('0x20')]:_0x460dfe[_0xeb42('0x21')]+_0x460dfe['limit'];var _0xdffcb8;if(_0x1b00db>=_0x34c92e){_0x1b00db=_0x34c92e;_0xdffcb8=0xc8;}else{_0xdffcb8=0xce;}_0x4bd338['status'](_0xdffcb8);return _0x4bd338[_0xeb42('0x22')]('Content-Range',_0x3fb37b+'-'+_0x1b00db+'/'+_0x34c92e)[_0xeb42('0x1d')](_0x4cd0de);}return null;};}function patchUpdates(_0x21cde8){return function(_0x4f597e){try{jsonpatch[_0xeb42('0x23')](_0x4f597e,_0x21cde8,!![]);}catch(_0x5c608e){return BPromise[_0xeb42('0x24')](_0x5c608e);}return _0x4f597e[_0xeb42('0x25')]();};}function saveUpdates(_0x12b3f5,_0x2016a0){return function(_0x21d713){if(_0x21d713){return _0x21d713[_0xeb42('0x26')](_0x12b3f5)['then'](function(_0x5ce71d){return _0x5ce71d;});}return null;};}function removeEntity(_0x5b4697,_0x7470f4){return function(_0x2c37b0){if(_0x2c37b0){return _0x2c37b0['destroy']()['then'](function(){var _0x553c3f=_0x2c37b0[_0xeb42('0x27')]({'plain':!![]});var _0x542558=_0xeb42('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x542558,'resourceId':_0x553c3f['id']}})[_0xeb42('0x29')](function(){return _0x2c37b0;});})[_0xeb42('0x29')](function(){_0x5b4697['status'](0xcc)[_0xeb42('0x1b')]();});}};}function handleEntityNotFound(_0x3fe018,_0x2dd4bb){return function(_0x4a3e33){if(!_0x4a3e33){_0x3fe018[_0xeb42('0x1a')](0x194);}return _0x4a3e33;};}function handleError(_0x144d73,_0xcf50e5){_0xcf50e5=_0xcf50e5||0x1f4;return function(_0x19f52c){logger[_0xeb42('0x2a')](_0x19f52c[_0xeb42('0x2b')]);if(_0x19f52c[_0xeb42('0x2c')]){delete _0x19f52c[_0xeb42('0x2c')];}_0x144d73[_0xeb42('0x1c')](_0xcf50e5)[_0xeb42('0x2d')](_0x19f52c);};}exports[_0xeb42('0x2e')]=function(_0x1a9245,_0x3e8c3b){var _0x3c92c6={},_0x372a89={},_0xc1ccd2={'count':0x0,'rows':[]};var _0x5b627a=_[_0xeb42('0x2f')](db[_0xeb42('0x30')][_0xeb42('0x31')],function(_0x300982){return{'name':_0x300982[_0xeb42('0x32')],'type':_0x300982['type']['key']};});_0x372a89[_0xeb42('0x33')]=_[_0xeb42('0x2f')](_0x5b627a,'name');_0x372a89[_0xeb42('0x34')]=_[_0xeb42('0x35')](_0x1a9245['query']);_0x372a89[_0xeb42('0x36')]=_[_0xeb42('0x37')](_0x372a89[_0xeb42('0x33')],_0x372a89[_0xeb42('0x34')]);_0x3c92c6[_0xeb42('0x38')]=_['intersection'](_0x372a89[_0xeb42('0x33')],qs['fields'](_0x1a9245[_0xeb42('0x34')][_0xeb42('0x39')]));_0x3c92c6['attributes']=_0x3c92c6[_0xeb42('0x38')][_0xeb42('0x3a')]?_0x3c92c6[_0xeb42('0x38')]:_0x372a89[_0xeb42('0x33')];if(!_0x1a9245['query'][_0xeb42('0x3b')](_0xeb42('0x3c'))){_0x3c92c6[_0xeb42('0x1f')]=qs['limit'](_0x1a9245[_0xeb42('0x34')][_0xeb42('0x1f')]);_0x3c92c6[_0xeb42('0x21')]=qs[_0xeb42('0x21')](_0x1a9245[_0xeb42('0x34')]['offset']);}_0x3c92c6[_0xeb42('0x3d')]=qs['sort'](_0x1a9245[_0xeb42('0x34')]['sort']);_0x3c92c6[_0xeb42('0x3e')]=qs[_0xeb42('0x36')](_[_0xeb42('0x3f')](_0x1a9245['query'],_0x372a89[_0xeb42('0x36')]),_0x5b627a);if(_0x1a9245[_0xeb42('0x34')]['filter']){_0x3c92c6['where']=_[_0xeb42('0x40')](_0x3c92c6[_0xeb42('0x3e')],{'$or':_[_0xeb42('0x2f')](_0x5b627a,function(_0x1116a6){if(_0x1116a6['type']!==_0xeb42('0x41')){var _0x3edf12={};_0x3edf12[_0x1116a6[_0xeb42('0x2c')]]={'$like':'%'+_0x1a9245[_0xeb42('0x34')][_0xeb42('0x42')]+'%'};return _0x3edf12;}})});}_0x3c92c6=_[_0xeb42('0x40')]({},_0x3c92c6,_0x1a9245[_0xeb42('0x43')]);var _0x587d85={'where':_0x3c92c6[_0xeb42('0x3e')]};return db[_0xeb42('0x30')]['count'](_0x587d85)[_0xeb42('0x29')](function(_0x82ff43){_0xc1ccd2['count']=_0x82ff43;if(_0x1a9245[_0xeb42('0x34')][_0xeb42('0x44')]){_0x3c92c6[_0xeb42('0x45')]=[{'all':!![]}];}return db[_0xeb42('0x30')][_0xeb42('0x46')](_0x3c92c6);})[_0xeb42('0x29')](function(_0x301326){_0xc1ccd2['rows']=_0x301326;return _0xc1ccd2;})[_0xeb42('0x29')](respondWithFilteredResult(_0x3e8c3b,_0x3c92c6))[_0xeb42('0x47')](handleError(_0x3e8c3b,null));};exports['show']=function(_0x3b1eae,_0x49d63e){var _0xc069d4={'raw':!![],'where':{'id':_0x3b1eae[_0xeb42('0x48')]['id']}},_0x521727={};_0x521727[_0xeb42('0x33')]=_[_0xeb42('0x35')](db[_0xeb42('0x30')][_0xeb42('0x31')]);_0x521727['query']=_[_0xeb42('0x35')](_0x3b1eae[_0xeb42('0x34')]);_0x521727['filters']=_['intersection'](_0x521727[_0xeb42('0x33')],_0x521727[_0xeb42('0x34')]);_0xc069d4[_0xeb42('0x38')]=_['intersection'](_0x521727[_0xeb42('0x33')],qs[_0xeb42('0x39')](_0x3b1eae[_0xeb42('0x34')][_0xeb42('0x39')]));_0xc069d4[_0xeb42('0x38')]=_0xc069d4['attributes'][_0xeb42('0x3a')]?_0xc069d4['attributes']:_0x521727[_0xeb42('0x33')];if(_0x3b1eae[_0xeb42('0x34')][_0xeb42('0x44')]){_0xc069d4['include']=[{'all':!![]}];}_0xc069d4=_['merge']({},_0xc069d4,_0x3b1eae['options']);return db[_0xeb42('0x30')]['find'](_0xc069d4)[_0xeb42('0x29')](handleEntityNotFound(_0x49d63e,null))['then'](respondWithResult(_0x49d63e,null))[_0xeb42('0x47')](handleError(_0x49d63e,null));};exports[_0xeb42('0x49')]=function(_0x1ea682,_0x3da94c,_0x28dec9){return db[_0xeb42('0x30')][_0xeb42('0x4a')]({'where':{'id':_0x1ea682[_0xeb42('0x48')]['id']},'attributes':[_0xeb42('0x2c'),_0xeb42('0x4b'),_0xeb42('0x4c')],'raw':!![]})[_0xeb42('0x29')](handleEntityNotFound(_0x3da94c,null))[_0xeb42('0x29')](function(_0x40fc57){if(_0x40fc57){if(!fs['existsSync'](path[_0xeb42('0x4d')](config[_0xeb42('0x4e')],'server/files/sounds/converted',_0x40fc57['save_name']+'.'+_0x40fc57[_0xeb42('0x4c')]))){throw new db['Sequelize']['ValidationError'](_0xeb42('0x4f'));}return _0x3da94c[_0xeb42('0x49')](path[_0xeb42('0x4d')](config[_0xeb42('0x4e')],_0xeb42('0x50'),util[_0xeb42('0x51')](_0xeb42('0x52'),_0x40fc57[_0xeb42('0x4b')],_0x40fc57[_0xeb42('0x4c')])),util[_0xeb42('0x51')](_0xeb42('0x52'),_0x40fc57[_0xeb42('0x2c')],_0x40fc57[_0xeb42('0x4c')]));}return null;})['catch'](handleError(_0x3da94c,null));};exports[_0xeb42('0x53')]=function(_0x3c8026,_0x40cd04,_0x2663e2){var _0x401cb9={'name':path[_0xeb42('0x54')](_0x3c8026[_0xeb42('0x55')][_0xeb42('0x56')],path[_0xeb42('0x57')](_0x3c8026[_0xeb42('0x55')][_0xeb42('0x56')])),'save_name':path[_0xeb42('0x54')](_0x3c8026[_0xeb42('0x55')][_0xeb42('0x58')],path[_0xeb42('0x57')](_0x3c8026[_0xeb42('0x55')]['filename'])),'original_format':path['extname'](_0x3c8026[_0xeb42('0x55')][_0xeb42('0x56')])[_0xeb42('0x59')](0x1),'converted_format':'wav'};var _0xf93205=path[_0xeb42('0x4d')](config[_0xeb42('0x4e')],_0xeb42('0x5a'),_0x3c8026[_0xeb42('0x55')][_0xeb42('0x58')]);var _0x3ebe19=path[_0xeb42('0x4d')](config['root'],_0xeb42('0x50'),util[_0xeb42('0x51')]('%s.%s',path['basename'](_0x3c8026[_0xeb42('0x55')]['filename'],path[_0xeb42('0x57')](_0x3c8026[_0xeb42('0x55')][_0xeb42('0x58')])),_0x401cb9[_0xeb42('0x4c')]));logger['info'](_0xeb42('0x5b'),_0xf93205);logger[_0xeb42('0x5c')](_0xeb42('0x5d'),_0x3ebe19);try{fs[_0xeb42('0x5e')](_0xf93205,parseInt(_0xeb42('0x5f'),0x8));var _0x110167=sox['transcode'](_0xf93205,_0x3ebe19,{'sampleRate':0x1f40,'format':_0xeb42('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x110167['on'](_0xeb42('0x2a'),function(_0x51da27){fs[_0xeb42('0x61')](_0xf93205);_0x40cd04[_0xeb42('0x1c')](0x1f4)[_0xeb42('0x2d')](_0x51da27);});_0x110167['on'](_0xeb42('0x62'),function(_0x1a3785){_0x401cb9[_0xeb42('0x63')]=isNaN(_0x1a3785[_0xeb42('0x64')])?null:_0x1a3785[_0xeb42('0x64')]*0x3e8;_0x401cb9[_0xeb42('0x65')]=isNaN(_0x1a3785[_0xeb42('0x66')])?null:_0x1a3785[_0xeb42('0x66')];_0x401cb9['original_channelCount']=isNaN(_0x1a3785[_0xeb42('0x67')])?null:_0x1a3785[_0xeb42('0x67')];_0x401cb9['original_bitRate']=isNaN(_0x1a3785['bitRate'])?null:_0x1a3785['bitRate'];_0x401cb9['original_sampleRate']=isNaN(_0x1a3785['sampleRate'])?null:_0x1a3785[_0xeb42('0x68')];});_0x110167['on']('dest',function(_0x37c8cb){_0x401cb9[_0xeb42('0x69')]=isNaN(_0x37c8cb['duration'])?null:_0x37c8cb['duration']*0x3e8;_0x401cb9[_0xeb42('0x6a')]=isNaN(_0x37c8cb[_0xeb42('0x66')])?null:_0x37c8cb[_0xeb42('0x66')];_0x401cb9[_0xeb42('0x6b')]=isNaN(_0x37c8cb['channelCount'])?null:_0x37c8cb[_0xeb42('0x67')];_0x401cb9[_0xeb42('0x6c')]=isNaN(_0x37c8cb[_0xeb42('0x6d')])?null:_0x37c8cb[_0xeb42('0x6d')];_0x401cb9[_0xeb42('0x6e')]=isNaN(_0x37c8cb[_0xeb42('0x68')])?null:_0x37c8cb[_0xeb42('0x68')];});_0x110167['on']('end',function(){fs[_0xeb42('0x5e')](_0x3ebe19,parseInt(_0xeb42('0x5f'),0x8));return db[_0xeb42('0x30')][_0xeb42('0x53')](_0x401cb9)[_0xeb42('0x29')](function(_0x360cce){var _0xaacf71={'role':_0x3c8026['body'][_0xeb42('0x6f')],'userProfileId':_0x3c8026[_0xeb42('0x70')][_0xeb42('0x71')]};if(!_0xaacf71)throw new Error(_0xeb42('0x72'));if(_0xaacf71['role']===_0xeb42('0x73')){var _0x59cd32=_0x360cce[_0xeb42('0x27')]({'plain':!![]});return db[_0xeb42('0x74')]['find']({'where':{'name':'Sounds','userProfileId':_0xaacf71[_0xeb42('0x71')]},'raw':!![]})[_0xeb42('0x29')](function(_0x58d12e){if(_0x58d12e&&_0x58d12e['autoAssociation']===0x0){return db['UserProfileResource'][_0xeb42('0x53')]({'name':_0x59cd32[_0xeb42('0x2c')],'resourceId':_0x59cd32['id'],'type':_0x58d12e[_0xeb42('0x2c')],'sectionId':_0x58d12e['id']},{})[_0xeb42('0x29')](function(){return _0x360cce;});}else{return _0x360cce;}})['catch'](function(_0x1defb0){logger[_0xeb42('0x2a')](_0xeb42('0x75'),_0x1defb0);throw _0x1defb0;});}return _0x360cce;})[_0xeb42('0x29')](respondWithResult(_0x40cd04,null))[_0xeb42('0x47')](handleError(_0x40cd04,null));});_0x110167[_0xeb42('0x76')]();}catch(_0x3c3e09){_0x40cd04[_0xeb42('0x1c')](0x1f4)[_0xeb42('0x2d')](_0x3c3e09);}};exports[_0xeb42('0x26')]=function(_0xe31af6,_0x28a7f6,_0x29f422){return db['Sound'][_0xeb42('0x4a')]({'where':{'id':_0xe31af6[_0xeb42('0x48')]['id']}})['then'](handleEntityNotFound(_0x28a7f6,null))[_0xeb42('0x29')](saveUpdates(_[_0xeb42('0x3f')](_0xe31af6['body'],[_0xeb42('0x2c'),'description']),null))[_0xeb42('0x29')](respondWithResult(_0x28a7f6,null))[_0xeb42('0x47')](handleError(_0x28a7f6,null));};exports['delete']=function(_0x100fef,_0x72f060,_0x361868){return db['Sound']['find']({'where':{'id':_0x100fef[_0xeb42('0x48')]['id']}})[_0xeb42('0x29')](function(_0x110d9d){if(_0x110d9d){return _0x110d9d[_0xeb42('0x77')]();}})[_0xeb42('0x29')](function(_0x46c48c){var _0xa8812d=path[_0xeb42('0x4d')](config[_0xeb42('0x4e')],'server/files/sounds/original',util[_0xeb42('0x51')](_0xeb42('0x52'),_0x46c48c[_0xeb42('0x4b')],_0x46c48c['original_format']));var _0x4235a9=path[_0xeb42('0x4d')](config[_0xeb42('0x4e')],_0xeb42('0x50'),util[_0xeb42('0x51')](_0xeb42('0x52'),_0x46c48c['save_name'],_0x46c48c['converted_format']));fs[_0xeb42('0x61')](_0xa8812d);fs[_0xeb42('0x61')](_0x4235a9);return _0x46c48c;})[_0xeb42('0x29')](function(_0x23f6b){if(_0x23f6b){return _0x72f060[_0xeb42('0x1c')](0xcc)['end']();}})[_0xeb42('0x29')](handleEntityNotFound(_0x72f060,null))[_0xeb42('0x47')](handleError(_0x72f060,null));}; \ No newline at end of file +var _0xc271=['description','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','count','limit','set','Content-Range','reject','update','destroy','then','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','find','download','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','join','format','create','originalname','basename','file','filename','extname','substring','server/files/sounds/original','%s.%s','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','send','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x309eaa,_0x46b31){var _0x3fad14=function(_0x388c86){while(--_0x388c86){_0x309eaa['push'](_0x309eaa['shift']());}};_0x3fad14(++_0x46b31);}(_0xc271,0xf4));var _0x1c27=function(_0xeb67f3,_0x631617){_0xeb67f3=_0xeb67f3-0x0;var _0x193a08=_0xc271[_0xeb67f3];return _0x193a08;};'use strict';var emlformat=require(_0x1c27('0x0'));var rimraf=require(_0x1c27('0x1'));var zipdir=require(_0x1c27('0x2'));var jsonpatch=require(_0x1c27('0x3'));var rp=require(_0x1c27('0x4'));var moment=require(_0x1c27('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1c27('0x6'));var util=require('util');var path=require(_0x1c27('0x7'));var sox=require('sox');var csv=require(_0x1c27('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c27('0x9'));var _=require(_0x1c27('0xa'));var squel=require(_0x1c27('0xb'));var crypto=require('crypto');var jsforce=require(_0x1c27('0xc'));var deskjs=require(_0x1c27('0xd'));var toCsv=require(_0x1c27('0x8'));var querystring=require(_0x1c27('0xe'));var Papa=require('papaparse');var Redis=require(_0x1c27('0xf'));var authService=require(_0x1c27('0x10'));var qs=require(_0x1c27('0x11'));var as=require(_0x1c27('0x12'));var hardwareService=require(_0x1c27('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1c27('0x14'));var config=require(_0x1c27('0x15'));var licenseUtil=require(_0x1c27('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0197,_0xcd7e21){_0xcd7e21=_0xcd7e21||0xcc;return function(_0x4f19f6){if(_0x4f19f6){return _0x4b0197['sendStatus'](_0xcd7e21);}return _0x4b0197[_0x1c27('0x17')](_0xcd7e21)[_0x1c27('0x18')]();};}function respondWithResult(_0x225f11,_0x103560){_0x103560=_0x103560||0xc8;return function(_0x3cdf51){if(_0x3cdf51){return _0x225f11[_0x1c27('0x17')](_0x103560)[_0x1c27('0x19')](_0x3cdf51);}};}function respondWithFilteredResult(_0x4b3bd6,_0x2ed6a3){return function(_0x2d5939){if(_0x2d5939){var _0x517b05=typeof _0x2ed6a3[_0x1c27('0x1a')]==='undefined'&&typeof _0x2ed6a3['limit']==='undefined';var _0x516fd7=_0x2d5939[_0x1c27('0x1b')];var _0x3372b6=_0x517b05?0x0:_0x2ed6a3[_0x1c27('0x1a')];var _0x47cd77=_0x517b05?_0x2d5939['count']:_0x2ed6a3[_0x1c27('0x1a')]+_0x2ed6a3[_0x1c27('0x1c')];var _0x33c0bf;if(_0x47cd77>=_0x516fd7){_0x47cd77=_0x516fd7;_0x33c0bf=0xc8;}else{_0x33c0bf=0xce;}_0x4b3bd6[_0x1c27('0x17')](_0x33c0bf);return _0x4b3bd6[_0x1c27('0x1d')](_0x1c27('0x1e'),_0x3372b6+'-'+_0x47cd77+'/'+_0x516fd7)[_0x1c27('0x19')](_0x2d5939);}return null;};}function patchUpdates(_0x27827a){return function(_0x4b2e58){try{jsonpatch['apply'](_0x4b2e58,_0x27827a,!![]);}catch(_0x42ca9b){return BPromise[_0x1c27('0x1f')](_0x42ca9b);}return _0x4b2e58['save']();};}function saveUpdates(_0x24cbb5,_0x3d65ad){return function(_0x15f942){if(_0x15f942){return _0x15f942[_0x1c27('0x20')](_0x24cbb5)['then'](function(_0x201f8e){return _0x201f8e;});}return null;};}function removeEntity(_0x5876e6,_0x249dfa){return function(_0x3d3b97){if(_0x3d3b97){return _0x3d3b97[_0x1c27('0x21')]()[_0x1c27('0x22')](function(){var _0x1e7739=_0x3d3b97['get']({'plain':!![]});var _0x2cdd3c=_0x1c27('0x23');return db[_0x1c27('0x24')][_0x1c27('0x21')]({'where':{'type':_0x2cdd3c,'resourceId':_0x1e7739['id']}})[_0x1c27('0x22')](function(){return _0x3d3b97;});})[_0x1c27('0x22')](function(){_0x5876e6[_0x1c27('0x17')](0xcc)[_0x1c27('0x18')]();});}};}function handleEntityNotFound(_0x54af15,_0x5bf3a5){return function(_0x3e3b50){if(!_0x3e3b50){_0x54af15['sendStatus'](0x194);}return _0x3e3b50;};}function handleError(_0x35e1a7,_0x294a94){_0x294a94=_0x294a94||0x1f4;return function(_0x530b04){logger[_0x1c27('0x25')](_0x530b04[_0x1c27('0x26')]);if(_0x530b04[_0x1c27('0x27')]){delete _0x530b04[_0x1c27('0x27')];}_0x35e1a7[_0x1c27('0x17')](_0x294a94)['send'](_0x530b04);};}exports[_0x1c27('0x28')]=function(_0x50b6c5,_0x396d8e){var _0x132533={},_0x2441bd={},_0x3415fd={'count':0x0,'rows':[]};var _0x5a96f5=_[_0x1c27('0x29')](db[_0x1c27('0x2a')][_0x1c27('0x2b')],function(_0x57f6d3){return{'name':_0x57f6d3['fieldName'],'type':_0x57f6d3[_0x1c27('0x2c')][_0x1c27('0x2d')]};});_0x2441bd['model']=_[_0x1c27('0x29')](_0x5a96f5,_0x1c27('0x27'));_0x2441bd['query']=_[_0x1c27('0x2e')](_0x50b6c5[_0x1c27('0x2f')]);_0x2441bd[_0x1c27('0x30')]=_[_0x1c27('0x31')](_0x2441bd[_0x1c27('0x32')],_0x2441bd[_0x1c27('0x2f')]);_0x132533[_0x1c27('0x33')]=_['intersection'](_0x2441bd['model'],qs[_0x1c27('0x34')](_0x50b6c5['query'][_0x1c27('0x34')]));_0x132533[_0x1c27('0x33')]=_0x132533[_0x1c27('0x33')][_0x1c27('0x35')]?_0x132533[_0x1c27('0x33')]:_0x2441bd[_0x1c27('0x32')];if(!_0x50b6c5[_0x1c27('0x2f')][_0x1c27('0x36')](_0x1c27('0x37'))){_0x132533['limit']=qs['limit'](_0x50b6c5[_0x1c27('0x2f')][_0x1c27('0x1c')]);_0x132533[_0x1c27('0x1a')]=qs[_0x1c27('0x1a')](_0x50b6c5['query']['offset']);}_0x132533[_0x1c27('0x38')]=qs['sort'](_0x50b6c5[_0x1c27('0x2f')]['sort']);_0x132533[_0x1c27('0x39')]=qs[_0x1c27('0x30')](_[_0x1c27('0x3a')](_0x50b6c5[_0x1c27('0x2f')],_0x2441bd['filters']),_0x5a96f5);if(_0x50b6c5['query'][_0x1c27('0x3b')]){_0x132533[_0x1c27('0x39')]=_[_0x1c27('0x3c')](_0x132533[_0x1c27('0x39')],{'$or':_[_0x1c27('0x29')](_0x5a96f5,function(_0x4ef088){if(_0x4ef088[_0x1c27('0x2c')]!==_0x1c27('0x3d')){var _0x391135={};_0x391135[_0x4ef088[_0x1c27('0x27')]]={'$like':'%'+_0x50b6c5[_0x1c27('0x2f')][_0x1c27('0x3b')]+'%'};return _0x391135;}})});}_0x132533=_[_0x1c27('0x3c')]({},_0x132533,_0x50b6c5['options']);var _0x2f2551={'where':_0x132533[_0x1c27('0x39')]};return db['Sound'][_0x1c27('0x1b')](_0x2f2551)[_0x1c27('0x22')](function(_0x360550){_0x3415fd[_0x1c27('0x1b')]=_0x360550;if(_0x50b6c5[_0x1c27('0x2f')]['includeAll']){_0x132533[_0x1c27('0x3e')]=[{'all':!![]}];}return db[_0x1c27('0x2a')][_0x1c27('0x3f')](_0x132533);})[_0x1c27('0x22')](function(_0x2716c6){_0x3415fd[_0x1c27('0x40')]=_0x2716c6;return _0x3415fd;})['then'](respondWithFilteredResult(_0x396d8e,_0x132533))[_0x1c27('0x41')](handleError(_0x396d8e,null));};exports[_0x1c27('0x42')]=function(_0x4b3e17,_0x51ecb1){var _0x1d97e5={'raw':!![],'where':{'id':_0x4b3e17[_0x1c27('0x43')]['id']}},_0x1f4241={};_0x1f4241[_0x1c27('0x32')]=_[_0x1c27('0x2e')](db[_0x1c27('0x2a')]['rawAttributes']);_0x1f4241[_0x1c27('0x2f')]=_[_0x1c27('0x2e')](_0x4b3e17[_0x1c27('0x2f')]);_0x1f4241['filters']=_[_0x1c27('0x31')](_0x1f4241[_0x1c27('0x32')],_0x1f4241[_0x1c27('0x2f')]);_0x1d97e5[_0x1c27('0x33')]=_[_0x1c27('0x31')](_0x1f4241['model'],qs['fields'](_0x4b3e17[_0x1c27('0x2f')]['fields']));_0x1d97e5[_0x1c27('0x33')]=_0x1d97e5[_0x1c27('0x33')][_0x1c27('0x35')]?_0x1d97e5[_0x1c27('0x33')]:_0x1f4241['model'];if(_0x4b3e17['query'][_0x1c27('0x44')]){_0x1d97e5['include']=[{'all':!![]}];}_0x1d97e5=_[_0x1c27('0x3c')]({},_0x1d97e5,_0x4b3e17[_0x1c27('0x45')]);return db[_0x1c27('0x2a')][_0x1c27('0x46')](_0x1d97e5)[_0x1c27('0x22')](handleEntityNotFound(_0x51ecb1,null))[_0x1c27('0x22')](respondWithResult(_0x51ecb1,null))['catch'](handleError(_0x51ecb1,null));};exports[_0x1c27('0x47')]=function(_0x4e1fcc,_0x282787,_0x56e12f){return db[_0x1c27('0x2a')][_0x1c27('0x46')]({'where':{'id':_0x4e1fcc['params']['id']},'attributes':['name',_0x1c27('0x48'),_0x1c27('0x49')],'raw':!![]})[_0x1c27('0x22')](handleEntityNotFound(_0x282787,null))[_0x1c27('0x22')](function(_0x340a52){if(_0x340a52){if(!fs[_0x1c27('0x4a')](path['join'](config[_0x1c27('0x4b')],_0x1c27('0x4c'),_0x340a52[_0x1c27('0x48')]+'.'+_0x340a52[_0x1c27('0x49')]))){throw new db[(_0x1c27('0x4d'))]['ValidationError'](_0x1c27('0x4e'));}return _0x282787[_0x1c27('0x47')](path[_0x1c27('0x4f')](config[_0x1c27('0x4b')],_0x1c27('0x4c'),util[_0x1c27('0x50')]('%s.%s',_0x340a52[_0x1c27('0x48')],_0x340a52[_0x1c27('0x49')])),util['format']('%s.%s',_0x340a52[_0x1c27('0x27')],_0x340a52[_0x1c27('0x49')]));}return null;})[_0x1c27('0x41')](handleError(_0x282787,null));};exports[_0x1c27('0x51')]=function(_0xef518,_0x771a2,_0x1a8b5a){var _0x553fff={'name':path['basename'](_0xef518['file'][_0x1c27('0x52')],path['extname'](_0xef518['file'][_0x1c27('0x52')])),'save_name':path[_0x1c27('0x53')](_0xef518['file']['filename'],path['extname'](_0xef518[_0x1c27('0x54')][_0x1c27('0x55')])),'original_format':path[_0x1c27('0x56')](_0xef518[_0x1c27('0x54')]['originalname'])[_0x1c27('0x57')](0x1),'converted_format':'wav'};var _0x516488=path['join'](config[_0x1c27('0x4b')],_0x1c27('0x58'),_0xef518[_0x1c27('0x54')][_0x1c27('0x55')]);var _0x295ab4=path['join'](config[_0x1c27('0x4b')],_0x1c27('0x4c'),util['format'](_0x1c27('0x59'),path[_0x1c27('0x53')](_0xef518[_0x1c27('0x54')][_0x1c27('0x55')],path['extname'](_0xef518[_0x1c27('0x54')][_0x1c27('0x55')])),_0x553fff['converted_format']));logger['info'](_0x1c27('0x5a'),_0x516488);logger[_0x1c27('0x5b')](_0x1c27('0x5c'),_0x295ab4);try{fs[_0x1c27('0x5d')](_0x516488,parseInt('0777',0x8));var _0x2c632d=sox[_0x1c27('0x5e')](_0x516488,_0x295ab4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c632d['on'](_0x1c27('0x25'),function(_0x4ef1db){fs['unlinkSync'](_0x516488);_0x771a2[_0x1c27('0x17')](0x1f4)[_0x1c27('0x5f')](_0x4ef1db);});_0x2c632d['on'](_0x1c27('0x60'),function(_0x4a0a72){_0x553fff[_0x1c27('0x61')]=isNaN(_0x4a0a72[_0x1c27('0x62')])?null:_0x4a0a72[_0x1c27('0x62')]*0x3e8;_0x553fff[_0x1c27('0x63')]=isNaN(_0x4a0a72[_0x1c27('0x64')])?null:_0x4a0a72[_0x1c27('0x64')];_0x553fff['original_channelCount']=isNaN(_0x4a0a72[_0x1c27('0x65')])?null:_0x4a0a72[_0x1c27('0x65')];_0x553fff['original_bitRate']=isNaN(_0x4a0a72[_0x1c27('0x66')])?null:_0x4a0a72[_0x1c27('0x66')];_0x553fff[_0x1c27('0x67')]=isNaN(_0x4a0a72[_0x1c27('0x68')])?null:_0x4a0a72[_0x1c27('0x68')];});_0x2c632d['on'](_0x1c27('0x69'),function(_0x32cd8e){_0x553fff['converted_duration']=isNaN(_0x32cd8e[_0x1c27('0x62')])?null:_0x32cd8e[_0x1c27('0x62')]*0x3e8;_0x553fff[_0x1c27('0x6a')]=isNaN(_0x32cd8e['sampleCount'])?null:_0x32cd8e[_0x1c27('0x64')];_0x553fff[_0x1c27('0x6b')]=isNaN(_0x32cd8e[_0x1c27('0x65')])?null:_0x32cd8e['channelCount'];_0x553fff['converted_bitRate']=isNaN(_0x32cd8e[_0x1c27('0x66')])?null:_0x32cd8e['bitRate'];_0x553fff[_0x1c27('0x6c')]=isNaN(_0x32cd8e[_0x1c27('0x68')])?null:_0x32cd8e[_0x1c27('0x68')];});_0x2c632d['on']('end',function(){fs['chmodSync'](_0x295ab4,parseInt(_0x1c27('0x6d'),0x8));return db[_0x1c27('0x2a')]['create'](_0x553fff)[_0x1c27('0x22')](function(_0x59abd8){var _0x6dbc9d={'role':_0xef518['body'][_0x1c27('0x6e')],'userProfileId':_0xef518['body']['userProfileId']};if(!_0x6dbc9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6dbc9d[_0x1c27('0x6e')]===_0x1c27('0x6f')){var _0x58da7e=_0x59abd8['get']({'plain':!![]});return db[_0x1c27('0x70')][_0x1c27('0x46')]({'where':{'name':_0x1c27('0x23'),'userProfileId':_0x6dbc9d['userProfileId']},'raw':!![]})[_0x1c27('0x22')](function(_0x29517d){if(_0x29517d&&_0x29517d[_0x1c27('0x71')]===0x0){return db[_0x1c27('0x24')][_0x1c27('0x51')]({'name':_0x58da7e[_0x1c27('0x27')],'resourceId':_0x58da7e['id'],'type':_0x29517d[_0x1c27('0x27')],'sectionId':_0x29517d['id']},{})['then'](function(){return _0x59abd8;});}else{return _0x59abd8;}})[_0x1c27('0x41')](function(_0x3d9f08){logger[_0x1c27('0x25')](_0x1c27('0x72'),_0x3d9f08);throw _0x3d9f08;});}return _0x59abd8;})['then'](respondWithResult(_0x771a2,null))[_0x1c27('0x41')](handleError(_0x771a2,null));});_0x2c632d['start']();}catch(_0xaae71){_0x771a2[_0x1c27('0x17')](0x1f4)[_0x1c27('0x5f')](_0xaae71);}};exports[_0x1c27('0x20')]=function(_0x1e8b6c,_0x25c392,_0x54d655){return db['Sound'][_0x1c27('0x46')]({'where':{'id':_0x1e8b6c[_0x1c27('0x43')]['id']}})[_0x1c27('0x22')](handleEntityNotFound(_0x25c392,null))[_0x1c27('0x22')](saveUpdates(_[_0x1c27('0x3a')](_0x1e8b6c[_0x1c27('0x73')],[_0x1c27('0x27'),_0x1c27('0x74')]),null))[_0x1c27('0x22')](respondWithResult(_0x25c392,null))[_0x1c27('0x41')](handleError(_0x25c392,null));};exports[_0x1c27('0x75')]=function(_0xe75051,_0x7f58c4,_0x1bc9c5){return db[_0x1c27('0x2a')][_0x1c27('0x46')]({'where':{'id':_0xe75051['params']['id']}})[_0x1c27('0x22')](function(_0x43b561){if(_0x43b561){return _0x43b561[_0x1c27('0x21')]();}})[_0x1c27('0x22')](function(_0x552e69){var _0x1be0ec=path['join'](config['root'],_0x1c27('0x58'),util['format'](_0x1c27('0x59'),_0x552e69['save_name'],_0x552e69[_0x1c27('0x76')]));var _0x168a11=path[_0x1c27('0x4f')](config['root'],_0x1c27('0x4c'),util[_0x1c27('0x50')](_0x1c27('0x59'),_0x552e69[_0x1c27('0x48')],_0x552e69['converted_format']));fs[_0x1c27('0x77')](_0x1be0ec);fs[_0x1c27('0x77')](_0x168a11);return _0x552e69;})[_0x1c27('0x22')](function(_0x381f31){if(_0x381f31){return _0x7f58c4['status'](0xcc)[_0x1c27('0x18')]();}})[_0x1c27('0x22')](handleEntityNotFound(_0x7f58c4,null))[_0x1c27('0x41')](handleError(_0x7f58c4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 1f55ee7..df8b0da 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 _0x6180=['exports','Sound','tools_sounds','lodash','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x26c073,_0x323ca2){var _0x57cb8b=function(_0x3cb5e6){while(--_0x3cb5e6){_0x26c073['push'](_0x26c073['shift']());}};_0x57cb8b(++_0x323ca2);}(_0x6180,0xdb));var _0x0618=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x6180[_0xb7a459];return _0x104ab5;};'use strict';var _=require(_0x0618('0x0'));var util=require('util');var logger=require(_0x0618('0x1'))(_0x0618('0x2'));var moment=require('moment');var BPromise=require(_0x0618('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0618('0x4'));var rimraf=require('rimraf');var config=require(_0x0618('0x5'));var attributes=require('./sound.attributes');module[_0x0618('0x6')]=function(_0x2be6df,_0x3274c0){return _0x2be6df['define'](_0x0618('0x7'),attributes,{'tableName':_0x0618('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe358=['bluebird','request-promise','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment'];(function(_0x3c6cd5,_0x46bbfd){var _0x3b46d8=function(_0x30772e){while(--_0x30772e){_0x3c6cd5['push'](_0x3c6cd5['shift']());}};_0x3b46d8(++_0x46bbfd);}(_0xe358,0xcb));var _0x8e35=function(_0x8261bb,_0x48e718){_0x8261bb=_0x8261bb-0x0;var _0x530867=_0xe358[_0x8261bb];return _0x530867;};'use strict';var _=require(_0x8e35('0x0'));var util=require(_0x8e35('0x1'));var logger=require(_0x8e35('0x2'))(_0x8e35('0x3'));var moment=require(_0x8e35('0x4'));var BPromise=require(_0x8e35('0x5'));var rp=require(_0x8e35('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e35('0x7'));var attributes=require(_0x8e35('0x8'));module[_0x8e35('0x9')]=function(_0x2e85f1,_0x1f526c){return _0x2e85f1[_0x8e35('0xa')](_0x8e35('0xb'),attributes,{'tableName':_0x8e35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index e4715b1..1e0004d 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 _0x6ddb=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','Sound,\x20%s,\x20%s','info','result','catch','Sound','find','options','raw','where','attributes','include','map','ShowSound','lodash'];(function(_0xcf82bd,_0x37d132){var _0x30652b=function(_0x5a0430){while(--_0x5a0430){_0xcf82bd['push'](_0xcf82bd['shift']());}};_0x30652b(++_0x37d132);}(_0x6ddb,0x1cd));var _0xb6dd=function(_0x31fec9,_0x43ae19){_0x31fec9=_0x31fec9-0x0;var _0x5e6f41=_0x6ddb[_0x31fec9];return _0x5e6f41;};'use strict';var _=require(_0xb6dd('0x0'));var util=require('util');var moment=require(_0xb6dd('0x1'));var BPromise=require(_0xb6dd('0x2'));var rs=require(_0xb6dd('0x3'));var fs=require('fs');var Redis=require(_0xb6dd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6dd('0x5'));var logger=require(_0xb6dd('0x6'))(_0xb6dd('0x7'));var config=require(_0xb6dd('0x8'));var jayson=require(_0xb6dd('0x9'));var client=jayson[_0xb6dd('0xa')][_0xb6dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39f41c,_0x5dff56,_0x255c90){return new BPromise(function(_0x5df1ae,_0x435abc){return client[_0xb6dd('0xc')](_0x39f41c,_0x255c90)[_0xb6dd('0xd')](function(_0x22ed1b){logger['info']('Sound,\x20%s,\x20%s',_0x5dff56,_0xb6dd('0xe'));logger[_0xb6dd('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x5dff56,_0xb6dd('0xe'),JSON[_0xb6dd('0x10')](_0x22ed1b));if(_0x22ed1b[_0xb6dd('0x11')]){if(_0x22ed1b[_0xb6dd('0x11')][_0xb6dd('0x12')]===0x1f4){logger[_0xb6dd('0x11')]('Sound,\x20%s,\x20%s',_0x5dff56,_0x22ed1b[_0xb6dd('0x11')][_0xb6dd('0x13')]);return _0x435abc(_0x22ed1b[_0xb6dd('0x11')][_0xb6dd('0x13')]);}logger[_0xb6dd('0x11')](_0xb6dd('0x14'),_0x5dff56,_0x22ed1b[_0xb6dd('0x11')][_0xb6dd('0x13')]);return _0x5df1ae(_0x22ed1b[_0xb6dd('0x11')][_0xb6dd('0x13')]);}else{logger[_0xb6dd('0x15')](_0xb6dd('0x14'),_0x5dff56,_0xb6dd('0xe'));_0x5df1ae(_0x22ed1b[_0xb6dd('0x16')]['message']);}})[_0xb6dd('0x17')](function(_0x2c4432){logger[_0xb6dd('0x11')]('Sound,\x20%s,\x20%s',_0x5dff56,_0x2c4432);_0x435abc(_0x2c4432);});});}exports['ShowSound']=function(_0x392cfc){var _0x31ea7d=this;return new Promise(function(_0x53cf88,_0x1621e3){return db[_0xb6dd('0x18')][_0xb6dd('0x19')]({'raw':_0x392cfc[_0xb6dd('0x1a')]?_0x392cfc[_0xb6dd('0x1a')][_0xb6dd('0x1b')]===undefined?!![]:![]:!![],'where':_0x392cfc['options']?_0x392cfc[_0xb6dd('0x1a')][_0xb6dd('0x1c')]||null:null,'attributes':_0x392cfc[_0xb6dd('0x1a')]?_0x392cfc[_0xb6dd('0x1a')][_0xb6dd('0x1d')]||null:null,'include':_0x392cfc[_0xb6dd('0x1a')]?_0x392cfc[_0xb6dd('0x1a')][_0xb6dd('0x1e')]?_[_0xb6dd('0x1f')](_0x392cfc[_0xb6dd('0x1a')]['include'],function(_0x42b34d){return{'model':db[_0x42b34d['model']],'as':_0x42b34d['as'],'attributes':_0x42b34d[_0xb6dd('0x1d')],'include':_0x42b34d['include']?_[_0xb6dd('0x1f')](_0x42b34d[_0xb6dd('0x1e')],function(_0x5e3d19){return{'model':db[_0x5e3d19['model']],'as':_0x5e3d19['as'],'attributes':_0x5e3d19[_0xb6dd('0x1d')],'include':_0x5e3d19[_0xb6dd('0x1e')]?_[_0xb6dd('0x1f')](_0x5e3d19[_0xb6dd('0x1e')],function(_0x3aecc6){return{'model':db[_0x3aecc6['model']],'as':_0x3aecc6['as'],'attributes':_0x3aecc6['attributes']};}):[]};}):[]};}):[]:[]})[_0xb6dd('0xd')](function(_0x121b0c){logger[_0xb6dd('0x15')]('ShowSound',_0x392cfc);logger[_0xb6dd('0xf')](_0xb6dd('0x20'),_0x392cfc,JSON['stringify'](_0x121b0c));_0x53cf88(_0x121b0c);})[_0xb6dd('0x17')](function(_0x1ce738){logger[_0xb6dd('0x11')](_0xb6dd('0x20'),_0x1ce738[_0xb6dd('0x13')],_0x392cfc);_0x1621e3(_0x31ea7d[_0xb6dd('0x11')](0x1f4,_0x1ce738[_0xb6dd('0x13')]));});});}; \ No newline at end of file +var _0x2916=['error','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','find','options','where','attributes','include','model','map','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify'];(function(_0xf3b8c4,_0x54fea8){var _0x1d8f01=function(_0x375616){while(--_0x375616){_0xf3b8c4['push'](_0xf3b8c4['shift']());}};_0x1d8f01(++_0x54fea8);}(_0x2916,0x81));var _0x6291=function(_0x1c29b3,_0x442dd4){_0x1c29b3=_0x1c29b3-0x0;var _0x6485da=_0x2916[_0x1c29b3];return _0x6485da;};'use strict';var _=require(_0x6291('0x0'));var util=require(_0x6291('0x1'));var moment=require(_0x6291('0x2'));var BPromise=require(_0x6291('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6291('0x4'));var db=require(_0x6291('0x5'))['db'];var utils=require(_0x6291('0x6'));var logger=require('../../config/logger')(_0x6291('0x7'));var config=require('../../config/environment');var jayson=require(_0x6291('0x8'));var client=jayson[_0x6291('0x9')][_0x6291('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cc769,_0x2c8dcd,_0x40c011){return new BPromise(function(_0x53f5f9,_0x1a055a){return client[_0x6291('0xb')](_0x4cc769,_0x40c011)[_0x6291('0xc')](function(_0x5d5509){logger[_0x6291('0xd')]('Sound,\x20%s,\x20%s',_0x2c8dcd,_0x6291('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x2c8dcd,'request\x20sent',JSON[_0x6291('0xf')](_0x5d5509));if(_0x5d5509[_0x6291('0x10')]){if(_0x5d5509[_0x6291('0x10')]['code']===0x1f4){logger[_0x6291('0x10')](_0x6291('0x11'),_0x2c8dcd,_0x5d5509[_0x6291('0x10')]['message']);return _0x1a055a(_0x5d5509[_0x6291('0x10')][_0x6291('0x12')]);}logger[_0x6291('0x10')]('Sound,\x20%s,\x20%s',_0x2c8dcd,_0x5d5509[_0x6291('0x10')][_0x6291('0x12')]);return _0x53f5f9(_0x5d5509[_0x6291('0x10')][_0x6291('0x12')]);}else{logger['info'](_0x6291('0x11'),_0x2c8dcd,_0x6291('0xe'));_0x53f5f9(_0x5d5509[_0x6291('0x13')]['message']);}})[_0x6291('0x14')](function(_0xe9691c){logger['error'](_0x6291('0x11'),_0x2c8dcd,_0xe9691c);_0x1a055a(_0xe9691c);});});}exports[_0x6291('0x15')]=function(_0x40bb5e){var _0x5d0bcf=this;return new Promise(function(_0x508ec5,_0x2928e7){return db['Sound'][_0x6291('0x16')]({'raw':_0x40bb5e[_0x6291('0x17')]?_0x40bb5e[_0x6291('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40bb5e[_0x6291('0x17')]?_0x40bb5e[_0x6291('0x17')][_0x6291('0x18')]||null:null,'attributes':_0x40bb5e[_0x6291('0x17')]?_0x40bb5e[_0x6291('0x17')][_0x6291('0x19')]||null:null,'include':_0x40bb5e[_0x6291('0x17')]?_0x40bb5e[_0x6291('0x17')][_0x6291('0x1a')]?_['map'](_0x40bb5e['options'][_0x6291('0x1a')],function(_0x1d6781){return{'model':db[_0x1d6781[_0x6291('0x1b')]],'as':_0x1d6781['as'],'attributes':_0x1d6781['attributes'],'include':_0x1d6781[_0x6291('0x1a')]?_[_0x6291('0x1c')](_0x1d6781[_0x6291('0x1a')],function(_0x245116){return{'model':db[_0x245116[_0x6291('0x1b')]],'as':_0x245116['as'],'attributes':_0x245116['attributes'],'include':_0x245116[_0x6291('0x1a')]?_[_0x6291('0x1c')](_0x245116['include'],function(_0x31f6ff){return{'model':db[_0x31f6ff[_0x6291('0x1b')]],'as':_0x31f6ff['as'],'attributes':_0x31f6ff[_0x6291('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f4098){logger['info'](_0x6291('0x15'),_0x40bb5e);logger['debug']('ShowSound',_0x40bb5e,JSON['stringify'](_0x4f4098));_0x508ec5(_0x4f4098);})[_0x6291('0x14')](function(_0x3d5a71){logger[_0x6291('0x10')](_0x6291('0x15'),_0x3d5a71[_0x6291('0x12')],_0x40bb5e);_0x2928e7(_0x5d0bcf[_0x6291('0x10')](0x1f4,_0x3d5a71[_0x6291('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cd9f6ea..810202d 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x8603,0x190));var _0x3860=function(_0x448e12,_0x3dd593){_0x448e12=_0x448e12-0x0;var _0x3a178d=_0x8603[_0x448e12];return _0x3a178d;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x59591b,_0x354045){var _0x576642=function(_0x12d1ce){while(--_0x12d1ce){_0x59591b['push'](_0x59591b['shift']());}};_0x576642(++_0x354045);}(_0xda2d,0x102));var _0xdda2=function(_0x3ea78e,_0x4d2f1e){_0x3ea78e=_0x3ea78e-0x0;var _0x3f0153=_0xda2d[_0x3ea78e];return _0x3f0153;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 99ab8b5..fb0eeaf 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 _0x7268=['medium','ENUM','out','TEXT','sequelize','exports','STRING'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7268,0x185));var _0x8726=function(_0x3d686a,_0x1a6d79){_0x3d686a=_0x3d686a-0x0;var _0xffd49d=_0x7268[_0x3d686a];return _0xffd49d;};'use strict';var Sequelize=require(_0x8726('0x0'));module[_0x8726('0x1')]={'uniqueid':{'type':Sequelize[_0x8726('0x2')]},'body':{'type':Sequelize['TEXT'](_0x8726('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x8726('0x4')]('in',_0x8726('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x8726('0x2')]},'providerResponse':{'type':Sequelize[_0x8726('0x6')]}}; \ No newline at end of file +var _0xf7be=['ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x25ede0,_0x29dc39){var _0x16fc37=function(_0x13e4d1){while(--_0x13e4d1){_0x25ede0['push'](_0x25ede0['shift']());}};_0x16fc37(++_0x29dc39);}(_0xf7be,0xa4));var _0xef7b=function(_0x529e40,_0x48d6e6){_0x529e40=_0x529e40-0x0;var _0x22aecb=_0xf7be[_0x529e40];return _0x22aecb;};'use strict';var Sequelize=require(_0xef7b('0x0'));module[_0xef7b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xef7b('0x2')](_0xef7b('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xef7b('0x4')]('in','out'),'defaultValue':_0xef7b('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xef7b('0x6')]},'providerResponse':{'type':Sequelize[_0xef7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 66b7731..c9b59ec 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 _0xe8ae=['zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareMessage','includeAll','findAll','rows','catch','show','params','rawAttributes','create','body','find'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xe8ae,0x163));var _0xee8a=function(_0x578361,_0x11cec0){_0x578361=_0x578361-0x0;var _0x18fad3=_0xe8ae[_0x578361];return _0x18fad3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee8a('0x0'));var jsonpatch=require(_0xee8a('0x1'));var rp=require(_0xee8a('0x2'));var moment=require(_0xee8a('0x3'));var BPromise=require(_0xee8a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xee8a('0x5'));var csv=require(_0xee8a('0x6'));var ejs=require(_0xee8a('0x7'));var fs=require('fs');var fs_extra=require(_0xee8a('0x8'));var _=require(_0xee8a('0x9'));var squel=require(_0xee8a('0xa'));var crypto=require('crypto');var jsforce=require(_0xee8a('0xb'));var deskjs=require(_0xee8a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xee8a('0xd'));var Papa=require(_0xee8a('0xe'));var Redis=require('ioredis');var authService=require(_0xee8a('0xf'));var qs=require(_0xee8a('0x10'));var as=require(_0xee8a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee8a('0x12'))(_0xee8a('0x13'));var utils=require(_0xee8a('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x192daa,_0x2e2a04){_0x2e2a04=_0x2e2a04||0xcc;return function(_0x18983b){if(_0x18983b){return _0x192daa[_0xee8a('0x15')](_0x2e2a04);}return _0x192daa[_0xee8a('0x16')](_0x2e2a04)[_0xee8a('0x17')]();};}function respondWithResult(_0x29c7e2,_0x55ca8b){_0x55ca8b=_0x55ca8b||0xc8;return function(_0x1cf500){if(_0x1cf500){return _0x29c7e2['status'](_0x55ca8b)['json'](_0x1cf500);}};}function respondWithFilteredResult(_0x4a5fc0,_0x2787b8){return function(_0x31262d){if(_0x31262d){var _0x5f4c1b=typeof _0x2787b8[_0xee8a('0x18')]===_0xee8a('0x19')&&typeof _0x2787b8[_0xee8a('0x1a')]===_0xee8a('0x19');var _0x18d7a3=_0x31262d['count'];var _0x42e99b=_0x5f4c1b?0x0:_0x2787b8[_0xee8a('0x18')];var _0x444ae7=_0x5f4c1b?_0x31262d[_0xee8a('0x1b')]:_0x2787b8[_0xee8a('0x18')]+_0x2787b8['limit'];var _0x5a778e;if(_0x444ae7>=_0x18d7a3){_0x444ae7=_0x18d7a3;_0x5a778e=0xc8;}else{_0x5a778e=0xce;}_0x4a5fc0[_0xee8a('0x16')](_0x5a778e);return _0x4a5fc0[_0xee8a('0x1c')](_0xee8a('0x1d'),_0x42e99b+'-'+_0x444ae7+'/'+_0x18d7a3)[_0xee8a('0x1e')](_0x31262d);}return null;};}function patchUpdates(_0x524f64){return function(_0x284d28){try{jsonpatch[_0xee8a('0x1f')](_0x284d28,_0x524f64,!![]);}catch(_0x1a4e17){return BPromise[_0xee8a('0x20')](_0x1a4e17);}return _0x284d28[_0xee8a('0x21')]();};}function saveUpdates(_0x59eb2f,_0x39903d){return function(_0x280240){if(_0x280240){return _0x280240['update'](_0x59eb2f)[_0xee8a('0x22')](function(_0x1fef34){return _0x1fef34;});}return null;};}function removeEntity(_0x38e9d4,_0x5150f3){return function(_0x56efb1){if(_0x56efb1){return _0x56efb1['destroy']()[_0xee8a('0x22')](function(){_0x38e9d4[_0xee8a('0x16')](0xcc)[_0xee8a('0x17')]();});}};}function handleEntityNotFound(_0x1fee56,_0x17d6d7){return function(_0x488413){if(!_0x488413){_0x1fee56[_0xee8a('0x15')](0x194);}return _0x488413;};}function handleError(_0x128cfb,_0x341221){_0x341221=_0x341221||0x1f4;return function(_0x20dc04){logger[_0xee8a('0x23')](_0x20dc04[_0xee8a('0x24')]);if(_0x20dc04['name']){delete _0x20dc04[_0xee8a('0x25')];}_0x128cfb['status'](_0x341221)[_0xee8a('0x26')](_0x20dc04);};}exports[_0xee8a('0x27')]=function(_0x2dbebf,_0x238df5){var _0x1a1219={},_0x5bd313={},_0x377b35={'count':0x0,'rows':[]};var _0x588e41=_[_0xee8a('0x28')](db['SquareMessage']['rawAttributes'],function(_0x5d399f){return{'name':_0x5d399f['fieldName'],'type':_0x5d399f[_0xee8a('0x29')][_0xee8a('0x2a')]};});_0x5bd313[_0xee8a('0x2b')]=_[_0xee8a('0x28')](_0x588e41,_0xee8a('0x25'));_0x5bd313['query']=_[_0xee8a('0x2c')](_0x2dbebf[_0xee8a('0x2d')]);_0x5bd313[_0xee8a('0x2e')]=_['intersection'](_0x5bd313['model'],_0x5bd313[_0xee8a('0x2d')]);_0x1a1219[_0xee8a('0x2f')]=_[_0xee8a('0x30')](_0x5bd313[_0xee8a('0x2b')],qs[_0xee8a('0x31')](_0x2dbebf['query'][_0xee8a('0x31')]));_0x1a1219[_0xee8a('0x2f')]=_0x1a1219[_0xee8a('0x2f')]['length']?_0x1a1219['attributes']:_0x5bd313['model'];if(!_0x2dbebf[_0xee8a('0x2d')][_0xee8a('0x32')](_0xee8a('0x33'))){_0x1a1219['limit']=qs[_0xee8a('0x1a')](_0x2dbebf[_0xee8a('0x2d')][_0xee8a('0x1a')]);_0x1a1219[_0xee8a('0x18')]=qs['offset'](_0x2dbebf[_0xee8a('0x2d')][_0xee8a('0x18')]);}_0x1a1219[_0xee8a('0x34')]=qs[_0xee8a('0x35')](_0x2dbebf[_0xee8a('0x2d')]['sort']);_0x1a1219[_0xee8a('0x36')]=qs[_0xee8a('0x2e')](_[_0xee8a('0x37')](_0x2dbebf['query'],_0x5bd313['filters']),_0x588e41);if(_0x2dbebf[_0xee8a('0x2d')][_0xee8a('0x38')]){_0x1a1219['where']=_[_0xee8a('0x39')](_0x1a1219[_0xee8a('0x36')],{'$or':_[_0xee8a('0x28')](_0x588e41,function(_0x3c0691){if(_0x3c0691['type']!==_0xee8a('0x3a')){var _0x53a595={};_0x53a595[_0x3c0691[_0xee8a('0x25')]]={'$like':'%'+_0x2dbebf[_0xee8a('0x2d')][_0xee8a('0x38')]+'%'};return _0x53a595;}})});}_0x1a1219=_[_0xee8a('0x39')]({},_0x1a1219,_0x2dbebf[_0xee8a('0x3b')]);var _0x391741={'where':_0x1a1219[_0xee8a('0x36')]};return db[_0xee8a('0x3c')][_0xee8a('0x1b')](_0x391741)[_0xee8a('0x22')](function(_0x35b53c){_0x377b35[_0xee8a('0x1b')]=_0x35b53c;if(_0x2dbebf[_0xee8a('0x2d')][_0xee8a('0x3d')]){_0x1a1219['include']=[{'all':!![]}];}return db['SquareMessage'][_0xee8a('0x3e')](_0x1a1219);})[_0xee8a('0x22')](function(_0x17a062){_0x377b35[_0xee8a('0x3f')]=_0x17a062;return _0x377b35;})['then'](respondWithFilteredResult(_0x238df5,_0x1a1219))[_0xee8a('0x40')](handleError(_0x238df5,null));};exports[_0xee8a('0x41')]=function(_0x31891e,_0x289b00){var _0x5c540b={'raw':!![],'where':{'id':_0x31891e[_0xee8a('0x42')]['id']}},_0x3fd20e={};_0x3fd20e['model']=_[_0xee8a('0x2c')](db[_0xee8a('0x3c')][_0xee8a('0x43')]);_0x3fd20e[_0xee8a('0x2d')]=_[_0xee8a('0x2c')](_0x31891e[_0xee8a('0x2d')]);_0x3fd20e[_0xee8a('0x2e')]=_[_0xee8a('0x30')](_0x3fd20e['model'],_0x3fd20e['query']);_0x5c540b[_0xee8a('0x2f')]=_[_0xee8a('0x30')](_0x3fd20e[_0xee8a('0x2b')],qs['fields'](_0x31891e[_0xee8a('0x2d')]['fields']));_0x5c540b['attributes']=_0x5c540b[_0xee8a('0x2f')]['length']?_0x5c540b['attributes']:_0x3fd20e[_0xee8a('0x2b')];if(_0x31891e[_0xee8a('0x2d')][_0xee8a('0x3d')]){_0x5c540b['include']=[{'all':!![]}];}_0x5c540b=_[_0xee8a('0x39')]({},_0x5c540b,_0x31891e[_0xee8a('0x3b')]);return db[_0xee8a('0x3c')]['find'](_0x5c540b)[_0xee8a('0x22')](handleEntityNotFound(_0x289b00,null))['then'](respondWithResult(_0x289b00,null))[_0xee8a('0x40')](handleError(_0x289b00,null));};exports['create']=function(_0x1549cd,_0x32b77b){return db['SquareMessage'][_0xee8a('0x44')](_0x1549cd[_0xee8a('0x45')],{})[_0xee8a('0x22')](respondWithResult(_0x32b77b,0xc9))[_0xee8a('0x40')](handleError(_0x32b77b,null));};exports['update']=function(_0x20d50d,_0x138bf0){if(_0x20d50d[_0xee8a('0x45')]['id']){delete _0x20d50d[_0xee8a('0x45')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x20d50d['params']['id']}})['then'](handleEntityNotFound(_0x138bf0,null))[_0xee8a('0x22')](saveUpdates(_0x20d50d[_0xee8a('0x45')],null))[_0xee8a('0x22')](respondWithResult(_0x138bf0,null))[_0xee8a('0x40')](handleError(_0x138bf0,null));};exports['destroy']=function(_0x3ff048,_0x3956f1){return db[_0xee8a('0x3c')][_0xee8a('0x46')]({'where':{'id':_0x3ff048[_0xee8a('0x42')]['id']}})[_0xee8a('0x22')](handleEntityNotFound(_0x3956f1,null))[_0xee8a('0x22')](removeEntity(_0x3956f1,null))['catch'](handleError(_0x3956f1,null));}; \ No newline at end of file +var _0x74ae=['ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','map','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','SquareMessage','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x5871f9,_0x28ccb7){var _0x8fd1c0=function(_0x510060){while(--_0x510060){_0x5871f9['push'](_0x5871f9['shift']());}};_0x8fd1c0(++_0x28ccb7);}(_0x74ae,0xc5));var _0xe74a=function(_0x5bd953,_0x307788){_0x5bd953=_0x5bd953-0x0;var _0x4ac021=_0x74ae[_0x5bd953];return _0x4ac021;};'use strict';var emlformat=require(_0xe74a('0x0'));var rimraf=require(_0xe74a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe74a('0x2'));var rp=require(_0xe74a('0x3'));var moment=require('moment');var BPromise=require(_0xe74a('0x4'));var Mustache=require(_0xe74a('0x5'));var util=require(_0xe74a('0x6'));var path=require(_0xe74a('0x7'));var sox=require(_0xe74a('0x8'));var csv=require(_0xe74a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe74a('0xa'));var _=require(_0xe74a('0xb'));var squel=require(_0xe74a('0xc'));var crypto=require(_0xe74a('0xd'));var jsforce=require(_0xe74a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe74a('0x9'));var querystring=require(_0xe74a('0xf'));var Papa=require('papaparse');var Redis=require(_0xe74a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe74a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe74a('0x12'));var logger=require('../../config/logger')(_0xe74a('0x13'));var utils=require('../../config/utils');var config=require(_0xe74a('0x14'));var licenseUtil=require(_0xe74a('0x15'));var db=require(_0xe74a('0x16'))['db'];function respondWithStatusCode(_0x4cb157,_0x4dac3f){_0x4dac3f=_0x4dac3f||0xcc;return function(_0x2b793d){if(_0x2b793d){return _0x4cb157[_0xe74a('0x17')](_0x4dac3f);}return _0x4cb157['status'](_0x4dac3f)['end']();};}function respondWithResult(_0x3c1c55,_0x4e7480){_0x4e7480=_0x4e7480||0xc8;return function(_0x4ee3a2){if(_0x4ee3a2){return _0x3c1c55[_0xe74a('0x18')](_0x4e7480)['json'](_0x4ee3a2);}};}function respondWithFilteredResult(_0x4dd5fa,_0x188130){return function(_0x527177){if(_0x527177){var _0x2fe47a=typeof _0x188130['offset']===_0xe74a('0x19')&&typeof _0x188130[_0xe74a('0x1a')]===_0xe74a('0x19');var _0x257281=_0x527177[_0xe74a('0x1b')];var _0x1ba9f=_0x2fe47a?0x0:_0x188130[_0xe74a('0x1c')];var _0x3eabdf=_0x2fe47a?_0x527177[_0xe74a('0x1b')]:_0x188130[_0xe74a('0x1c')]+_0x188130[_0xe74a('0x1a')];var _0x200c33;if(_0x3eabdf>=_0x257281){_0x3eabdf=_0x257281;_0x200c33=0xc8;}else{_0x200c33=0xce;}_0x4dd5fa[_0xe74a('0x18')](_0x200c33);return _0x4dd5fa[_0xe74a('0x1d')](_0xe74a('0x1e'),_0x1ba9f+'-'+_0x3eabdf+'/'+_0x257281)[_0xe74a('0x1f')](_0x527177);}return null;};}function patchUpdates(_0x44939e){return function(_0x337305){try{jsonpatch[_0xe74a('0x20')](_0x337305,_0x44939e,!![]);}catch(_0x2455ec){return BPromise[_0xe74a('0x21')](_0x2455ec);}return _0x337305[_0xe74a('0x22')]();};}function saveUpdates(_0xa09077,_0x5df418){return function(_0x5eec8d){if(_0x5eec8d){return _0x5eec8d[_0xe74a('0x23')](_0xa09077)[_0xe74a('0x24')](function(_0x4be78a){return _0x4be78a;});}return null;};}function removeEntity(_0x5c4703,_0x468352){return function(_0x37126b){if(_0x37126b){return _0x37126b[_0xe74a('0x25')]()['then'](function(){_0x5c4703[_0xe74a('0x18')](0xcc)[_0xe74a('0x26')]();});}};}function handleEntityNotFound(_0x2c997c,_0x34e739){return function(_0x7432d1){if(!_0x7432d1){_0x2c997c[_0xe74a('0x17')](0x194);}return _0x7432d1;};}function handleError(_0x261e69,_0x44e556){_0x44e556=_0x44e556||0x1f4;return function(_0x3124b9){logger[_0xe74a('0x27')](_0x3124b9['stack']);if(_0x3124b9[_0xe74a('0x28')]){delete _0x3124b9[_0xe74a('0x28')];}_0x261e69[_0xe74a('0x18')](_0x44e556)['send'](_0x3124b9);};}exports['index']=function(_0x2aa601,_0x1badd4){var _0x2f6533={},_0x4fa228={},_0x39b069={'count':0x0,'rows':[]};var _0x38d66c=_[_0xe74a('0x29')](db['SquareMessage'][_0xe74a('0x2a')],function(_0x119fe3){return{'name':_0x119fe3[_0xe74a('0x2b')],'type':_0x119fe3[_0xe74a('0x2c')]['key']};});_0x4fa228['model']=_[_0xe74a('0x29')](_0x38d66c,'name');_0x4fa228[_0xe74a('0x2d')]=_[_0xe74a('0x2e')](_0x2aa601[_0xe74a('0x2d')]);_0x4fa228['filters']=_[_0xe74a('0x2f')](_0x4fa228[_0xe74a('0x30')],_0x4fa228[_0xe74a('0x2d')]);_0x2f6533['attributes']=_[_0xe74a('0x2f')](_0x4fa228[_0xe74a('0x30')],qs[_0xe74a('0x31')](_0x2aa601[_0xe74a('0x2d')][_0xe74a('0x31')]));_0x2f6533[_0xe74a('0x32')]=_0x2f6533[_0xe74a('0x32')][_0xe74a('0x33')]?_0x2f6533[_0xe74a('0x32')]:_0x4fa228[_0xe74a('0x30')];if(!_0x2aa601[_0xe74a('0x2d')][_0xe74a('0x34')](_0xe74a('0x35'))){_0x2f6533[_0xe74a('0x1a')]=qs['limit'](_0x2aa601[_0xe74a('0x2d')][_0xe74a('0x1a')]);_0x2f6533['offset']=qs[_0xe74a('0x1c')](_0x2aa601[_0xe74a('0x2d')]['offset']);}_0x2f6533[_0xe74a('0x36')]=qs['sort'](_0x2aa601[_0xe74a('0x2d')][_0xe74a('0x37')]);_0x2f6533[_0xe74a('0x38')]=qs[_0xe74a('0x39')](_['pick'](_0x2aa601[_0xe74a('0x2d')],_0x4fa228[_0xe74a('0x39')]),_0x38d66c);if(_0x2aa601[_0xe74a('0x2d')][_0xe74a('0x3a')]){_0x2f6533[_0xe74a('0x38')]=_[_0xe74a('0x3b')](_0x2f6533[_0xe74a('0x38')],{'$or':_[_0xe74a('0x29')](_0x38d66c,function(_0x335ae5){if(_0x335ae5[_0xe74a('0x2c')]!==_0xe74a('0x3c')){var _0x3671a6={};_0x3671a6[_0x335ae5['name']]={'$like':'%'+_0x2aa601[_0xe74a('0x2d')][_0xe74a('0x3a')]+'%'};return _0x3671a6;}})});}_0x2f6533=_[_0xe74a('0x3b')]({},_0x2f6533,_0x2aa601['options']);var _0x6787ca={'where':_0x2f6533['where']};return db[_0xe74a('0x3d')][_0xe74a('0x1b')](_0x6787ca)[_0xe74a('0x24')](function(_0x160c64){_0x39b069['count']=_0x160c64;if(_0x2aa601[_0xe74a('0x2d')]['includeAll']){_0x2f6533['include']=[{'all':!![]}];}return db['SquareMessage'][_0xe74a('0x3e')](_0x2f6533);})[_0xe74a('0x24')](function(_0xa5b751){_0x39b069[_0xe74a('0x3f')]=_0xa5b751;return _0x39b069;})['then'](respondWithFilteredResult(_0x1badd4,_0x2f6533))[_0xe74a('0x40')](handleError(_0x1badd4,null));};exports[_0xe74a('0x41')]=function(_0x47b4dd,_0x356975){var _0x2ad836={'raw':!![],'where':{'id':_0x47b4dd[_0xe74a('0x42')]['id']}},_0x579778={};_0x579778[_0xe74a('0x30')]=_[_0xe74a('0x2e')](db[_0xe74a('0x3d')][_0xe74a('0x2a')]);_0x579778['query']=_[_0xe74a('0x2e')](_0x47b4dd['query']);_0x579778[_0xe74a('0x39')]=_[_0xe74a('0x2f')](_0x579778['model'],_0x579778[_0xe74a('0x2d')]);_0x2ad836[_0xe74a('0x32')]=_['intersection'](_0x579778[_0xe74a('0x30')],qs[_0xe74a('0x31')](_0x47b4dd[_0xe74a('0x2d')][_0xe74a('0x31')]));_0x2ad836[_0xe74a('0x32')]=_0x2ad836['attributes'][_0xe74a('0x33')]?_0x2ad836[_0xe74a('0x32')]:_0x579778[_0xe74a('0x30')];if(_0x47b4dd[_0xe74a('0x2d')]['includeAll']){_0x2ad836[_0xe74a('0x43')]=[{'all':!![]}];}_0x2ad836=_[_0xe74a('0x3b')]({},_0x2ad836,_0x47b4dd['options']);return db[_0xe74a('0x3d')]['find'](_0x2ad836)[_0xe74a('0x24')](handleEntityNotFound(_0x356975,null))['then'](respondWithResult(_0x356975,null))[_0xe74a('0x40')](handleError(_0x356975,null));};exports[_0xe74a('0x44')]=function(_0x2bed06,_0xe60d73){return db['SquareMessage']['create'](_0x2bed06[_0xe74a('0x45')],{})[_0xe74a('0x24')](respondWithResult(_0xe60d73,0xc9))['catch'](handleError(_0xe60d73,null));};exports[_0xe74a('0x23')]=function(_0x400bb9,_0x890360){if(_0x400bb9[_0xe74a('0x45')]['id']){delete _0x400bb9[_0xe74a('0x45')]['id'];}return db['SquareMessage'][_0xe74a('0x46')]({'where':{'id':_0x400bb9['params']['id']}})[_0xe74a('0x24')](handleEntityNotFound(_0x890360,null))[_0xe74a('0x24')](saveUpdates(_0x400bb9['body'],null))[_0xe74a('0x24')](respondWithResult(_0x890360,null))[_0xe74a('0x40')](handleError(_0x890360,null));};exports[_0xe74a('0x25')]=function(_0xdf195b,_0x44c6b2){return db['SquareMessage'][_0xe74a('0x46')]({'where':{'id':_0xdf195b[_0xe74a('0x42')]['id']}})[_0xe74a('0x24')](handleEntityNotFound(_0x44c6b2,null))[_0xe74a('0x24')](removeEntity(_0x44c6b2,null))[_0xe74a('0x40')](handleError(_0x44c6b2,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 3dcf241..bb1cf27 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 _0xbe87=['api','moment','request-promise','path','rimraf','./squareMessage.attributes','exports','define','square_messages','lodash','util','../../config/logger'];(function(_0x51257f,_0x398b9f){var _0x34bd3f=function(_0x494791){while(--_0x494791){_0x51257f['push'](_0x51257f['shift']());}};_0x34bd3f(++_0x398b9f);}(_0xbe87,0x75));var _0x7be8=function(_0x104512,_0x1388ee){_0x104512=_0x104512-0x0;var _0x513a4f=_0xbe87[_0x104512];return _0x513a4f;};'use strict';var _=require(_0x7be8('0x0'));var util=require(_0x7be8('0x1'));var logger=require(_0x7be8('0x2'))(_0x7be8('0x3'));var moment=require(_0x7be8('0x4'));var BPromise=require('bluebird');var rp=require(_0x7be8('0x5'));var fs=require('fs');var path=require(_0x7be8('0x6'));var rimraf=require(_0x7be8('0x7'));var config=require('../../config/environment');var attributes=require(_0x7be8('0x8'));module[_0x7be8('0x9')]=function(_0x24863f,_0x58f1c7){return _0x24863f[_0x7be8('0xa')]('SquareMessage',attributes,{'tableName':_0x7be8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3756=['SquareMessage','square_messages','lodash','../../config/logger','moment','request-promise','path','./squareMessage.attributes','define'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x3756,0x14f));var _0x6375=function(_0x4affcc,_0xfa2c5b){_0x4affcc=_0x4affcc-0x0;var _0x1776b5=_0x3756[_0x4affcc];return _0x1776b5;};'use strict';var _=require(_0x6375('0x0'));var util=require('util');var logger=require(_0x6375('0x1'))('api');var moment=require(_0x6375('0x2'));var BPromise=require('bluebird');var rp=require(_0x6375('0x3'));var fs=require('fs');var path=require(_0x6375('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6375('0x5'));module['exports']=function(_0x147dd4,_0x1f8832){return _0x147dd4[_0x6375('0x6')](_0x6375('0x7'),attributes,{'tableName':_0x6375('0x8'),'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 d0d702e..bec146b 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 _0x14c2=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','SquareMessage,\x20%s,\x20%s','result','catch','create','body','options','raw','CreateSquareMessage','debug','stringify','util','moment','bluebird'];(function(_0x1326de,_0x5adb99){var _0x5967c7=function(_0x331e2e){while(--_0x331e2e){_0x1326de['push'](_0x1326de['shift']());}};_0x5967c7(++_0x5adb99);}(_0x14c2,0x176));var _0x214c=function(_0x44f0c0,_0x32f867){_0x44f0c0=_0x44f0c0-0x0;var _0x3135ae=_0x14c2[_0x44f0c0];return _0x3135ae;};'use strict';var _=require('lodash');var util=require(_0x214c('0x0'));var moment=require(_0x214c('0x1'));var BPromise=require(_0x214c('0x2'));var rs=require(_0x214c('0x3'));var fs=require('fs');var Redis=require(_0x214c('0x4'));var db=require(_0x214c('0x5'))['db'];var utils=require(_0x214c('0x6'));var logger=require('../../config/logger')(_0x214c('0x7'));var config=require(_0x214c('0x8'));var jayson=require(_0x214c('0x9'));var client=jayson[_0x214c('0xa')][_0x214c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d724,_0x3aeaa6,_0x28dd31){return new BPromise(function(_0x5e390c,_0x3d73cb){return client['request'](_0x36d724,_0x28dd31)[_0x214c('0xc')](function(_0x4f4ca9){logger[_0x214c('0xd')]('SquareMessage,\x20%s,\x20%s',_0x3aeaa6,_0x214c('0xe'));logger['debug'](_0x214c('0xf'),_0x3aeaa6,'request\x20sent',JSON['stringify'](_0x4f4ca9));if(_0x4f4ca9[_0x214c('0x10')]){if(_0x4f4ca9['error'][_0x214c('0x11')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x3aeaa6,_0x4f4ca9[_0x214c('0x10')][_0x214c('0x12')]);return _0x3d73cb(_0x4f4ca9[_0x214c('0x10')]['message']);}logger[_0x214c('0x10')](_0x214c('0x13'),_0x3aeaa6,_0x4f4ca9[_0x214c('0x10')]['message']);return _0x5e390c(_0x4f4ca9['error'][_0x214c('0x12')]);}else{logger[_0x214c('0xd')](_0x214c('0x13'),_0x3aeaa6,_0x214c('0xe'));_0x5e390c(_0x4f4ca9[_0x214c('0x14')]['message']);}})[_0x214c('0x15')](function(_0x33f0f7){logger[_0x214c('0x10')]('SquareMessage,\x20%s,\x20%s',_0x3aeaa6,_0x33f0f7);_0x3d73cb(_0x33f0f7);});});}exports['CreateSquareMessage']=function(_0x38ff15){var _0x8d0757=this;return new Promise(function(_0x3ba8bd,_0x4244c8){return db['SquareMessage'][_0x214c('0x16')](_0x38ff15[_0x214c('0x17')],{'raw':_0x38ff15[_0x214c('0x18')]?_0x38ff15['options'][_0x214c('0x19')]===undefined?!![]:![]:!![]})[_0x214c('0xc')](function(_0x5a89cb){logger[_0x214c('0xd')](_0x214c('0x1a'),_0x38ff15);logger[_0x214c('0x1b')](_0x214c('0x1a'),_0x38ff15,JSON[_0x214c('0x1c')](_0x5a89cb));_0x3ba8bd(_0x5a89cb);})[_0x214c('0x15')](function(_0x349a9c){logger[_0x214c('0x10')]('CreateSquareMessage',_0x349a9c['message'],_0x38ff15);_0x4244c8(_0x8d0757[_0x214c('0x10')](0x1f4,_0x349a9c[_0x214c('0x12')]));});});}; \ No newline at end of file +var _0xdbf1=['stringify','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x5bab5e,_0xf263ef){var _0x3f885a=function(_0x1750c6){while(--_0x1750c6){_0x5bab5e['push'](_0x5bab5e['shift']());}};_0x3f885a(++_0xf263ef);}(_0xdbf1,0xed));var _0x1dbf=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0xdbf1[_0x342700];return _0x53406f;};'use strict';var _=require(_0x1dbf('0x0'));var util=require(_0x1dbf('0x1'));var moment=require('moment');var BPromise=require(_0x1dbf('0x2'));var rs=require(_0x1dbf('0x3'));var fs=require('fs');var Redis=require(_0x1dbf('0x4'));var db=require(_0x1dbf('0x5'))['db'];var utils=require(_0x1dbf('0x6'));var logger=require('../../config/logger')(_0x1dbf('0x7'));var config=require(_0x1dbf('0x8'));var jayson=require(_0x1dbf('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3bdef1,_0x593a99,_0x680371){return new BPromise(function(_0x149d14,_0x52f56a){return client['request'](_0x3bdef1,_0x680371)[_0x1dbf('0xa')](function(_0x2e67ab){logger['info'](_0x1dbf('0xb'),_0x593a99,_0x1dbf('0xc'));logger[_0x1dbf('0xd')](_0x1dbf('0xe'),_0x593a99,_0x1dbf('0xc'),JSON[_0x1dbf('0xf')](_0x2e67ab));if(_0x2e67ab[_0x1dbf('0x10')]){if(_0x2e67ab[_0x1dbf('0x10')][_0x1dbf('0x11')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x593a99,_0x2e67ab[_0x1dbf('0x10')][_0x1dbf('0x12')]);return _0x52f56a(_0x2e67ab[_0x1dbf('0x10')][_0x1dbf('0x12')]);}logger[_0x1dbf('0x10')](_0x1dbf('0xb'),_0x593a99,_0x2e67ab['error']['message']);return _0x149d14(_0x2e67ab[_0x1dbf('0x10')][_0x1dbf('0x12')]);}else{logger[_0x1dbf('0x13')](_0x1dbf('0xb'),_0x593a99,'request\x20sent');_0x149d14(_0x2e67ab[_0x1dbf('0x14')][_0x1dbf('0x12')]);}})[_0x1dbf('0x15')](function(_0x5bf7e6){logger[_0x1dbf('0x10')](_0x1dbf('0xb'),_0x593a99,_0x5bf7e6);_0x52f56a(_0x5bf7e6);});});}exports[_0x1dbf('0x16')]=function(_0x1e4ffe){var _0x231f18=this;return new Promise(function(_0x2c7aec,_0x462ee5){return db[_0x1dbf('0x17')][_0x1dbf('0x18')](_0x1e4ffe[_0x1dbf('0x19')],{'raw':_0x1e4ffe['options']?_0x1e4ffe[_0x1dbf('0x1a')][_0x1dbf('0x1b')]===undefined?!![]:![]:!![]})[_0x1dbf('0xa')](function(_0x5ffb19){logger[_0x1dbf('0x13')]('CreateSquareMessage',_0x1e4ffe);logger[_0x1dbf('0xd')](_0x1dbf('0x16'),_0x1e4ffe,JSON['stringify'](_0x5ffb19));_0x2c7aec(_0x5ffb19);})[_0x1dbf('0x15')](function(_0x30e7d4){logger[_0x1dbf('0x10')](_0x1dbf('0x16'),_0x30e7d4[_0x1dbf('0x12')],_0x1e4ffe);_0x462ee5(_0x231f18[_0x1dbf('0x10')](0x1f4,_0x30e7d4[_0x1dbf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 562ad3e..5079ad3 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 _0xce3e=['get','isAuthenticated','index','/:id','show','15s','test','post','create','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0xee7bd8,_0x281b38){var _0x295961=function(_0x1f9605){while(--_0x1f9605){_0xee7bd8['push'](_0xee7bd8['shift']());}};_0x295961(++_0x281b38);}(_0xce3e,0x1d9));var _0xece3=function(_0x4222de,_0x567252){_0x4222de=_0x4222de-0x0;var _0x1ff142=_0xce3e[_0x4222de];return _0x1ff142;};'use strict';var multer=require(_0xece3('0x0'));var util=require(_0xece3('0x1'));var path=require(_0xece3('0x2'));var timeout=require(_0xece3('0x3'));var express=require(_0xece3('0x4'));var router=express['Router']();var fs_extra=require(_0xece3('0x5'));var auth=require(_0xece3('0x6'));var interaction=require(_0xece3('0x7'));var config=require(_0xece3('0x8'));var controller=require(_0xece3('0x9'));router[_0xece3('0xa')]('/',auth[_0xece3('0xb')](),controller[_0xece3('0xc')]);router[_0xece3('0xa')](_0xece3('0xd'),auth[_0xece3('0xb')](),controller[_0xece3('0xe')]);router[_0xece3('0xa')]('/:id/test',auth[_0xece3('0xb')](),timeout(_0xece3('0xf')),controller[_0xece3('0x10')]);router[_0xece3('0x11')]('/',auth[_0xece3('0xb')](),controller[_0xece3('0x12')]);router['put']('/:id',auth[_0xece3('0xb')](),controller[_0xece3('0x13')]);router['delete'](_0xece3('0xd'),auth[_0xece3('0xb')](),controller[_0xece3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x30eb=['fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','/:id/test','15s','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x2eb6d0,_0x4880f1){var _0x43c041=function(_0x10fa5d){while(--_0x10fa5d){_0x2eb6d0['push'](_0x2eb6d0['shift']());}};_0x43c041(++_0x4880f1);}(_0x30eb,0x7f));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xb30e('0x0'));var path=require(_0xb30e('0x1'));var timeout=require(_0xb30e('0x2'));var express=require(_0xb30e('0x3'));var router=express[_0xb30e('0x4')]();var fs_extra=require(_0xb30e('0x5'));var auth=require(_0xb30e('0x6'));var interaction=require(_0xb30e('0x7'));var config=require('../../config/environment');var controller=require(_0xb30e('0x8'));router['get']('/',auth[_0xb30e('0x9')](),controller[_0xb30e('0xa')]);router[_0xb30e('0xb')](_0xb30e('0xc'),auth[_0xb30e('0x9')](),controller[_0xb30e('0xd')]);router[_0xb30e('0xb')](_0xb30e('0xe'),auth['isAuthenticated'](),timeout(_0xb30e('0xf')),controller['test']);router[_0xb30e('0x10')]('/',auth[_0xb30e('0x9')](),controller['create']);router[_0xb30e('0x11')](_0xb30e('0xc'),auth[_0xb30e('0x9')](),controller[_0xb30e('0x12')]);router[_0xb30e('0x13')]('/:id',auth[_0xb30e('0x9')](),controller[_0xb30e('0x14')]);module[_0xb30e('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index ac79eff..e6b076a 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 _0xb3ab=['exports','STRING','name','sequelize'];(function(_0xb3820,_0x34e82c){var _0x43bf92=function(_0x51eccc){while(--_0x51eccc){_0xb3820['push'](_0xb3820['shift']());}};_0x43bf92(++_0x34e82c);}(_0xb3ab,0x73));var _0xbb3a=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0xb3ab[_0x4c260a];return _0x17bbdd;};'use strict';var Sequelize=require(_0xbb3a('0x0'));module[_0xbb3a('0x1')]={'name':{'type':Sequelize[_0xbb3a('0x2')],'unique':_0xbb3a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x97ee=['exports','STRING','name'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x97ee,0x198));var _0xe97e=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x97ee[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require('sequelize');module[_0xe97e('0x0')]={'name':{'type':Sequelize[_0xe97e('0x1')],'unique':_0xe97e('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe97e('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5dbd238..102c714 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 _0x3330=['merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ODBC','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x24b0ab,_0x19de60){var _0x12112c=function(_0x3977d9){while(--_0x3977d9){_0x24b0ab['push'](_0x24b0ab['shift']());}};_0x12112c(++_0x19de60);}(_0x3330,0xd1));var _0x0333=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x3330[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0333('0x0'));var zipdir=require(_0x0333('0x1'));var jsonpatch=require(_0x0333('0x2'));var rp=require('request-promise');var moment=require(_0x0333('0x3'));var BPromise=require(_0x0333('0x4'));var Mustache=require(_0x0333('0x5'));var util=require(_0x0333('0x6'));var path=require(_0x0333('0x7'));var sox=require(_0x0333('0x8'));var csv=require(_0x0333('0x9'));var ejs=require(_0x0333('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0333('0xb'));var squel=require('squel');var crypto=require(_0x0333('0xc'));var jsforce=require(_0x0333('0xd'));var deskjs=require(_0x0333('0xe'));var toCsv=require(_0x0333('0x9'));var querystring=require(_0x0333('0xf'));var Papa=require(_0x0333('0x10'));var Redis=require(_0x0333('0x11'));var authService=require(_0x0333('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0333('0x13'));var hardwareService=require(_0x0333('0x14'));var logger=require(_0x0333('0x15'))(_0x0333('0x16'));var utils=require(_0x0333('0x17'));var config=require(_0x0333('0x18'));var licenseUtil=require(_0x0333('0x19'));var db=require(_0x0333('0x1a'))['db'];function respondWithStatusCode(_0xdbdc59,_0x24151f){_0x24151f=_0x24151f||0xcc;return function(_0x539539){if(_0x539539){return _0xdbdc59[_0x0333('0x1b')](_0x24151f);}return _0xdbdc59[_0x0333('0x1c')](_0x24151f)[_0x0333('0x1d')]();};}function respondWithResult(_0x330fac,_0x56bee2){_0x56bee2=_0x56bee2||0xc8;return function(_0x3e4120){if(_0x3e4120){return _0x330fac[_0x0333('0x1c')](_0x56bee2)[_0x0333('0x1e')](_0x3e4120);}};}function respondWithFilteredResult(_0xf74d44,_0x2d5f2f){return function(_0x5c3b49){if(_0x5c3b49){var _0x2ff3f5=typeof _0x2d5f2f[_0x0333('0x1f')]===_0x0333('0x20')&&typeof _0x2d5f2f['limit']===_0x0333('0x20');var _0xa99fb7=_0x5c3b49[_0x0333('0x21')];var _0x19ccca=_0x2ff3f5?0x0:_0x2d5f2f[_0x0333('0x1f')];var _0x54241b=_0x2ff3f5?_0x5c3b49[_0x0333('0x21')]:_0x2d5f2f[_0x0333('0x1f')]+_0x2d5f2f[_0x0333('0x22')];var _0x595640;if(_0x54241b>=_0xa99fb7){_0x54241b=_0xa99fb7;_0x595640=0xc8;}else{_0x595640=0xce;}_0xf74d44[_0x0333('0x1c')](_0x595640);return _0xf74d44[_0x0333('0x23')]('Content-Range',_0x19ccca+'-'+_0x54241b+'/'+_0xa99fb7)[_0x0333('0x1e')](_0x5c3b49);}return null;};}function patchUpdates(_0x296992){return function(_0x34c870){try{jsonpatch[_0x0333('0x24')](_0x34c870,_0x296992,!![]);}catch(_0x3bd49b){return BPromise['reject'](_0x3bd49b);}return _0x34c870[_0x0333('0x25')]();};}function saveUpdates(_0x5e2306,_0x4cb86a){return function(_0x3d7270){if(_0x3d7270){return _0x3d7270[_0x0333('0x26')](_0x5e2306)[_0x0333('0x27')](function(_0x3ce7a0){return _0x3ce7a0;});}return null;};}function removeEntity(_0x3ac633,_0x3904ff){return function(_0xcfede8){if(_0xcfede8){return _0xcfede8['destroy']()['then'](function(){var _0x512246=_0xcfede8[_0x0333('0x28')]({'plain':!![]});var _0xb563a7='ODBC';return db[_0x0333('0x29')][_0x0333('0x2a')]({'where':{'type':_0xb563a7,'resourceId':_0x512246['id']}})['then'](function(){return _0xcfede8;});})['then'](function(){_0x3ac633[_0x0333('0x1c')](0xcc)[_0x0333('0x1d')]();});}};}function handleEntityNotFound(_0xfba6a5,_0x435316){return function(_0x1cb375){if(!_0x1cb375){_0xfba6a5[_0x0333('0x1b')](0x194);}return _0x1cb375;};}function handleError(_0x5d6d14,_0x3f5d04){_0x3f5d04=_0x3f5d04||0x1f4;return function(_0xde87fc){logger[_0x0333('0x2b')](_0xde87fc[_0x0333('0x2c')]);if(_0xde87fc[_0x0333('0x2d')]){delete _0xde87fc['name'];}_0x5d6d14[_0x0333('0x1c')](_0x3f5d04)[_0x0333('0x2e')](_0xde87fc);};}exports['index']=function(_0x20ffd4,_0x3239f7){var _0x21d22a={},_0x317643={},_0x21ee52={'count':0x0,'rows':[]};var _0x526b24=_[_0x0333('0x2f')](db[_0x0333('0x30')][_0x0333('0x31')],function(_0xc18a95){return{'name':_0xc18a95[_0x0333('0x32')],'type':_0xc18a95['type'][_0x0333('0x33')]};});_0x317643[_0x0333('0x34')]=_['map'](_0x526b24,'name');_0x317643[_0x0333('0x35')]=_[_0x0333('0x36')](_0x20ffd4['query']);_0x317643[_0x0333('0x37')]=_[_0x0333('0x38')](_0x317643[_0x0333('0x34')],_0x317643[_0x0333('0x35')]);_0x21d22a[_0x0333('0x39')]=_['intersection'](_0x317643[_0x0333('0x34')],qs[_0x0333('0x3a')](_0x20ffd4[_0x0333('0x35')][_0x0333('0x3a')]));_0x21d22a[_0x0333('0x39')]=_0x21d22a[_0x0333('0x39')][_0x0333('0x3b')]?_0x21d22a[_0x0333('0x39')]:_0x317643[_0x0333('0x34')];if(!_0x20ffd4['query'][_0x0333('0x3c')](_0x0333('0x3d'))){_0x21d22a[_0x0333('0x22')]=qs[_0x0333('0x22')](_0x20ffd4[_0x0333('0x35')][_0x0333('0x22')]);_0x21d22a['offset']=qs[_0x0333('0x1f')](_0x20ffd4[_0x0333('0x35')][_0x0333('0x1f')]);}_0x21d22a[_0x0333('0x3e')]=qs[_0x0333('0x3f')](_0x20ffd4['query'][_0x0333('0x3f')]);_0x21d22a[_0x0333('0x40')]=qs[_0x0333('0x37')](_[_0x0333('0x41')](_0x20ffd4[_0x0333('0x35')],_0x317643['filters']),_0x526b24);if(_0x20ffd4[_0x0333('0x35')][_0x0333('0x42')]){_0x21d22a[_0x0333('0x40')]=_[_0x0333('0x43')](_0x21d22a['where'],{'$or':_['map'](_0x526b24,function(_0x4212c0){if(_0x4212c0[_0x0333('0x44')]!==_0x0333('0x45')){var _0xb97abe={};_0xb97abe[_0x4212c0[_0x0333('0x2d')]]={'$like':'%'+_0x20ffd4[_0x0333('0x35')]['filter']+'%'};return _0xb97abe;}})});}_0x21d22a=_[_0x0333('0x43')]({},_0x21d22a,_0x20ffd4[_0x0333('0x46')]);var _0x3991e0={'where':_0x21d22a['where']};return db[_0x0333('0x30')][_0x0333('0x21')](_0x3991e0)[_0x0333('0x27')](function(_0x1a97c6){_0x21ee52[_0x0333('0x21')]=_0x1a97c6;if(_0x20ffd4[_0x0333('0x35')][_0x0333('0x47')]){_0x21d22a[_0x0333('0x48')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x21d22a);})['then'](function(_0x59b05c){_0x21ee52[_0x0333('0x49')]=_0x59b05c;return _0x21ee52;})[_0x0333('0x27')](respondWithFilteredResult(_0x3239f7,_0x21d22a))[_0x0333('0x4a')](handleError(_0x3239f7,null));};exports[_0x0333('0x4b')]=function(_0x34ffe9,_0x2fa93a){var _0x2a2891={'raw':!![],'where':{'id':_0x34ffe9[_0x0333('0x4c')]['id']}},_0x224a07={};_0x224a07['model']=_[_0x0333('0x36')](db[_0x0333('0x30')]['rawAttributes']);_0x224a07[_0x0333('0x35')]=_[_0x0333('0x36')](_0x34ffe9['query']);_0x224a07[_0x0333('0x37')]=_[_0x0333('0x38')](_0x224a07[_0x0333('0x34')],_0x224a07['query']);_0x2a2891[_0x0333('0x39')]=_['intersection'](_0x224a07[_0x0333('0x34')],qs[_0x0333('0x3a')](_0x34ffe9['query'][_0x0333('0x3a')]));_0x2a2891['attributes']=_0x2a2891[_0x0333('0x39')][_0x0333('0x3b')]?_0x2a2891[_0x0333('0x39')]:_0x224a07[_0x0333('0x34')];if(_0x34ffe9['query'][_0x0333('0x47')]){_0x2a2891[_0x0333('0x48')]=[{'all':!![]}];}_0x2a2891=_[_0x0333('0x43')]({},_0x2a2891,_0x34ffe9['options']);return db['SquareOdbc']['find'](_0x2a2891)[_0x0333('0x27')](handleEntityNotFound(_0x2fa93a,null))['then'](respondWithResult(_0x2fa93a,null))['catch'](handleError(_0x2fa93a,null));};exports['create']=function(_0x1676fb,_0x41f3aa){return db[_0x0333('0x30')][_0x0333('0x4d')](_0x1676fb[_0x0333('0x4e')],{})[_0x0333('0x27')](function(_0x155369){var _0x3c4ff0=_0x1676fb['user'][_0x0333('0x28')]({'plain':!![]});if(!_0x3c4ff0)throw new Error(_0x0333('0x4f'));if(_0x3c4ff0[_0x0333('0x50')]===_0x0333('0x51')){var _0x32b9eb=_0x155369[_0x0333('0x28')]({'plain':!![]});var _0x36901e=_0x0333('0x52');return db['UserProfileSection'][_0x0333('0x53')]({'where':{'name':_0x36901e,'userProfileId':_0x3c4ff0[_0x0333('0x54')]},'raw':!![]})[_0x0333('0x27')](function(_0x122f18){if(_0x122f18&&_0x122f18[_0x0333('0x55')]===0x0){return db[_0x0333('0x29')]['create']({'name':_0x32b9eb[_0x0333('0x2d')],'resourceId':_0x32b9eb['id'],'type':_0x122f18[_0x0333('0x2d')],'sectionId':_0x122f18['id']},{})['then'](function(){return _0x155369;});}else{return _0x155369;}})[_0x0333('0x4a')](function(_0x30853a){logger[_0x0333('0x2b')](_0x0333('0x56'),_0x30853a);throw _0x30853a;});}return _0x155369;})[_0x0333('0x27')](respondWithResult(_0x41f3aa,0xc9))[_0x0333('0x4a')](handleError(_0x41f3aa,null));};exports[_0x0333('0x26')]=function(_0x3464fa,_0x41e9be){if(_0x3464fa['body']['id']){delete _0x3464fa['body']['id'];}return db[_0x0333('0x30')][_0x0333('0x53')]({'where':{'id':_0x3464fa[_0x0333('0x4c')]['id']}})[_0x0333('0x27')](handleEntityNotFound(_0x41e9be,null))['then'](saveUpdates(_0x3464fa[_0x0333('0x4e')],null))[_0x0333('0x27')](respondWithResult(_0x41e9be,null))[_0x0333('0x4a')](handleError(_0x41e9be,null));};exports[_0x0333('0x2a')]=function(_0x3658ba,_0x1c816d){return db[_0x0333('0x30')][_0x0333('0x53')]({'where':{'id':_0x3658ba['params']['id']}})['then'](handleEntityNotFound(_0x1c816d,null))[_0x0333('0x27')](removeEntity(_0x1c816d,null))[_0x0333('0x4a')](handleError(_0x1c816d,null));};exports[_0x0333('0x57')]=function(_0x2778d3,_0x2f5185,_0x16ce3f){var _0x343ee8;return db[_0x0333('0x30')][_0x0333('0x53')]({'where':{'id':_0x2778d3['params']['id']},'attributes':['id',_0x0333('0x58')]})[_0x0333('0x27')](handleEntityNotFound(_0x2f5185,null))[_0x0333('0x27')](function(_0x2268cc){if(_0x2268cc){var _0x21f4b3=require(_0x0333('0x59'))();_0x21f4b3[_0x0333('0x5a')](_0x2268cc['dsn']);_0x21f4b3[_0x0333('0x5b')]();return _0x2268cc;}})['then'](respondWithResult(_0x2f5185,null))[_0x0333('0x4a')](handleError(_0x2f5185,null));}; \ No newline at end of file +var _0xd710=['show','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','name','send','map','SquareOdbc','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch'];(function(_0x253daf,_0x6fe93b){var _0x2932ae=function(_0x4488b5){while(--_0x4488b5){_0x253daf['push'](_0x253daf['shift']());}};_0x2932ae(++_0x6fe93b);}(_0xd710,0x171));var _0x0d71=function(_0x1cbd2e,_0x1af575){_0x1cbd2e=_0x1cbd2e-0x0;var _0x36aa24=_0xd710[_0x1cbd2e];return _0x36aa24;};'use strict';var emlformat=require(_0x0d71('0x0'));var rimraf=require(_0x0d71('0x1'));var zipdir=require(_0x0d71('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d71('0x3'));var moment=require(_0x0d71('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0d71('0x5'));var util=require(_0x0d71('0x6'));var path=require(_0x0d71('0x7'));var sox=require(_0x0d71('0x8'));var csv=require(_0x0d71('0x9'));var ejs=require(_0x0d71('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0d71('0xb'));var squel=require(_0x0d71('0xc'));var crypto=require(_0x0d71('0xd'));var jsforce=require(_0x0d71('0xe'));var deskjs=require(_0x0d71('0xf'));var toCsv=require(_0x0d71('0x9'));var querystring=require(_0x0d71('0x10'));var Papa=require(_0x0d71('0x11'));var Redis=require('ioredis');var authService=require(_0x0d71('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0d71('0x13'));var hardwareService=require(_0x0d71('0x14'));var logger=require(_0x0d71('0x15'))(_0x0d71('0x16'));var utils=require('../../config/utils');var config=require(_0x0d71('0x17'));var licenseUtil=require(_0x0d71('0x18'));var db=require(_0x0d71('0x19'))['db'];function respondWithStatusCode(_0x249697,_0x2e768e){_0x2e768e=_0x2e768e||0xcc;return function(_0x1507bd){if(_0x1507bd){return _0x249697[_0x0d71('0x1a')](_0x2e768e);}return _0x249697['status'](_0x2e768e)[_0x0d71('0x1b')]();};}function respondWithResult(_0xd07a7d,_0x1b9ef6){_0x1b9ef6=_0x1b9ef6||0xc8;return function(_0x2211b7){if(_0x2211b7){return _0xd07a7d[_0x0d71('0x1c')](_0x1b9ef6)['json'](_0x2211b7);}};}function respondWithFilteredResult(_0x54e1fc,_0x31577b){return function(_0x7ea392){if(_0x7ea392){var _0x453cec=typeof _0x31577b[_0x0d71('0x1d')]===_0x0d71('0x1e')&&typeof _0x31577b[_0x0d71('0x1f')]==='undefined';var _0x5af129=_0x7ea392[_0x0d71('0x20')];var _0x5a2b6a=_0x453cec?0x0:_0x31577b[_0x0d71('0x1d')];var _0x1774aa=_0x453cec?_0x7ea392[_0x0d71('0x20')]:_0x31577b[_0x0d71('0x1d')]+_0x31577b[_0x0d71('0x1f')];var _0x1c836e;if(_0x1774aa>=_0x5af129){_0x1774aa=_0x5af129;_0x1c836e=0xc8;}else{_0x1c836e=0xce;}_0x54e1fc[_0x0d71('0x1c')](_0x1c836e);return _0x54e1fc[_0x0d71('0x21')]('Content-Range',_0x5a2b6a+'-'+_0x1774aa+'/'+_0x5af129)[_0x0d71('0x22')](_0x7ea392);}return null;};}function patchUpdates(_0x10282a){return function(_0x1da922){try{jsonpatch[_0x0d71('0x23')](_0x1da922,_0x10282a,!![]);}catch(_0x1c7c60){return BPromise[_0x0d71('0x24')](_0x1c7c60);}return _0x1da922[_0x0d71('0x25')]();};}function saveUpdates(_0x49429d,_0x431a70){return function(_0x2a84ee){if(_0x2a84ee){return _0x2a84ee[_0x0d71('0x26')](_0x49429d)[_0x0d71('0x27')](function(_0x4507a3){return _0x4507a3;});}return null;};}function removeEntity(_0x9c7ad5,_0xdb9169){return function(_0x425648){if(_0x425648){return _0x425648[_0x0d71('0x28')]()[_0x0d71('0x27')](function(){var _0x44ca5b=_0x425648[_0x0d71('0x29')]({'plain':!![]});var _0x5bfc1c=_0x0d71('0x2a');return db[_0x0d71('0x2b')][_0x0d71('0x28')]({'where':{'type':_0x5bfc1c,'resourceId':_0x44ca5b['id']}})[_0x0d71('0x27')](function(){return _0x425648;});})[_0x0d71('0x27')](function(){_0x9c7ad5[_0x0d71('0x1c')](0xcc)[_0x0d71('0x1b')]();});}};}function handleEntityNotFound(_0x5f5d7d,_0x5c88a8){return function(_0xb90812){if(!_0xb90812){_0x5f5d7d[_0x0d71('0x1a')](0x194);}return _0xb90812;};}function handleError(_0x3f250b,_0x5ef9b4){_0x5ef9b4=_0x5ef9b4||0x1f4;return function(_0x24bfab){logger['error'](_0x24bfab['stack']);if(_0x24bfab[_0x0d71('0x2c')]){delete _0x24bfab[_0x0d71('0x2c')];}_0x3f250b[_0x0d71('0x1c')](_0x5ef9b4)[_0x0d71('0x2d')](_0x24bfab);};}exports['index']=function(_0x3c9e1a,_0x3d6079){var _0x33881b={},_0x2e2e4c={},_0xbc97f4={'count':0x0,'rows':[]};var _0x5c5c97=_[_0x0d71('0x2e')](db[_0x0d71('0x2f')]['rawAttributes'],function(_0x29dd98){return{'name':_0x29dd98[_0x0d71('0x30')],'type':_0x29dd98[_0x0d71('0x31')][_0x0d71('0x32')]};});_0x2e2e4c[_0x0d71('0x33')]=_[_0x0d71('0x2e')](_0x5c5c97,'name');_0x2e2e4c['query']=_[_0x0d71('0x34')](_0x3c9e1a[_0x0d71('0x35')]);_0x2e2e4c['filters']=_[_0x0d71('0x36')](_0x2e2e4c[_0x0d71('0x33')],_0x2e2e4c[_0x0d71('0x35')]);_0x33881b[_0x0d71('0x37')]=_[_0x0d71('0x36')](_0x2e2e4c[_0x0d71('0x33')],qs[_0x0d71('0x38')](_0x3c9e1a[_0x0d71('0x35')][_0x0d71('0x38')]));_0x33881b[_0x0d71('0x37')]=_0x33881b[_0x0d71('0x37')][_0x0d71('0x39')]?_0x33881b[_0x0d71('0x37')]:_0x2e2e4c[_0x0d71('0x33')];if(!_0x3c9e1a[_0x0d71('0x35')]['hasOwnProperty'](_0x0d71('0x3a'))){_0x33881b[_0x0d71('0x1f')]=qs[_0x0d71('0x1f')](_0x3c9e1a['query']['limit']);_0x33881b['offset']=qs[_0x0d71('0x1d')](_0x3c9e1a[_0x0d71('0x35')][_0x0d71('0x1d')]);}_0x33881b['order']=qs[_0x0d71('0x3b')](_0x3c9e1a['query'][_0x0d71('0x3b')]);_0x33881b[_0x0d71('0x3c')]=qs['filters'](_[_0x0d71('0x3d')](_0x3c9e1a[_0x0d71('0x35')],_0x2e2e4c[_0x0d71('0x3e')]),_0x5c5c97);if(_0x3c9e1a['query'][_0x0d71('0x3f')]){_0x33881b[_0x0d71('0x3c')]=_[_0x0d71('0x40')](_0x33881b[_0x0d71('0x3c')],{'$or':_['map'](_0x5c5c97,function(_0x3768f1){if(_0x3768f1[_0x0d71('0x31')]!==_0x0d71('0x41')){var _0x1a1250={};_0x1a1250[_0x3768f1[_0x0d71('0x2c')]]={'$like':'%'+_0x3c9e1a['query'][_0x0d71('0x3f')]+'%'};return _0x1a1250;}})});}_0x33881b=_[_0x0d71('0x40')]({},_0x33881b,_0x3c9e1a[_0x0d71('0x42')]);var _0x474307={'where':_0x33881b[_0x0d71('0x3c')]};return db[_0x0d71('0x2f')][_0x0d71('0x20')](_0x474307)[_0x0d71('0x27')](function(_0x4af127){_0xbc97f4[_0x0d71('0x20')]=_0x4af127;if(_0x3c9e1a[_0x0d71('0x35')]['includeAll']){_0x33881b[_0x0d71('0x43')]=[{'all':!![]}];}return db[_0x0d71('0x2f')][_0x0d71('0x44')](_0x33881b);})[_0x0d71('0x27')](function(_0x44d17d){_0xbc97f4[_0x0d71('0x45')]=_0x44d17d;return _0xbc97f4;})[_0x0d71('0x27')](respondWithFilteredResult(_0x3d6079,_0x33881b))[_0x0d71('0x46')](handleError(_0x3d6079,null));};exports[_0x0d71('0x47')]=function(_0x3dd476,_0x20424f){var _0x3cf688={'raw':!![],'where':{'id':_0x3dd476[_0x0d71('0x48')]['id']}},_0xbd7ff={};_0xbd7ff[_0x0d71('0x33')]=_[_0x0d71('0x34')](db[_0x0d71('0x2f')][_0x0d71('0x49')]);_0xbd7ff[_0x0d71('0x35')]=_['keys'](_0x3dd476['query']);_0xbd7ff[_0x0d71('0x3e')]=_[_0x0d71('0x36')](_0xbd7ff[_0x0d71('0x33')],_0xbd7ff[_0x0d71('0x35')]);_0x3cf688[_0x0d71('0x37')]=_[_0x0d71('0x36')](_0xbd7ff['model'],qs[_0x0d71('0x38')](_0x3dd476[_0x0d71('0x35')][_0x0d71('0x38')]));_0x3cf688[_0x0d71('0x37')]=_0x3cf688[_0x0d71('0x37')]['length']?_0x3cf688['attributes']:_0xbd7ff[_0x0d71('0x33')];if(_0x3dd476[_0x0d71('0x35')]['includeAll']){_0x3cf688['include']=[{'all':!![]}];}_0x3cf688=_[_0x0d71('0x40')]({},_0x3cf688,_0x3dd476[_0x0d71('0x42')]);return db[_0x0d71('0x2f')][_0x0d71('0x4a')](_0x3cf688)[_0x0d71('0x27')](handleEntityNotFound(_0x20424f,null))[_0x0d71('0x27')](respondWithResult(_0x20424f,null))['catch'](handleError(_0x20424f,null));};exports[_0x0d71('0x4b')]=function(_0x5389b0,_0x40d6a0){return db[_0x0d71('0x2f')][_0x0d71('0x4b')](_0x5389b0[_0x0d71('0x4c')],{})['then'](function(_0x2565bf){var _0x3b130d=_0x5389b0['user'][_0x0d71('0x29')]({'plain':!![]});if(!_0x3b130d)throw new Error(_0x0d71('0x4d'));if(_0x3b130d[_0x0d71('0x4e')]===_0x0d71('0x4f')){var _0x246731=_0x2565bf[_0x0d71('0x29')]({'plain':!![]});var _0x250e6b=_0x0d71('0x2a');return db[_0x0d71('0x50')]['find']({'where':{'name':_0x250e6b,'userProfileId':_0x3b130d['userProfileId']},'raw':!![]})['then'](function(_0x37d107){if(_0x37d107&&_0x37d107[_0x0d71('0x51')]===0x0){return db[_0x0d71('0x2b')][_0x0d71('0x4b')]({'name':_0x246731['name'],'resourceId':_0x246731['id'],'type':_0x37d107[_0x0d71('0x2c')],'sectionId':_0x37d107['id']},{})['then'](function(){return _0x2565bf;});}else{return _0x2565bf;}})[_0x0d71('0x46')](function(_0x7a021d){logger[_0x0d71('0x52')](_0x0d71('0x53'),_0x7a021d);throw _0x7a021d;});}return _0x2565bf;})[_0x0d71('0x27')](respondWithResult(_0x40d6a0,0xc9))[_0x0d71('0x46')](handleError(_0x40d6a0,null));};exports[_0x0d71('0x26')]=function(_0x3245e0,_0x2f1ac7){if(_0x3245e0['body']['id']){delete _0x3245e0[_0x0d71('0x4c')]['id'];}return db['SquareOdbc'][_0x0d71('0x4a')]({'where':{'id':_0x3245e0[_0x0d71('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f1ac7,null))[_0x0d71('0x27')](saveUpdates(_0x3245e0[_0x0d71('0x4c')],null))[_0x0d71('0x27')](respondWithResult(_0x2f1ac7,null))[_0x0d71('0x46')](handleError(_0x2f1ac7,null));};exports[_0x0d71('0x28')]=function(_0x2155dd,_0x40bbec){return db[_0x0d71('0x2f')][_0x0d71('0x4a')]({'where':{'id':_0x2155dd[_0x0d71('0x48')]['id']}})['then'](handleEntityNotFound(_0x40bbec,null))[_0x0d71('0x27')](removeEntity(_0x40bbec,null))['catch'](handleError(_0x40bbec,null));};exports[_0x0d71('0x54')]=function(_0x1a893f,_0x233520,_0x1dc5ad){var _0x163cde;return db[_0x0d71('0x2f')][_0x0d71('0x4a')]({'where':{'id':_0x1a893f[_0x0d71('0x48')]['id']},'attributes':['id',_0x0d71('0x55')]})[_0x0d71('0x27')](handleEntityNotFound(_0x233520,null))[_0x0d71('0x27')](function(_0x523f14){if(_0x523f14){var _0x22f001=require(_0x0d71('0x56'))();_0x22f001['openSync'](_0x523f14['dsn']);_0x22f001[_0x0d71('0x57')]();return _0x523f14;}})[_0x0d71('0x27')](respondWithResult(_0x233520,null))['catch'](handleError(_0x233520,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6e90eed..e6fcda3 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 _0xa870=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','request-promise','../../config/environment'];(function(_0x3220c3,_0xd4c06){var _0x1bfcfa=function(_0x227bb4){while(--_0x227bb4){_0x3220c3['push'](_0x3220c3['shift']());}};_0x1bfcfa(++_0xd4c06);}(_0xa870,0x165));var _0x0a87=function(_0x153cd7,_0x5b1625){_0x153cd7=_0x153cd7-0x0;var _0x16e8af=_0xa870[_0x153cd7];return _0x16e8af;};'use strict';var _=require(_0x0a87('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0a87('0x1'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0a87('0x2'));var attributes=require(_0x0a87('0x3'));module[_0x0a87('0x4')]=function(_0x3eac9f,_0x1166ae){return _0x3eac9f[_0x0a87('0x5')](_0x0a87('0x6'),attributes,{'tableName':_0x0a87('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56c4=['bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','../../config/logger','api','moment'];(function(_0x15385d,_0x155bb5){var _0x14612f=function(_0x59550c){while(--_0x59550c){_0x15385d['push'](_0x15385d['shift']());}};_0x14612f(++_0x155bb5);}(_0x56c4,0x1b9));var _0x456c=function(_0x20006a,_0x30e3a9){_0x20006a=_0x20006a-0x0;var _0x5e26ac=_0x56c4[_0x20006a];return _0x5e26ac;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x456c('0x0'))(_0x456c('0x1'));var moment=require(_0x456c('0x2'));var BPromise=require(_0x456c('0x3'));var rp=require(_0x456c('0x4'));var fs=require('fs');var path=require(_0x456c('0x5'));var rimraf=require('rimraf');var config=require(_0x456c('0x6'));var attributes=require(_0x456c('0x7'));module[_0x456c('0x8')]=function(_0xadf41c,_0x3fec55){return _0xadf41c[_0x456c('0x9')](_0x456c('0xa'),attributes,{'tableName':_0x456c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 1a7ef30..d40bb82 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 _0x03ac=['ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','debug','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x03ac,0x14b));var _0xc03a=function(_0x49256d,_0x8dc806){_0x49256d=_0x49256d-0x0;var _0x9d6527=_0x03ac[_0x49256d];return _0x9d6527;};'use strict';var _=require(_0xc03a('0x0'));var util=require('util');var moment=require(_0xc03a('0x1'));var BPromise=require(_0xc03a('0x2'));var rs=require(_0xc03a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc03a('0x4'));var logger=require(_0xc03a('0x5'))(_0xc03a('0x6'));var config=require(_0xc03a('0x7'));var jayson=require(_0xc03a('0x8'));var client=jayson[_0xc03a('0x9')][_0xc03a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24e800,_0x5aa8c4,_0x485a65){return new BPromise(function(_0x4745d7,_0x485e97){return client[_0xc03a('0xb')](_0x24e800,_0x485a65)[_0xc03a('0xc')](function(_0x21f1ea){logger[_0xc03a('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x5aa8c4,_0xc03a('0xe'));logger['debug'](_0xc03a('0xf'),_0x5aa8c4,_0xc03a('0xe'),JSON[_0xc03a('0x10')](_0x21f1ea));if(_0x21f1ea[_0xc03a('0x11')]){if(_0x21f1ea[_0xc03a('0x11')][_0xc03a('0x12')]===0x1f4){logger['error'](_0xc03a('0x13'),_0x5aa8c4,_0x21f1ea[_0xc03a('0x11')][_0xc03a('0x14')]);return _0x485e97(_0x21f1ea[_0xc03a('0x11')][_0xc03a('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x5aa8c4,_0x21f1ea['error'][_0xc03a('0x14')]);return _0x4745d7(_0x21f1ea[_0xc03a('0x11')]['message']);}else{logger[_0xc03a('0xd')](_0xc03a('0x13'),_0x5aa8c4,_0xc03a('0xe'));_0x4745d7(_0x21f1ea['result'][_0xc03a('0x14')]);}})['catch'](function(_0xb3b3f1){logger[_0xc03a('0x11')](_0xc03a('0x13'),_0x5aa8c4,_0xb3b3f1);_0x485e97(_0xb3b3f1);});});}exports[_0xc03a('0x15')]=function(_0x5c281a){var _0xe83f1f=this;return new Promise(function(_0x37b189,_0x18c69b){return db[_0xc03a('0x16')][_0xc03a('0x17')]({'raw':_0x5c281a[_0xc03a('0x18')]?_0x5c281a[_0xc03a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5c281a[_0xc03a('0x18')]?_0x5c281a[_0xc03a('0x18')][_0xc03a('0x19')]||null:null,'attributes':_0x5c281a[_0xc03a('0x18')]?_0x5c281a[_0xc03a('0x18')][_0xc03a('0x1a')]||null:null,'include':_0x5c281a['options']?_0x5c281a[_0xc03a('0x18')][_0xc03a('0x1b')]?_[_0xc03a('0x1c')](_0x5c281a[_0xc03a('0x18')][_0xc03a('0x1b')],function(_0x4f69fd){return{'model':db[_0x4f69fd['model']],'as':_0x4f69fd['as'],'attributes':_0x4f69fd[_0xc03a('0x1a')],'include':_0x4f69fd[_0xc03a('0x1b')]?_[_0xc03a('0x1c')](_0x4f69fd[_0xc03a('0x1b')],function(_0x34e2d6){return{'model':db[_0x34e2d6[_0xc03a('0x1d')]],'as':_0x34e2d6['as'],'attributes':_0x34e2d6[_0xc03a('0x1a')],'include':_0x34e2d6[_0xc03a('0x1b')]?_[_0xc03a('0x1c')](_0x34e2d6[_0xc03a('0x1b')],function(_0x3b624b){return{'model':db[_0x3b624b[_0xc03a('0x1d')]],'as':_0x3b624b['as'],'attributes':_0x3b624b[_0xc03a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52a5c6){logger[_0xc03a('0xd')](_0xc03a('0x15'),_0x5c281a);logger[_0xc03a('0x1e')]('ShowSquareOdbc',_0x5c281a,JSON[_0xc03a('0x10')](_0x52a5c6));_0x37b189(_0x52a5c6);})[_0xc03a('0x1f')](function(_0x7dd42c){logger[_0xc03a('0x11')](_0xc03a('0x15'),_0x7dd42c['message'],_0x5c281a);_0x18c69b(_0xe83f1f[_0xc03a('0x11')](0x1f4,_0x7dd42c[_0xc03a('0x14')]));});});}; \ No newline at end of file +var _0x84c9=['request\x20sent','stringify','error','code','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x341a8d,_0x319696){var _0x3b598d=function(_0x187e7e){while(--_0x187e7e){_0x341a8d['push'](_0x341a8d['shift']());}};_0x3b598d(++_0x319696);}(_0x84c9,0x70));var _0x984c=function(_0xc1bc0a,_0x1b2ecf){_0xc1bc0a=_0xc1bc0a-0x0;var _0x5638a2=_0x84c9[_0xc1bc0a];return _0x5638a2;};'use strict';var _=require(_0x984c('0x0'));var util=require(_0x984c('0x1'));var moment=require(_0x984c('0x2'));var BPromise=require('bluebird');var rs=require(_0x984c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x984c('0x4'))['db'];var utils=require(_0x984c('0x5'));var logger=require(_0x984c('0x6'))(_0x984c('0x7'));var config=require(_0x984c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x984c('0x9')][_0x984c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b24da,_0x4c26ca,_0x58b53a){return new BPromise(function(_0x398564,_0x4ef01d){return client[_0x984c('0xb')](_0x7b24da,_0x58b53a)[_0x984c('0xc')](function(_0x5ec823){logger[_0x984c('0xd')](_0x984c('0xe'),_0x4c26ca,'request\x20sent');logger['debug'](_0x984c('0xf'),_0x4c26ca,_0x984c('0x10'),JSON[_0x984c('0x11')](_0x5ec823));if(_0x5ec823['error']){if(_0x5ec823[_0x984c('0x12')][_0x984c('0x13')]===0x1f4){logger[_0x984c('0x12')](_0x984c('0xe'),_0x4c26ca,_0x5ec823['error'][_0x984c('0x14')]);return _0x4ef01d(_0x5ec823[_0x984c('0x12')][_0x984c('0x14')]);}logger[_0x984c('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x4c26ca,_0x5ec823['error']['message']);return _0x398564(_0x5ec823[_0x984c('0x12')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x4c26ca,'request\x20sent');_0x398564(_0x5ec823['result'][_0x984c('0x14')]);}})[_0x984c('0x15')](function(_0x121711){logger[_0x984c('0x12')](_0x984c('0xe'),_0x4c26ca,_0x121711);_0x4ef01d(_0x121711);});});}exports[_0x984c('0x16')]=function(_0x322e9e){var _0x5061f3=this;return new Promise(function(_0x2a10c3,_0x7d8940){return db[_0x984c('0x17')][_0x984c('0x18')]({'raw':_0x322e9e[_0x984c('0x19')]?_0x322e9e[_0x984c('0x19')][_0x984c('0x1a')]===undefined?!![]:![]:!![],'where':_0x322e9e[_0x984c('0x19')]?_0x322e9e[_0x984c('0x19')][_0x984c('0x1b')]||null:null,'attributes':_0x322e9e[_0x984c('0x19')]?_0x322e9e[_0x984c('0x19')]['attributes']||null:null,'include':_0x322e9e[_0x984c('0x19')]?_0x322e9e[_0x984c('0x19')][_0x984c('0x1c')]?_[_0x984c('0x1d')](_0x322e9e[_0x984c('0x19')][_0x984c('0x1c')],function(_0x290b9c){return{'model':db[_0x290b9c[_0x984c('0x1e')]],'as':_0x290b9c['as'],'attributes':_0x290b9c[_0x984c('0x1f')],'include':_0x290b9c[_0x984c('0x1c')]?_['map'](_0x290b9c[_0x984c('0x1c')],function(_0x5213d6){return{'model':db[_0x5213d6[_0x984c('0x1e')]],'as':_0x5213d6['as'],'attributes':_0x5213d6[_0x984c('0x1f')],'include':_0x5213d6[_0x984c('0x1c')]?_['map'](_0x5213d6[_0x984c('0x1c')],function(_0x33c7cd){return{'model':db[_0x33c7cd['model']],'as':_0x33c7cd['as'],'attributes':_0x33c7cd[_0x984c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x984c('0xc')](function(_0x39f477){logger[_0x984c('0xd')](_0x984c('0x16'),_0x322e9e);logger['debug'](_0x984c('0x16'),_0x322e9e,JSON[_0x984c('0x11')](_0x39f477));_0x2a10c3(_0x39f477);})[_0x984c('0x15')](function(_0x5463db){logger[_0x984c('0x12')](_0x984c('0x16'),_0x5463db['message'],_0x322e9e);_0x7d8940(_0x5061f3[_0x984c('0x12')](0x1f4,_0x5463db[_0x984c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 39c3690..b530ed2 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 _0xc1df=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','show','post','create','put','/:id','destroy','exports','util'];(function(_0x3d7fbc,_0x5547ae){var _0x1e5fb4=function(_0x3c7ae2){while(--_0x3c7ae2){_0x3d7fbc['push'](_0x3d7fbc['shift']());}};_0x1e5fb4(++_0x5547ae);}(_0xc1df,0x12f));var _0xfc1d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc1df[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0xfc1d('0x0'));var path=require('path');var timeout=require(_0xfc1d('0x1'));var express=require(_0xfc1d('0x2'));var router=express['Router']();var fs_extra=require(_0xfc1d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfc1d('0x4'));var config=require(_0xfc1d('0x5'));var controller=require(_0xfc1d('0x6'));router[_0xfc1d('0x7')]('/',auth[_0xfc1d('0x8')](),controller['index']);router['get']('/:id',auth[_0xfc1d('0x8')](),controller[_0xfc1d('0x9')]);router[_0xfc1d('0xa')]('/',auth[_0xfc1d('0x8')](),controller[_0xfc1d('0xb')]);router[_0xfc1d('0xc')](_0xfc1d('0xd'),auth[_0xfc1d('0x8')](),controller['update']);router['delete'](_0xfc1d('0xd'),auth[_0xfc1d('0x8')](),controller[_0xfc1d('0xe')]);module[_0xfc1d('0xf')]=router; \ No newline at end of file +var _0x7e93=['../../components/interaction/service','./squareProject.controller','index','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x51cdd8,_0x47cf92){var _0x1aa5c1=function(_0x5d4318){while(--_0x5d4318){_0x51cdd8['push'](_0x51cdd8['shift']());}};_0x1aa5c1(++_0x47cf92);}(_0x7e93,0xa1));var _0x37e9=function(_0x5281d6,_0x396979){_0x5281d6=_0x5281d6-0x0;var _0x106bb7=_0x7e93[_0x5281d6];return _0x106bb7;};'use strict';var multer=require(_0x37e9('0x0'));var util=require('util');var path=require(_0x37e9('0x1'));var timeout=require(_0x37e9('0x2'));var express=require(_0x37e9('0x3'));var router=express[_0x37e9('0x4')]();var fs_extra=require(_0x37e9('0x5'));var auth=require(_0x37e9('0x6'));var interaction=require(_0x37e9('0x7'));var config=require('../../config/environment');var controller=require(_0x37e9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x37e9('0x9')]);router[_0x37e9('0xa')](_0x37e9('0xb'),auth['isAuthenticated'](),controller[_0x37e9('0xc')]);router[_0x37e9('0xd')]('/',auth[_0x37e9('0xe')](),controller[_0x37e9('0xf')]);router[_0x37e9('0x10')](_0x37e9('0xb'),auth[_0x37e9('0xe')](),controller[_0x37e9('0x11')]);router[_0x37e9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x37e9('0x13')]);module[_0x37e9('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 1c2476b..3f0d687 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 _0xc5fe=['production','DATE','sequelize','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8'];(function(_0x2501f0,_0x517c3e){var _0x3cb4c5=function(_0x23adfe){while(--_0x23adfe){_0x2501f0['push'](_0x2501f0['shift']());}};_0x3cb4c5(++_0x517c3e);}(_0xc5fe,0x152));var _0xec5f=function(_0x1498ad,_0x1574a1){_0x1498ad=_0x1498ad-0x0;var _0x4d91f0=_0xc5fe[_0x1498ad];return _0x4d91f0;};'use strict';var Sequelize=require(_0xec5f('0x0'));module['exports']={'name':{'type':Sequelize[_0xec5f('0x1')],'unique':_0xec5f('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xec5f('0x1')]},'notes':{'type':Sequelize[_0xec5f('0x3')]},'preproduction':{'type':Sequelize[_0xec5f('0x4')](_0xec5f('0x5')),'get':function(){if(this[_0xec5f('0x6')]('preproduction')){return this[_0xec5f('0x6')](_0xec5f('0x7'))[_0xec5f('0x8')](_0xec5f('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xec5f('0x5')),'get':function(){if(this['getDataValue'](_0xec5f('0xa'))){return this[_0xec5f('0x6')](_0xec5f('0xa'))[_0xec5f('0x8')](_0xec5f('0x9'));}}},'savedAt':{'type':Sequelize[_0xec5f('0xb')]},'publishedAt':{'type':Sequelize[_0xec5f('0xb')]}}; \ No newline at end of file +var _0x9092=['preproduction','utf8','production','toString','DATE','sequelize','exports','STRING','name','BLOB','long','getDataValue'];(function(_0x3fbc26,_0x430c6e){var _0x4a3496=function(_0x210170){while(--_0x210170){_0x3fbc26['push'](_0x3fbc26['shift']());}};_0x4a3496(++_0x430c6e);}(_0x9092,0x95));var _0x2909=function(_0xdfc34a,_0x103d33){_0xdfc34a=_0xdfc34a-0x0;var _0x1d895d=_0x9092[_0xdfc34a];return _0x1d895d;};'use strict';var Sequelize=require(_0x2909('0x0'));module[_0x2909('0x1')]={'name':{'type':Sequelize[_0x2909('0x2')],'unique':_0x2909('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2909('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x2909('0x4')](_0x2909('0x5')),'get':function(){if(this[_0x2909('0x6')]('preproduction')){return this['getDataValue'](_0x2909('0x7'))['toString'](_0x2909('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x2909('0x6')](_0x2909('0x9'))){return this[_0x2909('0x6')]('production')[_0x2909('0xa')](_0x2909('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x2909('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 76b0b66..9ce0f68 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 _0x8e0c=['agi','stringify','end','error','stack','name','send','index','map','SquareProject','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','limit','undefined','count','offset','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','publish'];(function(_0x628452,_0x5ee9fc){var _0xc14d6f=function(_0x326465){while(--_0x326465){_0x628452['push'](_0x628452['shift']());}};_0xc14d6f(++_0x5ee9fc);}(_0x8e0c,0x18a));var _0xc8e0=function(_0x302cfa,_0x5b98f3){_0x302cfa=_0x302cfa-0x0;var _0x451e18=_0x8e0c[_0x302cfa];return _0x451e18;};'use strict';var _=require(_0xc8e0('0x0'));var Redis=require(_0xc8e0('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xc8e0('0x2'))(_0xc8e0('0x3'));var config=require('../../config/environment');var db=require(_0xc8e0('0x4'))['db'];config['redis']=_[_0xc8e0('0x5')](config[_0xc8e0('0x6')],{'host':_0xc8e0('0x7'),'port':0x18eb});var socket=require(_0xc8e0('0x8'))(new Redis(config['redis']));require(_0xc8e0('0x9'))[_0xc8e0('0xa')](socket);function respondWithResult(_0x205159,_0x58da1c){_0x58da1c=_0x58da1c||0xc8;return function(_0x1e4bf3){if(_0x1e4bf3){return _0x205159[_0xc8e0('0xb')](_0x58da1c)[_0xc8e0('0xc')](_0x1e4bf3);}};}function respondWithFilteredResult(_0x3526b3,_0x238d89){return function(_0x48caa1){if(_0x48caa1){var _0x34d610=typeof _0x238d89['offset']==='undefined'&&typeof _0x238d89[_0xc8e0('0xd')]===_0xc8e0('0xe');var _0x178945=_0x48caa1[_0xc8e0('0xf')];var _0x21c682=_0x34d610?0x0:_0x238d89[_0xc8e0('0x10')];var _0x34c709=_0x34d610?_0x48caa1[_0xc8e0('0xf')]:_0x238d89[_0xc8e0('0x10')]+_0x238d89[_0xc8e0('0xd')];var _0x544a35;if(_0x34c709>=_0x178945){_0x34c709=_0x178945;_0x544a35=0xc8;}else{_0x544a35=0xce;}_0x3526b3[_0xc8e0('0xb')](_0x544a35);return _0x3526b3[_0xc8e0('0x11')](_0xc8e0('0x12'),_0x21c682+'-'+_0x34c709+'/'+_0x178945)['json'](_0x48caa1);}return null;};}function saveUpdates(_0x2d8c69){return function(_0xf18280){if(_0xf18280){return _0xf18280[_0xc8e0('0x13')](_0x2d8c69)[_0xc8e0('0x14')](function(_0x1fd41f){return _0x1fd41f;});}return null;};}function removeEntity(_0x18cf28){return function(_0x4b0015){if(_0x4b0015){return _0x4b0015[_0xc8e0('0x15')]()[_0xc8e0('0x14')](function(){var _0x382308=_0x4b0015[_0xc8e0('0x16')]({'plain':!![]});var _0x2aa7c4=_0xc8e0('0x17');return db[_0xc8e0('0x18')][_0xc8e0('0x15')]({'where':{'type':_0x2aa7c4,'resourceId':_0x382308['id']}})['then'](function(){return _0x4b0015;});})[_0xc8e0('0x14')](function(){var _0x34ecef=new Redis(config[_0xc8e0('0x6')]);_0x34ecef[_0xc8e0('0x19')](_0xc8e0('0x1a'),JSON[_0xc8e0('0x1b')]({'id':_0x4b0015['id'],'deleted':!![]}));})[_0xc8e0('0x14')](function(){_0x18cf28['status'](0xcc)[_0xc8e0('0x1c')]();});}};}function handleEntityNotFound(_0x5aa799){return function(_0x1d2526){if(!_0x1d2526){_0x5aa799['sendStatus'](0x194);}return _0x1d2526;};}function handleError(_0x28bdab,_0x4c2a99){_0x4c2a99=_0x4c2a99||0x1f4;return function(_0x29f6df){logger[_0xc8e0('0x1d')](_0x29f6df[_0xc8e0('0x1e')]);if(_0x29f6df[_0xc8e0('0x1f')]){delete _0x29f6df[_0xc8e0('0x1f')];}_0x28bdab[_0xc8e0('0xb')](_0x4c2a99)[_0xc8e0('0x20')](_0x29f6df);};}exports[_0xc8e0('0x21')]=function(_0x531fcd,_0x1ac7c7){var _0x5516e3={},_0x38ece2={},_0x1993a5={'count':0x0,'rows':[]};var _0x546e06=_[_0xc8e0('0x22')](db[_0xc8e0('0x23')]['rawAttributes'],function(_0x1a222c){return{'name':_0x1a222c[_0xc8e0('0x24')],'type':_0x1a222c[_0xc8e0('0x25')]['key']};});_0x38ece2[_0xc8e0('0x26')]=_['map'](_0x546e06,_0xc8e0('0x1f'));_0x38ece2[_0xc8e0('0x27')]=_[_0xc8e0('0x28')](_0x531fcd[_0xc8e0('0x27')]);_0x38ece2[_0xc8e0('0x29')]=_[_0xc8e0('0x2a')](_0x38ece2[_0xc8e0('0x26')],_0x38ece2[_0xc8e0('0x27')]);_0x5516e3[_0xc8e0('0x2b')]=_['intersection'](_0x38ece2[_0xc8e0('0x26')],qs[_0xc8e0('0x2c')](_0x531fcd[_0xc8e0('0x27')]['fields']));_0x5516e3[_0xc8e0('0x2b')]=_0x5516e3[_0xc8e0('0x2b')]['length']?_0x5516e3[_0xc8e0('0x2b')]:_0x38ece2[_0xc8e0('0x26')];if(!_0x531fcd[_0xc8e0('0x27')]['hasOwnProperty']('nolimit')){_0x5516e3[_0xc8e0('0xd')]=qs[_0xc8e0('0xd')](_0x531fcd[_0xc8e0('0x27')][_0xc8e0('0xd')]);_0x5516e3[_0xc8e0('0x10')]=qs[_0xc8e0('0x10')](_0x531fcd[_0xc8e0('0x27')]['offset']);}_0x5516e3[_0xc8e0('0x2d')]=qs[_0xc8e0('0x2e')](_0x531fcd[_0xc8e0('0x27')][_0xc8e0('0x2e')]);_0x5516e3[_0xc8e0('0x2f')]=qs[_0xc8e0('0x29')](_[_0xc8e0('0x30')](_0x531fcd[_0xc8e0('0x27')],_0x38ece2['filters']),_0x546e06);if(_0x531fcd[_0xc8e0('0x27')][_0xc8e0('0x31')]){_0x5516e3['where']=_[_0xc8e0('0x32')](_0x5516e3[_0xc8e0('0x2f')],{'$or':_[_0xc8e0('0x22')](_0x546e06,function(_0x31901d){if(_0x31901d['type']!=='VIRTUAL'){var _0x1af661={};_0x1af661[_0x31901d[_0xc8e0('0x1f')]]={'$like':'%'+_0x531fcd[_0xc8e0('0x27')][_0xc8e0('0x31')]+'%'};return _0x1af661;}})});}_0x5516e3=_[_0xc8e0('0x32')]({},_0x5516e3,_0x531fcd[_0xc8e0('0x33')]);var _0x19d149={'where':_0x5516e3['where']};return db[_0xc8e0('0x23')]['count'](_0x19d149)[_0xc8e0('0x14')](function(_0x32a4c1){_0x1993a5[_0xc8e0('0xf')]=_0x32a4c1;if(_0x531fcd[_0xc8e0('0x27')]['includeAll']){_0x5516e3[_0xc8e0('0x34')]=[{'all':!![]}];}return db[_0xc8e0('0x23')][_0xc8e0('0x35')](_0x5516e3);})[_0xc8e0('0x14')](function(_0x148aa4){_0x1993a5[_0xc8e0('0x36')]=_0x148aa4;return _0x1993a5;})[_0xc8e0('0x14')](respondWithFilteredResult(_0x1ac7c7,_0x5516e3))['catch'](handleError(_0x1ac7c7,null));};exports[_0xc8e0('0x37')]=function(_0x4cfe63,_0x732cae){var _0x48b1a0={'raw':![],'where':{'id':_0x4cfe63[_0xc8e0('0x38')]['id']}},_0x1205d7={};_0x1205d7[_0xc8e0('0x26')]=_[_0xc8e0('0x28')](db[_0xc8e0('0x23')][_0xc8e0('0x39')]);_0x1205d7[_0xc8e0('0x27')]=_[_0xc8e0('0x28')](_0x4cfe63[_0xc8e0('0x27')]);_0x1205d7[_0xc8e0('0x29')]=_[_0xc8e0('0x2a')](_0x1205d7[_0xc8e0('0x26')],_0x1205d7[_0xc8e0('0x27')]);_0x48b1a0[_0xc8e0('0x2b')]=_[_0xc8e0('0x2a')](_0x1205d7[_0xc8e0('0x26')],qs[_0xc8e0('0x2c')](_0x4cfe63['query'][_0xc8e0('0x2c')]));_0x48b1a0[_0xc8e0('0x2b')]=_0x48b1a0[_0xc8e0('0x2b')][_0xc8e0('0x3a')]?_0x48b1a0[_0xc8e0('0x2b')]:_0x1205d7[_0xc8e0('0x26')];if(_0x4cfe63[_0xc8e0('0x27')][_0xc8e0('0x3b')]){_0x48b1a0['include']=[{'all':!![]}];}_0x48b1a0=_[_0xc8e0('0x32')]({},_0x48b1a0,_0x4cfe63[_0xc8e0('0x33')]);return db[_0xc8e0('0x23')][_0xc8e0('0x3c')](_0x48b1a0)[_0xc8e0('0x14')](handleEntityNotFound(_0x732cae,null))[_0xc8e0('0x14')](respondWithResult(_0x732cae,null))[_0xc8e0('0x3d')](handleError(_0x732cae,null));};exports[_0xc8e0('0x3e')]=function(_0x56a918,_0x569431){return db[_0xc8e0('0x23')]['create'](_0x56a918[_0xc8e0('0x3f')],{})[_0xc8e0('0x14')](function(_0x4ef05a){var _0x253666=_0x56a918[_0xc8e0('0x40')][_0xc8e0('0x16')]({'plain':!![]});if(!_0x253666)throw new Error(_0xc8e0('0x41'));if(_0x253666[_0xc8e0('0x42')]===_0xc8e0('0x40')){var _0x2de72b=_0x4ef05a[_0xc8e0('0x16')]({'plain':!![]});var _0x3b2e87=_0xc8e0('0x17');return db['UserProfileSection'][_0xc8e0('0x3c')]({'where':{'name':_0x3b2e87,'userProfileId':_0x253666[_0xc8e0('0x43')]},'raw':!![]})['then'](function(_0x52083d){if(_0x52083d&&_0x52083d['autoAssociation']===0x0){return db[_0xc8e0('0x18')][_0xc8e0('0x3e')]({'name':_0x2de72b[_0xc8e0('0x1f')],'resourceId':_0x2de72b['id'],'type':_0x52083d[_0xc8e0('0x1f')],'sectionId':_0x52083d['id']},{})[_0xc8e0('0x14')](function(){return _0x4ef05a;});}else{return _0x4ef05a;}})[_0xc8e0('0x3d')](function(_0x3e979a){logger[_0xc8e0('0x1d')](_0xc8e0('0x44'),_0x3e979a);throw _0x3e979a;});}return _0x4ef05a;})['then'](respondWithResult(_0x569431,0xc9))[_0xc8e0('0x3d')](handleError(_0x569431,null));};exports[_0xc8e0('0x13')]=function(_0x41e0d8,_0xda3aef){if(_0x41e0d8[_0xc8e0('0x3f')]['id']){delete _0x41e0d8[_0xc8e0('0x3f')]['id'];}return db[_0xc8e0('0x23')][_0xc8e0('0x3c')]({'where':{'id':_0x41e0d8[_0xc8e0('0x38')]['id']}})[_0xc8e0('0x14')](handleEntityNotFound(_0xda3aef,null))[_0xc8e0('0x14')](saveUpdates(_0x41e0d8[_0xc8e0('0x3f')],null))[_0xc8e0('0x14')](function(_0x5b6a2f){if(!_0x5b6a2f)return;var _0x35dd1f=_0x5b6a2f[_0xc8e0('0x16')]({'plain':!![]});return _0x35dd1f;})[_0xc8e0('0x14')](function(_0x520303){var _0x519585=new Redis(config[_0xc8e0('0x6')]);_0x519585[_0xc8e0('0x19')](_0xc8e0('0x1a'),JSON['stringify'](_[_0xc8e0('0x30')](_0x520303,['id',_0xc8e0('0x1f'),_0xc8e0('0x45')])));return _0x520303;})[_0xc8e0('0x14')](respondWithResult(_0xda3aef,null))[_0xc8e0('0x3d')](handleError(_0xda3aef,null));};exports[_0xc8e0('0x15')]=function(_0xdde49e,_0x3aa236){return db[_0xc8e0('0x23')][_0xc8e0('0x3c')]({'where':{'id':_0xdde49e['params']['id']}})[_0xc8e0('0x14')](handleEntityNotFound(_0x3aa236,null))[_0xc8e0('0x14')](removeEntity(_0x3aa236,null))[_0xc8e0('0x3d')](handleError(_0x3aa236,null));}; \ No newline at end of file +var _0x51ef=['show','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','production','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','status','offset','limit','undefined','count','set','Content-Range','json','destroy','then','UserProfileResource','publish','agi','stringify','end','sendStatus','error','name','index','SquareProject','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x51ef,0x1f1));var _0xf51e=function(_0x1dee6b,_0x469604){_0x1dee6b=_0x1dee6b-0x0;var _0x1c77d3=_0x51ef[_0x1dee6b];return _0x1c77d3;};'use strict';var _=require(_0xf51e('0x0'));var Redis=require(_0xf51e('0x1'));var qs=require(_0xf51e('0x2'));var logger=require('../../config/logger')(_0xf51e('0x3'));var config=require('../../config/environment');var db=require(_0xf51e('0x4'))['db'];config[_0xf51e('0x5')]=_[_0xf51e('0x6')](config[_0xf51e('0x5')],{'host':_0xf51e('0x7'),'port':0x18eb});var socket=require(_0xf51e('0x8'))(new Redis(config[_0xf51e('0x5')]));require(_0xf51e('0x9'))[_0xf51e('0xa')](socket);function respondWithResult(_0x2a0701,_0x46b943){_0x46b943=_0x46b943||0xc8;return function(_0x3bb5ad){if(_0x3bb5ad){return _0x2a0701[_0xf51e('0xb')](_0x46b943)['json'](_0x3bb5ad);}};}function respondWithFilteredResult(_0x541a21,_0x5a4f35){return function(_0xf1f0db){if(_0xf1f0db){var _0x3560a9=typeof _0x5a4f35[_0xf51e('0xc')]==='undefined'&&typeof _0x5a4f35[_0xf51e('0xd')]===_0xf51e('0xe');var _0x493954=_0xf1f0db[_0xf51e('0xf')];var _0x1b3894=_0x3560a9?0x0:_0x5a4f35['offset'];var _0x3cb96d=_0x3560a9?_0xf1f0db['count']:_0x5a4f35[_0xf51e('0xc')]+_0x5a4f35[_0xf51e('0xd')];var _0x516ee8;if(_0x3cb96d>=_0x493954){_0x3cb96d=_0x493954;_0x516ee8=0xc8;}else{_0x516ee8=0xce;}_0x541a21['status'](_0x516ee8);return _0x541a21[_0xf51e('0x10')](_0xf51e('0x11'),_0x1b3894+'-'+_0x3cb96d+'/'+_0x493954)[_0xf51e('0x12')](_0xf1f0db);}return null;};}function saveUpdates(_0x140169){return function(_0x174df8){if(_0x174df8){return _0x174df8['update'](_0x140169)['then'](function(_0x5d43d2){return _0x5d43d2;});}return null;};}function removeEntity(_0x417017){return function(_0x54d4c2){if(_0x54d4c2){return _0x54d4c2[_0xf51e('0x13')]()[_0xf51e('0x14')](function(){var _0x485b40=_0x54d4c2['get']({'plain':!![]});var _0x317282='SquareProjects';return db[_0xf51e('0x15')]['destroy']({'where':{'type':_0x317282,'resourceId':_0x485b40['id']}})[_0xf51e('0x14')](function(){return _0x54d4c2;});})[_0xf51e('0x14')](function(){var _0x2d45cb=new Redis(config[_0xf51e('0x5')]);_0x2d45cb[_0xf51e('0x16')](_0xf51e('0x17'),JSON[_0xf51e('0x18')]({'id':_0x54d4c2['id'],'deleted':!![]}));})[_0xf51e('0x14')](function(){_0x417017[_0xf51e('0xb')](0xcc)[_0xf51e('0x19')]();});}};}function handleEntityNotFound(_0x1a7b66){return function(_0x486040){if(!_0x486040){_0x1a7b66[_0xf51e('0x1a')](0x194);}return _0x486040;};}function handleError(_0x3f3d99,_0x3ba200){_0x3ba200=_0x3ba200||0x1f4;return function(_0x3a1d35){logger[_0xf51e('0x1b')](_0x3a1d35['stack']);if(_0x3a1d35[_0xf51e('0x1c')]){delete _0x3a1d35['name'];}_0x3f3d99['status'](_0x3ba200)['send'](_0x3a1d35);};}exports[_0xf51e('0x1d')]=function(_0x2efac2,_0x5d844d){var _0x3ee72e={},_0x30fad9={},_0x2dc4c2={'count':0x0,'rows':[]};var _0x56c382=_['map'](db[_0xf51e('0x1e')][_0xf51e('0x1f')],function(_0x945f3c){return{'name':_0x945f3c[_0xf51e('0x20')],'type':_0x945f3c['type']['key']};});_0x30fad9[_0xf51e('0x21')]=_[_0xf51e('0x22')](_0x56c382,'name');_0x30fad9[_0xf51e('0x23')]=_[_0xf51e('0x24')](_0x2efac2['query']);_0x30fad9[_0xf51e('0x25')]=_[_0xf51e('0x26')](_0x30fad9[_0xf51e('0x21')],_0x30fad9[_0xf51e('0x23')]);_0x3ee72e[_0xf51e('0x27')]=_[_0xf51e('0x26')](_0x30fad9['model'],qs[_0xf51e('0x28')](_0x2efac2[_0xf51e('0x23')][_0xf51e('0x28')]));_0x3ee72e[_0xf51e('0x27')]=_0x3ee72e[_0xf51e('0x27')][_0xf51e('0x29')]?_0x3ee72e[_0xf51e('0x27')]:_0x30fad9[_0xf51e('0x21')];if(!_0x2efac2['query'][_0xf51e('0x2a')](_0xf51e('0x2b'))){_0x3ee72e[_0xf51e('0xd')]=qs['limit'](_0x2efac2[_0xf51e('0x23')][_0xf51e('0xd')]);_0x3ee72e[_0xf51e('0xc')]=qs['offset'](_0x2efac2['query'][_0xf51e('0xc')]);}_0x3ee72e['order']=qs['sort'](_0x2efac2[_0xf51e('0x23')][_0xf51e('0x2c')]);_0x3ee72e['where']=qs[_0xf51e('0x25')](_[_0xf51e('0x2d')](_0x2efac2[_0xf51e('0x23')],_0x30fad9['filters']),_0x56c382);if(_0x2efac2[_0xf51e('0x23')][_0xf51e('0x2e')]){_0x3ee72e[_0xf51e('0x2f')]=_['merge'](_0x3ee72e[_0xf51e('0x2f')],{'$or':_['map'](_0x56c382,function(_0x1f1ea4){if(_0x1f1ea4['type']!==_0xf51e('0x30')){var _0x2900e0={};_0x2900e0[_0x1f1ea4[_0xf51e('0x1c')]]={'$like':'%'+_0x2efac2[_0xf51e('0x23')][_0xf51e('0x2e')]+'%'};return _0x2900e0;}})});}_0x3ee72e=_[_0xf51e('0x31')]({},_0x3ee72e,_0x2efac2['options']);var _0xb6cb5d={'where':_0x3ee72e[_0xf51e('0x2f')]};return db[_0xf51e('0x1e')]['count'](_0xb6cb5d)[_0xf51e('0x14')](function(_0x11689c){_0x2dc4c2[_0xf51e('0xf')]=_0x11689c;if(_0x2efac2[_0xf51e('0x23')][_0xf51e('0x32')]){_0x3ee72e[_0xf51e('0x33')]=[{'all':!![]}];}return db[_0xf51e('0x1e')][_0xf51e('0x34')](_0x3ee72e);})['then'](function(_0x434b19){_0x2dc4c2[_0xf51e('0x35')]=_0x434b19;return _0x2dc4c2;})[_0xf51e('0x14')](respondWithFilteredResult(_0x5d844d,_0x3ee72e))[_0xf51e('0x36')](handleError(_0x5d844d,null));};exports[_0xf51e('0x37')]=function(_0x4c3978,_0x3a56a5){var _0x5a6ba4={'raw':![],'where':{'id':_0x4c3978[_0xf51e('0x38')]['id']}},_0x4acc91={};_0x4acc91[_0xf51e('0x21')]=_[_0xf51e('0x24')](db[_0xf51e('0x1e')][_0xf51e('0x1f')]);_0x4acc91[_0xf51e('0x23')]=_[_0xf51e('0x24')](_0x4c3978[_0xf51e('0x23')]);_0x4acc91[_0xf51e('0x25')]=_[_0xf51e('0x26')](_0x4acc91['model'],_0x4acc91[_0xf51e('0x23')]);_0x5a6ba4[_0xf51e('0x27')]=_[_0xf51e('0x26')](_0x4acc91['model'],qs[_0xf51e('0x28')](_0x4c3978[_0xf51e('0x23')][_0xf51e('0x28')]));_0x5a6ba4[_0xf51e('0x27')]=_0x5a6ba4['attributes'][_0xf51e('0x29')]?_0x5a6ba4[_0xf51e('0x27')]:_0x4acc91[_0xf51e('0x21')];if(_0x4c3978['query'][_0xf51e('0x32')]){_0x5a6ba4[_0xf51e('0x33')]=[{'all':!![]}];}_0x5a6ba4=_[_0xf51e('0x31')]({},_0x5a6ba4,_0x4c3978[_0xf51e('0x39')]);return db[_0xf51e('0x1e')]['find'](_0x5a6ba4)[_0xf51e('0x14')](handleEntityNotFound(_0x3a56a5,null))[_0xf51e('0x14')](respondWithResult(_0x3a56a5,null))[_0xf51e('0x36')](handleError(_0x3a56a5,null));};exports[_0xf51e('0x3a')]=function(_0x17a89c,_0x7b1c37){return db[_0xf51e('0x1e')][_0xf51e('0x3a')](_0x17a89c['body'],{})['then'](function(_0x4eb93c){var _0x3dd117=_0x17a89c[_0xf51e('0x3b')][_0xf51e('0x3c')]({'plain':!![]});if(!_0x3dd117)throw new Error(_0xf51e('0x3d'));if(_0x3dd117[_0xf51e('0x3e')]==='user'){var _0x46c90a=_0x4eb93c[_0xf51e('0x3c')]({'plain':!![]});var _0x534cda=_0xf51e('0x3f');return db['UserProfileSection']['find']({'where':{'name':_0x534cda,'userProfileId':_0x3dd117[_0xf51e('0x40')]},'raw':!![]})[_0xf51e('0x14')](function(_0xfa14d4){if(_0xfa14d4&&_0xfa14d4['autoAssociation']===0x0){return db[_0xf51e('0x15')][_0xf51e('0x3a')]({'name':_0x46c90a[_0xf51e('0x1c')],'resourceId':_0x46c90a['id'],'type':_0xfa14d4['name'],'sectionId':_0xfa14d4['id']},{})['then'](function(){return _0x4eb93c;});}else{return _0x4eb93c;}})['catch'](function(_0x496f7a){logger[_0xf51e('0x1b')](_0xf51e('0x41'),_0x496f7a);throw _0x496f7a;});}return _0x4eb93c;})[_0xf51e('0x14')](respondWithResult(_0x7b1c37,0xc9))[_0xf51e('0x36')](handleError(_0x7b1c37,null));};exports['update']=function(_0x3353b1,_0x5b77c1){if(_0x3353b1['body']['id']){delete _0x3353b1[_0xf51e('0x42')]['id'];}return db[_0xf51e('0x1e')][_0xf51e('0x43')]({'where':{'id':_0x3353b1[_0xf51e('0x38')]['id']}})['then'](handleEntityNotFound(_0x5b77c1,null))[_0xf51e('0x14')](saveUpdates(_0x3353b1[_0xf51e('0x42')],null))[_0xf51e('0x14')](function(_0x2d8d0c){if(!_0x2d8d0c)return;var _0x1fe9e3=_0x2d8d0c[_0xf51e('0x3c')]({'plain':!![]});return _0x1fe9e3;})[_0xf51e('0x14')](function(_0x1b2733){var _0x47769f=new Redis(config['redis']);_0x47769f['publish'](_0xf51e('0x17'),JSON['stringify'](_[_0xf51e('0x2d')](_0x1b2733,['id',_0xf51e('0x1c'),_0xf51e('0x44')])));return _0x1b2733;})[_0xf51e('0x14')](respondWithResult(_0x5b77c1,null))['catch'](handleError(_0x5b77c1,null));};exports[_0xf51e('0x13')]=function(_0x5008c7,_0x3c5531){return db[_0xf51e('0x1e')][_0xf51e('0x43')]({'where':{'id':_0x5008c7[_0xf51e('0x38')]['id']}})[_0xf51e('0x14')](handleEntityNotFound(_0x3c5531,null))[_0xf51e('0x14')](removeEntity(_0x3c5531,null))[_0xf51e('0x36')](handleError(_0x3c5531,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1b96731..80ee795 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 _0x6836=['events','../../mysqldb','setMaxListeners','emit','hasOwnProperty','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6836,0x198));var _0x6683=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x6836[_0x341e0f];return _0x59555a;};'use strict';var EventEmitter=require(_0x6683('0x0'));var SquareProject=require(_0x6683('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6683('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x156e38){return function(_0x56df25,_0x25e27a,_0x35d6ff){SquareProjectEvents[_0x6683('0x3')](_0x156e38+':'+_0x56df25['id'],_0x56df25);SquareProjectEvents[_0x6683('0x3')](_0x156e38,_0x56df25);_0x35d6ff(null);};}for(var e in events){if(events[_0x6683('0x4')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x6683('0x5')]=SquareProjectEvents; \ No newline at end of file +var _0xdd75=['SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x466186,_0x59ec76){var _0x795885=function(_0x2b8b5d){while(--_0x2b8b5d){_0x466186['push'](_0x466186['shift']());}};_0x795885(++_0x59ec76);}(_0xdd75,0x1dc));var _0x5dd7=function(_0x4ce15c,_0x1bbcbd){_0x4ce15c=_0x4ce15c-0x0;var _0x5ee259=_0xdd75[_0x4ce15c];return _0x5ee259;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x5dd7('0x0'))['db'][_0x5dd7('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5dd7('0x2')](0x0);var events={'afterCreate':_0x5dd7('0x3'),'afterUpdate':'update','afterDestroy':_0x5dd7('0x4')};function emitEvent(_0x38acbb){return function(_0x22cfb1,_0x3413c8,_0x18bf9a){SquareProjectEvents[_0x5dd7('0x5')](_0x38acbb+':'+_0x22cfb1['id'],_0x22cfb1);SquareProjectEvents[_0x5dd7('0x5')](_0x38acbb,_0x22cfb1);_0x18bf9a(null);};}for(var e in events){if(events[_0x5dd7('0x6')](e)){var event=events[e];SquareProject[_0x5dd7('0x7')](e,emitEvent(event));}}module[_0x5dd7('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index a4319c5..07d21e6 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 _0xc8ef=['moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','changed','lodash','util','../../config/logger','api'];(function(_0x7c9831,_0x1f00ad){var _0x25d3e6=function(_0x4c07ee){while(--_0x4c07ee){_0x7c9831['push'](_0x7c9831['shift']());}};_0x25d3e6(++_0x1f00ad);}(_0xc8ef,0x14c));var _0xfc8e=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xc8ef[_0x122096];return _0x3d1966;};'use strict';var _=require(_0xfc8e('0x0'));var util=require(_0xfc8e('0x1'));var logger=require(_0xfc8e('0x2'))(_0xfc8e('0x3'));var moment=require(_0xfc8e('0x4'));var BPromise=require('bluebird');var rp=require(_0xfc8e('0x5'));var fs=require('fs');var path=require(_0xfc8e('0x6'));var rimraf=require(_0xfc8e('0x7'));var config=require(_0xfc8e('0x8'));var attributes=require(_0xfc8e('0x9'));module[_0xfc8e('0xa')]=function(_0x10e64f,_0x25ee4a){return _0x10e64f[_0xfc8e('0xb')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1176ed,_0x400584,_0x431690){if(_0x1176ed['changed'](_0xfc8e('0xc'))){_0x1176ed['savedAt']=moment()[_0xfc8e('0xd')](_0xfc8e('0xe'));}if(_0x1176ed[_0xfc8e('0xf')]('production')){_0x1176ed['publishedAt']=moment()[_0xfc8e('0xd')](_0xfc8e('0xe'));}_0x431690(null,_0x1176ed);}}});}; \ No newline at end of file +var _0xfb1d=['changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment','bluebird','rimraf','SquareProject','square_projects'];(function(_0x52ece1,_0x425dc5){var _0x329205=function(_0xf76c47){while(--_0xf76c47){_0x52ece1['push'](_0x52ece1['shift']());}};_0x329205(++_0x425dc5);}(_0xfb1d,0x1c6));var _0xdfb1=function(_0x3b7747,_0x5fdfed){_0x3b7747=_0x3b7747-0x0;var _0x924528=_0xfb1d[_0x3b7747];return _0x924528;};'use strict';var _=require(_0xdfb1('0x0'));var util=require(_0xdfb1('0x1'));var logger=require(_0xdfb1('0x2'))('api');var moment=require(_0xdfb1('0x3'));var BPromise=require(_0xdfb1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdfb1('0x5'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module['exports']=function(_0x424213,_0x347a40){return _0x424213['define'](_0xdfb1('0x6'),attributes,{'tableName':_0xdfb1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26d0e1,_0x535515,_0x1a80ce){if(_0x26d0e1[_0xdfb1('0x8')](_0xdfb1('0x9'))){_0x26d0e1['savedAt']=moment()[_0xdfb1('0xa')](_0xdfb1('0xb'));}if(_0x26d0e1[_0xdfb1('0x8')](_0xdfb1('0xc'))){_0x26d0e1[_0xdfb1('0xd')]=moment()[_0xdfb1('0xa')](_0xdfb1('0xb'));}_0x1a80ce(null,_0x26d0e1);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 460d089..48527ad 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 _0x7497=['raw','lodash','ioredis','../../mysqldb','rpc','../../config/environment','redis','socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','limit','include','map','model','attributes','then','debug','stringify','catch','error','message','ShowSquareProject','find'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7497,0xeb));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7749('0x0'));var Redis=require(_0x7749('0x1'));var db=require(_0x7749('0x2'))['db'];var logger=require('../../config/logger')(_0x7749('0x3'));var config=require(_0x7749('0x4'));config[_0x7749('0x5')]=_['defaults'](config[_0x7749('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x7749('0x6'))(new Redis(config[_0x7749('0x5')]));require('./squareProject.socket')[_0x7749('0x7')](socket);exports[_0x7749('0x8')]=function(_0x508c81){var _0x135890=this;return new Promise(function(_0x26b388,_0x388390){return db[_0x7749('0x9')][_0x7749('0xa')]({'raw':_0x508c81[_0x7749('0xb')]?_0x508c81[_0x7749('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x508c81[_0x7749('0xb')]?_0x508c81[_0x7749('0xb')]['where']||null:null,'attributes':_0x508c81[_0x7749('0xb')]?_0x508c81[_0x7749('0xb')]['attributes']||null:null,'limit':_0x508c81[_0x7749('0xb')]?_0x508c81[_0x7749('0xb')][_0x7749('0xc')]||null:null,'include':_0x508c81['options']?_0x508c81[_0x7749('0xb')][_0x7749('0xd')]?_[_0x7749('0xe')](_0x508c81[_0x7749('0xb')][_0x7749('0xd')],function(_0x57f5d5){return{'model':db[_0x57f5d5[_0x7749('0xf')]],'as':_0x57f5d5['as'],'attributes':_0x57f5d5[_0x7749('0x10')],'include':_0x57f5d5['include']?_[_0x7749('0xe')](_0x57f5d5[_0x7749('0xd')],function(_0xc016dc){return{'model':db[_0xc016dc[_0x7749('0xf')]],'as':_0xc016dc['as'],'attributes':_0xc016dc[_0x7749('0x10')],'include':_0xc016dc[_0x7749('0xd')]?_[_0x7749('0xe')](_0xc016dc[_0x7749('0xd')],function(_0x39ba18){return{'model':db[_0x39ba18[_0x7749('0xf')]],'as':_0x39ba18['as'],'attributes':_0x39ba18[_0x7749('0x10')]};}):[]};}):[]};}):[]:[]})[_0x7749('0x11')](function(_0x1e4ce5){logger['info'](_0x7749('0x8'),_0x508c81);logger[_0x7749('0x12')](_0x7749('0x8'),_0x508c81,JSON[_0x7749('0x13')](_0x1e4ce5));_0x26b388(_0x1e4ce5);})[_0x7749('0x14')](function(_0x57fe5d){logger[_0x7749('0x15')]('GetSquareProjects',_0x57fe5d['message'],_0x508c81);_0x388390(_0x135890['error'](0x1f4,_0x57fe5d[_0x7749('0x16')]));});});};exports[_0x7749('0x17')]=function(_0x14f4bc){var _0x251162=this;return new Promise(function(_0x2dda34,_0xa44edc){return db[_0x7749('0x9')][_0x7749('0x18')]({'raw':_0x14f4bc['options']?_0x14f4bc[_0x7749('0xb')][_0x7749('0x19')]===undefined?!![]:![]:!![],'where':_0x14f4bc['options']?_0x14f4bc['options']['where']||null:null,'attributes':_0x14f4bc[_0x7749('0xb')]?_0x14f4bc['options'][_0x7749('0x10')]||null:null,'include':_0x14f4bc['options']?_0x14f4bc[_0x7749('0xb')][_0x7749('0xd')]?_[_0x7749('0xe')](_0x14f4bc[_0x7749('0xb')][_0x7749('0xd')],function(_0x403c81){return{'model':db[_0x403c81[_0x7749('0xf')]],'as':_0x403c81['as'],'attributes':_0x403c81['attributes'],'include':_0x403c81[_0x7749('0xd')]?_['map'](_0x403c81[_0x7749('0xd')],function(_0x506089){return{'model':db[_0x506089['model']],'as':_0x506089['as'],'attributes':_0x506089['attributes'],'include':_0x506089[_0x7749('0xd')]?_[_0x7749('0xe')](_0x506089['include'],function(_0x3ab9f1){return{'model':db[_0x3ab9f1[_0x7749('0xf')]],'as':_0x3ab9f1['as'],'attributes':_0x3ab9f1[_0x7749('0x10')]};}):[]};}):[]};}):[]:[]})[_0x7749('0x11')](function(_0x387db4){logger['info']('ShowSquareProject',_0x14f4bc);logger[_0x7749('0x12')](_0x7749('0x17'),_0x14f4bc,JSON[_0x7749('0x13')](_0x387db4));_0x2dda34(_0x387db4);})[_0x7749('0x14')](function(_0x590cb3){logger[_0x7749('0x15')](_0x7749('0x17'),_0x590cb3[_0x7749('0x16')],_0x14f4bc);_0xa44edc(_0x251162['error'](0x1f4,_0x590cb3['message']));});});}; \ No newline at end of file +var _0x494f=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','raw','limit','include','map','model','attributes','info','debug','error','message','ShowSquareProject','where','then','catch','lodash'];(function(_0x1731cb,_0xa8248a){var _0x4ae85d=function(_0x591872){while(--_0x591872){_0x1731cb['push'](_0x1731cb['shift']());}};_0x4ae85d(++_0xa8248a);}(_0x494f,0x133));var _0xf494=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x494f[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0xf494('0x0'));var Redis=require(_0xf494('0x1'));var db=require(_0xf494('0x2'))['db'];var logger=require(_0xf494('0x3'))(_0xf494('0x4'));var config=require(_0xf494('0x5'));config[_0xf494('0x6')]=_[_0xf494('0x7')](config['redis'],{'host':_0xf494('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf494('0x9'))['register'](socket);exports[_0xf494('0xa')]=function(_0x34e20c){var _0x464c8e=this;return new Promise(function(_0x2bf396,_0x1e1253){return db[_0xf494('0xb')][_0xf494('0xc')]({'raw':_0x34e20c['options']?_0x34e20c[_0xf494('0xd')][_0xf494('0xe')]===undefined?!![]:![]:!![],'where':_0x34e20c['options']?_0x34e20c['options']['where']||null:null,'attributes':_0x34e20c[_0xf494('0xd')]?_0x34e20c['options']['attributes']||null:null,'limit':_0x34e20c['options']?_0x34e20c[_0xf494('0xd')][_0xf494('0xf')]||null:null,'include':_0x34e20c[_0xf494('0xd')]?_0x34e20c[_0xf494('0xd')][_0xf494('0x10')]?_[_0xf494('0x11')](_0x34e20c[_0xf494('0xd')][_0xf494('0x10')],function(_0x319a14){return{'model':db[_0x319a14[_0xf494('0x12')]],'as':_0x319a14['as'],'attributes':_0x319a14[_0xf494('0x13')],'include':_0x319a14[_0xf494('0x10')]?_['map'](_0x319a14[_0xf494('0x10')],function(_0x1b4f7e){return{'model':db[_0x1b4f7e['model']],'as':_0x1b4f7e['as'],'attributes':_0x1b4f7e[_0xf494('0x13')],'include':_0x1b4f7e[_0xf494('0x10')]?_['map'](_0x1b4f7e[_0xf494('0x10')],function(_0x1f056a){return{'model':db[_0x1f056a[_0xf494('0x12')]],'as':_0x1f056a['as'],'attributes':_0x1f056a[_0xf494('0x13')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd8f022){logger[_0xf494('0x14')]('GetSquareProjects',_0x34e20c);logger[_0xf494('0x15')](_0xf494('0xa'),_0x34e20c,JSON['stringify'](_0xd8f022));_0x2bf396(_0xd8f022);})['catch'](function(_0x4977d3){logger[_0xf494('0x16')]('GetSquareProjects',_0x4977d3[_0xf494('0x17')],_0x34e20c);_0x1e1253(_0x464c8e['error'](0x1f4,_0x4977d3[_0xf494('0x17')]));});});};exports[_0xf494('0x18')]=function(_0xb8e33a){var _0x1db114=this;return new Promise(function(_0x4bdac3,_0x15f5a4){return db['SquareProject']['find']({'raw':_0xb8e33a['options']?_0xb8e33a[_0xf494('0xd')][_0xf494('0xe')]===undefined?!![]:![]:!![],'where':_0xb8e33a[_0xf494('0xd')]?_0xb8e33a[_0xf494('0xd')][_0xf494('0x19')]||null:null,'attributes':_0xb8e33a['options']?_0xb8e33a[_0xf494('0xd')][_0xf494('0x13')]||null:null,'include':_0xb8e33a[_0xf494('0xd')]?_0xb8e33a['options'][_0xf494('0x10')]?_[_0xf494('0x11')](_0xb8e33a['options'][_0xf494('0x10')],function(_0x4bcd96){return{'model':db[_0x4bcd96[_0xf494('0x12')]],'as':_0x4bcd96['as'],'attributes':_0x4bcd96[_0xf494('0x13')],'include':_0x4bcd96['include']?_[_0xf494('0x11')](_0x4bcd96[_0xf494('0x10')],function(_0x26d549){return{'model':db[_0x26d549[_0xf494('0x12')]],'as':_0x26d549['as'],'attributes':_0x26d549[_0xf494('0x13')],'include':_0x26d549[_0xf494('0x10')]?_[_0xf494('0x11')](_0x26d549[_0xf494('0x10')],function(_0x38108e){return{'model':db[_0x38108e[_0xf494('0x12')]],'as':_0x38108e['as'],'attributes':_0x38108e[_0xf494('0x13')]};}):[]};}):[]};}):[]:[]})[_0xf494('0x1a')](function(_0x5c0e7a){logger[_0xf494('0x14')](_0xf494('0x18'),_0xb8e33a);logger[_0xf494('0x15')]('ShowSquareProject',_0xb8e33a,JSON['stringify'](_0x5c0e7a));_0x4bdac3(_0x5c0e7a);})[_0xf494('0x1b')](function(_0x3f3a24){logger[_0xf494('0x16')](_0xf494('0x18'),_0x3f3a24[_0xf494('0x17')],_0xb8e33a);_0x15f5a4(_0x1db114[_0xf494('0x16')](0x1f4,_0x3f3a24['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 735389b..fc78002 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 _0xce1c=['emit','removeListener','register','length','./squareProject.events','save','remove','update'];(function(_0x20f256,_0x2f58ec){var _0x5ced25=function(_0x15a4c4){while(--_0x15a4c4){_0x20f256['push'](_0x20f256['shift']());}};_0x5ced25(++_0x2f58ec);}(_0xce1c,0x18c));var _0xcce1=function(_0x95d45,_0x4bb3f1){_0x95d45=_0x95d45-0x0;var _0x38086f=_0xce1c[_0x95d45];return _0x38086f;};'use strict';var SquareProjectEvents=require(_0xcce1('0x0'));var events=[_0xcce1('0x1'),_0xcce1('0x2'),_0xcce1('0x3')];function createListener(_0x64f7a6,_0xe8e693){return function(_0x177195){_0xe8e693[_0xcce1('0x4')](_0x64f7a6,_0x177195);};}function removeListener(_0x15737f,_0x5a6d35){return function(){SquareProjectEvents[_0xcce1('0x5')](_0x15737f,_0x5a6d35);};}exports[_0xcce1('0x6')]=function(_0x43316e){for(var _0x2730f5=0x0,_0x5630ce=events[_0xcce1('0x7')];_0x2730f5<_0x5630ce;_0x2730f5++){var _0x457e86=events[_0x2730f5];var _0x6b6415=createListener('squareProject:'+_0x457e86,_0x43316e);SquareProjectEvents['on'](_0x457e86,_0x6b6415);}}; \ No newline at end of file +var _0x3be0=['length','squareProject:','save','remove','update'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0x3be0,0x11a));var _0x03be=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x3be0[_0x45f951];return _0x24756c;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x03be('0x0'),_0x03be('0x1'),_0x03be('0x2')];function createListener(_0x3e666f,_0x557d12){return function(_0x15d76c){_0x557d12['emit'](_0x3e666f,_0x15d76c);};}function removeListener(_0x1a34ec,_0x3d9aab){return function(){SquareProjectEvents['removeListener'](_0x1a34ec,_0x3d9aab);};}exports['register']=function(_0x9f423b){for(var _0x2c741d=0x0,_0x584093=events[_0x03be('0x3')];_0x2c741d<_0x584093;_0x2c741d++){var _0x3186a3=events[_0x2c741d];var _0x2604a0=createListener(_0x03be('0x4')+_0x3186a3,_0x9f423b);SquareProjectEvents['on'](_0x3186a3,_0x2604a0);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 15ef253..78f0e9b 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 _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x52d93f,_0x1e8ae9){var _0xf79159=function(_0x119dfc){while(--_0x119dfc){_0x52d93f['push'](_0x52d93f['shift']());}};_0xf79159(++_0x1e8ae9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4ced70,_0x32626e){_0x4ced70=_0x4ced70-0x0;var _0x1faa4b=_0x1cb9[_0x4ced70];return _0x1faa4b;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x11668f,_0xf43a60){var _0x221b66=function(_0x464b20){while(--_0x464b20){_0x11668f['push'](_0x11668f['shift']());}};_0x221b66(++_0xf43a60);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xc4aa[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 46d3a53..58b1fac 100644 --- a/server/api/squareRecording/squareRecording.attributes.js +++ b/server/api/squareRecording/squareRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x12f14b,_0x40d3f9){var _0xfb171b=function(_0x1a350c){while(--_0x1a350c){_0x12f14b['push'](_0x12f14b['shift']());}};_0xfb171b(++_0x40d3f9);}(_0xd8fb,0x99));var _0xbd8f=function(_0x514cf5,_0x3363e2){_0x514cf5=_0x514cf5-0x0;var _0x5890c4=_0xd8fb[_0x514cf5];return _0x5890c4;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file +var _0x9957=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x177a87,_0x33ce68){var _0x43cd09=function(_0x2e2771){while(--_0x2e2771){_0x177a87['push'](_0x177a87['shift']());}};_0x43cd09(++_0x33ce68);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7995('0x2')]},'extension':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x7995('0x2')]},'saveName':{'type':Sequelize[_0x7995('0x2')]},'filename':{'type':Sequelize[_0x7995('0x2')]},'savePath':{'type':Sequelize[_0x7995('0x2')]},'format':{'type':Sequelize[_0x7995('0x3')],'get':function(){var _0x326741='';var _0x4996ca=this[_0x7995('0x4')](_0x7995('0x5'));if(_0x4996ca){_0x326741=_0x4996ca['substring'](_0x4996ca[_0x7995('0x6')]('.'));}return _0x326741;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5e64a04..2625f6f 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 _0xdaa3=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SquareRecording','includeAll','include','rows','catch','show','params','keys','find','create','body','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','secrets','recording','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf'];(function(_0x3c857c,_0x4db3fe){var _0x58bfe6=function(_0xdae7f7){while(--_0xdae7f7){_0x3c857c['push'](_0x3c857c['shift']());}};_0x58bfe6(++_0x4db3fe);}(_0xdaa3,0x18a));var _0x3daa=function(_0x738e74,_0x12b183){_0x738e74=_0x738e74-0x0;var _0x3552f7=_0xdaa3[_0x738e74];return _0x3552f7;};'use strict';var emlformat=require(_0x3daa('0x0'));var rimraf=require(_0x3daa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3daa('0x2'));var rp=require(_0x3daa('0x3'));var moment=require(_0x3daa('0x4'));var BPromise=require(_0x3daa('0x5'));var Mustache=require(_0x3daa('0x6'));var util=require(_0x3daa('0x7'));var path=require(_0x3daa('0x8'));var sox=require(_0x3daa('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3daa('0xa'));var _=require('lodash');var squel=require(_0x3daa('0xb'));var crypto=require(_0x3daa('0xc'));var jsforce=require(_0x3daa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3daa('0xe'));var querystring=require(_0x3daa('0xf'));var Papa=require('papaparse');var Redis=require(_0x3daa('0x10'));var authService=require(_0x3daa('0x11'));var qs=require(_0x3daa('0x12'));var as=require(_0x3daa('0x13'));var hardwareService=require(_0x3daa('0x14'));var logger=require(_0x3daa('0x15'))(_0x3daa('0x16'));var utils=require('../../config/utils');var config=require(_0x3daa('0x17'));var licenseUtil=require(_0x3daa('0x18'));var db=require(_0x3daa('0x19'))['db'];function respondWithStatusCode(_0x4ef119,_0x1e00e2){_0x1e00e2=_0x1e00e2||0xcc;return function(_0xd3e940){if(_0xd3e940){return _0x4ef119['sendStatus'](_0x1e00e2);}return _0x4ef119['status'](_0x1e00e2)[_0x3daa('0x1a')]();};}function respondWithResult(_0x2eaa82,_0x2a2c03){_0x2a2c03=_0x2a2c03||0xc8;return function(_0x4b31bb){if(_0x4b31bb){return _0x2eaa82[_0x3daa('0x1b')](_0x2a2c03)['json'](_0x4b31bb);}};}function respondWithFilteredResult(_0x5b07f3,_0x25fd2e){return function(_0x62ae05){if(_0x62ae05){var _0x284bcb=typeof _0x25fd2e[_0x3daa('0x1c')]===_0x3daa('0x1d')&&typeof _0x25fd2e[_0x3daa('0x1e')]===_0x3daa('0x1d');var _0x16306e=_0x62ae05[_0x3daa('0x1f')];var _0x330dca=_0x284bcb?0x0:_0x25fd2e['offset'];var _0x30b7d5=_0x284bcb?_0x62ae05[_0x3daa('0x1f')]:_0x25fd2e['offset']+_0x25fd2e[_0x3daa('0x1e')];var _0xbb17c9;if(_0x30b7d5>=_0x16306e){_0x30b7d5=_0x16306e;_0xbb17c9=0xc8;}else{_0xbb17c9=0xce;}_0x5b07f3[_0x3daa('0x1b')](_0xbb17c9);return _0x5b07f3[_0x3daa('0x20')](_0x3daa('0x21'),_0x330dca+'-'+_0x30b7d5+'/'+_0x16306e)[_0x3daa('0x22')](_0x62ae05);}return null;};}function patchUpdates(_0x10efe1){return function(_0x1174f4){try{jsonpatch[_0x3daa('0x23')](_0x1174f4,_0x10efe1,!![]);}catch(_0x18fd60){return BPromise[_0x3daa('0x24')](_0x18fd60);}return _0x1174f4[_0x3daa('0x25')]();};}function saveUpdates(_0x2b7bd5,_0x289b5f){return function(_0x47f188){if(_0x47f188){return _0x47f188['update'](_0x2b7bd5)[_0x3daa('0x26')](function(_0x336881){return _0x336881;});}return null;};}function removeEntity(_0x14e605,_0x27859d){return function(_0x310cad){if(_0x310cad){return _0x310cad[_0x3daa('0x27')]()[_0x3daa('0x26')](function(){_0x14e605['status'](0xcc)[_0x3daa('0x1a')]();});}};}function handleEntityNotFound(_0x1cb9d3,_0x121565){return function(_0x3ab980){if(!_0x3ab980){_0x1cb9d3[_0x3daa('0x28')](0x194);}return _0x3ab980;};}function handleError(_0x12fd6a,_0x127a17){_0x127a17=_0x127a17||0x1f4;return function(_0x2cdf7f){logger[_0x3daa('0x29')](_0x2cdf7f[_0x3daa('0x2a')]);if(_0x2cdf7f['name']){delete _0x2cdf7f[_0x3daa('0x2b')];}_0x12fd6a[_0x3daa('0x1b')](_0x127a17)[_0x3daa('0x2c')](_0x2cdf7f);};}exports[_0x3daa('0x2d')]=function(_0x484e02,_0x3dfed2){var _0x4b1225={},_0x57b8b6={},_0x47d36d={'count':0x0,'rows':[]};var _0x597cda=_[_0x3daa('0x2e')](db['SquareRecording'][_0x3daa('0x2f')],function(_0x3ac0fd){return{'name':_0x3ac0fd['fieldName'],'type':_0x3ac0fd[_0x3daa('0x30')][_0x3daa('0x31')]};});_0x57b8b6['model']=_['map'](_0x597cda,_0x3daa('0x2b'));_0x57b8b6[_0x3daa('0x32')]=_['keys'](_0x484e02[_0x3daa('0x32')]);_0x57b8b6[_0x3daa('0x33')]=_[_0x3daa('0x34')](_0x57b8b6[_0x3daa('0x35')],_0x57b8b6['query']);_0x4b1225[_0x3daa('0x36')]=_[_0x3daa('0x34')](_0x57b8b6[_0x3daa('0x35')],qs[_0x3daa('0x37')](_0x484e02[_0x3daa('0x32')][_0x3daa('0x37')]));_0x4b1225['attributes']=_0x4b1225['attributes']['length']?_0x4b1225[_0x3daa('0x36')]:_0x57b8b6[_0x3daa('0x35')];if(!_0x484e02[_0x3daa('0x32')][_0x3daa('0x38')](_0x3daa('0x39'))){_0x4b1225[_0x3daa('0x1e')]=qs[_0x3daa('0x1e')](_0x484e02['query']['limit']);_0x4b1225[_0x3daa('0x1c')]=qs['offset'](_0x484e02['query'][_0x3daa('0x1c')]);}_0x4b1225[_0x3daa('0x3a')]=qs[_0x3daa('0x3b')](_0x484e02[_0x3daa('0x32')][_0x3daa('0x3b')]);_0x4b1225[_0x3daa('0x3c')]=qs[_0x3daa('0x33')](_[_0x3daa('0x3d')](_0x484e02['query'],_0x57b8b6['filters']),_0x597cda);if(_0x484e02['query'][_0x3daa('0x3e')]){_0x4b1225[_0x3daa('0x3c')]=_[_0x3daa('0x3f')](_0x4b1225[_0x3daa('0x3c')],{'$or':_[_0x3daa('0x2e')](_0x597cda,function(_0x351e4c){if(_0x351e4c['type']!==_0x3daa('0x40')){var _0x3479bc={};_0x3479bc[_0x351e4c[_0x3daa('0x2b')]]={'$like':'%'+_0x484e02[_0x3daa('0x32')]['filter']+'%'};return _0x3479bc;}})});}_0x4b1225=_['merge']({},_0x4b1225,_0x484e02[_0x3daa('0x41')]);var _0x407321={'where':_0x4b1225[_0x3daa('0x3c')]};return db[_0x3daa('0x42')][_0x3daa('0x1f')](_0x407321)[_0x3daa('0x26')](function(_0xe717c1){_0x47d36d['count']=_0xe717c1;if(_0x484e02[_0x3daa('0x32')][_0x3daa('0x43')]){_0x4b1225[_0x3daa('0x44')]=[{'all':!![]}];}return db[_0x3daa('0x42')]['findAll'](_0x4b1225);})['then'](function(_0x3ac99e){_0x47d36d[_0x3daa('0x45')]=_0x3ac99e;return _0x47d36d;})['then'](respondWithFilteredResult(_0x3dfed2,_0x4b1225))[_0x3daa('0x46')](handleError(_0x3dfed2,null));};exports[_0x3daa('0x47')]=function(_0x4c2301,_0x5c4a5e){var _0x455a3b={'raw':!![],'where':{'id':_0x4c2301[_0x3daa('0x48')]['id']}},_0x477d44={};_0x477d44['model']=_['keys'](db[_0x3daa('0x42')][_0x3daa('0x2f')]);_0x477d44[_0x3daa('0x32')]=_[_0x3daa('0x49')](_0x4c2301[_0x3daa('0x32')]);_0x477d44[_0x3daa('0x33')]=_['intersection'](_0x477d44[_0x3daa('0x35')],_0x477d44[_0x3daa('0x32')]);_0x455a3b[_0x3daa('0x36')]=_['intersection'](_0x477d44[_0x3daa('0x35')],qs['fields'](_0x4c2301[_0x3daa('0x32')][_0x3daa('0x37')]));_0x455a3b['attributes']=_0x455a3b[_0x3daa('0x36')]['length']?_0x455a3b[_0x3daa('0x36')]:_0x477d44[_0x3daa('0x35')];if(_0x4c2301[_0x3daa('0x32')]['includeAll']){_0x455a3b[_0x3daa('0x44')]=[{'all':!![]}];}_0x455a3b=_[_0x3daa('0x3f')]({},_0x455a3b,_0x4c2301[_0x3daa('0x41')]);return db[_0x3daa('0x42')][_0x3daa('0x4a')](_0x455a3b)['then'](handleEntityNotFound(_0x5c4a5e,null))[_0x3daa('0x26')](respondWithResult(_0x5c4a5e,null))[_0x3daa('0x46')](handleError(_0x5c4a5e,null));};exports[_0x3daa('0x4b')]=function(_0x136de4,_0x4d8b5a){return db[_0x3daa('0x42')][_0x3daa('0x4b')](_0x136de4[_0x3daa('0x4c')],{})['then'](respondWithResult(_0x4d8b5a,0xc9))['catch'](handleError(_0x4d8b5a,null));};exports['update']=function(_0xef332e,_0x274b31){if(_0xef332e['body']['id']){delete _0xef332e['body']['id'];}return db[_0x3daa('0x42')]['find']({'where':{'id':_0xef332e[_0x3daa('0x48')]['id']}})[_0x3daa('0x26')](handleEntityNotFound(_0x274b31,null))[_0x3daa('0x26')](saveUpdates(_0xef332e[_0x3daa('0x4c')],null))[_0x3daa('0x26')](respondWithResult(_0x274b31,null))[_0x3daa('0x46')](handleError(_0x274b31,null));};exports['download']=function(_0x5afb9b,_0x2415a7,_0x1962e9){var _0x2c8202=require(_0x3daa('0x4d'));var _0x4b0891=![];var _0x240deb={};if(_0x5afb9b[_0x3daa('0x32')][_0x3daa('0x30')]&&_0x5afb9b[_0x3daa('0x32')][_0x3daa('0x30')]===_0x3daa('0x4e')){_0x240deb['uniqueid']=_0x5afb9b['params']['id'];}else{_0x240deb['id']=_0x5afb9b[_0x3daa('0x48')]['id'];}return db[_0x3daa('0x42')][_0x3daa('0x4a')]({'where':_0x240deb,'attributes':['id','savePath',_0x3daa('0x4f')],'raw':!![]})[_0x3daa('0x26')](handleEntityNotFound(_0x2415a7,null))[_0x3daa('0x26')](function(_0x35dfa2){if(_0x35dfa2){var _0x59f0b8=_0x35dfa2[_0x3daa('0x50')];var _0x46445e=util[_0x3daa('0x51')](_0x3daa('0x52'),_0x59f0b8);if(fs[_0x3daa('0x53')](_0x46445e)){_0x4b0891=!![];return _0x2c8202['decryptFile'](_0x46445e,_0x59f0b8,config[_0x3daa('0x54')][_0x3daa('0x55')])[_0x3daa('0x26')](function(){return _0x35dfa2;});}return _0x35dfa2;}})[_0x3daa('0x26')](function(_0x3f1d3c){if(_0x3f1d3c){var _0x6139b=_0x3f1d3c[_0x3daa('0x50')];if(!fs[_0x3daa('0x53')](_0x6139b)){throw new db['Sequelize'][(_0x3daa('0x56'))](_0x3daa('0x57'));}if(_0x3f1d3c[_0x3daa('0x4f')]){return _0x2415a7[_0x3daa('0x58')](_0x6139b,_0x3f1d3c[_0x3daa('0x4f')]+path[_0x3daa('0x59')](_0x6139b),function(){if(_0x4b0891){fs[_0x3daa('0x5a')](_0x6139b);}});}else{return _0x2415a7[_0x3daa('0x58')](_0x6139b,function(_0x1bfe50){if(_0x4b0891){fs['unlink'](_0x6139b);}});}}})[_0x3daa('0x46')](function(_0x421e03){if(_0x421e03[_0x3daa('0x5b')]==='SquareRecording\x20not\x20found'){_0x2415a7[_0x3daa('0x1b')](0x194)[_0x3daa('0x2c')](_0x3daa('0x5c'));}else{return handleError(_0x2415a7,null);}});};exports[_0x3daa('0x27')]=function(_0x5c91ea,_0x1f741a){return db['SquareRecording']['find']({'where':{'id':_0x5c91ea[_0x3daa('0x48')]['id']}})[_0x3daa('0x26')](function(_0x18647b){if(_['isNil'](_0x18647b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x18647b;})[_0x3daa('0x26')](function(_0xa11eb3){var _0x2aa305=_0xa11eb3[_0x3daa('0x50')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2aa305);if(!_[_0x3daa('0x5d')](_0xa11eb3['savePath'])&&fs['existsSync'](_0x2aa305)){logger[_0x3daa('0x5e')](_0x3daa('0x5f')+_0x2aa305+_0x3daa('0x60'));fs['unlinkSync'](_0x2aa305);}_0x2aa305=_0x2aa305+_0x3daa('0x61');if(!_[_0x3daa('0x5d')](_0xa11eb3[_0x3daa('0x50')])&&fs[_0x3daa('0x53')](_0x2aa305)){logger['info']('File:\x20\x22'+_0x2aa305+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3daa('0x62')](_0x2aa305);}return _0xa11eb3;})['then'](function(_0x35006e){if(!_0x35006e)throw new InternalError();return _0x35006e[_0x3daa('0x27')]();})[_0x3daa('0x26')](function(){_0x1f741a[_0x3daa('0x1b')](0xcc)[_0x3daa('0x1a')]();})['catch'](handleError(_0x1f741a,null));}; \ No newline at end of file +var _0x2984=['include','findAll','rows','catch','show','options','find','create','body','params','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','message','send','Not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','index','SquareRecording','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2984,0x82));var _0x4298=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x2984[_0x2265da];return _0x430c2b;};'use strict';var emlformat=require(_0x4298('0x0'));var rimraf=require(_0x4298('0x1'));var zipdir=require(_0x4298('0x2'));var jsonpatch=require(_0x4298('0x3'));var rp=require(_0x4298('0x4'));var moment=require('moment');var BPromise=require(_0x4298('0x5'));var Mustache=require(_0x4298('0x6'));var util=require('util');var path=require(_0x4298('0x7'));var sox=require(_0x4298('0x8'));var csv=require(_0x4298('0x9'));var ejs=require(_0x4298('0xa'));var fs=require('fs');var fs_extra=require(_0x4298('0xb'));var _=require(_0x4298('0xc'));var squel=require('squel');var crypto=require(_0x4298('0xd'));var jsforce=require(_0x4298('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4298('0x9'));var querystring=require(_0x4298('0xf'));var Papa=require(_0x4298('0x10'));var Redis=require('ioredis');var authService=require(_0x4298('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4298('0x12'));var hardwareService=require(_0x4298('0x13'));var logger=require(_0x4298('0x14'))(_0x4298('0x15'));var utils=require(_0x4298('0x16'));var config=require(_0x4298('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c7d2b,_0x3f98bd){_0x3f98bd=_0x3f98bd||0xcc;return function(_0x15efce){if(_0x15efce){return _0x5c7d2b[_0x4298('0x18')](_0x3f98bd);}return _0x5c7d2b[_0x4298('0x19')](_0x3f98bd)['end']();};}function respondWithResult(_0x595d8e,_0x2a7a1e){_0x2a7a1e=_0x2a7a1e||0xc8;return function(_0xb15e8b){if(_0xb15e8b){return _0x595d8e[_0x4298('0x19')](_0x2a7a1e)[_0x4298('0x1a')](_0xb15e8b);}};}function respondWithFilteredResult(_0x1a4bac,_0x32a5b0){return function(_0x5d0ff9){if(_0x5d0ff9){var _0x34261b=typeof _0x32a5b0[_0x4298('0x1b')]===_0x4298('0x1c')&&typeof _0x32a5b0['limit']===_0x4298('0x1c');var _0x3e2335=_0x5d0ff9[_0x4298('0x1d')];var _0xcc7fbc=_0x34261b?0x0:_0x32a5b0['offset'];var _0x11c810=_0x34261b?_0x5d0ff9[_0x4298('0x1d')]:_0x32a5b0[_0x4298('0x1b')]+_0x32a5b0[_0x4298('0x1e')];var _0x4cd666;if(_0x11c810>=_0x3e2335){_0x11c810=_0x3e2335;_0x4cd666=0xc8;}else{_0x4cd666=0xce;}_0x1a4bac[_0x4298('0x19')](_0x4cd666);return _0x1a4bac[_0x4298('0x1f')]('Content-Range',_0xcc7fbc+'-'+_0x11c810+'/'+_0x3e2335)[_0x4298('0x1a')](_0x5d0ff9);}return null;};}function patchUpdates(_0x1a41cc){return function(_0x3ad551){try{jsonpatch[_0x4298('0x20')](_0x3ad551,_0x1a41cc,!![]);}catch(_0x910c0){return BPromise[_0x4298('0x21')](_0x910c0);}return _0x3ad551[_0x4298('0x22')]();};}function saveUpdates(_0x217fcc,_0xfa8180){return function(_0x1138f5){if(_0x1138f5){return _0x1138f5[_0x4298('0x23')](_0x217fcc)[_0x4298('0x24')](function(_0x2cd4a8){return _0x2cd4a8;});}return null;};}function removeEntity(_0x6a8565,_0x4f8972){return function(_0x4dc119){if(_0x4dc119){return _0x4dc119[_0x4298('0x25')]()[_0x4298('0x24')](function(){_0x6a8565[_0x4298('0x19')](0xcc)[_0x4298('0x26')]();});}};}function handleEntityNotFound(_0x224605,_0x16912d){return function(_0x9c1a0e){if(!_0x9c1a0e){_0x224605[_0x4298('0x18')](0x194);}return _0x9c1a0e;};}function handleError(_0x4a0062,_0x257bae){_0x257bae=_0x257bae||0x1f4;return function(_0x31872f){logger[_0x4298('0x27')](_0x31872f[_0x4298('0x28')]);if(_0x31872f[_0x4298('0x29')]){delete _0x31872f['name'];}_0x4a0062[_0x4298('0x19')](_0x257bae)['send'](_0x31872f);};}exports[_0x4298('0x2a')]=function(_0x276ce2,_0x433da1){var _0x2f7689={},_0x46fe20={},_0x56427f={'count':0x0,'rows':[]};var _0x39d9a2=_['map'](db[_0x4298('0x2b')][_0x4298('0x2c')],function(_0x2930a8){return{'name':_0x2930a8[_0x4298('0x2d')],'type':_0x2930a8[_0x4298('0x2e')][_0x4298('0x2f')]};});_0x46fe20[_0x4298('0x30')]=_[_0x4298('0x31')](_0x39d9a2,_0x4298('0x29'));_0x46fe20[_0x4298('0x32')]=_[_0x4298('0x33')](_0x276ce2[_0x4298('0x32')]);_0x46fe20[_0x4298('0x34')]=_[_0x4298('0x35')](_0x46fe20[_0x4298('0x30')],_0x46fe20[_0x4298('0x32')]);_0x2f7689[_0x4298('0x36')]=_[_0x4298('0x35')](_0x46fe20[_0x4298('0x30')],qs['fields'](_0x276ce2[_0x4298('0x32')][_0x4298('0x37')]));_0x2f7689[_0x4298('0x36')]=_0x2f7689[_0x4298('0x36')][_0x4298('0x38')]?_0x2f7689[_0x4298('0x36')]:_0x46fe20[_0x4298('0x30')];if(!_0x276ce2['query']['hasOwnProperty'](_0x4298('0x39'))){_0x2f7689[_0x4298('0x1e')]=qs[_0x4298('0x1e')](_0x276ce2[_0x4298('0x32')][_0x4298('0x1e')]);_0x2f7689[_0x4298('0x1b')]=qs[_0x4298('0x1b')](_0x276ce2[_0x4298('0x32')][_0x4298('0x1b')]);}_0x2f7689[_0x4298('0x3a')]=qs[_0x4298('0x3b')](_0x276ce2['query'][_0x4298('0x3b')]);_0x2f7689[_0x4298('0x3c')]=qs[_0x4298('0x34')](_[_0x4298('0x3d')](_0x276ce2[_0x4298('0x32')],_0x46fe20['filters']),_0x39d9a2);if(_0x276ce2[_0x4298('0x32')]['filter']){_0x2f7689[_0x4298('0x3c')]=_[_0x4298('0x3e')](_0x2f7689[_0x4298('0x3c')],{'$or':_[_0x4298('0x31')](_0x39d9a2,function(_0x54789e){if(_0x54789e[_0x4298('0x2e')]!==_0x4298('0x3f')){var _0x25e339={};_0x25e339[_0x54789e[_0x4298('0x29')]]={'$like':'%'+_0x276ce2['query']['filter']+'%'};return _0x25e339;}})});}_0x2f7689=_[_0x4298('0x3e')]({},_0x2f7689,_0x276ce2['options']);var _0x5f1fd3={'where':_0x2f7689[_0x4298('0x3c')]};return db[_0x4298('0x2b')][_0x4298('0x1d')](_0x5f1fd3)[_0x4298('0x24')](function(_0x439f22){_0x56427f[_0x4298('0x1d')]=_0x439f22;if(_0x276ce2[_0x4298('0x32')]['includeAll']){_0x2f7689[_0x4298('0x40')]=[{'all':!![]}];}return db[_0x4298('0x2b')][_0x4298('0x41')](_0x2f7689);})['then'](function(_0x3513f1){_0x56427f[_0x4298('0x42')]=_0x3513f1;return _0x56427f;})['then'](respondWithFilteredResult(_0x433da1,_0x2f7689))[_0x4298('0x43')](handleError(_0x433da1,null));};exports[_0x4298('0x44')]=function(_0x16d918,_0x5a2163){var _0x25096f={'raw':!![],'where':{'id':_0x16d918['params']['id']}},_0x311fc7={};_0x311fc7[_0x4298('0x30')]=_[_0x4298('0x33')](db[_0x4298('0x2b')]['rawAttributes']);_0x311fc7[_0x4298('0x32')]=_['keys'](_0x16d918['query']);_0x311fc7[_0x4298('0x34')]=_[_0x4298('0x35')](_0x311fc7[_0x4298('0x30')],_0x311fc7[_0x4298('0x32')]);_0x25096f[_0x4298('0x36')]=_[_0x4298('0x35')](_0x311fc7['model'],qs['fields'](_0x16d918[_0x4298('0x32')]['fields']));_0x25096f[_0x4298('0x36')]=_0x25096f[_0x4298('0x36')][_0x4298('0x38')]?_0x25096f[_0x4298('0x36')]:_0x311fc7[_0x4298('0x30')];if(_0x16d918['query']['includeAll']){_0x25096f[_0x4298('0x40')]=[{'all':!![]}];}_0x25096f=_[_0x4298('0x3e')]({},_0x25096f,_0x16d918[_0x4298('0x45')]);return db[_0x4298('0x2b')][_0x4298('0x46')](_0x25096f)['then'](handleEntityNotFound(_0x5a2163,null))['then'](respondWithResult(_0x5a2163,null))[_0x4298('0x43')](handleError(_0x5a2163,null));};exports[_0x4298('0x47')]=function(_0x9c1764,_0x5051e0){return db['SquareRecording'][_0x4298('0x47')](_0x9c1764[_0x4298('0x48')],{})[_0x4298('0x24')](respondWithResult(_0x5051e0,0xc9))[_0x4298('0x43')](handleError(_0x5051e0,null));};exports['update']=function(_0x5bdc0b,_0x2b063e){if(_0x5bdc0b[_0x4298('0x48')]['id']){delete _0x5bdc0b[_0x4298('0x48')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x5bdc0b[_0x4298('0x49')]['id']}})['then'](handleEntityNotFound(_0x2b063e,null))[_0x4298('0x24')](saveUpdates(_0x5bdc0b['body'],null))[_0x4298('0x24')](respondWithResult(_0x2b063e,null))[_0x4298('0x43')](handleError(_0x2b063e,null));};exports['download']=function(_0x4992e1,_0x40ff3d,_0x50d1d6){var _0x3cd6c6=require('../../components/encryptor');var _0x28c2c4=![];var _0x23040d={};if(_0x4992e1['query'][_0x4298('0x2e')]&&_0x4992e1[_0x4298('0x32')]['type']===_0x4298('0x4a')){_0x23040d[_0x4298('0x4a')]=_0x4992e1['params']['id'];}else{_0x23040d['id']=_0x4992e1[_0x4298('0x49')]['id'];}return db[_0x4298('0x2b')][_0x4298('0x46')]({'where':_0x23040d,'attributes':['id',_0x4298('0x4b'),_0x4298('0x4c')],'raw':!![]})[_0x4298('0x24')](handleEntityNotFound(_0x40ff3d,null))[_0x4298('0x24')](function(_0x2cb889){if(_0x2cb889){var _0x5e0891=_0x2cb889[_0x4298('0x4b')];var _0x5c3e06=util[_0x4298('0x4d')](_0x4298('0x4e'),_0x5e0891);if(fs[_0x4298('0x4f')](_0x5c3e06)){_0x28c2c4=!![];return _0x3cd6c6[_0x4298('0x50')](_0x5c3e06,_0x5e0891,config[_0x4298('0x51')][_0x4298('0x52')])[_0x4298('0x24')](function(){return _0x2cb889;});}return _0x2cb889;}})[_0x4298('0x24')](function(_0x32fe5c){if(_0x32fe5c){var _0x1d5e50=_0x32fe5c[_0x4298('0x4b')];if(!fs['existsSync'](_0x1d5e50)){throw new db[(_0x4298('0x53'))]['ValidationError'](_0x4298('0x54'));}if(_0x32fe5c[_0x4298('0x4c')]){return _0x40ff3d[_0x4298('0x55')](_0x1d5e50,_0x32fe5c['filename']+path[_0x4298('0x56')](_0x1d5e50),function(){if(_0x28c2c4){fs[_0x4298('0x57')](_0x1d5e50);}});}else{return _0x40ff3d['download'](_0x1d5e50,function(_0x4187e2){if(_0x28c2c4){fs[_0x4298('0x57')](_0x1d5e50);}});}}})[_0x4298('0x43')](function(_0x10384f){if(_0x10384f[_0x4298('0x58')]===_0x4298('0x54')){_0x40ff3d[_0x4298('0x19')](0x194)[_0x4298('0x59')](_0x4298('0x5a'));}else{return handleError(_0x40ff3d,null);}});};exports[_0x4298('0x25')]=function(_0x3ba28d,_0x5966d7){return db[_0x4298('0x2b')][_0x4298('0x46')]({'where':{'id':_0x3ba28d[_0x4298('0x49')]['id']}})[_0x4298('0x24')](function(_0x932bda){if(_['isNil'](_0x932bda)){throw new ReferenceError('Entity\x20not\x20found');}return _0x932bda;})[_0x4298('0x24')](function(_0x33fac6){var _0x75c748=_0x33fac6[_0x4298('0x4b')];logger[_0x4298('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x75c748);if(!_['isNil'](_0x33fac6[_0x4298('0x4b')])&&fs[_0x4298('0x4f')](_0x75c748)){logger[_0x4298('0x5b')](_0x4298('0x5c')+_0x75c748+_0x4298('0x5d'));fs[_0x4298('0x5e')](_0x75c748);}_0x75c748=_0x75c748+_0x4298('0x5f');if(!_[_0x4298('0x60')](_0x33fac6[_0x4298('0x4b')])&&fs['existsSync'](_0x75c748)){logger[_0x4298('0x5b')](_0x4298('0x5c')+_0x75c748+_0x4298('0x5d'));fs['unlinkSync'](_0x75c748);}return _0x33fac6;})[_0x4298('0x24')](function(_0x1b4564){if(!_0x1b4564)throw new InternalError();return _0x1b4564[_0x4298('0x25')]();})[_0x4298('0x24')](function(){_0x5966d7['status'](0xcc)[_0x4298('0x26')]();})['catch'](handleError(_0x5966d7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 45da05c..a3ac267 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 _0x50e5=['square_recordings','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0xc3fe55,_0x35e121){var _0x2ea801=function(_0xd391e9){while(--_0xd391e9){_0xc3fe55['push'](_0xc3fe55['shift']());}};_0x2ea801(++_0x35e121);}(_0x50e5,0xb7));var _0x550e=function(_0x1fd7c3,_0x53a6df){_0x1fd7c3=_0x1fd7c3-0x0;var _0x53dd1b=_0x50e5[_0x1fd7c3];return _0x53dd1b;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var logger=require('../../config/logger')(_0x550e('0x2'));var moment=require(_0x550e('0x3'));var BPromise=require(_0x550e('0x4'));var rp=require(_0x550e('0x5'));var fs=require('fs');var path=require(_0x550e('0x6'));var rimraf=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var attributes=require(_0x550e('0x9'));module[_0x550e('0xa')]=function(_0x3d8c9b,_0x863e3b){return _0x3d8c9b[_0x550e('0xb')]('SquareRecording',attributes,{'tableName':_0x550e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7db=['./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa7db,0xbf));var _0xba7d=function(_0x448d13,_0x89c97){_0x448d13=_0x448d13-0x0;var _0xf6c8c9=_0xa7db[_0x448d13];return _0xf6c8c9;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var logger=require(_0xba7d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba7d('0x3'));var fs=require('fs');var path=require(_0xba7d('0x4'));var rimraf=require(_0xba7d('0x5'));var config=require(_0xba7d('0x6'));var attributes=require(_0xba7d('0x7'));module['exports']=function(_0x2f6d8d,_0x257384){return _0x2f6d8d[_0xba7d('0x8')](_0xba7d('0x9'),attributes,{'tableName':_0xba7d('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 2af2d3a..13ea02a 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 _0x67c1=['http','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','SquareRecording','create','options','raw','CreateSquareRecording','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56b421,_0x3f8745){var _0x354b93=function(_0x450c81){while(--_0x450c81){_0x56b421['push'](_0x56b421['shift']());}};_0x354b93(++_0x3f8745);}(_0x67c1,0x17d));var _0x167c=function(_0x225633,_0x4b218f){_0x225633=_0x225633-0x0;var _0x3cd943=_0x67c1[_0x225633];return _0x3cd943;};'use strict';var _=require(_0x167c('0x0'));var util=require(_0x167c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x167c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x167c('0x3'))['db'];var utils=require(_0x167c('0x4'));var logger=require(_0x167c('0x5'))(_0x167c('0x6'));var config=require(_0x167c('0x7'));var jayson=require(_0x167c('0x8'));var client=jayson['client'][_0x167c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47c174,_0x17342d,_0x4de4c1){return new BPromise(function(_0x2863c8,_0x149b1b){return client['request'](_0x47c174,_0x4de4c1)[_0x167c('0xa')](function(_0x1e3081){logger[_0x167c('0xb')]('SquareRecording,\x20%s,\x20%s',_0x17342d,_0x167c('0xc'));logger[_0x167c('0xd')](_0x167c('0xe'),_0x17342d,_0x167c('0xc'),JSON[_0x167c('0xf')](_0x1e3081));if(_0x1e3081[_0x167c('0x10')]){if(_0x1e3081['error'][_0x167c('0x11')]===0x1f4){logger['error'](_0x167c('0x12'),_0x17342d,_0x1e3081['error']['message']);return _0x149b1b(_0x1e3081[_0x167c('0x10')][_0x167c('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x17342d,_0x1e3081[_0x167c('0x10')]['message']);return _0x2863c8(_0x1e3081['error'][_0x167c('0x13')]);}else{logger[_0x167c('0xb')](_0x167c('0x12'),_0x17342d,_0x167c('0xc'));_0x2863c8(_0x1e3081['result'][_0x167c('0x13')]);}})[_0x167c('0x14')](function(_0x344c8b){logger['error'](_0x167c('0x12'),_0x17342d,_0x344c8b);_0x149b1b(_0x344c8b);});});}exports['CreateSquareRecording']=function(_0x298175){var _0x2f2208=this;return new Promise(function(_0x290d4b,_0x3945c0){return db[_0x167c('0x15')][_0x167c('0x16')](_0x298175['body'],{'raw':_0x298175[_0x167c('0x17')]?_0x298175[_0x167c('0x17')][_0x167c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x230675){logger[_0x167c('0xb')](_0x167c('0x19'),_0x298175);logger[_0x167c('0xd')]('CreateSquareRecording',_0x298175,JSON['stringify'](_0x230675));_0x290d4b(_0x230675);})['catch'](function(_0x11bbcc){logger[_0x167c('0x10')]('CreateSquareRecording',_0x11bbcc[_0x167c('0x13')],_0x298175);_0x3945c0(_0x2f2208[_0x167c('0x10')](0x1f4,_0x11bbcc['message']));});});}; \ No newline at end of file +var _0xebcd=['catch','SquareRecording','create','options','raw','CreateSquareRecording','lodash','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x3d2cd0,_0x31d4a9){var _0x47b219=function(_0x4687d0){while(--_0x4687d0){_0x3d2cd0['push'](_0x3d2cd0['shift']());}};_0x47b219(++_0x31d4a9);}(_0xebcd,0x18c));var _0xdebc=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xebcd[_0x49cb71];return _0x3a50fd;};'use strict';var _=require(_0xdebc('0x0'));var util=require('util');var moment=require(_0xdebc('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdebc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdebc('0x3'));var logger=require('../../config/logger')(_0xdebc('0x4'));var config=require(_0xdebc('0x5'));var jayson=require(_0xdebc('0x6'));var client=jayson[_0xdebc('0x7')][_0xdebc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x435862,_0x54956e,_0x1c94c3){return new BPromise(function(_0x51129e,_0x5a862b){return client[_0xdebc('0x9')](_0x435862,_0x1c94c3)[_0xdebc('0xa')](function(_0x4ce9ba){logger[_0xdebc('0xb')](_0xdebc('0xc'),_0x54956e,_0xdebc('0xd'));logger[_0xdebc('0xe')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x54956e,'request\x20sent',JSON[_0xdebc('0xf')](_0x4ce9ba));if(_0x4ce9ba[_0xdebc('0x10')]){if(_0x4ce9ba[_0xdebc('0x10')][_0xdebc('0x11')]===0x1f4){logger[_0xdebc('0x10')](_0xdebc('0xc'),_0x54956e,_0x4ce9ba[_0xdebc('0x10')][_0xdebc('0x12')]);return _0x5a862b(_0x4ce9ba[_0xdebc('0x10')][_0xdebc('0x12')]);}logger[_0xdebc('0x10')](_0xdebc('0xc'),_0x54956e,_0x4ce9ba[_0xdebc('0x10')][_0xdebc('0x12')]);return _0x51129e(_0x4ce9ba[_0xdebc('0x10')][_0xdebc('0x12')]);}else{logger[_0xdebc('0xb')](_0xdebc('0xc'),_0x54956e,_0xdebc('0xd'));_0x51129e(_0x4ce9ba[_0xdebc('0x13')][_0xdebc('0x12')]);}})[_0xdebc('0x14')](function(_0x388c7b){logger[_0xdebc('0x10')](_0xdebc('0xc'),_0x54956e,_0x388c7b);_0x5a862b(_0x388c7b);});});}exports['CreateSquareRecording']=function(_0x4d8635){var _0x431b09=this;return new Promise(function(_0x57405c,_0x3e9526){return db[_0xdebc('0x15')][_0xdebc('0x16')](_0x4d8635['body'],{'raw':_0x4d8635[_0xdebc('0x17')]?_0x4d8635[_0xdebc('0x17')][_0xdebc('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x13c349){logger['info'](_0xdebc('0x19'),_0x4d8635);logger['debug']('CreateSquareRecording',_0x4d8635,JSON[_0xdebc('0xf')](_0x13c349));_0x57405c(_0x13c349);})[_0xdebc('0x14')](function(_0x3d2f9a){logger[_0xdebc('0x10')]('CreateSquareRecording',_0x3d2f9a[_0xdebc('0x12')],_0x4d8635);_0x3e9526(_0x431b09[_0xdebc('0x10')](0x1f4,_0x3d2f9a[_0xdebc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 2fbc529..1493d18 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0xed5729,_0x4979b1){var _0x4607e4=function(_0x2d77e2){while(--_0x2d77e2){_0xed5729['push'](_0xed5729['shift']());}};_0x4607e4(++_0x4979b1);}(_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 +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x2df94b,_0x2ec2ad){var _0xecf896=function(_0x4f6708){while(--_0x4f6708){_0x2df94b['push'](_0x2df94b['shift']());}};_0xecf896(++_0x2ec2ad);}(_0xb10b,0x12a));var _0xbb10=function(_0x18fb4c,_0x578f22){_0x18fb4c=_0x18fb4c-0x0;var _0x4a75b3=_0xb10b[_0x18fb4c];return _0x4a75b3;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4e8f7f6..24806af 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 _0xf306=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x535591,_0x50a974){var _0xb45690=function(_0x30ec11){while(--_0x30ec11){_0x535591['push'](_0x535591['shift']());}};_0xb45690(++_0x50a974);}(_0xf306,0xb6));var _0x6f30=function(_0x5f23eb,_0x437347){_0x5f23eb=_0x5f23eb-0x0;var _0x6a7886=_0xf306[_0x5f23eb];return _0x6a7886;};'use strict';var Sequelize=require(_0x6f30('0x0'));module[_0x6f30('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x6f30('0x2')]},'request':{'type':Sequelize[_0x6f30('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6f30('0x2')]},'type':{'type':Sequelize[_0x6f30('0x2')]},'uniqueid':{'type':Sequelize[_0x6f30('0x2')]},'version':{'type':Sequelize[_0x6f30('0x2')]},'callerid':{'type':Sequelize[_0x6f30('0x2')]},'calleridname':{'type':Sequelize[_0x6f30('0x2')]},'callingpres':{'type':Sequelize[_0x6f30('0x2')]},'callingani2':{'type':Sequelize[_0x6f30('0x2')]},'callington':{'type':Sequelize[_0x6f30('0x2')]},'callingtns':{'type':Sequelize[_0x6f30('0x2')]},'dnid':{'type':Sequelize[_0x6f30('0x2')]},'rdnis':{'type':Sequelize[_0x6f30('0x2')]},'context':{'type':Sequelize[_0x6f30('0x2')]},'extension':{'type':Sequelize[_0x6f30('0x2')]},'priority':{'type':Sequelize[_0x6f30('0x2')]},'enhanced':{'type':Sequelize[_0x6f30('0x2')]},'accountcode':{'type':Sequelize[_0x6f30('0x2')]},'threadid':{'type':Sequelize[_0x6f30('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6f30('0x3')]},'leaveAt':{'type':Sequelize[_0x6f30('0x3')]},'bot':{'type':Sequelize[_0x6f30('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc0fd=['DATE','sequelize','STRING'];(function(_0x13ef5c,_0x5a920c){var _0x7fab14=function(_0x17cc5a){while(--_0x17cc5a){_0x13ef5c['push'](_0x13ef5c['shift']());}};_0x7fab14(++_0x5a920c);}(_0xc0fd,0x1c6));var _0xdc0f=function(_0x181d19,_0x46822d){_0x181d19=_0x181d19-0x0;var _0x227c31=_0xc0fd[_0x181d19];return _0x227c31;};'use strict';var Sequelize=require(_0xdc0f('0x0'));module['exports']={'network':{'type':Sequelize[_0xdc0f('0x1')]},'network_script':{'type':Sequelize[_0xdc0f('0x1')]},'request':{'type':Sequelize[_0xdc0f('0x1')]},'channel':{'type':Sequelize[_0xdc0f('0x1')]},'language':{'type':Sequelize[_0xdc0f('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xdc0f('0x1')]},'version':{'type':Sequelize[_0xdc0f('0x1')]},'callerid':{'type':Sequelize[_0xdc0f('0x1')]},'calleridname':{'type':Sequelize[_0xdc0f('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xdc0f('0x1')]},'callington':{'type':Sequelize[_0xdc0f('0x1')]},'callingtns':{'type':Sequelize[_0xdc0f('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0xdc0f('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xdc0f('0x1')]},'priority':{'type':Sequelize[_0xdc0f('0x1')]},'enhanced':{'type':Sequelize[_0xdc0f('0x1')]},'accountcode':{'type':Sequelize[_0xdc0f('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xdc0f('0x1')]},'joinAt':{'type':Sequelize[_0xdc0f('0x2')]},'leaveAt':{'type':Sequelize[_0xdc0f('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 664e138..19dd571 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 _0xe17d=['status','json','offset','undefined','limit','count','Content-Range','save','update','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','where','merge','VIRTUAL','options','SquareReport','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x4ed8ba,_0x372ece){var _0x17d54a=function(_0x1fe75e){while(--_0x1fe75e){_0x4ed8ba['push'](_0x4ed8ba['shift']());}};_0x17d54a(++_0x372ece);}(_0xe17d,0xfa));var _0xde17=function(_0x427ae4,_0x12ab05){_0x427ae4=_0x427ae4-0x0;var _0x1ea1ed=_0xe17d[_0x427ae4];return _0x1ea1ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xde17('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xde17('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xde17('0x2'));var util=require('util');var path=require(_0xde17('0x3'));var sox=require(_0xde17('0x4'));var csv=require(_0xde17('0x5'));var ejs=require(_0xde17('0x6'));var fs=require('fs');var fs_extra=require(_0xde17('0x7'));var _=require(_0xde17('0x8'));var squel=require(_0xde17('0x9'));var crypto=require(_0xde17('0xa'));var jsforce=require(_0xde17('0xb'));var deskjs=require(_0xde17('0xc'));var toCsv=require(_0xde17('0x5'));var querystring=require('querystring');var Papa=require(_0xde17('0xd'));var Redis=require('ioredis');var authService=require(_0xde17('0xe'));var qs=require(_0xde17('0xf'));var as=require(_0xde17('0x10'));var hardwareService=require(_0xde17('0x11'));var logger=require(_0xde17('0x12'))(_0xde17('0x13'));var utils=require(_0xde17('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xde17('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4550b0,_0xa0e855){_0xa0e855=_0xa0e855||0xcc;return function(_0x50d41f){if(_0x50d41f){return _0x4550b0['sendStatus'](_0xa0e855);}return _0x4550b0[_0xde17('0x16')](_0xa0e855)['end']();};}function respondWithResult(_0x504289,_0x3d6677){_0x3d6677=_0x3d6677||0xc8;return function(_0x14548e){if(_0x14548e){return _0x504289[_0xde17('0x16')](_0x3d6677)[_0xde17('0x17')](_0x14548e);}};}function respondWithFilteredResult(_0x1bb4e8,_0x403a14){return function(_0x5bb4f3){if(_0x5bb4f3){var _0x2b6f7d=typeof _0x403a14[_0xde17('0x18')]===_0xde17('0x19')&&typeof _0x403a14[_0xde17('0x1a')]===_0xde17('0x19');var _0x8e4b49=_0x5bb4f3[_0xde17('0x1b')];var _0x47fd9d=_0x2b6f7d?0x0:_0x403a14[_0xde17('0x18')];var _0x5d5646=_0x2b6f7d?_0x5bb4f3[_0xde17('0x1b')]:_0x403a14['offset']+_0x403a14['limit'];var _0x5b1b17;if(_0x5d5646>=_0x8e4b49){_0x5d5646=_0x8e4b49;_0x5b1b17=0xc8;}else{_0x5b1b17=0xce;}_0x1bb4e8[_0xde17('0x16')](_0x5b1b17);return _0x1bb4e8['set'](_0xde17('0x1c'),_0x47fd9d+'-'+_0x5d5646+'/'+_0x8e4b49)[_0xde17('0x17')](_0x5bb4f3);}return null;};}function patchUpdates(_0x4f61ba){return function(_0x194570){try{jsonpatch['apply'](_0x194570,_0x4f61ba,!![]);}catch(_0x516c02){return BPromise['reject'](_0x516c02);}return _0x194570[_0xde17('0x1d')]();};}function saveUpdates(_0x19c4c4,_0x2c4b5f){return function(_0x4270e2){if(_0x4270e2){return _0x4270e2[_0xde17('0x1e')](_0x19c4c4)[_0xde17('0x1f')](function(_0x387cd3){return _0x387cd3;});}return null;};}function removeEntity(_0x145612,_0x489063){return function(_0x498e47){if(_0x498e47){return _0x498e47['destroy']()['then'](function(){_0x145612[_0xde17('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2819,_0x11506d){return function(_0x4bbaf2){if(!_0x4bbaf2){_0x3f2819[_0xde17('0x20')](0x194);}return _0x4bbaf2;};}function handleError(_0x127110,_0x2f8ca2){_0x2f8ca2=_0x2f8ca2||0x1f4;return function(_0x27fd49){logger[_0xde17('0x21')](_0x27fd49[_0xde17('0x22')]);if(_0x27fd49[_0xde17('0x23')]){delete _0x27fd49[_0xde17('0x23')];}_0x127110[_0xde17('0x16')](_0x2f8ca2)['send'](_0x27fd49);};}exports[_0xde17('0x24')]=function(_0x358d27,_0xe109eb){var _0x13e366={},_0x46b4c4={},_0x3f677d={'count':0x0,'rows':[]};var _0x4149eb=_[_0xde17('0x25')](db['SquareReport'][_0xde17('0x26')],function(_0x451634){return{'name':_0x451634[_0xde17('0x27')],'type':_0x451634[_0xde17('0x28')][_0xde17('0x29')]};});_0x46b4c4[_0xde17('0x2a')]=_[_0xde17('0x25')](_0x4149eb,_0xde17('0x23'));_0x46b4c4[_0xde17('0x2b')]=_[_0xde17('0x2c')](_0x358d27[_0xde17('0x2b')]);_0x46b4c4[_0xde17('0x2d')]=_[_0xde17('0x2e')](_0x46b4c4['model'],_0x46b4c4['query']);_0x13e366[_0xde17('0x2f')]=_[_0xde17('0x2e')](_0x46b4c4[_0xde17('0x2a')],qs[_0xde17('0x30')](_0x358d27[_0xde17('0x2b')][_0xde17('0x30')]));_0x13e366['attributes']=_0x13e366[_0xde17('0x2f')]['length']?_0x13e366[_0xde17('0x2f')]:_0x46b4c4[_0xde17('0x2a')];if(!_0x358d27[_0xde17('0x2b')][_0xde17('0x31')]('nolimit')){_0x13e366[_0xde17('0x1a')]=qs[_0xde17('0x1a')](_0x358d27[_0xde17('0x2b')][_0xde17('0x1a')]);_0x13e366[_0xde17('0x18')]=qs['offset'](_0x358d27[_0xde17('0x2b')][_0xde17('0x18')]);}_0x13e366['order']=qs[_0xde17('0x32')](_0x358d27[_0xde17('0x2b')][_0xde17('0x32')]);_0x13e366['where']=qs[_0xde17('0x2d')](_[_0xde17('0x33')](_0x358d27['query'],_0x46b4c4[_0xde17('0x2d')]),_0x4149eb);if(_0x358d27[_0xde17('0x2b')]['filter']){_0x13e366[_0xde17('0x34')]=_[_0xde17('0x35')](_0x13e366[_0xde17('0x34')],{'$or':_[_0xde17('0x25')](_0x4149eb,function(_0x17a8ed){if(_0x17a8ed[_0xde17('0x28')]!==_0xde17('0x36')){var _0x34e7fa={};_0x34e7fa[_0x17a8ed[_0xde17('0x23')]]={'$like':'%'+_0x358d27[_0xde17('0x2b')]['filter']+'%'};return _0x34e7fa;}})});}_0x13e366=_['merge']({},_0x13e366,_0x358d27[_0xde17('0x37')]);var _0x2ca08b={'where':_0x13e366[_0xde17('0x34')]};return db[_0xde17('0x38')][_0xde17('0x1b')](_0x2ca08b)['then'](function(_0x463ff6){_0x3f677d[_0xde17('0x1b')]=_0x463ff6;if(_0x358d27[_0xde17('0x2b')][_0xde17('0x39')]){_0x13e366[_0xde17('0x3a')]=[{'all':!![]}];}return db[_0xde17('0x38')]['findAll'](_0x13e366);})['then'](function(_0x2c5cfe){_0x3f677d[_0xde17('0x3b')]=_0x2c5cfe;return _0x3f677d;})['then'](respondWithFilteredResult(_0xe109eb,_0x13e366))[_0xde17('0x3c')](handleError(_0xe109eb,null));};exports[_0xde17('0x3d')]=function(_0x277f44,_0x30f421){var _0x1983e8={'raw':!![],'where':{'id':_0x277f44[_0xde17('0x3e')]['id']}},_0x2698a9={};_0x2698a9['model']=_[_0xde17('0x2c')](db['SquareReport'][_0xde17('0x26')]);_0x2698a9[_0xde17('0x2b')]=_[_0xde17('0x2c')](_0x277f44[_0xde17('0x2b')]);_0x2698a9['filters']=_['intersection'](_0x2698a9[_0xde17('0x2a')],_0x2698a9[_0xde17('0x2b')]);_0x1983e8[_0xde17('0x2f')]=_['intersection'](_0x2698a9[_0xde17('0x2a')],qs[_0xde17('0x30')](_0x277f44[_0xde17('0x2b')]['fields']));_0x1983e8['attributes']=_0x1983e8[_0xde17('0x2f')]['length']?_0x1983e8[_0xde17('0x2f')]:_0x2698a9[_0xde17('0x2a')];if(_0x277f44[_0xde17('0x2b')]['includeAll']){_0x1983e8[_0xde17('0x3a')]=[{'all':!![]}];}_0x1983e8=_[_0xde17('0x35')]({},_0x1983e8,_0x277f44[_0xde17('0x37')]);return db[_0xde17('0x38')][_0xde17('0x3f')](_0x1983e8)[_0xde17('0x1f')](handleEntityNotFound(_0x30f421,null))['then'](respondWithResult(_0x30f421,null))[_0xde17('0x3c')](handleError(_0x30f421,null));};exports['create']=function(_0x12117c,_0x18a8e7){return db['SquareReport'][_0xde17('0x40')](_0x12117c[_0xde17('0x41')],{})[_0xde17('0x1f')](respondWithResult(_0x18a8e7,0xc9))[_0xde17('0x3c')](handleError(_0x18a8e7,null));};exports[_0xde17('0x1e')]=function(_0x5d580f,_0x4345bb){if(_0x5d580f[_0xde17('0x41')]['id']){delete _0x5d580f[_0xde17('0x41')]['id'];}return db[_0xde17('0x38')][_0xde17('0x3f')]({'where':{'id':_0x5d580f[_0xde17('0x3e')]['id']}})[_0xde17('0x1f')](handleEntityNotFound(_0x4345bb,null))[_0xde17('0x1f')](saveUpdates(_0x5d580f[_0xde17('0x41')],null))[_0xde17('0x1f')](respondWithResult(_0x4345bb,null))[_0xde17('0x3c')](handleError(_0x4345bb,null));};exports[_0xde17('0x42')]=function(_0x381d9d,_0x2d586c){return db[_0xde17('0x38')][_0xde17('0x3f')]({'where':{'id':_0x381d9d[_0xde17('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2d586c,null))[_0xde17('0x1f')](removeEntity(_0x2d586c,null))['catch'](handleError(_0x2d586c,null));};exports[_0xde17('0x43')]=function(_0x53e0a9,_0x26f272){return db['SquareReport']['describe']()[_0xde17('0x1f')](respondWithResult(_0x26f272,null))[_0xde17('0x3c')](handleError(_0x26f272,null));}; \ No newline at end of file +var _0x7f26=['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','limit','count','set','apply','save','then','destroy','error','name','index','SquareReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','include','rows','catch','show','fields','merge','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x4f0464,_0x26f314){var _0xc4fd1=function(_0xe6c3e1){while(--_0xe6c3e1){_0x4f0464['push'](_0x4f0464['shift']());}};_0xc4fd1(++_0x26f314);}(_0x7f26,0x86));var _0x67f2=function(_0xbb35b2,_0x327e3d){_0xbb35b2=_0xbb35b2-0x0;var _0x4c1b79=_0x7f26[_0xbb35b2];return _0x4c1b79;};'use strict';var emlformat=require(_0x67f2('0x0'));var rimraf=require(_0x67f2('0x1'));var zipdir=require(_0x67f2('0x2'));var jsonpatch=require(_0x67f2('0x3'));var rp=require(_0x67f2('0x4'));var moment=require(_0x67f2('0x5'));var BPromise=require(_0x67f2('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x67f2('0x7'));var sox=require(_0x67f2('0x8'));var csv=require(_0x67f2('0x9'));var ejs=require(_0x67f2('0xa'));var fs=require('fs');var fs_extra=require(_0x67f2('0xb'));var _=require(_0x67f2('0xc'));var squel=require(_0x67f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x67f2('0xe'));var deskjs=require(_0x67f2('0xf'));var toCsv=require(_0x67f2('0x9'));var querystring=require(_0x67f2('0x10'));var Papa=require('papaparse');var Redis=require(_0x67f2('0x11'));var authService=require(_0x67f2('0x12'));var qs=require(_0x67f2('0x13'));var as=require(_0x67f2('0x14'));var hardwareService=require(_0x67f2('0x15'));var logger=require(_0x67f2('0x16'))(_0x67f2('0x17'));var utils=require(_0x67f2('0x18'));var config=require(_0x67f2('0x19'));var licenseUtil=require(_0x67f2('0x1a'));var db=require(_0x67f2('0x1b'))['db'];function respondWithStatusCode(_0x39fc30,_0x2f30a4){_0x2f30a4=_0x2f30a4||0xcc;return function(_0x1ad578){if(_0x1ad578){return _0x39fc30[_0x67f2('0x1c')](_0x2f30a4);}return _0x39fc30[_0x67f2('0x1d')](_0x2f30a4)[_0x67f2('0x1e')]();};}function respondWithResult(_0x2ccd5e,_0x54622d){_0x54622d=_0x54622d||0xc8;return function(_0x1868af){if(_0x1868af){return _0x2ccd5e[_0x67f2('0x1d')](_0x54622d)[_0x67f2('0x1f')](_0x1868af);}};}function respondWithFilteredResult(_0x409e81,_0x3988e4){return function(_0x331297){if(_0x331297){var _0x174c85=typeof _0x3988e4[_0x67f2('0x20')]===_0x67f2('0x21')&&typeof _0x3988e4[_0x67f2('0x22')]===_0x67f2('0x21');var _0x23e950=_0x331297['count'];var _0x29f36b=_0x174c85?0x0:_0x3988e4[_0x67f2('0x20')];var _0x24bac9=_0x174c85?_0x331297[_0x67f2('0x23')]:_0x3988e4['offset']+_0x3988e4['limit'];var _0x1a8b89;if(_0x24bac9>=_0x23e950){_0x24bac9=_0x23e950;_0x1a8b89=0xc8;}else{_0x1a8b89=0xce;}_0x409e81[_0x67f2('0x1d')](_0x1a8b89);return _0x409e81[_0x67f2('0x24')]('Content-Range',_0x29f36b+'-'+_0x24bac9+'/'+_0x23e950)[_0x67f2('0x1f')](_0x331297);}return null;};}function patchUpdates(_0x1b8dd6){return function(_0x1b6d32){try{jsonpatch[_0x67f2('0x25')](_0x1b6d32,_0x1b8dd6,!![]);}catch(_0x34c3c7){return BPromise['reject'](_0x34c3c7);}return _0x1b6d32[_0x67f2('0x26')]();};}function saveUpdates(_0x76643b,_0x2adffe){return function(_0x585c94){if(_0x585c94){return _0x585c94['update'](_0x76643b)[_0x67f2('0x27')](function(_0x175045){return _0x175045;});}return null;};}function removeEntity(_0x328bec,_0x30667c){return function(_0x1badfa){if(_0x1badfa){return _0x1badfa[_0x67f2('0x28')]()[_0x67f2('0x27')](function(){_0x328bec[_0x67f2('0x1d')](0xcc)[_0x67f2('0x1e')]();});}};}function handleEntityNotFound(_0x46c0c9,_0x10f183){return function(_0x5ab0fd){if(!_0x5ab0fd){_0x46c0c9[_0x67f2('0x1c')](0x194);}return _0x5ab0fd;};}function handleError(_0x4f5cf,_0x1488a3){_0x1488a3=_0x1488a3||0x1f4;return function(_0xce18dd){logger[_0x67f2('0x29')](_0xce18dd['stack']);if(_0xce18dd['name']){delete _0xce18dd[_0x67f2('0x2a')];}_0x4f5cf[_0x67f2('0x1d')](_0x1488a3)['send'](_0xce18dd);};}exports[_0x67f2('0x2b')]=function(_0x43ae6f,_0x3f7d05){var _0xcde194={},_0x41ce47={},_0x42900e={'count':0x0,'rows':[]};var _0x366981=_['map'](db[_0x67f2('0x2c')][_0x67f2('0x2d')],function(_0x467048){return{'name':_0x467048['fieldName'],'type':_0x467048[_0x67f2('0x2e')][_0x67f2('0x2f')]};});_0x41ce47[_0x67f2('0x30')]=_[_0x67f2('0x31')](_0x366981,_0x67f2('0x2a'));_0x41ce47[_0x67f2('0x32')]=_[_0x67f2('0x33')](_0x43ae6f[_0x67f2('0x32')]);_0x41ce47[_0x67f2('0x34')]=_[_0x67f2('0x35')](_0x41ce47[_0x67f2('0x30')],_0x41ce47['query']);_0xcde194[_0x67f2('0x36')]=_[_0x67f2('0x35')](_0x41ce47[_0x67f2('0x30')],qs['fields'](_0x43ae6f[_0x67f2('0x32')]['fields']));_0xcde194[_0x67f2('0x36')]=_0xcde194['attributes'][_0x67f2('0x37')]?_0xcde194[_0x67f2('0x36')]:_0x41ce47[_0x67f2('0x30')];if(!_0x43ae6f[_0x67f2('0x32')][_0x67f2('0x38')](_0x67f2('0x39'))){_0xcde194[_0x67f2('0x22')]=qs[_0x67f2('0x22')](_0x43ae6f[_0x67f2('0x32')][_0x67f2('0x22')]);_0xcde194[_0x67f2('0x20')]=qs[_0x67f2('0x20')](_0x43ae6f[_0x67f2('0x32')]['offset']);}_0xcde194['order']=qs[_0x67f2('0x3a')](_0x43ae6f[_0x67f2('0x32')][_0x67f2('0x3a')]);_0xcde194[_0x67f2('0x3b')]=qs[_0x67f2('0x34')](_[_0x67f2('0x3c')](_0x43ae6f[_0x67f2('0x32')],_0x41ce47[_0x67f2('0x34')]),_0x366981);if(_0x43ae6f[_0x67f2('0x32')]['filter']){_0xcde194[_0x67f2('0x3b')]=_['merge'](_0xcde194[_0x67f2('0x3b')],{'$or':_['map'](_0x366981,function(_0x4fe8e9){if(_0x4fe8e9[_0x67f2('0x2e')]!=='VIRTUAL'){var _0x3d1641={};_0x3d1641[_0x4fe8e9[_0x67f2('0x2a')]]={'$like':'%'+_0x43ae6f[_0x67f2('0x32')][_0x67f2('0x3d')]+'%'};return _0x3d1641;}})});}_0xcde194=_['merge']({},_0xcde194,_0x43ae6f[_0x67f2('0x3e')]);var _0x4d323a={'where':_0xcde194[_0x67f2('0x3b')]};return db[_0x67f2('0x2c')][_0x67f2('0x23')](_0x4d323a)[_0x67f2('0x27')](function(_0x2eec47){_0x42900e['count']=_0x2eec47;if(_0x43ae6f[_0x67f2('0x32')]['includeAll']){_0xcde194[_0x67f2('0x3f')]=[{'all':!![]}];}return db['SquareReport']['findAll'](_0xcde194);})[_0x67f2('0x27')](function(_0x57836a){_0x42900e[_0x67f2('0x40')]=_0x57836a;return _0x42900e;})['then'](respondWithFilteredResult(_0x3f7d05,_0xcde194))[_0x67f2('0x41')](handleError(_0x3f7d05,null));};exports[_0x67f2('0x42')]=function(_0x1533d8,_0x1dad48){var _0x50b88a={'raw':!![],'where':{'id':_0x1533d8['params']['id']}},_0x2a5894={};_0x2a5894['model']=_['keys'](db[_0x67f2('0x2c')][_0x67f2('0x2d')]);_0x2a5894[_0x67f2('0x32')]=_['keys'](_0x1533d8[_0x67f2('0x32')]);_0x2a5894[_0x67f2('0x34')]=_[_0x67f2('0x35')](_0x2a5894[_0x67f2('0x30')],_0x2a5894[_0x67f2('0x32')]);_0x50b88a[_0x67f2('0x36')]=_[_0x67f2('0x35')](_0x2a5894['model'],qs[_0x67f2('0x43')](_0x1533d8[_0x67f2('0x32')][_0x67f2('0x43')]));_0x50b88a['attributes']=_0x50b88a[_0x67f2('0x36')][_0x67f2('0x37')]?_0x50b88a['attributes']:_0x2a5894[_0x67f2('0x30')];if(_0x1533d8[_0x67f2('0x32')]['includeAll']){_0x50b88a[_0x67f2('0x3f')]=[{'all':!![]}];}_0x50b88a=_[_0x67f2('0x44')]({},_0x50b88a,_0x1533d8[_0x67f2('0x3e')]);return db['SquareReport'][_0x67f2('0x45')](_0x50b88a)['then'](handleEntityNotFound(_0x1dad48,null))[_0x67f2('0x27')](respondWithResult(_0x1dad48,null))[_0x67f2('0x41')](handleError(_0x1dad48,null));};exports['create']=function(_0xf978ac,_0x30167d){return db['SquareReport'][_0x67f2('0x46')](_0xf978ac[_0x67f2('0x47')],{})['then'](respondWithResult(_0x30167d,0xc9))[_0x67f2('0x41')](handleError(_0x30167d,null));};exports[_0x67f2('0x48')]=function(_0x57a3ab,_0x3f96be){if(_0x57a3ab[_0x67f2('0x47')]['id']){delete _0x57a3ab[_0x67f2('0x47')]['id'];}return db['SquareReport'][_0x67f2('0x45')]({'where':{'id':_0x57a3ab[_0x67f2('0x49')]['id']}})[_0x67f2('0x27')](handleEntityNotFound(_0x3f96be,null))['then'](saveUpdates(_0x57a3ab[_0x67f2('0x47')],null))[_0x67f2('0x27')](respondWithResult(_0x3f96be,null))[_0x67f2('0x41')](handleError(_0x3f96be,null));};exports[_0x67f2('0x28')]=function(_0x1035f8,_0x359404){return db['SquareReport'][_0x67f2('0x45')]({'where':{'id':_0x1035f8['params']['id']}})[_0x67f2('0x27')](handleEntityNotFound(_0x359404,null))['then'](removeEntity(_0x359404,null))[_0x67f2('0x41')](handleError(_0x359404,null));};exports[_0x67f2('0x4a')]=function(_0x1e6549,_0x20a2e7){return db[_0x67f2('0x2c')][_0x67f2('0x4a')]()[_0x67f2('0x27')](respondWithResult(_0x20a2e7,null))[_0x67f2('0x41')](handleError(_0x20a2e7,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d1d6a26..de8b0b0 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 _0xd153=['define','SquareReport','report_square','uniqueid','project_name','leaveAt','util','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd153,0x11e));var _0x3d15=function(_0x2d1f27,_0x3e57e6){_0x2d1f27=_0x2d1f27-0x0;var _0x3619d5=_0xd153[_0x2d1f27];return _0x3619d5;};'use strict';var _=require('lodash');var util=require(_0x3d15('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3d15('0x1'));var rp=require(_0x3d15('0x2'));var fs=require('fs');var path=require(_0x3d15('0x3'));var rimraf=require(_0x3d15('0x4'));var config=require(_0x3d15('0x5'));var attributes=require(_0x3d15('0x6'));module[_0x3d15('0x7')]=function(_0x154f4b,_0x182151){return _0x154f4b[_0x3d15('0x8')](_0x3d15('0x9'),attributes,{'tableName':_0x3d15('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x3d15('0xb'),_0x3d15('0xc')]},{'name':'leaveAt','fields':[_0x3d15('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4632=['./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x37cfb6,_0x225c6d){var _0x1d0a82=function(_0x5ac426){while(--_0x5ac426){_0x37cfb6['push'](_0x37cfb6['shift']());}};_0x1d0a82(++_0x225c6d);}(_0x4632,0x1b2));var _0x2463=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4632[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x2463('0x0'));var util=require(_0x2463('0x1'));var logger=require(_0x2463('0x2'))('api');var moment=require(_0x2463('0x3'));var BPromise=require(_0x2463('0x4'));var rp=require(_0x2463('0x5'));var fs=require('fs');var path=require(_0x2463('0x6'));var rimraf=require('rimraf');var config=require(_0x2463('0x7'));var attributes=require(_0x2463('0x8'));module[_0x2463('0x9')]=function(_0x480c26,_0x25fe4d){return _0x480c26[_0x2463('0xa')](_0x2463('0xb'),attributes,{'tableName':_0x2463('0xc'),'paranoid':![],'indexes':[{'name':_0x2463('0xd'),'fields':[_0x2463('0xe'),_0x2463('0xf')]},{'name':_0x2463('0x10'),'fields':[_0x2463('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8f2d897..fa8c702 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 _0xca7a=['SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','stringify','UpdateSquareReport','update','body','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x3ccb42,_0x121568){var _0x1d4a40=function(_0x2cd792){while(--_0x2cd792){_0x3ccb42['push'](_0x3ccb42['shift']());}};_0x1d4a40(++_0x121568);}(_0xca7a,0x19a));var _0xaca7=function(_0x217e5b,_0x53776f){_0x217e5b=_0x217e5b-0x0;var _0x38f156=_0xca7a[_0x217e5b];return _0x38f156;};'use strict';var _=require('lodash');var util=require(_0xaca7('0x0'));var moment=require(_0xaca7('0x1'));var BPromise=require(_0xaca7('0x2'));var rs=require(_0xaca7('0x3'));var fs=require('fs');var Redis=require(_0xaca7('0x4'));var db=require(_0xaca7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaca7('0x6'));var config=require(_0xaca7('0x7'));var jayson=require(_0xaca7('0x8'));var client=jayson[_0xaca7('0x9')][_0xaca7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455dbd,_0x16a7f6,_0x200348){return new BPromise(function(_0x317070,_0x45599b){return client[_0xaca7('0xb')](_0x455dbd,_0x200348)[_0xaca7('0xc')](function(_0x79e738){logger[_0xaca7('0xd')]('SquareReport,\x20%s,\x20%s',_0x16a7f6,'request\x20sent');logger[_0xaca7('0xe')](_0xaca7('0xf'),_0x16a7f6,_0xaca7('0x10'),JSON['stringify'](_0x79e738));if(_0x79e738[_0xaca7('0x11')]){if(_0x79e738['error'][_0xaca7('0x12')]===0x1f4){logger[_0xaca7('0x11')](_0xaca7('0x13'),_0x16a7f6,_0x79e738[_0xaca7('0x11')][_0xaca7('0x14')]);return _0x45599b(_0x79e738[_0xaca7('0x11')][_0xaca7('0x14')]);}logger[_0xaca7('0x11')](_0xaca7('0x13'),_0x16a7f6,_0x79e738['error'][_0xaca7('0x14')]);return _0x317070(_0x79e738[_0xaca7('0x11')]['message']);}else{logger[_0xaca7('0xd')]('SquareReport,\x20%s,\x20%s',_0x16a7f6,_0xaca7('0x10'));_0x317070(_0x79e738[_0xaca7('0x15')][_0xaca7('0x14')]);}})[_0xaca7('0x16')](function(_0x353b4a){logger[_0xaca7('0x11')](_0xaca7('0x13'),_0x16a7f6,_0x353b4a);_0x45599b(_0x353b4a);});});}exports[_0xaca7('0x17')]=function(_0x34b253){var _0x330e55=this;return new Promise(function(_0x5a9e9d,_0xa05951){return db[_0xaca7('0x18')][_0xaca7('0x19')](_0x34b253['body'],{'raw':_0x34b253['options']?_0x34b253[_0xaca7('0x1a')][_0xaca7('0x1b')]===undefined?!![]:![]:!![]})[_0xaca7('0xc')](function(_0x28c192){logger[_0xaca7('0xd')](_0xaca7('0x17'),_0x34b253);logger['debug'](_0xaca7('0x17'),_0x34b253,JSON[_0xaca7('0x1c')](_0x28c192));_0x5a9e9d(_0x28c192);})['catch'](function(_0x550f24){logger[_0xaca7('0x11')](_0xaca7('0x17'),_0x550f24[_0xaca7('0x14')],_0x34b253);_0xa05951(_0x330e55[_0xaca7('0x11')](0x1f4,_0x550f24[_0xaca7('0x14')]));});});};exports[_0xaca7('0x1d')]=function(_0x45265e){var _0x1a0877=this;return new Promise(function(_0x91936c,_0x4a6a54){return db[_0xaca7('0x18')][_0xaca7('0x1e')](_0x45265e[_0xaca7('0x1f')],{'raw':_0x45265e[_0xaca7('0x1a')]?_0x45265e[_0xaca7('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45265e['options']?_0x45265e['options'][_0xaca7('0x20')]||null:null,'attributes':_0x45265e[_0xaca7('0x1a')]?_0x45265e[_0xaca7('0x1a')]['attributes']||null:null,'limit':_0x45265e[_0xaca7('0x1a')]?_0x45265e[_0xaca7('0x1a')]['limit']||null:null})[_0xaca7('0xc')](function(_0x16a461){logger['info'](_0xaca7('0x1d'),_0x45265e);logger[_0xaca7('0xe')](_0xaca7('0x1d'),_0x45265e,JSON[_0xaca7('0x1c')](_0x16a461));_0x91936c(_0x16a461);})['catch'](function(_0x476a05){logger[_0xaca7('0x11')](_0xaca7('0x1d'),_0x476a05[_0xaca7('0x14')],_0x45265e);_0x4a6a54(_0x1a0877[_0xaca7('0x11')](0x1f4,_0x476a05[_0xaca7('0x14')]));});});}; \ No newline at end of file +var _0x66c9=['CreateSquareReport','SquareReport','options','raw','debug','update','body','where','attributes','UpdateSquareReport','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x66c9,0x154));var _0x966c=function(_0x5b9e0f,_0x19ffa6){_0x5b9e0f=_0x5b9e0f-0x0;var _0x3352f1=_0x66c9[_0x5b9e0f];return _0x3352f1;};'use strict';var _=require(_0x966c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x966c('0x1'));var rs=require(_0x966c('0x2'));var fs=require('fs');var Redis=require(_0x966c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x966c('0x4'));var logger=require('../../config/logger')(_0x966c('0x5'));var config=require(_0x966c('0x6'));var jayson=require(_0x966c('0x7'));var client=jayson[_0x966c('0x8')][_0x966c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b59e7,_0x1bed47,_0x23c845){return new BPromise(function(_0x1d5b42,_0x5c03a4){return client['request'](_0x2b59e7,_0x23c845)[_0x966c('0xa')](function(_0x5d65a9){logger[_0x966c('0xb')](_0x966c('0xc'),_0x1bed47,'request\x20sent');logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x1bed47,_0x966c('0xd'),JSON[_0x966c('0xe')](_0x5d65a9));if(_0x5d65a9[_0x966c('0xf')]){if(_0x5d65a9[_0x966c('0xf')][_0x966c('0x10')]===0x1f4){logger[_0x966c('0xf')]('SquareReport,\x20%s,\x20%s',_0x1bed47,_0x5d65a9['error']['message']);return _0x5c03a4(_0x5d65a9[_0x966c('0xf')][_0x966c('0x11')]);}logger[_0x966c('0xf')]('SquareReport,\x20%s,\x20%s',_0x1bed47,_0x5d65a9[_0x966c('0xf')]['message']);return _0x1d5b42(_0x5d65a9[_0x966c('0xf')][_0x966c('0x11')]);}else{logger[_0x966c('0xb')]('SquareReport,\x20%s,\x20%s',_0x1bed47,_0x966c('0xd'));_0x1d5b42(_0x5d65a9[_0x966c('0x12')]['message']);}})[_0x966c('0x13')](function(_0x3b8a4c){logger['error'](_0x966c('0xc'),_0x1bed47,_0x3b8a4c);_0x5c03a4(_0x3b8a4c);});});}exports[_0x966c('0x14')]=function(_0x1a323c){var _0x5d29dc=this;return new Promise(function(_0x3385db,_0x57f108){return db[_0x966c('0x15')]['create'](_0x1a323c['body'],{'raw':_0x1a323c[_0x966c('0x16')]?_0x1a323c['options'][_0x966c('0x17')]===undefined?!![]:![]:!![]})[_0x966c('0xa')](function(_0x4590ce){logger[_0x966c('0xb')](_0x966c('0x14'),_0x1a323c);logger[_0x966c('0x18')](_0x966c('0x14'),_0x1a323c,JSON[_0x966c('0xe')](_0x4590ce));_0x3385db(_0x4590ce);})[_0x966c('0x13')](function(_0x4d897b){logger[_0x966c('0xf')](_0x966c('0x14'),_0x4d897b[_0x966c('0x11')],_0x1a323c);_0x57f108(_0x5d29dc['error'](0x1f4,_0x4d897b[_0x966c('0x11')]));});});};exports['UpdateSquareReport']=function(_0x184ac3){var _0x39cdb1=this;return new Promise(function(_0x3aeb27,_0x1d1052){return db[_0x966c('0x15')][_0x966c('0x19')](_0x184ac3[_0x966c('0x1a')],{'raw':_0x184ac3[_0x966c('0x16')]?_0x184ac3[_0x966c('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x184ac3[_0x966c('0x16')]?_0x184ac3[_0x966c('0x16')][_0x966c('0x1b')]||null:null,'attributes':_0x184ac3['options']?_0x184ac3[_0x966c('0x16')][_0x966c('0x1c')]||null:null,'limit':_0x184ac3[_0x966c('0x16')]?_0x184ac3[_0x966c('0x16')]['limit']||null:null})[_0x966c('0xa')](function(_0x35edc6){logger[_0x966c('0xb')](_0x966c('0x1d'),_0x184ac3);logger[_0x966c('0x18')](_0x966c('0x1d'),_0x184ac3,JSON[_0x966c('0xe')](_0x35edc6));_0x3aeb27(_0x35edc6);})['catch'](function(_0x5d65dc){logger['error'](_0x966c('0x1d'),_0x5d65dc[_0x966c('0x11')],_0x184ac3);_0x1d1052(_0x39cdb1['error'](0x1f4,_0x5d65dc[_0x966c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6ee09e6..873ef83 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 _0xba4e=['index','/describe','describe','show','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba4e,0xb2));var _0xeba4=function(_0x41c31b,_0xdda69e){_0x41c31b=_0x41c31b-0x0;var _0x356ace=_0xba4e[_0x41c31b];return _0x356ace;};'use strict';var multer=require(_0xeba4('0x0'));var util=require(_0xeba4('0x1'));var path=require(_0xeba4('0x2'));var timeout=require(_0xeba4('0x3'));var express=require('express');var router=express[_0xeba4('0x4')]();var fs_extra=require(_0xeba4('0x5'));var auth=require(_0xeba4('0x6'));var interaction=require(_0xeba4('0x7'));var config=require('../../config/environment');var controller=require(_0xeba4('0x8'));router[_0xeba4('0x9')]('/',auth[_0xeba4('0xa')](),controller[_0xeba4('0xb')]);router[_0xeba4('0x9')](_0xeba4('0xc'),auth[_0xeba4('0xa')](),controller[_0xeba4('0xd')]);router[_0xeba4('0x9')]('/:id',auth[_0xeba4('0xa')](),controller[_0xeba4('0xe')]);router[_0xeba4('0xf')]('/',auth[_0xeba4('0xa')](),controller['create']);router[_0xeba4('0x10')](_0xeba4('0x11'),auth[_0xeba4('0xa')](),controller[_0xeba4('0x12')]);router[_0xeba4('0x13')](_0xeba4('0x11'),auth['isAuthenticated'](),controller[_0xeba4('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5d53=['put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','/describe','show','post'];(function(_0x2c8c8e,_0xe47e23){var _0x3456fe=function(_0x59df5e){while(--_0x59df5e){_0x2c8c8e['push'](_0x2c8c8e['shift']());}};_0x3456fe(++_0xe47e23);}(_0x5d53,0x6a));var _0x35d5=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x5d53[_0x10d670];return _0x20d6f8;};'use strict';var multer=require(_0x35d5('0x0'));var util=require(_0x35d5('0x1'));var path=require(_0x35d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x35d5('0x3'));var router=express[_0x35d5('0x4')]();var fs_extra=require(_0x35d5('0x5'));var auth=require(_0x35d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35d5('0x7'));var controller=require(_0x35d5('0x8'));router[_0x35d5('0x9')]('/',auth[_0x35d5('0xa')](),controller['index']);router[_0x35d5('0x9')](_0x35d5('0xb'),auth[_0x35d5('0xa')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x35d5('0xc')]);router[_0x35d5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x35d5('0xe')]('/:id',auth[_0x35d5('0xa')](),controller[_0x35d5('0xf')]);router[_0x35d5('0x10')](_0x35d5('0x11'),auth[_0x35d5('0xa')](),controller[_0x35d5('0x12')]);module[_0x35d5('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 6bc924b..6db9183 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 _0xc1aa=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc1aa,0xe9));var _0xac1a=function(_0x5942f8,_0x4790de){_0x5942f8=_0x5942f8-0x0;var _0x3b3d19=_0xc1aa[_0x5942f8];return _0x3b3d19;};'use strict';var Sequelize=require(_0xac1a('0x0'));module[_0xac1a('0x1')]={'uniqueid':{'type':Sequelize[_0xac1a('0x2')]},'node':{'type':Sequelize[_0xac1a('0x2')]},'application':{'type':Sequelize[_0xac1a('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xac1a('0x2')]},'callerid':{'type':Sequelize[_0xac1a('0x2')]}}; \ No newline at end of file +var _0x3c2f=['exports','STRING','TEXT','sequelize'];(function(_0x26aee4,_0x530ead){var _0x2e1048=function(_0x2e92db){while(--_0x2e92db){_0x26aee4['push'](_0x26aee4['shift']());}};_0x2e1048(++_0x530ead);}(_0x3c2f,0xf3));var _0xf3c2=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x3c2f[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0xf3c2('0x0'));module[_0xf3c2('0x1')]={'uniqueid':{'type':Sequelize[_0xf3c2('0x2')]},'node':{'type':Sequelize[_0xf3c2('0x2')]},'application':{'type':Sequelize[_0xf3c2('0x2')]},'data':{'type':Sequelize[_0xf3c2('0x3')]},'project_name':{'type':Sequelize[_0xf3c2('0x2')]},'callerid':{'type':Sequelize[_0xf3c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5272b6a..b9e6b91 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 _0x0c1c=['crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','offset','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x302e32,_0x52a79e){var _0x3c61d5=function(_0x2a6e1c){while(--_0x2a6e1c){_0x302e32['push'](_0x302e32['shift']());}};_0x3c61d5(++_0x52a79e);}(_0x0c1c,0x8e));var _0xc0c1=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x0c1c[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0xc0c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0c1('0x2'));var moment=require(_0xc0c1('0x3'));var BPromise=require(_0xc0c1('0x4'));var Mustache=require(_0xc0c1('0x5'));var util=require(_0xc0c1('0x6'));var path=require(_0xc0c1('0x7'));var sox=require(_0xc0c1('0x8'));var csv=require(_0xc0c1('0x9'));var ejs=require(_0xc0c1('0xa'));var fs=require('fs');var fs_extra=require(_0xc0c1('0xb'));var _=require(_0xc0c1('0xc'));var squel=require(_0xc0c1('0xd'));var crypto=require(_0xc0c1('0xe'));var jsforce=require(_0xc0c1('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc0c1('0x9'));var querystring=require(_0xc0c1('0x10'));var Papa=require(_0xc0c1('0x11'));var Redis=require('ioredis');var authService=require(_0xc0c1('0x12'));var qs=require(_0xc0c1('0x13'));var as=require(_0xc0c1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc0c1('0x15'))(_0xc0c1('0x16'));var utils=require(_0xc0c1('0x17'));var config=require(_0xc0c1('0x18'));var licenseUtil=require(_0xc0c1('0x19'));var db=require(_0xc0c1('0x1a'))['db'];function respondWithStatusCode(_0x1f8517,_0x5906de){_0x5906de=_0x5906de||0xcc;return function(_0x28c831){if(_0x28c831){return _0x1f8517[_0xc0c1('0x1b')](_0x5906de);}return _0x1f8517[_0xc0c1('0x1c')](_0x5906de)[_0xc0c1('0x1d')]();};}function respondWithResult(_0x2251db,_0xe2fa11){_0xe2fa11=_0xe2fa11||0xc8;return function(_0x534d58){if(_0x534d58){return _0x2251db[_0xc0c1('0x1c')](_0xe2fa11)[_0xc0c1('0x1e')](_0x534d58);}};}function respondWithFilteredResult(_0x4f301e,_0x16ed6a){return function(_0x34e06d){if(_0x34e06d){var _0x3185c5=typeof _0x16ed6a['offset']==='undefined'&&typeof _0x16ed6a[_0xc0c1('0x1f')]===_0xc0c1('0x20');var _0x1f04ca=_0x34e06d[_0xc0c1('0x21')];var _0x55dbe0=_0x3185c5?0x0:_0x16ed6a['offset'];var _0x43efdb=_0x3185c5?_0x34e06d[_0xc0c1('0x21')]:_0x16ed6a['offset']+_0x16ed6a['limit'];var _0x114a19;if(_0x43efdb>=_0x1f04ca){_0x43efdb=_0x1f04ca;_0x114a19=0xc8;}else{_0x114a19=0xce;}_0x4f301e['status'](_0x114a19);return _0x4f301e[_0xc0c1('0x22')]('Content-Range',_0x55dbe0+'-'+_0x43efdb+'/'+_0x1f04ca)[_0xc0c1('0x1e')](_0x34e06d);}return null;};}function patchUpdates(_0x413a1c){return function(_0x24a366){try{jsonpatch[_0xc0c1('0x23')](_0x24a366,_0x413a1c,!![]);}catch(_0x1064e2){return BPromise[_0xc0c1('0x24')](_0x1064e2);}return _0x24a366[_0xc0c1('0x25')]();};}function saveUpdates(_0xd3df96,_0x2d7b5e){return function(_0xc7720f){if(_0xc7720f){return _0xc7720f[_0xc0c1('0x26')](_0xd3df96)[_0xc0c1('0x27')](function(_0x17f027){return _0x17f027;});}return null;};}function removeEntity(_0xe50bfb,_0xfa672e){return function(_0x4c7c1b){if(_0x4c7c1b){return _0x4c7c1b[_0xc0c1('0x28')]()[_0xc0c1('0x27')](function(){_0xe50bfb['status'](0xcc)[_0xc0c1('0x1d')]();});}};}function handleEntityNotFound(_0x516369,_0x5a7de4){return function(_0x956071){if(!_0x956071){_0x516369[_0xc0c1('0x1b')](0x194);}return _0x956071;};}function handleError(_0x4e7d6b,_0x431c8a){_0x431c8a=_0x431c8a||0x1f4;return function(_0x3fe06e){logger['error'](_0x3fe06e[_0xc0c1('0x29')]);if(_0x3fe06e['name']){delete _0x3fe06e[_0xc0c1('0x2a')];}_0x4e7d6b[_0xc0c1('0x1c')](_0x431c8a)[_0xc0c1('0x2b')](_0x3fe06e);};}exports[_0xc0c1('0x2c')]=function(_0x301b32,_0x3348e3){var _0x24962a={},_0x828828={},_0x4183b0={'count':0x0,'rows':[]};var _0x231926=_[_0xc0c1('0x2d')](db[_0xc0c1('0x2e')][_0xc0c1('0x2f')],function(_0x2bcd5a){return{'name':_0x2bcd5a[_0xc0c1('0x30')],'type':_0x2bcd5a[_0xc0c1('0x31')][_0xc0c1('0x32')]};});_0x828828[_0xc0c1('0x33')]=_['map'](_0x231926,_0xc0c1('0x2a'));_0x828828[_0xc0c1('0x34')]=_[_0xc0c1('0x35')](_0x301b32[_0xc0c1('0x34')]);_0x828828[_0xc0c1('0x36')]=_['intersection'](_0x828828[_0xc0c1('0x33')],_0x828828['query']);_0x24962a[_0xc0c1('0x37')]=_[_0xc0c1('0x38')](_0x828828[_0xc0c1('0x33')],qs['fields'](_0x301b32[_0xc0c1('0x34')][_0xc0c1('0x39')]));_0x24962a[_0xc0c1('0x37')]=_0x24962a[_0xc0c1('0x37')][_0xc0c1('0x3a')]?_0x24962a[_0xc0c1('0x37')]:_0x828828[_0xc0c1('0x33')];if(!_0x301b32['query'][_0xc0c1('0x3b')]('nolimit')){_0x24962a[_0xc0c1('0x1f')]=qs[_0xc0c1('0x1f')](_0x301b32[_0xc0c1('0x34')]['limit']);_0x24962a[_0xc0c1('0x3c')]=qs[_0xc0c1('0x3c')](_0x301b32[_0xc0c1('0x34')]['offset']);}_0x24962a['order']=qs[_0xc0c1('0x3d')](_0x301b32['query'][_0xc0c1('0x3d')]);_0x24962a[_0xc0c1('0x3e')]=qs[_0xc0c1('0x36')](_['pick'](_0x301b32['query'],_0x828828[_0xc0c1('0x36')]),_0x231926);if(_0x301b32[_0xc0c1('0x34')]['filter']){_0x24962a[_0xc0c1('0x3e')]=_[_0xc0c1('0x3f')](_0x24962a[_0xc0c1('0x3e')],{'$or':_[_0xc0c1('0x2d')](_0x231926,function(_0x124a6e){if(_0x124a6e['type']!==_0xc0c1('0x40')){var _0x47a7a6={};_0x47a7a6[_0x124a6e[_0xc0c1('0x2a')]]={'$like':'%'+_0x301b32[_0xc0c1('0x34')][_0xc0c1('0x41')]+'%'};return _0x47a7a6;}})});}_0x24962a=_[_0xc0c1('0x3f')]({},_0x24962a,_0x301b32[_0xc0c1('0x42')]);var _0xcd0660={'where':_0x24962a[_0xc0c1('0x3e')]};return db['SquareDetailsReport'][_0xc0c1('0x21')](_0xcd0660)['then'](function(_0x4668f2){_0x4183b0[_0xc0c1('0x21')]=_0x4668f2;if(_0x301b32['query'][_0xc0c1('0x43')]){_0x24962a[_0xc0c1('0x44')]=[{'all':!![]}];}return db[_0xc0c1('0x2e')][_0xc0c1('0x45')](_0x24962a);})['then'](function(_0x1e1ebe){_0x4183b0[_0xc0c1('0x46')]=_0x1e1ebe;return _0x4183b0;})[_0xc0c1('0x27')](respondWithFilteredResult(_0x3348e3,_0x24962a))[_0xc0c1('0x47')](handleError(_0x3348e3,null));};exports[_0xc0c1('0x48')]=function(_0x58cf69,_0x32032b){var _0x253ae9={'raw':!![],'where':{'id':_0x58cf69[_0xc0c1('0x49')]['id']}},_0x4099bb={};_0x4099bb[_0xc0c1('0x33')]=_[_0xc0c1('0x35')](db['SquareDetailsReport'][_0xc0c1('0x2f')]);_0x4099bb[_0xc0c1('0x34')]=_[_0xc0c1('0x35')](_0x58cf69[_0xc0c1('0x34')]);_0x4099bb['filters']=_['intersection'](_0x4099bb[_0xc0c1('0x33')],_0x4099bb[_0xc0c1('0x34')]);_0x253ae9['attributes']=_[_0xc0c1('0x38')](_0x4099bb[_0xc0c1('0x33')],qs[_0xc0c1('0x39')](_0x58cf69[_0xc0c1('0x34')]['fields']));_0x253ae9[_0xc0c1('0x37')]=_0x253ae9['attributes'][_0xc0c1('0x3a')]?_0x253ae9['attributes']:_0x4099bb[_0xc0c1('0x33')];if(_0x58cf69[_0xc0c1('0x34')][_0xc0c1('0x43')]){_0x253ae9[_0xc0c1('0x44')]=[{'all':!![]}];}_0x253ae9=_['merge']({},_0x253ae9,_0x58cf69[_0xc0c1('0x42')]);return db[_0xc0c1('0x2e')][_0xc0c1('0x4a')](_0x253ae9)[_0xc0c1('0x27')](handleEntityNotFound(_0x32032b,null))[_0xc0c1('0x27')](respondWithResult(_0x32032b,null))[_0xc0c1('0x47')](handleError(_0x32032b,null));};exports[_0xc0c1('0x4b')]=function(_0x34449a,_0x4e5f85){return db[_0xc0c1('0x2e')]['create'](_0x34449a[_0xc0c1('0x4c')],{})[_0xc0c1('0x27')](respondWithResult(_0x4e5f85,0xc9))[_0xc0c1('0x47')](handleError(_0x4e5f85,null));};exports['update']=function(_0x25fbb5,_0x25fa0d){if(_0x25fbb5['body']['id']){delete _0x25fbb5[_0xc0c1('0x4c')]['id'];}return db[_0xc0c1('0x2e')][_0xc0c1('0x4a')]({'where':{'id':_0x25fbb5['params']['id']}})[_0xc0c1('0x27')](handleEntityNotFound(_0x25fa0d,null))[_0xc0c1('0x27')](saveUpdates(_0x25fbb5[_0xc0c1('0x4c')],null))[_0xc0c1('0x27')](respondWithResult(_0x25fa0d,null))[_0xc0c1('0x47')](handleError(_0x25fa0d,null));};exports[_0xc0c1('0x28')]=function(_0x3477c5,_0x28779d){return db[_0xc0c1('0x2e')][_0xc0c1('0x4a')]({'where':{'id':_0x3477c5[_0xc0c1('0x49')]['id']}})[_0xc0c1('0x27')](handleEntityNotFound(_0x28779d,null))[_0xc0c1('0x27')](removeEntity(_0x28779d,null))['catch'](handleError(_0x28779d,null));};exports[_0xc0c1('0x4d')]=function(_0x2b911e,_0xa4354f){return db[_0xc0c1('0x2e')][_0xc0c1('0x4d')]()[_0xc0c1('0x27')](respondWithResult(_0xa4354f,null))[_0xc0c1('0x47')](handleError(_0xa4354f,null));}; \ No newline at end of file +var _0xfafd=['filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xfafd,0x140));var _0xdfaf=function(_0x52efde,_0x110e4c){_0x52efde=_0x52efde-0x0;var _0x5cb4e5=_0xfafd[_0x52efde];return _0x5cb4e5;};'use strict';var emlformat=require(_0xdfaf('0x0'));var rimraf=require(_0xdfaf('0x1'));var zipdir=require(_0xdfaf('0x2'));var jsonpatch=require(_0xdfaf('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdfaf('0x4'));var Mustache=require(_0xdfaf('0x5'));var util=require(_0xdfaf('0x6'));var path=require('path');var sox=require(_0xdfaf('0x7'));var csv=require(_0xdfaf('0x8'));var ejs=require(_0xdfaf('0x9'));var fs=require('fs');var fs_extra=require(_0xdfaf('0xa'));var _=require('lodash');var squel=require(_0xdfaf('0xb'));var crypto=require(_0xdfaf('0xc'));var jsforce=require(_0xdfaf('0xd'));var deskjs=require(_0xdfaf('0xe'));var toCsv=require(_0xdfaf('0x8'));var querystring=require('querystring');var Papa=require(_0xdfaf('0xf'));var Redis=require('ioredis');var authService=require(_0xdfaf('0x10'));var qs=require(_0xdfaf('0x11'));var as=require(_0xdfaf('0x12'));var hardwareService=require(_0xdfaf('0x13'));var logger=require(_0xdfaf('0x14'))(_0xdfaf('0x15'));var utils=require(_0xdfaf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfaf('0x17'));var db=require(_0xdfaf('0x18'))['db'];function respondWithStatusCode(_0x33f969,_0x4a60a3){_0x4a60a3=_0x4a60a3||0xcc;return function(_0x334618){if(_0x334618){return _0x33f969[_0xdfaf('0x19')](_0x4a60a3);}return _0x33f969[_0xdfaf('0x1a')](_0x4a60a3)[_0xdfaf('0x1b')]();};}function respondWithResult(_0x1b842e,_0x30ef4b){_0x30ef4b=_0x30ef4b||0xc8;return function(_0xd5bbbe){if(_0xd5bbbe){return _0x1b842e[_0xdfaf('0x1a')](_0x30ef4b)[_0xdfaf('0x1c')](_0xd5bbbe);}};}function respondWithFilteredResult(_0x3b45b4,_0x1bff86){return function(_0xcb92ce){if(_0xcb92ce){var _0x45511c=typeof _0x1bff86[_0xdfaf('0x1d')]===_0xdfaf('0x1e')&&typeof _0x1bff86[_0xdfaf('0x1f')]===_0xdfaf('0x1e');var _0x52f7e1=_0xcb92ce[_0xdfaf('0x20')];var _0x296917=_0x45511c?0x0:_0x1bff86[_0xdfaf('0x1d')];var _0x524a0a=_0x45511c?_0xcb92ce['count']:_0x1bff86[_0xdfaf('0x1d')]+_0x1bff86['limit'];var _0x30f759;if(_0x524a0a>=_0x52f7e1){_0x524a0a=_0x52f7e1;_0x30f759=0xc8;}else{_0x30f759=0xce;}_0x3b45b4[_0xdfaf('0x1a')](_0x30f759);return _0x3b45b4[_0xdfaf('0x21')]('Content-Range',_0x296917+'-'+_0x524a0a+'/'+_0x52f7e1)[_0xdfaf('0x1c')](_0xcb92ce);}return null;};}function patchUpdates(_0x12b29e){return function(_0x16f29c){try{jsonpatch[_0xdfaf('0x22')](_0x16f29c,_0x12b29e,!![]);}catch(_0x157ad0){return BPromise[_0xdfaf('0x23')](_0x157ad0);}return _0x16f29c['save']();};}function saveUpdates(_0x3ef095,_0x59a442){return function(_0x2d82e1){if(_0x2d82e1){return _0x2d82e1[_0xdfaf('0x24')](_0x3ef095)[_0xdfaf('0x25')](function(_0x393b61){return _0x393b61;});}return null;};}function removeEntity(_0x388e05,_0x1f86f3){return function(_0x251144){if(_0x251144){return _0x251144['destroy']()[_0xdfaf('0x25')](function(){_0x388e05[_0xdfaf('0x1a')](0xcc)[_0xdfaf('0x1b')]();});}};}function handleEntityNotFound(_0x497a6a,_0x10cf80){return function(_0x55bc96){if(!_0x55bc96){_0x497a6a['sendStatus'](0x194);}return _0x55bc96;};}function handleError(_0x389a95,_0x3966d8){_0x3966d8=_0x3966d8||0x1f4;return function(_0x445190){logger[_0xdfaf('0x26')](_0x445190['stack']);if(_0x445190[_0xdfaf('0x27')]){delete _0x445190[_0xdfaf('0x27')];}_0x389a95[_0xdfaf('0x1a')](_0x3966d8)[_0xdfaf('0x28')](_0x445190);};}exports[_0xdfaf('0x29')]=function(_0x6bd495,_0x922007){var _0x26e86e={},_0x1f32d0={},_0x14a291={'count':0x0,'rows':[]};var _0x3ded9f=_[_0xdfaf('0x2a')](db[_0xdfaf('0x2b')][_0xdfaf('0x2c')],function(_0x44522c){return{'name':_0x44522c[_0xdfaf('0x2d')],'type':_0x44522c[_0xdfaf('0x2e')][_0xdfaf('0x2f')]};});_0x1f32d0['model']=_[_0xdfaf('0x2a')](_0x3ded9f,_0xdfaf('0x27'));_0x1f32d0['query']=_[_0xdfaf('0x30')](_0x6bd495[_0xdfaf('0x31')]);_0x1f32d0['filters']=_[_0xdfaf('0x32')](_0x1f32d0[_0xdfaf('0x33')],_0x1f32d0['query']);_0x26e86e[_0xdfaf('0x34')]=_[_0xdfaf('0x32')](_0x1f32d0['model'],qs[_0xdfaf('0x35')](_0x6bd495[_0xdfaf('0x31')][_0xdfaf('0x35')]));_0x26e86e[_0xdfaf('0x34')]=_0x26e86e[_0xdfaf('0x34')][_0xdfaf('0x36')]?_0x26e86e[_0xdfaf('0x34')]:_0x1f32d0['model'];if(!_0x6bd495['query'][_0xdfaf('0x37')](_0xdfaf('0x38'))){_0x26e86e[_0xdfaf('0x1f')]=qs[_0xdfaf('0x1f')](_0x6bd495[_0xdfaf('0x31')][_0xdfaf('0x1f')]);_0x26e86e[_0xdfaf('0x1d')]=qs[_0xdfaf('0x1d')](_0x6bd495[_0xdfaf('0x31')]['offset']);}_0x26e86e[_0xdfaf('0x39')]=qs['sort'](_0x6bd495[_0xdfaf('0x31')]['sort']);_0x26e86e['where']=qs[_0xdfaf('0x3a')](_[_0xdfaf('0x3b')](_0x6bd495[_0xdfaf('0x31')],_0x1f32d0[_0xdfaf('0x3a')]),_0x3ded9f);if(_0x6bd495[_0xdfaf('0x31')][_0xdfaf('0x3c')]){_0x26e86e[_0xdfaf('0x3d')]=_[_0xdfaf('0x3e')](_0x26e86e[_0xdfaf('0x3d')],{'$or':_[_0xdfaf('0x2a')](_0x3ded9f,function(_0x3d6d41){if(_0x3d6d41[_0xdfaf('0x2e')]!=='VIRTUAL'){var _0x4c61df={};_0x4c61df[_0x3d6d41[_0xdfaf('0x27')]]={'$like':'%'+_0x6bd495[_0xdfaf('0x31')][_0xdfaf('0x3c')]+'%'};return _0x4c61df;}})});}_0x26e86e=_[_0xdfaf('0x3e')]({},_0x26e86e,_0x6bd495[_0xdfaf('0x3f')]);var _0x3e3d95={'where':_0x26e86e[_0xdfaf('0x3d')]};return db[_0xdfaf('0x2b')]['count'](_0x3e3d95)[_0xdfaf('0x25')](function(_0x26fe75){_0x14a291[_0xdfaf('0x20')]=_0x26fe75;if(_0x6bd495[_0xdfaf('0x31')][_0xdfaf('0x40')]){_0x26e86e[_0xdfaf('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xdfaf('0x42')](_0x26e86e);})[_0xdfaf('0x25')](function(_0x28e2bc){_0x14a291[_0xdfaf('0x43')]=_0x28e2bc;return _0x14a291;})[_0xdfaf('0x25')](respondWithFilteredResult(_0x922007,_0x26e86e))[_0xdfaf('0x44')](handleError(_0x922007,null));};exports[_0xdfaf('0x45')]=function(_0x592975,_0x2019e3){var _0x39f506={'raw':!![],'where':{'id':_0x592975['params']['id']}},_0x376555={};_0x376555['model']=_[_0xdfaf('0x30')](db['SquareDetailsReport']['rawAttributes']);_0x376555['query']=_[_0xdfaf('0x30')](_0x592975[_0xdfaf('0x31')]);_0x376555[_0xdfaf('0x3a')]=_['intersection'](_0x376555[_0xdfaf('0x33')],_0x376555['query']);_0x39f506[_0xdfaf('0x34')]=_[_0xdfaf('0x32')](_0x376555[_0xdfaf('0x33')],qs[_0xdfaf('0x35')](_0x592975[_0xdfaf('0x31')][_0xdfaf('0x35')]));_0x39f506[_0xdfaf('0x34')]=_0x39f506[_0xdfaf('0x34')]['length']?_0x39f506['attributes']:_0x376555[_0xdfaf('0x33')];if(_0x592975[_0xdfaf('0x31')][_0xdfaf('0x40')]){_0x39f506[_0xdfaf('0x41')]=[{'all':!![]}];}_0x39f506=_[_0xdfaf('0x3e')]({},_0x39f506,_0x592975[_0xdfaf('0x3f')]);return db['SquareDetailsReport'][_0xdfaf('0x46')](_0x39f506)[_0xdfaf('0x25')](handleEntityNotFound(_0x2019e3,null))[_0xdfaf('0x25')](respondWithResult(_0x2019e3,null))['catch'](handleError(_0x2019e3,null));};exports[_0xdfaf('0x47')]=function(_0x2ca58c,_0x4079e7){return db[_0xdfaf('0x2b')]['create'](_0x2ca58c[_0xdfaf('0x48')],{})[_0xdfaf('0x25')](respondWithResult(_0x4079e7,0xc9))[_0xdfaf('0x44')](handleError(_0x4079e7,null));};exports['update']=function(_0x2bcf4e,_0x385c0b){if(_0x2bcf4e['body']['id']){delete _0x2bcf4e['body']['id'];}return db[_0xdfaf('0x2b')][_0xdfaf('0x46')]({'where':{'id':_0x2bcf4e[_0xdfaf('0x49')]['id']}})[_0xdfaf('0x25')](handleEntityNotFound(_0x385c0b,null))['then'](saveUpdates(_0x2bcf4e['body'],null))[_0xdfaf('0x25')](respondWithResult(_0x385c0b,null))[_0xdfaf('0x44')](handleError(_0x385c0b,null));};exports[_0xdfaf('0x4a')]=function(_0x2c69b0,_0x48d89a){return db[_0xdfaf('0x2b')]['find']({'where':{'id':_0x2c69b0[_0xdfaf('0x49')]['id']}})[_0xdfaf('0x25')](handleEntityNotFound(_0x48d89a,null))[_0xdfaf('0x25')](removeEntity(_0x48d89a,null))[_0xdfaf('0x44')](handleError(_0x48d89a,null));};exports['describe']=function(_0x54e109,_0xc74400){return db[_0xdfaf('0x2b')][_0xdfaf('0x4b')]()[_0xdfaf('0x25')](respondWithResult(_0xc74400,null))[_0xdfaf('0x44')](handleError(_0xc74400,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 9b8bb13..2798429 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 _0x24c7=['bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x17f862,_0x4fe6e6){var _0x13d947=function(_0x1d0829){while(--_0x1d0829){_0x17f862['push'](_0x17f862['shift']());}};_0x13d947(++_0x4fe6e6);}(_0x24c7,0x119));var _0x724c=function(_0x30666a,_0x326a16){_0x30666a=_0x30666a-0x0;var _0x1797b2=_0x24c7[_0x30666a];return _0x1797b2;};'use strict';var _=require(_0x724c('0x0'));var util=require(_0x724c('0x1'));var logger=require(_0x724c('0x2'))(_0x724c('0x3'));var moment=require(_0x724c('0x4'));var BPromise=require(_0x724c('0x5'));var rp=require(_0x724c('0x6'));var fs=require('fs');var path=require(_0x724c('0x7'));var rimraf=require(_0x724c('0x8'));var config=require('../../config/environment');var attributes=require(_0x724c('0x9'));module['exports']=function(_0x5ccb04,_0x3ddacb){return _0x5ccb04[_0x724c('0xa')](_0x724c('0xb'),attributes,{'tableName':_0x724c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e73=['bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','util','../../config/logger','api','moment'];(function(_0x177cfa,_0x463c2c){var _0x4ae48b=function(_0x438671){while(--_0x438671){_0x177cfa['push'](_0x177cfa['shift']());}};_0x4ae48b(++_0x463c2c);}(_0x7e73,0x110));var _0x37e7=function(_0x46d244,_0x3b0277){_0x46d244=_0x46d244-0x0;var _0x7a3adc=_0x7e73[_0x46d244];return _0x7a3adc;};'use strict';var _=require('lodash');var util=require(_0x37e7('0x0'));var logger=require(_0x37e7('0x1'))(_0x37e7('0x2'));var moment=require(_0x37e7('0x3'));var BPromise=require(_0x37e7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37e7('0x5'));var rimraf=require(_0x37e7('0x6'));var config=require(_0x37e7('0x7'));var attributes=require(_0x37e7('0x8'));module['exports']=function(_0x4b1466,_0x5c0e9a){return _0x4b1466[_0x37e7('0x9')](_0x37e7('0xa'),attributes,{'tableName':_0x37e7('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 9a9564a..55bfe14 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 _0x7fea=['options','raw','then','debug','stringify','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create'];(function(_0x4e45cb,_0x4ee967){var _0x5e358a=function(_0x20663e){while(--_0x20663e){_0x4e45cb['push'](_0x4e45cb['shift']());}};_0x5e358a(++_0x4ee967);}(_0x7fea,0x149));var _0xa7fe=function(_0x234ef7,_0x2224b3){_0x234ef7=_0x234ef7-0x0;var _0x18c351=_0x7fea[_0x234ef7];return _0x18c351;};'use strict';var _=require('lodash');var util=require(_0xa7fe('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa7fe('0x1'));var fs=require('fs');var Redis=require(_0xa7fe('0x2'));var db=require(_0xa7fe('0x3'))['db'];var utils=require(_0xa7fe('0x4'));var logger=require(_0xa7fe('0x5'))(_0xa7fe('0x6'));var config=require('../../config/environment');var jayson=require(_0xa7fe('0x7'));var client=jayson[_0xa7fe('0x8')][_0xa7fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1132f1,_0x45f967,_0x3597b0){return new BPromise(function(_0x4668f0,_0x3d9135){return client['request'](_0x1132f1,_0x3597b0)['then'](function(_0x1db10e){logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,_0xa7fe('0xc'));logger['debug'](_0xa7fe('0xd'),_0x45f967,_0xa7fe('0xc'),JSON['stringify'](_0x1db10e));if(_0x1db10e[_0xa7fe('0xe')]){if(_0x1db10e['error'][_0xa7fe('0xf')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x45f967,_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);return _0x3d9135(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}logger[_0xa7fe('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x45f967,_0x1db10e['error'][_0xa7fe('0x10')]);return _0x4668f0(_0x1db10e[_0xa7fe('0xe')][_0xa7fe('0x10')]);}else{logger[_0xa7fe('0xa')](_0xa7fe('0xb'),_0x45f967,'request\x20sent');_0x4668f0(_0x1db10e[_0xa7fe('0x11')][_0xa7fe('0x10')]);}})[_0xa7fe('0x12')](function(_0x253293){logger[_0xa7fe('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x45f967,_0x253293);_0x3d9135(_0x253293);});});}exports[_0xa7fe('0x13')]=function(_0x1e4966){var _0x2bf8db=this;return new Promise(function(_0x2ef53c,_0x179b9e){return db[_0xa7fe('0x14')][_0xa7fe('0x15')](_0x1e4966['body'],{'raw':_0x1e4966['options']?_0x1e4966[_0xa7fe('0x16')][_0xa7fe('0x17')]===undefined?!![]:![]:!![]})[_0xa7fe('0x18')](function(_0x529990){logger[_0xa7fe('0xa')](_0xa7fe('0x13'),_0x1e4966);logger[_0xa7fe('0x19')]('CreateSquareDetailsReport',_0x1e4966,JSON[_0xa7fe('0x1a')](_0x529990));_0x2ef53c(_0x529990);})[_0xa7fe('0x12')](function(_0x1619c1){logger[_0xa7fe('0xe')](_0xa7fe('0x13'),_0x1619c1[_0xa7fe('0x10')],_0x1e4966);_0x179b9e(_0x2bf8db[_0xa7fe('0xe')](0x1f4,_0x1619c1[_0xa7fe('0x10')]));});});}; \ No newline at end of file +var _0x32b6=['request','then','debug','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x32b6,0x1d1));var _0x632b=function(_0x32734f,_0x5becb6){_0x32734f=_0x32734f-0x0;var _0x3867c9=_0x32b6[_0x32734f];return _0x3867c9;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x116f62){logger['info']('CreateSquareDetailsReport',_0x3bb27f);logger[_0x632b('0xd')]('CreateSquareDetailsReport',_0x3bb27f,JSON[_0x632b('0xf')](_0x116f62));_0x51c894(_0x116f62);})[_0x632b('0x1b')](function(_0x2a6833){logger['error'](_0x632b('0x15'),_0x2a6833[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472['error'](0x1f4,_0x2a6833[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index f509413..fb84d36 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 _0x25af=['/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x39cf70,_0x3ec55b){var _0x580424=function(_0x580a4e){while(--_0x580a4e){_0x39cf70['push'](_0x39cf70['shift']());}};_0x580424(++_0x3ec55b);}(_0x25af,0xa5));var _0xf25a=function(_0x3f6c69,_0x1b7541){_0x3f6c69=_0x3f6c69-0x0;var _0x2f110e=_0x25af[_0x3f6c69];return _0x2f110e;};'use strict';var express=require(_0xf25a('0x0'));var router=express['Router']();var auth=require(_0xf25a('0x1'));var controller=require(_0xf25a('0x2'));router[_0xf25a('0x3')]('/',auth[_0xf25a('0x4')](),controller[_0xf25a('0x5')]);router[_0xf25a('0x3')](_0xf25a('0x6'),auth[_0xf25a('0x4')](),controller[_0xf25a('0x7')]);module[_0xf25a('0x8')]=router; \ No newline at end of file +var _0xe1cf=['./system.controller','isAuthenticated','/process/:pid/kill','exports','../../components/auth/service'];(function(_0x3d67f5,_0x45379f){var _0x225ce9=function(_0x20d731){while(--_0x20d731){_0x3d67f5['push'](_0x3d67f5['shift']());}};_0x225ce9(++_0x45379f);}(_0xe1cf,0xcc));var _0xfe1c=function(_0x42008b,_0x35f54f){_0x42008b=_0x42008b-0x0;var _0x34f22e=_0xe1cf[_0x42008b];return _0x34f22e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xfe1c('0x0'));var controller=require(_0xfe1c('0x1'));router['get']('/',auth[_0xfe1c('0x2')](),controller['index']);router['get'](_0xfe1c('0x3'),auth['isAuthenticated'](),controller['killProcess']);module[_0xfe1c('0x4')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index a06c9b2..889e08e 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 _0x8bdf=['getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','systeminformation','exec','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0x8bdf,0xfe));var _0xf8bd=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x8bdf[_0x31e29a];return _0x32d892;};'use strict';var info=require(_0xf8bd('0x0'));var exec=require('child_process')[_0xf8bd('0x1')];var logger=require('../../config/logger')(_0xf8bd('0x2'));var util=require('util');var BPromise=require(_0xf8bd('0x3'));var _=require(_0xf8bd('0x4'));function handleError(_0x53c26e,_0x1c5fb3,_0x4cdce3){_0x1c5fb3=_0x1c5fb3||0x1f4;return function(_0x376d3d){logger[_0xf8bd('0x5')](_0xf8bd('0x6'),_0x4cdce3,_0x1c5fb3,util[_0xf8bd('0x7')](_0x376d3d,{'showHidden':![],'depth':null}));delete _0x376d3d['name'];_0x53c26e[_0xf8bd('0x8')](_0x1c5fb3)[_0xf8bd('0x9')](_0x376d3d);};}exports['index']=function(_0x2a51ad,_0x523ded){return info[_0xf8bd('0xa')]()['then'](function(_0x268d97){return _0x523ded[_0xf8bd('0x8')](0xc8)[_0xf8bd('0xb')](_0x268d97);})[_0xf8bd('0xc')](function(_0x1091e2){return _0x523ded[_0xf8bd('0x8')](0x1f4)[_0xf8bd('0xb')](_0x1091e2);});};exports[_0xf8bd('0xd')]=function(_0x145055,_0x3bf294){var _0x5e0b02=[_0xf8bd('0xe')];return new BPromise(function(_0x25348f,_0x14d938){return exec(util[_0xf8bd('0xf')](_0xf8bd('0x10'),_0x145055[_0xf8bd('0x11')][_0xf8bd('0x12')]),function(_0x42861b,_0x33a7ad,_0x297fa7){if(_0x42861b){return _0x14d938(_0x42861b);}return _0x25348f(_0x33a7ad);});})['then'](function(_0x2e66fb){var _0x48c367=![];var _0x45e2d9=_0x2e66fb[_0xf8bd('0x13')](/\n/);for(var _0x393693=0x0,_0x36c3d8=_0x5e0b02[_0xf8bd('0x14')];_0x393693<_0x36c3d8,_0x48c367===![];_0x393693+=0x1){if(_0x2e66fb['indexOf'](_0x5e0b02[_0x393693])>=0x0){_0x48c367=!![];}}if(!_0x48c367){throw new Error(util[_0xf8bd('0xf')](_0xf8bd('0x15'),_0x145055[_0xf8bd('0x11')][_0xf8bd('0x12')]));}process[_0xf8bd('0x16')](_0x145055[_0xf8bd('0x11')]['pid'],_0xf8bd('0x17'));return _0x3bf294['status'](0xc8)[_0xf8bd('0xb')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x145055[_0xf8bd('0x11')][_0xf8bd('0x12')])});})[_0xf8bd('0xc')](handleError(_0x3bf294,null,_0xf8bd('0xd')));}; \ No newline at end of file +var _0x8abe=['error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split','length','indexOf','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','exec','../../config/logger','util','bluebird','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x8abe,0x127));var _0xe8ab=function(_0x2dcf6e,_0x1e971f){_0x2dcf6e=_0x2dcf6e-0x0;var _0x5c9d78=_0x8abe[_0x2dcf6e];return _0x5c9d78;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xe8ab('0x0')];var logger=require(_0xe8ab('0x1'))('api');var util=require(_0xe8ab('0x2'));var BPromise=require(_0xe8ab('0x3'));var _=require(_0xe8ab('0x4'));function handleError(_0x4ad03b,_0x629bdd,_0x314b4d){_0x629bdd=_0x629bdd||0x1f4;return function(_0x240d44){logger[_0xe8ab('0x5')](_0xe8ab('0x6'),_0x314b4d,_0x629bdd,util[_0xe8ab('0x7')](_0x240d44,{'showHidden':![],'depth':null}));delete _0x240d44['name'];_0x4ad03b[_0xe8ab('0x8')](_0x629bdd)[_0xe8ab('0x9')](_0x240d44);};}exports[_0xe8ab('0xa')]=function(_0x47cca1,_0x5b2c75){return info[_0xe8ab('0xb')]()[_0xe8ab('0xc')](function(_0x3590aa){return _0x5b2c75['status'](0xc8)[_0xe8ab('0xd')](_0x3590aa);})[_0xe8ab('0xe')](function(_0x20418d){return _0x5b2c75['status'](0x1f4)[_0xe8ab('0xd')](_0x20418d);});};exports[_0xe8ab('0xf')]=function(_0x369c1c,_0x907c8f){var _0x497c41=[_0xe8ab('0x10')];return new BPromise(function(_0xaedf01,_0x3d41ba){return exec(util[_0xe8ab('0x11')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x369c1c[_0xe8ab('0x12')][_0xe8ab('0x13')]),function(_0x117b22,_0x233f4d,_0xf2e113){if(_0x117b22){return _0x3d41ba(_0x117b22);}return _0xaedf01(_0x233f4d);});})[_0xe8ab('0xc')](function(_0x112613){var _0x552bb5=![];var _0x5f4a61=_0x112613[_0xe8ab('0x14')](/\n/);for(var _0x593269=0x0,_0x17540c=_0x497c41[_0xe8ab('0x15')];_0x593269<_0x17540c,_0x552bb5===![];_0x593269+=0x1){if(_0x112613[_0xe8ab('0x16')](_0x497c41[_0x593269])>=0x0){_0x552bb5=!![];}}if(!_0x552bb5){throw new Error(util[_0xe8ab('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x369c1c[_0xe8ab('0x12')][_0xe8ab('0x13')]));}process['kill'](_0x369c1c['params'][_0xe8ab('0x13')],_0xe8ab('0x17'));return _0x907c8f[_0xe8ab('0x8')](0xc8)[_0xe8ab('0xd')]({'message':util[_0xe8ab('0x11')](_0xe8ab('0x18'),_0x369c1c['params'][_0xe8ab('0x13')])});})[_0xe8ab('0xe')](handleError(_0x907c8f,null,_0xe8ab('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 647bd5a..3371753 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 _0xf109=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0xf109,0xce));var _0x9f10=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xf109[_0x20589d];return _0x422de9;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9f10('0x3'));var auth=require(_0x9f10('0x4'));var interaction=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var controller=require(_0x9f10('0x7'));router[_0x9f10('0x8')]('/',auth[_0x9f10('0x9')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x8')](_0x9f10('0xb'),auth[_0x9f10('0x9')](),controller['describe']);router[_0x9f10('0x8')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller[_0x9f10('0xd')]);router[_0x9f10('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')](_0x9f10('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9f10('0x11')](_0x9f10('0xc'),auth[_0x9f10('0x9')](),controller['destroy']);module[_0x9f10('0x12')]=router; \ No newline at end of file +var _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x17615e,_0x483a49){var _0xa4c97e=function(_0x24ecf7){while(--_0x24ecf7){_0x17615e['push'](_0x17615e['shift']());}};_0xa4c97e(++_0x483a49);}(_0xfd28,0x148));var _0x8fd2=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xfd28[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 701bd23..eb6adb8 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 _0xab23=['exports','STRING','name','#0091EA','sequelize'];(function(_0x2a7e8b,_0x23100c){var _0x4827e2=function(_0x57ed4e){while(--_0x57ed4e){_0x2a7e8b['push'](_0x2a7e8b['shift']());}};_0x4827e2(++_0x23100c);}(_0xab23,0x1bc));var _0x3ab2=function(_0x1a6b23,_0x2f0815){_0x1a6b23=_0x1a6b23-0x0;var _0xa2a1f8=_0xab23[_0x1a6b23];return _0xa2a1f8;};'use strict';var Sequelize=require(_0x3ab2('0x0'));module[_0x3ab2('0x1')]={'name':{'type':Sequelize[_0x3ab2('0x2')],'unique':_0x3ab2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3ab2('0x2')],'defaultValue':_0x3ab2('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0bb4=['exports','name','STRING','#0091EA','sequelize'];(function(_0x2bbdc0,_0x1b1fe4){var _0x21409a=function(_0x4f6f7c){while(--_0x4f6f7c){_0x2bbdc0['push'](_0x2bbdc0['shift']());}};_0x21409a(++_0x1b1fe4);}(_0x0bb4,0x77));var _0x40bb=function(_0x17a71f,_0x31beb9){_0x17a71f=_0x17a71f-0x0;var _0x3178f7=_0x0bb4[_0x17a71f];return _0x3178f7;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x40bb('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x40bb('0x3')],'defaultValue':_0x40bb('0x4')},'description':{'type':Sequelize[_0x40bb('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 379f703..dbf88c7 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 _0x5d99=['name','send','map','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','filter','merge','where','includeAll','include','findAll','catch','show','params','fields','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','get','UserProfileResource','stack'];(function(_0x1aa41b,_0x4e1ed8){var _0x9e2db3=function(_0x2f7bcc){while(--_0x2f7bcc){_0x1aa41b['push'](_0x1aa41b['shift']());}};_0x9e2db3(++_0x4e1ed8);}(_0x5d99,0x1b7));var _0x95d9=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x5d99[_0x303c30];return _0x43161b;};'use strict';var emlformat=require(_0x95d9('0x0'));var rimraf=require(_0x95d9('0x1'));var zipdir=require(_0x95d9('0x2'));var jsonpatch=require(_0x95d9('0x3'));var rp=require(_0x95d9('0x4'));var moment=require(_0x95d9('0x5'));var BPromise=require(_0x95d9('0x6'));var Mustache=require(_0x95d9('0x7'));var util=require(_0x95d9('0x8'));var path=require(_0x95d9('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95d9('0xa'));var fs=require('fs');var fs_extra=require(_0x95d9('0xb'));var _=require(_0x95d9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95d9('0xd'));var deskjs=require(_0x95d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95d9('0xf'));var Papa=require(_0x95d9('0x10'));var Redis=require(_0x95d9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x95d9('0x12'));var as=require(_0x95d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95d9('0x14'));var utils=require(_0x95d9('0x15'));var config=require(_0x95d9('0x16'));var licenseUtil=require(_0x95d9('0x17'));var db=require(_0x95d9('0x18'))['db'];function respondWithStatusCode(_0x8c1b85,_0xbbdcd4){_0xbbdcd4=_0xbbdcd4||0xcc;return function(_0x1363a0){if(_0x1363a0){return _0x8c1b85['sendStatus'](_0xbbdcd4);}return _0x8c1b85[_0x95d9('0x19')](_0xbbdcd4)[_0x95d9('0x1a')]();};}function respondWithResult(_0x49a3f2,_0x44cf76){_0x44cf76=_0x44cf76||0xc8;return function(_0x3a4283){if(_0x3a4283){return _0x49a3f2[_0x95d9('0x19')](_0x44cf76)[_0x95d9('0x1b')](_0x3a4283);}};}function respondWithFilteredResult(_0x372c24,_0x51e2a1){return function(_0x134a4f){if(_0x134a4f){var _0xed5a6e=typeof _0x51e2a1[_0x95d9('0x1c')]==='undefined'&&typeof _0x51e2a1[_0x95d9('0x1d')]===_0x95d9('0x1e');var _0xf0067a=_0x134a4f[_0x95d9('0x1f')];var _0xb3b52a=_0xed5a6e?0x0:_0x51e2a1[_0x95d9('0x1c')];var _0x1f58b5=_0xed5a6e?_0x134a4f[_0x95d9('0x1f')]:_0x51e2a1['offset']+_0x51e2a1[_0x95d9('0x1d')];var _0x57e1e3;if(_0x1f58b5>=_0xf0067a){_0x1f58b5=_0xf0067a;_0x57e1e3=0xc8;}else{_0x57e1e3=0xce;}_0x372c24[_0x95d9('0x19')](_0x57e1e3);return _0x372c24[_0x95d9('0x20')]('Content-Range',_0xb3b52a+'-'+_0x1f58b5+'/'+_0xf0067a)[_0x95d9('0x1b')](_0x134a4f);}return null;};}function patchUpdates(_0x171791){return function(_0x361db8){try{jsonpatch[_0x95d9('0x21')](_0x361db8,_0x171791,!![]);}catch(_0x248f5d){return BPromise['reject'](_0x248f5d);}return _0x361db8[_0x95d9('0x22')]();};}function saveUpdates(_0x5d562c,_0x2f3b7c){return function(_0x20b81d){if(_0x20b81d){return _0x20b81d[_0x95d9('0x23')](_0x5d562c)[_0x95d9('0x24')](function(_0x45e228){return _0x45e228;});}return null;};}function removeEntity(_0x5f3fcc,_0x102777){return function(_0x282840){if(_0x282840){return _0x282840[_0x95d9('0x25')]()[_0x95d9('0x24')](function(){var _0x5d74e3=_0x282840[_0x95d9('0x26')]({'plain':!![]});var _0x420041='Tags';return db[_0x95d9('0x27')][_0x95d9('0x25')]({'where':{'type':_0x420041,'resourceId':_0x5d74e3['id']}})[_0x95d9('0x24')](function(){return _0x282840;});})['then'](function(){_0x5f3fcc[_0x95d9('0x19')](0xcc)[_0x95d9('0x1a')]();});}};}function handleEntityNotFound(_0x5867f1,_0x2c6eb0){return function(_0x5c96ad){if(!_0x5c96ad){_0x5867f1['sendStatus'](0x194);}return _0x5c96ad;};}function handleError(_0x315faf,_0x2bbdb9){_0x2bbdb9=_0x2bbdb9||0x1f4;return function(_0x279acd){logger['error'](_0x279acd[_0x95d9('0x28')]);if(_0x279acd['name']){delete _0x279acd[_0x95d9('0x29')];}_0x315faf[_0x95d9('0x19')](_0x2bbdb9)[_0x95d9('0x2a')](_0x279acd);};}exports['index']=function(_0x7acc8d,_0x464bfb){var _0xe710fb={},_0xa72afa={},_0x38c7d6={'count':0x0,'rows':[]};var _0x5de7ec=_[_0x95d9('0x2b')](db[_0x95d9('0x2c')]['rawAttributes'],function(_0x21f9ee){return{'name':_0x21f9ee[_0x95d9('0x2d')],'type':_0x21f9ee['type'][_0x95d9('0x2e')]};});_0xa72afa[_0x95d9('0x2f')]=_[_0x95d9('0x2b')](_0x5de7ec,_0x95d9('0x29'));_0xa72afa[_0x95d9('0x30')]=_[_0x95d9('0x31')](_0x7acc8d[_0x95d9('0x30')]);_0xa72afa[_0x95d9('0x32')]=_[_0x95d9('0x33')](_0xa72afa[_0x95d9('0x2f')],_0xa72afa[_0x95d9('0x30')]);_0xe710fb[_0x95d9('0x34')]=_['intersection'](_0xa72afa['model'],qs['fields'](_0x7acc8d[_0x95d9('0x30')]['fields']));_0xe710fb[_0x95d9('0x34')]=_0xe710fb[_0x95d9('0x34')]['length']?_0xe710fb['attributes']:_0xa72afa[_0x95d9('0x2f')];if(!_0x7acc8d[_0x95d9('0x30')]['hasOwnProperty'](_0x95d9('0x35'))){_0xe710fb[_0x95d9('0x1d')]=qs[_0x95d9('0x1d')](_0x7acc8d[_0x95d9('0x30')]['limit']);_0xe710fb[_0x95d9('0x1c')]=qs[_0x95d9('0x1c')](_0x7acc8d[_0x95d9('0x30')][_0x95d9('0x1c')]);}_0xe710fb[_0x95d9('0x36')]=qs[_0x95d9('0x37')](_0x7acc8d['query']['sort']);_0xe710fb['where']=qs[_0x95d9('0x32')](_['pick'](_0x7acc8d[_0x95d9('0x30')],_0xa72afa[_0x95d9('0x32')]),_0x5de7ec);if(_0x7acc8d[_0x95d9('0x30')][_0x95d9('0x38')]){_0xe710fb['where']=_[_0x95d9('0x39')](_0xe710fb[_0x95d9('0x3a')],{'$or':_['map'](_0x5de7ec,function(_0x56d9f4){if(_0x56d9f4['type']!=='VIRTUAL'){var _0x24a0ae={};_0x24a0ae[_0x56d9f4[_0x95d9('0x29')]]={'$like':'%'+_0x7acc8d[_0x95d9('0x30')]['filter']+'%'};return _0x24a0ae;}})});}_0xe710fb=_['merge']({},_0xe710fb,_0x7acc8d['options']);var _0x13614c={'where':_0xe710fb[_0x95d9('0x3a')]};return db['Tag'][_0x95d9('0x1f')](_0x13614c)['then'](function(_0x234af3){_0x38c7d6[_0x95d9('0x1f')]=_0x234af3;if(_0x7acc8d['query'][_0x95d9('0x3b')]){_0xe710fb[_0x95d9('0x3c')]=[{'all':!![]}];}return db[_0x95d9('0x2c')][_0x95d9('0x3d')](_0xe710fb);})[_0x95d9('0x24')](function(_0x55a03b){_0x38c7d6['rows']=_0x55a03b;return _0x38c7d6;})['then'](respondWithFilteredResult(_0x464bfb,_0xe710fb))[_0x95d9('0x3e')](handleError(_0x464bfb,null));};exports[_0x95d9('0x3f')]=function(_0x4526fe,_0x50591c){var _0x481e7e={'raw':!![],'where':{'id':_0x4526fe[_0x95d9('0x40')]['id']}},_0x2fa94d={};_0x2fa94d['model']=_[_0x95d9('0x31')](db[_0x95d9('0x2c')]['rawAttributes']);_0x2fa94d['query']=_[_0x95d9('0x31')](_0x4526fe[_0x95d9('0x30')]);_0x2fa94d['filters']=_[_0x95d9('0x33')](_0x2fa94d['model'],_0x2fa94d[_0x95d9('0x30')]);_0x481e7e[_0x95d9('0x34')]=_[_0x95d9('0x33')](_0x2fa94d[_0x95d9('0x2f')],qs[_0x95d9('0x41')](_0x4526fe[_0x95d9('0x30')][_0x95d9('0x41')]));_0x481e7e[_0x95d9('0x34')]=_0x481e7e[_0x95d9('0x34')][_0x95d9('0x42')]?_0x481e7e[_0x95d9('0x34')]:_0x2fa94d['model'];if(_0x4526fe[_0x95d9('0x30')][_0x95d9('0x3b')]){_0x481e7e[_0x95d9('0x3c')]=[{'all':!![]}];}_0x481e7e=_[_0x95d9('0x39')]({},_0x481e7e,_0x4526fe[_0x95d9('0x43')]);return db['Tag']['find'](_0x481e7e)[_0x95d9('0x24')](handleEntityNotFound(_0x50591c,null))['then'](respondWithResult(_0x50591c,null))['catch'](handleError(_0x50591c,null));};exports[_0x95d9('0x44')]=function(_0x556809,_0x29a75a){return db[_0x95d9('0x2c')][_0x95d9('0x44')](_0x556809['body'],{})['then'](function(_0x4a7769){var _0x317f10=_0x556809[_0x95d9('0x45')][_0x95d9('0x26')]({'plain':!![]});if(!_0x317f10)throw new Error(_0x95d9('0x46'));if(_0x317f10[_0x95d9('0x47')]===_0x95d9('0x45')){var _0x5dd817=_0x4a7769[_0x95d9('0x26')]({'plain':!![]});var _0x5425b4=_0x95d9('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x5425b4,'userProfileId':_0x317f10[_0x95d9('0x49')]},'raw':!![]})[_0x95d9('0x24')](function(_0x4c0e46){if(_0x4c0e46&&_0x4c0e46[_0x95d9('0x4a')]===0x0){return db['UserProfileResource'][_0x95d9('0x44')]({'name':_0x5dd817['name'],'resourceId':_0x5dd817['id'],'type':_0x4c0e46[_0x95d9('0x29')],'sectionId':_0x4c0e46['id']},{})[_0x95d9('0x24')](function(){return _0x4a7769;});}else{return _0x4a7769;}})['catch'](function(_0x4cd2e8){logger[_0x95d9('0x4b')](_0x95d9('0x4c'),_0x4cd2e8);throw _0x4cd2e8;});}return _0x4a7769;})[_0x95d9('0x24')](respondWithResult(_0x29a75a,0xc9))['catch'](handleError(_0x29a75a,null));};exports['update']=function(_0x495ee3,_0x461ffa){if(_0x495ee3[_0x95d9('0x4d')]['id']){delete _0x495ee3[_0x95d9('0x4d')]['id'];}return db[_0x95d9('0x2c')]['find']({'where':{'id':_0x495ee3['params']['id']}})['then'](handleEntityNotFound(_0x461ffa,null))[_0x95d9('0x24')](saveUpdates(_0x495ee3[_0x95d9('0x4d')],null))[_0x95d9('0x24')](respondWithResult(_0x461ffa,null))['catch'](handleError(_0x461ffa,null));};exports[_0x95d9('0x25')]=function(_0x310e78,_0xb1238e){return db[_0x95d9('0x2c')][_0x95d9('0x4e')]({'where':{'id':_0x310e78[_0x95d9('0x40')]['id']}})[_0x95d9('0x24')](handleEntityNotFound(_0xb1238e,null))[_0x95d9('0x24')](removeEntity(_0xb1238e,null))[_0x95d9('0x3e')](handleError(_0xb1238e,null));};exports[_0x95d9('0x4f')]=function(_0x3ab856,_0x2775ad){return db['Tag'][_0x95d9('0x4f')]()[_0x95d9('0x24')](respondWithResult(_0x2775ad,null))[_0x95d9('0x3e')](handleError(_0x2775ad,null));}; \ No newline at end of file +var _0x45cb=['count','set','Content-Range','reject','update','then','destroy','Tags','sendStatus','name','send','map','Tag','rawAttributes','fieldName','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','catch','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','limit'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x45cb,0x126));var _0xb45c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x45cb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb45c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb45c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb45c('0x2'));var BPromise=require(_0xb45c('0x3'));var Mustache=require(_0xb45c('0x4'));var util=require(_0xb45c('0x5'));var path=require(_0xb45c('0x6'));var sox=require(_0xb45c('0x7'));var csv=require(_0xb45c('0x8'));var ejs=require(_0xb45c('0x9'));var fs=require('fs');var fs_extra=require(_0xb45c('0xa'));var _=require(_0xb45c('0xb'));var squel=require(_0xb45c('0xc'));var crypto=require('crypto');var jsforce=require(_0xb45c('0xd'));var deskjs=require(_0xb45c('0xe'));var toCsv=require(_0xb45c('0x8'));var querystring=require(_0xb45c('0xf'));var Papa=require(_0xb45c('0x10'));var Redis=require(_0xb45c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb45c('0x12'));var as=require(_0xb45c('0x13'));var hardwareService=require(_0xb45c('0x14'));var logger=require(_0xb45c('0x15'))(_0xb45c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb45c('0x17'));var db=require(_0xb45c('0x18'))['db'];function respondWithStatusCode(_0xe85640,_0x20fd56){_0x20fd56=_0x20fd56||0xcc;return function(_0x3f8fbb){if(_0x3f8fbb){return _0xe85640['sendStatus'](_0x20fd56);}return _0xe85640[_0xb45c('0x19')](_0x20fd56)[_0xb45c('0x1a')]();};}function respondWithResult(_0x166d01,_0x4762ac){_0x4762ac=_0x4762ac||0xc8;return function(_0x5c7eb8){if(_0x5c7eb8){return _0x166d01[_0xb45c('0x19')](_0x4762ac)[_0xb45c('0x1b')](_0x5c7eb8);}};}function respondWithFilteredResult(_0x552455,_0x556876){return function(_0x309ba9){if(_0x309ba9){var _0x102db5=typeof _0x556876['offset']===_0xb45c('0x1c')&&typeof _0x556876[_0xb45c('0x1d')]==='undefined';var _0x2cc0f8=_0x309ba9[_0xb45c('0x1e')];var _0x51a747=_0x102db5?0x0:_0x556876['offset'];var _0x5457e4=_0x102db5?_0x309ba9[_0xb45c('0x1e')]:_0x556876['offset']+_0x556876[_0xb45c('0x1d')];var _0x7f2870;if(_0x5457e4>=_0x2cc0f8){_0x5457e4=_0x2cc0f8;_0x7f2870=0xc8;}else{_0x7f2870=0xce;}_0x552455[_0xb45c('0x19')](_0x7f2870);return _0x552455[_0xb45c('0x1f')](_0xb45c('0x20'),_0x51a747+'-'+_0x5457e4+'/'+_0x2cc0f8)['json'](_0x309ba9);}return null;};}function patchUpdates(_0x3390fc){return function(_0x21e00e){try{jsonpatch['apply'](_0x21e00e,_0x3390fc,!![]);}catch(_0x2b0ef6){return BPromise[_0xb45c('0x21')](_0x2b0ef6);}return _0x21e00e['save']();};}function saveUpdates(_0x193123,_0x5960e3){return function(_0xaadef8){if(_0xaadef8){return _0xaadef8[_0xb45c('0x22')](_0x193123)[_0xb45c('0x23')](function(_0x552100){return _0x552100;});}return null;};}function removeEntity(_0x5dae6f,_0x554c50){return function(_0x43fa1e){if(_0x43fa1e){return _0x43fa1e[_0xb45c('0x24')]()['then'](function(){var _0x3f4603=_0x43fa1e['get']({'plain':!![]});var _0xcdde38=_0xb45c('0x25');return db['UserProfileResource'][_0xb45c('0x24')]({'where':{'type':_0xcdde38,'resourceId':_0x3f4603['id']}})['then'](function(){return _0x43fa1e;});})[_0xb45c('0x23')](function(){_0x5dae6f[_0xb45c('0x19')](0xcc)[_0xb45c('0x1a')]();});}};}function handleEntityNotFound(_0x402b28,_0x520cd5){return function(_0x5c1fdb){if(!_0x5c1fdb){_0x402b28[_0xb45c('0x26')](0x194);}return _0x5c1fdb;};}function handleError(_0x25c9c9,_0x4b9908){_0x4b9908=_0x4b9908||0x1f4;return function(_0x5aff1f){logger['error'](_0x5aff1f['stack']);if(_0x5aff1f[_0xb45c('0x27')]){delete _0x5aff1f[_0xb45c('0x27')];}_0x25c9c9['status'](_0x4b9908)[_0xb45c('0x28')](_0x5aff1f);};}exports['index']=function(_0x567a4b,_0x319bf7){var _0x249cbc={},_0x2497d5={},_0x5ea0cb={'count':0x0,'rows':[]};var _0xfe2385=_[_0xb45c('0x29')](db[_0xb45c('0x2a')][_0xb45c('0x2b')],function(_0x44baa6){return{'name':_0x44baa6[_0xb45c('0x2c')],'type':_0x44baa6['type']['key']};});_0x2497d5['model']=_[_0xb45c('0x29')](_0xfe2385,_0xb45c('0x27'));_0x2497d5[_0xb45c('0x2d')]=_[_0xb45c('0x2e')](_0x567a4b['query']);_0x2497d5[_0xb45c('0x2f')]=_['intersection'](_0x2497d5['model'],_0x2497d5[_0xb45c('0x2d')]);_0x249cbc[_0xb45c('0x30')]=_[_0xb45c('0x31')](_0x2497d5['model'],qs['fields'](_0x567a4b['query'][_0xb45c('0x32')]));_0x249cbc[_0xb45c('0x30')]=_0x249cbc[_0xb45c('0x30')][_0xb45c('0x33')]?_0x249cbc['attributes']:_0x2497d5[_0xb45c('0x34')];if(!_0x567a4b[_0xb45c('0x2d')][_0xb45c('0x35')](_0xb45c('0x36'))){_0x249cbc['limit']=qs[_0xb45c('0x1d')](_0x567a4b[_0xb45c('0x2d')]['limit']);_0x249cbc[_0xb45c('0x37')]=qs['offset'](_0x567a4b[_0xb45c('0x2d')]['offset']);}_0x249cbc[_0xb45c('0x38')]=qs[_0xb45c('0x39')](_0x567a4b[_0xb45c('0x2d')]['sort']);_0x249cbc[_0xb45c('0x3a')]=qs[_0xb45c('0x2f')](_['pick'](_0x567a4b[_0xb45c('0x2d')],_0x2497d5[_0xb45c('0x2f')]),_0xfe2385);if(_0x567a4b['query'][_0xb45c('0x3b')]){_0x249cbc[_0xb45c('0x3a')]=_[_0xb45c('0x3c')](_0x249cbc[_0xb45c('0x3a')],{'$or':_[_0xb45c('0x29')](_0xfe2385,function(_0x4b40b0){if(_0x4b40b0[_0xb45c('0x3d')]!==_0xb45c('0x3e')){var _0x25ce5f={};_0x25ce5f[_0x4b40b0[_0xb45c('0x27')]]={'$like':'%'+_0x567a4b[_0xb45c('0x2d')][_0xb45c('0x3b')]+'%'};return _0x25ce5f;}})});}_0x249cbc=_[_0xb45c('0x3c')]({},_0x249cbc,_0x567a4b[_0xb45c('0x3f')]);var _0x4f091e={'where':_0x249cbc[_0xb45c('0x3a')]};return db[_0xb45c('0x2a')][_0xb45c('0x1e')](_0x4f091e)['then'](function(_0x10703b){_0x5ea0cb[_0xb45c('0x1e')]=_0x10703b;if(_0x567a4b[_0xb45c('0x2d')]['includeAll']){_0x249cbc['include']=[{'all':!![]}];}return db[_0xb45c('0x2a')][_0xb45c('0x40')](_0x249cbc);})['then'](function(_0x45567a){_0x5ea0cb[_0xb45c('0x41')]=_0x45567a;return _0x5ea0cb;})[_0xb45c('0x23')](respondWithFilteredResult(_0x319bf7,_0x249cbc))[_0xb45c('0x42')](handleError(_0x319bf7,null));};exports['show']=function(_0x2a5ea1,_0x160823){var _0x59bfdc={'raw':!![],'where':{'id':_0x2a5ea1['params']['id']}},_0xfd23c2={};_0xfd23c2[_0xb45c('0x34')]=_[_0xb45c('0x2e')](db[_0xb45c('0x2a')][_0xb45c('0x2b')]);_0xfd23c2['query']=_[_0xb45c('0x2e')](_0x2a5ea1['query']);_0xfd23c2['filters']=_[_0xb45c('0x31')](_0xfd23c2[_0xb45c('0x34')],_0xfd23c2[_0xb45c('0x2d')]);_0x59bfdc[_0xb45c('0x30')]=_[_0xb45c('0x31')](_0xfd23c2[_0xb45c('0x34')],qs[_0xb45c('0x32')](_0x2a5ea1[_0xb45c('0x2d')][_0xb45c('0x32')]));_0x59bfdc[_0xb45c('0x30')]=_0x59bfdc[_0xb45c('0x30')][_0xb45c('0x33')]?_0x59bfdc[_0xb45c('0x30')]:_0xfd23c2[_0xb45c('0x34')];if(_0x2a5ea1['query']['includeAll']){_0x59bfdc[_0xb45c('0x43')]=[{'all':!![]}];}_0x59bfdc=_['merge']({},_0x59bfdc,_0x2a5ea1[_0xb45c('0x3f')]);return db[_0xb45c('0x2a')][_0xb45c('0x44')](_0x59bfdc)['then'](handleEntityNotFound(_0x160823,null))[_0xb45c('0x23')](respondWithResult(_0x160823,null))[_0xb45c('0x42')](handleError(_0x160823,null));};exports[_0xb45c('0x45')]=function(_0x3e2797,_0x266313){return db[_0xb45c('0x2a')][_0xb45c('0x45')](_0x3e2797[_0xb45c('0x46')],{})[_0xb45c('0x23')](function(_0x5d0030){var _0x2e8325=_0x3e2797['user']['get']({'plain':!![]});if(!_0x2e8325)throw new Error(_0xb45c('0x47'));if(_0x2e8325[_0xb45c('0x48')]===_0xb45c('0x49')){var _0x1e7136=_0x5d0030['get']({'plain':!![]});var _0x31c0c8='Tags';return db['UserProfileSection'][_0xb45c('0x44')]({'where':{'name':_0x31c0c8,'userProfileId':_0x2e8325[_0xb45c('0x4a')]},'raw':!![]})[_0xb45c('0x23')](function(_0x3fea4d){if(_0x3fea4d&&_0x3fea4d[_0xb45c('0x4b')]===0x0){return db[_0xb45c('0x4c')][_0xb45c('0x45')]({'name':_0x1e7136[_0xb45c('0x27')],'resourceId':_0x1e7136['id'],'type':_0x3fea4d['name'],'sectionId':_0x3fea4d['id']},{})[_0xb45c('0x23')](function(){return _0x5d0030;});}else{return _0x5d0030;}})['catch'](function(_0x125222){logger[_0xb45c('0x4d')](_0xb45c('0x4e'),_0x125222);throw _0x125222;});}return _0x5d0030;})[_0xb45c('0x23')](respondWithResult(_0x266313,0xc9))[_0xb45c('0x42')](handleError(_0x266313,null));};exports[_0xb45c('0x22')]=function(_0x594f65,_0x3e00ce){if(_0x594f65[_0xb45c('0x46')]['id']){delete _0x594f65[_0xb45c('0x46')]['id'];}return db['Tag']['find']({'where':{'id':_0x594f65[_0xb45c('0x4f')]['id']}})[_0xb45c('0x23')](handleEntityNotFound(_0x3e00ce,null))[_0xb45c('0x23')](saveUpdates(_0x594f65['body'],null))[_0xb45c('0x23')](respondWithResult(_0x3e00ce,null))[_0xb45c('0x42')](handleError(_0x3e00ce,null));};exports['destroy']=function(_0x43a7ad,_0xe6b70d){return db[_0xb45c('0x2a')][_0xb45c('0x44')]({'where':{'id':_0x43a7ad[_0xb45c('0x4f')]['id']}})[_0xb45c('0x23')](handleEntityNotFound(_0xe6b70d,null))['then'](removeEntity(_0xe6b70d,null))['catch'](handleError(_0xe6b70d,null));};exports[_0xb45c('0x50')]=function(_0x2f157f,_0x1432ce){return db[_0xb45c('0x2a')][_0xb45c('0x50')]()['then'](respondWithResult(_0x1432ce,null))['catch'](handleError(_0x1432ce,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 503b90c..5375fa2 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 _0xc3f6=['request-promise','path','rimraf','./tag.attributes','exports','define','tools_tags','lodash','../../config/logger','api','moment','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc3f6,0xdf));var _0x6c3f=function(_0x5cc31e,_0x2e19c4){_0x5cc31e=_0x5cc31e-0x0;var _0x1a0c59=_0xc3f6[_0x5cc31e];return _0x1a0c59;};'use strict';var _=require(_0x6c3f('0x0'));var util=require('util');var logger=require(_0x6c3f('0x1'))(_0x6c3f('0x2'));var moment=require(_0x6c3f('0x3'));var BPromise=require(_0x6c3f('0x4'));var rp=require(_0x6c3f('0x5'));var fs=require('fs');var path=require(_0x6c3f('0x6'));var rimraf=require(_0x6c3f('0x7'));var config=require('../../config/environment');var attributes=require(_0x6c3f('0x8'));module[_0x6c3f('0x9')]=function(_0x3e51ee,_0x228782){return _0x3e51ee[_0x6c3f('0xa')]('Tag',attributes,{'tableName':_0x6c3f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13f7=['tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x44fc36,_0x7595c6){var _0x54c8ff=function(_0x2d9d5b){while(--_0x2d9d5b){_0x44fc36['push'](_0x44fc36['shift']());}};_0x54c8ff(++_0x7595c6);}(_0x13f7,0x151));var _0x713f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13f7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x713f('0x0'));var util=require('util');var logger=require(_0x713f('0x1'))(_0x713f('0x2'));var moment=require(_0x713f('0x3'));var BPromise=require(_0x713f('0x4'));var rp=require(_0x713f('0x5'));var fs=require('fs');var path=require(_0x713f('0x6'));var rimraf=require(_0x713f('0x7'));var config=require(_0x713f('0x8'));var attributes=require(_0x713f('0x9'));module[_0x713f('0xa')]=function(_0x5edb62,_0x391700){return _0x5edb62['define']('Tag',attributes,{'tableName':_0x713f('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 1e40c29..332a277 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 _0xb66c=['../../config/environment','jayson/promise','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x22cf82,_0xea2ad2){var _0x393da3=function(_0x6fe877){while(--_0x6fe877){_0x22cf82['push'](_0x22cf82['shift']());}};_0x393da3(++_0xea2ad2);}(_0xb66c,0x175));var _0xcb66=function(_0x3e4cf4,_0x104393){_0x3e4cf4=_0x3e4cf4-0x0;var _0x4fece2=_0xb66c[_0x3e4cf4];return _0x4fece2;};'use strict';var _=require(_0xcb66('0x0'));var util=require('util');var moment=require(_0xcb66('0x1'));var BPromise=require('bluebird');var rs=require(_0xcb66('0x2'));var fs=require('fs');var Redis=require(_0xcb66('0x3'));var db=require(_0xcb66('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb66('0x5'))(_0xcb66('0x6'));var config=require(_0xcb66('0x7'));var jayson=require(_0xcb66('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19adf5,_0x1b6852,_0xa3993){return new BPromise(function(_0x439f3d,_0xf7bc39){return client['request'](_0x19adf5,_0xa3993)[_0xcb66('0x9')](function(_0x3047f7){logger[_0xcb66('0xa')](_0xcb66('0xb'),_0x1b6852,_0xcb66('0xc'));logger['debug'](_0xcb66('0xd'),_0x1b6852,_0xcb66('0xc'),JSON[_0xcb66('0xe')](_0x3047f7));if(_0x3047f7[_0xcb66('0xf')]){if(_0x3047f7['error'][_0xcb66('0x10')]===0x1f4){logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7[_0xcb66('0xf')]['message']);return _0xf7bc39(_0x3047f7[_0xcb66('0xf')][_0xcb66('0x11')]);}logger[_0xcb66('0xf')](_0xcb66('0xb'),_0x1b6852,_0x3047f7['error'][_0xcb66('0x11')]);return _0x439f3d(_0x3047f7['error'][_0xcb66('0x11')]);}else{logger['info'](_0xcb66('0xb'),_0x1b6852,'request\x20sent');_0x439f3d(_0x3047f7['result'][_0xcb66('0x11')]);}})[_0xcb66('0x12')](function(_0x681ce3){logger[_0xcb66('0xf')]('Tag,\x20%s,\x20%s',_0x1b6852,_0x681ce3);_0xf7bc39(_0x681ce3);});});} \ No newline at end of file +var _0xd6d6=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc680ea,_0x24b877){var _0xe88f13=function(_0x1b21c9){while(--_0x1b21c9){_0xc680ea['push'](_0xc680ea['shift']());}};_0xe88f13(++_0x24b877);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xa035b2,_0x4e494a){_0xa035b2=_0xa035b2-0x0;var _0x1e7b45=_0xd6d6[_0xa035b2];return _0x1e7b45;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('Tag,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 6cfa596..fb89510 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 8e8b473..6b8f0e6 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 _0xb7e7=['STRING','sequelize'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xb7e7[_0x9fd887];return _0x1a54ab;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xe706,0xa3));var _0x6e70=function(_0x11262c,_0x20d80b){_0x11262c=_0x11262c-0x0;var _0x23977b=_0xe706[_0x11262c];return _0x23977b;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1061110..a7dd04f 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 _0xbb1e=['capitalize','toLowerCase','ids','removeQueues','addAgents','Voice','Chat','Mail','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','online','voicePause','interface','upsert','format','SIP/%s','all','Queue:remove','UserVoiceQueueRt','removeAgents','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','error','stack','name','send','index','map','Team','rawAttributes','type','key','model','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','query','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','transaction','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','channel','Unknown\x20channel','pick','Queues','findOne','isValidChannel','ValidationError','add'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb1e,0xb4));var _0xebb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1e[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xebb1('0x0'));var rimraf=require(_0xebb1('0x1'));var zipdir=require(_0xebb1('0x2'));var jsonpatch=require(_0xebb1('0x3'));var rp=require('request-promise');var moment=require(_0xebb1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xebb1('0x5'));var util=require(_0xebb1('0x6'));var path=require('path');var sox=require(_0xebb1('0x7'));var csv=require(_0xebb1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebb1('0x9'));var _=require('lodash');var squel=require(_0xebb1('0xa'));var crypto=require(_0xebb1('0xb'));var jsforce=require(_0xebb1('0xc'));var deskjs=require(_0xebb1('0xd'));var toCsv=require(_0xebb1('0x8'));var querystring=require('querystring');var Papa=require(_0xebb1('0xe'));var Redis=require(_0xebb1('0xf'));var authService=require(_0xebb1('0x10'));var qs=require(_0xebb1('0x11'));var as=require(_0xebb1('0x12'));var hardwareService=require(_0xebb1('0x13'));var logger=require(_0xebb1('0x14'))(_0xebb1('0x15'));var utils=require(_0xebb1('0x16'));var config=require(_0xebb1('0x17'));var licenseUtil=require(_0xebb1('0x18'));var db=require('../../mysqldb')['db'];config[_0xebb1('0x19')]=_[_0xebb1('0x1a')](config[_0xebb1('0x19')],{'host':_0xebb1('0x1b'),'port':0x18eb});var socket=require(_0xebb1('0x1c'))(new Redis(config[_0xebb1('0x19')]));require('./team.socket')[_0xebb1('0x1d')](socket);function respondWithStatusCode(_0x5220b5,_0x4f615a){_0x4f615a=_0x4f615a||0xcc;return function(_0x502283){if(_0x502283){return _0x5220b5[_0xebb1('0x1e')](_0x4f615a);}return _0x5220b5[_0xebb1('0x1f')](_0x4f615a)[_0xebb1('0x20')]();};}function respondWithResult(_0x136170,_0x517ade){_0x517ade=_0x517ade||0xc8;return function(_0x56e5bc){if(_0x56e5bc){return _0x136170[_0xebb1('0x1f')](_0x517ade)[_0xebb1('0x21')](_0x56e5bc);}};}function respondWithFilteredResult(_0x31a432,_0x5a964b){return function(_0x2a862e){if(_0x2a862e){var _0x5dc5d1=typeof _0x5a964b[_0xebb1('0x22')]===_0xebb1('0x23')&&typeof _0x5a964b[_0xebb1('0x24')]==='undefined';var _0x1340a1=_0x2a862e[_0xebb1('0x25')];var _0x361f63=_0x5dc5d1?0x0:_0x5a964b['offset'];var _0xd93db7=_0x5dc5d1?_0x2a862e['count']:_0x5a964b[_0xebb1('0x22')]+_0x5a964b[_0xebb1('0x24')];var _0x4a16b9;if(_0xd93db7>=_0x1340a1){_0xd93db7=_0x1340a1;_0x4a16b9=0xc8;}else{_0x4a16b9=0xce;}_0x31a432['status'](_0x4a16b9);return _0x31a432[_0xebb1('0x26')](_0xebb1('0x27'),_0x361f63+'-'+_0xd93db7+'/'+_0x1340a1)[_0xebb1('0x21')](_0x2a862e);}return null;};}function patchUpdates(_0x2bc8df){return function(_0x4e9093){try{jsonpatch['apply'](_0x4e9093,_0x2bc8df,!![]);}catch(_0x3414c4){return BPromise[_0xebb1('0x28')](_0x3414c4);}return _0x4e9093[_0xebb1('0x29')]();};}function saveUpdates(_0xfbfa7d,_0x58c095){return function(_0x26556f){if(_0x26556f){return _0x26556f[_0xebb1('0x2a')](_0xfbfa7d)['then'](function(_0x2f96d0){return _0x2f96d0;});}return null;};}function handleEntityNotFound(_0x26b2ce,_0x2a75e3){return function(_0x379b76){if(!_0x379b76){_0x26b2ce[_0xebb1('0x1e')](0x194);}return _0x379b76;};}function handleError(_0x20aea6,_0x537326){_0x537326=_0x537326||0x1f4;return function(_0x1f940f){logger[_0xebb1('0x2b')](_0x1f940f[_0xebb1('0x2c')]);if(_0x1f940f['name']){delete _0x1f940f[_0xebb1('0x2d')];}_0x20aea6[_0xebb1('0x1f')](_0x537326)[_0xebb1('0x2e')](_0x1f940f);};}exports[_0xebb1('0x2f')]=function(_0x566e14,_0x1fd923){var _0x1aaec3={},_0x561b30={},_0x1d0f9b={'count':0x0,'rows':[]};var _0x4799a9=_[_0xebb1('0x30')](db[_0xebb1('0x31')][_0xebb1('0x32')],function(_0x475625){return{'name':_0x475625['fieldName'],'type':_0x475625[_0xebb1('0x33')][_0xebb1('0x34')]};});_0x561b30[_0xebb1('0x35')]=_[_0xebb1('0x30')](_0x4799a9,'name');_0x561b30['query']=_[_0xebb1('0x36')](_0x566e14['query']);_0x561b30['filters']=_[_0xebb1('0x37')](_0x561b30['model'],_0x561b30['query']);_0x1aaec3[_0xebb1('0x38')]=_[_0xebb1('0x37')](_0x561b30[_0xebb1('0x35')],qs['fields'](_0x566e14['query'][_0xebb1('0x39')]));_0x1aaec3[_0xebb1('0x38')]=_0x1aaec3['attributes'][_0xebb1('0x3a')]?_0x1aaec3[_0xebb1('0x38')]:_0x561b30[_0xebb1('0x35')];if(!_0x566e14['query'][_0xebb1('0x3b')](_0xebb1('0x3c'))){_0x1aaec3[_0xebb1('0x24')]=qs[_0xebb1('0x24')](_0x566e14[_0xebb1('0x3d')][_0xebb1('0x24')]);_0x1aaec3['offset']=qs[_0xebb1('0x22')](_0x566e14[_0xebb1('0x3d')][_0xebb1('0x22')]);}_0x1aaec3[_0xebb1('0x3e')]=qs[_0xebb1('0x3f')](_0x566e14[_0xebb1('0x3d')][_0xebb1('0x3f')]);_0x1aaec3[_0xebb1('0x40')]=qs['filters'](_['pick'](_0x566e14['query'],_0x561b30[_0xebb1('0x41')]),_0x4799a9);if(_0x566e14[_0xebb1('0x3d')][_0xebb1('0x42')]){_0x1aaec3['where']=_[_0xebb1('0x43')](_0x1aaec3['where'],{'$or':_['map'](_0x4799a9,function(_0x49d5a0){if(_0x49d5a0[_0xebb1('0x33')]!==_0xebb1('0x44')){var _0x3b1325={};_0x3b1325[_0x49d5a0[_0xebb1('0x2d')]]={'$like':'%'+_0x566e14['query'][_0xebb1('0x42')]+'%'};return _0x3b1325;}})});}_0x1aaec3=_[_0xebb1('0x43')]({},_0x1aaec3,_0x566e14[_0xebb1('0x45')]);var _0x100689={'where':_0x1aaec3[_0xebb1('0x40')]};return db['Team'][_0xebb1('0x25')](_0x100689)[_0xebb1('0x46')](function(_0x31e54d){_0x1d0f9b['count']=_0x31e54d;if(_0x566e14['query'][_0xebb1('0x47')]){_0x1aaec3['include']=[{'all':!![]}];}return db[_0xebb1('0x31')][_0xebb1('0x48')](_0x1aaec3);})[_0xebb1('0x46')](function(_0x290083){_0x1d0f9b['rows']=_0x290083;return _0x1d0f9b;})['then'](respondWithFilteredResult(_0x1fd923,_0x1aaec3))[_0xebb1('0x49')](handleError(_0x1fd923,null));};exports[_0xebb1('0x4a')]=function(_0x5ab1d7,_0x4ec1df){var _0x4e2c39={'raw':![],'where':{'id':_0x5ab1d7[_0xebb1('0x4b')]['id']}},_0x531732={};_0x531732[_0xebb1('0x35')]=_[_0xebb1('0x36')](db[_0xebb1('0x31')]['rawAttributes']);_0x531732[_0xebb1('0x3d')]=_[_0xebb1('0x36')](_0x5ab1d7[_0xebb1('0x3d')]);_0x531732[_0xebb1('0x41')]=_['intersection'](_0x531732[_0xebb1('0x35')],_0x531732['query']);_0x4e2c39[_0xebb1('0x38')]=_[_0xebb1('0x37')](_0x531732[_0xebb1('0x35')],qs[_0xebb1('0x39')](_0x5ab1d7[_0xebb1('0x3d')]['fields']));_0x4e2c39['attributes']=_0x4e2c39['attributes'][_0xebb1('0x3a')]?_0x4e2c39[_0xebb1('0x38')]:_0x531732[_0xebb1('0x35')];if(_0x5ab1d7[_0xebb1('0x3d')]['includeAll']){_0x4e2c39[_0xebb1('0x4c')]=[{'all':!![]}];}_0x4e2c39=_['merge']({},_0x4e2c39,_0x5ab1d7['options']);return db[_0xebb1('0x31')][_0xebb1('0x4d')](_0x4e2c39)[_0xebb1('0x46')](handleEntityNotFound(_0x4ec1df,null))['then'](respondWithResult(_0x4ec1df,null))['catch'](handleError(_0x4ec1df,null));};exports[_0xebb1('0x4e')]=function(_0x36bf7d,_0x17c2b9){return db[_0xebb1('0x31')]['create'](_0x36bf7d[_0xebb1('0x4f')],{})[_0xebb1('0x46')](function(_0xb4e717){var _0x40198e=_0x36bf7d[_0xebb1('0x50')]['get']({'plain':!![]});if(!_0x40198e)throw new Error(_0xebb1('0x51'));if(_0x40198e[_0xebb1('0x52')]===_0xebb1('0x50')){var _0x5d570b=_0xb4e717[_0xebb1('0x53')]({'plain':!![]});var _0x282224=_0xebb1('0x54');return db[_0xebb1('0x55')][_0xebb1('0x4d')]({'where':{'name':_0x282224,'userProfileId':_0x40198e[_0xebb1('0x56')]},'raw':!![]})[_0xebb1('0x46')](function(_0x450699){if(_0x450699&&_0x450699[_0xebb1('0x57')]===0x0){return db[_0xebb1('0x58')]['create']({'name':_0x5d570b[_0xebb1('0x2d')],'resourceId':_0x5d570b['id'],'type':_0x450699[_0xebb1('0x2d')],'sectionId':_0x450699['id']},{})[_0xebb1('0x46')](function(){return _0xb4e717;});}else{return _0xb4e717;}})[_0xebb1('0x49')](function(_0x15c44c){logger[_0xebb1('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15c44c);throw _0x15c44c;});}return _0xb4e717;})[_0xebb1('0x46')](respondWithResult(_0x17c2b9,0xc9))['catch'](handleError(_0x17c2b9,null));};exports[_0xebb1('0x2a')]=function(_0x23af72,_0x56ba9a){if(_0x23af72[_0xebb1('0x4f')]['id']){delete _0x23af72['body']['id'];}return db[_0xebb1('0x31')]['find']({'where':{'id':_0x23af72[_0xebb1('0x4b')]['id']}})[_0xebb1('0x46')](handleEntityNotFound(_0x56ba9a,null))[_0xebb1('0x46')](saveUpdates(_0x23af72[_0xebb1('0x4f')],null))[_0xebb1('0x46')](respondWithResult(_0x56ba9a,null))['catch'](handleError(_0x56ba9a,null));};exports[_0xebb1('0x59')]=function(_0x31cda3,_0x1b8ae3){var _0xf45a3f=_0x31cda3[_0xebb1('0x4b')]['id'];var _0x599554=[];return db[_0xebb1('0x5a')][_0xebb1('0x5b')](function(_0x2e90a7){var _0x53bd88='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0xf45a3f;return db['sequelize']['query'](_0x53bd88,{'type':db['Sequelize']['QueryTypes'][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7})[_0xebb1('0x46')](function(_0x9cdd71){_0x599554=_[_0xebb1('0x30')](_0x9cdd71,function(_0x558b0b){return Number(_0x558b0b[_0xebb1('0x5d')]);});})[_0xebb1('0x46')](function(){var _0x246c0e=_0xebb1('0x5e')+_0xf45a3f;return db['sequelize'][_0xebb1('0x3d')](_0x246c0e,{'type':db[_0xebb1('0x5f')][_0xebb1('0x60')][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(_0x187ded){var _0x36c97f=_[_0xebb1('0x30')](_0x187ded,function(_0xf3ddf){return Number(_0xf3ddf[_0xebb1('0x61')]);});return db[_0xebb1('0x62')]['destroy']({'where':{'UserId':{'$in':_0x599554},'VoiceQueueId':{'$in':_0x36c97f}},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){var _0x2ae363=_0xebb1('0x63')+_0xf45a3f;return db['sequelize'][_0xebb1('0x3d')](_0x2ae363,{'type':db['Sequelize']['QueryTypes'][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(_0x1ffcf0){var _0x535f84=_[_0xebb1('0x30')](_0x1ffcf0,function(_0x2c83f6){return Number(_0x2c83f6['MailQueueId']);});return db[_0xebb1('0x64')][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'MailQueueId':{'$in':_0x535f84}},'transaction':_0x2e90a7});})['then'](function(){var _0x1c050e=_0xebb1('0x65')+_0xf45a3f;return db[_0xebb1('0x5a')][_0xebb1('0x3d')](_0x1c050e,{'type':db[_0xebb1('0x5f')][_0xebb1('0x60')][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(_0x48f047){var _0x22f4ee=_[_0xebb1('0x30')](_0x48f047,function(_0x2187a9){return Number(_0x2187a9[_0xebb1('0x66')]);});return db[_0xebb1('0x67')][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'SmsQueueId':{'$in':_0x22f4ee}},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){var _0x3fcf70=_0xebb1('0x68')+_0xf45a3f;return db[_0xebb1('0x5a')][_0xebb1('0x3d')](_0x3fcf70,{'type':db[_0xebb1('0x5f')][_0xebb1('0x60')]['SELECT'],'raw':!![],'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(_0xa342cb){var _0x9f1ae=_[_0xebb1('0x30')](_0xa342cb,function(_0x2e038e){return Number(_0x2e038e['ChatQueueId']);});return db[_0xebb1('0x69')][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'ChatQueueId':{'$in':_0x9f1ae}},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){var _0x2f1a9a='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0xf45a3f;return db[_0xebb1('0x5a')][_0xebb1('0x3d')](_0x2f1a9a,{'type':db[_0xebb1('0x5f')][_0xebb1('0x60')][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(_0x122b14){var _0x4e04c5=_[_0xebb1('0x30')](_0x122b14,function(_0x453447){return Number(_0x453447[_0xebb1('0x6a')]);});return db[_0xebb1('0x6b')][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'FaxQueueId':{'$in':_0x4e04c5}},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){var _0x3bcd95='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xf45a3f;return db['sequelize'][_0xebb1('0x3d')](_0x3bcd95,{'type':db[_0xebb1('0x5f')][_0xebb1('0x60')][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7});})['then'](function(_0x116303){var _0x213463=_[_0xebb1('0x30')](_0x116303,function(_0x270640){return Number(_0x270640[_0xebb1('0x6c')]);});return db['UserOpenchannelQueue'][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'OpenchannelQueueId':{'$in':_0x213463}},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){var _0x5a9578='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xf45a3f;return db[_0xebb1('0x5a')][_0xebb1('0x3d')](_0x5a9578,{'type':db[_0xebb1('0x5f')]['QueryTypes'][_0xebb1('0x5c')],'raw':!![],'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(_0x452c04){var _0x419399=_[_0xebb1('0x30')](_0x452c04,function(_0x35267f){return Number(_0x35267f[_0xebb1('0x6d')]);});return db['UserWhatsappQueue'][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'WhatsappQueueId':{'$in':_0x419399}},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){return db[_0xebb1('0x6e')]['find']({'where':{'TeamId':_0xf45a3f}});})['then'](function(_0x2cc3ca){if(_0x2cc3ca===null){return;}return db[_0xebb1('0x6f')][_0xebb1('0x59')]({'where':{'UserId':{'$in':_0x599554},'VoicePrefixId':_0x2cc3ca[_0xebb1('0x70')]},'transaction':_0x2e90a7});})[_0xebb1('0x46')](function(){return db['Team']['destroy']({'where':{'id':_0xf45a3f},'cascade':!![],'transaction':_0x2e90a7});})['then'](function(_0x141f84){if(_0x141f84===0x0){_0x1b8ae3[_0xebb1('0x1e')](0x194);}else{return db[_0xebb1('0x58')][_0xebb1('0x59')]({'where':{'type':'Teams','resourceId':_0xf45a3f},'cascade':!![],'transaction':_0x2e90a7})[_0xebb1('0x46')](function(){_0x1b8ae3[_0xebb1('0x1f')](0xcc)[_0xebb1('0x20')]();});}})[_0xebb1('0x49')](function(_0x56d399){_0x1b8ae3[_0xebb1('0x1f')](0x1f4)['send'](_0x56d399);});});};exports[_0xebb1('0x71')]=function(_0x59fd17,_0x1b0c99,_0xbe983c){return db[_0xebb1('0x31')]['findOne']({'where':{'id':_0x59fd17[_0xebb1('0x4b')]['id']}})[_0xebb1('0x46')](handleEntityNotFound(_0x1b0c99,null))[_0xebb1('0x46')](function(_0x335587){if(!_0x59fd17[_0xebb1('0x3d')][_0xebb1('0x72')]||!utils['isValidChannel'](_0x59fd17[_0xebb1('0x3d')][_0xebb1('0x72')])){throw new db[(_0xebb1('0x5f'))]['ValidationError'](_0xebb1('0x73'));}var _0x421e01={};var _0x3e6a98={};_0x3e6a98[_0xebb1('0x35')]=_['keys'](db[_['capitalize'](_0x59fd17['query'][_0xebb1('0x72')]['toLowerCase']())+'Queue'][_0xebb1('0x32')]);_0x3e6a98[_0xebb1('0x3d')]=_[_0xebb1('0x36')](_0x59fd17[_0xebb1('0x3d')]);_0x3e6a98['filters']=_[_0xebb1('0x37')](_0x3e6a98[_0xebb1('0x35')],_0x3e6a98[_0xebb1('0x3d')]);_0x421e01[_0xebb1('0x38')]=_[_0xebb1('0x37')](_0x3e6a98[_0xebb1('0x35')],qs[_0xebb1('0x39')](_0x59fd17['query'][_0xebb1('0x39')]));_0x421e01[_0xebb1('0x38')]=_0x421e01['attributes'][_0xebb1('0x3a')]?_0x421e01[_0xebb1('0x38')]:_0x3e6a98[_0xebb1('0x35')];_0x421e01[_0xebb1('0x24')]=qs[_0xebb1('0x24')](_0x59fd17[_0xebb1('0x3d')]['limit']);_0x421e01[_0xebb1('0x22')]=qs['offset'](_0x59fd17[_0xebb1('0x3d')][_0xebb1('0x22')]);_0x421e01[_0xebb1('0x3e')]=qs[_0xebb1('0x3f')](_0x59fd17[_0xebb1('0x3d')]['sort']);_0x421e01[_0xebb1('0x40')]=qs['filters'](_[_0xebb1('0x74')](_0x59fd17[_0xebb1('0x3d')],_0x3e6a98['filters']));_0x421e01=_[_0xebb1('0x43')]({},_0x421e01,_0x59fd17[_0xebb1('0x45')]);return _0x335587[_0xebb1('0x53')+_['capitalize'](_0x59fd17[_0xebb1('0x3d')][_0xebb1('0x72')]['toLowerCase']())+_0xebb1('0x75')](_0x421e01);})[_0xebb1('0x46')](respondWithResult(_0x1b0c99,null))[_0xebb1('0x49')](handleError(_0x1b0c99,null));};exports['addQueues']=function(_0x4ed9c9,_0x4b517b,_0xe26ac2){return db['Team'][_0xebb1('0x76')]({'where':{'id':_0x4ed9c9[_0xebb1('0x4b')]['id']}})['then'](function(_0x1a6272){if(_0x1a6272){if(!_0x4ed9c9[_0xebb1('0x4f')][_0xebb1('0x72')]||!utils[_0xebb1('0x77')](_0x4ed9c9[_0xebb1('0x4f')][_0xebb1('0x72')])){throw new db[(_0xebb1('0x5f'))][(_0xebb1('0x78'))](_0xebb1('0x73'));}return _0x1a6272[_0xebb1('0x79')+_[_0xebb1('0x7a')](_0x4ed9c9[_0xebb1('0x4f')]['channel'][_0xebb1('0x7b')]())+_0xebb1('0x75')](_0x4ed9c9[_0xebb1('0x4f')][_0xebb1('0x7c')]);}return null;})[_0xebb1('0x46')](handleEntityNotFound(_0x4b517b,null))[_0xebb1('0x46')](respondWithStatusCode(_0x4b517b,null))[_0xebb1('0x49')](handleError(_0x4b517b,null));};exports[_0xebb1('0x7d')]=function(_0x1e5ad7,_0x1b4cc9,_0x46e3c1){return db['Team'][_0xebb1('0x76')]({'where':{'id':_0x1e5ad7['params']['id']}})[_0xebb1('0x46')](function(_0x3fbf4c){if(_0x3fbf4c){if(!_0x1e5ad7['query'][_0xebb1('0x72')]||!utils[_0xebb1('0x77')](_0x1e5ad7['query'][_0xebb1('0x72')])){throw new db[(_0xebb1('0x5f'))][(_0xebb1('0x78'))](_0xebb1('0x73'));}return _0x3fbf4c['remove'+_[_0xebb1('0x7a')](_0x1e5ad7[_0xebb1('0x3d')]['channel'][_0xebb1('0x7b')]())+_0xebb1('0x75')](_0x1e5ad7['query'][_0xebb1('0x7c')]);}return null;})[_0xebb1('0x46')](handleEntityNotFound(_0x1b4cc9,null))[_0xebb1('0x46')](respondWithStatusCode(_0x1b4cc9,null))[_0xebb1('0x49')](handleError(_0x1b4cc9,null));};exports[_0xebb1('0x7e')]=function(_0x48a3d2,_0x990650){var _0x183fc0=_['isArray'](_0x48a3d2[_0xebb1('0x4f')]['ids'])?_0x48a3d2['body'][_0xebb1('0x7c')]:[_0x48a3d2[_0xebb1('0x4f')][_0xebb1('0x7c')]];var _0x4272ed=_0x48a3d2[_0xebb1('0x4b')]['id'];return db[_0xebb1('0x31')][_0xebb1('0x4d')]({'where':{'id':_0x4272ed}})['then'](handleEntityNotFound(_0x990650,null))['then'](function(_0x3869f6){if(_0x3869f6){var _0x31bcfd=[_0xebb1('0x7f'),_0xebb1('0x80'),_0xebb1('0x81'),'Sms',_0xebb1('0x82'),_0xebb1('0x83'),_0xebb1('0x84')];return db[_0xebb1('0x5a')][_0xebb1('0x5b')](function(_0x18a00d){var _0x5aac9b=_[_0xebb1('0x30')](_0x31bcfd,function(_0xc25cea){var _0x15f909={'attributes':['id',_0xebb1('0x2d')]};if(_0xc25cea===_0xebb1('0x7f')){_0x15f909[_0xebb1('0x85')]={'attributes':['penalty']};}return _0x3869f6['get'+_0xc25cea+_0xebb1('0x75')](_0x15f909)[_0xebb1('0x46')](function(_0x585b68){var _0x5093f7=_['map'](_0x585b68,function(_0x27a2b8){var _0x4f79a9=_[_0xebb1('0x30')](_0x183fc0,function(_0x2bebcd){var _0x169841={'where':{'UserId':_0x2bebcd,[_0xc25cea+_0xebb1('0x86')]:_0x27a2b8['id']},'transaction':_0x18a00d};if(_0xc25cea==='Voice'){_0x169841[_0xebb1('0x1a')]={'penalty':_0x27a2b8[_0xebb1('0x87')][_0xebb1('0x88')]};}return db[_0xebb1('0x89')+_0xc25cea+'Queue'][_0xebb1('0x8a')](_0x169841)[_0xebb1('0x46')](function(){socket['emit'](_0xebb1('0x50')+_0xc25cea+_0xebb1('0x8b'),{'UserId':_0x2bebcd,[_0xc25cea+_0xebb1('0x86')]:_0x27a2b8['id']});if(_0xc25cea!==_0xebb1('0x7f')){return;}return db[_0xebb1('0x89')][_0xebb1('0x48')]({'where':{'id':_0x183fc0,'online':0x1},'attributes':['id',_0xebb1('0x2d'),_0xebb1('0x8c'),_0xebb1('0x8d'),_0xebb1('0x8e')],'raw':!![]})[_0xebb1('0x46')](function(_0x16b21a){var _0x19907d=_[_0xebb1('0x30')](_0x16b21a,function(_0x52be1d){return db['UserVoiceQueueRt'][_0xebb1('0x8f')]({'membername':_0x52be1d[_0xebb1('0x2d')],'UserId':_0x52be1d['id'],'queue_name':_0x27a2b8[_0xebb1('0x2d')],'VoiceQueueId':_0x27a2b8['id'],'interface':_['isNil'](_0x52be1d[_0xebb1('0x8e')])?util[_0xebb1('0x90')](_0xebb1('0x91'),_0x52be1d[_0xebb1('0x2d')]):_0x52be1d[_0xebb1('0x8e')],'paused':_0x52be1d[_0xebb1('0x8d')]||![],'penalty':_0x27a2b8['TeamVoiceQueue'][_0xebb1('0x88')]},{'transaction':_0x18a00d});});return Promise[_0xebb1('0x92')](_0x19907d);});});});return Promise[_0xebb1('0x92')](_0x4f79a9);});return Promise['all'](_0x5093f7);})[_0xebb1('0x46')](function(){return db['TeamVoicePrefix'][_0xebb1('0x76')]({'where':{'teamId':_0x4272ed}})[_0xebb1('0x46')](function(_0x5904af){if(_0x5904af){var _0xbbc3e1=_[_0xebb1('0x30')](_0x183fc0,function(_0x23cbd4){db[_0xebb1('0x6f')][_0xebb1('0x8f')]({'UserId':_0x23cbd4,'VoicePrefixId':_0x5904af[_0xebb1('0x70')]});});return Promise[_0xebb1('0x92')](_0xbbc3e1);}});});});return Promise[_0xebb1('0x92')](_0x5aac9b)[_0xebb1('0x46')](function(){return _0x3869f6[_0xebb1('0x7e')](_0x183fc0,{'transaction':_0x18a00d})['spread'](function(_0x3e55e5){return _0x3e55e5;});});});}})[_0xebb1('0x46')](respondWithResult(_0x990650,null))[_0xebb1('0x49')](handleError(_0x990650,null));};exports['removeAgents']=function(_0x5ac882,_0x2f6172){var _0x1dec70=_['isArray'](_0x5ac882[_0xebb1('0x3d')]['ids'])?_0x5ac882[_0xebb1('0x3d')]['ids']:[_0x5ac882[_0xebb1('0x3d')][_0xebb1('0x7c')]];var _0x3a24f2=_0x5ac882[_0xebb1('0x4b')]['id'];return db[_0xebb1('0x31')][_0xebb1('0x4d')]({'where':{'id':_0x3a24f2}})[_0xebb1('0x46')](handleEntityNotFound(_0x2f6172,null))[_0xebb1('0x46')](function(_0xcb0eb3){if(_0xcb0eb3){var _0x1ce1df=['Voice',_0xebb1('0x80'),'Mail','Sms','Fax',_0xebb1('0x83'),_0xebb1('0x84')];return db[_0xebb1('0x5a')][_0xebb1('0x5b')](function(_0x4051dc){var _0x26cf2e=_[_0xebb1('0x30')](_0x1ce1df,function(_0x474ba5){var _0x4bdd33={'attributes':['id',_0xebb1('0x2d')]};return _0xcb0eb3[_0xebb1('0x53')+_0x474ba5+_0xebb1('0x75')](_0x4bdd33)[_0xebb1('0x46')](function(_0x7ca0d7){var _0x3f5605=_[_0xebb1('0x30')](_0x7ca0d7,function(_0x539b9d){return _0x539b9d['removeAgents'](_0x1dec70,{'transaction':_0x4051dc})['then'](function(){var _0x2deb08=_[_0xebb1('0x30')](_0x1dec70,function(_0x3ecc6f){socket['emit'](_0xebb1('0x50')+_0x474ba5+_0xebb1('0x93'),{'UserId':Number(_0x3ecc6f),[_0x474ba5+_0xebb1('0x86')]:_0x539b9d['id']});if(_0x474ba5!=='Voice'){return;}return db[_0xebb1('0x94')]['destroy']({'where':{'VoiceQueueId':_0x539b9d['id'],'UserId':_0x3ecc6f},'transaction':_0x4051dc});});return Promise[_0xebb1('0x92')](_0x2deb08);});});return Promise['all'](_0x3f5605);});});return Promise[_0xebb1('0x92')](_0x26cf2e)[_0xebb1('0x46')](function(){return _0xcb0eb3[_0xebb1('0x95')](_0x1dec70,{'transaction':_0x4051dc});})[_0xebb1('0x46')](function(){return db[_0xebb1('0x6e')]['findOne']({'where':{'teamId':_0x3a24f2}})[_0xebb1('0x46')](function(_0x411fad){if(_0x411fad){var _0x4b12bc=_[_0xebb1('0x30')](_0x1dec70,function(_0x4e4cb5){db[_0xebb1('0x6f')]['destroy']({'where':{'UserId':_0x4e4cb5,'VoicePrefixId':_0x411fad[_0xebb1('0x70')]}});});return Promise['all'](_0x4b12bc);}});});});}})[_0xebb1('0x46')](respondWithStatusCode(_0x2f6172,null))[_0xebb1('0x49')](handleError(_0x2f6172,null));};exports[_0xebb1('0x96')]=function(_0x5c3030,_0x4c39b1,_0x4e52f0){var _0x2cc803={};var _0xb3ef37={};var _0x52366f;var _0x5cd548;return db[_0xebb1('0x31')]['findOne']({'where':{'id':_0x5c3030['params']['id']}})['then'](handleEntityNotFound(_0x4c39b1,null))[_0xebb1('0x46')](function(_0x1265a9){if(_0x1265a9){_0x52366f=_0x1265a9;_0xb3ef37[_0xebb1('0x35')]=_[_0xebb1('0x36')](db[_0xebb1('0x89')]['rawAttributes']);_0xb3ef37['query']=_[_0xebb1('0x36')](_0x5c3030['query']);_0xb3ef37['filters']=_['intersection'](_0xb3ef37[_0xebb1('0x35')],_0xb3ef37[_0xebb1('0x3d')]);_0x2cc803[_0xebb1('0x38')]=_[_0xebb1('0x37')](_0xb3ef37['model'],qs[_0xebb1('0x39')](_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x39')]));_0x2cc803[_0xebb1('0x38')]=_0x2cc803[_0xebb1('0x38')][_0xebb1('0x3a')]?_0x2cc803[_0xebb1('0x38')]:_0xb3ef37[_0xebb1('0x35')];_0x2cc803[_0xebb1('0x3e')]=qs[_0xebb1('0x3f')](_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x3f')]);_0x2cc803[_0xebb1('0x40')]=qs[_0xebb1('0x41')](_['pick'](_0x5c3030['query'],_0xb3ef37[_0xebb1('0x41')]));if(_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x42')]){_0x2cc803[_0xebb1('0x40')]=_[_0xebb1('0x43')](_0x2cc803['where'],{'$or':_[_0xebb1('0x30')](_0x2cc803[_0xebb1('0x38')],function(_0x24b454){var _0x45916e={};_0x45916e[_0x24b454]={'$like':'%'+_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x42')]+'%'};return _0x45916e;})});}_0x2cc803=_[_0xebb1('0x43')]({},_0x2cc803,_0x5c3030[_0xebb1('0x45')]);return _0x52366f[_0xebb1('0x96')](_0x2cc803);}})[_0xebb1('0x46')](function(_0x3ccf69){if(_0x3ccf69){_0x5cd548=_0x3ccf69['length'];if(!_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x3b')](_0xebb1('0x3c'))){_0x2cc803[_0xebb1('0x24')]=qs['limit'](_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x24')]);_0x2cc803[_0xebb1('0x22')]=qs['offset'](_0x5c3030[_0xebb1('0x3d')][_0xebb1('0x22')]);}return _0x52366f[_0xebb1('0x96')](_0x2cc803);}})[_0xebb1('0x46')](function(_0x5adcfb){if(_0x5adcfb){return _0x5adcfb?{'count':_0x5cd548,'rows':_0x5adcfb}:null;}})[_0xebb1('0x46')](respondWithResult(_0x4c39b1,null))[_0xebb1('0x49')](handleError(_0x4c39b1,null));}; \ No newline at end of file +var _0x7663=['findOne','channel','Queue','capitalize','toLowerCase','Queues','addQueues','isValidChannel','ValidationError','Unknown\x20channel','ids','remove','isArray','Voice','Chat','Mail','Sms','Openchannel','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','addAgents','spread','removeAgents','Fax','Whatsapp','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','find','create','body','user','get','role','Teams','UserProfileSection','userProfileId','error','destroy','params','sequelize','transaction','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','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','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','sendStatus','UserProfileResource'];(function(_0x45ff81,_0x3cb624){var _0x1abf39=function(_0x118836){while(--_0x118836){_0x45ff81['push'](_0x45ff81['shift']());}};_0x1abf39(++_0x3cb624);}(_0x7663,0x156));var _0x3766=function(_0x5066ac,_0x4d28b1){_0x5066ac=_0x5066ac-0x0;var _0x1bc8d9=_0x7663[_0x5066ac];return _0x1bc8d9;};'use strict';var emlformat=require(_0x3766('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3766('0x1'));var jsonpatch=require(_0x3766('0x2'));var rp=require('request-promise');var moment=require(_0x3766('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3766('0x4'));var util=require('util');var path=require(_0x3766('0x5'));var sox=require(_0x3766('0x6'));var csv=require('to-csv');var ejs=require(_0x3766('0x7'));var fs=require('fs');var fs_extra=require(_0x3766('0x8'));var _=require(_0x3766('0x9'));var squel=require(_0x3766('0xa'));var crypto=require(_0x3766('0xb'));var jsforce=require(_0x3766('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3766('0xd'));var Redis=require(_0x3766('0xe'));var authService=require(_0x3766('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3766('0x10'));var hardwareService=require(_0x3766('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3766('0x12'));var config=require(_0x3766('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3766('0x14'))['db'];config[_0x3766('0x15')]=_[_0x3766('0x16')](config[_0x3766('0x15')],{'host':_0x3766('0x17'),'port':0x18eb});var socket=require(_0x3766('0x18'))(new Redis(config[_0x3766('0x15')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x4678cc,_0x40393b){_0x40393b=_0x40393b||0xcc;return function(_0x27360d){if(_0x27360d){return _0x4678cc['sendStatus'](_0x40393b);}return _0x4678cc['status'](_0x40393b)[_0x3766('0x19')]();};}function respondWithResult(_0x355e3e,_0x3add24){_0x3add24=_0x3add24||0xc8;return function(_0x187ffe){if(_0x187ffe){return _0x355e3e[_0x3766('0x1a')](_0x3add24)['json'](_0x187ffe);}};}function respondWithFilteredResult(_0x59a28d,_0x3706a1){return function(_0x51d602){if(_0x51d602){var _0x22ba85=typeof _0x3706a1[_0x3766('0x1b')]===_0x3766('0x1c')&&typeof _0x3706a1[_0x3766('0x1d')]===_0x3766('0x1c');var _0x2e6734=_0x51d602[_0x3766('0x1e')];var _0x59ea8b=_0x22ba85?0x0:_0x3706a1['offset'];var _0x1ab098=_0x22ba85?_0x51d602[_0x3766('0x1e')]:_0x3706a1[_0x3766('0x1b')]+_0x3706a1[_0x3766('0x1d')];var _0x2eecbf;if(_0x1ab098>=_0x2e6734){_0x1ab098=_0x2e6734;_0x2eecbf=0xc8;}else{_0x2eecbf=0xce;}_0x59a28d[_0x3766('0x1a')](_0x2eecbf);return _0x59a28d[_0x3766('0x1f')]('Content-Range',_0x59ea8b+'-'+_0x1ab098+'/'+_0x2e6734)['json'](_0x51d602);}return null;};}function patchUpdates(_0x2c5b11){return function(_0x518c01){try{jsonpatch[_0x3766('0x20')](_0x518c01,_0x2c5b11,!![]);}catch(_0x467ce6){return BPromise[_0x3766('0x21')](_0x467ce6);}return _0x518c01[_0x3766('0x22')]();};}function saveUpdates(_0x2caa9e,_0x567628){return function(_0x2b6920){if(_0x2b6920){return _0x2b6920[_0x3766('0x23')](_0x2caa9e)[_0x3766('0x24')](function(_0x3b7173){return _0x3b7173;});}return null;};}function handleEntityNotFound(_0x4286f4,_0x47bab9){return function(_0x223d16){if(!_0x223d16){_0x4286f4['sendStatus'](0x194);}return _0x223d16;};}function handleError(_0x1bbe05,_0x17424d){_0x17424d=_0x17424d||0x1f4;return function(_0x102ba5){logger['error'](_0x102ba5[_0x3766('0x25')]);if(_0x102ba5['name']){delete _0x102ba5[_0x3766('0x26')];}_0x1bbe05['status'](_0x17424d)[_0x3766('0x27')](_0x102ba5);};}exports[_0x3766('0x28')]=function(_0x5ec500,_0x2a3716){var _0xc0530a={},_0x28f022={},_0xf83131={'count':0x0,'rows':[]};var _0x19e805=_[_0x3766('0x29')](db[_0x3766('0x2a')][_0x3766('0x2b')],function(_0xa64e4b){return{'name':_0xa64e4b[_0x3766('0x2c')],'type':_0xa64e4b[_0x3766('0x2d')]['key']};});_0x28f022[_0x3766('0x2e')]=_[_0x3766('0x29')](_0x19e805,_0x3766('0x26'));_0x28f022[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x5ec500[_0x3766('0x2f')]);_0x28f022[_0x3766('0x31')]=_[_0x3766('0x32')](_0x28f022[_0x3766('0x2e')],_0x28f022[_0x3766('0x2f')]);_0xc0530a[_0x3766('0x33')]=_['intersection'](_0x28f022['model'],qs[_0x3766('0x34')](_0x5ec500[_0x3766('0x2f')][_0x3766('0x34')]));_0xc0530a['attributes']=_0xc0530a['attributes'][_0x3766('0x35')]?_0xc0530a[_0x3766('0x33')]:_0x28f022[_0x3766('0x2e')];if(!_0x5ec500[_0x3766('0x2f')][_0x3766('0x36')](_0x3766('0x37'))){_0xc0530a[_0x3766('0x1d')]=qs[_0x3766('0x1d')](_0x5ec500[_0x3766('0x2f')]['limit']);_0xc0530a[_0x3766('0x1b')]=qs['offset'](_0x5ec500[_0x3766('0x2f')][_0x3766('0x1b')]);}_0xc0530a[_0x3766('0x38')]=qs[_0x3766('0x39')](_0x5ec500[_0x3766('0x2f')][_0x3766('0x39')]);_0xc0530a['where']=qs['filters'](_[_0x3766('0x3a')](_0x5ec500[_0x3766('0x2f')],_0x28f022[_0x3766('0x31')]),_0x19e805);if(_0x5ec500[_0x3766('0x2f')][_0x3766('0x3b')]){_0xc0530a[_0x3766('0x3c')]=_[_0x3766('0x3d')](_0xc0530a[_0x3766('0x3c')],{'$or':_[_0x3766('0x29')](_0x19e805,function(_0x7ceed){if(_0x7ceed[_0x3766('0x2d')]!==_0x3766('0x3e')){var _0x2561ae={};_0x2561ae[_0x7ceed[_0x3766('0x26')]]={'$like':'%'+_0x5ec500[_0x3766('0x2f')][_0x3766('0x3b')]+'%'};return _0x2561ae;}})});}_0xc0530a=_[_0x3766('0x3d')]({},_0xc0530a,_0x5ec500['options']);var _0x2ec186={'where':_0xc0530a[_0x3766('0x3c')]};return db[_0x3766('0x2a')][_0x3766('0x1e')](_0x2ec186)['then'](function(_0x3107db){_0xf83131[_0x3766('0x1e')]=_0x3107db;if(_0x5ec500[_0x3766('0x2f')][_0x3766('0x3f')]){_0xc0530a[_0x3766('0x40')]=[{'all':!![]}];}return db[_0x3766('0x2a')][_0x3766('0x41')](_0xc0530a);})[_0x3766('0x24')](function(_0x7b2dca){_0xf83131[_0x3766('0x42')]=_0x7b2dca;return _0xf83131;})[_0x3766('0x24')](respondWithFilteredResult(_0x2a3716,_0xc0530a))[_0x3766('0x43')](handleError(_0x2a3716,null));};exports['show']=function(_0x4cc5f9,_0x1dec36){var _0x20e4ff={'raw':![],'where':{'id':_0x4cc5f9['params']['id']}},_0x45bc82={};_0x45bc82[_0x3766('0x2e')]=_[_0x3766('0x30')](db['Team'][_0x3766('0x2b')]);_0x45bc82[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x4cc5f9[_0x3766('0x2f')]);_0x45bc82[_0x3766('0x31')]=_['intersection'](_0x45bc82['model'],_0x45bc82[_0x3766('0x2f')]);_0x20e4ff[_0x3766('0x33')]=_[_0x3766('0x32')](_0x45bc82[_0x3766('0x2e')],qs['fields'](_0x4cc5f9[_0x3766('0x2f')][_0x3766('0x34')]));_0x20e4ff[_0x3766('0x33')]=_0x20e4ff[_0x3766('0x33')][_0x3766('0x35')]?_0x20e4ff[_0x3766('0x33')]:_0x45bc82[_0x3766('0x2e')];if(_0x4cc5f9[_0x3766('0x2f')][_0x3766('0x3f')]){_0x20e4ff[_0x3766('0x40')]=[{'all':!![]}];}_0x20e4ff=_[_0x3766('0x3d')]({},_0x20e4ff,_0x4cc5f9[_0x3766('0x44')]);return db[_0x3766('0x2a')][_0x3766('0x45')](_0x20e4ff)[_0x3766('0x24')](handleEntityNotFound(_0x1dec36,null))['then'](respondWithResult(_0x1dec36,null))[_0x3766('0x43')](handleError(_0x1dec36,null));};exports[_0x3766('0x46')]=function(_0x40909d,_0x4decb4){return db['Team'][_0x3766('0x46')](_0x40909d[_0x3766('0x47')],{})[_0x3766('0x24')](function(_0x3fcc4e){var _0x353103=_0x40909d[_0x3766('0x48')][_0x3766('0x49')]({'plain':!![]});if(!_0x353103)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x353103[_0x3766('0x4a')]===_0x3766('0x48')){var _0x4f974b=_0x3fcc4e[_0x3766('0x49')]({'plain':!![]});var _0x2890b1=_0x3766('0x4b');return db[_0x3766('0x4c')]['find']({'where':{'name':_0x2890b1,'userProfileId':_0x353103[_0x3766('0x4d')]},'raw':!![]})['then'](function(_0x3c09e9){if(_0x3c09e9&&_0x3c09e9['autoAssociation']===0x0){return db['UserProfileResource'][_0x3766('0x46')]({'name':_0x4f974b[_0x3766('0x26')],'resourceId':_0x4f974b['id'],'type':_0x3c09e9[_0x3766('0x26')],'sectionId':_0x3c09e9['id']},{})[_0x3766('0x24')](function(){return _0x3fcc4e;});}else{return _0x3fcc4e;}})[_0x3766('0x43')](function(_0x332d79){logger[_0x3766('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x332d79);throw _0x332d79;});}return _0x3fcc4e;})[_0x3766('0x24')](respondWithResult(_0x4decb4,0xc9))['catch'](handleError(_0x4decb4,null));};exports['update']=function(_0x6a0fd2,_0x415c12){if(_0x6a0fd2[_0x3766('0x47')]['id']){delete _0x6a0fd2[_0x3766('0x47')]['id'];}return db['Team']['find']({'where':{'id':_0x6a0fd2['params']['id']}})['then'](handleEntityNotFound(_0x415c12,null))[_0x3766('0x24')](saveUpdates(_0x6a0fd2['body'],null))[_0x3766('0x24')](respondWithResult(_0x415c12,null))['catch'](handleError(_0x415c12,null));};exports[_0x3766('0x4f')]=function(_0x5f5d4c,_0xa87da9){var _0x3de5f1=_0x5f5d4c[_0x3766('0x50')]['id'];var _0x893d37=[];return db[_0x3766('0x51')][_0x3766('0x52')](function(_0x4aa07b){var _0x58fea0='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x3de5f1;return db[_0x3766('0x51')][_0x3766('0x2f')](_0x58fea0,{'type':db[_0x3766('0x53')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4aa07b})[_0x3766('0x24')](function(_0x50c470){_0x893d37=_['map'](_0x50c470,function(_0x177813){return Number(_0x177813[_0x3766('0x54')]);});})[_0x3766('0x24')](function(){var _0x2fc6ae=_0x3766('0x55')+_0x3de5f1;return db[_0x3766('0x51')][_0x3766('0x2f')](_0x2fc6ae,{'type':db['Sequelize'][_0x3766('0x56')][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x496f4f){var _0x581d95=_['map'](_0x496f4f,function(_0x42f542){return Number(_0x42f542[_0x3766('0x58')]);});return db[_0x3766('0x59')]['destroy']({'where':{'UserId':{'$in':_0x893d37},'VoiceQueueId':{'$in':_0x581d95}},'transaction':_0x4aa07b});})[_0x3766('0x24')](function(){var _0x25da72=_0x3766('0x5a')+_0x3de5f1;return db[_0x3766('0x51')][_0x3766('0x2f')](_0x25da72,{'type':db[_0x3766('0x53')]['QueryTypes'][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x14adc4){var _0x57d201=_[_0x3766('0x29')](_0x14adc4,function(_0x4f08c3){return Number(_0x4f08c3[_0x3766('0x5b')]);});return db['UserMailQueue'][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'MailQueueId':{'$in':_0x57d201}},'transaction':_0x4aa07b});})[_0x3766('0x24')](function(){var _0x3ab451=_0x3766('0x5c')+_0x3de5f1;return db['sequelize'][_0x3766('0x2f')](_0x3ab451,{'type':db['Sequelize'][_0x3766('0x56')][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})['then'](function(_0x3c24e2){var _0x1ba5c0=_[_0x3766('0x29')](_0x3c24e2,function(_0x21c522){return Number(_0x21c522[_0x3766('0x5d')]);});return db[_0x3766('0x5e')][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'SmsQueueId':{'$in':_0x1ba5c0}},'transaction':_0x4aa07b});})['then'](function(){var _0x52a26b=_0x3766('0x5f')+_0x3de5f1;return db[_0x3766('0x51')]['query'](_0x52a26b,{'type':db[_0x3766('0x53')][_0x3766('0x56')][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x39c5a3){var _0x128fcf=_[_0x3766('0x29')](_0x39c5a3,function(_0x548c8c){return Number(_0x548c8c[_0x3766('0x60')]);});return db[_0x3766('0x61')][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'ChatQueueId':{'$in':_0x128fcf}},'transaction':_0x4aa07b});})[_0x3766('0x24')](function(){var _0x262a5f='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3de5f1;return db[_0x3766('0x51')][_0x3766('0x2f')](_0x262a5f,{'type':db['Sequelize'][_0x3766('0x56')][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x1ec2a9){var _0x3599a6=_['map'](_0x1ec2a9,function(_0x31268c){return Number(_0x31268c[_0x3766('0x62')]);});return db[_0x3766('0x63')][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'FaxQueueId':{'$in':_0x3599a6}},'transaction':_0x4aa07b});})['then'](function(){var _0x2d6903=_0x3766('0x64')+_0x3de5f1;return db[_0x3766('0x51')][_0x3766('0x2f')](_0x2d6903,{'type':db[_0x3766('0x53')][_0x3766('0x56')][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x3d390f){var _0x185f03=_[_0x3766('0x29')](_0x3d390f,function(_0x17932b){return Number(_0x17932b[_0x3766('0x65')]);});return db['UserOpenchannelQueue'][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'OpenchannelQueueId':{'$in':_0x185f03}},'transaction':_0x4aa07b});})['then'](function(){var _0x244406='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3de5f1;return db['sequelize'][_0x3766('0x2f')](_0x244406,{'type':db[_0x3766('0x53')][_0x3766('0x56')][_0x3766('0x57')],'raw':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x1b4ff7){var _0x1c2c1d=_[_0x3766('0x29')](_0x1b4ff7,function(_0x4a5f75){return Number(_0x4a5f75[_0x3766('0x66')]);});return db['UserWhatsappQueue'][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'WhatsappQueueId':{'$in':_0x1c2c1d}},'transaction':_0x4aa07b});})[_0x3766('0x24')](function(){return db[_0x3766('0x67')][_0x3766('0x45')]({'where':{'TeamId':_0x3de5f1}});})[_0x3766('0x24')](function(_0x1309e7){if(_0x1309e7===null){return;}return db[_0x3766('0x68')][_0x3766('0x4f')]({'where':{'UserId':{'$in':_0x893d37},'VoicePrefixId':_0x1309e7[_0x3766('0x69')]},'transaction':_0x4aa07b});})[_0x3766('0x24')](function(){return db[_0x3766('0x2a')]['destroy']({'where':{'id':_0x3de5f1},'cascade':!![],'transaction':_0x4aa07b});})[_0x3766('0x24')](function(_0x551839){if(_0x551839===0x0){_0xa87da9[_0x3766('0x6a')](0x194);}else{return db[_0x3766('0x6b')][_0x3766('0x4f')]({'where':{'type':_0x3766('0x4b'),'resourceId':_0x3de5f1},'cascade':!![],'transaction':_0x4aa07b})[_0x3766('0x24')](function(){_0xa87da9[_0x3766('0x1a')](0xcc)['end']();});}})[_0x3766('0x43')](function(_0x9dbea){_0xa87da9['status'](0x1f4)['send'](_0x9dbea);});});};exports['getQueues']=function(_0x3d359f,_0x56208d,_0x4ddcae){return db[_0x3766('0x2a')][_0x3766('0x6c')]({'where':{'id':_0x3d359f[_0x3766('0x50')]['id']}})[_0x3766('0x24')](handleEntityNotFound(_0x56208d,null))['then'](function(_0x5a6cca){if(!_0x3d359f[_0x3766('0x2f')][_0x3766('0x6d')]||!utils['isValidChannel'](_0x3d359f[_0x3766('0x2f')][_0x3766('0x6d')])){throw new db[(_0x3766('0x53'))]['ValidationError']('Unknown\x20channel');}var _0x25fd72={};var _0x313f88={};_0x313f88[_0x3766('0x2e')]=_['keys'](db[_['capitalize'](_0x3d359f[_0x3766('0x2f')][_0x3766('0x6d')]['toLowerCase']())+_0x3766('0x6e')][_0x3766('0x2b')]);_0x313f88[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x3d359f[_0x3766('0x2f')]);_0x313f88[_0x3766('0x31')]=_[_0x3766('0x32')](_0x313f88[_0x3766('0x2e')],_0x313f88['query']);_0x25fd72['attributes']=_[_0x3766('0x32')](_0x313f88[_0x3766('0x2e')],qs[_0x3766('0x34')](_0x3d359f[_0x3766('0x2f')][_0x3766('0x34')]));_0x25fd72[_0x3766('0x33')]=_0x25fd72[_0x3766('0x33')]['length']?_0x25fd72[_0x3766('0x33')]:_0x313f88[_0x3766('0x2e')];_0x25fd72[_0x3766('0x1d')]=qs['limit'](_0x3d359f[_0x3766('0x2f')][_0x3766('0x1d')]);_0x25fd72[_0x3766('0x1b')]=qs[_0x3766('0x1b')](_0x3d359f[_0x3766('0x2f')][_0x3766('0x1b')]);_0x25fd72['order']=qs[_0x3766('0x39')](_0x3d359f[_0x3766('0x2f')][_0x3766('0x39')]);_0x25fd72[_0x3766('0x3c')]=qs['filters'](_[_0x3766('0x3a')](_0x3d359f[_0x3766('0x2f')],_0x313f88[_0x3766('0x31')]));_0x25fd72=_['merge']({},_0x25fd72,_0x3d359f[_0x3766('0x44')]);return _0x5a6cca['get'+_[_0x3766('0x6f')](_0x3d359f[_0x3766('0x2f')][_0x3766('0x6d')][_0x3766('0x70')]())+_0x3766('0x71')](_0x25fd72);})[_0x3766('0x24')](respondWithResult(_0x56208d,null))[_0x3766('0x43')](handleError(_0x56208d,null));};exports[_0x3766('0x72')]=function(_0x106c4c,_0x55b9b4,_0x1000c2){return db['Team'][_0x3766('0x6c')]({'where':{'id':_0x106c4c[_0x3766('0x50')]['id']}})[_0x3766('0x24')](function(_0x3eebb1){if(_0x3eebb1){if(!_0x106c4c[_0x3766('0x47')]['channel']||!utils[_0x3766('0x73')](_0x106c4c[_0x3766('0x47')]['channel'])){throw new db[(_0x3766('0x53'))][(_0x3766('0x74'))](_0x3766('0x75'));}return _0x3eebb1['add'+_[_0x3766('0x6f')](_0x106c4c['body']['channel'][_0x3766('0x70')]())+_0x3766('0x71')](_0x106c4c['body'][_0x3766('0x76')]);}return null;})[_0x3766('0x24')](handleEntityNotFound(_0x55b9b4,null))[_0x3766('0x24')](respondWithStatusCode(_0x55b9b4,null))['catch'](handleError(_0x55b9b4,null));};exports['removeQueues']=function(_0x522cf6,_0x207984,_0x3d41b6){return db[_0x3766('0x2a')][_0x3766('0x6c')]({'where':{'id':_0x522cf6[_0x3766('0x50')]['id']}})['then'](function(_0x433611){if(_0x433611){if(!_0x522cf6[_0x3766('0x2f')]['channel']||!utils[_0x3766('0x73')](_0x522cf6['query'][_0x3766('0x6d')])){throw new db['Sequelize'][(_0x3766('0x74'))]('Unknown\x20channel');}return _0x433611[_0x3766('0x77')+_[_0x3766('0x6f')](_0x522cf6[_0x3766('0x2f')][_0x3766('0x6d')][_0x3766('0x70')]())+_0x3766('0x71')](_0x522cf6[_0x3766('0x2f')][_0x3766('0x76')]);}return null;})['then'](handleEntityNotFound(_0x207984,null))['then'](respondWithStatusCode(_0x207984,null))['catch'](handleError(_0x207984,null));};exports['addAgents']=function(_0x129bef,_0x1a140e){var _0x3b0e38=_[_0x3766('0x78')](_0x129bef['body'][_0x3766('0x76')])?_0x129bef[_0x3766('0x47')][_0x3766('0x76')]:[_0x129bef['body'][_0x3766('0x76')]];var _0x119f56=_0x129bef[_0x3766('0x50')]['id'];return db[_0x3766('0x2a')][_0x3766('0x45')]({'where':{'id':_0x119f56}})[_0x3766('0x24')](handleEntityNotFound(_0x1a140e,null))[_0x3766('0x24')](function(_0x4eb32c){if(_0x4eb32c){var _0x39d6e9=[_0x3766('0x79'),_0x3766('0x7a'),_0x3766('0x7b'),_0x3766('0x7c'),'Fax',_0x3766('0x7d'),'Whatsapp'];return db[_0x3766('0x51')][_0x3766('0x52')](function(_0x5f459f){var _0x113761=_[_0x3766('0x29')](_0x39d6e9,function(_0x3ba4f0){var _0x32c74c={'attributes':['id',_0x3766('0x26')]};if(_0x3ba4f0===_0x3766('0x79')){_0x32c74c[_0x3766('0x7e')]={'attributes':[_0x3766('0x7f')]};}return _0x4eb32c[_0x3766('0x49')+_0x3ba4f0+_0x3766('0x71')](_0x32c74c)[_0x3766('0x24')](function(_0x3fa39e){var _0xde6e4=_[_0x3766('0x29')](_0x3fa39e,function(_0xeaa393){var _0x520157=_[_0x3766('0x29')](_0x3b0e38,function(_0x4c93a7){var _0x166466={'where':{'UserId':_0x4c93a7,[_0x3ba4f0+_0x3766('0x80')]:_0xeaa393['id']},'transaction':_0x5f459f};if(_0x3ba4f0===_0x3766('0x79')){_0x166466[_0x3766('0x16')]={'penalty':_0xeaa393[_0x3766('0x81')][_0x3766('0x7f')]};}return db[_0x3766('0x82')+_0x3ba4f0+'Queue'][_0x3766('0x83')](_0x166466)[_0x3766('0x24')](function(){socket[_0x3766('0x84')](_0x3766('0x48')+_0x3ba4f0+_0x3766('0x85'),{'UserId':_0x4c93a7,[_0x3ba4f0+_0x3766('0x80')]:_0xeaa393['id']});if(_0x3ba4f0!=='Voice'){return;}return db[_0x3766('0x82')][_0x3766('0x41')]({'where':{'id':_0x3b0e38,'online':0x1},'attributes':['id',_0x3766('0x26'),_0x3766('0x86'),_0x3766('0x87'),_0x3766('0x88')],'raw':!![]})[_0x3766('0x24')](function(_0x1bae60){var _0x2485fe=_[_0x3766('0x29')](_0x1bae60,function(_0x37287d){return db[_0x3766('0x89')][_0x3766('0x8a')]({'membername':_0x37287d[_0x3766('0x26')],'UserId':_0x37287d['id'],'queue_name':_0xeaa393[_0x3766('0x26')],'VoiceQueueId':_0xeaa393['id'],'interface':_[_0x3766('0x8b')](_0x37287d[_0x3766('0x88')])?util[_0x3766('0x8c')](_0x3766('0x8d'),_0x37287d[_0x3766('0x26')]):_0x37287d['interface'],'paused':_0x37287d[_0x3766('0x87')]||![],'penalty':_0xeaa393[_0x3766('0x81')]['penalty']},{'transaction':_0x5f459f});});return Promise[_0x3766('0x8e')](_0x2485fe);});});});return Promise[_0x3766('0x8e')](_0x520157);});return Promise[_0x3766('0x8e')](_0xde6e4);})['then'](function(){return db[_0x3766('0x67')][_0x3766('0x6c')]({'where':{'teamId':_0x119f56}})['then'](function(_0x29fe05){if(_0x29fe05){var _0xa220d1=_[_0x3766('0x29')](_0x3b0e38,function(_0xf7a7e7){db[_0x3766('0x68')]['upsert']({'UserId':_0xf7a7e7,'VoicePrefixId':_0x29fe05[_0x3766('0x69')]});});return Promise[_0x3766('0x8e')](_0xa220d1);}});});});return Promise['all'](_0x113761)[_0x3766('0x24')](function(){return _0x4eb32c[_0x3766('0x8f')](_0x3b0e38,{'transaction':_0x5f459f})[_0x3766('0x90')](function(_0x25c1bd){return _0x25c1bd;});});});}})[_0x3766('0x24')](respondWithResult(_0x1a140e,null))[_0x3766('0x43')](handleError(_0x1a140e,null));};exports[_0x3766('0x91')]=function(_0x373632,_0x540235){var _0x67a661=_[_0x3766('0x78')](_0x373632[_0x3766('0x2f')]['ids'])?_0x373632[_0x3766('0x2f')]['ids']:[_0x373632[_0x3766('0x2f')][_0x3766('0x76')]];var _0x48484f=_0x373632['params']['id'];return db[_0x3766('0x2a')][_0x3766('0x45')]({'where':{'id':_0x48484f}})['then'](handleEntityNotFound(_0x540235,null))[_0x3766('0x24')](function(_0xb75918){if(_0xb75918){var _0x2770cb=[_0x3766('0x79'),_0x3766('0x7a'),_0x3766('0x7b'),_0x3766('0x7c'),_0x3766('0x92'),'Openchannel',_0x3766('0x93')];return db[_0x3766('0x51')][_0x3766('0x52')](function(_0x51e5a9){var _0x3bc065=_[_0x3766('0x29')](_0x2770cb,function(_0x234ccc){var _0x38473b={'attributes':['id','name']};return _0xb75918['get'+_0x234ccc+_0x3766('0x71')](_0x38473b)[_0x3766('0x24')](function(_0x347134){var _0x3cea5b=_[_0x3766('0x29')](_0x347134,function(_0x570170){return _0x570170[_0x3766('0x91')](_0x67a661,{'transaction':_0x51e5a9})['then'](function(){var _0x42943e=_[_0x3766('0x29')](_0x67a661,function(_0x17d63b){socket['emit'](_0x3766('0x48')+_0x234ccc+_0x3766('0x94'),{'UserId':Number(_0x17d63b),[_0x234ccc+_0x3766('0x80')]:_0x570170['id']});if(_0x234ccc!==_0x3766('0x79')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x570170['id'],'UserId':_0x17d63b},'transaction':_0x51e5a9});});return Promise['all'](_0x42943e);});});return Promise[_0x3766('0x8e')](_0x3cea5b);});});return Promise[_0x3766('0x8e')](_0x3bc065)['then'](function(){return _0xb75918[_0x3766('0x91')](_0x67a661,{'transaction':_0x51e5a9});})['then'](function(){return db[_0x3766('0x67')]['findOne']({'where':{'teamId':_0x48484f}})[_0x3766('0x24')](function(_0x2362ba){if(_0x2362ba){var _0x52fa07=_['map'](_0x67a661,function(_0x234d1b){db[_0x3766('0x68')]['destroy']({'where':{'UserId':_0x234d1b,'VoicePrefixId':_0x2362ba[_0x3766('0x69')]}});});return Promise[_0x3766('0x8e')](_0x52fa07);}});});});}})[_0x3766('0x24')](respondWithStatusCode(_0x540235,null))[_0x3766('0x43')](handleError(_0x540235,null));};exports[_0x3766('0x95')]=function(_0x2a6d24,_0x394d80,_0x1eca36){var _0x4531bc={};var _0x5e18c9={};var _0xa56add;var _0x40076e;return db[_0x3766('0x2a')][_0x3766('0x6c')]({'where':{'id':_0x2a6d24[_0x3766('0x50')]['id']}})[_0x3766('0x24')](handleEntityNotFound(_0x394d80,null))[_0x3766('0x24')](function(_0x270fd7){if(_0x270fd7){_0xa56add=_0x270fd7;_0x5e18c9['model']=_['keys'](db['User'][_0x3766('0x2b')]);_0x5e18c9[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x2a6d24['query']);_0x5e18c9[_0x3766('0x31')]=_[_0x3766('0x32')](_0x5e18c9[_0x3766('0x2e')],_0x5e18c9[_0x3766('0x2f')]);_0x4531bc[_0x3766('0x33')]=_[_0x3766('0x32')](_0x5e18c9[_0x3766('0x2e')],qs[_0x3766('0x34')](_0x2a6d24[_0x3766('0x2f')][_0x3766('0x34')]));_0x4531bc[_0x3766('0x33')]=_0x4531bc[_0x3766('0x33')][_0x3766('0x35')]?_0x4531bc[_0x3766('0x33')]:_0x5e18c9[_0x3766('0x2e')];_0x4531bc[_0x3766('0x38')]=qs['sort'](_0x2a6d24['query'][_0x3766('0x39')]);_0x4531bc[_0x3766('0x3c')]=qs[_0x3766('0x31')](_[_0x3766('0x3a')](_0x2a6d24['query'],_0x5e18c9['filters']));if(_0x2a6d24['query']['filter']){_0x4531bc['where']=_['merge'](_0x4531bc[_0x3766('0x3c')],{'$or':_['map'](_0x4531bc[_0x3766('0x33')],function(_0x590dbf){var _0x4fa9ea={};_0x4fa9ea[_0x590dbf]={'$like':'%'+_0x2a6d24['query']['filter']+'%'};return _0x4fa9ea;})});}_0x4531bc=_[_0x3766('0x3d')]({},_0x4531bc,_0x2a6d24[_0x3766('0x44')]);return _0xa56add[_0x3766('0x95')](_0x4531bc);}})[_0x3766('0x24')](function(_0x39130d){if(_0x39130d){_0x40076e=_0x39130d[_0x3766('0x35')];if(!_0x2a6d24[_0x3766('0x2f')][_0x3766('0x36')](_0x3766('0x37'))){_0x4531bc[_0x3766('0x1d')]=qs[_0x3766('0x1d')](_0x2a6d24[_0x3766('0x2f')][_0x3766('0x1d')]);_0x4531bc[_0x3766('0x1b')]=qs[_0x3766('0x1b')](_0x2a6d24[_0x3766('0x2f')][_0x3766('0x1b')]);}return _0xa56add['getAgents'](_0x4531bc);}})[_0x3766('0x24')](function(_0x2ca949){if(_0x2ca949){return _0x2ca949?{'count':_0x40076e,'rows':_0x2ca949}:null;}})[_0x3766('0x24')](respondWithResult(_0x394d80,null))[_0x3766('0x43')](handleError(_0x394d80,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index c464c19..2c4860d 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 _0x8ba0=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x254233,_0x45e922){var _0x24d660=function(_0x46198b){while(--_0x46198b){_0x254233['push'](_0x254233['shift']());}};_0x24d660(++_0x45e922);}(_0x8ba0,0x129));var _0x08ba=function(_0x5c3fc8,_0x3b4094){_0x5c3fc8=_0x5c3fc8-0x0;var _0x4280cb=_0x8ba0[_0x5c3fc8];return _0x4280cb;};'use strict';var EventEmitter=require(_0x08ba('0x0'));var Team=require(_0x08ba('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x08ba('0x2')](0x0);var events={'afterCreate':_0x08ba('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x18a05a){return function(_0x49b2f6,_0x2a3c60,_0x38adb3){TeamEvents[_0x08ba('0x4')](_0x18a05a+':'+_0x49b2f6['id'],_0x49b2f6);TeamEvents['emit'](_0x18a05a,_0x49b2f6);_0x38adb3(null);};}for(var e in events){if(events[_0x08ba('0x5')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x08ba('0x6')]=TeamEvents; \ No newline at end of file +var _0xbb43=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x53677f,_0x511bb3){var _0x4a13a0=function(_0x3d7022){while(--_0x3d7022){_0x53677f['push'](_0x53677f['shift']());}};_0x4a13a0(++_0x511bb3);}(_0xbb43,0x190));var _0x3bb4=function(_0x5c6ceb,_0x4ed099){_0x5c6ceb=_0x5c6ceb-0x0;var _0x28821b=_0xbb43[_0x5c6ceb];return _0x28821b;};'use strict';var EventEmitter=require(_0x3bb4('0x0'));var Team=require(_0x3bb4('0x1'))['db'][_0x3bb4('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x3bb4('0x3')](0x0);var events={'afterCreate':_0x3bb4('0x4'),'afterUpdate':_0x3bb4('0x5'),'afterDestroy':_0x3bb4('0x6')};function emitEvent(_0x59e8be){return function(_0x2552e7,_0x55d225,_0x5d5747){TeamEvents['emit'](_0x59e8be+':'+_0x2552e7['id'],_0x2552e7);TeamEvents[_0x3bb4('0x7')](_0x59e8be,_0x2552e7);_0x5d5747(null);};}for(var e in events){if(events[_0x3bb4('0x8')](e)){var event=events[e];Team[_0x3bb4('0x9')](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 7046d82..a926084 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 _0x3fb4=['setDataValue','channel','exports','define','Team','teams','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','catch','lodash','./team.attributes','Queues','then','map'];(function(_0x3ae9a2,_0x40cc2b){var _0x3d6645=function(_0x1564d1){while(--_0x1564d1){_0x3ae9a2['push'](_0x3ae9a2['shift']());}};_0x3d6645(++_0x40cc2b);}(_0x3fb4,0x163));var _0x43fb=function(_0x172747,_0x1732bd){_0x172747=_0x172747-0x0;var _0x509692=_0x3fb4[_0x172747];return _0x509692;};'use strict';var _=require(_0x43fb('0x0'));var attributes=require(_0x43fb('0x1'));function getQueuesByChannel(_0x51b7e9,_0x5b2104){var _0x17f445='get'+_0x5b2104+_0x43fb('0x2');return _0x51b7e9[_0x17f445]()[_0x43fb('0x3')](function(_0x410e35){return _[_0x43fb('0x4')](_0x410e35,function(_0x18d345){_0x18d345[_0x43fb('0x5')](_0x43fb('0x6'),_0x5b2104);return _0x18d345;});})['catch'](function(_0xf8665b){throw _0xf8665b;});}module[_0x43fb('0x7')]=function(_0xb82927){return _0xb82927[_0x43fb('0x8')](_0x43fb('0x9'),attributes,{'tableName':_0x43fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x8cc54d=this;var _0x123abb=['Chat','Fax',_0x43fb('0xb'),_0x43fb('0xc'),_0x43fb('0xd'),_0x43fb('0xe'),_0x43fb('0xf')];return Promise[_0x43fb('0x10')]()[_0x43fb('0x3')](function(){var _0x58a725=_['map'](_0x123abb,function(_0x95d9e7){return getQueuesByChannel(_0x8cc54d,_0x95d9e7);});return Promise['all'](_0x58a725);})[_0x43fb('0x11')](function(_0x3139c7){throw _0x3139c7;});}}});}; \ No newline at end of file +var _0xc1f8=['all','lodash','./team.attributes','get','Queues','setDataValue','channel','catch','define','teams','Chat','Fax','Sms','Voice','Whatsapp','resolve','then','map'];(function(_0x5046f0,_0x143f3c){var _0x423c81=function(_0xb2bc31){while(--_0xb2bc31){_0x5046f0['push'](_0x5046f0['shift']());}};_0x423c81(++_0x143f3c);}(_0xc1f8,0x1b1));var _0x8c1f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc1f8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c1f('0x0'));var attributes=require(_0x8c1f('0x1'));function getQueuesByChannel(_0x504cf4,_0xba3d5b){var _0x3f3748=_0x8c1f('0x2')+_0xba3d5b+_0x8c1f('0x3');return _0x504cf4[_0x3f3748]()['then'](function(_0x5bfba6){return _['map'](_0x5bfba6,function(_0x51b9b0){_0x51b9b0[_0x8c1f('0x4')](_0x8c1f('0x5'),_0xba3d5b);return _0x51b9b0;});})[_0x8c1f('0x6')](function(_0xefec56){throw _0xefec56;});}module['exports']=function(_0x1cf42e){return _0x1cf42e[_0x8c1f('0x7')]('Team',attributes,{'tableName':_0x8c1f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4d448f=this;var _0xcee0c3=[_0x8c1f('0x9'),_0x8c1f('0xa'),'Mail','Openchannel',_0x8c1f('0xb'),_0x8c1f('0xc'),_0x8c1f('0xd')];return Promise[_0x8c1f('0xe')]()[_0x8c1f('0xf')](function(){var _0x42c2ef=_[_0x8c1f('0x10')](_0xcee0c3,function(_0x34e84c){return getQueuesByChannel(_0x4d448f,_0x34e84c);});return Promise[_0x8c1f('0x11')](_0x42c2ef);})[_0x8c1f('0x6')](function(_0x2442fc){throw _0x2442fc;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index cf1f553..20d19c5 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 _0xa50a=['then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request'];(function(_0x4fbb24,_0x515a7b){var _0x35ea9b=function(_0x147791){while(--_0x147791){_0x4fbb24['push'](_0x4fbb24['shift']());}};_0x35ea9b(++_0x515a7b);}(_0xa50a,0x1e5));var _0xaa50=function(_0x484c80,_0x2bb3e){_0x484c80=_0x484c80-0x0;var _0x6d8d93=_0xa50a[_0x484c80];return _0x6d8d93;};'use strict';var _=require('lodash');var util=require(_0xaa50('0x0'));var moment=require('moment');var BPromise=require(_0xaa50('0x1'));var rs=require(_0xaa50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xaa50('0x3'));var logger=require('../../config/logger')(_0xaa50('0x4'));var config=require(_0xaa50('0x5'));var jayson=require(_0xaa50('0x6'));var client=jayson[_0xaa50('0x7')]['http']({'port':0x232a});config[_0xaa50('0x8')]=_[_0xaa50('0x9')](config[_0xaa50('0x8')],{'host':_0xaa50('0xa'),'port':0x18eb});var socket=require(_0xaa50('0xb'))(new Redis(config['redis']));require(_0xaa50('0xc'))[_0xaa50('0xd')](socket);function respondWithRpcPromise(_0x2f230d,_0x44a8a1,_0x59b326){return new BPromise(function(_0x44c127,_0x646528){return client[_0xaa50('0xe')](_0x2f230d,_0x59b326)[_0xaa50('0xf')](function(_0x12483c){logger[_0xaa50('0x10')]('Team,\x20%s,\x20%s',_0x44a8a1,_0xaa50('0x11'));logger[_0xaa50('0x12')](_0xaa50('0x13'),_0x44a8a1,_0xaa50('0x11'),JSON[_0xaa50('0x14')](_0x12483c));if(_0x12483c[_0xaa50('0x15')]){if(_0x12483c[_0xaa50('0x15')][_0xaa50('0x16')]===0x1f4){logger['error'](_0xaa50('0x17'),_0x44a8a1,_0x12483c[_0xaa50('0x15')]['message']);return _0x646528(_0x12483c[_0xaa50('0x15')][_0xaa50('0x18')]);}logger['error'](_0xaa50('0x17'),_0x44a8a1,_0x12483c[_0xaa50('0x15')][_0xaa50('0x18')]);return _0x44c127(_0x12483c[_0xaa50('0x15')][_0xaa50('0x18')]);}else{logger[_0xaa50('0x10')](_0xaa50('0x17'),_0x44a8a1,'request\x20sent');_0x44c127(_0x12483c['result']['message']);}})['catch'](function(_0x4ce0c4){logger[_0xaa50('0x15')](_0xaa50('0x17'),_0x44a8a1,_0x4ce0c4);_0x646528(_0x4ce0c4);});});} \ No newline at end of file +var _0xa9bb=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x47638d,_0x2c6518){var _0x42ccbb=function(_0xecd2c){while(--_0xecd2c){_0x47638d['push'](_0x47638d['shift']());}};_0x42ccbb(++_0x2c6518);}(_0xa9bb,0x192));var _0xba9b=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xa9bb[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xba9b('0x0'));var util=require(_0xba9b('0x1'));var moment=require(_0xba9b('0x2'));var BPromise=require(_0xba9b('0x3'));var rs=require(_0xba9b('0x4'));var fs=require('fs');var Redis=require(_0xba9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba9b('0x6'));var logger=require(_0xba9b('0x7'))('rpc');var config=require(_0xba9b('0x8'));var jayson=require(_0xba9b('0x9'));var client=jayson['client'][_0xba9b('0xa')]({'port':0x232a});config[_0xba9b('0xb')]=_[_0xba9b('0xc')](config[_0xba9b('0xb')],{'host':_0xba9b('0xd'),'port':0x18eb});var socket=require(_0xba9b('0xe'))(new Redis(config[_0xba9b('0xb')]));require(_0xba9b('0xf'))[_0xba9b('0x10')](socket);function respondWithRpcPromise(_0x7f7f93,_0x107282,_0x52a695){return new BPromise(function(_0x55ec63,_0x2ac841){return client[_0xba9b('0x11')](_0x7f7f93,_0x52a695)[_0xba9b('0x12')](function(_0x431137){logger[_0xba9b('0x13')](_0xba9b('0x14'),_0x107282,_0xba9b('0x15'));logger[_0xba9b('0x16')](_0xba9b('0x17'),_0x107282,'request\x20sent',JSON[_0xba9b('0x18')](_0x431137));if(_0x431137[_0xba9b('0x19')]){if(_0x431137['error'][_0xba9b('0x1a')]===0x1f4){logger['error'](_0xba9b('0x14'),_0x107282,_0x431137[_0xba9b('0x19')][_0xba9b('0x1b')]);return _0x2ac841(_0x431137['error'][_0xba9b('0x1b')]);}logger[_0xba9b('0x19')](_0xba9b('0x14'),_0x107282,_0x431137[_0xba9b('0x19')][_0xba9b('0x1b')]);return _0x55ec63(_0x431137[_0xba9b('0x19')][_0xba9b('0x1b')]);}else{logger['info'](_0xba9b('0x14'),_0x107282,_0xba9b('0x15'));_0x55ec63(_0x431137['result'][_0xba9b('0x1b')]);}})[_0xba9b('0x1c')](function(_0x3d372f){logger[_0xba9b('0x19')](_0xba9b('0x14'),_0x107282,_0x3d372f);_0x2ac841(_0x3d372f);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index b137a9e..d8e5505 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 _0x39cb=['length','save','remove','emit','removeListener','register'];(function(_0x57b5e7,_0x1a408){var _0x105fac=function(_0x11b707){while(--_0x11b707){_0x57b5e7['push'](_0x57b5e7['shift']());}};_0x105fac(++_0x1a408);}(_0x39cb,0x1bd));var _0xb39c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x39cb[_0x4b369d];return _0x571a98;};'use strict';var TeamEvents=require('./team.events');var events=[_0xb39c('0x0'),_0xb39c('0x1'),'update'];function createListener(_0x266bb4,_0x3aacb4){return function(_0x5bb582){_0x3aacb4[_0xb39c('0x2')](_0x266bb4,_0x5bb582);};}function removeListener(_0x285eca,_0x398d07){return function(){TeamEvents[_0xb39c('0x3')](_0x285eca,_0x398d07);};}exports[_0xb39c('0x4')]=function(_0x4ae4cf){for(var _0x32cdcd=0x0,_0x2fc868=events[_0xb39c('0x5')];_0x32cdcd<_0x2fc868;_0x32cdcd++){var _0x3f2fbe=events[_0x32cdcd];var _0x47d6d7=createListener('team:'+_0x3f2fbe,_0x4ae4cf);TeamEvents['on'](_0x3f2fbe,_0x47d6d7);}}; \ No newline at end of file +var _0xd87e=['save','update','emit','removeListener','length','team:','./team.events'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xd87e,0x1bf));var _0xed87=function(_0x3ddd29,_0x26f096){_0x3ddd29=_0x3ddd29-0x0;var _0x34cb20=_0xd87e[_0x3ddd29];return _0x34cb20;};'use strict';var TeamEvents=require(_0xed87('0x0'));var events=[_0xed87('0x1'),'remove',_0xed87('0x2')];function createListener(_0x189fdd,_0x16509b){return function(_0x5901be){_0x16509b[_0xed87('0x3')](_0x189fdd,_0x5901be);};}function removeListener(_0x5e960f,_0x11a5d9){return function(){TeamEvents[_0xed87('0x4')](_0x5e960f,_0x11a5d9);};}exports['register']=function(_0x17adfe){for(var _0x589fb9=0x0,_0x5da793=events[_0xed87('0x5')];_0x589fb9<_0x5da793;_0x589fb9++){var _0x42fef6=events[_0x589fb9];var _0x33e1c1=createListener(_0xed87('0x6')+_0x42fef6,_0x17adfe);TeamEvents['on'](_0x42fef6,_0x33e1c1);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 5419d3f..4d7382c 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 _0xa62c=['INTEGER','sequelize','exports'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xa62c,0x70));var _0xca62=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0xa62c[_0x4c630b];return _0x181259;};'use strict';var Sequelize=require(_0xca62('0x0'));module[_0xca62('0x1')]={'TeamId':{'type':Sequelize[_0xca62('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xca62('0x2')]}}; \ No newline at end of file +var _0xcbdd=['sequelize','INTEGER'];(function(_0x3a8dc1,_0x2f03b8){var _0x4b3595=function(_0x1c19e7){while(--_0x1c19e7){_0x3a8dc1['push'](_0x3a8dc1['shift']());}};_0x4b3595(++_0x2f03b8);}(_0xcbdd,0xec));var _0xdcbd=function(_0x3eb169,_0x26495b){_0x3eb169=_0x3eb169-0x0;var _0x16ee99=_0xcbdd[_0x3eb169];return _0x16ee99;};'use strict';var Sequelize=require(_0xdcbd('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xdcbd('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xdcbd('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 7ffe2c4..803999a 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 _0x3a79=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','util','../../config/logger'];(function(_0x4547e4,_0x3765b1){var _0x17d5d4=function(_0x440b5c){while(--_0x440b5c){_0x4547e4['push'](_0x4547e4['shift']());}};_0x17d5d4(++_0x3765b1);}(_0x3a79,0xca));var _0x93a7=function(_0x4a245b,_0x118aca){_0x4a245b=_0x4a245b-0x0;var _0x2e9104=_0x3a79[_0x4a245b];return _0x2e9104;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var logger=require(_0x93a7('0x1'))('api');var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var rp=require(_0x93a7('0x4'));var fs=require('fs');var path=require(_0x93a7('0x5'));var rimraf=require(_0x93a7('0x6'));var config=require(_0x93a7('0x7'));var attributes=require(_0x93a7('0x8'));module['exports']=function(_0x2976b2,_0x4efb20){return _0x2976b2[_0x93a7('0x9')](_0x93a7('0xa'),attributes,{'tableName':_0x93a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbac=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','TeamVoicePrefix','util'];(function(_0x33fc57,_0xdd2591){var _0xf701ca=function(_0x4a38b9){while(--_0x4a38b9){_0x33fc57['push'](_0x33fc57['shift']());}};_0xf701ca(++_0xdd2591);}(_0xfbac,0x167));var _0xcfba=function(_0x1915ad,_0x3626dd){_0x1915ad=_0x1915ad-0x0;var _0x1e01a4=_0xfbac[_0x1915ad];return _0x1e01a4;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));var logger=require(_0xcfba('0x1'))(_0xcfba('0x2'));var moment=require(_0xcfba('0x3'));var BPromise=require(_0xcfba('0x4'));var rp=require(_0xcfba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfba('0x6'));var attributes=require(_0xcfba('0x7'));module['exports']=function(_0x4eec09,_0x3bb3af){return _0x4eec09['define'](_0xcfba('0x8'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 3aaa606..40f3a4f 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(_0x39dbc3,_0x5adc70){var _0x28b160=function(_0x5b1e8d){while(--_0x5b1e8d){_0x39dbc3['push'](_0x39dbc3['shift']());}};_0x28b160(++_0x5adc70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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(_0x53991f,_0x431062){var _0x3be065=function(_0x848487){while(--_0x848487){_0x53991f['push'](_0x53991f['shift']());}};_0x3be065(++_0x431062);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8847dae..4279f8a 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 _0x403d=['exports','sequelize'];(function(_0x4c1b08,_0x1d846f){var _0x4c3946=function(_0x500926){while(--_0x500926){_0x4c1b08['push'](_0x4c1b08['shift']());}};_0x4c3946(++_0x1d846f);}(_0x403d,0x111));var _0xd403=function(_0x26013b,_0x23d44e){_0x26013b=_0x26013b-0x0;var _0x16a91f=_0x403d[_0x26013b];return _0x16a91f;};'use strict';var Sequelize=require(_0xd403('0x0'));module[_0xd403('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0f6e=['INTEGER','sequelize','exports'];(function(_0x592fbb,_0x3ddc10){var _0x341bcc=function(_0x3ca456){while(--_0x3ca456){_0x592fbb['push'](_0x592fbb['shift']());}};_0x341bcc(++_0x3ddc10);}(_0x0f6e,0x70));var _0xe0f6=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x0f6e[_0x3f8a03];return _0x147fb2;};'use strict';var Sequelize=require(_0xe0f6('0x0'));module[_0xe0f6('0x1')]={'penalty':{'type':Sequelize[_0xe0f6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 0fe3346..dbafc68 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 _0xd2ce=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoiceQueue','util','api','moment'];(function(_0x308b9a,_0x427bc8){var _0xf8a551=function(_0x2ee7d1){while(--_0x2ee7d1){_0x308b9a['push'](_0x308b9a['shift']());}};_0xf8a551(++_0x427bc8);}(_0xd2ce,0x13c));var _0xed2c=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xd2ce[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0xed2c('0x0'));var logger=require('../../config/logger')(_0xed2c('0x1'));var moment=require(_0xed2c('0x2'));var BPromise=require(_0xed2c('0x3'));var rp=require(_0xed2c('0x4'));var fs=require('fs');var path=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var config=require(_0xed2c('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xed2c('0x8')]=function(_0x5b6ccb,_0x38aa25){return _0x5b6ccb[_0xed2c('0x9')](_0xed2c('0xa'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24cd=['util','api','bluebird','request-promise','path','../../config/environment','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash'];(function(_0x52a7f1,_0x3a16bd){var _0x337926=function(_0x2d0114){while(--_0x2d0114){_0x52a7f1['push'](_0x52a7f1['shift']());}};_0x337926(++_0x3a16bd);}(_0x24cd,0x83));var _0xd24c=function(_0x19a113,_0x2e71b3){_0x19a113=_0x19a113-0x0;var _0x1c36d3=_0x24cd[_0x19a113];return _0x1c36d3;};'use strict';var _=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var logger=require('../../config/logger')(_0xd24c('0x2'));var moment=require('moment');var BPromise=require(_0xd24c('0x3'));var rp=require(_0xd24c('0x4'));var fs=require('fs');var path=require(_0xd24c('0x5'));var rimraf=require('rimraf');var config=require(_0xd24c('0x6'));var attributes=require(_0xd24c('0x7'));module['exports']=function(_0x1c30fc,_0x2721be){return _0x1c30fc[_0xd24c('0x8')](_0xd24c('0x9'),attributes,{'tableName':_0xd24c('0xa'),'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 919dca6..e5e455c 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 _0x461d=['request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x461d,0x166));var _0xd461=function(_0x1ea7b5,_0x1a6752){_0x1ea7b5=_0x1ea7b5-0x0;var _0x2f7f40=_0x461d[_0x1ea7b5];return _0x2f7f40;};'use strict';var _=require(_0xd461('0x0'));var util=require(_0xd461('0x1'));var moment=require('moment');var BPromise=require(_0xd461('0x2'));var rs=require(_0xd461('0x3'));var fs=require('fs');var Redis=require(_0xd461('0x4'));var db=require(_0xd461('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd461('0x6'))(_0xd461('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd461('0x8')][_0xd461('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x137454,_0x27e7b9,_0xa2ed8a){return new BPromise(function(_0x4b3d75,_0x554884){return client[_0xd461('0xa')](_0x137454,_0xa2ed8a)[_0xd461('0xb')](function(_0x38e788){logger[_0xd461('0xc')](_0xd461('0xd'),_0x27e7b9,'request\x20sent');logger[_0xd461('0xe')](_0xd461('0xf'),_0x27e7b9,_0xd461('0x10'),JSON[_0xd461('0x11')](_0x38e788));if(_0x38e788[_0xd461('0x12')]){if(_0x38e788[_0xd461('0x12')]['code']===0x1f4){logger[_0xd461('0x12')](_0xd461('0xd'),_0x27e7b9,_0x38e788[_0xd461('0x12')][_0xd461('0x13')]);return _0x554884(_0x38e788[_0xd461('0x12')]['message']);}logger[_0xd461('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x27e7b9,_0x38e788['error'][_0xd461('0x13')]);return _0x4b3d75(_0x38e788[_0xd461('0x12')][_0xd461('0x13')]);}else{logger[_0xd461('0xc')](_0xd461('0xd'),_0x27e7b9,'request\x20sent');_0x4b3d75(_0x38e788[_0xd461('0x14')][_0xd461('0x13')]);}})[_0xd461('0x15')](function(_0x1a462b){logger['error'](_0xd461('0xd'),_0x27e7b9,_0x1a462b);_0x554884(_0x1a462b);});});} \ No newline at end of file +var _0x17da=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5acaea,_0x442cb0){var _0x509dfa=function(_0x58a5d8){while(--_0x58a5d8){_0x5acaea['push'](_0x5acaea['shift']());}};_0x509dfa(++_0x442cb0);}(_0x17da,0x18a));var _0xa17d=function(_0x12f89a,_0x3e0e5e){_0x12f89a=_0x12f89a-0x0;var _0x4e4716=_0x17da[_0x12f89a];return _0x4e4716;};'use strict';var _=require(_0xa17d('0x0'));var util=require(_0xa17d('0x1'));var moment=require(_0xa17d('0x2'));var BPromise=require(_0xa17d('0x3'));var rs=require(_0xa17d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa17d('0x5'))['db'];var utils=require(_0xa17d('0x6'));var logger=require(_0xa17d('0x7'))(_0xa17d('0x8'));var config=require('../../config/environment');var jayson=require(_0xa17d('0x9'));var client=jayson[_0xa17d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43a5d2,_0x4d960d,_0x4ae0e7){return new BPromise(function(_0x3ac4af,_0x3badbc){return client[_0xa17d('0xb')](_0x43a5d2,_0x4ae0e7)['then'](function(_0x537581){logger['info'](_0xa17d('0xc'),_0x4d960d,'request\x20sent');logger[_0xa17d('0xd')](_0xa17d('0xe'),_0x4d960d,'request\x20sent',JSON[_0xa17d('0xf')](_0x537581));if(_0x537581[_0xa17d('0x10')]){if(_0x537581[_0xa17d('0x10')]['code']===0x1f4){logger[_0xa17d('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4d960d,_0x537581['error']['message']);return _0x3badbc(_0x537581[_0xa17d('0x10')]['message']);}logger[_0xa17d('0x10')](_0xa17d('0xc'),_0x4d960d,_0x537581[_0xa17d('0x10')][_0xa17d('0x11')]);return _0x3ac4af(_0x537581[_0xa17d('0x10')][_0xa17d('0x11')]);}else{logger[_0xa17d('0x12')](_0xa17d('0xc'),_0x4d960d,'request\x20sent');_0x3ac4af(_0x537581[_0xa17d('0x13')]['message']);}})[_0xa17d('0x14')](function(_0x15fc0b){logger[_0xa17d('0x10')](_0xa17d('0xc'),_0x4d960d,_0x15fc0b);_0x3badbc(_0x15fc0b);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index ab42efa..ce23698 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 _0xea4e=['fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','express'];(function(_0x592e69,_0x1947c5){var _0x1596f1=function(_0x50c369){while(--_0x50c369){_0x592e69['push'](_0x592e69['shift']());}};_0x1596f1(++_0x1947c5);}(_0xea4e,0x10c));var _0xeea4=function(_0x30414a,_0x3c8ed5){_0x30414a=_0x30414a-0x0;var _0x77ca87=_0xea4e[_0x30414a];return _0x77ca87;};'use strict';var multer=require(_0xeea4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeea4('0x1'));var router=express['Router']();var fs_extra=require(_0xeea4('0x2'));var auth=require(_0xeea4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xeea4('0x4'));var controller=require(_0xeea4('0x5'));router[_0xeea4('0x6')]('/',auth[_0xeea4('0x7')](),controller[_0xeea4('0x8')]);router[_0xeea4('0x6')](_0xeea4('0x9'),auth[_0xeea4('0x7')](),controller[_0xeea4('0xa')]);router['post']('/',auth[_0xeea4('0x7')](),controller['create']);router[_0xeea4('0xb')](_0xeea4('0x9'),auth[_0xeea4('0x7')](),controller[_0xeea4('0xc')]);router[_0xeea4('0xd')](_0xeea4('0x9'),auth[_0xeea4('0x7')](),controller[_0xeea4('0xe')]);module['exports']=router; \ No newline at end of file +var _0x04d5=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','post','isAuthenticated','create','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x13a5e2,_0x4e2d46){var _0x42c586=function(_0x935b12){while(--_0x935b12){_0x13a5e2['push'](_0x13a5e2['shift']());}};_0x42c586(++_0x4e2d46);}(_0x04d5,0xe1));var _0x504d=function(_0x135b22,_0x426ccc){_0x135b22=_0x135b22-0x0;var _0x494911=_0x04d5[_0x135b22];return _0x494911;};'use strict';var multer=require(_0x504d('0x0'));var util=require(_0x504d('0x1'));var path=require('path');var timeout=require(_0x504d('0x2'));var express=require(_0x504d('0x3'));var router=express[_0x504d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x504d('0x5'));var interaction=require(_0x504d('0x6'));var config=require(_0x504d('0x7'));var controller=require(_0x504d('0x8'));router[_0x504d('0x9')]('/',auth['isAuthenticated'](),controller[_0x504d('0xa')]);router[_0x504d('0x9')](_0x504d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x504d('0xc')]('/',auth[_0x504d('0xd')](),controller[_0x504d('0xe')]);router['put'](_0x504d('0xb'),auth[_0x504d('0xd')](),controller[_0x504d('0xf')]);router[_0x504d('0x10')]('/:id',auth[_0x504d('0xd')](),controller[_0x504d('0x11')]);module[_0x504d('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 47be9c3..816c208 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 _0x8473=['sequelize','exports','STRING','TEXT'];(function(_0x107f08,_0x1056ab){var _0x5da26a=function(_0x20540c){while(--_0x20540c){_0x107f08['push'](_0x107f08['shift']());}};_0x5da26a(++_0x1056ab);}(_0x8473,0x68));var _0x3847=function(_0x1ef930,_0x129c24){_0x1ef930=_0x1ef930-0x0;var _0x3b5a1d=_0x8473[_0x1ef930];return _0x3b5a1d;};'use strict';var Sequelize=require(_0x3847('0x0'));module[_0x3847('0x1')]={'name':{'type':Sequelize[_0x3847('0x2')]},'description':{'type':Sequelize[_0x3847('0x2')]},'html':{'type':Sequelize[_0x3847('0x3')]}}; \ No newline at end of file +var _0x010c=['exports','STRING','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x010c,0x12f));var _0xc010=function(_0xa15b3e,_0x4e5569){_0xa15b3e=_0xa15b3e-0x0;var _0x69d15a=_0x010c[_0xa15b3e];return _0x69d15a;};'use strict';var Sequelize=require('sequelize');module[_0xc010('0x0')]={'name':{'type':Sequelize[_0xc010('0x1')]},'description':{'type':Sequelize[_0xc010('0x1')]},'html':{'type':Sequelize[_0xc010('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 8cebf75..371672f 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 _0x4aa0=['catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','find','userProfileId','autoAssociation','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','get','sendStatus','stack','name','send','index','map','Template','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x1cdf81,_0x3b3de6){var _0xcdf114=function(_0x3b1c84){while(--_0x3b1c84){_0x1cdf81['push'](_0x1cdf81['shift']());}};_0xcdf114(++_0x3b3de6);}(_0x4aa0,0x1a7));var _0x04aa=function(_0x40b502,_0xd9995e){_0x40b502=_0x40b502-0x0;var _0x238346=_0x4aa0[_0x40b502];return _0x238346;};'use strict';var emlformat=require(_0x04aa('0x0'));var rimraf=require(_0x04aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04aa('0x2'));var rp=require('request-promise');var moment=require(_0x04aa('0x3'));var BPromise=require(_0x04aa('0x4'));var Mustache=require(_0x04aa('0x5'));var util=require(_0x04aa('0x6'));var path=require(_0x04aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x04aa('0x8'));var fs=require('fs');var fs_extra=require(_0x04aa('0x9'));var _=require(_0x04aa('0xa'));var squel=require('squel');var crypto=require(_0x04aa('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04aa('0xc'));var querystring=require(_0x04aa('0xd'));var Papa=require(_0x04aa('0xe'));var Redis=require(_0x04aa('0xf'));var authService=require(_0x04aa('0x10'));var qs=require(_0x04aa('0x11'));var as=require(_0x04aa('0x12'));var hardwareService=require(_0x04aa('0x13'));var logger=require('../../config/logger')(_0x04aa('0x14'));var utils=require(_0x04aa('0x15'));var config=require(_0x04aa('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x04aa('0x17'))['db'];function respondWithStatusCode(_0x4efcb3,_0x1a13dc){_0x1a13dc=_0x1a13dc||0xcc;return function(_0x3f2f52){if(_0x3f2f52){return _0x4efcb3['sendStatus'](_0x1a13dc);}return _0x4efcb3[_0x04aa('0x18')](_0x1a13dc)[_0x04aa('0x19')]();};}function respondWithResult(_0x52aea0,_0x7f87c0){_0x7f87c0=_0x7f87c0||0xc8;return function(_0x461502){if(_0x461502){return _0x52aea0[_0x04aa('0x18')](_0x7f87c0)[_0x04aa('0x1a')](_0x461502);}};}function respondWithFilteredResult(_0x92f7d,_0x3ed055){return function(_0x46464f){if(_0x46464f){var _0x133422=typeof _0x3ed055[_0x04aa('0x1b')]===_0x04aa('0x1c')&&typeof _0x3ed055['limit']===_0x04aa('0x1c');var _0x14021f=_0x46464f[_0x04aa('0x1d')];var _0xc34d4=_0x133422?0x0:_0x3ed055[_0x04aa('0x1b')];var _0x8204a0=_0x133422?_0x46464f[_0x04aa('0x1d')]:_0x3ed055['offset']+_0x3ed055[_0x04aa('0x1e')];var _0x527001;if(_0x8204a0>=_0x14021f){_0x8204a0=_0x14021f;_0x527001=0xc8;}else{_0x527001=0xce;}_0x92f7d[_0x04aa('0x18')](_0x527001);return _0x92f7d[_0x04aa('0x1f')](_0x04aa('0x20'),_0xc34d4+'-'+_0x8204a0+'/'+_0x14021f)[_0x04aa('0x1a')](_0x46464f);}return null;};}function patchUpdates(_0x3b89ba){return function(_0x373e72){try{jsonpatch['apply'](_0x373e72,_0x3b89ba,!![]);}catch(_0x11bf2f){return BPromise[_0x04aa('0x21')](_0x11bf2f);}return _0x373e72[_0x04aa('0x22')]();};}function saveUpdates(_0x16bb09,_0x388492){return function(_0x3eeb51){if(_0x3eeb51){return _0x3eeb51[_0x04aa('0x23')](_0x16bb09)['then'](function(_0x219d23){return _0x219d23;});}return null;};}function removeEntity(_0xa69ae,_0x42e7ee){return function(_0x2ed530){if(_0x2ed530){return _0x2ed530[_0x04aa('0x24')]()[_0x04aa('0x25')](function(){var _0x1222e5=_0x2ed530[_0x04aa('0x26')]({'plain':!![]});var _0x467474='Templates';return db['UserProfileResource'][_0x04aa('0x24')]({'where':{'type':_0x467474,'resourceId':_0x1222e5['id']}})[_0x04aa('0x25')](function(){return _0x2ed530;});})[_0x04aa('0x25')](function(){_0xa69ae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x174753,_0x11fcb5){return function(_0x590cf4){if(!_0x590cf4){_0x174753[_0x04aa('0x27')](0x194);}return _0x590cf4;};}function handleError(_0x14460f,_0x81be5d){_0x81be5d=_0x81be5d||0x1f4;return function(_0x12c08e){logger['error'](_0x12c08e[_0x04aa('0x28')]);if(_0x12c08e[_0x04aa('0x29')]){delete _0x12c08e[_0x04aa('0x29')];}_0x14460f[_0x04aa('0x18')](_0x81be5d)[_0x04aa('0x2a')](_0x12c08e);};}exports[_0x04aa('0x2b')]=function(_0x39c97f,_0x52daaf){var _0xbfed22={},_0x197f43={},_0x2451b5={'count':0x0,'rows':[]};var _0x34bf55=_[_0x04aa('0x2c')](db[_0x04aa('0x2d')][_0x04aa('0x2e')],function(_0x55dcb2){return{'name':_0x55dcb2['fieldName'],'type':_0x55dcb2['type'][_0x04aa('0x2f')]};});_0x197f43[_0x04aa('0x30')]=_['map'](_0x34bf55,_0x04aa('0x29'));_0x197f43[_0x04aa('0x31')]=_[_0x04aa('0x32')](_0x39c97f['query']);_0x197f43[_0x04aa('0x33')]=_[_0x04aa('0x34')](_0x197f43[_0x04aa('0x30')],_0x197f43['query']);_0xbfed22[_0x04aa('0x35')]=_['intersection'](_0x197f43[_0x04aa('0x30')],qs[_0x04aa('0x36')](_0x39c97f['query'][_0x04aa('0x36')]));_0xbfed22[_0x04aa('0x35')]=_0xbfed22[_0x04aa('0x35')]['length']?_0xbfed22[_0x04aa('0x35')]:_0x197f43['model'];if(!_0x39c97f[_0x04aa('0x31')][_0x04aa('0x37')](_0x04aa('0x38'))){_0xbfed22['limit']=qs['limit'](_0x39c97f['query'][_0x04aa('0x1e')]);_0xbfed22[_0x04aa('0x1b')]=qs[_0x04aa('0x1b')](_0x39c97f[_0x04aa('0x31')][_0x04aa('0x1b')]);}_0xbfed22[_0x04aa('0x39')]=qs[_0x04aa('0x3a')](_0x39c97f[_0x04aa('0x31')][_0x04aa('0x3a')]);_0xbfed22[_0x04aa('0x3b')]=qs[_0x04aa('0x33')](_[_0x04aa('0x3c')](_0x39c97f['query'],_0x197f43[_0x04aa('0x33')]),_0x34bf55);if(_0x39c97f[_0x04aa('0x31')][_0x04aa('0x3d')]){_0xbfed22[_0x04aa('0x3b')]=_[_0x04aa('0x3e')](_0xbfed22['where'],{'$or':_['map'](_0x34bf55,function(_0x4cb021){if(_0x4cb021['type']!==_0x04aa('0x3f')){var _0x286935={};_0x286935[_0x4cb021['name']]={'$like':'%'+_0x39c97f[_0x04aa('0x31')][_0x04aa('0x3d')]+'%'};return _0x286935;}})});}_0xbfed22=_['merge']({},_0xbfed22,_0x39c97f[_0x04aa('0x40')]);var _0x1eb0fb={'where':_0xbfed22[_0x04aa('0x3b')]};return db['Template']['count'](_0x1eb0fb)[_0x04aa('0x25')](function(_0x231b12){_0x2451b5[_0x04aa('0x1d')]=_0x231b12;if(_0x39c97f['query'][_0x04aa('0x41')]){_0xbfed22[_0x04aa('0x42')]=[{'all':!![]}];}return db[_0x04aa('0x2d')][_0x04aa('0x43')](_0xbfed22);})[_0x04aa('0x25')](function(_0x2ea912){_0x2451b5[_0x04aa('0x44')]=_0x2ea912;return _0x2451b5;})[_0x04aa('0x25')](respondWithFilteredResult(_0x52daaf,_0xbfed22))[_0x04aa('0x45')](handleError(_0x52daaf,null));};exports[_0x04aa('0x46')]=function(_0x39c4e2,_0x114fad){var _0xa5c9bb={'raw':!![],'where':{'id':_0x39c4e2[_0x04aa('0x47')]['id']}},_0x5cd41b={};_0x5cd41b[_0x04aa('0x30')]=_[_0x04aa('0x32')](db['Template'][_0x04aa('0x2e')]);_0x5cd41b[_0x04aa('0x31')]=_[_0x04aa('0x32')](_0x39c4e2[_0x04aa('0x31')]);_0x5cd41b[_0x04aa('0x33')]=_[_0x04aa('0x34')](_0x5cd41b[_0x04aa('0x30')],_0x5cd41b[_0x04aa('0x31')]);_0xa5c9bb[_0x04aa('0x35')]=_[_0x04aa('0x34')](_0x5cd41b[_0x04aa('0x30')],qs['fields'](_0x39c4e2[_0x04aa('0x31')][_0x04aa('0x36')]));_0xa5c9bb[_0x04aa('0x35')]=_0xa5c9bb['attributes']['length']?_0xa5c9bb[_0x04aa('0x35')]:_0x5cd41b['model'];if(_0x39c4e2[_0x04aa('0x31')][_0x04aa('0x41')]){_0xa5c9bb[_0x04aa('0x42')]=[{'all':!![]}];}_0xa5c9bb=_['merge']({},_0xa5c9bb,_0x39c4e2[_0x04aa('0x40')]);return db[_0x04aa('0x2d')]['find'](_0xa5c9bb)['then'](handleEntityNotFound(_0x114fad,null))['then'](respondWithResult(_0x114fad,null))[_0x04aa('0x45')](handleError(_0x114fad,null));};exports[_0x04aa('0x48')]=function(_0x55bc62,_0x31a26b){return db['Template'][_0x04aa('0x48')](_0x55bc62['body'],{})[_0x04aa('0x25')](function(_0x1383b7){var _0x5319a7=_0x55bc62[_0x04aa('0x49')][_0x04aa('0x26')]({'plain':!![]});if(!_0x5319a7)throw new Error(_0x04aa('0x4a'));if(_0x5319a7[_0x04aa('0x4b')]===_0x04aa('0x49')){var _0x5e39c7=_0x1383b7[_0x04aa('0x26')]({'plain':!![]});var _0x35ed88=_0x04aa('0x4c');return db[_0x04aa('0x4d')][_0x04aa('0x4e')]({'where':{'name':_0x35ed88,'userProfileId':_0x5319a7[_0x04aa('0x4f')]},'raw':!![]})['then'](function(_0x1cd625){if(_0x1cd625&&_0x1cd625[_0x04aa('0x50')]===0x0){return db['UserProfileResource'][_0x04aa('0x48')]({'name':_0x5e39c7[_0x04aa('0x29')],'resourceId':_0x5e39c7['id'],'type':_0x1cd625[_0x04aa('0x29')],'sectionId':_0x1cd625['id']},{})['then'](function(){return _0x1383b7;});}else{return _0x1383b7;}})[_0x04aa('0x45')](function(_0x13bd72){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bd72);throw _0x13bd72;});}return _0x1383b7;})[_0x04aa('0x25')](respondWithResult(_0x31a26b,0xc9))[_0x04aa('0x45')](handleError(_0x31a26b,null));};exports[_0x04aa('0x23')]=function(_0x142e04,_0x30a180){if(_0x142e04[_0x04aa('0x51')]['id']){delete _0x142e04[_0x04aa('0x51')]['id'];}return db[_0x04aa('0x2d')]['find']({'where':{'id':_0x142e04[_0x04aa('0x47')]['id']}})['then'](handleEntityNotFound(_0x30a180,null))[_0x04aa('0x25')](saveUpdates(_0x142e04[_0x04aa('0x51')],null))['then'](respondWithResult(_0x30a180,null))[_0x04aa('0x45')](handleError(_0x30a180,null));};exports[_0x04aa('0x24')]=function(_0x12f35d,_0x4f0ba3){return db[_0x04aa('0x2d')]['find']({'where':{'id':_0x12f35d[_0x04aa('0x47')]['id']}})[_0x04aa('0x25')](handleEntityNotFound(_0x4f0ba3,null))[_0x04aa('0x25')](removeEntity(_0x4f0ba3,null))['catch'](handleError(_0x4f0ba3,null));}; \ No newline at end of file +var _0xd3bb=['status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Templates','UserProfileResource','name','send','index','Template','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','where','merge','type','filter','options','includeAll','include','findAll','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x329905,_0x13c144){var _0x3aa42=function(_0x2fac43){while(--_0x2fac43){_0x329905['push'](_0x329905['shift']());}};_0x3aa42(++_0x13c144);}(_0xd3bb,0xc4));var _0xbd3b=function(_0x1bfe99,_0x4656fd){_0x1bfe99=_0x1bfe99-0x0;var _0x149f9a=_0xd3bb[_0x1bfe99];return _0x149f9a;};'use strict';var emlformat=require(_0xbd3b('0x0'));var rimraf=require(_0xbd3b('0x1'));var zipdir=require(_0xbd3b('0x2'));var jsonpatch=require(_0xbd3b('0x3'));var rp=require(_0xbd3b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbd3b('0x5'));var util=require('util');var path=require(_0xbd3b('0x6'));var sox=require(_0xbd3b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd3b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbd3b('0x9'));var deskjs=require(_0xbd3b('0xa'));var toCsv=require('to-csv');var querystring=require(_0xbd3b('0xb'));var Papa=require(_0xbd3b('0xc'));var Redis=require(_0xbd3b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbd3b('0xe'));var hardwareService=require(_0xbd3b('0xf'));var logger=require(_0xbd3b('0x10'))('api');var utils=require(_0xbd3b('0x11'));var config=require(_0xbd3b('0x12'));var licenseUtil=require(_0xbd3b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b1cd8,_0x2217e4){_0x2217e4=_0x2217e4||0xcc;return function(_0xba159e){if(_0xba159e){return _0x2b1cd8['sendStatus'](_0x2217e4);}return _0x2b1cd8[_0xbd3b('0x14')](_0x2217e4)[_0xbd3b('0x15')]();};}function respondWithResult(_0x497aa9,_0x1d1daf){_0x1d1daf=_0x1d1daf||0xc8;return function(_0x539001){if(_0x539001){return _0x497aa9[_0xbd3b('0x14')](_0x1d1daf)[_0xbd3b('0x16')](_0x539001);}};}function respondWithFilteredResult(_0x2ef85c,_0x57b396){return function(_0x204116){if(_0x204116){var _0x38f8e3=typeof _0x57b396[_0xbd3b('0x17')]==='undefined'&&typeof _0x57b396[_0xbd3b('0x18')]==='undefined';var _0x5634e4=_0x204116['count'];var _0x57a25c=_0x38f8e3?0x0:_0x57b396[_0xbd3b('0x17')];var _0x48f4e6=_0x38f8e3?_0x204116[_0xbd3b('0x19')]:_0x57b396[_0xbd3b('0x17')]+_0x57b396['limit'];var _0x1781f5;if(_0x48f4e6>=_0x5634e4){_0x48f4e6=_0x5634e4;_0x1781f5=0xc8;}else{_0x1781f5=0xce;}_0x2ef85c[_0xbd3b('0x14')](_0x1781f5);return _0x2ef85c[_0xbd3b('0x1a')](_0xbd3b('0x1b'),_0x57a25c+'-'+_0x48f4e6+'/'+_0x5634e4)['json'](_0x204116);}return null;};}function patchUpdates(_0x1d20be){return function(_0x259746){try{jsonpatch[_0xbd3b('0x1c')](_0x259746,_0x1d20be,!![]);}catch(_0x413d6c){return BPromise[_0xbd3b('0x1d')](_0x413d6c);}return _0x259746['save']();};}function saveUpdates(_0x57c204,_0x5251da){return function(_0x59e193){if(_0x59e193){return _0x59e193[_0xbd3b('0x1e')](_0x57c204)['then'](function(_0x3ae756){return _0x3ae756;});}return null;};}function removeEntity(_0x5967a8,_0x47a148){return function(_0x2f8880){if(_0x2f8880){return _0x2f8880[_0xbd3b('0x1f')]()[_0xbd3b('0x20')](function(){var _0x20bed4=_0x2f8880[_0xbd3b('0x21')]({'plain':!![]});var _0x302c2c=_0xbd3b('0x22');return db[_0xbd3b('0x23')]['destroy']({'where':{'type':_0x302c2c,'resourceId':_0x20bed4['id']}})[_0xbd3b('0x20')](function(){return _0x2f8880;});})['then'](function(){_0x5967a8[_0xbd3b('0x14')](0xcc)[_0xbd3b('0x15')]();});}};}function handleEntityNotFound(_0x22eb37,_0x191cd3){return function(_0x3d2f74){if(!_0x3d2f74){_0x22eb37['sendStatus'](0x194);}return _0x3d2f74;};}function handleError(_0x51912e,_0x73f792){_0x73f792=_0x73f792||0x1f4;return function(_0x31a23e){logger['error'](_0x31a23e['stack']);if(_0x31a23e[_0xbd3b('0x24')]){delete _0x31a23e['name'];}_0x51912e[_0xbd3b('0x14')](_0x73f792)[_0xbd3b('0x25')](_0x31a23e);};}exports[_0xbd3b('0x26')]=function(_0x3e4c93,_0x4d1f00){var _0x4fd29d={},_0x6d1ab2={},_0x19e0ae={'count':0x0,'rows':[]};var _0x29abb5=_['map'](db[_0xbd3b('0x27')][_0xbd3b('0x28')],function(_0x5b215b){return{'name':_0x5b215b[_0xbd3b('0x29')],'type':_0x5b215b['type'][_0xbd3b('0x2a')]};});_0x6d1ab2['model']=_[_0xbd3b('0x2b')](_0x29abb5,_0xbd3b('0x24'));_0x6d1ab2[_0xbd3b('0x2c')]=_[_0xbd3b('0x2d')](_0x3e4c93['query']);_0x6d1ab2[_0xbd3b('0x2e')]=_[_0xbd3b('0x2f')](_0x6d1ab2['model'],_0x6d1ab2[_0xbd3b('0x2c')]);_0x4fd29d[_0xbd3b('0x30')]=_[_0xbd3b('0x2f')](_0x6d1ab2['model'],qs[_0xbd3b('0x31')](_0x3e4c93[_0xbd3b('0x2c')][_0xbd3b('0x31')]));_0x4fd29d[_0xbd3b('0x30')]=_0x4fd29d['attributes'][_0xbd3b('0x32')]?_0x4fd29d[_0xbd3b('0x30')]:_0x6d1ab2[_0xbd3b('0x33')];if(!_0x3e4c93[_0xbd3b('0x2c')][_0xbd3b('0x34')]('nolimit')){_0x4fd29d['limit']=qs[_0xbd3b('0x18')](_0x3e4c93['query'][_0xbd3b('0x18')]);_0x4fd29d[_0xbd3b('0x17')]=qs[_0xbd3b('0x17')](_0x3e4c93[_0xbd3b('0x2c')][_0xbd3b('0x17')]);}_0x4fd29d[_0xbd3b('0x35')]=qs['sort'](_0x3e4c93[_0xbd3b('0x2c')]['sort']);_0x4fd29d['where']=qs[_0xbd3b('0x2e')](_['pick'](_0x3e4c93[_0xbd3b('0x2c')],_0x6d1ab2[_0xbd3b('0x2e')]),_0x29abb5);if(_0x3e4c93[_0xbd3b('0x2c')]['filter']){_0x4fd29d[_0xbd3b('0x36')]=_[_0xbd3b('0x37')](_0x4fd29d[_0xbd3b('0x36')],{'$or':_[_0xbd3b('0x2b')](_0x29abb5,function(_0x3f9e14){if(_0x3f9e14[_0xbd3b('0x38')]!=='VIRTUAL'){var _0x259846={};_0x259846[_0x3f9e14['name']]={'$like':'%'+_0x3e4c93['query'][_0xbd3b('0x39')]+'%'};return _0x259846;}})});}_0x4fd29d=_[_0xbd3b('0x37')]({},_0x4fd29d,_0x3e4c93[_0xbd3b('0x3a')]);var _0x14dab6={'where':_0x4fd29d[_0xbd3b('0x36')]};return db['Template'][_0xbd3b('0x19')](_0x14dab6)[_0xbd3b('0x20')](function(_0x5a05cf){_0x19e0ae[_0xbd3b('0x19')]=_0x5a05cf;if(_0x3e4c93[_0xbd3b('0x2c')][_0xbd3b('0x3b')]){_0x4fd29d[_0xbd3b('0x3c')]=[{'all':!![]}];}return db[_0xbd3b('0x27')][_0xbd3b('0x3d')](_0x4fd29d);})[_0xbd3b('0x20')](function(_0xc1da41){_0x19e0ae['rows']=_0xc1da41;return _0x19e0ae;})[_0xbd3b('0x20')](respondWithFilteredResult(_0x4d1f00,_0x4fd29d))[_0xbd3b('0x3e')](handleError(_0x4d1f00,null));};exports[_0xbd3b('0x3f')]=function(_0x3807ea,_0x7364cc){var _0x100f7d={'raw':!![],'where':{'id':_0x3807ea['params']['id']}},_0x4b3973={};_0x4b3973[_0xbd3b('0x33')]=_[_0xbd3b('0x2d')](db[_0xbd3b('0x27')][_0xbd3b('0x28')]);_0x4b3973[_0xbd3b('0x2c')]=_[_0xbd3b('0x2d')](_0x3807ea[_0xbd3b('0x2c')]);_0x4b3973[_0xbd3b('0x2e')]=_[_0xbd3b('0x2f')](_0x4b3973[_0xbd3b('0x33')],_0x4b3973[_0xbd3b('0x2c')]);_0x100f7d[_0xbd3b('0x30')]=_[_0xbd3b('0x2f')](_0x4b3973['model'],qs[_0xbd3b('0x31')](_0x3807ea[_0xbd3b('0x2c')][_0xbd3b('0x31')]));_0x100f7d[_0xbd3b('0x30')]=_0x100f7d[_0xbd3b('0x30')][_0xbd3b('0x32')]?_0x100f7d[_0xbd3b('0x30')]:_0x4b3973[_0xbd3b('0x33')];if(_0x3807ea['query'][_0xbd3b('0x3b')]){_0x100f7d['include']=[{'all':!![]}];}_0x100f7d=_[_0xbd3b('0x37')]({},_0x100f7d,_0x3807ea[_0xbd3b('0x3a')]);return db[_0xbd3b('0x27')]['find'](_0x100f7d)[_0xbd3b('0x20')](handleEntityNotFound(_0x7364cc,null))[_0xbd3b('0x20')](respondWithResult(_0x7364cc,null))['catch'](handleError(_0x7364cc,null));};exports[_0xbd3b('0x40')]=function(_0x45cb12,_0x1ab2c6){return db[_0xbd3b('0x27')][_0xbd3b('0x40')](_0x45cb12['body'],{})[_0xbd3b('0x20')](function(_0x474e64){var _0x5ec221=_0x45cb12[_0xbd3b('0x41')]['get']({'plain':!![]});if(!_0x5ec221)throw new Error(_0xbd3b('0x42'));if(_0x5ec221['role']===_0xbd3b('0x41')){var _0xb2c294=_0x474e64['get']({'plain':!![]});var _0x120931=_0xbd3b('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x120931,'userProfileId':_0x5ec221[_0xbd3b('0x43')]},'raw':!![]})[_0xbd3b('0x20')](function(_0x1eb553){if(_0x1eb553&&_0x1eb553[_0xbd3b('0x44')]===0x0){return db['UserProfileResource'][_0xbd3b('0x40')]({'name':_0xb2c294[_0xbd3b('0x24')],'resourceId':_0xb2c294['id'],'type':_0x1eb553[_0xbd3b('0x24')],'sectionId':_0x1eb553['id']},{})[_0xbd3b('0x20')](function(){return _0x474e64;});}else{return _0x474e64;}})[_0xbd3b('0x3e')](function(_0x2c0d05){logger['error'](_0xbd3b('0x45'),_0x2c0d05);throw _0x2c0d05;});}return _0x474e64;})[_0xbd3b('0x20')](respondWithResult(_0x1ab2c6,0xc9))['catch'](handleError(_0x1ab2c6,null));};exports[_0xbd3b('0x1e')]=function(_0x57709a,_0x4ecc87){if(_0x57709a[_0xbd3b('0x46')]['id']){delete _0x57709a[_0xbd3b('0x46')]['id'];}return db['Template']['find']({'where':{'id':_0x57709a['params']['id']}})[_0xbd3b('0x20')](handleEntityNotFound(_0x4ecc87,null))[_0xbd3b('0x20')](saveUpdates(_0x57709a[_0xbd3b('0x46')],null))[_0xbd3b('0x20')](respondWithResult(_0x4ecc87,null))[_0xbd3b('0x3e')](handleError(_0x4ecc87,null));};exports[_0xbd3b('0x1f')]=function(_0x178711,_0x329e34){return db[_0xbd3b('0x27')][_0xbd3b('0x47')]({'where':{'id':_0x178711['params']['id']}})[_0xbd3b('0x20')](handleEntityNotFound(_0x329e34,null))[_0xbd3b('0x20')](removeEntity(_0x329e34,null))[_0xbd3b('0x3e')](handleError(_0x329e34,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f536788..9f41ca0 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 _0x137e=['tools_templates','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template'];(function(_0x1b1712,_0x218ba6){var _0x29fe45=function(_0x37df32){while(--_0x37df32){_0x1b1712['push'](_0x1b1712['shift']());}};_0x29fe45(++_0x218ba6);}(_0x137e,0x153));var _0xe137=function(_0x56c4a0,_0x14b991){_0x56c4a0=_0x56c4a0-0x0;var _0x2a0878=_0x137e[_0x56c4a0];return _0x2a0878;};'use strict';var _=require(_0xe137('0x0'));var util=require('util');var logger=require(_0xe137('0x1'))(_0xe137('0x2'));var moment=require(_0xe137('0x3'));var BPromise=require(_0xe137('0x4'));var rp=require(_0xe137('0x5'));var fs=require('fs');var path=require(_0xe137('0x6'));var rimraf=require(_0xe137('0x7'));var config=require(_0xe137('0x8'));var attributes=require(_0xe137('0x9'));module['exports']=function(_0x23b2e7,_0x31d8f4){return _0x23b2e7[_0xe137('0xa')](_0xe137('0xb'),attributes,{'tableName':_0xe137('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9fb=['path','rimraf','../../config/environment','./template.attributes','tools_templates','lodash','util','api','bluebird','request-promise'];(function(_0xeea013,_0x3332c8){var _0x555d2e=function(_0x3b3797){while(--_0x3b3797){_0xeea013['push'](_0xeea013['shift']());}};_0x555d2e(++_0x3332c8);}(_0xa9fb,0x1b3));var _0xba9f=function(_0x25100c,_0x582cdd){_0x25100c=_0x25100c-0x0;var _0x2ff451=_0xa9fb[_0x25100c];return _0x2ff451;};'use strict';var _=require(_0xba9f('0x0'));var util=require(_0xba9f('0x1'));var logger=require('../../config/logger')(_0xba9f('0x2'));var moment=require('moment');var BPromise=require(_0xba9f('0x3'));var rp=require(_0xba9f('0x4'));var fs=require('fs');var path=require(_0xba9f('0x5'));var rimraf=require(_0xba9f('0x6'));var config=require(_0xba9f('0x7'));var attributes=require(_0xba9f('0x8'));module['exports']=function(_0x1d3729,_0x273b6c){return _0x1d3729['define']('Template',attributes,{'tableName':_0xba9f('0x9'),'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 3927056..aa88855 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 _0x2c5d=['debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','findAll','options','raw','where','attributes','limit','map','include','model','then','GetTemplate','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','Template,\x20%s,\x20%s','request\x20sent'];(function(_0x1c7ce4,_0x237a83){var _0x5117d0=function(_0x4c7ae3){while(--_0x4c7ae3){_0x1c7ce4['push'](_0x1c7ce4['shift']());}};_0x5117d0(++_0x237a83);}(_0x2c5d,0x133));var _0xd2c5=function(_0xfd3d1e,_0xe1344e){_0xfd3d1e=_0xfd3d1e-0x0;var _0x5c8fe5=_0x2c5d[_0xfd3d1e];return _0x5c8fe5;};'use strict';var _=require(_0xd2c5('0x0'));var util=require('util');var moment=require(_0xd2c5('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2c5('0x2'));var fs=require('fs');var Redis=require(_0xd2c5('0x3'));var db=require(_0xd2c5('0x4'))['db'];var utils=require(_0xd2c5('0x5'));var logger=require(_0xd2c5('0x6'))('rpc');var config=require(_0xd2c5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2c5('0x8')][_0xd2c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20dd1b,_0xc266ce,_0x8f040d){return new BPromise(function(_0x5e1214,_0x116d29){return client['request'](_0x20dd1b,_0x8f040d)['then'](function(_0x1a74ce){logger[_0xd2c5('0xa')](_0xd2c5('0xb'),_0xc266ce,_0xd2c5('0xc'));logger[_0xd2c5('0xd')](_0xd2c5('0xe'),_0xc266ce,'request\x20sent',JSON[_0xd2c5('0xf')](_0x1a74ce));if(_0x1a74ce[_0xd2c5('0x10')]){if(_0x1a74ce[_0xd2c5('0x10')]['code']===0x1f4){logger['error'](_0xd2c5('0xb'),_0xc266ce,_0x1a74ce[_0xd2c5('0x10')][_0xd2c5('0x11')]);return _0x116d29(_0x1a74ce[_0xd2c5('0x10')][_0xd2c5('0x11')]);}logger['error'](_0xd2c5('0xb'),_0xc266ce,_0x1a74ce['error'][_0xd2c5('0x11')]);return _0x5e1214(_0x1a74ce[_0xd2c5('0x10')][_0xd2c5('0x11')]);}else{logger[_0xd2c5('0xa')](_0xd2c5('0xb'),_0xc266ce,'request\x20sent');_0x5e1214(_0x1a74ce[_0xd2c5('0x12')][_0xd2c5('0x11')]);}})[_0xd2c5('0x13')](function(_0x270577){logger[_0xd2c5('0x10')](_0xd2c5('0xb'),_0xc266ce,_0x270577);_0x116d29(_0x270577);});});}exports['GetTemplate']=function(_0x32eff4){var _0x598fe5=this;return new Promise(function(_0x232e26,_0x6a9be4){return db[_0xd2c5('0x14')][_0xd2c5('0x15')]({'raw':_0x32eff4[_0xd2c5('0x16')]?_0x32eff4[_0xd2c5('0x16')][_0xd2c5('0x17')]===undefined?!![]:![]:!![],'where':_0x32eff4[_0xd2c5('0x16')]?_0x32eff4[_0xd2c5('0x16')][_0xd2c5('0x18')]||null:null,'attributes':_0x32eff4['options']?_0x32eff4[_0xd2c5('0x16')][_0xd2c5('0x19')]||null:null,'limit':_0x32eff4[_0xd2c5('0x16')]?_0x32eff4[_0xd2c5('0x16')][_0xd2c5('0x1a')]||null:null,'include':_0x32eff4[_0xd2c5('0x16')]?_0x32eff4['options']['include']?_[_0xd2c5('0x1b')](_0x32eff4[_0xd2c5('0x16')][_0xd2c5('0x1c')],function(_0xbc08a2){return{'model':db[_0xbc08a2['model']],'as':_0xbc08a2['as'],'attributes':_0xbc08a2[_0xd2c5('0x19')],'include':_0xbc08a2['include']?_[_0xd2c5('0x1b')](_0xbc08a2['include'],function(_0x17b41e){return{'model':db[_0x17b41e[_0xd2c5('0x1d')]],'as':_0x17b41e['as'],'attributes':_0x17b41e['attributes'],'include':_0x17b41e[_0xd2c5('0x1c')]?_[_0xd2c5('0x1b')](_0x17b41e[_0xd2c5('0x1c')],function(_0x4e2e3d){return{'model':db[_0x4e2e3d[_0xd2c5('0x1d')]],'as':_0x4e2e3d['as'],'attributes':_0x4e2e3d['attributes']};}):[]};}):[]};}):[]:[]})[_0xd2c5('0x1e')](function(_0x517778){logger[_0xd2c5('0xa')](_0xd2c5('0x1f'),_0x32eff4);logger[_0xd2c5('0xd')](_0xd2c5('0x1f'),_0x32eff4,JSON[_0xd2c5('0xf')](_0x517778));_0x232e26(_0x517778);})[_0xd2c5('0x13')](function(_0x2e45d5){logger[_0xd2c5('0x10')]('GetTemplate',_0x2e45d5['message'],_0x32eff4);_0x6a9be4(_0x598fe5[_0xd2c5('0x10')](0x1f4,_0x2e45d5['message']));});});}; \ No newline at end of file +var _0xf7f5=['../../config/environment','jayson/promise','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit','map','include','model','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xf7f5,0x7d));var _0x5f7f=function(_0x5d3cc1,_0x164096){_0x5d3cc1=_0x5d3cc1-0x0;var _0x1581a7=_0xf7f5[_0x5d3cc1];return _0x1581a7;};'use strict';var _=require(_0x5f7f('0x0'));var util=require('util');var moment=require(_0x5f7f('0x1'));var BPromise=require(_0x5f7f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f7f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f7f('0x4'));var logger=require(_0x5f7f('0x5'))(_0x5f7f('0x6'));var config=require(_0x5f7f('0x7'));var jayson=require(_0x5f7f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4950bd,_0x3e65e2,_0x290bdb){return new BPromise(function(_0x52fe6f,_0x22e27d){return client[_0x5f7f('0x9')](_0x4950bd,_0x290bdb)[_0x5f7f('0xa')](function(_0x37b5a9){logger[_0x5f7f('0xb')](_0x5f7f('0xc'),_0x3e65e2,'request\x20sent');logger[_0x5f7f('0xd')](_0x5f7f('0xe'),_0x3e65e2,_0x5f7f('0xf'),JSON[_0x5f7f('0x10')](_0x37b5a9));if(_0x37b5a9[_0x5f7f('0x11')]){if(_0x37b5a9[_0x5f7f('0x11')][_0x5f7f('0x12')]===0x1f4){logger[_0x5f7f('0x11')](_0x5f7f('0xc'),_0x3e65e2,_0x37b5a9[_0x5f7f('0x11')][_0x5f7f('0x13')]);return _0x22e27d(_0x37b5a9[_0x5f7f('0x11')][_0x5f7f('0x13')]);}logger[_0x5f7f('0x11')](_0x5f7f('0xc'),_0x3e65e2,_0x37b5a9['error']['message']);return _0x52fe6f(_0x37b5a9[_0x5f7f('0x11')][_0x5f7f('0x13')]);}else{logger[_0x5f7f('0xb')]('Template,\x20%s,\x20%s',_0x3e65e2,'request\x20sent');_0x52fe6f(_0x37b5a9[_0x5f7f('0x14')][_0x5f7f('0x13')]);}})[_0x5f7f('0x15')](function(_0x4a8dc1){logger['error'](_0x5f7f('0xc'),_0x3e65e2,_0x4a8dc1);_0x22e27d(_0x4a8dc1);});});}exports[_0x5f7f('0x16')]=function(_0x47105a){var _0x559f49=this;return new Promise(function(_0x35f3a3,_0x4bd8fe){return db[_0x5f7f('0x17')][_0x5f7f('0x18')]({'raw':_0x47105a['options']?_0x47105a[_0x5f7f('0x19')][_0x5f7f('0x1a')]===undefined?!![]:![]:!![],'where':_0x47105a['options']?_0x47105a[_0x5f7f('0x19')][_0x5f7f('0x1b')]||null:null,'attributes':_0x47105a['options']?_0x47105a[_0x5f7f('0x19')][_0x5f7f('0x1c')]||null:null,'limit':_0x47105a[_0x5f7f('0x19')]?_0x47105a[_0x5f7f('0x19')][_0x5f7f('0x1d')]||null:null,'include':_0x47105a['options']?_0x47105a[_0x5f7f('0x19')]['include']?_[_0x5f7f('0x1e')](_0x47105a[_0x5f7f('0x19')][_0x5f7f('0x1f')],function(_0x2e48be){return{'model':db[_0x2e48be[_0x5f7f('0x20')]],'as':_0x2e48be['as'],'attributes':_0x2e48be['attributes'],'include':_0x2e48be[_0x5f7f('0x1f')]?_[_0x5f7f('0x1e')](_0x2e48be[_0x5f7f('0x1f')],function(_0x1e9c5d){return{'model':db[_0x1e9c5d[_0x5f7f('0x20')]],'as':_0x1e9c5d['as'],'attributes':_0x1e9c5d[_0x5f7f('0x1c')],'include':_0x1e9c5d[_0x5f7f('0x1f')]?_[_0x5f7f('0x1e')](_0x1e9c5d[_0x5f7f('0x1f')],function(_0x211fa8){return{'model':db[_0x211fa8['model']],'as':_0x211fa8['as'],'attributes':_0x211fa8['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f7f('0xa')](function(_0x26b663){logger[_0x5f7f('0xb')](_0x5f7f('0x16'),_0x47105a);logger[_0x5f7f('0xd')](_0x5f7f('0x16'),_0x47105a,JSON['stringify'](_0x26b663));_0x35f3a3(_0x26b663);})['catch'](function(_0x56231d){logger['error'](_0x5f7f('0x16'),_0x56231d[_0x5f7f('0x13')],_0x47105a);_0x4bd8fe(_0x559f49[_0x5f7f('0x11')](0x1f4,_0x56231d[_0x5f7f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index dca350e..50320c1 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 _0x500c=['index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated'];(function(_0x483e77,_0x433e9b){var _0x359df0=function(_0x3c3d57){while(--_0x3c3d57){_0x483e77['push'](_0x483e77['shift']());}};_0x359df0(++_0x433e9b);}(_0x500c,0x188));var _0xc500=function(_0x14b062,_0x105842){_0x14b062=_0x14b062-0x0;var _0x59ee7e=_0x500c[_0x14b062];return _0x59ee7e;};'use strict';var multer=require(_0xc500('0x0'));var util=require(_0xc500('0x1'));var path=require(_0xc500('0x2'));var timeout=require(_0xc500('0x3'));var express=require(_0xc500('0x4'));var router=express[_0xc500('0x5')]();var fs_extra=require(_0xc500('0x6'));var auth=require(_0xc500('0x7'));var interaction=require(_0xc500('0x8'));var config=require(_0xc500('0x9'));var controller=require(_0xc500('0xa'));router[_0xc500('0xb')]('/',auth[_0xc500('0xc')](),controller[_0xc500('0xd')]);router[_0xc500('0xb')]('/:id',auth[_0xc500('0xc')](),controller['show']);router[_0xc500('0xb')](_0xc500('0xe'),auth[_0xc500('0xc')](),controller[_0xc500('0xf')]);router[_0xc500('0xb')](_0xc500('0x10'),auth['isAuthenticated'](),controller[_0xc500('0x11')]);router['get'](_0xc500('0x12'),auth['isAuthenticated'](),controller['getActions']);router[_0xc500('0x13')]('/',auth[_0xc500('0xc')](),controller['create']);router[_0xc500('0x13')](_0xc500('0xe'),auth[_0xc500('0xc')](),controller[_0xc500('0x14')]);router[_0xc500('0x13')](_0xc500('0x10'),auth[_0xc500('0xc')](),controller[_0xc500('0x15')]);router['post'](_0xc500('0x12'),auth[_0xc500('0xc')](),controller['addAction']);router[_0xc500('0x16')](_0xc500('0x17'),auth[_0xc500('0xc')](),controller[_0xc500('0x18')]);router[_0xc500('0x19')](_0xc500('0x17'),auth[_0xc500('0xc')](),controller['destroy']);module[_0xc500('0x1a')]=router; \ No newline at end of file +var _0xd12a=['isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAnyCondition','put','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../config/environment','./trigger.controller','get','index','/:id'];(function(_0x357a32,_0x3f469a){var _0x24c956=function(_0x2c25f2){while(--_0x2c25f2){_0x357a32['push'](_0x357a32['shift']());}};_0x24c956(++_0x3f469a);}(_0xd12a,0x1f2));var _0xad12=function(_0x244a0c,_0x126dde){_0x244a0c=_0x244a0c-0x0;var _0x1d64a0=_0xd12a[_0x244a0c];return _0x1d64a0;};'use strict';var multer=require('multer');var util=require(_0xad12('0x0'));var path=require('path');var timeout=require(_0xad12('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xad12('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xad12('0x3'));var controller=require(_0xad12('0x4'));router[_0xad12('0x5')]('/',auth['isAuthenticated'](),controller[_0xad12('0x6')]);router[_0xad12('0x5')](_0xad12('0x7'),auth[_0xad12('0x8')](),controller['show']);router[_0xad12('0x5')](_0xad12('0x9'),auth['isAuthenticated'](),controller[_0xad12('0xa')]);router[_0xad12('0x5')](_0xad12('0xb'),auth[_0xad12('0x8')](),controller['getAnyConditions']);router[_0xad12('0x5')](_0xad12('0xc'),auth[_0xad12('0x8')](),controller[_0xad12('0xd')]);router[_0xad12('0xe')]('/',auth[_0xad12('0x8')](),controller[_0xad12('0xf')]);router[_0xad12('0xe')](_0xad12('0x9'),auth[_0xad12('0x8')](),controller['addAllCondition']);router['post'](_0xad12('0xb'),auth[_0xad12('0x8')](),controller[_0xad12('0x10')]);router[_0xad12('0xe')](_0xad12('0xc'),auth[_0xad12('0x8')](),controller['addAction']);router[_0xad12('0x11')](_0xad12('0x7'),auth['isAuthenticated'](),controller[_0xad12('0x12')]);router[_0xad12('0x13')](_0xad12('0x7'),auth[_0xad12('0x8')](),controller[_0xad12('0x14')]);module[_0xad12('0x15')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 4ee3069..5643384 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 _0x28c7=['STRING','BOOLEAN','exports'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x28c7,0x1a6));var _0x728c=function(_0x2aef8b,_0x239d21){_0x2aef8b=_0x2aef8b-0x0;var _0x3dcf70=_0x28c7[_0x2aef8b];return _0x3dcf70;};'use strict';var Sequelize=require('sequelize');module[_0x728c('0x0')]={'name':{'type':Sequelize[_0x728c('0x1')]},'channel':{'type':Sequelize[_0x728c('0x1')]},'description':{'type':Sequelize[_0x728c('0x1')]},'status':{'type':Sequelize[_0x728c('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ae3=['sequelize','exports','STRING','BOOLEAN'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0x6ae3,0xe8));var _0x36ae=function(_0x4536a7,_0x2782d4){_0x4536a7=_0x4536a7-0x0;var _0x514a27=_0x6ae3[_0x4536a7];return _0x514a27;};'use strict';var Sequelize=require(_0x36ae('0x0'));module[_0x36ae('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x36ae('0x2')]},'description':{'type':Sequelize[_0x36ae('0x2')]},'status':{'type':Sequelize[_0x36ae('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 6be722c..ad745ac 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 _0x465e=['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','offset','limit','count','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','user','role','Triggers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','hasOwnProperty','getAnyConditions','findOne','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3f97f7,_0x84731d){var _0x1b6b96=function(_0xaf3d09){while(--_0xaf3d09){_0x3f97f7['push'](_0x3f97f7['shift']());}};_0x1b6b96(++_0x84731d);}(_0x465e,0x169));var _0xe465=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0x465e[_0x15cdcb];return _0x37b069;};'use strict';var emlformat=require(_0xe465('0x0'));var rimraf=require(_0xe465('0x1'));var zipdir=require(_0xe465('0x2'));var jsonpatch=require(_0xe465('0x3'));var rp=require('request-promise');var moment=require(_0xe465('0x4'));var BPromise=require(_0xe465('0x5'));var Mustache=require(_0xe465('0x6'));var util=require('util');var path=require(_0xe465('0x7'));var sox=require(_0xe465('0x8'));var csv=require('to-csv');var ejs=require(_0xe465('0x9'));var fs=require('fs');var fs_extra=require(_0xe465('0xa'));var _=require(_0xe465('0xb'));var squel=require(_0xe465('0xc'));var crypto=require(_0xe465('0xd'));var jsforce=require(_0xe465('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe465('0xf'));var querystring=require(_0xe465('0x10'));var Papa=require(_0xe465('0x11'));var Redis=require(_0xe465('0x12'));var authService=require(_0xe465('0x13'));var qs=require(_0xe465('0x14'));var as=require(_0xe465('0x15'));var hardwareService=require(_0xe465('0x16'));var logger=require(_0xe465('0x17'))('api');var utils=require(_0xe465('0x18'));var config=require(_0xe465('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x79d3c2,_0x29a0af){_0x29a0af=_0x29a0af||0xcc;return function(_0x52f80d){if(_0x52f80d){return _0x79d3c2[_0xe465('0x1a')](_0x29a0af);}return _0x79d3c2[_0xe465('0x1b')](_0x29a0af)[_0xe465('0x1c')]();};}function respondWithResult(_0xe44cf,_0x3c4999){_0x3c4999=_0x3c4999||0xc8;return function(_0x45dd40){if(_0x45dd40){return _0xe44cf[_0xe465('0x1b')](_0x3c4999)[_0xe465('0x1d')](_0x45dd40);}};}function respondWithFilteredResult(_0xf4dbfe,_0xc94603){return function(_0x319fab){if(_0x319fab){var _0x583317=typeof _0xc94603[_0xe465('0x1e')]==='undefined'&&typeof _0xc94603[_0xe465('0x1f')]==='undefined';var _0x17b417=_0x319fab[_0xe465('0x20')];var _0x1cb03d=_0x583317?0x0:_0xc94603[_0xe465('0x1e')];var _0x1c51dd=_0x583317?_0x319fab[_0xe465('0x20')]:_0xc94603[_0xe465('0x1e')]+_0xc94603['limit'];var _0x6aec01;if(_0x1c51dd>=_0x17b417){_0x1c51dd=_0x17b417;_0x6aec01=0xc8;}else{_0x6aec01=0xce;}_0xf4dbfe[_0xe465('0x1b')](_0x6aec01);return _0xf4dbfe['set'](_0xe465('0x21'),_0x1cb03d+'-'+_0x1c51dd+'/'+_0x17b417)[_0xe465('0x1d')](_0x319fab);}return null;};}function patchUpdates(_0x581417){return function(_0x56e6a9){try{jsonpatch[_0xe465('0x22')](_0x56e6a9,_0x581417,!![]);}catch(_0x2cbf5b){return BPromise['reject'](_0x2cbf5b);}return _0x56e6a9[_0xe465('0x23')]();};}function saveUpdates(_0x5a25b5,_0x5d81e7){return function(_0x1abe68){if(_0x1abe68){return _0x1abe68[_0xe465('0x24')](_0x5a25b5)[_0xe465('0x25')](function(_0x52a069){return _0x52a069;});}return null;};}function removeEntity(_0x42dfc9,_0x4c4fd8){return function(_0x5af097){if(_0x5af097){return _0x5af097[_0xe465('0x26')]()[_0xe465('0x25')](function(){var _0x53e92b=_0x5af097[_0xe465('0x27')]({'plain':!![]});var _0x38f302='Triggers';return db[_0xe465('0x28')][_0xe465('0x26')]({'where':{'type':_0x38f302,'resourceId':_0x53e92b['id']}})[_0xe465('0x25')](function(){return _0x5af097;});})['then'](function(){_0x42dfc9[_0xe465('0x1b')](0xcc)[_0xe465('0x1c')]();});}};}function handleEntityNotFound(_0x556da0,_0x22fa33){return function(_0x41413b){if(!_0x41413b){_0x556da0[_0xe465('0x1a')](0x194);}return _0x41413b;};}function handleError(_0x890a7a,_0xab4977){_0xab4977=_0xab4977||0x1f4;return function(_0x31b739){logger[_0xe465('0x29')](_0x31b739[_0xe465('0x2a')]);if(_0x31b739[_0xe465('0x2b')]){delete _0x31b739[_0xe465('0x2b')];}_0x890a7a[_0xe465('0x1b')](_0xab4977)[_0xe465('0x2c')](_0x31b739);};}exports[_0xe465('0x2d')]=function(_0x501a1c,_0x3795d0){var _0x4d664c={},_0x1ebb84={},_0x282e97={'count':0x0,'rows':[]};var _0x44f638=_[_0xe465('0x2e')](db[_0xe465('0x2f')][_0xe465('0x30')],function(_0x4a979e){return{'name':_0x4a979e[_0xe465('0x31')],'type':_0x4a979e['type'][_0xe465('0x32')]};});_0x1ebb84['model']=_[_0xe465('0x2e')](_0x44f638,_0xe465('0x2b'));_0x1ebb84[_0xe465('0x33')]=_[_0xe465('0x34')](_0x501a1c[_0xe465('0x33')]);_0x1ebb84[_0xe465('0x35')]=_[_0xe465('0x36')](_0x1ebb84[_0xe465('0x37')],_0x1ebb84['query']);_0x4d664c[_0xe465('0x38')]=_[_0xe465('0x36')](_0x1ebb84[_0xe465('0x37')],qs[_0xe465('0x39')](_0x501a1c['query'][_0xe465('0x39')]));_0x4d664c[_0xe465('0x38')]=_0x4d664c['attributes'][_0xe465('0x3a')]?_0x4d664c['attributes']:_0x1ebb84['model'];if(!_0x501a1c[_0xe465('0x33')]['hasOwnProperty'](_0xe465('0x3b'))){_0x4d664c['limit']=qs[_0xe465('0x1f')](_0x501a1c[_0xe465('0x33')]['limit']);_0x4d664c['offset']=qs[_0xe465('0x1e')](_0x501a1c[_0xe465('0x33')][_0xe465('0x1e')]);}_0x4d664c[_0xe465('0x3c')]=qs[_0xe465('0x3d')](_0x501a1c['query'][_0xe465('0x3d')]);_0x4d664c[_0xe465('0x3e')]=qs[_0xe465('0x35')](_[_0xe465('0x3f')](_0x501a1c[_0xe465('0x33')],_0x1ebb84[_0xe465('0x35')]),_0x44f638);if(_0x501a1c['query'][_0xe465('0x40')]){_0x4d664c[_0xe465('0x3e')]=_[_0xe465('0x41')](_0x4d664c[_0xe465('0x3e')],{'$or':_[_0xe465('0x2e')](_0x44f638,function(_0x426030){if(_0x426030['type']!==_0xe465('0x42')){var _0x45f54f={};_0x45f54f[_0x426030['name']]={'$like':'%'+_0x501a1c[_0xe465('0x33')]['filter']+'%'};return _0x45f54f;}})});}_0x4d664c=_[_0xe465('0x41')]({},_0x4d664c,_0x501a1c[_0xe465('0x43')]);var _0xcb56b5={'where':_0x4d664c['where']};return db[_0xe465('0x2f')][_0xe465('0x20')](_0xcb56b5)[_0xe465('0x25')](function(_0x28f793){_0x282e97['count']=_0x28f793;if(_0x501a1c[_0xe465('0x33')][_0xe465('0x44')]){_0x4d664c[_0xe465('0x45')]=[{'all':!![]}];}return db[_0xe465('0x2f')][_0xe465('0x46')](_0x4d664c);})[_0xe465('0x25')](function(_0x2a0aa6){_0x282e97[_0xe465('0x47')]=_0x2a0aa6;return _0x282e97;})[_0xe465('0x25')](respondWithFilteredResult(_0x3795d0,_0x4d664c))['catch'](handleError(_0x3795d0,null));};exports['show']=function(_0x4df376,_0x1726ad){var _0x820915={'raw':![],'where':{'id':_0x4df376[_0xe465('0x48')]['id']}},_0xf94a8a={};_0xf94a8a['model']=_['keys'](db[_0xe465('0x2f')][_0xe465('0x30')]);_0xf94a8a[_0xe465('0x33')]=_[_0xe465('0x34')](_0x4df376[_0xe465('0x33')]);_0xf94a8a['filters']=_[_0xe465('0x36')](_0xf94a8a['model'],_0xf94a8a[_0xe465('0x33')]);_0x820915['attributes']=_['intersection'](_0xf94a8a[_0xe465('0x37')],qs['fields'](_0x4df376['query']['fields']));_0x820915[_0xe465('0x38')]=_0x820915[_0xe465('0x38')][_0xe465('0x3a')]?_0x820915[_0xe465('0x38')]:_0xf94a8a['model'];if(_0x4df376[_0xe465('0x33')]['includeAll']){_0x820915[_0xe465('0x45')]=[{'all':!![]}];}_0x820915=_[_0xe465('0x41')]({},_0x820915,_0x4df376[_0xe465('0x43')]);return db[_0xe465('0x2f')][_0xe465('0x49')](_0x820915)[_0xe465('0x25')](handleEntityNotFound(_0x1726ad,null))[_0xe465('0x25')](respondWithResult(_0x1726ad,null))[_0xe465('0x4a')](handleError(_0x1726ad,null));};exports[_0xe465('0x4b')]=function(_0xe65117,_0x2a5c74){return db[_0xe465('0x2f')][_0xe465('0x4b')](_0xe65117['body'],{})[_0xe465('0x25')](function(_0x2172ee){var _0x1aee39=_0xe65117[_0xe465('0x4c')][_0xe465('0x27')]({'plain':!![]});if(!_0x1aee39)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1aee39[_0xe465('0x4d')]===_0xe465('0x4c')){var _0xb4a9ef=_0x2172ee[_0xe465('0x27')]({'plain':!![]});var _0x49bf5d=_0xe465('0x4e');return db['UserProfileSection'][_0xe465('0x49')]({'where':{'name':_0x49bf5d,'userProfileId':_0x1aee39[_0xe465('0x4f')]},'raw':!![]})[_0xe465('0x25')](function(_0x2692dd){if(_0x2692dd&&_0x2692dd[_0xe465('0x50')]===0x0){return db[_0xe465('0x28')][_0xe465('0x4b')]({'name':_0xb4a9ef[_0xe465('0x2b')],'resourceId':_0xb4a9ef['id'],'type':_0x2692dd[_0xe465('0x2b')],'sectionId':_0x2692dd['id']},{})[_0xe465('0x25')](function(){return _0x2172ee;});}else{return _0x2172ee;}})[_0xe465('0x4a')](function(_0x349b2a){logger[_0xe465('0x29')](_0xe465('0x51'),_0x349b2a);throw _0x349b2a;});}return _0x2172ee;})[_0xe465('0x25')](respondWithResult(_0x2a5c74,0xc9))[_0xe465('0x4a')](handleError(_0x2a5c74,null));};exports[_0xe465('0x24')]=function(_0x11b5fe,_0x3fcbb4){if(_0x11b5fe[_0xe465('0x52')]['id']){delete _0x11b5fe[_0xe465('0x52')]['id'];}return db[_0xe465('0x2f')][_0xe465('0x49')]({'where':{'id':_0x11b5fe[_0xe465('0x48')]['id']}})[_0xe465('0x25')](handleEntityNotFound(_0x3fcbb4,null))[_0xe465('0x25')](saveUpdates(_0x11b5fe[_0xe465('0x52')],null))[_0xe465('0x25')](respondWithResult(_0x3fcbb4,null))[_0xe465('0x4a')](handleError(_0x3fcbb4,null));};exports['destroy']=function(_0x4b55b0,_0x1d84c7){return db[_0xe465('0x2f')][_0xe465('0x49')]({'where':{'id':_0x4b55b0['params']['id']}})[_0xe465('0x25')](handleEntityNotFound(_0x1d84c7,null))[_0xe465('0x25')](removeEntity(_0x1d84c7,null))['catch'](handleError(_0x1d84c7,null));};exports[_0xe465('0x53')]=function(_0x5f578f,_0x3d0370,_0x4da163){if(_0x5f578f[_0xe465('0x52')]['id']){delete _0x5f578f[_0xe465('0x52')]['id'];}return db[_0xe465('0x2f')][_0xe465('0x49')]({'where':{'id':_0x5f578f['params']['id']}})[_0xe465('0x25')](handleEntityNotFound(_0x3d0370,null))['then'](function(_0x554975){if(_0x554975){_0x5f578f[_0xe465('0x52')][_0xe465('0x54')]=_0x554975['id'];return db[_0xe465('0x55')][_0xe465('0x4b')](_0x5f578f['body']);}})['then'](respondWithResult(_0x3d0370,null))[_0xe465('0x4a')](handleError(_0x3d0370,null));};exports['addAnyCondition']=function(_0xc95373,_0x6cea8b,_0xf7ce29){if(_0xc95373[_0xe465('0x52')]['id']){delete _0xc95373[_0xe465('0x52')]['id'];}return db[_0xe465('0x2f')]['find']({'where':{'id':_0xc95373[_0xe465('0x48')]['id']}})['then'](handleEntityNotFound(_0x6cea8b,null))[_0xe465('0x25')](function(_0xafe40f){if(_0xafe40f){_0xc95373[_0xe465('0x52')][_0xe465('0x56')]=_0xafe40f['id'];return db['Condition'][_0xe465('0x4b')](_0xc95373[_0xe465('0x52')]);}})[_0xe465('0x25')](respondWithResult(_0x6cea8b,null))[_0xe465('0x4a')](handleError(_0x6cea8b,null));};exports[_0xe465('0x57')]=function(_0x3708ca,_0xfa9d8d,_0x30f2a9){var _0x5d13e3={};var _0x2d75b1={};var _0x24d3a5;var _0x10bf3c;return db[_0xe465('0x2f')]['findOne']({'where':{'id':_0x3708ca[_0xe465('0x48')]['id']}})[_0xe465('0x25')](handleEntityNotFound(_0xfa9d8d,null))[_0xe465('0x25')](function(_0x214067){if(_0x214067){_0x24d3a5=_0x214067;_0x2d75b1['model']=_[_0xe465('0x34')](db['Condition']['rawAttributes']);_0x2d75b1[_0xe465('0x33')]=_[_0xe465('0x34')](_0x3708ca[_0xe465('0x33')]);_0x2d75b1[_0xe465('0x35')]=_[_0xe465('0x36')](_0x2d75b1['model'],_0x2d75b1['query']);_0x5d13e3[_0xe465('0x38')]=_[_0xe465('0x36')](_0x2d75b1['model'],qs[_0xe465('0x39')](_0x3708ca[_0xe465('0x33')][_0xe465('0x39')]));_0x5d13e3['attributes']=_0x5d13e3[_0xe465('0x38')][_0xe465('0x3a')]?_0x5d13e3[_0xe465('0x38')]:_0x2d75b1[_0xe465('0x37')];_0x5d13e3[_0xe465('0x3c')]=qs[_0xe465('0x3d')](_0x3708ca[_0xe465('0x33')][_0xe465('0x3d')]);_0x5d13e3[_0xe465('0x3e')]=qs['filters'](_[_0xe465('0x3f')](_0x3708ca[_0xe465('0x33')],_0x2d75b1[_0xe465('0x35')]));if(_0x3708ca[_0xe465('0x33')]['filter']){_0x5d13e3[_0xe465('0x3e')]=_[_0xe465('0x41')](_0x5d13e3[_0xe465('0x3e')],{'$or':_[_0xe465('0x2e')](_0x5d13e3[_0xe465('0x38')],function(_0x58d1f9){var _0x4ccfb9={};_0x4ccfb9[_0x58d1f9]={'$like':'%'+_0x3708ca[_0xe465('0x33')][_0xe465('0x40')]+'%'};return _0x4ccfb9;})});}_0x5d13e3=_['merge']({},_0x5d13e3,_0x3708ca['options']);return _0x24d3a5[_0xe465('0x57')](_0x5d13e3);}})['then'](function(_0x35422a){if(_0x35422a){_0x10bf3c=_0x35422a['length'];if(!_0x3708ca[_0xe465('0x33')][_0xe465('0x58')](_0xe465('0x3b'))){_0x5d13e3[_0xe465('0x1f')]=qs[_0xe465('0x1f')](_0x3708ca['query'][_0xe465('0x1f')]);_0x5d13e3[_0xe465('0x1e')]=qs[_0xe465('0x1e')](_0x3708ca[_0xe465('0x33')][_0xe465('0x1e')]);}return _0x24d3a5[_0xe465('0x57')](_0x5d13e3);}})[_0xe465('0x25')](function(_0x52e343){if(_0x52e343){return _0x52e343?{'count':_0x10bf3c,'rows':_0x52e343}:null;}})['then'](respondWithResult(_0xfa9d8d,null))[_0xe465('0x4a')](handleError(_0xfa9d8d,null));};exports[_0xe465('0x59')]=function(_0x4f56fe,_0x214576,_0x5033a4){var _0xee77e2={};var _0x526f68={};var _0x5aa874;var _0x223455;return db[_0xe465('0x2f')][_0xe465('0x5a')]({'where':{'id':_0x4f56fe[_0xe465('0x48')]['id']}})[_0xe465('0x25')](handleEntityNotFound(_0x214576,null))[_0xe465('0x25')](function(_0x34d344){if(_0x34d344){_0x5aa874=_0x34d344;_0x526f68[_0xe465('0x37')]=_[_0xe465('0x34')](db[_0xe465('0x55')][_0xe465('0x30')]);_0x526f68[_0xe465('0x33')]=_[_0xe465('0x34')](_0x4f56fe['query']);_0x526f68[_0xe465('0x35')]=_[_0xe465('0x36')](_0x526f68[_0xe465('0x37')],_0x526f68['query']);_0xee77e2[_0xe465('0x38')]=_[_0xe465('0x36')](_0x526f68[_0xe465('0x37')],qs[_0xe465('0x39')](_0x4f56fe['query'][_0xe465('0x39')]));_0xee77e2[_0xe465('0x38')]=_0xee77e2[_0xe465('0x38')]['length']?_0xee77e2[_0xe465('0x38')]:_0x526f68['model'];_0xee77e2['order']=qs[_0xe465('0x3d')](_0x4f56fe[_0xe465('0x33')][_0xe465('0x3d')]);_0xee77e2[_0xe465('0x3e')]=qs[_0xe465('0x35')](_[_0xe465('0x3f')](_0x4f56fe[_0xe465('0x33')],_0x526f68[_0xe465('0x35')]));if(_0x4f56fe['query'][_0xe465('0x40')]){_0xee77e2[_0xe465('0x3e')]=_[_0xe465('0x41')](_0xee77e2[_0xe465('0x3e')],{'$or':_[_0xe465('0x2e')](_0xee77e2['attributes'],function(_0x4981cc){var _0x30f222={};_0x30f222[_0x4981cc]={'$like':'%'+_0x4f56fe[_0xe465('0x33')][_0xe465('0x40')]+'%'};return _0x30f222;})});}_0xee77e2=_[_0xe465('0x41')]({},_0xee77e2,_0x4f56fe[_0xe465('0x43')]);return _0x5aa874['getAnyConditions'](_0xee77e2);}})[_0xe465('0x25')](function(_0x8cf090){if(_0x8cf090){_0x223455=_0x8cf090[_0xe465('0x3a')];if(!_0x4f56fe[_0xe465('0x33')][_0xe465('0x58')](_0xe465('0x3b'))){_0xee77e2[_0xe465('0x1f')]=qs[_0xe465('0x1f')](_0x4f56fe[_0xe465('0x33')][_0xe465('0x1f')]);_0xee77e2['offset']=qs[_0xe465('0x1e')](_0x4f56fe[_0xe465('0x33')][_0xe465('0x1e')]);}return _0x5aa874[_0xe465('0x59')](_0xee77e2);}})['then'](function(_0x2b3804){if(_0x2b3804){return _0x2b3804?{'count':_0x223455,'rows':_0x2b3804}:null;}})[_0xe465('0x25')](respondWithResult(_0x214576,null))['catch'](handleError(_0x214576,null));};exports['addAction']=function(_0x3d47d3,_0x5a9d36,_0x21d442){if(_0x3d47d3[_0xe465('0x52')]['id']){delete _0x3d47d3[_0xe465('0x52')]['id'];}return db[_0xe465('0x2f')]['find']({'where':{'id':_0x3d47d3[_0xe465('0x48')]['id']}})[_0xe465('0x25')](handleEntityNotFound(_0x5a9d36,null))[_0xe465('0x25')](function(_0x114304){if(_0x114304){_0x3d47d3[_0xe465('0x52')][_0xe465('0x5b')]=_0x114304['id'];return db['Action'][_0xe465('0x4b')](_0x3d47d3[_0xe465('0x52')]);}})['then'](respondWithResult(_0x5a9d36,null))['catch'](handleError(_0x5a9d36,null));};exports[_0xe465('0x5c')]=function(_0x268f4d,_0x7abad,_0x27ddab){var _0x82a5b8={};var _0x38db46={};var _0x7b8f1f;var _0x2f85e0;return db[_0xe465('0x2f')]['findOne']({'where':{'id':_0x268f4d[_0xe465('0x48')]['id']}})[_0xe465('0x25')](handleEntityNotFound(_0x7abad,null))[_0xe465('0x25')](function(_0x3dde03){if(_0x3dde03){_0x7b8f1f=_0x3dde03;_0x38db46[_0xe465('0x37')]=_['keys'](db[_0xe465('0x5d')][_0xe465('0x30')]);_0x38db46[_0xe465('0x33')]=_[_0xe465('0x34')](_0x268f4d[_0xe465('0x33')]);_0x38db46['filters']=_['intersection'](_0x38db46[_0xe465('0x37')],_0x38db46[_0xe465('0x33')]);_0x82a5b8['attributes']=_[_0xe465('0x36')](_0x38db46[_0xe465('0x37')],qs[_0xe465('0x39')](_0x268f4d[_0xe465('0x33')][_0xe465('0x39')]));_0x82a5b8[_0xe465('0x38')]=_0x82a5b8[_0xe465('0x38')][_0xe465('0x3a')]?_0x82a5b8['attributes']:_0x38db46[_0xe465('0x37')];_0x82a5b8[_0xe465('0x3c')]=qs[_0xe465('0x3d')](_0x268f4d[_0xe465('0x33')][_0xe465('0x3d')]);_0x82a5b8[_0xe465('0x3e')]=qs[_0xe465('0x35')](_[_0xe465('0x3f')](_0x268f4d['query'],_0x38db46['filters']));if(_0x268f4d[_0xe465('0x33')][_0xe465('0x40')]){_0x82a5b8['where']=_[_0xe465('0x41')](_0x82a5b8[_0xe465('0x3e')],{'$or':_['map'](_0x82a5b8[_0xe465('0x38')],function(_0x1ce9d5){var _0x5501e8={};_0x5501e8[_0x1ce9d5]={'$like':'%'+_0x268f4d['query'][_0xe465('0x40')]+'%'};return _0x5501e8;})});}_0x82a5b8=_[_0xe465('0x41')]({},_0x82a5b8,_0x268f4d[_0xe465('0x43')]);return _0x7b8f1f[_0xe465('0x5c')](_0x82a5b8);}})[_0xe465('0x25')](function(_0x409adf){if(_0x409adf){_0x2f85e0=_0x409adf['length'];if(!_0x268f4d[_0xe465('0x33')]['hasOwnProperty'](_0xe465('0x3b'))){_0x82a5b8[_0xe465('0x1f')]=qs[_0xe465('0x1f')](_0x268f4d[_0xe465('0x33')][_0xe465('0x1f')]);_0x82a5b8['offset']=qs[_0xe465('0x1e')](_0x268f4d[_0xe465('0x33')][_0xe465('0x1e')]);}return _0x7b8f1f[_0xe465('0x5c')](_0x82a5b8);}})[_0xe465('0x25')](function(_0x12d8ff){if(_0x12d8ff){return _0x12d8ff?{'count':_0x2f85e0,'rows':_0x12d8ff}:null;}})[_0xe465('0x25')](respondWithResult(_0x7abad,null))[_0xe465('0x4a')](handleError(_0x7abad,null));}; \ No newline at end of file +var _0x0576=['send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Trigger','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','Triggers','then','end','error','stack','name'];(function(_0x181945,_0x180cb8){var _0x3a129c=function(_0x4d3bef){while(--_0x4d3bef){_0x181945['push'](_0x181945['shift']());}};_0x3a129c(++_0x180cb8);}(_0x0576,0xf9));var _0x6057=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0576[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6057('0x0'));var rimraf=require(_0x6057('0x1'));var zipdir=require(_0x6057('0x2'));var jsonpatch=require(_0x6057('0x3'));var rp=require(_0x6057('0x4'));var moment=require(_0x6057('0x5'));var BPromise=require(_0x6057('0x6'));var Mustache=require(_0x6057('0x7'));var util=require('util');var path=require(_0x6057('0x8'));var sox=require(_0x6057('0x9'));var csv=require(_0x6057('0xa'));var ejs=require(_0x6057('0xb'));var fs=require('fs');var fs_extra=require(_0x6057('0xc'));var _=require('lodash');var squel=require(_0x6057('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6057('0xa'));var querystring=require(_0x6057('0xe'));var Papa=require(_0x6057('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6057('0x10'));var as=require(_0x6057('0x11'));var hardwareService=require(_0x6057('0x12'));var logger=require(_0x6057('0x13'))(_0x6057('0x14'));var utils=require(_0x6057('0x15'));var config=require(_0x6057('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x372a7d,_0xee7a6a){_0xee7a6a=_0xee7a6a||0xcc;return function(_0x2aca19){if(_0x2aca19){return _0x372a7d[_0x6057('0x17')](_0xee7a6a);}return _0x372a7d[_0x6057('0x18')](_0xee7a6a)['end']();};}function respondWithResult(_0x225cd5,_0x1482a5){_0x1482a5=_0x1482a5||0xc8;return function(_0x15762f){if(_0x15762f){return _0x225cd5['status'](_0x1482a5)[_0x6057('0x19')](_0x15762f);}};}function respondWithFilteredResult(_0x5ed61a,_0x5ed39e){return function(_0x18018b){if(_0x18018b){var _0x59987a=typeof _0x5ed39e[_0x6057('0x1a')]===_0x6057('0x1b')&&typeof _0x5ed39e[_0x6057('0x1c')]===_0x6057('0x1b');var _0x53744b=_0x18018b[_0x6057('0x1d')];var _0x5127bd=_0x59987a?0x0:_0x5ed39e[_0x6057('0x1a')];var _0x11c837=_0x59987a?_0x18018b[_0x6057('0x1d')]:_0x5ed39e[_0x6057('0x1a')]+_0x5ed39e['limit'];var _0x19b015;if(_0x11c837>=_0x53744b){_0x11c837=_0x53744b;_0x19b015=0xc8;}else{_0x19b015=0xce;}_0x5ed61a[_0x6057('0x18')](_0x19b015);return _0x5ed61a[_0x6057('0x1e')](_0x6057('0x1f'),_0x5127bd+'-'+_0x11c837+'/'+_0x53744b)[_0x6057('0x19')](_0x18018b);}return null;};}function patchUpdates(_0x224802){return function(_0x3559c4){try{jsonpatch['apply'](_0x3559c4,_0x224802,!![]);}catch(_0x12ee25){return BPromise[_0x6057('0x20')](_0x12ee25);}return _0x3559c4['save']();};}function saveUpdates(_0x4dbd05,_0x2d5edd){return function(_0x1b2978){if(_0x1b2978){return _0x1b2978[_0x6057('0x21')](_0x4dbd05)['then'](function(_0x54c878){return _0x54c878;});}return null;};}function removeEntity(_0x373f95,_0x48c4a2){return function(_0x21cb2e){if(_0x21cb2e){return _0x21cb2e[_0x6057('0x22')]()['then'](function(){var _0x3e1f4e=_0x21cb2e[_0x6057('0x23')]({'plain':!![]});var _0x3eae60=_0x6057('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x3eae60,'resourceId':_0x3e1f4e['id']}})[_0x6057('0x25')](function(){return _0x21cb2e;});})[_0x6057('0x25')](function(){_0x373f95[_0x6057('0x18')](0xcc)[_0x6057('0x26')]();});}};}function handleEntityNotFound(_0x1eaa08,_0x44f3aa){return function(_0x4eb8fc){if(!_0x4eb8fc){_0x1eaa08[_0x6057('0x17')](0x194);}return _0x4eb8fc;};}function handleError(_0x460c12,_0x532b12){_0x532b12=_0x532b12||0x1f4;return function(_0x3b1e79){logger[_0x6057('0x27')](_0x3b1e79[_0x6057('0x28')]);if(_0x3b1e79[_0x6057('0x29')]){delete _0x3b1e79[_0x6057('0x29')];}_0x460c12[_0x6057('0x18')](_0x532b12)[_0x6057('0x2a')](_0x3b1e79);};}exports[_0x6057('0x2b')]=function(_0xfecb21,_0x27ae94){var _0x54e57b={},_0x5e3f28={},_0x2176e0={'count':0x0,'rows':[]};var _0x54aed0=_[_0x6057('0x2c')](db['Trigger'][_0x6057('0x2d')],function(_0x577509){return{'name':_0x577509[_0x6057('0x2e')],'type':_0x577509[_0x6057('0x2f')][_0x6057('0x30')]};});_0x5e3f28[_0x6057('0x31')]=_[_0x6057('0x2c')](_0x54aed0,_0x6057('0x29'));_0x5e3f28[_0x6057('0x32')]=_[_0x6057('0x33')](_0xfecb21['query']);_0x5e3f28[_0x6057('0x34')]=_[_0x6057('0x35')](_0x5e3f28[_0x6057('0x31')],_0x5e3f28['query']);_0x54e57b['attributes']=_[_0x6057('0x35')](_0x5e3f28['model'],qs[_0x6057('0x36')](_0xfecb21[_0x6057('0x32')][_0x6057('0x36')]));_0x54e57b[_0x6057('0x37')]=_0x54e57b[_0x6057('0x37')][_0x6057('0x38')]?_0x54e57b['attributes']:_0x5e3f28['model'];if(!_0xfecb21[_0x6057('0x32')][_0x6057('0x39')]('nolimit')){_0x54e57b[_0x6057('0x1c')]=qs[_0x6057('0x1c')](_0xfecb21[_0x6057('0x32')][_0x6057('0x1c')]);_0x54e57b[_0x6057('0x1a')]=qs[_0x6057('0x1a')](_0xfecb21['query'][_0x6057('0x1a')]);}_0x54e57b[_0x6057('0x3a')]=qs[_0x6057('0x3b')](_0xfecb21['query'][_0x6057('0x3b')]);_0x54e57b[_0x6057('0x3c')]=qs[_0x6057('0x34')](_[_0x6057('0x3d')](_0xfecb21[_0x6057('0x32')],_0x5e3f28[_0x6057('0x34')]),_0x54aed0);if(_0xfecb21[_0x6057('0x32')][_0x6057('0x3e')]){_0x54e57b['where']=_[_0x6057('0x3f')](_0x54e57b[_0x6057('0x3c')],{'$or':_[_0x6057('0x2c')](_0x54aed0,function(_0x4135e4){if(_0x4135e4[_0x6057('0x2f')]!==_0x6057('0x40')){var _0x234adc={};_0x234adc[_0x4135e4[_0x6057('0x29')]]={'$like':'%'+_0xfecb21[_0x6057('0x32')][_0x6057('0x3e')]+'%'};return _0x234adc;}})});}_0x54e57b=_[_0x6057('0x3f')]({},_0x54e57b,_0xfecb21[_0x6057('0x41')]);var _0x19b3c0={'where':_0x54e57b['where']};return db[_0x6057('0x42')]['count'](_0x19b3c0)[_0x6057('0x25')](function(_0x2feca3){_0x2176e0[_0x6057('0x1d')]=_0x2feca3;if(_0xfecb21['query']['includeAll']){_0x54e57b[_0x6057('0x43')]=[{'all':!![]}];}return db[_0x6057('0x42')][_0x6057('0x44')](_0x54e57b);})[_0x6057('0x25')](function(_0x5853cd){_0x2176e0[_0x6057('0x45')]=_0x5853cd;return _0x2176e0;})[_0x6057('0x25')](respondWithFilteredResult(_0x27ae94,_0x54e57b))[_0x6057('0x46')](handleError(_0x27ae94,null));};exports[_0x6057('0x47')]=function(_0xa02b8c,_0x3bc7c4){var _0x14136f={'raw':![],'where':{'id':_0xa02b8c[_0x6057('0x48')]['id']}},_0x5e6597={};_0x5e6597[_0x6057('0x31')]=_['keys'](db[_0x6057('0x42')][_0x6057('0x2d')]);_0x5e6597[_0x6057('0x32')]=_[_0x6057('0x33')](_0xa02b8c[_0x6057('0x32')]);_0x5e6597[_0x6057('0x34')]=_['intersection'](_0x5e6597[_0x6057('0x31')],_0x5e6597['query']);_0x14136f[_0x6057('0x37')]=_[_0x6057('0x35')](_0x5e6597['model'],qs[_0x6057('0x36')](_0xa02b8c['query']['fields']));_0x14136f['attributes']=_0x14136f[_0x6057('0x37')][_0x6057('0x38')]?_0x14136f[_0x6057('0x37')]:_0x5e6597['model'];if(_0xa02b8c[_0x6057('0x32')][_0x6057('0x49')]){_0x14136f['include']=[{'all':!![]}];}_0x14136f=_[_0x6057('0x3f')]({},_0x14136f,_0xa02b8c[_0x6057('0x41')]);return db[_0x6057('0x42')][_0x6057('0x4a')](_0x14136f)[_0x6057('0x25')](handleEntityNotFound(_0x3bc7c4,null))[_0x6057('0x25')](respondWithResult(_0x3bc7c4,null))['catch'](handleError(_0x3bc7c4,null));};exports[_0x6057('0x4b')]=function(_0x4bed32,_0x371d3e){return db[_0x6057('0x42')][_0x6057('0x4b')](_0x4bed32['body'],{})['then'](function(_0x69a461){var _0x556241=_0x4bed32[_0x6057('0x4c')][_0x6057('0x23')]({'plain':!![]});if(!_0x556241)throw new Error(_0x6057('0x4d'));if(_0x556241[_0x6057('0x4e')]===_0x6057('0x4c')){var _0x141bd2=_0x69a461['get']({'plain':!![]});var _0x40eed6=_0x6057('0x24');return db[_0x6057('0x4f')][_0x6057('0x4a')]({'where':{'name':_0x40eed6,'userProfileId':_0x556241[_0x6057('0x50')]},'raw':!![]})[_0x6057('0x25')](function(_0x5e5611){if(_0x5e5611&&_0x5e5611[_0x6057('0x51')]===0x0){return db[_0x6057('0x52')]['create']({'name':_0x141bd2[_0x6057('0x29')],'resourceId':_0x141bd2['id'],'type':_0x5e5611[_0x6057('0x29')],'sectionId':_0x5e5611['id']},{})['then'](function(){return _0x69a461;});}else{return _0x69a461;}})[_0x6057('0x46')](function(_0x11c004){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11c004);throw _0x11c004;});}return _0x69a461;})[_0x6057('0x25')](respondWithResult(_0x371d3e,0xc9))[_0x6057('0x46')](handleError(_0x371d3e,null));};exports[_0x6057('0x21')]=function(_0x38c2f1,_0x5d8916){if(_0x38c2f1[_0x6057('0x53')]['id']){delete _0x38c2f1[_0x6057('0x53')]['id'];}return db[_0x6057('0x42')][_0x6057('0x4a')]({'where':{'id':_0x38c2f1[_0x6057('0x48')]['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x5d8916,null))['then'](saveUpdates(_0x38c2f1[_0x6057('0x53')],null))['then'](respondWithResult(_0x5d8916,null))['catch'](handleError(_0x5d8916,null));};exports[_0x6057('0x22')]=function(_0x1ba086,_0x1bf4a6){return db[_0x6057('0x42')][_0x6057('0x4a')]({'where':{'id':_0x1ba086[_0x6057('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bf4a6,null))[_0x6057('0x25')](removeEntity(_0x1bf4a6,null))[_0x6057('0x46')](handleError(_0x1bf4a6,null));};exports[_0x6057('0x54')]=function(_0x2310eb,_0x5d6d10,_0x371487){if(_0x2310eb[_0x6057('0x53')]['id']){delete _0x2310eb[_0x6057('0x53')]['id'];}return db['Trigger'][_0x6057('0x4a')]({'where':{'id':_0x2310eb[_0x6057('0x48')]['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x5d6d10,null))[_0x6057('0x25')](function(_0x5b315e){if(_0x5b315e){_0x2310eb[_0x6057('0x53')][_0x6057('0x55')]=_0x5b315e['id'];return db[_0x6057('0x56')][_0x6057('0x4b')](_0x2310eb['body']);}})[_0x6057('0x25')](respondWithResult(_0x5d6d10,null))['catch'](handleError(_0x5d6d10,null));};exports[_0x6057('0x57')]=function(_0x510dde,_0x3ae8e5,_0x319f9c){if(_0x510dde[_0x6057('0x53')]['id']){delete _0x510dde[_0x6057('0x53')]['id'];}return db[_0x6057('0x42')]['find']({'where':{'id':_0x510dde[_0x6057('0x48')]['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x3ae8e5,null))[_0x6057('0x25')](function(_0x3c6f1b){if(_0x3c6f1b){_0x510dde['body'][_0x6057('0x58')]=_0x3c6f1b['id'];return db[_0x6057('0x56')][_0x6057('0x4b')](_0x510dde[_0x6057('0x53')]);}})[_0x6057('0x25')](respondWithResult(_0x3ae8e5,null))[_0x6057('0x46')](handleError(_0x3ae8e5,null));};exports[_0x6057('0x59')]=function(_0x26adf7,_0x38a6e2,_0x3b7113){var _0x3a275a={};var _0x1a4b93={};var _0xe831e6;var _0x375883;return db[_0x6057('0x42')][_0x6057('0x5a')]({'where':{'id':_0x26adf7[_0x6057('0x48')]['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x38a6e2,null))[_0x6057('0x25')](function(_0x1dd014){if(_0x1dd014){_0xe831e6=_0x1dd014;_0x1a4b93[_0x6057('0x31')]=_['keys'](db[_0x6057('0x56')][_0x6057('0x2d')]);_0x1a4b93[_0x6057('0x32')]=_[_0x6057('0x33')](_0x26adf7[_0x6057('0x32')]);_0x1a4b93[_0x6057('0x34')]=_[_0x6057('0x35')](_0x1a4b93[_0x6057('0x31')],_0x1a4b93[_0x6057('0x32')]);_0x3a275a['attributes']=_[_0x6057('0x35')](_0x1a4b93[_0x6057('0x31')],qs[_0x6057('0x36')](_0x26adf7[_0x6057('0x32')][_0x6057('0x36')]));_0x3a275a[_0x6057('0x37')]=_0x3a275a[_0x6057('0x37')]['length']?_0x3a275a[_0x6057('0x37')]:_0x1a4b93[_0x6057('0x31')];_0x3a275a[_0x6057('0x3a')]=qs[_0x6057('0x3b')](_0x26adf7['query'][_0x6057('0x3b')]);_0x3a275a[_0x6057('0x3c')]=qs['filters'](_[_0x6057('0x3d')](_0x26adf7['query'],_0x1a4b93[_0x6057('0x34')]));if(_0x26adf7[_0x6057('0x32')][_0x6057('0x3e')]){_0x3a275a[_0x6057('0x3c')]=_[_0x6057('0x3f')](_0x3a275a[_0x6057('0x3c')],{'$or':_[_0x6057('0x2c')](_0x3a275a[_0x6057('0x37')],function(_0x33eb6b){var _0x28f550={};_0x28f550[_0x33eb6b]={'$like':'%'+_0x26adf7[_0x6057('0x32')]['filter']+'%'};return _0x28f550;})});}_0x3a275a=_[_0x6057('0x3f')]({},_0x3a275a,_0x26adf7[_0x6057('0x41')]);return _0xe831e6[_0x6057('0x59')](_0x3a275a);}})[_0x6057('0x25')](function(_0x496c84){if(_0x496c84){_0x375883=_0x496c84[_0x6057('0x38')];if(!_0x26adf7[_0x6057('0x32')][_0x6057('0x39')](_0x6057('0x5b'))){_0x3a275a[_0x6057('0x1c')]=qs['limit'](_0x26adf7['query'][_0x6057('0x1c')]);_0x3a275a['offset']=qs[_0x6057('0x1a')](_0x26adf7['query'][_0x6057('0x1a')]);}return _0xe831e6[_0x6057('0x59')](_0x3a275a);}})[_0x6057('0x25')](function(_0x581c10){if(_0x581c10){return _0x581c10?{'count':_0x375883,'rows':_0x581c10}:null;}})[_0x6057('0x25')](respondWithResult(_0x38a6e2,null))[_0x6057('0x46')](handleError(_0x38a6e2,null));};exports['getAnyConditions']=function(_0x2f19c2,_0x10d8b7,_0x597ea5){var _0x5817b4={};var _0x3ce1ad={};var _0x33fe12;var _0x3bb732;return db['Trigger']['findOne']({'where':{'id':_0x2f19c2['params']['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x10d8b7,null))[_0x6057('0x25')](function(_0x2c37a6){if(_0x2c37a6){_0x33fe12=_0x2c37a6;_0x3ce1ad[_0x6057('0x31')]=_[_0x6057('0x33')](db['Condition'][_0x6057('0x2d')]);_0x3ce1ad['query']=_[_0x6057('0x33')](_0x2f19c2['query']);_0x3ce1ad[_0x6057('0x34')]=_[_0x6057('0x35')](_0x3ce1ad[_0x6057('0x31')],_0x3ce1ad[_0x6057('0x32')]);_0x5817b4[_0x6057('0x37')]=_[_0x6057('0x35')](_0x3ce1ad[_0x6057('0x31')],qs['fields'](_0x2f19c2[_0x6057('0x32')][_0x6057('0x36')]));_0x5817b4[_0x6057('0x37')]=_0x5817b4[_0x6057('0x37')]['length']?_0x5817b4[_0x6057('0x37')]:_0x3ce1ad[_0x6057('0x31')];_0x5817b4['order']=qs['sort'](_0x2f19c2[_0x6057('0x32')]['sort']);_0x5817b4[_0x6057('0x3c')]=qs['filters'](_[_0x6057('0x3d')](_0x2f19c2[_0x6057('0x32')],_0x3ce1ad['filters']));if(_0x2f19c2[_0x6057('0x32')][_0x6057('0x3e')]){_0x5817b4[_0x6057('0x3c')]=_[_0x6057('0x3f')](_0x5817b4[_0x6057('0x3c')],{'$or':_['map'](_0x5817b4[_0x6057('0x37')],function(_0x4d94a1){var _0x5728a2={};_0x5728a2[_0x4d94a1]={'$like':'%'+_0x2f19c2[_0x6057('0x32')][_0x6057('0x3e')]+'%'};return _0x5728a2;})});}_0x5817b4=_[_0x6057('0x3f')]({},_0x5817b4,_0x2f19c2[_0x6057('0x41')]);return _0x33fe12[_0x6057('0x5c')](_0x5817b4);}})['then'](function(_0x58e7cd){if(_0x58e7cd){_0x3bb732=_0x58e7cd[_0x6057('0x38')];if(!_0x2f19c2[_0x6057('0x32')][_0x6057('0x39')](_0x6057('0x5b'))){_0x5817b4[_0x6057('0x1c')]=qs['limit'](_0x2f19c2['query'][_0x6057('0x1c')]);_0x5817b4['offset']=qs[_0x6057('0x1a')](_0x2f19c2[_0x6057('0x32')][_0x6057('0x1a')]);}return _0x33fe12[_0x6057('0x5c')](_0x5817b4);}})[_0x6057('0x25')](function(_0x2085ec){if(_0x2085ec){return _0x2085ec?{'count':_0x3bb732,'rows':_0x2085ec}:null;}})['then'](respondWithResult(_0x10d8b7,null))[_0x6057('0x46')](handleError(_0x10d8b7,null));};exports[_0x6057('0x5d')]=function(_0xe126f4,_0x10c01c,_0x4d16cb){if(_0xe126f4[_0x6057('0x53')]['id']){delete _0xe126f4['body']['id'];}return db[_0x6057('0x42')][_0x6057('0x4a')]({'where':{'id':_0xe126f4[_0x6057('0x48')]['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x10c01c,null))[_0x6057('0x25')](function(_0x1924ef){if(_0x1924ef){_0xe126f4[_0x6057('0x53')][_0x6057('0x5e')]=_0x1924ef['id'];return db['Action'][_0x6057('0x4b')](_0xe126f4[_0x6057('0x53')]);}})['then'](respondWithResult(_0x10c01c,null))['catch'](handleError(_0x10c01c,null));};exports[_0x6057('0x5f')]=function(_0x509851,_0x525259,_0x3eb25e){var _0x340c8d={};var _0x3950e4={};var _0x1db1fb;var _0x4dcda7;return db[_0x6057('0x42')][_0x6057('0x5a')]({'where':{'id':_0x509851[_0x6057('0x48')]['id']}})[_0x6057('0x25')](handleEntityNotFound(_0x525259,null))['then'](function(_0x4e91dc){if(_0x4e91dc){_0x1db1fb=_0x4e91dc;_0x3950e4[_0x6057('0x31')]=_[_0x6057('0x33')](db[_0x6057('0x60')][_0x6057('0x2d')]);_0x3950e4[_0x6057('0x32')]=_[_0x6057('0x33')](_0x509851['query']);_0x3950e4[_0x6057('0x34')]=_[_0x6057('0x35')](_0x3950e4[_0x6057('0x31')],_0x3950e4['query']);_0x340c8d[_0x6057('0x37')]=_['intersection'](_0x3950e4['model'],qs[_0x6057('0x36')](_0x509851['query']['fields']));_0x340c8d['attributes']=_0x340c8d['attributes'][_0x6057('0x38')]?_0x340c8d[_0x6057('0x37')]:_0x3950e4[_0x6057('0x31')];_0x340c8d[_0x6057('0x3a')]=qs[_0x6057('0x3b')](_0x509851['query'][_0x6057('0x3b')]);_0x340c8d['where']=qs['filters'](_[_0x6057('0x3d')](_0x509851['query'],_0x3950e4[_0x6057('0x34')]));if(_0x509851['query'][_0x6057('0x3e')]){_0x340c8d[_0x6057('0x3c')]=_[_0x6057('0x3f')](_0x340c8d[_0x6057('0x3c')],{'$or':_[_0x6057('0x2c')](_0x340c8d[_0x6057('0x37')],function(_0x165c10){var _0x5186af={};_0x5186af[_0x165c10]={'$like':'%'+_0x509851[_0x6057('0x32')][_0x6057('0x3e')]+'%'};return _0x5186af;})});}_0x340c8d=_['merge']({},_0x340c8d,_0x509851[_0x6057('0x41')]);return _0x1db1fb[_0x6057('0x5f')](_0x340c8d);}})['then'](function(_0x304245){if(_0x304245){_0x4dcda7=_0x304245[_0x6057('0x38')];if(!_0x509851[_0x6057('0x32')][_0x6057('0x39')](_0x6057('0x5b'))){_0x340c8d['limit']=qs[_0x6057('0x1c')](_0x509851['query'][_0x6057('0x1c')]);_0x340c8d[_0x6057('0x1a')]=qs[_0x6057('0x1a')](_0x509851[_0x6057('0x32')][_0x6057('0x1a')]);}return _0x1db1fb[_0x6057('0x5f')](_0x340c8d);}})[_0x6057('0x25')](function(_0x398b35){if(_0x398b35){return _0x398b35?{'count':_0x4dcda7,'rows':_0x398b35}:null;}})[_0x6057('0x25')](respondWithResult(_0x525259,null))[_0x6057('0x46')](handleError(_0x525259,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index faa6346..f848568 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 _0x63bb=['tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./trigger.attributes','exports','define','Trigger'];(function(_0x1b7251,_0x2f7e32){var _0x5c0d59=function(_0x207b18){while(--_0x207b18){_0x1b7251['push'](_0x1b7251['shift']());}};_0x5c0d59(++_0x2f7e32);}(_0x63bb,0xf8));var _0xb63b=function(_0x4286ad,_0x5a99ed){_0x4286ad=_0x4286ad-0x0;var _0x4382d3=_0x63bb[_0x4286ad];return _0x4382d3;};'use strict';var _=require(_0xb63b('0x0'));var util=require(_0xb63b('0x1'));var logger=require(_0xb63b('0x2'))(_0xb63b('0x3'));var moment=require(_0xb63b('0x4'));var BPromise=require(_0xb63b('0x5'));var rp=require(_0xb63b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb63b('0x7'));var attributes=require(_0xb63b('0x8'));module[_0xb63b('0x9')]=function(_0x22be29,_0x4fc464){return _0x22be29[_0xb63b('0xa')](_0xb63b('0xb'),attributes,{'tableName':_0xb63b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['util','../../config/logger','api','moment','path','rimraf','./trigger.attributes','exports','define','Trigger','tools_triggers'];(function(_0x3a5455,_0x7c9dc3){var _0x4f561f=function(_0xa17827){while(--_0xa17827){_0x3a5455['push'](_0x3a5455['shift']());}};_0x4f561f(++_0x7c9dc3);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xeb5d[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 0ad9b79..3cc06e9 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 _0x0490=['limit','include','map','model','then','debug','ShowTrigger','Trigger','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','findAll','options','raw','attributes'];(function(_0x6465b0,_0x45653a){var _0x4884fe=function(_0x427085){while(--_0x427085){_0x6465b0['push'](_0x6465b0['shift']());}};_0x4884fe(++_0x45653a);}(_0x0490,0x18a));var _0x0049=function(_0x280c03,_0x5ba994){_0x280c03=_0x280c03-0x0;var _0x5e271e=_0x0490[_0x280c03];return _0x5e271e;};'use strict';var _=require(_0x0049('0x0'));var util=require(_0x0049('0x1'));var moment=require('moment');var BPromise=require(_0x0049('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0049('0x3'));var db=require(_0x0049('0x4'))['db'];var utils=require(_0x0049('0x5'));var logger=require(_0x0049('0x6'))('rpc');var config=require(_0x0049('0x7'));var jayson=require(_0x0049('0x8'));var client=jayson[_0x0049('0x9')][_0x0049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x534168,_0x5b922b,_0x228d7c){return new BPromise(function(_0x6bf8a7,_0x1e1370){return client[_0x0049('0xb')](_0x534168,_0x228d7c)['then'](function(_0x2b398d){logger[_0x0049('0xc')](_0x0049('0xd'),_0x5b922b,_0x0049('0xe'));logger['debug'](_0x0049('0xf'),_0x5b922b,_0x0049('0xe'),JSON[_0x0049('0x10')](_0x2b398d));if(_0x2b398d[_0x0049('0x11')]){if(_0x2b398d[_0x0049('0x11')]['code']===0x1f4){logger[_0x0049('0x11')](_0x0049('0xd'),_0x5b922b,_0x2b398d['error'][_0x0049('0x12')]);return _0x1e1370(_0x2b398d[_0x0049('0x11')][_0x0049('0x12')]);}logger[_0x0049('0x11')](_0x0049('0xd'),_0x5b922b,_0x2b398d['error'][_0x0049('0x12')]);return _0x6bf8a7(_0x2b398d['error'][_0x0049('0x12')]);}else{logger[_0x0049('0xc')](_0x0049('0xd'),_0x5b922b,_0x0049('0xe'));_0x6bf8a7(_0x2b398d[_0x0049('0x13')][_0x0049('0x12')]);}})[_0x0049('0x14')](function(_0x4bedb4){logger['error'](_0x0049('0xd'),_0x5b922b,_0x4bedb4);_0x1e1370(_0x4bedb4);});});}exports[_0x0049('0x15')]=function(_0x118272){var _0x44e06b=this;return new Promise(function(_0x3beeb0,_0x19ce59){return db['Trigger'][_0x0049('0x16')]({'raw':_0x118272[_0x0049('0x17')]?_0x118272[_0x0049('0x17')][_0x0049('0x18')]===undefined?!![]:![]:!![],'where':_0x118272[_0x0049('0x17')]?_0x118272['options']['where']||null:null,'attributes':_0x118272[_0x0049('0x17')]?_0x118272['options'][_0x0049('0x19')]||null:null,'limit':_0x118272[_0x0049('0x17')]?_0x118272[_0x0049('0x17')][_0x0049('0x1a')]||null:null,'include':_0x118272[_0x0049('0x17')]?_0x118272[_0x0049('0x17')][_0x0049('0x1b')]?_[_0x0049('0x1c')](_0x118272[_0x0049('0x17')][_0x0049('0x1b')],function(_0x48e9ba){return{'model':db[_0x48e9ba[_0x0049('0x1d')]],'as':_0x48e9ba['as'],'attributes':_0x48e9ba[_0x0049('0x19')],'include':_0x48e9ba[_0x0049('0x1b')]?_['map'](_0x48e9ba[_0x0049('0x1b')],function(_0x2d13ef){return{'model':db[_0x2d13ef[_0x0049('0x1d')]],'as':_0x2d13ef['as'],'attributes':_0x2d13ef[_0x0049('0x19')],'include':_0x2d13ef[_0x0049('0x1b')]?_[_0x0049('0x1c')](_0x2d13ef[_0x0049('0x1b')],function(_0xff33af){return{'model':db[_0xff33af[_0x0049('0x1d')]],'as':_0xff33af['as'],'attributes':_0xff33af['attributes']};}):[]};}):[]};}):[]:[]})[_0x0049('0x1e')](function(_0x55871a){logger[_0x0049('0xc')]('GetTrigger',_0x118272);logger[_0x0049('0x1f')]('GetTrigger',_0x118272,JSON[_0x0049('0x10')](_0x55871a));_0x3beeb0(_0x55871a);})['catch'](function(_0xa8737d){logger[_0x0049('0x11')](_0x0049('0x15'),_0xa8737d['message'],_0x118272);_0x19ce59(_0x44e06b['error'](0x1f4,_0xa8737d[_0x0049('0x12')]));});});};exports[_0x0049('0x20')]=function(_0x5e3434){var _0x214cf9=this;return new Promise(function(_0x685edc,_0x9b6b9f){return db[_0x0049('0x21')][_0x0049('0x22')]({'raw':_0x5e3434[_0x0049('0x17')]?_0x5e3434[_0x0049('0x17')][_0x0049('0x18')]===undefined?!![]:![]:!![],'where':_0x5e3434[_0x0049('0x17')]?_0x5e3434[_0x0049('0x17')]['where']||null:null,'attributes':_0x5e3434[_0x0049('0x17')]?_0x5e3434[_0x0049('0x17')]['attributes']||null:null,'include':_0x5e3434[_0x0049('0x17')]?_0x5e3434[_0x0049('0x17')]['include']?_['map'](_0x5e3434[_0x0049('0x17')][_0x0049('0x1b')],function(_0x329d0d){return{'model':db[_0x329d0d[_0x0049('0x1d')]],'as':_0x329d0d['as'],'attributes':_0x329d0d['attributes'],'include':_0x329d0d['include']?_[_0x0049('0x1c')](_0x329d0d[_0x0049('0x1b')],function(_0x3ec991){return{'model':db[_0x3ec991[_0x0049('0x1d')]],'as':_0x3ec991['as'],'attributes':_0x3ec991[_0x0049('0x19')],'include':_0x3ec991[_0x0049('0x1b')]?_[_0x0049('0x1c')](_0x3ec991[_0x0049('0x1b')],function(_0x24d71d){return{'model':db[_0x24d71d[_0x0049('0x1d')]],'as':_0x24d71d['as'],'attributes':_0x24d71d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0049('0x1e')](function(_0x3fa58a){logger[_0x0049('0xc')]('ShowTrigger',_0x5e3434);logger['debug'](_0x0049('0x20'),_0x5e3434,JSON[_0x0049('0x10')](_0x3fa58a));_0x685edc(_0x3fa58a);})[_0x0049('0x14')](function(_0x5be841){logger[_0x0049('0x11')](_0x0049('0x20'),_0x5be841[_0x0049('0x12')],_0x5e3434);_0x9b6b9f(_0x214cf9[_0x0049('0x11')](0x1f4,_0x5be841[_0x0049('0x12')]));});});}; \ No newline at end of file +var _0x2d3f=['request\x20sent','error','code','message','info','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x5a1897,_0x207b70){var _0x119caf=function(_0x14b211){while(--_0x14b211){_0x5a1897['push'](_0x5a1897['shift']());}};_0x119caf(++_0x207b70);}(_0x2d3f,0x13c));var _0xf2d3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2d3f[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xf2d3('0x0'));var util=require(_0xf2d3('0x1'));var moment=require(_0xf2d3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2d3('0x4'))['db'];var utils=require(_0xf2d3('0x5'));var logger=require(_0xf2d3('0x6'))(_0xf2d3('0x7'));var config=require(_0xf2d3('0x8'));var jayson=require(_0xf2d3('0x9'));var client=jayson[_0xf2d3('0xa')][_0xf2d3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f7a94,_0x2c75eb,_0x30361d){return new BPromise(function(_0x327952,_0x5d810b){return client[_0xf2d3('0xc')](_0x3f7a94,_0x30361d)[_0xf2d3('0xd')](function(_0x197aa9){logger['info'](_0xf2d3('0xe'),_0x2c75eb,'request\x20sent');logger[_0xf2d3('0xf')](_0xf2d3('0x10'),_0x2c75eb,_0xf2d3('0x11'),JSON['stringify'](_0x197aa9));if(_0x197aa9[_0xf2d3('0x12')]){if(_0x197aa9['error'][_0xf2d3('0x13')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x2c75eb,_0x197aa9[_0xf2d3('0x12')][_0xf2d3('0x14')]);return _0x5d810b(_0x197aa9[_0xf2d3('0x12')]['message']);}logger[_0xf2d3('0x12')](_0xf2d3('0xe'),_0x2c75eb,_0x197aa9[_0xf2d3('0x12')][_0xf2d3('0x14')]);return _0x327952(_0x197aa9['error']['message']);}else{logger[_0xf2d3('0x15')]('Trigger,\x20%s,\x20%s',_0x2c75eb,'request\x20sent');_0x327952(_0x197aa9[_0xf2d3('0x16')][_0xf2d3('0x14')]);}})['catch'](function(_0x338829){logger['error'](_0xf2d3('0xe'),_0x2c75eb,_0x338829);_0x5d810b(_0x338829);});});}exports[_0xf2d3('0x17')]=function(_0x1e3366){var _0x1b8885=this;return new Promise(function(_0x22c4d0,_0x180ef1){return db[_0xf2d3('0x18')][_0xf2d3('0x19')]({'raw':_0x1e3366['options']?_0x1e3366[_0xf2d3('0x1a')][_0xf2d3('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e3366[_0xf2d3('0x1a')]?_0x1e3366[_0xf2d3('0x1a')][_0xf2d3('0x1c')]||null:null,'attributes':_0x1e3366[_0xf2d3('0x1a')]?_0x1e3366[_0xf2d3('0x1a')][_0xf2d3('0x1d')]||null:null,'limit':_0x1e3366[_0xf2d3('0x1a')]?_0x1e3366[_0xf2d3('0x1a')][_0xf2d3('0x1e')]||null:null,'include':_0x1e3366[_0xf2d3('0x1a')]?_0x1e3366['options'][_0xf2d3('0x1f')]?_[_0xf2d3('0x20')](_0x1e3366[_0xf2d3('0x1a')]['include'],function(_0x5b369d){return{'model':db[_0x5b369d[_0xf2d3('0x21')]],'as':_0x5b369d['as'],'attributes':_0x5b369d[_0xf2d3('0x1d')],'include':_0x5b369d['include']?_[_0xf2d3('0x20')](_0x5b369d[_0xf2d3('0x1f')],function(_0x568acf){return{'model':db[_0x568acf[_0xf2d3('0x21')]],'as':_0x568acf['as'],'attributes':_0x568acf[_0xf2d3('0x1d')],'include':_0x568acf[_0xf2d3('0x1f')]?_[_0xf2d3('0x20')](_0x568acf['include'],function(_0x14ec22){return{'model':db[_0x14ec22[_0xf2d3('0x21')]],'as':_0x14ec22['as'],'attributes':_0x14ec22['attributes']};}):[]};}):[]};}):[]:[]})[_0xf2d3('0xd')](function(_0x3e4fde){logger[_0xf2d3('0x15')](_0xf2d3('0x17'),_0x1e3366);logger[_0xf2d3('0xf')]('GetTrigger',_0x1e3366,JSON[_0xf2d3('0x22')](_0x3e4fde));_0x22c4d0(_0x3e4fde);})['catch'](function(_0x2b5605){logger['error'](_0xf2d3('0x17'),_0x2b5605[_0xf2d3('0x14')],_0x1e3366);_0x180ef1(_0x1b8885[_0xf2d3('0x12')](0x1f4,_0x2b5605[_0xf2d3('0x14')]));});});};exports['ShowTrigger']=function(_0x2ca7c0){var _0x551292=this;return new Promise(function(_0x2c5548,_0xe5725c){return db[_0xf2d3('0x18')]['find']({'raw':_0x2ca7c0['options']?_0x2ca7c0['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ca7c0[_0xf2d3('0x1a')]?_0x2ca7c0['options'][_0xf2d3('0x1c')]||null:null,'attributes':_0x2ca7c0[_0xf2d3('0x1a')]?_0x2ca7c0['options'][_0xf2d3('0x1d')]||null:null,'include':_0x2ca7c0['options']?_0x2ca7c0['options']['include']?_[_0xf2d3('0x20')](_0x2ca7c0[_0xf2d3('0x1a')][_0xf2d3('0x1f')],function(_0x37d672){return{'model':db[_0x37d672[_0xf2d3('0x21')]],'as':_0x37d672['as'],'attributes':_0x37d672[_0xf2d3('0x1d')],'include':_0x37d672[_0xf2d3('0x1f')]?_[_0xf2d3('0x20')](_0x37d672[_0xf2d3('0x1f')],function(_0x2da592){return{'model':db[_0x2da592[_0xf2d3('0x21')]],'as':_0x2da592['as'],'attributes':_0x2da592[_0xf2d3('0x1d')],'include':_0x2da592['include']?_['map'](_0x2da592[_0xf2d3('0x1f')],function(_0x5f816b){return{'model':db[_0x5f816b[_0xf2d3('0x21')]],'as':_0x5f816b['as'],'attributes':_0x5f816b[_0xf2d3('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x428fad){logger[_0xf2d3('0x15')](_0xf2d3('0x23'),_0x2ca7c0);logger[_0xf2d3('0xf')](_0xf2d3('0x23'),_0x2ca7c0,JSON['stringify'](_0x428fad));_0x2c5548(_0x428fad);})[_0xf2d3('0x24')](function(_0x5e229c){logger['error']('ShowTrigger',_0x5e229c['message'],_0x2ca7c0);_0xe5725c(_0x551292[_0xf2d3('0x12')](0x1f4,_0x5e229c['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index fe4bfec..ffc6b4f 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 _0x742e=['../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x482c95,_0x504190){var _0x38c2e8=function(_0x5685df){while(--_0x5685df){_0x482c95['push'](_0x482c95['shift']());}};_0x38c2e8(++_0x504190);}(_0x742e,0x93));var _0xe742=function(_0x1b9f66,_0x2da770){_0x1b9f66=_0x1b9f66-0x0;var _0x34262c=_0x742e[_0x1b9f66];return _0x34262c;};'use strict';var multer=require(_0xe742('0x0'));var util=require(_0xe742('0x1'));var path=require(_0xe742('0x2'));var timeout=require(_0xe742('0x3'));var express=require('express');var router=express[_0xe742('0x4')]();var fs_extra=require(_0xe742('0x5'));var auth=require(_0xe742('0x6'));var interaction=require(_0xe742('0x7'));var config=require(_0xe742('0x8'));var controller=require(_0xe742('0x9'));router['get']('/',auth[_0xe742('0xa')](),controller[_0xe742('0xb')]);router[_0xe742('0xc')](_0xe742('0xd'),auth[_0xe742('0xa')](),controller[_0xe742('0xe')]);router[_0xe742('0xf')](_0xe742('0x10'),auth[_0xe742('0xa')](),controller[_0xe742('0x11')]);router[_0xe742('0xf')]('/',auth[_0xe742('0xa')](),controller['create']);router['put']('/:id',auth[_0xe742('0xa')](),controller[_0xe742('0x12')]);router[_0xe742('0x13')](_0xe742('0xd'),auth[_0xe742('0xa')](),controller[_0xe742('0x14')]);module[_0xe742('0x15')]=router; \ No newline at end of file +var _0xde7d=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','post','isAuthenticated','clone','create','/:id','update','delete'];(function(_0x196f76,_0x22cafb){var _0x13ca7d=function(_0x31ca29){while(--_0x31ca29){_0x196f76['push'](_0x196f76['shift']());}};_0x13ca7d(++_0x22cafb);}(_0xde7d,0x140));var _0xdde7=function(_0x503bb9,_0x36802c){_0x503bb9=_0x503bb9-0x0;var _0x50c7e0=_0xde7d[_0x503bb9];return _0x50c7e0;};'use strict';var multer=require(_0xdde7('0x0'));var util=require('util');var path=require(_0xdde7('0x1'));var timeout=require(_0xdde7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdde7('0x3'));var auth=require(_0xdde7('0x4'));var interaction=require(_0xdde7('0x5'));var config=require(_0xdde7('0x6'));var controller=require(_0xdde7('0x7'));router[_0xdde7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdde7('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdde7('0x9')]('/:id/clone',auth[_0xdde7('0xa')](),controller[_0xdde7('0xb')]);router[_0xdde7('0x9')]('/',auth[_0xdde7('0xa')](),controller[_0xdde7('0xc')]);router['put'](_0xdde7('0xd'),auth[_0xdde7('0xa')](),controller[_0xdde7('0xe')]);router[_0xdde7('0xf')](_0xdde7('0xd'),auth[_0xdde7('0xa')](),controller['destroy']);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 2f1d78b..0918bc9 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 _0x1782=['join','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','certificate','active','passive','update,nonat','BOOLEAN','exports','STRING','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','getDataValue','transport','split','rfc2833','info','shortinfo','inband','yes','nonat','outgoing','nat'];(function(_0x188aaa,_0x8079d1){var _0x275557=function(_0x533efd){while(--_0x533efd){_0x188aaa['push'](_0x188aaa['shift']());}};_0x275557(++_0x8079d1);}(_0x1782,0x12f));var _0x2178=function(_0x55e9e1,_0x1b5fd2){_0x55e9e1=_0x55e9e1-0x0;var _0xb2897e=_0x1782[_0x55e9e1];return _0xb2897e;};'use strict';var Sequelize=require('sequelize');module[_0x2178('0x0')]={'name':{'type':Sequelize[_0x2178('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2178('0x2'),_0x2178('0x3'),'peer'),'allowNull':![],'defaultValue':_0x2178('0x2')},'context':{'type':Sequelize[_0x2178('0x1')],'allowNull':![],'defaultValue':_0x2178('0x4')},'callingpres':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x6'),_0x2178('0x7'),_0x2178('0x8'),_0x2178('0x9'),_0x2178('0xa'),_0x2178('0xb'),_0x2178('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x2178('0x1')]},'permit':{'type':Sequelize[_0x2178('0x1')]},'secret':{'type':Sequelize[_0x2178('0x1')]},'md5secret':{'type':Sequelize[_0x2178('0x1')]},'remotesecret':{'type':Sequelize[_0x2178('0x1')]},'transport':{'type':Sequelize[_0x2178('0x1')],'defaultValue':_0x2178('0xd'),'set':function(_0x13a4b7){this[_0x2178('0xe')]('transport',_0x13a4b7?_0x13a4b7['join'](','):null);},'get':function(){return this[_0x2178('0xf')]('transport')?this[_0x2178('0xf')](_0x2178('0x10'))[_0x2178('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2178('0x12'),_0x2178('0x13'),_0x2178('0x14'),_0x2178('0x15'),'auto'),'defaultValue':_0x2178('0x12')},'directmedia':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no',_0x2178('0x17'),'update',_0x2178('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2178('0x1')]},'directmediadeny':{'type':Sequelize[_0x2178('0x1')]},'nat':{'type':Sequelize[_0x2178('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x512b32){this[_0x2178('0xe')](_0x2178('0x19'),_0x512b32?_0x512b32[_0x2178('0x1a')](','):null);},'get':function(){return this[_0x2178('0xf')]('nat')?this[_0x2178('0xf')]('nat')[_0x2178('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x2178('0x1')]},'namedcallgroup':{'type':Sequelize[_0x2178('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2178('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2178('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2178('0x1b')},'allow':{'type':Sequelize[_0x2178('0x1')],'allowNull':![],'defaultValue':_0x2178('0x1c'),'set':function(_0x2eb4a1){this[_0x2178('0xe')]('allow',_0x2eb4a1?_0x2eb4a1[_0x2178('0x1a')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x2178('0x1d'))?this[_0x2178('0xf')](_0x2178('0x1d'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2178('0x5')]('yes','no')},'insecure':{'type':Sequelize[_0x2178('0x1')],'defaultValue':_0x2178('0x1e'),'set':function(_0x2cc215){this[_0x2178('0xe')](_0x2178('0x1f'),_0x2cc215?_0x2cc215[_0x2178('0x1a')](','):null);},'get':function(){return this[_0x2178('0xf')]('insecure')?this['getDataValue'](_0x2178('0x1f'))['split'](','):null;},'comment':_0x2178('0x20')},'trustrpid':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2178('0x5')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no',_0x2178('0x21'))},'promiscredir':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'accountcode':{'type':Sequelize[_0x2178('0x22')](0xb)},'setvar':{'type':Sequelize[_0x2178('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x2178('0x23')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x2178('0x16'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2178('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2178('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x2178('0x1')]},'template':{'type':Sequelize[_0x2178('0x1')]},'videosupport':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no',_0x2178('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2178('0x5')]('yes','no')},'mailbox':{'type':Sequelize[_0x2178('0x1')]},'session_timers':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x25'),_0x2178('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x27'),_0x2178('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x2178('0x1')]},'regexten':{'type':Sequelize[_0x2178('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x2178('0x1')]},'port':{'type':Sequelize[_0x2178('0x22')](0x5)},'qualify':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no'),'defaultValue':_0x2178('0x16')},'keepalive':{'type':Sequelize[_0x2178('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x2178('0x1')]},'defaultuser':{'type':Sequelize[_0x2178('0x1')]},'rtptimeout':{'type':Sequelize[_0x2178('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2178('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no',_0x2178('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2178('0x22')](0xb)},'timerb':{'type':Sequelize[_0x2178('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2178('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x2178('0x1')]},'contactdeny':{'type':Sequelize[_0x2178('0x1')]},'contactacl':{'type':Sequelize[_0x2178('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2178('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2178('0x22')](0xb)},'encryption':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x2178('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x2178('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2178('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x2178('0x5')]('yes','no','fingerprint',_0x2178('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x2178('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2178('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x2178('0x1')]},'dtlscipher':{'type':Sequelize[_0x2178('0x1')]},'dtlscafile':{'type':Sequelize[_0x2178('0x1')]},'dtlscapath':{'type':Sequelize[_0x2178('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2178('0x2b'),_0x2178('0x2c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2178('0x1')]},'usereqphone':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2178('0x1')]},'recordofffeature':{'type':Sequelize[_0x2178('0x1')]},'call_limit':{'type':Sequelize[_0x2178('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no')},'vmexten':{'type':Sequelize[_0x2178('0x1')]},'mohinterpret':{'type':Sequelize[_0x2178('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2178('0x1')]},'description':{'type':Sequelize[_0x2178('0x1')]},'host':{'type':Sequelize[_0x2178('0x1')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2178('0x5')](_0x2178('0x16'),'no',_0x2178('0x17'),'update',_0x2178('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2178('0x1')]},'otherFields':{'type':Sequelize[_0x2178('0x1')]},'active':{'type':Sequelize[_0x2178('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2178('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7566=['dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','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','active','passive','actpass'];(function(_0x3ba7f9,_0x21082d){var _0x3a5a12=function(_0x7f3e5e){while(--_0x7f3e5e){_0x3ba7f9['push'](_0x3ba7f9['shift']());}};_0x3a5a12(++_0x21082d);}(_0x7566,0x1ce));var _0x6756=function(_0x4d2993,_0x1c9473){_0x4d2993=_0x4d2993-0x0;var _0x427374=_0x7566[_0x4d2993];return _0x427374;};'use strict';var Sequelize=require(_0x6756('0x0'));module[_0x6756('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6756('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x4'),'user',_0x6756('0x5')),'allowNull':![],'defaultValue':_0x6756('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x6'),_0x6756('0x7'),'ALLOWED_FAILED_SCREEN',_0x6756('0x8'),_0x6756('0x9'),_0x6756('0xa'),_0x6756('0xb'),_0x6756('0xc'))},'deny':{'type':Sequelize[_0x6756('0xd')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x6756('0xd')]},'remotesecret':{'type':Sequelize[_0x6756('0xd')]},'transport':{'type':Sequelize[_0x6756('0xd')],'defaultValue':'udp','set':function(_0x3d2f75){this[_0x6756('0xe')]('transport',_0x3d2f75?_0x3d2f75[_0x6756('0xf')](','):null);},'get':function(){return this[_0x6756('0x10')](_0x6756('0x11'))?this[_0x6756('0x10')](_0x6756('0x11'))['split'](','):null;},'comment':_0x6756('0x12')},'dtmfmode':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x13'),_0x6756('0x14'),_0x6756('0x15'),_0x6756('0x16'),_0x6756('0x17')),'defaultValue':_0x6756('0x13')},'directmedia':{'type':Sequelize[_0x6756('0x3')]('yes','no',_0x6756('0x18'),_0x6756('0x19'),_0x6756('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6756('0xd')]},'directmediadeny':{'type':Sequelize[_0x6756('0xd')]},'nat':{'type':Sequelize[_0x6756('0xd')],'defaultValue':_0x6756('0x1c'),'set':function(_0x1b2dc8){this[_0x6756('0xe')](_0x6756('0x1d'),_0x1b2dc8?_0x1b2dc8[_0x6756('0xf')](','):null);},'get':function(){return this[_0x6756('0x10')](_0x6756('0x1d'))?this['getDataValue'](_0x6756('0x1d'))[_0x6756('0x1e')](','):null;},'comment':_0x6756('0x1f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x6756('0xd')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x6756('0xd')]},'language':{'type':Sequelize[_0x6756('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6756('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6756('0xd')],'defaultValue':_0x6756('0x20')},'allow':{'type':Sequelize[_0x6756('0xd')],'allowNull':![],'defaultValue':_0x6756('0x21'),'set':function(_0x22fa38){this[_0x6756('0xe')]('allow',_0x22fa38?_0x22fa38[_0x6756('0xf')](';'):_0x6756('0x21'));},'get':function(){return this[_0x6756('0x10')](_0x6756('0x22'))?this[_0x6756('0x10')](_0x6756('0x22'))[_0x6756('0x1e')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x6756('0x3')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0xf7834d){this['setDataValue'](_0x6756('0x23'),_0xf7834d?_0xf7834d[_0x6756('0xf')](','):null);},'get':function(){return this[_0x6756('0x10')](_0x6756('0x23'))?this[_0x6756('0x10')](_0x6756('0x23'))[_0x6756('0x1e')](','):null;},'comment':_0x6756('0x24')},'trustrpid':{'type':Sequelize[_0x6756('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no',_0x6756('0x25'))},'promiscredir':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x6756('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x6756('0x26')](0xb)},'setvar':{'type':Sequelize[_0x6756('0xd')]},'callerid':{'type':Sequelize[_0x6756('0xd')],'defaultValue':_0x6756('0x27')},'amaflags':{'type':Sequelize[_0x6756('0xd')]},'callcounter':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x6756('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0x6756('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x6756('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x6756('0xd')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'mailbox':{'type':Sequelize[_0x6756('0xd')]},'session_timers':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x28'),_0x6756('0x29'),_0x6756('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x6756('0x26')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x6756('0x2b'),_0x6756('0x2c')),'defaultValue':_0x6756('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x6756('0xd')]},'regexten':{'type':Sequelize[_0x6756('0xd')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x6756('0xd')]},'port':{'type':Sequelize[_0x6756('0x26')](0x5)},'qualify':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no'),'defaultValue':_0x6756('0x1b')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x6756('0xd')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x6756('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6756('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6756('0xd')]},'callbackextension':{'type':Sequelize[_0x6756('0xd')]},'timert1':{'type':Sequelize[_0x6756('0x26')](0xb)},'timerb':{'type':Sequelize[_0x6756('0x26')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x6756('0xd')]},'contactacl':{'type':Sequelize[_0x6756('0xd')]},'unsolicited_mailbox':{'type':Sequelize[_0x6756('0xd')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x6756('0x26')](0xb)},'encryption':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x6756('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6756('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0x6756('0xd')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x6756('0xd')]},'dtlscapath':{'type':Sequelize[_0x6756('0xd')]},'dtlssetup':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x2d'),_0x6756('0x2e'),_0x6756('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6756('0xd')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6756('0xd')]},'recordofffeature':{'type':Sequelize[_0x6756('0xd')]},'call_limit':{'type':Sequelize[_0x6756('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x6756('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x6756('0xd')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x6756('0xd')]},'parkinglot':{'type':Sequelize[_0x6756('0xd')]},'description':{'type':Sequelize[_0x6756('0xd')]},'host':{'type':Sequelize[_0x6756('0xd')],'defaultValue':_0x6756('0x30')},'canreinvite':{'type':Sequelize[_0x6756('0x3')](_0x6756('0x1b'),'no','nonat','update',_0x6756('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x6756('0xd')]},'active':{'type':Sequelize[_0x6756('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6756('0xd')],'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 6cdc448..be3083a 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 _0xb821=['model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Trunk','includeAll','findAll','intersection','length','include','find','params','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','root','rimraf','zip-dir','moment','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','Trunk,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','name','send','index','rawAttributes','fieldName','key'];(function(_0x5f3309,_0x37871b){var _0xea65ec=function(_0x4fbe43){while(--_0x4fbe43){_0x5f3309['push'](_0x5f3309['shift']());}};_0xea65ec(++_0x37871b);}(_0xb821,0xa7));var _0x1b82=function(_0x28a25f,_0x2001a3){_0x28a25f=_0x28a25f-0x0;var _0x5111aa=_0xb821[_0x28a25f];return _0x5111aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b82('0x0'));var zipdir=require(_0x1b82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1b82('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1b82('0x3'));var path=require(_0x1b82('0x4'));var sox=require(_0x1b82('0x5'));var csv=require(_0x1b82('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b82('0x7'));var _=require(_0x1b82('0x8'));var squel=require(_0x1b82('0x9'));var crypto=require(_0x1b82('0xa'));var jsforce=require(_0x1b82('0xb'));var deskjs=require(_0x1b82('0xc'));var toCsv=require(_0x1b82('0x6'));var querystring=require(_0x1b82('0xd'));var Papa=require(_0x1b82('0xe'));var Redis=require('ioredis');var authService=require(_0x1b82('0xf'));var qs=require(_0x1b82('0x10'));var as=require(_0x1b82('0x11'));var hardwareService=require(_0x1b82('0x12'));var logger=require(_0x1b82('0x13'))(_0x1b82('0x14'));var utils=require(_0x1b82('0x15'));var config=require(_0x1b82('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b82('0x17'))['db'];var jayson=require(_0x1b82('0x18'));var client=jayson[_0x1b82('0x19')][_0x1b82('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x50aed7,_0x1a6285,_0x5767aa,_0x54915f){return new BPromise(function(_0x1e553a,_0x4bf75b){var _0x1cffd1=_0x54915f||client;return _0x1cffd1[_0x1b82('0x1b')](_0x50aed7,_0x5767aa)['then'](function(_0x46c2cf){logger['info']('Trunk,\x20%s,\x20%s',_0x1a6285,_0x1b82('0x1c'));logger['debug'](_0x1b82('0x1d'),_0x1a6285,_0x1b82('0x1c'),JSON[_0x1b82('0x1e')](_0x46c2cf));if(_0x46c2cf['error']){if(_0x46c2cf['error'][_0x1b82('0x1f')]===0x1f4){logger['error'](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x4bf75b(_0x46c2cf['error'][_0x1b82('0x22')]);}logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x46c2cf[_0x1b82('0x21')][_0x1b82('0x22')]);return _0x1e553a(_0x46c2cf['error'][_0x1b82('0x22')]);}else{logger[_0x1b82('0x23')](_0x1b82('0x20'),_0x1a6285,_0x1b82('0x1c'));_0x1e553a(_0x46c2cf[_0x1b82('0x24')][_0x1b82('0x22')]);}})[_0x1b82('0x25')](function(_0x486e92){logger[_0x1b82('0x21')](_0x1b82('0x20'),_0x1a6285,_0x486e92);_0x4bf75b(_0x486e92);});});}function respondWithStatusCode(_0x5b8d09,_0x561d78){_0x561d78=_0x561d78||0xcc;return function(_0x225b81){if(_0x225b81){return _0x5b8d09[_0x1b82('0x26')](_0x561d78);}return _0x5b8d09['status'](_0x561d78)[_0x1b82('0x27')]();};}function respondWithResult(_0x4db690,_0x5cd458){_0x5cd458=_0x5cd458||0xc8;return function(_0x5f556b){if(_0x5f556b){return _0x4db690[_0x1b82('0x28')](_0x5cd458)[_0x1b82('0x29')](_0x5f556b);}};}function respondWithFilteredResult(_0xfd00d1,_0x257b79){return function(_0x548a3b){if(_0x548a3b){var _0x222483=typeof _0x257b79[_0x1b82('0x2a')]===_0x1b82('0x2b')&&typeof _0x257b79[_0x1b82('0x2c')]===_0x1b82('0x2b');var _0x1b8b6f=_0x548a3b[_0x1b82('0x2d')];var _0x21ea34=_0x222483?0x0:_0x257b79[_0x1b82('0x2a')];var _0x1f9c6b=_0x222483?_0x548a3b[_0x1b82('0x2d')]:_0x257b79[_0x1b82('0x2a')]+_0x257b79[_0x1b82('0x2c')];var _0x5ea890;if(_0x1f9c6b>=_0x1b8b6f){_0x1f9c6b=_0x1b8b6f;_0x5ea890=0xc8;}else{_0x5ea890=0xce;}_0xfd00d1[_0x1b82('0x28')](_0x5ea890);return _0xfd00d1[_0x1b82('0x2e')](_0x1b82('0x2f'),_0x21ea34+'-'+_0x1f9c6b+'/'+_0x1b8b6f)[_0x1b82('0x29')](_0x548a3b);}return null;};}function patchUpdates(_0x18e4ff){return function(_0x115ce7){try{jsonpatch[_0x1b82('0x30')](_0x115ce7,_0x18e4ff,!![]);}catch(_0x46575f){return BPromise[_0x1b82('0x31')](_0x46575f);}return _0x115ce7[_0x1b82('0x32')]();};}function saveUpdates(_0x501ab0,_0x225c06){return function(_0x29a31e){if(_0x29a31e){return _0x29a31e[_0x1b82('0x33')](_0x501ab0)[_0x1b82('0x34')](function(_0x5b7b18){return _0x5b7b18;});}return null;};}function removeEntity(_0x474218,_0xbf65a){return function(_0x544bd5){if(_0x544bd5){return _0x544bd5[_0x1b82('0x35')]()[_0x1b82('0x34')](function(){var _0x365c3c=_0x544bd5['get']({'plain':!![]});var _0x5efb8e=_0x1b82('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x5efb8e,'resourceId':_0x365c3c['id']}})[_0x1b82('0x34')](function(){return _0x544bd5;});})[_0x1b82('0x34')](function(){_0x474218[_0x1b82('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42a64e,_0x366db3){return function(_0xea774a){if(!_0xea774a){_0x42a64e[_0x1b82('0x26')](0x194);}return _0xea774a;};}function handleError(_0x4dd64a,_0x42c1c4){_0x42c1c4=_0x42c1c4||0x1f4;return function(_0x1cd7de){logger[_0x1b82('0x21')](_0x1cd7de['stack']);if(_0x1cd7de['name']){delete _0x1cd7de[_0x1b82('0x37')];}_0x4dd64a['status'](_0x42c1c4)[_0x1b82('0x38')](_0x1cd7de);};}exports[_0x1b82('0x39')]=function(_0x286b4b,_0x348880){var _0x1255db={},_0x3ab35c={},_0x39fe4a={'count':0x0,'rows':[]};var _0x1368df=_['map'](db['Trunk'][_0x1b82('0x3a')],function(_0x5f4baf){return{'name':_0x5f4baf[_0x1b82('0x3b')],'type':_0x5f4baf['type'][_0x1b82('0x3c')]};});_0x3ab35c[_0x1b82('0x3d')]=_[_0x1b82('0x3e')](_0x1368df,_0x1b82('0x37'));_0x3ab35c[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x286b4b['query']);_0x3ab35c[_0x1b82('0x41')]=_['intersection'](_0x3ab35c[_0x1b82('0x3d')],_0x3ab35c['query']);_0x1255db[_0x1b82('0x42')]=_['intersection'](_0x3ab35c['model'],qs[_0x1b82('0x43')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x1255db[_0x1b82('0x42')]=_0x1255db[_0x1b82('0x42')]['length']?_0x1255db[_0x1b82('0x42')]:_0x3ab35c['model'];if(!_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x44')](_0x1b82('0x45'))){_0x1255db[_0x1b82('0x2c')]=qs[_0x1b82('0x2c')](_0x286b4b['query'][_0x1b82('0x2c')]);_0x1255db['offset']=qs[_0x1b82('0x2a')](_0x286b4b[_0x1b82('0x3f')]['offset']);}_0x1255db[_0x1b82('0x46')]=qs[_0x1b82('0x47')](_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x47')]);_0x1255db[_0x1b82('0x48')]=qs[_0x1b82('0x41')](_[_0x1b82('0x49')](_0x286b4b['query'],_0x3ab35c[_0x1b82('0x41')]),_0x1368df);if(_0x286b4b['query'][_0x1b82('0x4a')]){_0x1255db[_0x1b82('0x48')]=_[_0x1b82('0x4b')](_0x1255db[_0x1b82('0x48')],{'$or':_[_0x1b82('0x3e')](_0x1368df,function(_0x1d24d6){if(_0x1d24d6[_0x1b82('0x4c')]!==_0x1b82('0x4d')){var _0x192ce3={};_0x192ce3[_0x1d24d6[_0x1b82('0x37')]]={'$like':'%'+_0x286b4b[_0x1b82('0x3f')][_0x1b82('0x4a')]+'%'};return _0x192ce3;}})});}_0x1255db=_[_0x1b82('0x4b')]({},_0x1255db,_0x286b4b[_0x1b82('0x4e')]);var _0x4fb92f={'where':_0x1255db['where']};return db[_0x1b82('0x4f')]['count'](_0x4fb92f)[_0x1b82('0x34')](function(_0x3df0af){_0x39fe4a[_0x1b82('0x2d')]=_0x3df0af;if(_0x286b4b['query'][_0x1b82('0x50')]){_0x1255db['include']=[{'all':!![]}];}return db['Trunk'][_0x1b82('0x51')](_0x1255db);})[_0x1b82('0x34')](function(_0x242324){_0x39fe4a['rows']=_0x242324;return _0x39fe4a;})[_0x1b82('0x34')](respondWithFilteredResult(_0x348880,_0x1255db))[_0x1b82('0x25')](handleError(_0x348880,null));};exports['show']=function(_0x5ca898,_0x106282){var _0x2e676a={'raw':![],'where':{'id':_0x5ca898['params']['id']}},_0x2dc53e={};_0x2dc53e[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db[_0x1b82('0x4f')][_0x1b82('0x3a')]);_0x2dc53e[_0x1b82('0x3f')]=_[_0x1b82('0x40')](_0x5ca898['query']);_0x2dc53e[_0x1b82('0x41')]=_['intersection'](_0x2dc53e[_0x1b82('0x3d')],_0x2dc53e[_0x1b82('0x3f')]);_0x2e676a['attributes']=_[_0x1b82('0x52')](_0x2dc53e['model'],qs[_0x1b82('0x43')](_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x2e676a[_0x1b82('0x42')]=_0x2e676a[_0x1b82('0x42')][_0x1b82('0x53')]?_0x2e676a['attributes']:_0x2dc53e['model'];if(_0x5ca898[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x2e676a[_0x1b82('0x54')]=[{'all':!![]}];}_0x2e676a=_[_0x1b82('0x4b')]({},_0x2e676a,_0x5ca898[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x2e676a)[_0x1b82('0x34')](handleEntityNotFound(_0x106282,null))['then'](respondWithResult(_0x106282,null))['catch'](handleError(_0x106282,null));};exports['clone']=function(_0x2658b5,_0x2a95d2){var _0x207f1c={'where':{'id':_0x2658b5[_0x1b82('0x56')]['id']}},_0x27ad80={};_0x27ad80[_0x1b82('0x3d')]=_[_0x1b82('0x40')](db['Trunk'][_0x1b82('0x3a')]);_0x207f1c[_0x1b82('0x42')]=_[_0x1b82('0x52')](_0x27ad80[_0x1b82('0x3d')],qs[_0x1b82('0x43')](_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x43')]));_0x207f1c[_0x1b82('0x42')]=_0x207f1c['attributes'][_0x1b82('0x53')]?_0x207f1c[_0x1b82('0x42')]:_0x27ad80[_0x1b82('0x3d')];if(_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]){_0x207f1c['include']=[{'all':!![]}];}_0x207f1c=_['merge']({},_0x207f1c,_0x2658b5[_0x1b82('0x4e')]);return db[_0x1b82('0x4f')][_0x1b82('0x55')](_0x207f1c)[_0x1b82('0x34')](handleEntityNotFound(_0x2a95d2,null))['then'](function(_0x170905){if(_0x170905){var _0x352603=_0x170905[_0x1b82('0x57')]({'plain':!![]});_0x352603=qs[_0x1b82('0x58')](_0x352603,['id',_0x1b82('0x59'),_0x1b82('0x5a')]);_0x2658b5[_0x1b82('0x5b')]=_[_0x1b82('0x58')](_0x2658b5[_0x1b82('0x5b')],['id',_0x1b82('0x59'),'updatedAt']);return db[_0x1b82('0x4f')][_0x1b82('0x5c')](_['merge'](_0x352603,_0x2658b5[_0x1b82('0x5b')]),{'include':_0x2658b5[_0x1b82('0x3f')][_0x1b82('0x50')]?[{'all':!![]}]:undefined})[_0x1b82('0x34')](function(_0x4b26c4){var _0x30f13a=_0x2658b5[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x30f13a)throw new Error(_0x1b82('0x5e'));if(_0x30f13a[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x4e8fa2=_0x4b26c4[_0x1b82('0x57')]({'plain':!![]});var _0x5267c3=_0x1b82('0x36');return db['UserProfileSection'][_0x1b82('0x55')]({'where':{'name':_0x5267c3,'userProfileId':_0x30f13a[_0x1b82('0x60')]},'raw':!![]})[_0x1b82('0x34')](function(_0x2db0fe){if(_0x2db0fe&&_0x2db0fe[_0x1b82('0x61')]===0x0){return db[_0x1b82('0x62')][_0x1b82('0x5c')]({'name':_0x4e8fa2['name'],'resourceId':_0x4e8fa2['id'],'type':_0x2db0fe[_0x1b82('0x37')],'sectionId':_0x2db0fe['id']},{})[_0x1b82('0x34')](function(){return _0x4b26c4;});}else{return _0x4b26c4;}})[_0x1b82('0x25')](function(_0x2de10c){logger[_0x1b82('0x21')](_0x1b82('0x63'),_0x2de10c);throw _0x2de10c;});}return _0x4b26c4;});}})[_0x1b82('0x34')](respondWithResult(_0x2a95d2,0xc9))[_0x1b82('0x25')](handleError(_0x2a95d2,null));};exports[_0x1b82('0x5c')]=function(_0x3f7690,_0x1873de,_0xe31cbc){var _0x1ef92c;return db['Trunk'][_0x1b82('0x5c')](_0x3f7690[_0x1b82('0x5b')],{'raw':!![]})[_0x1b82('0x34')](function(_0x4a229e){_0x1ef92c=_0x4a229e;return db[_0x1b82('0x4f')][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x3bf106){var _0x5cc386=fs[_0x1b82('0x64')](path['join'](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x3b4088=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x68')),'utf8');var _0x143689=ejs[_0x1b82('0x69')](_0x5cc386,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x143689);if(_0x1ef92c[_0x1b82('0x6c')]){var _0x29c42e=ejs[_0x1b82('0x69')](_0x3b4088,{'trunks':_0x3bf106||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x29c42e);}})[_0x1b82('0x34')](function(){return respondWithRpcPromise(_0x1b82('0x6e'),'create',{'module':_0x1b82('0x6f')});})['then'](function(){var _0x4c2e52=_0x3f7690[_0x1b82('0x5d')][_0x1b82('0x57')]({'plain':!![]});if(!_0x4c2e52)throw new Error(_0x1b82('0x5e'));if(_0x4c2e52[_0x1b82('0x5f')]===_0x1b82('0x5d')){var _0x1dd3a1=_0x1ef92c[_0x1b82('0x57')]({'plain':!![]});return db[_0x1b82('0x70')][_0x1b82('0x55')]({'where':{'name':_0x1b82('0x36'),'userProfileId':_0x4c2e52['userProfileId']},'raw':!![]})[_0x1b82('0x34')](function(_0x4d496b){if(_0x4d496b&&_0x4d496b[_0x1b82('0x61')]===0x0){return db['UserProfileResource'][_0x1b82('0x5c')]({'name':_0x1dd3a1[_0x1b82('0x37')],'resourceId':_0x1dd3a1['id'],'type':_0x4d496b[_0x1b82('0x37')],'sectionId':_0x4d496b['id']},{})[_0x1b82('0x34')](function(){return _0x1ef92c;});}else{return _0x1ef92c;}})[_0x1b82('0x25')](function(_0x49a202){logger[_0x1b82('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a202);throw _0x49a202;});}return _0x1ef92c;})['then'](respondWithResult(_0x1873de,0xc9))[_0x1b82('0x25')](handleError(_0x1873de,null));};exports[_0x1b82('0x33')]=function(_0x1a4826,_0x4d986c,_0x2e9191){var _0x52f16e;return db[_0x1b82('0x4f')]['find']({'where':{'id':_0x1a4826[_0x1b82('0x56')]['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x4d986c,null))[_0x1b82('0x34')](saveUpdates(_0x1a4826[_0x1b82('0x5b')],null))['then'](function(_0x46cae4){if(_0x46cae4){_0x52f16e=_0x46cae4;return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});}})[_0x1b82('0x34')](function(_0x1095fb){if(_0x1095fb){var _0x185fce=fs[_0x1b82('0x64')](path['join'](config[_0x1b82('0x71')],'server/files/templates/trunk.ejs'),_0x1b82('0x66'));var _0x5ce247=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],'server/files/templates/registry.ejs'),_0x1b82('0x66'));var _0x31a56e=ejs[_0x1b82('0x69')](_0x185fce,{'trunks':_0x1095fb||[]});fs['writeFileSync'](_0x1b82('0x6b'),_0x31a56e);var _0x396272=ejs[_0x1b82('0x69')](_0x5ce247,{'trunks':_0x1095fb||[]});fs[_0x1b82('0x6a')](_0x1b82('0x6d'),_0x396272);return respondWithRpcPromise('Reload',_0x1b82('0x33'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2759ac){if(_0x2759ac){return _0x52f16e;}})['then'](respondWithResult(_0x4d986c,null))[_0x1b82('0x25')](handleError(_0x4d986c,null));};exports[_0x1b82('0x35')]=function(_0x5f349f,_0x3e17b0,_0x391207){var _0x553ac5;return db['Trunk']['find']({'where':{'id':_0x5f349f['params']['id']}})[_0x1b82('0x34')](handleEntityNotFound(_0x3e17b0,null))[_0x1b82('0x34')](removeEntity(_0x3e17b0,null))[_0x1b82('0x34')](function(){return db['Trunk'][_0x1b82('0x51')]({'raw':!![]});})['then'](function(_0x7d95b6){var _0x372c3b=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config['root'],_0x1b82('0x65')),_0x1b82('0x66'));var _0x14510c=fs[_0x1b82('0x64')](path[_0x1b82('0x67')](config[_0x1b82('0x71')],_0x1b82('0x68')),'utf8');var _0x58e180=ejs[_0x1b82('0x69')](_0x372c3b,{'trunks':_0x7d95b6});var _0x531d3f=ejs['render'](_0x14510c,{'trunks':_0x7d95b6});fs[_0x1b82('0x6a')](_0x1b82('0x6b'),_0x58e180);fs[_0x1b82('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x531d3f);return respondWithRpcPromise(_0x1b82('0x6e'),'destroy',{'module':_0x1b82('0x6f')});})[_0x1b82('0x25')](handleError(_0x3e17b0,null));}; \ No newline at end of file +var _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x584921,_0x5ef6bb){var _0x1bb74e=function(_0x27e133){while(--_0x27e133){_0x584921['push'](_0x584921['shift']());}};_0x1bb74e(++_0x5ef6bb);}(_0x425d,0x1e0));var _0xd425=function(_0xdfeec5,_0x6a548c){_0xdfeec5=_0xdfeec5-0x0;var _0x446388=_0x425d[_0xdfeec5];return _0x446388;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index bb0d837..6452317 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 _0x1ec5=['../../config/environment','./trunk.attributes','Trunk','tools_trunks','api','moment','request-promise'];(function(_0x5dcc7b,_0x5879e3){var _0xb98f2a=function(_0x1ba653){while(--_0x1ba653){_0x5dcc7b['push'](_0x5dcc7b['shift']());}};_0xb98f2a(++_0x5879e3);}(_0x1ec5,0x1ee));var _0x51ec=function(_0x2dabce,_0x473d54){_0x2dabce=_0x2dabce-0x0;var _0x2673ed=_0x1ec5[_0x2dabce];return _0x2673ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x51ec('0x0'));var moment=require(_0x51ec('0x1'));var BPromise=require('bluebird');var rp=require(_0x51ec('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x51ec('0x3'));var attributes=require(_0x51ec('0x4'));module['exports']=function(_0x231d81,_0x1db76c){return _0x231d81['define'](_0x51ec('0x5'),attributes,{'tableName':_0x51ec('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd5=['moment','bluebird','path','rimraf','../../config/environment','exports','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x18e52b,_0x1fae35){var _0x3d3062=function(_0x133b14){while(--_0x133b14){_0x18e52b['push'](_0x18e52b['shift']());}};_0x3d3062(++_0x1fae35);}(_0x7bd5,0x158));var _0x57bd=function(_0x41352d,_0x24639e){_0x41352d=_0x41352d-0x0;var _0x49ba84=_0x7bd5[_0x41352d];return _0x49ba84;};'use strict';var _=require(_0x57bd('0x0'));var util=require(_0x57bd('0x1'));var logger=require(_0x57bd('0x2'))(_0x57bd('0x3'));var moment=require(_0x57bd('0x4'));var BPromise=require(_0x57bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57bd('0x6'));var rimraf=require(_0x57bd('0x7'));var config=require(_0x57bd('0x8'));var attributes=require('./trunk.attributes');module[_0x57bd('0x9')]=function(_0x566fe2,_0x48ddcc){return _0x566fe2['define'](_0x57bd('0xa'),attributes,{'tableName':_0x57bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 665e0ab..1b314f0 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 _0x99db=['attributes','limit','include','map','model','GetTrunk','ShowTrunk','find','raw','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','Trunk','findAll','options','where'];(function(_0x290c8f,_0x178335){var _0x433e5b=function(_0x41cb04){while(--_0x41cb04){_0x290c8f['push'](_0x290c8f['shift']());}};_0x433e5b(++_0x178335);}(_0x99db,0x17f));var _0xb99d=function(_0x3e3221,_0x392851){_0x3e3221=_0x3e3221-0x0;var _0x190da4=_0x99db[_0x3e3221];return _0x190da4;};'use strict';var _=require('lodash');var util=require(_0xb99d('0x0'));var moment=require('moment');var BPromise=require(_0xb99d('0x1'));var rs=require(_0xb99d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb99d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb99d('0x4'))(_0xb99d('0x5'));var config=require(_0xb99d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb99d('0x7')][_0xb99d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d54d2,_0x16bf40,_0xeab839){return new BPromise(function(_0x15b03b,_0x2a960e){return client[_0xb99d('0x9')](_0x3d54d2,_0xeab839)[_0xb99d('0xa')](function(_0x402b0c){logger[_0xb99d('0xb')]('Trunk,\x20%s,\x20%s',_0x16bf40,_0xb99d('0xc'));logger[_0xb99d('0xd')](_0xb99d('0xe'),_0x16bf40,_0xb99d('0xc'),JSON[_0xb99d('0xf')](_0x402b0c));if(_0x402b0c[_0xb99d('0x10')]){if(_0x402b0c[_0xb99d('0x10')]['code']===0x1f4){logger[_0xb99d('0x10')](_0xb99d('0x11'),_0x16bf40,_0x402b0c[_0xb99d('0x10')][_0xb99d('0x12')]);return _0x2a960e(_0x402b0c[_0xb99d('0x10')][_0xb99d('0x12')]);}logger[_0xb99d('0x10')](_0xb99d('0x11'),_0x16bf40,_0x402b0c[_0xb99d('0x10')][_0xb99d('0x12')]);return _0x15b03b(_0x402b0c[_0xb99d('0x10')][_0xb99d('0x12')]);}else{logger[_0xb99d('0xb')]('Trunk,\x20%s,\x20%s',_0x16bf40,_0xb99d('0xc'));_0x15b03b(_0x402b0c[_0xb99d('0x13')][_0xb99d('0x12')]);}})[_0xb99d('0x14')](function(_0x2d991a){logger['error']('Trunk,\x20%s,\x20%s',_0x16bf40,_0x2d991a);_0x2a960e(_0x2d991a);});});}exports['GetTrunk']=function(_0x12e6e1){var _0x49b399=this;return new Promise(function(_0x249eef,_0x2db649){return db[_0xb99d('0x15')][_0xb99d('0x16')]({'raw':_0x12e6e1[_0xb99d('0x17')]?_0x12e6e1[_0xb99d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x12e6e1['options']?_0x12e6e1[_0xb99d('0x17')][_0xb99d('0x18')]||null:null,'attributes':_0x12e6e1[_0xb99d('0x17')]?_0x12e6e1[_0xb99d('0x17')][_0xb99d('0x19')]||null:null,'limit':_0x12e6e1[_0xb99d('0x17')]?_0x12e6e1[_0xb99d('0x17')][_0xb99d('0x1a')]||null:null,'include':_0x12e6e1[_0xb99d('0x17')]?_0x12e6e1[_0xb99d('0x17')][_0xb99d('0x1b')]?_[_0xb99d('0x1c')](_0x12e6e1[_0xb99d('0x17')][_0xb99d('0x1b')],function(_0x36d3ee){return{'model':db[_0x36d3ee[_0xb99d('0x1d')]],'as':_0x36d3ee['as'],'attributes':_0x36d3ee[_0xb99d('0x19')],'include':_0x36d3ee[_0xb99d('0x1b')]?_[_0xb99d('0x1c')](_0x36d3ee['include'],function(_0x4e0291){return{'model':db[_0x4e0291[_0xb99d('0x1d')]],'as':_0x4e0291['as'],'attributes':_0x4e0291['attributes'],'include':_0x4e0291[_0xb99d('0x1b')]?_['map'](_0x4e0291['include'],function(_0x50d46c){return{'model':db[_0x50d46c[_0xb99d('0x1d')]],'as':_0x50d46c['as'],'attributes':_0x50d46c['attributes']};}):[]};}):[]};}):[]:[]})[_0xb99d('0xa')](function(_0x1c851f){logger['info'](_0xb99d('0x1e'),_0x12e6e1);logger['debug'](_0xb99d('0x1e'),_0x12e6e1,JSON['stringify'](_0x1c851f));_0x249eef(_0x1c851f);})[_0xb99d('0x14')](function(_0x50bf35){logger[_0xb99d('0x10')](_0xb99d('0x1e'),_0x50bf35[_0xb99d('0x12')],_0x12e6e1);_0x2db649(_0x49b399['error'](0x1f4,_0x50bf35[_0xb99d('0x12')]));});});};exports[_0xb99d('0x1f')]=function(_0x2102ea){var _0x548b19=this;return new Promise(function(_0x553f10,_0x1edbf1){return db[_0xb99d('0x15')][_0xb99d('0x20')]({'raw':_0x2102ea[_0xb99d('0x17')]?_0x2102ea[_0xb99d('0x17')][_0xb99d('0x21')]===undefined?!![]:![]:!![],'where':_0x2102ea['options']?_0x2102ea[_0xb99d('0x17')][_0xb99d('0x18')]||null:null,'attributes':_0x2102ea[_0xb99d('0x17')]?_0x2102ea[_0xb99d('0x17')][_0xb99d('0x19')]||null:null,'include':_0x2102ea['options']?_0x2102ea[_0xb99d('0x17')]['include']?_[_0xb99d('0x1c')](_0x2102ea[_0xb99d('0x17')][_0xb99d('0x1b')],function(_0x38ce7d){return{'model':db[_0x38ce7d[_0xb99d('0x1d')]],'as':_0x38ce7d['as'],'attributes':_0x38ce7d[_0xb99d('0x19')],'include':_0x38ce7d[_0xb99d('0x1b')]?_[_0xb99d('0x1c')](_0x38ce7d['include'],function(_0x54df4d){return{'model':db[_0x54df4d[_0xb99d('0x1d')]],'as':_0x54df4d['as'],'attributes':_0x54df4d['attributes'],'include':_0x54df4d[_0xb99d('0x1b')]?_['map'](_0x54df4d['include'],function(_0x170a7e){return{'model':db[_0x170a7e['model']],'as':_0x170a7e['as'],'attributes':_0x170a7e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb99d('0xa')](function(_0x1dd1a5){logger[_0xb99d('0xb')]('ShowTrunk',_0x2102ea);logger[_0xb99d('0xd')](_0xb99d('0x1f'),_0x2102ea,JSON[_0xb99d('0xf')](_0x1dd1a5));_0x553f10(_0x1dd1a5);})[_0xb99d('0x14')](function(_0x28f6dc){logger[_0xb99d('0x10')](_0xb99d('0x1f'),_0x28f6dc[_0xb99d('0x12')],_0x2102ea);_0x1edbf1(_0x548b19[_0xb99d('0x10')](0x1f4,_0x28f6dc['message']));});});}; \ No newline at end of file +var _0xe697=['findAll','options','raw','attributes','limit','include','map','model','GetTrunk','catch','ShowTrunk','Trunk','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','result'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xe697,0xe0));var _0x7e69=function(_0xbebf50,_0x44ec09){_0xbebf50=_0xbebf50-0x0;var _0xce1496=_0xe697[_0xbebf50];return _0xce1496;};'use strict';var _=require(_0x7e69('0x0'));var util=require(_0x7e69('0x1'));var moment=require('moment');var BPromise=require(_0x7e69('0x2'));var rs=require(_0x7e69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e69('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e69('0x5'))('rpc');var config=require(_0x7e69('0x6'));var jayson=require(_0x7e69('0x7'));var client=jayson['client'][_0x7e69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d15ec,_0x119a19,_0x1f8b9b){return new BPromise(function(_0x5824cb,_0x1e19ec){return client[_0x7e69('0x9')](_0x2d15ec,_0x1f8b9b)[_0x7e69('0xa')](function(_0x3ce30e){logger[_0x7e69('0xb')]('Trunk,\x20%s,\x20%s',_0x119a19,'request\x20sent');logger[_0x7e69('0xc')](_0x7e69('0xd'),_0x119a19,_0x7e69('0xe'),JSON[_0x7e69('0xf')](_0x3ce30e));if(_0x3ce30e[_0x7e69('0x10')]){if(_0x3ce30e[_0x7e69('0x10')][_0x7e69('0x11')]===0x1f4){logger[_0x7e69('0x10')](_0x7e69('0x12'),_0x119a19,_0x3ce30e[_0x7e69('0x10')]['message']);return _0x1e19ec(_0x3ce30e['error']['message']);}logger[_0x7e69('0x10')]('Trunk,\x20%s,\x20%s',_0x119a19,_0x3ce30e['error'][_0x7e69('0x13')]);return _0x5824cb(_0x3ce30e[_0x7e69('0x10')]['message']);}else{logger['info'](_0x7e69('0x12'),_0x119a19,_0x7e69('0xe'));_0x5824cb(_0x3ce30e[_0x7e69('0x14')]['message']);}})['catch'](function(_0x316365){logger[_0x7e69('0x10')](_0x7e69('0x12'),_0x119a19,_0x316365);_0x1e19ec(_0x316365);});});}exports['GetTrunk']=function(_0x4ec1de){var _0x36181=this;return new Promise(function(_0x26ae00,_0x32683b){return db['Trunk'][_0x7e69('0x15')]({'raw':_0x4ec1de[_0x7e69('0x16')]?_0x4ec1de[_0x7e69('0x16')][_0x7e69('0x17')]===undefined?!![]:![]:!![],'where':_0x4ec1de[_0x7e69('0x16')]?_0x4ec1de[_0x7e69('0x16')]['where']||null:null,'attributes':_0x4ec1de[_0x7e69('0x16')]?_0x4ec1de[_0x7e69('0x16')][_0x7e69('0x18')]||null:null,'limit':_0x4ec1de[_0x7e69('0x16')]?_0x4ec1de['options'][_0x7e69('0x19')]||null:null,'include':_0x4ec1de[_0x7e69('0x16')]?_0x4ec1de[_0x7e69('0x16')][_0x7e69('0x1a')]?_[_0x7e69('0x1b')](_0x4ec1de[_0x7e69('0x16')][_0x7e69('0x1a')],function(_0x37425a){return{'model':db[_0x37425a[_0x7e69('0x1c')]],'as':_0x37425a['as'],'attributes':_0x37425a[_0x7e69('0x18')],'include':_0x37425a['include']?_[_0x7e69('0x1b')](_0x37425a[_0x7e69('0x1a')],function(_0x4258e3){return{'model':db[_0x4258e3[_0x7e69('0x1c')]],'as':_0x4258e3['as'],'attributes':_0x4258e3['attributes'],'include':_0x4258e3[_0x7e69('0x1a')]?_[_0x7e69('0x1b')](_0x4258e3['include'],function(_0x4d9b0b){return{'model':db[_0x4d9b0b[_0x7e69('0x1c')]],'as':_0x4d9b0b['as'],'attributes':_0x4d9b0b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7e69('0xa')](function(_0x3c314c){logger[_0x7e69('0xb')](_0x7e69('0x1d'),_0x4ec1de);logger[_0x7e69('0xc')](_0x7e69('0x1d'),_0x4ec1de,JSON[_0x7e69('0xf')](_0x3c314c));_0x26ae00(_0x3c314c);})[_0x7e69('0x1e')](function(_0xec20dd){logger['error'](_0x7e69('0x1d'),_0xec20dd['message'],_0x4ec1de);_0x32683b(_0x36181[_0x7e69('0x10')](0x1f4,_0xec20dd[_0x7e69('0x13')]));});});};exports[_0x7e69('0x1f')]=function(_0x34d415){var _0x28a6ad=this;return new Promise(function(_0x2b108d,_0x13105e){return db[_0x7e69('0x20')][_0x7e69('0x21')]({'raw':_0x34d415[_0x7e69('0x16')]?_0x34d415[_0x7e69('0x16')][_0x7e69('0x17')]===undefined?!![]:![]:!![],'where':_0x34d415[_0x7e69('0x16')]?_0x34d415[_0x7e69('0x16')][_0x7e69('0x22')]||null:null,'attributes':_0x34d415[_0x7e69('0x16')]?_0x34d415[_0x7e69('0x16')][_0x7e69('0x18')]||null:null,'include':_0x34d415['options']?_0x34d415[_0x7e69('0x16')][_0x7e69('0x1a')]?_[_0x7e69('0x1b')](_0x34d415[_0x7e69('0x16')][_0x7e69('0x1a')],function(_0x1b7958){return{'model':db[_0x1b7958[_0x7e69('0x1c')]],'as':_0x1b7958['as'],'attributes':_0x1b7958['attributes'],'include':_0x1b7958[_0x7e69('0x1a')]?_[_0x7e69('0x1b')](_0x1b7958[_0x7e69('0x1a')],function(_0x232e5e){return{'model':db[_0x232e5e[_0x7e69('0x1c')]],'as':_0x232e5e['as'],'attributes':_0x232e5e['attributes'],'include':_0x232e5e['include']?_['map'](_0x232e5e[_0x7e69('0x1a')],function(_0x49d14e){return{'model':db[_0x49d14e[_0x7e69('0x1c')]],'as':_0x49d14e['as'],'attributes':_0x49d14e[_0x7e69('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7e69('0xa')](function(_0x2a42fe){logger['info'](_0x7e69('0x1f'),_0x34d415);logger[_0x7e69('0xc')](_0x7e69('0x1f'),_0x34d415,JSON[_0x7e69('0xf')](_0x2a42fe));_0x2b108d(_0x2a42fe);})['catch'](function(_0x39cf95){logger[_0x7e69('0x10')](_0x7e69('0x1f'),_0x39cf95[_0x7e69('0x13')],_0x34d415);_0x13105e(_0x28a6ad[_0x7e69('0x10')](0x1f4,_0x39cf95[_0x7e69('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 4a9c0e2..d172803 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 _0xb3cf=['express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x57c172,_0x17630e){var _0x1597e4=function(_0x492dd3){while(--_0x492dd3){_0x57c172['push'](_0x57c172['shift']());}};_0x1597e4(++_0x17630e);}(_0xb3cf,0xf0));var _0xfb3c=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0xb3cf[_0x101d5b];return _0x382a50;};'use strict';var express=require(_0xfb3c('0x0'));var router=express[_0xfb3c('0x1')]();var auth=require(_0xfb3c('0x2'));var controller=require(_0xfb3c('0x3'));router[_0xfb3c('0x4')](_0xfb3c('0x5'),auth[_0xfb3c('0x6')](),controller[_0xfb3c('0x7')]);module['exports']=router; \ No newline at end of file +var _0x41f7=['put','isAuthenticated','Router','../../components/auth/service'];(function(_0x42d645,_0x61c13f){var _0x448a1=function(_0x285d12){while(--_0x285d12){_0x42d645['push'](_0x42d645['shift']());}};_0x448a1(++_0x61c13f);}(_0x41f7,0x1ca));var _0x741f=function(_0x3adad3,_0x5e0761){_0x3adad3=_0x3adad3-0x0;var _0x588043=_0x41f7[_0x3adad3];return _0x588043;};'use strict';var express=require('express');var router=express[_0x741f('0x0')]();var auth=require(_0x741f('0x1'));var controller=require('./user-setting.controller');router[_0x741f('0x2')]('/:id',auth[_0x741f('0x3')](),controller['update']);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 0cf8526..f230750 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 _0xac74=['TEXT','UserId','sequelize','warning','info','exports'];(function(_0x5bcddc,_0x288f93){var _0x578229=function(_0x277e20){while(--_0x277e20){_0x5bcddc['push'](_0x5bcddc['shift']());}};_0x578229(++_0x288f93);}(_0xac74,0x1c4));var _0x4ac7=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0xac74[_0x5751e6];return _0x4199e4;};'use strict';var Sequelize=require(_0x4ac7('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x4ac7('0x1'),_0x4ac7('0x2'),'debug'];module[_0x4ac7('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x4ac7('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x4ac7('0x5')}}; \ No newline at end of file +var _0x8642=['TEXT','DATE','INTEGER','warning','debug','ENUM','error','BOOLEAN'];(function(_0x2ab324,_0x49fbac){var _0x427c10=function(_0x4674c2){while(--_0x4674c2){_0x2ab324['push'](_0x2ab324['shift']());}};_0x427c10(++_0x49fbac);}(_0x8642,0x163));var _0x2864=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8642[_0x1992f1];return _0x413dfe;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=['error',_0x2864('0x0'),'info',_0x2864('0x1')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x2864('0x2')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2864('0x3'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2864('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x2864('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2864('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2864('0x7')],'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 89a896d..62be1a4 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 _0x7daf=['body','catch','ioredis','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','update','then','sendStatus','stack','name','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x7daf,0xaa));var _0xf7da=function(_0x558d91,_0x3fc135){_0x558d91=_0x558d91-0x0;var _0x2cf781=_0x7daf[_0x558d91];return _0x2cf781;};'use strict';var _=require('lodash');var Redis=require(_0xf7da('0x0'));var logger=require('../../config/logger')(_0xf7da('0x1'));var config=require(_0xf7da('0x2'));var db=require('../../mysqldb')['db'];var socket=require(_0xf7da('0x3'))(new Redis(config[_0xf7da('0x4')]));require(_0xf7da('0x5'))[_0xf7da('0x6')](socket);config[_0xf7da('0x4')]=_['defaults'](config[_0xf7da('0x4')],{'host':_0xf7da('0x7'),'port':0x18eb});function respondWithResult(_0x1b35ec,_0x110cad){_0x110cad=_0x110cad||0xc8;return function(_0x2c70ad){if(_0x2c70ad){return _0x1b35ec[_0xf7da('0x8')](_0x110cad)['json'](_0x2c70ad);}};}function saveUpdates(_0x3f0f80){return function(_0x3e00f1){if(_0x3e00f1){return _0x3e00f1[_0xf7da('0x9')](_0x3f0f80)[_0xf7da('0xa')](function(_0x305873){return _0x305873;});}return null;};}function handleEntityNotFound(_0x4667b6){return function(_0x209f37){if(!_0x209f37){_0x4667b6[_0xf7da('0xb')](0x194);}return _0x209f37;};}function handleError(_0x363233,_0x2ad574){_0x2ad574=_0x2ad574||0x1f4;return function(_0x514c1e){logger['error'](_0x514c1e[_0xf7da('0xc')]);if(_0x514c1e[_0xf7da('0xd')]){delete _0x514c1e[_0xf7da('0xd')];}_0x363233[_0xf7da('0x8')](_0x2ad574)[_0xf7da('0xe')](_0x514c1e);};}exports[_0xf7da('0x9')]=function(_0x5a1357,_0x2f3841){if(_0x5a1357[_0xf7da('0xf')]['role']!==_0xf7da('0x10'))throw new Error(_0xf7da('0x11'));if(isNaN(Number(_0x5a1357[_0xf7da('0x12')]['id'])))throw new Error(_0xf7da('0x13'));return db[_0xf7da('0x14')][_0xf7da('0x15')]({'where':{'id':_0x5a1357['params']['id']}})['then'](handleEntityNotFound(_0x2f3841,null))['then'](saveUpdates(_0x5a1357[_0xf7da('0x16')],null))[_0xf7da('0xa')](respondWithResult(_0x2f3841,null))[_0xf7da('0x17')](handleError(_0x2f3841,null));}; \ No newline at end of file +var _0xf7f3=['update','then','sendStatus','error','name','status','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','./user-setting.socket','register','defaults','localhost'];(function(_0x3a91fa,_0x7972a3){var _0xa885b9=function(_0x423efa){while(--_0x423efa){_0x3a91fa['push'](_0x3a91fa['shift']());}};_0xa885b9(++_0x7972a3);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x534084,_0x17a7c3){_0x534084=_0x534084-0x0;var _0x1420fb=_0xf7f3[_0x534084];return _0x1420fb;};'use strict';var _=require(_0x3f7f('0x0'));var Redis=require(_0x3f7f('0x1'));var logger=require(_0x3f7f('0x2'))(_0x3f7f('0x3'));var config=require(_0x3f7f('0x4'));var db=require(_0x3f7f('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f7f('0x6'))[_0x3f7f('0x7')](socket);config['redis']=_[_0x3f7f('0x8')](config['redis'],{'host':_0x3f7f('0x9'),'port':0x18eb});function respondWithResult(_0x57b834,_0x5d6e4d){_0x5d6e4d=_0x5d6e4d||0xc8;return function(_0x5cac86){if(_0x5cac86){return _0x57b834['status'](_0x5d6e4d)['json'](_0x5cac86);}};}function saveUpdates(_0x221238){return function(_0x1b2408){if(_0x1b2408){return _0x1b2408[_0x3f7f('0xa')](_0x221238)[_0x3f7f('0xb')](function(_0x32a80f){return _0x32a80f;});}return null;};}function handleEntityNotFound(_0x38af7e){return function(_0x2bfcfa){if(!_0x2bfcfa){_0x38af7e[_0x3f7f('0xc')](0x194);}return _0x2bfcfa;};}function handleError(_0x55f192,_0x5d6a4e){_0x5d6a4e=_0x5d6a4e||0x1f4;return function(_0x395f8a){logger[_0x3f7f('0xd')](_0x395f8a['stack']);if(_0x395f8a['name']){delete _0x395f8a[_0x3f7f('0xe')];}_0x55f192[_0x3f7f('0xf')](_0x5d6a4e)['send'](_0x395f8a);};}exports[_0x3f7f('0xa')]=function(_0x30b064,_0x1aa642){if(_0x30b064['user'][_0x3f7f('0x10')]!==_0x3f7f('0x11'))throw new Error(_0x3f7f('0x12'));if(isNaN(Number(_0x30b064[_0x3f7f('0x13')]['id'])))throw new Error(_0x3f7f('0x14'));return db['UserSetting'][_0x3f7f('0x15')]({'where':{'id':_0x30b064['params']['id']}})[_0x3f7f('0xb')](handleEntityNotFound(_0x1aa642,null))[_0x3f7f('0xb')](saveUpdates(_0x30b064['body'],null))[_0x3f7f('0xb')](respondWithResult(_0x1aa642,null))['catch'](handleError(_0x1aa642,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 dd71c12..e7d10c1 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 _0x6ae6=['exports','events','UserSetting','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x5e564d,_0xd5c026){var _0x254007=function(_0x36b3e6){while(--_0x36b3e6){_0x5e564d['push'](_0x5e564d['shift']());}};_0x254007(++_0xd5c026);}(_0x6ae6,0x1b1));var _0x66ae=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0x6ae6[_0x3299d1];return _0x44356e;};'use strict';var EventEmitter=require(_0x66ae('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x66ae('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x66ae('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x66ae('0x3'),'afterDestroy':_0x66ae('0x4')};function emitEvent(_0x3d7b68){return function(_0x23f387,_0x4a8c58,_0x25ee7e){UserSettingEvents[_0x66ae('0x5')](_0x3d7b68+':'+_0x23f387['id'],_0x23f387);UserSettingEvents[_0x66ae('0x5')](_0x3d7b68,_0x23f387);_0x25ee7e(null);};}for(var e in events){if(events[_0x66ae('0x6')](e)){var event=events[e];UserSetting[_0x66ae('0x7')](e,emitEvent(event));}}module[_0x66ae('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xc6ec=['hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','update','remove','emit'];(function(_0x3fcc79,_0x4d5313){var _0x353112=function(_0x1c3492){while(--_0x1c3492){_0x3fcc79['push'](_0x3fcc79['shift']());}};_0x353112(++_0x4d5313);}(_0xc6ec,0x92));var _0xcc6e=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0xc6ec[_0x209bbf];return _0x592d4b;};'use strict';var EventEmitter=require(_0xcc6e('0x0'));var UserSetting=require(_0xcc6e('0x1'))['db'][_0xcc6e('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xcc6e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcc6e('0x4'),'afterDestroy':_0xcc6e('0x5')};function emitEvent(_0x48aa4b){return function(_0x548854,_0x38d6f3,_0x46aa94){UserSettingEvents[_0xcc6e('0x6')](_0x48aa4b+':'+_0x548854['id'],_0x548854);UserSettingEvents[_0xcc6e('0x6')](_0x48aa4b,_0x548854);_0x46aa94(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xcc6e('0x7')](e,emitEvent(event));}}module[_0xcc6e('0x8')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 49d5834..2379af9 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 _0x1beb=['./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x549ad1,_0x44479a){var _0x52572a=function(_0x575a5f){while(--_0x575a5f){_0x549ad1['push'](_0x549ad1['shift']());}};_0x52572a(++_0x44479a);}(_0x1beb,0x165));var _0xb1be=function(_0x1efdcb,_0x429ce7){_0x1efdcb=_0x1efdcb-0x0;var _0x363475=_0x1beb[_0x1efdcb];return _0x363475;};'use strict';var attributes=require(_0xb1be('0x0'));module[_0xb1be('0x1')]=function(_0x56672f){return _0x56672f[_0xb1be('0x2')](_0xb1be('0x3'),attributes,{'tableName':_0xb1be('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55259c){if(!_0x55259c[_0xb1be('0x5')])_0x55259c[_0xb1be('0x6')]=null;else if(_0x55259c['clientSideLoggingEnabledSince']===null)_0x55259c[_0xb1be('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x9e5e=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x212780,_0x10a04a){var _0x18666c=function(_0x5b9847){while(--_0x5b9847){_0x212780['push'](_0x212780['shift']());}};_0x18666c(++_0x10a04a);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x9e5e[_0x4e676e];return _0x336a3c;};'use strict';var attributes=require(_0xe9e5('0x0'));module[_0xe9e5('0x1')]=function(_0x5a229a){return _0x5a229a[_0xe9e5('0x2')](_0xe9e5('0x3'),attributes,{'tableName':_0xe9e5('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4c9784){if(!_0x4c9784[_0xe9e5('0x5')])_0x4c9784['clientSideLoggingEnabledSince']=null;else if(_0x4c9784[_0xe9e5('0x6')]===null)_0x4c9784[_0xe9e5('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 9f30d1f..d796a3a 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 _0x4756=['remove','emit','user-setting:update','register','length','user-setting:','./user-setting.events','save'];(function(_0x14be9c,_0xcf69df){var _0x261419=function(_0x423480){while(--_0x423480){_0x14be9c['push'](_0x14be9c['shift']());}};_0x261419(++_0xcf69df);}(_0x4756,0x1ee));var _0x6475=function(_0x3da6dd,_0x303de0){_0x3da6dd=_0x3da6dd-0x0;var _0x33b591=_0x4756[_0x3da6dd];return _0x33b591;};'use strict';var UserSettingEvents=require(_0x6475('0x0'));var events=[_0x6475('0x1'),_0x6475('0x2'),'update'];function createListener(_0xc982c8,_0x2269c5){return function(_0x43fc06){_0x2269c5[_0x6475('0x3')](_0xc982c8,_0x43fc06);if(_0xc982c8===_0x6475('0x4')){_0x2269c5['emit']('user-setting:update:user-'+_0x43fc06['UserId'],_0x43fc06);}};}exports[_0x6475('0x5')]=function(_0x19c89a){for(var _0x5cd3b6=0x0,_0x36b33f=events[_0x6475('0x6')];_0x5cd3b6<_0x36b33f;_0x5cd3b6++){var _0x52854a=events[_0x5cd3b6];var _0x31ad0f=createListener(_0x6475('0x7')+_0x52854a,_0x19c89a);UserSettingEvents['on'](_0x52854a,_0x31ad0f);}}; \ No newline at end of file +var _0x9d1c=['update','emit','user-setting:update','UserId','register','length','user-setting:','save','remove'];(function(_0x612629,_0x5bf409){var _0x2c6e7c=function(_0x2f7d55){while(--_0x2f7d55){_0x612629['push'](_0x612629['shift']());}};_0x2c6e7c(++_0x5bf409);}(_0x9d1c,0x10c));var _0xc9d1=function(_0x4e69e7,_0x538e17){_0x4e69e7=_0x4e69e7-0x0;var _0x182498=_0x9d1c[_0x4e69e7];return _0x182498;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xc9d1('0x0'),_0xc9d1('0x1'),_0xc9d1('0x2')];function createListener(_0x996f5,_0x4e3c1c){return function(_0x560fa6){_0x4e3c1c[_0xc9d1('0x3')](_0x996f5,_0x560fa6);if(_0x996f5===_0xc9d1('0x4')){_0x4e3c1c[_0xc9d1('0x3')]('user-setting:update:user-'+_0x560fa6[_0xc9d1('0x5')],_0x560fa6);}};}exports[_0xc9d1('0x6')]=function(_0x8330e){for(var _0x11ab3d=0x0,_0xadbc9a=events[_0xc9d1('0x7')];_0x11ab3d<_0xadbc9a;_0x11ab3d++){var _0x23d069=events[_0x11ab3d];var _0x565f41=createListener(_0xc9d1('0x8')+_0x23d069,_0x8330e);UserSettingEvents['on'](_0x23d069,_0x565f41);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 159a6d8..eac8139 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 _0x6e7e=['addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','/:id/openchannel_accounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','diskStorage','join','root','format','%s-%s','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e7e,0x10c));var _0xe6e7=function(_0x429c0c,_0x560f5b){_0x429c0c=_0x429c0c-0x0;var _0x45c8a5=_0x6e7e[_0x429c0c];return _0x45c8a5;};'use strict';var multer=require(_0xe6e7('0x0'));var util=require(_0xe6e7('0x1'));var path=require(_0xe6e7('0x2'));var timeout=require('connect-timeout');var express=require(_0xe6e7('0x3'));var router=express[_0xe6e7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe6e7('0x5'));var interaction=require(_0xe6e7('0x6'));var config=require(_0xe6e7('0x7'));var controller=require(_0xe6e7('0x8'));router[_0xe6e7('0x9')]('/',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0xb')]);router[_0xe6e7('0x9')]('/describe',auth[_0xe6e7('0xa')](),controller['describe']);router[_0xe6e7('0x9')](_0xe6e7('0xc'),auth[_0xe6e7('0xa')](),controller['whoami']);router[_0xe6e7('0x9')](_0xe6e7('0xd'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0xe')]);router[_0xe6e7('0x9')](_0xe6e7('0xf'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x10')]);router['get'](_0xe6e7('0x11'),controller[_0xe6e7('0x12')]);router[_0xe6e7('0x9')]('/:id/open_tabs',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x13')]);router[_0xe6e7('0x9')](_0xe6e7('0x14'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x15')]);router['get'](_0xe6e7('0x16'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x17')]);router[_0xe6e7('0x9')](_0xe6e7('0x18'),auth['isAuthenticated'](),controller[_0xe6e7('0x19')]);router[_0xe6e7('0x9')]('/:id/groups',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x1a')]);router[_0xe6e7('0x9')](_0xe6e7('0x1b'),auth['isAuthenticated'](),controller[_0xe6e7('0x1c')]);router[_0xe6e7('0x9')](_0xe6e7('0x1d'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x1e')]);router['get'](_0xe6e7('0x1f'),auth['isAuthenticated'](),controller[_0xe6e7('0x20')]);router[_0xe6e7('0x9')](_0xe6e7('0x21'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x22')]);router[_0xe6e7('0x9')](_0xe6e7('0x23'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x24')]);router[_0xe6e7('0x9')](_0xe6e7('0x25'),auth['isAuthenticated'](),controller[_0xe6e7('0x26')]);router[_0xe6e7('0x9')](_0xe6e7('0x27'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x28')]);router[_0xe6e7('0x9')](_0xe6e7('0x29'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x2a')]);router[_0xe6e7('0x9')](_0xe6e7('0x2b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x2c')]);router[_0xe6e7('0x9')]('/:id/lists',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x2d')]);router[_0xe6e7('0x9')](_0xe6e7('0x2e'),auth['isAuthenticated'](),controller[_0xe6e7('0x2f')]);router[_0xe6e7('0x9')](_0xe6e7('0x30'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x31')]);router['get'](_0xe6e7('0x32'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x33')]);router[_0xe6e7('0x9')](_0xe6e7('0x34'),auth['isAuthenticated'](),controller[_0xe6e7('0x35')]);router['get']('/:id/openchannel_accounts',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x36')]);router['get'](_0xe6e7('0x37'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x38')]);router[_0xe6e7('0x9')](_0xe6e7('0x39'),auth[_0xe6e7('0xa')](),controller['getChatWebsites']);router[_0xe6e7('0x9')](_0xe6e7('0x3a'),auth[_0xe6e7('0xa')](),controller['getWhatsappAccounts']);router[_0xe6e7('0x9')](_0xe6e7('0x3b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x3c')]);router[_0xe6e7('0x9')](_0xe6e7('0x3d'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x3e')]);router[_0xe6e7('0x3f')](_0xe6e7('0x14'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x40')]);router[_0xe6e7('0x3f')]('/',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x41')]);router[_0xe6e7('0x3f')](_0xe6e7('0x42'),auth[_0xe6e7('0xa')](),controller['bulkCreate']);router[_0xe6e7('0x3f')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0xe6e7('0x43')]({'destination':function(_0x172d84,_0x2fd484,_0x55eca8){_0x55eca8(null,path[_0xe6e7('0x44')](config[_0xe6e7('0x45')],'server/files/images/'));},'filename':function(_0x37e49e,_0x2f7568,_0x389e66){_0x389e66(null,util[_0xe6e7('0x46')](_0xe6e7('0x47'),Date['now'](),_0x2f7568[_0xe6e7('0x48')]));}})});router[_0xe6e7('0x3f')](_0xe6e7('0x11'),upload[_0xe6e7('0x49')](_0xe6e7('0x4a')),controller[_0xe6e7('0x4b')]);router[_0xe6e7('0x3f')](_0xe6e7('0x4c'),auth[_0xe6e7('0xa')](),controller['login']);router[_0xe6e7('0x3f')](_0xe6e7('0x4d'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x4e')]);router['post'](_0xe6e7('0x4f'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x50')]);router[_0xe6e7('0x3f')](_0xe6e7('0x51'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x52')]);router[_0xe6e7('0x3f')](_0xe6e7('0x2b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x53')]);router[_0xe6e7('0x3f')](_0xe6e7('0x54'),auth['isAuthenticated'](),controller[_0xe6e7('0x55')]);router['post']('/:id/mail_interactions',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x56')]);router['post'](_0xe6e7('0x57'),auth['isAuthenticated'](),controller[_0xe6e7('0x58')]);router['post']('/:id/sms_interactions',auth[_0xe6e7('0xa')](),controller['addSmsInteractions']);router[_0xe6e7('0x3f')](_0xe6e7('0x59'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x5a')]);router['post'](_0xe6e7('0x5b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x5c')]);router[_0xe6e7('0x3f')](_0xe6e7('0x32'),auth['isAuthenticated'](),controller[_0xe6e7('0x5d')]);router['post']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xe6e7('0x5e')]);router[_0xe6e7('0x3f')]('/:id/openchannel_accounts',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x5f')]);router[_0xe6e7('0x3f')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xe6e7('0x60')]);router[_0xe6e7('0x3f')]('/:id/chat_websites',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x61')]);router[_0xe6e7('0x3f')]('/:id/whatsapp_accounts',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x62')]);router['post'](_0xe6e7('0x3d'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x63')]);router[_0xe6e7('0x64')](_0xe6e7('0xf'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x65')]);router['put'](_0xe6e7('0x66'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x67')]);router[_0xe6e7('0x68')](_0xe6e7('0x16'),auth['isAuthenticated'](),controller['removeQueues']);router['delete'](_0xe6e7('0x2b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x69')]);router[_0xe6e7('0x68')](_0xe6e7('0xf'),auth[_0xe6e7('0xa')](),controller['destroy']);router[_0xe6e7('0x68')]('/:id/chat_interactions',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x6a')]);router[_0xe6e7('0x68')](_0xe6e7('0x6b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x6c')]);router[_0xe6e7('0x68')](_0xe6e7('0x57'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x6d')]);router[_0xe6e7('0x68')](_0xe6e7('0x6e'),auth[_0xe6e7('0xa')](),controller['removeSmsInteractions']);router['delete'](_0xe6e7('0x59'),auth['isAuthenticated'](),controller[_0xe6e7('0x6f')]);router[_0xe6e7('0x68')](_0xe6e7('0x5b'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x70')]);router['delete']('/:id/fax_accounts',auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x71')]);router[_0xe6e7('0x68')](_0xe6e7('0x34'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x72')]);router['delete'](_0xe6e7('0x73'),auth[_0xe6e7('0xa')](),controller['removeOpenchannelAccounts']);router[_0xe6e7('0x68')](_0xe6e7('0x37'),auth[_0xe6e7('0xa')](),controller[_0xe6e7('0x74')]);router[_0xe6e7('0x68')](_0xe6e7('0x39'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xe6e7('0x68')](_0xe6e7('0x3a'),auth['isAuthenticated'](),controller[_0xe6e7('0x75')]);router[_0xe6e7('0x68')](_0xe6e7('0x3d'),auth['isAuthenticated'](),controller[_0xe6e7('0x76')]);router[_0xe6e7('0x3f')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0xe6e7('0x77')]);module[_0xe6e7('0x78')]=router; \ No newline at end of file +var _0xd201=['format','%s-%s','now','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','createApiKey','put','/:id/password','delete','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeApiKey','/:id/messengerSoundNotification','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/'];(function(_0x41d5f0,_0x37b3c7){var _0x3dd65b=function(_0x3596ea){while(--_0x3596ea){_0x41d5f0['push'](_0x41d5f0['shift']());}};_0x3dd65b(++_0x37b3c7);}(_0xd201,0x17a));var _0x1d20=function(_0x465533,_0x56ab66){_0x465533=_0x465533-0x0;var _0x49489b=_0xd201[_0x465533];return _0x49489b;};'use strict';var multer=require('multer');var util=require(_0x1d20('0x0'));var path=require(_0x1d20('0x1'));var timeout=require('connect-timeout');var express=require(_0x1d20('0x2'));var router=express[_0x1d20('0x3')]();var fs_extra=require(_0x1d20('0x4'));var auth=require(_0x1d20('0x5'));var interaction=require(_0x1d20('0x6'));var config=require(_0x1d20('0x7'));var controller=require(_0x1d20('0x8'));router[_0x1d20('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d20('0xa')]);router[_0x1d20('0x9')](_0x1d20('0xb'),auth[_0x1d20('0xc')](),controller[_0x1d20('0xd')]);router[_0x1d20('0x9')](_0x1d20('0xe'),auth[_0x1d20('0xc')](),controller[_0x1d20('0xf')]);router[_0x1d20('0x9')](_0x1d20('0x10'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x11')]);router[_0x1d20('0x9')](_0x1d20('0x12'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x13')]);router[_0x1d20('0x9')](_0x1d20('0x14'),controller['getAvatar']);router[_0x1d20('0x9')](_0x1d20('0x15'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x16')]);router['get'](_0x1d20('0x17'),auth['isAuthenticated'](),controller[_0x1d20('0x18')]);router[_0x1d20('0x9')]('/:id/queues',auth[_0x1d20('0xc')](),controller[_0x1d20('0x19')]);router['get'](_0x1d20('0x1a'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x1b')]);router[_0x1d20('0x9')](_0x1d20('0x1c'),auth[_0x1d20('0xc')](),controller['getGroups']);router['get']('/:id/recordings',auth[_0x1d20('0xc')](),controller[_0x1d20('0x1d')]);router[_0x1d20('0x9')](_0x1d20('0x1e'),auth[_0x1d20('0xc')](),controller['getScreenRecordings']);router[_0x1d20('0x9')](_0x1d20('0x1f'),auth[_0x1d20('0xc')](),controller['getChatInteractions']);router[_0x1d20('0x9')](_0x1d20('0x20'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x21')]);router[_0x1d20('0x9')](_0x1d20('0x22'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x23')]);router[_0x1d20('0x9')](_0x1d20('0x24'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x25')]);router[_0x1d20('0x9')](_0x1d20('0x26'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x27')]);router['get'](_0x1d20('0x28'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x29')]);router[_0x1d20('0x9')](_0x1d20('0x2a'),auth[_0x1d20('0xc')](),controller['getTeams']);router[_0x1d20('0x9')](_0x1d20('0x2b'),auth[_0x1d20('0xc')](),controller['getLists']);router['get'](_0x1d20('0x2c'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x2d')]);router[_0x1d20('0x9')](_0x1d20('0x2e'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x2f')]);router[_0x1d20('0x9')](_0x1d20('0x30'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x31')]);router[_0x1d20('0x9')](_0x1d20('0x32'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x33')]);router[_0x1d20('0x9')]('/:id/openchannel_accounts',auth[_0x1d20('0xc')](),controller[_0x1d20('0x34')]);router[_0x1d20('0x9')](_0x1d20('0x35'),auth[_0x1d20('0xc')](),controller['getSmsAccounts']);router[_0x1d20('0x9')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0x1d20('0x36')]);router['get'](_0x1d20('0x37'),auth['isAuthenticated'](),controller[_0x1d20('0x38')]);router[_0x1d20('0x9')](_0x1d20('0x39'),auth[_0x1d20('0xc')](),controller['getScheduledCalls']);router['get'](_0x1d20('0x3a'),auth['isAuthenticated'](),controller[_0x1d20('0x3b')]);router[_0x1d20('0x3c')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x1d20('0x3d')]);router[_0x1d20('0x3c')]('/',auth[_0x1d20('0xc')](),controller[_0x1d20('0x3e')]);router[_0x1d20('0x3c')](_0x1d20('0x3f'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x40')]);router[_0x1d20('0x3c')](_0x1d20('0x41'),auth[_0x1d20('0xc')](),controller['addQueues']);var upload=multer({'storage':multer[_0x1d20('0x42')]({'destination':function(_0x749e3f,_0x17dd07,_0x3a7da4){_0x3a7da4(null,path[_0x1d20('0x43')](config[_0x1d20('0x44')],_0x1d20('0x45')));},'filename':function(_0x528cd2,_0x31a077,_0x3e2992){_0x3e2992(null,util[_0x1d20('0x46')](_0x1d20('0x47'),Date[_0x1d20('0x48')](),_0x31a077['originalname']));}})});router[_0x1d20('0x3c')](_0x1d20('0x14'),upload[_0x1d20('0x49')](_0x1d20('0x4a')),controller['addAvatar']);router[_0x1d20('0x3c')](_0x1d20('0x4b'),auth['isAuthenticated'](),controller['login']);router[_0x1d20('0x3c')](_0x1d20('0x4c'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x4d')]);router[_0x1d20('0x3c')](_0x1d20('0x4e'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x4f')]);router[_0x1d20('0x3c')](_0x1d20('0x50'),auth['isAuthenticated'](),controller[_0x1d20('0x51')]);router['post']('/:id/teams',auth[_0x1d20('0xc')](),controller[_0x1d20('0x52')]);router[_0x1d20('0x3c')](_0x1d20('0x53'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x54')]);router[_0x1d20('0x3c')](_0x1d20('0x55'),auth['isAuthenticated'](),controller[_0x1d20('0x56')]);router[_0x1d20('0x3c')]('/:id/fax_interactions',auth['isAuthenticated'](),controller['addFaxInteractions']);router[_0x1d20('0x3c')](_0x1d20('0x57'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x58')]);router[_0x1d20('0x3c')](_0x1d20('0x59'),auth[_0x1d20('0xc')](),controller['addOpenchannelInteractions']);router[_0x1d20('0x3c')](_0x1d20('0x5a'),auth[_0x1d20('0xc')](),controller['addWhatsappInteractions']);router['post'](_0x1d20('0x30'),auth[_0x1d20('0xc')](),controller['addFaxAccounts']);router[_0x1d20('0x3c')](_0x1d20('0x32'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x5b')]);router[_0x1d20('0x3c')](_0x1d20('0x5c'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x5d')]);router[_0x1d20('0x3c')]('/:id/sms_accounts',auth[_0x1d20('0xc')](),controller['addSmsAccounts']);router[_0x1d20('0x3c')]('/:id/chat_websites',auth[_0x1d20('0xc')](),controller[_0x1d20('0x5e')]);router[_0x1d20('0x3c')](_0x1d20('0x37'),auth['isAuthenticated'](),controller['addWhatsappAccounts']);router['post'](_0x1d20('0x3a'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x5f')]);router[_0x1d20('0x60')](_0x1d20('0x12'),auth[_0x1d20('0xc')](),controller['update']);router[_0x1d20('0x60')](_0x1d20('0x61'),auth[_0x1d20('0xc')](),controller['changePassword']);router[_0x1d20('0x62')]('/:id/queues',auth[_0x1d20('0xc')](),controller['removeQueues']);router[_0x1d20('0x62')](_0x1d20('0x2a'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x63')]);router[_0x1d20('0x62')]('/:id',auth[_0x1d20('0xc')](),controller[_0x1d20('0x64')]);router['delete'](_0x1d20('0x53'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x65')]);router[_0x1d20('0x62')]('/:id/mail_interactions',auth[_0x1d20('0xc')](),controller['removeMailInteractions']);router[_0x1d20('0x62')](_0x1d20('0x66'),auth[_0x1d20('0xc')](),controller['removeFaxInteractions']);router[_0x1d20('0x62')](_0x1d20('0x57'),auth[_0x1d20('0xc')](),controller['removeSmsInteractions']);router[_0x1d20('0x62')](_0x1d20('0x59'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x67')]);router[_0x1d20('0x62')](_0x1d20('0x5a'),auth[_0x1d20('0xc')](),controller['removeWhatsappInteractions']);router['delete'](_0x1d20('0x30'),auth['isAuthenticated'](),controller[_0x1d20('0x68')]);router[_0x1d20('0x62')](_0x1d20('0x32'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x69')]);router['delete']('/:id/openchannel_accounts',auth[_0x1d20('0xc')](),controller[_0x1d20('0x6a')]);router[_0x1d20('0x62')]('/:id/sms_accounts',auth[_0x1d20('0xc')](),controller[_0x1d20('0x6b')]);router[_0x1d20('0x62')](_0x1d20('0x6c'),auth[_0x1d20('0xc')](),controller['removeChatWebsites']);router[_0x1d20('0x62')]('/:id/whatsapp_accounts',auth[_0x1d20('0xc')](),controller['removeWhatsappAccounts']);router['delete'](_0x1d20('0x3a'),auth[_0x1d20('0xc')](),controller[_0x1d20('0x6d')]);router['post'](_0x1d20('0x6e'),auth[_0x1d20('0xc')](),controller['messengerSoundNotification']);module[_0x1d20('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 2ea0214..11f495c 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 _0x0352=['toLowerCase','ENUM','admin','agent','telephone','INTEGER','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','transport','join','rfc2833','shortinfo','inband','auto','yes','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','refuse','uas','fingerprint','certificate','passive','actpass','update','update,nonat','TEXT','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0352,0x9a));var _0x2035=function(_0x26be45,_0x154888){_0x26be45=_0x26be45-0x0;var _0xe50f19=_0x0352[_0x26be45];return _0xe50f19;};'use strict';var Sequelize=require(_0x2035('0x0'));var moment=require('moment');var util=require(_0x2035('0x1'));var _=require(_0x2035('0x2'));module[_0x2035('0x3')]={'name':{'type':Sequelize[_0x2035('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5b4ed1){this['setDataValue'](_0x2035('0x5'),_0x5b4ed1);this[_0x2035('0x6')](_0x2035('0x7'),_0x5b4ed1);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x2035('0x4')],'allowNull':![],'set':function(_0xd7f135){this[_0x2035('0x6')]('fullname',_0xd7f135);this[_0x2035('0x6')](_0x2035('0x8'),util[_0x2035('0x9')](_0x2035('0xa'),_0xd7f135,this[_0x2035('0xb')](_0x2035('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2035('0x4')],'allowNull':![],'unique':_0x2035('0xd'),'validate':{'isEmail':!![]},'set':function(_0x8364d6){if(_0x8364d6){this[_0x2035('0x6')](_0x2035('0xd'),_0x8364d6[_0x2035('0xe')]());}}},'role':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x10'),'user',_0x2035('0x11'),_0x2035('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x2035('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':![],'unique':'internal','set':function(_0x2601b8){this['setDataValue'](_0x2035('0xc'),_0x2601b8);this[_0x2035('0x6')](_0x2035('0x14'),_0x2601b8);this[_0x2035('0x6')](_0x2035('0x8'),util[_0x2035('0x9')]('\x22%s\x22\x20<%s>',this[_0x2035('0xb')](_0x2035('0x15')),_0x2601b8));}},'salt':{'type':Sequelize[_0x2035('0x4')]},'phone':{'type':Sequelize[_0x2035('0x4')]},'mobile':{'type':Sequelize[_0x2035('0x4')]},'address':{'type':Sequelize[_0x2035('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x2035('0x4')]},'city':{'type':Sequelize[_0x2035('0x4')]},'country':{'type':Sequelize[_0x2035('0x4')]},'online':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x2035('0x17')]},'voicePause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x2035('0x4')],'defaultValue':_0x2035('0x18')},'lastPauseAt':{'type':Sequelize[_0x2035('0x17')]},'chatCapacity':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x2035('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x2035('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![],'defaultValue':_0x2035('0x19')},'ipaddr':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x2035('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x1a'),'user',_0x2035('0x1b')),'allowNull':!![],'defaultValue':_0x2035('0x1a')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2035('0x1c')},'callingpres':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x1d'),_0x2035('0x1e'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x2035('0x1f'),'PROHIB_PASSED_SCREEN',_0x2035('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2035('0x21'),'set':function(_0x5a8ccf){this[_0x2035('0x6')](_0x2035('0x22'),_0x5a8ccf?_0x5a8ccf[_0x2035('0x23')](','):null);},'get':function(){return this[_0x2035('0xb')]('transport')?this[_0x2035('0xb')](_0x2035('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x24'),'info',_0x2035('0x25'),_0x2035('0x26'),_0x2035('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no','nonat','update',_0x2035('0x29')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![],'defaultValue':_0x2035('0x2a'),'set':function(_0x181af6){this['setDataValue'](_0x2035('0x2b'),_0x181af6?_0x181af6['join'](','):null);},'get':function(){return this[_0x2035('0xb')](_0x2035('0x2b'))?this[_0x2035('0xb')](_0x2035('0x2b'))[_0x2035('0x2c')](','):null;},'comment':_0x2035('0x2d')},'callgroup':{'type':Sequelize[_0x2035('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2035('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x2035('0x4')]},'language':{'type':Sequelize[_0x2035('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2035('0x4')]},'disallow':{'type':Sequelize[_0x2035('0x4')],'allowNull':![],'defaultValue':_0x2035('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2035('0x2f'),'set':function(_0x166c41){this['setDataValue'](_0x2035('0x30'),_0x166c41?_0x166c41[_0x2035('0x23')](';'):_0x2035('0x2f'));},'get':function(){return this['getDataValue'](_0x2035('0x30'))?this['getDataValue'](_0x2035('0x30'))[_0x2035('0x2c')](';'):null;},'comment':_0x2035('0x31')},'autoframing':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![],'set':function(_0xe42a47){this[_0x2035('0x6')]('insecure',_0xe42a47?_0xe42a47['join'](','):null);},'get':function(){return this[_0x2035('0xb')](_0x2035('0x32'))?this[_0x2035('0xb')](_0x2035('0x32'))[_0x2035('0x2c')](','):null;},'comment':_0x2035('0x33')},'trustrpid':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2035('0xf')]('yes','no',_0x2035('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![],'defaultValue':_0x2035('0x28')},'busylevel':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no',_0x2035('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x2035('0xf')]('accept',_0x2035('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x2035('0xf')]('uac','uas'),'allowNull':!![],'defaultValue':_0x2035('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x2035('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x2035('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x2035('0x28'),'no',_0x2035('0x38'),_0x2035('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x2035('0xf')]('active',_0x2035('0x3a'),_0x2035('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x2035('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x2035('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat',_0x2035('0x3c'),_0x2035('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x2035('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x2035('0x17')]},'passwordResetAt':{'type':Sequelize[_0x2035('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x2035('0x3e')]},'showWebBar':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0,'set':function(_0x5a4eaf){this[_0x2035('0x6')]('showWebBar',_0x5a4eaf);var _0x4372ee=this['get']({'plain':!![]});switch(_0x5a4eaf){case 0x0:case 0x1:var _0x41bf25=_0x4372ee[_0x2035('0x22')]?_['isArray'](_0x4372ee[_0x2035('0x22')])?_0x4372ee[_0x2035('0x22')][_0x2035('0x23')]():_0x4372ee[_0x2035('0x22')]:_0x2035('0x21');if(_0x41bf25==='wss'){_0x41bf25=_0x2035('0x21');}this[_0x2035('0x6')]('transport',_0x41bf25);this[_0x2035('0x6')](_0x2035('0x3f'),'no');this[_0x2035('0x6')](_0x2035('0x40'),null);this[_0x2035('0x6')]('force_avp',null);this[_0x2035('0x6')](_0x2035('0x41'),null);this[_0x2035('0x6')](_0x2035('0x42'),null);this['setDataValue'](_0x2035('0x43'),null);this[_0x2035('0x6')](_0x2035('0x44'),null);this[_0x2035('0x6')](_0x2035('0x45'),null);this[_0x2035('0x6')]('dtlsprivatekey',null);this[_0x2035('0x6')](_0x2035('0x46'),'no');break;case 0x2:this['setDataValue'](_0x2035('0x22'),'wss');this[_0x2035('0x6')]('encryption','yes');this[_0x2035('0x6')](_0x2035('0x40'),'yes');this['setDataValue']('force_avp',_0x2035('0x28'));this[_0x2035('0x6')](_0x2035('0x41'),_0x2035('0x28'));this[_0x2035('0x6')](_0x2035('0x42'),_0x2035('0x28'));this[_0x2035('0x6')](_0x2035('0x43'),'no');this[_0x2035('0x6')]('dtlssetup',_0x2035('0x3b'));this[_0x2035('0x6')](_0x2035('0x45'),_0x4372ee[_0x2035('0x45')]||_0x2035('0x47'));this[_0x2035('0x6')](_0x2035('0x48'),_0x4372ee[_0x2035('0x48')]||'/etc/pki/tls/private/motion.key');this[_0x2035('0x6')](_0x2035('0x46'),_0x2035('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x2035('0x3e')],'set':function(_0x1cb775){this[_0x2035('0x6')](_0x2035('0x49'),_0x1cb775?_0x1cb775[_0x2035('0x23')](','):[]);},'get':function(){return this[_0x2035('0xb')]('permissions')?_[_0x2035('0x4a')](this[_0x2035('0xb')](_0x2035('0x49'))[_0x2035('0x2c')](','),function(_0x486400){return parseInt(_0x486400,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x2035('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x2035('0x4')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x2035('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x2035('0xf')](_0x2035('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x2035('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x2035('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x2035('0x4b')],'get':function(){return this[_0x2035('0xb')](_0x2035('0x4c'))?this[_0x2035('0xb')](_0x2035('0x4c')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x2035('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x2469ed){if(typeof _0x2469ed===_0x2035('0x4d')){var _0x4b139f=_0x2469ed==='1'?!![]:_0x2469ed==='0'?![]:_0x2469ed===_0x2035('0x4e')?!![]:_0x2469ed===_0x2035('0x4f')?![]:![];this[_0x2035('0x6')](_0x2035('0x50'),_0x4b139f);}else{this[_0x2035('0x6')](_0x2035('0x50'),_0x2469ed);}}},'blocked':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![],'set':function(_0x41fce6){this['setDataValue'](_0x2035('0x51'),_0x41fce6);if(_0x41fce6===!![]){this[_0x2035('0x6')](_0x2035('0x52'),moment());this[_0x2035('0x6')](_0x2035('0x53'),0x0);}else{this['setDataValue'](_0x2035('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0x2035('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2035('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2035('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x2035('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x2035('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xf484=['from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','getDataValue','split','info','shortinfo','inband','auto','nonat','update','yes','force_rport,comedia','nat','join','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[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','get','isArray','wss','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','encryption','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','moment','util','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','\x22%s\x22\x20<%s>','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer'];(function(_0x344e42,_0x31c2cf){var _0x3d6b58=function(_0x260db9){while(--_0x260db9){_0x344e42['push'](_0x344e42['shift']());}};_0x3d6b58(++_0x31c2cf);}(_0xf484,0x149));var _0x4f48=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf484[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4f48('0x0'));var util=require(_0x4f48('0x1'));var _=require('lodash');module[_0x4f48('0x2')]={'name':{'type':Sequelize[_0x4f48('0x3')],'allowNull':![],'unique':_0x4f48('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4f1d13){this['setDataValue'](_0x4f48('0x4'),_0x4f1d13);this[_0x4f48('0x5')](_0x4f48('0x6'),_0x4f1d13);},'comment':_0x4f48('0x7')},'fullname':{'type':Sequelize[_0x4f48('0x3')],'allowNull':![],'set':function(_0xafeac3){this[_0x4f48('0x5')](_0x4f48('0x8'),_0xafeac3);this['setDataValue'](_0x4f48('0x9'),util['format'](_0x4f48('0xa'),_0xafeac3,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x4f48('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4a3db1){if(_0x4a3db1){this[_0x4f48('0x5')]('email',_0x4a3db1[_0x4f48('0xb')]());}}},'role':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0xd'),_0x4f48('0xe'),_0x4f48('0xf'),_0x4f48('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x4f48('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4f48('0x3')],'defaultValue':_0x4f48('0x11')},'internal':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':![],'unique':_0x4f48('0x13'),'set':function(_0x5e5211){this[_0x4f48('0x5')](_0x4f48('0x13'),_0x5e5211);this['setDataValue'](_0x4f48('0x14'),_0x5e5211);this[_0x4f48('0x5')](_0x4f48('0x9'),util['format'](_0x4f48('0xa'),this['getDataValue'](_0x4f48('0x8')),_0x5e5211));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4f48('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x4f48('0x3')]},'zipcode':{'type':Sequelize[_0x4f48('0x3')]},'userpic':{'type':Sequelize[_0x4f48('0x3')]},'city':{'type':Sequelize[_0x4f48('0x3')]},'country':{'type':Sequelize[_0x4f48('0x3')]},'online':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4f48('0x16')]},'voicePause':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4f48('0x3')],'defaultValue':_0x4f48('0x17')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4f48('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![],'defaultValue':_0x4f48('0x18')},'ipaddr':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x4f48('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x19'),_0x4f48('0xe'),_0x4f48('0x1a')),'allowNull':!![],'defaultValue':_0x4f48('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4f48('0x1b')},'callingpres':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x1c'),'ALLOWED_PASSED_SCREEN',_0x4f48('0x1d'),_0x4f48('0x1e'),_0x4f48('0x1f'),_0x4f48('0x20'),_0x4f48('0x21'),_0x4f48('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![],'defaultValue':_0x4f48('0x23'),'set':function(_0x20145b){this[_0x4f48('0x5')](_0x4f48('0x24'),_0x20145b?_0x20145b['join'](','):null);},'get':function(){return this[_0x4f48('0x25')](_0x4f48('0x24'))?this[_0x4f48('0x25')](_0x4f48('0x24'))[_0x4f48('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4f48('0xc')]('rfc2833',_0x4f48('0x27'),_0x4f48('0x28'),_0x4f48('0x29'),_0x4f48('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x4f48('0xc')]('yes','no',_0x4f48('0x2b'),_0x4f48('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![],'defaultValue':_0x4f48('0x2e'),'set':function(_0x2d4cbf){this[_0x4f48('0x5')](_0x4f48('0x2f'),_0x2d4cbf?_0x2d4cbf[_0x4f48('0x30')](','):null);},'get':function(){return this['getDataValue'](_0x4f48('0x2f'))?this['getDataValue'](_0x4f48('0x2f'))['split'](','):null;},'comment':_0x4f48('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x4f48('0x3')]},'pickupgroup':{'type':Sequelize[_0x4f48('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4f48('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4f48('0x32')},'allow':{'type':Sequelize[_0x4f48('0x3')],'allowNull':![],'defaultValue':_0x4f48('0x33'),'set':function(_0x357f1e){this[_0x4f48('0x5')](_0x4f48('0x34'),_0x357f1e?_0x357f1e[_0x4f48('0x30')](';'):_0x4f48('0x33'));},'get':function(){return this[_0x4f48('0x25')](_0x4f48('0x34'))?this[_0x4f48('0x25')]('allow')['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![],'set':function(_0x34e072){this['setDataValue']('insecure',_0x34e072?_0x34e072[_0x4f48('0x30')](','):null);},'get':function(){return this[_0x4f48('0x25')]('insecure')?this[_0x4f48('0x25')]('insecure')[_0x4f48('0x26')](','):null;},'comment':_0x4f48('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4f48('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no',_0x4f48('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![],'defaultValue':_0x4f48('0x37')},'amaflags':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no',_0x4f48('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4f48('0xc')]('accept',_0x4f48('0x39'),_0x4f48('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4f48('0xc')]('uac','uas'),'allowNull':!![],'defaultValue':_0x4f48('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0x4f48('0x2d')},'keepalive':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4f48('0xc')]('yes','no',_0x4f48('0x3c'),_0x4f48('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x3e'),_0x4f48('0x3f'),_0x4f48('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4f48('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x4f48('0x2d'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4f48('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x4f48('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x18feff){this['setDataValue']('showWebBar',_0x18feff);var _0x5da110=this[_0x4f48('0x41')]({'plain':!![]});switch(_0x18feff){case 0x0:case 0x1:var _0x4c2327=_0x5da110['transport']?_[_0x4f48('0x42')](_0x5da110[_0x4f48('0x24')])?_0x5da110['transport'][_0x4f48('0x30')]():_0x5da110[_0x4f48('0x24')]:_0x4f48('0x23');if(_0x4c2327===_0x4f48('0x43')){_0x4c2327='udp';}this[_0x4f48('0x5')]('transport',_0x4c2327);this[_0x4f48('0x5')]('encryption','no');this[_0x4f48('0x5')](_0x4f48('0x44'),null);this[_0x4f48('0x5')](_0x4f48('0x45'),null);this[_0x4f48('0x5')](_0x4f48('0x46'),null);this[_0x4f48('0x5')](_0x4f48('0x47'),null);this['setDataValue'](_0x4f48('0x48'),null);this[_0x4f48('0x5')](_0x4f48('0x49'),null);this[_0x4f48('0x5')](_0x4f48('0x4a'),null);this[_0x4f48('0x5')](_0x4f48('0x4b'),null);this[_0x4f48('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x4f48('0x24'),'wss');this[_0x4f48('0x5')](_0x4f48('0x4c'),_0x4f48('0x2d'));this[_0x4f48('0x5')](_0x4f48('0x44'),'yes');this['setDataValue'](_0x4f48('0x45'),_0x4f48('0x2d'));this[_0x4f48('0x5')](_0x4f48('0x46'),_0x4f48('0x2d'));this['setDataValue'](_0x4f48('0x47'),'yes');this[_0x4f48('0x5')](_0x4f48('0x48'),'no');this[_0x4f48('0x5')]('dtlssetup',_0x4f48('0x40'));this[_0x4f48('0x5')](_0x4f48('0x4a'),_0x5da110[_0x4f48('0x4a')]||_0x4f48('0x4d'));this['setDataValue'](_0x4f48('0x4b'),_0x5da110[_0x4f48('0x4b')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x4f48('0x4e'),_0x4f48('0x2d'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a08d4){this[_0x4f48('0x5')](_0x4f48('0x4f'),_0x1a08d4?_0x1a08d4[_0x4f48('0x30')](','):[]);},'get':function(){return this[_0x4f48('0x25')](_0x4f48('0x4f'))?_[_0x4f48('0x50')](this[_0x4f48('0x25')](_0x4f48('0x4f'))['split'](','),function(_0x5c67b8){return parseInt(_0x5c67b8,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4f48('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4f48('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x4f48('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4f48('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4f48('0xc')](_0x4f48('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4f48('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4f48('0x25')](_0x4f48('0x51'))?this[_0x4f48('0x25')](_0x4f48('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x4f48('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4f48('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![],'set':function(_0x29cf81){if(typeof _0x29cf81==='string'){var _0x3b0994=_0x29cf81==='1'?!![]:_0x29cf81==='0'?![]:_0x29cf81===_0x4f48('0x52')?!![]:_0x29cf81===_0x4f48('0x53')?![]:![];this[_0x4f48('0x5')](_0x4f48('0x54'),_0x3b0994);}else{this[_0x4f48('0x5')]('screenrecording',_0x29cf81);}}},'blocked':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![],'set':function(_0x5b66ba){this[_0x4f48('0x5')](_0x4f48('0x55'),_0x5b66ba);if(_0x5b66ba===!![]){this['setDataValue']('blockedAt',moment());this[_0x4f48('0x5')](_0x4f48('0x56'),0x0);}else{this['setDataValue'](_0x4f48('0x57'),null);}}},'blockedAt':{'type':Sequelize[_0x4f48('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x4f48('0x12')](0x5)[_0x4f48('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x4f48('0x12')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x4f48('0x15')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 8fca767..d2ebbaa 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 _0xe7b2=['$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','createApiKey','generateApiKey','iat','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','true','getPresence','unknown','ringing','teams','queues','inbound','getAgents','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','offline','voiceStatus','unavailable','busy','charAt','select','field','ui.','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','OpenTabs','messengerSoundNotification','enabled','moment','path','ioredis','jayson/promise','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIForbiddenrror','handleError','socket.io-emitter','redis','register','defaults','client','http','status','end','json','undefined','limit','count','set','Content-Range','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','update','emit','destroy','get','admin','Users','agent','Telephones','telephone','filter','ignore','value','includes','role','find','name','UserProfileResource','send','User','rawAttributes','map','fieldName','key','previousPasswords','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','query','userSetting','attributes','openTabs','rows','length','push','chat','sms','dataValues','fax','mail','openchannel','whatsapp','catch','show','params','includeAll','include','merge','all','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','password','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','fullname','email','permissions','102','113','110','104','105','106','107','108','109','111','114','create','Unauthorized','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','findAll','compact','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','QueueId','toLowerCase','Queue:save','voice','format','SIP/%s','UserVoiceQueueRt','removeQueues','channel','remove','addAvatar','userpic','file','filename','getAvatar','download','existsSync','join','root','server/files/images/','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OPENCHANNEL','MAIL','SMS','WhatsappOpenTabs','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','color','tag','model','keys','Queue','filters','intersection','fields','order','sort','where','pick','options','Unknown\x20role','nolimit','offset','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','mobile','interface','intrf','user:%s','headers','x-forwarded-for','remoteAddress','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','logout','pause','QueuePause','updateAttributes','type','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','Team','getTeams','addTeams','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','isArray','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeTeams','UserVoicePrefix','Queue:remove','getLists','values','CmHopper','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in'];(function(_0x2d41cc,_0x5eb3f8){var _0x1dc9ec=function(_0x3e60f2){while(--_0x3e60f2){_0x2d41cc['push'](_0x2d41cc['shift']());}};_0x1dc9ec(++_0x5eb3f8);}(_0xe7b2,0x1cf));var _0x2e7b=function(_0x3a6555,_0x3c790a){_0x3a6555=_0x3a6555-0x0;var _0x4bec35=_0xe7b2[_0x3a6555];return _0x4bec35;};'use strict';var moment=require(_0x2e7b('0x0'));var util=require('util');var path=require(_0x2e7b('0x1'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var Redis=require(_0x2e7b('0x2'));var jayson=require(_0x2e7b('0x3'));var authService=require(_0x2e7b('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x2e7b('0x5'));var rta=require(_0x2e7b('0x6'));var logger=require(_0x2e7b('0x7'))(_0x2e7b('0x8'));var utils=require(_0x2e7b('0x9'));var config=require(_0x2e7b('0xa'));var licenseUtil=require(_0x2e7b('0xb'));var APIBadRequestError=require(_0x2e7b('0xc'))['APIBadRequestError'];var APINotFoundError=require(_0x2e7b('0xc'))['APINotFoundError'];var APIForbiddenError=require(_0x2e7b('0xc'))[_0x2e7b('0xd')];var APIHandleError=require(_0x2e7b('0xc'))[_0x2e7b('0xe')];var db=require('../../mysqldb')['db'];var socket=require(_0x2e7b('0xf'))(new Redis(config[_0x2e7b('0x10')]));require('./user.socket')[_0x2e7b('0x11')](socket);config['redis']=_[_0x2e7b('0x12')](config[_0x2e7b('0x10')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0x2e7b('0x13')][_0x2e7b('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x503791,_0x53baf5){_0x53baf5=_0x53baf5||0xcc;return function(_0x235311){if(_0x235311){return _0x503791['sendStatus'](_0x53baf5);}return _0x503791[_0x2e7b('0x15')](_0x53baf5)[_0x2e7b('0x16')]();};}function respondWithResult(_0x4c05ef,_0xcf2113){_0xcf2113=_0xcf2113||0xc8;return function(_0x421e78){if(_0x421e78){return _0x4c05ef['status'](_0xcf2113)[_0x2e7b('0x17')](_0x421e78);}};}function respondWithFilteredResult(_0x31905e,_0xa46639){return function(_0x57911c){if(_0x57911c){var _0x2879ad=typeof _0xa46639['offset']===_0x2e7b('0x18')&&typeof _0xa46639[_0x2e7b('0x19')]===_0x2e7b('0x18');var _0x4b67ce=_0x57911c[_0x2e7b('0x1a')];var _0x514b66=_0x2879ad?0x0:_0xa46639['offset'];var _0x3c8b96=_0x2879ad?_0x57911c[_0x2e7b('0x1a')]:_0xa46639['offset']+_0xa46639['limit'];var _0x1d2b4c;if(_0x3c8b96>=_0x4b67ce){_0x3c8b96=_0x4b67ce;_0x1d2b4c=0xc8;}else{_0x1d2b4c=0xce;}_0x31905e['status'](_0x1d2b4c);return _0x31905e[_0x2e7b('0x1b')](_0x2e7b('0x1c'),_0x514b66+'-'+_0x3c8b96+'/'+_0x4b67ce)[_0x2e7b('0x17')](_0x57911c);}return null;};}function respondWithRpcPromise(_0x51d539,_0x2ecc47,_0x421fa4,_0x4c5247){return new Promise(function(_0x44268e,_0x53903c){var _0x138f1e=_0x4c5247||amiClient;return _0x138f1e['request'](_0x51d539,_0x421fa4)[_0x2e7b('0x1d')](function(_0x1f17ea){logger['info'](_0x2e7b('0x1e'),_0x2ecc47,_0x2e7b('0x1f'));logger[_0x2e7b('0x20')](_0x2e7b('0x21'),_0x2ecc47,_0x2e7b('0x1f'),JSON[_0x2e7b('0x22')](_0x1f17ea));if(_0x1f17ea[_0x2e7b('0x23')]){if(_0x1f17ea[_0x2e7b('0x23')][_0x2e7b('0x24')]===0x1f4){logger[_0x2e7b('0x23')]('User,\x20%s,\x20%s',_0x2ecc47,_0x1f17ea[_0x2e7b('0x23')][_0x2e7b('0x25')]);return _0x53903c(_0x1f17ea['error'][_0x2e7b('0x25')]);}logger['error'](_0x2e7b('0x1e'),_0x2ecc47,_0x1f17ea[_0x2e7b('0x23')]['message']);return _0x44268e(_0x1f17ea[_0x2e7b('0x23')][_0x2e7b('0x25')]);}else{logger[_0x2e7b('0x26')]('User,\x20%s,\x20%s',_0x2ecc47,_0x2e7b('0x1f'));_0x44268e(_0x1f17ea[_0x2e7b('0x27')][_0x2e7b('0x25')]);}})['catch'](function(_0x2a6d8e){logger[_0x2e7b('0x23')]('User,\x20%s,\x20%s',_0x2ecc47,_0x2a6d8e);_0x53903c(_0x2a6d8e);});});}function saveUpdates(_0x560621){return function(_0x217d64){if(_0x217d64){return _0x217d64[_0x2e7b('0x28')](_0x560621)[_0x2e7b('0x1d')](function(_0x4946e){if(_0x4946e['role']==='agent'){socket[_0x2e7b('0x29')]('userNotification:recalc:'+_0x4946e['id'],_0x4946e);}return _0x4946e;});}return null;};}function removeEntity(_0x3087c4,_0x596804){return function(_0x38f698){if(_0x38f698){return _0x38f698[_0x2e7b('0x2a')]({'transaction':_0x596804})['then'](function(){var _0x2a75aa=_0x38f698[_0x2e7b('0x2b')]({'plain':!![]});if(_0x2a75aa['role']===_0x2e7b('0x2c'))return;var _0x2036ca=[{'name':_0x2e7b('0x2d'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x2e7b('0x2e'),'ignore':![]},{'name':_0x2e7b('0x2f'),'value':_0x2e7b('0x30'),'ignore':![]}];var _0x520e47=_(_0x2036ca)[_0x2e7b('0x31')](_0x2e7b('0x32'))['map'](_0x2e7b('0x33'))[_0x2e7b('0x33')]();if(_[_0x2e7b('0x34')](_0x520e47,_0x2a75aa[_0x2e7b('0x35')])){return;}var _0x5114dd=_[_0x2e7b('0x36')](_0x2036ca,[_0x2e7b('0x33'),_0x2a75aa[_0x2e7b('0x35')]])[_0x2e7b('0x37')];return db[_0x2e7b('0x38')][_0x2e7b('0x2a')]({'where':{'type':_0x5114dd,'resourceId':_0x2a75aa['id']},'transaction':_0x596804})[_0x2e7b('0x1d')](function(){return _0x38f698;});})[_0x2e7b('0x1d')](function(){_0x3087c4[_0x2e7b('0x15')](0xcc)[_0x2e7b('0x16')]();});}};}function handleEntityNotFound(_0x2dcc13){return function(_0x359c21){if(!_0x359c21){_0x2dcc13['sendStatus'](0x194);}return _0x359c21;};}function handleError(_0x2d6b5f,_0x2e910e){_0x2e910e=_0x2e910e||0x1f4;return function(_0x53936e){logger[_0x2e7b('0x23')](_0x53936e['stack']);if(_0x53936e[_0x2e7b('0x37')]){delete _0x53936e[_0x2e7b('0x37')];}_0x2d6b5f[_0x2e7b('0x15')](_0x2e910e)[_0x2e7b('0x39')](_0x53936e);};}function getUserAttributes(){return _(db[_0x2e7b('0x3a')][_0x2e7b('0x3b')])[_0x2e7b('0x3c')](function(_0x1d1618){return{'name':_0x1d1618[_0x2e7b('0x3d')],'type':_0x1d1618['type'][_0x2e7b('0x3e')]};})[_0x2e7b('0x31')](function(_0x23e569){return!['password','salt',_0x2e7b('0x3f'),_0x2e7b('0x40'),_0x2e7b('0x41'),_0x2e7b('0x42')][_0x2e7b('0x34')](_0x23e569[_0x2e7b('0x37')]);})[_0x2e7b('0x33')]();}exports[_0x2e7b('0x43')]=function(_0x50d92c,_0x430bbe){var _0x512501={},_0xb48798={'count':0x0,'rows':[]};var _0x3c66c2=getUserAttributes();_0x512501=qs[_0x2e7b('0x44')](_0x3c66c2,_0x50d92c);var _0x5eecb0={'where':_0x512501['where']};return db[_0x2e7b('0x3a')][_0x2e7b('0x1a')](_0x5eecb0)[_0x2e7b('0x1d')](function(_0x25d8fc){_0xb48798[_0x2e7b('0x1a')]=_0x25d8fc;if(_0x50d92c[_0x2e7b('0x45')]['includeAll']){_0x512501['include']=[{'all':!![]}];}if(_0x50d92c[_0x2e7b('0x45')][_0x2e7b('0x46')]==='true'){_0x512501['include']=[{'model':db['UserSetting'],'as':_0x2e7b('0x46')}];}if(!_[_0x2e7b('0x34')](_0x512501['attributes'],'id')){_0x512501[_0x2e7b('0x47')]['push']('id');}return db['User']['findAll'](_0x512501);})['then'](function(_0x49de79){_0xb48798['rows']=_0x49de79;if(_0x50d92c[_0x2e7b('0x45')][_0x2e7b('0x48')]==='true'){var _0x287ee0=[];for(var _0x59711c=0x0;_0x59711c<_0xb48798[_0x2e7b('0x49')][_0x2e7b('0x4a')];_0x59711c++){_0x287ee0[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4c'),_0xb48798[_0x2e7b('0x49')][_0x59711c]['dataValues']));_0x287ee0[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4d'),_0xb48798['rows'][_0x59711c][_0x2e7b('0x4e')]));_0x287ee0['push'](get_open_tabs(_0x2e7b('0x4f'),_0xb48798[_0x2e7b('0x49')][_0x59711c][_0x2e7b('0x4e')]));_0x287ee0[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x50'),_0xb48798['rows'][_0x59711c][_0x2e7b('0x4e')]));_0x287ee0[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x51'),_0xb48798[_0x2e7b('0x49')][_0x59711c][_0x2e7b('0x4e')]));_0x287ee0[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x52'),_0xb48798[_0x2e7b('0x49')][_0x59711c]['dataValues']));}return Promise['all'](_0x287ee0)[_0x2e7b('0x1d')](function(){return _0xb48798;});}else{return _0xb48798;}})[_0x2e7b('0x1d')](respondWithFilteredResult(_0x430bbe,_0x512501))[_0x2e7b('0x53')](handleError(_0x430bbe,null));};exports[_0x2e7b('0x54')]=function(_0x21414f,_0x3a01bc){var _0x3b3758=getUserAttributes();_0x21414f[_0x2e7b('0x45')]['id']=_0x21414f[_0x2e7b('0x55')]['id'];var _0x185a2d=qs[_0x2e7b('0x44')](_0x3b3758,_0x21414f);if(_0x21414f['query'][_0x2e7b('0x56')]){_0x185a2d['include']=[{'all':!![]}];}if(_0x21414f['query'][_0x2e7b('0x46')]==='true'){_0x185a2d[_0x2e7b('0x57')]=[{'model':db['UserSetting'],'as':_0x2e7b('0x46')}];}_0x185a2d=_[_0x2e7b('0x58')]({},_0x185a2d,_0x21414f['options']);if(!_['includes'](_0x185a2d[_0x2e7b('0x47')],'id')){_0x185a2d['attributes']['push']('id');}return db['User'][_0x2e7b('0x36')](_0x185a2d)['then'](handleEntityNotFound(_0x3a01bc,null))[_0x2e7b('0x1d')](function(_0x4d5393){var _0x393504=[];values=_0x4d5393;if(_0x21414f['query'][_0x2e7b('0x48')]==='true'){_0x393504[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4c'),_0x4d5393['dataValues']));_0x393504[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4d'),_0x4d5393[_0x2e7b('0x4e')]));_0x393504[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x51'),_0x4d5393['dataValues']));_0x393504['push'](get_open_tabs(_0x2e7b('0x52'),_0x4d5393['dataValues']));_0x393504[_0x2e7b('0x4b')](get_open_tabs('fax',_0x4d5393[_0x2e7b('0x4e')]));_0x393504['push'](get_open_tabs(_0x2e7b('0x50'),_0x4d5393[_0x2e7b('0x4e')]));return Promise[_0x2e7b('0x59')](_0x393504);}else{return values;}})['then'](function(){return values;})[_0x2e7b('0x1d')](respondWithResult(_0x3a01bc,null))[_0x2e7b('0x53')](handleError(_0x3a01bc,null));};exports[_0x2e7b('0x28')]=function(_0x24308f,_0x461557){if(_0x24308f[_0x2e7b('0x5a')]['id']){delete _0x24308f[_0x2e7b('0x5a')]['id'];}delete _0x24308f['body'][_0x2e7b('0x35')];return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0x24308f['params']['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x461557,null))[_0x2e7b('0x1d')](saveUpdates(_0x24308f[_0x2e7b('0x5a')],null))[_0x2e7b('0x1d')](respondWithResult(_0x461557,null))[_0x2e7b('0x53')](handleError(_0x461557,null));};exports[_0x2e7b('0x5b')]=function(_0x40fd98,_0x12931d){return db[_0x2e7b('0x3a')][_0x2e7b('0x5b')]()[_0x2e7b('0x1d')](respondWithResult(_0x12931d,null))[_0x2e7b('0x53')](handleError(_0x12931d,null));};exports[_0x2e7b('0x5c')]=function(_0x1fff06,_0x5113ec){return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0x1fff06[_0x2e7b('0x55')]['id']}})['then'](handleEntityNotFound(_0x5113ec,null))[_0x2e7b('0x1d')](function(_0x45440a){if(_0x45440a){return _0x45440a['addContacts'](_0x1fff06[_0x2e7b('0x5a')]['ids'],_[_0x2e7b('0x5d')](_0x1fff06[_0x2e7b('0x5a')],[_0x2e7b('0x5e'),'id'])||{});}})[_0x2e7b('0x1d')](respondWithResult(_0x5113ec,null))[_0x2e7b('0x53')](handleError(_0x5113ec,null));};function validateUser(_0x53c827){return new Promise(function(_0x1992ac,_0x312880){if(_0x53c827[_0x2e7b('0x5f')])return _0x1992ac(_0x53c827);return db[_0x2e7b('0x60')][_0x2e7b('0x61')](0x1)[_0x2e7b('0x1d')](function(_0x3f7ab6){if(_0x3f7ab6[_0x2e7b('0x62')])authService[_0x2e7b('0x63')](_0x53c827[_0x2e7b('0x64')]);db[_0x2e7b('0x3a')][_0x2e7b('0x65')](_0x2e7b('0x5f'))[_0x2e7b('0x1d')](function(_0x1735b0){if(_[_0x2e7b('0x66')](_0x1735b0)){_0x53c827[_0x2e7b('0x5f')]=_0x3f7ab6[_0x2e7b('0x67')]||0x1;return;}if(_['isNil'](_0x3f7ab6[_0x2e7b('0x67')])||_0x3f7ab6[_0x2e7b('0x67')]===_0x1735b0){_0x53c827[_0x2e7b('0x5f')]=_0x1735b0+0x1;return;}if(_0x3f7ab6[_0x2e7b('0x67')]>_0x1735b0){_0x53c827[_0x2e7b('0x5f')]=_0x3f7ab6[_0x2e7b('0x67')];return;}return db[_0x2e7b('0x68')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0x2e7b('0x69')][_0x2e7b('0x6a')]})[_0x2e7b('0x1d')](function(_0x47fddf){if(_0x47fddf&&_0x47fddf[_0x2e7b('0x4a')]){for(var _0x451a77=0x0,_0x21501c=_0x47fddf[_0x2e7b('0x4a')];_0x451a77<_0x21501c&&_[_0x2e7b('0x66')](_0x53c827['internal']);_0x451a77++){if(_0x3f7ab6['min_internal']<=_0x47fddf[_0x451a77]['from']){_0x53c827[_0x2e7b('0x5f')]=_0x47fddf[_0x451a77][_0x2e7b('0x6b')];}else if(_0x3f7ab6[_0x2e7b('0x67')]>_0x47fddf[_0x451a77][_0x2e7b('0x6b')]&&_0x3f7ab6['min_internal']<=_0x47fddf[_0x451a77]['to']){_0x53c827[_0x2e7b('0x5f')]=_0x3f7ab6[_0x2e7b('0x67')];}}}if(_[_0x2e7b('0x66')](_0x53c827[_0x2e7b('0x5f')])){_0x53c827[_0x2e7b('0x5f')]=_0x1735b0+0x1;}return _0x1992ac(_0x53c827);});});})[_0x2e7b('0x53')](function(_0x341134){_0x312880(_0x341134);});});}function updateUser(_0x515cb5){return new Promise(function(_0x52b57a,_0x267b4d){try{if(_0x515cb5[_0x2e7b('0x6c')]){_0x515cb5['mailbox']=_0x515cb5[_0x2e7b('0x5f')];_0x515cb5['VoiceMail']={'mailbox':_0x515cb5[_0x2e7b('0x5f')],'password':_0x515cb5[_0x2e7b('0x64')],'fullname':_0x515cb5[_0x2e7b('0x6d')],'email':_0x515cb5[_0x2e7b('0x6e')]};}if(_0x515cb5[_0x2e7b('0x35')]===_0x2e7b('0x2e')){if(!_0x515cb5[_0x2e7b('0x6f')])_0x515cb5[_0x2e7b('0x6f')]=['101',_0x2e7b('0x70'),'103',_0x2e7b('0x71'),_0x2e7b('0x72'),_0x2e7b('0x73'),_0x2e7b('0x74'),_0x2e7b('0x75'),_0x2e7b('0x76'),_0x2e7b('0x77'),_0x2e7b('0x78'),'100',_0x2e7b('0x79'),_0x2e7b('0x7a'),'115'];}_0x52b57a(_0x515cb5);}catch(_0x155fff){_0x267b4d(_0x155fff);}});}exports[_0x2e7b('0x7b')]=function(_0x5c59ba,_0x2d834e){if(_0x5c59ba['user'][_0x2e7b('0x35')]===_0x2e7b('0x2e'))throw new Error(_0x2e7b('0x7c'));if(_0x5c59ba[_0x2e7b('0x5a')]['role']===_0x2e7b('0x7d')&&_0x5c59ba[_0x2e7b('0x7d')]['role']!==_0x2e7b('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5c59ba[_0x2e7b('0x5a')][_0x2e7b('0x35')]===_0x2e7b('0x2c')&&_0x5c59ba[_0x2e7b('0x7d')][_0x2e7b('0x35')]!==_0x2e7b('0x2c')){throw new Error(_0x2e7b('0x7e'));}return licenseUtil[_0x2e7b('0x7f')]([_0x5c59ba[_0x2e7b('0x5a')]])['then'](function(){return validateUser(_0x5c59ba[_0x2e7b('0x5a')]);})[_0x2e7b('0x1d')](function(_0x24962f){return updateUser(_0x24962f)[_0x2e7b('0x1d')](function(_0x365780){if(_0x365780['role']===_0x2e7b('0x2c')){_0x365780[_0x2e7b('0x80')]=_0x5c59ba[_0x2e7b('0x7d')][_0x2e7b('0x80')];delete _0x365780[_0x2e7b('0x81')];}return _0x365780;});})[_0x2e7b('0x1d')](function(_0xfd4e42){return db[_0x2e7b('0x3a')]['create'](_0xfd4e42,{'include':[{'model':db['VoiceMail'],'as':_0x2e7b('0x82')}]});})[_0x2e7b('0x1d')](function(_0x1ae018){if(_0x5c59ba['body'][_0x2e7b('0x35')]===_0x2e7b('0x7d'))return _0x1ae018;if(_0x5c59ba[_0x2e7b('0x7d')]['role']!=='user')return _0x1ae018;return db[_0x2e7b('0x83')][_0x2e7b('0x36')]({'where':{'name':_0x1ae018['role']===_0x2e7b('0x2e')?_0x2e7b('0x84'):_0x2e7b('0x2f'),'userProfileId':_0x5c59ba[_0x2e7b('0x7d')]['userProfileId']},'raw':!![]})[_0x2e7b('0x1d')](function(_0x45e961){if(!_0x45e961||_0x45e961[_0x2e7b('0x85')]!=0x0)return _0x1ae018;return db['UserProfileResource']['create']({'name':_0x1ae018[_0x2e7b('0x37')],'resourceId':_0x1ae018['id'],'type':_0x45e961['name'],'sectionId':_0x45e961['id']},{})[_0x2e7b('0x1d')](function(){return _0x1ae018;});})['catch'](function(_0x26e6f0){logger['error'](_0x2e7b('0x86'),_0x26e6f0);throw _0x26e6f0;});})['then'](respondWithResult(_0x2d834e,0xc9))[_0x2e7b('0x53')](handleError(_0x2d834e,null));};exports[_0x2e7b('0x87')]=function(_0x562825,_0x3d5592){var _0x1f8add=_0x562825['body'];var _0x2512a2=[];if(_0x562825['user'][_0x2e7b('0x35')]===_0x2e7b('0x2e'))throw new Error('Unauthorized');if(_[_0x2e7b('0x88')](_0x1f8add,[_0x2e7b('0x35'),'user'])&&_0x562825['user'][_0x2e7b('0x35')]!==_0x2e7b('0x2c')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2e7b('0x88')](_0x1f8add,[_0x2e7b('0x35'),_0x2e7b('0x2c')])&&_0x562825['user']['role']!==_0x2e7b('0x2c')){throw new Error(_0x2e7b('0x89'));}return licenseUtil['checkUserLimits'](_0x1f8add)[_0x2e7b('0x1d')](function(){return validateUser(_0x1f8add[0x0]);})[_0x2e7b('0x1d')](function(){for(var _0x4c1827=0x1;_0x4c1827<_0x1f8add[_0x2e7b('0x4a')];_0x4c1827++){var _0xc37c82=_0x1f8add[_0x4c1827-0x1][_0x2e7b('0x5f')];if(!_0x1f8add[_0x4c1827][_0x2e7b('0x5f')])_0x1f8add[_0x4c1827][_0x2e7b('0x5f')]=_0xc37c82+0x1;_0x2512a2[_0x2e7b('0x4b')](validateUser(_0x1f8add[_0x4c1827]));}return Promise[_0x2e7b('0x59')](_0x2512a2);})[_0x2e7b('0x1d')](function(){_0x2512a2=[];for(var _0x2440ed=0x0;_0x2440ed<_0x1f8add['length'];_0x2440ed++){_0x2512a2[_0x2e7b('0x4b')](updateUser(_0x1f8add[_0x2440ed]));}return Promise[_0x2e7b('0x59')](_0x2512a2);})[_0x2e7b('0x1d')](function(){_0x2512a2=_0x1f8add[_0x2e7b('0x3c')](function(_0x429837){return db[_0x2e7b('0x3a')][_0x2e7b('0x7b')](_0x429837,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x2e7b('0x1d')](function(_0x14984c){_0x429837['id']=_0x14984c['id'];return _0x429837;});});return Promise[_0x2e7b('0x59')](_0x2512a2);})['then'](function(_0x3364c0){if(_0x562825[_0x2e7b('0x5a')][_0x2e7b('0x35')]===_0x2e7b('0x7d'))return _0x3364c0;if(_0x562825[_0x2e7b('0x7d')][_0x2e7b('0x35')]!==_0x2e7b('0x7d'))return _0x3364c0;var _0x116114=_[_0x2e7b('0x88')](_0x3364c0,function(_0x4abdd5){return _0x4abdd5[_0x2e7b('0x35')]===_0x2e7b('0x2e')||_0x4abdd5[_0x2e7b('0x35')]===_0x2e7b('0x30');});if(!_0x116114)return _0x3364c0;return db[_0x2e7b('0x83')][_0x2e7b('0x8a')]({'where':{'name':{'$or':[_0x2e7b('0x84'),_0x2e7b('0x2f')]},'userProfileId':_0x562825['user'][_0x2e7b('0x81')]},'raw':!![]})[_0x2e7b('0x1d')](function(_0xc4b4d5){if(_['isEmpty'](_0xc4b4d5)||!_[_0x2e7b('0x88')](_0xc4b4d5,[_0x2e7b('0x85'),0x0]))return _0x3364c0;_0x2512a2=[];var _0x200c66=_(_0xc4b4d5)[_0x2e7b('0x3c')](function(_0x4ab644){if(_0x4ab644[_0x2e7b('0x85')]===0x1)return;return _0x4ab644['name']===_0x2e7b('0x84')?_0x2e7b('0x2e'):_0x2e7b('0x30');})[_0x2e7b('0x8b')]()[_0x2e7b('0x33')]();for(var _0xdd249a=0x0;_0xdd249a<_0x3364c0['length'];_0xdd249a++){if(!_[_0x2e7b('0x34')](_0x200c66,_0x3364c0[_0xdd249a][_0x2e7b('0x35')]))return;var _0x2cceab=_0x3364c0[_0xdd249a][_0x2e7b('0x35')]===_0x2e7b('0x2e')?_0x2e7b('0x84'):_0x2e7b('0x2f');_0x2512a2[_0x2e7b('0x4b')](db[_0x2e7b('0x38')]['create']({'name':_0x3364c0[_0xdd249a][_0x2e7b('0x37')],'resourceId':_0x3364c0[_0xdd249a]['id'],'type':_0x2cceab,'sectionId':_['find'](_0xc4b4d5,[_0x2e7b('0x37'),_0x2cceab])['id']},{}));}return Promise[_0x2e7b('0x59')](_0x2512a2);});})[_0x2e7b('0x1d')](respondWithResult(_0x3d5592,0xc9))[_0x2e7b('0x53')](handleError(_0x3d5592,null));};exports['changePassword']=function(_0x1a1847,_0xf08a40){if(_0x1a1847[_0x2e7b('0x5a')]['id']){delete _0x1a1847[_0x2e7b('0x5a')]['id'];}return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0x1a1847[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](function(_0x381124){if(!_0x381124)return null;if(_0x381124['id']===_0x1a1847[_0x2e7b('0x7d')]['id']){if(!_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8c')]||!_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')]){throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0x90'));}if(!_0x381124[_0x2e7b('0x91')](_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8c')])){throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0x92'));}if(_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8c')]===_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')]){throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x1a1847['user'][_0x2e7b('0x35')]===_0x2e7b('0x2c')){if(!_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')]){throw new db['Sequelize'][(_0x2e7b('0x8f'))](_0x2e7b('0x93'));}}else if(_0x1a1847[_0x2e7b('0x7d')]['role']===_0x2e7b('0x7d')){if(!_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')]){throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0x93'));}if(_0x381124[_0x2e7b('0x35')]!==_0x2e7b('0x2e')){throw new db['Sequelize'][(_0x2e7b('0x8f'))](_0x2e7b('0x7c'));}}else{throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0x7c'));}return _0x381124;})[_0x2e7b('0x1d')](handleEntityNotFound(_0xf08a40,null))['then'](function(_0x4eff13){return db[_0x2e7b('0x60')][_0x2e7b('0x94')]({'attributes':['id',_0x2e7b('0x62'),_0x2e7b('0x95'),_0x2e7b('0x96')]})[_0x2e7b('0x1d')](function(_0x6d9c76){if(_0x6d9c76[_0x2e7b('0x62')])authService[_0x2e7b('0x63')](_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')]);if(!_0x6d9c76['enforcePasswordHistory']||!_0x4eff13[_0x2e7b('0x3f')])return _0x4eff13;authService['validatePasswordHistory'](_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')],_0x4eff13[_0x2e7b('0x3f')],_0x6d9c76[_0x2e7b('0x96')]);return _0x4eff13;})[_0x2e7b('0x1d')](saveUpdates({'password':_0x1a1847[_0x2e7b('0x5a')]['newPassword'],'passwordResetAt':_0x1a1847[_0x2e7b('0x7d')]['id']==_0x1a1847['params']['id']?moment():null,'previousPasswords':authService[_0x2e7b('0x97')](_0x1a1847[_0x2e7b('0x5a')][_0x2e7b('0x8d')],_0x4eff13[_0x2e7b('0x3f')])},null));})[_0x2e7b('0x1d')](respondWithResult(_0xf08a40,null))[_0x2e7b('0x53')](handleError(_0xf08a40,null));};exports[_0x2e7b('0x98')]=function(_0x350eae,_0x1d828d){var _0x4d27ff=_0x350eae[_0x2e7b('0x5a')]['channel'];return db['User'][_0x2e7b('0x36')]({'where':{'id':_0x350eae[_0x2e7b('0x55')]['id']},'attributes':['id',_0x2e7b('0x37'),'role',_0x2e7b('0x99'),_0x2e7b('0x9a'),_0x2e7b('0x9b'),'interface']})['then'](handleEntityNotFound(_0x1d828d,null))[_0x2e7b('0x1d')](function(_0x4650cc){if(_0x4650cc){if(!utils[_0x2e7b('0x9c')](_0x4d27ff)){throw new db[(_0x2e7b('0x8e'))]['ValidationError'](_0x2e7b('0x9d'));}return _0x4650cc[_0x2e7b('0x9e')+_[_0x2e7b('0x9f')](_0x4d27ff['toLowerCase']())+_0x2e7b('0xa0')](_0x350eae['body'][_0x2e7b('0x5e')],{'penalty':_0x350eae[_0x2e7b('0x5a')][_0x2e7b('0xa1')]||0x0})[_0x2e7b('0xa2')](function(_0x31fdf1){for(var _0xddb521=0x0;_0xddb521<_0x350eae[_0x2e7b('0x5a')][_0x2e7b('0x5e')][_0x2e7b('0x4a')];_0xddb521+=0x1){var _0x54fc83={'UserId':Number(_0x350eae[_0x2e7b('0x55')]['id'])};_0x54fc83[_['capitalize'](_0x4d27ff['toLowerCase']())+_0x2e7b('0xa3')]=Number(_0x350eae[_0x2e7b('0x5a')][_0x2e7b('0x5e')][_0xddb521]);socket[_0x2e7b('0x29')](_0x2e7b('0x7d')+_[_0x2e7b('0x9f')](_0x4d27ff[_0x2e7b('0xa4')]())+_0x2e7b('0xa5'),_0x54fc83);}return _0x31fdf1;})[_0x2e7b('0x1d')](function(){if(_0x4d27ff===_0x2e7b('0xa6')){return db['VoiceQueue']['findAll']({'where':{'id':_0x350eae[_0x2e7b('0x5a')][_0x2e7b('0x5e')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2e7b('0x1d')](function(_0x349d3d){var _0x37f144=_0x4650cc[_0x2e7b('0x2b')]({'plain':!![]});var _0x35d5cd=[];if(_0x4d27ff==='voice'&&_0x37f144[_0x2e7b('0x35')]===_0x2e7b('0x2e')&&_0x37f144[_0x2e7b('0x99')]){for(let _0x9d5836=0x0;_0x9d5836<_0x349d3d[_0x2e7b('0x4a')];_0x9d5836+=0x1){_0x35d5cd[_0x2e7b('0x4b')]({'membername':_0x37f144[_0x2e7b('0x37')],'UserId':_0x37f144['id'],'queue_name':_0x349d3d[_0x9d5836]['name'],'VoiceQueueId':_0x349d3d[_0x9d5836]['id'],'interface':_[_0x2e7b('0x66')](_0x37f144['interface'])?util[_0x2e7b('0xa7')](_0x2e7b('0xa8'),_0x37f144[_0x2e7b('0x37')]):_0x37f144['interface'],'paused':_0x37f144['voicePause']||![],'penalty':_0x350eae[_0x2e7b('0x5a')][_0x2e7b('0xa1')]||0x0});}return Promise[_0x2e7b('0x59')](_0x35d5cd[_0x2e7b('0x3c')](function(_0x1bdaab){return db[_0x2e7b('0xa9')]['upsert'](_0x1bdaab);}));}return _0x4650cc;});}})['then'](respondWithStatusCode(_0x1d828d,null))[_0x2e7b('0x53')](handleError(_0x1d828d,null));};exports[_0x2e7b('0xaa')]=function(_0xc04d89,_0x1213c9){var _0x38e0cf,_0x25258d;return db[_0x2e7b('0x3a')]['find']({'where':{'id':_0xc04d89[_0x2e7b('0x55')]['id']},'attributes':['id',_0x2e7b('0x37'),_0x2e7b('0x35')]})[_0x2e7b('0x1d')](handleEntityNotFound(_0x1213c9,null))[_0x2e7b('0x1d')](function(_0x7c5c8){if(_0x7c5c8){_0x38e0cf=_0x7c5c8;if(!_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0xab')]||!utils['isValidChannel'](_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0xab')])){throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0x9d'));}return _0x7c5c8[_0x2e7b('0xac')+_[_0x2e7b('0x9f')](_0xc04d89[_0x2e7b('0x45')]['channel'][_0x2e7b('0xa4')]())+_0x2e7b('0xa0')](_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0x5e')]);}})[_0x2e7b('0x1d')](function(_0x45e6ef){if(_['isArray'](_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0x5e')])){for(var _0x552a5e=0x0;_0x552a5e<_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0x5e')]['length'];_0x552a5e+=0x1){_0x25258d={'UserId':Number(_0xc04d89[_0x2e7b('0x55')]['id'])};_0x25258d[_['capitalize'](_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0xab')]['toLowerCase']())+_0x2e7b('0xa3')]=Number(_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0x5e')][_0x552a5e]);socket[_0x2e7b('0x29')](_0x2e7b('0x7d')+_['capitalize'](_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0xab')]['toLowerCase']())+'Queue:remove',_0x25258d);}}else{_0x25258d={'UserId':Number(_0xc04d89[_0x2e7b('0x55')]['id'])};_0x25258d[_[_0x2e7b('0x9f')](_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0xab')]['toLowerCase']())+_0x2e7b('0xa3')]=Number(_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0x5e')]);socket[_0x2e7b('0x29')](_0x2e7b('0x7d')+_[_0x2e7b('0x9f')](_0xc04d89['query'][_0x2e7b('0xab')]['toLowerCase']())+'Queue:remove',_0x25258d);}return _0x45e6ef;})['then'](function(){if(_0xc04d89['query'][_0x2e7b('0xab')]==='voice'){return db[_0x2e7b('0xa9')][_0x2e7b('0x2a')]({'where':{'UserId':_0xc04d89[_0x2e7b('0x55')]['id'],'VoiceQueueId':_0xc04d89[_0x2e7b('0x45')][_0x2e7b('0x5e')]},'individualHooks':!![]})[_0x2e7b('0x1d')](function(){return _0x38e0cf;});}return _0x38e0cf;})[_0x2e7b('0x1d')](respondWithStatusCode(_0x1213c9,null))[_0x2e7b('0x53')](handleError(_0x1213c9,null));};exports[_0x2e7b('0xad')]=function(_0x4d7fe7,_0x135c90){_0x4d7fe7[_0x2e7b('0x5a')][_0x2e7b('0xae')]=_0x4d7fe7[_0x2e7b('0xaf')][_0x2e7b('0xb0')];return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0x4d7fe7[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x135c90,null))[_0x2e7b('0x1d')](saveUpdates(_0x4d7fe7['body'],null))[_0x2e7b('0x1d')](respondWithResult(_0x135c90,null))['catch'](handleError(_0x135c90,null));};exports[_0x2e7b('0xb1')]=function(_0x4532d4,_0x1062e6){var _0x2466f5=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0x4532d4[_0x2e7b('0x55')]['id']},'attributes':['id',_0x2e7b('0xae')],'raw':!![]})['then'](handleEntityNotFound(_0x1062e6,null))[_0x2e7b('0x1d')](function(_0x24ced7){if(_0x24ced7){if(_[_0x2e7b('0x66')](_0x24ced7['userpic'])){return _0x1062e6[_0x2e7b('0xb2')](_0x2466f5);}else{if(!fs[_0x2e7b('0xb3')](path[_0x2e7b('0xb4')](config[_0x2e7b('0xb5')],'server/files/images/',_0x24ced7[_0x2e7b('0xae')]))){return _0x1062e6[_0x2e7b('0xb2')](_0x2466f5);}return _0x1062e6[_0x2e7b('0xb2')](path['join'](config[_0x2e7b('0xb5')],_0x2e7b('0xb6'),_0x24ced7[_0x2e7b('0xae')]));}}})[_0x2e7b('0x53')](handleError(_0x1062e6,null));};exports[_0x2e7b('0xb7')]=function(_0x150f2c,_0xe3698e){return db['User'][_0x2e7b('0x36')]({'where':{'id':_0x150f2c[_0x2e7b('0x55')]['id']},'attributes':['id']})[_0x2e7b('0x1d')](handleEntityNotFound(_0xe3698e,null))['then'](function(_0x50a5cf){var _0x2c9ee1=[];values=_0x50a5cf[_0x2e7b('0x4e')];_0x2c9ee1[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4c'),_0x50a5cf[_0x2e7b('0x4e')]));_0x2c9ee1[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4d'),_0x50a5cf[_0x2e7b('0x4e')]));_0x2c9ee1[_0x2e7b('0x4b')](get_open_tabs('openchannel',_0x50a5cf[_0x2e7b('0x4e')]));_0x2c9ee1[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x52'),_0x50a5cf[_0x2e7b('0x4e')]));_0x2c9ee1[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x4f'),_0x50a5cf[_0x2e7b('0x4e')]));_0x2c9ee1[_0x2e7b('0x4b')](get_open_tabs(_0x2e7b('0x50'),_0x50a5cf[_0x2e7b('0x4e')]));return Promise[_0x2e7b('0x59')](_0x2c9ee1);})[_0x2e7b('0x1d')](function(_0x5b9d35){if(_0x5b9d35){var _0x4b0bf2=_['map'](values['ChatOpenTabs'],function(_0xc85916){return{'channel':_0x2e7b('0xb8'),'id':_0xc85916['id'],'createdAt':_0xc85916[_0x2e7b('0xb9')]};});var _0x481693=_['map'](values[_0x2e7b('0xba')],function(_0x5bab8b){return{'channel':_0x2e7b('0xbb'),'id':_0x5bab8b['id'],'createdAt':_0x5bab8b[_0x2e7b('0xb9')]};});var _0x219ec8=_[_0x2e7b('0x3c')](values['OpenchannelOpenTabs'],function(_0x2b1a2a){return{'channel':_0x2e7b('0xbc'),'id':_0x2b1a2a['id'],'createdAt':_0x2b1a2a['createdAt']};});var _0x194197=_[_0x2e7b('0x3c')](values['MailOpenTabs'],function(_0x1beae8){return{'channel':_0x2e7b('0xbd'),'id':_0x1beae8['id'],'createdAt':_0x1beae8[_0x2e7b('0xb9')]};});var _0x2c18a2=_['map'](values['SmsOpenTabs'],function(_0x26b2cf){return{'channel':_0x2e7b('0xbe'),'id':_0x26b2cf['id'],'createdAt':_0x26b2cf[_0x2e7b('0xb9')]};});var _0x3bafb7=_[_0x2e7b('0x3c')](values[_0x2e7b('0xbf')],function(_0x9f9f58){return{'channel':'WHATSAPP','id':_0x9f9f58['id'],'createdAt':_0x9f9f58[_0x2e7b('0xb9')]};});var _0x30f90b=_['concat'](_0x4b0bf2,_0x481693,_0x219ec8,_0x194197,_0x2c18a2,_0x3bafb7);var _0x202461={'count':_0x30f90b['length'],'rows':_0x30f90b};return _0x202461;}else return null;})[_0x2e7b('0x1d')](respondWithResult(_0xe3698e,null))['catch'](handleError(_0xe3698e,null));};exports[_0x2e7b('0xc0')]=function(_0x4682ec,_0xcc6327){var _0x4b1ec8={};return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x4682ec[_0x2e7b('0x55')]['id']}})['then'](function(_0x3d0dc6){if(!_0x3d0dc6){throw new APINotFoundError(util[_0x2e7b('0xa7')](_0x2e7b('0xc1'),_0x4682ec[_0x2e7b('0x55')]['id']));}return contacts['describe']();})['then'](function(_0x524a81){_0x4682ec[_0x2e7b('0x45')][_0x2e7b('0x3a')]=_0x4682ec['params']['id'];_0x4b1ec8=qs[_0x2e7b('0x44')](_0x524a81,_0x4682ec);if(_0x4682ec['query'][_0x2e7b('0xc2')](_0x2e7b('0x56'))){_0x4b1ec8[_0x2e7b('0x57')]=[{'model':db[_0x2e7b('0xc3')],'as':'List','required':![]},{'model':db[_0x2e7b('0xc4')],'as':_0x2e7b('0xc5'),'attributes':['id',_0x2e7b('0x37'),_0x2e7b('0xc6')],'where':_0x4682ec[_0x2e7b('0x45')][_0x2e7b('0xc7')]?{'id':_0x4682ec['query'][_0x2e7b('0xc7')]}:undefined,'required':_0x4682ec['query'][_0x2e7b('0xc7')]?!![]:![]}];}return contacts[_0x2e7b('0x8a')](_0x4682ec[_0x2e7b('0x45')],_0x4682ec['user'],_0x4b1ec8,_0x524a81);})[_0x2e7b('0x1d')](respondWithFilteredResult(_0xcc6327,_0x4b1ec8))[_0x2e7b('0x53')](APIHandleError(_0xcc6327));};exports['getQueues']=function(_0x5c4381,_0x162006){var _0x2d8a77;var _0x43ea2d={};var _0x50dd69;return db[_0x2e7b('0x3a')]['findOne']({'where':{'id':_0x5c4381[_0x2e7b('0x55')]['id']},'attributes':['id',_0x2e7b('0x37'),_0x2e7b('0x35')]})[_0x2e7b('0x1d')](handleEntityNotFound(_0x162006,null))[_0x2e7b('0x1d')](function(_0x5a8c3b){if(!utils[_0x2e7b('0x9c')](_0x5c4381['query'][_0x2e7b('0xab')])){throw new db[(_0x2e7b('0x8e'))]['ValidationError'](_0x2e7b('0x9d'));}_0x2d8a77=_0x5a8c3b;var _0x24e586={};_0x24e586[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_[_0x2e7b('0x9f')](_0x5c4381[_0x2e7b('0x45')][_0x2e7b('0xab')])+_0x2e7b('0xca')][_0x2e7b('0x3b')]);_0x24e586[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x5c4381[_0x2e7b('0x45')]);_0x24e586[_0x2e7b('0xcb')]=_['intersection'](_0x24e586[_0x2e7b('0xc8')],_0x24e586[_0x2e7b('0x45')]);_0x43ea2d[_0x2e7b('0x47')]=_[_0x2e7b('0xcc')](_0x24e586[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x5c4381['query']['fields']));_0x43ea2d[_0x2e7b('0x47')]=_0x43ea2d['attributes'][_0x2e7b('0x4a')]?_0x43ea2d[_0x2e7b('0x47')]:_0x24e586[_0x2e7b('0xc8')];_0x43ea2d[_0x2e7b('0xce')]=qs[_0x2e7b('0xcf')](_0x5c4381[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x43ea2d[_0x2e7b('0xd0')]=qs['filters'](_[_0x2e7b('0xd1')](_0x5c4381[_0x2e7b('0x45')],_0x24e586['filters']));if(_0x5c4381['query'][_0x2e7b('0x31')]){_0x43ea2d['where']=_[_0x2e7b('0x58')](_0x43ea2d['where'],{'$or':_[_0x2e7b('0x3c')](_0x43ea2d['attributes'],function(_0x9ad289){var _0x2946a0={};_0x2946a0[_0x9ad289]={'$like':'%'+_0x5c4381[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x2946a0;})});}_0x43ea2d=_[_0x2e7b('0x58')]({},_0x43ea2d,_0x5c4381[_0x2e7b('0xd2')]);switch(_0x2d8a77[_0x2e7b('0x35')]){case _0x2e7b('0x2c'):return db[_[_0x2e7b('0x9f')](_0x5c4381['query']['channel'])+'Queue']['findAll'](_0x43ea2d);case _0x2e7b('0x7d'):case _0x2e7b('0x2e'):return _0x2d8a77[_0x2e7b('0x2b')+_[_0x2e7b('0x9f')](_0x5c4381['query']['channel'])+_0x2e7b('0xa0')](_0x43ea2d);default:throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0xd3'));}})[_0x2e7b('0x1d')](function(_0x2891d3){_0x50dd69=_0x2891d3[_0x2e7b('0x4a')];if(!_0x5c4381[_0x2e7b('0x45')][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x43ea2d[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x5c4381[_0x2e7b('0x45')]['limit']);_0x43ea2d['offset']=qs[_0x2e7b('0xd5')](_0x5c4381[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}switch(_0x2d8a77['role']){case _0x2e7b('0x2c'):return db[_['capitalize'](_0x5c4381[_0x2e7b('0x45')]['channel'])+_0x2e7b('0xca')]['findAll'](_0x43ea2d);case _0x2e7b('0x7d'):case _0x2e7b('0x2e'):return _0x2d8a77[_0x2e7b('0x2b')+_['capitalize'](_0x5c4381[_0x2e7b('0x45')]['channel'])+_0x2e7b('0xa0')](_0x43ea2d);}})[_0x2e7b('0x1d')](function(_0x597bb2){return{'count':_0x50dd69,'rows':_0x597bb2};})[_0x2e7b('0x1d')](respondWithResult(_0x162006,null))[_0x2e7b('0x53')](handleError(_0x162006,null));};exports['getVoiceQueuesRt']=function(_0x13a87f,_0x49d762){var _0xa04035={};var _0x47a47d={};var _0x1a4212;var _0x1560e2;return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x13a87f[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x49d762,null))[_0x2e7b('0x1d')](function(_0x2dd955){if(_0x2dd955){_0x1a4212=_0x2dd955;_0x47a47d[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db['UserVoiceQueueRt']['rawAttributes']);_0x47a47d[_0x2e7b('0x45')]=_['keys'](_0x13a87f[_0x2e7b('0x45')]);_0x47a47d['filters']=_['intersection'](_0x47a47d[_0x2e7b('0xc8')],_0x47a47d[_0x2e7b('0x45')]);_0xa04035['attributes']=_[_0x2e7b('0xcc')](_0x47a47d['model'],qs['fields'](_0x13a87f[_0x2e7b('0x45')]['fields']));_0xa04035[_0x2e7b('0x47')]=_0xa04035[_0x2e7b('0x47')]['length']?_0xa04035[_0x2e7b('0x47')]:_0x47a47d[_0x2e7b('0xc8')];_0xa04035[_0x2e7b('0xce')]=qs[_0x2e7b('0xcf')](_0x13a87f['query']['sort']);_0xa04035['where']=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x13a87f[_0x2e7b('0x45')],_0x47a47d[_0x2e7b('0xcb')]));if(_0x13a87f[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0xa04035[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0xa04035[_0x2e7b('0xd0')],{'$or':_['map'](_0xa04035[_0x2e7b('0x47')],function(_0x4428d5){var _0x308c28={};_0x308c28[_0x4428d5]={'$like':'%'+_0x13a87f[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x308c28;})});}_0xa04035=_['merge']({},_0xa04035,_0x13a87f[_0x2e7b('0xd2')]);return _0x1a4212['getVoiceQueuesRt'](_0xa04035);}})[_0x2e7b('0x1d')](function(_0x587172){if(_0x587172){_0x1560e2=_0x587172[_0x2e7b('0x4a')];if(!_0x13a87f[_0x2e7b('0x45')]['hasOwnProperty'](_0x2e7b('0xd4'))){_0xa04035[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x13a87f[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0xa04035[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x13a87f[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x1a4212[_0x2e7b('0xd6')](_0xa04035);}})[_0x2e7b('0x1d')](function(_0x7c67a6){if(_0x7c67a6){return _0x7c67a6?{'count':_0x1560e2,'rows':_0x7c67a6}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0x49d762,null))[_0x2e7b('0x53')](handleError(_0x49d762,null));};exports['getGroups']=function(_0x46ab0c,_0x1e5ddd){var _0x2d5a21={};var _0x2b2c25={};var _0x5ace02;var _0x2c5dce;return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x46ab0c[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x1e5ddd,null))[_0x2e7b('0x1d')](function(_0x3f4be9){if(_0x3f4be9){_0x5ace02=_0x3f4be9;_0x2b2c25[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0xd7')][_0x2e7b('0x3b')]);_0x2b2c25[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x46ab0c[_0x2e7b('0x45')]);_0x2b2c25[_0x2e7b('0xcb')]=_['intersection'](_0x2b2c25[_0x2e7b('0xc8')],_0x2b2c25[_0x2e7b('0x45')]);_0x2d5a21['attributes']=_[_0x2e7b('0xcc')](_0x2b2c25[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x46ab0c['query'][_0x2e7b('0xcd')]));_0x2d5a21['attributes']=_0x2d5a21[_0x2e7b('0x47')]['length']?_0x2d5a21[_0x2e7b('0x47')]:_0x2b2c25[_0x2e7b('0xc8')];_0x2d5a21[_0x2e7b('0xce')]=qs['sort'](_0x46ab0c[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x2d5a21[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x46ab0c[_0x2e7b('0x45')],_0x2b2c25[_0x2e7b('0xcb')]));if(_0x46ab0c[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0x2d5a21[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x2d5a21[_0x2e7b('0xd0')],{'$or':_['map'](_0x2d5a21[_0x2e7b('0x47')],function(_0xa7e098){var _0x3c7516={};_0x3c7516[_0xa7e098]={'$like':'%'+_0x46ab0c[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x3c7516;})});}_0x2d5a21=_[_0x2e7b('0x58')]({},_0x2d5a21,_0x46ab0c[_0x2e7b('0xd2')]);return _0x5ace02[_0x2e7b('0xd8')](_0x2d5a21);}})[_0x2e7b('0x1d')](function(_0x11d0bb){if(_0x11d0bb){_0x2c5dce=_0x11d0bb['length'];if(!_0x46ab0c[_0x2e7b('0x45')][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x2d5a21[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x46ab0c['query'][_0x2e7b('0x19')]);_0x2d5a21[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x46ab0c[_0x2e7b('0x45')]['offset']);}return _0x5ace02[_0x2e7b('0xd8')](_0x2d5a21);}})[_0x2e7b('0x1d')](function(_0x42b560){if(_0x42b560){return _0x42b560?{'count':_0x2c5dce,'rows':_0x42b560}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0x1e5ddd,null))[_0x2e7b('0x53')](handleError(_0x1e5ddd,null));};exports[_0x2e7b('0xd9')]=function(_0x5d95f6,_0x2b5771){var _0x53c9e6={'raw':!![],'where':{}};var _0x11172b={};var _0x29c915={'count':0x0,'rows':[]};return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x5d95f6[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x2b5771,null))['then'](function(_0x489dbb){if(_0x489dbb){_0x11172b[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0xda')][_0x2e7b('0x3b')]);_0x11172b['query']=_[_0x2e7b('0xc9')](_0x5d95f6[_0x2e7b('0x45')]);_0x11172b[_0x2e7b('0xcb')]=_['intersection'](_0x11172b['model'],_0x11172b[_0x2e7b('0x45')]);_0x53c9e6[_0x2e7b('0x47')]=_[_0x2e7b('0xcc')](_0x11172b[_0x2e7b('0xc8')],qs['fields'](_0x5d95f6[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x53c9e6[_0x2e7b('0x47')]=_0x53c9e6['attributes'][_0x2e7b('0x4a')]?_0x53c9e6['attributes']:_0x11172b['model'];if(!_0x5d95f6[_0x2e7b('0x45')][_0x2e7b('0xc2')]('nolimit')){_0x53c9e6[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x5d95f6['query'][_0x2e7b('0x19')]);_0x53c9e6['offset']=qs[_0x2e7b('0xd5')](_0x5d95f6['query'][_0x2e7b('0xd5')]);}_0x53c9e6['order']=qs['sort'](_0x5d95f6['query'][_0x2e7b('0xcf')]);_0x53c9e6[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x5d95f6[_0x2e7b('0x45')],_0x11172b[_0x2e7b('0xcb')]));_0x53c9e6[_0x2e7b('0xd0')][_0x2e7b('0xdb')]=_0x489dbb['id'];if(_0x5d95f6[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0x53c9e6['where']=_[_0x2e7b('0x58')](_0x53c9e6[_0x2e7b('0xd0')],{'$or':_[_0x2e7b('0x3c')](_0x53c9e6[_0x2e7b('0x47')],function(_0x11d277){var _0x576426={};_0x576426[_0x11d277]={'$like':'%'+_0x5d95f6[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x576426;})});}_0x53c9e6=_['merge']({},_0x53c9e6,_0x5d95f6[_0x2e7b('0xd2')]);return db[_0x2e7b('0xda')][_0x2e7b('0x1a')]({'where':_0x53c9e6['where']})['then'](function(_0x2b640c){_0x29c915[_0x2e7b('0x1a')]=_0x2b640c;if(_0x5d95f6[_0x2e7b('0x45')]['includeAll']){_0x53c9e6['include']=[{'all':!![]}];}return db[_0x2e7b('0xda')][_0x2e7b('0x8a')](_0x53c9e6);})[_0x2e7b('0x1d')](function(_0x4e7dbb){_0x29c915[_0x2e7b('0x49')]=_0x4e7dbb;return _0x29c915;});}})[_0x2e7b('0x1d')](respondWithFilteredResult(_0x2b5771,_0x53c9e6))['catch'](handleError(_0x2b5771,null));};exports[_0x2e7b('0xdc')]=function(_0x27509b,_0x441947){var _0x48ee8a={'raw':!![],'where':{}};var _0x40da84={};var _0x23b879={'count':0x0,'rows':[]};return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x27509b['params']['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x441947,null))['then'](function(_0x1b2b3f){if(_0x1b2b3f){_0x40da84[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0xdd')][_0x2e7b('0x3b')]);_0x40da84['query']=_[_0x2e7b('0xc9')](_0x27509b[_0x2e7b('0x45')]);_0x40da84[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x40da84[_0x2e7b('0xc8')],_0x40da84[_0x2e7b('0x45')]);_0x48ee8a[_0x2e7b('0x47')]=_['intersection'](_0x40da84[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x27509b[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x48ee8a[_0x2e7b('0x47')]=_0x48ee8a[_0x2e7b('0x47')][_0x2e7b('0x4a')]?_0x48ee8a[_0x2e7b('0x47')]:_0x40da84['model'];if(!_0x27509b[_0x2e7b('0x45')]['hasOwnProperty']('nolimit')){_0x48ee8a[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x27509b[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0x48ee8a['offset']=qs[_0x2e7b('0xd5')](_0x27509b[_0x2e7b('0x45')]['offset']);}_0x48ee8a[_0x2e7b('0xce')]=qs['sort'](_0x27509b[_0x2e7b('0x45')]['sort']);_0x48ee8a[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x27509b[_0x2e7b('0x45')],_0x40da84['filters']));_0x48ee8a['where'][_0x2e7b('0xdb')]=_0x1b2b3f['id'];if(_0x27509b[_0x2e7b('0x45')]['filter']){_0x48ee8a['where']=_[_0x2e7b('0x58')](_0x48ee8a['where'],{'$or':_[_0x2e7b('0x3c')](_0x48ee8a[_0x2e7b('0x47')],function(_0x4f6a48){var _0x50dd7c={};_0x50dd7c[_0x4f6a48]={'$like':'%'+_0x27509b[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x50dd7c;})});}_0x48ee8a=_[_0x2e7b('0x58')]({},_0x48ee8a,_0x27509b[_0x2e7b('0xd2')]);return db[_0x2e7b('0xdd')]['count']({'where':_0x48ee8a[_0x2e7b('0xd0')]})['then'](function(_0x5c4c60){_0x23b879[_0x2e7b('0x1a')]=_0x5c4c60;if(_0x27509b[_0x2e7b('0x45')][_0x2e7b('0x56')]){_0x48ee8a[_0x2e7b('0x57')]=[{'all':!![]}];}return db[_0x2e7b('0xdd')][_0x2e7b('0x8a')](_0x48ee8a);})[_0x2e7b('0x1d')](function(_0x3beea5){_0x23b879['rows']=_0x3beea5;return _0x23b879;});}})['then'](respondWithFilteredResult(_0x441947,_0x48ee8a))[_0x2e7b('0x53')](handleError(_0x441947,null));};exports[_0x2e7b('0xde')]=function(_0x474baa,_0x50d634){var _0x2b1045={};var _0x679fd5={};var _0x48854b;var _0x5294f5;return db[_0x2e7b('0x3a')]['findOne']({'where':{'id':_0x474baa['params']['id']}})['then'](handleEntityNotFound(_0x50d634,null))[_0x2e7b('0x1d')](function(_0x5efb8b){if(_0x5efb8b){_0x48854b=_0x5efb8b;_0x679fd5[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0xdf')]['rawAttributes']);_0x679fd5[_0x2e7b('0x45')]=_['keys'](_0x474baa[_0x2e7b('0x45')]);_0x679fd5[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x679fd5['model'],_0x679fd5[_0x2e7b('0x45')]);_0x2b1045[_0x2e7b('0x47')]=_['intersection'](_0x679fd5['model'],qs[_0x2e7b('0xcd')](_0x474baa[_0x2e7b('0x45')]['fields']));_0x2b1045['attributes']=_0x2b1045['attributes'][_0x2e7b('0x4a')]?_0x2b1045[_0x2e7b('0x47')]:_0x679fd5['model'];_0x2b1045[_0x2e7b('0xce')]=qs[_0x2e7b('0xcf')](_0x474baa[_0x2e7b('0x45')]['sort']);_0x2b1045[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x474baa[_0x2e7b('0x45')],_0x679fd5[_0x2e7b('0xcb')]));if(_0x474baa[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0x2b1045[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x2b1045[_0x2e7b('0xd0')],{'$or':_['map'](_0x2b1045['attributes'],function(_0x18e429){var _0x4ba7f0={};_0x4ba7f0[_0x18e429]={'$like':'%'+_0x474baa[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x4ba7f0;})});}_0x2b1045=_['merge']({},_0x2b1045,_0x474baa['options']);return _0x48854b[_0x2e7b('0xde')](_0x2b1045);}})[_0x2e7b('0x1d')](function(_0x35babd){if(_0x35babd){_0x5294f5=_0x35babd[_0x2e7b('0x4a')];if(!_0x474baa[_0x2e7b('0x45')][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x2b1045[_0x2e7b('0x19')]=qs['limit'](_0x474baa[_0x2e7b('0x45')]['limit']);_0x2b1045['offset']=qs[_0x2e7b('0xd5')](_0x474baa[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x48854b[_0x2e7b('0xde')](_0x2b1045);}})[_0x2e7b('0x1d')](function(_0x555b82){if(_0x555b82){return _0x555b82?{'count':_0x5294f5,'rows':_0x555b82}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0x50d634,null))[_0x2e7b('0x53')](handleError(_0x50d634,null));};exports[_0x2e7b('0xe0')]=function(_0x2c6039,_0x124eee){var _0x2d3954={};var _0x63c4d5={};var _0x109ca5;var _0x4322fb;return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x2c6039[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x124eee,null))[_0x2e7b('0x1d')](function(_0x4aef46){if(_0x4aef46){_0x109ca5=_0x4aef46;_0x63c4d5[_0x2e7b('0xc8')]=_['keys'](db[_0x2e7b('0xe1')][_0x2e7b('0x3b')]);_0x63c4d5[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x2c6039[_0x2e7b('0x45')]);_0x63c4d5[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x63c4d5[_0x2e7b('0xc8')],_0x63c4d5['query']);_0x2d3954[_0x2e7b('0x47')]=_['intersection'](_0x63c4d5['model'],qs[_0x2e7b('0xcd')](_0x2c6039[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x2d3954[_0x2e7b('0x47')]=_0x2d3954[_0x2e7b('0x47')][_0x2e7b('0x4a')]?_0x2d3954[_0x2e7b('0x47')]:_0x63c4d5['model'];_0x2d3954[_0x2e7b('0xce')]=qs[_0x2e7b('0xcf')](_0x2c6039[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x2d3954[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x2c6039[_0x2e7b('0x45')],_0x63c4d5[_0x2e7b('0xcb')]));if(_0x2c6039['query']['filter']){_0x2d3954[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x2d3954['where'],{'$or':_[_0x2e7b('0x3c')](_0x2d3954[_0x2e7b('0x47')],function(_0x100443){var _0x57b3fc={};_0x57b3fc[_0x100443]={'$like':'%'+_0x2c6039[_0x2e7b('0x45')]['filter']+'%'};return _0x57b3fc;})});}_0x2d3954=_[_0x2e7b('0x58')]({},_0x2d3954,_0x2c6039[_0x2e7b('0xd2')]);return _0x109ca5[_0x2e7b('0xe0')](_0x2d3954);}})[_0x2e7b('0x1d')](function(_0x894322){if(_0x894322){_0x4322fb=_0x894322[_0x2e7b('0x4a')];if(!_0x2c6039[_0x2e7b('0x45')]['hasOwnProperty'](_0x2e7b('0xd4'))){_0x2d3954[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x2c6039[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0x2d3954[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x2c6039[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x109ca5['getOpenchannelInteractions'](_0x2d3954);}})[_0x2e7b('0x1d')](function(_0x55b99e){if(_0x55b99e){return _0x55b99e?{'count':_0x4322fb,'rows':_0x55b99e}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0x124eee,null))[_0x2e7b('0x53')](handleError(_0x124eee,null));};exports['getMailInteractions']=function(_0x25e5d0,_0x3ef334){var _0x5de677={'raw':!![],'where':{}};var _0xf9a960={};var _0x46cce8={'count':0x0,'rows':[]};return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x25e5d0['params']['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x3ef334,null))['then'](function(_0x8b0103){if(_0x8b0103){_0xf9a960[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db['MailInteraction'][_0x2e7b('0x3b')]);_0xf9a960['query']=_[_0x2e7b('0xc9')](_0x25e5d0[_0x2e7b('0x45')]);_0xf9a960['filters']=_[_0x2e7b('0xcc')](_0xf9a960['model'],_0xf9a960['query']);_0x5de677[_0x2e7b('0x47')]=_['intersection'](_0xf9a960[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x25e5d0[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x5de677['attributes']=_0x5de677[_0x2e7b('0x47')][_0x2e7b('0x4a')]?_0x5de677[_0x2e7b('0x47')]:_0xf9a960[_0x2e7b('0xc8')];if(!_0x25e5d0['query'][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x5de677['limit']=qs[_0x2e7b('0x19')](_0x25e5d0[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0x5de677[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x25e5d0[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}_0x5de677[_0x2e7b('0xce')]=qs['sort'](_0x25e5d0[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x5de677[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x25e5d0[_0x2e7b('0x45')],_0xf9a960[_0x2e7b('0xcb')]));_0x5de677[_0x2e7b('0xd0')][_0x2e7b('0xdb')]=_0x8b0103['id'];if(_0x25e5d0[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0x5de677[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x5de677['where'],{'$or':_[_0x2e7b('0x3c')](_0x5de677[_0x2e7b('0x47')],function(_0x40748a){var _0x328e5a={};_0x328e5a[_0x40748a]={'$like':'%'+_0x25e5d0[_0x2e7b('0x45')]['filter']+'%'};return _0x328e5a;})});}_0x5de677=_[_0x2e7b('0x58')]({},_0x5de677,_0x25e5d0[_0x2e7b('0xd2')]);return db[_0x2e7b('0xe2')][_0x2e7b('0x1a')]({'where':_0x5de677[_0x2e7b('0xd0')]})[_0x2e7b('0x1d')](function(_0x5e8b7f){_0x46cce8[_0x2e7b('0x1a')]=_0x5e8b7f;if(_0x25e5d0[_0x2e7b('0x45')]['includeAll']){_0x5de677['include']=[{'all':!![]}];}return db[_0x2e7b('0xe2')][_0x2e7b('0x8a')](_0x5de677);})[_0x2e7b('0x1d')](function(_0x1e833a){_0x46cce8['rows']=_0x1e833a;return _0x46cce8;});}})['then'](respondWithFilteredResult(_0x3ef334,_0x5de677))[_0x2e7b('0x53')](handleError(_0x3ef334,null));};exports['getSmsInteractions']=function(_0x23c4a7,_0x4beed1){var _0x5a69fc={};var _0x3dee9d={};var _0x25a467;var _0x532068;return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x23c4a7['params']['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x4beed1,null))['then'](function(_0x41677c){if(_0x41677c){_0x25a467=_0x41677c;_0x3dee9d[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0xe3')]['rawAttributes']);_0x3dee9d[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x23c4a7[_0x2e7b('0x45')]);_0x3dee9d['filters']=_['intersection'](_0x3dee9d['model'],_0x3dee9d['query']);_0x5a69fc[_0x2e7b('0x47')]=_[_0x2e7b('0xcc')](_0x3dee9d[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x23c4a7[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x5a69fc['attributes']=_0x5a69fc['attributes'][_0x2e7b('0x4a')]?_0x5a69fc[_0x2e7b('0x47')]:_0x3dee9d[_0x2e7b('0xc8')];_0x5a69fc['order']=qs[_0x2e7b('0xcf')](_0x23c4a7[_0x2e7b('0x45')]['sort']);_0x5a69fc['where']=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x23c4a7[_0x2e7b('0x45')],_0x3dee9d[_0x2e7b('0xcb')]));if(_0x23c4a7['query']['filter']){_0x5a69fc[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x5a69fc[_0x2e7b('0xd0')],{'$or':_[_0x2e7b('0x3c')](_0x5a69fc[_0x2e7b('0x47')],function(_0x545f97){var _0x5f433d={};_0x5f433d[_0x545f97]={'$like':'%'+_0x23c4a7[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x5f433d;})});}_0x5a69fc=_['merge']({},_0x5a69fc,_0x23c4a7[_0x2e7b('0xd2')]);return _0x25a467[_0x2e7b('0xe4')](_0x5a69fc);}})[_0x2e7b('0x1d')](function(_0x31b70f){if(_0x31b70f){_0x532068=_0x31b70f['length'];if(!_0x23c4a7['query'][_0x2e7b('0xc2')]('nolimit')){_0x5a69fc['limit']=qs[_0x2e7b('0x19')](_0x23c4a7['query'][_0x2e7b('0x19')]);_0x5a69fc[_0x2e7b('0xd5')]=qs['offset'](_0x23c4a7[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x25a467['getSmsInteractions'](_0x5a69fc);}})['then'](function(_0xc5157c){if(_0xc5157c){return _0xc5157c?{'count':_0x532068,'rows':_0xc5157c}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0x4beed1,null))['catch'](handleError(_0x4beed1,null));};exports[_0x2e7b('0xe5')]=function(_0x47b51a,_0x2f449a){var _0x3c3b31={};var _0x2fb32a={};var _0x1aab95;var _0x3543b9;return db['User'][_0x2e7b('0x94')]({'where':{'id':_0x47b51a['params']['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x2f449a,null))[_0x2e7b('0x1d')](function(_0x40fb1a){if(_0x40fb1a){_0x1aab95=_0x40fb1a;_0x2fb32a[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0xe6')][_0x2e7b('0x3b')]);_0x2fb32a[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x47b51a[_0x2e7b('0x45')]);_0x2fb32a[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x2fb32a[_0x2e7b('0xc8')],_0x2fb32a[_0x2e7b('0x45')]);_0x3c3b31[_0x2e7b('0x47')]=_[_0x2e7b('0xcc')](_0x2fb32a[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x47b51a[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x3c3b31[_0x2e7b('0x47')]=_0x3c3b31[_0x2e7b('0x47')][_0x2e7b('0x4a')]?_0x3c3b31['attributes']:_0x2fb32a[_0x2e7b('0xc8')];_0x3c3b31['order']=qs[_0x2e7b('0xcf')](_0x47b51a[_0x2e7b('0x45')]['sort']);_0x3c3b31[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_['pick'](_0x47b51a[_0x2e7b('0x45')],_0x2fb32a['filters']));if(_0x47b51a[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0x3c3b31[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x3c3b31[_0x2e7b('0xd0')],{'$or':_['map'](_0x3c3b31['attributes'],function(_0x1e349e){var _0x49bdd0={};_0x49bdd0[_0x1e349e]={'$like':'%'+_0x47b51a[_0x2e7b('0x45')]['filter']+'%'};return _0x49bdd0;})});}_0x3c3b31=_[_0x2e7b('0x58')]({},_0x3c3b31,_0x47b51a[_0x2e7b('0xd2')]);return _0x1aab95[_0x2e7b('0xe5')](_0x3c3b31);}})[_0x2e7b('0x1d')](function(_0x434565){if(_0x434565){_0x3543b9=_0x434565['length'];if(!_0x47b51a[_0x2e7b('0x45')][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x3c3b31[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x47b51a[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0x3c3b31[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x47b51a[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x1aab95[_0x2e7b('0xe5')](_0x3c3b31);}})[_0x2e7b('0x1d')](function(_0x506326){if(_0x506326){return _0x506326?{'count':_0x3543b9,'rows':_0x506326}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0x2f449a,null))[_0x2e7b('0x53')](handleError(_0x2f449a,null));};exports['getWhatsappInteractions']=function(_0x435eb1,_0x368e9e){var _0x28fba8={};var _0x411c20={};var _0x2f1ac6;var _0x4b8c2b;return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x435eb1[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x368e9e,null))[_0x2e7b('0x1d')](function(_0x5b78a2){if(_0x5b78a2){_0x2f1ac6=_0x5b78a2;_0x411c20[_0x2e7b('0xc8')]=_['keys'](db[_0x2e7b('0xe7')][_0x2e7b('0x3b')]);_0x411c20[_0x2e7b('0x45')]=_['keys'](_0x435eb1['query']);_0x411c20[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x411c20[_0x2e7b('0xc8')],_0x411c20[_0x2e7b('0x45')]);_0x28fba8[_0x2e7b('0x47')]=_[_0x2e7b('0xcc')](_0x411c20[_0x2e7b('0xc8')],qs['fields'](_0x435eb1['query'][_0x2e7b('0xcd')]));_0x28fba8[_0x2e7b('0x47')]=_0x28fba8[_0x2e7b('0x47')]['length']?_0x28fba8['attributes']:_0x411c20[_0x2e7b('0xc8')];_0x28fba8[_0x2e7b('0xce')]=qs['sort'](_0x435eb1[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x28fba8[_0x2e7b('0xd0')]=qs['filters'](_[_0x2e7b('0xd1')](_0x435eb1[_0x2e7b('0x45')],_0x411c20[_0x2e7b('0xcb')]));if(_0x435eb1[_0x2e7b('0x45')][_0x2e7b('0x31')]){_0x28fba8['where']=_[_0x2e7b('0x58')](_0x28fba8[_0x2e7b('0xd0')],{'$or':_[_0x2e7b('0x3c')](_0x28fba8[_0x2e7b('0x47')],function(_0x51d2a3){var _0x38aa5f={};_0x38aa5f[_0x51d2a3]={'$like':'%'+_0x435eb1['query'][_0x2e7b('0x31')]+'%'};return _0x38aa5f;})});}_0x28fba8=_[_0x2e7b('0x58')]({},_0x28fba8,_0x435eb1[_0x2e7b('0xd2')]);return _0x2f1ac6[_0x2e7b('0xe8')](_0x28fba8);}})[_0x2e7b('0x1d')](function(_0x2e1580){if(_0x2e1580){_0x4b8c2b=_0x2e1580[_0x2e7b('0x4a')];if(!_0x435eb1['query'][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x28fba8['limit']=qs[_0x2e7b('0x19')](_0x435eb1[_0x2e7b('0x45')]['limit']);_0x28fba8[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x435eb1[_0x2e7b('0x45')]['offset']);}return _0x2f1ac6[_0x2e7b('0xe8')](_0x28fba8);}})[_0x2e7b('0x1d')](function(_0x43ffe9){if(_0x43ffe9){return _0x43ffe9?{'count':_0x4b8c2b,'rows':_0x43ffe9}:null;}})['then'](respondWithResult(_0x368e9e,null))['catch'](handleError(_0x368e9e,null));};exports[_0x2e7b('0xe9')]=function(_0x252ea5,_0x7c1fb6,_0x2990b8){var _0x45cfca;var _0x9b1562;var _0x5561d5;var _0x1ad1e6=!_[_0x2e7b('0x66')](_0x252ea5[_0x2e7b('0x55')]['id'])?_0x252ea5[_0x2e7b('0x55')]['id']:!_['isNil'](_0x252ea5['user']['id'])?_0x252ea5[_0x2e7b('0x7d')]['id']:null;return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0x1ad1e6,'role':{'$or':[_0x2e7b('0x2c'),_0x2e7b('0x7d'),'agent']}},'attributes':['id',_0x2e7b('0x37'),'phone',_0x2e7b('0xea'),'role','internal',_0x2e7b('0x9a')]})['then'](function(_0x5dd4aa){if(_0x5dd4aa){if(_0x5dd4aa['role']===_0x2e7b('0x2e')){_0x45cfca=_0x5dd4aa;if(_0x252ea5[_0x2e7b('0x5a')][_0x2e7b('0xeb')]){_0x5561d5=util['format']('LOCAL/%s@from-sip/n',_0x45cfca[_0x252ea5['body'][_0x2e7b('0xeb')]]);}else if(_0x252ea5[_0x2e7b('0x5a')][_0x2e7b('0xec')]){_0x5561d5=util[_0x2e7b('0xa7')]('SIP/%s',_0x252ea5[_0x2e7b('0x5a')][_0x2e7b('0xec')]);}else{_0x5561d5=util['format'](_0x2e7b('0xa8'),_0x45cfca[_0x2e7b('0x37')]);}socket['to'](util[_0x2e7b('0xa7')](_0x2e7b('0xed'),_0x45cfca[_0x2e7b('0x37')]))['emit']('user:forcelogout',{'user':{'id':_0x45cfca['id'],'name':_0x45cfca[_0x2e7b('0x37')]},'ip':_0x252ea5[_0x2e7b('0xee')][_0x2e7b('0xef')]||_0x252ea5['connection'][_0x2e7b('0xf0')]||_0x252ea5['socket'][_0x2e7b('0xf0')]||_0x252ea5[_0x2e7b('0xf1')][_0x2e7b('0xf2')][_0x2e7b('0xf0')]});return db[_0x2e7b('0xa9')][_0x2e7b('0x2a')]({'where':{'membername':_0x45cfca[_0x2e7b('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x2e7b('0x8e'))][(_0x2e7b('0x8f'))](_0x2e7b('0xf3'));}})['then'](function(){if(_0x45cfca){return _0x45cfca[_0x2e7b('0xf4')]({'raw':!![]});}})['then'](function(_0x26c82d){if(_0x45cfca){if(_0x26c82d){_0x9b1562=_0x26c82d;if(_0x9b1562[_0x2e7b('0x4a')]){var _0x6f1c19=_0x9b1562[_0x2e7b('0x3c')](function(_0x1fd5d2){var _0x385083={'membername':_0x45cfca[_0x2e7b('0x37')],'UserId':_0x45cfca['id'],'queue_name':_0x1fd5d2['name'],'VoiceQueueId':_0x1fd5d2['id'],'interface':_0x5561d5,'paused':_0x45cfca[_0x2e7b('0x9a')]||![],'penalty':_0x1fd5d2[_0x2e7b('0xf5')]||0x0};return db[_0x2e7b('0xa9')][_0x2e7b('0xf6')](_0x385083);});return Promise[_0x2e7b('0x59')](_0x6f1c19);}}}})[_0x2e7b('0x1d')](function(){if(_0x45cfca){return db['MemberReport'][_0x2e7b('0x8a')]({'where':{'membername':_0x45cfca[_0x2e7b('0x37')],'exitAt':null}});}})[_0x2e7b('0x1d')](function(_0x226bc2){if(_0x45cfca){var _0x354149=[];_0x226bc2[_0x2e7b('0xf7')](function(_0x3aebe9){_0x354149['push'](_0x3aebe9['update']({'exitAt':moment()[_0x2e7b('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x354149);}})['then'](function(){if(_0x45cfca){var _0x35644c=[];var _0x6ddef9=[];var _0xb0fc2f=utils[_0x2e7b('0xf8')]();var _0x292fbd={'membername':_0x45cfca[_0x2e7b('0x37')],'interface':_0x5561d5,'enterAt':moment()[_0x2e7b('0xa7')](_0x2e7b('0xf9')),'role':_0x45cfca[_0x2e7b('0x35')],'internal':_0x45cfca[_0x2e7b('0x5f')]};_0xb0fc2f[_0x2e7b('0xf7')](function(_0x3fb82a){_0x35644c[_0x2e7b('0x4b')](_[_0x2e7b('0x58')]({'channel':_0x3fb82a,'type':'LOGIN','data1':_0x252ea5[_0x2e7b('0x5a')][_0x2e7b('0xfa')],'data2':_0x5561d5},_0x292fbd));if(_0x45cfca['loginInPause']){_0x6ddef9[_0x2e7b('0x4b')](_[_0x2e7b('0x58')]({'channel':_0x3fb82a,'type':_0x2e7b('0xfb'),'data1':_0x2e7b('0xfc')},_0x292fbd));}});return db[_0x2e7b('0xfd')][_0x2e7b('0x87')](_0x35644c[_0x2e7b('0xfe')](_0x6ddef9),{'individualHooks':!![]});}})[_0x2e7b('0x1d')](function(){if(_0x45cfca){return _0x45cfca[_0x2e7b('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0x2e7b('0xf9')),'voicePause':_0x45cfca['loginInPause']||![],'mailPause':_0x45cfca[_0x2e7b('0x9a')]||![],'chatPause':_0x45cfca['loginInPause']||![],'faxPause':_0x45cfca[_0x2e7b('0x9a')]||![],'smsPause':_0x45cfca[_0x2e7b('0x9a')]||![],'openchannelPause':_0x45cfca['loginInPause']||![],'whatsappPause':_0x45cfca['loginInPause']||![],'pauseType':_0x45cfca[_0x2e7b('0x9a')]?_0x2e7b('0xfc'):null,'interface':_0x5561d5,'lastPauseAt':moment()[_0x2e7b('0xa7')](_0x2e7b('0xf9'))});}})['then'](function(_0x24363d){if(_0x252ea5[_0x2e7b('0xff')]){return _0x2990b8();}else{return Promise['resolve'](_0x24363d)['then'](respondWithResult(_0x7c1fb6,null));}})[_0x2e7b('0x53')](handleError(_0x7c1fb6,null));};exports[_0x2e7b('0x100')]=function(_0xaa55c6,_0x47209a){var _0x4dad06;return db[_0x2e7b('0x3a')][_0x2e7b('0x36')]({'where':{'id':_0xaa55c6[_0x2e7b('0x55')]['id'],'role':_0x2e7b('0x2e')},'attributes':['id',_0x2e7b('0x37'),_0x2e7b('0x35')]})[_0x2e7b('0x1d')](handleEntityNotFound(_0x47209a,null))['then'](function(_0x22ba45){if(_0x22ba45){_0x4dad06=_0x22ba45;return db[_0x2e7b('0xa9')]['destroy']({'where':{'membername':_0x4dad06[_0x2e7b('0x37')]},'individualHooks':!![]});}})[_0x2e7b('0x1d')](function(){return db['MemberReport'][_0x2e7b('0x8a')]({'where':{'membername':_0x4dad06[_0x2e7b('0x37')],'exitAt':null}});})['then'](function(_0x39a94a){var _0x26fad9=[];_0x39a94a['forEach'](function(_0x43614d){_0x26fad9[_0x2e7b('0x4b')](_0x43614d['update']({'exitAt':moment()[_0x2e7b('0xa7')](_0x2e7b('0xf9'))}));});return Promise['all'](_0x26fad9);})[_0x2e7b('0x1d')](function(){return _0x4dad06['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2e7b('0x1d')](respondWithResult(_0x47209a,null))[_0x2e7b('0x53')](handleError(_0x47209a,null));};exports[_0x2e7b('0x101')]=function(_0x4cece1,_0x316fcd){var _0x4a1835;return db[_0x2e7b('0xa9')][_0x2e7b('0x28')]({'paused':0x1},{'where':{'UserId':_0x4cece1[_0x2e7b('0x55')]['id']},'individualHooks':!![]})[_0x2e7b('0x1d')](function(){return db['User'][_0x2e7b('0x36')]({'where':{'id':_0x4cece1[_0x2e7b('0x55')]['id'],'role':'agent'},'attributes':['id',_0x2e7b('0x37'),_0x2e7b('0x35'),_0x2e7b('0x5f'),_0x2e7b('0xeb'),_0x2e7b('0x99')]});})[_0x2e7b('0x1d')](handleEntityNotFound(_0x316fcd,null))[_0x2e7b('0x1d')](function(_0xb27ffc){if(_0xb27ffc){_0x4a1835=_0xb27ffc;return respondWithRpcPromise(_0x2e7b('0x102'),'pause',{'id':_0x4a1835['id'],'name':_0x4a1835[_0x2e7b('0x37')],'pause':!![]});}})['then'](function(){if(_0x4a1835){return db['MemberReport'][_0x2e7b('0x8a')]({'where':{'membername':_0x4a1835[_0x2e7b('0x37')],'type':'PAUSE','exitAt':null}});}})[_0x2e7b('0x1d')](function(_0x2356ba){if(_0x2356ba['length']){var _0x5c1b05=moment()['format'](_0x2e7b('0xf9'));for(var _0x54a0e5=0x0,_0x515671=_0x2356ba[_0x2e7b('0x4a')];_0x54a0e5<_0x515671;_0x54a0e5++){_0x2356ba[_0x54a0e5][_0x2e7b('0x103')]({'exitAt':_0x5c1b05});}}})[_0x2e7b('0x1d')](function(){var _0xe3a960=[];var _0x58c13a=utils['getChannels']();_0x58c13a[_0x2e7b('0xf7')](function(_0x580e6c){_0xe3a960[_0x2e7b('0x4b')]({'channel':_0x580e6c,'membername':_0x4a1835[_0x2e7b('0x37')],'interface':_[_0x2e7b('0x66')](_0x4a1835[_0x2e7b('0xeb')])?util[_0x2e7b('0xa7')](_0x2e7b('0xa8'),_0x4a1835[_0x2e7b('0x37')]):_0x4a1835[_0x2e7b('0xeb')],'type':_0x2e7b('0xfb'),'enterAt':moment()[_0x2e7b('0xa7')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4cece1[_0x2e7b('0x5a')]['type']||'DEFAULT\x20PAUSE','role':_0x4a1835[_0x2e7b('0x35')],'internal':_0x4a1835[_0x2e7b('0x5f')]});});return db[_0x2e7b('0xfd')][_0x2e7b('0x87')](_0xe3a960,{'individualHooks':!![]});})[_0x2e7b('0x1d')](function(){return _0x4a1835['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4cece1[_0x2e7b('0x5a')][_0x2e7b('0x104')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x2e7b('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2e7b('0x1d')](respondWithResult(_0x316fcd,null))['catch'](handleError(_0x316fcd,null));};exports[_0x2e7b('0x105')]=function(_0x1ccd8a,_0x182114){if(_0x1ccd8a[_0x2e7b('0x5a')][_0x2e7b('0xab')]&&!utils[_0x2e7b('0x9c')](_0x1ccd8a[_0x2e7b('0x5a')][_0x2e7b('0xab')])){throw new APIBadRequestError(util['format']('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1ccd8a[_0x2e7b('0x5a')][_0x2e7b('0xab')]));}return db[_0x2e7b('0x3a')]['find']({'where':{'id':_0x1ccd8a['params']['id']},'attributes':['id',_0x2e7b('0x37'),'role','internal',_0x2e7b('0xeb'),_0x2e7b('0x99'),'voicePause','mailPause',_0x2e7b('0x106'),_0x2e7b('0x107'),_0x2e7b('0x108'),_0x2e7b('0x109'),_0x2e7b('0x10a'),_0x2e7b('0x10b'),'lastPauseAt']})[_0x2e7b('0x1d')](function(_0x13a9ac){if(!_0x13a9ac){throw new APINotFoundError(util['format'](_0x2e7b('0xc1'),_0x1ccd8a[_0x2e7b('0x55')]['id']));}return _0x13a9ac[_0x2e7b('0x105')](_0x1ccd8a[_0x2e7b('0x5a')][_0x2e7b('0xab')]);})[_0x2e7b('0x1d')](respondWithResult(_0x182114,null))[_0x2e7b('0x53')](APIHandleError(_0x182114));};exports['getTeams']=function(_0x596b16,_0xce9ac1){var _0x1fb54c={};var _0x5426d1={};var _0x3cf119;var _0x2c5588;return db['User']['findOne']({'where':{'id':_0x596b16[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0xce9ac1,null))[_0x2e7b('0x1d')](function(_0x46a5d8){if(_0x46a5d8){_0x3cf119=_0x46a5d8;_0x5426d1[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db[_0x2e7b('0x10c')][_0x2e7b('0x3b')]);_0x5426d1[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x596b16['query']);_0x5426d1['filters']=_[_0x2e7b('0xcc')](_0x5426d1[_0x2e7b('0xc8')],_0x5426d1[_0x2e7b('0x45')]);_0x1fb54c['attributes']=_[_0x2e7b('0xcc')](_0x5426d1[_0x2e7b('0xc8')],qs['fields'](_0x596b16[_0x2e7b('0x45')][_0x2e7b('0xcd')]));_0x1fb54c[_0x2e7b('0x47')]=_0x1fb54c[_0x2e7b('0x47')][_0x2e7b('0x4a')]?_0x1fb54c[_0x2e7b('0x47')]:_0x5426d1[_0x2e7b('0xc8')];_0x1fb54c[_0x2e7b('0xce')]=qs[_0x2e7b('0xcf')](_0x596b16[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x1fb54c['where']=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x596b16['query'],_0x5426d1[_0x2e7b('0xcb')]));if(_0x596b16['query'][_0x2e7b('0x31')]){_0x1fb54c[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x1fb54c['where'],{'$or':_[_0x2e7b('0x3c')](_0x1fb54c[_0x2e7b('0x47')],function(_0x2a47e0){var _0x52e3b4={};_0x52e3b4[_0x2a47e0]={'$like':'%'+_0x596b16[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x52e3b4;})});}_0x1fb54c=_[_0x2e7b('0x58')]({},_0x1fb54c,_0x596b16[_0x2e7b('0xd2')]);return _0x3cf119[_0x2e7b('0x10d')](_0x1fb54c);}})[_0x2e7b('0x1d')](function(_0x2f0e9b){if(_0x2f0e9b){_0x2c5588=_0x2f0e9b['length'];if(!_0x596b16[_0x2e7b('0x45')][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0x1fb54c[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x596b16[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0x1fb54c['offset']=qs[_0x2e7b('0xd5')](_0x596b16[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x3cf119['getTeams'](_0x1fb54c);}})[_0x2e7b('0x1d')](function(_0x2bcc46){if(_0x2bcc46){return _0x2bcc46?{'count':_0x2c5588,'rows':_0x2bcc46}:null;}})[_0x2e7b('0x1d')](respondWithResult(_0xce9ac1,null))[_0x2e7b('0x53')](handleError(_0xce9ac1,null));};exports[_0x2e7b('0x10e')]=function(_0x2a9723,_0x52e716){var _0x5e0182=_0x2a9723['params']['id'];var _0x15a78e=_0x2a9723[_0x2e7b('0x5a')]?_0x2a9723[_0x2e7b('0x5a')][_0x2e7b('0x5e')]:null;var _0x22a7f4=[];return Promise['resolve']()[_0x2e7b('0x1d')](function(){if(!_0x15a78e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x2e7b('0x1d')](function(){return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0x5e0182}});})[_0x2e7b('0x1d')](function(_0x16042b){if(!_0x16042b)throw new APINotFoundError(util[_0x2e7b('0xa7')](_0x2e7b('0xc1'),_0x2a9723['params']['id']));return db['sequelize'][_0x2e7b('0x10f')](function(_0x7df5ff){return _0x16042b[_0x2e7b('0x10e')](_0x15a78e,{'transaction':_0x7df5ff})[_0x2e7b('0x1d')](function(){return db[_0x2e7b('0x10c')][_0x2e7b('0x8a')]({'where':{'id':{'$in':_0x15a78e}}});})[_0x2e7b('0x1d')](function(_0x511126){var _0x3f1df2=_[_0x2e7b('0x3c')](_0x511126,function(_0x2bc2a2){return _0x2bc2a2[_0x2e7b('0x110')]();});return Promise[_0x2e7b('0x59')](_0x3f1df2);})[_0x2e7b('0x1d')](function(_0x3018a6){_0x22a7f4=_[_0x2e7b('0x111')](_0x3018a6);var _0x12f6b3=_[_0x2e7b('0x3c')](_0x22a7f4,function(_0x239f0c){return _0x239f0c[_0x2e7b('0x112')](_0x16042b['id'],{'transaction':_0x7df5ff});});return Promise[_0x2e7b('0x59')](_0x12f6b3);})[_0x2e7b('0x1d')](function(){if(!_0x16042b[_0x2e7b('0x99')])return;var _0x2eebca=_[_0x2e7b('0x31')](_0x22a7f4,function(_0x546047){return _0x546047[_0x2e7b('0x113')](_0x2e7b('0xab'))===_0x2e7b('0x114');});var _0x1de5d8=_[_0x2e7b('0x3c')](_0x2eebca,function(_0x38932d){return db[_0x2e7b('0xa9')][_0x2e7b('0xf6')]({'membername':_0x16042b[_0x2e7b('0x37')],'UserId':_0x16042b['id'],'queue_name':_0x38932d['name'],'VoiceQueueId':_0x38932d['id'],'interface':_[_0x2e7b('0x66')](_0x16042b[_0x2e7b('0xeb')])?util[_0x2e7b('0xa7')](_0x2e7b('0xa8'),_0x16042b[_0x2e7b('0x37')]):_0x16042b[_0x2e7b('0xeb')],'paused':_0x16042b[_0x2e7b('0x9b')]||![],'penalty':_0x16042b['penalty']},{'transaction':_0x7df5ff});});return Promise[_0x2e7b('0x59')](_0x1de5d8);})[_0x2e7b('0x1d')](function(){return db[_0x2e7b('0x115')]['findAll']({'where':{'teamId':{'$in':_0x15a78e}}});})[_0x2e7b('0x1d')](function(_0x5aa509){var _0x7b954d=_[_0x2e7b('0x3c')](_0x5aa509,function(_0x36c367){return db['UserVoicePrefix'][_0x2e7b('0x7b')]({'UserId':_0x16042b['id'],'VoicePrefixId':_0x36c367[_0x2e7b('0x116')]},{'transaction':_0x7df5ff});});return Promise[_0x2e7b('0x59')](_0x7b954d);});});})[_0x2e7b('0x1d')](function(){for(var _0x3406f7=0x0;_0x3406f7<_0x22a7f4['length'];_0x3406f7++){var _0x2b6ce7=_0x22a7f4[_0x3406f7][_0x2e7b('0x113')](_0x2e7b('0xab'));var _0x1d071a=_0x2b6ce7+_0x2e7b('0xa3');socket[_0x2e7b('0x29')](_0x2e7b('0x7d')+_0x2b6ce7+_0x2e7b('0xa5'),{'UserId':_0x5e0182,['queueField']:_0x22a7f4[_0x3406f7]['id']});}})[_0x2e7b('0x1d')](respondWithStatusCode(_0x52e716,null))[_0x2e7b('0x53')](APIHandleError(_0x52e716));};exports['removeTeams']=function(_0x261d53,_0x132557){var _0xa62fb2=_0x261d53[_0x2e7b('0x55')]['id'];var _0x1ccf46=null;if(_0x261d53[_0x2e7b('0x45')][_0x2e7b('0x5e')]){_0x1ccf46=_[_0x2e7b('0x117')](_0x261d53['query'][_0x2e7b('0x5e')])?_0x261d53[_0x2e7b('0x45')]['ids']:[_0x261d53[_0x2e7b('0x45')]['ids']];}var _0x8a54a2=[];return Promise[_0x2e7b('0x118')]()[_0x2e7b('0x1d')](function(){if(!_0x1ccf46)throw new APIBadRequestError(_0x2e7b('0x119'));})[_0x2e7b('0x1d')](function(){return db[_0x2e7b('0x3a')][_0x2e7b('0x94')]({'where':{'id':_0xa62fb2}});})[_0x2e7b('0x1d')](function(_0x29126d){if(!_0x29126d)throw new APINotFoundError(util[_0x2e7b('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x261d53[_0x2e7b('0x55')]['id']));return db[_0x2e7b('0x68')]['transaction'](function(_0xa97dfb){return _0x29126d[_0x2e7b('0x11a')](_0x1ccf46,{'transaction':_0xa97dfb})['then'](function(){return db[_0x2e7b('0x10c')][_0x2e7b('0x8a')]({'where':{'id':{'$in':_0x1ccf46}}});})[_0x2e7b('0x1d')](function(_0x4b38c6){var _0x5b6406=_[_0x2e7b('0x3c')](_0x4b38c6,function(_0x2fd9c2){return _0x2fd9c2[_0x2e7b('0x110')]();});return Promise[_0x2e7b('0x59')](_0x5b6406);})[_0x2e7b('0x1d')](function(_0x56f785){_0x8a54a2=_[_0x2e7b('0x111')](_0x56f785);var _0x273ae0=_['map'](_0x8a54a2,function(_0x7b947f){return _0x7b947f['removeAgent'](_0x29126d['id'],{'transaction':_0xa97dfb});});return Promise[_0x2e7b('0x59')](_0x273ae0);})[_0x2e7b('0x1d')](function(){if(!_0x29126d[_0x2e7b('0x99')])return;var _0xe49a82=_['filter'](_0x8a54a2,function(_0xf976eb){return _0xf976eb[_0x2e7b('0x113')](_0x2e7b('0xab'))==='Voice';});var _0x35e0a7=_[_0x2e7b('0x3c')](_0xe49a82,function(_0x22e2b3){return db['UserVoiceQueueRt'][_0x2e7b('0x2a')]({'where':{'VoiceQueueId':_0x22e2b3['id'],'UserId':_0x29126d['id']},'transaction':_0xa97dfb});});return Promise[_0x2e7b('0x59')](_0x35e0a7);})[_0x2e7b('0x1d')](function(){return db[_0x2e7b('0x115')][_0x2e7b('0x8a')]({'where':{'teamId':{'$in':_0x1ccf46}}});})[_0x2e7b('0x1d')](function(_0x32cc13){var _0x243ce9=_[_0x2e7b('0x3c')](_0x32cc13,function(_0x5e5d17){return db[_0x2e7b('0x11b')][_0x2e7b('0x2a')]({'where':{'UserId':_0x29126d['id'],'VoicePrefixId':_0x5e5d17[_0x2e7b('0x116')]}},{'transaction':_0xa97dfb});});return Promise[_0x2e7b('0x59')](_0x243ce9);});});})[_0x2e7b('0x1d')](function(){for(var _0xafdfe2=0x0;_0xafdfe2<_0x8a54a2['length'];_0xafdfe2++){var _0x5870be=_0x8a54a2[_0xafdfe2][_0x2e7b('0x113')](_0x2e7b('0xab'));var _0x2bb3cf=_0x5870be+_0x2e7b('0xa3');socket[_0x2e7b('0x29')](_0x2e7b('0x7d')+_0x5870be+_0x2e7b('0x11c'),{'UserId':_0xa62fb2,['queueField']:_0x8a54a2[_0xafdfe2]['id']});}})['then'](respondWithStatusCode(_0x132557,null))[_0x2e7b('0x53')](APIHandleError(_0x132557));};exports[_0x2e7b('0x11d')]=function(_0x854186,_0x33ad42){var _0xb1d455={};var _0x937f84={};var _0x1d1c92;var _0x5b9aff;return db['User']['findOne']({'where':{'id':_0x854186['params']['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x33ad42,null))['then'](function(_0x1f3081){if(_0x1f3081){_0x1d1c92=_0x1f3081;_0x937f84[_0x2e7b('0xc8')]=_[_0x2e7b('0xc9')](db['CmList'][_0x2e7b('0x3b')]);_0x937f84['query']=_[_0x2e7b('0xc9')](_0x854186[_0x2e7b('0x45')]);_0x937f84[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x937f84[_0x2e7b('0xc8')],_0x937f84['query']);_0xb1d455['attributes']=_[_0x2e7b('0xcc')](_0x937f84['model'],qs[_0x2e7b('0xcd')](_0x854186['query'][_0x2e7b('0xcd')]));_0xb1d455[_0x2e7b('0x47')]=_0xb1d455[_0x2e7b('0x47')][_0x2e7b('0x4a')]?_0xb1d455[_0x2e7b('0x47')]:_0x937f84['model'];_0xb1d455[_0x2e7b('0xce')]=qs[_0x2e7b('0xcf')](_0x854186['query'][_0x2e7b('0xcf')]);_0xb1d455[_0x2e7b('0xd0')]=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x854186[_0x2e7b('0x45')],_0x937f84['filters']));if(_0x854186[_0x2e7b('0x45')]['filter']){_0xb1d455['where']=_['merge'](_0xb1d455[_0x2e7b('0xd0')],{'$or':_[_0x2e7b('0x3c')](_0xb1d455['attributes'],function(_0x177de7){var _0x5e9e0e={};_0x5e9e0e[_0x177de7]={'$like':'%'+_0x854186['query'][_0x2e7b('0x31')]+'%'};return _0x5e9e0e;})});}_0xb1d455=_[_0x2e7b('0x58')]({},_0xb1d455,_0x854186[_0x2e7b('0xd2')]);return _0x1d1c92[_0x2e7b('0x11d')](_0xb1d455);}})[_0x2e7b('0x1d')](function(_0x5d7051){if(_0x5d7051){_0x5b9aff=_0x5d7051['length'];if(!_0x854186['query'][_0x2e7b('0xc2')](_0x2e7b('0xd4'))){_0xb1d455[_0x2e7b('0x19')]=qs[_0x2e7b('0x19')](_0x854186[_0x2e7b('0x45')][_0x2e7b('0x19')]);_0xb1d455[_0x2e7b('0xd5')]=qs[_0x2e7b('0xd5')](_0x854186[_0x2e7b('0x45')][_0x2e7b('0xd5')]);}return _0x1d1c92[_0x2e7b('0x11d')](_0xb1d455);}})['then'](function(_0x356fe7){if(_0x356fe7){return _0x356fe7?{'count':_0x5b9aff,'rows':_0x356fe7}:null;}})['then'](respondWithResult(_0x33ad42,null))[_0x2e7b('0x53')](handleError(_0x33ad42,null));};exports['getAgents']=function(_0x20c2df,_0x4723b9){var _0x19cc46={};var _0x41af36={};var _0x5c1160;return db['User'][_0x2e7b('0x94')]({'where':{'id':_0x20c2df[_0x2e7b('0x55')]['id']}})[_0x2e7b('0x1d')](handleEntityNotFound(_0x4723b9,null))[_0x2e7b('0x1d')](function(_0x55be18){if(_0x55be18){_0x5c1160=_0x55be18;_0x41af36['model']=_[_0x2e7b('0xc9')](db[_0x2e7b('0x3a')][_0x2e7b('0x3b')]);_0x41af36[_0x2e7b('0x45')]=_[_0x2e7b('0xc9')](_0x20c2df['query']);_0x41af36[_0x2e7b('0xcb')]=_[_0x2e7b('0xcc')](_0x41af36['model'],_0x41af36[_0x2e7b('0x45')]);_0x19cc46[_0x2e7b('0x47')]=_[_0x2e7b('0xcc')](_0x41af36[_0x2e7b('0xc8')],qs[_0x2e7b('0xcd')](_0x20c2df['query'][_0x2e7b('0xcd')]));_0x19cc46[_0x2e7b('0x47')]=_0x19cc46['attributes']['length']?_0x19cc46[_0x2e7b('0x47')]:_0x41af36[_0x2e7b('0xc8')];_0x19cc46['order']=qs[_0x2e7b('0xcf')](_0x20c2df[_0x2e7b('0x45')][_0x2e7b('0xcf')]);_0x19cc46['where']=qs[_0x2e7b('0xcb')](_[_0x2e7b('0xd1')](_0x20c2df['query'],_0x41af36[_0x2e7b('0xcb')]));if(_0x20c2df['query'][_0x2e7b('0x31')]){_0x19cc46[_0x2e7b('0xd0')]=_[_0x2e7b('0x58')](_0x19cc46[_0x2e7b('0xd0')],{'$or':_['map'](_0x19cc46[_0x2e7b('0x47')],function(_0x293b2b){var _0x1546d8={};_0x1546d8[_0x293b2b]={'$like':'%'+_0x20c2df[_0x2e7b('0x45')][_0x2e7b('0x31')]+'%'};return _0x1546d8;})});}_0x19cc46[_0x2e7b('0xc8')]=db[_0x2e7b('0x3a')];_0x19cc46['as']=_0x2e7b('0x84');_0x19cc46=_[_0x2e7b('0x58')]({},_0x19cc46,_0x20c2df['options']);return _0x5c1160[_0x2e7b('0xf4')]({'include':[_0x19cc46]});}})['then'](function(_0x3f752f){if(_0x3f752f){var _0x26259f={},_0x57c80d=[];for(var _0x1441ce=0x0;_0x1441ce<_0x3f752f[_0x2e7b('0x4a')];_0x1441ce+=0x1){for(var _0x176eea=0x0,_0x532a19;_0x176eea<_0x3f752f[_0x1441ce][_0x2e7b('0x84')][_0x2e7b('0x4a')];_0x176eea+=0x1){_0x532a19=_0x3f752f[_0x1441ce]['Agents'][_0x176eea][_0x2e7b('0x2b')]({'plain':!![]});_0x26259f[_0x532a19['id']]=_0x532a19;}}_0x26259f=_[_0x2e7b('0x11e')](_0x26259f);for(var _0x22a37a=qs['offset'](_0x20c2df[_0x2e7b('0x45')][_0x2e7b('0xd5')]);_0x22a37a<_0x26259f['length']&&_0x57c80d[_0x2e7b('0x4a')]=_0x1acc1e){_0x3fe668=_0x1acc1e;_0x1f10ac=0xc8;}else{_0x1f10ac=0xce;}_0x23a186['status'](_0x1f10ac);return _0x23a186['set'](_0x118c('0x20'),_0xfa8c+'-'+_0x3fe668+'/'+_0x1acc1e)[_0x118c('0x1c')](_0x2d077f);}return null;};}function respondWithRpcPromise(_0x1b351e,_0x1eddc1,_0x3b2875,_0x749d6c){return new Promise(function(_0x260c80,_0x142916){var _0x192095=_0x749d6c||amiClient;return _0x192095[_0x118c('0x21')](_0x1b351e,_0x3b2875)[_0x118c('0x22')](function(_0x200490){logger[_0x118c('0x23')](_0x118c('0x24'),_0x1eddc1,_0x118c('0x25'));logger[_0x118c('0x26')](_0x118c('0x27'),_0x1eddc1,_0x118c('0x25'),JSON['stringify'](_0x200490));if(_0x200490['error']){if(_0x200490['error'][_0x118c('0x28')]===0x1f4){logger['error'](_0x118c('0x24'),_0x1eddc1,_0x200490[_0x118c('0x29')][_0x118c('0x2a')]);return _0x142916(_0x200490[_0x118c('0x29')][_0x118c('0x2a')]);}logger[_0x118c('0x29')](_0x118c('0x24'),_0x1eddc1,_0x200490[_0x118c('0x29')][_0x118c('0x2a')]);return _0x260c80(_0x200490[_0x118c('0x29')][_0x118c('0x2a')]);}else{logger[_0x118c('0x23')](_0x118c('0x24'),_0x1eddc1,_0x118c('0x25'));_0x260c80(_0x200490[_0x118c('0x2b')][_0x118c('0x2a')]);}})[_0x118c('0x2c')](function(_0x1ac33e){logger[_0x118c('0x29')](_0x118c('0x24'),_0x1eddc1,_0x1ac33e);_0x142916(_0x1ac33e);});});}function saveUpdates(_0x267355){return function(_0x5d7df7){if(_0x5d7df7){return _0x5d7df7[_0x118c('0x2d')](_0x267355)['then'](function(_0x12d4b3){if(_0x12d4b3[_0x118c('0x2e')]===_0x118c('0x2f')){socket[_0x118c('0x30')](_0x118c('0x31')+_0x12d4b3['id'],_0x12d4b3);}return _0x12d4b3;});}return null;};}function removeEntity(_0x33bc07,_0x4854ca){return function(_0x6b46a){if(_0x6b46a){return _0x6b46a[_0x118c('0x32')]({'transaction':_0x4854ca})[_0x118c('0x22')](function(){var _0x513fc9=_0x6b46a[_0x118c('0x33')]({'plain':!![]});if(_0x513fc9['role']===_0x118c('0x34'))return;var _0x58536a=[{'name':_0x118c('0x35'),'value':_0x118c('0x36'),'ignore':!![]},{'name':_0x118c('0x37'),'value':_0x118c('0x2f'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x267e65=_(_0x58536a)[_0x118c('0x38')](_0x118c('0x39'))[_0x118c('0x3a')](_0x118c('0x3b'))[_0x118c('0x3b')]();if(_[_0x118c('0x3c')](_0x267e65,_0x513fc9[_0x118c('0x2e')])){return;}var _0x4fe4a2=_['find'](_0x58536a,[_0x118c('0x3b'),_0x513fc9[_0x118c('0x2e')]])[_0x118c('0x3d')];return db['UserProfileResource'][_0x118c('0x32')]({'where':{'type':_0x4fe4a2,'resourceId':_0x513fc9['id']},'transaction':_0x4854ca})['then'](function(){return _0x6b46a;});})['then'](function(){_0x33bc07[_0x118c('0x1a')](0xcc)[_0x118c('0x1b')]();});}};}function handleEntityNotFound(_0x11ffba){return function(_0x1b3ee5){if(!_0x1b3ee5){_0x11ffba[_0x118c('0x19')](0x194);}return _0x1b3ee5;};}function handleError(_0x248a0d,_0x5cbda3){_0x5cbda3=_0x5cbda3||0x1f4;return function(_0x569650){logger['error'](_0x569650[_0x118c('0x3e')]);if(_0x569650['name']){delete _0x569650[_0x118c('0x3d')];}_0x248a0d[_0x118c('0x1a')](_0x5cbda3)[_0x118c('0x3f')](_0x569650);};}function getUserAttributes(){return _(db[_0x118c('0x40')]['rawAttributes'])[_0x118c('0x3a')](function(_0x2a78a1){return{'name':_0x2a78a1[_0x118c('0x41')],'type':_0x2a78a1['type'][_0x118c('0x42')]};})['filter'](function(_0x566b64){return!['password',_0x118c('0x43'),_0x118c('0x44'),_0x118c('0x45'),_0x118c('0x46'),_0x118c('0x47')][_0x118c('0x3c')](_0x566b64['name']);})['value']();}exports[_0x118c('0x48')]=function(_0x561814,_0x3d9129){var _0xc53cf8={},_0x453659={'count':0x0,'rows':[]};var _0x17cf15=getUserAttributes();_0xc53cf8=qs[_0x118c('0x49')](_0x17cf15,_0x561814);var _0x5f354e={'where':_0xc53cf8[_0x118c('0x4a')]};return db[_0x118c('0x40')]['count'](_0x5f354e)['then'](function(_0x501fcf){_0x453659[_0x118c('0x1f')]=_0x501fcf;if(_0x561814[_0x118c('0x4b')][_0x118c('0x4c')]){_0xc53cf8[_0x118c('0x4d')]=[{'all':!![]}];}if(_0x561814[_0x118c('0x4b')][_0x118c('0x4e')]===_0x118c('0x4f')){_0xc53cf8[_0x118c('0x4d')]=[{'model':db['UserSetting'],'as':_0x118c('0x4e')}];}if(!_[_0x118c('0x3c')](_0xc53cf8['attributes'],'id')){_0xc53cf8[_0x118c('0x50')][_0x118c('0x51')]('id');}return db['User'][_0x118c('0x52')](_0xc53cf8);})['then'](function(_0x9d1713){_0x453659['rows']=_0x9d1713;if(_0x561814[_0x118c('0x4b')][_0x118c('0x53')]===_0x118c('0x4f')){var _0x2d79ae=[];for(var _0x2ee0c6=0x0;_0x2ee0c6<_0x453659[_0x118c('0x54')][_0x118c('0x55')];_0x2ee0c6++){_0x2d79ae[_0x118c('0x51')](get_open_tabs(_0x118c('0x56'),_0x453659['rows'][_0x2ee0c6][_0x118c('0x57')]));_0x2d79ae['push'](get_open_tabs(_0x118c('0x58'),_0x453659[_0x118c('0x54')][_0x2ee0c6][_0x118c('0x57')]));_0x2d79ae[_0x118c('0x51')](get_open_tabs(_0x118c('0x59'),_0x453659[_0x118c('0x54')][_0x2ee0c6][_0x118c('0x57')]));_0x2d79ae['push'](get_open_tabs('mail',_0x453659['rows'][_0x2ee0c6][_0x118c('0x57')]));_0x2d79ae[_0x118c('0x51')](get_open_tabs('openchannel',_0x453659[_0x118c('0x54')][_0x2ee0c6][_0x118c('0x57')]));_0x2d79ae['push'](get_open_tabs(_0x118c('0x5a'),_0x453659['rows'][_0x2ee0c6][_0x118c('0x57')]));}return Promise['all'](_0x2d79ae)[_0x118c('0x22')](function(){return _0x453659;});}else{return _0x453659;}})[_0x118c('0x22')](respondWithFilteredResult(_0x3d9129,_0xc53cf8))[_0x118c('0x2c')](handleError(_0x3d9129,null));};exports['show']=function(_0x227d93,_0x42c3fa){var _0x3f29b1=getUserAttributes();_0x227d93[_0x118c('0x4b')]['id']=_0x227d93['params']['id'];var _0x424cc0=qs[_0x118c('0x49')](_0x3f29b1,_0x227d93);if(_0x227d93[_0x118c('0x4b')][_0x118c('0x4c')]){_0x424cc0[_0x118c('0x4d')]=[{'all':!![]}];}if(_0x227d93[_0x118c('0x4b')]['userSetting']==='true'){_0x424cc0[_0x118c('0x4d')]=[{'model':db[_0x118c('0x5b')],'as':_0x118c('0x4e')}];}_0x424cc0=_['merge']({},_0x424cc0,_0x227d93['options']);if(!_[_0x118c('0x3c')](_0x424cc0[_0x118c('0x50')],'id')){_0x424cc0[_0x118c('0x50')][_0x118c('0x51')]('id');}return db['User']['find'](_0x424cc0)[_0x118c('0x22')](handleEntityNotFound(_0x42c3fa,null))[_0x118c('0x22')](function(_0x26d5ac){var _0x226184=[];values=_0x26d5ac;if(_0x227d93['query'][_0x118c('0x53')]==='true'){_0x226184[_0x118c('0x51')](get_open_tabs('chat',_0x26d5ac[_0x118c('0x57')]));_0x226184[_0x118c('0x51')](get_open_tabs(_0x118c('0x58'),_0x26d5ac[_0x118c('0x57')]));_0x226184[_0x118c('0x51')](get_open_tabs(_0x118c('0x5c'),_0x26d5ac[_0x118c('0x57')]));_0x226184[_0x118c('0x51')](get_open_tabs('whatsapp',_0x26d5ac[_0x118c('0x57')]));_0x226184[_0x118c('0x51')](get_open_tabs('fax',_0x26d5ac[_0x118c('0x57')]));_0x226184[_0x118c('0x51')](get_open_tabs('mail',_0x26d5ac['dataValues']));return Promise['all'](_0x226184);}else{return values;}})['then'](function(){return values;})[_0x118c('0x22')](respondWithResult(_0x42c3fa,null))['catch'](handleError(_0x42c3fa,null));};exports['update']=function(_0x4fde81,_0x138563){if(_0x4fde81[_0x118c('0x5d')]['id']){delete _0x4fde81['body']['id'];}delete _0x4fde81[_0x118c('0x5d')]['role'];return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x4fde81[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x138563,null))[_0x118c('0x22')](saveUpdates(_0x4fde81[_0x118c('0x5d')],null))['then'](respondWithResult(_0x138563,null))['catch'](handleError(_0x138563,null));};exports[_0x118c('0x60')]=function(_0x51230f,_0x42e734){return db[_0x118c('0x40')][_0x118c('0x60')]()[_0x118c('0x22')](respondWithResult(_0x42e734,null))['catch'](handleError(_0x42e734,null));};exports[_0x118c('0x61')]=function(_0x1c4bf5,_0x2e7db5){return db[_0x118c('0x40')]['find']({'where':{'id':_0x1c4bf5[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x2e7db5,null))[_0x118c('0x22')](function(_0x173958){if(_0x173958){return _0x173958[_0x118c('0x61')](_0x1c4bf5[_0x118c('0x5d')]['ids'],_[_0x118c('0x62')](_0x1c4bf5[_0x118c('0x5d')],[_0x118c('0x63'),'id'])||{});}})[_0x118c('0x22')](respondWithResult(_0x2e7db5,null))['catch'](handleError(_0x2e7db5,null));};function validateUser(_0x315604){return new Promise(function(_0x392602,_0x2797ca){if(_0x315604['internal'])return _0x392602(_0x315604);return db[_0x118c('0x64')][_0x118c('0x65')](0x1)[_0x118c('0x22')](function(_0x3bb494){if(_0x3bb494[_0x118c('0x66')])authService['validatePasswordPattern'](_0x315604['password']);db[_0x118c('0x40')]['max'](_0x118c('0x67'))[_0x118c('0x22')](function(_0x21e4af){if(_[_0x118c('0x68')](_0x21e4af)){_0x315604[_0x118c('0x67')]=_0x3bb494[_0x118c('0x69')]||0x1;return;}if(_[_0x118c('0x68')](_0x3bb494['min_internal'])||_0x3bb494[_0x118c('0x69')]===_0x21e4af){_0x315604[_0x118c('0x67')]=_0x21e4af+0x1;return;}if(_0x3bb494[_0x118c('0x69')]>_0x21e4af){_0x315604['internal']=_0x3bb494[_0x118c('0x69')];return;}return db[_0x118c('0x6a')][_0x118c('0x4b')](_0x118c('0x6b'),{'type':db[_0x118c('0x6a')]['QueryTypes']['SELECT']})['then'](function(_0x527abd){if(_0x527abd&&_0x527abd[_0x118c('0x55')]){for(var _0x35f084=0x0,_0xa39aaa=_0x527abd[_0x118c('0x55')];_0x35f084<_0xa39aaa&&_[_0x118c('0x68')](_0x315604[_0x118c('0x67')]);_0x35f084++){if(_0x3bb494['min_internal']<=_0x527abd[_0x35f084]['from']){_0x315604['internal']=_0x527abd[_0x35f084]['from'];}else if(_0x3bb494[_0x118c('0x69')]>_0x527abd[_0x35f084][_0x118c('0x6c')]&&_0x3bb494[_0x118c('0x69')]<=_0x527abd[_0x35f084]['to']){_0x315604[_0x118c('0x67')]=_0x3bb494['min_internal'];}}}if(_[_0x118c('0x68')](_0x315604['internal'])){_0x315604[_0x118c('0x67')]=_0x21e4af+0x1;}return _0x392602(_0x315604);});});})['catch'](function(_0x43f4d7){_0x2797ca(_0x43f4d7);});});}function updateUser(_0x42136d){return new Promise(function(_0x37111a,_0x1ed5cd){try{if(_0x42136d[_0x118c('0x6d')]){_0x42136d[_0x118c('0x6e')]=_0x42136d[_0x118c('0x67')];_0x42136d[_0x118c('0x6f')]={'mailbox':_0x42136d[_0x118c('0x67')],'password':_0x42136d[_0x118c('0x70')],'fullname':_0x42136d['fullname'],'email':_0x42136d['email']};}if(_0x42136d[_0x118c('0x2e')]===_0x118c('0x2f')){if(!_0x42136d[_0x118c('0x71')])_0x42136d[_0x118c('0x71')]=['101',_0x118c('0x72'),_0x118c('0x73'),_0x118c('0x74'),_0x118c('0x75'),_0x118c('0x76'),'105',_0x118c('0x77'),_0x118c('0x78'),_0x118c('0x79'),_0x118c('0x7a'),_0x118c('0x7b'),'111',_0x118c('0x7c'),'115'];}_0x37111a(_0x42136d);}catch(_0x4f2e35){_0x1ed5cd(_0x4f2e35);}});}exports[_0x118c('0x7d')]=function(_0x591216,_0x2f580e){if(_0x591216[_0x118c('0x36')]['role']===_0x118c('0x2f'))throw new Error(_0x118c('0x7e'));if(_0x591216[_0x118c('0x5d')][_0x118c('0x2e')]==='user'&&_0x591216['user'][_0x118c('0x2e')]!==_0x118c('0x34')){throw new Error(_0x118c('0x7f'));}if(_0x591216[_0x118c('0x5d')][_0x118c('0x2e')]===_0x118c('0x34')&&_0x591216[_0x118c('0x36')][_0x118c('0x2e')]!==_0x118c('0x34')){throw new Error(_0x118c('0x80'));}return licenseUtil[_0x118c('0x81')]([_0x591216['body']])['then'](function(){return validateUser(_0x591216[_0x118c('0x5d')]);})[_0x118c('0x22')](function(_0x5d9891){return updateUser(_0x5d9891)['then'](function(_0x5a42d2){if(_0x5a42d2['role']===_0x118c('0x34')){_0x5a42d2[_0x118c('0x82')]=_0x591216[_0x118c('0x36')][_0x118c('0x82')];delete _0x5a42d2[_0x118c('0x83')];}return _0x5a42d2;});})[_0x118c('0x22')](function(_0x2a61c0){return db[_0x118c('0x40')]['create'](_0x2a61c0,{'include':[{'model':db['VoiceMail'],'as':_0x118c('0x6f')}]});})[_0x118c('0x22')](function(_0xb5be79){if(_0x591216[_0x118c('0x5d')][_0x118c('0x2e')]==='user')return _0xb5be79;if(_0x591216[_0x118c('0x36')][_0x118c('0x2e')]!==_0x118c('0x36'))return _0xb5be79;return db[_0x118c('0x84')]['find']({'where':{'name':_0xb5be79[_0x118c('0x2e')]===_0x118c('0x2f')?'Agents':_0x118c('0x85'),'userProfileId':_0x591216[_0x118c('0x36')][_0x118c('0x83')]},'raw':!![]})[_0x118c('0x22')](function(_0x4b24c7){if(!_0x4b24c7||_0x4b24c7[_0x118c('0x86')]!=0x0)return _0xb5be79;return db['UserProfileResource']['create']({'name':_0xb5be79[_0x118c('0x3d')],'resourceId':_0xb5be79['id'],'type':_0x4b24c7[_0x118c('0x3d')],'sectionId':_0x4b24c7['id']},{})[_0x118c('0x22')](function(){return _0xb5be79;});})[_0x118c('0x2c')](function(_0x243c14){logger[_0x118c('0x29')](_0x118c('0x87'),_0x243c14);throw _0x243c14;});})[_0x118c('0x22')](respondWithResult(_0x2f580e,0xc9))[_0x118c('0x2c')](handleError(_0x2f580e,null));};exports['bulkCreate']=function(_0x4b4e1e,_0x494c41){var _0xdca1a9=_0x4b4e1e[_0x118c('0x5d')];var _0x19185c=[];if(_0x4b4e1e[_0x118c('0x36')][_0x118c('0x2e')]==='agent')throw new Error(_0x118c('0x7e'));if(_[_0x118c('0x88')](_0xdca1a9,[_0x118c('0x2e'),_0x118c('0x36')])&&_0x4b4e1e[_0x118c('0x36')][_0x118c('0x2e')]!==_0x118c('0x34')){throw new Error(_0x118c('0x7f'));}if(_[_0x118c('0x88')](_0xdca1a9,[_0x118c('0x2e'),_0x118c('0x34')])&&_0x4b4e1e['user'][_0x118c('0x2e')]!=='admin'){throw new Error(_0x118c('0x89'));}return licenseUtil[_0x118c('0x81')](_0xdca1a9)[_0x118c('0x22')](function(){return validateUser(_0xdca1a9[0x0]);})['then'](function(){for(var _0x42f434=0x1;_0x42f434<_0xdca1a9['length'];_0x42f434++){var _0x431772=_0xdca1a9[_0x42f434-0x1]['internal'];if(!_0xdca1a9[_0x42f434][_0x118c('0x67')])_0xdca1a9[_0x42f434][_0x118c('0x67')]=_0x431772+0x1;_0x19185c['push'](validateUser(_0xdca1a9[_0x42f434]));}return Promise['all'](_0x19185c);})[_0x118c('0x22')](function(){_0x19185c=[];for(var _0x3fceb7=0x0;_0x3fceb7<_0xdca1a9[_0x118c('0x55')];_0x3fceb7++){_0x19185c[_0x118c('0x51')](updateUser(_0xdca1a9[_0x3fceb7]));}return Promise[_0x118c('0x8a')](_0x19185c);})[_0x118c('0x22')](function(){_0x19185c=_0xdca1a9[_0x118c('0x3a')](function(_0x363c01){return db['User'][_0x118c('0x7d')](_0x363c01,{'include':[{'model':db[_0x118c('0x6f')],'as':'VoiceMail'}]})['then'](function(_0x555034){_0x363c01['id']=_0x555034['id'];return _0x363c01;});});return Promise['all'](_0x19185c);})[_0x118c('0x22')](function(_0x2bcec4){if(_0x4b4e1e[_0x118c('0x5d')]['role']===_0x118c('0x36'))return _0x2bcec4;if(_0x4b4e1e[_0x118c('0x36')]['role']!=='user')return _0x2bcec4;var _0x554fdc=_[_0x118c('0x88')](_0x2bcec4,function(_0x3bfffd){return _0x3bfffd[_0x118c('0x2e')]===_0x118c('0x2f')||_0x3bfffd['role']===_0x118c('0x8b');});if(!_0x554fdc)return _0x2bcec4;return db['UserProfileSection'][_0x118c('0x52')]({'where':{'name':{'$or':[_0x118c('0x37'),_0x118c('0x85')]},'userProfileId':_0x4b4e1e[_0x118c('0x36')][_0x118c('0x83')]},'raw':!![]})[_0x118c('0x22')](function(_0x20e66e){if(_[_0x118c('0x8c')](_0x20e66e)||!_['some'](_0x20e66e,[_0x118c('0x86'),0x0]))return _0x2bcec4;_0x19185c=[];var _0x593f14=_(_0x20e66e)['map'](function(_0x110500){if(_0x110500[_0x118c('0x86')]===0x1)return;return _0x110500[_0x118c('0x3d')]==='Agents'?'agent':_0x118c('0x8b');})['compact']()[_0x118c('0x3b')]();for(var _0x5da634=0x0;_0x5da634<_0x2bcec4[_0x118c('0x55')];_0x5da634++){if(!_[_0x118c('0x3c')](_0x593f14,_0x2bcec4[_0x5da634][_0x118c('0x2e')]))return;var _0x193ee4=_0x2bcec4[_0x5da634][_0x118c('0x2e')]===_0x118c('0x2f')?_0x118c('0x37'):_0x118c('0x85');_0x19185c[_0x118c('0x51')](db['UserProfileResource'][_0x118c('0x7d')]({'name':_0x2bcec4[_0x5da634][_0x118c('0x3d')],'resourceId':_0x2bcec4[_0x5da634]['id'],'type':_0x193ee4,'sectionId':_['find'](_0x20e66e,[_0x118c('0x3d'),_0x193ee4])['id']},{}));}return Promise[_0x118c('0x8a')](_0x19185c);});})[_0x118c('0x22')](respondWithResult(_0x494c41,0xc9))['catch'](handleError(_0x494c41,null));};exports[_0x118c('0x8d')]=function(_0x219335,_0x2a47ae){if(_0x219335[_0x118c('0x5d')]['id']){delete _0x219335[_0x118c('0x5d')]['id'];}return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x219335['params']['id']}})[_0x118c('0x22')](function(_0x387efd){if(!_0x387efd)return null;if(_0x387efd['id']===_0x219335[_0x118c('0x36')]['id']){if(!_0x219335[_0x118c('0x5d')][_0x118c('0x8e')]||!_0x219335[_0x118c('0x5d')][_0x118c('0x8f')]){throw new db['Sequelize'][(_0x118c('0x90'))](_0x118c('0x91'));}if(!_0x387efd[_0x118c('0x92')](_0x219335[_0x118c('0x5d')]['oldPassword'])){throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0x94'));}if(_0x219335[_0x118c('0x5d')][_0x118c('0x8e')]===_0x219335[_0x118c('0x5d')][_0x118c('0x8f')]){throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0x95'));}}else if(_0x219335[_0x118c('0x36')][_0x118c('0x2e')]===_0x118c('0x34')){if(!_0x219335[_0x118c('0x5d')][_0x118c('0x8f')]){throw new db['Sequelize'][(_0x118c('0x90'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x219335[_0x118c('0x36')]['role']===_0x118c('0x36')){if(!_0x219335[_0x118c('0x5d')][_0x118c('0x8f')]){throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0x96'));}if(_0x387efd[_0x118c('0x2e')]!==_0x118c('0x2f')){throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0x7e'));}}else{throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))]('Unauthorized');}return _0x387efd;})[_0x118c('0x22')](handleEntityNotFound(_0x2a47ae,null))[_0x118c('0x22')](function(_0x30282c){return db[_0x118c('0x64')][_0x118c('0x97')]({'attributes':['id',_0x118c('0x66'),_0x118c('0x98'),_0x118c('0x99')]})['then'](function(_0x5ddab2){if(_0x5ddab2[_0x118c('0x66')])authService[_0x118c('0x9a')](_0x219335['body'][_0x118c('0x8f')]);if(!_0x5ddab2['enforcePasswordHistory']||!_0x30282c[_0x118c('0x44')])return _0x30282c;authService[_0x118c('0x9b')](_0x219335[_0x118c('0x5d')][_0x118c('0x8f')],_0x30282c[_0x118c('0x44')],_0x5ddab2['passwordHistoryLimit']);return _0x30282c;})[_0x118c('0x22')](saveUpdates({'password':_0x219335[_0x118c('0x5d')]['newPassword'],'passwordResetAt':_0x219335[_0x118c('0x36')]['id']==_0x219335[_0x118c('0x5f')]['id']?moment():null,'previousPasswords':authService[_0x118c('0x9c')](_0x219335[_0x118c('0x5d')][_0x118c('0x8f')],_0x30282c[_0x118c('0x44')])},null));})[_0x118c('0x22')](respondWithResult(_0x2a47ae,null))['catch'](handleError(_0x2a47ae,null));};exports[_0x118c('0x9d')]=function(_0x1b866f,_0x26e966){var _0x2cd8f9=_0x1b866f[_0x118c('0x5d')]['channel'];return db[_0x118c('0x40')]['find']({'where':{'id':_0x1b866f[_0x118c('0x5f')]['id']},'attributes':['id','name',_0x118c('0x2e'),'online',_0x118c('0x9e'),_0x118c('0x9f'),'interface']})['then'](handleEntityNotFound(_0x26e966,null))['then'](function(_0x5ece1a){if(_0x5ece1a){if(!utils[_0x118c('0xa0')](_0x2cd8f9)){throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0xa1'));}return _0x5ece1a[_0x118c('0xa2')+_[_0x118c('0xa3')](_0x2cd8f9[_0x118c('0xa4')]())+_0x118c('0xa5')](_0x1b866f[_0x118c('0x5d')]['ids'],{'penalty':_0x1b866f['body']['penalty']||0x0})['spread'](function(_0x514f07){for(var _0x5692fd=0x0;_0x5692fd<_0x1b866f['body'][_0x118c('0x63')][_0x118c('0x55')];_0x5692fd+=0x1){var _0x654965={'UserId':Number(_0x1b866f[_0x118c('0x5f')]['id'])};_0x654965[_[_0x118c('0xa3')](_0x2cd8f9[_0x118c('0xa4')]())+_0x118c('0xa6')]=Number(_0x1b866f[_0x118c('0x5d')][_0x118c('0x63')][_0x5692fd]);socket[_0x118c('0x30')](_0x118c('0x36')+_[_0x118c('0xa3')](_0x2cd8f9['toLowerCase']())+_0x118c('0xa7'),_0x654965);}return _0x514f07;})[_0x118c('0x22')](function(){if(_0x2cd8f9===_0x118c('0xa8')){return db['VoiceQueue'][_0x118c('0x52')]({'where':{'id':_0x1b866f['body']['ids']||[]},'raw':!![],'attributes':['id',_0x118c('0x3d')]});}})[_0x118c('0x22')](function(_0x49100a){var _0x1ab5d7=_0x5ece1a[_0x118c('0x33')]({'plain':!![]});var _0x490e7f=[];if(_0x2cd8f9===_0x118c('0xa8')&&_0x1ab5d7[_0x118c('0x2e')]==='agent'&&_0x1ab5d7['online']){for(let _0x283b25=0x0;_0x283b25<_0x49100a[_0x118c('0x55')];_0x283b25+=0x1){_0x490e7f[_0x118c('0x51')]({'membername':_0x1ab5d7[_0x118c('0x3d')],'UserId':_0x1ab5d7['id'],'queue_name':_0x49100a[_0x283b25][_0x118c('0x3d')],'VoiceQueueId':_0x49100a[_0x283b25]['id'],'interface':_[_0x118c('0x68')](_0x1ab5d7[_0x118c('0xa9')])?util[_0x118c('0xaa')](_0x118c('0xab'),_0x1ab5d7['name']):_0x1ab5d7[_0x118c('0xa9')],'paused':_0x1ab5d7[_0x118c('0x9f')]||![],'penalty':_0x1b866f[_0x118c('0x5d')][_0x118c('0xac')]||0x0});}return Promise[_0x118c('0x8a')](_0x490e7f[_0x118c('0x3a')](function(_0x7283e1){return db[_0x118c('0xad')][_0x118c('0xae')](_0x7283e1);}));}return _0x5ece1a;});}})['then'](respondWithStatusCode(_0x26e966,null))[_0x118c('0x2c')](handleError(_0x26e966,null));};exports['removeQueues']=function(_0x6f9b36,_0x5648da){var _0x5c3f48,_0x5d114a;return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x6f9b36[_0x118c('0x5f')]['id']},'attributes':['id',_0x118c('0x3d'),_0x118c('0x2e')]})[_0x118c('0x22')](handleEntityNotFound(_0x5648da,null))[_0x118c('0x22')](function(_0x1454b6){if(_0x1454b6){_0x5c3f48=_0x1454b6;if(!_0x6f9b36[_0x118c('0x4b')][_0x118c('0xaf')]||!utils['isValidChannel'](_0x6f9b36['query'][_0x118c('0xaf')])){throw new db['Sequelize'][(_0x118c('0x90'))]('Unknown\x20channel');}return _0x1454b6[_0x118c('0xb0')+_['capitalize'](_0x6f9b36['query']['channel']['toLowerCase']())+_0x118c('0xa5')](_0x6f9b36[_0x118c('0x4b')]['ids']);}})[_0x118c('0x22')](function(_0x31b469){if(_[_0x118c('0xb1')](_0x6f9b36[_0x118c('0x4b')][_0x118c('0x63')])){for(var _0x525ba3=0x0;_0x525ba3<_0x6f9b36['query'][_0x118c('0x63')][_0x118c('0x55')];_0x525ba3+=0x1){_0x5d114a={'UserId':Number(_0x6f9b36['params']['id'])};_0x5d114a[_['capitalize'](_0x6f9b36['query']['channel'][_0x118c('0xa4')]())+_0x118c('0xa6')]=Number(_0x6f9b36[_0x118c('0x4b')][_0x118c('0x63')][_0x525ba3]);socket[_0x118c('0x30')]('user'+_[_0x118c('0xa3')](_0x6f9b36[_0x118c('0x4b')][_0x118c('0xaf')][_0x118c('0xa4')]())+_0x118c('0xb2'),_0x5d114a);}}else{_0x5d114a={'UserId':Number(_0x6f9b36['params']['id'])};_0x5d114a[_[_0x118c('0xa3')](_0x6f9b36[_0x118c('0x4b')][_0x118c('0xaf')]['toLowerCase']())+_0x118c('0xa6')]=Number(_0x6f9b36[_0x118c('0x4b')]['ids']);socket[_0x118c('0x30')]('user'+_['capitalize'](_0x6f9b36[_0x118c('0x4b')][_0x118c('0xaf')][_0x118c('0xa4')]())+_0x118c('0xb2'),_0x5d114a);}return _0x31b469;})[_0x118c('0x22')](function(){if(_0x6f9b36[_0x118c('0x4b')][_0x118c('0xaf')]==='voice'){return db[_0x118c('0xad')][_0x118c('0x32')]({'where':{'UserId':_0x6f9b36[_0x118c('0x5f')]['id'],'VoiceQueueId':_0x6f9b36[_0x118c('0x4b')][_0x118c('0x63')]},'individualHooks':!![]})[_0x118c('0x22')](function(){return _0x5c3f48;});}return _0x5c3f48;})[_0x118c('0x22')](respondWithStatusCode(_0x5648da,null))[_0x118c('0x2c')](handleError(_0x5648da,null));};exports[_0x118c('0xb3')]=function(_0x4bef14,_0x54362c){_0x4bef14['body']['userpic']=_0x4bef14[_0x118c('0xb4')][_0x118c('0xb5')];return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x4bef14[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x54362c,null))['then'](saveUpdates(_0x4bef14[_0x118c('0x5d')],null))[_0x118c('0x22')](respondWithResult(_0x54362c,null))['catch'](handleError(_0x54362c,null));};exports[_0x118c('0xb6')]=function(_0x4f67d1,_0x53b699){var _0x5bde59=path[_0x118c('0xb7')](config['root'],_0x118c('0xb8'));return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x4f67d1[_0x118c('0x5f')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x53b699,null))[_0x118c('0x22')](function(_0x3387be){if(_0x3387be){if(_['isNil'](_0x3387be[_0x118c('0xb9')])){return _0x53b699[_0x118c('0xba')](_0x5bde59);}else{if(!fs['existsSync'](path[_0x118c('0xb7')](config[_0x118c('0xbb')],_0x118c('0xbc'),_0x3387be[_0x118c('0xb9')]))){return _0x53b699['download'](_0x5bde59);}return _0x53b699[_0x118c('0xba')](path[_0x118c('0xb7')](config[_0x118c('0xbb')],_0x118c('0xbc'),_0x3387be['userpic']));}}})['catch'](handleError(_0x53b699,null));};exports['getOpenTabs']=function(_0x561d3b,_0x4ddfda){return db[_0x118c('0x40')]['find']({'where':{'id':_0x561d3b[_0x118c('0x5f')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4ddfda,null))[_0x118c('0x22')](function(_0x3058fe){var _0x3f46cf=[];values=_0x3058fe[_0x118c('0x57')];_0x3f46cf[_0x118c('0x51')](get_open_tabs(_0x118c('0x56'),_0x3058fe[_0x118c('0x57')]));_0x3f46cf[_0x118c('0x51')](get_open_tabs(_0x118c('0x58'),_0x3058fe[_0x118c('0x57')]));_0x3f46cf[_0x118c('0x51')](get_open_tabs(_0x118c('0x5c'),_0x3058fe[_0x118c('0x57')]));_0x3f46cf['push'](get_open_tabs(_0x118c('0x5a'),_0x3058fe[_0x118c('0x57')]));_0x3f46cf['push'](get_open_tabs('fax',_0x3058fe['dataValues']));_0x3f46cf[_0x118c('0x51')](get_open_tabs('mail',_0x3058fe[_0x118c('0x57')]));return Promise[_0x118c('0x8a')](_0x3f46cf);})['then'](function(_0x5eaadb){if(_0x5eaadb){var _0x3f1995=_[_0x118c('0x3a')](values['ChatOpenTabs'],function(_0x8d24b5){return{'channel':_0x118c('0xbd'),'id':_0x8d24b5['id'],'createdAt':_0x8d24b5[_0x118c('0xbe')]};});var _0xdd4814=_[_0x118c('0x3a')](values['FaxOpenTabs'],function(_0x50ac07){return{'channel':'FAX','id':_0x50ac07['id'],'createdAt':_0x50ac07[_0x118c('0xbe')]};});var _0x2ecf72=_['map'](values[_0x118c('0xbf')],function(_0x28d549){return{'channel':_0x118c('0xc0'),'id':_0x28d549['id'],'createdAt':_0x28d549[_0x118c('0xbe')]};});var _0x1a283e=_[_0x118c('0x3a')](values[_0x118c('0xc1')],function(_0x50ef02){return{'channel':'MAIL','id':_0x50ef02['id'],'createdAt':_0x50ef02[_0x118c('0xbe')]};});var _0x4c4be1=_['map'](values['SmsOpenTabs'],function(_0x1149f8){return{'channel':_0x118c('0xc2'),'id':_0x1149f8['id'],'createdAt':_0x1149f8['createdAt']};});var _0x4e243a=_[_0x118c('0x3a')](values[_0x118c('0xc3')],function(_0x48c042){return{'channel':_0x118c('0xc4'),'id':_0x48c042['id'],'createdAt':_0x48c042['createdAt']};});var _0x5ace96=_[_0x118c('0xc5')](_0x3f1995,_0xdd4814,_0x2ecf72,_0x1a283e,_0x4c4be1,_0x4e243a);var _0x4b8c03={'count':_0x5ace96[_0x118c('0x55')],'rows':_0x5ace96};return _0x4b8c03;}else return null;})[_0x118c('0x22')](respondWithResult(_0x4ddfda,null))[_0x118c('0x2c')](handleError(_0x4ddfda,null));};exports[_0x118c('0xc6')]=function(_0x30c301,_0x233f2a){var _0x21a035={};return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x30c301[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](function(_0x45a562){if(!_0x45a562){throw new APINotFoundError(util[_0x118c('0xaa')](_0x118c('0xc7'),_0x30c301[_0x118c('0x5f')]['id']));}return contacts[_0x118c('0x60')]();})[_0x118c('0x22')](function(_0x161926){_0x30c301['query']['User']=_0x30c301[_0x118c('0x5f')]['id'];_0x21a035=qs['getOptions'](_0x161926,_0x30c301);if(_0x30c301[_0x118c('0x4b')]['hasOwnProperty'](_0x118c('0x4c'))){_0x21a035[_0x118c('0x4d')]=[{'model':db[_0x118c('0xc8')],'as':_0x118c('0xc9'),'required':![]},{'model':db[_0x118c('0xca')],'as':'Tags','attributes':['id','name',_0x118c('0xcb')],'where':_0x30c301[_0x118c('0x4b')][_0x118c('0xcc')]?{'id':_0x30c301[_0x118c('0x4b')][_0x118c('0xcc')]}:undefined,'required':_0x30c301[_0x118c('0x4b')][_0x118c('0xcc')]?!![]:![]}];}return contacts['findAll'](_0x30c301['query'],_0x30c301[_0x118c('0x36')],_0x21a035,_0x161926);})[_0x118c('0x22')](respondWithFilteredResult(_0x233f2a,_0x21a035))[_0x118c('0x2c')](APIHandleError(_0x233f2a));};exports[_0x118c('0xcd')]=function(_0x3a378d,_0x1897eb){var _0x59327d;var _0x39c57e={};var _0x1d8609;return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x3a378d['params']['id']},'attributes':['id','name',_0x118c('0x2e')]})[_0x118c('0x22')](handleEntityNotFound(_0x1897eb,null))[_0x118c('0x22')](function(_0x303009){if(!utils[_0x118c('0xa0')](_0x3a378d['query'][_0x118c('0xaf')])){throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0xa1'));}_0x59327d=_0x303009;var _0x52e2ee={};_0x52e2ee[_0x118c('0xce')]=_[_0x118c('0xcf')](db[_[_0x118c('0xa3')](_0x3a378d[_0x118c('0x4b')][_0x118c('0xaf')])+'Queue'][_0x118c('0xd0')]);_0x52e2ee[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x3a378d[_0x118c('0x4b')]);_0x52e2ee[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x52e2ee[_0x118c('0xce')],_0x52e2ee[_0x118c('0x4b')]);_0x39c57e[_0x118c('0x50')]=_['intersection'](_0x52e2ee[_0x118c('0xce')],qs['fields'](_0x3a378d[_0x118c('0x4b')][_0x118c('0xd3')]));_0x39c57e['attributes']=_0x39c57e[_0x118c('0x50')]['length']?_0x39c57e[_0x118c('0x50')]:_0x52e2ee[_0x118c('0xce')];_0x39c57e[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x3a378d['query'][_0x118c('0xd5')]);_0x39c57e['where']=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x3a378d[_0x118c('0x4b')],_0x52e2ee[_0x118c('0xd1')]));if(_0x3a378d[_0x118c('0x4b')]['filter']){_0x39c57e[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x39c57e[_0x118c('0x4a')],{'$or':_['map'](_0x39c57e['attributes'],function(_0x14d578){var _0x3db93a={};_0x3db93a[_0x14d578]={'$like':'%'+_0x3a378d[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x3db93a;})});}_0x39c57e=_[_0x118c('0xd7')]({},_0x39c57e,_0x3a378d[_0x118c('0xd8')]);switch(_0x59327d[_0x118c('0x2e')]){case _0x118c('0x34'):return db[_[_0x118c('0xa3')](_0x3a378d[_0x118c('0x4b')][_0x118c('0xaf')])+_0x118c('0xd9')][_0x118c('0x52')](_0x39c57e);case _0x118c('0x36'):case'agent':return _0x59327d[_0x118c('0x33')+_[_0x118c('0xa3')](_0x3a378d[_0x118c('0x4b')][_0x118c('0xaf')])+_0x118c('0xa5')](_0x39c57e);default:throw new db[(_0x118c('0x93'))][(_0x118c('0x90'))](_0x118c('0xda'));}})['then'](function(_0x4d88be){_0x1d8609=_0x4d88be['length'];if(!_0x3a378d[_0x118c('0x4b')][_0x118c('0xdb')](_0x118c('0xdc'))){_0x39c57e[_0x118c('0x1e')]=qs['limit'](_0x3a378d[_0x118c('0x4b')][_0x118c('0x1e')]);_0x39c57e[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x3a378d[_0x118c('0x4b')][_0x118c('0x1d')]);}switch(_0x59327d[_0x118c('0x2e')]){case _0x118c('0x34'):return db[_[_0x118c('0xa3')](_0x3a378d[_0x118c('0x4b')][_0x118c('0xaf')])+'Queue'][_0x118c('0x52')](_0x39c57e);case _0x118c('0x36'):case _0x118c('0x2f'):return _0x59327d[_0x118c('0x33')+_['capitalize'](_0x3a378d['query'][_0x118c('0xaf')])+'Queues'](_0x39c57e);}})[_0x118c('0x22')](function(_0x4abd1f){return{'count':_0x1d8609,'rows':_0x4abd1f};})['then'](respondWithResult(_0x1897eb,null))['catch'](handleError(_0x1897eb,null));};exports[_0x118c('0xdd')]=function(_0xd3a82e,_0xcd7cda){var _0x2b58f5={};var _0x523201={};var _0x370da3;var _0x4e0598;return db['User'][_0x118c('0x97')]({'where':{'id':_0xd3a82e[_0x118c('0x5f')]['id']}})['then'](handleEntityNotFound(_0xcd7cda,null))['then'](function(_0x1abd2e){if(_0x1abd2e){_0x370da3=_0x1abd2e;_0x523201[_0x118c('0xce')]=_[_0x118c('0xcf')](db[_0x118c('0xad')][_0x118c('0xd0')]);_0x523201[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0xd3a82e['query']);_0x523201[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x523201[_0x118c('0xce')],_0x523201[_0x118c('0x4b')]);_0x2b58f5['attributes']=_[_0x118c('0xd2')](_0x523201[_0x118c('0xce')],qs[_0x118c('0xd3')](_0xd3a82e[_0x118c('0x4b')][_0x118c('0xd3')]));_0x2b58f5['attributes']=_0x2b58f5[_0x118c('0x50')][_0x118c('0x55')]?_0x2b58f5[_0x118c('0x50')]:_0x523201[_0x118c('0xce')];_0x2b58f5[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0xd3a82e['query']['sort']);_0x2b58f5[_0x118c('0x4a')]=qs['filters'](_[_0x118c('0xd6')](_0xd3a82e[_0x118c('0x4b')],_0x523201[_0x118c('0xd1')]));if(_0xd3a82e[_0x118c('0x4b')][_0x118c('0x38')]){_0x2b58f5['where']=_[_0x118c('0xd7')](_0x2b58f5['where'],{'$or':_['map'](_0x2b58f5[_0x118c('0x50')],function(_0x3fce2d){var _0x58591e={};_0x58591e[_0x3fce2d]={'$like':'%'+_0xd3a82e[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x58591e;})});}_0x2b58f5=_[_0x118c('0xd7')]({},_0x2b58f5,_0xd3a82e[_0x118c('0xd8')]);return _0x370da3['getVoiceQueuesRt'](_0x2b58f5);}})[_0x118c('0x22')](function(_0x31b0d1){if(_0x31b0d1){_0x4e0598=_0x31b0d1[_0x118c('0x55')];if(!_0xd3a82e[_0x118c('0x4b')]['hasOwnProperty'](_0x118c('0xdc'))){_0x2b58f5['limit']=qs[_0x118c('0x1e')](_0xd3a82e[_0x118c('0x4b')]['limit']);_0x2b58f5[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0xd3a82e[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x370da3[_0x118c('0xdd')](_0x2b58f5);}})[_0x118c('0x22')](function(_0x422a4c){if(_0x422a4c){return _0x422a4c?{'count':_0x4e0598,'rows':_0x422a4c}:null;}})[_0x118c('0x22')](respondWithResult(_0xcd7cda,null))['catch'](handleError(_0xcd7cda,null));};exports[_0x118c('0xde')]=function(_0x406c73,_0x44abaa){var _0x38ffea={};var _0x552a27={};var _0x54abc6;var _0x470592;return db['User'][_0x118c('0x97')]({'where':{'id':_0x406c73[_0x118c('0x5f')]['id']}})['then'](handleEntityNotFound(_0x44abaa,null))[_0x118c('0x22')](function(_0x5613ce){if(_0x5613ce){_0x54abc6=_0x5613ce;_0x552a27[_0x118c('0xce')]=_[_0x118c('0xcf')](db[_0x118c('0xdf')]['rawAttributes']);_0x552a27['query']=_['keys'](_0x406c73['query']);_0x552a27['filters']=_['intersection'](_0x552a27[_0x118c('0xce')],_0x552a27[_0x118c('0x4b')]);_0x38ffea[_0x118c('0x50')]=_['intersection'](_0x552a27[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x406c73[_0x118c('0x4b')][_0x118c('0xd3')]));_0x38ffea[_0x118c('0x50')]=_0x38ffea[_0x118c('0x50')][_0x118c('0x55')]?_0x38ffea['attributes']:_0x552a27[_0x118c('0xce')];_0x38ffea[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x406c73[_0x118c('0x4b')][_0x118c('0xd5')]);_0x38ffea[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x406c73[_0x118c('0x4b')],_0x552a27[_0x118c('0xd1')]));if(_0x406c73[_0x118c('0x4b')]['filter']){_0x38ffea[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x38ffea[_0x118c('0x4a')],{'$or':_['map'](_0x38ffea['attributes'],function(_0x43eb1b){var _0x575e1b={};_0x575e1b[_0x43eb1b]={'$like':'%'+_0x406c73[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x575e1b;})});}_0x38ffea=_[_0x118c('0xd7')]({},_0x38ffea,_0x406c73[_0x118c('0xd8')]);return _0x54abc6['getGroups'](_0x38ffea);}})[_0x118c('0x22')](function(_0x207608){if(_0x207608){_0x470592=_0x207608[_0x118c('0x55')];if(!_0x406c73['query'][_0x118c('0xdb')](_0x118c('0xdc'))){_0x38ffea['limit']=qs[_0x118c('0x1e')](_0x406c73[_0x118c('0x4b')]['limit']);_0x38ffea[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x406c73[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x54abc6['getGroups'](_0x38ffea);}})['then'](function(_0x198f32){if(_0x198f32){return _0x198f32?{'count':_0x470592,'rows':_0x198f32}:null;}})[_0x118c('0x22')](respondWithResult(_0x44abaa,null))[_0x118c('0x2c')](handleError(_0x44abaa,null));};exports['getRecordings']=function(_0x2710bc,_0x4d642a){var _0x4fd1e6={'raw':!![],'where':{}};var _0x3ce4b6={};var _0x5940a8={'count':0x0,'rows':[]};return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x2710bc[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x4d642a,null))[_0x118c('0x22')](function(_0x3efbb8){if(_0x3efbb8){_0x3ce4b6['model']=_['keys'](db[_0x118c('0xe0')]['rawAttributes']);_0x3ce4b6[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x2710bc['query']);_0x3ce4b6['filters']=_[_0x118c('0xd2')](_0x3ce4b6['model'],_0x3ce4b6['query']);_0x4fd1e6[_0x118c('0x50')]=_['intersection'](_0x3ce4b6[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x2710bc[_0x118c('0x4b')]['fields']));_0x4fd1e6[_0x118c('0x50')]=_0x4fd1e6[_0x118c('0x50')]['length']?_0x4fd1e6[_0x118c('0x50')]:_0x3ce4b6[_0x118c('0xce')];if(!_0x2710bc[_0x118c('0x4b')][_0x118c('0xdb')]('nolimit')){_0x4fd1e6['limit']=qs[_0x118c('0x1e')](_0x2710bc[_0x118c('0x4b')]['limit']);_0x4fd1e6[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x2710bc[_0x118c('0x4b')][_0x118c('0x1d')]);}_0x4fd1e6['order']=qs['sort'](_0x2710bc[_0x118c('0x4b')][_0x118c('0xd5')]);_0x4fd1e6[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x2710bc[_0x118c('0x4b')],_0x3ce4b6[_0x118c('0xd1')]));_0x4fd1e6['where'][_0x118c('0xe1')]=_0x3efbb8['id'];if(_0x2710bc[_0x118c('0x4b')][_0x118c('0x38')]){_0x4fd1e6[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x4fd1e6[_0x118c('0x4a')],{'$or':_[_0x118c('0x3a')](_0x4fd1e6[_0x118c('0x50')],function(_0x16cc49){var _0xe2a83d={};_0xe2a83d[_0x16cc49]={'$like':'%'+_0x2710bc[_0x118c('0x4b')]['filter']+'%'};return _0xe2a83d;})});}_0x4fd1e6=_[_0x118c('0xd7')]({},_0x4fd1e6,_0x2710bc[_0x118c('0xd8')]);return db[_0x118c('0xe0')]['count']({'where':_0x4fd1e6[_0x118c('0x4a')]})[_0x118c('0x22')](function(_0x535093){_0x5940a8[_0x118c('0x1f')]=_0x535093;if(_0x2710bc[_0x118c('0x4b')][_0x118c('0x4c')]){_0x4fd1e6[_0x118c('0x4d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x118c('0x52')](_0x4fd1e6);})['then'](function(_0x58878e){_0x5940a8[_0x118c('0x54')]=_0x58878e;return _0x5940a8;});}})[_0x118c('0x22')](respondWithFilteredResult(_0x4d642a,_0x4fd1e6))[_0x118c('0x2c')](handleError(_0x4d642a,null));};exports[_0x118c('0xe2')]=function(_0x1eff84,_0x3376be){var _0x35f9e={'raw':!![],'where':{}};var _0x2a7d3a={};var _0x207eb6={'count':0x0,'rows':[]};return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x1eff84[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x3376be,null))['then'](function(_0x2a2d9d){if(_0x2a2d9d){_0x2a7d3a[_0x118c('0xce')]=_['keys'](db['ScreenRecording'][_0x118c('0xd0')]);_0x2a7d3a[_0x118c('0x4b')]=_['keys'](_0x1eff84[_0x118c('0x4b')]);_0x2a7d3a['filters']=_[_0x118c('0xd2')](_0x2a7d3a[_0x118c('0xce')],_0x2a7d3a[_0x118c('0x4b')]);_0x35f9e[_0x118c('0x50')]=_[_0x118c('0xd2')](_0x2a7d3a[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x1eff84['query'][_0x118c('0xd3')]));_0x35f9e[_0x118c('0x50')]=_0x35f9e[_0x118c('0x50')]['length']?_0x35f9e[_0x118c('0x50')]:_0x2a7d3a['model'];if(!_0x1eff84['query'][_0x118c('0xdb')]('nolimit')){_0x35f9e[_0x118c('0x1e')]=qs[_0x118c('0x1e')](_0x1eff84[_0x118c('0x4b')]['limit']);_0x35f9e['offset']=qs[_0x118c('0x1d')](_0x1eff84[_0x118c('0x4b')][_0x118c('0x1d')]);}_0x35f9e['order']=qs[_0x118c('0xd5')](_0x1eff84[_0x118c('0x4b')]['sort']);_0x35f9e[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x1eff84[_0x118c('0x4b')],_0x2a7d3a['filters']));_0x35f9e[_0x118c('0x4a')][_0x118c('0xe1')]=_0x2a2d9d['id'];if(_0x1eff84[_0x118c('0x4b')][_0x118c('0x38')]){_0x35f9e['where']=_[_0x118c('0xd7')](_0x35f9e[_0x118c('0x4a')],{'$or':_[_0x118c('0x3a')](_0x35f9e[_0x118c('0x50')],function(_0x2842f3){var _0x246242={};_0x246242[_0x2842f3]={'$like':'%'+_0x1eff84[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x246242;})});}_0x35f9e=_[_0x118c('0xd7')]({},_0x35f9e,_0x1eff84[_0x118c('0xd8')]);return db[_0x118c('0xe3')][_0x118c('0x1f')]({'where':_0x35f9e[_0x118c('0x4a')]})['then'](function(_0x219617){_0x207eb6['count']=_0x219617;if(_0x1eff84['query'][_0x118c('0x4c')]){_0x35f9e[_0x118c('0x4d')]=[{'all':!![]}];}return db[_0x118c('0xe3')][_0x118c('0x52')](_0x35f9e);})[_0x118c('0x22')](function(_0x417d3a){_0x207eb6[_0x118c('0x54')]=_0x417d3a;return _0x207eb6;});}})[_0x118c('0x22')](respondWithFilteredResult(_0x3376be,_0x35f9e))['catch'](handleError(_0x3376be,null));};exports[_0x118c('0xe4')]=function(_0x59550d,_0x373506){var _0x5b358f={};var _0x1753bf={};var _0x58a91b;var _0x104b57;return db['User'][_0x118c('0x97')]({'where':{'id':_0x59550d[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x373506,null))[_0x118c('0x22')](function(_0x22ddd1){if(_0x22ddd1){_0x58a91b=_0x22ddd1;_0x1753bf[_0x118c('0xce')]=_[_0x118c('0xcf')](db['ChatInteraction'][_0x118c('0xd0')]);_0x1753bf[_0x118c('0x4b')]=_['keys'](_0x59550d[_0x118c('0x4b')]);_0x1753bf[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x1753bf[_0x118c('0xce')],_0x1753bf[_0x118c('0x4b')]);_0x5b358f[_0x118c('0x50')]=_[_0x118c('0xd2')](_0x1753bf[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x59550d[_0x118c('0x4b')][_0x118c('0xd3')]));_0x5b358f[_0x118c('0x50')]=_0x5b358f[_0x118c('0x50')]['length']?_0x5b358f['attributes']:_0x1753bf[_0x118c('0xce')];_0x5b358f[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x59550d['query']['sort']);_0x5b358f[_0x118c('0x4a')]=qs['filters'](_[_0x118c('0xd6')](_0x59550d['query'],_0x1753bf['filters']));if(_0x59550d[_0x118c('0x4b')][_0x118c('0x38')]){_0x5b358f[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x5b358f[_0x118c('0x4a')],{'$or':_[_0x118c('0x3a')](_0x5b358f[_0x118c('0x50')],function(_0x14b55f){var _0x3ee00a={};_0x3ee00a[_0x14b55f]={'$like':'%'+_0x59550d[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x3ee00a;})});}_0x5b358f=_[_0x118c('0xd7')]({},_0x5b358f,_0x59550d[_0x118c('0xd8')]);return _0x58a91b[_0x118c('0xe4')](_0x5b358f);}})[_0x118c('0x22')](function(_0x5772a0){if(_0x5772a0){_0x104b57=_0x5772a0[_0x118c('0x55')];if(!_0x59550d[_0x118c('0x4b')][_0x118c('0xdb')](_0x118c('0xdc'))){_0x5b358f['limit']=qs['limit'](_0x59550d[_0x118c('0x4b')][_0x118c('0x1e')]);_0x5b358f[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x59550d[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x58a91b[_0x118c('0xe4')](_0x5b358f);}})[_0x118c('0x22')](function(_0x5f2ae5){if(_0x5f2ae5){return _0x5f2ae5?{'count':_0x104b57,'rows':_0x5f2ae5}:null;}})[_0x118c('0x22')](respondWithResult(_0x373506,null))['catch'](handleError(_0x373506,null));};exports[_0x118c('0xe5')]=function(_0x4eed8b,_0x310d2a){var _0x40783f={};var _0x500b84={};var _0x1db3ed;var _0x9df7ca;return db['User'][_0x118c('0x97')]({'where':{'id':_0x4eed8b['params']['id']}})['then'](handleEntityNotFound(_0x310d2a,null))[_0x118c('0x22')](function(_0x572ddf){if(_0x572ddf){_0x1db3ed=_0x572ddf;_0x500b84[_0x118c('0xce')]=_[_0x118c('0xcf')](db['OpenchannelInteraction'][_0x118c('0xd0')]);_0x500b84['query']=_[_0x118c('0xcf')](_0x4eed8b[_0x118c('0x4b')]);_0x500b84[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x500b84[_0x118c('0xce')],_0x500b84['query']);_0x40783f['attributes']=_[_0x118c('0xd2')](_0x500b84[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x4eed8b[_0x118c('0x4b')][_0x118c('0xd3')]));_0x40783f[_0x118c('0x50')]=_0x40783f[_0x118c('0x50')]['length']?_0x40783f[_0x118c('0x50')]:_0x500b84[_0x118c('0xce')];_0x40783f[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x4eed8b['query'][_0x118c('0xd5')]);_0x40783f[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x4eed8b['query'],_0x500b84[_0x118c('0xd1')]));if(_0x4eed8b[_0x118c('0x4b')][_0x118c('0x38')]){_0x40783f[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x40783f[_0x118c('0x4a')],{'$or':_[_0x118c('0x3a')](_0x40783f[_0x118c('0x50')],function(_0x550be2){var _0x8f9512={};_0x8f9512[_0x550be2]={'$like':'%'+_0x4eed8b[_0x118c('0x4b')]['filter']+'%'};return _0x8f9512;})});}_0x40783f=_['merge']({},_0x40783f,_0x4eed8b[_0x118c('0xd8')]);return _0x1db3ed[_0x118c('0xe5')](_0x40783f);}})[_0x118c('0x22')](function(_0x35c271){if(_0x35c271){_0x9df7ca=_0x35c271['length'];if(!_0x4eed8b[_0x118c('0x4b')]['hasOwnProperty'](_0x118c('0xdc'))){_0x40783f[_0x118c('0x1e')]=qs[_0x118c('0x1e')](_0x4eed8b[_0x118c('0x4b')]['limit']);_0x40783f[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x4eed8b[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x1db3ed[_0x118c('0xe5')](_0x40783f);}})[_0x118c('0x22')](function(_0xdc651e){if(_0xdc651e){return _0xdc651e?{'count':_0x9df7ca,'rows':_0xdc651e}:null;}})[_0x118c('0x22')](respondWithResult(_0x310d2a,null))['catch'](handleError(_0x310d2a,null));};exports[_0x118c('0xe6')]=function(_0x232d83,_0x4ee74d){var _0x4a0926={'raw':!![],'where':{}};var _0x410e9d={};var _0x467d13={'count':0x0,'rows':[]};return db['User'][_0x118c('0x97')]({'where':{'id':_0x232d83['params']['id']}})['then'](handleEntityNotFound(_0x4ee74d,null))['then'](function(_0x5bfbc3){if(_0x5bfbc3){_0x410e9d[_0x118c('0xce')]=_['keys'](db[_0x118c('0xe7')][_0x118c('0xd0')]);_0x410e9d[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x232d83[_0x118c('0x4b')]);_0x410e9d[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x410e9d[_0x118c('0xce')],_0x410e9d[_0x118c('0x4b')]);_0x4a0926[_0x118c('0x50')]=_[_0x118c('0xd2')](_0x410e9d[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x232d83[_0x118c('0x4b')]['fields']));_0x4a0926[_0x118c('0x50')]=_0x4a0926['attributes'][_0x118c('0x55')]?_0x4a0926[_0x118c('0x50')]:_0x410e9d['model'];if(!_0x232d83[_0x118c('0x4b')][_0x118c('0xdb')](_0x118c('0xdc'))){_0x4a0926[_0x118c('0x1e')]=qs[_0x118c('0x1e')](_0x232d83[_0x118c('0x4b')][_0x118c('0x1e')]);_0x4a0926['offset']=qs[_0x118c('0x1d')](_0x232d83[_0x118c('0x4b')][_0x118c('0x1d')]);}_0x4a0926['order']=qs[_0x118c('0xd5')](_0x232d83[_0x118c('0x4b')]['sort']);_0x4a0926[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_['pick'](_0x232d83[_0x118c('0x4b')],_0x410e9d[_0x118c('0xd1')]));_0x4a0926['where'][_0x118c('0xe1')]=_0x5bfbc3['id'];if(_0x232d83[_0x118c('0x4b')][_0x118c('0x38')]){_0x4a0926[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x4a0926[_0x118c('0x4a')],{'$or':_['map'](_0x4a0926['attributes'],function(_0x21f55f){var _0x1ffea7={};_0x1ffea7[_0x21f55f]={'$like':'%'+_0x232d83[_0x118c('0x4b')]['filter']+'%'};return _0x1ffea7;})});}_0x4a0926=_['merge']({},_0x4a0926,_0x232d83['options']);return db[_0x118c('0xe7')][_0x118c('0x1f')]({'where':_0x4a0926[_0x118c('0x4a')]})[_0x118c('0x22')](function(_0x437b54){_0x467d13[_0x118c('0x1f')]=_0x437b54;if(_0x232d83['query']['includeAll']){_0x4a0926[_0x118c('0x4d')]=[{'all':!![]}];}return db['MailInteraction'][_0x118c('0x52')](_0x4a0926);})[_0x118c('0x22')](function(_0x7763ea){_0x467d13['rows']=_0x7763ea;return _0x467d13;});}})['then'](respondWithFilteredResult(_0x4ee74d,_0x4a0926))[_0x118c('0x2c')](handleError(_0x4ee74d,null));};exports['getSmsInteractions']=function(_0x5e12c4,_0x1e7a4b){var _0x328bb8={};var _0x31419d={};var _0x4d036c;var _0xa70ea1;return db['User'][_0x118c('0x97')]({'where':{'id':_0x5e12c4[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x1e7a4b,null))[_0x118c('0x22')](function(_0x28e299){if(_0x28e299){_0x4d036c=_0x28e299;_0x31419d[_0x118c('0xce')]=_['keys'](db[_0x118c('0xe8')][_0x118c('0xd0')]);_0x31419d['query']=_['keys'](_0x5e12c4['query']);_0x31419d[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x31419d[_0x118c('0xce')],_0x31419d[_0x118c('0x4b')]);_0x328bb8[_0x118c('0x50')]=_[_0x118c('0xd2')](_0x31419d[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x5e12c4[_0x118c('0x4b')]['fields']));_0x328bb8['attributes']=_0x328bb8['attributes']['length']?_0x328bb8[_0x118c('0x50')]:_0x31419d['model'];_0x328bb8[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x5e12c4[_0x118c('0x4b')][_0x118c('0xd5')]);_0x328bb8[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x5e12c4[_0x118c('0x4b')],_0x31419d['filters']));if(_0x5e12c4['query'][_0x118c('0x38')]){_0x328bb8[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x328bb8['where'],{'$or':_[_0x118c('0x3a')](_0x328bb8['attributes'],function(_0x4f610f){var _0x5446a7={};_0x5446a7[_0x4f610f]={'$like':'%'+_0x5e12c4['query'][_0x118c('0x38')]+'%'};return _0x5446a7;})});}_0x328bb8=_['merge']({},_0x328bb8,_0x5e12c4[_0x118c('0xd8')]);return _0x4d036c['getSmsInteractions'](_0x328bb8);}})[_0x118c('0x22')](function(_0x5b8db3){if(_0x5b8db3){_0xa70ea1=_0x5b8db3[_0x118c('0x55')];if(!_0x5e12c4[_0x118c('0x4b')]['hasOwnProperty'](_0x118c('0xdc'))){_0x328bb8['limit']=qs[_0x118c('0x1e')](_0x5e12c4[_0x118c('0x4b')][_0x118c('0x1e')]);_0x328bb8[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x5e12c4[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x4d036c[_0x118c('0xe9')](_0x328bb8);}})[_0x118c('0x22')](function(_0x4b966f){if(_0x4b966f){return _0x4b966f?{'count':_0xa70ea1,'rows':_0x4b966f}:null;}})['then'](respondWithResult(_0x1e7a4b,null))[_0x118c('0x2c')](handleError(_0x1e7a4b,null));};exports[_0x118c('0xea')]=function(_0x108f8f,_0x5e708c){var _0x485c31={};var _0x5b11fa={};var _0x8dfab8;var _0x45ced7;return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x108f8f[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x5e708c,null))[_0x118c('0x22')](function(_0x413c2f){if(_0x413c2f){_0x8dfab8=_0x413c2f;_0x5b11fa[_0x118c('0xce')]=_['keys'](db['FaxInteraction'][_0x118c('0xd0')]);_0x5b11fa[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x108f8f[_0x118c('0x4b')]);_0x5b11fa[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x5b11fa[_0x118c('0xce')],_0x5b11fa[_0x118c('0x4b')]);_0x485c31['attributes']=_[_0x118c('0xd2')](_0x5b11fa[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x108f8f[_0x118c('0x4b')]['fields']));_0x485c31['attributes']=_0x485c31[_0x118c('0x50')][_0x118c('0x55')]?_0x485c31[_0x118c('0x50')]:_0x5b11fa[_0x118c('0xce')];_0x485c31[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x108f8f['query']['sort']);_0x485c31[_0x118c('0x4a')]=qs['filters'](_[_0x118c('0xd6')](_0x108f8f['query'],_0x5b11fa[_0x118c('0xd1')]));if(_0x108f8f[_0x118c('0x4b')][_0x118c('0x38')]){_0x485c31['where']=_[_0x118c('0xd7')](_0x485c31['where'],{'$or':_[_0x118c('0x3a')](_0x485c31[_0x118c('0x50')],function(_0x431a17){var _0x2304bf={};_0x2304bf[_0x431a17]={'$like':'%'+_0x108f8f[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x2304bf;})});}_0x485c31=_[_0x118c('0xd7')]({},_0x485c31,_0x108f8f[_0x118c('0xd8')]);return _0x8dfab8[_0x118c('0xea')](_0x485c31);}})[_0x118c('0x22')](function(_0x5d6e3f){if(_0x5d6e3f){_0x45ced7=_0x5d6e3f[_0x118c('0x55')];if(!_0x108f8f[_0x118c('0x4b')]['hasOwnProperty'](_0x118c('0xdc'))){_0x485c31['limit']=qs[_0x118c('0x1e')](_0x108f8f['query'][_0x118c('0x1e')]);_0x485c31['offset']=qs[_0x118c('0x1d')](_0x108f8f[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x8dfab8[_0x118c('0xea')](_0x485c31);}})[_0x118c('0x22')](function(_0xd17044){if(_0xd17044){return _0xd17044?{'count':_0x45ced7,'rows':_0xd17044}:null;}})[_0x118c('0x22')](respondWithResult(_0x5e708c,null))[_0x118c('0x2c')](handleError(_0x5e708c,null));};exports[_0x118c('0xeb')]=function(_0x3a5b7f,_0x42f731){var _0x367360={};var _0x254550={};var _0x17ac96;var _0xb8169;return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x3a5b7f[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x42f731,null))['then'](function(_0x76ee7f){if(_0x76ee7f){_0x17ac96=_0x76ee7f;_0x254550[_0x118c('0xce')]=_[_0x118c('0xcf')](db[_0x118c('0xec')][_0x118c('0xd0')]);_0x254550['query']=_[_0x118c('0xcf')](_0x3a5b7f[_0x118c('0x4b')]);_0x254550[_0x118c('0xd1')]=_['intersection'](_0x254550[_0x118c('0xce')],_0x254550[_0x118c('0x4b')]);_0x367360['attributes']=_['intersection'](_0x254550[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x3a5b7f['query'][_0x118c('0xd3')]));_0x367360['attributes']=_0x367360[_0x118c('0x50')][_0x118c('0x55')]?_0x367360[_0x118c('0x50')]:_0x254550[_0x118c('0xce')];_0x367360[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x3a5b7f[_0x118c('0x4b')][_0x118c('0xd5')]);_0x367360[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x3a5b7f[_0x118c('0x4b')],_0x254550['filters']));if(_0x3a5b7f[_0x118c('0x4b')]['filter']){_0x367360[_0x118c('0x4a')]=_[_0x118c('0xd7')](_0x367360[_0x118c('0x4a')],{'$or':_[_0x118c('0x3a')](_0x367360[_0x118c('0x50')],function(_0x3feac5){var _0x44b251={};_0x44b251[_0x3feac5]={'$like':'%'+_0x3a5b7f[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x44b251;})});}_0x367360=_['merge']({},_0x367360,_0x3a5b7f[_0x118c('0xd8')]);return _0x17ac96[_0x118c('0xeb')](_0x367360);}})[_0x118c('0x22')](function(_0x15d92a){if(_0x15d92a){_0xb8169=_0x15d92a[_0x118c('0x55')];if(!_0x3a5b7f[_0x118c('0x4b')][_0x118c('0xdb')](_0x118c('0xdc'))){_0x367360['limit']=qs['limit'](_0x3a5b7f['query']['limit']);_0x367360[_0x118c('0x1d')]=qs['offset'](_0x3a5b7f[_0x118c('0x4b')][_0x118c('0x1d')]);}return _0x17ac96[_0x118c('0xeb')](_0x367360);}})[_0x118c('0x22')](function(_0x57ec60){if(_0x57ec60){return _0x57ec60?{'count':_0xb8169,'rows':_0x57ec60}:null;}})[_0x118c('0x22')](respondWithResult(_0x42f731,null))['catch'](handleError(_0x42f731,null));};exports[_0x118c('0xed')]=function(_0x37e67b,_0x444211,_0x4741c9){var _0x59624f;var _0x3c3c1c;var _0x406bf3;var _0x18ab5b=!_['isNil'](_0x37e67b[_0x118c('0x5f')]['id'])?_0x37e67b[_0x118c('0x5f')]['id']:!_['isNil'](_0x37e67b['user']['id'])?_0x37e67b[_0x118c('0x36')]['id']:null;return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x18ab5b,'role':{'$or':[_0x118c('0x34'),'user',_0x118c('0x2f')]}},'attributes':['id',_0x118c('0x3d'),'phone',_0x118c('0xee'),_0x118c('0x2e'),_0x118c('0x67'),'loginInPause']})[_0x118c('0x22')](function(_0x5481e5){if(_0x5481e5){if(_0x5481e5['role']===_0x118c('0x2f')){_0x59624f=_0x5481e5;if(_0x37e67b['body'][_0x118c('0xa9')]){_0x406bf3=util[_0x118c('0xaa')]('LOCAL/%s@from-sip/n',_0x59624f[_0x37e67b['body']['interface']]);}else if(_0x37e67b[_0x118c('0x5d')][_0x118c('0xef')]){_0x406bf3=util[_0x118c('0xaa')](_0x118c('0xab'),_0x37e67b[_0x118c('0x5d')]['intrf']);}else{_0x406bf3=util[_0x118c('0xaa')]('SIP/%s',_0x59624f[_0x118c('0x3d')]);}socket['to'](util[_0x118c('0xaa')](_0x118c('0xf0'),_0x59624f[_0x118c('0x3d')]))[_0x118c('0x30')](_0x118c('0xf1'),{'user':{'id':_0x59624f['id'],'name':_0x59624f['name']},'ip':_0x37e67b[_0x118c('0xf2')][_0x118c('0xf3')]||_0x37e67b['connection'][_0x118c('0xf4')]||_0x37e67b['socket'][_0x118c('0xf4')]||_0x37e67b[_0x118c('0xf5')]['socket']['remoteAddress']});return db[_0x118c('0xad')][_0x118c('0x32')]({'where':{'membername':_0x59624f['name']},'individualHooks':!![]});}}else{throw new db[(_0x118c('0x93'))]['ValidationError'](_0x118c('0xf6'));}})[_0x118c('0x22')](function(){if(_0x59624f){return _0x59624f[_0x118c('0xf7')]({'raw':!![]});}})[_0x118c('0x22')](function(_0x26369b){if(_0x59624f){if(_0x26369b){_0x3c3c1c=_0x26369b;if(_0x3c3c1c['length']){var _0x2ec382=_0x3c3c1c[_0x118c('0x3a')](function(_0x10b6c5){var _0x3707b1={'membername':_0x59624f[_0x118c('0x3d')],'UserId':_0x59624f['id'],'queue_name':_0x10b6c5[_0x118c('0x3d')],'VoiceQueueId':_0x10b6c5['id'],'interface':_0x406bf3,'paused':_0x59624f[_0x118c('0x9e')]||![],'penalty':_0x10b6c5[_0x118c('0xf8')]||0x0};return db[_0x118c('0xad')][_0x118c('0xae')](_0x3707b1);});return Promise[_0x118c('0x8a')](_0x2ec382);}}}})[_0x118c('0x22')](function(){if(_0x59624f){return db[_0x118c('0xf9')][_0x118c('0x52')]({'where':{'membername':_0x59624f[_0x118c('0x3d')],'exitAt':null}});}})[_0x118c('0x22')](function(_0x555c6d){if(_0x59624f){var _0xa882dd=[];_0x555c6d[_0x118c('0xfa')](function(_0x160cd3){_0xa882dd['push'](_0x160cd3['update']({'exitAt':moment()[_0x118c('0xaa')](_0x118c('0xfb'))}));});return Promise[_0x118c('0x8a')](_0xa882dd);}})[_0x118c('0x22')](function(){if(_0x59624f){var _0x343b07=[];var _0x29dbd6=[];var _0x75914c=utils[_0x118c('0xfc')]();var _0x37ab61={'membername':_0x59624f[_0x118c('0x3d')],'interface':_0x406bf3,'enterAt':moment()[_0x118c('0xaa')](_0x118c('0xfb')),'role':_0x59624f['role'],'internal':_0x59624f[_0x118c('0x67')]};_0x75914c['forEach'](function(_0x201837){_0x343b07[_0x118c('0x51')](_[_0x118c('0xd7')]({'channel':_0x201837,'type':_0x118c('0xfd'),'data1':_0x37e67b['body']['device'],'data2':_0x406bf3},_0x37ab61));if(_0x59624f[_0x118c('0x9e')]){_0x29dbd6[_0x118c('0x51')](_[_0x118c('0xd7')]({'channel':_0x201837,'type':'PAUSE','data1':_0x118c('0xfe')},_0x37ab61));}});return db['MemberReport']['bulkCreate'](_0x343b07['concat'](_0x29dbd6),{'individualHooks':!![]});}})['then'](function(){if(_0x59624f){return _0x59624f[_0x118c('0x2d')]({'online':!![],'lastLoginAt':moment()['format'](_0x118c('0xfb')),'voicePause':_0x59624f[_0x118c('0x9e')]||![],'mailPause':_0x59624f['loginInPause']||![],'chatPause':_0x59624f[_0x118c('0x9e')]||![],'faxPause':_0x59624f['loginInPause']||![],'smsPause':_0x59624f[_0x118c('0x9e')]||![],'openchannelPause':_0x59624f[_0x118c('0x9e')]||![],'whatsappPause':_0x59624f[_0x118c('0x9e')]||![],'pauseType':_0x59624f['loginInPause']?_0x118c('0xfe'):null,'interface':_0x406bf3,'lastPauseAt':moment()['format'](_0x118c('0xfb'))});}})[_0x118c('0x22')](function(_0x5ad67c){if(_0x37e67b['isMiddleware']){return _0x4741c9();}else{return Promise['resolve'](_0x5ad67c)[_0x118c('0x22')](respondWithResult(_0x444211,null));}})[_0x118c('0x2c')](handleError(_0x444211,null));};exports[_0x118c('0xff')]=function(_0x3f1f6e,_0x374bd7){var _0x7c0f0e;return db[_0x118c('0x40')]['find']({'where':{'id':_0x3f1f6e[_0x118c('0x5f')]['id'],'role':_0x118c('0x2f')},'attributes':['id',_0x118c('0x3d'),_0x118c('0x2e')]})[_0x118c('0x22')](handleEntityNotFound(_0x374bd7,null))[_0x118c('0x22')](function(_0x314c39){if(_0x314c39){_0x7c0f0e=_0x314c39;return db['UserVoiceQueueRt'][_0x118c('0x32')]({'where':{'membername':_0x7c0f0e[_0x118c('0x3d')]},'individualHooks':!![]});}})[_0x118c('0x22')](function(){return db[_0x118c('0xf9')]['findAll']({'where':{'membername':_0x7c0f0e[_0x118c('0x3d')],'exitAt':null}});})['then'](function(_0x365b56){var _0x136449=[];_0x365b56['forEach'](function(_0x537548){_0x136449[_0x118c('0x51')](_0x537548['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x118c('0x8a')](_0x136449);})[_0x118c('0x22')](function(){return _0x7c0f0e[_0x118c('0x2d')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x118c('0x22')](respondWithResult(_0x374bd7,null))['catch'](handleError(_0x374bd7,null));};exports[_0x118c('0x100')]=function(_0x17ab79,_0x3c05a2){var _0x54bcf3;return db[_0x118c('0xad')]['update']({'paused':0x1},{'where':{'UserId':_0x17ab79[_0x118c('0x5f')]['id']},'individualHooks':!![]})[_0x118c('0x22')](function(){return db['User'][_0x118c('0x5e')]({'where':{'id':_0x17ab79[_0x118c('0x5f')]['id'],'role':_0x118c('0x2f')},'attributes':['id',_0x118c('0x3d'),_0x118c('0x2e'),'internal','interface','online']});})['then'](handleEntityNotFound(_0x3c05a2,null))[_0x118c('0x22')](function(_0x4ea227){if(_0x4ea227){_0x54bcf3=_0x4ea227;return respondWithRpcPromise(_0x118c('0x101'),'pause',{'id':_0x54bcf3['id'],'name':_0x54bcf3[_0x118c('0x3d')],'pause':!![]});}})[_0x118c('0x22')](function(){if(_0x54bcf3){return db['MemberReport'][_0x118c('0x52')]({'where':{'membername':_0x54bcf3[_0x118c('0x3d')],'type':_0x118c('0x102'),'exitAt':null}});}})[_0x118c('0x22')](function(_0x50168b){if(_0x50168b['length']){var _0x45ff2a=moment()[_0x118c('0xaa')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2b1b44=0x0,_0x55ce72=_0x50168b[_0x118c('0x55')];_0x2b1b44<_0x55ce72;_0x2b1b44++){_0x50168b[_0x2b1b44][_0x118c('0x103')]({'exitAt':_0x45ff2a});}}})[_0x118c('0x22')](function(){var _0x3ccee5=[];var _0x18a460=utils[_0x118c('0xfc')]();_0x18a460[_0x118c('0xfa')](function(_0x2bd984){_0x3ccee5[_0x118c('0x51')]({'channel':_0x2bd984,'membername':_0x54bcf3[_0x118c('0x3d')],'interface':_[_0x118c('0x68')](_0x54bcf3['interface'])?util[_0x118c('0xaa')]('SIP/%s',_0x54bcf3[_0x118c('0x3d')]):_0x54bcf3[_0x118c('0xa9')],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x17ab79[_0x118c('0x5d')][_0x118c('0x104')]||_0x118c('0x105'),'role':_0x54bcf3['role'],'internal':_0x54bcf3[_0x118c('0x67')]});});return db['MemberReport'][_0x118c('0x106')](_0x3ccee5,{'individualHooks':!![]});})[_0x118c('0x22')](function(){return _0x54bcf3['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x17ab79[_0x118c('0x5d')][_0x118c('0x104')]||_0x118c('0x105'),'lastPauseAt':moment()[_0x118c('0xaa')](_0x118c('0xfb'))});})[_0x118c('0x22')](respondWithResult(_0x3c05a2,null))['catch'](handleError(_0x3c05a2,null));};exports[_0x118c('0x107')]=function(_0x1c6d3c,_0x3632bf){if(_0x1c6d3c[_0x118c('0x5d')][_0x118c('0xaf')]&&!utils['isValidChannel'](_0x1c6d3c[_0x118c('0x5d')]['channel'])){throw new APIBadRequestError(util[_0x118c('0xaa')](_0x118c('0x108'),_0x1c6d3c[_0x118c('0x5d')][_0x118c('0xaf')]));}return db[_0x118c('0x40')][_0x118c('0x5e')]({'where':{'id':_0x1c6d3c['params']['id']},'attributes':['id',_0x118c('0x3d'),_0x118c('0x2e'),_0x118c('0x67'),'interface',_0x118c('0x109'),_0x118c('0x9f'),_0x118c('0x10a'),_0x118c('0x10b'),'faxPause',_0x118c('0x10c'),_0x118c('0x10d'),_0x118c('0x10e'),_0x118c('0x10f'),_0x118c('0x110')]})['then'](function(_0x321bc7){if(!_0x321bc7){throw new APINotFoundError(util[_0x118c('0xaa')](_0x118c('0xc7'),_0x1c6d3c[_0x118c('0x5f')]['id']));}return _0x321bc7[_0x118c('0x107')](_0x1c6d3c['body'][_0x118c('0xaf')]);})[_0x118c('0x22')](respondWithResult(_0x3632bf,null))[_0x118c('0x2c')](APIHandleError(_0x3632bf));};exports[_0x118c('0x111')]=function(_0x481343,_0x2c20d3){var _0x14472c={};var _0x3b2588={};var _0x252a06;var _0x201a83;return db['User']['findOne']({'where':{'id':_0x481343[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x2c20d3,null))[_0x118c('0x22')](function(_0x505c85){if(_0x505c85){_0x252a06=_0x505c85;_0x3b2588[_0x118c('0xce')]=_[_0x118c('0xcf')](db[_0x118c('0x112')][_0x118c('0xd0')]);_0x3b2588[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x481343['query']);_0x3b2588[_0x118c('0xd1')]=_['intersection'](_0x3b2588[_0x118c('0xce')],_0x3b2588[_0x118c('0x4b')]);_0x14472c[_0x118c('0x50')]=_[_0x118c('0xd2')](_0x3b2588['model'],qs[_0x118c('0xd3')](_0x481343[_0x118c('0x4b')]['fields']));_0x14472c[_0x118c('0x50')]=_0x14472c[_0x118c('0x50')][_0x118c('0x55')]?_0x14472c[_0x118c('0x50')]:_0x3b2588['model'];_0x14472c['order']=qs[_0x118c('0xd5')](_0x481343['query'][_0x118c('0xd5')]);_0x14472c['where']=qs['filters'](_[_0x118c('0xd6')](_0x481343[_0x118c('0x4b')],_0x3b2588['filters']));if(_0x481343[_0x118c('0x4b')][_0x118c('0x38')]){_0x14472c[_0x118c('0x4a')]=_['merge'](_0x14472c[_0x118c('0x4a')],{'$or':_['map'](_0x14472c['attributes'],function(_0x14710b){var _0x34768e={};_0x34768e[_0x14710b]={'$like':'%'+_0x481343[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x34768e;})});}_0x14472c=_[_0x118c('0xd7')]({},_0x14472c,_0x481343[_0x118c('0xd8')]);return _0x252a06['getTeams'](_0x14472c);}})[_0x118c('0x22')](function(_0x1d0702){if(_0x1d0702){_0x201a83=_0x1d0702[_0x118c('0x55')];if(!_0x481343[_0x118c('0x4b')][_0x118c('0xdb')](_0x118c('0xdc'))){_0x14472c[_0x118c('0x1e')]=qs[_0x118c('0x1e')](_0x481343[_0x118c('0x4b')][_0x118c('0x1e')]);_0x14472c['offset']=qs[_0x118c('0x1d')](_0x481343[_0x118c('0x4b')]['offset']);}return _0x252a06['getTeams'](_0x14472c);}})[_0x118c('0x22')](function(_0x3c9008){if(_0x3c9008){return _0x3c9008?{'count':_0x201a83,'rows':_0x3c9008}:null;}})[_0x118c('0x22')](respondWithResult(_0x2c20d3,null))[_0x118c('0x2c')](handleError(_0x2c20d3,null));};exports[_0x118c('0x113')]=function(_0x384234,_0x3947e2){var _0x38abf4=_0x384234['params']['id'];var _0x2cd479=_0x384234[_0x118c('0x5d')]?_0x384234[_0x118c('0x5d')][_0x118c('0x63')]:null;var _0x44c136=[];return Promise['resolve']()[_0x118c('0x22')](function(){if(!_0x2cd479)throw new APIBadRequestError(_0x118c('0x114'));})[_0x118c('0x22')](function(){return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x38abf4}});})[_0x118c('0x22')](function(_0x2e3b78){if(!_0x2e3b78)throw new APINotFoundError(util[_0x118c('0xaa')]('User\x20with\x20id\x20%s\x20not\x20found',_0x384234[_0x118c('0x5f')]['id']));return db[_0x118c('0x6a')][_0x118c('0x115')](function(_0x5536ff){return _0x2e3b78[_0x118c('0x113')](_0x2cd479,{'transaction':_0x5536ff})[_0x118c('0x22')](function(){return db[_0x118c('0x112')][_0x118c('0x52')]({'where':{'id':{'$in':_0x2cd479}}});})[_0x118c('0x22')](function(_0x3d7929){var _0x286969=_[_0x118c('0x3a')](_0x3d7929,function(_0x5412ce){return _0x5412ce[_0x118c('0x116')]();});return Promise['all'](_0x286969);})['then'](function(_0x5be830){_0x44c136=_[_0x118c('0x117')](_0x5be830);var _0x5c3adb=_[_0x118c('0x3a')](_0x44c136,function(_0x2fe6c6){return _0x2fe6c6['addAgent'](_0x2e3b78['id'],{'transaction':_0x5536ff});});return Promise[_0x118c('0x8a')](_0x5c3adb);})[_0x118c('0x22')](function(){if(!_0x2e3b78[_0x118c('0x109')])return;var _0x4a94d8=_['filter'](_0x44c136,function(_0x57fe5a){return _0x57fe5a[_0x118c('0x118')](_0x118c('0xaf'))===_0x118c('0x119');});var _0x5dfc24=_['map'](_0x4a94d8,function(_0x27a68e){return db[_0x118c('0xad')][_0x118c('0xae')]({'membername':_0x2e3b78[_0x118c('0x3d')],'UserId':_0x2e3b78['id'],'queue_name':_0x27a68e[_0x118c('0x3d')],'VoiceQueueId':_0x27a68e['id'],'interface':_[_0x118c('0x68')](_0x2e3b78[_0x118c('0xa9')])?util[_0x118c('0xaa')](_0x118c('0xab'),_0x2e3b78[_0x118c('0x3d')]):_0x2e3b78[_0x118c('0xa9')],'paused':_0x2e3b78[_0x118c('0x9f')]||![],'penalty':_0x2e3b78['penalty']},{'transaction':_0x5536ff});});return Promise[_0x118c('0x8a')](_0x5dfc24);})['then'](function(){return db[_0x118c('0x11a')][_0x118c('0x52')]({'where':{'teamId':{'$in':_0x2cd479}}});})[_0x118c('0x22')](function(_0x51dfd5){var _0x3de49d=_[_0x118c('0x3a')](_0x51dfd5,function(_0x27e024){return db[_0x118c('0x11b')][_0x118c('0x7d')]({'UserId':_0x2e3b78['id'],'VoicePrefixId':_0x27e024[_0x118c('0x11c')]},{'transaction':_0x5536ff});});return Promise[_0x118c('0x8a')](_0x3de49d);});});})[_0x118c('0x22')](function(){for(var _0x2c0ff0=0x0;_0x2c0ff0<_0x44c136['length'];_0x2c0ff0++){var _0x47c466=_0x44c136[_0x2c0ff0][_0x118c('0x118')](_0x118c('0xaf'));var _0x569c27=_0x47c466+_0x118c('0xa6');socket[_0x118c('0x30')](_0x118c('0x36')+_0x47c466+'Queue:save',{'UserId':_0x38abf4,['queueField']:_0x44c136[_0x2c0ff0]['id']});}})[_0x118c('0x22')](respondWithStatusCode(_0x3947e2,null))[_0x118c('0x2c')](APIHandleError(_0x3947e2));};exports['removeTeams']=function(_0x53dd20,_0x52da0b){var _0x1111e5=_0x53dd20[_0x118c('0x5f')]['id'];var _0x387600=null;if(_0x53dd20[_0x118c('0x4b')]['ids']){_0x387600=_['isArray'](_0x53dd20[_0x118c('0x4b')][_0x118c('0x63')])?_0x53dd20[_0x118c('0x4b')]['ids']:[_0x53dd20[_0x118c('0x4b')][_0x118c('0x63')]];}var _0x5320d8=[];return Promise[_0x118c('0x11d')]()[_0x118c('0x22')](function(){if(!_0x387600)throw new APIBadRequestError(_0x118c('0x11e'));})[_0x118c('0x22')](function(){return db[_0x118c('0x40')][_0x118c('0x97')]({'where':{'id':_0x1111e5}});})[_0x118c('0x22')](function(_0x2d89fb){if(!_0x2d89fb)throw new APINotFoundError(util[_0x118c('0xaa')]('User\x20with\x20id\x20%s\x20not\x20found',_0x53dd20[_0x118c('0x5f')]['id']));return db[_0x118c('0x6a')][_0x118c('0x115')](function(_0x51d749){return _0x2d89fb[_0x118c('0x11f')](_0x387600,{'transaction':_0x51d749})[_0x118c('0x22')](function(){return db[_0x118c('0x112')][_0x118c('0x52')]({'where':{'id':{'$in':_0x387600}}});})[_0x118c('0x22')](function(_0x43ec3d){var _0x55f207=_[_0x118c('0x3a')](_0x43ec3d,function(_0x550cfc){return _0x550cfc[_0x118c('0x116')]();});return Promise[_0x118c('0x8a')](_0x55f207);})['then'](function(_0x5cf91f){_0x5320d8=_[_0x118c('0x117')](_0x5cf91f);var _0x578a73=_[_0x118c('0x3a')](_0x5320d8,function(_0x2aab8c){return _0x2aab8c[_0x118c('0x120')](_0x2d89fb['id'],{'transaction':_0x51d749});});return Promise[_0x118c('0x8a')](_0x578a73);})[_0x118c('0x22')](function(){if(!_0x2d89fb[_0x118c('0x109')])return;var _0xf3e849=_['filter'](_0x5320d8,function(_0x1cd948){return _0x1cd948[_0x118c('0x118')](_0x118c('0xaf'))===_0x118c('0x119');});var _0x30fcbc=_[_0x118c('0x3a')](_0xf3e849,function(_0x10f917){return db['UserVoiceQueueRt'][_0x118c('0x32')]({'where':{'VoiceQueueId':_0x10f917['id'],'UserId':_0x2d89fb['id']},'transaction':_0x51d749});});return Promise[_0x118c('0x8a')](_0x30fcbc);})[_0x118c('0x22')](function(){return db[_0x118c('0x11a')][_0x118c('0x52')]({'where':{'teamId':{'$in':_0x387600}}});})[_0x118c('0x22')](function(_0x3a36fa){var _0x2cf25c=_[_0x118c('0x3a')](_0x3a36fa,function(_0x52e4b6){return db[_0x118c('0x11b')]['destroy']({'where':{'UserId':_0x2d89fb['id'],'VoicePrefixId':_0x52e4b6['VoicePrefixId']}},{'transaction':_0x51d749});});return Promise[_0x118c('0x8a')](_0x2cf25c);});});})[_0x118c('0x22')](function(){for(var _0x1daea0=0x0;_0x1daea0<_0x5320d8[_0x118c('0x55')];_0x1daea0++){var _0x28fe06=_0x5320d8[_0x1daea0]['getDataValue'](_0x118c('0xaf'));var _0x3b8481=_0x28fe06+_0x118c('0xa6');socket[_0x118c('0x30')]('user'+_0x28fe06+_0x118c('0xb2'),{'UserId':_0x1111e5,['queueField']:_0x5320d8[_0x1daea0]['id']});}})[_0x118c('0x22')](respondWithStatusCode(_0x52da0b,null))[_0x118c('0x2c')](APIHandleError(_0x52da0b));};exports[_0x118c('0x121')]=function(_0x4cb9b9,_0x66f493){var _0xf6dbc6={};var _0x295bfc={};var _0x177eee;var _0x1b4321;return db['User'][_0x118c('0x97')]({'where':{'id':_0x4cb9b9['params']['id']}})[_0x118c('0x22')](handleEntityNotFound(_0x66f493,null))['then'](function(_0x3320ee){if(_0x3320ee){_0x177eee=_0x3320ee;_0x295bfc[_0x118c('0xce')]=_['keys'](db[_0x118c('0xc8')]['rawAttributes']);_0x295bfc[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x4cb9b9[_0x118c('0x4b')]);_0x295bfc[_0x118c('0xd1')]=_['intersection'](_0x295bfc[_0x118c('0xce')],_0x295bfc['query']);_0xf6dbc6['attributes']=_[_0x118c('0xd2')](_0x295bfc[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x4cb9b9[_0x118c('0x4b')]['fields']));_0xf6dbc6[_0x118c('0x50')]=_0xf6dbc6[_0x118c('0x50')]['length']?_0xf6dbc6[_0x118c('0x50')]:_0x295bfc['model'];_0xf6dbc6[_0x118c('0xd4')]=qs['sort'](_0x4cb9b9[_0x118c('0x4b')]['sort']);_0xf6dbc6[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_['pick'](_0x4cb9b9[_0x118c('0x4b')],_0x295bfc[_0x118c('0xd1')]));if(_0x4cb9b9[_0x118c('0x4b')][_0x118c('0x38')]){_0xf6dbc6[_0x118c('0x4a')]=_['merge'](_0xf6dbc6[_0x118c('0x4a')],{'$or':_['map'](_0xf6dbc6[_0x118c('0x50')],function(_0x10b34e){var _0x4cd906={};_0x4cd906[_0x10b34e]={'$like':'%'+_0x4cb9b9[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x4cd906;})});}_0xf6dbc6=_[_0x118c('0xd7')]({},_0xf6dbc6,_0x4cb9b9[_0x118c('0xd8')]);return _0x177eee['getLists'](_0xf6dbc6);}})[_0x118c('0x22')](function(_0x1fcf1a){if(_0x1fcf1a){_0x1b4321=_0x1fcf1a[_0x118c('0x55')];if(!_0x4cb9b9['query'][_0x118c('0xdb')](_0x118c('0xdc'))){_0xf6dbc6[_0x118c('0x1e')]=qs[_0x118c('0x1e')](_0x4cb9b9['query'][_0x118c('0x1e')]);_0xf6dbc6[_0x118c('0x1d')]=qs[_0x118c('0x1d')](_0x4cb9b9[_0x118c('0x4b')]['offset']);}return _0x177eee[_0x118c('0x121')](_0xf6dbc6);}})[_0x118c('0x22')](function(_0x5ec49f){if(_0x5ec49f){return _0x5ec49f?{'count':_0x1b4321,'rows':_0x5ec49f}:null;}})[_0x118c('0x22')](respondWithResult(_0x66f493,null))['catch'](handleError(_0x66f493,null));};exports[_0x118c('0x122')]=function(_0x33557c,_0xe31c70){var _0x1c04e4={};var _0x3517ed={};var _0x899f0b;return db[_0x118c('0x40')]['findOne']({'where':{'id':_0x33557c[_0x118c('0x5f')]['id']}})[_0x118c('0x22')](handleEntityNotFound(_0xe31c70,null))['then'](function(_0xef2050){if(_0xef2050){_0x899f0b=_0xef2050;_0x3517ed[_0x118c('0xce')]=_[_0x118c('0xcf')](db['User'][_0x118c('0xd0')]);_0x3517ed[_0x118c('0x4b')]=_[_0x118c('0xcf')](_0x33557c['query']);_0x3517ed[_0x118c('0xd1')]=_[_0x118c('0xd2')](_0x3517ed[_0x118c('0xce')],_0x3517ed[_0x118c('0x4b')]);_0x1c04e4['attributes']=_[_0x118c('0xd2')](_0x3517ed[_0x118c('0xce')],qs[_0x118c('0xd3')](_0x33557c[_0x118c('0x4b')]['fields']));_0x1c04e4[_0x118c('0x50')]=_0x1c04e4[_0x118c('0x50')][_0x118c('0x55')]?_0x1c04e4[_0x118c('0x50')]:_0x3517ed[_0x118c('0xce')];_0x1c04e4[_0x118c('0xd4')]=qs[_0x118c('0xd5')](_0x33557c[_0x118c('0x4b')][_0x118c('0xd5')]);_0x1c04e4[_0x118c('0x4a')]=qs[_0x118c('0xd1')](_[_0x118c('0xd6')](_0x33557c[_0x118c('0x4b')],_0x3517ed[_0x118c('0xd1')]));if(_0x33557c['query'][_0x118c('0x38')]){_0x1c04e4['where']=_[_0x118c('0xd7')](_0x1c04e4['where'],{'$or':_[_0x118c('0x3a')](_0x1c04e4['attributes'],function(_0x55d027){var _0x21853a={};_0x21853a[_0x55d027]={'$like':'%'+_0x33557c[_0x118c('0x4b')][_0x118c('0x38')]+'%'};return _0x21853a;})});}_0x1c04e4[_0x118c('0xce')]=db[_0x118c('0x40')];_0x1c04e4['as']=_0x118c('0x37');_0x1c04e4=_[_0x118c('0xd7')]({},_0x1c04e4,_0x33557c[_0x118c('0xd8')]);return _0x899f0b[_0x118c('0xf7')]({'include':[_0x1c04e4]});}})['then'](function(_0x18f50d){if(_0x18f50d){var _0xdf6c38={},_0x447e3f=[];for(var _0x2752bc=0x0;_0x2752bc<_0x18f50d[_0x118c('0x55')];_0x2752bc+=0x1){for(var _0x597c59=0x0,_0x3b7da8;_0x597c59<_0x18f50d[_0x2752bc][_0x118c('0x37')][_0x118c('0x55')];_0x597c59+=0x1){_0x3b7da8=_0x18f50d[_0x2752bc]['Agents'][_0x597c59][_0x118c('0x33')]({'plain':!![]});_0xdf6c38[_0x3b7da8['id']]=_0x3b7da8;}}_0xdf6c38=_[_0x118c('0x123')](_0xdf6c38);for(var _0x471dd3=qs[_0x118c('0x1d')](_0x33557c[_0x118c('0x4b')][_0x118c('0x1d')]);_0x471dd3<_0xdf6c38[_0x118c('0x55')]&&_0x447e3f[_0x118c('0x55')]=_0x2b395a[_0x06f2('0x4b')]){throw new Error(_0x06f2('0x4c'));}})['then'](function(){if(_0x32a947){return db[_0x06f2('0x40')][_0x06f2('0x41')]({'where':{'membername':_0x32a947[_0x06f2('0x20')]},'individualHooks':!![]});}})['then'](function(){if(_0x32a947){return _0x32a947[_0x06f2('0x4d')]({'raw':!![]});}})[_0x06f2('0x16')](function(_0x53ba11){if(_0x32a947){if(_0x53ba11){var _0x524d54=[];_0xb51d1=_0x53ba11;if(_0xb51d1[_0x06f2('0x26')]){for(var _0x459405=0x0;_0x459405<_0xb51d1[_0x06f2('0x26')];_0x459405++){_0x524d54[_0x06f2('0x42')](db[_0x06f2('0x40')][_0x06f2('0x4e')]({'membername':_0x32a947[_0x06f2('0x20')],'UserId':_0x32a947['id'],'queue_name':_0xb51d1[_0x459405][_0x06f2('0x20')],'VoiceQueueId':_0xb51d1[_0x459405]['id'],'interface':_0x1503d5,'paused':_0x32a947['loginInPause']||![],'penalty':_0xb51d1[_0x459405][_0x06f2('0x4f')]||0x0}));}return BPromise[_0x06f2('0x43')](_0x524d54);}}}})['then'](function(){if(_0x32a947){return db['MemberReport'][_0x06f2('0xe')]({'where':{'membername':_0x32a947['name'],'exitAt':null}});}})[_0x06f2('0x16')](function(_0x2ff9c2){if(_0x32a947){if(_0x2ff9c2&&_0x2ff9c2[_0x06f2('0x26')]){var _0xe4cbfd=[];_0x2ff9c2[_0x06f2('0x50')](function(_0x2b00d2){_0xe4cbfd['push'](_0x2b00d2[_0x06f2('0x2f')]({'exitAt':moment()[_0x06f2('0x23')](_0x06f2('0x27'))}));});return BPromise[_0x06f2('0x43')](_0xe4cbfd);}}})[_0x06f2('0x16')](function(){if(_0x32a947){var _0x2d8846=[];var _0x48b14d=[];var _0x208ec8=utils[_0x06f2('0x51')]();var _0x57b14f={'membername':_0x32a947[_0x06f2('0x20')],'interface':_0x1503d5,'enterAt':moment()[_0x06f2('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x32a947['role'],'internal':_0x32a947[_0x06f2('0x21')]};_0x208ec8[_0x06f2('0x50')](function(_0x467d28){_0x2d8846[_0x06f2('0x42')](_[_0x06f2('0x52')]({'channel':_0x467d28,'type':_0x06f2('0x53'),'data1':'callysquare','data2':_0x1503d5},_0x57b14f));if(_0x32a947[_0x06f2('0x54')]){_0x48b14d[_0x06f2('0x42')](_[_0x06f2('0x52')]({'channel':_0x467d28,'type':_0x06f2('0x2a'),'data1':_0x06f2('0x55')},_0x57b14f));}});return db[_0x06f2('0x25')][_0x06f2('0x2e')](_0x2d8846[_0x06f2('0x56')](_0x48b14d),{'individualHooks':!![]});}})[_0x06f2('0x16')](function(){if(_0x32a947){return _0x32a947[_0x06f2('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x06f2('0x23')](_0x06f2('0x27')),'voicePause':_0x32a947[_0x06f2('0x54')]||![],'mailPause':_0x32a947[_0x06f2('0x54')]||![],'chatPause':_0x32a947[_0x06f2('0x54')]||![],'faxPause':_0x32a947['loginInPause']||![],'smsPause':_0x32a947[_0x06f2('0x54')]||![],'openchannelPause':_0x32a947[_0x06f2('0x54')]||![],'pauseType':_0x32a947[_0x06f2('0x54')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x06f2('0x23')](_0x06f2('0x27')),'interface':_0x1503d5});}})[_0x06f2('0x16')](function(_0x1586a7){_0x5bfbe6(_0x1586a7);})['catch'](function(_0x2df406){_0x1b7469(_0x378229[_0x06f2('0x1c')](0x1f4,_0x2df406[_0x06f2('0x1b')]));});});}; \ No newline at end of file +var _0xae0b=['Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','callysquare','concat','LOGININPAUSE','lodash','util','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','User','findAll','options','raw','map','include','model','attributes','then','info','GetUser','debug','stringify','catch','message','error','ShowUser','find','where','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','type','MemberReport','bulkCreate','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','faxPause','whatsappPause','pauseType','lastPauseAt','unpause','system','destroy','push','all','LoginUser','loginInPause','count','../../config/license/util','getLicense','agents'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xae0b,0xac));var _0xbae0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae0b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbae0('0x0'));var util=require(_0xbae0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbae0('0x2'));var logger=require(_0xbae0('0x3'))(_0xbae0('0x4'));var config=require(_0xbae0('0x5'));config[_0xbae0('0x6')]=_[_0xbae0('0x7')](config['redis'],{'host':_0xbae0('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbae0('0x6')]));require('./user.socket')['register'](socket);exports['GetUser']=function(_0x596a78){var _0x437e55=this;return new Promise(function(_0x37c7ff,_0x368b16){return db[_0xbae0('0x9')][_0xbae0('0xa')]({'raw':_0x596a78[_0xbae0('0xb')]?_0x596a78[_0xbae0('0xb')][_0xbae0('0xc')]===undefined?!![]:![]:!![],'where':_0x596a78['options']?_0x596a78[_0xbae0('0xb')]['where']||null:null,'attributes':_0x596a78[_0xbae0('0xb')]?_0x596a78[_0xbae0('0xb')]['attributes']||null:null,'limit':_0x596a78[_0xbae0('0xb')]?_0x596a78[_0xbae0('0xb')]['limit']||null:null,'include':_0x596a78[_0xbae0('0xb')]?_0x596a78[_0xbae0('0xb')]['include']?_[_0xbae0('0xd')](_0x596a78[_0xbae0('0xb')][_0xbae0('0xe')],function(_0x22201c){return{'model':db[_0x22201c['model']],'as':_0x22201c['as'],'attributes':_0x22201c['attributes'],'include':_0x22201c['include']?_[_0xbae0('0xd')](_0x22201c['include'],function(_0xf2e689){return{'model':db[_0xf2e689[_0xbae0('0xf')]],'as':_0xf2e689['as'],'attributes':_0xf2e689[_0xbae0('0x10')],'include':_0xf2e689['include']?_[_0xbae0('0xd')](_0xf2e689[_0xbae0('0xe')],function(_0x2b8130){return{'model':db[_0x2b8130['model']],'as':_0x2b8130['as'],'attributes':_0x2b8130[_0xbae0('0x10')]};}):[]};}):[]};}):[]:[]})[_0xbae0('0x11')](function(_0x4c67fc){logger[_0xbae0('0x12')](_0xbae0('0x13'),_0x596a78);logger[_0xbae0('0x14')]('GetUser',_0x596a78,JSON[_0xbae0('0x15')](_0x4c67fc));_0x37c7ff(_0x4c67fc);})[_0xbae0('0x16')](function(_0x249488){logger['error'](_0xbae0('0x13'),_0x249488[_0xbae0('0x17')],_0x596a78);_0x368b16(_0x437e55[_0xbae0('0x18')](0x1f4,_0x249488[_0xbae0('0x17')]));});});};exports[_0xbae0('0x19')]=function(_0x3f398f){var _0x3ed813=this;return new Promise(function(_0x2aa621,_0x4ffdfb){return db[_0xbae0('0x9')][_0xbae0('0x1a')]({'raw':_0x3f398f[_0xbae0('0xb')]?_0x3f398f[_0xbae0('0xb')][_0xbae0('0xc')]===undefined?!![]:![]:!![],'where':_0x3f398f[_0xbae0('0xb')]?_0x3f398f[_0xbae0('0xb')][_0xbae0('0x1b')]||null:null,'attributes':_0x3f398f['options']?_0x3f398f[_0xbae0('0xb')]['attributes']||null:null,'include':_0x3f398f[_0xbae0('0xb')]?_0x3f398f[_0xbae0('0xb')][_0xbae0('0xe')]?_[_0xbae0('0xd')](_0x3f398f['options'][_0xbae0('0xe')],function(_0x187d9b){return{'model':db[_0x187d9b[_0xbae0('0xf')]],'as':_0x187d9b['as'],'attributes':_0x187d9b['attributes'],'include':_0x187d9b['include']?_[_0xbae0('0xd')](_0x187d9b[_0xbae0('0xe')],function(_0x50ef31){return{'model':db[_0x50ef31['model']],'as':_0x50ef31['as'],'attributes':_0x50ef31['attributes'],'include':_0x50ef31[_0xbae0('0xe')]?_['map'](_0x50ef31[_0xbae0('0xe')],function(_0x500c97){return{'model':db[_0x500c97['model']],'as':_0x500c97['as'],'attributes':_0x500c97['attributes']};}):[]};}):[]};}):[]:[]})[_0xbae0('0x11')](function(_0x55776c){logger[_0xbae0('0x12')](_0xbae0('0x19'),_0x3f398f);logger['debug'](_0xbae0('0x19'),_0x3f398f,JSON[_0xbae0('0x15')](_0x55776c));_0x2aa621(_0x55776c);})[_0xbae0('0x16')](function(_0x2db583){logger[_0xbae0('0x18')](_0xbae0('0x19'),_0x2db583['message'],_0x3f398f);_0x4ffdfb(_0x3ed813[_0xbae0('0x18')](0x1f4,_0x2db583[_0xbae0('0x17')]));});});};exports[_0xbae0('0x1c')]=function(_0x26a18e){var _0x27054b;return db[_0xbae0('0x9')][_0xbae0('0x1a')]({'where':_0x26a18e['options'][_0xbae0('0x1b')]||{},'attributes':['id',_0xbae0('0x1d'),_0xbae0('0x1e'),_0xbae0('0x1f'),_0xbae0('0x20')]})[_0xbae0('0x11')](function(_0x2d9448){if(!_0x2d9448){throw new Error(util[_0xbae0('0x21')](_0xbae0('0x22'),_0x26a18e[_0xbae0('0x23')]['id']));}_0x27054b=_0x2d9448;return db[_0xbae0('0x24')][_0xbae0('0x25')]({'paused':0x1},{'where':{'UserId':_0x27054b['id']},'individualHooks':!![]});})[_0xbae0('0x11')](function(){return db['MemberReport'][_0xbae0('0xa')]({'where':{'membername':_0x27054b[_0xbae0('0x1d')],'type':_0xbae0('0x26'),'exitAt':null}});})['then'](function(_0x1fcc41){if(_0x1fcc41&&_0x1fcc41[_0xbae0('0x27')]){var _0xdad89c=moment()[_0xbae0('0x21')](_0xbae0('0x28'));for(var _0x8afc2b=0x0,_0x1e4f35=_0x1fcc41['length'];_0x8afc2b<_0x1e4f35;_0x8afc2b++){_0x1fcc41[_0x8afc2b][_0xbae0('0x29')]({'exitAt':_0xdad89c});}}})[_0xbae0('0x11')](function(){var _0x3c83a4=[];var _0x3565ef=utils[_0xbae0('0x2a')]();_0x3565ef[_0xbae0('0x2b')](function(_0x514421){_0x3c83a4['push']({'channel':_0x514421,'membername':_0x27054b[_0xbae0('0x1d')],'interface':_[_0xbae0('0x2c')](_0x27054b['interface'])?util[_0xbae0('0x21')](_0xbae0('0x2d'),_0x27054b['name']):_0x27054b[_0xbae0('0x20')],'type':_0xbae0('0x26'),'enterAt':moment()[_0xbae0('0x21')](_0xbae0('0x28')),'data1':_0x26a18e[_0xbae0('0x2e')][_0xbae0('0x2f')]||'DEFAULT\x20PAUSE','role':_0x27054b[_0xbae0('0x1e')],'internal':_0x27054b['internal'],'uniqueid':_0x26a18e[_0xbae0('0x2e')]['uniqueid']||null});});return db[_0xbae0('0x30')][_0xbae0('0x31')](_0x3c83a4,{'individualHooks':!![]});})[_0xbae0('0x11')](function(){return _0x27054b[_0xbae0('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x26a18e[_0xbae0('0x2e')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xbae0('0x21')](_0xbae0('0x28'))});})['catch'](function(_0x151e29){throw _0x151e29;});};exports[_0xbae0('0x32')]=function(_0x159b4e){return Promise[_0xbae0('0x33')]()['then'](function(){if(_0x159b4e[_0xbae0('0x2e')][_0xbae0('0x34')]&&!utils[_0xbae0('0x35')](_0x159b4e[_0xbae0('0x2e')]['channel'])){throw new Error(util[_0xbae0('0x21')](_0xbae0('0x36'),_0x159b4e[_0xbae0('0x2e')][_0xbae0('0x34')]));}return db[_0xbae0('0x9')][_0xbae0('0x37')]({'where':_0x159b4e['options'][_0xbae0('0x1b')]||{},'attributes':['id',_0xbae0('0x1d'),_0xbae0('0x1e'),_0xbae0('0x1f'),_0xbae0('0x20'),_0xbae0('0x38'),_0xbae0('0x39'),'mailPause',_0xbae0('0x3a'),_0xbae0('0x3b'),'openchannelPause','smsPause',_0xbae0('0x3c'),_0xbae0('0x3d'),_0xbae0('0x3e')]});})['then'](function(_0x327ae4){if(!_0x327ae4){throw new Error(util[_0xbae0('0x21')]('User\x20with\x20id\x20%s\x20not\x20found',_0x159b4e[_0xbae0('0x23')]['id']));}return _0x327ae4[_0xbae0('0x3f')](_0x159b4e['body'][_0xbae0('0x34')],_0xbae0('0x40'));})[_0xbae0('0x16')](function(_0x324347){throw _0x324347;});};exports['LogoutUser']=function(_0x532d11){var _0x15882e=this;return new Promise(function(_0x5c383f,_0x39a4b0){var _0x23eb0c;return db['User'][_0xbae0('0x37')]({'where':_0x532d11['options'][_0xbae0('0x1b')]||{},'attributes':['id',_0xbae0('0x1d')]})[_0xbae0('0x11')](function(_0x4f7912){if(_0x4f7912){_0x23eb0c=_0x4f7912;return db[_0xbae0('0x24')][_0xbae0('0x41')]({'where':{'membername':_0x23eb0c['name']},'individualHooks':!![]});}})[_0xbae0('0x11')](function(){if(_0x23eb0c){return db[_0xbae0('0x30')][_0xbae0('0xa')]({'where':{'membername':_0x23eb0c[_0xbae0('0x1d')],'exitAt':null}});}})['then'](function(_0x220487){if(_0x23eb0c){if(_0x220487&&_0x220487[_0xbae0('0x27')]){var _0xfcc4dd=[];_0x220487['forEach'](function(_0x130b21){_0xfcc4dd[_0xbae0('0x42')](_0x130b21[_0xbae0('0x25')]({'exitAt':moment()[_0xbae0('0x21')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbae0('0x43')](_0xfcc4dd);}}})[_0xbae0('0x11')](function(){if(_0x23eb0c){return _0x23eb0c[_0xbae0('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbae0('0x11')](function(_0x5261f9){_0x5c383f(_0x5261f9);})['catch'](function(_0x43b551){_0x39a4b0(_0x15882e[_0xbae0('0x18')](0x1f4,_0x43b551[_0xbae0('0x17')]));});});};exports[_0xbae0('0x44')]=function(_0x1a2610){var _0x587db8=this;return new Promise(function(_0x27aee1,_0xff7df4){var _0x2a09a0;var _0x46ab0e;var _0x553bc7;var _0x5f18ca;return db['User']['findOne']({'where':_0x1a2610[_0xbae0('0xb')][_0xbae0('0x1b')]||{},'attributes':['id',_0xbae0('0x1d'),'role','mobile','phone',_0xbae0('0x1f'),_0xbae0('0x45'),_0xbae0('0x20')]})[_0xbae0('0x11')](function(_0x45ac92){if(_0x45ac92){_0x2a09a0=_0x45ac92;_0x5f18ca=_0x1a2610['body']['interface']?_0x1a2610['body'][_0xbae0('0x20')]:util[_0xbae0('0x21')](_0xbae0('0x2d'),_0x2a09a0[_0xbae0('0x1d')]);return db['User'][_0xbae0('0x46')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x2a09a0['id']}}});}})[_0xbae0('0x11')](function(_0x55b023){if(_0x55b023){_0x553bc7=_0x55b023;return require(_0xbae0('0x47'))[_0xbae0('0x48')]();}})['then'](function(_0x29ae2a){if(_0x29ae2a&&_0x29ae2a[_0xbae0('0x49')]&&_0x553bc7>=_0x29ae2a[_0xbae0('0x49')]){throw new Error(_0xbae0('0x4a'));}})[_0xbae0('0x11')](function(){if(_0x2a09a0){return db[_0xbae0('0x24')][_0xbae0('0x41')]({'where':{'membername':_0x2a09a0[_0xbae0('0x1d')]},'individualHooks':!![]});}})[_0xbae0('0x11')](function(){if(_0x2a09a0){return _0x2a09a0[_0xbae0('0x4b')]({'raw':!![]});}})[_0xbae0('0x11')](function(_0x18b58e){if(_0x2a09a0){if(_0x18b58e){var _0x5cda97=[];_0x46ab0e=_0x18b58e;if(_0x46ab0e[_0xbae0('0x27')]){for(var _0x1a8074=0x0;_0x1a8074<_0x46ab0e['length'];_0x1a8074++){_0x5cda97['push'](db[_0xbae0('0x24')][_0xbae0('0x4c')]({'membername':_0x2a09a0[_0xbae0('0x1d')],'UserId':_0x2a09a0['id'],'queue_name':_0x46ab0e[_0x1a8074][_0xbae0('0x1d')],'VoiceQueueId':_0x46ab0e[_0x1a8074]['id'],'interface':_0x5f18ca,'paused':_0x2a09a0['loginInPause']||![],'penalty':_0x46ab0e[_0x1a8074][_0xbae0('0x4d')]||0x0}));}return BPromise[_0xbae0('0x43')](_0x5cda97);}}}})[_0xbae0('0x11')](function(){if(_0x2a09a0){return db[_0xbae0('0x30')][_0xbae0('0xa')]({'where':{'membername':_0x2a09a0[_0xbae0('0x1d')],'exitAt':null}});}})[_0xbae0('0x11')](function(_0x3c9e7c){if(_0x2a09a0){if(_0x3c9e7c&&_0x3c9e7c[_0xbae0('0x27')]){var _0x4bf5d3=[];_0x3c9e7c[_0xbae0('0x2b')](function(_0x2a87dc){_0x4bf5d3[_0xbae0('0x42')](_0x2a87dc[_0xbae0('0x25')]({'exitAt':moment()[_0xbae0('0x21')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbae0('0x43')](_0x4bf5d3);}}})[_0xbae0('0x11')](function(){if(_0x2a09a0){var _0x38e955=[];var _0x191575=[];var _0x5521b6=utils[_0xbae0('0x2a')]();var _0x220f99={'membername':_0x2a09a0[_0xbae0('0x1d')],'interface':_0x5f18ca,'enterAt':moment()[_0xbae0('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2a09a0[_0xbae0('0x1e')],'internal':_0x2a09a0[_0xbae0('0x1f')]};_0x5521b6[_0xbae0('0x2b')](function(_0x1e2793){_0x38e955[_0xbae0('0x42')](_[_0xbae0('0x4e')]({'channel':_0x1e2793,'type':'LOGIN','data1':_0xbae0('0x4f'),'data2':_0x5f18ca},_0x220f99));if(_0x2a09a0['loginInPause']){_0x191575[_0xbae0('0x42')](_[_0xbae0('0x4e')]({'channel':_0x1e2793,'type':'PAUSE','data1':'LOGININPAUSE'},_0x220f99));}});return db[_0xbae0('0x30')]['bulkCreate'](_0x38e955[_0xbae0('0x50')](_0x191575),{'individualHooks':!![]});}})[_0xbae0('0x11')](function(){if(_0x2a09a0){return _0x2a09a0[_0xbae0('0x25')]({'online':!![],'lastLoginAt':moment()[_0xbae0('0x21')](_0xbae0('0x28')),'voicePause':_0x2a09a0[_0xbae0('0x45')]||![],'mailPause':_0x2a09a0[_0xbae0('0x45')]||![],'chatPause':_0x2a09a0[_0xbae0('0x45')]||![],'faxPause':_0x2a09a0[_0xbae0('0x45')]||![],'smsPause':_0x2a09a0[_0xbae0('0x45')]||![],'openchannelPause':_0x2a09a0['loginInPause']||![],'pauseType':_0x2a09a0[_0xbae0('0x45')]?_0xbae0('0x51'):null,'lastPauseAt':moment()[_0xbae0('0x21')](_0xbae0('0x28')),'interface':_0x5f18ca});}})['then'](function(_0x3b60ca){_0x27aee1(_0x3b60ca);})['catch'](function(_0x123214){_0xff7df4(_0x587db8[_0xbae0('0x18')](0x1f4,_0x123214['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index dfc4543..223dd19 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 _0x2728=['length','user:','./user.events','save','remove','update','emit','register'];(function(_0x3ee2a8,_0x4b102c){var _0x3863df=function(_0x339cdf){while(--_0x339cdf){_0x3ee2a8['push'](_0x3ee2a8['shift']());}};_0x3863df(++_0x4b102c);}(_0x2728,0x16a));var _0x8272=function(_0x4c9c81,_0x155e2f){_0x4c9c81=_0x4c9c81-0x0;var _0x27788f=_0x2728[_0x4c9c81];return _0x27788f;};'use strict';var UserEvents=require(_0x8272('0x0'));var events=[_0x8272('0x1'),_0x8272('0x2'),_0x8272('0x3')];function createListener(_0x50caed,_0x276bae){return function(_0x3ed61c){_0x276bae[_0x8272('0x4')](_0x50caed,_0x3ed61c);};}function removeListener(_0x4b603d,_0x21ea65){return function(){UserEvents['removeListener'](_0x4b603d,_0x21ea65);};}exports[_0x8272('0x5')]=function(_0x278e74){for(var _0x2c2eb4=0x0,_0x117168=events[_0x8272('0x6')];_0x2c2eb4<_0x117168;_0x2c2eb4++){var _0x3a3b20=events[_0x2c2eb4];var _0x68edc0=createListener(_0x8272('0x7')+_0x3a3b20,_0x278e74);UserEvents['on'](_0x3a3b20,_0x68edc0);}}; \ No newline at end of file +var _0xb6bd=['update','emit','removeListener','register','./user.events','save'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xb6bd,0x13c));var _0xdb6b=function(_0x274cef,_0x1c529d){_0x274cef=_0x274cef-0x0;var _0x3bf81a=_0xb6bd[_0x274cef];return _0x3bf81a;};'use strict';var UserEvents=require(_0xdb6b('0x0'));var events=[_0xdb6b('0x1'),'remove',_0xdb6b('0x2')];function createListener(_0x55cb03,_0x1cea8b){return function(_0x2418c8){_0x1cea8b[_0xdb6b('0x3')](_0x55cb03,_0x2418c8);};}function removeListener(_0x1ae9f8,_0x4b887d){return function(){UserEvents[_0xdb6b('0x4')](_0x1ae9f8,_0x4b887d);};}exports[_0xdb6b('0x5')]=function(_0x1ad4cf){for(var _0x830c41=0x0,_0x106ea3=events['length'];_0x830c41<_0x106ea3;_0x830c41++){var _0x4600ae=events[_0x830c41];var _0x303751=createListener('user:'+_0x4600ae,_0x1ad4cf);UserEvents['on'](_0x4600ae,_0x303751);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 5db3942..3694f42 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1e257e,_0x1f952d){var _0x1342d8=function(_0x8fef21){while(--_0x8fef21){_0x1e257e['push'](_0x1e257e['shift']());}};_0x1342d8(++_0x1f952d);}(_0x70e0,0x17b));var _0x070e=function(_0xaf5a52,_0x4dc091){_0xaf5a52=_0xaf5a52-0x0;var _0x4af0a9=_0x70e0[_0xaf5a52];return _0x4af0a9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x275720,_0x2310a9){var _0x80fcaa=function(_0xa8e40a){while(--_0xa8e40a){_0x275720['push'](_0x275720['shift']());}};_0x80fcaa(++_0x2310a9);}(_0xedd9,0xfc));var _0x9edd=function(_0x2992cb,_0x102ca6){_0x2992cb=_0x2992cb-0x0;var _0x499699=_0xedd9[_0x2992cb];return _0x499699;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a6e043e..9006424 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 _0x9e75=['exports','sequelize'];(function(_0x2f7e22,_0x213a1f){var _0x473fc1=function(_0x133f60){while(--_0x133f60){_0x2f7e22['push'](_0x2f7e22['shift']());}};_0x473fc1(++_0x213a1f);}(_0x9e75,0xb5));var _0x59e7=function(_0x1f4a56,_0x56cfe3){_0x1f4a56=_0x1f4a56-0x0;var _0xb048b=_0x9e75[_0x1f4a56];return _0xb048b;};'use strict';var Sequelize=require(_0x59e7('0x0'));module[_0x59e7('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 935eba6..8749849 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 _0x4576=['../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','rimraf'];(function(_0xacd405,_0x2217bb){var _0x57611c=function(_0x10db85){while(--_0x10db85){_0xacd405['push'](_0xacd405['shift']());}};_0x57611c(++_0x2217bb);}(_0x4576,0x7e));var _0x6457=function(_0x376abf,_0xe1a6de){_0x376abf=_0x376abf-0x0;var _0xb3d35d=_0x4576[_0x376abf];return _0xb3d35d;};'use strict';var _=require(_0x6457('0x0'));var util=require(_0x6457('0x1'));var logger=require(_0x6457('0x2'))(_0x6457('0x3'));var moment=require(_0x6457('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6457('0x5'));var config=require(_0x6457('0x6'));var attributes=require(_0x6457('0x7'));module[_0x6457('0x8')]=function(_0x1e4d09,_0x17d4bf){return _0x1e4d09[_0x6457('0x9')](_0x6457('0xa'),attributes,{'tableName':_0x6457('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ee=['../../config/environment','UserChatQueue','user_has_chat_queues','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x90ee,0x1f2));var _0xe90e=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x90ee[_0x151418];return _0x40e29a;};'use strict';var _=require('lodash');var util=require(_0xe90e('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe90e('0x1'));var BPromise=require(_0xe90e('0x2'));var rp=require(_0xe90e('0x3'));var fs=require('fs');var path=require(_0xe90e('0x4'));var rimraf=require(_0xe90e('0x5'));var config=require(_0xe90e('0x6'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x1fb498,_0x7dca4){return _0x1fb498['define'](_0xe90e('0x7'),attributes,{'tableName':_0xe90e('0x8'),'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 81e469a..9dbc396 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 _0xf6ff=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis'];(function(_0x3ffd69,_0x5038ae){var _0x5113ce=function(_0x452095){while(--_0x452095){_0x3ffd69['push'](_0x3ffd69['shift']());}};_0x5113ce(++_0x5038ae);}(_0xf6ff,0xba));var _0xff6f=function(_0xa6d7a,_0x1b9afc){_0xa6d7a=_0xa6d7a-0x0;var _0xbf0a0=_0xf6ff[_0xa6d7a];return _0xbf0a0;};'use strict';var _=require(_0xff6f('0x0'));var util=require('util');var moment=require(_0xff6f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff6f('0x2'));var db=require(_0xff6f('0x3'))['db'];var utils=require(_0xff6f('0x4'));var logger=require(_0xff6f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xff6f('0x6'));var client=jayson[_0xff6f('0x7')][_0xff6f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3684de,_0x3feece,_0x5d0560){return new BPromise(function(_0x3077ab,_0x3f55b9){return client['request'](_0x3684de,_0x5d0560)[_0xff6f('0x9')](function(_0x4b7d92){logger[_0xff6f('0xa')](_0xff6f('0xb'),_0x3feece,_0xff6f('0xc'));logger[_0xff6f('0xd')](_0xff6f('0xe'),_0x3feece,'request\x20sent',JSON[_0xff6f('0xf')](_0x4b7d92));if(_0x4b7d92['error']){if(_0x4b7d92[_0xff6f('0x10')][_0xff6f('0x11')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3feece,_0x4b7d92[_0xff6f('0x10')][_0xff6f('0x12')]);return _0x3f55b9(_0x4b7d92[_0xff6f('0x10')][_0xff6f('0x12')]);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3feece,_0x4b7d92['error']['message']);return _0x3077ab(_0x4b7d92[_0xff6f('0x10')]['message']);}else{logger[_0xff6f('0xa')](_0xff6f('0xb'),_0x3feece,'request\x20sent');_0x3077ab(_0x4b7d92[_0xff6f('0x13')][_0xff6f('0x12')]);}})[_0xff6f('0x14')](function(_0x5aa555){logger['error'](_0xff6f('0xb'),_0x3feece,_0x5aa555);_0x3f55b9(_0x5aa555);});});} \ No newline at end of file +var _0x848a=['info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0xd1a252,_0x16396f){var _0x560ee1=function(_0x35dd90){while(--_0x35dd90){_0xd1a252['push'](_0xd1a252['shift']());}};_0x560ee1(++_0x16396f);}(_0x848a,0x66));var _0xa848=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0x848a[_0x401676];return _0x4f13fe;};'use strict';var _=require(_0xa848('0x0'));var util=require(_0xa848('0x1'));var moment=require('moment');var BPromise=require(_0xa848('0x2'));var rs=require(_0xa848('0x3'));var fs=require('fs');var Redis=require(_0xa848('0x4'));var db=require(_0xa848('0x5'))['db'];var utils=require(_0xa848('0x6'));var logger=require(_0xa848('0x7'))(_0xa848('0x8'));var config=require(_0xa848('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa848('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd93f31,_0x308bf9,_0x469469){return new BPromise(function(_0x5742f2,_0x4fdbab){return client[_0xa848('0xb')](_0xd93f31,_0x469469)[_0xa848('0xc')](function(_0x14d832){logger[_0xa848('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x308bf9,_0xa848('0xe'));logger[_0xa848('0xf')](_0xa848('0x10'),_0x308bf9,_0xa848('0xe'),JSON[_0xa848('0x11')](_0x14d832));if(_0x14d832['error']){if(_0x14d832[_0xa848('0x12')]['code']===0x1f4){logger[_0xa848('0x12')](_0xa848('0x13'),_0x308bf9,_0x14d832[_0xa848('0x12')][_0xa848('0x14')]);return _0x4fdbab(_0x14d832[_0xa848('0x12')][_0xa848('0x14')]);}logger[_0xa848('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x308bf9,_0x14d832['error']['message']);return _0x5742f2(_0x14d832[_0xa848('0x12')]['message']);}else{logger['info'](_0xa848('0x13'),_0x308bf9,_0xa848('0xe'));_0x5742f2(_0x14d832[_0xa848('0x15')][_0xa848('0x14')]);}})[_0xa848('0x16')](function(_0x1cf0b9){logger[_0xa848('0x12')](_0xa848('0x13'),_0x308bf9,_0x1cf0b9);_0x4fdbab(_0x1cf0b9);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f7d87e5..8b9a894 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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(_0x3b2dce,_0x439b8b){var _0x51ff0d=function(_0x49a398){while(--_0x49a398){_0x3b2dce['push'](_0x3b2dce['shift']());}};_0x51ff0d(++_0x439b8b);}(_0x70e0,0x17b));var _0x070e=function(_0x5a97df,_0x52beb0){_0x5a97df=_0x5a97df-0x0;var _0x1a9944=_0x70e0[_0x5a97df];return _0x1a9944;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 0819f25..20c9a72 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 _0x51da=['sequelize','exports','INTEGER','STRING'];(function(_0x422d5e,_0x3f44c7){var _0x5a4c48=function(_0x331294){while(--_0x331294){_0x422d5e['push'](_0x422d5e['shift']());}};_0x5a4c48(++_0x3f44c7);}(_0x51da,0x124));var _0xa51d=function(_0x1a9d39,_0x2023d9){_0x1a9d39=_0x1a9d39-0x0;var _0x40a4e8=_0x51da[_0x1a9d39];return _0x40a4e8;};'use strict';var Sequelize=require(_0xa51d('0x0'));module[_0xa51d('0x1')]={'penalty':{'type':Sequelize[_0xa51d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xa51d('0x3')]}}; \ No newline at end of file +var _0x4791=['sequelize','exports','INTEGER','STRING'];(function(_0x4eb747,_0x2a8d80){var _0x166652=function(_0x57854c){while(--_0x57854c){_0x4eb747['push'](_0x4eb747['shift']());}};_0x166652(++_0x2a8d80);}(_0x4791,0x13c));var _0x1479=function(_0x385467,_0x298239){_0x385467=_0x385467-0x0;var _0x5ed67e=_0x4791[_0x385467];return _0x5ed67e;};'use strict';var Sequelize=require(_0x1479('0x0'));module[_0x1479('0x1')]={'penalty':{'type':Sequelize[_0x1479('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1479('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x1479('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index df18d2b..7352f23 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 _0xf818=['../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','util','api','bluebird','path','rimraf'];(function(_0x1c5741,_0x1f7ab8){var _0x1988f1=function(_0x3bd9d1){while(--_0x3bd9d1){_0x1c5741['push'](_0x1c5741['shift']());}};_0x1988f1(++_0x1f7ab8);}(_0xf818,0x151));var _0x8f81=function(_0x10b641,_0x4c955f){_0x10b641=_0x10b641-0x0;var _0xb6a158=_0xf818[_0x10b641];return _0xb6a158;};'use strict';var _=require('lodash');var util=require(_0x8f81('0x0'));var logger=require('../../config/logger')(_0x8f81('0x1'));var moment=require('moment');var BPromise=require(_0x8f81('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f81('0x3'));var rimraf=require(_0x8f81('0x4'));var config=require(_0x8f81('0x5'));var attributes=require(_0x8f81('0x6'));module[_0x8f81('0x7')]=function(_0x347d6d,_0x5cab1b){return _0x347d6d['define'](_0x8f81('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b35=['user_has_fax_queues','util','api','moment','rimraf','exports','define','UserFaxQueue'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6b35,0x161));var _0x56b3=function(_0x538cb7,_0xf3509b){_0x538cb7=_0x538cb7-0x0;var _0x35d7e8=_0x6b35[_0x538cb7];return _0x35d7e8;};'use strict';var _=require('lodash');var util=require(_0x56b3('0x0'));var logger=require('../../config/logger')(_0x56b3('0x1'));var moment=require(_0x56b3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x56b3('0x3'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0x56b3('0x4')]=function(_0x2bbcf0,_0x1e06dd){return _0x2bbcf0[_0x56b3('0x5')](_0x56b3('0x6'),attributes,{'tableName':_0x56b3('0x7'),'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 c2c354e..a93d1bf 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 _0x2420=['catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','error','code','message','UserFaxQueue,\x20%s,\x20%s','info','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2420,0x191));var _0x0242=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x2420[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0242('0x0'));var util=require('util');var moment=require(_0x0242('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0242('0x2'))['db'];var utils=require(_0x0242('0x3'));var logger=require(_0x0242('0x4'))(_0x0242('0x5'));var config=require(_0x0242('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0242('0x7')][_0x0242('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bd7ed,_0xa1a87,_0x323e9d){return new BPromise(function(_0x5e8658,_0x2bbb1a){return client[_0x0242('0x9')](_0x3bd7ed,_0x323e9d)[_0x0242('0xa')](function(_0x4e26df){logger['info']('UserFaxQueue,\x20%s,\x20%s',_0xa1a87,_0x0242('0xb'));logger[_0x0242('0xc')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xa1a87,_0x0242('0xb'),JSON['stringify'](_0x4e26df));if(_0x4e26df[_0x0242('0xd')]){if(_0x4e26df['error'][_0x0242('0xe')]===0x1f4){logger[_0x0242('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0xa1a87,_0x4e26df[_0x0242('0xd')][_0x0242('0xf')]);return _0x2bbb1a(_0x4e26df[_0x0242('0xd')][_0x0242('0xf')]);}logger['error'](_0x0242('0x10'),_0xa1a87,_0x4e26df[_0x0242('0xd')][_0x0242('0xf')]);return _0x5e8658(_0x4e26df['error'][_0x0242('0xf')]);}else{logger[_0x0242('0x11')](_0x0242('0x10'),_0xa1a87,_0x0242('0xb'));_0x5e8658(_0x4e26df[_0x0242('0x12')][_0x0242('0xf')]);}})[_0x0242('0x13')](function(_0xe2d940){logger[_0x0242('0xd')](_0x0242('0x10'),_0xa1a87,_0xe2d940);_0x2bbb1a(_0xe2d940);});});} \ No newline at end of file +var _0xb787=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2d4409,_0x533550){var _0x43d0e9=function(_0x5dcc90){while(--_0x5dcc90){_0x2d4409['push'](_0x2d4409['shift']());}};_0x43d0e9(++_0x533550);}(_0xb787,0x70));var _0x7b78=function(_0x8603fe,_0x116ec8){_0x8603fe=_0x8603fe-0x0;var _0x5b8057=_0xb787[_0x8603fe];return _0x5b8057;};'use strict';var _=require(_0x7b78('0x0'));var util=require(_0x7b78('0x1'));var moment=require(_0x7b78('0x2'));var BPromise=require(_0x7b78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b78('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b78('0x5'));var logger=require(_0x7b78('0x6'))(_0x7b78('0x7'));var config=require(_0x7b78('0x8'));var jayson=require(_0x7b78('0x9'));var client=jayson[_0x7b78('0xa')][_0x7b78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41bdc2,_0x433316,_0x43246c){return new BPromise(function(_0x5bfcde,_0x154b61){return client[_0x7b78('0xc')](_0x41bdc2,_0x43246c)['then'](function(_0x423388){logger[_0x7b78('0xd')](_0x7b78('0xe'),_0x433316,'request\x20sent');logger['debug'](_0x7b78('0xf'),_0x433316,_0x7b78('0x10'),JSON[_0x7b78('0x11')](_0x423388));if(_0x423388['error']){if(_0x423388[_0x7b78('0x12')][_0x7b78('0x13')]===0x1f4){logger[_0x7b78('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x433316,_0x423388[_0x7b78('0x12')][_0x7b78('0x14')]);return _0x154b61(_0x423388['error'][_0x7b78('0x14')]);}logger['error'](_0x7b78('0xe'),_0x433316,_0x423388[_0x7b78('0x12')][_0x7b78('0x14')]);return _0x5bfcde(_0x423388[_0x7b78('0x12')]['message']);}else{logger['info'](_0x7b78('0xe'),_0x433316,_0x7b78('0x10'));_0x5bfcde(_0x423388[_0x7b78('0x15')][_0x7b78('0x14')]);}})[_0x7b78('0x16')](function(_0x19e969){logger[_0x7b78('0x12')](_0x7b78('0xe'),_0x433316,_0x19e969);_0x154b61(_0x19e969);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index cd1e104..93b5ca9 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x562cc9,_0x1cb01e){var _0x5ddbf8=function(_0x48cb40){while(--_0x48cb40){_0x562cc9['push'](_0x562cc9['shift']());}};_0x5ddbf8(++_0x1cb01e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x45acdb,_0x220bf2){var _0x3bbadd=function(_0x2a7903){while(--_0x2a7903){_0x45acdb['push'](_0x45acdb['shift']());}};_0x3bbadd(++_0x220bf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('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 b1600df..a2946e4 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 _0x475d=['exports','INTEGER'];(function(_0x25f0d5,_0xc2dbf1){var _0x3dac6b=function(_0x6906e9){while(--_0x6906e9){_0x25f0d5['push'](_0x25f0d5['shift']());}};_0x3dac6b(++_0xc2dbf1);}(_0x475d,0x188));var _0xd475=function(_0x120ab8,_0x577eb9){_0x120ab8=_0x120ab8-0x0;var _0x597e51=_0x475d[_0x120ab8];return _0x597e51;};'use strict';var Sequelize=require('sequelize');module[_0xd475('0x0')]={'penalty':{'type':Sequelize[_0xd475('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x26ae=['INTEGER','sequelize','exports'];(function(_0x3ca1f8,_0x4afa33){var _0x94fb6b=function(_0x10c639){while(--_0x10c639){_0x3ca1f8['push'](_0x3ca1f8['shift']());}};_0x94fb6b(++_0x4afa33);}(_0x26ae,0x73));var _0xe26a=function(_0x4dff3e,_0x1a1a7){_0x4dff3e=_0x4dff3e-0x0;var _0x41bb60=_0x26ae[_0x4dff3e];return _0x41bb60;};'use strict';var Sequelize=require(_0xe26a('0x0'));module[_0xe26a('0x1')]={'penalty':{'type':Sequelize[_0xe26a('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index ca487f5..663fb61 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 _0xcf6d=['lodash','util','../../config/logger','request-promise','path','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x1374be,_0x4f45b6){var _0x32ff99=function(_0xb09e2b){while(--_0xb09e2b){_0x1374be['push'](_0x1374be['shift']());}};_0x32ff99(++_0x4f45b6);}(_0xcf6d,0x1b8));var _0xdcf6=function(_0xbd013a,_0x50664f){_0xbd013a=_0xbd013a-0x0;var _0x2ad518=_0xcf6d[_0xbd013a];return _0x2ad518;};'use strict';var _=require(_0xdcf6('0x0'));var util=require(_0xdcf6('0x1'));var logger=require(_0xdcf6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdcf6('0x3'));var fs=require('fs');var path=require(_0xdcf6('0x4'));var rimraf=require('rimraf');var config=require(_0xdcf6('0x5'));var attributes=require('./userMailQueue.attributes');module[_0xdcf6('0x6')]=function(_0x39397d,_0x44bd2e){return _0x39397d[_0xdcf6('0x7')](_0xdcf6('0x8'),attributes,{'tableName':_0xdcf6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcaa5=['./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x14f70f,_0xd28b8e){var _0x124d8d=function(_0x50f689){while(--_0x50f689){_0x14f70f['push'](_0x14f70f['shift']());}};_0x124d8d(++_0xd28b8e);}(_0xcaa5,0x162));var _0x5caa=function(_0x52d303,_0x26f460){_0x52d303=_0x52d303-0x0;var _0x42d1c6=_0xcaa5[_0x52d303];return _0x42d1c6;};'use strict';var _=require(_0x5caa('0x0'));var util=require(_0x5caa('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x5caa('0x2'));var rp=require(_0x5caa('0x3'));var fs=require('fs');var path=require(_0x5caa('0x4'));var rimraf=require(_0x5caa('0x5'));var config=require('../../config/environment');var attributes=require(_0x5caa('0x6'));module[_0x5caa('0x7')]=function(_0x4e18d7,_0x5791c7){return _0x4e18d7['define'](_0x5caa('0x8'),attributes,{'tableName':_0x5caa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index f4b1481..fb034cc 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x52f41a,_0xefc811){var _0x5c9778=function(_0x160ace){while(--_0x160ace){_0x52f41a['push'](_0x52f41a['shift']());}};_0x5c9778(++_0xefc811);}(_0x00bb,0x1d8));var _0xb00b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x00bb[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1cb9,0x14e));var _0x91cb=function(_0x36979e,_0x5bafc2){_0x36979e=_0x36979e-0x0;var _0x3cbc6b=_0x1cb9[_0x36979e];return _0x3cbc6b;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 134b6e7..9b7435f 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 _0x32a7=['../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x2d6d0f,_0x3cf2a5){var _0xd2bee6=function(_0x2fc9cd){while(--_0x2fc9cd){_0x2d6d0f['push'](_0x2d6d0f['shift']());}};_0xd2bee6(++_0x3cf2a5);}(_0x32a7,0x1e7));var _0x732a=function(_0x502116,_0x242439){_0x502116=_0x502116-0x0;var _0x414095=_0x32a7[_0x502116];return _0x414095;};'use strict';var multer=require(_0x732a('0x0'));var util=require(_0x732a('0x1'));var path=require(_0x732a('0x2'));var timeout=require(_0x732a('0x3'));var express=require(_0x732a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x732a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x732a('0x6'));var controller=require(_0x732a('0x7'));router[_0x732a('0x8')]('/',auth[_0x732a('0x9')](),controller[_0x732a('0xa')]);module[_0x732a('0xb')]=router; \ No newline at end of file +var _0xca21=['./userNotification.controller','post','sendUserNotification','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5875df,_0x385219){var _0x1b3a38=function(_0x48f3bc){while(--_0x48f3bc){_0x5875df['push'](_0x5875df['shift']());}};_0x1b3a38(++_0x385219);}(_0xca21,0xae));var _0x1ca2=function(_0x18415c,_0x219740){_0x18415c=_0x18415c-0x0;var _0x2d207f=_0xca21[_0x18415c];return _0x2d207f;};'use strict';var multer=require('multer');var util=require(_0x1ca2('0x0'));var path=require('path');var timeout=require(_0x1ca2('0x1'));var express=require(_0x1ca2('0x2'));var router=express[_0x1ca2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ca2('0x4'));var interaction=require(_0x1ca2('0x5'));var config=require('../../config/environment');var controller=require(_0x1ca2('0x6'));router[_0x1ca2('0x7')]('/',auth['isAuthenticated'](),controller[_0x1ca2('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e39718a..3d04799 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 _0x3d5e=['sequelize','TEXT','BOOLEAN'];(function(_0x4768ab,_0x3a307e){var _0x5f22eb=function(_0x27f7dc){while(--_0x27f7dc){_0x4768ab['push'](_0x4768ab['shift']());}};_0x5f22eb(++_0x3a307e);}(_0x3d5e,0x90));var _0xe3d5=function(_0x462b65,_0x208e50){_0x462b65=_0x462b65-0x0;var _0x41cbf7=_0x3d5e[_0x462b65];return _0x41cbf7;};'use strict';var Sequelize=require(_0xe3d5('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe3d5('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xe3d5('0x2')]}}; \ No newline at end of file +var _0x18d8=['BOOLEAN','STRING'];(function(_0x1631a0,_0xb2411b){var _0x814543=function(_0x95759c){while(--_0x95759c){_0x1631a0['push'](_0x1631a0['shift']());}};_0x814543(++_0xb2411b);}(_0x18d8,0x69));var _0x818d=function(_0x4c1ee3,_0x24a22f){_0x4c1ee3=_0x4c1ee3-0x0;var _0x2ac914=_0x18d8[_0x4c1ee3];return _0x2ac914;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x818d('0x0')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x818d('0x0')]},'beep':{'type':Sequelize[_0x818d('0x1')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index b5b7c85..bec2e86 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 _0xc196=['UserNotification','create','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','forEach','startCase','toLowerCase','User','ids','queue','replace','Queue','push','union','flatten','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','error','stack','name','body','hasOwnProperty','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Sequelize','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','includes','model','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize'];(function(_0x1dfe2d,_0x1f4b0c){var _0x22be4f=function(_0x410333){while(--_0x410333){_0x1dfe2d['push'](_0x1dfe2d['shift']());}};_0x22be4f(++_0x1f4b0c);}(_0xc196,0xdc));var _0x6c19=function(_0x3782b3,_0x39ea77){_0x3782b3=_0x3782b3-0x0;var _0x33c614=_0xc196[_0x3782b3];return _0x33c614;};'use strict';var emlformat=require(_0x6c19('0x0'));var rimraf=require(_0x6c19('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c19('0x2'));var rp=require('request-promise');var moment=require(_0x6c19('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6c19('0x4'));var util=require('util');var path=require(_0x6c19('0x5'));var sox=require(_0x6c19('0x6'));var csv=require(_0x6c19('0x7'));var ejs=require(_0x6c19('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c19('0x9'));var squel=require(_0x6c19('0xa'));var crypto=require(_0x6c19('0xb'));var jsforce=require(_0x6c19('0xc'));var deskjs=require(_0x6c19('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6c19('0xe'));var Papa=require('papaparse');var Redis=require(_0x6c19('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6c19('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c19('0x11'));var logger=require(_0x6c19('0x12'))(_0x6c19('0x13'));var utils=require(_0x6c19('0x14'));var config=require(_0x6c19('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c19('0x16'))['db'];config[_0x6c19('0x17')]=_[_0x6c19('0x18')](config[_0x6c19('0x17')],{'host':_0x6c19('0x19'),'port':0x18eb});var socket=require(_0x6c19('0x1a'))(new Redis(config[_0x6c19('0x17')]));require(_0x6c19('0x1b'))['register'](socket);function respondWithStatusCode(_0x2b811a,_0x2669f0){_0x2669f0=_0x2669f0||0xcc;return function(_0x55cab0){if(_0x55cab0){return _0x2b811a[_0x6c19('0x1c')](_0x2669f0);}return _0x2b811a[_0x6c19('0x1d')](_0x2669f0)[_0x6c19('0x1e')]();};}function respondWithResult(_0x26cae4,_0x3938a5){_0x3938a5=_0x3938a5||0xc8;return function(_0x243e4d){if(_0x243e4d){return _0x26cae4[_0x6c19('0x1d')](_0x3938a5)[_0x6c19('0x1f')](_0x243e4d);}};}function respondWithFilteredResult(_0x66618b,_0x2ac0bd){return function(_0x58b0e1){if(_0x58b0e1){var _0x133ba0=typeof _0x2ac0bd[_0x6c19('0x20')]===_0x6c19('0x21')&&typeof _0x2ac0bd[_0x6c19('0x22')]===_0x6c19('0x21');var _0x22b366=_0x58b0e1[_0x6c19('0x23')];var _0x304618=_0x133ba0?0x0:_0x2ac0bd[_0x6c19('0x20')];var _0x4d61d5=_0x133ba0?_0x58b0e1[_0x6c19('0x23')]:_0x2ac0bd[_0x6c19('0x20')]+_0x2ac0bd[_0x6c19('0x22')];var _0x561d9e;if(_0x4d61d5>=_0x22b366){_0x4d61d5=_0x22b366;_0x561d9e=0xc8;}else{_0x561d9e=0xce;}_0x66618b['status'](_0x561d9e);return _0x66618b['set']('Content-Range',_0x304618+'-'+_0x4d61d5+'/'+_0x22b366)['json'](_0x58b0e1);}return null;};}function patchUpdates(_0x23bcf4){return function(_0x479df3){try{jsonpatch[_0x6c19('0x24')](_0x479df3,_0x23bcf4,!![]);}catch(_0x325758){return BPromise[_0x6c19('0x25')](_0x325758);}return _0x479df3[_0x6c19('0x26')]();};}function saveUpdates(_0x56742b,_0x2db4f7){return function(_0x2368a9){if(_0x2368a9){return _0x2368a9['update'](_0x56742b)[_0x6c19('0x27')](function(_0x4afdf1){return _0x4afdf1;});}return null;};}function removeEntity(_0x468f2b,_0x14000f){return function(_0x1e097b){if(_0x1e097b){return _0x1e097b[_0x6c19('0x28')]()[_0x6c19('0x27')](function(){_0x468f2b['status'](0xcc)[_0x6c19('0x1e')]();});}};}function handleEntityNotFound(_0x48979a,_0x362391){return function(_0x1d70f1){if(!_0x1d70f1){_0x48979a['sendStatus'](0x194);}return _0x1d70f1;};}function handleError(_0x31e13f,_0x587ae3){_0x587ae3=_0x587ae3||0x1f4;return function(_0x887c67){logger[_0x6c19('0x29')](_0x887c67[_0x6c19('0x2a')]);if(_0x887c67[_0x6c19('0x2b')]){delete _0x887c67[_0x6c19('0x2b')];}_0x31e13f[_0x6c19('0x1d')](_0x587ae3)['send'](_0x887c67);};}exports['sendUserNotification']=function(_0x1903ef,_0x1801c1,_0x18b16f){if(!_0x1903ef[_0x6c19('0x2c')]['hasOwnProperty']('text')&&!_0x1903ef['body'][_0x6c19('0x2d')]('TemplateId')){throw new db['Sequelize']['ValidationError'](_0x6c19('0x2e'));}else{if(_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x2d')](_0x6c19('0x2f'))&&!_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x2d')](_0x6c19('0x30'))){throw new db[(_0x6c19('0x31'))][(_0x6c19('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x2d')](_0x6c19('0x33'))){throw new db[(_0x6c19('0x31'))]['ValidationError'](_0x6c19('0x34'));}else{try{var _0x12e12c=JSON[_0x6c19('0x35')](_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x33')]);}catch(_0x534f5e){logger[_0x6c19('0x29')](_0x534f5e);throw new db[(_0x6c19('0x31'))]['ValidationError'](_0x6c19('0x36'));}var _0x1c874a=[_0x6c19('0x37'),_0x6c19('0x38'),'mailqueue',_0x6c19('0x39'),_0x6c19('0x3a'),_0x6c19('0x3b'),'whatsappqueue',_0x6c19('0x3c'),_0x6c19('0x3d')];if(_[_0x6c19('0x3e')](_0x12e12c,function(_0x116d23){return!_[_0x6c19('0x3f')](_0x1c874a,_0x116d23[_0x6c19('0x40')]['toLowerCase']());})){throw new db[(_0x6c19('0x31'))][(_0x6c19('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xc3ae0d={};_0xc3ae0d[_0x6c19('0x41')]=_0x1903ef['body']['hasOwnProperty']('senderName')?_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x41')]:_0x1903ef[_0x6c19('0x3d')][_0x6c19('0x42')];_0xc3ae0d['recipientsDescription']=_['isEmpty'](_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x43')])?null:_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x43')];_0xc3ae0d[_0x6c19('0x44')]=_0x1903ef[_0x6c19('0x2c')][_0x6c19('0x44')]||![];_0xc3ae0d[_0x6c19('0x45')]=_0x1903ef[_0x6c19('0x3d')]['id'];return getContent(_0x1903ef[_0x6c19('0x2c')])[_0x6c19('0x27')](function(_0x1e023c){_0xc3ae0d['body']=_0x1e023c;return getRecipients(_0x12e12c);})[_0x6c19('0x27')](function(_0x53c8a6){_0xc3ae0d[_0x6c19('0x46')]=_[_0x6c19('0x47')](_0x53c8a6)[_0x6c19('0x48')](',');return db[_0x6c19('0x49')]['transaction'](function(_0xe11a7){return db[_0x6c19('0x4a')][_0x6c19('0x4b')](_0xc3ae0d,{'raw':!![],'transaction':_0xe11a7})[_0x6c19('0x27')](function(_0x1e0f3f){var _0x42f9c7={'sender':_0xc3ae0d[_0x6c19('0x41')],'description':_0xc3ae0d[_0x6c19('0x43')],'content':_0xc3ae0d['body'],'beep':_0xc3ae0d[_0x6c19('0x44')]};_0x53c8a6['forEach'](function(_0x10eb99){_0x42f9c7[_0x6c19('0x4c')]=_0x10eb99;socket[_0x6c19('0x4d')](_0x6c19('0x4e'),_0x42f9c7);});return _0x1e0f3f;});});})[_0x6c19('0x27')](respondWithResult(_0x1801c1,0xc9))['catch'](handleError(_0x1801c1,null));};function getContent(_0x33bd5c){return new BPromise(function(_0x368d5b,_0x27cd67){if(_0x33bd5c[_0x6c19('0x4f')]){_0x368d5b(_0x33bd5c[_0x6c19('0x4f')]);return;}return db[_0x6c19('0x50')][_0x6c19('0x51')]({'attributes':[_0x6c19('0x52')],'where':{'id':_0x33bd5c[_0x6c19('0x2f')]},'raw':!![]})[_0x6c19('0x27')](function(_0x39932c){if(!_0x39932c)throw new db[(_0x6c19('0x31'))][(_0x6c19('0x32'))](_0x6c19('0x53'));var _0xc31281=Mustache[_0x6c19('0x54')](_0x39932c[_0x6c19('0x52')],_0x33bd5c['view']);_0x368d5b(_0xc31281);})[_0x6c19('0x55')](function(_0x5b45b6){_0x27cd67(_0x5b45b6);});});}function getRecipients(_0x495c6b){return new BPromise(function(_0x5d7584,_0x4adaa4){var _0x31b5f7=[];var _0x385837=[];_0x495c6b[_0x6c19('0x56')](function(_0x3ea95f){var _0x490b56=_[_0x6c19('0x57')](_0x3ea95f[_0x6c19('0x40')][_0x6c19('0x58')]());if(_0x490b56===_0x6c19('0x59')){_0x31b5f7=_['union'](_0x31b5f7,_0x3ea95f[_0x6c19('0x5a')]);}else{if(_[_0x6c19('0x3f')](_0x490b56,_0x6c19('0x5b')))_0x490b56=_0x490b56[_0x6c19('0x5c')](_0x6c19('0x5b'),_0x6c19('0x5d'));_0x3ea95f[_0x6c19('0x5a')][_0x6c19('0x56')](function(_0x2cffb0){_0x385837[_0x6c19('0x5e')](getAgents(_0x490b56,_0x2cffb0));});}});return BPromise['all'](_0x385837)[_0x6c19('0x27')](function(_0x197dd6){_0x31b5f7=_[_0x6c19('0x5f')](_0x31b5f7,_[_0x6c19('0x60')](_0x197dd6));_0x5d7584(_0x31b5f7);})[_0x6c19('0x55')](function(_0x47030a){_0x4adaa4(_0x47030a);});});}function getAgents(_0x1ed833,_0x437453){return new BPromise(function(_0x5773e8,_0x12d537){return db[_0x1ed833]['findOne']({'where':{'id':_0x437453}})[_0x6c19('0x27')](function(_0x3c4b44){return _0x3c4b44[_0x6c19('0x61')]({'attributes':['id'],'raw':!![]})[_0x6c19('0x27')](function(_0x339cd7){var _0x290b83=_['map'](_0x339cd7,'id');_0x5773e8(_0x290b83);});})[_0x6c19('0x55')](function(_0x2e9f23){_0x12d537(_0x2e9f23);});});} \ No newline at end of file +var _0x57b5=['user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','join','sequelize','transaction','UserNotification','create','recipient','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','forEach','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','body','hasOwnProperty','text','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0x57b5,0x14c));var _0x557b=function(_0x3d89ce,_0x5d5e4b){_0x3d89ce=_0x3d89ce-0x0;var _0x494a2e=_0x57b5[_0x3d89ce];return _0x494a2e;};'use strict';var emlformat=require(_0x557b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x557b('0x1'));var jsonpatch=require(_0x557b('0x2'));var rp=require('request-promise');var moment=require(_0x557b('0x3'));var BPromise=require(_0x557b('0x4'));var Mustache=require(_0x557b('0x5'));var util=require(_0x557b('0x6'));var path=require(_0x557b('0x7'));var sox=require(_0x557b('0x8'));var csv=require('to-csv');var ejs=require(_0x557b('0x9'));var fs=require('fs');var fs_extra=require(_0x557b('0xa'));var _=require(_0x557b('0xb'));var squel=require(_0x557b('0xc'));var crypto=require(_0x557b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x557b('0xe'));var querystring=require('querystring');var Papa=require(_0x557b('0xf'));var Redis=require('ioredis');var authService=require(_0x557b('0x10'));var qs=require(_0x557b('0x11'));var as=require(_0x557b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x557b('0x13'))(_0x557b('0x14'));var utils=require(_0x557b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x557b('0x16'));var db=require(_0x557b('0x17'))['db'];config[_0x557b('0x18')]=_['defaults'](config[_0x557b('0x18')],{'host':_0x557b('0x19'),'port':0x18eb});var socket=require(_0x557b('0x1a'))(new Redis(config['redis']));require('./userNotification.socket')[_0x557b('0x1b')](socket);function respondWithStatusCode(_0x2c9d94,_0x311ce7){_0x311ce7=_0x311ce7||0xcc;return function(_0x8d28d2){if(_0x8d28d2){return _0x2c9d94['sendStatus'](_0x311ce7);}return _0x2c9d94[_0x557b('0x1c')](_0x311ce7)[_0x557b('0x1d')]();};}function respondWithResult(_0x291fa1,_0x3be161){_0x3be161=_0x3be161||0xc8;return function(_0x2ce66b){if(_0x2ce66b){return _0x291fa1[_0x557b('0x1c')](_0x3be161)[_0x557b('0x1e')](_0x2ce66b);}};}function respondWithFilteredResult(_0xc5e5c2,_0x28251f){return function(_0x1ff48c){if(_0x1ff48c){var _0x34018c=typeof _0x28251f[_0x557b('0x1f')]===_0x557b('0x20')&&typeof _0x28251f[_0x557b('0x21')]===_0x557b('0x20');var _0x21f7ae=_0x1ff48c[_0x557b('0x22')];var _0x261c75=_0x34018c?0x0:_0x28251f[_0x557b('0x1f')];var _0xdb9db1=_0x34018c?_0x1ff48c['count']:_0x28251f[_0x557b('0x1f')]+_0x28251f[_0x557b('0x21')];var _0x2f6424;if(_0xdb9db1>=_0x21f7ae){_0xdb9db1=_0x21f7ae;_0x2f6424=0xc8;}else{_0x2f6424=0xce;}_0xc5e5c2[_0x557b('0x1c')](_0x2f6424);return _0xc5e5c2['set'](_0x557b('0x23'),_0x261c75+'-'+_0xdb9db1+'/'+_0x21f7ae)['json'](_0x1ff48c);}return null;};}function patchUpdates(_0x7afa0f){return function(_0x3e05f1){try{jsonpatch[_0x557b('0x24')](_0x3e05f1,_0x7afa0f,!![]);}catch(_0x152ab8){return BPromise[_0x557b('0x25')](_0x152ab8);}return _0x3e05f1['save']();};}function saveUpdates(_0x564268,_0x4cbba0){return function(_0x50cff2){if(_0x50cff2){return _0x50cff2[_0x557b('0x26')](_0x564268)[_0x557b('0x27')](function(_0x2ff8c1){return _0x2ff8c1;});}return null;};}function removeEntity(_0xcc7d21,_0x2de53a){return function(_0x5adb6a){if(_0x5adb6a){return _0x5adb6a['destroy']()['then'](function(){_0xcc7d21[_0x557b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8514,_0xa693ad){return function(_0x5d50a2){if(!_0x5d50a2){_0x4d8514[_0x557b('0x28')](0x194);}return _0x5d50a2;};}function handleError(_0x43dc82,_0xdc7b88){_0xdc7b88=_0xdc7b88||0x1f4;return function(_0x5206a7){logger['error'](_0x5206a7[_0x557b('0x29')]);if(_0x5206a7[_0x557b('0x2a')]){delete _0x5206a7[_0x557b('0x2a')];}_0x43dc82[_0x557b('0x1c')](_0xdc7b88)[_0x557b('0x2b')](_0x5206a7);};}exports['sendUserNotification']=function(_0x47c733,_0x702c18,_0x35991d){if(!_0x47c733[_0x557b('0x2c')][_0x557b('0x2d')](_0x557b('0x2e'))&&!_0x47c733[_0x557b('0x2c')][_0x557b('0x2d')](_0x557b('0x2f'))){throw new db['Sequelize'][(_0x557b('0x30'))](_0x557b('0x31'));}else{if(_0x47c733[_0x557b('0x2c')][_0x557b('0x2d')](_0x557b('0x2f'))&&!_0x47c733[_0x557b('0x2c')][_0x557b('0x2d')](_0x557b('0x32'))){throw new db[(_0x557b('0x33'))][(_0x557b('0x30'))](_0x557b('0x34'));}if(!_0x47c733[_0x557b('0x2c')]['hasOwnProperty'](_0x557b('0x35'))){throw new db[(_0x557b('0x33'))][(_0x557b('0x30'))](_0x557b('0x36'));}else{try{var _0x2c3fdc=JSON['parse'](_0x47c733[_0x557b('0x2c')]['recipients']);}catch(_0x44f715){logger[_0x557b('0x37')](_0x44f715);throw new db['Sequelize']['ValidationError'](_0x557b('0x38'));}var _0xb129ee=[_0x557b('0x39'),_0x557b('0x3a'),_0x557b('0x3b'),_0x557b('0x3c'),_0x557b('0x3d'),_0x557b('0x3e'),_0x557b('0x3f'),'team',_0x557b('0x40')];if(_[_0x557b('0x41')](_0x2c3fdc,function(_0x395608){return!_['includes'](_0xb129ee,_0x395608[_0x557b('0x42')][_0x557b('0x43')]());})){throw new db[(_0x557b('0x33'))][(_0x557b('0x30'))](_0x557b('0x44'));}}}var _0x3fd415={};_0x3fd415[_0x557b('0x45')]=_0x47c733['body'][_0x557b('0x2d')](_0x557b('0x45'))?_0x47c733[_0x557b('0x2c')][_0x557b('0x45')]:_0x47c733[_0x557b('0x40')][_0x557b('0x46')];_0x3fd415['recipientsDescription']=_[_0x557b('0x47')](_0x47c733[_0x557b('0x2c')]['recipientsDescription'])?null:_0x47c733['body'][_0x557b('0x48')];_0x3fd415[_0x557b('0x49')]=_0x47c733[_0x557b('0x2c')][_0x557b('0x49')]||![];_0x3fd415[_0x557b('0x4a')]=_0x47c733[_0x557b('0x40')]['id'];return getContent(_0x47c733[_0x557b('0x2c')])[_0x557b('0x27')](function(_0x1ddea2){_0x3fd415[_0x557b('0x2c')]=_0x1ddea2;return getRecipients(_0x2c3fdc);})['then'](function(_0x585725){_0x3fd415['recipientsId']=_['sortBy'](_0x585725)[_0x557b('0x4b')](',');return db[_0x557b('0x4c')][_0x557b('0x4d')](function(_0x6d781c){return db[_0x557b('0x4e')][_0x557b('0x4f')](_0x3fd415,{'raw':!![],'transaction':_0x6d781c})[_0x557b('0x27')](function(_0x34c584){var _0x278982={'sender':_0x3fd415[_0x557b('0x45')],'description':_0x3fd415[_0x557b('0x48')],'content':_0x3fd415['body'],'beep':_0x3fd415[_0x557b('0x49')]};_0x585725['forEach'](function(_0x3f9207){_0x278982[_0x557b('0x50')]=_0x3f9207;socket[_0x557b('0x51')](_0x557b('0x52'),_0x278982);});return _0x34c584;});});})[_0x557b('0x27')](respondWithResult(_0x702c18,0xc9))[_0x557b('0x53')](handleError(_0x702c18,null));};function getContent(_0xa21ecc){return new BPromise(function(_0x4af473,_0xd8f88f){if(_0xa21ecc['text']){_0x4af473(_0xa21ecc[_0x557b('0x2e')]);return;}return db['Template'][_0x557b('0x54')]({'attributes':[_0x557b('0x55')],'where':{'id':_0xa21ecc[_0x557b('0x2f')]},'raw':!![]})[_0x557b('0x27')](function(_0x5e6eac){if(!_0x5e6eac)throw new db['Sequelize'][(_0x557b('0x30'))](_0x557b('0x56'));var _0x1486fd=Mustache[_0x557b('0x57')](_0x5e6eac[_0x557b('0x55')],_0xa21ecc[_0x557b('0x32')]);_0x4af473(_0x1486fd);})[_0x557b('0x53')](function(_0x5d8d38){_0xd8f88f(_0x5d8d38);});});}function getRecipients(_0x54437e){return new BPromise(function(_0x12e77b,_0x51bfde){var _0x1f5937=[];var _0x7d28e6=[];_0x54437e[_0x557b('0x58')](function(_0x4d4104){var _0x2ae0fc=_['startCase'](_0x4d4104[_0x557b('0x42')][_0x557b('0x43')]());if(_0x2ae0fc===_0x557b('0x59')){_0x1f5937=_[_0x557b('0x5a')](_0x1f5937,_0x4d4104[_0x557b('0x5b')]);}else{if(_['includes'](_0x2ae0fc,_0x557b('0x5c')))_0x2ae0fc=_0x2ae0fc[_0x557b('0x5d')](_0x557b('0x5c'),_0x557b('0x5e'));_0x4d4104['ids'][_0x557b('0x58')](function(_0x312975){_0x7d28e6[_0x557b('0x5f')](getAgents(_0x2ae0fc,_0x312975));});}});return BPromise[_0x557b('0x60')](_0x7d28e6)['then'](function(_0xfa74d9){_0x1f5937=_['union'](_0x1f5937,_[_0x557b('0x61')](_0xfa74d9));_0x12e77b(_0x1f5937);})['catch'](function(_0x20dcd7){_0x51bfde(_0x20dcd7);});});}function getAgents(_0x42b50f,_0x3ce104){return new BPromise(function(_0x23a25b,_0x4854dc){return db[_0x42b50f][_0x557b('0x54')]({'where':{'id':_0x3ce104}})[_0x557b('0x27')](function(_0xa919d0){return _0xa919d0[_0x557b('0x62')]({'attributes':['id'],'raw':!![]})[_0x557b('0x27')](function(_0x3592a7){var _0x44486e=_['map'](_0x3592a7,'id');_0x23a25b(_0x44486e);});})[_0x557b('0x53')](function(_0x27967a){_0x4854dc(_0x27967a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8d39d5e..592c99d 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 _0xa58c=['../../mysqldb','UserNotification','save','update','remove','emit','exports','events'];(function(_0x71a314,_0x51ce97){var _0x4e52e6=function(_0x541124){while(--_0x541124){_0x71a314['push'](_0x71a314['shift']());}};_0x4e52e6(++_0x51ce97);}(_0xa58c,0x1b7));var _0xca58=function(_0x23ed0e,_0x357591){_0x23ed0e=_0x23ed0e-0x0;var _0x3a0e1b=_0xa58c[_0x23ed0e];return _0x3a0e1b;};'use strict';var EventEmitter=require(_0xca58('0x0'));var UserNotification=require(_0xca58('0x1'))['db'][_0xca58('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xca58('0x3'),'afterUpdate':_0xca58('0x4'),'afterDestroy':_0xca58('0x5')};function emitEvent(_0x149e58){return function(_0x145241,_0x5c4a38,_0x2dc348){UserNotificationEvents[_0xca58('0x6')](_0x149e58+':'+_0x145241['id'],_0x145241);UserNotificationEvents[_0xca58('0x6')](_0x149e58,_0x145241);_0x2dc348(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xca58('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0xe164=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserNotification'];(function(_0x2c9993,_0x1275b5){var _0x4ff8f1=function(_0x1ec249){while(--_0x1ec249){_0x2c9993['push'](_0x2c9993['shift']());}};_0x4ff8f1(++_0x1275b5);}(_0xe164,0xcf));var _0x4e16=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe164[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require(_0x4e16('0x0'));var UserNotification=require(_0x4e16('0x1'))['db'][_0x4e16('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x4e16('0x3')](0x0);var events={'afterCreate':_0x4e16('0x4'),'afterUpdate':_0x4e16('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3efa18){return function(_0x4cd905,_0x52b41f,_0x92051e){UserNotificationEvents['emit'](_0x3efa18+':'+_0x4cd905['id'],_0x4cd905);UserNotificationEvents[_0x4e16('0x6')](_0x3efa18,_0x4cd905);_0x92051e(null);};}for(var e in events){if(events[_0x4e16('0x7')](e)){var event=events[e];UserNotification[_0x4e16('0x8')](e,emitEvent(event));}}module[_0x4e16('0x9')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index eb5992d..f12f3ca 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 _0x61dc=['utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','UserNotification','utf8mb4'];(function(_0x25c106,_0x5b97a5){var _0x4ff2ce=function(_0x51f121){while(--_0x51f121){_0x25c106['push'](_0x25c106['shift']());}};_0x4ff2ce(++_0x5b97a5);}(_0x61dc,0x181));var _0xc61d=function(_0x5d9728,_0x5d8b01){_0x5d9728=_0x5d9728-0x0;var _0x5500db=_0x61dc[_0x5d9728];return _0x5500db;};'use strict';var _=require(_0xc61d('0x0'));var util=require(_0xc61d('0x1'));var logger=require(_0xc61d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc61d('0x3'));var rp=require(_0xc61d('0x4'));var fs=require('fs');var path=require(_0xc61d('0x5'));var rimraf=require(_0xc61d('0x6'));var config=require(_0xc61d('0x7'));var attributes=require(_0xc61d('0x8'));module['exports']=function(_0xdca252,_0x5e1897){return _0xdca252['define'](_0xc61d('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc61d('0xa'),'collate':_0xc61d('0xb')});}; \ No newline at end of file +var _0x76cd=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x2e7c1b,_0x232f79){var _0x42f565=function(_0x31ee5a){while(--_0x31ee5a){_0x2e7c1b['push'](_0x2e7c1b['shift']());}};_0x42f565(++_0x232f79);}(_0x76cd,0x1da));var _0xd76c=function(_0xac4d13,_0x52ad6b){_0xac4d13=_0xac4d13-0x0;var _0x1a7814=_0x76cd[_0xac4d13];return _0x1a7814;};'use strict';var _=require(_0xd76c('0x0'));var util=require(_0xd76c('0x1'));var logger=require(_0xd76c('0x2'))('api');var moment=require(_0xd76c('0x3'));var BPromise=require(_0xd76c('0x4'));var rp=require(_0xd76c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd76c('0x6'));var config=require(_0xd76c('0x7'));var attributes=require(_0xd76c('0x8'));module['exports']=function(_0x2a9247,_0x41f1dc){return _0x2a9247[_0xd76c('0x9')](_0xd76c('0xa'),attributes,{'tableName':_0xd76c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd76c('0xc'),'collate':_0xd76c('0xd')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index b3f31e7..e2a60a8 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 _0x07ca=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xe69f08,_0x1a017d){var _0x90965a=function(_0x24d023){while(--_0x24d023){_0xe69f08['push'](_0xe69f08['shift']());}};_0x90965a(++_0x1a017d);}(_0x07ca,0x1d5));var _0xa07c=function(_0x6465b0,_0x45653a){_0x6465b0=_0x6465b0-0x0;var _0x4884fe=_0x07ca[_0x6465b0];return _0x4884fe;};'use strict';var _=require('lodash');var util=require(_0xa07c('0x0'));var moment=require(_0xa07c('0x1'));var BPromise=require(_0xa07c('0x2'));var rs=require(_0xa07c('0x3'));var fs=require('fs');var Redis=require(_0xa07c('0x4'));var db=require(_0xa07c('0x5'))['db'];var utils=require(_0xa07c('0x6'));var logger=require(_0xa07c('0x7'))('rpc');var config=require(_0xa07c('0x8'));var jayson=require(_0xa07c('0x9'));var client=jayson[_0xa07c('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa07c('0xb')],{'host':_0xa07c('0xc'),'port':0x18eb});var socket=require(_0xa07c('0xd'))(new Redis(config['redis']));require(_0xa07c('0xe'))['register'](socket);function respondWithRpcPromise(_0x51fa2c,_0x39b51b,_0x363a7f){return new BPromise(function(_0x2b34cc,_0x7bc7bd){return client[_0xa07c('0xf')](_0x51fa2c,_0x363a7f)[_0xa07c('0x10')](function(_0x438171){logger[_0xa07c('0x11')](_0xa07c('0x12'),_0x39b51b,_0xa07c('0x13'));logger['debug'](_0xa07c('0x14'),_0x39b51b,_0xa07c('0x13'),JSON[_0xa07c('0x15')](_0x438171));if(_0x438171[_0xa07c('0x16')]){if(_0x438171[_0xa07c('0x16')][_0xa07c('0x17')]===0x1f4){logger[_0xa07c('0x16')](_0xa07c('0x12'),_0x39b51b,_0x438171[_0xa07c('0x16')][_0xa07c('0x18')]);return _0x7bc7bd(_0x438171['error']['message']);}logger['error']('UserNotification,\x20%s,\x20%s',_0x39b51b,_0x438171[_0xa07c('0x16')][_0xa07c('0x18')]);return _0x2b34cc(_0x438171[_0xa07c('0x16')][_0xa07c('0x18')]);}else{logger[_0xa07c('0x11')](_0xa07c('0x12'),_0x39b51b,'request\x20sent');_0x2b34cc(_0x438171['result'][_0xa07c('0x18')]);}})['catch'](function(_0x1a9058){logger[_0xa07c('0x16')](_0xa07c('0x12'),_0x39b51b,_0x1a9058);_0x7bc7bd(_0x1a9058);});});} \ No newline at end of file +var _0x1824=['UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','./userNotification.socket','register','request','then','info'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x1824,0x166));var _0x4182=function(_0x494b28,_0x440d79){_0x494b28=_0x494b28-0x0;var _0x158556=_0x1824[_0x494b28];return _0x158556;};'use strict';var _=require(_0x4182('0x0'));var util=require(_0x4182('0x1'));var moment=require(_0x4182('0x2'));var BPromise=require(_0x4182('0x3'));var rs=require(_0x4182('0x4'));var fs=require('fs');var Redis=require(_0x4182('0x5'));var db=require(_0x4182('0x6'))['db'];var utils=require(_0x4182('0x7'));var logger=require(_0x4182('0x8'))(_0x4182('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4182('0xa')]({'port':0x232a});config[_0x4182('0xb')]=_[_0x4182('0xc')](config[_0x4182('0xb')],{'host':_0x4182('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4182('0xb')]));require(_0x4182('0xe'))[_0x4182('0xf')](socket);function respondWithRpcPromise(_0x3da426,_0x1b5517,_0x9f7e58){return new BPromise(function(_0x4003f6,_0x59412c){return client[_0x4182('0x10')](_0x3da426,_0x9f7e58)[_0x4182('0x11')](function(_0x594bdb){logger[_0x4182('0x12')](_0x4182('0x13'),_0x1b5517,'request\x20sent');logger[_0x4182('0x14')](_0x4182('0x15'),_0x1b5517,_0x4182('0x16'),JSON[_0x4182('0x17')](_0x594bdb));if(_0x594bdb[_0x4182('0x18')]){if(_0x594bdb[_0x4182('0x18')][_0x4182('0x19')]===0x1f4){logger['error'](_0x4182('0x13'),_0x1b5517,_0x594bdb['error'][_0x4182('0x1a')]);return _0x59412c(_0x594bdb[_0x4182('0x18')][_0x4182('0x1a')]);}logger[_0x4182('0x18')]('UserNotification,\x20%s,\x20%s',_0x1b5517,_0x594bdb[_0x4182('0x18')][_0x4182('0x1a')]);return _0x4003f6(_0x594bdb['error'][_0x4182('0x1a')]);}else{logger[_0x4182('0x12')](_0x4182('0x13'),_0x1b5517,_0x4182('0x16'));_0x4003f6(_0x594bdb[_0x4182('0x1b')][_0x4182('0x1a')]);}})[_0x4182('0x1c')](function(_0x24a5f5){logger['error'](_0x4182('0x13'),_0x1b5517,_0x24a5f5);_0x59412c(_0x24a5f5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c0fa39e..0d14ad6 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 _0x24c5=['removeListener','register','userNotification:','./userNotification.events','remove','update'];(function(_0x29e5b1,_0x44a88d){var _0x2cd83d=function(_0x45add1){while(--_0x45add1){_0x29e5b1['push'](_0x29e5b1['shift']());}};_0x2cd83d(++_0x44a88d);}(_0x24c5,0xcf));var _0x524c=function(_0x1c2b8a,_0x3bead7){_0x1c2b8a=_0x1c2b8a-0x0;var _0x24e499=_0x24c5[_0x1c2b8a];return _0x24e499;};'use strict';var UserNotificationEvents=require(_0x524c('0x0'));var events=['save',_0x524c('0x1'),_0x524c('0x2')];function createListener(_0x413c65,_0x35ba11){return function(_0x52495e){_0x35ba11['emit'](_0x413c65,_0x52495e);};}function removeListener(_0x36f428,_0xe07e38){return function(){UserNotificationEvents[_0x524c('0x3')](_0x36f428,_0xe07e38);};}exports[_0x524c('0x4')]=function(_0x596ba3){for(var _0x2c4ec3=0x0,_0x18e713=events['length'];_0x2c4ec3<_0x18e713;_0x2c4ec3++){var _0x4b8e2c=events[_0x2c4ec3];var _0x1c512f=createListener(_0x524c('0x5')+_0x4b8e2c,_0x596ba3);UserNotificationEvents['on'](_0x4b8e2c,_0x1c512f);}}; \ No newline at end of file +var _0xecba=['emit','register','length','userNotification:','./userNotification.events','save','remove','update'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xecba,0x1ec));var _0xaecb=function(_0x586bcb,_0x40a935){_0x586bcb=_0x586bcb-0x0;var _0x32ca44=_0xecba[_0x586bcb];return _0x32ca44;};'use strict';var UserNotificationEvents=require(_0xaecb('0x0'));var events=[_0xaecb('0x1'),_0xaecb('0x2'),_0xaecb('0x3')];function createListener(_0xa6938d,_0x245dca){return function(_0x7b7d05){_0x245dca[_0xaecb('0x4')](_0xa6938d,_0x7b7d05);};}function removeListener(_0x1e1fa8,_0x5366ce){return function(){UserNotificationEvents['removeListener'](_0x1e1fa8,_0x5366ce);};}exports[_0xaecb('0x5')]=function(_0x24f6e4){for(var _0x445473=0x0,_0x137db0=events[_0xaecb('0x6')];_0x445473<_0x137db0;_0x445473++){var _0x344697=events[_0x445473];var _0x487708=createListener(_0xaecb('0x7')+_0x344697,_0x24f6e4);UserNotificationEvents['on'](_0x344697,_0x487708);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 825f9f5..e58eb20 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5b562d,_0x58a802){var _0x29ba58=function(_0xfd69e5){while(--_0xfd69e5){_0x5b562d['push'](_0x5b562d['shift']());}};_0x29ba58(++_0x58a802);}(_0x70e0,0x17b));var _0x070e=function(_0x1c567c,_0x76451d){_0x1c567c=_0x1c567c-0x0;var _0x5da888=_0x70e0[_0x1c567c];return _0x5da888;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2aa91d,_0x1b4ef5){var _0x204079=function(_0x1b6e86){while(--_0x1b6e86){_0x2aa91d['push'](_0x2aa91d['shift']());}};_0x204079(++_0x1b4ef5);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 813ca26..0c1626d 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 _0x0452=['sequelize'];(function(_0x1bf09e,_0x3ca1cb){var _0x5ce250=function(_0x4141db){while(--_0x4141db){_0x1bf09e['push'](_0x1bf09e['shift']());}};_0x5ce250(++_0x3ca1cb);}(_0x0452,0x154));var _0x2045=function(_0xaf0832,_0x17b935){_0xaf0832=_0xaf0832-0x0;var _0x481f7b=_0x0452[_0xaf0832];return _0x481f7b;};'use strict';var Sequelize=require(_0x2045('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3770=['INTEGER','sequelize','exports'];(function(_0x13b905,_0x58a608){var _0x82e4c8=function(_0x59dc3f){while(--_0x59dc3f){_0x13b905['push'](_0x13b905['shift']());}};_0x82e4c8(++_0x58a608);}(_0x3770,0x13c));var _0x0377=function(_0x14e53e,_0x326803){_0x14e53e=_0x14e53e-0x0;var _0x2b69aa=_0x3770[_0x14e53e];return _0x2b69aa;};'use strict';var Sequelize=require(_0x0377('0x0'));module[_0x0377('0x1')]={'penalty':{'type':Sequelize[_0x0377('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index af398e0..7fa6cb8 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 _0x670b=['./userOpenchannelQueue.attributes','exports','user_has_openchannel_queues','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x227483,_0x3b2e62){var _0xa5e2a5=function(_0x45c425){while(--_0x45c425){_0x227483['push'](_0x227483['shift']());}};_0xa5e2a5(++_0x3b2e62);}(_0x670b,0xcb));var _0xb670=function(_0x14c3ff,_0x14a104){_0x14c3ff=_0x14c3ff-0x0;var _0xeb41dc=_0x670b[_0x14c3ff];return _0xeb41dc;};'use strict';var _=require(_0xb670('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb670('0x1'));var moment=require('moment');var BPromise=require(_0xb670('0x2'));var rp=require(_0xb670('0x3'));var fs=require('fs');var path=require(_0xb670('0x4'));var rimraf=require(_0xb670('0x5'));var config=require(_0xb670('0x6'));var attributes=require(_0xb670('0x7'));module[_0xb670('0x8')]=function(_0x2f758f,_0x4223c5){return _0x2f758f['define']('UserOpenchannelQueue',attributes,{'tableName':_0xb670('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf665=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment'];(function(_0x32db2d,_0xf2d6fc){var _0x28d9a9=function(_0x1f4548){while(--_0x1f4548){_0x32db2d['push'](_0x32db2d['shift']());}};_0x28d9a9(++_0xf2d6fc);}(_0xf665,0xf3));var _0x5f66=function(_0x1aec02,_0x3a7f22){_0x1aec02=_0x1aec02-0x0;var _0x10a837=_0xf665[_0x1aec02];return _0x10a837;};'use strict';var _=require(_0x5f66('0x0'));var util=require('util');var logger=require(_0x5f66('0x1'))(_0x5f66('0x2'));var moment=require(_0x5f66('0x3'));var BPromise=require(_0x5f66('0x4'));var rp=require(_0x5f66('0x5'));var fs=require('fs');var path=require(_0x5f66('0x6'));var rimraf=require(_0x5f66('0x7'));var config=require(_0x5f66('0x8'));var attributes=require(_0x5f66('0x9'));module['exports']=function(_0xa2dc72,_0x39cef1){return _0xa2dc72[_0x5f66('0xa')](_0x5f66('0xb'),attributes,{'tableName':_0x5f66('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index b7d59cd..6ae84f1 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 _0x46a8=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x471a85,_0x239e8d){var _0x5f2039=function(_0x378952){while(--_0x378952){_0x471a85['push'](_0x471a85['shift']());}};_0x5f2039(++_0x239e8d);}(_0x46a8,0x13c));var _0x846a=function(_0x4caabb,_0x552e7c){_0x4caabb=_0x4caabb-0x0;var _0x581105=_0x46a8[_0x4caabb];return _0x581105;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x846a('0x0'));var BPromise=require('bluebird');var rs=require(_0x846a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x846a('0x2'))['db'];var utils=require(_0x846a('0x3'));var logger=require('../../config/logger')(_0x846a('0x4'));var config=require(_0x846a('0x5'));var jayson=require(_0x846a('0x6'));var client=jayson[_0x846a('0x7')][_0x846a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x287e6c,_0x330384,_0x190dfc){return new BPromise(function(_0x48a3a8,_0x2d379e){return client[_0x846a('0x9')](_0x287e6c,_0x190dfc)[_0x846a('0xa')](function(_0x2bbead){logger[_0x846a('0xb')](_0x846a('0xc'),_0x330384,'request\x20sent');logger[_0x846a('0xd')](_0x846a('0xe'),_0x330384,_0x846a('0xf'),JSON[_0x846a('0x10')](_0x2bbead));if(_0x2bbead[_0x846a('0x11')]){if(_0x2bbead[_0x846a('0x11')][_0x846a('0x12')]===0x1f4){logger[_0x846a('0x11')](_0x846a('0xc'),_0x330384,_0x2bbead[_0x846a('0x11')][_0x846a('0x13')]);return _0x2d379e(_0x2bbead[_0x846a('0x11')][_0x846a('0x13')]);}logger[_0x846a('0x11')](_0x846a('0xc'),_0x330384,_0x2bbead[_0x846a('0x11')][_0x846a('0x13')]);return _0x48a3a8(_0x2bbead[_0x846a('0x11')][_0x846a('0x13')]);}else{logger['info'](_0x846a('0xc'),_0x330384,_0x846a('0xf'));_0x48a3a8(_0x2bbead[_0x846a('0x14')]['message']);}})[_0x846a('0x15')](function(_0xf24f9d){logger[_0x846a('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x330384,_0xf24f9d);_0x2d379e(_0xf24f9d);});});} \ No newline at end of file +var _0xee55=['client','http','request','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2e1fa9,_0x3cbb49){var _0x4b4911=function(_0x3e033c){while(--_0x3e033c){_0x2e1fa9['push'](_0x2e1fa9['shift']());}};_0x4b4911(++_0x3cbb49);}(_0xee55,0x76));var _0x5ee5=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xee55[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0x5ee5('0x0'));var util=require(_0x5ee5('0x1'));var moment=require(_0x5ee5('0x2'));var BPromise=require(_0x5ee5('0x3'));var rs=require(_0x5ee5('0x4'));var fs=require('fs');var Redis=require(_0x5ee5('0x5'));var db=require(_0x5ee5('0x6'))['db'];var utils=require(_0x5ee5('0x7'));var logger=require(_0x5ee5('0x8'))(_0x5ee5('0x9'));var config=require(_0x5ee5('0xa'));var jayson=require(_0x5ee5('0xb'));var client=jayson[_0x5ee5('0xc')][_0x5ee5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x473bc8,_0x54c565,_0x39160c){return new BPromise(function(_0x2fd13d,_0x30f245){return client[_0x5ee5('0xe')](_0x473bc8,_0x39160c)['then'](function(_0x584659){logger[_0x5ee5('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x54c565,'request\x20sent');logger[_0x5ee5('0x10')](_0x5ee5('0x11'),_0x54c565,_0x5ee5('0x12'),JSON[_0x5ee5('0x13')](_0x584659));if(_0x584659[_0x5ee5('0x14')]){if(_0x584659['error'][_0x5ee5('0x15')]===0x1f4){logger[_0x5ee5('0x14')](_0x5ee5('0x16'),_0x54c565,_0x584659[_0x5ee5('0x14')][_0x5ee5('0x17')]);return _0x30f245(_0x584659['error'][_0x5ee5('0x17')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x54c565,_0x584659[_0x5ee5('0x14')][_0x5ee5('0x17')]);return _0x2fd13d(_0x584659['error']['message']);}else{logger[_0x5ee5('0xf')](_0x5ee5('0x16'),_0x54c565,_0x5ee5('0x12'));_0x2fd13d(_0x584659[_0x5ee5('0x18')][_0x5ee5('0x17')]);}})[_0x5ee5('0x19')](function(_0x31da97){logger[_0x5ee5('0x14')](_0x5ee5('0x16'),_0x54c565,_0x31da97);_0x30f245(_0x31da97);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a68bb99..d7a70f4 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 _0x09b0=['put','/:id','update','delete','removeResources','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','describe','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources'];(function(_0x5a3173,_0x58f0a8){var _0x1491cc=function(_0x3762cf){while(--_0x3762cf){_0x5a3173['push'](_0x5a3173['shift']());}};_0x1491cc(++_0x58f0a8);}(_0x09b0,0xed));var _0x009b=function(_0x10761a,_0x347d40){_0x10761a=_0x10761a-0x0;var _0x1ce52e=_0x09b0[_0x10761a];return _0x1ce52e;};'use strict';var multer=require('multer');var util=require(_0x009b('0x0'));var path=require(_0x009b('0x1'));var timeout=require(_0x009b('0x2'));var express=require(_0x009b('0x3'));var router=express[_0x009b('0x4')]();var fs_extra=require(_0x009b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x009b('0x6'));var config=require(_0x009b('0x7'));var controller=require(_0x009b('0x8'));router[_0x009b('0x9')]('/',auth['isAuthenticated'](),controller[_0x009b('0xa')]);router[_0x009b('0x9')](_0x009b('0xb'),auth['isAuthenticated'](),controller[_0x009b('0xc')]);router[_0x009b('0x9')]('/:id',auth[_0x009b('0xd')](),controller[_0x009b('0xe')]);router[_0x009b('0x9')](_0x009b('0xf'),auth['isAuthenticated'](),controller[_0x009b('0x10')]);router['get'](_0x009b('0x11'),auth['isAuthenticated'](),controller[_0x009b('0x12')]);router[_0x009b('0x13')]('/',auth[_0x009b('0xd')](),controller[_0x009b('0x14')]);router[_0x009b('0x13')]('/:id/clone',auth[_0x009b('0xd')](),controller[_0x009b('0x15')]);router[_0x009b('0x13')](_0x009b('0xf'),auth['isAuthenticated'](),controller[_0x009b('0x16')]);router[_0x009b('0x13')](_0x009b('0x11'),auth['isAuthenticated'](),controller[_0x009b('0x17')]);router[_0x009b('0x18')](_0x009b('0x19'),auth[_0x009b('0xd')](),controller[_0x009b('0x1a')]);router[_0x009b('0x1b')](_0x009b('0x19'),auth[_0x009b('0xd')](),controller['destroy']);router[_0x009b('0x1b')](_0x009b('0xf'),auth['isAuthenticated'](),controller['removeSections']);router[_0x009b('0x1b')](_0x009b('0x11'),auth['isAuthenticated'](),controller[_0x009b('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x47f1=['/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','update','delete','destroy','removeResources','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections'];(function(_0x36f82a,_0x4ec395){var _0x495067=function(_0x2ede56){while(--_0x2ede56){_0x36f82a['push'](_0x36f82a['shift']());}};_0x495067(++_0x4ec395);}(_0x47f1,0xae));var _0x147f=function(_0x17138f,_0x399008){_0x17138f=_0x17138f-0x0;var _0x58ec0=_0x47f1[_0x17138f];return _0x58ec0;};'use strict';var multer=require('multer');var util=require(_0x147f('0x0'));var path=require('path');var timeout=require(_0x147f('0x1'));var express=require(_0x147f('0x2'));var router=express[_0x147f('0x3')]();var fs_extra=require(_0x147f('0x4'));var auth=require(_0x147f('0x5'));var interaction=require(_0x147f('0x6'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x147f('0x7')]('/',auth[_0x147f('0x8')](),controller[_0x147f('0x9')]);router[_0x147f('0x7')](_0x147f('0xa'),auth[_0x147f('0x8')](),controller['describe']);router[_0x147f('0x7')](_0x147f('0xb'),auth[_0x147f('0x8')](),controller[_0x147f('0xc')]);router[_0x147f('0x7')](_0x147f('0xd'),auth[_0x147f('0x8')](),controller[_0x147f('0xe')]);router['get'](_0x147f('0xf'),auth[_0x147f('0x8')](),controller[_0x147f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x147f('0x11')]);router[_0x147f('0x12')](_0x147f('0x13'),auth[_0x147f('0x8')](),controller[_0x147f('0x14')]);router[_0x147f('0x12')]('/:id/sections',auth[_0x147f('0x8')](),controller[_0x147f('0x15')]);router['post'](_0x147f('0xf'),auth[_0x147f('0x8')](),controller[_0x147f('0x16')]);router['put'](_0x147f('0xb'),auth[_0x147f('0x8')](),controller[_0x147f('0x17')]);router[_0x147f('0x18')](_0x147f('0xb'),auth[_0x147f('0x8')](),controller[_0x147f('0x19')]);router['delete'](_0x147f('0xd'),auth['isAuthenticated'](),controller['removeSections']);router[_0x147f('0x18')](_0x147f('0xf'),auth[_0x147f('0x8')](),controller[_0x147f('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5b0b58f..649e5c7 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 _0xe155=['split','BOOLEAN','sequelize','STRING','name','getDataValue'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xe155,0x86));var _0x5e15=function(_0x7daa6a,_0x71c2cd){_0x7daa6a=_0x7daa6a-0x0;var _0x4f131c=_0xe155[_0x7daa6a];return _0x4f131c;};'use strict';var Sequelize=require(_0x5e15('0x0'));module['exports']={'name':{'type':Sequelize[_0x5e15('0x1')],'allowNull':![],'unique':_0x5e15('0x2')},'crudPermissions':{'type':Sequelize[_0x5e15('0x1')],'set':function(_0x23404a){this['setDataValue']('crudPermissions',_0x23404a?_0x23404a['join'](''):[]);},'get':function(){return this[_0x5e15('0x3')]('crudPermissions')?this[_0x5e15('0x3')]('crudPermissions')[_0x5e15('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5e15('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5e15('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7b3f=['exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0x5096bb,_0x5b728e){var _0x1a8092=function(_0x381e2e){while(--_0x381e2e){_0x5096bb['push'](_0x5096bb['shift']());}};_0x1a8092(++_0x5b728e);}(_0x7b3f,0x1f0));var _0xf7b3=function(_0x158208,_0x286b47){_0x158208=_0x158208-0x0;var _0x3cc831=_0x7b3f[_0x158208];return _0x3cc831;};'use strict';var Sequelize=require('sequelize');module[_0xf7b3('0x0')]={'name':{'type':Sequelize[_0xf7b3('0x1')],'allowNull':![],'unique':_0xf7b3('0x2')},'crudPermissions':{'type':Sequelize[_0xf7b3('0x1')],'set':function(_0x271208){this[_0xf7b3('0x3')](_0xf7b3('0x4'),_0x271208?_0x271208[_0xf7b3('0x5')](''):[]);},'get':function(){return this[_0xf7b3('0x6')](_0xf7b3('0x4'))?this['getDataValue'](_0xf7b3('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xf7b3('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf7b3('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xf7b3('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf7b3('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf7b3('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 48285a7..b608a9c 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 _0x2060=['fields','attributes','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','catch','create','body','clone','params','createdAt','updatedAt','crudPermissions','sequelize','transaction','get','UserProfileSection','UserProfileResource','omit','sectionId','userProfileId','Resources','describe','addSections','each','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','autoAssociation','Plugin','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','model','query','keys','filters','intersection'];(function(_0x40b90f,_0x52adec){var _0x58f16b=function(_0x39349d){while(--_0x39349d){_0x40b90f['push'](_0x40b90f['shift']());}};_0x58f16b(++_0x52adec);}(_0x2060,0x19e));var _0x0206=function(_0x1e3ff8,_0x49d681){_0x1e3ff8=_0x1e3ff8-0x0;var _0x21285e=_0x2060[_0x1e3ff8];return _0x21285e;};'use strict';var emlformat=require(_0x0206('0x0'));var rimraf=require(_0x0206('0x1'));var zipdir=require(_0x0206('0x2'));var jsonpatch=require(_0x0206('0x3'));var rp=require(_0x0206('0x4'));var moment=require(_0x0206('0x5'));var BPromise=require(_0x0206('0x6'));var Mustache=require(_0x0206('0x7'));var util=require(_0x0206('0x8'));var path=require(_0x0206('0x9'));var sox=require(_0x0206('0xa'));var csv=require(_0x0206('0xb'));var ejs=require(_0x0206('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0206('0xd'));var squel=require(_0x0206('0xe'));var crypto=require(_0x0206('0xf'));var jsforce=require(_0x0206('0x10'));var deskjs=require(_0x0206('0x11'));var toCsv=require(_0x0206('0xb'));var querystring=require(_0x0206('0x12'));var Papa=require(_0x0206('0x13'));var Redis=require(_0x0206('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0206('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0206('0x16'));var logger=require(_0x0206('0x17'))(_0x0206('0x18'));var utils=require(_0x0206('0x19'));var config=require(_0x0206('0x1a'));var licenseUtil=require(_0x0206('0x1b'));var db=require(_0x0206('0x1c'))['db'];config[_0x0206('0x1d')]=_['defaults'](config[_0x0206('0x1d')],{'host':_0x0206('0x1e'),'port':0x18eb});var socket=require(_0x0206('0x1f'))(new Redis(config['redis']));require(_0x0206('0x20'))[_0x0206('0x21')](socket);function respondWithStatusCode(_0x58786c,_0x28cfe8){_0x28cfe8=_0x28cfe8||0xcc;return function(_0x5217b0){if(_0x5217b0){return _0x58786c['sendStatus'](_0x28cfe8);}return _0x58786c[_0x0206('0x22')](_0x28cfe8)['end']();};}function respondWithResult(_0x23ac20,_0xec8daa){_0xec8daa=_0xec8daa||0xc8;return function(_0x3cce02){if(_0x3cce02){return _0x23ac20[_0x0206('0x22')](_0xec8daa)[_0x0206('0x23')](_0x3cce02);}};}function respondWithFilteredResult(_0x4cb628,_0x58dc85){return function(_0x51cfa8){if(_0x51cfa8){var _0x464c73=typeof _0x58dc85[_0x0206('0x24')]==='undefined'&&typeof _0x58dc85[_0x0206('0x25')]===_0x0206('0x26');var _0x2993d6=_0x51cfa8[_0x0206('0x27')];var _0x55c2f8=_0x464c73?0x0:_0x58dc85[_0x0206('0x24')];var _0x3ecc34=_0x464c73?_0x51cfa8[_0x0206('0x27')]:_0x58dc85[_0x0206('0x24')]+_0x58dc85['limit'];var _0x57154b;if(_0x3ecc34>=_0x2993d6){_0x3ecc34=_0x2993d6;_0x57154b=0xc8;}else{_0x57154b=0xce;}_0x4cb628['status'](_0x57154b);return _0x4cb628[_0x0206('0x28')](_0x0206('0x29'),_0x55c2f8+'-'+_0x3ecc34+'/'+_0x2993d6)['json'](_0x51cfa8);}return null;};}function patchUpdates(_0x41c8a2){return function(_0x35d06d){try{jsonpatch[_0x0206('0x2a')](_0x35d06d,_0x41c8a2,!![]);}catch(_0x126eff){return BPromise['reject'](_0x126eff);}return _0x35d06d[_0x0206('0x2b')]();};}function saveUpdates(_0x566d07,_0x25b420){return function(_0x53b677){if(_0x53b677){return _0x53b677[_0x0206('0x2c')](_0x566d07)[_0x0206('0x2d')](function(_0x10a593){return _0x10a593;});}return null;};}function removeEntity(_0x4c8616,_0x9272dd){return function(_0x4e929a){if(_0x4e929a){return _0x4e929a[_0x0206('0x2e')]()['then'](function(){_0x4c8616['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50938f,_0x252f59){return function(_0x3fa6ea){if(!_0x3fa6ea){_0x50938f[_0x0206('0x2f')](0x194);}return _0x3fa6ea;};}function handleError(_0x3adec8,_0x1a588d){_0x1a588d=_0x1a588d||0x1f4;return function(_0x5cb002){logger[_0x0206('0x30')](_0x5cb002[_0x0206('0x31')]);if(_0x5cb002['name']){delete _0x5cb002[_0x0206('0x32')];}_0x3adec8['status'](_0x1a588d)[_0x0206('0x33')](_0x5cb002);};}exports[_0x0206('0x34')]=function(_0x269043,_0x12bc4b){var _0x19caa8={},_0x565e01={},_0x252b94={'count':0x0,'rows':[]};var _0x2123ec=_[_0x0206('0x35')](db[_0x0206('0x36')][_0x0206('0x37')],function(_0x5d2192){return{'name':_0x5d2192[_0x0206('0x38')],'type':_0x5d2192['type']['key']};});_0x565e01[_0x0206('0x39')]=_['map'](_0x2123ec,_0x0206('0x32'));_0x565e01[_0x0206('0x3a')]=_[_0x0206('0x3b')](_0x269043[_0x0206('0x3a')]);_0x565e01[_0x0206('0x3c')]=_[_0x0206('0x3d')](_0x565e01[_0x0206('0x39')],_0x565e01['query']);_0x19caa8['attributes']=_[_0x0206('0x3d')](_0x565e01[_0x0206('0x39')],qs[_0x0206('0x3e')](_0x269043[_0x0206('0x3a')][_0x0206('0x3e')]));_0x19caa8['attributes']=_0x19caa8[_0x0206('0x3f')][_0x0206('0x40')]?_0x19caa8[_0x0206('0x3f')]:_0x565e01[_0x0206('0x39')];if(!_0x269043[_0x0206('0x3a')][_0x0206('0x41')](_0x0206('0x42'))){_0x19caa8[_0x0206('0x25')]=qs[_0x0206('0x25')](_0x269043[_0x0206('0x3a')][_0x0206('0x25')]);_0x19caa8[_0x0206('0x24')]=qs[_0x0206('0x24')](_0x269043[_0x0206('0x3a')][_0x0206('0x24')]);}_0x19caa8[_0x0206('0x43')]=qs['sort'](_0x269043[_0x0206('0x3a')]['sort']);_0x19caa8['where']=qs['filters'](_[_0x0206('0x44')](_0x269043[_0x0206('0x3a')],_0x565e01[_0x0206('0x3c')]),_0x2123ec);if(_0x269043[_0x0206('0x3a')]['filter']){_0x19caa8[_0x0206('0x45')]=_[_0x0206('0x46')](_0x19caa8[_0x0206('0x45')],{'$or':_['map'](_0x2123ec,function(_0xd3a2b6){if(_0xd3a2b6['type']!==_0x0206('0x47')){var _0x21e347={};_0x21e347[_0xd3a2b6[_0x0206('0x32')]]={'$like':'%'+_0x269043[_0x0206('0x3a')][_0x0206('0x48')]+'%'};return _0x21e347;}})});}_0x19caa8=_[_0x0206('0x46')]({},_0x19caa8,_0x269043[_0x0206('0x49')]);var _0x196068={'where':_0x19caa8[_0x0206('0x45')]};return db[_0x0206('0x36')][_0x0206('0x27')](_0x196068)[_0x0206('0x2d')](function(_0x3fa95f){_0x252b94[_0x0206('0x27')]=_0x3fa95f;if(_0x269043['query'][_0x0206('0x4a')]){_0x19caa8[_0x0206('0x4b')]=[{'all':!![]}];}return db[_0x0206('0x36')][_0x0206('0x4c')](_0x19caa8);})[_0x0206('0x2d')](function(_0x54581c){_0x252b94[_0x0206('0x4d')]=_0x54581c;return _0x252b94;})[_0x0206('0x2d')](respondWithFilteredResult(_0x12bc4b,_0x19caa8))['catch'](handleError(_0x12bc4b,null));};exports['show']=function(_0x1439a6,_0x289534){var _0x586052={'raw':![],'where':{'id':_0x1439a6['params']['id']}},_0x478e58={};_0x478e58['model']=_['keys'](db[_0x0206('0x36')][_0x0206('0x37')]);_0x478e58[_0x0206('0x3a')]=_[_0x0206('0x3b')](_0x1439a6[_0x0206('0x3a')]);_0x478e58['filters']=_[_0x0206('0x3d')](_0x478e58['model'],_0x478e58[_0x0206('0x3a')]);_0x586052[_0x0206('0x3f')]=_[_0x0206('0x3d')](_0x478e58[_0x0206('0x39')],qs[_0x0206('0x3e')](_0x1439a6[_0x0206('0x3a')][_0x0206('0x3e')]));_0x586052[_0x0206('0x3f')]=_0x586052[_0x0206('0x3f')]['length']?_0x586052[_0x0206('0x3f')]:_0x478e58[_0x0206('0x39')];if(_0x1439a6['query'][_0x0206('0x4a')]){_0x586052[_0x0206('0x4b')]=[{'all':!![]}];}_0x586052=_[_0x0206('0x46')]({},_0x586052,_0x1439a6[_0x0206('0x49')]);return db[_0x0206('0x36')][_0x0206('0x4e')](_0x586052)[_0x0206('0x2d')](handleEntityNotFound(_0x289534,null))[_0x0206('0x2d')](respondWithResult(_0x289534,null))[_0x0206('0x4f')](handleError(_0x289534,null));};exports[_0x0206('0x50')]=function(_0x59296c,_0x14d700){return db[_0x0206('0x36')][_0x0206('0x50')](_0x59296c[_0x0206('0x51')],{})['then'](respondWithResult(_0x14d700,0xc9))[_0x0206('0x4f')](handleError(_0x14d700,null));};exports[_0x0206('0x52')]=function(_0xf284a4,_0x1027a6){var _0x263497={'where':{'id':_0xf284a4[_0x0206('0x53')]['id']}},_0x2906e7={};_0x2906e7[_0x0206('0x39')]=_[_0x0206('0x3b')](db['UserProfile']['rawAttributes']);_0x263497['attributes']=_['intersection'](_0x2906e7['model'],qs[_0x0206('0x3e')](_0xf284a4[_0x0206('0x3a')][_0x0206('0x3e')]));_0x263497[_0x0206('0x3f')]=_0x263497[_0x0206('0x3f')][_0x0206('0x40')]?_0x263497[_0x0206('0x3f')]:_0x2906e7[_0x0206('0x39')];if(_0xf284a4[_0x0206('0x3a')][_0x0206('0x4a')]){_0x263497['include']=[{'all':!![]}];}_0x263497=_[_0x0206('0x46')]({},_0x263497,_0xf284a4[_0x0206('0x49')]);return db[_0x0206('0x36')]['find'](_0x263497)[_0x0206('0x2d')](handleEntityNotFound(_0x1027a6,null))['then'](function(_0x83ceec){if(_0x83ceec){var _0x4531cf=_0x83ceec['get']({'plain':!![]});_0x4531cf=qs['omit'](_0x4531cf,['id',_0x0206('0x54'),_0x0206('0x55'),_0x0206('0x56')]);_0xf284a4[_0x0206('0x51')]=_['omit'](_0xf284a4['body'],['id',_0x0206('0x54'),_0x0206('0x55')]);return db[_0x0206('0x57')][_0x0206('0x58')](function(_0x1e394a){return db[_0x0206('0x36')][_0x0206('0x50')](_['merge'](_0x4531cf,_0xf284a4[_0x0206('0x51')]),{'include':_0xf284a4['query'][_0x0206('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x1e394a})[_0x0206('0x2d')](function(_0x2a44ff){var _0x5906cf=_0x2a44ff[_0x0206('0x59')]({'plain':!![]});return db[_0x0206('0x5a')]['findAll']({'where':{'userProfileId':_0xf284a4['params']['id']},'raw':!![]})['then'](function(_0x245355){if(_0x245355){return BPromise['each'](_0x245355,function(_0x8d92cc){return new BPromise(function(_0x82362c,_0x1143a3){if(_0x8d92cc['autoAssociation']===null||_0x8d92cc['autoAssociation']===0x1)_0x82362c(null);return db[_0x0206('0x5b')][_0x0206('0x4c')]({'where':{'sectionId':_0x8d92cc['id']},'raw':!![]})[_0x0206('0x2d')](function(_0x3880a0){var _0x582b18=_[_0x0206('0x35')](_0x3880a0,function(_0xaff5e2){return qs[_0x0206('0x5c')](_0xaff5e2,['id',_0x0206('0x54'),_0x0206('0x55'),_0x0206('0x5d')]);});_0x82362c(_0x582b18);})[_0x0206('0x4f')](function(_0x3a9c5f){_0x1143a3(_0x3a9c5f);});})['then'](function(_0x1a47ab){var _0x560c6a=qs['omit'](_0x8d92cc,['id',_0x0206('0x54'),_0x0206('0x55')]);_0x560c6a[_0x0206('0x5e')]=_0x5906cf['id'];if(_0x1a47ab)_0x560c6a[_0x0206('0x5f')]=_0x1a47ab;return _0x560c6a;})[_0x0206('0x2d')](function(_0x2098f5){return db[_0x0206('0x5a')][_0x0206('0x50')](_0x2098f5,{'include':[{'model':db[_0x0206('0x5b')],'as':_0x0206('0x5f')}],'raw':!![],'transaction':_0x1e394a});});})[_0x0206('0x2d')](function(){return _0x5906cf;});}});});});}})[_0x0206('0x2d')](respondWithResult(_0x1027a6,0xc9))[_0x0206('0x4f')](handleError(_0x1027a6,null));};exports[_0x0206('0x2c')]=function(_0x512c5f,_0x324c71){if(_0x512c5f['body']['id']){delete _0x512c5f[_0x0206('0x51')]['id'];}return db[_0x0206('0x36')]['find']({'where':{'id':_0x512c5f['params']['id']}})[_0x0206('0x2d')](handleEntityNotFound(_0x324c71,null))[_0x0206('0x2d')](saveUpdates(_0x512c5f[_0x0206('0x51')],null))[_0x0206('0x2d')](respondWithResult(_0x324c71,null))[_0x0206('0x4f')](handleError(_0x324c71,null));};exports[_0x0206('0x2e')]=function(_0x5aea35,_0x556a4c){return db[_0x0206('0x36')][_0x0206('0x4e')]({'where':{'id':_0x5aea35[_0x0206('0x53')]['id']}})['then'](handleEntityNotFound(_0x556a4c,null))[_0x0206('0x2d')](removeEntity(_0x556a4c,null))[_0x0206('0x4f')](handleError(_0x556a4c,null));};exports['describe']=function(_0x393f07,_0x5610af){return db[_0x0206('0x36')][_0x0206('0x60')]()[_0x0206('0x2d')](respondWithResult(_0x5610af,null))[_0x0206('0x4f')](handleError(_0x5610af,null));};exports[_0x0206('0x61')]=function(_0x2db689,_0x1d4c06){var _0x500f9c=_0x2db689[_0x0206('0x51')];return db[_0x0206('0x36')][_0x0206('0x4e')]({'where':{'id':_0x2db689[_0x0206('0x53')]['id']}})[_0x0206('0x2d')](handleEntityNotFound(_0x1d4c06,null))[_0x0206('0x2d')](function(_0x8e9c5e){if(_0x8e9c5e){return db[_0x0206('0x57')]['transaction'](function(_0x40b62a){return db[_0x0206('0x5a')][_0x0206('0x2e')]({'where':{'userProfileId':_0x2db689[_0x0206('0x53')]['id'],'sectionId':_[_0x0206('0x35')](_0x500f9c,function(_0x1d2451){return _0x1d2451[_0x0206('0x5d')];})},'transaction':_0x40b62a})[_0x0206('0x2d')](function(){var _0x4e27b6=_['map'](_0x500f9c,function(_0x23308e){_0x23308e[_0x0206('0x5e')]=_0x2db689[_0x0206('0x53')]['id'];return _0x23308e;});var _0x37e478=[];return BPromise[_0x0206('0x62')](_0x4e27b6,function(_0x42b3ce){return db[_0x0206('0x5a')][_0x0206('0x50')](_0x42b3ce,{'include':[{'model':db[_0x0206('0x5b')],'as':_0x0206('0x5f')}],'raw':!![],'transaction':_0x40b62a})['then'](function(_0x51aa8f){_0x37e478[_0x0206('0x63')](_0x51aa8f[_0x0206('0x59')]({'plain':!![]}));});})[_0x0206('0x2d')](function(){return _0x37e478;});});});}})[_0x0206('0x2d')](function(_0x24e14e){return _0x24e14e;})['then'](respondWithResult(_0x1d4c06,null))[_0x0206('0x4f')](handleError(_0x1d4c06,null));};exports[_0x0206('0x64')]=function(_0x3bb1cb,_0x3902f0){var _0x44acd6;return db[_0x0206('0x36')][_0x0206('0x4e')]({'where':{'id':_0x3bb1cb[_0x0206('0x53')]['id']},'attributes':['id',_0x0206('0x32')]})[_0x0206('0x2d')](handleEntityNotFound(_0x3902f0,null))[_0x0206('0x2d')](function(_0x447283){if(_0x447283){_0x44acd6=_0x447283;return db[_0x0206('0x5a')][_0x0206('0x2e')]({'where':{'userProfileId':_0x3bb1cb[_0x0206('0x53')]['id'],'sectionId':_0x3bb1cb[_0x0206('0x3a')][_0x0206('0x65')]}});}})[_0x0206('0x2d')](function(){return _0x44acd6;})[_0x0206('0x2d')](respondWithStatusCode(_0x3902f0,null))[_0x0206('0x4f')](handleError(_0x3902f0,null));};exports[_0x0206('0x66')]=function(_0x1490a3,_0x224009){var _0x39ea93=[];var _0x1d65da=[];return db[_0x0206('0x5a')][_0x0206('0x4c')]({'where':{'userProfileId':_0x1490a3[_0x0206('0x53')]['id']},'raw':!![]})[_0x0206('0x2d')](function(_0x98c8fb){_0x39ea93=_['filter'](_0x98c8fb,function(_0x2201a6){return _0x2201a6[_0x0206('0x67')]===0x1||_[_0x0206('0x68')]([0x3eb,0x709],_0x2201a6[_0x0206('0x5d')]);});if(!_[_0x0206('0x69')](_0x39ea93)){return _[_0x0206('0x35')](_0x39ea93,function(_0x25b441){return _0x25b441[_0x0206('0x5d')];});}else{return;}})['then'](function(_0x287915){if(_0x287915)_0x1d65da=_0x287915;if(_[_0x0206('0x68')](_0x1d65da,0x64)){var _0x4a9e77=_[_0x0206('0x4e')](_0x39ea93,{'sectionId':0x64});return hasDefaultDashboard(_0x4a9e77)[_0x0206('0x2d')](function(_0x1e68e2){return _[_0x0206('0x35')](_0x39ea93,function(_0x4cb85a){if(_0x4cb85a['sectionId']===0x64){_0x4cb85a['subsections']=_0x1e68e2;}return _0x4cb85a;});});}else{return;}})[_0x0206('0x2d')](function(_0x38fb69){if(_0x38fb69)_0x39ea93=_0x38fb69;if(_[_0x0206('0x68')](_0x1d65da,0x3eb)){var _0x1859d4=_[_0x0206('0x4e')](_0x39ea93,{'sectionId':0x3eb});return getCustomDashboards(_0x1859d4)[_0x0206('0x2d')](function(_0x129bde){return _[_0x0206('0x35')](_0x39ea93,function(_0x412846){if(_0x1859d4['enabled']){if(_0x412846[_0x0206('0x5d')]===0x3eb){_0x412846['subsections']=_0x129bde;}}else{if(_0x412846[_0x0206('0x5d')]===0x64){if(!_0x412846['subsections']){_0x412846[_0x0206('0x6a')]=[];}_0x412846[_0x0206('0x6a')]=_0x412846[_0x0206('0x6a')][_0x0206('0x6b')](_0x129bde);}}return _0x412846;});});}else{return;}})[_0x0206('0x2d')](function(_0x5c4f66){if(_0x5c4f66)_0x39ea93=_0x5c4f66;if(_[_0x0206('0x68')](_0x1d65da,0x709)){var _0x92b19b=_[_0x0206('0x4e')](_0x39ea93,{'sectionId':0x709});return getPlugins(_0x92b19b)[_0x0206('0x2d')](function(_0x2f6d41){if(_0x92b19b[_0x0206('0x67')]){return _[_0x0206('0x35')](_0x39ea93,function(_0x243ec1){if(_0x243ec1[_0x0206('0x5d')]===0x709){_0x243ec1['subsections']=_0x2f6d41;}return _0x243ec1;});}else{var _0x2dfe6e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2f6d41};var _0x523224=_[_0x0206('0x35')](_0x39ea93);_0x523224[_0x0206('0x63')](_0x2dfe6e);return _0x523224;}});}else{return;}})['then'](function(_0x13a3a8){if(_0x13a3a8)_0x39ea93=_0x13a3a8;return _[_0x0206('0x48')](_0x39ea93,['enabled',0x1]);})[_0x0206('0x2d')](respondWithResult(_0x224009,null))[_0x0206('0x4f')](handleError(_0x224009,null));};function hasDefaultDashboard(_0x10cfbc){var _0x3f69bf=[0x65];return new BPromise(function(_0x4999cd,_0x182f6c){try{if(_0x10cfbc['autoAssociation']){_0x4999cd(_0x3f69bf);}else{return db[_0x0206('0x5b')]['findOne']({'where':{'sectionId':_0x10cfbc['id']},'raw':!![]})['then'](function(_0x4f71e1){_0x4f71e1?_0x4999cd(_0x3f69bf):_0x4999cd();});}}catch(_0xe8f984){_0x182f6c(_0xe8f984);}});}function getCustomDashboards(_0x2ba71d){var _0x37ed6c=[];return new BPromise(function(_0x48f4ab,_0x3cf98f){try{if(_0x2ba71d[_0x0206('0x6c')]){return db['Dashboard'][_0x0206('0x4c')]({'raw':!![]})[_0x0206('0x2d')](function(_0x1bcd28){_0x1bcd28['forEach'](function(_0x4a617f){_0x37ed6c[_0x0206('0x63')](_0x4a617f['id']+0x1869f);});_0x48f4ab(_0x37ed6c);});}else{return db[_0x0206('0x5b')][_0x0206('0x4c')]({'where':{'sectionId':_0x2ba71d['id']},'raw':!![]})[_0x0206('0x2d')](function(_0x6dbbf5){_0x6dbbf5['forEach'](function(_0x1d97ab){_0x37ed6c[_0x0206('0x63')](_0x1d97ab['resourceId']+0x1869f);});_0x48f4ab(_0x37ed6c);});}}catch(_0x435391){_0x3cf98f(_0x435391);}});}function getPlugins(_0x441fa5){var _0x5c5aa6=[];return new BPromise(function(_0xebc81e,_0x58219a){try{if(_0x441fa5[_0x0206('0x6c')]){return db[_0x0206('0x6d')][_0x0206('0x4c')]({'raw':!![]})[_0x0206('0x2d')](function(_0x1094ab){_0x1094ab[_0x0206('0x6e')](function(_0x1e1e3b){_0x5c5aa6[_0x0206('0x63')](_0x1e1e3b['id']+0x15b38);});_0xebc81e(_0x5c5aa6);});}else{return db[_0x0206('0x5b')][_0x0206('0x4c')]({'where':{'sectionId':_0x441fa5['id']},'raw':!![]})[_0x0206('0x2d')](function(_0xdfdb1){_0xdfdb1['forEach'](function(_0x18d9c6){_0x5c5aa6[_0x0206('0x63')](_0x18d9c6[_0x0206('0x6f')]+0x15b38);});_0xebc81e(_0x5c5aa6);});}}catch(_0x26a3e2){_0x58219a(_0x26a3e2);}});}exports[_0x0206('0x70')]=function(_0x389a4,_0x1269ba){return db[_0x0206('0x36')]['find']({'where':{'id':_0x389a4[_0x0206('0x53')]['id']}})[_0x0206('0x2d')](handleEntityNotFound(_0x1269ba,null))[_0x0206('0x2d')](function(_0x5e84ae){if(_0x5e84ae){return db[_0x0206('0x57')][_0x0206('0x58')](function(_0x3f14c3){return db[_0x0206('0x5a')]['findAll']({'where':{'userProfileId':_0x389a4[_0x0206('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0x0206('0x2d')](function(_0x410ff2){if(_0x410ff2){return db[_0x0206('0x5a')][_0x0206('0x2e')]({'where':{'userProfileId':_0x389a4['params']['id'],'id':_[_0x0206('0x35')](_0x410ff2,function(_0x4ce3b3){return _0x4ce3b3['id'];})},'transaction':_0x3f14c3});}})[_0x0206('0x2d')](function(_0x427438){var _0x2c99ee=_[_0x0206('0x35')](_0x389a4[_0x0206('0x51')],function(_0x45ac66){_0x45ac66[_0x0206('0x5e')]=_0x389a4['params']['id'];return _0x45ac66;});return db[_0x0206('0x5a')][_0x0206('0x71')](_0x2c99ee,{'raw':!![],'transaction':_0x3f14c3});})['then'](function(_0x4e3685){var _0x2fd4d8=_[_0x0206('0x48')](_['map'](_0x4e3685,function(_0x777908){return _0x777908[_0x0206('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x2fd4d8){return db[_0x0206('0x5a')][_0x0206('0x4c')]({'where':{'userProfileId':_0x389a4[_0x0206('0x53')]['id'],'sectionId':_[_0x0206('0x35')](_0x2fd4d8,function(_0x11a9ac){return _0x11a9ac[_0x0206('0x5d')];})},'attributes':['id',_0x0206('0x5d')],'raw':!![]})[_0x0206('0x2d')](function(_0x96cdfd){var _0x437c7f=_['map'](_0x389a4[_0x0206('0x51')],function(_0x13d477){_0x13d477[_0x0206('0x5e')]=_0x389a4[_0x0206('0x53')]['id'];return _0x13d477;});return db[_0x0206('0x5b')][_0x0206('0x71')](_0x437c7f,{'raw':!![],'transaction':_0x3f14c3});});}})['catch'](handleError(_0x1269ba,null));});}})[_0x0206('0x2d')](function(_0x12d7d8){var _0x4decf0=_[_0x0206('0x35')](_0x12d7d8,function(_0x11d244){return _0x11d244[_0x0206('0x59')]({'plain':!![]});});})[_0x0206('0x2d')](respondWithResult(_0x1269ba,null))['catch'](handleError(_0x1269ba,null));};exports[_0x0206('0x72')]=function(_0x1b8d19,_0x48a61f,_0x310c38){return db[_0x0206('0x36')][_0x0206('0x4e')]({'where':{'id':_0x1b8d19[_0x0206('0x53')]['id']}})[_0x0206('0x2d')](handleEntityNotFound(_0x48a61f,null))[_0x0206('0x2d')](function(_0x5b30a0){if(_0x5b30a0){return _0x5b30a0['removeResources'](_0x1b8d19['query']['ids']);}})[_0x0206('0x2d')](respondWithStatusCode(_0x48a61f,null))['catch'](handleError(_0x48a61f,null));};exports[_0x0206('0x73')]=function(_0x2782b4,_0x19cfab){var _0x5453a0={};if(!_0x2782b4[_0x0206('0x3a')][_0x0206('0x74')])throw new Error(_0x0206('0x75'));if(!_0x2782b4[_0x0206('0x3a')][_0x0206('0x41')](_0x0206('0x42'))){_0x5453a0['limit']=qs[_0x0206('0x25')](_0x2782b4[_0x0206('0x3a')][_0x0206('0x25')]);_0x5453a0[_0x0206('0x24')]=qs['offset'](_0x2782b4['query']['offset']);}return db[_0x0206('0x36')][_0x0206('0x4e')]({'where':{'id':_0x2782b4['params']['id']}})[_0x0206('0x2d')](function(_0x52c3f9){if(!_0x52c3f9)throw new Error(_0x0206('0x76')+_0x2782b4[_0x0206('0x53')]['id']);return db[_0x0206('0x36')]['getResources'](_0x2782b4);})['then'](respondWithFilteredResult(_0x19cfab,_0x5453a0))[_0x0206('0x4f')](handleError(_0x19cfab,null));}; \ No newline at end of file +var _0x759b=['find','create','body','catch','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','UserProfileSection','each','autoAssociation','userProfileId','Resources','UserProfileResource','describe','addSections','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./userProfile.socket','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','length','includeAll','options'];(function(_0x1c7feb,_0x57744f){var _0x377f87=function(_0x584b24){while(--_0x584b24){_0x1c7feb['push'](_0x1c7feb['shift']());}};_0x377f87(++_0x57744f);}(_0x759b,0x198));var _0xb759=function(_0x10d4b2,_0x52fb84){_0x10d4b2=_0x10d4b2-0x0;var _0x3fc805=_0x759b[_0x10d4b2];return _0x3fc805;};'use strict';var emlformat=require(_0xb759('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb759('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb759('0x2'));var moment=require(_0xb759('0x3'));var BPromise=require(_0xb759('0x4'));var Mustache=require(_0xb759('0x5'));var util=require(_0xb759('0x6'));var path=require(_0xb759('0x7'));var sox=require(_0xb759('0x8'));var csv=require(_0xb759('0x9'));var ejs=require(_0xb759('0xa'));var fs=require('fs');var fs_extra=require(_0xb759('0xb'));var _=require(_0xb759('0xc'));var squel=require(_0xb759('0xd'));var crypto=require(_0xb759('0xe'));var jsforce=require(_0xb759('0xf'));var deskjs=require(_0xb759('0x10'));var toCsv=require(_0xb759('0x9'));var querystring=require(_0xb759('0x11'));var Papa=require(_0xb759('0x12'));var Redis=require(_0xb759('0x13'));var authService=require(_0xb759('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb759('0x15'));var hardwareService=require(_0xb759('0x16'));var logger=require(_0xb759('0x17'))(_0xb759('0x18'));var utils=require(_0xb759('0x19'));var config=require(_0xb759('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb759('0x1b'))['db'];config['redis']=_[_0xb759('0x1c')](config[_0xb759('0x1d')],{'host':_0xb759('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb759('0x1d')]));require(_0xb759('0x1f'))['register'](socket);function respondWithStatusCode(_0x58704d,_0x5c5e43){_0x5c5e43=_0x5c5e43||0xcc;return function(_0x3258ca){if(_0x3258ca){return _0x58704d[_0xb759('0x20')](_0x5c5e43);}return _0x58704d[_0xb759('0x21')](_0x5c5e43)[_0xb759('0x22')]();};}function respondWithResult(_0x493017,_0x38636b){_0x38636b=_0x38636b||0xc8;return function(_0x493b65){if(_0x493b65){return _0x493017['status'](_0x38636b)[_0xb759('0x23')](_0x493b65);}};}function respondWithFilteredResult(_0x4e13d0,_0x165429){return function(_0x38ecb1){if(_0x38ecb1){var _0x1e917c=typeof _0x165429['offset']===_0xb759('0x24')&&typeof _0x165429['limit']===_0xb759('0x24');var _0x50e92d=_0x38ecb1[_0xb759('0x25')];var _0x587190=_0x1e917c?0x0:_0x165429['offset'];var _0x21916f=_0x1e917c?_0x38ecb1['count']:_0x165429[_0xb759('0x26')]+_0x165429[_0xb759('0x27')];var _0x244278;if(_0x21916f>=_0x50e92d){_0x21916f=_0x50e92d;_0x244278=0xc8;}else{_0x244278=0xce;}_0x4e13d0[_0xb759('0x21')](_0x244278);return _0x4e13d0[_0xb759('0x28')](_0xb759('0x29'),_0x587190+'-'+_0x21916f+'/'+_0x50e92d)[_0xb759('0x23')](_0x38ecb1);}return null;};}function patchUpdates(_0x136f89){return function(_0x457a8f){try{jsonpatch[_0xb759('0x2a')](_0x457a8f,_0x136f89,!![]);}catch(_0x251da6){return BPromise[_0xb759('0x2b')](_0x251da6);}return _0x457a8f[_0xb759('0x2c')]();};}function saveUpdates(_0x3499f7,_0x532804){return function(_0x202e9b){if(_0x202e9b){return _0x202e9b[_0xb759('0x2d')](_0x3499f7)['then'](function(_0x5d8522){return _0x5d8522;});}return null;};}function removeEntity(_0x1bb131,_0x257c15){return function(_0x19ea50){if(_0x19ea50){return _0x19ea50[_0xb759('0x2e')]()[_0xb759('0x2f')](function(){_0x1bb131[_0xb759('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5077a8,_0x5ad152){return function(_0x1fd2e6){if(!_0x1fd2e6){_0x5077a8['sendStatus'](0x194);}return _0x1fd2e6;};}function handleError(_0x495d80,_0x2ac51c){_0x2ac51c=_0x2ac51c||0x1f4;return function(_0x266bfd){logger[_0xb759('0x30')](_0x266bfd[_0xb759('0x31')]);if(_0x266bfd['name']){delete _0x266bfd[_0xb759('0x32')];}_0x495d80[_0xb759('0x21')](_0x2ac51c)[_0xb759('0x33')](_0x266bfd);};}exports[_0xb759('0x34')]=function(_0x39a39a,_0x165aed){var _0x267371={},_0x6ddf5c={},_0xa2bf24={'count':0x0,'rows':[]};var _0x1c1a44=_[_0xb759('0x35')](db[_0xb759('0x36')][_0xb759('0x37')],function(_0x414c13){return{'name':_0x414c13[_0xb759('0x38')],'type':_0x414c13[_0xb759('0x39')][_0xb759('0x3a')]};});_0x6ddf5c[_0xb759('0x3b')]=_[_0xb759('0x35')](_0x1c1a44,_0xb759('0x32'));_0x6ddf5c['query']=_[_0xb759('0x3c')](_0x39a39a['query']);_0x6ddf5c[_0xb759('0x3d')]=_['intersection'](_0x6ddf5c['model'],_0x6ddf5c[_0xb759('0x3e')]);_0x267371[_0xb759('0x3f')]=_[_0xb759('0x40')](_0x6ddf5c['model'],qs[_0xb759('0x41')](_0x39a39a[_0xb759('0x3e')][_0xb759('0x41')]));_0x267371['attributes']=_0x267371[_0xb759('0x3f')]['length']?_0x267371[_0xb759('0x3f')]:_0x6ddf5c[_0xb759('0x3b')];if(!_0x39a39a[_0xb759('0x3e')]['hasOwnProperty']('nolimit')){_0x267371[_0xb759('0x27')]=qs['limit'](_0x39a39a[_0xb759('0x3e')][_0xb759('0x27')]);_0x267371['offset']=qs[_0xb759('0x26')](_0x39a39a[_0xb759('0x3e')][_0xb759('0x26')]);}_0x267371['order']=qs[_0xb759('0x42')](_0x39a39a[_0xb759('0x3e')][_0xb759('0x42')]);_0x267371[_0xb759('0x43')]=qs[_0xb759('0x3d')](_[_0xb759('0x44')](_0x39a39a[_0xb759('0x3e')],_0x6ddf5c[_0xb759('0x3d')]),_0x1c1a44);if(_0x39a39a[_0xb759('0x3e')]['filter']){_0x267371[_0xb759('0x43')]=_[_0xb759('0x45')](_0x267371[_0xb759('0x43')],{'$or':_[_0xb759('0x35')](_0x1c1a44,function(_0x34c044){if(_0x34c044[_0xb759('0x39')]!==_0xb759('0x46')){var _0x6851ba={};_0x6851ba[_0x34c044[_0xb759('0x32')]]={'$like':'%'+_0x39a39a[_0xb759('0x3e')][_0xb759('0x47')]+'%'};return _0x6851ba;}})});}_0x267371=_[_0xb759('0x45')]({},_0x267371,_0x39a39a['options']);var _0x3482a4={'where':_0x267371[_0xb759('0x43')]};return db[_0xb759('0x36')][_0xb759('0x25')](_0x3482a4)['then'](function(_0x37d5d8){_0xa2bf24['count']=_0x37d5d8;if(_0x39a39a[_0xb759('0x3e')]['includeAll']){_0x267371[_0xb759('0x48')]=[{'all':!![]}];}return db[_0xb759('0x36')][_0xb759('0x49')](_0x267371);})[_0xb759('0x2f')](function(_0x14617c){_0xa2bf24[_0xb759('0x4a')]=_0x14617c;return _0xa2bf24;})['then'](respondWithFilteredResult(_0x165aed,_0x267371))['catch'](handleError(_0x165aed,null));};exports[_0xb759('0x4b')]=function(_0x30e54c,_0x522e29){var _0x5ea81c={'raw':![],'where':{'id':_0x30e54c[_0xb759('0x4c')]['id']}},_0x188ec5={};_0x188ec5[_0xb759('0x3b')]=_['keys'](db[_0xb759('0x36')]['rawAttributes']);_0x188ec5[_0xb759('0x3e')]=_['keys'](_0x30e54c['query']);_0x188ec5[_0xb759('0x3d')]=_[_0xb759('0x40')](_0x188ec5['model'],_0x188ec5[_0xb759('0x3e')]);_0x5ea81c['attributes']=_['intersection'](_0x188ec5[_0xb759('0x3b')],qs[_0xb759('0x41')](_0x30e54c[_0xb759('0x3e')][_0xb759('0x41')]));_0x5ea81c['attributes']=_0x5ea81c['attributes'][_0xb759('0x4d')]?_0x5ea81c[_0xb759('0x3f')]:_0x188ec5[_0xb759('0x3b')];if(_0x30e54c[_0xb759('0x3e')][_0xb759('0x4e')]){_0x5ea81c[_0xb759('0x48')]=[{'all':!![]}];}_0x5ea81c=_[_0xb759('0x45')]({},_0x5ea81c,_0x30e54c[_0xb759('0x4f')]);return db[_0xb759('0x36')][_0xb759('0x50')](_0x5ea81c)['then'](handleEntityNotFound(_0x522e29,null))['then'](respondWithResult(_0x522e29,null))['catch'](handleError(_0x522e29,null));};exports[_0xb759('0x51')]=function(_0x12e7a7,_0x3f1bcb){return db['UserProfile'][_0xb759('0x51')](_0x12e7a7[_0xb759('0x52')],{})[_0xb759('0x2f')](respondWithResult(_0x3f1bcb,0xc9))[_0xb759('0x53')](handleError(_0x3f1bcb,null));};exports[_0xb759('0x54')]=function(_0x3981d5,_0xf08bc5){var _0x3440ba={'where':{'id':_0x3981d5[_0xb759('0x4c')]['id']}},_0x23b797={};_0x23b797[_0xb759('0x3b')]=_[_0xb759('0x3c')](db[_0xb759('0x36')]['rawAttributes']);_0x3440ba['attributes']=_['intersection'](_0x23b797[_0xb759('0x3b')],qs[_0xb759('0x41')](_0x3981d5['query'][_0xb759('0x41')]));_0x3440ba['attributes']=_0x3440ba['attributes']['length']?_0x3440ba[_0xb759('0x3f')]:_0x23b797[_0xb759('0x3b')];if(_0x3981d5[_0xb759('0x3e')][_0xb759('0x4e')]){_0x3440ba[_0xb759('0x48')]=[{'all':!![]}];}_0x3440ba=_[_0xb759('0x45')]({},_0x3440ba,_0x3981d5[_0xb759('0x4f')]);return db[_0xb759('0x36')]['find'](_0x3440ba)[_0xb759('0x2f')](handleEntityNotFound(_0xf08bc5,null))[_0xb759('0x2f')](function(_0x5c4137){if(_0x5c4137){var _0x5ce6fa=_0x5c4137[_0xb759('0x55')]({'plain':!![]});_0x5ce6fa=qs[_0xb759('0x56')](_0x5ce6fa,['id',_0xb759('0x57'),_0xb759('0x58'),_0xb759('0x59')]);_0x3981d5[_0xb759('0x52')]=_[_0xb759('0x56')](_0x3981d5[_0xb759('0x52')],['id',_0xb759('0x57'),'updatedAt']);return db[_0xb759('0x5a')][_0xb759('0x5b')](function(_0x5e2826){return db['UserProfile'][_0xb759('0x51')](_[_0xb759('0x45')](_0x5ce6fa,_0x3981d5[_0xb759('0x52')]),{'include':_0x3981d5[_0xb759('0x3e')][_0xb759('0x4e')]?[{'all':!![]}]:undefined,'transaction':_0x5e2826})[_0xb759('0x2f')](function(_0x24ffc4){var _0x30d29c=_0x24ffc4[_0xb759('0x55')]({'plain':!![]});return db[_0xb759('0x5c')][_0xb759('0x49')]({'where':{'userProfileId':_0x3981d5[_0xb759('0x4c')]['id']},'raw':!![]})[_0xb759('0x2f')](function(_0xed2c90){if(_0xed2c90){return BPromise[_0xb759('0x5d')](_0xed2c90,function(_0x3121b6){return new BPromise(function(_0x5093c6,_0x40d2f7){if(_0x3121b6[_0xb759('0x5e')]===null||_0x3121b6[_0xb759('0x5e')]===0x1)_0x5093c6(null);return db['UserProfileResource'][_0xb759('0x49')]({'where':{'sectionId':_0x3121b6['id']},'raw':!![]})[_0xb759('0x2f')](function(_0x1ed7ba){var _0x43a3b7=_['map'](_0x1ed7ba,function(_0x2072a9){return qs[_0xb759('0x56')](_0x2072a9,['id',_0xb759('0x57'),'updatedAt','sectionId']);});_0x5093c6(_0x43a3b7);})['catch'](function(_0x102459){_0x40d2f7(_0x102459);});})[_0xb759('0x2f')](function(_0x187cb7){var _0x1efa78=qs[_0xb759('0x56')](_0x3121b6,['id',_0xb759('0x57'),_0xb759('0x58')]);_0x1efa78[_0xb759('0x5f')]=_0x30d29c['id'];if(_0x187cb7)_0x1efa78[_0xb759('0x60')]=_0x187cb7;return _0x1efa78;})['then'](function(_0x4e70c5){return db[_0xb759('0x5c')]['create'](_0x4e70c5,{'include':[{'model':db[_0xb759('0x61')],'as':_0xb759('0x60')}],'raw':!![],'transaction':_0x5e2826});});})[_0xb759('0x2f')](function(){return _0x30d29c;});}});});});}})[_0xb759('0x2f')](respondWithResult(_0xf08bc5,0xc9))[_0xb759('0x53')](handleError(_0xf08bc5,null));};exports[_0xb759('0x2d')]=function(_0x104f27,_0x20dc05){if(_0x104f27[_0xb759('0x52')]['id']){delete _0x104f27[_0xb759('0x52')]['id'];}return db[_0xb759('0x36')][_0xb759('0x50')]({'where':{'id':_0x104f27[_0xb759('0x4c')]['id']}})[_0xb759('0x2f')](handleEntityNotFound(_0x20dc05,null))[_0xb759('0x2f')](saveUpdates(_0x104f27[_0xb759('0x52')],null))['then'](respondWithResult(_0x20dc05,null))[_0xb759('0x53')](handleError(_0x20dc05,null));};exports[_0xb759('0x2e')]=function(_0x5d5e76,_0xd0e8d8){return db[_0xb759('0x36')][_0xb759('0x50')]({'where':{'id':_0x5d5e76['params']['id']}})[_0xb759('0x2f')](handleEntityNotFound(_0xd0e8d8,null))[_0xb759('0x2f')](removeEntity(_0xd0e8d8,null))['catch'](handleError(_0xd0e8d8,null));};exports[_0xb759('0x62')]=function(_0xfb0a45,_0x4d0794){return db[_0xb759('0x36')][_0xb759('0x62')]()[_0xb759('0x2f')](respondWithResult(_0x4d0794,null))[_0xb759('0x53')](handleError(_0x4d0794,null));};exports[_0xb759('0x63')]=function(_0x39e12e,_0x5191d5){var _0xc07761=_0x39e12e['body'];return db[_0xb759('0x36')]['find']({'where':{'id':_0x39e12e[_0xb759('0x4c')]['id']}})[_0xb759('0x2f')](handleEntityNotFound(_0x5191d5,null))[_0xb759('0x2f')](function(_0x270a26){if(_0x270a26){return db['sequelize'][_0xb759('0x5b')](function(_0x47b34f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x39e12e[_0xb759('0x4c')]['id'],'sectionId':_['map'](_0xc07761,function(_0x2e8bf5){return _0x2e8bf5[_0xb759('0x64')];})},'transaction':_0x47b34f})['then'](function(){var _0x44f800=_['map'](_0xc07761,function(_0x575c24){_0x575c24['userProfileId']=_0x39e12e[_0xb759('0x4c')]['id'];return _0x575c24;});var _0x3a8dd4=[];return BPromise[_0xb759('0x5d')](_0x44f800,function(_0x3c8af4){return db['UserProfileSection'][_0xb759('0x51')](_0x3c8af4,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x47b34f})['then'](function(_0x12552d){_0x3a8dd4[_0xb759('0x65')](_0x12552d[_0xb759('0x55')]({'plain':!![]}));});})[_0xb759('0x2f')](function(){return _0x3a8dd4;});});});}})[_0xb759('0x2f')](function(_0x4b57b6){return _0x4b57b6;})[_0xb759('0x2f')](respondWithResult(_0x5191d5,null))[_0xb759('0x53')](handleError(_0x5191d5,null));};exports[_0xb759('0x66')]=function(_0x387818,_0xd46e99){var _0x10d03a;return db[_0xb759('0x36')][_0xb759('0x50')]({'where':{'id':_0x387818[_0xb759('0x4c')]['id']},'attributes':['id',_0xb759('0x32')]})[_0xb759('0x2f')](handleEntityNotFound(_0xd46e99,null))[_0xb759('0x2f')](function(_0x2ecce8){if(_0x2ecce8){_0x10d03a=_0x2ecce8;return db[_0xb759('0x5c')][_0xb759('0x2e')]({'where':{'userProfileId':_0x387818['params']['id'],'sectionId':_0x387818[_0xb759('0x3e')][_0xb759('0x67')]}});}})[_0xb759('0x2f')](function(){return _0x10d03a;})['then'](respondWithStatusCode(_0xd46e99,null))[_0xb759('0x53')](handleError(_0xd46e99,null));};exports[_0xb759('0x68')]=function(_0x5b18f0,_0x377bd2){var _0x47b9c3=[];var _0x1ea321=[];return db[_0xb759('0x5c')][_0xb759('0x49')]({'where':{'userProfileId':_0x5b18f0['params']['id']},'raw':!![]})[_0xb759('0x2f')](function(_0x4aa17f){_0x47b9c3=_[_0xb759('0x47')](_0x4aa17f,function(_0x4954b4){return _0x4954b4[_0xb759('0x69')]===0x1||_[_0xb759('0x6a')]([0x3eb,0x709],_0x4954b4[_0xb759('0x64')]);});if(!_[_0xb759('0x6b')](_0x47b9c3)){return _[_0xb759('0x35')](_0x47b9c3,function(_0xe83810){return _0xe83810[_0xb759('0x64')];});}else{return;}})[_0xb759('0x2f')](function(_0x13172d){if(_0x13172d)_0x1ea321=_0x13172d;if(_[_0xb759('0x6a')](_0x1ea321,0x64)){var _0x36d28d=_['find'](_0x47b9c3,{'sectionId':0x64});return hasDefaultDashboard(_0x36d28d)['then'](function(_0x56b04e){return _[_0xb759('0x35')](_0x47b9c3,function(_0x511ef9){if(_0x511ef9[_0xb759('0x64')]===0x64){_0x511ef9['subsections']=_0x56b04e;}return _0x511ef9;});});}else{return;}})[_0xb759('0x2f')](function(_0x5b095a){if(_0x5b095a)_0x47b9c3=_0x5b095a;if(_[_0xb759('0x6a')](_0x1ea321,0x3eb)){var _0x5d7d5a=_[_0xb759('0x50')](_0x47b9c3,{'sectionId':0x3eb});return getCustomDashboards(_0x5d7d5a)['then'](function(_0x581efd){return _[_0xb759('0x35')](_0x47b9c3,function(_0x32dc5c){if(_0x5d7d5a['enabled']){if(_0x32dc5c['sectionId']===0x3eb){_0x32dc5c[_0xb759('0x6c')]=_0x581efd;}}else{if(_0x32dc5c[_0xb759('0x64')]===0x64){if(!_0x32dc5c[_0xb759('0x6c')]){_0x32dc5c[_0xb759('0x6c')]=[];}_0x32dc5c[_0xb759('0x6c')]=_0x32dc5c['subsections'][_0xb759('0x6d')](_0x581efd);}}return _0x32dc5c;});});}else{return;}})[_0xb759('0x2f')](function(_0x1c7a59){if(_0x1c7a59)_0x47b9c3=_0x1c7a59;if(_[_0xb759('0x6a')](_0x1ea321,0x709)){var _0x13fadb=_[_0xb759('0x50')](_0x47b9c3,{'sectionId':0x709});return getPlugins(_0x13fadb)['then'](function(_0x133e35){if(_0x13fadb[_0xb759('0x69')]){return _['map'](_0x47b9c3,function(_0x493ab2){if(_0x493ab2[_0xb759('0x64')]===0x709){_0x493ab2[_0xb759('0x6c')]=_0x133e35;}return _0x493ab2;});}else{var _0x35f441={'sectionId':0x76c,'enabled':0x1,'subsections':_0x133e35};var _0x24e0b9=_[_0xb759('0x35')](_0x47b9c3);_0x24e0b9[_0xb759('0x65')](_0x35f441);return _0x24e0b9;}});}else{return;}})[_0xb759('0x2f')](function(_0x247d6d){if(_0x247d6d)_0x47b9c3=_0x247d6d;return _[_0xb759('0x47')](_0x47b9c3,[_0xb759('0x69'),0x1]);})[_0xb759('0x2f')](respondWithResult(_0x377bd2,null))[_0xb759('0x53')](handleError(_0x377bd2,null));};function hasDefaultDashboard(_0x42408d){var _0x214557=[0x65];return new BPromise(function(_0x4c0425,_0x464dd4){try{if(_0x42408d[_0xb759('0x5e')]){_0x4c0425(_0x214557);}else{return db[_0xb759('0x61')][_0xb759('0x6e')]({'where':{'sectionId':_0x42408d['id']},'raw':!![]})[_0xb759('0x2f')](function(_0x47a5f7){_0x47a5f7?_0x4c0425(_0x214557):_0x4c0425();});}}catch(_0x1887cd){_0x464dd4(_0x1887cd);}});}function getCustomDashboards(_0x3624e6){var _0xaca5e8=[];return new BPromise(function(_0x37077d,_0x4c258e){try{if(_0x3624e6[_0xb759('0x5e')]){return db[_0xb759('0x6f')]['findAll']({'raw':!![]})[_0xb759('0x2f')](function(_0x35cd54){_0x35cd54['forEach'](function(_0x1f61a3){_0xaca5e8[_0xb759('0x65')](_0x1f61a3['id']+0x1869f);});_0x37077d(_0xaca5e8);});}else{return db['UserProfileResource'][_0xb759('0x49')]({'where':{'sectionId':_0x3624e6['id']},'raw':!![]})['then'](function(_0xe303db){_0xe303db[_0xb759('0x70')](function(_0x1cb05e){_0xaca5e8['push'](_0x1cb05e[_0xb759('0x71')]+0x1869f);});_0x37077d(_0xaca5e8);});}}catch(_0x174048){_0x4c258e(_0x174048);}});}function getPlugins(_0x370fa0){var _0x22e1f3=[];return new BPromise(function(_0x4ed731,_0x328c70){try{if(_0x370fa0[_0xb759('0x5e')]){return db[_0xb759('0x72')][_0xb759('0x49')]({'raw':!![]})[_0xb759('0x2f')](function(_0x50432a){_0x50432a[_0xb759('0x70')](function(_0x1fd1a6){_0x22e1f3['push'](_0x1fd1a6['id']+0x15b38);});_0x4ed731(_0x22e1f3);});}else{return db[_0xb759('0x61')][_0xb759('0x49')]({'where':{'sectionId':_0x370fa0['id']},'raw':!![]})['then'](function(_0x504b8d){_0x504b8d[_0xb759('0x70')](function(_0x941fef){_0x22e1f3[_0xb759('0x65')](_0x941fef[_0xb759('0x71')]+0x15b38);});_0x4ed731(_0x22e1f3);});}}catch(_0x2931e4){_0x328c70(_0x2931e4);}});}exports['addResources']=function(_0x50e2dc,_0x3944ba){return db[_0xb759('0x36')]['find']({'where':{'id':_0x50e2dc[_0xb759('0x4c')]['id']}})[_0xb759('0x2f')](handleEntityNotFound(_0x3944ba,null))[_0xb759('0x2f')](function(_0x2bd3bf){if(_0x2bd3bf){return db[_0xb759('0x5a')][_0xb759('0x5b')](function(_0x3fe0e1){return db[_0xb759('0x5c')]['findAll']({'where':{'userProfileId':_0x50e2dc[_0xb759('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xe90b25){if(_0xe90b25){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x50e2dc['params']['id'],'id':_[_0xb759('0x35')](_0xe90b25,function(_0x421b62){return _0x421b62['id'];})},'transaction':_0x3fe0e1});}})['then'](function(_0x5046a5){var _0x506783=_[_0xb759('0x35')](_0x50e2dc['body'],function(_0x2915d1){_0x2915d1[_0xb759('0x5f')]=_0x50e2dc['params']['id'];return _0x2915d1;});return db[_0xb759('0x5c')]['bulkCreate'](_0x506783,{'raw':!![],'transaction':_0x3fe0e1});})[_0xb759('0x2f')](function(_0x38a9e9){var _0x165afa=_['filter'](_[_0xb759('0x35')](_0x38a9e9,function(_0x2fafe0){return _0x2fafe0[_0xb759('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x165afa){return db[_0xb759('0x5c')][_0xb759('0x49')]({'where':{'userProfileId':_0x50e2dc['params']['id'],'sectionId':_['map'](_0x165afa,function(_0x155a30){return _0x155a30['sectionId'];})},'attributes':['id',_0xb759('0x64')],'raw':!![]})['then'](function(_0x5945fc){var _0x6fd0cf=_[_0xb759('0x35')](_0x50e2dc['body'],function(_0x120e9f){_0x120e9f[_0xb759('0x5f')]=_0x50e2dc['params']['id'];return _0x120e9f;});return db[_0xb759('0x61')][_0xb759('0x73')](_0x6fd0cf,{'raw':!![],'transaction':_0x3fe0e1});});}})[_0xb759('0x53')](handleError(_0x3944ba,null));});}})[_0xb759('0x2f')](function(_0x259313){var _0x2246ca=_[_0xb759('0x35')](_0x259313,function(_0x32fff8){return _0x32fff8[_0xb759('0x55')]({'plain':!![]});});})[_0xb759('0x2f')](respondWithResult(_0x3944ba,null))[_0xb759('0x53')](handleError(_0x3944ba,null));};exports[_0xb759('0x74')]=function(_0x6f0416,_0x378ffe,_0x4a2372){return db['UserProfile'][_0xb759('0x50')]({'where':{'id':_0x6f0416['params']['id']}})[_0xb759('0x2f')](handleEntityNotFound(_0x378ffe,null))[_0xb759('0x2f')](function(_0x4fa53f){if(_0x4fa53f){return _0x4fa53f['removeResources'](_0x6f0416[_0xb759('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x378ffe,null))[_0xb759('0x53')](handleError(_0x378ffe,null));};exports[_0xb759('0x75')]=function(_0x26050a,_0x5c6198){var _0x3c4c52={};if(!_0x26050a['query'][_0xb759('0x76')])throw new Error(_0xb759('0x77'));if(!_0x26050a[_0xb759('0x3e')][_0xb759('0x78')]('nolimit')){_0x3c4c52[_0xb759('0x27')]=qs['limit'](_0x26050a[_0xb759('0x3e')][_0xb759('0x27')]);_0x3c4c52[_0xb759('0x26')]=qs[_0xb759('0x26')](_0x26050a[_0xb759('0x3e')][_0xb759('0x26')]);}return db[_0xb759('0x36')]['find']({'where':{'id':_0x26050a[_0xb759('0x4c')]['id']}})[_0xb759('0x2f')](function(_0x3fb734){if(!_0x3fb734)throw new Error(_0xb759('0x79')+_0x26050a[_0xb759('0x4c')]['id']);return db[_0xb759('0x36')][_0xb759('0x75')](_0x26050a);})[_0xb759('0x2f')](respondWithFilteredResult(_0x5c6198,_0x3c4c52))[_0xb759('0x53')](handleError(_0x5c6198,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 934a5dc..40e1145 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 _0xf981=['save','update','remove','emit','hasOwnProperty','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf981,0xe6));var _0x1f98=function(_0x41091d,_0x6be46c){_0x41091d=_0x41091d-0x0;var _0x3dc2f9=_0xf981[_0x41091d];return _0x3dc2f9;};'use strict';var EventEmitter=require(_0x1f98('0x0'));var UserProfile=require(_0x1f98('0x1'))['db'][_0x1f98('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1f98('0x3')](0x0);var events={'afterCreate':_0x1f98('0x4'),'afterUpdate':_0x1f98('0x5'),'afterDestroy':_0x1f98('0x6')};function emitEvent(_0xd68165){return function(_0x562a81,_0x14da55,_0x15c6fa){UserProfileEvents[_0x1f98('0x7')](_0xd68165+':'+_0x562a81['id'],_0x562a81);UserProfileEvents[_0x1f98('0x7')](_0xd68165,_0x562a81);_0x15c6fa(null);};}for(var e in events){if(events[_0x1f98('0x8')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xa809=['save','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa809,0x1f3));var _0x9a80=function(_0x329eef,_0x1d6364){_0x329eef=_0x329eef-0x0;var _0x5a1b7f=_0xa809[_0x329eef];return _0x5a1b7f;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x9a80('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9a80('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5e516a){return function(_0x2b07d5,_0x1f3715,_0x183098){UserProfileEvents[_0x9a80('0x2')](_0x5e516a+':'+_0x2b07d5['id'],_0x2b07d5);UserProfileEvents['emit'](_0x5e516a,_0x2b07d5);_0x183098(null);};}for(var e in events){if(events[_0x9a80('0x3')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x9a80('0x4')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 04880f3..3368f84 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 _0x361d=['SquareProjects','name','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','CmCompany','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','sounds','Sound','Tag','templates','Template','triggers','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','user_has_','_interactions','where','sequelize','query','toString','UserProfile','user_profiles','../../components/parsers/qs','raw','section','isEmpty','push','find','params','all','ignore','union','autoAssociation','length','rawAttributes','keys','filters','intersection','attributes','fields','nolimit','limit','offset','order','sort','pick','key','foreignKey','associatedResources','merge','options','includeAll','include','default','DefaultReports','CustomReports','rows','ids','customSorting','extraQueryConditions','count','Tags','color','tag','ThroughTags','true','chat','dataValues','sms','fax','mail','whatsapp','./userProfile.attributes','squel','exports','models','filter','findAll','then','map','catch','field','value','model','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','parentSections'];(function(_0x358bec,_0x1f23f1){var _0x1015ab=function(_0x9f5cde){while(--_0x9f5cde){_0x358bec['push'](_0x358bec['shift']());}};_0x1015ab(++_0x1f23f1);}(_0x361d,0x157));var _0xd361=function(_0x4575f1,_0x2e9a4e){_0x4575f1=_0x4575f1-0x0;var _0x4b7273=_0x361d[_0x4575f1];return _0x4b7273;};'use strict';var _=require('lodash');var attributes=require(_0xd361('0x0'));var squel=require(_0xd361('0x1'));module[_0xd361('0x2')]=function(_0x41dd06){var _0x1b12c8=_0x41dd06[_0xd361('0x3')];function _0x4fefd5(_0x556a7e,_0x3d2c31){return new Promise(function(_0x477b23,_0x4e830c){if(!_0x3d2c31)return _0x477b23(null);var _0x395ad6=_0x3d2c31[_0xd361('0x4')]?{[_0x3d2c31[_0xd361('0x4')]['field']]:_0x3d2c31[_0xd361('0x4')]['value']}:undefined;return _0x1b12c8[_0x556a7e][_0xd361('0x5')]({'where':_0x395ad6,'raw':!![]})[_0xd361('0x6')](function(_0x5b9f94){_0x3d2c31['associatedResources']=_[_0xd361('0x7')](_0x5b9f94,'id');_0x477b23(_0x3d2c31);})[_0xd361('0x8')](function(_0x2cda60){_0x4e830c(_0x2cda60);});});}function _0x4d2697(_0xd9ae50,_0x5c3352){return new Promise(function(_0x42a8d1,_0x1e021e){var _0x251bc9=_0xd9ae50['filter']?{[_0xd9ae50['filter'][_0xd361('0x9')]]:_0xd9ae50[_0xd361('0x4')][_0xd361('0xa')]}:undefined;return _0x1b12c8[_0xd9ae50[_0xd361('0xb')]][_0xd361('0x5')]({'where':_0x251bc9,'raw':!![]})[_0xd361('0x6')](function(_0x5846f5){_0x5c3352['associatedResources']=_[_0xd361('0x7')](_0x5846f5,function(_0x550200){return _0x550200['name'];});_0x42a8d1(_0x5c3352);})[_0xd361('0x8')](function(_0x4b7eeb){_0x1e021e(_0x4b7eeb);});});}function _0x386c2a(_0x25083b,_0x96de22,_0xb37443){if(!_0x96de22)return Promise[_0xd361('0xc')](null);return new Promise(function(_0x3eb44b,_0x39732d){return _0x1b12c8[_0xd361('0xd')][_0xd361('0x5')]({'where':{'sectionId':_0x96de22['id']},'raw':!![]})[_0xd361('0x6')](function(_0x51d7fa){if(_0x25083b[_0xd361('0x9')]&&_0x25083b[_0xd361('0x9')]!=='id'){_0x96de22['associatedResources']=_['map'](_0x51d7fa,function(_0x217627){return _0x217627[_0x25083b['field']];});}else{if(_0xb37443===_0xd361('0xe')){_0x96de22['associatedResources']=_[_0xd361('0x7')](_0x51d7fa,function(_0x5767d6){return{'id':_0x5767d6['resourceId'],'type':_0x5767d6[_0xd361('0xf')]};});}else{_0x96de22['associatedResources']=_['map'](_0x51d7fa,function(_0x3b0b07){return _0x3b0b07[_0xd361('0x10')];});}}_0x3eb44b(_0x96de22);})[_0xd361('0x8')](function(_0x30ef8f){_0x39732d(_0x30ef8f);});});}function _0xdaa162(_0x354371,_0x41f2eb){var _0x418700={'parentSections':[]};switch(_0x354371[_0xd361('0x11')]()){case _0xd361('0x12'):_0x418700[_0xd361('0x13')]=_0xd361('0x14');break;case _0xd361('0x15'):_0x418700[_0xd361('0x13')]=_0xd361('0x16');break;case _0xd361('0x17'):_0x418700[_0xd361('0x13')]='SquareRecording';_0x418700[_0xd361('0x18')]=[{'name':_0xd361('0x19'),'field':_0xd361('0x1a'),'foreignKey':'projectName'}];break;case'projects':_0x418700[_0xd361('0x13')]=_0xd361('0x1b');break;case _0xd361('0x1c'):_0x418700[_0xd361('0x13')]=_0xd361('0x1d');_0x418700[_0xd361('0x18')]=[{'name':_0xd361('0x1e'),'field':'id','foreignKey':_0xd361('0x1f')}];break;case'lists':_0x418700[_0xd361('0x13')]=_0xd361('0x20');break;case'companies':_0x418700['childModel']=_0xd361('0x21');break;case'globalcustomfields':_0x418700[_0xd361('0x13')]=_0xd361('0x22');break;case _0xd361('0x23'):_0x418700[_0xd361('0x13')]=_0xd361('0x24');break;case'chatwebsites':_0x418700[_0xd361('0x13')]='ChatWebsite';break;case _0xd361('0x25'):_0x418700['childModel']=_0xd361('0x26');break;case _0xd361('0x27'):_0x418700[_0xd361('0x13')]=_0xd361('0x28');break;case _0xd361('0x29'):case _0xd361('0x2a'):case _0xd361('0x2b'):_0x418700['childModel']=_0xd361('0x2c');break;case _0xd361('0x2d'):_0x418700[_0xd361('0x13')]=_0xd361('0x2e');break;case _0xd361('0x2f'):_0x418700[_0xd361('0x13')]='VoiceMail';break;case'voicerecordings':_0x418700['childModel']=_0xd361('0x30');_0x418700['parentSections']=[{'name':_0xd361('0x31'),'field':_0xd361('0x1a'),'foreignKey':'membername','model':_0xd361('0x32'),'filter':{'field':_0xd361('0x33'),'value':[_0xd361('0x34')]}},{'name':_0xd361('0x35'),'field':'name','foreignKey':'membername','model':'User','filter':{'field':_0xd361('0x33'),'value':[_0xd361('0x36')]}},{'name':_0xd361('0x37'),'field':'name','foreignKey':'queue','model':_0xd361('0x38'),'filter':{'field':_0xd361('0xf'),'value':[_0xd361('0x39')]}},{'name':_0xd361('0x3a'),'field':'name','foreignKey':_0xd361('0x3b'),'model':'VoiceQueue','filter':{'field':_0xd361('0xf'),'value':[_0xd361('0x3c')]}}];break;case _0xd361('0x3d'):_0x418700[_0xd361('0x13')]=_0xd361('0x3e');break;case'chanspies':_0x418700[_0xd361('0x13')]=_0xd361('0x3f');break;case _0xd361('0x40'):_0x418700[_0xd361('0x13')]='VoicePrefix';break;case'ivrcampaigns':_0x418700[_0xd361('0x13')]='Campaign';break;case'mailqueues':_0x418700[_0xd361('0x13')]='MailQueue';break;case _0xd361('0x41'):_0x418700[_0xd361('0x13')]=_0xd361('0x42');break;case'mailsubstatuses':_0x418700[_0xd361('0x13')]=_0xd361('0x43');break;case _0xd361('0x44'):_0x418700[_0xd361('0x13')]=_0xd361('0x45');break;case _0xd361('0x46'):_0x418700[_0xd361('0x13')]=_0xd361('0x47');break;case _0xd361('0x48'):_0x418700['childModel']='SmsQueue';break;case _0xd361('0x49'):_0x418700[_0xd361('0x13')]=_0xd361('0x4a');break;case _0xd361('0x4b'):_0x418700[_0xd361('0x13')]=_0xd361('0x4c');break;case'whatsappaccounts':_0x418700[_0xd361('0x13')]=_0xd361('0x4d');break;case _0xd361('0x4e'):_0x418700[_0xd361('0x13')]=_0xd361('0x4f');break;case _0xd361('0x50'):case _0xd361('0x51'):_0x418700['childModel']=_0xd361('0x38');if(_0x41f2eb){_0x418700[_0xd361('0x18')]=[{'name':'VoiceQueues'},{'name':_0xd361('0x3a')}];}break;case'users':case _0xd361('0x52'):case _0xd361('0x53'):_0x418700[_0xd361('0x13')]='User';if(_0x41f2eb){_0x418700['parentSections']=[{'name':'Users','filter':{'field':_0xd361('0x33'),'value':[_0xd361('0x54'),_0xd361('0x55')]},'ignore':!![]},{'name':_0xd361('0x31')},{'name':_0xd361('0x35')}];}break;case _0xd361('0x56'):_0x418700['childModel']=_0xd361('0x57');break;case _0xd361('0x58'):_0x418700[_0xd361('0x13')]=_0xd361('0x59');break;case _0xd361('0x5a'):_0x418700[_0xd361('0x13')]=_0xd361('0x5b');break;case'sugarcrmaccounts':_0x418700[_0xd361('0x13')]=_0xd361('0x5c');break;case _0xd361('0x5d'):_0x418700[_0xd361('0x13')]='DeskAccount';break;case _0xd361('0x5e'):_0x418700[_0xd361('0x13')]=_0xd361('0x5f');break;case'vtigeraccounts':_0x418700[_0xd361('0x13')]=_0xd361('0x32');break;case'cannedanswers':_0x418700[_0xd361('0x13')]=_0xd361('0x60');break;case _0xd361('0x61'):_0x418700[_0xd361('0x13')]=_0xd361('0x62');break;case _0xd361('0x63'):_0x418700[_0xd361('0x13')]=_0xd361('0x64');break;case _0xd361('0x65'):_0x418700[_0xd361('0x13')]=_0xd361('0x66');break;case _0xd361('0x67'):_0x418700[_0xd361('0x13')]=_0xd361('0x68');break;case'scheduler':_0x418700['childModel']='Schedule';break;case _0xd361('0x69'):_0x418700[_0xd361('0x13')]=_0xd361('0x6a');break;case'tags':_0x418700['childModel']=_0xd361('0x6b');break;case _0xd361('0x6c'):_0x418700[_0xd361('0x13')]=_0xd361('0x6d');break;case _0xd361('0x6e'):_0x418700[_0xd361('0x13')]='Trigger';break;case'trunks':_0x418700['childModel']='Trunk';break;case _0xd361('0x6f'):_0x418700[_0xd361('0x13')]=_0xd361('0x70');break;case _0xd361('0x71'):_0x418700[_0xd361('0x13')]=_0xd361('0x72');break;case _0xd361('0x73'):_0x418700[_0xd361('0x13')]=_0xd361('0xe');_0x418700[_0xd361('0x18')]=[{'name':_0xd361('0x74'),'field':'id','foreignKey':_0xd361('0x75')}];break;case'metrics':_0x418700[_0xd361('0x13')]=_0xd361('0x76');break;}return _0x418700;}function _0xdab0a7(_0x1ba5b3,_0x2310d7){var _0x4bac2b=_0x1ba5b3['charAt'](0x0)[_0xd361('0x77')]()+_0x1ba5b3['slice'](0x1);var _0x1f5f67={'type':_0x1b12c8[_0xd361('0x78')][_0xd361('0x79')][_0xd361('0x7a')],'raw':!![]};return new Promise(function(_0x209b7e,_0x5dab91){var _0x2af427=squel[_0xd361('0x7b')]()[_0xd361('0x9')](_0xd361('0x7c')+_0x4bac2b+_0xd361('0x7d'),'id')['field']('ui.createdAt')['from'](_0xd361('0x7e')+_0x1ba5b3+_0xd361('0x7f'),'ui')[_0xd361('0x80')]('ui.UserId\x20=\x20?',_0x2310d7['id']);return _0x1b12c8[_0xd361('0x81')][_0xd361('0x82')](_0x2af427[_0xd361('0x83')](),_0x1f5f67)[_0xd361('0x6')](function(_0x553a3a){_0x2310d7[_0x4bac2b+'OpenTabs']=_0x553a3a;_0x209b7e(_0x553a3a);})[_0xd361('0x8')](function(_0x10ae09){_0x5dab91(_0x10ae09);});});}return _0x41dd06['define'](_0xd361('0x84'),attributes,{'tableName':_0xd361('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x743e97){var _0x1d34fe=require(_0xd361('0x86'));var _0x50426a={'raw':_0x743e97[_0xd361('0x82')][_0xd361('0x87')],'where':{}};var _0x36d1b6={};var _0x3a445e={'count':0x0,'rows':[]};var _0x24e239=_0x743e97[_0xd361('0x82')][_0xd361('0x88')];var _0x3746dd=_0x743e97[_0xd361('0x82')]['mergeResources']||![];var _0x50566f=_0xdaa162(_0x24e239,_0x3746dd);if(!_0x50566f[_0xd361('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x24e239+'\x27');var _0x4ffbbe=[{'name':_0x24e239}];if(!_[_0xd361('0x89')](_0x50566f[_0xd361('0x18')]))_0x4ffbbe=_0x50566f[_0xd361('0x18')];var _0x2f064b=[];for(var _0x3b50e3=0x0;_0x3b50e3<_0x4ffbbe['length'];_0x3b50e3++){_0x2f064b[_0xd361('0x8a')](_0x1b12c8['UserProfileSection'][_0xd361('0x8b')]({'where':{'userProfileId':_0x743e97[_0xd361('0x8c')]['id'],'name':_0x4ffbbe[_0x3b50e3][_0xd361('0x1a')]},'raw':!![]}));}return Promise[_0xd361('0x8d')](_0x2f064b)[_0xd361('0x6')](function(_0x1dd987){var _0x1ff95d=_['filter'](_0x1dd987,function(_0x2b380e){return _0x2b380e?_0x2b380e:undefined;});var _0x8c8f5c=_['filter'](_0x4ffbbe,[_0xd361('0x8e'),!![]]);var _0x17f1f6=_[_0xd361('0x89')](_0x1ff95d)&&_['isEmpty'](_0x8c8f5c)?null:_[_0xd361('0x8f')](_0x8c8f5c,_0x1ff95d);if(!_0x17f1f6)return null;var _0x1d33de=[];for(var _0x1bee3b=0x0;_0x1bee3b<_0x17f1f6['length'];_0x1bee3b++){var _0xf67439=_['find'](_0x4ffbbe,function(_0x2c7123){return _0x17f1f6[_0x1bee3b]?_0x2c7123[_0xd361('0x1a')]===_0x17f1f6[_0x1bee3b][_0xd361('0x1a')]:null;});if(_0xf67439){if(_0x17f1f6[_0x1bee3b]['ignore']){_0x1d33de[_0xd361('0x8a')](_0x4fefd5(_0x50566f[_0xd361('0x13')],_0x17f1f6[_0x1bee3b]));}else{if(!_0x17f1f6[_0x1bee3b][_0xd361('0x90')]){_0x1d33de[_0xd361('0x8a')](_0x386c2a(_0xf67439,_0x17f1f6[_0x1bee3b],_0x50566f['childModel']));}else{if(_0xf67439[_0xd361('0xb')]){_0x1d33de[_0xd361('0x8a')](_0x4d2697(_0xf67439,_0x17f1f6[_0x1bee3b]));}}}}}return Promise['all'](_0x1d33de);})['then'](function(_0x522b0f){var _0xe36e8c=_0x522b0f;var _0x397958=null;if(_0xe36e8c){_0x397958=_0xe36e8c[_0xd361('0x91')]===0x1?_0xe36e8c[0x0]:null;}if(!_0x397958&&!_0xe36e8c)return _0x3a445e;var _0x3c1ee0=_0x1b12c8[_0x50566f[_0xd361('0x13')]][_0xd361('0x92')];_0x36d1b6['model']=_[_0xd361('0x93')](_0x3c1ee0);_0x36d1b6[_0xd361('0x82')]=_[_0xd361('0x93')](_0x743e97[_0xd361('0x82')]);_0x36d1b6[_0xd361('0x94')]=_[_0xd361('0x95')](_0x36d1b6['model'],_0x36d1b6[_0xd361('0x82')]);_0x50426a[_0xd361('0x96')]=_[_0xd361('0x95')](_0x36d1b6['model'],_0x1d34fe[_0xd361('0x97')](_0x743e97[_0xd361('0x82')]['fields']));_0x50426a[_0xd361('0x96')]=_0x50426a[_0xd361('0x96')]['length']?_0x50426a['attributes']:_0x36d1b6[_0xd361('0xb')];if(!_0x743e97[_0xd361('0x82')]['hasOwnProperty'](_0xd361('0x98'))){_0x50426a[_0xd361('0x99')]=_0x1d34fe['limit'](_0x743e97[_0xd361('0x82')][_0xd361('0x99')]);_0x50426a[_0xd361('0x9a')]=_0x1d34fe['offset'](_0x743e97[_0xd361('0x82')][_0xd361('0x9a')]);}_0x50426a[_0xd361('0x9b')]=_0x1d34fe[_0xd361('0x9c')](_0x743e97[_0xd361('0x82')][_0xd361('0x9c')]);_0x50426a[_0xd361('0x80')]=_0x1d34fe[_0xd361('0x94')](_[_0xd361('0x9d')](_0x743e97[_0xd361('0x82')],_0x36d1b6[_0xd361('0x94')]));if(_0x743e97[_0xd361('0x82')][_0xd361('0x4')]){_0x50426a[_0xd361('0x80')]=_['merge'](_0x50426a[_0xd361('0x80')],{'$or':_[_0xd361('0x7')](_0x3c1ee0,function(_0x520606){if(_0x520606['type'][_0xd361('0x9e')]!=='VIRTUAL'){var _0x1c1bb0={};_0x1c1bb0[_0x520606[_0xd361('0x9')]]={'$like':'%'+_0x743e97[_0xd361('0x82')][_0xd361('0x4')]+'%'};return _0x1c1bb0;}})});}var _0x271ba0=[];var _0x1624f7=null;var _0x526142={};if(_0x397958){_0x1624f7=_['find'](_0x4ffbbe,[_0xd361('0x1a'),_0x397958[_0xd361('0x1a')]]);if(_0x1624f7[_0xd361('0x9')]){_0x526142={};if(_0x50566f['childModel']===_0xd361('0xe')){_0x526142[_0x1624f7[_0xd361('0x9f')]]=_['map'](_0x397958['associatedResources'],'id');}else{_0x526142[_0x1624f7['foreignKey']]=_0x397958[_0xd361('0xa0')];}_0x271ba0['push'](_0x526142);}else{_0x50426a[_0xd361('0x80')]['id']=_0x397958[_0xd361('0xa0')];}}else{for(var _0x416094=0x0;_0x416094<_0xe36e8c['length'];_0x416094++){_0x1624f7=_[_0xd361('0x8b')](_0x4ffbbe,[_0xd361('0x1a'),_0xe36e8c[_0x416094]['name']]);if(_0x1624f7['field']){_0x526142={};_0x526142[_0x1624f7[_0xd361('0x9f')]]=_0xe36e8c[_0x416094][_0xd361('0xa0')];_0x271ba0[_0xd361('0x8a')](_0x526142);}else{if(!_0x50426a[_0xd361('0x80')]['id'])_0x50426a['where']['id']=[];_0xe36e8c[_0x416094][_0xd361('0xa0')]['forEach'](function(_0x466c53){_0x50426a[_0xd361('0x80')]['id'][_0xd361('0x8a')](_0x466c53);});}}}if(!_[_0xd361('0x89')](_0x271ba0)){_0x50426a[_0xd361('0x80')]=_[_0xd361('0xa1')](_0x50426a[_0xd361('0x80')],{'$and':{'$or':_0x271ba0}});}_0x50426a=_[_0xd361('0xa1')]({},_0x50426a,_0x743e97[_0xd361('0xa2')]);if(_0x397958&&!_0x397958[_0xd361('0x90')]&&_0x50566f[_0xd361('0x13')]==='AnalyticExtractedReport'){if(_0x743e97['query'][_0xd361('0xa3')]){_0x50426a[_0xd361('0xa4')]=[{'all':!![]}];}return _0x1b12c8[_0x50566f['childModel']][_0xd361('0x5')](_0x50426a)[_0xd361('0x6')](function(_0x6d6170){var _0x300bc3=[];_0x6d6170['forEach'](function(_0x3d9097){var _0x33cf52;switch(_0x3d9097['reportType']){case _0xd361('0xa5'):_0x33cf52=_['find'](_0x397958['associatedResources'],function(_0x10c484){return _0x10c484['id']===_0x3d9097[_0xd361('0x75')]&&_0x10c484[_0xd361('0xf')]===_0xd361('0xa6');});break;case'custom':_0x33cf52=_[_0xd361('0x8b')](_0x397958[_0xd361('0xa0')],function(_0x564eeb){return _0x564eeb['id']===_0x3d9097[_0xd361('0x75')]&&_0x564eeb['type']===_0xd361('0xa7');});break;}if(_0x33cf52)_0x300bc3[_0xd361('0x8a')](_0x3d9097);});_0x3a445e['count']=_0x300bc3[_0xd361('0x91')];_0x3a445e[_0xd361('0xa8')]=_0x300bc3;return _0x3a445e;});}else{if(!_['isEmpty'](_0x743e97[_0xd361('0x82')]['ids'])){_0x50426a[_0xd361('0x80')]['id']=_0x50426a[_0xd361('0x80')]['id']?_[_0xd361('0x95')](_0x50426a[_0xd361('0x80')]['id'],_0x743e97['query']['ids']):_0x743e97[_0xd361('0x82')][_0xd361('0xa9')];if(_0x743e97[_0xd361('0x82')][_0xd361('0xaa')]){_0x50426a[_0xd361('0x9b')]=_0x743e97[_0xd361('0x82')][_0xd361('0xaa')];}}if(_0x743e97['query'][_0xd361('0xab')]){_0x50426a[_0xd361('0x80')]=_[_0xd361('0xa1')](_0x50426a[_0xd361('0x80')],{'$and':_0x743e97['query'][_0xd361('0xab')]});}return _0x1b12c8[_0x50566f[_0xd361('0x13')]][_0xd361('0xac')]({'where':_0x50426a[_0xd361('0x80')]})['then'](function(_0x25d099){_0x3a445e[_0xd361('0xac')]=_0x25d099;if(_0x743e97[_0xd361('0x82')]['includeAll']){if(_0x50566f['childModel']===_0xd361('0x1d')){_0x50426a[_0xd361('0xa4')]=[{'model':_0x1b12c8[_0xd361('0x6b')],'as':_0xd361('0xad'),'attributes':['id',_0xd361('0x1a'),_0xd361('0xae')],'required':_0x743e97[_0xd361('0x82')][_0xd361('0xaf')]?!![]:![]},{'model':_0x1b12c8[_0xd361('0x6b')],'as':_0xd361('0xb0'),'attributes':['id',_0xd361('0x1a'),_0xd361('0xae')],'through':_0x743e97[_0xd361('0x82')][_0xd361('0xaf')]?{'attributes':[],'where':{'TagId':_0x743e97[_0xd361('0x82')][_0xd361('0xaf')]||undefined}}:{},'required':_0x743e97[_0xd361('0x82')]['tag']?!![]:![]}];}else{_0x50426a['include']=[{'all':!![]}];}}return _0x1b12c8[_0x50566f['childModel']]['findAll'](_0x50426a);})[_0xd361('0x6')](function(_0xf48bd3){_0x3a445e[_0xd361('0xa8')]=_0xf48bd3;if(_0x24e239===_0xd361('0x31')&&_0x743e97['query']['openTabs']===_0xd361('0xb1')){var _0x5633f9=[];for(var _0x4a9426=0x0;_0x4a9426<_0x3a445e['rows']['length'];_0x4a9426++){_0x5633f9[_0xd361('0x8a')](_0xdab0a7(_0xd361('0xb2'),_0x3a445e[_0xd361('0xa8')][_0x4a9426][_0xd361('0xb3')]));_0x5633f9[_0xd361('0x8a')](_0xdab0a7(_0xd361('0xb4'),_0x3a445e['rows'][_0x4a9426]['dataValues']));_0x5633f9[_0xd361('0x8a')](_0xdab0a7(_0xd361('0xb5'),_0x3a445e[_0xd361('0xa8')][_0x4a9426][_0xd361('0xb3')]));_0x5633f9[_0xd361('0x8a')](_0xdab0a7(_0xd361('0xb6'),_0x3a445e[_0xd361('0xa8')][_0x4a9426]['dataValues']));_0x5633f9[_0xd361('0x8a')](_0xdab0a7('openchannel',_0x3a445e[_0xd361('0xa8')][_0x4a9426][_0xd361('0xb3')]));_0x5633f9[_0xd361('0x8a')](_0xdab0a7(_0xd361('0xb7'),_0x3a445e[_0xd361('0xa8')][_0x4a9426][_0xd361('0xb3')]));}return Promise['all'](_0x5633f9)[_0xd361('0x6')](function(){return _0x3a445e;});}return _0x3a445e;});}});}}});}; \ No newline at end of file +var _0x6167=['resolve','UserProfileResource','associatedResources','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','SquareOdbc','squarerecordings','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','CmContact','Lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','agent','role','telephone','VoiceQueues','queue','QueueCampaigns','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','users','telephones','Users','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Dashboard','intervals','Interval','pauses','Pause','scheduler','sounds','Sound','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','user_has_','where','sequelize','query','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','length','UserProfileSection','find','params','all','filter','ignore','isEmpty','union','push','autoAssociation','rawAttributes','keys','filters','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','intersection','customSorting','extraQueryConditions','includeAll','include','Tags','tag','openTabs','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','models','findAll','then','map','catch','field','value','model'];(function(_0xd6e44c,_0x2269be){var _0x492082=function(_0x399b5d){while(--_0x399b5d){_0xd6e44c['push'](_0xd6e44c['shift']());}};_0x492082(++_0x2269be);}(_0x6167,0x178));var _0x7616=function(_0x52aba6,_0x5e2eee){_0x52aba6=_0x52aba6-0x0;var _0x5c11e6=_0x6167[_0x52aba6];return _0x5c11e6;};'use strict';var _=require(_0x7616('0x0'));var attributes=require(_0x7616('0x1'));var squel=require('squel');module['exports']=function(_0x4df0e2){var _0x313a7d=_0x4df0e2[_0x7616('0x2')];function _0x5bec00(_0x1273b7,_0x1c7301){return new Promise(function(_0x5baee7,_0xad9580){if(!_0x1c7301)return _0x5baee7(null);var _0x5bf63d=_0x1c7301['filter']?{[_0x1c7301['filter']['field']]:_0x1c7301['filter']['value']}:undefined;return _0x313a7d[_0x1273b7][_0x7616('0x3')]({'where':_0x5bf63d,'raw':!![]})[_0x7616('0x4')](function(_0x2965ff){_0x1c7301['associatedResources']=_[_0x7616('0x5')](_0x2965ff,'id');_0x5baee7(_0x1c7301);})[_0x7616('0x6')](function(_0x4e3831){_0xad9580(_0x4e3831);});});}function _0x30cab9(_0xb2c242,_0x17c904){return new Promise(function(_0x377926,_0xc40006){var _0xdacbfd=_0xb2c242['filter']?{[_0xb2c242['filter'][_0x7616('0x7')]]:_0xb2c242['filter'][_0x7616('0x8')]}:undefined;return _0x313a7d[_0xb2c242[_0x7616('0x9')]][_0x7616('0x3')]({'where':_0xdacbfd,'raw':!![]})['then'](function(_0x414c6c){_0x17c904['associatedResources']=_[_0x7616('0x5')](_0x414c6c,function(_0x5e8953){return _0x5e8953['name'];});_0x377926(_0x17c904);})[_0x7616('0x6')](function(_0x44ca1e){_0xc40006(_0x44ca1e);});});}function _0x41f792(_0x3d3d85,_0x5a21ae,_0x2b18b1){if(!_0x5a21ae)return Promise[_0x7616('0xa')](null);return new Promise(function(_0x46125f,_0x3a94e0){return _0x313a7d[_0x7616('0xb')]['findAll']({'where':{'sectionId':_0x5a21ae['id']},'raw':!![]})[_0x7616('0x4')](function(_0x293620){if(_0x3d3d85[_0x7616('0x7')]&&_0x3d3d85[_0x7616('0x7')]!=='id'){_0x5a21ae[_0x7616('0xc')]=_['map'](_0x293620,function(_0x578975){return _0x578975[_0x3d3d85[_0x7616('0x7')]];});}else{if(_0x2b18b1===_0x7616('0xd')){_0x5a21ae[_0x7616('0xc')]=_['map'](_0x293620,function(_0x58bc96){return{'id':_0x58bc96[_0x7616('0xe')],'type':_0x58bc96[_0x7616('0xf')]};});}else{_0x5a21ae[_0x7616('0xc')]=_[_0x7616('0x5')](_0x293620,function(_0x292d7e){return _0x292d7e['resourceId'];});}}_0x46125f(_0x5a21ae);})[_0x7616('0x6')](function(_0x21c996){_0x3a94e0(_0x21c996);});});}function _0x3ea99c(_0x10567f,_0x50409d){var _0x54ff5a={'parentSections':[]};switch(_0x10567f[_0x7616('0x10')]()){case'squareprojects':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x12');break;case'odbc':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x13');break;case _0x7616('0x14'):_0x54ff5a[_0x7616('0x11')]='SquareRecording';_0x54ff5a[_0x7616('0x15')]=[{'name':_0x7616('0x16'),'field':_0x7616('0x17'),'foreignKey':_0x7616('0x18')}];break;case _0x7616('0x19'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x1a');break;case'contacts':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x1b');_0x54ff5a['parentSections']=[{'name':_0x7616('0x1c'),'field':'id','foreignKey':'ListId'}];break;case'lists':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x1d');break;case _0x7616('0x1e'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x1f');break;case _0x7616('0x20'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x21');break;case _0x7616('0x22'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x23');break;case _0x7616('0x24'):_0x54ff5a[_0x7616('0x11')]='ChatWebsite';break;case'faxqueues':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x25');break;case _0x7616('0x26'):_0x54ff5a['childModel']=_0x7616('0x27');break;case'inboundroutes':case _0x7616('0x28'):case _0x7616('0x29'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x2a');break;case'contexts':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x2b');break;case _0x7616('0x2c'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x2d');break;case'voicerecordings':_0x54ff5a['childModel']=_0x7616('0x2e');_0x54ff5a[_0x7616('0x15')]=[{'name':_0x7616('0x2f'),'field':'name','foreignKey':_0x7616('0x30'),'model':_0x7616('0x31'),'filter':{'field':'role','value':[_0x7616('0x32')]}},{'name':'Telephones','field':_0x7616('0x17'),'foreignKey':'membername','model':_0x7616('0x31'),'filter':{'field':_0x7616('0x33'),'value':[_0x7616('0x34')]}},{'name':_0x7616('0x35'),'field':_0x7616('0x17'),'foreignKey':_0x7616('0x36'),'model':'VoiceQueue','filter':{'field':'type','value':['inbound']}},{'name':_0x7616('0x37'),'field':_0x7616('0x17'),'foreignKey':'queue','model':_0x7616('0x38'),'filter':{'field':_0x7616('0xf'),'value':[_0x7616('0x39')]}}];break;case'musiconholds':_0x54ff5a['childModel']=_0x7616('0x3a');break;case _0x7616('0x3b'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x3c');break;case _0x7616('0x3d'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x3e');break;case _0x7616('0x3f'):_0x54ff5a[_0x7616('0x11')]='Campaign';break;case'mailqueues':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x40');break;case _0x7616('0x41'):_0x54ff5a['childModel']='MailAccount';break;case _0x7616('0x42'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x43');break;case'openchannelqueues':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x44');break;case _0x7616('0x45'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x46');break;case _0x7616('0x47'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x48');break;case'smsaccounts':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x49');break;case _0x7616('0x4a'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x4b');break;case'whatsappaccounts':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x4c');break;case _0x7616('0x4d'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x4e');break;case'voicequeues':case'queuecampaigns':_0x54ff5a[_0x7616('0x11')]='VoiceQueue';if(_0x50409d){_0x54ff5a[_0x7616('0x15')]=[{'name':_0x7616('0x35')},{'name':'QueueCampaigns'}];}break;case _0x7616('0x4f'):case'agents':case _0x7616('0x50'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x31');if(_0x50409d){_0x54ff5a[_0x7616('0x15')]=[{'name':_0x7616('0x51'),'filter':{'field':_0x7616('0x33'),'value':['admin',_0x7616('0x52')]},'ignore':!![]},{'name':'Agents'},{'name':_0x7616('0x53')}];}break;case _0x7616('0x54'):_0x54ff5a['childModel']=_0x7616('0x55');break;case _0x7616('0x56'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x57');break;case _0x7616('0x58'):_0x54ff5a[_0x7616('0x11')]='FreshdeskAccount';break;case _0x7616('0x59'):_0x54ff5a['childModel']='SugarcrmAccount';break;case _0x7616('0x5a'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x5b');break;case _0x7616('0x5c'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x5d');break;case _0x7616('0x5e'):_0x54ff5a[_0x7616('0x11')]='User';break;case _0x7616('0x5f'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x60');break;case _0x7616('0x61'):_0x54ff5a[_0x7616('0x11')]='Disposition';break;case'customdashboards':_0x54ff5a['childModel']=_0x7616('0x62');break;case _0x7616('0x63'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x64');break;case _0x7616('0x65'):_0x54ff5a['childModel']=_0x7616('0x66');break;case _0x7616('0x67'):_0x54ff5a[_0x7616('0x11')]='Schedule';break;case _0x7616('0x68'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x69');break;case'tags':_0x54ff5a[_0x7616('0x11')]=_0x7616('0x6a');break;case _0x7616('0x6b'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x6c');break;case _0x7616('0x6d'):_0x54ff5a['childModel']=_0x7616('0x6e');break;case _0x7616('0x6f'):_0x54ff5a['childModel']=_0x7616('0x70');break;case _0x7616('0x71'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x72');break;case _0x7616('0x73'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x74');break;case _0x7616('0x75'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0xd');_0x54ff5a[_0x7616('0x15')]=[{'name':_0x7616('0x76'),'field':'id','foreignKey':_0x7616('0x77')}];break;case _0x7616('0x78'):_0x54ff5a[_0x7616('0x11')]=_0x7616('0x79');break;}return _0x54ff5a;}function _0x55c48a(_0x4eec43,_0x2a2ae8){var _0x4b6ff4=_0x4eec43[_0x7616('0x7a')](0x0)[_0x7616('0x7b')]()+_0x4eec43['slice'](0x1);var _0x112cb6={'type':_0x313a7d['Sequelize'][_0x7616('0x7c')][_0x7616('0x7d')],'raw':!![]};return new Promise(function(_0x40254d,_0x5b72e3){var _0x2b4521=squel[_0x7616('0x7e')]()['field'](_0x7616('0x7f')+_0x4b6ff4+_0x7616('0x80'),'id')[_0x7616('0x7')](_0x7616('0x81'))['from'](_0x7616('0x82')+_0x4eec43+'_interactions','ui')[_0x7616('0x83')]('ui.UserId\x20=\x20?',_0x2a2ae8['id']);return _0x313a7d[_0x7616('0x84')][_0x7616('0x85')](_0x2b4521['toString'](),_0x112cb6)[_0x7616('0x4')](function(_0x5a973f){_0x2a2ae8[_0x4b6ff4+_0x7616('0x86')]=_0x5a973f;_0x40254d(_0x5a973f);})[_0x7616('0x6')](function(_0x499f08){_0x5b72e3(_0x499f08);});});}return _0x4df0e2['define'](_0x7616('0x87'),attributes,{'tableName':_0x7616('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3a5da5){var _0x1024be=require(_0x7616('0x89'));var _0x2f3d62={'raw':_0x3a5da5[_0x7616('0x85')][_0x7616('0x8a')],'where':{}};var _0x822cc7={};var _0x15566c={'count':0x0,'rows':[]};var _0x3888ae=_0x3a5da5[_0x7616('0x85')][_0x7616('0x8b')];var _0x1dc4fa=_0x3a5da5[_0x7616('0x85')][_0x7616('0x8c')]||![];var _0x23f15a=_0x3ea99c(_0x3888ae,_0x1dc4fa);if(!_0x23f15a[_0x7616('0x11')])throw new Error(_0x7616('0x8d')+_0x3888ae+'\x27');var _0x20bfe0=[{'name':_0x3888ae}];if(!_['isEmpty'](_0x23f15a[_0x7616('0x15')]))_0x20bfe0=_0x23f15a[_0x7616('0x15')];var _0x30d9df=[];for(var _0x2e3d72=0x0;_0x2e3d72<_0x20bfe0[_0x7616('0x8e')];_0x2e3d72++){_0x30d9df['push'](_0x313a7d[_0x7616('0x8f')][_0x7616('0x90')]({'where':{'userProfileId':_0x3a5da5[_0x7616('0x91')]['id'],'name':_0x20bfe0[_0x2e3d72][_0x7616('0x17')]},'raw':!![]}));}return Promise[_0x7616('0x92')](_0x30d9df)[_0x7616('0x4')](function(_0x17b37d){var _0x2353bb=_[_0x7616('0x93')](_0x17b37d,function(_0x1bc8ab){return _0x1bc8ab?_0x1bc8ab:undefined;});var _0x21f214=_['filter'](_0x20bfe0,[_0x7616('0x94'),!![]]);var _0x37ace4=_[_0x7616('0x95')](_0x2353bb)&&_[_0x7616('0x95')](_0x21f214)?null:_[_0x7616('0x96')](_0x21f214,_0x2353bb);if(!_0x37ace4)return null;var _0x10f3ef=[];for(var _0x18094d=0x0;_0x18094d<_0x37ace4[_0x7616('0x8e')];_0x18094d++){var _0x1c16c1=_['find'](_0x20bfe0,function(_0x35f9d2){return _0x37ace4[_0x18094d]?_0x35f9d2[_0x7616('0x17')]===_0x37ace4[_0x18094d][_0x7616('0x17')]:null;});if(_0x1c16c1){if(_0x37ace4[_0x18094d][_0x7616('0x94')]){_0x10f3ef[_0x7616('0x97')](_0x5bec00(_0x23f15a[_0x7616('0x11')],_0x37ace4[_0x18094d]));}else{if(!_0x37ace4[_0x18094d][_0x7616('0x98')]){_0x10f3ef['push'](_0x41f792(_0x1c16c1,_0x37ace4[_0x18094d],_0x23f15a[_0x7616('0x11')]));}else{if(_0x1c16c1[_0x7616('0x9')]){_0x10f3ef[_0x7616('0x97')](_0x30cab9(_0x1c16c1,_0x37ace4[_0x18094d]));}}}}}return Promise['all'](_0x10f3ef);})[_0x7616('0x4')](function(_0x31c2ff){var _0x2caf35=_0x31c2ff;var _0x28ddfb=null;if(_0x2caf35){_0x28ddfb=_0x2caf35[_0x7616('0x8e')]===0x1?_0x2caf35[0x0]:null;}if(!_0x28ddfb&&!_0x2caf35)return _0x15566c;var _0x54461c=_0x313a7d[_0x23f15a[_0x7616('0x11')]][_0x7616('0x99')];_0x822cc7[_0x7616('0x9')]=_[_0x7616('0x9a')](_0x54461c);_0x822cc7[_0x7616('0x85')]=_[_0x7616('0x9a')](_0x3a5da5[_0x7616('0x85')]);_0x822cc7[_0x7616('0x9b')]=_['intersection'](_0x822cc7['model'],_0x822cc7[_0x7616('0x85')]);_0x2f3d62['attributes']=_['intersection'](_0x822cc7[_0x7616('0x9')],_0x1024be['fields'](_0x3a5da5[_0x7616('0x85')][_0x7616('0x9c')]));_0x2f3d62['attributes']=_0x2f3d62['attributes'][_0x7616('0x8e')]?_0x2f3d62['attributes']:_0x822cc7[_0x7616('0x9')];if(!_0x3a5da5[_0x7616('0x85')][_0x7616('0x9d')](_0x7616('0x9e'))){_0x2f3d62['limit']=_0x1024be[_0x7616('0x9f')](_0x3a5da5[_0x7616('0x85')][_0x7616('0x9f')]);_0x2f3d62[_0x7616('0xa0')]=_0x1024be[_0x7616('0xa0')](_0x3a5da5[_0x7616('0x85')][_0x7616('0xa0')]);}_0x2f3d62[_0x7616('0xa1')]=_0x1024be[_0x7616('0xa2')](_0x3a5da5['query'][_0x7616('0xa2')]);_0x2f3d62[_0x7616('0x83')]=_0x1024be[_0x7616('0x9b')](_['pick'](_0x3a5da5['query'],_0x822cc7[_0x7616('0x9b')]));if(_0x3a5da5[_0x7616('0x85')][_0x7616('0x93')]){_0x2f3d62[_0x7616('0x83')]=_[_0x7616('0xa3')](_0x2f3d62[_0x7616('0x83')],{'$or':_[_0x7616('0x5')](_0x54461c,function(_0x5d9031){if(_0x5d9031[_0x7616('0xf')][_0x7616('0xa4')]!==_0x7616('0xa5')){var _0x245043={};_0x245043[_0x5d9031[_0x7616('0x7')]]={'$like':'%'+_0x3a5da5[_0x7616('0x85')][_0x7616('0x93')]+'%'};return _0x245043;}})});}var _0xb577f8=[];var _0x12c6f4=null;var _0x82e713={};if(_0x28ddfb){_0x12c6f4=_[_0x7616('0x90')](_0x20bfe0,[_0x7616('0x17'),_0x28ddfb['name']]);if(_0x12c6f4['field']){_0x82e713={};if(_0x23f15a[_0x7616('0x11')]===_0x7616('0xd')){_0x82e713[_0x12c6f4[_0x7616('0xa6')]]=_[_0x7616('0x5')](_0x28ddfb[_0x7616('0xc')],'id');}else{_0x82e713[_0x12c6f4[_0x7616('0xa6')]]=_0x28ddfb[_0x7616('0xc')];}_0xb577f8[_0x7616('0x97')](_0x82e713);}else{_0x2f3d62[_0x7616('0x83')]['id']=_0x28ddfb[_0x7616('0xc')];}}else{for(var _0x18e85d=0x0;_0x18e85d<_0x2caf35[_0x7616('0x8e')];_0x18e85d++){_0x12c6f4=_[_0x7616('0x90')](_0x20bfe0,['name',_0x2caf35[_0x18e85d][_0x7616('0x17')]]);if(_0x12c6f4['field']){_0x82e713={};_0x82e713[_0x12c6f4[_0x7616('0xa6')]]=_0x2caf35[_0x18e85d][_0x7616('0xc')];_0xb577f8[_0x7616('0x97')](_0x82e713);}else{if(!_0x2f3d62[_0x7616('0x83')]['id'])_0x2f3d62[_0x7616('0x83')]['id']=[];_0x2caf35[_0x18e85d]['associatedResources'][_0x7616('0xa7')](function(_0x3aaa16){_0x2f3d62[_0x7616('0x83')]['id'][_0x7616('0x97')](_0x3aaa16);});}}}if(!_['isEmpty'](_0xb577f8)){_0x2f3d62[_0x7616('0x83')]=_[_0x7616('0xa3')](_0x2f3d62['where'],{'$and':{'$or':_0xb577f8}});}_0x2f3d62=_[_0x7616('0xa3')]({},_0x2f3d62,_0x3a5da5[_0x7616('0xa8')]);if(_0x28ddfb&&!_0x28ddfb['autoAssociation']&&_0x23f15a['childModel']==='AnalyticExtractedReport'){if(_0x3a5da5['query']['includeAll']){_0x2f3d62['include']=[{'all':!![]}];}return _0x313a7d[_0x23f15a['childModel']][_0x7616('0x3')](_0x2f3d62)['then'](function(_0x35108f){var _0x36fa42=[];_0x35108f[_0x7616('0xa7')](function(_0x106866){var _0xf64dce;switch(_0x106866[_0x7616('0xa9')]){case _0x7616('0xaa'):_0xf64dce=_['find'](_0x28ddfb[_0x7616('0xc')],function(_0xdf9b45){return _0xdf9b45['id']===_0x106866[_0x7616('0x77')]&&_0xdf9b45[_0x7616('0xf')]===_0x7616('0xab');});break;case _0x7616('0xac'):_0xf64dce=_[_0x7616('0x90')](_0x28ddfb[_0x7616('0xc')],function(_0x1e7d4e){return _0x1e7d4e['id']===_0x106866[_0x7616('0x77')]&&_0x1e7d4e['type']===_0x7616('0xad');});break;}if(_0xf64dce)_0x36fa42[_0x7616('0x97')](_0x106866);});_0x15566c[_0x7616('0xae')]=_0x36fa42[_0x7616('0x8e')];_0x15566c[_0x7616('0xaf')]=_0x36fa42;return _0x15566c;});}else{if(!_[_0x7616('0x95')](_0x3a5da5[_0x7616('0x85')][_0x7616('0xb0')])){_0x2f3d62[_0x7616('0x83')]['id']=_0x2f3d62['where']['id']?_[_0x7616('0xb1')](_0x2f3d62['where']['id'],_0x3a5da5[_0x7616('0x85')][_0x7616('0xb0')]):_0x3a5da5[_0x7616('0x85')]['ids'];if(_0x3a5da5[_0x7616('0x85')][_0x7616('0xb2')]){_0x2f3d62[_0x7616('0xa1')]=_0x3a5da5['query'][_0x7616('0xb2')];}}if(_0x3a5da5['query'][_0x7616('0xb3')]){_0x2f3d62[_0x7616('0x83')]=_[_0x7616('0xa3')](_0x2f3d62[_0x7616('0x83')],{'$and':_0x3a5da5[_0x7616('0x85')][_0x7616('0xb3')]});}return _0x313a7d[_0x23f15a['childModel']][_0x7616('0xae')]({'where':_0x2f3d62[_0x7616('0x83')]})['then'](function(_0x53c764){_0x15566c[_0x7616('0xae')]=_0x53c764;if(_0x3a5da5[_0x7616('0x85')][_0x7616('0xb4')]){if(_0x23f15a['childModel']===_0x7616('0x1b')){_0x2f3d62[_0x7616('0xb5')]=[{'model':_0x313a7d['Tag'],'as':_0x7616('0xb6'),'attributes':['id','name','color'],'required':_0x3a5da5['query']['tag']?!![]:![]},{'model':_0x313a7d['Tag'],'as':'ThroughTags','attributes':['id',_0x7616('0x17'),'color'],'through':_0x3a5da5[_0x7616('0x85')][_0x7616('0xb7')]?{'attributes':[],'where':{'TagId':_0x3a5da5[_0x7616('0x85')][_0x7616('0xb7')]||undefined}}:{},'required':_0x3a5da5[_0x7616('0x85')]['tag']?!![]:![]}];}else{_0x2f3d62[_0x7616('0xb5')]=[{'all':!![]}];}}return _0x313a7d[_0x23f15a[_0x7616('0x11')]][_0x7616('0x3')](_0x2f3d62);})[_0x7616('0x4')](function(_0x378005){_0x15566c[_0x7616('0xaf')]=_0x378005;if(_0x3888ae===_0x7616('0x2f')&&_0x3a5da5[_0x7616('0x85')][_0x7616('0xb8')]===_0x7616('0xb9')){var _0x2cfa34=[];for(var _0x1b4f85=0x0;_0x1b4f85<_0x15566c[_0x7616('0xaf')][_0x7616('0x8e')];_0x1b4f85++){_0x2cfa34[_0x7616('0x97')](_0x55c48a(_0x7616('0xba'),_0x15566c[_0x7616('0xaf')][_0x1b4f85]['dataValues']));_0x2cfa34['push'](_0x55c48a(_0x7616('0xbb'),_0x15566c[_0x7616('0xaf')][_0x1b4f85][_0x7616('0xbc')]));_0x2cfa34['push'](_0x55c48a(_0x7616('0xbd'),_0x15566c['rows'][_0x1b4f85][_0x7616('0xbc')]));_0x2cfa34[_0x7616('0x97')](_0x55c48a(_0x7616('0xbe'),_0x15566c[_0x7616('0xaf')][_0x1b4f85][_0x7616('0xbc')]));_0x2cfa34['push'](_0x55c48a(_0x7616('0xbf'),_0x15566c['rows'][_0x1b4f85][_0x7616('0xbc')]));_0x2cfa34['push'](_0x55c48a(_0x7616('0xc0'),_0x15566c['rows'][_0x1b4f85][_0x7616('0xbc')]));}return Promise['all'](_0x2cfa34)['then'](function(){return _0x15566c;});}return _0x15566c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d69a080..18b2c17 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 _0x5a9e=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','ioredis'];(function(_0x41cad8,_0x5d0f48){var _0xcb23ca=function(_0x391a25){while(--_0x391a25){_0x41cad8['push'](_0x41cad8['shift']());}};_0xcb23ca(++_0x5d0f48);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x5a9e[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0xe5a9('0x0'));var moment=require(_0xe5a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5a9('0x2'));var db=require(_0xe5a9('0x3'))['db'];var utils=require(_0xe5a9('0x4'));var logger=require(_0xe5a9('0x5'))(_0xe5a9('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5a9('0x7'));var client=jayson['client'][_0xe5a9('0x8')]({'port':0x232a});config[_0xe5a9('0x9')]=_['defaults'](config['redis'],{'host':_0xe5a9('0xa'),'port':0x18eb});var socket=require(_0xe5a9('0xb'))(new Redis(config[_0xe5a9('0x9')]));require(_0xe5a9('0xc'))[_0xe5a9('0xd')](socket);function respondWithRpcPromise(_0x530b67,_0x579b84,_0x7ab4a9){return new BPromise(function(_0x523fda,_0x7ec4cf){return client['request'](_0x530b67,_0x7ab4a9)['then'](function(_0x563625){logger[_0xe5a9('0xe')](_0xe5a9('0xf'),_0x579b84,_0xe5a9('0x10'));logger[_0xe5a9('0x11')](_0xe5a9('0x12'),_0x579b84,_0xe5a9('0x10'),JSON['stringify'](_0x563625));if(_0x563625[_0xe5a9('0x13')]){if(_0x563625[_0xe5a9('0x13')][_0xe5a9('0x14')]===0x1f4){logger[_0xe5a9('0x13')](_0xe5a9('0xf'),_0x579b84,_0x563625[_0xe5a9('0x13')][_0xe5a9('0x15')]);return _0x7ec4cf(_0x563625['error'][_0xe5a9('0x15')]);}logger[_0xe5a9('0x13')](_0xe5a9('0xf'),_0x579b84,_0x563625['error']['message']);return _0x523fda(_0x563625[_0xe5a9('0x13')][_0xe5a9('0x15')]);}else{logger[_0xe5a9('0xe')](_0xe5a9('0xf'),_0x579b84,_0xe5a9('0x10'));_0x523fda(_0x563625[_0xe5a9('0x16')]['message']);}})[_0xe5a9('0x17')](function(_0x4bff6e){logger['error'](_0xe5a9('0xf'),_0x579b84,_0x4bff6e);_0x7ec4cf(_0x4bff6e);});});} \ No newline at end of file +var _0xde46=['moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xde46,0x14e));var _0x6de4=function(_0x12cb49,_0x19f696){_0x12cb49=_0x12cb49-0x0;var _0x5ba8ad=_0xde46[_0x12cb49];return _0x5ba8ad;};'use strict';var _=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var moment=require(_0x6de4('0x2'));var BPromise=require(_0x6de4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6de4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6de4('0x5'))(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var jayson=require(_0x6de4('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x6de4('0x9')]=_['defaults'](config[_0x6de4('0x9')],{'host':_0x6de4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6de4('0x9')]));require(_0x6de4('0xb'))[_0x6de4('0xc')](socket);function respondWithRpcPromise(_0x2f2d2a,_0x20a86c,_0x10a00c){return new BPromise(function(_0xffe1ea,_0x3b2c5b){return client[_0x6de4('0xd')](_0x2f2d2a,_0x10a00c)[_0x6de4('0xe')](function(_0x1554b6){logger['info'](_0x6de4('0xf'),_0x20a86c,_0x6de4('0x10'));logger[_0x6de4('0x11')](_0x6de4('0x12'),_0x20a86c,_0x6de4('0x10'),JSON[_0x6de4('0x13')](_0x1554b6));if(_0x1554b6[_0x6de4('0x14')]){if(_0x1554b6[_0x6de4('0x14')]['code']===0x1f4){logger[_0x6de4('0x14')]('UserProfile,\x20%s,\x20%s',_0x20a86c,_0x1554b6[_0x6de4('0x14')][_0x6de4('0x15')]);return _0x3b2c5b(_0x1554b6[_0x6de4('0x14')]['message']);}logger[_0x6de4('0x14')](_0x6de4('0xf'),_0x20a86c,_0x1554b6[_0x6de4('0x14')][_0x6de4('0x15')]);return _0xffe1ea(_0x1554b6['error'][_0x6de4('0x15')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x20a86c,_0x6de4('0x10'));_0xffe1ea(_0x1554b6[_0x6de4('0x16')][_0x6de4('0x15')]);}})[_0x6de4('0x17')](function(_0xe8af1a){logger[_0x6de4('0x14')](_0x6de4('0xf'),_0x20a86c,_0xe8af1a);_0x3b2c5b(_0xe8af1a);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 8c328f2..ba479a5 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 _0x4a2a=['removeListener','register','length','userProfile:','./userProfile.events','remove','update'];(function(_0x543b02,_0x471127){var _0x2dec1e=function(_0x46d35b){while(--_0x46d35b){_0x543b02['push'](_0x543b02['shift']());}};_0x2dec1e(++_0x471127);}(_0x4a2a,0x12a));var _0xa4a2=function(_0x448166,_0xf22199){_0x448166=_0x448166-0x0;var _0x2dd11d=_0x4a2a[_0x448166];return _0x2dd11d;};'use strict';var UserProfileEvents=require(_0xa4a2('0x0'));var events=['save',_0xa4a2('0x1'),_0xa4a2('0x2')];function createListener(_0x47607c,_0x17246e){return function(_0x5f4fd4){_0x17246e['emit'](_0x47607c,_0x5f4fd4);};}function removeListener(_0x461ef5,_0x435627){return function(){UserProfileEvents[_0xa4a2('0x3')](_0x461ef5,_0x435627);};}exports[_0xa4a2('0x4')]=function(_0x1667f1){for(var _0x41b090=0x0,_0x202510=events[_0xa4a2('0x5')];_0x41b090<_0x202510;_0x41b090++){var _0x305769=events[_0x41b090];var _0x3837fb=createListener(_0xa4a2('0x6')+_0x305769,_0x1667f1);UserProfileEvents['on'](_0x305769,_0x3837fb);}}; \ No newline at end of file +var _0x5d43=['length','./userProfile.events','save','update','emit','removeListener','register'];(function(_0x1c199c,_0x592ae0){var _0x47772a=function(_0x1939ef){while(--_0x1939ef){_0x1c199c['push'](_0x1c199c['shift']());}};_0x47772a(++_0x592ae0);}(_0x5d43,0x119));var _0x35d4=function(_0x2aad8e,_0x6341cd){_0x2aad8e=_0x2aad8e-0x0;var _0x32218b=_0x5d43[_0x2aad8e];return _0x32218b;};'use strict';var UserProfileEvents=require(_0x35d4('0x0'));var events=[_0x35d4('0x1'),'remove',_0x35d4('0x2')];function createListener(_0x50e0f1,_0x663443){return function(_0x18a039){_0x663443[_0x35d4('0x3')](_0x50e0f1,_0x18a039);};}function removeListener(_0x5e9349,_0x177588){return function(){UserProfileEvents[_0x35d4('0x4')](_0x5e9349,_0x177588);};}exports[_0x35d4('0x5')]=function(_0x324b69){for(var _0x366ae9=0x0,_0x414ba9=events[_0x35d4('0x6')];_0x366ae9<_0x414ba9;_0x366ae9++){var _0x454ed4=events[_0x366ae9];var _0x19ee44=createListener('userProfile:'+_0x454ed4,_0x324b69);UserProfileEvents['on'](_0x454ed4,_0x19ee44);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 4cd7311..14b3e7e 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 _0xb033=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x49b333,_0xfb409c){var _0x370b24=function(_0x3959b8){while(--_0x3959b8){_0x49b333['push'](_0x49b333['shift']());}};_0x370b24(++_0xfb409c);}(_0xb033,0x130));var _0x3b03=function(_0x2da0a6,_0x21a54c){_0x2da0a6=_0x2da0a6-0x0;var _0x3f49a4=_0xb033[_0x2da0a6];return _0x3f49a4;};'use strict';var multer=require(_0x3b03('0x0'));var util=require(_0x3b03('0x1'));var path=require(_0x3b03('0x2'));var timeout=require('connect-timeout');var express=require(_0x3b03('0x3'));var router=express[_0x3b03('0x4')]();var fs_extra=require(_0x3b03('0x5'));var auth=require(_0x3b03('0x6'));var interaction=require(_0x3b03('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x3b03('0x8')]('/',auth[_0x3b03('0x9')](),controller[_0x3b03('0xa')]);router[_0x3b03('0x8')](_0x3b03('0xb'),auth[_0x3b03('0x9')](),controller['describe']);router[_0x3b03('0x8')](_0x3b03('0xc'),auth[_0x3b03('0x9')](),controller[_0x3b03('0xd')]);router[_0x3b03('0xe')]('/',auth[_0x3b03('0x9')](),controller[_0x3b03('0xf')]);router[_0x3b03('0x10')](_0x3b03('0xc'),auth['isAuthenticated'](),controller[_0x3b03('0x11')]);router[_0x3b03('0x12')]('/:id',auth[_0x3b03('0x9')](),controller[_0x3b03('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0ac2=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','multer','path','Router','fs-extra','../../components/auth/service'];(function(_0x363492,_0x3fd79a){var _0x47dc66=function(_0x1bef47){while(--_0x1bef47){_0x363492['push'](_0x363492['shift']());}};_0x47dc66(++_0x3fd79a);}(_0x0ac2,0x12b));var _0x20ac=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0ac2[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x20ac('0x0'));var util=require('util');var path=require(_0x20ac('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x20ac('0x2')]();var fs_extra=require(_0x20ac('0x3'));var auth=require(_0x20ac('0x4'));var interaction=require(_0x20ac('0x5'));var config=require(_0x20ac('0x6'));var controller=require(_0x20ac('0x7'));router[_0x20ac('0x8')]('/',auth['isAuthenticated'](),controller[_0x20ac('0x9')]);router[_0x20ac('0x8')](_0x20ac('0xa'),auth[_0x20ac('0xb')](),controller[_0x20ac('0xc')]);router[_0x20ac('0x8')](_0x20ac('0xd'),auth[_0x20ac('0xb')](),controller[_0x20ac('0xe')]);router[_0x20ac('0xf')]('/',auth[_0x20ac('0xb')](),controller[_0x20ac('0x10')]);router['put'](_0x20ac('0xd'),auth['isAuthenticated'](),controller[_0x20ac('0x11')]);router[_0x20ac('0x12')](_0x20ac('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8052123..bd772d0 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 _0x1c14=['STRING'];(function(_0x23315f,_0x13fa40){var _0x2c817a=function(_0x18be2a){while(--_0x18be2a){_0x23315f['push'](_0x23315f['shift']());}};_0x2c817a(++_0x13fa40);}(_0x1c14,0x19a));var _0x41c1=function(_0x5ba493,_0x2d4d44){_0x5ba493=_0x5ba493-0x0;var _0x4cfbf0=_0x1c14[_0x5ba493];return _0x4cfbf0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x41c1('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0417=['sequelize','exports','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x0417,0x17d));var _0x7041=function(_0x20d13b,_0x343bea){_0x20d13b=_0x20d13b-0x0;var _0x268e1a=_0x0417[_0x20d13b];return _0x268e1a;};'use strict';var Sequelize=require(_0x7041('0x0'));module[_0x7041('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x7041('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 4f6733a..0ba18b9 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x5f3c49,_0x2c9716){var _0x5259ac=function(_0x54eb42){while(--_0x54eb42){_0x5f3c49['push'](_0x5f3c49['shift']());}};_0x5259ac(++_0x2c9716);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x4975=['to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','pick','filter','where','map','VIRTUAL','options','UserProfileResource','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3767a8,_0x58a80e){var _0x36b1d7=function(_0x3bcf4b){while(--_0x3bcf4b){_0x3767a8['push'](_0x3767a8['shift']());}};_0x36b1d7(++_0x58a80e);}(_0x4975,0x86));var _0x5497=function(_0x456b8e,_0x5d955f){_0x456b8e=_0x456b8e-0x0;var _0x1189fc=_0x4975[_0x456b8e];return _0x1189fc;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];function respondWithStatusCode(_0x1b23df,_0x1bb794){_0x1bb794=_0x1bb794||0xcc;return function(_0x984990){if(_0x984990){return _0x1b23df[_0x5497('0x18')](_0x1bb794);}return _0x1b23df[_0x5497('0x19')](_0x1bb794)[_0x5497('0x1a')]();};}function respondWithResult(_0xaca97d,_0x363a5b){_0x363a5b=_0x363a5b||0xc8;return function(_0x1a4c74){if(_0x1a4c74){return _0xaca97d['status'](_0x363a5b)[_0x5497('0x1b')](_0x1a4c74);}};}function respondWithFilteredResult(_0x4fb8e9,_0x4237a9){return function(_0x2bfd8a){if(_0x2bfd8a){var _0x19e5f3=typeof _0x4237a9[_0x5497('0x1c')]===_0x5497('0x1d')&&typeof _0x4237a9[_0x5497('0x1e')]===_0x5497('0x1d');var _0x575f6b=_0x2bfd8a['count'];var _0x3f4d20=_0x19e5f3?0x0:_0x4237a9[_0x5497('0x1c')];var _0x3a47fd=_0x19e5f3?_0x2bfd8a['count']:_0x4237a9[_0x5497('0x1c')]+_0x4237a9[_0x5497('0x1e')];var _0x18e8a8;if(_0x3a47fd>=_0x575f6b){_0x3a47fd=_0x575f6b;_0x18e8a8=0xc8;}else{_0x18e8a8=0xce;}_0x4fb8e9[_0x5497('0x19')](_0x18e8a8);return _0x4fb8e9[_0x5497('0x1f')](_0x5497('0x20'),_0x3f4d20+'-'+_0x3a47fd+'/'+_0x575f6b)[_0x5497('0x1b')](_0x2bfd8a);}return null;};}function patchUpdates(_0x10226f){return function(_0x2e3960){try{jsonpatch[_0x5497('0x21')](_0x2e3960,_0x10226f,!![]);}catch(_0x186065){return BPromise['reject'](_0x186065);}return _0x2e3960[_0x5497('0x22')]();};}function saveUpdates(_0x4d1b27,_0x19200a){return function(_0xd0868d){if(_0xd0868d){return _0xd0868d[_0x5497('0x23')](_0x4d1b27)[_0x5497('0x24')](function(_0x35ecd9){return _0x35ecd9;});}return null;};}function removeEntity(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(_0x54043a){return _0x54043a[_0x5497('0x25')]()[_0x5497('0x24')](function(){_0x3b2fbc[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x5223b5,_0x13b7a4){return function(_0x57268c){if(!_0x57268c){_0x5223b5[_0x5497('0x18')](0x194);}return _0x57268c;};}function handleError(_0x16a2b4,_0x429d36){_0x429d36=_0x429d36||0x1f4;return function(_0x34a1a5){logger[_0x5497('0x26')](_0x34a1a5[_0x5497('0x27')]);if(_0x34a1a5['name']){delete _0x34a1a5[_0x5497('0x28')];}_0x16a2b4['status'](_0x429d36)['send'](_0x34a1a5);};}exports['index']=function(_0x39a2b7,_0x48d146){var _0x5e9356={},_0xc3465={},_0xb14593={'count':0x0,'rows':[]};var _0x1cf908=_['map'](db['UserProfileResource']['rawAttributes'],function(_0x371874){return{'name':_0x371874[_0x5497('0x29')],'type':_0x371874[_0x5497('0x2a')]['key']};});_0xc3465['model']=_['map'](_0x1cf908,_0x5497('0x28'));_0xc3465['query']=_[_0x5497('0x2b')](_0x39a2b7[_0x5497('0x2c')]);_0xc3465[_0x5497('0x2d')]=_['intersection'](_0xc3465[_0x5497('0x2e')],_0xc3465[_0x5497('0x2c')]);_0x5e9356['attributes']=_[_0x5497('0x2f')](_0xc3465[_0x5497('0x2e')],qs[_0x5497('0x30')](_0x39a2b7['query'][_0x5497('0x30')]));_0x5e9356[_0x5497('0x31')]=_0x5e9356[_0x5497('0x31')][_0x5497('0x32')]?_0x5e9356[_0x5497('0x31')]:_0xc3465['model'];if(!_0x39a2b7[_0x5497('0x2c')][_0x5497('0x33')]('nolimit')){_0x5e9356[_0x5497('0x1e')]=qs[_0x5497('0x1e')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x1e')]);_0x5e9356[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x39a2b7['query'][_0x5497('0x1c')]);}_0x5e9356['order']=qs[_0x5497('0x34')](_0x39a2b7[_0x5497('0x2c')][_0x5497('0x34')]);_0x5e9356['where']=qs['filters'](_[_0x5497('0x35')](_0x39a2b7[_0x5497('0x2c')],_0xc3465[_0x5497('0x2d')]),_0x1cf908);if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]){_0x5e9356[_0x5497('0x37')]=_['merge'](_0x5e9356[_0x5497('0x37')],{'$or':_[_0x5497('0x38')](_0x1cf908,function(_0x3de8fe){if(_0x3de8fe[_0x5497('0x2a')]!==_0x5497('0x39')){var _0x468902={};_0x468902[_0x3de8fe[_0x5497('0x28')]]={'$like':'%'+_0x39a2b7[_0x5497('0x2c')][_0x5497('0x36')]+'%'};return _0x468902;}})});}_0x5e9356=_['merge']({},_0x5e9356,_0x39a2b7[_0x5497('0x3a')]);var _0x32fa2b={'where':_0x5e9356[_0x5497('0x37')]};return db[_0x5497('0x3b')][_0x5497('0x3c')](_0x32fa2b)[_0x5497('0x24')](function(_0x4299be){_0xb14593['count']=_0x4299be;if(_0x39a2b7[_0x5497('0x2c')][_0x5497('0x3d')]){_0x5e9356[_0x5497('0x3e')]=[{'all':!![]}];}return db[_0x5497('0x3b')][_0x5497('0x3f')](_0x5e9356);})[_0x5497('0x24')](function(_0x114471){_0xb14593['rows']=_0x114471;return _0xb14593;})[_0x5497('0x24')](respondWithFilteredResult(_0x48d146,_0x5e9356))[_0x5497('0x40')](handleError(_0x48d146,null));};exports[_0x5497('0x41')]=function(_0x1e6389,_0x20e947){var _0xd90608={'raw':![],'where':{'id':_0x1e6389[_0x5497('0x42')]['id']}},_0xc1a999={};_0xc1a999[_0x5497('0x2e')]=_[_0x5497('0x2b')](db['UserProfileResource'][_0x5497('0x43')]);_0xc1a999['query']=_[_0x5497('0x2b')](_0x1e6389[_0x5497('0x2c')]);_0xc1a999[_0x5497('0x2d')]=_[_0x5497('0x2f')](_0xc1a999[_0x5497('0x2e')],_0xc1a999['query']);_0xd90608[_0x5497('0x31')]=_[_0x5497('0x2f')](_0xc1a999['model'],qs[_0x5497('0x30')](_0x1e6389['query'][_0x5497('0x30')]));_0xd90608['attributes']=_0xd90608[_0x5497('0x31')][_0x5497('0x32')]?_0xd90608[_0x5497('0x31')]:_0xc1a999[_0x5497('0x2e')];if(_0x1e6389[_0x5497('0x2c')]['includeAll']){_0xd90608['include']=[{'all':!![]}];}_0xd90608=_['merge']({},_0xd90608,_0x1e6389['options']);return db[_0x5497('0x3b')][_0x5497('0x44')](_0xd90608)[_0x5497('0x24')](handleEntityNotFound(_0x20e947,null))[_0x5497('0x24')](respondWithResult(_0x20e947,null))[_0x5497('0x40')](handleError(_0x20e947,null));};exports[_0x5497('0x45')]=function(_0xc78abe,_0x466287){return db[_0x5497('0x3b')]['create'](_0xc78abe[_0x5497('0x46')],{})[_0x5497('0x24')](respondWithResult(_0x466287,0xc9))[_0x5497('0x40')](handleError(_0x466287,null));};exports['update']=function(_0x3e4da2,_0x530475){if(_0x3e4da2[_0x5497('0x46')]['id']){delete _0x3e4da2[_0x5497('0x46')]['id'];}return db[_0x5497('0x3b')]['find']({'where':{'id':_0x3e4da2[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x530475,null))['then'](saveUpdates(_0x3e4da2[_0x5497('0x46')],null))['then'](respondWithResult(_0x530475,null))[_0x5497('0x40')](handleError(_0x530475,null));};exports['destroy']=function(_0x416f76,_0x400860){return db[_0x5497('0x3b')][_0x5497('0x44')]({'where':{'id':_0x416f76[_0x5497('0x42')]['id']}})[_0x5497('0x24')](handleEntityNotFound(_0x400860,null))[_0x5497('0x24')](removeEntity(_0x400860,null))[_0x5497('0x40')](handleError(_0x400860,null));};exports['describe']=function(_0x1f73eb,_0x5b2c22){return db['UserProfileResource'][_0x5497('0x47')]()[_0x5497('0x24')](respondWithResult(_0x5b2c22,null))['catch'](handleError(_0x5b2c22,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3a94293..4c06568 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 _0x9218=['resourceId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','compositeIndex'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x9218,0xde));var _0x8921=function(_0x21c607,_0x221437){_0x21c607=_0x21c607-0x0;var _0x24d07b=_0x9218[_0x21c607];return _0x24d07b;};'use strict';var _=require(_0x8921('0x0'));var util=require('util');var logger=require(_0x8921('0x1'))(_0x8921('0x2'));var moment=require(_0x8921('0x3'));var BPromise=require(_0x8921('0x4'));var rp=require(_0x8921('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8921('0x6'));var config=require(_0x8921('0x7'));var attributes=require(_0x8921('0x8'));module[_0x8921('0x9')]=function(_0x79b38c,_0x47ab0b){return _0x79b38c['define'](_0x8921('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x8921('0xb'),'fields':[_0x8921('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x41b4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0xf9ac86,_0x55ee59){var _0x441c03=function(_0x311534){while(--_0x311534){_0xf9ac86['push'](_0xf9ac86['shift']());}};_0x441c03(++_0x55ee59);}(_0x41b4,0x150));var _0x441b=function(_0x1f8921,_0x38bd21){_0x1f8921=_0x1f8921-0x0;var _0x2c2f34=_0x41b4[_0x1f8921];return _0x2c2f34;};'use strict';var _=require(_0x441b('0x0'));var util=require(_0x441b('0x1'));var logger=require(_0x441b('0x2'))(_0x441b('0x3'));var moment=require(_0x441b('0x4'));var BPromise=require(_0x441b('0x5'));var rp=require(_0x441b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x441b('0x7'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x4f85ce,_0x578790){return _0x4f85ce['define'](_0x441b('0x8'),attributes,{'tableName':_0x441b('0x9'),'paranoid':![],'indexes':[{'name':_0x441b('0xa'),'fields':[_0x441b('0xb'),'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 1046a23..59ca009 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 _0x3d91=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x24987e,_0x20461a){var _0x109a48=function(_0x49914d){while(--_0x49914d){_0x24987e['push'](_0x24987e['shift']());}};_0x109a48(++_0x20461a);}(_0x3d91,0x15a));var _0x13d9=function(_0x4fcaf1,_0x59fa8b){_0x4fcaf1=_0x4fcaf1-0x0;var _0x509afb=_0x3d91[_0x4fcaf1];return _0x509afb;};'use strict';var _=require(_0x13d9('0x0'));var util=require(_0x13d9('0x1'));var moment=require(_0x13d9('0x2'));var BPromise=require(_0x13d9('0x3'));var rs=require(_0x13d9('0x4'));var fs=require('fs');var Redis=require(_0x13d9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13d9('0x6'))('rpc');var config=require(_0x13d9('0x7'));var jayson=require(_0x13d9('0x8'));var client=jayson['client'][_0x13d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db1a5,_0x47947a,_0x3f0ac6){return new BPromise(function(_0x52a629,_0x35a8cc){return client['request'](_0x5db1a5,_0x3f0ac6)['then'](function(_0x23312d){logger[_0x13d9('0xa')](_0x13d9('0xb'),_0x47947a,_0x13d9('0xc'));logger[_0x13d9('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x47947a,'request\x20sent',JSON[_0x13d9('0xe')](_0x23312d));if(_0x23312d[_0x13d9('0xf')]){if(_0x23312d[_0x13d9('0xf')]['code']===0x1f4){logger['error'](_0x13d9('0xb'),_0x47947a,_0x23312d[_0x13d9('0xf')][_0x13d9('0x10')]);return _0x35a8cc(_0x23312d['error']['message']);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x47947a,_0x23312d[_0x13d9('0xf')]['message']);return _0x52a629(_0x23312d['error'][_0x13d9('0x10')]);}else{logger[_0x13d9('0xa')](_0x13d9('0xb'),_0x47947a,'request\x20sent');_0x52a629(_0x23312d[_0x13d9('0x11')][_0x13d9('0x10')]);}})['catch'](function(_0x987ec1){logger[_0x13d9('0xf')](_0x13d9('0xb'),_0x47947a,_0x987ec1);_0x35a8cc(_0x987ec1);});});} \ No newline at end of file +var _0xa118=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1feee3,_0x34af40){var _0x6225e6=function(_0x3d8aee){while(--_0x3d8aee){_0x1feee3['push'](_0x1feee3['shift']());}};_0x6225e6(++_0x34af40);}(_0xa118,0x90));var _0x8a11=function(_0x272eb7,_0x35b9d4){_0x272eb7=_0x272eb7-0x0;var _0x1cbc08=_0xa118[_0x272eb7];return _0x1cbc08;};'use strict';var _=require(_0x8a11('0x0'));var util=require(_0x8a11('0x1'));var moment=require('moment');var BPromise=require(_0x8a11('0x2'));var rs=require(_0x8a11('0x3'));var fs=require('fs');var Redis=require(_0x8a11('0x4'));var db=require(_0x8a11('0x5'))['db'];var utils=require(_0x8a11('0x6'));var logger=require(_0x8a11('0x7'))(_0x8a11('0x8'));var config=require(_0x8a11('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32a02a,_0x444f6b,_0x2a598b){return new BPromise(function(_0x11df6b,_0x35265d){return client[_0x8a11('0xa')](_0x32a02a,_0x2a598b)[_0x8a11('0xb')](function(_0x3ae59a){logger[_0x8a11('0xc')](_0x8a11('0xd'),_0x444f6b,_0x8a11('0xe'));logger[_0x8a11('0xf')](_0x8a11('0x10'),_0x444f6b,_0x8a11('0xe'),JSON[_0x8a11('0x11')](_0x3ae59a));if(_0x3ae59a[_0x8a11('0x12')]){if(_0x3ae59a[_0x8a11('0x12')][_0x8a11('0x13')]===0x1f4){logger['error'](_0x8a11('0xd'),_0x444f6b,_0x3ae59a[_0x8a11('0x12')][_0x8a11('0x14')]);return _0x35265d(_0x3ae59a[_0x8a11('0x12')][_0x8a11('0x14')]);}logger[_0x8a11('0x12')](_0x8a11('0xd'),_0x444f6b,_0x3ae59a[_0x8a11('0x12')]['message']);return _0x11df6b(_0x3ae59a[_0x8a11('0x12')][_0x8a11('0x14')]);}else{logger[_0x8a11('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x444f6b,'request\x20sent');_0x11df6b(_0x3ae59a['result'][_0x8a11('0x14')]);}})[_0x8a11('0x15')](function(_0x3a7237){logger[_0x8a11('0x12')](_0x8a11('0xd'),_0x444f6b,_0x3a7237);_0x35265d(_0x3a7237);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 504dcdc..8f8ed53 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 _0xceb6=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xceb6,0x150));var _0x6ceb=function(_0x1663f7,_0x17ef75){_0x1663f7=_0x1663f7-0x0;var _0x283506=_0xceb6[_0x1663f7];return _0x283506;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6ceb('0x0'));var timeout=require(_0x6ceb('0x1'));var express=require(_0x6ceb('0x2'));var router=express[_0x6ceb('0x3')]();var fs_extra=require(_0x6ceb('0x4'));var auth=require(_0x6ceb('0x5'));var interaction=require(_0x6ceb('0x6'));var config=require(_0x6ceb('0x7'));var controller=require('./userProfileSection.controller');router[_0x6ceb('0x8')]('/',auth[_0x6ceb('0x9')](),controller['index']);router[_0x6ceb('0x8')](_0x6ceb('0xa'),auth[_0x6ceb('0x9')](),controller[_0x6ceb('0xb')]);router[_0x6ceb('0x8')](_0x6ceb('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6ceb('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6ceb('0xe')](_0x6ceb('0xc'),auth[_0x6ceb('0x9')](),controller[_0x6ceb('0xf')]);router['delete']('/:id',auth[_0x6ceb('0x9')](),controller[_0x6ceb('0x10')]);module[_0x6ceb('0x11')]=router; \ No newline at end of file +var _0x3843=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','index','get','/describe','isAuthenticated'];(function(_0x3a1c29,_0x2fc0aa){var _0x2437cf=function(_0x58b47b){while(--_0x58b47b){_0x3a1c29['push'](_0x3a1c29['shift']());}};_0x2437cf(++_0x2fc0aa);}(_0x3843,0x8d));var _0x3384=function(_0xdab9d4,_0x3a5250){_0xdab9d4=_0xdab9d4-0x0;var _0x58f235=_0x3843[_0xdab9d4];return _0x58f235;};'use strict';var multer=require(_0x3384('0x0'));var util=require(_0x3384('0x1'));var path=require('path');var timeout=require(_0x3384('0x2'));var express=require('express');var router=express[_0x3384('0x3')]();var fs_extra=require(_0x3384('0x4'));var auth=require(_0x3384('0x5'));var interaction=require(_0x3384('0x6'));var config=require(_0x3384('0x7'));var controller=require(_0x3384('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x3384('0x9')]);router[_0x3384('0xa')](_0x3384('0xb'),auth[_0x3384('0xc')](),controller[_0x3384('0xd')]);router[_0x3384('0xa')](_0x3384('0xe'),auth[_0x3384('0xc')](),controller[_0x3384('0xf')]);router[_0x3384('0x10')]('/',auth[_0x3384('0xc')](),controller[_0x3384('0x11')]);router[_0x3384('0x12')](_0x3384('0xe'),auth[_0x3384('0xc')](),controller[_0x3384('0x13')]);router['delete'](_0x3384('0xe'),auth['isAuthenticated'](),controller[_0x3384('0x14')]);module[_0x3384('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 79cb3f5..2fbd43a 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 _0x7334=['split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x25d4ee,_0xc95872){var _0x214a35=function(_0x4285a0){while(--_0x4285a0){_0x25d4ee['push'](_0x25d4ee['shift']());}};_0x214a35(++_0xc95872);}(_0x7334,0x184));var _0x4733=function(_0x47084d,_0x1c491f){_0x47084d=_0x47084d-0x0;var _0x5065c7=_0x7334[_0x47084d];return _0x5065c7;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'name':{'type':Sequelize[_0x4733('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x4733('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4733('0x2')],'set':function(_0x218143){this[_0x4733('0x4')](_0x4733('0x5'),_0x218143?_0x218143[_0x4733('0x6')](''):[]);},'get':function(){return this[_0x4733('0x7')](_0x4733('0x5'))?this[_0x4733('0x7')](_0x4733('0x5'))[_0x4733('0x8')](''):[];}}}; \ No newline at end of file +var _0x5b12=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions'];(function(_0x48abbe,_0x9ac0dd){var _0x56b3ad=function(_0x45a28a){while(--_0x45a28a){_0x48abbe['push'](_0x48abbe['shift']());}};_0x56b3ad(++_0x9ac0dd);}(_0x5b12,0xa3));var _0x25b1=function(_0x3fbc3d,_0x330322){_0x3fbc3d=_0x3fbc3d-0x0;var _0x4bf366=_0x5b12[_0x3fbc3d];return _0x4bf366;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x25b1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x25b1('0x2')],'set':function(_0x47995b){this[_0x25b1('0x5')]('crudPermissions',_0x47995b?_0x47995b['join'](''):[]);},'get':function(){return this[_0x25b1('0x6')]('crudPermissions')?this['getDataValue'](_0x25b1('0x7'))[_0x25b1('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index a0e68f0..c5a17ee 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 _0x952d=['length','nolimit','order','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','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','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileSection','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x336734,_0x3f4f1d){var _0x2597f6=function(_0x4eecfb){while(--_0x4eecfb){_0x336734['push'](_0x336734['shift']());}};_0x2597f6(++_0x3f4f1d);}(_0x952d,0x1c5));var _0xd952=function(_0x113706,_0x4c4556){_0x113706=_0x113706-0x0;var _0x3e72cf=_0x952d[_0x113706];return _0x3e72cf;};'use strict';var emlformat=require(_0xd952('0x0'));var rimraf=require(_0xd952('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd952('0x2'));var moment=require(_0xd952('0x3'));var BPromise=require(_0xd952('0x4'));var Mustache=require(_0xd952('0x5'));var util=require(_0xd952('0x6'));var path=require(_0xd952('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd952('0x8'));var _=require(_0xd952('0x9'));var squel=require(_0xd952('0xa'));var crypto=require(_0xd952('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd952('0xc'));var querystring=require(_0xd952('0xd'));var Papa=require(_0xd952('0xe'));var Redis=require(_0xd952('0xf'));var authService=require(_0xd952('0x10'));var qs=require(_0xd952('0x11'));var as=require(_0xd952('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd952('0x13'))('api');var utils=require(_0xd952('0x14'));var config=require(_0xd952('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16c5f5,_0x2b865a){_0x2b865a=_0x2b865a||0xcc;return function(_0x52a117){if(_0x52a117){return _0x16c5f5[_0xd952('0x16')](_0x2b865a);}return _0x16c5f5[_0xd952('0x17')](_0x2b865a)['end']();};}function respondWithResult(_0x15d70b,_0x2dd0df){_0x2dd0df=_0x2dd0df||0xc8;return function(_0x47a698){if(_0x47a698){return _0x15d70b[_0xd952('0x17')](_0x2dd0df)['json'](_0x47a698);}};}function respondWithFilteredResult(_0x1196b0,_0x4c6f6a){return function(_0x1f03c8){if(_0x1f03c8){var _0x4d03fc=typeof _0x4c6f6a['offset']===_0xd952('0x18')&&typeof _0x4c6f6a[_0xd952('0x19')]===_0xd952('0x18');var _0xb03d83=_0x1f03c8['count'];var _0xb71737=_0x4d03fc?0x0:_0x4c6f6a['offset'];var _0x18d797=_0x4d03fc?_0x1f03c8[_0xd952('0x1a')]:_0x4c6f6a[_0xd952('0x1b')]+_0x4c6f6a[_0xd952('0x19')];var _0x213dcc;if(_0x18d797>=_0xb03d83){_0x18d797=_0xb03d83;_0x213dcc=0xc8;}else{_0x213dcc=0xce;}_0x1196b0[_0xd952('0x17')](_0x213dcc);return _0x1196b0['set'](_0xd952('0x1c'),_0xb71737+'-'+_0x18d797+'/'+_0xb03d83)[_0xd952('0x1d')](_0x1f03c8);}return null;};}function patchUpdates(_0x3bc46a){return function(_0x38d760){try{jsonpatch[_0xd952('0x1e')](_0x38d760,_0x3bc46a,!![]);}catch(_0x4d159f){return BPromise[_0xd952('0x1f')](_0x4d159f);}return _0x38d760[_0xd952('0x20')]();};}function saveUpdates(_0x4529c7,_0x1cf388){return function(_0x2f877e){if(_0x2f877e){return _0x2f877e[_0xd952('0x21')](_0x4529c7)[_0xd952('0x22')](function(_0x38e518){return _0x38e518;});}return null;};}function removeEntity(_0x125574,_0x388d9b){return function(_0x182c09){if(_0x182c09){return _0x182c09[_0xd952('0x23')]()[_0xd952('0x22')](function(){_0x125574[_0xd952('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9fbd,_0x21882d){return function(_0x585c05){if(!_0x585c05){_0x1f9fbd['sendStatus'](0x194);}return _0x585c05;};}function handleError(_0x539481,_0x3449d5){_0x3449d5=_0x3449d5||0x1f4;return function(_0xba97b7){logger[_0xd952('0x24')](_0xba97b7[_0xd952('0x25')]);if(_0xba97b7[_0xd952('0x26')]){delete _0xba97b7[_0xd952('0x26')];}_0x539481[_0xd952('0x17')](_0x3449d5)[_0xd952('0x27')](_0xba97b7);};}exports['index']=function(_0x530631,_0x25c423){var _0x2049d0={},_0x4b2ae3={},_0x52d20c={'count':0x0,'rows':[]};var _0x28e56f=_[_0xd952('0x28')](db[_0xd952('0x29')]['rawAttributes'],function(_0x5ac2a7){return{'name':_0x5ac2a7['fieldName'],'type':_0x5ac2a7[_0xd952('0x2a')][_0xd952('0x2b')]};});_0x4b2ae3[_0xd952('0x2c')]=_['map'](_0x28e56f,_0xd952('0x26'));_0x4b2ae3[_0xd952('0x2d')]=_[_0xd952('0x2e')](_0x530631['query']);_0x4b2ae3[_0xd952('0x2f')]=_[_0xd952('0x30')](_0x4b2ae3[_0xd952('0x2c')],_0x4b2ae3[_0xd952('0x2d')]);_0x2049d0[_0xd952('0x31')]=_[_0xd952('0x30')](_0x4b2ae3[_0xd952('0x2c')],qs['fields'](_0x530631[_0xd952('0x2d')][_0xd952('0x32')]));_0x2049d0[_0xd952('0x31')]=_0x2049d0[_0xd952('0x31')][_0xd952('0x33')]?_0x2049d0[_0xd952('0x31')]:_0x4b2ae3[_0xd952('0x2c')];if(!_0x530631[_0xd952('0x2d')]['hasOwnProperty'](_0xd952('0x34'))){_0x2049d0['limit']=qs[_0xd952('0x19')](_0x530631[_0xd952('0x2d')][_0xd952('0x19')]);_0x2049d0[_0xd952('0x1b')]=qs['offset'](_0x530631[_0xd952('0x2d')]['offset']);}_0x2049d0[_0xd952('0x35')]=qs['sort'](_0x530631[_0xd952('0x2d')]['sort']);_0x2049d0['where']=qs[_0xd952('0x2f')](_[_0xd952('0x36')](_0x530631[_0xd952('0x2d')],_0x4b2ae3[_0xd952('0x2f')]),_0x28e56f);if(_0x530631[_0xd952('0x2d')]['filter']){_0x2049d0[_0xd952('0x37')]=_[_0xd952('0x38')](_0x2049d0[_0xd952('0x37')],{'$or':_[_0xd952('0x28')](_0x28e56f,function(_0x35e8d8){if(_0x35e8d8['type']!==_0xd952('0x39')){var _0xe90070={};_0xe90070[_0x35e8d8['name']]={'$like':'%'+_0x530631[_0xd952('0x2d')][_0xd952('0x3a')]+'%'};return _0xe90070;}})});}_0x2049d0=_[_0xd952('0x38')]({},_0x2049d0,_0x530631[_0xd952('0x3b')]);var _0x1bac05={'where':_0x2049d0[_0xd952('0x37')]};return db[_0xd952('0x29')][_0xd952('0x1a')](_0x1bac05)[_0xd952('0x22')](function(_0x7edf3c){_0x52d20c[_0xd952('0x1a')]=_0x7edf3c;if(_0x530631[_0xd952('0x2d')]['includeAll']){_0x2049d0[_0xd952('0x3c')]=[{'all':!![]}];}return db[_0xd952('0x29')][_0xd952('0x3d')](_0x2049d0);})[_0xd952('0x22')](function(_0x467134){_0x52d20c[_0xd952('0x3e')]=_0x467134;return _0x52d20c;})[_0xd952('0x22')](respondWithFilteredResult(_0x25c423,_0x2049d0))[_0xd952('0x3f')](handleError(_0x25c423,null));};exports[_0xd952('0x40')]=function(_0x1ec3d0,_0x19d095){var _0x5760d5={'raw':![],'where':{'id':_0x1ec3d0[_0xd952('0x41')]['id']}},_0x2979ce={};_0x2979ce[_0xd952('0x2c')]=_[_0xd952('0x2e')](db[_0xd952('0x29')][_0xd952('0x42')]);_0x2979ce[_0xd952('0x2d')]=_[_0xd952('0x2e')](_0x1ec3d0[_0xd952('0x2d')]);_0x2979ce[_0xd952('0x2f')]=_[_0xd952('0x30')](_0x2979ce['model'],_0x2979ce[_0xd952('0x2d')]);_0x5760d5[_0xd952('0x31')]=_[_0xd952('0x30')](_0x2979ce['model'],qs[_0xd952('0x32')](_0x1ec3d0[_0xd952('0x2d')][_0xd952('0x32')]));_0x5760d5[_0xd952('0x31')]=_0x5760d5['attributes'][_0xd952('0x33')]?_0x5760d5['attributes']:_0x2979ce[_0xd952('0x2c')];if(_0x1ec3d0[_0xd952('0x2d')][_0xd952('0x43')]){_0x5760d5[_0xd952('0x3c')]=[{'all':!![]}];}_0x5760d5=_[_0xd952('0x38')]({},_0x5760d5,_0x1ec3d0['options']);return db[_0xd952('0x29')]['find'](_0x5760d5)[_0xd952('0x22')](handleEntityNotFound(_0x19d095,null))['then'](respondWithResult(_0x19d095,null))[_0xd952('0x3f')](handleError(_0x19d095,null));};exports[_0xd952('0x44')]=function(_0x4cf271,_0x5109f1){return db[_0xd952('0x29')][_0xd952('0x44')](_0x4cf271[_0xd952('0x45')],{})[_0xd952('0x22')](respondWithResult(_0x5109f1,0xc9))[_0xd952('0x3f')](handleError(_0x5109f1,null));};exports[_0xd952('0x21')]=function(_0x23d9de,_0x1f78ac){if(_0x23d9de[_0xd952('0x45')]['id']){delete _0x23d9de[_0xd952('0x45')]['id'];}return db[_0xd952('0x29')][_0xd952('0x46')]({'where':{'id':_0x23d9de['params']['id']}})[_0xd952('0x22')](handleEntityNotFound(_0x1f78ac,null))[_0xd952('0x22')](saveUpdates(_0x23d9de['body'],null))['then'](respondWithResult(_0x1f78ac,null))[_0xd952('0x3f')](handleError(_0x1f78ac,null));};exports['destroy']=function(_0x426760,_0x1adf79){return db[_0xd952('0x29')]['find']({'where':{'id':_0x426760[_0xd952('0x41')]['id']}})[_0xd952('0x22')](handleEntityNotFound(_0x1adf79,null))[_0xd952('0x22')](removeEntity(_0x1adf79,null))[_0xd952('0x3f')](handleError(_0x1adf79,null));};exports['describe']=function(_0x27f378,_0x35a15c){return db['UserProfileSection'][_0xd952('0x47')]()[_0xd952('0x22')](respondWithResult(_0x35a15c,null))['catch'](handleError(_0x35a15c,null));}; \ No newline at end of file +var _0x1ea5=['request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileSection','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','zip-dir'];(function(_0x1a8624,_0x5c8035){var _0x2d96fe=function(_0x30e6bb){while(--_0x30e6bb){_0x1a8624['push'](_0x1a8624['shift']());}};_0x2d96fe(++_0x5c8035);}(_0x1ea5,0xd4));var _0x51ea=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x1ea5[_0x4c7b20];return _0x4872bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51ea('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51ea('0x1'));var moment=require(_0x51ea('0x2'));var BPromise=require(_0x51ea('0x3'));var Mustache=require(_0x51ea('0x4'));var util=require(_0x51ea('0x5'));var path=require('path');var sox=require(_0x51ea('0x6'));var csv=require(_0x51ea('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51ea('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x51ea('0x9'));var deskjs=require(_0x51ea('0xa'));var toCsv=require(_0x51ea('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x51ea('0xb'));var authService=require(_0x51ea('0xc'));var qs=require(_0x51ea('0xd'));var as=require(_0x51ea('0xe'));var hardwareService=require(_0x51ea('0xf'));var logger=require(_0x51ea('0x10'))(_0x51ea('0x11'));var utils=require(_0x51ea('0x12'));var config=require(_0x51ea('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x51ea('0x14'))['db'];function respondWithStatusCode(_0x9e4af2,_0x286d69){_0x286d69=_0x286d69||0xcc;return function(_0x386479){if(_0x386479){return _0x9e4af2[_0x51ea('0x15')](_0x286d69);}return _0x9e4af2[_0x51ea('0x16')](_0x286d69)['end']();};}function respondWithResult(_0x555f38,_0xffcf0c){_0xffcf0c=_0xffcf0c||0xc8;return function(_0x4b97c5){if(_0x4b97c5){return _0x555f38[_0x51ea('0x16')](_0xffcf0c)[_0x51ea('0x17')](_0x4b97c5);}};}function respondWithFilteredResult(_0xc6f81e,_0x229e7b){return function(_0xa2a3ba){if(_0xa2a3ba){var _0x298e93=typeof _0x229e7b[_0x51ea('0x18')]===_0x51ea('0x19')&&typeof _0x229e7b[_0x51ea('0x1a')]===_0x51ea('0x19');var _0x38655e=_0xa2a3ba[_0x51ea('0x1b')];var _0x4f2af1=_0x298e93?0x0:_0x229e7b[_0x51ea('0x18')];var _0x318a70=_0x298e93?_0xa2a3ba['count']:_0x229e7b[_0x51ea('0x18')]+_0x229e7b[_0x51ea('0x1a')];var _0x5c5f9a;if(_0x318a70>=_0x38655e){_0x318a70=_0x38655e;_0x5c5f9a=0xc8;}else{_0x5c5f9a=0xce;}_0xc6f81e['status'](_0x5c5f9a);return _0xc6f81e[_0x51ea('0x1c')](_0x51ea('0x1d'),_0x4f2af1+'-'+_0x318a70+'/'+_0x38655e)[_0x51ea('0x17')](_0xa2a3ba);}return null;};}function patchUpdates(_0x39a42e){return function(_0x1b4543){try{jsonpatch['apply'](_0x1b4543,_0x39a42e,!![]);}catch(_0x4ff089){return BPromise[_0x51ea('0x1e')](_0x4ff089);}return _0x1b4543[_0x51ea('0x1f')]();};}function saveUpdates(_0xaa453,_0x3c5a02){return function(_0x219912){if(_0x219912){return _0x219912[_0x51ea('0x20')](_0xaa453)[_0x51ea('0x21')](function(_0x12e73b){return _0x12e73b;});}return null;};}function removeEntity(_0x184384,_0x39912f){return function(_0x74fe91){if(_0x74fe91){return _0x74fe91[_0x51ea('0x22')]()[_0x51ea('0x21')](function(){_0x184384[_0x51ea('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b2689,_0x5883de){return function(_0x2c5b5e){if(!_0x2c5b5e){_0x5b2689['sendStatus'](0x194);}return _0x2c5b5e;};}function handleError(_0x1f446b,_0x46d2fe){_0x46d2fe=_0x46d2fe||0x1f4;return function(_0x2b8441){logger[_0x51ea('0x23')](_0x2b8441[_0x51ea('0x24')]);if(_0x2b8441[_0x51ea('0x25')]){delete _0x2b8441[_0x51ea('0x25')];}_0x1f446b[_0x51ea('0x16')](_0x46d2fe)[_0x51ea('0x26')](_0x2b8441);};}exports['index']=function(_0x2ab0a0,_0x317315){var _0x1edbdf={},_0x484a82={},_0x496883={'count':0x0,'rows':[]};var _0x50f08d=_[_0x51ea('0x27')](db[_0x51ea('0x28')]['rawAttributes'],function(_0x4899dc){return{'name':_0x4899dc[_0x51ea('0x29')],'type':_0x4899dc[_0x51ea('0x2a')][_0x51ea('0x2b')]};});_0x484a82[_0x51ea('0x2c')]=_[_0x51ea('0x27')](_0x50f08d,_0x51ea('0x25'));_0x484a82['query']=_[_0x51ea('0x2d')](_0x2ab0a0[_0x51ea('0x2e')]);_0x484a82[_0x51ea('0x2f')]=_[_0x51ea('0x30')](_0x484a82[_0x51ea('0x2c')],_0x484a82[_0x51ea('0x2e')]);_0x1edbdf[_0x51ea('0x31')]=_[_0x51ea('0x30')](_0x484a82[_0x51ea('0x2c')],qs[_0x51ea('0x32')](_0x2ab0a0['query']['fields']));_0x1edbdf[_0x51ea('0x31')]=_0x1edbdf[_0x51ea('0x31')][_0x51ea('0x33')]?_0x1edbdf['attributes']:_0x484a82[_0x51ea('0x2c')];if(!_0x2ab0a0[_0x51ea('0x2e')]['hasOwnProperty']('nolimit')){_0x1edbdf['limit']=qs[_0x51ea('0x1a')](_0x2ab0a0[_0x51ea('0x2e')][_0x51ea('0x1a')]);_0x1edbdf[_0x51ea('0x18')]=qs[_0x51ea('0x18')](_0x2ab0a0['query'][_0x51ea('0x18')]);}_0x1edbdf[_0x51ea('0x34')]=qs[_0x51ea('0x35')](_0x2ab0a0['query'][_0x51ea('0x35')]);_0x1edbdf[_0x51ea('0x36')]=qs['filters'](_[_0x51ea('0x37')](_0x2ab0a0[_0x51ea('0x2e')],_0x484a82['filters']),_0x50f08d);if(_0x2ab0a0[_0x51ea('0x2e')][_0x51ea('0x38')]){_0x1edbdf[_0x51ea('0x36')]=_[_0x51ea('0x39')](_0x1edbdf[_0x51ea('0x36')],{'$or':_['map'](_0x50f08d,function(_0x35e1ad){if(_0x35e1ad[_0x51ea('0x2a')]!==_0x51ea('0x3a')){var _0x2b68db={};_0x2b68db[_0x35e1ad[_0x51ea('0x25')]]={'$like':'%'+_0x2ab0a0[_0x51ea('0x2e')]['filter']+'%'};return _0x2b68db;}})});}_0x1edbdf=_[_0x51ea('0x39')]({},_0x1edbdf,_0x2ab0a0[_0x51ea('0x3b')]);var _0x41ef6f={'where':_0x1edbdf[_0x51ea('0x36')]};return db[_0x51ea('0x28')][_0x51ea('0x1b')](_0x41ef6f)['then'](function(_0x49ed4d){_0x496883[_0x51ea('0x1b')]=_0x49ed4d;if(_0x2ab0a0['query'][_0x51ea('0x3c')]){_0x1edbdf[_0x51ea('0x3d')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1edbdf);})[_0x51ea('0x21')](function(_0x24b3da){_0x496883[_0x51ea('0x3e')]=_0x24b3da;return _0x496883;})[_0x51ea('0x21')](respondWithFilteredResult(_0x317315,_0x1edbdf))[_0x51ea('0x3f')](handleError(_0x317315,null));};exports[_0x51ea('0x40')]=function(_0x3fd2fa,_0x21936a){var _0x58b61f={'raw':![],'where':{'id':_0x3fd2fa[_0x51ea('0x41')]['id']}},_0x150112={};_0x150112['model']=_[_0x51ea('0x2d')](db[_0x51ea('0x28')][_0x51ea('0x42')]);_0x150112[_0x51ea('0x2e')]=_[_0x51ea('0x2d')](_0x3fd2fa[_0x51ea('0x2e')]);_0x150112[_0x51ea('0x2f')]=_[_0x51ea('0x30')](_0x150112[_0x51ea('0x2c')],_0x150112[_0x51ea('0x2e')]);_0x58b61f[_0x51ea('0x31')]=_['intersection'](_0x150112[_0x51ea('0x2c')],qs[_0x51ea('0x32')](_0x3fd2fa[_0x51ea('0x2e')]['fields']));_0x58b61f[_0x51ea('0x31')]=_0x58b61f[_0x51ea('0x31')][_0x51ea('0x33')]?_0x58b61f['attributes']:_0x150112[_0x51ea('0x2c')];if(_0x3fd2fa[_0x51ea('0x2e')][_0x51ea('0x3c')]){_0x58b61f[_0x51ea('0x3d')]=[{'all':!![]}];}_0x58b61f=_[_0x51ea('0x39')]({},_0x58b61f,_0x3fd2fa[_0x51ea('0x3b')]);return db['UserProfileSection'][_0x51ea('0x43')](_0x58b61f)[_0x51ea('0x21')](handleEntityNotFound(_0x21936a,null))[_0x51ea('0x21')](respondWithResult(_0x21936a,null))['catch'](handleError(_0x21936a,null));};exports[_0x51ea('0x44')]=function(_0x4b6723,_0x10f233){return db[_0x51ea('0x28')][_0x51ea('0x44')](_0x4b6723[_0x51ea('0x45')],{})[_0x51ea('0x21')](respondWithResult(_0x10f233,0xc9))[_0x51ea('0x3f')](handleError(_0x10f233,null));};exports['update']=function(_0x42a70a,_0x251b04){if(_0x42a70a[_0x51ea('0x45')]['id']){delete _0x42a70a[_0x51ea('0x45')]['id'];}return db[_0x51ea('0x28')][_0x51ea('0x43')]({'where':{'id':_0x42a70a['params']['id']}})[_0x51ea('0x21')](handleEntityNotFound(_0x251b04,null))[_0x51ea('0x21')](saveUpdates(_0x42a70a[_0x51ea('0x45')],null))['then'](respondWithResult(_0x251b04,null))['catch'](handleError(_0x251b04,null));};exports[_0x51ea('0x22')]=function(_0x3f9a14,_0x27e0f8){return db['UserProfileSection'][_0x51ea('0x43')]({'where':{'id':_0x3f9a14[_0x51ea('0x41')]['id']}})[_0x51ea('0x21')](handleEntityNotFound(_0x27e0f8,null))[_0x51ea('0x21')](removeEntity(_0x27e0f8,null))[_0x51ea('0x3f')](handleError(_0x27e0f8,null));};exports[_0x51ea('0x46')]=function(_0x584c83,_0x2e9c72){return db[_0x51ea('0x28')]['describe']()[_0x51ea('0x21')](respondWithResult(_0x2e9c72,null))[_0x51ea('0x3f')](handleError(_0x2e9c72,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6b57def..630d25c 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 _0x1312=['api','moment','bluebird','rimraf','../../config/environment','define','user_profile_has_sections','compositeIndex','sectionId','util','../../config/logger'];(function(_0x4d4c81,_0x2d4f62){var _0x415bd7=function(_0x2e5c72){while(--_0x2e5c72){_0x4d4c81['push'](_0x4d4c81['shift']());}};_0x415bd7(++_0x2d4f62);}(_0x1312,0x148));var _0x2131=function(_0x372400,_0xdaeb10){_0x372400=_0x372400-0x0;var _0x4cd28c=_0x1312[_0x372400];return _0x4cd28c;};'use strict';var _=require('lodash');var util=require(_0x2131('0x0'));var logger=require(_0x2131('0x1'))(_0x2131('0x2'));var moment=require(_0x2131('0x3'));var BPromise=require(_0x2131('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2131('0x5'));var config=require(_0x2131('0x6'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0xfcccc,_0x3e3253){return _0xfcccc[_0x2131('0x7')]('UserProfileSection',attributes,{'tableName':_0x2131('0x8'),'paranoid':![],'indexes':[{'name':_0x2131('0x9'),'fields':[_0x2131('0xa'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8945=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','compositeIndex','sectionId','userProfileId','util'];(function(_0x40737a,_0x424056){var _0x35c127=function(_0x44feb0){while(--_0x44feb0){_0x40737a['push'](_0x40737a['shift']());}};_0x35c127(++_0x424056);}(_0x8945,0x12b));var _0x5894=function(_0x3ae4b8,_0x53fffc){_0x3ae4b8=_0x3ae4b8-0x0;var _0x4bfddc=_0x8945[_0x3ae4b8];return _0x4bfddc;};'use strict';var _=require('lodash');var util=require(_0x5894('0x0'));var logger=require(_0x5894('0x1'))(_0x5894('0x2'));var moment=require(_0x5894('0x3'));var BPromise=require(_0x5894('0x4'));var rp=require(_0x5894('0x5'));var fs=require('fs');var path=require(_0x5894('0x6'));var rimraf=require(_0x5894('0x7'));var config=require(_0x5894('0x8'));var attributes=require(_0x5894('0x9'));module['exports']=function(_0x71d30a,_0x3c082e){return _0x71d30a[_0x5894('0xa')](_0x5894('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x5894('0xc'),'fields':[_0x5894('0xd'),_0x5894('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 63a8f57..8424c62 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 _0xe68c=['info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe68c,0xd0));var _0xce68=function(_0x4efe4b,_0x2af93c){_0x4efe4b=_0x4efe4b-0x0;var _0x63e206=_0xe68c[_0x4efe4b];return _0x63e206;};'use strict';var _=require(_0xce68('0x0'));var util=require('util');var moment=require(_0xce68('0x1'));var BPromise=require(_0xce68('0x2'));var rs=require(_0xce68('0x3'));var fs=require('fs');var Redis=require(_0xce68('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xce68('0x5'));var logger=require(_0xce68('0x6'))(_0xce68('0x7'));var config=require('../../config/environment');var jayson=require(_0xce68('0x8'));var client=jayson[_0xce68('0x9')][_0xce68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d51bf,_0x46b0dd,_0x121ae8){return new BPromise(function(_0x5068e8,_0x46b539){return client[_0xce68('0xb')](_0x2d51bf,_0x121ae8)['then'](function(_0x59c68a){logger[_0xce68('0xc')](_0xce68('0xd'),_0x46b0dd,_0xce68('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x46b0dd,'request\x20sent',JSON[_0xce68('0xf')](_0x59c68a));if(_0x59c68a[_0xce68('0x10')]){if(_0x59c68a[_0xce68('0x10')][_0xce68('0x11')]===0x1f4){logger[_0xce68('0x10')](_0xce68('0xd'),_0x46b0dd,_0x59c68a['error'][_0xce68('0x12')]);return _0x46b539(_0x59c68a['error'][_0xce68('0x12')]);}logger[_0xce68('0x10')](_0xce68('0xd'),_0x46b0dd,_0x59c68a[_0xce68('0x10')][_0xce68('0x12')]);return _0x5068e8(_0x59c68a[_0xce68('0x10')][_0xce68('0x12')]);}else{logger[_0xce68('0xc')](_0xce68('0xd'),_0x46b0dd,_0xce68('0xe'));_0x5068e8(_0x59c68a['result'][_0xce68('0x12')]);}})[_0xce68('0x13')](function(_0x1a187e){logger['error'](_0xce68('0xd'),_0x46b0dd,_0x1a187e);_0x46b539(_0x1a187e);});});} \ No newline at end of file +var _0xa8f5=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileSection,\x20%s,\x20%s'];(function(_0x1ad3ca,_0xe0a0c2){var _0x2cd02a=function(_0xbecd21){while(--_0xbecd21){_0x1ad3ca['push'](_0x1ad3ca['shift']());}};_0x2cd02a(++_0xe0a0c2);}(_0xa8f5,0xb1));var _0x5a8f=function(_0x339c23,_0x541ff6){_0x339c23=_0x339c23-0x0;var _0x5bf134=_0xa8f5[_0x339c23];return _0x5bf134;};'use strict';var _=require(_0x5a8f('0x0'));var util=require(_0x5a8f('0x1'));var moment=require('moment');var BPromise=require(_0x5a8f('0x2'));var rs=require(_0x5a8f('0x3'));var fs=require('fs');var Redis=require(_0x5a8f('0x4'));var db=require(_0x5a8f('0x5'))['db'];var utils=require(_0x5a8f('0x6'));var logger=require(_0x5a8f('0x7'))(_0x5a8f('0x8'));var config=require(_0x5a8f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5a8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c0c45,_0x24e00c,_0x317cb7){return new BPromise(function(_0x2ba0de,_0x1b8e07){return client[_0x5a8f('0xb')](_0x5c0c45,_0x317cb7)[_0x5a8f('0xc')](function(_0x2c8174){logger[_0x5a8f('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x24e00c,_0x5a8f('0xe'));logger['debug'](_0x5a8f('0xf'),_0x24e00c,_0x5a8f('0xe'),JSON[_0x5a8f('0x10')](_0x2c8174));if(_0x2c8174[_0x5a8f('0x11')]){if(_0x2c8174[_0x5a8f('0x11')][_0x5a8f('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x24e00c,_0x2c8174[_0x5a8f('0x11')]['message']);return _0x1b8e07(_0x2c8174[_0x5a8f('0x11')][_0x5a8f('0x13')]);}logger[_0x5a8f('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x24e00c,_0x2c8174['error'][_0x5a8f('0x13')]);return _0x2ba0de(_0x2c8174[_0x5a8f('0x11')][_0x5a8f('0x13')]);}else{logger[_0x5a8f('0xd')](_0x5a8f('0x14'),_0x24e00c,'request\x20sent');_0x2ba0de(_0x2c8174[_0x5a8f('0x15')][_0x5a8f('0x13')]);}})['catch'](function(_0xe71c7d){logger['error'](_0x5a8f('0x14'),_0x24e00c,_0xe71c7d);_0x1b8e07(_0xe71c7d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 99019e5..b128129 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(_0x2afa0a,_0x4b273c){var _0x206201=function(_0x9df21a){while(--_0x9df21a){_0x2afa0a['push'](_0x2afa0a['shift']());}};_0x206201(++_0x4b273c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index dcc193b..e9b4245 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 _0x0a5c=['INTEGER','sequelize'];(function(_0x149a72,_0x415d09){var _0x2631cf=function(_0xefafae){while(--_0xefafae){_0x149a72['push'](_0x149a72['shift']());}};_0x2631cf(++_0x415d09);}(_0x0a5c,0x97));var _0xc0a5=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x0a5c[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0xc0a5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xc0a5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee10=['sequelize','INTEGER'];(function(_0x202b04,_0x3f067d){var _0x21a9b4=function(_0x5b3c7b){while(--_0x5b3c7b){_0x202b04['push'](_0x202b04['shift']());}};_0x21a9b4(++_0x3f067d);}(_0xee10,0x66));var _0x0ee1=function(_0x4183ea,_0xeb7bb3){_0x4183ea=_0x4183ea-0x0;var _0x3873e4=_0xee10[_0x4183ea];return _0x3873e4;};'use strict';var Sequelize=require(_0x0ee1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0ee1('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 17f6c19..9f5840a 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 _0xa899=['./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x155f22,_0x30422c){var _0x569d57=function(_0x1aeed6){while(--_0x1aeed6){_0x155f22['push'](_0x155f22['shift']());}};_0x569d57(++_0x30422c);}(_0xa899,0x155));var _0x9a89=function(_0x58fbb0,_0xe497b5){_0x58fbb0=_0x58fbb0-0x0;var _0x1783d2=_0xa899[_0x58fbb0];return _0x1783d2;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var logger=require(_0x9a89('0x2'))('api');var moment=require(_0x9a89('0x3'));var BPromise=require(_0x9a89('0x4'));var rp=require(_0x9a89('0x5'));var fs=require('fs');var path=require(_0x9a89('0x6'));var rimraf=require(_0x9a89('0x7'));var config=require(_0x9a89('0x8'));var attributes=require(_0x9a89('0x9'));module[_0x9a89('0xa')]=function(_0x126099,_0x413d15){return _0x126099[_0x9a89('0xb')](_0x9a89('0xc'),attributes,{'tableName':_0x9a89('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x553a=['bluebird','rimraf','exports','define','UserSmsQueue','user_has_sms_queues','util','api','moment'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x553a,0x192));var _0xa553=function(_0x843880,_0x1516d1){_0x843880=_0x843880-0x0;var _0x49943f=_0x553a[_0x843880];return _0x49943f;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var logger=require('../../config/logger')(_0xa553('0x1'));var moment=require(_0xa553('0x2'));var BPromise=require(_0xa553('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa553('0x4'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xa553('0x5')]=function(_0x53190d,_0x5ddf5e){return _0x53190d[_0xa553('0x6')](_0xa553('0x7'),attributes,{'tableName':_0xa553('0x8'),'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 c1abd87..4eb6698 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 _0x8f0d=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8f0d,0x175));var _0xd8f0=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x8f0d[_0x433a86];return _0x23000c;};'use strict';var _=require(_0xd8f0('0x0'));var util=require(_0xd8f0('0x1'));var moment=require(_0xd8f0('0x2'));var BPromise=require('bluebird');var rs=require(_0xd8f0('0x3'));var fs=require('fs');var Redis=require(_0xd8f0('0x4'));var db=require(_0xd8f0('0x5'))['db'];var utils=require(_0xd8f0('0x6'));var logger=require(_0xd8f0('0x7'))(_0xd8f0('0x8'));var config=require(_0xd8f0('0x9'));var jayson=require(_0xd8f0('0xa'));var client=jayson['client'][_0xd8f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cca40,_0x295766,_0x441f80){return new BPromise(function(_0x5239c6,_0x12220c){return client[_0xd8f0('0xc')](_0x1cca40,_0x441f80)[_0xd8f0('0xd')](function(_0xd9c486){logger[_0xd8f0('0xe')](_0xd8f0('0xf'),_0x295766,'request\x20sent');logger[_0xd8f0('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x295766,_0xd8f0('0x11'),JSON[_0xd8f0('0x12')](_0xd9c486));if(_0xd9c486[_0xd8f0('0x13')]){if(_0xd9c486[_0xd8f0('0x13')][_0xd8f0('0x14')]===0x1f4){logger[_0xd8f0('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x295766,_0xd9c486[_0xd8f0('0x13')][_0xd8f0('0x15')]);return _0x12220c(_0xd9c486[_0xd8f0('0x13')][_0xd8f0('0x15')]);}logger[_0xd8f0('0x13')](_0xd8f0('0xf'),_0x295766,_0xd9c486[_0xd8f0('0x13')][_0xd8f0('0x15')]);return _0x5239c6(_0xd9c486[_0xd8f0('0x13')][_0xd8f0('0x15')]);}else{logger[_0xd8f0('0xe')](_0xd8f0('0xf'),_0x295766,_0xd8f0('0x11'));_0x5239c6(_0xd9c486[_0xd8f0('0x16')]['message']);}})['catch'](function(_0x435ef7){logger['error'](_0xd8f0('0xf'),_0x295766,_0x435ef7);_0x12220c(_0x435ef7);});});} \ No newline at end of file +var _0xb465=['jayson/promise','http','request','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x38223f,_0x3a0dfc){var _0x3e3fab=function(_0x2b40d0){while(--_0x2b40d0){_0x38223f['push'](_0x38223f['shift']());}};_0x3e3fab(++_0x3a0dfc);}(_0xb465,0x139));var _0x5b46=function(_0x47440d,_0x3efe09){_0x47440d=_0x47440d-0x0;var _0x36ceea=_0xb465[_0x47440d];return _0x36ceea;};'use strict';var _=require(_0x5b46('0x0'));var util=require('util');var moment=require(_0x5b46('0x1'));var BPromise=require(_0x5b46('0x2'));var rs=require(_0x5b46('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b46('0x4'))['db'];var utils=require(_0x5b46('0x5'));var logger=require(_0x5b46('0x6'))(_0x5b46('0x7'));var config=require(_0x5b46('0x8'));var jayson=require(_0x5b46('0x9'));var client=jayson['client'][_0x5b46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41d5d7,_0x58ba38,_0x1f64d1){return new BPromise(function(_0x4c8b93,_0xeb54f4){return client[_0x5b46('0xb')](_0x41d5d7,_0x1f64d1)['then'](function(_0x14606b){logger['info'](_0x5b46('0xc'),_0x58ba38,_0x5b46('0xd'));logger[_0x5b46('0xe')](_0x5b46('0xf'),_0x58ba38,_0x5b46('0xd'),JSON[_0x5b46('0x10')](_0x14606b));if(_0x14606b[_0x5b46('0x11')]){if(_0x14606b['error'][_0x5b46('0x12')]===0x1f4){logger['error'](_0x5b46('0xc'),_0x58ba38,_0x14606b[_0x5b46('0x11')][_0x5b46('0x13')]);return _0xeb54f4(_0x14606b[_0x5b46('0x11')][_0x5b46('0x13')]);}logger[_0x5b46('0x11')](_0x5b46('0xc'),_0x58ba38,_0x14606b[_0x5b46('0x11')][_0x5b46('0x13')]);return _0x4c8b93(_0x14606b[_0x5b46('0x11')][_0x5b46('0x13')]);}else{logger[_0x5b46('0x14')]('UserSmsQueue,\x20%s,\x20%s',_0x58ba38,'request\x20sent');_0x4c8b93(_0x14606b[_0x5b46('0x15')][_0x5b46('0x13')]);}})[_0x5b46('0x16')](function(_0x50d46b){logger[_0x5b46('0x11')](_0x5b46('0xc'),_0x58ba38,_0x50d46b);_0xeb54f4(_0x50d46b);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index d799ce3..b0c538a 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 _0x54f1=['sequelize','exports','INTEGER'];(function(_0x53be66,_0x9ec3be){var _0x9e5520=function(_0x5c4742){while(--_0x5c4742){_0x53be66['push'](_0x53be66['shift']());}};_0x9e5520(++_0x9ec3be);}(_0x54f1,0x153));var _0x154f=function(_0x534cf1,_0x364de3){_0x534cf1=_0x534cf1-0x0;var _0x2b94d4=_0x54f1[_0x534cf1];return _0x2b94d4;};'use strict';var Sequelize=require(_0x154f('0x0'));module[_0x154f('0x1')]={'UserId':{'type':Sequelize[_0x154f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x154f('0x2')]}}; \ No newline at end of file +var _0x9edd=['sequelize','exports','INTEGER'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9edd,0x171));var _0xd9ed=function(_0x3f9940,_0x3eefd7){_0x3f9940=_0x3f9940-0x0;var _0x5d4441=_0x9edd[_0x3f9940];return _0x5d4441;};'use strict';var Sequelize=require(_0xd9ed('0x0'));module[_0xd9ed('0x1')]={'UserId':{'type':Sequelize[_0xd9ed('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd9ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 77695d1..bf31daf 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(_0x2fb980,_0x5c6bdc){var _0x3cb865=function(_0x5f1e92){while(--_0x5f1e92){_0x2fb980['push'](_0x2fb980['shift']());}};_0x3cb865(++_0x5c6bdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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(_0x5e9234,_0x36189d){var _0x2f971e=function(_0x458b84){while(--_0x458b84){_0x5e9234['push'](_0x5e9234['shift']());}};_0x2f971e(++_0x36189d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 9cf49f7..742c212 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1fdd12,_0x2f1c5c){var _0x55ccd1=function(_0x587451){while(--_0x587451){_0x1fdd12['push'](_0x1fdd12['shift']());}};_0x55ccd1(++_0x2f1c5c);}(_0x70e0,0x17b));var _0x070e=function(_0x1653fc,_0x4d5d96){_0x1653fc=_0x1653fc-0x0;var _0x525d0e=_0x70e0[_0x1653fc];return _0x525d0e;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4fb95a,_0x213c61){var _0x158438=function(_0x5137f6){while(--_0x5137f6){_0x4fb95a['push'](_0x4fb95a['shift']());}};_0x158438(++_0x213c61);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0xcb91[_0x3f2d02];return _0x54092b;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 71647ad..04ee42c 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 _0x671b=['sequelize','exports','INTEGER'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x671b,0x1e0));var _0xb671=function(_0x5690e0,_0x31a9b9){_0x5690e0=_0x5690e0-0x0;var _0x42bff8=_0x671b[_0x5690e0];return _0x42bff8;};'use strict';var Sequelize=require(_0xb671('0x0'));module[_0xb671('0x1')]={'penalty':{'type':Sequelize[_0xb671('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee5e=['INTEGER'];(function(_0xd143f8,_0xd48028){var _0x43a25e=function(_0x3d5bf5){while(--_0x3d5bf5){_0xd143f8['push'](_0xd143f8['shift']());}};_0x43a25e(++_0xd48028);}(_0xee5e,0x181));var _0xeee5=function(_0x58664a,_0x3a99d3){_0x58664a=_0x58664a-0x0;var _0x1075c8=_0xee5e[_0x58664a];return _0x1075c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xeee5('0x0')],'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 dc7813c..f587259 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 _0x93d8=['define','UserVoiceQueue','user_has_voice_queues','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x461930,_0x329a2a){var _0x382394=function(_0x58a6c5){while(--_0x58a6c5){_0x461930['push'](_0x461930['shift']());}};_0x382394(++_0x329a2a);}(_0x93d8,0x184));var _0x893d=function(_0x20b749,_0x46bf14){_0x20b749=_0x20b749-0x0;var _0x5b891a=_0x93d8[_0x20b749];return _0x5b891a;};'use strict';var _=require(_0x893d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x893d('0x1'));var rp=require(_0x893d('0x2'));var fs=require('fs');var path=require(_0x893d('0x3'));var rimraf=require(_0x893d('0x4'));var config=require(_0x893d('0x5'));var attributes=require(_0x893d('0x6'));module[_0x893d('0x7')]=function(_0x4b8882,_0x393f03){return _0x4b8882[_0x893d('0x8')](_0x893d('0x9'),attributes,{'tableName':_0x893d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b17=['request-promise','rimraf','../../config/environment','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x57cc22,_0x2d351f){var _0x6f7bdc=function(_0x4935b5){while(--_0x4935b5){_0x57cc22['push'](_0x57cc22['shift']());}};_0x6f7bdc(++_0x2d351f);}(_0x1b17,0x1be));var _0x71b1=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x1b17[_0x351509];return _0x4e9861;};'use strict';var _=require(_0x71b1('0x0'));var util=require(_0x71b1('0x1'));var logger=require(_0x71b1('0x2'))('api');var moment=require(_0x71b1('0x3'));var BPromise=require(_0x71b1('0x4'));var rp=require(_0x71b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x71b1('0x6'));var config=require(_0x71b1('0x7'));var attributes=require('./userVoiceQueue.attributes');module[_0x71b1('0x8')]=function(_0x69eb4f,_0x976518){return _0x69eb4f['define'](_0x71b1('0x9'),attributes,{'tableName':_0x71b1('0xa'),'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 21cbe18..6eff6fe 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 _0x002d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash'];(function(_0x28f5ea,_0x17b804){var _0x304936=function(_0x2cade0){while(--_0x2cade0){_0x28f5ea['push'](_0x28f5ea['shift']());}};_0x304936(++_0x17b804);}(_0x002d,0x14f));var _0xd002=function(_0x1536a9,_0x48e582){_0x1536a9=_0x1536a9-0x0;var _0x17269a=_0x002d[_0x1536a9];return _0x17269a;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var moment=require(_0xd002('0x2'));var BPromise=require(_0xd002('0x3'));var rs=require(_0xd002('0x4'));var fs=require('fs');var Redis=require(_0xd002('0x5'));var db=require(_0xd002('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd002('0x7'))('rpc');var config=require(_0xd002('0x8'));var jayson=require(_0xd002('0x9'));var client=jayson[_0xd002('0xa')][_0xd002('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x411989,_0x4c394b,_0x2ab80a){return new BPromise(function(_0x1f3a02,_0x23decb){return client[_0xd002('0xc')](_0x411989,_0x2ab80a)[_0xd002('0xd')](function(_0x25f151){logger[_0xd002('0xe')](_0xd002('0xf'),_0x4c394b,_0xd002('0x10'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4c394b,'request\x20sent',JSON[_0xd002('0x11')](_0x25f151));if(_0x25f151[_0xd002('0x12')]){if(_0x25f151[_0xd002('0x12')]['code']===0x1f4){logger[_0xd002('0x12')](_0xd002('0xf'),_0x4c394b,_0x25f151[_0xd002('0x12')][_0xd002('0x13')]);return _0x23decb(_0x25f151['error'][_0xd002('0x13')]);}logger['error'](_0xd002('0xf'),_0x4c394b,_0x25f151[_0xd002('0x12')][_0xd002('0x13')]);return _0x1f3a02(_0x25f151['error']['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x4c394b,_0xd002('0x10'));_0x1f3a02(_0x25f151['result']['message']);}})[_0xd002('0x14')](function(_0x4b3567){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4c394b,_0x4b3567);_0x23decb(_0x4b3567);});});} \ No newline at end of file +var _0x9714=['error','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x4b91f3,_0x549a38){var _0x9a2e3e=function(_0xd1cddc){while(--_0xd1cddc){_0x4b91f3['push'](_0x4b91f3['shift']());}};_0x9a2e3e(++_0x549a38);}(_0x9714,0x9e));var _0x4971=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x9714[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x4971('0x0'));var util=require('util');var moment=require(_0x4971('0x1'));var BPromise=require(_0x4971('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4971('0x3'));var logger=require(_0x4971('0x4'))(_0x4971('0x5'));var config=require(_0x4971('0x6'));var jayson=require(_0x4971('0x7'));var client=jayson[_0x4971('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9f6b,_0x211900,_0x589dc9){return new BPromise(function(_0x5587e3,_0x216df8){return client[_0x4971('0x9')](_0xc9f6b,_0x589dc9)[_0x4971('0xa')](function(_0x192f18){logger[_0x4971('0xb')](_0x4971('0xc'),_0x211900,_0x4971('0xd'));logger[_0x4971('0xe')](_0x4971('0xf'),_0x211900,_0x4971('0xd'),JSON[_0x4971('0x10')](_0x192f18));if(_0x192f18['error']){if(_0x192f18['error'][_0x4971('0x11')]===0x1f4){logger[_0x4971('0x12')](_0x4971('0xc'),_0x211900,_0x192f18[_0x4971('0x12')]['message']);return _0x216df8(_0x192f18[_0x4971('0x12')][_0x4971('0x13')]);}logger['error'](_0x4971('0xc'),_0x211900,_0x192f18[_0x4971('0x12')][_0x4971('0x13')]);return _0x5587e3(_0x192f18['error'][_0x4971('0x13')]);}else{logger[_0x4971('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x211900,_0x4971('0xd'));_0x5587e3(_0x192f18[_0x4971('0x14')][_0x4971('0x13')]);}})[_0x4971('0x15')](function(_0x2a8037){logger[_0x4971('0x12')](_0x4971('0xc'),_0x211900,_0x2a8037);_0x216df8(_0x2a8037);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 63604c6..31ded93 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x801bdb,_0x261b61){var _0xfe915c=function(_0x5ad212){while(--_0x5ad212){_0x801bdb['push'](_0x801bdb['shift']());}};_0xfe915c(++_0x261b61);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4375bf,_0x768a61){var _0x28b84b=function(_0x23e688){while(--_0x23e688){_0x4375bf['push'](_0x4375bf['shift']());}};_0x28b84b(++_0x768a61);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a0ad487..e2e114e 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 _0x8c73=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0x8c73,0x10d));var _0x38c7=function(_0x572246,_0x31c860){_0x572246=_0x572246-0x0;var _0x53ff43=_0x8c73[_0x572246];return _0x53ff43;};'use strict';var Sequelize=require(_0x38c7('0x0'));module[_0x38c7('0x1')]={'uniqueid':{'type':Sequelize[_0x38c7('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x38c7('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x38c7('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x38c7('0x4')],'allowNull':![],'unique':_0x38c7('0x5'),'comment':_0x38c7('0x3')},'VoiceQueueId':{'type':Sequelize[_0x38c7('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x38c7('0x4')],'allowNull':![],'unique':_0x38c7('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x38c7('0x2')](0xb),'defaultValue':0x0,'comment':_0x38c7('0x3')},'paused':{'type':Sequelize[_0x38c7('0x2')](0xb),'defaultValue':0x0,'comment':_0x38c7('0x3')}}; \ No newline at end of file +var _0x1340=['queue_interface','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x15f910,_0x509727){var _0x55b1cb=function(_0x4c1912){while(--_0x4c1912){_0x15f910['push'](_0x15f910['shift']());}};_0x55b1cb(++_0x509727);}(_0x1340,0x74));var _0x0134=function(_0x4bec3f,_0x4af915){_0x4bec3f=_0x4bec3f-0x0;var _0x42ac43=_0x1340[_0x4bec3f];return _0x42ac43;};'use strict';var Sequelize=require('sequelize');module[_0x0134('0x0')]={'uniqueid':{'type':Sequelize[_0x0134('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x0134('0x2')},'membername':{'type':Sequelize[_0x0134('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x0134('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x0134('0x3')],'allowNull':![],'unique':_0x0134('0x4'),'comment':_0x0134('0x2')},'VoiceQueueId':{'type':Sequelize[_0x0134('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x0134('0x3')],'allowNull':![],'unique':_0x0134('0x4'),'comment':_0x0134('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x0134('0x2')},'paused':{'type':Sequelize[_0x0134('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index f8dc6a3..6811b9e 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 _0xf15c=['hasOwnProperty','exports','UserVoiceQueueRt','setMaxListeners','save','update','remove','emit'];(function(_0x4c7b30,_0x5e51aa){var _0x46d373=function(_0x1589b3){while(--_0x1589b3){_0x4c7b30['push'](_0x4c7b30['shift']());}};_0x46d373(++_0x5e51aa);}(_0xf15c,0x112));var _0xcf15=function(_0x376217,_0x2cc9d2){_0x376217=_0x376217-0x0;var _0x4fda02=_0xf15c[_0x376217];return _0x4fda02;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xcf15('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xcf15('0x1')](0x0);var events={'afterCreate':_0xcf15('0x2'),'afterUpdate':_0xcf15('0x3'),'afterDestroy':_0xcf15('0x4')};function emitEvent(_0x434991){return function(_0x4d1640,_0x532144,_0xe7991e){UserVoiceQueueRtEvents[_0xcf15('0x5')](_0x434991+':'+_0x4d1640['id'],_0x4d1640);UserVoiceQueueRtEvents[_0xcf15('0x5')](_0x434991,_0x4d1640);_0xe7991e(null);};}for(var e in events){if(events[_0xcf15('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xcf15('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xa794=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','update'];(function(_0x12cb32,_0x16ecb0){var _0x1679a2=function(_0x2ea133){while(--_0x2ea133){_0x12cb32['push'](_0x12cb32['shift']());}};_0x1679a2(++_0x16ecb0);}(_0xa794,0xfe));var _0x4a79=function(_0x2f876a,_0x411cb0){_0x2f876a=_0x2f876a-0x0;var _0xeceb68=_0xa794[_0x2f876a];return _0xeceb68;};'use strict';var EventEmitter=require(_0x4a79('0x0'));var UserVoiceQueueRt=require(_0x4a79('0x1'))['db'][_0x4a79('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4a79('0x3')](0x0);var events={'afterCreate':_0x4a79('0x4'),'afterUpdate':_0x4a79('0x5'),'afterDestroy':'remove'};function emitEvent(_0x50a972){return function(_0x20110b,_0x45e3dd,_0x1de7fb){UserVoiceQueueRtEvents['emit'](_0x50a972+':'+_0x20110b['id'],_0x20110b);UserVoiceQueueRtEvents[_0x4a79('0x6')](_0x50a972,_0x20110b);_0x1de7fb(null);};}for(var e in events){if(events[_0x4a79('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x4a79('0x8')](e,emitEvent(event));}}module[_0x4a79('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3d54a12..59cfbb7 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 _0xab7b=['moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','define','user_has_voice_queues_rt','lodash','../../config/logger','api'];(function(_0x1bcb83,_0x150ecb){var _0x327a4d=function(_0x57e05b){while(--_0x57e05b){_0x1bcb83['push'](_0x1bcb83['shift']());}};_0x327a4d(++_0x150ecb);}(_0xab7b,0x141));var _0xbab7=function(_0x3f43ef,_0x4c2ba9){_0x3f43ef=_0x3f43ef-0x0;var _0x20af43=_0xab7b[_0x3f43ef];return _0x20af43;};'use strict';var _=require(_0xbab7('0x0'));var util=require('util');var logger=require(_0xbab7('0x1'))(_0xbab7('0x2'));var moment=require(_0xbab7('0x3'));var BPromise=require(_0xbab7('0x4'));var rp=require(_0xbab7('0x5'));var fs=require('fs');var path=require(_0xbab7('0x6'));var rimraf=require(_0xbab7('0x7'));var config=require('../../config/environment');var attributes=require(_0xbab7('0x8'));module[_0xbab7('0x9')]=function(_0x5e25a9,_0x26938c){return _0x5e25a9[_0xbab7('0xa')]('UserVoiceQueueRt',attributes,{'tableName':_0xbab7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb848=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','moment','bluebird','request-promise','path'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0xb848,0x11b));var _0x8b84=function(_0x532607,_0x1a44af){_0x532607=_0x532607-0x0;var _0x5093b0=_0xb848[_0x532607];return _0x5093b0;};'use strict';var _=require(_0x8b84('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8b84('0x1'));var BPromise=require(_0x8b84('0x2'));var rp=require(_0x8b84('0x3'));var fs=require('fs');var path=require(_0x8b84('0x4'));var rimraf=require(_0x8b84('0x5'));var config=require(_0x8b84('0x6'));var attributes=require(_0x8b84('0x7'));module[_0x8b84('0x8')]=function(_0x4d7884,_0x3b59f3){return _0x4d7884[_0x8b84('0x9')](_0x8b84('0xa'),attributes,{'tableName':_0x8b84('0xb'),'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 a219961..4b174d7 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 _0xb022=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','localhost'];(function(_0x49b351,_0x6de6c7){var _0x378413=function(_0x464a78){while(--_0x464a78){_0x49b351['push'](_0x49b351['shift']());}};_0x378413(++_0x6de6c7);}(_0xb022,0xd2));var _0x2b02=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xb022[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var moment=require(_0x2b02('0x2'));var BPromise=require(_0x2b02('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b02('0x4'));var db=require(_0x2b02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b02('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2b02('0x7'));var client=jayson[_0x2b02('0x8')][_0x2b02('0x9')]({'port':0x232a});config[_0x2b02('0xa')]=_['defaults'](config[_0x2b02('0xa')],{'host':_0x2b02('0xb'),'port':0x18eb});var socket=require(_0x2b02('0xc'))(new Redis(config[_0x2b02('0xa')]));require(_0x2b02('0xd'))[_0x2b02('0xe')](socket);function respondWithRpcPromise(_0x56af87,_0x1a0a6f,_0x5333b3){return new BPromise(function(_0x522366,_0x5a3b72){return client[_0x2b02('0xf')](_0x56af87,_0x5333b3)[_0x2b02('0x10')](function(_0x24da35){logger[_0x2b02('0x11')](_0x2b02('0x12'),_0x1a0a6f,_0x2b02('0x13'));logger[_0x2b02('0x14')](_0x2b02('0x15'),_0x1a0a6f,_0x2b02('0x13'),JSON['stringify'](_0x24da35));if(_0x24da35[_0x2b02('0x16')]){if(_0x24da35[_0x2b02('0x16')][_0x2b02('0x17')]===0x1f4){logger['error'](_0x2b02('0x12'),_0x1a0a6f,_0x24da35[_0x2b02('0x16')][_0x2b02('0x18')]);return _0x5a3b72(_0x24da35[_0x2b02('0x16')][_0x2b02('0x18')]);}logger['error'](_0x2b02('0x12'),_0x1a0a6f,_0x24da35[_0x2b02('0x16')][_0x2b02('0x18')]);return _0x522366(_0x24da35['error'][_0x2b02('0x18')]);}else{logger[_0x2b02('0x11')](_0x2b02('0x12'),_0x1a0a6f,_0x2b02('0x13'));_0x522366(_0x24da35['result'][_0x2b02('0x18')]);}})[_0x2b02('0x19')](function(_0x43df84){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x1a0a6f,_0x43df84);_0x5a3b72(_0x43df84);});});}exports[_0x2b02('0x1a')]=function(_0x5b80a3){var _0x29adad=this;return new Promise(function(_0x488602,_0x93cbb){return db[_0x2b02('0x1b')][_0x2b02('0x1c')]({'raw':_0x5b80a3[_0x2b02('0x1d')]?_0x5b80a3[_0x2b02('0x1d')][_0x2b02('0x1e')]===undefined?!![]:![]:!![],'where':_0x5b80a3[_0x2b02('0x1d')]?_0x5b80a3['options'][_0x2b02('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2b02('0x20'),db[_0x2b02('0x21')]['fn']('IF',db[_0x2b02('0x21')][_0x2b02('0x22')](_0x2b02('0x23')))),_0x2b02('0x24')]]})[_0x2b02('0x10')](function(_0x57cf50){logger[_0x2b02('0x11')](_0x2b02('0x1a'),_0x5b80a3);logger['debug'](_0x2b02('0x1a'),_0x5b80a3,JSON['stringify'](_0x57cf50));_0x488602(_0x57cf50);})[_0x2b02('0x19')](function(_0x3671b6){logger['error'](_0x2b02('0x1a'),_0x3671b6['message'],_0x5b80a3);_0x93cbb(_0x29adad[_0x2b02('0x16')](0x1f4,_0x3671b6['message']));});});}; \ No newline at end of file +var _0xbd73=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x4bdea0,_0x3a3e49){var _0x182ad0=function(_0x2a68e2){while(--_0x2a68e2){_0x4bdea0['push'](_0x4bdea0['shift']());}};_0x182ad0(++_0x3a3e49);}(_0xbd73,0x103));var _0x3bd7=function(_0x3ee414,_0x39e0a6){_0x3ee414=_0x3ee414-0x0;var _0xcdc9da=_0xbd73[_0x3ee414];return _0xcdc9da;};'use strict';var _=require(_0x3bd7('0x0'));var util=require(_0x3bd7('0x1'));var moment=require('moment');var BPromise=require(_0x3bd7('0x2'));var rs=require(_0x3bd7('0x3'));var fs=require('fs');var Redis=require(_0x3bd7('0x4'));var db=require(_0x3bd7('0x5'))['db'];var utils=require(_0x3bd7('0x6'));var logger=require('../../config/logger')(_0x3bd7('0x7'));var config=require(_0x3bd7('0x8'));var jayson=require(_0x3bd7('0x9'));var client=jayson[_0x3bd7('0xa')]['http']({'port':0x232a});config['redis']=_[_0x3bd7('0xb')](config[_0x3bd7('0xc')],{'host':_0x3bd7('0xd'),'port':0x18eb});var socket=require(_0x3bd7('0xe'))(new Redis(config[_0x3bd7('0xc')]));require(_0x3bd7('0xf'))[_0x3bd7('0x10')](socket);function respondWithRpcPromise(_0x27508e,_0x5028a9,_0x180b7e){return new BPromise(function(_0x5ebb6f,_0x37e8de){return client[_0x3bd7('0x11')](_0x27508e,_0x180b7e)['then'](function(_0x298b9c){logger['info'](_0x3bd7('0x12'),_0x5028a9,_0x3bd7('0x13'));logger[_0x3bd7('0x14')](_0x3bd7('0x15'),_0x5028a9,_0x3bd7('0x13'),JSON[_0x3bd7('0x16')](_0x298b9c));if(_0x298b9c['error']){if(_0x298b9c[_0x3bd7('0x17')][_0x3bd7('0x18')]===0x1f4){logger[_0x3bd7('0x17')](_0x3bd7('0x12'),_0x5028a9,_0x298b9c[_0x3bd7('0x17')][_0x3bd7('0x19')]);return _0x37e8de(_0x298b9c['error'][_0x3bd7('0x19')]);}logger['error'](_0x3bd7('0x12'),_0x5028a9,_0x298b9c[_0x3bd7('0x17')][_0x3bd7('0x19')]);return _0x5ebb6f(_0x298b9c[_0x3bd7('0x17')][_0x3bd7('0x19')]);}else{logger[_0x3bd7('0x1a')](_0x3bd7('0x12'),_0x5028a9,_0x3bd7('0x13'));_0x5ebb6f(_0x298b9c[_0x3bd7('0x1b')][_0x3bd7('0x19')]);}})[_0x3bd7('0x1c')](function(_0x5bfff1){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5028a9,_0x5bfff1);_0x37e8de(_0x5bfff1);});});}exports[_0x3bd7('0x1d')]=function(_0x4f4e4b){var _0x4f9e2c=this;return new Promise(function(_0x2d2265,_0x3df505){return db[_0x3bd7('0x1e')][_0x3bd7('0x1f')]({'raw':_0x4f4e4b[_0x3bd7('0x20')]?_0x4f4e4b['options'][_0x3bd7('0x21')]===undefined?!![]:![]:!![],'where':_0x4f4e4b[_0x3bd7('0x20')]?_0x4f4e4b[_0x3bd7('0x20')]['where']||null:null,'attributes':[[db[_0x3bd7('0x22')]['fn'](_0x3bd7('0x23'),db['sequelize']['fn']('IF',db[_0x3bd7('0x22')][_0x3bd7('0x24')](_0x3bd7('0x25')))),_0x3bd7('0x26')]]})['then'](function(_0x42aca3){logger['info'](_0x3bd7('0x1d'),_0x4f4e4b);logger['debug'](_0x3bd7('0x1d'),_0x4f4e4b,JSON[_0x3bd7('0x16')](_0x42aca3));_0x2d2265(_0x42aca3);})[_0x3bd7('0x1c')](function(_0x52b290){logger[_0x3bd7('0x17')](_0x3bd7('0x1d'),_0x52b290[_0x3bd7('0x19')],_0x4f4e4b);_0x3df505(_0x4f9e2c['error'](0x1f4,_0x52b290[_0x3bd7('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 837e902..a4c29c8 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 _0x5bd7=['length','userVoiceQueueRt:','save','remove','update','emit','removeListener','register'];(function(_0x34bd11,_0x322433){var _0x2a4f5c=function(_0x3296e3){while(--_0x3296e3){_0x34bd11['push'](_0x34bd11['shift']());}};_0x2a4f5c(++_0x322433);}(_0x5bd7,0x12a));var _0x75bd=function(_0x324b12,_0xd979f4){_0x324b12=_0x324b12-0x0;var _0x55e875=_0x5bd7[_0x324b12];return _0x55e875;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x75bd('0x0'),_0x75bd('0x1'),_0x75bd('0x2')];function createListener(_0x52a721,_0x3c0c8f){return function(_0x4aa89d){_0x3c0c8f[_0x75bd('0x3')](_0x52a721,_0x4aa89d);};}function removeListener(_0x24036f,_0x524c93){return function(){UserVoiceQueueRtEvents[_0x75bd('0x4')](_0x24036f,_0x524c93);};}exports[_0x75bd('0x5')]=function(_0x2aaa6a){for(var _0x47c9c7=0x0,_0x391b42=events[_0x75bd('0x6')];_0x47c9c7<_0x391b42;_0x47c9c7++){var _0x70cd30=events[_0x47c9c7];var _0x2417ba=createListener(_0x75bd('0x7')+_0x70cd30,_0x2aaa6a);UserVoiceQueueRtEvents['on'](_0x70cd30,_0x2417ba);}}; \ No newline at end of file +var _0x1574=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x58c513,_0x15deec){var _0x4da4c4=function(_0x112a83){while(--_0x112a83){_0x58c513['push'](_0x58c513['shift']());}};_0x4da4c4(++_0x15deec);}(_0x1574,0x148));var _0x4157=function(_0x36abde,_0x2f47d4){_0x36abde=_0x36abde-0x0;var _0x3b84fc=_0x1574[_0x36abde];return _0x3b84fc;};'use strict';var UserVoiceQueueRtEvents=require(_0x4157('0x0'));var events=[_0x4157('0x1'),_0x4157('0x2'),_0x4157('0x3')];function createListener(_0x56ee53,_0x31fa4d){return function(_0x3bdabb){_0x31fa4d[_0x4157('0x4')](_0x56ee53,_0x3bdabb);};}function removeListener(_0x1759d6,_0x2f0766){return function(){UserVoiceQueueRtEvents[_0x4157('0x5')](_0x1759d6,_0x2f0766);};}exports[_0x4157('0x6')]=function(_0x43c6dc){for(var _0xbd0cf7=0x0,_0x1ece73=events[_0x4157('0x7')];_0xbd0cf7<_0x1ece73;_0xbd0cf7++){var _0x213c67=events[_0xbd0cf7];var _0x17a9ec=createListener(_0x4157('0x8')+_0x213c67,_0x43c6dc);UserVoiceQueueRtEvents['on'](_0x213c67,_0x17a9ec);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 412eb29..c07b349 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x53d71c,_0x1a3859){var _0x555efb=function(_0x32ef67){while(--_0x32ef67){_0x53d71c['push'](_0x53d71c['shift']());}};_0x555efb(++_0x1a3859);}(_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 +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4750ca,_0x5d50e1){var _0x52b854=function(_0x42a79c){while(--_0x42a79c){_0x4750ca['push'](_0x4750ca['shift']());}};_0x52b854(++_0x5d50e1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xcb91[_0xd09668];return _0x68726;};'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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1eff14b..f3d8386 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 _0x759a=['sequelize','INTEGER'];(function(_0x5529e5,_0x4632e3){var _0xde48cb=function(_0x165243){while(--_0x165243){_0x5529e5['push'](_0x5529e5['shift']());}};_0xde48cb(++_0x4632e3);}(_0x759a,0x126));var _0xa759=function(_0x71487b,_0x59c3e5){_0x71487b=_0x71487b-0x0;var _0xe335f2=_0x759a[_0x71487b];return _0xe335f2;};'use strict';var Sequelize=require(_0xa759('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xa759('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe049=['exports','INTEGER','sequelize'];(function(_0x56ec7e,_0x3e5d1e){var _0x44619f=function(_0x41df52){while(--_0x41df52){_0x56ec7e['push'](_0x56ec7e['shift']());}};_0x44619f(++_0x3e5d1e);}(_0xe049,0x1f1));var _0x9e04=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe049[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x9e04('0x0'));module[_0x9e04('0x1')]={'penalty':{'type':Sequelize[_0x9e04('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index efde3b2..6c81876 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 _0x4434=['bluebird','request-promise','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api'];(function(_0xda573c,_0x2ad7d1){var _0x4e7f89=function(_0x59db46){while(--_0x59db46){_0xda573c['push'](_0xda573c['shift']());}};_0x4e7f89(++_0x2ad7d1);}(_0x4434,0x1bf));var _0x4443=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4434[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x4443('0x0'));var util=require(_0x4443('0x1'));var logger=require('../../config/logger')(_0x4443('0x2'));var moment=require('moment');var BPromise=require(_0x4443('0x3'));var rp=require(_0x4443('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4443('0x5'));module[_0x4443('0x6')]=function(_0x4de916,_0xd3196e){return _0x4de916[_0x4443('0x7')](_0x4443('0x8'),attributes,{'tableName':_0x4443('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3529=['user_has_whatsapp_queues','lodash','moment','request-promise','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3529,0x157));var _0x9352=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0x3529[_0x2dee2f];return _0x327c18;};'use strict';var _=require(_0x9352('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x9352('0x1'));var BPromise=require('bluebird');var rp=require(_0x9352('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x9352('0x3')]=function(_0xc35ee0,_0x309913){return _0xc35ee0[_0x9352('0x4')]('UserWhatsappQueue',attributes,{'tableName':_0x9352('0x5'),'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 d6cef8e..b1c93f3 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 _0xa632=['info','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserWhatsappQueue,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then'];(function(_0x18b637,_0x415f58){var _0x2008c3=function(_0x551b00){while(--_0x551b00){_0x18b637['push'](_0x18b637['shift']());}};_0x2008c3(++_0x415f58);}(_0xa632,0x12f));var _0x2a63=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa632[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x2a63('0x0'));var util=require(_0x2a63('0x1'));var moment=require(_0x2a63('0x2'));var BPromise=require(_0x2a63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a63('0x4'));var db=require(_0x2a63('0x5'))['db'];var utils=require(_0x2a63('0x6'));var logger=require(_0x2a63('0x7'))(_0x2a63('0x8'));var config=require(_0x2a63('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2a63('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56388a,_0x56ab14,_0x50eb74){return new BPromise(function(_0xe3dd5e,_0x403e9e){return client['request'](_0x56388a,_0x50eb74)[_0x2a63('0xb')](function(_0x4f33ee){logger[_0x2a63('0xc')]('UserWhatsappQueue,\x20%s,\x20%s',_0x56ab14,'request\x20sent');logger['debug'](_0x2a63('0xd'),_0x56ab14,_0x2a63('0xe'),JSON[_0x2a63('0xf')](_0x4f33ee));if(_0x4f33ee[_0x2a63('0x10')]){if(_0x4f33ee['error'][_0x2a63('0x11')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x56ab14,_0x4f33ee['error'][_0x2a63('0x12')]);return _0x403e9e(_0x4f33ee[_0x2a63('0x10')][_0x2a63('0x12')]);}logger[_0x2a63('0x10')](_0x2a63('0x13'),_0x56ab14,_0x4f33ee[_0x2a63('0x10')][_0x2a63('0x12')]);return _0xe3dd5e(_0x4f33ee['error'][_0x2a63('0x12')]);}else{logger['info'](_0x2a63('0x13'),_0x56ab14,_0x2a63('0xe'));_0xe3dd5e(_0x4f33ee[_0x2a63('0x14')][_0x2a63('0x12')]);}})['catch'](function(_0x4a4450){logger[_0x2a63('0x10')](_0x2a63('0x13'),_0x56ab14,_0x4a4450);_0x403e9e(_0x4a4450);});});} \ No newline at end of file +var _0x700a=['../../config/utils','rpc','jayson/promise','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','bluebird','../../mysqldb'];(function(_0x36f6bb,_0x317dfc){var _0x3b5f87=function(_0x2839d7){while(--_0x2839d7){_0x36f6bb['push'](_0x36f6bb['shift']());}};_0x3b5f87(++_0x317dfc);}(_0x700a,0x107));var _0xa700=function(_0x54dbe2,_0x26b44e){_0x54dbe2=_0x54dbe2-0x0;var _0x57bde7=_0x700a[_0x54dbe2];return _0x57bde7;};'use strict';var _=require('lodash');var util=require(_0xa700('0x0'));var moment=require('moment');var BPromise=require(_0xa700('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa700('0x2'))['db'];var utils=require(_0xa700('0x3'));var logger=require('../../config/logger')(_0xa700('0x4'));var config=require('../../config/environment');var jayson=require(_0xa700('0x5'));var client=jayson['client'][_0xa700('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x434c97,_0xedc1dc,_0x57e776){return new BPromise(function(_0x3932fe,_0x3b95dd){return client[_0xa700('0x7')](_0x434c97,_0x57e776)['then'](function(_0x45312e){logger[_0xa700('0x8')](_0xa700('0x9'),_0xedc1dc,'request\x20sent');logger[_0xa700('0xa')](_0xa700('0xb'),_0xedc1dc,_0xa700('0xc'),JSON[_0xa700('0xd')](_0x45312e));if(_0x45312e[_0xa700('0xe')]){if(_0x45312e['error'][_0xa700('0xf')]===0x1f4){logger[_0xa700('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0xedc1dc,_0x45312e[_0xa700('0xe')]['message']);return _0x3b95dd(_0x45312e['error'][_0xa700('0x10')]);}logger['error'](_0xa700('0x9'),_0xedc1dc,_0x45312e['error']['message']);return _0x3932fe(_0x45312e['error']['message']);}else{logger[_0xa700('0x8')](_0xa700('0x9'),_0xedc1dc,'request\x20sent');_0x3932fe(_0x45312e[_0xa700('0x11')][_0xa700('0x10')]);}})[_0xa700('0x12')](function(_0x584a2f){logger[_0xa700('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0xedc1dc,_0x584a2f);_0x3b95dd(_0x584a2f);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 47aa3ea..c3867ac 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 _0x6334=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0x6334,0x119));var _0x4633=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x6334[_0x5f36cd];return _0x49832a;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0xe')]);router[_0x4633('0xf')]('/',auth['isAuthenticated'](),controller[_0x4633('0x10')]);router[_0x4633('0x11')](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0x12')]);router[_0x4633('0x13')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0x14')]);module[_0x4633('0x15')]=router; \ No newline at end of file +var _0x6f7f=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','create','destroy'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x6f7f,0x177));var _0xf6f7=function(_0x4616ac,_0x83f691){_0x4616ac=_0x4616ac-0x0;var _0x30af31=_0x6f7f[_0x4616ac];return _0x30af31;};'use strict';var multer=require('multer');var util=require(_0xf6f7('0x0'));var path=require(_0xf6f7('0x1'));var timeout=require(_0xf6f7('0x2'));var express=require(_0xf6f7('0x3'));var router=express[_0xf6f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf6f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf6f7('0x6'));var controller=require(_0xf6f7('0x7'));router[_0xf6f7('0x8')]('/',auth['isAuthenticated'](),controller[_0xf6f7('0x9')]);router['get'](_0xf6f7('0xa'),auth[_0xf6f7('0xb')](),controller[_0xf6f7('0xc')]);router[_0xf6f7('0xd')]('/',auth[_0xf6f7('0xb')](),controller[_0xf6f7('0xe')]);router['put'](_0xf6f7('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6f7('0xa'),auth[_0xf6f7('0xb')](),controller[_0xf6f7('0xf')]);module[_0xf6f7('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index fb176e6..556d69b 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 _0x7c6b=['exports','STRING','sequelize'];(function(_0x552b66,_0x3ccf09){var _0x1c3318=function(_0x4d79f4){while(--_0x4d79f4){_0x552b66['push'](_0x552b66['shift']());}};_0x1c3318(++_0x3ccf09);}(_0x7c6b,0x9b));var _0xb7c6=function(_0x3797ba,_0x2478f2){_0x3797ba=_0x3797ba-0x0;var _0x55c7fd=_0x7c6b[_0x3797ba];return _0x55c7fd;};'use strict';var Sequelize=require(_0xb7c6('0x0'));module[_0xb7c6('0x1')]={'name':{'type':Sequelize[_0xb7c6('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb7c6('0x2')]}}; \ No newline at end of file +var _0x64f0=['name','STRING','sequelize'];(function(_0x26f7d5,_0x2fad0f){var _0x29d177=function(_0x40f87e){while(--_0x40f87e){_0x26f7d5['push'](_0x26f7d5['shift']());}};_0x29d177(++_0x2fad0f);}(_0x64f0,0x1a0));var _0x064f=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0x64f0[_0x20fdc1];return _0x25397c;};'use strict';var Sequelize=require(_0x064f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x064f('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x064f('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 0e54c30..c88863b 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 _0xc5cd=['include','findAll','rows','catch','show','params','fields','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Variables','UserProfileSection','autoAssociation','eml-format','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','UserProfileResource','destroy','error','stack','name','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x32a633,_0x2fce2a){var _0x4fda3a=function(_0x27d816){while(--_0x27d816){_0x32a633['push'](_0x32a633['shift']());}};_0x4fda3a(++_0x2fce2a);}(_0xc5cd,0x66));var _0xdc5c=function(_0x3186ae,_0x5d615c){_0x3186ae=_0x3186ae-0x0;var _0x247818=_0xc5cd[_0x3186ae];return _0x247818;};'use strict';var emlformat=require(_0xdc5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc5c('0x1'));var jsonpatch=require(_0xdc5c('0x2'));var rp=require(_0xdc5c('0x3'));var moment=require(_0xdc5c('0x4'));var BPromise=require(_0xdc5c('0x5'));var Mustache=require(_0xdc5c('0x6'));var util=require(_0xdc5c('0x7'));var path=require(_0xdc5c('0x8'));var sox=require(_0xdc5c('0x9'));var csv=require(_0xdc5c('0xa'));var ejs=require(_0xdc5c('0xb'));var fs=require('fs');var fs_extra=require(_0xdc5c('0xc'));var _=require('lodash');var squel=require(_0xdc5c('0xd'));var crypto=require(_0xdc5c('0xe'));var jsforce=require(_0xdc5c('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc5c('0x10'));var Redis=require(_0xdc5c('0x11'));var authService=require(_0xdc5c('0x12'));var qs=require(_0xdc5c('0x13'));var as=require(_0xdc5c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc5c('0x15'))(_0xdc5c('0x16'));var utils=require(_0xdc5c('0x17'));var config=require(_0xdc5c('0x18'));var licenseUtil=require(_0xdc5c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cc8e9,_0x2afd0d){_0x2afd0d=_0x2afd0d||0xcc;return function(_0x20e523){if(_0x20e523){return _0x5cc8e9[_0xdc5c('0x1a')](_0x2afd0d);}return _0x5cc8e9['status'](_0x2afd0d)[_0xdc5c('0x1b')]();};}function respondWithResult(_0x3f4357,_0x440b16){_0x440b16=_0x440b16||0xc8;return function(_0x21f892){if(_0x21f892){return _0x3f4357[_0xdc5c('0x1c')](_0x440b16)[_0xdc5c('0x1d')](_0x21f892);}};}function respondWithFilteredResult(_0x51003b,_0xc7d002){return function(_0x1b511d){if(_0x1b511d){var _0x49c0e9=typeof _0xc7d002[_0xdc5c('0x1e')]===_0xdc5c('0x1f')&&typeof _0xc7d002[_0xdc5c('0x20')]===_0xdc5c('0x1f');var _0x4c094e=_0x1b511d[_0xdc5c('0x21')];var _0x773930=_0x49c0e9?0x0:_0xc7d002[_0xdc5c('0x1e')];var _0x192a6a=_0x49c0e9?_0x1b511d['count']:_0xc7d002['offset']+_0xc7d002['limit'];var _0x3f7246;if(_0x192a6a>=_0x4c094e){_0x192a6a=_0x4c094e;_0x3f7246=0xc8;}else{_0x3f7246=0xce;}_0x51003b['status'](_0x3f7246);return _0x51003b[_0xdc5c('0x22')](_0xdc5c('0x23'),_0x773930+'-'+_0x192a6a+'/'+_0x4c094e)['json'](_0x1b511d);}return null;};}function patchUpdates(_0x9f4ef0){return function(_0x27b8bb){try{jsonpatch[_0xdc5c('0x24')](_0x27b8bb,_0x9f4ef0,!![]);}catch(_0x18b0bc){return BPromise['reject'](_0x18b0bc);}return _0x27b8bb['save']();};}function saveUpdates(_0x373487,_0x4a1ee7){return function(_0x2268c2){if(_0x2268c2){return _0x2268c2[_0xdc5c('0x25')](_0x373487)[_0xdc5c('0x26')](function(_0x2b3ddd){return _0x2b3ddd;});}return null;};}function removeEntity(_0x559f5d,_0x351ce7){return function(_0x343912){if(_0x343912){return _0x343912['destroy']()['then'](function(){var _0x16bac1=_0x343912['get']({'plain':!![]});var _0x15d5c2='Variables';return db[_0xdc5c('0x27')][_0xdc5c('0x28')]({'where':{'type':_0x15d5c2,'resourceId':_0x16bac1['id']}})[_0xdc5c('0x26')](function(){return _0x343912;});})['then'](function(){_0x559f5d[_0xdc5c('0x1c')](0xcc)[_0xdc5c('0x1b')]();});}};}function handleEntityNotFound(_0x21b045,_0x25ffd5){return function(_0x3574af){if(!_0x3574af){_0x21b045[_0xdc5c('0x1a')](0x194);}return _0x3574af;};}function handleError(_0x52fed7,_0x101f3c){_0x101f3c=_0x101f3c||0x1f4;return function(_0xa3f97f){logger[_0xdc5c('0x29')](_0xa3f97f[_0xdc5c('0x2a')]);if(_0xa3f97f[_0xdc5c('0x2b')]){delete _0xa3f97f['name'];}_0x52fed7[_0xdc5c('0x1c')](_0x101f3c)['send'](_0xa3f97f);};}exports[_0xdc5c('0x2c')]=function(_0x24004c,_0x44ab50){var _0x508707={},_0x447c0f={},_0x272d58={'count':0x0,'rows':[]};var _0x490e14=_[_0xdc5c('0x2d')](db[_0xdc5c('0x2e')][_0xdc5c('0x2f')],function(_0x5aadc8){return{'name':_0x5aadc8[_0xdc5c('0x30')],'type':_0x5aadc8[_0xdc5c('0x31')][_0xdc5c('0x32')]};});_0x447c0f[_0xdc5c('0x33')]=_[_0xdc5c('0x2d')](_0x490e14,_0xdc5c('0x2b'));_0x447c0f[_0xdc5c('0x34')]=_[_0xdc5c('0x35')](_0x24004c[_0xdc5c('0x34')]);_0x447c0f['filters']=_[_0xdc5c('0x36')](_0x447c0f[_0xdc5c('0x33')],_0x447c0f[_0xdc5c('0x34')]);_0x508707['attributes']=_[_0xdc5c('0x36')](_0x447c0f[_0xdc5c('0x33')],qs['fields'](_0x24004c['query']['fields']));_0x508707[_0xdc5c('0x37')]=_0x508707[_0xdc5c('0x37')]['length']?_0x508707[_0xdc5c('0x37')]:_0x447c0f[_0xdc5c('0x33')];if(!_0x24004c[_0xdc5c('0x34')][_0xdc5c('0x38')]('nolimit')){_0x508707[_0xdc5c('0x20')]=qs['limit'](_0x24004c[_0xdc5c('0x34')][_0xdc5c('0x20')]);_0x508707[_0xdc5c('0x1e')]=qs['offset'](_0x24004c[_0xdc5c('0x34')]['offset']);}_0x508707['order']=qs[_0xdc5c('0x39')](_0x24004c[_0xdc5c('0x34')][_0xdc5c('0x39')]);_0x508707[_0xdc5c('0x3a')]=qs[_0xdc5c('0x3b')](_[_0xdc5c('0x3c')](_0x24004c[_0xdc5c('0x34')],_0x447c0f[_0xdc5c('0x3b')]),_0x490e14);if(_0x24004c[_0xdc5c('0x34')][_0xdc5c('0x3d')]){_0x508707[_0xdc5c('0x3a')]=_[_0xdc5c('0x3e')](_0x508707[_0xdc5c('0x3a')],{'$or':_[_0xdc5c('0x2d')](_0x490e14,function(_0x5c63d0){if(_0x5c63d0['type']!==_0xdc5c('0x3f')){var _0x39dd28={};_0x39dd28[_0x5c63d0[_0xdc5c('0x2b')]]={'$like':'%'+_0x24004c[_0xdc5c('0x34')]['filter']+'%'};return _0x39dd28;}})});}_0x508707=_[_0xdc5c('0x3e')]({},_0x508707,_0x24004c[_0xdc5c('0x40')]);var _0x134254={'where':_0x508707[_0xdc5c('0x3a')]};return db[_0xdc5c('0x2e')][_0xdc5c('0x21')](_0x134254)[_0xdc5c('0x26')](function(_0x5b9dce){_0x272d58[_0xdc5c('0x21')]=_0x5b9dce;if(_0x24004c[_0xdc5c('0x34')][_0xdc5c('0x41')]){_0x508707[_0xdc5c('0x42')]=[{'all':!![]}];}return db[_0xdc5c('0x2e')][_0xdc5c('0x43')](_0x508707);})[_0xdc5c('0x26')](function(_0x347ef4){_0x272d58[_0xdc5c('0x44')]=_0x347ef4;return _0x272d58;})[_0xdc5c('0x26')](respondWithFilteredResult(_0x44ab50,_0x508707))[_0xdc5c('0x45')](handleError(_0x44ab50,null));};exports[_0xdc5c('0x46')]=function(_0x4404c2,_0x322658){var _0x2074ce={'raw':!![],'where':{'id':_0x4404c2[_0xdc5c('0x47')]['id']}},_0x4b692b={};_0x4b692b['model']=_[_0xdc5c('0x35')](db[_0xdc5c('0x2e')][_0xdc5c('0x2f')]);_0x4b692b[_0xdc5c('0x34')]=_[_0xdc5c('0x35')](_0x4404c2[_0xdc5c('0x34')]);_0x4b692b[_0xdc5c('0x3b')]=_[_0xdc5c('0x36')](_0x4b692b[_0xdc5c('0x33')],_0x4b692b[_0xdc5c('0x34')]);_0x2074ce[_0xdc5c('0x37')]=_[_0xdc5c('0x36')](_0x4b692b[_0xdc5c('0x33')],qs[_0xdc5c('0x48')](_0x4404c2['query']['fields']));_0x2074ce[_0xdc5c('0x37')]=_0x2074ce[_0xdc5c('0x37')][_0xdc5c('0x49')]?_0x2074ce[_0xdc5c('0x37')]:_0x4b692b[_0xdc5c('0x33')];if(_0x4404c2[_0xdc5c('0x34')][_0xdc5c('0x41')]){_0x2074ce[_0xdc5c('0x42')]=[{'all':!![]}];}_0x2074ce=_[_0xdc5c('0x3e')]({},_0x2074ce,_0x4404c2[_0xdc5c('0x40')]);return db[_0xdc5c('0x2e')][_0xdc5c('0x4a')](_0x2074ce)['then'](handleEntityNotFound(_0x322658,null))['then'](respondWithResult(_0x322658,null))[_0xdc5c('0x45')](handleError(_0x322658,null));};exports[_0xdc5c('0x4b')]=function(_0x3724fd,_0x1edb64){return db[_0xdc5c('0x2e')]['create'](_0x3724fd[_0xdc5c('0x4c')],{})[_0xdc5c('0x26')](function(_0x5a5a45){var _0x4d4845=_0x3724fd['user'][_0xdc5c('0x4d')]({'plain':!![]});if(!_0x4d4845)throw new Error(_0xdc5c('0x4e'));if(_0x4d4845[_0xdc5c('0x4f')]===_0xdc5c('0x50')){var _0x587cc5=_0x5a5a45['get']({'plain':!![]});var _0x335437=_0xdc5c('0x51');return db[_0xdc5c('0x52')][_0xdc5c('0x4a')]({'where':{'name':_0x335437,'userProfileId':_0x4d4845['userProfileId']},'raw':!![]})[_0xdc5c('0x26')](function(_0x30116e){if(_0x30116e&&_0x30116e[_0xdc5c('0x53')]===0x0){return db[_0xdc5c('0x27')][_0xdc5c('0x4b')]({'name':_0x587cc5[_0xdc5c('0x2b')],'resourceId':_0x587cc5['id'],'type':_0x30116e[_0xdc5c('0x2b')],'sectionId':_0x30116e['id']},{})[_0xdc5c('0x26')](function(){return _0x5a5a45;});}else{return _0x5a5a45;}})['catch'](function(_0x4c2d43){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c2d43);throw _0x4c2d43;});}return _0x5a5a45;})['then'](respondWithResult(_0x1edb64,0xc9))[_0xdc5c('0x45')](handleError(_0x1edb64,null));};exports['update']=function(_0x1a5e6f,_0x1d3790){if(_0x1a5e6f[_0xdc5c('0x4c')]['id']){delete _0x1a5e6f[_0xdc5c('0x4c')]['id'];}return db[_0xdc5c('0x2e')]['find']({'where':{'id':_0x1a5e6f[_0xdc5c('0x47')]['id']}})[_0xdc5c('0x26')](handleEntityNotFound(_0x1d3790,null))[_0xdc5c('0x26')](saveUpdates(_0x1a5e6f[_0xdc5c('0x4c')],null))['then'](respondWithResult(_0x1d3790,null))[_0xdc5c('0x45')](handleError(_0x1d3790,null));};exports[_0xdc5c('0x28')]=function(_0xf95a92,_0x419d2b){return db['Variable'][_0xdc5c('0x4a')]({'where':{'id':_0xf95a92[_0xdc5c('0x47')]['id']}})['then'](handleEntityNotFound(_0x419d2b,null))['then'](removeEntity(_0x419d2b,null))[_0xdc5c('0x45')](handleError(_0x419d2b,null));}; \ No newline at end of file +var _0xe98a=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','stack','name','index','map','Variable','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','rows','catch','rawAttributes','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','error','params'];(function(_0x1c96c4,_0x5288c4){var _0x5bb03b=function(_0x119cb2){while(--_0x119cb2){_0x1c96c4['push'](_0x1c96c4['shift']());}};_0x5bb03b(++_0x5288c4);}(_0xe98a,0xa4));var _0xae98=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xe98a[_0x243217];return _0x478029;};'use strict';var emlformat=require(_0xae98('0x0'));var rimraf=require(_0xae98('0x1'));var zipdir=require(_0xae98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae98('0x3'));var moment=require(_0xae98('0x4'));var BPromise=require(_0xae98('0x5'));var Mustache=require(_0xae98('0x6'));var util=require('util');var path=require(_0xae98('0x7'));var sox=require(_0xae98('0x8'));var csv=require('to-csv');var ejs=require(_0xae98('0x9'));var fs=require('fs');var fs_extra=require(_0xae98('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xae98('0xb'));var jsforce=require(_0xae98('0xc'));var deskjs=require(_0xae98('0xd'));var toCsv=require('to-csv');var querystring=require(_0xae98('0xe'));var Papa=require(_0xae98('0xf'));var Redis=require(_0xae98('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xae98('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae98('0x12'))(_0xae98('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae98('0x14'));var db=require(_0xae98('0x15'))['db'];function respondWithStatusCode(_0x34dc67,_0x4c93fa){_0x4c93fa=_0x4c93fa||0xcc;return function(_0x2ee4c9){if(_0x2ee4c9){return _0x34dc67[_0xae98('0x16')](_0x4c93fa);}return _0x34dc67[_0xae98('0x17')](_0x4c93fa)[_0xae98('0x18')]();};}function respondWithResult(_0x1ad0a8,_0xdbfcd1){_0xdbfcd1=_0xdbfcd1||0xc8;return function(_0x34b9ad){if(_0x34b9ad){return _0x1ad0a8[_0xae98('0x17')](_0xdbfcd1)['json'](_0x34b9ad);}};}function respondWithFilteredResult(_0x5b0583,_0x772abb){return function(_0x500273){if(_0x500273){var _0x39dc26=typeof _0x772abb['offset']===_0xae98('0x19')&&typeof _0x772abb[_0xae98('0x1a')]==='undefined';var _0x395dc9=_0x500273[_0xae98('0x1b')];var _0x58cf30=_0x39dc26?0x0:_0x772abb['offset'];var _0x3bd788=_0x39dc26?_0x500273[_0xae98('0x1b')]:_0x772abb[_0xae98('0x1c')]+_0x772abb[_0xae98('0x1a')];var _0x38b133;if(_0x3bd788>=_0x395dc9){_0x3bd788=_0x395dc9;_0x38b133=0xc8;}else{_0x38b133=0xce;}_0x5b0583[_0xae98('0x17')](_0x38b133);return _0x5b0583[_0xae98('0x1d')](_0xae98('0x1e'),_0x58cf30+'-'+_0x3bd788+'/'+_0x395dc9)[_0xae98('0x1f')](_0x500273);}return null;};}function patchUpdates(_0x5e9e4d){return function(_0x3d14a6){try{jsonpatch[_0xae98('0x20')](_0x3d14a6,_0x5e9e4d,!![]);}catch(_0x14d22f){return BPromise[_0xae98('0x21')](_0x14d22f);}return _0x3d14a6[_0xae98('0x22')]();};}function saveUpdates(_0x4f227a,_0x422575){return function(_0x4a51c1){if(_0x4a51c1){return _0x4a51c1[_0xae98('0x23')](_0x4f227a)[_0xae98('0x24')](function(_0x2c450d){return _0x2c450d;});}return null;};}function removeEntity(_0x45b654,_0x541c7f){return function(_0x2090a3){if(_0x2090a3){return _0x2090a3[_0xae98('0x25')]()[_0xae98('0x24')](function(){var _0x481ed6=_0x2090a3[_0xae98('0x26')]({'plain':!![]});var _0xd267c2=_0xae98('0x27');return db[_0xae98('0x28')][_0xae98('0x25')]({'where':{'type':_0xd267c2,'resourceId':_0x481ed6['id']}})[_0xae98('0x24')](function(){return _0x2090a3;});})[_0xae98('0x24')](function(){_0x45b654[_0xae98('0x17')](0xcc)[_0xae98('0x18')]();});}};}function handleEntityNotFound(_0x405ca0,_0x487a12){return function(_0x2bb637){if(!_0x2bb637){_0x405ca0['sendStatus'](0x194);}return _0x2bb637;};}function handleError(_0x4d5f92,_0x2a5686){_0x2a5686=_0x2a5686||0x1f4;return function(_0x19a677){logger['error'](_0x19a677[_0xae98('0x29')]);if(_0x19a677[_0xae98('0x2a')]){delete _0x19a677[_0xae98('0x2a')];}_0x4d5f92[_0xae98('0x17')](_0x2a5686)['send'](_0x19a677);};}exports[_0xae98('0x2b')]=function(_0x1b256e,_0x334d4d){var _0x22a989={},_0x17f345={},_0x21da13={'count':0x0,'rows':[]};var _0x247b93=_[_0xae98('0x2c')](db[_0xae98('0x2d')]['rawAttributes'],function(_0x30bcca){return{'name':_0x30bcca[_0xae98('0x2e')],'type':_0x30bcca[_0xae98('0x2f')][_0xae98('0x30')]};});_0x17f345[_0xae98('0x31')]=_[_0xae98('0x2c')](_0x247b93,_0xae98('0x2a'));_0x17f345['query']=_[_0xae98('0x32')](_0x1b256e[_0xae98('0x33')]);_0x17f345['filters']=_['intersection'](_0x17f345[_0xae98('0x31')],_0x17f345[_0xae98('0x33')]);_0x22a989['attributes']=_[_0xae98('0x34')](_0x17f345[_0xae98('0x31')],qs[_0xae98('0x35')](_0x1b256e[_0xae98('0x33')][_0xae98('0x35')]));_0x22a989[_0xae98('0x36')]=_0x22a989[_0xae98('0x36')][_0xae98('0x37')]?_0x22a989[_0xae98('0x36')]:_0x17f345[_0xae98('0x31')];if(!_0x1b256e[_0xae98('0x33')][_0xae98('0x38')](_0xae98('0x39'))){_0x22a989[_0xae98('0x1a')]=qs['limit'](_0x1b256e[_0xae98('0x33')][_0xae98('0x1a')]);_0x22a989['offset']=qs[_0xae98('0x1c')](_0x1b256e[_0xae98('0x33')][_0xae98('0x1c')]);}_0x22a989[_0xae98('0x3a')]=qs[_0xae98('0x3b')](_0x1b256e[_0xae98('0x33')][_0xae98('0x3b')]);_0x22a989[_0xae98('0x3c')]=qs[_0xae98('0x3d')](_[_0xae98('0x3e')](_0x1b256e[_0xae98('0x33')],_0x17f345['filters']),_0x247b93);if(_0x1b256e['query'][_0xae98('0x3f')]){_0x22a989[_0xae98('0x3c')]=_[_0xae98('0x40')](_0x22a989['where'],{'$or':_[_0xae98('0x2c')](_0x247b93,function(_0x51ab55){if(_0x51ab55['type']!==_0xae98('0x41')){var _0x305554={};_0x305554[_0x51ab55['name']]={'$like':'%'+_0x1b256e['query']['filter']+'%'};return _0x305554;}})});}_0x22a989=_['merge']({},_0x22a989,_0x1b256e['options']);var _0x361e34={'where':_0x22a989[_0xae98('0x3c')]};return db[_0xae98('0x2d')][_0xae98('0x1b')](_0x361e34)['then'](function(_0x3c1578){_0x21da13[_0xae98('0x1b')]=_0x3c1578;if(_0x1b256e[_0xae98('0x33')]['includeAll']){_0x22a989[_0xae98('0x42')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x22a989);})[_0xae98('0x24')](function(_0x363b15){_0x21da13[_0xae98('0x43')]=_0x363b15;return _0x21da13;})[_0xae98('0x24')](respondWithFilteredResult(_0x334d4d,_0x22a989))[_0xae98('0x44')](handleError(_0x334d4d,null));};exports['show']=function(_0xeb2dee,_0x153b0f){var _0x4b556e={'raw':!![],'where':{'id':_0xeb2dee['params']['id']}},_0x176a92={};_0x176a92[_0xae98('0x31')]=_['keys'](db[_0xae98('0x2d')][_0xae98('0x45')]);_0x176a92[_0xae98('0x33')]=_[_0xae98('0x32')](_0xeb2dee[_0xae98('0x33')]);_0x176a92[_0xae98('0x3d')]=_[_0xae98('0x34')](_0x176a92['model'],_0x176a92[_0xae98('0x33')]);_0x4b556e['attributes']=_[_0xae98('0x34')](_0x176a92['model'],qs[_0xae98('0x35')](_0xeb2dee[_0xae98('0x33')]['fields']));_0x4b556e[_0xae98('0x36')]=_0x4b556e['attributes'][_0xae98('0x37')]?_0x4b556e['attributes']:_0x176a92[_0xae98('0x31')];if(_0xeb2dee[_0xae98('0x33')][_0xae98('0x46')]){_0x4b556e[_0xae98('0x42')]=[{'all':!![]}];}_0x4b556e=_[_0xae98('0x40')]({},_0x4b556e,_0xeb2dee[_0xae98('0x47')]);return db[_0xae98('0x2d')][_0xae98('0x48')](_0x4b556e)[_0xae98('0x24')](handleEntityNotFound(_0x153b0f,null))['then'](respondWithResult(_0x153b0f,null))[_0xae98('0x44')](handleError(_0x153b0f,null));};exports['create']=function(_0x14fcfb,_0x134f1c){return db[_0xae98('0x2d')][_0xae98('0x49')](_0x14fcfb[_0xae98('0x4a')],{})[_0xae98('0x24')](function(_0xb28964){var _0x3aff28=_0x14fcfb['user']['get']({'plain':!![]});if(!_0x3aff28)throw new Error(_0xae98('0x4b'));if(_0x3aff28['role']===_0xae98('0x4c')){var _0x57bd14=_0xb28964[_0xae98('0x26')]({'plain':!![]});var _0x4733dc=_0xae98('0x27');return db[_0xae98('0x4d')][_0xae98('0x48')]({'where':{'name':_0x4733dc,'userProfileId':_0x3aff28[_0xae98('0x4e')]},'raw':!![]})[_0xae98('0x24')](function(_0x5b3691){if(_0x5b3691&&_0x5b3691[_0xae98('0x4f')]===0x0){return db[_0xae98('0x28')][_0xae98('0x49')]({'name':_0x57bd14['name'],'resourceId':_0x57bd14['id'],'type':_0x5b3691[_0xae98('0x2a')],'sectionId':_0x5b3691['id']},{})[_0xae98('0x24')](function(){return _0xb28964;});}else{return _0xb28964;}})['catch'](function(_0x2d5f82){logger[_0xae98('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d5f82);throw _0x2d5f82;});}return _0xb28964;})[_0xae98('0x24')](respondWithResult(_0x134f1c,0xc9))[_0xae98('0x44')](handleError(_0x134f1c,null));};exports['update']=function(_0x1feb79,_0xed0902){if(_0x1feb79[_0xae98('0x4a')]['id']){delete _0x1feb79[_0xae98('0x4a')]['id'];}return db[_0xae98('0x2d')][_0xae98('0x48')]({'where':{'id':_0x1feb79['params']['id']}})[_0xae98('0x24')](handleEntityNotFound(_0xed0902,null))['then'](saveUpdates(_0x1feb79['body'],null))[_0xae98('0x24')](respondWithResult(_0xed0902,null))[_0xae98('0x44')](handleError(_0xed0902,null));};exports[_0xae98('0x25')]=function(_0x567688,_0x30248d){return db['Variable'][_0xae98('0x48')]({'where':{'id':_0x567688[_0xae98('0x51')]['id']}})[_0xae98('0x24')](handleEntityNotFound(_0x30248d,null))[_0xae98('0x24')](removeEntity(_0x30248d,null))[_0xae98('0x44')](handleError(_0x30248d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e01421a..a8c82a2 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 _0xc3c4=['tools_variables','lodash','util','../../config/logger','moment','request-promise','rimraf','./variable.attributes','define','Variable'];(function(_0x50af9c,_0xd3bd72){var _0x2b1221=function(_0x2d397b){while(--_0x2d397b){_0x50af9c['push'](_0x50af9c['shift']());}};_0x2b1221(++_0xd3bd72);}(_0xc3c4,0x8d));var _0x4c3c=function(_0x488d7b,_0x2d68ad){_0x488d7b=_0x488d7b-0x0;var _0x268754=_0xc3c4[_0x488d7b];return _0x268754;};'use strict';var _=require(_0x4c3c('0x0'));var util=require(_0x4c3c('0x1'));var logger=require(_0x4c3c('0x2'))('api');var moment=require(_0x4c3c('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c3c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c3c('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c3c('0x6'));module['exports']=function(_0x2f487f,_0x4a8e35){return _0x2f487f[_0x4c3c('0x7')](_0x4c3c('0x8'),attributes,{'tableName':_0x4c3c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5603=['Variable','tools_variables','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./variable.attributes','define'];(function(_0x3735f8,_0x33205e){var _0x5db65b=function(_0x1a97dd){while(--_0x1a97dd){_0x3735f8['push'](_0x3735f8['shift']());}};_0x5db65b(++_0x33205e);}(_0x5603,0xec));var _0x3560=function(_0x1b4b15,_0x23a2a4){_0x1b4b15=_0x1b4b15-0x0;var _0x596ead=_0x5603[_0x1b4b15];return _0x596ead;};'use strict';var _=require(_0x3560('0x0'));var util=require(_0x3560('0x1'));var logger=require(_0x3560('0x2'))(_0x3560('0x3'));var moment=require(_0x3560('0x4'));var BPromise=require('bluebird');var rp=require(_0x3560('0x5'));var fs=require('fs');var path=require(_0x3560('0x6'));var rimraf=require(_0x3560('0x7'));var config=require(_0x3560('0x8'));var attributes=require(_0x3560('0x9'));module['exports']=function(_0xb1844a,_0x4d407f){return _0xb1844a[_0x3560('0xa')](_0x3560('0xb'),attributes,{'tableName':_0x3560('0xc'),'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 8d978fc..3c56c0b 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x36a0a4,_0x7178d6){var _0x32d0b6=function(_0x4a931a){while(--_0x4a931a){_0x36a0a4['push'](_0x36a0a4['shift']());}};_0x32d0b6(++_0x7178d6);}(_0x3e74,0x175));var _0x43e7=function(_0x459127,_0x3bbcbd){_0x459127=_0x459127-0x0;var _0x526bd0=_0x3e74[_0x459127];return _0x526bd0;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x5d7ff4,_0x1384c1){var _0x3edd41=function(_0x5b7216){while(--_0x5b7216){_0x5d7ff4['push'](_0x5d7ff4['shift']());}};_0x3edd41(++_0x1384c1);}(_0x3e74,0x175));var _0x43e7=function(_0x4a012a,_0x2c6792){_0x4a012a=_0x4a012a-0x0;var _0x4cbb37=_0x3e74[_0x4a012a];return _0x4cbb37;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 80e3f62..c9f3eac 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 _0xf6e5=['/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','pull','/restart','restart','/migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index'];(function(_0xb65e33,_0x24c168){var _0x5ccbc6=function(_0x2b25c4){while(--_0x2b25c4){_0xb65e33['push'](_0xb65e33['shift']());}};_0x5ccbc6(++_0x24c168);}(_0xf6e5,0x15f));var _0x5f6e=function(_0x13f84b,_0x563036){_0x13f84b=_0x13f84b-0x0;var _0x2c8128=_0xf6e5[_0x13f84b];return _0x2c8128;};'use strict';var express=require(_0x5f6e('0x0'));var router=express[_0x5f6e('0x1')]();var auth=require(_0x5f6e('0x2'));var controller=require(_0x5f6e('0x3'));router[_0x5f6e('0x4')]('/',controller[_0x5f6e('0x5')]);router[_0x5f6e('0x4')](_0x5f6e('0x6'),auth['isAuthenticated'](),auth[_0x5f6e('0x7')](),controller[_0x5f6e('0x8')]);router[_0x5f6e('0x4')](_0x5f6e('0x9'),auth[_0x5f6e('0xa')](),auth[_0x5f6e('0x7')](),controller[_0x5f6e('0xb')]);router['get']('/pull',auth[_0x5f6e('0xa')](),auth[_0x5f6e('0x7')](),controller[_0x5f6e('0xc')]);router['get'](_0x5f6e('0xd'),auth[_0x5f6e('0xa')](),controller[_0x5f6e('0xe')]);router[_0x5f6e('0x4')](_0x5f6e('0xf'),controller['migrations']);module[_0x5f6e('0x10')]=router; \ No newline at end of file +var _0xa9ab=['migrations','exports','express','Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','/migrations'];(function(_0x4950ba,_0x334b35){var _0x42037c=function(_0xf78b8f){while(--_0xf78b8f){_0x4950ba['push'](_0x4950ba['shift']());}};_0x42037c(++_0x334b35);}(_0xa9ab,0x152));var _0xba9a=function(_0x3dc8f9,_0x3965e5){_0x3dc8f9=_0x3dc8f9-0x0;var _0x54e06a=_0xa9ab[_0x3dc8f9];return _0x54e06a;};'use strict';var express=require(_0xba9a('0x0'));var router=express[_0xba9a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xba9a('0x2'));router[_0xba9a('0x3')]('/',controller[_0xba9a('0x4')]);router[_0xba9a('0x3')](_0xba9a('0x5'),auth[_0xba9a('0x6')](),auth[_0xba9a('0x7')](),controller[_0xba9a('0x8')]);router['get']('/reset',auth[_0xba9a('0x6')](),auth[_0xba9a('0x7')](),controller[_0xba9a('0x9')]);router[_0xba9a('0x3')](_0xba9a('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xba9a('0xb')]);router[_0xba9a('0x3')](_0xba9a('0xc'),auth[_0xba9a('0x6')](),controller['restart']);router[_0xba9a('0x3')](_0xba9a('0xd'),controller[_0xba9a('0xe')]);module[_0xba9a('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 6b7b96c..e2df01d 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 _0xb0d6=['sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','index','exports','query','latest','fetch','tags','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','sort','Migration'];(function(_0x34e1cd,_0xf4b89){var _0x2aad51=function(_0x341773){while(--_0x341773){_0x34e1cd['push'](_0x34e1cd['shift']());}};_0x2aad51(++_0xf4b89);}(_0xb0d6,0x1b1));var _0x6b0d=function(_0x99d37,_0x4e7974){_0x99d37=_0x99d37-0x0;var _0x2db098=_0xb0d6[_0x99d37];return _0x2db098;};'use strict';var Umzug=require(_0x6b0d('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6b0d('0x1'))(module,_0x6b0d('0x2'));var compareVersions=require(_0x6b0d('0x3'));var exec=require(_0x6b0d('0x4'))[_0x6b0d('0x5')];var db=require(_0x6b0d('0x6'))['db'];var config=require(_0x6b0d('0x7'));var pm2=require(_0x6b0d('0x8'));var logger=require(_0x6b0d('0x9'))('update');var git=require('simple-git')(config['root']);exports[_0x6b0d('0xa')]=function(_0xd38e18,_0x4e010e){var _0x2f5bae={'current':module[_0x6b0d('0xb')][_0x6b0d('0x2')],'phonebar':0x2};if(_0xd38e18['query']&&_0xd38e18[_0x6b0d('0xc')][_0x6b0d('0xd')]){return git[_0x6b0d('0xe')]()[_0x6b0d('0xf')](function(_0x2125d8,_0x1f3786){_0x2f5bae['latest']=(_0x2125d8?module[_0x6b0d('0xb')][_0x6b0d('0x2')]:_0x1f3786[_0x6b0d('0xd')])||'2.0.0';return _0x4e010e[_0x6b0d('0x10')](0xc8)[_0x6b0d('0x11')](_0x2f5bae);});}else{return _0x4e010e[_0x6b0d('0x10')](0xc8)[_0x6b0d('0x11')](_0x2f5bae);}};exports[_0x6b0d('0xe')]=function(_0x4c7e58,_0x502786){return git[_0x6b0d('0xe')]([_0x6b0d('0x12'),_0x6b0d('0x13')],function(_0x2a010e){if(_0x2a010e){logger[_0x6b0d('0x14')](_0x2a010e);return _0x502786[_0x6b0d('0x10')](0x1f4)[_0x6b0d('0x11')](_0x2a010e);}logger[_0x6b0d('0x15')](_0x6b0d('0x16'));return _0x502786[_0x6b0d('0x10')](0xc8)[_0x6b0d('0x11')]({'output':_0x6b0d('0x17')});});};exports[_0x6b0d('0x18')]=function(_0x3f379c,_0x2aa283){return git[_0x6b0d('0x18')]([_0x6b0d('0x19'),'FETCH_HEAD'],function(_0x13f6eb){if(_0x13f6eb){logger[_0x6b0d('0x14')](_0x13f6eb);return _0x2aa283[_0x6b0d('0x10')](0x1f4)[_0x6b0d('0x11')](_0x13f6eb);}logger[_0x6b0d('0x15')](_0x6b0d('0x1a'));return _0x2aa283[_0x6b0d('0x10')](0xc8)[_0x6b0d('0x11')]({'output':_0x6b0d('0x1b')});});};exports[_0x6b0d('0x1c')]=function(_0x3b7c6f,_0x26d1c3){exec(_0x6b0d('0x1d'),function(_0x305cf4,_0x2c473f,_0x3d9856){logger[_0x6b0d('0x15')](_0x2c473f);logger['info'](_0x3d9856);if(_0x305cf4){logger[_0x6b0d('0x14')](_0x305cf4);return _0x26d1c3[_0x6b0d('0x10')](0x1f4)['json'](_0x305cf4);}return _0x26d1c3['status'](0xc8)[_0x6b0d('0x11')]({'output':_0x2c473f});});};exports[_0x6b0d('0x1e')]=function(_0x57eee0,_0x528721){return pm2[_0x6b0d('0x1e')](_0x6b0d('0x1f'))['then'](function(_0x14994c){logger['info'](_0x6b0d('0x20'),_0x14994c);return _0x528721['status'](0xc8)[_0x6b0d('0x11')]({'output':_0x6b0d('0x21')});})[_0x6b0d('0x22')](function(_0x376e61){logger['error'](_0x376e61);return _0x528721[_0x6b0d('0x10')](0x1f4)[_0x6b0d('0x11')](_0x376e61);});};exports[_0x6b0d('0x23')]=function(_0x2330e9,_0x2928b8){var _0xd8c644=fs[_0x6b0d('0x24')](path[_0x6b0d('0x25')](config[_0x6b0d('0x26')],_0x6b0d('0x27'),'migrations'));var _0x249455=[];for(var _0x41afc9=0x0;_0x41afc9<_0xd8c644[_0x6b0d('0x28')];_0x41afc9++){var _0x946860=_0xd8c644[_0x41afc9][_0x6b0d('0x29')]('.js','');if(compareVersions(module['exports'][_0x6b0d('0x2')],_0x946860)===-0x1){_0x249455['push'](_0x946860);}}if(_0x249455[_0x6b0d('0x28')]){var _0x51a3be=_0x249455[_0x6b0d('0x2a')](compareVersions);var _0x5b278d=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x6b0d('0x2b')],'modelName':_0x6b0d('0x2b'),'columnName':_0x6b0d('0x2')},'migrations':{'params':[db[_0x6b0d('0x2c')][_0x6b0d('0x2d')](),db[_0x6b0d('0x2c')]['constructor'],function(){throw new Error(_0x6b0d('0x2e'));}],'path':path['join'](config[_0x6b0d('0x26')],_0x6b0d('0x27'),_0x6b0d('0x23')),'pattern':/\.js$/}});_0x5b278d['up']({'migrations':_[_0x6b0d('0x2f')](_0x51a3be,function(_0x15a264){return _0x15a264+_0x6b0d('0x30');})})[_0x6b0d('0x31')](function(){return _0x2928b8[_0x6b0d('0x10')](0xc8)[_0x6b0d('0x11')]({'output':_0x6b0d('0x32')+module[_0x6b0d('0xb')][_0x6b0d('0x2')]+_0x6b0d('0x33')+_['last'](_0x51a3be),'migrations':_['join'](_0x51a3be)});})[_0x6b0d('0x22')](function(_0x259e06){if(_0x259e06 instanceof db[_0x6b0d('0x2c')]['UniqueConstraintError']){return _0x2928b8['status'](0xc8)['json']({'output':_0x6b0d('0x34')});}else{return _0x2928b8['status'](0x1f4)[_0x6b0d('0x11')](_0x259e06);}});}else{return _0x2928b8['status'](0xc8)[_0x6b0d('0x11')]({'output':_0x6b0d('0x34')});}}; \ No newline at end of file +var _0xcae4=['FETCH_HEAD','info','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','migrations','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','update','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch\x20origin\x20master','reset','--hard'];(function(_0x317ffb,_0x492cd3){var _0x2fec30=function(_0x4b28ff){while(--_0x4b28ff){_0x317ffb['push'](_0x317ffb['shift']());}};_0x2fec30(++_0x492cd3);}(_0xcae4,0xea));var _0x4cae=function(_0x2016d4,_0x156c10){_0x2016d4=_0x2016d4-0x0;var _0x231d7f=_0xcae4[_0x2016d4];return _0x231d7f;};'use strict';var Umzug=require(_0x4cae('0x0'));var path=require(_0x4cae('0x1'));var fs=require('fs');var _=require(_0x4cae('0x2'));var pkginfo=require(_0x4cae('0x3'))(module,_0x4cae('0x4'));var compareVersions=require(_0x4cae('0x5'));var exec=require(_0x4cae('0x6'))['exec'];var db=require(_0x4cae('0x7'))['db'];var config=require(_0x4cae('0x8'));var pm2=require(_0x4cae('0x9'));var logger=require('../../config/logger')(_0x4cae('0xa'));var git=require('simple-git')(config[_0x4cae('0xb')]);exports[_0x4cae('0xc')]=function(_0x4f9b43,_0x253d52){var _0x3ec2f4={'current':module[_0x4cae('0xd')][_0x4cae('0x4')],'phonebar':0x2};if(_0x4f9b43[_0x4cae('0xe')]&&_0x4f9b43['query'][_0x4cae('0xf')]){return git[_0x4cae('0x10')]()[_0x4cae('0x11')](function(_0x11e446,_0x10ab7f){_0x3ec2f4[_0x4cae('0xf')]=(_0x11e446?module[_0x4cae('0xd')][_0x4cae('0x4')]:_0x10ab7f[_0x4cae('0xf')])||_0x4cae('0x12');return _0x253d52[_0x4cae('0x13')](0xc8)[_0x4cae('0x14')](_0x3ec2f4);});}else{return _0x253d52[_0x4cae('0x13')](0xc8)[_0x4cae('0x14')](_0x3ec2f4);}};exports[_0x4cae('0x10')]=function(_0x5985f0,_0x16c145){return git['fetch']([_0x4cae('0x15'),'master'],function(_0x3a9a88){if(_0x3a9a88){logger[_0x4cae('0x16')](_0x3a9a88);return _0x16c145[_0x4cae('0x13')](0x1f4)[_0x4cae('0x14')](_0x3a9a88);}logger['info']('git\x20fetch');return _0x16c145[_0x4cae('0x13')](0xc8)[_0x4cae('0x14')]({'output':_0x4cae('0x17')});});};exports[_0x4cae('0x18')]=function(_0x265e23,_0x2ca9db){return git[_0x4cae('0x18')]([_0x4cae('0x19'),_0x4cae('0x1a')],function(_0x50af7a){if(_0x50af7a){logger[_0x4cae('0x16')](_0x50af7a);return _0x2ca9db[_0x4cae('0x13')](0x1f4)['json'](_0x50af7a);}logger[_0x4cae('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x2ca9db[_0x4cae('0x13')](0xc8)[_0x4cae('0x14')]({'output':_0x4cae('0x1c')});});};exports[_0x4cae('0x1d')]=function(_0x3f56b9,_0x3cf168){exec('npm\x20install\x20--production',function(_0x430982,_0x12994b,_0x6d9e4e){logger[_0x4cae('0x1b')](_0x12994b);logger[_0x4cae('0x1b')](_0x6d9e4e);if(_0x430982){logger[_0x4cae('0x16')](_0x430982);return _0x3cf168[_0x4cae('0x13')](0x1f4)[_0x4cae('0x14')](_0x430982);}return _0x3cf168[_0x4cae('0x13')](0xc8)[_0x4cae('0x14')]({'output':_0x12994b});});};exports[_0x4cae('0x1e')]=function(_0x533f1f,_0x518748){return pm2[_0x4cae('0x1e')](_0x4cae('0x1f'))[_0x4cae('0x20')](function(_0x2dc599){logger[_0x4cae('0x1b')](_0x4cae('0x21'),_0x2dc599);return _0x518748[_0x4cae('0x13')](0xc8)[_0x4cae('0x14')]({'output':_0x4cae('0x22')});})[_0x4cae('0x23')](function(_0x5e3f10){logger[_0x4cae('0x16')](_0x5e3f10);return _0x518748[_0x4cae('0x13')](0x1f4)[_0x4cae('0x14')](_0x5e3f10);});};exports['migrations']=function(_0x371dfd,_0x4f61a9){var _0x55a92c=fs['readdirSync'](path[_0x4cae('0x24')](config[_0x4cae('0xb')],'server',_0x4cae('0x25')));var _0x57b59c=[];for(var _0xefae9d=0x0;_0xefae9d<_0x55a92c[_0x4cae('0x26')];_0xefae9d++){var _0x5846bb=_0x55a92c[_0xefae9d][_0x4cae('0x27')](_0x4cae('0x28'),'');if(compareVersions(module[_0x4cae('0xd')][_0x4cae('0x4')],_0x5846bb)===-0x1){_0x57b59c[_0x4cae('0x29')](_0x5846bb);}}if(_0x57b59c[_0x4cae('0x26')]){var _0x28d3f8=_0x57b59c[_0x4cae('0x2a')](compareVersions);var _0x11dbc0=new Umzug({'storage':_0x4cae('0x2b'),'storageOptions':{'model':db[_0x4cae('0x2c')],'modelName':_0x4cae('0x2c'),'columnName':_0x4cae('0x4')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x4cae('0x2b')][_0x4cae('0x2d')],function(){throw new Error(_0x4cae('0x2e'));}],'path':path['join'](config[_0x4cae('0xb')],_0x4cae('0x2f'),_0x4cae('0x25')),'pattern':/\.js$/}});_0x11dbc0['up']({'migrations':_['map'](_0x28d3f8,function(_0x75694c){return _0x75694c+_0x4cae('0x28');})})[_0x4cae('0x20')](function(){return _0x4f61a9[_0x4cae('0x13')](0xc8)['json']({'output':_0x4cae('0x30')+module[_0x4cae('0xd')][_0x4cae('0x4')]+_0x4cae('0x31')+_[_0x4cae('0x32')](_0x28d3f8),'migrations':_[_0x4cae('0x24')](_0x28d3f8)});})[_0x4cae('0x23')](function(_0x48d796){if(_0x48d796 instanceof db[_0x4cae('0x2b')]['UniqueConstraintError']){return _0x4f61a9['status'](0xc8)[_0x4cae('0x14')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4f61a9[_0x4cae('0x13')](0x1f4)[_0x4cae('0x14')](_0x48d796);}});}else{return _0x4f61a9['status'](0xc8)[_0x4cae('0x14')]({'output':_0x4cae('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a39afd4..39a481b 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 _0x9c1a=['/describe','describe','/:id','post','put','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x9c1a,0x1a9));var _0xa9c1=function(_0x340172,_0x46c3b8){_0x340172=_0x340172-0x0;var _0x1d9ef6=_0x9c1a[_0x340172];return _0x1d9ef6;};'use strict';var multer=require(_0xa9c1('0x0'));var util=require('util');var path=require(_0xa9c1('0x1'));var timeout=require(_0xa9c1('0x2'));var express=require(_0xa9c1('0x3'));var router=express[_0xa9c1('0x4')]();var fs_extra=require(_0xa9c1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c1('0x6'));var config=require(_0xa9c1('0x7'));var controller=require(_0xa9c1('0x8'));router[_0xa9c1('0x9')]('/',auth[_0xa9c1('0xa')](),controller[_0xa9c1('0xb')]);router[_0xa9c1('0x9')](_0xa9c1('0xc'),auth[_0xa9c1('0xa')](),controller[_0xa9c1('0xd')]);router[_0xa9c1('0x9')](_0xa9c1('0xe'),auth[_0xa9c1('0xa')](),controller['show']);router[_0xa9c1('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9c1('0x10')](_0xa9c1('0xe'),auth[_0xa9c1('0xa')](),controller[_0xa9c1('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa9c1('0x12')]);module['exports']=router; \ No newline at end of file +var _0xed44=['update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','describe','isAuthenticated','show','post','create','put','/:id'];(function(_0x1a660d,_0x182bba){var _0x3c1a19=function(_0x49f149){while(--_0x49f149){_0x1a660d['push'](_0x1a660d['shift']());}};_0x3c1a19(++_0x182bba);}(_0xed44,0x1f2));var _0x4ed4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xed44[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0x4ed4('0x0'));var path=require(_0x4ed4('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ed4('0x2'));var router=express[_0x4ed4('0x3')]();var fs_extra=require(_0x4ed4('0x4'));var auth=require(_0x4ed4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ed4('0x6'));var controller=require('./voiceAgentReport.controller');router[_0x4ed4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4ed4('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4ed4('0x8')]);router[_0x4ed4('0x7')]('/:id',auth[_0x4ed4('0x9')](),controller[_0x4ed4('0xa')]);router[_0x4ed4('0xb')]('/',auth[_0x4ed4('0x9')](),controller[_0x4ed4('0xc')]);router[_0x4ed4('0xd')](_0x4ed4('0xe'),auth[_0x4ed4('0x9')](),controller[_0x4ed4('0xf')]);router[_0x4ed4('0x10')](_0x4ed4('0xe'),auth[_0x4ed4('0x9')](),controller[_0x4ed4('0x11')]);module[_0x4ed4('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 936e92c..cf02605 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 _0x8aad=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x22593e,_0x468b31){var _0x45b681=function(_0x489435){while(--_0x489435){_0x22593e['push'](_0x22593e['shift']());}};_0x45b681(++_0x468b31);}(_0x8aad,0x146));var _0xd8aa=function(_0x4644ab,_0x2ccd77){_0x4644ab=_0x4644ab-0x0;var _0x5b2c43=_0x8aad[_0x4644ab];return _0x5b2c43;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd8aa('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd8aa('0x2')]},'queue':{'type':Sequelize[_0xd8aa('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd8aa('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd8aa('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd8aa('0x3')]},'holdtime':{'type':Sequelize[_0xd8aa('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd8aa('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd8aa('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd8aa('0x4')]},'agentacw':{'type':Sequelize[_0xd8aa('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xd8aa('0x2')]},'channel':{'type':Sequelize[_0xd8aa('0x2')]},'channelstate':{'type':Sequelize[_0xd8aa('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd8aa('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd8aa('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd8aa('0x2')]},'accountcode':{'type':Sequelize[_0xd8aa('0x2')]},'context':{'type':Sequelize[_0xd8aa('0x2')]},'exten':{'type':Sequelize[_0xd8aa('0x2')]},'priority':{'type':Sequelize[_0xd8aa('0x2')]},'destchannel':{'type':Sequelize[_0xd8aa('0x2')]},'destchannelstate':{'type':Sequelize[_0xd8aa('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd8aa('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd8aa('0x2')]},'destcalleridname':{'type':Sequelize[_0xd8aa('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd8aa('0x2')]},'destaccountcode':{'type':Sequelize[_0xd8aa('0x2')]},'destcontext':{'type':Sequelize[_0xd8aa('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xd8aa('0x2')]},'destuniqueid':{'type':Sequelize[_0xd8aa('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd8aa('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xd8aa('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd8aa('0x2')],'comment':_0xd8aa('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd8aa('0x2')]},'agententerreason':{'type':Sequelize[_0xd8aa('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02ce=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x45fb76,_0x35fd5d){var _0x338556=function(_0x526a58){while(--_0x526a58){_0x45fb76['push'](_0x45fb76['shift']());}};_0x338556(++_0x35fd5d);}(_0x02ce,0x1ac));var _0xe02c=function(_0x24c57e,_0x37b71e){_0x24c57e=_0x24c57e-0x0;var _0x1bf46b=_0x02ce[_0x24c57e];return _0x1bf46b;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'type':{'type':Sequelize[_0xe02c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe02c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe02c('0x2')]},'interface':{'type':Sequelize[_0xe02c('0x2')]},'membername':{'type':Sequelize[_0xe02c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe02c('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe02c('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe02c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe02c('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe02c('0x3')]},'holdtime':{'type':Sequelize[_0xe02c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe02c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe02c('0x4')]},'agentacw':{'type':Sequelize[_0xe02c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe02c('0x4')]},'reason':{'type':Sequelize[_0xe02c('0x2')]},'lastevent':{'type':Sequelize[_0xe02c('0x2')]},'channel':{'type':Sequelize[_0xe02c('0x2')]},'channelstate':{'type':Sequelize[_0xe02c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe02c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe02c('0x2')]},'connectedlinename':{'type':Sequelize[_0xe02c('0x2')]},'language':{'type':Sequelize[_0xe02c('0x2')]},'accountcode':{'type':Sequelize[_0xe02c('0x2')]},'context':{'type':Sequelize[_0xe02c('0x2')]},'exten':{'type':Sequelize[_0xe02c('0x2')]},'priority':{'type':Sequelize[_0xe02c('0x2')]},'destchannel':{'type':Sequelize[_0xe02c('0x2')]},'destchannelstate':{'type':Sequelize[_0xe02c('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe02c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe02c('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe02c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe02c('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe02c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe02c('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe02c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe02c('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe02c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe02c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ebd08db..1f4966a 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(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 d0c4aef..873e8de 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 _0x24ca=['request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','destuniqueid','lodash','../../config/logger','api','moment'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x24ca,0x1bc));var _0xa24c=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x24ca[_0x457b64];return _0x437111;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xa24c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd13e=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0xd13e,0x193));var _0xed13=function(_0x26476e,_0x521e74){_0x26476e=_0x26476e-0x0;var _0x1aea62=_0xd13e[_0x26476e];return _0x1aea62;};'use strict';var _=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var logger=require(_0xed13('0x2'))(_0xed13('0x3'));var moment=require('moment');var BPromise=require(_0xed13('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed13('0x5'));var rimraf=require('rimraf');var config=require(_0xed13('0x6'));var attributes=require(_0xed13('0x7'));module['exports']=function(_0x50de44,_0x5142bd){return _0x50de44[_0xed13('0x8')](_0xed13('0x9'),attributes,{'tableName':_0xed13('0xa'),'paranoid':![],'indexes':[{'fields':[_0xed13('0xb'),_0xed13('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 9412f74..97c4c48 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 _0x89c3=['where','attributes','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','then','info','catch','UpdateVoiceAgentReport','update'];(function(_0x2574ee,_0x33ed39){var _0x3510b1=function(_0x2caa9f){while(--_0x2caa9f){_0x2574ee['push'](_0x2574ee['shift']());}};_0x3510b1(++_0x33ed39);}(_0x89c3,0x1af));var _0x389c=function(_0x3eb761,_0xa5bdad){_0x3eb761=_0x3eb761-0x0;var _0x374b59=_0x89c3[_0x3eb761];return _0x374b59;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var moment=require(_0x389c('0x2'));var BPromise=require(_0x389c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x389c('0x4'));var db=require(_0x389c('0x5'))['db'];var utils=require(_0x389c('0x6'));var logger=require(_0x389c('0x7'))(_0x389c('0x8'));var config=require('../../config/environment');var jayson=require(_0x389c('0x9'));var client=jayson[_0x389c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x285d43,_0x18ff8,_0x5ac76a){return new BPromise(function(_0x16cc9f,_0xba5ccb){return client[_0x389c('0xb')](_0x285d43,_0x5ac76a)['then'](function(_0x400b32){logger['info'](_0x389c('0xc'),_0x18ff8,_0x389c('0xd'));logger[_0x389c('0xe')](_0x389c('0xf'),_0x18ff8,'request\x20sent',JSON[_0x389c('0x10')](_0x400b32));if(_0x400b32[_0x389c('0x11')]){if(_0x400b32[_0x389c('0x11')][_0x389c('0x12')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x18ff8,_0x400b32[_0x389c('0x11')]['message']);return _0xba5ccb(_0x400b32[_0x389c('0x11')][_0x389c('0x13')]);}logger[_0x389c('0x11')](_0x389c('0xc'),_0x18ff8,_0x400b32['error'][_0x389c('0x13')]);return _0x16cc9f(_0x400b32[_0x389c('0x11')][_0x389c('0x13')]);}else{logger['info'](_0x389c('0xc'),_0x18ff8,_0x389c('0xd'));_0x16cc9f(_0x400b32[_0x389c('0x14')][_0x389c('0x13')]);}})['catch'](function(_0x2a1e8c){logger[_0x389c('0x11')](_0x389c('0xc'),_0x18ff8,_0x2a1e8c);_0xba5ccb(_0x2a1e8c);});});}exports[_0x389c('0x15')]=function(_0x5f36a4){var _0x392cff=this;return new Promise(function(_0x37bef2,_0x872152){return db[_0x389c('0x16')]['create'](_0x5f36a4[_0x389c('0x17')],{'raw':_0x5f36a4[_0x389c('0x18')]?_0x5f36a4[_0x389c('0x18')][_0x389c('0x19')]===undefined?!![]:![]:!![]})[_0x389c('0x1a')](function(_0x6461f5){logger[_0x389c('0x1b')](_0x389c('0x15'),_0x5f36a4);logger[_0x389c('0xe')](_0x389c('0x15'),_0x5f36a4,JSON[_0x389c('0x10')](_0x6461f5));_0x37bef2(_0x6461f5);})[_0x389c('0x1c')](function(_0x5cce3a){logger['error'](_0x389c('0x15'),_0x5cce3a[_0x389c('0x13')],_0x5f36a4);_0x872152(_0x392cff[_0x389c('0x11')](0x1f4,_0x5cce3a[_0x389c('0x13')]));});});};exports[_0x389c('0x1d')]=function(_0x1b64fd){var _0x44400f=this;return new Promise(function(_0x4d1fd6,_0xd3e5c2){return db[_0x389c('0x16')][_0x389c('0x1e')](_0x1b64fd[_0x389c('0x17')],{'raw':_0x1b64fd[_0x389c('0x18')]?_0x1b64fd[_0x389c('0x18')][_0x389c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b64fd['options']?_0x1b64fd[_0x389c('0x18')][_0x389c('0x1f')]||null:null,'attributes':_0x1b64fd['options']?_0x1b64fd['options'][_0x389c('0x20')]||null:null,'limit':_0x1b64fd['options']?_0x1b64fd[_0x389c('0x18')]['limit']||null:null})['then'](function(_0x4077bc){logger[_0x389c('0x1b')](_0x389c('0x1d'),_0x1b64fd);logger[_0x389c('0xe')](_0x389c('0x1d'),_0x1b64fd,JSON[_0x389c('0x10')](_0x4077bc));_0x4d1fd6(_0x4077bc);})[_0x389c('0x1c')](function(_0x1bc4c8){logger[_0x389c('0x11')]('UpdateVoiceAgentReport',_0x1bc4c8[_0x389c('0x13')],_0x1b64fd);_0xd3e5c2(_0x44400f[_0x389c('0x11')](0x1f4,_0x1bc4c8['message']));});});}; \ No newline at end of file +var _0x1545=['debug','UpdateVoiceAgentReport','VoiceAgentReport','update','options','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','body'];(function(_0x468206,_0x2514ca){var _0x3e4378=function(_0xb00a19){while(--_0xb00a19){_0x468206['push'](_0x468206['shift']());}};_0x3e4378(++_0x2514ca);}(_0x1545,0x144));var _0x5154=function(_0x2fc130,_0x1e4dc0){_0x2fc130=_0x2fc130-0x0;var _0xd5a6d1=_0x1545[_0x2fc130];return _0xd5a6d1;};'use strict';var _=require('lodash');var util=require(_0x5154('0x0'));var moment=require(_0x5154('0x1'));var BPromise=require(_0x5154('0x2'));var rs=require(_0x5154('0x3'));var fs=require('fs');var Redis=require(_0x5154('0x4'));var db=require(_0x5154('0x5'))['db'];var utils=require(_0x5154('0x6'));var logger=require(_0x5154('0x7'))(_0x5154('0x8'));var config=require(_0x5154('0x9'));var jayson=require(_0x5154('0xa'));var client=jayson['client'][_0x5154('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14c3c9,_0x5fcbec,_0x5434ed){return new BPromise(function(_0x3e7e88,_0x319546){return client[_0x5154('0xc')](_0x14c3c9,_0x5434ed)[_0x5154('0xd')](function(_0x2ca59c){logger[_0x5154('0xe')](_0x5154('0xf'),_0x5fcbec,_0x5154('0x10'));logger['debug'](_0x5154('0x11'),_0x5fcbec,'request\x20sent',JSON[_0x5154('0x12')](_0x2ca59c));if(_0x2ca59c[_0x5154('0x13')]){if(_0x2ca59c[_0x5154('0x13')][_0x5154('0x14')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x5fcbec,_0x2ca59c[_0x5154('0x13')][_0x5154('0x15')]);return _0x319546(_0x2ca59c['error'][_0x5154('0x15')]);}logger[_0x5154('0x13')](_0x5154('0xf'),_0x5fcbec,_0x2ca59c['error'][_0x5154('0x15')]);return _0x3e7e88(_0x2ca59c[_0x5154('0x13')][_0x5154('0x15')]);}else{logger[_0x5154('0xe')](_0x5154('0xf'),_0x5fcbec,_0x5154('0x10'));_0x3e7e88(_0x2ca59c[_0x5154('0x16')][_0x5154('0x15')]);}})[_0x5154('0x17')](function(_0xe1067a){logger['error'](_0x5154('0xf'),_0x5fcbec,_0xe1067a);_0x319546(_0xe1067a);});});}exports[_0x5154('0x18')]=function(_0x1db751){var _0x352225=this;return new Promise(function(_0x444109,_0x354e06){return db['VoiceAgentReport']['create'](_0x1db751[_0x5154('0x19')],{'raw':_0x1db751['options']?_0x1db751['options']['raw']===undefined?!![]:![]:!![]})[_0x5154('0xd')](function(_0x784190){logger[_0x5154('0xe')]('CreateVoiceAgentReport',_0x1db751);logger[_0x5154('0x1a')]('CreateVoiceAgentReport',_0x1db751,JSON['stringify'](_0x784190));_0x444109(_0x784190);})[_0x5154('0x17')](function(_0xa2d5c4){logger[_0x5154('0x13')](_0x5154('0x18'),_0xa2d5c4[_0x5154('0x15')],_0x1db751);_0x354e06(_0x352225[_0x5154('0x13')](0x1f4,_0xa2d5c4[_0x5154('0x15')]));});});};exports[_0x5154('0x1b')]=function(_0x3b3b37){var _0x1e4701=this;return new Promise(function(_0x4d87f5,_0x2efb7b){return db[_0x5154('0x1c')][_0x5154('0x1d')](_0x3b3b37[_0x5154('0x19')],{'raw':_0x3b3b37[_0x5154('0x1e')]?_0x3b3b37[_0x5154('0x1e')][_0x5154('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b3b37[_0x5154('0x1e')]?_0x3b3b37[_0x5154('0x1e')][_0x5154('0x20')]||null:null,'attributes':_0x3b3b37[_0x5154('0x1e')]?_0x3b3b37[_0x5154('0x1e')][_0x5154('0x21')]||null:null,'limit':_0x3b3b37[_0x5154('0x1e')]?_0x3b3b37[_0x5154('0x1e')][_0x5154('0x22')]||null:null})[_0x5154('0xd')](function(_0x37f3d4){logger[_0x5154('0xe')]('UpdateVoiceAgentReport',_0x3b3b37);logger[_0x5154('0x1a')](_0x5154('0x1b'),_0x3b3b37,JSON['stringify'](_0x37f3d4));_0x4d87f5(_0x37f3d4);})[_0x5154('0x17')](function(_0x5e834a){logger[_0x5154('0x13')](_0x5154('0x1b'),_0x5e834a[_0x5154('0x15')],_0x3b3b37);_0x2efb7b(_0x1e4701[_0x5154('0x13')](0x1f4,_0x5e834a[_0x5154('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 14c5d7c..cefe5de 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 _0x4f33=['get','isAuthenticated','/describe','describe','/:id','show','post','put','update','/with-retry/:id','delete','destroy','exports','express','Router'];(function(_0x459225,_0x39f46b){var _0x43ed01=function(_0x3de073){while(--_0x3de073){_0x459225['push'](_0x459225['shift']());}};_0x43ed01(++_0x39f46b);}(_0x4f33,0x175));var _0x34f3=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0x4f33[_0x308dcc];return _0x361717;};'use strict';var express=require(_0x34f3('0x0'));var router=express[_0x34f3('0x1')]();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router[_0x34f3('0x2')]('/',auth[_0x34f3('0x3')](),controller['index']);router[_0x34f3('0x2')](_0x34f3('0x4'),auth['isAuthenticated'](),controller[_0x34f3('0x5')]);router[_0x34f3('0x2')](_0x34f3('0x6'),auth['isAuthenticated'](),controller[_0x34f3('0x7')]);router[_0x34f3('0x8')]('/',auth[_0x34f3('0x3')](),controller['create']);router[_0x34f3('0x9')]('/:id',auth[_0x34f3('0x3')](),controller[_0x34f3('0xa')]);router[_0x34f3('0x9')](_0x34f3('0xb'),auth[_0x34f3('0x3')](),controller['updateWithRetry']);router[_0x34f3('0xc')](_0x34f3('0x6'),auth[_0x34f3('0x3')](),controller[_0x34f3('0xd')]);module[_0x34f3('0xe')]=router; \ No newline at end of file +var _0x0281=['create','update','/with-retry/:id','updateWithRetry','delete','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x129015,_0x586c48){var _0x137f96=function(_0x27daa7){while(--_0x27daa7){_0x129015['push'](_0x129015['shift']());}};_0x137f96(++_0x586c48);}(_0x0281,0xe3));var _0x1028=function(_0x22512,_0x4e772c){_0x22512=_0x22512-0x0;var _0x429609=_0x0281[_0x22512];return _0x429609;};'use strict';var express=require(_0x1028('0x0'));var router=express[_0x1028('0x1')]();var auth=require(_0x1028('0x2'));var controller=require(_0x1028('0x3'));router[_0x1028('0x4')]('/',auth[_0x1028('0x5')](),controller[_0x1028('0x6')]);router[_0x1028('0x4')](_0x1028('0x7'),auth[_0x1028('0x5')](),controller['describe']);router[_0x1028('0x4')](_0x1028('0x8'),auth[_0x1028('0x5')](),controller[_0x1028('0x9')]);router[_0x1028('0xa')]('/',auth[_0x1028('0x5')](),controller[_0x1028('0xb')]);router['put'](_0x1028('0x8'),auth[_0x1028('0x5')](),controller[_0x1028('0xc')]);router['put'](_0x1028('0xd'),auth['isAuthenticated'](),controller[_0x1028('0xe')]);router[_0x1028('0xf')](_0x1028('0x8'),auth[_0x1028('0x5')](),controller['destroy']);module[_0x1028('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6c0fa45..a25bd51 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 _0xe2c5=['dialer','TEXT','DATE','INTEGER','exports','STRING','outbound','inbound-fax','outbound-fax'];(function(_0x3e9bb7,_0x1e2b77){var _0x24319a=function(_0x1bd243){while(--_0x1bd243){_0x3e9bb7['push'](_0x3e9bb7['shift']());}};_0x24319a(++_0x1e2b77);}(_0xe2c5,0xd3));var _0x5e2c=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0xe2c5[_0xfbdff6];return _0x4cb9be;};'use strict';var Sequelize=require('sequelize');module[_0x5e2c('0x0')]={'uniqueid':{'type':Sequelize[_0x5e2c('0x1')]},'type':{'type':Sequelize['ENUM']('inbound','internal',_0x5e2c('0x2'),_0x5e2c('0x3'),_0x5e2c('0x4'),_0x5e2c('0x5'))},'tag':{'type':Sequelize[_0x5e2c('0x1')]},'accountcode':{'type':Sequelize[_0x5e2c('0x1')]},'source':{'type':Sequelize[_0x5e2c('0x1')]},'destination':{'type':Sequelize[_0x5e2c('0x1')]},'destinationcontext':{'type':Sequelize[_0x5e2c('0x1')]},'callerid':{'type':Sequelize[_0x5e2c('0x1')]},'channel':{'type':Sequelize[_0x5e2c('0x1')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x5e2c('0x1')]},'lastdata':{'type':Sequelize[_0x5e2c('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5e2c('0x7')]},'answertime':{'type':Sequelize[_0x5e2c('0x7')]},'endtime':{'type':Sequelize[_0x5e2c('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x5e2c('0x8')]},'mohtime':{'type':Sequelize[_0x5e2c('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5e2c('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x5e2c('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x5e2c('0x1')]}}; \ No newline at end of file +var _0x8066=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound-fax'];(function(_0x115d41,_0x44266a){var _0x248902=function(_0x5e8f2c){while(--_0x5e8f2c){_0x115d41['push'](_0x115d41['shift']());}};_0x248902(++_0x44266a);}(_0x8066,0x192));var _0x6806=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x8066[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x6806('0x0'));module[_0x6806('0x1')]={'uniqueid':{'type':Sequelize[_0x6806('0x2')]},'type':{'type':Sequelize[_0x6806('0x3')](_0x6806('0x4'),'internal','outbound','inbound-fax',_0x6806('0x5'),'dialer')},'tag':{'type':Sequelize[_0x6806('0x2')]},'accountcode':{'type':Sequelize[_0x6806('0x2')]},'source':{'type':Sequelize[_0x6806('0x2')]},'destination':{'type':Sequelize[_0x6806('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6806('0x2')]},'destinationchannel':{'type':Sequelize[_0x6806('0x2')]},'lastapplication':{'type':Sequelize[_0x6806('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x6806('0x6')]},'systemanswertime':{'type':Sequelize[_0x6806('0x6')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6806('0x6')]},'duration':{'type':Sequelize[_0x6806('0x7')]},'billableseconds':{'type':Sequelize[_0x6806('0x7')]},'mohtime':{'type':Sequelize[_0x6806('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x6806('0x2')]},'userfield':{'type':Sequelize[_0x6806('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6806('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x6806('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index cc248e2..cdb4b08 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 _0x54ef=['Content-Range','then','end','sendStatus','stack','name','send','index','VoiceCallReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','alias','User','findAll','catch','params','rawAttributes','find','create','body','destroy','describe','user','update','uniqueid','updateWithRetry','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','promise-retry','status','json','offset','limit','count','set'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x54ef,0x112));var _0xf54e=function(_0x4c1c74,_0x1451ab){_0x4c1c74=_0x4c1c74-0x0;var _0x3f9c09=_0x54ef[_0x4c1c74];return _0x3f9c09;};'use strict';var _=require(_0xf54e('0x0'));var qs=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var db=require(_0xf54e('0x3'))['db'];const promiseRetry=require(_0xf54e('0x4'));function respondWithResult(_0x18b1cf,_0x42b9b2){_0x42b9b2=_0x42b9b2||0xc8;return function(_0x8b6bb6){if(_0x8b6bb6){return _0x18b1cf[_0xf54e('0x5')](_0x42b9b2)[_0xf54e('0x6')](_0x8b6bb6);}};}function respondWithFilteredResult(_0x4c3022,_0x55e611){return function(_0x18e84e){if(_0x18e84e){var _0x99cf9=typeof _0x55e611[_0xf54e('0x7')]==='undefined'&&typeof _0x55e611[_0xf54e('0x8')]==='undefined';var _0x40a75d=_0x18e84e[_0xf54e('0x9')];var _0x47c5e1=_0x99cf9?0x0:_0x55e611[_0xf54e('0x7')];var _0xefa1c0=_0x99cf9?_0x18e84e[_0xf54e('0x9')]:_0x55e611[_0xf54e('0x7')]+_0x55e611['limit'];var _0x558502;if(_0xefa1c0>=_0x40a75d){_0xefa1c0=_0x40a75d;_0x558502=0xc8;}else{_0x558502=0xce;}_0x4c3022[_0xf54e('0x5')](_0x558502);return _0x4c3022[_0xf54e('0xa')](_0xf54e('0xb'),_0x47c5e1+'-'+_0xefa1c0+'/'+_0x40a75d)['json'](_0x18e84e);}return null;};}function saveUpdates(_0x358c88){return function(_0x4b0ee1){if(_0x4b0ee1){return _0x4b0ee1['update'](_0x358c88)[_0xf54e('0xc')](function(_0x2033e9){return _0x2033e9;});}return null;};}function removeEntity(_0x28f776){return function(_0x380f26){if(_0x380f26){return _0x380f26['destroy']()[_0xf54e('0xc')](function(){_0x28f776[_0xf54e('0x5')](0xcc)[_0xf54e('0xd')]();});}};}function handleEntityNotFound(_0x15f639){return function(_0x56828e){if(!_0x56828e){_0x15f639[_0xf54e('0xe')](0x194);}return _0x56828e;};}function handleError(_0x389abc,_0x3eb415){_0x3eb415=_0x3eb415||0x1f4;return function(_0x5c5d00){logger['error'](_0x5c5d00[_0xf54e('0xf')]);if(_0x5c5d00[_0xf54e('0x10')]){delete _0x5c5d00[_0xf54e('0x10')];}_0x389abc[_0xf54e('0x5')](_0x3eb415)[_0xf54e('0x11')](_0x5c5d00);};}exports[_0xf54e('0x12')]=function(_0x2e27b6,_0x1ef06e){var _0x1dcc04={},_0x4689fe={},_0x226c96={'count':0x0,'rows':[]};var _0x50fc66=_['map'](db[_0xf54e('0x13')]['rawAttributes'],function(_0x3e1556){return{'name':_0x3e1556[_0xf54e('0x14')],'type':_0x3e1556[_0xf54e('0x15')][_0xf54e('0x16')]};});_0x4689fe[_0xf54e('0x17')]=_[_0xf54e('0x18')](_0x50fc66,_0xf54e('0x10'));_0x4689fe[_0xf54e('0x19')]=_[_0xf54e('0x1a')](_0x2e27b6[_0xf54e('0x19')]);_0x4689fe[_0xf54e('0x1b')]=_['intersection'](_0x4689fe[_0xf54e('0x17')],_0x4689fe['query']);_0x1dcc04[_0xf54e('0x1c')]=_[_0xf54e('0x1d')](_0x4689fe[_0xf54e('0x17')],qs[_0xf54e('0x1e')](_0x2e27b6[_0xf54e('0x19')][_0xf54e('0x1e')]));_0x1dcc04[_0xf54e('0x1c')]=_0x1dcc04[_0xf54e('0x1c')][_0xf54e('0x1f')]?_0x1dcc04[_0xf54e('0x1c')]:_0x4689fe[_0xf54e('0x17')];if(!_0x2e27b6[_0xf54e('0x19')][_0xf54e('0x20')]('nolimit')){_0x1dcc04[_0xf54e('0x8')]=qs['limit'](_0x2e27b6[_0xf54e('0x19')]['limit']);_0x1dcc04[_0xf54e('0x7')]=qs[_0xf54e('0x7')](_0x2e27b6[_0xf54e('0x19')][_0xf54e('0x7')]);}_0x1dcc04[_0xf54e('0x21')]=qs[_0xf54e('0x22')](_0x2e27b6[_0xf54e('0x19')]['sort']);_0x1dcc04['where']=qs[_0xf54e('0x1b')](_[_0xf54e('0x23')](_0x2e27b6[_0xf54e('0x19')],_0x4689fe[_0xf54e('0x1b')]),_0x50fc66);if(_0x2e27b6[_0xf54e('0x19')][_0xf54e('0x24')]){_0x1dcc04[_0xf54e('0x25')]=_[_0xf54e('0x26')](_0x1dcc04[_0xf54e('0x25')],{'$or':_[_0xf54e('0x18')](_0x50fc66,function(_0x5ea0cc){if(_0x5ea0cc['type']!==_0xf54e('0x27')){var _0x3169dd={};_0x3169dd[_0x5ea0cc['name']]={'$like':'%'+_0x2e27b6[_0xf54e('0x19')][_0xf54e('0x24')]+'%'};return _0x3169dd;}})});}_0x1dcc04=_[_0xf54e('0x26')]({},_0x1dcc04,_0x2e27b6[_0xf54e('0x28')]);var _0x576b46={'where':_0x1dcc04['where']};return db['VoiceCallReport'][_0xf54e('0x9')](_0x576b46)[_0xf54e('0xc')](function(_0x210d6d){_0x226c96[_0xf54e('0x9')]=_0x210d6d;if(_0x2e27b6[_0xf54e('0x19')][_0xf54e('0x29')]){_0x1dcc04['include']=[{'attributes':['id','name','fullname',_0xf54e('0x2a')],'model':db[_0xf54e('0x2b')],'as':'User'}];}return db['VoiceCallReport'][_0xf54e('0x2c')](_0x1dcc04);})[_0xf54e('0xc')](function(_0x173e6c){_0x226c96['rows']=_0x173e6c;return _0x226c96;})[_0xf54e('0xc')](respondWithFilteredResult(_0x1ef06e,_0x1dcc04))[_0xf54e('0x2d')](handleError(_0x1ef06e,null));};exports['show']=function(_0x38d7a0,_0x6e5bdf){var _0x5af03={'raw':!![],'where':{'id':_0x38d7a0[_0xf54e('0x2e')]['id']}},_0x1eeeb4={};_0x1eeeb4[_0xf54e('0x17')]=_['keys'](db['VoiceCallReport'][_0xf54e('0x2f')]);_0x1eeeb4[_0xf54e('0x19')]=_[_0xf54e('0x1a')](_0x38d7a0['query']);_0x1eeeb4[_0xf54e('0x1b')]=_[_0xf54e('0x1d')](_0x1eeeb4[_0xf54e('0x17')],_0x1eeeb4[_0xf54e('0x19')]);_0x5af03[_0xf54e('0x1c')]=_[_0xf54e('0x1d')](_0x1eeeb4[_0xf54e('0x17')],qs[_0xf54e('0x1e')](_0x38d7a0[_0xf54e('0x19')][_0xf54e('0x1e')]));_0x5af03[_0xf54e('0x1c')]=_0x5af03[_0xf54e('0x1c')][_0xf54e('0x1f')]?_0x5af03[_0xf54e('0x1c')]:_0x1eeeb4[_0xf54e('0x17')];if(_0x38d7a0['query']['includeAll']){_0x5af03['include']=[{'all':!![]}];}_0x5af03=_[_0xf54e('0x26')]({},_0x5af03,_0x38d7a0[_0xf54e('0x28')]);return db['VoiceCallReport'][_0xf54e('0x30')](_0x5af03)[_0xf54e('0xc')](handleEntityNotFound(_0x6e5bdf,null))[_0xf54e('0xc')](respondWithResult(_0x6e5bdf,null))['catch'](handleError(_0x6e5bdf,null));};exports[_0xf54e('0x31')]=function(_0x13d145,_0x1e016e){return db[_0xf54e('0x13')][_0xf54e('0x31')](_0x13d145[_0xf54e('0x32')],{})[_0xf54e('0xc')](respondWithResult(_0x1e016e,0xc9))[_0xf54e('0x2d')](handleError(_0x1e016e,null));};exports[_0xf54e('0x33')]=function(_0x47bedd,_0x11c736){return db[_0xf54e('0x13')][_0xf54e('0x30')]({'where':{'id':_0x47bedd[_0xf54e('0x2e')]['id']}})[_0xf54e('0xc')](handleEntityNotFound(_0x11c736,null))[_0xf54e('0xc')](removeEntity(_0x11c736,null))['catch'](handleError(_0x11c736,null));};exports[_0xf54e('0x34')]=function(_0x59af72,_0x1d16e0){return db['VoiceCallReport'][_0xf54e('0x34')]()[_0xf54e('0xc')](respondWithResult(_0x1d16e0,null))[_0xf54e('0x2d')](handleError(_0x1d16e0,null));};function findForUpdate(_0x57371d){return db[_0xf54e('0x13')][_0xf54e('0x30')]({'where':{'uniqueid':_0x57371d[_0xf54e('0x2e')]['id'],'UserId':{'$or':[null,_0x57371d[_0xf54e('0x35')]['id']]}}});}exports[_0xf54e('0x36')]=function(_0x478809,_0x427799){if(_0x478809[_0xf54e('0x32')][_0xf54e('0x37')]){delete _0x478809[_0xf54e('0x32')]['uniqueid'];}return findForUpdate(_0x478809)[_0xf54e('0xc')](handleEntityNotFound(_0x427799,null))[_0xf54e('0xc')](saveUpdates(_0x478809['body'],null))[_0xf54e('0xc')](respondWithResult(_0x427799,null))[_0xf54e('0x2d')](handleError(_0x427799,null));};exports[_0xf54e('0x38')]=function(_0xca0141,_0x557964,_0x196e68){if(_0xca0141[_0xf54e('0x32')][_0xf54e('0x37')]){delete _0xca0141[_0xf54e('0x32')][_0xf54e('0x37')];}promiseRetry(function(){return findForUpdate(_0xca0141);},{'retries':0x6,'minTimeout':0xfa})[_0xf54e('0xc')](function(_0x1231d0){if(!_0x1231d0){return new Promise(function(_0xd7b0c5){_0xd7b0c5(handleEntityNotFound(_0x557964)());});}else{return _0x1231d0[_0xf54e('0x36')](_0xca0141[_0xf54e('0x32')])[_0xf54e('0xc')](function(_0x1f4cf8){return respondWithResult(_0x557964)(_0x1f4cf8);});}},function(){handleEntityNotFound(_0x557964)();});}; \ No newline at end of file +var _0x7c7f=['query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','options','fullname','alias','User','findAll','rows','show','params','includeAll','include','find','catch','body','describe','uniqueid','updateWithRetry','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','offset','undefined','limit','count','status','set','json','update','then','destroy','end','stack','name','index','VoiceCallReport','rawAttributes','fieldName','type','key','map'];(function(_0x24f10d,_0x226a4c){var _0xd85f94=function(_0x3871a1){while(--_0x3871a1){_0x24f10d['push'](_0x24f10d['shift']());}};_0xd85f94(++_0x226a4c);}(_0x7c7f,0x1ae));var _0xf7c7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x7c7f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf7c7('0x0'));var qs=require(_0xf7c7('0x1'));var logger=require(_0xf7c7('0x2'))(_0xf7c7('0x3'));var db=require(_0xf7c7('0x4'))['db'];const promiseRetry=require(_0xf7c7('0x5'));function respondWithResult(_0x3e441f,_0x159113){_0x159113=_0x159113||0xc8;return function(_0x3e04f1){if(_0x3e04f1){return _0x3e441f['status'](_0x159113)['json'](_0x3e04f1);}};}function respondWithFilteredResult(_0xbe2954,_0x1877ad){return function(_0x2046e7){if(_0x2046e7){var _0x4b979d=typeof _0x1877ad[_0xf7c7('0x6')]===_0xf7c7('0x7')&&typeof _0x1877ad[_0xf7c7('0x8')]===_0xf7c7('0x7');var _0x8e8931=_0x2046e7[_0xf7c7('0x9')];var _0x4ced70=_0x4b979d?0x0:_0x1877ad[_0xf7c7('0x6')];var _0x329b9a=_0x4b979d?_0x2046e7[_0xf7c7('0x9')]:_0x1877ad['offset']+_0x1877ad[_0xf7c7('0x8')];var _0x24a2b0;if(_0x329b9a>=_0x8e8931){_0x329b9a=_0x8e8931;_0x24a2b0=0xc8;}else{_0x24a2b0=0xce;}_0xbe2954[_0xf7c7('0xa')](_0x24a2b0);return _0xbe2954[_0xf7c7('0xb')]('Content-Range',_0x4ced70+'-'+_0x329b9a+'/'+_0x8e8931)[_0xf7c7('0xc')](_0x2046e7);}return null;};}function saveUpdates(_0x27d381){return function(_0x3da94f){if(_0x3da94f){return _0x3da94f[_0xf7c7('0xd')](_0x27d381)[_0xf7c7('0xe')](function(_0x46cf4e){return _0x46cf4e;});}return null;};}function removeEntity(_0x55129f){return function(_0x20338f){if(_0x20338f){return _0x20338f[_0xf7c7('0xf')]()[_0xf7c7('0xe')](function(){_0x55129f[_0xf7c7('0xa')](0xcc)[_0xf7c7('0x10')]();});}};}function handleEntityNotFound(_0x15549d){return function(_0x4637e6){if(!_0x4637e6){_0x15549d['sendStatus'](0x194);}return _0x4637e6;};}function handleError(_0x1f209f,_0x532c99){_0x532c99=_0x532c99||0x1f4;return function(_0x2d3d34){logger['error'](_0x2d3d34[_0xf7c7('0x11')]);if(_0x2d3d34[_0xf7c7('0x12')]){delete _0x2d3d34[_0xf7c7('0x12')];}_0x1f209f['status'](_0x532c99)['send'](_0x2d3d34);};}exports[_0xf7c7('0x13')]=function(_0x910ab4,_0x4c95ac){var _0x454e5b={},_0x184982={},_0x4f298f={'count':0x0,'rows':[]};var _0xdc06bc=_['map'](db[_0xf7c7('0x14')][_0xf7c7('0x15')],function(_0x122f1d){return{'name':_0x122f1d[_0xf7c7('0x16')],'type':_0x122f1d[_0xf7c7('0x17')][_0xf7c7('0x18')]};});_0x184982['model']=_[_0xf7c7('0x19')](_0xdc06bc,_0xf7c7('0x12'));_0x184982[_0xf7c7('0x1a')]=_[_0xf7c7('0x1b')](_0x910ab4[_0xf7c7('0x1a')]);_0x184982['filters']=_[_0xf7c7('0x1c')](_0x184982[_0xf7c7('0x1d')],_0x184982[_0xf7c7('0x1a')]);_0x454e5b['attributes']=_[_0xf7c7('0x1c')](_0x184982[_0xf7c7('0x1d')],qs[_0xf7c7('0x1e')](_0x910ab4[_0xf7c7('0x1a')][_0xf7c7('0x1e')]));_0x454e5b['attributes']=_0x454e5b[_0xf7c7('0x1f')][_0xf7c7('0x20')]?_0x454e5b[_0xf7c7('0x1f')]:_0x184982[_0xf7c7('0x1d')];if(!_0x910ab4[_0xf7c7('0x1a')][_0xf7c7('0x21')]('nolimit')){_0x454e5b[_0xf7c7('0x8')]=qs[_0xf7c7('0x8')](_0x910ab4[_0xf7c7('0x1a')]['limit']);_0x454e5b['offset']=qs[_0xf7c7('0x6')](_0x910ab4['query'][_0xf7c7('0x6')]);}_0x454e5b[_0xf7c7('0x22')]=qs['sort'](_0x910ab4[_0xf7c7('0x1a')][_0xf7c7('0x23')]);_0x454e5b[_0xf7c7('0x24')]=qs['filters'](_[_0xf7c7('0x25')](_0x910ab4['query'],_0x184982[_0xf7c7('0x26')]),_0xdc06bc);if(_0x910ab4['query'][_0xf7c7('0x27')]){_0x454e5b[_0xf7c7('0x24')]=_[_0xf7c7('0x28')](_0x454e5b['where'],{'$or':_['map'](_0xdc06bc,function(_0x2f8d3b){if(_0x2f8d3b[_0xf7c7('0x17')]!=='VIRTUAL'){var _0x23ac85={};_0x23ac85[_0x2f8d3b['name']]={'$like':'%'+_0x910ab4[_0xf7c7('0x1a')][_0xf7c7('0x27')]+'%'};return _0x23ac85;}})});}_0x454e5b=_[_0xf7c7('0x28')]({},_0x454e5b,_0x910ab4[_0xf7c7('0x29')]);var _0x3ad183={'where':_0x454e5b['where']};return db[_0xf7c7('0x14')][_0xf7c7('0x9')](_0x3ad183)[_0xf7c7('0xe')](function(_0x23fb65){_0x4f298f[_0xf7c7('0x9')]=_0x23fb65;if(_0x910ab4['query']['includeAll']){_0x454e5b['include']=[{'attributes':['id',_0xf7c7('0x12'),_0xf7c7('0x2a'),_0xf7c7('0x2b')],'model':db[_0xf7c7('0x2c')],'as':_0xf7c7('0x2c')}];}return db[_0xf7c7('0x14')][_0xf7c7('0x2d')](_0x454e5b);})[_0xf7c7('0xe')](function(_0x142efb){_0x4f298f[_0xf7c7('0x2e')]=_0x142efb;return _0x4f298f;})[_0xf7c7('0xe')](respondWithFilteredResult(_0x4c95ac,_0x454e5b))['catch'](handleError(_0x4c95ac,null));};exports[_0xf7c7('0x2f')]=function(_0x8b379f,_0xdcdd7c){var _0x559ea9={'raw':!![],'where':{'id':_0x8b379f[_0xf7c7('0x30')]['id']}},_0x5eca5d={};_0x5eca5d[_0xf7c7('0x1d')]=_[_0xf7c7('0x1b')](db[_0xf7c7('0x14')][_0xf7c7('0x15')]);_0x5eca5d[_0xf7c7('0x1a')]=_[_0xf7c7('0x1b')](_0x8b379f['query']);_0x5eca5d[_0xf7c7('0x26')]=_['intersection'](_0x5eca5d[_0xf7c7('0x1d')],_0x5eca5d['query']);_0x559ea9[_0xf7c7('0x1f')]=_['intersection'](_0x5eca5d[_0xf7c7('0x1d')],qs['fields'](_0x8b379f[_0xf7c7('0x1a')][_0xf7c7('0x1e')]));_0x559ea9[_0xf7c7('0x1f')]=_0x559ea9[_0xf7c7('0x1f')][_0xf7c7('0x20')]?_0x559ea9['attributes']:_0x5eca5d[_0xf7c7('0x1d')];if(_0x8b379f['query'][_0xf7c7('0x31')]){_0x559ea9[_0xf7c7('0x32')]=[{'all':!![]}];}_0x559ea9=_[_0xf7c7('0x28')]({},_0x559ea9,_0x8b379f[_0xf7c7('0x29')]);return db['VoiceCallReport'][_0xf7c7('0x33')](_0x559ea9)[_0xf7c7('0xe')](handleEntityNotFound(_0xdcdd7c,null))['then'](respondWithResult(_0xdcdd7c,null))[_0xf7c7('0x34')](handleError(_0xdcdd7c,null));};exports['create']=function(_0xe89823,_0x2b1965){return db[_0xf7c7('0x14')]['create'](_0xe89823[_0xf7c7('0x35')],{})['then'](respondWithResult(_0x2b1965,0xc9))[_0xf7c7('0x34')](handleError(_0x2b1965,null));};exports[_0xf7c7('0xf')]=function(_0x2ccd80,_0x4efe73){return db[_0xf7c7('0x14')][_0xf7c7('0x33')]({'where':{'id':_0x2ccd80[_0xf7c7('0x30')]['id']}})[_0xf7c7('0xe')](handleEntityNotFound(_0x4efe73,null))[_0xf7c7('0xe')](removeEntity(_0x4efe73,null))['catch'](handleError(_0x4efe73,null));};exports[_0xf7c7('0x36')]=function(_0x473e38,_0x387449){return db['VoiceCallReport']['describe']()[_0xf7c7('0xe')](respondWithResult(_0x387449,null))[_0xf7c7('0x34')](handleError(_0x387449,null));};function findForUpdate(_0x1f3e24){return db[_0xf7c7('0x14')][_0xf7c7('0x33')]({'where':{'uniqueid':_0x1f3e24[_0xf7c7('0x30')]['id'],'UserId':{'$or':[null,_0x1f3e24['user']['id']]}}});}exports[_0xf7c7('0xd')]=function(_0x347e87,_0x57d605){if(_0x347e87[_0xf7c7('0x35')][_0xf7c7('0x37')]){delete _0x347e87[_0xf7c7('0x35')][_0xf7c7('0x37')];}return findForUpdate(_0x347e87)[_0xf7c7('0xe')](handleEntityNotFound(_0x57d605,null))[_0xf7c7('0xe')](saveUpdates(_0x347e87[_0xf7c7('0x35')],null))[_0xf7c7('0xe')](respondWithResult(_0x57d605,null))[_0xf7c7('0x34')](handleError(_0x57d605,null));};exports[_0xf7c7('0x38')]=function(_0x223868,_0x529314){if(_0x223868['body']['uniqueid']){delete _0x223868[_0xf7c7('0x35')][_0xf7c7('0x37')];}promiseRetry(function(_0x1c7b02){return findForUpdate(_0x223868)[_0xf7c7('0xe')](function(_0x13d4dd){if(_0x13d4dd!==null){return _0x13d4dd;}else{_0x1c7b02(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0xf7c7('0xe')](function(_0x2de3f0){return _0x2de3f0[_0xf7c7('0xd')](_0x223868[_0xf7c7('0x35')])[_0xf7c7('0xe')](function(_0xa42c83){return respondWithResult(_0x529314)(_0xa42c83);});},handleEntityNotFound(_0x529314));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index f17ad93..a5207e7 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 _0xb2a7=['report_call','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xb2a7,0xe8));var _0x7b2a=function(_0x44f4c1,_0x117b72){_0x44f4c1=_0x44f4c1-0x0;var _0x2f87c4=_0xb2a7[_0x44f4c1];return _0x2f87c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b2a('0x0'))(_0x7b2a('0x1'));var moment=require('moment');var BPromise=require(_0x7b2a('0x2'));var rp=require(_0x7b2a('0x3'));var fs=require('fs');var path=require(_0x7b2a('0x4'));var rimraf=require(_0x7b2a('0x5'));var config=require('../../config/environment');var attributes=require(_0x7b2a('0x6'));module[_0x7b2a('0x7')]=function(_0x463a91,_0x5e9a53){return _0x463a91[_0x7b2a('0x8')](_0x7b2a('0x9'),attributes,{'tableName':_0x7b2a('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ea8=['api','moment','request-promise','path','rimraf','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x5941a3,_0x358c94){var _0x127e7a=function(_0x24152f){while(--_0x24152f){_0x5941a3['push'](_0x5941a3['shift']());}};_0x127e7a(++_0x358c94);}(_0x7ea8,0x1d1));var _0x87ea=function(_0xd57719,_0x25e43c){_0xd57719=_0xd57719-0x0;var _0xf05cb1=_0x7ea8[_0xd57719];return _0xf05cb1;};'use strict';var _=require(_0x87ea('0x0'));var util=require(_0x87ea('0x1'));var logger=require(_0x87ea('0x2'))(_0x87ea('0x3'));var moment=require(_0x87ea('0x4'));var BPromise=require('bluebird');var rp=require(_0x87ea('0x5'));var fs=require('fs');var path=require(_0x87ea('0x6'));var rimraf=require(_0x87ea('0x7'));var config=require('../../config/environment');var attributes=require('./voiceCallReport.attributes');module[_0x87ea('0x8')]=function(_0x1927e0,_0x70dccf){return _0x1927e0[_0x87ea('0x9')](_0x87ea('0xa'),attributes,{'tableName':_0x87ea('0xb'),'paranoid':![],'indexes':[{'fields':[_0x87ea('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index e8a3cfc..8b10d3c 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 _0xb5b6=['CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','debug','stringify'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0xb5b6,0x14e));var _0x6b5b=function(_0x34166c,_0xd53d21){_0x34166c=_0x34166c-0x0;var _0x210bf7=_0xb5b6[_0x34166c];return _0x210bf7;};'use strict';var _=require(_0x6b5b('0x0'));var util=require(_0x6b5b('0x1'));var moment=require(_0x6b5b('0x2'));var BPromise=require(_0x6b5b('0x3'));var rs=require(_0x6b5b('0x4'));var fs=require('fs');var Redis=require(_0x6b5b('0x5'));var db=require(_0x6b5b('0x6'))['db'];var utils=require(_0x6b5b('0x7'));var logger=require(_0x6b5b('0x8'))(_0x6b5b('0x9'));var config=require(_0x6b5b('0xa'));var jayson=require(_0x6b5b('0xb'));var client=jayson[_0x6b5b('0xc')][_0x6b5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d06a9,_0x5ed7ee,_0x1e366b){return new BPromise(function(_0xe6c0a1,_0x5898bb){return client[_0x6b5b('0xe')](_0x1d06a9,_0x1e366b)[_0x6b5b('0xf')](function(_0x304a66){logger['info'](_0x6b5b('0x10'),_0x5ed7ee,'request\x20sent');logger['debug'](_0x6b5b('0x11'),_0x5ed7ee,_0x6b5b('0x12'),JSON['stringify'](_0x304a66));if(_0x304a66[_0x6b5b('0x13')]){if(_0x304a66[_0x6b5b('0x13')]['code']===0x1f4){logger['error'](_0x6b5b('0x10'),_0x5ed7ee,_0x304a66[_0x6b5b('0x13')][_0x6b5b('0x14')]);return _0x5898bb(_0x304a66[_0x6b5b('0x13')][_0x6b5b('0x14')]);}logger[_0x6b5b('0x13')](_0x6b5b('0x10'),_0x5ed7ee,_0x304a66['error']['message']);return _0xe6c0a1(_0x304a66[_0x6b5b('0x13')]['message']);}else{logger[_0x6b5b('0x15')](_0x6b5b('0x10'),_0x5ed7ee,_0x6b5b('0x12'));_0xe6c0a1(_0x304a66[_0x6b5b('0x16')][_0x6b5b('0x14')]);}})[_0x6b5b('0x17')](function(_0x162433){logger[_0x6b5b('0x13')](_0x6b5b('0x10'),_0x5ed7ee,_0x162433);_0x5898bb(_0x162433);});});}exports[_0x6b5b('0x18')]=function(_0x47420f){var _0x227638=this;return new Promise(function(_0x41478d,_0x4fd44e){return db['VoiceCallReport']['findAll']({'raw':_0x47420f[_0x6b5b('0x19')]?_0x47420f['options'][_0x6b5b('0x1a')]===undefined?!![]:![]:!![],'where':_0x47420f[_0x6b5b('0x19')]?_0x47420f['options'][_0x6b5b('0x1b')]||null:null,'attributes':_0x47420f[_0x6b5b('0x19')]?_0x47420f['options'][_0x6b5b('0x1c')]||null:null,'limit':_0x47420f['options']?_0x47420f['options'][_0x6b5b('0x1d')]||null:null,'include':_0x47420f[_0x6b5b('0x19')]?_0x47420f['options'][_0x6b5b('0x1e')]?_[_0x6b5b('0x1f')](_0x47420f[_0x6b5b('0x19')]['include'],function(_0x5b98b8){return{'model':db[_0x5b98b8[_0x6b5b('0x20')]],'as':_0x5b98b8['as'],'attributes':_0x5b98b8[_0x6b5b('0x1c')],'include':_0x5b98b8['include']?_[_0x6b5b('0x1f')](_0x5b98b8[_0x6b5b('0x1e')],function(_0x1296de){return{'model':db[_0x1296de[_0x6b5b('0x20')]],'as':_0x1296de['as'],'attributes':_0x1296de[_0x6b5b('0x1c')],'include':_0x1296de[_0x6b5b('0x1e')]?_['map'](_0x1296de['include'],function(_0x3c99d4){return{'model':db[_0x3c99d4[_0x6b5b('0x20')]],'as':_0x3c99d4['as'],'attributes':_0x3c99d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b5b('0xf')](function(_0x1ae5e5){logger['info'](_0x6b5b('0x18'),_0x47420f);logger[_0x6b5b('0x21')](_0x6b5b('0x18'),_0x47420f,JSON[_0x6b5b('0x22')](_0x1ae5e5));_0x41478d(_0x1ae5e5);})[_0x6b5b('0x17')](function(_0x1f6230){logger[_0x6b5b('0x13')]('GetVoiceCallReport',_0x1f6230[_0x6b5b('0x14')],_0x47420f);_0x4fd44e(_0x227638[_0x6b5b('0x13')](0x1f4,_0x1f6230[_0x6b5b('0x14')]));});});};exports[_0x6b5b('0x23')]=function(_0x35b50f){var _0x325f6c=this;return new Promise(function(_0x488d88,_0x2a413a){return db[_0x6b5b('0x24')][_0x6b5b('0x25')](_0x35b50f[_0x6b5b('0x26')],{'raw':_0x35b50f['options']?_0x35b50f[_0x6b5b('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xea8fe5){logger[_0x6b5b('0x15')](_0x6b5b('0x23'),_0x35b50f);logger[_0x6b5b('0x21')]('CreateVoiceCallReport',_0x35b50f,JSON[_0x6b5b('0x22')](_0xea8fe5));_0x488d88(_0xea8fe5);})[_0x6b5b('0x17')](function(_0xad080a){logger['error'](_0x6b5b('0x23'),_0xad080a[_0x6b5b('0x14')],_0x35b50f);_0x2a413a(_0x325f6c[_0x6b5b('0x13')](0x1f4,_0xad080a[_0x6b5b('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x4fc59d){var _0xc3153a=this;return new Promise(function(_0x28c4a1,_0xb93708){return db['VoiceCallReport'][_0x6b5b('0x27')](_0x4fc59d['body'],{'raw':_0x4fc59d[_0x6b5b('0x19')]?_0x4fc59d[_0x6b5b('0x19')][_0x6b5b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fc59d[_0x6b5b('0x19')]?_0x4fc59d['options'][_0x6b5b('0x1b')]||null:null,'attributes':_0x4fc59d['options']?_0x4fc59d[_0x6b5b('0x19')][_0x6b5b('0x1c')]||null:null,'limit':_0x4fc59d[_0x6b5b('0x19')]?_0x4fc59d[_0x6b5b('0x19')][_0x6b5b('0x1d')]||null:null})[_0x6b5b('0xf')](function(_0x283196){logger['info'](_0x6b5b('0x28'),_0x4fc59d);logger[_0x6b5b('0x21')](_0x6b5b('0x28'),_0x4fc59d,JSON[_0x6b5b('0x22')](_0x283196));_0x28c4a1(_0x283196);})[_0x6b5b('0x17')](function(_0x6ac05a){logger[_0x6b5b('0x13')](_0x6b5b('0x28'),_0x6ac05a[_0x6b5b('0x14')],_0x4fc59d);_0xb93708(_0xc3153a['error'](0x1f4,_0x6ac05a['message']));});});}; \ No newline at end of file +var _0xac81=['UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','create','body'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xac81,0x16a));var _0x1ac8=function(_0x1cca33,_0x2be37d){_0x1cca33=_0x1cca33-0x0;var _0x305532=_0xac81[_0x1cca33];return _0x305532;};'use strict';var _=require(_0x1ac8('0x0'));var util=require(_0x1ac8('0x1'));var moment=require('moment');var BPromise=require(_0x1ac8('0x2'));var rs=require(_0x1ac8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ac8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac8('0x5'))(_0x1ac8('0x6'));var config=require(_0x1ac8('0x7'));var jayson=require(_0x1ac8('0x8'));var client=jayson[_0x1ac8('0x9')][_0x1ac8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49a9f5,_0x5c7073,_0x44f330){return new BPromise(function(_0x2063ad,_0x48bc3a){return client[_0x1ac8('0xb')](_0x49a9f5,_0x44f330)[_0x1ac8('0xc')](function(_0x2f4b9f){logger[_0x1ac8('0xd')](_0x1ac8('0xe'),_0x5c7073,'request\x20sent');logger[_0x1ac8('0xf')](_0x1ac8('0x10'),_0x5c7073,_0x1ac8('0x11'),JSON[_0x1ac8('0x12')](_0x2f4b9f));if(_0x2f4b9f[_0x1ac8('0x13')]){if(_0x2f4b9f['error'][_0x1ac8('0x14')]===0x1f4){logger[_0x1ac8('0x13')](_0x1ac8('0xe'),_0x5c7073,_0x2f4b9f[_0x1ac8('0x13')][_0x1ac8('0x15')]);return _0x48bc3a(_0x2f4b9f[_0x1ac8('0x13')][_0x1ac8('0x15')]);}logger[_0x1ac8('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x5c7073,_0x2f4b9f[_0x1ac8('0x13')][_0x1ac8('0x15')]);return _0x2063ad(_0x2f4b9f[_0x1ac8('0x13')][_0x1ac8('0x15')]);}else{logger[_0x1ac8('0xd')](_0x1ac8('0xe'),_0x5c7073,_0x1ac8('0x11'));_0x2063ad(_0x2f4b9f[_0x1ac8('0x16')]['message']);}})[_0x1ac8('0x17')](function(_0x4a1553){logger[_0x1ac8('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x5c7073,_0x4a1553);_0x48bc3a(_0x4a1553);});});}exports['GetVoiceCallReport']=function(_0x462195){var _0x464bfb=this;return new Promise(function(_0x51c3fe,_0x571400){return db[_0x1ac8('0x18')][_0x1ac8('0x19')]({'raw':_0x462195[_0x1ac8('0x1a')]?_0x462195['options'][_0x1ac8('0x1b')]===undefined?!![]:![]:!![],'where':_0x462195[_0x1ac8('0x1a')]?_0x462195['options'][_0x1ac8('0x1c')]||null:null,'attributes':_0x462195['options']?_0x462195['options'][_0x1ac8('0x1d')]||null:null,'limit':_0x462195['options']?_0x462195['options'][_0x1ac8('0x1e')]||null:null,'include':_0x462195[_0x1ac8('0x1a')]?_0x462195[_0x1ac8('0x1a')][_0x1ac8('0x1f')]?_[_0x1ac8('0x20')](_0x462195[_0x1ac8('0x1a')][_0x1ac8('0x1f')],function(_0x4b24bd){return{'model':db[_0x4b24bd[_0x1ac8('0x21')]],'as':_0x4b24bd['as'],'attributes':_0x4b24bd[_0x1ac8('0x1d')],'include':_0x4b24bd[_0x1ac8('0x1f')]?_[_0x1ac8('0x20')](_0x4b24bd['include'],function(_0x382d45){return{'model':db[_0x382d45[_0x1ac8('0x21')]],'as':_0x382d45['as'],'attributes':_0x382d45[_0x1ac8('0x1d')],'include':_0x382d45[_0x1ac8('0x1f')]?_[_0x1ac8('0x20')](_0x382d45['include'],function(_0x1abca9){return{'model':db[_0x1abca9[_0x1ac8('0x21')]],'as':_0x1abca9['as'],'attributes':_0x1abca9['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ac8('0xc')](function(_0x5b4e86){logger['info'](_0x1ac8('0x22'),_0x462195);logger[_0x1ac8('0xf')](_0x1ac8('0x22'),_0x462195,JSON[_0x1ac8('0x12')](_0x5b4e86));_0x51c3fe(_0x5b4e86);})[_0x1ac8('0x17')](function(_0x179ded){logger[_0x1ac8('0x13')](_0x1ac8('0x22'),_0x179ded['message'],_0x462195);_0x571400(_0x464bfb[_0x1ac8('0x13')](0x1f4,_0x179ded['message']));});});};exports[_0x1ac8('0x23')]=function(_0x2aa66c){var _0x520086=this;return new Promise(function(_0x292178,_0x230bcb){return db[_0x1ac8('0x18')][_0x1ac8('0x24')](_0x2aa66c[_0x1ac8('0x25')],{'raw':_0x2aa66c[_0x1ac8('0x1a')]?_0x2aa66c[_0x1ac8('0x1a')][_0x1ac8('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x42af16){logger['info']('CreateVoiceCallReport',_0x2aa66c);logger[_0x1ac8('0xf')](_0x1ac8('0x23'),_0x2aa66c,JSON[_0x1ac8('0x12')](_0x42af16));_0x292178(_0x42af16);})['catch'](function(_0x280d95){logger[_0x1ac8('0x13')]('CreateVoiceCallReport',_0x280d95[_0x1ac8('0x15')],_0x2aa66c);_0x230bcb(_0x520086[_0x1ac8('0x13')](0x1f4,_0x280d95[_0x1ac8('0x15')]));});});};exports[_0x1ac8('0x26')]=function(_0x54efa8){var _0x28bf3d=this;return new Promise(function(_0x1fc4bc,_0xbd9870){return db[_0x1ac8('0x18')][_0x1ac8('0x27')](_0x54efa8[_0x1ac8('0x25')],{'raw':_0x54efa8[_0x1ac8('0x1a')]?_0x54efa8['options'][_0x1ac8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54efa8[_0x1ac8('0x1a')]?_0x54efa8[_0x1ac8('0x1a')]['where']||null:null,'attributes':_0x54efa8[_0x1ac8('0x1a')]?_0x54efa8[_0x1ac8('0x1a')][_0x1ac8('0x1d')]||null:null,'limit':_0x54efa8[_0x1ac8('0x1a')]?_0x54efa8[_0x1ac8('0x1a')][_0x1ac8('0x1e')]||null:null})[_0x1ac8('0xc')](function(_0x8075f4){logger['info'](_0x1ac8('0x26'),_0x54efa8);logger[_0x1ac8('0xf')]('UpdateVoiceCallReport',_0x54efa8,JSON[_0x1ac8('0x12')](_0x8075f4));_0x1fc4bc(_0x8075f4);})['catch'](function(_0x3d366d){logger[_0x1ac8('0x13')]('UpdateVoiceCallReport',_0x3d366d[_0x1ac8('0x15')],_0x54efa8);_0xbd9870(_0x28bf3d['error'](0x1f4,_0x3d366d['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 3848726..1b8a557 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 _0xf987=['update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','create','put','/:id'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xf987,0x136));var _0x7f98=function(_0x434ee2,_0x522a17){_0x434ee2=_0x434ee2-0x0;var _0x5215ed=_0xf987[_0x434ee2];return _0x5215ed;};'use strict';var multer=require('multer');var util=require(_0x7f98('0x0'));var path=require('path');var timeout=require(_0x7f98('0x1'));var express=require(_0x7f98('0x2'));var router=express[_0x7f98('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f98('0x4'));var interaction=require(_0x7f98('0x5'));var config=require(_0x7f98('0x6'));var controller=require(_0x7f98('0x7'));router['get']('/',auth[_0x7f98('0x8')](),controller[_0x7f98('0x9')]);router['get']('/:id',auth[_0x7f98('0x8')](),controller['show']);router['post']('/',auth[_0x7f98('0x8')](),controller[_0x7f98('0xa')]);router[_0x7f98('0xb')](_0x7f98('0xc'),auth[_0x7f98('0x8')](),controller[_0x7f98('0xd')]);router[_0x7f98('0xe')](_0x7f98('0xc'),auth['isAuthenticated'](),controller[_0x7f98('0xf')]);module[_0x7f98('0x10')]=router; \ No newline at end of file +var _0x1bbf=['index','get','/:id','show','create','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x1bbf,0xa8));var _0xf1bb=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x1bbf[_0x6e1239];return _0x418150;};'use strict';var multer=require('multer');var util=require(_0xf1bb('0x0'));var path=require(_0xf1bb('0x1'));var timeout=require(_0xf1bb('0x2'));var express=require(_0xf1bb('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf1bb('0x4'));var interaction=require(_0xf1bb('0x5'));var config=require('../../config/environment');var controller=require(_0xf1bb('0x6'));router['get']('/',auth[_0xf1bb('0x7')](),controller[_0xf1bb('0x8')]);router[_0xf1bb('0x9')](_0xf1bb('0xa'),auth[_0xf1bb('0x7')](),controller[_0xf1bb('0xb')]);router['post']('/',auth[_0xf1bb('0x7')](),controller[_0xf1bb('0xc')]);router[_0xf1bb('0xd')]('/:id',auth[_0xf1bb('0x7')](),controller['update']);router[_0xf1bb('0xe')](_0xf1bb('0xa'),auth[_0xf1bb('0x7')](),controller['destroy']);module[_0xf1bb('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index c1f223e..609dc12 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 _0x6d93=['join','getDataValue','options','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0x11a5ab,_0x82368b){var _0x302258=function(_0x3e5189){while(--_0x3e5189){_0x11a5ab['push'](_0x11a5ab['shift']());}};_0x302258(++_0x82368b);}(_0x6d93,0x154));var _0x36d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d93[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x36d9('0x0')]={'name':{'type':Sequelize[_0x36d9('0x1')]},'prefix':{'type':Sequelize[_0x36d9('0x1')],'unique':_0x36d9('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x36d9('0x1')],'set':function(_0xb9b195){this[_0x36d9('0x3')]('options',_0xb9b195?_0xb9b195[_0x36d9('0x4')](''):[]);},'get':function(){return this[_0x36d9('0x5')](_0x36d9('0x6'))?this[_0x36d9('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x36d9('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x36d9('0x1')]},'record':{'type':Sequelize[_0x36d9('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x36d9('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x04fb=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x4e918e,_0x425713){var _0x14c813=function(_0x16aa93){while(--_0x16aa93){_0x4e918e['push'](_0x4e918e['shift']());}};_0x14c813(++_0x425713);}(_0x04fb,0xc1));var _0xb04f=function(_0x39d98a,_0x543abc){_0x39d98a=_0x39d98a-0x0;var _0x47bc9f=_0x04fb[_0x39d98a];return _0x47bc9f;};'use strict';var Sequelize=require(_0xb04f('0x0'));module[_0xb04f('0x1')]={'name':{'type':Sequelize[_0xb04f('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xb04f('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb04f('0x2')],'set':function(_0x5558e4){this[_0xb04f('0x4')](_0xb04f('0x5'),_0x5558e4?_0x5558e4['join'](''):[]);},'get':function(){return this[_0xb04f('0x6')]('options')?this[_0xb04f('0x6')](_0xb04f('0x5'))[_0xb04f('0x7')](''):[];}},'auth':{'type':Sequelize[_0xb04f('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xb04f('0x2')]},'record':{'type':Sequelize[_0xb04f('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb04f('0x2')]},'description':{'type':Sequelize[_0xb04f('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index b066a29..1d93d9d 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 _0x765b=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','VoiceChanSpy','include','show','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','fast-json-patch','moment','mustache','util','path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','ChanSpies','error','name'];(function(_0x567577,_0x5a1ea8){var _0x5ee6da=function(_0x434cc7){while(--_0x434cc7){_0x567577['push'](_0x567577['shift']());}};_0x5ee6da(++_0x5a1ea8);}(_0x765b,0x18c));var _0xb765=function(_0xf91841,_0x182ae3){_0xf91841=_0xf91841-0x0;var _0x4b9c44=_0x765b[_0xf91841];return _0x4b9c44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb765('0x0'));var rp=require('request-promise');var moment=require(_0xb765('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb765('0x2'));var util=require(_0xb765('0x3'));var path=require(_0xb765('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb765('0x5'));var squel=require('squel');var crypto=require(_0xb765('0x6'));var jsforce=require(_0xb765('0x7'));var deskjs=require(_0xb765('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb765('0x9'));var Papa=require(_0xb765('0xa'));var Redis=require(_0xb765('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb765('0xc'));var logger=require(_0xb765('0xd'))(_0xb765('0xe'));var utils=require(_0xb765('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xb765('0x10'));var db=require(_0xb765('0x11'))['db'];function respondWithStatusCode(_0x157a3b,_0x3f9acb){_0x3f9acb=_0x3f9acb||0xcc;return function(_0x38ee06){if(_0x38ee06){return _0x157a3b[_0xb765('0x12')](_0x3f9acb);}return _0x157a3b[_0xb765('0x13')](_0x3f9acb)[_0xb765('0x14')]();};}function respondWithResult(_0x355f6e,_0x4d8eff){_0x4d8eff=_0x4d8eff||0xc8;return function(_0x2aebdb){if(_0x2aebdb){return _0x355f6e['status'](_0x4d8eff)[_0xb765('0x15')](_0x2aebdb);}};}function respondWithFilteredResult(_0x33958e,_0x4cecc1){return function(_0x4b8e26){if(_0x4b8e26){var _0x3f73f4=typeof _0x4cecc1[_0xb765('0x16')]===_0xb765('0x17')&&typeof _0x4cecc1[_0xb765('0x18')]===_0xb765('0x17');var _0x3b9a9b=_0x4b8e26[_0xb765('0x19')];var _0x395edc=_0x3f73f4?0x0:_0x4cecc1['offset'];var _0x3fd470=_0x3f73f4?_0x4b8e26[_0xb765('0x19')]:_0x4cecc1[_0xb765('0x16')]+_0x4cecc1[_0xb765('0x18')];var _0x711484;if(_0x3fd470>=_0x3b9a9b){_0x3fd470=_0x3b9a9b;_0x711484=0xc8;}else{_0x711484=0xce;}_0x33958e[_0xb765('0x13')](_0x711484);return _0x33958e[_0xb765('0x1a')](_0xb765('0x1b'),_0x395edc+'-'+_0x3fd470+'/'+_0x3b9a9b)[_0xb765('0x15')](_0x4b8e26);}return null;};}function patchUpdates(_0x3a1197){return function(_0x44936d){try{jsonpatch[_0xb765('0x1c')](_0x44936d,_0x3a1197,!![]);}catch(_0x5074ca){return BPromise['reject'](_0x5074ca);}return _0x44936d[_0xb765('0x1d')]();};}function saveUpdates(_0x5f4189,_0x3d69c7){return function(_0x2e0196){if(_0x2e0196){return _0x2e0196[_0xb765('0x1e')](_0x5f4189)['then'](function(_0x97b886){return _0x97b886;});}return null;};}function removeEntity(_0x1a740c,_0x5d1ea0){return function(_0x3a05b1){if(_0x3a05b1){return _0x3a05b1[_0xb765('0x1f')]()[_0xb765('0x20')](function(){var _0x410c6f=_0x3a05b1['get']({'plain':!![]});var _0x3735e3=_0xb765('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x3735e3,'resourceId':_0x410c6f['id']}})[_0xb765('0x20')](function(){return _0x3a05b1;});})[_0xb765('0x20')](function(){_0x1a740c[_0xb765('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f6f27,_0x4a3aac){return function(_0xf35ec1){if(!_0xf35ec1){_0x4f6f27[_0xb765('0x12')](0x194);}return _0xf35ec1;};}function handleError(_0x29767f,_0x4db746){_0x4db746=_0x4db746||0x1f4;return function(_0xb41497){logger[_0xb765('0x22')](_0xb41497['stack']);if(_0xb41497[_0xb765('0x23')]){delete _0xb41497[_0xb765('0x23')];}_0x29767f[_0xb765('0x13')](_0x4db746)['send'](_0xb41497);};}exports['index']=function(_0x2d3f99,_0x42fc05){var _0x1d8970={},_0x4bb376={},_0x40209e={'count':0x0,'rows':[]};var _0x34ab67=_['map'](db['VoiceChanSpy'][_0xb765('0x24')],function(_0x16b015){return{'name':_0x16b015[_0xb765('0x25')],'type':_0x16b015[_0xb765('0x26')][_0xb765('0x27')]};});_0x4bb376[_0xb765('0x28')]=_[_0xb765('0x29')](_0x34ab67,'name');_0x4bb376[_0xb765('0x2a')]=_[_0xb765('0x2b')](_0x2d3f99[_0xb765('0x2a')]);_0x4bb376[_0xb765('0x2c')]=_['intersection'](_0x4bb376['model'],_0x4bb376['query']);_0x1d8970[_0xb765('0x2d')]=_[_0xb765('0x2e')](_0x4bb376['model'],qs[_0xb765('0x2f')](_0x2d3f99['query']['fields']));_0x1d8970[_0xb765('0x2d')]=_0x1d8970[_0xb765('0x2d')]['length']?_0x1d8970[_0xb765('0x2d')]:_0x4bb376[_0xb765('0x28')];if(!_0x2d3f99['query'][_0xb765('0x30')](_0xb765('0x31'))){_0x1d8970[_0xb765('0x18')]=qs[_0xb765('0x18')](_0x2d3f99[_0xb765('0x2a')][_0xb765('0x18')]);_0x1d8970[_0xb765('0x16')]=qs[_0xb765('0x16')](_0x2d3f99['query'][_0xb765('0x16')]);}_0x1d8970[_0xb765('0x32')]=qs['sort'](_0x2d3f99[_0xb765('0x2a')]['sort']);_0x1d8970[_0xb765('0x33')]=qs[_0xb765('0x2c')](_['pick'](_0x2d3f99[_0xb765('0x2a')],_0x4bb376[_0xb765('0x2c')]),_0x34ab67);if(_0x2d3f99['query']['filter']){_0x1d8970[_0xb765('0x33')]=_[_0xb765('0x34')](_0x1d8970[_0xb765('0x33')],{'$or':_[_0xb765('0x29')](_0x34ab67,function(_0x492620){if(_0x492620[_0xb765('0x26')]!==_0xb765('0x35')){var _0x15ba36={};_0x15ba36[_0x492620['name']]={'$like':'%'+_0x2d3f99[_0xb765('0x2a')][_0xb765('0x36')]+'%'};return _0x15ba36;}})});}_0x1d8970=_[_0xb765('0x34')]({},_0x1d8970,_0x2d3f99[_0xb765('0x37')]);var _0x5bbaa3={'where':_0x1d8970[_0xb765('0x33')]};return db[_0xb765('0x38')]['count'](_0x5bbaa3)[_0xb765('0x20')](function(_0x536651){_0x40209e[_0xb765('0x19')]=_0x536651;if(_0x2d3f99['query']['includeAll']){_0x1d8970[_0xb765('0x39')]=[{'all':!![]}];}return db[_0xb765('0x38')]['findAll'](_0x1d8970);})[_0xb765('0x20')](function(_0x516b98){_0x40209e['rows']=_0x516b98;return _0x40209e;})['then'](respondWithFilteredResult(_0x42fc05,_0x1d8970))['catch'](handleError(_0x42fc05,null));};exports[_0xb765('0x3a')]=function(_0x2fb5d6,_0x1737ec){var _0xb8893d={'raw':![],'where':{'id':_0x2fb5d6['params']['id']}},_0x11902b={};_0x11902b[_0xb765('0x28')]=_[_0xb765('0x2b')](db['VoiceChanSpy'][_0xb765('0x24')]);_0x11902b[_0xb765('0x2a')]=_['keys'](_0x2fb5d6[_0xb765('0x2a')]);_0x11902b[_0xb765('0x2c')]=_[_0xb765('0x2e')](_0x11902b[_0xb765('0x28')],_0x11902b[_0xb765('0x2a')]);_0xb8893d[_0xb765('0x2d')]=_[_0xb765('0x2e')](_0x11902b[_0xb765('0x28')],qs[_0xb765('0x2f')](_0x2fb5d6['query'][_0xb765('0x2f')]));_0xb8893d[_0xb765('0x2d')]=_0xb8893d[_0xb765('0x2d')]['length']?_0xb8893d['attributes']:_0x11902b[_0xb765('0x28')];if(_0x2fb5d6['query'][_0xb765('0x3b')]){_0xb8893d[_0xb765('0x39')]=[{'all':!![]}];}_0xb8893d=_['merge']({},_0xb8893d,_0x2fb5d6[_0xb765('0x37')]);return db[_0xb765('0x38')][_0xb765('0x3c')](_0xb8893d)[_0xb765('0x20')](handleEntityNotFound(_0x1737ec,null))[_0xb765('0x20')](respondWithResult(_0x1737ec,null))[_0xb765('0x3d')](handleError(_0x1737ec,null));};exports['create']=function(_0x188dbe,_0x2540fc){return db[_0xb765('0x38')][_0xb765('0x3e')](_0x188dbe[_0xb765('0x3f')],{})[_0xb765('0x20')](function(_0xcbcf4e){var _0x5d8824=_0x188dbe[_0xb765('0x40')]['get']({'plain':!![]});if(!_0x5d8824)throw new Error(_0xb765('0x41'));if(_0x5d8824[_0xb765('0x42')]===_0xb765('0x40')){var _0x38752d=_0xcbcf4e['get']({'plain':!![]});var _0x41d67e='ChanSpies';return db[_0xb765('0x43')]['find']({'where':{'name':_0x41d67e,'userProfileId':_0x5d8824[_0xb765('0x44')]},'raw':!![]})['then'](function(_0x4ede86){if(_0x4ede86&&_0x4ede86[_0xb765('0x45')]===0x0){return db['UserProfileResource'][_0xb765('0x3e')]({'name':_0x38752d[_0xb765('0x23')],'resourceId':_0x38752d['id'],'type':_0x4ede86[_0xb765('0x23')],'sectionId':_0x4ede86['id']},{})[_0xb765('0x20')](function(){return _0xcbcf4e;});}else{return _0xcbcf4e;}})[_0xb765('0x3d')](function(_0x3c9ace){logger['error'](_0xb765('0x46'),_0x3c9ace);throw _0x3c9ace;});}return _0xcbcf4e;})[_0xb765('0x20')](respondWithResult(_0x2540fc,0xc9))[_0xb765('0x3d')](handleError(_0x2540fc,null));};exports[_0xb765('0x1e')]=function(_0x334e43,_0x18a941){if(_0x334e43[_0xb765('0x3f')]['id']){delete _0x334e43['body']['id'];}return db[_0xb765('0x38')][_0xb765('0x3c')]({'where':{'id':_0x334e43['params']['id']}})['then'](handleEntityNotFound(_0x18a941,null))[_0xb765('0x20')](saveUpdates(_0x334e43[_0xb765('0x3f')],null))[_0xb765('0x20')](respondWithResult(_0x18a941,null))[_0xb765('0x3d')](handleError(_0x18a941,null));};exports[_0xb765('0x1f')]=function(_0x78c01c,_0x4ae2ba){return db['VoiceChanSpy']['find']({'where':{'id':_0x78c01c[_0xb765('0x47')]['id']}})[_0xb765('0x20')](handleEntityNotFound(_0x4ae2ba,null))['then'](removeEntity(_0x4ae2ba,null))[_0xb765('0x3d')](handleError(_0x4ae2ba,null));}; \ No newline at end of file +var _0x2116=['includeAll','include','findAll','catch','show','keys','fields','options','find','create','body','user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','get','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VoiceChanSpy'];(function(_0x38c6ca,_0x27152b){var _0x361e63=function(_0x216df1){while(--_0x216df1){_0x38c6ca['push'](_0x38c6ca['shift']());}};_0x361e63(++_0x27152b);}(_0x2116,0x67));var _0x6211=function(_0x368e3c,_0x2c226e){_0x368e3c=_0x368e3c-0x0;var _0x1950d5=_0x2116[_0x368e3c];return _0x1950d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6211('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6211('0x1'));var rp=require(_0x6211('0x2'));var moment=require(_0x6211('0x3'));var BPromise=require(_0x6211('0x4'));var Mustache=require('mustache');var util=require(_0x6211('0x5'));var path=require(_0x6211('0x6'));var sox=require(_0x6211('0x7'));var csv=require(_0x6211('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6211('0x9'));var _=require('lodash');var squel=require(_0x6211('0xa'));var crypto=require(_0x6211('0xb'));var jsforce=require(_0x6211('0xc'));var deskjs=require(_0x6211('0xd'));var toCsv=require(_0x6211('0x8'));var querystring=require(_0x6211('0xe'));var Papa=require(_0x6211('0xf'));var Redis=require('ioredis');var authService=require(_0x6211('0x10'));var qs=require(_0x6211('0x11'));var as=require(_0x6211('0x12'));var hardwareService=require(_0x6211('0x13'));var logger=require(_0x6211('0x14'))(_0x6211('0x15'));var utils=require(_0x6211('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6211('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x337362,_0x6661a7){_0x6661a7=_0x6661a7||0xcc;return function(_0x22963d){if(_0x22963d){return _0x337362['sendStatus'](_0x6661a7);}return _0x337362[_0x6211('0x18')](_0x6661a7)[_0x6211('0x19')]();};}function respondWithResult(_0x1a27a2,_0x509faa){_0x509faa=_0x509faa||0xc8;return function(_0x54a303){if(_0x54a303){return _0x1a27a2[_0x6211('0x18')](_0x509faa)[_0x6211('0x1a')](_0x54a303);}};}function respondWithFilteredResult(_0x23f8d2,_0xf69c79){return function(_0xa23863){if(_0xa23863){var _0x15adb6=typeof _0xf69c79[_0x6211('0x1b')]===_0x6211('0x1c')&&typeof _0xf69c79['limit']===_0x6211('0x1c');var _0x432c18=_0xa23863[_0x6211('0x1d')];var _0x2ccbb0=_0x15adb6?0x0:_0xf69c79[_0x6211('0x1b')];var _0x14c051=_0x15adb6?_0xa23863[_0x6211('0x1d')]:_0xf69c79['offset']+_0xf69c79[_0x6211('0x1e')];var _0x1528e6;if(_0x14c051>=_0x432c18){_0x14c051=_0x432c18;_0x1528e6=0xc8;}else{_0x1528e6=0xce;}_0x23f8d2['status'](_0x1528e6);return _0x23f8d2[_0x6211('0x1f')](_0x6211('0x20'),_0x2ccbb0+'-'+_0x14c051+'/'+_0x432c18)[_0x6211('0x1a')](_0xa23863);}return null;};}function patchUpdates(_0x30d6a5){return function(_0x4d99bc){try{jsonpatch['apply'](_0x4d99bc,_0x30d6a5,!![]);}catch(_0x4252d3){return BPromise[_0x6211('0x21')](_0x4252d3);}return _0x4d99bc['save']();};}function saveUpdates(_0x52eb53,_0x15ca00){return function(_0x1e6a53){if(_0x1e6a53){return _0x1e6a53[_0x6211('0x22')](_0x52eb53)[_0x6211('0x23')](function(_0x5b50cd){return _0x5b50cd;});}return null;};}function removeEntity(_0x2c1c0a,_0x311054){return function(_0x16fb0c){if(_0x16fb0c){return _0x16fb0c['destroy']()[_0x6211('0x23')](function(){var _0x279069=_0x16fb0c[_0x6211('0x24')]({'plain':!![]});var _0x4a13f8='ChanSpies';return db['UserProfileResource']['destroy']({'where':{'type':_0x4a13f8,'resourceId':_0x279069['id']}})['then'](function(){return _0x16fb0c;});})[_0x6211('0x23')](function(){_0x2c1c0a[_0x6211('0x18')](0xcc)[_0x6211('0x19')]();});}};}function handleEntityNotFound(_0x2d6265,_0x3049c7){return function(_0x301b3d){if(!_0x301b3d){_0x2d6265[_0x6211('0x25')](0x194);}return _0x301b3d;};}function handleError(_0x42fca1,_0x148740){_0x148740=_0x148740||0x1f4;return function(_0x19a369){logger[_0x6211('0x26')](_0x19a369[_0x6211('0x27')]);if(_0x19a369[_0x6211('0x28')]){delete _0x19a369[_0x6211('0x28')];}_0x42fca1[_0x6211('0x18')](_0x148740)[_0x6211('0x29')](_0x19a369);};}exports[_0x6211('0x2a')]=function(_0x55fe29,_0x276a30){var _0x44404a={},_0x18553c={},_0x4cd58b={'count':0x0,'rows':[]};var _0x54ad08=_[_0x6211('0x2b')](db['VoiceChanSpy'][_0x6211('0x2c')],function(_0x253bb3){return{'name':_0x253bb3[_0x6211('0x2d')],'type':_0x253bb3['type'][_0x6211('0x2e')]};});_0x18553c[_0x6211('0x2f')]=_[_0x6211('0x2b')](_0x54ad08,_0x6211('0x28'));_0x18553c[_0x6211('0x30')]=_['keys'](_0x55fe29['query']);_0x18553c[_0x6211('0x31')]=_['intersection'](_0x18553c['model'],_0x18553c['query']);_0x44404a[_0x6211('0x32')]=_[_0x6211('0x33')](_0x18553c[_0x6211('0x2f')],qs['fields'](_0x55fe29[_0x6211('0x30')]['fields']));_0x44404a[_0x6211('0x32')]=_0x44404a[_0x6211('0x32')][_0x6211('0x34')]?_0x44404a['attributes']:_0x18553c[_0x6211('0x2f')];if(!_0x55fe29[_0x6211('0x30')][_0x6211('0x35')](_0x6211('0x36'))){_0x44404a[_0x6211('0x1e')]=qs[_0x6211('0x1e')](_0x55fe29[_0x6211('0x30')][_0x6211('0x1e')]);_0x44404a['offset']=qs[_0x6211('0x1b')](_0x55fe29[_0x6211('0x30')][_0x6211('0x1b')]);}_0x44404a[_0x6211('0x37')]=qs[_0x6211('0x38')](_0x55fe29['query'][_0x6211('0x38')]);_0x44404a[_0x6211('0x39')]=qs[_0x6211('0x31')](_[_0x6211('0x3a')](_0x55fe29['query'],_0x18553c[_0x6211('0x31')]),_0x54ad08);if(_0x55fe29[_0x6211('0x30')][_0x6211('0x3b')]){_0x44404a[_0x6211('0x39')]=_[_0x6211('0x3c')](_0x44404a[_0x6211('0x39')],{'$or':_[_0x6211('0x2b')](_0x54ad08,function(_0x4fb7e8){if(_0x4fb7e8[_0x6211('0x3d')]!=='VIRTUAL'){var _0x5013f0={};_0x5013f0[_0x4fb7e8[_0x6211('0x28')]]={'$like':'%'+_0x55fe29['query'][_0x6211('0x3b')]+'%'};return _0x5013f0;}})});}_0x44404a=_[_0x6211('0x3c')]({},_0x44404a,_0x55fe29['options']);var _0x4e8ba8={'where':_0x44404a['where']};return db[_0x6211('0x3e')][_0x6211('0x1d')](_0x4e8ba8)[_0x6211('0x23')](function(_0x5972d4){_0x4cd58b[_0x6211('0x1d')]=_0x5972d4;if(_0x55fe29[_0x6211('0x30')][_0x6211('0x3f')]){_0x44404a[_0x6211('0x40')]=[{'all':!![]}];}return db[_0x6211('0x3e')][_0x6211('0x41')](_0x44404a);})[_0x6211('0x23')](function(_0x371956){_0x4cd58b['rows']=_0x371956;return _0x4cd58b;})['then'](respondWithFilteredResult(_0x276a30,_0x44404a))[_0x6211('0x42')](handleError(_0x276a30,null));};exports[_0x6211('0x43')]=function(_0x2400f1,_0x455d90){var _0x16db53={'raw':![],'where':{'id':_0x2400f1['params']['id']}},_0x2c7ffb={};_0x2c7ffb[_0x6211('0x2f')]=_[_0x6211('0x44')](db[_0x6211('0x3e')][_0x6211('0x2c')]);_0x2c7ffb[_0x6211('0x30')]=_['keys'](_0x2400f1[_0x6211('0x30')]);_0x2c7ffb['filters']=_[_0x6211('0x33')](_0x2c7ffb['model'],_0x2c7ffb[_0x6211('0x30')]);_0x16db53[_0x6211('0x32')]=_['intersection'](_0x2c7ffb[_0x6211('0x2f')],qs[_0x6211('0x45')](_0x2400f1[_0x6211('0x30')]['fields']));_0x16db53[_0x6211('0x32')]=_0x16db53['attributes'][_0x6211('0x34')]?_0x16db53['attributes']:_0x2c7ffb[_0x6211('0x2f')];if(_0x2400f1['query'][_0x6211('0x3f')]){_0x16db53[_0x6211('0x40')]=[{'all':!![]}];}_0x16db53=_[_0x6211('0x3c')]({},_0x16db53,_0x2400f1[_0x6211('0x46')]);return db[_0x6211('0x3e')][_0x6211('0x47')](_0x16db53)[_0x6211('0x23')](handleEntityNotFound(_0x455d90,null))[_0x6211('0x23')](respondWithResult(_0x455d90,null))[_0x6211('0x42')](handleError(_0x455d90,null));};exports[_0x6211('0x48')]=function(_0x501c6d,_0x2bc4ae){return db[_0x6211('0x3e')][_0x6211('0x48')](_0x501c6d[_0x6211('0x49')],{})['then'](function(_0x27c5a9){var _0xee45fb=_0x501c6d['user'][_0x6211('0x24')]({'plain':!![]});if(!_0xee45fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xee45fb['role']===_0x6211('0x4a')){var _0x25d2c8=_0x27c5a9['get']({'plain':!![]});var _0xa0485a=_0x6211('0x4b');return db[_0x6211('0x4c')][_0x6211('0x47')]({'where':{'name':_0xa0485a,'userProfileId':_0xee45fb[_0x6211('0x4d')]},'raw':!![]})['then'](function(_0x92aa60){if(_0x92aa60&&_0x92aa60[_0x6211('0x4e')]===0x0){return db[_0x6211('0x4f')]['create']({'name':_0x25d2c8[_0x6211('0x28')],'resourceId':_0x25d2c8['id'],'type':_0x92aa60['name'],'sectionId':_0x92aa60['id']},{})[_0x6211('0x23')](function(){return _0x27c5a9;});}else{return _0x27c5a9;}})[_0x6211('0x42')](function(_0x4b1d8e){logger[_0x6211('0x26')](_0x6211('0x50'),_0x4b1d8e);throw _0x4b1d8e;});}return _0x27c5a9;})['then'](respondWithResult(_0x2bc4ae,0xc9))[_0x6211('0x42')](handleError(_0x2bc4ae,null));};exports[_0x6211('0x22')]=function(_0x41c86a,_0x39536a){if(_0x41c86a['body']['id']){delete _0x41c86a[_0x6211('0x49')]['id'];}return db[_0x6211('0x3e')][_0x6211('0x47')]({'where':{'id':_0x41c86a[_0x6211('0x51')]['id']}})[_0x6211('0x23')](handleEntityNotFound(_0x39536a,null))[_0x6211('0x23')](saveUpdates(_0x41c86a[_0x6211('0x49')],null))[_0x6211('0x23')](respondWithResult(_0x39536a,null))['catch'](handleError(_0x39536a,null));};exports[_0x6211('0x52')]=function(_0x32e539,_0x48ea42){return db['VoiceChanSpy'][_0x6211('0x47')]({'where':{'id':_0x32e539[_0x6211('0x51')]['id']}})[_0x6211('0x23')](handleEntityNotFound(_0x48ea42,null))['then'](removeEntity(_0x48ea42,null))[_0x6211('0x42')](handleError(_0x48ea42,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 9019155..58cfa6e 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 _0x9747=['length','concat','internal','User','findAll','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','format','chanspy','push','merge','MixMonitor','recordingFormat','auth','Authenticate','SIP/%s,%s','name','options','join','record'];(function(_0x184a95,_0x500731){var _0x55eadf=function(_0x49fcd7){while(--_0x49fcd7){_0x184a95['push'](_0x184a95['shift']());}};_0x55eadf(++_0x500731);}(_0x9747,0xe1));var _0x7974=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9747[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7974('0x0'));var util=require(_0x7974('0x1'));var BPromise=require(_0x7974('0x2'));var attributes=require(_0x7974('0x3'));var getUserApplications=function(_0x2934a3,_0x5c0ae5,_0x1651e5){var _0x40bf93=0x1;var _0x27705d=[];var _0x31083c={'context':_0x5c0ae5['context']||_0x7974('0x4'),'exten':util['format'](_0x7974('0x5'),_0x2934a3[_0x7974('0x6')],_0x1651e5),'type':'system','isApp':![],'ChanSpyId':_0x2934a3['id'],'UserId':_0x5c0ae5['id']};_0x27705d['push'](_['merge']({'app':'Set','appdata':util[_0x7974('0x7')]('CDR(type)=%s',_0x7974('0x8')),'priority':_0x40bf93++},_0x31083c));if(_0x2934a3['record']){_0x27705d[_0x7974('0x9')](_[_0x7974('0xa')]({'app':_0x7974('0xb'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x2934a3[_0x7974('0xc')]),'priority':_0x40bf93++},_0x31083c));}if(_0x2934a3[_0x7974('0xd')]){_0x27705d[_0x7974('0x9')](_[_0x7974('0xa')]({'app':_0x7974('0xe'),'appdata':_0x2934a3['password'],'priority':_0x40bf93++},_0x31083c));}_0x27705d[_0x7974('0x9')](_[_0x7974('0xa')]({'app':'ChanSpy','appdata':util[_0x7974('0x7')](_0x7974('0xf'),_0x5c0ae5[_0x7974('0x10')],_0x2934a3[_0x7974('0x11')]?_0x2934a3['options'][_0x7974('0x12')](''):''),'priority':_0x40bf93++},_0x31083c));if(_0x2934a3[_0x7974('0x13')]){_0x27705d['push'](_[_0x7974('0xa')]({'app':'StopMixMonitor','priority':_0x40bf93++},_0x31083c));}return _0x27705d;};var getChanSpyApplications=function(_0x49df04,_0x34e68f){var _0x4ed3de=[];for(var _0x19c4a4=0x0,_0x18fcc8=0x1;_0x19c4a4<_0x34e68f[_0x7974('0x14')];_0x19c4a4++,_0x18fcc8=0x1){_0x4ed3de=_0x4ed3de[_0x7974('0x15')](getUserApplications(_0x49df04,_0x34e68f[_0x19c4a4],_0x34e68f[_0x19c4a4][_0x7974('0x16')]));if(_0x34e68f[_0x19c4a4][_0x7974('0x16')]!=_0x34e68f[_0x19c4a4]['name']){_0x4ed3de=_0x4ed3de[_0x7974('0x15')](getUserApplications(_0x49df04,_0x34e68f[_0x19c4a4],_0x34e68f[_0x19c4a4][_0x7974('0x10')]));}}return _0x4ed3de;};var getChanSpyPromise=function(_0x431e59,_0x232aac){return new BPromise(function(_0x256786,_0x4cf764){return _0x431e59[_0x7974('0x17')][_0x7974('0x18')]({'attributes':['id',_0x7974('0x10'),_0x7974('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x7974('0x19')](function(_0x144b01){if(_0x144b01){return _0x256786(getChanSpyApplications(_0x232aac,_0x144b01));}return _0x256786([]);})[_0x7974('0x1a')](function(_0x285c62){_0x4cf764(_0x285c62);});});};module[_0x7974('0x1b')]=function(_0x2efe47,_0x393bd2){var _0x26ae74=_0x2efe47[_0x7974('0x1c')];return _0x2efe47[_0x7974('0x1d')](_0x7974('0x1e'),attributes,{'tableName':_0x7974('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x14abaf,_0x51d981,_0x190f29){return getChanSpyPromise(_0x26ae74,_0x14abaf)[_0x7974('0x19')](function(_0x3b7af4){if(_0x3b7af4&&_0x3b7af4[_0x7974('0x14')]){return _0x26ae74[_0x7974('0x20')][_0x7974('0x21')](_0x3b7af4);}})[_0x7974('0x19')](function(){_0x190f29();})[_0x7974('0x1a')](function(_0x1f6860){_0x190f29(_0x1f6860);});},'afterUpdate':function(_0x94da2,_0x16fce9,_0x5456be){return _0x26ae74[_0x7974('0x20')][_0x7974('0x22')]({'where':{'ChanSpyId':_0x94da2['id']}})['then'](function(){return getChanSpyPromise(_0x26ae74,_0x94da2);})['then'](function(_0x521a5d){if(_0x521a5d&&_0x521a5d[_0x7974('0x14')]){return _0x26ae74['VoiceExtension'][_0x7974('0x21')](_0x521a5d);}})[_0x7974('0x19')](function(){_0x5456be();})['catch'](function(_0x5a08e5){_0x5456be(_0x5a08e5);});},'afterDestroy':function(_0x12ecfa,_0x647451,_0x506e32){return _0x26ae74[_0x7974('0x20')]['destroy']({'where':{'ChanSpyId':_0x12ecfa['id']}})[_0x7974('0x19')](function(){_0x506e32();})[_0x7974('0x1a')](function(_0x216679){_0x506e32(_0x216679);});}}});}; \ No newline at end of file +var _0x25a1=['options','join','StopMixMonitor','length','internal','name','concat','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy'];(function(_0xfbd396,_0x8eb96b){var _0x3b8490=function(_0x58180a){while(--_0x58180a){_0xfbd396['push'](_0xfbd396['shift']());}};_0x3b8490(++_0x8eb96b);}(_0x25a1,0x1da));var _0x125a=function(_0x4f595a,_0x122192){_0x4f595a=_0x4f595a-0x0;var _0x13d60c=_0x25a1[_0x4f595a];return _0x13d60c;};'use strict';var _=require(_0x125a('0x0'));var util=require('util');var BPromise=require(_0x125a('0x1'));var attributes=require(_0x125a('0x2'));var getUserApplications=function(_0x40e787,_0x1b6ec9,_0x1f8000){var _0x567af6=0x1;var _0xdf41ed=[];var _0x57218f={'context':_0x1b6ec9['context']||_0x125a('0x3'),'exten':util['format'](_0x125a('0x4'),_0x40e787[_0x125a('0x5')],_0x1f8000),'type':_0x125a('0x6'),'isApp':![],'ChanSpyId':_0x40e787['id'],'UserId':_0x1b6ec9['id']};_0xdf41ed[_0x125a('0x7')](_[_0x125a('0x8')]({'app':_0x125a('0x9'),'appdata':util[_0x125a('0xa')](_0x125a('0xb'),_0x125a('0xc')),'priority':_0x567af6++},_0x57218f));if(_0x40e787[_0x125a('0xd')]){_0xdf41ed[_0x125a('0x7')](_[_0x125a('0x8')]({'app':_0x125a('0xe'),'appdata':util[_0x125a('0xa')]('${UNIQUEID}.%s,a',_0x40e787[_0x125a('0xf')]),'priority':_0x567af6++},_0x57218f));}if(_0x40e787[_0x125a('0x10')]){_0xdf41ed['push'](_[_0x125a('0x8')]({'app':_0x125a('0x11'),'appdata':_0x40e787[_0x125a('0x12')],'priority':_0x567af6++},_0x57218f));}_0xdf41ed[_0x125a('0x7')](_[_0x125a('0x8')]({'app':_0x125a('0x13'),'appdata':util['format']('SIP/%s,%s',_0x1b6ec9['name'],_0x40e787[_0x125a('0x14')]?_0x40e787[_0x125a('0x14')][_0x125a('0x15')](''):''),'priority':_0x567af6++},_0x57218f));if(_0x40e787['record']){_0xdf41ed['push'](_['merge']({'app':_0x125a('0x16'),'priority':_0x567af6++},_0x57218f));}return _0xdf41ed;};var getChanSpyApplications=function(_0x21b93b,_0x33e817){var _0x4246d5=[];for(var _0x488fcb=0x0,_0x5b0c80=0x1;_0x488fcb<_0x33e817[_0x125a('0x17')];_0x488fcb++,_0x5b0c80=0x1){_0x4246d5=_0x4246d5['concat'](getUserApplications(_0x21b93b,_0x33e817[_0x488fcb],_0x33e817[_0x488fcb][_0x125a('0x18')]));if(_0x33e817[_0x488fcb][_0x125a('0x18')]!=_0x33e817[_0x488fcb][_0x125a('0x19')]){_0x4246d5=_0x4246d5[_0x125a('0x1a')](getUserApplications(_0x21b93b,_0x33e817[_0x488fcb],_0x33e817[_0x488fcb][_0x125a('0x19')]));}}return _0x4246d5;};var getChanSpyPromise=function(_0x3d9042,_0x1583cd){return new BPromise(function(_0x1b72cc,_0x144563){return _0x3d9042['User'][_0x125a('0x1b')]({'attributes':['id',_0x125a('0x19'),_0x125a('0x18')],'where':{'role':_0x125a('0x1c'),'chanspy':!![]},'raw':!![]})[_0x125a('0x1d')](function(_0x38b07b){if(_0x38b07b){return _0x1b72cc(getChanSpyApplications(_0x1583cd,_0x38b07b));}return _0x1b72cc([]);})[_0x125a('0x1e')](function(_0x1bebf5){_0x144563(_0x1bebf5);});});};module['exports']=function(_0x419c70,_0x3efbce){var _0xe72534=_0x419c70[_0x125a('0x1f')];return _0x419c70[_0x125a('0x20')](_0x125a('0x21'),attributes,{'tableName':_0x125a('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xfcd8c6,_0x58e9dd,_0x5a18ce){return getChanSpyPromise(_0xe72534,_0xfcd8c6)['then'](function(_0x50fff2){if(_0x50fff2&&_0x50fff2['length']){return _0xe72534['VoiceExtension']['bulkCreate'](_0x50fff2);}})['then'](function(){_0x5a18ce();})[_0x125a('0x1e')](function(_0x5ae376){_0x5a18ce(_0x5ae376);});},'afterUpdate':function(_0x1feecd,_0x10bafd,_0x3a3595){return _0xe72534[_0x125a('0x23')][_0x125a('0x24')]({'where':{'ChanSpyId':_0x1feecd['id']}})[_0x125a('0x1d')](function(){return getChanSpyPromise(_0xe72534,_0x1feecd);})[_0x125a('0x1d')](function(_0x4cc2b2){if(_0x4cc2b2&&_0x4cc2b2['length']){return _0xe72534[_0x125a('0x23')][_0x125a('0x25')](_0x4cc2b2);}})[_0x125a('0x1d')](function(){_0x3a3595();})[_0x125a('0x1e')](function(_0x32fb2a){_0x3a3595(_0x32fb2a);});},'afterDestroy':function(_0x85e3d7,_0x2b5baa,_0xecdeb7){return _0xe72534['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x85e3d7['id']}})[_0x125a('0x1d')](function(){_0xecdeb7();})[_0x125a('0x1e')](function(_0x2d2726){_0xecdeb7(_0x2d2726);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 651c85e..7dedaed 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 _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x351a11,_0x3da2cc){var _0x15a37f=function(_0x54badc){while(--_0x54badc){_0x351a11['push'](_0x351a11['shift']());}};_0x15a37f(++_0x3da2cc);}(_0x0bb5,0x148));var _0x50bb=function(_0x22a08c,_0x3f1f36){_0x22a08c=_0x22a08c-0x0;var _0x1b38f7=_0x0bb5[_0x22a08c];return _0x1b38f7;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file +var _0x0647=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x140ef8,_0x4a9e12){var _0x296f58=function(_0x443494){while(--_0x443494){_0x140ef8['push'](_0x140ef8['shift']());}};_0x296f58(++_0x4a9e12);}(_0x0647,0xd0));var _0x7064=function(_0x145b3c,_0x31ea4a){_0x145b3c=_0x145b3c-0x0;var _0x1b6e36=_0x0647[_0x145b3c];return _0x1b6e36;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var moment=require(_0x7064('0x1'));var BPromise=require(_0x7064('0x2'));var rs=require(_0x7064('0x3'));var fs=require('fs');var Redis=require(_0x7064('0x4'));var db=require(_0x7064('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7064('0x6'));var config=require(_0x7064('0x7'));var jayson=require(_0x7064('0x8'));var client=jayson[_0x7064('0x9')][_0x7064('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1101e4,_0x58186b,_0x536336){return new BPromise(function(_0x1c85b1,_0x39b7e3){return client[_0x7064('0xb')](_0x1101e4,_0x536336)['then'](function(_0x38c195){logger[_0x7064('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x58186b,_0x7064('0xd'));logger[_0x7064('0xe')](_0x7064('0xf'),_0x58186b,'request\x20sent',JSON[_0x7064('0x10')](_0x38c195));if(_0x38c195[_0x7064('0x11')]){if(_0x38c195[_0x7064('0x11')][_0x7064('0x12')]===0x1f4){logger['error'](_0x7064('0x13'),_0x58186b,_0x38c195[_0x7064('0x11')][_0x7064('0x14')]);return _0x39b7e3(_0x38c195[_0x7064('0x11')][_0x7064('0x14')]);}logger[_0x7064('0x11')](_0x7064('0x13'),_0x58186b,_0x38c195[_0x7064('0x11')]['message']);return _0x1c85b1(_0x38c195['error']['message']);}else{logger[_0x7064('0xc')](_0x7064('0x13'),_0x58186b,_0x7064('0xd'));_0x1c85b1(_0x38c195['result'][_0x7064('0x14')]);}})[_0x7064('0x15')](function(_0x5bb1cc){logger[_0x7064('0x11')](_0x7064('0x13'),_0x58186b,_0x5bb1cc);_0x39b7e3(_0x5bb1cc);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index daefab1..da07225 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 _0xa762=['./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3f1b48,_0x14bb7d){var _0x401579=function(_0x3a2be8){while(--_0x3a2be8){_0x3f1b48['push'](_0x3f1b48['shift']());}};_0x401579(++_0x14bb7d);}(_0xa762,0x187));var _0x2a76=function(_0x366765,_0x32f4cf){_0x366765=_0x366765-0x0;var _0x3f22da=_0xa762[_0x366765];return _0x3f22da;};'use strict';var multer=require(_0x2a76('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a76('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x2a76('0x2'));var interaction=require(_0x2a76('0x3'));var config=require(_0x2a76('0x4'));var controller=require(_0x2a76('0x5'));router[_0x2a76('0x6')]('/',auth[_0x2a76('0x7')](),controller[_0x2a76('0x8')]);router[_0x2a76('0x6')](_0x2a76('0x9'),auth[_0x2a76('0x7')](),controller[_0x2a76('0xa')]);router[_0x2a76('0xb')]('/',auth[_0x2a76('0x7')](),controller[_0x2a76('0xc')]);router[_0x2a76('0xd')](_0x2a76('0x9'),auth[_0x2a76('0x7')](),controller[_0x2a76('0xe')]);router[_0x2a76('0xf')](_0x2a76('0x9'),auth[_0x2a76('0x7')](),controller[_0x2a76('0x10')]);module[_0x2a76('0x11')]=router; \ No newline at end of file +var _0xbc0c=['get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x3536d0,_0x403160){var _0xa8b664=function(_0x4d7afe){while(--_0x4d7afe){_0x3536d0['push'](_0x3536d0['shift']());}};_0xa8b664(++_0x403160);}(_0xbc0c,0x171));var _0xcbc0=function(_0x28a653,_0xcd7f78){_0x28a653=_0x28a653-0x0;var _0x980e01=_0xbc0c[_0x28a653];return _0x980e01;};'use strict';var multer=require(_0xcbc0('0x0'));var util=require(_0xcbc0('0x1'));var path=require(_0xcbc0('0x2'));var timeout=require(_0xcbc0('0x3'));var express=require(_0xcbc0('0x4'));var router=express[_0xcbc0('0x5')]();var fs_extra=require(_0xcbc0('0x6'));var auth=require(_0xcbc0('0x7'));var interaction=require(_0xcbc0('0x8'));var config=require(_0xcbc0('0x9'));var controller=require(_0xcbc0('0xa'));router[_0xcbc0('0xb')]('/',auth[_0xcbc0('0xc')](),controller[_0xcbc0('0xd')]);router[_0xcbc0('0xb')](_0xcbc0('0xe'),auth[_0xcbc0('0xc')](),controller[_0xcbc0('0xf')]);router[_0xcbc0('0x10')]('/',auth[_0xcbc0('0xc')](),controller[_0xcbc0('0x11')]);router[_0xcbc0('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xcbc0('0xe'),auth[_0xcbc0('0xc')](),controller['destroy']);module[_0xcbc0('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index aebf412..52babbf 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 _0xfa2b=['STRING','name','BOOLEAN','sequelize','exports'];(function(_0x25f582,_0x3407f9){var _0x2cee54=function(_0x138290){while(--_0x138290){_0x25f582['push'](_0x25f582['shift']());}};_0x2cee54(++_0x3407f9);}(_0xfa2b,0xd5));var _0xbfa2=function(_0x128ac3,_0x17f72f){_0x128ac3=_0x128ac3-0x0;var _0x5bfc01=_0xfa2b[_0x128ac3];return _0x5bfc01;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'name':{'type':Sequelize[_0xbfa2('0x2')],'unique':_0xbfa2('0x3')},'description':{'type':Sequelize[_0xbfa2('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbfa2('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa403=['name','sequelize'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xa403,0xe1));var _0x3a40=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xa403[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x3a40('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3a40('0x1')},'description':{'type':Sequelize['STRING'],'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 cf9d7e9..fd164d6 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 _0x2304=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','sendStatus','stack','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','order','where','filters','filter','merge','VIRTUAL','name','includeAll','include','rows','show','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','findAll','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x199aa8,_0x55993b){var _0x5ea49a=function(_0x9751c0){while(--_0x9751c0){_0x199aa8['push'](_0x199aa8['shift']());}};_0x5ea49a(++_0x55993b);}(_0x2304,0xb5));var _0x4230=function(_0x4c058d,_0x28a146){_0x4c058d=_0x4c058d-0x0;var _0x49ccea=_0x2304[_0x4c058d];return _0x49ccea;};'use strict';var emlformat=require(_0x4230('0x0'));var rimraf=require(_0x4230('0x1'));var zipdir=require(_0x4230('0x2'));var jsonpatch=require(_0x4230('0x3'));var rp=require(_0x4230('0x4'));var moment=require(_0x4230('0x5'));var BPromise=require(_0x4230('0x6'));var Mustache=require(_0x4230('0x7'));var util=require(_0x4230('0x8'));var path=require(_0x4230('0x9'));var sox=require(_0x4230('0xa'));var csv=require(_0x4230('0xb'));var ejs=require(_0x4230('0xc'));var fs=require('fs');var fs_extra=require(_0x4230('0xd'));var _=require(_0x4230('0xe'));var squel=require(_0x4230('0xf'));var crypto=require(_0x4230('0x10'));var jsforce=require(_0x4230('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x4230('0xb'));var querystring=require(_0x4230('0x12'));var Papa=require('papaparse');var Redis=require(_0x4230('0x13'));var authService=require(_0x4230('0x14'));var qs=require(_0x4230('0x15'));var as=require(_0x4230('0x16'));var hardwareService=require(_0x4230('0x17'));var logger=require(_0x4230('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4230('0x19'));var db=require(_0x4230('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4230('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b366,_0x3f6870,_0x1dda50,_0x51c854){return new BPromise(function(_0x345571,_0x5a3dc7){var _0x1ad8d8=_0x51c854||client;return _0x1ad8d8['request'](_0x10b366,_0x1dda50)[_0x4230('0x1c')](function(_0x394330){logger[_0x4230('0x1d')](_0x4230('0x1e'),_0x3f6870,_0x4230('0x1f'));logger['debug'](_0x4230('0x20'),_0x3f6870,_0x4230('0x1f'),JSON[_0x4230('0x21')](_0x394330));if(_0x394330[_0x4230('0x22')]){if(_0x394330['error']['code']===0x1f4){logger[_0x4230('0x22')](_0x4230('0x1e'),_0x3f6870,_0x394330[_0x4230('0x22')][_0x4230('0x23')]);return _0x5a3dc7(_0x394330['error'][_0x4230('0x23')]);}logger[_0x4230('0x22')]('VoiceContext,\x20%s,\x20%s',_0x3f6870,_0x394330[_0x4230('0x22')][_0x4230('0x23')]);return _0x345571(_0x394330[_0x4230('0x22')][_0x4230('0x23')]);}else{logger['info'](_0x4230('0x1e'),_0x3f6870,_0x4230('0x1f'));_0x345571(_0x394330[_0x4230('0x24')][_0x4230('0x23')]);}})['catch'](function(_0x5dbc36){logger[_0x4230('0x22')](_0x4230('0x1e'),_0x3f6870,_0x5dbc36);_0x5a3dc7(_0x5dbc36);});});}function respondWithStatusCode(_0x7a408d,_0x2b94ec){_0x2b94ec=_0x2b94ec||0xcc;return function(_0x45bf5f){if(_0x45bf5f){return _0x7a408d['sendStatus'](_0x2b94ec);}return _0x7a408d['status'](_0x2b94ec)[_0x4230('0x25')]();};}function respondWithResult(_0x39df63,_0x221f3d){_0x221f3d=_0x221f3d||0xc8;return function(_0x1bc041){if(_0x1bc041){return _0x39df63[_0x4230('0x26')](_0x221f3d)[_0x4230('0x27')](_0x1bc041);}};}function respondWithFilteredResult(_0x553d02,_0x3fc993){return function(_0xfa487e){if(_0xfa487e){var _0x1d7cd8=typeof _0x3fc993[_0x4230('0x28')]==='undefined'&&typeof _0x3fc993[_0x4230('0x29')]===_0x4230('0x2a');var _0x3cec3e=_0xfa487e[_0x4230('0x2b')];var _0x485e14=_0x1d7cd8?0x0:_0x3fc993['offset'];var _0x56f33f=_0x1d7cd8?_0xfa487e[_0x4230('0x2b')]:_0x3fc993[_0x4230('0x28')]+_0x3fc993['limit'];var _0x256bb0;if(_0x56f33f>=_0x3cec3e){_0x56f33f=_0x3cec3e;_0x256bb0=0xc8;}else{_0x256bb0=0xce;}_0x553d02[_0x4230('0x26')](_0x256bb0);return _0x553d02['set'](_0x4230('0x2c'),_0x485e14+'-'+_0x56f33f+'/'+_0x3cec3e)[_0x4230('0x27')](_0xfa487e);}return null;};}function patchUpdates(_0x503ae3){return function(_0x23d300){try{jsonpatch[_0x4230('0x2d')](_0x23d300,_0x503ae3,!![]);}catch(_0x2d0d69){return BPromise[_0x4230('0x2e')](_0x2d0d69);}return _0x23d300[_0x4230('0x2f')]();};}function saveUpdates(_0x3cc9fa,_0x2a69fc){return function(_0x13b6b3){if(_0x13b6b3){return _0x13b6b3[_0x4230('0x30')](_0x3cc9fa)[_0x4230('0x1c')](function(_0x4cc570){return _0x4cc570;});}return null;};}function removeEntity(_0x4ef0f5,_0x197164){return function(_0x2a3d76){if(_0x2a3d76){return _0x2a3d76[_0x4230('0x31')]()[_0x4230('0x1c')](function(){var _0x273aba=_0x2a3d76[_0x4230('0x32')]({'plain':!![]});var _0x5b68cd=_0x4230('0x33');return db[_0x4230('0x34')][_0x4230('0x31')]({'where':{'type':_0x5b68cd,'resourceId':_0x273aba['id']}})[_0x4230('0x1c')](function(){return _0x2a3d76;});})['then'](function(){_0x4ef0f5[_0x4230('0x26')](0xcc)[_0x4230('0x25')]();});}};}function handleEntityNotFound(_0x2cf36c,_0x7bc12f){return function(_0x18be63){if(!_0x18be63){_0x2cf36c[_0x4230('0x35')](0x194);}return _0x18be63;};}function handleError(_0x225482,_0x5482d2){_0x5482d2=_0x5482d2||0x1f4;return function(_0x409ec4){logger[_0x4230('0x22')](_0x409ec4[_0x4230('0x36')]);if(_0x409ec4['name']){delete _0x409ec4['name'];}_0x225482[_0x4230('0x26')](_0x5482d2)[_0x4230('0x37')](_0x409ec4);};}exports[_0x4230('0x38')]=function(_0x589fb4,_0x35fe5){var _0x2f2f6a={},_0x300d4f={},_0x185633={'count':0x0,'rows':[]};var _0x3e2750=_['map'](db[_0x4230('0x39')][_0x4230('0x3a')],function(_0x451b65){return{'name':_0x451b65[_0x4230('0x3b')],'type':_0x451b65[_0x4230('0x3c')][_0x4230('0x3d')]};});_0x300d4f[_0x4230('0x3e')]=_[_0x4230('0x3f')](_0x3e2750,'name');_0x300d4f[_0x4230('0x40')]=_[_0x4230('0x41')](_0x589fb4[_0x4230('0x40')]);_0x300d4f['filters']=_['intersection'](_0x300d4f['model'],_0x300d4f[_0x4230('0x40')]);_0x2f2f6a['attributes']=_[_0x4230('0x42')](_0x300d4f[_0x4230('0x3e')],qs[_0x4230('0x43')](_0x589fb4[_0x4230('0x40')]['fields']));_0x2f2f6a[_0x4230('0x44')]=_0x2f2f6a[_0x4230('0x44')][_0x4230('0x45')]?_0x2f2f6a['attributes']:_0x300d4f[_0x4230('0x3e')];if(!_0x589fb4[_0x4230('0x40')]['hasOwnProperty']('nolimit')){_0x2f2f6a[_0x4230('0x29')]=qs[_0x4230('0x29')](_0x589fb4[_0x4230('0x40')][_0x4230('0x29')]);_0x2f2f6a['offset']=qs[_0x4230('0x28')](_0x589fb4[_0x4230('0x40')]['offset']);}_0x2f2f6a[_0x4230('0x46')]=qs['sort'](_0x589fb4[_0x4230('0x40')]['sort']);_0x2f2f6a[_0x4230('0x47')]=qs[_0x4230('0x48')](_['pick'](_0x589fb4['query'],_0x300d4f[_0x4230('0x48')]),_0x3e2750);if(_0x589fb4[_0x4230('0x40')][_0x4230('0x49')]){_0x2f2f6a[_0x4230('0x47')]=_[_0x4230('0x4a')](_0x2f2f6a[_0x4230('0x47')],{'$or':_[_0x4230('0x3f')](_0x3e2750,function(_0x1e632f){if(_0x1e632f[_0x4230('0x3c')]!==_0x4230('0x4b')){var _0x14a82f={};_0x14a82f[_0x1e632f[_0x4230('0x4c')]]={'$like':'%'+_0x589fb4[_0x4230('0x40')][_0x4230('0x49')]+'%'};return _0x14a82f;}})});}_0x2f2f6a=_['merge']({},_0x2f2f6a,_0x589fb4['options']);var _0x3ff69d={'where':_0x2f2f6a[_0x4230('0x47')]};return db[_0x4230('0x39')][_0x4230('0x2b')](_0x3ff69d)[_0x4230('0x1c')](function(_0x43786c){_0x185633[_0x4230('0x2b')]=_0x43786c;if(_0x589fb4[_0x4230('0x40')][_0x4230('0x4d')]){_0x2f2f6a[_0x4230('0x4e')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x2f2f6a);})[_0x4230('0x1c')](function(_0x587f50){_0x185633[_0x4230('0x4f')]=_0x587f50;return _0x185633;})[_0x4230('0x1c')](respondWithFilteredResult(_0x35fe5,_0x2f2f6a))['catch'](handleError(_0x35fe5,null));};exports[_0x4230('0x50')]=function(_0x47bcae,_0x5abcf9){var _0x373292={'raw':![],'where':{'id':_0x47bcae['params']['id']}},_0x13d68b={};_0x13d68b[_0x4230('0x3e')]=_['keys'](db[_0x4230('0x39')][_0x4230('0x3a')]);_0x13d68b[_0x4230('0x40')]=_[_0x4230('0x41')](_0x47bcae['query']);_0x13d68b['filters']=_['intersection'](_0x13d68b[_0x4230('0x3e')],_0x13d68b['query']);_0x373292[_0x4230('0x44')]=_[_0x4230('0x42')](_0x13d68b[_0x4230('0x3e')],qs[_0x4230('0x43')](_0x47bcae[_0x4230('0x40')]['fields']));_0x373292[_0x4230('0x44')]=_0x373292[_0x4230('0x44')]['length']?_0x373292[_0x4230('0x44')]:_0x13d68b[_0x4230('0x3e')];if(_0x47bcae[_0x4230('0x40')]['includeAll']){_0x373292['include']=[{'all':!![]}];}_0x373292=_[_0x4230('0x4a')]({},_0x373292,_0x47bcae['options']);return db[_0x4230('0x39')][_0x4230('0x51')](_0x373292)[_0x4230('0x1c')](handleEntityNotFound(_0x5abcf9,null))['then'](respondWithResult(_0x5abcf9,null))[_0x4230('0x52')](handleError(_0x5abcf9,null));};exports[_0x4230('0x53')]=function(_0x4c5426,_0x240eae,_0x16cc89){var _0x2475df;return db[_0x4230('0x39')]['create'](_0x4c5426[_0x4230('0x54')],{'raw':!![]})[_0x4230('0x1c')](function(_0x31c622){_0x2475df=_0x31c622;return db[_0x4230('0x39')]['findAll']({'raw':!![]});})[_0x4230('0x1c')](function(_0x364c50){var _0x2a34f3=fs[_0x4230('0x55')](path[_0x4230('0x56')](config[_0x4230('0x57')],_0x4230('0x58')),_0x4230('0x59'));var _0x130b6c=ejs[_0x4230('0x5a')](_0x2a34f3,{'contexts':_0x364c50||[]});fs[_0x4230('0x5b')](_0x4230('0x5c'),_0x130b6c);})[_0x4230('0x1c')](function(){return respondWithRpcPromise(_0x4230('0x5d'),_0x4230('0x53'),{'module':_0x4230('0x5e')});})[_0x4230('0x1c')](function(){var _0x286f6d=_0x4c5426[_0x4230('0x5f')]['get']({'plain':!![]});if(!_0x286f6d)throw new Error(_0x4230('0x60'));if(_0x286f6d[_0x4230('0x61')]===_0x4230('0x5f')){var _0x246e09=_0x2475df[_0x4230('0x32')]({'plain':!![]});return db[_0x4230('0x62')][_0x4230('0x51')]({'where':{'name':_0x4230('0x33'),'userProfileId':_0x286f6d[_0x4230('0x63')]},'raw':!![]})[_0x4230('0x1c')](function(_0x1b9c97){if(_0x1b9c97&&_0x1b9c97['autoAssociation']===0x0){return db[_0x4230('0x34')][_0x4230('0x53')]({'name':_0x246e09[_0x4230('0x4c')],'resourceId':_0x246e09['id'],'type':_0x1b9c97[_0x4230('0x4c')],'sectionId':_0x1b9c97['id']},{})[_0x4230('0x1c')](function(){return _0x2475df;});}else{return _0x2475df;}})[_0x4230('0x52')](function(_0x5f58d8){logger[_0x4230('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f58d8);throw _0x5f58d8;});}return _0x2475df;})['then'](respondWithResult(_0x240eae,0xc9))[_0x4230('0x52')](handleError(_0x240eae,null));};exports[_0x4230('0x30')]=function(_0x249bac,_0x3fba8d,_0x3baf76){var _0x3e5b64;return db[_0x4230('0x39')][_0x4230('0x51')]({'where':{'id':_0x249bac['params']['id']}})[_0x4230('0x1c')](handleEntityNotFound(_0x3fba8d,null))[_0x4230('0x1c')](saveUpdates(_0x249bac[_0x4230('0x54')],null))[_0x4230('0x1c')](function(_0x64d4f){if(_0x64d4f){_0x3e5b64=_0x64d4f;return db['VoiceContext'][_0x4230('0x64')]({'raw':!![]});}})[_0x4230('0x1c')](function(_0x3b0efb){var _0x59e1c6=fs[_0x4230('0x55')](path[_0x4230('0x56')](config['root'],_0x4230('0x58')),_0x4230('0x59'));var _0x46957e=ejs[_0x4230('0x5a')](_0x59e1c6,{'contexts':_0x3b0efb||[]});fs['writeFileSync'](_0x4230('0x5c'),_0x46957e);})[_0x4230('0x1c')](function(){return respondWithRpcPromise('Reload',_0x4230('0x30'),{'module':_0x4230('0x5e')});})[_0x4230('0x1c')](function(){return _0x3e5b64;})[_0x4230('0x1c')](respondWithResult(_0x3fba8d,null))[_0x4230('0x52')](handleError(_0x3fba8d,null));};exports[_0x4230('0x31')]=function(_0x111674,_0x106545,_0x295156){var _0x350f2f;return db['VoiceContext'][_0x4230('0x51')]({'where':{'id':_0x111674[_0x4230('0x65')]['id']}})[_0x4230('0x1c')](handleEntityNotFound(_0x106545,null))[_0x4230('0x1c')](removeEntity(_0x106545,null))[_0x4230('0x1c')](function(){return db[_0x4230('0x39')]['findAll']({'raw':!![]});})[_0x4230('0x1c')](function(_0x5785bb){var _0x28dda1=fs[_0x4230('0x55')](path['join'](config['root'],_0x4230('0x58')),_0x4230('0x59'));var _0x51e98f=ejs[_0x4230('0x5a')](_0x28dda1,{'contexts':_0x5785bb});fs['writeFileSync'](_0x4230('0x5c'),_0x51e98f);return respondWithRpcPromise('Reload',_0x4230('0x31'),{'module':_0x4230('0x5e')});})[_0x4230('0x52')](handleError(_0x106545,null));}; \ No newline at end of file +var _0x638a=['update','body','findAll','writeFileSync','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','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','apply','reject','save','Contexts','UserProfileResource','destroy','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rows','show','includeAll','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x53a34c,_0x25cffd){var _0x3dda74=function(_0x559ccd){while(--_0x559ccd){_0x53a34c['push'](_0x53a34c['shift']());}};_0x3dda74(++_0x25cffd);}(_0x638a,0x6e));var _0xa638=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x638a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa638('0x0'));var rimraf=require(_0xa638('0x1'));var zipdir=require(_0xa638('0x2'));var jsonpatch=require(_0xa638('0x3'));var rp=require('request-promise');var moment=require(_0xa638('0x4'));var BPromise=require(_0xa638('0x5'));var Mustache=require(_0xa638('0x6'));var util=require(_0xa638('0x7'));var path=require(_0xa638('0x8'));var sox=require(_0xa638('0x9'));var csv=require(_0xa638('0xa'));var ejs=require(_0xa638('0xb'));var fs=require('fs');var fs_extra=require(_0xa638('0xc'));var _=require(_0xa638('0xd'));var squel=require(_0xa638('0xe'));var crypto=require('crypto');var jsforce=require(_0xa638('0xf'));var deskjs=require(_0xa638('0x10'));var toCsv=require(_0xa638('0xa'));var querystring=require('querystring');var Papa=require(_0xa638('0x11'));var Redis=require(_0xa638('0x12'));var authService=require(_0xa638('0x13'));var qs=require(_0xa638('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa638('0x15'));var logger=require('../../config/logger')(_0xa638('0x16'));var utils=require(_0xa638('0x17'));var config=require(_0xa638('0x18'));var licenseUtil=require(_0xa638('0x19'));var db=require(_0xa638('0x1a'))['db'];var jayson=require(_0xa638('0x1b'));var client=jayson[_0xa638('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56a013,_0x12b376,_0x2656d4,_0x14a824){return new BPromise(function(_0x595109,_0x115540){var _0x14e903=_0x14a824||client;return _0x14e903['request'](_0x56a013,_0x2656d4)[_0xa638('0x1d')](function(_0x3b168a){logger[_0xa638('0x1e')](_0xa638('0x1f'),_0x12b376,_0xa638('0x20'));logger['debug'](_0xa638('0x21'),_0x12b376,_0xa638('0x20'),JSON[_0xa638('0x22')](_0x3b168a));if(_0x3b168a['error']){if(_0x3b168a[_0xa638('0x23')]['code']===0x1f4){logger[_0xa638('0x23')](_0xa638('0x1f'),_0x12b376,_0x3b168a[_0xa638('0x23')]['message']);return _0x115540(_0x3b168a[_0xa638('0x23')][_0xa638('0x24')]);}logger[_0xa638('0x23')](_0xa638('0x1f'),_0x12b376,_0x3b168a['error']['message']);return _0x595109(_0x3b168a['error'][_0xa638('0x24')]);}else{logger[_0xa638('0x1e')](_0xa638('0x1f'),_0x12b376,_0xa638('0x20'));_0x595109(_0x3b168a['result'][_0xa638('0x24')]);}})[_0xa638('0x25')](function(_0x4ac02a){logger[_0xa638('0x23')]('VoiceContext,\x20%s,\x20%s',_0x12b376,_0x4ac02a);_0x115540(_0x4ac02a);});});}function respondWithStatusCode(_0x3ac4da,_0x59b6e9){_0x59b6e9=_0x59b6e9||0xcc;return function(_0x37cbe3){if(_0x37cbe3){return _0x3ac4da[_0xa638('0x26')](_0x59b6e9);}return _0x3ac4da[_0xa638('0x27')](_0x59b6e9)[_0xa638('0x28')]();};}function respondWithResult(_0x25fab3,_0x4d5560){_0x4d5560=_0x4d5560||0xc8;return function(_0x62dd1d){if(_0x62dd1d){return _0x25fab3[_0xa638('0x27')](_0x4d5560)[_0xa638('0x29')](_0x62dd1d);}};}function respondWithFilteredResult(_0x2cac14,_0x1ac449){return function(_0x9d0d82){if(_0x9d0d82){var _0x69def5=typeof _0x1ac449[_0xa638('0x2a')]===_0xa638('0x2b')&&typeof _0x1ac449[_0xa638('0x2c')]===_0xa638('0x2b');var _0x5d982b=_0x9d0d82[_0xa638('0x2d')];var _0x7217db=_0x69def5?0x0:_0x1ac449[_0xa638('0x2a')];var _0x485ce6=_0x69def5?_0x9d0d82[_0xa638('0x2d')]:_0x1ac449[_0xa638('0x2a')]+_0x1ac449[_0xa638('0x2c')];var _0x56a3ea;if(_0x485ce6>=_0x5d982b){_0x485ce6=_0x5d982b;_0x56a3ea=0xc8;}else{_0x56a3ea=0xce;}_0x2cac14[_0xa638('0x27')](_0x56a3ea);return _0x2cac14[_0xa638('0x2e')](_0xa638('0x2f'),_0x7217db+'-'+_0x485ce6+'/'+_0x5d982b)[_0xa638('0x29')](_0x9d0d82);}return null;};}function patchUpdates(_0x279ac){return function(_0x219fc7){try{jsonpatch[_0xa638('0x30')](_0x219fc7,_0x279ac,!![]);}catch(_0x2de14b){return BPromise[_0xa638('0x31')](_0x2de14b);}return _0x219fc7[_0xa638('0x32')]();};}function saveUpdates(_0x2c3610,_0x3e840f){return function(_0x1b93be){if(_0x1b93be){return _0x1b93be['update'](_0x2c3610)[_0xa638('0x1d')](function(_0x455325){return _0x455325;});}return null;};}function removeEntity(_0x2638d7,_0x49851a){return function(_0x529934){if(_0x529934){return _0x529934['destroy']()[_0xa638('0x1d')](function(){var _0x445afb=_0x529934['get']({'plain':!![]});var _0x467c3d=_0xa638('0x33');return db[_0xa638('0x34')][_0xa638('0x35')]({'where':{'type':_0x467c3d,'resourceId':_0x445afb['id']}})['then'](function(){return _0x529934;});})['then'](function(){_0x2638d7[_0xa638('0x27')](0xcc)[_0xa638('0x28')]();});}};}function handleEntityNotFound(_0x2c05e4,_0x58d8c8){return function(_0x53497a){if(!_0x53497a){_0x2c05e4['sendStatus'](0x194);}return _0x53497a;};}function handleError(_0x103100,_0x1ab9e7){_0x1ab9e7=_0x1ab9e7||0x1f4;return function(_0x3dab09){logger[_0xa638('0x23')](_0x3dab09['stack']);if(_0x3dab09['name']){delete _0x3dab09[_0xa638('0x36')];}_0x103100[_0xa638('0x27')](_0x1ab9e7)['send'](_0x3dab09);};}exports['index']=function(_0x4b5b9c,_0x2742b5){var _0x5f1d60={},_0x10f48a={},_0x3f629d={'count':0x0,'rows':[]};var _0x1d06b0=_['map'](db[_0xa638('0x37')][_0xa638('0x38')],function(_0x5cd07e){return{'name':_0x5cd07e[_0xa638('0x39')],'type':_0x5cd07e[_0xa638('0x3a')][_0xa638('0x3b')]};});_0x10f48a[_0xa638('0x3c')]=_[_0xa638('0x3d')](_0x1d06b0,'name');_0x10f48a[_0xa638('0x3e')]=_[_0xa638('0x3f')](_0x4b5b9c[_0xa638('0x3e')]);_0x10f48a[_0xa638('0x40')]=_['intersection'](_0x10f48a[_0xa638('0x3c')],_0x10f48a[_0xa638('0x3e')]);_0x5f1d60[_0xa638('0x41')]=_[_0xa638('0x42')](_0x10f48a['model'],qs[_0xa638('0x43')](_0x4b5b9c[_0xa638('0x3e')][_0xa638('0x43')]));_0x5f1d60[_0xa638('0x41')]=_0x5f1d60[_0xa638('0x41')][_0xa638('0x44')]?_0x5f1d60['attributes']:_0x10f48a[_0xa638('0x3c')];if(!_0x4b5b9c['query'][_0xa638('0x45')](_0xa638('0x46'))){_0x5f1d60['limit']=qs[_0xa638('0x2c')](_0x4b5b9c[_0xa638('0x3e')][_0xa638('0x2c')]);_0x5f1d60[_0xa638('0x2a')]=qs[_0xa638('0x2a')](_0x4b5b9c[_0xa638('0x3e')][_0xa638('0x2a')]);}_0x5f1d60[_0xa638('0x47')]=qs[_0xa638('0x48')](_0x4b5b9c[_0xa638('0x3e')][_0xa638('0x48')]);_0x5f1d60[_0xa638('0x49')]=qs[_0xa638('0x40')](_[_0xa638('0x4a')](_0x4b5b9c['query'],_0x10f48a[_0xa638('0x40')]),_0x1d06b0);if(_0x4b5b9c[_0xa638('0x3e')][_0xa638('0x4b')]){_0x5f1d60[_0xa638('0x49')]=_[_0xa638('0x4c')](_0x5f1d60[_0xa638('0x49')],{'$or':_[_0xa638('0x3d')](_0x1d06b0,function(_0x184465){if(_0x184465['type']!=='VIRTUAL'){var _0x3348bf={};_0x3348bf[_0x184465['name']]={'$like':'%'+_0x4b5b9c[_0xa638('0x3e')][_0xa638('0x4b')]+'%'};return _0x3348bf;}})});}_0x5f1d60=_[_0xa638('0x4c')]({},_0x5f1d60,_0x4b5b9c[_0xa638('0x4d')]);var _0x4c9369={'where':_0x5f1d60['where']};return db[_0xa638('0x37')][_0xa638('0x2d')](_0x4c9369)[_0xa638('0x1d')](function(_0x507d2a){_0x3f629d[_0xa638('0x2d')]=_0x507d2a;if(_0x4b5b9c[_0xa638('0x3e')]['includeAll']){_0x5f1d60[_0xa638('0x4e')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x5f1d60);})['then'](function(_0x328951){_0x3f629d[_0xa638('0x4f')]=_0x328951;return _0x3f629d;})[_0xa638('0x1d')](respondWithFilteredResult(_0x2742b5,_0x5f1d60))[_0xa638('0x25')](handleError(_0x2742b5,null));};exports[_0xa638('0x50')]=function(_0x527a43,_0x58a7fe){var _0x321b7c={'raw':![],'where':{'id':_0x527a43['params']['id']}},_0x39161d={};_0x39161d[_0xa638('0x3c')]=_[_0xa638('0x3f')](db[_0xa638('0x37')][_0xa638('0x38')]);_0x39161d[_0xa638('0x3e')]=_[_0xa638('0x3f')](_0x527a43['query']);_0x39161d['filters']=_[_0xa638('0x42')](_0x39161d[_0xa638('0x3c')],_0x39161d[_0xa638('0x3e')]);_0x321b7c[_0xa638('0x41')]=_[_0xa638('0x42')](_0x39161d[_0xa638('0x3c')],qs[_0xa638('0x43')](_0x527a43[_0xa638('0x3e')][_0xa638('0x43')]));_0x321b7c['attributes']=_0x321b7c['attributes'][_0xa638('0x44')]?_0x321b7c[_0xa638('0x41')]:_0x39161d[_0xa638('0x3c')];if(_0x527a43['query'][_0xa638('0x51')]){_0x321b7c[_0xa638('0x4e')]=[{'all':!![]}];}_0x321b7c=_[_0xa638('0x4c')]({},_0x321b7c,_0x527a43[_0xa638('0x4d')]);return db[_0xa638('0x37')][_0xa638('0x52')](_0x321b7c)['then'](handleEntityNotFound(_0x58a7fe,null))[_0xa638('0x1d')](respondWithResult(_0x58a7fe,null))['catch'](handleError(_0x58a7fe,null));};exports[_0xa638('0x53')]=function(_0xc449d9,_0x11b207,_0x448c64){var _0x41c69a;return db[_0xa638('0x37')]['create'](_0xc449d9['body'],{'raw':!![]})[_0xa638('0x1d')](function(_0x28aec0){_0x41c69a=_0x28aec0;return db[_0xa638('0x37')]['findAll']({'raw':!![]});})['then'](function(_0x3465c7){var _0x1ff9b3=fs[_0xa638('0x54')](path[_0xa638('0x55')](config[_0xa638('0x56')],_0xa638('0x57')),_0xa638('0x58'));var _0x187cf9=ejs[_0xa638('0x59')](_0x1ff9b3,{'contexts':_0x3465c7||[]});fs['writeFileSync'](_0xa638('0x5a'),_0x187cf9);})['then'](function(){return respondWithRpcPromise(_0xa638('0x5b'),_0xa638('0x53'),{'module':_0xa638('0x5c')});})['then'](function(){var _0x14f535=_0xc449d9[_0xa638('0x5d')][_0xa638('0x5e')]({'plain':!![]});if(!_0x14f535)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14f535[_0xa638('0x5f')]===_0xa638('0x5d')){var _0x1ba787=_0x41c69a[_0xa638('0x5e')]({'plain':!![]});return db[_0xa638('0x60')]['find']({'where':{'name':_0xa638('0x33'),'userProfileId':_0x14f535[_0xa638('0x61')]},'raw':!![]})[_0xa638('0x1d')](function(_0x3f1c4f){if(_0x3f1c4f&&_0x3f1c4f[_0xa638('0x62')]===0x0){return db['UserProfileResource'][_0xa638('0x53')]({'name':_0x1ba787[_0xa638('0x36')],'resourceId':_0x1ba787['id'],'type':_0x3f1c4f[_0xa638('0x36')],'sectionId':_0x3f1c4f['id']},{})[_0xa638('0x1d')](function(){return _0x41c69a;});}else{return _0x41c69a;}})[_0xa638('0x25')](function(_0x39ed38){logger[_0xa638('0x23')](_0xa638('0x63'),_0x39ed38);throw _0x39ed38;});}return _0x41c69a;})[_0xa638('0x1d')](respondWithResult(_0x11b207,0xc9))[_0xa638('0x25')](handleError(_0x11b207,null));};exports[_0xa638('0x64')]=function(_0xbc972c,_0x5ea1fb,_0x51e5cb){var _0x19f0e7;return db['VoiceContext'][_0xa638('0x52')]({'where':{'id':_0xbc972c['params']['id']}})['then'](handleEntityNotFound(_0x5ea1fb,null))[_0xa638('0x1d')](saveUpdates(_0xbc972c[_0xa638('0x65')],null))[_0xa638('0x1d')](function(_0x4470da){if(_0x4470da){_0x19f0e7=_0x4470da;return db[_0xa638('0x37')][_0xa638('0x66')]({'raw':!![]});}})['then'](function(_0x2ce68f){var _0xa6a961=fs[_0xa638('0x54')](path[_0xa638('0x55')](config['root'],'server/files/templates/context.ejs'),_0xa638('0x58'));var _0x55ee6c=ejs[_0xa638('0x59')](_0xa6a961,{'contexts':_0x2ce68f||[]});fs[_0xa638('0x67')](_0xa638('0x5a'),_0x55ee6c);})[_0xa638('0x1d')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xa638('0x5c')});})[_0xa638('0x1d')](function(){return _0x19f0e7;})['then'](respondWithResult(_0x5ea1fb,null))[_0xa638('0x25')](handleError(_0x5ea1fb,null));};exports[_0xa638('0x35')]=function(_0x18b30e,_0x301c0d,_0x2a06ac){var _0x56df2b;return db['VoiceContext'][_0xa638('0x52')]({'where':{'id':_0x18b30e[_0xa638('0x68')]['id']}})['then'](handleEntityNotFound(_0x301c0d,null))[_0xa638('0x1d')](removeEntity(_0x301c0d,null))[_0xa638('0x1d')](function(){return db[_0xa638('0x37')][_0xa638('0x66')]({'raw':!![]});})[_0xa638('0x1d')](function(_0x40ef12){var _0x12fef6=fs['readFileSync'](path['join'](config[_0xa638('0x56')],'server/files/templates/context.ejs'),_0xa638('0x58'));var _0x6f264c=ejs[_0xa638('0x59')](_0x12fef6,{'contexts':_0x40ef12});fs[_0xa638('0x67')](_0xa638('0x5a'),_0x6f264c);return respondWithRpcPromise(_0xa638('0x5b'),'destroy',{'module':_0xa638('0x5c')});})[_0xa638('0x25')](handleError(_0x301c0d,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index aebe3fa..6934819 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 _0xf93a=['VoiceContext','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceContext.attributes','exports','define'];(function(_0x3f1861,_0x7b4285){var _0x7ca70a=function(_0x119b09){while(--_0x119b09){_0x3f1861['push'](_0x3f1861['shift']());}};_0x7ca70a(++_0x7b4285);}(_0xf93a,0x156));var _0xaf93=function(_0x3b5cde,_0x595d49){_0x3b5cde=_0x3b5cde-0x0;var _0x263bec=_0xf93a[_0x3b5cde];return _0x263bec;};'use strict';var _=require('lodash');var util=require(_0xaf93('0x0'));var logger=require(_0xaf93('0x1'))(_0xaf93('0x2'));var moment=require(_0xaf93('0x3'));var BPromise=require('bluebird');var rp=require(_0xaf93('0x4'));var fs=require('fs');var path=require(_0xaf93('0x5'));var rimraf=require(_0xaf93('0x6'));var config=require('../../config/environment');var attributes=require(_0xaf93('0x7'));module[_0xaf93('0x8')]=function(_0x5bd569,_0x4a039c){return _0x5bd569[_0xaf93('0x9')](_0xaf93('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6bc0=['define','VoiceContext','voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports'];(function(_0x272b57,_0x56cc34){var _0x44322a=function(_0x24782b){while(--_0x24782b){_0x272b57['push'](_0x272b57['shift']());}};_0x44322a(++_0x56cc34);}(_0x6bc0,0xc7));var _0x06bc=function(_0xedd03d,_0x46c3ab){_0xedd03d=_0xedd03d-0x0;var _0x2311bc=_0x6bc0[_0xedd03d];return _0x2311bc;};'use strict';var _=require(_0x06bc('0x0'));var util=require('util');var logger=require(_0x06bc('0x1'))(_0x06bc('0x2'));var moment=require(_0x06bc('0x3'));var BPromise=require(_0x06bc('0x4'));var rp=require(_0x06bc('0x5'));var fs=require('fs');var path=require(_0x06bc('0x6'));var rimraf=require(_0x06bc('0x7'));var config=require(_0x06bc('0x8'));var attributes=require(_0x06bc('0x9'));module[_0x06bc('0xa')]=function(_0x5a635f,_0x484f6c){return _0x5a635f[_0x06bc('0xb')](_0x06bc('0xc'),attributes,{'tableName':_0x06bc('0xd'),'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 46fffcb..2b9d5b5 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 _0xc2af=['stringify','code','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x2ddc00,_0x3decaf){var _0x531ede=function(_0x5c4d8a){while(--_0x5c4d8a){_0x2ddc00['push'](_0x2ddc00['shift']());}};_0x531ede(++_0x3decaf);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x4837b5,_0x51a7a0){_0x4837b5=_0x4837b5-0x0;var _0x240a88=_0xc2af[_0x4837b5];return _0x240a88;};'use strict';var _=require(_0xfc2a('0x0'));var util=require('util');var moment=require(_0xfc2a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfc2a('0x2'));var fs=require('fs');var Redis=require(_0xfc2a('0x3'));var db=require(_0xfc2a('0x4'))['db'];var utils=require(_0xfc2a('0x5'));var logger=require(_0xfc2a('0x6'))(_0xfc2a('0x7'));var config=require(_0xfc2a('0x8'));var jayson=require(_0xfc2a('0x9'));var client=jayson['client'][_0xfc2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c193b,_0x4330c3,_0x5cc7fc){return new BPromise(function(_0x1b96b1,_0x1427a6){return client[_0xfc2a('0xb')](_0x4c193b,_0x5cc7fc)[_0xfc2a('0xc')](function(_0x4c826a){logger[_0xfc2a('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4330c3,_0xfc2a('0xe'));logger['debug'](_0xfc2a('0xf'),_0x4330c3,_0xfc2a('0xe'),JSON[_0xfc2a('0x10')](_0x4c826a));if(_0x4c826a['error']){if(_0x4c826a['error'][_0xfc2a('0x11')]===0x1f4){logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);return _0x1427a6(_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);}logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0x4c826a['error']['message']);return _0x1b96b1(_0x4c826a[_0xfc2a('0x12')][_0xfc2a('0x14')]);}else{logger['info'](_0xfc2a('0x13'),_0x4330c3,_0xfc2a('0xe'));_0x1b96b1(_0x4c826a[_0xfc2a('0x15')][_0xfc2a('0x14')]);}})[_0xfc2a('0x16')](function(_0xa93aa7){logger[_0xfc2a('0x12')](_0xfc2a('0x13'),_0x4330c3,_0xa93aa7);_0x1427a6(_0xa93aa7);});});} \ No newline at end of file +var _0x2b84=['jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x96be88,_0x2c01a4){var _0x1c14c0=function(_0x20aeff){while(--_0x20aeff){_0x96be88['push'](_0x96be88['shift']());}};_0x1c14c0(++_0x2c01a4);}(_0x2b84,0x1ed));var _0x42b8=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x2b84[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x42b8('0x0'));var util=require(_0x42b8('0x1'));var moment=require('moment');var BPromise=require(_0x42b8('0x2'));var rs=require(_0x42b8('0x3'));var fs=require('fs');var Redis=require(_0x42b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42b8('0x5'));var logger=require('../../config/logger')(_0x42b8('0x6'));var config=require('../../config/environment');var jayson=require(_0x42b8('0x7'));var client=jayson[_0x42b8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a040d,_0x399f8e,_0x23459e){return new BPromise(function(_0x1c6323,_0x38de8a){return client[_0x42b8('0x9')](_0x4a040d,_0x23459e)['then'](function(_0x381f1a){logger[_0x42b8('0xa')](_0x42b8('0xb'),_0x399f8e,_0x42b8('0xc'));logger[_0x42b8('0xd')](_0x42b8('0xe'),_0x399f8e,_0x42b8('0xc'),JSON[_0x42b8('0xf')](_0x381f1a));if(_0x381f1a['error']){if(_0x381f1a['error'][_0x42b8('0x10')]===0x1f4){logger[_0x42b8('0x11')]('VoiceContext,\x20%s,\x20%s',_0x399f8e,_0x381f1a[_0x42b8('0x11')]['message']);return _0x38de8a(_0x381f1a['error'][_0x42b8('0x12')]);}logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x381f1a[_0x42b8('0x11')][_0x42b8('0x12')]);return _0x1c6323(_0x381f1a['error'][_0x42b8('0x12')]);}else{logger['info'](_0x42b8('0xb'),_0x399f8e,'request\x20sent');_0x1c6323(_0x381f1a['result'][_0x42b8('0x12')]);}})[_0x42b8('0x13')](function(_0x2d1706){logger[_0x42b8('0x11')](_0x42b8('0xb'),_0x399f8e,_0x2d1706);_0x38de8a(_0x2d1706);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8d4965d..3f0b540 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 _0x8aa5=['index','describe','show','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4eb0b1,_0x1621ac){var _0x1b58bd=function(_0x30c4e5){while(--_0x30c4e5){_0x4eb0b1['push'](_0x4eb0b1['shift']());}};_0x1b58bd(++_0x1621ac);}(_0x8aa5,0x78));var _0x58aa=function(_0x492c1b,_0x4ba7dc){_0x492c1b=_0x492c1b-0x0;var _0x124549=_0x8aa5[_0x492c1b];return _0x124549;};'use strict';var multer=require(_0x58aa('0x0'));var util=require(_0x58aa('0x1'));var path=require(_0x58aa('0x2'));var timeout=require(_0x58aa('0x3'));var express=require(_0x58aa('0x4'));var router=express[_0x58aa('0x5')]();var fs_extra=require(_0x58aa('0x6'));var auth=require(_0x58aa('0x7'));var interaction=require(_0x58aa('0x8'));var config=require(_0x58aa('0x9'));var controller=require('./voiceDialReport.controller');router[_0x58aa('0xa')]('/',auth[_0x58aa('0xb')](),controller[_0x58aa('0xc')]);router[_0x58aa('0xa')]('/describe',auth[_0x58aa('0xb')](),controller[_0x58aa('0xd')]);router[_0x58aa('0xa')]('/:id',auth[_0x58aa('0xb')](),controller[_0x58aa('0xe')]);router[_0x58aa('0xf')]('/',auth[_0x58aa('0xb')](),controller[_0x58aa('0x10')]);router[_0x58aa('0x11')](_0x58aa('0x12'),auth[_0x58aa('0xb')](),controller[_0x58aa('0x13')]);router[_0x58aa('0x14')]('/:id',auth[_0x58aa('0xb')](),controller['destroy']);module[_0x58aa('0x15')]=router; \ No newline at end of file +var _0xece2=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer'];(function(_0x414c93,_0x486641){var _0x2115e5=function(_0x3c2e9e){while(--_0x3c2e9e){_0x414c93['push'](_0x414c93['shift']());}};_0x2115e5(++_0x486641);}(_0xece2,0x1cd));var _0x2ece=function(_0x1ee08c,_0x595bf8){_0x1ee08c=_0x1ee08c-0x0;var _0x2369a=_0xece2[_0x1ee08c];return _0x2369a;};'use strict';var multer=require(_0x2ece('0x0'));var util=require(_0x2ece('0x1'));var path=require(_0x2ece('0x2'));var timeout=require(_0x2ece('0x3'));var express=require('express');var router=express[_0x2ece('0x4')]();var fs_extra=require(_0x2ece('0x5'));var auth=require(_0x2ece('0x6'));var interaction=require(_0x2ece('0x7'));var config=require(_0x2ece('0x8'));var controller=require(_0x2ece('0x9'));router['get']('/',auth[_0x2ece('0xa')](),controller['index']);router[_0x2ece('0xb')](_0x2ece('0xc'),auth[_0x2ece('0xa')](),controller[_0x2ece('0xd')]);router['get'](_0x2ece('0xe'),auth[_0x2ece('0xa')](),controller[_0x2ece('0xf')]);router['post']('/',auth[_0x2ece('0xa')](),controller[_0x2ece('0x10')]);router['put'](_0x2ece('0xe'),auth[_0x2ece('0xa')](),controller[_0x2ece('0x11')]);router[_0x2ece('0x12')](_0x2ece('0xe'),auth[_0x2ece('0xa')](),controller[_0x2ece('0x13')]);module[_0x2ece('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 50f7c76..8d8ccb8 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 _0x98a8=['sequelize','exports','STRING','INTEGER','DATE'];(function(_0x3fd37b,_0x427cdd){var _0x13acd8=function(_0x4717b1){while(--_0x4717b1){_0x3fd37b['push'](_0x3fd37b['shift']());}};_0x13acd8(++_0x427cdd);}(_0x98a8,0x12c));var _0x898a=function(_0xc00f2a,_0x506514){_0xc00f2a=_0xc00f2a-0x0;var _0x2607dd=_0x98a8[_0xc00f2a];return _0x2607dd;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'privilege':{'type':Sequelize[_0x898a('0x2')]},'channel':{'type':Sequelize[_0x898a('0x2')]},'channelstate':{'type':Sequelize[_0x898a('0x3')]},'channelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'calleridnum':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'connectedlinename':{'type':Sequelize[_0x898a('0x2')]},'language':{'type':Sequelize[_0x898a('0x2')]},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x898a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x898a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x898a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x898a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x898a('0x2')]},'destcalleridname':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x898a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x898a('0x2')]},'destlanguage':{'type':Sequelize[_0x898a('0x2')]},'destaccountcode':{'type':Sequelize[_0x898a('0x2')]},'destcontext':{'type':Sequelize[_0x898a('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x898a('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x898a('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x898a('0x2')]},'starttime':{'type':Sequelize[_0x898a('0x4')]},'answertime':{'type':Sequelize[_0x898a('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x898a('0x3')]},'duration':{'type':Sequelize[_0x898a('0x3')]},'holdtime':{'type':Sequelize[_0x898a('0x3')]},'billableseconds':{'type':Sequelize[_0x898a('0x3')]}}; \ No newline at end of file +var _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x494299,_0x11bd86){var _0x435505=function(_0x29a2b1){while(--_0x29a2b1){_0x494299['push'](_0x494299['shift']());}};_0x435505(++_0x11bd86);}(_0x4b84,0x1cc));var _0x44b8=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x4b84[_0x496333];return _0x44256e;};'use strict';var Sequelize=require(_0x44b8('0x0'));module[_0x44b8('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x44b8('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'connectedlinename':{'type':Sequelize[_0x44b8('0x3')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x44b8('0x3')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x44b8('0x3')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x44b8('0x3')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x44b8('0x3')]},'destcalleridname':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinenum':{'type':Sequelize[_0x44b8('0x3')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x44b8('0x3')]},'destaccountcode':{'type':Sequelize[_0x44b8('0x3')]},'destcontext':{'type':Sequelize[_0x44b8('0x3')]},'destexten':{'type':Sequelize[_0x44b8('0x3')]},'destpriority':{'type':Sequelize[_0x44b8('0x2')]},'destuniqueid':{'type':Sequelize[_0x44b8('0x3')]},'destlinkedid':{'type':Sequelize[_0x44b8('0x3')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x44b8('0x3')]},'starttime':{'type':Sequelize[_0x44b8('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x44b8('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x44b8('0x5')},'routeId':{'type':Sequelize[_0x44b8('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x44b8('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index de5f299..f7c65f8 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 _0x28bd=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','VoiceDialReport','length','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys'];(function(_0x9dbecb,_0x44958a){var _0x9dd13d=function(_0x5196b7){while(--_0x5196b7){_0x9dbecb['push'](_0x9dbecb['shift']());}};_0x9dd13d(++_0x44958a);}(_0x28bd,0x14a));var _0xd28b=function(_0x149380,_0x162914){_0x149380=_0x149380-0x0;var _0x46cad=_0x28bd[_0x149380];return _0x46cad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd28b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd28b('0x1'));var rp=require(_0xd28b('0x2'));var moment=require(_0xd28b('0x3'));var BPromise=require(_0xd28b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd28b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd28b('0x6'));var _=require(_0xd28b('0x7'));var squel=require(_0xd28b('0x8'));var crypto=require(_0xd28b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd28b('0xa'));var toCsv=require(_0xd28b('0x5'));var querystring=require('querystring');var Papa=require(_0xd28b('0xb'));var Redis=require('ioredis');var authService=require(_0xd28b('0xc'));var qs=require(_0xd28b('0xd'));var as=require(_0xd28b('0xe'));var hardwareService=require(_0xd28b('0xf'));var logger=require(_0xd28b('0x10'))(_0xd28b('0x11'));var utils=require(_0xd28b('0x12'));var config=require(_0xd28b('0x13'));var licenseUtil=require(_0xd28b('0x14'));var db=require(_0xd28b('0x15'))['db'];function respondWithStatusCode(_0x46dcc1,_0x3a3ccf){_0x3a3ccf=_0x3a3ccf||0xcc;return function(_0x29dd2a){if(_0x29dd2a){return _0x46dcc1[_0xd28b('0x16')](_0x3a3ccf);}return _0x46dcc1[_0xd28b('0x17')](_0x3a3ccf)[_0xd28b('0x18')]();};}function respondWithResult(_0x51ae77,_0x3c0b48){_0x3c0b48=_0x3c0b48||0xc8;return function(_0x5019d6){if(_0x5019d6){return _0x51ae77[_0xd28b('0x17')](_0x3c0b48)['json'](_0x5019d6);}};}function respondWithFilteredResult(_0x5d6a8a,_0x2d93ed){return function(_0x398064){if(_0x398064){var _0x3159bc=typeof _0x2d93ed['offset']===_0xd28b('0x19')&&typeof _0x2d93ed[_0xd28b('0x1a')]===_0xd28b('0x19');var _0x10b064=_0x398064[_0xd28b('0x1b')];var _0x237eab=_0x3159bc?0x0:_0x2d93ed[_0xd28b('0x1c')];var _0xe6ee3a=_0x3159bc?_0x398064[_0xd28b('0x1b')]:_0x2d93ed[_0xd28b('0x1c')]+_0x2d93ed['limit'];var _0x2ff8b3;if(_0xe6ee3a>=_0x10b064){_0xe6ee3a=_0x10b064;_0x2ff8b3=0xc8;}else{_0x2ff8b3=0xce;}_0x5d6a8a[_0xd28b('0x17')](_0x2ff8b3);return _0x5d6a8a[_0xd28b('0x1d')](_0xd28b('0x1e'),_0x237eab+'-'+_0xe6ee3a+'/'+_0x10b064)[_0xd28b('0x1f')](_0x398064);}return null;};}function patchUpdates(_0x26deb7){return function(_0x3aea57){try{jsonpatch[_0xd28b('0x20')](_0x3aea57,_0x26deb7,!![]);}catch(_0x5c3439){return BPromise[_0xd28b('0x21')](_0x5c3439);}return _0x3aea57[_0xd28b('0x22')]();};}function saveUpdates(_0x3e8338,_0x453765){return function(_0x506f3a){if(_0x506f3a){return _0x506f3a[_0xd28b('0x23')](_0x3e8338)[_0xd28b('0x24')](function(_0x4d25bf){return _0x4d25bf;});}return null;};}function removeEntity(_0x36db09,_0x2a043d){return function(_0x241caa){if(_0x241caa){return _0x241caa[_0xd28b('0x25')]()[_0xd28b('0x24')](function(){_0x36db09[_0xd28b('0x17')](0xcc)[_0xd28b('0x18')]();});}};}function handleEntityNotFound(_0xd78ede,_0x262eff){return function(_0x3fa128){if(!_0x3fa128){_0xd78ede['sendStatus'](0x194);}return _0x3fa128;};}function handleError(_0x255554,_0x3a4481){_0x3a4481=_0x3a4481||0x1f4;return function(_0x4b325d){logger[_0xd28b('0x26')](_0x4b325d[_0xd28b('0x27')]);if(_0x4b325d[_0xd28b('0x28')]){delete _0x4b325d[_0xd28b('0x28')];}_0x255554[_0xd28b('0x17')](_0x3a4481)[_0xd28b('0x29')](_0x4b325d);};}exports[_0xd28b('0x2a')]=function(_0x4a9a5b,_0x5dbca6){var _0x318e4a={},_0x456c97={},_0x2d3162={'count':0x0,'rows':[]};var _0x35f6a8=_[_0xd28b('0x2b')](db['VoiceDialReport'][_0xd28b('0x2c')],function(_0xbcfb16){return{'name':_0xbcfb16[_0xd28b('0x2d')],'type':_0xbcfb16['type'][_0xd28b('0x2e')]};});_0x456c97[_0xd28b('0x2f')]=_[_0xd28b('0x2b')](_0x35f6a8,_0xd28b('0x28'));_0x456c97[_0xd28b('0x30')]=_[_0xd28b('0x31')](_0x4a9a5b[_0xd28b('0x30')]);_0x456c97[_0xd28b('0x32')]=_[_0xd28b('0x33')](_0x456c97[_0xd28b('0x2f')],_0x456c97['query']);_0x318e4a[_0xd28b('0x34')]=_[_0xd28b('0x33')](_0x456c97[_0xd28b('0x2f')],qs[_0xd28b('0x35')](_0x4a9a5b[_0xd28b('0x30')][_0xd28b('0x35')]));_0x318e4a[_0xd28b('0x34')]=_0x318e4a[_0xd28b('0x34')]['length']?_0x318e4a['attributes']:_0x456c97[_0xd28b('0x2f')];if(!_0x4a9a5b['query'][_0xd28b('0x36')](_0xd28b('0x37'))){_0x318e4a[_0xd28b('0x1a')]=qs['limit'](_0x4a9a5b['query']['limit']);_0x318e4a[_0xd28b('0x1c')]=qs[_0xd28b('0x1c')](_0x4a9a5b[_0xd28b('0x30')]['offset']);}_0x318e4a[_0xd28b('0x38')]=qs['sort'](_0x4a9a5b[_0xd28b('0x30')]['sort']);_0x318e4a[_0xd28b('0x39')]=qs[_0xd28b('0x32')](_['pick'](_0x4a9a5b[_0xd28b('0x30')],_0x456c97[_0xd28b('0x32')]),_0x35f6a8);if(_0x4a9a5b['query'][_0xd28b('0x3a')]){_0x318e4a[_0xd28b('0x39')]=_['merge'](_0x318e4a[_0xd28b('0x39')],{'$or':_['map'](_0x35f6a8,function(_0x4dfa57){if(_0x4dfa57[_0xd28b('0x3b')]!==_0xd28b('0x3c')){var _0x1e5c59={};_0x1e5c59[_0x4dfa57[_0xd28b('0x28')]]={'$like':'%'+_0x4a9a5b[_0xd28b('0x30')]['filter']+'%'};return _0x1e5c59;}})});}_0x318e4a=_[_0xd28b('0x3d')]({},_0x318e4a,_0x4a9a5b[_0xd28b('0x3e')]);var _0x1cb373={'where':_0x318e4a['where']};return db['VoiceDialReport'][_0xd28b('0x1b')](_0x1cb373)[_0xd28b('0x24')](function(_0x10c34b){_0x2d3162[_0xd28b('0x1b')]=_0x10c34b;if(_0x4a9a5b[_0xd28b('0x30')][_0xd28b('0x3f')]){_0x318e4a[_0xd28b('0x40')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xd28b('0x41')](_0x318e4a);})['then'](function(_0xabe26f){_0x2d3162[_0xd28b('0x42')]=_0xabe26f;return _0x2d3162;})[_0xd28b('0x24')](respondWithFilteredResult(_0x5dbca6,_0x318e4a))[_0xd28b('0x43')](handleError(_0x5dbca6,null));};exports[_0xd28b('0x44')]=function(_0x2c96e,_0x518b68){var _0x3c2aed={'raw':!![],'where':{'id':_0x2c96e[_0xd28b('0x45')]['id']}},_0x40dddb={};_0x40dddb[_0xd28b('0x2f')]=_[_0xd28b('0x31')](db[_0xd28b('0x46')]['rawAttributes']);_0x40dddb[_0xd28b('0x30')]=_[_0xd28b('0x31')](_0x2c96e[_0xd28b('0x30')]);_0x40dddb[_0xd28b('0x32')]=_[_0xd28b('0x33')](_0x40dddb['model'],_0x40dddb[_0xd28b('0x30')]);_0x3c2aed['attributes']=_['intersection'](_0x40dddb['model'],qs[_0xd28b('0x35')](_0x2c96e['query'][_0xd28b('0x35')]));_0x3c2aed[_0xd28b('0x34')]=_0x3c2aed['attributes'][_0xd28b('0x47')]?_0x3c2aed['attributes']:_0x40dddb[_0xd28b('0x2f')];if(_0x2c96e['query'][_0xd28b('0x3f')]){_0x3c2aed[_0xd28b('0x40')]=[{'all':!![]}];}_0x3c2aed=_['merge']({},_0x3c2aed,_0x2c96e[_0xd28b('0x3e')]);return db[_0xd28b('0x46')]['find'](_0x3c2aed)[_0xd28b('0x24')](handleEntityNotFound(_0x518b68,null))['then'](respondWithResult(_0x518b68,null))[_0xd28b('0x43')](handleError(_0x518b68,null));};exports[_0xd28b('0x48')]=function(_0x1b350b,_0x4d7e25){return db[_0xd28b('0x46')][_0xd28b('0x48')](_0x1b350b[_0xd28b('0x49')],{})[_0xd28b('0x24')](respondWithResult(_0x4d7e25,0xc9))[_0xd28b('0x43')](handleError(_0x4d7e25,null));};exports[_0xd28b('0x23')]=function(_0x3e5ad3,_0x454e09){if(_0x3e5ad3['body']['id']){delete _0x3e5ad3[_0xd28b('0x49')]['id'];}return db[_0xd28b('0x46')][_0xd28b('0x4a')]({'where':{'id':_0x3e5ad3[_0xd28b('0x45')]['id']}})[_0xd28b('0x24')](handleEntityNotFound(_0x454e09,null))[_0xd28b('0x24')](saveUpdates(_0x3e5ad3[_0xd28b('0x49')],null))[_0xd28b('0x24')](respondWithResult(_0x454e09,null))['catch'](handleError(_0x454e09,null));};exports['destroy']=function(_0x239e13,_0x5244c4){return db[_0xd28b('0x46')][_0xd28b('0x4a')]({'where':{'id':_0x239e13[_0xd28b('0x45')]['id']}})[_0xd28b('0x24')](handleEntityNotFound(_0x5244c4,null))[_0xd28b('0x24')](removeEntity(_0x5244c4,null))[_0xd28b('0x43')](handleError(_0x5244c4,null));};exports[_0xd28b('0x4b')]=function(_0x2de887,_0x1ce1f1){return db[_0xd28b('0x46')][_0xd28b('0x4b')]()[_0xd28b('0x24')](respondWithResult(_0x1ce1f1,null))[_0xd28b('0x43')](handleError(_0x1ce1f1,null));}; \ No newline at end of file +var _0x550d=['zip-dir','request-promise','moment','mustache','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params'];(function(_0x175e91,_0x5d7678){var _0x3f15c8=function(_0x3f5f1c){while(--_0x3f5f1c){_0x175e91['push'](_0x175e91['shift']());}};_0x3f15c8(++_0x5d7678);}(_0x550d,0x10c));var _0xd550=function(_0x3b831e,_0x1b25ad){_0x3b831e=_0x3b831e-0x0;var _0x12a7ec=_0x550d[_0x3b831e];return _0x12a7ec;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd550('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd550('0x1'));var moment=require(_0xd550('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd550('0x3'));var util=require('util');var path=require(_0xd550('0x4'));var sox=require('sox');var csv=require(_0xd550('0x5'));var ejs=require(_0xd550('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd550('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xd550('0x8'));var toCsv=require(_0xd550('0x5'));var querystring=require(_0xd550('0x9'));var Papa=require(_0xd550('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd550('0xb'));var as=require(_0xd550('0xc'));var hardwareService=require(_0xd550('0xd'));var logger=require(_0xd550('0xe'))(_0xd550('0xf'));var utils=require(_0xd550('0x10'));var config=require(_0xd550('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x421a70,_0x1a7406){_0x1a7406=_0x1a7406||0xcc;return function(_0x33014f){if(_0x33014f){return _0x421a70['sendStatus'](_0x1a7406);}return _0x421a70[_0xd550('0x12')](_0x1a7406)[_0xd550('0x13')]();};}function respondWithResult(_0x9196e8,_0x4fa691){_0x4fa691=_0x4fa691||0xc8;return function(_0x24bb57){if(_0x24bb57){return _0x9196e8['status'](_0x4fa691)['json'](_0x24bb57);}};}function respondWithFilteredResult(_0x4ed8df,_0x14b90e){return function(_0xf4d52c){if(_0xf4d52c){var _0x29c9ed=typeof _0x14b90e[_0xd550('0x14')]===_0xd550('0x15')&&typeof _0x14b90e[_0xd550('0x16')]===_0xd550('0x15');var _0x4b2bdf=_0xf4d52c[_0xd550('0x17')];var _0x378681=_0x29c9ed?0x0:_0x14b90e['offset'];var _0x19c3a7=_0x29c9ed?_0xf4d52c[_0xd550('0x17')]:_0x14b90e['offset']+_0x14b90e[_0xd550('0x16')];var _0x5d8148;if(_0x19c3a7>=_0x4b2bdf){_0x19c3a7=_0x4b2bdf;_0x5d8148=0xc8;}else{_0x5d8148=0xce;}_0x4ed8df[_0xd550('0x12')](_0x5d8148);return _0x4ed8df[_0xd550('0x18')](_0xd550('0x19'),_0x378681+'-'+_0x19c3a7+'/'+_0x4b2bdf)[_0xd550('0x1a')](_0xf4d52c);}return null;};}function patchUpdates(_0x199fa6){return function(_0x2ed926){try{jsonpatch[_0xd550('0x1b')](_0x2ed926,_0x199fa6,!![]);}catch(_0x533457){return BPromise[_0xd550('0x1c')](_0x533457);}return _0x2ed926['save']();};}function saveUpdates(_0x29be3f,_0x19bae6){return function(_0xc448c7){if(_0xc448c7){return _0xc448c7[_0xd550('0x1d')](_0x29be3f)[_0xd550('0x1e')](function(_0x16a06a){return _0x16a06a;});}return null;};}function removeEntity(_0x3d042c,_0x5d3111){return function(_0x587fb3){if(_0x587fb3){return _0x587fb3[_0xd550('0x1f')]()[_0xd550('0x1e')](function(){_0x3d042c['status'](0xcc)[_0xd550('0x13')]();});}};}function handleEntityNotFound(_0x16474f,_0x504326){return function(_0x2b4e23){if(!_0x2b4e23){_0x16474f[_0xd550('0x20')](0x194);}return _0x2b4e23;};}function handleError(_0x55c53e,_0x468668){_0x468668=_0x468668||0x1f4;return function(_0x1815f9){logger[_0xd550('0x21')](_0x1815f9['stack']);if(_0x1815f9['name']){delete _0x1815f9['name'];}_0x55c53e[_0xd550('0x12')](_0x468668)[_0xd550('0x22')](_0x1815f9);};}exports[_0xd550('0x23')]=function(_0x25d80f,_0x86a545){var _0x25b990={},_0x2f2042={},_0x4bd037={'count':0x0,'rows':[]};var _0x4e7b72=_[_0xd550('0x24')](db[_0xd550('0x25')][_0xd550('0x26')],function(_0x45cd74){return{'name':_0x45cd74[_0xd550('0x27')],'type':_0x45cd74[_0xd550('0x28')]['key']};});_0x2f2042['model']=_[_0xd550('0x24')](_0x4e7b72,_0xd550('0x29'));_0x2f2042[_0xd550('0x2a')]=_[_0xd550('0x2b')](_0x25d80f['query']);_0x2f2042[_0xd550('0x2c')]=_[_0xd550('0x2d')](_0x2f2042[_0xd550('0x2e')],_0x2f2042['query']);_0x25b990[_0xd550('0x2f')]=_['intersection'](_0x2f2042[_0xd550('0x2e')],qs['fields'](_0x25d80f['query']['fields']));_0x25b990[_0xd550('0x2f')]=_0x25b990[_0xd550('0x2f')][_0xd550('0x30')]?_0x25b990[_0xd550('0x2f')]:_0x2f2042[_0xd550('0x2e')];if(!_0x25d80f[_0xd550('0x2a')]['hasOwnProperty']('nolimit')){_0x25b990[_0xd550('0x16')]=qs['limit'](_0x25d80f[_0xd550('0x2a')][_0xd550('0x16')]);_0x25b990[_0xd550('0x14')]=qs[_0xd550('0x14')](_0x25d80f[_0xd550('0x2a')][_0xd550('0x14')]);}_0x25b990[_0xd550('0x31')]=qs['sort'](_0x25d80f[_0xd550('0x2a')]['sort']);_0x25b990[_0xd550('0x32')]=qs['filters'](_[_0xd550('0x33')](_0x25d80f[_0xd550('0x2a')],_0x2f2042['filters']),_0x4e7b72);if(_0x25d80f[_0xd550('0x2a')][_0xd550('0x34')]){_0x25b990['where']=_[_0xd550('0x35')](_0x25b990[_0xd550('0x32')],{'$or':_[_0xd550('0x24')](_0x4e7b72,function(_0xe74ebe){if(_0xe74ebe['type']!==_0xd550('0x36')){var _0x5ce94={};_0x5ce94[_0xe74ebe[_0xd550('0x29')]]={'$like':'%'+_0x25d80f[_0xd550('0x2a')]['filter']+'%'};return _0x5ce94;}})});}_0x25b990=_[_0xd550('0x35')]({},_0x25b990,_0x25d80f[_0xd550('0x37')]);var _0x121592={'where':_0x25b990['where']};return db['VoiceDialReport']['count'](_0x121592)[_0xd550('0x1e')](function(_0x3a7152){_0x4bd037[_0xd550('0x17')]=_0x3a7152;if(_0x25d80f[_0xd550('0x2a')][_0xd550('0x38')]){_0x25b990[_0xd550('0x39')]=[{'all':!![]}];}return db[_0xd550('0x25')][_0xd550('0x3a')](_0x25b990);})['then'](function(_0x4fe715){_0x4bd037[_0xd550('0x3b')]=_0x4fe715;return _0x4bd037;})[_0xd550('0x1e')](respondWithFilteredResult(_0x86a545,_0x25b990))[_0xd550('0x3c')](handleError(_0x86a545,null));};exports[_0xd550('0x3d')]=function(_0x23868e,_0x276110){var _0x255c0d={'raw':!![],'where':{'id':_0x23868e['params']['id']}},_0x1e03c4={};_0x1e03c4[_0xd550('0x2e')]=_[_0xd550('0x2b')](db['VoiceDialReport']['rawAttributes']);_0x1e03c4[_0xd550('0x2a')]=_[_0xd550('0x2b')](_0x23868e['query']);_0x1e03c4[_0xd550('0x2c')]=_[_0xd550('0x2d')](_0x1e03c4[_0xd550('0x2e')],_0x1e03c4[_0xd550('0x2a')]);_0x255c0d[_0xd550('0x2f')]=_['intersection'](_0x1e03c4[_0xd550('0x2e')],qs[_0xd550('0x3e')](_0x23868e[_0xd550('0x2a')][_0xd550('0x3e')]));_0x255c0d['attributes']=_0x255c0d['attributes'][_0xd550('0x30')]?_0x255c0d[_0xd550('0x2f')]:_0x1e03c4[_0xd550('0x2e')];if(_0x23868e[_0xd550('0x2a')]['includeAll']){_0x255c0d[_0xd550('0x39')]=[{'all':!![]}];}_0x255c0d=_['merge']({},_0x255c0d,_0x23868e['options']);return db[_0xd550('0x25')][_0xd550('0x3f')](_0x255c0d)[_0xd550('0x1e')](handleEntityNotFound(_0x276110,null))['then'](respondWithResult(_0x276110,null))[_0xd550('0x3c')](handleError(_0x276110,null));};exports['create']=function(_0x32c12c,_0x2c2cf1){return db[_0xd550('0x25')][_0xd550('0x40')](_0x32c12c[_0xd550('0x41')],{})[_0xd550('0x1e')](respondWithResult(_0x2c2cf1,0xc9))[_0xd550('0x3c')](handleError(_0x2c2cf1,null));};exports['update']=function(_0x2366e5,_0x363faf){if(_0x2366e5[_0xd550('0x41')]['id']){delete _0x2366e5[_0xd550('0x41')]['id'];}return db[_0xd550('0x25')][_0xd550('0x3f')]({'where':{'id':_0x2366e5['params']['id']}})[_0xd550('0x1e')](handleEntityNotFound(_0x363faf,null))[_0xd550('0x1e')](saveUpdates(_0x2366e5['body'],null))[_0xd550('0x1e')](respondWithResult(_0x363faf,null))[_0xd550('0x3c')](handleError(_0x363faf,null));};exports['destroy']=function(_0x1c6432,_0x5c9584){return db[_0xd550('0x25')][_0xd550('0x3f')]({'where':{'id':_0x1c6432[_0xd550('0x42')]['id']}})[_0xd550('0x1e')](handleEntityNotFound(_0x5c9584,null))[_0xd550('0x1e')](removeEntity(_0x5c9584,null))[_0xd550('0x3c')](handleError(_0x5c9584,null));};exports['describe']=function(_0x555556,_0x349cf6){return db[_0xd550('0x25')]['describe']()[_0xd550('0x1e')](respondWithResult(_0x349cf6,null))[_0xd550('0x3c')](handleError(_0x349cf6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 81c7c52..b8169d9 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 _0x9d54=['report_dial','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x3bd4cf,_0x3de055){var _0x44e7fe=function(_0x208a57){while(--_0x208a57){_0x3bd4cf['push'](_0x3bd4cf['shift']());}};_0x44e7fe(++_0x3de055);}(_0x9d54,0x155));var _0x49d5=function(_0x59f1d8,_0x5bbe38){_0x59f1d8=_0x59f1d8-0x0;var _0x44fa3f=_0x9d54[_0x59f1d8];return _0x44fa3f;};'use strict';var _=require('lodash');var util=require(_0x49d5('0x0'));var logger=require(_0x49d5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x49d5('0x2'));var rp=require(_0x49d5('0x3'));var fs=require('fs');var path=require(_0x49d5('0x4'));var rimraf=require(_0x49d5('0x5'));var config=require(_0x49d5('0x6'));var attributes=require(_0x49d5('0x7'));module['exports']=function(_0x49eff0,_0x2eac1f){return _0x49eff0[_0x49d5('0x8')]('VoiceDialReport',attributes,{'tableName':_0x49d5('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb26=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial'];(function(_0x4b3474,_0xf900bb){var _0x4a6327=function(_0x1d5e99){while(--_0x1d5e99){_0x4b3474['push'](_0x4b3474['shift']());}};_0x4a6327(++_0xf900bb);}(_0xdb26,0xb7));var _0x6db2=function(_0x40b09f,_0x161f4f){_0x40b09f=_0x40b09f-0x0;var _0x3dbee2=_0xdb26[_0x40b09f];return _0x3dbee2;};'use strict';var _=require(_0x6db2('0x0'));var util=require('util');var logger=require(_0x6db2('0x1'))(_0x6db2('0x2'));var moment=require(_0x6db2('0x3'));var BPromise=require(_0x6db2('0x4'));var rp=require(_0x6db2('0x5'));var fs=require('fs');var path=require(_0x6db2('0x6'));var rimraf=require(_0x6db2('0x7'));var config=require(_0x6db2('0x8'));var attributes=require(_0x6db2('0x9'));module['exports']=function(_0x57fcee,_0x592245){return _0x57fcee[_0x6db2('0xa')](_0x6db2('0xb'),attributes,{'tableName':_0x6db2('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d055eff..1e3c3f1 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 _0xb7ec=['request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','VoiceDialReport','create','options','CreateVoiceDialReport','UpdateVoiceDialReport','update','body','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xb7ec,0x1d3));var _0xcb7e=function(_0xe3f0b0,_0x43edc9){_0xe3f0b0=_0xe3f0b0-0x0;var _0x3a839e=_0xb7ec[_0xe3f0b0];return _0x3a839e;};'use strict';var _=require(_0xcb7e('0x0'));var util=require('util');var moment=require(_0xcb7e('0x1'));var BPromise=require(_0xcb7e('0x2'));var rs=require(_0xcb7e('0x3'));var fs=require('fs');var Redis=require(_0xcb7e('0x4'));var db=require(_0xcb7e('0x5'))['db'];var utils=require(_0xcb7e('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcb7e('0x7'));var client=jayson[_0xcb7e('0x8')][_0xcb7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b6178,_0x175dd4,_0x448dbc){return new BPromise(function(_0x272c9e,_0xe5b958){return client[_0xcb7e('0xa')](_0x3b6178,_0x448dbc)[_0xcb7e('0xb')](function(_0x103be5){logger['info'](_0xcb7e('0xc'),_0x175dd4,_0xcb7e('0xd'));logger[_0xcb7e('0xe')](_0xcb7e('0xf'),_0x175dd4,'request\x20sent',JSON['stringify'](_0x103be5));if(_0x103be5[_0xcb7e('0x10')]){if(_0x103be5[_0xcb7e('0x10')][_0xcb7e('0x11')]===0x1f4){logger[_0xcb7e('0x10')](_0xcb7e('0xc'),_0x175dd4,_0x103be5[_0xcb7e('0x10')][_0xcb7e('0x12')]);return _0xe5b958(_0x103be5[_0xcb7e('0x10')][_0xcb7e('0x12')]);}logger[_0xcb7e('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x175dd4,_0x103be5[_0xcb7e('0x10')][_0xcb7e('0x12')]);return _0x272c9e(_0x103be5[_0xcb7e('0x10')]['message']);}else{logger[_0xcb7e('0x13')](_0xcb7e('0xc'),_0x175dd4,_0xcb7e('0xd'));_0x272c9e(_0x103be5['result'][_0xcb7e('0x12')]);}})[_0xcb7e('0x14')](function(_0x55121f){logger[_0xcb7e('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x175dd4,_0x55121f);_0xe5b958(_0x55121f);});});}exports['CreateVoiceDialReport']=function(_0x21be6c){var _0x1a29b5=this;return new Promise(function(_0xb500d8,_0x14382c){return db[_0xcb7e('0x15')][_0xcb7e('0x16')](_0x21be6c['body'],{'raw':_0x21be6c[_0xcb7e('0x17')]?_0x21be6c[_0xcb7e('0x17')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x530b41){logger[_0xcb7e('0x13')](_0xcb7e('0x18'),_0x21be6c);logger[_0xcb7e('0xe')](_0xcb7e('0x18'),_0x21be6c,JSON['stringify'](_0x530b41));_0xb500d8(_0x530b41);})[_0xcb7e('0x14')](function(_0x3fcea8){logger[_0xcb7e('0x10')](_0xcb7e('0x18'),_0x3fcea8[_0xcb7e('0x12')],_0x21be6c);_0x14382c(_0x1a29b5[_0xcb7e('0x10')](0x1f4,_0x3fcea8[_0xcb7e('0x12')]));});});};exports[_0xcb7e('0x19')]=function(_0x345221){var _0x2acf4a=this;return new Promise(function(_0x28b805,_0x43549e){return db[_0xcb7e('0x15')][_0xcb7e('0x1a')](_0x345221[_0xcb7e('0x1b')],{'raw':_0x345221['options']?_0x345221[_0xcb7e('0x17')][_0xcb7e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345221[_0xcb7e('0x17')]?_0x345221['options'][_0xcb7e('0x1d')]||null:null,'attributes':_0x345221[_0xcb7e('0x17')]?_0x345221[_0xcb7e('0x17')][_0xcb7e('0x1e')]||null:null,'limit':_0x345221['options']?_0x345221[_0xcb7e('0x17')][_0xcb7e('0x1f')]||null:null})['then'](function(_0x390c93){logger[_0xcb7e('0x13')](_0xcb7e('0x19'),_0x345221);logger[_0xcb7e('0xe')](_0xcb7e('0x19'),_0x345221,JSON['stringify'](_0x390c93));_0x28b805(_0x390c93);})[_0xcb7e('0x14')](function(_0x5dd777){logger['error'](_0xcb7e('0x19'),_0x5dd777[_0xcb7e('0x12')],_0x345221);_0x43549e(_0x2acf4a[_0xcb7e('0x10')](0x1f4,_0x5dd777[_0xcb7e('0x12')]));});});}; \ No newline at end of file +var _0x8491=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','update','attributes','limit','UpdateVoiceDialReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x460205,_0x525d49){var _0x25c99e=function(_0x31738d){while(--_0x31738d){_0x460205['push'](_0x460205['shift']());}};_0x25c99e(++_0x525d49);}(_0x8491,0xcb));var _0x1849=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x8491[_0x24f31b];return _0x488401;};'use strict';var _=require('lodash');var util=require(_0x1849('0x0'));var moment=require(_0x1849('0x1'));var BPromise=require(_0x1849('0x2'));var rs=require(_0x1849('0x3'));var fs=require('fs');var Redis=require(_0x1849('0x4'));var db=require(_0x1849('0x5'))['db'];var utils=require(_0x1849('0x6'));var logger=require(_0x1849('0x7'))(_0x1849('0x8'));var config=require('../../config/environment');var jayson=require(_0x1849('0x9'));var client=jayson[_0x1849('0xa')][_0x1849('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c876c,_0x3a641e,_0x4a98a7){return new BPromise(function(_0x5633a1,_0x3b85ca){return client[_0x1849('0xc')](_0x4c876c,_0x4a98a7)[_0x1849('0xd')](function(_0x25ec90){logger[_0x1849('0xe')](_0x1849('0xf'),_0x3a641e,'request\x20sent');logger[_0x1849('0x10')](_0x1849('0x11'),_0x3a641e,_0x1849('0x12'),JSON[_0x1849('0x13')](_0x25ec90));if(_0x25ec90[_0x1849('0x14')]){if(_0x25ec90[_0x1849('0x14')][_0x1849('0x15')]===0x1f4){logger['error'](_0x1849('0xf'),_0x3a641e,_0x25ec90[_0x1849('0x14')][_0x1849('0x16')]);return _0x3b85ca(_0x25ec90[_0x1849('0x14')][_0x1849('0x16')]);}logger[_0x1849('0x14')](_0x1849('0xf'),_0x3a641e,_0x25ec90[_0x1849('0x14')]['message']);return _0x5633a1(_0x25ec90[_0x1849('0x14')][_0x1849('0x16')]);}else{logger[_0x1849('0xe')](_0x1849('0xf'),_0x3a641e,_0x1849('0x12'));_0x5633a1(_0x25ec90[_0x1849('0x17')][_0x1849('0x16')]);}})[_0x1849('0x18')](function(_0x39e13d){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3a641e,_0x39e13d);_0x3b85ca(_0x39e13d);});});}exports[_0x1849('0x19')]=function(_0x24dba7){var _0x35ed16=this;return new Promise(function(_0xf253a3,_0x4f2f7a){return db[_0x1849('0x1a')][_0x1849('0x1b')](_0x24dba7[_0x1849('0x1c')],{'raw':_0x24dba7[_0x1849('0x1d')]?_0x24dba7[_0x1849('0x1d')][_0x1849('0x1e')]===undefined?!![]:![]:!![]})[_0x1849('0xd')](function(_0x96a360){logger[_0x1849('0xe')](_0x1849('0x19'),_0x24dba7);logger[_0x1849('0x10')](_0x1849('0x19'),_0x24dba7,JSON['stringify'](_0x96a360));_0xf253a3(_0x96a360);})[_0x1849('0x18')](function(_0x143adc){logger[_0x1849('0x14')]('CreateVoiceDialReport',_0x143adc[_0x1849('0x16')],_0x24dba7);_0x4f2f7a(_0x35ed16['error'](0x1f4,_0x143adc['message']));});});};exports['UpdateVoiceDialReport']=function(_0x31f8a1){var _0xa7c6eb=this;return new Promise(function(_0x7b285b,_0x4aa360){return db[_0x1849('0x1a')][_0x1849('0x1f')](_0x31f8a1[_0x1849('0x1c')],{'raw':_0x31f8a1[_0x1849('0x1d')]?_0x31f8a1[_0x1849('0x1d')][_0x1849('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31f8a1[_0x1849('0x1d')]?_0x31f8a1[_0x1849('0x1d')]['where']||null:null,'attributes':_0x31f8a1[_0x1849('0x1d')]?_0x31f8a1[_0x1849('0x1d')][_0x1849('0x20')]||null:null,'limit':_0x31f8a1[_0x1849('0x1d')]?_0x31f8a1['options'][_0x1849('0x21')]||null:null})['then'](function(_0x1a0664){logger[_0x1849('0xe')]('UpdateVoiceDialReport',_0x31f8a1);logger[_0x1849('0x10')](_0x1849('0x22'),_0x31f8a1,JSON[_0x1849('0x13')](_0x1a0664));_0x7b285b(_0x1a0664);})['catch'](function(_0x37ff50){logger['error']('UpdateVoiceDialReport',_0x37ff50[_0x1849('0x16')],_0x31f8a1);_0x4aa360(_0xa7c6eb[_0x1849('0x14')](0x1f4,_0x37ff50[_0x1849('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 61a2f9d..55a9218 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 _0x3d9b=['multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','show','post','/:id/applications','put','/:id','update','destroy','exports'];(function(_0x23099a,_0x2b5805){var _0x37d69c=function(_0xd2830e){while(--_0xd2830e){_0x23099a['push'](_0x23099a['shift']());}};_0x37d69c(++_0x2b5805);}(_0x3d9b,0xf7));var _0xb3d9=function(_0xb0155,_0x2fb24a){_0xb0155=_0xb0155-0x0;var _0x2c1297=_0x3d9b[_0xb0155];return _0x2c1297;};'use strict';var multer=require(_0xb3d9('0x0'));var util=require(_0xb3d9('0x1'));var path=require('path');var timeout=require(_0xb3d9('0x2'));var express=require(_0xb3d9('0x3'));var router=express[_0xb3d9('0x4')]();var fs_extra=require(_0xb3d9('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3d9('0x6'));var controller=require(_0xb3d9('0x7'));router['get']('/',auth[_0xb3d9('0x8')](),controller[_0xb3d9('0x9')]);router[_0xb3d9('0xa')]('/:id',auth[_0xb3d9('0x8')](),controller[_0xb3d9('0xb')]);router['post']('/',auth[_0xb3d9('0x8')](),controller['create']);router[_0xb3d9('0xc')](_0xb3d9('0xd'),auth[_0xb3d9('0x8')](),controller['addApplications']);router[_0xb3d9('0xe')](_0xb3d9('0xf'),auth['isAuthenticated'](),controller[_0xb3d9('0x10')]);router['delete'](_0xb3d9('0xf'),auth[_0xb3d9('0x8')](),controller[_0xb3d9('0x11')]);module[_0xb3d9('0x12')]=router; \ No newline at end of file +var _0xcc50=['show','create','post','addApplications','put','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','/:id'];(function(_0x8e6852,_0x52454){var _0x2522bc=function(_0x4834c5){while(--_0x4834c5){_0x8e6852['push'](_0x8e6852['shift']());}};_0x2522bc(++_0x52454);}(_0xcc50,0x11e));var _0x0cc5=function(_0x4c39f5,_0x109684){_0x4c39f5=_0x4c39f5-0x0;var _0x1db24f=_0xcc50[_0x4c39f5];return _0x1db24f;};'use strict';var multer=require(_0x0cc5('0x0'));var util=require(_0x0cc5('0x1'));var path=require('path');var timeout=require(_0x0cc5('0x2'));var express=require(_0x0cc5('0x3'));var router=express[_0x0cc5('0x4')]();var fs_extra=require(_0x0cc5('0x5'));var auth=require(_0x0cc5('0x6'));var interaction=require(_0x0cc5('0x7'));var config=require(_0x0cc5('0x8'));var controller=require(_0x0cc5('0x9'));router['get']('/',auth[_0x0cc5('0xa')](),controller[_0x0cc5('0xb')]);router[_0x0cc5('0xc')](_0x0cc5('0xd'),auth[_0x0cc5('0xa')](),controller[_0x0cc5('0xe')]);router['post']('/',auth[_0x0cc5('0xa')](),controller[_0x0cc5('0xf')]);router[_0x0cc5('0x10')]('/:id/applications',auth['isAuthenticated'](),controller[_0x0cc5('0x11')]);router[_0x0cc5('0x12')](_0x0cc5('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0cc5('0xd'),auth['isAuthenticated'](),controller[_0x0cc5('0x13')]);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 30a7969..9c488a9 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 _0xcb91=['outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','inbound'];(function(_0x1a2647,_0xdb9b37){var _0x252914=function(_0x567d09){while(--_0x567d09){_0x1a2647['push'](_0x1a2647['shift']());}};_0x252914(++_0xdb9b37);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xcb91[_0x478c8a];return _0x3b6b3e;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'unique':_0x1cb9('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x1cb9('0x1')},'tag':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x2')},'appdata':{'type':Sequelize[_0x1cb9('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x1cb9('0x3'),_0x1cb9('0x4'),'internal',_0x1cb9('0x5'),_0x1cb9('0x6'),'system',_0x1cb9('0x7')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x8')},'IntervalId':{'type':Sequelize[_0x1cb9('0x9')]},'isApp':{'type':Sequelize[_0x1cb9('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x1cb9('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x1cb9('0x9')]},'recordingFormat':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':_0x1cb9('0xb')},'answer':{'type':Sequelize[_0x1cb9('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x1cb9('0xc')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x134867,_0x5e6aed){var _0x2c9ea5=function(_0x171f7a){while(--_0x171f7a){_0x134867['push'](_0x134867['shift']());}};_0x2c9ea5(++_0x5e6aed);}(_0xb7e7,0x121));var _0x7b7e=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xb7e7[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index febe348..0b5a249 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 _0x61fe=['InternalRoutes','internal','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','show','filters','catch','create','body','startsWith','concat','exten','user','UserProfileSection','userProfileId','autoAssociation','update','params','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','get','InboundRoutes','OutboundRoutes','outbound'];(function(_0x4a9f24,_0x43c422){var _0x13199b=function(_0x1596af){while(--_0x1596af){_0x4a9f24['push'](_0x4a9f24['shift']());}};_0x13199b(++_0x43c422);}(_0x61fe,0xfd));var _0xe61f=function(_0x50b107,_0x1ff9a3){_0x50b107=_0x50b107-0x0;var _0x4b39b4=_0x61fe[_0x50b107];return _0x4b39b4;};'use strict';var _=require('lodash');var Redis=require(_0xe61f('0x0'));var qs=require(_0xe61f('0x1'));var logger=require('../../config/logger')(_0xe61f('0x2'));var config=require(_0xe61f('0x3'));var db=require(_0xe61f('0x4'))['db'];config['redis']=_[_0xe61f('0x5')](config['redis'],{'host':_0xe61f('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe61f('0x7')]));require(_0xe61f('0x8'))[_0xe61f('0x9')](socket);function respondWithStatusCode(_0x562d33,_0x2d46c2){_0x2d46c2=_0x2d46c2||0xcc;return function(_0x1617ad){if(_0x1617ad){return _0x562d33[_0xe61f('0xa')](_0x2d46c2);}return _0x562d33[_0xe61f('0xb')](_0x2d46c2)[_0xe61f('0xc')]();};}function respondWithResult(_0x44a4d0,_0xd16da2){_0xd16da2=_0xd16da2||0xc8;return function(_0x94d220){if(_0x94d220){return _0x44a4d0[_0xe61f('0xb')](_0xd16da2)[_0xe61f('0xd')](_0x94d220);}};}function respondWithFilteredResult(_0x2b2a49,_0x25731b){return function(_0x5b36d7){if(_0x5b36d7){var _0x2a6712=typeof _0x25731b[_0xe61f('0xe')]===_0xe61f('0xf')&&typeof _0x25731b[_0xe61f('0x10')]==='undefined';var _0x1afd8a=_0x5b36d7['count'];var _0x6ee730=_0x2a6712?0x0:_0x25731b['offset'];var _0x1f0997=_0x2a6712?_0x5b36d7[_0xe61f('0x11')]:_0x25731b[_0xe61f('0xe')]+_0x25731b['limit'];var _0x28c1b8;if(_0x1f0997>=_0x1afd8a){_0x1f0997=_0x1afd8a;_0x28c1b8=0xc8;}else{_0x28c1b8=0xce;}_0x2b2a49[_0xe61f('0xb')](_0x28c1b8);return _0x2b2a49[_0xe61f('0x12')](_0xe61f('0x13'),_0x6ee730+'-'+_0x1f0997+'/'+_0x1afd8a)[_0xe61f('0xd')](_0x5b36d7);}return null;};}function removeEntity(_0x101a8f){return function(_0x2390f7){if(_0x2390f7){return _0x2390f7[_0xe61f('0x14')]()[_0xe61f('0x15')](function(){var _0x31f292=_0x2390f7[_0xe61f('0x16')]({'plain':!![]});var _0x13f7d5=[{'name':_0xe61f('0x17'),'value':'inbound','ignore':![]},{'name':_0xe61f('0x18'),'value':_0xe61f('0x19'),'ignore':![]},{'name':_0xe61f('0x1a'),'value':_0xe61f('0x1b'),'ignore':![]}];var _0x28f3bb=_(_0x13f7d5)[_0xe61f('0x1c')](_0xe61f('0x1d'))['map'](_0xe61f('0x1e'))[_0xe61f('0x1e')]();if(_[_0xe61f('0x1f')](_0x28f3bb,_0x31f292[_0xe61f('0x20')])){return;}var _0x56d27a=_[_0xe61f('0x21')](_0x13f7d5,[_0xe61f('0x1e'),_0x31f292[_0xe61f('0x20')]])[_0xe61f('0x22')];return db[_0xe61f('0x23')][_0xe61f('0x14')]({'where':{'type':_0x56d27a,'resourceId':_0x31f292['id']}})['then'](function(){return _0x2390f7;});})[_0xe61f('0x15')](function(){_0x101a8f[_0xe61f('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24aa40){return function(_0x22186b){if(!_0x22186b){_0x24aa40[_0xe61f('0xa')](0x194);}return _0x22186b;};}function handleError(_0x53fa57,_0x48d61d){_0x48d61d=_0x48d61d||0x1f4;return function(_0x1f3fbc){logger[_0xe61f('0x24')](_0x1f3fbc[_0xe61f('0x25')]);if(_0x1f3fbc[_0xe61f('0x22')]){delete _0x1f3fbc[_0xe61f('0x22')];}_0x53fa57['status'](_0x48d61d)['send'](_0x1f3fbc);};}exports[_0xe61f('0x26')]=function(_0x328cc4,_0x88b198){var _0x34a16a={},_0x49c5b4={},_0x211686={'count':0x0,'rows':[]};var _0x54ae6b=_[_0xe61f('0x27')](db[_0xe61f('0x28')][_0xe61f('0x29')],function(_0x1157c5){return{'name':_0x1157c5[_0xe61f('0x2a')],'type':_0x1157c5[_0xe61f('0x20')][_0xe61f('0x2b')]};});_0x49c5b4[_0xe61f('0x2c')]=_[_0xe61f('0x27')](_0x54ae6b,_0xe61f('0x22'));_0x49c5b4[_0xe61f('0x2d')]=_[_0xe61f('0x2e')](_0x328cc4[_0xe61f('0x2d')]);_0x49c5b4['filters']=_[_0xe61f('0x2f')](_0x49c5b4[_0xe61f('0x2c')],_0x49c5b4[_0xe61f('0x2d')]);_0x34a16a[_0xe61f('0x30')]=_['intersection'](_0x49c5b4[_0xe61f('0x2c')],qs[_0xe61f('0x31')](_0x328cc4[_0xe61f('0x2d')][_0xe61f('0x31')]));_0x34a16a['attributes']=_0x34a16a[_0xe61f('0x30')][_0xe61f('0x32')]?_0x34a16a[_0xe61f('0x30')]:_0x49c5b4['model'];if(!_0x328cc4[_0xe61f('0x2d')]['hasOwnProperty'](_0xe61f('0x33'))){_0x34a16a['limit']=qs[_0xe61f('0x10')](_0x328cc4[_0xe61f('0x2d')][_0xe61f('0x10')]);_0x34a16a[_0xe61f('0xe')]=qs[_0xe61f('0xe')](_0x328cc4[_0xe61f('0x2d')][_0xe61f('0xe')]);}_0x34a16a[_0xe61f('0x34')]=qs[_0xe61f('0x35')](_0x328cc4[_0xe61f('0x2d')][_0xe61f('0x35')]);_0x34a16a['where']=qs['filters'](_[_0xe61f('0x36')](_0x328cc4[_0xe61f('0x2d')],_0x49c5b4['filters']),_0x54ae6b);if(_0x328cc4['query']['filter']){_0x34a16a[_0xe61f('0x37')]=_[_0xe61f('0x38')](_0x34a16a[_0xe61f('0x37')],{'$or':_[_0xe61f('0x27')](_0x54ae6b,function(_0x131314){if(_0x131314[_0xe61f('0x20')]!==_0xe61f('0x39')){var _0x2c2aea={};_0x2c2aea[_0x131314[_0xe61f('0x22')]]={'$like':'%'+_0x328cc4['query'][_0xe61f('0x1c')]+'%'};return _0x2c2aea;}})});}_0x34a16a=_[_0xe61f('0x38')]({},_0x34a16a,_0x328cc4[_0xe61f('0x3a')]);var _0x26e771={'where':_0x34a16a[_0xe61f('0x37')]};return db[_0xe61f('0x28')][_0xe61f('0x11')](_0x26e771)[_0xe61f('0x15')](function(_0x111a3e){_0x211686['count']=_0x111a3e;if(_0x328cc4['query'][_0xe61f('0x3b')]){_0x34a16a[_0xe61f('0x3c')]=[{'all':!![]}];}return db[_0xe61f('0x28')][_0xe61f('0x3d')](_0x34a16a);})[_0xe61f('0x15')](function(_0x329fab){_0x211686['rows']=_0x329fab;return _0x211686;})[_0xe61f('0x15')](respondWithFilteredResult(_0x88b198,_0x34a16a))['catch'](handleError(_0x88b198,null));};exports[_0xe61f('0x3e')]=function(_0x12f181,_0x43fcab){var _0x5e8d61={'raw':![],'where':{'id':_0x12f181['params']['id']}},_0x545a5e={};_0x545a5e[_0xe61f('0x2c')]=_[_0xe61f('0x2e')](db[_0xe61f('0x28')][_0xe61f('0x29')]);_0x545a5e[_0xe61f('0x2d')]=_[_0xe61f('0x2e')](_0x12f181['query']);_0x545a5e[_0xe61f('0x3f')]=_[_0xe61f('0x2f')](_0x545a5e[_0xe61f('0x2c')],_0x545a5e[_0xe61f('0x2d')]);_0x5e8d61[_0xe61f('0x30')]=_['intersection'](_0x545a5e[_0xe61f('0x2c')],qs['fields'](_0x12f181[_0xe61f('0x2d')][_0xe61f('0x31')]));_0x5e8d61['attributes']=_0x5e8d61[_0xe61f('0x30')][_0xe61f('0x32')]?_0x5e8d61[_0xe61f('0x30')]:_0x545a5e[_0xe61f('0x2c')];if(_0x12f181[_0xe61f('0x2d')][_0xe61f('0x3b')]){_0x5e8d61[_0xe61f('0x3c')]=[{'all':!![]}];}_0x5e8d61=_['merge']({},_0x5e8d61,_0x12f181[_0xe61f('0x3a')]);return db[_0xe61f('0x28')]['find'](_0x5e8d61)['then'](handleEntityNotFound(_0x43fcab,null))[_0xe61f('0x15')](respondWithResult(_0x43fcab,null))[_0xe61f('0x40')](handleError(_0x43fcab,null));};exports[_0xe61f('0x14')]=function(_0x3ab414,_0x398afd){return db['VoiceExtension'][_0xe61f('0x21')]({'where':{'id':_0x3ab414['params']['id']}})['then'](handleEntityNotFound(_0x398afd,null))['then'](removeEntity(_0x398afd,null))[_0xe61f('0x40')](handleError(_0x398afd,null));};exports[_0xe61f('0x41')]=function(_0x2fca4d,_0x5a4821){if(_0x2fca4d[_0xe61f('0x42')][_0xe61f('0x20')]===_0xe61f('0x19')&&!_[_0xe61f('0x43')](_0x2fca4d[_0xe61f('0x42')]['exten'],'_')){_0x2fca4d[_0xe61f('0x42')]['exten']='_'[_0xe61f('0x44')](_0x2fca4d[_0xe61f('0x42')][_0xe61f('0x45')]);}return db['VoiceExtension'][_0xe61f('0x41')](_0x2fca4d[_0xe61f('0x42')],{'raw':![]})['then'](function(_0x1759f5){var _0x3433a7=_0x2fca4d[_0xe61f('0x46')]['get']({'plain':!![]});if(!_0x3433a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3433a7['role']===_0xe61f('0x46')){var _0x3c6f2c=_0x1759f5[_0xe61f('0x16')]({'plain':!![]});var _0x11e0e6=[{'name':_0xe61f('0x17'),'value':'inbound'},{'name':_0xe61f('0x18'),'value':_0xe61f('0x19')},{'name':'InternalRoutes','value':_0xe61f('0x1b')}];var _0x321551=_[_0xe61f('0x21')](_0x11e0e6,['value',_0x3c6f2c[_0xe61f('0x20')]])[_0xe61f('0x22')];return db[_0xe61f('0x47')]['find']({'where':{'name':_0x321551,'userProfileId':_0x3433a7[_0xe61f('0x48')]},'raw':!![]})[_0xe61f('0x15')](function(_0x3278c8){if(_0x3278c8&&_0x3278c8[_0xe61f('0x49')]===0x0){return db[_0xe61f('0x23')][_0xe61f('0x41')]({'name':_0x3c6f2c['name'],'resourceId':_0x3c6f2c['id'],'type':_0x3278c8[_0xe61f('0x22')],'sectionId':_0x3278c8['id']},{})[_0xe61f('0x15')](function(){return _0x1759f5;});}else{return _0x1759f5;}})[_0xe61f('0x40')](function(_0x3cba89){logger[_0xe61f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cba89);throw _0x3cba89;});}return _0x1759f5;})[_0xe61f('0x15')](respondWithResult(_0x5a4821,0xc9))['catch'](handleError(_0x5a4821,null));};exports[_0xe61f('0x4a')]=function(_0x31da7b,_0x54bf78){if(_0x31da7b[_0xe61f('0x42')]['id']){delete _0x31da7b[_0xe61f('0x42')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x31da7b[_0xe61f('0x4b')]['id']}})[_0xe61f('0x15')](handleEntityNotFound(_0x54bf78,null))['then'](function(_0x5d0805){if(_0x5d0805){return db[_0xe61f('0x28')]['update'](_[_0xe61f('0x36')](_0x31da7b[_0xe61f('0x42')],['exten','context',_0xe61f('0x4c'),_0xe61f('0x4d'),_0xe61f('0x4e'),_0xe61f('0x4f'),_0xe61f('0x50')]),{'where':{'context':_0x5d0805[_0xe61f('0x51')],'exten':_0x5d0805['exten']},'individualHooks':!![]})[_0xe61f('0x15')](function(_0xa08119){return _0xa08119;});}return null;})[_0xe61f('0x15')](respondWithStatusCode(_0x54bf78,null))[_0xe61f('0x40')](handleError(_0x54bf78,null));};exports['addApplications']=function(_0x353f54,_0x5ef6d1){var _0x374ae8=_0x353f54['params']['id'];var _0x5c0a9f=_0x353f54[_0xe61f('0x42')];var _0x32e97e=0xc8;var _0x3e350f=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xe61f('0x52')][_0xe61f('0x53')][_0xe61f('0x54')]['READ_COMMITTED']},function(_0x12e193){return db[_0xe61f('0x28')][_0xe61f('0x55')]({'where':{'id':_0x374ae8},'transaction':_0x12e193})[_0xe61f('0x15')](function(_0x1c8d7a){if(_0x1c8d7a){return db[_0xe61f('0x28')][_0xe61f('0x14')]({'where':{'VoiceExtensionId':_0x374ae8},'transaction':_0x12e193})['then'](function(){var _0x28934a=_[_0xe61f('0x27')](_0x5c0a9f,function(_0x1bdfda){_0x1bdfda[_0xe61f('0x56')]=_0x374ae8;_0x1bdfda[_0xe61f('0x57')]=!![];return _0x1bdfda;});return _0x1c8d7a[_0xe61f('0x58')](_0x28934a);})[_0xe61f('0x15')](function(_0x396222){return db[_0xe61f('0x28')][_0xe61f('0x59')](_0x396222,{'transaction':_0x12e193});});}else{_0x32e97e=0x194;_0x3e350f=[];}});})[_0xe61f('0x15')](function(){if(_0x32e97e!==0x194){return db[_0xe61f('0x28')][_0xe61f('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x374ae8},'order':_0xe61f('0x5b')})['then'](function(_0xc6a134){_0x3e350f=_0xc6a134;});}})[_0xe61f('0x40')](function(_0x5f1a57){_0x32e97e=0x1f4;logger[_0xe61f('0x24')](_0x5f1a57[_0xe61f('0x25')]);if(_0x5f1a57['name']){delete _0x5f1a57[_0xe61f('0x22')];}_0x3e350f=_0x5f1a57;})[_0xe61f('0x5c')](function(){if(_0x3e350f===null){_0x5ef6d1['sendStatus'](_0x32e97e);}else{if(_0x32e97e===0x1f4){_0x5ef6d1['status'](_0x32e97e)['send'](_0x3e350f);}else{_0x5ef6d1[_0xe61f('0xb')](_0x32e97e)[_0xe61f('0xd')](_0x3e350f);}}});}; \ No newline at end of file +var _0xf0ea=['socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','get','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','exten','concat','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','internal','UserProfileSection','userProfileId','autoAssociation','update','context','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x33bb6f,_0x8516dd){var _0x29f99a=function(_0x1412f6){while(--_0x1412f6){_0x33bb6f['push'](_0x33bb6f['shift']());}};_0x29f99a(++_0x8516dd);}(_0xf0ea,0x17f));var _0xaf0e=function(_0x5d6754,_0x1acdc1){_0x5d6754=_0x5d6754-0x0;var _0x469103=_0xf0ea[_0x5d6754];return _0x469103;};'use strict';var _=require(_0xaf0e('0x0'));var Redis=require(_0xaf0e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xaf0e('0x2'))(_0xaf0e('0x3'));var config=require(_0xaf0e('0x4'));var db=require(_0xaf0e('0x5'))['db'];config[_0xaf0e('0x6')]=_[_0xaf0e('0x7')](config['redis'],{'host':_0xaf0e('0x8'),'port':0x18eb});var socket=require(_0xaf0e('0x9'))(new Redis(config[_0xaf0e('0x6')]));require('./voiceExtension.socket')[_0xaf0e('0xa')](socket);function respondWithStatusCode(_0x5f1644,_0x37fbd3){_0x37fbd3=_0x37fbd3||0xcc;return function(_0x243c9d){if(_0x243c9d){return _0x5f1644[_0xaf0e('0xb')](_0x37fbd3);}return _0x5f1644[_0xaf0e('0xc')](_0x37fbd3)[_0xaf0e('0xd')]();};}function respondWithResult(_0x4f3434,_0xc03e49){_0xc03e49=_0xc03e49||0xc8;return function(_0x2cdae0){if(_0x2cdae0){return _0x4f3434[_0xaf0e('0xc')](_0xc03e49)['json'](_0x2cdae0);}};}function respondWithFilteredResult(_0x44950a,_0x2e78d8){return function(_0x6c1171){if(_0x6c1171){var _0x42e329=typeof _0x2e78d8[_0xaf0e('0xe')]===_0xaf0e('0xf')&&typeof _0x2e78d8[_0xaf0e('0x10')]===_0xaf0e('0xf');var _0x3c629d=_0x6c1171['count'];var _0x28725b=_0x42e329?0x0:_0x2e78d8[_0xaf0e('0xe')];var _0x11a6ac=_0x42e329?_0x6c1171[_0xaf0e('0x11')]:_0x2e78d8[_0xaf0e('0xe')]+_0x2e78d8[_0xaf0e('0x10')];var _0x44a780;if(_0x11a6ac>=_0x3c629d){_0x11a6ac=_0x3c629d;_0x44a780=0xc8;}else{_0x44a780=0xce;}_0x44950a[_0xaf0e('0xc')](_0x44a780);return _0x44950a[_0xaf0e('0x12')](_0xaf0e('0x13'),_0x28725b+'-'+_0x11a6ac+'/'+_0x3c629d)[_0xaf0e('0x14')](_0x6c1171);}return null;};}function removeEntity(_0x1ce7a7){return function(_0x4efc62){if(_0x4efc62){return _0x4efc62[_0xaf0e('0x15')]()[_0xaf0e('0x16')](function(){var _0x546f92=_0x4efc62[_0xaf0e('0x17')]({'plain':!![]});var _0x59d968=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0xaf0e('0x18'),'value':_0xaf0e('0x19'),'ignore':![]},{'name':_0xaf0e('0x1a'),'value':'internal','ignore':![]}];var _0x244612=_(_0x59d968)[_0xaf0e('0x1b')](_0xaf0e('0x1c'))[_0xaf0e('0x1d')](_0xaf0e('0x1e'))[_0xaf0e('0x1e')]();if(_[_0xaf0e('0x1f')](_0x244612,_0x546f92[_0xaf0e('0x20')])){return;}var _0x40e7c3=_['find'](_0x59d968,['value',_0x546f92[_0xaf0e('0x20')]])['name'];return db[_0xaf0e('0x21')][_0xaf0e('0x15')]({'where':{'type':_0x40e7c3,'resourceId':_0x546f92['id']}})[_0xaf0e('0x16')](function(){return _0x4efc62;});})[_0xaf0e('0x16')](function(){_0x1ce7a7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xd14fce){return function(_0x5535c5){if(!_0x5535c5){_0xd14fce['sendStatus'](0x194);}return _0x5535c5;};}function handleError(_0x1323d2,_0x4439b7){_0x4439b7=_0x4439b7||0x1f4;return function(_0x44d502){logger[_0xaf0e('0x22')](_0x44d502[_0xaf0e('0x23')]);if(_0x44d502[_0xaf0e('0x24')]){delete _0x44d502[_0xaf0e('0x24')];}_0x1323d2[_0xaf0e('0xc')](_0x4439b7)[_0xaf0e('0x25')](_0x44d502);};}exports[_0xaf0e('0x26')]=function(_0x2d8e7d,_0x19d2bb){var _0x5e404e={},_0x1b8fba={},_0xd5f045={'count':0x0,'rows':[]};var _0x3a1d3a=_[_0xaf0e('0x1d')](db[_0xaf0e('0x27')][_0xaf0e('0x28')],function(_0x37cfec){return{'name':_0x37cfec[_0xaf0e('0x29')],'type':_0x37cfec[_0xaf0e('0x20')]['key']};});_0x1b8fba[_0xaf0e('0x2a')]=_[_0xaf0e('0x1d')](_0x3a1d3a,_0xaf0e('0x24'));_0x1b8fba[_0xaf0e('0x2b')]=_[_0xaf0e('0x2c')](_0x2d8e7d[_0xaf0e('0x2b')]);_0x1b8fba[_0xaf0e('0x2d')]=_[_0xaf0e('0x2e')](_0x1b8fba[_0xaf0e('0x2a')],_0x1b8fba['query']);_0x5e404e[_0xaf0e('0x2f')]=_[_0xaf0e('0x2e')](_0x1b8fba[_0xaf0e('0x2a')],qs[_0xaf0e('0x30')](_0x2d8e7d[_0xaf0e('0x2b')]['fields']));_0x5e404e[_0xaf0e('0x2f')]=_0x5e404e[_0xaf0e('0x2f')][_0xaf0e('0x31')]?_0x5e404e['attributes']:_0x1b8fba[_0xaf0e('0x2a')];if(!_0x2d8e7d[_0xaf0e('0x2b')][_0xaf0e('0x32')](_0xaf0e('0x33'))){_0x5e404e['limit']=qs[_0xaf0e('0x10')](_0x2d8e7d[_0xaf0e('0x2b')]['limit']);_0x5e404e[_0xaf0e('0xe')]=qs[_0xaf0e('0xe')](_0x2d8e7d[_0xaf0e('0x2b')][_0xaf0e('0xe')]);}_0x5e404e[_0xaf0e('0x34')]=qs[_0xaf0e('0x35')](_0x2d8e7d[_0xaf0e('0x2b')][_0xaf0e('0x35')]);_0x5e404e[_0xaf0e('0x36')]=qs[_0xaf0e('0x2d')](_[_0xaf0e('0x37')](_0x2d8e7d['query'],_0x1b8fba['filters']),_0x3a1d3a);if(_0x2d8e7d[_0xaf0e('0x2b')]['filter']){_0x5e404e[_0xaf0e('0x36')]=_[_0xaf0e('0x38')](_0x5e404e[_0xaf0e('0x36')],{'$or':_[_0xaf0e('0x1d')](_0x3a1d3a,function(_0x52f9da){if(_0x52f9da[_0xaf0e('0x20')]!==_0xaf0e('0x39')){var _0x440e2e={};_0x440e2e[_0x52f9da[_0xaf0e('0x24')]]={'$like':'%'+_0x2d8e7d[_0xaf0e('0x2b')][_0xaf0e('0x1b')]+'%'};return _0x440e2e;}})});}_0x5e404e=_[_0xaf0e('0x38')]({},_0x5e404e,_0x2d8e7d[_0xaf0e('0x3a')]);var _0x30cc6f={'where':_0x5e404e[_0xaf0e('0x36')]};return db['VoiceExtension']['count'](_0x30cc6f)[_0xaf0e('0x16')](function(_0x2a0032){_0xd5f045[_0xaf0e('0x11')]=_0x2a0032;if(_0x2d8e7d['query'][_0xaf0e('0x3b')]){_0x5e404e[_0xaf0e('0x3c')]=[{'all':!![]}];}return db[_0xaf0e('0x27')][_0xaf0e('0x3d')](_0x5e404e);})[_0xaf0e('0x16')](function(_0xfdfcb7){_0xd5f045[_0xaf0e('0x3e')]=_0xfdfcb7;return _0xd5f045;})[_0xaf0e('0x16')](respondWithFilteredResult(_0x19d2bb,_0x5e404e))[_0xaf0e('0x3f')](handleError(_0x19d2bb,null));};exports[_0xaf0e('0x40')]=function(_0x304587,_0x250bdd){var _0x46eee3={'raw':![],'where':{'id':_0x304587[_0xaf0e('0x41')]['id']}},_0x28eabc={};_0x28eabc['model']=_[_0xaf0e('0x2c')](db['VoiceExtension'][_0xaf0e('0x28')]);_0x28eabc[_0xaf0e('0x2b')]=_['keys'](_0x304587[_0xaf0e('0x2b')]);_0x28eabc[_0xaf0e('0x2d')]=_['intersection'](_0x28eabc[_0xaf0e('0x2a')],_0x28eabc['query']);_0x46eee3[_0xaf0e('0x2f')]=_[_0xaf0e('0x2e')](_0x28eabc[_0xaf0e('0x2a')],qs[_0xaf0e('0x30')](_0x304587['query'][_0xaf0e('0x30')]));_0x46eee3['attributes']=_0x46eee3[_0xaf0e('0x2f')]['length']?_0x46eee3[_0xaf0e('0x2f')]:_0x28eabc[_0xaf0e('0x2a')];if(_0x304587['query'][_0xaf0e('0x3b')]){_0x46eee3[_0xaf0e('0x3c')]=[{'all':!![]}];}_0x46eee3=_[_0xaf0e('0x38')]({},_0x46eee3,_0x304587['options']);return db[_0xaf0e('0x27')][_0xaf0e('0x42')](_0x46eee3)[_0xaf0e('0x16')](handleEntityNotFound(_0x250bdd,null))[_0xaf0e('0x16')](respondWithResult(_0x250bdd,null))[_0xaf0e('0x3f')](handleError(_0x250bdd,null));};exports[_0xaf0e('0x15')]=function(_0x21bc83,_0x1e2bf2){return db[_0xaf0e('0x27')][_0xaf0e('0x42')]({'where':{'id':_0x21bc83[_0xaf0e('0x41')]['id']}})[_0xaf0e('0x16')](handleEntityNotFound(_0x1e2bf2,null))['then'](removeEntity(_0x1e2bf2,null))[_0xaf0e('0x3f')](handleError(_0x1e2bf2,null));};exports['create']=function(_0x5f11b6,_0x464d0e){if(_0x5f11b6[_0xaf0e('0x43')]['type']===_0xaf0e('0x19')&&!_['startsWith'](_0x5f11b6[_0xaf0e('0x43')][_0xaf0e('0x44')],'_')){_0x5f11b6[_0xaf0e('0x43')]['exten']='_'[_0xaf0e('0x45')](_0x5f11b6[_0xaf0e('0x43')][_0xaf0e('0x44')]);}return db['VoiceExtension'][_0xaf0e('0x46')](_0x5f11b6['body'],{'raw':![]})[_0xaf0e('0x16')](function(_0x5dcc88){var _0xc2f9e9=_0x5f11b6['user'][_0xaf0e('0x17')]({'plain':!![]});if(!_0xc2f9e9)throw new Error(_0xaf0e('0x47'));if(_0xc2f9e9[_0xaf0e('0x48')]===_0xaf0e('0x49')){var _0x4356a1=_0x5dcc88[_0xaf0e('0x17')]({'plain':!![]});var _0x28759b=[{'name':'InboundRoutes','value':_0xaf0e('0x4a')},{'name':_0xaf0e('0x18'),'value':_0xaf0e('0x19')},{'name':_0xaf0e('0x1a'),'value':_0xaf0e('0x4b')}];var _0xca2cd0=_[_0xaf0e('0x42')](_0x28759b,[_0xaf0e('0x1e'),_0x4356a1['type']])['name'];return db[_0xaf0e('0x4c')]['find']({'where':{'name':_0xca2cd0,'userProfileId':_0xc2f9e9[_0xaf0e('0x4d')]},'raw':!![]})[_0xaf0e('0x16')](function(_0x222a74){if(_0x222a74&&_0x222a74[_0xaf0e('0x4e')]===0x0){return db['UserProfileResource'][_0xaf0e('0x46')]({'name':_0x4356a1[_0xaf0e('0x24')],'resourceId':_0x4356a1['id'],'type':_0x222a74[_0xaf0e('0x24')],'sectionId':_0x222a74['id']},{})['then'](function(){return _0x5dcc88;});}else{return _0x5dcc88;}})[_0xaf0e('0x3f')](function(_0x20a9c5){logger[_0xaf0e('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20a9c5);throw _0x20a9c5;});}return _0x5dcc88;})[_0xaf0e('0x16')](respondWithResult(_0x464d0e,0xc9))[_0xaf0e('0x3f')](handleError(_0x464d0e,null));};exports[_0xaf0e('0x4f')]=function(_0x462b78,_0x183a9a){if(_0x462b78['body']['id']){delete _0x462b78[_0xaf0e('0x43')]['id'];}return db[_0xaf0e('0x27')][_0xaf0e('0x42')]({'where':{'id':_0x462b78[_0xaf0e('0x41')]['id']}})[_0xaf0e('0x16')](handleEntityNotFound(_0x183a9a,null))[_0xaf0e('0x16')](function(_0x17a54a){if(_0x17a54a){return db[_0xaf0e('0x27')][_0xaf0e('0x4f')](_[_0xaf0e('0x37')](_0x462b78[_0xaf0e('0x43')],[_0xaf0e('0x44'),_0xaf0e('0x50'),'description',_0xaf0e('0x51'),'cutdigits',_0xaf0e('0x52'),_0xaf0e('0x53')]),{'where':{'context':_0x17a54a[_0xaf0e('0x50')],'exten':_0x17a54a['exten']},'individualHooks':!![]})[_0xaf0e('0x16')](function(_0x957f2d){return _0x957f2d;});}return null;})[_0xaf0e('0x16')](respondWithStatusCode(_0x183a9a,null))['catch'](handleError(_0x183a9a,null));};exports[_0xaf0e('0x54')]=function(_0x23e825,_0x5cd688){var _0x1aa198=_0x23e825[_0xaf0e('0x41')]['id'];var _0x3b0104=_0x23e825['body'];var _0x37d4e2=0xc8;var _0xfda654=null;return db[_0xaf0e('0x55')][_0xaf0e('0x56')]({'isolationLevel':db['sequelize'][_0xaf0e('0x57')][_0xaf0e('0x58')][_0xaf0e('0x59')]},function(_0x3c66ed){return db[_0xaf0e('0x27')][_0xaf0e('0x5a')]({'where':{'id':_0x1aa198},'transaction':_0x3c66ed})[_0xaf0e('0x16')](function(_0x2e67ea){if(_0x2e67ea){return db[_0xaf0e('0x27')][_0xaf0e('0x15')]({'where':{'VoiceExtensionId':_0x1aa198},'transaction':_0x3c66ed})[_0xaf0e('0x16')](function(){var _0x3ad28c=_[_0xaf0e('0x1d')](_0x3b0104,function(_0x4fc771){_0x4fc771[_0xaf0e('0x5b')]=_0x1aa198;_0x4fc771[_0xaf0e('0x5c')]=!![];return _0x4fc771;});return _0x2e67ea[_0xaf0e('0x5d')](_0x3ad28c);})['then'](function(_0x48adaf){return db['VoiceExtension'][_0xaf0e('0x5e')](_0x48adaf,{'transaction':_0x3c66ed});});}else{_0x37d4e2=0x194;_0xfda654=[];}});})[_0xaf0e('0x16')](function(){if(_0x37d4e2!==0x194){return db['VoiceExtension'][_0xaf0e('0x5f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1aa198},'order':_0xaf0e('0x60')})[_0xaf0e('0x16')](function(_0x518310){_0xfda654=_0x518310;});}})['catch'](function(_0x268237){_0x37d4e2=0x1f4;logger[_0xaf0e('0x22')](_0x268237[_0xaf0e('0x23')]);if(_0x268237[_0xaf0e('0x24')]){delete _0x268237['name'];}_0xfda654=_0x268237;})[_0xaf0e('0x61')](function(){if(_0xfda654===null){_0x5cd688[_0xaf0e('0xb')](_0x37d4e2);}else{if(_0x37d4e2===0x1f4){_0x5cd688[_0xaf0e('0xc')](_0x37d4e2)[_0xaf0e('0x25')](_0xfda654);}else{_0x5cd688[_0xaf0e('0xc')](_0x37d4e2)['json'](_0xfda654);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index a74b433..5132889 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 _0x4102=['hasOwnProperty','exports','../../mysqldb','VoiceExtension','save','remove','emit'];(function(_0x9e639d,_0x4e827f){var _0x2544f8=function(_0x3c18b0){while(--_0x3c18b0){_0x9e639d['push'](_0x9e639d['shift']());}};_0x2544f8(++_0x4e827f);}(_0x4102,0x87));var _0x2410=function(_0x44466d,_0x39a777){_0x44466d=_0x44466d-0x0;var _0x50e7fe=_0x4102[_0x44466d];return _0x50e7fe;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x2410('0x0'))['db'][_0x2410('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2410('0x2'),'afterUpdate':'update','afterDestroy':_0x2410('0x3')};function emitEvent(_0x4011ac){return function(_0x374cd3,_0x4215df,_0x477f03){VoiceExtensionEvents[_0x2410('0x4')](_0x4011ac+':'+_0x374cd3['id'],_0x374cd3);VoiceExtensionEvents[_0x2410('0x4')](_0x4011ac,_0x374cd3);_0x477f03(null);};}for(var e in events){if(events[_0x2410('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x2410('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb4fb=['events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1ccdb0,_0x8903c6){var _0x3e2a18=function(_0xa57b50){while(--_0xa57b50){_0x1ccdb0['push'](_0x1ccdb0['shift']());}};_0x3e2a18(++_0x8903c6);}(_0xb4fb,0xb4));var _0xbb4f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4fb[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xbb4f('0x0'));var VoiceExtension=require(_0xbb4f('0x1'))['db'][_0xbb4f('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbb4f('0x3')](0x0);var events={'afterCreate':_0xbb4f('0x4'),'afterUpdate':_0xbb4f('0x5'),'afterDestroy':_0xbb4f('0x6')};function emitEvent(_0x38ad34){return function(_0x5bccb9,_0x51b7a6,_0x45285e){VoiceExtensionEvents['emit'](_0x38ad34+':'+_0x5bccb9['id'],_0x5bccb9);VoiceExtensionEvents[_0xbb4f('0x7')](_0x38ad34,_0x5bccb9);_0x45285e(null);};}for(var e in events){if(events[_0xbb4f('0x8')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xbb4f('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index f9bb6d3..093052e 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 _0x6e15=['XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','app','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','Hangup','models','type','Set','CDR(type)=','context','exten','push','inbound'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x6e15,0x114));var _0x56e1=function(_0x3f53b0,_0x39258f){_0x3f53b0=_0x3f53b0-0x0;var _0x539c67=_0x6e15[_0x3f53b0];return _0x539c67;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x1e2803){var _0x4a0e3f=_0x1e2803[_0x56e1('0x0')];function _0x1cf908(_0x3b9bdf){var _0x2b1b23=0x2;var _0x3138ed=[{'type':_0x3b9bdf[_0x56e1('0x1')],'app':_0x56e1('0x2'),'appdata':_0x56e1('0x3')+_0x3b9bdf[_0x56e1('0x1')],'context':_0x3b9bdf[_0x56e1('0x4')],'exten':_0x3b9bdf[_0x56e1('0x5')],'priority':_0x2b1b23++,'VoiceExtensionId':_0x3b9bdf['id']}];if(_0x3b9bdf[_0x56e1('0x1')]==='inbound'){_0x3138ed[_0x56e1('0x6')]({'type':_0x56e1('0x7'),'app':_0x56e1('0x2'),'appdata':'CDR(routeid)='+_0x3b9bdf['id'],'context':_0x3b9bdf[_0x56e1('0x4')],'exten':_0x3b9bdf[_0x56e1('0x5')],'priority':_0x2b1b23++,'VoiceExtensionId':_0x3b9bdf['id']});}_0x3138ed[_0x56e1('0x6')]({'type':_0x3b9bdf['type'],'app':_0x56e1('0x2'),'appdata':_0x56e1('0x8'),'context':_0x3b9bdf['context'],'exten':_0x3b9bdf[_0x56e1('0x5')],'priority':_0x2b1b23++,'VoiceExtensionId':_0x3b9bdf['id']},{'type':_0x3b9bdf[_0x56e1('0x1')],'app':_0x56e1('0x2'),'appdata':_0x56e1('0x9'),'context':_0x3b9bdf['context'],'exten':_0x3b9bdf[_0x56e1('0x5')],'priority':_0x2b1b23++,'VoiceExtensionId':_0x3b9bdf['id']},{'type':_0x3b9bdf['type'],'app':_0x56e1('0x2'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3b9bdf[_0x56e1('0x4')],'exten':_0x3b9bdf['exten'],'priority':_0x2b1b23++,'VoiceExtensionId':_0x3b9bdf['id']});return _0x3138ed;}function _0x5f3a24(_0x19ddbf){var _0x213dbf=0x2;var _0x40e270=[{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':_0x56e1('0xb'),'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':_0x56e1('0xc')+(_0x19ddbf[_0x56e1('0xd')]?_0x56e1('0xe')+_0x19ddbf[_0x56e1('0xd')]+'}':_0x56e1('0xf')),'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf['exten'],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':'Set','appdata':_0x56e1('0x10')+_0x19ddbf['id'],'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x11'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x213dbf+0x2)+_0x56e1('0x12')+(_0x213dbf+0x1)+')','context':_0x19ddbf['context'],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':_0x19ddbf[_0x56e1('0xd')]?_0x56e1('0x13')+_0x19ddbf[_0x56e1('0xd')]+'}':'CDR(prefix)=noprefix','context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':'outbound','app':_0x56e1('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':_0x56e1('0x9'),'context':_0x19ddbf['context'],'exten':_0x19ddbf['exten'],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':_0x56e1('0x14'),'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':'outboundrouteid='+_0x19ddbf['id'],'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf['exten'],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']}];if(_0x19ddbf[_0x56e1('0x15')](_0x56e1('0x16'))&&_0x19ddbf[_0x56e1('0x16')]!==_0x56e1('0x17')){_0x40e270[_0x56e1('0x6')]({'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':_0x56e1('0x18'),'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']},{'type':_0x56e1('0xa'),'app':_0x56e1('0x2'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x19ddbf['recordingFormat']||_0x56e1('0x19'),'context':_0x19ddbf[_0x56e1('0x4')],'exten':_0x19ddbf[_0x56e1('0x5')],'priority':_0x213dbf++,'VoiceExtensionId':_0x19ddbf['id']});}return _0x40e270;}function _0x3c2941(_0x4effd0,_0x1a2232){var _0x1f9e29=[{'name':_0x56e1('0x1a'),'param':0x0},{'name':_0x56e1('0x1b'),'param':0x1},{'name':_0x56e1('0x1c'),'param':0x2},{'name':_0x56e1('0x1d'),'param':0x3}];var _0x15b2a0={};var _0x21c8a8=_0x1a2232[_0x56e1('0x1e')](',');var _0xbbdf72=[];for(var _0x2fc9f9=0x0;_0x2fc9f9<_0x1f9e29['length'];_0x2fc9f9++){switch(_0x1f9e29[_0x2fc9f9][_0x56e1('0x1f')]){case'trunk':_0x15b2a0[_0x56e1('0x1a')]=_0x21c8a8[_0x1f9e29[_0x2fc9f9][_0x56e1('0x20')]][_0x56e1('0x1e')]('/')[0x1];_0x15b2a0[_0x56e1('0x21')]=_0x21c8a8[_0x1f9e29[_0x2fc9f9][_0x56e1('0x20')]][_0x56e1('0x1e')]('/')[0x2];_0x15b2a0[_0x56e1('0x22')]=_0x15b2a0[_0x56e1('0x21')]?_0x15b2a0[_0x56e1('0x21')][_0x56e1('0x1e')]('$')[0x0]:undefined;_0x15b2a0[_0x56e1('0x21')]=_0x4effd0[_0x56e1('0xd')]?(_0x15b2a0[_0x56e1('0x22')]||'')+'${EXTEN:'+_0x4effd0[_0x56e1('0xd')]+'}':(_0x15b2a0[_0x56e1('0x22')]||'')+'${EXTEN}';_0xbbdf72[_0x1f9e29[_0x2fc9f9][_0x56e1('0x20')]]=[_0x56e1('0x23'),_0x15b2a0[_0x56e1('0x1a')],_0x15b2a0[_0x56e1('0x21')]][_0x56e1('0x24')]('/');break;case _0x56e1('0x1c'):_0x15b2a0[_0x56e1('0x1c')]=_0x21c8a8[_0x1f9e29[_0x2fc9f9][_0x56e1('0x20')]];if(_0x4effd0[_0x56e1('0x16')]!==_0x56e1('0x17')){if(_0x15b2a0[_0x56e1('0x1c')][_0x56e1('0x25')](_0x56e1('0x26'))<0x0){_0x15b2a0[_0x56e1('0x1c')]+=_0x56e1('0x26');}}else{_0x15b2a0[_0x56e1('0x1c')]=_0x15b2a0[_0x56e1('0x1c')][_0x56e1('0x27')](_0x56e1('0x26'),'');}_0xbbdf72[_0x1f9e29[_0x2fc9f9][_0x56e1('0x20')]]=_0x15b2a0[_0x56e1('0x1c')];break;default:_0xbbdf72[_0x1f9e29[_0x2fc9f9][_0x56e1('0x20')]]=_0x21c8a8[_0x1f9e29[_0x2fc9f9]['param']];}}return _0xbbdf72['join'](',');}function _0x1873e3(_0x328e30,_0x1d4b0d,_0x19986a){return new Promise(function(_0x30e6fa,_0x55b05e){var _0x4a2a1e=[];if(_[_0x56e1('0x28')](_0x1d4b0d))return _0x30e6fa(_0x4a2a1e);_0x4a0e3f['Interval']['findAll']({'attributes':['id',_0x56e1('0x29'),_0x56e1('0x2a')],'raw':!![]})[_0x56e1('0x2b')](function(_0x258e73){for(var _0x662a7=0x0,_0x31f33a=0x0;_0x662a7<_0x1d4b0d[_0x56e1('0x2c')];_0x662a7++,_0x31f33a=0x0){var _0x26a841=_0x1d4b0d[_0x662a7];var _0x229341=[];var _0x2745aa=[];delete _0x26a841['id'];if(_0x26a841[_0x56e1('0x29')]!==_0x56e1('0x2d')){_0x26a841['intervals']=[_0x26a841['interval']];}else{_0x26a841[_0x56e1('0x2e')]=_0x26a841[_0x56e1('0x2a')]?_[_0x56e1('0x2f')](_[_0x56e1('0x30')](_0x258e73,{'IntervalId':_0x26a841['IntervalId']}),_0x56e1('0x29')):[];}_0x26a841[_0x56e1('0x4')]=_0x328e30[_0x56e1('0x4')];_0x26a841[_0x56e1('0x5')]=_0x328e30[_0x56e1('0x5')];if(_0x26a841[_0x56e1('0x1')])_0x26a841[_0x56e1('0x1')]=_0x26a841[_0x56e1('0x1')][_0x56e1('0x31')]();if(_0x328e30[_0x56e1('0x1')]===_0x56e1('0xa')){if(_0x26a841['hasOwnProperty'](_0x56e1('0x32'))&&_0x26a841[_0x56e1('0x32')]&&_0x26a841[_0x56e1('0x32')]!=='--'){_0x229341[_0x56e1('0x6')]({'type':_0x26a841[_0x56e1('0x1')][_0x56e1('0x31')](),'app':_0x56e1('0x2'),'appdata':_0x56e1('0x33')+_0x26a841[_0x56e1('0x32')],'context':_0x328e30[_0x56e1('0x4')],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841['intervals'][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});}_0x229341[_0x56e1('0x6')]({'type':_0x26a841[_0x56e1('0x1')][_0x56e1('0x31')](),'app':'ExecIf','appdata':_0x56e1('0x34')+(_0x26a841[_0x56e1('0x35')]?_0x56e1('0x36')+_0x26a841[_0x56e1('0x35')]+')':_0x56e1('0x37')),'context':_0x328e30[_0x56e1('0x4')],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841[_0x56e1('0x2e')][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});}else{if(_0x26a841[_0x56e1('0x15')]('answer')){if([_0x56e1('0x38'),'playback']['includes'](_0x26a841[_0x56e1('0x39')]['toLowerCase']())&&_0x26a841['appType']!=='custom'){if(_0x26a841[_0x56e1('0x3a')]){_0x229341[_0x56e1('0x6')]({'type':_0x26a841[_0x56e1('0x1')]['toLowerCase'](),'app':_0x56e1('0x11'),'appdata':_0x56e1('0x3b'),'context':_0x328e30[_0x56e1('0x4')],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841[_0x56e1('0x2e')][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});_0x229341[_0x56e1('0x6')]({'type':_0x26a841[_0x56e1('0x1')]['toLowerCase'](),'app':_0x56e1('0x2'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x328e30[_0x56e1('0x4')],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841[_0x56e1('0x2e')][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});}else{_0x229341[_0x56e1('0x6')]({'type':_0x26a841[_0x56e1('0x1')][_0x56e1('0x31')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x328e30[_0x56e1('0x4')],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841['intervals'][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});_0x229341[_0x56e1('0x6')]({'type':_0x26a841['type']['toLowerCase'](),'app':_0x56e1('0x2'),'appdata':_0x56e1('0x3c'),'context':_0x328e30['context'],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841[_0x56e1('0x2e')][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});}}}}for(var _0x17681c=0x0;_0x17681c<_0x26a841[_0x56e1('0x2e')][_0x56e1('0x2c')];_0x17681c++){var _0x437fea=_0x19986a+_0x26a841[_0x56e1('0x2e')]['length'];var _0x26770c=_0x17681c===_0x26a841['intervals'][_0x56e1('0x2c')]-0x1?_0x19986a+_0x229341['length']+_0x2745aa[_0x56e1('0x2c')]+0x2:_0x19986a+_0x17681c+0x1;_0x229341[_0x56e1('0x3d')](_0x17681c,0x0,{'type':_0x328e30[_0x56e1('0x1')],'app':'GotoIfTime','appdata':_0x26a841[_0x56e1('0x2e')][_0x17681c]+'?'+_0x328e30[_0x56e1('0x4')]+_0x56e1('0x3e')+_0x437fea+':'+_0x328e30['context']+_0x56e1('0x3e')+_0x26770c,'exten':_0x328e30[_0x56e1('0x5')],'context':_0x328e30[_0x56e1('0x4')],'priority':_0x19986a+_0x17681c,'VoiceExtensionId':_0x328e30['id']});}if(_0x26a841['appType']===_0x56e1('0x3f')){_0x26a841['appdata']=_0x3c2941(_0x328e30,_0x26a841[_0x56e1('0x40')]);}if(_0x26a841['appType']==='agi'){_0x229341[_0x56e1('0x6')]({'type':_0x26a841['type'][_0x56e1('0x31')](),'app':_0x56e1('0x2'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x328e30['context'],'exten':_0x328e30[_0x56e1('0x5')],'priority':_0x26a841['intervals'][_0x56e1('0x2c')]+_0x19986a+_0x31f33a++,'VoiceExtensionId':_0x328e30['id']});}_0x26a841[_0x56e1('0x41')]=_0x229341[_0x56e1('0x2c')]?_[_0x56e1('0x42')](_0x229341)['priority']+0x1:_0x19986a;_0x4a2a1e=_[_0x56e1('0x43')](_0x4a2a1e,_0x229341,[_0x26a841],_0x2745aa);_0x19986a=_['last'](_0x4a2a1e)[_0x56e1('0x41')]+0x1;}return _0x30e6fa(_0x4a2a1e);})[_0x56e1('0x44')](function(_0x1f69a5){_0x55b05e(_0x1f69a5);});});}return _0x1e2803[_0x56e1('0x45')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x56193f){var _0x45d054=this['get']({'plain':!![]});var _0x310499=_0x45d054[_0x56e1('0x1')]===_0x56e1('0xa')?_0x5f3a24(_0x45d054):_0x1cf908(_0x45d054);return _0x1873e3(_0x45d054,_0x56193f,_[_0x56e1('0x42')](_0x310499)['priority']+0x1)[_0x56e1('0x2b')](function(_0x1c2ec7){var _0x5a2cf5=_['concat'](_0x310499,_0x1c2ec7);_0x5a2cf5[_0x56e1('0x6')]({'type':_0x45d054[_0x56e1('0x1')],'app':_0x56e1('0x46'),'exten':_0x45d054['exten'],'context':_0x45d054[_0x56e1('0x4')],'priority':_[_0x56e1('0x42')](_0x5a2cf5)['priority']+0x1,'VoiceExtensionId':_0x45d054['id']});return _0x5a2cf5;});}}});}; \ No newline at end of file +var _0x4c37=['models','type','Set','CDR(type)=','exten','inbound','push','CDR(routeid)=','context','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','length','param','split','phone','prefix','${EXTEN}','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','VoiceExtension','get','Hangup','lodash','./voiceExtension.attributes','exports'];(function(_0x2e7abe,_0x52dbac){var _0x539aeb=function(_0x2646a0){while(--_0x2646a0){_0x2e7abe['push'](_0x2e7abe['shift']());}};_0x539aeb(++_0x52dbac);}(_0x4c37,0x192));var _0x74c3=function(_0x54aa64,_0x1c9fa9){_0x54aa64=_0x54aa64-0x0;var _0x52442b=_0x4c37[_0x54aa64];return _0x52442b;};'use strict';var _=require(_0x74c3('0x0'));var attributes=require(_0x74c3('0x1'));module[_0x74c3('0x2')]=function(_0x8f2c4){var _0x16964e=_0x8f2c4[_0x74c3('0x3')];function _0x54c77f(_0x58b19f){var _0x1cd54a=0x2;var _0x2ce3b2=[{'type':_0x58b19f[_0x74c3('0x4')],'app':_0x74c3('0x5'),'appdata':_0x74c3('0x6')+_0x58b19f['type'],'context':_0x58b19f['context'],'exten':_0x58b19f[_0x74c3('0x7')],'priority':_0x1cd54a++,'VoiceExtensionId':_0x58b19f['id']}];if(_0x58b19f['type']===_0x74c3('0x8')){_0x2ce3b2[_0x74c3('0x9')]({'type':'inbound','app':'Set','appdata':_0x74c3('0xa')+_0x58b19f['id'],'context':_0x58b19f[_0x74c3('0xb')],'exten':_0x58b19f[_0x74c3('0x7')],'priority':_0x1cd54a++,'VoiceExtensionId':_0x58b19f['id']});}_0x2ce3b2[_0x74c3('0x9')]({'type':_0x58b19f[_0x74c3('0x4')],'app':_0x74c3('0x5'),'appdata':_0x74c3('0xc'),'context':_0x58b19f[_0x74c3('0xb')],'exten':_0x58b19f['exten'],'priority':_0x1cd54a++,'VoiceExtensionId':_0x58b19f['id']},{'type':_0x58b19f[_0x74c3('0x4')],'app':_0x74c3('0x5'),'appdata':_0x74c3('0xd'),'context':_0x58b19f[_0x74c3('0xb')],'exten':_0x58b19f['exten'],'priority':_0x1cd54a++,'VoiceExtensionId':_0x58b19f['id']},{'type':_0x58b19f[_0x74c3('0x4')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x58b19f[_0x74c3('0xb')],'exten':_0x58b19f['exten'],'priority':_0x1cd54a++,'VoiceExtensionId':_0x58b19f['id']});return _0x2ce3b2;}function _0x2f0822(_0x14ec8d){var _0x2879e6=0x2;var _0x50519b=[{'type':_0x74c3('0xe'),'app':_0x74c3('0x5'),'appdata':_0x74c3('0xf'),'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':_0x74c3('0xe'),'app':_0x74c3('0x5'),'appdata':'CDR(destination)='+(_0x14ec8d[_0x74c3('0x10')]?_0x74c3('0x11')+_0x14ec8d[_0x74c3('0x10')]+'}':'${EXTEN}'),'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d['exten'],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':_0x74c3('0xe'),'app':_0x74c3('0x5'),'appdata':_0x74c3('0xa')+_0x14ec8d['id'],'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':_0x74c3('0xe'),'app':_0x74c3('0x12'),'appdata':_0x74c3('0x13')+(_0x2879e6+0x2)+'):Goto('+(_0x2879e6+0x1)+')','context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':'outbound','app':'Set','appdata':_0x14ec8d['cutdigits']?_0x74c3('0x14')+_0x14ec8d[_0x74c3('0x10')]+'}':_0x74c3('0x15'),'context':_0x14ec8d['context'],'exten':_0x14ec8d['exten'],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':'outbound','app':_0x74c3('0x5'),'appdata':_0x74c3('0xc'),'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':'outbound','app':_0x74c3('0x5'),'appdata':_0x74c3('0xd'),'context':_0x14ec8d['context'],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':_0x74c3('0xe'),'app':_0x74c3('0x5'),'appdata':_0x74c3('0x16'),'context':_0x14ec8d['context'],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':_0x74c3('0xe'),'app':_0x74c3('0x5'),'appdata':_0x74c3('0x17')+_0x14ec8d['id'],'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d['exten'],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']}];if(_0x14ec8d['hasOwnProperty'](_0x74c3('0x18'))&&_0x14ec8d['recordingFormat']!=='none'){_0x50519b[_0x74c3('0x9')]({'type':'outbound','app':'Set','appdata':_0x74c3('0x19'),'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']},{'type':'outbound','app':'Set','appdata':_0x74c3('0x1a')+_0x14ec8d[_0x74c3('0x18')]||_0x74c3('0x1b'),'context':_0x14ec8d[_0x74c3('0xb')],'exten':_0x14ec8d[_0x74c3('0x7')],'priority':_0x2879e6++,'VoiceExtensionId':_0x14ec8d['id']});}return _0x50519b;}function _0x44cb18(_0x227e23,_0x355547){var _0xcdac0b=[{'name':_0x74c3('0x1c'),'param':0x0},{'name':_0x74c3('0x1d'),'param':0x1},{'name':'options','param':0x2},{'name':_0x74c3('0x1e'),'param':0x3}];var _0x20da28={};var _0xff7830=_0x355547['split'](',');var _0x259603=[];for(var _0x128cd1=0x0;_0x128cd1<_0xcdac0b[_0x74c3('0x1f')];_0x128cd1++){switch(_0xcdac0b[_0x128cd1]['name']){case _0x74c3('0x1c'):_0x20da28[_0x74c3('0x1c')]=_0xff7830[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]][_0x74c3('0x21')]('/')[0x1];_0x20da28[_0x74c3('0x22')]=_0xff7830[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]]['split']('/')[0x2];_0x20da28[_0x74c3('0x23')]=_0x20da28[_0x74c3('0x22')]?_0x20da28[_0x74c3('0x22')][_0x74c3('0x21')]('$')[0x0]:undefined;_0x20da28['phone']=_0x227e23['cutdigits']?(_0x20da28[_0x74c3('0x23')]||'')+_0x74c3('0x11')+_0x227e23[_0x74c3('0x10')]+'}':(_0x20da28['prefix']||'')+_0x74c3('0x24');_0x259603[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]]=[_0x74c3('0x25'),_0x20da28[_0x74c3('0x1c')],_0x20da28[_0x74c3('0x22')]][_0x74c3('0x26')]('/');break;case _0x74c3('0x27'):_0x20da28[_0x74c3('0x27')]=_0xff7830[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]];if(_0x227e23[_0x74c3('0x18')]!==_0x74c3('0x28')){if(_0x20da28[_0x74c3('0x27')][_0x74c3('0x29')]('U(xcally-mixmonitor-context)')<0x0){_0x20da28[_0x74c3('0x27')]+=_0x74c3('0x2a');}}else{_0x20da28[_0x74c3('0x27')]=_0x20da28[_0x74c3('0x27')][_0x74c3('0x2b')]('U(xcally-mixmonitor-context)','');}_0x259603[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]]=_0x20da28[_0x74c3('0x27')];break;default:_0x259603[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]]=_0xff7830[_0xcdac0b[_0x128cd1][_0x74c3('0x20')]];}}return _0x259603[_0x74c3('0x26')](',');}function _0xe0068d(_0x22d5ae,_0x54ade1,_0x2d9250){return new Promise(function(_0x5e2e73,_0x23c901){var _0x5707a0=[];if(_['isEmpty'](_0x54ade1))return _0x5e2e73(_0x5707a0);_0x16964e[_0x74c3('0x2c')][_0x74c3('0x2d')]({'attributes':['id',_0x74c3('0x2e'),_0x74c3('0x2f')],'raw':!![]})[_0x74c3('0x30')](function(_0x377c72){for(var _0x43ec7e=0x0,_0x134c9a=0x0;_0x43ec7e<_0x54ade1[_0x74c3('0x1f')];_0x43ec7e++,_0x134c9a=0x0){var _0x1c00c5=_0x54ade1[_0x43ec7e];var _0x1cbaeb=[];var _0x6b773a=[];delete _0x1c00c5['id'];if(_0x1c00c5[_0x74c3('0x2e')]!=='*,*,*,*'){_0x1c00c5[_0x74c3('0x31')]=[_0x1c00c5[_0x74c3('0x2e')]];}else{_0x1c00c5[_0x74c3('0x31')]=_0x1c00c5['IntervalId']?_[_0x74c3('0x32')](_[_0x74c3('0x33')](_0x377c72,{'IntervalId':_0x1c00c5[_0x74c3('0x2f')]}),_0x74c3('0x2e')):[];}_0x1c00c5[_0x74c3('0xb')]=_0x22d5ae[_0x74c3('0xb')];_0x1c00c5[_0x74c3('0x7')]=_0x22d5ae[_0x74c3('0x7')];if(_0x1c00c5[_0x74c3('0x4')])_0x1c00c5[_0x74c3('0x4')]=_0x1c00c5[_0x74c3('0x4')][_0x74c3('0x34')]();if(_0x22d5ae[_0x74c3('0x4')]===_0x74c3('0xe')){if(_0x1c00c5[_0x74c3('0x35')](_0x74c3('0x36'))&&_0x1c00c5[_0x74c3('0x36')]&&_0x1c00c5['tag']!=='--'){_0x1cbaeb['push']({'type':_0x1c00c5[_0x74c3('0x4')][_0x74c3('0x34')](),'app':_0x74c3('0x5'),'appdata':_0x74c3('0x37')+_0x1c00c5[_0x74c3('0x36')],'context':_0x22d5ae[_0x74c3('0xb')],'exten':_0x22d5ae[_0x74c3('0x7')],'priority':_0x1c00c5['intervals'][_0x74c3('0x1f')]+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});}_0x1cbaeb[_0x74c3('0x9')]({'type':_0x1c00c5[_0x74c3('0x4')][_0x74c3('0x34')](),'app':'ExecIf','appdata':_0x74c3('0x38')+(_0x1c00c5['callerID']?_0x74c3('0x39')+_0x1c00c5['callerID']+')':_0x74c3('0x3a')),'context':_0x22d5ae['context'],'exten':_0x22d5ae[_0x74c3('0x7')],'priority':_0x1c00c5[_0x74c3('0x31')][_0x74c3('0x1f')]+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});}else{if(_0x1c00c5[_0x74c3('0x35')](_0x74c3('0x3b'))){if([_0x74c3('0x3c'),_0x74c3('0x3d')]['includes'](_0x1c00c5[_0x74c3('0x3e')][_0x74c3('0x34')]())&&_0x1c00c5[_0x74c3('0x3f')]!==_0x74c3('0x40')){if(_0x1c00c5[_0x74c3('0x3b')]){_0x1cbaeb[_0x74c3('0x9')]({'type':_0x1c00c5[_0x74c3('0x4')]['toLowerCase'](),'app':_0x74c3('0x12'),'appdata':_0x74c3('0x41'),'context':_0x22d5ae['context'],'exten':_0x22d5ae[_0x74c3('0x7')],'priority':_0x1c00c5[_0x74c3('0x31')][_0x74c3('0x1f')]+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});_0x1cbaeb[_0x74c3('0x9')]({'type':_0x1c00c5['type'][_0x74c3('0x34')](),'app':_0x74c3('0x5'),'appdata':_0x74c3('0x42'),'context':_0x22d5ae['context'],'exten':_0x22d5ae[_0x74c3('0x7')],'priority':_0x1c00c5[_0x74c3('0x31')][_0x74c3('0x1f')]+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});}else{_0x1cbaeb['push']({'type':_0x1c00c5[_0x74c3('0x4')][_0x74c3('0x34')](),'app':_0x74c3('0x12'),'appdata':_0x74c3('0x43'),'context':_0x22d5ae[_0x74c3('0xb')],'exten':_0x22d5ae[_0x74c3('0x7')],'priority':_0x1c00c5[_0x74c3('0x31')][_0x74c3('0x1f')]+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});_0x1cbaeb[_0x74c3('0x9')]({'type':_0x1c00c5[_0x74c3('0x4')][_0x74c3('0x34')](),'app':_0x74c3('0x5'),'appdata':_0x74c3('0x44'),'context':_0x22d5ae[_0x74c3('0xb')],'exten':_0x22d5ae[_0x74c3('0x7')],'priority':_0x1c00c5['intervals']['length']+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});}}}}for(var _0x21e31f=0x0;_0x21e31f<_0x1c00c5[_0x74c3('0x31')]['length'];_0x21e31f++){var _0xf55594=_0x2d9250+_0x1c00c5[_0x74c3('0x31')]['length'];var _0x473f1a=_0x21e31f===_0x1c00c5[_0x74c3('0x31')][_0x74c3('0x1f')]-0x1?_0x2d9250+_0x1cbaeb[_0x74c3('0x1f')]+_0x6b773a['length']+0x2:_0x2d9250+_0x21e31f+0x1;_0x1cbaeb['splice'](_0x21e31f,0x0,{'type':_0x22d5ae[_0x74c3('0x4')],'app':_0x74c3('0x45'),'appdata':_0x1c00c5[_0x74c3('0x31')][_0x21e31f]+'?'+_0x22d5ae[_0x74c3('0xb')]+_0x74c3('0x46')+_0xf55594+':'+_0x22d5ae[_0x74c3('0xb')]+_0x74c3('0x46')+_0x473f1a,'exten':_0x22d5ae[_0x74c3('0x7')],'context':_0x22d5ae['context'],'priority':_0x2d9250+_0x21e31f,'VoiceExtensionId':_0x22d5ae['id']});}if(_0x1c00c5[_0x74c3('0x3f')]===_0x74c3('0x47')){_0x1c00c5['appdata']=_0x44cb18(_0x22d5ae,_0x1c00c5[_0x74c3('0x48')]);}if(_0x1c00c5[_0x74c3('0x3f')]==='agi'){_0x1cbaeb[_0x74c3('0x9')]({'type':_0x1c00c5['type']['toLowerCase'](),'app':_0x74c3('0x5'),'appdata':_0x74c3('0x49'),'context':_0x22d5ae[_0x74c3('0xb')],'exten':_0x22d5ae['exten'],'priority':_0x1c00c5[_0x74c3('0x31')][_0x74c3('0x1f')]+_0x2d9250+_0x134c9a++,'VoiceExtensionId':_0x22d5ae['id']});}_0x1c00c5[_0x74c3('0x4a')]=_0x1cbaeb[_0x74c3('0x1f')]?_[_0x74c3('0x4b')](_0x1cbaeb)[_0x74c3('0x4a')]+0x1:_0x2d9250;_0x5707a0=_[_0x74c3('0x4c')](_0x5707a0,_0x1cbaeb,[_0x1c00c5],_0x6b773a);_0x2d9250=_[_0x74c3('0x4b')](_0x5707a0)[_0x74c3('0x4a')]+0x1;}return _0x5e2e73(_0x5707a0);})[_0x74c3('0x4d')](function(_0x15d413){_0x23c901(_0x15d413);});});}return _0x8f2c4['define'](_0x74c3('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x40a4d4){var _0x34a8a3=this[_0x74c3('0x4f')]({'plain':!![]});var _0x4b2559=_0x34a8a3[_0x74c3('0x4')]===_0x74c3('0xe')?_0x2f0822(_0x34a8a3):_0x54c77f(_0x34a8a3);return _0xe0068d(_0x34a8a3,_0x40a4d4,_[_0x74c3('0x4b')](_0x4b2559)[_0x74c3('0x4a')]+0x1)[_0x74c3('0x30')](function(_0x26a799){var _0x58c9a8=_['concat'](_0x4b2559,_0x26a799);_0x58c9a8[_0x74c3('0x9')]({'type':_0x34a8a3[_0x74c3('0x4')],'app':_0x74c3('0x50'),'exten':_0x34a8a3['exten'],'context':_0x34a8a3[_0x74c3('0xb')],'priority':_['last'](_0x58c9a8)['priority']+0x1,'VoiceExtensionId':_0x34a8a3['id']});return _0x58c9a8;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 77702e3..de73970 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 _0x15b2=['stringify','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','request\x20sent','error','code','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','include','map','model','attributes','then','debug','GetVoiceExtension'];(function(_0x109781,_0x63bce4){var _0x2a4c07=function(_0x1fec0f){while(--_0x1fec0f){_0x109781['push'](_0x109781['shift']());}};_0x2a4c07(++_0x63bce4);}(_0x15b2,0x145));var _0x215b=function(_0x29a132,_0x49c0cc){_0x29a132=_0x29a132-0x0;var _0x1443cf=_0x15b2[_0x29a132];return _0x1443cf;};'use strict';var _=require('lodash');var util=require(_0x215b('0x0'));var moment=require('moment');var BPromise=require(_0x215b('0x1'));var rs=require(_0x215b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x215b('0x3'))['db'];var utils=require(_0x215b('0x4'));var logger=require(_0x215b('0x5'))(_0x215b('0x6'));var config=require('../../config/environment');var jayson=require(_0x215b('0x7'));var client=jayson['client'][_0x215b('0x8')]({'port':0x232a});config[_0x215b('0x9')]=_[_0x215b('0xa')](config[_0x215b('0x9')],{'host':_0x215b('0xb'),'port':0x18eb});var socket=require(_0x215b('0xc'))(new Redis(config['redis']));require(_0x215b('0xd'))[_0x215b('0xe')](socket);function respondWithRpcPromise(_0x50ef7a,_0x2f736e,_0x44bbd9){return new BPromise(function(_0x5578e4,_0x4de4ad){return client[_0x215b('0xf')](_0x50ef7a,_0x44bbd9)['then'](function(_0x401260){logger[_0x215b('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2f736e,_0x215b('0x11'),JSON['stringify'](_0x401260));if(_0x401260[_0x215b('0x12')]){if(_0x401260['error'][_0x215b('0x13')]===0x1f4){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260['error']['message']);return _0x4de4ad(_0x401260['error'][_0x215b('0x15')]);}logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x401260[_0x215b('0x12')][_0x215b('0x15')]);return _0x5578e4(_0x401260[_0x215b('0x12')][_0x215b('0x15')]);}else{logger['info'](_0x215b('0x14'),_0x2f736e,_0x215b('0x11'));_0x5578e4(_0x401260[_0x215b('0x16')][_0x215b('0x15')]);}})[_0x215b('0x17')](function(_0x4492da){logger[_0x215b('0x12')](_0x215b('0x14'),_0x2f736e,_0x4492da);_0x4de4ad(_0x4492da);});});}exports['GetVoiceExtension']=function(_0x534e73){var _0x2cb718=this;return new Promise(function(_0x5d1998,_0x16732d){return db[_0x215b('0x18')][_0x215b('0x19')]({'raw':_0x534e73[_0x215b('0x1a')]?_0x534e73[_0x215b('0x1a')][_0x215b('0x1b')]===undefined?!![]:![]:!![],'where':_0x534e73[_0x215b('0x1a')]?_0x534e73[_0x215b('0x1a')]['where']||null:null,'attributes':_0x534e73['options']?_0x534e73[_0x215b('0x1a')]['attributes']||null:null,'limit':_0x534e73[_0x215b('0x1a')]?_0x534e73[_0x215b('0x1a')]['limit']||null:null,'include':_0x534e73[_0x215b('0x1a')]?_0x534e73['options'][_0x215b('0x1c')]?_[_0x215b('0x1d')](_0x534e73[_0x215b('0x1a')][_0x215b('0x1c')],function(_0x1f30b1){return{'model':db[_0x1f30b1[_0x215b('0x1e')]],'as':_0x1f30b1['as'],'attributes':_0x1f30b1[_0x215b('0x1f')],'include':_0x1f30b1[_0x215b('0x1c')]?_['map'](_0x1f30b1[_0x215b('0x1c')],function(_0x1f1a6f){return{'model':db[_0x1f1a6f['model']],'as':_0x1f1a6f['as'],'attributes':_0x1f1a6f[_0x215b('0x1f')],'include':_0x1f1a6f[_0x215b('0x1c')]?_[_0x215b('0x1d')](_0x1f1a6f['include'],function(_0x23ffca){return{'model':db[_0x23ffca[_0x215b('0x1e')]],'as':_0x23ffca['as'],'attributes':_0x23ffca[_0x215b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x215b('0x20')](function(_0x8dea4c){logger[_0x215b('0x10')]('GetVoiceExtension',_0x534e73);logger[_0x215b('0x21')](_0x215b('0x22'),_0x534e73,JSON[_0x215b('0x23')](_0x8dea4c));_0x5d1998(_0x8dea4c);})[_0x215b('0x17')](function(_0x5eb42b){logger['error']('GetVoiceExtension',_0x5eb42b['message'],_0x534e73);_0x16732d(_0x2cb718['error'](0x1f4,_0x5eb42b[_0x215b('0x15')]));});});}; \ No newline at end of file +var _0x1298=['request\x20sent','stringify','error','VoiceExtension,\x20%s,\x20%s','message','result','catch','VoiceExtension','findAll','options','raw','where','attributes','map','include','model','then','GetVoiceExtension','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s'];(function(_0x239bfa,_0x5b871d){var _0x2a7002=function(_0x2a58b0){while(--_0x2a58b0){_0x239bfa['push'](_0x239bfa['shift']());}};_0x2a7002(++_0x5b871d);}(_0x1298,0x19e));var _0x8129=function(_0x47423e,_0xfaa9b){_0x47423e=_0x47423e-0x0;var _0x1cc932=_0x1298[_0x47423e];return _0x1cc932;};'use strict';var _=require('lodash');var util=require(_0x8129('0x0'));var moment=require('moment');var BPromise=require(_0x8129('0x1'));var rs=require(_0x8129('0x2'));var fs=require('fs');var Redis=require(_0x8129('0x3'));var db=require(_0x8129('0x4'))['db'];var utils=require(_0x8129('0x5'));var logger=require(_0x8129('0x6'))(_0x8129('0x7'));var config=require('../../config/environment');var jayson=require(_0x8129('0x8'));var client=jayson[_0x8129('0x9')]['http']({'port':0x232a});config['redis']=_[_0x8129('0xa')](config[_0x8129('0xb')],{'host':_0x8129('0xc'),'port':0x18eb});var socket=require(_0x8129('0xd'))(new Redis(config[_0x8129('0xb')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x5a64a4,_0x50b960,_0x2f27a7){return new BPromise(function(_0x2fe2b6,_0x4cfa1d){return client[_0x8129('0xe')](_0x5a64a4,_0x2f27a7)['then'](function(_0x511313){logger[_0x8129('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x50b960,'request\x20sent');logger[_0x8129('0x10')](_0x8129('0x11'),_0x50b960,_0x8129('0x12'),JSON[_0x8129('0x13')](_0x511313));if(_0x511313[_0x8129('0x14')]){if(_0x511313[_0x8129('0x14')]['code']===0x1f4){logger['error'](_0x8129('0x15'),_0x50b960,_0x511313['error'][_0x8129('0x16')]);return _0x4cfa1d(_0x511313['error'][_0x8129('0x16')]);}logger[_0x8129('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x50b960,_0x511313[_0x8129('0x14')]['message']);return _0x2fe2b6(_0x511313[_0x8129('0x14')][_0x8129('0x16')]);}else{logger[_0x8129('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x50b960,_0x8129('0x12'));_0x2fe2b6(_0x511313[_0x8129('0x17')][_0x8129('0x16')]);}})[_0x8129('0x18')](function(_0x3050b4){logger[_0x8129('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x50b960,_0x3050b4);_0x4cfa1d(_0x3050b4);});});}exports['GetVoiceExtension']=function(_0x1ac697){var _0x4b96a6=this;return new Promise(function(_0x22c68d,_0x1b419c){return db[_0x8129('0x19')][_0x8129('0x1a')]({'raw':_0x1ac697[_0x8129('0x1b')]?_0x1ac697[_0x8129('0x1b')][_0x8129('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ac697[_0x8129('0x1b')]?_0x1ac697[_0x8129('0x1b')][_0x8129('0x1d')]||null:null,'attributes':_0x1ac697['options']?_0x1ac697[_0x8129('0x1b')][_0x8129('0x1e')]||null:null,'limit':_0x1ac697[_0x8129('0x1b')]?_0x1ac697[_0x8129('0x1b')]['limit']||null:null,'include':_0x1ac697[_0x8129('0x1b')]?_0x1ac697[_0x8129('0x1b')]['include']?_[_0x8129('0x1f')](_0x1ac697['options'][_0x8129('0x20')],function(_0x3b6e8e){return{'model':db[_0x3b6e8e[_0x8129('0x21')]],'as':_0x3b6e8e['as'],'attributes':_0x3b6e8e['attributes'],'include':_0x3b6e8e[_0x8129('0x20')]?_[_0x8129('0x1f')](_0x3b6e8e[_0x8129('0x20')],function(_0x4b57f0){return{'model':db[_0x4b57f0['model']],'as':_0x4b57f0['as'],'attributes':_0x4b57f0[_0x8129('0x1e')],'include':_0x4b57f0[_0x8129('0x20')]?_['map'](_0x4b57f0[_0x8129('0x20')],function(_0x467162){return{'model':db[_0x467162['model']],'as':_0x467162['as'],'attributes':_0x467162[_0x8129('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8129('0x22')](function(_0x4a956f){logger[_0x8129('0xf')](_0x8129('0x23'),_0x1ac697);logger[_0x8129('0x10')](_0x8129('0x23'),_0x1ac697,JSON[_0x8129('0x13')](_0x4a956f));_0x22c68d(_0x4a956f);})[_0x8129('0x18')](function(_0x3708e3){logger[_0x8129('0x14')](_0x8129('0x23'),_0x3708e3[_0x8129('0x16')],_0x1ac697);_0x1b419c(_0x4b96a6[_0x8129('0x14')](0x1f4,_0x3708e3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index c52737a..6630c02 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(_0x1d7510,_0x469676){var _0x446171=function(_0x3f8a1e){while(--_0x3f8a1e){_0x1d7510['push'](_0x1d7510['shift']());}};_0x446171(++_0x469676);}(_0x5fab,0x177));var _0xb5fa=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x5fab[_0x270dba];return _0x36b83b;};'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(_0x1a8d45,_0x3b7c68){var _0x58f047=function(_0x5ada74){while(--_0x5ada74){_0x1a8d45['push'](_0x1a8d45['shift']());}};_0x58f047(++_0x3b7c68);}(_0x326f,0xd1));var _0xf326=function(_0x440e21,_0x16d31b){_0x440e21=_0x440e21-0x0;var _0x12cfb1=_0x326f[_0x440e21];return _0x12cfb1;};'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 c0f0a9f..5ca3f9d 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 _0x6d11=['put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x6d11,0xbf));var _0x16d1=function(_0x135356,_0x3ba789){_0x135356=_0x135356-0x0;var _0x564362=_0x6d11[_0x135356];return _0x564362;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['show']);router['get']('/:id/messages',auth[_0x16d1('0x8')](),controller[_0x16d1('0xb')]);router[_0x16d1('0xc')]('/',auth[_0x16d1('0x8')](),controller['create']);router[_0x16d1('0xd')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xe')]);router[_0x16d1('0xf')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x68b3=['index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5e503b,_0x3c6023){var _0x472bf2=function(_0x5beabd){while(--_0x5beabd){_0x5e503b['push'](_0x5e503b['shift']());}};_0x472bf2(++_0x3c6023);}(_0x68b3,0x1d8));var _0x368b=function(_0x6b445e,_0x2c634c){_0x6b445e=_0x6b445e-0x0;var _0x4e299b=_0x68b3[_0x6b445e];return _0x4e299b;};'use strict';var multer=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var path=require(_0x368b('0x2'));var timeout=require(_0x368b('0x3'));var express=require(_0x368b('0x4'));var router=express['Router']();var fs_extra=require(_0x368b('0x5'));var auth=require(_0x368b('0x6'));var interaction=require(_0x368b('0x7'));var config=require(_0x368b('0x8'));var controller=require('./voiceMail.controller');router[_0x368b('0x9')]('/',auth[_0x368b('0xa')](),controller[_0x368b('0xb')]);router[_0x368b('0x9')](_0x368b('0xc'),auth[_0x368b('0xa')](),controller[_0x368b('0xd')]);router[_0x368b('0x9')](_0x368b('0xe'),auth[_0x368b('0xa')](),controller[_0x368b('0xf')]);router['post']('/',auth[_0x368b('0xa')](),controller[_0x368b('0x10')]);router[_0x368b('0x11')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x12')]);router[_0x368b('0x13')]('/:id',auth[_0x368b('0xa')](),controller[_0x368b('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 07b53a7..631a45d 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 _0x65f2=['yes','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','setDataValue','email','trim','central','ENUM'];(function(_0x27530d,_0x46480a){var _0x59e561=function(_0x395fe9){while(--_0x395fe9){_0x27530d['push'](_0x27530d['shift']());}};_0x59e561(++_0x46480a);}(_0x65f2,0x128));var _0x265f=function(_0x3a5854,_0x1cc9b1){_0x3a5854=_0x3a5854-0x0;var _0x3f0590=_0x65f2[_0x3a5854];return _0x3f0590;};'use strict';var Sequelize=require(_0x265f('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x265f('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x265f('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x265f('0x1')]},'fullname':{'type':Sequelize[_0x265f('0x1')]},'email':{'type':Sequelize[_0x265f('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5dc2c0){this[_0x265f('0x3')](_0x265f('0x4'),typeof _0x5dc2c0==='string'&&_0x5dc2c0[_0x265f('0x5')]()?_0x5dc2c0['trim']():null);}},'pager':{'type':Sequelize[_0x265f('0x1')]},'tz':{'type':Sequelize[_0x265f('0x1')],'defaultValue':_0x265f('0x6')},'attach':{'type':Sequelize[_0x265f('0x7')](_0x265f('0x8'),'no'),'defaultValue':_0x265f('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x265f('0x7')]('yes','no'),'defaultValue':_0x265f('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x265f('0x1')]},'callback':{'type':Sequelize[_0x265f('0x1')]},'review':{'type':Sequelize[_0x265f('0x7')](_0x265f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x265f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x265f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x265f('0x7')](_0x265f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x265f('0x7')](_0x265f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x265f('0x8'),'no'),'defaultValue':_0x265f('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x265f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x265f('0x7')]('yes','no'),'defaultValue':_0x265f('0x8'),'allowNull':![]},'stamp':{'type':_0x265f('0x9')},'emailsubject':{'type':Sequelize[_0x265f('0x1')]},'emailbody':{'type':Sequelize[_0x265f('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x265f('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x265f('0xb')],'get':function(){return this['getDataValue'](_0x265f('0xc'))+_0x265f('0xd')+this[_0x265f('0xe')](_0x265f('0xf'));}}}; \ No newline at end of file +var _0x5811=['STRING','from-voicemail','setDataValue','email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','exports'];(function(_0x173bf4,_0x267601){var _0x2ddb68=function(_0x4d6293){while(--_0x4d6293){_0x173bf4['push'](_0x173bf4['shift']());}};_0x2ddb68(++_0x267601);}(_0x5811,0x1bf));var _0x1581=function(_0x56acd3,_0x1b1121){_0x56acd3=_0x56acd3-0x0;var _0x1bfeb9=_0x5811[_0x56acd3];return _0x1bfeb9;};'use strict';var Sequelize=require('sequelize');module[_0x1581('0x0')]={'customer_id':{'type':Sequelize[_0x1581('0x1')]},'context':{'type':Sequelize[_0x1581('0x1')],'defaultValue':_0x1581('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x1581('0x1')]},'fullname':{'type':Sequelize[_0x1581('0x1')]},'email':{'type':Sequelize[_0x1581('0x1')],'validate':{'isEmail':!![]},'set':function(_0x4749d1){this[_0x1581('0x3')](_0x1581('0x4'),typeof _0x4749d1===_0x1581('0x5')&&_0x4749d1[_0x1581('0x6')]()?_0x4749d1[_0x1581('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x1581('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':_0x1581('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':_0x1581('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1581('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1581('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x1581('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x1581('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1581('0x7')](_0x1581('0x8'),'no'),'defaultValue':_0x1581('0x8'),'allowNull':![]},'stamp':{'type':_0x1581('0xa')},'emailsubject':{'type':Sequelize[_0x1581('0x1')]},'emailbody':{'type':Sequelize[_0x1581('0x1')]},'maxsecs':{'type':Sequelize[_0x1581('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1581('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1581('0xc')],'get':function(){return this[_0x1581('0xd')](_0x1581('0xe'))+'\x20-\x20'+this['getDataValue'](_0x1581('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 83336fd..bb0cd3f 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 _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x16ce8a,_0x521f45){var _0x5357de=function(_0xb9e4c){while(--_0xb9e4c){_0x16ce8a['push'](_0x16ce8a['shift']());}};_0x5357de(++_0x521f45);}(_0x97c1,0xdf));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file +var _0xe5b5=['stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','filter','where','merge','options','VoiceMail','includeAll','include','findAll','catch','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','getMessages','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xe5b5[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310f71,_0x18434e){_0x18434e=_0x18434e||0xcc;return function(_0x4559a0){if(_0x4559a0){return _0x310f71[_0x5e5b('0x1b')](_0x18434e);}return _0x310f71[_0x5e5b('0x1c')](_0x18434e)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x2e331d,_0x49edd0){_0x49edd0=_0x49edd0||0xc8;return function(_0x2b37fa){if(_0x2b37fa){return _0x2e331d[_0x5e5b('0x1c')](_0x49edd0)['json'](_0x2b37fa);}};}function respondWithFilteredResult(_0x227417,_0x578c14){return function(_0x4e9509){if(_0x4e9509){var _0x13a1cb=typeof _0x578c14[_0x5e5b('0x1e')]===_0x5e5b('0x1f')&&typeof _0x578c14['limit']===_0x5e5b('0x1f');var _0x4d490c=_0x4e9509[_0x5e5b('0x20')];var _0x45a091=_0x13a1cb?0x0:_0x578c14['offset'];var _0xe5aa6b=_0x13a1cb?_0x4e9509[_0x5e5b('0x20')]:_0x578c14[_0x5e5b('0x1e')]+_0x578c14['limit'];var _0x2bf0b7;if(_0xe5aa6b>=_0x4d490c){_0xe5aa6b=_0x4d490c;_0x2bf0b7=0xc8;}else{_0x2bf0b7=0xce;}_0x227417[_0x5e5b('0x1c')](_0x2bf0b7);return _0x227417['set'](_0x5e5b('0x21'),_0x45a091+'-'+_0xe5aa6b+'/'+_0x4d490c)[_0x5e5b('0x22')](_0x4e9509);}return null;};}function patchUpdates(_0x3c488e){return function(_0x2d8252){try{jsonpatch[_0x5e5b('0x23')](_0x2d8252,_0x3c488e,!![]);}catch(_0x33d61b){return BPromise[_0x5e5b('0x24')](_0x33d61b);}return _0x2d8252[_0x5e5b('0x25')]();};}function saveUpdates(_0x4a78e3,_0x512e46){return function(_0x256a00){if(_0x256a00){return _0x256a00[_0x5e5b('0x26')](_0x4a78e3)[_0x5e5b('0x27')](function(_0xe1c268){return _0xe1c268;});}return null;};}function removeEntity(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(_0x135c6c){return _0x135c6c[_0x5e5b('0x28')]()[_0x5e5b('0x27')](function(){var _0x26bc02=_0x135c6c[_0x5e5b('0x29')]({'plain':!![]});var _0x4da321=_0x5e5b('0x2a');return db[_0x5e5b('0x2b')][_0x5e5b('0x28')]({'where':{'type':_0x4da321,'resourceId':_0x26bc02['id']}})['then'](function(){return _0x135c6c;});})[_0x5e5b('0x27')](function(){_0x2e38ed[_0x5e5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ff91,_0x21c74b){return function(_0x39ce16){if(!_0x39ce16){_0x13ff91[_0x5e5b('0x1b')](0x194);}return _0x39ce16;};}function handleError(_0x31af09,_0x250fbd){_0x250fbd=_0x250fbd||0x1f4;return function(_0x2cb695){logger[_0x5e5b('0x2c')](_0x2cb695[_0x5e5b('0x2d')]);if(_0x2cb695[_0x5e5b('0x2e')]){delete _0x2cb695[_0x5e5b('0x2e')];}_0x31af09[_0x5e5b('0x1c')](_0x250fbd)['send'](_0x2cb695);};}exports['index']=function(_0x365f6f,_0x289f54){var _0xb68419={},_0x3dcdab={},_0x12f1ee={'count':0x0,'rows':[]};var _0x4b9be8=_[_0x5e5b('0x2f')](db['VoiceMail'][_0x5e5b('0x30')],function(_0x384d8f){return{'name':_0x384d8f[_0x5e5b('0x31')],'type':_0x384d8f[_0x5e5b('0x32')]['key']};});_0x3dcdab[_0x5e5b('0x33')]=_[_0x5e5b('0x2f')](_0x4b9be8,'name');_0x3dcdab[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x365f6f[_0x5e5b('0x34')]);_0x3dcdab[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x3dcdab[_0x5e5b('0x33')],_0x3dcdab[_0x5e5b('0x34')]);_0xb68419[_0x5e5b('0x38')]=_['intersection'](_0x3dcdab[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x39')]));_0xb68419[_0x5e5b('0x38')]=_0xb68419[_0x5e5b('0x38')]['length']?_0xb68419['attributes']:_0x3dcdab[_0x5e5b('0x33')];if(!_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0xb68419[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0xb68419['offset']=qs[_0x5e5b('0x1e')](_0x365f6f[_0x5e5b('0x34')]['offset']);}_0xb68419['order']=qs[_0x5e5b('0x3c')](_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3c')]);_0xb68419['where']=qs[_0x5e5b('0x36')](_['pick'](_0x365f6f['query'],_0x3dcdab[_0x5e5b('0x36')]),_0x4b9be8);if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0xb68419[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0xb68419[_0x5e5b('0x3e')],{'$or':_[_0x5e5b('0x2f')](_0x4b9be8,function(_0x14ac35){if(_0x14ac35[_0x5e5b('0x32')]!=='VIRTUAL'){var _0x1f1907={};_0x1f1907[_0x14ac35[_0x5e5b('0x2e')]]={'$like':'%'+_0x365f6f['query'][_0x5e5b('0x3d')]+'%'};return _0x1f1907;}})});}_0xb68419=_['merge']({},_0xb68419,_0x365f6f[_0x5e5b('0x40')]);var _0x14b152={'where':_0xb68419[_0x5e5b('0x3e')]};return db[_0x5e5b('0x41')][_0x5e5b('0x20')](_0x14b152)[_0x5e5b('0x27')](function(_0x371550){_0x12f1ee[_0x5e5b('0x20')]=_0x371550;if(_0x365f6f[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0xb68419[_0x5e5b('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x5e5b('0x44')](_0xb68419);})[_0x5e5b('0x27')](function(_0x46fec9){_0x12f1ee['rows']=_0x46fec9;return _0x12f1ee;})[_0x5e5b('0x27')](respondWithFilteredResult(_0x289f54,_0xb68419))[_0x5e5b('0x45')](handleError(_0x289f54,null));};exports['show']=function(_0x6672d9,_0x44b7be){var _0x5d3135={'raw':!![],'where':{'id':_0x6672d9['params']['id']}},_0x257bb7={};_0x257bb7['model']=_['keys'](db[_0x5e5b('0x41')]['rawAttributes']);_0x257bb7[_0x5e5b('0x34')]=_['keys'](_0x6672d9[_0x5e5b('0x34')]);_0x257bb7[_0x5e5b('0x36')]=_[_0x5e5b('0x37')](_0x257bb7[_0x5e5b('0x33')],_0x257bb7[_0x5e5b('0x34')]);_0x5d3135[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x257bb7['model'],qs['fields'](_0x6672d9[_0x5e5b('0x34')]['fields']));_0x5d3135['attributes']=_0x5d3135['attributes'][_0x5e5b('0x46')]?_0x5d3135['attributes']:_0x257bb7[_0x5e5b('0x33')];if(_0x6672d9[_0x5e5b('0x34')][_0x5e5b('0x42')]){_0x5d3135[_0x5e5b('0x43')]=[{'all':!![]}];}_0x5d3135=_[_0x5e5b('0x3f')]({},_0x5d3135,_0x6672d9[_0x5e5b('0x40')]);return db['VoiceMail'][_0x5e5b('0x47')](_0x5d3135)[_0x5e5b('0x27')](handleEntityNotFound(_0x44b7be,null))['then'](respondWithResult(_0x44b7be,null))[_0x5e5b('0x45')](handleError(_0x44b7be,null));};exports['create']=function(_0x41e4b3,_0x36d8fa){return db[_0x5e5b('0x41')][_0x5e5b('0x48')](_0x41e4b3['body'],{})[_0x5e5b('0x27')](function(_0x1c4efe){var _0x4f4ea3=_0x41e4b3[_0x5e5b('0x49')][_0x5e5b('0x29')]({'plain':!![]});if(!_0x4f4ea3)throw new Error(_0x5e5b('0x4a'));if(_0x4f4ea3[_0x5e5b('0x4b')]===_0x5e5b('0x49')){var _0x5ae8d0=_0x1c4efe['get']({'plain':!![]});var _0x690f8c=_0x5e5b('0x2a');return db['UserProfileSection'][_0x5e5b('0x47')]({'where':{'name':_0x690f8c,'userProfileId':_0x4f4ea3[_0x5e5b('0x4c')]},'raw':!![]})[_0x5e5b('0x27')](function(_0x5a9eae){if(_0x5a9eae&&_0x5a9eae[_0x5e5b('0x4d')]===0x0){return db[_0x5e5b('0x2b')][_0x5e5b('0x48')]({'name':_0x5ae8d0['name'],'resourceId':_0x5ae8d0['id'],'type':_0x5a9eae[_0x5e5b('0x2e')],'sectionId':_0x5a9eae['id']},{})[_0x5e5b('0x27')](function(){return _0x1c4efe;});}else{return _0x1c4efe;}})[_0x5e5b('0x45')](function(_0x4a4e0f){logger['error'](_0x5e5b('0x4e'),_0x4a4e0f);throw _0x4a4e0f;});}return _0x1c4efe;})['then'](respondWithResult(_0x36d8fa,0xc9))['catch'](handleError(_0x36d8fa,null));};exports[_0x5e5b('0x26')]=function(_0x13eee9,_0x4774ee){if(_0x13eee9['body']['id']){delete _0x13eee9[_0x5e5b('0x4f')]['id'];}return db[_0x5e5b('0x41')][_0x5e5b('0x47')]({'where':{'id':_0x13eee9[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x4774ee,null))[_0x5e5b('0x27')](saveUpdates(_0x13eee9['body'],null))['then'](respondWithResult(_0x4774ee,null))[_0x5e5b('0x45')](handleError(_0x4774ee,null));};exports[_0x5e5b('0x28')]=function(_0x1cc741,_0x357e55){return db['VoiceMail'][_0x5e5b('0x47')]({'where':{'id':_0x1cc741['params']['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x357e55,null))[_0x5e5b('0x27')](removeEntity(_0x357e55,null))[_0x5e5b('0x45')](handleError(_0x357e55,null));};exports[_0x5e5b('0x51')]=function(_0x2d17b0,_0x30b010,_0x275930){return db[_0x5e5b('0x41')]['findOne']({'where':{'id':_0x2d17b0[_0x5e5b('0x50')]['id']}})[_0x5e5b('0x27')](handleEntityNotFound(_0x30b010,null))[_0x5e5b('0x27')](function(_0x1aea38){var _0x129026;var _0x5543eb={},_0x2ccee2={};_0x2ccee2[_0x5e5b('0x33')]=_[_0x5e5b('0x35')](db[_0x5e5b('0x52')][_0x5e5b('0x30')]);_0x2ccee2['query']=_[_0x5e5b('0x35')](_0x2d17b0['query']);_0x2ccee2[_0x5e5b('0x36')]=_['intersection'](_0x2ccee2[_0x5e5b('0x33')],_0x2ccee2[_0x5e5b('0x34')]);_0x5543eb[_0x5e5b('0x38')]=_[_0x5e5b('0x37')](_0x2ccee2[_0x5e5b('0x33')],qs[_0x5e5b('0x39')](_0x2d17b0['query'][_0x5e5b('0x39')]));_0x5543eb[_0x5e5b('0x38')]=_0x5543eb[_0x5e5b('0x38')][_0x5e5b('0x46')]?_0x5543eb['attributes']:_0x2ccee2['model'];if(!_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3a')]('nolimit')){_0x5543eb[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3b')](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3b')]);_0x5543eb[_0x5e5b('0x1e')]=qs['offset'](_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x1e')]);}_0x5543eb['order']=qs['sort'](_0x2d17b0['query'][_0x5e5b('0x3c')]);_0x5543eb[_0x5e5b('0x3e')]=qs[_0x5e5b('0x36')](_[_0x5e5b('0x53')](_0x2d17b0[_0x5e5b('0x34')],_0x2ccee2['filters']));if(_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]){_0x5543eb['where']=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'$or':_['map'](_0x5543eb[_0x5e5b('0x38')],function(_0x4fa0db){var _0x454026={};_0x454026[_0x4fa0db]={'$like':'%'+_0x2d17b0[_0x5e5b('0x34')][_0x5e5b('0x3d')]+'%'};return _0x454026;})});}_0x5543eb[_0x5e5b('0x3e')]=_[_0x5e5b('0x3f')](_0x5543eb['where'],{'mailboxuser':_0x1aea38[_0x5e5b('0x54')]});_0x5543eb=_[_0x5e5b('0x3f')]({},_0x5543eb,_0x2d17b0[_0x5e5b('0x40')]);return db[_0x5e5b('0x52')][_0x5e5b('0x55')](_0x5543eb)[_0x5e5b('0x27')](respondWithFilteredResult(_0x30b010,_0x5543eb));})[_0x5e5b('0x45')](handleError(_0x30b010,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 34c5b6d..3bb7f54 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 _0x442d=['mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x442d,0x72));var _0xd442=function(_0x220afa,_0xf5f6cc){_0x220afa=_0x220afa-0x0;var _0x1b79d1=_0x442d[_0x220afa];return _0x1b79d1;};'use strict';var _=require(_0xd442('0x0'));var util=require(_0xd442('0x1'));var logger=require(_0xd442('0x2'))(_0xd442('0x3'));var moment=require(_0xd442('0x4'));var BPromise=require(_0xd442('0x5'));var rp=require(_0xd442('0x6'));var fs=require('fs');var path=require(_0xd442('0x7'));var rimraf=require(_0xd442('0x8'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0xd442('0x9')]=function(_0x34c074,_0x48ea16){return _0x34c074[_0xd442('0xa')](_0xd442('0xb'),attributes,{'tableName':_0xd442('0xc'),'paranoid':![],'indexes':[{'name':_0xd442('0xd'),'fields':[_0xd442('0xe'),_0xd442('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x06fe=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util'];(function(_0xf60abf,_0x4727f5){var _0xf0a853=function(_0x9536){while(--_0x9536){_0xf60abf['push'](_0xf60abf['shift']());}};_0xf0a853(++_0x4727f5);}(_0x06fe,0xec));var _0xe06f=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0x06fe[_0xc051b2];return _0x599dc2;};'use strict';var _=require(_0xe06f('0x0'));var util=require(_0xe06f('0x1'));var logger=require(_0xe06f('0x2'))(_0xe06f('0x3'));var moment=require('moment');var BPromise=require(_0xe06f('0x4'));var rp=require(_0xe06f('0x5'));var fs=require('fs');var path=require(_0xe06f('0x6'));var rimraf=require(_0xe06f('0x7'));var config=require(_0xe06f('0x8'));var attributes=require(_0xe06f('0x9'));module[_0xe06f('0xa')]=function(_0xc0e1c5,_0x3e9afb){return _0xc0e1c5[_0xe06f('0xb')](_0xe06f('0xc'),attributes,{'tableName':_0xe06f('0xd'),'paranoid':![],'indexes':[{'name':_0xe06f('0xe'),'fields':[_0xe06f('0xf'),_0xe06f('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ec90829..d475594 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 _0x870d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x1c9242,_0x25e870){var _0x51a780=function(_0x11d70c){while(--_0x11d70c){_0x1c9242['push'](_0x1c9242['shift']());}};_0x51a780(++_0x25e870);}(_0x870d,0xb8));var _0xd870=function(_0x38edfa,_0x4b7db7){_0x38edfa=_0x38edfa-0x0;var _0x34de46=_0x870d[_0x38edfa];return _0x34de46;};'use strict';var _=require(_0xd870('0x0'));var util=require(_0xd870('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd870('0x2'));var db=require(_0xd870('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd870('0x4'))(_0xd870('0x5'));var config=require(_0xd870('0x6'));var jayson=require(_0xd870('0x7'));var client=jayson[_0xd870('0x8')][_0xd870('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b20a3,_0x819d46,_0x30dc39){return new BPromise(function(_0x49b57f,_0x2c759e){return client[_0xd870('0xa')](_0x2b20a3,_0x30dc39)[_0xd870('0xb')](function(_0x2ba280){logger[_0xd870('0xc')](_0xd870('0xd'),_0x819d46,_0xd870('0xe'));logger[_0xd870('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x819d46,'request\x20sent',JSON[_0xd870('0x10')](_0x2ba280));if(_0x2ba280[_0xd870('0x11')]){if(_0x2ba280[_0xd870('0x11')][_0xd870('0x12')]===0x1f4){logger[_0xd870('0x11')](_0xd870('0xd'),_0x819d46,_0x2ba280['error'][_0xd870('0x13')]);return _0x2c759e(_0x2ba280[_0xd870('0x11')][_0xd870('0x13')]);}logger[_0xd870('0x11')](_0xd870('0xd'),_0x819d46,_0x2ba280[_0xd870('0x11')][_0xd870('0x13')]);return _0x49b57f(_0x2ba280['error']['message']);}else{logger[_0xd870('0xc')](_0xd870('0xd'),_0x819d46,'request\x20sent');_0x49b57f(_0x2ba280[_0xd870('0x14')][_0xd870('0x13')]);}})['catch'](function(_0x375d0c){logger[_0xd870('0x11')](_0xd870('0xd'),_0x819d46,_0x375d0c);_0x2c759e(_0x375d0c);});});} \ No newline at end of file +var _0x0b7f=['client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46b864,_0x1c7076){var _0x40ca16=function(_0x532886){while(--_0x532886){_0x46b864['push'](_0x46b864['shift']());}};_0x40ca16(++_0x1c7076);}(_0x0b7f,0x91));var _0xf0b7=function(_0x9572ff,_0x188aba){_0x9572ff=_0x9572ff-0x0;var _0x398c8a=_0x0b7f[_0x9572ff];return _0x398c8a;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require(_0xf0b7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf0b7('0x7')][_0xf0b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b849e,_0x24c0f4,_0x323d47){return new BPromise(function(_0x47d7ae,_0x2a7b2b){return client['request'](_0x2b849e,_0x323d47)[_0xf0b7('0x9')](function(_0x223632){logger[_0xf0b7('0xa')](_0xf0b7('0xb'),_0x24c0f4,_0xf0b7('0xc'));logger[_0xf0b7('0xd')](_0xf0b7('0xe'),_0x24c0f4,'request\x20sent',JSON[_0xf0b7('0xf')](_0x223632));if(_0x223632['error']){if(_0x223632[_0xf0b7('0x10')]['code']===0x1f4){logger[_0xf0b7('0x10')](_0xf0b7('0xb'),_0x24c0f4,_0x223632[_0xf0b7('0x10')][_0xf0b7('0x11')]);return _0x2a7b2b(_0x223632[_0xf0b7('0x10')][_0xf0b7('0x11')]);}logger[_0xf0b7('0x10')](_0xf0b7('0xb'),_0x24c0f4,_0x223632[_0xf0b7('0x10')][_0xf0b7('0x11')]);return _0x47d7ae(_0x223632[_0xf0b7('0x10')][_0xf0b7('0x11')]);}else{logger[_0xf0b7('0xa')](_0xf0b7('0xb'),_0x24c0f4,_0xf0b7('0xc'));_0x47d7ae(_0x223632[_0xf0b7('0x12')][_0xf0b7('0x11')]);}})['catch'](function(_0xbbb66d){logger[_0xf0b7('0x10')](_0xf0b7('0xb'),_0x24c0f4,_0xbbb66d);_0x2a7b2b(_0xbbb66d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 07bb2fa..918f2e6 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 _0x5b2e=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','show','/:id/download','post','create','/:id','update'];(function(_0x337324,_0x4d58cd){var _0x26943b=function(_0x377037){while(--_0x377037){_0x337324['push'](_0x337324['shift']());}};_0x26943b(++_0x4d58cd);}(_0x5b2e,0x101));var _0xe5b2=function(_0x40ebdc,_0x2fdba8){_0x40ebdc=_0x40ebdc-0x0;var _0x172be4=_0x5b2e[_0x40ebdc];return _0x172be4;};'use strict';var multer=require(_0xe5b2('0x0'));var util=require('util');var path=require(_0xe5b2('0x1'));var timeout=require(_0xe5b2('0x2'));var express=require(_0xe5b2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe5b2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe5b2('0x5'));var controller=require(_0xe5b2('0x6'));router['get']('/',auth[_0xe5b2('0x7')](),controller['index']);router[_0xe5b2('0x8')]('/:id',auth[_0xe5b2('0x7')](),controller[_0xe5b2('0x9')]);router[_0xe5b2('0x8')](_0xe5b2('0xa'),auth['isAuthenticated'](),controller['download']);router[_0xe5b2('0xb')]('/',auth[_0xe5b2('0x7')](),controller[_0xe5b2('0xc')]);router['put'](_0xe5b2('0xd'),auth[_0xe5b2('0x7')](),controller[_0xe5b2('0xe')]);router['delete'](_0xe5b2('0xd'),auth[_0xe5b2('0x7')](),controller[_0xe5b2('0xf')]);module[_0xe5b2('0x10')]=router; \ No newline at end of file +var _0xfc7a=['delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','post','put','update'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xfc7a,0x10c));var _0xafc7=function(_0x13211b,_0x3050c2){_0x13211b=_0x13211b-0x0;var _0x4adb44=_0xfc7a[_0x13211b];return _0x4adb44;};'use strict';var multer=require('multer');var util=require(_0xafc7('0x0'));var path=require(_0xafc7('0x1'));var timeout=require('connect-timeout');var express=require(_0xafc7('0x2'));var router=express[_0xafc7('0x3')]();var fs_extra=require(_0xafc7('0x4'));var auth=require(_0xafc7('0x5'));var interaction=require(_0xafc7('0x6'));var config=require(_0xafc7('0x7'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0xafc7('0x8')](),controller[_0xafc7('0x9')]);router[_0xafc7('0xa')](_0xafc7('0xb'),auth[_0xafc7('0x8')](),controller[_0xafc7('0xc')]);router['get'](_0xafc7('0xd'),auth['isAuthenticated'](),controller['download']);router[_0xafc7('0xe')]('/',auth[_0xafc7('0x8')](),controller['create']);router[_0xafc7('0xf')]('/:id',auth[_0xafc7('0x8')](),controller[_0xafc7('0x10')]);router[_0xafc7('0x11')](_0xafc7('0xb'),auth['isAuthenticated'](),controller[_0xafc7('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index f78bbe9..46d4db2 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 _0xa8ad=['INTEGER','STRING','BLOB','long','literal','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x1c0b6d,_0xc318bc){var _0x588418=function(_0x3fc1d6){while(--_0x3fc1d6){_0x1c0b6d['push'](_0x1c0b6d['shift']());}};_0x588418(++_0xc318bc);}(_0xa8ad,0x1a3));var _0xda8a=function(_0xb5d44c,_0x44e3f9){_0xb5d44c=_0xb5d44c-0x0;var _0x281d08=_0xa8ad[_0xb5d44c];return _0x281d08;};'use strict';var Sequelize=require(_0xda8a('0x0'));module[_0xda8a('0x1')]={'name':{'type':Sequelize[_0xda8a('0x2')],'get':function(_0x54debe){return this[_0xda8a('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xda8a('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xda8a('0x6')](_0xda8a('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xda8a('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xda8a('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xb67d=['long','TIMESTAMP','literal','exports','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x543bc5,_0x34c1f4){var _0x39b538=function(_0x8c5a0){while(--_0x8c5a0){_0x543bc5['push'](_0x543bc5['shift']());}};_0x39b538(++_0x34c1f4);}(_0xb67d,0xdb));var _0xdb67=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb67d[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0xdb67('0x0')]={'name':{'type':Sequelize[_0xdb67('0x1')],'get':function(_0x201ef5){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xdb67('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xdb67('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xdb67('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0xdb67('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xdb67('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xdb67('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0xdb67('0x4')](_0xdb67('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xdb67('0x6'),'defaultValue':Sequelize[_0xdb67('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 9e28144..1b2d391 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 _0x89e7=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','type','filter','options','VoiceMailMessage','then','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','update','download','msg_id','recording','Sequelize','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x89e7,0xac));var _0x789e=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x89e7[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0x789e('0x0'));var rimraf=require(_0x789e('0x1'));var zipdir=require(_0x789e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x789e('0x3'));var moment=require(_0x789e('0x4'));var BPromise=require(_0x789e('0x5'));var Mustache=require(_0x789e('0x6'));var util=require('util');var path=require(_0x789e('0x7'));var sox=require(_0x789e('0x8'));var csv=require('to-csv');var ejs=require(_0x789e('0x9'));var fs=require('fs');var fs_extra=require(_0x789e('0xa'));var _=require(_0x789e('0xb'));var squel=require('squel');var crypto=require(_0x789e('0xc'));var jsforce=require(_0x789e('0xd'));var deskjs=require(_0x789e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x789e('0xf'));var Papa=require('papaparse');var Redis=require(_0x789e('0x10'));var authService=require(_0x789e('0x11'));var qs=require(_0x789e('0x12'));var as=require(_0x789e('0x13'));var hardwareService=require(_0x789e('0x14'));var logger=require(_0x789e('0x15'))(_0x789e('0x16'));var utils=require(_0x789e('0x17'));var config=require(_0x789e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x789e('0x19'))['db'];function respondWithStatusCode(_0x23bc31,_0x58eb08){_0x58eb08=_0x58eb08||0xcc;return function(_0xbbf0f5){if(_0xbbf0f5){return _0x23bc31['sendStatus'](_0x58eb08);}return _0x23bc31[_0x789e('0x1a')](_0x58eb08)[_0x789e('0x1b')]();};}function respondWithResult(_0x502208,_0x504352){_0x504352=_0x504352||0xc8;return function(_0x48c77d){if(_0x48c77d){return _0x502208[_0x789e('0x1a')](_0x504352)[_0x789e('0x1c')](_0x48c77d);}};}function respondWithFilteredResult(_0x15c6c0,_0x524008){return function(_0x2ea18a){if(_0x2ea18a){var _0x50b46b=typeof _0x524008[_0x789e('0x1d')]===_0x789e('0x1e')&&typeof _0x524008[_0x789e('0x1f')]===_0x789e('0x1e');var _0x3bf62d=_0x2ea18a[_0x789e('0x20')];var _0x47c6e9=_0x50b46b?0x0:_0x524008[_0x789e('0x1d')];var _0x35eefb=_0x50b46b?_0x2ea18a[_0x789e('0x20')]:_0x524008[_0x789e('0x1d')]+_0x524008[_0x789e('0x1f')];var _0x35ee60;if(_0x35eefb>=_0x3bf62d){_0x35eefb=_0x3bf62d;_0x35ee60=0xc8;}else{_0x35ee60=0xce;}_0x15c6c0['status'](_0x35ee60);return _0x15c6c0['set'](_0x789e('0x21'),_0x47c6e9+'-'+_0x35eefb+'/'+_0x3bf62d)['json'](_0x2ea18a);}return null;};}function patchUpdates(_0x39626d){return function(_0x2479c7){try{jsonpatch[_0x789e('0x22')](_0x2479c7,_0x39626d,!![]);}catch(_0x19614b){return BPromise[_0x789e('0x23')](_0x19614b);}return _0x2479c7[_0x789e('0x24')]();};}function saveUpdates(_0x5aca29,_0x9b5056){return function(_0x49f9ae){if(_0x49f9ae){return _0x49f9ae['update'](_0x5aca29)['then'](function(_0x39dde0){return _0x39dde0;});}return null;};}function removeEntity(_0x2cb676,_0xee6e2f){return function(_0x329662){if(_0x329662){return _0x329662[_0x789e('0x25')]()['then'](function(){_0x2cb676['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2485cc,_0x14dea0){return function(_0x2375d1){if(!_0x2375d1){_0x2485cc['sendStatus'](0x194);}return _0x2375d1;};}function handleError(_0x1ab91f,_0x12a146){_0x12a146=_0x12a146||0x1f4;return function(_0x23ff31){logger[_0x789e('0x26')](_0x23ff31[_0x789e('0x27')]);if(_0x23ff31[_0x789e('0x28')]){delete _0x23ff31['name'];}_0x1ab91f[_0x789e('0x1a')](_0x12a146)[_0x789e('0x29')](_0x23ff31);};}exports[_0x789e('0x2a')]=function(_0x57ff69,_0xd1407c){var _0x35f770={},_0x456956={},_0x38b29f={'count':0x0,'rows':[]};var _0x19d04e=_['map'](db['VoiceMailMessage'][_0x789e('0x2b')],function(_0x592cd7){return{'name':_0x592cd7[_0x789e('0x2c')],'type':_0x592cd7['type'][_0x789e('0x2d')]};});_0x456956[_0x789e('0x2e')]=_['differenceBy'](_[_0x789e('0x2f')](_0x19d04e,_0x789e('0x28')),[_0x789e('0x28')]);_0x456956[_0x789e('0x30')]=_[_0x789e('0x31')](_0x57ff69[_0x789e('0x30')]);_0x456956[_0x789e('0x32')]=_['intersection'](_0x456956['model'],_0x456956[_0x789e('0x30')]);_0x35f770[_0x789e('0x33')]=_[_0x789e('0x34')](_0x456956[_0x789e('0x2e')],qs['fields'](_0x57ff69[_0x789e('0x30')][_0x789e('0x35')]));_0x35f770[_0x789e('0x33')]=_0x35f770[_0x789e('0x33')][_0x789e('0x36')]?_0x35f770[_0x789e('0x33')]:_0x456956[_0x789e('0x2e')];if(!_0x57ff69[_0x789e('0x30')][_0x789e('0x37')](_0x789e('0x38'))){_0x35f770[_0x789e('0x1f')]=qs[_0x789e('0x1f')](_0x57ff69[_0x789e('0x30')][_0x789e('0x1f')]);_0x35f770[_0x789e('0x1d')]=qs[_0x789e('0x1d')](_0x57ff69[_0x789e('0x30')]['offset']);}_0x35f770['order']=qs[_0x789e('0x39')](_0x57ff69['query'][_0x789e('0x39')]);_0x35f770['where']=qs[_0x789e('0x32')](_[_0x789e('0x3a')](_0x57ff69[_0x789e('0x30')],_0x456956[_0x789e('0x32')]),_0x19d04e);if(_0x57ff69[_0x789e('0x30')]['filter']){_0x35f770[_0x789e('0x3b')]=_['merge'](_0x35f770[_0x789e('0x3b')],{'$or':_['map'](_0x19d04e,function(_0x38bb88){if(_0x38bb88[_0x789e('0x3c')]!=='VIRTUAL'){var _0x3489f8={};_0x3489f8[_0x38bb88[_0x789e('0x28')]]={'$like':'%'+_0x57ff69['query'][_0x789e('0x3d')]+'%'};return _0x3489f8;}})});}_0x35f770=_['merge']({},_0x35f770,_0x57ff69[_0x789e('0x3e')]);var _0x220db3={'where':_0x35f770[_0x789e('0x3b')]};return db[_0x789e('0x3f')][_0x789e('0x20')](_0x220db3)[_0x789e('0x40')](function(_0x57a711){_0x38b29f[_0x789e('0x20')]=_0x57a711;if(_0x57ff69[_0x789e('0x30')][_0x789e('0x41')]){_0x35f770[_0x789e('0x42')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x789e('0x43')](_0x35f770);})['then'](function(_0x4946bc){_0x38b29f[_0x789e('0x44')]=_0x4946bc;return _0x38b29f;})[_0x789e('0x40')](respondWithFilteredResult(_0xd1407c,_0x35f770))['catch'](handleError(_0xd1407c,null));};exports[_0x789e('0x45')]=function(_0x2f8c8d,_0x436d3c){var _0x3bd72b={'raw':!![],'where':{'id':_0x2f8c8d[_0x789e('0x46')]['id']}},_0x17cb79={};_0x17cb79[_0x789e('0x2e')]=_[_0x789e('0x31')](db[_0x789e('0x3f')][_0x789e('0x2b')]);_0x17cb79[_0x789e('0x30')]=_[_0x789e('0x31')](_0x2f8c8d[_0x789e('0x30')]);_0x17cb79[_0x789e('0x32')]=_[_0x789e('0x34')](_0x17cb79[_0x789e('0x2e')],_0x17cb79['query']);_0x3bd72b['attributes']=_[_0x789e('0x34')](_0x17cb79['model'],qs[_0x789e('0x35')](_0x2f8c8d['query']['fields']));_0x3bd72b[_0x789e('0x33')]=_0x3bd72b[_0x789e('0x33')][_0x789e('0x36')]?_0x3bd72b[_0x789e('0x33')]:_0x17cb79[_0x789e('0x2e')];if(_0x2f8c8d[_0x789e('0x30')][_0x789e('0x41')]){_0x3bd72b[_0x789e('0x42')]=[{'all':!![]}];}_0x3bd72b=_[_0x789e('0x47')]({},_0x3bd72b,_0x2f8c8d[_0x789e('0x3e')]);return db['VoiceMailMessage'][_0x789e('0x48')](_0x3bd72b)['then'](handleEntityNotFound(_0x436d3c,null))['then'](respondWithResult(_0x436d3c,null))[_0x789e('0x49')](handleError(_0x436d3c,null));};exports[_0x789e('0x4a')]=function(_0x37260c,_0x5bb13f){return db[_0x789e('0x3f')][_0x789e('0x4a')](_0x37260c[_0x789e('0x4b')],{})[_0x789e('0x40')](respondWithResult(_0x5bb13f,0xc9))[_0x789e('0x49')](handleError(_0x5bb13f,null));};exports[_0x789e('0x4c')]=function(_0x585142,_0x1fea90){if(_0x585142[_0x789e('0x4b')]['id']){delete _0x585142[_0x789e('0x4b')]['id'];}return db['VoiceMailMessage'][_0x789e('0x48')]({'where':{'id':_0x585142[_0x789e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1fea90,null))[_0x789e('0x40')](saveUpdates(_0x585142['body'],null))['then'](respondWithResult(_0x1fea90,null))['catch'](handleError(_0x1fea90,null));};exports[_0x789e('0x25')]=function(_0x5773a7,_0xf6ada8){return db[_0x789e('0x3f')][_0x789e('0x48')]({'where':{'id':_0x5773a7[_0x789e('0x46')]['id']}})[_0x789e('0x40')](handleEntityNotFound(_0xf6ada8,null))[_0x789e('0x40')](removeEntity(_0xf6ada8,null))[_0x789e('0x49')](handleError(_0xf6ada8,null));};exports[_0x789e('0x4d')]=function(_0x508536,_0x4b2d84,_0x3637b9){return db[_0x789e('0x3f')][_0x789e('0x48')]({'where':{'id':_0x508536[_0x789e('0x46')]['id']},'attributes':['id','recording',_0x789e('0x4e')]})[_0x789e('0x40')](handleEntityNotFound(_0x4b2d84,null))['then'](function(_0x5b5c95){if(_0x5b5c95){if(!_0x5b5c95[_0x789e('0x4f')]){throw new db[(_0x789e('0x50'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0xb1861d={'Content-Type':'audio/wav','Content-Disposition':_0x789e('0x51')};if(_0x5b5c95[_0x789e('0x4e')]){_0xb1861d[_0x789e('0x52')]=_0x789e('0x53')+_0x5b5c95[_0x789e('0x4e')]+_0x789e('0x54');}_0x4b2d84[_0x789e('0x55')](_0xb1861d);return _0x4b2d84[_0x789e('0x29')](new Buffer(_0x5b5c95[_0x789e('0x4f')]));}})['catch'](handleError(_0x4b2d84,null));}; \ No newline at end of file +var _0x843a=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','recording','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x2b3e1c,_0xc434b2){var _0x316f38=function(_0x4be538){while(--_0x4be538){_0x2b3e1c['push'](_0x2b3e1c['shift']());}};_0x316f38(++_0xc434b2);}(_0x843a,0x101));var _0xa843=function(_0x3428c7,_0xd73f31){_0x3428c7=_0x3428c7-0x0;var _0x22cefb=_0x843a[_0x3428c7];return _0x22cefb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa843('0x0'));var zipdir=require(_0xa843('0x1'));var jsonpatch=require(_0xa843('0x2'));var rp=require(_0xa843('0x3'));var moment=require(_0xa843('0x4'));var BPromise=require(_0xa843('0x5'));var Mustache=require(_0xa843('0x6'));var util=require('util');var path=require(_0xa843('0x7'));var sox=require('sox');var csv=require(_0xa843('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa843('0x9'));var _=require(_0xa843('0xa'));var squel=require(_0xa843('0xb'));var crypto=require(_0xa843('0xc'));var jsforce=require(_0xa843('0xd'));var deskjs=require(_0xa843('0xe'));var toCsv=require(_0xa843('0x8'));var querystring=require(_0xa843('0xf'));var Papa=require(_0xa843('0x10'));var Redis=require(_0xa843('0x11'));var authService=require(_0xa843('0x12'));var qs=require(_0xa843('0x13'));var as=require(_0xa843('0x14'));var hardwareService=require(_0xa843('0x15'));var logger=require(_0xa843('0x16'))(_0xa843('0x17'));var utils=require(_0xa843('0x18'));var config=require(_0xa843('0x19'));var licenseUtil=require(_0xa843('0x1a'));var db=require(_0xa843('0x1b'))['db'];function respondWithStatusCode(_0x463a5b,_0x15c9c6){_0x15c9c6=_0x15c9c6||0xcc;return function(_0x2aef1d){if(_0x2aef1d){return _0x463a5b[_0xa843('0x1c')](_0x15c9c6);}return _0x463a5b[_0xa843('0x1d')](_0x15c9c6)[_0xa843('0x1e')]();};}function respondWithResult(_0x345e61,_0xe211f){_0xe211f=_0xe211f||0xc8;return function(_0x56c17b){if(_0x56c17b){return _0x345e61[_0xa843('0x1d')](_0xe211f)[_0xa843('0x1f')](_0x56c17b);}};}function respondWithFilteredResult(_0x304869,_0x91bf8a){return function(_0x9771d5){if(_0x9771d5){var _0x18b6d2=typeof _0x91bf8a[_0xa843('0x20')]==='undefined'&&typeof _0x91bf8a[_0xa843('0x21')]===_0xa843('0x22');var _0x55cfde=_0x9771d5[_0xa843('0x23')];var _0x265635=_0x18b6d2?0x0:_0x91bf8a[_0xa843('0x20')];var _0x298a4f=_0x18b6d2?_0x9771d5[_0xa843('0x23')]:_0x91bf8a[_0xa843('0x20')]+_0x91bf8a[_0xa843('0x21')];var _0x213f12;if(_0x298a4f>=_0x55cfde){_0x298a4f=_0x55cfde;_0x213f12=0xc8;}else{_0x213f12=0xce;}_0x304869[_0xa843('0x1d')](_0x213f12);return _0x304869[_0xa843('0x24')]('Content-Range',_0x265635+'-'+_0x298a4f+'/'+_0x55cfde)['json'](_0x9771d5);}return null;};}function patchUpdates(_0x34f76e){return function(_0x3e0939){try{jsonpatch[_0xa843('0x25')](_0x3e0939,_0x34f76e,!![]);}catch(_0x1ee9fa){return BPromise[_0xa843('0x26')](_0x1ee9fa);}return _0x3e0939[_0xa843('0x27')]();};}function saveUpdates(_0x25d92e,_0x158179){return function(_0x28adcb){if(_0x28adcb){return _0x28adcb[_0xa843('0x28')](_0x25d92e)[_0xa843('0x29')](function(_0x570c9c){return _0x570c9c;});}return null;};}function removeEntity(_0x5a09cd,_0x5456c0){return function(_0x4cbb1d){if(_0x4cbb1d){return _0x4cbb1d[_0xa843('0x2a')]()['then'](function(){_0x5a09cd[_0xa843('0x1d')](0xcc)[_0xa843('0x1e')]();});}};}function handleEntityNotFound(_0xa15b0a,_0x2707bb){return function(_0x563d24){if(!_0x563d24){_0xa15b0a[_0xa843('0x1c')](0x194);}return _0x563d24;};}function handleError(_0x49b396,_0x58a12b){_0x58a12b=_0x58a12b||0x1f4;return function(_0xcbf8e7){logger[_0xa843('0x2b')](_0xcbf8e7[_0xa843('0x2c')]);if(_0xcbf8e7[_0xa843('0x2d')]){delete _0xcbf8e7[_0xa843('0x2d')];}_0x49b396[_0xa843('0x1d')](_0x58a12b)[_0xa843('0x2e')](_0xcbf8e7);};}exports[_0xa843('0x2f')]=function(_0x1a4d7a,_0x20f2ee){var _0x4b65bd={},_0x64a640={},_0x91a35d={'count':0x0,'rows':[]};var _0x59fe26=_[_0xa843('0x30')](db[_0xa843('0x31')]['rawAttributes'],function(_0x9c205f){return{'name':_0x9c205f[_0xa843('0x32')],'type':_0x9c205f[_0xa843('0x33')][_0xa843('0x34')]};});_0x64a640['model']=_[_0xa843('0x35')](_[_0xa843('0x30')](_0x59fe26,'name'),[_0xa843('0x2d')]);_0x64a640[_0xa843('0x36')]=_[_0xa843('0x37')](_0x1a4d7a['query']);_0x64a640['filters']=_['intersection'](_0x64a640[_0xa843('0x38')],_0x64a640['query']);_0x4b65bd[_0xa843('0x39')]=_[_0xa843('0x3a')](_0x64a640['model'],qs[_0xa843('0x3b')](_0x1a4d7a[_0xa843('0x36')]['fields']));_0x4b65bd[_0xa843('0x39')]=_0x4b65bd[_0xa843('0x39')][_0xa843('0x3c')]?_0x4b65bd[_0xa843('0x39')]:_0x64a640[_0xa843('0x38')];if(!_0x1a4d7a[_0xa843('0x36')][_0xa843('0x3d')]('nolimit')){_0x4b65bd[_0xa843('0x21')]=qs[_0xa843('0x21')](_0x1a4d7a[_0xa843('0x36')]['limit']);_0x4b65bd[_0xa843('0x20')]=qs['offset'](_0x1a4d7a[_0xa843('0x36')]['offset']);}_0x4b65bd['order']=qs[_0xa843('0x3e')](_0x1a4d7a['query'][_0xa843('0x3e')]);_0x4b65bd[_0xa843('0x3f')]=qs[_0xa843('0x40')](_[_0xa843('0x41')](_0x1a4d7a[_0xa843('0x36')],_0x64a640[_0xa843('0x40')]),_0x59fe26);if(_0x1a4d7a[_0xa843('0x36')][_0xa843('0x42')]){_0x4b65bd[_0xa843('0x3f')]=_[_0xa843('0x43')](_0x4b65bd[_0xa843('0x3f')],{'$or':_[_0xa843('0x30')](_0x59fe26,function(_0x630203){if(_0x630203[_0xa843('0x33')]!==_0xa843('0x44')){var _0x1e573d={};_0x1e573d[_0x630203[_0xa843('0x2d')]]={'$like':'%'+_0x1a4d7a['query'][_0xa843('0x42')]+'%'};return _0x1e573d;}})});}_0x4b65bd=_['merge']({},_0x4b65bd,_0x1a4d7a[_0xa843('0x45')]);var _0x3a7930={'where':_0x4b65bd[_0xa843('0x3f')]};return db[_0xa843('0x31')][_0xa843('0x23')](_0x3a7930)[_0xa843('0x29')](function(_0x4570ed){_0x91a35d[_0xa843('0x23')]=_0x4570ed;if(_0x1a4d7a['query'][_0xa843('0x46')]){_0x4b65bd[_0xa843('0x47')]=[{'all':!![]}];}return db[_0xa843('0x31')][_0xa843('0x48')](_0x4b65bd);})[_0xa843('0x29')](function(_0x7cd3ef){_0x91a35d[_0xa843('0x49')]=_0x7cd3ef;return _0x91a35d;})['then'](respondWithFilteredResult(_0x20f2ee,_0x4b65bd))[_0xa843('0x4a')](handleError(_0x20f2ee,null));};exports[_0xa843('0x4b')]=function(_0x412541,_0x5e8334){var _0x157e27={'raw':!![],'where':{'id':_0x412541[_0xa843('0x4c')]['id']}},_0x5bbb15={};_0x5bbb15[_0xa843('0x38')]=_['keys'](db[_0xa843('0x31')][_0xa843('0x4d')]);_0x5bbb15[_0xa843('0x36')]=_['keys'](_0x412541[_0xa843('0x36')]);_0x5bbb15['filters']=_[_0xa843('0x3a')](_0x5bbb15[_0xa843('0x38')],_0x5bbb15['query']);_0x157e27[_0xa843('0x39')]=_[_0xa843('0x3a')](_0x5bbb15[_0xa843('0x38')],qs['fields'](_0x412541[_0xa843('0x36')][_0xa843('0x3b')]));_0x157e27[_0xa843('0x39')]=_0x157e27[_0xa843('0x39')][_0xa843('0x3c')]?_0x157e27[_0xa843('0x39')]:_0x5bbb15[_0xa843('0x38')];if(_0x412541[_0xa843('0x36')]['includeAll']){_0x157e27[_0xa843('0x47')]=[{'all':!![]}];}_0x157e27=_[_0xa843('0x43')]({},_0x157e27,_0x412541[_0xa843('0x45')]);return db['VoiceMailMessage'][_0xa843('0x4e')](_0x157e27)[_0xa843('0x29')](handleEntityNotFound(_0x5e8334,null))[_0xa843('0x29')](respondWithResult(_0x5e8334,null))['catch'](handleError(_0x5e8334,null));};exports[_0xa843('0x4f')]=function(_0x53cceb,_0x13638f){return db[_0xa843('0x31')][_0xa843('0x4f')](_0x53cceb['body'],{})[_0xa843('0x29')](respondWithResult(_0x13638f,0xc9))[_0xa843('0x4a')](handleError(_0x13638f,null));};exports[_0xa843('0x28')]=function(_0x566170,_0x18096a){if(_0x566170[_0xa843('0x50')]['id']){delete _0x566170['body']['id'];}return db[_0xa843('0x31')][_0xa843('0x4e')]({'where':{'id':_0x566170[_0xa843('0x4c')]['id']}})[_0xa843('0x29')](handleEntityNotFound(_0x18096a,null))['then'](saveUpdates(_0x566170[_0xa843('0x50')],null))['then'](respondWithResult(_0x18096a,null))[_0xa843('0x4a')](handleError(_0x18096a,null));};exports[_0xa843('0x2a')]=function(_0x4f1956,_0x22841f){return db[_0xa843('0x31')][_0xa843('0x4e')]({'where':{'id':_0x4f1956[_0xa843('0x4c')]['id']}})[_0xa843('0x29')](handleEntityNotFound(_0x22841f,null))[_0xa843('0x29')](removeEntity(_0x22841f,null))['catch'](handleError(_0x22841f,null));};exports[_0xa843('0x51')]=function(_0x45c291,_0x382b05,_0x1ec4b5){return db[_0xa843('0x31')][_0xa843('0x4e')]({'where':{'id':_0x45c291[_0xa843('0x4c')]['id']},'attributes':['id','recording',_0xa843('0x52')]})[_0xa843('0x29')](handleEntityNotFound(_0x382b05,null))['then'](function(_0x4264a8){if(_0x4264a8){if(!_0x4264a8['recording']){throw new db[(_0xa843('0x53'))][(_0xa843('0x54'))](_0xa843('0x55'));}var _0x32c447={'Content-Type':_0xa843('0x56'),'Content-Disposition':'attachment'};if(_0x4264a8[_0xa843('0x52')]){_0x32c447[_0xa843('0x57')]='attachment;\x20filename=\x22'+_0x4264a8['msg_id']+_0xa843('0x58');}_0x382b05['set'](_0x32c447);return _0x382b05[_0xa843('0x2e')](new Buffer(_0x4264a8[_0xa843('0x59')]));}})[_0xa843('0x4a')](handleError(_0x382b05,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 66be602..48d311b 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 _0x7482=['rimraf','exports','VoiceMailMessage','dir','lodash','util','api','path'];(function(_0x349823,_0x380ae9){var _0x3ce632=function(_0x111988){while(--_0x111988){_0x349823['push'](_0x349823['shift']());}};_0x3ce632(++_0x380ae9);}(_0x7482,0x18c));var _0x2748=function(_0x15f798,_0x146c8b){_0x15f798=_0x15f798-0x0;var _0xb03241=_0x7482[_0x15f798];return _0xb03241;};'use strict';var _=require(_0x2748('0x0'));var util=require(_0x2748('0x1'));var logger=require('../../config/logger')(_0x2748('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2748('0x3'));var rimraf=require(_0x2748('0x4'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x2748('0x5')]=function(_0x2e1859,_0x3b3aaf){return _0x2e1859['define'](_0x2748('0x6'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x2748('0x7'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x0c8e=['path','rimraf','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x0c8e,0xbd));var _0xe0c8=function(_0x125e64,_0x5153a8){_0x125e64=_0x125e64-0x0;var _0x26baa4=_0x0c8e[_0x125e64];return _0x26baa4;};'use strict';var _=require(_0xe0c8('0x0'));var util=require(_0xe0c8('0x1'));var logger=require(_0xe0c8('0x2'))(_0xe0c8('0x3'));var moment=require(_0xe0c8('0x4'));var BPromise=require(_0xe0c8('0x5'));var rp=require(_0xe0c8('0x6'));var fs=require('fs');var path=require(_0xe0c8('0x7'));var rimraf=require(_0xe0c8('0x8'));var config=require('../../config/environment');var attributes=require(_0xe0c8('0x9'));module[_0xe0c8('0xa')]=function(_0x5d1439,_0x107a40){return _0x5d1439['define'](_0xe0c8('0xb'),attributes,{'tableName':_0xe0c8('0xc'),'paranoid':![],'indexes':[{'name':_0xe0c8('0xd'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 1e9eeca..1464e16 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 _0xe880=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x2341f8,_0x4e86a7){var _0x4578af=function(_0x5bf83d){while(--_0x5bf83d){_0x2341f8['push'](_0x2341f8['shift']());}};_0x4578af(++_0x4e86a7);}(_0xe880,0x1d5));var _0x0e88=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xe880[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0e88('0x0'));var util=require(_0x0e88('0x1'));var moment=require(_0x0e88('0x2'));var BPromise=require(_0x0e88('0x3'));var rs=require(_0x0e88('0x4'));var fs=require('fs');var Redis=require(_0x0e88('0x5'));var db=require(_0x0e88('0x6'))['db'];var utils=require(_0x0e88('0x7'));var logger=require(_0x0e88('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0e88('0x9'));var client=jayson[_0x0e88('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x79b8d5,_0x397adf,_0x23ea1c){return new BPromise(function(_0x26a708,_0x1ad23a){return client[_0x0e88('0xb')](_0x79b8d5,_0x23ea1c)[_0x0e88('0xc')](function(_0x556c96){logger[_0x0e88('0xd')](_0x0e88('0xe'),_0x397adf,_0x0e88('0xf'));logger[_0x0e88('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x397adf,'request\x20sent',JSON[_0x0e88('0x11')](_0x556c96));if(_0x556c96[_0x0e88('0x12')]){if(_0x556c96['error'][_0x0e88('0x13')]===0x1f4){logger[_0x0e88('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x397adf,_0x556c96[_0x0e88('0x12')][_0x0e88('0x14')]);return _0x1ad23a(_0x556c96[_0x0e88('0x12')]['message']);}logger[_0x0e88('0x12')](_0x0e88('0xe'),_0x397adf,_0x556c96[_0x0e88('0x12')][_0x0e88('0x14')]);return _0x26a708(_0x556c96[_0x0e88('0x12')][_0x0e88('0x14')]);}else{logger['info'](_0x0e88('0xe'),_0x397adf,'request\x20sent');_0x26a708(_0x556c96['result'][_0x0e88('0x14')]);}})[_0x0e88('0x15')](function(_0x2eb949){logger[_0x0e88('0x12')](_0x0e88('0xe'),_0x397adf,_0x2eb949);_0x1ad23a(_0x2eb949);});});} \ No newline at end of file +var _0xae2e=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x3416e1,_0x9eaf1f){var _0x40801b=function(_0x282184){while(--_0x282184){_0x3416e1['push'](_0x3416e1['shift']());}};_0x40801b(++_0x9eaf1f);}(_0xae2e,0xdf));var _0xeae2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xae2e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xeae2('0x0'));var util=require(_0xeae2('0x1'));var moment=require(_0xeae2('0x2'));var BPromise=require(_0xeae2('0x3'));var rs=require(_0xeae2('0x4'));var fs=require('fs');var Redis=require(_0xeae2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeae2('0x6'))('rpc');var config=require(_0xeae2('0x7'));var jayson=require(_0xeae2('0x8'));var client=jayson[_0xeae2('0x9')][_0xeae2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30022d,_0x28044a,_0x5a6d56){return new BPromise(function(_0x4d6ed2,_0x4601a3){return client[_0xeae2('0xb')](_0x30022d,_0x5a6d56)[_0xeae2('0xc')](function(_0x404266){logger['info'](_0xeae2('0xd'),_0x28044a,_0xeae2('0xe'));logger[_0xeae2('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x28044a,_0xeae2('0xe'),JSON[_0xeae2('0x10')](_0x404266));if(_0x404266[_0xeae2('0x11')]){if(_0x404266[_0xeae2('0x11')]['code']===0x1f4){logger[_0xeae2('0x11')](_0xeae2('0xd'),_0x28044a,_0x404266['error'][_0xeae2('0x12')]);return _0x4601a3(_0x404266[_0xeae2('0x11')][_0xeae2('0x12')]);}logger[_0xeae2('0x11')](_0xeae2('0xd'),_0x28044a,_0x404266['error']['message']);return _0x4d6ed2(_0x404266[_0xeae2('0x11')][_0xeae2('0x12')]);}else{logger[_0xeae2('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x28044a,_0xeae2('0xe'));_0x4d6ed2(_0x404266[_0xeae2('0x14')][_0xeae2('0x12')]);}})[_0xeae2('0x15')](function(_0xf9e397){logger[_0xeae2('0x11')](_0xeae2('0xd'),_0x28044a,_0xf9e397);_0x4601a3(_0xf9e397);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d3d593c..daf43a2 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 _0x7cc5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','/:id/sounds','post','create','addSound','put','delete','/:id/sounds/:id2','exports','util'];(function(_0x2ef8f1,_0x1280a3){var _0x17498d=function(_0xd20876){while(--_0xd20876){_0x2ef8f1['push'](_0x2ef8f1['shift']());}};_0x17498d(++_0x1280a3);}(_0x7cc5,0x110));var _0x57cc=function(_0x3e2cfe,_0x516d5c){_0x3e2cfe=_0x3e2cfe-0x0;var _0x31e56f=_0x7cc5[_0x3e2cfe];return _0x31e56f;};'use strict';var multer=require('multer');var util=require(_0x57cc('0x0'));var path=require(_0x57cc('0x1'));var timeout=require(_0x57cc('0x2'));var express=require('express');var router=express[_0x57cc('0x3')]();var fs_extra=require(_0x57cc('0x4'));var auth=require(_0x57cc('0x5'));var interaction=require(_0x57cc('0x6'));var config=require(_0x57cc('0x7'));var controller=require(_0x57cc('0x8'));router[_0x57cc('0x9')]('/',auth[_0x57cc('0xa')](),controller[_0x57cc('0xb')]);router[_0x57cc('0x9')](_0x57cc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x57cc('0x9')](_0x57cc('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x57cc('0xe')]('/',auth[_0x57cc('0xa')](),controller[_0x57cc('0xf')]);router['post'](_0x57cc('0xd'),auth[_0x57cc('0xa')](),controller[_0x57cc('0x10')]);router[_0x57cc('0x11')](_0x57cc('0xc'),auth[_0x57cc('0xa')](),controller['update']);router[_0x57cc('0x12')](_0x57cc('0xc'),auth[_0x57cc('0xa')](),controller['destroy']);router['delete'](_0x57cc('0x13'),auth[_0x57cc('0xa')](),controller['removeSound']);module[_0x57cc('0x14')]=router; \ No newline at end of file +var _0xfc0d=['/:id/sounds','put','delete','destroy','removeSound','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','getSounds','post','create'];(function(_0x4618da,_0x27c024){var _0xede04a=function(_0x2bdf4c){while(--_0x2bdf4c){_0x4618da['push'](_0x4618da['shift']());}};_0xede04a(++_0x27c024);}(_0xfc0d,0x155));var _0xdfc0=function(_0x478c66,_0x14f892){_0x478c66=_0x478c66-0x0;var _0x2656ed=_0xfc0d[_0x478c66];return _0x2656ed;};'use strict';var multer=require(_0xdfc0('0x0'));var util=require(_0xdfc0('0x1'));var path=require(_0xdfc0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdfc0('0x3')]();var fs_extra=require(_0xdfc0('0x4'));var auth=require(_0xdfc0('0x5'));var interaction=require(_0xdfc0('0x6'));var config=require('../../config/environment');var controller=require(_0xdfc0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdfc0('0x8')]);router[_0xdfc0('0x9')](_0xdfc0('0xa'),auth[_0xdfc0('0xb')](),controller[_0xdfc0('0xc')]);router[_0xdfc0('0x9')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xdfc0('0xd')]);router[_0xdfc0('0xe')]('/',auth[_0xdfc0('0xb')](),controller[_0xdfc0('0xf')]);router[_0xdfc0('0xe')](_0xdfc0('0x10'),auth[_0xdfc0('0xb')](),controller['addSound']);router[_0xdfc0('0x11')](_0xdfc0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xdfc0('0x12')](_0xdfc0('0xa'),auth[_0xdfc0('0xb')](),controller[_0xdfc0('0x13')]);router[_0xdfc0('0x12')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xdfc0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 735848e..74e0343 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 _0x1f4f=['quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1f4f,0x84));var _0xf1f4=function(_0x8d1998,_0x50865e){_0x8d1998=_0x8d1998-0x0;var _0x292d7c=_0x1f4f[_0x8d1998];return _0x292d7c;};'use strict';var Sequelize=require(_0xf1f4('0x0'));module[_0xf1f4('0x1')]={'name':{'type':Sequelize[_0xf1f4('0x2')],'allowNull':![],'unique':_0xf1f4('0x3')},'mode':{'type':Sequelize[_0xf1f4('0x4')](_0xf1f4('0x5'),_0xf1f4('0x6'),_0xf1f4('0x7'),_0xf1f4('0x8'),_0xf1f4('0x9'),_0xf1f4('0xa')),'allowNull':!![],'defaultValue':_0xf1f4('0x6')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xf1f4('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xf1f4('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf1f4('0xb')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xf1f4('0xc')},'defaultEntry':{'type':Sequelize[_0xf1f4('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x65db=['files','mp3nb','quietmp3nb','quietmp3','mp3','BOOLEAN','exports','STRING','name','ENUM','custom'];(function(_0x14a2aa,_0x248941){var _0x46895b=function(_0x15d023){while(--_0x15d023){_0x14a2aa['push'](_0x14a2aa['shift']());}};_0x46895b(++_0x248941);}(_0x65db,0x7f));var _0xb65d=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x65db[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');module[_0xb65d('0x0')]={'name':{'type':Sequelize[_0xb65d('0x1')],'allowNull':![],'unique':_0xb65d('0x2')},'mode':{'type':Sequelize[_0xb65d('0x3')](_0xb65d('0x4'),_0xb65d('0x5'),_0xb65d('0x6'),_0xb65d('0x7'),_0xb65d('0x8'),_0xb65d('0x9')),'allowNull':!![],'defaultValue':_0xb65d('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xb65d('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xb65d('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xb65d('0x1')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xb65d('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xb65d('0xa')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 0b64471..fe2445d 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 _0xe6b2=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','include','options','find','body','params','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','MusicOnHolds','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','pick','getSounds','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x487f22,_0x2cc035){var _0x5b8880=function(_0x3cdd0f){while(--_0x3cdd0f){_0x487f22['push'](_0x487f22['shift']());}};_0x5b8880(++_0x2cc035);}(_0xe6b2,0x148));var _0x2e6b=function(_0x1e8d82,_0x3c0d34){_0x1e8d82=_0x1e8d82-0x0;var _0x3d5234=_0xe6b2[_0x1e8d82];return _0x3d5234;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2e6b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2e6b('0x1'));var moment=require(_0x2e6b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2e6b('0x3'));var util=require(_0x2e6b('0x4'));var path=require('path');var sox=require(_0x2e6b('0x5'));var csv=require(_0x2e6b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2e6b('0x7'));var crypto=require(_0x2e6b('0x8'));var jsforce=require(_0x2e6b('0x9'));var deskjs=require(_0x2e6b('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2e6b('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2e6b('0xc'));var qs=require(_0x2e6b('0xd'));var as=require(_0x2e6b('0xe'));var hardwareService=require(_0x2e6b('0xf'));var logger=require(_0x2e6b('0x10'))('api');var utils=require(_0x2e6b('0x11'));var config=require(_0x2e6b('0x12'));var licenseUtil=require(_0x2e6b('0x13'));var db=require(_0x2e6b('0x14'))['db'];function respondWithStatusCode(_0x4d345c,_0x38a983){_0x38a983=_0x38a983||0xcc;return function(_0x3d0a70){if(_0x3d0a70){return _0x4d345c[_0x2e6b('0x15')](_0x38a983);}return _0x4d345c['status'](_0x38a983)[_0x2e6b('0x16')]();};}function respondWithResult(_0x3a04c6,_0x5bb32a){_0x5bb32a=_0x5bb32a||0xc8;return function(_0x48b6cd){if(_0x48b6cd){return _0x3a04c6[_0x2e6b('0x17')](_0x5bb32a)[_0x2e6b('0x18')](_0x48b6cd);}};}function respondWithFilteredResult(_0x985f19,_0x172e64){return function(_0x3987e3){if(_0x3987e3){var _0x493a4f=typeof _0x172e64['offset']===_0x2e6b('0x19')&&typeof _0x172e64['limit']===_0x2e6b('0x19');var _0x2d3c21=_0x3987e3['count'];var _0x2ceb6b=_0x493a4f?0x0:_0x172e64['offset'];var _0x2b9e72=_0x493a4f?_0x3987e3[_0x2e6b('0x1a')]:_0x172e64[_0x2e6b('0x1b')]+_0x172e64[_0x2e6b('0x1c')];var _0x393813;if(_0x2b9e72>=_0x2d3c21){_0x2b9e72=_0x2d3c21;_0x393813=0xc8;}else{_0x393813=0xce;}_0x985f19['status'](_0x393813);return _0x985f19[_0x2e6b('0x1d')]('Content-Range',_0x2ceb6b+'-'+_0x2b9e72+'/'+_0x2d3c21)[_0x2e6b('0x18')](_0x3987e3);}return null;};}function patchUpdates(_0x808a14){return function(_0x149515){try{jsonpatch[_0x2e6b('0x1e')](_0x149515,_0x808a14,!![]);}catch(_0x1b4874){return BPromise[_0x2e6b('0x1f')](_0x1b4874);}return _0x149515[_0x2e6b('0x20')]();};}function saveUpdates(_0x129c56,_0x2eb101){return function(_0x44e889){if(_0x44e889){return _0x44e889[_0x2e6b('0x21')](_0x129c56)[_0x2e6b('0x22')](function(_0x29db18){return _0x29db18;});}return null;};}function removeEntity(_0x57c7c0,_0xe237c5){return function(_0x260003){if(_0x260003){return _0x260003[_0x2e6b('0x23')]()[_0x2e6b('0x22')](function(){var _0x2074ec=_0x260003['get']({'plain':!![]});var _0x4bd9d8='MusicOnHolds';return db[_0x2e6b('0x24')][_0x2e6b('0x23')]({'where':{'type':_0x4bd9d8,'resourceId':_0x2074ec['id']}})[_0x2e6b('0x22')](function(){return _0x260003;});})[_0x2e6b('0x22')](function(){_0x57c7c0[_0x2e6b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fe40e,_0x5cff4c){return function(_0x1750c2){if(!_0x1750c2){_0x3fe40e[_0x2e6b('0x15')](0x194);}return _0x1750c2;};}function handleError(_0x143dd0,_0xe83b48){_0xe83b48=_0xe83b48||0x1f4;return function(_0x22fb13){logger['error'](_0x22fb13[_0x2e6b('0x25')]);if(_0x22fb13[_0x2e6b('0x26')]){delete _0x22fb13[_0x2e6b('0x26')];}_0x143dd0['status'](_0xe83b48)[_0x2e6b('0x27')](_0x22fb13);};}exports[_0x2e6b('0x28')]=function(_0x528f2d,_0x543934){var _0x223d7b={},_0x20cd99={},_0x241b3c={'count':0x0,'rows':[]};var _0x2a8e7c=_[_0x2e6b('0x29')](db[_0x2e6b('0x2a')][_0x2e6b('0x2b')],function(_0x4aee53){return{'name':_0x4aee53[_0x2e6b('0x2c')],'type':_0x4aee53[_0x2e6b('0x2d')][_0x2e6b('0x2e')]};});_0x20cd99[_0x2e6b('0x2f')]=_[_0x2e6b('0x29')](_0x2a8e7c,_0x2e6b('0x26'));_0x20cd99[_0x2e6b('0x30')]=_[_0x2e6b('0x31')](_0x528f2d['query']);_0x20cd99[_0x2e6b('0x32')]=_[_0x2e6b('0x33')](_0x20cd99[_0x2e6b('0x2f')],_0x20cd99[_0x2e6b('0x30')]);_0x223d7b[_0x2e6b('0x34')]=_['intersection'](_0x20cd99[_0x2e6b('0x2f')],qs[_0x2e6b('0x35')](_0x528f2d['query'][_0x2e6b('0x35')]));_0x223d7b[_0x2e6b('0x34')]=_0x223d7b[_0x2e6b('0x34')][_0x2e6b('0x36')]?_0x223d7b[_0x2e6b('0x34')]:_0x20cd99[_0x2e6b('0x2f')];if(!_0x528f2d['query'][_0x2e6b('0x37')](_0x2e6b('0x38'))){_0x223d7b[_0x2e6b('0x1c')]=qs['limit'](_0x528f2d['query'][_0x2e6b('0x1c')]);_0x223d7b[_0x2e6b('0x1b')]=qs['offset'](_0x528f2d[_0x2e6b('0x30')][_0x2e6b('0x1b')]);}_0x223d7b[_0x2e6b('0x39')]=qs[_0x2e6b('0x3a')](_0x528f2d[_0x2e6b('0x30')]['sort']);delete _0x528f2d['query'][_0x2e6b('0x3a')];_0x223d7b[_0x2e6b('0x3b')]=qs['filters'](_['pick'](_0x528f2d['query'],_0x20cd99[_0x2e6b('0x32')]),_0x2a8e7c);if(_0x528f2d[_0x2e6b('0x30')]['filter']){_0x223d7b[_0x2e6b('0x3b')]=_[_0x2e6b('0x3c')](_0x223d7b[_0x2e6b('0x3b')],{'$or':_['map'](_0x2a8e7c,function(_0x3922ff){if(_0x3922ff[_0x2e6b('0x2d')]!==_0x2e6b('0x3d')){var _0x507dea={};_0x507dea[_0x3922ff[_0x2e6b('0x26')]]={'$like':'%'+_0x528f2d['query'][_0x2e6b('0x3e')]+'%'};return _0x507dea;}})});}_0x223d7b=_[_0x2e6b('0x3c')]({},_0x223d7b,_0x528f2d['options']);var _0x1b09b6={'where':_0x223d7b[_0x2e6b('0x3b')]};return db[_0x2e6b('0x2a')][_0x2e6b('0x1a')](_0x1b09b6)[_0x2e6b('0x22')](function(_0xc29162){_0x241b3c[_0x2e6b('0x1a')]=_0xc29162;if(_0x528f2d[_0x2e6b('0x30')][_0x2e6b('0x3f')]){_0x223d7b['include']=[{'all':!![]}];}return db[_0x2e6b('0x2a')][_0x2e6b('0x40')](_0x223d7b);})[_0x2e6b('0x22')](function(_0x4f2239){_0x241b3c[_0x2e6b('0x41')]=_0x4f2239;return _0x241b3c;})[_0x2e6b('0x22')](respondWithFilteredResult(_0x543934,_0x223d7b))[_0x2e6b('0x42')](handleError(_0x543934,null));};exports['show']=function(_0x4f89bc,_0x355d98){var _0x5af17c={'raw':![],'where':{'id':_0x4f89bc['params']['id']}},_0x522f99={};_0x522f99[_0x2e6b('0x2f')]=_[_0x2e6b('0x31')](db['VoiceMusicOnHold'][_0x2e6b('0x2b')]);_0x522f99[_0x2e6b('0x30')]=_[_0x2e6b('0x31')](_0x4f89bc[_0x2e6b('0x30')]);_0x522f99[_0x2e6b('0x32')]=_[_0x2e6b('0x33')](_0x522f99['model'],_0x522f99[_0x2e6b('0x30')]);_0x5af17c[_0x2e6b('0x34')]=_[_0x2e6b('0x33')](_0x522f99[_0x2e6b('0x2f')],qs[_0x2e6b('0x35')](_0x4f89bc['query'][_0x2e6b('0x35')]));_0x5af17c[_0x2e6b('0x34')]=_0x5af17c[_0x2e6b('0x34')][_0x2e6b('0x36')]?_0x5af17c['attributes']:_0x522f99[_0x2e6b('0x2f')];if(_0x4f89bc[_0x2e6b('0x30')]['includeAll']){_0x5af17c[_0x2e6b('0x43')]=[{'all':!![]}];}_0x5af17c=_['merge']({},_0x5af17c,_0x4f89bc[_0x2e6b('0x44')]);return db[_0x2e6b('0x2a')][_0x2e6b('0x45')](_0x5af17c)['then'](handleEntityNotFound(_0x355d98,null))['then'](respondWithResult(_0x355d98,null))['catch'](handleError(_0x355d98,null));};exports[_0x2e6b('0x21')]=function(_0x2332a2,_0x1b6bb3){if(_0x2332a2['body']['id']){delete _0x2332a2[_0x2e6b('0x46')]['id'];}return db['VoiceMusicOnHold'][_0x2e6b('0x45')]({'where':{'id':_0x2332a2[_0x2e6b('0x47')]['id']}})[_0x2e6b('0x22')](handleEntityNotFound(_0x1b6bb3,null))['then'](saveUpdates(_0x2332a2[_0x2e6b('0x46')],null))['then'](respondWithResult(_0x1b6bb3,null))[_0x2e6b('0x42')](handleError(_0x1b6bb3,null));};exports[_0x2e6b('0x48')]=function(_0x3d2aee,_0x19a86b,_0x5f12d6){return db[_0x2e6b('0x49')][_0x2e6b('0x4a')](function(_0x3b8f0b){if(_0x3d2aee[_0x2e6b('0x46')][_0x2e6b('0x4b')]===_0x2e6b('0x4c')){_0x3d2aee[_0x2e6b('0x46')]['directory']=path[_0x2e6b('0x4d')](config[_0x2e6b('0x4e')],_0x2e6b('0x4f'),_0x3d2aee[_0x2e6b('0x46')][_0x2e6b('0x26')]);}return db[_0x2e6b('0x2a')][_0x2e6b('0x48')](_0x3d2aee[_0x2e6b('0x46')],{'transaction':_0x3b8f0b})[_0x2e6b('0x22')](function(_0x509ccf){if(_0x3d2aee[_0x2e6b('0x46')][_0x2e6b('0x4b')]===_0x2e6b('0x4c')){fs[_0x2e6b('0x50')](_0x509ccf[_0x2e6b('0x51')],parseInt(_0x2e6b('0x52'),0x8));}var _0x4e8f87=_0x3d2aee[_0x2e6b('0x53')]['get']({'plain':!![]});if(!_0x4e8f87)throw new Error(_0x2e6b('0x54'));if(_0x4e8f87[_0x2e6b('0x55')]===_0x2e6b('0x53')){var _0x63fd5e=_0x509ccf[_0x2e6b('0x56')]({'plain':!![]});return db[_0x2e6b('0x57')]['find']({'where':{'name':_0x2e6b('0x58'),'userProfileId':_0x4e8f87[_0x2e6b('0x59')]},'raw':!![]})['then'](function(_0x41f6c0){if(_0x41f6c0&&_0x41f6c0['autoAssociation']===0x0){return db[_0x2e6b('0x24')][_0x2e6b('0x48')]({'name':_0x63fd5e['name'],'resourceId':_0x63fd5e['id'],'type':_0x41f6c0[_0x2e6b('0x26')],'sectionId':_0x41f6c0['id']},{})['then'](function(){return _0x509ccf;});}else{return _0x509ccf;}})['catch'](function(_0x1f549d){logger[_0x2e6b('0x5a')](_0x2e6b('0x5b'),_0x1f549d);});}return _0x509ccf;});})[_0x2e6b('0x22')](respondWithResult(_0x19a86b,0xc9))[_0x2e6b('0x42')](handleError(_0x19a86b,null));};exports[_0x2e6b('0x23')]=function(_0x442c7c,_0x4d15ab,_0x4c0d69){var _0x4b0363;return db[_0x2e6b('0x2a')][_0x2e6b('0x45')]({'where':{'id':_0x442c7c['params']['id']}})[_0x2e6b('0x22')](function(_0x43358d){if(_0x43358d){return db[_0x2e6b('0x49')][_0x2e6b('0x4a')](function(_0x72b7f6){return _0x43358d['destroy']({'transaction':_0x72b7f6,'raw':!![]})[_0x2e6b('0x22')](function(_0x24cf54){if(_0x24cf54[_0x2e6b('0x51')]){fs[_0x2e6b('0x5c')](_0x24cf54[_0x2e6b('0x51')])[_0x2e6b('0x5d')](function(_0x3c525d){fs[_0x2e6b('0x5e')](path[_0x2e6b('0x4d')](_0x24cf54[_0x2e6b('0x51')],_0x3c525d));});fs['rmdirSync'](_0x24cf54[_0x2e6b('0x51')]);}return _0x24cf54;});})[_0x2e6b('0x42')](function(_0x27eb90){throw new db[(_0x2e6b('0x5f'))][(_0x2e6b('0x60'))](_0x27eb90['message']);});}})[_0x2e6b('0x22')](handleEntityNotFound(_0x4d15ab,null))[_0x2e6b('0x22')](removeEntity(_0x4d15ab,null))[_0x2e6b('0x42')](handleError(_0x4d15ab,null));};exports[_0x2e6b('0x61')]=function(_0x5214d5,_0x35f1fd,_0x5f50c9){return db['sequelize'][_0x2e6b('0x4a')](function(_0xcc09f0){var _0x366688;return db[_0x2e6b('0x2a')][_0x2e6b('0x45')]({'where':{'id':_0x5214d5[_0x2e6b('0x47')]['id']}})[_0x2e6b('0x22')](function(_0x2c50b3){if(_0x2c50b3){_0x366688=_0x2c50b3;return _0x2c50b3[_0x2e6b('0x61')](_0x5214d5[_0x2e6b('0x46')]['id'],{'transaction':_0xcc09f0});}})[_0x2e6b('0x22')](function(_0x5c165d){if(_0x5c165d){return db[_0x2e6b('0x62')][_0x2e6b('0x63')]({'where':{'id':_0x5214d5[_0x2e6b('0x46')]['id']},'attributes':['id',_0x2e6b('0x26'),_0x2e6b('0x64'),_0x2e6b('0x65'),_0x2e6b('0x66')],'raw':!![]});}})['then'](function(_0x56d798){if(_0x56d798){var _0x323820=path[_0x2e6b('0x4d')](config['root'],_0x2e6b('0x67'),util[_0x2e6b('0x68')](_0x2e6b('0x69'),path[_0x2e6b('0x6a')](_0x56d798['save_name'],path[_0x2e6b('0x6b')](_0x56d798[_0x2e6b('0x64')])),_0x56d798[_0x2e6b('0x65')]));var _0x4df591=path['join'](config[_0x2e6b('0x4e')],_0x2e6b('0x4f'),_0x366688[_0x2e6b('0x26')],util[_0x2e6b('0x68')](_0x2e6b('0x69'),_0x56d798['name'],_0x56d798[_0x2e6b('0x65')]));fs[_0x2e6b('0x6c')](_0x323820,_0x4df591);return _0x56d798;}})[_0x2e6b('0x42')](function(_0x66a657){throw new db[(_0x2e6b('0x5f'))]['ValidationError'](_0x66a657[_0x2e6b('0x6d')]);});})['then'](handleEntityNotFound(_0x35f1fd,null))[_0x2e6b('0x22')](respondWithResult(_0x35f1fd,0xc9))[_0x2e6b('0x42')](handleError(_0x35f1fd,null));};exports[_0x2e6b('0x6e')]=function(_0x267e2a,_0x392888,_0x5aee59){return db[_0x2e6b('0x49')][_0x2e6b('0x4a')](function(_0x4e53c6){var _0x46376e;return db['VoiceMusicOnHold'][_0x2e6b('0x63')]({'where':{'id':_0x267e2a[_0x2e6b('0x47')]['id']}})[_0x2e6b('0x22')](handleEntityNotFound(_0x392888,null))[_0x2e6b('0x22')](function(_0x49587f){if(_0x49587f){_0x46376e=_0x49587f;return _0x49587f[_0x2e6b('0x6e')](_0x267e2a[_0x2e6b('0x47')][_0x2e6b('0x6f')]);}})[_0x2e6b('0x22')](function(_0x38b345){if(_0x38b345){return db[_0x2e6b('0x62')][_0x2e6b('0x63')]({'where':{'id':_0x267e2a['params'][_0x2e6b('0x6f')]},'attributes':['id','name',_0x2e6b('0x64'),_0x2e6b('0x65'),_0x2e6b('0x66')],'raw':!![]});}})[_0x2e6b('0x22')](function(_0x36a5de){if(_0x36a5de){fs[_0x2e6b('0x5e')](path[_0x2e6b('0x4d')](_0x46376e[_0x2e6b('0x51')],util['format'](_0x2e6b('0x69'),_0x36a5de['name'],_0x36a5de['converted_format'])));return _0x36a5de;}})[_0x2e6b('0x42')](function(_0x15c383){throw new db[(_0x2e6b('0x5f'))][(_0x2e6b('0x60'))](_0x15c383['message']);});})[_0x2e6b('0x22')](handleEntityNotFound(_0x392888,null))['then'](respondWithStatusCode(_0x392888,0xcc))[_0x2e6b('0x42')](handleError(_0x392888,null));};exports['getSounds']=function(_0xb51069,_0x1dabc9,_0x338c25){var _0x3d9cca={};var _0x4691bf={};var _0x4cc068;var _0x38ca13;return db[_0x2e6b('0x2a')][_0x2e6b('0x63')]({'where':{'id':_0xb51069[_0x2e6b('0x47')]['id']}})[_0x2e6b('0x22')](handleEntityNotFound(_0x1dabc9,null))[_0x2e6b('0x22')](function(_0x5adf8b){if(_0x5adf8b){_0x4cc068=_0x5adf8b;_0x4691bf[_0x2e6b('0x2f')]=_[_0x2e6b('0x31')](db[_0x2e6b('0x62')]['rawAttributes']);_0x4691bf[_0x2e6b('0x30')]=_[_0x2e6b('0x31')](_0xb51069[_0x2e6b('0x30')]);_0x4691bf[_0x2e6b('0x32')]=_[_0x2e6b('0x33')](_0x4691bf[_0x2e6b('0x2f')],_0x4691bf[_0x2e6b('0x30')]);_0x3d9cca[_0x2e6b('0x34')]=_[_0x2e6b('0x33')](_0x4691bf[_0x2e6b('0x2f')],qs[_0x2e6b('0x35')](_0xb51069[_0x2e6b('0x30')][_0x2e6b('0x35')]));_0x3d9cca[_0x2e6b('0x34')]=_0x3d9cca[_0x2e6b('0x34')][_0x2e6b('0x36')]?_0x3d9cca[_0x2e6b('0x34')]:_0x4691bf[_0x2e6b('0x2f')];_0x3d9cca[_0x2e6b('0x39')]=qs[_0x2e6b('0x3a')](_0xb51069[_0x2e6b('0x30')][_0x2e6b('0x3a')]);_0x3d9cca[_0x2e6b('0x3b')]=qs[_0x2e6b('0x32')](_[_0x2e6b('0x70')](_0xb51069[_0x2e6b('0x30')],_0x4691bf['filters']));if(_0xb51069[_0x2e6b('0x30')]['filter']){_0x3d9cca[_0x2e6b('0x3b')]=_['merge'](_0x3d9cca[_0x2e6b('0x3b')],{'$or':_[_0x2e6b('0x29')](_0x3d9cca['attributes'],function(_0x8a7adb){var _0x4f0c8d={};_0x4f0c8d[_0x8a7adb]={'$like':'%'+_0xb51069[_0x2e6b('0x30')]['filter']+'%'};return _0x4f0c8d;})});}_0x3d9cca=_[_0x2e6b('0x3c')]({},_0x3d9cca,_0xb51069[_0x2e6b('0x44')]);return _0x4cc068[_0x2e6b('0x71')](_0x3d9cca);}})[_0x2e6b('0x22')](function(_0x5b6262){if(_0x5b6262){_0x38ca13=_0x5b6262[_0x2e6b('0x36')];if(!_0xb51069[_0x2e6b('0x30')][_0x2e6b('0x37')](_0x2e6b('0x38'))){_0x3d9cca['limit']=qs[_0x2e6b('0x1c')](_0xb51069[_0x2e6b('0x30')]['limit']);_0x3d9cca[_0x2e6b('0x1b')]=qs['offset'](_0xb51069[_0x2e6b('0x30')][_0x2e6b('0x1b')]);}return _0x4cc068[_0x2e6b('0x71')](_0x3d9cca);}})[_0x2e6b('0x22')](function(_0x60e282){if(_0x60e282){return _0x60e282?{'count':_0x38ca13,'rows':_0x60e282}:null;}})[_0x2e6b('0x22')](respondWithResult(_0x1dabc9,null))[_0x2e6b('0x42')](handleError(_0x1dabc9,null));}; \ No newline at end of file +var _0x17b0=['nolimit','sort','pick','filter','where','merge','VIRTUAL','options','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','find','body','create','sequelize','transaction','mode','files','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readdirSync','forEach','unlinkSync','join','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','order','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x587fb5,_0x59cb3b){var _0x551105=function(_0x5bbef4){while(--_0x5bbef4){_0x587fb5['push'](_0x587fb5['shift']());}};_0x551105(++_0x59cb3b);}(_0x17b0,0x19b));var _0x017b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x17b0[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x017b('0x0'));var rimraf=require(_0x017b('0x1'));var zipdir=require(_0x017b('0x2'));var jsonpatch=require(_0x017b('0x3'));var rp=require(_0x017b('0x4'));var moment=require(_0x017b('0x5'));var BPromise=require(_0x017b('0x6'));var Mustache=require('mustache');var util=require(_0x017b('0x7'));var path=require('path');var sox=require(_0x017b('0x8'));var csv=require(_0x017b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x017b('0xa'));var _=require(_0x017b('0xb'));var squel=require(_0x017b('0xc'));var crypto=require('crypto');var jsforce=require(_0x017b('0xd'));var deskjs=require(_0x017b('0xe'));var toCsv=require(_0x017b('0x9'));var querystring=require(_0x017b('0xf'));var Papa=require(_0x017b('0x10'));var Redis=require(_0x017b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x017b('0x12'));var hardwareService=require(_0x017b('0x13'));var logger=require(_0x017b('0x14'))(_0x017b('0x15'));var utils=require(_0x017b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x017b('0x17'));var db=require(_0x017b('0x18'))['db'];function respondWithStatusCode(_0x3a3852,_0x2bb98b){_0x2bb98b=_0x2bb98b||0xcc;return function(_0x5a49c8){if(_0x5a49c8){return _0x3a3852['sendStatus'](_0x2bb98b);}return _0x3a3852[_0x017b('0x19')](_0x2bb98b)[_0x017b('0x1a')]();};}function respondWithResult(_0x2c5c8e,_0x2ade62){_0x2ade62=_0x2ade62||0xc8;return function(_0x5209ad){if(_0x5209ad){return _0x2c5c8e[_0x017b('0x19')](_0x2ade62)[_0x017b('0x1b')](_0x5209ad);}};}function respondWithFilteredResult(_0x1853cb,_0x19de23){return function(_0xf9d054){if(_0xf9d054){var _0x26da65=typeof _0x19de23[_0x017b('0x1c')]===_0x017b('0x1d')&&typeof _0x19de23[_0x017b('0x1e')]===_0x017b('0x1d');var _0x260078=_0xf9d054['count'];var _0x548d0e=_0x26da65?0x0:_0x19de23[_0x017b('0x1c')];var _0x174108=_0x26da65?_0xf9d054['count']:_0x19de23[_0x017b('0x1c')]+_0x19de23[_0x017b('0x1e')];var _0x165b1c;if(_0x174108>=_0x260078){_0x174108=_0x260078;_0x165b1c=0xc8;}else{_0x165b1c=0xce;}_0x1853cb[_0x017b('0x19')](_0x165b1c);return _0x1853cb[_0x017b('0x1f')](_0x017b('0x20'),_0x548d0e+'-'+_0x174108+'/'+_0x260078)[_0x017b('0x1b')](_0xf9d054);}return null;};}function patchUpdates(_0x3b7c9a){return function(_0x37f363){try{jsonpatch[_0x017b('0x21')](_0x37f363,_0x3b7c9a,!![]);}catch(_0x52e381){return BPromise[_0x017b('0x22')](_0x52e381);}return _0x37f363[_0x017b('0x23')]();};}function saveUpdates(_0x3c04c7,_0x1172de){return function(_0x462a5d){if(_0x462a5d){return _0x462a5d[_0x017b('0x24')](_0x3c04c7)['then'](function(_0x5816f4){return _0x5816f4;});}return null;};}function removeEntity(_0xaf2051,_0x370c25){return function(_0x36c02c){if(_0x36c02c){return _0x36c02c[_0x017b('0x25')]()['then'](function(){var _0x5cd470=_0x36c02c[_0x017b('0x26')]({'plain':!![]});var _0x1843fd=_0x017b('0x27');return db[_0x017b('0x28')]['destroy']({'where':{'type':_0x1843fd,'resourceId':_0x5cd470['id']}})['then'](function(){return _0x36c02c;});})[_0x017b('0x29')](function(){_0xaf2051[_0x017b('0x19')](0xcc)[_0x017b('0x1a')]();});}};}function handleEntityNotFound(_0x4bf49c,_0x90df3c){return function(_0x337e93){if(!_0x337e93){_0x4bf49c[_0x017b('0x2a')](0x194);}return _0x337e93;};}function handleError(_0x1a25a6,_0x200885){_0x200885=_0x200885||0x1f4;return function(_0x281f38){logger[_0x017b('0x2b')](_0x281f38['stack']);if(_0x281f38[_0x017b('0x2c')]){delete _0x281f38['name'];}_0x1a25a6[_0x017b('0x19')](_0x200885)[_0x017b('0x2d')](_0x281f38);};}exports[_0x017b('0x2e')]=function(_0x2b25c7,_0x1eed4c){var _0x2b7455={},_0x23cc34={},_0x6f2c37={'count':0x0,'rows':[]};var _0x3d60ad=_[_0x017b('0x2f')](db['VoiceMusicOnHold'][_0x017b('0x30')],function(_0x3d6a30){return{'name':_0x3d6a30[_0x017b('0x31')],'type':_0x3d6a30[_0x017b('0x32')][_0x017b('0x33')]};});_0x23cc34['model']=_[_0x017b('0x2f')](_0x3d60ad,_0x017b('0x2c'));_0x23cc34[_0x017b('0x34')]=_[_0x017b('0x35')](_0x2b25c7[_0x017b('0x34')]);_0x23cc34[_0x017b('0x36')]=_[_0x017b('0x37')](_0x23cc34[_0x017b('0x38')],_0x23cc34[_0x017b('0x34')]);_0x2b7455[_0x017b('0x39')]=_[_0x017b('0x37')](_0x23cc34['model'],qs[_0x017b('0x3a')](_0x2b25c7[_0x017b('0x34')][_0x017b('0x3a')]));_0x2b7455[_0x017b('0x39')]=_0x2b7455[_0x017b('0x39')][_0x017b('0x3b')]?_0x2b7455['attributes']:_0x23cc34[_0x017b('0x38')];if(!_0x2b25c7[_0x017b('0x34')][_0x017b('0x3c')](_0x017b('0x3d'))){_0x2b7455[_0x017b('0x1e')]=qs[_0x017b('0x1e')](_0x2b25c7[_0x017b('0x34')]['limit']);_0x2b7455[_0x017b('0x1c')]=qs[_0x017b('0x1c')](_0x2b25c7[_0x017b('0x34')][_0x017b('0x1c')]);}_0x2b7455['order']=qs[_0x017b('0x3e')](_0x2b25c7[_0x017b('0x34')][_0x017b('0x3e')]);delete _0x2b25c7[_0x017b('0x34')][_0x017b('0x3e')];_0x2b7455['where']=qs[_0x017b('0x36')](_[_0x017b('0x3f')](_0x2b25c7[_0x017b('0x34')],_0x23cc34['filters']),_0x3d60ad);if(_0x2b25c7[_0x017b('0x34')][_0x017b('0x40')]){_0x2b7455[_0x017b('0x41')]=_[_0x017b('0x42')](_0x2b7455[_0x017b('0x41')],{'$or':_['map'](_0x3d60ad,function(_0x348911){if(_0x348911['type']!==_0x017b('0x43')){var _0xb7a9df={};_0xb7a9df[_0x348911[_0x017b('0x2c')]]={'$like':'%'+_0x2b25c7[_0x017b('0x34')][_0x017b('0x40')]+'%'};return _0xb7a9df;}})});}_0x2b7455=_[_0x017b('0x42')]({},_0x2b7455,_0x2b25c7[_0x017b('0x44')]);var _0x275929={'where':_0x2b7455[_0x017b('0x41')]};return db[_0x017b('0x45')][_0x017b('0x46')](_0x275929)[_0x017b('0x29')](function(_0x17292d){_0x6f2c37[_0x017b('0x46')]=_0x17292d;if(_0x2b25c7[_0x017b('0x34')][_0x017b('0x47')]){_0x2b7455[_0x017b('0x48')]=[{'all':!![]}];}return db[_0x017b('0x45')][_0x017b('0x49')](_0x2b7455);})[_0x017b('0x29')](function(_0x244d27){_0x6f2c37[_0x017b('0x4a')]=_0x244d27;return _0x6f2c37;})['then'](respondWithFilteredResult(_0x1eed4c,_0x2b7455))[_0x017b('0x4b')](handleError(_0x1eed4c,null));};exports['show']=function(_0x39ec0e,_0x1ffb43){var _0x33fc26={'raw':![],'where':{'id':_0x39ec0e[_0x017b('0x4c')]['id']}},_0x45c459={};_0x45c459['model']=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x45c459['query']=_[_0x017b('0x35')](_0x39ec0e[_0x017b('0x34')]);_0x45c459[_0x017b('0x36')]=_[_0x017b('0x37')](_0x45c459[_0x017b('0x38')],_0x45c459[_0x017b('0x34')]);_0x33fc26['attributes']=_[_0x017b('0x37')](_0x45c459[_0x017b('0x38')],qs['fields'](_0x39ec0e[_0x017b('0x34')][_0x017b('0x3a')]));_0x33fc26[_0x017b('0x39')]=_0x33fc26[_0x017b('0x39')][_0x017b('0x3b')]?_0x33fc26['attributes']:_0x45c459[_0x017b('0x38')];if(_0x39ec0e[_0x017b('0x34')][_0x017b('0x47')]){_0x33fc26[_0x017b('0x48')]=[{'all':!![]}];}_0x33fc26=_['merge']({},_0x33fc26,_0x39ec0e['options']);return db[_0x017b('0x45')][_0x017b('0x4d')](_0x33fc26)[_0x017b('0x29')](handleEntityNotFound(_0x1ffb43,null))['then'](respondWithResult(_0x1ffb43,null))[_0x017b('0x4b')](handleError(_0x1ffb43,null));};exports[_0x017b('0x24')]=function(_0xa2f2cd,_0x1bbd9f){if(_0xa2f2cd[_0x017b('0x4e')]['id']){delete _0xa2f2cd[_0x017b('0x4e')]['id'];}return db[_0x017b('0x45')]['find']({'where':{'id':_0xa2f2cd['params']['id']}})[_0x017b('0x29')](handleEntityNotFound(_0x1bbd9f,null))['then'](saveUpdates(_0xa2f2cd[_0x017b('0x4e')],null))['then'](respondWithResult(_0x1bbd9f,null))[_0x017b('0x4b')](handleError(_0x1bbd9f,null));};exports[_0x017b('0x4f')]=function(_0x5ea15f,_0x5b33ea,_0x213573){return db[_0x017b('0x50')][_0x017b('0x51')](function(_0x5d2772){if(_0x5ea15f[_0x017b('0x4e')][_0x017b('0x52')]===_0x017b('0x53')){_0x5ea15f[_0x017b('0x4e')][_0x017b('0x54')]=path['join'](config[_0x017b('0x55')],_0x017b('0x56'),_0x5ea15f[_0x017b('0x4e')][_0x017b('0x2c')]);}return db['VoiceMusicOnHold'][_0x017b('0x4f')](_0x5ea15f[_0x017b('0x4e')],{'transaction':_0x5d2772})['then'](function(_0x5d1283){if(_0x5ea15f[_0x017b('0x4e')]['mode']==='files'){fs[_0x017b('0x57')](_0x5d1283[_0x017b('0x54')],parseInt(_0x017b('0x58'),0x8));}var _0x115f5b=_0x5ea15f[_0x017b('0x59')][_0x017b('0x26')]({'plain':!![]});if(!_0x115f5b)throw new Error(_0x017b('0x5a'));if(_0x115f5b[_0x017b('0x5b')]==='user'){var _0xbbff75=_0x5d1283[_0x017b('0x26')]({'plain':!![]});return db[_0x017b('0x5c')][_0x017b('0x4d')]({'where':{'name':_0x017b('0x27'),'userProfileId':_0x115f5b[_0x017b('0x5d')]},'raw':!![]})[_0x017b('0x29')](function(_0x4b7b81){if(_0x4b7b81&&_0x4b7b81[_0x017b('0x5e')]===0x0){return db[_0x017b('0x28')][_0x017b('0x4f')]({'name':_0xbbff75[_0x017b('0x2c')],'resourceId':_0xbbff75['id'],'type':_0x4b7b81[_0x017b('0x2c')],'sectionId':_0x4b7b81['id']},{})[_0x017b('0x29')](function(){return _0x5d1283;});}else{return _0x5d1283;}})[_0x017b('0x4b')](function(_0x28b3be){logger[_0x017b('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28b3be);});}return _0x5d1283;});})['then'](respondWithResult(_0x5b33ea,0xc9))['catch'](handleError(_0x5b33ea,null));};exports[_0x017b('0x25')]=function(_0x574804,_0x536722,_0x5b9110){var _0x18bcf5;return db[_0x017b('0x45')]['find']({'where':{'id':_0x574804['params']['id']}})[_0x017b('0x29')](function(_0x3abee6){if(_0x3abee6){return db['sequelize'][_0x017b('0x51')](function(_0x4d9611){return _0x3abee6[_0x017b('0x25')]({'transaction':_0x4d9611,'raw':!![]})[_0x017b('0x29')](function(_0x5b5ab0){if(_0x5b5ab0[_0x017b('0x54')]){fs[_0x017b('0x5f')](_0x5b5ab0['directory'])[_0x017b('0x60')](function(_0x3ff81c){fs[_0x017b('0x61')](path[_0x017b('0x62')](_0x5b5ab0[_0x017b('0x54')],_0x3ff81c));});fs['rmdirSync'](_0x5b5ab0[_0x017b('0x54')]);}return _0x5b5ab0;});})['catch'](function(_0x512540){throw new db[(_0x017b('0x63'))][(_0x017b('0x64'))](_0x512540[_0x017b('0x65')]);});}})[_0x017b('0x29')](handleEntityNotFound(_0x536722,null))['then'](removeEntity(_0x536722,null))[_0x017b('0x4b')](handleError(_0x536722,null));};exports['addSound']=function(_0x20c59a,_0x45d497,_0x3c6663){return db[_0x017b('0x50')][_0x017b('0x51')](function(_0x23e127){var _0x352334;return db[_0x017b('0x45')]['find']({'where':{'id':_0x20c59a[_0x017b('0x4c')]['id']}})[_0x017b('0x29')](function(_0x449a1c){if(_0x449a1c){_0x352334=_0x449a1c;return _0x449a1c[_0x017b('0x66')](_0x20c59a[_0x017b('0x4e')]['id'],{'transaction':_0x23e127});}})[_0x017b('0x29')](function(_0x3bf7e6){if(_0x3bf7e6){return db[_0x017b('0x67')][_0x017b('0x68')]({'where':{'id':_0x20c59a[_0x017b('0x4e')]['id']},'attributes':['id',_0x017b('0x2c'),_0x017b('0x69'),_0x017b('0x6a'),_0x017b('0x6b')],'raw':!![]});}})['then'](function(_0x432f40){if(_0x432f40){var _0x3d7460=path[_0x017b('0x62')](config[_0x017b('0x55')],_0x017b('0x6c'),util[_0x017b('0x6d')](_0x017b('0x6e'),path[_0x017b('0x6f')](_0x432f40[_0x017b('0x69')],path[_0x017b('0x70')](_0x432f40[_0x017b('0x69')])),_0x432f40['converted_format']));var _0x411731=path[_0x017b('0x62')](config[_0x017b('0x55')],_0x017b('0x56'),_0x352334[_0x017b('0x2c')],util[_0x017b('0x6d')](_0x017b('0x6e'),_0x432f40['name'],_0x432f40['converted_format']));fs[_0x017b('0x71')](_0x3d7460,_0x411731);return _0x432f40;}})[_0x017b('0x4b')](function(_0x59f966){throw new db['Sequelize']['ValidationError'](_0x59f966['message']);});})[_0x017b('0x29')](handleEntityNotFound(_0x45d497,null))['then'](respondWithResult(_0x45d497,0xc9))[_0x017b('0x4b')](handleError(_0x45d497,null));};exports[_0x017b('0x72')]=function(_0x2a03e6,_0x648ece,_0x5d20a5){return db[_0x017b('0x50')][_0x017b('0x51')](function(_0x525ea2){var _0x254af4;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x2a03e6['params']['id']}})[_0x017b('0x29')](handleEntityNotFound(_0x648ece,null))[_0x017b('0x29')](function(_0x2397ca){if(_0x2397ca){_0x254af4=_0x2397ca;return _0x2397ca[_0x017b('0x72')](_0x2a03e6['params'][_0x017b('0x73')]);}})[_0x017b('0x29')](function(_0x433860){if(_0x433860){return db[_0x017b('0x67')][_0x017b('0x68')]({'where':{'id':_0x2a03e6[_0x017b('0x4c')][_0x017b('0x73')]},'attributes':['id','name',_0x017b('0x69'),_0x017b('0x6a'),_0x017b('0x6b')],'raw':!![]});}})[_0x017b('0x29')](function(_0x587caf){if(_0x587caf){fs[_0x017b('0x61')](path[_0x017b('0x62')](_0x254af4[_0x017b('0x54')],util[_0x017b('0x6d')](_0x017b('0x6e'),_0x587caf['name'],_0x587caf[_0x017b('0x6a')])));return _0x587caf;}})[_0x017b('0x4b')](function(_0x5e6a39){throw new db[(_0x017b('0x63'))][(_0x017b('0x64'))](_0x5e6a39[_0x017b('0x65')]);});})[_0x017b('0x29')](handleEntityNotFound(_0x648ece,null))[_0x017b('0x29')](respondWithStatusCode(_0x648ece,0xcc))[_0x017b('0x4b')](handleError(_0x648ece,null));};exports['getSounds']=function(_0x3421d4,_0x50db34,_0x416844){var _0x24c55d={};var _0x6f25cb={};var _0x3e7518;var _0x4c5c0f;return db['VoiceMusicOnHold'][_0x017b('0x68')]({'where':{'id':_0x3421d4[_0x017b('0x4c')]['id']}})[_0x017b('0x29')](handleEntityNotFound(_0x50db34,null))['then'](function(_0x759be1){if(_0x759be1){_0x3e7518=_0x759be1;_0x6f25cb[_0x017b('0x38')]=_[_0x017b('0x35')](db[_0x017b('0x67')][_0x017b('0x30')]);_0x6f25cb[_0x017b('0x34')]=_[_0x017b('0x35')](_0x3421d4[_0x017b('0x34')]);_0x6f25cb[_0x017b('0x36')]=_['intersection'](_0x6f25cb['model'],_0x6f25cb[_0x017b('0x34')]);_0x24c55d['attributes']=_[_0x017b('0x37')](_0x6f25cb[_0x017b('0x38')],qs[_0x017b('0x3a')](_0x3421d4[_0x017b('0x34')][_0x017b('0x3a')]));_0x24c55d[_0x017b('0x39')]=_0x24c55d[_0x017b('0x39')][_0x017b('0x3b')]?_0x24c55d[_0x017b('0x39')]:_0x6f25cb[_0x017b('0x38')];_0x24c55d[_0x017b('0x74')]=qs[_0x017b('0x3e')](_0x3421d4[_0x017b('0x34')][_0x017b('0x3e')]);_0x24c55d[_0x017b('0x41')]=qs[_0x017b('0x36')](_['pick'](_0x3421d4[_0x017b('0x34')],_0x6f25cb[_0x017b('0x36')]));if(_0x3421d4[_0x017b('0x34')][_0x017b('0x40')]){_0x24c55d[_0x017b('0x41')]=_[_0x017b('0x42')](_0x24c55d[_0x017b('0x41')],{'$or':_[_0x017b('0x2f')](_0x24c55d[_0x017b('0x39')],function(_0x2ce6e7){var _0x3179b2={};_0x3179b2[_0x2ce6e7]={'$like':'%'+_0x3421d4[_0x017b('0x34')][_0x017b('0x40')]+'%'};return _0x3179b2;})});}_0x24c55d=_[_0x017b('0x42')]({},_0x24c55d,_0x3421d4['options']);return _0x3e7518[_0x017b('0x75')](_0x24c55d);}})['then'](function(_0x30a5d9){if(_0x30a5d9){_0x4c5c0f=_0x30a5d9[_0x017b('0x3b')];if(!_0x3421d4['query'][_0x017b('0x3c')](_0x017b('0x3d'))){_0x24c55d['limit']=qs[_0x017b('0x1e')](_0x3421d4[_0x017b('0x34')]['limit']);_0x24c55d[_0x017b('0x1c')]=qs['offset'](_0x3421d4[_0x017b('0x34')]['offset']);}return _0x3e7518[_0x017b('0x75')](_0x24c55d);}})[_0x017b('0x29')](function(_0x3c2b9d){if(_0x3c2b9d){return _0x3c2b9d?{'count':_0x4c5c0f,'rows':_0x3c2b9d}:null;}})[_0x017b('0x29')](respondWithResult(_0x50db34,null))[_0x017b('0x4b')](handleError(_0x50db34,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index bc89903..76fc715 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 _0x4dab=['voice_musiconhold','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0x4dab,0xb5));var _0xb4da=function(_0x9105f4,_0x3bf6f7){_0x9105f4=_0x9105f4-0x0;var _0x57a818=_0x4dab[_0x9105f4];return _0x57a818;};'use strict';var _=require(_0xb4da('0x0'));var util=require('util');var logger=require(_0xb4da('0x1'))(_0xb4da('0x2'));var moment=require(_0xb4da('0x3'));var BPromise=require(_0xb4da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb4da('0x5'));var config=require(_0xb4da('0x6'));var attributes=require(_0xb4da('0x7'));module[_0xb4da('0x8')]=function(_0x3a2372,_0x1366cb){return _0x3a2372[_0xb4da('0x9')](_0xb4da('0xa'),attributes,{'tableName':_0xb4da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x556a=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x1bc5a3,_0x3b9487){var _0x207f3d=function(_0x2e389d){while(--_0x2e389d){_0x1bc5a3['push'](_0x1bc5a3['shift']());}};_0x207f3d(++_0x3b9487);}(_0x556a,0x66));var _0xa556=function(_0x4ec95f,_0x466921){_0x4ec95f=_0x4ec95f-0x0;var _0x37c866=_0x556a[_0x4ec95f];return _0x37c866;};'use strict';var _=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var logger=require('../../config/logger')(_0xa556('0x2'));var moment=require(_0xa556('0x3'));var BPromise=require(_0xa556('0x4'));var rp=require(_0xa556('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa556('0x6'));var config=require(_0xa556('0x7'));var attributes=require(_0xa556('0x8'));module[_0xa556('0x9')]=function(_0x51a83b,_0x2be1b7){return _0x51a83b[_0xa556('0xa')](_0xa556('0xb'),attributes,{'tableName':_0xa556('0xc'),'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 59e0949..8d17a13 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(_0x4c8565,_0x437bfc){var _0x1d876f=function(_0x4dff7b){while(--_0x4dff7b){_0x4c8565['push'](_0x4c8565['shift']());}};_0x1d876f(++_0x437bfc);}(_0xedd9,0xfc));var _0x9edd=function(_0x4752cf,_0x479ac8){_0x4752cf=_0x4752cf-0x0;var _0x42b48b=_0xedd9[_0x4752cf];return _0x42b48b;};'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 _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(_0x605a55,_0x3f5fe6){var _0x30c7fe=function(_0x593947){while(--_0x593947){_0x605a55['push'](_0x605a55['shift']());}};_0x30c7fe(++_0x3f5fe6);}(_0xedd9,0xfc));var _0x9edd=function(_0x526281,_0x8ad7d9){_0x526281=_0x526281-0x0;var _0x38fe96=_0xedd9[_0x526281];return _0x38fe96;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7e3fe25..c972af2 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 _0x6d65=['getAgents','/:id/teams','getTeams','create','post','addAgents','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','/:id/users'];(function(_0x4cfe02,_0x50d83a){var _0x34b0ad=function(_0x17ef0a){while(--_0x17ef0a){_0x4cfe02['push'](_0x4cfe02['shift']());}};_0x34b0ad(++_0x50d83a);}(_0x6d65,0x100));var _0x56d6=function(_0x57a5f6,_0x2e20ef){_0x57a5f6=_0x57a5f6-0x0;var _0x32bdc1=_0x6d65[_0x57a5f6];return _0x32bdc1;};'use strict';var multer=require(_0x56d6('0x0'));var util=require(_0x56d6('0x1'));var path=require('path');var timeout=require(_0x56d6('0x2'));var express=require('express');var router=express[_0x56d6('0x3')]();var fs_extra=require(_0x56d6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x56d6('0x5'));var config=require(_0x56d6('0x6'));var controller=require(_0x56d6('0x7'));router[_0x56d6('0x8')]('/',auth[_0x56d6('0x9')](),controller[_0x56d6('0xa')]);router['get'](_0x56d6('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x56d6('0x8')](_0x56d6('0xc'),auth[_0x56d6('0x9')](),controller['show']);router['get'](_0x56d6('0xd'),auth[_0x56d6('0x9')](),controller[_0x56d6('0xe')]);router[_0x56d6('0x8')](_0x56d6('0xf'),auth[_0x56d6('0x9')](),controller[_0x56d6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x56d6('0x11')]);router[_0x56d6('0x12')](_0x56d6('0xd'),auth[_0x56d6('0x9')](),controller[_0x56d6('0x13')]);router['post'](_0x56d6('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0x56d6('0x14')](_0x56d6('0xc'),auth[_0x56d6('0x9')](),controller[_0x56d6('0x15')]);router[_0x56d6('0x16')](_0x56d6('0xc'),auth[_0x56d6('0x9')](),controller[_0x56d6('0x17')]);router['delete'](_0x56d6('0xd'),auth[_0x56d6('0x9')](),controller[_0x56d6('0x18')]);router[_0x56d6('0x16')](_0x56d6('0xf'),auth[_0x56d6('0x9')](),controller[_0x56d6('0x19')]);module[_0x56d6('0x1a')]=router; \ No newline at end of file +var _0xb27d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','index','/describe','isAuthenticated','describe','get','/:id','/:id/users','getAgents','/:id/teams','post','create','addAgents','addTeams','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path'];(function(_0x3072e2,_0x648a09){var _0x42c45b=function(_0x2ddff5){while(--_0x2ddff5){_0x3072e2['push'](_0x3072e2['shift']());}};_0x42c45b(++_0x648a09);}(_0xb27d,0xe5));var _0xdb27=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xb27d[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xdb27('0x0'));var util=require(_0xdb27('0x1'));var path=require(_0xdb27('0x2'));var timeout=require(_0xdb27('0x3'));var express=require('express');var router=express[_0xdb27('0x4')]();var fs_extra=require(_0xdb27('0x5'));var auth=require(_0xdb27('0x6'));var interaction=require(_0xdb27('0x7'));var config=require(_0xdb27('0x8'));var controller=require(_0xdb27('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdb27('0xa')]);router['get'](_0xdb27('0xb'),auth[_0xdb27('0xc')](),controller[_0xdb27('0xd')]);router[_0xdb27('0xe')](_0xdb27('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdb27('0x10'),auth[_0xdb27('0xc')](),controller[_0xdb27('0x11')]);router['get'](_0xdb27('0x12'),auth[_0xdb27('0xc')](),controller['getTeams']);router[_0xdb27('0x13')]('/',auth[_0xdb27('0xc')](),controller[_0xdb27('0x14')]);router[_0xdb27('0x13')](_0xdb27('0x10'),auth[_0xdb27('0xc')](),controller[_0xdb27('0x15')]);router[_0xdb27('0x13')]('/:id/teams',auth[_0xdb27('0xc')](),controller[_0xdb27('0x16')]);router['put']('/:id',auth[_0xdb27('0xc')](),controller[_0xdb27('0x17')]);router[_0xdb27('0x18')](_0xdb27('0xf'),auth['isAuthenticated'](),controller[_0xdb27('0x19')]);router[_0xdb27('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xdb27('0x1a')]);router[_0xdb27('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdb27('0x1b')]);module[_0xdb27('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 f3b4a3b..9112e9c 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 _0x7fe2=['VIRTUAL','system-','getDataValue','STRING','INTEGER','exports','name'];(function(_0x187491,_0x54b6fd){var _0x654b2=function(_0x1133a4){while(--_0x1133a4){_0x187491['push'](_0x187491['shift']());}};_0x654b2(++_0x54b6fd);}(_0x7fe2,0x139));var _0x27fe=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x7fe2[_0x7d62cb];return _0x3a6266;};'use strict';var Sequelize=require('sequelize');module[_0x27fe('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x27fe('0x1')},'prefix':{'type':Sequelize[_0x27fe('0x2')],'get':function(_0x52cc7b){return _0x27fe('0x3')+this[_0x27fe('0x4')](_0x27fe('0x1'))+'-';}},'description':{'type':Sequelize[_0x27fe('0x5')]},'callerIdAll':{'type':Sequelize[_0x27fe('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x27fe('0x6')]}}; \ No newline at end of file +var _0xc34a=['exports','STRING','VIRTUAL','system-','name','INTEGER'];(function(_0x384e80,_0x5ac6c2){var _0x128d4e=function(_0x26f0b2){while(--_0x26f0b2){_0x384e80['push'](_0x384e80['shift']());}};_0x128d4e(++_0x5ac6c2);}(_0xc34a,0xfc));var _0xac34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc34a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xac34('0x0')]={'name':{'type':Sequelize[_0xac34('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xac34('0x2')],'get':function(_0x885911){return _0xac34('0x3')+this['getDataValue'](_0xac34('0x4'))+'-';}},'description':{'type':Sequelize[_0xac34('0x1')]},'callerIdAll':{'type':Sequelize[_0xac34('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xac34('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index ec5c043..2066531 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 _0x84a0=['query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','Team','getTeams','addTeams','online','voicePause','interface','flatMap','Agents','TeamVoicePrefix','upsert','each','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84a0,0x66));var _0x084a=function(_0x34ab14,_0x228d49){_0x34ab14=_0x34ab14-0x0;var _0x52c36b=_0x84a0[_0x34ab14];return _0x52c36b;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];config[_0x084a('0x18')]=_[_0x084a('0x19')](config[_0x084a('0x18')],{'host':_0x084a('0x1a'),'port':0x18eb});var socket=require(_0x084a('0x1b'))(new Redis(config[_0x084a('0x18')]));require(_0x084a('0x1c'))['register'](socket);function respondWithStatusCode(_0x4277c9,_0x4b9cc5){_0x4b9cc5=_0x4b9cc5||0xcc;return function(_0x225de0){if(_0x225de0){return _0x4277c9[_0x084a('0x1d')](_0x4b9cc5);}return _0x4277c9[_0x084a('0x1e')](_0x4b9cc5)[_0x084a('0x1f')]();};}function respondWithResult(_0xd20527,_0x4cbd16){_0x4cbd16=_0x4cbd16||0xc8;return function(_0x443ebb){if(_0x443ebb){return _0xd20527['status'](_0x4cbd16)[_0x084a('0x20')](_0x443ebb);}};}function respondWithFilteredResult(_0x355b45,_0x4af43e){return function(_0xf2c333){if(_0xf2c333){var _0x32c729=typeof _0x4af43e[_0x084a('0x21')]===_0x084a('0x22')&&typeof _0x4af43e[_0x084a('0x23')]===_0x084a('0x22');var _0x447a19=_0xf2c333[_0x084a('0x24')];var _0x3f60cf=_0x32c729?0x0:_0x4af43e[_0x084a('0x21')];var _0x3c7fd6=_0x32c729?_0xf2c333[_0x084a('0x24')]:_0x4af43e[_0x084a('0x21')]+_0x4af43e[_0x084a('0x23')];var _0xf0dd98;if(_0x3c7fd6>=_0x447a19){_0x3c7fd6=_0x447a19;_0xf0dd98=0xc8;}else{_0xf0dd98=0xce;}_0x355b45['status'](_0xf0dd98);return _0x355b45[_0x084a('0x25')](_0x084a('0x26'),_0x3f60cf+'-'+_0x3c7fd6+'/'+_0x447a19)[_0x084a('0x20')](_0xf2c333);}return null;};}function patchUpdates(_0x2d62bf){return function(_0x1c3f6c){try{jsonpatch['apply'](_0x1c3f6c,_0x2d62bf,!![]);}catch(_0x755c24){return BPromise[_0x084a('0x27')](_0x755c24);}return _0x1c3f6c[_0x084a('0x28')]();};}function saveUpdates(_0x1f2c9f,_0x18b43d){return function(_0x3cdc1e){if(_0x3cdc1e){return _0x3cdc1e['update'](_0x1f2c9f)[_0x084a('0x29')](function(_0x2af138){return _0x2af138;});}return null;};}function removeEntity(_0x54233b,_0x5b1474){return function(_0x8806d5){if(_0x8806d5){return _0x8806d5[_0x084a('0x2a')]()[_0x084a('0x29')](function(){var _0x4c5658=_0x8806d5['get']({'plain':!![]});var _0x4874fe='VoicePrefixes';return db[_0x084a('0x2b')]['destroy']({'where':{'type':_0x4874fe,'resourceId':_0x4c5658['id']}})['then'](function(){return _0x8806d5;});})['then'](function(){_0x54233b[_0x084a('0x1e')](0xcc)[_0x084a('0x1f')]();});}};}function handleEntityNotFound(_0x388062,_0x2c4149){return function(_0x3be7a6){if(!_0x3be7a6){_0x388062[_0x084a('0x1d')](0x194);}return _0x3be7a6;};}function handleError(_0x378de6,_0x16053f){_0x16053f=_0x16053f||0x1f4;return function(_0x5e6ea8){logger[_0x084a('0x2c')](_0x5e6ea8[_0x084a('0x2d')]);if(_0x5e6ea8['name']){delete _0x5e6ea8[_0x084a('0x2e')];}_0x378de6[_0x084a('0x1e')](_0x16053f)[_0x084a('0x2f')](_0x5e6ea8);};}exports[_0x084a('0x30')]=function(_0x448ae9,_0x202602){var _0x3a99fe={},_0x1e971a={},_0x50cb54={'count':0x0,'rows':[]};var _0x2f59a6=_[_0x084a('0x31')](db[_0x084a('0x32')][_0x084a('0x33')],function(_0x49c9db){return{'name':_0x49c9db['fieldName'],'type':_0x49c9db[_0x084a('0x34')][_0x084a('0x35')]};});_0x1e971a[_0x084a('0x36')]=_[_0x084a('0x31')](_0x2f59a6,_0x084a('0x2e'));_0x1e971a['query']=_[_0x084a('0x37')](_0x448ae9[_0x084a('0x38')]);_0x1e971a[_0x084a('0x39')]=_['intersection'](_0x1e971a[_0x084a('0x36')],_0x1e971a[_0x084a('0x38')]);_0x3a99fe[_0x084a('0x3a')]=_['intersection'](_0x1e971a['model'],qs['fields'](_0x448ae9[_0x084a('0x38')][_0x084a('0x3b')]));_0x3a99fe[_0x084a('0x3a')]=_0x3a99fe['attributes'][_0x084a('0x3c')]?_0x3a99fe[_0x084a('0x3a')]:_0x1e971a[_0x084a('0x36')];if(!_0x448ae9[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x3a99fe[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x448ae9[_0x084a('0x38')][_0x084a('0x23')]);_0x3a99fe[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x448ae9[_0x084a('0x38')][_0x084a('0x21')]);}_0x3a99fe[_0x084a('0x3f')]=qs['sort'](_0x448ae9[_0x084a('0x38')][_0x084a('0x40')]);_0x3a99fe[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x448ae9[_0x084a('0x38')],_0x1e971a[_0x084a('0x39')]),_0x2f59a6);if(_0x448ae9[_0x084a('0x38')][_0x084a('0x43')]){_0x3a99fe['where']=_[_0x084a('0x44')](_0x3a99fe[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x2f59a6,function(_0x432eb7){if(_0x432eb7[_0x084a('0x34')]!==_0x084a('0x45')){var _0x515743={};_0x515743[_0x432eb7[_0x084a('0x2e')]]={'$like':'%'+_0x448ae9[_0x084a('0x38')]['filter']+'%'};return _0x515743;}})});}_0x3a99fe=_[_0x084a('0x44')]({},_0x3a99fe,_0x448ae9[_0x084a('0x46')]);var _0x68e0d6={'where':_0x3a99fe['where']};return db[_0x084a('0x32')][_0x084a('0x24')](_0x68e0d6)['then'](function(_0x3e2b92){_0x50cb54[_0x084a('0x24')]=_0x3e2b92;if(_0x448ae9['query']['includeAll']){_0x3a99fe[_0x084a('0x47')]=[{'all':!![]}];}return db[_0x084a('0x32')][_0x084a('0x48')](_0x3a99fe);})[_0x084a('0x29')](function(_0x1e2a2d){_0x50cb54[_0x084a('0x49')]=_0x1e2a2d;return _0x50cb54;})[_0x084a('0x29')](respondWithFilteredResult(_0x202602,_0x3a99fe))[_0x084a('0x4a')](handleError(_0x202602,null));};exports[_0x084a('0x4b')]=function(_0x8b61f5,_0x30f8a4){var _0x593cc8={'raw':![],'where':{'id':_0x8b61f5[_0x084a('0x4c')]['id']}},_0x51dbda={};_0x51dbda[_0x084a('0x36')]=_[_0x084a('0x37')](db['VoicePrefix'][_0x084a('0x33')]);_0x51dbda[_0x084a('0x38')]=_[_0x084a('0x37')](_0x8b61f5[_0x084a('0x38')]);_0x51dbda[_0x084a('0x39')]=_['intersection'](_0x51dbda[_0x084a('0x36')],_0x51dbda['query']);_0x593cc8[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x51dbda[_0x084a('0x36')],qs['fields'](_0x8b61f5['query'][_0x084a('0x3b')]));_0x593cc8[_0x084a('0x3a')]=_0x593cc8['attributes'][_0x084a('0x3c')]?_0x593cc8[_0x084a('0x3a')]:_0x51dbda[_0x084a('0x36')];if(_0x8b61f5[_0x084a('0x38')]['includeAll']){_0x593cc8[_0x084a('0x47')]=[{'all':!![]}];}_0x593cc8=_[_0x084a('0x44')]({},_0x593cc8,_0x8b61f5[_0x084a('0x46')]);return db[_0x084a('0x32')]['find'](_0x593cc8)[_0x084a('0x29')](handleEntityNotFound(_0x30f8a4,null))[_0x084a('0x29')](respondWithResult(_0x30f8a4,null))[_0x084a('0x4a')](handleError(_0x30f8a4,null));};exports[_0x084a('0x2a')]=function(_0x5a718c,_0x502d9a){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x5a718c[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x502d9a,null))[_0x084a('0x29')](removeEntity(_0x502d9a,null))[_0x084a('0x4a')](handleError(_0x502d9a,null));};exports[_0x084a('0x4f')]=function(_0x12c3a8,_0xf6ce0d){return db[_0x084a('0x32')][_0x084a('0x4f')]()[_0x084a('0x29')](respondWithResult(_0xf6ce0d,null))['catch'](handleError(_0xf6ce0d,null));};exports[_0x084a('0x50')]=function(_0x37fce4,_0x29fa4b){var _0x39edc1;return db[_0x084a('0x51')][_0x084a('0x52')](function(_0xa5362){return db['VoicePrefix'][_0x084a('0x50')](_0x37fce4[_0x084a('0x53')],{'transaction':_0xa5362})[_0x084a('0x29')](function(_0x54aa6c){_0x39edc1=_0x54aa6c['get']({'plain':!![]});return db[_0x084a('0x54')]['find']({'where':{'id':_0x39edc1[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x490ad9){return createVoicePrefixExtensions(_0x39edc1,_0x490ad9,_0xa5362);});});})[_0x084a('0x29')](function(){var _0x54e9a5=_0x37fce4['user'][_0x084a('0x56')]({'plain':!![]});if(!_0x54e9a5)throw new Error(_0x084a('0x57'));if(_0x54e9a5[_0x084a('0x58')]===_0x084a('0x59')){var _0x2a8056=_0x39edc1;return db[_0x084a('0x5a')][_0x084a('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x54e9a5[_0x084a('0x5b')]},'raw':!![]})[_0x084a('0x29')](function(_0x3d7f0a){if(_0x3d7f0a&&_0x3d7f0a['autoAssociation']===0x0){return db[_0x084a('0x2b')][_0x084a('0x50')]({'name':_0x2a8056[_0x084a('0x2e')],'resourceId':_0x2a8056['id'],'type':_0x3d7f0a[_0x084a('0x2e')],'sectionId':_0x3d7f0a['id']},{})['then'](function(){return _0x39edc1;});}else{return _0x39edc1;}})[_0x084a('0x4a')](function(_0x58fe64){logger[_0x084a('0x2c')](_0x084a('0x5c'),_0x58fe64);throw _0x58fe64;});}return _0x39edc1;})[_0x084a('0x29')](respondWithResult(_0x29fa4b,null))['catch'](handleError(_0x29fa4b,null));};function Extension(_0x589e38,_0xd37003,_0x2f228c,_0x598075){this[_0x084a('0x5d')]='from-sip';this['exten']=_0x589e38;this[_0x084a('0x5e')]=_0x2f228c;this[_0x084a('0x34')]=_0x084a('0x5f');this[_0x084a('0x60')]=_0x084a('0x61');this[_0x084a('0x62')]=_0xd37003;this[_0x084a('0x63')]=_0x598075;}function createVoicePrefixExtensions(_0x5ab9d6,_0x114aa5,_0x50fe69){return new BPromise(function(_0x445563,_0x12588a){var _0x3668eb=new Extension(formatPrefixName(_0x5ab9d6['prefix']),0x1,_0x084a('0x64'),_0x084a('0x65'));_0x3668eb['VoicePrefixId']=_0x5ab9d6['id'];return db[_0x084a('0x54')]['create'](_0x3668eb,{'transaction':_0x50fe69})['then'](function(_0x1c40f3){var _0x534db3=_0x1c40f3['get']({'plain':!![]});var _0x2368f5=_[_0x084a('0x31')](addVoicePrefixExtensions(_0x5ab9d6,_0x114aa5),function(_0x495304){_0x495304['VoiceExtensionId']=_0x534db3['id'];_0x495304[_0x084a('0x66')]=_0x5ab9d6['id'];return _0x495304;});return db[_0x084a('0x54')][_0x084a('0x67')](_0x2368f5,{'transaction':_0x50fe69})[_0x084a('0x29')](function(_0x45e2d3){if(!_0x45e2d3){return _0x12588a(_0x084a('0x68'));}else{return _0x445563(_0x45e2d3);}})[_0x084a('0x4a')](function(_0x560f60){return _0x12588a(_0x560f60);});});;});};function addVoicePrefixExtensions(_0x51e090,_0x2ba35a){var _0x36ba24=[];var _0x5c77a3=formatPrefixName(_0x51e090[_0x084a('0x69')]);_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x2,_0x084a('0x6b'),_0x084a('0x6c')+_0x51e090['name']));if(_0x51e090[_0x084a('0x6d')]){_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x6b'),'PREFIX-CALLERIDALL='+_0x51e090['callerIdAll']));}else{_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x3,_0x084a('0x64'),_0x084a('0x6e')));}_0x36ba24[_0x084a('0x6a')](new Extension(_0x5c77a3,0x4,_0x084a('0x6f'),_0x2ba35a[_0x084a('0x5d')]+','+_0x084a('0x70')+(0x8+_0x51e090['name'][_0x084a('0x3c')])+'}'+','+0x1));return _0x36ba24;}function formatPrefixName(_0x51a066){var _0x4e713c='_';for(var _0x24a553=0x0;_0x24a553<_0x51a066[_0x084a('0x3c')];_0x24a553++){if(_0x51a066[_0x084a('0x71')](_0x24a553)=='-'){_0x4e713c+=_0x51a066['charAt'](_0x24a553);}else{_0x4e713c+='['+_0x51a066[_0x084a('0x71')](_0x24a553)+']';}}_0x4e713c+='.';return _0x4e713c;}exports['update']=function(_0x1eb7be,_0x1054ea,_0x2417b4){var _0x12cef4=_0x1eb7be[_0x084a('0x53')];_0x12cef4[_0x084a('0x69')]='system-'+_0x12cef4['name']+'-';return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x782285){return db[_0x084a('0x32')][_0x084a('0x72')](_0x12cef4,{'where':{'id':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db['VoiceExtension'][_0x084a('0x2a')]({'where':{'VoicePrefixId':_0x12cef4['id']},'transaction':_0x782285})[_0x084a('0x29')](function(){return db[_0x084a('0x54')][_0x084a('0x4e')]({'where':{'id':_0x12cef4[_0x084a('0x55')]},'raw':!![]})[_0x084a('0x29')](function(_0x537578){return createVoicePrefixExtensions(_0x12cef4,_0x537578,_0x782285);});});});})['then'](function(){return db[_0x084a('0x32')][_0x084a('0x73')](_0x12cef4['id']);})[_0x084a('0x29')](respondWithResult(_0x1054ea,null))[_0x084a('0x4a')](handleError(_0x1054ea,null));};exports[_0x084a('0x74')]=function(_0xb287e7,_0x3824db,_0x26cd70){return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0xb287e7['params']['id']}})['then'](handleEntityNotFound(_0x3824db,null))['then'](function(_0x2216d4){if(_0x2216d4){return _0x2216d4[_0x084a('0x74')](_0xb287e7['body'][_0x084a('0x75')],_[_0x084a('0x76')](_0xb287e7[_0x084a('0x53')],[_0x084a('0x75'),'id'])||{})['spread'](function(_0x50cb3a){for(var _0x30ea2a=0x0;_0x30ea2a<_0xb287e7[_0x084a('0x53')][_0x084a('0x75')][_0x084a('0x3c')];_0x30ea2a+=0x1){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':Number(_0xb287e7[_0x084a('0x53')]['ids'][_0x30ea2a]),'VoicePrefixId':Number(_0xb287e7[_0x084a('0x4c')]['id'])});}return _0x50cb3a;});}})[_0x084a('0x29')](respondWithResult(_0x3824db,null))[_0x084a('0x4a')](handleError(_0x3824db,null));};exports[_0x084a('0x79')]=function(_0x3dcafb,_0x31b89a,_0x14617e){return db['VoicePrefix'][_0x084a('0x4e')]({'where':{'id':_0x3dcafb[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x31b89a,null))[_0x084a('0x29')](function(_0x417048){if(_0x417048){return _0x417048[_0x084a('0x79')](_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')])[_0x084a('0x29')](function(){if(_[_0x084a('0x7a')](_0x3dcafb[_0x084a('0x38')]['ids'])){for(var _0x2932b6=0x0;_0x2932b6<_0x3dcafb[_0x084a('0x38')]['ids'][_0x084a('0x3c')];_0x2932b6+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')][_0x2932b6]),'VoicePrefixId':Number(_0x3dcafb['params']['id'])});}}else{socket[_0x084a('0x77')](_0x084a('0x7b'),{'UserId':Number(_0x3dcafb[_0x084a('0x38')][_0x084a('0x75')]),'VoicePrefixId':Number(_0x3dcafb[_0x084a('0x4c')]['id'])});}});}})[_0x084a('0x29')](respondWithStatusCode(_0x31b89a,null))[_0x084a('0x4a')](handleError(_0x31b89a,null));};exports[_0x084a('0x7c')]=function(_0x1916b1,_0x8074aa,_0xe03abd){var _0x7c85e3={};var _0x19ea24={};var _0x18cf1e;var _0x3b8dda;return db['VoicePrefix'][_0x084a('0x7d')]({'where':{'id':_0x1916b1[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x8074aa,null))[_0x084a('0x29')](function(_0x1a99b2){if(_0x1a99b2){_0x18cf1e=_0x1a99b2;_0x19ea24[_0x084a('0x36')]=_[_0x084a('0x37')](db[_0x084a('0x7e')]['rawAttributes']);_0x19ea24['query']=_[_0x084a('0x37')](_0x1916b1[_0x084a('0x38')]);_0x19ea24['filters']=_['intersection'](_0x19ea24[_0x084a('0x36')],_0x19ea24['query']);_0x7c85e3[_0x084a('0x3a')]=_['intersection'](_0x19ea24[_0x084a('0x36')],qs[_0x084a('0x3b')](_0x1916b1[_0x084a('0x38')][_0x084a('0x3b')]));_0x7c85e3['attributes']=_0x7c85e3['attributes']['length']?_0x7c85e3[_0x084a('0x3a')]:_0x19ea24[_0x084a('0x36')];_0x7c85e3[_0x084a('0x3f')]=qs['sort'](_0x1916b1[_0x084a('0x38')][_0x084a('0x40')]);_0x7c85e3['where']=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x1916b1['query'],_0x19ea24[_0x084a('0x39')]));if(_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]){_0x7c85e3['where']=_['merge'](_0x7c85e3[_0x084a('0x41')],{'$or':_['map'](_0x7c85e3[_0x084a('0x3a')],function(_0x67d92b){var _0x11894e={};_0x11894e[_0x67d92b]={'$like':'%'+_0x1916b1[_0x084a('0x38')][_0x084a('0x43')]+'%'};return _0x11894e;})});}_0x7c85e3=_[_0x084a('0x44')]({},_0x7c85e3,_0x1916b1['options']);return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})['then'](function(_0x5ce185){if(_0x5ce185){_0x3b8dda=_0x5ce185[_0x084a('0x3c')];if(!_0x1916b1[_0x084a('0x38')][_0x084a('0x3d')](_0x084a('0x3e'))){_0x7c85e3[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x1916b1['query']['limit']);_0x7c85e3[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x1916b1[_0x084a('0x38')]['offset']);}return _0x18cf1e[_0x084a('0x7c')](_0x7c85e3);}})[_0x084a('0x29')](function(_0x4eb3da){if(_0x4eb3da){return _0x4eb3da?{'count':_0x3b8dda,'rows':_0x4eb3da}:null;}})['then'](respondWithResult(_0x8074aa,null))[_0x084a('0x4a')](handleError(_0x8074aa,null));};exports['getTeams']=function(_0x5c93b2,_0x135e46,_0x2d9c66){var _0x57d90c={};var _0x42d267={};var _0x2ee08a;var _0x4f40c4;return db[_0x084a('0x32')][_0x084a('0x7d')]({'where':{'id':_0x5c93b2[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](handleEntityNotFound(_0x135e46,null))[_0x084a('0x29')](function(_0x29cdb8){if(_0x29cdb8){_0x2ee08a=_0x29cdb8;_0x42d267['model']=_['keys'](db[_0x084a('0x7f')][_0x084a('0x33')]);_0x42d267['query']=_[_0x084a('0x37')](_0x5c93b2['query']);_0x42d267[_0x084a('0x39')]=_[_0x084a('0x4d')](_0x42d267[_0x084a('0x36')],_0x42d267[_0x084a('0x38')]);_0x57d90c[_0x084a('0x3a')]=_[_0x084a('0x4d')](_0x42d267['model'],qs['fields'](_0x5c93b2[_0x084a('0x38')][_0x084a('0x3b')]));_0x57d90c[_0x084a('0x3a')]=_0x57d90c[_0x084a('0x3a')][_0x084a('0x3c')]?_0x57d90c['attributes']:_0x42d267[_0x084a('0x36')];_0x57d90c[_0x084a('0x3f')]=qs[_0x084a('0x40')](_0x5c93b2[_0x084a('0x38')]['sort']);_0x57d90c[_0x084a('0x41')]=qs[_0x084a('0x39')](_[_0x084a('0x42')](_0x5c93b2[_0x084a('0x38')],_0x42d267[_0x084a('0x39')]));if(_0x5c93b2[_0x084a('0x38')][_0x084a('0x43')]){_0x57d90c[_0x084a('0x41')]=_[_0x084a('0x44')](_0x57d90c[_0x084a('0x41')],{'$or':_[_0x084a('0x31')](_0x57d90c['attributes'],function(_0x5ed84e){var _0x35df86={};_0x35df86[_0x5ed84e]={'$like':'%'+_0x5c93b2['query'][_0x084a('0x43')]+'%'};return _0x35df86;})});}_0x57d90c=_[_0x084a('0x44')]({},_0x57d90c,_0x5c93b2[_0x084a('0x46')]);return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x5412d1){if(_0x5412d1){_0x4f40c4=_0x5412d1[_0x084a('0x3c')];if(!_0x5c93b2[_0x084a('0x38')]['hasOwnProperty'](_0x084a('0x3e'))){_0x57d90c[_0x084a('0x23')]=qs[_0x084a('0x23')](_0x5c93b2['query'][_0x084a('0x23')]);_0x57d90c[_0x084a('0x21')]=qs[_0x084a('0x21')](_0x5c93b2[_0x084a('0x38')][_0x084a('0x21')]);}return _0x2ee08a[_0x084a('0x80')](_0x57d90c);}})[_0x084a('0x29')](function(_0x37d422){if(_0x37d422){return _0x37d422?{'count':_0x4f40c4,'rows':_0x37d422}:null;}})['then'](respondWithResult(_0x135e46,null))[_0x084a('0x4a')](handleError(_0x135e46,null));};exports[_0x084a('0x81')]=function(_0x355c04,_0x8b89d0,_0x5db744){var _0x45a53a=_0x355c04[_0x084a('0x53')][_0x084a('0x75')];var _0xab0f66;return db[_0x084a('0x7f')][_0x084a('0x48')]({'where':{'id':_0x45a53a},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':'Agents','attributes':['id',_0x084a('0x2e'),_0x084a('0x82'),_0x084a('0x83'),_0x084a('0x84')],'raw':!![]}]})[_0x084a('0x29')](function(_0x4087bf){if(_0x4087bf){_0xab0f66=_0x4087bf;var _0x88598d=_[_0x084a('0x85')](_0x4087bf,function(_0x1106ff){var _0x3339d4=_0x1106ff[_0x084a('0x56')]({'plain':!![]});return _0x3339d4[_0x084a('0x86')];});return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x355c04[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x378b74){return db['sequelize'][_0x084a('0x52')](function(_0x383bb8){return _0x378b74[_0x084a('0x81')](_0x45a53a,{'transaction':_0x383bb8})[_0x084a('0x29')](function(){return BPromise['each'](_0xab0f66,function(_0x133f4c){return db[_0x084a('0x87')][_0x084a('0x88')]({'TeamId':_0x133f4c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},{'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){return BPromise[_0x084a('0x89')](_0x88598d,function(_0x5b5c6c){return db['UserVoicePrefix'][_0x084a('0x8a')]({'where':{'UserId':_0x5b5c6c['id'],'VoicePrefixId':_0x355c04[_0x084a('0x4c')]['id']},'transaction':_0x383bb8});});})[_0x084a('0x29')](function(){_0x88598d[_0x084a('0x8b')](function(_0x3dd10e){socket[_0x084a('0x77')](_0x084a('0x78'),{'UserId':_0x3dd10e['id'],'VoicePrefixId':_0x378b74['id']});});});});});}})[_0x084a('0x29')](respondWithStatusCode(_0x8b89d0,null))['catch'](handleError(_0x8b89d0,null));};exports[_0x084a('0x8c')]=function(_0x294cca,_0x3be1f3,_0x1c6dec){return db['Team']['findAll']({'where':{'id':_0x294cca[_0x084a('0x38')][_0x084a('0x75')]},'attributes':['id'],'include':[{'model':db[_0x084a('0x7e')],'as':_0x084a('0x86'),'attributes':['id'],'raw':!![]}]})[_0x084a('0x29')](handleEntityNotFound(_0x3be1f3,null))['then'](function(_0x57ed50){var _0x5288ea=_[_0x084a('0x31')](_0x57ed50,'id');var _0x19aff1=[];var _0x5dab17=[];var _0x3983b1=squel[_0x084a('0x8d')]();_0x3983b1['field'](_0x084a('0x8e'))[_0x084a('0x8f')](_0x084a('0x90'),'tq')['join'](_0x084a('0x91'),'ut',_0x084a('0x92'))[_0x084a('0x41')](_0x084a('0x93'),_0x294cca[_0x084a('0x4c')]['id']);for(var _0x1d6333=0x0;_0x1d6333<_0x57ed50['length'];_0x1d6333+=0x1){let _0x277932=_0x57ed50[_0x1d6333];for(var _0x5f16a1=0x0;_0x5f16a1<_0x277932[_0x084a('0x86')]['length'];_0x5f16a1+=0x1){let _0x4156fa=_0x277932[_0x084a('0x86')][_0x5f16a1];var _0x43f940=_0x3983b1[_0x084a('0x94')]();_0x43f940[_0x084a('0x41')](_0x084a('0x95'),_0x4156fa['id']);_0x5dab17[_0x084a('0x6a')](db[_0x084a('0x51')][_0x084a('0x38')](_0x43f940[_0x084a('0x96')](),{'type':db[_0x084a('0x51')][_0x084a('0x97')]['SELECT']})[_0x084a('0x29')](function(_0x44f94e){if(_0x44f94e[_0x084a('0x3c')]===0x1){return _0x4156fa['id'];}else{var _0x4725a0=_[_0x084a('0x98')](_[_0x084a('0x31')](_0x44f94e,_0x084a('0x99')),function(_0x13b3f0){return _['includes'](_0x5288ea,_0x13b3f0);});if(_0x4725a0){return _0x4156fa['id'];}}}));}}return BPromise['all'](_0x5dab17)['then'](function(_0x1bcb9d){_0x19aff1=_(_0x19aff1)[_0x084a('0x9a')](_0x1bcb9d)[_0x084a('0x9b')]()[_0x084a('0x9c')]();return db[_0x084a('0x32')][_0x084a('0x4e')]({'where':{'id':_0x294cca[_0x084a('0x4c')]['id']}})[_0x084a('0x29')](function(_0x1997ee){return db[_0x084a('0x51')][_0x084a('0x52')](function(_0x1f5843){return _0x1997ee[_0x084a('0x8c')](_0x294cca[_0x084a('0x38')][_0x084a('0x75')],{'transaction':_0x1f5843})[_0x084a('0x29')](function(){if(!_[_0x084a('0x9d')](_0x19aff1)){return _0x1997ee[_0x084a('0x79')](_0x19aff1,{'transaction':_0x1f5843});}})[_0x084a('0x29')](function(){_0x19aff1[_0x084a('0x8b')](function(_0x2ee2a7){socket['emit'](_0x084a('0x7b'),{'UserId':_0x2ee2a7,'VoicePrefixId':_0x1997ee['id']});});});});});});})[_0x084a('0x29')](respondWithStatusCode(_0x3be1f3,null))[_0x084a('0x4a')](handleError(_0x3be1f3,null));}; \ No newline at end of file +var _0x8603=['send','map','VoicePrefix','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','length','includeAll','include','find','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','priority','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','NoOp','goto','charAt','update','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','findOrCreate','removeTeams','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','clone','toString','QueryTypes','every','includes','all','union','compact','forEach','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','stack','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8603,0x190));var _0x3860=function(_0x56dd58,_0xb1287d){_0x56dd58=_0x56dd58-0x0;var _0x103e75=_0x8603[_0x56dd58];return _0x103e75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3860('0x0'));var zipdir=require(_0x3860('0x1'));var jsonpatch=require(_0x3860('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3860('0x3'));var Mustache=require(_0x3860('0x4'));var util=require(_0x3860('0x5'));var path=require('path');var sox=require(_0x3860('0x6'));var csv=require('to-csv');var ejs=require(_0x3860('0x7'));var fs=require('fs');var fs_extra=require(_0x3860('0x8'));var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3860('0x14'))['db'];config[_0x3860('0x15')]=_[_0x3860('0x16')](config[_0x3860('0x15')],{'host':_0x3860('0x17'),'port':0x18eb});var socket=require(_0x3860('0x18'))(new Redis(config[_0x3860('0x15')]));require(_0x3860('0x19'))[_0x3860('0x1a')](socket);function respondWithStatusCode(_0x46264d,_0x54dbc3){_0x54dbc3=_0x54dbc3||0xcc;return function(_0x3d861d){if(_0x3d861d){return _0x46264d[_0x3860('0x1b')](_0x54dbc3);}return _0x46264d[_0x3860('0x1c')](_0x54dbc3)[_0x3860('0x1d')]();};}function respondWithResult(_0x1055b3,_0xfa0c9a){_0xfa0c9a=_0xfa0c9a||0xc8;return function(_0x2d8a3a){if(_0x2d8a3a){return _0x1055b3[_0x3860('0x1c')](_0xfa0c9a)[_0x3860('0x1e')](_0x2d8a3a);}};}function respondWithFilteredResult(_0x3c0d91,_0x3e51b4){return function(_0x45b799){if(_0x45b799){var _0x4b6b15=typeof _0x3e51b4['offset']===_0x3860('0x1f')&&typeof _0x3e51b4[_0x3860('0x20')]===_0x3860('0x1f');var _0x53fc63=_0x45b799[_0x3860('0x21')];var _0x145b26=_0x4b6b15?0x0:_0x3e51b4[_0x3860('0x22')];var _0x3af33a=_0x4b6b15?_0x45b799[_0x3860('0x21')]:_0x3e51b4[_0x3860('0x22')]+_0x3e51b4[_0x3860('0x20')];var _0x1f8891;if(_0x3af33a>=_0x53fc63){_0x3af33a=_0x53fc63;_0x1f8891=0xc8;}else{_0x1f8891=0xce;}_0x3c0d91[_0x3860('0x1c')](_0x1f8891);return _0x3c0d91[_0x3860('0x23')](_0x3860('0x24'),_0x145b26+'-'+_0x3af33a+'/'+_0x53fc63)[_0x3860('0x1e')](_0x45b799);}return null;};}function patchUpdates(_0x280ea9){return function(_0x9eaaa1){try{jsonpatch[_0x3860('0x25')](_0x9eaaa1,_0x280ea9,!![]);}catch(_0x564efd){return BPromise[_0x3860('0x26')](_0x564efd);}return _0x9eaaa1[_0x3860('0x27')]();};}function saveUpdates(_0x2b91f2,_0x301e03){return function(_0x20bb1e){if(_0x20bb1e){return _0x20bb1e['update'](_0x2b91f2)[_0x3860('0x28')](function(_0x568515){return _0x568515;});}return null;};}function removeEntity(_0x577750,_0xfa9705){return function(_0x1c4bbc){if(_0x1c4bbc){return _0x1c4bbc['destroy']()['then'](function(){var _0x5f42d5=_0x1c4bbc[_0x3860('0x29')]({'plain':!![]});var _0x3ebc5b=_0x3860('0x2a');return db[_0x3860('0x2b')][_0x3860('0x2c')]({'where':{'type':_0x3ebc5b,'resourceId':_0x5f42d5['id']}})[_0x3860('0x28')](function(){return _0x1c4bbc;});})['then'](function(){_0x577750['status'](0xcc)[_0x3860('0x1d')]();});}};}function handleEntityNotFound(_0x1f1809,_0x5a9af2){return function(_0x2551f4){if(!_0x2551f4){_0x1f1809[_0x3860('0x1b')](0x194);}return _0x2551f4;};}function handleError(_0x10d9e4,_0x426e6c){_0x426e6c=_0x426e6c||0x1f4;return function(_0x3628f7){logger['error'](_0x3628f7[_0x3860('0x2d')]);if(_0x3628f7[_0x3860('0x2e')]){delete _0x3628f7[_0x3860('0x2e')];}_0x10d9e4['status'](_0x426e6c)[_0x3860('0x2f')](_0x3628f7);};}exports['index']=function(_0x294b3a,_0x4825f0){var _0x1c498c={},_0x2e542a={},_0x24cf39={'count':0x0,'rows':[]};var _0x47e350=_[_0x3860('0x30')](db[_0x3860('0x31')]['rawAttributes'],function(_0x1c94cc){return{'name':_0x1c94cc['fieldName'],'type':_0x1c94cc[_0x3860('0x32')][_0x3860('0x33')]};});_0x2e542a[_0x3860('0x34')]=_[_0x3860('0x30')](_0x47e350,_0x3860('0x2e'));_0x2e542a[_0x3860('0x35')]=_[_0x3860('0x36')](_0x294b3a['query']);_0x2e542a[_0x3860('0x37')]=_[_0x3860('0x38')](_0x2e542a['model'],_0x2e542a[_0x3860('0x35')]);_0x1c498c[_0x3860('0x39')]=_[_0x3860('0x38')](_0x2e542a['model'],qs['fields'](_0x294b3a[_0x3860('0x35')][_0x3860('0x3a')]));_0x1c498c[_0x3860('0x39')]=_0x1c498c[_0x3860('0x39')]['length']?_0x1c498c['attributes']:_0x2e542a[_0x3860('0x34')];if(!_0x294b3a[_0x3860('0x35')][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1c498c[_0x3860('0x20')]=qs['limit'](_0x294b3a[_0x3860('0x35')][_0x3860('0x20')]);_0x1c498c['offset']=qs['offset'](_0x294b3a[_0x3860('0x35')][_0x3860('0x22')]);}_0x1c498c[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x294b3a[_0x3860('0x35')]['sort']);_0x1c498c[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x294b3a[_0x3860('0x35')],_0x2e542a['filters']),_0x47e350);if(_0x294b3a[_0x3860('0x35')][_0x3860('0x41')]){_0x1c498c['where']=_[_0x3860('0x42')](_0x1c498c[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x47e350,function(_0xf346e){if(_0xf346e['type']!==_0x3860('0x43')){var _0x47141b={};_0x47141b[_0xf346e[_0x3860('0x2e')]]={'$like':'%'+_0x294b3a['query'][_0x3860('0x41')]+'%'};return _0x47141b;}})});}_0x1c498c=_['merge']({},_0x1c498c,_0x294b3a[_0x3860('0x44')]);var _0x424801={'where':_0x1c498c[_0x3860('0x3f')]};return db[_0x3860('0x31')][_0x3860('0x21')](_0x424801)[_0x3860('0x28')](function(_0x4e0a44){_0x24cf39[_0x3860('0x21')]=_0x4e0a44;if(_0x294b3a[_0x3860('0x35')]['includeAll']){_0x1c498c['include']=[{'all':!![]}];}return db[_0x3860('0x31')][_0x3860('0x45')](_0x1c498c);})['then'](function(_0x164a77){_0x24cf39[_0x3860('0x46')]=_0x164a77;return _0x24cf39;})['then'](respondWithFilteredResult(_0x4825f0,_0x1c498c))[_0x3860('0x47')](handleError(_0x4825f0,null));};exports[_0x3860('0x48')]=function(_0x392dc3,_0x37e5c3){var _0x14f5b2={'raw':![],'where':{'id':_0x392dc3[_0x3860('0x49')]['id']}},_0x3fa282={};_0x3fa282[_0x3860('0x34')]=_[_0x3860('0x36')](db[_0x3860('0x31')][_0x3860('0x4a')]);_0x3fa282[_0x3860('0x35')]=_[_0x3860('0x36')](_0x392dc3['query']);_0x3fa282[_0x3860('0x37')]=_['intersection'](_0x3fa282[_0x3860('0x34')],_0x3fa282[_0x3860('0x35')]);_0x14f5b2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x3fa282[_0x3860('0x34')],qs[_0x3860('0x3a')](_0x392dc3[_0x3860('0x35')][_0x3860('0x3a')]));_0x14f5b2['attributes']=_0x14f5b2[_0x3860('0x39')][_0x3860('0x4b')]?_0x14f5b2[_0x3860('0x39')]:_0x3fa282['model'];if(_0x392dc3[_0x3860('0x35')][_0x3860('0x4c')]){_0x14f5b2[_0x3860('0x4d')]=[{'all':!![]}];}_0x14f5b2=_[_0x3860('0x42')]({},_0x14f5b2,_0x392dc3['options']);return db['VoicePrefix'][_0x3860('0x4e')](_0x14f5b2)['then'](handleEntityNotFound(_0x37e5c3,null))[_0x3860('0x28')](respondWithResult(_0x37e5c3,null))[_0x3860('0x47')](handleError(_0x37e5c3,null));};exports[_0x3860('0x2c')]=function(_0x52456e,_0x29c52d){return db['VoicePrefix'][_0x3860('0x4e')]({'where':{'id':_0x52456e['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x29c52d,null))[_0x3860('0x28')](removeEntity(_0x29c52d,null))[_0x3860('0x47')](handleError(_0x29c52d,null));};exports['describe']=function(_0x4876ab,_0x4408b5){return db[_0x3860('0x31')]['describe']()[_0x3860('0x28')](respondWithResult(_0x4408b5,null))['catch'](handleError(_0x4408b5,null));};exports[_0x3860('0x4f')]=function(_0x1267e1,_0x254631){var _0x233eee;return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x3fad85){return db['VoicePrefix'][_0x3860('0x4f')](_0x1267e1[_0x3860('0x52')],{'transaction':_0x3fad85})[_0x3860('0x28')](function(_0x137789){_0x233eee=_0x137789[_0x3860('0x29')]({'plain':!![]});return db[_0x3860('0x53')]['find']({'where':{'id':_0x233eee[_0x3860('0x54')]},'raw':!![]})[_0x3860('0x28')](function(_0x19a26d){return createVoicePrefixExtensions(_0x233eee,_0x19a26d,_0x3fad85);});});})[_0x3860('0x28')](function(){var _0x3a55e7=_0x1267e1[_0x3860('0x55')][_0x3860('0x29')]({'plain':!![]});if(!_0x3a55e7)throw new Error(_0x3860('0x56'));if(_0x3a55e7['role']===_0x3860('0x55')){var _0x2ff0bf=_0x233eee;return db['UserProfileSection'][_0x3860('0x4e')]({'where':{'name':_0x3860('0x2a'),'userProfileId':_0x3a55e7[_0x3860('0x57')]},'raw':!![]})['then'](function(_0x17d2df){if(_0x17d2df&&_0x17d2df['autoAssociation']===0x0){return db[_0x3860('0x2b')][_0x3860('0x4f')]({'name':_0x2ff0bf[_0x3860('0x2e')],'resourceId':_0x2ff0bf['id'],'type':_0x17d2df[_0x3860('0x2e')],'sectionId':_0x17d2df['id']},{})[_0x3860('0x28')](function(){return _0x233eee;});}else{return _0x233eee;}})[_0x3860('0x47')](function(_0x1a4f58){logger[_0x3860('0x58')](_0x3860('0x59'),_0x1a4f58);throw _0x1a4f58;});}return _0x233eee;})[_0x3860('0x28')](respondWithResult(_0x254631,null))[_0x3860('0x47')](handleError(_0x254631,null));};function Extension(_0x2bac24,_0x58147d,_0x5ce9a4,_0x5111e0){this[_0x3860('0x5a')]='from-sip';this['exten']=_0x2bac24;this[_0x3860('0x5b')]=_0x5ce9a4;this[_0x3860('0x32')]=_0x3860('0x5c');this[_0x3860('0x5d')]=_0x3860('0x5e');this[_0x3860('0x5f')]=_0x58147d;this['appdata']=_0x5111e0;}function createVoicePrefixExtensions(_0x49ec68,_0x4df47b,_0x1d6c70){return new BPromise(function(_0x1c1da4,_0x2d1646){var _0x5ec169=new Extension(formatPrefixName(_0x49ec68[_0x3860('0x60')]),0x1,'NoOp',_0x3860('0x61'));_0x5ec169[_0x3860('0x62')]=_0x49ec68['id'];return db['VoiceExtension'][_0x3860('0x4f')](_0x5ec169,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0xfe45d8){var _0x27f817=_0xfe45d8['get']({'plain':!![]});var _0x18cc37=_[_0x3860('0x30')](addVoicePrefixExtensions(_0x49ec68,_0x4df47b),function(_0x17f248){_0x17f248['VoiceExtensionId']=_0x27f817['id'];_0x17f248['VoicePrefixId']=_0x49ec68['id'];return _0x17f248;});return db[_0x3860('0x53')][_0x3860('0x63')](_0x18cc37,{'transaction':_0x1d6c70})[_0x3860('0x28')](function(_0x1ca0e7){if(!_0x1ca0e7){return _0x2d1646(_0x3860('0x64'));}else{return _0x1c1da4(_0x1ca0e7);}})[_0x3860('0x47')](function(_0x5d0210){return _0x2d1646(_0x5d0210);});});;});};function addVoicePrefixExtensions(_0x2d916a,_0x4fe4e8){var _0x5db8f9=[];var _0x15fa2d=formatPrefixName(_0x2d916a[_0x3860('0x60')]);_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x2,_0x3860('0x66'),_0x3860('0x67')+_0x2d916a[_0x3860('0x2e')]));if(_0x2d916a['callerIdAll']){_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x66'),_0x3860('0x68')+_0x2d916a[_0x3860('0x69')]));}else{_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x3,_0x3860('0x6a'),'No\x20callerid\x20available'));}_0x5db8f9[_0x3860('0x65')](new Extension(_0x15fa2d,0x4,_0x3860('0x6b'),_0x4fe4e8[_0x3860('0x5a')]+','+'${EXTEN:'+(0x8+_0x2d916a['name'][_0x3860('0x4b')])+'}'+','+0x1));return _0x5db8f9;}function formatPrefixName(_0x2d425d){var _0x11c2c8='_';for(var _0x3b7a76=0x0;_0x3b7a76<_0x2d425d[_0x3860('0x4b')];_0x3b7a76++){if(_0x2d425d['charAt'](_0x3b7a76)=='-'){_0x11c2c8+=_0x2d425d['charAt'](_0x3b7a76);}else{_0x11c2c8+='['+_0x2d425d[_0x3860('0x6c')](_0x3b7a76)+']';}}_0x11c2c8+='.';return _0x11c2c8;}exports[_0x3860('0x6d')]=function(_0x47e144,_0x5d9416,_0x2fd2ec){var _0x38ad4e=_0x47e144['body'];_0x38ad4e[_0x3860('0x60')]=_0x3860('0x6e')+_0x38ad4e[_0x3860('0x2e')]+'-';return db[_0x3860('0x50')]['transaction'](function(_0x1e8c5c){return db[_0x3860('0x31')]['update'](_0x38ad4e,{'where':{'id':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')][_0x3860('0x2c')]({'where':{'VoicePrefixId':_0x38ad4e['id']},'transaction':_0x1e8c5c})['then'](function(){return db[_0x3860('0x53')]['find']({'where':{'id':_0x38ad4e[_0x3860('0x54')]},'raw':!![]})['then'](function(_0x543574){return createVoicePrefixExtensions(_0x38ad4e,_0x543574,_0x1e8c5c);});});});})[_0x3860('0x28')](function(){return db['VoicePrefix'][_0x3860('0x6f')](_0x38ad4e['id']);})[_0x3860('0x28')](respondWithResult(_0x5d9416,null))[_0x3860('0x47')](handleError(_0x5d9416,null));};exports[_0x3860('0x70')]=function(_0x19f717,_0x43c5a1,_0x4b3447){return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x19f717[_0x3860('0x49')]['id']}})['then'](handleEntityNotFound(_0x43c5a1,null))[_0x3860('0x28')](function(_0x55661a){if(_0x55661a){return _0x55661a[_0x3860('0x70')](_0x19f717[_0x3860('0x52')]['ids'],_[_0x3860('0x71')](_0x19f717[_0x3860('0x52')],[_0x3860('0x72'),'id'])||{})['spread'](function(_0x572707){for(var _0x5a282a=0x0;_0x5a282a<_0x19f717['body'][_0x3860('0x72')][_0x3860('0x4b')];_0x5a282a+=0x1){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':Number(_0x19f717['body']['ids'][_0x5a282a]),'VoicePrefixId':Number(_0x19f717[_0x3860('0x49')]['id'])});}return _0x572707;});}})[_0x3860('0x28')](respondWithResult(_0x43c5a1,null))[_0x3860('0x47')](handleError(_0x43c5a1,null));};exports[_0x3860('0x75')]=function(_0x4b0652,_0x3a7c0c,_0x306560){return db['VoicePrefix']['find']({'where':{'id':_0x4b0652[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x3a7c0c,null))[_0x3860('0x28')](function(_0x27894f){if(_0x27894f){return _0x27894f['removeAgents'](_0x4b0652['query'][_0x3860('0x72')])['then'](function(){if(_[_0x3860('0x76')](_0x4b0652[_0x3860('0x35')]['ids'])){for(var _0x4e7713=0x0;_0x4e7713<_0x4b0652['query'][_0x3860('0x72')][_0x3860('0x4b')];_0x4e7713+=0x1){socket['emit'](_0x3860('0x77'),{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')][_0x4e7713]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}}else{socket[_0x3860('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x4b0652[_0x3860('0x35')][_0x3860('0x72')]),'VoicePrefixId':Number(_0x4b0652[_0x3860('0x49')]['id'])});}});}})[_0x3860('0x28')](respondWithStatusCode(_0x3a7c0c,null))[_0x3860('0x47')](handleError(_0x3a7c0c,null));};exports['getAgents']=function(_0x313366,_0xf57e80,_0x2f3759){var _0x41ee6f={};var _0x28fcb6={};var _0x543c98;var _0x532370;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x313366[_0x3860('0x49')]['id']}})[_0x3860('0x28')](handleEntityNotFound(_0xf57e80,null))[_0x3860('0x28')](function(_0x293c60){if(_0x293c60){_0x543c98=_0x293c60;_0x28fcb6[_0x3860('0x34')]=_['keys'](db[_0x3860('0x79')][_0x3860('0x4a')]);_0x28fcb6['query']=_[_0x3860('0x36')](_0x313366[_0x3860('0x35')]);_0x28fcb6[_0x3860('0x37')]=_['intersection'](_0x28fcb6[_0x3860('0x34')],_0x28fcb6[_0x3860('0x35')]);_0x41ee6f['attributes']=_[_0x3860('0x38')](_0x28fcb6['model'],qs[_0x3860('0x3a')](_0x313366[_0x3860('0x35')]['fields']));_0x41ee6f[_0x3860('0x39')]=_0x41ee6f[_0x3860('0x39')][_0x3860('0x4b')]?_0x41ee6f[_0x3860('0x39')]:_0x28fcb6[_0x3860('0x34')];_0x41ee6f['order']=qs[_0x3860('0x3e')](_0x313366[_0x3860('0x35')][_0x3860('0x3e')]);_0x41ee6f[_0x3860('0x3f')]=qs[_0x3860('0x37')](_['pick'](_0x313366['query'],_0x28fcb6[_0x3860('0x37')]));if(_0x313366[_0x3860('0x35')]['filter']){_0x41ee6f[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x41ee6f[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x41ee6f['attributes'],function(_0x3a0719){var _0x5a2f99={};_0x5a2f99[_0x3a0719]={'$like':'%'+_0x313366[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x5a2f99;})});}_0x41ee6f=_[_0x3860('0x42')]({},_0x41ee6f,_0x313366[_0x3860('0x44')]);return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})[_0x3860('0x28')](function(_0x467b1b){if(_0x467b1b){_0x532370=_0x467b1b['length'];if(!_0x313366[_0x3860('0x35')][_0x3860('0x3b')]('nolimit')){_0x41ee6f['limit']=qs['limit'](_0x313366['query'][_0x3860('0x20')]);_0x41ee6f[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x313366[_0x3860('0x35')][_0x3860('0x22')]);}return _0x543c98[_0x3860('0x7a')](_0x41ee6f);}})['then'](function(_0x204da6){if(_0x204da6){return _0x204da6?{'count':_0x532370,'rows':_0x204da6}:null;}})['then'](respondWithResult(_0xf57e80,null))[_0x3860('0x47')](handleError(_0xf57e80,null));};exports[_0x3860('0x7b')]=function(_0x897ea0,_0x221229,_0x459b6c){var _0x1108d2={};var _0x23d7f0={};var _0x52987a;var _0xcd4bd3;return db[_0x3860('0x31')][_0x3860('0x78')]({'where':{'id':_0x897ea0['params']['id']}})[_0x3860('0x28')](handleEntityNotFound(_0x221229,null))[_0x3860('0x28')](function(_0x1c87bd){if(_0x1c87bd){_0x52987a=_0x1c87bd;_0x23d7f0['model']=_[_0x3860('0x36')](db[_0x3860('0x7c')][_0x3860('0x4a')]);_0x23d7f0[_0x3860('0x35')]=_['keys'](_0x897ea0[_0x3860('0x35')]);_0x23d7f0[_0x3860('0x37')]=_[_0x3860('0x38')](_0x23d7f0['model'],_0x23d7f0[_0x3860('0x35')]);_0x1108d2[_0x3860('0x39')]=_[_0x3860('0x38')](_0x23d7f0['model'],qs[_0x3860('0x3a')](_0x897ea0[_0x3860('0x35')][_0x3860('0x3a')]));_0x1108d2['attributes']=_0x1108d2[_0x3860('0x39')][_0x3860('0x4b')]?_0x1108d2[_0x3860('0x39')]:_0x23d7f0['model'];_0x1108d2[_0x3860('0x3d')]=qs[_0x3860('0x3e')](_0x897ea0[_0x3860('0x35')]['sort']);_0x1108d2[_0x3860('0x3f')]=qs['filters'](_[_0x3860('0x40')](_0x897ea0['query'],_0x23d7f0[_0x3860('0x37')]));if(_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]){_0x1108d2[_0x3860('0x3f')]=_[_0x3860('0x42')](_0x1108d2[_0x3860('0x3f')],{'$or':_[_0x3860('0x30')](_0x1108d2[_0x3860('0x39')],function(_0x3f808c){var _0x1de607={};_0x1de607[_0x3f808c]={'$like':'%'+_0x897ea0[_0x3860('0x35')][_0x3860('0x41')]+'%'};return _0x1de607;})});}_0x1108d2=_[_0x3860('0x42')]({},_0x1108d2,_0x897ea0[_0x3860('0x44')]);return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})[_0x3860('0x28')](function(_0x46661f){if(_0x46661f){_0xcd4bd3=_0x46661f[_0x3860('0x4b')];if(!_0x897ea0['query'][_0x3860('0x3b')](_0x3860('0x3c'))){_0x1108d2[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x897ea0[_0x3860('0x35')][_0x3860('0x20')]);_0x1108d2[_0x3860('0x22')]=qs[_0x3860('0x22')](_0x897ea0[_0x3860('0x35')][_0x3860('0x22')]);}return _0x52987a[_0x3860('0x7b')](_0x1108d2);}})['then'](function(_0x252c19){if(_0x252c19){return _0x252c19?{'count':_0xcd4bd3,'rows':_0x252c19}:null;}})[_0x3860('0x28')](respondWithResult(_0x221229,null))[_0x3860('0x47')](handleError(_0x221229,null));};exports[_0x3860('0x7d')]=function(_0x4a929e,_0x1a1994,_0x2ece36){var _0x2fcf2c=_0x4a929e[_0x3860('0x52')]['ids'];var _0x280747;return db['Team']['findAll']({'where':{'id':_0x2fcf2c},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id',_0x3860('0x2e'),_0x3860('0x7f'),_0x3860('0x80'),_0x3860('0x81')],'raw':!![]}]})[_0x3860('0x28')](function(_0x273fed){if(_0x273fed){_0x280747=_0x273fed;var _0x3e4a88=_[_0x3860('0x82')](_0x273fed,function(_0x4677b0){var _0x559c=_0x4677b0[_0x3860('0x29')]({'plain':!![]});return _0x559c['Agents'];});return db[_0x3860('0x31')]['find']({'where':{'id':_0x4a929e[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x5891d8){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0x1a9158){return _0x5891d8[_0x3860('0x7d')](_0x2fcf2c,{'transaction':_0x1a9158})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x280747,function(_0x12296a){return db['TeamVoicePrefix'][_0x3860('0x84')]({'TeamId':_0x12296a['id'],'VoicePrefixId':_0x4a929e[_0x3860('0x49')]['id']},{'transaction':_0x1a9158});});})[_0x3860('0x28')](function(){return BPromise[_0x3860('0x83')](_0x3e4a88,function(_0x469ae6){return db['UserVoicePrefix'][_0x3860('0x85')]({'where':{'UserId':_0x469ae6['id'],'VoicePrefixId':_0x4a929e['params']['id']},'transaction':_0x1a9158});});})['then'](function(){_0x3e4a88['forEach'](function(_0x1059a4){socket[_0x3860('0x73')](_0x3860('0x74'),{'UserId':_0x1059a4['id'],'VoicePrefixId':_0x5891d8['id']});});});});});}})[_0x3860('0x28')](respondWithStatusCode(_0x1a1994,null))[_0x3860('0x47')](handleError(_0x1a1994,null));};exports[_0x3860('0x86')]=function(_0x270ca1,_0xe24a1d,_0x59c203){return db[_0x3860('0x7c')][_0x3860('0x45')]({'where':{'id':_0x270ca1['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x3860('0x79')],'as':_0x3860('0x7e'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x28')](handleEntityNotFound(_0xe24a1d,null))['then'](function(_0x1fe2d8){var _0x4f07f3=_[_0x3860('0x30')](_0x1fe2d8,'id');var _0x5c196e=[];var _0x41fd53=[];var _0xf91fc2=squel['select']();_0xf91fc2[_0x3860('0x87')](_0x3860('0x88'))['from'](_0x3860('0x89'),'tq')[_0x3860('0x8a')](_0x3860('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3860('0x3f')]('VoicePrefixId\x20=\x20?',_0x270ca1[_0x3860('0x49')]['id']);for(var _0x18b845=0x0;_0x18b845<_0x1fe2d8['length'];_0x18b845+=0x1){let _0x20edc7=_0x1fe2d8[_0x18b845];for(var _0x2d8581=0x0;_0x2d8581<_0x20edc7[_0x3860('0x7e')][_0x3860('0x4b')];_0x2d8581+=0x1){let _0x2d4744=_0x20edc7['Agents'][_0x2d8581];var _0x410bf4=_0xf91fc2[_0x3860('0x8c')]();_0x410bf4['where']('ut.UserId\x20=\x20?',_0x2d4744['id']);_0x41fd53[_0x3860('0x65')](db['sequelize'][_0x3860('0x35')](_0x410bf4[_0x3860('0x8d')](),{'type':db['sequelize'][_0x3860('0x8e')]['SELECT']})[_0x3860('0x28')](function(_0x4b8128){if(_0x4b8128[_0x3860('0x4b')]===0x1){return _0x2d4744['id'];}else{var _0x24788d=_[_0x3860('0x8f')](_[_0x3860('0x30')](_0x4b8128,'TeamId'),function(_0x25a8f7){return _[_0x3860('0x90')](_0x4f07f3,_0x25a8f7);});if(_0x24788d){return _0x2d4744['id'];}}}));}}return BPromise[_0x3860('0x91')](_0x41fd53)[_0x3860('0x28')](function(_0x4b7f2a){_0x5c196e=_(_0x5c196e)[_0x3860('0x92')](_0x4b7f2a)[_0x3860('0x93')]()['value']();return db[_0x3860('0x31')][_0x3860('0x4e')]({'where':{'id':_0x270ca1[_0x3860('0x49')]['id']}})[_0x3860('0x28')](function(_0x514374){return db[_0x3860('0x50')][_0x3860('0x51')](function(_0xd2167f){return _0x514374[_0x3860('0x86')](_0x270ca1['query'][_0x3860('0x72')],{'transaction':_0xd2167f})['then'](function(){if(!_['isEmpty'](_0x5c196e)){return _0x514374['removeAgents'](_0x5c196e,{'transaction':_0xd2167f});}})[_0x3860('0x28')](function(){_0x5c196e[_0x3860('0x94')](function(_0x1a6929){socket['emit'](_0x3860('0x77'),{'UserId':_0x1a6929,'VoicePrefixId':_0x514374['id']});});});});});});})['then'](respondWithStatusCode(_0xe24a1d,null))[_0x3860('0x47')](handleError(_0xe24a1d,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 7da656b..e10a793 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 _0x94d9=['../../mysqldb','VoicePrefix','setMaxListeners','emit','hasOwnProperty','hook','events'];(function(_0x1e76aa,_0x238147){var _0x1c83ab=function(_0x56f869){while(--_0x56f869){_0x1e76aa['push'](_0x1e76aa['shift']());}};_0x1c83ab(++_0x238147);}(_0x94d9,0x68));var _0x994d=function(_0xc0efd0,_0x5eb8c0){_0xc0efd0=_0xc0efd0-0x0;var _0x8fa6f7=_0x94d9[_0xc0efd0];return _0x8fa6f7;};'use strict';var EventEmitter=require(_0x994d('0x0'));var VoicePrefix=require(_0x994d('0x1'))['db'][_0x994d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x994d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x57294a){return function(_0x448df7,_0x2254b2,_0x576e85){VoicePrefixEvents[_0x994d('0x4')](_0x57294a+':'+_0x448df7['id'],_0x448df7);VoicePrefixEvents[_0x994d('0x4')](_0x57294a,_0x448df7);_0x576e85(null);};}for(var e in events){if(events[_0x994d('0x5')](e)){var event=events[e];VoicePrefix[_0x994d('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xfa77=['emit','hook','exports','events','setMaxListeners','save','update','remove'];(function(_0x4b97c3,_0x49e7e9){var _0x485045=function(_0x287c8a){while(--_0x287c8a){_0x4b97c3['push'](_0x4b97c3['shift']());}};_0x485045(++_0x49e7e9);}(_0xfa77,0x133));var _0x7fa7=function(_0x2d7a61,_0x256493){_0x2d7a61=_0x2d7a61-0x0;var _0x510928=_0xfa77[_0x2d7a61];return _0x510928;};'use strict';var EventEmitter=require(_0x7fa7('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7fa7('0x1')](0x0);var events={'afterCreate':_0x7fa7('0x2'),'afterUpdate':_0x7fa7('0x3'),'afterDestroy':_0x7fa7('0x4')};function emitEvent(_0x1308f9){return function(_0x2b01a5,_0x46e5e3,_0x2c1f85){VoicePrefixEvents[_0x7fa7('0x5')](_0x1308f9+':'+_0x2b01a5['id'],_0x2b01a5);VoicePrefixEvents['emit'](_0x1308f9,_0x2b01a5);_0x2c1f85(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x7fa7('0x6')](e,emitEvent(event));}}module[_0x7fa7('0x7')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index f1dab17..bfa95ad 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 _0xcf1b=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports','define','voice_prefixes'];(function(_0x5e844d,_0x1a2af2){var _0x7760f1=function(_0x7ae4ba){while(--_0x7ae4ba){_0x5e844d['push'](_0x5e844d['shift']());}};_0x7760f1(++_0x1a2af2);}(_0xcf1b,0xbd));var _0xbcf1=function(_0x5336fb,_0x4d7283){_0x5336fb=_0x5336fb-0x0;var _0x4328e9=_0xcf1b[_0x5336fb];return _0x4328e9;};'use strict';var _=require('lodash');var util=require(_0xbcf1('0x0'));var logger=require(_0xbcf1('0x1'))('api');var moment=require(_0xbcf1('0x2'));var BPromise=require(_0xbcf1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbcf1('0x4'));var config=require(_0xbcf1('0x5'));var attributes=require('./voicePrefix.attributes');module[_0xbcf1('0x6')]=function(_0x2ec7f0,_0x3ab15f){return _0x2ec7f0[_0xbcf1('0x7')]('VoicePrefix',attributes,{'tableName':_0xbcf1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x915b=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes'];(function(_0x4ca88f,_0xbd5b23){var _0x4bd853=function(_0xac771f){while(--_0xac771f){_0x4ca88f['push'](_0x4ca88f['shift']());}};_0x4bd853(++_0xbd5b23);}(_0x915b,0xfd));var _0xb915=function(_0x3a4eb0,_0x47488c){_0x3a4eb0=_0x3a4eb0-0x0;var _0x47335b=_0x915b[_0x3a4eb0];return _0x47335b;};'use strict';var _=require(_0xb915('0x0'));var util=require(_0xb915('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb915('0x2'));var BPromise=require('bluebird');var rp=require(_0xb915('0x3'));var fs=require('fs');var path=require(_0xb915('0x4'));var rimraf=require(_0xb915('0x5'));var config=require(_0xb915('0x6'));var attributes=require(_0xb915('0x7'));module['exports']=function(_0x456ac3,_0x144b4d){return _0x456ac3[_0xb915('0x8')](_0xb915('0x9'),attributes,{'tableName':_0xb915('0xa'),'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 cab8063..bca7a1d 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 _0x9d76=['error','code','message','info','VoicePrefix,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9d76,0x76));var _0x69d7=function(_0x33d353,_0x975f90){_0x33d353=_0x33d353-0x0;var _0x3b02ff=_0x9d76[_0x33d353];return _0x3b02ff;};'use strict';var _=require(_0x69d7('0x0'));var util=require('util');var moment=require(_0x69d7('0x1'));var BPromise=require(_0x69d7('0x2'));var rs=require(_0x69d7('0x3'));var fs=require('fs');var Redis=require(_0x69d7('0x4'));var db=require(_0x69d7('0x5'))['db'];var utils=require(_0x69d7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x69d7('0x7'));var jayson=require(_0x69d7('0x8'));var client=jayson[_0x69d7('0x9')][_0x69d7('0xa')]({'port':0x232a});config['redis']=_[_0x69d7('0xb')](config[_0x69d7('0xc')],{'host':_0x69d7('0xd'),'port':0x18eb});var socket=require(_0x69d7('0xe'))(new Redis(config[_0x69d7('0xc')]));require(_0x69d7('0xf'))[_0x69d7('0x10')](socket);function respondWithRpcPromise(_0x43b7d2,_0x514e07,_0x3d45b0){return new BPromise(function(_0x3061f3,_0x2617eb){return client[_0x69d7('0x11')](_0x43b7d2,_0x3d45b0)[_0x69d7('0x12')](function(_0x3b6bb9){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x514e07,_0x69d7('0x13'));logger[_0x69d7('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x514e07,_0x69d7('0x13'),JSON[_0x69d7('0x15')](_0x3b6bb9));if(_0x3b6bb9[_0x69d7('0x16')]){if(_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x17')]===0x1f4){logger[_0x69d7('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x514e07,_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);return _0x2617eb(_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x514e07,_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);return _0x3061f3(_0x3b6bb9[_0x69d7('0x16')][_0x69d7('0x18')]);}else{logger[_0x69d7('0x19')](_0x69d7('0x1a'),_0x514e07,_0x69d7('0x13'));_0x3061f3(_0x3b6bb9[_0x69d7('0x1b')][_0x69d7('0x18')]);}})['catch'](function(_0x208b66){logger[_0x69d7('0x16')](_0x69d7('0x1a'),_0x514e07,_0x208b66);_0x2617eb(_0x208b66);});});} \ No newline at end of file +var _0x1410=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x1410,0x130));var _0x0141=function(_0x763b64,_0x291bdf){_0x763b64=_0x763b64-0x0;var _0x1e6b5e=_0x1410[_0x763b64];return _0x1e6b5e;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});config[_0x0141('0xb')]=_[_0x0141('0xc')](config[_0x0141('0xb')],{'host':_0x0141('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0141('0xb')]));require(_0x0141('0xe'))[_0x0141('0xf')](socket);function respondWithRpcPromise(_0x3465f2,_0x1b6b66,_0x1798ae){return new BPromise(function(_0x3f5e8f,_0x5f368f){return client['request'](_0x3465f2,_0x1798ae)[_0x0141('0x10')](function(_0x3b7718){logger[_0x0141('0x11')](_0x0141('0x12'),_0x1b6b66,'request\x20sent');logger['debug'](_0x0141('0x13'),_0x1b6b66,_0x0141('0x14'),JSON['stringify'](_0x3b7718));if(_0x3b7718[_0x0141('0x15')]){if(_0x3b7718[_0x0141('0x15')][_0x0141('0x16')]===0x1f4){logger[_0x0141('0x15')](_0x0141('0x12'),_0x1b6b66,_0x3b7718['error'][_0x0141('0x17')]);return _0x5f368f(_0x3b7718['error'][_0x0141('0x17')]);}logger[_0x0141('0x15')](_0x0141('0x12'),_0x1b6b66,_0x3b7718[_0x0141('0x15')][_0x0141('0x17')]);return _0x3f5e8f(_0x3b7718[_0x0141('0x15')]['message']);}else{logger['info'](_0x0141('0x12'),_0x1b6b66,_0x0141('0x14'));_0x3f5e8f(_0x3b7718['result'][_0x0141('0x17')]);}})[_0x0141('0x18')](function(_0x8beed8){logger[_0x0141('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1b6b66,_0x8beed8);_0x5f368f(_0x8beed8);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 683cb4c..2144e20 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 _0x4ea3=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update','emit'];(function(_0x2a9f1a,_0x56bbe4){var _0x20ae83=function(_0x57ab52){while(--_0x57ab52){_0x2a9f1a['push'](_0x2a9f1a['shift']());}};_0x20ae83(++_0x56bbe4);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'use strict';var VoicePrefixEvents=require(_0x34ea('0x0'));var events=[_0x34ea('0x1'),_0x34ea('0x2'),_0x34ea('0x3')];function createListener(_0x588172,_0x374ec1){return function(_0x494b56){_0x374ec1[_0x34ea('0x4')](_0x588172,_0x494b56);};}function removeListener(_0x571f1b,_0x5e5a84){return function(){VoicePrefixEvents[_0x34ea('0x5')](_0x571f1b,_0x5e5a84);};}exports[_0x34ea('0x6')]=function(_0x962596){for(var _0x123d48=0x0,_0x40434e=events[_0x34ea('0x7')];_0x123d48<_0x40434e;_0x123d48++){var _0x22b09e=events[_0x123d48];var _0x5bec7c=createListener(_0x34ea('0x8')+_0x22b09e,_0x962596);VoicePrefixEvents['on'](_0x22b09e,_0x5bec7c);}}; \ No newline at end of file +var _0x652b=['length','voicePrefix:','./voicePrefix.events','save','remove','emit'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x652b,0x68));var _0xb652=function(_0x4c7b20,_0x361515){_0x4c7b20=_0x4c7b20-0x0;var _0x4872bd=_0x652b[_0x4c7b20];return _0x4872bd;};'use strict';var VoicePrefixEvents=require(_0xb652('0x0'));var events=[_0xb652('0x1'),_0xb652('0x2'),'update'];function createListener(_0x4070c6,_0x4a11b5){return function(_0x5b10a1){_0x4a11b5[_0xb652('0x3')](_0x4070c6,_0x5b10a1);};}function removeListener(_0x1dd99b,_0x1c8fb4){return function(){VoicePrefixEvents['removeListener'](_0x1dd99b,_0x1c8fb4);};}exports['register']=function(_0x43f467){for(var _0x491ce7=0x0,_0x58d168=events[_0xb652('0x4')];_0x491ce7<_0x58d168;_0x491ce7++){var _0x5c0245=events[_0x491ce7];var _0x2b82fd=createListener(_0xb652('0x5')+_0x5c0245,_0x43f467);VoicePrefixEvents['on'](_0x5c0245,_0x2b82fd);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 97a8d4f..54bf047 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(_0x2eec7d,_0xf27bd){var _0x372102=function(_0x546e6f){while(--_0x546e6f){_0x2eec7d['push'](_0x2eec7d['shift']());}};_0x372102(++_0xf27bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x3d61c6,_0x4571e6){var _0x47e0df=function(_0x25adfd){while(--_0x25adfd){_0x3d61c6['push'](_0x3d61c6['shift']());}};_0x47e0df(++_0x4571e6);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c5835,_0x20431a){_0x1c5835=_0x1c5835-0x0;var _0x558ebf=_0xb10b[_0x1c5835];return _0x558ebf;};'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 1218ffd..451b477 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 _0xa882=['roundrobin','INTEGER','yes','once','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','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','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','outbound','inbound','ringall','random','rrmemory','wrandom','rrordered','setDataValue','type','getDataValue','dialMethod','preview'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xa882,0x1c9));var _0x2a88=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0xa882[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0x2a88('0x0'));module[_0x2a88('0x1')]={'name':{'type':Sequelize[_0x2a88('0x2')],'allowNull':![],'unique':_0x2a88('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2a88('0x4')]('inbound',_0x2a88('0x5')),'allowNull':![],'defaultValue':_0x2a88('0x6')},'musiconhold':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x2a88('0x7'),'leastrecent','fewestcalls',_0x2a88('0x8'),_0x2a88('0x9'),'linear',_0x2a88('0xa'),_0x2a88('0xb')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1891c6){this[_0x2a88('0xc')]('strategy',_0x1891c6?_0x1891c6:_0x2a88('0x9'));},'get':function(){var _0x4cc0be=this['getDataValue'](_0x2a88('0xd'));var _0x44409a=this[_0x2a88('0xe')](_0x2a88('0xf'));var _0x24bfaf=this[_0x2a88('0xe')]('strategy');if(_0x4cc0be===_0x2a88('0x5')){if(_0x44409a===_0x2a88('0x10')){return null;}if(_0x44409a==='booked'&&![_0x2a88('0x9'),_0x2a88('0x11')]['includes'](_0x24bfaf)){this[_0x2a88('0xc')]('strategy',_0x2a88('0x9'));}}return _0x24bfaf;}},'servicelevel':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2a88('0x12')](0xb)},'timeout':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2a88('0x2')]},'weight':{'type':Sequelize[_0x2a88('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2a88('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x2a88('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2a88('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x2a88('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x2a88('0x13'),'no',_0x2a88('0x14')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2a88('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2a88('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2a88('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2a88('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x2a88('0x2')]},'queue_quantity1':{'type':Sequelize[_0x2a88('0x2')]},'queue_quantity2':{'type':Sequelize[_0x2a88('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x2a88('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x846695){this['setDataValue'](_0x2a88('0x15'),_0x846695?_0x846695['join'](','):[]);},'get':function(){return this[_0x2a88('0xe')]('periodic_announce')?this[_0x2a88('0xe')](_0x2a88('0x15'))[_0x2a88('0x16')](','):[];}},'joinempty':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':_0x2a88('0x13'),'set':function(_0x3b10e1){this[_0x2a88('0xc')](_0x2a88('0x17'),_0x3b10e1?_0x3b10e1[_0x2a88('0x18')](','):undefined);},'get':function(){return this[_0x2a88('0xe')](_0x2a88('0x17'))?this[_0x2a88('0xe')](_0x2a88('0x17'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x1b1d82){this[_0x2a88('0xc')]('leavewhenempty',_0x1b1d82?_0x1b1d82['join'](','):undefined);},'get':function(){return this[_0x2a88('0xe')](_0x2a88('0x19'))?this['getDataValue'](_0x2a88('0x19'))[_0x2a88('0x16')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x2a88('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2a88('0x2')]},'acw':{'type':Sequelize[_0x2a88('0x1a')],'defaultValue':0x0,'set':function(_0x22928b){this[_0x2a88('0xc')](_0x2a88('0x1b'),_0x22928b);if(_0x22928b){if(this[_0x2a88('0xe')](_0x2a88('0x1c'))<0x2){this[_0x2a88('0xc')](_0x2a88('0x1c'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x2a88('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2a88('0x1d')},'dialMethod':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x10'),_0x2a88('0x1e'),_0x2a88('0x1f'),_0x2a88('0x20'),_0x2a88('0x21')),'defaultValue':_0x2a88('0x1e'),'comment':_0x2a88('0x22')},'dialLimitChannel':{'type':Sequelize[_0x2a88('0x12')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2a88('0x23')},'dialLimitQueue':{'type':Sequelize[_0x2a88('0x12')](0x4)[_0x2a88('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2a88('0x25')},'dialPowerLevel':{'type':Sequelize[_0x2a88('0x26')](0x2)[_0x2a88('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x27'),_0x2a88('0x28')),'defaultValue':'dropRate','comment':_0x2a88('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2a88('0x26')](0x2)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2a88('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2a88('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2a88('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x2a88('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a88('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':_0x2a88('0x2d'),'comment':_0x2a88('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x2a88('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x2a88('0x2')],'comment':_0x2a88('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a88('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2a88('0x12')](0x5)[_0x2a88('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a88('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a88('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2a88('0x12')](0x5)[_0x2a88('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a88('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2a88('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2a88('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2a88('0x35')},'dialTimezone':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x2a88('0x36')},'dialPrefix':{'type':Sequelize[_0x2a88('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x37'),_0x2a88('0x38'),'onlyIfOpen'),'defaultValue':_0x2a88('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2a88('0x12')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2a88('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x2a88('0x12')](0x9)[_0x2a88('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2a88('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x2a88('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2a88('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x2a88('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2a88('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2a88('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2a88('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2a88('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2a88('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2a88('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2a88('0x12')](0x9)[_0x2a88('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2a88('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x2a88('0x12')](0x5)[_0x2a88('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2a88('0x40')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2a88('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2a88('0x4')](_0x2a88('0x42'),'ASC'),'defaultValue':_0x2a88('0x42')},'dialQueueProject2':{'type':Sequelize[_0x2a88('0x2')],'comment':_0x2a88('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x2a88('0x1a')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a88('0x43')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x2a88('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a88('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2a88('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a88('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a88('0x46')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a88('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2a88('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a88('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a88('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2a88('0x12')](0x5)[_0x2a88('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2a88('0x12')](0x3)[_0x2a88('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a88('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2a88('0x12')](0x5)[_0x2a88('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a88('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2a88('0x12')],'allowNull':!![],'comment':_0x2a88('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x2a88('0x1a')],'defaultValue':![],'comment':_0x2a88('0x4d'),'set':function(_0x1391fa){if(!_0x1391fa)this[_0x2a88('0xc')]('mandatoryDispositionPauseId',null);this[_0x2a88('0xc')](_0x2a88('0x4e'),_0x1391fa);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2a88('0x12')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x2a88('0x1a')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x2a88('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x01f5=['#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','#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)','#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','name','ENUM','inbound','STRING','default','leastrecent','fewestcalls','random','linear','wrandom','ringall','setDataValue','strategy','getDataValue','type','dialMethod','outbound','booked','rrmemory','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','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','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x01f5,0x15b));var _0x501f=function(_0x47e010,_0x311bae){_0x47e010=_0x47e010-0x0;var _0x4b005e=_0x01f5[_0x47e010];return _0x4b005e;};'use strict';var Sequelize=require(_0x501f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x501f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x501f('0x3')},'musiconhold':{'type':Sequelize[_0x501f('0x4')],'defaultValue':_0x501f('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x501f('0x2')]('rr','ringall',_0x501f('0x6'),_0x501f('0x7'),_0x501f('0x8'),'rrmemory',_0x501f('0x9'),_0x501f('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0x501f('0xb'),'set':function(_0x27c017){this[_0x501f('0xc')](_0x501f('0xd'),_0x27c017?_0x27c017:'rrmemory');},'get':function(){var _0xf86d14=this[_0x501f('0xe')](_0x501f('0xf'));var _0x23937b=this[_0x501f('0xe')](_0x501f('0x10'));var _0x363f4d=this['getDataValue'](_0x501f('0xd'));if(_0xf86d14===_0x501f('0x11')){if(_0x23937b==='preview'){return null;}if(_0x23937b===_0x501f('0x12')&&![_0x501f('0x13'),_0x501f('0x14')][_0x501f('0x15')](_0x363f4d)){this['setDataValue'](_0x501f('0xd'),_0x501f('0x13'));}}return _0x363f4d;}},'servicelevel':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x501f('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':_0x501f('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x501f('0x17'),'no',_0x501f('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x501f('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x501f('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x501f('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x501f('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x501f('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x501f('0x17'),'no'),'defaultValue':_0x501f('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x501f('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x501f('0x2')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x501f('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x501f('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x501f('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x501f('0x4')]},'queue_youarenext':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x501f('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x501f('0x4')]},'queue_quantity1':{'type':Sequelize[_0x501f('0x4')]},'queue_quantity2':{'type':Sequelize[_0x501f('0x4')]},'queue_periodic_announce':{'type':Sequelize[_0x501f('0x4')]},'queue_less_than':{'type':Sequelize[_0x501f('0x4')]},'periodic_announce':{'type':Sequelize[_0x501f('0x19')],'set':function(_0x24b0a8){this['setDataValue'](_0x501f('0x1a'),_0x24b0a8?_0x24b0a8[_0x501f('0x1b')](','):[]);},'get':function(){return this[_0x501f('0xe')](_0x501f('0x1a'))?this[_0x501f('0xe')]('periodic_announce')[_0x501f('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x501f('0x4')],'defaultValue':_0x501f('0x17'),'set':function(_0xeb116b){this[_0x501f('0xc')]('joinempty',_0xeb116b?_0xeb116b['join'](','):undefined);},'get':function(){return this['getDataValue'](_0x501f('0x1d'))?this[_0x501f('0xe')](_0x501f('0x1d'))[_0x501f('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x501f('0x4')],'defaultValue':'no','set':function(_0x5d1388){this[_0x501f('0xc')](_0x501f('0x1e'),_0x5d1388?_0x5d1388[_0x501f('0x1b')](','):undefined);},'get':function(){return this[_0x501f('0xe')](_0x501f('0x1e'))?this[_0x501f('0xe')]('leavewhenempty')[_0x501f('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x501f('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x501f('0x4')]},'description':{'type':Sequelize[_0x501f('0x4')]},'acw':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':0x0,'set':function(_0x3595a8){this[_0x501f('0xc')]('acw',_0x3595a8);if(_0x3595a8){if(this[_0x501f('0xe')](_0x501f('0x20'))<0x2){this[_0x501f('0xc')](_0x501f('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x501f('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':0x0,'comment':_0x501f('0x21')},'dialMethod':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x22'),_0x501f('0x23'),_0x501f('0x24'),_0x501f('0x25'),_0x501f('0x12')),'defaultValue':_0x501f('0x23'),'comment':_0x501f('0x26')},'dialLimitChannel':{'type':Sequelize[_0x501f('0x16')](0x4)[_0x501f('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x501f('0x28')},'dialLimitQueue':{'type':Sequelize[_0x501f('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x501f('0x29')},'dialPowerLevel':{'type':Sequelize[_0x501f('0x2a')](0x2)[_0x501f('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x2b'),_0x501f('0x2c')),'defaultValue':_0x501f('0x2c'),'comment':_0x501f('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x501f('0x2a')](0x2)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x501f('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x501f('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x501f('0x4')],'defaultValue':_0x501f('0x2f'),'comment':_0x501f('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x31')},'dialQueueProject':{'type':Sequelize[_0x501f('0x4')],'comment':_0x501f('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x501f('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x35')},'dialBusyRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x501f('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x3,'comment':_0x501f('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)[_0x501f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x501f('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x501f('0x39')},'dialTimezone':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x501f('0x4')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x501f('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x501f('0x3a'),'never','onlyIfOpen'),'defaultValue':_0x501f('0x3a')},'dialAMDActive':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':0x0,'comment':_0x501f('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x501f('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x501f('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x501f('0x16')](0x9)[_0x501f('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x501f('0x16')](0x9)[_0x501f('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x501f('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x501f('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x501f('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x501f('0x16')](0x9)[_0x501f('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x501f('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x501f('0x16')](0x9)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x501f('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x501f('0x16')](0x5)[_0x501f('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x501f('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x501f('0x16')](0x9)[_0x501f('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x501f('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x501f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':0x0,'comment':_0x501f('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x501f('0x2')](_0x501f('0x43'),_0x501f('0x44')),'defaultValue':_0x501f('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x501f('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x501f('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)[_0x501f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x501f('0x46')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)[_0x501f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x501f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x501f('0x49')},'dialMachineMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x501f('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x501f('0x16')](0x5)[_0x501f('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x501f('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x501f('0x16')],'allowNull':!![],'comment':_0x501f('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':![],'comment':_0x501f('0x4e'),'set':function(_0x1cec10){if(!_0x1cec10)this[_0x501f('0xc')](_0x501f('0x4f'),null);this['setDataValue']('mandatoryDisposition',_0x1cec10);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x501f('0x16')](0x3)[_0x501f('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x501f('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x501f('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x501f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 00f6c77..a443110 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 _0x8ef6=['select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','into','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','VoiceQueues','inbound','outbound','ignore','map','value','find','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','getOptions','include','query','findAll','rows','catch','show','model','keys','intersection','attributes','fields','length','merge','options','create','body','user','get','role','QueueCampaigns','UserProfileSection','userProfileId','clone','includeAll','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getHoppers','findOne','CmHopper','filters','hasOwnProperty','order','sort','where','pick','filter','getHopperHistories','CmHopperHistory','nolimit','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids'];(function(_0x3d716e,_0x578aff){var _0x4e5dd4=function(_0x589a17){while(--_0x589a17){_0x3d716e['push'](_0x3d716e['shift']());}};_0x4e5dd4(++_0x578aff);}(_0x8ef6,0xf2));var _0x68ef=function(_0xd8f662,_0x146350){_0xd8f662=_0xd8f662-0x0;var _0x45c1ac=_0x8ef6[_0xd8f662];return _0x45c1ac;};'use strict';var moment=require(_0x68ef('0x0'));var BPromise=require(_0x68ef('0x1'));var util=require(_0x68ef('0x2'));var _=require(_0x68ef('0x3'));var squel=require(_0x68ef('0x4'));var Redis=require(_0x68ef('0x5'));var qs=require(_0x68ef('0x6'));var logger=require('../../config/logger')(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var db=require(_0x68ef('0x9'))['db'];config[_0x68ef('0xa')]=_['defaults'](config['redis'],{'host':_0x68ef('0xb'),'port':0x18eb});var socket=require(_0x68ef('0xc'))(new Redis(config[_0x68ef('0xa')]));require('./voiceQueue.socket')[_0x68ef('0xd')](socket);function respondWithStatusCode(_0x31007e,_0x1bee73){_0x1bee73=_0x1bee73||0xcc;return function(_0x22ae26){if(_0x22ae26){return _0x31007e[_0x68ef('0xe')](_0x1bee73);}return _0x31007e[_0x68ef('0xf')](_0x1bee73)[_0x68ef('0x10')]();};}function respondWithResult(_0x23da00,_0x1f6747){_0x1f6747=_0x1f6747||0xc8;return function(_0x255c85){if(_0x255c85){return _0x23da00[_0x68ef('0xf')](_0x1f6747)[_0x68ef('0x11')](_0x255c85);}};}function respondWithFilteredResult(_0x582a79,_0x1aa045){return function(_0x46356f){if(_0x46356f){var _0x1e117a=typeof _0x1aa045[_0x68ef('0x12')]===_0x68ef('0x13')&&typeof _0x1aa045[_0x68ef('0x14')]==='undefined';var _0x3b48dd=_0x46356f[_0x68ef('0x15')];var _0x2657c5=_0x1e117a?0x0:_0x1aa045['offset'];var _0x22fe96=_0x1e117a?_0x46356f[_0x68ef('0x15')]:_0x1aa045[_0x68ef('0x12')]+_0x1aa045['limit'];var _0x35493d;if(_0x22fe96>=_0x3b48dd){_0x22fe96=_0x3b48dd;_0x35493d=0xc8;}else{_0x35493d=0xce;}_0x582a79[_0x68ef('0xf')](_0x35493d);return _0x582a79[_0x68ef('0x16')](_0x68ef('0x17'),_0x2657c5+'-'+_0x22fe96+'/'+_0x3b48dd)['json'](_0x46356f);}return null;};}function saveUpdates(_0x2ada1c){return function(_0x54139e){if(_0x54139e){return _0x54139e['update'](_0x2ada1c)[_0x68ef('0x18')](function(_0x404870){return _0x404870;});}return null;};}function removeEntity(_0x4ade0d){return function(_0x527870){if(_0x527870){return _0x527870[_0x68ef('0x19')]()[_0x68ef('0x18')](function(){var _0x318514=_0x527870['get']({'plain':!![]});var _0x1dc49c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b'),'ignore':![]},{'name':'QueueCampaigns','value':_0x68ef('0x1c'),'ignore':![]}];var _0x3be4c0=_(_0x1dc49c)['filter'](_0x68ef('0x1d'))[_0x68ef('0x1e')](_0x68ef('0x1f'))['value']();if(_['includes'](_0x3be4c0,_0x318514['type'])){return;}var _0x26018d=_[_0x68ef('0x20')](_0x1dc49c,[_0x68ef('0x1f'),_0x318514[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x23')][_0x68ef('0x19')]({'where':{'type':_0x26018d,'resourceId':_0x318514['id']}})[_0x68ef('0x18')](function(){return _0x527870;});})[_0x68ef('0x18')](function(){_0x4ade0d[_0x68ef('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x178460){return function(_0x57f9ee){if(!_0x57f9ee){_0x178460['sendStatus'](0x194);}return _0x57f9ee;};}function handleError(_0x55d8b0,_0x1a7ce1){_0x1a7ce1=_0x1a7ce1||0x1f4;return function(_0x268f32){logger[_0x68ef('0x24')](_0x268f32[_0x68ef('0x25')]);if(_0x268f32['name']){delete _0x268f32['name'];}_0x55d8b0[_0x68ef('0xf')](_0x1a7ce1)[_0x68ef('0x26')](_0x268f32);};}exports[_0x68ef('0x27')]=function(_0x263b30,_0x22ef25){var _0x201884={};var _0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x28')][_0x68ef('0x29')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x21')]['key']};});_0x201884=qs[_0x68ef('0x2a')](_0x4579cb,_0x263b30);var _0x17588a={'where':_0x201884['where']};return db['VoiceQueue'][_0x68ef('0x15')](_0x17588a)[_0x68ef('0x18')](function(_0x4b8fc8){_0x26288a[_0x68ef('0x15')]=_0x4b8fc8;_0x201884[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x263b30[_0x68ef('0x2c')]);return db['VoiceQueue'][_0x68ef('0x2d')](_0x201884);})[_0x68ef('0x18')](function(_0x5f137b){_0x26288a[_0x68ef('0x2e')]=_0x5f137b;return _0x26288a;})['then'](respondWithFilteredResult(_0x22ef25,_0x201884))[_0x68ef('0x2f')](handleError(_0x22ef25,null));};exports[_0x68ef('0x30')]=function(_0x4973c2,_0x24c2c9){var _0x4a0763={'raw':![],'where':{'id':_0x4973c2['params']['id']}},_0x38c2f8={};_0x38c2f8[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x28')]['rawAttributes']);_0x38c2f8[_0x68ef('0x2c')]=_['keys'](_0x4973c2[_0x68ef('0x2c')]);_0x38c2f8['filters']=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],_0x38c2f8[_0x68ef('0x2c')]);_0x4a0763[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x38c2f8[_0x68ef('0x31')],qs['fields'](_0x4973c2[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a0763[_0x68ef('0x34')]=_0x4a0763['attributes'][_0x68ef('0x36')]?_0x4a0763[_0x68ef('0x34')]:_0x38c2f8[_0x68ef('0x31')];if(_0x4973c2['query']['includeAll']){_0x4a0763[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4a0763=_[_0x68ef('0x37')]({},_0x4a0763,_0x4973c2[_0x68ef('0x38')]);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4a0763)[_0x68ef('0x18')](handleEntityNotFound(_0x24c2c9,null))[_0x68ef('0x18')](respondWithResult(_0x24c2c9,null))['catch'](handleError(_0x24c2c9,null));};exports[_0x68ef('0x39')]=function(_0xd7f9ca,_0x2f6ee0){return db[_0x68ef('0x28')]['create'](_0xd7f9ca[_0x68ef('0x3a')],{})[_0x68ef('0x18')](function(_0xcf595d){var _0x410c10=_0xd7f9ca[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0x410c10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x410c10[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0xf5010c=_0xcf595d[_0x68ef('0x3c')]({'plain':!![]});var _0x449f3c=[{'name':_0x68ef('0x1a'),'value':_0x68ef('0x1b')},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x531096=_[_0x68ef('0x20')](_0x449f3c,[_0x68ef('0x1f'),_0xf5010c[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x531096,'userProfileId':_0x410c10[_0x68ef('0x40')]},'raw':!![]})['then'](function(_0xb3d396){if(_0xb3d396&&_0xb3d396['autoAssociation']===0x0){return db[_0x68ef('0x23')][_0x68ef('0x39')]({'name':_0xf5010c[_0x68ef('0x22')],'resourceId':_0xf5010c['id'],'type':_0xb3d396[_0x68ef('0x22')],'sectionId':_0xb3d396['id']},{})['then'](function(){return _0xcf595d;});}else{return _0xcf595d;}})[_0x68ef('0x2f')](function(_0x5a8231){logger[_0x68ef('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a8231);throw _0x5a8231;});}return _0xcf595d;})[_0x68ef('0x18')](respondWithResult(_0x2f6ee0,0xc9))[_0x68ef('0x2f')](handleError(_0x2f6ee0,null));};exports[_0x68ef('0x41')]=function(_0x5c4a66,_0x59b148){var _0x4044d5={'where':{'id':_0x5c4a66['params']['id']}},_0x399055={};_0x399055['model']=_['keys'](db[_0x68ef('0x28')][_0x68ef('0x29')]);_0x4044d5[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x399055[_0x68ef('0x31')],qs['fields'](_0x5c4a66['query'][_0x68ef('0x35')]));_0x4044d5[_0x68ef('0x34')]=_0x4044d5[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4044d5['attributes']:_0x399055[_0x68ef('0x31')];if(_0x5c4a66[_0x68ef('0x2c')][_0x68ef('0x42')]){_0x4044d5[_0x68ef('0x2b')]=[{'all':!![]}];}_0x4044d5=_['merge']({},_0x4044d5,_0x5c4a66['options']);return db[_0x68ef('0x28')][_0x68ef('0x20')](_0x4044d5)['then'](handleEntityNotFound(_0x59b148,null))[_0x68ef('0x18')](function(_0x12fff3){if(_0x12fff3){var _0x3a82a0=_0x12fff3[_0x68ef('0x3c')]({'plain':!![]});_0x3a82a0=qs[_0x68ef('0x43')](_0x3a82a0,['id','createdAt',_0x68ef('0x44')]);_0x5c4a66[_0x68ef('0x3a')]=_[_0x68ef('0x43')](_0x5c4a66['body'],['id',_0x68ef('0x45'),_0x68ef('0x44')]);return db[_0x68ef('0x28')]['create'](_[_0x68ef('0x37')](_0x3a82a0,_0x5c4a66['body']),{'include':_0x5c4a66['query'][_0x68ef('0x42')]?[{'all':!![]}]:undefined})['then'](function(_0x39dd21){var _0xb33afd=_0x5c4a66[_0x68ef('0x3b')][_0x68ef('0x3c')]({'plain':!![]});if(!_0xb33afd)throw new Error(_0x68ef('0x46'));if(_0xb33afd[_0x68ef('0x3d')]===_0x68ef('0x3b')){var _0x1d1d6e=_0x39dd21[_0x68ef('0x3c')]({'plain':!![]});var _0x247915=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x68ef('0x3e'),'value':_0x68ef('0x1c')}];var _0x317b79=_[_0x68ef('0x20')](_0x247915,[_0x68ef('0x1f'),_0x1d1d6e[_0x68ef('0x21')]])[_0x68ef('0x22')];return db[_0x68ef('0x3f')][_0x68ef('0x20')]({'where':{'name':_0x317b79,'userProfileId':_0xb33afd['userProfileId']},'raw':!![]})['then'](function(_0x42a4b2){if(_0x42a4b2&&_0x42a4b2['autoAssociation']===0x0){return db[_0x68ef('0x23')]['create']({'name':_0x1d1d6e[_0x68ef('0x22')],'resourceId':_0x1d1d6e['id'],'type':_0x42a4b2[_0x68ef('0x22')],'sectionId':_0x42a4b2['id']},{})['then'](function(){return _0x39dd21;});}else{return _0x39dd21;}})[_0x68ef('0x2f')](function(_0x4e097e){logger[_0x68ef('0x24')](_0x68ef('0x47'),_0x4e097e);throw _0x4e097e;});}return _0x39dd21;});}})[_0x68ef('0x18')](respondWithResult(_0x59b148,0xc9))[_0x68ef('0x2f')](handleError(_0x59b148,null));};exports[_0x68ef('0x48')]=function(_0x3d81c8,_0x5c347c){if(_0x3d81c8[_0x68ef('0x3a')]['id']){delete _0x3d81c8[_0x68ef('0x3a')]['id'];}return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3d81c8[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5c347c,null))['then'](saveUpdates(_0x3d81c8[_0x68ef('0x3a')],null))[_0x68ef('0x18')](respondWithResult(_0x5c347c,null))['catch'](handleError(_0x5c347c,null));};exports[_0x68ef('0x19')]=function(_0x114d9f,_0x3d3087){return db['VoiceQueue'][_0x68ef('0x20')]({'where':{'id':_0x114d9f['params']['id']}})['then'](handleEntityNotFound(_0x3d3087,null))[_0x68ef('0x18')](removeEntity(_0x3d3087,null))['catch'](handleError(_0x3d3087,null));};exports[_0x68ef('0x4a')]=function(_0x47c1d5,_0x100a20){var _0x9e8554={'raw':![],'where':{}};var _0x304405={};var _0x3fbd39={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x47c1d5['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x100a20,null))['then'](function(_0x2cbd99){if(_0x2cbd99){_0x304405['model']=_[_0x68ef('0x32')](db[_0x68ef('0x4c')][_0x68ef('0x29')]);_0x304405[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x47c1d5[_0x68ef('0x2c')]);_0x304405[_0x68ef('0x4d')]=_['intersection'](_0x304405[_0x68ef('0x31')],_0x304405[_0x68ef('0x2c')]);_0x9e8554[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x304405[_0x68ef('0x31')],qs['fields'](_0x47c1d5[_0x68ef('0x2c')]['fields']));_0x9e8554[_0x68ef('0x34')]=_0x9e8554['attributes']['length']?_0x9e8554[_0x68ef('0x34')]:_0x304405[_0x68ef('0x31')];if(!_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x4e')]('nolimit')){_0x9e8554[_0x68ef('0x14')]=qs['limit'](_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x9e8554[_0x68ef('0x12')]=qs['offset'](_0x47c1d5['query'][_0x68ef('0x12')]);}_0x9e8554[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x47c1d5[_0x68ef('0x2c')]['sort']);_0x9e8554[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x47c1d5[_0x68ef('0x2c')],_0x304405['filters']));_0x9e8554[_0x68ef('0x51')]['VoiceQueueId']=_0x2cbd99['id'];if(_0x47c1d5[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x9e8554[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x9e8554[_0x68ef('0x51')],{'$or':_['map'](_0x9e8554[_0x68ef('0x34')],function(_0x2caed7){var _0x147695={};_0x147695[_0x2caed7]={'$like':'%'+_0x47c1d5['query'][_0x68ef('0x53')]+'%'};return _0x147695;})});}_0x9e8554=_['merge']({},_0x9e8554,_0x47c1d5[_0x68ef('0x38')]);return db['CmHopper']['count']({'where':_0x9e8554[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x38c117){_0x3fbd39[_0x68ef('0x15')]=_0x38c117;if(_0x47c1d5['query'][_0x68ef('0x42')]){_0x9e8554[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x4c')]['findAll'](_0x9e8554);})[_0x68ef('0x18')](function(_0x2db826){_0x3fbd39[_0x68ef('0x2e')]=_0x2db826;return _0x3fbd39;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x100a20,_0x9e8554))[_0x68ef('0x2f')](handleError(_0x100a20,null));};exports[_0x68ef('0x54')]=function(_0x139557,_0xfe72dc){var _0x156ce3={'raw':!![],'where':{}};var _0x11feff={};var _0x454999={'count':0x0,'rows':[]};return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x139557[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0xfe72dc,null))['then'](function(_0x513c69){if(_0x513c69){_0x11feff[_0x68ef('0x31')]=_['keys'](db[_0x68ef('0x55')][_0x68ef('0x29')]);_0x11feff['query']=_['keys'](_0x139557[_0x68ef('0x2c')]);_0x11feff['filters']=_[_0x68ef('0x33')](_0x11feff['model'],_0x11feff[_0x68ef('0x2c')]);_0x156ce3['attributes']=_[_0x68ef('0x33')](_0x11feff[_0x68ef('0x31')],qs['fields'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x156ce3[_0x68ef('0x34')]=_0x156ce3[_0x68ef('0x34')]['length']?_0x156ce3[_0x68ef('0x34')]:_0x11feff[_0x68ef('0x31')];if(!_0x139557['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x156ce3[_0x68ef('0x14')]=qs['limit'](_0x139557[_0x68ef('0x2c')]['limit']);_0x156ce3[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x139557['query']['offset']);}_0x156ce3['order']=qs['sort'](_0x139557[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x156ce3[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x139557[_0x68ef('0x2c')],_0x11feff[_0x68ef('0x4d')]));_0x156ce3[_0x68ef('0x51')][_0x68ef('0x57')]=_0x513c69['id'];if(_0x139557[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x156ce3[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x156ce3['where'],{'$or':_[_0x68ef('0x1e')](_0x156ce3['attributes'],function(_0x791181){var _0x5b39a8={};_0x5b39a8[_0x791181]={'$like':'%'+_0x139557['query'][_0x68ef('0x53')]+'%'};return _0x5b39a8;})});}_0x156ce3=_[_0x68ef('0x37')]({},_0x156ce3,_0x139557[_0x68ef('0x38')]);return db[_0x68ef('0x55')]['count']({'where':_0x156ce3['where']})[_0x68ef('0x18')](function(_0x308997){_0x454999[_0x68ef('0x15')]=_0x308997;if(_0x139557['query'][_0x68ef('0x42')]){_0x156ce3[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x55')][_0x68ef('0x2d')](_0x156ce3);})['then'](function(_0x214e89){_0x454999[_0x68ef('0x2e')]=_0x214e89;return _0x454999;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0xfe72dc,_0x156ce3))[_0x68ef('0x2f')](handleError(_0xfe72dc,null));};exports[_0x68ef('0x58')]=function(_0x346049,_0x489ca6){var _0x2a72e8={'raw':!![],'where':{}};var _0x49844f={};var _0xea97f4={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x346049[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x489ca6,null))[_0x68ef('0x18')](function(_0x4c47ab){if(_0x4c47ab){_0x49844f[_0x68ef('0x31')]=_[_0x68ef('0x32')](db['CmHopperFinal']['rawAttributes']);_0x49844f[_0x68ef('0x2c')]=_['keys'](_0x346049[_0x68ef('0x2c')]);_0x49844f['filters']=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],_0x49844f[_0x68ef('0x2c')]);_0x2a72e8[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x49844f[_0x68ef('0x31')],qs['fields'](_0x346049[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x2a72e8[_0x68ef('0x34')]=_0x2a72e8[_0x68ef('0x34')][_0x68ef('0x36')]?_0x2a72e8[_0x68ef('0x34')]:_0x49844f[_0x68ef('0x31')];if(!_0x346049['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x2a72e8[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x346049[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x2a72e8[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x346049[_0x68ef('0x2c')]['offset']);}_0x2a72e8[_0x68ef('0x4f')]=qs['sort'](_0x346049['query']['sort']);_0x2a72e8[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x346049['query'],_0x49844f['filters']));_0x2a72e8['where'][_0x68ef('0x57')]=_0x4c47ab['id'];if(_0x346049[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x2a72e8[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x2a72e8[_0x68ef('0x51')],{'$or':_['map'](_0x2a72e8[_0x68ef('0x34')],function(_0x2c7f18){var _0x1bdacc={};_0x1bdacc[_0x2c7f18]={'$like':'%'+_0x346049[_0x68ef('0x2c')]['filter']+'%'};return _0x1bdacc;})});}_0x2a72e8=_[_0x68ef('0x37')]({},_0x2a72e8,_0x346049[_0x68ef('0x38')]);return db[_0x68ef('0x59')][_0x68ef('0x15')]({'where':_0x2a72e8[_0x68ef('0x51')]})[_0x68ef('0x18')](function(_0x6ca6f4){_0xea97f4[_0x68ef('0x15')]=_0x6ca6f4;if(_0x346049['query'][_0x68ef('0x42')]){_0x2a72e8[_0x68ef('0x2b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x68ef('0x2d')](_0x2a72e8);})[_0x68ef('0x18')](function(_0x1b9028){_0xea97f4[_0x68ef('0x2e')]=_0x1b9028;return _0xea97f4;});}})[_0x68ef('0x18')](respondWithFilteredResult(_0x489ca6,_0x2a72e8))[_0x68ef('0x2f')](handleError(_0x489ca6,null));};exports[_0x68ef('0x5a')]=function(_0x2e626c,_0x3b1781){var _0x159169={'raw':!![],'where':{}};var _0x29522c={};var _0x37bf89={'count':0x0,'rows':[]};return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x2e626c[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3b1781,null))[_0x68ef('0x18')](function(_0x24af15){if(_0x24af15){_0x29522c['model']=_[_0x68ef('0x32')](db[_0x68ef('0x5b')][_0x68ef('0x29')]);_0x29522c[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x2e626c['query']);_0x29522c[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x29522c['model'],_0x29522c[_0x68ef('0x2c')]);_0x159169['attributes']=_['intersection'](_0x29522c['model'],qs['fields'](_0x2e626c[_0x68ef('0x2c')]['fields']));_0x159169[_0x68ef('0x34')]=_0x159169['attributes']['length']?_0x159169['attributes']:_0x29522c[_0x68ef('0x31')];if(!_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x159169[_0x68ef('0x14')]=qs['limit'](_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x159169[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x2e626c['query'][_0x68ef('0x12')]);}_0x159169['order']=qs['sort'](_0x2e626c['query'][_0x68ef('0x50')]);_0x159169[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x2e626c[_0x68ef('0x2c')],_0x29522c[_0x68ef('0x4d')]));_0x159169[_0x68ef('0x51')][_0x68ef('0x57')]=_0x24af15['id'];if(_0x2e626c[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x159169[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x159169['where'],{'$or':_['map'](_0x159169['attributes'],function(_0x25e698){var _0x1cad59={};_0x1cad59[_0x25e698]={'$like':'%'+_0x2e626c[_0x68ef('0x2c')]['filter']+'%'};return _0x1cad59;})});}_0x159169=_[_0x68ef('0x37')]({},_0x159169,_0x2e626c['options']);return db[_0x68ef('0x5b')][_0x68ef('0x15')]({'where':_0x159169[_0x68ef('0x51')]})['then'](function(_0x304260){_0x37bf89[_0x68ef('0x15')]=_0x304260;if(_0x2e626c['query'][_0x68ef('0x42')]){_0x159169[_0x68ef('0x2b')]=[{'all':!![]}];}return db[_0x68ef('0x5b')][_0x68ef('0x2d')](_0x159169);})[_0x68ef('0x18')](function(_0x23126a){_0x37bf89[_0x68ef('0x2e')]=_0x23126a;return _0x37bf89;});}})['then'](respondWithFilteredResult(_0x3b1781,_0x159169))[_0x68ef('0x2f')](handleError(_0x3b1781,null));};exports[_0x68ef('0x5c')]=function(_0x5a262d,_0x28cad4){var _0x424e46={};var _0x46c87e={};var _0x20a131;var _0x1b8250;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5a262d['params']['id']}})['then'](handleEntityNotFound(_0x28cad4,null))[_0x68ef('0x18')](function(_0x4dcf9e){if(_0x4dcf9e){_0x20a131=_0x4dcf9e;_0x46c87e[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x5d')][_0x68ef('0x29')]);_0x46c87e[_0x68ef('0x2c')]=_['keys'](_0x5a262d[_0x68ef('0x2c')]);_0x46c87e[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],_0x46c87e['query']);_0x424e46['attributes']=_[_0x68ef('0x33')](_0x46c87e[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x424e46[_0x68ef('0x34')]=_0x424e46[_0x68ef('0x34')][_0x68ef('0x36')]?_0x424e46[_0x68ef('0x34')]:_0x46c87e[_0x68ef('0x31')];_0x424e46[_0x68ef('0x4f')]=qs['sort'](_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x424e46[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x5a262d[_0x68ef('0x2c')],_0x46c87e[_0x68ef('0x4d')]));if(_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x424e46[_0x68ef('0x51')]=_['merge'](_0x424e46['where'],{'$or':_[_0x68ef('0x1e')](_0x424e46[_0x68ef('0x34')],function(_0x3ef9e2){var _0x12ef69={};_0x12ef69[_0x3ef9e2]={'$like':'%'+_0x5a262d[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0x12ef69;})});}_0x424e46=_[_0x68ef('0x37')]({},_0x424e46,_0x5a262d['options']);return _0x20a131[_0x68ef('0x5c')](_0x424e46);}})[_0x68ef('0x18')](function(_0x11c717){if(_0x11c717){_0x1b8250=_0x11c717[_0x68ef('0x36')];if(!_0x5a262d['query'][_0x68ef('0x4e')]('nolimit')){_0x424e46[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5a262d[_0x68ef('0x2c')]['limit']);_0x424e46['offset']=qs[_0x68ef('0x12')](_0x5a262d['query'][_0x68ef('0x12')]);}return _0x20a131['getTeams'](_0x424e46);}})[_0x68ef('0x18')](function(_0x426274){if(_0x426274){return _0x426274?{'count':_0x1b8250,'rows':_0x426274}:null;}})['then'](respondWithResult(_0x28cad4,null))['catch'](handleError(_0x28cad4,null));};exports[_0x68ef('0x5e')]=function(_0x1d429a,_0x4d96a9){var _0xf9f2c4=_0x1d429a[_0x68ef('0x3a')][_0x68ef('0x5f')];var _0x4ae311=_['map'](_0xf9f2c4,'id');return db[_0x68ef('0x5d')]['findAll']({'where':{'id':_0x4ae311},'attributes':['id'],'include':[{'model':db[_0x68ef('0x60')],'as':_0x68ef('0x61'),'attributes':['id',_0x68ef('0x22'),_0x68ef('0x62'),_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]}]})['then'](function(_0x48f3f6){if(_0x48f3f6){var _0x453f91=_[_0x68ef('0x65')](_0x48f3f6,function(_0x8eb711){var _0x39ab6a=_0x8eb711[_0x68ef('0x3c')]({'plain':!![]});_0x39ab6a['Agents'][_0x68ef('0x66')](function(_0x428fd5){_0x428fd5[_0x68ef('0x67')]=_[_0x68ef('0x20')](_0xf9f2c4,{'id':_0x39ab6a['id']})[_0x68ef('0x67')];});return _0x39ab6a[_0x68ef('0x61')];});return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x1d429a['params']['id']}})[_0x68ef('0x18')](function(_0x261ce6){return db[_0x68ef('0x68')][_0x68ef('0x69')](function(_0x2138cd){return _0x261ce6[_0x68ef('0x5e')](_0x4ae311,{'transaction':_0x2138cd})['then'](function(){return BPromise[_0x68ef('0x6a')](_0xf9f2c4,function(_0x13fae2){return db[_0x68ef('0x6b')][_0x68ef('0x6c')]({'TeamId':_0x13fae2['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id'],'penalty':_0x13fae2['penalty']},{'transaction':_0x2138cd});});})[_0x68ef('0x18')](function(){return BPromise[_0x68ef('0x6a')](_0x453f91,function(_0x5d156e){return db['UserVoiceQueue'][_0x68ef('0x6d')]({'where':{'UserId':_0x5d156e['id'],'VoiceQueueId':_0x1d429a[_0x68ef('0x49')]['id']},'defaults':{'penalty':_0x5d156e[_0x68ef('0x67')]},'transaction':_0x2138cd});});})['then'](function(){return BPromise['each'](_[_0x68ef('0x53')](_0x453f91,{'online':!![]}),function(_0x10a3f9){return db[_0x68ef('0x6e')][_0x68ef('0x6c')]({'membername':_0x10a3f9[_0x68ef('0x22')],'UserId':_0x10a3f9['id'],'queue_name':_0x261ce6[_0x68ef('0x22')],'VoiceQueueId':_0x261ce6['id'],'interface':_[_0x68ef('0x6f')](_0x10a3f9[_0x68ef('0x64')])?util[_0x68ef('0x70')](_0x68ef('0x71'),_0x10a3f9[_0x68ef('0x22')]):_0x10a3f9[_0x68ef('0x64')],'paused':_0x10a3f9[_0x68ef('0x63')]||![],'penalty':_0x10a3f9[_0x68ef('0x67')]},{'transaction':_0x2138cd});});})['then'](function(){_0x453f91['forEach'](function(_0x503219){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':_0x503219['id'],'VoiceQueueId':_0x261ce6['id']});});});});});}})[_0x68ef('0x18')](respondWithStatusCode(_0x4d96a9,null))['catch'](handleError(_0x4d96a9,null));};exports[_0x68ef('0x74')]=function(_0x3713e0,_0x5af5d0){return db['Team'][_0x68ef('0x2d')]({'where':{'id':_0x3713e0[_0x68ef('0x2c')][_0x68ef('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x68ef('0x61'),'attributes':['id'],'raw':!![]}]})[_0x68ef('0x18')](handleEntityNotFound(_0x5af5d0,null))[_0x68ef('0x18')](function(_0x48959f){var _0x1bb11f=_['map'](_0x48959f,'id');var _0x211d51=[];var _0x3e37e3=[];var _0x5168cd=squel[_0x68ef('0x76')]();_0x5168cd[_0x68ef('0x77')](_0x68ef('0x78'))[_0x68ef('0x79')](_0x68ef('0x7a'),'tq')[_0x68ef('0x7b')](_0x68ef('0x7c'),'ut',_0x68ef('0x7d'))[_0x68ef('0x51')]('VoiceQueueId\x20=\x20?',_0x3713e0[_0x68ef('0x49')]['id']);for(var _0x121a0f=0x0;_0x121a0f<_0x48959f[_0x68ef('0x36')];_0x121a0f+=0x1){let _0x465198=_0x48959f[_0x121a0f];for(var _0x3e3775=0x0;_0x3e3775<_0x465198[_0x68ef('0x61')][_0x68ef('0x36')];_0x3e3775+=0x1){let _0x4906d2=_0x465198['Agents'][_0x3e3775];var _0x1e8577=_0x5168cd['clone']();_0x1e8577[_0x68ef('0x51')](_0x68ef('0x7e'),_0x4906d2['id']);_0x3e37e3[_0x68ef('0x7f')](db[_0x68ef('0x68')]['query'](_0x1e8577[_0x68ef('0x80')](),{'type':db[_0x68ef('0x68')][_0x68ef('0x81')]['SELECT']})[_0x68ef('0x18')](function(_0xe82f3a){if(_0xe82f3a['length']===0x1){return _0x4906d2['id'];}else{var _0x3c3933=_[_0x68ef('0x82')](_['map'](_0xe82f3a,'TeamId'),function(_0x522ef7){return _[_0x68ef('0x83')](_0x1bb11f,_0x522ef7);});if(_0x3c3933){return _0x4906d2['id'];}}}));}}return BPromise[_0x68ef('0x84')](_0x3e37e3)[_0x68ef('0x18')](function(_0x3e92e0){_0x211d51=_(_0x211d51)[_0x68ef('0x85')](_0x3e92e0)[_0x68ef('0x86')]()[_0x68ef('0x1f')]();return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x3713e0['params']['id']}})[_0x68ef('0x18')](function(_0x62a830){return db['sequelize'][_0x68ef('0x69')](function(_0x2374fa){return _0x62a830[_0x68ef('0x74')](_0x3713e0['query'][_0x68ef('0x75')],{'transaction':_0x2374fa})['then'](function(){if(!_[_0x68ef('0x87')](_0x211d51)){return _0x62a830[_0x68ef('0x88')](_0x211d51,{'transaction':_0x2374fa})[_0x68ef('0x18')](function(){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x3713e0[_0x68ef('0x49')]['id'],'UserId':_0x211d51},'transaction':_0x2374fa});});}})[_0x68ef('0x18')](function(){_0x211d51[_0x68ef('0x66')](function(_0x491464){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':_0x491464,'VoiceQueueId':_0x62a830['id']});});});});});});})['then'](respondWithStatusCode(_0x5af5d0,null))[_0x68ef('0x2f')](handleError(_0x5af5d0,null));};exports[_0x68ef('0x8a')]=function(_0x430ef5,_0x1d3499){var _0x2b1686,_0x51c52b;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x430ef5[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1d3499,null))[_0x68ef('0x18')](function(_0x5548b1){if(_0x5548b1){_0x51c52b=_0x5548b1;return _0x5548b1[_0x68ef('0x8a')](_0x430ef5['body']['ids'],_[_0x68ef('0x43')](_0x430ef5[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{})[_0x68ef('0x8b')](function(_0x32e1e3){for(var _0x150e0d=0x0;_0x150e0d<_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]['length'];_0x150e0d+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x73'),{'UserId':Number(_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')][_0x150e0d]),'VoiceQueueId':Number(_0x430ef5[_0x68ef('0x49')]['id'])});}return _0x32e1e3;});}})[_0x68ef('0x18')](function(_0x39302e){_0x2b1686=_0x39302e||[];if(_0x51c52b){return db[_0x68ef('0x60')][_0x68ef('0x2d')]({'where':{'id':_0x430ef5[_0x68ef('0x3a')][_0x68ef('0x75')]},'attributes':['id',_0x68ef('0x22'),'online',_0x68ef('0x63'),_0x68ef('0x64')],'raw':!![]});}})[_0x68ef('0x18')](function(_0xe4c314){if(!_['isEmpty'](_0xe4c314)){var _0xc5163d=[];for(var _0xb342e5=0x0;_0xb342e5<_0xe4c314[_0x68ef('0x36')];_0xb342e5++){if(_0xe4c314[_0xb342e5]['online']){_0xc5163d[_0x68ef('0x7f')](db['UserVoiceQueueRt'][_0x68ef('0x6c')]({'membername':_0xe4c314[_0xb342e5][_0x68ef('0x22')],'UserId':_0xe4c314[_0xb342e5]['id'],'queue_name':_0x51c52b[_0x68ef('0x22')],'VoiceQueueId':_0x51c52b['id'],'interface':_[_0x68ef('0x6f')](_0xe4c314[_0xb342e5][_0x68ef('0x64')])?util['format']('SIP/%s',_0xe4c314[_0xb342e5]['name']):_0xe4c314[_0xb342e5][_0x68ef('0x64')],'paused':_0xe4c314[_0xb342e5][_0x68ef('0x63')]||![],'penalty':_0x430ef5['body'][_0x68ef('0x67')]||0x0}));}}return BPromise[_0x68ef('0x84')](_0xc5163d);}})[_0x68ef('0x18')](function(){return _0x2b1686;})[_0x68ef('0x18')](respondWithResult(_0x1d3499,null))[_0x68ef('0x2f')](handleError(_0x1d3499,null));};exports[_0x68ef('0x88')]=function(_0x34edc4,_0x1576ac){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x34edc4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x1576ac,null))[_0x68ef('0x18')](function(_0x31b61d){if(_0x31b61d){return _0x31b61d[_0x68ef('0x88')](_0x34edc4[_0x68ef('0x2c')]['ids'])[_0x68ef('0x18')](function(){if(_[_0x68ef('0x8c')](_0x34edc4['query'][_0x68ef('0x75')])){for(var _0x1774a9=0x0;_0x1774a9<_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')][_0x68ef('0x36')];_0x1774a9+=0x1){socket[_0x68ef('0x72')](_0x68ef('0x89'),{'UserId':Number(_0x34edc4['query']['ids'][_0x1774a9]),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}}else{socket[_0x68ef('0x72')]('userVoiceQueue:remove',{'UserId':Number(_0x34edc4[_0x68ef('0x2c')]['ids']),'VoiceQueueId':Number(_0x34edc4[_0x68ef('0x49')]['id'])});}});}})['then'](function(_0x3054e8){return db[_0x68ef('0x6e')][_0x68ef('0x19')]({'where':{'VoiceQueueId':_0x34edc4[_0x68ef('0x49')]['id'],'UserId':_0x34edc4[_0x68ef('0x2c')][_0x68ef('0x75')]}})[_0x68ef('0x18')](function(){return _0x3054e8;});})[_0x68ef('0x18')](respondWithStatusCode(_0x1576ac,null))['catch'](handleError(_0x1576ac,null));};exports[_0x68ef('0x8d')]=function(_0x60a1e7,_0x3bd9f2){var _0x3dd5f7={};var _0x35eba3={};var _0x18e166;var _0x3a6e25;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x60a1e7['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x3bd9f2,null))[_0x68ef('0x18')](function(_0x33ec8e){if(_0x33ec8e){_0x18e166=_0x33ec8e;_0x35eba3['model']=_[_0x68ef('0x32')](db[_0x68ef('0x60')][_0x68ef('0x29')]);_0x35eba3[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x60a1e7[_0x68ef('0x2c')]);_0x35eba3[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],_0x35eba3[_0x68ef('0x2c')]);_0x3dd5f7[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x35eba3[_0x68ef('0x31')],qs[_0x68ef('0x35')](_0x60a1e7[_0x68ef('0x2c')]['fields']));_0x3dd5f7[_0x68ef('0x34')]=_0x3dd5f7[_0x68ef('0x34')]['length']?_0x3dd5f7[_0x68ef('0x34')]:_0x35eba3['model'];_0x3dd5f7[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x3dd5f7[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x60a1e7[_0x68ef('0x2c')],_0x35eba3[_0x68ef('0x4d')]));if(_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x3dd5f7[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x3dd5f7['where'],{'$or':_[_0x68ef('0x1e')](_0x3dd5f7[_0x68ef('0x34')],function(_0x2cf7d3){var _0x154c78={};_0x154c78[_0x2cf7d3]={'$like':'%'+_0x60a1e7['query'][_0x68ef('0x53')]+'%'};return _0x154c78;})});}_0x3dd5f7=_[_0x68ef('0x37')]({},_0x3dd5f7,_0x60a1e7[_0x68ef('0x38')]);return _0x18e166['getAgents'](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x225067){if(_0x225067){_0x3a6e25=_0x225067[_0x68ef('0x36')];if(!_0x60a1e7[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x3dd5f7[_0x68ef('0x14')]=qs['limit'](_0x60a1e7['query'][_0x68ef('0x14')]);_0x3dd5f7[_0x68ef('0x12')]=qs['offset'](_0x60a1e7['query'][_0x68ef('0x12')]);}return _0x18e166[_0x68ef('0x8d')](_0x3dd5f7);}})[_0x68ef('0x18')](function(_0x1e1738){if(_0x1e1738){return _0x1e1738?{'count':_0x3a6e25,'rows':_0x1e1738}:null;}})[_0x68ef('0x18')](respondWithResult(_0x3bd9f2,null))[_0x68ef('0x2f')](handleError(_0x3bd9f2,null));};exports[_0x68ef('0x8e')]=function(_0x13db31,_0x58800b){var _0x4cc80a={};var _0x3452d1={};var _0x1c5b4a;var _0x33dd03;return db['VoiceQueue'][_0x68ef('0x4b')]({'where':{'id':_0x13db31[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x58800b,null))[_0x68ef('0x18')](function(_0x535c5c){if(_0x535c5c){_0x1c5b4a=_0x535c5c;_0x3452d1['model']=_[_0x68ef('0x32')](db[_0x68ef('0x6e')][_0x68ef('0x29')]);_0x3452d1['query']=_[_0x68ef('0x32')](_0x13db31[_0x68ef('0x2c')]);_0x3452d1[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],_0x3452d1[_0x68ef('0x2c')]);_0x4cc80a[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x3452d1[_0x68ef('0x31')],qs['fields'](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4cc80a['attributes']=_0x4cc80a[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4cc80a[_0x68ef('0x34')]:_0x3452d1[_0x68ef('0x31')];_0x4cc80a['order']=qs[_0x68ef('0x50')](_0x13db31[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x4cc80a['where']=qs[_0x68ef('0x4d')](_['pick'](_0x13db31['query'],_0x3452d1['filters']));if(_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x4cc80a['where']=_[_0x68ef('0x37')](_0x4cc80a['where'],{'$or':_['map'](_0x4cc80a[_0x68ef('0x34')],function(_0x103585){var _0xa28738={};_0xa28738[_0x103585]={'$like':'%'+_0x13db31[_0x68ef('0x2c')][_0x68ef('0x53')]+'%'};return _0xa28738;})});}_0x4cc80a=_[_0x68ef('0x37')]({},_0x4cc80a,_0x13db31[_0x68ef('0x38')]);return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0xcd5609){if(_0xcd5609){_0x33dd03=_0xcd5609[_0x68ef('0x36')];if(!_0x13db31['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4cc80a['limit']=qs[_0x68ef('0x14')](_0x13db31['query'][_0x68ef('0x14')]);_0x4cc80a[_0x68ef('0x12')]=qs[_0x68ef('0x12')](_0x13db31['query'][_0x68ef('0x12')]);}return _0x1c5b4a[_0x68ef('0x8e')](_0x4cc80a);}})[_0x68ef('0x18')](function(_0x799597){return _0x799597?{'count':_0x33dd03,'rows':_0x799597}:null;})[_0x68ef('0x18')](respondWithResult(_0x58800b,null))[_0x68ef('0x2f')](handleError(_0x58800b,null));};exports['getLists']=function(_0x5e4ec4,_0x40c6ec){var _0x4a45f9={};var _0x16ba3d={};var _0x405008;var _0x3ecec3;return db[_0x68ef('0x28')][_0x68ef('0x4b')]({'where':{'id':_0x5e4ec4[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x40c6ec,null))[_0x68ef('0x18')](function(_0x4d4bfa){if(_0x4d4bfa){_0x405008=_0x4d4bfa;_0x16ba3d[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')]['rawAttributes']);_0x16ba3d[_0x68ef('0x2c')]=_[_0x68ef('0x32')](_0x5e4ec4[_0x68ef('0x2c')]);_0x16ba3d[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x16ba3d[_0x68ef('0x31')],_0x16ba3d[_0x68ef('0x2c')]);_0x4a45f9[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x16ba3d['model'],qs['fields'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x4a45f9['attributes']=_0x4a45f9[_0x68ef('0x34')][_0x68ef('0x36')]?_0x4a45f9['attributes']:_0x16ba3d['model'];_0x4a45f9['order']=qs['sort'](_0x5e4ec4[_0x68ef('0x2c')]['sort']);_0x4a45f9[_0x68ef('0x51')]=qs['filters'](_[_0x68ef('0x52')](_0x5e4ec4[_0x68ef('0x2c')],_0x16ba3d['filters']));if(_0x5e4ec4['query']['filter']){_0x4a45f9[_0x68ef('0x51')]=_[_0x68ef('0x37')](_0x4a45f9[_0x68ef('0x51')],{'$or':_['map'](_0x4a45f9[_0x68ef('0x34')],function(_0x4898ad){var _0x22a810={};_0x22a810[_0x4898ad]={'$like':'%'+_0x5e4ec4['query'][_0x68ef('0x53')]+'%'};return _0x22a810;})});}_0x4a45f9=_[_0x68ef('0x37')]({},_0x4a45f9,_0x5e4ec4[_0x68ef('0x38')]);return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x3f9113){if(_0x3f9113){_0x3ecec3=_0x3f9113[_0x68ef('0x36')];if(!_0x5e4ec4['query'][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x4a45f9[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x4a45f9[_0x68ef('0x12')]=qs['offset'](_0x5e4ec4[_0x68ef('0x2c')][_0x68ef('0x12')]);}return _0x405008[_0x68ef('0x90')](_0x4a45f9);}})[_0x68ef('0x18')](function(_0x2a93bf){if(_0x2a93bf){return _0x2a93bf?{'count':_0x3ecec3,'rows':_0x2a93bf}:null;}})[_0x68ef('0x18')](respondWithResult(_0x40c6ec,null))[_0x68ef('0x2f')](handleError(_0x40c6ec,null));};exports[_0x68ef('0x91')]=function(_0x2d0bf5,_0x40da26){var _0x202e78=moment()[_0x68ef('0x70')]('YYYY-MM-DD\x20HH:mm:ss');var _0x253b31,_0x14b845;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x2d0bf5['params']['id']}})['then'](handleEntityNotFound(_0x40da26,null))['then'](function(_0x2e6bcf){if(_0x2e6bcf){_0x14b845=_0x2e6bcf;return _0x2e6bcf[_0x68ef('0x91')](_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0x2d0bf5['body'],['ids','id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x12dbe5){var _0x547e6d;_0x253b31=_0x12dbe5||[];var _0x575f73=[];if(_0x12dbe5){for(var _0x6dc883=0x0;_0x6dc883<_0x12dbe5[_0x68ef('0x36')];_0x6dc883+=0x1){var _0x1dcc3e=_0x12dbe5[_0x6dc883][_0x68ef('0x3c')]({'plain':!![]});_0x14b845[_0x68ef('0x92')]=_0x2d0bf5[_0x68ef('0x3a')][_0x68ef('0x92')]?_0x2d0bf5['body'][_0x68ef('0x92')]:_0x14b845[_0x68ef('0x92')];switch(_0x14b845[_0x68ef('0x92')]){case _0x68ef('0x93'):_0x547e6d=squel[_0x68ef('0x94')]()['into'](_0x68ef('0x95'))[_0x68ef('0x96')](['phone',_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),'createdAt',_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id','ContactId')['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')['field'](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa1'))[_0x68ef('0x79')]('cm_hopper_final')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]()))[_0x68ef('0x51')]('phone\x20NOT\x20IN\x20(?)',squel[_0x68ef('0x76')]()[_0x68ef('0x77')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0x68ef('0x51')](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id']['toString']())))[_0x68ef('0x80')]();break;case'onlyIfOpen':_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0x95'))[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),_0x68ef('0x57'),_0x68ef('0x45'),_0x68ef('0x44')],squel[_0x68ef('0x76')]()['field'](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))[_0x68ef('0x77')]('id',_0x68ef('0x98'))['field'](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0x2d0bf5['params']['id']['toString'](),_0x68ef('0x57'))['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))[_0x68ef('0x79')](_0x68ef('0x9c'))[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f'))[_0x68ef('0x51')](_0x68ef('0xa0'),squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa4'))[_0x68ef('0x79')]('cm_hopper')['where'](_0x68ef('0xa2'),_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')]())))[_0x68ef('0x80')]();break;default:_0x547e6d=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')]('cm_hopper')[_0x68ef('0x96')]([_0x68ef('0x9a'),_0x68ef('0x97'),_0x68ef('0x98'),_0x68ef('0x99'),'VoiceQueueId','createdAt',_0x68ef('0x44')],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x97'))['field']('id','ContactId')[_0x68ef('0x77')](_0x1dcc3e[_0x68ef('0x9b')][_0x68ef('0x80')](),'ListId')[_0x68ef('0x77')](_0x2d0bf5[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0x9c'))['where'](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x1dcc3e['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))[_0x68ef('0x80')]();}_0x575f73[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x547e6d));}return BPromise[_0x68ef('0x84')](_0x575f73);}})[_0x68ef('0x18')](function(){var _0x54b4cc=[];var _0x59637f=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xa5'))['fromQuery']([_0x68ef('0xa6'),_0x68ef('0x9a'),_0x68ef('0xa7'),'createdAt','updatedAt'],squel[_0x68ef('0x76')]()[_0x68ef('0x77')](_0x68ef('0xa8'))[_0x68ef('0x77')](_0x68ef('0xa9'))[_0x68ef('0x77')]('ci.OrderBy+1')['field']('\x27'+_0x202e78+'\x27',_0x68ef('0x45'))[_0x68ef('0x77')]('\x27'+_0x202e78+'\x27',_0x68ef('0x44'))['from'](_0x68ef('0xaa'),'ci')[_0x68ef('0x7b')](_0x68ef('0x95'),'h',_0x68ef('0xab'))[_0x68ef('0x51')]('h.scheduledat=?',_0x202e78)[_0x68ef('0x51')](_0x68ef('0xac'),_0x68ef('0xad')))['toString']();_0x54b4cc[_0x68ef('0x7f')](db[_0x68ef('0x68')][_0x68ef('0x2c')](_0x59637f));return BPromise[_0x68ef('0x84')](_0x54b4cc);})[_0x68ef('0x18')](function(){return _0x253b31;})[_0x68ef('0x18')](respondWithResult(_0x40da26,null))[_0x68ef('0x2f')](handleError(_0x40da26,null));};exports[_0x68ef('0xae')]=function(_0x58d5da,_0x1873b5){return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0x58d5da[_0x68ef('0x49')]['id']}})['then'](handleEntityNotFound(_0x1873b5,null))[_0x68ef('0x18')](function(_0x351b99){if(_0x351b99){return _0x351b99[_0x68ef('0xae')](_0x58d5da[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x5b41f0){if(_0x5b41f0){return db[_0x68ef('0x4c')]['destroy']({'where':{'ListId':_0x58d5da['query'][_0x68ef('0x75')],'VoiceQueueId':_0x58d5da[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](function(){return _0x5b41f0;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x1873b5,null))[_0x68ef('0x2f')](handleError(_0x1873b5,null));};exports[_0x68ef('0xaf')]=function(_0x3ee069,_0x5f49e9){var _0x40cd91={};var _0x848118={};var _0x794d1e;var _0x266f6c;return db[_0x68ef('0x28')]['findOne']({'where':{'id':_0x3ee069[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x5f49e9,null))[_0x68ef('0x18')](function(_0x2b5994){if(_0x2b5994){_0x794d1e=_0x2b5994;_0x848118[_0x68ef('0x31')]=_[_0x68ef('0x32')](db[_0x68ef('0x8f')][_0x68ef('0x29')]);_0x848118['query']=_[_0x68ef('0x32')](_0x3ee069[_0x68ef('0x2c')]);_0x848118[_0x68ef('0x4d')]=_[_0x68ef('0x33')](_0x848118[_0x68ef('0x31')],_0x848118[_0x68ef('0x2c')]);_0x40cd91[_0x68ef('0x34')]=_[_0x68ef('0x33')](_0x848118['model'],qs[_0x68ef('0x35')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x35')]));_0x40cd91[_0x68ef('0x34')]=_0x40cd91[_0x68ef('0x34')]['length']?_0x40cd91[_0x68ef('0x34')]:_0x848118[_0x68ef('0x31')];_0x40cd91[_0x68ef('0x4f')]=qs[_0x68ef('0x50')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x50')]);_0x40cd91[_0x68ef('0x51')]=qs[_0x68ef('0x4d')](_[_0x68ef('0x52')](_0x3ee069[_0x68ef('0x2c')],_0x848118[_0x68ef('0x4d')]));if(_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x53')]){_0x40cd91['where']=_[_0x68ef('0x37')](_0x40cd91[_0x68ef('0x51')],{'$or':_[_0x68ef('0x1e')](_0x40cd91[_0x68ef('0x34')],function(_0x124eda){var _0x4b738d={};_0x4b738d[_0x124eda]={'$like':'%'+_0x3ee069[_0x68ef('0x2c')]['filter']+'%'};return _0x4b738d;})});}_0x40cd91=_['merge']({},_0x40cd91,_0x3ee069[_0x68ef('0x38')]);return _0x794d1e['getBlackLists'](_0x40cd91);}})['then'](function(_0x4210c0){if(_0x4210c0){_0x266f6c=_0x4210c0['length'];if(!_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x4e')](_0x68ef('0x56'))){_0x40cd91[_0x68ef('0x14')]=qs[_0x68ef('0x14')](_0x3ee069[_0x68ef('0x2c')][_0x68ef('0x14')]);_0x40cd91[_0x68ef('0x12')]=qs['offset'](_0x3ee069['query'][_0x68ef('0x12')]);}return _0x794d1e[_0x68ef('0xaf')](_0x40cd91);}})[_0x68ef('0x18')](function(_0x23946d){if(_0x23946d){return _0x23946d?{'count':_0x266f6c,'rows':_0x23946d}:null;}})[_0x68ef('0x18')](respondWithResult(_0x5f49e9,null))[_0x68ef('0x2f')](handleError(_0x5f49e9,null));};exports[_0x68ef('0xb0')]=function(_0xcc1765,_0x29662c){var _0x1185bd;return db[_0x68ef('0x28')][_0x68ef('0x20')]({'where':{'id':_0xcc1765['params']['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x29662c,null))['then'](function(_0x30876d){if(_0x30876d){return _0x30876d[_0x68ef('0xb0')](_0xcc1765[_0x68ef('0x3a')][_0x68ef('0x75')],_['omit'](_0xcc1765[_0x68ef('0x3a')],[_0x68ef('0x75'),'id'])||{});}return null;})[_0x68ef('0x8b')](function(_0x295b66){var _0x3455b5;_0x1185bd=_0x295b66||[];var _0xbf2168=[];if(_0x295b66){for(var _0x4cf8b6=0x0;_0x4cf8b6<_0x295b66[_0x68ef('0x36')];_0x4cf8b6+=0x1){var _0x4e3f0a=_0x295b66[_0x4cf8b6][_0x68ef('0x3c')]({'plain':!![]});_0x3455b5=squel[_0x68ef('0x94')]()[_0x68ef('0xa3')](_0x68ef('0xb1'))[_0x68ef('0x96')]([_0x68ef('0x9a'),'ContactId','ListId','VoiceQueueId',_0x68ef('0x45'),_0x68ef('0x44')],squel['select']()[_0x68ef('0x77')](_0x68ef('0x9a'),_0x68ef('0x9a'))[_0x68ef('0x77')]('id','ContactId')[_0x68ef('0x77')](_0x4e3f0a[_0x68ef('0x9b')][_0x68ef('0x80')](),_0x68ef('0x99'))[_0x68ef('0x77')](_0xcc1765[_0x68ef('0x49')]['id'][_0x68ef('0x80')](),_0x68ef('0x57'))[_0x68ef('0x77')](_0x68ef('0xb2'),'createdAt')[_0x68ef('0x77')](_0x68ef('0xb2'),_0x68ef('0x44'))[_0x68ef('0x79')]('cm_contacts')[_0x68ef('0x51')](_0x68ef('0x9d'))[_0x68ef('0x51')](_0x68ef('0x9e'),_0x4e3f0a['CmListId'][_0x68ef('0x80')]())[_0x68ef('0x51')](_0x68ef('0x9f')))['toString']();_0xbf2168['push'](db['sequelize'][_0x68ef('0x2c')](_0x3455b5));}return BPromise['all'](_0xbf2168);}})['then'](function(){return _0x1185bd;})[_0x68ef('0x18')](respondWithResult(_0x29662c,null))['catch'](handleError(_0x29662c,null));};exports[_0x68ef('0xb3')]=function(_0x398899,_0x8dd212){return db[_0x68ef('0x28')]['find']({'where':{'id':_0x398899[_0x68ef('0x49')]['id']}})[_0x68ef('0x18')](handleEntityNotFound(_0x8dd212,null))[_0x68ef('0x18')](function(_0x57d305){if(_0x57d305){return _0x57d305[_0x68ef('0xb3')](_0x398899[_0x68ef('0x2c')][_0x68ef('0x75')]);}})['then'](function(_0x4c6756){if(_0x4c6756){return db[_0x68ef('0x5b')]['destroy']({'where':{'ListId':_0x398899[_0x68ef('0x2c')]['ids'],'VoiceQueueId':_0x398899['params']['id']}})['then'](function(){return _0x4c6756;});}})[_0x68ef('0x18')](respondWithStatusCode(_0x8dd212,null))[_0x68ef('0x2f')](handleError(_0x8dd212,null));}; \ No newline at end of file +var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x39a2c2,_0x28c76e){var _0x13912c=function(_0x4b2561){while(--_0x4b2561){_0x39a2c2['push'](_0x39a2c2['shift']());}};_0x13912c(++_0x28c76e);}(_0xe14b,0x93));var _0xbe14=function(_0x3699ab,_0x43cb42){_0x3699ab=_0x3699ab-0x0;var _0x50f9f4=_0xe14b[_0x3699ab];return _0x50f9f4;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index a29dd2e..0953750 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 _0xab12=['hook','exports','events','VoiceQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x31be09,_0x5ebfe0){var _0x54af4c=function(_0x42605a){while(--_0x42605a){_0x31be09['push'](_0x31be09['shift']());}};_0x54af4c(++_0x5ebfe0);}(_0xab12,0x1ba));var _0x2ab1=function(_0x5510ff,_0x1533d7){_0x5510ff=_0x5510ff-0x0;var _0x4a5ead=_0xab12[_0x5510ff];return _0x4a5ead;};'use strict';var EventEmitter=require(_0x2ab1('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x2ab1('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2ab1('0x2')](0x0);var events={'afterCreate':_0x2ab1('0x3'),'afterUpdate':_0x2ab1('0x4'),'afterDestroy':_0x2ab1('0x5')};function emitEvent(_0x67f7b9){return function(_0x1c3c9e,_0x39479c,_0x35da8c){VoiceQueueEvents[_0x2ab1('0x6')](_0x67f7b9+':'+_0x1c3c9e['id'],_0x1c3c9e);VoiceQueueEvents[_0x2ab1('0x6')](_0x67f7b9,_0x1c3c9e);_0x35da8c(null);};}for(var e in events){if(events[_0x2ab1('0x7')](e)){var event=events[e];VoiceQueue[_0x2ab1('0x8')](e,emitEvent(event));}}module[_0x2ab1('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x7f93=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x626207,_0x278147){var _0x5e26d3=function(_0x56c40e){while(--_0x56c40e){_0x626207['push'](_0x626207['shift']());}};_0x5e26d3(++_0x278147);}(_0x7f93,0x114));var _0x37f9=function(_0x471049,_0x532341){_0x471049=_0x471049-0x0;var _0x234ae6=_0x7f93[_0x471049];return _0x234ae6;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x37f9('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x37f9('0x1')](0x0);var events={'afterCreate':_0x37f9('0x2'),'afterUpdate':_0x37f9('0x3'),'afterDestroy':_0x37f9('0x4')};function emitEvent(_0x3614ad){return function(_0x5b637c,_0x86d1a8,_0x213bdb){VoiceQueueEvents[_0x37f9('0x5')](_0x3614ad+':'+_0x5b637c['id'],_0x5b637c);VoiceQueueEvents['emit'](_0x3614ad,_0x5b637c);_0x213bdb(null);};}for(var e in events){if(events[_0x37f9('0x6')](e)){var event=events[e];VoiceQueue[_0x37f9('0x7')](e,emitEvent(event));}}module[_0x37f9('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 07ae6a8..3ba406b 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x5941b2,_0x5ec35d){var _0x334997=function(_0x548b1e){while(--_0x548b1e){_0x5941b2['push'](_0x5941b2['shift']());}};_0x334997(++_0x5ec35d);}(_0x34e8,0x12c));var _0x834e=function(_0x518cbc,_0x13885c){_0x518cbc=_0x518cbc-0x0;var _0x52c5c6=_0x34e8[_0x518cbc];return _0x52c5c6;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x19454e,_0x34df45){var _0x9675b0=function(_0x1abc49){while(--_0x1abc49){_0x19454e['push'](_0x19454e['shift']());}};_0x9675b0(++_0x34df45);}(_0x34e8,0x12c));var _0x834e=function(_0x330a44,_0x337308){_0x330a44=_0x330a44-0x0;var _0xbf84ce=_0x34e8[_0x330a44];return _0xbf84ce;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 39c27c0..154afa8 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 _0x5033=['localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','model','include','map','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x926861,_0x4dd567){var _0x1654f5=function(_0x339c83){while(--_0x339c83){_0x926861['push'](_0x926861['shift']());}};_0x1654f5(++_0x4dd567);}(_0x5033,0x1d6));var _0x3503=function(_0x2cebbc,_0x5cc7a7){_0x2cebbc=_0x2cebbc-0x0;var _0x2b8cf6=_0x5033[_0x2cebbc];return _0x2b8cf6;};'use strict';var _=require(_0x3503('0x0'));var util=require(_0x3503('0x1'));var moment=require(_0x3503('0x2'));var BPromise=require(_0x3503('0x3'));var rs=require(_0x3503('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3503('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3503('0x6'))(_0x3503('0x7'));var config=require(_0x3503('0x8'));var jayson=require(_0x3503('0x9'));var client=jayson[_0x3503('0xa')][_0x3503('0xb')]({'port':0x232a});config[_0x3503('0xc')]=_[_0x3503('0xd')](config[_0x3503('0xc')],{'host':_0x3503('0xe'),'port':0x18eb});var socket=require(_0x3503('0xf'))(new Redis(config['redis']));require(_0x3503('0x10'))[_0x3503('0x11')](socket);function respondWithRpcPromise(_0x272e53,_0x19a374,_0x4233a5){return new BPromise(function(_0x54d955,_0x1fda4d){return client[_0x3503('0x12')](_0x272e53,_0x4233a5)[_0x3503('0x13')](function(_0x82da3b){logger[_0x3503('0x14')](_0x3503('0x15'),_0x19a374,_0x3503('0x16'));logger[_0x3503('0x17')](_0x3503('0x18'),_0x19a374,'request\x20sent',JSON[_0x3503('0x19')](_0x82da3b));if(_0x82da3b[_0x3503('0x1a')]){if(_0x82da3b[_0x3503('0x1a')][_0x3503('0x1b')]===0x1f4){logger['error'](_0x3503('0x15'),_0x19a374,_0x82da3b['error'][_0x3503('0x1c')]);return _0x1fda4d(_0x82da3b[_0x3503('0x1a')][_0x3503('0x1c')]);}logger[_0x3503('0x1a')](_0x3503('0x15'),_0x19a374,_0x82da3b[_0x3503('0x1a')]['message']);return _0x54d955(_0x82da3b['error'][_0x3503('0x1c')]);}else{logger['info'](_0x3503('0x15'),_0x19a374,_0x3503('0x16'));_0x54d955(_0x82da3b[_0x3503('0x1d')][_0x3503('0x1c')]);}})[_0x3503('0x1e')](function(_0x1e8891){logger[_0x3503('0x1a')](_0x3503('0x15'),_0x19a374,_0x1e8891);_0x1fda4d(_0x1e8891);});});}exports[_0x3503('0x1f')]=function(_0x266cbd){var _0xce3307=this;return new Promise(function(_0x548377,_0x5bce80){return db[_0x3503('0x20')][_0x3503('0x21')]({'raw':_0x266cbd[_0x3503('0x22')]?_0x266cbd[_0x3503('0x22')][_0x3503('0x23')]===undefined?!![]:![]:!![],'where':_0x266cbd[_0x3503('0x22')]?_0x266cbd[_0x3503('0x22')][_0x3503('0x24')]||null:null,'attributes':_0x266cbd[_0x3503('0x22')]?_0x266cbd[_0x3503('0x22')][_0x3503('0x25')]||null:null,'limit':_0x266cbd['options']?_0x266cbd[_0x3503('0x22')][_0x3503('0x26')]||null:null,'include':_0x266cbd[_0x3503('0x22')]?_0x266cbd[_0x3503('0x22')]['include']?_['map'](_0x266cbd['options']['include'],function(_0x2f2975){return{'model':db[_0x2f2975[_0x3503('0x27')]],'as':_0x2f2975['as'],'attributes':_0x2f2975['attributes'],'include':_0x2f2975[_0x3503('0x28')]?_['map'](_0x2f2975[_0x3503('0x28')],function(_0x178044){return{'model':db[_0x178044['model']],'as':_0x178044['as'],'attributes':_0x178044[_0x3503('0x25')],'include':_0x178044[_0x3503('0x28')]?_[_0x3503('0x29')](_0x178044[_0x3503('0x28')],function(_0xc57709){return{'model':db[_0xc57709[_0x3503('0x27')]],'as':_0xc57709['as'],'attributes':_0xc57709['attributes']};}):[]};}):[]};}):[]:[]})[_0x3503('0x13')](function(_0x140e20){logger[_0x3503('0x14')]('GetVoiceQueue',_0x266cbd);logger[_0x3503('0x17')](_0x3503('0x1f'),_0x266cbd,JSON['stringify'](_0x140e20));_0x548377(_0x140e20);})[_0x3503('0x1e')](function(_0x6b46a2){logger[_0x3503('0x1a')](_0x3503('0x1f'),_0x6b46a2[_0x3503('0x1c')],_0x266cbd);_0x5bce80(_0xce3307[_0x3503('0x1a')](0x1f4,_0x6b46a2[_0x3503('0x1c')]));});});};exports['ShowVoiceQueue']=function(_0x3db46d){var _0x542b0e=this;return new Promise(function(_0x863f1f,_0x220382){return db[_0x3503('0x20')][_0x3503('0x2a')]({'raw':_0x3db46d['options']?_0x3db46d[_0x3503('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x3db46d['options']?_0x3db46d['options']['where']||null:null,'attributes':_0x3db46d[_0x3503('0x22')]?_0x3db46d['options'][_0x3503('0x25')]||null:null,'include':_0x3db46d[_0x3503('0x22')]?_0x3db46d[_0x3503('0x22')][_0x3503('0x28')]?_['map'](_0x3db46d[_0x3503('0x22')]['include'],function(_0x56d36b){return{'model':db[_0x56d36b[_0x3503('0x27')]],'as':_0x56d36b['as'],'attributes':_0x56d36b['attributes'],'include':_0x56d36b[_0x3503('0x28')]?_[_0x3503('0x29')](_0x56d36b[_0x3503('0x28')],function(_0xb27f00){return{'model':db[_0xb27f00[_0x3503('0x27')]],'as':_0xb27f00['as'],'attributes':_0xb27f00[_0x3503('0x25')],'include':_0xb27f00['include']?_['map'](_0xb27f00[_0x3503('0x28')],function(_0x5cbc2a){return{'model':db[_0x5cbc2a[_0x3503('0x27')]],'as':_0x5cbc2a['as'],'attributes':_0x5cbc2a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cb061){logger['info'](_0x3503('0x2b'),_0x3db46d);logger[_0x3503('0x17')](_0x3503('0x2b'),_0x3db46d,JSON['stringify'](_0x2cb061));_0x863f1f(_0x2cb061);})[_0x3503('0x1e')](function(_0x372e86){logger['error'](_0x3503('0x2b'),_0x372e86['message'],_0x3db46d);_0x220382(_0x542b0e[_0x3503('0x1a')](0x1f4,_0x372e86['message']));});});}; \ No newline at end of file +var _0x2aa9=['include','map','model','attributes','ShowVoiceQueue','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','request\x20sent','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','limit'];(function(_0x2e6006,_0x314c29){var _0x701665=function(_0x219014){while(--_0x219014){_0x2e6006['push'](_0x2e6006['shift']());}};_0x701665(++_0x314c29);}(_0x2aa9,0x118));var _0x92aa=function(_0x5bc154,_0x34ff78){_0x5bc154=_0x5bc154-0x0;var _0x538e20=_0x2aa9[_0x5bc154];return _0x538e20;};'use strict';var _=require(_0x92aa('0x0'));var util=require(_0x92aa('0x1'));var moment=require(_0x92aa('0x2'));var BPromise=require(_0x92aa('0x3'));var rs=require(_0x92aa('0x4'));var fs=require('fs');var Redis=require(_0x92aa('0x5'));var db=require(_0x92aa('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x92aa('0x7'));var jayson=require(_0x92aa('0x8'));var client=jayson[_0x92aa('0x9')]['http']({'port':0x232a});config[_0x92aa('0xa')]=_['defaults'](config[_0x92aa('0xa')],{'host':_0x92aa('0xb'),'port':0x18eb});var socket=require(_0x92aa('0xc'))(new Redis(config[_0x92aa('0xa')]));require(_0x92aa('0xd'))[_0x92aa('0xe')](socket);function respondWithRpcPromise(_0x4b066b,_0x3bc63f,_0x19048b){return new BPromise(function(_0x20f185,_0xe3e503){return client[_0x92aa('0xf')](_0x4b066b,_0x19048b)[_0x92aa('0x10')](function(_0x2ef941){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x3bc63f,_0x92aa('0x11'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3bc63f,'request\x20sent',JSON[_0x92aa('0x12')](_0x2ef941));if(_0x2ef941[_0x92aa('0x13')]){if(_0x2ef941[_0x92aa('0x13')][_0x92aa('0x14')]===0x1f4){logger[_0x92aa('0x13')](_0x92aa('0x15'),_0x3bc63f,_0x2ef941[_0x92aa('0x13')][_0x92aa('0x16')]);return _0xe3e503(_0x2ef941[_0x92aa('0x13')][_0x92aa('0x16')]);}logger[_0x92aa('0x13')](_0x92aa('0x15'),_0x3bc63f,_0x2ef941[_0x92aa('0x13')]['message']);return _0x20f185(_0x2ef941['error'][_0x92aa('0x16')]);}else{logger[_0x92aa('0x17')](_0x92aa('0x15'),_0x3bc63f,_0x92aa('0x11'));_0x20f185(_0x2ef941[_0x92aa('0x18')][_0x92aa('0x16')]);}})[_0x92aa('0x19')](function(_0x1b8f45){logger[_0x92aa('0x13')](_0x92aa('0x15'),_0x3bc63f,_0x1b8f45);_0xe3e503(_0x1b8f45);});});}exports[_0x92aa('0x1a')]=function(_0x2ce705){var _0x160a49=this;return new Promise(function(_0x16153b,_0x25b5c9){return db[_0x92aa('0x1b')]['findAll']({'raw':_0x2ce705[_0x92aa('0x1c')]?_0x2ce705['options'][_0x92aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ce705['options']?_0x2ce705[_0x92aa('0x1c')][_0x92aa('0x1e')]||null:null,'attributes':_0x2ce705[_0x92aa('0x1c')]?_0x2ce705[_0x92aa('0x1c')]['attributes']||null:null,'limit':_0x2ce705[_0x92aa('0x1c')]?_0x2ce705[_0x92aa('0x1c')][_0x92aa('0x1f')]||null:null,'include':_0x2ce705[_0x92aa('0x1c')]?_0x2ce705[_0x92aa('0x1c')][_0x92aa('0x20')]?_[_0x92aa('0x21')](_0x2ce705['options']['include'],function(_0x1be0ad){return{'model':db[_0x1be0ad[_0x92aa('0x22')]],'as':_0x1be0ad['as'],'attributes':_0x1be0ad['attributes'],'include':_0x1be0ad[_0x92aa('0x20')]?_[_0x92aa('0x21')](_0x1be0ad[_0x92aa('0x20')],function(_0x237bcf){return{'model':db[_0x237bcf[_0x92aa('0x22')]],'as':_0x237bcf['as'],'attributes':_0x237bcf['attributes'],'include':_0x237bcf[_0x92aa('0x20')]?_[_0x92aa('0x21')](_0x237bcf[_0x92aa('0x20')],function(_0x1eebaa){return{'model':db[_0x1eebaa[_0x92aa('0x22')]],'as':_0x1eebaa['as'],'attributes':_0x1eebaa[_0x92aa('0x23')]};}):[]};}):[]};}):[]:[]})[_0x92aa('0x10')](function(_0x5bf10e){logger['info'](_0x92aa('0x1a'),_0x2ce705);logger['debug'](_0x92aa('0x1a'),_0x2ce705,JSON[_0x92aa('0x12')](_0x5bf10e));_0x16153b(_0x5bf10e);})[_0x92aa('0x19')](function(_0x1d0744){logger[_0x92aa('0x13')](_0x92aa('0x1a'),_0x1d0744['message'],_0x2ce705);_0x25b5c9(_0x160a49['error'](0x1f4,_0x1d0744['message']));});});};exports[_0x92aa('0x24')]=function(_0x1eb7b9){var _0x4aef8d=this;return new Promise(function(_0x21cb43,_0xa7b7eb){return db[_0x92aa('0x1b')][_0x92aa('0x25')]({'raw':_0x1eb7b9[_0x92aa('0x1c')]?_0x1eb7b9[_0x92aa('0x1c')][_0x92aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x1eb7b9[_0x92aa('0x1c')]?_0x1eb7b9[_0x92aa('0x1c')][_0x92aa('0x1e')]||null:null,'attributes':_0x1eb7b9['options']?_0x1eb7b9[_0x92aa('0x1c')][_0x92aa('0x23')]||null:null,'include':_0x1eb7b9['options']?_0x1eb7b9[_0x92aa('0x1c')]['include']?_[_0x92aa('0x21')](_0x1eb7b9['options']['include'],function(_0x56e0ef){return{'model':db[_0x56e0ef['model']],'as':_0x56e0ef['as'],'attributes':_0x56e0ef[_0x92aa('0x23')],'include':_0x56e0ef[_0x92aa('0x20')]?_[_0x92aa('0x21')](_0x56e0ef[_0x92aa('0x20')],function(_0x31e9c1){return{'model':db[_0x31e9c1[_0x92aa('0x22')]],'as':_0x31e9c1['as'],'attributes':_0x31e9c1[_0x92aa('0x23')],'include':_0x31e9c1[_0x92aa('0x20')]?_['map'](_0x31e9c1[_0x92aa('0x20')],function(_0x1f5e37){return{'model':db[_0x1f5e37[_0x92aa('0x22')]],'as':_0x1f5e37['as'],'attributes':_0x1f5e37[_0x92aa('0x23')]};}):[]};}):[]};}):[]:[]})[_0x92aa('0x10')](function(_0x5e36e4){logger[_0x92aa('0x17')](_0x92aa('0x24'),_0x1eb7b9);logger[_0x92aa('0x26')]('ShowVoiceQueue',_0x1eb7b9,JSON['stringify'](_0x5e36e4));_0x21cb43(_0x5e36e4);})['catch'](function(_0x3673f0){logger[_0x92aa('0x13')](_0x92aa('0x24'),_0x3673f0['message'],_0x1eb7b9);_0xa7b7eb(_0x4aef8d['error'](0x1f4,_0x3673f0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 89aa5a7..1d0e183 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 _0x91fb=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x15b07a,_0x4b0108){var _0x245811=function(_0x43c4f7){while(--_0x43c4f7){_0x15b07a['push'](_0x15b07a['shift']());}};_0x245811(++_0x4b0108);}(_0x91fb,0xde));var _0xb91f=function(_0x5d8631,_0x44944b){_0x5d8631=_0x5d8631-0x0;var _0x34c15e=_0x91fb[_0x5d8631];return _0x34c15e;};'use strict';var VoiceQueueEvents=require(_0xb91f('0x0'));var events=[_0xb91f('0x1'),_0xb91f('0x2'),_0xb91f('0x3')];function createListener(_0x21ce89,_0x12256b){return function(_0x2bcdb3){_0x12256b[_0xb91f('0x4')](_0x21ce89,_0x2bcdb3);};}function removeListener(_0x469d31,_0x42f1fa){return function(){VoiceQueueEvents[_0xb91f('0x5')](_0x469d31,_0x42f1fa);};}exports[_0xb91f('0x6')]=function(_0x41c02d){for(var _0xb56050=0x0,_0x1956db=events[_0xb91f('0x7')];_0xb56050<_0x1956db;_0xb56050++){var _0x3fa80f=events[_0xb56050];var _0x2e9c0b=createListener(_0xb91f('0x8')+_0x3fa80f,_0x41c02d);VoiceQueueEvents['on'](_0x3fa80f,_0x2e9c0b);}}; \ No newline at end of file +var _0x4a75=['emit','removeListener','register','voiceQueue:','save','remove'];(function(_0x37df26,_0x5157ed){var _0x3d5961=function(_0x310150){while(--_0x310150){_0x37df26['push'](_0x37df26['shift']());}};_0x3d5961(++_0x5157ed);}(_0x4a75,0x112));var _0x54a7=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x4a75[_0x324012];return _0x435cf2;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x54a7('0x0'),_0x54a7('0x1'),'update'];function createListener(_0x399fce,_0xd37ae4){return function(_0x4632a7){_0xd37ae4[_0x54a7('0x2')](_0x399fce,_0x4632a7);};}function removeListener(_0x1b99bb,_0x260c2b){return function(){VoiceQueueEvents[_0x54a7('0x3')](_0x1b99bb,_0x260c2b);};}exports[_0x54a7('0x4')]=function(_0x3f7562){for(var _0x3bf5eb=0x0,_0x45313f=events['length'];_0x3bf5eb<_0x45313f;_0x3bf5eb++){var _0x1116a3=events[_0x3bf5eb];var _0x5861f9=createListener(_0x54a7('0x5')+_0x1116a3,_0x3f7562);VoiceQueueEvents['on'](_0x1116a3,_0x5861f9);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index e54a9fe..753a127 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 _0x0ecd=['isAuthenticated','index','/describe','describe','get','/index','getVoiceQueuesReport','show','post','/:id','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller'];(function(_0x3d23ef,_0x4e0369){var _0x328553=function(_0x5e7872){while(--_0x5e7872){_0x3d23ef['push'](_0x3d23ef['shift']());}};_0x328553(++_0x4e0369);}(_0x0ecd,0x1db));var _0xd0ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ecd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd0ec('0x0'));var util=require(_0xd0ec('0x1'));var path=require(_0xd0ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0ec('0x3'));var router=express[_0xd0ec('0x4')]();var fs_extra=require(_0xd0ec('0x5'));var auth=require(_0xd0ec('0x6'));var interaction=require(_0xd0ec('0x7'));var config=require('../../config/environment');var controller=require(_0xd0ec('0x8'));router['get']('/',auth[_0xd0ec('0x9')](),controller[_0xd0ec('0xa')]);router['get'](_0xd0ec('0xb'),auth[_0xd0ec('0x9')](),controller[_0xd0ec('0xc')]);router[_0xd0ec('0xd')](_0xd0ec('0xe'),auth[_0xd0ec('0x9')](),controller[_0xd0ec('0xf')]);router['get']('/:id',auth[_0xd0ec('0x9')](),controller[_0xd0ec('0x10')]);router[_0xd0ec('0x11')]('/',auth[_0xd0ec('0x9')](),controller['create']);router['put'](_0xd0ec('0x12'),auth[_0xd0ec('0x9')](),controller[_0xd0ec('0x13')]);router[_0xd0ec('0x14')](_0xd0ec('0x12'),auth[_0xd0ec('0x9')](),controller[_0xd0ec('0x15')]);module['exports']=router; \ No newline at end of file +var _0x08ca=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x3b1746,_0x11b868){var _0x163fb7=function(_0x3bab2c){while(--_0x3bab2c){_0x3b1746['push'](_0x3b1746['shift']());}};_0x163fb7(++_0x11b868);}(_0x08ca,0x168));var _0xa08c=function(_0xf02b3f,_0x4aaf47){_0xf02b3f=_0xf02b3f-0x0;var _0x51d908=_0x08ca[_0xf02b3f];return _0x51d908;};'use strict';var multer=require(_0xa08c('0x0'));var util=require(_0xa08c('0x1'));var path=require(_0xa08c('0x2'));var timeout=require(_0xa08c('0x3'));var express=require(_0xa08c('0x4'));var router=express['Router']();var fs_extra=require(_0xa08c('0x5'));var auth=require(_0xa08c('0x6'));var interaction=require(_0xa08c('0x7'));var config=require(_0xa08c('0x8'));var controller=require(_0xa08c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xa08c('0xa')]);router[_0xa08c('0xb')](_0xa08c('0xc'),auth[_0xa08c('0xd')](),controller[_0xa08c('0xe')]);router[_0xa08c('0xb')]('/index',auth[_0xa08c('0xd')](),controller['getVoiceQueuesReport']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa08c('0xf')]);router[_0xa08c('0x10')]('/',auth['isAuthenticated'](),controller[_0xa08c('0x11')]);router[_0xa08c('0x12')]('/:id',auth[_0xa08c('0xd')](),controller[_0xa08c('0x13')]);router[_0xa08c('0x14')](_0xa08c('0x15'),auth[_0xa08c('0xd')](),controller[_0xa08c('0x16')]);module[_0xa08c('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index efac18c..42e5d5e 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 _0x6c62=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0xb66df,_0x4fb5ce){var _0x42a702=function(_0x252d1d){while(--_0x252d1d){_0xb66df['push'](_0xb66df['shift']());}};_0x42a702(++_0x4fb5ce);}(_0x6c62,0x67));var _0x26c6=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x6c62[_0x3a6e4b];return _0x36572d;};'use strict';var Sequelize=require(_0x26c6('0x0'));var moment=require(_0x26c6('0x1'));module[_0x26c6('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x26c6('0x3')]},'calleridnum':{'type':Sequelize[_0x26c6('0x3')]},'calleridname':{'type':Sequelize[_0x26c6('0x3')]},'queue':{'type':Sequelize[_0x26c6('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x26c6('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x38cc30){var _0x33efa6=moment(_0x38cc30);var _0x5d83ea=moment(this[_0x26c6('0x5')](_0x26c6('0x6')))['format'](_0x26c6('0x7'));var _0x242ee2=_0x33efa6[_0x26c6('0x8')](_0x5d83ea,_0x26c6('0x9'));this[_0x26c6('0xa')](_0x26c6('0xb'),_0x38cc30);this['setDataValue'](_0x26c6('0xc'),_0x242ee2||null);}},'position':{'type':Sequelize[_0x26c6('0xd')]},'count':{'type':Sequelize[_0x26c6('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x26c6('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x26c6('0x4')]},'queuecallerexit':{'type':Sequelize[_0x26c6('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x26c6('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x26c6('0xf')},'originalposition':{'type':Sequelize[_0x26c6('0xd')]},'channel':{'type':Sequelize[_0x26c6('0x3')]},'connectedlinenum':{'type':Sequelize[_0x26c6('0x3')]},'connectedlinename':{'type':Sequelize[_0x26c6('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x26c6('0x3')]},'exten':{'type':Sequelize[_0x26c6('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x26c6('0xd')]},'mohtime':{'type':Sequelize[_0x26c6('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x26c6('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x26c6('0x3')]},'transfer':{'type':Sequelize[_0x26c6('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x26c6('0x3')],'comment':_0x26c6('0x10')},'transferexten':{'type':Sequelize[_0x26c6('0x3')]},'transferuniqueid':{'type':Sequelize[_0x26c6('0x3')]},'disposition':{'type':Sequelize[_0x26c6('0x3')]},'secondDisposition':{'type':Sequelize[_0x26c6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x26c6('0x3')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x26c6('0x3')]}}; \ No newline at end of file +var _0x543e=['setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds'];(function(_0x50f15a,_0x4b2465){var _0x150cd6=function(_0x193e5d){while(--_0x193e5d){_0x50f15a['push'](_0x50f15a['shift']());}};_0x150cd6(++_0x4b2465);}(_0x543e,0x1b1));var _0xe543=function(_0x5340fb,_0x53d5a2){_0x5340fb=_0x5340fb-0x0;var _0x35701e=_0x543e[_0x5340fb];return _0x35701e;};'use strict';var Sequelize=require(_0xe543('0x0'));var moment=require(_0xe543('0x1'));module[_0xe543('0x2')]={'type':{'type':Sequelize[_0xe543('0x3')]},'uniqueid':{'type':Sequelize[_0xe543('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe543('0x3')]},'queue':{'type':Sequelize[_0xe543('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x589229){var _0x537a53=moment(_0x589229);var _0x1c34c3=moment(this['getDataValue'](_0xe543('0x4')))[_0xe543('0x5')](_0xe543('0x6'));var _0xffcaf5=_0x537a53[_0xe543('0x7')](_0x1c34c3,_0xe543('0x8'));this[_0xe543('0x9')](_0xe543('0xa'),_0x589229);this['setDataValue'](_0xe543('0xb'),_0xffcaf5||null);}},'position':{'type':Sequelize[_0xe543('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xe543('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xe543('0xe')]},'queuecallercomplete':{'type':Sequelize[_0xe543('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xe543('0xe')]},'queuecallerexit':{'type':Sequelize[_0xe543('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xe543('0xe')]},'queuecallerexitreason':{'type':Sequelize[_0xe543('0x3')],'comment':_0xe543('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xe543('0x3')]},'accountcode':{'type':Sequelize[_0xe543('0x3')]},'context':{'type':Sequelize[_0xe543('0x3')]},'exten':{'type':Sequelize[_0xe543('0x3')]},'priority':{'type':Sequelize[_0xe543('0x3')]},'holdtime':{'type':Sequelize[_0xe543('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe543('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xe543('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xe543('0x10')},'transferexten':{'type':Sequelize[_0xe543('0x3')]},'transferuniqueid':{'type':Sequelize[_0xe543('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0xe543('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0xe543('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index cbddc7e..27911e7 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 _0x453e=['nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','params','length','catch','create','body','find','describe','getVoiceQueuesReport','hasOwnProperty','merge','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','undefined','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceQueueReport','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields'];(function(_0x121e0f,_0x1dce03){var _0x563380=function(_0x49fcbb){while(--_0x49fcbb){_0x121e0f['push'](_0x121e0f['shift']());}};_0x563380(++_0x1dce03);}(_0x453e,0x104));var _0xe453=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0x453e[_0x111e94];return _0x3de107;};'use strict';var emlformat=require(_0xe453('0x0'));var rimraf=require(_0xe453('0x1'));var zipdir=require(_0xe453('0x2'));var jsonpatch=require(_0xe453('0x3'));var rp=require(_0xe453('0x4'));var moment=require(_0xe453('0x5'));var BPromise=require(_0xe453('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe453('0x7'));var sox=require(_0xe453('0x8'));var csv=require(_0xe453('0x9'));var ejs=require(_0xe453('0xa'));var fs=require('fs');var fs_extra=require(_0xe453('0xb'));var _=require(_0xe453('0xc'));var squel=require('squel');var crypto=require(_0xe453('0xd'));var jsforce=require(_0xe453('0xe'));var deskjs=require(_0xe453('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe453('0x10'));var Papa=require('papaparse');var Redis=require(_0xe453('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe453('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe453('0x13'))(_0xe453('0x14'));var utils=require(_0xe453('0x15'));var config=require(_0xe453('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe453('0x17'))['db'];config[_0xe453('0x18')]=_[_0xe453('0x19')](config['redis'],{'host':_0xe453('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe453('0x18')]));require(_0xe453('0x1b'))[_0xe453('0x1c')](socket);function respondWithStatusCode(_0x1d8d57,_0x46c182){_0x46c182=_0x46c182||0xcc;return function(_0x1a77d2){if(_0x1a77d2){return _0x1d8d57[_0xe453('0x1d')](_0x46c182);}return _0x1d8d57[_0xe453('0x1e')](_0x46c182)[_0xe453('0x1f')]();};}function respondWithResult(_0x4ebab9,_0x4786c5){_0x4786c5=_0x4786c5||0xc8;return function(_0x303e70){if(_0x303e70){return _0x4ebab9['status'](_0x4786c5)['json'](_0x303e70);}};}function respondWithFilteredResult(_0x28e145,_0x3b906f){return function(_0x20ed82){if(_0x20ed82){var _0x50a1d8=typeof _0x3b906f['offset']===_0xe453('0x20')&&typeof _0x3b906f['limit']===_0xe453('0x20');var _0xf00fb0=_0x20ed82[_0xe453('0x21')];var _0x40969f=_0x50a1d8?0x0:_0x3b906f[_0xe453('0x22')];var _0x52031e=_0x50a1d8?_0x20ed82['count']:_0x3b906f['offset']+_0x3b906f[_0xe453('0x23')];var _0x1511ed;if(_0x52031e>=_0xf00fb0){_0x52031e=_0xf00fb0;_0x1511ed=0xc8;}else{_0x1511ed=0xce;}_0x28e145[_0xe453('0x1e')](_0x1511ed);return _0x28e145['set']('Content-Range',_0x40969f+'-'+_0x52031e+'/'+_0xf00fb0)['json'](_0x20ed82);}return null;};}function patchUpdates(_0x574c3e){return function(_0x1324a){try{jsonpatch[_0xe453('0x24')](_0x1324a,_0x574c3e,!![]);}catch(_0x43edec){return BPromise[_0xe453('0x25')](_0x43edec);}return _0x1324a[_0xe453('0x26')]();};}function saveUpdates(_0x554ff2,_0x482559){return function(_0x57f33d){if(_0x57f33d){return _0x57f33d[_0xe453('0x27')](_0x554ff2)[_0xe453('0x28')](function(_0x4b1926){return _0x4b1926;});}return null;};}function removeEntity(_0x461852,_0x571bab){return function(_0x40da9e){if(_0x40da9e){return _0x40da9e[_0xe453('0x29')]()[_0xe453('0x28')](function(){_0x461852[_0xe453('0x1e')](0xcc)[_0xe453('0x1f')]();});}};}function handleEntityNotFound(_0x21110a,_0x4d1960){return function(_0x48c424){if(!_0x48c424){_0x21110a[_0xe453('0x1d')](0x194);}return _0x48c424;};}function handleError(_0x2393e2,_0x198a95){_0x198a95=_0x198a95||0x1f4;return function(_0x51c260){logger['error'](_0x51c260[_0xe453('0x2a')]);if(_0x51c260[_0xe453('0x2b')]){delete _0x51c260[_0xe453('0x2b')];}_0x2393e2[_0xe453('0x1e')](_0x198a95)['send'](_0x51c260);};}exports[_0xe453('0x2c')]=function(_0x417925,_0x324840){var _0x30c2c4={},_0x5b0966={},_0xc436ab={'count':0x0,'rows':[]};var _0x2575a1=_[_0xe453('0x2d')](db[_0xe453('0x2e')][_0xe453('0x2f')],function(_0x2bf259){return{'name':_0x2bf259[_0xe453('0x30')],'type':_0x2bf259['type'][_0xe453('0x31')]};});_0x5b0966[_0xe453('0x32')]=_[_0xe453('0x2d')](_0x2575a1,_0xe453('0x2b'));_0x5b0966[_0xe453('0x33')]=_[_0xe453('0x34')](_0x417925[_0xe453('0x33')]);_0x5b0966['filters']=_['intersection'](_0x5b0966['model'],_0x5b0966[_0xe453('0x33')]);_0x30c2c4[_0xe453('0x35')]=_[_0xe453('0x36')](_0x5b0966[_0xe453('0x32')],qs[_0xe453('0x37')](_0x417925[_0xe453('0x33')][_0xe453('0x37')]));_0x30c2c4[_0xe453('0x35')]=_0x30c2c4[_0xe453('0x35')]['length']?_0x30c2c4['attributes']:_0x5b0966[_0xe453('0x32')];if(!_0x417925[_0xe453('0x33')]['hasOwnProperty'](_0xe453('0x38'))){_0x30c2c4['limit']=qs[_0xe453('0x23')](_0x417925[_0xe453('0x33')]['limit']);_0x30c2c4[_0xe453('0x22')]=qs[_0xe453('0x22')](_0x417925[_0xe453('0x33')][_0xe453('0x22')]);}_0x30c2c4[_0xe453('0x39')]=qs[_0xe453('0x3a')](_0x417925[_0xe453('0x33')]['sort']);_0x30c2c4[_0xe453('0x3b')]=qs[_0xe453('0x3c')](_[_0xe453('0x3d')](_0x417925['query'],_0x5b0966[_0xe453('0x3c')]),_0x2575a1);if(_0x417925['query'][_0xe453('0x3e')]){_0x30c2c4[_0xe453('0x3b')]=_['merge'](_0x30c2c4[_0xe453('0x3b')],{'$or':_[_0xe453('0x2d')](_0x2575a1,function(_0x343e10){if(_0x343e10['type']!==_0xe453('0x3f')){var _0x385ddb={};_0x385ddb[_0x343e10[_0xe453('0x2b')]]={'$like':'%'+_0x417925['query'][_0xe453('0x3e')]+'%'};return _0x385ddb;}})});}_0x30c2c4=_['merge']({},_0x30c2c4,_0x417925[_0xe453('0x40')]);var _0x1ab2fa={'where':_0x30c2c4['where']};return db['VoiceQueueReport'][_0xe453('0x21')](_0x1ab2fa)[_0xe453('0x28')](function(_0x237027){_0xc436ab[_0xe453('0x21')]=_0x237027;if(_0x417925[_0xe453('0x33')][_0xe453('0x41')]){_0x30c2c4[_0xe453('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xe453('0x43')](_0x30c2c4);})[_0xe453('0x28')](function(_0x5651d6){_0xc436ab[_0xe453('0x44')]=_0x5651d6;return _0xc436ab;})['then'](respondWithFilteredResult(_0x324840,_0x30c2c4))['catch'](handleError(_0x324840,null));};exports['show']=function(_0x30d29a,_0x55241e){var _0x3b7782={'raw':![],'where':{'id':_0x30d29a[_0xe453('0x45')]['id']}},_0x9422d={};_0x9422d[_0xe453('0x32')]=_['keys'](db['VoiceQueueReport'][_0xe453('0x2f')]);_0x9422d['query']=_[_0xe453('0x34')](_0x30d29a[_0xe453('0x33')]);_0x9422d[_0xe453('0x3c')]=_['intersection'](_0x9422d[_0xe453('0x32')],_0x9422d[_0xe453('0x33')]);_0x3b7782[_0xe453('0x35')]=_[_0xe453('0x36')](_0x9422d[_0xe453('0x32')],qs[_0xe453('0x37')](_0x30d29a['query'][_0xe453('0x37')]));_0x3b7782['attributes']=_0x3b7782['attributes'][_0xe453('0x46')]?_0x3b7782[_0xe453('0x35')]:_0x9422d[_0xe453('0x32')];if(_0x30d29a[_0xe453('0x33')][_0xe453('0x41')]){_0x3b7782[_0xe453('0x42')]=[{'all':!![]}];}_0x3b7782=_['merge']({},_0x3b7782,_0x30d29a[_0xe453('0x40')]);return db[_0xe453('0x2e')]['find'](_0x3b7782)[_0xe453('0x28')](handleEntityNotFound(_0x55241e,null))[_0xe453('0x28')](respondWithResult(_0x55241e,null))[_0xe453('0x47')](handleError(_0x55241e,null));};exports[_0xe453('0x48')]=function(_0x40c802,_0x3e5e87){return db[_0xe453('0x2e')][_0xe453('0x48')](_0x40c802[_0xe453('0x49')],{})[_0xe453('0x28')](respondWithResult(_0x3e5e87,0xc9))['catch'](handleError(_0x3e5e87,null));};exports[_0xe453('0x27')]=function(_0x3b9352,_0x515dc0){if(_0x3b9352[_0xe453('0x49')]['id']){delete _0x3b9352[_0xe453('0x49')]['id'];}return db[_0xe453('0x2e')][_0xe453('0x4a')]({'where':{'id':_0x3b9352[_0xe453('0x45')]['id']}})[_0xe453('0x28')](handleEntityNotFound(_0x515dc0,null))[_0xe453('0x28')](saveUpdates(_0x3b9352[_0xe453('0x49')],null))['then'](respondWithResult(_0x515dc0,null))[_0xe453('0x47')](handleError(_0x515dc0,null));};exports[_0xe453('0x29')]=function(_0x51ea67,_0x35c430){return db[_0xe453('0x2e')][_0xe453('0x4a')]({'where':{'id':_0x51ea67['params']['id']}})['then'](handleEntityNotFound(_0x35c430,null))[_0xe453('0x28')](removeEntity(_0x35c430,null))['catch'](handleError(_0x35c430,null));};exports[_0xe453('0x4b')]=function(_0x4d3419,_0x46277a){return db['VoiceQueueReport']['describe']()[_0xe453('0x28')](respondWithResult(_0x46277a,null))[_0xe453('0x47')](handleError(_0x46277a,null));};exports[_0xe453('0x4c')]=function(_0x4f0691,_0x4fe41e){var _0x15bb07={},_0xec64df={},_0x5f0aab={'count':0x0,'rows':[]};_0xec64df[_0xe453('0x32')]=_[_0xe453('0x34')](db[_0xe453('0x2e')][_0xe453('0x2f')]);_0xec64df[_0xe453('0x33')]=_[_0xe453('0x34')](_0x4f0691['query']);_0xec64df[_0xe453('0x3c')]=_[_0xe453('0x36')](_0xec64df[_0xe453('0x32')],_0xec64df[_0xe453('0x33')]);_0x15bb07['attributes']=_[_0xe453('0x36')](_0xec64df['model'],qs[_0xe453('0x37')](_0x4f0691[_0xe453('0x33')]['fields']));_0x15bb07[_0xe453('0x35')]=_0x15bb07[_0xe453('0x35')][_0xe453('0x46')]?_0x15bb07[_0xe453('0x35')]:_0xec64df[_0xe453('0x32')];if(!_0x4f0691[_0xe453('0x33')][_0xe453('0x4d')](_0xe453('0x38'))){_0x15bb07['limit']=qs[_0xe453('0x23')](_0x4f0691[_0xe453('0x33')][_0xe453('0x23')]);_0x15bb07[_0xe453('0x22')]=qs[_0xe453('0x22')](_0x4f0691[_0xe453('0x33')]['offset']);}_0x15bb07[_0xe453('0x39')]=qs['sort'](_0x4f0691['query'][_0xe453('0x3a')]);_0x15bb07[_0xe453('0x3b')]=qs[_0xe453('0x3c')](_['pick'](_0x4f0691[_0xe453('0x33')],_0xec64df[_0xe453('0x3c')]));if(_0x4f0691[_0xe453('0x33')][_0xe453('0x3e')]){_0x15bb07[_0xe453('0x3b')]=_[_0xe453('0x4e')](_0x15bb07[_0xe453('0x3b')],{'$or':_[_0xe453('0x2d')](_0x15bb07[_0xe453('0x35')],function(_0x2d05e8){var _0x5db4ba={};_0x5db4ba[_0x2d05e8]={'$like':'%'+_0x4f0691[_0xe453('0x33')][_0xe453('0x3e')]+'%'};return _0x5db4ba;})});}_0x15bb07=_['merge']({},_0x15bb07,_0x4f0691[_0xe453('0x40')]);var _0x130cd8={'where':_0x15bb07['where']};return db['VoiceQueueReport'][_0xe453('0x21')](_0x130cd8)[_0xe453('0x28')](function(_0x5bd0f5){_0x5f0aab[_0xe453('0x21')]=_0x5bd0f5;if(_0x4f0691[_0xe453('0x33')][_0xe453('0x41')]){_0x15bb07[_0xe453('0x42')]=[{'all':!![]}];}return db[_0xe453('0x2e')][_0xe453('0x43')](_0x15bb07);})[_0xe453('0x28')](function(_0x10e0f3){_0x5f0aab[_0xe453('0x44')]=_0x10e0f3;return _0x5f0aab;})['then'](respondWithFilteredResult(_0x4fe41e,_0x15bb07,_0xe453('0x4c')))[_0xe453('0x47')](handleError(_0x4fe41e,null,_0xe453('0x4c')));}; \ No newline at end of file +var _0xc00c=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','error','name','send','index','VoiceQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','options','find','create','body','catch','update','describe','getVoiceQueuesReport','eml-format','rimraf','fast-json-patch'];(function(_0x4fb76a,_0x280733){var _0x58eead=function(_0x153858){while(--_0x153858){_0x4fb76a['push'](_0x4fb76a['shift']());}};_0x58eead(++_0x280733);}(_0xc00c,0x18d));var _0xcc00=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xc00c[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0xcc00('0x0'));var rimraf=require(_0xcc00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc00('0x2'));var rp=require('request-promise');var moment=require(_0xcc00('0x3'));var BPromise=require(_0xcc00('0x4'));var Mustache=require(_0xcc00('0x5'));var util=require('util');var path=require(_0xcc00('0x6'));var sox=require(_0xcc00('0x7'));var csv=require('to-csv');var ejs=require(_0xcc00('0x8'));var fs=require('fs');var fs_extra=require(_0xcc00('0x9'));var _=require(_0xcc00('0xa'));var squel=require(_0xcc00('0xb'));var crypto=require(_0xcc00('0xc'));var jsforce=require(_0xcc00('0xd'));var deskjs=require(_0xcc00('0xe'));var toCsv=require(_0xcc00('0xf'));var querystring=require(_0xcc00('0x10'));var Papa=require('papaparse');var Redis=require(_0xcc00('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc00('0x12'));var as=require(_0xcc00('0x13'));var hardwareService=require(_0xcc00('0x14'));var logger=require(_0xcc00('0x15'))(_0xcc00('0x16'));var utils=require(_0xcc00('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcc00('0x18'))['db'];config[_0xcc00('0x19')]=_['defaults'](config[_0xcc00('0x19')],{'host':_0xcc00('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcc00('0x1b'))[_0xcc00('0x1c')](socket);function respondWithStatusCode(_0x5a52bd,_0x333c8c){_0x333c8c=_0x333c8c||0xcc;return function(_0x403363){if(_0x403363){return _0x5a52bd[_0xcc00('0x1d')](_0x333c8c);}return _0x5a52bd[_0xcc00('0x1e')](_0x333c8c)[_0xcc00('0x1f')]();};}function respondWithResult(_0x6b6bcd,_0x5cd843){_0x5cd843=_0x5cd843||0xc8;return function(_0x41d87e){if(_0x41d87e){return _0x6b6bcd['status'](_0x5cd843)[_0xcc00('0x20')](_0x41d87e);}};}function respondWithFilteredResult(_0x4302fc,_0x3ff0b0){return function(_0xd2d9be){if(_0xd2d9be){var _0x4bd6fb=typeof _0x3ff0b0[_0xcc00('0x21')]==='undefined'&&typeof _0x3ff0b0[_0xcc00('0x22')]===_0xcc00('0x23');var _0x1ad74c=_0xd2d9be['count'];var _0x32f4bc=_0x4bd6fb?0x0:_0x3ff0b0['offset'];var _0x508cea=_0x4bd6fb?_0xd2d9be[_0xcc00('0x24')]:_0x3ff0b0[_0xcc00('0x21')]+_0x3ff0b0[_0xcc00('0x22')];var _0x650015;if(_0x508cea>=_0x1ad74c){_0x508cea=_0x1ad74c;_0x650015=0xc8;}else{_0x650015=0xce;}_0x4302fc[_0xcc00('0x1e')](_0x650015);return _0x4302fc[_0xcc00('0x25')]('Content-Range',_0x32f4bc+'-'+_0x508cea+'/'+_0x1ad74c)[_0xcc00('0x20')](_0xd2d9be);}return null;};}function patchUpdates(_0x4ffa06){return function(_0x29d397){try{jsonpatch[_0xcc00('0x26')](_0x29d397,_0x4ffa06,!![]);}catch(_0xf495a2){return BPromise[_0xcc00('0x27')](_0xf495a2);}return _0x29d397[_0xcc00('0x28')]();};}function saveUpdates(_0x4fd9da,_0x3f5269){return function(_0x1f4b35){if(_0x1f4b35){return _0x1f4b35['update'](_0x4fd9da)[_0xcc00('0x29')](function(_0x3f3627){return _0x3f3627;});}return null;};}function removeEntity(_0x503515,_0x4b7fed){return function(_0xc200ff){if(_0xc200ff){return _0xc200ff[_0xcc00('0x2a')]()[_0xcc00('0x29')](function(){_0x503515[_0xcc00('0x1e')](0xcc)[_0xcc00('0x1f')]();});}};}function handleEntityNotFound(_0x2c51ac,_0x4b7690){return function(_0x59af94){if(!_0x59af94){_0x2c51ac['sendStatus'](0x194);}return _0x59af94;};}function handleError(_0xd3bbf5,_0x120f4d){_0x120f4d=_0x120f4d||0x1f4;return function(_0x14eef0){logger[_0xcc00('0x2b')](_0x14eef0['stack']);if(_0x14eef0[_0xcc00('0x2c')]){delete _0x14eef0[_0xcc00('0x2c')];}_0xd3bbf5[_0xcc00('0x1e')](_0x120f4d)[_0xcc00('0x2d')](_0x14eef0);};}exports[_0xcc00('0x2e')]=function(_0x47a4ee,_0x352d47){var _0x368cde={},_0x8178ba={},_0x2805bb={'count':0x0,'rows':[]};var _0x3aef2c=_['map'](db[_0xcc00('0x2f')][_0xcc00('0x30')],function(_0x204017){return{'name':_0x204017[_0xcc00('0x31')],'type':_0x204017['type'][_0xcc00('0x32')]};});_0x8178ba[_0xcc00('0x33')]=_[_0xcc00('0x34')](_0x3aef2c,'name');_0x8178ba[_0xcc00('0x35')]=_[_0xcc00('0x36')](_0x47a4ee[_0xcc00('0x35')]);_0x8178ba[_0xcc00('0x37')]=_[_0xcc00('0x38')](_0x8178ba['model'],_0x8178ba[_0xcc00('0x35')]);_0x368cde[_0xcc00('0x39')]=_['intersection'](_0x8178ba[_0xcc00('0x33')],qs[_0xcc00('0x3a')](_0x47a4ee[_0xcc00('0x35')][_0xcc00('0x3a')]));_0x368cde[_0xcc00('0x39')]=_0x368cde[_0xcc00('0x39')][_0xcc00('0x3b')]?_0x368cde[_0xcc00('0x39')]:_0x8178ba[_0xcc00('0x33')];if(!_0x47a4ee[_0xcc00('0x35')]['hasOwnProperty']('nolimit')){_0x368cde[_0xcc00('0x22')]=qs[_0xcc00('0x22')](_0x47a4ee[_0xcc00('0x35')][_0xcc00('0x22')]);_0x368cde[_0xcc00('0x21')]=qs[_0xcc00('0x21')](_0x47a4ee[_0xcc00('0x35')][_0xcc00('0x21')]);}_0x368cde[_0xcc00('0x3c')]=qs[_0xcc00('0x3d')](_0x47a4ee[_0xcc00('0x35')]['sort']);_0x368cde[_0xcc00('0x3e')]=qs[_0xcc00('0x37')](_['pick'](_0x47a4ee['query'],_0x8178ba['filters']),_0x3aef2c);if(_0x47a4ee[_0xcc00('0x35')][_0xcc00('0x3f')]){_0x368cde[_0xcc00('0x3e')]=_[_0xcc00('0x40')](_0x368cde[_0xcc00('0x3e')],{'$or':_[_0xcc00('0x34')](_0x3aef2c,function(_0x531875){if(_0x531875[_0xcc00('0x41')]!==_0xcc00('0x42')){var _0x35ddeb={};_0x35ddeb[_0x531875[_0xcc00('0x2c')]]={'$like':'%'+_0x47a4ee['query'][_0xcc00('0x3f')]+'%'};return _0x35ddeb;}})});}_0x368cde=_['merge']({},_0x368cde,_0x47a4ee['options']);var _0x44ec6f={'where':_0x368cde[_0xcc00('0x3e')]};return db['VoiceQueueReport']['count'](_0x44ec6f)['then'](function(_0x32c805){_0x2805bb[_0xcc00('0x24')]=_0x32c805;if(_0x47a4ee[_0xcc00('0x35')][_0xcc00('0x43')]){_0x368cde[_0xcc00('0x44')]=[{'all':!![]}];}return db[_0xcc00('0x2f')]['findAll'](_0x368cde);})[_0xcc00('0x29')](function(_0x50df4c){_0x2805bb[_0xcc00('0x45')]=_0x50df4c;return _0x2805bb;})[_0xcc00('0x29')](respondWithFilteredResult(_0x352d47,_0x368cde))['catch'](handleError(_0x352d47,null));};exports[_0xcc00('0x46')]=function(_0x45b8ec,_0x2d82fe){var _0x250f70={'raw':![],'where':{'id':_0x45b8ec[_0xcc00('0x47')]['id']}},_0x1f51d3={};_0x1f51d3[_0xcc00('0x33')]=_[_0xcc00('0x36')](db[_0xcc00('0x2f')][_0xcc00('0x30')]);_0x1f51d3[_0xcc00('0x35')]=_[_0xcc00('0x36')](_0x45b8ec[_0xcc00('0x35')]);_0x1f51d3[_0xcc00('0x37')]=_[_0xcc00('0x38')](_0x1f51d3['model'],_0x1f51d3[_0xcc00('0x35')]);_0x250f70['attributes']=_[_0xcc00('0x38')](_0x1f51d3[_0xcc00('0x33')],qs[_0xcc00('0x3a')](_0x45b8ec[_0xcc00('0x35')][_0xcc00('0x3a')]));_0x250f70[_0xcc00('0x39')]=_0x250f70[_0xcc00('0x39')][_0xcc00('0x3b')]?_0x250f70[_0xcc00('0x39')]:_0x1f51d3[_0xcc00('0x33')];if(_0x45b8ec['query'][_0xcc00('0x43')]){_0x250f70[_0xcc00('0x44')]=[{'all':!![]}];}_0x250f70=_['merge']({},_0x250f70,_0x45b8ec[_0xcc00('0x48')]);return db[_0xcc00('0x2f')][_0xcc00('0x49')](_0x250f70)['then'](handleEntityNotFound(_0x2d82fe,null))[_0xcc00('0x29')](respondWithResult(_0x2d82fe,null))['catch'](handleError(_0x2d82fe,null));};exports[_0xcc00('0x4a')]=function(_0x4637c3,_0x348a71){return db['VoiceQueueReport'][_0xcc00('0x4a')](_0x4637c3[_0xcc00('0x4b')],{})[_0xcc00('0x29')](respondWithResult(_0x348a71,0xc9))[_0xcc00('0x4c')](handleError(_0x348a71,null));};exports[_0xcc00('0x4d')]=function(_0x29d399,_0x27731c){if(_0x29d399[_0xcc00('0x4b')]['id']){delete _0x29d399['body']['id'];}return db[_0xcc00('0x2f')][_0xcc00('0x49')]({'where':{'id':_0x29d399[_0xcc00('0x47')]['id']}})['then'](handleEntityNotFound(_0x27731c,null))[_0xcc00('0x29')](saveUpdates(_0x29d399[_0xcc00('0x4b')],null))['then'](respondWithResult(_0x27731c,null))[_0xcc00('0x4c')](handleError(_0x27731c,null));};exports[_0xcc00('0x2a')]=function(_0x40a5dd,_0x3888cd){return db[_0xcc00('0x2f')]['find']({'where':{'id':_0x40a5dd[_0xcc00('0x47')]['id']}})[_0xcc00('0x29')](handleEntityNotFound(_0x3888cd,null))[_0xcc00('0x29')](removeEntity(_0x3888cd,null))[_0xcc00('0x4c')](handleError(_0x3888cd,null));};exports['describe']=function(_0x3ba88b,_0x190e9a){return db[_0xcc00('0x2f')][_0xcc00('0x4e')]()[_0xcc00('0x29')](respondWithResult(_0x190e9a,null))[_0xcc00('0x4c')](handleError(_0x190e9a,null));};exports[_0xcc00('0x4f')]=function(_0x4beebc,_0x2a89a9){var _0x18e9d2={},_0x15d899={},_0x146da0={'count':0x0,'rows':[]};_0x15d899[_0xcc00('0x33')]=_[_0xcc00('0x36')](db[_0xcc00('0x2f')][_0xcc00('0x30')]);_0x15d899[_0xcc00('0x35')]=_[_0xcc00('0x36')](_0x4beebc['query']);_0x15d899[_0xcc00('0x37')]=_[_0xcc00('0x38')](_0x15d899[_0xcc00('0x33')],_0x15d899['query']);_0x18e9d2['attributes']=_[_0xcc00('0x38')](_0x15d899[_0xcc00('0x33')],qs['fields'](_0x4beebc[_0xcc00('0x35')][_0xcc00('0x3a')]));_0x18e9d2[_0xcc00('0x39')]=_0x18e9d2[_0xcc00('0x39')][_0xcc00('0x3b')]?_0x18e9d2[_0xcc00('0x39')]:_0x15d899[_0xcc00('0x33')];if(!_0x4beebc['query']['hasOwnProperty']('nolimit')){_0x18e9d2[_0xcc00('0x22')]=qs[_0xcc00('0x22')](_0x4beebc[_0xcc00('0x35')][_0xcc00('0x22')]);_0x18e9d2[_0xcc00('0x21')]=qs['offset'](_0x4beebc[_0xcc00('0x35')]['offset']);}_0x18e9d2['order']=qs[_0xcc00('0x3d')](_0x4beebc['query'][_0xcc00('0x3d')]);_0x18e9d2[_0xcc00('0x3e')]=qs[_0xcc00('0x37')](_['pick'](_0x4beebc[_0xcc00('0x35')],_0x15d899['filters']));if(_0x4beebc[_0xcc00('0x35')]['filter']){_0x18e9d2['where']=_[_0xcc00('0x40')](_0x18e9d2[_0xcc00('0x3e')],{'$or':_['map'](_0x18e9d2[_0xcc00('0x39')],function(_0x2037c0){var _0x28acf3={};_0x28acf3[_0x2037c0]={'$like':'%'+_0x4beebc[_0xcc00('0x35')][_0xcc00('0x3f')]+'%'};return _0x28acf3;})});}_0x18e9d2=_[_0xcc00('0x40')]({},_0x18e9d2,_0x4beebc[_0xcc00('0x48')]);var _0x5ec944={'where':_0x18e9d2[_0xcc00('0x3e')]};return db[_0xcc00('0x2f')]['count'](_0x5ec944)[_0xcc00('0x29')](function(_0x4dc605){_0x146da0[_0xcc00('0x24')]=_0x4dc605;if(_0x4beebc[_0xcc00('0x35')][_0xcc00('0x43')]){_0x18e9d2[_0xcc00('0x44')]=[{'all':!![]}];}return db[_0xcc00('0x2f')]['findAll'](_0x18e9d2);})[_0xcc00('0x29')](function(_0x4a5545){_0x146da0[_0xcc00('0x45')]=_0x4a5545;return _0x146da0;})[_0xcc00('0x29')](respondWithFilteredResult(_0x2a89a9,_0x18e9d2,_0xcc00('0x4f')))[_0xcc00('0x4c')](handleError(_0x2a89a9,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f09b30b..2f1c926 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 _0x102c=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueueReport','save'];(function(_0x411b5e,_0x4710ba){var _0xe38727=function(_0xc67dfa){while(--_0xc67dfa){_0x411b5e['push'](_0x411b5e['shift']());}};_0xe38727(++_0x4710ba);}(_0x102c,0x1eb));var _0xc102=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x102c[_0x397cfb];return _0x15fed9;};'use strict';var EventEmitter=require(_0xc102('0x0'));var VoiceQueueReport=require(_0xc102('0x1'))['db'][_0xc102('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc102('0x3'),'afterUpdate':_0xc102('0x4'),'afterDestroy':_0xc102('0x5')};function emitEvent(_0xc2ad5b){return function(_0x51104b,_0x5a47e3,_0xeb3b8b){VoiceQueueReportEvents['emit'](_0xc2ad5b+':'+_0x51104b['id'],_0x51104b);VoiceQueueReportEvents[_0xc102('0x6')](_0xc2ad5b,_0x51104b);_0xeb3b8b(null);};}for(var e in events){if(events[_0xc102('0x7')](e)){var event=events[e];VoiceQueueReport[_0xc102('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x057f=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x057f,0xaa));var _0xf057=function(_0x567248,_0x4e4d75){_0x567248=_0x567248-0x0;var _0x20a156=_0x057f[_0x567248];return _0x20a156;};'use strict';var EventEmitter=require(_0xf057('0x0'));var VoiceQueueReport=require(_0xf057('0x1'))['db'][_0xf057('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf057('0x3')](0x0);var events={'afterCreate':_0xf057('0x4'),'afterUpdate':'update','afterDestroy':_0xf057('0x5')};function emitEvent(_0x3a0b9d){return function(_0x29080e,_0x1483ed,_0x1a735e){VoiceQueueReportEvents[_0xf057('0x6')](_0x3a0b9d+':'+_0x29080e['id'],_0x29080e);VoiceQueueReportEvents[_0xf057('0x6')](_0x3a0b9d,_0x29080e);_0x1a735e(null);};}for(var e in events){if(events[_0xf057('0x7')](e)){var event=events[e];VoiceQueueReport[_0xf057('0x8')](e,emitEvent(event));}}module[_0xf057('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 5eaa6b0..b199b00 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 _0x925c=['exports','define','report_queue','uniqueid','calleridnum','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x925c,0x15a));var _0xc925=function(_0x37643f,_0x194b27){_0x37643f=_0x37643f-0x0;var _0x4b01d2=_0x925c[_0x37643f];return _0x4b01d2;};'use strict';var _=require('lodash');var util=require(_0xc925('0x0'));var logger=require('../../config/logger')(_0xc925('0x1'));var moment=require('moment');var BPromise=require(_0xc925('0x2'));var rp=require(_0xc925('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc925('0x4'));var config=require(_0xc925('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0xc925('0x6')]=function(_0x55c66a,_0x27710d){return _0x55c66a[_0xc925('0x7')]('VoiceQueueReport',attributes,{'tableName':_0xc925('0x8'),'paranoid':![],'indexes':[{'fields':[_0xc925('0x9')]},{'fields':[_0xc925('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa65=['uniqueid','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','VoiceQueueReport'];(function(_0x596650,_0x4ab6e8){var _0xd1e426=function(_0x385e4c){while(--_0x385e4c){_0x596650['push'](_0x596650['shift']());}};_0xd1e426(++_0x4ab6e8);}(_0xfa65,0x97));var _0x5fa6=function(_0x526487,_0x321b12){_0x526487=_0x526487-0x0;var _0x1aca63=_0xfa65[_0x526487];return _0x1aca63;};'use strict';var _=require('lodash');var util=require(_0x5fa6('0x0'));var logger=require(_0x5fa6('0x1'))(_0x5fa6('0x2'));var moment=require('moment');var BPromise=require(_0x5fa6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5fa6('0x4'));var config=require(_0x5fa6('0x5'));var attributes=require('./voiceQueueReport.attributes');module[_0x5fa6('0x6')]=function(_0x3257e1,_0x3de8ea){return _0x3257e1[_0x5fa6('0x7')](_0x5fa6('0x8'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x5fa6('0x9')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index f7c0570..4f53d55 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 _0x6360=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','include','attributes','map','model','then','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0xbb320a,_0x2fe710){var _0x5f36dc=function(_0x17349a){while(--_0x17349a){_0xbb320a['push'](_0xbb320a['shift']());}};_0x5f36dc(++_0x2fe710);}(_0x6360,0x1db));var _0x0636=function(_0x59da1c,_0x4bcb6c){_0x59da1c=_0x59da1c-0x0;var _0x23e374=_0x6360[_0x59da1c];return _0x23e374;};'use strict';var _=require(_0x0636('0x0'));var util=require('util');var moment=require(_0x0636('0x1'));var BPromise=require(_0x0636('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0636('0x3'));var db=require(_0x0636('0x4'))['db'];var utils=require(_0x0636('0x5'));var logger=require(_0x0636('0x6'))('rpc');var config=require(_0x0636('0x7'));var jayson=require(_0x0636('0x8'));var client=jayson['client'][_0x0636('0x9')]({'port':0x232a});config[_0x0636('0xa')]=_[_0x0636('0xb')](config[_0x0636('0xa')],{'host':_0x0636('0xc'),'port':0x18eb});var socket=require(_0x0636('0xd'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x2b290f,_0x368d29,_0x47946d){return new BPromise(function(_0xd9fe85,_0x123812){return client['request'](_0x2b290f,_0x47946d)['then'](function(_0x1e0adf){logger[_0x0636('0xe')](_0x0636('0xf'),_0x368d29,_0x0636('0x10'));logger[_0x0636('0x11')](_0x0636('0x12'),_0x368d29,'request\x20sent',JSON[_0x0636('0x13')](_0x1e0adf));if(_0x1e0adf[_0x0636('0x14')]){if(_0x1e0adf[_0x0636('0x14')][_0x0636('0x15')]===0x1f4){logger[_0x0636('0x14')](_0x0636('0xf'),_0x368d29,_0x1e0adf[_0x0636('0x14')][_0x0636('0x16')]);return _0x123812(_0x1e0adf[_0x0636('0x14')]['message']);}logger[_0x0636('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x368d29,_0x1e0adf[_0x0636('0x14')]['message']);return _0xd9fe85(_0x1e0adf['error'][_0x0636('0x16')]);}else{logger[_0x0636('0xe')]('VoiceQueueReport,\x20%s,\x20%s',_0x368d29,_0x0636('0x10'));_0xd9fe85(_0x1e0adf['result'][_0x0636('0x16')]);}})[_0x0636('0x17')](function(_0xae7189){logger['error'](_0x0636('0xf'),_0x368d29,_0xae7189);_0x123812(_0xae7189);});});}exports[_0x0636('0x18')]=function(_0x531813){var _0x1ee3dc=this;return new Promise(function(_0x3b3e3e,_0x3e5bc5){return db[_0x0636('0x19')][_0x0636('0x1a')]({'raw':_0x531813[_0x0636('0x1b')]?_0x531813[_0x0636('0x1b')][_0x0636('0x1c')]===undefined?!![]:![]:!![],'where':_0x531813[_0x0636('0x1b')]?_0x531813[_0x0636('0x1b')]['where']||null:null,'attributes':_0x531813[_0x0636('0x1b')]?_0x531813[_0x0636('0x1b')]['attributes']||null:null,'limit':_0x531813[_0x0636('0x1b')]?_0x531813[_0x0636('0x1b')][_0x0636('0x1d')]||null:null,'include':_0x531813[_0x0636('0x1b')]?_0x531813[_0x0636('0x1b')][_0x0636('0x1e')]?_['map'](_0x531813[_0x0636('0x1b')][_0x0636('0x1e')],function(_0x43b810){return{'model':db[_0x43b810['model']],'as':_0x43b810['as'],'attributes':_0x43b810[_0x0636('0x1f')],'include':_0x43b810[_0x0636('0x1e')]?_[_0x0636('0x20')](_0x43b810[_0x0636('0x1e')],function(_0x42d54b){return{'model':db[_0x42d54b[_0x0636('0x21')]],'as':_0x42d54b['as'],'attributes':_0x42d54b[_0x0636('0x1f')],'include':_0x42d54b[_0x0636('0x1e')]?_[_0x0636('0x20')](_0x42d54b[_0x0636('0x1e')],function(_0x502ab7){return{'model':db[_0x502ab7[_0x0636('0x21')]],'as':_0x502ab7['as'],'attributes':_0x502ab7[_0x0636('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0636('0x22')](function(_0x1f0b61){logger[_0x0636('0xe')]('GetVoiceQueueReport',_0x531813);logger[_0x0636('0x11')](_0x0636('0x18'),_0x531813,JSON[_0x0636('0x13')](_0x1f0b61));_0x3b3e3e(_0x1f0b61);})['catch'](function(_0x2b94a9){logger[_0x0636('0x14')]('GetVoiceQueueReport',_0x2b94a9[_0x0636('0x16')],_0x531813);_0x3e5bc5(_0x1ee3dc[_0x0636('0x14')](0x1f4,_0x2b94a9[_0x0636('0x16')]));});});};exports[_0x0636('0x23')]=function(_0x1377a3){var _0xd0d21b=this;return new Promise(function(_0x1c7545,_0x391ec1){return db[_0x0636('0x19')][_0x0636('0x24')](_0x1377a3['body'],{'raw':_0x1377a3['options']?_0x1377a3['options'][_0x0636('0x1c')]===undefined?!![]:![]:!![]})[_0x0636('0x22')](function(_0x27fb38){logger[_0x0636('0xe')](_0x0636('0x23'),_0x1377a3);logger['debug'](_0x0636('0x23'),_0x1377a3,JSON[_0x0636('0x13')](_0x27fb38));_0x1c7545(_0x27fb38);})['catch'](function(_0x712894){logger[_0x0636('0x14')](_0x0636('0x23'),_0x712894[_0x0636('0x16')],_0x1377a3);_0x391ec1(_0xd0d21b['error'](0x1f4,_0x712894[_0x0636('0x16')]));});});};exports[_0x0636('0x25')]=function(_0x54eb67){var _0x3836b4=this;return new Promise(function(_0xb04423,_0x110283){return db[_0x0636('0x19')][_0x0636('0x26')](_0x54eb67[_0x0636('0x27')],{'raw':_0x54eb67[_0x0636('0x1b')]?_0x54eb67[_0x0636('0x1b')][_0x0636('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54eb67[_0x0636('0x1b')]?_0x54eb67[_0x0636('0x1b')]['where']||null:null,'attributes':_0x54eb67[_0x0636('0x1b')]?_0x54eb67[_0x0636('0x1b')][_0x0636('0x1f')]||null:null,'limit':_0x54eb67[_0x0636('0x1b')]?_0x54eb67['options']['limit']||null:null})[_0x0636('0x22')](function(_0x1d0b4f){logger[_0x0636('0xe')]('UpdateVoiceQueueReport',_0x54eb67);logger[_0x0636('0x11')](_0x0636('0x25'),_0x54eb67,JSON[_0x0636('0x13')](_0x1d0b4f));_0xb04423(_0x1d0b4f);})[_0x0636('0x17')](function(_0x4d3c33){logger[_0x0636('0x14')]('UpdateVoiceQueueReport',_0x4d3c33[_0x0636('0x16')],_0x54eb67);_0x110283(_0x3836b4[_0x0636('0x14')](0x1f4,_0x4d3c33[_0x0636('0x16')]));});});}; \ No newline at end of file +var _0x3311=['model','stringify','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','map'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3311,0x1b5));var _0x1331=function(_0x4e4e49,_0x5dc466){_0x4e4e49=_0x4e4e49-0x0;var _0x671be=_0x3311[_0x4e4e49];return _0x671be;};'use strict';var _=require(_0x1331('0x0'));var util=require(_0x1331('0x1'));var moment=require(_0x1331('0x2'));var BPromise=require(_0x1331('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1331('0x4'));var db=require(_0x1331('0x5'))['db'];var utils=require(_0x1331('0x6'));var logger=require(_0x1331('0x7'))(_0x1331('0x8'));var config=require('../../config/environment');var jayson=require(_0x1331('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x1331('0xa')]=_['defaults'](config[_0x1331('0xa')],{'host':_0x1331('0xb'),'port':0x18eb});var socket=require(_0x1331('0xc'))(new Redis(config[_0x1331('0xa')]));require(_0x1331('0xd'))[_0x1331('0xe')](socket);function respondWithRpcPromise(_0x16a63e,_0x1657d7,_0x4f6a96){return new BPromise(function(_0x1479bf,_0x58376a){return client[_0x1331('0xf')](_0x16a63e,_0x4f6a96)[_0x1331('0x10')](function(_0x58a2ad){logger[_0x1331('0x11')](_0x1331('0x12'),_0x1657d7,_0x1331('0x13'));logger[_0x1331('0x14')](_0x1331('0x15'),_0x1657d7,_0x1331('0x13'),JSON['stringify'](_0x58a2ad));if(_0x58a2ad[_0x1331('0x16')]){if(_0x58a2ad[_0x1331('0x16')][_0x1331('0x17')]===0x1f4){logger[_0x1331('0x16')](_0x1331('0x12'),_0x1657d7,_0x58a2ad[_0x1331('0x16')][_0x1331('0x18')]);return _0x58376a(_0x58a2ad['error'][_0x1331('0x18')]);}logger[_0x1331('0x16')](_0x1331('0x12'),_0x1657d7,_0x58a2ad[_0x1331('0x16')][_0x1331('0x18')]);return _0x1479bf(_0x58a2ad[_0x1331('0x16')][_0x1331('0x18')]);}else{logger[_0x1331('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x1657d7,_0x1331('0x13'));_0x1479bf(_0x58a2ad[_0x1331('0x19')]['message']);}})[_0x1331('0x1a')](function(_0x351dcc){logger[_0x1331('0x16')](_0x1331('0x12'),_0x1657d7,_0x351dcc);_0x58376a(_0x351dcc);});});}exports[_0x1331('0x1b')]=function(_0x480137){var _0x123bad=this;return new Promise(function(_0x5cf456,_0x20cd4f){return db[_0x1331('0x1c')][_0x1331('0x1d')]({'raw':_0x480137[_0x1331('0x1e')]?_0x480137[_0x1331('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x480137[_0x1331('0x1e')]?_0x480137['options'][_0x1331('0x1f')]||null:null,'attributes':_0x480137['options']?_0x480137['options'][_0x1331('0x20')]||null:null,'limit':_0x480137['options']?_0x480137[_0x1331('0x1e')][_0x1331('0x21')]||null:null,'include':_0x480137['options']?_0x480137[_0x1331('0x1e')][_0x1331('0x22')]?_[_0x1331('0x23')](_0x480137[_0x1331('0x1e')][_0x1331('0x22')],function(_0x2513a3){return{'model':db[_0x2513a3[_0x1331('0x24')]],'as':_0x2513a3['as'],'attributes':_0x2513a3['attributes'],'include':_0x2513a3[_0x1331('0x22')]?_[_0x1331('0x23')](_0x2513a3[_0x1331('0x22')],function(_0x68db26){return{'model':db[_0x68db26[_0x1331('0x24')]],'as':_0x68db26['as'],'attributes':_0x68db26['attributes'],'include':_0x68db26[_0x1331('0x22')]?_[_0x1331('0x23')](_0x68db26[_0x1331('0x22')],function(_0x1517a9){return{'model':db[_0x1517a9[_0x1331('0x24')]],'as':_0x1517a9['as'],'attributes':_0x1517a9[_0x1331('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f360){logger[_0x1331('0x11')](_0x1331('0x1b'),_0x480137);logger[_0x1331('0x14')]('GetVoiceQueueReport',_0x480137,JSON[_0x1331('0x25')](_0x21f360));_0x5cf456(_0x21f360);})['catch'](function(_0xc66963){logger[_0x1331('0x16')](_0x1331('0x1b'),_0xc66963[_0x1331('0x18')],_0x480137);_0x20cd4f(_0x123bad[_0x1331('0x16')](0x1f4,_0xc66963['message']));});});};exports[_0x1331('0x26')]=function(_0x467752){var _0x32bb99=this;return new Promise(function(_0x7adbf2,_0xe0f4a){return db[_0x1331('0x1c')]['create'](_0x467752[_0x1331('0x27')],{'raw':_0x467752[_0x1331('0x1e')]?_0x467752['options'][_0x1331('0x28')]===undefined?!![]:![]:!![]})[_0x1331('0x10')](function(_0x1e0bc5){logger[_0x1331('0x11')](_0x1331('0x26'),_0x467752);logger[_0x1331('0x14')](_0x1331('0x26'),_0x467752,JSON[_0x1331('0x25')](_0x1e0bc5));_0x7adbf2(_0x1e0bc5);})[_0x1331('0x1a')](function(_0x195f52){logger[_0x1331('0x16')](_0x1331('0x26'),_0x195f52[_0x1331('0x18')],_0x467752);_0xe0f4a(_0x32bb99[_0x1331('0x16')](0x1f4,_0x195f52[_0x1331('0x18')]));});});};exports[_0x1331('0x29')]=function(_0x3e77a5){var _0x1134c4=this;return new Promise(function(_0x37a48b,_0x59244f){return db[_0x1331('0x1c')][_0x1331('0x2a')](_0x3e77a5['body'],{'raw':_0x3e77a5['options']?_0x3e77a5[_0x1331('0x1e')][_0x1331('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e77a5['options']?_0x3e77a5[_0x1331('0x1e')][_0x1331('0x1f')]||null:null,'attributes':_0x3e77a5[_0x1331('0x1e')]?_0x3e77a5['options'][_0x1331('0x20')]||null:null,'limit':_0x3e77a5[_0x1331('0x1e')]?_0x3e77a5[_0x1331('0x1e')][_0x1331('0x21')]||null:null})['then'](function(_0x37d06b){logger[_0x1331('0x11')](_0x1331('0x29'),_0x3e77a5);logger[_0x1331('0x14')](_0x1331('0x29'),_0x3e77a5,JSON[_0x1331('0x25')](_0x37d06b));_0x37a48b(_0x37d06b);})[_0x1331('0x1a')](function(_0x4e2660){logger['error'](_0x1331('0x29'),_0x4e2660[_0x1331('0x18')],_0x3e77a5);_0x59244f(_0x1134c4[_0x1331('0x16')](0x1f4,_0x4e2660['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 5ce9df8..2cc0ea5 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 _0xf3d0=['remove','update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xf3d0,0x1bf));var _0x0f3d=function(_0x58cb81,_0x2eff9e){_0x58cb81=_0x58cb81-0x0;var _0x584bd3=_0xf3d0[_0x58cb81];return _0x584bd3;};'use strict';var VoiceQueueReportEvents=require(_0x0f3d('0x0'));var events=['save',_0x0f3d('0x1'),_0x0f3d('0x2')];function createListener(_0x5c718c,_0x28f1ce){return function(_0x165e35){_0x28f1ce[_0x0f3d('0x3')](_0x5c718c,_0x165e35);};}function removeListener(_0x1b160f,_0x414425){return function(){VoiceQueueReportEvents[_0x0f3d('0x4')](_0x1b160f,_0x414425);};}exports[_0x0f3d('0x5')]=function(_0x6a86a1){for(var _0x26f57d=0x0,_0x55b185=events[_0x0f3d('0x6')];_0x26f57d<_0x55b185;_0x26f57d++){var _0x4817cb=events[_0x26f57d];var _0x47884f=createListener(_0x0f3d('0x7')+_0x4817cb,_0x6a86a1);VoiceQueueReportEvents['on'](_0x4817cb,_0x47884f);}}; \ No newline at end of file +var _0xf776=['length','./voiceQueueReport.events','remove','update','emit','removeListener'];(function(_0xe37cad,_0x9fcbdd){var _0x24593e=function(_0x4170bb){while(--_0x4170bb){_0xe37cad['push'](_0xe37cad['shift']());}};_0x24593e(++_0x9fcbdd);}(_0xf776,0x169));var _0x6f77=function(_0x55426d,_0x2f03f3){_0x55426d=_0x55426d-0x0;var _0xa506cf=_0xf776[_0x55426d];return _0xa506cf;};'use strict';var VoiceQueueReportEvents=require(_0x6f77('0x0'));var events=['save',_0x6f77('0x1'),_0x6f77('0x2')];function createListener(_0x4e3b77,_0x43f2fd){return function(_0x2458e0){_0x43f2fd[_0x6f77('0x3')](_0x4e3b77,_0x2458e0);};}function removeListener(_0x16874b,_0x53ec9b){return function(){VoiceQueueReportEvents[_0x6f77('0x4')](_0x16874b,_0x53ec9b);};}exports['register']=function(_0xf62e3e){for(var _0x21909a=0x0,_0x36ffd2=events[_0x6f77('0x5')];_0x21909a<_0x36ffd2;_0x21909a++){var _0x545ba9=events[_0x21909a];var _0x1dd52f=createListener('voiceQueueReport:'+_0x545ba9,_0xf62e3e);VoiceQueueReportEvents['on'](_0x545ba9,_0x1dd52f);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 635fd2b..dd0bd03 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 _0xd78e=['update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','post','create','put','/:id'];(function(_0x2e7a43,_0x3b3df4){var _0x52e9e1=function(_0x2c08cf){while(--_0x2c08cf){_0x2e7a43['push'](_0x2e7a43['shift']());}};_0x52e9e1(++_0x3b3df4);}(_0xd78e,0xc1));var _0xed78=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xd78e[_0x30faec];return _0x29484f;};'use strict';var multer=require(_0xed78('0x0'));var util=require(_0xed78('0x1'));var path=require(_0xed78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed78('0x3')]();var fs_extra=require(_0xed78('0x4'));var auth=require(_0xed78('0x5'));var interaction=require(_0xed78('0x6'));var config=require(_0xed78('0x7'));var controller=require(_0xed78('0x8'));router[_0xed78('0x9')]('/',auth[_0xed78('0xa')](),controller[_0xed78('0xb')]);router[_0xed78('0x9')]('/:id',auth[_0xed78('0xa')](),controller['show']);router[_0xed78('0xc')]('/',auth[_0xed78('0xa')](),controller[_0xed78('0xd')]);router[_0xed78('0xe')](_0xed78('0xf'),auth[_0xed78('0xa')](),controller[_0xed78('0x10')]);router[_0xed78('0x11')]('/:id',auth[_0xed78('0xa')](),controller['destroy']);module[_0xed78('0x12')]=router; \ No newline at end of file +var _0xa4fb=['../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5a4d05,_0x5bf9e9){var _0x7a3f97=function(_0x1ed9ab){while(--_0x1ed9ab){_0x5a4d05['push'](_0x5a4d05['shift']());}};_0x7a3f97(++_0x5bf9e9);}(_0xa4fb,0x150));var _0xba4f=function(_0x574617,_0x42eccc){_0x574617=_0x574617-0x0;var _0x29de90=_0xa4fb[_0x574617];return _0x29de90;};'use strict';var multer=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var path=require(_0xba4f('0x2'));var timeout=require(_0xba4f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xba4f('0x4'));var auth=require(_0xba4f('0x5'));var interaction=require(_0xba4f('0x6'));var config=require('../../config/environment');var controller=require(_0xba4f('0x7'));router[_0xba4f('0x8')]('/',auth[_0xba4f('0x9')](),controller[_0xba4f('0xa')]);router[_0xba4f('0x8')](_0xba4f('0xb'),auth[_0xba4f('0x9')](),controller[_0xba4f('0xc')]);router[_0xba4f('0xd')]('/',auth[_0xba4f('0x9')](),controller['create']);router[_0xba4f('0xe')]('/:id',auth[_0xba4f('0x9')](),controller[_0xba4f('0xf')]);router[_0xba4f('0x10')](_0xba4f('0xb'),auth[_0xba4f('0x9')](),controller[_0xba4f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index e162d4e..22d23e5 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 _0x227b=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment'];(function(_0x590d00,_0x358dff){var _0x2b6525=function(_0x304965){while(--_0x304965){_0x590d00['push'](_0x590d00['shift']());}};_0x2b6525(++_0x358dff);}(_0x227b,0x1be));var _0xb227=function(_0x2f4c41,_0x771752){_0x2f4c41=_0x2f4c41-0x0;var _0x5753cc=_0x227b[_0x2f4c41];return _0x5753cc;};'use strict';var Sequelize=require(_0xb227('0x0'));var moment=require(_0xb227('0x1'));module[_0xb227('0x2')]={'time':{'type':Sequelize[_0xb227('0x3')]},'callid':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb227('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb227('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xb227('0x5')](_0xb227('0x6'))}}; \ No newline at end of file +var _0x113d=['DATE','literal','sequelize','moment','exports','STRING'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x113d,0xfe));var _0xd113=function(_0x390579,_0x50c790){_0x390579=_0x390579-0x0;var _0x41b3b6=_0x113d[_0x390579];return _0x41b3b6;};'use strict';var Sequelize=require(_0xd113('0x0'));var moment=require(_0xd113('0x1'));module[_0xd113('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd113('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd113('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd113('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xd113('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd113('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xd113('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xd113('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xd113('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 6c6a6ea..93664b6 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 _0x822b=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','VoiceQueuesLog','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','update','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0x822b,0x1a7));var _0xb822=function(_0x113afc,_0x2c7d5a){_0x113afc=_0x113afc-0x0;var _0x3a9219=_0x822b[_0x113afc];return _0x3a9219;};'use strict';var emlformat=require(_0xb822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb822('0x1'));var jsonpatch=require(_0xb822('0x2'));var rp=require(_0xb822('0x3'));var moment=require(_0xb822('0x4'));var BPromise=require(_0xb822('0x5'));var Mustache=require(_0xb822('0x6'));var util=require(_0xb822('0x7'));var path=require('path');var sox=require(_0xb822('0x8'));var csv=require(_0xb822('0x9'));var ejs=require(_0xb822('0xa'));var fs=require('fs');var fs_extra=require(_0xb822('0xb'));var _=require(_0xb822('0xc'));var squel=require(_0xb822('0xd'));var crypto=require(_0xb822('0xe'));var jsforce=require(_0xb822('0xf'));var deskjs=require(_0xb822('0x10'));var toCsv=require(_0xb822('0x9'));var querystring=require('querystring');var Papa=require(_0xb822('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb822('0x12'));var as=require(_0xb822('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb822('0x14'));var utils=require('../../config/utils');var config=require(_0xb822('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fab40,_0x16498c){_0x16498c=_0x16498c||0xcc;return function(_0x2370cf){if(_0x2370cf){return _0x2fab40[_0xb822('0x16')](_0x16498c);}return _0x2fab40[_0xb822('0x17')](_0x16498c)['end']();};}function respondWithResult(_0x27c2fa,_0xb24c95){_0xb24c95=_0xb24c95||0xc8;return function(_0x1f11a9){if(_0x1f11a9){return _0x27c2fa[_0xb822('0x17')](_0xb24c95)[_0xb822('0x18')](_0x1f11a9);}};}function respondWithFilteredResult(_0x4bf26f,_0xaffa20){return function(_0x9d8ca7){if(_0x9d8ca7){var _0x256a5b=typeof _0xaffa20[_0xb822('0x19')]===_0xb822('0x1a')&&typeof _0xaffa20[_0xb822('0x1b')]===_0xb822('0x1a');var _0x2c5c00=_0x9d8ca7[_0xb822('0x1c')];var _0x1593b9=_0x256a5b?0x0:_0xaffa20['offset'];var _0x529952=_0x256a5b?_0x9d8ca7[_0xb822('0x1c')]:_0xaffa20[_0xb822('0x19')]+_0xaffa20[_0xb822('0x1b')];var _0x1851fb;if(_0x529952>=_0x2c5c00){_0x529952=_0x2c5c00;_0x1851fb=0xc8;}else{_0x1851fb=0xce;}_0x4bf26f[_0xb822('0x17')](_0x1851fb);return _0x4bf26f[_0xb822('0x1d')](_0xb822('0x1e'),_0x1593b9+'-'+_0x529952+'/'+_0x2c5c00)[_0xb822('0x18')](_0x9d8ca7);}return null;};}function patchUpdates(_0x235e23){return function(_0x3f431f){try{jsonpatch['apply'](_0x3f431f,_0x235e23,!![]);}catch(_0x2dd2c6){return BPromise[_0xb822('0x1f')](_0x2dd2c6);}return _0x3f431f[_0xb822('0x20')]();};}function saveUpdates(_0x2192d6,_0x2f12fe){return function(_0x3932d3){if(_0x3932d3){return _0x3932d3['update'](_0x2192d6)[_0xb822('0x21')](function(_0x277595){return _0x277595;});}return null;};}function removeEntity(_0x3407da,_0xc48b51){return function(_0x25bd75){if(_0x25bd75){return _0x25bd75[_0xb822('0x22')]()[_0xb822('0x21')](function(){_0x3407da['status'](0xcc)[_0xb822('0x23')]();});}};}function handleEntityNotFound(_0x218eab,_0x56b24e){return function(_0x25792b){if(!_0x25792b){_0x218eab[_0xb822('0x16')](0x194);}return _0x25792b;};}function handleError(_0x39b2eb,_0x5639ff){_0x5639ff=_0x5639ff||0x1f4;return function(_0x4e69fc){logger[_0xb822('0x24')](_0x4e69fc[_0xb822('0x25')]);if(_0x4e69fc[_0xb822('0x26')]){delete _0x4e69fc[_0xb822('0x26')];}_0x39b2eb[_0xb822('0x17')](_0x5639ff)[_0xb822('0x27')](_0x4e69fc);};}exports[_0xb822('0x28')]=function(_0x6677e7,_0x301446){var _0x21d83c={},_0x2514a7={},_0x1ad415={'count':0x0,'rows':[]};var _0x59184e=_['map'](db[_0xb822('0x29')]['rawAttributes'],function(_0x1f89be){return{'name':_0x1f89be['fieldName'],'type':_0x1f89be[_0xb822('0x2a')][_0xb822('0x2b')]};});_0x2514a7['model']=_['map'](_0x59184e,_0xb822('0x26'));_0x2514a7[_0xb822('0x2c')]=_[_0xb822('0x2d')](_0x6677e7[_0xb822('0x2c')]);_0x2514a7[_0xb822('0x2e')]=_[_0xb822('0x2f')](_0x2514a7[_0xb822('0x30')],_0x2514a7[_0xb822('0x2c')]);_0x21d83c[_0xb822('0x31')]=_[_0xb822('0x2f')](_0x2514a7[_0xb822('0x30')],qs[_0xb822('0x32')](_0x6677e7[_0xb822('0x2c')][_0xb822('0x32')]));_0x21d83c['attributes']=_0x21d83c['attributes'][_0xb822('0x33')]?_0x21d83c[_0xb822('0x31')]:_0x2514a7['model'];if(!_0x6677e7[_0xb822('0x2c')][_0xb822('0x34')](_0xb822('0x35'))){_0x21d83c[_0xb822('0x1b')]=qs[_0xb822('0x1b')](_0x6677e7[_0xb822('0x2c')][_0xb822('0x1b')]);_0x21d83c['offset']=qs[_0xb822('0x19')](_0x6677e7[_0xb822('0x2c')][_0xb822('0x19')]);}_0x21d83c['order']=qs[_0xb822('0x36')](_0x6677e7[_0xb822('0x2c')][_0xb822('0x36')]);_0x21d83c[_0xb822('0x37')]=qs[_0xb822('0x2e')](_[_0xb822('0x38')](_0x6677e7[_0xb822('0x2c')],_0x2514a7[_0xb822('0x2e')]),_0x59184e);if(_0x6677e7['query'][_0xb822('0x39')]){_0x21d83c[_0xb822('0x37')]=_[_0xb822('0x3a')](_0x21d83c['where'],{'$or':_[_0xb822('0x3b')](_0x59184e,function(_0x5a8b76){if(_0x5a8b76['type']!==_0xb822('0x3c')){var _0x55f411={};_0x55f411[_0x5a8b76[_0xb822('0x26')]]={'$like':'%'+_0x6677e7[_0xb822('0x2c')][_0xb822('0x39')]+'%'};return _0x55f411;}})});}_0x21d83c=_[_0xb822('0x3a')]({},_0x21d83c,_0x6677e7[_0xb822('0x3d')]);var _0x1ed403={'where':_0x21d83c[_0xb822('0x37')]};return db[_0xb822('0x29')][_0xb822('0x1c')](_0x1ed403)[_0xb822('0x21')](function(_0x242cd6){_0x1ad415['count']=_0x242cd6;if(_0x6677e7[_0xb822('0x2c')][_0xb822('0x3e')]){_0x21d83c['include']=[{'all':!![]}];}return db[_0xb822('0x29')][_0xb822('0x3f')](_0x21d83c);})[_0xb822('0x21')](function(_0x52fc3e){_0x1ad415[_0xb822('0x40')]=_0x52fc3e;return _0x1ad415;})[_0xb822('0x21')](respondWithFilteredResult(_0x301446,_0x21d83c))[_0xb822('0x41')](handleError(_0x301446,null));};exports[_0xb822('0x42')]=function(_0x2d1a07,_0x1a61f3){var _0x308683={'raw':!![],'where':{'id':_0x2d1a07[_0xb822('0x43')]['id']}},_0x361464={};_0x361464['model']=_[_0xb822('0x2d')](db[_0xb822('0x29')]['rawAttributes']);_0x361464['query']=_['keys'](_0x2d1a07[_0xb822('0x2c')]);_0x361464['filters']=_[_0xb822('0x2f')](_0x361464[_0xb822('0x30')],_0x361464[_0xb822('0x2c')]);_0x308683[_0xb822('0x31')]=_[_0xb822('0x2f')](_0x361464[_0xb822('0x30')],qs[_0xb822('0x32')](_0x2d1a07[_0xb822('0x2c')][_0xb822('0x32')]));_0x308683['attributes']=_0x308683[_0xb822('0x31')][_0xb822('0x33')]?_0x308683[_0xb822('0x31')]:_0x361464[_0xb822('0x30')];if(_0x2d1a07[_0xb822('0x2c')][_0xb822('0x3e')]){_0x308683['include']=[{'all':!![]}];}_0x308683=_[_0xb822('0x3a')]({},_0x308683,_0x2d1a07['options']);return db[_0xb822('0x29')]['find'](_0x308683)['then'](handleEntityNotFound(_0x1a61f3,null))[_0xb822('0x21')](respondWithResult(_0x1a61f3,null))[_0xb822('0x41')](handleError(_0x1a61f3,null));};exports['create']=function(_0x161eb4,_0x334301){return db['VoiceQueuesLog'][_0xb822('0x44')](_0x161eb4['body'],{})['then'](respondWithResult(_0x334301,0xc9))[_0xb822('0x41')](handleError(_0x334301,null));};exports[_0xb822('0x45')]=function(_0x13a9ba,_0x5943cf){if(_0x13a9ba[_0xb822('0x46')]['id']){delete _0x13a9ba[_0xb822('0x46')]['id'];}return db[_0xb822('0x29')][_0xb822('0x47')]({'where':{'id':_0x13a9ba[_0xb822('0x43')]['id']}})[_0xb822('0x21')](handleEntityNotFound(_0x5943cf,null))[_0xb822('0x21')](saveUpdates(_0x13a9ba[_0xb822('0x46')],null))['then'](respondWithResult(_0x5943cf,null))[_0xb822('0x41')](handleError(_0x5943cf,null));};exports[_0xb822('0x22')]=function(_0x128831,_0x4ca951){return db['VoiceQueuesLog'][_0xb822('0x47')]({'where':{'id':_0x128831[_0xb822('0x43')]['id']}})[_0xb822('0x21')](handleEntityNotFound(_0x4ca951,null))[_0xb822('0x21')](removeEntity(_0x4ca951,null))['catch'](handleError(_0x4ca951,null));}; \ No newline at end of file +var _0x74a0=['options','then','includeAll','include','findAll','rows','catch','params','rawAttributes','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','error','stack','send','index','map','VoiceQueuesLog','fieldName','type','key','model','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74a0,0x1db));var _0x074a=function(_0x15aa0f,_0x596f6e){_0x15aa0f=_0x15aa0f-0x0;var _0x56cb65=_0x74a0[_0x15aa0f];return _0x56cb65;};'use strict';var emlformat=require(_0x074a('0x0'));var rimraf=require(_0x074a('0x1'));var zipdir=require(_0x074a('0x2'));var jsonpatch=require(_0x074a('0x3'));var rp=require(_0x074a('0x4'));var moment=require('moment');var BPromise=require(_0x074a('0x5'));var Mustache=require(_0x074a('0x6'));var util=require(_0x074a('0x7'));var path=require('path');var sox=require(_0x074a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x074a('0x9'));var squel=require(_0x074a('0xa'));var crypto=require(_0x074a('0xb'));var jsforce=require(_0x074a('0xc'));var deskjs=require(_0x074a('0xd'));var toCsv=require(_0x074a('0xe'));var querystring=require(_0x074a('0xf'));var Papa=require(_0x074a('0x10'));var Redis=require(_0x074a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x074a('0x12'));var as=require(_0x074a('0x13'));var hardwareService=require(_0x074a('0x14'));var logger=require('../../config/logger')(_0x074a('0x15'));var utils=require(_0x074a('0x16'));var config=require(_0x074a('0x17'));var licenseUtil=require(_0x074a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4958ca,_0x3b0c00){_0x3b0c00=_0x3b0c00||0xcc;return function(_0xedb54d){if(_0xedb54d){return _0x4958ca[_0x074a('0x19')](_0x3b0c00);}return _0x4958ca[_0x074a('0x1a')](_0x3b0c00)[_0x074a('0x1b')]();};}function respondWithResult(_0x41b149,_0x73dba3){_0x73dba3=_0x73dba3||0xc8;return function(_0x5d152e){if(_0x5d152e){return _0x41b149[_0x074a('0x1a')](_0x73dba3)[_0x074a('0x1c')](_0x5d152e);}};}function respondWithFilteredResult(_0x2998e6,_0xaef97d){return function(_0x1a9c6b){if(_0x1a9c6b){var _0x11981e=typeof _0xaef97d['offset']==='undefined'&&typeof _0xaef97d[_0x074a('0x1d')]===_0x074a('0x1e');var _0x5270d6=_0x1a9c6b[_0x074a('0x1f')];var _0x2a9d51=_0x11981e?0x0:_0xaef97d[_0x074a('0x20')];var _0x2c45d0=_0x11981e?_0x1a9c6b[_0x074a('0x1f')]:_0xaef97d[_0x074a('0x20')]+_0xaef97d[_0x074a('0x1d')];var _0xf0bcf8;if(_0x2c45d0>=_0x5270d6){_0x2c45d0=_0x5270d6;_0xf0bcf8=0xc8;}else{_0xf0bcf8=0xce;}_0x2998e6[_0x074a('0x1a')](_0xf0bcf8);return _0x2998e6[_0x074a('0x21')](_0x074a('0x22'),_0x2a9d51+'-'+_0x2c45d0+'/'+_0x5270d6)[_0x074a('0x1c')](_0x1a9c6b);}return null;};}function patchUpdates(_0x33cb40){return function(_0x172a31){try{jsonpatch[_0x074a('0x23')](_0x172a31,_0x33cb40,!![]);}catch(_0x33c46f){return BPromise['reject'](_0x33c46f);}return _0x172a31['save']();};}function saveUpdates(_0x230356,_0x2c7f7f){return function(_0x1b91ba){if(_0x1b91ba){return _0x1b91ba[_0x074a('0x24')](_0x230356)['then'](function(_0x13214a){return _0x13214a;});}return null;};}function removeEntity(_0x2a56cc,_0x39ce9c){return function(_0x39c1c0){if(_0x39c1c0){return _0x39c1c0[_0x074a('0x25')]()['then'](function(){_0x2a56cc[_0x074a('0x1a')](0xcc)[_0x074a('0x1b')]();});}};}function handleEntityNotFound(_0x21755e,_0x1f58f9){return function(_0x60233e){if(!_0x60233e){_0x21755e['sendStatus'](0x194);}return _0x60233e;};}function handleError(_0x284551,_0x1f2112){_0x1f2112=_0x1f2112||0x1f4;return function(_0x32cdad){logger[_0x074a('0x26')](_0x32cdad[_0x074a('0x27')]);if(_0x32cdad['name']){delete _0x32cdad['name'];}_0x284551[_0x074a('0x1a')](_0x1f2112)[_0x074a('0x28')](_0x32cdad);};}exports[_0x074a('0x29')]=function(_0x5c4b86,_0x1c7a85){var _0x424030={},_0x567e68={},_0x451457={'count':0x0,'rows':[]};var _0x33ba18=_[_0x074a('0x2a')](db[_0x074a('0x2b')]['rawAttributes'],function(_0x4ca52a){return{'name':_0x4ca52a[_0x074a('0x2c')],'type':_0x4ca52a[_0x074a('0x2d')][_0x074a('0x2e')]};});_0x567e68[_0x074a('0x2f')]=_[_0x074a('0x2a')](_0x33ba18,_0x074a('0x30'));_0x567e68[_0x074a('0x31')]=_[_0x074a('0x32')](_0x5c4b86[_0x074a('0x31')]);_0x567e68[_0x074a('0x33')]=_[_0x074a('0x34')](_0x567e68[_0x074a('0x2f')],_0x567e68['query']);_0x424030['attributes']=_['intersection'](_0x567e68[_0x074a('0x2f')],qs[_0x074a('0x35')](_0x5c4b86[_0x074a('0x31')][_0x074a('0x35')]));_0x424030['attributes']=_0x424030['attributes'][_0x074a('0x36')]?_0x424030[_0x074a('0x37')]:_0x567e68[_0x074a('0x2f')];if(!_0x5c4b86['query'][_0x074a('0x38')](_0x074a('0x39'))){_0x424030[_0x074a('0x1d')]=qs['limit'](_0x5c4b86[_0x074a('0x31')][_0x074a('0x1d')]);_0x424030[_0x074a('0x20')]=qs['offset'](_0x5c4b86[_0x074a('0x31')][_0x074a('0x20')]);}_0x424030[_0x074a('0x3a')]=qs[_0x074a('0x3b')](_0x5c4b86[_0x074a('0x31')][_0x074a('0x3b')]);_0x424030[_0x074a('0x3c')]=qs['filters'](_[_0x074a('0x3d')](_0x5c4b86[_0x074a('0x31')],_0x567e68[_0x074a('0x33')]),_0x33ba18);if(_0x5c4b86[_0x074a('0x31')][_0x074a('0x3e')]){_0x424030['where']=_['merge'](_0x424030[_0x074a('0x3c')],{'$or':_[_0x074a('0x2a')](_0x33ba18,function(_0x159a06){if(_0x159a06[_0x074a('0x2d')]!==_0x074a('0x3f')){var _0x5bd235={};_0x5bd235[_0x159a06[_0x074a('0x30')]]={'$like':'%'+_0x5c4b86[_0x074a('0x31')][_0x074a('0x3e')]+'%'};return _0x5bd235;}})});}_0x424030=_['merge']({},_0x424030,_0x5c4b86[_0x074a('0x40')]);var _0x391d0c={'where':_0x424030[_0x074a('0x3c')]};return db['VoiceQueuesLog']['count'](_0x391d0c)[_0x074a('0x41')](function(_0xb56e0b){_0x451457[_0x074a('0x1f')]=_0xb56e0b;if(_0x5c4b86['query'][_0x074a('0x42')]){_0x424030[_0x074a('0x43')]=[{'all':!![]}];}return db[_0x074a('0x2b')][_0x074a('0x44')](_0x424030);})[_0x074a('0x41')](function(_0x4ca20){_0x451457[_0x074a('0x45')]=_0x4ca20;return _0x451457;})['then'](respondWithFilteredResult(_0x1c7a85,_0x424030))[_0x074a('0x46')](handleError(_0x1c7a85,null));};exports['show']=function(_0x33291c,_0x23c856){var _0xe34c29={'raw':!![],'where':{'id':_0x33291c[_0x074a('0x47')]['id']}},_0x2a85fa={};_0x2a85fa[_0x074a('0x2f')]=_[_0x074a('0x32')](db['VoiceQueuesLog'][_0x074a('0x48')]);_0x2a85fa[_0x074a('0x31')]=_[_0x074a('0x32')](_0x33291c['query']);_0x2a85fa['filters']=_['intersection'](_0x2a85fa[_0x074a('0x2f')],_0x2a85fa['query']);_0xe34c29['attributes']=_[_0x074a('0x34')](_0x2a85fa[_0x074a('0x2f')],qs[_0x074a('0x35')](_0x33291c['query']['fields']));_0xe34c29[_0x074a('0x37')]=_0xe34c29[_0x074a('0x37')]['length']?_0xe34c29[_0x074a('0x37')]:_0x2a85fa[_0x074a('0x2f')];if(_0x33291c[_0x074a('0x31')][_0x074a('0x42')]){_0xe34c29[_0x074a('0x43')]=[{'all':!![]}];}_0xe34c29=_[_0x074a('0x49')]({},_0xe34c29,_0x33291c['options']);return db[_0x074a('0x2b')][_0x074a('0x4a')](_0xe34c29)['then'](handleEntityNotFound(_0x23c856,null))['then'](respondWithResult(_0x23c856,null))[_0x074a('0x46')](handleError(_0x23c856,null));};exports['create']=function(_0x285530,_0x3000a6){return db['VoiceQueuesLog'][_0x074a('0x4b')](_0x285530[_0x074a('0x4c')],{})[_0x074a('0x41')](respondWithResult(_0x3000a6,0xc9))[_0x074a('0x46')](handleError(_0x3000a6,null));};exports[_0x074a('0x24')]=function(_0x25c145,_0x5c0e2d){if(_0x25c145[_0x074a('0x4c')]['id']){delete _0x25c145['body']['id'];}return db[_0x074a('0x2b')][_0x074a('0x4a')]({'where':{'id':_0x25c145[_0x074a('0x47')]['id']}})[_0x074a('0x41')](handleEntityNotFound(_0x5c0e2d,null))['then'](saveUpdates(_0x25c145[_0x074a('0x4c')],null))[_0x074a('0x41')](respondWithResult(_0x5c0e2d,null))[_0x074a('0x46')](handleError(_0x5c0e2d,null));};exports[_0x074a('0x25')]=function(_0x387660,_0xf33b8b){return db[_0x074a('0x2b')][_0x074a('0x4a')]({'where':{'id':_0x387660['params']['id']}})['then'](handleEntityNotFound(_0xf33b8b,null))[_0x074a('0x41')](removeEntity(_0xf33b8b,null))[_0x074a('0x46')](handleError(_0xf33b8b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 1c1d1eb..4deecd5 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 _0x6d7c=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5786ec,_0x3b42ce){var _0x498f91=function(_0x131028){while(--_0x131028){_0x5786ec['push'](_0x5786ec['shift']());}};_0x498f91(++_0x3b42ce);}(_0x6d7c,0x1c7));var _0xc6d7=function(_0xec625b,_0x31d6f9){_0xec625b=_0xec625b-0x0;var _0x58c103=_0x6d7c[_0xec625b];return _0x58c103;};'use strict';var _=require(_0xc6d7('0x0'));var util=require(_0xc6d7('0x1'));var logger=require(_0xc6d7('0x2'))(_0xc6d7('0x3'));var moment=require('moment');var BPromise=require(_0xc6d7('0x4'));var rp=require(_0xc6d7('0x5'));var fs=require('fs');var path=require(_0xc6d7('0x6'));var rimraf=require(_0xc6d7('0x7'));var config=require(_0xc6d7('0x8'));var attributes=require(_0xc6d7('0x9'));module[_0xc6d7('0xa')]=function(_0x3c4763,_0x5e56c6){return _0x3c4763[_0xc6d7('0xb')](_0xc6d7('0xc'),attributes,{'tableName':_0xc6d7('0xd'),'paranoid':![],'indexes':[{'name':_0xc6d7('0xe'),'fields':['event',_0xc6d7('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x684d=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','VoiceQueuesLog','voice_queues_log','event_dtm','dtm'];(function(_0x3d69a5,_0x4a3ace){var _0x1a7038=function(_0x169d8b){while(--_0x169d8b){_0x3d69a5['push'](_0x3d69a5['shift']());}};_0x1a7038(++_0x4a3ace);}(_0x684d,0x174));var _0xd684=function(_0x45059a,_0x4e003a){_0x45059a=_0x45059a-0x0;var _0x37838e=_0x684d[_0x45059a];return _0x37838e;};'use strict';var _=require('lodash');var util=require(_0xd684('0x0'));var logger=require(_0xd684('0x1'))(_0xd684('0x2'));var moment=require('moment');var BPromise=require(_0xd684('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd684('0x4'));var rimraf=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var attributes=require('./voiceQueuesLog.attributes');module[_0xd684('0x7')]=function(_0x5f50ac,_0x3bf907){return _0x5f50ac['define'](_0xd684('0x8'),attributes,{'tableName':_0xd684('0x9'),'paranoid':![],'indexes':[{'name':_0xd684('0xa'),'fields':['event',_0xd684('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 8c8560e..7d5df82 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 _0xba30=['VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1a5712,_0x59d1dd){var _0x1d24f9=function(_0x2dc128){while(--_0x2dc128){_0x1a5712['push'](_0x1a5712['shift']());}};_0x1d24f9(++_0x59d1dd);}(_0xba30,0xf0));var _0x0ba3=function(_0x581feb,_0x475a85){_0x581feb=_0x581feb-0x0;var _0x29fe1a=_0xba30[_0x581feb];return _0x29fe1a;};'use strict';var _=require(_0x0ba3('0x0'));var util=require(_0x0ba3('0x1'));var moment=require(_0x0ba3('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ba3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0ba3('0x4'));var logger=require(_0x0ba3('0x5'))('rpc');var config=require(_0x0ba3('0x6'));var jayson=require(_0x0ba3('0x7'));var client=jayson[_0x0ba3('0x8')][_0x0ba3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45429c,_0x1888a2,_0x390541){return new BPromise(function(_0x2b3d81,_0x43e5ba){return client[_0x0ba3('0xa')](_0x45429c,_0x390541)[_0x0ba3('0xb')](function(_0x4695ec){logger[_0x0ba3('0xc')](_0x0ba3('0xd'),_0x1888a2,'request\x20sent');logger[_0x0ba3('0xe')](_0x0ba3('0xf'),_0x1888a2,_0x0ba3('0x10'),JSON[_0x0ba3('0x11')](_0x4695ec));if(_0x4695ec[_0x0ba3('0x12')]){if(_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x13')]===0x1f4){logger[_0x0ba3('0x12')](_0x0ba3('0xd'),_0x1888a2,_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x14')]);return _0x43e5ba(_0x4695ec['error'][_0x0ba3('0x14')]);}logger[_0x0ba3('0x12')](_0x0ba3('0xd'),_0x1888a2,_0x4695ec['error'][_0x0ba3('0x14')]);return _0x2b3d81(_0x4695ec[_0x0ba3('0x12')][_0x0ba3('0x14')]);}else{logger[_0x0ba3('0xc')](_0x0ba3('0xd'),_0x1888a2,_0x0ba3('0x10'));_0x2b3d81(_0x4695ec[_0x0ba3('0x15')][_0x0ba3('0x14')]);}})[_0x0ba3('0x16')](function(_0x16fa5a){logger[_0x0ba3('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1888a2,_0x16fa5a);_0x43e5ba(_0x16fa5a);});});} \ No newline at end of file +var _0x0be7=['stringify','error','code','message','info','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x0be7,0xc4));var _0x70be=function(_0x53c1a6,_0x19ee54){_0x53c1a6=_0x53c1a6-0x0;var _0x261fd3=_0x0be7[_0x53c1a6];return _0x261fd3;};'use strict';var _=require('lodash');var util=require(_0x70be('0x0'));var moment=require('moment');var BPromise=require(_0x70be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70be('0x2'));var db=require(_0x70be('0x3'))['db'];var utils=require(_0x70be('0x4'));var logger=require(_0x70be('0x5'))(_0x70be('0x6'));var config=require(_0x70be('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x70be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe8b00,_0x5a8b51,_0x352f03){return new BPromise(function(_0x23373d,_0x11aa1a){return client[_0x70be('0x9')](_0xe8b00,_0x352f03)[_0x70be('0xa')](function(_0x5940c2){logger['info'](_0x70be('0xb'),_0x5a8b51,_0x70be('0xc'));logger[_0x70be('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x5a8b51,_0x70be('0xc'),JSON[_0x70be('0xe')](_0x5940c2));if(_0x5940c2[_0x70be('0xf')]){if(_0x5940c2['error'][_0x70be('0x10')]===0x1f4){logger[_0x70be('0xf')](_0x70be('0xb'),_0x5a8b51,_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);return _0x11aa1a(_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);}logger[_0x70be('0xf')](_0x70be('0xb'),_0x5a8b51,_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);return _0x23373d(_0x5940c2[_0x70be('0xf')][_0x70be('0x11')]);}else{logger[_0x70be('0x12')](_0x70be('0xb'),_0x5a8b51,'request\x20sent');_0x23373d(_0x5940c2[_0x70be('0x13')][_0x70be('0x11')]);}})[_0x70be('0x14')](function(_0x56e261){logger['error'](_0x70be('0xb'),_0x5a8b51,_0x56e261);_0x11aa1a(_0x56e261);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 9f92f94..1beed49 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 _0x5f8a=['/:id/transcribe','runTranscribe','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','/:id/downloads','downloads','downloadTranscribe','create'];(function(_0x1ec6c8,_0x72ff6){var _0x16701c=function(_0x4fd69f){while(--_0x4fd69f){_0x1ec6c8['push'](_0x1ec6c8['shift']());}};_0x16701c(++_0x72ff6);}(_0x5f8a,0x88));var _0xa5f8=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x5f8a[_0x5ce15c];return _0x36e4f5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa5f8('0x0'));var timeout=require(_0xa5f8('0x1'));var express=require(_0xa5f8('0x2'));var router=express[_0xa5f8('0x3')]();var fs_extra=require(_0xa5f8('0x4'));var auth=require(_0xa5f8('0x5'));var interaction=require(_0xa5f8('0x6'));var config=require(_0xa5f8('0x7'));var controller=require(_0xa5f8('0x8'));router[_0xa5f8('0x9')]('/',auth[_0xa5f8('0xa')](),controller[_0xa5f8('0xb')]);router[_0xa5f8('0x9')](_0xa5f8('0xc'),auth[_0xa5f8('0xa')](),controller[_0xa5f8('0xd')]);router[_0xa5f8('0x9')](_0xa5f8('0xe'),auth[_0xa5f8('0xa')](),controller['show']);router[_0xa5f8('0x9')](_0xa5f8('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xa5f8('0x9')](_0xa5f8('0x10'),controller[_0xa5f8('0x11')]);router[_0xa5f8('0x9')]('/:id/transcribe',auth[_0xa5f8('0xa')](),controller[_0xa5f8('0x12')]);router['post']('/',auth[_0xa5f8('0xa')](),controller[_0xa5f8('0x13')]);router['post'](_0xa5f8('0x14'),auth[_0xa5f8('0xa')](),controller[_0xa5f8('0x15')]);router[_0xa5f8('0x16')]('/:id',auth[_0xa5f8('0xa')](),controller[_0xa5f8('0x17')]);router[_0xa5f8('0x18')]('/:id',auth[_0xa5f8('0xa')](),controller['destroy']);module[_0xa5f8('0x19')]=router; \ No newline at end of file +var _0xe221=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','delete','multer','util'];(function(_0x5d5d37,_0x2ae286){var _0x2fd5c0=function(_0x340067){while(--_0x340067){_0x5d5d37['push'](_0x5d5d37['shift']());}};_0x2fd5c0(++_0x2ae286);}(_0xe221,0x17e));var _0x1e22=function(_0x52fc4a,_0x594288){_0x52fc4a=_0x52fc4a-0x0;var _0x51a067=_0xe221[_0x52fc4a];return _0x51a067;};'use strict';var multer=require(_0x1e22('0x0'));var util=require(_0x1e22('0x1'));var path=require('path');var timeout=require(_0x1e22('0x2'));var express=require(_0x1e22('0x3'));var router=express[_0x1e22('0x4')]();var fs_extra=require(_0x1e22('0x5'));var auth=require(_0x1e22('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e22('0x7'));var controller=require('./voiceRecording.controller');router[_0x1e22('0x8')]('/',auth[_0x1e22('0x9')](),controller[_0x1e22('0xa')]);router[_0x1e22('0x8')](_0x1e22('0xb'),auth[_0x1e22('0x9')](),controller[_0x1e22('0xc')]);router[_0x1e22('0x8')]('/:id',auth[_0x1e22('0x9')](),controller[_0x1e22('0xd')]);router['get']('/:id/download',auth[_0x1e22('0x9')](),controller[_0x1e22('0xe')]);router[_0x1e22('0x8')](_0x1e22('0xf'),controller[_0x1e22('0x10')]);router[_0x1e22('0x8')](_0x1e22('0x11'),auth[_0x1e22('0x9')](),controller[_0x1e22('0x12')]);router[_0x1e22('0x13')]('/',auth[_0x1e22('0x9')](),controller[_0x1e22('0x14')]);router[_0x1e22('0x13')](_0x1e22('0x11'),auth[_0x1e22('0x9')](),controller[_0x1e22('0x15')]);router['put']('/:id',auth[_0x1e22('0x9')](),controller[_0x1e22('0x16')]);router[_0x1e22('0x17')]('/:id',auth[_0x1e22('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 4fd5f9d..c7a0ea9 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(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 0162027..05f0544 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 _0xa903=['bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','VoiceRecording','rawAttributes','type','key','model','differenceBy','map','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','secrets','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','decryptFile','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','listBuckets','createBucket','upload','[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','TranscriptionJobName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','tempSentiment','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x2fac65,_0x2ff8d2){var _0x55b715=function(_0x3ad88f){while(--_0x3ad88f){_0x2fac65['push'](_0x2fac65['shift']());}};_0x55b715(++_0x2ff8d2);}(_0xa903,0x1ca));var _0x3a90=function(_0x47ccc3,_0x2f447c){_0x47ccc3=_0x47ccc3-0x0;var _0x433a52=_0xa903[_0x47ccc3];return _0x433a52;};'use strict';var emlformat=require(_0x3a90('0x0'));var rimraf=require(_0x3a90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a90('0x2'));var rp=require(_0x3a90('0x3'));var moment=require('moment');var BPromise=require(_0x3a90('0x4'));var Mustache=require(_0x3a90('0x5'));var util=require(_0x3a90('0x6'));var path=require(_0x3a90('0x7'));var sox=require(_0x3a90('0x8'));var csv=require(_0x3a90('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a90('0xa'));var _=require('lodash');var squel=require(_0x3a90('0xb'));var crypto=require(_0x3a90('0xc'));var jsforce=require(_0x3a90('0xd'));var deskjs=require(_0x3a90('0xe'));var toCsv=require(_0x3a90('0x9'));var querystring=require(_0x3a90('0xf'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x3a90('0x10'));var Redis=require(_0x3a90('0x11'));var authService=require(_0x3a90('0x12'));var qs=require(_0x3a90('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a90('0x14'))(_0x3a90('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3a90('0x16'));var db=require(_0x3a90('0x17'))['db'];function respondWithStatusCode(_0x307387,_0x4bd5e5){_0x4bd5e5=_0x4bd5e5||0xcc;return function(_0x536a25){if(_0x536a25){return _0x307387[_0x3a90('0x18')](_0x4bd5e5);}return _0x307387['status'](_0x4bd5e5)[_0x3a90('0x19')]();};}function respondWithResult(_0x51bcc4,_0xa2eeeb){_0xa2eeeb=_0xa2eeeb||0xc8;return function(_0x4bb30f){if(_0x4bb30f){return _0x51bcc4[_0x3a90('0x1a')](_0xa2eeeb)[_0x3a90('0x1b')](_0x4bb30f);}};}function respondWithFilteredResult(_0xf62f28,_0x16f16f){return function(_0x2e7cb8){if(_0x2e7cb8){var _0x361a45=typeof _0x16f16f[_0x3a90('0x1c')]===_0x3a90('0x1d')&&typeof _0x16f16f['limit']===_0x3a90('0x1d');var _0x8a34c9=_0x2e7cb8[_0x3a90('0x1e')];var _0x93de2a=_0x361a45?0x0:_0x16f16f[_0x3a90('0x1c')];var _0x442e36=_0x361a45?_0x2e7cb8[_0x3a90('0x1e')]:_0x16f16f[_0x3a90('0x1c')]+_0x16f16f[_0x3a90('0x1f')];var _0xefec23;if(_0x442e36>=_0x8a34c9){_0x442e36=_0x8a34c9;_0xefec23=0xc8;}else{_0xefec23=0xce;}_0xf62f28[_0x3a90('0x1a')](_0xefec23);return _0xf62f28[_0x3a90('0x20')](_0x3a90('0x21'),_0x93de2a+'-'+_0x442e36+'/'+_0x8a34c9)['json'](_0x2e7cb8);}return null;};}function patchUpdates(_0x14e4fc){return function(_0x282c48){try{jsonpatch[_0x3a90('0x22')](_0x282c48,_0x14e4fc,!![]);}catch(_0x1ca55f){return BPromise[_0x3a90('0x23')](_0x1ca55f);}return _0x282c48['save']();};}function saveUpdates(_0x18fa68,_0x1d703d){return function(_0x15a8f1){if(_0x15a8f1){return _0x15a8f1[_0x3a90('0x24')](_0x18fa68)['then'](function(_0x77038e){return _0x77038e;});}return null;};}function removeEntity(_0x119993,_0x15fce8){return function(_0x35dd0d){if(_0x35dd0d){return _0x35dd0d[_0x3a90('0x25')]()[_0x3a90('0x26')](function(){_0x119993[_0x3a90('0x1a')](0xcc)[_0x3a90('0x19')]();});}};}function handleEntityNotFound(_0x363925,_0x2e9364){return function(_0x2863ad){if(!_0x2863ad){_0x363925[_0x3a90('0x18')](0x194);}return _0x2863ad;};}function handleError(_0x59f0f8,_0x17d8dd){_0x17d8dd=_0x17d8dd||0x1f4;return function(_0x219426){logger[_0x3a90('0x27')](_0x219426[_0x3a90('0x28')]);if(_0x219426[_0x3a90('0x29')]){delete _0x219426['name'];}_0x59f0f8[_0x3a90('0x1a')](_0x17d8dd)[_0x3a90('0x2a')](_0x219426);};}exports[_0x3a90('0x2b')]=function(_0x110f13,_0x5d9f18){var _0x4ba1d4={},_0x324561={},_0x9baea={'count':0x0,'rows':[]};var _0x5ec7d9=_['map'](db[_0x3a90('0x2c')][_0x3a90('0x2d')],function(_0x4a1f72){return{'name':_0x4a1f72['fieldName'],'type':_0x4a1f72[_0x3a90('0x2e')][_0x3a90('0x2f')]};});_0x324561[_0x3a90('0x30')]=_[_0x3a90('0x31')](_[_0x3a90('0x32')](_0x5ec7d9,_0x3a90('0x29')),[_0x3a90('0x33')]);_0x324561[_0x3a90('0x34')]=_[_0x3a90('0x35')](_0x110f13[_0x3a90('0x34')]);_0x324561[_0x3a90('0x36')]=_[_0x3a90('0x37')](_0x324561['model'],_0x324561['query']);_0x4ba1d4[_0x3a90('0x38')]=_[_0x3a90('0x37')](_0x324561[_0x3a90('0x30')],qs[_0x3a90('0x39')](_0x110f13[_0x3a90('0x34')]['fields']));_0x4ba1d4[_0x3a90('0x38')]=_0x4ba1d4[_0x3a90('0x38')][_0x3a90('0x3a')]?_0x4ba1d4[_0x3a90('0x38')]:_0x324561[_0x3a90('0x30')];if(!_0x110f13['query'][_0x3a90('0x3b')](_0x3a90('0x3c'))){_0x4ba1d4[_0x3a90('0x1f')]=qs[_0x3a90('0x1f')](_0x110f13[_0x3a90('0x34')][_0x3a90('0x1f')]);_0x4ba1d4['offset']=qs[_0x3a90('0x1c')](_0x110f13[_0x3a90('0x34')]['offset']);}_0x4ba1d4[_0x3a90('0x3d')]=qs[_0x3a90('0x3e')](_0x110f13[_0x3a90('0x34')][_0x3a90('0x3e')]);_0x4ba1d4['where']=qs[_0x3a90('0x36')](_[_0x3a90('0x3f')](_0x110f13[_0x3a90('0x34')],_0x324561['filters']),_0x5ec7d9);if(_0x110f13['query'][_0x3a90('0x40')]){_0x4ba1d4['where']=_[_0x3a90('0x41')](_0x4ba1d4[_0x3a90('0x42')],{'$or':_[_0x3a90('0x32')](_0x5ec7d9,function(_0x5b28bf){if(_0x5b28bf['type']!==_0x3a90('0x43')){var _0x32d9a4={};_0x32d9a4[_0x5b28bf[_0x3a90('0x29')]]={'$like':'%'+_0x110f13[_0x3a90('0x34')][_0x3a90('0x40')]+'%'};return _0x32d9a4;}})});}_0x4ba1d4=_[_0x3a90('0x41')]({},_0x4ba1d4,_0x110f13['options']);var _0x197ef3={'where':_0x4ba1d4[_0x3a90('0x42')]};return db[_0x3a90('0x2c')][_0x3a90('0x1e')](_0x197ef3)['then'](function(_0x50fc24){_0x9baea['count']=_0x50fc24;if(_0x110f13[_0x3a90('0x34')][_0x3a90('0x44')]){_0x4ba1d4[_0x3a90('0x45')]=[{'all':!![]}];}return db[_0x3a90('0x2c')][_0x3a90('0x46')](_0x4ba1d4);})['then'](function(_0x98dec7){_0x9baea[_0x3a90('0x47')]=_0x98dec7;return _0x9baea;})[_0x3a90('0x26')](respondWithFilteredResult(_0x5d9f18,_0x4ba1d4))[_0x3a90('0x48')](handleError(_0x5d9f18,null));};exports[_0x3a90('0x49')]=function(_0x46acd1,_0x1bdbaa){var _0x596aca={'raw':![],'where':{'id':_0x46acd1[_0x3a90('0x4a')]['id']}},_0x2a15e0={};_0x2a15e0[_0x3a90('0x30')]=_['keys'](db['VoiceRecording'][_0x3a90('0x2d')]);_0x2a15e0['query']=_[_0x3a90('0x35')](_0x46acd1[_0x3a90('0x34')]);_0x2a15e0[_0x3a90('0x36')]=_[_0x3a90('0x37')](_0x2a15e0[_0x3a90('0x30')],_0x2a15e0[_0x3a90('0x34')]);_0x596aca[_0x3a90('0x38')]=_[_0x3a90('0x37')](_0x2a15e0['model'],qs[_0x3a90('0x39')](_0x46acd1[_0x3a90('0x34')][_0x3a90('0x39')]));_0x596aca['attributes']=_0x596aca[_0x3a90('0x38')][_0x3a90('0x3a')]?_0x596aca[_0x3a90('0x38')]:_0x2a15e0['model'];if(_0x46acd1[_0x3a90('0x34')][_0x3a90('0x44')]){_0x596aca[_0x3a90('0x45')]=[{'all':!![]}];}_0x596aca=_[_0x3a90('0x41')]({},_0x596aca,_0x46acd1['options']);return db[_0x3a90('0x2c')][_0x3a90('0x4b')](_0x596aca)['then'](handleEntityNotFound(_0x1bdbaa,null))['then'](respondWithResult(_0x1bdbaa,null))[_0x3a90('0x48')](handleError(_0x1bdbaa,null));};exports[_0x3a90('0x4c')]=function(_0x2f82be,_0x31755b){return db[_0x3a90('0x2c')]['create'](_0x2f82be[_0x3a90('0x4d')],{})[_0x3a90('0x26')](respondWithResult(_0x31755b,0xc9))[_0x3a90('0x48')](handleError(_0x31755b,null));};exports[_0x3a90('0x24')]=function(_0x20be4c,_0x103f7f){if(_0x20be4c[_0x3a90('0x4d')]['id']){delete _0x20be4c['body']['id'];}return db[_0x3a90('0x2c')][_0x3a90('0x4b')]({'where':{'id':_0x20be4c[_0x3a90('0x4a')]['id']}})[_0x3a90('0x26')](handleEntityNotFound(_0x103f7f,null))[_0x3a90('0x26')](saveUpdates(_0x20be4c[_0x3a90('0x4d')],null))['then'](respondWithResult(_0x103f7f,null))[_0x3a90('0x48')](handleError(_0x103f7f,null));};exports['describe']=function(_0x2ec58e,_0x2edc56){return db['VoiceRecording'][_0x3a90('0x4e')]()['then'](respondWithResult(_0x2edc56,null))[_0x3a90('0x48')](handleError(_0x2edc56,null));};exports[_0x3a90('0x4f')]=function(_0x5aee52,_0x2851bf,_0x556944){var _0x445204=require(_0x3a90('0x50'));var _0xccc09d=![];var _0x2a16a8={};if(_0x5aee52['query'][_0x3a90('0x2e')]&&_0x5aee52['query']['type']===_0x3a90('0x51')){_0x2a16a8[_0x3a90('0x51')]=_0x5aee52[_0x3a90('0x4a')]['id'];}else{_0x2a16a8['id']=_0x5aee52[_0x3a90('0x4a')]['id'];}return db[_0x3a90('0x2c')][_0x3a90('0x4b')]({'where':_0x2a16a8,'attributes':['id',_0x3a90('0x52')],'raw':!![]})[_0x3a90('0x26')](handleEntityNotFound(_0x2851bf,null))['then'](function(_0x28f497){if(_0x28f497){var _0x1d7baf=_0x28f497[_0x3a90('0x52')];var _0x14b1e2=util['format'](_0x3a90('0x53'),_0x1d7baf);if(fs['existsSync'](_0x14b1e2)){_0xccc09d=!![];return _0x445204['decryptFile'](_0x14b1e2,_0x1d7baf,config[_0x3a90('0x54')]['recording'])['then'](function(){return _0x28f497;});}return _0x28f497;}})['then'](function(_0x3d569c){if(_0x3d569c){var _0x2b9e47=_0x3d569c[_0x3a90('0x52')];if(!fs[_0x3a90('0x55')](_0x2b9e47)){throw new db[(_0x3a90('0x56'))][(_0x3a90('0x57'))](_0x3a90('0x58'));}if(_0x3d569c[_0x3a90('0x59')]){return _0x2851bf['download'](_0x2b9e47,_0x3d569c['filename']+path[_0x3a90('0x5a')](_0x2b9e47),function(){if(_0xccc09d){fs[_0x3a90('0x5b')](_0x2b9e47);}});}else{return _0x2851bf[_0x3a90('0x4f')](_0x2b9e47,function(_0x1d5a97){if(_0xccc09d){fs[_0x3a90('0x5b')](_0x2b9e47);}});}}})[_0x3a90('0x48')](function(_0x531e47){if(_0x531e47[_0x3a90('0x5c')]===_0x3a90('0x58')){_0x2851bf[_0x3a90('0x1a')](0x194)[_0x3a90('0x2a')](_0x3a90('0x5d'));}else{return handleError(_0x2851bf,null);}});};exports['downloads']=function(_0x128626,_0x2b1886,_0x1b6cb6){var _0x5751e4=require(_0x3a90('0x50'));var _0x458034=![];var _0x3554f9={'$and':[db[_0x3a90('0x5e')][_0x3a90('0x42')](db['sequelize']['fn'](_0x3a90('0x5f'),db[_0x3a90('0x5e')][_0x3a90('0x60')](_0x3a90('0x51'))),_0x128626['query'][_0x3a90('0x61')])]};if(_0x128626[_0x3a90('0x34')]['type']&&_0x128626[_0x3a90('0x34')]['type']===_0x3a90('0x51')){_0x3554f9[_0x3a90('0x62')][_0x3a90('0x63')]({'uniqueid':_0x128626['params']['id']});}else{_0x3554f9[_0x3a90('0x62')][_0x3a90('0x63')]({'id':_0x128626['params']['id']});}return db[_0x3a90('0x2c')][_0x3a90('0x4b')]({'where':_0x3554f9,'attributes':['id',_0x3a90('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x2b1886,null))['then'](function(_0x4f8faf){if(_0x4f8faf){var _0x2e2a5d=util[_0x3a90('0x33')](_0x3a90('0x53'),_0x4f8faf[_0x3a90('0x52')]);if(fs['existsSync'](_0x2e2a5d)){_0x458034=!![];return _0x5751e4[_0x3a90('0x64')](_0x2e2a5d,_0x4f8faf['value'],config[_0x3a90('0x54')][_0x3a90('0x65')])[_0x3a90('0x26')](function(){return _0x4f8faf;});}return _0x4f8faf;}})[_0x3a90('0x26')](function(_0x1c7aee){if(_0x1c7aee){if(!fs['existsSync'](_0x1c7aee[_0x3a90('0x52')])){throw new db[(_0x3a90('0x56'))][(_0x3a90('0x57'))](_0x3a90('0x58'));}if(_0x1c7aee[_0x3a90('0x59')]){return _0x2b1886[_0x3a90('0x4f')](_0x1c7aee['value'],_0x1c7aee['filename']+path[_0x3a90('0x5a')](_0x1c7aee[_0x3a90('0x52')]),function(){if(_0x458034){fs[_0x3a90('0x5b')](_0x1c7aee[_0x3a90('0x52')]);}});}else{return _0x2b1886[_0x3a90('0x4f')](_0x1c7aee[_0x3a90('0x52')],function(_0x5180ae){if(_0x458034){fs[_0x3a90('0x5b')](_0x1c7aee[_0x3a90('0x52')]);}});}}})['catch'](handleError(_0x2b1886,null));};exports['destroy']=function(_0x3e4a50,_0x52ed53){return db[_0x3a90('0x2c')][_0x3a90('0x4b')]({'where':{'id':_0x3e4a50[_0x3a90('0x4a')]['id']}})[_0x3a90('0x26')](function(_0x12a489){if(_[_0x3a90('0x66')](_0x12a489)){throw new ReferenceError(_0x3a90('0x67'));}return _0x12a489;})['then'](function(_0x183a44){var _0x298a8c=_0x183a44[_0x3a90('0x52')];logger[_0x3a90('0x68')](_0x3a90('0x69'),_0x298a8c);if(!_[_0x3a90('0x66')](_0x183a44[_0x3a90('0x52')])&&fs[_0x3a90('0x55')](_0x298a8c)){logger[_0x3a90('0x68')](_0x3a90('0x6a')+_0x298a8c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x298a8c);}_0x298a8c=_0x298a8c+_0x3a90('0x6b');if(!_[_0x3a90('0x66')](_0x183a44['value'])&&fs[_0x3a90('0x55')](_0x298a8c)){logger[_0x3a90('0x68')](_0x3a90('0x6a')+_0x298a8c+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x298a8c);}return _0x183a44;})[_0x3a90('0x26')](function(_0x4a2248){if(!_0x4a2248)throw new InternalError();return _0x4a2248['destroy']();})[_0x3a90('0x26')](function(){_0x52ed53[_0x3a90('0x1a')](0xcc)[_0x3a90('0x19')]();})[_0x3a90('0x48')](handleError(_0x52ed53,null));};function getBucketslist(_0x5ed825,_0x5e008c,_0x5625ec){return new Promise(function(_0x1ebb3e,_0x410ef6){var _0x2e163f=new AWS['S3']({'accessKeyId':_0x5e008c,'secretAccessKey':_0x5ed825,'region':_0x5625ec});_0x2e163f[_0x3a90('0x6c')]({},function(_0x250648,_0x3da968){if(_0x250648){return _0x410ef6(_0x250648);}else{return _0x1ebb3e(_0x3da968);}});});}function createBucket(_0x35424f,_0x320594,_0x46bf2b,_0x159687){return new Promise(function(_0x1918c7,_0x1fa014){var _0xb84181=new AWS['S3']({'accessKeyId':_0x320594,'secretAccessKey':_0x35424f,'region':_0x46bf2b});_0xb84181[_0x3a90('0x6d')]({'Bucket':_0x159687},function(_0x1e5c44,_0x17e67b){if(_0x1e5c44){return _0x1fa014(_0x1e5c44);}else{return _0x1918c7(_0x17e67b);}});});}function uploadFile(_0xd9b64c,_0x4708f3,_0x3cbb54,_0x36a354,_0x14d96c,_0xf10916){return new Promise(function(_0x126ee0,_0x554c64){var _0x4b29c5=new AWS['S3']({'accessKeyId':_0x4708f3,'secretAccessKey':_0xd9b64c,'region':_0x3cbb54});_0x4b29c5[_0x3a90('0x6e')]({'Bucket':_0x36a354,'Key':_0x14d96c,'Body':_0xf10916},function(_0x51f789,_0x48e7d3){if(_0x51f789){return _0x554c64(_0x51f789);}else{return _0x126ee0(_0x48e7d3);}});});}function startTranscribe(_0x549087,_0xa480a2,_0x19b55d,_0x14aecf,_0x3606c1,_0x1a56d7){return new Promise(function(_0x192e49,_0xf5b56f){var _0x526231=new AWS['TranscribeService']({'accessKeyId':_0xa480a2,'secretAccessKey':_0x549087,'region':_0x19b55d});_0x526231['startTranscriptionJob']({'TranscriptionJobName':_0x14aecf,'LanguageCode':_0x3606c1,'Media':{'MediaFileUri':_0x1a56d7}},function(_0x54cdb2,_0xdf78d8){if(_0x54cdb2){return _0xf5b56f(_0x54cdb2);}else{return _0x192e49(_0xdf78d8);}});});}function transcribe(_0x31fb2c,_0x3d0c93,_0xe89a6a,_0x300325,_0x386628,_0xf37584,_0x2b3219){return new Promise(function(_0x306ee4,_0x1b6064){var _0x49aa4f={};logger[_0x3a90('0x68')](util[_0x3a90('0x33')](_0x3a90('0x6f'),_0x31fb2c,_0x386628));return uploadFile(_0x3d0c93,_0xe89a6a,_0x300325,_0x386628,path[_0x3a90('0x70')](_0xf37584),fs[_0x3a90('0x71')](_0xf37584))[_0x3a90('0x26')](function(_0xc856b8){logger[_0x3a90('0x68')](util[_0x3a90('0x33')](_0x3a90('0x72'),_0x31fb2c,_0x386628,_0xc856b8[_0x3a90('0x73')]));_0x49aa4f[_0x3a90('0x74')]=_0xc856b8[_0x3a90('0x75')];_0x49aa4f[_0x3a90('0x76')]=_0xc856b8[_0x3a90('0x73')];logger[_0x3a90('0x68')](util[_0x3a90('0x33')](_0x3a90('0x77'),_0x31fb2c));return startTranscribe(_0x3d0c93,_0xe89a6a,_0x300325,uuidv4(),_0x2b3219,_0xc856b8['Location']);})['then'](function(_0x2c2383){logger[_0x3a90('0x68')](util[_0x3a90('0x33')](_0x3a90('0x78'),_0x31fb2c,_0x2c2383['TranscriptionJob'][_0x3a90('0x79')]));_0x49aa4f['transcribeName']=_0x2c2383[_0x3a90('0x7a')][_0x3a90('0x79')];_0x49aa4f[_0x3a90('0x7b')]=_0x2c2383[_0x3a90('0x7a')][_0x3a90('0x7c')];return _0x306ee4(_0x49aa4f);})['catch'](function(_0x2d7c4c){return _0x1b6064(_0x2d7c4c);});});}exports[_0x3a90('0x7d')]=function(_0x35ea40,_0x415dff,_0x265e3a){var _0x1378a3;var _0x3f67e8;var _0x302bc6;var _0x3f71fb=require(_0x3a90('0x50'));return db[_0x3a90('0x2c')][_0x3a90('0x7e')]({'where':{'id':_0x35ea40[_0x3a90('0x4a')]['id']}})['then'](function(_0xc5f5a8){if(_0xc5f5a8){var _0x12a8de=util['format'](_0x3a90('0x53'),_0xc5f5a8[_0x3a90('0x52')]);if(fs[_0x3a90('0x55')](_0x12a8de)){cypher=!![];return _0x3f71fb[_0x3a90('0x64')](_0x12a8de,_0xc5f5a8['value'],config[_0x3a90('0x54')][_0x3a90('0x65')])[_0x3a90('0x26')](function(){return _0xc5f5a8;});}return _0xc5f5a8;}})[_0x3a90('0x26')](function(_0x929172){if(!_0x929172){throw new db['Sequelize'][(_0x3a90('0x57'))](_0x3a90('0x7f'));}_0x3f67e8=_0x929172;return db[_0x3a90('0x80')][_0x3a90('0x7e')]({'where':{'id':0x1}});})[_0x3a90('0x26')](handleEntityNotFound(_0x415dff,null))[_0x3a90('0x26')](function(_0x516466){if(_0x516466){_0x1378a3=_0x516466;if(!_0x1378a3['transcribe']||!_0x1378a3[_0x3a90('0x81')]||!_0x1378a3[_0x3a90('0x82')]||!_0x1378a3[_0x3a90('0x83')]||!_0x1378a3['bucket']){throw new db[(_0x3a90('0x56'))]['ValidationError'](_0x3a90('0x84'));}if(_0x35ea40[_0x3a90('0x4d')][_0x3a90('0x85')]&&(!_0x1378a3[_0x3a90('0x86')]||!_0x1378a3[_0x3a90('0x87')]||!_0x1378a3[_0x3a90('0x88')]||!_0x1378a3['language']||!_0x1378a3[_0x3a90('0x74')])){throw new db[(_0x3a90('0x56'))]['ValidationError'](_0x3a90('0x89'));}return db[_0x3a90('0x8a')][_0x3a90('0x7e')]({'where':{'id':_0x1378a3[_0x3a90('0x81')]}});}})[_0x3a90('0x26')](function(_0x351153){if(!_0x351153){throw new db[(_0x3a90('0x56'))]['ValidationError'](_0x3a90('0x8b'));}if(!_0x351153[_0x3a90('0x8c')]||!_0x351153[_0x3a90('0x8d')]){throw new db[(_0x3a90('0x56'))][(_0x3a90('0x57'))](_0x3a90('0x8e'));}_0x302bc6=_0x351153;return getBucketslist(_0x302bc6[_0x3a90('0x8c')],_0x302bc6[_0x3a90('0x8d')],_0x1378a3['transcribeRegion']);})[_0x3a90('0x26')](function(_0x44e088){if(_0x44e088&&_0x44e088['Buckets']){var _0x41133c=_[_0x3a90('0x4b')](_0x44e088[_0x3a90('0x8f')],function(_0x14639b){return _0x14639b['Name']===_0x1378a3[_0x3a90('0x74')];});if(!_0x41133c){logger[_0x3a90('0x68')](util['format'](_0x3a90('0x90'),_0x35ea40['params']['id'],_0x1378a3['bucket']));return createBucket(_0x302bc6[_0x3a90('0x8c')],_0x302bc6['data2'],_0x1378a3[_0x3a90('0x82')],_0x1378a3['bucket']);}logger[_0x3a90('0x68')](util[_0x3a90('0x33')](_0x3a90('0x91'),_0x35ea40['params']['id'],_0x1378a3[_0x3a90('0x74')]));return;}})['then'](function(_0x334604){if(_0x3f67e8[_0x3a90('0x7b')]===_0x3a90('0x92')){return transcribe(_0x35ea40[_0x3a90('0x4a')]['id'],_0x302bc6[_0x3a90('0x8c')],_0x302bc6['data2'],_0x1378a3['transcribeRegion'],_0x1378a3[_0x3a90('0x74')],_0x3f67e8[_0x3a90('0x52')],_0x1378a3[_0x3a90('0x83')]);}else{logger[_0x3a90('0x68')](util[_0x3a90('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x35ea40['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x3a90('0x26')](function(_0x55aef5){if(_0x55aef5){_0x55aef5[_0x3a90('0x93')]=_0x35ea40['body']['runSentiment'];return _0x3f67e8['updateAttributes'](_0x55aef5);}})[_0x3a90('0x26')](respondWithResult(_0x415dff,null))[_0x3a90('0x48')](handleError(_0x415dff,null));};function writeFile(_0x1ed279,_0x2203df){return new Promise(function(_0x3ed18e,_0x51bcf7){fs[_0x3a90('0x94')](_0x2203df,_0x1ed279,function(_0x416721,_0x50bdd0){if(_0x416721){return _0x51bcf7(_0x416721);}else{return _0x3ed18e(_0x50bdd0);}});});}exports['downloadTranscribe']=function(_0x3e55a7,_0x48b432,_0x4c09cf){return db['VoiceRecording'][_0x3a90('0x7e')]({'where':{'id':_0x3e55a7[_0x3a90('0x4a')]['id']}})[_0x3a90('0x26')](handleEntityNotFound(_0x48b432))[_0x3a90('0x26')](function(_0x36560c){if(_0x36560c&&_0x36560c[_0x3a90('0x95')]){var _0x3d516a=_0x36560c[_0x3a90('0x95')];var _0x4a4f6c=config[_0x3a90('0x96')]+_0x3a90('0x97')+_0x36560c['id']+_0x3a90('0x98');if(fs['existsSync'](_0x4a4f6c)){return _0x4a4f6c;}return writeFile(_0x3d516a,_0x4a4f6c)['then'](function(){return _0x4a4f6c;});}else{throw new db['Sequelize'][(_0x3a90('0x57'))](_0x3a90('0x99'));}})[_0x3a90('0x26')](function(_0x577690){return _0x48b432['download'](_0x577690);})[_0x3a90('0x48')](handleError(_0x48b432));}; \ No newline at end of file +var _0x28c6=['Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','includeAll','include','VoiceRecording','findAll','rows','catch','show','params','merge','create','body','find','describe','download','uniqueid','format','%s.cypher','existsSync','value','Sequelize','ValidationError','filename','extname','unlink','VoiceRecording\x20not\x20found','Not\x20found','downloads','../../components/encryptor','MD5','token','$and','push','decryptFile','secrets','recording','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\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','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data1','data2','Buckets'];(function(_0x378b4,_0x5ca7fa){var _0x11d07b=function(_0x35d420){while(--_0x35d420){_0x378b4['push'](_0x378b4['shift']());}};_0x11d07b(++_0x5ca7fa);}(_0x28c6,0xa6));var _0x628c=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x28c6[_0x4e55a9];return _0x4a9b67;};'use strict';var emlformat=require(_0x628c('0x0'));var rimraf=require(_0x628c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x628c('0x2'));var moment=require('moment');var BPromise=require(_0x628c('0x3'));var Mustache=require(_0x628c('0x4'));var util=require(_0x628c('0x5'));var path=require('path');var sox=require(_0x628c('0x6'));var csv=require(_0x628c('0x7'));var ejs=require(_0x628c('0x8'));var fs=require('fs');var fs_extra=require(_0x628c('0x9'));var _=require(_0x628c('0xa'));var squel=require('squel');var crypto=require(_0x628c('0xb'));var jsforce=require(_0x628c('0xc'));var deskjs=require(_0x628c('0xd'));var toCsv=require(_0x628c('0x7'));var querystring=require(_0x628c('0xe'));var Papa=require(_0x628c('0xf'));var AWS=require(_0x628c('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0x628c('0x11'));var authService=require(_0x628c('0x12'));var qs=require(_0x628c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x628c('0x14'));var logger=require(_0x628c('0x15'))(_0x628c('0x16'));var utils=require('../../config/utils');var config=require(_0x628c('0x17'));var licenseUtil=require(_0x628c('0x18'));var db=require(_0x628c('0x19'))['db'];function respondWithStatusCode(_0x5c608c,_0x25ae5e){_0x25ae5e=_0x25ae5e||0xcc;return function(_0x138593){if(_0x138593){return _0x5c608c[_0x628c('0x1a')](_0x25ae5e);}return _0x5c608c[_0x628c('0x1b')](_0x25ae5e)['end']();};}function respondWithResult(_0x3dd829,_0x4a2c5b){_0x4a2c5b=_0x4a2c5b||0xc8;return function(_0x226cb5){if(_0x226cb5){return _0x3dd829[_0x628c('0x1b')](_0x4a2c5b)[_0x628c('0x1c')](_0x226cb5);}};}function respondWithFilteredResult(_0x14bc9c,_0x4280c5){return function(_0x10dcb1){if(_0x10dcb1){var _0x53b2fc=typeof _0x4280c5[_0x628c('0x1d')]===_0x628c('0x1e')&&typeof _0x4280c5[_0x628c('0x1f')]===_0x628c('0x1e');var _0x467108=_0x10dcb1[_0x628c('0x20')];var _0x28344b=_0x53b2fc?0x0:_0x4280c5['offset'];var _0x37743c=_0x53b2fc?_0x10dcb1[_0x628c('0x20')]:_0x4280c5[_0x628c('0x1d')]+_0x4280c5[_0x628c('0x1f')];var _0x68fa4f;if(_0x37743c>=_0x467108){_0x37743c=_0x467108;_0x68fa4f=0xc8;}else{_0x68fa4f=0xce;}_0x14bc9c[_0x628c('0x1b')](_0x68fa4f);return _0x14bc9c[_0x628c('0x21')]('Content-Range',_0x28344b+'-'+_0x37743c+'/'+_0x467108)[_0x628c('0x1c')](_0x10dcb1);}return null;};}function patchUpdates(_0x428603){return function(_0x5df680){try{jsonpatch[_0x628c('0x22')](_0x5df680,_0x428603,!![]);}catch(_0x1aec50){return BPromise[_0x628c('0x23')](_0x1aec50);}return _0x5df680[_0x628c('0x24')]();};}function saveUpdates(_0x7221af,_0x118289){return function(_0x5d99b4){if(_0x5d99b4){return _0x5d99b4[_0x628c('0x25')](_0x7221af)[_0x628c('0x26')](function(_0x3921f1){return _0x3921f1;});}return null;};}function removeEntity(_0x12da9a,_0x52d488){return function(_0x3fa217){if(_0x3fa217){return _0x3fa217[_0x628c('0x27')]()[_0x628c('0x26')](function(){_0x12da9a[_0x628c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3274a7,_0x54d7fb){return function(_0x443a9b){if(!_0x443a9b){_0x3274a7[_0x628c('0x1a')](0x194);}return _0x443a9b;};}function handleError(_0x7edf00,_0x5b2324){_0x5b2324=_0x5b2324||0x1f4;return function(_0x3af09e){logger[_0x628c('0x28')](_0x3af09e['stack']);if(_0x3af09e[_0x628c('0x29')]){delete _0x3af09e[_0x628c('0x29')];}_0x7edf00['status'](_0x5b2324)[_0x628c('0x2a')](_0x3af09e);};}exports[_0x628c('0x2b')]=function(_0x3b77e1,_0x3776dd){var _0x1f2667={},_0x20ff45={},_0x37e85b={'count':0x0,'rows':[]};var _0x3a8e49=_[_0x628c('0x2c')](db['VoiceRecording'][_0x628c('0x2d')],function(_0x3341b2){return{'name':_0x3341b2[_0x628c('0x2e')],'type':_0x3341b2['type'][_0x628c('0x2f')]};});_0x20ff45['model']=_[_0x628c('0x30')](_[_0x628c('0x2c')](_0x3a8e49,_0x628c('0x29')),['format']);_0x20ff45[_0x628c('0x31')]=_[_0x628c('0x32')](_0x3b77e1[_0x628c('0x31')]);_0x20ff45[_0x628c('0x33')]=_[_0x628c('0x34')](_0x20ff45[_0x628c('0x35')],_0x20ff45[_0x628c('0x31')]);_0x1f2667[_0x628c('0x36')]=_[_0x628c('0x34')](_0x20ff45['model'],qs[_0x628c('0x37')](_0x3b77e1[_0x628c('0x31')][_0x628c('0x37')]));_0x1f2667[_0x628c('0x36')]=_0x1f2667['attributes'][_0x628c('0x38')]?_0x1f2667['attributes']:_0x20ff45[_0x628c('0x35')];if(!_0x3b77e1['query']['hasOwnProperty'](_0x628c('0x39'))){_0x1f2667['limit']=qs['limit'](_0x3b77e1[_0x628c('0x31')][_0x628c('0x1f')]);_0x1f2667[_0x628c('0x1d')]=qs[_0x628c('0x1d')](_0x3b77e1[_0x628c('0x31')]['offset']);}_0x1f2667[_0x628c('0x3a')]=qs[_0x628c('0x3b')](_0x3b77e1[_0x628c('0x31')][_0x628c('0x3b')]);_0x1f2667['where']=qs[_0x628c('0x33')](_[_0x628c('0x3c')](_0x3b77e1[_0x628c('0x31')],_0x20ff45['filters']),_0x3a8e49);if(_0x3b77e1[_0x628c('0x31')]['filter']){_0x1f2667[_0x628c('0x3d')]=_['merge'](_0x1f2667[_0x628c('0x3d')],{'$or':_['map'](_0x3a8e49,function(_0x57ab1f){if(_0x57ab1f[_0x628c('0x3e')]!==_0x628c('0x3f')){var _0xee142={};_0xee142[_0x57ab1f[_0x628c('0x29')]]={'$like':'%'+_0x3b77e1['query'][_0x628c('0x40')]+'%'};return _0xee142;}})});}_0x1f2667=_['merge']({},_0x1f2667,_0x3b77e1[_0x628c('0x41')]);var _0x89df23={'where':_0x1f2667[_0x628c('0x3d')]};return db['VoiceRecording'][_0x628c('0x20')](_0x89df23)[_0x628c('0x26')](function(_0x1c4acf){_0x37e85b[_0x628c('0x20')]=_0x1c4acf;if(_0x3b77e1[_0x628c('0x31')][_0x628c('0x42')]){_0x1f2667[_0x628c('0x43')]=[{'all':!![]}];}return db[_0x628c('0x44')][_0x628c('0x45')](_0x1f2667);})[_0x628c('0x26')](function(_0x12e137){_0x37e85b[_0x628c('0x46')]=_0x12e137;return _0x37e85b;})[_0x628c('0x26')](respondWithFilteredResult(_0x3776dd,_0x1f2667))[_0x628c('0x47')](handleError(_0x3776dd,null));};exports[_0x628c('0x48')]=function(_0x5c54d1,_0x5240ea){var _0x34e573={'raw':![],'where':{'id':_0x5c54d1[_0x628c('0x49')]['id']}},_0x43a600={};_0x43a600[_0x628c('0x35')]=_[_0x628c('0x32')](db['VoiceRecording'][_0x628c('0x2d')]);_0x43a600[_0x628c('0x31')]=_[_0x628c('0x32')](_0x5c54d1['query']);_0x43a600[_0x628c('0x33')]=_[_0x628c('0x34')](_0x43a600[_0x628c('0x35')],_0x43a600[_0x628c('0x31')]);_0x34e573[_0x628c('0x36')]=_[_0x628c('0x34')](_0x43a600['model'],qs['fields'](_0x5c54d1[_0x628c('0x31')][_0x628c('0x37')]));_0x34e573['attributes']=_0x34e573[_0x628c('0x36')][_0x628c('0x38')]?_0x34e573[_0x628c('0x36')]:_0x43a600[_0x628c('0x35')];if(_0x5c54d1[_0x628c('0x31')][_0x628c('0x42')]){_0x34e573[_0x628c('0x43')]=[{'all':!![]}];}_0x34e573=_[_0x628c('0x4a')]({},_0x34e573,_0x5c54d1[_0x628c('0x41')]);return db['VoiceRecording']['find'](_0x34e573)[_0x628c('0x26')](handleEntityNotFound(_0x5240ea,null))[_0x628c('0x26')](respondWithResult(_0x5240ea,null))['catch'](handleError(_0x5240ea,null));};exports[_0x628c('0x4b')]=function(_0x5b8991,_0x706196){return db[_0x628c('0x44')]['create'](_0x5b8991['body'],{})[_0x628c('0x26')](respondWithResult(_0x706196,0xc9))['catch'](handleError(_0x706196,null));};exports[_0x628c('0x25')]=function(_0x5c7ee8,_0x3749bf){if(_0x5c7ee8['body']['id']){delete _0x5c7ee8[_0x628c('0x4c')]['id'];}return db[_0x628c('0x44')][_0x628c('0x4d')]({'where':{'id':_0x5c7ee8[_0x628c('0x49')]['id']}})[_0x628c('0x26')](handleEntityNotFound(_0x3749bf,null))[_0x628c('0x26')](saveUpdates(_0x5c7ee8[_0x628c('0x4c')],null))[_0x628c('0x26')](respondWithResult(_0x3749bf,null))[_0x628c('0x47')](handleError(_0x3749bf,null));};exports[_0x628c('0x4e')]=function(_0x545ceb,_0x5c5a5f){return db[_0x628c('0x44')][_0x628c('0x4e')]()['then'](respondWithResult(_0x5c5a5f,null))[_0x628c('0x47')](handleError(_0x5c5a5f,null));};exports[_0x628c('0x4f')]=function(_0x1a5251,_0x53a7cc,_0x2e0bba){var _0xc51ef1=require('../../components/encryptor');var _0x2bb8bb=![];var _0xe126ea={};if(_0x1a5251[_0x628c('0x31')][_0x628c('0x3e')]&&_0x1a5251[_0x628c('0x31')]['type']==='uniqueid'){_0xe126ea[_0x628c('0x50')]=_0x1a5251[_0x628c('0x49')]['id'];}else{_0xe126ea['id']=_0x1a5251['params']['id'];}return db[_0x628c('0x44')][_0x628c('0x4d')]({'where':_0xe126ea,'attributes':['id','value'],'raw':!![]})[_0x628c('0x26')](handleEntityNotFound(_0x53a7cc,null))[_0x628c('0x26')](function(_0x2acc46){if(_0x2acc46){var _0x3487cd=_0x2acc46['value'];var _0x2bc17d=util[_0x628c('0x51')](_0x628c('0x52'),_0x3487cd);if(fs[_0x628c('0x53')](_0x2bc17d)){_0x2bb8bb=!![];return _0xc51ef1['decryptFile'](_0x2bc17d,_0x3487cd,config['secrets']['recording'])['then'](function(){return _0x2acc46;});}return _0x2acc46;}})[_0x628c('0x26')](function(_0x2ce92d){if(_0x2ce92d){var _0x344df2=_0x2ce92d[_0x628c('0x54')];if(!fs[_0x628c('0x53')](_0x344df2)){throw new db[(_0x628c('0x55'))][(_0x628c('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x2ce92d[_0x628c('0x57')]){return _0x53a7cc[_0x628c('0x4f')](_0x344df2,_0x2ce92d[_0x628c('0x57')]+path[_0x628c('0x58')](_0x344df2),function(){if(_0x2bb8bb){fs[_0x628c('0x59')](_0x344df2);}});}else{return _0x53a7cc['download'](_0x344df2,function(_0x2d329e){if(_0x2bb8bb){fs[_0x628c('0x59')](_0x344df2);}});}}})[_0x628c('0x47')](function(_0x4681dd){if(_0x4681dd['message']===_0x628c('0x5a')){_0x53a7cc['status'](0x194)[_0x628c('0x2a')](_0x628c('0x5b'));}else{return handleError(_0x53a7cc,null);}});};exports[_0x628c('0x5c')]=function(_0x4019a5,_0x26e731,_0x5daf83){var _0xf2ef16=require(_0x628c('0x5d'));var _0x387470=![];var _0x235418={'$and':[db['sequelize']['where'](db['sequelize']['fn'](_0x628c('0x5e'),db['sequelize']['col'](_0x628c('0x50'))),_0x4019a5[_0x628c('0x31')][_0x628c('0x5f')])]};if(_0x4019a5['query'][_0x628c('0x3e')]&&_0x4019a5['query'][_0x628c('0x3e')]==='uniqueid'){_0x235418['$and']['push']({'uniqueid':_0x4019a5[_0x628c('0x49')]['id']});}else{_0x235418[_0x628c('0x60')][_0x628c('0x61')]({'id':_0x4019a5['params']['id']});}return db[_0x628c('0x44')][_0x628c('0x4d')]({'where':_0x235418,'attributes':['id','value'],'raw':!![]})[_0x628c('0x26')](handleEntityNotFound(_0x26e731,null))[_0x628c('0x26')](function(_0x320ae7){if(_0x320ae7){var _0x1955d0=util[_0x628c('0x51')]('%s.cypher',_0x320ae7[_0x628c('0x54')]);if(fs[_0x628c('0x53')](_0x1955d0)){_0x387470=!![];return _0xf2ef16[_0x628c('0x62')](_0x1955d0,_0x320ae7[_0x628c('0x54')],config[_0x628c('0x63')][_0x628c('0x64')])[_0x628c('0x26')](function(){return _0x320ae7;});}return _0x320ae7;}})[_0x628c('0x26')](function(_0x2d7eb2){if(_0x2d7eb2){if(!fs['existsSync'](_0x2d7eb2[_0x628c('0x54')])){throw new db[(_0x628c('0x55'))][(_0x628c('0x56'))](_0x628c('0x5a'));}if(_0x2d7eb2[_0x628c('0x57')]){return _0x26e731['download'](_0x2d7eb2['value'],_0x2d7eb2[_0x628c('0x57')]+path[_0x628c('0x58')](_0x2d7eb2[_0x628c('0x54')]),function(){if(_0x387470){fs[_0x628c('0x59')](_0x2d7eb2[_0x628c('0x54')]);}});}else{return _0x26e731[_0x628c('0x4f')](_0x2d7eb2[_0x628c('0x54')],function(_0x5d543e){if(_0x387470){fs[_0x628c('0x59')](_0x2d7eb2['value']);}});}}})['catch'](handleError(_0x26e731,null));};exports[_0x628c('0x27')]=function(_0x171381,_0x782e56){return db[_0x628c('0x44')][_0x628c('0x4d')]({'where':{'id':_0x171381[_0x628c('0x49')]['id']}})[_0x628c('0x26')](function(_0x125cb4){if(_[_0x628c('0x65')](_0x125cb4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x125cb4;})[_0x628c('0x26')](function(_0x52a75f){var _0x360392=_0x52a75f[_0x628c('0x54')];logger[_0x628c('0x66')](_0x628c('0x67'),_0x360392);if(!_[_0x628c('0x65')](_0x52a75f['value'])&&fs[_0x628c('0x53')](_0x360392)){logger['info'](_0x628c('0x68')+_0x360392+_0x628c('0x69'));fs[_0x628c('0x6a')](_0x360392);}_0x360392=_0x360392+'.cypher';if(!_[_0x628c('0x65')](_0x52a75f['value'])&&fs[_0x628c('0x53')](_0x360392)){logger[_0x628c('0x66')](_0x628c('0x68')+_0x360392+_0x628c('0x69'));fs[_0x628c('0x6a')](_0x360392);}return _0x52a75f;})[_0x628c('0x26')](function(_0x418aa2){if(!_0x418aa2)throw new InternalError();return _0x418aa2[_0x628c('0x27')]();})[_0x628c('0x26')](function(){_0x782e56[_0x628c('0x1b')](0xcc)[_0x628c('0x6b')]();})[_0x628c('0x47')](handleError(_0x782e56,null));};function getBucketslist(_0x2a82ce,_0x375ef7,_0x565a42){return new Promise(function(_0x58f902,_0x551568){var _0x2cad69=new AWS['S3']({'accessKeyId':_0x375ef7,'secretAccessKey':_0x2a82ce,'region':_0x565a42});_0x2cad69[_0x628c('0x6c')]({},function(_0x2c8d8b,_0x51f753){if(_0x2c8d8b){return _0x551568(_0x2c8d8b);}else{return _0x58f902(_0x51f753);}});});}function createBucket(_0x3b8af5,_0x469618,_0xd89399,_0x472150){return new Promise(function(_0x5f2320,_0x149659){var _0x2a1edb=new AWS['S3']({'accessKeyId':_0x469618,'secretAccessKey':_0x3b8af5,'region':_0xd89399});_0x2a1edb['createBucket']({'Bucket':_0x472150},function(_0x10a973,_0xf13738){if(_0x10a973){return _0x149659(_0x10a973);}else{return _0x5f2320(_0xf13738);}});});}function uploadFile(_0x50adda,_0x237708,_0x3159d7,_0x3d9942,_0x3f2d15,_0x1007be){return new Promise(function(_0x1ec299,_0x239646){var _0x141fe2=new AWS['S3']({'accessKeyId':_0x237708,'secretAccessKey':_0x50adda,'region':_0x3159d7});_0x141fe2[_0x628c('0x6d')]({'Bucket':_0x3d9942,'Key':_0x3f2d15,'Body':_0x1007be},function(_0xb0d2f8,_0x5090b4){if(_0xb0d2f8){return _0x239646(_0xb0d2f8);}else{return _0x1ec299(_0x5090b4);}});});}function startTranscribe(_0x43efc0,_0x5f3a7b,_0xa8f011,_0x4126a8,_0xe9ea50,_0x73d324){return new Promise(function(_0x55b23f,_0x396edd){var _0x513f5f=new AWS[(_0x628c('0x6e'))]({'accessKeyId':_0x5f3a7b,'secretAccessKey':_0x43efc0,'region':_0xa8f011});_0x513f5f[_0x628c('0x6f')]({'TranscriptionJobName':_0x4126a8,'LanguageCode':_0xe9ea50,'Media':{'MediaFileUri':_0x73d324}},function(_0x50ccbf,_0x2cba64){if(_0x50ccbf){return _0x396edd(_0x50ccbf);}else{return _0x55b23f(_0x2cba64);}});});}function transcribe(_0x41252c,_0x4b5d70,_0x4a9a28,_0x4f778f,_0x5532d8,_0xa1f47c,_0x1f6ac1){return new Promise(function(_0x3e2483,_0x4dc822){var _0x4badf5={};logger[_0x628c('0x66')](util[_0x628c('0x51')](_0x628c('0x70'),_0x41252c,_0x5532d8));return uploadFile(_0x4b5d70,_0x4a9a28,_0x4f778f,_0x5532d8,path['basename'](_0xa1f47c),fs['readFileSync'](_0xa1f47c))[_0x628c('0x26')](function(_0x160843){logger[_0x628c('0x66')](util[_0x628c('0x51')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x41252c,_0x5532d8,_0x160843[_0x628c('0x71')]));_0x4badf5[_0x628c('0x72')]=_0x160843[_0x628c('0x73')];_0x4badf5[_0x628c('0x74')]=_0x160843[_0x628c('0x71')];logger['info'](util['format'](_0x628c('0x75'),_0x41252c));return startTranscribe(_0x4b5d70,_0x4a9a28,_0x4f778f,uuidv4(),_0x1f6ac1,_0x160843[_0x628c('0x71')]);})[_0x628c('0x26')](function(_0x31269d){logger[_0x628c('0x66')](util['format'](_0x628c('0x76'),_0x41252c,_0x31269d[_0x628c('0x77')][_0x628c('0x78')]));_0x4badf5['transcribeName']=_0x31269d[_0x628c('0x77')][_0x628c('0x78')];_0x4badf5[_0x628c('0x79')]=_0x31269d['TranscriptionJob'][_0x628c('0x7a')];return _0x3e2483(_0x4badf5);})[_0x628c('0x47')](function(_0x3494ca){return _0x4dc822(_0x3494ca);});});}exports[_0x628c('0x7b')]=function(_0x30371f,_0x156806,_0x5c4527){var _0x190e99;var _0x2a7952;var _0x5d5011;var _0x38b46b=require(_0x628c('0x5d'));return db['VoiceRecording'][_0x628c('0x7c')]({'where':{'id':_0x30371f[_0x628c('0x49')]['id']}})[_0x628c('0x26')](function(_0x450e7e){if(_0x450e7e){var _0x2fa707=util['format']('%s.cypher',_0x450e7e['value']);if(fs[_0x628c('0x53')](_0x2fa707)){cypher=!![];return _0x38b46b[_0x628c('0x62')](_0x2fa707,_0x450e7e['value'],config[_0x628c('0x63')][_0x628c('0x64')])[_0x628c('0x26')](function(){return _0x450e7e;});}return _0x450e7e;}})[_0x628c('0x26')](function(_0x2f1e2d){if(!_0x2f1e2d){throw new db['Sequelize']['ValidationError'](_0x628c('0x7d'));}_0x2a7952=_0x2f1e2d;return db[_0x628c('0x7e')]['findOne']({'where':{'id':0x1}});})[_0x628c('0x26')](handleEntityNotFound(_0x156806,null))[_0x628c('0x26')](function(_0xd5fd6c){if(_0xd5fd6c){_0x190e99=_0xd5fd6c;if(!_0x190e99[_0x628c('0x7f')]||!_0x190e99[_0x628c('0x80')]||!_0x190e99[_0x628c('0x81')]||!_0x190e99[_0x628c('0x82')]||!_0x190e99[_0x628c('0x72')]){throw new db[(_0x628c('0x55'))][(_0x628c('0x56'))](_0x628c('0x83'));}if(_0x30371f[_0x628c('0x4c')][_0x628c('0x84')]&&(!_0x190e99[_0x628c('0x85')]||!_0x190e99[_0x628c('0x86')]||!_0x190e99[_0x628c('0x87')]||!_0x190e99[_0x628c('0x82')]||!_0x190e99[_0x628c('0x72')])){throw new db[(_0x628c('0x55'))][(_0x628c('0x56'))](_0x628c('0x88'));}return db['CloudProvider']['findOne']({'where':{'id':_0x190e99['transcribeAccountId']}});}})[_0x628c('0x26')](function(_0x52f2f0){if(!_0x52f2f0){throw new db[(_0x628c('0x55'))][(_0x628c('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x52f2f0[_0x628c('0x89')]||!_0x52f2f0['data2']){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5d5011=_0x52f2f0;return getBucketslist(_0x5d5011[_0x628c('0x89')],_0x5d5011[_0x628c('0x8a')],_0x190e99[_0x628c('0x81')]);})[_0x628c('0x26')](function(_0xb3a4d3){if(_0xb3a4d3&&_0xb3a4d3[_0x628c('0x8b')]){var _0x11a17a=_[_0x628c('0x4d')](_0xb3a4d3[_0x628c('0x8b')],function(_0x1f123c){return _0x1f123c[_0x628c('0x8c')]===_0x190e99[_0x628c('0x72')];});if(!_0x11a17a){logger[_0x628c('0x66')](util[_0x628c('0x51')](_0x628c('0x8d'),_0x30371f['params']['id'],_0x190e99[_0x628c('0x72')]));return createBucket(_0x5d5011[_0x628c('0x89')],_0x5d5011[_0x628c('0x8a')],_0x190e99[_0x628c('0x81')],_0x190e99[_0x628c('0x72')]);}logger['info'](util[_0x628c('0x51')](_0x628c('0x8e'),_0x30371f[_0x628c('0x49')]['id'],_0x190e99['bucket']));return;}})[_0x628c('0x26')](function(_0x510d97){if(_0x2a7952[_0x628c('0x79')]===_0x628c('0x8f')){return transcribe(_0x30371f[_0x628c('0x49')]['id'],_0x5d5011[_0x628c('0x89')],_0x5d5011['data2'],_0x190e99['transcribeRegion'],_0x190e99['bucket'],_0x2a7952[_0x628c('0x54')],_0x190e99[_0x628c('0x82')]);}else{logger[_0x628c('0x66')](util[_0x628c('0x51')](_0x628c('0x90'),_0x30371f['params']['id']));return{'transcribeStatus':_0x628c('0x91')};}})[_0x628c('0x26')](function(_0x5748c8){if(_0x5748c8){_0x5748c8[_0x628c('0x92')]=_0x30371f['body'][_0x628c('0x84')];return _0x2a7952[_0x628c('0x93')](_0x5748c8);}})[_0x628c('0x26')](respondWithResult(_0x156806,null))['catch'](handleError(_0x156806,null));};function writeFile(_0x5af5ab,_0x3d9b79){return new Promise(function(_0x22e66b,_0x5ea37c){fs[_0x628c('0x94')](_0x3d9b79,_0x5af5ab,function(_0x353af4,_0x47ba8b){if(_0x353af4){return _0x5ea37c(_0x353af4);}else{return _0x22e66b(_0x47ba8b);}});});}exports[_0x628c('0x95')]=function(_0x48a212,_0x3a1bdf,_0xc6e6d1){return db['VoiceRecording'][_0x628c('0x7c')]({'where':{'id':_0x48a212[_0x628c('0x49')]['id']}})[_0x628c('0x26')](handleEntityNotFound(_0x3a1bdf))[_0x628c('0x26')](function(_0xa88995){if(_0xa88995&&_0xa88995['fileText']){var _0x200b60=_0xa88995['fileText'];var _0x10e7c2=config['root']+_0x628c('0x96')+_0xa88995['id']+_0x628c('0x97');if(fs[_0x628c('0x53')](_0x10e7c2)){return _0x10e7c2;}return writeFile(_0x200b60,_0x10e7c2)[_0x628c('0x26')](function(){return _0x10e7c2;});}else{throw new db['Sequelize'][(_0x628c('0x56'))](_0x628c('0x98'));}})[_0x628c('0x26')](function(_0x32fd9e){return _0x3a1bdf['download'](_0x32fd9e);})[_0x628c('0x47')](handleError(_0x3a1bdf));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 248cc2b..d0a7089 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 _0x0ba7=['./voiceRecording.attributes','define','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0x0ba7,0x16d));var _0x70ba=function(_0x56ef6f,_0x2440fd){_0x56ef6f=_0x56ef6f-0x0;var _0x23e2b9=_0x0ba7[_0x56ef6f];return _0x23e2b9;};'use strict';var attributes=require(_0x70ba('0x0'));module['exports']=function(_0x469795,_0x15094e){return _0x469795[_0x70ba('0x1')](_0x70ba('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x70ba('0x3'),'fields':[_0x70ba('0x3')]},{'name':_0x70ba('0x4'),'fields':[_0x70ba('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aea=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','uniqueid'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x9aea,0xdd));var _0xa9ae=function(_0x3a83fe,_0x7bec21){_0x3a83fe=_0x3a83fe-0x0;var _0x486626=_0x9aea[_0x3a83fe];return _0x486626;};'use strict';var attributes=require(_0xa9ae('0x0'));module['exports']=function(_0x45ec16,_0x5e1d51){return _0x45ec16[_0xa9ae('0x1')](_0xa9ae('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xa9ae('0x3'),'fields':[_0xa9ae('0x3')]},{'name':_0xa9ae('0x4'),'fields':[_0xa9ae('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index a62af09..965d217 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 _0x5f2f=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x488dc5,_0x2dcf61){var _0x4d40f5=function(_0x311184){while(--_0x311184){_0x488dc5['push'](_0x488dc5['shift']());}};_0x4d40f5(++_0x2dcf61);}(_0x5f2f,0x73));var _0xf5f2=function(_0x30b1bc,_0x3a1b05){_0x30b1bc=_0x30b1bc-0x0;var _0x134560=_0x5f2f[_0x30b1bc];return _0x134560;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x21')]=function(_0x13a3be){var _0x281ec8=this;return new Promise(function(_0x294414,_0x4ab014){var _0xaa2602=require(_0xf5f2('0x22'));var _0x375ca8;return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'attributes':['id',_0xf5f2('0x25')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x53cb96){_0x375ca8=_0x53cb96;return db[_0xf5f2('0x18')][_0xf5f2('0x26')](_0x13a3be[_0xf5f2('0x1a')]);})['then'](function(_0x5a2c7e){if(_0x375ca8[_0xf5f2('0x25')]&&fs[_0xf5f2('0x27')](_0x5a2c7e[_0xf5f2('0x28')])){var _0x153924=util[_0xf5f2('0x29')]('%s.cypher',_0x5a2c7e['value']);return _0xaa2602[_0xf5f2('0x2a')](_0x5a2c7e['value'],_0x153924,config[_0xf5f2('0x2b')]['recording'])[_0xf5f2('0x20')](function(){fs[_0xf5f2('0x2c')](_0x5a2c7e[_0xf5f2('0x28')]);logger[_0xf5f2('0xd')](_0xf5f2('0x2d'));return _0x5a2c7e;});}return _0x5a2c7e;})[_0xf5f2('0x20')](function(_0x2ac089){logger[_0xf5f2('0xd')]('CreateVoiceRecording',_0x13a3be);logger[_0xf5f2('0xf')](_0xf5f2('0x21'),_0x13a3be,JSON[_0xf5f2('0x10')](_0x2ac089));_0x294414(_0x2ac089);})[_0xf5f2('0x16')](function(_0x1408b9){logger[_0xf5f2('0x11')](_0xf5f2('0x21'),_0x1408b9['message'],_0x13a3be);_0x4ab014(_0x281ec8[_0xf5f2('0x11')](0x1f4,_0x1408b9[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0x4888=['recording','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateVoiceRecording','VoiceRecording','update','body','options','where','attributes','limit','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','value','format','%s.cypher','encryptFile','secrets'];(function(_0x145520,_0x1c8fa6){var _0x47ef1c=function(_0x53c446){while(--_0x53c446){_0x145520['push'](_0x145520['shift']());}};_0x47ef1c(++_0x1c8fa6);}(_0x4888,0x198));var _0x8488=function(_0x4bdd56,_0x219c46){_0x4bdd56=_0x4bdd56-0x0;var _0x5c1151=_0x4888[_0x4bdd56];return _0x5c1151;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});}exports[_0x8488('0x17')]=function(_0x60ae2f){var _0x39775f=this;return new Promise(function(_0x1aedb1,_0x27c62a){return db[_0x8488('0x18')][_0x8488('0x19')](_0x60ae2f[_0x8488('0x1a')],{'raw':_0x60ae2f[_0x8488('0x1b')]?_0x60ae2f[_0x8488('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x60ae2f['options']?_0x60ae2f[_0x8488('0x1b')][_0x8488('0x1c')]||null:null,'attributes':_0x60ae2f[_0x8488('0x1b')]?_0x60ae2f[_0x8488('0x1b')][_0x8488('0x1d')]||null:null,'limit':_0x60ae2f[_0x8488('0x1b')]?_0x60ae2f[_0x8488('0x1b')][_0x8488('0x1e')]||null:null})[_0x8488('0xd')](function(_0x5123d0){logger[_0x8488('0xe')](_0x8488('0x17'),_0x60ae2f);logger[_0x8488('0x11')](_0x8488('0x17'),_0x60ae2f,JSON[_0x8488('0x12')](_0x5123d0));_0x1aedb1(_0x5123d0);})['catch'](function(_0x577234){logger['error']('UpdateVoiceRecording',_0x577234[_0x8488('0x15')],_0x60ae2f);_0x27c62a(_0x39775f['error'](0x1f4,_0x577234['message']));});});};exports[_0x8488('0x1f')]=function(_0x2f350a){var _0x2b3c97=this;return new Promise(function(_0x6ebee0,_0x287662){var _0x503b83=require(_0x8488('0x20'));var _0x38c137;return db[_0x8488('0x21')][_0x8488('0x22')]({'attributes':['id',_0x8488('0x23')],'where':{'id':0x1},'raw':!![]})[_0x8488('0xd')](function(_0x2c15ff){_0x38c137=_0x2c15ff;return db[_0x8488('0x18')][_0x8488('0x24')](_0x2f350a[_0x8488('0x1a')]);})[_0x8488('0xd')](function(_0x58d0cc){if(_0x38c137['callRecordingEncryption']&&fs['existsSync'](_0x58d0cc[_0x8488('0x25')])){var _0x408c36=util[_0x8488('0x26')](_0x8488('0x27'),_0x58d0cc[_0x8488('0x25')]);return _0x503b83[_0x8488('0x28')](_0x58d0cc['value'],_0x408c36,config[_0x8488('0x29')][_0x8488('0x2a')])[_0x8488('0xd')](function(){fs[_0x8488('0x2b')](_0x58d0cc[_0x8488('0x25')]);logger['info'](_0x8488('0x2c'));return _0x58d0cc;});}return _0x58d0cc;})[_0x8488('0xd')](function(_0x579d50){logger[_0x8488('0xe')](_0x8488('0x1f'),_0x2f350a);logger[_0x8488('0x11')](_0x8488('0x1f'),_0x2f350a,JSON[_0x8488('0x12')](_0x579d50));_0x6ebee0(_0x579d50);})['catch'](function(_0x44c8f3){logger[_0x8488('0x13')](_0x8488('0x1f'),_0x44c8f3['message'],_0x2f350a);_0x287662(_0x2b3c97[_0x8488('0x13')](0x1f4,_0x44c8f3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 7f93b13..8b0dcd4 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 _0x71ac=['path','express','Router','fs-extra','../../components/interaction/service','./voiceTransferReport.controller','isAuthenticated','index','get','describe','post','create','put','/:id','update','destroy','exports','multer','util'];(function(_0x2da36f,_0x591093){var _0x1861bb=function(_0x11350e){while(--_0x11350e){_0x2da36f['push'](_0x2da36f['shift']());}};_0x1861bb(++_0x591093);}(_0x71ac,0x154));var _0xc71a=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0x71ac[_0x4c260a];return _0x17bbdd;};'use strict';var multer=require(_0xc71a('0x0'));var util=require(_0xc71a('0x1'));var path=require(_0xc71a('0x2'));var timeout=require('connect-timeout');var express=require(_0xc71a('0x3'));var router=express[_0xc71a('0x4')]();var fs_extra=require(_0xc71a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc71a('0x6'));var config=require('../../config/environment');var controller=require(_0xc71a('0x7'));router['get']('/',auth[_0xc71a('0x8')](),controller[_0xc71a('0x9')]);router[_0xc71a('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xc71a('0xb')]);router[_0xc71a('0xa')]('/:id',auth[_0xc71a('0x8')](),controller['show']);router[_0xc71a('0xc')]('/',auth[_0xc71a('0x8')](),controller[_0xc71a('0xd')]);router[_0xc71a('0xe')](_0xc71a('0xf'),auth[_0xc71a('0x8')](),controller[_0xc71a('0x10')]);router['delete']('/:id',auth[_0xc71a('0x8')](),controller[_0xc71a('0x11')]);module[_0xc71a('0x12')]=router; \ No newline at end of file +var _0x7909=['fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','util','path','connect-timeout','express'];(function(_0x51d4ee,_0xdead36){var _0x2939b0=function(_0x1d7bf6){while(--_0x1d7bf6){_0x51d4ee['push'](_0x51d4ee['shift']());}};_0x2939b0(++_0xdead36);}(_0x7909,0x12e));var _0x9790=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7909[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x9790('0x0'));var path=require(_0x9790('0x1'));var timeout=require(_0x9790('0x2'));var express=require(_0x9790('0x3'));var router=express['Router']();var fs_extra=require(_0x9790('0x4'));var auth=require(_0x9790('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9790('0x6'));var controller=require(_0x9790('0x7'));router[_0x9790('0x8')]('/',auth[_0x9790('0x9')](),controller[_0x9790('0xa')]);router[_0x9790('0x8')]('/describe',auth[_0x9790('0x9')](),controller['describe']);router[_0x9790('0x8')](_0x9790('0xb'),auth['isAuthenticated'](),controller[_0x9790('0xc')]);router[_0x9790('0xd')]('/',auth['isAuthenticated'](),controller[_0x9790('0xe')]);router[_0x9790('0xf')](_0x9790('0xb'),auth['isAuthenticated'](),controller[_0x9790('0x10')]);router['delete'](_0x9790('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9790('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1552a06..6b027c2 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 _0x4a63=['ENUM','blind','attended','STRING','sequelize','moment'];(function(_0x2e20f7,_0x595785){var _0x4636a1=function(_0x306d70){while(--_0x306d70){_0x2e20f7['push'](_0x2e20f7['shift']());}};_0x4636a1(++_0x595785);}(_0x4a63,0xca));var _0x34a6=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x4a63[_0x365e54];return _0x13317a;};'use strict';var Sequelize=require(_0x34a6('0x0'));var moment=require(_0x34a6('0x1'));module['exports']={'type':{'type':Sequelize[_0x34a6('0x2')](_0x34a6('0x3'),_0x34a6('0x4'))},'result':{'type':Sequelize[_0x34a6('0x5')]},'transfererchannel':{'type':Sequelize[_0x34a6('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x34a6('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x34a6('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x34a6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x34a6('0x5')]},'transferercontext':{'type':Sequelize[_0x34a6('0x5')]},'transfererexten':{'type':Sequelize[_0x34a6('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x34a6('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x34a6('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x34a6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x34a6('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x34a6('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x34a6('0x5')]},'transfereecontext':{'type':Sequelize[_0x34a6('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x34a6('0x5')]},'isexternal':{'type':Sequelize[_0x34a6('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x34a6('0x5')]},'extension':{'type':Sequelize[_0x34a6('0x5')]}}; \ No newline at end of file +var _0x4a0f=['attended','STRING','Yes','sequelize','moment','ENUM','blind'];(function(_0x3dc4d0,_0x5ba240){var _0x30669b=function(_0x4a8a1f){while(--_0x4a8a1f){_0x3dc4d0['push'](_0x3dc4d0['shift']());}};_0x30669b(++_0x5ba240);}(_0x4a0f,0x1ed));var _0xf4a0=function(_0x560542,_0x4c8c73){_0x560542=_0x560542-0x0;var _0x49f743=_0x4a0f[_0x560542];return _0x49f743;};'use strict';var Sequelize=require(_0xf4a0('0x0'));var moment=require(_0xf4a0('0x1'));module['exports']={'type':{'type':Sequelize[_0xf4a0('0x2')](_0xf4a0('0x3'),_0xf4a0('0x4'))},'result':{'type':Sequelize[_0xf4a0('0x5')]},'transfererchannel':{'type':Sequelize[_0xf4a0('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf4a0('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf4a0('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf4a0('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf4a0('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xf4a0('0x5')]},'transferercontext':{'type':Sequelize[_0xf4a0('0x5')]},'transfererexten':{'type':Sequelize[_0xf4a0('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf4a0('0x5')]},'transfereechannel':{'type':Sequelize[_0xf4a0('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf4a0('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf4a0('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf4a0('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xf4a0('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf4a0('0x5')]},'isexternal':{'type':Sequelize[_0xf4a0('0x2')](_0xf4a0('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xf4a0('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 5aa24d1..f832239 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 _0x0dbf=['json','save','update','then','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceTransferReport','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','offset','count','set','Content-Range'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0dbf,0x191));var _0xf0db=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x0dbf[_0x5581ba];return _0x1e927f;};'use strict';var emlformat=require(_0xf0db('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf0db('0x1'));var jsonpatch=require(_0xf0db('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0db('0x3'));var Mustache=require(_0xf0db('0x4'));var util=require(_0xf0db('0x5'));var path=require('path');var sox=require(_0xf0db('0x6'));var csv=require(_0xf0db('0x7'));var ejs=require(_0xf0db('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf0db('0x9'));var squel=require(_0xf0db('0xa'));var crypto=require('crypto');var jsforce=require(_0xf0db('0xb'));var deskjs=require(_0xf0db('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf0db('0xd'));var Papa=require(_0xf0db('0xe'));var Redis=require(_0xf0db('0xf'));var authService=require(_0xf0db('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf0db('0x11'));var hardwareService=require(_0xf0db('0x12'));var logger=require(_0xf0db('0x13'))('api');var utils=require(_0xf0db('0x14'));var config=require(_0xf0db('0x15'));var licenseUtil=require(_0xf0db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239af7,_0x30aafa){_0x30aafa=_0x30aafa||0xcc;return function(_0x15d749){if(_0x15d749){return _0x239af7[_0xf0db('0x17')](_0x30aafa);}return _0x239af7[_0xf0db('0x18')](_0x30aafa)['end']();};}function respondWithResult(_0x2a0dd1,_0x5a85ee){_0x5a85ee=_0x5a85ee||0xc8;return function(_0x4d39f7){if(_0x4d39f7){return _0x2a0dd1[_0xf0db('0x18')](_0x5a85ee)['json'](_0x4d39f7);}};}function respondWithFilteredResult(_0x1dc716,_0x406e59){return function(_0x3c1579){if(_0x3c1579){var _0xd15ab8=typeof _0x406e59['offset']===_0xf0db('0x19')&&typeof _0x406e59[_0xf0db('0x1a')]===_0xf0db('0x19');var _0x3166a3=_0x3c1579['count'];var _0x55066d=_0xd15ab8?0x0:_0x406e59[_0xf0db('0x1b')];var _0x51e007=_0xd15ab8?_0x3c1579[_0xf0db('0x1c')]:_0x406e59['offset']+_0x406e59[_0xf0db('0x1a')];var _0x2e0849;if(_0x51e007>=_0x3166a3){_0x51e007=_0x3166a3;_0x2e0849=0xc8;}else{_0x2e0849=0xce;}_0x1dc716[_0xf0db('0x18')](_0x2e0849);return _0x1dc716[_0xf0db('0x1d')](_0xf0db('0x1e'),_0x55066d+'-'+_0x51e007+'/'+_0x3166a3)[_0xf0db('0x1f')](_0x3c1579);}return null;};}function patchUpdates(_0x131a5b){return function(_0x62b1b3){try{jsonpatch['apply'](_0x62b1b3,_0x131a5b,!![]);}catch(_0x50a4d0){return BPromise['reject'](_0x50a4d0);}return _0x62b1b3[_0xf0db('0x20')]();};}function saveUpdates(_0xc58a4,_0x4a2b60){return function(_0x48f85f){if(_0x48f85f){return _0x48f85f[_0xf0db('0x21')](_0xc58a4)[_0xf0db('0x22')](function(_0x54fb3c){return _0x54fb3c;});}return null;};}function removeEntity(_0x1a22c4,_0x404eb8){return function(_0x2c9055){if(_0x2c9055){return _0x2c9055['destroy']()[_0xf0db('0x22')](function(){_0x1a22c4[_0xf0db('0x18')](0xcc)[_0xf0db('0x23')]();});}};}function handleEntityNotFound(_0x244181,_0xf2b6d3){return function(_0x6bf8bf){if(!_0x6bf8bf){_0x244181['sendStatus'](0x194);}return _0x6bf8bf;};}function handleError(_0x242d5,_0x25dc68){_0x25dc68=_0x25dc68||0x1f4;return function(_0x14d15f){logger[_0xf0db('0x24')](_0x14d15f[_0xf0db('0x25')]);if(_0x14d15f[_0xf0db('0x26')]){delete _0x14d15f[_0xf0db('0x26')];}_0x242d5['status'](_0x25dc68)['send'](_0x14d15f);};}exports['index']=function(_0x5ad329,_0x2d05d0){var _0x52f619={},_0x20eb92={},_0x27665b={'count':0x0,'rows':[]};var _0xe1d3e2=_[_0xf0db('0x27')](db['VoiceTransferReport'][_0xf0db('0x28')],function(_0x3cdc34){return{'name':_0x3cdc34[_0xf0db('0x29')],'type':_0x3cdc34[_0xf0db('0x2a')][_0xf0db('0x2b')]};});_0x20eb92[_0xf0db('0x2c')]=_[_0xf0db('0x27')](_0xe1d3e2,_0xf0db('0x26'));_0x20eb92[_0xf0db('0x2d')]=_[_0xf0db('0x2e')](_0x5ad329['query']);_0x20eb92[_0xf0db('0x2f')]=_[_0xf0db('0x30')](_0x20eb92[_0xf0db('0x2c')],_0x20eb92[_0xf0db('0x2d')]);_0x52f619[_0xf0db('0x31')]=_['intersection'](_0x20eb92[_0xf0db('0x2c')],qs['fields'](_0x5ad329[_0xf0db('0x2d')][_0xf0db('0x32')]));_0x52f619[_0xf0db('0x31')]=_0x52f619[_0xf0db('0x31')][_0xf0db('0x33')]?_0x52f619[_0xf0db('0x31')]:_0x20eb92[_0xf0db('0x2c')];if(!_0x5ad329[_0xf0db('0x2d')][_0xf0db('0x34')](_0xf0db('0x35'))){_0x52f619['limit']=qs['limit'](_0x5ad329[_0xf0db('0x2d')][_0xf0db('0x1a')]);_0x52f619[_0xf0db('0x1b')]=qs['offset'](_0x5ad329[_0xf0db('0x2d')]['offset']);}_0x52f619[_0xf0db('0x36')]=qs['sort'](_0x5ad329['query']['sort']);_0x52f619[_0xf0db('0x37')]=qs[_0xf0db('0x2f')](_[_0xf0db('0x38')](_0x5ad329['query'],_0x20eb92[_0xf0db('0x2f')]),_0xe1d3e2);if(_0x5ad329[_0xf0db('0x2d')][_0xf0db('0x39')]){_0x52f619[_0xf0db('0x37')]=_[_0xf0db('0x3a')](_0x52f619[_0xf0db('0x37')],{'$or':_[_0xf0db('0x27')](_0xe1d3e2,function(_0x6f3a20){if(_0x6f3a20[_0xf0db('0x2a')]!==_0xf0db('0x3b')){var _0x3a4c16={};_0x3a4c16[_0x6f3a20[_0xf0db('0x26')]]={'$like':'%'+_0x5ad329[_0xf0db('0x2d')][_0xf0db('0x39')]+'%'};return _0x3a4c16;}})});}_0x52f619=_[_0xf0db('0x3a')]({},_0x52f619,_0x5ad329[_0xf0db('0x3c')]);var _0x5c5cf0={'where':_0x52f619[_0xf0db('0x37')]};return db['VoiceTransferReport']['count'](_0x5c5cf0)[_0xf0db('0x22')](function(_0x39d817){_0x27665b[_0xf0db('0x1c')]=_0x39d817;if(_0x5ad329[_0xf0db('0x2d')][_0xf0db('0x3d')]){_0x52f619[_0xf0db('0x3e')]=[{'all':!![]}];}return db[_0xf0db('0x3f')]['findAll'](_0x52f619);})[_0xf0db('0x22')](function(_0x28bbc6){_0x27665b[_0xf0db('0x40')]=_0x28bbc6;return _0x27665b;})['then'](respondWithFilteredResult(_0x2d05d0,_0x52f619))[_0xf0db('0x41')](handleError(_0x2d05d0,null));};exports[_0xf0db('0x42')]=function(_0x33b8d6,_0x467861){var _0x3eabff={'raw':!![],'where':{'id':_0x33b8d6[_0xf0db('0x43')]['id']}},_0x44375a={};_0x44375a['model']=_[_0xf0db('0x2e')](db[_0xf0db('0x3f')][_0xf0db('0x28')]);_0x44375a[_0xf0db('0x2d')]=_['keys'](_0x33b8d6[_0xf0db('0x2d')]);_0x44375a[_0xf0db('0x2f')]=_[_0xf0db('0x30')](_0x44375a[_0xf0db('0x2c')],_0x44375a[_0xf0db('0x2d')]);_0x3eabff['attributes']=_[_0xf0db('0x30')](_0x44375a[_0xf0db('0x2c')],qs['fields'](_0x33b8d6[_0xf0db('0x2d')][_0xf0db('0x32')]));_0x3eabff[_0xf0db('0x31')]=_0x3eabff[_0xf0db('0x31')][_0xf0db('0x33')]?_0x3eabff[_0xf0db('0x31')]:_0x44375a[_0xf0db('0x2c')];if(_0x33b8d6[_0xf0db('0x2d')][_0xf0db('0x3d')]){_0x3eabff[_0xf0db('0x3e')]=[{'all':!![]}];}_0x3eabff=_[_0xf0db('0x3a')]({},_0x3eabff,_0x33b8d6['options']);return db[_0xf0db('0x3f')][_0xf0db('0x44')](_0x3eabff)[_0xf0db('0x22')](handleEntityNotFound(_0x467861,null))[_0xf0db('0x22')](respondWithResult(_0x467861,null))[_0xf0db('0x41')](handleError(_0x467861,null));};exports[_0xf0db('0x45')]=function(_0x8db27a,_0x4fa679){return db['VoiceTransferReport'][_0xf0db('0x45')](_0x8db27a[_0xf0db('0x46')],{})['then'](respondWithResult(_0x4fa679,0xc9))[_0xf0db('0x41')](handleError(_0x4fa679,null));};exports['update']=function(_0x12577d,_0x5e0586){if(_0x12577d[_0xf0db('0x46')]['id']){delete _0x12577d[_0xf0db('0x46')]['id'];}return db[_0xf0db('0x3f')][_0xf0db('0x44')]({'where':{'id':_0x12577d[_0xf0db('0x43')]['id']}})[_0xf0db('0x22')](handleEntityNotFound(_0x5e0586,null))[_0xf0db('0x22')](saveUpdates(_0x12577d[_0xf0db('0x46')],null))[_0xf0db('0x22')](respondWithResult(_0x5e0586,null))[_0xf0db('0x41')](handleError(_0x5e0586,null));};exports['destroy']=function(_0x4c55d3,_0x16e74f){return db[_0xf0db('0x3f')][_0xf0db('0x44')]({'where':{'id':_0x4c55d3[_0xf0db('0x43')]['id']}})[_0xf0db('0x22')](handleEntityNotFound(_0x16e74f,null))[_0xf0db('0x22')](removeEntity(_0x16e74f,null))[_0xf0db('0x41')](handleError(_0x16e74f,null));};exports[_0xf0db('0x47')]=function(_0x2610cb,_0xb2342d){return db['VoiceTransferReport'][_0xf0db('0x47')]()['then'](respondWithResult(_0xb2342d,null))['catch'](handleError(_0xb2342d,null));}; \ No newline at end of file +var _0xca42=['sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceTransferReport','include','findAll','catch','show','params','keys','intersection','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','limit','undefined','offset','count','status','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x104870,_0x410c33){var _0x2e3bf8=function(_0x271908){while(--_0x271908){_0x104870['push'](_0x104870['shift']());}};_0x2e3bf8(++_0x410c33);}(_0xca42,0xf2));var _0x2ca4=function(_0x3793f8,_0xf9ad68){_0x3793f8=_0x3793f8-0x0;var _0x3d17f9=_0xca42[_0x3793f8];return _0x3d17f9;};'use strict';var emlformat=require(_0x2ca4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2ca4('0x1'));var jsonpatch=require(_0x2ca4('0x2'));var rp=require(_0x2ca4('0x3'));var moment=require(_0x2ca4('0x4'));var BPromise=require(_0x2ca4('0x5'));var Mustache=require(_0x2ca4('0x6'));var util=require(_0x2ca4('0x7'));var path=require(_0x2ca4('0x8'));var sox=require(_0x2ca4('0x9'));var csv=require(_0x2ca4('0xa'));var ejs=require(_0x2ca4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ca4('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ca4('0xa'));var querystring=require(_0x2ca4('0xd'));var Papa=require('papaparse');var Redis=require(_0x2ca4('0xe'));var authService=require(_0x2ca4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2ca4('0x10'));var hardwareService=require(_0x2ca4('0x11'));var logger=require('../../config/logger')(_0x2ca4('0x12'));var utils=require(_0x2ca4('0x13'));var config=require(_0x2ca4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ca4('0x15'))['db'];function respondWithStatusCode(_0x471c4c,_0x33afab){_0x33afab=_0x33afab||0xcc;return function(_0x27930a){if(_0x27930a){return _0x471c4c[_0x2ca4('0x16')](_0x33afab);}return _0x471c4c['status'](_0x33afab)['end']();};}function respondWithResult(_0x300c5f,_0x3a763c){_0x3a763c=_0x3a763c||0xc8;return function(_0x58e8be){if(_0x58e8be){return _0x300c5f['status'](_0x3a763c)[_0x2ca4('0x17')](_0x58e8be);}};}function respondWithFilteredResult(_0x2c2a40,_0x34c628){return function(_0x3961ef){if(_0x3961ef){var _0x116e85=typeof _0x34c628['offset']==='undefined'&&typeof _0x34c628[_0x2ca4('0x18')]===_0x2ca4('0x19');var _0x1716f1=_0x3961ef['count'];var _0x5398ad=_0x116e85?0x0:_0x34c628[_0x2ca4('0x1a')];var _0x5f1310=_0x116e85?_0x3961ef[_0x2ca4('0x1b')]:_0x34c628[_0x2ca4('0x1a')]+_0x34c628[_0x2ca4('0x18')];var _0x1f4e33;if(_0x5f1310>=_0x1716f1){_0x5f1310=_0x1716f1;_0x1f4e33=0xc8;}else{_0x1f4e33=0xce;}_0x2c2a40[_0x2ca4('0x1c')](_0x1f4e33);return _0x2c2a40[_0x2ca4('0x1d')](_0x2ca4('0x1e'),_0x5398ad+'-'+_0x5f1310+'/'+_0x1716f1)[_0x2ca4('0x17')](_0x3961ef);}return null;};}function patchUpdates(_0x20ba42){return function(_0x39f9cd){try{jsonpatch['apply'](_0x39f9cd,_0x20ba42,!![]);}catch(_0x39bf33){return BPromise[_0x2ca4('0x1f')](_0x39bf33);}return _0x39f9cd[_0x2ca4('0x20')]();};}function saveUpdates(_0x5864df,_0x3dc329){return function(_0x24db10){if(_0x24db10){return _0x24db10[_0x2ca4('0x21')](_0x5864df)[_0x2ca4('0x22')](function(_0x68ed70){return _0x68ed70;});}return null;};}function removeEntity(_0xd488fc,_0x417c8e){return function(_0x3ac345){if(_0x3ac345){return _0x3ac345[_0x2ca4('0x23')]()['then'](function(){_0xd488fc[_0x2ca4('0x1c')](0xcc)[_0x2ca4('0x24')]();});}};}function handleEntityNotFound(_0x3a6047,_0x650eb8){return function(_0x33e77d){if(!_0x33e77d){_0x3a6047['sendStatus'](0x194);}return _0x33e77d;};}function handleError(_0x5a174,_0x1e04b4){_0x1e04b4=_0x1e04b4||0x1f4;return function(_0x23572e){logger['error'](_0x23572e[_0x2ca4('0x25')]);if(_0x23572e[_0x2ca4('0x26')]){delete _0x23572e[_0x2ca4('0x26')];}_0x5a174['status'](_0x1e04b4)[_0x2ca4('0x27')](_0x23572e);};}exports[_0x2ca4('0x28')]=function(_0x1723d9,_0x29fc64){var _0x3ba6aa={},_0x1f85cf={},_0x4c595c={'count':0x0,'rows':[]};var _0x3a3228=_[_0x2ca4('0x29')](db['VoiceTransferReport'][_0x2ca4('0x2a')],function(_0x29fdef){return{'name':_0x29fdef[_0x2ca4('0x2b')],'type':_0x29fdef['type'][_0x2ca4('0x2c')]};});_0x1f85cf[_0x2ca4('0x2d')]=_['map'](_0x3a3228,_0x2ca4('0x26'));_0x1f85cf['query']=_['keys'](_0x1723d9[_0x2ca4('0x2e')]);_0x1f85cf[_0x2ca4('0x2f')]=_['intersection'](_0x1f85cf[_0x2ca4('0x2d')],_0x1f85cf[_0x2ca4('0x2e')]);_0x3ba6aa[_0x2ca4('0x30')]=_['intersection'](_0x1f85cf[_0x2ca4('0x2d')],qs['fields'](_0x1723d9[_0x2ca4('0x2e')][_0x2ca4('0x31')]));_0x3ba6aa[_0x2ca4('0x30')]=_0x3ba6aa[_0x2ca4('0x30')][_0x2ca4('0x32')]?_0x3ba6aa[_0x2ca4('0x30')]:_0x1f85cf[_0x2ca4('0x2d')];if(!_0x1723d9[_0x2ca4('0x2e')][_0x2ca4('0x33')](_0x2ca4('0x34'))){_0x3ba6aa[_0x2ca4('0x18')]=qs[_0x2ca4('0x18')](_0x1723d9[_0x2ca4('0x2e')]['limit']);_0x3ba6aa[_0x2ca4('0x1a')]=qs['offset'](_0x1723d9[_0x2ca4('0x2e')][_0x2ca4('0x1a')]);}_0x3ba6aa[_0x2ca4('0x35')]=qs[_0x2ca4('0x36')](_0x1723d9[_0x2ca4('0x2e')][_0x2ca4('0x36')]);_0x3ba6aa[_0x2ca4('0x37')]=qs[_0x2ca4('0x2f')](_[_0x2ca4('0x38')](_0x1723d9[_0x2ca4('0x2e')],_0x1f85cf[_0x2ca4('0x2f')]),_0x3a3228);if(_0x1723d9[_0x2ca4('0x2e')][_0x2ca4('0x39')]){_0x3ba6aa[_0x2ca4('0x37')]=_[_0x2ca4('0x3a')](_0x3ba6aa['where'],{'$or':_['map'](_0x3a3228,function(_0x4871d4){if(_0x4871d4[_0x2ca4('0x3b')]!==_0x2ca4('0x3c')){var _0x437c88={};_0x437c88[_0x4871d4[_0x2ca4('0x26')]]={'$like':'%'+_0x1723d9[_0x2ca4('0x2e')][_0x2ca4('0x39')]+'%'};return _0x437c88;}})});}_0x3ba6aa=_[_0x2ca4('0x3a')]({},_0x3ba6aa,_0x1723d9[_0x2ca4('0x3d')]);var _0x21e4a2={'where':_0x3ba6aa[_0x2ca4('0x37')]};return db[_0x2ca4('0x3e')]['count'](_0x21e4a2)[_0x2ca4('0x22')](function(_0x48521d){_0x4c595c['count']=_0x48521d;if(_0x1723d9['query']['includeAll']){_0x3ba6aa[_0x2ca4('0x3f')]=[{'all':!![]}];}return db[_0x2ca4('0x3e')][_0x2ca4('0x40')](_0x3ba6aa);})['then'](function(_0x1003b8){_0x4c595c['rows']=_0x1003b8;return _0x4c595c;})[_0x2ca4('0x22')](respondWithFilteredResult(_0x29fc64,_0x3ba6aa))[_0x2ca4('0x41')](handleError(_0x29fc64,null));};exports[_0x2ca4('0x42')]=function(_0x297336,_0x50599e){var _0x11a375={'raw':!![],'where':{'id':_0x297336[_0x2ca4('0x43')]['id']}},_0x45fd69={};_0x45fd69[_0x2ca4('0x2d')]=_[_0x2ca4('0x44')](db[_0x2ca4('0x3e')]['rawAttributes']);_0x45fd69[_0x2ca4('0x2e')]=_[_0x2ca4('0x44')](_0x297336['query']);_0x45fd69[_0x2ca4('0x2f')]=_[_0x2ca4('0x45')](_0x45fd69[_0x2ca4('0x2d')],_0x45fd69[_0x2ca4('0x2e')]);_0x11a375['attributes']=_[_0x2ca4('0x45')](_0x45fd69['model'],qs[_0x2ca4('0x31')](_0x297336['query'][_0x2ca4('0x31')]));_0x11a375[_0x2ca4('0x30')]=_0x11a375[_0x2ca4('0x30')][_0x2ca4('0x32')]?_0x11a375[_0x2ca4('0x30')]:_0x45fd69[_0x2ca4('0x2d')];if(_0x297336['query']['includeAll']){_0x11a375['include']=[{'all':!![]}];}_0x11a375=_[_0x2ca4('0x3a')]({},_0x11a375,_0x297336[_0x2ca4('0x3d')]);return db[_0x2ca4('0x3e')][_0x2ca4('0x46')](_0x11a375)[_0x2ca4('0x22')](handleEntityNotFound(_0x50599e,null))[_0x2ca4('0x22')](respondWithResult(_0x50599e,null))[_0x2ca4('0x41')](handleError(_0x50599e,null));};exports[_0x2ca4('0x47')]=function(_0x455f17,_0xeac9a5){return db['VoiceTransferReport'][_0x2ca4('0x47')](_0x455f17['body'],{})['then'](respondWithResult(_0xeac9a5,0xc9))['catch'](handleError(_0xeac9a5,null));};exports[_0x2ca4('0x21')]=function(_0x34e038,_0x461ea4){if(_0x34e038[_0x2ca4('0x48')]['id']){delete _0x34e038[_0x2ca4('0x48')]['id'];}return db[_0x2ca4('0x3e')]['find']({'where':{'id':_0x34e038[_0x2ca4('0x43')]['id']}})[_0x2ca4('0x22')](handleEntityNotFound(_0x461ea4,null))[_0x2ca4('0x22')](saveUpdates(_0x34e038[_0x2ca4('0x48')],null))[_0x2ca4('0x22')](respondWithResult(_0x461ea4,null))[_0x2ca4('0x41')](handleError(_0x461ea4,null));};exports[_0x2ca4('0x23')]=function(_0xf39347,_0x494c7a){return db['VoiceTransferReport'][_0x2ca4('0x46')]({'where':{'id':_0xf39347[_0x2ca4('0x43')]['id']}})[_0x2ca4('0x22')](handleEntityNotFound(_0x494c7a,null))[_0x2ca4('0x22')](removeEntity(_0x494c7a,null))[_0x2ca4('0x41')](handleError(_0x494c7a,null));};exports[_0x2ca4('0x49')]=function(_0x4ed6ec,_0x40596b){return db[_0x2ca4('0x3e')][_0x2ca4('0x49')]()[_0x2ca4('0x22')](respondWithResult(_0x40596b,null))['catch'](handleError(_0x40596b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2e951c0..0268c09 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 _0x57ad=['report_call_transfer','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','define'];(function(_0x860edc,_0x5388b6){var _0x463dea=function(_0x32c909){while(--_0x32c909){_0x860edc['push'](_0x860edc['shift']());}};_0x463dea(++_0x5388b6);}(_0x57ad,0x14b));var _0xd57a=function(_0x5be0cf,_0x4cfe44){_0x5be0cf=_0x5be0cf-0x0;var _0xecd17a=_0x57ad[_0x5be0cf];return _0xecd17a;};'use strict';var _=require(_0xd57a('0x0'));var util=require(_0xd57a('0x1'));var logger=require(_0xd57a('0x2'))(_0xd57a('0x3'));var moment=require('moment');var BPromise=require(_0xd57a('0x4'));var rp=require(_0xd57a('0x5'));var fs=require('fs');var path=require(_0xd57a('0x6'));var rimraf=require('rimraf');var config=require(_0xd57a('0x7'));var attributes=require(_0xd57a('0x8'));module['exports']=function(_0x17f7c9,_0x33f8d4){return _0x17f7c9[_0xd57a('0x9')]('VoiceTransferReport',attributes,{'tableName':_0xd57a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb570=['path','../../config/environment','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4e9438,_0x25146a){var _0x27a778=function(_0x28f748){while(--_0x28f748){_0x4e9438['push'](_0x4e9438['shift']());}};_0x27a778(++_0x25146a);}(_0xb570,0x144));var _0x0b57=function(_0x3ba01f,_0x3c000e){_0x3ba01f=_0x3ba01f-0x0;var _0x53f5a5=_0xb570[_0x3ba01f];return _0x53f5a5;};'use strict';var _=require(_0x0b57('0x0'));var util=require(_0x0b57('0x1'));var logger=require(_0x0b57('0x2'))(_0x0b57('0x3'));var moment=require(_0x0b57('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b57('0x5'));var fs=require('fs');var path=require(_0x0b57('0x6'));var rimraf=require('rimraf');var config=require(_0x0b57('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0xe06428,_0x34dcd7){return _0xe06428[_0x0b57('0x8')](_0x0b57('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index d094817..be61707 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 _0xd445=['body','options','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateVoiceTransferReport','create'];(function(_0x520236,_0x5c8564){var _0x4d6664=function(_0x398c51){while(--_0x398c51){_0x520236['push'](_0x520236['shift']());}};_0x4d6664(++_0x5c8564);}(_0xd445,0x146));var _0x5d44=function(_0x1af11c,_0x24e084){_0x1af11c=_0x1af11c-0x0;var _0x29d074=_0xd445[_0x1af11c];return _0x29d074;};'use strict';var _=require(_0x5d44('0x0'));var util=require('util');var moment=require(_0x5d44('0x1'));var BPromise=require(_0x5d44('0x2'));var rs=require(_0x5d44('0x3'));var fs=require('fs');var Redis=require(_0x5d44('0x4'));var db=require(_0x5d44('0x5'))['db'];var utils=require(_0x5d44('0x6'));var logger=require(_0x5d44('0x7'))(_0x5d44('0x8'));var config=require(_0x5d44('0x9'));var jayson=require(_0x5d44('0xa'));var client=jayson[_0x5d44('0xb')][_0x5d44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x24f31d,_0x4b3c12,_0x312528){return new BPromise(function(_0x56d376,_0xb346bd){return client[_0x5d44('0xd')](_0x24f31d,_0x312528)['then'](function(_0x4fce15){logger[_0x5d44('0xe')](_0x5d44('0xf'),_0x4b3c12,'request\x20sent');logger[_0x5d44('0x10')](_0x5d44('0x11'),_0x4b3c12,_0x5d44('0x12'),JSON[_0x5d44('0x13')](_0x4fce15));if(_0x4fce15[_0x5d44('0x14')]){if(_0x4fce15['error']['code']===0x1f4){logger[_0x5d44('0x14')](_0x5d44('0xf'),_0x4b3c12,_0x4fce15[_0x5d44('0x14')][_0x5d44('0x15')]);return _0xb346bd(_0x4fce15[_0x5d44('0x14')]['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4b3c12,_0x4fce15[_0x5d44('0x14')]['message']);return _0x56d376(_0x4fce15[_0x5d44('0x14')][_0x5d44('0x15')]);}else{logger[_0x5d44('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b3c12,_0x5d44('0x12'));_0x56d376(_0x4fce15['result'][_0x5d44('0x15')]);}})[_0x5d44('0x16')](function(_0x24cd7d){logger[_0x5d44('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b3c12,_0x24cd7d);_0xb346bd(_0x24cd7d);});});}exports[_0x5d44('0x17')]=function(_0x16bb84){var _0xffc1e8=this;return new Promise(function(_0x1af3ec,_0x51b851){return db['VoiceTransferReport'][_0x5d44('0x18')](_0x16bb84[_0x5d44('0x19')],{'raw':_0x16bb84[_0x5d44('0x1a')]?_0x16bb84[_0x5d44('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xd96c4b){logger[_0x5d44('0xe')]('CreateVoiceTransferReport',_0x16bb84);logger['debug'](_0x5d44('0x17'),_0x16bb84,JSON[_0x5d44('0x13')](_0xd96c4b));_0x1af3ec(_0xd96c4b);})[_0x5d44('0x16')](function(_0x301f5a){logger[_0x5d44('0x14')](_0x5d44('0x17'),_0x301f5a['message'],_0x16bb84);_0x51b851(_0xffc1e8['error'](0x1f4,_0x301f5a[_0x5d44('0x15')]));});});}; \ No newline at end of file +var _0xe184=['message','result','catch','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xe184,0x188));var _0x4e18=function(_0x24c72d,_0x58d17f){_0x24c72d=_0x24c72d-0x0;var _0x1176b9=_0xe184[_0x24c72d];return _0x1176b9;};'use strict';var _=require(_0x4e18('0x0'));var util=require(_0x4e18('0x1'));var moment=require(_0x4e18('0x2'));var BPromise=require(_0x4e18('0x3'));var rs=require(_0x4e18('0x4'));var fs=require('fs');var Redis=require(_0x4e18('0x5'));var db=require(_0x4e18('0x6'))['db'];var utils=require(_0x4e18('0x7'));var logger=require(_0x4e18('0x8'))(_0x4e18('0x9'));var config=require(_0x4e18('0xa'));var jayson=require(_0x4e18('0xb'));var client=jayson[_0x4e18('0xc')][_0x4e18('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x27285c,_0x6a9895,_0x3c5206){return new BPromise(function(_0x1446b4,_0x160be5){return client[_0x4e18('0xe')](_0x27285c,_0x3c5206)[_0x4e18('0xf')](function(_0xab9ac0){logger[_0x4e18('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x6a9895,_0x4e18('0x11'));logger[_0x4e18('0x12')](_0x4e18('0x13'),_0x6a9895,'request\x20sent',JSON[_0x4e18('0x14')](_0xab9ac0));if(_0xab9ac0[_0x4e18('0x15')]){if(_0xab9ac0[_0x4e18('0x15')][_0x4e18('0x16')]===0x1f4){logger[_0x4e18('0x15')](_0x4e18('0x17'),_0x6a9895,_0xab9ac0['error']['message']);return _0x160be5(_0xab9ac0[_0x4e18('0x15')][_0x4e18('0x18')]);}logger[_0x4e18('0x15')](_0x4e18('0x17'),_0x6a9895,_0xab9ac0[_0x4e18('0x15')][_0x4e18('0x18')]);return _0x1446b4(_0xab9ac0['error'][_0x4e18('0x18')]);}else{logger['info'](_0x4e18('0x17'),_0x6a9895,'request\x20sent');_0x1446b4(_0xab9ac0[_0x4e18('0x19')][_0x4e18('0x18')]);}})[_0x4e18('0x1a')](function(_0x1e46a9){logger[_0x4e18('0x15')](_0x4e18('0x17'),_0x6a9895,_0x1e46a9);_0x160be5(_0x1e46a9);});});}exports['CreateVoiceTransferReport']=function(_0x28e7e2){var _0x253aa2=this;return new Promise(function(_0x226773,_0xe1979a){return db[_0x4e18('0x1b')][_0x4e18('0x1c')](_0x28e7e2['body'],{'raw':_0x28e7e2[_0x4e18('0x1d')]?_0x28e7e2[_0x4e18('0x1d')][_0x4e18('0x1e')]===undefined?!![]:![]:!![]})[_0x4e18('0xf')](function(_0x2603d8){logger[_0x4e18('0x10')]('CreateVoiceTransferReport',_0x28e7e2);logger['debug'](_0x4e18('0x1f'),_0x28e7e2,JSON['stringify'](_0x2603d8));_0x226773(_0x2603d8);})['catch'](function(_0x32af2a){logger[_0x4e18('0x15')](_0x4e18('0x1f'),_0x32af2a[_0x4e18('0x18')],_0x28e7e2);_0xe1979a(_0x253aa2['error'](0x1f4,_0x32af2a[_0x4e18('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index db88869..081b1eb 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(_0x37abc7,_0x381e97){var _0x5c16bc=function(_0x4c42c0){while(--_0x4c42c0){_0x37abc7['push'](_0x37abc7['shift']());}};_0x5c16bc(++_0x381e97);}(_0x9f62,0x154));var _0x29f6=function(_0x323fe0,_0x3dc3b1){_0x323fe0=_0x323fe0-0x0;var _0x3daf2f=_0x9f62[_0x323fe0];return _0x3daf2f;};'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 _0xb4e6=['unhold','calls','/transfer','exports','express','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/hold','hold','/unhold'];(function(_0x462345,_0x3ef834){var _0x397683=function(_0x2ea21d){while(--_0x2ea21d){_0x462345['push'](_0x462345['shift']());}};_0x397683(++_0x3ef834);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xb4e6[_0x2064e5];return _0x21a233;};'use strict';var express=require(_0x6b4e('0x0'));var router=express['Router']();var auth=require(_0x6b4e('0x1'));var controller=require(_0x6b4e('0x2'));router[_0x6b4e('0x3')](_0x6b4e('0x4'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0x7')]);router['post'](_0x6b4e('0x8'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['hangup']);router[_0x6b4e('0x3')]('/answer',auth['isAuthenticated'](),auth[_0x6b4e('0x6')](),controller['answer']);router['post'](_0x6b4e('0x9'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xa')]);router[_0x6b4e('0x3')](_0x6b4e('0xb'),auth[_0x6b4e('0x5')](),auth['isWebrtcLicence'](),controller[_0x6b4e('0xc')]);router[_0x6b4e('0x3')]('/calls',auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller[_0x6b4e('0xd')]);router[_0x6b4e('0x3')](_0x6b4e('0xe'),auth[_0x6b4e('0x5')](),auth[_0x6b4e('0x6')](),controller['transfer']);module[_0x6b4e('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index f1a30e6..cfadf70 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 _0x42d4=['jayson/promise','http','../../config/logger','webbarapi','redis','socket.io-emitter','validate','number','userId\x20is\x20required','string','info','stringify','log','error','stack','name','status','send','NotFound','request','code','result','User','findOne','agent','then','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','body','json','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','catch','hangup','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','path','lodash','../../mysqldb','bluebird'];(function(_0x2a9cf0,_0xa14a3d){var _0x19ff88=function(_0x43855b){while(--_0x43855b){_0x2a9cf0['push'](_0x2a9cf0['shift']());}};_0x19ff88(++_0xa14a3d);}(_0x42d4,0x10c));var _0x442d=function(_0x529577,_0x4be5a9){_0x529577=_0x529577-0x0;var _0x345761=_0x42d4[_0x529577];return _0x345761;};'use strict';var path=require(_0x442d('0x0'));var fs=require('fs');var _=require(_0x442d('0x1'));var db=require(_0x442d('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x442d('0x3'));var jayson=require(_0x442d('0x4'));var amiClient=jayson['client'][_0x442d('0x5')]({'port':0x232a});var logger=require(_0x442d('0x6'))(_0x442d('0x7'));var Redis=require('ioredis');config[_0x442d('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x442d('0x9'))(new Redis(config[_0x442d('0x8')]));var Schema=require(_0x442d('0xa'));var originateValidation=new Schema({'userId':{'type':_0x442d('0xb'),'required':[!![],_0x442d('0xc')]},'callNumber':{'type':_0x442d('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x442d('0xd')},'callbackUrl':{'type':_0x442d('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x442d('0xb'),'required':[!![],_0x442d('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x442d('0xb'),'required':[!![],_0x442d('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x442d('0xb'),'required':[!![],_0x442d('0xc')]},'sessionId':{'type':_0x442d('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x442d('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x442d('0xb'),'required':[!![],_0x442d('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x442d('0xc')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x442d('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x442d('0xb'),'required':[!![],_0x442d('0xc')]}});function emit(_0x56bfd9,_0x4fbd30,_0x3f704d){logger[_0x442d('0xe')](_0x56bfd9,_0x4fbd30,JSON[_0x442d('0xf')](_0x3f704d));io['to'](_0x56bfd9)['emit'](_0x4fbd30,_0x3f704d);}function handleError(_0x4dbee2){return function(_0x4d1d97){console[_0x442d('0x10')]('handleError:',_0x4d1d97,_0x4d1d97 instanceof RangeError);logger[_0x442d('0x11')](_0x4d1d97[_0x442d('0x12')]);if(_0x4d1d97 instanceof RangeError){if(_0x4d1d97[_0x442d('0x13')]){delete _0x4d1d97[_0x442d('0x13')];}_0x4dbee2[_0x442d('0x14')](0x194)[_0x442d('0x15')](_0x4d1d97);}else{if(_0x4d1d97[_0x442d('0x13')]){delete _0x4d1d97[_0x442d('0x13')];}_0x4dbee2['status'](0x1f4)[_0x442d('0x15')](_0x4d1d97);}};}function checkError(){return function(_0xf8f9ca){if(!_0xf8f9ca){throw new RangeError(_0x442d('0x16'));}return _0xf8f9ca;};}function respondWithRpcPromise(_0x4603ec,_0x2e7954){return new BPromise(function(_0x4e8383,_0x3b6729){var _0x24a0ea=amiClient;return _0x24a0ea[_0x442d('0x17')](_0x4603ec,_0x2e7954)['then'](function(_0x5458af){if(_0x5458af[_0x442d('0x11')]){if(_0x5458af[_0x442d('0x11')][_0x442d('0x18')]===0x1f4){return _0x3b6729(_0x5458af['error']['message']);}return _0x4e8383(_0x5458af[_0x442d('0x11')]['message']);}else{_0x4e8383(_0x5458af[_0x442d('0x19')]);}})['catch'](function(_0x10f3cf){_0x3b6729(_0x10f3cf);});});}function getAgent(_0x50cfe4){return db[_0x442d('0x1a')][_0x442d('0x1b')]({'where':{'id':_0x50cfe4,'role':_0x442d('0x1c')}})[_0x442d('0x1d')](checkError());}function getAgentCheckSession(_0x33af9e,_0x4d5d5d){return new BPromise(function(_0x3a74bb,_0x574679){var _0x5a4630=respondWithRpcPromise(_0x442d('0x1e'));var _0x359d26=getAgent(_0x33af9e);Promise[_0x442d('0x1f')]([_0x5a4630,_0x359d26])['then'](function(_0x8cfd11){var _0x2ec3ae=_0x8cfd11[0x0];var _0x3b7c3e=_0x8cfd11[0x1];var _0xc5434d=_['filter'](_0x2ec3ae[_0x442d('0x20')],function(_0x51f473){return _0x51f473['UserId']==_0x3b7c3e['id']&&_0x51f473[_0x442d('0x21')]==_0x4d5d5d;});if(_0xc5434d[_0x442d('0x22')]==0x1){_0x3a74bb(_0x3b7c3e);}else{_0x574679(new RangeError(_0x442d('0x23')+_0x4d5d5d+_0x442d('0x24')));}});});}exports['originate']=function(_0x26c6c6,_0xef9c01){logger[_0x442d('0xe')]('originate\x20fired:',_0x26c6c6[_0x442d('0x25')]);var _0x29a252=originateValidation[_0x442d('0xa')](_0x26c6c6[_0x442d('0x25')]);if(_0x29a252[_0x442d('0x22')]>0x0){return _0xef9c01[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0x29a252);}var _0x43e3e5=_0x26c6c6[_0x442d('0x25')]['userId'];var _0x1878af=_0x26c6c6[_0x442d('0x25')][_0x442d('0x27')];var _0x349ad4=_0x26c6c6[_0x442d('0x25')][_0x442d('0x28')];var _0x46ac42=_0x26c6c6['body'][_0x442d('0x29')];return getAgent(_0x43e3e5)['then'](function(_0x288b94){logger[_0x442d('0xe')](_0x442d('0x2a'),_0x288b94[_0x442d('0x13')]);emit(util[_0x442d('0x2b')](_0x442d('0x2c'),_0x288b94[_0x442d('0x13')]),_0x442d('0x2d'),{'callNumber':_0x1878af,'callerId':_0x349ad4,'callbackUrl':_0x46ac42});return _0xef9c01[_0x442d('0x14')](0xc8)[_0x442d('0x26')]({'error':![],'message':'originate\x20executed!'});})[_0x442d('0x2e')](handleError(_0xef9c01));};exports[_0x442d('0x2f')]=function(_0xf283fc,_0x1924ae){logger[_0x442d('0xe')]('hangup\x20fired:',_0xf283fc[_0x442d('0x25')]);var _0x3372af=hangupValidation['validate'](_0xf283fc[_0x442d('0x25')]);if(_0x3372af['length']>0x0){return _0x1924ae['status'](0x190)[_0x442d('0x26')](_0x3372af);}var _0x1f6b9c=_0xf283fc[_0x442d('0x25')][_0x442d('0x30')];var _0x27b4d9=_0xf283fc['body'][_0x442d('0x21')];return getAgent(_0x1f6b9c)[_0x442d('0x1d')](function(_0x44bb31){logger['info'](_0x442d('0x2a'),_0x44bb31[_0x442d('0x13')]);emit(util[_0x442d('0x2b')](_0x442d('0x2c'),_0x44bb31[_0x442d('0x13')]),_0x442d('0x31'),{'sessionId':_0x27b4d9});return _0x1924ae[_0x442d('0x14')](0xc8)[_0x442d('0x26')]({'error':![],'message':_0x442d('0x32')});})[_0x442d('0x2e')](handleError(_0x1924ae));};exports[_0x442d('0x33')]=function(_0x3c1da8,_0x47f0d8){logger[_0x442d('0xe')](_0x442d('0x34'),_0x3c1da8[_0x442d('0x25')]);var _0x3d83ce=answerValidation['validate'](_0x3c1da8[_0x442d('0x25')]);if(_0x3d83ce[_0x442d('0x22')]>0x0){return _0x47f0d8[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0x3d83ce);}var _0x3c9df5=_0x3c1da8[_0x442d('0x25')][_0x442d('0x30')];var _0x2c0aa9=_0x3c1da8[_0x442d('0x25')][_0x442d('0x21')];return getAgent(_0x3c9df5)['then'](function(_0x542861){logger[_0x442d('0xe')]('entityFound:',_0x542861[_0x442d('0x13')]);emit(util[_0x442d('0x2b')](_0x442d('0x2c'),_0x542861['name']),_0x442d('0x35'),{'sessionId':_0x2c0aa9});return _0x47f0d8['status'](0xc8)['json']({'error':![],'message':_0x442d('0x36')});})[_0x442d('0x2e')](handleError(_0x47f0d8));};exports[_0x442d('0x37')]=function(_0x269fd4,_0xe95034){logger[_0x442d('0xe')](_0x442d('0x38'),_0x269fd4[_0x442d('0x25')]);var _0x1fe762=holdValidation[_0x442d('0xa')](_0x269fd4['body']);if(_0x1fe762[_0x442d('0x22')]>0x0){return _0xe95034[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0x1fe762);}var _0x231ba2=_0x269fd4[_0x442d('0x25')]['userId'];var _0x26c848=_0x269fd4[_0x442d('0x25')][_0x442d('0x21')];return getAgent(_0x231ba2)[_0x442d('0x1d')](function(_0x5091bf){logger[_0x442d('0xe')](_0x442d('0x2a'),_0x5091bf[_0x442d('0x13')]);emit(util['format'](_0x442d('0x2c'),_0x5091bf[_0x442d('0x13')]),'webbar:hold',{'sessionId':_0x26c848});return _0xe95034[_0x442d('0x14')](0xc8)[_0x442d('0x26')]({'error':![],'message':_0x442d('0x39')});})['catch'](handleError(_0xe95034));};exports[_0x442d('0x3a')]=function(_0x1a4e8e,_0x130001){logger[_0x442d('0xe')]('unhold\x20fired:',_0x1a4e8e[_0x442d('0x25')]);var _0x236756=unholdValidation[_0x442d('0xa')](_0x1a4e8e[_0x442d('0x25')]);if(_0x236756[_0x442d('0x22')]>0x0){return _0x130001[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0x236756);}var _0x2e5108=_0x1a4e8e[_0x442d('0x25')][_0x442d('0x30')];var _0x2648ef=_0x1a4e8e['body'][_0x442d('0x21')];return getAgent(_0x2e5108)['then'](function(_0x366e30){logger[_0x442d('0xe')](_0x442d('0x2a'),_0x366e30[_0x442d('0x13')]);emit(util[_0x442d('0x2b')](_0x442d('0x2c'),_0x366e30[_0x442d('0x13')]),_0x442d('0x3b'),{'sessionId':_0x2648ef});return _0x130001['status'](0xc8)[_0x442d('0x26')]({'error':![],'message':_0x442d('0x3c')});})[_0x442d('0x2e')](handleError(_0x130001));};exports[_0x442d('0x3d')]=function(_0x4862dc,_0x2d45f9){logger[_0x442d('0xe')](_0x442d('0x3e'),_0x2d45f9[_0x442d('0x25')]);var _0x264051=callsValidation[_0x442d('0xa')](_0x4862dc[_0x442d('0x25')]);if(_0x264051[_0x442d('0x22')]>0x0){return _0x2d45f9[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0x264051);}var _0x4568eb=_0x4862dc['body'][_0x442d('0x30')];var _0xa3806e=respondWithRpcPromise(_0x442d('0x1e'));var _0x39e0fc=getAgent(_0x4568eb);return Promise['all']([_0xa3806e,_0x39e0fc])['then'](function(_0x50577b){var _0x25833e=_0x50577b[0x0];var _0xa5b105=_0x50577b[0x1];var _0x247ee8=_['filter'](_0x25833e[_0x442d('0x20')],function(_0x33bf22){return _0x33bf22['UserId']==_0xa5b105['id'];});return _0x2d45f9[_0x442d('0x14')](0xc8)['json']({'count':_0x247ee8[_0x442d('0x22')],'rows':_0x247ee8});})['catch'](handleError(_0x2d45f9));};exports['conference']=function(_0x4a7fca,_0x3eb156){logger[_0x442d('0xe')](_0x442d('0x3f'),_0x4a7fca['body']);var _0xcdafc=conferenceValidation[_0x442d('0xa')](_0x4a7fca['body']);if(_0xcdafc['length']>0x0){return _0x3eb156[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0xcdafc);}var _0x44fbc6=_0x4a7fca['body'][_0x442d('0x30')];return getAgent(_0x44fbc6)[_0x442d('0x1d')](function(_0x758e51){logger[_0x442d('0xe')](_0x442d('0x2a'),_0x758e51[_0x442d('0x13')]);emit(util[_0x442d('0x2b')](_0x442d('0x2c'),_0x758e51[_0x442d('0x13')]),'webbar:conference');return _0x3eb156['status'](0xc8)['json']({'error':![],'message':_0x442d('0x40')});})[_0x442d('0x2e')](handleError(_0x3eb156));};exports[_0x442d('0x41')]=function(_0xf2f6da,_0x36606d){logger[_0x442d('0xe')](_0x442d('0x42'),_0xf2f6da[_0x442d('0x25')]);var _0x34cb22=transferValidation['validate'](_0xf2f6da['body']);if(_0x34cb22[_0x442d('0x22')]>0x0){return _0x36606d[_0x442d('0x14')](0x190)[_0x442d('0x26')](_0x34cb22);}var _0x39f596=_0xf2f6da['body']['userId'];var _0x199c4f=_0xf2f6da[_0x442d('0x25')][_0x442d('0x21')];var _0x77768d=_0xf2f6da[_0x442d('0x25')][_0x442d('0x43')];return getAgent(_0x39f596)['then'](function(_0xaf8a3f){logger[_0x442d('0xe')](_0x442d('0x2a'),_0xaf8a3f[_0x442d('0x13')]);emit(util[_0x442d('0x2b')](_0x442d('0x2c'),_0xaf8a3f[_0x442d('0x13')]),'webbar:transfer',{'sessionId':_0x199c4f,'transferNumber':_0x77768d});return _0x36606d[_0x442d('0x14')](0xc8)[_0x442d('0x26')]({'error':![],'message':'transfer\x20executed!'});})[_0x442d('0x2e')](handleError(_0x36606d));}; \ No newline at end of file +var _0x12ec=['stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','code','message','result','catch','User','findOne','agent','then','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','webbarapi','ioredis','redis','defaults','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0x12ec,0x1d9));var _0xc12e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x12ec[_0x47e7cb];return _0x2a8874;};'use strict';var path=require(_0xc12e('0x0'));var fs=require('fs');var _=require(_0xc12e('0x1'));var db=require(_0xc12e('0x2'))['db'];var config=require(_0xc12e('0x3'));var util=require(_0xc12e('0x4'));var BPromise=require(_0xc12e('0x5'));var jayson=require(_0xc12e('0x6'));var amiClient=jayson['client'][_0xc12e('0x7')]({'port':0x232a});var logger=require(_0xc12e('0x8'))(_0xc12e('0x9'));var Redis=require(_0xc12e('0xa'));config[_0xc12e('0xb')]=_[_0xc12e('0xc')](config[_0xc12e('0xb')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc12e('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],_0xc12e('0xe')]},'callNumber':{'type':_0xc12e('0xf'),'required':[!![],_0xc12e('0x10')]},'callerId':{'type':_0xc12e('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc12e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],_0xc12e('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc12e('0xe')]},'sessionId':{'type':_0xc12e('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc12e('0xf'),'required':[!![],_0xc12e('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],_0xc12e('0xe')]},'sessionId':{'type':_0xc12e('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],_0xc12e('0xe')]},'sessionId':{'type':_0xc12e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],_0xc12e('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc12e('0xd'),'required':[!![],_0xc12e('0xe')]}});function emit(_0x1c4041,_0x56ec06,_0x2376a2){logger[_0xc12e('0x12')](_0x1c4041,_0x56ec06,JSON[_0xc12e('0x13')](_0x2376a2));io['to'](_0x1c4041)[_0xc12e('0x14')](_0x56ec06,_0x2376a2);}function handleError(_0x43a038){return function(_0x44de6a){console[_0xc12e('0x15')](_0xc12e('0x16'),_0x44de6a,_0x44de6a instanceof RangeError);logger[_0xc12e('0x17')](_0x44de6a[_0xc12e('0x18')]);if(_0x44de6a instanceof RangeError){if(_0x44de6a[_0xc12e('0x19')]){delete _0x44de6a[_0xc12e('0x19')];}_0x43a038['status'](0x194)['send'](_0x44de6a);}else{if(_0x44de6a[_0xc12e('0x19')]){delete _0x44de6a[_0xc12e('0x19')];}_0x43a038[_0xc12e('0x1a')](0x1f4)[_0xc12e('0x1b')](_0x44de6a);}};}function checkError(){return function(_0xaf0289){if(!_0xaf0289){throw new RangeError(_0xc12e('0x1c'));}return _0xaf0289;};}function respondWithRpcPromise(_0x5974b9,_0x1f761e){return new BPromise(function(_0x223d74,_0x394116){var _0x5ce75c=amiClient;return _0x5ce75c[_0xc12e('0x1d')](_0x5974b9,_0x1f761e)['then'](function(_0x17b423){if(_0x17b423[_0xc12e('0x17')]){if(_0x17b423[_0xc12e('0x17')][_0xc12e('0x1e')]===0x1f4){return _0x394116(_0x17b423[_0xc12e('0x17')][_0xc12e('0x1f')]);}return _0x223d74(_0x17b423[_0xc12e('0x17')]['message']);}else{_0x223d74(_0x17b423[_0xc12e('0x20')]);}})[_0xc12e('0x21')](function(_0x46758d){_0x394116(_0x46758d);});});}function getAgent(_0x24d805){return db[_0xc12e('0x22')][_0xc12e('0x23')]({'where':{'id':_0x24d805,'role':_0xc12e('0x24')}})[_0xc12e('0x25')](checkError());}function getAgentCheckSession(_0x3ab48b,_0x2f1329){return new BPromise(function(_0x488d9a,_0xad1353){var _0x2fea2e=respondWithRpcPromise('VoiceChannels');var _0x1eefbc=getAgent(_0x3ab48b);Promise['all']([_0x2fea2e,_0x1eefbc])[_0xc12e('0x25')](function(_0x377dd8){var _0x1ef511=_0x377dd8[0x0];var _0x58524a=_0x377dd8[0x1];var _0x34692f=_[_0xc12e('0x26')](_0x1ef511[_0xc12e('0x27')],function(_0x4676c8){return _0x4676c8[_0xc12e('0x28')]==_0x58524a['id']&&_0x4676c8[_0xc12e('0x29')]==_0x2f1329;});if(_0x34692f[_0xc12e('0x2a')]==0x1){_0x488d9a(_0x58524a);}else{_0xad1353(new RangeError(_0xc12e('0x2b')+_0x2f1329+_0xc12e('0x2c')));}});});}exports[_0xc12e('0x2d')]=function(_0x3398c8,_0x4617e9){logger[_0xc12e('0x12')](_0xc12e('0x2e'),_0x3398c8[_0xc12e('0x2f')]);var _0x3e128a=originateValidation[_0xc12e('0x30')](_0x3398c8['body']);if(_0x3e128a[_0xc12e('0x2a')]>0x0){return _0x4617e9[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0x3e128a);}var _0x19eecf=_0x3398c8[_0xc12e('0x2f')][_0xc12e('0x32')];var _0x1e920d=_0x3398c8[_0xc12e('0x2f')][_0xc12e('0x33')];var _0x35d7c6=_0x3398c8[_0xc12e('0x2f')][_0xc12e('0x34')];var _0x256c42=_0x3398c8[_0xc12e('0x2f')][_0xc12e('0x35')];return getAgent(_0x19eecf)[_0xc12e('0x25')](function(_0x1198d2){logger[_0xc12e('0x12')]('entityFound:',_0x1198d2['name']);emit(util[_0xc12e('0x36')](_0xc12e('0x37'),_0x1198d2['name']),_0xc12e('0x38'),{'callNumber':_0x1e920d,'callerId':_0x35d7c6,'callbackUrl':_0x256c42});return _0x4617e9[_0xc12e('0x1a')](0xc8)[_0xc12e('0x31')]({'error':![],'message':_0xc12e('0x39')});})[_0xc12e('0x21')](handleError(_0x4617e9));};exports[_0xc12e('0x3a')]=function(_0x5caf7a,_0x2e07fa){logger['info'](_0xc12e('0x3b'),_0x5caf7a[_0xc12e('0x2f')]);var _0x17ca1d=hangupValidation[_0xc12e('0x30')](_0x5caf7a[_0xc12e('0x2f')]);if(_0x17ca1d['length']>0x0){return _0x2e07fa[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0x17ca1d);}var _0x1d930f=_0x5caf7a[_0xc12e('0x2f')][_0xc12e('0x32')];var _0x5a05bc=_0x5caf7a[_0xc12e('0x2f')][_0xc12e('0x29')];return getAgent(_0x1d930f)[_0xc12e('0x25')](function(_0x29161d){logger[_0xc12e('0x12')]('entityFound:',_0x29161d[_0xc12e('0x19')]);emit(util[_0xc12e('0x36')](_0xc12e('0x37'),_0x29161d[_0xc12e('0x19')]),_0xc12e('0x3c'),{'sessionId':_0x5a05bc});return _0x2e07fa[_0xc12e('0x1a')](0xc8)[_0xc12e('0x31')]({'error':![],'message':_0xc12e('0x3d')});})[_0xc12e('0x21')](handleError(_0x2e07fa));};exports[_0xc12e('0x3e')]=function(_0x16fb67,_0x28adc2){logger[_0xc12e('0x12')](_0xc12e('0x3f'),_0x16fb67[_0xc12e('0x2f')]);var _0x1c99af=answerValidation[_0xc12e('0x30')](_0x16fb67[_0xc12e('0x2f')]);if(_0x1c99af[_0xc12e('0x2a')]>0x0){return _0x28adc2[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0x1c99af);}var _0x16b9cc=_0x16fb67[_0xc12e('0x2f')]['userId'];var _0x10431f=_0x16fb67[_0xc12e('0x2f')][_0xc12e('0x29')];return getAgent(_0x16b9cc)[_0xc12e('0x25')](function(_0x3889ae){logger[_0xc12e('0x12')](_0xc12e('0x40'),_0x3889ae[_0xc12e('0x19')]);emit(util[_0xc12e('0x36')]('user:%s',_0x3889ae[_0xc12e('0x19')]),_0xc12e('0x41'),{'sessionId':_0x10431f});return _0x28adc2[_0xc12e('0x1a')](0xc8)[_0xc12e('0x31')]({'error':![],'message':_0xc12e('0x42')});})['catch'](handleError(_0x28adc2));};exports[_0xc12e('0x43')]=function(_0x38c78d,_0x1faeb2){logger[_0xc12e('0x12')](_0xc12e('0x44'),_0x38c78d[_0xc12e('0x2f')]);var _0x63bcfd=holdValidation[_0xc12e('0x30')](_0x38c78d[_0xc12e('0x2f')]);if(_0x63bcfd[_0xc12e('0x2a')]>0x0){return _0x1faeb2[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0x63bcfd);}var _0x3c8d51=_0x38c78d[_0xc12e('0x2f')]['userId'];var _0x2bb62d=_0x38c78d['body'][_0xc12e('0x29')];return getAgent(_0x3c8d51)['then'](function(_0x55d842){logger[_0xc12e('0x12')](_0xc12e('0x40'),_0x55d842[_0xc12e('0x19')]);emit(util[_0xc12e('0x36')](_0xc12e('0x37'),_0x55d842[_0xc12e('0x19')]),_0xc12e('0x45'),{'sessionId':_0x2bb62d});return _0x1faeb2['status'](0xc8)[_0xc12e('0x31')]({'error':![],'message':_0xc12e('0x46')});})[_0xc12e('0x21')](handleError(_0x1faeb2));};exports[_0xc12e('0x47')]=function(_0x243ed7,_0x13debd){logger[_0xc12e('0x12')](_0xc12e('0x48'),_0x243ed7['body']);var _0x586cc9=unholdValidation[_0xc12e('0x30')](_0x243ed7['body']);if(_0x586cc9['length']>0x0){return _0x13debd[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0x586cc9);}var _0x3af56c=_0x243ed7['body'][_0xc12e('0x32')];var _0x52e9a8=_0x243ed7[_0xc12e('0x2f')][_0xc12e('0x29')];return getAgent(_0x3af56c)['then'](function(_0x3148b9){logger[_0xc12e('0x12')](_0xc12e('0x40'),_0x3148b9[_0xc12e('0x19')]);emit(util[_0xc12e('0x36')](_0xc12e('0x37'),_0x3148b9[_0xc12e('0x19')]),'webbar:unhold',{'sessionId':_0x52e9a8});return _0x13debd[_0xc12e('0x1a')](0xc8)[_0xc12e('0x31')]({'error':![],'message':'unhold\x20executed!'});})[_0xc12e('0x21')](handleError(_0x13debd));};exports[_0xc12e('0x49')]=function(_0x3d706f,_0x4fe180){logger['info']('calls\x20fired:',_0x4fe180[_0xc12e('0x2f')]);var _0x1e0948=callsValidation[_0xc12e('0x30')](_0x3d706f[_0xc12e('0x2f')]);if(_0x1e0948[_0xc12e('0x2a')]>0x0){return _0x4fe180[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0x1e0948);}var _0x20ae73=_0x3d706f[_0xc12e('0x2f')]['userId'];var _0x4d3398=respondWithRpcPromise('VoiceChannels');var _0x588738=getAgent(_0x20ae73);return Promise[_0xc12e('0x4a')]([_0x4d3398,_0x588738])[_0xc12e('0x25')](function(_0x26e7ce){var _0xf8c531=_0x26e7ce[0x0];var _0x2fde71=_0x26e7ce[0x1];var _0x1115b6=_[_0xc12e('0x26')](_0xf8c531[_0xc12e('0x27')],function(_0x50bf72){return _0x50bf72[_0xc12e('0x28')]==_0x2fde71['id'];});return _0x4fe180[_0xc12e('0x1a')](0xc8)['json']({'count':_0x1115b6[_0xc12e('0x2a')],'rows':_0x1115b6});})['catch'](handleError(_0x4fe180));};exports[_0xc12e('0x4b')]=function(_0x2709e7,_0x43402d){logger[_0xc12e('0x12')](_0xc12e('0x4c'),_0x2709e7[_0xc12e('0x2f')]);var _0x4af457=conferenceValidation[_0xc12e('0x30')](_0x2709e7[_0xc12e('0x2f')]);if(_0x4af457[_0xc12e('0x2a')]>0x0){return _0x43402d['status'](0x190)[_0xc12e('0x31')](_0x4af457);}var _0x2a078e=_0x2709e7[_0xc12e('0x2f')][_0xc12e('0x32')];return getAgent(_0x2a078e)[_0xc12e('0x25')](function(_0x1a8c1e){logger[_0xc12e('0x12')](_0xc12e('0x40'),_0x1a8c1e[_0xc12e('0x19')]);emit(util[_0xc12e('0x36')](_0xc12e('0x37'),_0x1a8c1e['name']),_0xc12e('0x4d'));return _0x43402d[_0xc12e('0x1a')](0xc8)[_0xc12e('0x31')]({'error':![],'message':_0xc12e('0x4e')});})[_0xc12e('0x21')](handleError(_0x43402d));};exports[_0xc12e('0x4f')]=function(_0x2e934d,_0xadc42e){logger[_0xc12e('0x12')]('transfer\x20fired:',_0x2e934d[_0xc12e('0x2f')]);var _0xe4f863=transferValidation[_0xc12e('0x30')](_0x2e934d[_0xc12e('0x2f')]);if(_0xe4f863[_0xc12e('0x2a')]>0x0){return _0xadc42e[_0xc12e('0x1a')](0x190)[_0xc12e('0x31')](_0xe4f863);}var _0x3d3441=_0x2e934d[_0xc12e('0x2f')][_0xc12e('0x32')];var _0x28bc6c=_0x2e934d['body'][_0xc12e('0x29')];var _0x180049=_0x2e934d[_0xc12e('0x2f')][_0xc12e('0x50')];return getAgent(_0x3d3441)[_0xc12e('0x25')](function(_0x17d4bf){logger['info'](_0xc12e('0x40'),_0x17d4bf[_0xc12e('0x19')]);emit(util[_0xc12e('0x36')]('user:%s',_0x17d4bf[_0xc12e('0x19')]),'webbar:transfer',{'sessionId':_0x28bc6c,'transferNumber':_0x180049});return _0xadc42e[_0xc12e('0x1a')](0xc8)[_0xc12e('0x31')]({'error':![],'message':_0xc12e('0x51')});})[_0xc12e('0x21')](handleError(_0xadc42e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ed0ce59..d9493da 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 _0x3598=['getApplications','post','create','addAnswer','addAgents','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications'];(function(_0x134926,_0x228888){var _0x3510e3=function(_0x1a9e17){while(--_0x1a9e17){_0x134926['push'](_0x134926['shift']());}};_0x3510e3(++_0x228888);}(_0x3598,0x1cc));var _0x8359=function(_0x589b47,_0x351ea8){_0x589b47=_0x589b47-0x0;var _0x439317=_0x3598[_0x589b47];return _0x439317;};'use strict';var multer=require(_0x8359('0x0'));var util=require(_0x8359('0x1'));var path=require(_0x8359('0x2'));var timeout=require(_0x8359('0x3'));var express=require(_0x8359('0x4'));var router=express['Router']();var fs_extra=require(_0x8359('0x5'));var auth=require(_0x8359('0x6'));var interaction=require(_0x8359('0x7'));var config=require('../../config/environment');var controller=require(_0x8359('0x8'));router[_0x8359('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8359('0xa'),auth[_0x8359('0xb')](),controller['describe']);router[_0x8359('0x9')](_0x8359('0xc'),auth[_0x8359('0xb')](),controller[_0x8359('0xd')]);router['get'](_0x8359('0xe'),auth['isAuthenticated'](),controller[_0x8359('0xf')]);router[_0x8359('0x9')](_0x8359('0x10'),auth[_0x8359('0xb')](),controller[_0x8359('0x11')]);router['get'](_0x8359('0x12'),auth['isAuthenticated'](),controller[_0x8359('0x13')]);router['get'](_0x8359('0x14'),auth['isAuthenticated'](),controller[_0x8359('0x15')]);router[_0x8359('0x16')]('/',auth[_0x8359('0xb')](),controller[_0x8359('0x17')]);router[_0x8359('0x16')](_0x8359('0xe'),auth[_0x8359('0xb')](),controller['addDisposition']);router['post'](_0x8359('0x10'),auth[_0x8359('0xb')](),controller[_0x8359('0x18')]);router[_0x8359('0x16')](_0x8359('0x12'),auth[_0x8359('0xb')](),controller[_0x8359('0x19')]);router[_0x8359('0x16')](_0x8359('0x14'),auth[_0x8359('0xb')](),controller['addApplications']);router['post'](_0x8359('0x1a'),controller[_0x8359('0x1b')]);router[_0x8359('0x16')](_0x8359('0x1c'),auth[_0x8359('0xb')](),controller[_0x8359('0x1d')]);router[_0x8359('0x1e')](_0x8359('0xc'),auth[_0x8359('0xb')](),controller[_0x8359('0x1f')]);router[_0x8359('0x20')](_0x8359('0xc'),auth[_0x8359('0xb')](),controller[_0x8359('0x21')]);router['delete'](_0x8359('0xe'),auth[_0x8359('0xb')](),controller[_0x8359('0x22')]);router[_0x8359('0x20')](_0x8359('0x10'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x8359('0x20')](_0x8359('0x12'),auth[_0x8359('0xb')](),controller[_0x8359('0x23')]);module[_0x8359('0x24')]=router; \ No newline at end of file +var _0xfc14=['/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','/:id/applications','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/notify','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3b07d7,_0x374e44){var _0x2a9b53=function(_0x11a0e5){while(--_0x11a0e5){_0x3b07d7['push'](_0x3b07d7['shift']());}};_0x2a9b53(++_0x374e44);}(_0xfc14,0x7a));var _0x4fc1=function(_0x2054f5,_0x28cf67){_0x2054f5=_0x2054f5-0x0;var _0x2f8a4d=_0xfc14[_0x2054f5];return _0x2f8a4d;};'use strict';var multer=require(_0x4fc1('0x0'));var util=require(_0x4fc1('0x1'));var path=require(_0x4fc1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4fc1('0x3')]();var fs_extra=require(_0x4fc1('0x4'));var auth=require(_0x4fc1('0x5'));var interaction=require(_0x4fc1('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x4fc1('0x7')]('/',auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x9')]);router['get'](_0x4fc1('0xa'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0xb')]);router[_0x4fc1('0x7')](_0x4fc1('0xc'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0xd')]);router[_0x4fc1('0x7')](_0x4fc1('0xe'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0xf')]);router[_0x4fc1('0x7')](_0x4fc1('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4fc1('0x7')](_0x4fc1('0x11'),auth[_0x4fc1('0x8')](),controller['getAgents']);router[_0x4fc1('0x7')](_0x4fc1('0x12'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x13')]);router[_0x4fc1('0x14')]('/',auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x15')]);router['post'](_0x4fc1('0xe'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x16')]);router[_0x4fc1('0x14')]('/:id/canned_answers',auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x17')]);router[_0x4fc1('0x14')](_0x4fc1('0x11'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x18')]);router[_0x4fc1('0x14')](_0x4fc1('0x12'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x4fc1('0x19'),controller['notify']);router[_0x4fc1('0x14')](_0x4fc1('0x1a'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x1b')]);router['put'](_0x4fc1('0xc'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x1c')]);router[_0x4fc1('0x1d')](_0x4fc1('0xc'),auth[_0x4fc1('0x8')](),controller['destroy']);router[_0x4fc1('0x1d')](_0x4fc1('0xe'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x1e')]);router[_0x4fc1('0x1d')](_0x4fc1('0x10'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x1f')]);router[_0x4fc1('0x1d')](_0x4fc1('0x11'),auth[_0x4fc1('0x8')](),controller[_0x4fc1('0x20')]);module[_0x4fc1('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 116ad4e..fc8f629 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 _0x95c6=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5dae23,_0x5db2fa){var _0x515ea4=function(_0x2a081e){while(--_0x2a081e){_0x5dae23['push'](_0x5dae23['shift']());}};_0x515ea4(++_0x5db2fa);}(_0x95c6,0x1ca));var _0x695c=function(_0x5e7cc6,_0x4911a7){_0x5e7cc6=_0x5e7cc6-0x0;var _0x29fb4a=_0x95c6[_0x5e7cc6];return _0x29fb4a;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x695c('0x0')]={'name':{'type':Sequelize[_0x695c('0x1')],'unique':_0x695c('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x695c('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x695c('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x695c('0x3'),_0x695c('0x4'))},'accountSid':{'type':Sequelize[_0x695c('0x1')]},'baseUrl':{'type':Sequelize[_0x695c('0x1')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x695c('0x5');}},'notificationSound':{'type':Sequelize[_0x695c('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x695c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x695c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x695c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x695c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x695c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x695c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x695c('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x695c('0x9'),'set':function(_0x30d478){if(!_0x30d478){this[_0x695c('0xa')](_0x695c('0xb'),null);}this[_0x695c('0xa')](_0x695c('0xc'),_0x30d478);}},'description':{'type':Sequelize[_0x695c('0x1')]}}; \ No newline at end of file +var _0x032b=['generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','name','STRING'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x032b,0x183));var _0xb032=function(_0x503cd5,_0x57774a){_0x503cd5=_0x503cd5-0x0;var _0x1fdf1e=_0x032b[_0x503cd5];return _0x1fdf1e;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb032('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb032('0x1'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xb032('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xb032('0x3')]();}},'phone':{'type':Sequelize[_0xb032('0x2')]},'type':{'type':Sequelize[_0xb032('0x4')](_0xb032('0x5'),_0xb032('0x6'))},'accountSid':{'type':Sequelize[_0xb032('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xb032('0x2')]},'notificationTemplate':{'type':Sequelize[_0xb032('0x7')],'defaultValue':function(){return _0xb032('0x8');}},'notificationSound':{'type':Sequelize[_0xb032('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb032('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb032('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb032('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb032('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb032('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb032('0xa')],'comment':_0xb032('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x11e483){if(!_0x11e483){this[_0xb032('0xc')](_0xb032('0xd'),null);}this[_0xb032('0xc')](_0xb032('0xe'),_0x11e483);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index ddf6929..bb6c9ce 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 _0x757e=['ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','queueId','unshift','queue','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./whatsappAccount.socket','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','destroy','get','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','includeAll','rows','catch','params','include','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','addAgents','ids','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','WhatsappMessage','timestamp','message_id','applications','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId'];(function(_0x12e7cf,_0x5d356c){var _0x2dde27=function(_0x57070c){while(--_0x57070c){_0x12e7cf['push'](_0x12e7cf['shift']());}};_0x2dde27(++_0x5d356c);}(_0x757e,0xf8));var _0xe757=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x757e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xe757('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe757('0x1'));var rp=require(_0xe757('0x2'));var moment=require('moment');var BPromise=require(_0xe757('0x3'));var Mustache=require(_0xe757('0x4'));var util=require(_0xe757('0x5'));var path=require('path');var sox=require(_0xe757('0x6'));var csv=require(_0xe757('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe757('0x8'));var _=require(_0xe757('0x9'));var squel=require(_0xe757('0xa'));var crypto=require(_0xe757('0xb'));var jsforce=require(_0xe757('0xc'));var deskjs=require(_0xe757('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe757('0xe'));var Papa=require(_0xe757('0xf'));var Redis=require(_0xe757('0x10'));var authService=require(_0xe757('0x11'));var qs=require(_0xe757('0x12'));var as=require(_0xe757('0x13'));var hardwareService=require(_0xe757('0x14'));var logger=require(_0xe757('0x15'))(_0xe757('0x16'));var utils=require(_0xe757('0x17'));var config=require(_0xe757('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe757('0x19'))['db'];config[_0xe757('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe757('0x1a')]));require(_0xe757('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe757('0x1c')][_0xe757('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x401ed9,_0x269727,_0xccdb8d,_0x16a794){return new BPromise(function(_0x3fc9af,_0x396a10){var _0x1bc3d8=_0x16a794||client;return _0x1bc3d8[_0xe757('0x1e')](_0x401ed9,_0xccdb8d)[_0xe757('0x1f')](function(_0x205a36){logger[_0xe757('0x20')](_0xe757('0x21'),_0x269727,_0xe757('0x22'));logger[_0xe757('0x23')](_0xe757('0x24'),_0x269727,'request\x20sent',JSON[_0xe757('0x25')](_0x205a36));if(_0x205a36[_0xe757('0x26')]){if(_0x205a36[_0xe757('0x26')][_0xe757('0x27')]===0x1f4){logger[_0xe757('0x26')](_0xe757('0x21'),_0x269727,_0x205a36[_0xe757('0x26')][_0xe757('0x28')]);return _0x396a10(_0x205a36['error'][_0xe757('0x28')]);}logger[_0xe757('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x269727,_0x205a36[_0xe757('0x26')][_0xe757('0x28')]);return _0x3fc9af(_0x205a36['error'][_0xe757('0x28')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x269727,_0xe757('0x22'));_0x3fc9af(_0x205a36[_0xe757('0x29')][_0xe757('0x28')]);}})['catch'](function(_0x4d79ca){logger[_0xe757('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x269727,_0x4d79ca);_0x396a10(_0x4d79ca);});});}function respondWithStatusCode(_0x4bed87,_0x2c073b){_0x2c073b=_0x2c073b||0xcc;return function(_0x1c80a0){if(_0x1c80a0){return _0x4bed87[_0xe757('0x2a')](_0x2c073b);}return _0x4bed87[_0xe757('0x2b')](_0x2c073b)['end']();};}function respondWithResult(_0x1c4aa6,_0x4aea92){_0x4aea92=_0x4aea92||0xc8;return function(_0xa31832){if(_0xa31832){return _0x1c4aa6[_0xe757('0x2b')](_0x4aea92)[_0xe757('0x2c')](_0xa31832);}};}function respondWithFilteredResult(_0x2f629e,_0x592932){return function(_0x2aa2f3){if(_0x2aa2f3){var _0x59479f=typeof _0x592932['offset']==='undefined'&&typeof _0x592932[_0xe757('0x2d')]===_0xe757('0x2e');var _0x17bea4=_0x2aa2f3[_0xe757('0x2f')];var _0xcc0aed=_0x59479f?0x0:_0x592932['offset'];var _0x27ce93=_0x59479f?_0x2aa2f3[_0xe757('0x2f')]:_0x592932[_0xe757('0x30')]+_0x592932['limit'];var _0x1cec20;if(_0x27ce93>=_0x17bea4){_0x27ce93=_0x17bea4;_0x1cec20=0xc8;}else{_0x1cec20=0xce;}_0x2f629e[_0xe757('0x2b')](_0x1cec20);return _0x2f629e[_0xe757('0x31')](_0xe757('0x32'),_0xcc0aed+'-'+_0x27ce93+'/'+_0x17bea4)[_0xe757('0x2c')](_0x2aa2f3);}return null;};}function patchUpdates(_0x16d5d5){return function(_0x3eb881){try{jsonpatch[_0xe757('0x33')](_0x3eb881,_0x16d5d5,!![]);}catch(_0x357b93){return BPromise['reject'](_0x357b93);}return _0x3eb881['save']();};}function saveUpdates(_0x3dc790,_0x310a16){return function(_0x2c1a41){if(_0x2c1a41){return _0x2c1a41[_0xe757('0x34')](_0x3dc790)[_0xe757('0x1f')](function(_0x3ce47b){return _0x3ce47b;});}return null;};}function removeEntity(_0x3e3d79,_0x27ac4c){return function(_0x3aa131){if(_0x3aa131){return _0x3aa131[_0xe757('0x35')]()[_0xe757('0x1f')](function(){var _0x243a7f=_0x3aa131[_0xe757('0x36')]({'plain':!![]});var _0x398d0a='WhatsappAccounts';return db[_0xe757('0x37')][_0xe757('0x35')]({'where':{'type':_0x398d0a,'resourceId':_0x243a7f['id']}})[_0xe757('0x1f')](function(){return _0x3aa131;});})[_0xe757('0x1f')](function(){_0x3e3d79[_0xe757('0x2b')](0xcc)[_0xe757('0x38')]();});}};}function handleEntityNotFound(_0x746522,_0xf621b6){return function(_0x643f86){if(!_0x643f86){_0x746522[_0xe757('0x2a')](0x194);}return _0x643f86;};}function handleError(_0x43ac8b,_0x13ef11){_0x13ef11=_0x13ef11||0x1f4;return function(_0x1acfb2){logger[_0xe757('0x26')](_0x1acfb2[_0xe757('0x39')]);if(_0x1acfb2['name']){delete _0x1acfb2[_0xe757('0x3a')];}_0x43ac8b['status'](_0x13ef11)[_0xe757('0x3b')](_0x1acfb2);};}exports[_0xe757('0x3c')]=function(_0x57db1f,_0xad95ff){var _0x255612={'include':[{'model':db[_0xe757('0x3d')],'as':_0xe757('0x3e')}]},_0x6c2b5={},_0x3f9909={'count':0x0,'rows':[]};var _0x4e36d3=_[_0xe757('0x3f')](db['WhatsappAccount'][_0xe757('0x40')],function(_0x5046ca){return{'name':_0x5046ca[_0xe757('0x41')],'type':_0x5046ca[_0xe757('0x42')][_0xe757('0x43')]};});_0x6c2b5[_0xe757('0x44')]=_[_0xe757('0x3f')](_0x4e36d3,_0xe757('0x3a'));_0x6c2b5[_0xe757('0x45')]=_[_0xe757('0x46')](_0x57db1f['query']);_0x6c2b5[_0xe757('0x47')]=_[_0xe757('0x48')](_0x6c2b5[_0xe757('0x44')],_0x6c2b5['query']);_0x255612[_0xe757('0x49')]=_[_0xe757('0x48')](_0x6c2b5[_0xe757('0x44')],qs[_0xe757('0x4a')](_0x57db1f[_0xe757('0x45')]['fields']));_0x255612[_0xe757('0x49')]=_0x255612['attributes'][_0xe757('0x4b')]?_0x255612[_0xe757('0x49')]:_0x6c2b5[_0xe757('0x44')];if(!_0x57db1f[_0xe757('0x45')][_0xe757('0x4c')](_0xe757('0x4d'))){_0x255612[_0xe757('0x2d')]=qs['limit'](_0x57db1f[_0xe757('0x45')][_0xe757('0x2d')]);_0x255612['offset']=qs['offset'](_0x57db1f[_0xe757('0x45')][_0xe757('0x30')]);}_0x255612[_0xe757('0x4e')]=qs[_0xe757('0x4f')](_0x57db1f['query'][_0xe757('0x4f')]);_0x255612[_0xe757('0x50')]=qs['filters'](_[_0xe757('0x51')](_0x57db1f[_0xe757('0x45')],_0x6c2b5['filters']),_0x4e36d3);if(_0x57db1f[_0xe757('0x45')][_0xe757('0x52')]){_0x255612[_0xe757('0x50')]=_['merge'](_0x255612[_0xe757('0x50')],{'$or':_[_0xe757('0x3f')](_0x4e36d3,function(_0x54d28e){if(_0x54d28e['type']!==_0xe757('0x53')){var _0x5ce654={};_0x5ce654[_0x54d28e[_0xe757('0x3a')]]={'$like':'%'+_0x57db1f[_0xe757('0x45')]['filter']+'%'};return _0x5ce654;}})});}_0x255612=_[_0xe757('0x54')]({},_0x255612,_0x57db1f[_0xe757('0x55')]);var _0x58ef19={'where':_0x255612['where']};return db[_0xe757('0x56')][_0xe757('0x2f')](_0x58ef19)['then'](function(_0x2e0808){_0x3f9909['count']=_0x2e0808;if(_0x57db1f[_0xe757('0x45')][_0xe757('0x57')]){_0x255612['include']=[{'all':!![]}];}return db[_0xe757('0x56')]['findAll'](_0x255612);})[_0xe757('0x1f')](function(_0x2037f2){_0x3f9909[_0xe757('0x58')]=_0x2037f2;return _0x3f9909;})['then'](respondWithFilteredResult(_0xad95ff,_0x255612))[_0xe757('0x59')](handleError(_0xad95ff,null));};exports['show']=function(_0x5a727a,_0x160b3a){var _0x204e68={'raw':![],'where':{'id':_0x5a727a[_0xe757('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5a10a6={};_0x5a10a6[_0xe757('0x44')]=_[_0xe757('0x46')](db['WhatsappAccount'][_0xe757('0x40')]);_0x5a10a6[_0xe757('0x45')]=_[_0xe757('0x46')](_0x5a727a[_0xe757('0x45')]);_0x5a10a6[_0xe757('0x47')]=_[_0xe757('0x48')](_0x5a10a6[_0xe757('0x44')],_0x5a10a6[_0xe757('0x45')]);_0x204e68[_0xe757('0x49')]=_[_0xe757('0x48')](_0x5a10a6['model'],qs[_0xe757('0x4a')](_0x5a727a[_0xe757('0x45')][_0xe757('0x4a')]));_0x204e68[_0xe757('0x49')]=_0x204e68[_0xe757('0x49')][_0xe757('0x4b')]?_0x204e68[_0xe757('0x49')]:_0x5a10a6[_0xe757('0x44')];if(_0x5a727a[_0xe757('0x45')][_0xe757('0x57')]){_0x204e68[_0xe757('0x5b')]=[{'all':!![]}];}_0x204e68=_['merge']({},_0x204e68,_0x5a727a[_0xe757('0x55')]);return db[_0xe757('0x56')][_0xe757('0x5c')](_0x204e68)[_0xe757('0x1f')](handleEntityNotFound(_0x160b3a,null))[_0xe757('0x1f')](respondWithResult(_0x160b3a,null))['catch'](handleError(_0x160b3a,null));};exports[_0xe757('0x5d')]=function(_0xb7a206,_0x381076){return db[_0xe757('0x56')][_0xe757('0x5d')](_0xb7a206[_0xe757('0x5e')],{})[_0xe757('0x1f')](function(_0x1ad62b){var _0x32c509=_0xb7a206[_0xe757('0x5f')][_0xe757('0x36')]({'plain':!![]});if(!_0x32c509)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x32c509[_0xe757('0x60')]===_0xe757('0x5f')){var _0x75a13d=_0x1ad62b['get']({'plain':!![]});var _0x3b3b84='WhatsappAccounts';return db[_0xe757('0x61')]['find']({'where':{'name':_0x3b3b84,'userProfileId':_0x32c509[_0xe757('0x62')]},'raw':!![]})[_0xe757('0x1f')](function(_0x57b160){if(_0x57b160&&_0x57b160['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x75a13d['name'],'resourceId':_0x75a13d['id'],'type':_0x57b160[_0xe757('0x3a')],'sectionId':_0x57b160['id']},{})['then'](function(){return _0x1ad62b;});}else{return _0x1ad62b;}})['catch'](function(_0x20e06a){logger[_0xe757('0x26')](_0xe757('0x63'),_0x20e06a);throw _0x20e06a;});}return _0x1ad62b;})[_0xe757('0x1f')](respondWithResult(_0x381076,0xc9))[_0xe757('0x59')](handleError(_0x381076,null));};exports[_0xe757('0x34')]=function(_0x2d9f9d,_0x55233e){if(_0x2d9f9d['body']['id']){delete _0x2d9f9d[_0xe757('0x5e')]['id'];}return db['WhatsappAccount'][_0xe757('0x5c')]({'where':{'id':_0x2d9f9d['params']['id']},'include':[{'model':db[_0xe757('0x3d')],'as':_0xe757('0x3e')}]})[_0xe757('0x1f')](handleEntityNotFound(_0x55233e,null))['then'](saveUpdates(_0x2d9f9d[_0xe757('0x5e')],null))[_0xe757('0x1f')](respondWithResult(_0x55233e,null))[_0xe757('0x59')](handleError(_0x55233e,null));};exports[_0xe757('0x35')]=function(_0x15212d,_0x3df902){return db[_0xe757('0x56')]['find']({'where':{'id':_0x15212d[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x3df902,null))[_0xe757('0x1f')](removeEntity(_0x3df902,null))[_0xe757('0x59')](handleError(_0x3df902,null));};exports[_0xe757('0x64')]=function(_0x24575e,_0x2de0a9){return db[_0xe757('0x56')]['describe']()[_0xe757('0x1f')](respondWithResult(_0x2de0a9,null))[_0xe757('0x59')](handleError(_0x2de0a9,null));};exports['addDisposition']=function(_0x1e5d30,_0x52345f,_0x164843){if(_0x1e5d30['body']['id']){delete _0x1e5d30[_0xe757('0x5e')]['id'];}return db[_0xe757('0x56')][_0xe757('0x5c')]({'where':{'id':_0x1e5d30[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x52345f,null))['then'](function(_0x55235c){if(_0x55235c){_0x1e5d30[_0xe757('0x5e')][_0xe757('0x65')]=_0x55235c['id'];return db[_0xe757('0x66')][_0xe757('0x5d')](_0x1e5d30['body']);}})[_0xe757('0x1f')](respondWithResult(_0x52345f,null))[_0xe757('0x59')](handleError(_0x52345f,null));};exports[_0xe757('0x67')]=function(_0x463719,_0x5d509e,_0x5ab409){var _0x15b234={'raw':![],'where':{}};var _0x82f921={};var _0x3a6332={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xe757('0x68')]({'where':{'id':_0x463719[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x5d509e,null))[_0xe757('0x1f')](function(_0x55c2f5){if(_0x55c2f5){_0x82f921[_0xe757('0x44')]=_['keys'](db[_0xe757('0x66')][_0xe757('0x40')]);_0x82f921[_0xe757('0x45')]=_[_0xe757('0x46')](_0x463719[_0xe757('0x45')]);_0x82f921['filters']=_[_0xe757('0x48')](_0x82f921[_0xe757('0x44')],_0x82f921[_0xe757('0x45')]);_0x15b234[_0xe757('0x49')]=_[_0xe757('0x48')](_0x82f921['model'],qs['fields'](_0x463719['query']['fields']));_0x15b234[_0xe757('0x49')]=_0x15b234[_0xe757('0x49')][_0xe757('0x4b')]?_0x15b234['attributes']:_0x82f921[_0xe757('0x44')];if(!_0x463719['query'][_0xe757('0x4c')](_0xe757('0x4d'))){_0x15b234[_0xe757('0x2d')]=qs['limit'](_0x463719[_0xe757('0x45')][_0xe757('0x2d')]);_0x15b234[_0xe757('0x30')]=qs[_0xe757('0x30')](_0x463719[_0xe757('0x45')][_0xe757('0x30')]);}_0x15b234[_0xe757('0x4e')]=qs['sort'](_0x463719[_0xe757('0x45')]['sort']);_0x15b234['where']=qs[_0xe757('0x47')](_['pick'](_0x463719[_0xe757('0x45')],_0x82f921[_0xe757('0x47')]));_0x15b234['where'][_0xe757('0x65')]=_0x55c2f5['id'];if(_0x463719[_0xe757('0x45')]['filter']){_0x15b234[_0xe757('0x50')]=_[_0xe757('0x54')](_0x15b234[_0xe757('0x50')],{'$or':_['map'](_0x15b234[_0xe757('0x49')],function(_0x46c857){var _0x3c96c8={};_0x3c96c8[_0x46c857]={'$like':'%'+_0x463719['query'][_0xe757('0x52')]+'%'};return _0x3c96c8;})});}_0x15b234=_['merge']({},_0x15b234,_0x463719[_0xe757('0x55')]);return db[_0xe757('0x66')][_0xe757('0x2f')]({'where':_0x15b234[_0xe757('0x50')]})[_0xe757('0x1f')](function(_0x34cdf8){_0x3a6332[_0xe757('0x2f')]=_0x34cdf8;if(_0x463719['query'][_0xe757('0x57')]){_0x15b234['include']=[{'all':!![]}];}return db[_0xe757('0x66')][_0xe757('0x69')](_0x15b234);})['then'](function(_0x74a794){_0x3a6332[_0xe757('0x58')]=_0x74a794;return _0x3a6332;});}})['then'](respondWithFilteredResult(_0x5d509e,_0x15b234))[_0xe757('0x59')](handleError(_0x5d509e,null));};exports[_0xe757('0x6a')]=function(_0x3c1c3f,_0x31d8d1,_0x36328e){return db[_0xe757('0x56')][_0xe757('0x5c')]({'where':{'id':_0x3c1c3f[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x31d8d1,null))[_0xe757('0x1f')](function(_0x45ff46){if(_0x45ff46){return _0x45ff46[_0xe757('0x6a')](_0x3c1c3f['query']['ids']);}})['then'](respondWithStatusCode(_0x31d8d1,null))[_0xe757('0x59')](handleError(_0x31d8d1,null));};exports[_0xe757('0x6b')]=function(_0x35eba2,_0x57be02,_0x41b07d){if(_0x35eba2['body']['id']){delete _0x35eba2[_0xe757('0x5e')]['id'];}return db['WhatsappAccount'][_0xe757('0x5c')]({'where':{'id':_0x35eba2[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x57be02,null))[_0xe757('0x1f')](function(_0x448d9d){if(_0x448d9d){_0x35eba2['body'][_0xe757('0x65')]=_0x448d9d['id'];return db[_0xe757('0x6c')]['create'](_0x35eba2[_0xe757('0x5e')]);}})['then'](respondWithResult(_0x57be02,null))[_0xe757('0x59')](handleError(_0x57be02,null));};exports['getAnswers']=function(_0x2ae519,_0x38e18,_0x4aa62e){var _0x4b7d67={'raw':![],'where':{}};var _0x23febd={};var _0x3aefd2={'count':0x0,'rows':[]};return db[_0xe757('0x56')]['findOne']({'where':{'id':_0x2ae519[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x38e18,null))[_0xe757('0x1f')](function(_0x1c012f){if(_0x1c012f){_0x23febd[_0xe757('0x44')]=_[_0xe757('0x46')](db['CannedAnswer'][_0xe757('0x40')]);_0x23febd[_0xe757('0x45')]=_[_0xe757('0x46')](_0x2ae519[_0xe757('0x45')]);_0x23febd[_0xe757('0x47')]=_[_0xe757('0x48')](_0x23febd['model'],_0x23febd[_0xe757('0x45')]);_0x4b7d67[_0xe757('0x49')]=_[_0xe757('0x48')](_0x23febd['model'],qs[_0xe757('0x4a')](_0x2ae519[_0xe757('0x45')][_0xe757('0x4a')]));_0x4b7d67[_0xe757('0x49')]=_0x4b7d67['attributes']['length']?_0x4b7d67[_0xe757('0x49')]:_0x23febd['model'];if(!_0x2ae519[_0xe757('0x45')]['hasOwnProperty'](_0xe757('0x4d'))){_0x4b7d67[_0xe757('0x2d')]=qs[_0xe757('0x2d')](_0x2ae519[_0xe757('0x45')][_0xe757('0x2d')]);_0x4b7d67[_0xe757('0x30')]=qs[_0xe757('0x30')](_0x2ae519['query']['offset']);}_0x4b7d67[_0xe757('0x4e')]=qs[_0xe757('0x4f')](_0x2ae519[_0xe757('0x45')]['sort']);_0x4b7d67[_0xe757('0x50')]=qs['filters'](_[_0xe757('0x51')](_0x2ae519['query'],_0x23febd[_0xe757('0x47')]));_0x4b7d67[_0xe757('0x50')][_0xe757('0x65')]=_0x1c012f['id'];if(_0x2ae519['query'][_0xe757('0x52')]){_0x4b7d67['where']=_[_0xe757('0x54')](_0x4b7d67[_0xe757('0x50')],{'$or':_[_0xe757('0x3f')](_0x4b7d67['attributes'],function(_0x384bea){var _0x1f5344={};_0x1f5344[_0x384bea]={'$like':'%'+_0x2ae519[_0xe757('0x45')][_0xe757('0x52')]+'%'};return _0x1f5344;})});}_0x4b7d67=_['merge']({},_0x4b7d67,_0x2ae519[_0xe757('0x55')]);return db[_0xe757('0x6c')]['count']({'where':_0x4b7d67[_0xe757('0x50')]})[_0xe757('0x1f')](function(_0x2ee9ef){_0x3aefd2['count']=_0x2ee9ef;if(_0x2ae519['query'][_0xe757('0x57')]){_0x4b7d67[_0xe757('0x5b')]=[{'all':!![]}];}return db[_0xe757('0x6c')][_0xe757('0x69')](_0x4b7d67);})['then'](function(_0x1f5a57){_0x3aefd2[_0xe757('0x58')]=_0x1f5a57;return _0x3aefd2;});}})[_0xe757('0x1f')](respondWithFilteredResult(_0x38e18,_0x4b7d67))[_0xe757('0x59')](handleError(_0x38e18,null));};exports[_0xe757('0x6d')]=function(_0x4f0ff5,_0x14230c,_0x225326){return db['WhatsappAccount'][_0xe757('0x5c')]({'where':{'id':_0x4f0ff5[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x14230c,null))['then'](function(_0x3d1d14){if(_0x3d1d14){return _0x3d1d14[_0xe757('0x6d')](_0x4f0ff5[_0xe757('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x14230c,null))[_0xe757('0x59')](handleError(_0x14230c,null));};exports[_0xe757('0x6e')]=function(_0xb8b2c4,_0x3eeca5,_0x2e5244){return db[_0xe757('0x56')][_0xe757('0x5c')]({'where':{'id':_0xb8b2c4[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x3eeca5,null))[_0xe757('0x1f')](function(_0x5b2e4b){if(_0x5b2e4b){return _0x5b2e4b[_0xe757('0x6e')](_0xb8b2c4['body'][_0xe757('0x6f')],_[_0xe757('0x70')](_0xb8b2c4[_0xe757('0x5e')],['ids','id'])||{})[_0xe757('0x71')](function(_0x5888c8){for(var _0x340957=0x0;_0x340957<_0xb8b2c4[_0xe757('0x5e')][_0xe757('0x6f')][_0xe757('0x4b')];_0x340957+=0x1){socket[_0xe757('0x72')](_0xe757('0x73'),{'UserId':Number(_0xb8b2c4[_0xe757('0x5e')]['ids'][_0x340957]),'WhatsappAccountId':Number(_0xb8b2c4[_0xe757('0x5a')]['id'])});}return _0x5888c8;});}})[_0xe757('0x1f')](respondWithResult(_0x3eeca5,null))['catch'](handleError(_0x3eeca5,null));};exports['removeAgents']=function(_0x27ca4a,_0x5a170c,_0x1967a4){return db[_0xe757('0x56')][_0xe757('0x5c')]({'where':{'id':_0x27ca4a[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x5a170c,null))[_0xe757('0x1f')](function(_0x2b4886){if(_0x2b4886){return _0x2b4886[_0xe757('0x74')](_0x27ca4a[_0xe757('0x45')]['ids'])[_0xe757('0x1f')](function(){if(_[_0xe757('0x75')](_0x27ca4a[_0xe757('0x45')][_0xe757('0x6f')])){for(var _0x331203=0x0;_0x331203<_0x27ca4a[_0xe757('0x45')][_0xe757('0x6f')]['length'];_0x331203+=0x1){socket[_0xe757('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x27ca4a[_0xe757('0x45')][_0xe757('0x6f')][_0x331203]),'WhatsappAccountId':Number(_0x27ca4a[_0xe757('0x5a')]['id'])});}}else{socket[_0xe757('0x72')](_0xe757('0x76'),{'UserId':Number(_0x27ca4a[_0xe757('0x45')][_0xe757('0x6f')]),'WhatsappAccountId':Number(_0x27ca4a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5a170c,null))[_0xe757('0x59')](handleError(_0x5a170c,null));};exports[_0xe757('0x77')]=function(_0x4583aa,_0x4f03f6,_0x109e10){var _0x5068cd={};var _0x3df8fc={};var _0x54739a;var _0x4f547c;return db[_0xe757('0x56')]['findOne']({'where':{'id':_0x4583aa['params']['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x4f03f6,null))['then'](function(_0x1e4c1f){if(_0x1e4c1f){_0x54739a=_0x1e4c1f;_0x3df8fc[_0xe757('0x44')]=_[_0xe757('0x46')](db[_0xe757('0x78')][_0xe757('0x40')]);_0x3df8fc[_0xe757('0x45')]=_[_0xe757('0x46')](_0x4583aa['query']);_0x3df8fc[_0xe757('0x47')]=_[_0xe757('0x48')](_0x3df8fc[_0xe757('0x44')],_0x3df8fc[_0xe757('0x45')]);_0x5068cd['attributes']=_[_0xe757('0x48')](_0x3df8fc[_0xe757('0x44')],qs[_0xe757('0x4a')](_0x4583aa[_0xe757('0x45')]['fields']));_0x5068cd['attributes']=_0x5068cd[_0xe757('0x49')][_0xe757('0x4b')]?_0x5068cd['attributes']:_0x3df8fc[_0xe757('0x44')];_0x5068cd[_0xe757('0x4e')]=qs[_0xe757('0x4f')](_0x4583aa[_0xe757('0x45')][_0xe757('0x4f')]);_0x5068cd['where']=qs[_0xe757('0x47')](_['pick'](_0x4583aa[_0xe757('0x45')],_0x3df8fc[_0xe757('0x47')]));if(_0x4583aa['query'][_0xe757('0x52')]){_0x5068cd[_0xe757('0x50')]=_['merge'](_0x5068cd[_0xe757('0x50')],{'$or':_[_0xe757('0x3f')](_0x5068cd[_0xe757('0x49')],function(_0x13b7f8){var _0x233593={};_0x233593[_0x13b7f8]={'$like':'%'+_0x4583aa[_0xe757('0x45')][_0xe757('0x52')]+'%'};return _0x233593;})});}_0x5068cd=_[_0xe757('0x54')]({},_0x5068cd,_0x4583aa['options']);return _0x54739a[_0xe757('0x77')](_0x5068cd);}})[_0xe757('0x1f')](function(_0x45c99e){if(_0x45c99e){_0x4f547c=_0x45c99e[_0xe757('0x4b')];if(!_0x4583aa['query'][_0xe757('0x4c')]('nolimit')){_0x5068cd[_0xe757('0x2d')]=qs['limit'](_0x4583aa[_0xe757('0x45')][_0xe757('0x2d')]);_0x5068cd[_0xe757('0x30')]=qs[_0xe757('0x30')](_0x4583aa[_0xe757('0x45')][_0xe757('0x30')]);}return _0x54739a[_0xe757('0x77')](_0x5068cd);}})[_0xe757('0x1f')](function(_0x46b184){if(_0x46b184){return _0x46b184?{'count':_0x4f547c,'rows':_0x46b184}:null;}})[_0xe757('0x1f')](respondWithResult(_0x4f03f6,null))[_0xe757('0x59')](handleError(_0x4f03f6,null));};exports[_0xe757('0x79')]=function(_0x3228c5,_0xc90192){var _0x2e4286=_0x3228c5['params']['id'];var _0x5e9d34=_0x3228c5['body'];var _0x462bd9=0xc8;var _0xcfa907=null;return db['sequelize'][_0xe757('0x7a')]({'isolationLevel':db[_0xe757('0x7b')][_0xe757('0x7c')][_0xe757('0x7d')]['READ_COMMITTED']},function(_0x2815c9){return db[_0xe757('0x56')]['findOne']({'where':{'id':_0x2e4286},'transaction':_0x2815c9})[_0xe757('0x1f')](function(_0x16f406){if(_0x16f406){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x2e4286},'transaction':_0x2815c9})[_0xe757('0x1f')](function(){var _0xeda332=_['map'](_0x5e9d34,function(_0x905588){_0x905588[_0xe757('0x65')]=_0x2e4286;return _0x905588;});return db[_0xe757('0x7e')][_0xe757('0x7f')](_0xeda332,{'transaction':_0x2815c9});});}else{_0x462bd9=0x194;_0xcfa907=[];}});})['then'](function(){if(_0x462bd9!==0x194){return db['WhatsappApplication'][_0xe757('0x80')]({'where':{'WhatsappAccountId':_0x2e4286},'order':_0xe757('0x81')})[_0xe757('0x1f')](function(_0x2433de){_0xcfa907=_0x2433de;});}})[_0xe757('0x59')](function(_0x3e8bee){_0x462bd9=0x1f4;logger[_0xe757('0x26')](_0x3e8bee[_0xe757('0x39')]);if(_0x3e8bee['name']){delete _0x3e8bee['name'];}_0xcfa907=_0x3e8bee;})[_0xe757('0x82')](function(){if(_0xcfa907===null){_0xc90192['sendStatus'](_0x462bd9);}else{if(_0x462bd9===0x1f4){_0xc90192[_0xe757('0x2b')](_0x462bd9)[_0xe757('0x3b')](_0xcfa907);}else{_0xc90192[_0xe757('0x2b')](_0x462bd9)[_0xe757('0x2c')](_0xcfa907);}}});};exports[_0xe757('0x83')]=function(_0x4eced7,_0x21d863,_0x5b4255){var _0x2bd34f={};var _0x26d006={};var _0x15d44a;var _0x11511;return db[_0xe757('0x56')]['findOne']({'where':{'id':_0x4eced7[_0xe757('0x5a')]['id']}})[_0xe757('0x1f')](handleEntityNotFound(_0x21d863,null))[_0xe757('0x1f')](function(_0x43c261){if(_0x43c261){_0x15d44a=_0x43c261;_0x26d006[_0xe757('0x44')]=_[_0xe757('0x46')](db[_0xe757('0x7e')][_0xe757('0x40')]);_0x26d006[_0xe757('0x45')]=_[_0xe757('0x46')](_0x4eced7[_0xe757('0x45')]);_0x26d006['filters']=_[_0xe757('0x48')](_0x26d006['model'],_0x26d006[_0xe757('0x45')]);_0x2bd34f[_0xe757('0x49')]=_[_0xe757('0x48')](_0x26d006[_0xe757('0x44')],qs['fields'](_0x4eced7[_0xe757('0x45')][_0xe757('0x4a')]));_0x2bd34f[_0xe757('0x49')]=_0x2bd34f[_0xe757('0x49')][_0xe757('0x4b')]?_0x2bd34f[_0xe757('0x49')]:_0x26d006[_0xe757('0x44')];_0x2bd34f['order']=qs[_0xe757('0x4f')](_0x4eced7[_0xe757('0x45')][_0xe757('0x4f')]);_0x2bd34f['where']=qs['filters'](_[_0xe757('0x51')](_0x4eced7[_0xe757('0x45')],_0x26d006[_0xe757('0x47')]));if(_0x4eced7[_0xe757('0x45')][_0xe757('0x52')]){_0x2bd34f[_0xe757('0x50')]=_[_0xe757('0x54')](_0x2bd34f[_0xe757('0x50')],{'$or':_[_0xe757('0x3f')](_0x2bd34f[_0xe757('0x49')],function(_0x324522){var _0x4503c2={};_0x4503c2[_0x324522]={'$like':'%'+_0x4eced7['query'][_0xe757('0x52')]+'%'};return _0x4503c2;})});}_0x2bd34f=_['merge']({},_0x2bd34f,_0x4eced7[_0xe757('0x55')]);return _0x15d44a[_0xe757('0x83')](_0x2bd34f);}})['then'](function(_0x1d3853){if(_0x1d3853){_0x11511=_0x1d3853[_0xe757('0x4b')];if(!_0x4eced7['query'][_0xe757('0x4c')](_0xe757('0x4d'))){_0x2bd34f[_0xe757('0x2d')]=qs[_0xe757('0x2d')](_0x4eced7['query'][_0xe757('0x2d')]);_0x2bd34f[_0xe757('0x30')]=qs[_0xe757('0x30')](_0x4eced7[_0xe757('0x45')][_0xe757('0x30')]);}return _0x15d44a[_0xe757('0x83')](_0x2bd34f);}})[_0xe757('0x1f')](function(_0x54c6b0){if(_0x54c6b0){return _0x54c6b0?{'count':_0x11511,'rows':_0x54c6b0}:null;}})[_0xe757('0x1f')](respondWithResult(_0x21d863,null))['catch'](handleError(_0x21d863,null));};exports[_0xe757('0x84')]=function(_0x6a4a8d,_0x233f3d,_0x3344c9){var _0x3c0010={'channel':_0xe757('0x85')};var _0x14e044=[];var _0x1e2dca=[];var _0x137c79={};return db[_0xe757('0x56')]['find']({'where':{'id':_0x6a4a8d[_0xe757('0x5a')]['id']},'include':[{'model':db[_0xe757('0x7e')],'as':_0xe757('0x86')}]})[_0xe757('0x1f')](handleEntityNotFound(_0x233f3d,null))[_0xe757('0x1f')](function(_0x36fedc){_0x3c0010[_0xe757('0x87')]=_0x36fedc;if(_0x3c0010[_0xe757('0x87')]&&_0x3c0010[_0xe757('0x87')][_0xe757('0x42')]===_0xe757('0x88')&&_0x6a4a8d[_0xe757('0x5e')][_0xe757('0x89')]){if(_0x6a4a8d['body'][_0xe757('0x89')][_0xe757('0x4b')]===0x0)return;if(_0x6a4a8d[_0xe757('0x5e')]['statuses'][0x0][_0xe757('0x8a')]!=='read')return;return db[_0xe757('0x8b')][_0xe757('0x34')]({'read':!![],'readAt':_0x6a4a8d[_0xe757('0x5e')]['statuses'][0x0][_0xe757('0x8c')]},{'where':{'messageId':_0x6a4a8d[_0xe757('0x5e')][_0xe757('0x89')][0x0][_0xe757('0x8d')]},'individualHooks':!![]})[_0xe757('0x1f')](function(_0x6bb0c4){return _0x233f3d[_0xe757('0x2b')](0xc8)[_0xe757('0x2c')](_0x6bb0c4);});}_0x3c0010[_0xe757('0x8e')]=_['orderBy'](_0x36fedc[_0xe757('0x86')],[_0xe757('0x81')],['asc']);if(_0x3c0010['account'][_0xe757('0x86')]){delete _0x3c0010[_0xe757('0x87')][_0xe757('0x86')];}return db[_0xe757('0x8f')][_0xe757('0x64')]()[_0xe757('0x1f')](function(_0xd452d3){if(!_0xd452d3){throw new db[(_0xe757('0x90'))]['ValidationError'](_0xe757('0x91'));}_0x14e044=_[_0xe757('0x92')](_['keys'](_0xd452d3),[_0xe757('0x93'),_0xe757('0x94')]);_0x1e2dca=_[_0xe757('0x92')](_['keys'](_0xd452d3),[_0xe757('0x93'),_0xe757('0x94'),_0xe757('0x95'),_0xe757('0x96')]);_0x3c0010[_0xe757('0x5e')]={'mapKey':_0xe757('0x97')};if(_0x3c0010[_0xe757('0x87')]&&_0x3c0010['account'][_0xe757('0x42')]==='twilio'){_0x3c0010[_0xe757('0x5e')][_0xe757('0x98')]=_0x6a4a8d[_0xe757('0x5e')][_0xe757('0x99')][_0xe757('0x9a')](_0xe757('0x9b'),'');_0x3c0010[_0xe757('0x5e')][_0xe757('0x5e')]=_0x6a4a8d[_0xe757('0x5e')][_0xe757('0x9c')];_0x3c0010[_0xe757('0x5e')][_0xe757('0x9d')]=_0x6a4a8d[_0xe757('0x5e')][_0xe757('0x9e')];}if(_0x3c0010[_0xe757('0x87')]&&_0x3c0010['account'][_0xe757('0x42')]===_0xe757('0x88')){_0x3c0010[_0xe757('0x5e')][_0xe757('0x98')]=_0x6a4a8d['body'][_0xe757('0x9f')][0x0][_0xe757('0x98')];_0x3c0010[_0xe757('0x5e')][_0xe757('0x5e')]=_0x6a4a8d['body'][_0xe757('0x9f')][0x0][_0xe757('0x28')]['body'];_0x3c0010[_0xe757('0x5e')][_0xe757('0x9d')]=_0x6a4a8d[_0xe757('0x5e')][_0xe757('0x9f')][0x0][_0xe757('0x8d')];}if(_0x3c0010['body']['id']){delete _0x3c0010['body']['id'];}if(_[_0xe757('0xa0')](_0x3c0010['body'][_0xe757('0x98')])){throw new db[(_0xe757('0x90'))][(_0xe757('0xa1'))](_0xe757('0xa2'));}if(_[_0xe757('0xa0')](_0x3c0010[_0xe757('0x5e')][_0xe757('0x5e')])||_0x3c0010[_0xe757('0x5e')][_0xe757('0x5e')]===''){throw new db['Sequelize'][(_0xe757('0xa1'))](_0xe757('0xa3'));}if(_['isNil'](_0x3c0010[_0xe757('0x5e')]['mapKey'])){throw new db[(_0xe757('0x90'))][(_0xe757('0xa1'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e2dca);}if(!_['includes'](_0x1e2dca,_0x3c0010[_0xe757('0x5e')][_0xe757('0xa4')])){throw new db[(_0xe757('0x90'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e2dca);}_0x137c79[_0x3c0010[_0xe757('0x5e')]['mapKey']]=_0x3c0010[_0xe757('0x5e')]['from'];return db['CmList'][_0xe757('0x5c')]({'where':{'id':_0x3c0010[_0xe757('0x87')]['ListId']},'include':[{'model':db[_0xe757('0x8f')],'as':_0xe757('0xa5'),'where':_0x137c79,'limit':0x1,'order':[[_0xe757('0x94'),_0xe757('0xa6')]]}]});})[_0xe757('0x1f')](handleEntityNotFound(_0x233f3d,null))[_0xe757('0x1f')](function(_0x458600){if(_0x458600){_0x3c0010[_0xe757('0xa7')]=_[_0xe757('0x70')](_0x458600,['Contacts']);if(_0x458600[_0xe757('0xa5')][_0xe757('0x4b')]){return _0x458600[_0xe757('0xa5')][0x0];}var _0x5b55d0=_[_0xe757('0xa8')](_0x3c0010[_0xe757('0x5e')],{'firstName':_0x3c0010['body'][_0xe757('0x98')],'ListId':_0x458600['id']});_0x5b55d0[_0x3c0010[_0xe757('0x5e')][_0xe757('0xa4')]]=_0x3c0010[_0xe757('0x5e')][_0xe757('0x98')];return db[_0xe757('0x8f')][_0xe757('0x5d')](_0x5b55d0,{'fields':_0x14e044,'raw':!![]});}})['then'](handleEntityNotFound(_0x233f3d,null))['then'](function(_0x20a633){if(_0x20a633){_0x3c0010[_0xe757('0xa9')]=_0x20a633;var _0x42dfd3={'ContactId':_0x20a633['id'],'phone':_0x3c0010[_0xe757('0x5e')]['from'],'WhatsappAccountId':_0x6a4a8d[_0xe757('0x5a')]['id']};var _0x37f314={'ContactId':_0x20a633['id'],'WhatsappAccountId':_0x6a4a8d[_0xe757('0x5a')]['id'],'closed':![]};return db[_0xe757('0xaa')][_0xe757('0x5c')]({'where':_0x37f314})['then'](function(_0x4a5a37){if(_0x4a5a37){return[_0x4a5a37,![]];}return db[_0xe757('0xaa')]['create'](_0x42dfd3)['then'](function(_0xda1497){return[_0xda1497,!![]];});});}})[_0xe757('0x71')](function(_0x30ea22,_0x2d5056){_0x3c0010[_0xe757('0xab')]=_0x30ea22['get']({'plain':!![]});_0x3c0010[_0xe757('0xab')][_0xe757('0xac')]=![];if(_0x2d5056){if(_0x3c0010['account'][_0xe757('0xad')]){_0x3c0010['applications'][_0xe757('0xae')]({'id':0x0,'priority':_0x3c0010[_0xe757('0x8e')][_0xe757('0x4b')]+0x1,'app':_0xe757('0xaf'),'appdata':_0xe757('0xb0'),'interval':_0xe757('0xb1')});}_0x3c0010['interaction'][_0xe757('0xac')]=!![];}return db['WhatsappMessage'][_0xe757('0x5d')]({'phone':_0x3c0010['body'][_0xe757('0x98')],'messageId':_0x3c0010[_0xe757('0x5e')][_0xe757('0x9d')],'body':_0x3c0010[_0xe757('0x5e')][_0xe757('0x5e')],'WhatsappAccountId':_0x6a4a8d[_0xe757('0x5a')]['id'],'WhatsappInteractionId':_0x30ea22['id'],'direction':'in','ContactId':_0x30ea22[_0xe757('0xb2')],'AttachmentId':_0x3c0010[_0xe757('0x5e')][_0xe757('0xb3')]});})[_0xe757('0x1f')](function(_0x35396f){_0x3c0010[_0xe757('0x28')]=_0x35396f;if(!_0x3c0010[_0xe757('0xab')][_0xe757('0xb4')])return;return db[_0xe757('0x78')][_0xe757('0x5c')]({'attributes':['id',_0xe757('0x3a')],'where':{'id':_0x3c0010[_0xe757('0xab')][_0xe757('0xb4')]}});})[_0xe757('0x1f')](function(_0x2b4631){if(_0x2b4631){_0x3c0010[_0xe757('0x8e')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2b4631[_0xe757('0x3a')]+','+(_0x3c0010[_0xe757('0x87')][_0xe757('0xb5')]||0xa),'interval':_0xe757('0xb1')});}if(!_0x3c0010['interaction'][_0xe757('0xb6')])return;return db['WhatsappQueue'][_0xe757('0x5c')]({'attributes':['id',_0xe757('0x3a')],'where':{'id':_0x3c0010[_0xe757('0xab')][_0xe757('0xb6')]}});})['then'](function(_0x27a2b3){if(_0x27a2b3){_0x3c0010[_0xe757('0x8e')][_0xe757('0xb7')]({'id':0x0,'priority':0x1,'app':_0xe757('0xb8'),'appdata':_0x27a2b3[_0xe757('0x3a')]+','+(_0x3c0010[_0xe757('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xe757('0xb9'),_0x3c0010);})[_0xe757('0x1f')](function(_0x2b5047){if(_0x2b5047){var _0xb9761a=0xc8;var _0x3cae82=_0xe757('0xba');logger[_0xe757('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3cae82,_0xb9761a,_0xe757('0xbb'));logger[_0xe757('0x23')](_0xe757('0xbc'),_0x3cae82,_0xb9761a,_0xe757('0xbb'),JSON[_0xe757('0x25')](_0x2b5047));if(_0x3c0010[_0xe757('0x87')]['type']===_0xe757('0xbd')){return _0x233f3d['status'](_0xb9761a)[_0xe757('0x31')](_0xe757('0xbe'),_0xe757('0xbf'))[_0xe757('0x3b')](_0xe757('0xc0'));}else{return _0x233f3d[_0xe757('0x2b')](_0xb9761a)[_0xe757('0x2c')](_0x2b5047);}}});})['catch'](handleError(_0x233f3d,null));};exports[_0xe757('0x3b')]=function(_0xd01c62,_0x17e43f,_0x527f48){var _0x28e224,_0x20dda6,_0x3941fc;if(_[_0xe757('0xa0')](_0xd01c62[_0xe757('0x5e')]['body'])||_0xd01c62[_0xe757('0x5e')][_0xe757('0x5e')]===''){throw new db[(_0xe757('0x90'))][(_0xe757('0xa1'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe757('0xa0')](_0xd01c62[_0xe757('0x5e')]['to'])){throw new db[(_0xe757('0x90'))]['ValidationError'](_0xe757('0xc1'));}_0x28e224=_0xd01c62[_0xe757('0x5e')]['to'];return db['WhatsappAccount'][_0xe757('0x5c')]({'where':{'id':_0xd01c62[_0xe757('0x5a')]['id']},'include':[{'model':db[_0xe757('0xc2')],'as':_0xe757('0xc3'),'include':[{'model':db[_0xe757('0x8f')],'as':_0xe757('0xa5'),'where':{'mobile':_0x28e224},'limit':0x1,'order':[[_0xe757('0x94'),_0xe757('0xa6')]]}]}]})[_0xe757('0x1f')](handleEntityNotFound(_0x17e43f,null))['then'](function(_0xda4f21){if(_0xda4f21&&_0xda4f21['List']){_0x20dda6=_0xda4f21[_0xe757('0x36')]({'plain':!![]});if(_0x20dda6[_0xe757('0xc3')]&&_0x20dda6['List'][_0xe757('0xa5')][_0xe757('0x4b')]){return _0x20dda6[_0xe757('0xc3')]['Contacts'][0x0];}return db[_0xe757('0x8f')]['create'](_['defaults'](_0xd01c62[_0xe757('0x5e')],{'firstName':_0x28e224,'mobile':_0x28e224,'phone':_0x28e224,'ListId':_0x20dda6[_0xe757('0x96')]}));}})['then'](handleEntityNotFound(_0x17e43f,null))['then'](function(_0x58386e){if(_0x58386e){_0x3941fc=_0x58386e;return db['WhatsappInteraction'][_0xe757('0x5c')]({'where':{'ContactId':_0x3941fc['id'],'closed':![],'WhatsappAccountId':_0x20dda6['id']}})[_0xe757('0x1f')](function(_0x39cc27){if(_0x39cc27){return[_0x39cc27,![]];}return db['WhatsappInteraction'][_0xe757('0x5d')]({'UserId':_0xd01c62[_0xe757('0x5f')]['id'],'ContactId':_0x3941fc['id'],'WhatsappAccountId':_0x20dda6['id'],'phone':_0x28e224,'firstMsgDirection':_0xe757('0xc4'),'Messages':[_[_0xe757('0x54')](_0xd01c62[_0xe757('0x5e')],{'read':![],'body':_0xd01c62['body'][_0xe757('0x5e')],'phone':_0x28e224,'WhatsappAccountId':_0x20dda6['id'],'UserId':_0xd01c62[_0xe757('0x5f')]['id'],'ContactId':_0x3941fc['id']})]},{'include':[{'model':db[_0xe757('0x8b')],'as':_0xe757('0xc5')}]})[_0xe757('0x1f')](function(_0x5d832a){return[_0x5d832a,!![]];});});}})[_0xe757('0x71')](function(_0x16f0b0,_0x2f6567){if(_0x2f6567){return _0x16f0b0;}return db[_0xe757('0x8b')][_0xe757('0x5d')](_[_0xe757('0x54')](_0xd01c62[_0xe757('0x5e')],{'read':![],'body':_0xd01c62['body'][_0xe757('0x5e')],'phone':_0x28e224,'WhatsappAccountId':_0x20dda6['id'],'WhatsappInteractionId':_0x16f0b0['id'],'UserId':_0xd01c62[_0xe757('0x5f')]['id'],'ContactId':_0x3941fc['id']}))[_0xe757('0x1f')](function(_0x4f7e05){_0x16f0b0[_0xe757('0xc6')][_0xe757('0xc5')]=[];_0x16f0b0[_0xe757('0xc6')][_0xe757('0xc5')][_0xe757('0xae')](_0x4f7e05[_0xe757('0xc6')]);return _0x16f0b0;});})[_0xe757('0x1f')](respondWithResult(_0x17e43f,null))[_0xe757('0x59')](handleError(_0x17e43f,null));}; \ No newline at end of file +var _0xbfcc=['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','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','count','set','Content-Range','save','update','get','UserProfileResource','destroy','sendStatus','index','Pause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','limit','order','sort','where','filters','pick','merge','name','filter','options','includeAll','include','findAll','show','params','mandatoryDispositionPause','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','hasOwnProperty','nolimit','WhatsappAccountId','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','stack','finally','send','getApplications','whatsapp','Applications','account','sinch','statuses','read','WhatsappMessage','message_id','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','replace','Body','MessageSid','notifications','messageId','ValidationError','from\x20is\x20mandatory','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','ListId','Contacts','DESC','contact','interaction','created','autoclose','push','applications','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','WhatsappQueue','waitForTheAssignedQueue','Start','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto'];(function(_0x2d2b63,_0x277d0a){var _0x5d18f8=function(_0x4eca54){while(--_0x4eca54){_0x2d2b63['push'](_0x2d2b63['shift']());}};_0x5d18f8(++_0x277d0a);}(_0xbfcc,0x186));var _0xcbfc=function(_0x335271,_0x5025f2){_0x335271=_0x335271-0x0;var _0xa9fff8=_0xbfcc[_0x335271];return _0xa9fff8;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require(_0xcbfc('0x1'));var zipdir=require(_0xcbfc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbfc('0x3'));var moment=require(_0xcbfc('0x4'));var BPromise=require(_0xcbfc('0x5'));var Mustache=require(_0xcbfc('0x6'));var util=require('util');var path=require(_0xcbfc('0x7'));var sox=require('sox');var csv=require(_0xcbfc('0x8'));var ejs=require(_0xcbfc('0x9'));var fs=require('fs');var fs_extra=require(_0xcbfc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcbfc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcbfc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcbfc('0xd'));var Papa=require(_0xcbfc('0xe'));var Redis=require(_0xcbfc('0xf'));var authService=require(_0xcbfc('0x10'));var qs=require(_0xcbfc('0x11'));var as=require(_0xcbfc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbfc('0x13'))(_0xcbfc('0x14'));var utils=require(_0xcbfc('0x15'));var config=require(_0xcbfc('0x16'));var licenseUtil=require(_0xcbfc('0x17'));var db=require(_0xcbfc('0x18'))['db'];config['redis']=_[_0xcbfc('0x19')](config[_0xcbfc('0x1a')],{'host':_0xcbfc('0x1b'),'port':0x18eb});var socket=require(_0xcbfc('0x1c'))(new Redis(config[_0xcbfc('0x1a')]));require(_0xcbfc('0x1d'))[_0xcbfc('0x1e')](socket);var jayson=require(_0xcbfc('0x1f'));var client=jayson[_0xcbfc('0x20')][_0xcbfc('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x34c151,_0x4078a2,_0x25db2f,_0x5b3e44){return new BPromise(function(_0x29aff6,_0x5f580f){var _0x23bd03=_0x5b3e44||client;return _0x23bd03['request'](_0x34c151,_0x25db2f)[_0xcbfc('0x22')](function(_0x4af8e3){logger[_0xcbfc('0x23')](_0xcbfc('0x24'),_0x4078a2,'request\x20sent');logger[_0xcbfc('0x25')](_0xcbfc('0x26'),_0x4078a2,'request\x20sent',JSON[_0xcbfc('0x27')](_0x4af8e3));if(_0x4af8e3[_0xcbfc('0x28')]){if(_0x4af8e3[_0xcbfc('0x28')][_0xcbfc('0x29')]===0x1f4){logger[_0xcbfc('0x28')](_0xcbfc('0x24'),_0x4078a2,_0x4af8e3[_0xcbfc('0x28')][_0xcbfc('0x2a')]);return _0x5f580f(_0x4af8e3['error'][_0xcbfc('0x2a')]);}logger[_0xcbfc('0x28')](_0xcbfc('0x24'),_0x4078a2,_0x4af8e3[_0xcbfc('0x28')][_0xcbfc('0x2a')]);return _0x29aff6(_0x4af8e3[_0xcbfc('0x28')][_0xcbfc('0x2a')]);}else{logger[_0xcbfc('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x4078a2,'request\x20sent');_0x29aff6(_0x4af8e3['result'][_0xcbfc('0x2a')]);}})[_0xcbfc('0x2b')](function(_0x28833b){logger[_0xcbfc('0x28')](_0xcbfc('0x24'),_0x4078a2,_0x28833b);_0x5f580f(_0x28833b);});});}function respondWithStatusCode(_0x7073ed,_0x4237fc){_0x4237fc=_0x4237fc||0xcc;return function(_0x174779){if(_0x174779){return _0x7073ed['sendStatus'](_0x4237fc);}return _0x7073ed[_0xcbfc('0x2c')](_0x4237fc)[_0xcbfc('0x2d')]();};}function respondWithResult(_0x38c498,_0x54715d){_0x54715d=_0x54715d||0xc8;return function(_0x28cfc3){if(_0x28cfc3){return _0x38c498[_0xcbfc('0x2c')](_0x54715d)[_0xcbfc('0x2e')](_0x28cfc3);}};}function respondWithFilteredResult(_0xace3d2,_0x413e75){return function(_0x30a541){if(_0x30a541){var _0x51100f=typeof _0x413e75[_0xcbfc('0x2f')]===_0xcbfc('0x30')&&typeof _0x413e75['limit']===_0xcbfc('0x30');var _0x36cb4d=_0x30a541[_0xcbfc('0x31')];var _0x21dcaf=_0x51100f?0x0:_0x413e75[_0xcbfc('0x2f')];var _0x4fcb2e=_0x51100f?_0x30a541[_0xcbfc('0x31')]:_0x413e75[_0xcbfc('0x2f')]+_0x413e75['limit'];var _0x15cb4e;if(_0x4fcb2e>=_0x36cb4d){_0x4fcb2e=_0x36cb4d;_0x15cb4e=0xc8;}else{_0x15cb4e=0xce;}_0xace3d2[_0xcbfc('0x2c')](_0x15cb4e);return _0xace3d2[_0xcbfc('0x32')](_0xcbfc('0x33'),_0x21dcaf+'-'+_0x4fcb2e+'/'+_0x36cb4d)[_0xcbfc('0x2e')](_0x30a541);}return null;};}function patchUpdates(_0x278966){return function(_0xa474a1){try{jsonpatch['apply'](_0xa474a1,_0x278966,!![]);}catch(_0x2a0ec2){return BPromise['reject'](_0x2a0ec2);}return _0xa474a1[_0xcbfc('0x34')]();};}function saveUpdates(_0x245cc3,_0x1c4c58){return function(_0x2494bc){if(_0x2494bc){return _0x2494bc[_0xcbfc('0x35')](_0x245cc3)[_0xcbfc('0x22')](function(_0x471b7c){return _0x471b7c;});}return null;};}function removeEntity(_0x488426,_0x158f4a){return function(_0x3176dd){if(_0x3176dd){return _0x3176dd['destroy']()[_0xcbfc('0x22')](function(){var _0x246d7e=_0x3176dd[_0xcbfc('0x36')]({'plain':!![]});var _0x3d662f='WhatsappAccounts';return db[_0xcbfc('0x37')][_0xcbfc('0x38')]({'where':{'type':_0x3d662f,'resourceId':_0x246d7e['id']}})[_0xcbfc('0x22')](function(){return _0x3176dd;});})[_0xcbfc('0x22')](function(){_0x488426[_0xcbfc('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ecce,_0x1914ce){return function(_0x238717){if(!_0x238717){_0x12ecce[_0xcbfc('0x39')](0x194);}return _0x238717;};}function handleError(_0x383052,_0x214788){_0x214788=_0x214788||0x1f4;return function(_0x4d1d4e){logger[_0xcbfc('0x28')](_0x4d1d4e['stack']);if(_0x4d1d4e['name']){delete _0x4d1d4e['name'];}_0x383052[_0xcbfc('0x2c')](_0x214788)['send'](_0x4d1d4e);};}exports[_0xcbfc('0x3a')]=function(_0x144849,_0x34caa2){var _0x2a2ad3={'include':[{'model':db[_0xcbfc('0x3b')],'as':'mandatoryDispositionPause'}]},_0x52d607={},_0x48b987={'count':0x0,'rows':[]};var _0x5a4efa=_[_0xcbfc('0x3c')](db[_0xcbfc('0x3d')][_0xcbfc('0x3e')],function(_0x474b2a){return{'name':_0x474b2a[_0xcbfc('0x3f')],'type':_0x474b2a[_0xcbfc('0x40')][_0xcbfc('0x41')]};});_0x52d607[_0xcbfc('0x42')]=_[_0xcbfc('0x3c')](_0x5a4efa,'name');_0x52d607['query']=_[_0xcbfc('0x43')](_0x144849[_0xcbfc('0x44')]);_0x52d607['filters']=_['intersection'](_0x52d607[_0xcbfc('0x42')],_0x52d607[_0xcbfc('0x44')]);_0x2a2ad3[_0xcbfc('0x45')]=_[_0xcbfc('0x46')](_0x52d607[_0xcbfc('0x42')],qs[_0xcbfc('0x47')](_0x144849[_0xcbfc('0x44')]['fields']));_0x2a2ad3[_0xcbfc('0x45')]=_0x2a2ad3[_0xcbfc('0x45')]['length']?_0x2a2ad3[_0xcbfc('0x45')]:_0x52d607['model'];if(!_0x144849[_0xcbfc('0x44')]['hasOwnProperty']('nolimit')){_0x2a2ad3[_0xcbfc('0x48')]=qs[_0xcbfc('0x48')](_0x144849[_0xcbfc('0x44')][_0xcbfc('0x48')]);_0x2a2ad3['offset']=qs[_0xcbfc('0x2f')](_0x144849[_0xcbfc('0x44')]['offset']);}_0x2a2ad3[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x144849[_0xcbfc('0x44')][_0xcbfc('0x4a')]);_0x2a2ad3[_0xcbfc('0x4b')]=qs[_0xcbfc('0x4c')](_[_0xcbfc('0x4d')](_0x144849['query'],_0x52d607[_0xcbfc('0x4c')]),_0x5a4efa);if(_0x144849[_0xcbfc('0x44')]['filter']){_0x2a2ad3[_0xcbfc('0x4b')]=_[_0xcbfc('0x4e')](_0x2a2ad3['where'],{'$or':_[_0xcbfc('0x3c')](_0x5a4efa,function(_0x86c04b){if(_0x86c04b['type']!=='VIRTUAL'){var _0x425fec={};_0x425fec[_0x86c04b[_0xcbfc('0x4f')]]={'$like':'%'+_0x144849[_0xcbfc('0x44')][_0xcbfc('0x50')]+'%'};return _0x425fec;}})});}_0x2a2ad3=_['merge']({},_0x2a2ad3,_0x144849[_0xcbfc('0x51')]);var _0x58af43={'where':_0x2a2ad3[_0xcbfc('0x4b')]};return db[_0xcbfc('0x3d')][_0xcbfc('0x31')](_0x58af43)[_0xcbfc('0x22')](function(_0x1780f3){_0x48b987[_0xcbfc('0x31')]=_0x1780f3;if(_0x144849[_0xcbfc('0x44')][_0xcbfc('0x52')]){_0x2a2ad3[_0xcbfc('0x53')]=[{'all':!![]}];}return db[_0xcbfc('0x3d')][_0xcbfc('0x54')](_0x2a2ad3);})[_0xcbfc('0x22')](function(_0x3dcae5){_0x48b987['rows']=_0x3dcae5;return _0x48b987;})[_0xcbfc('0x22')](respondWithFilteredResult(_0x34caa2,_0x2a2ad3))['catch'](handleError(_0x34caa2,null));};exports[_0xcbfc('0x55')]=function(_0x3735d6,_0x9602de){var _0x4d6944={'raw':![],'where':{'id':_0x3735d6[_0xcbfc('0x56')]['id']},'include':[{'model':db[_0xcbfc('0x3b')],'as':_0xcbfc('0x57')}]},_0xf73433={};_0xf73433['model']=_[_0xcbfc('0x43')](db[_0xcbfc('0x3d')][_0xcbfc('0x3e')]);_0xf73433[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x3735d6[_0xcbfc('0x44')]);_0xf73433[_0xcbfc('0x4c')]=_[_0xcbfc('0x46')](_0xf73433[_0xcbfc('0x42')],_0xf73433['query']);_0x4d6944[_0xcbfc('0x45')]=_[_0xcbfc('0x46')](_0xf73433[_0xcbfc('0x42')],qs[_0xcbfc('0x47')](_0x3735d6[_0xcbfc('0x44')][_0xcbfc('0x47')]));_0x4d6944[_0xcbfc('0x45')]=_0x4d6944[_0xcbfc('0x45')][_0xcbfc('0x58')]?_0x4d6944['attributes']:_0xf73433['model'];if(_0x3735d6[_0xcbfc('0x44')][_0xcbfc('0x52')]){_0x4d6944[_0xcbfc('0x53')]=[{'all':!![]}];}_0x4d6944=_[_0xcbfc('0x4e')]({},_0x4d6944,_0x3735d6['options']);return db[_0xcbfc('0x3d')][_0xcbfc('0x59')](_0x4d6944)['then'](handleEntityNotFound(_0x9602de,null))[_0xcbfc('0x22')](respondWithResult(_0x9602de,null))[_0xcbfc('0x2b')](handleError(_0x9602de,null));};exports[_0xcbfc('0x5a')]=function(_0x5a2bf7,_0x1db049){return db[_0xcbfc('0x3d')]['create'](_0x5a2bf7[_0xcbfc('0x5b')],{})['then'](function(_0x1e8cdb){var _0x3e4f71=_0x5a2bf7['user'][_0xcbfc('0x36')]({'plain':!![]});if(!_0x3e4f71)throw new Error(_0xcbfc('0x5c'));if(_0x3e4f71[_0xcbfc('0x5d')]===_0xcbfc('0x5e')){var _0x565606=_0x1e8cdb[_0xcbfc('0x36')]({'plain':!![]});var _0x206c12=_0xcbfc('0x5f');return db[_0xcbfc('0x60')][_0xcbfc('0x59')]({'where':{'name':_0x206c12,'userProfileId':_0x3e4f71['userProfileId']},'raw':!![]})[_0xcbfc('0x22')](function(_0x330a58){if(_0x330a58&&_0x330a58[_0xcbfc('0x61')]===0x0){return db[_0xcbfc('0x37')][_0xcbfc('0x5a')]({'name':_0x565606['name'],'resourceId':_0x565606['id'],'type':_0x330a58['name'],'sectionId':_0x330a58['id']},{})[_0xcbfc('0x22')](function(){return _0x1e8cdb;});}else{return _0x1e8cdb;}})['catch'](function(_0x53f31f){logger[_0xcbfc('0x28')](_0xcbfc('0x62'),_0x53f31f);throw _0x53f31f;});}return _0x1e8cdb;})['then'](respondWithResult(_0x1db049,0xc9))[_0xcbfc('0x2b')](handleError(_0x1db049,null));};exports[_0xcbfc('0x35')]=function(_0x4e1dae,_0xc9576b){if(_0x4e1dae['body']['id']){delete _0x4e1dae[_0xcbfc('0x5b')]['id'];}return db[_0xcbfc('0x3d')]['find']({'where':{'id':_0x4e1dae[_0xcbfc('0x56')]['id']},'include':[{'model':db[_0xcbfc('0x3b')],'as':'mandatoryDispositionPause'}]})[_0xcbfc('0x22')](handleEntityNotFound(_0xc9576b,null))[_0xcbfc('0x22')](saveUpdates(_0x4e1dae[_0xcbfc('0x5b')],null))[_0xcbfc('0x22')](respondWithResult(_0xc9576b,null))[_0xcbfc('0x2b')](handleError(_0xc9576b,null));};exports[_0xcbfc('0x38')]=function(_0x537feb,_0x420a13){return db[_0xcbfc('0x3d')][_0xcbfc('0x59')]({'where':{'id':_0x537feb[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x420a13,null))[_0xcbfc('0x22')](removeEntity(_0x420a13,null))[_0xcbfc('0x2b')](handleError(_0x420a13,null));};exports[_0xcbfc('0x63')]=function(_0x5ad1c9,_0x1f09f1){return db['WhatsappAccount'][_0xcbfc('0x63')]()[_0xcbfc('0x22')](respondWithResult(_0x1f09f1,null))['catch'](handleError(_0x1f09f1,null));};exports[_0xcbfc('0x64')]=function(_0x31235a,_0x48878d,_0x21a7f8){if(_0x31235a['body']['id']){delete _0x31235a[_0xcbfc('0x5b')]['id'];}return db[_0xcbfc('0x3d')]['find']({'where':{'id':_0x31235a[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x48878d,null))['then'](function(_0x7143f9){if(_0x7143f9){_0x31235a['body']['WhatsappAccountId']=_0x7143f9['id'];return db[_0xcbfc('0x65')][_0xcbfc('0x5a')](_0x31235a[_0xcbfc('0x5b')]);}})[_0xcbfc('0x22')](respondWithResult(_0x48878d,null))[_0xcbfc('0x2b')](handleError(_0x48878d,null));};exports['getDispositions']=function(_0x5d8abd,_0x2c4918,_0x212a31){var _0x1aa45d={'raw':![],'where':{}};var _0x86fbf5={};var _0x15c9e2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcbfc('0x66')]({'where':{'id':_0x5d8abd[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x2c4918,null))[_0xcbfc('0x22')](function(_0x4fd60e){if(_0x4fd60e){_0x86fbf5[_0xcbfc('0x42')]=_['keys'](db[_0xcbfc('0x65')][_0xcbfc('0x3e')]);_0x86fbf5[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x5d8abd['query']);_0x86fbf5[_0xcbfc('0x4c')]=_[_0xcbfc('0x46')](_0x86fbf5[_0xcbfc('0x42')],_0x86fbf5[_0xcbfc('0x44')]);_0x1aa45d[_0xcbfc('0x45')]=_['intersection'](_0x86fbf5[_0xcbfc('0x42')],qs[_0xcbfc('0x47')](_0x5d8abd[_0xcbfc('0x44')][_0xcbfc('0x47')]));_0x1aa45d[_0xcbfc('0x45')]=_0x1aa45d[_0xcbfc('0x45')]['length']?_0x1aa45d[_0xcbfc('0x45')]:_0x86fbf5[_0xcbfc('0x42')];if(!_0x5d8abd[_0xcbfc('0x44')][_0xcbfc('0x67')](_0xcbfc('0x68'))){_0x1aa45d[_0xcbfc('0x48')]=qs['limit'](_0x5d8abd[_0xcbfc('0x44')][_0xcbfc('0x48')]);_0x1aa45d[_0xcbfc('0x2f')]=qs[_0xcbfc('0x2f')](_0x5d8abd['query'][_0xcbfc('0x2f')]);}_0x1aa45d[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x5d8abd[_0xcbfc('0x44')]['sort']);_0x1aa45d['where']=qs['filters'](_[_0xcbfc('0x4d')](_0x5d8abd[_0xcbfc('0x44')],_0x86fbf5['filters']));_0x1aa45d[_0xcbfc('0x4b')][_0xcbfc('0x69')]=_0x4fd60e['id'];if(_0x5d8abd[_0xcbfc('0x44')][_0xcbfc('0x50')]){_0x1aa45d['where']=_['merge'](_0x1aa45d[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3c')](_0x1aa45d[_0xcbfc('0x45')],function(_0x546c21){var _0xbc2397={};_0xbc2397[_0x546c21]={'$like':'%'+_0x5d8abd[_0xcbfc('0x44')][_0xcbfc('0x50')]+'%'};return _0xbc2397;})});}_0x1aa45d=_[_0xcbfc('0x4e')]({},_0x1aa45d,_0x5d8abd[_0xcbfc('0x51')]);return db[_0xcbfc('0x65')]['count']({'where':_0x1aa45d[_0xcbfc('0x4b')]})[_0xcbfc('0x22')](function(_0x3ffd0c){_0x15c9e2['count']=_0x3ffd0c;if(_0x5d8abd[_0xcbfc('0x44')]['includeAll']){_0x1aa45d[_0xcbfc('0x53')]=[{'all':!![]}];}return db[_0xcbfc('0x65')]['findAll'](_0x1aa45d);})[_0xcbfc('0x22')](function(_0x4a18ed){_0x15c9e2[_0xcbfc('0x6a')]=_0x4a18ed;return _0x15c9e2;});}})['then'](respondWithFilteredResult(_0x2c4918,_0x1aa45d))[_0xcbfc('0x2b')](handleError(_0x2c4918,null));};exports[_0xcbfc('0x6b')]=function(_0x121df1,_0x29aa86,_0x5b60e4){return db[_0xcbfc('0x3d')][_0xcbfc('0x59')]({'where':{'id':_0x121df1[_0xcbfc('0x56')]['id']}})['then'](handleEntityNotFound(_0x29aa86,null))[_0xcbfc('0x22')](function(_0x31ee8a){if(_0x31ee8a){return _0x31ee8a[_0xcbfc('0x6b')](_0x121df1[_0xcbfc('0x44')]['ids']);}})[_0xcbfc('0x22')](respondWithStatusCode(_0x29aa86,null))[_0xcbfc('0x2b')](handleError(_0x29aa86,null));};exports['addAnswer']=function(_0x192f5,_0x454e30,_0x30495e){if(_0x192f5[_0xcbfc('0x5b')]['id']){delete _0x192f5['body']['id'];}return db[_0xcbfc('0x3d')]['find']({'where':{'id':_0x192f5[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x454e30,null))[_0xcbfc('0x22')](function(_0x2eedda){if(_0x2eedda){_0x192f5['body'][_0xcbfc('0x69')]=_0x2eedda['id'];return db[_0xcbfc('0x6c')]['create'](_0x192f5[_0xcbfc('0x5b')]);}})['then'](respondWithResult(_0x454e30,null))[_0xcbfc('0x2b')](handleError(_0x454e30,null));};exports[_0xcbfc('0x6d')]=function(_0x2d1c19,_0x21f8a2,_0x5319c7){var _0x13a32={'raw':![],'where':{}};var _0x48778f={};var _0x36e96e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xcbfc('0x66')]({'where':{'id':_0x2d1c19[_0xcbfc('0x56')]['id']}})['then'](handleEntityNotFound(_0x21f8a2,null))['then'](function(_0x12317a){if(_0x12317a){_0x48778f[_0xcbfc('0x42')]=_[_0xcbfc('0x43')](db[_0xcbfc('0x6c')][_0xcbfc('0x3e')]);_0x48778f[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x2d1c19[_0xcbfc('0x44')]);_0x48778f[_0xcbfc('0x4c')]=_['intersection'](_0x48778f[_0xcbfc('0x42')],_0x48778f[_0xcbfc('0x44')]);_0x13a32[_0xcbfc('0x45')]=_[_0xcbfc('0x46')](_0x48778f[_0xcbfc('0x42')],qs[_0xcbfc('0x47')](_0x2d1c19[_0xcbfc('0x44')]['fields']));_0x13a32[_0xcbfc('0x45')]=_0x13a32[_0xcbfc('0x45')][_0xcbfc('0x58')]?_0x13a32[_0xcbfc('0x45')]:_0x48778f[_0xcbfc('0x42')];if(!_0x2d1c19[_0xcbfc('0x44')][_0xcbfc('0x67')](_0xcbfc('0x68'))){_0x13a32[_0xcbfc('0x48')]=qs[_0xcbfc('0x48')](_0x2d1c19[_0xcbfc('0x44')][_0xcbfc('0x48')]);_0x13a32['offset']=qs['offset'](_0x2d1c19[_0xcbfc('0x44')][_0xcbfc('0x2f')]);}_0x13a32[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x2d1c19['query'][_0xcbfc('0x4a')]);_0x13a32[_0xcbfc('0x4b')]=qs['filters'](_['pick'](_0x2d1c19['query'],_0x48778f[_0xcbfc('0x4c')]));_0x13a32[_0xcbfc('0x4b')][_0xcbfc('0x69')]=_0x12317a['id'];if(_0x2d1c19[_0xcbfc('0x44')][_0xcbfc('0x50')]){_0x13a32[_0xcbfc('0x4b')]=_[_0xcbfc('0x4e')](_0x13a32['where'],{'$or':_['map'](_0x13a32['attributes'],function(_0x2eaf6a){var _0x4f680b={};_0x4f680b[_0x2eaf6a]={'$like':'%'+_0x2d1c19[_0xcbfc('0x44')][_0xcbfc('0x50')]+'%'};return _0x4f680b;})});}_0x13a32=_[_0xcbfc('0x4e')]({},_0x13a32,_0x2d1c19[_0xcbfc('0x51')]);return db[_0xcbfc('0x6c')][_0xcbfc('0x31')]({'where':_0x13a32[_0xcbfc('0x4b')]})['then'](function(_0x45f685){_0x36e96e['count']=_0x45f685;if(_0x2d1c19[_0xcbfc('0x44')][_0xcbfc('0x52')]){_0x13a32[_0xcbfc('0x53')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x13a32);})[_0xcbfc('0x22')](function(_0x649ae8){_0x36e96e[_0xcbfc('0x6a')]=_0x649ae8;return _0x36e96e;});}})[_0xcbfc('0x22')](respondWithFilteredResult(_0x21f8a2,_0x13a32))['catch'](handleError(_0x21f8a2,null));};exports[_0xcbfc('0x6e')]=function(_0x52d8a2,_0x350dca,_0x460fe3){return db['WhatsappAccount']['find']({'where':{'id':_0x52d8a2[_0xcbfc('0x56')]['id']}})['then'](handleEntityNotFound(_0x350dca,null))[_0xcbfc('0x22')](function(_0x3a13c0){if(_0x3a13c0){return _0x3a13c0[_0xcbfc('0x6e')](_0x52d8a2['query'][_0xcbfc('0x6f')]);}})[_0xcbfc('0x22')](respondWithStatusCode(_0x350dca,null))[_0xcbfc('0x2b')](handleError(_0x350dca,null));};exports[_0xcbfc('0x70')]=function(_0x5cc1ef,_0x13329a,_0x21fefc){return db['WhatsappAccount']['find']({'where':{'id':_0x5cc1ef[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x13329a,null))[_0xcbfc('0x22')](function(_0x488cbc){if(_0x488cbc){return _0x488cbc[_0xcbfc('0x70')](_0x5cc1ef['body']['ids'],_[_0xcbfc('0x71')](_0x5cc1ef[_0xcbfc('0x5b')],['ids','id'])||{})[_0xcbfc('0x72')](function(_0x411dec){for(var _0x14d804=0x0;_0x14d804<_0x5cc1ef[_0xcbfc('0x5b')][_0xcbfc('0x6f')][_0xcbfc('0x58')];_0x14d804+=0x1){socket[_0xcbfc('0x73')](_0xcbfc('0x74'),{'UserId':Number(_0x5cc1ef['body'][_0xcbfc('0x6f')][_0x14d804]),'WhatsappAccountId':Number(_0x5cc1ef['params']['id'])});}return _0x411dec;});}})[_0xcbfc('0x22')](respondWithResult(_0x13329a,null))['catch'](handleError(_0x13329a,null));};exports[_0xcbfc('0x75')]=function(_0x436282,_0x31e540,_0x1be420){return db[_0xcbfc('0x3d')][_0xcbfc('0x59')]({'where':{'id':_0x436282['params']['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x31e540,null))['then'](function(_0x254909){if(_0x254909){return _0x254909[_0xcbfc('0x75')](_0x436282['query'][_0xcbfc('0x6f')])[_0xcbfc('0x22')](function(){if(_[_0xcbfc('0x76')](_0x436282['query']['ids'])){for(var _0x433181=0x0;_0x433181<_0x436282['query'][_0xcbfc('0x6f')][_0xcbfc('0x58')];_0x433181+=0x1){socket[_0xcbfc('0x73')](_0xcbfc('0x77'),{'UserId':Number(_0x436282[_0xcbfc('0x44')]['ids'][_0x433181]),'WhatsappAccountId':Number(_0x436282[_0xcbfc('0x56')]['id'])});}}else{socket[_0xcbfc('0x73')](_0xcbfc('0x77'),{'UserId':Number(_0x436282[_0xcbfc('0x44')]['ids']),'WhatsappAccountId':Number(_0x436282[_0xcbfc('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x31e540,null))[_0xcbfc('0x2b')](handleError(_0x31e540,null));};exports[_0xcbfc('0x78')]=function(_0x2b6d5b,_0x35bac6,_0xea05cc){var _0x14cfb9={};var _0x563d59={};var _0x35d1bc;var _0x2f0bd7;return db[_0xcbfc('0x3d')][_0xcbfc('0x66')]({'where':{'id':_0x2b6d5b[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x35bac6,null))['then'](function(_0x184f1a){if(_0x184f1a){_0x35d1bc=_0x184f1a;_0x563d59['model']=_[_0xcbfc('0x43')](db[_0xcbfc('0x79')][_0xcbfc('0x3e')]);_0x563d59[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x2b6d5b[_0xcbfc('0x44')]);_0x563d59[_0xcbfc('0x4c')]=_[_0xcbfc('0x46')](_0x563d59[_0xcbfc('0x42')],_0x563d59[_0xcbfc('0x44')]);_0x14cfb9[_0xcbfc('0x45')]=_[_0xcbfc('0x46')](_0x563d59[_0xcbfc('0x42')],qs[_0xcbfc('0x47')](_0x2b6d5b['query'][_0xcbfc('0x47')]));_0x14cfb9['attributes']=_0x14cfb9['attributes'][_0xcbfc('0x58')]?_0x14cfb9[_0xcbfc('0x45')]:_0x563d59['model'];_0x14cfb9[_0xcbfc('0x49')]=qs[_0xcbfc('0x4a')](_0x2b6d5b[_0xcbfc('0x44')]['sort']);_0x14cfb9[_0xcbfc('0x4b')]=qs[_0xcbfc('0x4c')](_[_0xcbfc('0x4d')](_0x2b6d5b[_0xcbfc('0x44')],_0x563d59['filters']));if(_0x2b6d5b['query'][_0xcbfc('0x50')]){_0x14cfb9[_0xcbfc('0x4b')]=_[_0xcbfc('0x4e')](_0x14cfb9[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3c')](_0x14cfb9['attributes'],function(_0x24f8d7){var _0x1ac86f={};_0x1ac86f[_0x24f8d7]={'$like':'%'+_0x2b6d5b['query'][_0xcbfc('0x50')]+'%'};return _0x1ac86f;})});}_0x14cfb9=_[_0xcbfc('0x4e')]({},_0x14cfb9,_0x2b6d5b[_0xcbfc('0x51')]);return _0x35d1bc['getAgents'](_0x14cfb9);}})[_0xcbfc('0x22')](function(_0xa156d7){if(_0xa156d7){_0x2f0bd7=_0xa156d7[_0xcbfc('0x58')];if(!_0x2b6d5b[_0xcbfc('0x44')]['hasOwnProperty'](_0xcbfc('0x68'))){_0x14cfb9[_0xcbfc('0x48')]=qs['limit'](_0x2b6d5b[_0xcbfc('0x44')]['limit']);_0x14cfb9['offset']=qs[_0xcbfc('0x2f')](_0x2b6d5b[_0xcbfc('0x44')][_0xcbfc('0x2f')]);}return _0x35d1bc[_0xcbfc('0x78')](_0x14cfb9);}})[_0xcbfc('0x22')](function(_0x39710b){if(_0x39710b){return _0x39710b?{'count':_0x2f0bd7,'rows':_0x39710b}:null;}})[_0xcbfc('0x22')](respondWithResult(_0x35bac6,null))[_0xcbfc('0x2b')](handleError(_0x35bac6,null));};exports[_0xcbfc('0x7a')]=function(_0x13de23,_0x306d8c){var _0x55fe16=_0x13de23[_0xcbfc('0x56')]['id'];var _0x5a6068=_0x13de23[_0xcbfc('0x5b')];var _0xcbce99=0xc8;var _0x737ace=null;return db[_0xcbfc('0x7b')][_0xcbfc('0x7c')]({'isolationLevel':db['sequelize'][_0xcbfc('0x7d')][_0xcbfc('0x7e')]['READ_COMMITTED']},function(_0x207041){return db['WhatsappAccount'][_0xcbfc('0x66')]({'where':{'id':_0x55fe16},'transaction':_0x207041})[_0xcbfc('0x22')](function(_0x43778b){if(_0x43778b){return db['WhatsappApplication'][_0xcbfc('0x38')]({'where':{'WhatsappAccountId':_0x55fe16},'transaction':_0x207041})[_0xcbfc('0x22')](function(){var _0x4d436d=_[_0xcbfc('0x3c')](_0x5a6068,function(_0x229689){_0x229689['WhatsappAccountId']=_0x55fe16;return _0x229689;});return db[_0xcbfc('0x7f')]['bulkCreate'](_0x4d436d,{'transaction':_0x207041});});}else{_0xcbce99=0x194;_0x737ace=[];}});})[_0xcbfc('0x22')](function(){if(_0xcbce99!==0x194){return db[_0xcbfc('0x7f')][_0xcbfc('0x80')]({'where':{'WhatsappAccountId':_0x55fe16},'order':_0xcbfc('0x81')})['then'](function(_0x3555f4){_0x737ace=_0x3555f4;});}})[_0xcbfc('0x2b')](function(_0x91a689){_0xcbce99=0x1f4;logger['error'](_0x91a689[_0xcbfc('0x82')]);if(_0x91a689[_0xcbfc('0x4f')]){delete _0x91a689['name'];}_0x737ace=_0x91a689;})[_0xcbfc('0x83')](function(){if(_0x737ace===null){_0x306d8c[_0xcbfc('0x39')](_0xcbce99);}else{if(_0xcbce99===0x1f4){_0x306d8c[_0xcbfc('0x2c')](_0xcbce99)[_0xcbfc('0x84')](_0x737ace);}else{_0x306d8c[_0xcbfc('0x2c')](_0xcbce99)['json'](_0x737ace);}}});};exports[_0xcbfc('0x85')]=function(_0x358e53,_0x256ff6,_0x75cad3){var _0x2f0ed9={};var _0x5babc7={};var _0xb00b4a;var _0x174de5;return db[_0xcbfc('0x3d')][_0xcbfc('0x66')]({'where':{'id':_0x358e53[_0xcbfc('0x56')]['id']}})[_0xcbfc('0x22')](handleEntityNotFound(_0x256ff6,null))[_0xcbfc('0x22')](function(_0x5ca7c7){if(_0x5ca7c7){_0xb00b4a=_0x5ca7c7;_0x5babc7[_0xcbfc('0x42')]=_[_0xcbfc('0x43')](db['WhatsappApplication'][_0xcbfc('0x3e')]);_0x5babc7[_0xcbfc('0x44')]=_[_0xcbfc('0x43')](_0x358e53[_0xcbfc('0x44')]);_0x5babc7['filters']=_['intersection'](_0x5babc7[_0xcbfc('0x42')],_0x5babc7[_0xcbfc('0x44')]);_0x2f0ed9[_0xcbfc('0x45')]=_['intersection'](_0x5babc7['model'],qs[_0xcbfc('0x47')](_0x358e53[_0xcbfc('0x44')]['fields']));_0x2f0ed9['attributes']=_0x2f0ed9[_0xcbfc('0x45')][_0xcbfc('0x58')]?_0x2f0ed9['attributes']:_0x5babc7[_0xcbfc('0x42')];_0x2f0ed9['order']=qs[_0xcbfc('0x4a')](_0x358e53['query'][_0xcbfc('0x4a')]);_0x2f0ed9['where']=qs[_0xcbfc('0x4c')](_['pick'](_0x358e53[_0xcbfc('0x44')],_0x5babc7[_0xcbfc('0x4c')]));if(_0x358e53['query'][_0xcbfc('0x50')]){_0x2f0ed9[_0xcbfc('0x4b')]=_[_0xcbfc('0x4e')](_0x2f0ed9[_0xcbfc('0x4b')],{'$or':_[_0xcbfc('0x3c')](_0x2f0ed9['attributes'],function(_0x539dbd){var _0x311950={};_0x311950[_0x539dbd]={'$like':'%'+_0x358e53[_0xcbfc('0x44')][_0xcbfc('0x50')]+'%'};return _0x311950;})});}_0x2f0ed9=_[_0xcbfc('0x4e')]({},_0x2f0ed9,_0x358e53[_0xcbfc('0x51')]);return _0xb00b4a[_0xcbfc('0x85')](_0x2f0ed9);}})[_0xcbfc('0x22')](function(_0x287d4b){if(_0x287d4b){_0x174de5=_0x287d4b[_0xcbfc('0x58')];if(!_0x358e53[_0xcbfc('0x44')]['hasOwnProperty']('nolimit')){_0x2f0ed9['limit']=qs['limit'](_0x358e53[_0xcbfc('0x44')]['limit']);_0x2f0ed9[_0xcbfc('0x2f')]=qs[_0xcbfc('0x2f')](_0x358e53['query'][_0xcbfc('0x2f')]);}return _0xb00b4a['getApplications'](_0x2f0ed9);}})['then'](function(_0x439911){if(_0x439911){return _0x439911?{'count':_0x174de5,'rows':_0x439911}:null;}})['then'](respondWithResult(_0x256ff6,null))[_0xcbfc('0x2b')](handleError(_0x256ff6,null));};exports['notify']=function(_0x2d8f3f,_0x2388e2,_0x2079ec){var _0x240e74={'channel':_0xcbfc('0x86')};var _0x5a93a9=[];var _0x48cc13=[];var _0x54421d={};return db[_0xcbfc('0x3d')][_0xcbfc('0x59')]({'where':{'id':_0x2d8f3f[_0xcbfc('0x56')]['id']},'include':[{'model':db[_0xcbfc('0x7f')],'as':_0xcbfc('0x87')}]})[_0xcbfc('0x22')](handleEntityNotFound(_0x2388e2,null))['then'](function(_0x4582c8){_0x240e74[_0xcbfc('0x88')]=_0x4582c8;if(_0x240e74['account']&&_0x240e74[_0xcbfc('0x88')][_0xcbfc('0x40')]===_0xcbfc('0x89')&&_0x2d8f3f['body'][_0xcbfc('0x8a')]){if(_0x2d8f3f[_0xcbfc('0x5b')][_0xcbfc('0x8a')]['length']===0x0)return;if(_0x2d8f3f['body'][_0xcbfc('0x8a')][0x0]['state']!==_0xcbfc('0x8b'))return;return db[_0xcbfc('0x8c')][_0xcbfc('0x35')]({'read':!![],'readAt':_0x2d8f3f[_0xcbfc('0x5b')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x2d8f3f[_0xcbfc('0x5b')][_0xcbfc('0x8a')][0x0][_0xcbfc('0x8d')]},'individualHooks':!![]})[_0xcbfc('0x22')](function(_0x3f2d04){return _0x2388e2[_0xcbfc('0x2c')](0xc8)[_0xcbfc('0x2e')](_0x3f2d04);});}_0x240e74['applications']=_[_0xcbfc('0x8e')](_0x4582c8[_0xcbfc('0x87')],[_0xcbfc('0x81')],[_0xcbfc('0x8f')]);if(_0x240e74['account'][_0xcbfc('0x87')]){delete _0x240e74[_0xcbfc('0x88')][_0xcbfc('0x87')];}return db[_0xcbfc('0x90')]['describe']()[_0xcbfc('0x22')](function(_0x2c8baa){if(!_0x2c8baa){throw new db[(_0xcbfc('0x91'))]['ValidationError'](_0xcbfc('0x92'));}_0x5a93a9=_[_0xcbfc('0x93')](_['keys'](_0x2c8baa),[_0xcbfc('0x94'),_0xcbfc('0x95')]);_0x48cc13=_['difference'](_[_0xcbfc('0x43')](_0x2c8baa),[_0xcbfc('0x94'),_0xcbfc('0x95'),_0xcbfc('0x96'),'ListId']);_0x240e74['body']={'mapKey':_0xcbfc('0x97')};if(_0x240e74[_0xcbfc('0x88')]&&_0x240e74[_0xcbfc('0x88')][_0xcbfc('0x40')]===_0xcbfc('0x98')){_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x99')]=_0x2d8f3f[_0xcbfc('0x5b')][_0xcbfc('0x9a')][_0xcbfc('0x9b')]('whatsapp:','');_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x5b')]=_0x2d8f3f['body'][_0xcbfc('0x9c')];_0x240e74['body']['messageId']=_0x2d8f3f['body'][_0xcbfc('0x9d')];}if(_0x240e74[_0xcbfc('0x88')]&&_0x240e74['account'][_0xcbfc('0x40')]===_0xcbfc('0x89')){_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x99')]=_0x2d8f3f[_0xcbfc('0x5b')]['notifications'][0x0][_0xcbfc('0x99')];_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x5b')]=_0x2d8f3f[_0xcbfc('0x5b')][_0xcbfc('0x9e')][0x0][_0xcbfc('0x2a')][_0xcbfc('0x5b')];_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x9f')]=_0x2d8f3f[_0xcbfc('0x5b')][_0xcbfc('0x9e')][0x0][_0xcbfc('0x8d')];}if(_0x240e74[_0xcbfc('0x5b')]['id']){delete _0x240e74['body']['id'];}if(_['isNil'](_0x240e74['body'][_0xcbfc('0x99')])){throw new db[(_0xcbfc('0x91'))][(_0xcbfc('0xa0'))](_0xcbfc('0xa1'));}if(_[_0xcbfc('0xa2')](_0x240e74['body']['body'])||_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x5b')]===''){throw new db[(_0xcbfc('0x91'))][(_0xcbfc('0xa0'))](_0xcbfc('0xa3'));}if(_['isNil'](_0x240e74['body'][_0xcbfc('0xa4')])){throw new db['Sequelize'][(_0xcbfc('0xa0'))](_0xcbfc('0xa5')+_0x48cc13);}if(!_[_0xcbfc('0xa6')](_0x48cc13,_0x240e74[_0xcbfc('0x5b')]['mapKey'])){throw new db[(_0xcbfc('0x91'))][(_0xcbfc('0xa0'))](_0xcbfc('0xa7')+_0x48cc13);}_0x54421d[_0x240e74['body'][_0xcbfc('0xa4')]]=_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x99')];return db[_0xcbfc('0xa8')][_0xcbfc('0x59')]({'where':{'id':_0x240e74['account'][_0xcbfc('0xa9')]},'include':[{'model':db['CmContact'],'as':_0xcbfc('0xaa'),'where':_0x54421d,'limit':0x1,'order':[[_0xcbfc('0x95'),_0xcbfc('0xab')]]}]});})[_0xcbfc('0x22')](handleEntityNotFound(_0x2388e2,null))[_0xcbfc('0x22')](function(_0x4f6e39){if(_0x4f6e39){_0x240e74['list']=_[_0xcbfc('0x71')](_0x4f6e39,[_0xcbfc('0xaa')]);if(_0x4f6e39[_0xcbfc('0xaa')][_0xcbfc('0x58')]){return _0x4f6e39[_0xcbfc('0xaa')][0x0];}var _0x373431=_['defaults'](_0x240e74[_0xcbfc('0x5b')],{'firstName':_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x99')],'ListId':_0x4f6e39['id']});_0x373431[_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0xa4')]]=_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0x99')];return db[_0xcbfc('0x90')][_0xcbfc('0x5a')](_0x373431,{'fields':_0x5a93a9,'raw':!![]});}})[_0xcbfc('0x22')](handleEntityNotFound(_0x2388e2,null))[_0xcbfc('0x22')](function(_0x763858){if(_0x763858){_0x240e74[_0xcbfc('0xac')]=_0x763858;var _0x48de1f={'ContactId':_0x763858['id'],'phone':_0x240e74['body'][_0xcbfc('0x99')],'WhatsappAccountId':_0x2d8f3f['params']['id']};var _0x30de1c={'ContactId':_0x763858['id'],'WhatsappAccountId':_0x2d8f3f[_0xcbfc('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xcbfc('0x59')]({'where':_0x30de1c})[_0xcbfc('0x22')](function(_0x1413d5){if(_0x1413d5){return[_0x1413d5,![]];}return db['WhatsappInteraction'][_0xcbfc('0x5a')](_0x48de1f)[_0xcbfc('0x22')](function(_0x364812){return[_0x364812,!![]];});});}})[_0xcbfc('0x72')](function(_0xdda102,_0x505985){_0x240e74[_0xcbfc('0xad')]=_0xdda102['get']({'plain':!![]});_0x240e74['interaction'][_0xcbfc('0xae')]=![];if(_0x505985){if(_0x240e74['account'][_0xcbfc('0xaf')]){_0x240e74['applications'][_0xcbfc('0xb0')]({'id':0x0,'priority':_0x240e74[_0xcbfc('0xb1')][_0xcbfc('0x58')]+0x1,'app':'close','appdata':_0xcbfc('0xb2'),'interval':'*,*,*,*'});}_0x240e74[_0xcbfc('0xad')][_0xcbfc('0xae')]=!![];}return db[_0xcbfc('0x8c')]['create']({'phone':_0x240e74[_0xcbfc('0x5b')]['from'],'messageId':_0x240e74['body']['messageId'],'body':_0x240e74['body'][_0xcbfc('0x5b')],'WhatsappAccountId':_0x2d8f3f['params']['id'],'WhatsappInteractionId':_0xdda102['id'],'direction':'in','ContactId':_0xdda102[_0xcbfc('0xb3')],'AttachmentId':_0x240e74[_0xcbfc('0x5b')][_0xcbfc('0xb4')]});})['then'](function(_0x41175c){_0x240e74[_0xcbfc('0x2a')]=_0x41175c;if(!_0x240e74[_0xcbfc('0xad')][_0xcbfc('0xb5')])return;return db[_0xcbfc('0x79')][_0xcbfc('0x59')]({'attributes':['id',_0xcbfc('0x4f')],'where':{'id':_0x240e74[_0xcbfc('0xad')][_0xcbfc('0xb5')]}});})[_0xcbfc('0x22')](function(_0x285ec7){if(_0x285ec7){_0x240e74[_0xcbfc('0xb1')][_0xcbfc('0xb6')]({'id':0x0,'priority':0x0,'app':_0xcbfc('0xb7'),'appdata':_0x285ec7[_0xcbfc('0x4f')]+','+(_0x240e74[_0xcbfc('0x88')][_0xcbfc('0xb8')]||0xa),'interval':_0xcbfc('0xb9')});}if(!_0x240e74[_0xcbfc('0xad')][_0xcbfc('0xba')])return;return db[_0xcbfc('0xbb')]['find']({'attributes':['id',_0xcbfc('0x4f')],'where':{'id':_0x240e74['interaction'][_0xcbfc('0xba')]}});})[_0xcbfc('0x22')](function(_0x1ea6a7){if(_0x1ea6a7){_0x240e74['applications'][_0xcbfc('0xb6')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1ea6a7['name']+','+(_0x240e74[_0xcbfc('0x88')][_0xcbfc('0xbc')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcbfc('0xbd'),'startRouting',_0x240e74);})[_0xcbfc('0x22')](function(_0x3204a9){if(_0x3204a9){var _0x3b784a=0xc8;var _0x303d51='receiveMessage';logger[_0xcbfc('0x23')](_0xcbfc('0x26'),_0x303d51,_0x3b784a,_0xcbfc('0xbe'));logger[_0xcbfc('0x25')](_0xcbfc('0xbf'),_0x303d51,_0x3b784a,_0xcbfc('0xbe'),JSON[_0xcbfc('0x27')](_0x3204a9));if(_0x240e74[_0xcbfc('0x88')][_0xcbfc('0x40')]===_0xcbfc('0x98')){return _0x2388e2[_0xcbfc('0x2c')](_0x3b784a)[_0xcbfc('0x32')](_0xcbfc('0xc0'),_0xcbfc('0xc1'))[_0xcbfc('0x84')](_0xcbfc('0xc2'));}else{return _0x2388e2[_0xcbfc('0x2c')](_0x3b784a)[_0xcbfc('0x2e')](_0x3204a9);}}});})[_0xcbfc('0x2b')](handleError(_0x2388e2,null));};exports['send']=function(_0x3e5850,_0x58b0a4,_0x16ae8a){var _0x121b8a,_0x2aa0b1,_0x5bc38c;if(_['isNil'](_0x3e5850[_0xcbfc('0x5b')][_0xcbfc('0x5b')])||_0x3e5850[_0xcbfc('0x5b')][_0xcbfc('0x5b')]===''){throw new db['Sequelize']['ValidationError'](_0xcbfc('0xa3'));}if(_[_0xcbfc('0xa2')](_0x3e5850[_0xcbfc('0x5b')]['to'])){throw new db['Sequelize'][(_0xcbfc('0xa0'))](_0xcbfc('0xc3'));}_0x121b8a=_0x3e5850[_0xcbfc('0x5b')]['to'];return db[_0xcbfc('0x3d')][_0xcbfc('0x59')]({'where':{'id':_0x3e5850[_0xcbfc('0x56')]['id']},'include':[{'model':db[_0xcbfc('0xa8')],'as':_0xcbfc('0xc4'),'include':[{'model':db[_0xcbfc('0x90')],'as':'Contacts','where':{'mobile':_0x121b8a},'limit':0x1,'order':[[_0xcbfc('0x95'),_0xcbfc('0xab')]]}]}]})[_0xcbfc('0x22')](handleEntityNotFound(_0x58b0a4,null))[_0xcbfc('0x22')](function(_0x58cd26){if(_0x58cd26&&_0x58cd26[_0xcbfc('0xc4')]){_0x2aa0b1=_0x58cd26[_0xcbfc('0x36')]({'plain':!![]});if(_0x2aa0b1[_0xcbfc('0xc4')]&&_0x2aa0b1[_0xcbfc('0xc4')][_0xcbfc('0xaa')]['length']){return _0x2aa0b1[_0xcbfc('0xc4')][_0xcbfc('0xaa')][0x0];}return db[_0xcbfc('0x90')][_0xcbfc('0x5a')](_[_0xcbfc('0x19')](_0x3e5850[_0xcbfc('0x5b')],{'firstName':_0x121b8a,'mobile':_0x121b8a,'phone':_0x121b8a,'ListId':_0x2aa0b1['ListId']}));}})[_0xcbfc('0x22')](handleEntityNotFound(_0x58b0a4,null))[_0xcbfc('0x22')](function(_0x140758){if(_0x140758){_0x5bc38c=_0x140758;return db[_0xcbfc('0xc5')][_0xcbfc('0x59')]({'where':{'ContactId':_0x5bc38c['id'],'closed':![],'WhatsappAccountId':_0x2aa0b1['id']}})[_0xcbfc('0x22')](function(_0xe4974d){if(_0xe4974d){return[_0xe4974d,![]];}return db['WhatsappInteraction'][_0xcbfc('0x5a')]({'UserId':_0x3e5850[_0xcbfc('0x5e')]['id'],'ContactId':_0x5bc38c['id'],'WhatsappAccountId':_0x2aa0b1['id'],'phone':_0x121b8a,'firstMsgDirection':_0xcbfc('0xc6'),'Messages':[_[_0xcbfc('0x4e')](_0x3e5850[_0xcbfc('0x5b')],{'read':![],'body':_0x3e5850[_0xcbfc('0x5b')]['body'],'phone':_0x121b8a,'WhatsappAccountId':_0x2aa0b1['id'],'UserId':_0x3e5850['user']['id'],'ContactId':_0x5bc38c['id']})]},{'include':[{'model':db[_0xcbfc('0x8c')],'as':_0xcbfc('0xc7')}]})[_0xcbfc('0x22')](function(_0x38409b){return[_0x38409b,!![]];});});}})[_0xcbfc('0x72')](function(_0x5b8793,_0x101d08){if(_0x101d08){return _0x5b8793;}return db[_0xcbfc('0x8c')][_0xcbfc('0x5a')](_[_0xcbfc('0x4e')](_0x3e5850[_0xcbfc('0x5b')],{'read':![],'body':_0x3e5850[_0xcbfc('0x5b')][_0xcbfc('0x5b')],'phone':_0x121b8a,'WhatsappAccountId':_0x2aa0b1['id'],'WhatsappInteractionId':_0x5b8793['id'],'UserId':_0x3e5850[_0xcbfc('0x5e')]['id'],'ContactId':_0x5bc38c['id']}))[_0xcbfc('0x22')](function(_0x405d88){_0x5b8793[_0xcbfc('0xc8')][_0xcbfc('0xc7')]=[];_0x5b8793[_0xcbfc('0xc8')][_0xcbfc('0xc7')][_0xcbfc('0xb0')](_0x405d88[_0xcbfc('0xc8')]);return _0x5b8793;});})[_0xcbfc('0x22')](respondWithResult(_0x58b0a4,null))[_0xcbfc('0x2b')](handleError(_0x58b0a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index e779e7a..48d66b0 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 _0x5af3=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','update','emit'];(function(_0x2fb3b2,_0x365db0){var _0x33eedb=function(_0x535772){while(--_0x535772){_0x2fb3b2['push'](_0x2fb3b2['shift']());}};_0x33eedb(++_0x365db0);}(_0x5af3,0xc9));var _0x35af=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x5af3[_0x1992f1];return _0x413dfe;};'use strict';var EventEmitter=require(_0x35af('0x0'));var WhatsappAccount=require(_0x35af('0x1'))['db'][_0x35af('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x35af('0x3'),'afterUpdate':_0x35af('0x4'),'afterDestroy':'remove'};function emitEvent(_0x36383f){return function(_0x538c9,_0x4901b0,_0x24ad28){WhatsappAccountEvents[_0x35af('0x5')](_0x36383f+':'+_0x538c9['id'],_0x538c9);WhatsappAccountEvents[_0x35af('0x5')](_0x36383f,_0x538c9);_0x24ad28(null);};}for(var e in events){if(events[_0x35af('0x6')](e)){var event=events[e];WhatsappAccount[_0x35af('0x7')](e,emitEvent(event));}}module[_0x35af('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x0f2d=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x0f2d,0x17d));var _0xd0f2=function(_0x398b23,_0xe3dd9){_0x398b23=_0x398b23-0x0;var _0x319672=_0x0f2d[_0x398b23];return _0x319672;};'use strict';var EventEmitter=require(_0xd0f2('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xd0f2('0x1')](0x0);var events={'afterCreate':_0xd0f2('0x2'),'afterUpdate':_0xd0f2('0x3'),'afterDestroy':_0xd0f2('0x4')};function emitEvent(_0x29d0a2){return function(_0x4847e7,_0x399e74,_0x5332d5){WhatsappAccountEvents[_0xd0f2('0x5')](_0x29d0a2+':'+_0x4847e7['id'],_0x4847e7);WhatsappAccountEvents['emit'](_0x29d0a2,_0x4847e7);_0x5332d5(null);};}for(var e in events){if(events[_0xd0f2('0x6')](e)){var event=events[e];WhatsappAccount[_0xd0f2('0x7')](e,emitEvent(event));}}module[_0xd0f2('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e3db933..663e767 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 _0x8e6e=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','whatsapp_accounts','lodash','util'];(function(_0x5c88b5,_0x3895af){var _0x3ae2d7=function(_0x1ecb22){while(--_0x1ecb22){_0x5c88b5['push'](_0x5c88b5['shift']());}};_0x3ae2d7(++_0x3895af);}(_0x8e6e,0x1d2));var _0xe8e6=function(_0x12ceba,_0x59ba15){_0x12ceba=_0x12ceba-0x0;var _0x36c243=_0x8e6e[_0x12ceba];return _0x36c243;};'use strict';var _=require(_0xe8e6('0x0'));var util=require(_0xe8e6('0x1'));var logger=require(_0xe8e6('0x2'))(_0xe8e6('0x3'));var moment=require(_0xe8e6('0x4'));var BPromise=require(_0xe8e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8e6('0x6'));var rimraf=require(_0xe8e6('0x7'));var config=require(_0xe8e6('0x8'));var attributes=require('./whatsappAccount.attributes');module[_0xe8e6('0x9')]=function(_0x226519,_0x5e3a4f){return _0x226519[_0xe8e6('0xa')]('WhatsappAccount',attributes,{'tableName':_0xe8e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb283=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','request-promise','path'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb283,0xd2));var _0x3b28=function(_0xf90bad,_0x2b272a){_0xf90bad=_0xf90bad-0x0;var _0x2deef0=_0xb283[_0xf90bad];return _0x2deef0;};'use strict';var _=require(_0x3b28('0x0'));var util=require(_0x3b28('0x1'));var logger=require('../../config/logger')(_0x3b28('0x2'));var moment=require(_0x3b28('0x3'));var BPromise=require('bluebird');var rp=require(_0x3b28('0x4'));var fs=require('fs');var path=require(_0x3b28('0x5'));var rimraf=require('rimraf');var config=require(_0x3b28('0x6'));var attributes=require(_0x3b28('0x7'));module[_0x3b28('0x8')]=function(_0x26f1c8,_0x2b1543){return _0x26f1c8[_0x3b28('0x9')](_0x3b28('0xa'),attributes,{'tableName':_0x3b28('0xb'),'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 e7743a1..12c19cc 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 _0xf45d=['message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','lodash','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error'];(function(_0x18c657,_0x194edc){var _0x161361=function(_0x4d1cfd){while(--_0x4d1cfd){_0x18c657['push'](_0x18c657['shift']());}};_0x161361(++_0x194edc);}(_0xf45d,0x151));var _0xdf45=function(_0x44ccfa,_0x1951b4){_0x44ccfa=_0x44ccfa-0x0;var _0x1d5f5=_0xf45d[_0x44ccfa];return _0x1d5f5;};'use strict';var _=require(_0xdf45('0x0'));var util=require(_0xdf45('0x1'));var moment=require('moment');var BPromise=require(_0xdf45('0x2'));var rs=require(_0xdf45('0x3'));var fs=require('fs');var Redis=require(_0xdf45('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdf45('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdf45('0x6'));var client=jayson[_0xdf45('0x7')][_0xdf45('0x8')]({'port':0x232a});config[_0xdf45('0x9')]=_[_0xdf45('0xa')](config[_0xdf45('0x9')],{'host':_0xdf45('0xb'),'port':0x18eb});var socket=require(_0xdf45('0xc'))(new Redis(config[_0xdf45('0x9')]));require('./whatsappAccount.socket')[_0xdf45('0xd')](socket);function respondWithRpcPromise(_0x26b792,_0x70a87,_0x562b2b){return new BPromise(function(_0x10b9cc,_0x4b5ead){return client['request'](_0x26b792,_0x562b2b)[_0xdf45('0xe')](function(_0x3ebf00){logger[_0xdf45('0xf')](_0xdf45('0x10'),_0x70a87,'request\x20sent');logger[_0xdf45('0x11')](_0xdf45('0x12'),_0x70a87,_0xdf45('0x13'),JSON[_0xdf45('0x14')](_0x3ebf00));if(_0x3ebf00['error']){if(_0x3ebf00['error'][_0xdf45('0x15')]===0x1f4){logger[_0xdf45('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x70a87,_0x3ebf00[_0xdf45('0x16')][_0xdf45('0x17')]);return _0x4b5ead(_0x3ebf00[_0xdf45('0x16')][_0xdf45('0x17')]);}logger[_0xdf45('0x16')](_0xdf45('0x10'),_0x70a87,_0x3ebf00[_0xdf45('0x16')][_0xdf45('0x17')]);return _0x10b9cc(_0x3ebf00[_0xdf45('0x16')][_0xdf45('0x17')]);}else{logger[_0xdf45('0xf')](_0xdf45('0x10'),_0x70a87,'request\x20sent');_0x10b9cc(_0x3ebf00[_0xdf45('0x18')][_0xdf45('0x17')]);}})[_0xdf45('0x19')](function(_0x198b8c){logger['error'](_0xdf45('0x10'),_0x70a87,_0x198b8c);_0x4b5ead(_0x198b8c);});});}exports[_0xdf45('0x1a')]=function(_0xdd509e){var _0x87fe25=this;return new Promise(function(_0x4a5a9d,_0x435adb){return db[_0xdf45('0x1b')][_0xdf45('0x1c')]({'raw':_0xdd509e[_0xdf45('0x1d')]?_0xdd509e[_0xdf45('0x1d')][_0xdf45('0x1e')]===undefined?!![]:![]:!![],'where':_0xdd509e[_0xdf45('0x1d')]?_0xdd509e[_0xdf45('0x1d')][_0xdf45('0x1f')]||null:null,'attributes':_0xdd509e[_0xdf45('0x1d')]?_0xdd509e[_0xdf45('0x1d')][_0xdf45('0x20')]||null:null,'include':_0xdd509e['options']?_0xdd509e[_0xdf45('0x1d')][_0xdf45('0x21')]?_['map'](_0xdd509e[_0xdf45('0x1d')][_0xdf45('0x21')],function(_0x596332){return{'model':db[_0x596332[_0xdf45('0x22')]],'as':_0x596332['as'],'attributes':_0x596332[_0xdf45('0x20')],'include':_0x596332['include']?_[_0xdf45('0x23')](_0x596332[_0xdf45('0x21')],function(_0x1df890){return{'model':db[_0x1df890[_0xdf45('0x22')]],'as':_0x1df890['as'],'attributes':_0x1df890[_0xdf45('0x20')],'include':_0x1df890[_0xdf45('0x21')]?_[_0xdf45('0x23')](_0x1df890[_0xdf45('0x21')],function(_0x489687){return{'model':db[_0x489687['model']],'as':_0x489687['as'],'attributes':_0x489687['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x251497){logger[_0xdf45('0xf')]('ShowWhatsappAccount',_0xdd509e);logger['debug'](_0xdf45('0x1a'),_0xdd509e,JSON[_0xdf45('0x14')](_0x251497));_0x4a5a9d(_0x251497);})[_0xdf45('0x19')](function(_0x51302f){logger[_0xdf45('0x16')](_0xdf45('0x1a'),_0x51302f[_0xdf45('0x17')],_0xdd509e);_0x435adb(_0x87fe25[_0xdf45('0x16')](0x1f4,_0x51302f[_0xdf45('0x17')]));});});}; \ No newline at end of file +var _0x9209=['result','ShowWhatsappAccount','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0x9209,0x1ba));var _0x9920=function(_0xfcb2,_0x5ef656){_0xfcb2=_0xfcb2-0x0;var _0x436b21=_0x9209[_0xfcb2];return _0x436b21;};'use strict';var _=require(_0x9920('0x0'));var util=require(_0x9920('0x1'));var moment=require(_0x9920('0x2'));var BPromise=require(_0x9920('0x3'));var rs=require(_0x9920('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9920('0x5'));var logger=require(_0x9920('0x6'))(_0x9920('0x7'));var config=require(_0x9920('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9920('0x9')][_0x9920('0xa')]({'port':0x232a});config[_0x9920('0xb')]=_[_0x9920('0xc')](config[_0x9920('0xb')],{'host':_0x9920('0xd'),'port':0x18eb});var socket=require(_0x9920('0xe'))(new Redis(config[_0x9920('0xb')]));require(_0x9920('0xf'))[_0x9920('0x10')](socket);function respondWithRpcPromise(_0x5dc7af,_0x27463b,_0x1b1528){return new BPromise(function(_0x1f7a17,_0x19babc){return client[_0x9920('0x11')](_0x5dc7af,_0x1b1528)[_0x9920('0x12')](function(_0x569e1c){logger[_0x9920('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x27463b,'request\x20sent');logger[_0x9920('0x14')](_0x9920('0x15'),_0x27463b,'request\x20sent',JSON['stringify'](_0x569e1c));if(_0x569e1c[_0x9920('0x16')]){if(_0x569e1c[_0x9920('0x16')]['code']===0x1f4){logger[_0x9920('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x27463b,_0x569e1c['error'][_0x9920('0x17')]);return _0x19babc(_0x569e1c[_0x9920('0x16')][_0x9920('0x17')]);}logger[_0x9920('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x27463b,_0x569e1c[_0x9920('0x16')][_0x9920('0x17')]);return _0x1f7a17(_0x569e1c['error'][_0x9920('0x17')]);}else{logger[_0x9920('0x13')](_0x9920('0x18'),_0x27463b,_0x9920('0x19'));_0x1f7a17(_0x569e1c[_0x9920('0x1a')]['message']);}})['catch'](function(_0x2236f9){logger['error'](_0x9920('0x18'),_0x27463b,_0x2236f9);_0x19babc(_0x2236f9);});});}exports[_0x9920('0x1b')]=function(_0x54e7ed){var _0x58762d=this;return new Promise(function(_0x4183b9,_0x2e2e50){return db['WhatsappAccount'][_0x9920('0x1c')]({'raw':_0x54e7ed[_0x9920('0x1d')]?_0x54e7ed[_0x9920('0x1d')][_0x9920('0x1e')]===undefined?!![]:![]:!![],'where':_0x54e7ed[_0x9920('0x1d')]?_0x54e7ed[_0x9920('0x1d')][_0x9920('0x1f')]||null:null,'attributes':_0x54e7ed[_0x9920('0x1d')]?_0x54e7ed[_0x9920('0x1d')]['attributes']||null:null,'include':_0x54e7ed['options']?_0x54e7ed[_0x9920('0x1d')][_0x9920('0x20')]?_[_0x9920('0x21')](_0x54e7ed[_0x9920('0x1d')]['include'],function(_0x47b0eb){return{'model':db[_0x47b0eb[_0x9920('0x22')]],'as':_0x47b0eb['as'],'attributes':_0x47b0eb[_0x9920('0x23')],'include':_0x47b0eb[_0x9920('0x20')]?_[_0x9920('0x21')](_0x47b0eb[_0x9920('0x20')],function(_0x8d6c5d){return{'model':db[_0x8d6c5d['model']],'as':_0x8d6c5d['as'],'attributes':_0x8d6c5d[_0x9920('0x23')],'include':_0x8d6c5d['include']?_[_0x9920('0x21')](_0x8d6c5d[_0x9920('0x20')],function(_0x442cac){return{'model':db[_0x442cac['model']],'as':_0x442cac['as'],'attributes':_0x442cac[_0x9920('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x259327){logger[_0x9920('0x13')]('ShowWhatsappAccount',_0x54e7ed);logger[_0x9920('0x14')](_0x9920('0x1b'),_0x54e7ed,JSON['stringify'](_0x259327));_0x4183b9(_0x259327);})['catch'](function(_0x702609){logger[_0x9920('0x16')](_0x9920('0x1b'),_0x702609['message'],_0x54e7ed);_0x2e2e50(_0x58762d['error'](0x1f4,_0x702609['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b3b2311..46ac585 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 _0x6474=['length','whatsappAccount:','./whatsappAccount.events','save','remove','emit'];(function(_0x559f72,_0x44ec54){var _0x204b08=function(_0x2c2570){while(--_0x2c2570){_0x559f72['push'](_0x559f72['shift']());}};_0x204b08(++_0x44ec54);}(_0x6474,0x164));var _0x4647=function(_0xdde6fb,_0x1b1884){_0xdde6fb=_0xdde6fb-0x0;var _0xe8042e=_0x6474[_0xdde6fb];return _0xe8042e;};'use strict';var WhatsappAccountEvents=require(_0x4647('0x0'));var events=[_0x4647('0x1'),_0x4647('0x2'),'update'];function createListener(_0x47bcff,_0x21a0cc){return function(_0x2022d2){_0x21a0cc[_0x4647('0x3')](_0x47bcff,_0x2022d2);};}function removeListener(_0x3e2b66,_0x3b0e0b){return function(){WhatsappAccountEvents['removeListener'](_0x3e2b66,_0x3b0e0b);};}exports['register']=function(_0x4d88c3){for(var _0x4aa44d=0x0,_0x281c80=events[_0x4647('0x4')];_0x4aa44d<_0x281c80;_0x4aa44d++){var _0x29280d=events[_0x4aa44d];var _0x34941=createListener(_0x4647('0x5')+_0x29280d,_0x4d88c3);WhatsappAccountEvents['on'](_0x29280d,_0x34941);}}; \ No newline at end of file +var _0x65da=['./whatsappAccount.events','save','emit','removeListener','register','length'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x65da,0x132));var _0xa65d=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x65da[_0x32b542];return _0x554d54;};'use strict';var WhatsappAccountEvents=require(_0xa65d('0x0'));var events=[_0xa65d('0x1'),'remove','update'];function createListener(_0x369ee8,_0xe3701a){return function(_0x282e46){_0xe3701a[_0xa65d('0x2')](_0x369ee8,_0x282e46);};}function removeListener(_0x1abfc9,_0x39bf97){return function(){WhatsappAccountEvents[_0xa65d('0x3')](_0x1abfc9,_0x39bf97);};}exports[_0xa65d('0x4')]=function(_0x148e90){for(var _0x1c9a6f=0x0,_0x337e74=events[_0xa65d('0x5')];_0x1c9a6f<_0x337e74;_0x1c9a6f++){var _0x5d966b=events[_0x1c9a6f];var _0x5c5d83=createListener('whatsappAccount:'+_0x5d966b,_0x148e90);WhatsappAccountEvents['on'](_0x5d966b,_0x5c5d83);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6f7b647..02f0641 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 _0xe7b7=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x41f5b4,_0x21e771){var _0x42e618=function(_0x5b5458){while(--_0x5b5458){_0x41f5b4['push'](_0x41f5b4['shift']());}};_0x42e618(++_0x21e771);}(_0xe7b7,0xe4));var _0x7e7b=function(_0x3202dc,_0x281fc){_0x3202dc=_0x3202dc-0x0;var _0x76897a=_0xe7b7[_0x3202dc];return _0x76897a;};'use strict';var multer=require(_0x7e7b('0x0'));var util=require(_0x7e7b('0x1'));var path=require(_0x7e7b('0x2'));var timeout=require(_0x7e7b('0x3'));var express=require(_0x7e7b('0x4'));var router=express[_0x7e7b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7e7b('0x6'));var interaction=require(_0x7e7b('0x7'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x7e7b('0x8')]('/',auth[_0x7e7b('0x9')](),controller[_0x7e7b('0xa')]);router['get'](_0x7e7b('0xb'),auth[_0x7e7b('0x9')](),controller['show']);router[_0x7e7b('0xc')]('/',auth[_0x7e7b('0x9')](),controller[_0x7e7b('0xd')]);router[_0x7e7b('0xe')]('/:id',auth[_0x7e7b('0x9')](),controller[_0x7e7b('0xf')]);router[_0x7e7b('0x10')](_0x7e7b('0xb'),auth[_0x7e7b('0x9')](),controller[_0x7e7b('0x11')]);module[_0x7e7b('0x12')]=router; \ No newline at end of file +var _0xff10=['index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x220155,_0x15d63d){var _0x1dd6d3=function(_0x2cacc3){while(--_0x2cacc3){_0x220155['push'](_0x220155['shift']());}};_0x1dd6d3(++_0x15d63d);}(_0xff10,0x172));var _0x0ff1=function(_0x3006bd,_0x4e2d81){_0x3006bd=_0x3006bd-0x0;var _0x30bd32=_0xff10[_0x3006bd];return _0x30bd32;};'use strict';var multer=require(_0x0ff1('0x0'));var util=require(_0x0ff1('0x1'));var path=require(_0x0ff1('0x2'));var timeout=require(_0x0ff1('0x3'));var express=require(_0x0ff1('0x4'));var router=express['Router']();var fs_extra=require(_0x0ff1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0ff1('0x6'));var config=require('../../config/environment');var controller=require(_0x0ff1('0x7'));router[_0x0ff1('0x8')]('/',auth[_0x0ff1('0x9')](),controller[_0x0ff1('0xa')]);router[_0x0ff1('0x8')]('/:id',auth[_0x0ff1('0x9')](),controller[_0x0ff1('0xb')]);router[_0x0ff1('0xc')]('/',auth[_0x0ff1('0x9')](),controller['create']);router[_0x0ff1('0xd')](_0x0ff1('0xe'),auth[_0x0ff1('0x9')](),controller[_0x0ff1('0xf')]);router[_0x0ff1('0x10')](_0x0ff1('0xe'),auth[_0x0ff1('0x9')](),controller[_0x0ff1('0x11')]);module[_0x0ff1('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index cef07e4..3024cd6 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 _0x2c1b=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0xffec15,_0xb473a9){var _0x367a69=function(_0x52629b){while(--_0x52629b){_0xffec15['push'](_0xffec15['shift']());}};_0x367a69(++_0xb473a9);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x2c1b[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require(_0xb2c1('0x0'));module[_0xb2c1('0x1')]={'priority':{'type':Sequelize[_0xb2c1('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb2c1('0x3')],'allowNull':![],'defaultValue':_0xb2c1('0x4')},'appdata':{'type':Sequelize[_0xb2c1('0x5')]()},'description':{'type':Sequelize[_0xb2c1('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb2c1('0x6')}}; \ No newline at end of file +var _0x696b=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x696b,0x1c3));var _0xb696=function(_0x21f37e,_0x491cc0){_0x21f37e=_0x21f37e-0x0;var _0x4ff423=_0x696b[_0x21f37e];return _0x4ff423;};'use strict';var Sequelize=require('sequelize');module[_0xb696('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb696('0x1')],'allowNull':![],'defaultValue':_0xb696('0x2')},'appdata':{'type':Sequelize[_0xb696('0x3')]()},'description':{'type':Sequelize[_0xb696('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb696('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 5dfab48..96286df 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 _0xe451=['end','offset','undefined','limit','count','update','then','destroy','sendStatus','error','name','send','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status'];(function(_0x8385f3,_0x53f26b){var _0x50c271=function(_0x51cb4f){while(--_0x51cb4f){_0x8385f3['push'](_0x8385f3['shift']());}};_0x50c271(++_0x53f26b);}(_0xe451,0xec));var _0x1e45=function(_0x1ee99d,_0x25aba5){_0x1ee99d=_0x1ee99d-0x0;var _0x2cee6b=_0xe451[_0x1ee99d];return _0x2cee6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1e45('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e45('0x1'));var Mustache=require(_0x1e45('0x2'));var util=require(_0x1e45('0x3'));var path=require(_0x1e45('0x4'));var sox=require('sox');var csv=require(_0x1e45('0x5'));var ejs=require(_0x1e45('0x6'));var fs=require('fs');var fs_extra=require(_0x1e45('0x7'));var _=require('lodash');var squel=require(_0x1e45('0x8'));var crypto=require(_0x1e45('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1e45('0x5'));var querystring=require(_0x1e45('0xa'));var Papa=require(_0x1e45('0xb'));var Redis=require('ioredis');var authService=require(_0x1e45('0xc'));var qs=require(_0x1e45('0xd'));var as=require(_0x1e45('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1e45('0xf'));var utils=require(_0x1e45('0x10'));var config=require(_0x1e45('0x11'));var licenseUtil=require(_0x1e45('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16cafc,_0x2ec564){_0x2ec564=_0x2ec564||0xcc;return function(_0x3d25a8){if(_0x3d25a8){return _0x16cafc['sendStatus'](_0x2ec564);}return _0x16cafc[_0x1e45('0x13')](_0x2ec564)[_0x1e45('0x14')]();};}function respondWithResult(_0x31215a,_0x21f68d){_0x21f68d=_0x21f68d||0xc8;return function(_0x5b3ee1){if(_0x5b3ee1){return _0x31215a[_0x1e45('0x13')](_0x21f68d)['json'](_0x5b3ee1);}};}function respondWithFilteredResult(_0xf66042,_0x2c7ace){return function(_0x4e1400){if(_0x4e1400){var _0xfdeae3=typeof _0x2c7ace[_0x1e45('0x15')]===_0x1e45('0x16')&&typeof _0x2c7ace[_0x1e45('0x17')]===_0x1e45('0x16');var _0x308c29=_0x4e1400[_0x1e45('0x18')];var _0x2a6f47=_0xfdeae3?0x0:_0x2c7ace[_0x1e45('0x15')];var _0x5d24a7=_0xfdeae3?_0x4e1400[_0x1e45('0x18')]:_0x2c7ace['offset']+_0x2c7ace['limit'];var _0x17c63a;if(_0x5d24a7>=_0x308c29){_0x5d24a7=_0x308c29;_0x17c63a=0xc8;}else{_0x17c63a=0xce;}_0xf66042['status'](_0x17c63a);return _0xf66042['set']('Content-Range',_0x2a6f47+'-'+_0x5d24a7+'/'+_0x308c29)['json'](_0x4e1400);}return null;};}function patchUpdates(_0x207335){return function(_0x4476eb){try{jsonpatch['apply'](_0x4476eb,_0x207335,!![]);}catch(_0xc0deec){return BPromise['reject'](_0xc0deec);}return _0x4476eb['save']();};}function saveUpdates(_0x41cfae,_0x59aaa7){return function(_0x4ffe97){if(_0x4ffe97){return _0x4ffe97[_0x1e45('0x19')](_0x41cfae)[_0x1e45('0x1a')](function(_0x4ce4c5){return _0x4ce4c5;});}return null;};}function removeEntity(_0x48209a,_0x2fb478){return function(_0x40c216){if(_0x40c216){return _0x40c216[_0x1e45('0x1b')]()[_0x1e45('0x1a')](function(){_0x48209a[_0x1e45('0x13')](0xcc)[_0x1e45('0x14')]();});}};}function handleEntityNotFound(_0x55e968,_0x3f6771){return function(_0x394f7e){if(!_0x394f7e){_0x55e968[_0x1e45('0x1c')](0x194);}return _0x394f7e;};}function handleError(_0x25b131,_0x1a8355){_0x1a8355=_0x1a8355||0x1f4;return function(_0xfd7633){logger[_0x1e45('0x1d')](_0xfd7633['stack']);if(_0xfd7633[_0x1e45('0x1e')]){delete _0xfd7633[_0x1e45('0x1e')];}_0x25b131[_0x1e45('0x13')](_0x1a8355)[_0x1e45('0x1f')](_0xfd7633);};}exports['index']=function(_0xe7cdcf,_0x34046e){var _0x3dd6c3={},_0x5229e7={},_0x3def67={'count':0x0,'rows':[]};var _0x4a04aa=_[_0x1e45('0x20')](db['WhatsappApplication']['rawAttributes'],function(_0x34d75e){return{'name':_0x34d75e[_0x1e45('0x21')],'type':_0x34d75e[_0x1e45('0x22')][_0x1e45('0x23')]};});_0x5229e7['model']=_[_0x1e45('0x20')](_0x4a04aa,'name');_0x5229e7[_0x1e45('0x24')]=_[_0x1e45('0x25')](_0xe7cdcf[_0x1e45('0x24')]);_0x5229e7['filters']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],_0x5229e7[_0x1e45('0x24')]);_0x3dd6c3['attributes']=_[_0x1e45('0x26')](_0x5229e7[_0x1e45('0x27')],qs[_0x1e45('0x28')](_0xe7cdcf[_0x1e45('0x24')]['fields']));_0x3dd6c3[_0x1e45('0x29')]=_0x3dd6c3[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x3dd6c3[_0x1e45('0x29')]:_0x5229e7[_0x1e45('0x27')];if(!_0xe7cdcf['query']['hasOwnProperty']('nolimit')){_0x3dd6c3['limit']=qs[_0x1e45('0x17')](_0xe7cdcf['query'][_0x1e45('0x17')]);_0x3dd6c3[_0x1e45('0x15')]=qs['offset'](_0xe7cdcf['query'][_0x1e45('0x15')]);}_0x3dd6c3[_0x1e45('0x2b')]=qs[_0x1e45('0x2c')](_0xe7cdcf[_0x1e45('0x24')]['sort']);_0x3dd6c3[_0x1e45('0x2d')]=qs[_0x1e45('0x2e')](_[_0x1e45('0x2f')](_0xe7cdcf[_0x1e45('0x24')],_0x5229e7['filters']),_0x4a04aa);if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]){_0x3dd6c3[_0x1e45('0x2d')]=_['merge'](_0x3dd6c3['where'],{'$or':_[_0x1e45('0x20')](_0x4a04aa,function(_0x47c200){if(_0x47c200['type']!==_0x1e45('0x31')){var _0x587a0a={};_0x587a0a[_0x47c200['name']]={'$like':'%'+_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x30')]+'%'};return _0x587a0a;}})});}_0x3dd6c3=_[_0x1e45('0x32')]({},_0x3dd6c3,_0xe7cdcf[_0x1e45('0x33')]);var _0x11a327={'where':_0x3dd6c3[_0x1e45('0x2d')]};return db[_0x1e45('0x34')][_0x1e45('0x18')](_0x11a327)[_0x1e45('0x1a')](function(_0x53713a){_0x3def67[_0x1e45('0x18')]=_0x53713a;if(_0xe7cdcf[_0x1e45('0x24')][_0x1e45('0x35')]){_0x3dd6c3[_0x1e45('0x36')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x1e45('0x37')](_0x3dd6c3);})[_0x1e45('0x1a')](function(_0x2984ae){_0x3def67[_0x1e45('0x38')]=_0x2984ae;return _0x3def67;})['then'](respondWithFilteredResult(_0x34046e,_0x3dd6c3))[_0x1e45('0x39')](handleError(_0x34046e,null));};exports[_0x1e45('0x3a')]=function(_0x32a42a,_0x393a50){var _0x522b40={'raw':!![],'where':{'id':_0x32a42a[_0x1e45('0x3b')]['id']}},_0x460d38={};_0x460d38[_0x1e45('0x27')]=_[_0x1e45('0x25')](db[_0x1e45('0x34')][_0x1e45('0x3c')]);_0x460d38['query']=_[_0x1e45('0x25')](_0x32a42a['query']);_0x460d38[_0x1e45('0x2e')]=_[_0x1e45('0x26')](_0x460d38[_0x1e45('0x27')],_0x460d38[_0x1e45('0x24')]);_0x522b40[_0x1e45('0x29')]=_[_0x1e45('0x26')](_0x460d38['model'],qs[_0x1e45('0x28')](_0x32a42a[_0x1e45('0x24')][_0x1e45('0x28')]));_0x522b40['attributes']=_0x522b40[_0x1e45('0x29')][_0x1e45('0x2a')]?_0x522b40[_0x1e45('0x29')]:_0x460d38['model'];if(_0x32a42a['query']['includeAll']){_0x522b40[_0x1e45('0x36')]=[{'all':!![]}];}_0x522b40=_[_0x1e45('0x32')]({},_0x522b40,_0x32a42a[_0x1e45('0x33')]);return db[_0x1e45('0x34')]['find'](_0x522b40)[_0x1e45('0x1a')](handleEntityNotFound(_0x393a50,null))[_0x1e45('0x1a')](respondWithResult(_0x393a50,null))[_0x1e45('0x39')](handleError(_0x393a50,null));};exports[_0x1e45('0x3d')]=function(_0x3994d8,_0x53e41b){return db[_0x1e45('0x34')][_0x1e45('0x3d')](_0x3994d8[_0x1e45('0x3e')],{})[_0x1e45('0x1a')](respondWithResult(_0x53e41b,0xc9))[_0x1e45('0x39')](handleError(_0x53e41b,null));};exports['update']=function(_0x374c32,_0x14b06f){if(_0x374c32[_0x1e45('0x3e')]['id']){delete _0x374c32[_0x1e45('0x3e')]['id'];}return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x374c32['params']['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x14b06f,null))[_0x1e45('0x1a')](saveUpdates(_0x374c32['body'],null))[_0x1e45('0x1a')](respondWithResult(_0x14b06f,null))['catch'](handleError(_0x14b06f,null));};exports[_0x1e45('0x1b')]=function(_0x3e6845,_0x5bafc7){return db[_0x1e45('0x34')][_0x1e45('0x3f')]({'where':{'id':_0x3e6845[_0x1e45('0x3b')]['id']}})[_0x1e45('0x1a')](handleEntityNotFound(_0x5bafc7,null))[_0x1e45('0x1a')](removeEntity(_0x5bafc7,null))[_0x1e45('0x39')](handleError(_0x5bafc7,null));}; \ No newline at end of file +var _0x8277=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','find','create','body','params','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2beb8c,_0x64ddb0){var _0x10b7e3=function(_0x5dfe54){while(--_0x5dfe54){_0x2beb8c['push'](_0x2beb8c['shift']());}};_0x10b7e3(++_0x64ddb0);}(_0x8277,0xcf));var _0x7827=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0x8277[_0x31b5a5];return _0x364cc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7827('0x0'));var zipdir=require(_0x7827('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7827('0x2'));var moment=require(_0x7827('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7827('0x4'));var util=require(_0x7827('0x5'));var path=require('path');var sox=require(_0x7827('0x6'));var csv=require(_0x7827('0x7'));var ejs=require(_0x7827('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7827('0x9'));var squel=require(_0x7827('0xa'));var crypto=require(_0x7827('0xb'));var jsforce=require(_0x7827('0xc'));var deskjs=require(_0x7827('0xd'));var toCsv=require(_0x7827('0x7'));var querystring=require(_0x7827('0xe'));var Papa=require(_0x7827('0xf'));var Redis=require(_0x7827('0x10'));var authService=require(_0x7827('0x11'));var qs=require(_0x7827('0x12'));var as=require(_0x7827('0x13'));var hardwareService=require(_0x7827('0x14'));var logger=require(_0x7827('0x15'))('api');var utils=require(_0x7827('0x16'));var config=require(_0x7827('0x17'));var licenseUtil=require(_0x7827('0x18'));var db=require(_0x7827('0x19'))['db'];function respondWithStatusCode(_0x5e3061,_0x3a5a48){_0x3a5a48=_0x3a5a48||0xcc;return function(_0xb8c1a9){if(_0xb8c1a9){return _0x5e3061[_0x7827('0x1a')](_0x3a5a48);}return _0x5e3061[_0x7827('0x1b')](_0x3a5a48)[_0x7827('0x1c')]();};}function respondWithResult(_0x41dcb9,_0x35c668){_0x35c668=_0x35c668||0xc8;return function(_0x453f04){if(_0x453f04){return _0x41dcb9[_0x7827('0x1b')](_0x35c668)[_0x7827('0x1d')](_0x453f04);}};}function respondWithFilteredResult(_0x2eae42,_0x33bded){return function(_0x2fe484){if(_0x2fe484){var _0x85c389=typeof _0x33bded[_0x7827('0x1e')]==='undefined'&&typeof _0x33bded[_0x7827('0x1f')]===_0x7827('0x20');var _0x19be26=_0x2fe484[_0x7827('0x21')];var _0x34a6b2=_0x85c389?0x0:_0x33bded[_0x7827('0x1e')];var _0x18ca8f=_0x85c389?_0x2fe484[_0x7827('0x21')]:_0x33bded['offset']+_0x33bded[_0x7827('0x1f')];var _0x13f66f;if(_0x18ca8f>=_0x19be26){_0x18ca8f=_0x19be26;_0x13f66f=0xc8;}else{_0x13f66f=0xce;}_0x2eae42[_0x7827('0x1b')](_0x13f66f);return _0x2eae42[_0x7827('0x22')](_0x7827('0x23'),_0x34a6b2+'-'+_0x18ca8f+'/'+_0x19be26)[_0x7827('0x1d')](_0x2fe484);}return null;};}function patchUpdates(_0x216bf6){return function(_0x523edf){try{jsonpatch[_0x7827('0x24')](_0x523edf,_0x216bf6,!![]);}catch(_0x4a1dd1){return BPromise[_0x7827('0x25')](_0x4a1dd1);}return _0x523edf[_0x7827('0x26')]();};}function saveUpdates(_0x4697aa,_0x3465de){return function(_0x589d37){if(_0x589d37){return _0x589d37[_0x7827('0x27')](_0x4697aa)[_0x7827('0x28')](function(_0x14070d){return _0x14070d;});}return null;};}function removeEntity(_0x5ecc81,_0x18dbc3){return function(_0x55a4d4){if(_0x55a4d4){return _0x55a4d4[_0x7827('0x29')]()['then'](function(){_0x5ecc81[_0x7827('0x1b')](0xcc)[_0x7827('0x1c')]();});}};}function handleEntityNotFound(_0x2745e4,_0x3271c9){return function(_0x4d1c18){if(!_0x4d1c18){_0x2745e4[_0x7827('0x1a')](0x194);}return _0x4d1c18;};}function handleError(_0x4b2a0d,_0x3ec12e){_0x3ec12e=_0x3ec12e||0x1f4;return function(_0x2e12d6){logger[_0x7827('0x2a')](_0x2e12d6[_0x7827('0x2b')]);if(_0x2e12d6[_0x7827('0x2c')]){delete _0x2e12d6[_0x7827('0x2c')];}_0x4b2a0d[_0x7827('0x1b')](_0x3ec12e)[_0x7827('0x2d')](_0x2e12d6);};}exports[_0x7827('0x2e')]=function(_0x4b25ba,_0x21b502){var _0x301b31={},_0x25415b={},_0x25bcbe={'count':0x0,'rows':[]};var _0x52c029=_[_0x7827('0x2f')](db[_0x7827('0x30')][_0x7827('0x31')],function(_0x26a004){return{'name':_0x26a004['fieldName'],'type':_0x26a004['type'][_0x7827('0x32')]};});_0x25415b['model']=_[_0x7827('0x2f')](_0x52c029,_0x7827('0x2c'));_0x25415b['query']=_[_0x7827('0x33')](_0x4b25ba[_0x7827('0x34')]);_0x25415b[_0x7827('0x35')]=_['intersection'](_0x25415b[_0x7827('0x36')],_0x25415b['query']);_0x301b31[_0x7827('0x37')]=_[_0x7827('0x38')](_0x25415b['model'],qs[_0x7827('0x39')](_0x4b25ba['query'][_0x7827('0x39')]));_0x301b31['attributes']=_0x301b31[_0x7827('0x37')][_0x7827('0x3a')]?_0x301b31[_0x7827('0x37')]:_0x25415b[_0x7827('0x36')];if(!_0x4b25ba[_0x7827('0x34')]['hasOwnProperty']('nolimit')){_0x301b31[_0x7827('0x1f')]=qs['limit'](_0x4b25ba[_0x7827('0x34')]['limit']);_0x301b31[_0x7827('0x1e')]=qs[_0x7827('0x1e')](_0x4b25ba['query'][_0x7827('0x1e')]);}_0x301b31[_0x7827('0x3b')]=qs[_0x7827('0x3c')](_0x4b25ba['query'][_0x7827('0x3c')]);_0x301b31[_0x7827('0x3d')]=qs[_0x7827('0x35')](_[_0x7827('0x3e')](_0x4b25ba[_0x7827('0x34')],_0x25415b['filters']),_0x52c029);if(_0x4b25ba[_0x7827('0x34')]['filter']){_0x301b31[_0x7827('0x3d')]=_[_0x7827('0x3f')](_0x301b31[_0x7827('0x3d')],{'$or':_['map'](_0x52c029,function(_0x30bb81){if(_0x30bb81[_0x7827('0x40')]!==_0x7827('0x41')){var _0x4624af={};_0x4624af[_0x30bb81['name']]={'$like':'%'+_0x4b25ba[_0x7827('0x34')][_0x7827('0x42')]+'%'};return _0x4624af;}})});}_0x301b31=_[_0x7827('0x3f')]({},_0x301b31,_0x4b25ba['options']);var _0x4bfaa0={'where':_0x301b31[_0x7827('0x3d')]};return db[_0x7827('0x30')]['count'](_0x4bfaa0)[_0x7827('0x28')](function(_0x5243a5){_0x25bcbe['count']=_0x5243a5;if(_0x4b25ba[_0x7827('0x34')][_0x7827('0x43')]){_0x301b31[_0x7827('0x44')]=[{'all':!![]}];}return db[_0x7827('0x30')]['findAll'](_0x301b31);})[_0x7827('0x28')](function(_0x453ec0){_0x25bcbe[_0x7827('0x45')]=_0x453ec0;return _0x25bcbe;})[_0x7827('0x28')](respondWithFilteredResult(_0x21b502,_0x301b31))[_0x7827('0x46')](handleError(_0x21b502,null));};exports[_0x7827('0x47')]=function(_0x2f8a8c,_0x37dd2b){var _0x58fbcf={'raw':!![],'where':{'id':_0x2f8a8c['params']['id']}},_0xe79716={};_0xe79716[_0x7827('0x36')]=_[_0x7827('0x33')](db[_0x7827('0x30')][_0x7827('0x31')]);_0xe79716[_0x7827('0x34')]=_[_0x7827('0x33')](_0x2f8a8c[_0x7827('0x34')]);_0xe79716[_0x7827('0x35')]=_[_0x7827('0x38')](_0xe79716[_0x7827('0x36')],_0xe79716[_0x7827('0x34')]);_0x58fbcf[_0x7827('0x37')]=_[_0x7827('0x38')](_0xe79716[_0x7827('0x36')],qs[_0x7827('0x39')](_0x2f8a8c[_0x7827('0x34')][_0x7827('0x39')]));_0x58fbcf[_0x7827('0x37')]=_0x58fbcf[_0x7827('0x37')]['length']?_0x58fbcf['attributes']:_0xe79716[_0x7827('0x36')];if(_0x2f8a8c['query'][_0x7827('0x43')]){_0x58fbcf[_0x7827('0x44')]=[{'all':!![]}];}_0x58fbcf=_[_0x7827('0x3f')]({},_0x58fbcf,_0x2f8a8c['options']);return db[_0x7827('0x30')][_0x7827('0x48')](_0x58fbcf)[_0x7827('0x28')](handleEntityNotFound(_0x37dd2b,null))[_0x7827('0x28')](respondWithResult(_0x37dd2b,null))[_0x7827('0x46')](handleError(_0x37dd2b,null));};exports[_0x7827('0x49')]=function(_0x180d4b,_0x2340d6){return db[_0x7827('0x30')]['create'](_0x180d4b[_0x7827('0x4a')],{})[_0x7827('0x28')](respondWithResult(_0x2340d6,0xc9))[_0x7827('0x46')](handleError(_0x2340d6,null));};exports[_0x7827('0x27')]=function(_0x2ee0d8,_0x458aa4){if(_0x2ee0d8[_0x7827('0x4a')]['id']){delete _0x2ee0d8['body']['id'];}return db[_0x7827('0x30')][_0x7827('0x48')]({'where':{'id':_0x2ee0d8[_0x7827('0x4b')]['id']}})[_0x7827('0x28')](handleEntityNotFound(_0x458aa4,null))[_0x7827('0x28')](saveUpdates(_0x2ee0d8[_0x7827('0x4a')],null))[_0x7827('0x28')](respondWithResult(_0x458aa4,null))['catch'](handleError(_0x458aa4,null));};exports['destroy']=function(_0x59b38d,_0x224a9a){return db[_0x7827('0x30')]['find']({'where':{'id':_0x59b38d[_0x7827('0x4b')]['id']}})['then'](handleEntityNotFound(_0x224a9a,null))['then'](removeEntity(_0x224a9a,null))[_0x7827('0x46')](handleError(_0x224a9a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 1092ca2..8d78e5a 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 _0x432b=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','rimraf','./whatsappApplication.attributes'];(function(_0x3fb2d4,_0x44a3a8){var _0x4cfd9a=function(_0x35f723){while(--_0x35f723){_0x3fb2d4['push'](_0x3fb2d4['shift']());}};_0x4cfd9a(++_0x44a3a8);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var logger=require(_0xb432('0x1'))(_0xb432('0x2'));var moment=require(_0xb432('0x3'));var BPromise=require(_0xb432('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb432('0x5'));var config=require('../../config/environment');var attributes=require(_0xb432('0x6'));module['exports']=function(_0x143093,_0x3f1a78){return _0x143093[_0xb432('0x7')](_0xb432('0x8'),attributes,{'tableName':_0xb432('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb432('0xa'),'collate':_0xb432('0xb')});}; \ No newline at end of file +var _0x544a=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','./whatsappApplication.attributes','exports','define'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x544a,0xbd));var _0xa544=function(_0x3f8736,_0x546caf){_0x3f8736=_0x3f8736-0x0;var _0x2db96c=_0x544a[_0x3f8736];return _0x2db96c;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var logger=require(_0xa544('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa544('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa544('0x4'));var rimraf=require(_0xa544('0x5'));var config=require('../../config/environment');var attributes=require(_0xa544('0x6'));module[_0xa544('0x7')]=function(_0x2f5992,_0x15a604){return _0x2f5992[_0xa544('0x8')]('WhatsappApplication',attributes,{'tableName':_0xa544('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa544('0xa')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 8fb8368..c11912f 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 _0x425d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x5bd7f0,_0x325527){var _0x395a02=function(_0x5dbb95){while(--_0x5dbb95){_0x5bd7f0['push'](_0x5bd7f0['shift']());}};_0x395a02(++_0x325527);}(_0x425d,0x1e0));var _0xd425=function(_0xfba42,_0x2df074){_0xfba42=_0xfba42-0x0;var _0x245842=_0x425d[_0xfba42];return _0x245842;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var moment=require(_0xd425('0x1'));var BPromise=require(_0xd425('0x2'));var rs=require(_0xd425('0x3'));var fs=require('fs');var Redis=require(_0xd425('0x4'));var db=require(_0xd425('0x5'))['db'];var utils=require(_0xd425('0x6'));var logger=require(_0xd425('0x7'))('rpc');var config=require(_0xd425('0x8'));var jayson=require(_0xd425('0x9'));var client=jayson[_0xd425('0xa')][_0xd425('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){return client[_0xd425('0xc')](_0x1d97d9,_0x50b061)[_0xd425('0xd')](function(_0x2db9da){logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));logger[_0xd425('0x11')](_0xd425('0x12'),_0x1d2ed0,_0xd425('0x10'),JSON[_0xd425('0x13')](_0x2db9da));if(_0x2db9da[_0xd425('0x14')]){if(_0x2db9da[_0xd425('0x14')][_0xd425('0x15')]===0x1f4){logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);return _0x374c3d(_0x2db9da[_0xd425('0x14')]['message']);}logger[_0xd425('0x14')](_0xd425('0xf'),_0x1d2ed0,_0x2db9da[_0xd425('0x14')]['message']);return _0xb6ba8e(_0x2db9da[_0xd425('0x14')][_0xd425('0x16')]);}else{logger[_0xd425('0xe')](_0xd425('0xf'),_0x1d2ed0,_0xd425('0x10'));_0xb6ba8e(_0x2db9da['result'][_0xd425('0x16')]);}})[_0xd425('0x17')](function(_0x7e267e){logger[_0xd425('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1d2ed0,_0x7e267e);_0x374c3d(_0x7e267e);});});} \ No newline at end of file +var _0x5fd1=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x203b16,_0x418af6){var _0x5c8785=function(_0x1642ee){while(--_0x1642ee){_0x203b16['push'](_0x203b16['shift']());}};_0x5c8785(++_0x418af6);}(_0x5fd1,0x155));var _0x15fd=function(_0xd483d2,_0x17e458){_0xd483d2=_0xd483d2-0x0;var _0x4bfd35=_0x5fd1[_0xd483d2];return _0x4bfd35;};'use strict';var _=require(_0x15fd('0x0'));var util=require('util');var moment=require(_0x15fd('0x1'));var BPromise=require(_0x15fd('0x2'));var rs=require(_0x15fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15fd('0x4'));var logger=require(_0x15fd('0x5'))(_0x15fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x15fd('0x7'));var client=jayson[_0x15fd('0x8')][_0x15fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e88bf,_0x225728,_0x534e63){return new BPromise(function(_0x210e90,_0x1ee117){return client[_0x15fd('0xa')](_0x2e88bf,_0x534e63)['then'](function(_0x2d2fbb){logger['info'](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x225728,'request\x20sent',JSON[_0x15fd('0xd')](_0x2d2fbb));if(_0x2d2fbb[_0x15fd('0xe')]){if(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0xf')]===0x1f4){logger[_0x15fd('0xe')](_0x15fd('0xb'),_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x1ee117(_0x2d2fbb[_0x15fd('0xe')]['message']);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x225728,_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);return _0x210e90(_0x2d2fbb[_0x15fd('0xe')][_0x15fd('0x10')]);}else{logger[_0x15fd('0x11')](_0x15fd('0xb'),_0x225728,_0x15fd('0xc'));_0x210e90(_0x2d2fbb[_0x15fd('0x12')]['message']);}})['catch'](function(_0x25f139){logger['error'](_0x15fd('0xb'),_0x225728,_0x25f139);_0x1ee117(_0x25f139);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 241d4e2..ad271a7 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 _0xee3c=['index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','whatsapp','whatsappinteraction:addtags','tracked','whatsappinteraction:update','update','destroy','delete','/:id/tags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xee3c,0x14a));var _0xcee3=function(_0x4edae2,_0x3afbba){_0x4edae2=_0x4edae2-0x0;var _0x36913f=_0xee3c[_0x4edae2];return _0x36913f;};'use strict';var multer=require(_0xcee3('0x0'));var util=require(_0xcee3('0x1'));var path=require(_0xcee3('0x2'));var timeout=require(_0xcee3('0x3'));var express=require(_0xcee3('0x4'));var router=express[_0xcee3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcee3('0x6'));var config=require(_0xcee3('0x7'));var controller=require(_0xcee3('0x8'));router[_0xcee3('0x9')]('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0xb')]);router[_0xcee3('0x9')](_0xcee3('0xc'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xd')]);router[_0xcee3('0x9')](_0xcee3('0xe'),auth[_0xcee3('0xa')](),controller[_0xcee3('0xf')]);router[_0xcee3('0x9')]('/:id/messages',auth[_0xcee3('0xa')](),controller[_0xcee3('0x10')]);router[_0xcee3('0x9')](_0xcee3('0x11'),auth[_0xcee3('0xa')](),controller[_0xcee3('0x12')]);router['post']('/',auth[_0xcee3('0xa')](),controller[_0xcee3('0x13')]);router[_0xcee3('0x14')](_0xcee3('0x15'),auth[_0xcee3('0xa')](),controller['addMessage']);router[_0xcee3('0x14')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xcee3('0x16'),_0xcee3('0x17')),controller['addTags']);router['put'](_0xcee3('0xe'),auth['isAuthenticated'](),interaction[_0xcee3('0x18')]('whatsapp',_0xcee3('0x19')),controller[_0xcee3('0x1a')]);router['delete'](_0xcee3('0xe'),auth[_0xcee3('0xa')](),interaction[_0xcee3('0x18')](_0xcee3('0x16'),'whatsappinteraction:destroy'),controller[_0xcee3('0x1b')]);router[_0xcee3('0x1c')](_0xcee3('0x1d'),auth[_0xcee3('0xa')](),controller['removeTags']);module[_0xcee3('0x1e')]=router; \ No newline at end of file +var _0x85d0=['../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','put','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','express','Router','fs-extra','../../components/auth/service'];(function(_0x5ddec1,_0x491520){var _0x4dbaac=function(_0x1de963){while(--_0x1de963){_0x5ddec1['push'](_0x5ddec1['shift']());}};_0x4dbaac(++_0x491520);}(_0x85d0,0x164));var _0x085d=function(_0x24e2d1,_0x2dd1ba){_0x24e2d1=_0x24e2d1-0x0;var _0x1751ca=_0x85d0[_0x24e2d1];return _0x1751ca;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x085d('0x0'));var router=express[_0x085d('0x1')]();var fs_extra=require(_0x085d('0x2'));var auth=require(_0x085d('0x3'));var interaction=require(_0x085d('0x4'));var config=require(_0x085d('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x085d('0x6')]('/',auth['isAuthenticated'](),controller[_0x085d('0x7')]);router[_0x085d('0x6')](_0x085d('0x8'),auth['isAuthenticated'](),controller[_0x085d('0x9')]);router[_0x085d('0x6')](_0x085d('0xa'),auth[_0x085d('0xb')](),controller[_0x085d('0xc')]);router[_0x085d('0x6')](_0x085d('0xd'),auth[_0x085d('0xb')](),controller[_0x085d('0xe')]);router['get'](_0x085d('0xf'),auth[_0x085d('0xb')](),controller[_0x085d('0x10')]);router[_0x085d('0x11')]('/',auth['isAuthenticated'](),controller[_0x085d('0x12')]);router[_0x085d('0x11')]('/:id/messages',auth[_0x085d('0xb')](),controller[_0x085d('0x13')]);router[_0x085d('0x11')](_0x085d('0x14'),auth['isAuthenticated'](),interaction[_0x085d('0x15')](_0x085d('0x16'),'whatsappinteraction:addtags'),controller['addTags']);router[_0x085d('0x17')](_0x085d('0xa'),auth[_0x085d('0xb')](),interaction[_0x085d('0x15')](_0x085d('0x16'),'whatsappinteraction:update'),controller[_0x085d('0x18')]);router[_0x085d('0x19')](_0x085d('0xa'),auth[_0x085d('0xb')](),interaction[_0x085d('0x15')](_0x085d('0x16'),_0x085d('0x1a')),controller[_0x085d('0x1b')]);router[_0x085d('0x19')]('/:id/tags',auth[_0x085d('0xb')](),controller[_0x085d('0x1c')]);module[_0x085d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 41d8b5a..8c25398 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 _0x26b2=['moment','exports','DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize'];(function(_0x24916a,_0x3a445e){var _0x5d1c70=function(_0x139785){while(--_0x139785){_0x24916a['push'](_0x24916a['shift']());}};_0x5d1c70(++_0x3a445e);}(_0x26b2,0xc5));var _0x226b=function(_0x1065f5,_0x193093){_0x1065f5=_0x1065f5-0x0;var _0x21faa6=_0x26b2[_0x1065f5];return _0x21faa6;};'use strict';var Sequelize=require(_0x226b('0x0'));var moment=require(_0x226b('0x1'));module[_0x226b('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x226b('0x3')]},'disposition':{'type':Sequelize[_0x226b('0x4')]},'secondDisposition':{'type':Sequelize[_0x226b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x226b('0x4')]},'note':{'type':Sequelize[_0x226b('0x4')]},'phone':{'type':Sequelize[_0x226b('0x4')]},'read1stAt':{'type':Sequelize[_0x226b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x226b('0x5')]('in',_0x226b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x226b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x226b('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x226b('0x8')]}}; \ No newline at end of file +var _0x7a40=['BOOLEAN','INTEGER','sequelize','moment','exports','DATE','STRING','ENUM','out'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x7a40,0x197));var _0x07a4=function(_0x8b2415,_0xb75bd5){_0x8b2415=_0x8b2415-0x0;var _0xb3586e=_0x7a40[_0x8b2415];return _0xb3586e;};'use strict';var Sequelize=require(_0x07a4('0x0'));var moment=require(_0x07a4('0x1'));module[_0x07a4('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x07a4('0x3')]},'disposition':{'type':Sequelize[_0x07a4('0x4')]},'secondDisposition':{'type':Sequelize[_0x07a4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x07a4('0x4')]},'note':{'type':Sequelize[_0x07a4('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x07a4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x07a4('0x5')]('in',_0x07a4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x07a4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x07a4('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x07a4('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x07a4('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9c52ae9..442624b 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 _0x0b48=['undefined','count','limit','Content-Range','then','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','user','params','model','keys','rawAttributes','filters','intersection','fields','attributes','length','include','merge','options','find','catch','create','body','describe','addMessage','ids','omit','findOne','nolimit','order','sort','WhatsappInteractionId','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','toString','closed','existsSync','createReadStream','pipe','createWriteStream','basename','System','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','bluebird','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset'];(function(_0x4f9962,_0x3fcfa0){var _0x14512b=function(_0x4b1baf){while(--_0x4b1baf){_0x4f9962['push'](_0x4f9962['shift']());}};_0x14512b(++_0x3fcfa0);}(_0x0b48,0x1ce));var _0x80b4=function(_0x5033ca,_0x1c87b7){_0x5033ca=_0x5033ca-0x0;var _0x50b339=_0x0b48[_0x5033ca];return _0x50b339;};'use strict';var rimraf=require(_0x80b4('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x80b4('0x1'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x80b4('0x2'));var interaction=require(_0x80b4('0x3'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x80b4('0x4'))(_0x80b4('0x5'));var config=require(_0x80b4('0x6'));var db=require(_0x80b4('0x7'))['db'];config[_0x80b4('0x8')]=_[_0x80b4('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x80b4('0xa'))(new Redis(config[_0x80b4('0x8')]));require(_0x80b4('0xb'))[_0x80b4('0xc')](socket);function respondWithStatusCode(_0x518400,_0x1b2e69){_0x1b2e69=_0x1b2e69||0xcc;return function(_0x1f7791){if(_0x1f7791){return _0x518400[_0x80b4('0xd')](_0x1b2e69);}return _0x518400[_0x80b4('0xe')](_0x1b2e69)[_0x80b4('0xf')]();};}function respondWithResult(_0x10c63f,_0x58ba8a){_0x58ba8a=_0x58ba8a||0xc8;return function(_0x5e31e3){if(_0x5e31e3){return _0x10c63f[_0x80b4('0xe')](_0x58ba8a)[_0x80b4('0x10')](_0x5e31e3);}};}function respondWithFilteredResult(_0x424075,_0x38980a){return function(_0x13c893){if(_0x13c893){var _0x3fb348=typeof _0x38980a[_0x80b4('0x11')]===_0x80b4('0x12')&&typeof _0x38980a['limit']==='undefined';var _0x4ad551=_0x13c893[_0x80b4('0x13')];var _0x3f0343=_0x3fb348?0x0:_0x38980a['offset'];var _0x180c8b=_0x3fb348?_0x13c893[_0x80b4('0x13')]:_0x38980a[_0x80b4('0x11')]+_0x38980a[_0x80b4('0x14')];var _0xc3095d;if(_0x180c8b>=_0x4ad551){_0x180c8b=_0x4ad551;_0xc3095d=0xc8;}else{_0xc3095d=0xce;}_0x424075['status'](_0xc3095d);return _0x424075['set'](_0x80b4('0x15'),_0x3f0343+'-'+_0x180c8b+'/'+_0x4ad551)[_0x80b4('0x10')](_0x13c893);}return null;};}function saveUpdates(_0x377aab){return function(_0x3d9d31){if(_0x3d9d31){return _0x3d9d31['update'](_0x377aab)['then'](function(_0x5e3763){return _0x5e3763;});}return null;};}function removeEntity(_0x4f5f3b){return function(_0x4bf07b){if(_0x4bf07b){return _0x4bf07b['destroy']()[_0x80b4('0x16')](function(){_0x4f5f3b['status'](0xcc)[_0x80b4('0xf')]();});}};}function handleEntityNotFound(_0x3fb569){return function(_0x238464){if(!_0x238464){_0x3fb569[_0x80b4('0xd')](0x194);}return _0x238464;};}function handleError(_0xe99e8e,_0x445b85){_0x445b85=_0x445b85||0x1f4;return function(_0xb11d81){logger['error'](_0xb11d81[_0x80b4('0x17')]);if(_0xb11d81['name']){delete _0xb11d81[_0x80b4('0x18')];}_0xe99e8e[_0x80b4('0xe')](_0x445b85)[_0x80b4('0x19')](_0xb11d81);};}exports[_0x80b4('0x1a')]=function(_0x19eb2b,_0x32934c){var _0x3be46e={};var _0x3ac1ba=_[_0x80b4('0x1b')](db[_0x80b4('0x1c')]['rawAttributes'],function(_0x2360a2){return{'name':_0x2360a2[_0x80b4('0x1d')],'type':_0x2360a2[_0x80b4('0x1e')][_0x80b4('0x1f')]};});_0x3be46e=qs[_0x80b4('0x20')](_0x3ac1ba,_0x19eb2b);return interaction[_0x80b4('0x21')](_0x80b4('0x22'),_0x19eb2b[_0x80b4('0x23')],_0x19eb2b[_0x80b4('0x24')],_0x3be46e,_0x3ac1ba)[_0x80b4('0x16')](respondWithFilteredResult(_0x32934c,_0x3be46e))['catch'](handleError(_0x32934c,null));};exports['show']=function(_0x387ab4,_0x48be33){var _0x445f1c={'raw':![],'where':{'id':_0x387ab4[_0x80b4('0x25')]['id']}},_0x5e0bb2={};_0x5e0bb2[_0x80b4('0x26')]=_[_0x80b4('0x27')](db[_0x80b4('0x1c')][_0x80b4('0x28')]);_0x5e0bb2[_0x80b4('0x23')]=_['keys'](_0x387ab4[_0x80b4('0x23')]);_0x5e0bb2[_0x80b4('0x29')]=_['intersection'](_0x5e0bb2[_0x80b4('0x26')],_0x5e0bb2[_0x80b4('0x23')]);_0x445f1c['attributes']=_[_0x80b4('0x2a')](_0x5e0bb2['model'],qs['fields'](_0x387ab4['query'][_0x80b4('0x2b')]));_0x445f1c[_0x80b4('0x2c')]=_0x445f1c['attributes'][_0x80b4('0x2d')]?_0x445f1c[_0x80b4('0x2c')]:_0x5e0bb2['model'];if(_0x387ab4[_0x80b4('0x23')]['includeAll']){_0x445f1c[_0x80b4('0x2e')]=[{'all':!![]}];}_0x445f1c=_[_0x80b4('0x2f')]({},_0x445f1c,_0x387ab4[_0x80b4('0x30')]);return db[_0x80b4('0x1c')][_0x80b4('0x31')](_0x445f1c)[_0x80b4('0x16')](handleEntityNotFound(_0x48be33,null))[_0x80b4('0x16')](respondWithResult(_0x48be33,null))[_0x80b4('0x32')](handleError(_0x48be33,null));};exports[_0x80b4('0x33')]=function(_0x2e7e79,_0x51fa79){return db[_0x80b4('0x1c')]['create'](_0x2e7e79[_0x80b4('0x34')],{})[_0x80b4('0x16')](respondWithResult(_0x51fa79,0xc9))[_0x80b4('0x32')](handleError(_0x51fa79,null));};exports['update']=function(_0xac5eaa,_0x29c922){if(_0xac5eaa['body']['id']){delete _0xac5eaa[_0x80b4('0x34')]['id'];}return db[_0x80b4('0x1c')]['find']({'where':{'id':_0xac5eaa[_0x80b4('0x25')]['id']}})[_0x80b4('0x16')](handleEntityNotFound(_0x29c922,null))[_0x80b4('0x16')](saveUpdates(_0xac5eaa[_0x80b4('0x34')],null))[_0x80b4('0x16')](respondWithResult(_0x29c922,null))['catch'](handleError(_0x29c922,null));};exports['destroy']=function(_0x514121,_0x285de7){return db[_0x80b4('0x1c')][_0x80b4('0x31')]({'where':{'id':_0x514121[_0x80b4('0x25')]['id']}})[_0x80b4('0x16')](handleEntityNotFound(_0x285de7,null))[_0x80b4('0x16')](removeEntity(_0x285de7,null))[_0x80b4('0x32')](handleError(_0x285de7,null));};exports[_0x80b4('0x35')]=function(_0x18c1dc,_0x2d75a1){return db[_0x80b4('0x1c')][_0x80b4('0x35')]()[_0x80b4('0x16')](respondWithResult(_0x2d75a1,null))[_0x80b4('0x32')](handleError(_0x2d75a1,null));};exports['addMessage']=function(_0x804b0,_0x35f289){return db['WhatsappMessage'][_0x80b4('0x31')]({'where':{'id':_0x804b0[_0x80b4('0x25')]['id']}})[_0x80b4('0x16')](handleEntityNotFound(_0x35f289,null))[_0x80b4('0x16')](function(_0x1e041d){if(_0x1e041d){return _0x1e041d[_0x80b4('0x36')](_0x804b0[_0x80b4('0x34')][_0x80b4('0x37')],_[_0x80b4('0x38')](_0x804b0[_0x80b4('0x34')],[_0x80b4('0x37'),'id'])||{});}})[_0x80b4('0x16')](respondWithResult(_0x35f289,null))[_0x80b4('0x32')](handleError(_0x35f289,null));};exports['getMessages']=function(_0x25a5c4,_0x3a3f44){var _0x597657={'raw':![],'where':{}};var _0x45a5f1={};var _0x213a87={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x80b4('0x39')]({'where':{'id':_0x25a5c4['params']['id']}})[_0x80b4('0x16')](handleEntityNotFound(_0x3a3f44,null))[_0x80b4('0x16')](function(_0x474b51){if(_0x474b51){_0x45a5f1[_0x80b4('0x26')]=_[_0x80b4('0x27')](db['WhatsappMessage']['rawAttributes']);_0x45a5f1[_0x80b4('0x23')]=_['keys'](_0x25a5c4['query']);_0x45a5f1[_0x80b4('0x29')]=_[_0x80b4('0x2a')](_0x45a5f1['model'],_0x45a5f1[_0x80b4('0x23')]);_0x597657[_0x80b4('0x2c')]=_[_0x80b4('0x2a')](_0x45a5f1[_0x80b4('0x26')],qs[_0x80b4('0x2b')](_0x25a5c4[_0x80b4('0x23')][_0x80b4('0x2b')]));_0x597657[_0x80b4('0x2c')]=_0x597657[_0x80b4('0x2c')][_0x80b4('0x2d')]?_0x597657[_0x80b4('0x2c')]:_0x45a5f1['model'];if(!_0x25a5c4['query']['hasOwnProperty'](_0x80b4('0x3a'))){_0x597657[_0x80b4('0x14')]=qs[_0x80b4('0x14')](_0x25a5c4['query'][_0x80b4('0x14')]);_0x597657[_0x80b4('0x11')]=qs[_0x80b4('0x11')](_0x25a5c4[_0x80b4('0x23')]['offset']);}_0x597657[_0x80b4('0x3b')]=qs[_0x80b4('0x3c')](_0x25a5c4[_0x80b4('0x23')][_0x80b4('0x3c')]);_0x597657['where']=qs[_0x80b4('0x29')](_['pick'](_0x25a5c4[_0x80b4('0x23')],_0x45a5f1['filters']));_0x597657['where'][_0x80b4('0x3d')]=_0x474b51['id'];if(_0x25a5c4[_0x80b4('0x23')]['filter']){_0x597657[_0x80b4('0x3e')]=_[_0x80b4('0x2f')](_0x597657[_0x80b4('0x3e')],{'$or':_[_0x80b4('0x1b')](_0x597657[_0x80b4('0x2c')],function(_0x206b47){var _0x160729={};_0x160729[_0x206b47]={'$like':'%'+_0x25a5c4['query'][_0x80b4('0x3f')]+'%'};return _0x160729;})});}if(_0x25a5c4[_0x80b4('0x23')][_0x80b4('0x40')]){var _0x2b3bf2=_0x25a5c4[_0x80b4('0x23')]['$gte'][_0x80b4('0x41')](',');var _0x55720a={};_0x55720a[_0x2b3bf2[0x0]]={'$gte':moment(_0x2b3bf2[0x1])[_0x80b4('0x42')](_0x80b4('0x43'))};_0x597657[_0x80b4('0x3e')]=_[_0x80b4('0x2f')](_0x597657[_0x80b4('0x3e')],_0x55720a);}_0x597657=_['merge']({},_0x597657,_0x25a5c4[_0x80b4('0x30')]);return db['WhatsappMessage'][_0x80b4('0x13')]({'where':_0x597657[_0x80b4('0x3e')]})['then'](function(_0x1b0e86){_0x213a87[_0x80b4('0x13')]=_0x1b0e86;if(_0x25a5c4['query'][_0x80b4('0x44')]){_0x597657[_0x80b4('0x2e')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x80b4('0x21')](_0x597657);})[_0x80b4('0x16')](function(_0x3b9203){_0x213a87[_0x80b4('0x45')]=_0x3b9203;return _0x213a87;});}})[_0x80b4('0x16')](respondWithFilteredResult(_0x3a3f44,_0x597657))['catch'](handleError(_0x3a3f44,null));};exports[_0x80b4('0x46')]=function(_0x4a9120,_0x274ac4){return db[_0x80b4('0x1c')]['find']({'where':{'id':_0x4a9120[_0x80b4('0x25')]['id']}})[_0x80b4('0x16')](handleEntityNotFound(_0x274ac4,null))[_0x80b4('0x16')](function(_0x33e166){if(_0x33e166){return _0x33e166['setTags'](_0x4a9120[_0x80b4('0x34')][_0x80b4('0x37')],_['omit'](_0x4a9120[_0x80b4('0x34')],['ids','id'])||{})[_0x80b4('0x47')](function(){return db[_0x80b4('0x48')][_0x80b4('0x21')]({'attributes':['id',_0x80b4('0x18'),'color'],'where':{'id':_0x4a9120[_0x80b4('0x34')]['ids']}});})['then'](function(_0x33de32){socket[_0x80b4('0x49')](_0x80b4('0x4a'),{'id':Number(_0x4a9120[_0x80b4('0x25')]['id']),'tags':_0x33de32||[]});return{'id':Number(_0x4a9120[_0x80b4('0x25')]['id']),'tags':_0x33de32||[]};});}})['then'](respondWithResult(_0x274ac4,null))['catch'](handleError(_0x274ac4,null));};exports[_0x80b4('0x4b')]=function(_0xc028d5,_0x5cc01f){return db[_0x80b4('0x1c')]['find']({'where':{'id':_0xc028d5[_0x80b4('0x25')]['id']}})[_0x80b4('0x16')](handleEntityNotFound(_0x5cc01f,null))[_0x80b4('0x16')](function(_0x5d2abe){if(_0x5d2abe){return _0x5d2abe[_0x80b4('0x4b')](_0xc028d5[_0x80b4('0x23')]['ids']);}})[_0x80b4('0x16')](respondWithStatusCode(_0x5cc01f,null))['catch'](handleError(_0x5cc01f,null));};exports[_0x80b4('0x4c')]=function(_0x5acae6,_0x34e477){var _0x2d912e=moment()['unix']()['toString']();var _0x5da304=path[_0x80b4('0x4d')](config[_0x80b4('0x4e')],_0x80b4('0x4f'),_0x80b4('0x50'),_0x80b4('0x51'));var _0x262377=path[_0x80b4('0x4d')](config['root'],'server',_0x80b4('0x50'),_0x80b4('0x52'));var _0x5f1528=path[_0x80b4('0x4d')](_0x5da304,_0x2d912e);var _0x21d6de=util[_0x80b4('0x42')](_0x80b4('0x53'),_0x5acae6[_0x80b4('0x25')]['id'],_0x2d912e);var _0x2be73a=path['join'](_0x5da304,_0x21d6de);var _0x22ae1d=[];_0x22ae1d[_0x80b4('0x54')]({'model':db[_0x80b4('0x55')],'as':_0x80b4('0x55'),'attributes':['id',_0x80b4('0x56')],'raw':!![]});_0x22ae1d[_0x80b4('0x54')]({'model':db['CmContact'],'as':_0x80b4('0x57'),'attributes':['id',_0x80b4('0x58'),_0x80b4('0x59')],'raw':!![]});if(_0x5acae6[_0x80b4('0x23')][_0x80b4('0x52')]){_0x22ae1d[_0x80b4('0x54')]({'model':db[_0x80b4('0x5a')],'as':_0x80b4('0x5a'),'raw':!![]});}var _0x3e97f3=[{'model':db['WhatsappMessage'],'as':_0x80b4('0x5b'),'attributes':['id',_0x80b4('0x34'),_0x80b4('0x5c'),_0x80b4('0x5d'),_0x80b4('0x5e'),_0x80b4('0x5f')],'include':_0x22ae1d}];_0x3e97f3[_0x80b4('0x54')]({'model':db[_0x80b4('0x60')],'as':_0x80b4('0x61'),'attributes':['id','name']});_0x3e97f3[_0x80b4('0x54')]({'model':db[_0x80b4('0x55')],'as':'Owner','attributes':['id',_0x80b4('0x56')]});return db[_0x80b4('0x1c')][_0x80b4('0x31')]({'where':{'id':_0x5acae6['params']['id']},'include':_0x3e97f3})[_0x80b4('0x16')](handleEntityNotFound(_0x34e477,null))[_0x80b4('0x16')](function(_0x5bca7e){if(_0x5bca7e){var _0x49efc8=_0x5bca7e[_0x80b4('0x62')]({'plain':!![]});fs[_0x80b4('0x63')](_0x5f1528);var _0x161a7d={'channel':_0x80b4('0x64'),'account':_0x49efc8[_0x80b4('0x61')][_0x80b4('0x18')],'agent':_0x49efc8['Owner']?_0x49efc8[_0x80b4('0x65')][_0x80b4('0x56')]:'N.A.','createdAt':moment(_0x49efc8[_0x80b4('0x5c')])[_0x80b4('0x42')](_0x80b4('0x43'))[_0x80b4('0x66')](),'closedAt':_0x49efc8[_0x80b4('0x67')]?moment(_0x49efc8['closedAt'])['format'](_0x80b4('0x43'))[_0x80b4('0x66')]():'','disposition':_0x49efc8['disposition'],'messages':_(_0x49efc8[_0x80b4('0x5b')])['filter']({'secret':![]})[_0x80b4('0x1b')](function(_0x38a696){if(_0x38a696[_0x80b4('0x5a')]){var _0x12ecbd=path[_0x80b4('0x4d')](_0x262377,_0x38a696[_0x80b4('0x5a')]['basename']);if(fs[_0x80b4('0x68')](_0x12ecbd)){fs[_0x80b4('0x69')](_0x12ecbd)[_0x80b4('0x6a')](fs[_0x80b4('0x6b')](path['join'](_0x5f1528,_0x38a696[_0x80b4('0x5a')][_0x80b4('0x6c')])));}}return{'date':moment(_0x38a696[_0x80b4('0x5c')])[_0x80b4('0x42')](_0x80b4('0x43'))[_0x80b4('0x66')](),'sender':_0x38a696[_0x80b4('0x5d')]==='out'?_0x38a696['User']?_0x38a696[_0x80b4('0x55')][_0x80b4('0x56')]:_0x80b4('0x6d'):_0x38a696[_0x80b4('0x57')]['firstName']+(_0x38a696[_0x80b4('0x57')][_0x80b4('0x59')]?'\x20'+_0x38a696['Contact'][_0x80b4('0x59')]:''),'body':_0x38a696[_0x80b4('0x5a')]?_0x38a696[_0x80b4('0x5a')][_0x80b4('0x6c')]:_0x38a696[_0x80b4('0x34')],'direction':_0x38a696['direction']===_0x80b4('0x6e')?'A':'C','secret':_0x38a696[_0x80b4('0x5e')],'read':_0x38a696[_0x80b4('0x5f')],'attachment':_0x38a696[_0x80b4('0x5a')]};})[_0x80b4('0x6f')]()};return ejs[_0x80b4('0x70')](path[_0x80b4('0x4d')](config[_0x80b4('0x4e')],_0x80b4('0x4f'),_0x80b4('0x71'),_0x80b4('0x72')),{'interaction':_0x161a7d})[_0x80b4('0x16')](function(_0x13b433){var _0x2d9010=path[_0x80b4('0x4d')](_0x5f1528,_0x80b4('0x73')+_0x49efc8['id']+'-'+_0x2d912e+_0x80b4('0x74'));var _0x13dcb2={'path':_0x2d9010,'channel':_0x80b4('0x64'),'interactionId':_0x49efc8['id']};return pdf[_0x80b4('0x75')](_0x13b433,_0x13dcb2);})[_0x80b4('0x16')](function(){return new BPromise(function(_0x176773,_0x574d49){zipdir(_0x5f1528,{'saveTo':_0x2be73a},function(_0x23e283,_0xb57247){if(_0x23e283)return _0x574d49(_0x23e283);return _0x176773(_0xb57247);});})[_0x80b4('0x16')](function(){return new BPromise(function(_0x25989a,_0x5cf687){rimraf(_0x5f1528,function(_0xf149b0){if(_0xf149b0)_0x5cf687(_0xf149b0);return _0x25989a();});});})[_0x80b4('0x16')](function(){return _0x34e477[_0x80b4('0x4c')](_0x2be73a,_0x21d6de,function(_0x3f3a78){if(_0x3f3a78){console[_0x80b4('0x76')]('err',_0x3f3a78);}else{fs[_0x80b4('0x77')](_0x2be73a);}});});});}else{return _0x34e477['sendStatus'](0xc8);}})[_0x80b4('0x32')](handleError(_0x34e477,null));}; \ No newline at end of file +var _0xdf4d=['WhatsappMessage','ids','omit','getMessages','findOne','intersection','length','hasOwnProperty','nolimit','sort','where','pick','filters','WhatsappInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Owner','get','mkdirSync','Whatsapp','Account','N.A.','closed','closedAt','disposition','basename','createReadStream','createWriteStream','out','System','Contact','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','type','getOptions','findAll','whatsapp','query','user','catch','show','keys','model','attributes','fields','includeAll','include','create','body','update','find','params','describe','addMessage'];(function(_0xc769be,_0xa21daa){var _0x40bcda=function(_0x17d54c){while(--_0x17d54c){_0xc769be['push'](_0xc769be['shift']());}};_0x40bcda(++_0xa21daa);}(_0xdf4d,0xcb));var _0xddf4=function(_0x3a0086,_0x1d1f2f){_0x3a0086=_0x3a0086-0x0;var _0x3c1cd8=_0xdf4d[_0x3a0086];return _0x3c1cd8;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xddf4('0x0'));var moment=require(_0xddf4('0x1'));var BPromise=require('bluebird');var util=require(_0xddf4('0x2'));var path=require(_0xddf4('0x3'));var ejs=require(_0xddf4('0x4'));var fs=require('fs');var _=require(_0xddf4('0x5'));var Redis=require(_0xddf4('0x6'));var interaction=require(_0xddf4('0x7'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0xddf4('0x8'))(_0xddf4('0x9'));var config=require(_0xddf4('0xa'));var db=require(_0xddf4('0xb'))['db'];config[_0xddf4('0xc')]=_[_0xddf4('0xd')](config[_0xddf4('0xc')],{'host':_0xddf4('0xe'),'port':0x18eb});var socket=require(_0xddf4('0xf'))(new Redis(config[_0xddf4('0xc')]));require(_0xddf4('0x10'))['register'](socket);function respondWithStatusCode(_0x27e945,_0x4a698e){_0x4a698e=_0x4a698e||0xcc;return function(_0x44c33d){if(_0x44c33d){return _0x27e945[_0xddf4('0x11')](_0x4a698e);}return _0x27e945[_0xddf4('0x12')](_0x4a698e)[_0xddf4('0x13')]();};}function respondWithResult(_0x4b7f16,_0x2c7595){_0x2c7595=_0x2c7595||0xc8;return function(_0x32298b){if(_0x32298b){return _0x4b7f16[_0xddf4('0x12')](_0x2c7595)[_0xddf4('0x14')](_0x32298b);}};}function respondWithFilteredResult(_0x4c4c26,_0x4993fc){return function(_0xa9b80d){if(_0xa9b80d){var _0x4e83b2=typeof _0x4993fc[_0xddf4('0x15')]===_0xddf4('0x16')&&typeof _0x4993fc[_0xddf4('0x17')]===_0xddf4('0x16');var _0x3ef3a1=_0xa9b80d['count'];var _0x151b7b=_0x4e83b2?0x0:_0x4993fc['offset'];var _0x13c576=_0x4e83b2?_0xa9b80d[_0xddf4('0x18')]:_0x4993fc[_0xddf4('0x15')]+_0x4993fc[_0xddf4('0x17')];var _0x2e393d;if(_0x13c576>=_0x3ef3a1){_0x13c576=_0x3ef3a1;_0x2e393d=0xc8;}else{_0x2e393d=0xce;}_0x4c4c26[_0xddf4('0x12')](_0x2e393d);return _0x4c4c26[_0xddf4('0x19')]('Content-Range',_0x151b7b+'-'+_0x13c576+'/'+_0x3ef3a1)['json'](_0xa9b80d);}return null;};}function saveUpdates(_0x136036){return function(_0x1aa57a){if(_0x1aa57a){return _0x1aa57a['update'](_0x136036)['then'](function(_0x5cb24f){return _0x5cb24f;});}return null;};}function removeEntity(_0x361fc6){return function(_0x412dab){if(_0x412dab){return _0x412dab[_0xddf4('0x1a')]()[_0xddf4('0x1b')](function(){_0x361fc6[_0xddf4('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a1223){return function(_0x5b1aee){if(!_0x5b1aee){_0x2a1223[_0xddf4('0x11')](0x194);}return _0x5b1aee;};}function handleError(_0x36ce1a,_0x3a2e57){_0x3a2e57=_0x3a2e57||0x1f4;return function(_0x52d533){logger[_0xddf4('0x1c')](_0x52d533[_0xddf4('0x1d')]);if(_0x52d533[_0xddf4('0x1e')]){delete _0x52d533['name'];}_0x36ce1a[_0xddf4('0x12')](_0x3a2e57)[_0xddf4('0x1f')](_0x52d533);};}exports[_0xddf4('0x20')]=function(_0x3d37da,_0x321b6c){var _0x44e751={};var _0x33894c=_[_0xddf4('0x21')](db[_0xddf4('0x22')][_0xddf4('0x23')],function(_0x2c76c6){return{'name':_0x2c76c6['fieldName'],'type':_0x2c76c6[_0xddf4('0x24')]['key']};});_0x44e751=qs[_0xddf4('0x25')](_0x33894c,_0x3d37da);return interaction[_0xddf4('0x26')](_0xddf4('0x27'),_0x3d37da[_0xddf4('0x28')],_0x3d37da[_0xddf4('0x29')],_0x44e751,_0x33894c)[_0xddf4('0x1b')](respondWithFilteredResult(_0x321b6c,_0x44e751))[_0xddf4('0x2a')](handleError(_0x321b6c,null));};exports[_0xddf4('0x2b')]=function(_0x2808fe,_0x1c48bd){var _0x9143e0={'raw':![],'where':{'id':_0x2808fe['params']['id']}},_0x5dca0b={};_0x5dca0b['model']=_[_0xddf4('0x2c')](db['WhatsappInteraction'][_0xddf4('0x23')]);_0x5dca0b[_0xddf4('0x28')]=_[_0xddf4('0x2c')](_0x2808fe[_0xddf4('0x28')]);_0x5dca0b['filters']=_['intersection'](_0x5dca0b[_0xddf4('0x2d')],_0x5dca0b[_0xddf4('0x28')]);_0x9143e0[_0xddf4('0x2e')]=_['intersection'](_0x5dca0b[_0xddf4('0x2d')],qs[_0xddf4('0x2f')](_0x2808fe[_0xddf4('0x28')]['fields']));_0x9143e0[_0xddf4('0x2e')]=_0x9143e0[_0xddf4('0x2e')]['length']?_0x9143e0['attributes']:_0x5dca0b[_0xddf4('0x2d')];if(_0x2808fe['query'][_0xddf4('0x30')]){_0x9143e0[_0xddf4('0x31')]=[{'all':!![]}];}_0x9143e0=_['merge']({},_0x9143e0,_0x2808fe['options']);return db[_0xddf4('0x22')]['find'](_0x9143e0)[_0xddf4('0x1b')](handleEntityNotFound(_0x1c48bd,null))[_0xddf4('0x1b')](respondWithResult(_0x1c48bd,null))[_0xddf4('0x2a')](handleError(_0x1c48bd,null));};exports[_0xddf4('0x32')]=function(_0x45401f,_0x3d2361){return db[_0xddf4('0x22')][_0xddf4('0x32')](_0x45401f[_0xddf4('0x33')],{})[_0xddf4('0x1b')](respondWithResult(_0x3d2361,0xc9))['catch'](handleError(_0x3d2361,null));};exports[_0xddf4('0x34')]=function(_0x384f05,_0x3f2622){if(_0x384f05[_0xddf4('0x33')]['id']){delete _0x384f05[_0xddf4('0x33')]['id'];}return db[_0xddf4('0x22')][_0xddf4('0x35')]({'where':{'id':_0x384f05[_0xddf4('0x36')]['id']}})[_0xddf4('0x1b')](handleEntityNotFound(_0x3f2622,null))[_0xddf4('0x1b')](saveUpdates(_0x384f05[_0xddf4('0x33')],null))[_0xddf4('0x1b')](respondWithResult(_0x3f2622,null))[_0xddf4('0x2a')](handleError(_0x3f2622,null));};exports['destroy']=function(_0x39107f,_0xbbfd39){return db['WhatsappInteraction'][_0xddf4('0x35')]({'where':{'id':_0x39107f[_0xddf4('0x36')]['id']}})[_0xddf4('0x1b')](handleEntityNotFound(_0xbbfd39,null))[_0xddf4('0x1b')](removeEntity(_0xbbfd39,null))[_0xddf4('0x2a')](handleError(_0xbbfd39,null));};exports[_0xddf4('0x37')]=function(_0x1d434f,_0x1e89de){return db['WhatsappInteraction'][_0xddf4('0x37')]()['then'](respondWithResult(_0x1e89de,null))['catch'](handleError(_0x1e89de,null));};exports[_0xddf4('0x38')]=function(_0x63a5db,_0x3cd53f){return db[_0xddf4('0x39')][_0xddf4('0x35')]({'where':{'id':_0x63a5db['params']['id']}})[_0xddf4('0x1b')](handleEntityNotFound(_0x3cd53f,null))[_0xddf4('0x1b')](function(_0x28653e){if(_0x28653e){return _0x28653e[_0xddf4('0x38')](_0x63a5db[_0xddf4('0x33')][_0xddf4('0x3a')],_[_0xddf4('0x3b')](_0x63a5db[_0xddf4('0x33')],[_0xddf4('0x3a'),'id'])||{});}})[_0xddf4('0x1b')](respondWithResult(_0x3cd53f,null))[_0xddf4('0x2a')](handleError(_0x3cd53f,null));};exports[_0xddf4('0x3c')]=function(_0x3d7478,_0x5d25f9){var _0x1bcb35={'raw':![],'where':{}};var _0x284134={};var _0x59d876={'count':0x0,'rows':[]};return db[_0xddf4('0x22')][_0xddf4('0x3d')]({'where':{'id':_0x3d7478[_0xddf4('0x36')]['id']}})[_0xddf4('0x1b')](handleEntityNotFound(_0x5d25f9,null))[_0xddf4('0x1b')](function(_0x20d2b2){if(_0x20d2b2){_0x284134[_0xddf4('0x2d')]=_[_0xddf4('0x2c')](db[_0xddf4('0x39')][_0xddf4('0x23')]);_0x284134[_0xddf4('0x28')]=_[_0xddf4('0x2c')](_0x3d7478['query']);_0x284134['filters']=_[_0xddf4('0x3e')](_0x284134[_0xddf4('0x2d')],_0x284134[_0xddf4('0x28')]);_0x1bcb35[_0xddf4('0x2e')]=_[_0xddf4('0x3e')](_0x284134[_0xddf4('0x2d')],qs['fields'](_0x3d7478[_0xddf4('0x28')][_0xddf4('0x2f')]));_0x1bcb35['attributes']=_0x1bcb35[_0xddf4('0x2e')][_0xddf4('0x3f')]?_0x1bcb35[_0xddf4('0x2e')]:_0x284134[_0xddf4('0x2d')];if(!_0x3d7478['query'][_0xddf4('0x40')](_0xddf4('0x41'))){_0x1bcb35['limit']=qs['limit'](_0x3d7478[_0xddf4('0x28')]['limit']);_0x1bcb35[_0xddf4('0x15')]=qs[_0xddf4('0x15')](_0x3d7478[_0xddf4('0x28')][_0xddf4('0x15')]);}_0x1bcb35['order']=qs[_0xddf4('0x42')](_0x3d7478[_0xddf4('0x28')]['sort']);_0x1bcb35[_0xddf4('0x43')]=qs['filters'](_[_0xddf4('0x44')](_0x3d7478[_0xddf4('0x28')],_0x284134[_0xddf4('0x45')]));_0x1bcb35['where'][_0xddf4('0x46')]=_0x20d2b2['id'];if(_0x3d7478['query'][_0xddf4('0x47')]){_0x1bcb35['where']=_[_0xddf4('0x48')](_0x1bcb35[_0xddf4('0x43')],{'$or':_[_0xddf4('0x21')](_0x1bcb35[_0xddf4('0x2e')],function(_0x112eca){var _0x5200ea={};_0x5200ea[_0x112eca]={'$like':'%'+_0x3d7478[_0xddf4('0x28')][_0xddf4('0x47')]+'%'};return _0x5200ea;})});}if(_0x3d7478[_0xddf4('0x28')]['$gte']){var _0x92a747=_0x3d7478['query'][_0xddf4('0x49')][_0xddf4('0x4a')](',');var _0x7e031b={};_0x7e031b[_0x92a747[0x0]]={'$gte':moment(_0x92a747[0x1])[_0xddf4('0x4b')](_0xddf4('0x4c'))};_0x1bcb35[_0xddf4('0x43')]=_['merge'](_0x1bcb35[_0xddf4('0x43')],_0x7e031b);}_0x1bcb35=_[_0xddf4('0x48')]({},_0x1bcb35,_0x3d7478[_0xddf4('0x4d')]);return db['WhatsappMessage'][_0xddf4('0x18')]({'where':_0x1bcb35[_0xddf4('0x43')]})[_0xddf4('0x1b')](function(_0x2789c4){_0x59d876[_0xddf4('0x18')]=_0x2789c4;if(_0x3d7478['query']['includeAll']){_0x1bcb35['include']=[{'all':!![]}];}return db[_0xddf4('0x39')][_0xddf4('0x26')](_0x1bcb35);})[_0xddf4('0x1b')](function(_0x36f286){_0x59d876[_0xddf4('0x4e')]=_0x36f286;return _0x59d876;});}})['then'](respondWithFilteredResult(_0x5d25f9,_0x1bcb35))[_0xddf4('0x2a')](handleError(_0x5d25f9,null));};exports[_0xddf4('0x4f')]=function(_0x20c3c6,_0x58dcb1){return db[_0xddf4('0x22')][_0xddf4('0x35')]({'where':{'id':_0x20c3c6[_0xddf4('0x36')]['id']}})['then'](handleEntityNotFound(_0x58dcb1,null))[_0xddf4('0x1b')](function(_0x423e8b){if(_0x423e8b){return _0x423e8b['setTags'](_0x20c3c6[_0xddf4('0x33')][_0xddf4('0x3a')],_[_0xddf4('0x3b')](_0x20c3c6[_0xddf4('0x33')],[_0xddf4('0x3a'),'id'])||{})['spread'](function(){return db[_0xddf4('0x50')][_0xddf4('0x26')]({'attributes':['id',_0xddf4('0x1e'),_0xddf4('0x51')],'where':{'id':_0x20c3c6['body'][_0xddf4('0x3a')]}});})[_0xddf4('0x1b')](function(_0x2eca89){socket[_0xddf4('0x52')](_0xddf4('0x53'),{'id':Number(_0x20c3c6[_0xddf4('0x36')]['id']),'tags':_0x2eca89||[]});return{'id':Number(_0x20c3c6[_0xddf4('0x36')]['id']),'tags':_0x2eca89||[]};});}})[_0xddf4('0x1b')](respondWithResult(_0x58dcb1,null))[_0xddf4('0x2a')](handleError(_0x58dcb1,null));};exports[_0xddf4('0x54')]=function(_0x21db53,_0x605e2c){return db['WhatsappInteraction'][_0xddf4('0x35')]({'where':{'id':_0x21db53['params']['id']}})['then'](handleEntityNotFound(_0x605e2c,null))[_0xddf4('0x1b')](function(_0x57eca3){if(_0x57eca3){return _0x57eca3['removeTags'](_0x21db53[_0xddf4('0x28')][_0xddf4('0x3a')]);}})[_0xddf4('0x1b')](respondWithStatusCode(_0x605e2c,null))[_0xddf4('0x2a')](handleError(_0x605e2c,null));};exports[_0xddf4('0x55')]=function(_0x526881,_0x4aa85a){var _0x1c18f1=moment()['unix']()[_0xddf4('0x56')]();var _0x37bf7e=path['join'](config[_0xddf4('0x57')],_0xddf4('0x58'),_0xddf4('0x59'),_0xddf4('0x5a'));var _0xe21801=path[_0xddf4('0x5b')](config['root'],'server','files','attachments');var _0x223028=path[_0xddf4('0x5b')](_0x37bf7e,_0x1c18f1);var _0x243ec9=util[_0xddf4('0x4b')](_0xddf4('0x5c'),_0x526881[_0xddf4('0x36')]['id'],_0x1c18f1);var _0xb7b514=path['join'](_0x37bf7e,_0x243ec9);var _0x82d699=[];_0x82d699[_0xddf4('0x5d')]({'model':db[_0xddf4('0x5e')],'as':'User','attributes':['id',_0xddf4('0x5f')],'raw':!![]});_0x82d699['push']({'model':db[_0xddf4('0x60')],'as':'Contact','attributes':['id',_0xddf4('0x61'),_0xddf4('0x62')],'raw':!![]});if(_0x526881[_0xddf4('0x28')][_0xddf4('0x63')]){_0x82d699[_0xddf4('0x5d')]({'model':db[_0xddf4('0x64')],'as':_0xddf4('0x64'),'raw':!![]});}var _0x340ee8=[{'model':db[_0xddf4('0x39')],'as':_0xddf4('0x65'),'attributes':['id',_0xddf4('0x33'),_0xddf4('0x66'),_0xddf4('0x67'),_0xddf4('0x68'),_0xddf4('0x69')],'include':_0x82d699}];_0x340ee8[_0xddf4('0x5d')]({'model':db[_0xddf4('0x6a')],'as':'Account','attributes':['id','name']});_0x340ee8[_0xddf4('0x5d')]({'model':db[_0xddf4('0x5e')],'as':_0xddf4('0x6b'),'attributes':['id',_0xddf4('0x5f')]});return db[_0xddf4('0x22')][_0xddf4('0x35')]({'where':{'id':_0x526881['params']['id']},'include':_0x340ee8})[_0xddf4('0x1b')](handleEntityNotFound(_0x4aa85a,null))[_0xddf4('0x1b')](function(_0x356b25){if(_0x356b25){var _0x4c47e2=_0x356b25[_0xddf4('0x6c')]({'plain':!![]});fs[_0xddf4('0x6d')](_0x223028);var _0xd71e22={'channel':_0xddf4('0x6e'),'account':_0x4c47e2[_0xddf4('0x6f')][_0xddf4('0x1e')],'agent':_0x4c47e2[_0xddf4('0x6b')]?_0x4c47e2['Owner'][_0xddf4('0x5f')]:_0xddf4('0x70'),'createdAt':moment(_0x4c47e2[_0xddf4('0x66')])[_0xddf4('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x4c47e2[_0xddf4('0x71')]?moment(_0x4c47e2[_0xddf4('0x72')])['format'](_0xddf4('0x4c'))[_0xddf4('0x56')]():'','disposition':_0x4c47e2[_0xddf4('0x73')],'messages':_(_0x4c47e2[_0xddf4('0x65')])[_0xddf4('0x47')]({'secret':![]})['map'](function(_0x4a286b){if(_0x4a286b[_0xddf4('0x64')]){var _0x1c1976=path['join'](_0xe21801,_0x4a286b[_0xddf4('0x64')][_0xddf4('0x74')]);if(fs['existsSync'](_0x1c1976)){fs[_0xddf4('0x75')](_0x1c1976)['pipe'](fs[_0xddf4('0x76')](path['join'](_0x223028,_0x4a286b[_0xddf4('0x64')]['basename'])));}}return{'date':moment(_0x4a286b['createdAt'])[_0xddf4('0x4b')](_0xddf4('0x4c'))[_0xddf4('0x56')](),'sender':_0x4a286b['direction']===_0xddf4('0x77')?_0x4a286b['User']?_0x4a286b[_0xddf4('0x5e')]['fullname']:_0xddf4('0x78'):_0x4a286b['Contact'][_0xddf4('0x61')]+(_0x4a286b[_0xddf4('0x79')]['lastName']?'\x20'+_0x4a286b[_0xddf4('0x79')][_0xddf4('0x62')]:''),'body':_0x4a286b['Attachment']?_0x4a286b[_0xddf4('0x64')][_0xddf4('0x74')]:_0x4a286b[_0xddf4('0x33')],'direction':_0x4a286b[_0xddf4('0x67')]===_0xddf4('0x77')?'A':'C','secret':_0x4a286b[_0xddf4('0x68')],'read':_0x4a286b['read'],'attachment':_0x4a286b[_0xddf4('0x64')]};})['value']()};return ejs[_0xddf4('0x7a')](path[_0xddf4('0x5b')](config[_0xddf4('0x57')],'server',_0xddf4('0x7b'),_0xddf4('0x7c')),{'interaction':_0xd71e22})[_0xddf4('0x1b')](function(_0x499d50){var _0x394cf3=path[_0xddf4('0x5b')](_0x223028,_0xddf4('0x7d')+_0x4c47e2['id']+'-'+_0x1c18f1+_0xddf4('0x7e'));var _0x4d20fa={'path':_0x394cf3,'channel':_0xddf4('0x6e'),'interactionId':_0x4c47e2['id']};return pdf['createPdfFromHTML'](_0x499d50,_0x4d20fa);})[_0xddf4('0x1b')](function(){return new BPromise(function(_0x3a67be,_0xa771f4){zipdir(_0x223028,{'saveTo':_0xb7b514},function(_0x266b57,_0x57321c){if(_0x266b57)return _0xa771f4(_0x266b57);return _0x3a67be(_0x57321c);});})[_0xddf4('0x1b')](function(){return new BPromise(function(_0x4aaaf6,_0x5da933){rimraf(_0x223028,function(_0x453932){if(_0x453932)_0x5da933(_0x453932);return _0x4aaaf6();});});})[_0xddf4('0x1b')](function(){return _0x4aa85a[_0xddf4('0x55')](_0xb7b514,_0x243ec9,function(_0x477be5){if(_0x477be5){console[_0xddf4('0x7f')](_0xddf4('0x80'),_0x477be5);}else{fs[_0xddf4('0x81')](_0xb7b514);}});});});}else{return _0x4aa85a['sendStatus'](0xc8);}})[_0xddf4('0x2a')](handleError(_0x4aa85a,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6f75149..487136e 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 _0xa20a=['emit','hasOwnProperty','hook','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x2abf8b,_0x271ba5){var _0x5e3025=function(_0x5bf2be){while(--_0x5bf2be){_0x2abf8b['push'](_0x2abf8b['shift']());}};_0x5e3025(++_0x271ba5);}(_0xa20a,0x74));var _0xaa20=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa20a[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xaa20('0x0')];var WhatsappMessage=require(_0xaa20('0x1'))['db'][_0xaa20('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xaa20('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa20('0x4'),'afterDestroy':_0xaa20('0x5')};function emitEvent(_0x1497a0){return function(_0x40cb4c,_0x46ae89,_0x5ac74e){_0x40cb4c['getUsers']({'attributes':['id'],'raw':!![]})[_0xaa20('0x6')](function(_0x6d1518){_0x40cb4c[_0xaa20('0x7')](_0xaa20('0x8'),_0x6d1518[_0xaa20('0x9')](function(_0x1983e8){return{'id':_0x1983e8['id']};}));return WhatsappMessage[_0xaa20('0xa')]({'where':{'WhatsappInteractionId':_0x40cb4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa20('0x6')](function(_0x17692f){_0x40cb4c[_0xaa20('0x7')](_0xaa20('0xb'),_0x17692f['length']);WhatsappInteractionEvents[_0xaa20('0xc')](_0x1497a0+':'+_0x40cb4c['id'],_0x40cb4c);WhatsappInteractionEvents[_0xaa20('0xc')](_0x1497a0,_0x40cb4c);_0x5ac74e(null);})['catch'](_0x5ac74e(null));};}for(var e in events){if(events[_0xaa20('0xd')](e)){var event=events[e];WhatsappInteraction[_0xaa20('0xe')](e,emitEvent(event));}}module[_0xaa20('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xdb76=['save','update','remove','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage'];(function(_0x4f8e06,_0x1548c9){var _0x381ca9=function(_0x37c5df){while(--_0x37c5df){_0x4f8e06['push'](_0x4f8e06['shift']());}};_0x381ca9(++_0x1548c9);}(_0xdb76,0x1be));var _0x6db7=function(_0x5b95a7,_0x2192db){_0x5b95a7=_0x5b95a7-0x0;var _0x3f6e48=_0xdb76[_0x5b95a7];return _0x3f6e48;};'use strict';var EventEmitter=require(_0x6db7('0x0'));var WhatsappInteraction=require(_0x6db7('0x1'))['db'][_0x6db7('0x2')];var WhatsappMessage=require(_0x6db7('0x1'))['db'][_0x6db7('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6db7('0x4'),'afterUpdate':_0x6db7('0x5'),'afterDestroy':_0x6db7('0x6')};function emitEvent(_0x40f6ce){return function(_0x57a095,_0x117f1c,_0x7bba2d){_0x57a095[_0x6db7('0x7')]({'attributes':['id'],'raw':!![]})[_0x6db7('0x8')](function(_0x3b7b8a){_0x57a095['setDataValue'](_0x6db7('0x9'),_0x3b7b8a[_0x6db7('0xa')](function(_0x4e2553){return{'id':_0x4e2553['id']};}));return WhatsappMessage[_0x6db7('0xb')]({'where':{'WhatsappInteractionId':_0x57a095['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6db7('0x8')](function(_0x582d31){_0x57a095[_0x6db7('0xc')](_0x6db7('0xd'),_0x582d31[_0x6db7('0xe')]);WhatsappInteractionEvents['emit'](_0x40f6ce+':'+_0x57a095['id'],_0x57a095);WhatsappInteractionEvents['emit'](_0x40f6ce,_0x57a095);_0x7bba2d(null);})[_0x6db7('0xf')](_0x7bba2d(null));};}for(var e in events){if(events[_0x6db7('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x6db7('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7cc907a..fac7244 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 _0x641b=['rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x305b81,_0x47c0cc){var _0x12e30b=function(_0x24f5e6){while(--_0x24f5e6){_0x305b81['push'](_0x305b81['shift']());}};_0x12e30b(++_0x47c0cc);}(_0x641b,0xca));var _0xb641=function(_0x385e75,_0x5d4c8d){_0x385e75=_0x385e75-0x0;var _0x2ebf92=_0x641b[_0x385e75];return _0x2ebf92;};'use strict';var _=require(_0xb641('0x0'));var util=require('util');var logger=require(_0xb641('0x1'))(_0xb641('0x2'));var moment=require(_0xb641('0x3'));var BPromise=require(_0xb641('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb641('0x5'));var rimraf=require(_0xb641('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xb641('0x7')]=function(_0x434f2d,_0x3094a7){return _0x434f2d[_0xb641('0x8')](_0xb641('0x9'),attributes,{'tableName':_0xb641('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b21f5,_0x185790,_0x5ea0f2){if(_0x1b21f5[_0xb641('0xb')](_0xb641('0xc'))){_0x1b21f5[_0xb641('0xd')]=moment()[_0xb641('0xe')](_0xb641('0xf'));}_0x5ea0f2(null,_0x1b21f5);}}});}; \ No newline at end of file +var _0x81ef=['bluebird','request-promise','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment'];(function(_0x3b9565,_0x4bc2b1){var _0x404e58=function(_0x2a6a05){while(--_0x2a6a05){_0x3b9565['push'](_0x3b9565['shift']());}};_0x404e58(++_0x4bc2b1);}(_0x81ef,0x16c));var _0xf81e=function(_0x2ba149,_0x37eaa2){_0x2ba149=_0x2ba149-0x0;var _0x23572a=_0x81ef[_0x2ba149];return _0x23572a;};'use strict';var _=require(_0xf81e('0x0'));var util=require(_0xf81e('0x1'));var logger=require('../../config/logger')(_0xf81e('0x2'));var moment=require(_0xf81e('0x3'));var BPromise=require(_0xf81e('0x4'));var rp=require(_0xf81e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf81e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf81e('0x7'));module[_0xf81e('0x8')]=function(_0x92cde0,_0x107384){return _0x92cde0[_0xf81e('0x9')](_0xf81e('0xa'),attributes,{'tableName':_0xf81e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x390f09,_0x4a84eb,_0x12c043){if(_0x390f09['changed'](_0xf81e('0xc'))){_0x390f09[_0xf81e('0xd')]=moment()[_0xf81e('0xe')](_0xf81e('0xf'));}_0x12c043(null,_0x390f09);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cd0813c..da25f4e 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 _0x6ebf=['then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request'];(function(_0x2a1d8a,_0xa539be){var _0x53d308=function(_0x302b3d){while(--_0x302b3d){_0x2a1d8a['push'](_0x2a1d8a['shift']());}};_0x53d308(++_0xa539be);}(_0x6ebf,0x149));var _0xf6eb=function(_0x2e5f9c,_0x134a52){_0x2e5f9c=_0x2e5f9c-0x0;var _0x538b44=_0x6ebf[_0x2e5f9c];return _0x538b44;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf6eb('0x0'));var BPromise=require(_0xf6eb('0x1'));var rs=require(_0xf6eb('0x2'));var fs=require('fs');var Redis=require(_0xf6eb('0x3'));var db=require(_0xf6eb('0x4'))['db'];var utils=require(_0xf6eb('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf6eb('0x6')]({'port':0x232a});config[_0xf6eb('0x7')]=_[_0xf6eb('0x8')](config[_0xf6eb('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6eb('0x9'))(new Redis(config[_0xf6eb('0x7')]));require(_0xf6eb('0xa'))[_0xf6eb('0xb')](socket);function respondWithRpcPromise(_0x1776dc,_0xd31cbf,_0x5e2c62){return new BPromise(function(_0x1eceaf,_0x254027){return client[_0xf6eb('0xc')](_0x1776dc,_0x5e2c62)[_0xf6eb('0xd')](function(_0x181ff9){logger[_0xf6eb('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0xd31cbf,_0xf6eb('0xf'));logger[_0xf6eb('0x10')](_0xf6eb('0x11'),_0xd31cbf,_0xf6eb('0xf'),JSON[_0xf6eb('0x12')](_0x181ff9));if(_0x181ff9[_0xf6eb('0x13')]){if(_0x181ff9[_0xf6eb('0x13')][_0xf6eb('0x14')]===0x1f4){logger[_0xf6eb('0x13')](_0xf6eb('0x15'),_0xd31cbf,_0x181ff9[_0xf6eb('0x13')][_0xf6eb('0x16')]);return _0x254027(_0x181ff9['error'][_0xf6eb('0x16')]);}logger[_0xf6eb('0x13')](_0xf6eb('0x15'),_0xd31cbf,_0x181ff9['error'][_0xf6eb('0x16')]);return _0x1eceaf(_0x181ff9['error']['message']);}else{logger[_0xf6eb('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0xd31cbf,'request\x20sent');_0x1eceaf(_0x181ff9[_0xf6eb('0x17')][_0xf6eb('0x16')]);}})['catch'](function(_0x457744){logger['error'](_0xf6eb('0x15'),_0xd31cbf,_0x457744);_0x254027(_0x457744);});});}exports[_0xf6eb('0x18')]=function(_0x5760ce){var _0x52f353=this;return new Promise(function(_0x13e537,_0x113979){return db[_0xf6eb('0x19')]['update'](_0x5760ce[_0xf6eb('0x1a')],{'raw':_0x5760ce[_0xf6eb('0x1b')]?_0x5760ce[_0xf6eb('0x1b')][_0xf6eb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5760ce[_0xf6eb('0x1b')]?_0x5760ce[_0xf6eb('0x1b')][_0xf6eb('0x1d')]||null:null,'attributes':_0x5760ce[_0xf6eb('0x1b')]?_0x5760ce[_0xf6eb('0x1b')][_0xf6eb('0x1e')]||null:null,'limit':_0x5760ce['options']?_0x5760ce[_0xf6eb('0x1b')][_0xf6eb('0x1f')]||null:null})[_0xf6eb('0xd')](function(_0x4673e5){logger[_0xf6eb('0xe')](_0xf6eb('0x18'),_0x5760ce);logger['debug'](_0xf6eb('0x18'),_0x5760ce,JSON[_0xf6eb('0x12')](_0x4673e5));_0x13e537(_0x4673e5);})['catch'](function(_0x183c6a){logger['error']('UpdateWhatsappInteraction',_0x183c6a['message'],_0x5760ce);_0x113979(_0x52f353[_0xf6eb('0x13')](0x1f4,_0x183c6a[_0xf6eb('0x16')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x36f9cb){return new Promise(function(_0x521ca5,_0x538d9a){return db['WhatsappInteraction'][_0xf6eb('0x20')]({'where':_0x36f9cb[_0xf6eb('0x1b')]?_0x36f9cb[_0xf6eb('0x1b')]['where']||null:null})[_0xf6eb('0xd')](function(_0x3a0071){if(_0x3a0071){return _0x3a0071['addTags'](_0x36f9cb[_0xf6eb('0x1a')][_0xf6eb('0x21')],_[_0xf6eb('0x22')](_0x36f9cb[_0xf6eb('0x1a')],[_0xf6eb('0x21'),'id'])||{});}})[_0xf6eb('0x23')](function(_0x35beba){logger[_0xf6eb('0xe')]('AddTags',_0x36f9cb);logger[_0xf6eb('0x10')](_0xf6eb('0x24'),_0x36f9cb,JSON[_0xf6eb('0x12')](_0x35beba));_0x521ca5(_0x35beba);})[_0xf6eb('0x25')](function(_0x55008b){logger[_0xf6eb('0x13')](_0xf6eb('0x24'),_0x55008b[_0xf6eb('0x16')],_0x36f9cb);_0x538d9a(_this[_0xf6eb('0x13')](0x1f4,_0x55008b[_0xf6eb('0x16')]));});});}; \ No newline at end of file +var _0x0ac9=['info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappInteraction,\x20%s,\x20%s','result','catch','WhatsappInteraction','update','body','options','raw','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','where','ids','omit','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then'];(function(_0x5139d5,_0x249f6a){var _0x2e5d5a=function(_0xbdac4f){while(--_0xbdac4f){_0x5139d5['push'](_0x5139d5['shift']());}};_0x2e5d5a(++_0x249f6a);}(_0x0ac9,0x14d));var _0x90ac=function(_0x7feb90,_0x28e700){_0x7feb90=_0x7feb90-0x0;var _0x3c5b33=_0x0ac9[_0x7feb90];return _0x3c5b33;};'use strict';var _=require('lodash');var util=require(_0x90ac('0x0'));var moment=require('moment');var BPromise=require(_0x90ac('0x1'));var rs=require(_0x90ac('0x2'));var fs=require('fs');var Redis=require(_0x90ac('0x3'));var db=require(_0x90ac('0x4'))['db'];var utils=require(_0x90ac('0x5'));var logger=require(_0x90ac('0x6'))(_0x90ac('0x7'));var config=require('../../config/environment');var jayson=require(_0x90ac('0x8'));var client=jayson[_0x90ac('0x9')][_0x90ac('0xa')]({'port':0x232a});config[_0x90ac('0xb')]=_[_0x90ac('0xc')](config[_0x90ac('0xb')],{'host':_0x90ac('0xd'),'port':0x18eb});var socket=require(_0x90ac('0xe'))(new Redis(config[_0x90ac('0xb')]));require(_0x90ac('0xf'))[_0x90ac('0x10')](socket);function respondWithRpcPromise(_0x102dcc,_0x5e05c0,_0x470fd4){return new BPromise(function(_0xff5c06,_0x2874b3){return client[_0x90ac('0x11')](_0x102dcc,_0x470fd4)[_0x90ac('0x12')](function(_0x557bb8){logger[_0x90ac('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e05c0,'request\x20sent');logger[_0x90ac('0x14')](_0x90ac('0x15'),_0x5e05c0,_0x90ac('0x16'),JSON[_0x90ac('0x17')](_0x557bb8));if(_0x557bb8[_0x90ac('0x18')]){if(_0x557bb8[_0x90ac('0x18')][_0x90ac('0x19')]===0x1f4){logger[_0x90ac('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e05c0,_0x557bb8[_0x90ac('0x18')][_0x90ac('0x1a')]);return _0x2874b3(_0x557bb8['error'][_0x90ac('0x1a')]);}logger['error'](_0x90ac('0x1b'),_0x5e05c0,_0x557bb8[_0x90ac('0x18')][_0x90ac('0x1a')]);return _0xff5c06(_0x557bb8[_0x90ac('0x18')][_0x90ac('0x1a')]);}else{logger[_0x90ac('0x13')](_0x90ac('0x1b'),_0x5e05c0,_0x90ac('0x16'));_0xff5c06(_0x557bb8[_0x90ac('0x1c')][_0x90ac('0x1a')]);}})[_0x90ac('0x1d')](function(_0x536709){logger[_0x90ac('0x18')](_0x90ac('0x1b'),_0x5e05c0,_0x536709);_0x2874b3(_0x536709);});});}exports['UpdateWhatsappInteraction']=function(_0x313d89){var _0x57e818=this;return new Promise(function(_0x35176a,_0x1d7f9e){return db[_0x90ac('0x1e')][_0x90ac('0x1f')](_0x313d89[_0x90ac('0x20')],{'raw':_0x313d89[_0x90ac('0x21')]?_0x313d89[_0x90ac('0x21')][_0x90ac('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x313d89[_0x90ac('0x21')]?_0x313d89['options']['where']||null:null,'attributes':_0x313d89[_0x90ac('0x21')]?_0x313d89['options'][_0x90ac('0x23')]||null:null,'limit':_0x313d89[_0x90ac('0x21')]?_0x313d89[_0x90ac('0x21')][_0x90ac('0x24')]||null:null})[_0x90ac('0x12')](function(_0x3c4765){logger[_0x90ac('0x13')](_0x90ac('0x25'),_0x313d89);logger[_0x90ac('0x14')](_0x90ac('0x25'),_0x313d89,JSON[_0x90ac('0x17')](_0x3c4765));_0x35176a(_0x3c4765);})[_0x90ac('0x1d')](function(_0x31a0d0){logger[_0x90ac('0x18')](_0x90ac('0x25'),_0x31a0d0['message'],_0x313d89);_0x1d7f9e(_0x57e818[_0x90ac('0x18')](0x1f4,_0x31a0d0['message']));});});};exports[_0x90ac('0x26')]=function(_0x399449){return new Promise(function(_0x429859,_0x501874){return db['WhatsappInteraction'][_0x90ac('0x27')]({'where':_0x399449[_0x90ac('0x21')]?_0x399449[_0x90ac('0x21')][_0x90ac('0x28')]||null:null})[_0x90ac('0x12')](function(_0x30e8eb){if(_0x30e8eb){return _0x30e8eb['addTags'](_0x399449[_0x90ac('0x20')][_0x90ac('0x29')],_[_0x90ac('0x2a')](_0x399449[_0x90ac('0x20')],[_0x90ac('0x29'),'id'])||{});}})['spread'](function(_0x5dbd51){logger[_0x90ac('0x13')](_0x90ac('0x2b'),_0x399449);logger[_0x90ac('0x14')](_0x90ac('0x2b'),_0x399449,JSON[_0x90ac('0x17')](_0x5dbd51));_0x429859(_0x5dbd51);})[_0x90ac('0x1d')](function(_0x3004e1){logger[_0x90ac('0x18')](_0x90ac('0x2b'),_0x3004e1[_0x90ac('0x1a')],_0x399449);_0x501874(_this[_0x90ac('0x18')](0x1f4,_0x3004e1[_0x90ac('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 26bda89..f931e96 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 _0xe3aa=['length','update','removeListener'];(function(_0x4c7c73,_0x1c2aea){var _0x1d1af0=function(_0x11c48e){while(--_0x11c48e){_0x4c7c73['push'](_0x4c7c73['shift']());}};_0x1d1af0(++_0x1c2aea);}(_0xe3aa,0x19c));var _0xae3a=function(_0x1c93d0,_0x14939a){_0x1c93d0=_0x1c93d0-0x0;var _0x482150=_0xe3aa[_0x1c93d0];return _0x482150;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save','remove',_0xae3a('0x0')];function createListener(_0x1cff94,_0x2696e1){return function(_0x454541){_0x2696e1['emit'](_0x1cff94,_0x454541);};}function removeListener(_0x445ae8,_0x5874cf){return function(){WhatsappInteractionEvents[_0xae3a('0x1')](_0x445ae8,_0x5874cf);};}exports['register']=function(_0x1647a6){for(var _0x3c19b0=0x0,_0x2361c7=events[_0xae3a('0x2')];_0x3c19b0<_0x2361c7;_0x3c19b0++){var _0x3529b1=events[_0x3c19b0];var _0x5975a1=createListener('whatsappInteraction:'+_0x3529b1,_0x1647a6);WhatsappInteractionEvents['on'](_0x3529b1,_0x5975a1);}}; \ No newline at end of file +var _0x628d=['register','length','./whatsappInteraction.events','emit','removeListener'];(function(_0x126d56,_0x2914cb){var _0x4014a9=function(_0x2bd1a2){while(--_0x2bd1a2){_0x126d56['push'](_0x126d56['shift']());}};_0x4014a9(++_0x2914cb);}(_0x628d,0xac));var _0xd628=function(_0x1dbc96,_0xb7f876){_0x1dbc96=_0x1dbc96-0x0;var _0x3951a5=_0x628d[_0x1dbc96];return _0x3951a5;};'use strict';var WhatsappInteractionEvents=require(_0xd628('0x0'));var events=['save','remove','update'];function createListener(_0x413b36,_0x310e27){return function(_0x1526e1){_0x310e27[_0xd628('0x1')](_0x413b36,_0x1526e1);};}function removeListener(_0x1306b7,_0x8d68fd){return function(){WhatsappInteractionEvents[_0xd628('0x2')](_0x1306b7,_0x8d68fd);};}exports[_0xd628('0x3')]=function(_0x526ec2){for(var _0x932702=0x0,_0x47e161=events[_0xd628('0x4')];_0x932702<_0x47e161;_0x932702++){var _0x14da38=events[_0x932702];var _0x2aa514=createListener('whatsappInteraction:'+_0x14da38,_0x526ec2);WhatsappInteractionEvents['on'](_0x14da38,_0x2aa514);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3494803..561bca8 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 _0x0ac0=['create','status','put','update','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x239841,_0x1cc2d2){var _0xf5b501=function(_0x15f13f){while(--_0x15f13f){_0x239841['push'](_0x239841['shift']());}};_0xf5b501(++_0x1cc2d2);}(_0x0ac0,0xa5));var _0x00ac=function(_0x130705,_0x2d266b){_0x130705=_0x130705-0x0;var _0x1fa991=_0x0ac0[_0x130705];return _0x1fa991;};'use strict';var multer=require(_0x00ac('0x0'));var util=require('util');var path=require(_0x00ac('0x1'));var timeout=require(_0x00ac('0x2'));var express=require(_0x00ac('0x3'));var router=express[_0x00ac('0x4')]();var fs_extra=require(_0x00ac('0x5'));var auth=require(_0x00ac('0x6'));var interaction=require(_0x00ac('0x7'));var config=require(_0x00ac('0x8'));var controller=require(_0x00ac('0x9'));router[_0x00ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x00ac('0xb')]);router[_0x00ac('0xa')]('/describe',auth[_0x00ac('0xc')](),controller[_0x00ac('0xd')]);router['get'](_0x00ac('0xe'),auth[_0x00ac('0xc')](),controller[_0x00ac('0xf')]);router[_0x00ac('0x10')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller[_0x00ac('0x11')]);router['post']('/:id/status',controller[_0x00ac('0x12')]);router[_0x00ac('0x13')]('/:id',auth[_0x00ac('0xc')](),controller[_0x00ac('0x14')]);router[_0x00ac('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0x00ac('0x15')]);router[_0x00ac('0x13')](_0x00ac('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x00ac('0x17')]('/:id',auth[_0x00ac('0xc')](),controller[_0x00ac('0x18')]);module[_0x00ac('0x19')]=router; \ No newline at end of file +var _0x09d1=['tracked','whatsappmessage:create','create','post','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/:id','show'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x09d1,0x95));var _0x109d=function(_0x2b0170,_0x3514ee){_0x2b0170=_0x2b0170-0x0;var _0x3167db=_0x09d1[_0x2b0170];return _0x3167db;};'use strict';var multer=require(_0x109d('0x0'));var util=require(_0x109d('0x1'));var path=require(_0x109d('0x2'));var timeout=require(_0x109d('0x3'));var express=require(_0x109d('0x4'));var router=express['Router']();var fs_extra=require(_0x109d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x109d('0x6'));var config=require(_0x109d('0x7'));var controller=require(_0x109d('0x8'));router[_0x109d('0x9')]('/',auth[_0x109d('0xa')](),controller['index']);router[_0x109d('0x9')]('/describe',auth[_0x109d('0xa')](),controller['describe']);router[_0x109d('0x9')](_0x109d('0xb'),auth[_0x109d('0xa')](),controller[_0x109d('0xc')]);router['post']('/',auth[_0x109d('0xa')](),interaction[_0x109d('0xd')]('whatsapp',_0x109d('0xe')),controller[_0x109d('0xf')]);router[_0x109d('0x10')](_0x109d('0x11'),controller['status']);router[_0x109d('0x12')](_0x109d('0xb'),auth[_0x109d('0xa')](),controller[_0x109d('0x13')]);router[_0x109d('0x12')](_0x109d('0x14'),auth['isAuthenticated'](),controller[_0x109d('0x15')]);router[_0x109d('0x12')](_0x109d('0x16'),auth[_0x109d('0xa')](),controller[_0x109d('0x17')]);router[_0x109d('0x18')]('/:id',auth[_0x109d('0xa')](),controller[_0x109d('0x19')]);module[_0x109d('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2325ccb..3b1aa93 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 _0x0852=['sequelize','exports','TEXT','medium','BOOLEAN','out','STRING','DATE'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x0852,0x130));var _0x2085=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0852[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x2085('0x0'));module[_0x2085('0x1')]={'body':{'type':Sequelize[_0x2085('0x2')](_0x2085('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x2085('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x2085('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x2085('0x6')](0xbe)},'phone':{'type':Sequelize[_0x2085('0x6')]},'readAt':{'type':Sequelize[_0x2085('0x7')]},'secret':{'type':Sequelize[_0x2085('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2085('0x6')]},'providerResponse':{'type':Sequelize[_0x2085('0x2')]}}; \ No newline at end of file +var _0x12e8=['medium','BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x439aa2,_0x16f27c){var _0x110b71=function(_0x3cc859){while(--_0x3cc859){_0x439aa2['push'](_0x439aa2['shift']());}};_0x110b71(++_0x16f27c);}(_0x12e8,0x195));var _0x812e=function(_0x5bd2bf,_0x549ecf){_0x5bd2bf=_0x5bd2bf-0x0;var _0x3e037a=_0x12e8[_0x5bd2bf];return _0x3e037a;};'use strict';var Sequelize=require(_0x812e('0x0'));module[_0x812e('0x1')]={'body':{'type':Sequelize[_0x812e('0x2')](_0x812e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x812e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x812e('0x5')),'defaultValue':_0x812e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x812e('0x6')](0xbe)},'phone':{'type':Sequelize[_0x812e('0x6')]},'readAt':{'type':Sequelize[_0x812e('0x7')]},'secret':{'type':Sequelize[_0x812e('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x812e('0x6')]},'providerResponse':{'type':Sequelize[_0x812e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 1bb1871..ed1ad1a 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 _0x2079=['RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','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','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','create','body','find','describe','whatsapp-interactions','accept','whatsapp','read','format','UserId','user','get','WhatsappInteraction','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','ContactId','QueryTypes','SELECT','contact','email','agent','interface','SIP/%s','channel','motionChannel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x2079,0x130));var _0x9207=function(_0x49464c,_0x28ade7){_0x49464c=_0x49464c-0x0;var _0x52a620=_0x2079[_0x49464c];return _0x52a620;};'use strict';var emlformat=require(_0x9207('0x0'));var rimraf=require(_0x9207('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9207('0x2'));var rp=require('request-promise');var moment=require(_0x9207('0x3'));var BPromise=require(_0x9207('0x4'));var Mustache=require(_0x9207('0x5'));var util=require(_0x9207('0x6'));var path=require(_0x9207('0x7'));var sox=require(_0x9207('0x8'));var csv=require(_0x9207('0x9'));var ejs=require(_0x9207('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9207('0xb'));var squel=require('squel');var crypto=require(_0x9207('0xc'));var jsforce=require(_0x9207('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9207('0xe'));var Papa=require(_0x9207('0xf'));var Redis=require(_0x9207('0x10'));var authService=require(_0x9207('0x11'));var qs=require(_0x9207('0x12'));var as=require(_0x9207('0x13'));var hardwareService=require(_0x9207('0x14'));var logger=require(_0x9207('0x15'))(_0x9207('0x16'));var utils=require(_0x9207('0x17'));var config=require(_0x9207('0x18'));var licenseUtil=require(_0x9207('0x19'));var db=require(_0x9207('0x1a'))['db'];config[_0x9207('0x1b')]=_[_0x9207('0x1c')](config[_0x9207('0x1b')],{'host':_0x9207('0x1d'),'port':0x18eb});var socket=require(_0x9207('0x1e'))(new Redis(config[_0x9207('0x1b')]));require(_0x9207('0x1f'))[_0x9207('0x20')](socket);var jayson=require(_0x9207('0x21'));var client=jayson[_0x9207('0x22')]['http']({'port':0x232c});var client9002=jayson[_0x9207('0x22')][_0x9207('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2f7ba0,_0x5dfb53,_0x5b4a6d,_0x1511ce){return new BPromise(function(_0x236dee,_0x3ee7f6){var _0x54ffb9=_0x1511ce||client;return _0x54ffb9[_0x9207('0x24')](_0x2f7ba0,_0x5b4a6d)[_0x9207('0x25')](function(_0xd1f188){logger[_0x9207('0x26')](_0x9207('0x27'),_0x5dfb53,_0x9207('0x28'));logger[_0x9207('0x29')](_0x9207('0x2a'),_0x5dfb53,_0x9207('0x28'),JSON['stringify'](_0xd1f188));if(_0xd1f188[_0x9207('0x2b')]){if(_0xd1f188['error'][_0x9207('0x2c')]===0x1f4){logger['error'](_0x9207('0x27'),_0x5dfb53,_0xd1f188['error']['message']);return _0x3ee7f6(_0xd1f188[_0x9207('0x2b')][_0x9207('0x2d')]);}logger['error'](_0x9207('0x27'),_0x5dfb53,_0xd1f188['error'][_0x9207('0x2d')]);return _0x236dee(_0xd1f188[_0x9207('0x2b')][_0x9207('0x2d')]);}else{logger[_0x9207('0x26')](_0x9207('0x27'),_0x5dfb53,_0x9207('0x28'));_0x236dee(_0xd1f188['result'][_0x9207('0x2d')]);}})[_0x9207('0x2e')](function(_0x13b4ed){logger[_0x9207('0x2b')](_0x9207('0x27'),_0x5dfb53,_0x13b4ed);_0x3ee7f6(_0x13b4ed);});});}function respondWithStatusCode(_0x190e65,_0x3ee03c){_0x3ee03c=_0x3ee03c||0xcc;return function(_0x52dd35){if(_0x52dd35){return _0x190e65[_0x9207('0x2f')](_0x3ee03c);}return _0x190e65[_0x9207('0x30')](_0x3ee03c)[_0x9207('0x31')]();};}function respondWithResult(_0x38f6a9,_0x1f3fca){_0x1f3fca=_0x1f3fca||0xc8;return function(_0x2d46af){if(_0x2d46af){return _0x38f6a9[_0x9207('0x30')](_0x1f3fca)[_0x9207('0x32')](_0x2d46af);}};}function respondWithFilteredResult(_0x3fc0e3,_0x5294a8){return function(_0x5ddce1){if(_0x5ddce1){var _0xbe7206=typeof _0x5294a8[_0x9207('0x33')]==='undefined'&&typeof _0x5294a8[_0x9207('0x34')]===_0x9207('0x35');var _0x451ca6=_0x5ddce1[_0x9207('0x36')];var _0x3f4613=_0xbe7206?0x0:_0x5294a8[_0x9207('0x33')];var _0x46d706=_0xbe7206?_0x5ddce1[_0x9207('0x36')]:_0x5294a8['offset']+_0x5294a8[_0x9207('0x34')];var _0x467028;if(_0x46d706>=_0x451ca6){_0x46d706=_0x451ca6;_0x467028=0xc8;}else{_0x467028=0xce;}_0x3fc0e3['status'](_0x467028);return _0x3fc0e3['set'](_0x9207('0x37'),_0x3f4613+'-'+_0x46d706+'/'+_0x451ca6)[_0x9207('0x32')](_0x5ddce1);}return null;};}function patchUpdates(_0x583794){return function(_0x4b2d49){try{jsonpatch[_0x9207('0x38')](_0x4b2d49,_0x583794,!![]);}catch(_0xe055c9){return BPromise[_0x9207('0x39')](_0xe055c9);}return _0x4b2d49[_0x9207('0x3a')]();};}function saveUpdates(_0x732983,_0x4920c1){return function(_0x56a0f0){if(_0x56a0f0){return _0x56a0f0[_0x9207('0x3b')](_0x732983)[_0x9207('0x25')](function(_0x4d64c1){return _0x4d64c1;});}return null;};}function removeEntity(_0x3d269e,_0xe4256b){return function(_0x32a3f7){if(_0x32a3f7){return _0x32a3f7['destroy']()[_0x9207('0x25')](function(){_0x3d269e['status'](0xcc)[_0x9207('0x31')]();});}};}function handleEntityNotFound(_0x336aff,_0x416147){return function(_0x2b7706){if(!_0x2b7706){_0x336aff[_0x9207('0x2f')](0x194);}return _0x2b7706;};}function handleError(_0x1d1c36,_0x37ecef){_0x37ecef=_0x37ecef||0x1f4;return function(_0x3a88ae){logger[_0x9207('0x2b')](_0x3a88ae[_0x9207('0x3c')]);if(_0x3a88ae[_0x9207('0x3d')]){delete _0x3a88ae['name'];}_0x1d1c36[_0x9207('0x30')](_0x37ecef)[_0x9207('0x3e')](_0x3a88ae);};}exports[_0x9207('0x3f')]=function(_0x2d5ef2,_0x2c9631){var _0x3a7847={},_0x47133b={},_0x39a417={'count':0x0,'rows':[]};var _0x94dc59=_[_0x9207('0x40')](db[_0x9207('0x41')][_0x9207('0x42')],function(_0x51e5bd){return{'name':_0x51e5bd[_0x9207('0x43')],'type':_0x51e5bd[_0x9207('0x44')][_0x9207('0x45')]};});_0x47133b[_0x9207('0x46')]=_[_0x9207('0x40')](_0x94dc59,_0x9207('0x3d'));_0x47133b['query']=_[_0x9207('0x47')](_0x2d5ef2[_0x9207('0x48')]);_0x47133b[_0x9207('0x49')]=_[_0x9207('0x4a')](_0x47133b['model'],_0x47133b[_0x9207('0x48')]);_0x3a7847[_0x9207('0x4b')]=_['intersection'](_0x47133b[_0x9207('0x46')],qs[_0x9207('0x4c')](_0x2d5ef2[_0x9207('0x48')][_0x9207('0x4c')]));_0x3a7847[_0x9207('0x4b')]=_0x3a7847[_0x9207('0x4b')][_0x9207('0x4d')]?_0x3a7847['attributes']:_0x47133b['model'];if(!_0x2d5ef2[_0x9207('0x48')][_0x9207('0x4e')](_0x9207('0x4f'))){_0x3a7847['limit']=qs[_0x9207('0x34')](_0x2d5ef2['query'][_0x9207('0x34')]);_0x3a7847['offset']=qs[_0x9207('0x33')](_0x2d5ef2[_0x9207('0x48')]['offset']);}_0x3a7847[_0x9207('0x50')]=qs[_0x9207('0x51')](_0x2d5ef2[_0x9207('0x48')][_0x9207('0x51')]);_0x3a7847['where']=qs['filters'](_['pick'](_0x2d5ef2['query'],_0x47133b[_0x9207('0x49')]),_0x94dc59);if(_0x2d5ef2['query'][_0x9207('0x52')]){_0x3a7847[_0x9207('0x53')]=_[_0x9207('0x54')](_0x3a7847[_0x9207('0x53')],{'$or':_[_0x9207('0x40')](_0x94dc59,function(_0x5d8a4d){if(_0x5d8a4d[_0x9207('0x44')]!==_0x9207('0x55')){var _0x19f586={};_0x19f586[_0x5d8a4d[_0x9207('0x3d')]]={'$like':'%'+_0x2d5ef2[_0x9207('0x48')][_0x9207('0x52')]+'%'};return _0x19f586;}})});}_0x3a7847=_[_0x9207('0x54')]({},_0x3a7847,_0x2d5ef2['options']);var _0x9d3f51={'where':_0x3a7847[_0x9207('0x53')]};return db['WhatsappMessage'][_0x9207('0x36')](_0x9d3f51)['then'](function(_0x536ec5){_0x39a417[_0x9207('0x36')]=_0x536ec5;if(_0x2d5ef2['query'][_0x9207('0x56')]){_0x3a7847[_0x9207('0x57')]=[{'all':!![]}];}return db[_0x9207('0x41')][_0x9207('0x58')](_0x3a7847);})['then'](function(_0x157ab9){_0x39a417[_0x9207('0x59')]=_0x157ab9;return _0x39a417;})['then'](respondWithFilteredResult(_0x2c9631,_0x3a7847))['catch'](handleError(_0x2c9631,null));};exports['show']=function(_0x22e81c,_0x345afd){var _0x1ebf82={'raw':!![],'where':{'id':_0x22e81c[_0x9207('0x5a')]['id']}},_0x1454a1={};_0x1454a1['model']=_[_0x9207('0x47')](db[_0x9207('0x41')]['rawAttributes']);_0x1454a1['query']=_[_0x9207('0x47')](_0x22e81c[_0x9207('0x48')]);_0x1454a1['filters']=_[_0x9207('0x4a')](_0x1454a1['model'],_0x1454a1[_0x9207('0x48')]);_0x1ebf82[_0x9207('0x4b')]=_[_0x9207('0x4a')](_0x1454a1[_0x9207('0x46')],qs[_0x9207('0x4c')](_0x22e81c[_0x9207('0x48')][_0x9207('0x4c')]));_0x1ebf82['attributes']=_0x1ebf82[_0x9207('0x4b')][_0x9207('0x4d')]?_0x1ebf82[_0x9207('0x4b')]:_0x1454a1[_0x9207('0x46')];if(_0x22e81c['query']['includeAll']){_0x1ebf82[_0x9207('0x57')]=[{'all':!![]}];}_0x1ebf82=_['merge']({},_0x1ebf82,_0x22e81c[_0x9207('0x5b')]);return db['WhatsappMessage']['find'](_0x1ebf82)[_0x9207('0x25')](handleEntityNotFound(_0x345afd,null))[_0x9207('0x25')](respondWithResult(_0x345afd,null))[_0x9207('0x2e')](handleError(_0x345afd,null));};exports[_0x9207('0x5c')]=function(_0x11313d,_0x152935){return db[_0x9207('0x41')][_0x9207('0x5c')](_0x11313d['body'],{})[_0x9207('0x25')](respondWithResult(_0x152935,0xc9))[_0x9207('0x2e')](handleError(_0x152935,null));};exports[_0x9207('0x3b')]=function(_0x26550f,_0x28b264){if(_0x26550f[_0x9207('0x5d')]['id']){delete _0x26550f[_0x9207('0x5d')]['id'];}return db[_0x9207('0x41')][_0x9207('0x5e')]({'where':{'id':_0x26550f[_0x9207('0x5a')]['id']}})['then'](handleEntityNotFound(_0x28b264,null))[_0x9207('0x25')](saveUpdates(_0x26550f[_0x9207('0x5d')],null))[_0x9207('0x25')](respondWithResult(_0x28b264,null))['catch'](handleError(_0x28b264,null));};exports['destroy']=function(_0x613573,_0x47e118){return db[_0x9207('0x41')]['find']({'where':{'id':_0x613573['params']['id']}})['then'](handleEntityNotFound(_0x47e118,null))['then'](removeEntity(_0x47e118,null))[_0x9207('0x2e')](handleError(_0x47e118,null));};exports[_0x9207('0x5f')]=function(_0x572775,_0x96cf57){return db[_0x9207('0x41')][_0x9207('0x5f')]()[_0x9207('0x25')](respondWithResult(_0x96cf57,null))[_0x9207('0x2e')](handleError(_0x96cf57,null));};var interaction_log=require(_0x9207('0x15'))(_0x9207('0x60'));exports[_0x9207('0x61')]=function(_0x4051b8,_0x9a3e43,_0x53aff9){var _0x26ac4e={'agent':{},'channel':_0x9207('0x62')};if(_0x4051b8['body']['id']){delete _0x4051b8[_0x9207('0x5d')]['id'];}_0x4051b8[_0x9207('0x5d')][_0x9207('0x63')]=!![];_0x4051b8[_0x9207('0x5d')]['readAt']=moment()[_0x9207('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x4051b8[_0x9207('0x5d')][_0x9207('0x65')]=_0x4051b8['body'][_0x9207('0x65')]||_0x4051b8[_0x9207('0x66')]['id'];_0x26ac4e['agent']['id']=_0x4051b8[_0x9207('0x5d')][_0x9207('0x65')];return db['WhatsappMessage']['find']({'where':{'id':_0x4051b8['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x9a3e43,null))[_0x9207('0x25')](saveUpdates(_0x4051b8['body'],null))[_0x9207('0x25')](function(_0x45695b){if(_0x45695b){_0x26ac4e[_0x9207('0x2d')]=_0x45695b[_0x9207('0x67')]({'plain':!![]});return db[_0x9207('0x68')]['find']({'where':{'id':_0x45695b['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x9a3e43,null))[_0x9207('0x25')](function(_0x94bb33){if(_0x94bb33){return _0x94bb33[_0x9207('0x3b')]({'UserId':_0x4051b8[_0x9207('0x5d')][_0x9207('0x65')],'read1stAt':_[_0x9207('0x69')](_0x94bb33[_0x9207('0x6a')])?moment()[_0x9207('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9207('0x25')](function(_0x2af53f){if(_0x2af53f){_0x26ac4e[_0x9207('0x6b')]=_0x2af53f[_0x9207('0x67')]({'plain':!![]});interaction_log[_0x9207('0x26')](_0x9207('0x6c'),_0x4051b8[_0x9207('0x66')]['id'],_0x4051b8[_0x9207('0x66')]['name'],_0x4051b8['user']['role'],_0x26ac4e[_0x9207('0x6b')]['id'],_0x4051b8[_0x9207('0x5d')]?JSON[_0x9207('0x6d')](_0x4051b8['body']):_0x9207('0x6e'));return respondWithRpcPromise('AcceptMessage',_0x9207('0x6f'),_0x26ac4e);}return null;})[_0x9207('0x25')](function(_0x2cd7f0){var _0x21844b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2cd7f0['message'][_0x9207('0x70')];return db['sequelize']['query'](_0x21844b,{'type':db['Sequelize'][_0x9207('0x71')][_0x9207('0x72')],'raw':!![]})['then'](function(_0x478b5a){return _0x478b5a;});})['then'](function(_0x455c3c){if(_0x455c3c){_0x26ac4e[_0x9207('0x2d')][_0x9207('0x73')]=_0x455c3c[0x0];if(!_0x4051b8[_0x9207('0x5d')]['UserId'])return;return db['User']['find']({'where':{'id':_0x4051b8[_0x9207('0x5d')][_0x9207('0x65')],'role':'agent'},'attributes':['id','name','fullname',_0x9207('0x74'),'internal'],'raw':!![]});}return null;})[_0x9207('0x25')](function(_0x22225a){if(!_0x22225a)return null;_0x26ac4e[_0x9207('0x2d')][_0x9207('0x75')]=_0x22225a;return _0x26ac4e;})[_0x9207('0x25')](function(_0x1d48c8){if(_0x1d48c8){if(_0x4051b8[_0x9207('0x5d')]['manual']){_0x26ac4e['message'][_0x9207('0x76')]=util[_0x9207('0x64')](_0x9207('0x77'),_0x4051b8[_0x9207('0x66')][_0x9207('0x3d')]);_0x26ac4e[_0x9207('0x2d')][_0x9207('0x78')]=_0x26ac4e['channel'];_0x26ac4e['message'][_0x9207('0x79')]=_0x26ac4e[_0x9207('0x78')];_0x26ac4e['message'][_0x9207('0x7a')]=_0x9207('0x61');return respondWithRpcPromise(_0x9207('0x7b'),'EventManager',{'event':'acceptmessage','message':_0x26ac4e['message']},client9002)[_0x9207('0x25')](function(){return _0x26ac4e;});}return _0x26ac4e;}return null;})[_0x9207('0x25')](respondWithResult(_0x9a3e43,null))['catch'](handleError(_0x9a3e43,null));};var interaction_log=require(_0x9207('0x15'))(_0x9207('0x60'));exports[_0x9207('0x39')]=function(_0x1a2e61,_0x22a843,_0xfa8c96){var _0x47e81c={'agent':{},'channel':_0x9207('0x62')};if(_0x1a2e61[_0x9207('0x5d')]['id']){delete _0x1a2e61[_0x9207('0x5d')]['id'];}_0x1a2e61[_0x9207('0x5d')][_0x9207('0x65')]=_0x1a2e61['body'][_0x9207('0x65')]||_0x1a2e61[_0x9207('0x66')]['id'];_0x47e81c[_0x9207('0x75')]['id']=_0x1a2e61['body']['UserId'];return db[_0x9207('0x41')]['find']({'where':{'id':_0x1a2e61[_0x9207('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x22a843,null))[_0x9207('0x25')](function(_0x2501e6){if(_0x2501e6){_0x47e81c[_0x9207('0x2d')]=_0x2501e6['get']({'plain':!![]});return db[_0x9207('0x68')]['find']({'where':{'id':_0x2501e6['WhatsappInteractionId']}});}return null;})[_0x9207('0x25')](handleEntityNotFound(_0x22a843,null))[_0x9207('0x25')](function(_0xcff64d){if(_0xcff64d){_0x47e81c[_0x9207('0x6b')]=_0xcff64d[_0x9207('0x67')]({'plain':!![]});interaction_log[_0x9207('0x26')](_0x9207('0x7c'),_0x1a2e61[_0x9207('0x66')]['id'],_0x1a2e61[_0x9207('0x66')][_0x9207('0x3d')],_0x1a2e61[_0x9207('0x66')]['role'],_0x47e81c[_0x9207('0x6b')]['id'],_0x1a2e61['body']?JSON['stringify'](_0x1a2e61['body']):_0x9207('0x6e'));return respondWithRpcPromise(_0x9207('0x7d'),_0x9207('0x7e'),_0x47e81c);}return null;})[_0x9207('0x25')](function(_0x2da8dc){var _0x444e85=_0x9207('0x7f')+_0x2da8dc[_0x9207('0x2d')][_0x9207('0x70')];return db[_0x9207('0x80')]['query'](_0x444e85,{'type':db[_0x9207('0x81')][_0x9207('0x71')][_0x9207('0x72')],'raw':!![]})[_0x9207('0x25')](function(_0x8f759d){return _0x8f759d;});})['then'](function(_0x349450){if(_0x349450){_0x47e81c[_0x9207('0x2d')]['contact']=_0x349450[0x0];if(!_0x1a2e61[_0x9207('0x5d')][_0x9207('0x65')])return;return db['User'][_0x9207('0x5e')]({'where':{'id':_0x1a2e61[_0x9207('0x5d')]['UserId'],'role':'agent'},'attributes':['id','name',_0x9207('0x82'),_0x9207('0x74'),_0x9207('0x83')],'raw':!![]});}return null;})[_0x9207('0x25')](function(_0x2130bd){if(!_0x2130bd)return null;_0x47e81c[_0x9207('0x2d')][_0x9207('0x75')]=_0x2130bd;return _0x47e81c;})[_0x9207('0x25')](function(_0x5f3dc7){if(_0x5f3dc7){_0x5f3dc7[_0x9207('0x2d')][_0x9207('0x76')]=util[_0x9207('0x64')](_0x9207('0x77'),_0x1a2e61[_0x9207('0x66')][_0x9207('0x3d')]);_0x5f3dc7[_0x9207('0x2d')][_0x9207('0x78')]=_0x47e81c[_0x9207('0x78')];_0x5f3dc7[_0x9207('0x2d')][_0x9207('0x79')]=_0x47e81c['channel'];_0x5f3dc7['message'][_0x9207('0x7a')]=_0x9207('0x39');respondWithRpcPromise('EventManager','EventManager',{'event':_0x9207('0x84'),'message':_0x5f3dc7[_0x9207('0x2d')]},client9002);return _0x47e81c;}return null;})[_0x9207('0x25')](respondWithResult(_0x22a843,null))[_0x9207('0x2e')](handleError(_0x22a843,null));};exports['status']=function(_0x3351b1,_0x30c9f9,_0x317841){if(_0x3351b1[_0x9207('0x5d')]['id']){delete _0x3351b1[_0x9207('0x5d')]['id'];}var _0x3b7998;return db[_0x9207('0x41')]['find']({'where':{'id':_0x3351b1[_0x9207('0x5a')]['id']}})[_0x9207('0x25')](handleEntityNotFound(_0x30c9f9,null))['then'](function(_0x1e231){if(_0x1e231){_0x3b7998=_0x1e231;return db[_0x9207('0x85')][_0x9207('0x5e')]({'where':{'id':_0x1e231[_0x9207('0x86')]}});}})['then'](handleEntityNotFound(_0x30c9f9,null))['then'](function(_0x544947){if(_0x544947){logger[_0x9207('0x29')](_0x9207('0x87'),_0x9207('0x30'),_0x9207('0x88'),_0x544947[_0x9207('0x44')],util[_0x9207('0x89')](_0x3351b1[_0x9207('0x5d')],{'showHidden':![],'depth':null}));switch(_0x544947['type']){case _0x9207('0x8a'):if(_0x3351b1['body'][_0x9207('0x8b')]&&_0x3351b1['body'][_0x9207('0x8b')]===_0x3b7998[_0x9207('0x8c')]&&_0x3351b1['body']['MessageStatus']&&_0x3351b1[_0x9207('0x5d')][_0x9207('0x8d')]===_0x9207('0x63')){return _0x3b7998['update']({'read':!![]});}else{logger[_0x9207('0x2b')](_0x9207('0x8e'),_0x9207('0x30'),_0x9207('0x8a'),util[_0x9207('0x89')](_0x3351b1[_0x9207('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x3b7998;}})[_0x9207('0x25')](respondWithResult(_0x30c9f9,null))[_0x9207('0x2e')](handleError(_0x30c9f9,null));}; \ No newline at end of file +var _0x242f=['WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','reject','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','keys','create','body','find','destroy','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','fullname','interface','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','then','info','request\x20sent','debug'];(function(_0x3ce3d0,_0x597f99){var _0x23cbe9=function(_0x5dd39b){while(--_0x5dd39b){_0x3ce3d0['push'](_0x3ce3d0['shift']());}};_0x23cbe9(++_0x597f99);}(_0x242f,0x6d));var _0xf242=function(_0xba7840,_0x36fac8){_0xba7840=_0xba7840-0x0;var _0x532b9a=_0x242f[_0xba7840];return _0x532b9a;};'use strict';var emlformat=require(_0xf242('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf242('0x1'));var jsonpatch=require(_0xf242('0x2'));var rp=require(_0xf242('0x3'));var moment=require(_0xf242('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf242('0x5'));var util=require(_0xf242('0x6'));var path=require('path');var sox=require(_0xf242('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf242('0x8'));var _=require('lodash');var squel=require(_0xf242('0x9'));var crypto=require(_0xf242('0xa'));var jsforce=require(_0xf242('0xb'));var deskjs=require(_0xf242('0xc'));var toCsv=require(_0xf242('0xd'));var querystring=require(_0xf242('0xe'));var Papa=require(_0xf242('0xf'));var Redis=require(_0xf242('0x10'));var authService=require(_0xf242('0x11'));var qs=require(_0xf242('0x12'));var as=require(_0xf242('0x13'));var hardwareService=require(_0xf242('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xf242('0x15'));var config=require(_0xf242('0x16'));var licenseUtil=require(_0xf242('0x17'));var db=require(_0xf242('0x18'))['db'];config[_0xf242('0x19')]=_[_0xf242('0x1a')](config['redis'],{'host':_0xf242('0x1b'),'port':0x18eb});var socket=require(_0xf242('0x1c'))(new Redis(config[_0xf242('0x19')]));require(_0xf242('0x1d'))[_0xf242('0x1e')](socket);var jayson=require(_0xf242('0x1f'));var client=jayson['client'][_0xf242('0x20')]({'port':0x232c});var client9002=jayson[_0xf242('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53eeb4,_0x470548,_0x406158,_0x4abbed){return new BPromise(function(_0x1975c7,_0x5409c6){var _0x5f195b=_0x4abbed||client;return _0x5f195b['request'](_0x53eeb4,_0x406158)[_0xf242('0x22')](function(_0x417bed){logger[_0xf242('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x470548,_0xf242('0x24'));logger[_0xf242('0x25')](_0xf242('0x26'),_0x470548,_0xf242('0x24'),JSON[_0xf242('0x27')](_0x417bed));if(_0x417bed[_0xf242('0x28')]){if(_0x417bed[_0xf242('0x28')][_0xf242('0x29')]===0x1f4){logger[_0xf242('0x28')](_0xf242('0x2a'),_0x470548,_0x417bed[_0xf242('0x28')][_0xf242('0x2b')]);return _0x5409c6(_0x417bed[_0xf242('0x28')][_0xf242('0x2b')]);}logger[_0xf242('0x28')](_0xf242('0x2a'),_0x470548,_0x417bed[_0xf242('0x28')][_0xf242('0x2b')]);return _0x1975c7(_0x417bed[_0xf242('0x28')][_0xf242('0x2b')]);}else{logger[_0xf242('0x23')](_0xf242('0x2a'),_0x470548,_0xf242('0x24'));_0x1975c7(_0x417bed['result'][_0xf242('0x2b')]);}})[_0xf242('0x2c')](function(_0x421140){logger[_0xf242('0x28')](_0xf242('0x2a'),_0x470548,_0x421140);_0x5409c6(_0x421140);});});}function respondWithStatusCode(_0x20df5f,_0x434b07){_0x434b07=_0x434b07||0xcc;return function(_0x1710ba){if(_0x1710ba){return _0x20df5f[_0xf242('0x2d')](_0x434b07);}return _0x20df5f['status'](_0x434b07)[_0xf242('0x2e')]();};}function respondWithResult(_0x1b3eab,_0x477c24){_0x477c24=_0x477c24||0xc8;return function(_0x33a891){if(_0x33a891){return _0x1b3eab['status'](_0x477c24)[_0xf242('0x2f')](_0x33a891);}};}function respondWithFilteredResult(_0xfe68ff,_0x240648){return function(_0x33afdd){if(_0x33afdd){var _0x296702=typeof _0x240648['offset']===_0xf242('0x30')&&typeof _0x240648[_0xf242('0x31')]==='undefined';var _0x4617f9=_0x33afdd[_0xf242('0x32')];var _0x4f5ad0=_0x296702?0x0:_0x240648[_0xf242('0x33')];var _0x2d4c77=_0x296702?_0x33afdd[_0xf242('0x32')]:_0x240648['offset']+_0x240648[_0xf242('0x31')];var _0x2039e9;if(_0x2d4c77>=_0x4617f9){_0x2d4c77=_0x4617f9;_0x2039e9=0xc8;}else{_0x2039e9=0xce;}_0xfe68ff['status'](_0x2039e9);return _0xfe68ff[_0xf242('0x34')](_0xf242('0x35'),_0x4f5ad0+'-'+_0x2d4c77+'/'+_0x4617f9)[_0xf242('0x2f')](_0x33afdd);}return null;};}function patchUpdates(_0x4d1777){return function(_0x1076c9){try{jsonpatch['apply'](_0x1076c9,_0x4d1777,!![]);}catch(_0x81d328){return BPromise[_0xf242('0x36')](_0x81d328);}return _0x1076c9['save']();};}function saveUpdates(_0x498829,_0x4dc597){return function(_0x186575){if(_0x186575){return _0x186575['update'](_0x498829)['then'](function(_0x587282){return _0x587282;});}return null;};}function removeEntity(_0x525d96,_0x377d3e){return function(_0x1e2bf2){if(_0x1e2bf2){return _0x1e2bf2['destroy']()[_0xf242('0x22')](function(){_0x525d96['status'](0xcc)[_0xf242('0x2e')]();});}};}function handleEntityNotFound(_0x30c4b1,_0x238239){return function(_0xd127af){if(!_0xd127af){_0x30c4b1[_0xf242('0x2d')](0x194);}return _0xd127af;};}function handleError(_0x35e837,_0x5bc530){_0x5bc530=_0x5bc530||0x1f4;return function(_0x302e7d){logger['error'](_0x302e7d[_0xf242('0x37')]);if(_0x302e7d['name']){delete _0x302e7d[_0xf242('0x38')];}_0x35e837['status'](_0x5bc530)[_0xf242('0x39')](_0x302e7d);};}exports[_0xf242('0x3a')]=function(_0x4074dc,_0x1b1c84){var _0x1bfc34={},_0x150a39={},_0x28cf02={'count':0x0,'rows':[]};var _0xf904e=_[_0xf242('0x3b')](db[_0xf242('0x3c')][_0xf242('0x3d')],function(_0x670a42){return{'name':_0x670a42[_0xf242('0x3e')],'type':_0x670a42[_0xf242('0x3f')][_0xf242('0x40')]};});_0x150a39[_0xf242('0x41')]=_[_0xf242('0x3b')](_0xf904e,'name');_0x150a39[_0xf242('0x42')]=_['keys'](_0x4074dc[_0xf242('0x42')]);_0x150a39[_0xf242('0x43')]=_[_0xf242('0x44')](_0x150a39['model'],_0x150a39[_0xf242('0x42')]);_0x1bfc34['attributes']=_[_0xf242('0x44')](_0x150a39[_0xf242('0x41')],qs[_0xf242('0x45')](_0x4074dc[_0xf242('0x42')][_0xf242('0x45')]));_0x1bfc34[_0xf242('0x46')]=_0x1bfc34[_0xf242('0x46')][_0xf242('0x47')]?_0x1bfc34['attributes']:_0x150a39[_0xf242('0x41')];if(!_0x4074dc[_0xf242('0x42')][_0xf242('0x48')](_0xf242('0x49'))){_0x1bfc34[_0xf242('0x31')]=qs['limit'](_0x4074dc[_0xf242('0x42')][_0xf242('0x31')]);_0x1bfc34['offset']=qs['offset'](_0x4074dc[_0xf242('0x42')]['offset']);}_0x1bfc34[_0xf242('0x4a')]=qs[_0xf242('0x4b')](_0x4074dc[_0xf242('0x42')][_0xf242('0x4b')]);_0x1bfc34[_0xf242('0x4c')]=qs[_0xf242('0x43')](_[_0xf242('0x4d')](_0x4074dc[_0xf242('0x42')],_0x150a39[_0xf242('0x43')]),_0xf904e);if(_0x4074dc[_0xf242('0x42')][_0xf242('0x4e')]){_0x1bfc34[_0xf242('0x4c')]=_[_0xf242('0x4f')](_0x1bfc34[_0xf242('0x4c')],{'$or':_[_0xf242('0x3b')](_0xf904e,function(_0x503682){if(_0x503682[_0xf242('0x3f')]!=='VIRTUAL'){var _0x280e3b={};_0x280e3b[_0x503682[_0xf242('0x38')]]={'$like':'%'+_0x4074dc['query'][_0xf242('0x4e')]+'%'};return _0x280e3b;}})});}_0x1bfc34=_['merge']({},_0x1bfc34,_0x4074dc[_0xf242('0x50')]);var _0x4c998e={'where':_0x1bfc34[_0xf242('0x4c')]};return db[_0xf242('0x3c')][_0xf242('0x32')](_0x4c998e)[_0xf242('0x22')](function(_0xb9ebb3){_0x28cf02[_0xf242('0x32')]=_0xb9ebb3;if(_0x4074dc[_0xf242('0x42')][_0xf242('0x51')]){_0x1bfc34[_0xf242('0x52')]=[{'all':!![]}];}return db['WhatsappMessage'][_0xf242('0x53')](_0x1bfc34);})[_0xf242('0x22')](function(_0x3240c7){_0x28cf02['rows']=_0x3240c7;return _0x28cf02;})['then'](respondWithFilteredResult(_0x1b1c84,_0x1bfc34))['catch'](handleError(_0x1b1c84,null));};exports[_0xf242('0x54')]=function(_0x48a035,_0xf79a1){var _0x2425e4={'raw':!![],'where':{'id':_0x48a035[_0xf242('0x55')]['id']}},_0x4ef93e={};_0x4ef93e[_0xf242('0x41')]=_[_0xf242('0x56')](db[_0xf242('0x3c')]['rawAttributes']);_0x4ef93e[_0xf242('0x42')]=_[_0xf242('0x56')](_0x48a035[_0xf242('0x42')]);_0x4ef93e[_0xf242('0x43')]=_[_0xf242('0x44')](_0x4ef93e[_0xf242('0x41')],_0x4ef93e['query']);_0x2425e4[_0xf242('0x46')]=_['intersection'](_0x4ef93e['model'],qs['fields'](_0x48a035[_0xf242('0x42')][_0xf242('0x45')]));_0x2425e4[_0xf242('0x46')]=_0x2425e4[_0xf242('0x46')][_0xf242('0x47')]?_0x2425e4['attributes']:_0x4ef93e[_0xf242('0x41')];if(_0x48a035['query'][_0xf242('0x51')]){_0x2425e4[_0xf242('0x52')]=[{'all':!![]}];}_0x2425e4=_['merge']({},_0x2425e4,_0x48a035['options']);return db[_0xf242('0x3c')]['find'](_0x2425e4)['then'](handleEntityNotFound(_0xf79a1,null))[_0xf242('0x22')](respondWithResult(_0xf79a1,null))[_0xf242('0x2c')](handleError(_0xf79a1,null));};exports['create']=function(_0x2c8e5d,_0x54c411){return db[_0xf242('0x3c')][_0xf242('0x57')](_0x2c8e5d[_0xf242('0x58')],{})[_0xf242('0x22')](respondWithResult(_0x54c411,0xc9))[_0xf242('0x2c')](handleError(_0x54c411,null));};exports['update']=function(_0x496f62,_0x1967ed){if(_0x496f62[_0xf242('0x58')]['id']){delete _0x496f62[_0xf242('0x58')]['id'];}return db[_0xf242('0x3c')][_0xf242('0x59')]({'where':{'id':_0x496f62[_0xf242('0x55')]['id']}})['then'](handleEntityNotFound(_0x1967ed,null))['then'](saveUpdates(_0x496f62['body'],null))[_0xf242('0x22')](respondWithResult(_0x1967ed,null))['catch'](handleError(_0x1967ed,null));};exports[_0xf242('0x5a')]=function(_0x2b9132,_0x4de1b9){return db[_0xf242('0x3c')][_0xf242('0x59')]({'where':{'id':_0x2b9132[_0xf242('0x55')]['id']}})[_0xf242('0x22')](handleEntityNotFound(_0x4de1b9,null))[_0xf242('0x22')](removeEntity(_0x4de1b9,null))[_0xf242('0x2c')](handleError(_0x4de1b9,null));};exports[_0xf242('0x5b')]=function(_0x5d0c1,_0x42580a){return db[_0xf242('0x3c')]['describe']()['then'](respondWithResult(_0x42580a,null))[_0xf242('0x2c')](handleError(_0x42580a,null));};var interaction_log=require(_0xf242('0x5c'))(_0xf242('0x5d'));exports[_0xf242('0x5e')]=function(_0x48b657,_0x287bad,_0x54be1f){var _0x27efd9={'agent':{},'channel':_0xf242('0x5f')};if(_0x48b657[_0xf242('0x58')]['id']){delete _0x48b657[_0xf242('0x58')]['id'];}_0x48b657[_0xf242('0x58')][_0xf242('0x60')]=!![];_0x48b657[_0xf242('0x58')][_0xf242('0x61')]=moment()[_0xf242('0x62')](_0xf242('0x63'));_0x48b657[_0xf242('0x58')][_0xf242('0x64')]=_0x48b657[_0xf242('0x58')][_0xf242('0x64')]||_0x48b657[_0xf242('0x65')]['id'];_0x27efd9[_0xf242('0x66')]['id']=_0x48b657[_0xf242('0x58')][_0xf242('0x64')];return db[_0xf242('0x3c')][_0xf242('0x59')]({'where':{'id':_0x48b657[_0xf242('0x55')]['id'],'UserId':null}})[_0xf242('0x22')](handleEntityNotFound(_0x287bad,null))['then'](saveUpdates(_0x48b657[_0xf242('0x58')],null))[_0xf242('0x22')](function(_0x3656e1){if(_0x3656e1){_0x27efd9[_0xf242('0x2b')]=_0x3656e1[_0xf242('0x67')]({'plain':!![]});return db[_0xf242('0x68')][_0xf242('0x59')]({'where':{'id':_0x3656e1[_0xf242('0x69')]}});}return null;})[_0xf242('0x22')](handleEntityNotFound(_0x287bad,null))[_0xf242('0x22')](function(_0x110ac8){if(_0x110ac8){return _0x110ac8['update']({'UserId':_0x48b657[_0xf242('0x58')][_0xf242('0x64')],'read1stAt':_[_0xf242('0x6a')](_0x110ac8['read1stAt'])?moment()[_0xf242('0x62')](_0xf242('0x63')):undefined});}return null;})['then'](function(_0x179b88){if(_0x179b88){_0x27efd9[_0xf242('0x6b')]=_0x179b88[_0xf242('0x67')]({'plain':!![]});interaction_log[_0xf242('0x23')](_0xf242('0x6c'),_0x48b657[_0xf242('0x65')]['id'],_0x48b657[_0xf242('0x65')][_0xf242('0x38')],_0x48b657[_0xf242('0x65')]['role'],_0x27efd9[_0xf242('0x6b')]['id'],_0x48b657[_0xf242('0x58')]?JSON[_0xf242('0x27')](_0x48b657[_0xf242('0x58')]):_0xf242('0x6d'));return respondWithRpcPromise(_0xf242('0x6e'),_0xf242('0x6f'),_0x27efd9);}return null;})['then'](function(_0x1110b2){var _0x3f7256='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1110b2[_0xf242('0x2b')]['ContactId'];return db[_0xf242('0x70')][_0xf242('0x42')](_0x3f7256,{'type':db[_0xf242('0x71')][_0xf242('0x72')][_0xf242('0x73')],'raw':!![]})[_0xf242('0x22')](function(_0x1b9dc8){return _0x1b9dc8;});})[_0xf242('0x22')](function(_0x1f5d90){if(_0x1f5d90){_0x27efd9[_0xf242('0x2b')][_0xf242('0x74')]=_0x1f5d90[0x0];if(!_0x48b657[_0xf242('0x58')][_0xf242('0x64')])return;return db[_0xf242('0x75')][_0xf242('0x59')]({'where':{'id':_0x48b657[_0xf242('0x58')]['UserId'],'role':_0xf242('0x66')},'attributes':['id',_0xf242('0x38'),'fullname',_0xf242('0x76'),_0xf242('0x77')],'raw':!![]});}return null;})[_0xf242('0x22')](function(_0x2df131){if(!_0x2df131)return null;_0x27efd9['message']['agent']=_0x2df131;return _0x27efd9;})[_0xf242('0x22')](function(_0x5bf203){if(_0x5bf203){if(_0x48b657[_0xf242('0x58')][_0xf242('0x78')]){_0x27efd9['message']['interface']=util['format'](_0xf242('0x79'),_0x48b657[_0xf242('0x65')][_0xf242('0x38')]);_0x27efd9[_0xf242('0x2b')][_0xf242('0x7a')]=_0x27efd9[_0xf242('0x7a')];_0x27efd9[_0xf242('0x2b')][_0xf242('0x7b')]=_0x27efd9[_0xf242('0x7a')];_0x27efd9['message']['event']=_0xf242('0x5e');return respondWithRpcPromise('EventManager',_0xf242('0x7c'),{'event':_0xf242('0x7d'),'message':_0x27efd9[_0xf242('0x2b')]},client9002)['then'](function(){return _0x27efd9;});}return _0x27efd9;}return null;})['then'](respondWithResult(_0x287bad,null))[_0xf242('0x2c')](handleError(_0x287bad,null));};var interaction_log=require('../../config/logger')(_0xf242('0x5d'));exports[_0xf242('0x36')]=function(_0x59c0ed,_0x40a243,_0xcab383){var _0x1df906={'agent':{},'channel':_0xf242('0x5f')};if(_0x59c0ed['body']['id']){delete _0x59c0ed[_0xf242('0x58')]['id'];}_0x59c0ed[_0xf242('0x58')][_0xf242('0x64')]=_0x59c0ed[_0xf242('0x58')][_0xf242('0x64')]||_0x59c0ed[_0xf242('0x65')]['id'];_0x1df906[_0xf242('0x66')]['id']=_0x59c0ed[_0xf242('0x58')][_0xf242('0x64')];return db['WhatsappMessage'][_0xf242('0x59')]({'where':{'id':_0x59c0ed[_0xf242('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x40a243,null))[_0xf242('0x22')](function(_0x4ce10c){if(_0x4ce10c){_0x1df906['message']=_0x4ce10c['get']({'plain':!![]});return db['WhatsappInteraction'][_0xf242('0x59')]({'where':{'id':_0x4ce10c[_0xf242('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x40a243,null))[_0xf242('0x22')](function(_0x501c76){if(_0x501c76){_0x1df906[_0xf242('0x6b')]=_0x501c76[_0xf242('0x67')]({'plain':!![]});interaction_log[_0xf242('0x23')](_0xf242('0x7e'),_0x59c0ed[_0xf242('0x65')]['id'],_0x59c0ed[_0xf242('0x65')][_0xf242('0x38')],_0x59c0ed['user'][_0xf242('0x7f')],_0x1df906['interaction']['id'],_0x59c0ed[_0xf242('0x58')]?JSON['stringify'](_0x59c0ed[_0xf242('0x58')]):_0xf242('0x6d'));return respondWithRpcPromise(_0xf242('0x80'),_0xf242('0x81'),_0x1df906);}return null;})['then'](function(_0x4949f2){var _0x3d38dc=_0xf242('0x82')+_0x4949f2['message'][_0xf242('0x83')];return db['sequelize'][_0xf242('0x42')](_0x3d38dc,{'type':db[_0xf242('0x71')][_0xf242('0x72')][_0xf242('0x73')],'raw':!![]})[_0xf242('0x22')](function(_0x324974){return _0x324974;});})['then'](function(_0x5927d9){if(_0x5927d9){_0x1df906[_0xf242('0x2b')]['contact']=_0x5927d9[0x0];if(!_0x59c0ed[_0xf242('0x58')][_0xf242('0x64')])return;return db[_0xf242('0x75')]['find']({'where':{'id':_0x59c0ed[_0xf242('0x58')][_0xf242('0x64')],'role':_0xf242('0x66')},'attributes':['id',_0xf242('0x38'),_0xf242('0x84'),_0xf242('0x76'),'internal'],'raw':!![]});}return null;})[_0xf242('0x22')](function(_0x4f3b7c){if(!_0x4f3b7c)return null;_0x1df906[_0xf242('0x2b')][_0xf242('0x66')]=_0x4f3b7c;return _0x1df906;})['then'](function(_0x5eeb75){if(_0x5eeb75){_0x5eeb75[_0xf242('0x2b')][_0xf242('0x85')]=util[_0xf242('0x62')](_0xf242('0x79'),_0x59c0ed['user'][_0xf242('0x38')]);_0x5eeb75['message'][_0xf242('0x7a')]=_0x1df906['channel'];_0x5eeb75[_0xf242('0x2b')][_0xf242('0x7b')]=_0x1df906[_0xf242('0x7a')];_0x5eeb75[_0xf242('0x2b')][_0xf242('0x86')]=_0xf242('0x36');respondWithRpcPromise(_0xf242('0x7c'),'EventManager',{'event':_0xf242('0x87'),'message':_0x5eeb75[_0xf242('0x2b')]},client9002);return _0x1df906;}return null;})[_0xf242('0x22')](respondWithResult(_0x40a243,null))[_0xf242('0x2c')](handleError(_0x40a243,null));};exports['status']=function(_0x3c678a,_0x16308e,_0x3494f4){if(_0x3c678a[_0xf242('0x58')]['id']){delete _0x3c678a['body']['id'];}var _0x3d5fa5;return db[_0xf242('0x3c')][_0xf242('0x59')]({'where':{'id':_0x3c678a[_0xf242('0x55')]['id']}})[_0xf242('0x22')](handleEntityNotFound(_0x16308e,null))[_0xf242('0x22')](function(_0x2215ff){if(_0x2215ff){_0x3d5fa5=_0x2215ff;return db[_0xf242('0x88')][_0xf242('0x59')]({'where':{'id':_0x2215ff[_0xf242('0x89')]}});}})[_0xf242('0x22')](handleEntityNotFound(_0x16308e,null))[_0xf242('0x22')](function(_0x463db0){if(_0x463db0){logger['debug'](_0xf242('0x8a'),_0xf242('0x8b'),_0xf242('0x8c'),_0x463db0['type'],util['inspect'](_0x3c678a[_0xf242('0x58')],{'showHidden':![],'depth':null}));switch(_0x463db0[_0xf242('0x3f')]){case _0xf242('0x8d'):if(_0x3c678a[_0xf242('0x58')][_0xf242('0x8e')]&&_0x3c678a['body'][_0xf242('0x8e')]===_0x3d5fa5[_0xf242('0x8f')]&&_0x3c678a[_0xf242('0x58')][_0xf242('0x90')]&&_0x3c678a[_0xf242('0x58')][_0xf242('0x90')]===_0xf242('0x60')){return _0x3d5fa5['update']({'read':!![]});}else{logger[_0xf242('0x28')](_0xf242('0x91'),_0xf242('0x8b'),_0xf242('0x8d'),util[_0xf242('0x92')](_0x3c678a[_0xf242('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3d5fa5;}})[_0xf242('0x22')](respondWithResult(_0x16308e,null))['catch'](handleError(_0x16308e,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 77e4e1f..3e8f8f2 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 _0x705f=['update','remove','emit','hasOwnProperty','hook','WhatsappMessage','save'];(function(_0x3d8149,_0x249407){var _0x1d60fa=function(_0x285c02){while(--_0x285c02){_0x3d8149['push'](_0x3d8149['shift']());}};_0x1d60fa(++_0x249407);}(_0x705f,0x75));var _0xf705=function(_0x4f6ea8,_0x191395){_0x4f6ea8=_0x4f6ea8-0x0;var _0x39f538=_0x705f[_0x4f6ea8];return _0x39f538;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xf705('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf705('0x1'),'afterUpdate':_0xf705('0x2'),'afterDestroy':_0xf705('0x3')};function emitEvent(_0x35760c){return function(_0x1dd679,_0x47514c,_0x9045cf){WhatsappMessageEvents[_0xf705('0x4')](_0x35760c+':'+_0x1dd679['id'],_0x1dd679);WhatsappMessageEvents[_0xf705('0x4')](_0x35760c,_0x1dd679);_0x9045cf(null);};}for(var e in events){if(events[_0xf705('0x5')](e)){var event=events[e];WhatsappMessage[_0xf705('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9c2c=['events','../../mysqldb','update','emit','hasOwnProperty','hook','exports'];(function(_0x112eb2,_0x369928){var _0x2ac36b=function(_0xbf3657){while(--_0xbf3657){_0x112eb2['push'](_0x112eb2['shift']());}};_0x2ac36b(++_0x369928);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc9c2('0x0'));var WhatsappMessage=require(_0xc9c2('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9c2('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3d0e43){return function(_0x14e513,_0x5bf334,_0x4db342){WhatsappMessageEvents[_0xc9c2('0x3')](_0x3d0e43+':'+_0x14e513['id'],_0x14e513);WhatsappMessageEvents['emit'](_0x3d0e43,_0x14e513);_0x4db342(null);};}for(var e in events){if(events[_0xc9c2('0x4')](e)){var event=events[e];WhatsappMessage[_0xc9c2('0x5')](e,emitEvent(event));}}module[_0xc9c2('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 79b50dd..9a50779 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 _0xbf40=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','findOne','update','createdAt','catch','error','then','type','twilio','accountSid','phone','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','Bearer\x20','application/json','statuses','message_id','WhatsappMessage,\x20%s','finally'];(function(_0x5e033c,_0x109af1){var _0x12eeef=function(_0x4590dc){while(--_0x4590dc){_0x5e033c['push'](_0x5e033c['shift']());}};_0x12eeef(++_0x109af1);}(_0xbf40,0xad));var _0x0bf4=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xbf40[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0x0bf4('0x0'));var util=require(_0x0bf4('0x1'));var logger=require(_0x0bf4('0x2'))(_0x0bf4('0x3'));var moment=require(_0x0bf4('0x4'));var BPromise=require(_0x0bf4('0x5'));var rp=require(_0x0bf4('0x6'));var fetch=require(_0x0bf4('0x7'));var fs=require('fs');var path=require(_0x0bf4('0x8'));var rimraf=require(_0x0bf4('0x9'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x3595c3,_0x4d9f46){return _0x3595c3[_0x0bf4('0xa')]('WhatsappMessage',attributes,{'tableName':_0x0bf4('0xb'),'paranoid':![],'indexes':[{'name':_0x0bf4('0xc'),'fields':['messageId']},{'name':_0x0bf4('0xd'),'fields':[_0x0bf4('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xea0a34,_0x43a4ff,_0x2d3559){var _0x5d8858=_0x3595c3[_0x0bf4('0xf')];var _0x214d8d=_0xea0a34[_0x0bf4('0x10')]({'plain':!![]});if(_0x214d8d[_0x0bf4('0x11')][_0x0bf4('0x12')]()==='in'||_0x214d8d[_0x0bf4('0x11')]['toLowerCase']()===_0x0bf4('0x13')&&!_0x214d8d[_0x0bf4('0x14')]&&!_[_0x0bf4('0x15')](_0x214d8d['UserId'])){_0x5d8858[_0x0bf4('0x16')][_0x0bf4('0x17')]({'where':{'id':_0x214d8d['WhatsappInteractionId']}})['then'](function(_0x377da7){if(_0x377da7){_0x377da7[_0x0bf4('0x18')]({'lastMsgAt':_0x214d8d[_0x0bf4('0x19')],'lastMsgDirection':_0x214d8d[_0x0bf4('0x11')][_0x0bf4('0x12')]()});}})[_0x0bf4('0x1a')](function(_0x1f5817){console[_0x0bf4('0x1b')](_0x1f5817);});}if(_0x214d8d['direction']===_0x0bf4('0x13')&&!_0x214d8d['secret']){var _0x332c10;_0x5d8858['WhatsappAccount']['find']({'where':{'id':_0x214d8d['WhatsappAccountId']},'raw':!![]})[_0x0bf4('0x1c')](function(_0x4c29a2){_0x332c10=_0x4c29a2;if(_0x332c10&&_0x332c10[_0x0bf4('0x1d')]){switch(_0x332c10['type']){case _0x0bf4('0x1e'):var _0x4eb684=require(_0x0bf4('0x1e'));if(_0x332c10[_0x0bf4('0x1f')]&&_0x332c10['authToken']&&_0x332c10[_0x0bf4('0x20')]){var _0x532a52=new _0x4eb684(_0x332c10[_0x0bf4('0x1f')],_0x332c10[_0x0bf4('0x21')]);_0x532a52['messages'][_0x0bf4('0x22')]({'body':_0x214d8d['body'],'to':_0x0bf4('0x23')+_0x214d8d[_0x0bf4('0x20')],'from':_0x0bf4('0x23')+_0x332c10['phone'],'statusCallback':_0x332c10[_0x0bf4('0x24')]+_0x0bf4('0x25')+_0x214d8d['id']+_0x0bf4('0x26')+_0x332c10[_0x0bf4('0x27')]})[_0x0bf4('0x1c')](function(_0x3a753d){if(_0x3a753d[_0x0bf4('0x28')]){return _0xea0a34[_0x0bf4('0x18')]({'messageId':_0x3a753d[_0x0bf4('0x28')]});}})[_0x0bf4('0x1a')](function(_0x285a10){logger[_0x0bf4('0x1b')](_0x0bf4('0x29'),_0x0bf4('0x2a'),_0x0bf4('0x1e'),util[_0x0bf4('0x2b')](_0x285a10,{'showHidden':![],'depth':null}));});}else{logger[_0x0bf4('0x1b')](_0x0bf4('0x29'),_0x0bf4('0x2a'),_0x0bf4('0x1e'),_0x0bf4('0x2c'));}break;case _0x0bf4('0x2d'):var _0x191187=_0x332c10['accountSid'];var _0x1741c5=_0x332c10['authToken'];var _0x458ab0=_0x332c10[_0x0bf4('0x2e')]+'/whatsapp/v1/'+_0x191187+_0x0bf4('0x2f');var _0x7e84ac={'to':[_0x214d8d['phone']],'message':{'type':_0x0bf4('0x30'),'text':_0x214d8d[_0x0bf4('0xe')]}};var _0x4de9ed={'method':'POST','uri':_0x458ab0,'headers':{'Authorization':_0x0bf4('0x31')+_0x1741c5,'Content-Type':_0x0bf4('0x32')},'body':_0x7e84ac,'json':!![]};rp(_0x4de9ed)[_0x0bf4('0x1c')](function(_0x477174){if(_0x477174[_0x0bf4('0x33')][0x0][_0x0bf4('0x34')]){return _0xea0a34['update']({'messageId':_0x477174[_0x0bf4('0x33')][0x0][_0x0bf4('0x34')]});}})[_0x0bf4('0x1a')](function(_0x42c912){logger['err'](_0x0bf4('0x35'),_0x42c912);});break;}}})[_0x0bf4('0x36')](function(){_0x2d3559();});}else{_0x2d3559();}}},'charset':_0x0bf4('0x37'),'collate':_0x0bf4('0x38')});}; \ No newline at end of file +var _0x98d5=['WhatsappAccountId','then','type','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','message_id','statuses','finally','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','error','find'];(function(_0x1e2080,_0x53283b){var _0x260111=function(_0x15da5e){while(--_0x15da5e){_0x1e2080['push'](_0x1e2080['shift']());}};_0x260111(++_0x53283b);}(_0x98d5,0x157));var _0x598d=function(_0x2e4c36,_0xcc49f6){_0x2e4c36=_0x2e4c36-0x0;var _0x5d71a0=_0x98d5[_0x2e4c36];return _0x5d71a0;};'use strict';var _=require(_0x598d('0x0'));var util=require(_0x598d('0x1'));var logger=require(_0x598d('0x2'))(_0x598d('0x3'));var moment=require(_0x598d('0x4'));var BPromise=require(_0x598d('0x5'));var rp=require(_0x598d('0x6'));var fetch=require(_0x598d('0x7'));var fs=require('fs');var path=require(_0x598d('0x8'));var rimraf=require('rimraf');var config=require(_0x598d('0x9'));var attributes=require(_0x598d('0xa'));module[_0x598d('0xb')]=function(_0x1e5ada,_0x36b2c9){return _0x1e5ada['define']('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x598d('0xc'),'fields':[_0x598d('0xc')]},{'name':_0x598d('0xd'),'fields':[_0x598d('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c62d7,_0x55146d,_0xec0cb5){var _0x18df63=_0x1e5ada[_0x598d('0xf')];var _0x36a557=_0x1c62d7['get']({'plain':!![]});if(_0x36a557[_0x598d('0x10')]['toLowerCase']()==='in'||_0x36a557['direction'][_0x598d('0x11')]()===_0x598d('0x12')&&!_0x36a557[_0x598d('0x13')]&&!_[_0x598d('0x14')](_0x36a557[_0x598d('0x15')])){_0x18df63[_0x598d('0x16')][_0x598d('0x17')]({'where':{'id':_0x36a557['WhatsappInteractionId']}})['then'](function(_0xc2abea){if(_0xc2abea){_0xc2abea[_0x598d('0x18')]({'lastMsgAt':_0x36a557[_0x598d('0x19')],'lastMsgDirection':_0x36a557[_0x598d('0x10')][_0x598d('0x11')]()});}})['catch'](function(_0x31399a){console[_0x598d('0x1a')](_0x31399a);});}if(_0x36a557[_0x598d('0x10')]==='out'&&!_0x36a557[_0x598d('0x13')]){var _0x25a06c;_0x18df63['WhatsappAccount'][_0x598d('0x1b')]({'where':{'id':_0x36a557[_0x598d('0x1c')]},'raw':!![]})[_0x598d('0x1d')](function(_0x3ee609){_0x25a06c=_0x3ee609;if(_0x25a06c&&_0x25a06c[_0x598d('0x1e')]){switch(_0x25a06c[_0x598d('0x1e')]){case'twilio':var _0x33f68e=require('twilio');if(_0x25a06c['accountSid']&&_0x25a06c[_0x598d('0x1f')]&&_0x25a06c[_0x598d('0x20')]){var _0xe9eb0=new _0x33f68e(_0x25a06c[_0x598d('0x21')],_0x25a06c[_0x598d('0x1f')]);_0xe9eb0[_0x598d('0x22')][_0x598d('0x23')]({'body':_0x36a557[_0x598d('0xe')],'to':_0x598d('0x24')+_0x36a557['phone'],'from':_0x598d('0x24')+_0x25a06c[_0x598d('0x20')],'statusCallback':_0x25a06c[_0x598d('0x25')]+'/api/whatsapp/messages/'+_0x36a557['id']+_0x598d('0x26')+_0x25a06c['token']})[_0x598d('0x1d')](function(_0x4801ea){if(_0x4801ea[_0x598d('0x27')]){return _0x1c62d7['update']({'messageId':_0x4801ea[_0x598d('0x27')]});}})[_0x598d('0x28')](function(_0x437f1b){logger[_0x598d('0x1a')](_0x598d('0x29'),'afterCreate','twilio',util[_0x598d('0x2a')](_0x437f1b,{'showHidden':![],'depth':null}));});}else{logger[_0x598d('0x1a')](_0x598d('0x29'),'afterCreate','twilio',_0x598d('0x2b'));}break;case _0x598d('0x2c'):var _0x2c176f=_0x25a06c['accountSid'];var _0x592957=_0x25a06c['authToken'];var _0x260cfd=_0x25a06c['baseUrl']+_0x598d('0x2d')+_0x2c176f+_0x598d('0x2e');var _0x43fb37={'to':[_0x36a557[_0x598d('0x20')]],'message':{'type':_0x598d('0x2f'),'text':_0x36a557[_0x598d('0xe')]}};var _0x316a10={'method':'POST','uri':_0x260cfd,'headers':{'Authorization':_0x598d('0x30')+_0x592957,'Content-Type':_0x598d('0x31')},'body':_0x43fb37,'json':!![]};rp(_0x316a10)[_0x598d('0x1d')](function(_0x13df30){if(_0x13df30['statuses'][0x0][_0x598d('0x32')]){return _0x1c62d7[_0x598d('0x18')]({'messageId':_0x13df30[_0x598d('0x33')][0x0][_0x598d('0x32')]});}})[_0x598d('0x28')](function(_0x2e50be){logger['err']('WhatsappMessage,\x20%s',_0x2e50be);});break;}}})[_0x598d('0x34')](function(){_0xec0cb5();});}else{_0xec0cb5();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d644f16..3387755 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 _0x270e=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','util','bluebird','randomstring'];(function(_0x1a2edb,_0x352c06){var _0x437395=function(_0x17469f){while(--_0x17469f){_0x1a2edb['push'](_0x1a2edb['shift']());}};_0x437395(++_0x352c06);}(_0x270e,0x98));var _0xe270=function(_0x4e664c,_0x47abb9){_0x4e664c=_0x4e664c-0x0;var _0x5f3913=_0x270e[_0x4e664c];return _0x5f3913;};'use strict';var _=require('lodash');var util=require(_0xe270('0x0'));var moment=require('moment');var BPromise=require(_0xe270('0x1'));var rs=require(_0xe270('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe270('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe270('0x4'))(_0xe270('0x5'));var config=require(_0xe270('0x6'));var jayson=require(_0xe270('0x7'));var client=jayson[_0xe270('0x8')]['http']({'port':0x232a});config[_0xe270('0x9')]=_[_0xe270('0xa')](config[_0xe270('0x9')],{'host':_0xe270('0xb'),'port':0x18eb});var socket=require(_0xe270('0xc'))(new Redis(config[_0xe270('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x5dc37d,_0x311591,_0x1b2203){return new BPromise(function(_0x3d2913,_0xb06f4d){return client[_0xe270('0xd')](_0x5dc37d,_0x1b2203)[_0xe270('0xe')](function(_0x2ff9b6){logger[_0xe270('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x311591,_0xe270('0x10'));logger['debug'](_0xe270('0x11'),_0x311591,_0xe270('0x10'),JSON['stringify'](_0x2ff9b6));if(_0x2ff9b6[_0xe270('0x12')]){if(_0x2ff9b6[_0xe270('0x12')][_0xe270('0x13')]===0x1f4){logger[_0xe270('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x311591,_0x2ff9b6[_0xe270('0x12')][_0xe270('0x14')]);return _0xb06f4d(_0x2ff9b6[_0xe270('0x12')][_0xe270('0x14')]);}logger[_0xe270('0x12')](_0xe270('0x15'),_0x311591,_0x2ff9b6[_0xe270('0x12')]['message']);return _0x3d2913(_0x2ff9b6[_0xe270('0x12')][_0xe270('0x14')]);}else{logger[_0xe270('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x311591,_0xe270('0x10'));_0x3d2913(_0x2ff9b6[_0xe270('0x16')][_0xe270('0x14')]);}})[_0xe270('0x17')](function(_0x23b934){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x311591,_0x23b934);_0xb06f4d(_0x23b934);});});}exports[_0xe270('0x18')]=function(_0x18ca6d){var _0x465b10=this;return new Promise(function(_0x391ffc,_0x1605c1){return db[_0xe270('0x19')][_0xe270('0x1a')](_0x18ca6d[_0xe270('0x1b')],{'raw':_0x18ca6d[_0xe270('0x1c')]?_0x18ca6d['options'][_0xe270('0x1d')]===undefined?!![]:![]:!![]})[_0xe270('0xe')](function(_0x2b1333){logger[_0xe270('0xf')]('CreateWhatsappMessage',_0x18ca6d);logger[_0xe270('0x1e')](_0xe270('0x18'),_0x18ca6d,JSON['stringify'](_0x2b1333));_0x391ffc(_0x2b1333);})[_0xe270('0x17')](function(_0x5bf810){logger['error']('CreateWhatsappMessage',_0x5bf810[_0xe270('0x14')],_0x18ca6d);_0x1605c1(_0x465b10[_0xe270('0x12')](0x1f4,_0x5bf810[_0xe270('0x14')]));});});}; \ No newline at end of file +var _0xad72=['request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','options','raw','CreateWhatsappMessage','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','WhatsappMessage,\x20%s,\x20%s'];(function(_0xa4cfa7,_0x178bec){var _0x5d4b96=function(_0x58f90a){while(--_0x58f90a){_0xa4cfa7['push'](_0xa4cfa7['shift']());}};_0x5d4b96(++_0x178bec);}(_0xad72,0xc8));var _0x2ad7=function(_0x2c46de,_0x3bf39c){_0x2c46de=_0x2c46de-0x0;var _0xeab943=_0xad72[_0x2c46de];return _0xeab943;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2ad7('0x0'));var BPromise=require(_0x2ad7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ad7('0x2'));var db=require(_0x2ad7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ad7('0x4'))(_0x2ad7('0x5'));var config=require(_0x2ad7('0x6'));var jayson=require(_0x2ad7('0x7'));var client=jayson['client'][_0x2ad7('0x8')]({'port':0x232a});config[_0x2ad7('0x9')]=_[_0x2ad7('0xa')](config[_0x2ad7('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2ad7('0xb'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x2ad7('0xc')](socket);function respondWithRpcPromise(_0x545f9d,_0x14074b,_0x1a4a3b){return new BPromise(function(_0x173406,_0x518bc5){return client[_0x2ad7('0xd')](_0x545f9d,_0x1a4a3b)[_0x2ad7('0xe')](function(_0x44b0eb){logger['info'](_0x2ad7('0xf'),_0x14074b,_0x2ad7('0x10'));logger[_0x2ad7('0x11')](_0x2ad7('0x12'),_0x14074b,_0x2ad7('0x10'),JSON[_0x2ad7('0x13')](_0x44b0eb));if(_0x44b0eb[_0x2ad7('0x14')]){if(_0x44b0eb[_0x2ad7('0x14')][_0x2ad7('0x15')]===0x1f4){logger[_0x2ad7('0x14')](_0x2ad7('0xf'),_0x14074b,_0x44b0eb[_0x2ad7('0x14')][_0x2ad7('0x16')]);return _0x518bc5(_0x44b0eb[_0x2ad7('0x14')]['message']);}logger[_0x2ad7('0x14')](_0x2ad7('0xf'),_0x14074b,_0x44b0eb[_0x2ad7('0x14')][_0x2ad7('0x16')]);return _0x173406(_0x44b0eb[_0x2ad7('0x14')][_0x2ad7('0x16')]);}else{logger[_0x2ad7('0x17')](_0x2ad7('0xf'),_0x14074b,_0x2ad7('0x10'));_0x173406(_0x44b0eb['result']['message']);}})['catch'](function(_0x3183cd){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x14074b,_0x3183cd);_0x518bc5(_0x3183cd);});});}exports['CreateWhatsappMessage']=function(_0x21478c){var _0x1c8c1b=this;return new Promise(function(_0x369f11,_0x2b96d3){return db['WhatsappMessage']['create'](_0x21478c['body'],{'raw':_0x21478c[_0x2ad7('0x18')]?_0x21478c[_0x2ad7('0x18')][_0x2ad7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x417b82){logger[_0x2ad7('0x17')]('CreateWhatsappMessage',_0x21478c);logger[_0x2ad7('0x11')](_0x2ad7('0x1a'),_0x21478c,JSON['stringify'](_0x417b82));_0x369f11(_0x417b82);})['catch'](function(_0x2a2a3b){logger[_0x2ad7('0x14')](_0x2ad7('0x1a'),_0x2a2a3b['message'],_0x21478c);_0x2b96d3(_0x1c8c1b[_0x2ad7('0x14')](0x1f4,_0x2a2a3b[_0x2ad7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 0dc0c9d..1af7c54 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 _0xbebb=['length','save','remove','update','emit','register'];(function(_0x44daa1,_0x1487db){var _0x460e27=function(_0x384fbb){while(--_0x384fbb){_0x44daa1['push'](_0x44daa1['shift']());}};_0x460e27(++_0x1487db);}(_0xbebb,0x1a5));var _0xbbeb=function(_0x47d160,_0xb17594){_0x47d160=_0x47d160-0x0;var _0x20116f=_0xbebb[_0x47d160];return _0x20116f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xbbeb('0x0'),_0xbbeb('0x1'),_0xbbeb('0x2')];function createListener(_0x3ee117,_0x489e2c){return function(_0xf8e749){_0x489e2c[_0xbbeb('0x3')](_0x3ee117,_0xf8e749);};}function removeListener(_0x2d8fd3,_0x52880d){return function(){WhatsappMessageEvents['removeListener'](_0x2d8fd3,_0x52880d);};}exports[_0xbbeb('0x4')]=function(_0x548b71){for(var _0x152a28=0x0,_0x32e5e4=events[_0xbbeb('0x5')];_0x152a28<_0x32e5e4;_0x152a28++){var _0x20628c=events[_0x152a28];var _0x402a27=createListener('whatsappMessage:'+_0x20628c,_0x548b71);WhatsappMessageEvents['on'](_0x20628c,_0x402a27);}}; \ No newline at end of file +var _0xe158=['removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xe158,0x1b3));var _0x8e15=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0xe158[_0x230e39];return _0xa804e;};'use strict';var WhatsappMessageEvents=require(_0x8e15('0x0'));var events=[_0x8e15('0x1'),_0x8e15('0x2'),_0x8e15('0x3')];function createListener(_0x7dc266,_0xaa6611){return function(_0x59b2db){_0xaa6611[_0x8e15('0x4')](_0x7dc266,_0x59b2db);};}function removeListener(_0x2c5793,_0x1641fd){return function(){WhatsappMessageEvents[_0x8e15('0x5')](_0x2c5793,_0x1641fd);};}exports[_0x8e15('0x6')]=function(_0x184f2e){for(var _0x417a6d=0x0,_0x8008e2=events['length'];_0x417a6d<_0x8008e2;_0x417a6d++){var _0x26e281=events[_0x417a6d];var _0x1da6b6=createListener(_0x8e15('0x7')+_0x26e281,_0x184f2e);WhatsappMessageEvents['on'](_0x26e281,_0x1da6b6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 51f6398..a862ff7 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 _0xc2e3=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3c3a4d,_0x309438){var _0x251598=function(_0x283fb3){while(--_0x283fb3){_0x3c3a4d['push'](_0x3c3a4d['shift']());}};_0x251598(++_0x309438);}(_0xc2e3,0x182));var _0x3c2e=function(_0x2da4d4,_0x278319){_0x2da4d4=_0x2da4d4-0x0;var _0x2167ad=_0xc2e3[_0x2da4d4];return _0x2167ad;};'use strict';var multer=require(_0x3c2e('0x0'));var util=require(_0x3c2e('0x1'));var path=require(_0x3c2e('0x2'));var timeout=require(_0x3c2e('0x3'));var express=require(_0x3c2e('0x4'));var router=express['Router']();var fs_extra=require(_0x3c2e('0x5'));var auth=require(_0x3c2e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3c2e('0x7'));router['get']('/',auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x9')]);router[_0x3c2e('0xa')](_0x3c2e('0xb'),auth[_0x3c2e('0x8')](),controller['describe']);router[_0x3c2e('0xa')](_0x3c2e('0xc'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0xd')]);router['get'](_0x3c2e('0xe'),auth['isAuthenticated'](),controller[_0x3c2e('0xf')]);router[_0x3c2e('0xa')](_0x3c2e('0x10'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x11')]);router[_0x3c2e('0xa')](_0x3c2e('0x12'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x13')]);router[_0x3c2e('0x14')]('/',auth['isAuthenticated'](),controller[_0x3c2e('0x15')]);router[_0x3c2e('0x14')]('/:id/teams',auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x16')]);router[_0x3c2e('0x14')](_0x3c2e('0x12'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x17')]);router[_0x3c2e('0x18')](_0x3c2e('0xc'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x19')]);router[_0x3c2e('0x1a')](_0x3c2e('0xc'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x1b')]);router[_0x3c2e('0x1a')](_0x3c2e('0x10'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x1c')]);router[_0x3c2e('0x1a')](_0x3c2e('0x12'),auth[_0x3c2e('0x8')](),controller[_0x3c2e('0x1d')]);module[_0x3c2e('0x1e')]=router; \ No newline at end of file +var _0x3759=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path'];(function(_0x496236,_0x3cbdc5){var _0x5af53c=function(_0x2dfecf){while(--_0x2dfecf){_0x496236['push'](_0x496236['shift']());}};_0x5af53c(++_0x3cbdc5);}(_0x3759,0x131));var _0x9375=function(_0x539ea8,_0x78a700){_0x539ea8=_0x539ea8-0x0;var _0x3afeae=_0x3759[_0x539ea8];return _0x3afeae;};'use strict';var multer=require(_0x9375('0x0'));var util=require(_0x9375('0x1'));var path=require(_0x9375('0x2'));var timeout=require(_0x9375('0x3'));var express=require(_0x9375('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9375('0x5'));var interaction=require(_0x9375('0x6'));var config=require('../../config/environment');var controller=require(_0x9375('0x7'));router[_0x9375('0x8')]('/',auth['isAuthenticated'](),controller[_0x9375('0x9')]);router[_0x9375('0x8')](_0x9375('0xa'),auth[_0x9375('0xb')](),controller[_0x9375('0xc')]);router[_0x9375('0x8')](_0x9375('0xd'),auth[_0x9375('0xb')](),controller['show']);router['get']('/:id/members',auth[_0x9375('0xb')](),controller[_0x9375('0xe')]);router[_0x9375('0x8')]('/:id/teams',auth[_0x9375('0xb')](),controller[_0x9375('0xf')]);router[_0x9375('0x8')](_0x9375('0x10'),auth['isAuthenticated'](),controller[_0x9375('0x11')]);router[_0x9375('0x12')]('/',auth[_0x9375('0xb')](),controller[_0x9375('0x13')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x9375('0x14')]);router['post']('/:id/users',auth[_0x9375('0xb')](),controller[_0x9375('0x15')]);router[_0x9375('0x16')]('/:id',auth[_0x9375('0xb')](),controller['update']);router[_0x9375('0x17')](_0x9375('0xd'),auth['isAuthenticated'](),controller[_0x9375('0x18')]);router['delete']('/:id/teams',auth[_0x9375('0xb')](),controller[_0x9375('0x19')]);router[_0x9375('0x17')](_0x9375('0x10'),auth['isAuthenticated'](),controller[_0x9375('0x1a')]);module[_0x9375('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 1aaa4df..594a27d 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 _0x86f5=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x86f5,0x178));var _0x586f=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0x86f5[_0x28394f];return _0x2618d2;};'use strict';var Sequelize=require(_0x586f('0x0'));module['exports']={'name':{'type':Sequelize[_0x586f('0x1')],'unique':_0x586f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x586f('0x3')](_0x586f('0x4'),_0x586f('0x5'),_0x586f('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa75b=['sequelize','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x2371ca,_0x492257){var _0x15eaab=function(_0x27c1e3){while(--_0x27c1e3){_0x2371ca['push'](_0x2371ca['shift']());}};_0x15eaab(++_0x492257);}(_0xa75b,0x170));var _0xba75=function(_0x5bd083,_0x3f632d){_0x5bd083=_0x5bd083-0x0;var _0x84b539=_0xa75b[_0x5bd083];return _0x84b539;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xba75('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xba75('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xba75('0x3')](_0xba75('0x4'),_0xba75('0x5'),_0xba75('0x6'))},'description':{'type':Sequelize[_0xba75('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 30647a2..402e533 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 _0xbe34=['userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','./whatsappQueue.socket','register','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','get','WhatsappQueues','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','merge','filter','options','findAll','User','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userWhatsappQueue:save','removeTeams','select','field','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','emit'];(function(_0x34cb84,_0xef6050){var _0x10ddd0=function(_0x539005){while(--_0x539005){_0x34cb84['push'](_0x34cb84['shift']());}};_0x10ddd0(++_0xef6050);}(_0xbe34,0xec));var _0x4be3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbe34[_0x42cae2];return _0x5f256f;};'use strict';var BPromise=require(_0x4be3('0x0'));var util=require(_0x4be3('0x1'));var _=require(_0x4be3('0x2'));var squel=require(_0x4be3('0x3'));var Redis=require(_0x4be3('0x4'));var qs=require(_0x4be3('0x5'));var logger=require(_0x4be3('0x6'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4be3('0x7')]=_[_0x4be3('0x8')](config[_0x4be3('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4be3('0x7')]));require(_0x4be3('0x9'))[_0x4be3('0xa')](socket);function respondWithStatusCode(_0x367333,_0x6ccd4c){_0x6ccd4c=_0x6ccd4c||0xcc;return function(_0xbc97f3){if(_0xbc97f3){return _0x367333['sendStatus'](_0x6ccd4c);}return _0x367333['status'](_0x6ccd4c)[_0x4be3('0xb')]();};}function respondWithResult(_0xc9146d,_0x4fbccf){_0x4fbccf=_0x4fbccf||0xc8;return function(_0x1eb03e){if(_0x1eb03e){return _0xc9146d[_0x4be3('0xc')](_0x4fbccf)[_0x4be3('0xd')](_0x1eb03e);}};}function respondWithFilteredResult(_0x48a00a,_0x314ecd){return function(_0x5d2cbf){if(_0x5d2cbf){var _0x97d836=typeof _0x314ecd[_0x4be3('0xe')]===_0x4be3('0xf')&&typeof _0x314ecd[_0x4be3('0x10')]===_0x4be3('0xf');var _0x1f418e=_0x5d2cbf[_0x4be3('0x11')];var _0x5ba984=_0x97d836?0x0:_0x314ecd[_0x4be3('0xe')];var _0x434d2b=_0x97d836?_0x5d2cbf[_0x4be3('0x11')]:_0x314ecd[_0x4be3('0xe')]+_0x314ecd['limit'];var _0x3a605e;if(_0x434d2b>=_0x1f418e){_0x434d2b=_0x1f418e;_0x3a605e=0xc8;}else{_0x3a605e=0xce;}_0x48a00a['status'](_0x3a605e);return _0x48a00a['set'](_0x4be3('0x12'),_0x5ba984+'-'+_0x434d2b+'/'+_0x1f418e)[_0x4be3('0xd')](_0x5d2cbf);}return null;};}function saveUpdates(_0x5a2f16){return function(_0x3cb085){if(_0x3cb085){return _0x3cb085[_0x4be3('0x13')](_0x5a2f16)['then'](function(_0x4a4478){return _0x4a4478;});}return null;};}function removeEntity(_0xe7595d){return function(_0x1f0a4d){if(_0x1f0a4d){return _0x1f0a4d[_0x4be3('0x14')]()[_0x4be3('0x15')](function(){var _0xea5025=_0x1f0a4d[_0x4be3('0x16')]({'plain':!![]});var _0xbe1866=_0x4be3('0x17');return db['UserProfileResource'][_0x4be3('0x14')]({'where':{'type':_0xbe1866,'resourceId':_0xea5025['id']}})['then'](function(){return _0x1f0a4d;});})[_0x4be3('0x15')](function(){_0xe7595d[_0x4be3('0xc')](0xcc)[_0x4be3('0xb')]();});}};}function handleEntityNotFound(_0x276cc0){return function(_0x32a1c7){if(!_0x32a1c7){_0x276cc0['sendStatus'](0x194);}return _0x32a1c7;};}function handleError(_0xfae080,_0x5f08d0){_0x5f08d0=_0x5f08d0||0x1f4;return function(_0x52845c){logger['error'](_0x52845c[_0x4be3('0x18')]);if(_0x52845c[_0x4be3('0x19')]){delete _0x52845c[_0x4be3('0x19')];}_0xfae080[_0x4be3('0xc')](_0x5f08d0)[_0x4be3('0x1a')](_0x52845c);};}exports['index']=function(_0x4b723e,_0x26f168){var _0x36efc7={};var _0x17429e={'count':0x0,'rows':[]};var _0x3610a2=_[_0x4be3('0x1b')](db[_0x4be3('0x1c')][_0x4be3('0x1d')],function(_0x21f1b1){return{'name':_0x21f1b1[_0x4be3('0x1e')],'type':_0x21f1b1[_0x4be3('0x1f')][_0x4be3('0x20')]};});_0x36efc7=qs[_0x4be3('0x21')](_0x3610a2,_0x4b723e);var _0x3ac2ae={'where':_0x36efc7[_0x4be3('0x22')]};return db['WhatsappQueue']['count'](_0x3ac2ae)[_0x4be3('0x15')](function(_0x9093cd){_0x17429e[_0x4be3('0x11')]=_0x9093cd;_0x36efc7[_0x4be3('0x23')]=qs[_0x4be3('0x23')](_0x4b723e[_0x4be3('0x24')]);return db[_0x4be3('0x1c')]['findAll'](_0x36efc7);})[_0x4be3('0x15')](function(_0x37c008){_0x17429e['rows']=_0x37c008;return _0x17429e;})['then'](respondWithFilteredResult(_0x26f168,_0x36efc7))[_0x4be3('0x25')](handleError(_0x26f168,null));};exports[_0x4be3('0x26')]=function(_0x134caf,_0x1dd9bc){var _0x26efe3={'raw':!![],'where':{'id':_0x134caf[_0x4be3('0x27')]['id']}},_0x4ef124={};_0x4ef124[_0x4be3('0x28')]=_[_0x4be3('0x29')](db[_0x4be3('0x1c')][_0x4be3('0x1d')]);_0x4ef124[_0x4be3('0x24')]=_[_0x4be3('0x29')](_0x134caf[_0x4be3('0x24')]);_0x4ef124[_0x4be3('0x2a')]=_[_0x4be3('0x2b')](_0x4ef124[_0x4be3('0x28')],_0x4ef124[_0x4be3('0x24')]);_0x26efe3[_0x4be3('0x2c')]=_[_0x4be3('0x2b')](_0x4ef124[_0x4be3('0x28')],qs[_0x4be3('0x2d')](_0x134caf['query'][_0x4be3('0x2d')]));_0x26efe3[_0x4be3('0x2c')]=_0x26efe3[_0x4be3('0x2c')][_0x4be3('0x2e')]?_0x26efe3[_0x4be3('0x2c')]:_0x4ef124[_0x4be3('0x28')];if(_0x134caf[_0x4be3('0x24')]['includeAll']){_0x26efe3[_0x4be3('0x23')]=[{'all':!![]}];}_0x26efe3=_['merge']({},_0x26efe3,_0x134caf['options']);return db[_0x4be3('0x1c')][_0x4be3('0x2f')](_0x26efe3)[_0x4be3('0x15')](handleEntityNotFound(_0x1dd9bc,null))[_0x4be3('0x15')](respondWithResult(_0x1dd9bc,null))[_0x4be3('0x25')](handleError(_0x1dd9bc,null));};exports[_0x4be3('0x30')]=function(_0x103525,_0x288e7f){return db['WhatsappQueue'][_0x4be3('0x30')](_0x103525['body'],{})[_0x4be3('0x15')](function(_0x52d434){var _0x55dabe=_0x103525[_0x4be3('0x31')]['get']({'plain':!![]});if(!_0x55dabe)throw new Error(_0x4be3('0x32'));if(_0x55dabe[_0x4be3('0x33')]===_0x4be3('0x31')){var _0x5a35c0=_0x52d434[_0x4be3('0x16')]({'plain':!![]});var _0x55456b=_0x4be3('0x17');return db['UserProfileSection'][_0x4be3('0x2f')]({'where':{'name':_0x55456b,'userProfileId':_0x55dabe['userProfileId']},'raw':!![]})['then'](function(_0x149e00){if(_0x149e00&&_0x149e00[_0x4be3('0x34')]===0x0){return db['UserProfileResource'][_0x4be3('0x30')]({'name':_0x5a35c0[_0x4be3('0x19')],'resourceId':_0x5a35c0['id'],'type':_0x149e00['name'],'sectionId':_0x149e00['id']},{})[_0x4be3('0x15')](function(){return _0x52d434;});}else{return _0x52d434;}})[_0x4be3('0x25')](function(_0x80ef1a){logger[_0x4be3('0x35')](_0x4be3('0x36'),_0x80ef1a);throw _0x80ef1a;});}return _0x52d434;})[_0x4be3('0x15')](respondWithResult(_0x288e7f,0xc9))[_0x4be3('0x25')](handleError(_0x288e7f,null));};exports['update']=function(_0x491c0e,_0x3caf07){if(_0x491c0e[_0x4be3('0x37')]['id']){delete _0x491c0e[_0x4be3('0x37')]['id'];}return db[_0x4be3('0x1c')][_0x4be3('0x2f')]({'where':{'id':_0x491c0e[_0x4be3('0x27')]['id']}})[_0x4be3('0x15')](handleEntityNotFound(_0x3caf07,null))[_0x4be3('0x15')](saveUpdates(_0x491c0e['body'],null))[_0x4be3('0x15')](respondWithResult(_0x3caf07,null))[_0x4be3('0x25')](handleError(_0x3caf07,null));};exports[_0x4be3('0x14')]=function(_0x5b02bf,_0x43300d){return db['WhatsappQueue']['find']({'where':{'id':_0x5b02bf[_0x4be3('0x27')]['id']}})[_0x4be3('0x15')](handleEntityNotFound(_0x43300d,null))[_0x4be3('0x15')](removeEntity(_0x43300d,null))[_0x4be3('0x25')](handleError(_0x43300d,null));};exports[_0x4be3('0x38')]=function(_0x52c07f,_0x248bbd){return db[_0x4be3('0x1c')][_0x4be3('0x38')]()[_0x4be3('0x15')](respondWithResult(_0x248bbd,null))[_0x4be3('0x25')](handleError(_0x248bbd,null));};exports['getMembers']=function(_0x57a3d5,_0x9ab576){var _0x25f6d9={'raw':!![],'where':{}},_0x231903={},_0x2743b3;return db[_0x4be3('0x1c')][_0x4be3('0x39')]({'where':{'id':_0x57a3d5['params']['id']}})[_0x4be3('0x15')](handleEntityNotFound(_0x9ab576,null))[_0x4be3('0x15')](function(_0x1e66a8){if(_0x1e66a8){_0x2743b3=_0x1e66a8[_0x4be3('0x16')]({'plain':!![]});_0x231903[_0x4be3('0x28')]=_['keys'](db[_0x4be3('0x3a')][_0x4be3('0x1d')]);_0x231903['query']=_['keys'](_0x57a3d5[_0x4be3('0x24')]);_0x231903[_0x4be3('0x2a')]=_[_0x4be3('0x2b')](_0x231903['model'],_0x231903[_0x4be3('0x24')]);_0x25f6d9[_0x4be3('0x2c')]=_['intersection'](_0x231903[_0x4be3('0x28')],qs[_0x4be3('0x2d')](_0x57a3d5['query'][_0x4be3('0x2d')]));_0x25f6d9[_0x4be3('0x2c')]=_0x25f6d9['attributes'][_0x4be3('0x2e')]?_0x25f6d9[_0x4be3('0x2c')]:_0x231903[_0x4be3('0x28')];if(!_0x57a3d5[_0x4be3('0x24')][_0x4be3('0x3b')](_0x4be3('0x3c'))){_0x25f6d9[_0x4be3('0x10')]=qs[_0x4be3('0x10')](_0x57a3d5[_0x4be3('0x24')][_0x4be3('0x10')]);_0x25f6d9[_0x4be3('0xe')]=qs[_0x4be3('0xe')](_0x57a3d5[_0x4be3('0x24')][_0x4be3('0xe')]);}_0x25f6d9[_0x4be3('0x3d')]=qs['sort'](_0x57a3d5['query'][_0x4be3('0x3e')]);_0x25f6d9['where']=qs[_0x4be3('0x2a')](_[_0x4be3('0x3f')](_0x57a3d5[_0x4be3('0x24')],_0x231903['filters']));_0x25f6d9[_0x4be3('0x22')][_0x4be3('0x40')]=_0x1e66a8['id'];if(_0x57a3d5[_0x4be3('0x24')]['filter']){_0x25f6d9['where']=_[_0x4be3('0x41')](_0x25f6d9['where'],{'$or':_[_0x4be3('0x1b')](_0x25f6d9[_0x4be3('0x2c')],function(_0x331c19){var _0xc2e099={};_0xc2e099[_0x331c19]={'$like':'%'+_0x57a3d5[_0x4be3('0x24')][_0x4be3('0x42')]+'%'};return _0xc2e099;})});}_0x25f6d9=_[_0x4be3('0x41')]({},_0x25f6d9,_0x57a3d5[_0x4be3('0x43')]);return db[_0x4be3('0x3a')][_0x4be3('0x44')](_0x25f6d9);}})[_0x4be3('0x15')](function(_0x5e3984){if(_0x5e3984){return db[_0x4be3('0x45')]['findAndCountAll']({'where':{'id':_['map'](_0x5e3984,_0x4be3('0x46')),'role':_0x4be3('0x47')},'attributes':['id',_0x4be3('0x19'),_0x4be3('0x48'),_0x4be3('0x49'),_0x4be3('0x4a')]});}})[_0x4be3('0x15')](function(_0x480611){if(_0x480611){return{'count':_0x480611[_0x4be3('0x11')],'rows':_[_0x4be3('0x1b')](_0x480611[_0x4be3('0x4b')],function(_0xb727a9){return{'membername':_0xb727a9[_0x4be3('0x19')],'UserId':_0xb727a9['id'],'queue_name':_0x2743b3['name'],'WhatsappQueueId':_0x2743b3['id'],'interface':util[_0x4be3('0x4c')](_0x4be3('0x4d'),_0x4be3('0x4e'),_0xb727a9['name']),'penalty':0x0,'paused':_0xb727a9['whatsappPause'],'createdAt':_0xb727a9[_0x4be3('0x4a')],'updatedAt':_0xb727a9[_0x4be3('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4be3('0x15')](respondWithFilteredResult(_0x9ab576,_0x25f6d9))[_0x4be3('0x25')](handleError(_0x9ab576,null));};exports[_0x4be3('0x4f')]=function(_0x5e78b4,_0x2f5d52){var _0x41cb54={};var _0x56ec51={};var _0x1833f4;var _0x263034;return db[_0x4be3('0x1c')][_0x4be3('0x39')]({'where':{'id':_0x5e78b4[_0x4be3('0x27')]['id']}})[_0x4be3('0x15')](handleEntityNotFound(_0x2f5d52,null))['then'](function(_0x7ea40b){if(_0x7ea40b){_0x1833f4=_0x7ea40b;_0x56ec51[_0x4be3('0x28')]=_['keys'](db[_0x4be3('0x50')][_0x4be3('0x1d')]);_0x56ec51[_0x4be3('0x24')]=_[_0x4be3('0x29')](_0x5e78b4[_0x4be3('0x24')]);_0x56ec51['filters']=_[_0x4be3('0x2b')](_0x56ec51['model'],_0x56ec51['query']);_0x41cb54['attributes']=_[_0x4be3('0x2b')](_0x56ec51[_0x4be3('0x28')],qs[_0x4be3('0x2d')](_0x5e78b4['query'][_0x4be3('0x2d')]));_0x41cb54[_0x4be3('0x2c')]=_0x41cb54[_0x4be3('0x2c')][_0x4be3('0x2e')]?_0x41cb54[_0x4be3('0x2c')]:_0x56ec51['model'];_0x41cb54['order']=qs['sort'](_0x5e78b4['query'][_0x4be3('0x3e')]);_0x41cb54[_0x4be3('0x22')]=qs[_0x4be3('0x2a')](_['pick'](_0x5e78b4[_0x4be3('0x24')],_0x56ec51[_0x4be3('0x2a')]));if(_0x5e78b4[_0x4be3('0x24')]['filter']){_0x41cb54[_0x4be3('0x22')]=_[_0x4be3('0x41')](_0x41cb54[_0x4be3('0x22')],{'$or':_[_0x4be3('0x1b')](_0x41cb54['attributes'],function(_0x5c42df){var _0x24dd45={};_0x24dd45[_0x5c42df]={'$like':'%'+_0x5e78b4['query'][_0x4be3('0x42')]+'%'};return _0x24dd45;})});}_0x41cb54=_[_0x4be3('0x41')]({},_0x41cb54,_0x5e78b4[_0x4be3('0x43')]);return _0x1833f4[_0x4be3('0x4f')](_0x41cb54);}})['then'](function(_0x3d803f){if(_0x3d803f){_0x263034=_0x3d803f[_0x4be3('0x2e')];if(!_0x5e78b4['query'][_0x4be3('0x3b')](_0x4be3('0x3c'))){_0x41cb54['limit']=qs[_0x4be3('0x10')](_0x5e78b4[_0x4be3('0x24')][_0x4be3('0x10')]);_0x41cb54[_0x4be3('0xe')]=qs[_0x4be3('0xe')](_0x5e78b4[_0x4be3('0x24')][_0x4be3('0xe')]);}return _0x1833f4[_0x4be3('0x4f')](_0x41cb54);}})[_0x4be3('0x15')](function(_0x418810){if(_0x418810){return _0x418810?{'count':_0x263034,'rows':_0x418810}:null;}})[_0x4be3('0x15')](respondWithResult(_0x2f5d52,null))[_0x4be3('0x25')](handleError(_0x2f5d52,null));};exports[_0x4be3('0x51')]=function(_0x5c5ac0,_0x560fce){var _0x45d432=_0x5c5ac0[_0x4be3('0x37')][_0x4be3('0x52')];return db[_0x4be3('0x50')][_0x4be3('0x44')]({'where':{'id':_0x45d432},'attributes':['id'],'include':[{'model':db[_0x4be3('0x45')],'as':_0x4be3('0x53'),'attributes':['id',_0x4be3('0x19'),'online',_0x4be3('0x54'),_0x4be3('0x55')],'raw':!![]}]})[_0x4be3('0x15')](function(_0xdec394){if(_0xdec394){var _0xfd5ab=_[_0x4be3('0x56')](_0xdec394,function(_0x2c484c){var _0x2968f5=_0x2c484c[_0x4be3('0x16')]({'plain':!![]});return _0x2968f5[_0x4be3('0x53')];});return db['WhatsappQueue'][_0x4be3('0x2f')]({'where':{'id':_0x5c5ac0['params']['id']}})[_0x4be3('0x15')](function(_0xe6283b){return db[_0x4be3('0x57')][_0x4be3('0x58')](function(_0x281629){return _0xe6283b['addTeams'](_0x45d432,{'transaction':_0x281629})[_0x4be3('0x15')](function(){return BPromise[_0x4be3('0x59')](_0xfd5ab,function(_0x17ef24){return db[_0x4be3('0x3a')]['findOrCreate']({'where':{'UserId':_0x17ef24['id'],'WhatsappQueueId':_0x5c5ac0[_0x4be3('0x27')]['id']},'transaction':_0x281629});});})[_0x4be3('0x15')](function(){_0xfd5ab[_0x4be3('0x5a')](function(_0x195798){socket['emit'](_0x4be3('0x5b'),{'UserId':_0x195798['id'],'WhatsappQueueId':_0xe6283b['id']});});});});});}})[_0x4be3('0x15')](respondWithStatusCode(_0x560fce,null))[_0x4be3('0x25')](handleError(_0x560fce,null));};exports[_0x4be3('0x5c')]=function(_0x321271,_0xf52425){return db['Team'][_0x4be3('0x44')]({'where':{'id':_0x321271[_0x4be3('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4be3('0x45')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4be3('0x15')](handleEntityNotFound(_0xf52425,null))[_0x4be3('0x15')](function(_0x267127){var _0x84818a=_[_0x4be3('0x1b')](_0x267127,'id');var _0x9f892b=[];var _0x59c44d=[];var _0x27f78b=squel[_0x4be3('0x5d')]();_0x27f78b[_0x4be3('0x5e')]('tq.TeamId')['from'](_0x4be3('0x5f'),'tq')['join'](_0x4be3('0x60'),'ut',_0x4be3('0x61'))[_0x4be3('0x22')]('WhatsappQueueId\x20=\x20?',_0x321271['params']['id']);for(var _0x31c781=0x0;_0x31c781<_0x267127['length'];_0x31c781+=0x1){let _0x2cb415=_0x267127[_0x31c781];for(var _0x2a94dc=0x0;_0x2a94dc<_0x2cb415[_0x4be3('0x53')][_0x4be3('0x2e')];_0x2a94dc+=0x1){let _0x5b96ca=_0x2cb415[_0x4be3('0x53')][_0x2a94dc];var _0x5e71de=_0x27f78b['clone']();_0x5e71de[_0x4be3('0x22')](_0x4be3('0x62'),_0x5b96ca['id']);_0x59c44d[_0x4be3('0x63')](db[_0x4be3('0x57')][_0x4be3('0x24')](_0x5e71de['toString'](),{'type':db['sequelize'][_0x4be3('0x64')][_0x4be3('0x65')]})[_0x4be3('0x15')](function(_0x4442f6){if(_0x4442f6['length']===0x1){return _0x5b96ca['id'];}else{var _0x227fa0=_[_0x4be3('0x66')](_['map'](_0x4442f6,_0x4be3('0x67')),function(_0x3cfc5e){return _[_0x4be3('0x68')](_0x84818a,_0x3cfc5e);});if(_0x227fa0){return _0x5b96ca['id'];}}}));}}return BPromise[_0x4be3('0x69')](_0x59c44d)[_0x4be3('0x15')](function(_0x3c3c3a){_0x9f892b=_(_0x9f892b)['union'](_0x3c3c3a)[_0x4be3('0x6a')]()[_0x4be3('0x6b')]();return db[_0x4be3('0x1c')][_0x4be3('0x2f')]({'where':{'id':_0x321271[_0x4be3('0x27')]['id']}})[_0x4be3('0x15')](function(_0xc1324a){return db[_0x4be3('0x57')][_0x4be3('0x58')](function(_0x599f23){return _0xc1324a[_0x4be3('0x5c')](_0x321271[_0x4be3('0x24')][_0x4be3('0x52')],{'transaction':_0x599f23})[_0x4be3('0x15')](function(){if(!_['isEmpty'](_0x9f892b)){return _0xc1324a['removeAgents'](_0x9f892b,{'transaction':_0x599f23});}})[_0x4be3('0x15')](function(){_0x9f892b['forEach'](function(_0x261288){socket[_0x4be3('0x6c')](_0x4be3('0x6d'),{'UserId':_0x261288,'WhatsappQueueId':_0xc1324a['id']});});});});});});})['then'](respondWithStatusCode(_0xf52425,null))[_0x4be3('0x25')](handleError(_0xf52425,null));};exports[_0x4be3('0x6e')]=function(_0xe9c6d7,_0x447db4){return db[_0x4be3('0x1c')][_0x4be3('0x2f')]({'where':{'id':_0xe9c6d7[_0x4be3('0x27')]['id']}})[_0x4be3('0x15')](handleEntityNotFound(_0x447db4,null))[_0x4be3('0x15')](function(_0x3dbb56){if(_0x3dbb56){return _0x3dbb56[_0x4be3('0x6e')](_0xe9c6d7[_0x4be3('0x37')][_0x4be3('0x52')],_['omit'](_0xe9c6d7['body'],[_0x4be3('0x52'),'id'])||{})[_0x4be3('0x6f')](function(_0x780ac7){for(var _0x223fd3=0x0;_0x223fd3<_0xe9c6d7['body'][_0x4be3('0x52')][_0x4be3('0x2e')];_0x223fd3+=0x1){socket[_0x4be3('0x6c')](_0x4be3('0x5b'),{'UserId':Number(_0xe9c6d7['body'][_0x4be3('0x52')][_0x223fd3]),'WhatsappQueueId':Number(_0xe9c6d7[_0x4be3('0x27')]['id'])});}return _0x780ac7;});}})[_0x4be3('0x15')](respondWithResult(_0x447db4,null))[_0x4be3('0x25')](handleError(_0x447db4,null));};exports[_0x4be3('0x70')]=function(_0x5abc9e,_0x5662b9){return db[_0x4be3('0x1c')][_0x4be3('0x2f')]({'where':{'id':_0x5abc9e[_0x4be3('0x27')]['id']}})[_0x4be3('0x15')](handleEntityNotFound(_0x5662b9,null))[_0x4be3('0x15')](function(_0x52f217){if(_0x52f217){return _0x52f217[_0x4be3('0x70')](_0x5abc9e[_0x4be3('0x24')][_0x4be3('0x52')])[_0x4be3('0x15')](function(){if(_[_0x4be3('0x71')](_0x5abc9e['query'][_0x4be3('0x52')])){for(var _0x31e052=0x0;_0x31e052<_0x5abc9e['query'][_0x4be3('0x52')][_0x4be3('0x2e')];_0x31e052+=0x1){socket[_0x4be3('0x6c')]('userWhatsappQueue:remove',{'UserId':Number(_0x5abc9e[_0x4be3('0x24')][_0x4be3('0x52')][_0x31e052]),'WhatsappQueueId':Number(_0x5abc9e[_0x4be3('0x27')]['id'])});}}else{socket[_0x4be3('0x6c')](_0x4be3('0x6d'),{'UserId':Number(_0x5abc9e[_0x4be3('0x24')][_0x4be3('0x52')]),'WhatsappQueueId':Number(_0x5abc9e[_0x4be3('0x27')]['id'])});}});}})[_0x4be3('0x15')](respondWithStatusCode(_0x5662b9,null))[_0x4be3('0x25')](handleError(_0x5662b9,null));};exports[_0x4be3('0x72')]=function(_0xca8111,_0x366afa){var _0x4d1a36={};var _0x1813f0={};var _0x2621d2;var _0x23ed9f;return db[_0x4be3('0x1c')][_0x4be3('0x39')]({'where':{'id':_0xca8111['params']['id']}})['then'](handleEntityNotFound(_0x366afa,null))[_0x4be3('0x15')](function(_0x3fe2f4){if(_0x3fe2f4){_0x2621d2=_0x3fe2f4;_0x1813f0[_0x4be3('0x28')]=_[_0x4be3('0x29')](db[_0x4be3('0x45')][_0x4be3('0x1d')]);_0x1813f0[_0x4be3('0x24')]=_['keys'](_0xca8111[_0x4be3('0x24')]);_0x1813f0[_0x4be3('0x2a')]=_[_0x4be3('0x2b')](_0x1813f0['model'],_0x1813f0['query']);_0x4d1a36['attributes']=_[_0x4be3('0x2b')](_0x1813f0[_0x4be3('0x28')],qs[_0x4be3('0x2d')](_0xca8111[_0x4be3('0x24')]['fields']));_0x4d1a36[_0x4be3('0x2c')]=_0x4d1a36['attributes'][_0x4be3('0x2e')]?_0x4d1a36[_0x4be3('0x2c')]:_0x1813f0[_0x4be3('0x28')];_0x4d1a36['order']=qs[_0x4be3('0x3e')](_0xca8111[_0x4be3('0x24')]['sort']);_0x4d1a36['where']=qs[_0x4be3('0x2a')](_['pick'](_0xca8111['query'],_0x1813f0['filters']));if(_0xca8111[_0x4be3('0x24')][_0x4be3('0x42')]){_0x4d1a36[_0x4be3('0x22')]=_[_0x4be3('0x41')](_0x4d1a36[_0x4be3('0x22')],{'$or':_['map'](_0x4d1a36[_0x4be3('0x2c')],function(_0x2e1d7c){var _0x37bae1={};_0x37bae1[_0x2e1d7c]={'$like':'%'+_0xca8111[_0x4be3('0x24')][_0x4be3('0x42')]+'%'};return _0x37bae1;})});}_0x4d1a36=_['merge']({},_0x4d1a36,_0xca8111[_0x4be3('0x43')]);return _0x2621d2['getAgents'](_0x4d1a36);}})['then'](function(_0x3133ab){if(_0x3133ab){_0x23ed9f=_0x3133ab[_0x4be3('0x2e')];if(!_0xca8111['query']['hasOwnProperty'](_0x4be3('0x3c'))){_0x4d1a36[_0x4be3('0x10')]=qs[_0x4be3('0x10')](_0xca8111['query']['limit']);_0x4d1a36[_0x4be3('0xe')]=qs[_0x4be3('0xe')](_0xca8111[_0x4be3('0x24')]['offset']);}return _0x2621d2[_0x4be3('0x72')](_0x4d1a36);}})[_0x4be3('0x15')](function(_0x4f8154){if(_0x4f8154){return _0x4f8154?{'count':_0x23ed9f,'rows':_0x4f8154}:null;}})['then'](respondWithResult(_0x366afa,null))[_0x4be3('0x25')](handleError(_0x366afa,null));}; \ No newline at end of file +var _0x3066=['from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','all','union','compact','removeTeams','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','offset','limit','undefined','count','set','Content-Range','then','get','WhatsappQueues','UserProfileResource','destroy','error','stack','name','index','map','fieldName','getOptions','WhatsappQueue','include','findAll','catch','show','params','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappQueueId','merge','filter','findAndCountAll','UserId','agent','whatsappPause','updatedAt','rows','format','SIP','getTeams','Team','options','addTeams','ids','User','Agents','online','interface','flatMap','transaction','each','userWhatsappQueue:save','select','field','tq.TeamId'];(function(_0xd0cd54,_0x613e58){var _0x5f3f4f=function(_0x4fb920){while(--_0x4fb920){_0xd0cd54['push'](_0xd0cd54['shift']());}};_0x5f3f4f(++_0x613e58);}(_0x3066,0x8d));var _0x6306=function(_0x3ec856,_0xda9fd7){_0x3ec856=_0x3ec856-0x0;var _0x572403=_0x3066[_0x3ec856];return _0x572403;};'use strict';var BPromise=require(_0x6306('0x0'));var util=require('util');var _=require(_0x6306('0x1'));var squel=require(_0x6306('0x2'));var Redis=require(_0x6306('0x3'));var qs=require(_0x6306('0x4'));var logger=require(_0x6306('0x5'))('api');var config=require(_0x6306('0x6'));var db=require('../../mysqldb')['db'];config[_0x6306('0x7')]=_['defaults'](config[_0x6306('0x7')],{'host':_0x6306('0x8'),'port':0x18eb});var socket=require(_0x6306('0x9'))(new Redis(config[_0x6306('0x7')]));require(_0x6306('0xa'))['register'](socket);function respondWithStatusCode(_0x1a993e,_0x5b6d86){_0x5b6d86=_0x5b6d86||0xcc;return function(_0x3f3fd5){if(_0x3f3fd5){return _0x1a993e[_0x6306('0xb')](_0x5b6d86);}return _0x1a993e[_0x6306('0xc')](_0x5b6d86)['end']();};}function respondWithResult(_0x5b2b3c,_0x82cb1a){_0x82cb1a=_0x82cb1a||0xc8;return function(_0x32a360){if(_0x32a360){return _0x5b2b3c[_0x6306('0xc')](_0x82cb1a)['json'](_0x32a360);}};}function respondWithFilteredResult(_0x20fcc7,_0x2fecb9){return function(_0x5076a2){if(_0x5076a2){var _0x2cc423=typeof _0x2fecb9[_0x6306('0xd')]==='undefined'&&typeof _0x2fecb9[_0x6306('0xe')]===_0x6306('0xf');var _0x3d4c29=_0x5076a2[_0x6306('0x10')];var _0xee0cc9=_0x2cc423?0x0:_0x2fecb9[_0x6306('0xd')];var _0x410119=_0x2cc423?_0x5076a2[_0x6306('0x10')]:_0x2fecb9['offset']+_0x2fecb9[_0x6306('0xe')];var _0x1e52a0;if(_0x410119>=_0x3d4c29){_0x410119=_0x3d4c29;_0x1e52a0=0xc8;}else{_0x1e52a0=0xce;}_0x20fcc7['status'](_0x1e52a0);return _0x20fcc7[_0x6306('0x11')](_0x6306('0x12'),_0xee0cc9+'-'+_0x410119+'/'+_0x3d4c29)['json'](_0x5076a2);}return null;};}function saveUpdates(_0x1f8ab8){return function(_0x429036){if(_0x429036){return _0x429036['update'](_0x1f8ab8)[_0x6306('0x13')](function(_0x21c2cb){return _0x21c2cb;});}return null;};}function removeEntity(_0x2e7928){return function(_0x41e173){if(_0x41e173){return _0x41e173['destroy']()[_0x6306('0x13')](function(){var _0x1d2b54=_0x41e173[_0x6306('0x14')]({'plain':!![]});var _0x9bf4a9=_0x6306('0x15');return db[_0x6306('0x16')][_0x6306('0x17')]({'where':{'type':_0x9bf4a9,'resourceId':_0x1d2b54['id']}})[_0x6306('0x13')](function(){return _0x41e173;});})[_0x6306('0x13')](function(){_0x2e7928[_0x6306('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aae3f){return function(_0x257cb5){if(!_0x257cb5){_0x4aae3f[_0x6306('0xb')](0x194);}return _0x257cb5;};}function handleError(_0x5cdd7e,_0x54799f){_0x54799f=_0x54799f||0x1f4;return function(_0x53b1d8){logger[_0x6306('0x18')](_0x53b1d8[_0x6306('0x19')]);if(_0x53b1d8[_0x6306('0x1a')]){delete _0x53b1d8['name'];}_0x5cdd7e[_0x6306('0xc')](_0x54799f)['send'](_0x53b1d8);};}exports[_0x6306('0x1b')]=function(_0x205433,_0x389e85){var _0x119cae={};var _0x22bb2e={'count':0x0,'rows':[]};var _0x1271d8=_[_0x6306('0x1c')](db['WhatsappQueue']['rawAttributes'],function(_0x4f849a){return{'name':_0x4f849a[_0x6306('0x1d')],'type':_0x4f849a['type']['key']};});_0x119cae=qs[_0x6306('0x1e')](_0x1271d8,_0x205433);var _0x41eee6={'where':_0x119cae['where']};return db[_0x6306('0x1f')][_0x6306('0x10')](_0x41eee6)[_0x6306('0x13')](function(_0x3fd865){_0x22bb2e['count']=_0x3fd865;_0x119cae[_0x6306('0x20')]=qs[_0x6306('0x20')](_0x205433['query']);return db[_0x6306('0x1f')][_0x6306('0x21')](_0x119cae);})[_0x6306('0x13')](function(_0x176ead){_0x22bb2e['rows']=_0x176ead;return _0x22bb2e;})['then'](respondWithFilteredResult(_0x389e85,_0x119cae))[_0x6306('0x22')](handleError(_0x389e85,null));};exports[_0x6306('0x23')]=function(_0x4d0274,_0x450738){var _0x28b80a={'raw':!![],'where':{'id':_0x4d0274[_0x6306('0x24')]['id']}},_0x1cc71e={};_0x1cc71e[_0x6306('0x25')]=_[_0x6306('0x26')](db['WhatsappQueue'][_0x6306('0x27')]);_0x1cc71e[_0x6306('0x28')]=_[_0x6306('0x26')](_0x4d0274['query']);_0x1cc71e[_0x6306('0x29')]=_['intersection'](_0x1cc71e['model'],_0x1cc71e[_0x6306('0x28')]);_0x28b80a[_0x6306('0x2a')]=_[_0x6306('0x2b')](_0x1cc71e[_0x6306('0x25')],qs[_0x6306('0x2c')](_0x4d0274[_0x6306('0x28')][_0x6306('0x2c')]));_0x28b80a[_0x6306('0x2a')]=_0x28b80a[_0x6306('0x2a')][_0x6306('0x2d')]?_0x28b80a[_0x6306('0x2a')]:_0x1cc71e[_0x6306('0x25')];if(_0x4d0274[_0x6306('0x28')]['includeAll']){_0x28b80a[_0x6306('0x20')]=[{'all':!![]}];}_0x28b80a=_['merge']({},_0x28b80a,_0x4d0274['options']);return db[_0x6306('0x1f')][_0x6306('0x2e')](_0x28b80a)[_0x6306('0x13')](handleEntityNotFound(_0x450738,null))['then'](respondWithResult(_0x450738,null))[_0x6306('0x22')](handleError(_0x450738,null));};exports[_0x6306('0x2f')]=function(_0x19d5ec,_0xb4a9ce){return db[_0x6306('0x1f')][_0x6306('0x2f')](_0x19d5ec[_0x6306('0x30')],{})['then'](function(_0x29423d){var _0x170fcb=_0x19d5ec[_0x6306('0x31')]['get']({'plain':!![]});if(!_0x170fcb)throw new Error(_0x6306('0x32'));if(_0x170fcb[_0x6306('0x33')]===_0x6306('0x31')){var _0x292d5b=_0x29423d[_0x6306('0x14')]({'plain':!![]});var _0x4d122d=_0x6306('0x15');return db[_0x6306('0x34')][_0x6306('0x2e')]({'where':{'name':_0x4d122d,'userProfileId':_0x170fcb[_0x6306('0x35')]},'raw':!![]})['then'](function(_0x3aad32){if(_0x3aad32&&_0x3aad32[_0x6306('0x36')]===0x0){return db['UserProfileResource'][_0x6306('0x2f')]({'name':_0x292d5b['name'],'resourceId':_0x292d5b['id'],'type':_0x3aad32[_0x6306('0x1a')],'sectionId':_0x3aad32['id']},{})['then'](function(){return _0x29423d;});}else{return _0x29423d;}})[_0x6306('0x22')](function(_0x126a3c){logger[_0x6306('0x18')](_0x6306('0x37'),_0x126a3c);throw _0x126a3c;});}return _0x29423d;})[_0x6306('0x13')](respondWithResult(_0xb4a9ce,0xc9))[_0x6306('0x22')](handleError(_0xb4a9ce,null));};exports['update']=function(_0x55816e,_0x2da2bd){if(_0x55816e[_0x6306('0x30')]['id']){delete _0x55816e[_0x6306('0x30')]['id'];}return db[_0x6306('0x1f')]['find']({'where':{'id':_0x55816e[_0x6306('0x24')]['id']}})[_0x6306('0x13')](handleEntityNotFound(_0x2da2bd,null))['then'](saveUpdates(_0x55816e[_0x6306('0x30')],null))[_0x6306('0x13')](respondWithResult(_0x2da2bd,null))[_0x6306('0x22')](handleError(_0x2da2bd,null));};exports['destroy']=function(_0x24a088,_0x246e65){return db['WhatsappQueue'][_0x6306('0x2e')]({'where':{'id':_0x24a088[_0x6306('0x24')]['id']}})['then'](handleEntityNotFound(_0x246e65,null))[_0x6306('0x13')](removeEntity(_0x246e65,null))[_0x6306('0x22')](handleError(_0x246e65,null));};exports[_0x6306('0x38')]=function(_0x258516,_0x49e273){return db['WhatsappQueue'][_0x6306('0x38')]()[_0x6306('0x13')](respondWithResult(_0x49e273,null))[_0x6306('0x22')](handleError(_0x49e273,null));};exports[_0x6306('0x39')]=function(_0x11f864,_0x16a859){var _0x1bacf5={'raw':!![],'where':{}},_0x112e21={},_0x39adeb;return db['WhatsappQueue'][_0x6306('0x3a')]({'where':{'id':_0x11f864['params']['id']}})[_0x6306('0x13')](handleEntityNotFound(_0x16a859,null))['then'](function(_0x5a4f41){if(_0x5a4f41){_0x39adeb=_0x5a4f41[_0x6306('0x14')]({'plain':!![]});_0x112e21[_0x6306('0x25')]=_[_0x6306('0x26')](db[_0x6306('0x3b')][_0x6306('0x27')]);_0x112e21[_0x6306('0x28')]=_[_0x6306('0x26')](_0x11f864[_0x6306('0x28')]);_0x112e21['filters']=_[_0x6306('0x2b')](_0x112e21['model'],_0x112e21[_0x6306('0x28')]);_0x1bacf5['attributes']=_['intersection'](_0x112e21[_0x6306('0x25')],qs[_0x6306('0x2c')](_0x11f864[_0x6306('0x28')][_0x6306('0x2c')]));_0x1bacf5['attributes']=_0x1bacf5[_0x6306('0x2a')]['length']?_0x1bacf5[_0x6306('0x2a')]:_0x112e21[_0x6306('0x25')];if(!_0x11f864[_0x6306('0x28')][_0x6306('0x3c')](_0x6306('0x3d'))){_0x1bacf5[_0x6306('0xe')]=qs['limit'](_0x11f864[_0x6306('0x28')]['limit']);_0x1bacf5['offset']=qs[_0x6306('0xd')](_0x11f864['query'][_0x6306('0xd')]);}_0x1bacf5[_0x6306('0x3e')]=qs['sort'](_0x11f864[_0x6306('0x28')][_0x6306('0x3f')]);_0x1bacf5['where']=qs[_0x6306('0x29')](_[_0x6306('0x40')](_0x11f864[_0x6306('0x28')],_0x112e21[_0x6306('0x29')]));_0x1bacf5[_0x6306('0x41')][_0x6306('0x42')]=_0x5a4f41['id'];if(_0x11f864['query']['filter']){_0x1bacf5[_0x6306('0x41')]=_[_0x6306('0x43')](_0x1bacf5[_0x6306('0x41')],{'$or':_['map'](_0x1bacf5[_0x6306('0x2a')],function(_0x1938c8){var _0x915a4e={};_0x915a4e[_0x1938c8]={'$like':'%'+_0x11f864[_0x6306('0x28')][_0x6306('0x44')]+'%'};return _0x915a4e;})});}_0x1bacf5=_['merge']({},_0x1bacf5,_0x11f864['options']);return db[_0x6306('0x3b')][_0x6306('0x21')](_0x1bacf5);}})['then'](function(_0x3917b6){if(_0x3917b6){return db['User'][_0x6306('0x45')]({'where':{'id':_[_0x6306('0x1c')](_0x3917b6,_0x6306('0x46')),'role':_0x6306('0x47')},'attributes':['id',_0x6306('0x1a'),_0x6306('0x48'),_0x6306('0x49'),'createdAt']});}})['then'](function(_0x50f6cd){if(_0x50f6cd){return{'count':_0x50f6cd[_0x6306('0x10')],'rows':_['map'](_0x50f6cd[_0x6306('0x4a')],function(_0x2e9b40){return{'membername':_0x2e9b40['name'],'UserId':_0x2e9b40['id'],'queue_name':_0x39adeb['name'],'WhatsappQueueId':_0x39adeb['id'],'interface':util[_0x6306('0x4b')]('%s/%s',_0x6306('0x4c'),_0x2e9b40['name']),'penalty':0x0,'paused':_0x2e9b40[_0x6306('0x48')],'createdAt':_0x2e9b40['createdAt'],'updatedAt':_0x2e9b40[_0x6306('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x16a859,_0x1bacf5))[_0x6306('0x22')](handleError(_0x16a859,null));};exports[_0x6306('0x4d')]=function(_0x3a6674,_0x5aa8b5){var _0x130a14={};var _0x4fdcd8={};var _0x4ab752;var _0x4a54f0;return db[_0x6306('0x1f')][_0x6306('0x3a')]({'where':{'id':_0x3a6674[_0x6306('0x24')]['id']}})['then'](handleEntityNotFound(_0x5aa8b5,null))['then'](function(_0x1546c8){if(_0x1546c8){_0x4ab752=_0x1546c8;_0x4fdcd8[_0x6306('0x25')]=_[_0x6306('0x26')](db[_0x6306('0x4e')][_0x6306('0x27')]);_0x4fdcd8[_0x6306('0x28')]=_[_0x6306('0x26')](_0x3a6674[_0x6306('0x28')]);_0x4fdcd8[_0x6306('0x29')]=_[_0x6306('0x2b')](_0x4fdcd8['model'],_0x4fdcd8[_0x6306('0x28')]);_0x130a14['attributes']=_['intersection'](_0x4fdcd8['model'],qs[_0x6306('0x2c')](_0x3a6674['query'][_0x6306('0x2c')]));_0x130a14[_0x6306('0x2a')]=_0x130a14['attributes'][_0x6306('0x2d')]?_0x130a14[_0x6306('0x2a')]:_0x4fdcd8[_0x6306('0x25')];_0x130a14['order']=qs['sort'](_0x3a6674['query']['sort']);_0x130a14['where']=qs[_0x6306('0x29')](_[_0x6306('0x40')](_0x3a6674[_0x6306('0x28')],_0x4fdcd8['filters']));if(_0x3a6674[_0x6306('0x28')][_0x6306('0x44')]){_0x130a14['where']=_[_0x6306('0x43')](_0x130a14[_0x6306('0x41')],{'$or':_[_0x6306('0x1c')](_0x130a14[_0x6306('0x2a')],function(_0x3087ec){var _0x2a5162={};_0x2a5162[_0x3087ec]={'$like':'%'+_0x3a6674[_0x6306('0x28')][_0x6306('0x44')]+'%'};return _0x2a5162;})});}_0x130a14=_[_0x6306('0x43')]({},_0x130a14,_0x3a6674[_0x6306('0x4f')]);return _0x4ab752[_0x6306('0x4d')](_0x130a14);}})[_0x6306('0x13')](function(_0x44cc40){if(_0x44cc40){_0x4a54f0=_0x44cc40[_0x6306('0x2d')];if(!_0x3a6674[_0x6306('0x28')][_0x6306('0x3c')](_0x6306('0x3d'))){_0x130a14[_0x6306('0xe')]=qs[_0x6306('0xe')](_0x3a6674[_0x6306('0x28')][_0x6306('0xe')]);_0x130a14[_0x6306('0xd')]=qs['offset'](_0x3a6674['query'][_0x6306('0xd')]);}return _0x4ab752['getTeams'](_0x130a14);}})[_0x6306('0x13')](function(_0x3fff61){if(_0x3fff61){return _0x3fff61?{'count':_0x4a54f0,'rows':_0x3fff61}:null;}})[_0x6306('0x13')](respondWithResult(_0x5aa8b5,null))[_0x6306('0x22')](handleError(_0x5aa8b5,null));};exports[_0x6306('0x50')]=function(_0x342c76,_0x1bb44c){var _0x10950d=_0x342c76[_0x6306('0x30')][_0x6306('0x51')];return db['Team'][_0x6306('0x21')]({'where':{'id':_0x10950d},'attributes':['id'],'include':[{'model':db[_0x6306('0x52')],'as':_0x6306('0x53'),'attributes':['id',_0x6306('0x1a'),_0x6306('0x54'),'voicePause',_0x6306('0x55')],'raw':!![]}]})[_0x6306('0x13')](function(_0x4a4e2f){if(_0x4a4e2f){var _0x2afbba=_[_0x6306('0x56')](_0x4a4e2f,function(_0x3d1451){var _0x4601c3=_0x3d1451['get']({'plain':!![]});return _0x4601c3['Agents'];});return db[_0x6306('0x1f')][_0x6306('0x2e')]({'where':{'id':_0x342c76[_0x6306('0x24')]['id']}})[_0x6306('0x13')](function(_0x19ec55){return db['sequelize'][_0x6306('0x57')](function(_0x1c60cd){return _0x19ec55[_0x6306('0x50')](_0x10950d,{'transaction':_0x1c60cd})[_0x6306('0x13')](function(){return BPromise[_0x6306('0x58')](_0x2afbba,function(_0x462dc3){return db[_0x6306('0x3b')]['findOrCreate']({'where':{'UserId':_0x462dc3['id'],'WhatsappQueueId':_0x342c76[_0x6306('0x24')]['id']},'transaction':_0x1c60cd});});})[_0x6306('0x13')](function(){_0x2afbba['forEach'](function(_0x5f5cd9){socket['emit'](_0x6306('0x59'),{'UserId':_0x5f5cd9['id'],'WhatsappQueueId':_0x19ec55['id']});});});});});}})[_0x6306('0x13')](respondWithStatusCode(_0x1bb44c,null))[_0x6306('0x22')](handleError(_0x1bb44c,null));};exports['removeTeams']=function(_0x3bf49d,_0x2b8829){return db['Team'][_0x6306('0x21')]({'where':{'id':_0x3bf49d[_0x6306('0x28')][_0x6306('0x51')]},'attributes':['id'],'include':[{'model':db[_0x6306('0x52')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6306('0x13')](handleEntityNotFound(_0x2b8829,null))['then'](function(_0x3feffc){var _0x32c286=_[_0x6306('0x1c')](_0x3feffc,'id');var _0x4069bb=[];var _0x10ba85=[];var _0x59b689=squel[_0x6306('0x5a')]();_0x59b689[_0x6306('0x5b')](_0x6306('0x5c'))[_0x6306('0x5d')](_0x6306('0x5e'),'tq')[_0x6306('0x5f')](_0x6306('0x60'),'ut',_0x6306('0x61'))['where'](_0x6306('0x62'),_0x3bf49d[_0x6306('0x24')]['id']);for(var _0x3dcf5f=0x0;_0x3dcf5f<_0x3feffc[_0x6306('0x2d')];_0x3dcf5f+=0x1){let _0x29b72d=_0x3feffc[_0x3dcf5f];for(var _0x540070=0x0;_0x540070<_0x29b72d['Agents'][_0x6306('0x2d')];_0x540070+=0x1){let _0x63a9f2=_0x29b72d['Agents'][_0x540070];var _0x4acbfa=_0x59b689['clone']();_0x4acbfa[_0x6306('0x41')](_0x6306('0x63'),_0x63a9f2['id']);_0x10ba85[_0x6306('0x64')](db[_0x6306('0x65')][_0x6306('0x28')](_0x4acbfa[_0x6306('0x66')](),{'type':db[_0x6306('0x65')][_0x6306('0x67')][_0x6306('0x68')]})[_0x6306('0x13')](function(_0x330281){if(_0x330281[_0x6306('0x2d')]===0x1){return _0x63a9f2['id'];}else{var _0x1f76d0=_['every'](_[_0x6306('0x1c')](_0x330281,'TeamId'),function(_0x3570ac){return _['includes'](_0x32c286,_0x3570ac);});if(_0x1f76d0){return _0x63a9f2['id'];}}}));}}return BPromise[_0x6306('0x69')](_0x10ba85)[_0x6306('0x13')](function(_0x1568ca){_0x4069bb=_(_0x4069bb)[_0x6306('0x6a')](_0x1568ca)[_0x6306('0x6b')]()['value']();return db[_0x6306('0x1f')]['find']({'where':{'id':_0x3bf49d[_0x6306('0x24')]['id']}})[_0x6306('0x13')](function(_0x3655e6){return db[_0x6306('0x65')][_0x6306('0x57')](function(_0x10f187){return _0x3655e6[_0x6306('0x6c')](_0x3bf49d['query'][_0x6306('0x51')],{'transaction':_0x10f187})[_0x6306('0x13')](function(){if(!_[_0x6306('0x6d')](_0x4069bb)){return _0x3655e6[_0x6306('0x6e')](_0x4069bb,{'transaction':_0x10f187});}})[_0x6306('0x13')](function(){_0x4069bb[_0x6306('0x6f')](function(_0x5cb57e){socket[_0x6306('0x70')](_0x6306('0x71'),{'UserId':_0x5cb57e,'WhatsappQueueId':_0x3655e6['id']});});});});});});})[_0x6306('0x13')](respondWithStatusCode(_0x2b8829,null))[_0x6306('0x22')](handleError(_0x2b8829,null));};exports[_0x6306('0x72')]=function(_0x159367,_0x533df4){return db['WhatsappQueue']['find']({'where':{'id':_0x159367[_0x6306('0x24')]['id']}})[_0x6306('0x13')](handleEntityNotFound(_0x533df4,null))[_0x6306('0x13')](function(_0x21a6f4){if(_0x21a6f4){return _0x21a6f4[_0x6306('0x72')](_0x159367[_0x6306('0x30')][_0x6306('0x51')],_[_0x6306('0x73')](_0x159367[_0x6306('0x30')],[_0x6306('0x51'),'id'])||{})['spread'](function(_0x59877f){for(var _0x30c0b6=0x0;_0x30c0b6<_0x159367['body'][_0x6306('0x51')]['length'];_0x30c0b6+=0x1){socket[_0x6306('0x70')](_0x6306('0x59'),{'UserId':Number(_0x159367[_0x6306('0x30')][_0x6306('0x51')][_0x30c0b6]),'WhatsappQueueId':Number(_0x159367[_0x6306('0x24')]['id'])});}return _0x59877f;});}})[_0x6306('0x13')](respondWithResult(_0x533df4,null))[_0x6306('0x22')](handleError(_0x533df4,null));};exports[_0x6306('0x6e')]=function(_0x13b7bb,_0x597a37){return db['WhatsappQueue']['find']({'where':{'id':_0x13b7bb[_0x6306('0x24')]['id']}})[_0x6306('0x13')](handleEntityNotFound(_0x597a37,null))[_0x6306('0x13')](function(_0xa8f854){if(_0xa8f854){return _0xa8f854[_0x6306('0x6e')](_0x13b7bb[_0x6306('0x28')][_0x6306('0x51')])[_0x6306('0x13')](function(){if(_['isArray'](_0x13b7bb[_0x6306('0x28')][_0x6306('0x51')])){for(var _0x207c54=0x0;_0x207c54<_0x13b7bb[_0x6306('0x28')][_0x6306('0x51')][_0x6306('0x2d')];_0x207c54+=0x1){socket[_0x6306('0x70')]('userWhatsappQueue:remove',{'UserId':Number(_0x13b7bb[_0x6306('0x28')][_0x6306('0x51')][_0x207c54]),'WhatsappQueueId':Number(_0x13b7bb[_0x6306('0x24')]['id'])});}}else{socket[_0x6306('0x70')](_0x6306('0x71'),{'UserId':Number(_0x13b7bb[_0x6306('0x28')][_0x6306('0x51')]),'WhatsappQueueId':Number(_0x13b7bb[_0x6306('0x24')]['id'])});}});}})[_0x6306('0x13')](respondWithStatusCode(_0x597a37,null))[_0x6306('0x22')](handleError(_0x597a37,null));};exports[_0x6306('0x74')]=function(_0x3bce96,_0x36ea12){var _0x580101={};var _0x7f2648={};var _0x46c218;var _0x272085;return db[_0x6306('0x1f')][_0x6306('0x3a')]({'where':{'id':_0x3bce96[_0x6306('0x24')]['id']}})['then'](handleEntityNotFound(_0x36ea12,null))[_0x6306('0x13')](function(_0x3970d1){if(_0x3970d1){_0x46c218=_0x3970d1;_0x7f2648[_0x6306('0x25')]=_[_0x6306('0x26')](db[_0x6306('0x52')][_0x6306('0x27')]);_0x7f2648[_0x6306('0x28')]=_[_0x6306('0x26')](_0x3bce96[_0x6306('0x28')]);_0x7f2648[_0x6306('0x29')]=_[_0x6306('0x2b')](_0x7f2648[_0x6306('0x25')],_0x7f2648[_0x6306('0x28')]);_0x580101[_0x6306('0x2a')]=_['intersection'](_0x7f2648['model'],qs[_0x6306('0x2c')](_0x3bce96[_0x6306('0x28')][_0x6306('0x2c')]));_0x580101[_0x6306('0x2a')]=_0x580101['attributes'][_0x6306('0x2d')]?_0x580101['attributes']:_0x7f2648[_0x6306('0x25')];_0x580101[_0x6306('0x3e')]=qs[_0x6306('0x3f')](_0x3bce96['query'][_0x6306('0x3f')]);_0x580101['where']=qs[_0x6306('0x29')](_[_0x6306('0x40')](_0x3bce96[_0x6306('0x28')],_0x7f2648[_0x6306('0x29')]));if(_0x3bce96['query']['filter']){_0x580101[_0x6306('0x41')]=_['merge'](_0x580101[_0x6306('0x41')],{'$or':_[_0x6306('0x1c')](_0x580101[_0x6306('0x2a')],function(_0x555a3e){var _0x885f7b={};_0x885f7b[_0x555a3e]={'$like':'%'+_0x3bce96[_0x6306('0x28')][_0x6306('0x44')]+'%'};return _0x885f7b;})});}_0x580101=_[_0x6306('0x43')]({},_0x580101,_0x3bce96['options']);return _0x46c218[_0x6306('0x74')](_0x580101);}})[_0x6306('0x13')](function(_0x5acb83){if(_0x5acb83){_0x272085=_0x5acb83[_0x6306('0x2d')];if(!_0x3bce96[_0x6306('0x28')]['hasOwnProperty'](_0x6306('0x3d'))){_0x580101[_0x6306('0xe')]=qs[_0x6306('0xe')](_0x3bce96['query'][_0x6306('0xe')]);_0x580101[_0x6306('0xd')]=qs['offset'](_0x3bce96[_0x6306('0x28')][_0x6306('0xd')]);}return _0x46c218[_0x6306('0x74')](_0x580101);}})[_0x6306('0x13')](function(_0x2cbbfc){if(_0x2cbbfc){return _0x2cbbfc?{'count':_0x272085,'rows':_0x2cbbfc}:null;}})['then'](respondWithResult(_0x36ea12,null))['catch'](handleError(_0x36ea12,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index f8bfe33..3a0985b 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 _0x9a31=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x91d0b5,_0x31c1fa){var _0x55c810=function(_0x4f3753){while(--_0x4f3753){_0x91d0b5['push'](_0x91d0b5['shift']());}};_0x55c810(++_0x31c1fa);}(_0x9a31,0x118));var _0x19a3=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x9a31[_0x1d39f6];return _0x3dbd7a;};'use strict';var EventEmitter=require(_0x19a3('0x0'));var WhatsappQueue=require(_0x19a3('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x19a3('0x2')](0x0);var events={'afterCreate':_0x19a3('0x3'),'afterUpdate':_0x19a3('0x4'),'afterDestroy':_0x19a3('0x5')};function emitEvent(_0x4a1820){return function(_0x1107ae,_0xcbc30a,_0x36f974){WhatsappQueueEvents[_0x19a3('0x6')](_0x4a1820+':'+_0x1107ae['id'],_0x1107ae);WhatsappQueueEvents[_0x19a3('0x6')](_0x4a1820,_0x1107ae);_0x36f974(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x19a3('0x7')](e,emitEvent(event));}}module[_0x19a3('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf4df=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x382bba,_0x552036){var _0x208ad7=function(_0x47fed8){while(--_0x47fed8){_0x382bba['push'](_0x382bba['shift']());}};_0x208ad7(++_0x552036);}(_0xf4df,0x1b9));var _0xff4d=function(_0x3e7c63,_0xc2b958){_0x3e7c63=_0x3e7c63-0x0;var _0x1ddc57=_0xf4df[_0x3e7c63];return _0x1ddc57;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xff4d('0x0'))['db'][_0xff4d('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xff4d('0x2')](0x0);var events={'afterCreate':_0xff4d('0x3'),'afterUpdate':_0xff4d('0x4'),'afterDestroy':_0xff4d('0x5')};function emitEvent(_0x2cdac7){return function(_0x103e16,_0x152e9f,_0x426c8a){WhatsappQueueEvents[_0xff4d('0x6')](_0x2cdac7+':'+_0x103e16['id'],_0x103e16);WhatsappQueueEvents['emit'](_0x2cdac7,_0x103e16);_0x426c8a(null);};}for(var e in events){if(events[_0xff4d('0x7')](e)){var event=events[e];WhatsappQueue[_0xff4d('0x8')](e,emitEvent(event));}}module[_0xff4d('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 1b9cc3d..69688f2 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 _0x069f=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','lodash','util','moment'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x069f,0x147));var _0xf069=function(_0x3b6648,_0x2d723a){_0x3b6648=_0x3b6648-0x0;var _0x5a0a0d=_0x069f[_0x3b6648];return _0x5a0a0d;};'use strict';var _=require(_0xf069('0x0'));var util=require(_0xf069('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf069('0x2'));var BPromise=require(_0xf069('0x3'));var rp=require(_0xf069('0x4'));var fs=require('fs');var path=require(_0xf069('0x5'));var rimraf=require(_0xf069('0x6'));var config=require(_0xf069('0x7'));var attributes=require(_0xf069('0x8'));module[_0xf069('0x9')]=function(_0x2828d6,_0x4f4633){return _0x2828d6['define']('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa711=['whatsapp_queues','lodash','../../config/logger','api','bluebird','request-promise','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x2d0043,_0x160399){var _0x1a7c6f=function(_0x1921dc){while(--_0x1921dc){_0x2d0043['push'](_0x2d0043['shift']());}};_0x1a7c6f(++_0x160399);}(_0xa711,0x123));var _0x1a71=function(_0x25e324,_0x4e7e0f){_0x25e324=_0x25e324-0x0;var _0x863d7a=_0xa711[_0x25e324];return _0x863d7a;};'use strict';var _=require(_0x1a71('0x0'));var util=require('util');var logger=require(_0x1a71('0x1'))(_0x1a71('0x2'));var moment=require('moment');var BPromise=require(_0x1a71('0x3'));var rp=require(_0x1a71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1a71('0x5'));module[_0x1a71('0x6')]=function(_0xcf45c,_0x221da7){return _0xcf45c[_0x1a71('0x7')](_0x1a71('0x8'),attributes,{'tableName':_0x1a71('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 6942982..4c3e88c 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 _0xd40b=['message','info','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','include','map','model','debug','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x26013b,_0x23d44e){var _0x16a91f=function(_0x1bb368){while(--_0x1bb368){_0x26013b['push'](_0x26013b['shift']());}};_0x16a91f(++_0x23d44e);}(_0xd40b,0xd9));var _0xbd40=function(_0x3f975d,_0x306b4a){_0x3f975d=_0x3f975d-0x0;var _0x42ede1=_0xd40b[_0x3f975d];return _0x42ede1;};'use strict';var _=require(_0xbd40('0x0'));var util=require('util');var moment=require(_0xbd40('0x1'));var BPromise=require(_0xbd40('0x2'));var rs=require(_0xbd40('0x3'));var fs=require('fs');var Redis=require(_0xbd40('0x4'));var db=require(_0xbd40('0x5'))['db'];var utils=require(_0xbd40('0x6'));var logger=require(_0xbd40('0x7'))('rpc');var config=require(_0xbd40('0x8'));var jayson=require(_0xbd40('0x9'));var client=jayson[_0xbd40('0xa')][_0xbd40('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbd40('0xc')],{'host':_0xbd40('0xd'),'port':0x18eb});var socket=require(_0xbd40('0xe'))(new Redis(config[_0xbd40('0xc')]));require(_0xbd40('0xf'))[_0xbd40('0x10')](socket);function respondWithRpcPromise(_0x387b48,_0x36ed55,_0x3f4fff){return new BPromise(function(_0x191f77,_0x3c0fdd){return client['request'](_0x387b48,_0x3f4fff)[_0xbd40('0x11')](function(_0x585eab){logger['info'](_0xbd40('0x12'),_0x36ed55,_0xbd40('0x13'));logger['debug'](_0xbd40('0x14'),_0x36ed55,'request\x20sent',JSON[_0xbd40('0x15')](_0x585eab));if(_0x585eab['error']){if(_0x585eab[_0xbd40('0x16')]['code']===0x1f4){logger[_0xbd40('0x16')](_0xbd40('0x12'),_0x36ed55,_0x585eab[_0xbd40('0x16')][_0xbd40('0x17')]);return _0x3c0fdd(_0x585eab['error']['message']);}logger[_0xbd40('0x16')](_0xbd40('0x12'),_0x36ed55,_0x585eab['error'][_0xbd40('0x17')]);return _0x191f77(_0x585eab['error'][_0xbd40('0x17')]);}else{logger[_0xbd40('0x18')](_0xbd40('0x12'),_0x36ed55,_0xbd40('0x13'));_0x191f77(_0x585eab[_0xbd40('0x19')]['message']);}})[_0xbd40('0x1a')](function(_0x12e928){logger[_0xbd40('0x16')](_0xbd40('0x12'),_0x36ed55,_0x12e928);_0x3c0fdd(_0x12e928);});});}exports['GetWhatsappQueue']=function(_0x432330){var _0x423027=this;return new Promise(function(_0x4aa4a7,_0x5a90a0){return db[_0xbd40('0x1b')][_0xbd40('0x1c')]({'raw':_0x432330['options']?_0x432330[_0xbd40('0x1d')][_0xbd40('0x1e')]===undefined?!![]:![]:!![],'where':_0x432330[_0xbd40('0x1d')]?_0x432330['options'][_0xbd40('0x1f')]||null:null,'attributes':_0x432330[_0xbd40('0x1d')]?_0x432330['options'][_0xbd40('0x20')]||null:null,'limit':_0x432330[_0xbd40('0x1d')]?_0x432330['options']['limit']||null:null,'include':_0x432330[_0xbd40('0x1d')]?_0x432330[_0xbd40('0x1d')][_0xbd40('0x21')]?_[_0xbd40('0x22')](_0x432330['options']['include'],function(_0x4e2abc){return{'model':db[_0x4e2abc[_0xbd40('0x23')]],'as':_0x4e2abc['as'],'attributes':_0x4e2abc['attributes'],'include':_0x4e2abc[_0xbd40('0x21')]?_['map'](_0x4e2abc['include'],function(_0x433344){return{'model':db[_0x433344[_0xbd40('0x23')]],'as':_0x433344['as'],'attributes':_0x433344[_0xbd40('0x20')],'include':_0x433344['include']?_[_0xbd40('0x22')](_0x433344[_0xbd40('0x21')],function(_0x820818){return{'model':db[_0x820818[_0xbd40('0x23')]],'as':_0x820818['as'],'attributes':_0x820818[_0xbd40('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd40('0x11')](function(_0x15dea0){logger[_0xbd40('0x18')]('GetWhatsappQueue',_0x432330);logger[_0xbd40('0x24')]('GetWhatsappQueue',_0x432330,JSON[_0xbd40('0x15')](_0x15dea0));_0x4aa4a7(_0x15dea0);})[_0xbd40('0x1a')](function(_0x38f877){logger['error'](_0xbd40('0x25'),_0x38f877[_0xbd40('0x17')],_0x432330);_0x5a90a0(_0x423027[_0xbd40('0x16')](0x1f4,_0x38f877[_0xbd40('0x17')]));});});};exports[_0xbd40('0x26')]=function(_0x4e45b1){var _0x4e7621=this;return new Promise(function(_0x17e3b3,_0x5b7193){return db[_0xbd40('0x1b')][_0xbd40('0x27')]({'raw':_0x4e45b1['options']?_0x4e45b1[_0xbd40('0x1d')][_0xbd40('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e45b1[_0xbd40('0x1d')]?_0x4e45b1[_0xbd40('0x1d')][_0xbd40('0x1f')]||null:null,'attributes':_0x4e45b1['options']?_0x4e45b1[_0xbd40('0x1d')][_0xbd40('0x20')]||null:null,'include':_0x4e45b1[_0xbd40('0x1d')]?_0x4e45b1[_0xbd40('0x1d')]['include']?_[_0xbd40('0x22')](_0x4e45b1['options'][_0xbd40('0x21')],function(_0x3e9c01){return{'model':db[_0x3e9c01['model']],'as':_0x3e9c01['as'],'attributes':_0x3e9c01['attributes'],'include':_0x3e9c01['include']?_[_0xbd40('0x22')](_0x3e9c01['include'],function(_0x20fffb){return{'model':db[_0x20fffb[_0xbd40('0x23')]],'as':_0x20fffb['as'],'attributes':_0x20fffb['attributes'],'include':_0x20fffb[_0xbd40('0x21')]?_[_0xbd40('0x22')](_0x20fffb['include'],function(_0x251760){return{'model':db[_0x251760[_0xbd40('0x23')]],'as':_0x251760['as'],'attributes':_0x251760[_0xbd40('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbd40('0x11')](function(_0x7ac235){logger[_0xbd40('0x18')](_0xbd40('0x26'),_0x4e45b1);logger[_0xbd40('0x24')](_0xbd40('0x26'),_0x4e45b1,JSON['stringify'](_0x7ac235));_0x17e3b3(_0x7ac235);})[_0xbd40('0x1a')](function(_0x152f03){logger[_0xbd40('0x16')](_0xbd40('0x26'),_0x152f03[_0xbd40('0x17')],_0x4e45b1);_0x5b7193(_0x4e7621[_0xbd40('0x16')](0x1f4,_0x152f03[_0xbd40('0x17')]));});});}; \ No newline at end of file +var _0x1ee8=['catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowWhatsappQueue','find','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x5cfda6,_0x1d64e6){var _0x279770=function(_0x115701){while(--_0x115701){_0x5cfda6['push'](_0x5cfda6['shift']());}};_0x279770(++_0x1d64e6);}(_0x1ee8,0xa7));var _0x81ee=function(_0x6c44a1,_0x17df10){_0x6c44a1=_0x6c44a1-0x0;var _0x28a4b7=_0x1ee8[_0x6c44a1];return _0x28a4b7;};'use strict';var _=require('lodash');var util=require(_0x81ee('0x0'));var moment=require(_0x81ee('0x1'));var BPromise=require('bluebird');var rs=require(_0x81ee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x81ee('0x3'))(_0x81ee('0x4'));var config=require('../../config/environment');var jayson=require(_0x81ee('0x5'));var client=jayson[_0x81ee('0x6')]['http']({'port':0x232a});config[_0x81ee('0x7')]=_[_0x81ee('0x8')](config[_0x81ee('0x7')],{'host':_0x81ee('0x9'),'port':0x18eb});var socket=require(_0x81ee('0xa'))(new Redis(config['redis']));require(_0x81ee('0xb'))[_0x81ee('0xc')](socket);function respondWithRpcPromise(_0x294517,_0x177038,_0x40f13e){return new BPromise(function(_0x33d0ab,_0x1ad000){return client[_0x81ee('0xd')](_0x294517,_0x40f13e)[_0x81ee('0xe')](function(_0x374274){logger[_0x81ee('0xf')](_0x81ee('0x10'),_0x177038,_0x81ee('0x11'));logger[_0x81ee('0x12')](_0x81ee('0x13'),_0x177038,_0x81ee('0x11'),JSON['stringify'](_0x374274));if(_0x374274['error']){if(_0x374274['error']['code']===0x1f4){logger[_0x81ee('0x14')](_0x81ee('0x10'),_0x177038,_0x374274[_0x81ee('0x14')][_0x81ee('0x15')]);return _0x1ad000(_0x374274[_0x81ee('0x14')]['message']);}logger[_0x81ee('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x177038,_0x374274[_0x81ee('0x14')][_0x81ee('0x15')]);return _0x33d0ab(_0x374274[_0x81ee('0x14')][_0x81ee('0x15')]);}else{logger[_0x81ee('0xf')](_0x81ee('0x10'),_0x177038,'request\x20sent');_0x33d0ab(_0x374274[_0x81ee('0x16')]['message']);}})[_0x81ee('0x17')](function(_0x1c067c){logger[_0x81ee('0x14')](_0x81ee('0x10'),_0x177038,_0x1c067c);_0x1ad000(_0x1c067c);});});}exports[_0x81ee('0x18')]=function(_0x20600b){var _0x40939e=this;return new Promise(function(_0x2ad413,_0x5254c6){return db[_0x81ee('0x19')][_0x81ee('0x1a')]({'raw':_0x20600b[_0x81ee('0x1b')]?_0x20600b[_0x81ee('0x1b')][_0x81ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x20600b['options']?_0x20600b[_0x81ee('0x1b')][_0x81ee('0x1d')]||null:null,'attributes':_0x20600b[_0x81ee('0x1b')]?_0x20600b['options']['attributes']||null:null,'limit':_0x20600b['options']?_0x20600b[_0x81ee('0x1b')][_0x81ee('0x1e')]||null:null,'include':_0x20600b['options']?_0x20600b[_0x81ee('0x1b')][_0x81ee('0x1f')]?_[_0x81ee('0x20')](_0x20600b[_0x81ee('0x1b')]['include'],function(_0x5700d7){return{'model':db[_0x5700d7['model']],'as':_0x5700d7['as'],'attributes':_0x5700d7['attributes'],'include':_0x5700d7[_0x81ee('0x1f')]?_[_0x81ee('0x20')](_0x5700d7[_0x81ee('0x1f')],function(_0x4771a7){return{'model':db[_0x4771a7[_0x81ee('0x21')]],'as':_0x4771a7['as'],'attributes':_0x4771a7[_0x81ee('0x22')],'include':_0x4771a7[_0x81ee('0x1f')]?_[_0x81ee('0x20')](_0x4771a7[_0x81ee('0x1f')],function(_0x115d76){return{'model':db[_0x115d76[_0x81ee('0x21')]],'as':_0x115d76['as'],'attributes':_0x115d76[_0x81ee('0x22')]};}):[]};}):[]};}):[]:[]})[_0x81ee('0xe')](function(_0x445ca5){logger[_0x81ee('0xf')](_0x81ee('0x18'),_0x20600b);logger[_0x81ee('0x12')](_0x81ee('0x18'),_0x20600b,JSON[_0x81ee('0x23')](_0x445ca5));_0x2ad413(_0x445ca5);})['catch'](function(_0x30b060){logger[_0x81ee('0x14')]('GetWhatsappQueue',_0x30b060[_0x81ee('0x15')],_0x20600b);_0x5254c6(_0x40939e[_0x81ee('0x14')](0x1f4,_0x30b060[_0x81ee('0x15')]));});});};exports[_0x81ee('0x24')]=function(_0x4411db){var _0x294d32=this;return new Promise(function(_0x220fca,_0x3b8cd){return db[_0x81ee('0x19')][_0x81ee('0x25')]({'raw':_0x4411db['options']?_0x4411db[_0x81ee('0x1b')][_0x81ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x4411db[_0x81ee('0x1b')]?_0x4411db['options']['where']||null:null,'attributes':_0x4411db[_0x81ee('0x1b')]?_0x4411db['options'][_0x81ee('0x22')]||null:null,'include':_0x4411db[_0x81ee('0x1b')]?_0x4411db[_0x81ee('0x1b')][_0x81ee('0x1f')]?_['map'](_0x4411db[_0x81ee('0x1b')][_0x81ee('0x1f')],function(_0x3ce379){return{'model':db[_0x3ce379[_0x81ee('0x21')]],'as':_0x3ce379['as'],'attributes':_0x3ce379[_0x81ee('0x22')],'include':_0x3ce379['include']?_['map'](_0x3ce379[_0x81ee('0x1f')],function(_0x475085){return{'model':db[_0x475085[_0x81ee('0x21')]],'as':_0x475085['as'],'attributes':_0x475085['attributes'],'include':_0x475085[_0x81ee('0x1f')]?_[_0x81ee('0x20')](_0x475085[_0x81ee('0x1f')],function(_0x13df67){return{'model':db[_0x13df67[_0x81ee('0x21')]],'as':_0x13df67['as'],'attributes':_0x13df67['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x49b8db){logger[_0x81ee('0xf')]('ShowWhatsappQueue',_0x4411db);logger['debug']('ShowWhatsappQueue',_0x4411db,JSON[_0x81ee('0x23')](_0x49b8db));_0x220fca(_0x49b8db);})['catch'](function(_0x37a5ed){logger[_0x81ee('0x14')]('ShowWhatsappQueue',_0x37a5ed['message'],_0x4411db);_0x3b8cd(_0x294d32[_0x81ee('0x14')](0x1f4,_0x37a5ed[_0x81ee('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 280d053..f7dc646 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 _0xfa03=['remove','update','emit','removeListener','register','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfa03,0x10e));var _0x3fa0=function(_0x1afb7d,_0x512add){_0x1afb7d=_0x1afb7d-0x0;var _0x17d755=_0xfa03[_0x1afb7d];return _0x17d755;};'use strict';var WhatsappQueueEvents=require(_0x3fa0('0x0'));var events=[_0x3fa0('0x1'),_0x3fa0('0x2'),_0x3fa0('0x3')];function createListener(_0x122ce4,_0x21b0ff){return function(_0x303d36){_0x21b0ff[_0x3fa0('0x4')](_0x122ce4,_0x303d36);};}function removeListener(_0x1933cc,_0x206c78){return function(){WhatsappQueueEvents[_0x3fa0('0x5')](_0x1933cc,_0x206c78);};}exports[_0x3fa0('0x6')]=function(_0xc08d82){for(var _0x312793=0x0,_0x63c221=events['length'];_0x312793<_0x63c221;_0x312793++){var _0x396fc9=events[_0x312793];var _0x5007a1=createListener(_0x3fa0('0x7')+_0x396fc9,_0xc08d82);WhatsappQueueEvents['on'](_0x396fc9,_0x5007a1);}}; \ No newline at end of file +var _0xcecd=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x3990d3,_0x54d8cc){var _0x2218fa=function(_0x4adebf){while(--_0x4adebf){_0x3990d3['push'](_0x3990d3['shift']());}};_0x2218fa(++_0x54d8cc);}(_0xcecd,0x8d));var _0xdcec=function(_0x33445f,_0x1c5487){_0x33445f=_0x33445f-0x0;var _0x3c52ae=_0xcecd[_0x33445f];return _0x3c52ae;};'use strict';var WhatsappQueueEvents=require(_0xdcec('0x0'));var events=[_0xdcec('0x1'),_0xdcec('0x2'),_0xdcec('0x3')];function createListener(_0x50e0cd,_0x233653){return function(_0x92900d){_0x233653[_0xdcec('0x4')](_0x50e0cd,_0x92900d);};}function removeListener(_0x571a65,_0x10e045){return function(){WhatsappQueueEvents[_0xdcec('0x5')](_0x571a65,_0x10e045);};}exports[_0xdcec('0x6')]=function(_0x12e470){for(var _0x2c9979=0x0,_0x18983b=events[_0xdcec('0x7')];_0x2c9979<_0x18983b;_0x2c9979++){var _0x29f6da=events[_0x2c9979];var _0x26f234=createListener(_0xdcec('0x8')+_0x29f6da,_0x12e470);WhatsappQueueEvents['on'](_0x29f6da,_0x26f234);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7ea2691..ce8365b 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 _0x5d1c=['get','isAuthenticated','index','/describe','/:id','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller'];(function(_0x1d8ecf,_0x2f3ef1){var _0x31536f=function(_0x2176a0){while(--_0x2176a0){_0x1d8ecf['push'](_0x1d8ecf['shift']());}};_0x31536f(++_0x2f3ef1);}(_0x5d1c,0x1cc));var _0xc5d1=function(_0x50ea5f,_0x499bd5){_0x50ea5f=_0x50ea5f-0x0;var _0x4670e7=_0x5d1c[_0x50ea5f];return _0x4670e7;};'use strict';var multer=require('multer');var util=require(_0xc5d1('0x0'));var path=require(_0xc5d1('0x1'));var timeout=require(_0xc5d1('0x2'));var express=require('express');var router=express[_0xc5d1('0x3')]();var fs_extra=require(_0xc5d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc5d1('0x5'));var config=require(_0xc5d1('0x6'));var controller=require(_0xc5d1('0x7'));router[_0xc5d1('0x8')]('/',auth[_0xc5d1('0x9')](),controller[_0xc5d1('0xa')]);router[_0xc5d1('0x8')](_0xc5d1('0xb'),auth[_0xc5d1('0x9')](),controller['describe']);router[_0xc5d1('0x8')](_0xc5d1('0xc'),auth[_0xc5d1('0x9')](),controller['show']);router['post']('/',auth[_0xc5d1('0x9')](),controller[_0xc5d1('0xd')]);router[_0xc5d1('0xe')](_0xc5d1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc5d1('0xf')](_0xc5d1('0xc'),auth[_0xc5d1('0x9')](),controller[_0xc5d1('0x10')]);module[_0xc5d1('0x11')]=router; \ No newline at end of file +var _0xab89=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14c43d,_0x3878be){var _0x305631=function(_0x4815c2){while(--_0x4815c2){_0x14c43d['push'](_0x14c43d['shift']());}};_0x305631(++_0x3878be);}(_0xab89,0x1ed));var _0x9ab8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xab89[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x9ab8('0x0'));var util=require(_0x9ab8('0x1'));var path=require(_0x9ab8('0x2'));var timeout=require('connect-timeout');var express=require(_0x9ab8('0x3'));var router=express['Router']();var fs_extra=require(_0x9ab8('0x4'));var auth=require(_0x9ab8('0x5'));var interaction=require(_0x9ab8('0x6'));var config=require(_0x9ab8('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x9ab8('0x8')]('/',auth[_0x9ab8('0x9')](),controller[_0x9ab8('0xa')]);router[_0x9ab8('0x8')](_0x9ab8('0xb'),auth[_0x9ab8('0x9')](),controller[_0x9ab8('0xc')]);router[_0x9ab8('0x8')](_0x9ab8('0xd'),auth[_0x9ab8('0x9')](),controller[_0x9ab8('0xe')]);router[_0x9ab8('0xf')]('/',auth[_0x9ab8('0x9')](),controller[_0x9ab8('0x10')]);router[_0x9ab8('0x11')](_0x9ab8('0xd'),auth[_0x9ab8('0x9')](),controller['update']);router['delete'](_0x9ab8('0xd'),auth[_0x9ab8('0x9')](),controller[_0x9ab8('0x12')]);module[_0x9ab8('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 285cc49..bbd1a9d 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(_0x3b5439,_0x30b922){var _0x3c62ac=function(_0x21b5fb){while(--_0x21b5fb){_0x3b5439['push'](_0x3b5439['shift']());}};_0x3c62ac(++_0x30b922);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4f8ebc,_0x529e08){var _0x28e654=function(_0x423783){while(--_0x423783){_0x4f8ebc['push'](_0x4f8ebc['shift']());}};_0x28e654(++_0x529e08);}(_0x7a54,0x106));var _0x47a5=function(_0x2174a2,_0x5a6bf9){_0x2174a2=_0x2174a2-0x0;var _0x159ab6=_0x7a54[_0x2174a2];return _0x159ab6;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index a332230..88f1133 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 _0x0bb5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','options','findAll','show','params','rawAttributes','includeAll','include','find','catch','create','body','update','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','end','name','send','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x152646,_0x5f2c54){var _0x1e9302=function(_0x1babd3){while(--_0x1babd3){_0x152646['push'](_0x152646['shift']());}};_0x1e9302(++_0x5f2c54);}(_0x0bb5,0x148));var _0x50bb=function(_0x131c48,_0xcf6022){_0x131c48=_0x131c48-0x0;var _0x106c28=_0x0bb5[_0x131c48];return _0x106c28;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x226370,_0x58837d){_0x58837d=_0x58837d||0xcc;return function(_0x283f04){if(_0x283f04){return _0x226370[_0x50bb('0x19')](_0x58837d);}return _0x226370[_0x50bb('0x1a')](_0x58837d)['end']();};}function respondWithResult(_0x17007f,_0x309986){_0x309986=_0x309986||0xc8;return function(_0x3094f2){if(_0x3094f2){return _0x17007f['status'](_0x309986)[_0x50bb('0x1b')](_0x3094f2);}};}function respondWithFilteredResult(_0x5e8478,_0x21befa){return function(_0x3e1a51){if(_0x3e1a51){var _0x253073=typeof _0x21befa[_0x50bb('0x1c')]===_0x50bb('0x1d')&&typeof _0x21befa['limit']===_0x50bb('0x1d');var _0x174065=_0x3e1a51['count'];var _0x24ba19=_0x253073?0x0:_0x21befa['offset'];var _0x301f61=_0x253073?_0x3e1a51[_0x50bb('0x1e')]:_0x21befa['offset']+_0x21befa['limit'];var _0x43465b;if(_0x301f61>=_0x174065){_0x301f61=_0x174065;_0x43465b=0xc8;}else{_0x43465b=0xce;}_0x5e8478[_0x50bb('0x1a')](_0x43465b);return _0x5e8478[_0x50bb('0x1f')](_0x50bb('0x20'),_0x24ba19+'-'+_0x301f61+'/'+_0x174065)['json'](_0x3e1a51);}return null;};}function patchUpdates(_0x19dc5d){return function(_0x32bfc3){try{jsonpatch[_0x50bb('0x21')](_0x32bfc3,_0x19dc5d,!![]);}catch(_0x597e95){return BPromise[_0x50bb('0x22')](_0x597e95);}return _0x32bfc3[_0x50bb('0x23')]();};}function saveUpdates(_0x1344ec,_0x4825f8){return function(_0x1dbba2){if(_0x1dbba2){return _0x1dbba2['update'](_0x1344ec)[_0x50bb('0x24')](function(_0x3391da){return _0x3391da;});}return null;};}function removeEntity(_0x1a2a0b,_0x2ee87a){return function(_0x846311){if(_0x846311){return _0x846311[_0x50bb('0x25')]()['then'](function(){_0x1a2a0b[_0x50bb('0x1a')](0xcc)[_0x50bb('0x26')]();});}};}function handleEntityNotFound(_0x284a76,_0x3462c1){return function(_0x5234d7){if(!_0x5234d7){_0x284a76[_0x50bb('0x19')](0x194);}return _0x5234d7;};}function handleError(_0x4d38f7,_0x55e87b){_0x55e87b=_0x55e87b||0x1f4;return function(_0x2befd9){logger['error'](_0x2befd9['stack']);if(_0x2befd9[_0x50bb('0x27')]){delete _0x2befd9[_0x50bb('0x27')];}_0x4d38f7[_0x50bb('0x1a')](_0x55e87b)[_0x50bb('0x28')](_0x2befd9);};}exports[_0x50bb('0x29')]=function(_0x269479,_0x41a8ad){var _0x41d479={},_0x4f7514={},_0x44ce86={'count':0x0,'rows':[]};var _0x461cf3=_[_0x50bb('0x2a')](db[_0x50bb('0x2b')]['rawAttributes'],function(_0x13dc3c){return{'name':_0x13dc3c[_0x50bb('0x2c')],'type':_0x13dc3c[_0x50bb('0x2d')][_0x50bb('0x2e')]};});_0x4f7514[_0x50bb('0x2f')]=_[_0x50bb('0x2a')](_0x461cf3,_0x50bb('0x27'));_0x4f7514[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x269479[_0x50bb('0x30')]);_0x4f7514[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x4f7514['model'],_0x4f7514[_0x50bb('0x30')]);_0x41d479[_0x50bb('0x34')]=_[_0x50bb('0x33')](_0x4f7514[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x269479[_0x50bb('0x30')][_0x50bb('0x35')]));_0x41d479[_0x50bb('0x34')]=_0x41d479[_0x50bb('0x34')][_0x50bb('0x36')]?_0x41d479[_0x50bb('0x34')]:_0x4f7514['model'];if(!_0x269479[_0x50bb('0x30')][_0x50bb('0x37')](_0x50bb('0x38'))){_0x41d479[_0x50bb('0x39')]=qs[_0x50bb('0x39')](_0x269479[_0x50bb('0x30')]['limit']);_0x41d479['offset']=qs[_0x50bb('0x1c')](_0x269479['query'][_0x50bb('0x1c')]);}_0x41d479[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x269479[_0x50bb('0x30')][_0x50bb('0x3b')]);_0x41d479['where']=qs[_0x50bb('0x32')](_['pick'](_0x269479[_0x50bb('0x30')],_0x4f7514[_0x50bb('0x32')]),_0x461cf3);if(_0x269479[_0x50bb('0x30')]['filter']){_0x41d479['where']=_[_0x50bb('0x3c')](_0x41d479[_0x50bb('0x3d')],{'$or':_[_0x50bb('0x2a')](_0x461cf3,function(_0x21a180){if(_0x21a180['type']!==_0x50bb('0x3e')){var _0x4b75dc={};_0x4b75dc[_0x21a180['name']]={'$like':'%'+_0x269479[_0x50bb('0x30')]['filter']+'%'};return _0x4b75dc;}})});}_0x41d479=_[_0x50bb('0x3c')]({},_0x41d479,_0x269479[_0x50bb('0x3f')]);var _0x1ef231={'where':_0x41d479[_0x50bb('0x3d')]};return db[_0x50bb('0x2b')][_0x50bb('0x1e')](_0x1ef231)[_0x50bb('0x24')](function(_0x1cf782){_0x44ce86[_0x50bb('0x1e')]=_0x1cf782;if(_0x269479[_0x50bb('0x30')]['includeAll']){_0x41d479['include']=[{'all':!![]}];}return db[_0x50bb('0x2b')][_0x50bb('0x40')](_0x41d479);})[_0x50bb('0x24')](function(_0x1d929d){_0x44ce86['rows']=_0x1d929d;return _0x44ce86;})[_0x50bb('0x24')](respondWithFilteredResult(_0x41a8ad,_0x41d479))['catch'](handleError(_0x41a8ad,null));};exports[_0x50bb('0x41')]=function(_0x473a4c,_0x379944){var _0x40748d={'raw':!![],'where':{'id':_0x473a4c[_0x50bb('0x42')]['id']}},_0x1c438b={};_0x1c438b[_0x50bb('0x2f')]=_[_0x50bb('0x31')](db[_0x50bb('0x2b')][_0x50bb('0x43')]);_0x1c438b[_0x50bb('0x30')]=_[_0x50bb('0x31')](_0x473a4c[_0x50bb('0x30')]);_0x1c438b[_0x50bb('0x32')]=_[_0x50bb('0x33')](_0x1c438b[_0x50bb('0x2f')],_0x1c438b['query']);_0x40748d[_0x50bb('0x34')]=_['intersection'](_0x1c438b[_0x50bb('0x2f')],qs[_0x50bb('0x35')](_0x473a4c[_0x50bb('0x30')][_0x50bb('0x35')]));_0x40748d[_0x50bb('0x34')]=_0x40748d[_0x50bb('0x34')][_0x50bb('0x36')]?_0x40748d[_0x50bb('0x34')]:_0x1c438b[_0x50bb('0x2f')];if(_0x473a4c[_0x50bb('0x30')][_0x50bb('0x44')]){_0x40748d[_0x50bb('0x45')]=[{'all':!![]}];}_0x40748d=_[_0x50bb('0x3c')]({},_0x40748d,_0x473a4c[_0x50bb('0x3f')]);return db['WhatsappQueueReport'][_0x50bb('0x46')](_0x40748d)['then'](handleEntityNotFound(_0x379944,null))[_0x50bb('0x24')](respondWithResult(_0x379944,null))[_0x50bb('0x47')](handleError(_0x379944,null));};exports[_0x50bb('0x48')]=function(_0x35b440,_0x650e91){return db[_0x50bb('0x2b')][_0x50bb('0x48')](_0x35b440[_0x50bb('0x49')],{})['then'](respondWithResult(_0x650e91,0xc9))[_0x50bb('0x47')](handleError(_0x650e91,null));};exports[_0x50bb('0x4a')]=function(_0xf52a22,_0x13afe2){if(_0xf52a22[_0x50bb('0x49')]['id']){delete _0xf52a22['body']['id'];}return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0xf52a22[_0x50bb('0x42')]['id']}})[_0x50bb('0x24')](handleEntityNotFound(_0x13afe2,null))[_0x50bb('0x24')](saveUpdates(_0xf52a22['body'],null))['then'](respondWithResult(_0x13afe2,null))[_0x50bb('0x47')](handleError(_0x13afe2,null));};exports['destroy']=function(_0x357d08,_0x57ee0e){return db[_0x50bb('0x2b')][_0x50bb('0x46')]({'where':{'id':_0x357d08[_0x50bb('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ee0e,null))[_0x50bb('0x24')](removeEntity(_0x57ee0e,null))[_0x50bb('0x47')](handleError(_0x57ee0e,null));};exports['describe']=function(_0x184147,_0x1dff6a){return db[_0x50bb('0x2b')][_0x50bb('0x4b')]()['then'](respondWithResult(_0x1dff6a,null))[_0x50bb('0x47')](handleError(_0x1dff6a,null));}; \ No newline at end of file +var _0x5b12=['options','includeAll','include','findAll','then','show','params','rawAttributes','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','apply','reject','update','destroy','error','name','index','map','WhatsappQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x14e322,_0x4215c2){var _0x329687=function(_0x1f238e){while(--_0x1f238e){_0x14e322['push'](_0x14e322['shift']());}};_0x329687(++_0x4215c2);}(_0x5b12,0xa3));var _0x25b1=function(_0x5d0b24,_0x370673){_0x5d0b24=_0x5d0b24-0x0;var _0x20bfe5=_0x5b12[_0x5d0b24];return _0x20bfe5;};'use strict';var emlformat=require(_0x25b1('0x0'));var rimraf=require(_0x25b1('0x1'));var zipdir=require(_0x25b1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25b1('0x3'));var moment=require('moment');var BPromise=require(_0x25b1('0x4'));var Mustache=require(_0x25b1('0x5'));var util=require('util');var path=require(_0x25b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x25b1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x25b1('0x8'));var crypto=require(_0x25b1('0x9'));var jsforce=require(_0x25b1('0xa'));var deskjs=require(_0x25b1('0xb'));var toCsv=require(_0x25b1('0xc'));var querystring=require(_0x25b1('0xd'));var Papa=require(_0x25b1('0xe'));var Redis=require(_0x25b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x25b1('0x10'));var as=require(_0x25b1('0x11'));var hardwareService=require(_0x25b1('0x12'));var logger=require(_0x25b1('0x13'))(_0x25b1('0x14'));var utils=require(_0x25b1('0x15'));var config=require(_0x25b1('0x16'));var licenseUtil=require(_0x25b1('0x17'));var db=require(_0x25b1('0x18'))['db'];function respondWithStatusCode(_0x459070,_0xbdd348){_0xbdd348=_0xbdd348||0xcc;return function(_0x1c5421){if(_0x1c5421){return _0x459070[_0x25b1('0x19')](_0xbdd348);}return _0x459070[_0x25b1('0x1a')](_0xbdd348)[_0x25b1('0x1b')]();};}function respondWithResult(_0x76b5c4,_0x4ee40c){_0x4ee40c=_0x4ee40c||0xc8;return function(_0x2c337a){if(_0x2c337a){return _0x76b5c4[_0x25b1('0x1a')](_0x4ee40c)['json'](_0x2c337a);}};}function respondWithFilteredResult(_0xb5b9cf,_0x4bb1bb){return function(_0xe32e02){if(_0xe32e02){var _0x4a5a58=typeof _0x4bb1bb['offset']===_0x25b1('0x1c')&&typeof _0x4bb1bb['limit']===_0x25b1('0x1c');var _0x2ca567=_0xe32e02[_0x25b1('0x1d')];var _0x27ccc9=_0x4a5a58?0x0:_0x4bb1bb[_0x25b1('0x1e')];var _0x2a7d14=_0x4a5a58?_0xe32e02[_0x25b1('0x1d')]:_0x4bb1bb[_0x25b1('0x1e')]+_0x4bb1bb['limit'];var _0x4ecff1;if(_0x2a7d14>=_0x2ca567){_0x2a7d14=_0x2ca567;_0x4ecff1=0xc8;}else{_0x4ecff1=0xce;}_0xb5b9cf[_0x25b1('0x1a')](_0x4ecff1);return _0xb5b9cf['set'](_0x25b1('0x1f'),_0x27ccc9+'-'+_0x2a7d14+'/'+_0x2ca567)['json'](_0xe32e02);}return null;};}function patchUpdates(_0x3bfd7d){return function(_0x59aa37){try{jsonpatch[_0x25b1('0x20')](_0x59aa37,_0x3bfd7d,!![]);}catch(_0x529310){return BPromise[_0x25b1('0x21')](_0x529310);}return _0x59aa37['save']();};}function saveUpdates(_0x4e3f48,_0x565cfd){return function(_0x3bca9f){if(_0x3bca9f){return _0x3bca9f[_0x25b1('0x22')](_0x4e3f48)['then'](function(_0x19bab8){return _0x19bab8;});}return null;};}function removeEntity(_0x26b555,_0x1e5915){return function(_0x246acd){if(_0x246acd){return _0x246acd[_0x25b1('0x23')]()['then'](function(){_0x26b555[_0x25b1('0x1a')](0xcc)[_0x25b1('0x1b')]();});}};}function handleEntityNotFound(_0xd22469,_0x282187){return function(_0x1f37ed){if(!_0x1f37ed){_0xd22469[_0x25b1('0x19')](0x194);}return _0x1f37ed;};}function handleError(_0x5d9ed7,_0x3c05c6){_0x3c05c6=_0x3c05c6||0x1f4;return function(_0x27dd68){logger[_0x25b1('0x24')](_0x27dd68['stack']);if(_0x27dd68[_0x25b1('0x25')]){delete _0x27dd68[_0x25b1('0x25')];}_0x5d9ed7[_0x25b1('0x1a')](_0x3c05c6)['send'](_0x27dd68);};}exports[_0x25b1('0x26')]=function(_0x54ce2d,_0x19ecd1){var _0x3febb8={},_0x3a4475={},_0x293413={'count':0x0,'rows':[]};var _0x362118=_[_0x25b1('0x27')](db[_0x25b1('0x28')]['rawAttributes'],function(_0x30d455){return{'name':_0x30d455[_0x25b1('0x29')],'type':_0x30d455[_0x25b1('0x2a')][_0x25b1('0x2b')]};});_0x3a4475[_0x25b1('0x2c')]=_['map'](_0x362118,_0x25b1('0x25'));_0x3a4475[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x54ce2d[_0x25b1('0x2d')]);_0x3a4475[_0x25b1('0x2f')]=_['intersection'](_0x3a4475['model'],_0x3a4475[_0x25b1('0x2d')]);_0x3febb8['attributes']=_[_0x25b1('0x30')](_0x3a4475[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x54ce2d['query']['fields']));_0x3febb8[_0x25b1('0x32')]=_0x3febb8[_0x25b1('0x32')][_0x25b1('0x33')]?_0x3febb8['attributes']:_0x3a4475[_0x25b1('0x2c')];if(!_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x34')](_0x25b1('0x35'))){_0x3febb8['limit']=qs[_0x25b1('0x36')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x36')]);_0x3febb8['offset']=qs['offset'](_0x54ce2d[_0x25b1('0x2d')]['offset']);}_0x3febb8[_0x25b1('0x37')]=qs[_0x25b1('0x38')](_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x38')]);_0x3febb8[_0x25b1('0x39')]=qs[_0x25b1('0x2f')](_[_0x25b1('0x3a')](_0x54ce2d[_0x25b1('0x2d')],_0x3a4475[_0x25b1('0x2f')]),_0x362118);if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]){_0x3febb8[_0x25b1('0x39')]=_[_0x25b1('0x3c')](_0x3febb8[_0x25b1('0x39')],{'$or':_[_0x25b1('0x27')](_0x362118,function(_0x4837d5){if(_0x4837d5[_0x25b1('0x2a')]!==_0x25b1('0x3d')){var _0x53423d={};_0x53423d[_0x4837d5[_0x25b1('0x25')]]={'$like':'%'+_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3b')]+'%'};return _0x53423d;}})});}_0x3febb8=_[_0x25b1('0x3c')]({},_0x3febb8,_0x54ce2d[_0x25b1('0x3e')]);var _0x5bdefd={'where':_0x3febb8[_0x25b1('0x39')]};return db['WhatsappQueueReport'][_0x25b1('0x1d')](_0x5bdefd)['then'](function(_0x2e8747){_0x293413[_0x25b1('0x1d')]=_0x2e8747;if(_0x54ce2d[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x3febb8[_0x25b1('0x40')]=[{'all':!![]}];}return db[_0x25b1('0x28')][_0x25b1('0x41')](_0x3febb8);})[_0x25b1('0x42')](function(_0x3f9754){_0x293413['rows']=_0x3f9754;return _0x293413;})[_0x25b1('0x42')](respondWithFilteredResult(_0x19ecd1,_0x3febb8))['catch'](handleError(_0x19ecd1,null));};exports[_0x25b1('0x43')]=function(_0x2f56ac,_0x4d4e32){var _0x52d3f8={'raw':!![],'where':{'id':_0x2f56ac[_0x25b1('0x44')]['id']}},_0x39b4c7={};_0x39b4c7[_0x25b1('0x2c')]=_[_0x25b1('0x2e')](db[_0x25b1('0x28')][_0x25b1('0x45')]);_0x39b4c7[_0x25b1('0x2d')]=_[_0x25b1('0x2e')](_0x2f56ac[_0x25b1('0x2d')]);_0x39b4c7[_0x25b1('0x2f')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],_0x39b4c7[_0x25b1('0x2d')]);_0x52d3f8[_0x25b1('0x32')]=_[_0x25b1('0x30')](_0x39b4c7[_0x25b1('0x2c')],qs[_0x25b1('0x31')](_0x2f56ac['query']['fields']));_0x52d3f8['attributes']=_0x52d3f8[_0x25b1('0x32')]['length']?_0x52d3f8[_0x25b1('0x32')]:_0x39b4c7['model'];if(_0x2f56ac[_0x25b1('0x2d')][_0x25b1('0x3f')]){_0x52d3f8[_0x25b1('0x40')]=[{'all':!![]}];}_0x52d3f8=_[_0x25b1('0x3c')]({},_0x52d3f8,_0x2f56ac[_0x25b1('0x3e')]);return db[_0x25b1('0x28')]['find'](_0x52d3f8)[_0x25b1('0x42')](handleEntityNotFound(_0x4d4e32,null))[_0x25b1('0x42')](respondWithResult(_0x4d4e32,null))[_0x25b1('0x46')](handleError(_0x4d4e32,null));};exports[_0x25b1('0x47')]=function(_0x58ae67,_0x489f73){return db[_0x25b1('0x28')][_0x25b1('0x47')](_0x58ae67['body'],{})[_0x25b1('0x42')](respondWithResult(_0x489f73,0xc9))['catch'](handleError(_0x489f73,null));};exports[_0x25b1('0x22')]=function(_0x4b6181,_0x543f9b){if(_0x4b6181[_0x25b1('0x48')]['id']){delete _0x4b6181[_0x25b1('0x48')]['id'];}return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x4b6181['params']['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x543f9b,null))['then'](saveUpdates(_0x4b6181[_0x25b1('0x48')],null))['then'](respondWithResult(_0x543f9b,null))[_0x25b1('0x46')](handleError(_0x543f9b,null));};exports[_0x25b1('0x23')]=function(_0x1fcc79,_0x4fb92e){return db[_0x25b1('0x28')][_0x25b1('0x49')]({'where':{'id':_0x1fcc79[_0x25b1('0x44')]['id']}})[_0x25b1('0x42')](handleEntityNotFound(_0x4fb92e,null))[_0x25b1('0x42')](removeEntity(_0x4fb92e,null))[_0x25b1('0x46')](handleError(_0x4fb92e,null));};exports['describe']=function(_0x134c64,_0x133f50){return db[_0x25b1('0x28')][_0x25b1('0x4a')]()[_0x25b1('0x42')](respondWithResult(_0x133f50,null))[_0x25b1('0x46')](handleError(_0x133f50,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8c24916..322b8ed 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 _0xadf1=['bluebird','request-promise','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment'];(function(_0x12833b,_0x26c1d2){var _0x3acad3=function(_0x2f9ec9){while(--_0x2f9ec9){_0x12833b['push'](_0x12833b['shift']());}};_0x3acad3(++_0x26c1d2);}(_0xadf1,0x1b6));var _0x1adf=function(_0x4ba6ce,_0x404cc4){_0x4ba6ce=_0x4ba6ce-0x0;var _0x42377e=_0xadf1[_0x4ba6ce];return _0x42377e;};'use strict';var _=require(_0x1adf('0x0'));var util=require(_0x1adf('0x1'));var logger=require('../../config/logger')(_0x1adf('0x2'));var moment=require(_0x1adf('0x3'));var BPromise=require(_0x1adf('0x4'));var rp=require(_0x1adf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1adf('0x6'));var config=require('../../config/environment');var attributes=require(_0x1adf('0x7'));module[_0x1adf('0x8')]=function(_0x225fdb,_0x2d8d9c){return _0x225fdb[_0x1adf('0x9')](_0x1adf('0xa'),attributes,{'tableName':_0x1adf('0xb'),'paranoid':![],'indexes':[{'name':_0x1adf('0xc'),'fields':[_0x1adf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e3c=['exports','define','WhatsappQueueReport','report_whatsapp_queue','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4c7281,_0x4e11b8){var _0x3b47c5=function(_0xa9add8){while(--_0xa9add8){_0x4c7281['push'](_0x4c7281['shift']());}};_0x3b47c5(++_0x4e11b8);}(_0x9e3c,0xf4));var _0xc9e3=function(_0xdb3d60,_0x286503){_0xdb3d60=_0xdb3d60-0x0;var _0x38a1ae=_0x9e3c[_0xdb3d60];return _0x38a1ae;};'use strict';var _=require(_0xc9e3('0x0'));var util=require(_0xc9e3('0x1'));var logger=require(_0xc9e3('0x2'))(_0xc9e3('0x3'));var moment=require(_0xc9e3('0x4'));var BPromise=require('bluebird');var rp=require(_0xc9e3('0x5'));var fs=require('fs');var path=require(_0xc9e3('0x6'));var rimraf=require('rimraf');var config=require(_0xc9e3('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0xc9e3('0x8')]=function(_0x1e4289,_0x5d4242){return _0x1e4289[_0xc9e3('0x9')](_0xc9e3('0xa'),attributes,{'tableName':_0xc9e3('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 18727b0..54ca422 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 _0xc2fd=['attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update'];(function(_0x163e64,_0x2bc5a6){var _0x117bbd=function(_0x1228ef){while(--_0x1228ef){_0x163e64['push'](_0x163e64['shift']());}};_0x117bbd(++_0x2bc5a6);}(_0xc2fd,0x12e));var _0xdc2f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc2fd[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xdc2f('0x0'));var util=require(_0xdc2f('0x1'));var moment=require(_0xdc2f('0x2'));var BPromise=require(_0xdc2f('0x3'));var rs=require(_0xdc2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdc2f('0x5'))(_0xdc2f('0x6'));var config=require(_0xdc2f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdc2f('0x8')][_0xdc2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x725cc2,_0x299781,_0x3cd741){return new BPromise(function(_0x253bcf,_0xc97ad7){return client['request'](_0x725cc2,_0x3cd741)[_0xdc2f('0xa')](function(_0x572ae7){logger[_0xdc2f('0xb')](_0xdc2f('0xc'),_0x299781,_0xdc2f('0xd'));logger[_0xdc2f('0xe')](_0xdc2f('0xf'),_0x299781,'request\x20sent',JSON[_0xdc2f('0x10')](_0x572ae7));if(_0x572ae7[_0xdc2f('0x11')]){if(_0x572ae7[_0xdc2f('0x11')][_0xdc2f('0x12')]===0x1f4){logger['error'](_0xdc2f('0xc'),_0x299781,_0x572ae7[_0xdc2f('0x11')][_0xdc2f('0x13')]);return _0xc97ad7(_0x572ae7['error']['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x299781,_0x572ae7['error']['message']);return _0x253bcf(_0x572ae7[_0xdc2f('0x11')][_0xdc2f('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x299781,'request\x20sent');_0x253bcf(_0x572ae7[_0xdc2f('0x14')]['message']);}})['catch'](function(_0x5c2c2a){logger[_0xdc2f('0x11')](_0xdc2f('0xc'),_0x299781,_0x5c2c2a);_0xc97ad7(_0x5c2c2a);});});}exports[_0xdc2f('0x15')]=function(_0xdd3eb0){var _0x215bff=this;return new Promise(function(_0xedd6c0,_0x4a05d9){return db[_0xdc2f('0x16')]['create'](_0xdd3eb0[_0xdc2f('0x17')],{'raw':_0xdd3eb0[_0xdc2f('0x18')]?_0xdd3eb0[_0xdc2f('0x18')][_0xdc2f('0x19')]===undefined?!![]:![]:!![]})[_0xdc2f('0xa')](function(_0x223327){logger['info'](_0xdc2f('0x15'),_0xdd3eb0);logger[_0xdc2f('0xe')](_0xdc2f('0x15'),_0xdd3eb0,JSON[_0xdc2f('0x10')](_0x223327));_0xedd6c0(_0x223327);})['catch'](function(_0x37e647){logger['error'](_0xdc2f('0x15'),_0x37e647[_0xdc2f('0x13')],_0xdd3eb0);_0x4a05d9(_0x215bff[_0xdc2f('0x11')](0x1f4,_0x37e647[_0xdc2f('0x13')]));});});};exports[_0xdc2f('0x1a')]=function(_0x266975){var _0x36a9d6=this;return new Promise(function(_0x4ed137,_0x13a780){return db['WhatsappQueueReport'][_0xdc2f('0x1b')](_0x266975[_0xdc2f('0x17')],{'raw':_0x266975[_0xdc2f('0x18')]?_0x266975['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x266975[_0xdc2f('0x18')]?_0x266975[_0xdc2f('0x18')]['where']||null:null,'attributes':_0x266975['options']?_0x266975['options'][_0xdc2f('0x1c')]||null:null,'limit':_0x266975[_0xdc2f('0x18')]?_0x266975[_0xdc2f('0x18')][_0xdc2f('0x1d')]||null:null})[_0xdc2f('0xa')](function(_0xa53d93){logger[_0xdc2f('0xb')](_0xdc2f('0x1a'),_0x266975);logger[_0xdc2f('0xe')]('UpdateWhatsappQueueReport',_0x266975,JSON['stringify'](_0xa53d93));_0x4ed137(_0xa53d93);})['catch'](function(_0x1157d2){logger[_0xdc2f('0x11')](_0xdc2f('0x1a'),_0x1157d2[_0xdc2f('0x13')],_0x266975);_0x13a780(_0x36a9d6[_0xdc2f('0x11')](0x1f4,_0x1157d2[_0xdc2f('0x13')]));});});}; \ No newline at end of file +var _0x012a=['message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x11ca50,_0x4135c6){var _0x4f66cc=function(_0x41686f){while(--_0x41686f){_0x11ca50['push'](_0x11ca50['shift']());}};_0x4f66cc(++_0x4135c6);}(_0x012a,0x6a));var _0xa012=function(_0x3316ae,_0x196be2){_0x3316ae=_0x3316ae-0x0;var _0x324aa=_0x012a[_0x3316ae];return _0x324aa;};'use strict';var _=require(_0xa012('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa012('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa012('0x2'));var db=require(_0xa012('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa012('0x4'))(_0xa012('0x5'));var config=require(_0xa012('0x6'));var jayson=require(_0xa012('0x7'));var client=jayson['client'][_0xa012('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24f1f9,_0x1d21a8,_0x1d8c14){return new BPromise(function(_0x22db10,_0x1284f2){return client[_0xa012('0x9')](_0x24f1f9,_0x1d8c14)[_0xa012('0xa')](function(_0x5370fc){logger[_0xa012('0xb')](_0xa012('0xc'),_0x1d21a8,_0xa012('0xd'));logger[_0xa012('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1d21a8,_0xa012('0xd'),JSON[_0xa012('0xf')](_0x5370fc));if(_0x5370fc[_0xa012('0x10')]){if(_0x5370fc['error'][_0xa012('0x11')]===0x1f4){logger[_0xa012('0x10')](_0xa012('0xc'),_0x1d21a8,_0x5370fc['error']['message']);return _0x1284f2(_0x5370fc[_0xa012('0x10')][_0xa012('0x12')]);}logger[_0xa012('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1d21a8,_0x5370fc['error']['message']);return _0x22db10(_0x5370fc['error']['message']);}else{logger[_0xa012('0xb')](_0xa012('0xc'),_0x1d21a8,_0xa012('0xd'));_0x22db10(_0x5370fc['result'][_0xa012('0x12')]);}})[_0xa012('0x13')](function(_0x2533bf){logger['error'](_0xa012('0xc'),_0x1d21a8,_0x2533bf);_0x1284f2(_0x2533bf);});});}exports[_0xa012('0x14')]=function(_0x44e246){var _0x2c049a=this;return new Promise(function(_0x2750ac,_0x262af1){return db[_0xa012('0x15')][_0xa012('0x16')](_0x44e246[_0xa012('0x17')],{'raw':_0x44e246[_0xa012('0x18')]?_0x44e246[_0xa012('0x18')][_0xa012('0x19')]===undefined?!![]:![]:!![]})[_0xa012('0xa')](function(_0xde4f31){logger[_0xa012('0xb')](_0xa012('0x14'),_0x44e246);logger['debug']('CreateWhatsappQueueReport',_0x44e246,JSON['stringify'](_0xde4f31));_0x2750ac(_0xde4f31);})[_0xa012('0x13')](function(_0x442283){logger['error'](_0xa012('0x14'),_0x442283[_0xa012('0x12')],_0x44e246);_0x262af1(_0x2c049a[_0xa012('0x10')](0x1f4,_0x442283[_0xa012('0x12')]));});});};exports[_0xa012('0x1a')]=function(_0x3d3773){var _0x3decb7=this;return new Promise(function(_0x3d1ad2,_0x39f383){return db['WhatsappQueueReport'][_0xa012('0x1b')](_0x3d3773[_0xa012('0x17')],{'raw':_0x3d3773['options']?_0x3d3773[_0xa012('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d3773[_0xa012('0x18')]?_0x3d3773['options'][_0xa012('0x1c')]||null:null,'attributes':_0x3d3773[_0xa012('0x18')]?_0x3d3773['options'][_0xa012('0x1d')]||null:null,'limit':_0x3d3773['options']?_0x3d3773['options'][_0xa012('0x1e')]||null:null})[_0xa012('0xa')](function(_0x3df341){logger['info'](_0xa012('0x1a'),_0x3d3773);logger[_0xa012('0xe')]('UpdateWhatsappQueueReport',_0x3d3773,JSON[_0xa012('0xf')](_0x3df341));_0x3d1ad2(_0x3df341);})[_0xa012('0x13')](function(_0x20bfa4){logger['error']('UpdateWhatsappQueueReport',_0x20bfa4[_0xa012('0x12')],_0x3d3773);_0x39f383(_0x3decb7[_0xa012('0x10')](0x1f4,_0x20bfa4[_0xa012('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index fd50503..1addd23 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 _0xd4e8=['post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','describe','/:id'];(function(_0x114a90,_0x34cd90){var _0x454b69=function(_0x17dbe1){while(--_0x17dbe1){_0x114a90['push'](_0x114a90['shift']());}};_0x454b69(++_0x34cd90);}(_0xd4e8,0x120));var _0x8d4e=function(_0x9c36e9,_0x5154e6){_0x9c36e9=_0x9c36e9-0x0;var _0x5a393f=_0xd4e8[_0x9c36e9];return _0x5a393f;};'use strict';var multer=require('multer');var util=require(_0x8d4e('0x0'));var path=require(_0x8d4e('0x1'));var timeout=require(_0x8d4e('0x2'));var express=require(_0x8d4e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8d4e('0x4'));var interaction=require(_0x8d4e('0x5'));var config=require(_0x8d4e('0x6'));var controller=require(_0x8d4e('0x7'));router[_0x8d4e('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d4e('0x9')]);router[_0x8d4e('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8d4e('0xa')]);router[_0x8d4e('0x8')](_0x8d4e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8d4e('0xc')]('/',auth[_0x8d4e('0xd')](),controller[_0x8d4e('0xe')]);router[_0x8d4e('0xf')](_0x8d4e('0xb'),auth['isAuthenticated'](),controller[_0x8d4e('0x10')]);router[_0x8d4e('0x11')](_0x8d4e('0xb'),auth['isAuthenticated'](),controller[_0x8d4e('0x12')]);module[_0x8d4e('0x13')]=router; \ No newline at end of file +var _0xc406=['../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x576fe0,_0x29de93){var _0x524bf4=function(_0x30d42e){while(--_0x30d42e){_0x576fe0['push'](_0x576fe0['shift']());}};_0x524bf4(++_0x29de93);}(_0xc406,0xbe));var _0x6c40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc406[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6c40('0x0'));var util=require(_0x6c40('0x1'));var path=require(_0x6c40('0x2'));var timeout=require(_0x6c40('0x3'));var express=require(_0x6c40('0x4'));var router=express[_0x6c40('0x5')]();var fs_extra=require(_0x6c40('0x6'));var auth=require(_0x6c40('0x7'));var interaction=require(_0x6c40('0x8'));var config=require('../../config/environment');var controller=require(_0x6c40('0x9'));router[_0x6c40('0xa')]('/',auth[_0x6c40('0xb')](),controller[_0x6c40('0xc')]);router['get'](_0x6c40('0xd'),auth[_0x6c40('0xb')](),controller['describe']);router[_0x6c40('0xa')](_0x6c40('0xe'),auth[_0x6c40('0xb')](),controller[_0x6c40('0xf')]);router[_0x6c40('0x10')]('/',auth[_0x6c40('0xb')](),controller['create']);router[_0x6c40('0x11')](_0x6c40('0xe'),auth[_0x6c40('0xb')](),controller[_0x6c40('0x12')]);router[_0x6c40('0x13')](_0x6c40('0xe'),auth[_0x6c40('0xb')](),controller[_0x6c40('0x14')]);module[_0x6c40('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9f40b1b..4ef1be3 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 _0xa866=['DATE','sequelize','exports','STRING','ENUM','account','queue'];(function(_0x1773f7,_0x54318f){var _0x1983fb=function(_0x50b543){while(--_0x50b543){_0x1773f7['push'](_0x1773f7['shift']());}};_0x1983fb(++_0x54318f);}(_0xa866,0x6a));var _0x6a86=function(_0x595cdc,_0x30f8e4){_0x595cdc=_0x595cdc-0x0;var _0x1f019b=_0xa866[_0x595cdc];return _0x1f019b;};'use strict';var Sequelize=require(_0x6a86('0x0'));module[_0x6a86('0x1')]={'uniqueid':{'type':Sequelize[_0x6a86('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6a86('0x3')](_0x6a86('0x4'),'agent',_0x6a86('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6a86('0x6')]}}; \ No newline at end of file +var _0xd0e4=['exports','STRING','ENUM','queue','DATE','sequelize'];(function(_0x25b66a,_0x5944d0){var _0x4a2fc6=function(_0x5ba96e){while(--_0x5ba96e){_0x25b66a['push'](_0x25b66a['shift']());}};_0x4a2fc6(++_0x5944d0);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x597065,_0x453bfd){_0x597065=_0x597065-0x0;var _0xb8e1fb=_0xd0e4[_0x597065];return _0xb8e1fb;};'use strict';var Sequelize=require(_0x4d0e('0x0'));module[_0x4d0e('0x1')]={'uniqueid':{'type':Sequelize[_0x4d0e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d0e('0x3')]('account','agent',_0x4d0e('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x4d0e('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0ce6fcb..66f0be3 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 _0x2f56=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','set','Content-Range','reject','update','destroy','then','stack','name','send','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','WhatsappTransferReport','count','include','rows','catch','show','params','keys','includeAll','options','find','create','body','describe','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'];(function(_0x598039,_0x288bd3){var _0x5ef1f8=function(_0x55a6c8){while(--_0x55a6c8){_0x598039['push'](_0x598039['shift']());}};_0x5ef1f8(++_0x288bd3);}(_0x2f56,0xcd));var _0x62f5=function(_0x5aa29b,_0x2a4416){_0x5aa29b=_0x5aa29b-0x0;var _0x21ca73=_0x2f56[_0x5aa29b];return _0x21ca73;};'use strict';var emlformat=require(_0x62f5('0x0'));var rimraf=require(_0x62f5('0x1'));var zipdir=require(_0x62f5('0x2'));var jsonpatch=require(_0x62f5('0x3'));var rp=require(_0x62f5('0x4'));var moment=require(_0x62f5('0x5'));var BPromise=require(_0x62f5('0x6'));var Mustache=require(_0x62f5('0x7'));var util=require(_0x62f5('0x8'));var path=require(_0x62f5('0x9'));var sox=require(_0x62f5('0xa'));var csv=require(_0x62f5('0xb'));var ejs=require(_0x62f5('0xc'));var fs=require('fs');var fs_extra=require(_0x62f5('0xd'));var _=require(_0x62f5('0xe'));var squel=require(_0x62f5('0xf'));var crypto=require('crypto');var jsforce=require(_0x62f5('0x10'));var deskjs=require(_0x62f5('0x11'));var toCsv=require(_0x62f5('0xb'));var querystring=require(_0x62f5('0x12'));var Papa=require(_0x62f5('0x13'));var Redis=require(_0x62f5('0x14'));var authService=require(_0x62f5('0x15'));var qs=require(_0x62f5('0x16'));var as=require(_0x62f5('0x17'));var hardwareService=require(_0x62f5('0x18'));var logger=require(_0x62f5('0x19'))(_0x62f5('0x1a'));var utils=require(_0x62f5('0x1b'));var config=require(_0x62f5('0x1c'));var licenseUtil=require('../../config/license/util');var db=require(_0x62f5('0x1d'))['db'];function respondWithStatusCode(_0x4d72c8,_0x13e503){_0x13e503=_0x13e503||0xcc;return function(_0x2d7d39){if(_0x2d7d39){return _0x4d72c8[_0x62f5('0x1e')](_0x13e503);}return _0x4d72c8[_0x62f5('0x1f')](_0x13e503)[_0x62f5('0x20')]();};}function respondWithResult(_0x4336ec,_0x5d06de){_0x5d06de=_0x5d06de||0xc8;return function(_0x4ed4a4){if(_0x4ed4a4){return _0x4336ec[_0x62f5('0x1f')](_0x5d06de)['json'](_0x4ed4a4);}};}function respondWithFilteredResult(_0x16cd29,_0x46a859){return function(_0x436713){if(_0x436713){var _0x59eb9c=typeof _0x46a859[_0x62f5('0x21')]==='undefined'&&typeof _0x46a859[_0x62f5('0x22')]===_0x62f5('0x23');var _0x1494af=_0x436713['count'];var _0x4cfa08=_0x59eb9c?0x0:_0x46a859[_0x62f5('0x21')];var _0x334859=_0x59eb9c?_0x436713['count']:_0x46a859['offset']+_0x46a859[_0x62f5('0x22')];var _0x346747;if(_0x334859>=_0x1494af){_0x334859=_0x1494af;_0x346747=0xc8;}else{_0x346747=0xce;}_0x16cd29['status'](_0x346747);return _0x16cd29[_0x62f5('0x24')](_0x62f5('0x25'),_0x4cfa08+'-'+_0x334859+'/'+_0x1494af)['json'](_0x436713);}return null;};}function patchUpdates(_0x25717c){return function(_0x2996c2){try{jsonpatch['apply'](_0x2996c2,_0x25717c,!![]);}catch(_0x4b0d16){return BPromise[_0x62f5('0x26')](_0x4b0d16);}return _0x2996c2['save']();};}function saveUpdates(_0x32e1f4,_0x2640cb){return function(_0x1203b1){if(_0x1203b1){return _0x1203b1[_0x62f5('0x27')](_0x32e1f4)['then'](function(_0x46e9d4){return _0x46e9d4;});}return null;};}function removeEntity(_0x3ac73c,_0x519de0){return function(_0x46c1d5){if(_0x46c1d5){return _0x46c1d5[_0x62f5('0x28')]()[_0x62f5('0x29')](function(){_0x3ac73c[_0x62f5('0x1f')](0xcc)[_0x62f5('0x20')]();});}};}function handleEntityNotFound(_0x5d3635,_0xd2b64d){return function(_0x557b01){if(!_0x557b01){_0x5d3635[_0x62f5('0x1e')](0x194);}return _0x557b01;};}function handleError(_0xe6e7b2,_0x463a0d){_0x463a0d=_0x463a0d||0x1f4;return function(_0x1ddaf6){logger['error'](_0x1ddaf6[_0x62f5('0x2a')]);if(_0x1ddaf6['name']){delete _0x1ddaf6[_0x62f5('0x2b')];}_0xe6e7b2[_0x62f5('0x1f')](_0x463a0d)[_0x62f5('0x2c')](_0x1ddaf6);};}exports['index']=function(_0x5432e0,_0x5e7262){var _0x4c120c={},_0x5ab7cb={},_0x2eb22d={'count':0x0,'rows':[]};var _0x53b6d1=_['map'](db['WhatsappTransferReport'][_0x62f5('0x2d')],function(_0x27a9c8){return{'name':_0x27a9c8['fieldName'],'type':_0x27a9c8['type']['key']};});_0x5ab7cb[_0x62f5('0x2e')]=_[_0x62f5('0x2f')](_0x53b6d1,'name');_0x5ab7cb[_0x62f5('0x30')]=_['keys'](_0x5432e0[_0x62f5('0x30')]);_0x5ab7cb[_0x62f5('0x31')]=_[_0x62f5('0x32')](_0x5ab7cb[_0x62f5('0x2e')],_0x5ab7cb[_0x62f5('0x30')]);_0x4c120c[_0x62f5('0x33')]=_['intersection'](_0x5ab7cb[_0x62f5('0x2e')],qs[_0x62f5('0x34')](_0x5432e0[_0x62f5('0x30')][_0x62f5('0x34')]));_0x4c120c['attributes']=_0x4c120c[_0x62f5('0x33')][_0x62f5('0x35')]?_0x4c120c[_0x62f5('0x33')]:_0x5ab7cb[_0x62f5('0x2e')];if(!_0x5432e0[_0x62f5('0x30')]['hasOwnProperty'](_0x62f5('0x36'))){_0x4c120c[_0x62f5('0x22')]=qs[_0x62f5('0x22')](_0x5432e0[_0x62f5('0x30')][_0x62f5('0x22')]);_0x4c120c['offset']=qs[_0x62f5('0x21')](_0x5432e0[_0x62f5('0x30')][_0x62f5('0x21')]);}_0x4c120c[_0x62f5('0x37')]=qs[_0x62f5('0x38')](_0x5432e0[_0x62f5('0x30')]['sort']);_0x4c120c[_0x62f5('0x39')]=qs[_0x62f5('0x31')](_[_0x62f5('0x3a')](_0x5432e0[_0x62f5('0x30')],_0x5ab7cb[_0x62f5('0x31')]),_0x53b6d1);if(_0x5432e0['query'][_0x62f5('0x3b')]){_0x4c120c[_0x62f5('0x39')]=_['merge'](_0x4c120c[_0x62f5('0x39')],{'$or':_[_0x62f5('0x2f')](_0x53b6d1,function(_0x574361){if(_0x574361['type']!=='VIRTUAL'){var _0x501775={};_0x501775[_0x574361[_0x62f5('0x2b')]]={'$like':'%'+_0x5432e0[_0x62f5('0x30')]['filter']+'%'};return _0x501775;}})});}_0x4c120c=_[_0x62f5('0x3c')]({},_0x4c120c,_0x5432e0['options']);var _0x5cbdb6={'where':_0x4c120c['where']};return db[_0x62f5('0x3d')][_0x62f5('0x3e')](_0x5cbdb6)['then'](function(_0x2b7686){_0x2eb22d[_0x62f5('0x3e')]=_0x2b7686;if(_0x5432e0['query']['includeAll']){_0x4c120c[_0x62f5('0x3f')]=[{'all':!![]}];}return db[_0x62f5('0x3d')]['findAll'](_0x4c120c);})['then'](function(_0x55e1e7){_0x2eb22d[_0x62f5('0x40')]=_0x55e1e7;return _0x2eb22d;})[_0x62f5('0x29')](respondWithFilteredResult(_0x5e7262,_0x4c120c))[_0x62f5('0x41')](handleError(_0x5e7262,null));};exports[_0x62f5('0x42')]=function(_0xcc7148,_0x1f35d0){var _0x17de18={'raw':!![],'where':{'id':_0xcc7148[_0x62f5('0x43')]['id']}},_0x30460c={};_0x30460c[_0x62f5('0x2e')]=_[_0x62f5('0x44')](db[_0x62f5('0x3d')][_0x62f5('0x2d')]);_0x30460c['query']=_['keys'](_0xcc7148[_0x62f5('0x30')]);_0x30460c[_0x62f5('0x31')]=_[_0x62f5('0x32')](_0x30460c[_0x62f5('0x2e')],_0x30460c['query']);_0x17de18[_0x62f5('0x33')]=_[_0x62f5('0x32')](_0x30460c[_0x62f5('0x2e')],qs[_0x62f5('0x34')](_0xcc7148[_0x62f5('0x30')][_0x62f5('0x34')]));_0x17de18[_0x62f5('0x33')]=_0x17de18[_0x62f5('0x33')][_0x62f5('0x35')]?_0x17de18[_0x62f5('0x33')]:_0x30460c[_0x62f5('0x2e')];if(_0xcc7148[_0x62f5('0x30')][_0x62f5('0x45')]){_0x17de18[_0x62f5('0x3f')]=[{'all':!![]}];}_0x17de18=_[_0x62f5('0x3c')]({},_0x17de18,_0xcc7148[_0x62f5('0x46')]);return db['WhatsappTransferReport'][_0x62f5('0x47')](_0x17de18)[_0x62f5('0x29')](handleEntityNotFound(_0x1f35d0,null))[_0x62f5('0x29')](respondWithResult(_0x1f35d0,null))[_0x62f5('0x41')](handleError(_0x1f35d0,null));};exports[_0x62f5('0x48')]=function(_0x36988d,_0x2b28fb){return db[_0x62f5('0x3d')]['create'](_0x36988d[_0x62f5('0x49')],{})['then'](respondWithResult(_0x2b28fb,0xc9))[_0x62f5('0x41')](handleError(_0x2b28fb,null));};exports[_0x62f5('0x27')]=function(_0x361f07,_0x70c5c3){if(_0x361f07[_0x62f5('0x49')]['id']){delete _0x361f07['body']['id'];}return db[_0x62f5('0x3d')][_0x62f5('0x47')]({'where':{'id':_0x361f07[_0x62f5('0x43')]['id']}})[_0x62f5('0x29')](handleEntityNotFound(_0x70c5c3,null))[_0x62f5('0x29')](saveUpdates(_0x361f07[_0x62f5('0x49')],null))[_0x62f5('0x29')](respondWithResult(_0x70c5c3,null))['catch'](handleError(_0x70c5c3,null));};exports[_0x62f5('0x28')]=function(_0x295490,_0x53ecac){return db['WhatsappTransferReport'][_0x62f5('0x47')]({'where':{'id':_0x295490[_0x62f5('0x43')]['id']}})['then'](handleEntityNotFound(_0x53ecac,null))['then'](removeEntity(_0x53ecac,null))[_0x62f5('0x41')](handleError(_0x53ecac,null));};exports[_0x62f5('0x4a')]=function(_0x1f8365,_0x588beb){return db[_0x62f5('0x3d')]['describe']()[_0x62f5('0x29')](respondWithResult(_0x588beb,null))[_0x62f5('0x41')](handleError(_0x588beb,null));}; \ No newline at end of file +var _0xe4d3=['error','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe4d3,0xbc));var _0x3e4d=function(_0x2e8f13,_0x426905){_0x2e8f13=_0x2e8f13-0x0;var _0x374a00=_0xe4d3[_0x2e8f13];return _0x374a00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e4d('0x0'));var zipdir=require(_0x3e4d('0x1'));var jsonpatch=require(_0x3e4d('0x2'));var rp=require(_0x3e4d('0x3'));var moment=require(_0x3e4d('0x4'));var BPromise=require(_0x3e4d('0x5'));var Mustache=require(_0x3e4d('0x6'));var util=require(_0x3e4d('0x7'));var path=require('path');var sox=require(_0x3e4d('0x8'));var csv=require(_0x3e4d('0x9'));var ejs=require(_0x3e4d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e4d('0xb'));var squel=require(_0x3e4d('0xc'));var crypto=require(_0x3e4d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3e4d('0xe'));var toCsv=require(_0x3e4d('0x9'));var querystring=require(_0x3e4d('0xf'));var Papa=require('papaparse');var Redis=require(_0x3e4d('0x10'));var authService=require(_0x3e4d('0x11'));var qs=require(_0x3e4d('0x12'));var as=require(_0x3e4d('0x13'));var hardwareService=require(_0x3e4d('0x14'));var logger=require(_0x3e4d('0x15'))(_0x3e4d('0x16'));var utils=require(_0x3e4d('0x17'));var config=require(_0x3e4d('0x18'));var licenseUtil=require(_0x3e4d('0x19'));var db=require(_0x3e4d('0x1a'))['db'];function respondWithStatusCode(_0x2fe133,_0x2d1b3b){_0x2d1b3b=_0x2d1b3b||0xcc;return function(_0x493b27){if(_0x493b27){return _0x2fe133[_0x3e4d('0x1b')](_0x2d1b3b);}return _0x2fe133[_0x3e4d('0x1c')](_0x2d1b3b)['end']();};}function respondWithResult(_0x5e231a,_0x5ed992){_0x5ed992=_0x5ed992||0xc8;return function(_0x38bd52){if(_0x38bd52){return _0x5e231a[_0x3e4d('0x1c')](_0x5ed992)['json'](_0x38bd52);}};}function respondWithFilteredResult(_0x4b30c8,_0x23e467){return function(_0x2fa4b1){if(_0x2fa4b1){var _0x4b9d50=typeof _0x23e467[_0x3e4d('0x1d')]===_0x3e4d('0x1e')&&typeof _0x23e467[_0x3e4d('0x1f')]==='undefined';var _0x64783d=_0x2fa4b1[_0x3e4d('0x20')];var _0x36348e=_0x4b9d50?0x0:_0x23e467[_0x3e4d('0x1d')];var _0x482221=_0x4b9d50?_0x2fa4b1['count']:_0x23e467['offset']+_0x23e467[_0x3e4d('0x1f')];var _0x2d16b3;if(_0x482221>=_0x64783d){_0x482221=_0x64783d;_0x2d16b3=0xc8;}else{_0x2d16b3=0xce;}_0x4b30c8[_0x3e4d('0x1c')](_0x2d16b3);return _0x4b30c8[_0x3e4d('0x21')]('Content-Range',_0x36348e+'-'+_0x482221+'/'+_0x64783d)['json'](_0x2fa4b1);}return null;};}function patchUpdates(_0xd1deac){return function(_0x2d8e20){try{jsonpatch[_0x3e4d('0x22')](_0x2d8e20,_0xd1deac,!![]);}catch(_0x63a829){return BPromise[_0x3e4d('0x23')](_0x63a829);}return _0x2d8e20[_0x3e4d('0x24')]();};}function saveUpdates(_0x3909d8,_0x49737e){return function(_0x3e4ac7){if(_0x3e4ac7){return _0x3e4ac7[_0x3e4d('0x25')](_0x3909d8)[_0x3e4d('0x26')](function(_0x194632){return _0x194632;});}return null;};}function removeEntity(_0x1b7ce8,_0x3ac0fa){return function(_0xfd932e){if(_0xfd932e){return _0xfd932e[_0x3e4d('0x27')]()[_0x3e4d('0x26')](function(){_0x1b7ce8[_0x3e4d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xca562d,_0xb7a5a1){return function(_0x10ee62){if(!_0x10ee62){_0xca562d[_0x3e4d('0x1b')](0x194);}return _0x10ee62;};}function handleError(_0x2fe863,_0x3d49ef){_0x3d49ef=_0x3d49ef||0x1f4;return function(_0x2e999b){logger[_0x3e4d('0x28')](_0x2e999b['stack']);if(_0x2e999b[_0x3e4d('0x29')]){delete _0x2e999b[_0x3e4d('0x29')];}_0x2fe863[_0x3e4d('0x1c')](_0x3d49ef)[_0x3e4d('0x2a')](_0x2e999b);};}exports['index']=function(_0x388834,_0x86d99e){var _0x497e54={},_0x20d80d={},_0x7338fd={'count':0x0,'rows':[]};var _0x54ed60=_[_0x3e4d('0x2b')](db[_0x3e4d('0x2c')][_0x3e4d('0x2d')],function(_0x5d711a){return{'name':_0x5d711a[_0x3e4d('0x2e')],'type':_0x5d711a[_0x3e4d('0x2f')][_0x3e4d('0x30')]};});_0x20d80d[_0x3e4d('0x31')]=_[_0x3e4d('0x2b')](_0x54ed60,'name');_0x20d80d[_0x3e4d('0x32')]=_['keys'](_0x388834[_0x3e4d('0x32')]);_0x20d80d['filters']=_[_0x3e4d('0x33')](_0x20d80d[_0x3e4d('0x31')],_0x20d80d['query']);_0x497e54['attributes']=_[_0x3e4d('0x33')](_0x20d80d[_0x3e4d('0x31')],qs[_0x3e4d('0x34')](_0x388834[_0x3e4d('0x32')][_0x3e4d('0x34')]));_0x497e54['attributes']=_0x497e54[_0x3e4d('0x35')][_0x3e4d('0x36')]?_0x497e54[_0x3e4d('0x35')]:_0x20d80d[_0x3e4d('0x31')];if(!_0x388834[_0x3e4d('0x32')]['hasOwnProperty'](_0x3e4d('0x37'))){_0x497e54[_0x3e4d('0x1f')]=qs[_0x3e4d('0x1f')](_0x388834['query'][_0x3e4d('0x1f')]);_0x497e54[_0x3e4d('0x1d')]=qs['offset'](_0x388834[_0x3e4d('0x32')]['offset']);}_0x497e54[_0x3e4d('0x38')]=qs[_0x3e4d('0x39')](_0x388834[_0x3e4d('0x32')]['sort']);_0x497e54[_0x3e4d('0x3a')]=qs[_0x3e4d('0x3b')](_[_0x3e4d('0x3c')](_0x388834[_0x3e4d('0x32')],_0x20d80d[_0x3e4d('0x3b')]),_0x54ed60);if(_0x388834['query']['filter']){_0x497e54[_0x3e4d('0x3a')]=_[_0x3e4d('0x3d')](_0x497e54[_0x3e4d('0x3a')],{'$or':_[_0x3e4d('0x2b')](_0x54ed60,function(_0x2759c6){if(_0x2759c6['type']!=='VIRTUAL'){var _0x439e63={};_0x439e63[_0x2759c6[_0x3e4d('0x29')]]={'$like':'%'+_0x388834[_0x3e4d('0x32')][_0x3e4d('0x3e')]+'%'};return _0x439e63;}})});}_0x497e54=_[_0x3e4d('0x3d')]({},_0x497e54,_0x388834[_0x3e4d('0x3f')]);var _0x25d0f7={'where':_0x497e54[_0x3e4d('0x3a')]};return db[_0x3e4d('0x2c')][_0x3e4d('0x20')](_0x25d0f7)[_0x3e4d('0x26')](function(_0xe1f663){_0x7338fd[_0x3e4d('0x20')]=_0xe1f663;if(_0x388834['query']['includeAll']){_0x497e54[_0x3e4d('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x3e4d('0x41')](_0x497e54);})[_0x3e4d('0x26')](function(_0x39762a){_0x7338fd[_0x3e4d('0x42')]=_0x39762a;return _0x7338fd;})['then'](respondWithFilteredResult(_0x86d99e,_0x497e54))[_0x3e4d('0x43')](handleError(_0x86d99e,null));};exports[_0x3e4d('0x44')]=function(_0x1c0d86,_0x58150e){var _0x4dcded={'raw':!![],'where':{'id':_0x1c0d86[_0x3e4d('0x45')]['id']}},_0x16a2f1={};_0x16a2f1[_0x3e4d('0x31')]=_[_0x3e4d('0x46')](db[_0x3e4d('0x2c')]['rawAttributes']);_0x16a2f1[_0x3e4d('0x32')]=_[_0x3e4d('0x46')](_0x1c0d86['query']);_0x16a2f1[_0x3e4d('0x3b')]=_[_0x3e4d('0x33')](_0x16a2f1[_0x3e4d('0x31')],_0x16a2f1[_0x3e4d('0x32')]);_0x4dcded[_0x3e4d('0x35')]=_[_0x3e4d('0x33')](_0x16a2f1[_0x3e4d('0x31')],qs['fields'](_0x1c0d86[_0x3e4d('0x32')][_0x3e4d('0x34')]));_0x4dcded[_0x3e4d('0x35')]=_0x4dcded[_0x3e4d('0x35')][_0x3e4d('0x36')]?_0x4dcded[_0x3e4d('0x35')]:_0x16a2f1[_0x3e4d('0x31')];if(_0x1c0d86[_0x3e4d('0x32')][_0x3e4d('0x47')]){_0x4dcded[_0x3e4d('0x40')]=[{'all':!![]}];}_0x4dcded=_['merge']({},_0x4dcded,_0x1c0d86[_0x3e4d('0x3f')]);return db[_0x3e4d('0x2c')][_0x3e4d('0x48')](_0x4dcded)[_0x3e4d('0x26')](handleEntityNotFound(_0x58150e,null))['then'](respondWithResult(_0x58150e,null))[_0x3e4d('0x43')](handleError(_0x58150e,null));};exports[_0x3e4d('0x49')]=function(_0x3a1b0d,_0x44f452){return db['WhatsappTransferReport'][_0x3e4d('0x49')](_0x3a1b0d[_0x3e4d('0x4a')],{})[_0x3e4d('0x26')](respondWithResult(_0x44f452,0xc9))['catch'](handleError(_0x44f452,null));};exports[_0x3e4d('0x25')]=function(_0x7a443b,_0x49c9ae){if(_0x7a443b[_0x3e4d('0x4a')]['id']){delete _0x7a443b[_0x3e4d('0x4a')]['id'];}return db[_0x3e4d('0x2c')][_0x3e4d('0x48')]({'where':{'id':_0x7a443b[_0x3e4d('0x45')]['id']}})['then'](handleEntityNotFound(_0x49c9ae,null))[_0x3e4d('0x26')](saveUpdates(_0x7a443b['body'],null))[_0x3e4d('0x26')](respondWithResult(_0x49c9ae,null))['catch'](handleError(_0x49c9ae,null));};exports[_0x3e4d('0x27')]=function(_0x4f35a9,_0x65b015){return db['WhatsappTransferReport'][_0x3e4d('0x48')]({'where':{'id':_0x4f35a9['params']['id']}})[_0x3e4d('0x26')](handleEntityNotFound(_0x65b015,null))['then'](removeEntity(_0x65b015,null))[_0x3e4d('0x43')](handleError(_0x65b015,null));};exports[_0x3e4d('0x4b')]=function(_0x592a2c,_0x3c8d91){return db[_0x3e4d('0x2c')][_0x3e4d('0x4b')]()[_0x3e4d('0x26')](respondWithResult(_0x3c8d91,null))[_0x3e4d('0x43')](handleError(_0x3c8d91,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ab9c008..58257c7 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 _0xd106=['rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x125d6d,_0x52f01a){var _0x5c1026=function(_0x5e309b){while(--_0x5e309b){_0x125d6d['push'](_0x125d6d['shift']());}};_0x5c1026(++_0x52f01a);}(_0xd106,0x11a));var _0x6d10=function(_0x38389b,_0xd4a774){_0x38389b=_0x38389b-0x0;var _0x12a6e2=_0xd106[_0x38389b];return _0x12a6e2;};'use strict';var _=require(_0x6d10('0x0'));var util=require('util');var logger=require(_0x6d10('0x1'))(_0x6d10('0x2'));var moment=require(_0x6d10('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d10('0x4'));var fs=require('fs');var path=require(_0x6d10('0x5'));var rimraf=require(_0x6d10('0x6'));var config=require(_0x6d10('0x7'));var attributes=require(_0x6d10('0x8'));module[_0x6d10('0x9')]=function(_0x1f720b,_0x246d1d){return _0x1f720b[_0x6d10('0xa')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x6d10('0xb'),'fields':[_0x6d10('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60e0=['lodash','util','../../config/logger','api','moment','bluebird','path','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x408ed9,_0x59c5d6){var _0x337f0f=function(_0x2fe794){while(--_0x2fe794){_0x408ed9['push'](_0x408ed9['shift']());}};_0x337f0f(++_0x59c5d6);}(_0x60e0,0x120));var _0x060e=function(_0x14fa28,_0x4cad53){_0x14fa28=_0x14fa28-0x0;var _0x598c67=_0x60e0[_0x14fa28];return _0x598c67;};'use strict';var _=require(_0x060e('0x0'));var util=require(_0x060e('0x1'));var logger=require(_0x060e('0x2'))(_0x060e('0x3'));var moment=require(_0x060e('0x4'));var BPromise=require(_0x060e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x060e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x060e('0x7'));module[_0x060e('0x8')]=function(_0x449900,_0x8c55e8){return _0x449900['define'](_0x060e('0x9'),attributes,{'tableName':_0x060e('0xa'),'paranoid':![],'indexes':[{'name':_0x060e('0xb'),'fields':[_0x060e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 42bf2bf..125c5e4 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 _0xf85c=['rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x543461,_0x1c0cc2){var _0x44e275=function(_0x3f53c6){while(--_0x3f53c6){_0x543461['push'](_0x543461['shift']());}};_0x44e275(++_0x1c0cc2);}(_0xf85c,0x15f));var _0xcf85=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xf85c[_0x58dc25];return _0x21b0a7;};'use strict';var _=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var moment=require(_0xcf85('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf85('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcf85('0x4'));var logger=require(_0xcf85('0x5'))(_0xcf85('0x6'));var config=require(_0xcf85('0x7'));var jayson=require(_0xcf85('0x8'));var client=jayson[_0xcf85('0x9')][_0xcf85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a1482,_0x177f86,_0x5e587c){return new BPromise(function(_0x11272b,_0x2a4d6d){return client['request'](_0x3a1482,_0x5e587c)[_0xcf85('0xb')](function(_0xc5608f){logger[_0xcf85('0xc')](_0xcf85('0xd'),_0x177f86,_0xcf85('0xe'));logger['debug'](_0xcf85('0xf'),_0x177f86,'request\x20sent',JSON[_0xcf85('0x10')](_0xc5608f));if(_0xc5608f[_0xcf85('0x11')]){if(_0xc5608f[_0xcf85('0x11')][_0xcf85('0x12')]===0x1f4){logger[_0xcf85('0x11')](_0xcf85('0xd'),_0x177f86,_0xc5608f['error'][_0xcf85('0x13')]);return _0x2a4d6d(_0xc5608f[_0xcf85('0x11')][_0xcf85('0x13')]);}logger[_0xcf85('0x11')](_0xcf85('0xd'),_0x177f86,_0xc5608f['error']['message']);return _0x11272b(_0xc5608f[_0xcf85('0x11')][_0xcf85('0x13')]);}else{logger[_0xcf85('0xc')](_0xcf85('0xd'),_0x177f86,_0xcf85('0xe'));_0x11272b(_0xc5608f['result']['message']);}})[_0xcf85('0x14')](function(_0x3c295b){logger[_0xcf85('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x177f86,_0x3c295b);_0x2a4d6d(_0x3c295b);});});} \ No newline at end of file +var _0x4936=['stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x21f4b2,_0x4fffe5){var _0x1d8b06=function(_0x416ec6){while(--_0x416ec6){_0x21f4b2['push'](_0x21f4b2['shift']());}};_0x1d8b06(++_0x4fffe5);}(_0x4936,0x9f));var _0x6493=function(_0xca42ed,_0x3cf6f3){_0xca42ed=_0xca42ed-0x0;var _0x2c59c5=_0x4936[_0xca42ed];return _0x2c59c5;};'use strict';var _=require(_0x6493('0x0'));var util=require(_0x6493('0x1'));var moment=require(_0x6493('0x2'));var BPromise=require(_0x6493('0x3'));var rs=require(_0x6493('0x4'));var fs=require('fs');var Redis=require(_0x6493('0x5'));var db=require(_0x6493('0x6'))['db'];var utils=require(_0x6493('0x7'));var logger=require('../../config/logger')(_0x6493('0x8'));var config=require('../../config/environment');var jayson=require(_0x6493('0x9'));var client=jayson[_0x6493('0xa')][_0x6493('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f43e1,_0xd68225,_0x39ec7b){return new BPromise(function(_0x13aabc,_0x16b0d9){return client[_0x6493('0xc')](_0x2f43e1,_0x39ec7b)[_0x6493('0xd')](function(_0x4105d0){logger[_0x6493('0xe')](_0x6493('0xf'),_0xd68225,_0x6493('0x10'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0xd68225,_0x6493('0x10'),JSON[_0x6493('0x11')](_0x4105d0));if(_0x4105d0[_0x6493('0x12')]){if(_0x4105d0[_0x6493('0x12')][_0x6493('0x13')]===0x1f4){logger['error'](_0x6493('0xf'),_0xd68225,_0x4105d0[_0x6493('0x12')][_0x6493('0x14')]);return _0x16b0d9(_0x4105d0[_0x6493('0x12')][_0x6493('0x14')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xd68225,_0x4105d0[_0x6493('0x12')][_0x6493('0x14')]);return _0x13aabc(_0x4105d0[_0x6493('0x12')][_0x6493('0x14')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0xd68225,_0x6493('0x10'));_0x13aabc(_0x4105d0['result'][_0x6493('0x14')]);}})[_0x6493('0x15')](function(_0x43079b){logger[_0x6493('0x12')](_0x6493('0xf'),_0xd68225,_0x43079b);_0x16b0d9(_0x43079b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 6cf33f2..67fe735 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2428=['error','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','start','info','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','online','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x2428,0xd3));var _0x8242=function(_0x4c272f,_0x18d107){_0x4c272f=_0x4c272f-0x0;var _0xd08a10=_0x2428[_0x4c272f];return _0xd08a10;};'use strict';var _=require('lodash');var db=require(_0x8242('0x0'))['db'];var seedDb=require(_0x8242('0x1'));var checkLicense=require(_0x8242('0x2'));var rpc=require(_0x8242('0x3'));var config=require(_0x8242('0x4'));var logger=require(_0x8242('0x5'))(_0x8242('0x6'));var pm2=require(_0x8242('0x7'));var pm2Config=require(_0x8242('0x8'));var schedule=require(_0x8242('0x9'));var chat=require(_0x8242('0xa'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x8242('0xb'));var provider=require(_0x8242('0xc'));function main(){return db[_0x8242('0xd')][_0x8242('0xe')]()[_0x8242('0xf')](function(){if(config['seedDB']){return seedDb[_0x8242('0x10')]();}})[_0x8242('0xf')](function(){return checkLicense[_0x8242('0x10')]();})[_0x8242('0xf')](function(){return rpc['listen']();})[_0x8242('0xf')](function(_0x3abaea){logger['info'](_0x3abaea);return chat[_0x8242('0x11')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x8242('0x11')]();})[_0x8242('0xf')](function(){return provider['start']();})['then'](function(_0xfb7cae){logger[_0x8242('0x12')](_0xfb7cae);return pm2['start'](pm2Config);})[_0x8242('0xf')](function(_0x5d649c){var _0x4086e5=_0x5d649c[_0x8242('0x13')](function(_0x27f950){return typeof _0x27f950[_0x8242('0x14')]===_0x8242('0x15')&&_0x27f950[_0x8242('0x14')]>=0x0;});if(_0x4086e5[_0x8242('0x16')]>0x0){throw new Error(_0x4086e5['length']+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x8242('0x17')](_0x4086e5,function(_0x45a325){return'\x22'+_0x45a325[_0x8242('0x18')][_0x8242('0x19')]+'\x22';}));}logger[_0x8242('0x12')](_0x8242('0x1a'),_[_0x8242('0x17')](_[_0x8242('0x13')](_0x5d649c,{'status':'online'}),_0x8242('0x19'))[_0x8242('0x1b')]());logger[_0x8242('0x12')](_0x8242('0x1c'),_[_0x8242('0x17')](_['filter'](_0x5d649c,function(_0x140fbc){return _0x140fbc['status']!==_0x8242('0x1d');}),_0x8242('0x19'))['join']()||'None');console[_0x8242('0x1e')](_0x8242('0x1f'));})[_0x8242('0x20')](function(_0x30e805){console[_0x8242('0x1e')](_0x8242('0x21'),_0x30e805);logger[_0x8242('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x30e805);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x4f5d=['./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','map','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB'];(function(_0x449d1e,_0x117a74){var _0x440487=function(_0x20435a){while(--_0x20435a){_0x449d1e['push'](_0x449d1e['shift']());}};_0x440487(++_0x117a74);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4f5d[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0xd4f5('0x0'));var db=require(_0xd4f5('0x1'))['db'];var seedDb=require(_0xd4f5('0x2'));var checkLicense=require(_0xd4f5('0x3'));var rpc=require(_0xd4f5('0x4'));var config=require(_0xd4f5('0x5'));var logger=require('./config/logger')(_0xd4f5('0x6'));var pm2=require(_0xd4f5('0x7'));var pm2Config=require(_0xd4f5('0x8'));var schedule=require(_0xd4f5('0x9'));var chat=require(_0xd4f5('0xa'));var whatsapp=require(_0xd4f5('0xb'));var transcribe=require(_0xd4f5('0xc'));var provider=require(_0xd4f5('0xd'));function main(){return db[_0xd4f5('0xe')][_0xd4f5('0xf')]()[_0xd4f5('0x10')](function(){if(config[_0xd4f5('0x11')]){return seedDb[_0xd4f5('0x12')]();}})['then'](function(){return checkLicense[_0xd4f5('0x12')]();})[_0xd4f5('0x10')](function(){return rpc['listen']();})[_0xd4f5('0x10')](function(_0x90fe4){logger[_0xd4f5('0x13')](_0x90fe4);return chat[_0xd4f5('0x14')]();})[_0xd4f5('0x10')](function(){return whatsapp[_0xd4f5('0x14')]();})[_0xd4f5('0x10')](function(){return schedule[_0xd4f5('0x14')]();})[_0xd4f5('0x10')](function(){return transcribe['start']();})[_0xd4f5('0x10')](function(){return provider[_0xd4f5('0x14')]();})['then'](function(_0x1553ec){logger[_0xd4f5('0x13')](_0x1553ec);return pm2[_0xd4f5('0x14')](pm2Config);})['then'](function(_0x166d4d){var _0x18dd1c=_0x166d4d[_0xd4f5('0x15')](function(_0x1a158f){return typeof _0x1a158f[_0xd4f5('0x16')]===_0xd4f5('0x17')&&_0x1a158f[_0xd4f5('0x16')]>=0x0;});if(_0x18dd1c[_0xd4f5('0x18')]>0x0){throw new Error(_0x18dd1c['length']+_0xd4f5('0x19')+_['map'](_0x18dd1c,function(_0x45d043){return'\x22'+_0x45d043['pm2_env'][_0xd4f5('0x1a')]+'\x22';}));}logger[_0xd4f5('0x13')](_0xd4f5('0x1b'),_[_0xd4f5('0x1c')](_[_0xd4f5('0x15')](_0x166d4d,{'status':_0xd4f5('0x1d')}),_0xd4f5('0x1a'))[_0xd4f5('0x1e')]());logger['info'](_0xd4f5('0x1f'),_[_0xd4f5('0x1c')](_['filter'](_0x166d4d,function(_0x1aae04){return _0x1aae04[_0xd4f5('0x20')]!=='online';}),'name')[_0xd4f5('0x1e')]()||_0xd4f5('0x21'));console[_0xd4f5('0x22')](_0xd4f5('0x23'));})[_0xd4f5('0x24')](function(_0x2a96b3){console[_0xd4f5('0x22')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x2a96b3);logger['error'](_0xd4f5('0x25'),_0x2a96b3);process[_0xd4f5('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index bd663f6..c13538d 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 _0x0fdf=['updatePasswordsHistory','split','length','unshift','join','promisify','sign','secret','payload','options','hex','floor','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','composable-middleware','crypto','bluebird','secrets','session','role','internal','email','userpic','permissions','md5secret','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','query','forceDownload','status','json','Forbidden.','catch','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','send','retrieveApiKey','isNil','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','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.'];(function(_0x48251c,_0x122f9d){var _0x4171b6=function(_0x7fe81d){while(--_0x7fe81d){_0x48251c['push'](_0x48251c['shift']());}};_0x4171b6(++_0x122f9d);}(_0x0fdf,0x1a0));var _0xf0fd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fdf[_0x20a584];return _0x4b41a8;};'use strict';var db=require(_0xf0fd('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xf0fd('0x1'));var licenseUtil=require(_0xf0fd('0x2'));var encryptor=require(_0xf0fd('0x3'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xf0fd('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0xf0fd('0x5'));var BPromise=require(_0xf0fd('0x6'));var util=require('util');var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xf0fd('0x7')][_0xf0fd('0x8')]});var userAttributes=['id',_0xf0fd('0x9'),'fullname','name',_0xf0fd('0xa'),_0xf0fd('0xb'),_0xf0fd('0xc'),_0xf0fd('0xd'),_0xf0fd('0xe'),'voicePause','chatPause',_0xf0fd('0xf'),_0xf0fd('0x10'),_0xf0fd('0x11'),_0xf0fd('0x12'),_0xf0fd('0x13'),_0xf0fd('0x14'),'lastLoginAt',_0xf0fd('0x15'),_0xf0fd('0x16'),_0xf0fd('0x17'),'passwordResetAt',_0xf0fd('0x18'),_0xf0fd('0x19'),_0xf0fd('0x1a'),_0xf0fd('0x1b'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xf0fd('0x1c'),_0xf0fd('0x1d'),_0xf0fd('0x1e'),_0xf0fd('0x1f'),_0xf0fd('0x20'),_0xf0fd('0x21'),_0xf0fd('0x22'),_0xf0fd('0x23'),'privacyEnabled',_0xf0fd('0x24'),'wssPort',_0xf0fd('0x25'),_0xf0fd('0x26'),_0xf0fd('0x27'),_0xf0fd('0x28'),_0xf0fd('0x29'),'chatAutoanswer',_0xf0fd('0x2a'),'emailAutoanswer',_0xf0fd('0x2b'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0xf0fd('0x2e'),_0xf0fd('0x2f'),_0xf0fd('0x30'),_0xf0fd('0x31'),_0xf0fd('0x32'),_0xf0fd('0x33'),_0xf0fd('0x34')];exports[_0xf0fd('0x35')]=function(){return this[_0xf0fd('0x36')](!![])[_0xf0fd('0x37')](function(_0x5f206f,_0x71114e,_0x51af5a){if(_0x5f206f[_0xf0fd('0x38')]){_0x51af5a();}else{return db[_0xf0fd('0x39')][_0xf0fd('0x3a')]({'where':{'id':_0x5f206f['params']['id']},'attributes':['id',_0xf0fd('0x3b'),_0xf0fd('0x3c')],'raw':!![]})[_0xf0fd('0x3d')](function(_0x3b32b9){if(_0x3b32b9&&_0x3b32b9[_0xf0fd('0x3b')]&&!_0x5f206f[_0xf0fd('0x3e')][_0xf0fd('0x3f')]){return _0x71114e[_0xf0fd('0x40')](_0x3b32b9[_0xf0fd('0x3c')]==='unmanaged'?0x195:0x193)[_0xf0fd('0x41')]({'message':_0x3b32b9[_0xf0fd('0x3c')]==='unmanaged'?'Unmanaged.':_0xf0fd('0x42')});}else{_0x51af5a();}})[_0xf0fd('0x43')](function(_0x120414){_0x51af5a(_0x120414);});}});};exports['isAuthenticated']=function isAuthenticated(_0x56d9f7){return compose()['use'](function(_0x2bf27f,_0x475862,_0x50a1ea){var _0x320344;if(_0x2bf27f[_0xf0fd('0x44')][_0xf0fd('0x45')]){if(_[_0xf0fd('0x46')](_0x2bf27f[_0xf0fd('0x44')]['authorization'],'Basic')){var _0x53923b=basicAuth(_0x2bf27f);db[_0xf0fd('0x47')][_0xf0fd('0x48')]({'where':{'name':_0x53923b[_0xf0fd('0x49')]}})[_0xf0fd('0x3d')](function(_0x1da619){if(!_0x1da619||!_0x1da619[_0xf0fd('0x4a')](_0x53923b[_0xf0fd('0x4b')])){return _0x475862['status'](0x191)[_0xf0fd('0x41')]({'message':_0xf0fd('0x4c')});}_0x2bf27f[_0xf0fd('0x38')]={'id':_0x1da619['id']};_0x50a1ea();})[_0xf0fd('0x43')](function(_0x2e0a81){_0x50a1ea(_0x2e0a81);});}else if(_[_0xf0fd('0x46')](_0x2bf27f[_0xf0fd('0x44')][_0xf0fd('0x45')],'Bearer')){validateJwt(_0x2bf27f,_0x475862,_0x50a1ea);}else{if(_0x56d9f7){_0x50a1ea();}else{return _0x475862[_0xf0fd('0x40')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2bf27f[_0xf0fd('0x3e')][_0xf0fd('0x4d')]){try{var _0x54fdd1={'audience':hardwareConf[_0xf0fd('0x4e')](),'issuer':hardwareConf[_0xf0fd('0x4e')]()};verifyJwt(_0x2bf27f[_0xf0fd('0x3e')]['apikey'],_0x54fdd1)[_0xf0fd('0x3d')](function(_0x10595d){return db[_0xf0fd('0x47')][_0xf0fd('0x48')]({'where':{'id':_0x10595d[_0xf0fd('0x4f')]}})['then'](function(_0x27dcf4){_0x320344=_0x27dcf4;return db[_0xf0fd('0x50')][_0xf0fd('0x3a')]({'where':{'id':0x1},'attributes':[_0xf0fd('0x51'),_0xf0fd('0x52')],'raw':!![]});})[_0xf0fd('0x3d')](function(_0x1f046b){if(!_0x320344||!_[_0xf0fd('0x53')](_0x320344[_0xf0fd('0x54')],_0x10595d[_0xf0fd('0x55')])){return _0x475862[_0xf0fd('0x40')](0x191)['json']({'message':_0xf0fd('0x56')});}if(_0x320344[_0xf0fd('0x57')]){return _0x475862[_0xf0fd('0x40')](0x191)[_0xf0fd('0x41')]({'message':_0xf0fd('0x58')});}if(_0x320344[_0xf0fd('0x59')]){if(_0x1f046b[_0xf0fd('0x52')]>0x0){if(moment(_0x320344[_0xf0fd('0x5a')])[_0xf0fd('0x5b')](_0x1f046b['blockDuration'],_0xf0fd('0x5c'))>moment()){return _0x475862[_0xf0fd('0x40')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x475862[_0xf0fd('0x40')](0x191)[_0xf0fd('0x41')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x2bf27f[_0xf0fd('0x38')]={'id':_0x320344['id']};_0x50a1ea();});})[_0xf0fd('0x43')](function(){return _0x475862[_0xf0fd('0x40')](0x191)[_0xf0fd('0x41')]({'message':_0xf0fd('0x58')});});}catch(_0x3f504c){_0x50a1ea(_0x3f504c);}}else if(_0x56d9f7){_0x50a1ea();}else{return _0x475862[_0xf0fd('0x40')](0x193)[_0xf0fd('0x41')]({'message':_0xf0fd('0x5d')});}})[_0xf0fd('0x37')](function(_0x3260aa,_0xbe7a43,_0x42a3a0){if(_0x3260aa[_0xf0fd('0x38')]){db['User'][_0xf0fd('0x48')]({'where':{'id':_0x3260aa[_0xf0fd('0x38')]['id']},'attributes':userAttributes})[_0xf0fd('0x3d')](function(_0x312c8f){if(!_0x312c8f){return _0xbe7a43[_0xf0fd('0x40')](0x194)[_0xf0fd('0x41')]({'message':_0xf0fd('0x5e')});}_0x3260aa[_0xf0fd('0x38')]=_0x312c8f;_0x42a3a0();})['catch'](function(_0x32a27e){_0x42a3a0(_0x32a27e);});}else if(_0x56d9f7){_0x42a3a0();}else{return _0xbe7a43[_0xf0fd('0x40')](0x194)[_0xf0fd('0x41')]({'message':_0xf0fd('0x5f')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x164219,_0x4f5957,_0x386588){return licenseUtil['getLicense']()[_0xf0fd('0x3d')](function(_0x179887){if(_0x179887[_0xf0fd('0x60')]){_0x386588();}else{return _0x4f5957[_0xf0fd('0x40')](0x193)[_0xf0fd('0x41')]({'message':_0xf0fd('0x61')});}})[_0xf0fd('0x43')](function(_0x36ff08){_0x386588(_0x36ff08);});});};exports[_0xf0fd('0x62')]=function isWebrtcLicence(){return compose()['use'](function(_0x51a9ae,_0x42df8d,_0xa303e5){return licenseUtil[_0xf0fd('0x63')]()[_0xf0fd('0x3d')](function(_0x13a157){if(_0x13a157['webrtc']){_0xa303e5();}else{return _0x42df8d[_0xf0fd('0x40')](0x193)['json']({'message':_0xf0fd('0x61')});}})['catch'](function(_0x5381c4){_0xa303e5(_0x5381c4);});});};exports[_0xf0fd('0x64')]=function(_0x511e00,_0x1fc20e,_0x236e85){_0x511e00[_0xf0fd('0x64')]=!![];return _0x236e85();};exports[_0xf0fd('0x65')]=function signToken(_0x3571c4){return signJwt(_0x3571c4);};exports[_0xf0fd('0x66')]=function(_0x51e945,_0x20ec3a){if(!_0x51e945[_0xf0fd('0x38')]){return _0x20ec3a[_0xf0fd('0x40')](0x194)[_0xf0fd('0x41')]({'message':_0xf0fd('0x67')});}var _0x34190d={'payload':{'id':_0x51e945['user']['id'],'role':_0x51e945[_0xf0fd('0x38')][_0xf0fd('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x34190d)[_0xf0fd('0x3d')](function(_0x31f1dc){_0x20ec3a[_0xf0fd('0x68')]('motion.token',_0x31f1dc);_0x20ec3a[_0xf0fd('0x69')]('/dashboards/general');})[_0xf0fd('0x43')](function(_0x21dc56){return _0x20ec3a['status'](0x1f4)[_0xf0fd('0x6a')](_0x21dc56);});};exports[_0xf0fd('0x6b')]=function(_0x2ffce7){if(_[_0xf0fd('0x6c')](_0x2ffce7[_0xf0fd('0x54')])||_[_0xf0fd('0x6c')](_0x2ffce7[_0xf0fd('0x6d')])){return null;}else{return createJwt(_0x2ffce7);}};exports['generateApiKey']=function(_0x498adf){_0x498adf[_0xf0fd('0x54')]=generateNonce();_0x498adf[_0xf0fd('0x6d')]=generateIssuedAt();return createJwt(_0x498adf);};exports['regenerateApiKey']=function(_0x56674d,_0x834cd6){var _0x438c7c=_0x56674d[_0xf0fd('0x3e')][_0xf0fd('0x4d')];if(_0x438c7c){var _0x1bea96={'nonce':_0x834cd6[_0xf0fd('0x54')],'iat':_0x834cd6['apiKeyIat'],'audience':hardwareConf[_0xf0fd('0x4e')](),'issuer':hardwareConf[_0xf0fd('0x4e')]()};return verifyJwt(_0x438c7c,_0x1bea96)[_0xf0fd('0x3d')](function(){return generateApiKey(_0x834cd6);});}else{throw{'message':_0xf0fd('0x6e')};}};exports[_0xf0fd('0x6f')]=function(_0x96e466){var _0x2e8b3c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2e8b3c[_0xf0fd('0x70')](_0x96e466))throw new db[(_0xf0fd('0x71'))][(_0xf0fd('0x72'))](_0xf0fd('0x73'));return;};exports['validatePasswordHistory']=function(_0x2e95b7,_0x175235,_0x368ea7){var _0x3797dd=encryptor[_0xf0fd('0x74')](_0x175235)['split'](',');for(var _0x5efb46=0x0;_0x5efb46<_0x368ea7;_0x5efb46++){if(!_0x3797dd[_0x5efb46])break;if(_0x2e95b7['toLowerCase']()===_0x3797dd[_0x5efb46]['toLowerCase']()){var _0x10a942=util[_0xf0fd('0x75')](_0xf0fd('0x76'),_0x368ea7);if(_0x368ea7===0x1){_0x10a942=_0xf0fd('0x77');}throw new db['Sequelize'][(_0xf0fd('0x72'))](_0x10a942);}}return;};exports[_0xf0fd('0x78')]=function(_0x49a101,_0x3f25a8){var _0x1246e4=_0x3f25a8?encryptor['decryptString'](_0x3f25a8)[_0xf0fd('0x79')](','):[];if(_0x1246e4[_0xf0fd('0x7a')]===0x5){_0x1246e4['splice'](-0x1,0x1);}_0x1246e4[_0xf0fd('0x7b')](_0x49a101);return encryptor['encryptString'](_0x1246e4[_0xf0fd('0x7c')](','));};function signJwt(_0x59454e){var _0x5874d8=BPromise[_0xf0fd('0x7d')](jwt[_0xf0fd('0x7e')],{'context':jwt});var _0x5d2a95=_0x59454e[_0xf0fd('0x7f')]||config[_0xf0fd('0x7')][_0xf0fd('0x8')];return new BPromise(function(_0x1401d2,_0x3581c0){_0x5874d8(_0x59454e[_0xf0fd('0x80')],_0x5d2a95,_0x59454e[_0xf0fd('0x81')])[_0xf0fd('0x3d')](function(_0x2b13e0){_0x1401d2(_0x2b13e0);})[_0xf0fd('0x43')](function(_0x44c8c3){_0x3581c0(_0x44c8c3);});});}function verifyJwt(_0x332382,_0x18484f,_0x12b589){var _0x37a35c=BPromise[_0xf0fd('0x7d')](jwt['verify'],{'context':jwt});var _0x2d6cf7=_0x12b589||config[_0xf0fd('0x7')][_0xf0fd('0x8')];return new BPromise(function(_0x2a1309,_0x5146f1){_0x37a35c(_0x332382,_0x2d6cf7,_0x18484f)[_0xf0fd('0x3d')](function(_0x4273da){_0x2a1309(_0x4273da);})[_0xf0fd('0x43')](function(_0xce5efb){_0x5146f1(_0xce5efb);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xf0fd('0x82'));}function generateIssuedAt(){return Math[_0xf0fd('0x83')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x23cccd){var _0x156acd={'payload':{'iat':_0x23cccd[_0xf0fd('0x6d')],'nonce':_0x23cccd[_0xf0fd('0x54')]},'options':{'algorithm':_0xf0fd('0x84'),'subject':_0x23cccd['id'][_0xf0fd('0x85')](),'issuer':hardwareConf[_0xf0fd('0x4e')](),'audience':hardwareConf[_0xf0fd('0x4e')]()}};return signJwt(_0x156acd)[_0xf0fd('0x3d')](function(_0x6b6de8){return{'iat':_0x23cccd['apiKeyIat'],'nonce':_0x23cccd[_0xf0fd('0x54')],'token':_0x6b6de8};});} \ No newline at end of file +var _0x3533=['ValidationError','length','unshift','join','sign','secret','payload','options','promisify','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','query','forceDownload','status','unmanaged','json','Unmanaged.','catch','headers','authorization','Basic','find','authenticate','Wrong\x20credentials.','user','startsWith','Unknown\x20authorization\x20format','getUuid','apikey','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockedAt','minutes','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','webrtc','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.'];(function(_0x3b19ea,_0x518b6b){var _0x40ece9=function(_0x3a3386){while(--_0x3a3386){_0x3b19ea['push'](_0x3b19ea['shift']());}};_0x40ece9(++_0x518b6b);}(_0x3533,0x9b));var _0x3353=function(_0x547379,_0x2492ff){_0x547379=_0x547379-0x0;var _0x3d0fa5=_0x3533[_0x547379];return _0x3d0fa5;};'use strict';var db=require(_0x3353('0x0'))['db'];var config=require(_0x3353('0x1'));var hardwareConf=require(_0x3353('0x2'));var licenseUtil=require(_0x3353('0x3'));var encryptor=require('../encryptor');var _=require(_0x3353('0x4'));var jwt=require(_0x3353('0x5'));var expressJwt=require(_0x3353('0x6'));var compose=require(_0x3353('0x7'));var basicAuth=require(_0x3353('0x8'));var crypto=require(_0x3353('0x9'));var BPromise=require(_0x3353('0xa'));var util=require('util');var moment=require(_0x3353('0xb'));var validateJwt=expressJwt({'secret':config[_0x3353('0xc')][_0x3353('0xd')]});var userAttributes=['id',_0x3353('0xe'),_0x3353('0xf'),_0x3353('0x10'),_0x3353('0x11'),_0x3353('0x12'),_0x3353('0x13'),_0x3353('0x14'),'md5secret',_0x3353('0x15'),'chatPause','mailPause',_0x3353('0x16'),_0x3353('0x17'),'openchannelPause',_0x3353('0x18'),_0x3353('0x19'),_0x3353('0x1a'),_0x3353('0x1b'),_0x3353('0x1c'),_0x3353('0x1d'),_0x3353('0x1e'),_0x3353('0x1f'),_0x3353('0x20'),'phoneBarAutoAnswerDelay',_0x3353('0x21'),'phoneBarEnableRecording',_0x3353('0x22'),_0x3353('0x23'),_0x3353('0x24'),_0x3353('0x25'),_0x3353('0x26'),_0x3353('0x27'),_0x3353('0x28'),_0x3353('0x29'),_0x3353('0x2a'),_0x3353('0x2b'),_0x3353('0x2c'),_0x3353('0x2d'),_0x3353('0x2e'),'downloadOmnichannelInteractions',_0x3353('0x2f'),_0x3353('0x30'),_0x3353('0x31'),_0x3353('0x32'),'chatAutoanswerDelay',_0x3353('0x33'),'emailAutoanswerDelay',_0x3353('0x34'),_0x3353('0x35'),'openchannelAutoanswer',_0x3353('0x36'),_0x3353('0x37'),_0x3353('0x38'),_0x3353('0x39'),'whatsappAutoanswerDelay',_0x3353('0x3a')];exports[_0x3353('0x3b')]=function(){return this[_0x3353('0x3c')](!![])[_0x3353('0x3d')](function(_0x1d9d56,_0x48b8a9,_0x49f341){if(_0x1d9d56['user']){_0x49f341();}else{return db[_0x3353('0x3e')][_0x3353('0x3f')]({'where':{'id':_0x1d9d56[_0x3353('0x40')]['id']},'attributes':['id',_0x3353('0x41'),_0x3353('0x42')],'raw':!![]})[_0x3353('0x43')](function(_0x4cbe9c){if(_0x4cbe9c&&_0x4cbe9c['closed']&&!_0x1d9d56[_0x3353('0x44')][_0x3353('0x45')]){return _0x48b8a9[_0x3353('0x46')](_0x4cbe9c['disposition']===_0x3353('0x47')?0x195:0x193)[_0x3353('0x48')]({'message':_0x4cbe9c[_0x3353('0x42')]===_0x3353('0x47')?_0x3353('0x49'):'Forbidden.'});}else{_0x49f341();}})[_0x3353('0x4a')](function(_0x505287){_0x49f341(_0x505287);});}});};exports[_0x3353('0x3c')]=function isAuthenticated(_0x58540a){return compose()[_0x3353('0x3d')](function(_0xad4c83,_0x5581dc,_0x1d3f24){var _0x5b22ef;if(_0xad4c83[_0x3353('0x4b')][_0x3353('0x4c')]){if(_['startsWith'](_0xad4c83['headers'][_0x3353('0x4c')],_0x3353('0x4d'))){var _0x33e4aa=basicAuth(_0xad4c83);db['User'][_0x3353('0x4e')]({'where':{'name':_0x33e4aa[_0x3353('0x10')]}})[_0x3353('0x43')](function(_0x33c4e3){if(!_0x33c4e3||!_0x33c4e3[_0x3353('0x4f')](_0x33e4aa['pass'])){return _0x5581dc[_0x3353('0x46')](0x191)[_0x3353('0x48')]({'message':_0x3353('0x50')});}_0xad4c83[_0x3353('0x51')]={'id':_0x33c4e3['id']};_0x1d3f24();})[_0x3353('0x4a')](function(_0x57f473){_0x1d3f24(_0x57f473);});}else if(_[_0x3353('0x52')](_0xad4c83['headers'][_0x3353('0x4c')],'Bearer')){validateJwt(_0xad4c83,_0x5581dc,_0x1d3f24);}else{if(_0x58540a){_0x1d3f24();}else{return _0x5581dc[_0x3353('0x46')](0x193)[_0x3353('0x48')]({'message':_0x3353('0x53')});}}}else if(_0xad4c83['query']['apikey']){try{var _0x4440f0={'audience':hardwareConf[_0x3353('0x54')](),'issuer':hardwareConf[_0x3353('0x54')]()};verifyJwt(_0xad4c83[_0x3353('0x44')][_0x3353('0x55')],_0x4440f0)[_0x3353('0x43')](function(_0x4d19e6){return db['User'][_0x3353('0x4e')]({'where':{'id':_0x4d19e6[_0x3353('0x56')]}})[_0x3353('0x43')](function(_0x38e562){_0x5b22ef=_0x38e562;return db['Setting'][_0x3353('0x3f')]({'where':{'id':0x1},'attributes':[_0x3353('0x57'),_0x3353('0x58')],'raw':!![]});})[_0x3353('0x43')](function(_0x311d0c){if(!_0x5b22ef||!_[_0x3353('0x59')](_0x5b22ef[_0x3353('0x5a')],_0x4d19e6[_0x3353('0x5b')])){return _0x5581dc[_0x3353('0x46')](0x191)[_0x3353('0x48')]({'message':_0x3353('0x5c')});}if(_0x5b22ef['disabled']){return _0x5581dc[_0x3353('0x46')](0x191)[_0x3353('0x48')]({'message':_0x3353('0x5d')});}if(_0x5b22ef[_0x3353('0x5e')]){if(_0x311d0c[_0x3353('0x58')]>0x0){if(moment(_0x5b22ef[_0x3353('0x5f')])['add'](_0x311d0c['blockDuration'],_0x3353('0x60'))>moment()){return _0x5581dc[_0x3353('0x46')](0x191)['json']({'message':_0x3353('0x5d')});}}else{return _0x5581dc[_0x3353('0x46')](0x191)[_0x3353('0x48')]({'message':'Invalid\x20API\x20access\x20key'});}}_0xad4c83['user']={'id':_0x5b22ef['id']};_0x1d3f24();});})[_0x3353('0x4a')](function(){return _0x5581dc[_0x3353('0x46')](0x191)['json']({'message':_0x3353('0x5d')});});}catch(_0x36f6b6){_0x1d3f24(_0x36f6b6);}}else if(_0x58540a){_0x1d3f24();}else{return _0x5581dc[_0x3353('0x46')](0x193)[_0x3353('0x48')]({'message':_0x3353('0x53')});}})[_0x3353('0x3d')](function(_0xc08578,_0x2fa37,_0x25496c){if(_0xc08578[_0x3353('0x51')]){db[_0x3353('0x61')][_0x3353('0x4e')]({'where':{'id':_0xc08578[_0x3353('0x51')]['id']},'attributes':userAttributes})[_0x3353('0x43')](function(_0x20bc0c){if(!_0x20bc0c){return _0x2fa37[_0x3353('0x46')](0x194)[_0x3353('0x48')]({'message':_0x3353('0x62')});}_0xc08578['user']=_0x20bc0c;_0x25496c();})[_0x3353('0x4a')](function(_0x53331f){_0x25496c(_0x53331f);});}else if(_0x58540a){_0x25496c();}else{return _0x2fa37[_0x3353('0x46')](0x194)[_0x3353('0x48')]({'message':_0x3353('0x63')});}});};exports[_0x3353('0x64')]=function canUpdate(){return compose()['use'](function(_0x25dde1,_0x41b84f,_0xe5f9d){return licenseUtil[_0x3353('0x65')]()['then'](function(_0x3935ff){if(_0x3935ff[_0x3353('0x66')]){_0xe5f9d();}else{return _0x41b84f[_0x3353('0x46')](0x193)[_0x3353('0x48')]({'message':'Forbidden'});}})[_0x3353('0x4a')](function(_0xccca02){_0xe5f9d(_0xccca02);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0x3353('0x3d')](function(_0x1a78e6,_0x128251,_0x370492){return licenseUtil['getLicense']()[_0x3353('0x43')](function(_0x2f976d){if(_0x2f976d[_0x3353('0x67')]){_0x370492();}else{return _0x128251[_0x3353('0x46')](0x193)[_0x3353('0x48')]({'message':_0x3353('0x68')});}})[_0x3353('0x4a')](function(_0x581d81){_0x370492(_0x581d81);});});};exports[_0x3353('0x69')]=function(_0xe7850e,_0x9d50a,_0xcd9844){_0xe7850e['isMiddleware']=!![];return _0xcd9844();};exports[_0x3353('0x6a')]=function signToken(_0x2acd72){return signJwt(_0x2acd72);};exports[_0x3353('0x6b')]=function(_0x3d7b3e,_0x27729d){if(!_0x3d7b3e[_0x3353('0x51')]){return _0x27729d[_0x3353('0x46')](0x194)[_0x3353('0x48')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x146f84={'payload':{'id':_0x3d7b3e[_0x3353('0x51')]['id'],'role':_0x3d7b3e[_0x3353('0x51')][_0x3353('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x146f84)[_0x3353('0x43')](function(_0x5c52fe){_0x27729d[_0x3353('0x6c')]('motion.token',_0x5c52fe);_0x27729d[_0x3353('0x6d')](_0x3353('0x6e'));})[_0x3353('0x4a')](function(_0x262f96){return _0x27729d[_0x3353('0x46')](0x1f4)['send'](_0x262f96);});};exports[_0x3353('0x6f')]=function(_0xf34fda){if(_[_0x3353('0x70')](_0xf34fda[_0x3353('0x5a')])||_[_0x3353('0x70')](_0xf34fda['apiKeyIat'])){return null;}else{return createJwt(_0xf34fda);}};exports[_0x3353('0x71')]=function(_0xbf09a5){_0xbf09a5[_0x3353('0x5a')]=generateNonce();_0xbf09a5[_0x3353('0x72')]=generateIssuedAt();return createJwt(_0xbf09a5);};exports[_0x3353('0x73')]=function(_0x1c7f37,_0x5384ee){var _0x4a2ada=_0x1c7f37[_0x3353('0x44')]['apikey'];if(_0x4a2ada){var _0x29aeff={'nonce':_0x5384ee[_0x3353('0x5a')],'iat':_0x5384ee['apiKeyIat'],'audience':hardwareConf[_0x3353('0x54')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x4a2ada,_0x29aeff)['then'](function(){return generateApiKey(_0x5384ee);});}else{throw{'message':_0x3353('0x74')};}};exports[_0x3353('0x75')]=function(_0x5cdabb){var _0x35e02f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x35e02f[_0x3353('0x76')](_0x5cdabb))throw new db[(_0x3353('0x77'))]['ValidationError'](_0x3353('0x78'));return;};exports[_0x3353('0x79')]=function(_0x189709,_0x64628a,_0x1e76c9){var _0x521c90=encryptor[_0x3353('0x7a')](_0x64628a)[_0x3353('0x7b')](',');for(var _0x1c220b=0x0;_0x1c220b<_0x1e76c9;_0x1c220b++){if(!_0x521c90[_0x1c220b])break;if(_0x189709['toLowerCase']()===_0x521c90[_0x1c220b][_0x3353('0x7c')]()){var _0x9aa8de=util[_0x3353('0x7d')](_0x3353('0x7e'),_0x1e76c9);if(_0x1e76c9===0x1){_0x9aa8de='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x3353('0x7f'))](_0x9aa8de);}}return;};exports['updatePasswordsHistory']=function(_0x36fb46,_0xf6d405){var _0x4e99a2=_0xf6d405?encryptor[_0x3353('0x7a')](_0xf6d405)['split'](','):[];if(_0x4e99a2[_0x3353('0x80')]===0x5){_0x4e99a2['splice'](-0x1,0x1);}_0x4e99a2[_0x3353('0x81')](_0x36fb46);return encryptor['encryptString'](_0x4e99a2[_0x3353('0x82')](','));};function signJwt(_0x58ed8d){var _0x52a3d7=BPromise['promisify'](jwt[_0x3353('0x83')],{'context':jwt});var _0x2efaa0=_0x58ed8d[_0x3353('0x84')]||config[_0x3353('0xc')][_0x3353('0xd')];return new BPromise(function(_0x46c4c3,_0x525d42){_0x52a3d7(_0x58ed8d[_0x3353('0x85')],_0x2efaa0,_0x58ed8d[_0x3353('0x86')])[_0x3353('0x43')](function(_0x299cde){_0x46c4c3(_0x299cde);})[_0x3353('0x4a')](function(_0x308bb2){_0x525d42(_0x308bb2);});});}function verifyJwt(_0x188565,_0x221416,_0x4f1516){var _0x29b86d=BPromise[_0x3353('0x87')](jwt['verify'],{'context':jwt});var _0x1633d0=_0x4f1516||config[_0x3353('0xc')]['session'];return new BPromise(function(_0x30b126,_0x142c25){_0x29b86d(_0x188565,_0x1633d0,_0x221416)[_0x3353('0x43')](function(_0x577ce8){_0x30b126(_0x577ce8);})[_0x3353('0x4a')](function(_0x5da18b){_0x142c25(_0x5da18b);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x3353('0x88')](_0x3353('0x89'));}function generateIssuedAt(){return Math[_0x3353('0x8a')](Date[_0x3353('0x8b')]()/0x3e8)['toString']();}function createJwt(_0x2d8af9){var _0xc00623={'payload':{'iat':_0x2d8af9[_0x3353('0x72')],'nonce':_0x2d8af9[_0x3353('0x5a')]},'options':{'algorithm':_0x3353('0x8c'),'subject':_0x2d8af9['id']['toString'](),'issuer':hardwareConf[_0x3353('0x54')](),'audience':hardwareConf[_0x3353('0x54')]()}};return signJwt(_0xc00623)[_0x3353('0x43')](function(_0x5afcaa){return{'iat':_0x2d8af9['apiKeyIat'],'nonce':_0x2d8af9[_0x3353('0x5a')],'token':_0x5afcaa};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index b142ff9..ca381ff 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 _0x97e4=['then','parseAdvancedSearchFilter','search','parseQueryParameters','where','default','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve'];(function(_0x1f9488,_0x4f21df){var _0x115b3f=function(_0x4120e1){while(--_0x4120e1){_0x1f9488['push'](_0x1f9488['shift']());}};_0x115b3f(++_0x4f21df);}(_0x97e4,0x1ce));var _0x497e=function(_0x11e000,_0x12a8e5){_0x11e000=_0x11e000-0x0;var _0x110c27=_0x97e4[_0x11e000];return _0x110c27;};'use strict';var _=require(_0x497e('0x0'));var sqlUtils=require(_0x497e('0x1'));var db=require(_0x497e('0x2'))['db'];exports[_0x497e('0x3')]=function(_0x39f7f0,_0x478366,_0x22c1d0,_0x2ef034){var _0x4c818e={'count':0x0,'rows':[]};var _0x1a10a5=sqlUtils[_0x497e('0x4')](_0x478366,_0x39f7f0);if(_0x1a10a5){return Promise[_0x497e('0x5')](_0x4c818e);}var _0xdeb50f=sqlUtils['getContactsSubquery']();var _0x1bf11d={};var _0x1b420c=![];var _0x4a3b57=![];return Promise['resolve']()[_0x497e('0x6')](function(){if(_0x39f7f0['search']){return sqlUtils[_0x497e('0x7')](_0x39f7f0[_0x497e('0x8')],_0x2ef034);}else{return sqlUtils[_0x497e('0x9')](_0x39f7f0,_0x2ef034);}})['then'](function(_0x2cb744){_0xdeb50f[_0x497e('0xa')](_0x2cb744[_0x497e('0xb')]);_0xdeb50f['where'](_0x2cb744['fields']);_0xdeb50f['where'](_0x2cb744['filter']);_0xdeb50f[_0x497e('0xa')](_0x2cb744[_0x497e('0xc')][_0x497e('0xd')]);_0x1bf11d=_0x2cb744[_0x497e('0xe')];_0x4a3b57=_0x2cb744[_0x497e('0xc')][_0x497e('0xf')];return sqlUtils[_0x497e('0x10')](_0x478366,_0x39f7f0,_0x4a3b57);})[_0x497e('0x6')](function(_0xd6bdd2){_0xdeb50f[_0x497e('0xa')](_0xd6bdd2);var _0x1b5e44=_0x39f7f0[_0x497e('0x8')]?_0x1bf11d[_0x497e('0x11')]:_0x39f7f0['tag'];_0x1b420c=_0x1b5e44?!![]:![];return sqlUtils[_0x497e('0x12')](_0xdeb50f,_0x1b5e44);})['then'](function(_0x2fe996){_0x4c818e[_0x497e('0x13')]=_0x2fe996;if(_0x4c818e[_0x497e('0x13')]===0x0){return;}if(_0x39f7f0[_0x497e('0x14')]){_0x4a3b57=!![];}return sqlUtils[_0x497e('0x15')](_0xdeb50f,_0x39f7f0[_0x497e('0x16')],_0x22c1d0,_0x1b420c,_0x1bf11d['clause'],_0x4a3b57);})[_0x497e('0x6')](function(_0x124989){if(!_0x124989){return[];}return sqlUtils[_0x497e('0x17')](_0x124989,_0x39f7f0,_0x22c1d0);})[_0x497e('0x6')](function(_0x10ed23){_0x4c818e[_0x497e('0x18')]=_0x10ed23;return _0x4c818e;})[_0x497e('0x19')](function(_0x2b9822){throw _0x2b9822;});};exports[_0x497e('0x1a')]=function(){var _0x19008f={};var _0x128a9f=[];return db[_0x497e('0x1b')][_0x497e('0x1a')]()[_0x497e('0x6')](function(_0x1644e4){_0x19008f=_0x1644e4;var _0x4e7af6=Object[_0x497e('0x1c')](_0x19008f)['filter'](function(_0x36ed6b){return _[_0x497e('0x1d')](_0x36ed6b,_0x497e('0x1e'))?_0x36ed6b:undefined;});var _0x44852d=_0x4e7af6[_0x497e('0x1f')](function(_0x57adcc){return db[_0x497e('0x20')][_0x497e('0x21')]({'where':{'id':_0x57adcc[_0x497e('0x22')](0x3)},'raw':!![]});});return Promise[_0x497e('0x23')](_0x44852d);})[_0x497e('0x6')](function(_0x3c8cd5){for(var _0x1bd2d0=0x0;_0x1bd2d0<_0x3c8cd5[_0x497e('0x24')];_0x1bd2d0++){if(_0x3c8cd5[_0x1bd2d0]){var _0x51ae2a=_0x497e('0x1e')+_0x3c8cd5[_0x1bd2d0]['id'];_0x19008f[_0x51ae2a][_0x497e('0x25')]=_0x3c8cd5[_0x1bd2d0][_0x497e('0x26')];}}_0x128a9f=_[_0x497e('0x1f')](Object['keys'](_0x19008f),function(_0x8d5aef){return{'name':_0x8d5aef,'type':_0x19008f[_0x8d5aef][_0x497e('0x26')]};});return _0x128a9f;})['catch'](function(_0x5dcb26){throw _0x5dcb26;});}; \ No newline at end of file +var _0xf4cd=['describe','keys','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','default','where','filter','clause','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','buildContactsQuery','fields','getFilteredContacts','rows','CmContact'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xf4cd,0x1ad));var _0xdf4c=function(_0x388685,_0x3cb775){_0x388685=_0x388685-0x0;var _0x103b2f=_0xf4cd[_0x388685];return _0x103b2f;};'use strict';var _=require(_0xdf4c('0x0'));var sqlUtils=require(_0xdf4c('0x1'));var db=require(_0xdf4c('0x2'))['db'];exports[_0xdf4c('0x3')]=function(_0x8afd72,_0x32bfcb,_0x3b6f94,_0x52e1b3){var _0x2a46e0={'count':0x0,'rows':[]};var _0x36058e=sqlUtils[_0xdf4c('0x4')](_0x32bfcb,_0x8afd72);if(_0x36058e){return Promise[_0xdf4c('0x5')](_0x2a46e0);}var _0x2c30e2=sqlUtils['getContactsSubquery']();var _0x354b22={};var _0x181bff=![];var _0x474f3a=![];return Promise[_0xdf4c('0x5')]()[_0xdf4c('0x6')](function(){if(_0x8afd72[_0xdf4c('0x7')]){return sqlUtils[_0xdf4c('0x8')](_0x8afd72[_0xdf4c('0x7')],_0x52e1b3);}else{return sqlUtils[_0xdf4c('0x9')](_0x8afd72,_0x52e1b3);}})[_0xdf4c('0x6')](function(_0x34f870){_0x2c30e2['where'](_0x34f870[_0xdf4c('0xa')]);_0x2c30e2[_0xdf4c('0xb')](_0x34f870['fields']);_0x2c30e2[_0xdf4c('0xb')](_0x34f870[_0xdf4c('0xc')]);_0x2c30e2[_0xdf4c('0xb')](_0x34f870['user'][_0xdf4c('0xd')]);_0x354b22=_0x34f870['tags'];_0x474f3a=_0x34f870[_0xdf4c('0xe')][_0xdf4c('0xf')];return sqlUtils[_0xdf4c('0x10')](_0x32bfcb,_0x8afd72,_0x474f3a);})[_0xdf4c('0x6')](function(_0x454863){_0x2c30e2[_0xdf4c('0xb')](_0x454863);var _0x1c829d=_0x8afd72[_0xdf4c('0x7')]?_0x354b22[_0xdf4c('0x11')]:_0x8afd72[_0xdf4c('0x12')];_0x181bff=_0x1c829d?!![]:![];return sqlUtils[_0xdf4c('0x13')](_0x2c30e2,_0x1c829d);})[_0xdf4c('0x6')](function(_0x4e5777){_0x2a46e0[_0xdf4c('0x14')]=_0x4e5777;if(_0x2a46e0[_0xdf4c('0x14')]===0x0){return;}if(_0x8afd72[_0xdf4c('0x15')]){_0x474f3a=!![];}return sqlUtils[_0xdf4c('0x16')](_0x2c30e2,_0x8afd72[_0xdf4c('0x17')],_0x3b6f94,_0x181bff,_0x354b22[_0xdf4c('0xd')],_0x474f3a);})[_0xdf4c('0x6')](function(_0x47c7c6){if(!_0x47c7c6){return[];}return sqlUtils[_0xdf4c('0x18')](_0x47c7c6,_0x8afd72,_0x3b6f94);})[_0xdf4c('0x6')](function(_0x719665){_0x2a46e0[_0xdf4c('0x19')]=_0x719665;return _0x2a46e0;})['catch'](function(_0x322a4c){throw _0x322a4c;});};exports['describe']=function(){var _0x3b5ebc={};var _0x4197bb=[];return db[_0xdf4c('0x1a')][_0xdf4c('0x1b')]()[_0xdf4c('0x6')](function(_0x376dc4){_0x3b5ebc=_0x376dc4;var _0x137fdf=Object[_0xdf4c('0x1c')](_0x3b5ebc)['filter'](function(_0x44e388){return _['startsWith'](_0x44e388,_0xdf4c('0x1d'))?_0x44e388:undefined;});var _0xc19006=_0x137fdf[_0xdf4c('0x1e')](function(_0xef968d){return db[_0xdf4c('0x1f')][_0xdf4c('0x20')]({'where':{'id':_0xef968d[_0xdf4c('0x21')](0x3)},'raw':!![]});});return Promise[_0xdf4c('0x22')](_0xc19006);})[_0xdf4c('0x6')](function(_0x3ce6ad){for(var _0x337ea1=0x0;_0x337ea1<_0x3ce6ad[_0xdf4c('0x23')];_0x337ea1++){if(_0x3ce6ad[_0x337ea1]){var _0x3e4be5='cf_'+_0x3ce6ad[_0x337ea1]['id'];_0x3b5ebc[_0x3e4be5][_0xdf4c('0x24')]=_0x3ce6ad[_0x337ea1][_0xdf4c('0x25')];}}_0x4197bb=_['map'](Object[_0xdf4c('0x1c')](_0x3b5ebc),function(_0x299ab3){return{'name':_0x299ab3,'type':_0x3b5ebc[_0x299ab3][_0xdf4c('0x25')]};});return _0x4197bb;})['catch'](function(_0x5a0076){throw _0x5a0076;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index a3395d5..8439137 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 _0xb0d6=['mobile','fax','email','CompanyId','createdAt','deletedAt','includes','push','forEach','field','expr','getSelectedTags','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.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','castTo','buildExpression','type','default','text','value','start','Tag','tags','clause','ids','User','user','keys','map','some','compact','Contact','ListId','and','concat','\x20=\x20?','resolve','then','tag','filter','role','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','TagIds','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','agent','search','true','select','from','cm_contacts','where','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','phone'];(function(_0x2f3dd6,_0x3e1b3b){var _0x2541c8=function(_0x1446f2){while(--_0x1446f2){_0x2f3dd6['push'](_0x2f3dd6['shift']());}};_0x2541c8(++_0x3e1b3b);}(_0xb0d6,0x122));var _0x6b0d=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0xb0d6[_0x4a73f2];return _0x4190ee;};'use strict';var _=require(_0x6b0d('0x0'));var squel=require(_0x6b0d('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x6b0d('0x2'));var utils=require(_0x6b0d('0x3'));var db=require(_0x6b0d('0x4'))['db'];function skipContactsQuery(_0x39ad16,_0x32279b){var _0x5a3f5c=![];if(_0x39ad16['role']===_0x6b0d('0x5')&&!_0x32279b[_0x6b0d('0x6')]&&!_0x32279b['ListId']&&_0x32279b['autocomplete']!==_0x6b0d('0x7')){_0x5a3f5c=!![];}return _0x5a3f5c;}function getContactsSubquery(){return squel[_0x6b0d('0x8')]()[_0x6b0d('0x9')](_0x6b0d('0xa'),'c')[_0x6b0d('0xb')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x13a2bf,_0x2d52a1){var _0x415774=_0x2d52a1?'c':_0x6b0d('0xc');_0x13a2bf[_0x6b0d('0xd')](_0x6b0d('0xe'),'uc',_0x6b0d('0xf')+_0x415774+'.id')[_0x6b0d('0xd')]('cm_contact_has_tags','ct',_0x6b0d('0x10')+_0x415774+_0x6b0d('0x11'))['left_join'](_0x6b0d('0x12'),'t','t.id\x20=\x20ct.TagId');return _0x13a2bf;}function addFieldsToQuery(_0x12ef76,_0x20d235,_0x171996,_0x3e912c,_0x2984fe){var _0x299eb1=_0x2984fe?'c':'subqry';if(!_0x20d235){_0x20d235=['id',_0x6b0d('0x13'),_0x6b0d('0x14'),_0x6b0d('0x15'),_0x6b0d('0x16'),_0x6b0d('0x17'),_0x6b0d('0x18'),'ListId',_0x6b0d('0x19'),_0x6b0d('0x1a'),'updatedAt',_0x6b0d('0x1b'),'TagIds'];}else if(!_0x20d235[_0x6b0d('0x1c')]('id')){_0x20d235[_0x6b0d('0x1d')]('id');}var _0x114023=_0x171996&&_0x2984fe||!_0x171996&&!_0x2984fe;if(_0x3e912c){_0x114023=_0x3e912c&&_0x2984fe||!_0x3e912c&&!_0x2984fe;}_0x20d235[_0x6b0d('0x1e')](function(_0x14c916){if(_0x14c916==='TagIds'){if(_0x114023){_0x12ef76[_0x6b0d('0x1f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x14c916);}else if(_0x171996||_0x3e912c){_0x12ef76[_0x6b0d('0x1f')](_0x299eb1+'.'+_0x14c916);}}else{_0x12ef76[_0x6b0d('0x1f')](_0x299eb1+'.'+_0x14c916);}});return _0x12ef76;}function getSqlClauses(){var _0x1254c6={'default':squel[_0x6b0d('0x20')](),'fields':squel[_0x6b0d('0x20')](),'filter':squel[_0x6b0d('0x20')](),'tags':{'clause':squel[_0x6b0d('0x20')](),'ids':null},'user':{'clause':squel[_0x6b0d('0x20')](),'skip':![]}};return _0x1254c6;}function parseTagParameter(_0x38edf5){var _0x4e04d5=squel[_0x6b0d('0x20')]();if(_0x38edf5){var _0x5f2dcc=utils[_0x6b0d('0x21')](_0x38edf5);_0x5f2dcc[_0x6b0d('0x1e')](function(_0x48c489){_0x4e04d5['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x48c489+',%');});}return _0x4e04d5;}function parseSearchFilter(_0x4dd190){var _0x372be2=squel[_0x6b0d('0x20')]();if(_0x4dd190){var _0x1f7642=_0x4dd190[_0x6b0d('0x22')]('\x5c','\x5c\x5c')[_0x6b0d('0x22')](/'/g,'\x27\x27');if(_0x1f7642[_0x6b0d('0x23')]('\x20')[_0x6b0d('0x24')]>0x1){_0x372be2['or'](_0x6b0d('0x25'),qs[_0x6b0d('0x26')](_0x1f7642,!![]),null);}else{if(qs[_0x6b0d('0x27')](_0x1f7642)){_0x372be2['or']('c.id\x20LIKE\x20?',_0x1f7642+'%');_0x372be2['or'](_0x6b0d('0x28'),_0x1f7642+'%');_0x372be2['or'](_0x6b0d('0x29'),_0x1f7642+'%');_0x372be2['or']('c.fax\x20LIKE\x20?',_0x1f7642+'%');}else if(qs['isEmail'](_0x1f7642)){_0x372be2['or'](_0x6b0d('0x2a'),_0x1f7642+'%');}else{_0x372be2['or']('c.firstName\x20LIKE\x20?','%'+_0x1f7642+'%');_0x372be2['or']('c.lastName\x20LIKE\x20?','%'+_0x1f7642+'%');_0x372be2['or'](_0x6b0d('0x2a'),'%'+_0x1f7642+'%');}}}return _0x372be2;}function parseAdvancedSearchFilter(_0x23ab1a,_0x519e3b){var _0x33c57c=getSqlClauses();var _0x466eb7=as['parseSearch'](_0x23ab1a);var _0x2678d3=_0x466eb7[_0x6b0d('0x2b')];for(var _0x1756c0=0x0;_0x1756c0<_0x466eb7[_0x6b0d('0x2c')][_0x6b0d('0x24')];_0x1756c0++){var _0x3efbc5=_0x466eb7[_0x6b0d('0x2c')][_0x1756c0];var _0x526ab5='c';var _0x5a241f=_[_0x6b0d('0x2d')](_0x519e3b,[_0x6b0d('0x2e'),_0x3efbc5['field']]);if(_0x5a241f){if(_0x3efbc5[_0x6b0d('0x1f')]===_0x6b0d('0x2f')||_0x5a241f[_0x6b0d('0x30')]==='datetime'){_0x3efbc5[_0x6b0d('0x31')]='DATE';}var _0x38b3f4=as[_0x6b0d('0x32')](_0x526ab5,_0x5a241f[_0x6b0d('0x33')],_0x3efbc5);_0x33c57c[_0x6b0d('0x34')][_0x2678d3](_0x38b3f4[_0x6b0d('0x35')],_0x38b3f4[_0x6b0d('0x36')][_0x6b0d('0x37')],_0x38b3f4[_0x6b0d('0x36')]['end']);}else{if(_0x3efbc5['field']===_0x6b0d('0x38')){var _0x2af4aa=_0x3efbc5[_0x6b0d('0x36')][_0x6b0d('0x23')](',')['map'](function(_0x5530fd){return Number(_0x5530fd);});var _0x5154b2=parseTagParameter(_0x2af4aa);_0x33c57c[_0x6b0d('0x39')][_0x6b0d('0x3a')]['and'](_0x5154b2);_0x33c57c[_0x6b0d('0x39')][_0x6b0d('0x3b')]=_0x2af4aa;}else if(_0x3efbc5[_0x6b0d('0x1f')]===_0x6b0d('0x3c')){_0x33c57c[_0x6b0d('0x3d')][_0x6b0d('0x3a')]['and']('uc.UserId\x20=\x20?',_0x3efbc5['value']);_0x33c57c[_0x6b0d('0x3d')]['skip']=!![];}}}return _0x33c57c;}function parseModelFields(_0x1e1f33,_0x2bcff4){var _0x54aee2=squel[_0x6b0d('0x20')]();var _0x193cce=_(_0x1e1f33)[_0x6b0d('0x3e')]()[_0x6b0d('0x3f')](function(_0x2b18d7){return _[_0x6b0d('0x40')](_0x2bcff4,[_0x6b0d('0x2e'),_0x2b18d7])?_0x2b18d7:undefined;})[_0x6b0d('0x41')]()[_0x6b0d('0x36')]();if(_0x1e1f33[_0x6b0d('0x42')]){_0x193cce['push'](_0x6b0d('0x42'));}if(_0x1e1f33['User']){_0x193cce[_0x6b0d('0x1d')](_0x6b0d('0x3c'));}if(_0x193cce[_0x6b0d('0x24')]>0x0){_0x193cce[_0x6b0d('0x1e')](function(_0x3220ba){if(_0x3220ba===_0x6b0d('0x43')){_0x54aee2[_0x6b0d('0x44')]('c.ListId\x20IN\x20?',[][_0x6b0d('0x45')](_0x1e1f33[_0x3220ba]));}else if(_0x3220ba===_0x6b0d('0x42')){var _0x926be2='%'+_0x1e1f33[_0x3220ba]+'%';_0x54aee2[_0x6b0d('0x44')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x926be2);}else if(_0x3220ba===_0x6b0d('0x3c')){_0x54aee2[_0x6b0d('0x44')]('uc.UserId\x20=\x20?',_0x1e1f33[_0x3220ba]);}else{_0x54aee2[_0x6b0d('0x44')]('c.'+_0x3220ba+_0x6b0d('0x46'),_0x1e1f33[_0x3220ba]);}});}return _0x54aee2;}function parseQueryParameters(_0xe5ad98,_0x4ee22e){var _0x5ec677=getSqlClauses();return Promise[_0x6b0d('0x47')]()[_0x6b0d('0x48')](function(){return parseModelFields(_0xe5ad98,_0x4ee22e);})[_0x6b0d('0x48')](function(_0x3e7954){_0x5ec677['fields'][_0x6b0d('0x44')](_0x3e7954);return parseTagParameter(_0xe5ad98[_0x6b0d('0x49')]);})['then'](function(_0xb601b7){_0x5ec677['tags']['clause'][_0x6b0d('0x44')](_0xb601b7);return parseSearchFilter(_0xe5ad98[_0x6b0d('0x4a')]);})[_0x6b0d('0x48')](function(_0x1ebc73){_0x5ec677[_0x6b0d('0x4a')]=_0x1ebc73;return _0x5ec677;});}function checkListsRestrictions(_0x214348,_0x37c9cc,_0x4df77b){var _0x129bc4=squel[_0x6b0d('0x20')]();return Promise['resolve']()['then'](function(){if(_0x37c9cc['search']&&_0x214348[_0x6b0d('0x4b')]===_0x6b0d('0x5')&&!_0x4df77b){return _0x214348[_0x6b0d('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0x6b0d('0x48')](function(_0x22dcf1){if(_0x22dcf1){if(_0x22dcf1['length']===0x0){_0x129bc4['and'](_0x6b0d('0x4d'));}else{_0x129bc4['and'](_0x6b0d('0x4e'),_[_0x6b0d('0x3f')](_0x22dcf1,'id'));}}})['then'](function(){return _0x129bc4;});}function buildContactsQuery(_0x1c44b6,_0x46d1cc,_0x3e8f18,_0x6358ad,_0x2d8c25,_0x2aef95){if(_0x46d1cc){_0x46d1cc=_0x3e8f18[_0x6b0d('0x4f')];}_0x1c44b6=addFieldsToQuery(_0x1c44b6,_0x46d1cc,_0x6358ad,_0x2aef95,!![]);var _0x122e5b=squel[_0x6b0d('0x8')]();_0x122e5b=addFieldsToQuery(_0x122e5b,_0x46d1cc,_0x6358ad,_0x2aef95,![]);if(_0x6358ad||_0x2aef95){_0x1c44b6=applyJoinClauses(_0x1c44b6,!![]);_0x1c44b6[_0x6b0d('0x50')](_0x6b0d('0x51'));if(_0x3e8f18[_0x6b0d('0x52')]){_0x122e5b[_0x6b0d('0x52')](_0x3e8f18[_0x6b0d('0x52')]);}if(_0x3e8f18[_0x6b0d('0x53')]){_0x122e5b[_0x6b0d('0x53')](_0x3e8f18[_0x6b0d('0x53')]);}}else{_0x122e5b=applyJoinClauses(_0x122e5b,![]);_0x122e5b['group'](_0x6b0d('0x54'));if(_0x3e8f18[_0x6b0d('0x52')]){_0x1c44b6[_0x6b0d('0x52')](_0x3e8f18['limit']);}if(_0x3e8f18[_0x6b0d('0x53')]){_0x1c44b6[_0x6b0d('0x53')](_0x3e8f18['offset']);}}_0x122e5b[_0x6b0d('0x55')](_0x2d8c25);if(_0x3e8f18[_0x6b0d('0x56')]){_0x3e8f18[_0x6b0d('0x56')][_0x6b0d('0x1e')](function(_0x1866e4){_0x1c44b6[_0x6b0d('0x56')]('c.'+_0x1866e4[0x0],_0x1866e4[0x1]===_0x6b0d('0x57')?![]:!![]);_0x122e5b[_0x6b0d('0x56')](_0x6b0d('0x58')+_0x1866e4[0x0],_0x1866e4[0x1]==='DESC'?![]:!![]);});}_0x122e5b[_0x6b0d('0x9')](_0x1c44b6,'subqry');return _0x122e5b;}function getFilteredContacts(_0x2f098d){var _0xdcd02=[];return db[_0x6b0d('0x38')]['findAll']({'attributes':['id',_0x6b0d('0x2e'),_0x6b0d('0x59')],'raw':!![]})[_0x6b0d('0x48')](function(_0x57f63e){_0xdcd02=_[_0x6b0d('0x5a')](_0x57f63e,'id');var _0x1c89e4={'type':db[_0x6b0d('0x5b')][_0x6b0d('0x5c')][_0x6b0d('0x5d')],'model':db[_0x6b0d('0x5e')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6b0d('0x5f')][_0x6b0d('0x60')](_0x2f098d[_0x6b0d('0x61')](),_0x1c89e4);})[_0x6b0d('0x48')](function(_0x33831a){_0x33831a['forEach'](function(_0x2feb65){if(_0x2feb65['TagIds']){_0x2feb65[_0x6b0d('0x62')]=[];_0x2feb65[_0x6b0d('0x63')]['split'](',')['forEach'](function(_0x3d1222){_0x2feb65[_0x6b0d('0x62')]['push'](_0xdcd02[_0x3d1222]);});}delete _0x2feb65[_0x6b0d('0x63')];});return _0x33831a;});}function countFilteredContacts(_0x103173,_0x3535db){var _0x1eca13=_0x103173[_0x6b0d('0x64')]();_0x1eca13[_0x6b0d('0x1f')](_0x6b0d('0x65'));_0x1eca13=applyJoinClauses(_0x1eca13,!![]);_0x103173['group'](_0x6b0d('0x51'));var _0x6f014d=utils[_0x6b0d('0x21')](_0x3535db);if(!_[_0x6b0d('0x66')](_0x6f014d)){_0x1eca13[_0x6b0d('0xb')](_0x6b0d('0x67'),_0x6f014d);}var _0x3b82dc={'type':db['Sequelize'][_0x6b0d('0x5c')]['SELECT'],'raw':!![]};return db[_0x6b0d('0x5f')]['query'](_0x1eca13[_0x6b0d('0x61')](),_0x3b82dc)[_0x6b0d('0x48')](function(_0x45f388){return _0x45f388[0x0]['COUNT(*)'];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x6ae8=['role','c.ListId\x20IS\x20NULL','attributes','limit','offset','group','subqry.id','having','order','subqry.','findAll','color','Sequelize','SELECT','CmContact','sequelize','query','toString','Tags','clone','c.id','isEmpty','t.id\x20IN\x20?','COUNT(*)','lodash','../parsers/advancedSearch','../parsers/qs','../../mysqldb','agent','search','ListId','autocomplete','select','from','where','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','subqry','lastName','phone','fax','createdAt','updatedAt','deletedAt','push','forEach','TagIds','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','dateOfBirth','datetime','buildExpression','type','text','value','start','end','split','tags','clause','and','user','uc.UserId\x20=\x20?','keys','map','some','name','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','fields','tag','filter'];(function(_0x2a396a,_0x5de621){var _0x3b4966=function(_0x55ad0e){while(--_0x55ad0e){_0x2a396a['push'](_0x2a396a['shift']());}};_0x3b4966(++_0x5de621);}(_0x6ae8,0x13e));var _0x86ae=function(_0x12dc45,_0x388e68){_0x12dc45=_0x12dc45-0x0;var _0x3691e4=_0x6ae8[_0x12dc45];return _0x3691e4;};'use strict';var _=require(_0x86ae('0x0'));var squel=require('squel');var as=require(_0x86ae('0x1'));var qs=require(_0x86ae('0x2'));var utils=require('../interaction/utils');var db=require(_0x86ae('0x3'))['db'];function skipContactsQuery(_0x1f2943,_0x3652ae){var _0x11a353=![];if(_0x1f2943['role']===_0x86ae('0x4')&&!_0x3652ae[_0x86ae('0x5')]&&!_0x3652ae[_0x86ae('0x6')]&&_0x3652ae[_0x86ae('0x7')]!=='true'){_0x11a353=!![];}return _0x11a353;}function getContactsSubquery(){return squel[_0x86ae('0x8')]()[_0x86ae('0x9')]('cm_contacts','c')[_0x86ae('0xa')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x2542ef,_0x4377f8){var _0x538fdb=_0x4377f8?'c':'subqry';_0x2542ef[_0x86ae('0xb')](_0x86ae('0xc'),'uc',_0x86ae('0xd')+_0x538fdb+_0x86ae('0xe'))[_0x86ae('0xb')]('cm_contact_has_tags','ct',_0x86ae('0xf')+_0x538fdb+_0x86ae('0xe'))[_0x86ae('0xb')](_0x86ae('0x10'),'t',_0x86ae('0x11'));return _0x2542ef;}function addFieldsToQuery(_0x48ffb8,_0x47587b,_0x20527a,_0x270137,_0x58e0c8){var _0x5a6026=_0x58e0c8?'c':_0x86ae('0x12');if(!_0x47587b){_0x47587b=['id','firstName',_0x86ae('0x13'),_0x86ae('0x14'),'mobile',_0x86ae('0x15'),'email','ListId','CompanyId',_0x86ae('0x16'),_0x86ae('0x17'),_0x86ae('0x18'),'TagIds'];}else if(!_0x47587b['includes']('id')){_0x47587b[_0x86ae('0x19')]('id');}var _0x22090c=_0x20527a&&_0x58e0c8||!_0x20527a&&!_0x58e0c8;if(_0x270137){_0x22090c=_0x270137&&_0x58e0c8||!_0x270137&&!_0x58e0c8;}_0x47587b[_0x86ae('0x1a')](function(_0x3e98cb){if(_0x3e98cb===_0x86ae('0x1b')){if(_0x22090c){_0x48ffb8[_0x86ae('0x1c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3e98cb);}else if(_0x20527a||_0x270137){_0x48ffb8[_0x86ae('0x1c')](_0x5a6026+'.'+_0x3e98cb);}}else{_0x48ffb8[_0x86ae('0x1c')](_0x5a6026+'.'+_0x3e98cb);}});return _0x48ffb8;}function getSqlClauses(){var _0x22a1a6={'default':squel[_0x86ae('0x1d')](),'fields':squel[_0x86ae('0x1d')](),'filter':squel[_0x86ae('0x1d')](),'tags':{'clause':squel[_0x86ae('0x1d')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x22a1a6;}function parseTagParameter(_0x443d5c){var _0x32ed95=squel[_0x86ae('0x1d')]();if(_0x443d5c){var _0x44752d=utils[_0x86ae('0x1e')](_0x443d5c);_0x44752d['forEach'](function(_0x19910a){_0x32ed95['or'](_0x86ae('0x1f'),'%,'+_0x19910a+',%');});}return _0x32ed95;}function parseSearchFilter(_0x1b1620){var _0x50544b=squel[_0x86ae('0x1d')]();if(_0x1b1620){var _0x5b9425=_0x1b1620['replace']('\x5c','\x5c\x5c')[_0x86ae('0x20')](/'/g,'\x27\x27');if(_0x5b9425['split']('\x20')['length']>0x1){_0x50544b['or'](_0x86ae('0x21'),qs['getFullTextValue'](_0x5b9425,!![]),null);}else{if(qs[_0x86ae('0x22')](_0x5b9425)){_0x50544b['or'](_0x86ae('0x23'),_0x5b9425+'%');_0x50544b['or']('c.phone\x20LIKE\x20?',_0x5b9425+'%');_0x50544b['or'](_0x86ae('0x24'),_0x5b9425+'%');_0x50544b['or']('c.fax\x20LIKE\x20?',_0x5b9425+'%');}else if(qs['isEmail'](_0x5b9425)){_0x50544b['or']('c.email\x20LIKE\x20?',_0x5b9425+'%');}else{_0x50544b['or'](_0x86ae('0x25'),'%'+_0x5b9425+'%');_0x50544b['or'](_0x86ae('0x26'),'%'+_0x5b9425+'%');_0x50544b['or'](_0x86ae('0x27'),'%'+_0x5b9425+'%');}}}return _0x50544b;}function parseAdvancedSearchFilter(_0x5a71c1,_0x317a23){var _0x50f495=getSqlClauses();var _0x2bcd29=as[_0x86ae('0x28')](_0x5a71c1);var _0x501a13=_0x2bcd29[_0x86ae('0x29')];for(var _0x2a175a=0x0;_0x2a175a<_0x2bcd29[_0x86ae('0x2a')][_0x86ae('0x2b')];_0x2a175a++){var _0x1dc65c=_0x2bcd29['conditions'][_0x2a175a];var _0x1ac44d='c';var _0x5ecce9=_['find'](_0x317a23,['name',_0x1dc65c[_0x86ae('0x1c')]]);if(_0x5ecce9){if(_0x1dc65c[_0x86ae('0x1c')]===_0x86ae('0x2c')||_0x5ecce9['fieldType']===_0x86ae('0x2d')){_0x1dc65c['castTo']='DATE';}var _0x3ad7c9=as[_0x86ae('0x2e')](_0x1ac44d,_0x5ecce9[_0x86ae('0x2f')],_0x1dc65c);_0x50f495['default'][_0x501a13](_0x3ad7c9[_0x86ae('0x30')],_0x3ad7c9[_0x86ae('0x31')][_0x86ae('0x32')],_0x3ad7c9[_0x86ae('0x31')][_0x86ae('0x33')]);}else{if(_0x1dc65c[_0x86ae('0x1c')]==='Tag'){var _0xe952c=_0x1dc65c['value'][_0x86ae('0x34')](',')['map'](function(_0x32be64){return Number(_0x32be64);});var _0x5769f2=parseTagParameter(_0xe952c);_0x50f495[_0x86ae('0x35')][_0x86ae('0x36')][_0x86ae('0x37')](_0x5769f2);_0x50f495['tags']['ids']=_0xe952c;}else if(_0x1dc65c[_0x86ae('0x1c')]==='User'){_0x50f495[_0x86ae('0x38')][_0x86ae('0x36')][_0x86ae('0x37')](_0x86ae('0x39'),_0x1dc65c[_0x86ae('0x31')]);_0x50f495[_0x86ae('0x38')]['skip']=!![];}}}return _0x50f495;}function parseModelFields(_0x178f40,_0x1ffd3a){var _0x27ada8=squel[_0x86ae('0x1d')]();var _0x567485=_(_0x178f40)[_0x86ae('0x3a')]()[_0x86ae('0x3b')](function(_0x2a9089){return _[_0x86ae('0x3c')](_0x1ffd3a,[_0x86ae('0x3d'),_0x2a9089])?_0x2a9089:undefined;})[_0x86ae('0x3e')]()[_0x86ae('0x31')]();if(_0x178f40[_0x86ae('0x3f')]){_0x567485[_0x86ae('0x19')](_0x86ae('0x3f'));}if(_0x178f40[_0x86ae('0x40')]){_0x567485[_0x86ae('0x19')]('User');}if(_0x567485['length']>0x0){_0x567485['forEach'](function(_0x170878){if(_0x170878===_0x86ae('0x6')){_0x27ada8[_0x86ae('0x37')](_0x86ae('0x41'),[][_0x86ae('0x42')](_0x178f40[_0x170878]));}else if(_0x170878===_0x86ae('0x3f')){var _0x189ff3='%'+_0x178f40[_0x170878]+'%';_0x27ada8['and'](_0x86ae('0x43'),_0x189ff3);}else if(_0x170878===_0x86ae('0x40')){_0x27ada8[_0x86ae('0x37')](_0x86ae('0x39'),_0x178f40[_0x170878]);}else{_0x27ada8[_0x86ae('0x37')]('c.'+_0x170878+_0x86ae('0x44'),_0x178f40[_0x170878]);}});}return _0x27ada8;}function parseQueryParameters(_0x331c54,_0x263ff6){var _0x53af63=getSqlClauses();return Promise[_0x86ae('0x45')]()[_0x86ae('0x46')](function(){return parseModelFields(_0x331c54,_0x263ff6);})['then'](function(_0x3bf327){_0x53af63[_0x86ae('0x47')][_0x86ae('0x37')](_0x3bf327);return parseTagParameter(_0x331c54[_0x86ae('0x48')]);})[_0x86ae('0x46')](function(_0x439bf2){_0x53af63[_0x86ae('0x35')]['clause']['and'](_0x439bf2);return parseSearchFilter(_0x331c54[_0x86ae('0x49')]);})[_0x86ae('0x46')](function(_0x2ddaf2){_0x53af63[_0x86ae('0x49')]=_0x2ddaf2;return _0x53af63;});}function checkListsRestrictions(_0x3852e2,_0x3fda6c,_0x39dc35){var _0x4c00bb=squel['expr']();return Promise[_0x86ae('0x45')]()['then'](function(){if(_0x3fda6c[_0x86ae('0x5')]&&_0x3852e2[_0x86ae('0x4a')]===_0x86ae('0x4')&&!_0x39dc35){return _0x3852e2['getLists']({'attributes':['id'],'raw':!![]});}})[_0x86ae('0x46')](function(_0x90767c){if(_0x90767c){if(_0x90767c[_0x86ae('0x2b')]===0x0){_0x4c00bb[_0x86ae('0x37')](_0x86ae('0x4b'));}else{_0x4c00bb[_0x86ae('0x37')](_0x86ae('0x41'),_[_0x86ae('0x3b')](_0x90767c,'id'));}}})['then'](function(){return _0x4c00bb;});}function buildContactsQuery(_0x33f4eb,_0x2658eb,_0x48fa03,_0x205be4,_0x1cf3c2,_0x11cb08){if(_0x2658eb){_0x2658eb=_0x48fa03[_0x86ae('0x4c')];}_0x33f4eb=addFieldsToQuery(_0x33f4eb,_0x2658eb,_0x205be4,_0x11cb08,!![]);var _0x178f4b=squel[_0x86ae('0x8')]();_0x178f4b=addFieldsToQuery(_0x178f4b,_0x2658eb,_0x205be4,_0x11cb08,![]);if(_0x205be4||_0x11cb08){_0x33f4eb=applyJoinClauses(_0x33f4eb,!![]);_0x33f4eb['group']('c.id');if(_0x48fa03['limit']){_0x178f4b[_0x86ae('0x4d')](_0x48fa03[_0x86ae('0x4d')]);}if(_0x48fa03[_0x86ae('0x4e')]){_0x178f4b[_0x86ae('0x4e')](_0x48fa03[_0x86ae('0x4e')]);}}else{_0x178f4b=applyJoinClauses(_0x178f4b,![]);_0x178f4b[_0x86ae('0x4f')](_0x86ae('0x50'));if(_0x48fa03[_0x86ae('0x4d')]){_0x33f4eb[_0x86ae('0x4d')](_0x48fa03[_0x86ae('0x4d')]);}if(_0x48fa03[_0x86ae('0x4e')]){_0x33f4eb[_0x86ae('0x4e')](_0x48fa03[_0x86ae('0x4e')]);}}_0x178f4b[_0x86ae('0x51')](_0x1cf3c2);if(_0x48fa03[_0x86ae('0x52')]){_0x48fa03[_0x86ae('0x52')][_0x86ae('0x1a')](function(_0xc81670){_0x33f4eb[_0x86ae('0x52')]('c.'+_0xc81670[0x0],_0xc81670[0x1]==='DESC'?![]:!![]);_0x178f4b[_0x86ae('0x52')](_0x86ae('0x53')+_0xc81670[0x0],_0xc81670[0x1]==='DESC'?![]:!![]);});}_0x178f4b['from'](_0x33f4eb,_0x86ae('0x12'));return _0x178f4b;}function getFilteredContacts(_0x574d79){var _0x3819bb=[];return db['Tag'][_0x86ae('0x54')]({'attributes':['id',_0x86ae('0x3d'),_0x86ae('0x55')],'raw':!![]})[_0x86ae('0x46')](function(_0x252a2c){_0x3819bb=_['keyBy'](_0x252a2c,'id');var _0x284464={'type':db[_0x86ae('0x56')]['QueryTypes'][_0x86ae('0x57')],'model':db[_0x86ae('0x58')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x86ae('0x59')][_0x86ae('0x5a')](_0x574d79[_0x86ae('0x5b')](),_0x284464);})[_0x86ae('0x46')](function(_0x49fb5c){_0x49fb5c[_0x86ae('0x1a')](function(_0x482ce3){if(_0x482ce3[_0x86ae('0x1b')]){_0x482ce3[_0x86ae('0x5c')]=[];_0x482ce3['TagIds']['split'](',')['forEach'](function(_0x1ff589){_0x482ce3[_0x86ae('0x5c')][_0x86ae('0x19')](_0x3819bb[_0x1ff589]);});}delete _0x482ce3[_0x86ae('0x1b')];});return _0x49fb5c;});}function countFilteredContacts(_0x4e9b63,_0x54da00){var _0x2c6f64=_0x4e9b63[_0x86ae('0x5d')]();_0x2c6f64[_0x86ae('0x1c')]('COUNT(*)');_0x2c6f64=applyJoinClauses(_0x2c6f64,!![]);_0x4e9b63[_0x86ae('0x4f')](_0x86ae('0x5e'));var _0x46d1ce=utils[_0x86ae('0x1e')](_0x54da00);if(!_[_0x86ae('0x5f')](_0x46d1ce)){_0x2c6f64[_0x86ae('0xa')](_0x86ae('0x60'),_0x46d1ce);}var _0xdab7cb={'type':db[_0x86ae('0x56')]['QueryTypes'][_0x86ae('0x57')],'raw':!![]};return db[_0x86ae('0x59')][_0x86ae('0x5a')](_0x2c6f64[_0x86ae('0x5b')](),_0xdab7cb)[_0x86ae('0x46')](function(_0x106f21){return _0x106f21[0x0][_0x86ae('0x61')];});}module['exports']={'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 4b6bdc4..8373b33 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 _0xbc14=['aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','write','end','final','close','unlink','decryptFile','data','update','secret','utf8','base64','decryptString','createDecipher','crypto','../../config/environment','../../config/logger','app','session'];(function(_0x482d77,_0x3f9c18){var _0x5828e9=function(_0x2a0715){while(--_0x2a0715){_0x482d77['push'](_0x482d77['shift']());}};_0x5828e9(++_0x3f9c18);}(_0xbc14,0x1e5));var _0x4bc1=function(_0xf458ea,_0x5767e5){_0xf458ea=_0xf458ea-0x0;var _0x20f763=_0xbc14[_0xf458ea];return _0x20f763;};'use strict';var crypto=require(_0x4bc1('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0x4bc1('0x1'));var logger=require(_0x4bc1('0x2'))(_0x4bc1('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x4bc1('0x4')],'algorithm':_0x4bc1('0x5')};const fileOptions={'algorithm':_0x4bc1('0x6')};if(config[_0x4bc1('0x7')]&&config['encrypt'][_0x4bc1('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4bc1('0x7')][_0x4bc1('0x8')]);if(isSupported){fileOptions[_0x4bc1('0x8')]=config['encrypt'][_0x4bc1('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4bc1('0x9')](',\x20');logger[_0x4bc1('0xa')](config['encrypt'][_0x4bc1('0x8')],_0x4bc1('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x3740de){return AES_SUPPORTED_RX[_0x4bc1('0xc')](_0x3740de);}function getSupportedCiphers(){return crypto[_0x4bc1('0xd')]()[_0x4bc1('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x4c41c3){return getSupportedCiphers()[_0x4bc1('0xf')](_0x4c41c3)>-0x1;}function combineOptions(_0x22a2b5){var _0x384c0d={};for(var _0x39baaa in fileOptions){if(fileOptions[_0x4bc1('0x10')](_0x39baaa)){_0x384c0d[_0x39baaa]=fileOptions[_0x39baaa];}}if(_0x22a2b5){for(var _0x1f9465 in _0x22a2b5){if(_0x22a2b5[_0x4bc1('0x10')](_0x1f9465)){_0x384c0d[_0x1f9465]=_0x22a2b5[_0x1f9465];}}}return _0x384c0d;}exports[_0x4bc1('0x11')]=function(_0x333c4d,_0x92304e,_0x39dba0,_0x47dfe5){return new BPromise(function(_0x28e7fe,_0xbffe2c){_0x47dfe5=combineOptions(_0x47dfe5);var _0x38c266=new Buffer(_0x39dba0);var _0x461bc7=fs[_0x4bc1('0x12')](_0x333c4d);var _0x31fb83=fs[_0x4bc1('0x13')](_0x92304e);var _0x108b0f=crypto[_0x4bc1('0x14')](_0x47dfe5[_0x4bc1('0x8')],_0x38c266);_0x461bc7['on']('data',function(_0x295095){var _0x30c6e1=new Buffer(_0x108b0f['update'](_0x295095),_0x4bc1('0x15'));_0x31fb83[_0x4bc1('0x16')](_0x30c6e1);});_0x461bc7['on'](_0x4bc1('0x17'),function(){try{var _0x22305d=new Buffer(_0x108b0f[_0x4bc1('0x18')](_0x4bc1('0x15')),'binary');_0x31fb83[_0x4bc1('0x16')](_0x22305d);_0x31fb83['end']();_0x31fb83['on'](_0x4bc1('0x19'),function(){return _0x28e7fe(_0x92304e);});}catch(_0x4ad5d2){fs[_0x4bc1('0x1a')](_0x92304e);return _0xbffe2c(_0x4ad5d2);}});});};exports[_0x4bc1('0x1b')]=function(_0x4b5d3a,_0x585de8,_0xd985cb,_0x41396f){return new BPromise(function(_0x38908d,_0x373367){_0x41396f=combineOptions(_0x41396f);var _0x5ca3c9=new Buffer(_0xd985cb);var _0x39ecbf=fs['createReadStream'](_0x4b5d3a);var _0x104e3f=fs['createWriteStream'](_0x585de8);var _0x44527b=crypto['createDecipher'](_0x41396f[_0x4bc1('0x8')],_0x5ca3c9);_0x39ecbf['on'](_0x4bc1('0x1c'),function(_0x4d86e8){var _0x9656c3=new Buffer(_0x44527b[_0x4bc1('0x1d')](_0x4d86e8),_0x4bc1('0x15'));_0x104e3f[_0x4bc1('0x16')](_0x9656c3);});_0x39ecbf['on'](_0x4bc1('0x17'),function(){try{var _0x1c56dd=new Buffer(_0x44527b[_0x4bc1('0x18')](_0x4bc1('0x15')),_0x4bc1('0x15'));_0x104e3f[_0x4bc1('0x16')](_0x1c56dd);_0x104e3f[_0x4bc1('0x17')]();_0x104e3f['on'](_0x4bc1('0x19'),function(){return _0x38908d(_0x585de8);});}catch(_0x1dc6c6){fs['unlink'](_0x585de8);return _0x373367(_0x1dc6c6);}});});};exports['encryptString']=function(_0x4735b6,_0x5412a1,_0xa719ef){var _0x104b05=_0xa719ef||stringOptions['algorithm'];var _0x51caa4=_0x5412a1||stringOptions[_0x4bc1('0x1e')];var _0x1bff1f=crypto[_0x4bc1('0x14')](_0x104b05,_0x51caa4);var _0x54b52b=_0x1bff1f[_0x4bc1('0x1d')](_0x4735b6,_0x4bc1('0x1f'),_0x4bc1('0x20'));_0x54b52b+=_0x1bff1f[_0x4bc1('0x18')]('base64');return _0x54b52b;};exports[_0x4bc1('0x21')]=function(_0x41023b,_0x417d71,_0x15fa79){var _0x3ee1a9=_0x15fa79||stringOptions['algorithm'];var _0x432fac=_0x417d71||stringOptions[_0x4bc1('0x1e')];var _0x385e3f=crypto[_0x4bc1('0x22')](_0x3ee1a9,_0x432fac);var _0x1099e1=_0x385e3f[_0x4bc1('0x1d')](_0x41023b,_0x4bc1('0x20'),_0x4bc1('0x1f'));_0x1099e1+=_0x385e3f[_0x4bc1('0x18')](_0x4bc1('0x1f'));return _0x1099e1;}; \ No newline at end of file +var _0x11af=['binary','write','end','close','unlink','decryptFile','createDecipher','update','final','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','encrypt','algorithm','join','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data'];(function(_0x504eef,_0x155f27){var _0x2116f5=function(_0x816c4f){while(--_0x816c4f){_0x504eef['push'](_0x504eef['shift']());}};_0x2116f5(++_0x155f27);}(_0x11af,0xdb));var _0xf11a=function(_0x36ec2f,_0x91178f){_0x36ec2f=_0x36ec2f-0x0;var _0x4f454b=_0x11af[_0x36ec2f];return _0x4f454b;};'use strict';var crypto=require(_0xf11a('0x0'));var fs=require('fs');var BPromise=require(_0xf11a('0x1'));var _=require(_0xf11a('0x2'));var config=require(_0xf11a('0x3'));var logger=require(_0xf11a('0x4'))(_0xf11a('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xf11a('0x6')][_0xf11a('0x7')],'algorithm':_0xf11a('0x8')};const fileOptions={'algorithm':'aes192'};if(config[_0xf11a('0x9')]&&config[_0xf11a('0x9')][_0xf11a('0xa')]){var isSupported=isAlgorithmSupported(config[_0xf11a('0x9')][_0xf11a('0xa')]);if(isSupported){fileOptions[_0xf11a('0xa')]=config[_0xf11a('0x9')][_0xf11a('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xf11a('0xb')](',\x20');logger['error'](config['encrypt'][_0xf11a('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x55c6ff){return AES_SUPPORTED_RX['test'](_0x55c6ff);}function getSupportedCiphers(){return crypto[_0xf11a('0xc')]()[_0xf11a('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x548776){return getSupportedCiphers()['indexOf'](_0x548776)>-0x1;}function combineOptions(_0x29ac62){var _0x18d2fd={};for(var _0x218dd1 in fileOptions){if(fileOptions[_0xf11a('0xe')](_0x218dd1)){_0x18d2fd[_0x218dd1]=fileOptions[_0x218dd1];}}if(_0x29ac62){for(var _0x2b7cbb in _0x29ac62){if(_0x29ac62['hasOwnProperty'](_0x2b7cbb)){_0x18d2fd[_0x2b7cbb]=_0x29ac62[_0x2b7cbb];}}}return _0x18d2fd;}exports[_0xf11a('0xf')]=function(_0x19385f,_0x30b963,_0x236a2d,_0x2691a2){return new BPromise(function(_0x4ab424,_0x1b2cfb){_0x2691a2=combineOptions(_0x2691a2);var _0x22326f=new Buffer(_0x236a2d);var _0x1f2b84=fs[_0xf11a('0x10')](_0x19385f);var _0x359ae8=fs[_0xf11a('0x11')](_0x30b963);var _0x454c49=crypto['createCipher'](_0x2691a2[_0xf11a('0xa')],_0x22326f);_0x1f2b84['on'](_0xf11a('0x12'),function(_0x579a3a){var _0x441376=new Buffer(_0x454c49['update'](_0x579a3a),_0xf11a('0x13'));_0x359ae8[_0xf11a('0x14')](_0x441376);});_0x1f2b84['on']('end',function(){try{var _0x2a0dcb=new Buffer(_0x454c49['final']('binary'),_0xf11a('0x13'));_0x359ae8[_0xf11a('0x14')](_0x2a0dcb);_0x359ae8[_0xf11a('0x15')]();_0x359ae8['on'](_0xf11a('0x16'),function(){return _0x4ab424(_0x30b963);});}catch(_0xfc9941){fs[_0xf11a('0x17')](_0x30b963);return _0x1b2cfb(_0xfc9941);}});});};exports[_0xf11a('0x18')]=function(_0x54ae37,_0xaa7fc9,_0x50234a,_0x359523){return new BPromise(function(_0x5e4847,_0x2e4df6){_0x359523=combineOptions(_0x359523);var _0x44b65d=new Buffer(_0x50234a);var _0x4901da=fs[_0xf11a('0x10')](_0x54ae37);var _0x124d6d=fs['createWriteStream'](_0xaa7fc9);var _0x3fe088=crypto[_0xf11a('0x19')](_0x359523[_0xf11a('0xa')],_0x44b65d);_0x4901da['on'](_0xf11a('0x12'),function(_0x12a1f6){var _0x3e1b2f=new Buffer(_0x3fe088[_0xf11a('0x1a')](_0x12a1f6),_0xf11a('0x13'));_0x124d6d['write'](_0x3e1b2f);});_0x4901da['on']('end',function(){try{var _0x16f6ea=new Buffer(_0x3fe088[_0xf11a('0x1b')]('binary'),_0xf11a('0x13'));_0x124d6d[_0xf11a('0x14')](_0x16f6ea);_0x124d6d[_0xf11a('0x15')]();_0x124d6d['on'](_0xf11a('0x16'),function(){return _0x5e4847(_0xaa7fc9);});}catch(_0xf2cdad){fs[_0xf11a('0x17')](_0xaa7fc9);return _0x2e4df6(_0xf2cdad);}});});};exports[_0xf11a('0x1c')]=function(_0x32bf2d,_0x1c9db7,_0xa6875f){var _0x21c4e5=_0xa6875f||stringOptions['algorithm'];var _0x5dc34c=_0x1c9db7||stringOptions[_0xf11a('0x1d')];var _0x4dcdbd=crypto[_0xf11a('0x1e')](_0x21c4e5,_0x5dc34c);var _0x3be348=_0x4dcdbd[_0xf11a('0x1a')](_0x32bf2d,_0xf11a('0x1f'),_0xf11a('0x20'));_0x3be348+=_0x4dcdbd['final'](_0xf11a('0x20'));return _0x3be348;};exports[_0xf11a('0x21')]=function(_0x2969d1,_0x59577e,_0x1c7586){var _0x4b7230=_0x1c7586||stringOptions[_0xf11a('0xa')];var _0x24a8c8=_0x59577e||stringOptions['secret'];var _0x45e02e=crypto['createDecipher'](_0x4b7230,_0x24a8c8);var _0x2b04bb=_0x45e02e['update'](_0x2969d1,_0xf11a('0x20'),'utf8');_0x2b04bb+=_0x45e02e[_0xf11a('0x1b')](_0xf11a('0x1f'));return _0x2b04bb;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f5e2bd5..1c955a5 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 _0x804b=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s.%s','zip\x20finished','Completed','zip','csv','inspect','Failed','exit','lodash','to-csv','zip-dir','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','splitSizeCsv','then','sequelize','query','SELECT','num','Empty','split','length','range','isInteger','forEach'];(function(_0x137cd7,_0x28f679){var _0x9ca7cd=function(_0x37bb60){while(--_0x37bb60){_0x137cd7['push'](_0x137cd7['shift']());}};_0x9ca7cd(++_0x28f679);}(_0x804b,0x1e8));var _0xb804=function(_0x295841,_0x3353cf){_0x295841=_0x295841-0x0;var _0x397348=_0x804b[_0x295841];return _0x397348;};'use strict';var util=require('util');var path=require('path');var _=require(_0xb804('0x0'));var csv=require(_0xb804('0x1'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb804('0x2'));var rimraf=require(_0xb804('0x3'));var db=require(_0xb804('0x4'))['db'];var dbH=require(_0xb804('0x4'))[_0xb804('0x5')];var logger=require(_0xb804('0x6'))(_0xb804('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb804('0x8')][0x2]);var QUERY=process[_0xb804('0x8')][0x3];var PATH=process[_0xb804('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2859c8,_0x37c103){var _0x466051={'status':_0x2859c8};var _0x4d4c8e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x37c103){_0x466051[_0xb804('0x9')]=_0x37c103;}return db[_0xb804('0xa')][_0xb804('0xb')](_0x466051,_0x4d4c8e);}function main(){var _0x3aa82f=0x1388;var _0x40a54f;logger[_0xb804('0xc')](util[_0xb804('0xd')](_0xb804('0xe'),EXTRACTED_REPORT_ID,_0xb804('0xf')));return db[_0xb804('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb804('0x11')]})[_0xb804('0x12')](function(_0x19eaaf){if(_0x19eaaf){_0x40a54f=_0x19eaaf;_0x3aa82f=_0x40a54f[_0xb804('0x11')]||0x1388;}})[_0xb804('0x12')](function(){return dbH[_0xb804('0x13')][_0xb804('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xb804('0x15')]});})[_0xb804('0x12')](function(_0x39b0b3){if(!_0x39b0b3[0x0][_0xb804('0x16')]){return analyticExtractedReport(_0xb804('0x17'));}var _0x1a3a3a=[];var _0x234aba=0x0;if(_0x40a54f[_0xb804('0x18')]){if(_0x39b0b3&&_0x39b0b3[_0xb804('0x19')]){var _0x46f2a4=_[_0xb804('0x1a')](_0x39b0b3[0x0][_0xb804('0x16')]/_0x3aa82f);var _0x16597=Number[_0xb804('0x1b')](_0x39b0b3[0x0][_0xb804('0x16')]/_0x3aa82f)?_0x39b0b3[0x0][_0xb804('0x16')]%_0x3aa82f:0x0;_0x46f2a4[_0xb804('0x1c')](function(_0x216e42){if(_0x216e42>0x0){_0x234aba+=_0x3aa82f;}_0x1a3a3a[_0xb804('0x1d')](dbH[_0xb804('0x13')][_0xb804('0x14')](util[_0xb804('0xd')](_0xb804('0x1e'),QUERY,_0x3aa82f,_0x234aba),{'type':dbH[_0xb804('0x13')][_0xb804('0x1f')][_0xb804('0x15')]}));});if(_0x16597>0x0){_0x234aba+=_0x3aa82f;_0x1a3a3a['push'](dbH[_0xb804('0x13')][_0xb804('0x14')](util[_0xb804('0xd')](_0xb804('0x1e'),QUERY,_0x16597,_0x234aba),{'type':dbH[_0xb804('0x13')][_0xb804('0x1f')][_0xb804('0x15')]}));}}}else{_0x1a3a3a[_0xb804('0x1d')](dbH['sequelize'][_0xb804('0x14')](QUERY,{'type':dbH[_0xb804('0x13')][_0xb804('0x1f')][_0xb804('0x15')]}));}var _0x117e21=path[_0xb804('0x20')](PATH);var _0x26ded1=path[_0xb804('0x21')](PATH,_0xb804('0x22'));var _0x3e88a7=_0x40a54f['split']&&_0x1a3a3a['length']>0x1;var _0xebf5f3=[];if(!fs[_0xb804('0x23')](path[_0xb804('0x24')](_0x117e21,_0x26ded1))&&_0x3e88a7){fs[_0xb804('0x25')](path[_0xb804('0x24')](_0x117e21,_0x26ded1));}return BPromise[_0xb804('0x26')](_0x1a3a3a,function(_0xce64dd){_0xebf5f3[_0xb804('0x1d')](_0xce64dd);})[_0xb804('0x12')](function(){for(var _0x40e5cc=0x0;_0x40e5cc<_0xebf5f3[_0xb804('0x19')];_0x40e5cc+=0x1){var _0xc8248;var _0x348966=_0xebf5f3[_0x40e5cc];if(_0x3e88a7){_0xc8248=path['join'](_0x117e21,_0x26ded1,util[_0xb804('0xd')]('%s%d.%s',_0x26ded1,_0x40e5cc,'csv'));}else{_0xc8248=path[_0xb804('0x24')](_0x117e21,util[_0xb804('0xd')](_0xb804('0x27'),_0x26ded1,'csv'));}fs['writeFileSync'](_0xc8248,csv(_0x348966));}})[_0xb804('0x12')](function(){if(_0x3e88a7){return new Promise(function(_0x51953b){zipdir(path['join'](_0x117e21,_0x26ded1),{'saveTo':path[_0xb804('0x24')](_0x117e21,util[_0xb804('0xd')](_0xb804('0x27'),_0x26ded1,'zip'))},function(_0x528922,_0x518388){rimraf(path[_0xb804('0x24')](_0x117e21,_0x26ded1),function(){});_0x51953b(_0xb804('0x28'));});});}})[_0xb804('0x12')](function(){logger[_0xb804('0xc')](util[_0xb804('0xd')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb804('0xf')));return analyticExtractedReport(_0xb804('0x29'),_0x3e88a7?util['format'](_0xb804('0x27'),_0x26ded1,_0x3e88a7?_0xb804('0x2a'):_0xb804('0x2b')):null);});})['catch'](function(_0x36ee27){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb804('0xf')),util[_0xb804('0x2c')](_0x36ee27,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb804('0x2d'));})['finally'](function(){process[_0xb804('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x402d=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','info'];(function(_0x233d44,_0x487429){var _0x5145ad=function(_0x3fea23){while(--_0x3fea23){_0x233d44['push'](_0x233d44['shift']());}};_0x5145ad(++_0x487429);}(_0x402d,0x19e));var _0xd402=function(_0x4a700b,_0xa8afa0){_0x4a700b=_0x4a700b-0x0;var _0x25cc98=_0x402d[_0x4a700b];return _0x25cc98;};'use strict';var util=require(_0xd402('0x0'));var path=require('path');var _=require(_0xd402('0x1'));var csv=require(_0xd402('0x2'));var fs=require('fs');var BPromise=require(_0xd402('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xd402('0x4'));var db=require(_0xd402('0x5'))['db'];var dbH=require(_0xd402('0x5'))[_0xd402('0x6')];var logger=require(_0xd402('0x7'))(_0xd402('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd402('0x9')][0x2]);var QUERY=process[_0xd402('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c35a6,_0xc5bb17){var _0x1196ea={'status':_0x5c35a6};var _0x3b1b7c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xc5bb17){_0x1196ea[_0xd402('0xa')]=_0xc5bb17;}return db[_0xd402('0xb')]['update'](_0x1196ea,_0x3b1b7c);}function main(){var _0x2eabe5=0x1388;var _0x2f46a9;logger['info'](util[_0xd402('0xc')](_0xd402('0xd'),EXTRACTED_REPORT_ID,_0xd402('0xe')));return db[_0xd402('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd402('0x10'),_0xd402('0x11')]})[_0xd402('0x12')](function(_0x5abeb9){if(_0x5abeb9){_0x2f46a9=_0x5abeb9;_0x2eabe5=_0x2f46a9['splitSizeCsv']||0x1388;}})[_0xd402('0x12')](function(){return dbH[_0xd402('0x13')][_0xd402('0x14')](util[_0xd402('0xc')](_0xd402('0x15'),QUERY),{'type':dbH['sequelize'][_0xd402('0x16')][_0xd402('0x17')]});})[_0xd402('0x12')](function(_0x2dd705){if(!_0x2dd705[0x0]['num']){return analyticExtractedReport(_0xd402('0x18'));}var _0x55f6bc=[];var _0x3efdb4=0x0;if(_0x2f46a9[_0xd402('0x10')]){if(_0x2dd705&&_0x2dd705[_0xd402('0x19')]){var _0x559ad0=_[_0xd402('0x1a')](_0x2dd705[0x0][_0xd402('0x1b')]/_0x2eabe5);var _0x41e915=Number[_0xd402('0x1c')](_0x2dd705[0x0][_0xd402('0x1b')]/_0x2eabe5)?_0x2dd705[0x0][_0xd402('0x1b')]%_0x2eabe5:0x0;_0x559ad0[_0xd402('0x1d')](function(_0x1cba41){if(_0x1cba41>0x0){_0x3efdb4+=_0x2eabe5;}_0x55f6bc[_0xd402('0x1e')](dbH['sequelize'][_0xd402('0x14')](util[_0xd402('0xc')](_0xd402('0x1f'),QUERY,_0x2eabe5,_0x3efdb4),{'type':dbH[_0xd402('0x13')][_0xd402('0x16')]['SELECT']}));});if(_0x41e915>0x0){_0x3efdb4+=_0x2eabe5;_0x55f6bc[_0xd402('0x1e')](dbH[_0xd402('0x13')][_0xd402('0x14')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41e915,_0x3efdb4),{'type':dbH[_0xd402('0x13')]['QueryTypes'][_0xd402('0x17')]}));}}}else{_0x55f6bc[_0xd402('0x1e')](dbH['sequelize'][_0xd402('0x14')](QUERY,{'type':dbH[_0xd402('0x13')][_0xd402('0x16')][_0xd402('0x17')]}));}var _0x3c788f=path[_0xd402('0x20')](PATH);var _0x1f237b=path[_0xd402('0x21')](PATH,_0xd402('0x22'));var _0x520dd3=_0x2f46a9[_0xd402('0x10')]&&_0x55f6bc[_0xd402('0x19')]>0x1;var _0x16550c=[];if(!fs[_0xd402('0x23')](path[_0xd402('0x24')](_0x3c788f,_0x1f237b))&&_0x520dd3){fs['mkdirSync'](path[_0xd402('0x24')](_0x3c788f,_0x1f237b));}return BPromise[_0xd402('0x25')](_0x55f6bc,function(_0xbbb9df){_0x16550c[_0xd402('0x1e')](_0xbbb9df);})[_0xd402('0x12')](function(){for(var _0x4130ff=0x0;_0x4130ff<_0x16550c['length'];_0x4130ff+=0x1){var _0x5e46b0;var _0x44765d=_0x16550c[_0x4130ff];if(_0x520dd3){_0x5e46b0=path[_0xd402('0x24')](_0x3c788f,_0x1f237b,util['format'](_0xd402('0x26'),_0x1f237b,_0x4130ff,_0xd402('0x27')));}else{_0x5e46b0=path[_0xd402('0x24')](_0x3c788f,util['format']('%s.%s',_0x1f237b,_0xd402('0x27')));}fs[_0xd402('0x28')](_0x5e46b0,csv(_0x44765d));}})[_0xd402('0x12')](function(){if(_0x520dd3){return new Promise(function(_0x5227e5){zipdir(path[_0xd402('0x24')](_0x3c788f,_0x1f237b),{'saveTo':path[_0xd402('0x24')](_0x3c788f,util[_0xd402('0xc')](_0xd402('0x29'),_0x1f237b,_0xd402('0x2a')))},function(_0x54307b,_0x16445b){rimraf(path[_0xd402('0x24')](_0x3c788f,_0x1f237b),function(){});_0x5227e5(_0xd402('0x2b'));});});}})[_0xd402('0x12')](function(){logger[_0xd402('0x2c')](util[_0xd402('0xc')](_0xd402('0x2d'),EXTRACTED_REPORT_ID,_0xd402('0xe')));return analyticExtractedReport('Completed',_0x520dd3?util['format'](_0xd402('0x29'),_0x1f237b,_0x520dd3?_0xd402('0x2a'):'csv'):null);});})[_0xd402('0x2e')](function(_0x102089){logger[_0xd402('0x2c')](util[_0xd402('0xc')](_0xd402('0x2f'),EXTRACTED_REPORT_ID,_0xd402('0xe')),util[_0xd402('0x30')](_0x102089,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd402('0x31'));})[_0xd402('0x32')](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 e79a721..6ba4193 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 _0xa917=['before','margin','landscape','toString','\x20/\x20','Arial','right','num','Empty','Setting','split','then','splitSizePdf','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','zip\x20finished','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','fill','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','length','header'];(function(_0x267509,_0x43a69f){var _0x3ea295=function(_0x40b16e){while(--_0x40b16e){_0x267509['push'](_0x267509['shift']());}};_0x3ea295(++_0x43a69f);}(_0xa917,0xe8));var _0x7a91=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa917[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x7a91('0x0'));var fs=require('fs');var util=require(_0x7a91('0x1'));var path=require(_0x7a91('0x2'));var moment=require(_0x7a91('0x3'));var htmlToPdfmake=require(_0x7a91('0x4'));var PdfPrinter=require(_0x7a91('0x5'));var zipdir=require('zip-dir');var rimraf=require(_0x7a91('0x6'));var JSDOM=require(_0x7a91('0x7'))[_0x7a91('0x8')];var window=new JSDOM('')[_0x7a91('0x9')];var BPromise=require(_0x7a91('0xa'));var db=require(_0x7a91('0xb'))['db'];var dbH=require(_0x7a91('0xb'))[_0x7a91('0xc')];var logger=require('../../config/logger')(_0x7a91('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x7a91('0xe')][0x2]);var QUERY=process[_0x7a91('0xe')][0x3];var PATH=process[_0x7a91('0xe')][0x4];var NAME=process[_0x7a91('0xe')][0x5];var FORMAT=_0x7a91('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x52c202,_0x54418a){var _0x117b02={'status':_0x52c202};var _0x32f63d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54418a){_0x117b02[_0x7a91('0x10')]=_0x54418a;}return db[_0x7a91('0x11')][_0x7a91('0x12')](_0x117b02,_0x32f63d);}function getHeaders(_0x201455){return _['map'](_0x201455,function(_0x2983bc){return{'text':_0x2983bc,'style':_0x7a91('0x13')};});}function getRows(_0x1f146f,_0x245672){return _[_0x7a91('0x14')](_0x245672,function(_0x5b1147){return _(_0x5b1147)[_0x7a91('0x15')](_0x1f146f)['map'](function(_0x473f6e){return _0x473f6e?_['toString'](_0x473f6e):'';})['value']();});}function createTable(_0xa05f65,_0x1bbe5a){var _0x8f861c={'widths':_[_0x7a91('0x16')](Array(_0xa05f65['length']),0x91),'heights':function(_0x2cfeb0){return _0x2cfeb0===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x251d83=getHeaders(_0xa05f65);_0x8f861c[_0x7a91('0x17')][_0x7a91('0x18')](_0x251d83);var _0x3556e2=getRows(_0xa05f65,_0x1bbe5a);_0x8f861c[_0x7a91('0x17')]=_0x8f861c[_0x7a91('0x17')][_0x7a91('0x19')](_0x3556e2);return _0x8f861c;}function createTables(_0xa82789){var _0x3dec12=[];var _0x40e4f6=_['chunk'](Object[_0x7a91('0x1a')](_0xa82789[0x0]),0x5);_0x40e4f6[_0x7a91('0x1b')](function(_0x1c22ef){_0x3dec12[_0x7a91('0x18')](createTable(_0x1c22ef,_0xa82789));});return _0x3dec12;}function getPDFDocDefinition(_0x2ba525){var _0x1b1791=util[_0x7a91('0x1c')](_0x7a91('0x1d'),NAME,EXTRACTED_REPORT[_0x7a91('0x1e')],moment(EXTRACTED_REPORT[_0x7a91('0x1f')])[_0x7a91('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x7a91('0x20')])[_0x7a91('0x1c')](FORMAT));var _0x29f1b8=[];for(var _0x8b0d4=0x0;_0x8b0d4<_0x2ba525[_0x7a91('0x21')];_0x8b0d4++){var _0xd1423a=[];if(_0x8b0d4===0x0){_0xd1423a[_0x7a91('0x18')]({'text':_0x1b1791,'style':_0x7a91('0x22')});}var _0xccf3d9={'table':_0x2ba525[_0x8b0d4]};if(_0x8b0d4>0x0){_0xccf3d9['pageBreak']=_0x7a91('0x23');_0xccf3d9[_0x7a91('0x24')]=[0x0,0x46,0x0,0x0];}_0xd1423a['push'](_0xccf3d9);_0x29f1b8[_0x7a91('0x18')](_0xd1423a);}return{'pageSize':'A4','pageOrientation':_0x7a91('0x25'),'content':_0x29f1b8,'footer':function(_0x5937c8,_0x5853ad){return{'text':_0x5937c8[_0x7a91('0x26')]()+_0x7a91('0x27')+_0x5853ad,'style':'footer'};},'defaultStyle':{'font':_0x7a91('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x7a91('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5dca1e){var _0x5e5c65=0x1388;var _0xd80af7;if(!_0x5dca1e[0x0][_0x7a91('0x2a')]){return analyticExtractedReport(_0x7a91('0x2b'));}return db[_0x7a91('0x2c')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7a91('0x2d'),'splitSizePdf']})[_0x7a91('0x2e')](function(_0x15f6e1){if(_0x15f6e1){_0xd80af7=_0x15f6e1;_0x5e5c65=_0xd80af7[_0x7a91('0x2f')]||0x3e8;}})[_0x7a91('0x2e')](function(){var _0xadabdb=[];var _0x383e4a=0x0;if(_0xd80af7[_0x7a91('0x2d')]){if(_0x5dca1e&&_0x5dca1e[_0x7a91('0x21')]){var _0xe26046=_['range'](_0x5dca1e[0x0]['num']/_0x5e5c65);var _0x10bcc9=Number[_0x7a91('0x30')](_0x5dca1e[0x0]['num']/_0x5e5c65)?_0x5dca1e[0x0][_0x7a91('0x2a')]%_0x5e5c65:0x0;_0xe26046['forEach'](function(_0x5cf03a){if(_0x5cf03a>0x0){_0x383e4a+=_0x5e5c65;}_0xadabdb[_0x7a91('0x18')](dbH[_0x7a91('0x31')][_0x7a91('0x32')](util[_0x7a91('0x1c')](_0x7a91('0x33'),QUERY,_0x5e5c65,_0x383e4a),{'type':dbH[_0x7a91('0x31')][_0x7a91('0x34')][_0x7a91('0x35')]}));});if(_0x10bcc9>0x0){_0x383e4a+=_0x5e5c65;_0xadabdb[_0x7a91('0x18')](dbH[_0x7a91('0x31')]['query'](util['format'](_0x7a91('0x33'),QUERY,_0x10bcc9,_0x383e4a),{'type':dbH[_0x7a91('0x31')][_0x7a91('0x34')][_0x7a91('0x35')]}));}}}else{_0xadabdb[_0x7a91('0x18')](dbH[_0x7a91('0x31')][_0x7a91('0x32')](QUERY,{'type':dbH[_0x7a91('0x31')]['QueryTypes']['SELECT']}));}var _0x3adf07=path['dirname'](PATH);var _0x5ee912=path[_0x7a91('0x36')](PATH,'.pdf');var _0x44fbcb=_0xd80af7[_0x7a91('0x2d')]&&_0xadabdb['length']>0x1;var _0x49ef0d=[];if(!fs[_0x7a91('0x37')](path[_0x7a91('0x38')](_0x3adf07,_0x5ee912))&&_0x44fbcb){fs[_0x7a91('0x39')](path[_0x7a91('0x38')](_0x3adf07,_0x5ee912));}return BPromise[_0x7a91('0x3a')](_0xadabdb,function(_0x5e948a){_0x49ef0d['push'](_0x5e948a);})['then'](function(){var _0x57a442=[];for(var _0x4cdbe1=0x0;_0x4cdbe1<_0x49ef0d[_0x7a91('0x21')];_0x4cdbe1+=0x1){var _0x3d1d67=_0x49ef0d[_0x4cdbe1];var _0x48a91b=createTables(_[_0x7a91('0x3b')](_0x3d1d67));var _0x2a7ea5;var _0x1c1b2f=getPDFDocDefinition(_0x48a91b);var _0x521168=getPDFPrinter();var _0x4be44f=_0x521168[_0x7a91('0x3c')](_0x1c1b2f);if(_0x44fbcb){_0x2a7ea5=path[_0x7a91('0x38')](_0x3adf07,_0x5ee912,util[_0x7a91('0x1c')](_0x7a91('0x3d'),_0x5ee912,_0x4cdbe1,_0x7a91('0x3e')));}else{_0x2a7ea5=path[_0x7a91('0x38')](_0x3adf07,util['format'](_0x7a91('0x3f'),_0x5ee912,'pdf'));}_0x57a442[_0x7a91('0x18')](writePDFDocument(_0x4be44f,_0x2a7ea5));}return Promise[_0x7a91('0x40')](_0x57a442);})['then'](function(){if(_0x44fbcb){return new Promise(function(_0xb929a7){zipdir(path['join'](_0x3adf07,_0x5ee912),{'saveTo':path[_0x7a91('0x38')](_0x3adf07,util[_0x7a91('0x1c')](_0x7a91('0x3f'),_0x5ee912,_0x7a91('0x41')))},function(){rimraf(path['join'](_0x3adf07,_0x5ee912),function(){});_0xb929a7(_0x7a91('0x42'));});});}})[_0x7a91('0x2e')](function(){if(!_0x44fbcb)return;rimraf(path[_0x7a91('0x38')](_0x3adf07,_0x5ee912),function(){});})[_0x7a91('0x2e')](function(){logger['info'](util[_0x7a91('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x7a91('0x43')));return analyticExtractedReport(_0x7a91('0x44'),_0x44fbcb?util[_0x7a91('0x1c')](_0x7a91('0x3f'),_0x5ee912,_0x44fbcb?_0x7a91('0x41'):_0x7a91('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x7a91('0x45')](util[_0x7a91('0x1c')](_0x7a91('0x46'),EXTRACTED_REPORT_ID,_0x7a91('0x43')));return db[_0x7a91('0x11')][_0x7a91('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7a91('0x2e')](function(_0x22c791){EXTRACTED_REPORT=_0x22c791;return dbH[_0x7a91('0x31')]['query'](util['format'](_0x7a91('0x48'),QUERY),{'type':dbH[_0x7a91('0x31')][_0x7a91('0x34')][_0x7a91('0x35')]});})[_0x7a91('0x2e')](extractReport)['catch'](function(_0x3bf19c){logger[_0x7a91('0x45')](util[_0x7a91('0x1c')](_0x7a91('0x49'),EXTRACTED_REPORT_ID,_0x7a91('0x43')),util['inspect'](_0x3bf19c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7a91('0x4a'));})['finally'](function(){process[_0x7a91('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1afa74=new PdfPrinter({'Arial':{'normal':__dirname+_0x7a91('0x4c'),'bold':__dirname+_0x7a91('0x4d'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1afa74;}function getPDFDocDefinitionFromHTML(_0x1dd774,_0x5481a9){var _0x523d02=util[_0x7a91('0x1c')](_0x7a91('0x4e'),_0x5481a9['channel'],_0x5481a9[_0x7a91('0x4f')]);var _0x58620c=moment()[_0x7a91('0x1c')](_0x7a91('0x50'))[_0x7a91('0x26')]();var _0x252964=htmlToPdfmake(_0x1dd774,{'window':window,'tableAutoSize':!![]});return{'content':[_0x252964],'defaultStyle':{'font':_0x7a91('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x7a91('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x7a91('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x7a91('0x51')}},'header':function(){return[{'text':_0x7a91('0x52'),'style':_0x7a91('0x22')}];},'footer':function(_0x37c648,_0x2df8ac){return[{'text':util['format'](_0x7a91('0x53'),_0x523d02,_0x37c648,_0x2df8ac,_0x58620c),'style':'footer'}];}};}function writePDFDocument(_0x1a2498,_0x4ebc39){return new Promise(function(_0x31de37,_0xbe9254){var _0x59fc73=_0x1a2498['pipe'](fs[_0x7a91('0x54')](_0x4ebc39));_0x59fc73['on'](_0x7a91('0x55'),function(){_0x31de37('finish');});_0x59fc73['on'](_0x7a91('0x56'),function(_0x23f67e){_0xbe9254(_0x23f67e);});_0x1a2498[_0x7a91('0x57')]();});}exports['createPdfFromHTML']=function(_0x389524,_0x133df4){var _0x5b13e6=getPDFPrinter();var _0x459f08=getPDFDocDefinitionFromHTML(_0x389524,_0x133df4);var _0x38cd39=_0x5b13e6['createPdfKitDocument'](_0x459f08);return writePDFDocument(_0x38cd39,_0x133df4['path'])[_0x7a91('0x58')](function(_0x4b6c65){throw _0x4b6c65;});}; \ No newline at end of file +var _0x491e=['sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','PDF','Completed','info','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','body','push','chunk','keys','forEach','format','name','startDate','endDate','header','before','margin','landscape','\x20/\x20','footer','black','right','num','Empty','Setting','split','splitSizePdf','then','isInteger'];(function(_0x4c4a33,_0x1ff81b){var _0x480290=function(_0x54b633){while(--_0x54b633){_0x4c4a33['push'](_0x4c4a33['shift']());}};_0x480290(++_0x1ff81b);}(_0x491e,0x80));var _0xe491=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x491e[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0xe491('0x0'));var fs=require('fs');var util=require(_0xe491('0x1'));var path=require(_0xe491('0x2'));var moment=require(_0xe491('0x3'));var htmlToPdfmake=require(_0xe491('0x4'));var PdfPrinter=require(_0xe491('0x5'));var zipdir=require(_0xe491('0x6'));var rimraf=require(_0xe491('0x7'));var JSDOM=require(_0xe491('0x8'))[_0xe491('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0xe491('0xa'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xe491('0xb')];var logger=require(_0xe491('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xe491('0xd')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b2e98,_0xb50768){var _0x12ee58={'status':_0x2b2e98};var _0x4b248d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb50768){_0x12ee58[_0xe491('0xe')]=_0xb50768;}return db[_0xe491('0xf')][_0xe491('0x10')](_0x12ee58,_0x4b248d);}function getHeaders(_0xd0cbb0){return _[_0xe491('0x11')](_0xd0cbb0,function(_0x2f9bc1){return{'text':_0x2f9bc1,'style':_0xe491('0x12')};});}function getRows(_0x3b7815,_0x458380){return _[_0xe491('0x11')](_0x458380,function(_0x510bdf){return _(_0x510bdf)[_0xe491('0x13')](_0x3b7815)['map'](function(_0x3c477f){return _0x3c477f?_[_0xe491('0x14')](_0x3c477f):'';})[_0xe491('0x15')]();});}function createTable(_0x53c885,_0x2112f6){var _0x30aff0={'widths':_[_0xe491('0x16')](Array(_0x53c885[_0xe491('0x17')]),0x91),'heights':function(_0x2a91d4){return _0x2a91d4===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x13e489=getHeaders(_0x53c885);_0x30aff0[_0xe491('0x18')][_0xe491('0x19')](_0x13e489);var _0xd3e486=getRows(_0x53c885,_0x2112f6);_0x30aff0[_0xe491('0x18')]=_0x30aff0[_0xe491('0x18')]['concat'](_0xd3e486);return _0x30aff0;}function createTables(_0x1787c6){var _0x292ef1=[];var _0x20c7a2=_[_0xe491('0x1a')](Object[_0xe491('0x1b')](_0x1787c6[0x0]),0x5);_0x20c7a2[_0xe491('0x1c')](function(_0xf09022){_0x292ef1['push'](createTable(_0xf09022,_0x1787c6));});return _0x292ef1;}function getPDFDocDefinition(_0x166b8f){var _0x1eba4e=util[_0xe491('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xe491('0x1e')],moment(EXTRACTED_REPORT[_0xe491('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0xe491('0x20')])[_0xe491('0x1d')](FORMAT));var _0x32d924=[];for(var _0x56637c=0x0;_0x56637c<_0x166b8f[_0xe491('0x17')];_0x56637c++){var _0x42f23b=[];if(_0x56637c===0x0){_0x42f23b[_0xe491('0x19')]({'text':_0x1eba4e,'style':_0xe491('0x21')});}var _0x161102={'table':_0x166b8f[_0x56637c]};if(_0x56637c>0x0){_0x161102['pageBreak']=_0xe491('0x22');_0x161102[_0xe491('0x23')]=[0x0,0x46,0x0,0x0];}_0x42f23b['push'](_0x161102);_0x32d924[_0xe491('0x19')](_0x42f23b);}return{'pageSize':'A4','pageOrientation':_0xe491('0x24'),'content':_0x32d924,'footer':function(_0xc8c9eb,_0x399af9){return{'text':_0xc8c9eb[_0xe491('0x14')]()+_0xe491('0x25')+_0x399af9,'style':_0xe491('0x26')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe491('0x27')},'footer':{'alignment':_0xe491('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xe63167){var _0x300c43=0x1388;var _0xfe0f7c;if(!_0xe63167[0x0][_0xe491('0x29')]){return analyticExtractedReport(_0xe491('0x2a'));}return db[_0xe491('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe491('0x2c'),_0xe491('0x2d')]})[_0xe491('0x2e')](function(_0xa4d8d7){if(_0xa4d8d7){_0xfe0f7c=_0xa4d8d7;_0x300c43=_0xfe0f7c[_0xe491('0x2d')]||0x3e8;}})['then'](function(){var _0x123262=[];var _0x119621=0x0;if(_0xfe0f7c['split']){if(_0xe63167&&_0xe63167['length']){var _0x39b064=_['range'](_0xe63167[0x0][_0xe491('0x29')]/_0x300c43);var _0x38197d=Number[_0xe491('0x2f')](_0xe63167[0x0][_0xe491('0x29')]/_0x300c43)?_0xe63167[0x0][_0xe491('0x29')]%_0x300c43:0x0;_0x39b064['forEach'](function(_0x35aded){if(_0x35aded>0x0){_0x119621+=_0x300c43;}_0x123262[_0xe491('0x19')](dbH[_0xe491('0x30')][_0xe491('0x31')](util[_0xe491('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x300c43,_0x119621),{'type':dbH[_0xe491('0x30')][_0xe491('0x32')][_0xe491('0x33')]}));});if(_0x38197d>0x0){_0x119621+=_0x300c43;_0x123262[_0xe491('0x19')](dbH[_0xe491('0x30')][_0xe491('0x31')](util[_0xe491('0x1d')](_0xe491('0x34'),QUERY,_0x38197d,_0x119621),{'type':dbH['sequelize'][_0xe491('0x32')][_0xe491('0x33')]}));}}}else{_0x123262[_0xe491('0x19')](dbH[_0xe491('0x30')]['query'](QUERY,{'type':dbH[_0xe491('0x30')][_0xe491('0x32')][_0xe491('0x33')]}));}var _0x21222b=path[_0xe491('0x35')](PATH);var _0xf08cc4=path[_0xe491('0x36')](PATH,_0xe491('0x37'));var _0x18d14d=_0xfe0f7c[_0xe491('0x2c')]&&_0x123262[_0xe491('0x17')]>0x1;var _0x3fb087=[];if(!fs[_0xe491('0x38')](path[_0xe491('0x39')](_0x21222b,_0xf08cc4))&&_0x18d14d){fs['mkdirSync'](path['join'](_0x21222b,_0xf08cc4));}return BPromise[_0xe491('0x3a')](_0x123262,function(_0x46fc75){_0x3fb087[_0xe491('0x19')](_0x46fc75);})['then'](function(){var _0x524f40=[];for(var _0x49a406=0x0;_0x49a406<_0x3fb087[_0xe491('0x17')];_0x49a406+=0x1){var _0x2a357b=_0x3fb087[_0x49a406];var _0x31760b=createTables(_[_0xe491('0x3b')](_0x2a357b));var _0x4e55ba;var _0x2fc78b=getPDFDocDefinition(_0x31760b);var _0x538437=getPDFPrinter();var _0x4c90b4=_0x538437[_0xe491('0x3c')](_0x2fc78b);if(_0x18d14d){_0x4e55ba=path['join'](_0x21222b,_0xf08cc4,util[_0xe491('0x1d')](_0xe491('0x3d'),_0xf08cc4,_0x49a406,_0xe491('0x3e')));}else{_0x4e55ba=path['join'](_0x21222b,util[_0xe491('0x1d')](_0xe491('0x3f'),_0xf08cc4,'pdf'));}_0x524f40[_0xe491('0x19')](writePDFDocument(_0x4c90b4,_0x4e55ba));}return Promise[_0xe491('0x40')](_0x524f40);})[_0xe491('0x2e')](function(){if(_0x18d14d){return new Promise(function(_0x26e23a){zipdir(path['join'](_0x21222b,_0xf08cc4),{'saveTo':path[_0xe491('0x39')](_0x21222b,util[_0xe491('0x1d')](_0xe491('0x3f'),_0xf08cc4,'zip'))},function(){rimraf(path[_0xe491('0x39')](_0x21222b,_0xf08cc4),function(){});_0x26e23a('zip\x20finished');});});}})[_0xe491('0x2e')](function(){if(!_0x18d14d)return;rimraf(path[_0xe491('0x39')](_0x21222b,_0xf08cc4),function(){});})[_0xe491('0x2e')](function(){logger['info'](util[_0xe491('0x1d')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xe491('0x41')));return analyticExtractedReport(_0xe491('0x42'),_0x18d14d?util[_0xe491('0x1d')]('%s.%s',_0xf08cc4,_0x18d14d?'zip':_0xe491('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe491('0x43')](util[_0xe491('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xe491('0x41')));return db[_0xe491('0xf')][_0xe491('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe491('0x2e')](function(_0x2a751d){EXTRACTED_REPORT=_0x2a751d;return dbH[_0xe491('0x30')][_0xe491('0x31')](util[_0xe491('0x1d')](_0xe491('0x45'),QUERY),{'type':dbH[_0xe491('0x30')]['QueryTypes'][_0xe491('0x33')]});})['then'](extractReport)[_0xe491('0x46')](function(_0x1b73f2){logger[_0xe491('0x43')](util[_0xe491('0x1d')](_0xe491('0x47'),EXTRACTED_REPORT_ID,_0xe491('0x41')),util[_0xe491('0x48')](_0x1b73f2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe491('0x49'));})[_0xe491('0x4a')](function(){process[_0xe491('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x79a226=new PdfPrinter({'Arial':{'normal':__dirname+_0xe491('0x4c'),'bold':__dirname+_0xe491('0x4d'),'italics':__dirname+_0xe491('0x4e'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x79a226;}function getPDFDocDefinitionFromHTML(_0x2aacf7,_0x44b050){var _0x305523=util[_0xe491('0x1d')]('%s\x20#%d',_0x44b050['channel'],_0x44b050[_0xe491('0x4f')]);var _0x49d964=moment()['format'](_0xe491('0x50'))['toString']();var _0x44bdc6=htmlToPdfmake(_0x2aacf7,{'window':window,'tableAutoSize':!![]});return{'content':[_0x44bdc6],'defaultStyle':{'font':_0xe491('0x51')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe491('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xe491('0x53'),'style':_0xe491('0x21')}];},'footer':function(_0x41dd31,_0x5b4db4){return[{'text':util[_0xe491('0x1d')](_0xe491('0x54'),_0x305523,_0x41dd31,_0x5b4db4,_0x49d964),'style':_0xe491('0x26')}];}};}function writePDFDocument(_0x3e6c98,_0x102b8b){return new Promise(function(_0x8c2b0e,_0x4234b8){var _0x34803e=_0x3e6c98[_0xe491('0x55')](fs['createWriteStream'](_0x102b8b));_0x34803e['on']('finish',function(){_0x8c2b0e('finish');});_0x34803e['on']('error',function(_0x5cac4b){_0x4234b8(_0x5cac4b);});_0x3e6c98[_0xe491('0x56')]();});}exports[_0xe491('0x57')]=function(_0x5187b3,_0x277d37){var _0x43ae69=getPDFPrinter();var _0x3566da=getPDFDocDefinitionFromHTML(_0x5187b3,_0x277d37);var _0x318325=_0x43ae69[_0xe491('0x3c')](_0x3566da);return writePDFDocument(_0x318325,_0x277d37['path'])[_0xe491('0x46')](function(_0xf42d3f){throw _0xf42d3f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 5d37d7c..ccbd1c0 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 _0x2136=['%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','mkdirSync','each'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2136,0x1eb));var _0x6213=function(_0x28b9dd,_0x2f2c7e){_0x28b9dd=_0x28b9dd-0x0;var _0x3c56ee=_0x2136[_0x28b9dd];return _0x3c56ee;};'use strict';var util=require(_0x6213('0x0'));var path=require(_0x6213('0x1'));var _=require(_0x6213('0x2'));var fs=require('fs');var json2xls=require(_0x6213('0x3'));var BPromise=require(_0x6213('0x4'));var zipdir=require(_0x6213('0x5'));var rimraf=require(_0x6213('0x6'));var db=require(_0x6213('0x7'))['db'];var dbH=require(_0x6213('0x7'))[_0x6213('0x8')];var logger=require('../../config/logger')(_0x6213('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x6213('0xa')][0x2]);var QUERY=process[_0x6213('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b05fe,_0x555c17){var _0x3604f1={'status':_0x2b05fe};var _0x88e8a0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x555c17){_0x3604f1['savename']=_0x555c17;}return db['AnalyticExtractedReport'][_0x6213('0xb')](_0x3604f1,_0x88e8a0);}function main(){var _0x23548f=0x1388;var _0x4082b0;logger[_0x6213('0xc')](util[_0x6213('0xd')](_0x6213('0xe'),EXTRACTED_REPORT_ID,_0x6213('0xf')));return db['Setting'][_0x6213('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6213('0x11'),_0x6213('0x12')]})['then'](function(_0x23c118){if(_0x23c118){_0x4082b0=_0x23c118;_0x23548f=_0x4082b0[_0x6213('0x12')]||0x1388;}})[_0x6213('0x13')](function(){return dbH[_0x6213('0x14')][_0x6213('0x15')](util['format'](_0x6213('0x16'),QUERY),{'type':dbH['sequelize'][_0x6213('0x17')][_0x6213('0x18')]});})[_0x6213('0x13')](function(_0x53844b){if(!_0x53844b[0x0][_0x6213('0x19')]){return analyticExtractedReport(_0x6213('0x1a'));}var _0x5ef2d6=[];var _0x509e48=0x0;if(_0x4082b0[_0x6213('0x11')]){if(_0x53844b&&_0x53844b[_0x6213('0x1b')]){var _0x5de3e2=_[_0x6213('0x1c')](_0x53844b[0x0][_0x6213('0x19')]/_0x23548f);var _0x3e5ece=Number['isInteger'](_0x53844b[0x0][_0x6213('0x19')]/_0x23548f)?_0x53844b[0x0]['num']%_0x23548f:0x0;_0x5de3e2[_0x6213('0x1d')](function(_0x3bb9ae){if(_0x3bb9ae>0x0){_0x509e48+=_0x23548f;}_0x5ef2d6['push'](dbH[_0x6213('0x14')]['query'](util[_0x6213('0xd')](_0x6213('0x1e'),QUERY,_0x23548f,_0x509e48),{'type':dbH[_0x6213('0x14')][_0x6213('0x17')][_0x6213('0x18')]}));});if(_0x3e5ece>0x0){_0x509e48+=_0x23548f;_0x5ef2d6[_0x6213('0x1f')](dbH[_0x6213('0x14')][_0x6213('0x15')](util[_0x6213('0xd')](_0x6213('0x1e'),QUERY,_0x3e5ece,_0x509e48),{'type':dbH['sequelize'][_0x6213('0x17')][_0x6213('0x18')]}));}}}else{_0x5ef2d6[_0x6213('0x1f')](dbH[_0x6213('0x14')][_0x6213('0x15')](QUERY,{'type':dbH[_0x6213('0x14')][_0x6213('0x17')][_0x6213('0x18')]}));}var _0x229fb0=path[_0x6213('0x20')](PATH);var _0x461289=path[_0x6213('0x21')](PATH,_0x6213('0x22'));var _0x5407a6=_0x4082b0['split']&&_0x5ef2d6[_0x6213('0x1b')]>0x1;var _0x11881d=[];if(!fs[_0x6213('0x23')](path[_0x6213('0x24')](_0x229fb0,_0x461289))&&_0x5407a6){fs[_0x6213('0x25')](path[_0x6213('0x24')](_0x229fb0,_0x461289));}return BPromise[_0x6213('0x26')](_0x5ef2d6,function(_0x29e86e){_0x11881d['push'](_0x29e86e);})[_0x6213('0x13')](function(){for(var _0x14aa5c=0x0;_0x14aa5c<_0x11881d['length'];_0x14aa5c+=0x1){var _0x29674b;var _0x224039=_0x11881d[_0x14aa5c];if(_0x5407a6){_0x29674b=path['join'](_0x229fb0,_0x461289,util['format'](_0x6213('0x27'),_0x461289,_0x14aa5c,_0x6213('0x28')));}else{_0x29674b=path[_0x6213('0x24')](_0x229fb0,util[_0x6213('0xd')](_0x6213('0x29'),_0x461289,'xlsx'));}fs[_0x6213('0x2a')](_0x29674b,json2xls(_0x224039),_0x6213('0x2b'));}})[_0x6213('0x13')](function(){if(_0x5407a6){return new Promise(function(_0x2f160b){zipdir(path[_0x6213('0x24')](_0x229fb0,_0x461289),{'saveTo':path[_0x6213('0x24')](_0x229fb0,util[_0x6213('0xd')](_0x6213('0x29'),_0x461289,_0x6213('0x2c')))},function(_0x18c994,_0x44cd5f){rimraf(path['join'](_0x229fb0,_0x461289),function(){});_0x2f160b(_0x6213('0x2d'));});});}})[_0x6213('0x13')](function(){logger[_0x6213('0xc')](util[_0x6213('0xd')](_0x6213('0x2e'),EXTRACTED_REPORT_ID,_0x6213('0xf')));return analyticExtractedReport(_0x6213('0x2f'),_0x5407a6?util['format'](_0x6213('0x29'),_0x461289,_0x5407a6?_0x6213('0x2c'):_0x6213('0x28')):null);});})[_0x6213('0x30')](function(_0x28ea37){logger[_0x6213('0xc')](util[_0x6213('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x6213('0x31')](_0x28ea37,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6213('0x32'));})[_0x6213('0x33')](function(){process[_0x6213('0x34')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0ae5=['sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','length','range','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','each','join','%s%d.%s','%s.%s','xlsx','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','bluebird','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','XLSX','find','split','then'];(function(_0xeca744,_0x28e6d0){var _0x456880=function(_0x4d48bb){while(--_0x4d48bb){_0xeca744['push'](_0xeca744['shift']());}};_0x456880(++_0x28e6d0);}(_0x0ae5,0x16a));var _0x50ae=function(_0x2bf9f1,_0x545f3b){_0x2bf9f1=_0x2bf9f1-0x0;var _0x34e6f7=_0x0ae5[_0x2bf9f1];return _0x34e6f7;};'use strict';var util=require(_0x50ae('0x0'));var path=require(_0x50ae('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x50ae('0x2'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x50ae('0x3'))['db'];var dbH=require(_0x50ae('0x3'))[_0x50ae('0x4')];var logger=require('../../config/logger')(_0x50ae('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x50ae('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xe8a3be,_0xd1273d){var _0x243829={'status':_0xe8a3be};var _0x63ece0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xd1273d){_0x243829[_0x50ae('0x7')]=_0xd1273d;}return db[_0x50ae('0x8')][_0x50ae('0x9')](_0x243829,_0x63ece0);}function main(){var _0x5937cf=0x1388;var _0x2ac3a5;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x50ae('0xa')));return db['Setting'][_0x50ae('0xb')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x50ae('0xc'),'splitSizeXlsx']})[_0x50ae('0xd')](function(_0x35cc70){if(_0x35cc70){_0x2ac3a5=_0x35cc70;_0x5937cf=_0x2ac3a5['splitSizeXlsx']||0x1388;}})[_0x50ae('0xd')](function(){return dbH[_0x50ae('0xe')]['query'](util[_0x50ae('0xf')](_0x50ae('0x10'),QUERY),{'type':dbH[_0x50ae('0xe')][_0x50ae('0x11')][_0x50ae('0x12')]});})[_0x50ae('0xd')](function(_0x4c0a1a){if(!_0x4c0a1a[0x0]['num']){return analyticExtractedReport('Empty');}var _0xd5df7b=[];var _0x58eed6=0x0;if(_0x2ac3a5[_0x50ae('0xc')]){if(_0x4c0a1a&&_0x4c0a1a[_0x50ae('0x13')]){var _0x58b245=_[_0x50ae('0x14')](_0x4c0a1a[0x0][_0x50ae('0x15')]/_0x5937cf);var _0x38fd17=Number[_0x50ae('0x16')](_0x4c0a1a[0x0][_0x50ae('0x15')]/_0x5937cf)?_0x4c0a1a[0x0][_0x50ae('0x15')]%_0x5937cf:0x0;_0x58b245[_0x50ae('0x17')](function(_0x398f73){if(_0x398f73>0x0){_0x58eed6+=_0x5937cf;}_0xd5df7b[_0x50ae('0x18')](dbH[_0x50ae('0xe')][_0x50ae('0x19')](util[_0x50ae('0xf')](_0x50ae('0x1a'),QUERY,_0x5937cf,_0x58eed6),{'type':dbH[_0x50ae('0xe')]['QueryTypes'][_0x50ae('0x12')]}));});if(_0x38fd17>0x0){_0x58eed6+=_0x5937cf;_0xd5df7b[_0x50ae('0x18')](dbH['sequelize'][_0x50ae('0x19')](util[_0x50ae('0xf')](_0x50ae('0x1a'),QUERY,_0x38fd17,_0x58eed6),{'type':dbH[_0x50ae('0xe')][_0x50ae('0x11')]['SELECT']}));}}}else{_0xd5df7b[_0x50ae('0x18')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x50ae('0xe')][_0x50ae('0x11')][_0x50ae('0x12')]}));}var _0x26e8b8=path[_0x50ae('0x1b')](PATH);var _0x9a14ad=path[_0x50ae('0x1c')](PATH,_0x50ae('0x1d'));var _0x2ec370=_0x2ac3a5[_0x50ae('0xc')]&&_0xd5df7b[_0x50ae('0x13')]>0x1;var _0x7f3f29=[];if(!fs[_0x50ae('0x1e')](path['join'](_0x26e8b8,_0x9a14ad))&&_0x2ec370){fs[_0x50ae('0x1f')](path['join'](_0x26e8b8,_0x9a14ad));}return BPromise[_0x50ae('0x20')](_0xd5df7b,function(_0x3b4d96){_0x7f3f29['push'](_0x3b4d96);})['then'](function(){for(var _0x309f24=0x0;_0x309f24<_0x7f3f29['length'];_0x309f24+=0x1){var _0x15894d;var _0x17534d=_0x7f3f29[_0x309f24];if(_0x2ec370){_0x15894d=path[_0x50ae('0x21')](_0x26e8b8,_0x9a14ad,util[_0x50ae('0xf')](_0x50ae('0x22'),_0x9a14ad,_0x309f24,'xlsx'));}else{_0x15894d=path['join'](_0x26e8b8,util['format'](_0x50ae('0x23'),_0x9a14ad,_0x50ae('0x24')));}fs['writeFileSync'](_0x15894d,json2xls(_0x17534d),'binary');}})['then'](function(){if(_0x2ec370){return new Promise(function(_0x5d513b){zipdir(path[_0x50ae('0x21')](_0x26e8b8,_0x9a14ad),{'saveTo':path[_0x50ae('0x21')](_0x26e8b8,util['format'](_0x50ae('0x23'),_0x9a14ad,'zip'))},function(_0x27c7e3,_0x3aed19){rimraf(path['join'](_0x26e8b8,_0x9a14ad),function(){});_0x5d513b(_0x50ae('0x25'));});});}})[_0x50ae('0xd')](function(){logger[_0x50ae('0x26')](util[_0x50ae('0xf')](_0x50ae('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x50ae('0x28'),_0x2ec370?util['format'](_0x50ae('0x23'),_0x9a14ad,_0x2ec370?'zip':_0x50ae('0x24')):null);});})[_0x50ae('0x29')](function(_0x42c68b){logger[_0x50ae('0x26')](util['format'](_0x50ae('0x2a'),EXTRACTED_REPORT_ID,_0x50ae('0xa')),util[_0x50ae('0x2b')](_0x42c68b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x50ae('0x2c'));})[_0x50ae('0x2d')](function(){process[_0x50ae('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 2e8cb93..8cb9ef4 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 _0xc479=['models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extensions','extension','find','push','type','format','context','VoiceExtensionId','Set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','lodash','util'];(function(_0x351a9a,_0xe7a7b9){var _0x4bbd53=function(_0x25bcb6){while(--_0x25bcb6){_0x351a9a['push'](_0x351a9a['shift']());}};_0x4bbd53(++_0xe7a7b9);}(_0xc479,0x152));var _0x9c47=function(_0x4d74f9,_0x53421d){_0x4d74f9=_0x4d74f9-0x0;var _0xcb39b4=_0xc479[_0x4d74f9];return _0xcb39b4;};'use strict';var _=require(_0x9c47('0x0'));var util=require(_0x9c47('0x1'));function rewrite(_0x294b68,_0x4881e6){var _0x429062=this;return _0x294b68[_0x9c47('0x2')][_0x9c47('0x3')][_0x9c47('0x4')]({'raw':!![]})['then'](function(_0x389526){_0x429062[_0x9c47('0x5')]=_0x389526;return _0x294b68[_0x9c47('0x2')][_0x9c47('0x6')][_0x9c47('0x4')]({'where':{'IntervalId':_0x4881e6[_0x9c47('0x7')]},'raw':!![]});})[_0x9c47('0x8')](function(_0x11f534){return _0x294b68[_0x9c47('0x2')][_0x9c47('0x6')][_0x9c47('0x4')]({'where':{'exten':{'$in':_[_0x9c47('0x9')](_[_0x9c47('0xa')](_0x11f534,_0x9c47('0xb')))}},'order':[{'raw':_0x9c47('0xc')}],'raw':!![]});})[_0x9c47('0x8')](function(_0x168cfc){var _0x49d965=_['filter'](_0x168cfc,{'priority':'1'});var _0x421cbc=_[_0x9c47('0xd')](_0x168cfc,{'isApp':0x1});var _0x52aa88=_[_0x9c47('0xe')](_0x421cbc,_0x9c47('0xb'));var _0x3c182d=['queue',_0x9c47('0xf')];var _0x38cf5d=[];var _0x26694c=[];for(var _0x527583 in _0x52aa88){if(_0x52aa88['hasOwnProperty'](_0x527583)){_0x429062[_0x9c47('0x10')]=0x2;_0x429062[_0x9c47('0x11')]=[];_0x429062[_0x9c47('0x12')]=_[_0x9c47('0x13')](_0x49d965,{'exten':_0x52aa88[_0x527583][0x0]['exten']});_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':util[_0x9c47('0x16')]('CDR(type)=%s',_0x52aa88[_0x527583][0x0]['type']),'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});if(_0x52aa88[_0x527583][0x0][_0x9c47('0x15')]==='inbound'){_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x52aa88[_0x527583][0x0][_0x9c47('0x18')],'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});}else if(_0x52aa88[_0x527583][0x0][_0x9c47('0x15')]==='outbound'){if(_0x429062[_0x9c47('0x12')]){_0x429062['extensions']['push']({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':_0x9c47('0x19'),'appdata':_0x9c47('0x1a')+(_0x429062['extension'][_0x9c47('0x1b')]?_0x9c47('0x1c')+_0x429062['extension'][_0x9c47('0x1b')]+'}':_0x9c47('0x1d')),'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});}_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':_0x9c47('0x19'),'appdata':'CDR(routeid)='+_0x52aa88[_0x527583][0x0]['VoiceExtensionId'],'context':_0x52aa88[_0x527583][0x0]['context'],'exten':_0x52aa88[_0x527583][0x0]['exten'],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});var _0x51a9c0=_0x429062[_0x9c47('0x10')]++;_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':_0x9c47('0x1e'),'appdata':_0x9c47('0x1f')+(_0x51a9c0+0x2)+_0x9c47('0x20')+(_0x51a9c0+0x1)+')','context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0]['exten'],'priority':_0x51a9c0,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});if(_0x429062[_0x9c47('0x12')]){_0x429062[_0x9c47('0x11')]['push']({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':_0x429062[_0x9c47('0x12')]['cutdigits']?_0x9c47('0x21')+_0x429062[_0x9c47('0x12')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x52aa88[_0x527583][0x0]['context'],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});}_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':_0x9c47('0x22')+_0x52aa88[_0x527583][0x0][_0x9c47('0x18')],'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});if(_0x429062[_0x9c47('0x12')]&&_0x429062[_0x9c47('0x12')][_0x9c47('0x23')](_0x9c47('0x24'))&&_0x429062[_0x9c47('0x12')][_0x9c47('0x24')]!==_0x9c47('0x25')){_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':_0x9c47('0x19'),'appdata':_0x9c47('0x26'),'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x429062[_0x9c47('0x12')][_0x9c47('0x24')]||_0x9c47('0x27'),'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0]['exten'],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});}}_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':_0x9c47('0x28'),'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0]['VoiceExtensionId']});_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0]['exten'],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0]['VoiceExtensionId']});_0x429062[_0x9c47('0x11')][_0x9c47('0x14')]({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':'Set','appdata':_0x9c47('0x29'),'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'priority':_0x429062[_0x9c47('0x10')]++,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});for(var _0x47a22d=0x0,_0x2fc431=0x0;_0x47a22d<_0x52aa88[_0x527583][_0x9c47('0x2a')];_0x47a22d+=0x1,_0x2fc431=0x0){var _0x4acec9=_0x52aa88[_0x527583][_0x47a22d];if(_0x4acec9[_0x9c47('0x15')]){_0x4acec9[_0x9c47('0x15')]=_0x4acec9[_0x9c47('0x15')][_0x9c47('0x2b')]();}var _0xe2967a=[];var _0x2c0d5d=[];delete _0x4acec9['id'];delete _0x4acec9['createdAt'];delete _0x4acec9[_0x9c47('0x2c')];var _0x98644d=_0x4acec9['interval']!==_0x9c47('0x2d')?[_0x4acec9[_0x9c47('0x2e')]]:_0x4acec9[_0x9c47('0x7')]?_[_0x9c47('0xa')](_[_0x9c47('0xd')](_0x429062['intervals'],{'IntervalId':_0x4acec9[_0x9c47('0x7')]}),_0x9c47('0x2e')):[];if(_0x4acec9[_0x9c47('0x23')](_0x9c47('0x2f'))){if(_0x4acec9[_0x9c47('0x2f')]&&_0x4acec9['tag']!=='--'){_0xe2967a[_0x9c47('0x14')]({'type':_0x4acec9['type'],'app':_0x9c47('0x19'),'appdata':_0x9c47('0x30')+_0x4acec9[_0x9c47('0x2f')],'context':_0x4acec9[_0x9c47('0x17')],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9[_0x9c47('0x18')]});}}if(_0x4acec9[_0x9c47('0x15')]===_0x9c47('0x31')&&_0x4acec9['hasOwnProperty'](_0x9c47('0x32'))){if(_0x4acec9['callerID']){_0xe2967a[_0x9c47('0x14')]({'type':_0x4acec9['type'],'app':_0x9c47('0x1e'),'appdata':_0x9c47('0x33')+_0x4acec9['callerID']+')','context':_0x4acec9['context'],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9[_0x9c47('0x18')]});}else{_0xe2967a[_0x9c47('0x14')]({'type':_0x4acec9['type'],'app':_0x9c47('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x4acec9[_0x9c47('0x17')],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9[_0x9c47('0x18')]});}}if(_0x4acec9[_0x9c47('0x23')](_0x9c47('0x34'))){if(_0x3c182d[_0x9c47('0x35')](_0x4acec9['app'][_0x9c47('0x2b')]())>=0x0&&_0x4acec9['appType']!==_0x9c47('0x36')){if(_0x4acec9[_0x9c47('0x34')]){_0xe2967a[_0x9c47('0x14')]({'type':_0x4acec9[_0x9c47('0x15')],'app':_0x9c47('0x1e'),'appdata':_0x9c47('0x37'),'context':_0x4acec9['context'],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9[_0x9c47('0x18')]});_0xe2967a[_0x9c47('0x14')]({'type':_0x4acec9['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4acec9[_0x9c47('0x17')],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9['VoiceExtensionId']});}else{_0xe2967a['push']({'type':_0x4acec9[_0x9c47('0x15')],'app':_0x9c47('0x1e'),'appdata':_0x9c47('0x38'),'context':_0x4acec9[_0x9c47('0x17')],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9[_0x9c47('0x18')]});_0xe2967a[_0x9c47('0x14')]({'type':_0x4acec9[_0x9c47('0x15')],'app':_0x9c47('0x19'),'appdata':_0x9c47('0x39'),'context':_0x4acec9[_0x9c47('0x17')],'exten':_0x4acec9[_0x9c47('0xb')],'priority':_0x98644d[_0x9c47('0x2a')]+_0x429062[_0x9c47('0x10')]+_0x2fc431++,'VoiceExtensionId':_0x4acec9[_0x9c47('0x18')]});}}}for(var _0x5746ee=0x0;_0x5746ee<_0x98644d[_0x9c47('0x2a')];_0x5746ee+=0x1){var _0x217fee=_0x429062[_0x9c47('0x10')]+_0x98644d['length'];var _0x22e911=_0x5746ee===_0x98644d[_0x9c47('0x2a')]-0x1?_0x429062[_0x9c47('0x10')]+_0xe2967a['length']+_0x2c0d5d[_0x9c47('0x2a')]+0x2:_0x429062[_0x9c47('0x10')]+_0x5746ee+0x1;_0xe2967a[_0x9c47('0x3a')](_0x5746ee,0x0,{'type':_0x4acec9[_0x9c47('0x15')],'app':_0x9c47('0x3b'),'appdata':_0x98644d[_0x5746ee]+'?'+_0x4acec9[_0x9c47('0x17')]+_0x9c47('0x3c')+_0x217fee+':'+_0x4acec9['context']+_0x9c47('0x3c')+_0x22e911,'exten':_0x4acec9[_0x9c47('0xb')],'context':_0x4acec9['context'],'priority':_0x429062['priority']+_0x5746ee,'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});}_0x4acec9[_0x9c47('0x10')]=_0xe2967a['length']?_[_0x9c47('0x3d')](_0xe2967a)[_0x9c47('0x10')]+0x1:_0x429062['priority'];_0x429062[_0x9c47('0x10')]=(_0x2c0d5d['length']?_[_0x9c47('0x3d')](_0x2c0d5d)[_0x9c47('0x10')]:_0x4acec9['priority'])+0x1;_0x429062[_0x9c47('0x11')]=_[_0x9c47('0x3e')](_0x429062[_0x9c47('0x11')],_0xe2967a,[_0x4acec9],_0x2c0d5d);}_0x429062['extensions']['push']({'type':_0x52aa88[_0x527583][0x0][_0x9c47('0x15')],'app':_0x9c47('0x3f'),'exten':_0x52aa88[_0x527583][0x0][_0x9c47('0xb')],'context':_0x52aa88[_0x527583][0x0][_0x9c47('0x17')],'priority':_0x429062[_0x9c47('0x10')],'VoiceExtensionId':_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]});_0x38cf5d['push'](_0x52aa88[_0x527583][0x0][_0x9c47('0x18')]);_0x26694c=_[_0x9c47('0x3e')](_0x26694c,_0x429062[_0x9c47('0x11')]);}}return _0x294b68[_0x9c47('0x40')](function(_0x1e51c7){return _0x294b68['models'][_0x9c47('0x6')][_0x9c47('0x41')]({'where':{'VoiceExtensionId':{'$in':_0x38cf5d}},'transaction':_0x1e51c7})['then'](function(_0x1938f7){return _0x294b68[_0x9c47('0x2')][_0x9c47('0x6')][_0x9c47('0x42')](_['sortBy'](_0x26694c,'priority'),{'transaction':_0x1e51c7});});});})[_0x9c47('0x43')](function(_0x513310){console['error'](_0x513310);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xd257=['$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','map','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','sortBy','catch','rewrite','lodash','util','models','Interval','intervals','VoiceExtension','findAll','IntervalId','then','uniq','exten','filter','groupBy','queue','hasOwnProperty','priority','extension','find','extensions','push','format','type','context','VoiceExtensionId','outbound','Set','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)='];(function(_0x17e10d,_0xd2880d){var _0x1af860=function(_0x917373){while(--_0x917373){_0x17e10d['push'](_0x17e10d['shift']());}};_0x1af860(++_0xd2880d);}(_0xd257,0xf6));var _0x7d25=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xd257[_0x1e4150];return _0x1ce3ee;};'use strict';var _=require(_0x7d25('0x0'));var util=require(_0x7d25('0x1'));function rewrite(_0x20e53b,_0x4350a2){var _0x4bc485=this;return _0x20e53b[_0x7d25('0x2')][_0x7d25('0x3')]['findAll']({'raw':!![]})['then'](function(_0x423cdf){_0x4bc485[_0x7d25('0x4')]=_0x423cdf;return _0x20e53b[_0x7d25('0x2')][_0x7d25('0x5')][_0x7d25('0x6')]({'where':{'IntervalId':_0x4350a2[_0x7d25('0x7')]},'raw':!![]});})[_0x7d25('0x8')](function(_0xb7e259){return _0x20e53b[_0x7d25('0x2')]['VoiceExtension'][_0x7d25('0x6')]({'where':{'exten':{'$in':_[_0x7d25('0x9')](_['map'](_0xb7e259,_0x7d25('0xa')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x24b68f){var _0x3a3abd=_['filter'](_0x24b68f,{'priority':'1'});var _0x1333b2=_[_0x7d25('0xb')](_0x24b68f,{'isApp':0x1});var _0x3fb294=_[_0x7d25('0xc')](_0x1333b2,'exten');var _0x45afc7=[_0x7d25('0xd'),'playback'];var _0x5ee93c=[];var _0x45f898=[];for(var _0x3f0dd1 in _0x3fb294){if(_0x3fb294[_0x7d25('0xe')](_0x3f0dd1)){_0x4bc485[_0x7d25('0xf')]=0x2;_0x4bc485['extensions']=[];_0x4bc485[_0x7d25('0x10')]=_[_0x7d25('0x11')](_0x3a3abd,{'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')]});_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':'Set','appdata':util[_0x7d25('0x14')]('CDR(type)=%s',_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')]),'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});if(_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')]==='inbound'){_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':'Set','appdata':'CDR(routeid)='+_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')],'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});}else if(_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')]===_0x7d25('0x18')){if(_0x4bc485[_0x7d25('0x10')]){_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x1a')+(_0x4bc485[_0x7d25('0x10')][_0x7d25('0x1b')]?'${EXTEN:'+_0x4bc485[_0x7d25('0x10')]['cutdigits']+'}':_0x7d25('0x1c')),'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0]['exten'],'priority':_0x4bc485['priority']++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});}_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')],'app':'Set','appdata':_0x7d25('0x1d')+_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')],'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0]['exten'],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});var _0x469dfc=_0x4bc485['priority']++;_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')],'app':'ExecIf','appdata':_0x7d25('0x1e')+(_0x469dfc+0x2)+_0x7d25('0x1f')+(_0x469dfc+0x1)+')','context':_0x3fb294[_0x3f0dd1][0x0]['context'],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x469dfc,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});if(_0x4bc485[_0x7d25('0x10')]){_0x4bc485['extensions'][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':_0x7d25('0x19'),'appdata':_0x4bc485[_0x7d25('0x10')]['cutdigits']?_0x7d25('0x20')+_0x4bc485[_0x7d25('0x10')][_0x7d25('0x1b')]+'}':_0x7d25('0x21'),'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0]['exten'],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});}_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x22')+_0x3fb294[_0x3f0dd1][0x0]['VoiceExtensionId'],'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0]['VoiceExtensionId']});if(_0x4bc485['extension']&&_0x4bc485[_0x7d25('0x10')]['hasOwnProperty'](_0x7d25('0x23'))&&_0x4bc485[_0x7d25('0x10')]['recordingFormat']!==_0x7d25('0x24')){_0x4bc485[_0x7d25('0x12')]['push']({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x25'),'context':_0x3fb294[_0x3f0dd1][0x0]['context'],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x26')+_0x4bc485[_0x7d25('0x10')][_0x7d25('0x23')]||_0x7d25('0x27'),'context':_0x3fb294[_0x3f0dd1][0x0]['context'],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0]['VoiceExtensionId']});}}_0x4bc485[_0x7d25('0x12')]['push']({'type':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')],'app':'Set','appdata':_0x7d25('0x28'),'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485['priority']++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x15')],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x29'),'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x2a'),'context':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x16')],'exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'priority':_0x4bc485[_0x7d25('0xf')]++,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});for(var _0x2bc8b4=0x0,_0x3b6216=0x0;_0x2bc8b4<_0x3fb294[_0x3f0dd1][_0x7d25('0x2b')];_0x2bc8b4+=0x1,_0x3b6216=0x0){var _0x4a3af8=_0x3fb294[_0x3f0dd1][_0x2bc8b4];if(_0x4a3af8[_0x7d25('0x15')]){_0x4a3af8[_0x7d25('0x15')]=_0x4a3af8[_0x7d25('0x15')]['toLowerCase']();}var _0x4813e3=[];var _0x1adb34=[];delete _0x4a3af8['id'];delete _0x4a3af8[_0x7d25('0x2c')];delete _0x4a3af8['updatedAt'];var _0x415874=_0x4a3af8[_0x7d25('0x2d')]!=='*,*,*,*'?[_0x4a3af8[_0x7d25('0x2d')]]:_0x4a3af8[_0x7d25('0x7')]?_[_0x7d25('0x2e')](_['filter'](_0x4bc485[_0x7d25('0x4')],{'IntervalId':_0x4a3af8[_0x7d25('0x7')]}),_0x7d25('0x2d')):[];if(_0x4a3af8['hasOwnProperty']('tag')){if(_0x4a3af8[_0x7d25('0x2f')]&&_0x4a3af8['tag']!=='--'){_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8[_0x7d25('0x15')],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x30')+_0x4a3af8[_0x7d25('0x2f')],'context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8[_0x7d25('0xa')],'priority':_0x415874[_0x7d25('0x2b')]+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8[_0x7d25('0x17')]});}}if(_0x4a3af8[_0x7d25('0x15')]==='outbound'&&_0x4a3af8[_0x7d25('0xe')]('callerID')){if(_0x4a3af8[_0x7d25('0x31')]){_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8[_0x7d25('0x15')],'app':_0x7d25('0x32'),'appdata':_0x7d25('0x33')+_0x4a3af8[_0x7d25('0x31')]+')','context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8['exten'],'priority':_0x415874[_0x7d25('0x2b')]+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8[_0x7d25('0x17')]});}else{_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8['type'],'app':_0x7d25('0x32'),'appdata':_0x7d25('0x34'),'context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8[_0x7d25('0xa')],'priority':_0x415874['length']+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8[_0x7d25('0x17')]});}}if(_0x4a3af8['hasOwnProperty'](_0x7d25('0x35'))){if(_0x45afc7[_0x7d25('0x36')](_0x4a3af8[_0x7d25('0x37')]['toLowerCase']())>=0x0&&_0x4a3af8[_0x7d25('0x38')]!==_0x7d25('0x39')){if(_0x4a3af8[_0x7d25('0x35')]){_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8[_0x7d25('0x15')],'app':_0x7d25('0x32'),'appdata':_0x7d25('0x3a'),'context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8[_0x7d25('0xa')],'priority':_0x415874[_0x7d25('0x2b')]+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8[_0x7d25('0x17')]});_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8[_0x7d25('0x15')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8[_0x7d25('0xa')],'priority':_0x415874[_0x7d25('0x2b')]+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8['VoiceExtensionId']});}else{_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8[_0x7d25('0x15')],'app':_0x7d25('0x32'),'appdata':_0x7d25('0x3b'),'context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8[_0x7d25('0xa')],'priority':_0x415874[_0x7d25('0x2b')]+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8['VoiceExtensionId']});_0x4813e3[_0x7d25('0x13')]({'type':_0x4a3af8[_0x7d25('0x15')],'app':_0x7d25('0x19'),'appdata':_0x7d25('0x3c'),'context':_0x4a3af8[_0x7d25('0x16')],'exten':_0x4a3af8[_0x7d25('0xa')],'priority':_0x415874[_0x7d25('0x2b')]+_0x4bc485[_0x7d25('0xf')]+_0x3b6216++,'VoiceExtensionId':_0x4a3af8[_0x7d25('0x17')]});}}}for(var _0x2a4f06=0x0;_0x2a4f06<_0x415874[_0x7d25('0x2b')];_0x2a4f06+=0x1){var _0x29ebdd=_0x4bc485[_0x7d25('0xf')]+_0x415874[_0x7d25('0x2b')];var _0x47f8f0=_0x2a4f06===_0x415874[_0x7d25('0x2b')]-0x1?_0x4bc485[_0x7d25('0xf')]+_0x4813e3[_0x7d25('0x2b')]+_0x1adb34[_0x7d25('0x2b')]+0x2:_0x4bc485['priority']+_0x2a4f06+0x1;_0x4813e3[_0x7d25('0x3d')](_0x2a4f06,0x0,{'type':_0x4a3af8['type'],'app':_0x7d25('0x3e'),'appdata':_0x415874[_0x2a4f06]+'?'+_0x4a3af8['context']+_0x7d25('0x3f')+_0x29ebdd+':'+_0x4a3af8['context']+_0x7d25('0x3f')+_0x47f8f0,'exten':_0x4a3af8['exten'],'context':_0x4a3af8[_0x7d25('0x16')],'priority':_0x4bc485['priority']+_0x2a4f06,'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0]['VoiceExtensionId']});}_0x4a3af8[_0x7d25('0xf')]=_0x4813e3[_0x7d25('0x2b')]?_[_0x7d25('0x40')](_0x4813e3)[_0x7d25('0xf')]+0x1:_0x4bc485[_0x7d25('0xf')];_0x4bc485[_0x7d25('0xf')]=(_0x1adb34[_0x7d25('0x2b')]?_[_0x7d25('0x40')](_0x1adb34)[_0x7d25('0xf')]:_0x4a3af8[_0x7d25('0xf')])+0x1;_0x4bc485[_0x7d25('0x12')]=_[_0x7d25('0x41')](_0x4bc485[_0x7d25('0x12')],_0x4813e3,[_0x4a3af8],_0x1adb34);}_0x4bc485[_0x7d25('0x12')][_0x7d25('0x13')]({'type':_0x3fb294[_0x3f0dd1][0x0]['type'],'app':'Hangup','exten':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0xa')],'context':_0x3fb294[_0x3f0dd1][0x0]['context'],'priority':_0x4bc485['priority'],'VoiceExtensionId':_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]});_0x5ee93c[_0x7d25('0x13')](_0x3fb294[_0x3f0dd1][0x0][_0x7d25('0x17')]);_0x45f898=_['concat'](_0x45f898,_0x4bc485[_0x7d25('0x12')]);}}return _0x20e53b['transaction'](function(_0xfee942){return _0x20e53b[_0x7d25('0x2')][_0x7d25('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x5ee93c}},'transaction':_0xfee942})['then'](function(_0x55019b){return _0x20e53b['models'][_0x7d25('0x5')]['bulkCreate'](_[_0x7d25('0x42')](_0x45f898,'priority'),{'transaction':_0xfee942});});});})[_0x7d25('0x43')](function(_0x587d71){console['error'](_0x587d71);});}exports[_0x7d25('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index e65af9b..b4bf2ae 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 _0x0c82=['push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','into','cm_hopper','fromQuery','ContactId','createdAt','select','field','NOW()','scheduledAt','toString','updatedAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','insert','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','str','cm_hopper_black','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','query','all','findAll','BlackLists','Campaign','CampaignId','emit','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x0c82,0x188));var _0x20c8=function(_0x4608ac,_0x340cd9){_0x4608ac=_0x4608ac-0x0;var _0x318daa=_0x0c82[_0x4608ac];return _0x318daa;};'use strict';var BPromise=require(_0x20c8('0x0'));var util=require('util');var _=require(_0x20c8('0x1'));var fs=require('fs');var squel=require(_0x20c8('0x2'));var Papa=require(_0x20c8('0x3'));var Redis=require(_0x20c8('0x4'));var db=require(_0x20c8('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x20c8('0x6'))(_0x20c8('0x7'));config[_0x20c8('0x8')]=_['defaults'](config[_0x20c8('0x8')],{'host':_0x20c8('0x9'),'port':0x18eb});var socket=require(_0x20c8('0xa'))(new Redis(config[_0x20c8('0x8')]));require(_0x20c8('0xb'))[_0x20c8('0xc')](socket);try{if(!process[_0x20c8('0xd')][0x2]||process[_0x20c8('0xd')][0x2]===_0x20c8('0xe')||process['argv'][0x2]==='null'){throw new Error(_0x20c8('0xf'));}var FILEPATH=process[_0x20c8('0xd')][0x2];if(!process[_0x20c8('0xd')][0x3]||process[_0x20c8('0xd')][0x3]==='undefined'||process['argv'][0x3]===_0x20c8('0x10')||!process[_0x20c8('0xd')][0x4]||process['argv'][0x4]===_0x20c8('0xe')||process['argv'][0x4]===_0x20c8('0x10')){throw new Error(_0x20c8('0x11'));}var FIELDS=_[_0x20c8('0x12')](process['argv'][0x3][_0x20c8('0x13')](','),process[_0x20c8('0xd')][0x4][_0x20c8('0x13')](','));if(!process[_0x20c8('0xd')][0x5]||process[_0x20c8('0xd')][0x5]==='undefined'||process[_0x20c8('0xd')][0x5]===_0x20c8('0x10')){throw new Error(_0x20c8('0x14'));}var LISTID=process[_0x20c8('0xd')][0x5];var COMPANYID=process[_0x20c8('0xd')][0x6]&&process[_0x20c8('0xd')][0x6]!=='undefined'&&process[_0x20c8('0xd')][0x6]!==_0x20c8('0x10')?process[_0x20c8('0xd')][0x6]:null;var DUPLICATES=process[_0x20c8('0xd')][0x7]&&process[_0x20c8('0xd')][0x7]!=='undefined'&&process[_0x20c8('0xd')][0x7]!==_0x20c8('0x10')?process[_0x20c8('0xd')][0x7]:null;if(!process['argv'][0x8]||process[_0x20c8('0xd')][0x8]===_0x20c8('0xe')||process[_0x20c8('0xd')][0x8]===_0x20c8('0x10')){throw new Error(_0x20c8('0x15'));}var SOCKET_TIMESTAMP=process[_0x20c8('0xd')][0x8];}catch(_0x268176){logger[_0x20c8('0x16')](_0x268176);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(_0x77d3e4,_0x578f03,_0x4eb6d9,_0x1128cf){var _0xc79c00={'message':_0x578f03};_0xc79c00[_0x77d3e4]=!![];if(_0x4eb6d9){_0xc79c00[_0x20c8('0x17')]=_0x4eb6d9;}if(_0x1128cf){_0xc79c00[_0x20c8('0x18')]=_0x1128cf;}return _0xc79c00;}function isEmail(_0x1f84e6){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))*$/[_0x20c8('0x19')](_0x1f84e6);}function checkRow(_0xd7b10c,_0xa183e6,_0x401b9f){return new BPromise(function(_0x57211f,_0x1abc70){if(_[_0x20c8('0x1a')](_0xd7b10c)){return _0x1abc70(handleCheckRowError('error',_0x20c8('0x1b'),null,_0x401b9f));}if(_0xd7b10c['errors']&&_0xd7b10c[_0x20c8('0x1c')][_0x20c8('0x1d')]){var _0x5ca21f=_[_0x20c8('0x1e')](_0xd7b10c[_0x20c8('0x1c')],_0x20c8('0x1f'))[_0x20c8('0x20')](';');return _0x1abc70(handleCheckRowError(_0x20c8('0x16'),_0x5ca21f,null,_0x401b9f));}var _0x50f03={};for(var _0xdadfad in FIELDS){if(FIELDS[_0x20c8('0x21')](_0xdadfad)&&FIELDS[_0xdadfad]){_0x50f03[_0xdadfad]=_0xd7b10c[_0x20c8('0x22')][0x0][FIELDS[_0xdadfad]]||_0xd7b10c['data'][0x0]['\ufeff'+FIELDS[_0xdadfad]];}}if(!_0x50f03[_0x20c8('0x23')]){return _0x1abc70(handleCheckRowError(_0x20c8('0x16'),_0x20c8('0x24'),null,_0x401b9f));}if(!_0x50f03[_0x20c8('0x25')]){return _0x1abc70(handleCheckRowError('error',_0x20c8('0x26'),null,_0x401b9f));}if(_0x50f03[_0x20c8('0x27')]){var _0xcb04fb=moment(_0x50f03[_0x20c8('0x27')],_0x20c8('0x28'));if(!_0xcb04fb[_0x20c8('0x29')]()){return _0x1abc70(handleCheckRowError(_0x20c8('0x16'),_0x20c8('0x2a'),null,_0x401b9f));}}if(_0x50f03['email']){if(!isEmail(_0x50f03[_0x20c8('0x2b')])){return _0x1abc70(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x401b9f));}}_0x50f03[_0x20c8('0x2c')]=LISTID;_0x50f03[_0x20c8('0x2d')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0xa183e6){var _0x4c9902={};for(var _0x5bb736=0x0,_0x3e5eee=DUPLICATES[_0x20c8('0x1d')];_0x5bb736<_0x3e5eee;_0x5bb736+=0x1){_0x4c9902[DUPLICATES[_0x5bb736]]=_0x50f03[DUPLICATES[_0x5bb736]];}var _0xdcbe0b=_[_0x20c8('0x2e')](_0xa183e6,_0x4c9902);if(_0xdcbe0b){return _0x1abc70(handleCheckRowError('duplicate',_0x20c8('0x2f'),_0xdcbe0b,_0x401b9f));}}return db[_0x20c8('0x30')][_0x20c8('0x31')](_0x50f03,{'raw':!![],'hooks':![],'fields':_[_0x20c8('0x32')](_0x50f03)})[_0x20c8('0x33')](function(_0x6cf510){if(DUPLICATES&&DUPLICATES['length']&&_0xa183e6){_0xa183e6[_0x20c8('0x34')](_[_0x20c8('0x35')](_0x50f03,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x6cf510['id'];return _0x57211f();})[_0x20c8('0x36')](function(_0x3c4182){return _0x1abc70(handleCheckRowError(_0x20c8('0x16'),_0x20c8('0x37')+(_0x3c4182['message']||JSON[_0x20c8('0x38')](_0x3c4182)),null,_0x401b9f));});});}function checkHopper(){function _0x5918bd(){return function(_0x3036fe){logger['error'](_0x20c8('0x39'),'checkHopper',util[_0x20c8('0x3a')](_0x3036fe,{'showHidden':![],'depth':null}));};}var _0x2579a5=function(_0x4f0477,_0xb76967){var _0x340c1c=squel['insert']()[_0x20c8('0x3b')](_0x20c8('0x3c'))[_0x20c8('0x3d')](['phone','scheduledAt',_0x20c8('0x3e'),_0x20c8('0x2c'),_0xb76967,_0x20c8('0x3f'),'updatedAt'],squel[_0x20c8('0x40')]()[_0x20c8('0x41')]('phone',_0x20c8('0x25'))[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x43'))[_0x20c8('0x41')]('id',_0x20c8('0x3e'))[_0x20c8('0x41')](LISTID[_0x20c8('0x44')](),_0x20c8('0x2c'))['field'](_0x4f0477['id'][_0x20c8('0x44')](),_0xb76967)['field'](_0x20c8('0x42'),_0x20c8('0x3f'))[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x45'))[_0x20c8('0x46')](_0x20c8('0x47'))[_0x20c8('0x48')](_0x20c8('0x49'))[_0x20c8('0x48')]('ListId\x20=\x20?',LISTID[_0x20c8('0x44')]())[_0x20c8('0x48')](_0x20c8('0x4a'))['where'](_0x20c8('0x4b'),squel['select']()[_0x20c8('0x41')](_0x20c8('0x25'))['from'](_0x20c8('0x3c'))[_0x20c8('0x48')](_0xb76967+'\x20=\x20?',_0x4f0477['id'][_0x20c8('0x44')]())))[_0x20c8('0x44')]();return _0x340c1c;};var _0x488315=function(_0x5d4e83,_0x3f61ec){var _0x1c9d46=squel[_0x20c8('0x4c')]()[_0x20c8('0x3b')]('cm_hopper')[_0x20c8('0x3d')]([_0x20c8('0x25'),'scheduledAt',_0x20c8('0x3e'),_0x20c8('0x2c'),_0x3f61ec,_0x20c8('0x3f'),_0x20c8('0x45')],squel[_0x20c8('0x40')]()['field']('phone',_0x20c8('0x25'))[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x43'))['field']('id',_0x20c8('0x3e'))[_0x20c8('0x41')](LISTID[_0x20c8('0x44')](),'ListId')[_0x20c8('0x41')](_0x5d4e83['id']['toString'](),_0x3f61ec)[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x3f'))[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x45'))[_0x20c8('0x46')](_0x20c8('0x47'))[_0x20c8('0x48')]('deletedAt\x20IS\x20NULL')[_0x20c8('0x48')](_0x20c8('0x4d'),LISTID['toString']())[_0x20c8('0x48')](_0x20c8('0x4e'),squel['str'](hopperContacts))[_0x20c8('0x48')](_0x20c8('0x4a'))[_0x20c8('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x20c8('0x40')]()[_0x20c8('0x41')](_0x20c8('0x4f'))[_0x20c8('0x46')](_0x20c8('0x50'))[_0x20c8('0x48')](_0x3f61ec+'\x20=\x20?',_0x5d4e83['id'][_0x20c8('0x44')]()))[_0x20c8('0x48')](_0x20c8('0x4b'),squel[_0x20c8('0x40')]()['field'](_0x20c8('0x25'))['from'](_0x20c8('0x3c'))[_0x20c8('0x48')](_0x3f61ec+'\x20=\x20?',_0x5d4e83['id'][_0x20c8('0x44')]())))[_0x20c8('0x44')]();return _0x1c9d46;};function _0x3dc7cd(_0x153941,_0x3c970f){var _0x3a1eeb=squel[_0x20c8('0x4c')]()['into'](_0x20c8('0x3c'))['fromQuery'](['phone','scheduledAt','ContactId',_0x20c8('0x2c'),_0x3c970f,_0x20c8('0x3f'),'updatedAt'],squel[_0x20c8('0x40')]()['field'](_0x20c8('0x25'),'phone')[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x43'))[_0x20c8('0x41')]('id',_0x20c8('0x3e'))[_0x20c8('0x41')](LISTID[_0x20c8('0x44')](),_0x20c8('0x2c'))['field'](_0x153941['id'][_0x20c8('0x44')](),_0x3c970f)[_0x20c8('0x41')](_0x20c8('0x42'),'createdAt')[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x45'))[_0x20c8('0x46')](_0x20c8('0x47'))[_0x20c8('0x48')]('deletedAt\x20IS\x20NULL')[_0x20c8('0x48')](_0x20c8('0x4d'),LISTID[_0x20c8('0x44')]())['where'](_0x20c8('0x4e'),squel[_0x20c8('0x51')](hopperContacts))[_0x20c8('0x48')](_0x20c8('0x4a')))['toString']();return _0x3a1eeb;}function _0x181711(_0x55092e,_0x1530d3){var _0x5a7d7d=squel[_0x20c8('0x4c')]()['into'](_0x20c8('0x52'))['fromQuery']([_0x20c8('0x25'),_0x20c8('0x3e'),_0x20c8('0x2c'),_0x1530d3,_0x20c8('0x3f'),_0x20c8('0x45')],squel[_0x20c8('0x40')]()['field'](_0x20c8('0x25'),_0x20c8('0x25'))[_0x20c8('0x41')]('id','ContactId')['field'](LISTID[_0x20c8('0x44')](),_0x20c8('0x2c'))['field'](_0x55092e['id']['toString'](),_0x1530d3)['field'](_0x20c8('0x42'),_0x20c8('0x3f'))[_0x20c8('0x41')](_0x20c8('0x42'),_0x20c8('0x45'))[_0x20c8('0x46')]('cm_contacts')[_0x20c8('0x48')](_0x20c8('0x49'))[_0x20c8('0x48')](_0x20c8('0x4d'),LISTID['toString']())[_0x20c8('0x48')](_0x20c8('0x4e'),squel[_0x20c8('0x51')](hopperContacts))[_0x20c8('0x48')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5a7d7d;}return db['VoiceQueue']['findAll']({'where':{'type':_0x20c8('0x53')},'attributes':['id',_0x20c8('0x54')],'include':[{'model':db[_0x20c8('0x55')],'as':_0x20c8('0x56'),'where':{'id':LISTID}}]})[_0x20c8('0x33')](function(_0x109dca){var _0x1399c3=[];if(_0x109dca){var _0x1678ae;for(var _0x4fcd23=0x0,_0x11833d;_0x4fcd23<_0x109dca[_0x20c8('0x1d')];_0x4fcd23+=0x1){_0x11833d=_0x109dca[_0x4fcd23][_0x20c8('0x57')]({'plain':!![]});switch(_0x11833d[_0x20c8('0x54')]){case _0x20c8('0x58'):_0x1399c3[_0x20c8('0x34')](db[_0x20c8('0x59')]['query'](_0x488315(_0x11833d,_0x20c8('0x5a')))[_0x20c8('0x33')](function(){})['catch'](_0x5918bd()));break;case'onlyIfOpen':_0x1399c3[_0x20c8('0x34')](db[_0x20c8('0x59')][_0x20c8('0x5b')](_0x2579a5(_0x11833d,_0x20c8('0x5a')))[_0x20c8('0x33')](function(){})[_0x20c8('0x36')](_0x5918bd()));break;default:_0x1399c3[_0x20c8('0x34')](db['sequelize']['query'](_0x3dc7cd(_0x11833d,_0x20c8('0x5a')))[_0x20c8('0x33')](function(){})[_0x20c8('0x36')](_0x5918bd()));}}}return _0x1399c3;})[_0x20c8('0x5c')]()[_0x20c8('0x33')](function(){return db['VoiceQueue'][_0x20c8('0x5d')]({'where':{'type':_0x20c8('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x20c8('0x5e'),'where':{'id':LISTID}}]})[_0x20c8('0x33')](function(_0x42f94c){var _0x4ae876=[];if(_0x42f94c){var _0x4c8ead;for(var _0x705a5b=0x0,_0x52af03;_0x705a5b<_0x42f94c[_0x20c8('0x1d')];_0x705a5b+=0x1){_0x52af03=_0x42f94c[_0x705a5b]['get']({'plain':!![]});_0x4ae876[_0x20c8('0x34')](db[_0x20c8('0x59')]['query'](_0x181711(_0x52af03,_0x20c8('0x5a')))[_0x20c8('0x33')](function(){})[_0x20c8('0x36')](_0x5918bd()));}}return _0x4ae876;})[_0x20c8('0x5c')]();})[_0x20c8('0x33')](function(){return db[_0x20c8('0x5f')][_0x20c8('0x5d')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x20c8('0x56'),'where':{'id':LISTID}}]})[_0x20c8('0x33')](function(_0x5aba19){var _0x2c8575=[];if(_0x5aba19){for(var _0xe7174b=0x0,_0x16bf94;_0xe7174b<_0x5aba19[_0x20c8('0x1d')];_0xe7174b+=0x1){_0x16bf94=_0x5aba19[_0xe7174b][_0x20c8('0x57')]({'plain':!![]});switch(_0x16bf94['dialCheckDuplicateType']){case _0x20c8('0x58'):_0x2c8575[_0x20c8('0x34')](db[_0x20c8('0x59')][_0x20c8('0x5b')](_0x488315(_0x16bf94,'CampaignId'))['then'](function(){})[_0x20c8('0x36')](_0x5918bd()));break;case'onlyIfOpen':_0x2c8575[_0x20c8('0x34')](db[_0x20c8('0x59')]['query'](_0x2579a5(_0x16bf94,_0x20c8('0x60')))[_0x20c8('0x33')](function(){})['catch'](_0x5918bd()));break;default:_0x2c8575[_0x20c8('0x34')](db['sequelize'][_0x20c8('0x5b')](_0x3dc7cd(_0x16bf94,_0x20c8('0x60')))[_0x20c8('0x33')](function(){})[_0x20c8('0x36')](_0x5918bd()));}}}return _0x2c8575;})[_0x20c8('0x5c')]();})[_0x20c8('0x33')](function(){return db[_0x20c8('0x5f')][_0x20c8('0x5d')]({'attributes':['id'],'include':[{'model':db[_0x20c8('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x20c8('0x33')](function(_0x51944e){var _0x504c45=[];if(_0x51944e){for(var _0x19d3d2=0x0,_0x173862;_0x19d3d2<_0x51944e[_0x20c8('0x1d')];_0x19d3d2+=0x1){_0x173862=_0x51944e[_0x19d3d2]['get']({'plain':!![]});_0x504c45[_0x20c8('0x34')](db['sequelize'][_0x20c8('0x5b')](_0x181711(_0x173862,_0x20c8('0x60')))[_0x20c8('0x33')](function(){})['catch'](_0x5918bd()));}}return _0x504c45;})[_0x20c8('0x5c')]();})['catch'](function(_0x5efb96){logger[_0x20c8('0x16')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x5efb96[_0x20c8('0x1f')]);});}var processPromises=function(_0x5ae951){return BPromise[_0x20c8('0x5c')](promises)['then'](function(_0x3dc0f3){})[_0x20c8('0x36')](function(_0x23a12b){logger[_0x20c8('0x16')]('Error\x20processing\x20rows\x20block:',JSON[_0x20c8('0x38')](_0x23a12b));})['finally'](function(){socket[_0x20c8('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5ae951){return _0x5ae951[_0x20c8('0x62')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x20c8('0x33')](function(){socket[_0x20c8('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x20c8('0x63')](FILEPATH);}catch(_0x545f52){logger[_0x20c8('0x16')](_0x20c8('0x64'),JSON[_0x20c8('0x38')](_0x545f52));}finally{process['exit'](0x0);}});};process['on'](_0x20c8('0x65'),function(){logger[_0x20c8('0x66')](_0x20c8('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0x20c8('0x33')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x20c8('0x13')](',');return db[_0x20c8('0x30')][_0x20c8('0x5d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x20c8('0x33')](function(_0x54ce59){var _0x361e5e=fs[_0x20c8('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x20c8('0x69')](_0x361e5e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x223fd4,_0x51e308){total+=0x1;var _0x53b279=total;promises[_0x20c8('0x34')](checkRow(_0x223fd4,_0x54ce59,_0x53b279)[_0x20c8('0x33')](function(){success+=0x1;})[_0x20c8('0x36')](function(_0x5d67f6){if(_0x5d67f6[_0x20c8('0x16')]){errors+=0x1;delete _0x5d67f6[_0x20c8('0x16')];}else if(_0x5d67f6[_0x20c8('0x6a')]){duplicates+=0x1;delete _0x5d67f6['duplicate'];}rows[_0x20c8('0x34')](_0x5d67f6);}));if(total%0xc8===0x0){_0x51e308[_0x20c8('0x6b')]();return processPromises(_0x51e308);}},'complete':function(){return processPromises()[_0x20c8('0x33')](function(){logger[_0x20c8('0x66')](_0x20c8('0x6c'));endCsv();});},'error':function(_0xa3ad89,_0x32fb5a){logger[_0x20c8('0x66')](_0x20c8('0x6d'),JSON[_0x20c8('0x38')](_0xa3ad89));endCsv();}});})[_0x20c8('0x36')](function(_0x4495bd){logger['error'](_0x20c8('0x6e'),JSON[_0x20c8('0x38')](_0x4495bd));});}main(); \ No newline at end of file +var _0x77a4=['CmContact','createReadStream','duplicate','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','test','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','length','find','Duplicate\x20Contact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','cm_hopper_final','VoiceQueue','findAll','outbound','CmList','Lists','always','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','BlackLists','Campaign','get','dialCheckDuplicateType','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x77a4,0xdf));var _0x477a=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x77a4[_0x3ce2c4];return _0x4047c1;};'use strict';var BPromise=require('bluebird');var util=require(_0x477a('0x0'));var _=require(_0x477a('0x1'));var fs=require('fs');var squel=require(_0x477a('0x2'));var Papa=require(_0x477a('0x3'));var Redis=require(_0x477a('0x4'));var db=require(_0x477a('0x5'))['db'];var config=require(_0x477a('0x6'));var logger=require(_0x477a('0x7'))(_0x477a('0x8'));config[_0x477a('0x9')]=_[_0x477a('0xa')](config[_0x477a('0x9')],{'host':_0x477a('0xb'),'port':0x18eb});var socket=require(_0x477a('0xc'))(new Redis(config[_0x477a('0x9')]));require(_0x477a('0xd'))[_0x477a('0xe')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x477a('0xf')||process[_0x477a('0x10')][0x2]==='null'){throw new Error(_0x477a('0x11'));}var FILEPATH=process[_0x477a('0x10')][0x2];if(!process[_0x477a('0x10')][0x3]||process['argv'][0x3]===_0x477a('0xf')||process[_0x477a('0x10')][0x3]===_0x477a('0x12')||!process[_0x477a('0x10')][0x4]||process[_0x477a('0x10')][0x4]===_0x477a('0xf')||process[_0x477a('0x10')][0x4]===_0x477a('0x12')){throw new Error(_0x477a('0x13'));}var FIELDS=_[_0x477a('0x14')](process[_0x477a('0x10')][0x3][_0x477a('0x15')](','),process[_0x477a('0x10')][0x4][_0x477a('0x15')](','));if(!process['argv'][0x5]||process[_0x477a('0x10')][0x5]==='undefined'||process[_0x477a('0x10')][0x5]===_0x477a('0x12')){throw new Error(_0x477a('0x16'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x477a('0x10')][0x6]&&process[_0x477a('0x10')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x477a('0x12')?process[_0x477a('0x10')][0x6]:null;var DUPLICATES=process[_0x477a('0x10')][0x7]&&process[_0x477a('0x10')][0x7]!==_0x477a('0xf')&&process['argv'][0x7]!==_0x477a('0x12')?process[_0x477a('0x10')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0x477a('0x10')][0x8]===_0x477a('0x12')){throw new Error(_0x477a('0x17'));}var SOCKET_TIMESTAMP=process[_0x477a('0x10')][0x8];}catch(_0x31c21e){logger[_0x477a('0x18')](_0x31c21e);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(_0x5bc842,_0x3d6b3d,_0x42452f,_0x4a7bf0){var _0xd755ce={'message':_0x3d6b3d};_0xd755ce[_0x5bc842]=!![];if(_0x42452f){_0xd755ce['contact']=_0x42452f;}if(_0x4a7bf0){_0xd755ce[_0x477a('0x19')]=_0x4a7bf0;}return _0xd755ce;}function isEmail(_0x5cdfdb){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))*$/[_0x477a('0x1a')](_0x5cdfdb);}function checkRow(_0x1e6723,_0x4721fb,_0x37dd20){return new BPromise(function(_0x5a8282,_0x5b34c2){if(_['isNil'](_0x1e6723)){return _0x5b34c2(handleCheckRowError(_0x477a('0x18'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x37dd20));}if(_0x1e6723[_0x477a('0x1b')]&&_0x1e6723['errors']['length']){var _0x54ce80=_[_0x477a('0x1c')](_0x1e6723[_0x477a('0x1b')],_0x477a('0x1d'))[_0x477a('0x1e')](';');return _0x5b34c2(handleCheckRowError('error',_0x54ce80,null,_0x37dd20));}var _0x112782={};for(var _0x521f75 in FIELDS){if(FIELDS[_0x477a('0x1f')](_0x521f75)&&FIELDS[_0x521f75]){_0x112782[_0x521f75]=_0x1e6723[_0x477a('0x20')][0x0][FIELDS[_0x521f75]]||_0x1e6723[_0x477a('0x20')][0x0]['\ufeff'+FIELDS[_0x521f75]];}}if(!_0x112782[_0x477a('0x21')]){return _0x5b34c2(handleCheckRowError(_0x477a('0x18'),_0x477a('0x22'),null,_0x37dd20));}if(!_0x112782['phone']){return _0x5b34c2(handleCheckRowError('error',_0x477a('0x23'),null,_0x37dd20));}if(_0x112782[_0x477a('0x24')]){var _0x46e0e=moment(_0x112782['birthDate'],'YYYY-MM-DD');if(!_0x46e0e[_0x477a('0x25')]()){return _0x5b34c2(handleCheckRowError(_0x477a('0x18'),_0x477a('0x26'),null,_0x37dd20));}}if(_0x112782[_0x477a('0x27')]){if(!isEmail(_0x112782[_0x477a('0x27')])){return _0x5b34c2(handleCheckRowError(_0x477a('0x18'),_0x477a('0x28'),null,_0x37dd20));}}_0x112782['ListId']=LISTID;_0x112782['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x477a('0x29')]&&_0x4721fb){var _0x3dd01f={};for(var _0x5ca8cf=0x0,_0x3810f0=DUPLICATES['length'];_0x5ca8cf<_0x3810f0;_0x5ca8cf+=0x1){_0x3dd01f[DUPLICATES[_0x5ca8cf]]=_0x112782[DUPLICATES[_0x5ca8cf]];}var _0x306bf5=_[_0x477a('0x2a')](_0x4721fb,_0x3dd01f);if(_0x306bf5){return _0x5b34c2(handleCheckRowError('duplicate',_0x477a('0x2b'),_0x306bf5,_0x37dd20));}}return db['CmContact']['create'](_0x112782,{'raw':!![],'hooks':![],'fields':_[_0x477a('0x2c')](_0x112782)})[_0x477a('0x2d')](function(_0x130349){if(DUPLICATES&&DUPLICATES[_0x477a('0x29')]&&_0x4721fb){_0x4721fb[_0x477a('0x2e')](_[_0x477a('0x2f')](_0x112782,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x130349['id'];return _0x5a8282();})['catch'](function(_0x5e61ae){return _0x5b34c2(handleCheckRowError('error',_0x477a('0x30')+(_0x5e61ae['message']||JSON[_0x477a('0x31')](_0x5e61ae)),null,_0x37dd20));});});}function checkHopper(){function _0x518916(){return function(_0x5c4942){logger[_0x477a('0x18')](_0x477a('0x32'),_0x477a('0x33'),util[_0x477a('0x34')](_0x5c4942,{'showHidden':![],'depth':null}));};}var _0x17ed33=function(_0x30ed0c,_0x1c5468){var _0x498eb9=squel[_0x477a('0x35')]()[_0x477a('0x36')](_0x477a('0x37'))['fromQuery']([_0x477a('0x38'),_0x477a('0x39'),_0x477a('0x3a'),_0x477a('0x3b'),_0x1c5468,'createdAt',_0x477a('0x3c')],squel[_0x477a('0x3d')]()[_0x477a('0x3e')](_0x477a('0x38'),_0x477a('0x38'))[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x39'))[_0x477a('0x3e')]('id','ContactId')[_0x477a('0x3e')](LISTID[_0x477a('0x40')](),'ListId')['field'](_0x30ed0c['id'][_0x477a('0x40')](),_0x1c5468)[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x41'))['field'](_0x477a('0x3f'),'updatedAt')[_0x477a('0x42')](_0x477a('0x43'))[_0x477a('0x44')](_0x477a('0x45'))[_0x477a('0x44')](_0x477a('0x46'),LISTID[_0x477a('0x40')]())['where'](_0x477a('0x47'))['where'](_0x477a('0x48'),squel[_0x477a('0x3d')]()[_0x477a('0x3e')](_0x477a('0x38'))[_0x477a('0x42')](_0x477a('0x37'))[_0x477a('0x44')](_0x1c5468+_0x477a('0x49'),_0x30ed0c['id'][_0x477a('0x40')]())))[_0x477a('0x40')]();return _0x498eb9;};var _0x1476e3=function(_0x23f0e6,_0x775423){var _0x53b194=squel['insert']()['into'](_0x477a('0x37'))[_0x477a('0x4a')]([_0x477a('0x38'),'scheduledAt',_0x477a('0x3a'),_0x477a('0x3b'),_0x775423,_0x477a('0x41'),'updatedAt'],squel[_0x477a('0x3d')]()[_0x477a('0x3e')]('phone',_0x477a('0x38'))[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x39'))[_0x477a('0x3e')]('id',_0x477a('0x3a'))['field'](LISTID[_0x477a('0x40')](),_0x477a('0x3b'))[_0x477a('0x3e')](_0x23f0e6['id'][_0x477a('0x40')](),_0x775423)[_0x477a('0x3e')](_0x477a('0x3f'),'createdAt')['field'](_0x477a('0x3f'),'updatedAt')[_0x477a('0x42')]('cm_contacts')['where'](_0x477a('0x45'))[_0x477a('0x44')](_0x477a('0x46'),LISTID[_0x477a('0x40')]())[_0x477a('0x44')](_0x477a('0x4b'),squel['str'](hopperContacts))[_0x477a('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x477a('0x44')](_0x477a('0x48'),squel[_0x477a('0x3d')]()[_0x477a('0x3e')]('calleridnum')[_0x477a('0x42')](_0x477a('0x4c'))[_0x477a('0x44')](_0x775423+_0x477a('0x49'),_0x23f0e6['id'][_0x477a('0x40')]()))[_0x477a('0x44')](_0x477a('0x48'),squel['select']()[_0x477a('0x3e')](_0x477a('0x38'))[_0x477a('0x42')](_0x477a('0x37'))['where'](_0x775423+_0x477a('0x49'),_0x23f0e6['id'][_0x477a('0x40')]())))[_0x477a('0x40')]();return _0x53b194;};function _0xa9772(_0x9cb862,_0x53d38f){var _0xf54e14=squel[_0x477a('0x35')]()[_0x477a('0x36')](_0x477a('0x37'))['fromQuery'](['phone','scheduledAt',_0x477a('0x3a'),'ListId',_0x53d38f,_0x477a('0x41'),_0x477a('0x3c')],squel['select']()[_0x477a('0x3e')](_0x477a('0x38'),_0x477a('0x38'))[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x39'))['field']('id',_0x477a('0x3a'))[_0x477a('0x3e')](LISTID[_0x477a('0x40')](),_0x477a('0x3b'))[_0x477a('0x3e')](_0x9cb862['id']['toString'](),_0x53d38f)[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x41'))[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x3c'))[_0x477a('0x42')](_0x477a('0x43'))[_0x477a('0x44')](_0x477a('0x45'))[_0x477a('0x44')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x477a('0x4b'),squel['str'](hopperContacts))[_0x477a('0x44')](_0x477a('0x47')))[_0x477a('0x40')]();return _0xf54e14;}function _0x189ad3(_0x5992a0,_0x426fd3){var _0x3914d1=squel['insert']()[_0x477a('0x36')]('cm_hopper_black')[_0x477a('0x4a')]([_0x477a('0x38'),_0x477a('0x3a'),_0x477a('0x3b'),_0x426fd3,'createdAt','updatedAt'],squel['select']()[_0x477a('0x3e')](_0x477a('0x38'),'phone')['field']('id',_0x477a('0x3a'))[_0x477a('0x3e')](LISTID['toString'](),_0x477a('0x3b'))[_0x477a('0x3e')](_0x5992a0['id']['toString'](),_0x426fd3)[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x41'))[_0x477a('0x3e')](_0x477a('0x3f'),_0x477a('0x3c'))[_0x477a('0x42')]('cm_contacts')[_0x477a('0x44')](_0x477a('0x45'))[_0x477a('0x44')](_0x477a('0x46'),LISTID[_0x477a('0x40')]())['where'](_0x477a('0x4b'),squel['str'](hopperContacts))[_0x477a('0x44')](_0x477a('0x47')))[_0x477a('0x40')]();return _0x3914d1;}return db[_0x477a('0x4d')][_0x477a('0x4e')]({'where':{'type':_0x477a('0x4f')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x477a('0x50')],'as':_0x477a('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x2f965c){var _0x25755c=[];if(_0x2f965c){var _0x55f2db;for(var _0x51107c=0x0,_0x39a45b;_0x51107c<_0x2f965c[_0x477a('0x29')];_0x51107c+=0x1){_0x39a45b=_0x2f965c[_0x51107c]['get']({'plain':!![]});switch(_0x39a45b['dialCheckDuplicateType']){case _0x477a('0x52'):_0x25755c[_0x477a('0x2e')](db[_0x477a('0x53')][_0x477a('0x54')](_0x1476e3(_0x39a45b,_0x477a('0x55')))[_0x477a('0x2d')](function(){})[_0x477a('0x56')](_0x518916()));break;case _0x477a('0x57'):_0x25755c[_0x477a('0x2e')](db[_0x477a('0x53')][_0x477a('0x54')](_0x17ed33(_0x39a45b,_0x477a('0x55')))[_0x477a('0x2d')](function(){})[_0x477a('0x56')](_0x518916()));break;default:_0x25755c[_0x477a('0x2e')](db['sequelize'][_0x477a('0x54')](_0xa9772(_0x39a45b,_0x477a('0x55')))[_0x477a('0x2d')](function(){})['catch'](_0x518916()));}}}return _0x25755c;})[_0x477a('0x58')]()[_0x477a('0x2d')](function(){return db[_0x477a('0x4d')][_0x477a('0x4e')]({'where':{'type':_0x477a('0x4f')},'attributes':['id'],'include':[{'model':db[_0x477a('0x50')],'as':_0x477a('0x59'),'where':{'id':LISTID}}]})[_0x477a('0x2d')](function(_0x1a4a2c){var _0x4b77ec=[];if(_0x1a4a2c){var _0xf18e0d;for(var _0x3428e6=0x0,_0x574b0e;_0x3428e6<_0x1a4a2c['length'];_0x3428e6+=0x1){_0x574b0e=_0x1a4a2c[_0x3428e6]['get']({'plain':!![]});_0x4b77ec[_0x477a('0x2e')](db[_0x477a('0x53')][_0x477a('0x54')](_0x189ad3(_0x574b0e,'VoiceQueueId'))[_0x477a('0x2d')](function(){})['catch'](_0x518916()));}}return _0x4b77ec;})['all']();})[_0x477a('0x2d')](function(){return db[_0x477a('0x5a')][_0x477a('0x4e')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x477a('0x2d')](function(_0x26ffb9){var _0x1c9cd5=[];if(_0x26ffb9){for(var _0x4ddb9e=0x0,_0x1297f4;_0x4ddb9e<_0x26ffb9[_0x477a('0x29')];_0x4ddb9e+=0x1){_0x1297f4=_0x26ffb9[_0x4ddb9e][_0x477a('0x5b')]({'plain':!![]});switch(_0x1297f4[_0x477a('0x5c')]){case _0x477a('0x52'):_0x1c9cd5[_0x477a('0x2e')](db[_0x477a('0x53')]['query'](_0x1476e3(_0x1297f4,'CampaignId'))[_0x477a('0x2d')](function(){})[_0x477a('0x56')](_0x518916()));break;case _0x477a('0x57'):_0x1c9cd5[_0x477a('0x2e')](db[_0x477a('0x53')]['query'](_0x17ed33(_0x1297f4,_0x477a('0x5d')))[_0x477a('0x2d')](function(){})[_0x477a('0x56')](_0x518916()));break;default:_0x1c9cd5['push'](db[_0x477a('0x53')]['query'](_0xa9772(_0x1297f4,_0x477a('0x5d')))[_0x477a('0x2d')](function(){})['catch'](_0x518916()));}}}return _0x1c9cd5;})['all']();})[_0x477a('0x2d')](function(){return db[_0x477a('0x5a')][_0x477a('0x4e')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x477a('0x59'),'where':{'id':LISTID}}]})[_0x477a('0x2d')](function(_0x5411a4){var _0x3712e5=[];if(_0x5411a4){for(var _0x313611=0x0,_0x56dab7;_0x313611<_0x5411a4[_0x477a('0x29')];_0x313611+=0x1){_0x56dab7=_0x5411a4[_0x313611][_0x477a('0x5b')]({'plain':!![]});_0x3712e5['push'](db[_0x477a('0x53')]['query'](_0x189ad3(_0x56dab7,'CampaignId'))[_0x477a('0x2d')](function(){})['catch'](_0x518916()));}}return _0x3712e5;})['all']();})['catch'](function(_0x3e34d4){logger[_0x477a('0x18')](_0x477a('0x5e'),'generalCheckHopper',_0x3e34d4['message']);});}var processPromises=function(_0x594dae){return BPromise[_0x477a('0x58')](promises)['then'](function(_0x12bf09){})[_0x477a('0x56')](function(_0x4b5549){logger[_0x477a('0x18')](_0x477a('0x5f'),JSON[_0x477a('0x31')](_0x4b5549));})['finally'](function(){socket[_0x477a('0x60')](_0x477a('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x594dae){return _0x594dae['resume']();}});};var endCsv=function(){return BPromise[_0x477a('0x62')]()[_0x477a('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x477a('0x2d')](function(){socket[_0x477a('0x60')](_0x477a('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x477a('0x63')](FILEPATH);}catch(_0x2ba9ba){logger['error'](_0x477a('0x64'),JSON[_0x477a('0x31')](_0x2ba9ba));}finally{process[_0x477a('0x65')](0x0);}});};process['on'](_0x477a('0x66'),function(){logger[_0x477a('0x67')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x477a('0x15')](',');return db[_0x477a('0x68')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1fcd32){var _0x51dca8=fs[_0x477a('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x51dca8,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c6e9b,_0x1fe9d2){total+=0x1;var _0x31e111=total;promises[_0x477a('0x2e')](checkRow(_0x4c6e9b,_0x1fcd32,_0x31e111)[_0x477a('0x2d')](function(){success+=0x1;})['catch'](function(_0x3e9866){if(_0x3e9866[_0x477a('0x18')]){errors+=0x1;delete _0x3e9866[_0x477a('0x18')];}else if(_0x3e9866[_0x477a('0x6a')]){duplicates+=0x1;delete _0x3e9866[_0x477a('0x6a')];}rows[_0x477a('0x2e')](_0x3e9866);}));if(total%0xc8===0x0){_0x1fe9d2['pause']();return processPromises(_0x1fe9d2);}},'complete':function(){return processPromises()[_0x477a('0x2d')](function(){logger[_0x477a('0x67')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x3b39bd,_0x1a89e2){logger[_0x477a('0x67')](_0x477a('0x6b'),JSON[_0x477a('0x31')](_0x3b39bd));endCsv();}});})['catch'](function(_0x504dd3){logger[_0x477a('0x18')](_0x477a('0x6c'),JSON[_0x477a('0x31')](_0x504dd3));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 6d6c3f9..e0b69b2 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 _0x1ea4=['SystemRow','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','finish','affectedRows','emit','contact:import:','unlink','existsSync','file\x20doesn\x27t\x20exists','argv','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment/shared','../../../config/logger','import','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','length','push','split','all','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','ListId','createdAt','updatedAt','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(?)','toString','into','cm_hopper_black','fromQuery','ListId\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.createdAt','insert','ContactId','priority','UserId','.CmListId\x20=\x20?','cm_contacts.phone','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','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)','min_id','group','info','Received\x20SIGINT','error','message','exit','code','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','query','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','findAll','name','_description','writeFileSync','data','rows','errors','find','isNil','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','agent\x20not\x20exists','email','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','itemTypeId'];(function(_0x456ea5,_0xb998d1){var _0xfc1c5=function(_0x4a2943){while(--_0x4a2943){_0x456ea5['push'](_0x456ea5['shift']());}};_0xfc1c5(++_0xb998d1);}(_0x1ea4,0xe0));var _0x41ea=function(_0x3c7602,_0xa55906){_0x3c7602=_0x3c7602-0x0;var _0x213ec5=_0x1ea4[_0x3c7602];return _0x213ec5;};'use strict';var fs=require('fs');var path=require(_0x41ea('0x0'));var _=require(_0x41ea('0x1'));var Papa=require(_0x41ea('0x2'));var util=require(_0x41ea('0x3'));var BPromise=require(_0x41ea('0x4'));var moment=require(_0x41ea('0x5'));var squel=require(_0x41ea('0x6'));var Redis=require('ioredis');var db=require(_0x41ea('0x7'))['db'];var config=require('../../../config/environment');var shared=require(_0x41ea('0x8'));var logger=require(_0x41ea('0x9'))(_0x41ea('0xa'));config[_0x41ea('0xb')]=_['defaults'](config[_0x41ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x41ea('0xc'))(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'](_0x41ea('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0x41ea('0xd'));function isEmail(_0x5962bf){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))*$/[_0x41ea('0xe')](_0x5962bf);}function selectNotIn(_0x63dbf,_0x30d8d3,_0x322042,_0x5cd0af,_0x32422f){return squel[_0x41ea('0xf')]()[_0x41ea('0x10')](_0x41ea('0x11'))[_0x41ea('0x12')](_0x5cd0af)[_0x41ea('0x13')](_0x30d8d3,null,_0x30d8d3+_0x41ea('0x14')+_0x5cd0af+'.'+_0x322042)[_0x41ea('0x15')](_0x5cd0af+'.'+_0x322042+'\x20=\x20'+_0x63dbf+'.'+_0x322042)['where'](_0x30d8d3+_0x41ea('0x16')+_0x32422f[_0x41ea('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x32fa02,_0x5491f8){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0x41ea('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x41ea('0x18')](function(_0x179ee1){if(_0x179ee1!==null){var _0x36616d=[];for(var _0x190c37=0x0;_0x190c37<_0x179ee1[_0x41ea('0x19')];_0x190c37++){var _0x169a12=_0x179ee1[_0x190c37];_0x36616d[_0x41ea('0x1a')](insertAdditionalPhones(_0x169a12));}}Promise['all'](_0x36616d)[_0x41ea('0x18')](function(){_0x32fa02({'val':0x1});});});});}function insertAdditionalPhones(_0x33863c){return new Promise(function(_0x42d025,_0x29bf78){var _0x5f2008=_0x33863c['AdditionalPhones'];var _0x32cd1e=_0x5f2008[_0x41ea('0x1b')](';');var _0x47a516=[];orderBy=0x0;for(var _0x94c1b1=0x0;_0x94c1b1<_0x32cd1e[_0x41ea('0x19')];_0x94c1b1++){_0x47a516[_0x41ea('0x1a')](splitAdditionalPhone(_0x33863c['id'],_0x32cd1e[_0x94c1b1]));}Promise[_0x41ea('0x1c')](_0x47a516)[_0x41ea('0x18')](function(){_0x42d025({'val':_0x32cd1e[_0x41ea('0x19')]});});});}function splitAdditionalPhone(_0x41e4e8,_0x52d4ce){return new Promise(function(_0x178e85,_0x13b070){var _0x5440de=_0x52d4ce[_0x41ea('0x1b')](':');var _0x579988=_0x5440de[0x0];var _0x1d929d=_0x5440de[0x1];if(!_['isNil'](_0x1d929d)){var _0x23e3e1=_0x1d929d['split']('|');var _0x27bec9=[];for(var _0x2927f4=0x0;_0x2927f4<_0x23e3e1['length'];_0x2927f4++){if(_0x23e3e1[_0x2927f4]!==''){var _0x79f1a9=_[_0x41ea('0x1d')](promisesAdditionalPhones,{'contactId':_0x41e4e8,'phone':_0x23e3e1[_0x2927f4]});if(_0x79f1a9[_0x41ea('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0x41ea('0x1a')]({'contactId':_0x41e4e8,'contactTypeId':_0x579988,'phone':_0x23e3e1[_0x2927f4],'orderBy':orderBy});}}}_0x178e85({'ok':0x1});}else _0x178e85({'res':0x0});});}function createAdditionalPhone(_0x5bb3e9,_0x2d50e1,_0x3b8cf0,_0x2963ef){var _0x3a2fb3='';var _0x2302b9='';var _0x514e9a=_0x3b8cf0[_0x41ea('0x1b')]('§');_0x3a2fb3=_0x514e9a[0x0];if(_0x514e9a[_0x41ea('0x19')]==0x2)_0x2302b9=_0x514e9a[0x1];return new Promise(function(_0x1d7f24,_0x519503){return db[_0x41ea('0x1e')][_0x41ea('0x1f')]({'where':{'CmContactId':_0x5bb3e9,'item':_0x3a2fb3}})[_0x41ea('0x18')](function(_0x2a38bd){if(_0x2a38bd){return db['CmContactHasItem'][_0x41ea('0x20')]({'ItemTypeId':_0x2d50e1,'description':_0x2302b9,'OrderBy':_0x2963ef},{'where':{'CmContactId':_0x5bb3e9,'item':_0x3a2fb3}})[_0x41ea('0x18')](function(_0x3c1518){_0x1d7f24({'res':_0x41ea('0x21')});});}else{return db[_0x41ea('0x1e')][_0x41ea('0x22')]({'CmContactId':_0x5bb3e9,'item':_0x3a2fb3,'description':_0x2302b9,'ItemTypeId':_0x2d50e1,'OrderBy':_0x2963ef,'ItemClass':_0x41ea('0x23')})['then'](function(_0x1bae1b){_0x1d7f24({'res':'inserted'});});}});});}function insertCmHopper(_0x574f75,_0x131ad2,_0x290b3b,_0x36034a,_0x13fbdc){var _0x3ba45c=['cm_contacts.phone',_0x41ea('0x24'),_0x41ea('0x25'),_0x41ea('0x26'),_0x131ad2+'.'+_0x36034a,'cm_contacts.createdAt',_0x41ea('0x27'),_0x41ea('0x28'),_0x41ea('0x29'),'\x22'+_0x13fbdc+'\x22'];return squel['insert']()['into'](_0x41ea('0x2a'))['fromQuery']([_0x41ea('0x11'),'scheduledat','ContactId',_0x41ea('0x2b'),_0x36034a,_0x41ea('0x2c'),_0x41ea('0x2d'),'priority','UserId',_0x41ea('0x2e')],squel['select']()[_0x41ea('0x2f')](_0x3ba45c)[_0x41ea('0x12')](_0x131ad2)['join'](_0x41ea('0x30'),null,_0x41ea('0x31')+_0x131ad2+_0x41ea('0x32'))['join'](_0x290b3b,null,_0x290b3b+_0x41ea('0x14')+_0x131ad2+'.'+_0x36034a)[_0x41ea('0x15')](_0x131ad2+'.CmListId\x20=\x20?',_0x574f75)[_0x41ea('0x15')](_0x41ea('0x33'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x131ad2,_0x290b3b,_0x36034a,'cm_hopper',[_0x41ea('0x34'),_0x41ea('0x35')]))[_0x41ea('0x15')](_0x41ea('0x36'),selectNotIn(_0x131ad2,_0x290b3b,_0x36034a,_0x41ea('0x2a'),[_0x41ea('0x34')])))[_0x41ea('0x37')]();}function insertCmHopperBlack(_0x31b46c,_0x39d503,_0x592898,_0xd6464){var _0x106351=['cm_contacts.phone',_0x41ea('0x25'),_0x41ea('0x26'),_0x39d503+'.'+_0xd6464,'cm_contacts.createdAt',_0x41ea('0x27')];return squel['insert']()[_0x41ea('0x38')](_0x41ea('0x39'))[_0x41ea('0x3a')]([_0x41ea('0x11'),'ContactId',_0x41ea('0x2b'),_0xd6464,_0x41ea('0x2c'),_0x41ea('0x2d')],squel[_0x41ea('0xf')]()['fields'](_0x106351)[_0x41ea('0x12')](_0x39d503)[_0x41ea('0x13')](_0x41ea('0x30'),null,_0x41ea('0x31')+_0x39d503+_0x41ea('0x32'))[_0x41ea('0x13')](_0x592898,null,_0x592898+_0x41ea('0x14')+_0x39d503+'.'+_0xd6464)[_0x41ea('0x15')](_0x39d503+'.CmListId\x20=\x20?',_0x31b46c)['where'](_0x41ea('0x33'),NOW)[_0x41ea('0x15')](_0x41ea('0x36'),squel[_0x41ea('0xf')]()[_0x41ea('0x10')]('phone')[_0x41ea('0x12')](_0x41ea('0x39'))[_0x41ea('0x15')](_0x41ea('0x3b'),_0x31b46c)[_0x41ea('0x15')](_0xd6464+_0x41ea('0x3c')+_0x39d503+'.'+_0xd6464)))[_0x41ea('0x37')]();}function insertTzCmHopper(_0x14c9cc,_0x584500,_0x15ac88,_0x3aace5,_0x5ee006,_0x284a88){var _0x19d8c4=['cm_contacts.phone',_0x41ea('0x3d')+_0x284a88+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id',_0x41ea('0x26'),_0x584500+'.'+_0x3aace5,_0x41ea('0x3e'),_0x41ea('0x27'),'cm_contacts.priority',_0x41ea('0x29'),'\x22'+_0x5ee006+'\x22'];var _0x35440a=squel[_0x41ea('0x3f')]()[_0x41ea('0x38')]('cm_hopper')[_0x41ea('0x3a')]([_0x41ea('0x11'),'scheduledat',_0x41ea('0x40'),'ListId',_0x3aace5,'createdAt',_0x41ea('0x2d'),_0x41ea('0x41'),_0x41ea('0x42'),_0x41ea('0x2e')],squel[_0x41ea('0xf')]()['fields'](_0x19d8c4)[_0x41ea('0x12')](_0x584500)[_0x41ea('0x13')]('cm_contacts',null,_0x41ea('0x31')+_0x584500+_0x41ea('0x32'))[_0x41ea('0x13')](_0x15ac88,null,_0x15ac88+_0x41ea('0x14')+_0x584500+'.'+_0x3aace5)['join'](_0x284a88,null,_0x284a88+_0x41ea('0x14')+_0x584500+'.'+_0x3aace5)[_0x41ea('0x15')](_0x584500+_0x41ea('0x43'),_0x14c9cc)[_0x41ea('0x15')](_0x41ea('0x33'),NOW)['where'](_0x41ea('0x36'),selectNotIn(_0x584500,_0x15ac88,_0x3aace5,_0x41ea('0x2a'),[_0x41ea('0x34'),_0x41ea('0x35')]))['where'](_0x41ea('0x36'),selectNotIn(_0x584500,_0x15ac88,_0x3aace5,_0x41ea('0x2a'),[_0x41ea('0x34')])))[_0x41ea('0x37')]();return _0x35440a;}function insertTzCmHopperBlack(_0x5966a2,_0xd769a5,_0x316b55,_0x375b1f){var _0x1d4066=[_0x41ea('0x44'),'cm_contacts.id','cm_contacts.ListId',_0xd769a5+'.'+_0x375b1f,_0x41ea('0x3e'),_0x41ea('0x27')];return squel[_0x41ea('0x3f')]()[_0x41ea('0x38')]('cm_hopper_black')[_0x41ea('0x3a')]([_0x41ea('0x11'),_0x41ea('0x40'),_0x41ea('0x2b'),_0x375b1f,_0x41ea('0x2c'),_0x41ea('0x2d')],squel[_0x41ea('0xf')]()[_0x41ea('0x2f')](_0x1d4066)[_0x41ea('0x12')](_0xd769a5)['join'](_0x41ea('0x30'),null,_0x41ea('0x31')+_0xd769a5+_0x41ea('0x32'))[_0x41ea('0x13')](_0x316b55,null,_0x316b55+_0x41ea('0x14')+_0xd769a5+'.'+_0x375b1f)['where'](_0xd769a5+_0x41ea('0x43'),_0x5966a2)[_0x41ea('0x15')](_0x41ea('0x33'),NOW)[_0x41ea('0x15')](_0x41ea('0x36'),squel[_0x41ea('0xf')]()[_0x41ea('0x10')]('phone')[_0x41ea('0x12')](_0x41ea('0x39'))[_0x41ea('0x15')]('ListId\x20=\x20?',_0x5966a2)['where'](_0x375b1f+_0x41ea('0x3c')+_0xd769a5+'.'+_0x375b1f)))[_0x41ea('0x37')]();}function insertCmHopperAdditionalPhones(_0x45667d){var _0xd309c9=[_0x41ea('0x45'),_0x41ea('0x46'),'cm_contact_has_items.OrderBy',_0x41ea('0x47'),_0x41ea('0x48')];return squel['insert']()[_0x41ea('0x38')](_0x41ea('0x49'))[_0x41ea('0x3a')]([_0x41ea('0x4a'),_0x41ea('0x11'),_0x41ea('0x4b'),_0x41ea('0x2c'),'updatedAt'],squel[_0x41ea('0xf')]()[_0x41ea('0x2f')](_0xd309c9)[_0x41ea('0x12')](_0x41ea('0x2a'))[_0x41ea('0x13')](_0x41ea('0x30'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x41ea('0x13')]('cm_contact_has_items',null,_0x41ea('0x4c'))[_0x41ea('0x15')](_0x41ea('0x4d'),_0x45667d)[_0x41ea('0x15')](_0x41ea('0x33'),NOW))['toString']();}function insertCmContact(_0x420096,_0xf044fb,_0x1b2d21,_0x3a17de){var _0x2e0d8d=_[_0x41ea('0x4e')](_[_0x41ea('0x4f')](_0x3a17de),[_0x41ea('0x2b'),'CompanyId',_0x41ea('0x2c'),_0x41ea('0x2d'),_0x41ea('0x50')]);return squel[_0x41ea('0x3f')]()[_0x41ea('0x38')]('cm_contacts')[_0x41ea('0x3a')](_0x2e0d8d,squel[_0x41ea('0xf')]()[_0x41ea('0x2f')](_0x2e0d8d)[_0x41ea('0x12')](_0xf044fb)[_0x41ea('0x15')]('('+_0x1b2d21[_0x41ea('0x13')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x41ea('0x2f')](_0x1b2d21)['from'](_0x41ea('0x30'))[_0x41ea('0x15')](_0x41ea('0x3b'),_0x420096)[_0x41ea('0x15')](_0x41ea('0x51')))[_0x41ea('0x15')](_0x41ea('0x52'),squel[_0x41ea('0xf')]()['field'](_0x41ea('0x53'),_0x41ea('0x54'))[_0x41ea('0x12')](_0xf044fb)[_0x41ea('0x55')](_0x1b2d21[_0x41ea('0x13')](','))))['toString']();}function handleStop(){logger[_0x41ea('0x56')](_0x41ea('0x57'));stopped=!![];}function handleUncaughtException(_0xa6cfbc){logger[_0x41ea('0x58')](_0xa6cfbc[_0x41ea('0x59')]);process[_0x41ea('0x5a')](0x1);}function handleError(_0x24c9b8,_0x2b070e){stats['errors']['push']({'name':_0x2b070e[_0x41ea('0x5b')],'message':_0x2b070e[_0x41ea('0x59')],'row':_0x24c9b8});}function handleQuery(_0x302b1c){logger[_0x41ea('0x56')](_0x302b1c);return db[_0x41ea('0x5c')]['query'](_0x302b1c)[_0x41ea('0x5d')](function(_0x2f794d){results['push'](_0x2f794d);})[_0x41ea('0x5e')](function(_0x5910b1){logger[_0x41ea('0x58')](_0x5910b1['message']);});}function updateTzCampaigns(_0x562409){return new Promise(function(_0xeebfb8,_0x30aca2){var _0x5df071=squel['select']()[_0x41ea('0x2f')]([_0x41ea('0x5f'),_0x41ea('0x60')])[_0x41ea('0x12')](_0x41ea('0x61'))[_0x41ea('0x13')]('campaigns_has_cm_lists',null,_0x41ea('0x62'))[_0x41ea('0x15')]('campaigns_has_cm_lists.CmListId='+_0x562409);db['sequelize']['query'](_0x5df071['toString']())[_0x41ea('0x5d')](function(_0x4521b7){var _0x505ca9=[];for(var _0x2b5a07=0x0;_0x2b5a07<_0x4521b7[_0x41ea('0x19')];_0x2b5a07++){_0x505ca9['push'](getTimezoneData(_0x4521b7[_0x2b5a07],tmp_campaigns));}BPromise[_0x41ea('0x1c')](_0x505ca9)['then'](function(){_0xeebfb8({'val':0x1});});})[_0x41ea('0x5e')](function(_0x37e3cf){logger[_0x41ea('0x58')](_0x37e3cf[_0x41ea('0x59')]);_0xeebfb8({'val':0x0});});});}function updateTzVoiceQueues(_0x3dfe22){return new Promise(function(_0xa1d401,_0x3e2b97){var _0x49c5aa=squel[_0x41ea('0xf')]()['fields']([_0x41ea('0x63'),_0x41ea('0x64')])[_0x41ea('0x12')](_0x41ea('0x65'))[_0x41ea('0x13')](_0x41ea('0x66'),null,_0x41ea('0x67'))[_0x41ea('0x15')]('voice_queues_has_cm_lists.CmListId='+_0x3dfe22);db['sequelize'][_0x41ea('0x68')](_0x49c5aa[_0x41ea('0x37')]())['spread'](function(_0x3fcf9e){var _0x172417=[];for(var _0x4a195a=0x0;_0x4a195a<_0x3fcf9e['length'];_0x4a195a++){_0x172417[_0x41ea('0x1a')](getTimezoneData(_0x3fcf9e[_0x4a195a],tmp_voice_queues));}BPromise[_0x41ea('0x1c')](_0x172417)[_0x41ea('0x18')](function(){_0xa1d401({'val':0x1});});})[_0x41ea('0x5e')](function(_0x553d3e){logger[_0x41ea('0x58')](_0x553d3e[_0x41ea('0x59')]);_0xa1d401({'val':0x0});});});}function getTimezoneData(_0x1e3331,_0x486076){return new Promise(function(_0x446d06,_0x38ed8e){var _0x26a368=shared[_0x41ea('0x69')];var _0x5d6686=_0x26a368[_0x1e3331[_0x41ea('0x6a')]];if(_['isNil'](_0x5d6686)){_0x446d06({'ret':0x1});}else{var _0x353cc5=_0x5d6686[_0x41ea('0x6b')];var _0x27e78c=squel[_0x41ea('0x3f')]()[_0x41ea('0x38')](_0x486076)[_0x41ea('0x6c')]('id',_0x1e3331['id'])['set'](_0x41ea('0x6d'),_0x353cc5)[_0x41ea('0x6c')]('dialTimezone',_0x1e3331[_0x41ea('0x6a')])['toString']();return db['sequelize'][_0x41ea('0x68')](_0x27e78c)['spread'](function(_0x90fd13){_0x446d06({'ret':0x1});})[_0x41ea('0x5e')](function(_0x4a81b8){logger[_0x41ea('0x58')](_0x4a81b8['message']);_0x38ed8e({'ret':0x1});});}});}function handleTZQuery(_0x2454dd){logger[_0x41ea('0x56')](_0x2454dd);return db[_0x41ea('0x5c')][_0x41ea('0x68')](_0x2454dd)[_0x41ea('0x5d')](function(_0x2bc56f){})[_0x41ea('0x5e')](function(_0x1c16e9){logger[_0x41ea('0x58')](_0x1c16e9[_0x41ea('0x59')]);});}function main(_0x5bae1c,_0x563aea,_0x135cec,_0x329c83){logger[_0x41ea('0x56')](_0x41ea('0x6e'),_0x5bae1c,JSON[_0x41ea('0x6f')](_0x563aea));process[_0x41ea('0x70')]('start');var _0x575290=_0x563aea[_0x41ea('0x71')];var _0xdfb1ea=_[_0x41ea('0x72')](_0x575290);var _0x2f5d15=_0x563aea[_0x41ea('0x73')];var _0x486534=path['join'](config[_0x41ea('0x74')],_0x41ea('0x75'),_0x2f5d15+_0x41ea('0x76'));hasTZ=_[_0x41ea('0x4f')](_0x575290)[_0x41ea('0x77')](_0x41ea('0x6a'));var _0x28c4f3=_[_0x41ea('0x4f')](_0x575290)[_0x41ea('0x13')]();logger[_0x41ea('0x56')](_0x41ea('0x78'),_0x28c4f3);db[_0x41ea('0x79')][_0x41ea('0x7a')]({'raw':!![],'attributes':['id',_0x41ea('0x7b')]})[_0x41ea('0x18')](function(_0xec5e9e){for(var _0x5151ff=0x0;_0x5151ff<_0xec5e9e[_0x41ea('0x19')];_0x5151ff++){if(_0xec5e9e[_0x5151ff][_0x41ea('0x7b')]in _0x575290){contactItemTypes[_0x41ea('0x1a')](_0xec5e9e[_0x5151ff]);delete _0xdfb1ea[_0xec5e9e[_0x5151ff][_0x41ea('0x7b')]];hasAdditionalPhones=!![];}for(var _0x51cbf0 in _0x575290){if(_0xec5e9e[_0x5151ff][_0x41ea('0x7b')]+_0x41ea('0x7c')===_0x51cbf0){phoneDescriptions[_0x41ea('0x1a')]({'itemTypeId':_0xec5e9e[_0x5151ff]['id'],'description':_0x51cbf0});delete _0xdfb1ea[_0x51cbf0];}}}if(hasAdditionalPhones)_0xdfb1ea[_0x41ea('0x17')]='';var _0x2f2878=_[_0x41ea('0x4f')](_0xdfb1ea)['join']();logger[_0x41ea('0x56')](_0x41ea('0x78'),_0x2f2878);fs[_0x41ea('0x7d')](_0x486534,_0x2f2878+'\x0a');Papa['parse'](fs['createReadStream'](_0x5bae1c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2b3679,_0x1e6e45){try{for(var _0xb04268=0x0,_0x463ff2=[];_0xb04268<_0x2b3679[_0x41ea('0x7e')]['length'];_0xb04268++){stats[_0x41ea('0x7f')]+=0x1;if(_0x2b3679[_0x41ea('0x80')][_0xb04268]){handleError(_0x2b3679['data'][_0xb04268],_0x2b3679['errors'][_0xb04268]);}else{var _0x47b948=[];var _0x2b797d=[];var _0x572f6a={};for(var _0x5c58a0 in _0x575290){let _0x113f70=contactItemTypes[_0x41ea('0x81')](_0x3f0d69=>_0x3f0d69[_0x41ea('0x7b')]===_0x5c58a0);let _0x2e3c60=contactItemTypes[_0x41ea('0x81')](_0x58b4c3=>_0x58b4c3[_0x41ea('0x7b')]+_0x41ea('0x7c')===_0x5c58a0);if(_[_0x41ea('0x82')](_0x113f70)&&_[_0x41ea('0x82')](_0x2e3c60)){if(_0x575290['hasOwnProperty'](_0x5c58a0)){if(_0x2b3679[_0x41ea('0x7e')][_0xb04268][_0x575290[_0x5c58a0]]){var _0x543095=_[_0x41ea('0x83')](_0x2b3679[_0x41ea('0x7e')][_0xb04268][_0x575290[_0x5c58a0]][_0x41ea('0x84')](/"/g,'\x27'));switch(_0x5c58a0){case _0x41ea('0x85'):var _0x111f99=moment(_0x543095,_0x41ea('0xd'),!![]);if(_0x111f99[_0x41ea('0x86')]()){_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x543095+'\x22');}else{_0x47b948[_0x41ea('0x1a')](_0x41ea('0x87'));}break;case _0x41ea('0x41'):var _0x41fe63=parseInt(_0x543095);_0x543095=_[_0x41ea('0x88')](_0x41fe63)||_0x41fe63<0x0||_0x41fe63>0x4?_0x329c83?0x3:0x2:_0x41fe63;_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x543095+'\x22');break;case _0x41ea('0x42'):var _0x12b441=parseInt(_0x543095);if(_['isNumber'](_0x12b441)&&_[_0x41ea('0x77')](_0x135cec,_0x12b441)){_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x12b441+'\x22');}else{_0x47b948[_0x41ea('0x1a')](_0x41ea('0x89'));}break;case _0x41ea('0x8a'):if(isEmail(_0x543095)){_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x543095+'\x22');}else{_0x47b948[_0x41ea('0x1a')]('email\x20wrong\x20format');}break;case _0x41ea('0x8b'):var _0x5908d5=moment(_0x543095,'YYYY-MM-DD',!![]);if(_0x5908d5[_0x41ea('0x86')]()){_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x543095+'\x22');}else{_0x47b948['push'](_0x41ea('0x8c'));}break;case _0x41ea('0x6a'):var _0x57b430=shared[_0x41ea('0x69')];var _0x221b66=_0x57b430[_0x543095];if(!_[_0x41ea('0x82')](_0x221b66)){var _0x41f249=_0x221b66['utcOffset'];_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x543095+'\x22');_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x41f249+'\x22');}break;default:_0x463ff2[_0x41ea('0x1a')]('\x22'+_0x543095+'\x22');}}else{switch(_0x5c58a0){case'firstName':case'phone':_0x47b948[_0x41ea('0x1a')](_0x5c58a0+'\x20not\x20specified');break;default:_0x463ff2[_0x41ea('0x1a')]('\x22\x22');}}}}else{var _0x329d8a='';if(!_['isNil'](_0x113f70)){if(!_0x572f6a['hasOwnProperty'](_0x113f70['id'])){if(!_[_0x41ea('0x82')](_0x2b3679[_0x41ea('0x7e')][_0xb04268][_0x575290[_0x5c58a0]])){var _0x543095=_[_0x41ea('0x83')](_0x2b3679[_0x41ea('0x7e')][_0xb04268][_0x575290[_0x5c58a0]]['replace'](/"/g,'\x27'));var _0x596739=phoneDescriptions['find'](_0x24038e=>_0x24038e[_0x41ea('0x8d')]===_0x113f70['id']);if(!_[_0x41ea('0x82')](_0x596739)){var _0x4b9ff5=_['trim'](_0x2b3679[_0x41ea('0x7e')][_0xb04268][_0x575290[_0x596739['description']]][_0x41ea('0x84')](/"/g,'\x27'));if(!_[_0x41ea('0x82')](_0x4b9ff5))_0x543095=_0x543095+'§'+_0x4b9ff5;}if(_0x329d8a=='')_0x329d8a=_0x543095;else _0x329d8a+='|'+_0x543095;}_0x2b797d['push'](_0x113f70['id']+':'+_0x329d8a);_0x572f6a[_0x113f70['id']]=0x1;}}}}if(hasAdditionalPhones){_0x463ff2['push']('\x22'+_0x2b797d[_0x41ea('0x13')](';')+'\x22');}if(_0x47b948[_0x41ea('0x19')]){handleError(_0x2b3679[_0x41ea('0x7e')][_0xb04268],{'code':_0x41ea('0x8e'),'message':_0x47b948[_0x41ea('0x13')]()});}else{fs['appendFileSync'](_0x486534,_0x463ff2[_0x41ea('0x13')]()+'\x0a');}_0x463ff2=[];}if(!(stats[_0x41ea('0x7f')]%0xc8)){socket['emit']('contact:import:'+_0x2f5d15,stats);stats[_0x41ea('0x80')]=[];}}if(stopped){logger[_0x41ea('0x56')](_0x41ea('0x8f'));_0x1e6e45[_0x41ea('0x90')]();}}catch(_0x11a012){handleError(_0x2b3679['data'][_0xb04268],{'code':_0x41ea('0x91'),'message':_0x11a012['message']});logger['error'](_0x41ea('0x92'),_0x11a012[_0x41ea('0x59')]);}},'complete':function(){try{var _0x3e6463=[];var _0x29b264=[];var _0x13fea5=_0x41ea('0x30');if(_0x563aea[_0x41ea('0x93')]&&_0x563aea[_0x41ea('0x93')][_0x41ea('0x19')]){_0x13fea5=_0x41ea('0x94')+_0x2f5d15;_0x3e6463[_0x41ea('0x1a')]('CREATE\x20TABLE\x20'+_0x13fea5+_0x41ea('0x95'));}tmp_campaigns=_0x41ea('0x96')+_0x2f5d15;tmp_voice_queues=_0x41ea('0x97')+_0x2f5d15;_0x29b264[_0x41ea('0x1a')](_0x41ea('0x98')+tmp_campaigns+_0x41ea('0x99'));_0x29b264[_0x41ea('0x1a')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0x41ea('0x99'));BPromise[_0x41ea('0x9a')](_0x29b264,handleTZQuery)[_0x41ea('0x18')](function(_0x4b0367){updateTzCampaigns(_0x563aea['ListId'])[_0x41ea('0x18')](function(_0x557596){updateTzVoiceQueues(_0x563aea[_0x41ea('0x2b')])[_0x41ea('0x18')](function(_0x594478){if(hasTZ)_0x2f2878=_0x2f2878[_0x41ea('0x84')](_0x41ea('0x6a'),_0x41ea('0x9b'));var _0x2b4ee2=util['format'](_0x41ea('0x9c'),_0x486534,_0x13fea5,_0x2f2878,_0x563aea['ListId'],_0x563aea[_0x41ea('0x9d')]||null,NOW,NOW);if(_['isNil'](_0x575290['scheduledat'])){_0x2b4ee2+=_0x41ea('0x9e');}_0x3e6463[_0x41ea('0x1a')](_0x2b4ee2);if(_0x563aea[_0x41ea('0x93')]&&_0x563aea[_0x41ea('0x93')][_0x41ea('0x19')]){_0x3e6463[_0x41ea('0x1a')](insertCmContact(_0x563aea[_0x41ea('0x2b')],_0x13fea5,_0x563aea[_0x41ea('0x93')],_0x575290));_0x3e6463['push'](_0x41ea('0x9f')+_0x13fea5+';');}BPromise['each'](_0x3e6463,handleQuery)[_0x41ea('0x18')](function(_0x35076e){BPromise[_0x41ea('0x1c')]([handleAdditionalPhones()])[_0x41ea('0x18')](function(){_0x3e6463=[];for(var _0x283222=0x0;_0x283222\x20\x20');}var _0x501817=path[_0x41ea('0x13')](config[_0x41ea('0x74')],_0x41ea('0x75'),process['argv'][0x2]);if(!fs[_0x41ea('0xad')](_0x501817)){throw new Error(_0x41ea('0xae'));}var _0x4b1d62={};try{_0x4b1d62=JSON['parse'](process[_0x41ea('0xaf')][0x3]);if(!_0x4b1d62['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x4b1d62[_0x41ea('0x71')]['phone']){throw new Error(_0x41ea('0xb0'));}if(!_0x4b1d62[_0x41ea('0x71')][_0x41ea('0xb1')]){throw new Error(_0x41ea('0xb2'));}var _0x232970=0x0;if(_0x4b1d62['binding'][_0x41ea('0x42')]){_0x232970=0x1;}if(!_0x4b1d62[_0x41ea('0x2b')]){throw new Error(_0x41ea('0xb3'));}}catch(_0x55c30e){throw new Error(_0x41ea('0xb4'));}var _0x192636=[];try{_0x192636=_['map'](JSON['parse'](process[_0x41ea('0xaf')][0x4]),'id');}catch(_0x43c3a8){logger[_0x41ea('0x56')](_0x41ea('0xb5'));}main(_0x501817,_0x4b1d62,_0x192636,_0x232970);}validate();process['on'](_0x41ea('0xb6'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xf6da=['dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','finish','affectedRows','unlink','complete','arguments\x20\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','squel','../../../config/environment/shared','../../../config/logger','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','length','then','split','push','all','isNil','filter','CmContactHasItem','findOne','update','updated','create','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','cm_contacts.createdAt','cm_hopper_black','fromQuery','updatedAt','field','ListId\x20=\x20?','\x20=\x20','toString','cm_contacts.priority','priority','.CmListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.createdAt','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?','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','info','Received\x20SIGINT','error','exit','errors','code','message','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','sequelize','query','timezones','dialTimezone','utcOffset','set','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','includes','keys','ContactItemType','name','_description','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format'];(function(_0x51a8d9,_0x303cbb){var _0x1820a5=function(_0x222796){while(--_0x222796){_0x51a8d9['push'](_0x51a8d9['shift']());}};_0x1820a5(++_0x303cbb);}(_0xf6da,0xe9));var _0xaf6d=function(_0x5a9126,_0xc1c87e){_0x5a9126=_0x5a9126-0x0;var _0x1134ed=_0xf6da[_0x5a9126];return _0x1134ed;};'use strict';var fs=require('fs');var path=require(_0xaf6d('0x0'));var _=require('lodash');var Papa=require(_0xaf6d('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xaf6d('0x2'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0xaf6d('0x3'));var logger=require(_0xaf6d('0x4'))('import');config['redis']=_['defaults'](config['redis'],{'host':_0xaf6d('0x5'),'port':0x18eb});var socket=require(_0xaf6d('0x6'))(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'](_0xaf6d('0x7'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xaf6d('0x8')](_0xaf6d('0x7'));function isEmail(_0x712cd9){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))*$/[_0xaf6d('0x9')](_0x712cd9);}function selectNotIn(_0x22bf38,_0x3b4973,_0x3784d3,_0x12a890,_0x4a3fce){return squel[_0xaf6d('0xa')]()['field'](_0xaf6d('0xb'))[_0xaf6d('0xc')](_0x12a890)[_0xaf6d('0xd')](_0x3b4973,null,_0x3b4973+_0xaf6d('0xe')+_0x12a890+'.'+_0x3784d3)[_0xaf6d('0xf')](_0x12a890+'.'+_0x3784d3+'\x20=\x20'+_0x22bf38+'.'+_0x3784d3)[_0xaf6d('0xf')](_0x3b4973+_0xaf6d('0x10')+_0x4a3fce[_0xaf6d('0xd')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0xad9a29,_0x1b001b){promisesAdditionalPhones=[];return db[_0xaf6d('0x11')][_0xaf6d('0x12')]({'raw':!![],'attributes':['id',_0xaf6d('0x13')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0xf541d3){if(_0xf541d3!==null){var _0x438969=[];for(var _0x5ea2c7=0x0;_0x5ea2c7<_0xf541d3[_0xaf6d('0x14')];_0x5ea2c7++){var _0x5ca38d=_0xf541d3[_0x5ea2c7];_0x438969['push'](insertAdditionalPhones(_0x5ca38d));}}Promise['all'](_0x438969)[_0xaf6d('0x15')](function(){_0xad9a29({'val':0x1});});});});}function insertAdditionalPhones(_0x39ad89){return new Promise(function(_0x1317c5,_0x1c1e8c){var _0x3c4f55=_0x39ad89['AdditionalPhones'];var _0x24486f=_0x3c4f55[_0xaf6d('0x16')](';');var _0x146c62=[];orderBy=0x0;for(var _0x3fbfe9=0x0;_0x3fbfe9<_0x24486f[_0xaf6d('0x14')];_0x3fbfe9++){_0x146c62[_0xaf6d('0x17')](splitAdditionalPhone(_0x39ad89['id'],_0x24486f[_0x3fbfe9]));}Promise[_0xaf6d('0x18')](_0x146c62)[_0xaf6d('0x15')](function(){_0x1317c5({'val':_0x24486f[_0xaf6d('0x14')]});});});}function splitAdditionalPhone(_0x1bc04c,_0x31332e){return new Promise(function(_0x10c0a4,_0x52b4ae){var _0x2cbcce=_0x31332e[_0xaf6d('0x16')](':');var _0x3614df=_0x2cbcce[0x0];var _0x330240=_0x2cbcce[0x1];if(!_[_0xaf6d('0x19')](_0x330240)){var _0x3b4064=_0x330240['split']('|');var _0x13257e=[];for(var _0x442f95=0x0;_0x442f95<_0x3b4064[_0xaf6d('0x14')];_0x442f95++){if(_0x3b4064[_0x442f95]!==''){var _0x2691a4=_[_0xaf6d('0x1a')](promisesAdditionalPhones,{'contactId':_0x1bc04c,'phone':_0x3b4064[_0x442f95]});if(_0x2691a4['length']==0x0){orderBy++;promisesAdditionalPhones[_0xaf6d('0x17')]({'contactId':_0x1bc04c,'contactTypeId':_0x3614df,'phone':_0x3b4064[_0x442f95],'orderBy':orderBy});}}}_0x10c0a4({'ok':0x1});}else _0x10c0a4({'res':0x0});});}function createAdditionalPhone(_0x2fed00,_0x290d2b,_0x21b6ed,_0x57730e){var _0x20143c='';var _0x5e3fd5='';var _0x151eab=_0x21b6ed[_0xaf6d('0x16')]('§');_0x20143c=_0x151eab[0x0];if(_0x151eab[_0xaf6d('0x14')]==0x2)_0x5e3fd5=_0x151eab[0x1];return new Promise(function(_0x488885,_0x11ece2){return db[_0xaf6d('0x1b')][_0xaf6d('0x1c')]({'where':{'CmContactId':_0x2fed00,'item':_0x20143c}})[_0xaf6d('0x15')](function(_0x1887b6){if(_0x1887b6){return db[_0xaf6d('0x1b')][_0xaf6d('0x1d')]({'ItemTypeId':_0x290d2b,'description':_0x5e3fd5,'OrderBy':_0x57730e},{'where':{'CmContactId':_0x2fed00,'item':_0x20143c}})[_0xaf6d('0x15')](function(_0xa412a5){_0x488885({'res':_0xaf6d('0x1e')});});}else{return db[_0xaf6d('0x1b')][_0xaf6d('0x1f')]({'CmContactId':_0x2fed00,'item':_0x20143c,'description':_0x5e3fd5,'ItemTypeId':_0x290d2b,'OrderBy':_0x57730e,'ItemClass':'PHONE'})[_0xaf6d('0x15')](function(_0x54b120){_0x488885({'res':_0xaf6d('0x20')});});}});});}function insertCmHopper(_0x35c10e,_0x192b99,_0x479998,_0x4350fc,_0x2bda1a){var _0x4f0164=[_0xaf6d('0x21'),'cm_contacts.scheduledat',_0xaf6d('0x22'),_0xaf6d('0x23'),_0x192b99+'.'+_0x4350fc,'cm_contacts.createdAt',_0xaf6d('0x24'),'cm_contacts.priority',_0xaf6d('0x25'),'\x22'+_0x2bda1a+'\x22'];return squel[_0xaf6d('0x26')]()[_0xaf6d('0x27')](_0xaf6d('0x28'))['fromQuery']([_0xaf6d('0xb'),_0xaf6d('0x29'),_0xaf6d('0x2a'),_0xaf6d('0x2b'),_0x4350fc,_0xaf6d('0x2c'),'updatedAt','priority',_0xaf6d('0x2d'),_0xaf6d('0x2e')],squel[_0xaf6d('0xa')]()[_0xaf6d('0x2f')](_0x4f0164)[_0xaf6d('0xc')](_0x192b99)[_0xaf6d('0xd')](_0xaf6d('0x30'),null,_0xaf6d('0x31')+_0x192b99+_0xaf6d('0x32'))[_0xaf6d('0xd')](_0x479998,null,_0x479998+_0xaf6d('0xe')+_0x192b99+'.'+_0x4350fc)[_0xaf6d('0xf')](_0x192b99+'.CmListId\x20=\x20?',_0x35c10e)[_0xaf6d('0xf')](_0xaf6d('0x33'),NOW)[_0xaf6d('0xf')](_0xaf6d('0x34'),selectNotIn(_0x192b99,_0x479998,_0x4350fc,'cm_hopper',['\x22always\x22',_0xaf6d('0x35')]))[_0xaf6d('0xf')](_0xaf6d('0x34'),selectNotIn(_0x192b99,_0x479998,_0x4350fc,_0xaf6d('0x28'),[_0xaf6d('0x36')])))['toString']();}function insertCmHopperBlack(_0x13a777,_0x2b5f4e,_0x3457b1,_0x1266d4){var _0x5d84d7=[_0xaf6d('0x21'),_0xaf6d('0x22'),'cm_contacts.ListId',_0x2b5f4e+'.'+_0x1266d4,_0xaf6d('0x37'),_0xaf6d('0x24')];return squel[_0xaf6d('0x26')]()['into'](_0xaf6d('0x38'))[_0xaf6d('0x39')](['phone','ContactId',_0xaf6d('0x2b'),_0x1266d4,_0xaf6d('0x2c'),_0xaf6d('0x3a')],squel[_0xaf6d('0xa')]()[_0xaf6d('0x2f')](_0x5d84d7)[_0xaf6d('0xc')](_0x2b5f4e)[_0xaf6d('0xd')](_0xaf6d('0x30'),null,_0xaf6d('0x31')+_0x2b5f4e+'.CmListId')[_0xaf6d('0xd')](_0x3457b1,null,_0x3457b1+_0xaf6d('0xe')+_0x2b5f4e+'.'+_0x1266d4)[_0xaf6d('0xf')](_0x2b5f4e+'.CmListId\x20=\x20?',_0x13a777)[_0xaf6d('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xaf6d('0xa')]()[_0xaf6d('0x3b')](_0xaf6d('0xb'))['from'](_0xaf6d('0x38'))[_0xaf6d('0xf')](_0xaf6d('0x3c'),_0x13a777)[_0xaf6d('0xf')](_0x1266d4+_0xaf6d('0x3d')+_0x2b5f4e+'.'+_0x1266d4)))[_0xaf6d('0x3e')]();}function insertTzCmHopper(_0x15aecc,_0x4eb69d,_0x23c985,_0x21f53b,_0x2484ef,_0x370c93){var _0x40648b=[_0xaf6d('0x21'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x370c93+'.offset-cm_contacts.utcOffset\x20minute)',_0xaf6d('0x22'),_0xaf6d('0x23'),_0x4eb69d+'.'+_0x21f53b,_0xaf6d('0x37'),_0xaf6d('0x24'),_0xaf6d('0x3f'),_0xaf6d('0x25'),'\x22'+_0x2484ef+'\x22'];var _0xffd7b0=squel[_0xaf6d('0x26')]()[_0xaf6d('0x27')](_0xaf6d('0x28'))[_0xaf6d('0x39')]([_0xaf6d('0xb'),_0xaf6d('0x29'),_0xaf6d('0x2a'),_0xaf6d('0x2b'),_0x21f53b,'createdAt','updatedAt',_0xaf6d('0x40'),'UserId',_0xaf6d('0x2e')],squel['select']()[_0xaf6d('0x2f')](_0x40648b)[_0xaf6d('0xc')](_0x4eb69d)[_0xaf6d('0xd')](_0xaf6d('0x30'),null,_0xaf6d('0x31')+_0x4eb69d+'.CmListId')[_0xaf6d('0xd')](_0x23c985,null,_0x23c985+_0xaf6d('0xe')+_0x4eb69d+'.'+_0x21f53b)[_0xaf6d('0xd')](_0x370c93,null,_0x370c93+_0xaf6d('0xe')+_0x4eb69d+'.'+_0x21f53b)[_0xaf6d('0xf')](_0x4eb69d+_0xaf6d('0x41'),_0x15aecc)[_0xaf6d('0xf')](_0xaf6d('0x33'),NOW)[_0xaf6d('0xf')](_0xaf6d('0x34'),selectNotIn(_0x4eb69d,_0x23c985,_0x21f53b,_0xaf6d('0x28'),[_0xaf6d('0x36'),_0xaf6d('0x35')]))[_0xaf6d('0xf')](_0xaf6d('0x34'),selectNotIn(_0x4eb69d,_0x23c985,_0x21f53b,_0xaf6d('0x28'),[_0xaf6d('0x36')])))[_0xaf6d('0x3e')]();return _0xffd7b0;}function insertTzCmHopperBlack(_0x333789,_0x2167c0,_0x36e485,_0x262497){var _0x435afa=[_0xaf6d('0x21'),_0xaf6d('0x22'),'cm_contacts.ListId',_0x2167c0+'.'+_0x262497,_0xaf6d('0x37'),_0xaf6d('0x24')];return squel[_0xaf6d('0x26')]()[_0xaf6d('0x27')](_0xaf6d('0x38'))[_0xaf6d('0x39')](['phone',_0xaf6d('0x2a'),_0xaf6d('0x2b'),_0x262497,_0xaf6d('0x2c'),'updatedAt'],squel[_0xaf6d('0xa')]()[_0xaf6d('0x2f')](_0x435afa)[_0xaf6d('0xc')](_0x2167c0)[_0xaf6d('0xd')](_0xaf6d('0x30'),null,_0xaf6d('0x31')+_0x2167c0+_0xaf6d('0x32'))[_0xaf6d('0xd')](_0x36e485,null,_0x36e485+_0xaf6d('0xe')+_0x2167c0+'.'+_0x262497)[_0xaf6d('0xf')](_0x2167c0+'.CmListId\x20=\x20?',_0x333789)['where'](_0xaf6d('0x33'),NOW)[_0xaf6d('0xf')](_0xaf6d('0x34'),squel['select']()[_0xaf6d('0x3b')](_0xaf6d('0xb'))[_0xaf6d('0xc')]('cm_hopper_black')['where'](_0xaf6d('0x3c'),_0x333789)['where'](_0x262497+_0xaf6d('0x3d')+_0x2167c0+'.'+_0x262497)))[_0xaf6d('0x3e')]();}function insertCmHopperAdditionalPhones(_0x33569d){var _0x33bd3b=[_0xaf6d('0x42'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0xaf6d('0x43'),'cm_contact_has_items.updatedAt'];return squel[_0xaf6d('0x26')]()[_0xaf6d('0x27')](_0xaf6d('0x44'))['fromQuery']([_0xaf6d('0x45'),_0xaf6d('0xb'),'OrderBy',_0xaf6d('0x2c'),_0xaf6d('0x3a')],squel[_0xaf6d('0xa')]()[_0xaf6d('0x2f')](_0x33bd3b)[_0xaf6d('0xc')](_0xaf6d('0x28'))[_0xaf6d('0xd')](_0xaf6d('0x30'),null,_0xaf6d('0x46'))[_0xaf6d('0xd')](_0xaf6d('0x47'),null,_0xaf6d('0x48'))[_0xaf6d('0xf')](_0xaf6d('0x49'),_0x33569d)[_0xaf6d('0xf')](_0xaf6d('0x33'),NOW))['toString']();}function insertCmContact(_0x433492,_0x4732e0,_0x10ec6f,_0x429019){var _0x14b7b1=_['concat'](_['keys'](_0x429019),[_0xaf6d('0x2b'),_0xaf6d('0x4a'),_0xaf6d('0x2c'),_0xaf6d('0x3a'),_0xaf6d('0x4b')]);return squel['insert']()[_0xaf6d('0x27')](_0xaf6d('0x30'))[_0xaf6d('0x39')](_0x14b7b1,squel[_0xaf6d('0xa')]()[_0xaf6d('0x2f')](_0x14b7b1)[_0xaf6d('0xc')](_0x4732e0)['where']('('+_0x10ec6f['join'](',')+_0xaf6d('0x4c'),squel['select']()['fields'](_0x10ec6f)[_0xaf6d('0xc')](_0xaf6d('0x30'))[_0xaf6d('0xf')]('ListId\x20=\x20?',_0x433492)[_0xaf6d('0xf')]('deletedAt\x20IS\x20NULL'))[_0xaf6d('0xf')](_0xaf6d('0x4d'),squel[_0xaf6d('0xa')]()['field']('MIN(id)',_0xaf6d('0x4e'))['from'](_0x4732e0)['group'](_0x10ec6f[_0xaf6d('0xd')](','))))[_0xaf6d('0x3e')]();}function handleStop(){logger[_0xaf6d('0x4f')](_0xaf6d('0x50'));stopped=!![];}function handleUncaughtException(_0x171d7f){logger[_0xaf6d('0x51')](_0x171d7f['message']);process[_0xaf6d('0x52')](0x1);}function handleError(_0x20aa09,_0x308606){stats[_0xaf6d('0x53')][_0xaf6d('0x17')]({'name':_0x308606[_0xaf6d('0x54')],'message':_0x308606[_0xaf6d('0x55')],'row':_0x20aa09});}function handleQuery(_0x1ffc71){logger['info'](_0x1ffc71);return db['sequelize']['query'](_0x1ffc71)[_0xaf6d('0x56')](function(_0x4cb278){results[_0xaf6d('0x17')](_0x4cb278);})[_0xaf6d('0x57')](function(_0x19c4c7){logger['error'](_0x19c4c7['message']);});}function updateTzCampaigns(_0x46d22e){return new Promise(function(_0xf70286,_0x28c86e){var _0x48a9a8=squel['select']()['fields']([_0xaf6d('0x58'),_0xaf6d('0x59')])['from']('campaigns')[_0xaf6d('0xd')](_0xaf6d('0x5a'),null,_0xaf6d('0x5b'))[_0xaf6d('0xf')](_0xaf6d('0x5c')+_0x46d22e);db['sequelize']['query'](_0x48a9a8['toString']())['spread'](function(_0x398258){var _0xe472ef=[];for(var _0x114dec=0x0;_0x114dec<_0x398258['length'];_0x114dec++){_0xe472ef[_0xaf6d('0x17')](getTimezoneData(_0x398258[_0x114dec],tmp_campaigns));}BPromise['all'](_0xe472ef)[_0xaf6d('0x15')](function(){_0xf70286({'val':0x1});});})[_0xaf6d('0x57')](function(_0x268fba){logger[_0xaf6d('0x51')](_0x268fba['message']);_0xf70286({'val':0x0});});});}function updateTzVoiceQueues(_0x67f311){return new Promise(function(_0x68e5bd,_0x42ed04){var _0x45c741=squel[_0xaf6d('0xa')]()['fields']([_0xaf6d('0x5d'),_0xaf6d('0x5e')])[_0xaf6d('0xc')](_0xaf6d('0x5f'))[_0xaf6d('0xd')]('voice_queues_has_cm_lists',null,_0xaf6d('0x60'))['where'](_0xaf6d('0x61')+_0x67f311);db[_0xaf6d('0x62')][_0xaf6d('0x63')](_0x45c741[_0xaf6d('0x3e')]())[_0xaf6d('0x56')](function(_0x22a5d5){var _0x289837=[];for(var _0x2f44da=0x0;_0x2f44da<_0x22a5d5[_0xaf6d('0x14')];_0x2f44da++){_0x289837[_0xaf6d('0x17')](getTimezoneData(_0x22a5d5[_0x2f44da],tmp_voice_queues));}BPromise[_0xaf6d('0x18')](_0x289837)[_0xaf6d('0x15')](function(){_0x68e5bd({'val':0x1});});})[_0xaf6d('0x57')](function(_0x5c258f){logger['error'](_0x5c258f[_0xaf6d('0x55')]);_0x68e5bd({'val':0x0});});});}function getTimezoneData(_0x33f064,_0x269b0e){return new Promise(function(_0x13ef16,_0x12f1a4){var _0xa23b7b=shared[_0xaf6d('0x64')];var _0x534fe6=_0xa23b7b[_0x33f064[_0xaf6d('0x65')]];if(_['isNil'](_0x534fe6)){_0x13ef16({'ret':0x1});}else{var _0x4f06e4=_0x534fe6[_0xaf6d('0x66')];var _0x3b688d=squel[_0xaf6d('0x26')]()[_0xaf6d('0x27')](_0x269b0e)[_0xaf6d('0x67')]('id',_0x33f064['id'])['set']('offset',_0x4f06e4)[_0xaf6d('0x67')](_0xaf6d('0x65'),_0x33f064[_0xaf6d('0x65')])[_0xaf6d('0x3e')]();return db[_0xaf6d('0x62')][_0xaf6d('0x63')](_0x3b688d)[_0xaf6d('0x56')](function(_0x3d7b76){_0x13ef16({'ret':0x1});})[_0xaf6d('0x57')](function(_0x262d3c){logger[_0xaf6d('0x51')](_0x262d3c[_0xaf6d('0x55')]);_0x12f1a4({'ret':0x1});});}});}function handleTZQuery(_0x185ceb){logger[_0xaf6d('0x4f')](_0x185ceb);return db[_0xaf6d('0x62')][_0xaf6d('0x63')](_0x185ceb)[_0xaf6d('0x56')](function(_0x281a12){})[_0xaf6d('0x57')](function(_0x887004){logger['error'](_0x887004['message']);});}function main(_0x25a8e3,_0x468d0b,_0x15a14b,_0x17167c){logger[_0xaf6d('0x4f')](_0xaf6d('0x68'),_0x25a8e3,JSON[_0xaf6d('0x69')](_0x468d0b));process[_0xaf6d('0x6a')](_0xaf6d('0x6b'));var _0x30e6d0=_0x468d0b[_0xaf6d('0x6c')];var _0x16e189=_['clone'](_0x30e6d0);var _0x3e3c84=_0x468d0b[_0xaf6d('0x6d')];var _0x28ac0d=path[_0xaf6d('0xd')](config[_0xaf6d('0x6e')],_0xaf6d('0x6f'),_0x3e3c84+_0xaf6d('0x70'));hasTZ=_['keys'](_0x30e6d0)[_0xaf6d('0x71')](_0xaf6d('0x65'));var _0x34b2cc=_[_0xaf6d('0x72')](_0x30e6d0)[_0xaf6d('0xd')]();logger[_0xaf6d('0x4f')]('header',_0x34b2cc);db[_0xaf6d('0x73')][_0xaf6d('0x12')]({'raw':!![],'attributes':['id','name']})[_0xaf6d('0x15')](function(_0x3f1912){for(var _0x36f4c3=0x0;_0x36f4c3<_0x3f1912[_0xaf6d('0x14')];_0x36f4c3++){if(_0x3f1912[_0x36f4c3][_0xaf6d('0x74')]in _0x30e6d0){contactItemTypes[_0xaf6d('0x17')](_0x3f1912[_0x36f4c3]);delete _0x16e189[_0x3f1912[_0x36f4c3]['name']];hasAdditionalPhones=!![];}for(var _0x5bb812 in _0x30e6d0){if(_0x3f1912[_0x36f4c3]['name']+_0xaf6d('0x75')===_0x5bb812){phoneDescriptions[_0xaf6d('0x17')]({'itemTypeId':_0x3f1912[_0x36f4c3]['id'],'description':_0x5bb812});delete _0x16e189[_0x5bb812];}}}if(hasAdditionalPhones)_0x16e189[_0xaf6d('0x13')]='';var _0x1ae492=_[_0xaf6d('0x72')](_0x16e189)[_0xaf6d('0xd')]();logger[_0xaf6d('0x4f')](_0xaf6d('0x76'),_0x1ae492);fs[_0xaf6d('0x77')](_0x28ac0d,_0x1ae492+'\x0a');Papa['parse'](fs[_0xaf6d('0x78')](_0x25a8e3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e923d,_0x5bab63){try{for(var _0x5284ac=0x0,_0x4578f9=[];_0x5284ac<_0x4e923d[_0xaf6d('0x79')][_0xaf6d('0x14')];_0x5284ac++){stats[_0xaf6d('0x7a')]+=0x1;if(_0x4e923d[_0xaf6d('0x53')][_0x5284ac]){handleError(_0x4e923d['data'][_0x5284ac],_0x4e923d[_0xaf6d('0x53')][_0x5284ac]);}else{var _0x3088db=[];var _0x2f6d17=[];var _0x490c18={};for(var _0x1e77dc in _0x30e6d0){let _0x37bfd6=contactItemTypes[_0xaf6d('0x7b')](_0x47a2b7=>_0x47a2b7[_0xaf6d('0x74')]===_0x1e77dc);let _0x352692=contactItemTypes['find'](_0x1ac606=>_0x1ac606[_0xaf6d('0x74')]+_0xaf6d('0x75')===_0x1e77dc);if(_['isNil'](_0x37bfd6)&&_['isNil'](_0x352692)){if(_0x30e6d0[_0xaf6d('0x7c')](_0x1e77dc)){if(_0x4e923d[_0xaf6d('0x79')][_0x5284ac][_0x30e6d0[_0x1e77dc]]){var _0x3f4959=_[_0xaf6d('0x7d')](_0x4e923d[_0xaf6d('0x79')][_0x5284ac][_0x30e6d0[_0x1e77dc]][_0xaf6d('0x7e')](/"/g,'\x27'));switch(_0x1e77dc){case _0xaf6d('0x29'):var _0x31bb39=moment(_0x3f4959,_0xaf6d('0x7'),!![]);if(_0x31bb39[_0xaf6d('0x7f')]()){_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x3f4959+'\x22');}else{_0x3088db['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3226b9=parseInt(_0x3f4959);_0x3f4959=_[_0xaf6d('0x80')](_0x3226b9)||_0x3226b9<0x0||_0x3226b9>0x4?_0x17167c?0x3:0x2:_0x3226b9;_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x3f4959+'\x22');break;case _0xaf6d('0x2d'):var _0x52fdd9=parseInt(_0x3f4959);if(_[_0xaf6d('0x81')](_0x52fdd9)&&_[_0xaf6d('0x71')](_0x15a14b,_0x52fdd9)){_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x52fdd9+'\x22');}else{_0x3088db['push'](_0xaf6d('0x82'));}break;case _0xaf6d('0x83'):if(isEmail(_0x3f4959)){_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x3f4959+'\x22');}else{_0x3088db[_0xaf6d('0x17')](_0xaf6d('0x84'));}break;case _0xaf6d('0x85'):var _0x4ed9d0=moment(_0x3f4959,_0xaf6d('0x86'),!![]);if(_0x4ed9d0['isValid']()){_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x3f4959+'\x22');}else{_0x3088db['push'](_0xaf6d('0x87'));}break;case'dialTimezone':var _0xdd3c78=shared[_0xaf6d('0x64')];var _0x210049=_0xdd3c78[_0x3f4959];if(!_[_0xaf6d('0x19')](_0x210049)){var _0x4e59a2=_0x210049[_0xaf6d('0x66')];_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x3f4959+'\x22');_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x4e59a2+'\x22');}break;default:_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x3f4959+'\x22');}}else{switch(_0x1e77dc){case _0xaf6d('0x88'):case _0xaf6d('0xb'):_0x3088db[_0xaf6d('0x17')](_0x1e77dc+_0xaf6d('0x89'));break;default:_0x4578f9[_0xaf6d('0x17')]('\x22\x22');}}}}else{var _0x2625f9='';if(!_[_0xaf6d('0x19')](_0x37bfd6)){if(!_0x490c18[_0xaf6d('0x7c')](_0x37bfd6['id'])){if(!_[_0xaf6d('0x19')](_0x4e923d[_0xaf6d('0x79')][_0x5284ac][_0x30e6d0[_0x1e77dc]])){var _0x3f4959=_['trim'](_0x4e923d[_0xaf6d('0x79')][_0x5284ac][_0x30e6d0[_0x1e77dc]]['replace'](/"/g,'\x27'));var _0x597d0e=phoneDescriptions[_0xaf6d('0x7b')](_0x3a38a5=>_0x3a38a5['itemTypeId']===_0x37bfd6['id']);if(!_[_0xaf6d('0x19')](_0x597d0e)){var _0x21c5de=_['trim'](_0x4e923d['data'][_0x5284ac][_0x30e6d0[_0x597d0e[_0xaf6d('0x8a')]]][_0xaf6d('0x7e')](/"/g,'\x27'));if(!_[_0xaf6d('0x19')](_0x21c5de))_0x3f4959=_0x3f4959+'§'+_0x21c5de;}if(_0x2625f9=='')_0x2625f9=_0x3f4959;else _0x2625f9+='|'+_0x3f4959;}_0x2f6d17[_0xaf6d('0x17')](_0x37bfd6['id']+':'+_0x2625f9);_0x490c18[_0x37bfd6['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4578f9[_0xaf6d('0x17')]('\x22'+_0x2f6d17['join'](';')+'\x22');}if(_0x3088db[_0xaf6d('0x14')]){handleError(_0x4e923d[_0xaf6d('0x79')][_0x5284ac],{'code':_0xaf6d('0x8b'),'message':_0x3088db[_0xaf6d('0xd')]()});}else{fs[_0xaf6d('0x8c')](_0x28ac0d,_0x4578f9[_0xaf6d('0xd')]()+'\x0a');}_0x4578f9=[];}if(!(stats[_0xaf6d('0x7a')]%0xc8)){socket['emit'](_0xaf6d('0x8d')+_0x3e3c84,stats);stats['errors']=[];}}if(stopped){logger[_0xaf6d('0x4f')](_0xaf6d('0x8e'));_0x5bab63[_0xaf6d('0x8f')]();}}catch(_0x351128){handleError(_0x4e923d['data'][_0x5284ac],{'code':_0xaf6d('0x90'),'message':_0x351128[_0xaf6d('0x55')]});logger[_0xaf6d('0x51')](_0xaf6d('0x91'),_0x351128['message']);}},'complete':function(){try{var _0x5db945=[];var _0x20b629=[];var _0x7c8cfe=_0xaf6d('0x30');if(_0x468d0b[_0xaf6d('0x92')]&&_0x468d0b['duplicates']['length']){_0x7c8cfe=_0xaf6d('0x93')+_0x3e3c84;_0x5db945[_0xaf6d('0x17')](_0xaf6d('0x94')+_0x7c8cfe+_0xaf6d('0x95'));}tmp_campaigns=_0xaf6d('0x96')+_0x3e3c84;tmp_voice_queues=_0xaf6d('0x97')+_0x3e3c84;_0x20b629[_0xaf6d('0x17')](_0xaf6d('0x94')+tmp_campaigns+_0xaf6d('0x98'));_0x20b629[_0xaf6d('0x17')](_0xaf6d('0x94')+tmp_voice_queues+_0xaf6d('0x98'));BPromise['each'](_0x20b629,handleTZQuery)[_0xaf6d('0x15')](function(_0xdbbb79){updateTzCampaigns(_0x468d0b[_0xaf6d('0x2b')])[_0xaf6d('0x15')](function(_0x4ca0a5){updateTzVoiceQueues(_0x468d0b['ListId'])[_0xaf6d('0x15')](function(_0x1b6e1d){if(hasTZ)_0x1ae492=_0x1ae492['replace'](_0xaf6d('0x65'),_0xaf6d('0x99'));var _0x52c9d9=util[_0xaf6d('0x8')](_0xaf6d('0x9a'),_0x28ac0d,_0x7c8cfe,_0x1ae492,_0x468d0b['ListId'],_0x468d0b['CompanyId']||null,NOW,NOW);if(_[_0xaf6d('0x19')](_0x30e6d0[_0xaf6d('0x29')])){_0x52c9d9+=',\x20scheduledAt\x20=\x20NOW()';}_0x5db945[_0xaf6d('0x17')](_0x52c9d9);if(_0x468d0b['duplicates']&&_0x468d0b[_0xaf6d('0x92')][_0xaf6d('0x14')]){_0x5db945[_0xaf6d('0x17')](insertCmContact(_0x468d0b[_0xaf6d('0x2b')],_0x7c8cfe,_0x468d0b['duplicates'],_0x30e6d0));_0x5db945['push'](_0xaf6d('0x9b')+_0x7c8cfe+';');}BPromise[_0xaf6d('0x9c')](_0x5db945,handleQuery)[_0xaf6d('0x15')](function(_0x29e0ef){BPromise[_0xaf6d('0x18')]([handleAdditionalPhones()])[_0xaf6d('0x15')](function(){_0x5db945=[];for(var _0x160f18=0x0;_0x160f18\x20\x20','existsSync','parse','binding','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','defaults','localhost','socket.io-emitter','redis','format','cm_contacts_temp_','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','length','isNil','phone','push','then','error','message','AdditionalPhones','split','all','filter','CmContactHasItem','update','updated','create','PHONE','CmContact','CmHopper','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','updatedAt','priority','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','cm_contacts.phone','cm_hopper_black','cm_contacts','.CmListId','ListId\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','CmHopperId','createdAt','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','spread','catch','main','stringify','send','start','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','header','writeFileSync','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)'];(function(_0x4fbd13,_0x4839e3){var _0xd5f0ad=function(_0x20b46a){while(--_0x20b46a){_0x4fbd13['push'](_0x4fbd13['shift']());}};_0xd5f0ad(++_0x4839e3);}(_0x3da6,0xc1));var _0x63da=function(_0x5f3cab,_0x1b523d){_0x5f3cab=_0x5f3cab-0x0;var _0x2db243=_0x3da6[_0x5f3cab];return _0x2db243;};'use strict';var fs=require('fs');var path=require(_0x63da('0x0'));var _=require(_0x63da('0x1'));var Papa=require(_0x63da('0x2'));var util=require(_0x63da('0x3'));var BPromise=require(_0x63da('0x4'));var moment=require(_0x63da('0x5'));var squel=require(_0x63da('0x6'));var Redis=require('ioredis');var db=require(_0x63da('0x7'))['db'];var config=require(_0x63da('0x8'));var logger=require('../../../config/logger')(_0x63da('0x9'));config['redis']=_[_0x63da('0xa')](config['redis'],{'host':_0x63da('0xb'),'port':0x18eb});var socket=require(_0x63da('0xc'))(new Redis(config[_0x63da('0xd')]));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()[_0x63da('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x63da('0xf')+moment()[_0x63da('0xe')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2d43f0){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'](_0x2d43f0);}function selectNotIn(_0x181bdc,_0x12ac78,_0x1f545a,_0xbfba58,_0x36a372){return squel['select']()[_0x63da('0x10')]('phone')[_0x63da('0x11')](_0xbfba58)[_0x63da('0x12')](_0x12ac78,null,_0x12ac78+_0x63da('0x13')+_0xbfba58+'.'+_0x1f545a)[_0x63da('0x14')](_0xbfba58+'.'+_0x1f545a+_0x63da('0x15')+_0x181bdc+'.'+_0x1f545a)[_0x63da('0x14')](_0x12ac78+_0x63da('0x16')+_0x36a372[_0x63da('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x37ce36,_0x26870d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x63da('0x17')][_0x63da('0x18')](_0x63da('0x19')+tempTableName)['spread'](function(_0x48ac11){if(_0x48ac11!==null){var _0x12ffb3=[];for(var _0x5cf63d=0x0;_0x5cf63d<_0x48ac11[_0x63da('0x1a')];_0x5cf63d++){var _0xe8c774=_0x48ac11[_0x5cf63d];if(!_[_0x63da('0x1b')](_0xe8c774[_0x63da('0x1c')])){if(!_[_0x63da('0x1b')](_0xe8c774['AdditionalPhones']))_0x12ffb3[_0x63da('0x1d')](insertAdditionalPhones(_0xe8c774));promisesContact['push']({'contact':_0xe8c774});}}}Promise['all'](_0x12ffb3)[_0x63da('0x1e')](function(){_0x37ce36({'val':0x1});});})['catch'](function(_0x18e457){logger[_0x63da('0x1f')](_0x18e457[_0x63da('0x20')]);});});}function insertAdditionalPhones(_0x4bf6f6){return new Promise(function(_0xdeeb40,_0x112193){var _0x54b6c6=_0x4bf6f6[_0x63da('0x21')];if(_[_0x63da('0x1b')](_0x54b6c6))_0x112193({'val':0x0});else{var _0x3716bd=_0x54b6c6[_0x63da('0x22')](';');var _0x1e777b=[];orderBy=0x0;for(var _0x33e5c6=0x0;_0x33e5c6<_0x3716bd[_0x63da('0x1a')];_0x33e5c6++){_0x1e777b[_0x63da('0x1d')](splitAdditionalPhone(_0x4bf6f6['id'],_0x3716bd[_0x33e5c6]));}Promise[_0x63da('0x23')](_0x1e777b)['then'](function(){_0xdeeb40({'val':_0x3716bd['length']});});}});}function splitAdditionalPhone(_0xef0017,_0x32d43e){return new Promise(function(_0x13d657,_0x45a021){var _0x2eb31d=_0x32d43e[_0x63da('0x22')](':');var _0x5ebcbb=_0x2eb31d[0x0];var _0xc44172=_0x2eb31d[0x1];if(_0xc44172!==''){var _0x15d548=_0xc44172[_0x63da('0x22')]('|');var _0x2d8810=[];for(var _0x54acd0=0x0;_0x54acd0<_0x15d548[_0x63da('0x1a')];_0x54acd0++){if(_0x15d548[_0x54acd0]!==''){var _0x274b71=_[_0x63da('0x24')](promisesAdditionalPhones,{'contactId':_0xef0017,'phone':_0x15d548[_0x54acd0]});if(_0x274b71[_0x63da('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x63da('0x1d')]({'contactId':_0xef0017,'contactTypeId':_0x5ebcbb,'phone':_0x15d548[_0x54acd0],'orderBy':orderBy});}}}_0x13d657({'ok':0x1});}else _0x13d657({'res':0x0});});}function createAdditionalPhone(_0x21cb98,_0x3e2655,_0x4b5e64,_0x5a4628){var _0x3c646a='';var _0x392617='';var _0x3a3d08=_0x4b5e64[_0x63da('0x22')]('§');_0x3c646a=_0x3a3d08[0x0];if(_0x3a3d08[_0x63da('0x1a')]==0x2)_0x392617=_0x3a3d08[0x1];return new Promise(function(_0x33fbca,_0x21530d){return db[_0x63da('0x25')]['findOne']({'where':{'CmContactId':_0x21cb98,'item':_0x3c646a}})['then'](function(_0x3fb195){if(_0x3fb195){return db['CmContactHasItem'][_0x63da('0x26')]({'ItemTypeId':_0x3e2655,'description':_0x392617,'OrderBy':_0x5a4628},{'where':{'CmContactId':_0x21cb98,'item':_0x3c646a}})[_0x63da('0x1e')](function(_0x1df948){_0x33fbca({'res':_0x63da('0x27')});});}else{return db[_0x63da('0x25')][_0x63da('0x28')]({'CmContactId':_0x21cb98,'item':_0x3c646a,'ItemTypeId':_0x3e2655,'description':_0x392617,'OrderBy':_0x5a4628,'ItemClass':_0x63da('0x29')})[_0x63da('0x1e')](function(_0x52a432){_0x33fbca({'res':'inserted'});});}});});}function updateContact(_0x59bf28){return new Promise(function(_0x373135,_0x501a84){var _0x4f5c27=_0x59bf28['id'];delete _0x59bf28['id'];return db[_0x63da('0x2a')][_0x63da('0x26')](_0x59bf28,{'where':{'id':_0x4f5c27}})[_0x63da('0x1e')](function(_0x413675){updatedRows+=0x1;return db[_0x63da('0x2b')]['update']({'phone':_0x59bf28['phone']},{'where':{'ContactId':_0x4f5c27}})[_0x63da('0x1e')](function(_0x4d1a57){_0x373135({'ret':'OK'});});});});}function insertCmHopper(_0x22b138,_0x17589c,_0x110555,_0x3a8bf6,_0x40635d){var _0x5cccc6=['cm_contacts.phone','cm_contacts.scheduledat',_0x63da('0x2c'),_0x63da('0x2d'),_0x17589c+'.'+_0x3a8bf6,_0x63da('0x2e'),_0x63da('0x2f'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x40635d+'\x22'];return squel[_0x63da('0x30')]()[_0x63da('0x31')](_0x63da('0x32'))[_0x63da('0x33')]([_0x63da('0x1c'),_0x63da('0x34'),_0x63da('0x35'),'ListId',_0x3a8bf6,'createdAt',_0x63da('0x36'),_0x63da('0x37'),_0x63da('0x38'),_0x63da('0x39')],squel[_0x63da('0x3a')]()[_0x63da('0x3b')](_0x5cccc6)['from'](_0x17589c)['join']('cm_contacts',null,_0x63da('0x3c')+_0x17589c+'.CmListId')[_0x63da('0x12')](_0x110555,null,_0x110555+'.id\x20=\x20'+_0x17589c+'.'+_0x3a8bf6)[_0x63da('0x14')](_0x17589c+_0x63da('0x3d'),_0x22b138)['where'](_0x63da('0x3e'),NOW)['where'](_0x63da('0x3f'),selectNotIn(_0x17589c,_0x110555,_0x3a8bf6,'cm_hopper',['\x22always\x22',_0x63da('0x40')]))['where'](_0x63da('0x3f'),selectNotIn(_0x17589c,_0x110555,_0x3a8bf6,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x31c35c,_0x40d524,_0x4b6d00,_0x5b999c){var _0x21481f=[_0x63da('0x41'),_0x63da('0x2c'),_0x63da('0x2d'),_0x40d524+'.'+_0x5b999c,_0x63da('0x2e'),_0x63da('0x2f')];return squel[_0x63da('0x30')]()[_0x63da('0x31')](_0x63da('0x42'))[_0x63da('0x33')]([_0x63da('0x1c'),_0x63da('0x35'),'ListId',_0x5b999c,'createdAt','updatedAt'],squel[_0x63da('0x3a')]()['fields'](_0x21481f)[_0x63da('0x11')](_0x40d524)[_0x63da('0x12')](_0x63da('0x43'),null,_0x63da('0x3c')+_0x40d524+_0x63da('0x44'))[_0x63da('0x12')](_0x4b6d00,null,_0x4b6d00+_0x63da('0x13')+_0x40d524+'.'+_0x5b999c)[_0x63da('0x14')](_0x40d524+'.CmListId\x20=\x20?',_0x31c35c)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x63da('0x14')](_0x63da('0x3f'),squel[_0x63da('0x3a')]()['field'](_0x63da('0x1c'))[_0x63da('0x11')](_0x63da('0x42'))[_0x63da('0x14')](_0x63da('0x45'),_0x31c35c)[_0x63da('0x14')](_0x5b999c+'\x20=\x20?',_0x40d524+'.'+_0x5b999c)))[_0x63da('0x46')]();}function insertCmHopperAdditionalPhones(_0x2e59df){var _0x4a7e8d=[_0x63da('0x47'),_0x63da('0x48'),_0x63da('0x49'),_0x63da('0x4a'),_0x63da('0x4b')];return squel[_0x63da('0x30')]()['into'](_0x63da('0x4c'))['fromQuery']([_0x63da('0x4d'),'phone','OrderBy',_0x63da('0x4e'),_0x63da('0x36')],squel['select']()[_0x63da('0x3b')](_0x4a7e8d)['from']('cm_hopper')[_0x63da('0x12')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x63da('0x12')](_0x63da('0x4f'),null,_0x63da('0x50'))[_0x63da('0x14')](_0x63da('0x51'),_0x2e59df)[_0x63da('0x14')](_0x63da('0x3e'),NOW))[_0x63da('0x46')]();}function insertCmContact(_0x3024c8,_0x3076a2,_0x5bfce6,_0x416102){var _0x2dc8d9=_[_0x63da('0x52')](_[_0x63da('0x53')](_0x416102),[_0x63da('0x54'),_0x63da('0x55'),_0x63da('0x4e'),_0x63da('0x36')]);return squel[_0x63da('0x30')]()[_0x63da('0x31')]('cm_contacts')[_0x63da('0x33')](_0x2dc8d9,squel[_0x63da('0x3a')]()['fields'](_0x2dc8d9)[_0x63da('0x11')](_0x3076a2)[_0x63da('0x14')]('('+_0x5bfce6[_0x63da('0x12')](',')+_0x63da('0x56'),squel[_0x63da('0x3a')]()[_0x63da('0x3b')](_0x5bfce6)[_0x63da('0x11')](_0x63da('0x43'))[_0x63da('0x14')]('ListId\x20=\x20?',_0x3024c8))[_0x63da('0x14')](_0x63da('0x57'),squel[_0x63da('0x3a')]()[_0x63da('0x10')](_0x63da('0x58'),_0x63da('0x59'))[_0x63da('0x11')](_0x3076a2)[_0x63da('0x5a')](_0x5bfce6['join'](','))))[_0x63da('0x46')]();}function handleStop(){logger[_0x63da('0x5b')](_0x63da('0x5c'));stopped=!![];}function handleUncaughtException(_0x215060){logger[_0x63da('0x1f')](_0x215060['message']);process[_0x63da('0x5d')](0x1);}function handleError(_0x5c5e6e,_0x2fa166){stats[_0x63da('0x5e')][_0x63da('0x1d')]({'name':_0x2fa166[_0x63da('0x5f')],'message':_0x2fa166[_0x63da('0x20')],'row':_0x5c5e6e});}function handleQuery(_0x4a9666){logger[_0x63da('0x5b')](_0x4a9666);return db[_0x63da('0x17')][_0x63da('0x18')](_0x4a9666)[_0x63da('0x60')](function(_0x4977e6){results[_0x63da('0x1d')](_0x4977e6);})[_0x63da('0x61')](function(_0x2b3d94){logger['error'](_0x2b3d94[_0x63da('0x20')]);});}function main(_0x2872fe,_0x50da69,_0x2f89d3,_0x20704a){logger['info'](_0x63da('0x62'),_0x2872fe,JSON[_0x63da('0x63')](_0x50da69));process[_0x63da('0x64')](_0x63da('0x65'));var _0x2ec1df=_0x50da69['binding'];var _0x6b338b=_[_0x63da('0x66')](_0x2ec1df);var _0x3a1921=_0x50da69[_0x63da('0x67')];var _0x11c362=path[_0x63da('0x12')](config[_0x63da('0x68')],_0x63da('0x69'),_0x3a1921+_0x63da('0x6a'));logger[_0x63da('0x5b')](_0x63da('0x6b'),_0x50da69);db[_0x63da('0x6c')]['findAll']({'raw':!![],'attributes':['id',_0x63da('0x6d')]})['then'](function(_0x47eead){for(var _0x5a9005=0x0;_0x5a9005<_0x47eead[_0x63da('0x1a')];_0x5a9005++){if(_0x47eead[_0x5a9005][_0x63da('0x6d')]in _0x2ec1df){contactItemTypes[_0x63da('0x1d')](_0x47eead[_0x5a9005]);delete _0x6b338b[_0x47eead[_0x5a9005][_0x63da('0x6d')]];hasAdditionalPhones=!![];}for(var _0x35ef7d in _0x2ec1df){if(_0x47eead[_0x5a9005][_0x63da('0x6d')]+'_description'===_0x35ef7d){phoneDescriptions[_0x63da('0x1d')]({'itemTypeId':_0x47eead[_0x5a9005]['id'],'description':_0x35ef7d});delete _0x6b338b[_0x35ef7d];}}}if(hasAdditionalPhones)_0x6b338b['AdditionalPhones']='';var _0x3ec1b8=_['keys'](_0x6b338b)['join']();logger[_0x63da('0x5b')](_0x63da('0x6e'),_0x3ec1b8);fs[_0x63da('0x6f')](_0x11c362,_0x3ec1b8+'\x0a');Papa['parse'](fs[_0x63da('0x70')](_0x2872fe),{'header':!![],'skipEmptyLines':!![],'step':function(_0x45adc2,_0x4158c2){try{for(var _0x7d2375=0x0,_0x1ceef1=[];_0x7d2375<_0x45adc2[_0x63da('0x71')][_0x63da('0x1a')];_0x7d2375++){stats[_0x63da('0x72')]+=0x1;if(_0x45adc2[_0x63da('0x5e')][_0x7d2375]){handleError(_0x45adc2[_0x63da('0x71')][_0x7d2375],_0x45adc2[_0x63da('0x5e')][_0x7d2375]);}else{var _0x433346=[];var _0x500d00=[];var _0x31299a={};for(var _0x2be32d in _0x2ec1df){let _0xb99faf=contactItemTypes[_0x63da('0x73')](_0x2cd400=>_0x2cd400[_0x63da('0x6d')]===_0x2be32d);let _0x33ddbc=contactItemTypes[_0x63da('0x73')](_0x430793=>_0x430793[_0x63da('0x6d')]+'_description'===_0x2be32d);if(_['isNil'](_0xb99faf)&&_[_0x63da('0x1b')](_0x33ddbc)){if(_0x2ec1df[_0x63da('0x74')](_0x2be32d)){if(_0x45adc2[_0x63da('0x71')][_0x7d2375][_0x2ec1df[_0x2be32d]]){var _0x5a2acc=_[_0x63da('0x75')](_0x45adc2[_0x63da('0x71')][_0x7d2375][_0x2ec1df[_0x2be32d]][_0x63da('0x76')](/"/g,'\x27'));switch(_0x2be32d){case'scheduledat':var _0x25d132=moment(_0x5a2acc,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x25d132[_0x63da('0x77')]()){_0x1ceef1[_0x63da('0x1d')]('\x22'+_0x5a2acc+'\x22');}else{_0x433346[_0x63da('0x1d')](_0x63da('0x78'));}break;case _0x63da('0x37'):var _0x4f0b5c=parseInt(_0x5a2acc);_0x5a2acc=_['isNaN'](_0x4f0b5c)||_0x4f0b5c<0x0||_0x4f0b5c>0x4?_0x20704a?0x3:0x2:_0x4f0b5c;_0x1ceef1[_0x63da('0x1d')]('\x22'+_0x5a2acc+'\x22');break;case _0x63da('0x38'):var _0x5186ab=parseInt(_0x5a2acc);if(_[_0x63da('0x79')](_0x5186ab)&&_['includes'](_0x2f89d3,_0x5186ab)){_0x1ceef1[_0x63da('0x1d')]('\x22'+_0x5186ab+'\x22');}else{_0x433346[_0x63da('0x1d')](_0x63da('0x7a'));}break;case _0x63da('0x7b'):if(isEmail(_0x5a2acc)){_0x1ceef1['push']('\x22'+_0x5a2acc+'\x22');}else{_0x433346['push']('email\x20wrong\x20format');}break;case _0x63da('0x7c'):var _0x3ca4ba=moment(_0x5a2acc,_0x63da('0x7d'),!![]);if(_0x3ca4ba[_0x63da('0x77')]()){_0x1ceef1[_0x63da('0x1d')]('\x22'+_0x5a2acc+'\x22');}else{_0x433346['push'](_0x63da('0x7e'));}break;default:_0x1ceef1[_0x63da('0x1d')]('\x22'+_0x5a2acc+'\x22');}}else{switch(_0x2be32d){case _0x63da('0x7f'):case _0x63da('0x1c'):_0x433346[_0x63da('0x1d')](_0x2be32d+_0x63da('0x80'));break;default:_0x1ceef1['push']('\x22\x22');}}}}else{var _0x33fef5='';if(!_[_0x63da('0x1b')](_0xb99faf)){if(!_0x31299a[_0x63da('0x74')](_0xb99faf['id'])){for(var _0x9c8ef7=0x0;_0x9c8ef7<_0x2ec1df[_0x2be32d]['length'];_0x9c8ef7++){var _0x5a2acc=_[_0x63da('0x75')](_0x45adc2[_0x63da('0x71')][_0x7d2375][_0x2ec1df[_0x2be32d][_0x9c8ef7]]['replace'](/"/g,'\x27'));var _0xc4a3f5=phoneDescriptions[_0x63da('0x73')](_0x2d85f7=>_0x2d85f7[_0x63da('0x81')]===_0xb99faf['id']);if(!_[_0x63da('0x1b')](_0xc4a3f5)){var _0x4957f5=_[_0x63da('0x75')](_0x45adc2[_0x63da('0x71')][_0x7d2375][_0x2ec1df[_0xc4a3f5[_0x63da('0x82')]][0x0]][_0x63da('0x76')](/"/g,'\x27'));if(!_[_0x63da('0x1b')](_0x4957f5))_0x5a2acc=_0x5a2acc+'§'+_0x4957f5;}if(_0x33fef5=='')_0x33fef5=_0x5a2acc;else _0x33fef5+='|'+_0x5a2acc;}_0x500d00[_0x63da('0x1d')](_0xb99faf['id']+':'+_0x33fef5);_0x31299a[_0xb99faf['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1ceef1[_0x63da('0x1d')]('\x22'+_0x500d00[_0x63da('0x12')](';')+'\x22');}if(_0x433346[_0x63da('0x1a')]){handleError(_0x45adc2[_0x63da('0x71')][_0x7d2375],{'code':_0x63da('0x83'),'message':_0x433346[_0x63da('0x12')]()});}else{fs[_0x63da('0x84')](_0x11c362,_0x1ceef1[_0x63da('0x12')]()+'\x0a');}_0x1ceef1=[];}if(!(stats[_0x63da('0x72')]%0xc8)){socket[_0x63da('0x85')](_0x63da('0x86')+_0x3a1921,stats);stats[_0x63da('0x5e')]=[];}}if(stopped){logger[_0x63da('0x5b')](_0x63da('0x87'));_0x4158c2[_0x63da('0x88')]();}}catch(_0x5a1af4){handleError(_0x45adc2[_0x63da('0x71')][_0x7d2375],{'code':_0x63da('0x89'),'message':_0x5a1af4[_0x63da('0x20')]});logger[_0x63da('0x1f')]('step',_0x5a1af4['message']);}},'complete':function(){try{var _0x29a52b=[];var _0x2b5449=tempTableName;_0x29a52b[_0x63da('0x1d')](_0x63da('0x8a')+_0x2b5449+'\x20LIKE\x20cm_contacts;');logger[_0x63da('0x5b')](_0x63da('0x8b'),contactItemTypes['length']);var _0x5983d7=util['format'](_0x63da('0x8c'),_0x11c362,_0x2b5449,_0x3ec1b8,_0x50da69[_0x63da('0x54')],_0x50da69[_0x63da('0x55')]||null,NOW,NOW);if(_[_0x63da('0x1b')](_0x2ec1df[_0x63da('0x34')])){_0x5983d7+=_0x63da('0x8d');}_0x29a52b[_0x63da('0x1d')](_0x5983d7);BPromise['each'](_0x29a52b,handleQuery)[_0x63da('0x1e')](function(_0x232d59){BPromise[_0x63da('0x23')]([handleAdditionalPhones()])[_0x63da('0x1e')](function(){_0x29a52b=[];for(var _0x5184c1=0x0;_0x5184c1_0x2de85a['name']===_0x33b521);let _0x1a3422=contactItemTypes[_0x8d79('0x73')](_0x1641d5=>_0x1641d5[_0x8d79('0x6b')]+_0x8d79('0x6c')===_0x33b521);if(_[_0x8d79('0x1a')](_0x176059)&&_[_0x8d79('0x1a')](_0x1a3422)){if(_0x31734e[_0x8d79('0x74')](_0x33b521)){if(_0x45ac4a[_0x8d79('0x71')][_0x363908][_0x31734e[_0x33b521]]){var _0x390c4c=_[_0x8d79('0x75')](_0x45ac4a[_0x8d79('0x71')][_0x363908][_0x31734e[_0x33b521]][_0x8d79('0x76')](/"/g,'\x27'));switch(_0x33b521){case'scheduledat':var _0x4cc4dc=moment(_0x390c4c,_0x8d79('0xb'),!![]);if(_0x4cc4dc[_0x8d79('0x77')]()){_0x1241cf[_0x8d79('0x1c')]('\x22'+_0x390c4c+'\x22');}else{_0x16802d['push'](_0x8d79('0x78'));}break;case'priority':var _0x522c6d=parseInt(_0x390c4c);_0x390c4c=_[_0x8d79('0x79')](_0x522c6d)||_0x522c6d<0x0||_0x522c6d>0x4?_0x5b20bf?0x3:0x2:_0x522c6d;_0x1241cf['push']('\x22'+_0x390c4c+'\x22');break;case'UserId':var _0x273134=parseInt(_0x390c4c);if(_[_0x8d79('0x7a')](_0x273134)&&_[_0x8d79('0x7b')](_0xcd3af6,_0x273134)){_0x1241cf[_0x8d79('0x1c')]('\x22'+_0x273134+'\x22');}else{_0x16802d['push'](_0x8d79('0x7c'));}break;case _0x8d79('0x7d'):if(isEmail(_0x390c4c)){_0x1241cf['push']('\x22'+_0x390c4c+'\x22');}else{_0x16802d[_0x8d79('0x1c')](_0x8d79('0x7e'));}break;case'dateOfBirth':var _0x50d5d8=moment(_0x390c4c,_0x8d79('0x7f'),!![]);if(_0x50d5d8[_0x8d79('0x77')]()){_0x1241cf[_0x8d79('0x1c')]('\x22'+_0x390c4c+'\x22');}else{_0x16802d[_0x8d79('0x1c')](_0x8d79('0x80'));}break;default:_0x1241cf['push']('\x22'+_0x390c4c+'\x22');}}else{switch(_0x33b521){case _0x8d79('0x81'):case _0x8d79('0x11'):_0x16802d['push'](_0x33b521+'\x20not\x20specified');break;default:_0x1241cf[_0x8d79('0x1c')]('\x22\x22');}}}}else{var _0xa9a7d8='';if(!_[_0x8d79('0x1a')](_0x176059)){if(!_0x522f5a[_0x8d79('0x74')](_0x176059['id'])){for(var _0x3210df=0x0;_0x3210df<_0x31734e[_0x33b521][_0x8d79('0x19')];_0x3210df++){var _0x390c4c=_['trim'](_0x45ac4a[_0x8d79('0x71')][_0x363908][_0x31734e[_0x33b521][_0x3210df]][_0x8d79('0x76')](/"/g,'\x27'));var _0x4c5fe6=phoneDescriptions[_0x8d79('0x73')](_0x3de27c=>_0x3de27c[_0x8d79('0x82')]===_0x176059['id']);if(!_[_0x8d79('0x1a')](_0x4c5fe6)){var _0x148fd8=_[_0x8d79('0x75')](_0x45ac4a[_0x8d79('0x71')][_0x363908][_0x31734e[_0x4c5fe6[_0x8d79('0x83')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x8d79('0x1a')](_0x148fd8))_0x390c4c=_0x390c4c+'§'+_0x148fd8;}if(_0xa9a7d8=='')_0xa9a7d8=_0x390c4c;else _0xa9a7d8+='|'+_0x390c4c;}_0x35f59b['push'](_0x176059['id']+':'+_0xa9a7d8);_0x522f5a[_0x176059['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1241cf['push']('\x22'+_0x35f59b['join'](';')+'\x22');}if(_0x16802d[_0x8d79('0x19')]){handleError(_0x45ac4a[_0x8d79('0x71')][_0x363908],{'code':_0x8d79('0x84'),'message':_0x16802d[_0x8d79('0x3f')]()});}else{fs[_0x8d79('0x85')](_0xb7811,_0x1241cf[_0x8d79('0x3f')]()+'\x0a');}_0x1241cf=[];}if(!(stats[_0x8d79('0x86')]%0xc8)){socket['emit'](_0x8d79('0x87')+_0x4a401b,stats);stats[_0x8d79('0x72')]=[];}}if(stopped){logger['info'](_0x8d79('0x88'));_0x134363['abort']();}}catch(_0xfa7824){handleError(_0x45ac4a[_0x8d79('0x71')][_0x363908],{'code':'SystemError','message':_0xfa7824['message']});logger[_0x8d79('0x1e')](_0x8d79('0x89'),_0xfa7824[_0x8d79('0x8a')]);}},'complete':function(){try{var _0x4a3227=[];var _0x2e9cf8=tempTableName;_0x4a3227[_0x8d79('0x1c')]('CREATE\x20TABLE\x20'+_0x2e9cf8+_0x8d79('0x8b'));logger['info'](_0x8d79('0x8c'),contactItemTypes[_0x8d79('0x19')]);var _0x1b534d=util[_0x8d79('0xa')](_0x8d79('0x8d'),_0xb7811,_0x2e9cf8,_0x5b9ef9,_0x4b0bc7[_0x8d79('0x35')],_0x4b0bc7[_0x8d79('0x56')]||null,NOW,NOW);if(_[_0x8d79('0x1a')](_0x31734e['scheduledat'])){_0x1b534d+=_0x8d79('0x8e');}_0x4a3227[_0x8d79('0x1c')](_0x1b534d);BPromise[_0x8d79('0x8f')](_0x4a3227,handleQuery)['then'](function(_0x5cf87f){BPromise[_0x8d79('0x20')]([handleAdditionalPhones()])['then'](function(){_0x4a3227=[];for(var _0x4d631a=0x0;_0x4d631a\x20\x20');}var _0x26471c=path[_0x8d79('0x3f')](config[_0x8d79('0x65')],_0x8d79('0x66'),process[_0x8d79('0x99')][0x2]);if(!fs[_0x8d79('0x9a')](_0x26471c)){throw new Error(_0x8d79('0x9b'));}var _0x3c102a={};try{_0x3c102a=JSON[_0x8d79('0x6f')](process[_0x8d79('0x99')][0x3]);if(!_0x3c102a['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x1adb1a=0x0;if(_0x3c102a[_0x8d79('0x63')][_0x8d79('0x39')]){_0x1adb1a=0x1;}if(!_0x3c102a['ListId']){throw new Error(_0x8d79('0x9c'));}}catch(_0x2e4d97){throw new Error(_0x8d79('0x9d'));}var _0x1106b6=[];try{_0x1106b6=_[_0x8d79('0x9e')](JSON['parse'](process[_0x8d79('0x99')][0x4]),'id');}catch(_0x39c1a7){logger['info'](_0x8d79('0x9f'));}main(_0x26471c,_0x3c102a,_0x1106b6,_0x1adb1a);}validate();process['on'](_0x8d79('0xa0'),handleStop);process['on'](_0x8d79('0xa1'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2cf262b..59e0ce2 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe059=['Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Call\x20To','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','talktime','Member\x20Name','membername','answertime','endtime','Duration','duration'];(function(_0x102057,_0x289756){var _0x2a5af3=function(_0x498e44){while(--_0x498e44){_0x102057['push'](_0x102057['shift']());}};_0x2a5af3(++_0x289756);}(_0xe059,0x192));var _0x9e05=function(_0xbb4b0a,_0x43b0b0){_0xbb4b0a=_0xbb4b0a-0x0;var _0x368223=_0xe059[_0xbb4b0a];return _0x368223;};'use strict';exports[_0x9e05('0x0')]=function(_0x4e724a,_0x1eacf9){var _0x122b8c=[{'type':_0x9e05('0x1'),'content':_0x9e05('0x2'),'variableName':null}];switch(_0x4e724a[_0x9e05('0x3')]()){case _0x9e05('0x4'):switch(_0x1eacf9[_0x9e05('0x3')]()){case _0x9e05('0x5'):_0x122b8c[_0x9e05('0x6')]({'type':_0x9e05('0x7'),'content':'','variableName':_0x9e05('0x8')});_0x122b8c[_0x9e05('0x6')]({'type':_0x9e05('0x7'),'content':'','variableName':'calleridnum'});break;case _0x9e05('0x9'):_0x122b8c['push']({'type':_0x9e05('0x1'),'content':'Outbound\x20Call','variableName':null});_0x122b8c[_0x9e05('0x6')]({'type':'variable','content':'','variableName':_0x9e05('0xa')});break;}}return _0x122b8c;};exports[_0x9e05('0xb')]=function(_0x1a63e3,_0x37fcf3){var _0x37ef0b=[];switch(_0x1a63e3[_0x9e05('0x3')]()){case _0x9e05('0x4'):switch(_0x37fcf3[_0x9e05('0x3')]()){case _0x9e05('0x5'):_0x37ef0b=[{'type':_0x9e05('0x1'),'content':_0x9e05('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x9e05('0xd'),'keyType':_0x9e05('0x7'),'variableName':'calleridnum'},{'type':_0x9e05('0xe'),'content':'','key':'Caller\x20Name','keyType':_0x9e05('0x7'),'variableName':'calleridname'},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0xf'),'keyType':_0x9e05('0x7'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x9e05('0x10'),'keyType':_0x9e05('0x7'),'variableName':'queue'},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x11'),'keyType':'variable','variableName':_0x9e05('0x12')},{'type':'keyValue','content':'','key':_0x9e05('0x13'),'keyType':'variable','variableName':_0x9e05('0x14')},{'type':_0x9e05('0x1'),'content':_0x9e05('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x16'),'keyType':_0x9e05('0x7'),'variableName':_0x9e05('0x17')},{'type':_0x9e05('0xe'),'content':'','key':'Agent\x20Number','keyType':_0x9e05('0x7'),'variableName':_0x9e05('0xa')},{'type':'string','content':_0x9e05('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x19'),'keyType':'variable','variableName':_0x9e05('0x14')},{'type':'keyValue','content':'','key':_0x9e05('0x1a'),'keyType':_0x9e05('0x7'),'variableName':_0x9e05('0x1b')},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x1c'),'keyType':_0x9e05('0x7'),'variableName':'agentcompleteAt'},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x1d'),'keyType':_0x9e05('0x7'),'variableName':_0x9e05('0x1e')},{'type':_0x9e05('0xe'),'content':'','key':'Talk\x20Time','keyType':_0x9e05('0x7'),'variableName':_0x9e05('0x1f')}];break;case _0x9e05('0x9'):_0x37ef0b=[{'type':'string','content':_0x9e05('0xc'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0x9e05('0x7'),'keyContent':'','variableName':_0x9e05('0xa')},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x20'),'keyType':_0x9e05('0x7'),'keyContent':'','variableName':_0x9e05('0x21')},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x11'),'keyType':_0x9e05('0x7'),'keyContent':'','variableName':_0x9e05('0x12')},{'type':_0x9e05('0xe'),'content':'','key':'Date','keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x9e05('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x9e05('0xe'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':_0x9e05('0x22')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0x9e05('0x7'),'keyContent':'','variableName':_0x9e05('0x23')},{'type':'keyValue','content':'','key':_0x9e05('0x24'),'keyType':_0x9e05('0x7'),'keyContent':'','variableName':_0x9e05('0x25')},{'type':_0x9e05('0xe'),'content':'','key':_0x9e05('0x26'),'keyType':_0x9e05('0x7'),'keyContent':'','variableName':_0x9e05('0x27')}];break;}}return _0x37ef0b;}; \ No newline at end of file +var _0xd3bf=['Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','calleridnum','outbound','Outbound\x20Call','variable','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','destexten','Queue','UniqueId'];(function(_0x300a18,_0x33be9d){var _0x312c9a=function(_0x1827a1){while(--_0x1827a1){_0x300a18['push'](_0x300a18['shift']());}};_0x312c9a(++_0x33be9d);}(_0xd3bf,0xa2));var _0xfd3b=function(_0x4c3851,_0xbebbfd){_0x4c3851=_0x4c3851-0x0;var _0x43a1e2=_0xd3bf[_0x4c3851];return _0x43a1e2;};'use strict';exports[_0xfd3b('0x0')]=function(_0x253f71,_0x2ff7bf){var _0x1d1659=[{'type':_0xfd3b('0x1'),'content':_0xfd3b('0x2'),'variableName':null}];switch(_0x253f71[_0xfd3b('0x3')]()){case'voice':switch(_0x2ff7bf[_0xfd3b('0x3')]()){case _0xfd3b('0x4'):_0x1d1659[_0xfd3b('0x5')]({'type':'variable','content':'','variableName':_0xfd3b('0x6')});_0x1d1659[_0xfd3b('0x5')]({'type':'variable','content':'','variableName':_0xfd3b('0x7')});break;case _0xfd3b('0x8'):_0x1d1659[_0xfd3b('0x5')]({'type':'string','content':_0xfd3b('0x9'),'variableName':null});_0x1d1659[_0xfd3b('0x5')]({'type':_0xfd3b('0xa'),'content':'','variableName':_0xfd3b('0xb')});break;}}return _0x1d1659;};exports[_0xfd3b('0xc')]=function(_0x199765,_0x58325d){var _0x5b696d=[];switch(_0x199765[_0xfd3b('0x3')]()){case _0xfd3b('0xd'):switch(_0x58325d['toLowerCase']()){case _0xfd3b('0x4'):_0x5b696d=[{'type':'string','content':_0xfd3b('0xe'),'key':null,'keyType':null,'variableName':null},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x10'),'keyType':'variable','variableName':'calleridnum'},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x11'),'keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x12')},{'type':_0xfd3b('0xf'),'content':'','key':'Call\x20To','keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x13')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x14'),'keyType':'variable','variableName':_0xfd3b('0x6')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x15'),'keyType':_0xfd3b('0xa'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xfd3b('0x16'),'keyType':'variable','variableName':_0xfd3b('0x17')},{'type':_0xfd3b('0x1'),'content':_0xfd3b('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x19'),'keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x1a')},{'type':_0xfd3b('0xf'),'content':'','key':'Agent\x20Number','keyType':_0xfd3b('0xa'),'variableName':'destcalleridnum'},{'type':_0xfd3b('0x1'),'content':_0xfd3b('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x1c'),'keyType':'variable','variableName':_0xfd3b('0x17')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x1d'),'keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x1e')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x1f'),'keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x20')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x21'),'keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x22')},{'type':_0xfd3b('0xf'),'content':'','key':'Talk\x20Time','keyType':_0xfd3b('0xa'),'variableName':_0xfd3b('0x23')}];break;case _0xfd3b('0x8'):_0x5b696d=[{'type':_0xfd3b('0x1'),'content':_0xfd3b('0xe'),'variableName':null},{'type':_0xfd3b('0xf'),'content':'','key':'Called\x20Number','keyType':_0xfd3b('0xa'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xfd3b('0xf'),'content':'','key':'Member\x20Name','keyType':_0xfd3b('0xa'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xfd3b('0x15'),'keyType':_0xfd3b('0xa'),'keyContent':'','variableName':_0xfd3b('0x24')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x16'),'keyType':_0xfd3b('0xa'),'keyContent':'','variableName':_0xfd3b('0x25')},{'type':'string','content':_0xfd3b('0x1b')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x26'),'keyType':_0xfd3b('0xa'),'keyContent':'','variableName':_0xfd3b('0x27')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x28'),'keyType':_0xfd3b('0xa'),'keyContent':'','variableName':_0xfd3b('0x29')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x2a'),'keyType':_0xfd3b('0xa'),'keyContent':'','variableName':_0xfd3b('0x2b')},{'type':_0xfd3b('0xf'),'content':'','key':_0xfd3b('0x2c'),'keyType':_0xfd3b('0xa'),'keyContent':'','variableName':_0xfd3b('0x2d')}];break;}}return _0x5b696d;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 7d5f26f..6ce8a6e 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7ba=['ids','tag','countFilteredInteractions','count','length','order','contactName','closed','getClosedOrderClause','DESC','catch','tracked','clone','omit','mobile','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','body','contact','default','fields','filter','user','having','read','tags','group','i.id'];(function(_0x3dc089,_0x5ccb0d){var _0x34d9d3=function(_0x4556bf){while(--_0x4556bf){_0x3dc089['push'](_0x3dc089['shift']());}};_0x34d9d3(++_0x5ccb0d);}(_0xb7ba,0xfa));var _0xab7b=function(_0x4316f9,_0x3dd19b){_0x4316f9=_0x4316f9-0x0;var _0x1823bb=_0xb7ba[_0x4316f9];return _0x1823bb;};'use strict';var _=require(_0xab7b('0x0'));var sqlUtils=require(_0xab7b('0x1'));var utils=require(_0xab7b('0x2'));exports[_0xab7b('0x3')]=function(_0x1b8edc,_0xbe5b11,_0x1ce92c,_0x1a3e6a,_0x5b8677){var _0x1f07de={'count':0x0,'rows':[]};var _0x2e0bf4=sqlUtils[_0xab7b('0x4')](_0x1b8edc,_0x1ce92c,_0xbe5b11);if(_0x2e0bf4){return Promise[_0xab7b('0x5')](_0x1f07de);}var _0x4ed81f=sqlUtils[_0xab7b('0x6')](_0x1b8edc);var _0x1394eb={};return Promise['resolve']()['then'](function(){if(_0xbe5b11[_0xab7b('0x7')]){return sqlUtils[_0xab7b('0x8')](_0xbe5b11[_0xab7b('0x7')],_0x5b8677);}else{return sqlUtils[_0xab7b('0x9')](_0x1b8edc,_0xbe5b11,_0x5b8677);}})[_0xab7b('0xa')](function(_0x4624df){_0x4ed81f[_0xab7b('0xb')](_0x4624df[_0xab7b('0xc')]);_0x4ed81f[_0xab7b('0xb')](_0x4624df[_0xab7b('0xd')]);_0x4ed81f['where'](_0x4624df[_0xab7b('0xe')]);_0x4ed81f[_0xab7b('0xb')](_0x4624df[_0xab7b('0xf')]);_0x4ed81f[_0xab7b('0xb')](_0x4624df[_0xab7b('0x10')]);_0x4ed81f[_0xab7b('0xb')](_0x4624df[_0xab7b('0x11')]);_0x4ed81f[_0xab7b('0x12')](_0x4624df[_0xab7b('0x13')]);_0x1394eb=_0x4624df[_0xab7b('0x14')];return sqlUtils['checkAccountsRestrictions'](_0x1b8edc,_0x1ce92c,_0xbe5b11);})['then'](function(_0x221fab){_0x4ed81f[_0xab7b('0xb')](_0x221fab);_0x4ed81f[_0xab7b('0x15')](_0xab7b('0x16'));var _0x2050d1=_0xbe5b11[_0xab7b('0x7')]?_0x1394eb[_0xab7b('0x17')]:_0xbe5b11[_0xab7b('0x18')];return sqlUtils[_0xab7b('0x19')](_0x4ed81f,_0x2050d1);})[_0xab7b('0xa')](function(_0x4576a8){_0x1f07de[_0xab7b('0x1a')]=_0x4576a8[_0xab7b('0x1b')];if(_0x1f07de[_0xab7b('0x1a')]===0x0){return[];}_0x4ed81f['having'](_0x1394eb['clause']);if(_0x1a3e6a[_0xab7b('0x1c')]){_0x1a3e6a[_0xab7b('0x1c')]['forEach'](function(_0x44d362){var _0x3825be=_0x44d362[0x0]===_0xab7b('0x1d')?_0x44d362[0x0]:'i.'+_0x44d362[0x0];_0x4ed81f[_0xab7b('0x1c')](_0x3825be,_0x44d362[0x1]==='DESC'?![]:!![]);if(_0x44d362[0x0]===_0xab7b('0x1e')){var _0x442454=sqlUtils[_0xab7b('0x1f')](_0x1b8edc,_0xbe5b11);_0x4ed81f['order'](_0x442454,_0x44d362[0x1]===_0xab7b('0x20')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x1b8edc,_0x4ed81f,_0xbe5b11,_0x1a3e6a);})[_0xab7b('0xa')](function(_0x455144){_0x1f07de['rows']=_0x455144;return _0x1f07de;})[_0xab7b('0x21')](function(_0x457dc1){throw _0x457dc1;});};exports[_0xab7b('0x22')]=function(_0x48b8ed,_0x485793){return function(_0x10160b,_0x1f0f0c,_0x2171ab){var _0x33f524=_0x10160b[_0xab7b('0x11')];var _0x3608b6={};var _0x53731f=_0x10160b['query'];if(_0x3608b6){_0x3608b6=_[_0xab7b('0x23')](_0x10160b[_0xab7b('0xc')]);_0x3608b6=_[_0xab7b('0x24')](_0x3608b6,[_0xab7b('0xc'),'html','phone','fax',_0xab7b('0x25')]);}utils[_0xab7b('0x26')](_0x33f524,_0x3608b6,_0x53731f,_0x48b8ed,_0x485793);_0x2171ab(null);};}; \ No newline at end of file +var _0xbe92=['order','contactName','closed','getClosedOrderClause','DESC','rows','catch','tracked','query','omit','html','phone','mobile','updateUser','lodash','./sql-utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','parseAdvancedSearchFilter','search','parseQueryParameters','then','where','body','contact','default','fields','user','having','read','tags','checkAccountsRestrictions','i.id','tag','countFilteredInteractions','count','length','clause'];(function(_0xec034,_0x16c358){var _0x2c5a19=function(_0xec401c){while(--_0xec401c){_0xec034['push'](_0xec034['shift']());}};_0x2c5a19(++_0x16c358);}(_0xbe92,0xd6));var _0x2be9=function(_0xb60e48,_0x5de76d){_0xb60e48=_0xb60e48-0x0;var _0x14fba2=_0xbe92[_0xb60e48];return _0x14fba2;};'use strict';var _=require(_0x2be9('0x0'));var sqlUtils=require(_0x2be9('0x1'));var utils=require('./utils');exports[_0x2be9('0x2')]=function(_0x4823d2,_0x381ddf,_0x20a717,_0x5b5bff,_0x2ca30f){var _0x31e1fb={'count':0x0,'rows':[]};var _0xfd4e76=sqlUtils[_0x2be9('0x3')](_0x4823d2,_0x20a717,_0x381ddf);if(_0xfd4e76){return Promise[_0x2be9('0x4')](_0x31e1fb);}var _0x1a1384=sqlUtils[_0x2be9('0x5')](_0x4823d2);var _0x39c723={};return Promise[_0x2be9('0x4')]()['then'](function(){if(_0x381ddf['search']){return sqlUtils[_0x2be9('0x6')](_0x381ddf[_0x2be9('0x7')],_0x2ca30f);}else{return sqlUtils[_0x2be9('0x8')](_0x4823d2,_0x381ddf,_0x2ca30f);}})[_0x2be9('0x9')](function(_0x66ee72){_0x1a1384[_0x2be9('0xa')](_0x66ee72[_0x2be9('0xb')]);_0x1a1384[_0x2be9('0xa')](_0x66ee72[_0x2be9('0xc')]);_0x1a1384[_0x2be9('0xa')](_0x66ee72[_0x2be9('0xd')]);_0x1a1384['where'](_0x66ee72[_0x2be9('0xe')]);_0x1a1384[_0x2be9('0xa')](_0x66ee72['filter']);_0x1a1384['where'](_0x66ee72[_0x2be9('0xf')]);_0x1a1384[_0x2be9('0x10')](_0x66ee72[_0x2be9('0x11')]);_0x39c723=_0x66ee72[_0x2be9('0x12')];return sqlUtils[_0x2be9('0x13')](_0x4823d2,_0x20a717,_0x381ddf);})[_0x2be9('0x9')](function(_0x1bfa80){_0x1a1384[_0x2be9('0xa')](_0x1bfa80);_0x1a1384['group'](_0x2be9('0x14'));var _0x3ab2eb=_0x381ddf[_0x2be9('0x7')]?_0x39c723['ids']:_0x381ddf[_0x2be9('0x15')];return sqlUtils[_0x2be9('0x16')](_0x1a1384,_0x3ab2eb);})[_0x2be9('0x9')](function(_0x51a7c5){_0x31e1fb[_0x2be9('0x17')]=_0x51a7c5[_0x2be9('0x18')];if(_0x31e1fb['count']===0x0){return[];}_0x1a1384[_0x2be9('0x10')](_0x39c723[_0x2be9('0x19')]);if(_0x5b5bff[_0x2be9('0x1a')]){_0x5b5bff[_0x2be9('0x1a')]['forEach'](function(_0x2dce1e){var _0x175758=_0x2dce1e[0x0]===_0x2be9('0x1b')?_0x2dce1e[0x0]:'i.'+_0x2dce1e[0x0];_0x1a1384['order'](_0x175758,_0x2dce1e[0x1]==='DESC'?![]:!![]);if(_0x2dce1e[0x0]===_0x2be9('0x1c')){var _0x5724fe=sqlUtils[_0x2be9('0x1d')](_0x4823d2,_0x381ddf);_0x1a1384[_0x2be9('0x1a')](_0x5724fe,_0x2dce1e[0x1]===_0x2be9('0x1e')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x4823d2,_0x1a1384,_0x381ddf,_0x5b5bff);})[_0x2be9('0x9')](function(_0x590059){_0x31e1fb[_0x2be9('0x1f')]=_0x590059;return _0x31e1fb;})[_0x2be9('0x20')](function(_0x2c1381){throw _0x2c1381;});};exports[_0x2be9('0x21')]=function(_0x2a365b,_0x47e6d0){return function(_0x5eb702,_0x2e1904,_0x2839ba){var _0x334994=_0x5eb702[_0x2be9('0xf')];var _0x472df3={};var _0x57db58=_0x5eb702[_0x2be9('0x22')];if(_0x472df3){_0x472df3=_['clone'](_0x5eb702[_0x2be9('0xb')]);_0x472df3=_[_0x2be9('0x23')](_0x472df3,['body',_0x2be9('0x24'),_0x2be9('0x25'),'fax',_0x2be9('0x26')]);}utils[_0x2be9('0x27')](_0x334994,_0x472df3,_0x57db58,_0x2a365b,_0x47e6d0);_0x2839ba(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index c921876..98c5afc 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5c5=['Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','all','clone','isEmpty','t.id\x20IN\x20?','Sequelize','lodash','squel','updateInteraction','./utils','../../mysqldb','role','search','select','field','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','interactions','o.id\x20=\x20i.UserId','accounts','messages','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','i.id\x20LIKE\x20?','whatsapp','fax','i.fax\x20LIKE\x20?','openchannel','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','name','default','text','value','start','unreadMessages','read','and','Contact','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','end','tags','clause','User','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','type','plainBody','body','keys','some','compact','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','sequelize','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.closed','i.attach','i.lastMsgDirection','i.subject','i.to','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*'];(function(_0x45b4c3,_0xf3dc72){var _0x54e82c=function(_0x56313b){while(--_0x56313b){_0x45b4c3['push'](_0x45b4c3['shift']());}};_0x54e82c(++_0xf3dc72);}(_0xb5c5,0xbb));var _0x5b5c=function(_0x15ee08,_0x402932){_0x15ee08=_0x15ee08-0x0;var _0x2cff68=_0xb5c5[_0x15ee08];return _0x2cff68;};'use strict';var _=require(_0x5b5c('0x0'));var squel=require(_0x5b5c('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require('./update-interaction')[_0x5b5c('0x2')];var utils=require(_0x5b5c('0x3'));var db=require(_0x5b5c('0x4'))['db'];function skipInteractionsQuery(_0x478ea2,_0x246c48,_0x13dd84){var _0x23331b=![];var _0x204997=utils['getAccountFK'](_0x478ea2);if(_0x246c48[_0x5b5c('0x5')]==='agent'&&!_0x13dd84[_0x5b5c('0x6')]&&!_0x13dd84[_0x204997]){_0x23331b=!![];}return _0x23331b;}function getTagsQuery(){return squel[_0x5b5c('0x7')]()[_0x5b5c('0x8')]('id')[_0x5b5c('0x8')]('name')[_0x5b5c('0x8')](_0x5b5c('0x9'))[_0x5b5c('0xa')](_0x5b5c('0xb'));}function getUsersQuery(_0x2bf07a,_0x4e12cb){var _0x378218=utils[_0x5b5c('0xc')](_0x2bf07a);var _0x335601=_0x5b5c('0xd')+_0x2bf07a+_0x5b5c('0xe');var _0x1ffb10=squel[_0x5b5c('0x7')]()['field'](_0x5b5c('0xf'))['field']('u.fullname')[_0x5b5c('0x8')](_0x5b5c('0x10')+_0x378218)[_0x5b5c('0xa')](_0x335601,'ui')[_0x5b5c('0x11')](_0x5b5c('0x12'),'u',_0x5b5c('0x13'));if(_0x4e12cb[_0x5b5c('0x14')]>0x0){_0x1ffb10[_0x5b5c('0x15')](_0x5b5c('0x10')+_0x378218+_0x5b5c('0x16'),_[_0x5b5c('0x17')](_0x4e12cb,'id'));}return _0x1ffb10;}function getInteractionsQuery(_0x3c1c66){var _0x273fb2=utils[_0x5b5c('0x18')](_0x3c1c66);var _0x391766=utils[_0x5b5c('0x19')](_0x3c1c66);var _0x2e2f19=utils[_0x5b5c('0xc')](_0x3c1c66);return squel['select']()[_0x5b5c('0xa')](_0x273fb2[_0x5b5c('0x1a')],'i')[_0x5b5c('0x11')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5b5c('0x11')]('users','o',_0x5b5c('0x1b'))[_0x5b5c('0x11')](_0x273fb2[_0x5b5c('0x1c')],'a','a.id\x20=\x20i.'+_0x391766)[_0x5b5c('0x11')](_0x273fb2[_0x5b5c('0x1d')],'me','me.'+_0x2e2f19+_0x5b5c('0x1e'))[_0x5b5c('0x11')](_0x273fb2[_0x5b5c('0x1f')],'it','it.'+_0x2e2f19+'\x20=\x20i.id')['left_join'](_0x5b5c('0xb'),'t',_0x5b5c('0x20'));}function getSqlClauses(){var _0x2a3cd7={'body':squel[_0x5b5c('0x21')](),'contact':squel[_0x5b5c('0x21')](),'default':squel[_0x5b5c('0x21')](),'fields':squel[_0x5b5c('0x21')](),'filter':squel[_0x5b5c('0x21')](),'read':squel[_0x5b5c('0x21')](),'tags':{'clause':squel[_0x5b5c('0x21')](),'ids':null},'user':squel['expr']()};return _0x2a3cd7;}function parseTagParameter(_0xcbe361){var _0x164c6e=squel[_0x5b5c('0x21')]();if(_0xcbe361){var _0x4e3898=utils[_0x5b5c('0x22')](_0xcbe361);_0x4e3898[_0x5b5c('0x23')](function(_0x4fbb2e){_0x164c6e['or'](_0x5b5c('0x24'),'%,'+_0x4fbb2e+',%');});}return _0x164c6e;}function parseReadParameter(_0x1360eb){var _0x48bb9a='';if(_0x1360eb){_0x48bb9a=_0x5b5c('0x25');if(_0x1360eb==='1'){_0x48bb9a=_0x48bb9a[_0x5b5c('0x26')]('{OPERATOR}','=');}else{_0x48bb9a=_0x48bb9a['replace'](_0x5b5c('0x27'),'>');}}return _0x48bb9a;}function parseSearchFilter(_0x15603d,_0x14e39e){var _0xcfeaae=squel[_0x5b5c('0x21')]();if(_0x14e39e){var _0x34510d=_0x14e39e[_0x5b5c('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x34510d)){_0xcfeaae['or'](_0x5b5c('0x28'),_0x34510d+'%');switch(_0x15603d){case'sms':case _0x5b5c('0x29'):_0xcfeaae['or']('i.phone\x20LIKE\x20?',_0x34510d+'%');break;case _0x5b5c('0x2a'):_0xcfeaae['or'](_0x5b5c('0x2b'),_0x34510d+'%');break;case _0x5b5c('0x2c'):_0xcfeaae['or']('i.from\x20LIKE\x20?',_0x34510d+'%');break;case _0x5b5c('0x2d'):_0xcfeaae['or'](_0x5b5c('0x2e'),qs[_0x5b5c('0x2f')](_0x34510d,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5b5c('0x2f')](_0x34510d));break;}}else if(_0x15603d==='mail'&&qs[_0x5b5c('0x30')](_0x34510d)){_0xcfeaae['or']('c.email\x20LIKE\x20?',_0x34510d+'%');}else{if(_0x15603d==='mail'){_0xcfeaae['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5b5c('0x2f')](_0x34510d,!![]))['or'](_0x5b5c('0x31'),qs[_0x5b5c('0x2f')](_0x34510d));}else if(_0x15603d!==_0x5b5c('0x2a')){_0xcfeaae['or'](_0x5b5c('0x32'),qs[_0x5b5c('0x2f')](_0x34510d));}_0xcfeaae['or'](_0x5b5c('0x33'),qs[_0x5b5c('0x2f')](_0x34510d,!![]),null);}}return _0xcfeaae;}function parseAdvancedSearchFilter(_0x29e301,_0x3e844c){var _0x354353=getSqlClauses();var _0x49728=as[_0x5b5c('0x34')](_0x29e301);var _0x194923=_0x49728[_0x5b5c('0x35')];for(var _0x8f653f=0x0;_0x8f653f<_0x49728[_0x5b5c('0x36')][_0x5b5c('0x14')];_0x8f653f++){var _0x4a2e1e=_0x49728['conditions'][_0x8f653f];var _0x4c7131='i';var _0x2253d3=_['find'](_0x3e844c,[_0x5b5c('0x37'),_0x4a2e1e[_0x5b5c('0x8')]]);if(_0x2253d3){var _0x2fdd85=as['buildExpression'](_0x4c7131,_0x2253d3['type'],_0x4a2e1e);_0x354353[_0x5b5c('0x38')][_0x194923](_0x2fdd85[_0x5b5c('0x39')],_0x2fdd85[_0x5b5c('0x3a')][_0x5b5c('0x3b')],_0x2fdd85[_0x5b5c('0x3a')]['end']);}else{switch(_0x4a2e1e[_0x5b5c('0x8')]){case _0x5b5c('0x3c'):var _0x1ebcd0=parseReadParameter(_0x4a2e1e['value']);_0x354353[_0x5b5c('0x3d')][_0x5b5c('0x3e')](_0x1ebcd0);break;case _0x5b5c('0x3f'):if(_0x4a2e1e['operator']===_0x5b5c('0x40')){if(_0x4a2e1e[_0x5b5c('0x3a')][_0x5b5c('0x41')]('\x20')['length']>0x1){_0x354353[_0x5b5c('0x42')][_0x194923](_0x5b5c('0x33'),qs[_0x5b5c('0x2f')](_0x4a2e1e[_0x5b5c('0x3a')],!![]),null);}else{var _0x3a7f43='%'+_0x4a2e1e[_0x5b5c('0x3a')]+'%';_0x354353[_0x5b5c('0x42')][_0x194923](_0x5b5c('0x43'),_0x3a7f43,_0x3a7f43,_0x3a7f43);}}else{_0x2253d3=_[_0x5b5c('0x44')](_0x3e844c,['name','ContactId']);_0x4a2e1e[_0x5b5c('0x8')]='ContactId';_0x2fdd85=as[_0x5b5c('0x45')](_0x4c7131,_0x2253d3['type'],_0x4a2e1e);_0x354353[_0x5b5c('0x42')][_0x194923](_0x2fdd85[_0x5b5c('0x39')],_0x2fdd85[_0x5b5c('0x3a')][_0x5b5c('0x3b')],_0x2fdd85['value'][_0x5b5c('0x46')]);}break;case'Tag':var _0x3905e7=_0x4a2e1e[_0x5b5c('0x3a')][_0x5b5c('0x41')](',')[_0x5b5c('0x17')](function(_0x434b86){return Number(_0x434b86);});var _0x48fa3d=parseTagParameter(_0x3905e7);_0x354353[_0x5b5c('0x47')][_0x5b5c('0x48')][_0x5b5c('0x3e')](_0x48fa3d);_0x354353[_0x5b5c('0x47')]['ids']=_0x3905e7;break;case _0x5b5c('0x49'):if(_0x4a2e1e[_0x5b5c('0x4a')]==='$substring'){_0x354353[_0x5b5c('0x4b')][_0x194923](_0x5b5c('0x4c'),'%'+_0x4a2e1e['value']+'%',null);}else{_0x2253d3=_[_0x5b5c('0x44')](_0x3e844c,[_0x5b5c('0x37'),_0x5b5c('0x4d')]);_0x4a2e1e['field']='UserId';_0x2fdd85=as[_0x5b5c('0x45')](_0x4c7131,_0x2253d3[_0x5b5c('0x4e')],_0x4a2e1e);_0x354353[_0x5b5c('0x4b')][_0x194923](_0x2fdd85[_0x5b5c('0x39')],_0x2fdd85[_0x5b5c('0x3a')][_0x5b5c('0x3b')],_0x2fdd85[_0x5b5c('0x3a')][_0x5b5c('0x46')]);}break;case'body':case _0x5b5c('0x4f'):_0x2fdd85=as[_0x5b5c('0x45')]('me',null,_0x4a2e1e);_0x354353[_0x5b5c('0x50')][_0x194923](_0x2fdd85['text'],_0x2fdd85[_0x5b5c('0x3a')]['start'],_0x2fdd85['value'][_0x5b5c('0x46')]);break;}}}return _0x354353;}function parseModelFields(_0x5846a9,_0x5a1d48,_0x5edbbc){var _0x18854f=utils[_0x5b5c('0x19')](_0x5846a9);var _0x48faf5=squel['expr']();var _0x52fe73=_(_0x5a1d48)[_0x5b5c('0x51')]()[_0x5b5c('0x17')](function(_0x8a8f82){return _[_0x5b5c('0x52')](_0x5edbbc,[_0x5b5c('0x37'),_0x8a8f82])?_0x8a8f82:undefined;})[_0x5b5c('0x53')]()[_0x5b5c('0x3a')]();if(_0x52fe73[_0x5b5c('0x14')]>0x0){_0x52fe73[_0x5b5c('0x23')](function(_0x19ab27){if(_0x19ab27===_0x18854f){_0x48faf5['and']('i.'+_0x18854f+_0x5b5c('0x16'),[][_0x5b5c('0x54')](_0x5a1d48[_0x19ab27]));}else if(_0x19ab27===_0x5b5c('0x55')){var _0xeb22d9=JSON['parse'](_0x5a1d48[_0x19ab27])[_0x5b5c('0x56')];var _0x2d8bf2=JSON['parse'](_0x5a1d48[_0x19ab27])[_0x5b5c('0x57')];_0x48faf5['and'](_0x5b5c('0x58'),_0xeb22d9,_0x2d8bf2);}else{if(_0x5a1d48[_0x19ab27]===_0x5b5c('0x59')){_0x48faf5[_0x5b5c('0x3e')]('i.'+_0x19ab27+_0x5b5c('0x5a'));}else{_0x48faf5['and']('i.'+_0x19ab27+_0x5b5c('0x5b'),_0x5a1d48[_0x19ab27]);}}});}return _0x48faf5;}function parseQueryParameters(_0x1d2955,_0x499451,_0x188555){var _0xa9fa77=getSqlClauses();return Promise[_0x5b5c('0x5c')]()[_0x5b5c('0x5d')](function(){return parseModelFields(_0x1d2955,_0x499451,_0x188555);})[_0x5b5c('0x5d')](function(_0x171916){_0xa9fa77[_0x5b5c('0x5e')][_0x5b5c('0x3e')](_0x171916);return parseReadParameter(_0x499451[_0x5b5c('0x3d')]);})[_0x5b5c('0x5d')](function(_0x538769){_0xa9fa77[_0x5b5c('0x3d')]['and'](_0x538769);return parseTagParameter(_0x499451[_0x5b5c('0x5f')]);})['then'](function(_0x4300c1){_0xa9fa77['tags'][_0x5b5c('0x48')]['and'](_0x4300c1);return parseSearchFilter(_0x1d2955,_0x499451[_0x5b5c('0x60')]);})[_0x5b5c('0x5d')](function(_0x4aed10){_0xa9fa77['filter']=_0x4aed10;return _0xa9fa77;});}function checkAccountsRestrictions(_0x1d1c96,_0x4d67e8,_0x1d277d){var _0x374fd7=utils['getAccountFK'](_0x1d1c96);var _0x2bd470='get'+_[_0x5b5c('0x61')](_0x1d1c96)+(_0x1d1c96===_0x5b5c('0x62')?'Websites':'Accounts');var _0x3be2ad=squel[_0x5b5c('0x21')]();return Promise['resolve']()[_0x5b5c('0x5d')](function(){if(_0x1d277d[_0x5b5c('0x6')]&&_0x4d67e8['role']===_0x5b5c('0x63')){return _0x4d67e8[_0x2bd470]({'attributes':['id'],'raw':!![]});}})[_0x5b5c('0x5d')](function(_0x57e47f){if(_0x57e47f){if(_0x57e47f['length']===0x0){_0x3be2ad['and']('i.'+_0x374fd7+_0x5b5c('0x5a'));}else{_0x3be2ad['and']('i.'+_0x374fd7+_0x5b5c('0x16'),_['map'](_0x57e47f,'id'));}}else if(!_0x1d277d[_0x374fd7]){_0x3be2ad['and']('i.'+_0x374fd7+_0x5b5c('0x64'));}})[_0x5b5c('0x5d')](function(){return _0x3be2ad;});}function getClosedOrderClause(_0xd60c01,_0x410038){var _0xa9f951='';var _0x3490e4=[_0x5b5c('0x65'),_0x5b5c('0x66'),_0x5b5c('0x67')];if(_0xd60c01===_0x5b5c('0x2d')){_0x3490e4['unshift']('i.substatus');}if(_0x410038[_0x5b5c('0x68')]==='0'&&_0xd60c01===_0x5b5c('0x2d')){_0xa9f951=_0x5b5c('0x69');}else{if(_0x410038['closed']==='1'){_0x3490e4[_0x5b5c('0x6a')]();}_0xa9f951=_0x5b5c('0x6b')+_0x3490e4[_0x5b5c('0x6c')](',\x20')+')';}return _0xa9f951;}function getFilteredInteractions(_0x24be7b,_0xbebdb7,_0x7aea4a,_0x31e315){var _0x6788aa=utils[_0x5b5c('0xc')](_0x24be7b);var _0x340a33=_[_0x5b5c('0x61')](_0x24be7b)+_0x5b5c('0x6d');var _0x1c1adc=[];var _0x2445d5=getTagsQuery();var _0x1afe93={'type':db['Sequelize'][_0x5b5c('0x6e')][_0x5b5c('0x6f')],'raw':!![]};var _0x38162a=[];var _0x52261c=[];return db[_0x5b5c('0x70')]['query'](_0x2445d5[_0x5b5c('0x71')](),_0x1afe93)[_0x5b5c('0x5d')](function(_0x12253e){_0x1c1adc=_[_0x5b5c('0x72')](_0x12253e,'id');_0x1afe93=_[_0x5b5c('0x73')](_0x1afe93,{'model':db[_0x340a33],'mapToModel':!![],'nest':!![]});if(_0x7aea4a['fields']){_0x31e315[_0x5b5c('0x74')]['forEach'](function(_0x9b808a){_0xbebdb7[_0x5b5c('0x8')]('i.'+_0x9b808a);});}else{_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x75'),'unreadMessages');_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x76'),_0x5b5c('0x77'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x78'),_0x5b5c('0x79'));if(_0x24be7b===_0x5b5c('0x2d')){_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x7a'),_0x5b5c('0x7b'));_0xbebdb7['field'](_0x5b5c('0x7c'),_0x5b5c('0x7d'));_0xbebdb7['field']('i.id');_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x7e'));_0xbebdb7['field']('i.updatedAt');_0xbebdb7['field'](_0x5b5c('0x7f'));_0xbebdb7[_0x5b5c('0x8')]('i.closedAt');_0xbebdb7['field'](_0x5b5c('0x80'));_0xbebdb7['field']('i.lastMsgAt');_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x81'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x82'));_0xbebdb7[_0x5b5c('0x8')]('i.disposition');_0xbebdb7['field'](_0x5b5c('0x66'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x65'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x69'));_0xbebdb7['field'](_0x5b5c('0x83'));_0xbebdb7['field']('i.ContactId');_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x84'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x85'));}else if(_0x24be7b==='openchannel'){_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x86'),_0x5b5c('0x7d'));}else{_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x87'),'contactName');}if(_0x24be7b!==_0x5b5c('0x2d')){_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x88'));}_0xbebdb7[_0x5b5c('0x8')]('c.firstName',_0x5b5c('0x89'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x8a'),_0x5b5c('0x8b'));_0xbebdb7['field'](_0x5b5c('0x8c'),'Contact.email');_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x8d'),_0x5b5c('0x8e'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x8f'),_0x5b5c('0x90'));_0xbebdb7['field'](_0x5b5c('0x91'),_0x5b5c('0x92'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x93'),_0x5b5c('0x94'));_0xbebdb7[_0x5b5c('0x8')](_0x5b5c('0x95'),'Owner.internal');_0xbebdb7[_0x5b5c('0x8')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5b5c('0x96'));}if(_0x31e315[_0x5b5c('0x97')]){_0xbebdb7['limit'](_0x31e315[_0x5b5c('0x97')]);}if(_0x31e315['offset']){_0xbebdb7[_0x5b5c('0x98')](_0x31e315[_0x5b5c('0x98')]);}return db[_0x5b5c('0x70')][_0x5b5c('0x99')](_0xbebdb7[_0x5b5c('0x71')](),_0x1afe93);})[_0x5b5c('0x5d')](function(_0x5954ce){_0x38162a=_0x5954ce;var _0x379e4b=getUsersQuery(_0x24be7b,_0x38162a);return db[_0x5b5c('0x70')]['query'](_0x379e4b[_0x5b5c('0x71')](),_0x1afe93);})[_0x5b5c('0x5d')](function(_0x1308c0){_0x52261c=_['groupBy'](_0x1308c0,_0x6788aa);if(_0x24be7b==='mail'){return db[_0x5b5c('0x9a')][_0x5b5c('0x9b')]({'attributes':[_0x5b5c('0x9c')],'raw':!![]});}})[_0x5b5c('0x5d')](function(_0x47782a){var _0x2a58e7=_0x47782a?_0x47782a[_0x5b5c('0x9c')]:undefined;var _0x332aee=_0x38162a[_0x5b5c('0x17')](function(_0x1a8b78){return updateInteraction(_0x1a8b78,_0x1c1adc,_0x52261c,_0x2a58e7);});return Promise[_0x5b5c('0x9d')](_0x332aee);});}function countFilteredInteractions(_0x2e5d1d,_0x514afa){var _0x532872=_0x2e5d1d[_0x5b5c('0x9e')]();_0x532872[_0x5b5c('0x8')]('COUNT(*)');_0x532872['field'](_0x5b5c('0x75'),_0x5b5c('0x3c'));var _0x26cdd0=utils[_0x5b5c('0x22')](_0x514afa);if(!_[_0x5b5c('0x9f')](_0x26cdd0)){_0x532872[_0x5b5c('0x15')](_0x5b5c('0xa0'),_0x26cdd0);}var _0xa53a9a={'type':db[_0x5b5c('0xa1')][_0x5b5c('0x6e')][_0x5b5c('0x6f')],'raw':!![]};return db['sequelize'][_0x5b5c('0x99')](_0x532872[_0x5b5c('0x71')](),_0xa53a9a);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xf3c3=['c.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','role','agent','search','select','field','name','color','from','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','isNumeric','i.id\x20LIKE\x20?','sms','fax','i.from\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','buildExpression','default','text','value','end','read','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','start','Tag','tags','clause','and','ids','User','user','UserId','body','keys','some','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','Websites','Accounts','i.thirdDisposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','keyBy','merge','forEach','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.MailAccountId','i.UserId','openchannel','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.firstName','c.lastName'];(function(_0x49efa5,_0x2a8c59){var _0x247079=function(_0x46460c){while(--_0x46460c){_0x49efa5['push'](_0x49efa5['shift']());}};_0x247079(++_0x2a8c59);}(_0xf3c3,0x15c));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f3c('0x0'));var squel=require(_0x3f3c('0x1'));var as=require(_0x3f3c('0x2'));var qs=require(_0x3f3c('0x3'));var updateInteraction=require(_0x3f3c('0x4'))[_0x3f3c('0x5')];var utils=require(_0x3f3c('0x6'));var db=require(_0x3f3c('0x7'))['db'];function skipInteractionsQuery(_0x50a294,_0x4209e8,_0xcf83e6){var _0x24571f=![];var _0x497dc0=utils['getAccountFK'](_0x50a294);if(_0x4209e8[_0x3f3c('0x8')]===_0x3f3c('0x9')&&!_0xcf83e6[_0x3f3c('0xa')]&&!_0xcf83e6[_0x497dc0]){_0x24571f=!![];}return _0x24571f;}function getTagsQuery(){return squel[_0x3f3c('0xb')]()[_0x3f3c('0xc')]('id')[_0x3f3c('0xc')](_0x3f3c('0xd'))['field'](_0x3f3c('0xe'))[_0x3f3c('0xf')]('tools_tags');}function getUsersQuery(_0x44fd0d,_0x7cdbac){var _0x369a15=utils[_0x3f3c('0x10')](_0x44fd0d);var _0x2f3b49=_0x3f3c('0x11')+_0x44fd0d+_0x3f3c('0x12');var _0x3bbab9=squel[_0x3f3c('0xb')]()[_0x3f3c('0xc')](_0x3f3c('0x13'))[_0x3f3c('0xc')](_0x3f3c('0x14'))[_0x3f3c('0xc')](_0x3f3c('0x15')+_0x369a15)[_0x3f3c('0xf')](_0x2f3b49,'ui')[_0x3f3c('0x16')](_0x3f3c('0x17'),'u',_0x3f3c('0x18'));if(_0x7cdbac[_0x3f3c('0x19')]>0x0){_0x3bbab9[_0x3f3c('0x1a')](_0x3f3c('0x15')+_0x369a15+_0x3f3c('0x1b'),_[_0x3f3c('0x1c')](_0x7cdbac,'id'));}return _0x3bbab9;}function getInteractionsQuery(_0x4d958c){var _0x15790c=utils[_0x3f3c('0x1d')](_0x4d958c);var _0x4fe8ab=utils[_0x3f3c('0x1e')](_0x4d958c);var _0x18b0b1=utils['getInteractionFK'](_0x4d958c);return squel['select']()[_0x3f3c('0xf')](_0x15790c['interactions'],'i')['left_join']('cm_contacts','c',_0x3f3c('0x1f'))[_0x3f3c('0x16')]('users','o',_0x3f3c('0x20'))['left_join'](_0x15790c['accounts'],'a',_0x3f3c('0x21')+_0x4fe8ab)['left_join'](_0x15790c[_0x3f3c('0x22')],'me',_0x3f3c('0x23')+_0x18b0b1+_0x3f3c('0x24'))[_0x3f3c('0x16')](_0x15790c[_0x3f3c('0x25')],'it',_0x3f3c('0x26')+_0x18b0b1+_0x3f3c('0x24'))[_0x3f3c('0x16')](_0x3f3c('0x27'),'t',_0x3f3c('0x28'));}function getSqlClauses(){var _0x19969b={'body':squel[_0x3f3c('0x29')](),'contact':squel['expr'](),'default':squel[_0x3f3c('0x29')](),'fields':squel[_0x3f3c('0x29')](),'filter':squel[_0x3f3c('0x29')](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x3f3c('0x29')]()};return _0x19969b;}function parseTagParameter(_0x9ab74b){var _0xf4d13a=squel[_0x3f3c('0x29')]();if(_0x9ab74b){var _0x4cc456=utils[_0x3f3c('0x2a')](_0x9ab74b);_0x4cc456['forEach'](function(_0x4ebf73){_0xf4d13a['or'](_0x3f3c('0x2b'),'%,'+_0x4ebf73+',%');});}return _0xf4d13a;}function parseReadParameter(_0x214a52){var _0x16d825='';if(_0x214a52){_0x16d825=_0x3f3c('0x2c');if(_0x214a52==='1'){_0x16d825=_0x16d825[_0x3f3c('0x2d')]('{OPERATOR}','=');}else{_0x16d825=_0x16d825['replace']('{OPERATOR}','>');}}return _0x16d825;}function parseSearchFilter(_0x4e66b1,_0x5033e2){var _0xbd87b2=squel[_0x3f3c('0x29')]();if(_0x5033e2){var _0xc6f812=_0x5033e2['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x3f3c('0x2e')](_0xc6f812)){_0xbd87b2['or'](_0x3f3c('0x2f'),_0xc6f812+'%');switch(_0x4e66b1){case _0x3f3c('0x30'):case'whatsapp':_0xbd87b2['or']('i.phone\x20LIKE\x20?',_0xc6f812+'%');break;case _0x3f3c('0x31'):_0xbd87b2['or']('i.fax\x20LIKE\x20?',_0xc6f812+'%');break;case'openchannel':_0xbd87b2['or'](_0x3f3c('0x32'),_0xc6f812+'%');break;case _0x3f3c('0x33'):_0xbd87b2['or'](_0x3f3c('0x34'),qs[_0x3f3c('0x35')](_0xc6f812,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3f3c('0x35')](_0xc6f812));break;}}else if(_0x4e66b1===_0x3f3c('0x33')&&qs[_0x3f3c('0x36')](_0xc6f812)){_0xbd87b2['or'](_0x3f3c('0x37'),_0xc6f812+'%');}else{if(_0x4e66b1==='mail'){_0xbd87b2['or'](_0x3f3c('0x34'),qs['getFullTextValue'](_0xc6f812,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3f3c('0x35')](_0xc6f812));}else if(_0x4e66b1!=='fax'){_0xbd87b2['or'](_0x3f3c('0x38'),qs[_0x3f3c('0x35')](_0xc6f812));}_0xbd87b2['or'](_0x3f3c('0x39'),qs[_0x3f3c('0x35')](_0xc6f812,!![]),null);}}return _0xbd87b2;}function parseAdvancedSearchFilter(_0x591b17,_0x388859){var _0xcdcd4=getSqlClauses();var _0x3c4dc2=as[_0x3f3c('0x3a')](_0x591b17);var _0x44798e=_0x3c4dc2[_0x3f3c('0x3b')];for(var _0x49038f=0x0;_0x49038f<_0x3c4dc2['conditions']['length'];_0x49038f++){var _0x3a8565=_0x3c4dc2[_0x3f3c('0x3c')][_0x49038f];var _0x57c1b7='i';var _0x4b9346=_[_0x3f3c('0x3d')](_0x388859,[_0x3f3c('0xd'),_0x3a8565[_0x3f3c('0xc')]]);if(_0x4b9346){var _0x15264b=as[_0x3f3c('0x3e')](_0x57c1b7,_0x4b9346['type'],_0x3a8565);_0xcdcd4[_0x3f3c('0x3f')][_0x44798e](_0x15264b[_0x3f3c('0x40')],_0x15264b[_0x3f3c('0x41')]['start'],_0x15264b['value'][_0x3f3c('0x42')]);}else{switch(_0x3a8565[_0x3f3c('0xc')]){case'unreadMessages':var _0x10a841=parseReadParameter(_0x3a8565['value']);_0xcdcd4[_0x3f3c('0x43')]['and'](_0x10a841);break;case _0x3f3c('0x44'):if(_0x3a8565[_0x3f3c('0x45')]===_0x3f3c('0x46')){if(_0x3a8565[_0x3f3c('0x41')][_0x3f3c('0x47')]('\x20')[_0x3f3c('0x19')]>0x1){_0xcdcd4[_0x3f3c('0x48')][_0x44798e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3a8565['value'],!![]),null);}else{var _0x57ece5='%'+_0x3a8565[_0x3f3c('0x41')]+'%';_0xcdcd4[_0x3f3c('0x48')][_0x44798e](_0x3f3c('0x49'),_0x57ece5,_0x57ece5,_0x57ece5);}}else{_0x4b9346=_[_0x3f3c('0x3d')](_0x388859,[_0x3f3c('0xd'),'ContactId']);_0x3a8565[_0x3f3c('0xc')]=_0x3f3c('0x4a');_0x15264b=as[_0x3f3c('0x3e')](_0x57c1b7,_0x4b9346[_0x3f3c('0x4b')],_0x3a8565);_0xcdcd4[_0x3f3c('0x48')][_0x44798e](_0x15264b[_0x3f3c('0x40')],_0x15264b[_0x3f3c('0x41')][_0x3f3c('0x4c')],_0x15264b[_0x3f3c('0x41')][_0x3f3c('0x42')]);}break;case _0x3f3c('0x4d'):var _0x5357b0=_0x3a8565['value'][_0x3f3c('0x47')](',')['map'](function(_0x40e4d6){return Number(_0x40e4d6);});var _0x3df65c=parseTagParameter(_0x5357b0);_0xcdcd4[_0x3f3c('0x4e')][_0x3f3c('0x4f')][_0x3f3c('0x50')](_0x3df65c);_0xcdcd4[_0x3f3c('0x4e')][_0x3f3c('0x51')]=_0x5357b0;break;case _0x3f3c('0x52'):if(_0x3a8565['operator']===_0x3f3c('0x46')){_0xcdcd4[_0x3f3c('0x53')][_0x44798e]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x3a8565[_0x3f3c('0x41')]+'%',null);}else{_0x4b9346=_['find'](_0x388859,[_0x3f3c('0xd'),_0x3f3c('0x54')]);_0x3a8565[_0x3f3c('0xc')]=_0x3f3c('0x54');_0x15264b=as[_0x3f3c('0x3e')](_0x57c1b7,_0x4b9346[_0x3f3c('0x4b')],_0x3a8565);_0xcdcd4[_0x3f3c('0x53')][_0x44798e](_0x15264b[_0x3f3c('0x40')],_0x15264b[_0x3f3c('0x41')][_0x3f3c('0x4c')],_0x15264b[_0x3f3c('0x41')][_0x3f3c('0x42')]);}break;case'body':case'plainBody':_0x15264b=as[_0x3f3c('0x3e')]('me',null,_0x3a8565);_0xcdcd4[_0x3f3c('0x55')][_0x44798e](_0x15264b[_0x3f3c('0x40')],_0x15264b['value'][_0x3f3c('0x4c')],_0x15264b[_0x3f3c('0x41')][_0x3f3c('0x42')]);break;}}}return _0xcdcd4;}function parseModelFields(_0x3d0a16,_0x4caa90,_0x266889){var _0x355286=utils['getAccountFK'](_0x3d0a16);var _0x2632d1=squel[_0x3f3c('0x29')]();var _0x21fff8=_(_0x4caa90)[_0x3f3c('0x56')]()[_0x3f3c('0x1c')](function(_0x59a821){return _[_0x3f3c('0x57')](_0x266889,[_0x3f3c('0xd'),_0x59a821])?_0x59a821:undefined;})['compact']()[_0x3f3c('0x41')]();if(_0x21fff8[_0x3f3c('0x19')]>0x0){_0x21fff8['forEach'](function(_0x1c785e){if(_0x1c785e===_0x355286){_0x2632d1[_0x3f3c('0x50')]('i.'+_0x355286+_0x3f3c('0x1b'),[][_0x3f3c('0x58')](_0x4caa90[_0x1c785e]));}else if(_0x1c785e===_0x3f3c('0x59')){var _0x57a3a4=JSON['parse'](_0x4caa90[_0x1c785e])[_0x3f3c('0x5a')];var _0x3c0f18=JSON[_0x3f3c('0x5b')](_0x4caa90[_0x1c785e])[_0x3f3c('0x5c')];_0x2632d1[_0x3f3c('0x50')](_0x3f3c('0x5d'),_0x57a3a4,_0x3c0f18);}else{if(_0x4caa90[_0x1c785e]===_0x3f3c('0x5e')){_0x2632d1['and']('i.'+_0x1c785e+_0x3f3c('0x5f'));}else{_0x2632d1[_0x3f3c('0x50')]('i.'+_0x1c785e+_0x3f3c('0x60'),_0x4caa90[_0x1c785e]);}}});}return _0x2632d1;}function parseQueryParameters(_0x27a6d7,_0x5d0276,_0x2e89d7){var _0x3a37a9=getSqlClauses();return Promise[_0x3f3c('0x61')]()[_0x3f3c('0x62')](function(){return parseModelFields(_0x27a6d7,_0x5d0276,_0x2e89d7);})[_0x3f3c('0x62')](function(_0x316284){_0x3a37a9[_0x3f3c('0x63')]['and'](_0x316284);return parseReadParameter(_0x5d0276[_0x3f3c('0x43')]);})[_0x3f3c('0x62')](function(_0x5a3aac){_0x3a37a9['read'][_0x3f3c('0x50')](_0x5a3aac);return parseTagParameter(_0x5d0276[_0x3f3c('0x64')]);})[_0x3f3c('0x62')](function(_0x3defd6){_0x3a37a9[_0x3f3c('0x4e')]['clause'][_0x3f3c('0x50')](_0x3defd6);return parseSearchFilter(_0x27a6d7,_0x5d0276['filter']);})[_0x3f3c('0x62')](function(_0x141efe){_0x3a37a9[_0x3f3c('0x65')]=_0x141efe;return _0x3a37a9;});}function checkAccountsRestrictions(_0x5b593f,_0x9ba6fb,_0x43a2c7){var _0x2eb12b=utils[_0x3f3c('0x1e')](_0x5b593f);var _0xa4391d='get'+_[_0x3f3c('0x66')](_0x5b593f)+(_0x5b593f==='chat'?_0x3f3c('0x67'):_0x3f3c('0x68'));var _0x5c8b08=squel[_0x3f3c('0x29')]();return Promise[_0x3f3c('0x61')]()['then'](function(){if(_0x43a2c7[_0x3f3c('0xa')]&&_0x9ba6fb[_0x3f3c('0x8')]===_0x3f3c('0x9')){return _0x9ba6fb[_0xa4391d]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x41c30e){if(_0x41c30e){if(_0x41c30e[_0x3f3c('0x19')]===0x0){_0x5c8b08[_0x3f3c('0x50')]('i.'+_0x2eb12b+'\x20IS\x20NULL');}else{_0x5c8b08[_0x3f3c('0x50')]('i.'+_0x2eb12b+_0x3f3c('0x1b'),_[_0x3f3c('0x1c')](_0x41c30e,'id'));}}else if(!_0x43a2c7[_0x2eb12b]){_0x5c8b08[_0x3f3c('0x50')]('i.'+_0x2eb12b+'\x20IS\x20NOT\x20NULL');}})['then'](function(){return _0x5c8b08;});}function getClosedOrderClause(_0x56e0bf,_0x490048){var _0x1e1aca='';var _0x1bdb42=[_0x3f3c('0x69'),'i.secondDisposition','i.disposition'];if(_0x56e0bf==='mail'){_0x1bdb42[_0x3f3c('0x6a')](_0x3f3c('0x6b'));}if(_0x490048[_0x3f3c('0x6c')]==='0'&&_0x56e0bf===_0x3f3c('0x33')){_0x1e1aca=_0x3f3c('0x6b');}else{if(_0x490048['closed']==='1'){_0x1bdb42[_0x3f3c('0x6d')]();}_0x1e1aca=_0x3f3c('0x6e')+_0x1bdb42[_0x3f3c('0x6f')](',\x20')+')';}return _0x1e1aca;}function getFilteredInteractions(_0x8fe2e9,_0x4b3dd9,_0x29fcb0,_0x3215ae){var _0x11cdae=utils[_0x3f3c('0x10')](_0x8fe2e9);var _0x1a4c6f=_['capitalize'](_0x8fe2e9)+_0x3f3c('0x70');var _0x309122=[];var _0x210a4b=getTagsQuery();var _0x310596={'type':db[_0x3f3c('0x71')][_0x3f3c('0x72')][_0x3f3c('0x73')],'raw':!![]};var _0x335e24=[];var _0x556efb=[];return db[_0x3f3c('0x74')]['query'](_0x210a4b[_0x3f3c('0x75')](),_0x310596)[_0x3f3c('0x62')](function(_0x305afd){_0x309122=_[_0x3f3c('0x76')](_0x305afd,'id');_0x310596=_[_0x3f3c('0x77')](_0x310596,{'model':db[_0x1a4c6f],'mapToModel':!![],'nest':!![]});if(_0x29fcb0[_0x3f3c('0x63')]){_0x3215ae['attributes'][_0x3f3c('0x78')](function(_0x1e0949){_0x4b3dd9[_0x3f3c('0xc')]('i.'+_0x1e0949);});}else{_0x4b3dd9['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3f3c('0x79'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x7a'),_0x3f3c('0x7b'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x7c'),_0x3f3c('0x7d'));if(_0x8fe2e9===_0x3f3c('0x33')){_0x4b3dd9[_0x3f3c('0xc')]('a.email',_0x3f3c('0x7e'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x7f'),_0x3f3c('0x80'));_0x4b3dd9[_0x3f3c('0xc')]('i.id');_0x4b3dd9[_0x3f3c('0xc')]('i.createdAt');_0x4b3dd9[_0x3f3c('0xc')]('i.updatedAt');_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x81'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x82'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x83'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x84'));_0x4b3dd9[_0x3f3c('0xc')]('i.lastMsgDirection');_0x4b3dd9['field'](_0x3f3c('0x85'));_0x4b3dd9['field'](_0x3f3c('0x86'));_0x4b3dd9['field'](_0x3f3c('0x87'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x69'));_0x4b3dd9['field'](_0x3f3c('0x6b'));_0x4b3dd9[_0x3f3c('0xc')]('i.to');_0x4b3dd9['field']('i.ContactId');_0x4b3dd9['field'](_0x3f3c('0x88'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x89'));}else if(_0x8fe2e9===_0x3f3c('0x8a')){_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x8b'),_0x3f3c('0x80'));}else{_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x8c'),_0x3f3c('0x80'));}if(_0x8fe2e9!==_0x3f3c('0x33')){_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x8d'));}_0x4b3dd9['field'](_0x3f3c('0x8e'),'Contact.firstName');_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x8f'),'Contact.lastName');_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x90'),'Contact.email');_0x4b3dd9['field']('c.phone','Contact.phone');_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x91'),_0x3f3c('0x92'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x93'),_0x3f3c('0x94'));_0x4b3dd9[_0x3f3c('0xc')]('o.fullname',_0x3f3c('0x95'));_0x4b3dd9[_0x3f3c('0xc')](_0x3f3c('0x96'),'Owner.internal');_0x4b3dd9['field'](_0x3f3c('0x97'),_0x3f3c('0x98'));}if(_0x3215ae[_0x3f3c('0x99')]){_0x4b3dd9[_0x3f3c('0x99')](_0x3215ae[_0x3f3c('0x99')]);}if(_0x3215ae['offset']){_0x4b3dd9['offset'](_0x3215ae[_0x3f3c('0x9a')]);}return db[_0x3f3c('0x74')][_0x3f3c('0x9b')](_0x4b3dd9['toString'](),_0x310596);})[_0x3f3c('0x62')](function(_0x23ffdd){_0x335e24=_0x23ffdd;var _0x334662=getUsersQuery(_0x8fe2e9,_0x335e24);return db[_0x3f3c('0x74')][_0x3f3c('0x9b')](_0x334662['toString'](),_0x310596);})[_0x3f3c('0x62')](function(_0x3d2f35){_0x556efb=_['groupBy'](_0x3d2f35,_0x11cdae);if(_0x8fe2e9===_0x3f3c('0x33')){return db['Setting']['findOne']({'attributes':[_0x3f3c('0x9c')],'raw':!![]});}})['then'](function(_0x29bc11){var _0x2cd0e6=_0x29bc11?_0x29bc11[_0x3f3c('0x9c')]:undefined;var _0x5321f2=_0x335e24['map'](function(_0x7bbc94){return updateInteraction(_0x7bbc94,_0x309122,_0x556efb,_0x2cd0e6);});return Promise[_0x3f3c('0x9d')](_0x5321f2);});}function countFilteredInteractions(_0x5d207a,_0x1e87f6){var _0x4d95a7=_0x5d207a[_0x3f3c('0x9e')]();_0x4d95a7[_0x3f3c('0xc')](_0x3f3c('0x9f'));_0x4d95a7[_0x3f3c('0xc')](_0x3f3c('0xa0'),_0x3f3c('0x79'));var _0x3ca5fa=utils[_0x3f3c('0x2a')](_0x1e87f6);if(!_[_0x3f3c('0xa1')](_0x3ca5fa)){_0x4d95a7[_0x3f3c('0x1a')](_0x3f3c('0xa2'),_0x3ca5fa);}var _0x28fef7={'type':db['Sequelize']['QueryTypes'][_0x3f3c('0x73')],'raw':!![]};return db['sequelize']['query'](_0x4d95a7[_0x3f3c('0x75')](),_0x28fef7);}module[_0x3f3c('0xa3')]={'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 965c6fa..fe7e64e 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 _0x8561=['Tags','lodash','../../mysqldb','map','fullname','split','forEach','push','waiting','talking','answered','disposition','abandoned','UserId','unmanaged','total','MailMessage','findOne','out','plainBody','then','lastMsgText','catch','TagIds'];(function(_0xa5e0d6,_0x543c15){var _0x137a5d=function(_0x302ece){while(--_0x302ece){_0xa5e0d6['push'](_0xa5e0d6['shift']());}};_0x137a5d(++_0x543c15);}(_0x8561,0xd9));var _0x1856=function(_0x53c739,_0x34dd56){_0x53c739=_0x53c739-0x0;var _0x1cf22e=_0x8561[_0x53c739];return _0x1cf22e;};'use strict';var _=require(_0x1856('0x0'));var db=require(_0x1856('0x1'))['db'];function getInteractionUsers(_0xa8abfa,_0x5d24e6){return new Promise(function(_0x463fcd,_0x6ec212){try{var _0x1fe3e4=[];if(_0x5d24e6[_0xa8abfa]){_0x1fe3e4=_0x5d24e6[_0xa8abfa][_0x1856('0x2')](function(_0xc6edd1){return{'id':_0xc6edd1['id'],'fullname':_0xc6edd1[_0x1856('0x3')]};});}return _0x463fcd(_0x1fe3e4);}catch(_0x3a2296){_0x6ec212(_0x3a2296);}});}function getInteractionTags(_0x33d5e6,_0x24b2a7){var _0x36823e=[];if(_0x33d5e6){_0x33d5e6[_0x1856('0x4')](',')[_0x1856('0x5')](function(_0x131528){_0x36823e[_0x1856('0x6')](_0x24b2a7[_0x131528]);});}return _0x36823e;}function updateWaitingCounter(_0x3e918c){if(_0x3e918c['waiting']){_0x3e918c['waiting']-=0x1;}}function updateInteractionCounters(_0x19e347){_0x19e347[_0x1856('0x7')]=0x0;_0x19e347[_0x1856('0x8')]=0x0;_0x19e347[_0x1856('0x9')]=0x0;_0x19e347['unmanaged']=0x0;_0x19e347['abandoned']=0x0;_0x19e347['total']=0x0;if(_0x19e347['closed']){if(_0x19e347[_0x1856('0xa')]===_0x1856('0xb')){_0x19e347[_0x1856('0xb')]+=0x1;updateWaitingCounter(_0x19e347);}if(_0x19e347[_0x1856('0xc')]){_0x19e347[_0x1856('0x9')]+=0x1;if(_0x19e347[_0x1856('0x8')]){_0x19e347[_0x1856('0x8')]-=0x1;}}else{if(_0x19e347['disposition']){_0x19e347[_0x1856('0xd')]+=0x1;updateWaitingCounter(_0x19e347);}}}else{if(!_0x19e347['UserId']){_0x19e347['waiting']+=0x1;}if(_0x19e347[_0x1856('0xc')]){_0x19e347[_0x1856('0x8')]+=0x1;updateWaitingCounter(_0x19e347);}}_0x19e347[_0x1856('0xe')]+=0x1;return _0x19e347;}function getLastMessageText(_0x1b7cf4){return db[_0x1856('0xf')][_0x1856('0x10')]({'where':{'$and':[{'MailInteractionId':_0x1b7cf4['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1856('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1856('0x12')],'order':'-id','raw':!![]})[_0x1856('0x13')](function(_0x208971){if(_0x208971&&_0x208971['plainBody']){_0x1b7cf4[_0x1856('0x14')]=_['trimStart'](_0x208971[_0x1856('0x12')]);}return _0x1b7cf4;})[_0x1856('0x15')](function(_0x30d10a){throw _0x30d10a;});}exports['updateInteraction']=function(_0x1a0f53,_0x5ef896,_0x24510b,_0x308a30){return new Promise(function(_0x30505e,_0x4aa2f4){return getInteractionUsers(_0x1a0f53['id'],_0x24510b)[_0x1856('0x13')](function(_0x42edee){_0x1a0f53['Users']=_0x42edee;return getInteractionTags(_0x1a0f53[_0x1856('0x16')],_0x5ef896);})['then'](function(_0x4b9717){_0x1a0f53[_0x1856('0x17')]=_0x4b9717;delete _0x1a0f53[_0x1856('0x16')];return updateInteractionCounters(_0x1a0f53);})['then'](function(_0x38ed94){if(_0x308a30){return getLastMessageText(_0x38ed94);}else{return _0x38ed94;}})[_0x1856('0x13')](function(_0x40c437){_0x30505e(_0x40c437);})[_0x1856('0x15')](function(_0x5b5753){_0x4aa2f4(_0x5b5753);});});}; \ No newline at end of file +var _0x5378=['talking','answered','unmanaged','abandoned','disposition','UserId','MailMessage','findOne','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','TagIds','../../mysqldb','map','fullname','split','forEach','push','waiting'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x5378,0x157));var _0x8537=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5378[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var db=require(_0x8537('0x0'))['db'];function getInteractionUsers(_0x29af0e,_0x41ae4e){return new Promise(function(_0x274a7c,_0x912899){try{var _0x11ff53=[];if(_0x41ae4e[_0x29af0e]){_0x11ff53=_0x41ae4e[_0x29af0e][_0x8537('0x1')](function(_0x2c76cf){return{'id':_0x2c76cf['id'],'fullname':_0x2c76cf[_0x8537('0x2')]};});}return _0x274a7c(_0x11ff53);}catch(_0x33468a){_0x912899(_0x33468a);}});}function getInteractionTags(_0x286a44,_0x447674){var _0x5cd855=[];if(_0x286a44){_0x286a44[_0x8537('0x3')](',')[_0x8537('0x4')](function(_0x29570f){_0x5cd855[_0x8537('0x5')](_0x447674[_0x29570f]);});}return _0x5cd855;}function updateWaitingCounter(_0xf9f4fb){if(_0xf9f4fb[_0x8537('0x6')]){_0xf9f4fb['waiting']-=0x1;}}function updateInteractionCounters(_0x3ad2cb){_0x3ad2cb['waiting']=0x0;_0x3ad2cb[_0x8537('0x7')]=0x0;_0x3ad2cb[_0x8537('0x8')]=0x0;_0x3ad2cb[_0x8537('0x9')]=0x0;_0x3ad2cb[_0x8537('0xa')]=0x0;_0x3ad2cb['total']=0x0;if(_0x3ad2cb['closed']){if(_0x3ad2cb[_0x8537('0xb')]===_0x8537('0xa')){_0x3ad2cb[_0x8537('0xa')]+=0x1;updateWaitingCounter(_0x3ad2cb);}if(_0x3ad2cb[_0x8537('0xc')]){_0x3ad2cb['answered']+=0x1;if(_0x3ad2cb[_0x8537('0x7')]){_0x3ad2cb[_0x8537('0x7')]-=0x1;}}else{if(_0x3ad2cb[_0x8537('0xb')]){_0x3ad2cb[_0x8537('0x9')]+=0x1;updateWaitingCounter(_0x3ad2cb);}}}else{if(!_0x3ad2cb[_0x8537('0xc')]){_0x3ad2cb[_0x8537('0x6')]+=0x1;}if(_0x3ad2cb[_0x8537('0xc')]){_0x3ad2cb['talking']+=0x1;updateWaitingCounter(_0x3ad2cb);}}_0x3ad2cb['total']+=0x1;return _0x3ad2cb;}function getLastMessageText(_0x55ef35){return db[_0x8537('0xd')][_0x8537('0xe')]({'where':{'$and':[{'MailInteractionId':_0x55ef35['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8537('0xf')],'order':_0x8537('0x10'),'raw':!![]})[_0x8537('0x11')](function(_0x2f0e73){if(_0x2f0e73&&_0x2f0e73[_0x8537('0xf')]){_0x55ef35[_0x8537('0x12')]=_[_0x8537('0x13')](_0x2f0e73[_0x8537('0xf')]);}return _0x55ef35;})[_0x8537('0x14')](function(_0x4c5d39){throw _0x4c5d39;});}exports[_0x8537('0x15')]=function(_0x22e063,_0x19ffaa,_0x6cd65e,_0x41b479){return new Promise(function(_0x28344b,_0x587052){return getInteractionUsers(_0x22e063['id'],_0x6cd65e)[_0x8537('0x11')](function(_0x5b6c5c){_0x22e063[_0x8537('0x16')]=_0x5b6c5c;return getInteractionTags(_0x22e063['TagIds'],_0x19ffaa);})[_0x8537('0x11')](function(_0x3b568e){_0x22e063[_0x8537('0x17')]=_0x3b568e;delete _0x22e063[_0x8537('0x18')];return updateInteractionCounters(_0x22e063);})['then'](function(_0x1130e6){if(_0x41b479){return getLastMessageText(_0x1130e6);}else{return _0x1130e6;}})['then'](function(_0x82e15d){_0x28344b(_0x82e15d);})[_0x8537('0x14')](function(_0x5a6930){_0x587052(_0x5a6930);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 82b33a4..4353c66 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 _0x2825=['then','info','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_messages','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify','Interaction','findOne','update'];(function(_0x187d80,_0x5b793f){var _0x498a77=function(_0x633dc9){while(--_0x633dc9){_0x187d80['push'](_0x187d80['shift']());}};_0x498a77(++_0x5b793f);}(_0x2825,0x1f4));var _0x5282=function(_0x43a6be,_0x1fa720){_0x43a6be=_0x43a6be-0x0;var _0x11fa35=_0x2825[_0x43a6be];return _0x11fa35;};'use strict';var _=require('lodash');var db=require(_0x5282('0x0'))['db'];var loggers={'openchannel':require(_0x5282('0x1'))(_0x5282('0x2')),'mail':require(_0x5282('0x1'))(_0x5282('0x3')),'fax':require(_0x5282('0x1'))(_0x5282('0x4')),'sms':require(_0x5282('0x1'))(_0x5282('0x5')),'chat':require(_0x5282('0x1'))(_0x5282('0x6')),'whatsapp':require(_0x5282('0x1'))(_0x5282('0x7'))};function getAccountFK(_0x383e64){return _[_0x5282('0x8')](_0x383e64)+(_0x383e64===_0x5282('0x9')?'Website':_0x5282('0xa'))+'Id';}function getInteractionFK(_0x47e017){return _['capitalize'](_0x47e017)+_0x5282('0xb');}function getInteractionId(_0x227171,_0x1f0179,_0x30ee6f){if(_0x227171&&_0x227171[_[_0x5282('0xc')](_0x30ee6f)+_0x5282('0xb')]){return _0x227171[_[_0x5282('0xc')](_0x30ee6f)+_0x5282('0xb')];}else if(_0x227171&&_0x227171['id']){return _0x227171['id'];}else if(_0x1f0179&&_0x1f0179['id']){return _0x1f0179['id'];}else{return _0x5282('0xd');}}function getInteractionsTables(_0x5372bf){return{'accounts':_0x5372bf+'_'+(_0x5372bf===_0x5282('0x9')?_0x5282('0xe'):_0x5282('0xf')),'interactions':_0x5372bf+_0x5282('0x10'),'interactionsTags':_0x5372bf+'_interaction_has_tags','messages':_0x5372bf+_0x5282('0x11'),'userInteractions':_0x5282('0x12')+_0x5372bf+_0x5282('0x10')};}function getSelectedTags(_0x145e84){var _0x4fe738=[];if(_0x145e84){_0x4fe738=Array[_0x5282('0x13')](_0x145e84)?_0x145e84:[_0x145e84];}return _0x4fe738;}function log(_0x28f0cb,_0x10cf94,_0x11d9d9,_0x1320c1,_0x54054e,_0x45435e){loggers[_0x54054e[_0x5282('0x14')]()][_0x28f0cb]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x45435e[_0x5282('0x15')](),_0x10cf94?_0x10cf94['id']:null,_0x10cf94?_0x10cf94[_0x5282('0x16')]:null,_0x10cf94?_0x10cf94[_0x5282('0x17')]:null,getInteractionId(_0x11d9d9,_0x1320c1,_0x54054e),_0x11d9d9?JSON[_0x5282('0x18')](_0x11d9d9):'null');}function updateUser(_0x2e94e0,_0x3964cb,_0x27d13f,_0x444ed6,_0xfdff5a){db[_[_0x5282('0xc')](_0x444ed6)+_0x5282('0x19')][_0x5282('0x1a')]({'where':{'id':getInteractionId(_0x3964cb,_0x27d13f,_0x444ed6)}})['then'](function(_0x3f4709){if(_0x3f4709){return _0x3f4709[_0x5282('0x1b')]({'UserId':_0x2e94e0?_0x2e94e0['id']:null});}})[_0x5282('0x1c')](function(_0x170d0a){if(_0x170d0a){log(_0x5282('0x1d'),_0x2e94e0,_0x3964cb,_0x27d13f,_0x444ed6,_0xfdff5a);}})[_0x5282('0x1e')](function(){log(_0x5282('0x1f'),_0x2e94e0,_0x3964cb,_0x27d13f,_0x444ed6,_0xfdff5a);});}module[_0x5282('0x20')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x2989=['openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interaction_has_tags','_messages','user_has_','_interactions','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','then','update','catch','error','exports','../../config/logger'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x2989,0x73));var _0x9298=function(_0x283ec2,_0x4d1c02){_0x283ec2=_0x283ec2-0x0;var _0xdc5b57=_0x2989[_0x283ec2];return _0xdc5b57;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x9298('0x0'))(_0x9298('0x1')),'mail':require(_0x9298('0x0'))(_0x9298('0x2')),'fax':require(_0x9298('0x0'))(_0x9298('0x3')),'sms':require('../../config/logger')(_0x9298('0x4')),'chat':require(_0x9298('0x0'))(_0x9298('0x5')),'whatsapp':require(_0x9298('0x0'))('whatsapp-interactions')};function getAccountFK(_0xcce773){return _[_0x9298('0x6')](_0xcce773)+(_0xcce773===_0x9298('0x7')?_0x9298('0x8'):_0x9298('0x9'))+'Id';}function getInteractionFK(_0x2ee046){return _[_0x9298('0x6')](_0x2ee046)+_0x9298('0xa');}function getInteractionId(_0x2a5b2f,_0x50cc2b,_0x3d32a4){if(_0x2a5b2f&&_0x2a5b2f[_['upperFirst'](_0x3d32a4)+_0x9298('0xa')]){return _0x2a5b2f[_[_0x9298('0xb')](_0x3d32a4)+_0x9298('0xa')];}else if(_0x2a5b2f&&_0x2a5b2f['id']){return _0x2a5b2f['id'];}else if(_0x50cc2b&&_0x50cc2b['id']){return _0x50cc2b['id'];}else{return _0x9298('0xc');}}function getInteractionsTables(_0x12a5f2){return{'accounts':_0x12a5f2+'_'+(_0x12a5f2===_0x9298('0x7')?'websites':_0x9298('0xd')),'interactions':_0x12a5f2+'_interactions','interactionsTags':_0x12a5f2+_0x9298('0xe'),'messages':_0x12a5f2+_0x9298('0xf'),'userInteractions':_0x9298('0x10')+_0x12a5f2+_0x9298('0x11')};}function getSelectedTags(_0x4531a7){var _0x4d250c=[];if(_0x4531a7){_0x4d250c=Array['isArray'](_0x4531a7)?_0x4531a7:[_0x4531a7];}return _0x4d250c;}function log(_0xb0c488,_0xdcf625,_0x4056a2,_0x2b8a63,_0x444e32,_0x4c2997){loggers[_0x444e32['toLowerCase']()][_0xb0c488](_0x9298('0x12'),_0x4c2997[_0x9298('0x13')](),_0xdcf625?_0xdcf625['id']:null,_0xdcf625?_0xdcf625[_0x9298('0x14')]:null,_0xdcf625?_0xdcf625[_0x9298('0x15')]:null,getInteractionId(_0x4056a2,_0x2b8a63,_0x444e32),_0x4056a2?JSON[_0x9298('0x16')](_0x4056a2):_0x9298('0x17'));}function updateUser(_0x105f86,_0x139e91,_0xda7dd9,_0x26928e,_0x1f0f02){db[_[_0x9298('0xb')](_0x26928e)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x139e91,_0xda7dd9,_0x26928e)}})[_0x9298('0x18')](function(_0x41f81e){if(_0x41f81e){return _0x41f81e[_0x9298('0x19')]({'UserId':_0x105f86?_0x105f86['id']:null});}})['then'](function(_0x3c3f19){if(_0x3c3f19){log('info',_0x105f86,_0x139e91,_0xda7dd9,_0x26928e,_0x1f0f02);}})[_0x9298('0x1a')](function(){log(_0x9298('0x1b'),_0x105f86,_0x139e91,_0xda7dd9,_0x26928e,_0x1f0f02);});}module[_0x9298('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 8fb194a..67ae9ea 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 _0x4bb7=['license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','License','findOne','then','count','status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment'];(function(_0x9b3efc,_0x577a0d){var _0x200f05=function(_0x15ad7c){while(--_0x15ad7c){_0x9b3efc['push'](_0x9b3efc['shift']());}};_0x200f05(++_0x577a0d);}(_0x4bb7,0x19c));var _0x74bb=function(_0xed8026,_0x492c67){_0xed8026=_0xed8026-0x0;var _0x4b9950=_0x4bb7[_0xed8026];return _0x4b9950;};'use strict';var crypto=require('crypto');var util=require(_0x74bb('0x0'));var compose=require(_0x74bb('0x1'));var db=require(_0x74bb('0x2'))['db'];var config=require(_0x74bb('0x3'));function getValueFromLicense(_0xe70731,_0x490d49){if(_0xe70731&&_0x490d49){if(_0x490d49['data1']&&_0x490d49[_0x74bb('0x4')]){var _0x435071=_0x490d49[_0x74bb('0x5')];var _0x9ab6c7=_0x490d49[_0x74bb('0x4')];var _0x4f9efc=_0x435071['split']('-')[0x4];var _0x3ff57f=_0x435071[_0x74bb('0x6')]('-')[0x0];var _0x2d7063=crypto[_0x74bb('0x7')](_0x74bb('0x8'),util['format'](_0x74bb('0x9'),_0x4f9efc,_0x435071,_0x3ff57f));var _0x53cf7c=_0x2d7063[_0x74bb('0xa')](_0x9ab6c7,_0x74bb('0xb'),'utf8');_0x53cf7c+=_0x2d7063[_0x74bb('0xc')](_0x74bb('0xd'));var _0x3d78b8=JSON[_0x74bb('0xe')](_0x53cf7c);return _0x3d78b8[_0x74bb('0xf')](_0xe70731)?_0x3d78b8[_0xe70731]:null;}}return null;}function isLimit(_0x5726d3,_0x188c47,_0x579046,_0x41c2ad){var _0x51e62d=_0x188c47;return compose()['use'](function(_0x5c74ba,_0x1598fa,_0x2dd2b4){return db[_0x74bb('0x10')][_0x74bb('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x47d2c3){var _0x4e8951=getValueFromLicense(_0x5726d3,_0x47d2c3);return _0x4e8951?_0x4e8951:_0x51e62d;})[_0x74bb('0x12')](function(_0x1ec3a4){_0x51e62d=_0x1ec3a4;return _0x579046[_0x74bb('0x13')](_0x41c2ad);})[_0x74bb('0x12')](function(_0x5cd28b){if(_0x5cd28b>=_0x51e62d){return _0x1598fa[_0x74bb('0x14')](0x193)['json']({'message':util[_0x74bb('0x15')](_0x74bb('0x16'),_0x5726d3)});}_0x2dd2b4();})['catch'](function(_0x147740){_0x2dd2b4(_0x147740);});});}function isUserLimit(){return isLimit(_0x74bb('0x17'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x74bb('0x18')}]}});}exports[_0x74bb('0x19')]=isUserLimit; \ No newline at end of file +var _0xd400=['admin','user','isUserLimit','util','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','use','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User'];(function(_0x11ddf7,_0x178aa0){var _0x1a19f0=function(_0x1aaa34){while(--_0x1aaa34){_0x11ddf7['push'](_0x11ddf7['shift']());}};_0x1a19f0(++_0x178aa0);}(_0xd400,0x107));var _0x0d40=function(_0xf65238,_0x59edab){_0xf65238=_0xf65238-0x0;var _0x2e8975=_0xd400[_0xf65238];return _0x2e8975;};'use strict';var crypto=require('crypto');var util=require(_0x0d40('0x0'));var compose=require('composable-middleware');var db=require(_0x0d40('0x1'))['db'];var config=require(_0x0d40('0x2'));function getValueFromLicense(_0xbf35c1,_0x19404a){if(_0xbf35c1&&_0x19404a){if(_0x19404a['data1']&&_0x19404a[_0x0d40('0x3')]){var _0x41a77a=_0x19404a[_0x0d40('0x4')];var _0x32d29f=_0x19404a[_0x0d40('0x3')];var _0x435905=_0x41a77a['split']('-')[0x4];var _0xfcb75c=_0x41a77a[_0x0d40('0x5')]('-')[0x0];var _0x288073=crypto[_0x0d40('0x6')](_0x0d40('0x7'),util['format'](_0x0d40('0x8'),_0x435905,_0x41a77a,_0xfcb75c));var _0x4c3e42=_0x288073[_0x0d40('0x9')](_0x32d29f,_0x0d40('0xa'),_0x0d40('0xb'));_0x4c3e42+=_0x288073[_0x0d40('0xc')](_0x0d40('0xb'));var _0x5d475b=JSON['parse'](_0x4c3e42);return _0x5d475b['hasOwnProperty'](_0xbf35c1)?_0x5d475b[_0xbf35c1]:null;}}return null;}function isLimit(_0x3159fc,_0x25400d,_0x4067ad,_0x44343e){var _0x3214a5=_0x25400d;return compose()[_0x0d40('0xd')](function(_0x23c315,_0x561199,_0x17d761){return db['License'][_0x0d40('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x0d40('0xf')](function(_0x29305b){var _0x2bb040=getValueFromLicense(_0x3159fc,_0x29305b);return _0x2bb040?_0x2bb040:_0x3214a5;})[_0x0d40('0xf')](function(_0x4ed9ef){_0x3214a5=_0x4ed9ef;return _0x4067ad[_0x0d40('0x10')](_0x44343e);})[_0x0d40('0xf')](function(_0x35555b){if(_0x35555b>=_0x3214a5){return _0x561199[_0x0d40('0x11')](0x193)[_0x0d40('0x12')]({'message':util[_0x0d40('0x13')](_0x0d40('0x14'),_0x3159fc)});}_0x17d761();})['catch'](function(_0x591c90){_0x17d761(_0x591c90);});});}function isUserLimit(){return isLimit(_0x0d40('0x15'),0x1,db[_0x0d40('0x16')],{'where':{'$or':[{'role':_0x0d40('0x17')},{'role':_0x0d40('0x18')}]}});}exports[_0x0d40('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 34a5e4d..72dc84b 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 _0x7ea1=['indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','CAST(','\x20AS\x20','text','field','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','$between','start','$startsWith','$endsWith','pop','utcOffset','minutes','seconds','sqlOperator','startsWith','[$or]','and','replace','split','length','forEach','shift','match','filter'];(function(_0x4e94a4,_0x39ad68){var _0x243623=function(_0x1dbf21){while(--_0x1dbf21){_0x4e94a4['push'](_0x4e94a4['shift']());}};_0x243623(++_0x39ad68);}(_0x7ea1,0xc9));var _0x17ea=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x7ea1[_0x5d72da];return _0x43ebe7;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x205b1e){var _0x161f3c={'conditions':[]};_0x161f3c[_0x17ea('0x0')]=_[_0x17ea('0x1')](_0x205b1e,_0x17ea('0x2'))?'or':_0x17ea('0x3');var _0x354c41=_0x205b1e[_0x17ea('0x4')]('[$and]','')[_0x17ea('0x4')](_0x17ea('0x2'),'')[_0x17ea('0x5')]('||');for(var _0x122c6c=0x0;_0x122c6c<_0x354c41[_0x17ea('0x6')];_0x122c6c++){var _0x1b2691=_0x354c41[_0x122c6c][_0x17ea('0x5')](':=');var _0x487782=_0x1b2691[0x0];var _0x4ad01f=_0x1b2691['slice'](0x1);_0x4ad01f[_0x17ea('0x7')](function(_0x35cb03){var _0x5ed7fe=_0x35cb03['split']('[')[_0x17ea('0x8')]();var _0x4d315f=_0x35cb03[_0x17ea('0x9')](/\[(.*?)\]/g);_0x4d315f['forEach'](function(_0xcb243c){var _0x353ae1=_0xcb243c['split']('[')[_0x17ea('0xa')](function(_0x5e31ec){return _0x5e31ec[_0x17ea('0xb')](']')>-0x1;})[_0x17ea('0xc')](function(_0x582455){return _0x582455[_0x17ea('0x5')](']')[0x0];})[0x0];_0x161f3c[_0x17ea('0xd')][_0x17ea('0xe')]({'field':_0x487782,'operator':_0x5ed7fe,'value':_0x353ae1});});});}return _0x161f3c;};exports[_0x17ea('0xf')]=function(_0xf0892d,_0x351e4b,_0x2c5c5e){var _0x59ce10={};if(_0x351e4b===_0x17ea('0x10')){if(_0x2c5c5e[_0x17ea('0x11')]===_0x17ea('0x12')){_0x2c5c5e['operator']='$between';_0x2c5c5e[_0x17ea('0x13')]+=','+_0x2c5c5e['value'];}else if(_['includes']([_0x17ea('0x14'),_0x17ea('0x15')],_0x2c5c5e[_0x17ea('0x11')])){_0x2c5c5e[_0x17ea('0x13')]=moment(_0x2c5c5e['value'])[_0x17ea('0x16')](0x1,_0x17ea('0x17'))[_0x17ea('0x18')](_0x17ea('0x19'));}}if(_0x2c5c5e[_0x17ea('0x1a')]){_0x351e4b=_0x2c5c5e[_0x17ea('0x1a')];_0x59ce10['text']=_0x17ea('0x1b')+_0xf0892d+'.'+_0x2c5c5e['field']+_0x17ea('0x1c')+_0x2c5c5e['castTo']+')\x20'+parseOperator(_0x2c5c5e[_0x17ea('0x11')]);}else{_0x59ce10[_0x17ea('0x1d')]=_0xf0892d+'.'+_0x2c5c5e[_0x17ea('0x1e')]+'\x20'+parseOperator(_0x2c5c5e[_0x17ea('0x11')]);}if(_['includes'](['$ne',_0x17ea('0x1f')],_0x2c5c5e['operator']))_0x59ce10['text']='('+_0x59ce10[_0x17ea('0x1d')]+_0x17ea('0x20')+_0xf0892d+'.'+_0x2c5c5e['field']+'\x20IS\x20NULL)';_0x59ce10[_0x17ea('0x13')]=parseValue(_0x351e4b,_0x2c5c5e['operator'],_0x2c5c5e[_0x17ea('0x13')]);return _0x59ce10;};function parseOperator(_0x431bd1){var _0xa908ab;switch(_0x431bd1){case _0x17ea('0x21'):_0xa908ab=_0x17ea('0x22');break;case'$notIn':_0xa908ab=_0x17ea('0x23');break;case _0x17ea('0x12'):_0xa908ab=_0x17ea('0x24');break;case _0x17ea('0x25'):_0xa908ab=_0x17ea('0x26');break;case _0x17ea('0x27'):case'$startsWith':case'$endsWith':_0xa908ab=_0x17ea('0x28');break;case _0x17ea('0x29'):_0xa908ab=_0x17ea('0x2a');break;case'$gt':_0xa908ab='>\x20?';break;case _0x17ea('0x15'):_0xa908ab=_0x17ea('0x2b');break;case _0x17ea('0x2c'):_0xa908ab='>=\x20?';break;case _0x17ea('0x2d'):_0xa908ab='BETWEEN\x20?\x20AND\x20?';break;}return _0xa908ab;}function parseValue(_0x3e9d2e,_0x3db04f,_0x5d15db){var _0xc265e9={'start':undefined,'end':undefined};switch(_0x3db04f){case _0x17ea('0x21'):case _0x17ea('0x1f'):_0xc265e9[_0x17ea('0x2e')]=_0x5d15db[_0x17ea('0x5')](',');break;case _0x17ea('0x27'):_0xc265e9[_0x17ea('0x2e')]='%'+_0x5d15db+'%';break;case _0x17ea('0x2f'):_0xc265e9[_0x17ea('0x2e')]=_0x5d15db+'%';break;case _0x17ea('0x30'):_0xc265e9[_0x17ea('0x2e')]='%'+_0x5d15db;break;case'$between':var _0x3bf3c2=_0x5d15db[_0x17ea('0x5')](',');var _0x5d15db=_0x3bf3c2[_0x17ea('0x8')]();var _0x2e3ed5=_0x3bf3c2[_0x17ea('0x31')]();if(_0x3e9d2e===_0x17ea('0x10')){_0x5d15db=moment(_0x5d15db)[_0x17ea('0x32')](0x0,!![])[_0x17ea('0x18')]();_0x2e3ed5=moment(_0x2e3ed5)[_0x17ea('0x32')](0x0,!![])['add'](0x17,'hours')[_0x17ea('0x16')](0x3b,_0x17ea('0x33'))[_0x17ea('0x16')](0x3b,_0x17ea('0x34'))[_0x17ea('0x18')]();}_0xc265e9={'start':_0x5d15db,'end':_0x2e3ed5};break;default:_0xc265e9[_0x17ea('0x2e')]=_0x5d15db;break;}return _0xc265e9;} \ No newline at end of file +var _0x186d=['LIKE\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','pop','utcOffset','hours','minutes','start','parseSearch','startsWith','[$or]','and','[$and]','split','length','slice','forEach','shift','match','filter','push','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0x186d,0xa4));var _0xd186=function(_0x46ce98,_0x52d764){_0x46ce98=_0x46ce98-0x0;var _0x172f46=_0x186d[_0x46ce98];return _0x172f46;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0xd186('0x0')]=function(_0xbedb81){var _0x2c9f17={'conditions':[]};_0x2c9f17['sqlOperator']=_[_0xd186('0x1')](_0xbedb81,_0xd186('0x2'))?'or':_0xd186('0x3');var _0x398e22=_0xbedb81['replace'](_0xd186('0x4'),'')['replace']('[$or]','')[_0xd186('0x5')]('||');for(var _0x5cb2e1=0x0;_0x5cb2e1<_0x398e22[_0xd186('0x6')];_0x5cb2e1++){var _0x5b9db7=_0x398e22[_0x5cb2e1][_0xd186('0x5')](':=');var _0x54e597=_0x5b9db7[0x0];var _0x4a97c3=_0x5b9db7[_0xd186('0x7')](0x1);_0x4a97c3[_0xd186('0x8')](function(_0x447b40){var _0x1c94f1=_0x447b40[_0xd186('0x5')]('[')[_0xd186('0x9')]();var _0x5428cd=_0x447b40[_0xd186('0xa')](/\[(.*?)\]/g);_0x5428cd['forEach'](function(_0x1088a0){var _0x3668c1=_0x1088a0[_0xd186('0x5')]('[')[_0xd186('0xb')](function(_0x4fcdbb){return _0x4fcdbb['indexOf'](']')>-0x1;})['map'](function(_0x484e94){return _0x484e94['split'](']')[0x0];})[0x0];_0x2c9f17['conditions'][_0xd186('0xc')]({'field':_0x54e597,'operator':_0x1c94f1,'value':_0x3668c1});});});}return _0x2c9f17;};exports[_0xd186('0xd')]=function(_0x47a454,_0x2912e9,_0x3baf48){var _0x1ed3b6={};if(_0x2912e9===_0xd186('0xe')){if(_0x3baf48['operator']===_0xd186('0xf')){_0x3baf48[_0xd186('0x10')]=_0xd186('0x11');_0x3baf48[_0xd186('0x12')]+=','+_0x3baf48[_0xd186('0x12')];}else if(_[_0xd186('0x13')]([_0xd186('0x14'),_0xd186('0x15')],_0x3baf48[_0xd186('0x10')])){_0x3baf48[_0xd186('0x12')]=moment(_0x3baf48[_0xd186('0x12')])[_0xd186('0x16')](0x1,_0xd186('0x17'))[_0xd186('0x18')](_0xd186('0x19'));}}if(_0x3baf48[_0xd186('0x1a')]){_0x2912e9=_0x3baf48[_0xd186('0x1a')];_0x1ed3b6[_0xd186('0x1b')]='CAST('+_0x47a454+'.'+_0x3baf48[_0xd186('0x1c')]+'\x20AS\x20'+_0x3baf48[_0xd186('0x1a')]+')\x20'+parseOperator(_0x3baf48[_0xd186('0x10')]);}else{_0x1ed3b6['text']=_0x47a454+'.'+_0x3baf48[_0xd186('0x1c')]+'\x20'+parseOperator(_0x3baf48['operator']);}if(_['includes']([_0xd186('0x1d'),_0xd186('0x1e')],_0x3baf48[_0xd186('0x10')]))_0x1ed3b6[_0xd186('0x1b')]='('+_0x1ed3b6[_0xd186('0x1b')]+_0xd186('0x1f')+_0x47a454+'.'+_0x3baf48[_0xd186('0x1c')]+_0xd186('0x20');_0x1ed3b6[_0xd186('0x12')]=parseValue(_0x2912e9,_0x3baf48[_0xd186('0x10')],_0x3baf48['value']);return _0x1ed3b6;};function parseOperator(_0x4d6a89){var _0x4f7a68;switch(_0x4d6a89){case _0xd186('0x21'):_0x4f7a68=_0xd186('0x22');break;case _0xd186('0x1e'):_0x4f7a68=_0xd186('0x23');break;case'$eq':_0x4f7a68=_0xd186('0x24');break;case'$ne':_0x4f7a68='<>\x20?';break;case _0xd186('0x25'):case _0xd186('0x26'):case _0xd186('0x27'):_0x4f7a68=_0xd186('0x28');break;case'$lt':_0x4f7a68='<\x20?';break;case _0xd186('0x14'):_0x4f7a68=_0xd186('0x29');break;case _0xd186('0x15'):_0x4f7a68=_0xd186('0x2a');break;case _0xd186('0x2b'):_0x4f7a68=_0xd186('0x2c');break;case _0xd186('0x11'):_0x4f7a68=_0xd186('0x2d');break;}return _0x4f7a68;}function parseValue(_0x532381,_0x336fab,_0x5ca659){var _0x343a19={'start':undefined,'end':undefined};switch(_0x336fab){case _0xd186('0x21'):case _0xd186('0x1e'):_0x343a19['start']=_0x5ca659[_0xd186('0x5')](',');break;case'$substring':_0x343a19['start']='%'+_0x5ca659+'%';break;case'$startsWith':_0x343a19['start']=_0x5ca659+'%';break;case'$endsWith':_0x343a19['start']='%'+_0x5ca659;break;case _0xd186('0x11'):var _0x3dc6a6=_0x5ca659[_0xd186('0x5')](',');var _0x5ca659=_0x3dc6a6[_0xd186('0x9')]();var _0x1632ff=_0x3dc6a6[_0xd186('0x2e')]();if(_0x532381===_0xd186('0xe')){_0x5ca659=moment(_0x5ca659)[_0xd186('0x2f')](0x0,!![])['format']();_0x1632ff=moment(_0x1632ff)['utcOffset'](0x0,!![])[_0xd186('0x16')](0x17,_0xd186('0x30'))[_0xd186('0x16')](0x3b,_0xd186('0x31'))[_0xd186('0x16')](0x3b,'seconds')[_0xd186('0x18')]();}_0x343a19={'start':_0x5ca659,'end':_0x1632ff};break;default:_0x343a19[_0xd186('0x32')]=_0x5ca659;break;}return _0x343a19;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index fc0663c..dc4cd17 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 _0x2b95=['DESC','cast','ASC','omit','length','isString','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','forEach','push','replace','{EXPR}','getOptions','query','$id','model','map','name','intersection','attributes','nolimit','where','filter','object','includes','columns','value','VIRTUAL','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','$lte','utc','subtract','uniqueid','isArray','limit','offset','sort','indexOf','priority','col','unsigned','substr'];(function(_0x30a40d,_0x13154d){var _0x4ebeea=function(_0x122e1c){while(--_0x122e1c){_0x30a40d['push'](_0x30a40d['shift']());}};_0x4ebeea(++_0x13154d);}(_0x2b95,0x1f1));var _0x52b9=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0x2b95[_0x566bdf];return _0x331215;};'use strict';var _=require(_0x52b9('0x0'));var sequelize=require(_0x52b9('0x1'));var moment=require(_0x52b9('0x2'));var db=require(_0x52b9('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xafb63f){var _0x205690=['ne'];try{var _0x333974=JSON[_0x52b9('0x4')](_0xafb63f);var _0x3bd570=Object[_0x52b9('0x5')](_0x333974)[0x0];return _0x205690['includes'](_0x3bd570);}catch(_0x291f61){return![];}}function getOperatorValue(_0x3165af){var _0x48fbd8=JSON[_0x52b9('0x4')](_0x3165af);var _0x59283c=Object[_0x52b9('0x5')](_0x48fbd8)[0x0];var _0xe022f6=_0x48fbd8[_0x59283c];return{['$'+_0x59283c]:_0xe022f6};}function parseIncludeModel(_0x533793){var _0x2f9100=JSON[_0x52b9('0x4')](_0x533793);return{'model':db[_0x2f9100['model']],'as':_0x2f9100[_0x52b9('0x6')],'attributes':_0x2f9100[_0x52b9('0x7')],'raw':_0x2f9100[_0x52b9('0x8')]};}exports['fields']=function(_0x50a645){var _0x5393f2=null;if(_0x50a645){_0x5393f2=_0x50a645[_0x52b9('0x9')](',');}return _0x5393f2;};exports[_0x52b9('0xa')]=function(_0x1e27f5,_0x1bff42){var _0x216d2a={};if(!_[_0x52b9('0xb')](_0x1e27f5)){_[_0x52b9('0xc')](_0x1e27f5,function(_0x561980,_0x54555c){try{if(_0x1bff42){var _0x4403f4=_[_0x52b9('0xd')](_0x1bff42,{'name':_0x54555c})||{};if(hasSequelizeOperator(_0x561980)){_0x216d2a[_0x54555c]=getOperatorValue(_0x561980);}else if(_0x4403f4[_0x52b9('0xe')]===_0x52b9('0xf')&&_[_0x52b9('0x10')](_0x561980)){var _0x57e96c=JSON[_0x52b9('0x4')](_0x561980);var _0x250346={'$gte':moment(moment(_0x57e96c['$gte'])[_0x52b9('0x11')]('YYYY-MM-DD'))['utc']()['format'](),'$lte':moment(moment(_0x57e96c[_0x52b9('0x12')])[_0x52b9('0x11')]('YYYY-MM-DD'))[_0x52b9('0x13')]()[_0x52b9('0x14')](0x1,'s')['format']()};_0x216d2a[_0x54555c]=_0x250346;}else if(_0x4403f4['name']===_0x52b9('0x15')){_0x216d2a[_0x54555c]=_0x561980;}else{_0x216d2a[_0x54555c]=_[_0x52b9('0x16')](_0x561980)?_0x561980:JSON['parse'](_0x561980);}}else{_0x216d2a[_0x54555c]=_['isArray'](_0x561980)?_0x561980:JSON['parse'](_0x561980);}}catch(_0x3f20c8){_0x216d2a[_0x54555c]=_0x561980[_0x52b9('0x9')](',');}});}return _0x216d2a;};exports[_0x52b9('0x17')]=function(_0xc46033){_0xc46033=parseInt(_0xc46033,0xa);if(!_0xc46033||_0xc46033<0x0){_0xc46033=LIMIT_VALUE;}return _0xc46033;};exports[_0x52b9('0x18')]=function(_0x107874){_0x107874=parseInt(_0x107874,0xa);if(!_0x107874||_0x107874<0x0){_0x107874=0x0;}return _0x107874;};exports[_0x52b9('0x19')]=function(_0x1055d1){var _0x5b0dcc,_0xe08976=null;if(_0x1055d1){_0x5b0dcc=_0x1055d1[_0x52b9('0x9')](',');_0xe08976=_['map'](_0x5b0dcc,function(_0x437ca2){if(_0x437ca2[_0x52b9('0x1a')]('-')===0x0){return[_0x437ca2===_0x52b9('0x1b')?sequelize['cast'](sequelize[_0x52b9('0x1c')]('priority'),_0x52b9('0x1d')):_0x437ca2[_0x52b9('0x1e')](0x1),_0x52b9('0x1f')];}else{return[_0x437ca2===_0x52b9('0x1b')?sequelize[_0x52b9('0x20')](sequelize[_0x52b9('0x1c')]('priority'),_0x52b9('0x1d')):_0x437ca2,_0x52b9('0x21')];}});}return _0xe08976;};exports[_0x52b9('0x22')]=function(_0x2146f3,_0x36220b){if(_[_0x52b9('0xb')](_0x2146f3)){return _0x2146f3;}if(_[_0x52b9('0x16')](_0x2146f3)){for(var _0x48c993=0x0;_0x48c993<_0x2146f3[_0x52b9('0x23')];_0x48c993+=0x1){_0x2146f3[_0x48c993]=this[_0x52b9('0x22')](_0x2146f3[_0x48c993],_0x36220b);}return _0x2146f3;}if(!_['isObject'](_0x2146f3)){return _0x2146f3;}if(_[_0x52b9('0x24')](_0x36220b)){_0x36220b=[_0x36220b];}if(!_[_0x52b9('0x16')](_0x36220b)){return _0x2146f3;}for(var _0x287f80=0x0;_0x287f80<_0x36220b[_0x52b9('0x23')];_0x287f80+=0x1){_['unset'](_0x2146f3,_0x36220b[_0x287f80]);}for(var _0x35f893 in _0x2146f3){if(_0x2146f3['hasOwnProperty'](_0x35f893)){_0x2146f3[_0x35f893]=this[_0x52b9('0x22')](_0x2146f3[_0x35f893],_0x36220b);}}return _0x2146f3;};exports[_0x52b9('0x25')]=function(_0x2d530b){return _0x2d530b['match'](RegExp(_0x52b9('0x26')))?!![]:![];};exports[_0x52b9('0x27')]=function(_0x2e09b5){return _0x2e09b5[_0x52b9('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x52b9('0x29')]=function(_0x31e5ad,_0x829acd){var _0x2cbc0d=[];var _0x1a9f94=/[ `!@#$%^&*()_\-?~]/;var _0x39e4bd=_0x829acd?_0x52b9('0x2a'):'{EXPR}';_0x31e5ad[_0x52b9('0x9')](/[ ,]+/)[_0x52b9('0x2b')](function(_0xe5408e){_0xe5408e=_0xe5408e['replace'](/([^:]")"+/g,'$1');_0xe5408e='+'+_0xe5408e+'*';var _0x1adcf7=_0xe5408e[_0x52b9('0x28')](_0x1a9f94);if(_0x1adcf7){_0xe5408e='\x22'+_0xe5408e+'\x22';}_0x2cbc0d[_0x52b9('0x2c')](_0xe5408e);});_0x39e4bd=_0x39e4bd[_0x52b9('0x2d')](_0x52b9('0x2e'),_0x2cbc0d['join']('\x20'));return _0x39e4bd;};exports[_0x52b9('0x2f')]=function(_0x29160c,_0x4b8bf9,_0x503305){var _0x12a915={},_0x5d3c31={};if(_0x4b8bf9[_0x52b9('0x30')]['$id']){_0x4b8bf9['query']['id']=_0x4b8bf9['query'][_0x52b9('0x31')];delete _0x4b8bf9[_0x52b9('0x30')][_0x52b9('0x31')];}_0x12a915[_0x52b9('0x32')]=_[_0x52b9('0x33')](_0x29160c,_0x52b9('0x34'));_0x12a915[_0x52b9('0x30')]=_[_0x52b9('0x5')](_0x4b8bf9[_0x52b9('0x30')]);_0x12a915[_0x52b9('0xa')]=_[_0x52b9('0x35')](_0x12a915[_0x52b9('0x32')],_0x12a915[_0x52b9('0x30')]);_0x5d3c31[_0x52b9('0x36')]=_[_0x52b9('0x35')](_0x12a915[_0x52b9('0x32')],this[_0x52b9('0x7')](_0x4b8bf9[_0x52b9('0x30')][_0x52b9('0x7')]));_0x5d3c31[_0x52b9('0x36')]=_0x5d3c31[_0x52b9('0x36')][_0x52b9('0x23')]?_0x5d3c31[_0x52b9('0x36')]:_0x12a915[_0x52b9('0x32')];if(!_0x4b8bf9[_0x52b9('0x30')]['hasOwnProperty'](_0x52b9('0x37'))){_0x5d3c31[_0x52b9('0x17')]=this[_0x52b9('0x17')](_0x4b8bf9[_0x52b9('0x30')][_0x52b9('0x17')]);_0x5d3c31['offset']=this['offset'](_0x4b8bf9[_0x52b9('0x30')][_0x52b9('0x18')]);}_0x5d3c31['order']=this[_0x52b9('0x19')](_0x4b8bf9['query'][_0x52b9('0x19')]);_0x5d3c31[_0x52b9('0x38')]=this[_0x52b9('0xa')](_['pick'](_0x4b8bf9[_0x52b9('0x30')],_0x12a915[_0x52b9('0xa')]),_0x29160c);if(_0x4b8bf9['query'][_0x52b9('0x39')]){var _0x21a78f=_0x29160c;var _0x2b7fe9=_0x4b8bf9[_0x52b9('0x30')][_0x52b9('0x39')];if(typeof _0x2b7fe9===_0x52b9('0x3a')){_0x21a78f=_[_0x52b9('0x39')](_0x29160c,function(_0x1812d3){return _[_0x52b9('0x3b')](_0x2b7fe9[_0x52b9('0x3c')],_0x1812d3[_0x52b9('0x34')]);});_0x2b7fe9=_0x2b7fe9[_0x52b9('0x3d')];}_0x5d3c31[_0x52b9('0x38')]=_['merge'](_0x5d3c31['where'],{'$or':_[_0x52b9('0x33')](_0x21a78f,function(_0x4dc307){if(_0x4dc307[_0x52b9('0xe')]!==_0x52b9('0x3e')){if(_0x503305){return sequelize[_0x52b9('0x38')](sequelize['fn']('lower',sequelize[_0x52b9('0x1c')](_0x4dc307['name'])),{'$like':sequelize['fn']('lower','%'+_0x4b8bf9[_0x52b9('0x30')]['filter']+'%')});}else{var _0xbc6385={};_0xbc6385[_0x4dc307[_0x52b9('0x34')]]={'$like':'%'+_0x4b8bf9[_0x52b9('0x30')][_0x52b9('0x39')]+'%'};return _0xbc6385;}}})});}_0x5d3c31=_['merge']({},_0x5d3c31,_0x4b8bf9[_0x52b9('0x3f')]);return _0x5d3c31;};exports[_0x52b9('0x40')]=function(_0x206179){var _0x1e752d=[];if(_0x206179[_0x52b9('0x41')]){_0x1e752d[_0x52b9('0x2c')]({'all':!![]});}else if(_0x206179[_0x52b9('0x40')]){if(Array[_0x52b9('0x16')](_0x206179[_0x52b9('0x40')])){_0x1e752d=Object[_0x52b9('0x5')](_0x206179[_0x52b9('0x40')])[_0x52b9('0x33')](function(_0x32cdc3){return parseIncludeModel(_0x206179[_0x52b9('0x40')][_0x32cdc3]);});}else{var _0x5e5460=parseIncludeModel(_0x206179[_0x52b9('0x40')]);_0x1e752d['push'](_0x5e5460);}}return _0x1e752d;}; \ No newline at end of file +var _0xd56f=['match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','map','intersection','attributes','nolimit','limit','order','sort','where','filter','object','columns','value','VIRTUAL','lower','merge','options','include','lodash','sequelize','moment','parse','keys','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','subtract','name','uniqueid','isArray','offset','col','priority','unsigned','substr','cast','omit','length','isObject','isString','hasOwnProperty','isNumeric'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xd56f,0xe8));var _0xfd56=function(_0x482815,_0x3601b1){_0x482815=_0x482815-0x0;var _0x272d11=_0xd56f[_0x482815];return _0x272d11;};'use strict';var _=require(_0xfd56('0x0'));var sequelize=require(_0xfd56('0x1'));var moment=require(_0xfd56('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4299d1){var _0x5b83cb=['ne'];try{var _0x1b786e=JSON[_0xfd56('0x3')](_0x4299d1);var _0x529405=Object[_0xfd56('0x4')](_0x1b786e)[0x0];return _0x5b83cb['includes'](_0x529405);}catch(_0x566176){return![];}}function getOperatorValue(_0x2454ba){var _0x1b0f15=JSON[_0xfd56('0x3')](_0x2454ba);var _0x305111=Object[_0xfd56('0x4')](_0x1b0f15)[0x0];var _0x2cf392=_0x1b0f15[_0x305111];return{['$'+_0x305111]:_0x2cf392};}function parseIncludeModel(_0x27ec81){var _0x2b3b03=JSON['parse'](_0x27ec81);return{'model':db[_0x2b3b03['model']],'as':_0x2b3b03[_0xfd56('0x5')],'attributes':_0x2b3b03[_0xfd56('0x6')],'raw':_0x2b3b03[_0xfd56('0x7')]};}exports[_0xfd56('0x6')]=function(_0x169ced){var _0x4cf672=null;if(_0x169ced){_0x4cf672=_0x169ced[_0xfd56('0x8')](',');}return _0x4cf672;};exports[_0xfd56('0x9')]=function(_0x486311,_0x5a2401){var _0x48d2db={};if(!_[_0xfd56('0xa')](_0x486311)){_[_0xfd56('0xb')](_0x486311,function(_0xcbc31b,_0x376f88){try{if(_0x5a2401){var _0x3a2091=_[_0xfd56('0xc')](_0x5a2401,{'name':_0x376f88})||{};if(hasSequelizeOperator(_0xcbc31b)){_0x48d2db[_0x376f88]=getOperatorValue(_0xcbc31b);}else if(_0x3a2091[_0xfd56('0xd')]===_0xfd56('0xe')&&_[_0xfd56('0xf')](_0xcbc31b)){var _0x265a4c=JSON['parse'](_0xcbc31b);var _0x411140={'$gte':moment(moment(_0x265a4c[_0xfd56('0x10')])[_0xfd56('0x11')](_0xfd56('0x12')))['utc']()[_0xfd56('0x11')](),'$lte':moment(moment(_0x265a4c[_0xfd56('0x13')])[_0xfd56('0x11')]('YYYY-MM-DD'))['utc']()[_0xfd56('0x14')](0x1,'s')[_0xfd56('0x11')]()};_0x48d2db[_0x376f88]=_0x411140;}else if(_0x3a2091[_0xfd56('0x15')]===_0xfd56('0x16')){_0x48d2db[_0x376f88]=_0xcbc31b;}else{_0x48d2db[_0x376f88]=_[_0xfd56('0x17')](_0xcbc31b)?_0xcbc31b:JSON[_0xfd56('0x3')](_0xcbc31b);}}else{_0x48d2db[_0x376f88]=_['isArray'](_0xcbc31b)?_0xcbc31b:JSON[_0xfd56('0x3')](_0xcbc31b);}}catch(_0x224817){_0x48d2db[_0x376f88]=_0xcbc31b[_0xfd56('0x8')](',');}});}return _0x48d2db;};exports['limit']=function(_0x85dd2b){_0x85dd2b=parseInt(_0x85dd2b,0xa);if(!_0x85dd2b||_0x85dd2b<0x0){_0x85dd2b=LIMIT_VALUE;}return _0x85dd2b;};exports[_0xfd56('0x18')]=function(_0x3b6f25){_0x3b6f25=parseInt(_0x3b6f25,0xa);if(!_0x3b6f25||_0x3b6f25<0x0){_0x3b6f25=0x0;}return _0x3b6f25;};exports['sort']=function(_0xf77efe){var _0x248cbc,_0xb22250=null;if(_0xf77efe){_0x248cbc=_0xf77efe['split'](',');_0xb22250=_['map'](_0x248cbc,function(_0x518381){if(_0x518381['indexOf']('-')===0x0){return[_0x518381==='priority'?sequelize['cast'](sequelize[_0xfd56('0x19')](_0xfd56('0x1a')),_0xfd56('0x1b')):_0x518381[_0xfd56('0x1c')](0x1),'DESC'];}else{return[_0x518381===_0xfd56('0x1a')?sequelize[_0xfd56('0x1d')](sequelize[_0xfd56('0x19')](_0xfd56('0x1a')),'unsigned'):_0x518381,'ASC'];}});}return _0xb22250;};exports[_0xfd56('0x1e')]=function(_0x2d3769,_0x166889){if(_[_0xfd56('0xa')](_0x2d3769)){return _0x2d3769;}if(_['isArray'](_0x2d3769)){for(var _0x2f40ba=0x0;_0x2f40ba<_0x2d3769[_0xfd56('0x1f')];_0x2f40ba+=0x1){_0x2d3769[_0x2f40ba]=this[_0xfd56('0x1e')](_0x2d3769[_0x2f40ba],_0x166889);}return _0x2d3769;}if(!_[_0xfd56('0x20')](_0x2d3769)){return _0x2d3769;}if(_[_0xfd56('0x21')](_0x166889)){_0x166889=[_0x166889];}if(!_[_0xfd56('0x17')](_0x166889)){return _0x2d3769;}for(var _0x3c1c78=0x0;_0x3c1c78<_0x166889[_0xfd56('0x1f')];_0x3c1c78+=0x1){_['unset'](_0x2d3769,_0x166889[_0x3c1c78]);}for(var _0x490103 in _0x2d3769){if(_0x2d3769[_0xfd56('0x22')](_0x490103)){_0x2d3769[_0x490103]=this[_0xfd56('0x1e')](_0x2d3769[_0x490103],_0x166889);}}return _0x2d3769;};exports[_0xfd56('0x23')]=function(_0x5bc3f1){return _0x5bc3f1[_0xfd56('0x24')](RegExp(_0xfd56('0x25')))?!![]:![];};exports[_0xfd56('0x26')]=function(_0x232986){return _0x232986[_0xfd56('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0xfd56('0x27')]=function(_0x4f81a1,_0x1ee7bd){var _0x342e08=[];var _0x5ecbd4=/[ `!@#$%^&*()_\-?~]/;var _0xd62f02=_0x1ee7bd?_0xfd56('0x28'):_0xfd56('0x29');_0x4f81a1[_0xfd56('0x8')](/[ ,]+/)[_0xfd56('0x2a')](function(_0x5b1271){_0x5b1271=_0x5b1271[_0xfd56('0x2b')](/([^:]")"+/g,'$1');_0x5b1271='+'+_0x5b1271+'*';var _0x1bc39e=_0x5b1271[_0xfd56('0x24')](_0x5ecbd4);if(_0x1bc39e){_0x5b1271='\x22'+_0x5b1271+'\x22';}_0x342e08[_0xfd56('0x2c')](_0x5b1271);});_0xd62f02=_0xd62f02[_0xfd56('0x2b')](_0xfd56('0x29'),_0x342e08[_0xfd56('0x2d')]('\x20'));return _0xd62f02;};exports[_0xfd56('0x2e')]=function(_0x72fffb,_0x37d63c,_0x282ad2){var _0x51a5c3={},_0x2dd0a3={};if(_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x30')]){_0x37d63c['query']['id']=_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x30')];delete _0x37d63c[_0xfd56('0x2f')][_0xfd56('0x30')];}_0x51a5c3[_0xfd56('0x31')]=_[_0xfd56('0x32')](_0x72fffb,_0xfd56('0x15'));_0x51a5c3[_0xfd56('0x2f')]=_[_0xfd56('0x4')](_0x37d63c[_0xfd56('0x2f')]);_0x51a5c3[_0xfd56('0x9')]=_[_0xfd56('0x33')](_0x51a5c3[_0xfd56('0x31')],_0x51a5c3[_0xfd56('0x2f')]);_0x2dd0a3[_0xfd56('0x34')]=_[_0xfd56('0x33')](_0x51a5c3['model'],this['fields'](_0x37d63c[_0xfd56('0x2f')]['fields']));_0x2dd0a3[_0xfd56('0x34')]=_0x2dd0a3[_0xfd56('0x34')][_0xfd56('0x1f')]?_0x2dd0a3['attributes']:_0x51a5c3['model'];if(!_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x22')](_0xfd56('0x35'))){_0x2dd0a3['limit']=this[_0xfd56('0x36')](_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x36')]);_0x2dd0a3['offset']=this[_0xfd56('0x18')](_0x37d63c['query'][_0xfd56('0x18')]);}_0x2dd0a3[_0xfd56('0x37')]=this[_0xfd56('0x38')](_0x37d63c['query'][_0xfd56('0x38')]);_0x2dd0a3[_0xfd56('0x39')]=this[_0xfd56('0x9')](_['pick'](_0x37d63c[_0xfd56('0x2f')],_0x51a5c3[_0xfd56('0x9')]),_0x72fffb);if(_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x3a')]){var _0x344516=_0x72fffb;var _0x88877b=_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x3a')];if(typeof _0x88877b===_0xfd56('0x3b')){_0x344516=_[_0xfd56('0x3a')](_0x72fffb,function(_0x2f593d){return _['includes'](_0x88877b[_0xfd56('0x3c')],_0x2f593d[_0xfd56('0x15')]);});_0x88877b=_0x88877b[_0xfd56('0x3d')];}_0x2dd0a3['where']=_['merge'](_0x2dd0a3[_0xfd56('0x39')],{'$or':_[_0xfd56('0x32')](_0x344516,function(_0x514436){if(_0x514436[_0xfd56('0xd')]!==_0xfd56('0x3e')){if(_0x282ad2){return sequelize[_0xfd56('0x39')](sequelize['fn'](_0xfd56('0x3f'),sequelize[_0xfd56('0x19')](_0x514436[_0xfd56('0x15')])),{'$like':sequelize['fn'](_0xfd56('0x3f'),'%'+_0x37d63c[_0xfd56('0x2f')][_0xfd56('0x3a')]+'%')});}else{var _0x2221c0={};_0x2221c0[_0x514436[_0xfd56('0x15')]]={'$like':'%'+_0x37d63c['query'][_0xfd56('0x3a')]+'%'};return _0x2221c0;}}})});}_0x2dd0a3=_[_0xfd56('0x40')]({},_0x2dd0a3,_0x37d63c[_0xfd56('0x41')]);return _0x2dd0a3;};exports['include']=function(_0xc862cc){var _0x222372=[];if(_0xc862cc['includeAll']){_0x222372['push']({'all':!![]});}else if(_0xc862cc[_0xfd56('0x42')]){if(Array[_0xfd56('0x17')](_0xc862cc[_0xfd56('0x42')])){_0x222372=Object[_0xfd56('0x4')](_0xc862cc[_0xfd56('0x42')])[_0xfd56('0x32')](function(_0x499dbb){return parseIncludeModel(_0xc862cc[_0xfd56('0x42')][_0x499dbb]);});}else{var _0x3563ed=parseIncludeModel(_0xc862cc[_0xfd56('0x42')]);_0x222372[_0xfd56('0x2c')](_0x3563ed);}}return _0x222372;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 3065ed5..9a867c1 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 _0x988c=['whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','pick','faxStatus','smsCapacity','chatCurrentCapacity','queue','getRealtimeAgentsQueryFields','lodash','http','client','chatPause','faxPause','mailPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','all','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','fullname','validateSortParameter','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','openchannelPause','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime'];(function(_0x139259,_0x115966){var _0x46c021=function(_0xa18b4a){while(--_0xa18b4a){_0x139259['push'](_0x139259['shift']());}};_0x46c021(++_0x115966);}(_0x988c,0x19e));var _0xc988=function(_0x27f4e2,_0x5fdea0){_0x27f4e2=_0x27f4e2-0x0;var _0x1e5faa=_0x988c[_0x27f4e2];return _0x1e5faa;};'use strict';var _=require(_0xc988('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xc988('0x1')]({'port':0x232a});var routingClient=jayson[_0xc988('0x2')][_0xc988('0x1')]({'port':0x232c});function isAgentPaused(_0x5a2b96,_0x5e41fb){var _0x54397d=[_0x5a2b96[_0xc988('0x3')],_0x5a2b96[_0xc988('0x4')],_0x5a2b96[_0xc988('0x5')],_0x5a2b96['openchannelPause'],_0x5a2b96[_0xc988('0x6')],_0x5a2b96[_0xc988('0x7')],_0x5a2b96['whatsappPause']];if(!_0x5e41fb)return _['every'](_0x54397d);var _0x2a96ab=_[_0xc988('0x8')](_0x54397d);return _0x2a96ab[_0xc988('0x9')]>0x0&&_0x2a96ab[_0xc988('0x9')]<_0x54397d[_0xc988('0x9')]?!![]:![];}function isIdle(_0x47d884){return _0x47d884===_0xc988('0xa')||_0x47d884===_0xc988('0xb')||_0x47d884===_0xc988('0xc')||_0x47d884===_0xc988('0xd')||_[_0xc988('0xe')](_0x47d884);}function isAgentIdle(_0x50d0b1){if(_0x50d0b1[_0xc988('0xf')]!==_0xc988('0xa')&&_0x50d0b1[_0xc988('0x7')]){_0x50d0b1['voiceStatus']=_0xc988('0x10');return![];}return _['every']([_0x50d0b1[_0xc988('0x11')],_0x50d0b1['faxStatus'],_0x50d0b1[_0xc988('0x12')],_0x50d0b1[_0xc988('0x13')],_0x50d0b1[_0xc988('0x14')],_0x50d0b1[_0xc988('0xf')],_0x50d0b1['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xc988('0x15')](_0xc988('0x16'),{})[_0xc988('0x17')](function(_0x26c251){if(_0x26c251[_0xc988('0x18')]){throw new Error(_0xc988('0x19'));}var _0xcb99f9=_0x26c251[_0xc988('0x1a')];return routingClient[_0xc988('0x15')](_0xc988('0x16'),{})[_0xc988('0x17')](function(_0x49738a){if(_0x49738a[_0xc988('0x18')]){throw new Error(_0xc988('0x1b'));}var _0x32319c=_0x49738a[_0xc988('0x1a')];return _[_0xc988('0x1c')]({},_0xcb99f9,_0x32319c);});})['catch'](function(_0x5d1c5f){throw _0x5d1c5f;});}exports[_0xc988('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x47f438){var _0x18cca5=_0xc988('0xb');if(isAgentPaused(_0x47f438))_0x18cca5='pause';else if(isAgentPaused(_0x47f438,!![]))_0x18cca5='*pause';else if(isAgentIdle(_0x47f438))_0x18cca5=_0xc988('0xa');else _0x18cca5=_0xc988('0x1e');return _0x18cca5;}exports[_0xc988('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x58b646,_0xc5754d){var _0x12dc1e=_[_0xc988('0x20')](_0x58b646)?_0x58b646:[_0x58b646];var _0x49fe1c=_[_0xc988('0x21')](_0xc5754d)+_0xc988('0x22');var _0x188685=_['map'](_0x12dc1e,function(_0x5444a5){return db[_0x49fe1c][_0xc988('0x23')]({'where':{'id':_0x5444a5}})[_0xc988('0x17')](function(_0xc3c27e){if(!_0xc3c27e)return[];return _0xc3c27e[_0xc988('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc988('0x25')](_0x188685)[_0xc988('0x17')](function(_0x176741){var _0xfb2eb4=_(_0x176741)['flatten']()[_0xc988('0x26')]('id')[_0xc988('0x27')]()[_0xc988('0x28')]();return _0xfb2eb4;});}exports[_0xc988('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x38bcee,_0x1c9d07,_0x3d0834){try{if(_0x1c9d07[_0xc988('0x9')]>0x0){_0x38bcee=_0x38bcee['filter'](function(_0x2a0d6f){return _0x1c9d07[_0xc988('0x2a')](_0x2a0d6f['id']);});}var _0x31a42b=_0x38bcee[_0xc988('0x8')](function(_0x4da32e){var _0x49b0c8=_0xc988('0x1e');if(isAgentIdle(_0x4da32e)){_0x49b0c8=_0xc988('0xa');}return _0x49b0c8===_0x3d0834;});return _[_0xc988('0x26')](_0x31a42b,'id');}catch(_0x4b954a){throw _0x4b954a;}}exports[_0xc988('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2da62e,_0x324e85,_0x467bd4){return Promise[_0xc988('0x2c')]()[_0xc988('0x17')](function(){if(_0x324e85[_0xc988('0x9')]>0x0){_0x2da62e=_0x2da62e[_0xc988('0x8')](function(_0x3a5fe7){return _0x324e85[_0xc988('0x2a')](_0x3a5fe7['id']);});}return _0x2da62e;})[_0xc988('0x17')](function(){return db[_0xc988('0x2d')][_0xc988('0x2e')]({'attributes':['id',_0xc988('0x2f'),'fullname','chatPause',_0xc988('0x4'),_0xc988('0x5'),'openchannelPause',_0xc988('0x6'),_0xc988('0x7'),'whatsappPause',_0xc988('0x30')],'where':{'id':{'$in':_[_0xc988('0x26')](_0x2da62e,'id')}},'raw':!![]});})[_0xc988('0x17')](function(_0x579f70){return _0x579f70['map'](function(_0x38e9a7){var _0x34fbe6=_[_0xc988('0x31')](_0x2da62e,['id',_0x38e9a7['id']]);var _0x2c105c=filterAgentAttributes(_0x34fbe6);_[_0xc988('0x1c')](_0x38e9a7,_0x2c105c);_0x38e9a7[_0xc988('0x32')]=getAgentStatus(_0x38e9a7);return _0x38e9a7;});})[_0xc988('0x17')](function(_0x17ff79){var _0x436fd7=sortAgentsByStatus(_0x17ff79,_0x467bd4);return _[_0xc988('0x26')](_0x436fd7,'id');})['catch'](function(_0x664212){throw _0x664212;});}exports[_0xc988('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1208a0){var _0x4a590e={'fields':[],'order':null};var _0x34c24d=_0x1208a0[_0xc988('0x34')](',');_0x4a590e['fields']=_[_0xc988('0x8')](_0x34c24d,function(_0x680618){if(!_0x680618['includes'](_0xc988('0x32'))){return!![];}_0x4a590e[_0xc988('0x35')]=_['startsWith'](_0x680618,'-')?_0xc988('0x36'):_0xc988('0x37');return![];});return _0x4a590e;}exports[_0xc988('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x5b61e9){if(!_0x5b61e9){_0x5b61e9=_0xc988('0x39');}if(_0x5b61e9[_0xc988('0x2a')]('fullname')&&!_0x5b61e9[_0xc988('0x2a')](_0xc988('0x3a'))){var _0x4cefe6=_0x5b61e9[_0xc988('0x3b')](0x0,_0x5b61e9[_0xc988('0x3c')](_0xc988('0x3d')));_0x5b61e9+=','+_0x4cefe6+_0xc988('0x3a');}return _0x5b61e9;}exports[_0xc988('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x13bf37,_0x4e63f9){var _0x197e03=_0x13bf37['sort'](function(_0xb95c1d,_0x21df84){if(_0xb95c1d['globalStatus']===_0x21df84[_0xc988('0x32')]){if(_0xb95c1d[_0xc988('0x32')]===_0xc988('0x10')){if(_0x4e63f9==='DESC'){return(_0xb95c1d['pauseType']||'')<(_0x21df84[_0xc988('0x30')]||'')||_0xb95c1d[_0xc988('0x3d')][_0xc988('0x3f')]()>_0x21df84[_0xc988('0x3d')][_0xc988('0x3f')]()?0x1:-0x1;}else{return(_0xb95c1d[_0xc988('0x30')]||'')<(_0x21df84[_0xc988('0x30')]||'')||_0xb95c1d[_0xc988('0x3d')]['toLowerCase']()>_0x21df84[_0xc988('0x3d')][_0xc988('0x3f')]()?-0x1:0x1;}}else{if(_0x4e63f9===_0xc988('0x36')){return _0xb95c1d[_0xc988('0x3d')][_0xc988('0x3f')]()<_0x21df84[_0xc988('0x3d')][_0xc988('0x3f')]()?0x1:-0x1;}else{return _0xb95c1d['fullname']['toLowerCase']()<_0x21df84['fullname'][_0xc988('0x3f')]()?-0x1:0x1;}}}else{if(_0x4e63f9==='DESC'){return _0xb95c1d[_0xc988('0x32')]<_0x21df84[_0xc988('0x32')]?0x1:-0x1;}else{return _0xb95c1d[_0xc988('0x32')]<_0x21df84[_0xc988('0x32')]?-0x1:0x1;}}});return _0x197e03;}exports[_0xc988('0x40')]=sortAgentsByStatus;function filterAgentAttributes(_0x225650){var _0x478a27=[_0xc988('0x41'),_0xc988('0x42'),_0xc988('0x43'),_0xc988('0x44'),_0xc988('0x30'),'lastPauseAt',_0xc988('0x3a'),'address',_0xc988('0x3'),_0xc988('0x45'),'mailPause','smsPause',_0xc988('0x46'),_0xc988('0x4'),_0xc988('0x7'),_0xc988('0x47'),_0xc988('0x48'),_0xc988('0x49'),'smsCapacity',_0xc988('0x4a'),_0xc988('0x4b'),'chatCurrentCapacity',_0xc988('0x4c'),_0xc988('0x4d'),_0xc988('0x4e'),_0xc988('0x4f'),_0xc988('0x50'),'chatStatus','openchannelStatus',_0xc988('0x12'),_0xc988('0x14'),_0xc988('0x51'),'faxStatus',_0xc988('0xf'),_0xc988('0x52'),_0xc988('0x53'),_0xc988('0x54'),_0xc988('0x55'),_0xc988('0x56'),_0xc988('0x57'),_0xc988('0x58'),'queue',_0xc988('0x59'),_0xc988('0x5a'),_0xc988('0x5b'),_0xc988('0x5c')];var _0x403e05=['chatPause',_0xc988('0x45'),_0xc988('0x5'),_0xc988('0x6'),_0xc988('0x46'),_0xc988('0x4'),_0xc988('0x7'),_0xc988('0x42')];var _0x513f59=_(_0x225650)[_0xc988('0x5d')](_0x403e05)[_0xc988('0x5e')](_0x478a27)['value']();return _0x513f59;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xc988('0x3d'),'role',_0xc988('0x3a'),_0xc988('0x42'),_0xc988('0x32'),_0xc988('0x41'),_0xc988('0x43'),_0xc988('0x30'),_0xc988('0x44'),_0xc988('0x4'),'chatPause',_0xc988('0x5'),'openchannelPause','smsPause',_0xc988('0x7'),_0xc988('0x46'),'chatStatus',_0xc988('0x5f'),_0xc988('0x12'),_0xc988('0x13'),'smsStatus','voiceStatus',_0xc988('0x51'),_0xc988('0x52'),'faxStatusTime',_0xc988('0x54'),_0xc988('0x53'),_0xc988('0x55'),_0xc988('0x58'),_0xc988('0x56'),_0xc988('0x47'),_0xc988('0x4b'),_0xc988('0x49'),_0xc988('0x48'),_0xc988('0x60'),_0xc988('0x4a'),_0xc988('0x61'),_0xc988('0x50'),_0xc988('0x4d'),'openchannelCurrentCapacity','smsCurrentCapacity',_0xc988('0x4f'),_0xc988('0x5b'),_0xc988('0x5c'),_0xc988('0x59'),'onhold',_0xc988('0x62'),_0xc988('0x5a')];}exports[_0xc988('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x5fdc=['length','idle','unknown','unavailable','ringing','isNil','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','voiceStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','catch','getRealtimeAgents','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByStatus','resolve','includes','User','findAll','name','fullname','voicePause','whatsappPause','pauseType','find','merge','globalStatus','fields','order','startsWith','DESC','ASC','fullname,internal','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','chatCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','online','omit','pick','role','faxCapacity','openchannelCapacity','whatsappCapacity','faxCurrentCapacity','mailCurrentCapacity','openchannelCurrentCapacity','phoneBarEnableAutomaticScreenRecording','queue','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','filter'];(function(_0x4050ff,_0x3b1584){var _0x5c5c09=function(_0x460035){while(--_0x460035){_0x4050ff['push'](_0x4050ff['shift']());}};_0x5c5c09(++_0x3b1584);}(_0x5fdc,0x127));var _0xc5fd=function(_0x350773,_0x5e4017){_0x350773=_0x350773-0x0;var _0x251764=_0x5fdc[_0x350773];return _0x251764;};'use strict';var _=require(_0xc5fd('0x0'));var jayson=require(_0xc5fd('0x1'));var db=require(_0xc5fd('0x2'))['db'];var amiClient=jayson[_0xc5fd('0x3')][_0xc5fd('0x4')]({'port':0x232a});var routingClient=jayson[_0xc5fd('0x3')][_0xc5fd('0x4')]({'port':0x232c});function isAgentPaused(_0x4d015c,_0xfdf928){var _0x1b6205=[_0x4d015c[_0xc5fd('0x5')],_0x4d015c[_0xc5fd('0x6')],_0x4d015c[_0xc5fd('0x7')],_0x4d015c[_0xc5fd('0x8')],_0x4d015c[_0xc5fd('0x9')],_0x4d015c['voicePause'],_0x4d015c['whatsappPause']];if(!_0xfdf928)return _['every'](_0x1b6205);var _0x224801=_[_0xc5fd('0xa')](_0x1b6205);return _0x224801[_0xc5fd('0xb')]>0x0&&_0x224801[_0xc5fd('0xb')]<_0x1b6205['length']?!![]:![];}function isIdle(_0x4e1e94){return _0x4e1e94===_0xc5fd('0xc')||_0x4e1e94===_0xc5fd('0xd')||_0x4e1e94===_0xc5fd('0xe')||_0x4e1e94===_0xc5fd('0xf')||_[_0xc5fd('0x10')](_0x4e1e94);}function isAgentIdle(_0x368c80){if(_0x368c80['voiceStatus']!==_0xc5fd('0xc')&&_0x368c80['voicePause']){_0x368c80['voiceStatus']=_0xc5fd('0x11');return![];}return _[_0xc5fd('0x12')]([_0x368c80[_0xc5fd('0x13')],_0x368c80[_0xc5fd('0x14')],_0x368c80[_0xc5fd('0x15')],_0x368c80[_0xc5fd('0x16')],_0x368c80[_0xc5fd('0x17')],_0x368c80[_0xc5fd('0x18')],_0x368c80['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xc5fd('0x19')](_0xc5fd('0x1a'),{})[_0xc5fd('0x1b')](function(_0x3404e0){if(_0x3404e0['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x4efafd=_0x3404e0['result'];return routingClient['request'](_0xc5fd('0x1a'),{})[_0xc5fd('0x1b')](function(_0x27f611){if(_0x27f611[_0xc5fd('0x1c')]){throw new Error(_0xc5fd('0x1d'));}var _0x3f981f=_0x27f611[_0xc5fd('0x1e')];return _['merge']({},_0x4efafd,_0x3f981f);});})[_0xc5fd('0x1f')](function(_0x27bda1){throw _0x27bda1;});}exports[_0xc5fd('0x20')]=getRealtimeAgents;function getAgentStatus(_0x9c12e4){var _0x3b3093='unknown';if(isAgentPaused(_0x9c12e4))_0x3b3093=_0xc5fd('0x11');else if(isAgentPaused(_0x9c12e4,!![]))_0x3b3093=_0xc5fd('0x21');else if(isAgentIdle(_0x9c12e4))_0x3b3093=_0xc5fd('0xc');else _0x3b3093=_0xc5fd('0x22');return _0x3b3093;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x4c85d5,_0x13cc42){var _0x2ab935=_[_0xc5fd('0x23')](_0x4c85d5)?_0x4c85d5:[_0x4c85d5];var _0x42d7f4=_[_0xc5fd('0x24')](_0x13cc42)+_0xc5fd('0x25');var _0x56d473=_[_0xc5fd('0x26')](_0x2ab935,function(_0x2701f7){return db[_0x42d7f4][_0xc5fd('0x27')]({'where':{'id':_0x2701f7}})[_0xc5fd('0x1b')](function(_0x39bb5e){if(!_0x39bb5e)return[];return _0x39bb5e[_0xc5fd('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc5fd('0x29')](_0x56d473)['then'](function(_0x3a86f9){var _0x48cd1d=_(_0x3a86f9)[_0xc5fd('0x2a')]()[_0xc5fd('0x26')]('id')[_0xc5fd('0x2b')]()[_0xc5fd('0x2c')]();return _0x48cd1d;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x176313,_0x1bbdc4,_0x19c4a0){try{if(_0x1bbdc4[_0xc5fd('0xb')]>0x0){_0x176313=_0x176313[_0xc5fd('0xa')](function(_0x209975){return _0x1bbdc4['includes'](_0x209975['id']);});}var _0x412ef7=_0x176313['filter'](function(_0x4859f7){var _0x12a962=_0xc5fd('0x22');if(isAgentIdle(_0x4859f7)){_0x12a962=_0xc5fd('0xc');}return _0x12a962===_0x19c4a0;});return _[_0xc5fd('0x26')](_0x412ef7,'id');}catch(_0x7693c4){throw _0x7693c4;}}exports[_0xc5fd('0x2d')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2a891d,_0x321eea,_0x49260d){return Promise[_0xc5fd('0x2e')]()[_0xc5fd('0x1b')](function(){if(_0x321eea[_0xc5fd('0xb')]>0x0){_0x2a891d=_0x2a891d[_0xc5fd('0xa')](function(_0x14c832){return _0x321eea[_0xc5fd('0x2f')](_0x14c832['id']);});}return _0x2a891d;})[_0xc5fd('0x1b')](function(){return db[_0xc5fd('0x30')][_0xc5fd('0x31')]({'attributes':['id',_0xc5fd('0x32'),_0xc5fd('0x33'),_0xc5fd('0x5'),'faxPause',_0xc5fd('0x7'),_0xc5fd('0x8'),_0xc5fd('0x9'),_0xc5fd('0x34'),_0xc5fd('0x35'),_0xc5fd('0x36')],'where':{'id':{'$in':_[_0xc5fd('0x26')](_0x2a891d,'id')}},'raw':!![]});})[_0xc5fd('0x1b')](function(_0x358883){return _0x358883['map'](function(_0xd15f7e){var _0x14d1c7=_[_0xc5fd('0x37')](_0x2a891d,['id',_0xd15f7e['id']]);var _0xc2c90b=filterAgentAttributes(_0x14d1c7);_[_0xc5fd('0x38')](_0xd15f7e,_0xc2c90b);_0xd15f7e[_0xc5fd('0x39')]=getAgentStatus(_0xd15f7e);return _0xd15f7e;});})[_0xc5fd('0x1b')](function(_0x50f1bf){var _0x8cd899=sortAgentsByStatus(_0x50f1bf,_0x49260d);return _[_0xc5fd('0x26')](_0x8cd899,'id');})['catch'](function(_0x1f7a7b){throw _0x1f7a7b;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x31bb5e){var _0x73533a={'fields':[],'order':null};var _0x23e7c8=_0x31bb5e['split'](',');_0x73533a[_0xc5fd('0x3a')]=_[_0xc5fd('0xa')](_0x23e7c8,function(_0x584662){if(!_0x584662[_0xc5fd('0x2f')](_0xc5fd('0x39'))){return!![];}_0x73533a[_0xc5fd('0x3b')]=_[_0xc5fd('0x3c')](_0x584662,'-')?_0xc5fd('0x3d'):_0xc5fd('0x3e');return![];});return _0x73533a;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x401e22){if(!_0x401e22){_0x401e22=_0xc5fd('0x3f');}if(_0x401e22[_0xc5fd('0x2f')](_0xc5fd('0x33'))&&!_0x401e22['includes']('internal')){var _0x47fe66=_0x401e22[_0xc5fd('0x40')](0x0,_0x401e22[_0xc5fd('0x41')](_0xc5fd('0x33')));_0x401e22+=','+_0x47fe66+_0xc5fd('0x42');}return _0x401e22;}exports[_0xc5fd('0x43')]=validateSortParameter;function sortAgentsByStatus(_0x33514d,_0x2c5d7a){var _0x2ef96f=_0x33514d[_0xc5fd('0x44')](function(_0x53341b,_0x5a2199){if(_0x53341b[_0xc5fd('0x39')]===_0x5a2199['globalStatus']){if(_0x53341b[_0xc5fd('0x39')]===_0xc5fd('0x11')){if(_0x2c5d7a===_0xc5fd('0x3d')){return(_0x53341b['pauseType']||'')<(_0x5a2199[_0xc5fd('0x36')]||'')||_0x53341b[_0xc5fd('0x33')]['toLowerCase']()>_0x5a2199[_0xc5fd('0x33')][_0xc5fd('0x45')]()?0x1:-0x1;}else{return(_0x53341b['pauseType']||'')<(_0x5a2199[_0xc5fd('0x36')]||'')||_0x53341b['fullname'][_0xc5fd('0x45')]()>_0x5a2199[_0xc5fd('0x33')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x2c5d7a===_0xc5fd('0x3d')){return _0x53341b[_0xc5fd('0x33')][_0xc5fd('0x45')]()<_0x5a2199['fullname'][_0xc5fd('0x45')]()?0x1:-0x1;}else{return _0x53341b[_0xc5fd('0x33')]['toLowerCase']()<_0x5a2199['fullname'][_0xc5fd('0x45')]()?-0x1:0x1;}}}else{if(_0x2c5d7a==='DESC'){return _0x53341b['globalStatus']<_0x5a2199['globalStatus']?0x1:-0x1;}else{return _0x53341b[_0xc5fd('0x39')]<_0x5a2199[_0xc5fd('0x39')]?-0x1:0x1;}}});return _0x2ef96f;}exports[_0xc5fd('0x46')]=sortAgentsByStatus;function filterAgentAttributes(_0x3fbf5d){var _0x453b02=[_0xc5fd('0x47'),'online','lastLoginAt','lastPauseAt',_0xc5fd('0x36'),_0xc5fd('0x48'),_0xc5fd('0x42'),'address',_0xc5fd('0x5'),'openchannelPause',_0xc5fd('0x7'),_0xc5fd('0x9'),_0xc5fd('0x35'),_0xc5fd('0x6'),_0xc5fd('0x34'),_0xc5fd('0x49'),'openchannelCapacity',_0xc5fd('0x4a'),_0xc5fd('0x4b'),'whatsappCapacity','faxCapacity',_0xc5fd('0x4c'),'openchannelCurrentCapacity','mailCurrentCapacity',_0xc5fd('0x4d'),_0xc5fd('0x4e'),'faxCurrentCapacity',_0xc5fd('0x13'),_0xc5fd('0x16'),'mailStatus',_0xc5fd('0x17'),_0xc5fd('0x4f'),_0xc5fd('0x14'),_0xc5fd('0x18'),_0xc5fd('0x50'),_0xc5fd('0x51'),_0xc5fd('0x52'),_0xc5fd('0x53'),_0xc5fd('0x54'),_0xc5fd('0x55'),_0xc5fd('0x56'),'queue',_0xc5fd('0x57'),_0xc5fd('0x58'),_0xc5fd('0x59'),'phoneBarEnableAutomaticScreenRecording'];var _0xb540a=[_0xc5fd('0x5'),_0xc5fd('0x8'),_0xc5fd('0x7'),'smsPause',_0xc5fd('0x35'),'faxPause','voicePause',_0xc5fd('0x5a')];var _0x3f7cd6=_(_0x3fbf5d)[_0xc5fd('0x5b')](_0xb540a)[_0xc5fd('0x5c')](_0x453b02)[_0xc5fd('0x2c')]();return _0x3f7cd6;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0xc5fd('0x33'),_0xc5fd('0x5d'),'internal','online','globalStatus',_0xc5fd('0x47'),'lastLoginAt',_0xc5fd('0x36'),_0xc5fd('0x48'),_0xc5fd('0x6'),_0xc5fd('0x5'),_0xc5fd('0x7'),_0xc5fd('0x8'),_0xc5fd('0x9'),'voicePause',_0xc5fd('0x35'),_0xc5fd('0x13'),_0xc5fd('0x14'),'mailStatus','openchannelStatus',_0xc5fd('0x17'),_0xc5fd('0x18'),_0xc5fd('0x4f'),_0xc5fd('0x50'),_0xc5fd('0x55'),_0xc5fd('0x52'),_0xc5fd('0x51'),_0xc5fd('0x53'),_0xc5fd('0x56'),_0xc5fd('0x54'),_0xc5fd('0x49'),_0xc5fd('0x5e'),_0xc5fd('0x4a'),_0xc5fd('0x5f'),_0xc5fd('0x4b'),_0xc5fd('0x60'),'chatCurrentCapacity',_0xc5fd('0x61'),_0xc5fd('0x62'),_0xc5fd('0x63'),'smsCurrentCapacity',_0xc5fd('0x4e'),_0xc5fd('0x59'),_0xc5fd('0x64'),_0xc5fd('0x57'),'onhold',_0xc5fd('0x65'),_0xc5fd('0x58')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 9eada8e..16bdc80 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 _0x7557=['dialMethod','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','format','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','paused','originated','find','merge','pick','initializeQueues','lodash','util','http','client','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','ringing','ringInUse','talking','unavailable','unknown','pTalking','message','statusMessage','dialActive'];(function(_0x46bca3,_0x800469){var _0x24d603=function(_0xeaf3fc){while(--_0xeaf3fc){_0x46bca3['push'](_0x46bca3['shift']());}};_0x24d603(++_0x800469);}(_0x7557,0xe6));var _0x7755=function(_0x565ba4,_0x47ca03){_0x565ba4=_0x565ba4-0x0;var _0x5ddf0e=_0x7557[_0x565ba4];return _0x5ddf0e;};'use strict';var _=require(_0x7755('0x0'));var jayson=require('jayson/promise');var util=require(_0x7755('0x1'));var amiClient=jayson['client'][_0x7755('0x2')]({'port':0x232a});var routingClient=jayson[_0x7755('0x3')][_0x7755('0x2')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x7755('0x4'),_0x7755('0x5'),'paused',_0x7755('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x7755('0x7'),_0x7755('0x8'),_0x7755('0x9'),_0x7755('0xa'),'notInUse','onHold',_0x7755('0xb'),_0x7755('0xc'),_0x7755('0xd'),_0x7755('0xe'),_0x7755('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x7755('0x10'),'originated',_0x7755('0x11'),_0x7755('0x12'),_0x7755('0x13'),_0x7755('0x14'),_0x7755('0x15'),_0x7755('0x16'),'startProgressive',_0x7755('0x17'),'erlangCallToSecond',_0x7755('0x18'),'erlangBusyFactor','dialPredictiveInterval',_0x7755('0x19'),_0x7755('0x1a'),_0x7755('0x1b'),_0x7755('0x1c'),_0x7755('0x1d'),'predictiveIntervalDroppedCallsTimeout',_0x7755('0x1e'),_0x7755('0x1f'),_0x7755('0x20')];function getRealtimeQueues(_0x1f1c5a,_0x223b93){var _0x4955f7=_0x223b93===_0x7755('0x21')?amiClient:routingClient;return _0x4955f7['request'](_['startCase'](_0x223b93)+_0x7755('0x22'),_0x1f1c5a)['then'](function(_0x3398d0){if(_0x3398d0['error'])throw new Error(util[_0x7755('0x23')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x223b93));return _0x3398d0[_0x7755('0x24')];})[_0x7755('0x25')](function(_0x1c7e6c){throw _0x1c7e6c;});}exports[_0x7755('0x26')]=getRealtimeQueues;function initializeQueues(_0x12353f,_0x3323d0,_0x76b192,_0x306f37){var _0x464337=DEFAULT_QUEUE_ATTRIBUTES;if(_0x76b192===_0x7755('0x21')){if(_0x306f37===_0x7755('0x27')){_0x464337=_0x464337[_0x7755('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x306f37===_0x7755('0x29')){_0x464337=_0x464337['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x12353f[_0x7755('0x2a')](function(_0x8c28cf){var _0x102dcc=_0x8c28cf[_0x7755('0x2b')]({'plain':!![]});_0x102dcc[_0x7755('0x2c')]=0x0;_0x102dcc[_0x7755('0xa')]=0x0;_0x102dcc[_0x7755('0x5')]=0x0;_0x102dcc[_0x7755('0x4')]=0x0;_0x102dcc[_0x7755('0x6')]=0x0;if(_0x76b192===_0x7755('0x21')){_0x102dcc[_0x7755('0xd')]=0x0;_0x102dcc['busy']=0x0;if(_0x306f37==='outbound'){_0x102dcc[_0x7755('0x10')]=0x0;_0x102dcc[_0x7755('0x2d')]=0x0;}}var _0x2d0182=_[_0x7755('0x2e')](_0x3323d0,['id',_0x102dcc['id']]);if(_0x2d0182){_[_0x7755('0x2f')](_0x102dcc,_[_0x7755('0x30')](_0x2d0182,_0x464337));}return _0x102dcc;});}exports[_0x7755('0x31')]=initializeQueues; \ No newline at end of file +var _0x8f61=['erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','concat','outbound','get','loggedInDb','loggedIn','voice','talking','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','paused','waiting','busy','inUse','invalid','notInUse','onHold','ringInUse','unavailable','unknown','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x12b893,_0x1ba772){var _0x69e8f7=function(_0x6fcd49){while(--_0x6fcd49){_0x12b893['push'](_0x12b893['shift']());}};_0x69e8f7(++_0x1ba772);}(_0x8f61,0x8d));var _0x18f6=function(_0x2aed8e,_0x108d6c){_0x2aed8e=_0x2aed8e-0x0;var _0x5914b3=_0x8f61[_0x2aed8e];return _0x5914b3;};'use strict';var _=require(_0x18f6('0x0'));var jayson=require(_0x18f6('0x1'));var util=require(_0x18f6('0x2'));var amiClient=jayson[_0x18f6('0x3')][_0x18f6('0x4')]({'port':0x232a});var routingClient=jayson[_0x18f6('0x3')][_0x18f6('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x18f6('0x5'),'loggedIn',_0x18f6('0x6'),_0x18f6('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x18f6('0x8'),_0x18f6('0x9'),_0x18f6('0xa'),'loggedInDb',_0x18f6('0xb'),_0x18f6('0xc'),'ringing',_0x18f6('0xd'),'talking',_0x18f6('0xe'),_0x18f6('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x18f6('0x10'),_0x18f6('0x11'),_0x18f6('0x12'),'statusMessage',_0x18f6('0x13'),_0x18f6('0x14'),_0x18f6('0x15'),_0x18f6('0x16'),_0x18f6('0x17'),_0x18f6('0x18'),_0x18f6('0x19'),_0x18f6('0x1a'),_0x18f6('0x1b'),_0x18f6('0x1c'),_0x18f6('0x1d'),_0x18f6('0x1e'),_0x18f6('0x1f'),_0x18f6('0x20'),'predictiveIntervalAnsweredCalls',_0x18f6('0x21'),_0x18f6('0x22'),_0x18f6('0x23'),_0x18f6('0x24')];function getRealtimeQueues(_0x461f77,_0x5093c9){var _0x1fea97=_0x5093c9==='voice'?amiClient:routingClient;return _0x1fea97[_0x18f6('0x25')](_[_0x18f6('0x26')](_0x5093c9)+_0x18f6('0x27'),_0x461f77)[_0x18f6('0x28')](function(_0x2cda97){if(_0x2cda97[_0x18f6('0x29')])throw new Error(util[_0x18f6('0x2a')](_0x18f6('0x2b'),_0x5093c9));return _0x2cda97['result'];})['catch'](function(_0x66cf7){throw _0x66cf7;});}exports[_0x18f6('0x2c')]=getRealtimeQueues;function initializeQueues(_0x20e4ad,_0x566125,_0x5e35aa,_0x592c09){var _0x21ff50=DEFAULT_QUEUE_ATTRIBUTES;if(_0x5e35aa==='voice'){if(_0x592c09==='inbound'){_0x21ff50=_0x21ff50[_0x18f6('0x2d')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x592c09===_0x18f6('0x2e')){_0x21ff50=_0x21ff50[_0x18f6('0x2d')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x20e4ad['map'](function(_0x3eaa4f){var _0x300b56=_0x3eaa4f[_0x18f6('0x2f')]({'plain':!![]});_0x300b56[_0x18f6('0x6')]=0x0;_0x300b56[_0x18f6('0x30')]=0x0;_0x300b56[_0x18f6('0x31')]=0x0;_0x300b56[_0x18f6('0x5')]=0x0;_0x300b56[_0x18f6('0x7')]=0x0;if(_0x5e35aa===_0x18f6('0x32')){_0x300b56[_0x18f6('0x33')]=0x0;_0x300b56[_0x18f6('0x8')]=0x0;if(_0x592c09===_0x18f6('0x2e')){_0x300b56[_0x18f6('0x10')]=0x0;_0x300b56[_0x18f6('0x11')]=0x0;}}var _0x34986a=_[_0x18f6('0x34')](_0x566125,['id',_0x300b56['id']]);if(_0x34986a){_[_0x18f6('0x35')](_0x300b56,_[_0x18f6('0x36')](_0x34986a,_0x21ff50));}return _0x300b56;});}exports[_0x18f6('0x37')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 58f3cdc..41179de 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 cb24a05..4d55474 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 _0xa103=['getUuid','licenseToken','utf8','hostname','macAddress','createHash','md5','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','update','hex'];(function(_0x1534d4,_0x33c784){var _0x274edd=function(_0xe8d545){while(--_0xe8d545){_0x1534d4['push'](_0x1534d4['shift']());}};_0x274edd(++_0x33c784);}(_0xa103,0x169));var _0x3a10=function(_0x197005,_0x1d8b1b){_0x197005=_0x197005-0x0;var _0x5501e1=_0xa103[_0x197005];return _0x5501e1;};'use strict';var _=require(_0x3a10('0x0'));var os=require('os');var crypto=require(_0x3a10('0x1'));var machine=require(_0x3a10('0x2'));var exec=require(_0x3a10('0x3'))[_0x3a10('0x4')];var config=require(_0x3a10('0x5'));function getInterfaces(){var _0x5c2e27=[];var _0x201270=os[_0x3a10('0x6')]();var _0x1fb9d5=_[_0x3a10('0x7')](_[_0x3a10('0x8')](_0x201270));for(var _0x1d3795=0x0;_0x1d3795<_0x1fb9d5[_0x3a10('0x9')];_0x1d3795++){var _0x4f700c=_0x201270[_0x1fb9d5[_0x1d3795]][_0x3a10('0xa')](function(_0x47cb5f){return _0x47cb5f[_0x3a10('0xb')]==='IPv4'&&_0x47cb5f['internal']===![];});_0x5c2e27=_0x5c2e27['concat'](_0x4f700c);}return _0x5c2e27;}function getFirstInterface(){var _0x4dd05e=_[_0x3a10('0xc')](getInterfaces());return{'macAddress':_0x4dd05e&&_0x4dd05e['mac']?_0x4dd05e[_0x3a10('0xd')]:'00:00:00:00:00:00','ipAddress':_0x4dd05e&&_0x4dd05e[_0x3a10('0xe')]?_0x4dd05e[_0x3a10('0xe')]:_0x3a10('0xf')};}exports[_0x3a10('0x10')]=getFirstInterface;function getCPUhash(){var _0x42137e=_['orderBy'](os[_0x3a10('0x11')]()[_0x3a10('0x12')](function(_0x5b95f7){return _0x5b95f7[_0x3a10('0x13')];}))[_0x3a10('0x14')](':');return crypto['createHash']('md5')[_0x3a10('0x15')](_0x42137e)['digest'](_0x3a10('0x16'));}exports[_0x3a10('0x17')]=function(){var _0x4c9527=os['platform']();var _0xd97ab6=/[0-9a-f-]{36}/;if(config[_0x3a10('0x18')]&&_0xd97ab6['test'](config[_0x3a10('0x18')])){return config[_0x3a10('0x18')];}else if(_0x4c9527==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3a10('0x19')})['replace']('\x0d\x0a','');}else{var _0x5ec1ba=getFirstInterface();var _0x4697a3=getCPUhash();var _0x4d6efd=_0x4697a3+'|'+os[_0x3a10('0x1a')]()+'|'+_0x5ec1ba[_0x3a10('0x1b')]+'|'+_0x5ec1ba['ipAddress'];var _0x438c63=crypto[_0x3a10('0x1c')](_0x3a10('0x1d'))['update'](_0x4d6efd)[_0x3a10('0x1e')](_0x3a10('0x16'));return _0x438c63[_0x3a10('0x1f')](0x0,0x8)+'-'+_0x438c63[_0x3a10('0x1f')](0x8,0xc)+'-'+_0x438c63['substring'](0xc,0x10)+'-'+_0x438c63['substring'](0x10,0x14)+'-'+_0x438c63[_0x3a10('0x1f')](0x14);}}; \ No newline at end of file +var _0xea8e=['lodash','crypto','child_process','execSync','../environment','networkInterfaces','keys','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','model','join','createHash','md5','update','digest','hex','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring'];(function(_0x372a2f,_0x533bfd){var _0x291e83=function(_0x4d662d){while(--_0x4d662d){_0x372a2f['push'](_0x372a2f['shift']());}};_0x291e83(++_0x533bfd);}(_0xea8e,0xe7));var _0xeea8=function(_0x1d98da,_0x532964){_0x1d98da=_0x1d98da-0x0;var _0x2a56f2=_0xea8e[_0x1d98da];return _0x2a56f2;};'use strict';var _=require(_0xeea8('0x0'));var os=require('os');var crypto=require(_0xeea8('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xeea8('0x2'))[_0xeea8('0x3')];var config=require(_0xeea8('0x4'));function getInterfaces(){var _0x34f275=[];var _0x393a67=os[_0xeea8('0x5')]();var _0x45937d=_['orderBy'](_[_0xeea8('0x6')](_0x393a67));for(var _0x308667=0x0;_0x308667<_0x45937d['length'];_0x308667++){var _0x2d2f87=_0x393a67[_0x45937d[_0x308667]]['filter'](function(_0x1cb745){return _0x1cb745['family']===_0xeea8('0x7')&&_0x1cb745[_0xeea8('0x8')]===![];});_0x34f275=_0x34f275[_0xeea8('0x9')](_0x2d2f87);}return _0x34f275;}function getFirstInterface(){var _0x160b09=_[_0xeea8('0xa')](getInterfaces());return{'macAddress':_0x160b09&&_0x160b09[_0xeea8('0xb')]?_0x160b09[_0xeea8('0xb')]:'00:00:00:00:00:00','ipAddress':_0x160b09&&_0x160b09[_0xeea8('0xc')]?_0x160b09[_0xeea8('0xc')]:_0xeea8('0xd')};}exports[_0xeea8('0xe')]=getFirstInterface;function getCPUhash(){var _0x56affb=_[_0xeea8('0xf')](os[_0xeea8('0x10')]()[_0xeea8('0x11')](function(_0x2a5135){return _0x2a5135[_0xeea8('0x12')];}))[_0xeea8('0x13')](':');return crypto[_0xeea8('0x14')](_0xeea8('0x15'))[_0xeea8('0x16')](_0x56affb)[_0xeea8('0x17')](_0xeea8('0x18'));}exports['getUuid']=function(){var _0xd38ed6=os['platform']();var _0x59b8dd=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x59b8dd['test'](config[_0xeea8('0x19')])){return config[_0xeea8('0x19')];}else if(_0xd38ed6===_0xeea8('0x1a')){return exec(_0xeea8('0x1b'),{'encoding':_0xeea8('0x1c')})[_0xeea8('0x1d')]('\x0d\x0a','');}else{var _0x466dda=getFirstInterface();var _0x3f94e9=getCPUhash();var _0x58b2ba=_0x3f94e9+'|'+os[_0xeea8('0x1e')]()+'|'+_0x466dda[_0xeea8('0x1f')]+'|'+_0x466dda['ipAddress'];var _0x26ab93=crypto[_0xeea8('0x14')](_0xeea8('0x15'))[_0xeea8('0x16')](_0x58b2ba)[_0xeea8('0x17')]('hex');return _0x26ab93[_0xeea8('0x20')](0x0,0x8)+'-'+_0x26ab93[_0xeea8('0x20')](0x8,0xc)+'-'+_0x26ab93['substring'](0xc,0x10)+'-'+_0x26ab93[_0xeea8('0x20')](0x10,0x14)+'-'+_0x26ab93[_0xeea8('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 28f1046..d54f8a0 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 _0x0250=['moment','request-promise','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','data2','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','getUuid','findOrCreate','spread','message','default','util'];(function(_0xd92a00,_0x3cadb5){var _0x22aff5=function(_0x56d6df){while(--_0x56d6df){_0xd92a00['push'](_0xd92a00['shift']());}};_0x22aff5(++_0x3cadb5);}(_0x0250,0x13f));var _0x0025=function(_0x512f8d,_0x4f0869){_0x512f8d=_0x512f8d-0x0;var _0x33b973=_0x0250[_0x512f8d];return _0x33b973;};'use strict';var util=require(_0x0025('0x0'));var moment=require(_0x0025('0x1'));var rp=require(_0x0025('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x0025('0x3'))(module,_0x0025('0x4'));var db=require(_0x0025('0x5'))['db'];var encryptor=require(_0x0025('0x6'));var hardware=require(_0x0025('0x7'));var logger=require(_0x0025('0x8'))(_0x0025('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16f2ba){return new BPromise(function(_0x20a6ed,_0x4bedd9){var _0x4d1bd9=util[_0x0025('0xa')](_0x0025('0xb'),HOST,_0x16f2ba,module[_0x0025('0xc')][_0x0025('0x4')]);if(oldToken){_0x4d1bd9=util[_0x0025('0xa')](_0x0025('0xd'),HOST,_0x16f2ba,module[_0x0025('0xc')][_0x0025('0x4')],oldToken);}var _0x52da96={'uri':_0x4d1bd9,'method':_0x0025('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x52da96)[_0x0025('0xf')](function(_0x4488a7){_0x20a6ed(_0x4488a7);})[_0x0025('0x10')](function(_0x1f5cf4){_0x4bedd9(_0x1f5cf4);});});}function manageLicense(_0x48fda1,_0x1be945){var _0x57d121=_0x1be945[_0x0025('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x57d121['data1']!==_0x48fda1&&!_0x57d121[_0x0025('0x12')]){oldToken=_0x57d121[_0x0025('0x13')];}httpRequest(_0x48fda1)[_0x0025('0xf')](function(_0x139121){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x139121['active']){isOldTokenSent=![];if(!_0x57d121[_0x0025('0x9')]&&_0x57d121['license']!=_0x139121[_0x0025('0x9')]||_0x57d121[_0x0025('0x9')]&&_0x57d121[_0x0025('0x12')]){logger['info'](_0x0025('0x14'));}if(_0x57d121['license']&&!_0x57d121[_0x0025('0x12')]&&_0x57d121[_0x0025('0x9')]!=_0x139121[_0x0025('0x9')]){logger[_0x0025('0x15')](_0x0025('0x16'));}if(_0x57d121[_0x0025('0x9')]&&!_0x57d121[_0x0025('0x12')]&&_0x57d121[_0x0025('0x9')]==_0x139121[_0x0025('0x9')]){return _0x1be945;}return _0x1be945[_0x0025('0x17')]({'data1':_0x48fda1,'data2':null,'license':_0x139121[_0x0025('0x9')]});}else{if(_0x139121[_0x0025('0x9')]||_0x57d121[_0x0025('0x9')]){if(!_0x57d121[_0x0025('0x12')]){if(_0x57d121['data1']==_0x48fda1){GRAY_PERIOD_REASON='Disabled';logger[_0x0025('0x15')](_0x0025('0x18'));}else{GRAY_PERIOD_REASON=_0x0025('0x19');logger[_0x0025('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57d121['data1'],_0x48fda1);}logger['info'](_0x0025('0x1a'),GRAY_PERIOD_REASON[_0x0025('0x1b')](),moment()[_0x0025('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x1be945[_0x0025('0x17')]({'data2':encryptor[_0x0025('0x1c')](moment()[_0x0025('0xa')](_0x0025('0x1d')))});}else{if(moment()[_0x0025('0x1e')](encryptor[_0x0025('0x1f')](_0x57d121[_0x0025('0x12')]),_0x0025('0x20'))>DAYS){logger[_0x0025('0x15')](_0x0025('0x21'),moment()['format']('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x1be945[_0x0025('0x17')]({'data1':_0x48fda1,'data2':null,'license':null});}}}else{if(_0x57d121[_0x0025('0x13')]!=_0x48fda1){logger[_0x0025('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x57d121[_0x0025('0x13')],_0x48fda1);return _0x1be945[_0x0025('0x17')]({'data1':_0x48fda1,'data2':null,'license':null});}}}return _0x1be945;})[_0x0025('0xf')](function(_0x5720f3){_0x1be945=_0x5720f3;})[_0x0025('0x10')](function(_0x41e2b9){logger[_0x0025('0x22')](_0x41e2b9['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x1be945);},TIME);});}function defaultLicense(){var _0x3511c2=hardware[_0x0025('0x23')]();if(_0x3511c2){return db['License'][_0x0025('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x3511c2}})[_0x0025('0x25')](function(_0x550275,_0x121e7d){logger[_0x0025('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x3511c2);manageLicense(_0x3511c2,_0x550275);})[_0x0025('0x10')](function(_0x3c6441){logger[_0x0025('0x22')](_0x3c6441[_0x0025('0x26')]);});}}exports[_0x0025('0x27')]=defaultLicense; \ No newline at end of file +var _0xeafd=['message','finally','getUuid','License','findOrCreate','default','moment','request-promise','bluebird','pkginfo','version','../../components/encryptor','../logger','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','data1','data2','then','active','license','info','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch'];(function(_0x5bca20,_0x37e530){var _0x40f5f5=function(_0x2b62a5){while(--_0x2b62a5){_0x5bca20['push'](_0x5bca20['shift']());}};_0x40f5f5(++_0x37e530);}(_0xeafd,0x16e));var _0xdeaf=function(_0x2405bc,_0x2f28a1){_0x2405bc=_0x2405bc-0x0;var _0x5272d4=_0xeafd[_0x2405bc];return _0x5272d4;};'use strict';var util=require('util');var moment=require(_0xdeaf('0x0'));var rp=require(_0xdeaf('0x1'));var BPromise=require(_0xdeaf('0x2'));var pkginfo=require(_0xdeaf('0x3'))(module,_0xdeaf('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xdeaf('0x5'));var hardware=require('./hardware');var logger=require(_0xdeaf('0x6'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5df3bc){return new BPromise(function(_0x598915,_0x15883a){var _0x39e391=util[_0xdeaf('0x7')](_0xdeaf('0x8'),HOST,_0x5df3bc,module['exports'][_0xdeaf('0x4')]);if(oldToken){_0x39e391=util['format'](_0xdeaf('0x9'),HOST,_0x5df3bc,module[_0xdeaf('0xa')]['version'],oldToken);}var _0x3c7856={'uri':_0x39e391,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3c7856)['then'](function(_0x3ed674){_0x598915(_0x3ed674);})['catch'](function(_0x245e32){_0x15883a(_0x245e32);});});}function manageLicense(_0x1c5b7d,_0x4e3c2b){var _0x4bcd06=_0x4e3c2b['get']({'plain':!![]});if(!isOldTokenSent&&_0x4bcd06[_0xdeaf('0xb')]!==_0x1c5b7d&&!_0x4bcd06[_0xdeaf('0xc')]){oldToken=_0x4bcd06[_0xdeaf('0xb')];}httpRequest(_0x1c5b7d)[_0xdeaf('0xd')](function(_0x37dce0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x37dce0[_0xdeaf('0xe')]){isOldTokenSent=![];if(!_0x4bcd06[_0xdeaf('0xf')]&&_0x4bcd06['license']!=_0x37dce0['license']||_0x4bcd06[_0xdeaf('0xf')]&&_0x4bcd06['data2']){logger[_0xdeaf('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4bcd06[_0xdeaf('0xf')]&&!_0x4bcd06['data2']&&_0x4bcd06['license']!=_0x37dce0[_0xdeaf('0xf')]){logger[_0xdeaf('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4bcd06['license']&&!_0x4bcd06[_0xdeaf('0xc')]&&_0x4bcd06['license']==_0x37dce0['license']){return _0x4e3c2b;}return _0x4e3c2b['update']({'data1':_0x1c5b7d,'data2':null,'license':_0x37dce0[_0xdeaf('0xf')]});}else{if(_0x37dce0[_0xdeaf('0xf')]||_0x4bcd06['license']){if(!_0x4bcd06[_0xdeaf('0xc')]){if(_0x4bcd06['data1']==_0x1c5b7d){GRAY_PERIOD_REASON=_0xdeaf('0x11');logger[_0xdeaf('0x10')](_0xdeaf('0x12'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xdeaf('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4bcd06['data1'],_0x1c5b7d);}logger[_0xdeaf('0x10')](_0xdeaf('0x13'),GRAY_PERIOD_REASON[_0xdeaf('0x14')](),moment()['format'](_0xdeaf('0x15')));return _0x4e3c2b[_0xdeaf('0x16')]({'data2':encryptor[_0xdeaf('0x17')](moment()['format'](_0xdeaf('0x15')))});}else{if(moment()[_0xdeaf('0x18')](encryptor[_0xdeaf('0x19')](_0x4bcd06[_0xdeaf('0xc')]),_0xdeaf('0x1a'))>DAYS){logger[_0xdeaf('0x10')](_0xdeaf('0x1b'),moment()[_0xdeaf('0x7')](_0xdeaf('0x15')));isOldTokenSent=![];return _0x4e3c2b[_0xdeaf('0x16')]({'data1':_0x1c5b7d,'data2':null,'license':null});}}}else{if(_0x4bcd06[_0xdeaf('0xb')]!=_0x1c5b7d){logger[_0xdeaf('0x10')](_0xdeaf('0x1c'),_0x4bcd06[_0xdeaf('0xb')],_0x1c5b7d);return _0x4e3c2b['update']({'data1':_0x1c5b7d,'data2':null,'license':null});}}}return _0x4e3c2b;})[_0xdeaf('0xd')](function(_0x4a98d1){_0x4e3c2b=_0x4a98d1;})[_0xdeaf('0x1d')](function(_0x23c32f){logger['error'](_0x23c32f[_0xdeaf('0x1e')]);})[_0xdeaf('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xdeaf('0x20')](),_0x4e3c2b);},TIME);});}function defaultLicense(){var _0x20f5fd=hardware[_0xdeaf('0x20')]();if(_0x20f5fd){return db[_0xdeaf('0x21')][_0xdeaf('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x20f5fd}})['spread'](function(_0x14a452,_0x36f12f){logger[_0xdeaf('0x10')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x20f5fd);manageLicense(_0x20f5fd,_0x14a452);})[_0xdeaf('0x1d')](function(_0x6f4713){logger['error'](_0x6f4713[_0xdeaf('0x1e')]);});}}exports[_0xdeaf('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 67be1fc..64d394b 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 _0x333e=['role','sequelize','COUNT','col','count','admin','user','telephone','users','telephones','countBy','exports','util','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','add','days','machineUuid','changed','message','User','findAll'];(function(_0x271555,_0x21bee1){var _0x5aa8c7=function(_0x12c474){while(--_0x12c474){_0x271555['push'](_0x271555['shift']());}};_0x5aa8c7(++_0x21bee1);}(_0x333e,0x139));var _0xe333=function(_0x5374eb,_0x4e5e18){_0x5374eb=_0x5374eb-0x0;var _0x406a25=_0x333e[_0x5374eb];return _0x406a25;};'use strict';var util=require(_0xe333('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xe333('0x1'));var encryptor=require(_0xe333('0x2'));var db=require(_0xe333('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe333('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe333('0x5'),'machineUuid':hardware[_0xe333('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe333('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe333('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x126599){return new BPromise(function(_0x2430f1,_0x76687a){return db[_0xe333('0x8')][_0xe333('0x9')](_[_0xe333('0xa')](_0x126599,{'raw':!![],'where':{'id':0x1}}))[_0xe333('0xb')](function(_0x5dcea5){return checkLicense(_0x5dcea5,null);})[_0xe333('0xb')](function(_0x57e1c7){_0x2430f1(_0x57e1c7);return;})[_0xe333('0xc')](function(_0x5237b8){_0x76687a(_0x5237b8);});});}function checkLicense(_0x15b892,_0x3f5a8d){if(!_0x15b892){demoLicense[_0xe333('0xd')]=_0x15b892[_0xe333('0xe')];return demoLicense;}try{var _0x43cb90=_0x3f5a8d||_0x15b892['license'];if(_[_0xe333('0xf')](_0x43cb90)){throw new Error(_0xe333('0x10'));}var _0x6772e=_0x15b892[_0xe333('0xe')];var _0x5c1e8b=_0x15b892[_0xe333('0x11')];var _0x491d81=_0x6772e[_0xe333('0x12')]('-')[0x4];var _0x2ad19b=_0x6772e['split']('-')[0x0];var _0x563b00=encryptor[_0xe333('0x13')](_0x43cb90,util[_0xe333('0x14')](_0xe333('0x15'),_0x491d81,_0x6772e,_0x2ad19b));var _0x3b5094=JSON[_0xe333('0x16')](_0x563b00);_0x3b5094[_0xe333('0x17')]=![];_0x3b5094[_0xe333('0xd')]=_0x6772e;_0x3b5094['machineUuid']=hardware[_0xe333('0x6')]();if(_0x5c1e8b){var _0x217cbf=encryptor[_0xe333('0x13')](_0x5c1e8b);_0x3b5094['gray']=_0x217cbf;_0x3b5094['deadline']=moment(_0x217cbf)[_0xe333('0x18')](0x7,_0xe333('0x19'))[_0xe333('0x14')]();_0x3b5094['grayReason']=_0x3b5094[_0xe333('0xd')]!=_0x3b5094[_0xe333('0x1a')]?_0xe333('0x1b'):'disabled';}return _0x3b5094;}catch(_0x44e401){breakingLicense['uuid']=_0x15b892['data1'];breakingLicense[_0xe333('0x1c')]=_0x44e401[_0xe333('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x128844,_0x34f8cf){getLicense()[_0xe333('0xb')](function(_0x3c708e){return db[_0xe333('0x1d')][_0xe333('0x1e')]({'attributes':[_0xe333('0x1f'),[db[_0xe333('0x20')]['fn'](_0xe333('0x21'),db['sequelize'][_0xe333('0x22')]('role')),_0xe333('0x23')]],'group':'role','where':{'role':{'$or':[_0xe333('0x24'),_0xe333('0x25'),_0xe333('0x26')]}},'raw':!![]})[_0xe333('0xb')](function(_0x1fc37b){var _0xfabbfc={'user':_0x3c708e[_0xe333('0x27')]||0x0,'telephone':_0x3c708e[_0xe333('0x28')]||0x0};_0x1fc37b['forEach'](function(_0x279bf2){var _0x45553a=_0x279bf2['role']===_0xe333('0x24')?'user':_0x279bf2['role'];_0xfabbfc[_0x45553a]-=_0x279bf2[_0xe333('0x23')];if(_0xfabbfc[_0x45553a]<0x0)_0xfabbfc[_0x45553a]=0x0;});_0x128844(_0xfabbfc);return;});})[_0xe333('0xc')](function(_0x37baf7){_0x34f8cf(_0x37baf7);});});}function checkUserLimits(_0x5c1aab){return new BPromise(function(_0x3808fa,_0x4783ae){getLimits()[_0xe333('0xb')](function(_0x43751c){var _0x591ce=_['pick'](_[_0xe333('0x29')](_0x5c1aab,'role'),[_0xe333('0x24'),_0xe333('0x25'),'telephone']);var _0x2cec4b=(_0x591ce[_0xe333('0x24')]||0x0)+(_0x591ce['user']||0x0);var _0x15b9c4=_0x591ce[_0xe333('0x26')]||0x0;if(_0x2cec4b>_0x43751c[_0xe333('0x25')])return _0x4783ae('License\x20limit\x20reached\x20for\x20users');if(_0x15b9c4>_0x43751c[_0xe333('0x26')])return _0x4783ae('License\x20limit\x20reached\x20for\x20telephones');return _0x3808fa();})[_0xe333('0xc')](function(_0x2914e2){_0x4783ae(_0x2914e2);});});}module[_0xe333('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8a3b=['days','grayReason','changed','disabled','message','findAll','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','lodash','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty','data2','split','format','parse','machineUuid','gray','deadline','add'];(function(_0x53c0a1,_0x5768ad){var _0xe26c52=function(_0x29232d){while(--_0x29232d){_0x53c0a1['push'](_0x53c0a1['shift']());}};_0xe26c52(++_0x5768ad);}(_0x8a3b,0x1d7));var _0xb8a3=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8a3b[_0x297fd3];return _0x2af381;};'use strict';var util=require('util');var _=require(_0xb8a3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require(_0xb8a3('0x1'));var encryptor=require(_0xb8a3('0x2'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb8a3('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb8a3('0x4'),'machineUuid':hardware[_0xb8a3('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb8a3('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb8a3('0x6'),'machineUuid':hardware[_0xb8a3('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x238b1d){return new BPromise(function(_0xcdd7e1,_0x29e50e){return db[_0xb8a3('0x7')][_0xb8a3('0x8')](_[_0xb8a3('0x9')](_0x238b1d,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2d8f38){return checkLicense(_0x2d8f38,null);})[_0xb8a3('0xa')](function(_0x16073c){_0xcdd7e1(_0x16073c);return;})[_0xb8a3('0xb')](function(_0x1aed23){_0x29e50e(_0x1aed23);});});}function checkLicense(_0x33e367,_0x69540c){if(!_0x33e367){demoLicense[_0xb8a3('0xc')]=_0x33e367[_0xb8a3('0xd')];return demoLicense;}try{var _0x564533=_0x69540c||_0x33e367[_0xb8a3('0xe')];if(_[_0xb8a3('0xf')](_0x564533)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x32591e=_0x33e367['data1'];var _0x4f5ecf=_0x33e367[_0xb8a3('0x10')];var _0x381b80=_0x32591e[_0xb8a3('0x11')]('-')[0x4];var _0x386516=_0x32591e[_0xb8a3('0x11')]('-')[0x0];var _0x128cbd=encryptor['decryptString'](_0x564533,util[_0xb8a3('0x12')]('%s:%s:%s',_0x381b80,_0x32591e,_0x386516));var _0x3add64=JSON[_0xb8a3('0x13')](_0x128cbd);_0x3add64['demo']=![];_0x3add64['uuid']=_0x32591e;_0x3add64[_0xb8a3('0x14')]=hardware[_0xb8a3('0x5')]();if(_0x4f5ecf){var _0x502bd6=encryptor['decryptString'](_0x4f5ecf);_0x3add64[_0xb8a3('0x15')]=_0x502bd6;_0x3add64[_0xb8a3('0x16')]=moment(_0x502bd6)[_0xb8a3('0x17')](0x7,_0xb8a3('0x18'))['format']();_0x3add64[_0xb8a3('0x19')]=_0x3add64[_0xb8a3('0xc')]!=_0x3add64['machineUuid']?_0xb8a3('0x1a'):_0xb8a3('0x1b');}return _0x3add64;}catch(_0x2b3569){breakingLicense[_0xb8a3('0xc')]=_0x33e367[_0xb8a3('0xd')];breakingLicense['message']=_0x2b3569[_0xb8a3('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3495dc,_0x3892ef){getLicense()['then'](function(_0x10b6c8){return db['User'][_0xb8a3('0x1d')]({'attributes':[_0xb8a3('0x1e'),[db['sequelize']['fn'](_0xb8a3('0x1f'),db[_0xb8a3('0x20')][_0xb8a3('0x21')](_0xb8a3('0x1e'))),_0xb8a3('0x22')]],'group':_0xb8a3('0x1e'),'where':{'role':{'$or':[_0xb8a3('0x23'),_0xb8a3('0x24'),_0xb8a3('0x25')]}},'raw':!![]})[_0xb8a3('0xa')](function(_0x389f80){var _0x4f3924={'user':_0x10b6c8[_0xb8a3('0x26')]||0x0,'telephone':_0x10b6c8[_0xb8a3('0x27')]||0x0};_0x389f80[_0xb8a3('0x28')](function(_0x52650f){var _0x1970b1=_0x52650f['role']===_0xb8a3('0x23')?_0xb8a3('0x24'):_0x52650f['role'];_0x4f3924[_0x1970b1]-=_0x52650f[_0xb8a3('0x22')];if(_0x4f3924[_0x1970b1]<0x0)_0x4f3924[_0x1970b1]=0x0;});_0x3495dc(_0x4f3924);return;});})[_0xb8a3('0xb')](function(_0x214c01){_0x3892ef(_0x214c01);});});}function checkUserLimits(_0x151215){return new BPromise(function(_0x32e2f9,_0x351110){getLimits()['then'](function(_0x5092ef){var _0x53e8f6=_[_0xb8a3('0x29')](_[_0xb8a3('0x2a')](_0x151215,_0xb8a3('0x1e')),['admin',_0xb8a3('0x24'),_0xb8a3('0x25')]);var _0x3fe66a=(_0x53e8f6[_0xb8a3('0x23')]||0x0)+(_0x53e8f6[_0xb8a3('0x24')]||0x0);var _0x219c16=_0x53e8f6['telephone']||0x0;if(_0x3fe66a>_0x5092ef['user'])return _0x351110(_0xb8a3('0x2b'));if(_0x219c16>_0x5092ef['telephone'])return _0x351110(_0xb8a3('0x2c'));return _0x32e2f9();})[_0xb8a3('0xb')](function(_0x2dfeb1){_0x351110(_0x2dfeb1);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 88b81e1..ab46421 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 _0x1893=['myappanuglar-secret','app-id','secret'];(function(_0x3b1e04,_0x1b7b69){var _0x4b6fa0=function(_0x27c273){while(--_0x27c273){_0x3b1e04['push'](_0x3b1e04['shift']());}};_0x4b6fa0(++_0x1b7b69);}(_0x1893,0xa2));var _0x3189=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x1893[_0x22ffbf];return _0x360c17;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3189('0x0'),'GOOGLE_ID':_0x3189('0x1'),'GOOGLE_SECRET':_0x3189('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x8f4c=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x549efc,_0x5d035a){var _0x4b6c2d=function(_0x29a4f1){while(--_0x29a4f1){_0x549efc['push'](_0x549efc['shift']());}};_0x4b6c2d(++_0x5d035a);}(_0x8f4c,0x113));var _0xc8f4=function(_0xf17786,_0x22bf88){_0xf17786=_0xf17786-0x0;var _0x7d3eb1=_0x8f4c[_0xf17786];return _0x7d3eb1;};'use strict';module[_0xc8f4('0x0')]={'DOMAIN':_0xc8f4('0x1'),'SESSION_SECRET':_0xc8f4('0x2'),'GOOGLE_ID':_0xc8f4('0x3'),'GOOGLE_SECRET':_0xc8f4('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 1432884..a67997b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90d2=['fileLogger','exports'];(function(_0x3615e0,_0x175dbe){var _0x341e61=function(_0x4011a3){while(--_0x4011a3){_0x3615e0['push'](_0x3615e0['shift']());}};_0x341e61(++_0x175dbe);}(_0x90d2,0x8c));var _0x290d=function(_0x34a118,_0xbff87c){_0x34a118=_0x34a118-0x0;var _0x18f5ed=_0x90d2[_0x34a118];return _0x18f5ed;};'use strict';var fileLogger=require('../utils/loggers')[_0x290d('0x0')];module[_0x290d('0x1')]=fileLogger; \ No newline at end of file +var _0x4601=['fileLogger'];(function(_0x5ca651,_0x1724a1){var _0x1aee54=function(_0x27489e){while(--_0x27489e){_0x5ca651['push'](_0x5ca651['shift']());}};_0x1aee54(++_0x1724a1);}(_0x4601,0x82));var _0x1460=function(_0x4fc99f,_0x3ac99c){_0x4fc99f=_0x4fc99f-0x0;var _0x1bc92d=_0x4601[_0x4fc99f];return _0x1bc92d;};'use strict';var fileLogger=require('../utils/loggers')[_0x1460('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 33f20b3..836991f 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 _0x2633=['../../config/environment','join','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2633,0xdd));var _0x3263=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x2633[_0x5447fd];return _0x15b28a;};'use strict';var path=require('path');var cfg=require(_0x3263('0x0'));var env={'NODE_PATH':path['resolve'](path[_0x3263('0x1')](cfg['root'],_0x3263('0x2')))};var pm2config={'apps':[{'name':_0x3263('0x3'),'script':path[_0x3263('0x1')](__dirname,_0x3263('0x4')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x3263('0x5')),'env':env},{'name':_0x3263('0x6'),'script':path[_0x3263('0x1')](__dirname,_0x3263('0x7')),'env':env},{'name':_0x3263('0x8'),'script':path[_0x3263('0x1')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x3263('0x9'),'script':path[_0x3263('0x1')](__dirname,_0x3263('0xa')),'env':env},{'name':_0x3263('0xb'),'script':path[_0x3263('0x1')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x3263('0xc')]=pm2config; \ No newline at end of file +var _0xb548=['../../services/express/index.js','ami','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','resolve','join','root','express'];(function(_0x56470f,_0x3cbafa){var _0x1be7bc=function(_0x558567){while(--_0x558567){_0x56470f['push'](_0x56470f['shift']());}};_0x1be7bc(++_0x3cbafa);}(_0xb548,0x121));var _0x8b54=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xb548[_0x2aa0e7];return _0x1472c0;};'use strict';var path=require(_0x8b54('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x8b54('0x1')](path[_0x8b54('0x2')](cfg[_0x8b54('0x3')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x8b54('0x4'),'script':path[_0x8b54('0x2')](__dirname,_0x8b54('0x5')),'env':env},{'name':_0x8b54('0x6'),'script':path[_0x8b54('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x8b54('0x7'),'script':path['join'](__dirname,_0x8b54('0x8')),'env':env},{'name':_0x8b54('0x9'),'script':path[_0x8b54('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x8b54('0xa'),'script':path[_0x8b54('0x2')](__dirname,_0x8b54('0xb')),'env':env},{'name':_0x8b54('0xc'),'script':path['join'](__dirname,_0x8b54('0xd')),'env':env}]};module['exports']=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5bb8720..9547674 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 _0xa391=['dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect','stop','restart','list','describe','delete'];(function(_0x3dc53b,_0x5271aa){var _0xe99dcb=function(_0x2244e9){while(--_0x2244e9){_0x3dc53b['push'](_0x3dc53b['shift']());}};_0xe99dcb(++_0x5271aa);}(_0xa391,0xf2));var _0x1a39=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xa391[_0x46698a];return _0x356db0;};'use strict';var pm2=require(_0x1a39('0x0'));var BPromise=require(_0x1a39('0x1'));var config=require(_0x1a39('0x2'));function connect(){return new BPromise(function(_0x19530f,_0x33d0ae){return pm2[_0x1a39('0x3')](function(_0x2471cc){if(_0x2471cc){return _0x33d0ae(_0x2471cc);}return _0x19530f(_0x1a39('0x4'));});});};exports['start']=function(_0xf606b){return connect()[_0x1a39('0x5')](function(){return new BPromise(function(_0x4a5bcc,_0x58931b){return pm2[_0x1a39('0x6')](_0xf606b,function(_0x57d0d7,_0x719cc7){if(_0x57d0d7){return _0x58931b(_0x57d0d7);}pm2[_0x1a39('0x7')]();return _0x4a5bcc(_0x719cc7);});});});};exports['stop']=function(_0x16e525){return connect()[_0x1a39('0x5')](function(){return new BPromise(function(_0x2ba955,_0x5a07a9){return pm2[_0x1a39('0x8')](_0x16e525,function(_0xc79ead,_0xeaaa9a){if(_0xc79ead){return _0x5a07a9(_0xc79ead);}pm2['disconnect']();return _0x2ba955(_0xeaaa9a);});});});};exports[_0x1a39('0x9')]=function(_0x47c04f){return connect()[_0x1a39('0x5')](function(){return new BPromise(function(_0x423eb2,_0x54a540){return pm2[_0x1a39('0x9')](_0x47c04f,function(_0x3c0fd1,_0x4405a6){if(_0x3c0fd1){return _0x54a540(_0x3c0fd1);}pm2[_0x1a39('0x7')]();return _0x423eb2(_0x4405a6);});});});};exports[_0x1a39('0xa')]=function(){return connect()[_0x1a39('0x5')](function(){return new BPromise(function(_0x478a20,_0x39ad77){return pm2[_0x1a39('0xa')](function(_0x36b808,_0x3cab4b){if(_0x36b808){return _0x39ad77(_0x36b808);}pm2[_0x1a39('0x7')]();return _0x478a20(_0x3cab4b);});});});};exports[_0x1a39('0xb')]=function(_0x47c57c){return connect()['then'](function(){return new BPromise(function(_0xcdd1c5,_0x2c394b){return pm2[_0x1a39('0xb')](_0x47c57c,function(_0x56c4ef,_0x2b491b){if(_0x56c4ef){return _0x2c394b(_0x56c4ef);}pm2[_0x1a39('0x7')]();return _0xcdd1c5(_0x2b491b);});});});};exports['delete']=function(_0x3f8f8d){return connect()['then'](function(){return new BPromise(function(_0x30be06,_0x2ed1aa){return pm2[_0x1a39('0xc')](_0x3f8f8d,function(_0x6efd5c,_0x5819f3){if(_0x6efd5c){return _0x2ed1aa(_0x6efd5c);}pm2['disconnect']();return _0x30be06(_0x5819f3);});});});};exports[_0x1a39('0xd')]=function(){return connect()[_0x1a39('0x5')](function(){return new BPromise(function(_0x4b1f40,_0x4d3840){return pm2[_0x1a39('0xd')](function(_0xe1d34f){if(_0xe1d34f){return _0x4d3840(_0xe1d34f);}return _0x4b1f40(_0x1a39('0xe'));});});});}; \ No newline at end of file +var _0x4709=['disconnect','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop','restart','list','describe'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4709,0x1e4));var _0x9470=function(_0x215250,_0x584168){_0x215250=_0x215250-0x0;var _0x22777b=_0x4709[_0x215250];return _0x22777b;};'use strict';var pm2=require(_0x9470('0x0'));var BPromise=require(_0x9470('0x1'));var config=require(_0x9470('0x2'));function connect(){return new BPromise(function(_0x2bd406,_0x10cb25){return pm2[_0x9470('0x3')](function(_0x250eb7){if(_0x250eb7){return _0x10cb25(_0x250eb7);}return _0x2bd406(_0x9470('0x4'));});});};exports[_0x9470('0x5')]=function(_0x5b0d79){return connect()[_0x9470('0x6')](function(){return new BPromise(function(_0x2bffd0,_0x384058){return pm2[_0x9470('0x5')](_0x5b0d79,function(_0x36f1a3,_0x521870){if(_0x36f1a3){return _0x384058(_0x36f1a3);}pm2['disconnect']();return _0x2bffd0(_0x521870);});});});};exports[_0x9470('0x7')]=function(_0x5552dc){return connect()[_0x9470('0x6')](function(){return new BPromise(function(_0x2a83a0,_0x3480b1){return pm2[_0x9470('0x7')](_0x5552dc,function(_0x3d7909,_0x5b77a9){if(_0x3d7909){return _0x3480b1(_0x3d7909);}pm2['disconnect']();return _0x2a83a0(_0x5b77a9);});});});};exports['restart']=function(_0x5e7e9a){return connect()[_0x9470('0x6')](function(){return new BPromise(function(_0x40a59e,_0x2494bb){return pm2[_0x9470('0x8')](_0x5e7e9a,function(_0x553553,_0x20ad8a){if(_0x553553){return _0x2494bb(_0x553553);}pm2['disconnect']();return _0x40a59e(_0x20ad8a);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x465b43,_0x1f5d2e){return pm2[_0x9470('0x9')](function(_0x2bef79,_0x23cf4c){if(_0x2bef79){return _0x1f5d2e(_0x2bef79);}pm2['disconnect']();return _0x465b43(_0x23cf4c);});});});};exports[_0x9470('0xa')]=function(_0x13708c){return connect()[_0x9470('0x6')](function(){return new BPromise(function(_0x5bc960,_0x50b131){return pm2['describe'](_0x13708c,function(_0x4db27e,_0x29d5c4){if(_0x4db27e){return _0x50b131(_0x4db27e);}pm2[_0x9470('0xb')]();return _0x5bc960(_0x29d5c4);});});});};exports[_0x9470('0xc')]=function(_0xfd215b){return connect()['then'](function(){return new BPromise(function(_0x2acd81,_0xd6f40c){return pm2['delete'](_0xfd215b,function(_0x50733c,_0x63f12b){if(_0x50733c){return _0xd6f40c(_0x50733c);}pm2[_0x9470('0xb')]();return _0x2acd81(_0x63f12b);});});});};exports['dump']=function(){return connect()[_0x9470('0x6')](function(){return new BPromise(function(_0x7414ba,_0x3abc4f){return pm2[_0x9470('0xd')](function(_0x349473){if(_0x349473){return _0x3abc4f(_0x349473);}return _0x7414ba(_0x9470('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 7434a91..341108f 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 _0x7780=['ChatInteraction','findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x4f7ec3,_0x29183d){var _0x34acdf=function(_0x461410){while(--_0x461410){_0x4f7ec3['push'](_0x4f7ec3['shift']());}};_0x34acdf(++_0x29183d);}(_0x7780,0x79));var _0x0778=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x7780[_0x68ee8b];return _0x5148f7;};'use strict';var _=require(_0x0778('0x0'));var moment=require(_0x0778('0x1'));var Redis=require(_0x0778('0x2'));var util=require('util');var config=require(_0x0778('0x3'));var db=require(_0x0778('0x4'))['db'];var logger=require(_0x0778('0x5'))(_0x0778('0x6'));config[_0x0778('0x7')]=_[_0x0778('0x8')](config[_0x0778('0x7')],{'host':_0x0778('0x9'),'port':0x18eb});var io=require(_0x0778('0xa'))(new Redis(config[_0x0778('0x7')]));function closeInteractions(){var _0x392e88=0x0;var _0x500800=[];return db[_0x0778('0xb')][_0x0778('0xc')]({'raw':!![],'attributes':['id',_0x0778('0xd')],'where':{'id':0x1}})[_0x0778('0xe')](function(_0x5509e5){_0x392e88=_0x5509e5[_0x0778('0xd')];if(_0x392e88){return db[_0x0778('0xf')][_0x0778('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0778('0x11')](_0x5509e5[_0x0778('0xd')],_0x0778('0x12'))}}});}else{return[];}})[_0x0778('0xe')](function(_0x412405){if(_0x412405&&_0x412405[_0x0778('0x13')]){_0x500800=_[_0x0778('0x14')](_0x412405||[],'id');logger[_0x0778('0x15')](_0x0778('0x16'),_0x500800[_0x0778('0x17')]());return db[_0x0778('0xf')]['update']({'closeReason':_0x0778('0x18'),'disposition':_0x0778('0x19'),'closed':!![],'closedAt':moment()['format'](_0x0778('0x1a'))},{'where':{'id':_0x500800}});}})[_0x0778('0xe')](function(){if(_0x500800&&_0x500800[_0x0778('0x13')]){logger[_0x0778('0x15')](_0x0778('0x1b'),_0x500800[_0x0778('0x17')]());for(var _0x22fcc3=0x0;_0x22fcc3<_0x500800[_0x0778('0x13')];_0x22fcc3++){io[_0x0778('0x1c')](_0x0778('0x1d'),{'id':_0x500800[_0x22fcc3],'closed':!![]});}}})['catch'](function(_0xa5c11d){logger[_0x0778('0x1e')](_0x0778('0x1f'),_0xa5c11d?util[_0x0778('0x20')](_0xa5c11d,{'showHidden':![],'depth':null}):'');});}exports[_0x0778('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x30c1=['minutes','then','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','error','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','lastMsgAt','subtract'];(function(_0x1b5f7a,_0x281348){var _0x205dd7=function(_0x331712){while(--_0x331712){_0x1b5f7a['push'](_0x1b5f7a['shift']());}};_0x205dd7(++_0x281348);}(_0x30c1,0x1e9));var _0x130c=function(_0x1c0460,_0x30fbcc){_0x1c0460=_0x1c0460-0x0;var _0x237424=_0x30c1[_0x1c0460];return _0x237424;};'use strict';var _=require(_0x130c('0x0'));var moment=require(_0x130c('0x1'));var Redis=require(_0x130c('0x2'));var util=require(_0x130c('0x3'));var config=require(_0x130c('0x4'));var db=require(_0x130c('0x5'))['db'];var logger=require('../logger')(_0x130c('0x6'));config['redis']=_[_0x130c('0x7')](config['redis'],{'host':_0x130c('0x8'),'port':0x18eb});var io=require(_0x130c('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x24f0ab=0x0;var _0x4d80f2=[];return db['Setting'][_0x130c('0xa')]({'raw':!![],'attributes':['id',_0x130c('0xb')],'where':{'id':0x1}})['then'](function(_0x2775cc){_0x24f0ab=_0x2775cc[_0x130c('0xb')];if(_0x24f0ab){return db[_0x130c('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x130c('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x130c('0xe')](_0x2775cc['chatTimeout'],_0x130c('0xf'))}}});}else{return[];}})[_0x130c('0x10')](function(_0x290f9a){if(_0x290f9a&&_0x290f9a['length']){_0x4d80f2=_['map'](_0x290f9a||[],'id');logger[_0x130c('0x11')](_0x130c('0x12'),_0x4d80f2[_0x130c('0x13')]());return db['ChatInteraction'][_0x130c('0x14')]({'closeReason':_0x130c('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x130c('0x16'))},{'where':{'id':_0x4d80f2}});}})[_0x130c('0x10')](function(){if(_0x4d80f2&&_0x4d80f2[_0x130c('0x17')]){logger[_0x130c('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x4d80f2[_0x130c('0x13')]());for(var _0x1d84c9=0x0;_0x1d84c9<_0x4d80f2['length'];_0x1d84c9++){io[_0x130c('0x18')](_0x130c('0x19'),{'id':_0x4d80f2[_0x1d84c9],'closed':!![]});}}})[_0x130c('0x1a')](function(_0x399d1e){logger[_0x130c('0x1b')]('[CHAT]\x20Error\x20closing\x20interactions',_0x399d1e?util['inspect'](_0x399d1e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index c776b4e..7698e5a 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 _0x1219=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x5e8fc,_0x1ccc06){var _0x41c58c=function(_0x495f2c){while(--_0x495f2c){_0x5e8fc['push'](_0x5e8fc['shift']());}};_0x41c58c(++_0x1ccc06);}(_0x1219,0x11c));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';function start(){var _0x2693af=require(_0x9121('0x0'));return _0x2693af['startAllRefreshIntervals']();}module[_0x9121('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xf05e=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xf05e,0xe2));var _0xef05=function(_0x44565e,_0x19e34){_0x44565e=_0x44565e-0x0;var _0x583604=_0xf05e[_0x44565e];return _0x583604;};'use strict';function start(){var _0x3995b4=require(_0xef05('0x0'));return _0x3995b4[_0xef05('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 31051df..ed6ccf0 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 _0x467a=['subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','toString','keyBy','difference','length','exists','delete\x20cron','resolve','run\x20job','cron','isBetween','endAt','add','start','add\x20cron','stop\x20cron','active','startAt','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','then','catch','error','info','email','MailAccount','getSmtpOptions','format','name','Smtp','user','bcc','subtractNumber','join','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','Empty','sendIfEmpty','Loading','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','email\x20sent','case\x20loading','retries','job','data','operation','stop','still\x20loading','case\x20empty','Unrecognized\x20status:','entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','dataValues','retry','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit'];(function(_0x21bbc2,_0x334558){var _0x5676cb=function(_0x163c02){while(--_0x163c02){_0x21bbc2['push'](_0x21bbc2['shift']());}};_0x5676cb(++_0x334558);}(_0x467a,0x8c));var _0xa467=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x467a[_0x2dafbe];return _0x58a45a;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xa467('0x0'));var _=require(_0xa467('0x1'));var moment=require(_0xa467('0x2'));var CronJobManager=require(_0xa467('0x3'));var jayson=require(_0xa467('0x4'));var BPromise=require(_0xa467('0x5'));var logger=require(_0xa467('0x6'))('schedule');var db=require(_0xa467('0x7'))['db'];const retry=require('retry');var analyticCustomReportController=require(_0xa467('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xa467('0x9')][_0xa467('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x13ba06){const _0x47d35d={};if(typeof _0x13ba06===_0xa467('0xb')){_0x47d35d['id']=_0x13ba06;}return db['AnalyticExtractedReport']['findOne']({'where':_0x47d35d})[_0xa467('0xc')](function(_0xb6f1f2){return _0xb6f1f2;})[_0xa467('0xd')](function(_0x2c6c6f){logger[_0xa467('0xe')](_0x2c6c6f);});}function handleSendEmail(_0x504b67,_0x2273b1){logger[_0xa467('0xf')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x504b67[_0xa467('0x10')]);var _0x322431=!![];var _0x25162c=_0x504b67[_0xa467('0x11')][_0xa467('0x12')]();var _0x235a20={'account':_0x25162c,'message':{'from':util[_0xa467('0x13')]('\x22%s\x22\x20<%s>',_0x504b67['MailAccount'][_0xa467('0x14')],_0x504b67['MailAccount'][_0xa467('0x10')]||_0x504b67[_0xa467('0x11')][_0xa467('0x15')][_0xa467('0x16')]),'to':_0x504b67['email'],'cc':_0x504b67['cc'],'bcc':_0x504b67[_0xa467('0x17')],'subject':util[_0xa467('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x2273b1[_0xa467('0x14')],_0x504b67[_0xa467('0x18')],_0x504b67['subtractUnit'])}};var _0x3720b9=path[_0xa467('0x19')](__dirname,'../../files/reports');var _0x497837=_0x2273b1[_0xa467('0x1a')];var _0x35af6e=util[_0xa467('0x13')](_0xa467('0x1b'),path[_0xa467('0x1c')](_0x2273b1[_0xa467('0x1a')],path[_0xa467('0x1d')](_0x2273b1[_0xa467('0x1a')])),_0xa467('0x1e'));var _0x53b766=path['join'](_0x3720b9,_0x497837);var _0x38821d=path[_0xa467('0x19')](_0x3720b9,_0x35af6e);if(fs[_0xa467('0x1f')](_0x53b766)){_0x2273b1['status']='Sent';_0x235a20[_0xa467('0x20')][_0xa467('0x21')]=[{'filename':_0x497837,'path':_0x53b766}];_0x235a20['message'][_0xa467('0x22')]=util[_0xa467('0x13')](_0xa467('0x23'),JSON[_0xa467('0x24')](_0x2273b1,null,0x2));}else if(fs['existsSync'](_0x38821d)){_0x2273b1[_0xa467('0x25')]=_0xa467('0x26');_0x235a20[_0xa467('0x20')][_0xa467('0x21')]=[{'filename':_0x35af6e,'path':_0x38821d}];}else{if(_0x2273b1[_0xa467('0x25')]===_0xa467('0x27')){_0x235a20['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x504b67[_0xa467('0x28')]){_0x322431=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x2273b1['status']===_0xa467('0x29')){_0x235a20[_0xa467('0x20')][_0xa467('0x22')]='Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x2273b1[_0xa467('0x25')]===_0xa467('0x2a')){_0x235a20[_0xa467('0x20')][_0xa467('0x22')]=_0xa467('0x2b');}else if(_0x2273b1['status']===_0xa467('0x2c')){_0x235a20[_0xa467('0x20')][_0xa467('0x22')]=_0xa467('0x2d');}else{logger['error'](_0xa467('0x2e'),_0x2273b1[_0xa467('0x25')]);}}if(_0x322431){return client[_0xa467('0x2f')](_0xa467('0x30'),_0x235a20)[_0xa467('0xc')](function(_0x13a9cb){if(_0x13a9cb[_0xa467('0xe')]){return logger[_0xa467('0xe')]('error\x20mail',JSON[_0xa467('0x24')](_0x13a9cb));}return logger[_0xa467('0xf')](_0xa467('0x31'));})[_0xa467('0xd')](function(_0x4356be){return logger[_0xa467('0xe')]('error\x20mail',JSON['stringify'](_0x4356be));});}}function handleError(){return function(_0x3fd870){return logger[_0xa467('0xe')](JSON[_0xa467('0x24')](_0x3fd870));};}function loading(_0x54e5a5){logger['info'](_0xa467('0x32'));if(_0x54e5a5['currentAttempt']===_0x54e5a5['retryOptions'][_0xa467('0x33')]){handleSendEmail(_0x54e5a5[_0xa467('0x34')],_0x54e5a5[_0xa467('0x35')]);_0x54e5a5[_0xa467('0x36')][_0xa467('0x37')]();}else{_0x54e5a5[_0xa467('0x36')]['retry'](_0xa467('0x38'));}}function completed(_0x195f63){logger[_0xa467('0xf')]('case\x20completed');handleSendEmail(_0x195f63[_0xa467('0x34')],_0x195f63['data']);_0x195f63[_0xa467('0x36')][_0xa467('0x37')]();}function empty(_0x684ca6){logger['info'](_0xa467('0x39'));handleSendEmail(_0x684ca6[_0xa467('0x34')],_0x684ca6['data']);_0x684ca6[_0xa467('0x36')]['stop']();}function failed(_0x447203){logger[_0xa467('0xf')]('case\x20failed');handleSendEmail(_0x447203[_0xa467('0x34')],_0x447203[_0xa467('0x35')]);_0x447203[_0xa467('0x36')][_0xa467('0x37')]();}function urecognized(_0x570dee){logger[_0xa467('0xe')](_0xa467('0x3a'),_0x570dee[_0xa467('0x3b')]['dataValues'][_0xa467('0x25')]);_0x570dee[_0xa467('0x36')]['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x99e4b,_0x413b51){const _0x5dcfc3={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x92befa=retry[_0xa467('0x36')](_0x5dcfc3);_0x92befa[_0xa467('0x3c')](_0x378b00=>{logger[_0xa467('0xf')](_0xa467('0x3d')+_0x99e4b['id']+_0xa467('0x3e')+_0x378b00);try{getReportData(_0x413b51['id'])['then'](function(_0x438370){_0x413b51=_0x438370;logger[_0xa467('0xf')](_0xa467('0x3f'),_0x438370[_0xa467('0x40')][_0xa467('0x25')]);if(!reportStatusStrategies[_0x438370[_0xa467('0x40')][_0xa467('0x25')]]){logger[_0xa467('0xe')](_0xa467('0x3f'),_0x438370['dataValues'][_0xa467('0x25')]);_0x92befa[_0xa467('0x41')]();}reportStatusStrategies[_0x438370[_0xa467('0x40')][_0xa467('0x25')]]({'operation':_0x92befa,'currentAttempt':_0x378b00,'retryOptions':_0x5dcfc3,'job':_0x99e4b,'data':_0x413b51,'entity':_0x438370});});}catch(_0x2db866){_0x92befa['retry'](_0x2db866);}});}function handleResult(_0x4a243d){return function(_0x2966e0){if(_0x4a243d[_0xa467('0x42')]&&_0x4a243d['MailAccount']&&_0x4a243d[_0xa467('0x11')][_0xa467('0x15')]&&!_[_0xa467('0x43')](_0x4a243d[_0xa467('0x10')])){retryer(_0x4a243d,_0x2966e0);}};}function handleJob(_0x1024e5){return function(){try{if(_['isNil'](_0x1024e5['subtractNumber'])){return logger[_0xa467('0xf')](_0xa467('0x44'));}if(_[_0xa467('0x43')](_0x1024e5[_0xa467('0x45')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x12d146={'startDate':moment()[_0xa467('0x46')](_0x1024e5[_0xa467('0x18')],_0x1024e5[_0xa467('0x45')])[_0xa467('0x13')](_0xa467('0x47')),'endDate':moment()[_0xa467('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xa467('0x48'),'output':_0x1024e5[_0xa467('0x49')],'name':_0x1024e5[_0xa467('0x14')]};if(!_[_0xa467('0x43')](_0x1024e5[_0xa467('0x4a')])){logger[_0xa467('0xf')](_0xa467('0x4b'),_0x1024e5['DefaultReportId']);return analyticDefaultReportController[_0xa467('0x4c')]({'id':_0x1024e5[_0xa467('0x4a')]},_0x12d146)[_0xa467('0xc')](handleResult(_0x1024e5))[_0xa467('0xd')](handleError());}if(!_[_0xa467('0x43')](_0x1024e5[_0xa467('0x4d')])){logger[_0xa467('0xf')](_0xa467('0x4e'),_0x1024e5[_0xa467('0x4d')]);return analyticCustomReportController['runReport']({'id':_0x1024e5[_0xa467('0x4d')]},_0x12d146)[_0xa467('0xc')](handleResult(_0x1024e5))['catch'](handleError());}}catch(_0x4d4c0d){logger[_0xa467('0xe')](JSON[_0xa467('0x24')](_0x4d4c0d));}return logger['info'](_0xa467('0x4f'));};}function getJobs(_0x159a35){var _0x51efbb={};if(_0x159a35){_0x51efbb['id']=_0x159a35;}return db[_0xa467('0x50')][_0xa467('0x51')]({'where':_0x51efbb,'include':[{'model':db[_0xa467('0x11')],'attributes':['id',_0xa467('0x14'),_0xa467('0x10')],'include':[{'model':db[_0xa467('0x52')],'as':_0xa467('0x15'),'include':[{'model':db[_0xa467('0x53')],'as':_0xa467('0x53')}]}]}]})[_0xa467('0xc')](function(_0x4d8141){var _0x39c023=_[_0xa467('0x54')](manager['jobs']);var _0x54c394=_['map'](_0x4d8141,function(_0x423740){return _0x423740['id'][_0xa467('0x55')]();});var _0xa7dbf3=_[_0xa467('0x56')](_0x4d8141,function(_0x15a46b){return _0x15a46b['id'][_0xa467('0x55')]();});var _0x3dce59=_0x159a35?_0x54c394:_[_0xa467('0x57')](_0x54c394,_0x39c023);var _0x288a02=_['intersection'](_0x54c394,_0x39c023);var _0x35b01a=_['difference'](_0x39c023,_0x54c394);var _0x4ea7d8;var _0x4610be;for(_0x4ea7d8=0x0;_0x4ea7d8<_0x35b01a[_0xa467('0x58')]&&!_0x159a35;_0x4ea7d8+=0x1){_0x4610be=_0x35b01a[_0x4ea7d8][_0xa467('0x55')]();if(manager[_0xa467('0x59')](_0x4610be)){manager[_0xa467('0x37')](_0x4610be);manager['deleteJob'](_0x4610be);logger[_0xa467('0xf')](_0xa467('0x5a'),_0x4610be);}}logger['info']('toRun',JSON[_0xa467('0x24')](_0x3dce59));for(_0x4ea7d8=0x0;_0x4ea7d8<_0x3dce59[_0xa467('0x58')];_0x4ea7d8+=0x1){_0x4610be=_0x3dce59[_0x4ea7d8][_0xa467('0x55')]();if(_0x159a35){logger[_0xa467('0xf')](JSON[_0xa467('0x24')](_0xa7dbf3[_0x4610be]));BPromise[_0xa467('0x5b')]()[_0xa467('0xc')](handleJob(_0xa7dbf3[_0x4610be]));logger[_0xa467('0xf')](_0xa467('0x5c'),_0xa7dbf3[_0x4610be][_0xa467('0x14')],_0xa7dbf3[_0x4610be]['cron']);}else if(_0xa7dbf3[_0x4610be][_0xa467('0x5d')]&&_0xa7dbf3[_0x4610be]['active']&&moment()[_0xa467('0x5e')](_0xa7dbf3[_0x4610be]['startAt'],_0xa7dbf3[_0x4610be][_0xa467('0x5f')])){manager[_0xa467('0x60')](_0x4610be,_0xa7dbf3[_0x4610be][_0xa467('0x5d')],handleJob(_0xa7dbf3[_0x4610be]));manager[_0xa467('0x61')](_0x4610be);logger[_0xa467('0xf')](_0xa467('0x62'),_0xa7dbf3[_0x4610be][_0xa467('0x14')],_0xa7dbf3[_0x4610be][_0xa467('0x5d')]);}else if(manager[_0xa467('0x59')](_0x4610be)){manager['stop'](_0x4610be);manager['deleteJob'](_0x4610be);logger[_0xa467('0xf')](_0xa467('0x63'),_0xa7dbf3[_0x4610be][_0xa467('0x14')],_0xa7dbf3[_0x4610be][_0xa467('0x5d')]);}}for(_0x4ea7d8=0x0,_0x4610be;_0x4ea7d8<_0x288a02['length']&&!_0x159a35;_0x4ea7d8+=0x1){_0x4610be=_0x288a02[_0x4ea7d8][_0xa467('0x55')]();if(manager['exists'](_0x4610be)){if(_0xa7dbf3[_0x4610be]['cron']&&_0xa7dbf3[_0x4610be][_0xa467('0x64')]&&moment()[_0xa467('0x5e')](_0xa7dbf3[_0x4610be][_0xa467('0x65')],_0xa7dbf3[_0x4610be][_0xa467('0x5f')])){manager[_0xa467('0x66')](_0x4610be,_0xa7dbf3[_0x4610be][_0xa467('0x5d')],handleJob(_0xa7dbf3[_0x4610be]));logger[_0xa467('0xf')](_0xa467('0x67'),_0xa7dbf3[_0x4610be][_0xa467('0x14')],_0xa7dbf3[_0x4610be][_0xa467('0x5d')]);}else{manager[_0xa467('0x37')](_0x4610be);manager['deleteJob'](_0x4610be);logger[_0xa467('0xf')](_0xa467('0x63'),_0xa7dbf3[_0x4610be][_0xa467('0x14')],_0xa7dbf3[_0x4610be]['cron']);}}}})[_0xa467('0xd')](function(_0x46398c){logger['error'](JSON[_0xa467('0x24')](_0x46398c));});}exports[_0xa467('0x68')]=function(_0x3426b2){return getJobs(_0x3426b2);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3a6f=['../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','error','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','still\x20loading','stop','case\x20empty','case\x20failed','entity','attempt','Job\x20ID\x20','dataValues','sendMail','Smtp','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','toString','difference','length','deleteJob','delete\x20cron','resolve','run\x20job','cron','active','startAt','endAt','start','exists','stop\x20cron','update','update\x20cron','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','number','AnalyticExtractedReport','findOne','then','catch','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','join'];(function(_0x2ce38b,_0x29cb69){var _0x7f9db=function(_0x33b613){while(--_0x33b613){_0x2ce38b['push'](_0x2ce38b['shift']());}};_0x7f9db(++_0x29cb69);}(_0x3a6f,0x180));var _0xf3a6=function(_0x3ef47d,_0x376369){_0x3ef47d=_0x3ef47d-0x0;var _0xef9333=_0x3a6f[_0x3ef47d];return _0xef9333;};'use strict';var fs=require('fs');var util=require(_0xf3a6('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xf3a6('0x1'));var CronJobManager=require(_0xf3a6('0x2'));var jayson=require(_0xf3a6('0x3'));var BPromise=require(_0xf3a6('0x4'));var logger=require(_0xf3a6('0x5'))(_0xf3a6('0x6'));var db=require(_0xf3a6('0x7'))['db'];const retry=require(_0xf3a6('0x8'));var analyticCustomReportController=require(_0xf3a6('0x9'));var analyticDefaultReportController=require(_0xf3a6('0xa'));var client=jayson[_0xf3a6('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2859d1){const _0x1b6ff1={};if(typeof _0x2859d1===_0xf3a6('0xc')){_0x1b6ff1['id']=_0x2859d1;}return db[_0xf3a6('0xd')][_0xf3a6('0xe')]({'where':_0x1b6ff1})[_0xf3a6('0xf')](function(_0x4fd038){return _0x4fd038;})[_0xf3a6('0x10')](function(_0x5f25da){logger['error'](_0x5f25da);});}function handleSendEmail(_0x2d8d18,_0x42ce69){logger[_0xf3a6('0x11')](_0xf3a6('0x12'),_0x2d8d18[_0xf3a6('0x13')]);var _0x5e75d5=!![];var _0x4368b8=_0x2d8d18[_0xf3a6('0x14')]['getSmtpOptions']();var _0x5c664d={'account':_0x4368b8,'message':{'from':util[_0xf3a6('0x15')](_0xf3a6('0x16'),_0x2d8d18['MailAccount'][_0xf3a6('0x17')],_0x2d8d18[_0xf3a6('0x14')]['email']||_0x2d8d18[_0xf3a6('0x14')]['Smtp'][_0xf3a6('0x18')]),'to':_0x2d8d18[_0xf3a6('0x13')],'cc':_0x2d8d18['cc'],'bcc':_0x2d8d18[_0xf3a6('0x19')],'subject':util[_0xf3a6('0x15')](_0xf3a6('0x1a'),_0x42ce69[_0xf3a6('0x17')],_0x2d8d18['subtractNumber'],_0x2d8d18['subtractUnit'])}};var _0x56c2de=path[_0xf3a6('0x1b')](__dirname,_0xf3a6('0x1c'));var _0x1b295d=_0x42ce69['savename'];var _0x5ad5e1=util['format'](_0xf3a6('0x1d'),path[_0xf3a6('0x1e')](_0x42ce69[_0xf3a6('0x1f')],path[_0xf3a6('0x20')](_0x42ce69[_0xf3a6('0x1f')])),_0xf3a6('0x21'));var _0x156da4=path[_0xf3a6('0x1b')](_0x56c2de,_0x1b295d);var _0x33edc8=path[_0xf3a6('0x1b')](_0x56c2de,_0x5ad5e1);if(fs[_0xf3a6('0x22')](_0x156da4)){_0x42ce69[_0xf3a6('0x23')]=_0xf3a6('0x24');_0x5c664d[_0xf3a6('0x25')][_0xf3a6('0x26')]=[{'filename':_0x1b295d,'path':_0x156da4}];_0x5c664d['message'][_0xf3a6('0x27')]=util[_0xf3a6('0x15')](_0xf3a6('0x28'),JSON[_0xf3a6('0x29')](_0x42ce69,null,0x2));}else if(fs[_0xf3a6('0x22')](_0x33edc8)){_0x42ce69[_0xf3a6('0x23')]=_0xf3a6('0x24');_0x5c664d[_0xf3a6('0x25')][_0xf3a6('0x26')]=[{'filename':_0x5ad5e1,'path':_0x33edc8}];}else{if(_0x42ce69['status']===_0xf3a6('0x2a')){_0x5c664d[_0xf3a6('0x25')]['text']=_0xf3a6('0x2b');if(!_0x2d8d18[_0xf3a6('0x2c')]){_0x5e75d5=![];logger['info'](_0xf3a6('0x2d'));}}else if(_0x42ce69[_0xf3a6('0x23')]===_0xf3a6('0x2e')){_0x5c664d[_0xf3a6('0x25')][_0xf3a6('0x27')]=_0xf3a6('0x2f');}else if(_0x42ce69[_0xf3a6('0x23')]===_0xf3a6('0x30')){_0x5c664d[_0xf3a6('0x25')][_0xf3a6('0x27')]=_0xf3a6('0x31');}else if(_0x42ce69[_0xf3a6('0x23')]===_0xf3a6('0x32')){_0x5c664d[_0xf3a6('0x25')]['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0xf3a6('0x33')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x42ce69[_0xf3a6('0x23')]);}}if(_0x5e75d5){return client['request'](_0xf3a6('0x34'),_0x5c664d)[_0xf3a6('0xf')](function(_0x161c19){if(_0x161c19[_0xf3a6('0x33')]){return logger[_0xf3a6('0x33')](_0xf3a6('0x35'),JSON[_0xf3a6('0x29')](_0x161c19));}return logger[_0xf3a6('0x11')](_0xf3a6('0x36'));})['catch'](function(_0x377142){return logger['error'](_0xf3a6('0x35'),JSON['stringify'](_0x377142));});}}function handleError(){return function(_0x7468e9){return logger[_0xf3a6('0x33')](JSON[_0xf3a6('0x29')](_0x7468e9));};}function loading(_0x453afe){logger[_0xf3a6('0x11')](_0xf3a6('0x37'));if(_0x453afe[_0xf3a6('0x38')]===_0x453afe[_0xf3a6('0x39')][_0xf3a6('0x3a')]){handleSendEmail(_0x453afe[_0xf3a6('0x3b')],_0x453afe[_0xf3a6('0x3c')]);_0x453afe[_0xf3a6('0x3d')]['stop']();}else{_0x453afe[_0xf3a6('0x3d')][_0xf3a6('0x8')](_0xf3a6('0x3e'));}}function completed(_0x152b9d){logger['info']('case\x20completed');handleSendEmail(_0x152b9d['job'],_0x152b9d['data']);_0x152b9d[_0xf3a6('0x3d')][_0xf3a6('0x3f')]();}function empty(_0x36d67b){logger['info'](_0xf3a6('0x40'));handleSendEmail(_0x36d67b['job'],_0x36d67b[_0xf3a6('0x3c')]);_0x36d67b[_0xf3a6('0x3d')][_0xf3a6('0x3f')]();}function failed(_0x3872a3){logger['info'](_0xf3a6('0x41'));handleSendEmail(_0x3872a3[_0xf3a6('0x3b')],_0x3872a3['data']);_0x3872a3[_0xf3a6('0x3d')][_0xf3a6('0x3f')]();}function urecognized(_0x481913){logger['error']('Unrecognized\x20status:',_0x481913[_0xf3a6('0x42')]['dataValues'][_0xf3a6('0x23')]);_0x481913['operation'][_0xf3a6('0x3f')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x1caa1b,_0x32e9f9){const _0x3a09e9={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x28c962=retry[_0xf3a6('0x3d')](_0x3a09e9);_0x28c962[_0xf3a6('0x43')](_0x4f78e6=>{logger[_0xf3a6('0x11')](_0xf3a6('0x44')+_0x1caa1b['id']+'\x20Attempt\x20#:'+_0x4f78e6);try{getReportData(_0x32e9f9['id'])[_0xf3a6('0xf')](function(_0xfbd7dd){_0x32e9f9=_0xfbd7dd;logger[_0xf3a6('0x11')]('report\x20status:',_0xfbd7dd['dataValues']['status']);if(!reportStatusStrategies[_0xfbd7dd[_0xf3a6('0x45')][_0xf3a6('0x23')]]){logger[_0xf3a6('0x33')]('report\x20status:',_0xfbd7dd['dataValues']['status']);_0x28c962[_0xf3a6('0x8')]();}reportStatusStrategies[_0xfbd7dd['dataValues'][_0xf3a6('0x23')]]({'operation':_0x28c962,'currentAttempt':_0x4f78e6,'retryOptions':_0x3a09e9,'job':_0x1caa1b,'data':_0x32e9f9,'entity':_0xfbd7dd});});}catch(_0xea730a){_0x28c962[_0xf3a6('0x8')](_0xea730a);}});}function handleResult(_0x4ddaea){return function(_0x551dc4){if(_0x4ddaea[_0xf3a6('0x46')]&&_0x4ddaea[_0xf3a6('0x14')]&&_0x4ddaea['MailAccount'][_0xf3a6('0x47')]&&!_[_0xf3a6('0x48')](_0x4ddaea[_0xf3a6('0x13')])){retryer(_0x4ddaea,_0x551dc4);}};}function handleJob(_0x4862bf){return function(){try{if(_[_0xf3a6('0x48')](_0x4862bf[_0xf3a6('0x49')])){return logger[_0xf3a6('0x11')](_0xf3a6('0x4a'));}if(_[_0xf3a6('0x48')](_0x4862bf[_0xf3a6('0x4b')])){return logger[_0xf3a6('0x11')]('subtractUnit\x20null\x20or\x20undefined');}var _0x253bc8={'startDate':moment()['subtract'](_0x4862bf[_0xf3a6('0x49')],_0x4862bf[_0xf3a6('0x4b')])[_0xf3a6('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xf3a6('0x15')](_0xf3a6('0x4c')),'type':'scheduled','output':_0x4862bf[_0xf3a6('0x4d')],'name':_0x4862bf[_0xf3a6('0x17')]};if(!_[_0xf3a6('0x48')](_0x4862bf[_0xf3a6('0x4e')])){logger[_0xf3a6('0x11')](_0xf3a6('0x4f'),_0x4862bf[_0xf3a6('0x4e')]);return analyticDefaultReportController['runReport']({'id':_0x4862bf[_0xf3a6('0x4e')]},_0x253bc8)['then'](handleResult(_0x4862bf))[_0xf3a6('0x10')](handleError());}if(!_['isNil'](_0x4862bf['CustomReportId'])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x4862bf['CustomReportId']);return analyticCustomReportController[_0xf3a6('0x50')]({'id':_0x4862bf[_0xf3a6('0x51')]},_0x253bc8)['then'](handleResult(_0x4862bf))['catch'](handleError());}}catch(_0x3ba66b){logger[_0xf3a6('0x33')](JSON[_0xf3a6('0x29')](_0x3ba66b));}return logger[_0xf3a6('0x11')](_0xf3a6('0x52'));};}function getJobs(_0x424595){var _0x39fc9f={};if(_0x424595){_0x39fc9f['id']=_0x424595;}return db[_0xf3a6('0x53')][_0xf3a6('0x54')]({'where':_0x39fc9f,'include':[{'model':db[_0xf3a6('0x14')],'attributes':['id',_0xf3a6('0x17'),'email'],'include':[{'model':db[_0xf3a6('0x55')],'as':_0xf3a6('0x47'),'include':[{'model':db[_0xf3a6('0x56')],'as':_0xf3a6('0x56')}]}]}]})[_0xf3a6('0xf')](function(_0x201881){var _0x249a5c=_['keys'](manager['jobs']);var _0x5bb2ea=_['map'](_0x201881,function(_0x4ac37b){return _0x4ac37b['id'][_0xf3a6('0x57')]();});var _0x8e37e5=_['keyBy'](_0x201881,function(_0x4f0f68){return _0x4f0f68['id'][_0xf3a6('0x57')]();});var _0xff1804=_0x424595?_0x5bb2ea:_[_0xf3a6('0x58')](_0x5bb2ea,_0x249a5c);var _0x4adce3=_['intersection'](_0x5bb2ea,_0x249a5c);var _0x58c4c3=_[_0xf3a6('0x58')](_0x249a5c,_0x5bb2ea);var _0x36c439;var _0x307522;for(_0x36c439=0x0;_0x36c439<_0x58c4c3[_0xf3a6('0x59')]&&!_0x424595;_0x36c439+=0x1){_0x307522=_0x58c4c3[_0x36c439][_0xf3a6('0x57')]();if(manager['exists'](_0x307522)){manager['stop'](_0x307522);manager[_0xf3a6('0x5a')](_0x307522);logger[_0xf3a6('0x11')](_0xf3a6('0x5b'),_0x307522);}}logger[_0xf3a6('0x11')]('toRun',JSON[_0xf3a6('0x29')](_0xff1804));for(_0x36c439=0x0;_0x36c439<_0xff1804[_0xf3a6('0x59')];_0x36c439+=0x1){_0x307522=_0xff1804[_0x36c439][_0xf3a6('0x57')]();if(_0x424595){logger[_0xf3a6('0x11')](JSON[_0xf3a6('0x29')](_0x8e37e5[_0x307522]));BPromise[_0xf3a6('0x5c')]()[_0xf3a6('0xf')](handleJob(_0x8e37e5[_0x307522]));logger[_0xf3a6('0x11')](_0xf3a6('0x5d'),_0x8e37e5[_0x307522][_0xf3a6('0x17')],_0x8e37e5[_0x307522][_0xf3a6('0x5e')]);}else if(_0x8e37e5[_0x307522][_0xf3a6('0x5e')]&&_0x8e37e5[_0x307522][_0xf3a6('0x5f')]&&moment()['isBetween'](_0x8e37e5[_0x307522][_0xf3a6('0x60')],_0x8e37e5[_0x307522][_0xf3a6('0x61')])){manager['add'](_0x307522,_0x8e37e5[_0x307522][_0xf3a6('0x5e')],handleJob(_0x8e37e5[_0x307522]));manager[_0xf3a6('0x62')](_0x307522);logger['info']('add\x20cron',_0x8e37e5[_0x307522]['name'],_0x8e37e5[_0x307522][_0xf3a6('0x5e')]);}else if(manager[_0xf3a6('0x63')](_0x307522)){manager['stop'](_0x307522);manager[_0xf3a6('0x5a')](_0x307522);logger['info'](_0xf3a6('0x64'),_0x8e37e5[_0x307522]['name'],_0x8e37e5[_0x307522][_0xf3a6('0x5e')]);}}for(_0x36c439=0x0,_0x307522;_0x36c439<_0x4adce3[_0xf3a6('0x59')]&&!_0x424595;_0x36c439+=0x1){_0x307522=_0x4adce3[_0x36c439]['toString']();if(manager[_0xf3a6('0x63')](_0x307522)){if(_0x8e37e5[_0x307522][_0xf3a6('0x5e')]&&_0x8e37e5[_0x307522][_0xf3a6('0x5f')]&&moment()['isBetween'](_0x8e37e5[_0x307522][_0xf3a6('0x60')],_0x8e37e5[_0x307522][_0xf3a6('0x61')])){manager[_0xf3a6('0x65')](_0x307522,_0x8e37e5[_0x307522][_0xf3a6('0x5e')],handleJob(_0x8e37e5[_0x307522]));logger[_0xf3a6('0x11')](_0xf3a6('0x66'),_0x8e37e5[_0x307522][_0xf3a6('0x17')],_0x8e37e5[_0x307522][_0xf3a6('0x5e')]);}else{manager[_0xf3a6('0x3f')](_0x307522);manager[_0xf3a6('0x5a')](_0x307522);logger[_0xf3a6('0x11')](_0xf3a6('0x64'),_0x8e37e5[_0x307522]['name'],_0x8e37e5[_0x307522]['cron']);}}}})['catch'](function(_0x5bb219){logger[_0xf3a6('0x33')](JSON[_0xf3a6('0x29')](_0x5bb219));});}exports['run']=function(_0x31268e){return getJobs(_0x31268e);};exports[_0xf3a6('0x62')]=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 224c447..cdc1e9e 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 _0xc933=['SentimentScore','Positive','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FailureReason','resolve','sentiment','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','COMPLETED','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','fileText','TranscriptionJob','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','language','bucket','CloudProvider','findOne','sentimentAccountId','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','update','Sentiment'];(function(_0x1e27cd,_0x5bdbe6){var _0x485d57=function(_0x132943){while(--_0x132943){_0x1e27cd['push'](_0x1e27cd['shift']());}};_0x485d57(++_0x5bdbe6);}(_0xc933,0xf9));var _0x3c93=function(_0x3ef23c,_0xd1f372){_0x3ef23c=_0x3ef23c-0x0;var _0x39e0aa=_0xc933[_0x3ef23c];return _0x39e0aa;};var _=require(_0x3c93('0x0'));var AWS=require(_0x3c93('0x1'));var rp=require(_0x3c93('0x2'));var util=require(_0x3c93('0x3'));var BPromise=require(_0x3c93('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x3c93('0x5'))(_0x3c93('0x6'));function getTranscriptionJob(_0x20d680,_0x343f96,_0x26478a,_0x47a995){return new Promise(function(_0x1f2667,_0x19939f){var _0x52c22c=new AWS[(_0x3c93('0x7'))]({'accessKeyId':_0x343f96,'secretAccessKey':_0x20d680,'region':_0x26478a});_0x52c22c['getTranscriptionJob']({'TranscriptionJobName':_0x47a995},function(_0x1b505a,_0x2ead14){if(_0x1b505a){return _0x19939f(_0x1b505a);}else{return _0x1f2667(_0x2ead14);}});});}function sentiment(_0x137d3c,_0xb32593,_0x46f9e8,_0x292096,_0x5577cf){return new Promise(function(_0x4b5ba8,_0x4a260d){var _0x1a5bac=new AWS[(_0x3c93('0x8'))]({'accessKeyId':_0xb32593,'secretAccessKey':_0x137d3c,'region':_0x46f9e8});_0x1a5bac[_0x3c93('0x9')]({'Text':_0x292096,'LanguageCode':_0x5577cf[_0x3c93('0xa')](0x0,0x2)},function(_0x26a613,_0x8848dd){if(_0x26a613){return _0x4a260d(_0x26a613);}else{return _0x4b5ba8(_0x8848dd);}});});}function checkTranscribeJob(_0x283ed8,_0x2d529c,_0xcb8253){var _0x2c0bce;return new BPromise(function(_0x328f4d,_0x106b0b){logger[_0x3c93('0xb')](util[_0x3c93('0xc')](_0x3c93('0xd'),_0x283ed8['id'],_0x283ed8[_0x3c93('0xe')]));return getTranscriptionJob(_0xcb8253[_0x3c93('0xf')],_0xcb8253['data2'],_0x2d529c['transcribeRegion'],_0x283ed8[_0x3c93('0xe')])[_0x3c93('0x10')](function(_0x95fc39){logger[_0x3c93('0xb')](util[_0x3c93('0xc')](_0x3c93('0x11'),_0x283ed8['id'],_0x283ed8[_0x3c93('0xe')],_0x95fc39['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x283ed8[_0x3c93('0x12')]){switch(_0x95fc39[_0x3c93('0x13')]['TranscriptionJobStatus']){case'COMPLETED':var _0x532973={'transcribeStatus':_0x95fc39[_0x3c93('0x13')]['TranscriptionJobStatus'],'fileUri':_0x95fc39['TranscriptionJob']['Transcript'][_0x3c93('0x14')]};logger[_0x3c93('0xb')](util[_0x3c93('0xc')](_0x3c93('0x15'),_0x283ed8['id']));return rp({'uri':_0x95fc39[_0x3c93('0x13')][_0x3c93('0x16')][_0x3c93('0x14')],'json':!![]})[_0x3c93('0x10')](function(_0x3207ac){logger[_0x3c93('0xb')](util['format'](_0x3c93('0x17'),_0x283ed8['id']));if(_0x3207ac&&_0x3207ac[_0x3c93('0x18')]&&_0x3207ac[_0x3c93('0x18')][_0x3c93('0x19')]&&_0x3207ac[_0x3c93('0x18')][_0x3c93('0x19')]['length']){_0x532973[_0x3c93('0x12')]='';for(var _0x3932f2=0x0;_0x3932f2<_0x3207ac[_0x3c93('0x18')][_0x3c93('0x19')][_0x3c93('0x1a')];_0x3932f2++){_0x532973[_0x3c93('0x12')]+=_0x3207ac[_0x3c93('0x18')][_0x3c93('0x19')][_0x3932f2][_0x3c93('0x1b')]+'';}}return _0x283ed8['update'](_0x532973);})[_0x3c93('0x10')](function(){logger[_0x3c93('0xb')](util[_0x3c93('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x283ed8['id']));if(!_0x283ed8[_0x3c93('0x1c')]){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x1f'));}if(!_0x2d529c['sentiment']||!_0x2d529c['sentimentAccountId']||!_0x2d529c['sentimentRegion']||!_0x2d529c[_0x3c93('0x20')]||!_0x2d529c[_0x3c93('0x21')]){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x532973[_0x3c93('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x2d529c['sentimentAccountId']===_0xcb8253['id']){return _0xcb8253;}else{return db[_0x3c93('0x22')][_0x3c93('0x23')]({'where':{'id':_settings[_0x3c93('0x24')]}});}})['then'](function(_0x8108f0){if(!_0x8108f0){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x8108f0[_0x3c93('0xf')]||!_0x8108f0[_0x3c93('0x25')]){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x26'));}_0x2c0bce=_0x8108f0;logger[_0x3c93('0xb')](util['format'](_0x3c93('0x27'),_0x283ed8['id']));return sentiment(_0x2c0bce[_0x3c93('0xf')],_0x2c0bce['data2'],_0x2d529c[_0x3c93('0x28')],_0x532973[_0x3c93('0x12')],_0x2d529c[_0x3c93('0x20')]);})['then'](function(_0xb07bc9){logger['info'](util[_0x3c93('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x283ed8['id']));return _0x283ed8[_0x3c93('0x29')]({'sentiment':_0xb07bc9[_0x3c93('0x2a')],'sPositive':_0xb07bc9[_0x3c93('0x2b')][_0x3c93('0x2c')],'sNegative':_0xb07bc9[_0x3c93('0x2b')][_0x3c93('0x2d')],'sMixed':_0xb07bc9['SentimentScore'][_0x3c93('0x2e')],'sNeutral':_0xb07bc9[_0x3c93('0x2b')][_0x3c93('0x2f')]});})[_0x3c93('0x10')](function(){logger[_0x3c93('0xb')](util[_0x3c93('0xc')](_0x3c93('0x30'),_0x283ed8['id']));_0x328f4d();});case'FAILED':return _0x283ed8[_0x3c93('0x29')]({'transcribeStatus':'FAILED','failureReason':_0x95fc39[_0x3c93('0x13')][_0x3c93('0x31')]})[_0x3c93('0x10')](function(){logger['info'](util[_0x3c93('0xc')](_0x3c93('0x30'),_0x283ed8['id']));_0x328f4d();});default:logger[_0x3c93('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x283ed8['id']));break;}}else{return BPromise[_0x3c93('0x32')]()['then'](function(){if(!_0x283ed8[_0x3c93('0x1c')]){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x1f'));}if(!_0x2d529c[_0x3c93('0x33')]||!_0x2d529c[_0x3c93('0x24')]||!_0x2d529c[_0x3c93('0x28')]||!_0x2d529c[_0x3c93('0x20')]||!_0x2d529c[_0x3c93('0x21')]){throw new db['Sequelize']['ValidationError'](_0x3c93('0x34'));}if(!_0x283ed8['fileText']){throw new Error(_0x3c93('0x35'));}if(_0x2d529c[_0x3c93('0x24')]===_0xcb8253['id']){return _0xcb8253;}else{return db[_0x3c93('0x22')]['findOne']({'where':{'id':_settings[_0x3c93('0x24')]}});}})[_0x3c93('0x10')](function(_0x45559d){if(!_0x45559d){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x36'));}if(!_0x45559d['data1']||!_0x45559d['data2']){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x26'));}_0x2c0bce=_0x45559d;logger[_0x3c93('0xb')](util[_0x3c93('0xc')](_0x3c93('0x27'),_0x283ed8['id']));return sentiment(_0x2c0bce[_0x3c93('0xf')],_0x2c0bce[_0x3c93('0x25')],_0x2d529c[_0x3c93('0x28')],_0x283ed8[_0x3c93('0x12')],_0x2d529c[_0x3c93('0x20')]);})[_0x3c93('0x10')](function(_0x45125f){logger[_0x3c93('0xb')](util[_0x3c93('0xc')](_0x3c93('0x37'),_0x283ed8['id']));return _0x283ed8[_0x3c93('0x29')]({'sentiment':_0x45125f[_0x3c93('0x2a')],'sPositive':_0x45125f[_0x3c93('0x2b')][_0x3c93('0x2c')],'sNegative':_0x45125f['SentimentScore']['Negative'],'sMixed':_0x45125f[_0x3c93('0x2b')][_0x3c93('0x2e')],'sNeutral':_0x45125f['SentimentScore'][_0x3c93('0x2f')],'transcribeStatus':_0x3c93('0x38')});})[_0x3c93('0x10')](function(){logger['info'](util[_0x3c93('0xc')](_0x3c93('0x30'),_0x283ed8['id']));_0x328f4d();});}})[_0x3c93('0x39')](function(_0x5478af){if(_0x5478af){if(!_0x5478af[_0x3c93('0x3a')]||_0x5478af['name']!==_0x3c93('0x3b')){logger['error'](util[_0x3c93('0xc')](_0x3c93('0x3c'),_0x283ed8['id']),util['inspect'](_0x5478af,{'showHidden':![],'depth':null}));}}_0x328f4d();});});}function checkTranscribe(){var _0x4086d1;var _0x427915;var _0x3ed520;return db[_0x3c93('0x3d')][_0x3c93('0x3e')]({'where':{'transcribeStatus':_0x3c93('0x3f')}})['then'](function(_0x2d8538){if(!_0x2d8538||!_0x2d8538[_0x3c93('0x1a')]){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x40'));}_0x4086d1=_0x2d8538;return db[_0x3c93('0x41')][_0x3c93('0x23')]({'where':{'id':0x1}});})[_0x3c93('0x10')](function(_0x3ddeb9){if(!_0x3ddeb9){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x42'));}_0x427915=_0x3ddeb9;if(!_0x427915[_0x3c93('0x6')]||!_0x427915[_0x3c93('0x43')]||!_0x427915['transcribeRegion']||!_0x427915['language']||!_0x427915[_0x3c93('0x21')]){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))]('Transcribe\x20not\x20configured');}return db[_0x3c93('0x22')][_0x3c93('0x23')]({'where':{'id':_0x427915[_0x3c93('0x43')]}});})[_0x3c93('0x10')](function(_0x2c6548){if(!_0x2c6548){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2c6548['data1']||!_0x2c6548['data2']){throw new db[(_0x3c93('0x1d'))][(_0x3c93('0x1e'))](_0x3c93('0x26'));}_0x3ed520=_0x2c6548;var _0x839baa=[];_0x4086d1[_0x3c93('0x44')](function(_0x599ce3){_0x839baa[_0x3c93('0x45')](checkTranscribeJob(_0x599ce3,_0x427915,_0x3ed520));});return BPromise[_0x3c93('0x46')](_0x839baa);})[_0x3c93('0x39')](function(_0x4d8cdc){if(_0x4d8cdc){if(!_0x4d8cdc['name']||_0x4d8cdc[_0x3c93('0x3a')]!==_0x3c93('0x3b')){logger[_0x3c93('0x47')](util['inspect'](_0x4d8cdc,{'showHidden':![],'depth':null}));}}});}exports[_0x3c93('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xefda=['push','catch','inspect','start','lodash','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','length','transcripts','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Transcript\x20not\x20available','ValidationError','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','Sentiment','Negative','name','SequelizeValidationError','error','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','CloudProvider','forEach'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0xefda,0x96));var _0xaefd=function(_0x4981e9,_0x2d8b39){_0x4981e9=_0x4981e9-0x0;var _0x3ea69b=_0xefda[_0x4981e9];return _0x3ea69b;};var _=require(_0xaefd('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0xaefd('0x1'));var BPromise=require(_0xaefd('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xaefd('0x3'))(_0xaefd('0x4'));function getTranscriptionJob(_0x2ade44,_0x22df24,_0x1ef6b4,_0x3288f9){return new Promise(function(_0x497258,_0x3677ea){var _0x3b9736=new AWS[(_0xaefd('0x5'))]({'accessKeyId':_0x22df24,'secretAccessKey':_0x2ade44,'region':_0x1ef6b4});_0x3b9736[_0xaefd('0x6')]({'TranscriptionJobName':_0x3288f9},function(_0x4ce248,_0x15193c){if(_0x4ce248){return _0x3677ea(_0x4ce248);}else{return _0x497258(_0x15193c);}});});}function sentiment(_0xbb04fb,_0x463ce7,_0x4d44ed,_0x48a255,_0x54a3b1){return new Promise(function(_0xa6239d,_0x16b36e){var _0x20135c=new AWS[(_0xaefd('0x7'))]({'accessKeyId':_0x463ce7,'secretAccessKey':_0xbb04fb,'region':_0x4d44ed});_0x20135c[_0xaefd('0x8')]({'Text':_0x48a255,'LanguageCode':_0x54a3b1[_0xaefd('0x9')](0x0,0x2)},function(_0x2ad4d9,_0x3dfddf){if(_0x2ad4d9){return _0x16b36e(_0x2ad4d9);}else{return _0xa6239d(_0x3dfddf);}});});}function checkTranscribeJob(_0x27be0f,_0x382983,_0x2a310c){var _0x4b2b5c;return new BPromise(function(_0x3172d3,_0x4ac467){logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0xc'),_0x27be0f['id'],_0x27be0f[_0xaefd('0xd')]));return getTranscriptionJob(_0x2a310c['data1'],_0x2a310c[_0xaefd('0xe')],_0x382983[_0xaefd('0xf')],_0x27be0f[_0xaefd('0xd')])[_0xaefd('0x10')](function(_0x10ee28){logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0x11'),_0x27be0f['id'],_0x27be0f['transcribeName'],_0x10ee28[_0xaefd('0x12')][_0xaefd('0x13')]));if(!_0x27be0f[_0xaefd('0x14')]){switch(_0x10ee28[_0xaefd('0x12')][_0xaefd('0x13')]){case _0xaefd('0x15'):var _0x516e84={'transcribeStatus':_0x10ee28[_0xaefd('0x12')][_0xaefd('0x13')],'fileUri':_0x10ee28[_0xaefd('0x12')][_0xaefd('0x16')][_0xaefd('0x17')]};logger[_0xaefd('0xa')](util['format'](_0xaefd('0x18'),_0x27be0f['id']));return rp({'uri':_0x10ee28[_0xaefd('0x12')][_0xaefd('0x16')][_0xaefd('0x17')],'json':!![]})[_0xaefd('0x10')](function(_0x577fb7){logger['info'](util['format'](_0xaefd('0x19'),_0x27be0f['id']));if(_0x577fb7&&_0x577fb7[_0xaefd('0x1a')]&&_0x577fb7[_0xaefd('0x1a')]['transcripts']&&_0x577fb7[_0xaefd('0x1a')]['transcripts'][_0xaefd('0x1b')]){_0x516e84[_0xaefd('0x14')]='';for(var _0x1a05eb=0x0;_0x1a05eb<_0x577fb7['results'][_0xaefd('0x1c')][_0xaefd('0x1b')];_0x1a05eb++){_0x516e84[_0xaefd('0x14')]+=_0x577fb7[_0xaefd('0x1a')][_0xaefd('0x1c')][_0x1a05eb]['transcript']+'';}}return _0x27be0f[_0xaefd('0x1d')](_0x516e84);})['then'](function(){logger[_0xaefd('0xa')](util[_0xaefd('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x27be0f['id']));if(!_0x27be0f[_0xaefd('0x1e')]){throw new db[(_0xaefd('0x1f'))]['ValidationError'](_0xaefd('0x20'));}if(!_0x382983[_0xaefd('0x21')]||!_0x382983[_0xaefd('0x22')]||!_0x382983['sentimentRegion']||!_0x382983[_0xaefd('0x23')]||!_0x382983['bucket']){throw new db[(_0xaefd('0x1f'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x516e84[_0xaefd('0x14')]){throw new Error(_0xaefd('0x24'));}if(_0x382983['sentimentAccountId']===_0x2a310c['id']){return _0x2a310c;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xaefd('0x22')]}});}})[_0xaefd('0x10')](function(_0x4b6910){if(!_0x4b6910){throw new db['Sequelize'][(_0xaefd('0x25'))](_0xaefd('0x26'));}if(!_0x4b6910[_0xaefd('0x27')]||!_0x4b6910[_0xaefd('0xe')]){throw new db['Sequelize'][(_0xaefd('0x25'))](_0xaefd('0x28'));}_0x4b2b5c=_0x4b6910;logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0x29'),_0x27be0f['id']));return sentiment(_0x4b2b5c[_0xaefd('0x27')],_0x4b2b5c[_0xaefd('0xe')],_0x382983[_0xaefd('0x2a')],_0x516e84[_0xaefd('0x14')],_0x382983[_0xaefd('0x23')]);})[_0xaefd('0x10')](function(_0x195571){logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0x2b'),_0x27be0f['id']));return _0x27be0f[_0xaefd('0x1d')]({'sentiment':_0x195571['Sentiment'],'sPositive':_0x195571[_0xaefd('0x2c')][_0xaefd('0x2d')],'sNegative':_0x195571[_0xaefd('0x2c')]['Negative'],'sMixed':_0x195571[_0xaefd('0x2c')]['Mixed'],'sNeutral':_0x195571[_0xaefd('0x2c')][_0xaefd('0x2e')]});})[_0xaefd('0x10')](function(){logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0x2f'),_0x27be0f['id']));_0x3172d3();});case _0xaefd('0x30'):return _0x27be0f[_0xaefd('0x1d')]({'transcribeStatus':_0xaefd('0x30'),'failureReason':_0x10ee28[_0xaefd('0x12')][_0xaefd('0x31')]})[_0xaefd('0x10')](function(){logger[_0xaefd('0xa')](util[_0xaefd('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x27be0f['id']));_0x3172d3();});default:logger[_0xaefd('0xa')](util['format'](_0xaefd('0x32'),_0x27be0f['id']));break;}}else{return BPromise[_0xaefd('0x33')]()[_0xaefd('0x10')](function(){if(!_0x27be0f[_0xaefd('0x1e')]){throw new db[(_0xaefd('0x1f'))][(_0xaefd('0x25'))](_0xaefd('0x20'));}if(!_0x382983[_0xaefd('0x21')]||!_0x382983[_0xaefd('0x22')]||!_0x382983[_0xaefd('0x2a')]||!_0x382983['language']||!_0x382983[_0xaefd('0x34')]){throw new db[(_0xaefd('0x1f'))]['ValidationError'](_0xaefd('0x35'));}if(!_0x27be0f[_0xaefd('0x14')]){throw new Error(_0xaefd('0x24'));}if(_0x382983['sentimentAccountId']===_0x2a310c['id']){return _0x2a310c;}else{return db['CloudProvider'][_0xaefd('0x36')]({'where':{'id':_settings[_0xaefd('0x22')]}});}})[_0xaefd('0x10')](function(_0x179648){if(!_0x179648){throw new db[(_0xaefd('0x1f'))][(_0xaefd('0x25'))](_0xaefd('0x26'));}if(!_0x179648[_0xaefd('0x27')]||!_0x179648['data2']){throw new db[(_0xaefd('0x1f'))][(_0xaefd('0x25'))](_0xaefd('0x28'));}_0x4b2b5c=_0x179648;logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0x29'),_0x27be0f['id']));return sentiment(_0x4b2b5c[_0xaefd('0x27')],_0x4b2b5c[_0xaefd('0xe')],_0x382983['sentimentRegion'],_0x27be0f['fileText'],_0x382983[_0xaefd('0x23')]);})[_0xaefd('0x10')](function(_0x532328){logger['info'](util[_0xaefd('0xb')](_0xaefd('0x2b'),_0x27be0f['id']));return _0x27be0f[_0xaefd('0x1d')]({'sentiment':_0x532328[_0xaefd('0x37')],'sPositive':_0x532328[_0xaefd('0x2c')][_0xaefd('0x2d')],'sNegative':_0x532328[_0xaefd('0x2c')][_0xaefd('0x38')],'sMixed':_0x532328[_0xaefd('0x2c')]['Mixed'],'sNeutral':_0x532328[_0xaefd('0x2c')][_0xaefd('0x2e')],'transcribeStatus':_0xaefd('0x15')});})[_0xaefd('0x10')](function(){logger[_0xaefd('0xa')](util[_0xaefd('0xb')](_0xaefd('0x2f'),_0x27be0f['id']));_0x3172d3();});}})['catch'](function(_0x20716c){if(_0x20716c){if(!_0x20716c['name']||_0x20716c[_0xaefd('0x39')]!==_0xaefd('0x3a')){logger[_0xaefd('0x3b')](util[_0xaefd('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x27be0f['id']),util['inspect'](_0x20716c,{'showHidden':![],'depth':null}));}}_0x3172d3();});});}function checkTranscribe(){var _0x1a73c5;var _0x34839e;var _0x179b8b;return db['VoiceRecording'][_0xaefd('0x3c')]({'where':{'transcribeStatus':_0xaefd('0x3d')}})['then'](function(_0x3deacd){if(!_0x3deacd||!_0x3deacd[_0xaefd('0x1b')]){throw new db[(_0xaefd('0x1f'))][(_0xaefd('0x25'))](_0xaefd('0x3e'));}_0x1a73c5=_0x3deacd;return db[_0xaefd('0x3f')][_0xaefd('0x36')]({'where':{'id':0x1}});})[_0xaefd('0x10')](function(_0x4dc674){if(!_0x4dc674){throw new db['Sequelize'][(_0xaefd('0x25'))](_0xaefd('0x40'));}_0x34839e=_0x4dc674;if(!_0x34839e['transcribe']||!_0x34839e[_0xaefd('0x41')]||!_0x34839e['transcribeRegion']||!_0x34839e[_0xaefd('0x23')]||!_0x34839e[_0xaefd('0x34')]){throw new db[(_0xaefd('0x1f'))][(_0xaefd('0x25'))](_0xaefd('0x42'));}return db[_0xaefd('0x43')]['findOne']({'where':{'id':_0x34839e['transcribeAccountId']}});})[_0xaefd('0x10')](function(_0x338823){if(!_0x338823){throw new db['Sequelize'][(_0xaefd('0x25'))](_0xaefd('0x26'));}if(!_0x338823[_0xaefd('0x27')]||!_0x338823[_0xaefd('0xe')]){throw new db['Sequelize']['ValidationError'](_0xaefd('0x28'));}_0x179b8b=_0x338823;var _0x41ef40=[];_0x1a73c5[_0xaefd('0x44')](function(_0x1fe44a){_0x41ef40[_0xaefd('0x45')](checkTranscribeJob(_0x1fe44a,_0x34839e,_0x179b8b));});return BPromise['all'](_0x41ef40);})[_0xaefd('0x46')](function(_0x3b6290){if(_0x3b6290){if(!_0x3b6290['name']||_0x3b6290[_0xaefd('0x39')]!==_0xaefd('0x3a')){logger['error'](util[_0xaefd('0x47')](_0x3b6290,{'showHidden':![],'depth':null}));}}});}exports[_0xaefd('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index da02dc4..8eda58a 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 _0x7b9b=['hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','system','format','YYYY-MM-DD\x20HH:mm:ss','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract'];(function(_0x2c6c95,_0x3e88d6){var _0x109f35=function(_0x1f02e3){while(--_0x1f02e3){_0x2c6c95['push'](_0x2c6c95['shift']());}};_0x109f35(++_0x3e88d6);}(_0x7b9b,0x72));var _0xb7b9=function(_0x18c382,_0x2e3eba){_0x18c382=_0x18c382-0x0;var _0x239b6f=_0x7b9b[_0x18c382];return _0x239b6f;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xb7b9('0x0'));var util=require(_0xb7b9('0x1'));var config=require(_0xb7b9('0x2'));var db=require(_0xb7b9('0x3'))['db'];var logger=require('../logger')(_0xb7b9('0x4'));config[_0xb7b9('0x5')]=_['defaults'](config[_0xb7b9('0x5')],{'host':_0xb7b9('0x6'),'port':0x18eb});var io=require(_0xb7b9('0x7'))(new Redis(config[_0xb7b9('0x5')]));function closeInteractions(){var _0x28854f=[];return db[_0xb7b9('0x8')][_0xb7b9('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb7b9('0xa')](0x18,_0xb7b9('0xb'))}}})[_0xb7b9('0xc')](function(_0x19c384){if(_0x19c384&&_0x19c384[_0xb7b9('0xd')]){_0x28854f=_['map'](_0x19c384||[],'id');logger[_0xb7b9('0xe')](_0xb7b9('0xf'),_0x28854f[_0xb7b9('0x10')]());return db[_0xb7b9('0x8')]['update']({'closeReason':_0xb7b9('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xb7b9('0x12')](_0xb7b9('0x13'))},{'where':{'id':_0x28854f}});}})[_0xb7b9('0xc')](function(){if(_0x28854f&&_0x28854f[_0xb7b9('0xd')]){logger['info']('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x28854f[_0xb7b9('0x10')]());for(var _0x433f48=0x0;_0x433f48<_0x28854f[_0xb7b9('0xd')];_0x433f48++){io['emit'](_0xb7b9('0x14'),{'id':_0x28854f[_0x433f48],'closed':!![]});}}})[_0xb7b9('0x15')](function(_0x388a64){logger['error'](_0xb7b9('0x16'),_0x388a64?util[_0xb7b9('0x17')](_0x388a64,{'showHidden':![],'depth':null}):'');});}exports[_0xb7b9('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6816=['emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','socket.io-emitter','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x6816,0x97));var _0x6681=function(_0x19bb59,_0x3e80f0){_0x19bb59=_0x19bb59-0x0;var _0x39cac3=_0x6816[_0x19bb59];return _0x39cac3;};'use strict';var _=require(_0x6681('0x0'));var moment=require(_0x6681('0x1'));var Redis=require(_0x6681('0x2'));var util=require(_0x6681('0x3'));var config=require(_0x6681('0x4'));var db=require(_0x6681('0x5'))['db'];var logger=require(_0x6681('0x6'))('schedule');config[_0x6681('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6681('0x8'))(new Redis(config[_0x6681('0x7')]));function closeInteractions(){var _0x541956=[];return db['WhatsappInteraction'][_0x6681('0x9')]({'raw':!![],'attributes':['id',_0x6681('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6681('0xb')](0x18,'hours')}}})[_0x6681('0xc')](function(_0x11fe53){if(_0x11fe53&&_0x11fe53[_0x6681('0xd')]){_0x541956=_[_0x6681('0xe')](_0x11fe53||[],'id');logger[_0x6681('0xf')](_0x6681('0x10'),_0x541956[_0x6681('0x11')]());return db['WhatsappInteraction'][_0x6681('0x12')]({'closeReason':_0x6681('0x13'),'disposition':_0x6681('0x14'),'closed':!![],'closedAt':moment()[_0x6681('0x15')](_0x6681('0x16'))},{'where':{'id':_0x541956}});}})[_0x6681('0xc')](function(){if(_0x541956&&_0x541956['length']){logger[_0x6681('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x541956[_0x6681('0x11')]());for(var _0x306a32=0x0;_0x306a32<_0x541956['length'];_0x306a32++){io[_0x6681('0x17')]('whatsappInteraction:update',{'id':_0x541956[_0x306a32],'closed':!![]});}}})[_0x6681('0x18')](function(_0x5d74a7){logger[_0x6681('0x19')](_0x6681('0x1a'),_0x5d74a7?util[_0x6681('0x1b')](_0x5d74a7,{'showHidden':![],'depth':null}):'');});}exports[_0x6681('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 6350cd2..4a32098 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f6=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','finished\x20populating','destroy','CmHopper','hopper1','contacts2','log','catch','util','../mysqldb'];(function(_0xb8b059,_0x453193){var _0x35e263=function(_0x57f8b6){while(--_0x57f8b6){_0xb8b059['push'](_0xb8b059['shift']());}};_0x35e263(++_0x453193);}(_0x95f6,0xa0));var _0x695f=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x95f6[_0x4ce028];return _0x583d0c;};'use strict';var util=require(_0x695f('0x0'));var db=require(_0x695f('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x695f('0x2')]({'id':i,'firstName':_0x695f('0x3')+i,'lastName':_0x695f('0x4')+i,'phone':0xf879fb460+i,'email':_0x695f('0x5')+i+_0x695f('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x695f('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x695f('0x2')]({'id':i,'firstName':_0x695f('0x3')+i,'lastName':_0x695f('0x4')+i,'phone':0xf879fb460+i,'email':_0x695f('0x5')+i+_0x695f('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x695f('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x695f('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x695f('0x7')](),'updatedAt':Date[_0x695f('0x7')]()});}db[_0x695f('0x8')]['destroy']({'where':{}})[_0x695f('0x9')](function(){return db['CmContact'][_0x695f('0xa')](contacts);})[_0x695f('0x9')](function(){console['log'](_0x695f('0xb'),'contacts1');return db['CmHopper'][_0x695f('0xc')]({'where':{}});})[_0x695f('0x9')](function(){return db[_0x695f('0xd')][_0x695f('0xa')](hopper);})['then'](function(){console['log'](_0x695f('0xb'),_0x695f('0xe'));return db[_0x695f('0x8')][_0x695f('0xa')](contacts2);})[_0x695f('0x9')](function(){console['log']('finished\x20populating',_0x695f('0xf'));return db[_0x695f('0xd')][_0x695f('0xa')](hopper2);})[_0x695f('0x9')](function(){console[_0x695f('0x10')](_0x695f('0xb'),'hopper2');})[_0x695f('0x11')](function(_0x35f5f2){console[_0x695f('0x10')](_0x35f5f2);}); \ No newline at end of file +var _0xb58c=['contacts1','CmHopper','hopper1','contacts2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','push','now','Biondo','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating'];(function(_0x5cb5cd,_0x6d4a7b){var _0x59caa6=function(_0x39bb7f){while(--_0x39bb7f){_0x5cb5cd['push'](_0x5cb5cd['shift']());}};_0x59caa6(++_0x6d4a7b);}(_0xb58c,0x122));var _0xcb58=function(_0x1b00f1,_0x15ffa8){_0x1b00f1=_0x1b00f1-0x0;var _0x5c3dad=_0xb58c[_0x1b00f1];return _0x5c3dad;};'use strict';var util=require(_0xcb58('0x0'));var db=require(_0xcb58('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xcb58('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xcb58('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xcb58('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xcb58('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xcb58('0x5')](),'updatedAt':Date[_0xcb58('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xcb58('0x4')]({'id':i,'firstName':_0xcb58('0x2')+i,'lastName':_0xcb58('0x6')+i,'phone':0xf879fb460+i,'email':_0xcb58('0x3')+i+_0xcb58('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xcb58('0x4')]({'id':i,'active':![],'scheduledat':Date[_0xcb58('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xcb58('0x5')]()});}db[_0xcb58('0x8')][_0xcb58('0x9')]({'where':{}})[_0xcb58('0xa')](function(){return db['CmContact'][_0xcb58('0xb')](contacts);})[_0xcb58('0xa')](function(){console[_0xcb58('0xc')](_0xcb58('0xd'),_0xcb58('0xe'));return db['CmHopper'][_0xcb58('0x9')]({'where':{}});})['then'](function(){return db[_0xcb58('0xf')]['bulkCreate'](hopper);})['then'](function(){console[_0xcb58('0xc')](_0xcb58('0xd'),_0xcb58('0x10'));return db[_0xcb58('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0xcb58('0xc')](_0xcb58('0xd'),_0xcb58('0x11'));return db[_0xcb58('0xf')]['bulkCreate'](hopper2);})[_0xcb58('0xa')](function(){console[_0xcb58('0xc')]('finished\x20populating','hopper2');})[_0xcb58('0x12')](function(_0x54f457){console[_0xcb58('0xc')](_0x54f457);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4c15613..02ba79a 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f08=['add\x20user','util','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','log'];(function(_0x23f387,_0x4ce4ad){var _0x30d52b=function(_0x545dd1){while(--_0x545dd1){_0x23f387['push'](_0x23f387['shift']());}};_0x30d52b(++_0x4ce4ad);}(_0x4f08,0x1ef));var _0x84f0=function(_0x873098,_0x352d42){_0x873098=_0x873098-0x0;var _0x24c0d9=_0x4f08[_0x873098];return _0x24c0d9;};'use strict';var util=require(_0x84f0('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x84f0('0x1')]({'name':util[_0x84f0('0x2')](_0x84f0('0x3'),_0x84f0('0x4'),i),'fullname':util[_0x84f0('0x2')](_0x84f0('0x3'),_0x84f0('0x4'),i),'email':util['format']('%s%s@xcally.com','agent',i),'role':'agent','password':_0x84f0('0x5'),'internal':0xfa0+i,'type':_0x84f0('0x6'),'transport':[_0x84f0('0x7'),'ws',_0x84f0('0x8')],'disallow':[_0x84f0('0x9')],'allow':[_0x84f0('0xa')],'defaultuser':util[_0x84f0('0x2')]('%s%s',_0x84f0('0x4'),i),'encryption':'yes','avpf':_0x84f0('0xb'),'force_avp':_0x84f0('0xb'),'icesupport':'yes','dtlsenable':_0x84f0('0xb'),'dtlsverify':'no','dtlscertfile':_0x84f0('0xc'),'dtlsprivatekey':_0x84f0('0xd'),'dtlssetup':_0x84f0('0xe'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x84f0('0x2')](_0x84f0('0x3'),_0x84f0('0x4'),i),0xfa0+i)});}db[_0x84f0('0xf')][_0x84f0('0x10')](users)['then'](function(){console[_0x84f0('0x11')](_0x84f0('0x12'));})['catch'](function(_0x3ccaf3){console[_0x84f0('0x11')](_0x3ccaf3);}); \ No newline at end of file +var _0x37f7=['format','%s%s','agent','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','User','bulkCreate','catch','log','push'];(function(_0xd94071,_0x44e2be){var _0x58a109=function(_0x7c5972){while(--_0x7c5972){_0xd94071['push'](_0xd94071['shift']());}};_0x58a109(++_0x44e2be);}(_0x37f7,0x167));var _0x737f=function(_0x14dc9a,_0x3d4c0d){_0x14dc9a=_0x14dc9a-0x0;var _0x2626ba=_0x37f7[_0x14dc9a];return _0x2626ba;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x737f('0x0')]({'name':util[_0x737f('0x1')](_0x737f('0x2'),'agent',i),'fullname':util[_0x737f('0x1')](_0x737f('0x2'),_0x737f('0x3'),i),'email':util[_0x737f('0x1')]('%s%s@xcally.com',_0x737f('0x3'),i),'role':_0x737f('0x3'),'password':'password','internal':0xfa0+i,'type':_0x737f('0x4'),'transport':[_0x737f('0x5'),'ws',_0x737f('0x6')],'disallow':[_0x737f('0x7')],'allow':[_0x737f('0x8')],'defaultuser':util[_0x737f('0x1')]('%s%s','agent',i),'encryption':_0x737f('0x9'),'avpf':_0x737f('0x9'),'force_avp':'yes','icesupport':_0x737f('0x9'),'dtlsenable':_0x737f('0x9'),'dtlsverify':'no','dtlscertfile':_0x737f('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x737f('0x1')](_0x737f('0x2'),_0x737f('0x3'),i),0xfa0+i)});}db[_0x737f('0xb')][_0x737f('0xc')](users)['then'](function(){console['log']('add\x20user');})[_0x737f('0xd')](function(_0x3a0489){console[_0x737f('0xe')](_0x3a0489);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 961c5b9..29e0556 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2da6=['MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','Trunk','Campaign','user','voice:outbound','SmsQueues','MailQueue','OpenchannelQueue','WhatsappQueue','Trunks','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','format','%s:queue:%s','length','user:%s','find','userProfileId','query','ChatInteraction'];(function(_0x2e61f5,_0x521184){var _0x573180=function(_0x282526){while(--_0x282526){_0x2e61f5['push'](_0x2e61f5['shift']());}};_0x573180(++_0x521184);}(_0x2da6,0x1dd));var _0x62da=function(_0x1b1d15,_0x5e8655){_0x1b1d15=_0x1b1d15-0x0;var _0x45d2fd=_0x2da6[_0x1b1d15];return _0x45d2fd;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var BPromise=require(_0x62da('0x2'));var db=require(_0x62da('0x3'))['db'];var config=require(_0x62da('0x4'));var queryQueues={'attributes':['id',_0x62da('0x5')],'include':[{'as':_0x62da('0x6'),'model':db[_0x62da('0x7')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x62da('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x62da('0x5')],'where':{'role':_0x62da('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x62da('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x62da('0x5')],'where':{'role':_0x62da('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x62da('0x5'),_0x62da('0xa')],'where':{'type':_0x62da('0xb')}};function getAssociatedResources(_0x4cfc5d,_0x19b866,_0x2a3937){return db[_0x62da('0xc')][_0x62da('0xd')]({'where':{'name':_0x4cfc5d,'userProfileId':_0x19b866},'raw':!![]})['then'](function(_0x241090){if(_0x241090){if(_0x241090[_0x62da('0xe')]){switch(_0x4cfc5d){case _0x62da('0xf'):case _0x62da('0x10'):case _0x62da('0x11'):case'SmsQueues':case _0x62da('0x12'):case _0x62da('0x13'):case _0x62da('0x14'):return db[_0x2a3937][_0x62da('0x15')](queryQueues);case _0x62da('0x16'):return db[_0x2a3937]['findAll'](queryTelephones);case'Trunks':return db[_0x2a3937][_0x62da('0x15')](queryTrunks);case _0x62da('0x17'):return db[_0x2a3937][_0x62da('0x15')](queryCampaigns);}}else{return db[_0x62da('0x18')][_0x62da('0x15')]({'attributes':[_0x62da('0x19')],'where':{'sectionId':_0x241090['id']},'raw':!![]})[_0x62da('0x1a')](function(_0x624a1c){if(_0x624a1c){var _0x2cbdf6={'where':{'id':_[_0x62da('0x1b')](_0x624a1c,_0x62da('0x19'))},'raw':!![]};switch(_0x2a3937){case _0x62da('0x7'):_0x2cbdf6[_0x62da('0x1c')][_0x62da('0x1d')]='telephone';break;case'Campaign':_0x2cbdf6[_0x62da('0x1c')]['type']=_0x62da('0xb');break;}return db[_0x2a3937][_0x62da('0x15')](_0x2cbdf6);}else{return[];}});}}else{return[];}})[_0x62da('0x1a')](function(_0x4feaec){return _0x4feaec;});}function joinOrLeaveQueues(_0x29191b,_0x481db6,_0x2e6b7e,_0x37c15d){_0x29191b[_0x481db6](util[_0x62da('0x1e')](_0x62da('0x1f'),_0x2e6b7e,_0x37c15d[_0x62da('0x5')]));if(_0x37c15d[_0x62da('0x6')]){for(var _0x183033=0x0;_0x183033<_0x37c15d[_0x62da('0x6')][_0x62da('0x20')];_0x183033+=0x1){_0x29191b[_0x481db6](util['format'](_0x62da('0x21'),_0x37c15d[_0x62da('0x6')][_0x183033][_0x62da('0x5')]));}}}function joinOrLeave(_0x1f6f96,_0x35f687,_0x54b936){var _0x24298a;if(_0x1f6f96['handshake']['query']['id']){db['User'][_0x62da('0x22')]({'attributes':['id',_0x62da('0x5'),_0x62da('0x1d'),_0x62da('0x23')],'where':{'id':_0x1f6f96['handshake'][_0x62da('0x24')]['id']},'include':[{'model':db[_0x62da('0x25')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x62da('0x26')],'as':_0x62da('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x62da('0x28')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x62da('0x29')],'as':_0x62da('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x62da('0x2b')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x62da('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x62da('0x1a')](function(_0x220ffc){if(_0x220ffc){_0x24298a=_0x220ffc;_0x1f6f96[_0x35f687](util['format'](_0x62da('0x21'),_0x220ffc[_0x62da('0x5')]));var _0x3f253c=[];switch(_0x220ffc[_0x62da('0x1d')]){case _0x62da('0x2d'):_0x1f6f96[_0x35f687](_0x62da('0x2e'));_0x1f6f96[_0x35f687]('voice:outbound');if(queryQueues[_0x62da('0x2f')]('include')){delete queryQueues[_0x62da('0x30')];}_0x3f253c[_0x62da('0x31')](db[_0x62da('0x32')][_0x62da('0x15')](queryQueues));_0x3f253c[_0x62da('0x31')](db[_0x62da('0x33')]['findAll'](queryQueues));_0x3f253c[_0x62da('0x31')](db[_0x62da('0x34')][_0x62da('0x15')](queryQueues));_0x3f253c['push'](db[_0x62da('0x35')][_0x62da('0x15')](queryQueues));_0x3f253c[_0x62da('0x31')](db['MailQueue'][_0x62da('0x15')](queryQueues));_0x3f253c[_0x62da('0x31')](db['OpenchannelQueue'][_0x62da('0x15')](queryQueues));_0x3f253c[_0x62da('0x31')](db['WhatsappQueue'][_0x62da('0x15')](queryQueues));_0x3f253c[_0x62da('0x31')](db[_0x62da('0x7')][_0x62da('0x15')](queryTelephones));_0x3f253c[_0x62da('0x31')](db[_0x62da('0x36')][_0x62da('0x15')](queryTrunks));_0x3f253c[_0x62da('0x31')](db[_0x62da('0x37')][_0x62da('0x15')](queryCampaigns));_0x3f253c[_0x62da('0x31')](db[_0x62da('0x7')][_0x62da('0x15')](queryAgents));break;case _0x62da('0x38'):_0x1f6f96[_0x35f687](_0x62da('0x2e'));_0x1f6f96[_0x35f687](_0x62da('0x39'));_0x3f253c[_0x62da('0x31')](getAssociatedResources('VoiceQueues',_0x220ffc[_0x62da('0x23')],'VoiceQueue'));_0x3f253c[_0x62da('0x31')](getAssociatedResources(_0x62da('0x10'),_0x220ffc[_0x62da('0x23')],'ChatQueue'));_0x3f253c[_0x62da('0x31')](getAssociatedResources(_0x62da('0x11'),_0x220ffc[_0x62da('0x23')],_0x62da('0x34')));_0x3f253c['push'](getAssociatedResources(_0x62da('0x3a'),_0x220ffc[_0x62da('0x23')],_0x62da('0x35')));_0x3f253c[_0x62da('0x31')](getAssociatedResources(_0x62da('0x12'),_0x220ffc[_0x62da('0x23')],_0x62da('0x3b')));_0x3f253c[_0x62da('0x31')](getAssociatedResources(_0x62da('0x13'),_0x220ffc['userProfileId'],_0x62da('0x3c')));_0x3f253c[_0x62da('0x31')](getAssociatedResources('WhatsappQueues',_0x220ffc[_0x62da('0x23')],_0x62da('0x3d')));_0x3f253c[_0x62da('0x31')](getAssociatedResources(_0x62da('0x16'),_0x220ffc[_0x62da('0x23')],_0x62da('0x7')));_0x3f253c[_0x62da('0x31')](getAssociatedResources(_0x62da('0x3e'),_0x220ffc['userProfileId'],'Trunk'));_0x3f253c['push'](getAssociatedResources(_0x62da('0x17'),_0x220ffc['userProfileId'],_0x62da('0x37')));_0x3f253c['push'](db['User']['findAll'](queryAgents));break;case _0x62da('0x8'):_0x1f6f96[_0x35f687](_0x62da('0x2e'));_0x1f6f96[_0x35f687]('voice:outbound');_0x3f253c[_0x62da('0x31')](_0x220ffc['getVoiceQueues']({'attributes':['id',_0x62da('0x5')]}));_0x3f253c['push'](_0x220ffc['getChatQueues']({'attributes':['id',_0x62da('0x5')]}));_0x3f253c[_0x62da('0x31')](_0x220ffc[_0x62da('0x3f')]({'attributes':['id','name']}));_0x3f253c[_0x62da('0x31')](_0x220ffc[_0x62da('0x40')]({'attributes':['id',_0x62da('0x5')]}));_0x3f253c[_0x62da('0x31')](_0x220ffc[_0x62da('0x41')]({'attributes':['id','name']}));_0x3f253c['push'](_0x220ffc[_0x62da('0x42')]({'attributes':['id',_0x62da('0x5')]}));_0x3f253c[_0x62da('0x31')](_0x220ffc[_0x62da('0x43')]({'attributes':['id',_0x62da('0x5')]}));break;}return BPromise['all'](_0x3f253c);}})['then'](function(_0x1de958){if(_0x1de958&&_0x1de958[_0x62da('0x20')]){for(var _0x4ce46c=0x0;_0x4ce46c<_0x1de958[_0x62da('0x20')];_0x4ce46c+=0x1){for(var _0x155afd=0x0;_0x155afd<_0x1de958[_0x4ce46c][_0x62da('0x20')];_0x155afd+=0x1){switch(_0x4ce46c){case 0x0:joinOrLeaveQueues(_0x1f6f96,_0x35f687,_0x62da('0x44'),_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x1:joinOrLeaveQueues(_0x1f6f96,_0x35f687,_0x62da('0x45'),_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x2:joinOrLeaveQueues(_0x1f6f96,_0x35f687,'fax',_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x3:joinOrLeaveQueues(_0x1f6f96,_0x35f687,_0x62da('0x46'),_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x4:joinOrLeaveQueues(_0x1f6f96,_0x35f687,_0x62da('0x47'),_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x5:joinOrLeaveQueues(_0x1f6f96,_0x35f687,_0x62da('0x48'),_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x6:joinOrLeaveQueues(_0x1f6f96,_0x35f687,_0x62da('0x49'),_0x1de958[_0x4ce46c][_0x155afd]);break;case 0x7:if(_0x24298a[_0x62da('0x1d')]!==_0x62da('0x8'))_0x1f6f96[_0x35f687](util[_0x62da('0x1e')](_0x62da('0x4a'),_0x1de958[_0x4ce46c][_0x155afd][_0x62da('0x5')]));break;case 0x8:if(_0x24298a['role']!==_0x62da('0x8'))_0x1f6f96[_0x35f687](util[_0x62da('0x1e')]('trunk:%s',_0x1de958[_0x4ce46c][_0x155afd]['name']));break;case 0x9:if(_0x24298a['role']!==_0x62da('0x8'))_0x1f6f96[_0x35f687](util[_0x62da('0x1e')](_0x62da('0x4b'),_0x1de958[_0x4ce46c][_0x155afd]['type'],_0x1de958[_0x4ce46c][_0x155afd][_0x62da('0x5')]));break;case 0xa:_0x1f6f96[_0x35f687](util[_0x62da('0x1e')](_0x62da('0x21'),_0x1de958[_0x4ce46c][_0x155afd]['name']));break;}}}}})[_0x62da('0x1a')](function(){if(_0x35f687===_0x62da('0x4c')){var _0x227d40=_[_0x62da('0x1b')](_0x24298a['ChatInteractions'],'id');return _0x24298a[_0x62da('0x4d')](_0x227d40)[_0x62da('0x1a')](function(){for(var _0x1a9a5d=0x0;_0x1a9a5d<_0x227d40[_0x62da('0x20')];_0x1a9a5d+=0x1){_0x54b936[_0x62da('0x4e')](_0x62da('0x4f'),{'ChatInteractionId':Number(_0x227d40[_0x1a9a5d]),'UserId':Number(_0x24298a['id'])});}});}})[_0x62da('0x1a')](function(){if(_0x35f687===_0x62da('0x4c')){var _0x1a5621=_['map'](_0x24298a['MailInteractions'],'id');return _0x24298a[_0x62da('0x50')](_0x1a5621)['then'](function(){for(var _0x53eb44=0x0;_0x53eb44<_0x1a5621['length'];_0x53eb44+=0x1){_0x54b936[_0x62da('0x4e')](_0x62da('0x51'),{'MailInteractionId':Number(_0x1a5621[_0x53eb44]),'UserId':Number(_0x24298a['id'])});}});}})[_0x62da('0x1a')](function(){if(_0x35f687==='leave'){var _0x3274f2=_[_0x62da('0x1b')](_0x24298a[_0x62da('0x52')],'id');return _0x24298a[_0x62da('0x53')](_0x3274f2)['then'](function(){for(var _0x1cb3b2=0x0;_0x1cb3b2<_0x3274f2[_0x62da('0x20')];_0x1cb3b2+=0x1){_0x54b936[_0x62da('0x4e')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x3274f2[_0x1cb3b2]),'UserId':Number(_0x24298a['id'])});}});}})[_0x62da('0x1a')](function(){if(_0x35f687==='leave'){var _0xba9ae0=_['map'](_0x24298a[_0x62da('0x2a')],'id');return _0x24298a[_0x62da('0x54')](_0xba9ae0)[_0x62da('0x1a')](function(){for(var _0x106583=0x0;_0x106583<_0xba9ae0[_0x62da('0x20')];_0x106583+=0x1){_0x54b936[_0x62da('0x4e')](_0x62da('0x55'),{'SmsInteractionId':Number(_0xba9ae0[_0x106583]),'UserId':Number(_0x24298a['id'])});}});}})['then'](function(){if(_0x35f687===_0x62da('0x4c')){var _0x2c5a57=_['map'](_0x24298a['OpenchannelInteractions'],'id');return _0x24298a[_0x62da('0x56')](_0x2c5a57)['then'](function(){for(var _0x5c7f93=0x0;_0x5c7f93<_0x2c5a57[_0x62da('0x20')];_0x5c7f93+=0x1){_0x54b936[_0x62da('0x4e')](_0x62da('0x57'),{'OpenchannelInteractionId':Number(_0x2c5a57[_0x5c7f93]),'UserId':Number(_0x24298a['id'])});}});}})[_0x62da('0x1a')](function(){if(_0x35f687===_0x62da('0x4c')){var _0x1fff12=_[_0x62da('0x1b')](_0x24298a[_0x62da('0x2c')],'id');return _0x24298a[_0x62da('0x58')](_0x1fff12)[_0x62da('0x1a')](function(){for(var _0x3abdd3=0x0;_0x3abdd3<_0x1fff12['length'];_0x3abdd3+=0x1){_0x54b936['emit'](_0x62da('0x59'),{'WhatsappInteractionId':Number(_0x1fff12[_0x3abdd3]),'UserId':Number(_0x24298a['id'])});}});}})[_0x62da('0x5a')](function(_0x4b80dc){_0x1f6f96[_0x62da('0x5b')](_0x4b80dc);});}}function onDisconnect(_0x3d6e37,_0x4fc966){joinOrLeave(_0x3d6e37,'leave',_0x4fc966);}function onConnect(_0x54f527){joinOrLeave(_0x54f527,_0x62da('0x5c'));}exports[_0x62da('0x5d')]=function(_0x505b32){_0x505b32['on'](_0x62da('0x5e'),function(_0x48ab1a){_0x48ab1a[_0x62da('0x5f')](0x0);_0x48ab1a[_0x62da('0x60')]=_0x48ab1a[_0x62da('0x61')][_0x62da('0x5e')][_0x62da('0x62')]+':'+_0x48ab1a['request']['connection'][_0x62da('0x63')];_0x48ab1a['connectedAt']=new Date();_0x48ab1a[_0x62da('0x5b')]=function(_0x2535f4){console['log'](_0x62da('0x64')+_0x48ab1a['nsp']['name']+'['+_0x48ab1a['address']+']',_0x2535f4);};_0x48ab1a['on']('disconnect',function(){onDisconnect(_0x48ab1a,_0x505b32);_0x48ab1a[_0x62da('0x5b')](_0x62da('0x65'));});onConnect(_0x48ab1a);_0x48ab1a[_0x62da('0x5b')](_0x62da('0x66'));});}; \ No newline at end of file +var _0x414f=['ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','type','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','telephone','Campaign','where','%s:queue:%s','length','format','user:%s','handshake','query','find','userProfileId','ChatInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','ChatQueues','ChatQueue','FaxQueues','FaxQueue','OpenchannelQueue','Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','leave'];(function(_0x1a1bcb,_0x1ba00c){var _0x461f5a=function(_0x4935bf){while(--_0x4935bf){_0x1a1bcb['push'](_0x1a1bcb['shift']());}};_0x461f5a(++_0x1ba00c);}(_0x414f,0x13f));var _0xf414=function(_0x51af96,_0x42104c){_0x51af96=_0x51af96-0x0;var _0x2bb16b=_0x414f[_0x51af96];return _0x2bb16b;};'use strict';var _=require(_0xf414('0x0'));var util=require('util');var BPromise=require(_0xf414('0x1'));var db=require(_0xf414('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xf414('0x3')],'include':[{'as':_0xf414('0x4'),'model':db[_0xf414('0x5')],'attributes':['id',_0xf414('0x3'),_0xf414('0x6')],'raw':!![],'where':{'role':_0xf414('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf414('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf414('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf414('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf414('0x3'),_0xf414('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4e69bd,_0x26a409,_0x2bbf01){return db[_0xf414('0x9')][_0xf414('0xa')]({'where':{'name':_0x4e69bd,'userProfileId':_0x26a409},'raw':!![]})[_0xf414('0xb')](function(_0x44648f){if(_0x44648f){if(_0x44648f[_0xf414('0xc')]){switch(_0x4e69bd){case _0xf414('0xd'):case'ChatQueues':case'FaxQueues':case _0xf414('0xe'):case _0xf414('0xf'):case _0xf414('0x10'):case _0xf414('0x11'):return db[_0x2bbf01][_0xf414('0x12')](queryQueues);case'Telephones':return db[_0x2bbf01][_0xf414('0x12')](queryTelephones);case _0xf414('0x13'):return db[_0x2bbf01][_0xf414('0x12')](queryTrunks);case _0xf414('0x14'):return db[_0x2bbf01][_0xf414('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0xf414('0x12')]({'attributes':[_0xf414('0x15')],'where':{'sectionId':_0x44648f['id']},'raw':!![]})[_0xf414('0xb')](function(_0x706d2e){if(_0x706d2e){var _0x4d3021={'where':{'id':_[_0xf414('0x16')](_0x706d2e,_0xf414('0x15'))},'raw':!![]};switch(_0x2bbf01){case _0xf414('0x5'):_0x4d3021['where'][_0xf414('0x6')]=_0xf414('0x17');break;case _0xf414('0x18'):_0x4d3021[_0xf414('0x19')][_0xf414('0x8')]='ivr';break;}return db[_0x2bbf01][_0xf414('0x12')](_0x4d3021);}else{return[];}});}}else{return[];}})['then'](function(_0x5ede89){return _0x5ede89;});}function joinOrLeaveQueues(_0x24b65e,_0x44b829,_0x572605,_0x49249b){_0x24b65e[_0x44b829](util['format'](_0xf414('0x1a'),_0x572605,_0x49249b[_0xf414('0x3')]));if(_0x49249b[_0xf414('0x4')]){for(var _0x417af1=0x0;_0x417af1<_0x49249b[_0xf414('0x4')][_0xf414('0x1b')];_0x417af1+=0x1){_0x24b65e[_0x44b829](util[_0xf414('0x1c')](_0xf414('0x1d'),_0x49249b[_0xf414('0x4')][_0x417af1]['name']));}}}function joinOrLeave(_0xcde327,_0x3ae2a0,_0x236504){var _0x4999e4;if(_0xcde327[_0xf414('0x1e')][_0xf414('0x1f')]['id']){db[_0xf414('0x5')][_0xf414('0x20')]({'attributes':['id',_0xf414('0x3'),_0xf414('0x6'),_0xf414('0x21')],'where':{'id':_0xcde327[_0xf414('0x1e')]['query']['id']},'include':[{'model':db[_0xf414('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf414('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x24')],'as':_0xf414('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x26')],'as':_0xf414('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf414('0x28')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xf414('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf414('0xb')](function(_0x209790){if(_0x209790){_0x4999e4=_0x209790;_0xcde327[_0x3ae2a0](util['format'](_0xf414('0x1d'),_0x209790['name']));var _0x485afe=[];switch(_0x209790[_0xf414('0x6')]){case _0xf414('0x2a'):_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xf414('0x2c'))){delete queryQueues['include'];}_0x485afe[_0xf414('0x2d')](db[_0xf414('0x2e')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db['ChatQueue'][_0xf414('0x12')](queryQueues));_0x485afe['push'](db['FaxQueue'][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x2f')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x30')][_0xf414('0x12')](queryQueues));_0x485afe[_0xf414('0x2d')](db['OpenchannelQueue']['findAll'](queryQueues));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x31')][_0xf414('0x12')](queryQueues));_0x485afe['push'](db['User'][_0xf414('0x12')](queryTelephones));_0x485afe['push'](db[_0xf414('0x32')]['findAll'](queryTrunks));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x18')]['findAll'](queryCampaigns));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x5')][_0xf414('0x12')](queryAgents));break;case'user':_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0](_0xf414('0x33'));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xd'),_0x209790[_0xf414('0x21')],_0xf414('0x2e')));_0x485afe['push'](getAssociatedResources(_0xf414('0x34'),_0x209790[_0xf414('0x21')],_0xf414('0x35')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x36'),_0x209790[_0xf414('0x21')],_0xf414('0x37')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xe'),_0x209790['userProfileId'],_0xf414('0x2f')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0xf'),_0x209790[_0xf414('0x21')],_0xf414('0x30')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x10'),_0x209790[_0xf414('0x21')],_0xf414('0x38')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x11'),_0x209790[_0xf414('0x21')],_0xf414('0x31')));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x39'),_0x209790[_0xf414('0x21')],_0xf414('0x5')));_0x485afe['push'](getAssociatedResources(_0xf414('0x13'),_0x209790[_0xf414('0x21')],'Trunk'));_0x485afe[_0xf414('0x2d')](getAssociatedResources(_0xf414('0x14'),_0x209790['userProfileId'],_0xf414('0x18')));_0x485afe[_0xf414('0x2d')](db[_0xf414('0x5')][_0xf414('0x12')](queryAgents));break;case _0xf414('0x7'):_0xcde327[_0x3ae2a0](_0xf414('0x2b'));_0xcde327[_0x3ae2a0](_0xf414('0x33'));_0x485afe['push'](_0x209790[_0xf414('0x3a')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3b')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3c')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790['getSmsQueues']({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790[_0xf414('0x3d')]({'attributes':['id',_0xf414('0x3')]}));_0x485afe['push'](_0x209790['getOpenchannelQueues']({'attributes':['id',_0xf414('0x3')]}));_0x485afe[_0xf414('0x2d')](_0x209790['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0xf414('0x3e')](_0x485afe);}})[_0xf414('0xb')](function(_0x33c42d){if(_0x33c42d&&_0x33c42d[_0xf414('0x1b')]){for(var _0x1e7e28=0x0;_0x1e7e28<_0x33c42d[_0xf414('0x1b')];_0x1e7e28+=0x1){for(var _0x8754a1=0x0;_0x8754a1<_0x33c42d[_0x1e7e28][_0xf414('0x1b')];_0x8754a1+=0x1){switch(_0x1e7e28){case 0x0:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x3f'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x1:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x40'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x2:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x41'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x3:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x42'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x4:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x43'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x5:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x44'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x6:joinOrLeaveQueues(_0xcde327,_0x3ae2a0,_0xf414('0x45'),_0x33c42d[_0x1e7e28][_0x8754a1]);break;case 0x7:if(_0x4999e4[_0xf414('0x6')]!=='agent')_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x46'),_0x33c42d[_0x1e7e28][_0x8754a1]['name']));break;case 0x8:if(_0x4999e4[_0xf414('0x6')]!==_0xf414('0x7'))_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x47'),_0x33c42d[_0x1e7e28][_0x8754a1][_0xf414('0x3')]));break;case 0x9:if(_0x4999e4[_0xf414('0x6')]!=='agent')_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')]('campaign:%s:%s',_0x33c42d[_0x1e7e28][_0x8754a1]['type'],_0x33c42d[_0x1e7e28][_0x8754a1][_0xf414('0x3')]));break;case 0xa:_0xcde327[_0x3ae2a0](util[_0xf414('0x1c')](_0xf414('0x1d'),_0x33c42d[_0x1e7e28][_0x8754a1]['name']));break;}}}}})[_0xf414('0xb')](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x20319f=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x49')],'id');return _0x4999e4[_0xf414('0x4a')](_0x20319f)['then'](function(){for(var _0x1f0324=0x0;_0x1f0324<_0x20319f['length'];_0x1f0324+=0x1){_0x236504['emit'](_0xf414('0x4b'),{'ChatInteractionId':Number(_0x20319f[_0x1f0324]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x5ceccb=_['map'](_0x4999e4['MailInteractions'],'id');return _0x4999e4[_0xf414('0x4c')](_0x5ceccb)[_0xf414('0xb')](function(){for(var _0x22d341=0x0;_0x22d341<_0x5ceccb['length'];_0x22d341+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x4e'),{'MailInteractionId':Number(_0x5ceccb[_0x22d341]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x5061cc=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x25')],'id');return _0x4999e4['removeFaxInteractions'](_0x5061cc)[_0xf414('0xb')](function(){for(var _0x3f1555=0x0;_0x3f1555<_0x5061cc['length'];_0x3f1555+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x4f'),{'FaxInteractionId':Number(_0x5061cc[_0x3f1555]),'UserId':Number(_0x4999e4['id'])});}});}})['then'](function(){if(_0x3ae2a0===_0xf414('0x48')){var _0x54d909=_[_0xf414('0x16')](_0x4999e4['SmsInteractions'],'id');return _0x4999e4[_0xf414('0x50')](_0x54d909)['then'](function(){for(var _0x1d17bf=0x0;_0x1d17bf<_0x54d909[_0xf414('0x1b')];_0x1d17bf+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x51'),{'SmsInteractionId':Number(_0x54d909[_0x1d17bf]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x375493=_[_0xf414('0x16')](_0x4999e4[_0xf414('0x52')],'id');return _0x4999e4['removeOpenchannelInteractions'](_0x375493)[_0xf414('0xb')](function(){for(var _0x30b335=0x0;_0x30b335<_0x375493[_0xf414('0x1b')];_0x30b335+=0x1){_0x236504[_0xf414('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x375493[_0x30b335]),'UserId':Number(_0x4999e4['id'])});}});}})[_0xf414('0xb')](function(){if(_0x3ae2a0==='leave'){var _0x59ad77=_['map'](_0x4999e4[_0xf414('0x29')],'id');return _0x4999e4[_0xf414('0x53')](_0x59ad77)['then'](function(){for(var _0x169835=0x0;_0x169835<_0x59ad77[_0xf414('0x1b')];_0x169835+=0x1){_0x236504[_0xf414('0x4d')](_0xf414('0x54'),{'WhatsappInteractionId':Number(_0x59ad77[_0x169835]),'UserId':Number(_0x4999e4['id'])});}});}})['catch'](function(_0x4d30f0){_0xcde327[_0xf414('0x55')](_0x4d30f0);});}}function onDisconnect(_0x40762d,_0x20caaf){joinOrLeave(_0x40762d,_0xf414('0x48'),_0x20caaf);}function onConnect(_0x6380d0){joinOrLeave(_0x6380d0,_0xf414('0x56'));}exports[_0xf414('0x57')]=function(_0x31c305){_0x31c305['on'](_0xf414('0x58'),function(_0x2827fd){_0x2827fd[_0xf414('0x59')](0x0);_0x2827fd[_0xf414('0x5a')]=_0x2827fd[_0xf414('0x5b')][_0xf414('0x58')]['remoteAddress']+':'+_0x2827fd[_0xf414('0x5b')][_0xf414('0x58')][_0xf414('0x5c')];_0x2827fd[_0xf414('0x5d')]=new Date();_0x2827fd[_0xf414('0x55')]=function(_0xb9b892){console[_0xf414('0x55')](_0xf414('0x5e')+_0x2827fd[_0xf414('0x5f')]['name']+'['+_0x2827fd[_0xf414('0x5a')]+']',_0xb9b892);};_0x2827fd['on'](_0xf414('0x60'),function(){onDisconnect(_0x2827fd,_0x31c305);_0x2827fd[_0xf414('0x55')]('DISCONNECTED');});onConnect(_0x2827fd);_0x2827fd[_0xf414('0x55')](_0xf414('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4e73bc2..215c47e 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 _0xf6d9=['AfterUpdate','User','find','email','internal','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','triggers','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','error','code','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','AfterCreate','changed','closed','substatus'];(function(_0x2f0cda,_0xfe4750){var _0x3af728=function(_0x5ba067){while(--_0x5ba067){_0x2f0cda['push'](_0x2f0cda['shift']());}};_0x3af728(++_0xfe4750);}(_0xf6d9,0x130));var _0x9f6d=function(_0x5beb02,_0x10e607){_0x5beb02=_0x5beb02-0x0;var _0x500144=_0xf6d9[_0x5beb02];return _0x500144;};'use strict';var util=require(_0x9f6d('0x0'));var db=require(_0x9f6d('0x1'))['db'];var jayson=require(_0x9f6d('0x2'));var logger=require('../logger')(_0x9f6d('0x3'));var client=jayson['client'][_0x9f6d('0x4')]({'port':0x232a});var triggers=[{'channel':_0x9f6d('0x5'),'model':_0x9f6d('0x6'),'event':_0x9f6d('0x7'),'condition':_0x9f6d('0x8'),'callback':afterCreate},{'channel':_0x9f6d('0x5'),'model':'ChatInteraction','event':_0x9f6d('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9f6d('0x5'),'model':_0x9f6d('0xa'),'event':_0x9f6d('0x7'),'condition':_0x9f6d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f6d('0x5'),'model':'ChatOfflineMessage','event':_0x9f6d('0x7'),'condition':_0x9f6d('0xb'),'callback':afterCreateOfflineMessage},{'channel':_0x9f6d('0xc'),'model':_0x9f6d('0xd'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x9f6d('0xc'),'model':_0x9f6d('0xd'),'event':_0x9f6d('0x9'),'condition':_0x9f6d('0xe'),'callback':afterUpdate},{'channel':_0x9f6d('0xc'),'model':_0x9f6d('0xf'),'event':_0x9f6d('0x7'),'condition':_0x9f6d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f6d('0x10'),'model':'WhatsappInteraction','event':_0x9f6d('0x7'),'condition':_0x9f6d('0x8'),'callback':afterCreate},{'channel':_0x9f6d('0x10'),'model':_0x9f6d('0x11'),'event':_0x9f6d('0x9'),'condition':_0x9f6d('0xe'),'callback':afterUpdate},{'channel':_0x9f6d('0x10'),'model':_0x9f6d('0x12'),'event':_0x9f6d('0x7'),'condition':_0x9f6d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f6d('0x13'),'model':_0x9f6d('0x14'),'event':_0x9f6d('0x7'),'condition':_0x9f6d('0x8'),'callback':afterCreate},{'channel':_0x9f6d('0x13'),'model':_0x9f6d('0x14'),'event':'afterUpdate','condition':_0x9f6d('0xe'),'callback':afterUpdate},{'channel':_0x9f6d('0x13'),'model':'FaxMessage','event':'afterCreate','condition':_0x9f6d('0xb'),'callback':afterCreateMessage},{'channel':_0x9f6d('0x15'),'model':'MailInteraction','event':_0x9f6d('0x7'),'condition':_0x9f6d('0x8'),'callback':afterCreate},{'channel':_0x9f6d('0x15'),'model':'MailInteraction','event':_0x9f6d('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9f6d('0x15'),'model':_0x9f6d('0x16'),'event':_0x9f6d('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9f6d('0x17'),'model':_0x9f6d('0x18'),'event':_0x9f6d('0x7'),'condition':_0x9f6d('0x8'),'callback':afterCreate},{'channel':_0x9f6d('0x17'),'model':_0x9f6d('0x18'),'event':_0x9f6d('0x9'),'condition':_0x9f6d('0xe'),'callback':afterUpdate},{'channel':'Openchannel','model':_0x9f6d('0x19'),'event':'afterCreate','condition':_0x9f6d('0xb'),'callback':afterCreateMessage}];function request(_0xa17ac1){return client[_0x9f6d('0x1a')](_0x9f6d('0x1b'),_0xa17ac1)[_0x9f6d('0x1c')](function(_0x273fba){logger['info']('Trigger,\x20%s',_0x9f6d('0x1b'),_0x273fba);if(_0x273fba[_0x9f6d('0x1d')]){if(_0x273fba[_0x9f6d('0x1d')][_0x9f6d('0x1e')]===0x1f4){logger['error'](_0x9f6d('0x1f'),_0x9f6d('0x1b'),_0x273fba[_0x9f6d('0x1d')]);}}})[_0x9f6d('0x20')](function(_0xadca3e){logger[_0x9f6d('0x1d')](_0x9f6d('0x1f'),'EventManager',_0xadca3e);});}function afterCreateMessage(_0x51e72f){return function(_0x280807){_0x280807=_0x280807[_0x9f6d('0x21')]({'plain':!![]});_0x280807[_0x9f6d('0x22')]=_0x51e72f;_0x280807[_0x9f6d('0x23')]=_0x51e72f;_0x280807[_0x9f6d('0x24')]=_0x280807[_0x9f6d('0x25')];Promise[_0x9f6d('0x26')]()[_0x9f6d('0x1c')](function(){if(typeof _0x280807[_0x9f6d('0x27')]===_0x9f6d('0x28'))return null;var _0x410293=_0x9f6d('0x29')+_0x280807['ContactId'];return db[_0x9f6d('0x2a')][_0x9f6d('0x2b')](_0x410293,{'type':db[_0x9f6d('0x2c')][_0x9f6d('0x2d')][_0x9f6d('0x2e')],'raw':!![]});})['then'](function(_0x15a516){if(_0x15a516){_0x280807[_0x9f6d('0x2f')]=_0x15a516[0x0];}if(typeof _0x280807[_0x9f6d('0x30')]==='undefined')return;return getAgent(_0x280807['UserId']);})[_0x9f6d('0x1c')](function(_0x1d40c5){if(_0x1d40c5){_0x280807[_0x9f6d('0x31')]=util['format'](_0x9f6d('0x32'),_0x1d40c5[_0x9f6d('0x33')]);_0x280807[_0x9f6d('0x34')]=_0x1d40c5;_0x280807[_0x9f6d('0x22')]=_0x51e72f;return request({'event':_0x9f6d('0x35'),'message':_0x280807});}else{return request({'event':_0x9f6d('0x36'),'message':_0x280807});}})[_0x9f6d('0x20')](function(_0x9a6dee){logger[_0x9f6d('0x1d')](_0x9f6d('0x1f'),_0x9f6d('0x37'),_0x9a6dee);});};}function afterCreateOfflineMessage(_0x3d2b1b){return function(_0xd28e8d){_0xd28e8d=_0xd28e8d[_0x9f6d('0x21')]({'plain':!![]});_0xd28e8d[_0x9f6d('0x22')]=_0x3d2b1b;_0xd28e8d[_0x9f6d('0x23')]=_0x3d2b1b;_0xd28e8d[_0x9f6d('0x24')]=_0x9f6d('0x38');return request({'event':_0xd28e8d[_0x9f6d('0x24')],'message':_0xd28e8d});};}function afterCreate(_0x3726da,_0x2dd30b){return function(_0x5e9426){_0x5e9426=_0x5e9426[_0x9f6d('0x21')]({'plain':!![]});_0x5e9426['channel']=_0x3726da;_0x5e9426[_0x9f6d('0x23')]=_0x3726da;_0x5e9426[_0x9f6d('0x24')]='opened';Promise[_0x9f6d('0x26')]()[_0x9f6d('0x1c')](function(){var _0x316514=_0x9f6d('0x29')+_0x5e9426[_0x9f6d('0x27')];return db[_0x9f6d('0x2a')][_0x9f6d('0x2b')](_0x316514,{'type':db[_0x9f6d('0x2c')]['QueryTypes'][_0x9f6d('0x2e')],'raw':!![]});})[_0x9f6d('0x1c')](function(_0x514011){if(_0x514011){_0x5e9426['contact']=_0x514011[0x0];}if(typeof _0x5e9426['UserId']===_0x9f6d('0x28'))return;return getAgent(_0x5e9426[_0x9f6d('0x30')]);})[_0x9f6d('0x1c')](function(_0x4bd190){if(_0x4bd190){_0x5e9426[_0x9f6d('0x31')]=util['format'](_0x9f6d('0x32'),_0x4bd190[_0x9f6d('0x33')]);_0x5e9426[_0x9f6d('0x34')]=_0x4bd190;}return request({'event':_0x2dd30b,'message':_0x5e9426});})[_0x9f6d('0x20')](function(_0x1867ff){logger[_0x9f6d('0x1d')](_0x9f6d('0x1f'),_0x9f6d('0x39'),_0x1867ff);});};}function afterUpdate(_0x1da71b){return function(_0x411f90){var _0x26cae8=_0x411f90[_0x9f6d('0x3a')](_0x9f6d('0x3b'))&&_0x411f90[_0x9f6d('0x3b')];var _0x2f2db0=_0x411f90[_0x9f6d('0x3a')](_0x9f6d('0x3c'));if(_0x26cae8||_0x2f2db0){var _0x14868f=_0x26cae8?_0x9f6d('0xe'):'substatus';var _0x5cf4da=_0x411f90[_0x9f6d('0x21')]({'plain':!![]});_0x5cf4da[_0x9f6d('0x22')]=_0x1da71b;_0x5cf4da[_0x9f6d('0x23')]=_0x1da71b;_0x5cf4da[_0x9f6d('0x24')]=_0x26cae8?_0x9f6d('0x3b'):_0x9f6d('0x3c');var _0x42dc92=_0x9f6d('0x29')+_0x5cf4da[_0x9f6d('0x27')];return db['sequelize'][_0x9f6d('0x2b')](_0x42dc92,{'type':db[_0x9f6d('0x2c')][_0x9f6d('0x2d')]['SELECT'],'raw':!![]})[_0x9f6d('0x1c')](function(_0x1a95b1){if(_0x1a95b1){_0x5cf4da['contact']=_0x1a95b1[0x0];}if(typeof _0x5cf4da['UserId']==='undefined')return;return getAgent(_0x5cf4da['UserId']);})[_0x9f6d('0x1c')](function(_0x42aa2b){if(_0x42aa2b){_0x5cf4da['interface']=util['format'](_0x9f6d('0x32'),_0x42aa2b[_0x9f6d('0x33')]);_0x5cf4da[_0x9f6d('0x34')]=_0x42aa2b;}return request({'event':_0x14868f,'message':_0x5cf4da});})['catch'](function(_0x3213cd){logger[_0x9f6d('0x1d')](_0x9f6d('0x1f'),_0x9f6d('0x3d'),_0x3213cd);});}};}function getAgent(_0x22b6ca){return db[_0x9f6d('0x3e')][_0x9f6d('0x3f')]({'where':{'id':_0x22b6ca},'attributes':['id','name','fullname',_0x9f6d('0x40'),_0x9f6d('0x41')],'raw':!![]})['then'](function(_0x3207f4){return _0x3207f4;});}exports[_0x9f6d('0x42')]=function(){for(var _0x4025ae=0x0;_0x4025ae=_0x311a2b['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1a1910(_0x395eba);})[_0x895e('0x18')](function(_0x538175){_0x418ed7(_0x538175);});});}; \ No newline at end of file +var _0x48a4=['sms','whatsapp','openchannel','getChannels','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat'];(function(_0x44bda4,_0x590028){var _0x5acd98=function(_0x1fdef4){while(--_0x1fdef4){_0x44bda4['push'](_0x44bda4['shift']());}};_0x5acd98(++_0x590028);}(_0x48a4,0xdf));var _0x448a=function(_0x4ee370,_0x134fa8){_0x4ee370=_0x4ee370-0x0;var _0x52cdf9=_0x48a4[_0x4ee370];return _0x52cdf9;};'use strict';var _=require(_0x448a('0x0'));var BPromise=require(_0x448a('0x1'));var db=require(_0x448a('0x2'))['db'];var util=require(_0x448a('0x3'));var channels=[_0x448a('0x4'),_0x448a('0x5'),_0x448a('0x6'),'fax',_0x448a('0x7'),_0x448a('0x8'),_0x448a('0x9')];exports[_0x448a('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x3679a1){_0x3679a1=_0x3679a1[_0x448a('0xb')]();return _['includes'](channels,_0x3679a1);};exports[_0x448a('0xc')]=function(_0x9b63af,_0x77e032,_0x56f04a,_0x5d1b1a){var _0xcbfe0={'loginAttempts':_0x77e032,'blocked':_0x56f04a};if(!_[_0x448a('0xd')](_0x5d1b1a)){_0xcbfe0[_0x448a('0xe')]=_0x5d1b1a;}return _0x9b63af[_0x448a('0xf')](_0xcbfe0);};exports[_0x448a('0x10')]=function(_0x2cb508){return new BPromise(function(_0x4a3a12,_0x175680){var _0xf43d63=0x0;if(_0x2cb508[_0x448a('0x11')]!==_0x448a('0x12')){_0x4a3a12(_0x2cb508);}db[_0x448a('0x13')][_0x448a('0x14')]({'where':{'role':_0x448a('0x12'),'online':!![],'id':{'$ne':_0x2cb508['id']}}})[_0x448a('0x15')](function(_0x142caf){_0xf43d63=_0x142caf;return util[_0x448a('0x10')]();})['then'](function(_0x5c9878){if(_0x5c9878&&_0x5c9878[_0x448a('0x16')]&&_0xf43d63>=_0x5c9878['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4a3a12(_0x2cb508);})['catch'](function(_0x4172c8){_0x175680(_0x4172c8);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index e23be52..8d6a07d 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15ae=['Not\x20Found','Conflict','error','stack','statusMessage','status','exports','../config/logger','api','Internal\x20Server\x20Error','inherits','name','Bad\x20Request','Forbidden','message','Entity\x20not\x20found','code','OutOfInterval','Resource\x20Conflict'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x15ae,0xb2));var _0xe15a=function(_0x4520dd,_0x33026f){_0x4520dd=_0x4520dd-0x0;var _0xb85503=_0x15ae[_0x4520dd];return _0xb85503;};'use strict';var util=require('util');var logger=require(_0xe15a('0x0'))(_0xe15a('0x1'));var APIError=function(_0x144eb0,_0x261207){this['message']=_0x144eb0||_0xe15a('0x2');this['name']=_0x261207||'Error';util[_0xe15a('0x3')](APIError,Error);};var APIBadRequestError=function(_0x3b5a2d){this['message']=_0x3b5a2d||'Bad\x20Request';this[_0xe15a('0x4')]=_0xe15a('0x5');util[_0xe15a('0x3')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x11869f){this['message']=_0x11869f||_0xe15a('0x6');this[_0xe15a('0x4')]=_0xe15a('0x6');util[_0xe15a('0x3')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x8c9131){this[_0xe15a('0x7')]=_0x8c9131||_0xe15a('0x8');this['name']='Not\x20Found';util[_0xe15a('0x3')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3e3f3f){this[_0xe15a('0x7')]=_0x3e3f3f||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xe15a('0x4')]='Out\x20Of\x20Interval';this[_0xe15a('0x9')]=0x193;this['details']={'type':_0xe15a('0xa')};util[_0xe15a('0x3')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x586405){this['message']=_0x586405||_0xe15a('0xb');this['name']='Conflict';util[_0xe15a('0x3')](APIBadRequestError,APIError);};function getStatusCode(_0x2533d9){switch(_0x2533d9){case _0xe15a('0x5'):return 0x190;case'Forbidden','Out\x20Of\x20Interval':return 0x193;case _0xe15a('0xc'):return 0x194;case _0xe15a('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x457fa9){if(_0x457fa9==='Out\x20Of\x20Interval')return _0x457fa9;return null;}function handleError(_0x3d33ed){return function(_0x51d04f){logger[_0xe15a('0xe')](_0x51d04f[_0xe15a('0xf')]);var _0xf2af25=getStatusCode(_0x51d04f[_0xe15a('0x4')]);var _0x2310bf=getCustomStatusMessage(_0x51d04f[_0xe15a('0x4')]);if(_0x51d04f['name']){delete _0x51d04f[_0xe15a('0x4')];}if(_0x2310bf){_0x3d33ed[_0xe15a('0x10')]=_0x2310bf;}return _0x3d33ed[_0xe15a('0x11')](_0xf2af25)['send'](_0x51d04f);};}module[_0xe15a('0x12')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xa455=['Resource\x20Conflict','Conflict','error','stack','statusMessage','status','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval'];(function(_0x22b430,_0x1aede5){var _0x338d2a=function(_0x1335f7){while(--_0x1335f7){_0x22b430['push'](_0x22b430['shift']());}};_0x338d2a(++_0x1aede5);}(_0xa455,0x13f));var _0x5a45=function(_0x8d6414,_0x28e959){_0x8d6414=_0x8d6414-0x0;var _0x5ddef1=_0xa455[_0x8d6414];return _0x5ddef1;};'use strict';var util=require(_0x5a45('0x0'));var logger=require(_0x5a45('0x1'))(_0x5a45('0x2'));var APIError=function(_0x2e86c5,_0xb86ab1){this[_0x5a45('0x3')]=_0x2e86c5||_0x5a45('0x4');this[_0x5a45('0x5')]=_0xb86ab1||_0x5a45('0x6');util[_0x5a45('0x7')](APIError,Error);};var APIBadRequestError=function(_0x1b38f1){this[_0x5a45('0x3')]=_0x1b38f1||'Bad\x20Request';this['name']=_0x5a45('0x8');util[_0x5a45('0x7')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x3686c6){this[_0x5a45('0x3')]=_0x3686c6||_0x5a45('0x9');this[_0x5a45('0x5')]='Forbidden';util[_0x5a45('0x7')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4ae2e3){this[_0x5a45('0x3')]=_0x4ae2e3||_0x5a45('0xa');this[_0x5a45('0x5')]=_0x5a45('0xb');util[_0x5a45('0x7')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x1ea718){this[_0x5a45('0x3')]=_0x1ea718||_0x5a45('0xc');this[_0x5a45('0x5')]=_0x5a45('0xd');this[_0x5a45('0xe')]=0x193;this[_0x5a45('0xf')]={'type':_0x5a45('0x10')};util[_0x5a45('0x7')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x8431b0){this[_0x5a45('0x3')]=_0x8431b0||_0x5a45('0x11');this['name']=_0x5a45('0x12');util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x2693f5){switch(_0x2693f5){case _0x5a45('0x8'):return 0x190;case _0x5a45('0x9'),_0x5a45('0xd'):return 0x193;case _0x5a45('0xb'):return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3a61d7){if(_0x3a61d7==='Out\x20Of\x20Interval')return _0x3a61d7;return null;}function handleError(_0x58dc9f){return function(_0x36acd6){logger[_0x5a45('0x13')](_0x36acd6[_0x5a45('0x14')]);var _0x45421e=getStatusCode(_0x36acd6[_0x5a45('0x5')]);var _0x4a25d4=getCustomStatusMessage(_0x36acd6['name']);if(_0x36acd6['name']){delete _0x36acd6['name'];}if(_0x4a25d4){_0x58dc9f[_0x5a45('0x15')]=_0x4a25d4;}return _0x58dc9f[_0x5a45('0x16')](_0x45421e)['send'](_0x36acd6);};}module[_0x5a45('0x17')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 5d9945b..053c9f8 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9803=['404','status','render','json','send','exports'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x9803,0x113));var _0x3980=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9803[_0x432682];return _0x463d05;};'use strict';module[_0x3980('0x0')][0x194]=function pageNotFound(_0xe6d65d,_0x360081){var _0x195b1c=_0x3980('0x1');var _0x4e3134=0x194;var _0x2fb21a={'status':_0x4e3134};_0x360081[_0x3980('0x2')](_0x2fb21a[_0x3980('0x2')]);_0x360081[_0x3980('0x3')](_0x195b1c,{},function(_0x1c27b2,_0x400e0a){if(_0x1c27b2){return _0x360081['status'](_0x2fb21a[_0x3980('0x2')])[_0x3980('0x4')](_0x2fb21a);}_0x360081[_0x3980('0x5')](_0x400e0a);});}; \ No newline at end of file +var _0xfac8=['exports','404','status','render','json'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfac8,0x190));var _0x8fac=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0xfac8[_0x9d639c];return _0x1671de;};'use strict';module[_0x8fac('0x0')][0x194]=function pageNotFound(_0x58d87d,_0x280366){var _0x2eb0ee=_0x8fac('0x1');var _0xbb9727=0x194;var _0x1fe52c={'status':_0xbb9727};_0x280366['status'](_0x1fe52c[_0x8fac('0x2')]);_0x280366[_0x8fac('0x3')](_0x2eb0ee,{},function(_0x3aa608,_0x387e46){if(_0x3aa608){return _0x280366[_0x8fac('0x2')](_0x1fe52c[_0x8fac('0x2')])[_0x8fac('0x4')](_0x1fe52c);}_0x280366['send'](_0x387e46);});}; \ No newline at end of file diff --git a/server/migrations/2.6.30.js b/server/migrations/2.6.30.js new file mode 100644 index 0000000..a59425a --- /dev/null +++ b/server/migrations/2.6.30.js @@ -0,0 +1,169 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); +var logger = require('../config/logger')('migration'); +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface /*, Sequelize */) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + // Add your migration code here + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function( /* queryInterface, Sequelize */ ) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1e6196e..bc31c92 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0825=['VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','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/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','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','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','SquareMessage','Team','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SET\x20NULL','belongsTo','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','FaxInteractions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','SmsQueues','OpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','CmList','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','VoiceCallReport','uniqueid','AgentReports','ContactId','MailAccount','MailAccountId','CloudProviderId','MailServerOut','restrict','MailMessage','Interactions','List','Template','TemplateId','mandatoryDispositionPause','Agents','MailInteractionId','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','Attachments','Contact','Interaction','Account','TagId','Dashboard','Items','Dispositions','FaxAccountId','Answers','Exntensions','FaxQueue','FaxApplication','FaxInteractionId','Owner','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','ListId','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','team_has_openchannel_queues','ChatWebsiteId','OpenchannelQueueReport','Agent','Queue','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','SmsInteractions','Company','Tags','cm_contact_has_tags','AdditionalPhones','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','AnalyticMetric','SalesforceAccount','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','VariableId','SugarcrmConfiguration','Configurations','SugarcrmField','SugarcrmAccount','int_desk_configuration_has_tags','ZohoAccount','ZendeskAccount','int_zendesk_configuration_has_tags','ServicenowField','Dynamics365Account','Dynamics365Configuration','FreshsalesAccount','ChatQueueReport','ToId','JscriptyQuestionReport','SessionId','JscriptyProject','ProjectId','MailQueues','team_has_chat_queues','ChatQueues','FaxQueues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','ToUserId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','FromUserId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileResource','sectionId','WhatsappAccountId','WhatsappApplication','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','Imap','exports','../config/environment','sequelize','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','name','utf8','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model'];(function(_0x42e465,_0x31344d){var _0x5ce301=function(_0x2fe75b){while(--_0x2fe75b){_0x42e465['push'](_0x42e465['shift']());}};_0x5ce301(++_0x31344d);}(_0x0825,0x1e4));var _0x5082=function(_0xb3787b,_0x5ed1a6){_0xb3787b=_0xb3787b-0x0;var _0x364bbe=_0x0825[_0xb3787b];return _0x364bbe;};'use strict';var config=require(_0x5082('0x0'));var Sequelize=require(_0x5082('0x1'));var _=require('lodash');var jstz=require('jstz');var timezone=jstz[_0x5082('0x2')]();config[_0x5082('0x1')]=_['defaultsDeep'](config[_0x5082('0x1')],{'database':_0x5082('0x3'),'username':_0x5082('0x4'),'password':_0x5082('0x5'),'options':{'host':_0x5082('0x6'),'port':0xcea,'dialect':_0x5082('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x5082('0x8')}}});config[_0x5082('0x9')]=_[_0x5082('0xa')](config[_0x5082('0x9')],{'database':_0x5082('0x3'),'username':'xcall','password':_0x5082('0x5'),'options':{'host':_0x5082('0x6'),'port':0xcea,'dialect':_0x5082('0x7'),'dialectOptions':{'charset':_0x5082('0xb')},'logging':![],'timezone':timezone[_0x5082('0xc')](),'define':{'charset':_0x5082('0xd'),'collate':_0x5082('0x8')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x5082('0x1')][_0x5082('0xe')],config[_0x5082('0x1')][_0x5082('0xf')],config[_0x5082('0x1')][_0x5082('0x10')],config[_0x5082('0x1')][_0x5082('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x5082('0xe')],config[_0x5082('0x9')][_0x5082('0xf')],config['sequelizeHistory'][_0x5082('0x10')],config[_0x5082('0x9')][_0x5082('0x11')])};db[_0x5082('0x12')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x14'));db[_0x5082('0x15')]=db['sequelize']['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x5082('0x16')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/voiceContext/voiceContext.model');db[_0x5082('0x17')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x5082('0x18')]=db[_0x5082('0x1')]['import'](_0x5082('0x19'));db[_0x5082('0x1a')]=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0x5082('0x1b')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x1c'));db[_0x5082('0x1d')]=db['sequelize']['import'](_0x5082('0x1e'));db[_0x5082('0x1f')]=db[_0x5082('0x1')]['import'](_0x5082('0x20'));db[_0x5082('0x21')]=db['sequelize']['import']('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db['sequelize']['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x5082('0x22')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x23'));db[_0x5082('0x24')]=db[_0x5082('0x1')]['import'](_0x5082('0x25'));db[_0x5082('0x26')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x27'));db[_0x5082('0x28')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x29'));db[_0x5082('0x2a')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x2b'));db[_0x5082('0x2c')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x2d'));db[_0x5082('0x2e')]=db['sequelize'][_0x5082('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x5082('0x2f')]=db['sequelize'][_0x5082('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x5082('0x30')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x31'));db[_0x5082('0x32')]=db[_0x5082('0x1')]['import'](_0x5082('0x33'));db[_0x5082('0x34')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0x5082('0x35')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x5082('0x36')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x37'));db[_0x5082('0x38')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x39'));db[_0x5082('0x3a')]=db['sequelize'][_0x5082('0x13')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x5082('0x1')][_0x5082('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x3b'));db[_0x5082('0x3c')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x3d'));db[_0x5082('0x3e')]=db[_0x5082('0x1')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x5082('0x3f')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x40'));db['MailMessage']=db['sequelize'][_0x5082('0x13')](_0x5082('0x41'));db[_0x5082('0x42')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x43'));db[_0x5082('0x44')]=db['sequelize']['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x5082('0x13')](_0x5082('0x45'));db[_0x5082('0x46')]=db[_0x5082('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x5082('0x13')](_0x5082('0x47'));db['FaxApplication']=db[_0x5082('0x1')][_0x5082('0x13')]('../api/faxApplication/faxApplication.model');db[_0x5082('0x48')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x49'));db[_0x5082('0x4a')]=db[_0x5082('0x1')]['import'](_0x5082('0x4b'));db['FaxQueue']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x4c'));db[_0x5082('0x4d')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x4e'));db[_0x5082('0x4f')]=db[_0x5082('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0x5082('0x50')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x51'));db[_0x5082('0x52')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x53'));db[_0x5082('0x54')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x55'));db[_0x5082('0x56')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x57'));db[_0x5082('0x58')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x59'));db[_0x5082('0x5a')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x5b'));db[_0x5082('0x5c')]=db[_0x5082('0x1')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x5082('0x5d')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x5e'));db['OpenchannelQueue']=db[_0x5082('0x1')]['import'](_0x5082('0x5f'));db[_0x5082('0x60')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x61'));db['OpenchannelQueueReport']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x62'));db[_0x5082('0x63')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x64'));db[_0x5082('0x65')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x66'));db['ChatMessage']=db['sequelize'][_0x5082('0x13')](_0x5082('0x67'));db[_0x5082('0x68')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x5082('0x69')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x6a'));db[_0x5082('0x6b')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x6c'));db[_0x5082('0x6d')]=db[_0x5082('0x1')]['import'](_0x5082('0x6e'));db[_0x5082('0x6f')]=db[_0x5082('0x1')]['import'](_0x5082('0x70'));db[_0x5082('0x71')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x72'));db[_0x5082('0x73')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x74'));db[_0x5082('0x75')]=db[_0x5082('0x1')]['import'](_0x5082('0x76'));db['CmHopperFinal']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x77'));db[_0x5082('0x78')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x79'));db[_0x5082('0x7a')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x7b'));db[_0x5082('0x7c')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0x5082('0x7d')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x7e'));db[_0x5082('0x7f')]=db[_0x5082('0x1')]['import']('../api/automation/automation.model');db[_0x5082('0x80')]=db[_0x5082('0x1')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x5082('0x81')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x82'));db[_0x5082('0x83')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x84'));db[_0x5082('0x85')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x86'));db[_0x5082('0x87')]=db[_0x5082('0x1')]['import'](_0x5082('0x88'));db[_0x5082('0x89')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x8a'));db[_0x5082('0x8b')]=db[_0x5082('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x5082('0x8c')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x8d'));db['Sound']=db[_0x5082('0x1')]['import'](_0x5082('0x8e'));db[_0x5082('0x8f')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x90'));db[_0x5082('0x91')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x92'));db[_0x5082('0x93')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x94'));db[_0x5082('0x95')]=db[_0x5082('0x1')]['import'](_0x5082('0x96'));db['Template']=db[_0x5082('0x1')][_0x5082('0x13')]('../api/template/template.model');db[_0x5082('0x97')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x98'));db[_0x5082('0x99')]=db[_0x5082('0x1')]['import'](_0x5082('0x9a'));db[_0x5082('0x9b')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x9c'));db['IntegrationReport']=db[_0x5082('0x1')][_0x5082('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x5082('0x1')][_0x5082('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x5082('0x9d')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x5082('0x9e')]=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x9f'));db['AnalyticFieldReport']=db['sequelize'][_0x5082('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x5082('0xa0')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xa1'));db['SalesforceAccount']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xa2'));db[_0x5082('0xa3')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xa4'));db[_0x5082('0xa5')]=db[_0x5082('0x1')]['import'](_0x5082('0xa6'));db['SugarcrmAccount']=db['sequelize'][_0x5082('0x13')](_0x5082('0xa7'));db['SugarcrmConfiguration']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xa8'));db['SugarcrmField']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xa9'));db[_0x5082('0xaa')]=db[_0x5082('0x1')]['import'](_0x5082('0xab'));db[_0x5082('0xac')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xad'));db[_0x5082('0xae')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xaf'));db[_0x5082('0xb0')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xb1'));db[_0x5082('0xb2')]=db['sequelize'][_0x5082('0x13')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xb3'));db[_0x5082('0xb4')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x5082('0xb5')]=db[_0x5082('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db[_0x5082('0xb6')]=db['sequelize']['import'](_0x5082('0xb7'));db[_0x5082('0xb8')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xb9'));db[_0x5082('0xba')]=db['sequelize']['import'](_0x5082('0xbb'));db[_0x5082('0xbc')]=db[_0x5082('0x1')]['import'](_0x5082('0xbd'));db[_0x5082('0xbe')]=db[_0x5082('0x1')]['import'](_0x5082('0xbf'));db[_0x5082('0xc0')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/intVtigerField/intVtigerField.model');db[_0x5082('0xc1')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xc2'));db[_0x5082('0xc3')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xc4'));db['ServicenowField']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xc5'));db['Dynamics365Account']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xc6'));db['Dynamics365Configuration']=db[_0x5082('0x1')]['import'](_0x5082('0xc7'));db[_0x5082('0xc8')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xc9'));db['FreshsalesAccount']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xca'));db[_0x5082('0xcb')]=db[_0x5082('0x1')]['import'](_0x5082('0xcc'));db[_0x5082('0xcd')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xce'));db[_0x5082('0x9b')]=db['sequelize'][_0x5082('0x13')](_0x5082('0x9c'));db['Network']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xcf'));db['ChatQueueReport']=db[_0x5082('0x1')]['import'](_0x5082('0xd0'));db[_0x5082('0xd1')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xd2'));db[_0x5082('0xd3')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xd4'));db['JscriptyQuestionReport']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xd5'));db[_0x5082('0xd6')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xd7'));db[_0x5082('0xd8')]=db['sequelize']['import'](_0x5082('0xd9'));db[_0x5082('0xda')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xdb'));db[_0x5082('0xdc')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xdd'));db['JscriptyProject']=db['sequelize'][_0x5082('0x13')](_0x5082('0xde'));db[_0x5082('0xdf')]=db[_0x5082('0x1')]['import']('../api/setting/setting.model');db[_0x5082('0xe0')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xe1'));db[_0x5082('0xe2')]=db['sequelize'][_0x5082('0x13')]('../api/squareProject/squareProject.model');db[_0x5082('0xe3')]=db[_0x5082('0x1')]['import']('../api/squareRecording/squareRecording.model');db[_0x5082('0xe4')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/squareMessage/squareMessage.model');db[_0x5082('0xe5')]=db['sequelize']['import']('../api/team/team.model');db['License']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xe6'));db[_0x5082('0xe7')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xe8'));db[_0x5082('0xe9')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xea'));db[_0x5082('0xeb')]=db[_0x5082('0x1')]['import'](_0x5082('0xec'));db['Plugin']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xed'));db[_0x5082('0xee')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xef'));db['ChatTransferReport']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xf0'));db['FaxTransferReport']=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xf1'));db[_0x5082('0xf2')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xf3'));db['SmsTransferReport']=db[_0x5082('0x1')][_0x5082('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db['sequelize'][_0x5082('0x13')](_0x5082('0xf4'));db[_0x5082('0xf5')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xf6'));db[_0x5082('0xf7')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xf8'));db[_0x5082('0xf9')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xfa'));db['UserProfileResource']=db[_0x5082('0x1')]['import']('../api/userProfileResource/userProfileResource.model');db[_0x5082('0xfb')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0xfc'));db[_0x5082('0xfd')]=db['sequelize'][_0x5082('0x13')](_0x5082('0xfe'));db['WhatsappApplication']=db['sequelize'][_0x5082('0x13')](_0x5082('0xff'));db[_0x5082('0x100')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x5082('0x101')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x5082('0x102')]=db[_0x5082('0x1')][_0x5082('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x5082('0x103')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x104'));db[_0x5082('0x105')]=db['sequelize'][_0x5082('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0x5082('0x106')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x107'));db[_0x5082('0x108')]=db[_0x5082('0x1')]['import'](_0x5082('0x109'));db[_0x5082('0x10a')]=db['sequelize']['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x5082('0x10b')]=db[_0x5082('0x1')][_0x5082('0x13')](_0x5082('0x10c'));db[_0x5082('0x10d')]=db['sequelize']['import']('../api/user-setting/user-setting.model');db['MailInteractionHasTag']=db['sequelize'][_0x5082('0x13')](_0x5082('0x10e'));db[_0x5082('0x12')][_0x5082('0x10f')](db[_0x5082('0x1f')],{'as':_0x5082('0x1f'),'onDelete':'cascade','foreignKey':_0x5082('0x110')});db['User'][_0x5082('0x10f')](db['UserSetting'],{'as':_0x5082('0x111'),'onDelete':_0x5082('0x112'),'foreignKey':'UserId'});db['User'][_0x5082('0x113')](db[_0x5082('0x1b')],{'as':_0x5082('0x114'),'foreignKey':_0x5082('0x110')});db['User'][_0x5082('0x113')](db[_0x5082('0x2e')],{'as':_0x5082('0x115'),'foreignKey':'UserId'});db['User'][_0x5082('0x113')](db[_0x5082('0x17')],{'as':_0x5082('0x116'),'onDelete':_0x5082('0x112'),'hooks':!![]});db[_0x5082('0x12')][_0x5082('0x113')](db[_0x5082('0x117')],{'as':'HopperFinals','foreignKey':'UserId'});db[_0x5082('0x12')][_0x5082('0x113')](db[_0x5082('0x78')],{'as':_0x5082('0x118'),'foreignKey':_0x5082('0x110')});db['User'][_0x5082('0x113')](db[_0x5082('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0x5082('0x110')});db[_0x5082('0x12')][_0x5082('0x113')](db[_0x5082('0x5c')],{'as':_0x5082('0x119'),'foreignKey':_0x5082('0x110')});db[_0x5082('0x12')][_0x5082('0x113')](db[_0x5082('0x65')],{'as':_0x5082('0x11a'),'foreignKey':'UserId'});db['User'][_0x5082('0x113')](db[_0x5082('0x52')],{'as':'SmsInteractions','foreignKey':_0x5082('0x110')});db[_0x5082('0x12')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x5082('0x12')][_0x5082('0x113')](db[_0x5082('0x3f')],{'as':_0x5082('0x11b'),'foreignKey':'UserId'});db[_0x5082('0x12')][_0x5082('0x113')](db[_0x5082('0x100')],{'as':_0x5082('0x11c'),'foreignKey':'UserId'});db['User'][_0x5082('0x113')](db['UserNotification'],{'as':_0x5082('0x11d'),'foreignKey':'SenderId'});db['User']['hasMany'](db[_0x5082('0x73')],{'as':'Hoppers','foreignKey':_0x5082('0x110'),'onDelete':_0x5082('0x11e')});db[_0x5082('0x12')][_0x5082('0x11f')](db[_0x5082('0xf7')],{'as':_0x5082('0xf7'),'foreignKey':_0x5082('0x120')});db[_0x5082('0x12')]['belongsToMany'](db[_0x5082('0x6b')],{'as':_0x5082('0x121'),'through':_0x5082('0x122')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x71')],{'as':'Contacts','through':_0x5082('0x124')});db[_0x5082('0x12')]['belongsToMany'](db['CmList'],{'as':_0x5082('0x125'),'through':_0x5082('0x126')});db[_0x5082('0x12')]['belongsToMany'](db['Team'],{'through':_0x5082('0x127')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x3f')],{'as':_0x5082('0x11b'),'through':'user_has_mail_interactions'});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x65')],{'as':_0x5082('0x11a'),'through':'user_has_chat_interactions'});db[_0x5082('0x12')]['belongsToMany'](db['FaxInteraction'],{'as':_0x5082('0x128'),'through':'user_has_fax_interactions'});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x52')],{'as':'SmsInteractions','through':_0x5082('0x129')});db[_0x5082('0x12')]['belongsToMany'](db[_0x5082('0x5c')],{'as':_0x5082('0x119'),'through':'user_has_openchannel_interactions'});db[_0x5082('0x12')][_0x5082('0x123')](db['WhatsappInteraction'],{'as':_0x5082('0x11c'),'through':_0x5082('0x12a')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x1a')],{'as':_0x5082('0x12b'),'through':_0x5082('0x2f'),'required':![]});db[_0x5082('0x12')][_0x5082('0x123')](db['VoicePrefix'],{'as':_0x5082('0x12c'),'through':_0x5082('0x10b'),'required':![]});db[_0x5082('0x12')]['belongsToMany'](db[_0x5082('0x3c')],{'as':'MailQueues','through':_0x5082('0x32'),'required':![]});db[_0x5082('0x12')]['belongsToMany'](db[_0x5082('0x69')],{'as':'ChatQueues','through':_0x5082('0x30'),'required':![],'hooks':!![]});db['User'][_0x5082('0x123')](db['FaxQueue'],{'as':'FaxQueues','through':_0x5082('0x34'),'required':![]});db[_0x5082('0x12')]['belongsToMany'](db[_0x5082('0x56')],{'as':_0x5082('0x12d'),'through':_0x5082('0x35'),'required':![]});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x12e')],{'as':'OpenchannelQueues','through':_0x5082('0x36'),'required':![]});db[_0x5082('0x12')][_0x5082('0x123')](db['WhatsappQueue'],{'as':_0x5082('0x12f'),'through':_0x5082('0x38'),'required':![]});db['User']['belongsToMany'](db['CmList'],{'through':_0x5082('0x126')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x60')],{'as':_0x5082('0x130'),'through':_0x5082('0x131')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x132')],{'as':_0x5082('0x133'),'through':_0x5082('0x134')});db[_0x5082('0x12')][_0x5082('0x123')](db['MailAccount'],{'as':'MailAccounts','through':_0x5082('0x135')});db['User'][_0x5082('0x123')](db[_0x5082('0x58')],{'as':_0x5082('0x136'),'through':_0x5082('0x137')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0x4f')],{'as':_0x5082('0x138'),'through':_0x5082('0x139')});db[_0x5082('0x12')][_0x5082('0x123')](db[_0x5082('0xfd')],{'as':'WhatsappAccounts','through':'user_has_whatsapp_accounts'});db[_0x5082('0x15')][_0x5082('0x113')](db[_0x5082('0x17')],{'as':_0x5082('0x13a'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x13b')});db[_0x5082('0x16')][_0x5082('0x113')](db[_0x5082('0x17')],{'onDelete':_0x5082('0x112')});db[_0x5082('0x17')][_0x5082('0x113')](db['VoiceExtension'],{'as':_0x5082('0x13c'),'onDelete':_0x5082('0x112')});db['VoiceMusicOnHold'][_0x5082('0x123')](db[_0x5082('0x13d')],{'as':_0x5082('0x13e'),'through':'moh_has_sounds'});db['VoiceQueue'][_0x5082('0x113')](db[_0x5082('0x2e')],{'as':_0x5082('0x13f'),'foreignKey':_0x5082('0x140')});db[_0x5082('0x1a')][_0x5082('0x113')](db[_0x5082('0x73')],{'as':_0x5082('0x141'),'foreignKey':_0x5082('0x140')});db[_0x5082('0x1a')][_0x5082('0x113')](db[_0x5082('0x117')],{'as':_0x5082('0x142'),'foreignKey':_0x5082('0x140')});db['VoiceQueue'][_0x5082('0x113')](db['CmHopperHistory'],{'as':_0x5082('0x143'),'foreignKey':_0x5082('0x140')});db['VoiceQueue'][_0x5082('0x113')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x5082('0x140')});db[_0x5082('0x1a')]['hasMany'](db[_0x5082('0x75')],{'as':'HopperBlacks','foreignKey':_0x5082('0x140')});db[_0x5082('0x1a')][_0x5082('0x113')](db['JscriptySessionReport'],{'as':_0x5082('0x144'),'foreignKey':'VoiceQueueId'});db[_0x5082('0x1a')]['belongsTo'](db[_0x5082('0x2a')],{'as':_0x5082('0x2a'),'foreignKey':_0x5082('0x145')});db['VoiceQueue'][_0x5082('0x11f')](db[_0x5082('0x2a')],{'as':_0x5082('0x146'),'foreignKey':_0x5082('0x147')});db[_0x5082('0x1a')]['belongsTo'](db[_0x5082('0x85')],{'as':_0x5082('0x85'),'foreignKey':_0x5082('0x148')});db[_0x5082('0x1a')][_0x5082('0x11f')](db[_0x5082('0x87')],{'as':'mandatoryDispositionPause','foreignKey':_0x5082('0x149')});db['VoiceQueue'][_0x5082('0x123')](db[_0x5082('0x14a')],{'as':_0x5082('0x125'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x5082('0x123')](db['User'],{'as':'Agents','through':_0x5082('0x2f')});db[_0x5082('0x1a')][_0x5082('0x123')](db['Team'],{'as':_0x5082('0x14b'),'through':'TeamVoiceQueue'});db[_0x5082('0x1a')][_0x5082('0x123')](db['CmList'],{'as':_0x5082('0x14c'),'through':_0x5082('0x14d')});db[_0x5082('0x1b')][_0x5082('0x11f')](db[_0x5082('0x12')],{'as':_0x5082('0x12'),'foreignKey':_0x5082('0x110')});db['ScreenRecording'][_0x5082('0x11f')](db['User'],{'as':'User','foreignKey':_0x5082('0x110')});db[_0x5082('0x1f')][_0x5082('0x113')](db['VoiceMailMessage'],{'as':_0x5082('0x14e'),'onDelete':_0x5082('0x112'),'foreignKey':'mailboxuser','sourceKey':_0x5082('0x14f')});db[_0x5082('0x21')][_0x5082('0x11f')](db[_0x5082('0x1f')],{'foreignKey':'mailboxuser','targetKey':_0x5082('0x14f')});db[_0x5082('0x150')]['hasMany'](db[_0x5082('0x26')],{'as':'QueueCalls','foreignKey':_0x5082('0x151'),'constraints':![]});db[_0x5082('0x150')][_0x5082('0x113')](db['VoiceAgentReport'],{'as':_0x5082('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0x5082('0x150')][_0x5082('0x11f')](db['User'],{'as':_0x5082('0x12'),'foreignKey':_0x5082('0x110')});db[_0x5082('0x150')][_0x5082('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':_0x5082('0x153')});db[_0x5082('0x3a')][_0x5082('0x11f')](db[_0x5082('0x154')],{'as':_0x5082('0x154'),'foreignKey':_0x5082('0x155')});db[_0x5082('0x3a')][_0x5082('0x11f')](db[_0x5082('0x106')],{'as':_0x5082('0x106'),'foreignKey':_0x5082('0x156'),'onDelete':'restrict'});db[_0x5082('0x157')][_0x5082('0x11f')](db[_0x5082('0x154')],{'as':_0x5082('0x154'),'foreignKey':'MailAccountId'});db[_0x5082('0x157')][_0x5082('0x11f')](db[_0x5082('0x106')],{'as':_0x5082('0x106'),'foreignKey':_0x5082('0x156'),'onDelete':_0x5082('0x158')});db[_0x5082('0x154')]['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':_0x5082('0x112')});db[_0x5082('0x154')][_0x5082('0x10f')](db['MailServerOut'],{'as':'Smtp','onDelete':_0x5082('0x112')});db[_0x5082('0x154')][_0x5082('0x113')](db[_0x5082('0x81')],{'as':'Dispositions','foreignKey':_0x5082('0x155'),'onDelete':_0x5082('0x112')});db[_0x5082('0x154')]['hasMany'](db[_0x5082('0x80')],{'as':'Answers','foreignKey':_0x5082('0x155')});db[_0x5082('0x154')][_0x5082('0x113')](db[_0x5082('0x159')],{'as':_0x5082('0x14e'),'foreignKey':_0x5082('0x155')});db[_0x5082('0x154')][_0x5082('0x113')](db[_0x5082('0x3f')],{'as':_0x5082('0x15a')});db['MailAccount'][_0x5082('0x113')](db[_0x5082('0x42')],{'as':_0x5082('0x13c'),'foreignKey':_0x5082('0x155'),'onDelete':'cascade'});db[_0x5082('0x154')]['belongsTo'](db['CmList'],{'as':_0x5082('0x15b'),'foreignKey':'ListId'});db[_0x5082('0x154')][_0x5082('0x11f')](db['Template'],{'as':_0x5082('0x15c'),'foreignKey':_0x5082('0x15d')});db[_0x5082('0x154')]['belongsTo'](db[_0x5082('0x87')],{'as':_0x5082('0x15e'),'foreignKey':_0x5082('0x149')});db['MailAccount'][_0x5082('0x123')](db['User'],{'as':'Agents','through':_0x5082('0x135')});db['MailQueue'][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x32')});db[_0x5082('0x3c')][_0x5082('0x123')](db[_0x5082('0xe5')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x5082('0x3f')]['hasMany'](db[_0x5082('0x159')],{'as':_0x5082('0x14e'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x160')});db['MailInteraction'][_0x5082('0x11f')](db[_0x5082('0x154')],{'as':'Account','foreignKey':_0x5082('0x155')});db['MailInteraction'][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':'Contact','foreignKey':'ContactId'});db[_0x5082('0x3f')]['belongsTo'](db[_0x5082('0x12')],{'as':'Owner','foreignKey':_0x5082('0x110')});db[_0x5082('0x3f')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x5082('0x3f')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x161'),'as':_0x5082('0x162')});db[_0x5082('0x3f')][_0x5082('0x123')](db['User'],{'as':'Users','through':_0x5082('0x163'),'foreignKey':_0x5082('0x160')});db[_0x5082('0x159')][_0x5082('0x113')](db[_0x5082('0xeb')],{'as':_0x5082('0x164'),'onDelete':_0x5082('0x112')});db['MailMessage']['belongsTo'](db['User'],{'as':'User'});db[_0x5082('0x159')][_0x5082('0x11f')](db[_0x5082('0x71')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x165')});db['MailMessage'][_0x5082('0x11f')](db[_0x5082('0x3f')],{'as':_0x5082('0x166'),'foreignKey':'MailInteractionId'});db[_0x5082('0x159')]['belongsTo'](db[_0x5082('0x154')],{'as':_0x5082('0x167'),'foreignKey':'MailAccountId'});db[_0x5082('0x159')][_0x5082('0x11f')](db[_0x5082('0x60')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db[_0x5082('0x159')][_0x5082('0x11f')](db[_0x5082('0x68')],{'as':_0x5082('0x68'),'foreignKey':'ChatOfflineMessageId'});db[_0x5082('0x42')][_0x5082('0x11f')](db['User'],{'onDelete':'restrict'});db[_0x5082('0x42')][_0x5082('0x11f')](db[_0x5082('0x3c')],{'onDelete':'restrict'});db[_0x5082('0x42')]['belongsTo'](db[_0x5082('0x154')],{'onDelete':_0x5082('0x158')});db[_0x5082('0x42')][_0x5082('0x11f')](db[_0x5082('0x85')],{'onDelete':_0x5082('0x158'),'foreignKey':'IntervalId'});db[_0x5082('0x42')][_0x5082('0x11f')](db[_0x5082('0x8f')],{'onDelete':'restrict','foreignKey':_0x5082('0x168')});db[_0x5082('0x44')][_0x5082('0x11f')](db['MailAccount'],{});db[_0x5082('0x44')][_0x5082('0x11f')](db[_0x5082('0x14a')],{'as':_0x5082('0x15b'),'foreignKey':'ListId'});db['MailQueueReport'][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':'ContactId'});db[_0x5082('0x44')][_0x5082('0x11f')](db[_0x5082('0x3f')],{});db['MailQueueReport'][_0x5082('0x11f')](db[_0x5082('0x159')],{});db[_0x5082('0x44')][_0x5082('0x11f')](db['User'],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0x5082('0x169')][_0x5082('0x113')](db[_0x5082('0x46')],{'as':_0x5082('0x16a'),'onDelete':_0x5082('0x112')});db[_0x5082('0x132')][_0x5082('0x113')](db['Disposition'],{'as':_0x5082('0x16b'),'foreignKey':_0x5082('0x16c'),'onDelete':_0x5082('0x112')});db['FaxAccount']['hasMany'](db[_0x5082('0x80')],{'as':_0x5082('0x16d'),'foreignKey':_0x5082('0x16c')});db['FaxAccount']['hasMany'](db[_0x5082('0x48')],{'as':_0x5082('0x15a')});db[_0x5082('0x132')][_0x5082('0x113')](db['FaxApplication'],{'as':_0x5082('0x13c'),'foreignKey':_0x5082('0x16c'),'onDelete':'cascade'});db[_0x5082('0x132')][_0x5082('0x113')](db['VoiceExtension'],{'as':_0x5082('0x16e'),'onDelete':'cascade'});db[_0x5082('0x132')][_0x5082('0x113')](db[_0x5082('0x4a')],{'as':'Messages'});db[_0x5082('0x132')][_0x5082('0x11f')](db['Trunk'],{'as':_0x5082('0x2a')});db[_0x5082('0x132')][_0x5082('0x11f')](db['CmList'],{'as':_0x5082('0x15b'),'foreignKey':'ListId'});db[_0x5082('0x132')][_0x5082('0x11f')](db[_0x5082('0x87')],{'as':_0x5082('0x15e'),'foreignKey':_0x5082('0x149')});db['FaxAccount'][_0x5082('0x123')](db[_0x5082('0x12')],{'as':'Agents','through':_0x5082('0x134')});db['FaxApplication'][_0x5082('0x11f')](db[_0x5082('0x12')],{'onDelete':_0x5082('0x158')});db['FaxApplication'][_0x5082('0x11f')](db[_0x5082('0x16f')],{'onDelete':'restrict'});db['FaxApplication'][_0x5082('0x11f')](db[_0x5082('0x132')],{'onDelete':_0x5082('0x158')});db[_0x5082('0x170')][_0x5082('0x11f')](db[_0x5082('0x8f')],{'onDelete':_0x5082('0x158'),'foreignKey':'TagId'});db[_0x5082('0x48')][_0x5082('0x113')](db[_0x5082('0x4a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x5082('0x171')});db[_0x5082('0x48')][_0x5082('0x11f')](db[_0x5082('0x132')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x16c')});db[_0x5082('0x48')][_0x5082('0x11f')](db['CmContact'],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x48')][_0x5082('0x11f')](db['User'],{'as':_0x5082('0x172'),'foreignKey':'UserId'});db['FaxInteraction'][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x173'),'as':'Tags'});db[_0x5082('0x48')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x173'),'as':_0x5082('0x162')});db[_0x5082('0x48')]['belongsToMany'](db[_0x5082('0x12')],{'as':_0x5082('0x174'),'through':'user_has_fax_interactions','foreignKey':_0x5082('0x171')});db[_0x5082('0x4a')][_0x5082('0x11f')](db[_0x5082('0x12')],{'onDelete':'cascade','as':_0x5082('0x12')});db[_0x5082('0x4a')][_0x5082('0x11f')](db[_0x5082('0x48')],{'as':_0x5082('0x166'),'foreignKey':'FaxInteractionId'});db[_0x5082('0x4a')][_0x5082('0x11f')](db[_0x5082('0x71')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x165')});db[_0x5082('0x4a')]['belongsTo'](db[_0x5082('0xeb')],{'as':_0x5082('0xeb'),'foreignKey':_0x5082('0x175')});db['FaxMessage'][_0x5082('0x11f')](db[_0x5082('0x132')],{'as':_0x5082('0x167'),'foreignKey':'FaxAccountId'});db[_0x5082('0x16f')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x34')});db['FaxQueue']['belongsToMany'](db[_0x5082('0xe5')],{'through':_0x5082('0x176'),'as':_0x5082('0x14b')});db[_0x5082('0x4d')][_0x5082('0x11f')](db[_0x5082('0x132')],{});db[_0x5082('0x4d')][_0x5082('0x11f')](db[_0x5082('0x14a')],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177')});db[_0x5082('0x4d')][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db['FaxQueueReport'][_0x5082('0x11f')](db[_0x5082('0x48')],{});db['FaxQueueReport'][_0x5082('0x11f')](db[_0x5082('0x4a')],{});db[_0x5082('0x4d')][_0x5082('0x11f')](db[_0x5082('0x12')],{});db[_0x5082('0x4d')][_0x5082('0x11f')](db['FaxQueue'],{});db['SmsAccount'][_0x5082('0x113')](db[_0x5082('0x81')],{'as':_0x5082('0x16b'),'foreignKey':_0x5082('0x178'),'onDelete':_0x5082('0x112')});db['SmsAccount'][_0x5082('0x113')](db[_0x5082('0x80')],{'as':_0x5082('0x16d'),'foreignKey':'SmsAccountId'});db[_0x5082('0x4f')][_0x5082('0x113')](db[_0x5082('0x54')],{'as':_0x5082('0x14e'),'foreignKey':'SmsAccountId'});db[_0x5082('0x4f')][_0x5082('0x113')](db[_0x5082('0x52')],{'as':_0x5082('0x15a')});db[_0x5082('0x4f')][_0x5082('0x113')](db[_0x5082('0x50')],{'as':_0x5082('0x13c'),'foreignKey':_0x5082('0x178'),'onDelete':_0x5082('0x112')});db[_0x5082('0x4f')][_0x5082('0x11f')](db[_0x5082('0x14a')],{'as':'List','foreignKey':_0x5082('0x177')});db[_0x5082('0x4f')][_0x5082('0x11f')](db[_0x5082('0x87')],{'as':_0x5082('0x15e'),'foreignKey':_0x5082('0x149')});db[_0x5082('0x4f')][_0x5082('0x123')](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication'][_0x5082('0x11f')](db['User'],{'onDelete':_0x5082('0x158')});db['SmsApplication'][_0x5082('0x11f')](db[_0x5082('0x56')],{'onDelete':_0x5082('0x158')});db[_0x5082('0x50')][_0x5082('0x11f')](db[_0x5082('0x4f')],{'onDelete':_0x5082('0x158')});db['SmsApplication'][_0x5082('0x11f')](db[_0x5082('0x85')],{'onDelete':_0x5082('0x158'),'foreignKey':_0x5082('0x148')});db['SmsApplication']['belongsTo'](db['Tag'],{'onDelete':_0x5082('0x158'),'foreignKey':'TagId'});db[_0x5082('0x52')][_0x5082('0x113')](db[_0x5082('0x54')],{'as':_0x5082('0x14e'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x179')});db[_0x5082('0x52')][_0x5082('0x11f')](db[_0x5082('0x4f')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x178')});db[_0x5082('0x52')][_0x5082('0x11f')](db['CmContact'],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x52')][_0x5082('0x11f')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0x5082('0x52')]['belongsToMany'](db[_0x5082('0x8f')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0x5082('0x52')][_0x5082('0x123')](db['Tag'],{'through':_0x5082('0x17a'),'as':'ThroughTags'});db[_0x5082('0x52')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':'Users','through':_0x5082('0x129'),'foreignKey':'SmsInteractionId'});db[_0x5082('0x54')]['belongsTo'](db[_0x5082('0x12')],{'as':_0x5082('0x12')});db['SmsMessage']['belongsTo'](db[_0x5082('0x71')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x165')});db[_0x5082('0x54')][_0x5082('0x11f')](db[_0x5082('0x52')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x166'),'foreignKey':_0x5082('0x179')});db['SmsMessage'][_0x5082('0x11f')](db[_0x5082('0x4f')],{'as':_0x5082('0x167'),'foreignKey':'SmsAccountId'});db[_0x5082('0x56')][_0x5082('0x123')](db['User'],{'as':_0x5082('0x15f'),'through':'UserSmsQueue','foreignKey':_0x5082('0x17b')});db[_0x5082('0x56')]['belongsToMany'](db['Team'],{'through':_0x5082('0x17c'),'as':'Teams'});db['OpenchannelAccount'][_0x5082('0x113')](db[_0x5082('0x81')],{'as':_0x5082('0x16b'),'foreignKey':'OpenchannelAccountId','onDelete':_0x5082('0x112')});db[_0x5082('0x58')][_0x5082('0x113')](db[_0x5082('0x80')],{'as':_0x5082('0x16d'),'foreignKey':'OpenchannelAccountId'});db[_0x5082('0x58')]['hasMany'](db[_0x5082('0x5c')],{'as':_0x5082('0x15a'),'foreignKey':_0x5082('0x17d')});db['OpenchannelAccount'][_0x5082('0x113')](db[_0x5082('0x5d')],{'as':_0x5082('0x14e'),'foreignKey':_0x5082('0x17d')});db[_0x5082('0x58')]['hasMany'](db['OpenchannelApplication'],{'as':_0x5082('0x13c'),'foreignKey':'OpenchannelAccountId','onDelete':_0x5082('0x112')});db[_0x5082('0x58')]['belongsTo'](db['CmList'],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177')});db['OpenchannelAccount'][_0x5082('0x11f')](db['Pause'],{'as':_0x5082('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x137')});db[_0x5082('0x5a')][_0x5082('0x11f')](db[_0x5082('0x12')],{'onDelete':_0x5082('0x158')});db[_0x5082('0x5a')]['belongsTo'](db[_0x5082('0x12e')],{'onDelete':_0x5082('0x158'),'foreignKey':_0x5082('0x17e')});db[_0x5082('0x5a')]['belongsTo'](db[_0x5082('0x58')],{'onDelete':_0x5082('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0x5082('0x5a')][_0x5082('0x11f')](db[_0x5082('0x85')],{'onDelete':'restrict','foreignKey':_0x5082('0x148')});db[_0x5082('0x5a')][_0x5082('0x11f')](db[_0x5082('0x8f')],{'onDelete':_0x5082('0x158'),'foreignKey':_0x5082('0x168')});db[_0x5082('0x5c')]['hasMany'](db['OpenchannelMessage'],{'as':_0x5082('0x14e'),'onDelete':_0x5082('0x112'),'foreignKey':'OpenchannelInteractionId'});db[_0x5082('0x5c')][_0x5082('0x11f')](db[_0x5082('0x58')],{'as':_0x5082('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0x5082('0x5c')][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':'ContactId'});db[_0x5082('0x5c')][_0x5082('0x11f')](db[_0x5082('0x12')],{'as':_0x5082('0x172'),'foreignKey':'UserId'});db[_0x5082('0x5c')]['belongsToMany'](db[_0x5082('0x8f')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db['OpenchannelInteraction'][_0x5082('0x123')](db['Tag'],{'through':_0x5082('0x17f'),'as':_0x5082('0x162')});db[_0x5082('0x5c')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x174'),'through':_0x5082('0x180'),'foreignKey':_0x5082('0x181')});db[_0x5082('0x5d')][_0x5082('0x11f')](db['User'],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x12')});db[_0x5082('0x5d')][_0x5082('0x11f')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x5082('0x5d')][_0x5082('0x11f')](db[_0x5082('0x5c')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x166'),'foreignKey':_0x5082('0x181')});db['OpenchannelMessage']['belongsTo'](db[_0x5082('0xeb')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x5082('0x5d')][_0x5082('0x11f')](db[_0x5082('0x58')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x17d')});db[_0x5082('0x12e')]['belongsToMany'](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x36'),'foreignKey':_0x5082('0x17e')});db[_0x5082('0x12e')][_0x5082('0x123')](db[_0x5082('0xe5')],{'through':_0x5082('0x182'),'as':_0x5082('0x14b')});db[_0x5082('0x60')]['hasMany'](db[_0x5082('0x81')],{'as':_0x5082('0x16b'),'foreignKey':'ChatWebsiteId','onDelete':_0x5082('0x112')});db['ChatWebsite'][_0x5082('0x113')](db[_0x5082('0x80')],{'as':_0x5082('0x16d'),'foreignKey':_0x5082('0x183')});db[_0x5082('0x60')][_0x5082('0x113')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x5082('0x60')][_0x5082('0x113')](db[_0x5082('0x65')],{'as':_0x5082('0x15a')});db[_0x5082('0x60')][_0x5082('0x113')](db[_0x5082('0x63')],{'as':_0x5082('0x13c'),'foreignKey':_0x5082('0x183'),'onDelete':'cascade'});db[_0x5082('0x60')][_0x5082('0x113')](db['ChatMessage'],{'as':_0x5082('0x14e')});db[_0x5082('0x60')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x5082('0x60')]['belongsTo'](db['Interval'],{'as':_0x5082('0x85'),'foreignKey':_0x5082('0x148')});db['ChatWebsite']['belongsTo'](db['MailAccount'],{'as':_0x5082('0x154'),'foreignKey':_0x5082('0x155')});db[_0x5082('0x60')][_0x5082('0x11f')](db[_0x5082('0x87')],{'as':_0x5082('0x15e'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x5082('0x60')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x131')});db[_0x5082('0x184')][_0x5082('0x11f')](db[_0x5082('0x58')],{});db[_0x5082('0x184')]['belongsTo'](db[_0x5082('0x14a')],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177')});db['OpenchannelQueueReport'][_0x5082('0x11f')](db['CmContact'],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x184')]['belongsTo'](db[_0x5082('0x5c')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x5082('0x5d')],{});db[_0x5082('0x184')][_0x5082('0x11f')](db['User'],{});db['OpenchannelQueueReport'][_0x5082('0x11f')](db[_0x5082('0x12e')],{});db[_0x5082('0x63')][_0x5082('0x11f')](db[_0x5082('0x12')],{'as':_0x5082('0x185'),'foreignKey':_0x5082('0x110'),'onDelete':_0x5082('0x158')});db[_0x5082('0x63')]['belongsTo'](db[_0x5082('0x69')],{'as':_0x5082('0x186'),'foreignKey':'ChatQueueId','onDelete':_0x5082('0x158')});db['ChatApplication'][_0x5082('0x11f')](db[_0x5082('0x60')],{'as':_0x5082('0x187'),'foreignKey':'ChatWebsiteId','onDelete':_0x5082('0x158')});db[_0x5082('0x63')]['belongsTo'](db[_0x5082('0x8f')],{'onDelete':_0x5082('0x158'),'foreignKey':_0x5082('0x168')});db[_0x5082('0x65')]['hasMany'](db[_0x5082('0x188')],{'as':_0x5082('0x14e'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x189')});db[_0x5082('0x65')]['belongsTo'](db['ChatWebsite'],{'as':'Account','foreignKey':_0x5082('0x183')});db[_0x5082('0x65')][_0x5082('0x11f')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db['ChatInteraction'][_0x5082('0x11f')](db[_0x5082('0x12')],{'as':_0x5082('0x172'),'foreignKey':_0x5082('0x110')});db[_0x5082('0x65')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x18a'),'as':'Tags'});db[_0x5082('0x65')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x18a'),'as':_0x5082('0x162')});db[_0x5082('0x65')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x174'),'through':_0x5082('0x18b'),'foreignKey':_0x5082('0x189')});db[_0x5082('0x188')][_0x5082('0x11f')](db[_0x5082('0x12')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x12')});db[_0x5082('0x188')][_0x5082('0x11f')](db['CmContact'],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x188')][_0x5082('0x11f')](db[_0x5082('0x65')],{'onDelete':_0x5082('0x112'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x5082('0x188')][_0x5082('0x11f')](db[_0x5082('0xeb')],{'as':_0x5082('0xeb'),'foreignKey':_0x5082('0x175')});db[_0x5082('0x188')][_0x5082('0x11f')](db[_0x5082('0x60')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x183')});db['ChatOfflineMessage'][_0x5082('0x113')](db['Attachment'],{'as':_0x5082('0x164'),'foreignKey':_0x5082('0x18c'),'onDelete':_0x5082('0x112'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0x5082('0x71')],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db['ChatOfflineMessage'][_0x5082('0x11f')](db[_0x5082('0x60')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x183')});db[_0x5082('0x69')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':'UserChatQueue','hooks':!![]});db[_0x5082('0x69')][_0x5082('0x123')](db['Team'],{'through':'team_has_chat_queues','as':'Teams'});db[_0x5082('0x6b')][_0x5082('0x113')](db[_0x5082('0xd1')],{'as':_0x5082('0x14e'),'foreignKey':_0x5082('0x18d'),'onDelete':'cascade'});db[_0x5082('0x6b')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x13f'),'through':'chat_group_has_users'});db[_0x5082('0x6d')]['belongsTo'](db['ChatWebsite'],{'as':_0x5082('0x187'),'foreignKey':'ChatWebsiteId'});db[_0x5082('0x6f')]['hasMany'](db[_0x5082('0x71')],{'as':_0x5082('0x18e'),'foreignKey':_0x5082('0x18f')});db[_0x5082('0x71')]['hasMany'](db['CmContactHasItem'],{'as':_0x5082('0x190'),'foreignKey':_0x5082('0x191')});db['CmContact']['hasMany'](db[_0x5082('0x73')],{'as':_0x5082('0x141'),'foreignKey':'ContactId'});db[_0x5082('0x71')][_0x5082('0x113')](db[_0x5082('0x117')],{'as':_0x5082('0x142'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x71')]['hasMany'](db[_0x5082('0x78')],{'as':_0x5082('0x143'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x71')][_0x5082('0x113')](db['ReportAgentPreview'],{'as':_0x5082('0x7a'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x71')][_0x5082('0x113')](db[_0x5082('0xd6')],{'as':_0x5082('0x144'),'foreignKey':_0x5082('0x153')});db['CmContact'][_0x5082('0x113')](db[_0x5082('0x5c')],{'as':'OpenchannelInteractions','foreignKey':_0x5082('0x153'),'onDelete':'restrict'});db[_0x5082('0x71')]['hasMany'](db[_0x5082('0x65')],{'as':'ChatInteractions','foreignKey':_0x5082('0x153'),'onDelete':_0x5082('0x158')});db['CmContact'][_0x5082('0x113')](db[_0x5082('0x52')],{'as':_0x5082('0x192'),'foreignKey':_0x5082('0x153'),'onDelete':_0x5082('0x158')});db[_0x5082('0x71')][_0x5082('0x113')](db[_0x5082('0x48')],{'as':_0x5082('0x128'),'foreignKey':_0x5082('0x153'),'onDelete':_0x5082('0x158')});db[_0x5082('0x71')][_0x5082('0x113')](db['MailInteraction'],{'as':_0x5082('0x11b'),'foreignKey':_0x5082('0x153'),'onDelete':_0x5082('0x158')});db[_0x5082('0x71')][_0x5082('0x11f')](db['CmCompany'],{'as':_0x5082('0x193'),'foreignKey':'CompanyId'});db[_0x5082('0x71')][_0x5082('0x11f')](db['CmList'],{'as':_0x5082('0x15b'),'foreignKey':'ListId','onDelete':_0x5082('0x112')});db['CmContact'][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x174'),'through':_0x5082('0x124')});db[_0x5082('0x71')]['belongsToMany'](db[_0x5082('0x8f')],{'as':_0x5082('0x194'),'through':_0x5082('0x195')});db['CmContact'][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x195'),'as':_0x5082('0x162')});db['CmHopper'][_0x5082('0x113')](db[_0x5082('0x95')],{'as':_0x5082('0x196'),'foreignKey':'CmHopperId'});db['CmHopper'][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':'Contact','foreignKey':_0x5082('0x153'),'onDelete':_0x5082('0x112')});db[_0x5082('0x73')][_0x5082('0x11f')](db['CmList'],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177'),'onDelete':'cascade'});db[_0x5082('0x73')]['belongsTo'](db[_0x5082('0x12')],{'as':_0x5082('0x185'),'foreignKey':_0x5082('0x110')});db[_0x5082('0x73')][_0x5082('0x11f')](db[_0x5082('0x1a')],{'as':_0x5082('0x186'),'foreignKey':_0x5082('0x140'),'onDelete':_0x5082('0x112')});db['CmHopper'][_0x5082('0x11f')](db[_0x5082('0xe7')],{'as':_0x5082('0xe7'),'foreignKey':_0x5082('0x197'),'onDelete':_0x5082('0x112')});db[_0x5082('0x73')][_0x5082('0x11f')](db['User'],{'as':_0x5082('0x172'),'foreignKey':_0x5082('0x198')});db[_0x5082('0x75')]['belongsTo'](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153'),'onDelete':_0x5082('0x112')});db['CmHopperBlack'][_0x5082('0x11f')](db[_0x5082('0x14a')],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177'),'onDelete':_0x5082('0x112')});db[_0x5082('0x75')]['belongsTo'](db[_0x5082('0x1a')],{'as':_0x5082('0x186'),'foreignKey':_0x5082('0x140'),'onDelete':'cascade'});db[_0x5082('0x75')]['belongsTo'](db[_0x5082('0xe7')],{'as':_0x5082('0xe7'),'foreignKey':_0x5082('0x197'),'onDelete':_0x5082('0x112')});db[_0x5082('0x7f')]['hasMany'](db['Condition'],{'as':{'plural':_0x5082('0x199'),'singular':'OneAll'},'foreignKey':_0x5082('0x19a'),'onDelete':'cascade','hooks':!![]});db[_0x5082('0x7f')][_0x5082('0x113')](db['Condition'],{'as':{'plural':_0x5082('0x19b'),'singular':_0x5082('0x19c')},'foreignKey':_0x5082('0x19d'),'onDelete':_0x5082('0x112'),'hooks':!![]});db['Automation'][_0x5082('0x113')](db['Action'],{'as':_0x5082('0x19e'),'foreignKey':'AutomationId','onDelete':_0x5082('0x112'),'hooks':!![]});db[_0x5082('0x81')]['hasMany'](db[_0x5082('0x81')],{'as':'Dispositions','foreignKey':_0x5082('0x19f'),'onDelete':_0x5082('0x112')});db[_0x5082('0x85')]['hasMany'](db[_0x5082('0x85')],{'as':_0x5082('0x1a0'),'foreignKey':_0x5082('0x148'),'onDelete':_0x5082('0x112'),'hooks':!![],'required':![]});db[_0x5082('0x85')]['hasMany'](db[_0x5082('0x17')],{'as':'Extensions','foreignKey':_0x5082('0x148'),'onDelete':'restrict'});db[_0x5082('0x85')][_0x5082('0x113')](db[_0x5082('0x42')],{'as':_0x5082('0x1a1'),'foreignKey':_0x5082('0x148')});db[_0x5082('0x85')][_0x5082('0x113')](db[_0x5082('0x63')],{'as':_0x5082('0x1a2'),'foreignKey':_0x5082('0x148')});db[_0x5082('0x85')][_0x5082('0x113')](db['FaxApplication'],{'as':_0x5082('0x1a3'),'foreignKey':_0x5082('0x148')});db[_0x5082('0x85')][_0x5082('0x113')](db[_0x5082('0x50')],{'as':_0x5082('0x1a4'),'foreignKey':_0x5082('0x148')});db['Schedule'][_0x5082('0x11f')](db[_0x5082('0x154')],{});db['Schedule'][_0x5082('0x11f')](db['AnalyticDefaultReport'],{'foreignKey':_0x5082('0x1a5')});db[_0x5082('0x8c')][_0x5082('0x11f')](db[_0x5082('0x1a6')],{'foreignKey':_0x5082('0x1a7')});db[_0x5082('0x13d')]['belongsToMany'](db[_0x5082('0x18')],{'as':_0x5082('0x1a8'),'through':'moh_has_sounds','onDelete':_0x5082('0x158')});db[_0x5082('0x8f')][_0x5082('0x123')](db[_0x5082('0x71')],{'through':_0x5082('0x195')});db[_0x5082('0x8f')]['belongsToMany'](db[_0x5082('0x65')],{'through':'chat_interaction_has_tags'});db[_0x5082('0x8f')][_0x5082('0x123')](db[_0x5082('0x3f')],{'through':_0x5082('0x161')});db[_0x5082('0x8f')][_0x5082('0x123')](db[_0x5082('0x52')],{'through':_0x5082('0x17a')});db['Tag'][_0x5082('0x123')](db[_0x5082('0x48')],{'through':'fax_interaction_has_tags'});db[_0x5082('0x8f')][_0x5082('0x123')](db[_0x5082('0x5c')],{'through':_0x5082('0x17f')});db[_0x5082('0x8f')][_0x5082('0x123')](db['WhatsappInteraction'],{'through':_0x5082('0x1a9')});db[_0x5082('0x93')][_0x5082('0x11f')](db['ContactItemType'],{'as':_0x5082('0x1aa'),'foreignKey':_0x5082('0x1ab')});db[_0x5082('0x95')][_0x5082('0x11f')](db[_0x5082('0x73')],{'as':_0x5082('0x1ac'),'foreignKey':'CmHopperId'});db['CmContactHasItem']['belongsTo'](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':'CmContactId'});db['Trigger'][_0x5082('0x113')](db[_0x5082('0x83')],{'as':{'plural':_0x5082('0x1ad'),'singular':'AllCondition'},'foreignKey':_0x5082('0x1ae'),'onDelete':_0x5082('0x112'),'hooks':!![]});db[_0x5082('0x97')][_0x5082('0x113')](db[_0x5082('0x83')],{'as':{'plural':'AnyConditions','singular':_0x5082('0x1af')},'foreignKey':_0x5082('0x1b0'),'onDelete':_0x5082('0x112'),'hooks':!![]});db[_0x5082('0x97')][_0x5082('0x113')](db[_0x5082('0x7d')],{'as':_0x5082('0x19e'),'foreignKey':_0x5082('0x1b1'),'onDelete':_0x5082('0x112'),'hooks':!![]});db[_0x5082('0x1a6')][_0x5082('0x113')](db[_0x5082('0x1b2')],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1a7'),'hooks':!![]});db['AnalyticDefaultReport'][_0x5082('0x113')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x5082('0x112'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x5082('0x113')](db[_0x5082('0x1b2')],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b4')});db[_0x5082('0x1b2')][_0x5082('0x11f')](db[_0x5082('0x1b5')],{'foreignKey':_0x5082('0x1b4')});db[_0x5082('0x1b6')]['hasMany'](db[_0x5082('0xa3')],{'as':'Configurations','onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0xa3')][_0x5082('0x113')](db[_0x5082('0xa5')],{'as':_0x5082('0x1b8'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xa3')][_0x5082('0x113')](db[_0x5082('0xa5')],{'as':_0x5082('0x1ba'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xa3')][_0x5082('0x113')](db[_0x5082('0xa5')],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xa3')][_0x5082('0x11f')](db[_0x5082('0x1b6')],{'as':_0x5082('0x167'),'foreignKey':'AccountId'});db[_0x5082('0xa5')][_0x5082('0x113')](db[_0x5082('0xa5')],{'as':_0x5082('0x1bd'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xa5')]['hasMany'](db['SalesforceField'],{'as':_0x5082('0x1be'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xa5')][_0x5082('0x113')](db[_0x5082('0xa5')],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db['SalesforceField']['belongsTo'](db[_0x5082('0x99')],{'as':'Variable','foreignKey':_0x5082('0x1c0')});db['SugarcrmAccount']['hasMany'](db[_0x5082('0x1c1')],{'as':_0x5082('0x1c2'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0x1c1')][_0x5082('0x113')](db[_0x5082('0x1c3')],{'as':_0x5082('0x1b8'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b9')});db['SugarcrmConfiguration'][_0x5082('0x113')](db[_0x5082('0x1c3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x5082('0x1bb')});db[_0x5082('0x1c1')]['hasMany'](db['SugarcrmField'],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0x1c1')]['belongsTo'](db[_0x5082('0x1c4')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0x1c3')]['hasMany'](db[_0x5082('0x1c3')],{'as':'Subject','foreignKey':_0x5082('0x1b9')});db[_0x5082('0x1c3')][_0x5082('0x113')](db[_0x5082('0x1c3')],{'as':_0x5082('0x1be'),'foreignKey':'DescriptionId'});db['SugarcrmField']['hasMany'](db[_0x5082('0x1c3')],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0x1c3')][_0x5082('0x11f')](db[_0x5082('0x99')],{'as':_0x5082('0x99'),'foreignKey':_0x5082('0x1c0')});db[_0x5082('0xaa')]['hasMany'](db[_0x5082('0xac')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x5082('0x1b7')});db[_0x5082('0xac')][_0x5082('0x113')](db[_0x5082('0xae')],{'as':_0x5082('0x1b8'),'onDelete':'cascade','foreignKey':_0x5082('0x1b9')});db[_0x5082('0xac')][_0x5082('0x113')](db[_0x5082('0xae')],{'as':_0x5082('0x1ba'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db[_0x5082('0xae')],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xac')][_0x5082('0x11f')](db['DeskAccount'],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0xac')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x1c5')});db[_0x5082('0xae')][_0x5082('0x113')](db['DeskField'],{'as':_0x5082('0x1bd'),'foreignKey':_0x5082('0x1b9')});db['DeskField'][_0x5082('0x113')](db[_0x5082('0xae')],{'as':_0x5082('0x1be'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xae')]['hasMany'](db[_0x5082('0xae')],{'as':'Field','foreignKey':_0x5082('0x1bc')});db[_0x5082('0xae')][_0x5082('0x11f')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x5082('0x1c6')]['hasMany'](db[_0x5082('0xb0')],{'as':_0x5082('0x1c2'),'onDelete':_0x5082('0x112'),'foreignKey':'AccountId'});db[_0x5082('0xb0')][_0x5082('0x113')](db[_0x5082('0xb2')],{'as':_0x5082('0x1b8'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b9')});db['ZohoConfiguration']['hasMany'](db[_0x5082('0xb2')],{'as':_0x5082('0x1ba'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xb0')][_0x5082('0x11f')](db[_0x5082('0x1c6')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0xb2')]['hasMany'](db[_0x5082('0xb2')],{'as':'Subject','foreignKey':_0x5082('0x1b9')});db[_0x5082('0xb2')][_0x5082('0x113')](db[_0x5082('0xb2')],{'as':_0x5082('0x1be'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0x5082('0xb2')],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db['ZohoField'][_0x5082('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0x5082('0x1c0')});db['ZendeskAccount'][_0x5082('0x113')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':_0x5082('0x112'),'foreignKey':'AccountId'});db[_0x5082('0xb4')][_0x5082('0x113')](db[_0x5082('0xb5')],{'as':_0x5082('0x1b8'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xb4')][_0x5082('0x113')](db[_0x5082('0xb5')],{'as':'Descriptions','foreignKey':_0x5082('0x1bb')});db[_0x5082('0xb4')][_0x5082('0x113')](db[_0x5082('0xb5')],{'as':_0x5082('0x1b3'),'foreignKey':_0x5082('0x1bc')});db['ZendeskConfiguration'][_0x5082('0x11f')](db[_0x5082('0x1c7')],{'as':'Account','foreignKey':_0x5082('0x1b7')});db['ZendeskConfiguration']['belongsToMany'](db[_0x5082('0x8f')],{'through':_0x5082('0x1c8')});db['ZendeskField'][_0x5082('0x113')](db[_0x5082('0xb5')],{'as':_0x5082('0x1bd'),'foreignKey':'SubjectId'});db[_0x5082('0xb5')][_0x5082('0x113')](db[_0x5082('0xb5')],{'as':_0x5082('0x1be'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xb5')]['hasMany'](db[_0x5082('0xb5')],{'as':_0x5082('0x1bf'),'foreignKey':'FieldId'});db['ZendeskField'][_0x5082('0x11f')](db[_0x5082('0x99')],{'as':_0x5082('0x99'),'foreignKey':_0x5082('0x1c0')});db[_0x5082('0xb6')][_0x5082('0x113')](db[_0x5082('0xb8')],{'as':_0x5082('0x1c2'),'onDelete':'cascade','foreignKey':_0x5082('0x1b7')});db[_0x5082('0xb8')]['hasMany'](db[_0x5082('0xba')],{'as':_0x5082('0x1b8'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b9')});db['FreshdeskConfiguration'][_0x5082('0x113')](db[_0x5082('0xba')],{'as':_0x5082('0x1ba'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xb8')][_0x5082('0x113')](db['FreshdeskField'],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':'FieldId'});db[_0x5082('0xb8')][_0x5082('0x11f')](db[_0x5082('0xb6')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0xb8')]['belongsToMany'](db[_0x5082('0x8f')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x5082('0xba')][_0x5082('0x113')](db[_0x5082('0xba')],{'as':_0x5082('0x1bd'),'foreignKey':'SubjectId'});db[_0x5082('0xba')][_0x5082('0x113')](db[_0x5082('0xba')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x5082('0xba')][_0x5082('0x113')](db['FreshdeskField'],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xba')][_0x5082('0x11f')](db[_0x5082('0x99')],{'as':_0x5082('0x99'),'foreignKey':_0x5082('0x1c0')});db[_0x5082('0xbc')][_0x5082('0x113')](db[_0x5082('0xbe')],{'as':_0x5082('0x1c2'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0xbe')][_0x5082('0x113')](db[_0x5082('0xc0')],{'as':_0x5082('0x1b8'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xbe')][_0x5082('0x113')](db[_0x5082('0xc0')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['VtigerConfiguration'][_0x5082('0x113')](db[_0x5082('0xc0')],{'as':_0x5082('0x1b3'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xbe')][_0x5082('0x11f')](db[_0x5082('0xbc')],{'as':_0x5082('0x167'),'foreignKey':'AccountId'});db['VtigerField'][_0x5082('0x113')](db['VtigerField'],{'as':_0x5082('0x1bd'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xc0')][_0x5082('0x113')](db[_0x5082('0xc0')],{'as':'Description','foreignKey':_0x5082('0x1bb')});db['VtigerField'][_0x5082('0x113')](db[_0x5082('0xc0')],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xc0')]['belongsTo'](db[_0x5082('0x99')],{'as':_0x5082('0x99'),'foreignKey':_0x5082('0x1c0')});db[_0x5082('0xc1')][_0x5082('0x113')](db[_0x5082('0xc3')],{'as':_0x5082('0x1c2'),'onDelete':_0x5082('0x112'),'foreignKey':'AccountId'});db[_0x5082('0xc3')]['hasMany'](db[_0x5082('0x1c9')],{'as':_0x5082('0x1b8'),'foreignKey':'SubjectId'});db[_0x5082('0xc3')][_0x5082('0x113')](db[_0x5082('0x1c9')],{'as':'Descriptions','foreignKey':_0x5082('0x1bb')});db[_0x5082('0xc3')][_0x5082('0x113')](db[_0x5082('0x1c9')],{'as':_0x5082('0x1b3'),'foreignKey':'FieldId'});db['ServicenowConfiguration'][_0x5082('0x11f')](db[_0x5082('0xc1')],{'as':_0x5082('0x167'),'foreignKey':'AccountId'});db[_0x5082('0x1c9')][_0x5082('0x113')](db[_0x5082('0x1c9')],{'as':_0x5082('0x1bd'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0x1c9')]['hasMany'](db['ServicenowField'],{'as':_0x5082('0x1be'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0x1c9')][_0x5082('0x113')](db['ServicenowField'],{'as':_0x5082('0x1bf'),'foreignKey':'FieldId'});db[_0x5082('0x1c9')][_0x5082('0x11f')](db['Variable'],{'as':'Variable','foreignKey':_0x5082('0x1c0')});db['Dynamics365Account']['hasMany'](db['Dynamics365Configuration'],{'as':_0x5082('0x1c2'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1b7')});db[_0x5082('0x1ca')][_0x5082('0x11f')](db[_0x5082('0x106')],{'as':_0x5082('0x106'),'foreignKey':'CloudProviderId'});db[_0x5082('0x1cb')][_0x5082('0x113')](db[_0x5082('0xc8')],{'as':_0x5082('0x1b8'),'onDelete':'cascade','foreignKey':_0x5082('0x1b9')});db[_0x5082('0x1cb')][_0x5082('0x113')](db[_0x5082('0xc8')],{'as':_0x5082('0x1ba'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0x1cb')][_0x5082('0x113')](db[_0x5082('0xc8')],{'as':_0x5082('0x1b3'),'onDelete':_0x5082('0x112'),'foreignKey':'FieldId'});db[_0x5082('0x1cb')][_0x5082('0x11f')](db[_0x5082('0x1ca')],{'as':'Account','foreignKey':_0x5082('0x1b7')});db[_0x5082('0xc8')]['hasMany'](db[_0x5082('0xc8')],{'as':_0x5082('0x1bd'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xc8')]['hasMany'](db['Dynamics365Field'],{'as':_0x5082('0x1be'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xc8')][_0x5082('0x113')](db[_0x5082('0xc8')],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db[_0x5082('0xc8')][_0x5082('0x11f')](db[_0x5082('0x99')],{'as':'Variable','foreignKey':_0x5082('0x1c0')});db[_0x5082('0x1cc')][_0x5082('0x113')](db[_0x5082('0xcb')],{'as':_0x5082('0x1c2'),'onDelete':'cascade','foreignKey':_0x5082('0x1b7')});db['FreshsalesConfiguration'][_0x5082('0x113')](db[_0x5082('0xcd')],{'as':_0x5082('0x1b8'),'foreignKey':_0x5082('0x1b9')});db[_0x5082('0xcb')][_0x5082('0x113')](db[_0x5082('0xcd')],{'as':_0x5082('0x1ba'),'foreignKey':'DescriptionId'});db[_0x5082('0xcb')][_0x5082('0x113')](db[_0x5082('0xcd')],{'as':_0x5082('0x1b3'),'foreignKey':_0x5082('0x1bc')});db['FreshsalesConfiguration'][_0x5082('0x11f')](db[_0x5082('0x1cc')],{'as':_0x5082('0x167'),'foreignKey':'AccountId'});db['FreshsalesField']['hasMany'](db[_0x5082('0xcd')],{'as':_0x5082('0x1bd'),'foreignKey':'SubjectId'});db[_0x5082('0xcd')]['hasMany'](db[_0x5082('0xcd')],{'as':_0x5082('0x1be'),'foreignKey':_0x5082('0x1bb')});db[_0x5082('0xcd')]['hasMany'](db['FreshsalesField'],{'as':_0x5082('0x1bf'),'foreignKey':_0x5082('0x1bc')});db['FreshsalesField']['belongsTo'](db[_0x5082('0x99')],{'as':_0x5082('0x99'),'foreignKey':_0x5082('0x1c0')});db[_0x5082('0x1cd')][_0x5082('0x11f')](db[_0x5082('0x60')],{});db[_0x5082('0x1cd')][_0x5082('0x11f')](db['CmList'],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177')});db[_0x5082('0x1cd')]['belongsTo'](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db['ChatQueueReport']['belongsTo'](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db[_0x5082('0x188')],{});db[_0x5082('0x1cd')][_0x5082('0x11f')](db[_0x5082('0x12')],{});db[_0x5082('0x1cd')][_0x5082('0x11f')](db[_0x5082('0x69')],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x5082('0x112'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x5082('0x11f')](db['User'],{'onDelete':'cascade','foreignKey':_0x5082('0x1ce')});db['JscriptySessionReport'][_0x5082('0x113')](db[_0x5082('0x1cf')],{'foreignKey':_0x5082('0x1d0'),'onDelete':_0x5082('0x112')});db[_0x5082('0xd6')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x5082('0x1d0'),'onDelete':'cascade'});db[_0x5082('0xd8')]['belongsTo'](db[_0x5082('0x4f')],{});db[_0x5082('0xd8')]['belongsTo'](db[_0x5082('0x14a')],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177')});db['SmsQueueReport'][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db[_0x5082('0xd8')][_0x5082('0x11f')](db[_0x5082('0x52')],{});db[_0x5082('0xd8')]['belongsTo'](db[_0x5082('0x54')],{});db['SmsQueueReport'][_0x5082('0x11f')](db[_0x5082('0x12')],{});db[_0x5082('0xd8')]['belongsTo'](db[_0x5082('0x56')],{});db[_0x5082('0x1d1')][_0x5082('0x113')](db[_0x5082('0xd6')],{'foreignKey':_0x5082('0x1d2')});db[_0x5082('0x1d1')][_0x5082('0x113')](db[_0x5082('0x1cf')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x5082('0x1d2')});db['Team'][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x127')});db[_0x5082('0xe5')][_0x5082('0x123')](db[_0x5082('0x1a')],{'through':'TeamVoiceQueue','as':_0x5082('0x12b')});db[_0x5082('0xe5')][_0x5082('0x123')](db[_0x5082('0x3c')],{'through':'team_has_mail_queues','as':_0x5082('0x1d3')});db['Team'][_0x5082('0x123')](db['ChatQueue'],{'through':_0x5082('0x1d4'),'as':_0x5082('0x1d5')});db[_0x5082('0xe5')][_0x5082('0x123')](db[_0x5082('0x16f')],{'through':'team_has_fax_queues','as':_0x5082('0x1d6')});db[_0x5082('0xe5')][_0x5082('0x123')](db[_0x5082('0x56')],{'through':_0x5082('0x17c'),'as':_0x5082('0x12d')});db[_0x5082('0xe5')][_0x5082('0x123')](db[_0x5082('0x12e')],{'through':'team_has_openchannel_queues','as':_0x5082('0x1d7')});db[_0x5082('0xe5')]['belongsToMany'](db[_0x5082('0x105')],{'through':_0x5082('0x1d8'),'as':_0x5082('0x12f')});db[_0x5082('0xe5')][_0x5082('0x123')](db[_0x5082('0xf5')],{'through':'TeamVoicePrefix','as':_0x5082('0x12c')});db[_0x5082('0xe7')]['hasMany'](db[_0x5082('0x73')],{'as':_0x5082('0x141'),'foreignKey':_0x5082('0x197')});db[_0x5082('0xe7')]['hasMany'](db[_0x5082('0x117')],{'as':_0x5082('0x142'),'foreignKey':'CampaignId'});db[_0x5082('0xe7')][_0x5082('0x113')](db[_0x5082('0x78')],{'as':_0x5082('0x143'),'foreignKey':'CampaignId'});db[_0x5082('0xe7')]['hasMany'](db['CmHopperBlack'],{'as':_0x5082('0x1d9'),'foreignKey':_0x5082('0x197')});db['Campaign'][_0x5082('0x11f')](db[_0x5082('0x2a')],{'as':_0x5082('0x2a'),'foreignKey':_0x5082('0x145')});db[_0x5082('0xe7')][_0x5082('0x11f')](db[_0x5082('0x2a')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x5082('0xe7')][_0x5082('0x11f')](db[_0x5082('0x85')],{'as':'Interval','foreignKey':_0x5082('0x148')});db['Campaign']['belongsTo'](db['SquareProject'],{'as':'SquareProject','foreignKey':_0x5082('0x1da')});db[_0x5082('0xe7')][_0x5082('0x123')](db[_0x5082('0x14a')],{'as':_0x5082('0x125'),'through':_0x5082('0x1db')});db[_0x5082('0xe7')][_0x5082('0x123')](db['CmList'],{'as':_0x5082('0x14c'),'through':_0x5082('0x1dc')});db[_0x5082('0xeb')][_0x5082('0x11f')](db[_0x5082('0x68')],{'as':_0x5082('0x68'),'foreignKey':'ChatOfflineMessageId'});db[_0x5082('0xee')][_0x5082('0x11f')](db[_0x5082('0x159')],{});db[_0x5082('0xee')][_0x5082('0x11f')](db[_0x5082('0x3f')],{});db[_0x5082('0xee')][_0x5082('0x11f')](db['MailAccount'],{'foreignKey':_0x5082('0x1dd'),'as':_0x5082('0x1de')});db[_0x5082('0xee')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':'FromUserId','as':_0x5082('0x1df')});db[_0x5082('0xee')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':'ToUserId','as':_0x5082('0x1e0')});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0x5082('0x1e1'),'as':_0x5082('0x1e2')});db[_0x5082('0xee')][_0x5082('0x11f')](db['MailAccount'],{'foreignKey':_0x5082('0x1e3'),'as':_0x5082('0x1e4')});db[_0x5082('0x1e5')][_0x5082('0x11f')](db['ChatMessage'],{});db['ChatTransferReport'][_0x5082('0x11f')](db[_0x5082('0x65')],{});db[_0x5082('0x1e5')][_0x5082('0x11f')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x5082('0x1de')});db[_0x5082('0x1e5')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db['ChatTransferReport'][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':_0x5082('0x1e6'),'as':_0x5082('0x1e0')});db[_0x5082('0x1e5')][_0x5082('0x11f')](db[_0x5082('0x69')],{'foreignKey':_0x5082('0x1e7'),'as':_0x5082('0x1e2')});db[_0x5082('0x1e5')][_0x5082('0x11f')](db['ChatWebsite'],{'foreignKey':_0x5082('0x1e8'),'as':_0x5082('0x1e4')});db[_0x5082('0x1e9')][_0x5082('0x11f')](db['FaxMessage'],{});db[_0x5082('0x1e9')][_0x5082('0x11f')](db['FaxInteraction'],{});db[_0x5082('0x1e9')][_0x5082('0x11f')](db['FaxAccount'],{'foreignKey':_0x5082('0x1ea'),'as':_0x5082('0x1de')});db[_0x5082('0x1e9')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':_0x5082('0x1eb'),'as':_0x5082('0x1df')});db[_0x5082('0x1e9')][_0x5082('0x11f')](db['User'],{'foreignKey':_0x5082('0x1e6'),'as':_0x5082('0x1e0')});db['FaxTransferReport']['belongsTo'](db[_0x5082('0x16f')],{'foreignKey':_0x5082('0x1ec'),'as':_0x5082('0x1e2')});db['FaxTransferReport'][_0x5082('0x11f')](db[_0x5082('0x132')],{'foreignKey':_0x5082('0x1ed'),'as':'ToAccount'});db[_0x5082('0xf2')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x5082('0xf2')][_0x5082('0x11f')](db['OpenchannelInteraction'],{});db[_0x5082('0xf2')]['belongsTo'](db[_0x5082('0x58')],{'foreignKey':_0x5082('0x1ee'),'as':_0x5082('0x1de')});db[_0x5082('0xf2')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':'FromUserId','as':_0x5082('0x1df')});db[_0x5082('0xf2')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':'ToUserId','as':_0x5082('0x1e0')});db['OpenchannelTransferReport'][_0x5082('0x11f')](db[_0x5082('0x12e')],{'foreignKey':_0x5082('0x1ef'),'as':_0x5082('0x1e2')});db['OpenchannelTransferReport'][_0x5082('0x11f')](db[_0x5082('0x58')],{'foreignKey':_0x5082('0x1f0'),'as':_0x5082('0x1e4')});db[_0x5082('0x1f1')][_0x5082('0x11f')](db[_0x5082('0x54')],{});db[_0x5082('0x1f1')][_0x5082('0x11f')](db[_0x5082('0x52')],{});db['SmsTransferReport'][_0x5082('0x11f')](db[_0x5082('0x4f')],{'foreignKey':_0x5082('0x1f2'),'as':'FromAccount'});db[_0x5082('0x1f1')][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':'FromUserId','as':_0x5082('0x1df')});db[_0x5082('0x1f1')][_0x5082('0x11f')](db['User'],{'foreignKey':_0x5082('0x1e6'),'as':_0x5082('0x1e0')});db[_0x5082('0x1f1')][_0x5082('0x11f')](db['SmsQueue'],{'foreignKey':_0x5082('0x1f3'),'as':_0x5082('0x1e2')});db[_0x5082('0x1f1')][_0x5082('0x11f')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x5082('0x1e4')});db[_0x5082('0x14a')][_0x5082('0x113')](db[_0x5082('0x81')],{'as':'Dispositions','foreignKey':_0x5082('0x177'),'onDelete':_0x5082('0x112')});db[_0x5082('0x14a')][_0x5082('0x113')](db['CmCustomField'],{'as':_0x5082('0x1f4'),'foreignKey':'ListId'});db[_0x5082('0x14a')][_0x5082('0x113')](db[_0x5082('0x71')],{'as':_0x5082('0x18e'),'onDelete':_0x5082('0x112'),'foreignKey':_0x5082('0x177')});db['CmList'][_0x5082('0x113')](db[_0x5082('0x117')],{'as':_0x5082('0x142'),'foreignKey':_0x5082('0x177')});db[_0x5082('0x14a')]['hasMany'](db[_0x5082('0x78')],{'as':_0x5082('0x118'),'foreignKey':_0x5082('0x177')});db[_0x5082('0x14a')][_0x5082('0x113')](db[_0x5082('0x7a')],{'as':_0x5082('0x7a'),'foreignKey':_0x5082('0x177')});db[_0x5082('0x14a')]['belongsToMany'](db[_0x5082('0x1a')],{'as':_0x5082('0x1f5'),'through':_0x5082('0x1f6')});db[_0x5082('0x14a')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':'cm_user_has_lists'});db[_0x5082('0xf5')][_0x5082('0x113')](db['VoiceExtension'],{'as':_0x5082('0x116'),'onDelete':'cascade'});db['VoicePrefix'][_0x5082('0x123')](db[_0x5082('0x12')],{'as':'Agents','through':'UserVoicePrefix'});db['VoicePrefix'][_0x5082('0x123')](db[_0x5082('0xe5')],{'through':_0x5082('0x10a'),'as':_0x5082('0x14b')});db[_0x5082('0xf7')][_0x5082('0x113')](db[_0x5082('0x12')],{'as':_0x5082('0x174'),'foreignKey':_0x5082('0x120')});db['UserProfile'][_0x5082('0x113')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x5082('0x120'),'onDelete':'cascade'});db[_0x5082('0xf9')][_0x5082('0x113')](db[_0x5082('0x1f7')],{'as':'Resources','foreignKey':_0x5082('0x1f8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x5082('0x113')](db[_0x5082('0x81')],{'as':_0x5082('0x16b'),'foreignKey':'WhatsappAccountId','onDelete':_0x5082('0x112')});db[_0x5082('0xfd')]['hasMany'](db['CannedAnswer'],{'as':_0x5082('0x16d'),'foreignKey':_0x5082('0x1f9')});db[_0x5082('0xfd')][_0x5082('0x113')](db[_0x5082('0x101')],{'as':_0x5082('0x14e'),'foreignKey':_0x5082('0x1f9')});db[_0x5082('0xfd')][_0x5082('0x113')](db[_0x5082('0x100')],{'as':_0x5082('0x15a')});db[_0x5082('0xfd')][_0x5082('0x113')](db[_0x5082('0x1fa')],{'as':'Applications','foreignKey':'WhatsappAccountId','onDelete':_0x5082('0x112')});db[_0x5082('0xfd')][_0x5082('0x11f')](db[_0x5082('0x14a')],{'as':_0x5082('0x15b'),'foreignKey':_0x5082('0x177')});db[_0x5082('0xfd')][_0x5082('0x11f')](db[_0x5082('0x87')],{'as':_0x5082('0x15e'),'foreignKey':_0x5082('0x149')});db[_0x5082('0xfd')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x1fb')});db['WhatsappApplication'][_0x5082('0x11f')](db[_0x5082('0x12')],{'onDelete':'restrict'});db[_0x5082('0x1fa')]['belongsTo'](db[_0x5082('0x105')],{'onDelete':_0x5082('0x158')});db[_0x5082('0x1fa')][_0x5082('0x11f')](db[_0x5082('0xfd')],{'onDelete':_0x5082('0x158')});db['WhatsappApplication'][_0x5082('0x11f')](db[_0x5082('0x85')],{'onDelete':_0x5082('0x158'),'foreignKey':_0x5082('0x148')});db[_0x5082('0x1fa')][_0x5082('0x11f')](db[_0x5082('0x8f')],{'onDelete':'restrict','foreignKey':_0x5082('0x168')});db[_0x5082('0x100')][_0x5082('0x113')](db['WhatsappMessage'],{'as':_0x5082('0x14e'),'onDelete':'cascade','foreignKey':_0x5082('0x1fc')});db['WhatsappInteraction'][_0x5082('0x11f')](db['WhatsappAccount'],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x1f9')});db[_0x5082('0x100')][_0x5082('0x11f')](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db[_0x5082('0x100')]['belongsTo'](db[_0x5082('0x12')],{'as':_0x5082('0x172'),'foreignKey':_0x5082('0x110')});db[_0x5082('0x100')][_0x5082('0x123')](db[_0x5082('0x8f')],{'through':_0x5082('0x1a9'),'as':'Tags'});db[_0x5082('0x100')][_0x5082('0x123')](db['Tag'],{'through':_0x5082('0x1a9'),'as':_0x5082('0x162')});db[_0x5082('0x100')][_0x5082('0x123')](db['User'],{'as':_0x5082('0x174'),'through':_0x5082('0x12a'),'foreignKey':_0x5082('0x1fc')});db['WhatsappMessage'][_0x5082('0x11f')](db['User'],{'as':_0x5082('0x12')});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x5082('0x112'),'as':_0x5082('0x165')});db[_0x5082('0x101')][_0x5082('0x11f')](db[_0x5082('0x100')],{'onDelete':'cascade','as':_0x5082('0x166'),'foreignKey':_0x5082('0x1fc')});db[_0x5082('0x101')][_0x5082('0x11f')](db[_0x5082('0xfd')],{'as':_0x5082('0x167'),'foreignKey':_0x5082('0x1f9')});db[_0x5082('0x102')]['belongsTo'](db[_0x5082('0xfd')],{});db['WhatsappQueueReport'][_0x5082('0x11f')](db[_0x5082('0x14a')],{'as':'List','foreignKey':_0x5082('0x177')});db[_0x5082('0x102')]['belongsTo'](db[_0x5082('0x71')],{'as':_0x5082('0x165'),'foreignKey':_0x5082('0x153')});db['WhatsappQueueReport'][_0x5082('0x11f')](db[_0x5082('0x100')],{});db[_0x5082('0x102')][_0x5082('0x11f')](db[_0x5082('0x105')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x5082('0x101')],{});db[_0x5082('0x102')][_0x5082('0x11f')](db['User'],{});db['WhatsappTransferReport'][_0x5082('0x11f')](db[_0x5082('0x101')],{});db[_0x5082('0x103')][_0x5082('0x11f')](db[_0x5082('0x100')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x5082('0xfd')],{'foreignKey':_0x5082('0x1fd'),'as':_0x5082('0x1de')});db[_0x5082('0x103')][_0x5082('0x11f')](db[_0x5082('0xfd')],{'foreignKey':_0x5082('0x1fe'),'as':'ToAccount'});db[_0x5082('0x103')][_0x5082('0x11f')](db[_0x5082('0x105')],{'foreignKey':_0x5082('0x1ff'),'as':_0x5082('0x1e2')});db['WhatsappTransferReport'][_0x5082('0x11f')](db['User'],{'foreignKey':_0x5082('0x1eb'),'as':_0x5082('0x1df')});db['WhatsappTransferReport'][_0x5082('0x11f')](db[_0x5082('0x12')],{'foreignKey':_0x5082('0x1e6'),'as':_0x5082('0x1e0')});db[_0x5082('0x105')][_0x5082('0x123')](db[_0x5082('0x12')],{'as':_0x5082('0x15f'),'through':_0x5082('0x38'),'foreignKey':'WhatsappQueueId'});db[_0x5082('0x105')][_0x5082('0x123')](db[_0x5082('0xe5')],{'through':_0x5082('0x1d8'),'as':_0x5082('0x14b')});db[_0x5082('0x10d')][_0x5082('0x11f')](db['User'],{'as':_0x5082('0x200'),'foreignKey':_0x5082('0x110'),'onDelete':_0x5082('0x112'),'hooks':!![]});db[_0x5082('0x106')][_0x5082('0x10f')](db[_0x5082('0x1ca')],{'as':'Dynamics365Account','onDelete':_0x5082('0x158')});db[_0x5082('0x106')][_0x5082('0x10f')](db['MailServerIn'],{'as':_0x5082('0x201'),'onDelete':'restrict'});db[_0x5082('0x106')][_0x5082('0x10f')](db[_0x5082('0x157')],{'as':'Smtp','onDelete':_0x5082('0x158')});module[_0x5082('0x202')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xb72a=['Interactions','MailApplication','ListId','TemplateId','team_has_mail_queues','Teams','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatOfflineMessage','TagId','MailQueueReport','Contact','DashboardItem','Items','FaxAccountId','Answers','Exntensions','List','FaxInteractionId','fax_interaction_has_tags','AttachmentId','Dispositions','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatWebsiteId','user_has_chat_websites','Agent','Queue','Website','chat_interaction_has_tags','ChatInteractionId','ChatOfflineMessageId','team_has_chat_queues','CompanyId','Phones','CmContactId','JscriptySessions','Company','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','Schedule','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','Subject','FieldId','Variable','Descriptions','Description','Field','VariableId','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','ChatQueueReport','FromId','SessionId','ProjectId','team_has_fax_queues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Extensions','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','xcall','name','utf8_general_ci','database','password','username','options','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','VoiceMail','cascade','UserId','Recordings','hasMany','VoiceExtension','HopperFinals','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotification','UserNotifications','SenderId','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','MailQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','UserWhatsappQueue','ChatWebsites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','Members','CmHopper','VoiceQueueId','HopperHistories','CmHopperBlack','HopperBlacks','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','MailAccountId','CloudProviderId','restrict','MailServerOut','Imap','hasOne','Smtp','Messages'];(function(_0xc2e46e,_0x3b979c){var _0x1a355d=function(_0x2cd000){while(--_0x2cd000){_0xc2e46e['push'](_0xc2e46e['shift']());}};_0x1a355d(++_0x3b979c);}(_0xb72a,0x8e));var _0xab72=function(_0x5c416d,_0x1452fc){_0x5c416d=_0x5c416d-0x0;var _0x27f533=_0xb72a[_0x5c416d];return _0x27f533;};'use strict';var config=require(_0xab72('0x0'));var Sequelize=require(_0xab72('0x1'));var _=require(_0xab72('0x2'));var jstz=require(_0xab72('0x3'));var timezone=jstz[_0xab72('0x4')]();config[_0xab72('0x1')]=_[_0xab72('0x5')](config[_0xab72('0x1')],{'database':_0xab72('0x6'),'username':'xcall','password':_0xab72('0x7'),'options':{'host':_0xab72('0x8'),'port':0xcea,'dialect':_0xab72('0x9'),'dialectOptions':{'charset':_0xab72('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xab72('0xb'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0xab72('0x5')](config[_0xab72('0xc')],{'database':_0xab72('0x6'),'username':_0xab72('0xd'),'password':_0xab72('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xab72('0x9'),'dialectOptions':{'charset':_0xab72('0xa')},'logging':![],'timezone':timezone[_0xab72('0xe')](),'define':{'charset':_0xab72('0xb'),'collate':_0xab72('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xab72('0x10')],config[_0xab72('0x1')]['username'],config[_0xab72('0x1')][_0xab72('0x11')],config[_0xab72('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xab72('0xc')][_0xab72('0x10')],config[_0xab72('0xc')][_0xab72('0x12')],config[_0xab72('0xc')][_0xab72('0x11')],config[_0xab72('0xc')][_0xab72('0x13')])};db[_0xab72('0x14')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x16'));db['VoiceChanSpy']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x17'));db[_0xab72('0x18')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x19'));db['VoiceExtension']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x1a'));db['VoiceMusicOnHold']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x1b'));db[_0xab72('0x1c')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x1d'));db[_0xab72('0x1e')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x1f'));db[_0xab72('0x20')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x21'));db['VoiceMail']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x22'));db['VoiceMailMessage']=db[_0xab72('0x1')]['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0xab72('0x23')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x24'));db[_0xab72('0x25')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x26'));db[_0xab72('0x27')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x28'));db[_0xab72('0x29')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x2a'));db[_0xab72('0x2b')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x2c'));db[_0xab72('0x2d')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x2e'));db['VoiceTransferReport']=db['sequelize']['import'](_0xab72('0x2f'));db[_0xab72('0x30')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xab72('0x31')]=db[_0xab72('0x1')]['import'](_0xab72('0x32'));db[_0xab72('0x33')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x34'));db[_0xab72('0x35')]=db['sequelize'][_0xab72('0x15')]('../api/userMailQueue/userMailQueue.model');db[_0xab72('0x36')]=db[_0xab72('0x1')]['import'](_0xab72('0x37'));db[_0xab72('0x38')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0xab72('0x39')]=db[_0xab72('0x1')]['import'](_0xab72('0x3a'));db['UserWhatsappQueue']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x3b'));db['MailServerIn']=db[_0xab72('0x1')]['import'](_0xab72('0x3c'));db['MailServerOut']=db['sequelize'][_0xab72('0x15')](_0xab72('0x3d'));db[_0xab72('0x3e')]=db['sequelize'][_0xab72('0x15')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x3f'));db[_0xab72('0x40')]=db['sequelize']['import']('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db['sequelize'][_0xab72('0x15')](_0xab72('0x41'));db[_0xab72('0x42')]=db[_0xab72('0x1')]['import'](_0xab72('0x43'));db['MailApplication']=db[_0xab72('0x1')][_0xab72('0x15')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db['sequelize'][_0xab72('0x15')]('../api/mailQueueReport/mailQueueReport.model');db[_0xab72('0x44')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x45'));db['DashboardItem']=db['sequelize'][_0xab72('0x15')](_0xab72('0x46'));db[_0xab72('0x47')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x48'));db[_0xab72('0x49')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x4a'));db[_0xab72('0x4b')]=db[_0xab72('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db[_0xab72('0x4c')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x4d'));db[_0xab72('0x4e')]=db[_0xab72('0x1')]['import'](_0xab72('0x4f'));db[_0xab72('0x50')]=db[_0xab72('0x1')]['import'](_0xab72('0x51'));db[_0xab72('0x52')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x53'));db['SmsApplication']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x54'));db[_0xab72('0x55')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x56'));db[_0xab72('0x57')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/smsMessage/smsMessage.model');db[_0xab72('0x58')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x59'));db[_0xab72('0x5a')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x5b'));db[_0xab72('0x5c')]=db['sequelize']['import'](_0xab72('0x5d'));db[_0xab72('0x5e')]=db['sequelize']['import'](_0xab72('0x5f'));db[_0xab72('0x60')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0xab72('0x61')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0xab72('0x62')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x63'));db[_0xab72('0x64')]=db['sequelize']['import'](_0xab72('0x65'));db[_0xab72('0x66')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/chatApplication/chatApplication.model');db[_0xab72('0x67')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x68'));db[_0xab72('0x69')]=db[_0xab72('0x1')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db[_0xab72('0x1')][_0xab72('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize']['import']('../api/chatQueue/chatQueue.model');db[_0xab72('0x6a')]=db[_0xab72('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0xab72('0x6b')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x6c'));db[_0xab72('0x6d')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x6e'));db[_0xab72('0x6f')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x70'));db['CmHopper']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x71'));db['CmHopperBlack']=db[_0xab72('0x1')]['import'](_0xab72('0x72'));db[_0xab72('0x73')]=db['sequelize']['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xab72('0x74')]=db[_0xab72('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xab72('0x75')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x76'));db[_0xab72('0x77')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x78'));db[_0xab72('0x79')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x7a'));db[_0xab72('0x7b')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/automation/automation.model');db[_0xab72('0x7c')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x7d'));db[_0xab72('0x7e')]=db[_0xab72('0x1')]['import'](_0xab72('0x7f'));db[_0xab72('0x80')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x81'));db[_0xab72('0x82')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x83'));db[_0xab72('0x84')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x85'));db[_0xab72('0x86')]=db[_0xab72('0x1')]['import'](_0xab72('0x87'));db[_0xab72('0x88')]=db[_0xab72('0x1')]['import'](_0xab72('0x89'));db['Schedule']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x8a'));db[_0xab72('0x8b')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x8c'));db[_0xab72('0x8d')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/tag/tag.model');db[_0xab72('0x8e')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x8f'));db[_0xab72('0x90')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x91'));db[_0xab72('0x92')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x93'));db[_0xab72('0x94')]=db[_0xab72('0x1')]['import'](_0xab72('0x95'));db[_0xab72('0x96')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x97'));db['Variable']=db[_0xab72('0x1')]['import'](_0xab72('0x98'));db[_0xab72('0x99')]=db[_0xab72('0x1')]['import'](_0xab72('0x9a'));db['IntegrationReport']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x9b'));db[_0xab72('0x9c')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x9d'));db[_0xab72('0x9e')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x9f'));db[_0xab72('0xa0')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xa1'));db[_0xab72('0xa2')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xa3'));db['AnalyticFieldReport']=db[_0xab72('0x1')]['import'](_0xab72('0xa4'));db[_0xab72('0xa5')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xa6'));db[_0xab72('0xa7')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xa8'));db[_0xab72('0xa9')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xab72('0xaa')]=db[_0xab72('0x1')]['import'](_0xab72('0xab'));db[_0xab72('0xac')]=db['sequelize'][_0xab72('0x15')](_0xab72('0xad'));db[_0xab72('0xae')]=db['sequelize'][_0xab72('0x15')](_0xab72('0xaf'));db[_0xab72('0xb0')]=db[_0xab72('0x1')]['import'](_0xab72('0xb1'));db[_0xab72('0xb2')]=db[_0xab72('0x1')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xab72('0xb3')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xb4'));db[_0xab72('0xb5')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xb6'));db['ZohoAccount']=db[_0xab72('0x1')][_0xab72('0x15')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db['sequelize']['import'](_0xab72('0xb7'));db[_0xab72('0xb8')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/intZohoField/intZohoField.model');db[_0xab72('0xb9')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xba'));db[_0xab72('0xbb')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xbc'));db[_0xab72('0xbd')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xbe'));db[_0xab72('0xbf')]=db['sequelize'][_0xab72('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xab72('0x1')][_0xab72('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xab72('0xc0')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xc1'));db[_0xab72('0xc2')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xc3'));db[_0xab72('0xc4')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xc5'));db['VtigerField']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xc6'));db[_0xab72('0xc7')]=db['sequelize'][_0xab72('0x15')](_0xab72('0xc8'));db[_0xab72('0xc9')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xab72('0xca')]=db[_0xab72('0x1')]['import'](_0xab72('0xcb'));db[_0xab72('0xcc')]=db[_0xab72('0x1')]['import'](_0xab72('0xcd'));db[_0xab72('0xce')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xcf'));db[_0xab72('0xd0')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xd1'));db[_0xab72('0xd2')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xd3'));db[_0xab72('0xd4')]=db[_0xab72('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xab72('0xd5')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xd6'));db[_0xab72('0x99')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x9a'));db['Network']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xd7'));db['ChatQueueReport']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xd8'));db[_0xab72('0xd9')]=db['sequelize']['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xab72('0xda')]=db[_0xab72('0x1')]['import'](_0xab72('0xdb'));db[_0xab72('0xdc')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xdd'));db[_0xab72('0xde')]=db['sequelize'][_0xab72('0x15')](_0xab72('0xdf'));db[_0xab72('0xe0')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xe1'));db[_0xab72('0xe2')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xe3'));db[_0xab72('0xe4')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/squareReportDetail/squareReportDetail.model');db[_0xab72('0xe5')]=db[_0xab72('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0xab72('0xe6')]=db[_0xab72('0x1')]['import'](_0xab72('0xe7'));db[_0xab72('0xe8')]=db['sequelize'][_0xab72('0x15')](_0xab72('0xe9'));db[_0xab72('0xea')]=db[_0xab72('0x1')]['import'](_0xab72('0xeb'));db[_0xab72('0xec')]=db[_0xab72('0x1')]['import'](_0xab72('0xed'));db['SquareMessage']=db[_0xab72('0x1')]['import'](_0xab72('0xee'));db[_0xab72('0xef')]=db['sequelize'][_0xab72('0x15')]('../api/team/team.model');db[_0xab72('0xf0')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xf1'));db[_0xab72('0xf2')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xf3'));db[_0xab72('0xf4')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xf5'));db[_0xab72('0xf6')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xf7'));db[_0xab72('0xf8')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/plugin/plugin.model');db[_0xab72('0xf9')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xfa'));db['ChatTransferReport']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xfb'));db[_0xab72('0xfc')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0xfd'));db[_0xab72('0xfe')]=db[_0xab72('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0xab72('0x15')](_0xab72('0xff'));db[_0xab72('0x100')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x101'));db[_0xab72('0x102')]=db['sequelize'][_0xab72('0x15')](_0xab72('0x103'));db[_0xab72('0x104')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/userProfile/userProfile.model');db[_0xab72('0x105')]=db[_0xab72('0x1')]['import'](_0xab72('0x106'));db['UserProfileResource']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x107'));db['UserNotification']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x108'));db['WhatsappAccount']=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x109'));db[_0xab72('0x10a')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x10b'));db[_0xab72('0x10c')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x10d'));db[_0xab72('0x10e')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x10f'));db[_0xab72('0x110')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x111'));db[_0xab72('0x112')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x113'));db['WhatsappQueue']=db['sequelize'][_0xab72('0x15')]('../api/whatsappQueue/whatsappQueue.model');db[_0xab72('0x114')]=db['sequelize'][_0xab72('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0xab72('0x115')]=db[_0xab72('0x1')][_0xab72('0x15')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xab72('0x116')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x117'));db[_0xab72('0x118')]=db[_0xab72('0x1')][_0xab72('0x15')](_0xab72('0x119'));db[_0xab72('0x11a')]=db[_0xab72('0x1')]['import'](_0xab72('0x11b'));db[_0xab72('0x11c')]=db['sequelize'][_0xab72('0x15')]('../api/mailInteractionHasTag/mailInteractionHasTag.model');db['User']['hasOne'](db[_0xab72('0x11d')],{'as':_0xab72('0x11d'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')]['hasOne'](db[_0xab72('0x11a')],{'as':'userSetting','onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x11f')});db['User']['hasMany'](db['VoiceRecording'],{'as':_0xab72('0x120'),'foreignKey':'UserId'});db[_0xab72('0x14')][_0xab72('0x121')](db[_0xab72('0x30')],{'as':'VoiceQueuesRt','foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')]['hasMany'](db[_0xab72('0x122')],{'as':'Extensions','onDelete':_0xab72('0x11e'),'hooks':!![]});db['User'][_0xab72('0x121')](db[_0xab72('0x73')],{'as':_0xab72('0x123'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')][_0xab72('0x121')](db[_0xab72('0x74')],{'as':_0xab72('0x124'),'foreignKey':'UserId'});db[_0xab72('0x14')][_0xab72('0x121')](db[_0xab72('0x75')],{'as':'ReportAgentPreview','foreignKey':_0xab72('0x11f')});db['User'][_0xab72('0x121')](db[_0xab72('0x5e')],{'as':'OpenchannelInteractions','foreignKey':_0xab72('0x11f')});db['User'][_0xab72('0x121')](db[_0xab72('0x67')],{'as':_0xab72('0x125'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')][_0xab72('0x121')](db[_0xab72('0x55')],{'as':_0xab72('0x126'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')][_0xab72('0x121')](db[_0xab72('0x4b')],{'as':_0xab72('0x127'),'foreignKey':_0xab72('0x11f')});db['User'][_0xab72('0x121')](db[_0xab72('0x128')],{'as':_0xab72('0x129'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')][_0xab72('0x121')](db[_0xab72('0x10c')],{'as':_0xab72('0x12a'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x14')]['hasMany'](db[_0xab72('0x12b')],{'as':_0xab72('0x12c'),'foreignKey':_0xab72('0x12d')});db['User'][_0xab72('0x121')](db['CmHopper'],{'as':_0xab72('0x12e'),'foreignKey':_0xab72('0x11f'),'onDelete':_0xab72('0x12f')});db['User'][_0xab72('0x130')](db[_0xab72('0x104')],{'as':_0xab72('0x104'),'foreignKey':_0xab72('0x131')});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x6a')],{'as':_0xab72('0x133'),'through':_0xab72('0x134')});db[_0xab72('0x14')]['belongsToMany'](db[_0xab72('0x6f')],{'as':_0xab72('0x135'),'through':_0xab72('0x136')});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x100')],{'as':'Lists','through':_0xab72('0x137')});db['User'][_0xab72('0x132')](db[_0xab72('0xef')],{'through':_0xab72('0x138')});db[_0xab72('0x14')][_0xab72('0x132')](db['MailInteraction'],{'as':_0xab72('0x129'),'through':_0xab72('0x139')});db['User'][_0xab72('0x132')](db[_0xab72('0x67')],{'as':_0xab72('0x125'),'through':_0xab72('0x13a')});db[_0xab72('0x14')]['belongsToMany'](db[_0xab72('0x4b')],{'as':_0xab72('0x127'),'through':_0xab72('0x13b')});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x55')],{'as':_0xab72('0x126'),'through':_0xab72('0x13c')});db['User'][_0xab72('0x132')](db[_0xab72('0x5e')],{'as':'OpenchannelInteractions','through':_0xab72('0x13d')});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x10c')],{'as':_0xab72('0x12a'),'through':_0xab72('0x13e')});db['User'][_0xab72('0x132')](db[_0xab72('0x1c')],{'as':'VoiceQueues','through':_0xab72('0x31'),'required':![]});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x102')],{'as':_0xab72('0x13f'),'through':_0xab72('0x118'),'required':![]});db['User'][_0xab72('0x132')](db[_0xab72('0x140')],{'as':_0xab72('0x141'),'through':_0xab72('0x35'),'required':![]});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x142')],{'as':_0xab72('0x143'),'through':_0xab72('0x33'),'required':![],'hooks':!![]});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x4e')],{'as':_0xab72('0x144'),'through':'UserFaxQueue','required':![]});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x58')],{'as':_0xab72('0x145'),'through':_0xab72('0x38'),'required':![]});db[_0xab72('0x14')]['belongsToMany'](db['OpenchannelQueue'],{'as':_0xab72('0x146'),'through':'UserOpenchannelQueue','required':![]});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x147')],{'as':'WhatsappQueues','through':_0xab72('0x148'),'required':![]});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x100')],{'through':_0xab72('0x137')});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x62')],{'as':_0xab72('0x149'),'through':'user_has_chat_websites'});db[_0xab72('0x14')][_0xab72('0x132')](db[_0xab72('0x47')],{'as':_0xab72('0x14a'),'through':_0xab72('0x14b')});db['User'][_0xab72('0x132')](db[_0xab72('0x3e')],{'as':_0xab72('0x14c'),'through':_0xab72('0x14d')});db['User'][_0xab72('0x132')](db[_0xab72('0x5a')],{'as':_0xab72('0x14e'),'through':_0xab72('0x14f')});db[_0xab72('0x14')][_0xab72('0x132')](db['SmsAccount'],{'as':_0xab72('0x150'),'through':_0xab72('0x151')});db[_0xab72('0x14')]['belongsToMany'](db[_0xab72('0x152')],{'as':'WhatsappAccounts','through':_0xab72('0x153')});db[_0xab72('0x154')][_0xab72('0x121')](db[_0xab72('0x122')],{'as':_0xab72('0x155'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x156')});db[_0xab72('0x18')][_0xab72('0x121')](db[_0xab72('0x122')],{'onDelete':_0xab72('0x11e')});db[_0xab72('0x122')][_0xab72('0x121')](db['VoiceExtension'],{'as':_0xab72('0x157'),'onDelete':'cascade'});db[_0xab72('0x158')][_0xab72('0x132')](db[_0xab72('0x8b')],{'as':_0xab72('0x159'),'through':'moh_has_sounds'});db[_0xab72('0x1c')][_0xab72('0x121')](db[_0xab72('0x30')],{'as':_0xab72('0x15a'),'foreignKey':'VoiceQueueId'});db[_0xab72('0x1c')][_0xab72('0x121')](db[_0xab72('0x15b')],{'as':_0xab72('0x12e'),'foreignKey':_0xab72('0x15c')});db['VoiceQueue'][_0xab72('0x121')](db['CmHopperFinal'],{'as':_0xab72('0x123'),'foreignKey':_0xab72('0x15c')});db[_0xab72('0x1c')][_0xab72('0x121')](db[_0xab72('0x74')],{'as':_0xab72('0x15d'),'foreignKey':_0xab72('0x15c')});db[_0xab72('0x1c')][_0xab72('0x121')](db['ReportAgentPreview'],{'as':_0xab72('0x75'),'foreignKey':_0xab72('0x15c')});db[_0xab72('0x1c')][_0xab72('0x121')](db[_0xab72('0x15e')],{'as':_0xab72('0x15f'),'foreignKey':_0xab72('0x15c')});db[_0xab72('0x1c')][_0xab72('0x121')](db[_0xab72('0xde')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xab72('0x1c')][_0xab72('0x130')](db['Trunk'],{'as':_0xab72('0x2d'),'foreignKey':_0xab72('0x160')});db[_0xab72('0x1c')][_0xab72('0x130')](db[_0xab72('0x2d')],{'as':_0xab72('0x161'),'foreignKey':_0xab72('0x162')});db['VoiceQueue'][_0xab72('0x130')](db[_0xab72('0x82')],{'as':_0xab72('0x82'),'foreignKey':_0xab72('0x163')});db[_0xab72('0x1c')][_0xab72('0x130')](db[_0xab72('0x84')],{'as':_0xab72('0x164'),'foreignKey':_0xab72('0x165')});db[_0xab72('0x1c')][_0xab72('0x132')](db['CmList'],{'as':_0xab72('0x166'),'through':_0xab72('0x167')});db['VoiceQueue'][_0xab72('0x132')](db['User'],{'as':_0xab72('0x168'),'through':'UserVoiceQueue'});db[_0xab72('0x1c')][_0xab72('0x132')](db[_0xab72('0xef')],{'as':'Teams','through':_0xab72('0x115')});db[_0xab72('0x1c')]['belongsToMany'](db[_0xab72('0x100')],{'as':_0xab72('0x169'),'through':_0xab72('0x16a')});db['VoiceRecording'][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x14'),'foreignKey':'UserId'});db[_0xab72('0x20')][_0xab72('0x130')](db['User'],{'as':_0xab72('0x14'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x11d')][_0xab72('0x121')](db[_0xab72('0x16b')],{'as':'Messages','onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x16c'),'sourceKey':_0xab72('0x16d')});db[_0xab72('0x16b')][_0xab72('0x130')](db[_0xab72('0x11d')],{'foreignKey':_0xab72('0x16c'),'targetKey':_0xab72('0x16d')});db[_0xab72('0x23')][_0xab72('0x121')](db['VoiceQueueReport'],{'as':_0xab72('0x16e'),'foreignKey':_0xab72('0x16f'),'constraints':![]});db['VoiceCallReport'][_0xab72('0x121')](db[_0xab72('0x27')],{'as':_0xab72('0x170'),'foreignKey':_0xab72('0x16f'),'constraints':![]});db[_0xab72('0x23')]['belongsTo'](db['User'],{'as':_0xab72('0x14'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x23')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':'Contact','foreignKey':_0xab72('0x171')});db[_0xab72('0x172')]['belongsTo'](db[_0xab72('0x3e')],{'as':_0xab72('0x3e'),'foreignKey':_0xab72('0x173')});db[_0xab72('0x172')][_0xab72('0x130')](db[_0xab72('0x114')],{'as':_0xab72('0x114'),'foreignKey':_0xab72('0x174'),'onDelete':_0xab72('0x175')});db[_0xab72('0x176')][_0xab72('0x130')](db[_0xab72('0x3e')],{'as':_0xab72('0x3e'),'foreignKey':_0xab72('0x173')});db[_0xab72('0x176')][_0xab72('0x130')](db[_0xab72('0x114')],{'as':'CloudProvider','foreignKey':_0xab72('0x174'),'onDelete':_0xab72('0x175')});db[_0xab72('0x3e')]['hasOne'](db['MailServerIn'],{'as':_0xab72('0x177'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x3e')][_0xab72('0x178')](db[_0xab72('0x176')],{'as':_0xab72('0x179'),'onDelete':_0xab72('0x11e')});db['MailAccount'][_0xab72('0x121')](db[_0xab72('0x7e')],{'as':'Dispositions','foreignKey':_0xab72('0x173'),'onDelete':'cascade'});db['MailAccount'][_0xab72('0x121')](db[_0xab72('0x7c')],{'as':'Answers','foreignKey':'MailAccountId'});db[_0xab72('0x3e')][_0xab72('0x121')](db[_0xab72('0x42')],{'as':_0xab72('0x17a'),'foreignKey':_0xab72('0x173')});db[_0xab72('0x3e')][_0xab72('0x121')](db[_0xab72('0x128')],{'as':_0xab72('0x17b')});db['MailAccount'][_0xab72('0x121')](db[_0xab72('0x17c')],{'as':_0xab72('0x157'),'foreignKey':_0xab72('0x173'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x3e')][_0xab72('0x130')](db[_0xab72('0x100')],{'as':'List','foreignKey':_0xab72('0x17d')});db['MailAccount'][_0xab72('0x130')](db[_0xab72('0x94')],{'as':'Template','foreignKey':_0xab72('0x17e')});db[_0xab72('0x3e')][_0xab72('0x130')](db['Pause'],{'as':_0xab72('0x164'),'foreignKey':_0xab72('0x165')});db[_0xab72('0x3e')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x168'),'through':_0xab72('0x14d')});db[_0xab72('0x140')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x168'),'through':_0xab72('0x35')});db['MailQueue']['belongsToMany'](db['Team'],{'through':_0xab72('0x17f'),'as':_0xab72('0x180')});db[_0xab72('0x128')]['hasMany'](db[_0xab72('0x42')],{'as':_0xab72('0x17a'),'onDelete':_0xab72('0x11e'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0xab72('0x130')](db['MailAccount'],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x173')});db[_0xab72('0x128')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':'Contact','foreignKey':_0xab72('0x171')});db[_0xab72('0x128')][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x182'),'foreignKey':_0xab72('0x11f')});db['MailInteraction'][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x183'),'as':_0xab72('0x184')});db[_0xab72('0x128')]['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xab72('0x185')});db['MailInteraction']['belongsToMany'](db[_0xab72('0x14')],{'as':_0xab72('0x186'),'through':_0xab72('0x139'),'foreignKey':_0xab72('0x187')});db[_0xab72('0x42')][_0xab72('0x121')](db['Attachment'],{'as':_0xab72('0x188'),'onDelete':_0xab72('0x11e')});db['MailMessage'][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x14')});db[_0xab72('0x42')][_0xab72('0x130')](db[_0xab72('0x6f')],{'onDelete':_0xab72('0x11e'),'as':'Contact'});db[_0xab72('0x42')][_0xab72('0x130')](db[_0xab72('0x128')],{'as':_0xab72('0x189'),'foreignKey':_0xab72('0x187')});db['MailMessage'][_0xab72('0x130')](db[_0xab72('0x3e')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x173')});db[_0xab72('0x42')][_0xab72('0x130')](db[_0xab72('0x62')],{'as':_0xab72('0x62'),'foreignKey':'ChatWebsiteId'});db[_0xab72('0x42')][_0xab72('0x130')](db[_0xab72('0x18a')],{'as':_0xab72('0x18a'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':_0xab72('0x175')});db[_0xab72('0x17c')][_0xab72('0x130')](db[_0xab72('0x140')],{'onDelete':_0xab72('0x175')});db[_0xab72('0x17c')]['belongsTo'](db['MailAccount'],{'onDelete':_0xab72('0x175')});db[_0xab72('0x17c')][_0xab72('0x130')](db['Interval'],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x163')});db[_0xab72('0x17c')]['belongsTo'](db[_0xab72('0x8d')],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x18b')});db[_0xab72('0x18c')][_0xab72('0x130')](db['MailAccount'],{});db['MailQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xab72('0x18c')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db[_0xab72('0x18c')]['belongsTo'](db['MailInteraction'],{});db[_0xab72('0x18c')][_0xab72('0x130')](db[_0xab72('0x42')],{});db['MailQueueReport'][_0xab72('0x130')](db[_0xab72('0x14')],{});db['MailQueueReport'][_0xab72('0x130')](db[_0xab72('0x140')],{});db[_0xab72('0x44')][_0xab72('0x121')](db[_0xab72('0x18e')],{'as':_0xab72('0x18f'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x47')][_0xab72('0x121')](db[_0xab72('0x7e')],{'as':'Dispositions','foreignKey':_0xab72('0x190'),'onDelete':_0xab72('0x11e')});db['FaxAccount'][_0xab72('0x121')](db[_0xab72('0x7c')],{'as':_0xab72('0x191'),'foreignKey':_0xab72('0x190')});db[_0xab72('0x47')][_0xab72('0x121')](db[_0xab72('0x4b')],{'as':_0xab72('0x17b')});db[_0xab72('0x47')][_0xab72('0x121')](db['FaxApplication'],{'as':_0xab72('0x157'),'foreignKey':_0xab72('0x190'),'onDelete':'cascade'});db[_0xab72('0x47')][_0xab72('0x121')](db['VoiceExtension'],{'as':_0xab72('0x192'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x47')][_0xab72('0x121')](db[_0xab72('0x4c')],{'as':_0xab72('0x17a')});db[_0xab72('0x47')][_0xab72('0x130')](db['Trunk'],{'as':_0xab72('0x2d')});db[_0xab72('0x47')]['belongsTo'](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':_0xab72('0x17d')});db[_0xab72('0x47')]['belongsTo'](db[_0xab72('0x84')],{'as':_0xab72('0x164'),'foreignKey':_0xab72('0x165')});db[_0xab72('0x47')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':'Agents','through':_0xab72('0x14b')});db[_0xab72('0x49')][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':'restrict'});db[_0xab72('0x49')][_0xab72('0x130')](db[_0xab72('0x4e')],{'onDelete':'restrict'});db[_0xab72('0x49')]['belongsTo'](db[_0xab72('0x47')],{'onDelete':_0xab72('0x175')});db[_0xab72('0x49')][_0xab72('0x130')](db[_0xab72('0x8d')],{'onDelete':_0xab72('0x175'),'foreignKey':'TagId'});db['FaxInteraction'][_0xab72('0x121')](db[_0xab72('0x4c')],{'as':_0xab72('0x17a'),'onDelete':'cascade','foreignKey':_0xab72('0x194')});db['FaxInteraction'][_0xab72('0x130')](db['FaxAccount'],{'as':'Account','foreignKey':_0xab72('0x190')});db['FaxInteraction'][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db[_0xab72('0x4b')][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x182'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x4b')]['belongsToMany'](db[_0xab72('0x8d')],{'through':'fax_interaction_has_tags','as':_0xab72('0x184')});db[_0xab72('0x4b')][_0xab72('0x132')](db['Tag'],{'through':_0xab72('0x195'),'as':_0xab72('0x185')});db['FaxInteraction'][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x186'),'through':'user_has_fax_interactions','foreignKey':_0xab72('0x194')});db[_0xab72('0x4c')]['belongsTo'](db['User'],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x14')});db[_0xab72('0x4c')][_0xab72('0x130')](db[_0xab72('0x4b')],{'as':_0xab72('0x189'),'foreignKey':_0xab72('0x194')});db[_0xab72('0x4c')][_0xab72('0x130')](db[_0xab72('0x6f')],{'onDelete':'cascade','as':_0xab72('0x18d')});db[_0xab72('0x4c')][_0xab72('0x130')](db[_0xab72('0xf6')],{'as':_0xab72('0xf6'),'foreignKey':_0xab72('0x196')});db[_0xab72('0x4c')][_0xab72('0x130')](db[_0xab72('0x47')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x190')});db[_0xab72('0x4e')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x168'),'through':_0xab72('0x36')});db[_0xab72('0x4e')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0xab72('0x180')});db[_0xab72('0x50')]['belongsTo'](db[_0xab72('0x47')],{});db[_0xab72('0x50')][_0xab72('0x130')](db[_0xab72('0x100')],{'as':'List','foreignKey':'ListId'});db[_0xab72('0x50')]['belongsTo'](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db['FaxQueueReport'][_0xab72('0x130')](db[_0xab72('0x4b')],{});db[_0xab72('0x50')][_0xab72('0x130')](db[_0xab72('0x4c')],{});db[_0xab72('0x50')][_0xab72('0x130')](db[_0xab72('0x14')],{});db[_0xab72('0x50')]['belongsTo'](db[_0xab72('0x4e')],{});db[_0xab72('0x52')]['hasMany'](db[_0xab72('0x7e')],{'as':_0xab72('0x197'),'foreignKey':_0xab72('0x198'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x52')][_0xab72('0x121')](db[_0xab72('0x7c')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xab72('0x121')](db['SmsMessage'],{'as':_0xab72('0x17a'),'foreignKey':_0xab72('0x198')});db[_0xab72('0x52')][_0xab72('0x121')](db[_0xab72('0x55')],{'as':'Interactions'});db[_0xab72('0x52')][_0xab72('0x121')](db[_0xab72('0x199')],{'as':_0xab72('0x157'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0xab72('0x52')][_0xab72('0x130')](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':_0xab72('0x17d')});db['SmsAccount'][_0xab72('0x130')](db[_0xab72('0x84')],{'as':_0xab72('0x164'),'foreignKey':_0xab72('0x165')});db[_0xab72('0x52')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x168'),'through':_0xab72('0x151')});db[_0xab72('0x199')][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':_0xab72('0x175')});db[_0xab72('0x199')][_0xab72('0x130')](db[_0xab72('0x58')],{'onDelete':'restrict'});db['SmsApplication'][_0xab72('0x130')](db[_0xab72('0x52')],{'onDelete':_0xab72('0x175')});db['SmsApplication'][_0xab72('0x130')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xab72('0x163')});db[_0xab72('0x199')][_0xab72('0x130')](db['Tag'],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x18b')});db[_0xab72('0x55')][_0xab72('0x121')](db[_0xab72('0x57')],{'as':'Messages','onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x19a')});db[_0xab72('0x55')][_0xab72('0x130')](db[_0xab72('0x52')],{'as':'Account','foreignKey':_0xab72('0x198')});db[_0xab72('0x55')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':'Contact','foreignKey':_0xab72('0x171')});db['SmsInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xab72('0x11f')});db[_0xab72('0x55')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':'sms_interaction_has_tags','as':'Tags'});db[_0xab72('0x55')][_0xab72('0x132')](db['Tag'],{'through':_0xab72('0x19b'),'as':_0xab72('0x185')});db[_0xab72('0x55')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x186'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xab72('0x130')](db[_0xab72('0x14')],{'as':'User'});db['SmsMessage'][_0xab72('0x130')](db[_0xab72('0x6f')],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x18d')});db[_0xab72('0x57')][_0xab72('0x130')](db[_0xab72('0x55')],{'onDelete':_0xab72('0x11e'),'as':'Interaction','foreignKey':_0xab72('0x19a')});db[_0xab72('0x57')][_0xab72('0x130')](db[_0xab72('0x52')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x198')});db[_0xab72('0x58')]['belongsToMany'](db['User'],{'as':_0xab72('0x168'),'through':'UserSmsQueue','foreignKey':_0xab72('0x19c')});db[_0xab72('0x58')][_0xab72('0x132')](db[_0xab72('0xef')],{'through':_0xab72('0x19d'),'as':_0xab72('0x180')});db[_0xab72('0x5a')][_0xab72('0x121')](db[_0xab72('0x7e')],{'as':'Dispositions','foreignKey':_0xab72('0x19e'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x5a')]['hasMany'](db[_0xab72('0x7c')],{'as':_0xab72('0x191'),'foreignKey':_0xab72('0x19e')});db[_0xab72('0x5a')][_0xab72('0x121')](db['OpenchannelInteraction'],{'as':_0xab72('0x17b'),'foreignKey':_0xab72('0x19e')});db[_0xab72('0x5a')][_0xab72('0x121')](db[_0xab72('0x60')],{'as':_0xab72('0x17a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xab72('0x5c')],{'as':_0xab72('0x157'),'foreignKey':_0xab72('0x19e'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x5a')]['belongsTo'](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':_0xab72('0x17d')});db[_0xab72('0x5a')]['belongsTo'](db[_0xab72('0x84')],{'as':_0xab72('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xab72('0x5a')][_0xab72('0x132')](db['User'],{'as':'Agents','through':_0xab72('0x14f')});db[_0xab72('0x5c')][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xab72('0x130')](db[_0xab72('0x61')],{'onDelete':'restrict','foreignKey':_0xab72('0x19f')});db[_0xab72('0x5c')][_0xab72('0x130')](db[_0xab72('0x5a')],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x19e')});db[_0xab72('0x5c')]['belongsTo'](db[_0xab72('0x82')],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x163')});db['OpenchannelApplication']['belongsTo'](db[_0xab72('0x8d')],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x18b')});db['OpenchannelInteraction'][_0xab72('0x121')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1a0')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0xab72('0x5e')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db[_0xab72('0x5e')][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x182'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x5e')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1a1'),'as':'Tags'});db[_0xab72('0x5e')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1a1'),'as':'ThroughTags'});db[_0xab72('0x5e')][_0xab72('0x132')](db['User'],{'as':_0xab72('0x186'),'through':'user_has_openchannel_interactions','foreignKey':_0xab72('0x1a0')});db['OpenchannelMessage'][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':'cascade','as':_0xab72('0x14')});db[_0xab72('0x60')][_0xab72('0x130')](db[_0xab72('0x6f')],{'onDelete':_0xab72('0x11e'),'as':'Contact'});db[_0xab72('0x60')][_0xab72('0x130')](db[_0xab72('0x5e')],{'onDelete':'cascade','as':_0xab72('0x189'),'foreignKey':_0xab72('0x1a0')});db[_0xab72('0x60')]['belongsTo'](db['Attachment'],{'as':_0xab72('0xf6'),'foreignKey':'AttachmentId'});db[_0xab72('0x60')][_0xab72('0x130')](db['OpenchannelAccount'],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x19e')});db[_0xab72('0x61')][_0xab72('0x132')](db['User'],{'as':_0xab72('0x168'),'through':_0xab72('0x39'),'foreignKey':_0xab72('0x19f')});db['OpenchannelQueue'][_0xab72('0x132')](db[_0xab72('0xef')],{'through':_0xab72('0x1a2'),'as':_0xab72('0x180')});db[_0xab72('0x62')][_0xab72('0x121')](db[_0xab72('0x7e')],{'as':_0xab72('0x197'),'foreignKey':'ChatWebsiteId','onDelete':_0xab72('0x11e')});db['ChatWebsite'][_0xab72('0x121')](db[_0xab72('0x7c')],{'as':_0xab72('0x191'),'foreignKey':'ChatWebsiteId'});db[_0xab72('0x62')][_0xab72('0x121')](db[_0xab72('0x6b')],{'as':_0xab72('0x1a3')});db[_0xab72('0x62')][_0xab72('0x121')](db['ChatInteraction'],{'as':_0xab72('0x17b')});db[_0xab72('0x62')][_0xab72('0x121')](db[_0xab72('0x66')],{'as':'Applications','foreignKey':_0xab72('0x1a4'),'onDelete':'cascade'});db[_0xab72('0x62')][_0xab72('0x121')](db[_0xab72('0x69')],{'as':_0xab72('0x17a')});db[_0xab72('0x62')]['belongsTo'](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':_0xab72('0x17d')});db['ChatWebsite'][_0xab72('0x130')](db[_0xab72('0x82')],{'as':_0xab72('0x82'),'foreignKey':'IntervalId'});db[_0xab72('0x62')][_0xab72('0x130')](db[_0xab72('0x3e')],{'as':_0xab72('0x3e'),'foreignKey':_0xab72('0x173')});db[_0xab72('0x62')][_0xab72('0x130')](db[_0xab72('0x84')],{'as':_0xab72('0x164'),'foreignKey':_0xab72('0x165')});db[_0xab72('0x62')]['belongsToMany'](db['User'],{'as':_0xab72('0x168'),'through':_0xab72('0x1a5')});db['OpenchannelQueueReport'][_0xab72('0x130')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xab72('0x130')](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':_0xab72('0x17d')});db['OpenchannelQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xab72('0x64')][_0xab72('0x130')](db['OpenchannelInteraction'],{});db[_0xab72('0x64')][_0xab72('0x130')](db[_0xab72('0x60')],{});db[_0xab72('0x64')][_0xab72('0x130')](db[_0xab72('0x14')],{});db[_0xab72('0x64')]['belongsTo'](db[_0xab72('0x61')],{});db['ChatApplication']['belongsTo'](db[_0xab72('0x14')],{'as':_0xab72('0x1a6'),'foreignKey':_0xab72('0x11f'),'onDelete':_0xab72('0x175')});db['ChatApplication'][_0xab72('0x130')](db[_0xab72('0x142')],{'as':_0xab72('0x1a7'),'foreignKey':'ChatQueueId','onDelete':_0xab72('0x175')});db['ChatApplication'][_0xab72('0x130')](db[_0xab72('0x62')],{'as':_0xab72('0x1a8'),'foreignKey':'ChatWebsiteId','onDelete':_0xab72('0x175')});db[_0xab72('0x66')][_0xab72('0x130')](db[_0xab72('0x8d')],{'onDelete':'restrict','foreignKey':_0xab72('0x18b')});db[_0xab72('0x67')][_0xab72('0x121')](db[_0xab72('0x69')],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0xab72('0x67')][_0xab72('0x130')](db[_0xab72('0x62')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1a4')});db[_0xab72('0x67')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':'ContactId'});db[_0xab72('0x67')][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x182'),'foreignKey':'UserId'});db[_0xab72('0x67')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1a9'),'as':_0xab72('0x184')});db[_0xab72('0x67')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1a9'),'as':'ThroughTags'});db[_0xab72('0x67')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x186'),'through':'user_has_chat_interactions','foreignKey':_0xab72('0x1aa')});db[_0xab72('0x69')][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x14')});db[_0xab72('0x69')]['belongsTo'](db['CmContact'],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db['ChatMessage'][_0xab72('0x130')](db[_0xab72('0x67')],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x189'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xab72('0x130')](db[_0xab72('0xf6')],{'as':'Attachment','foreignKey':'AttachmentId'});db['ChatMessage'][_0xab72('0x130')](db[_0xab72('0x62')],{'as':'Account','foreignKey':_0xab72('0x1a4')});db[_0xab72('0x18a')][_0xab72('0x121')](db[_0xab72('0xf6')],{'as':_0xab72('0x188'),'foreignKey':_0xab72('0x1ab'),'onDelete':_0xab72('0x11e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db[_0xab72('0x6f')],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x18d'),'foreignKey':'ContactId'});db[_0xab72('0x18a')][_0xab72('0x130')](db[_0xab72('0x62')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1a4')});db['ChatQueue'][_0xab72('0x132')](db[_0xab72('0x14')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xab72('0x142')][_0xab72('0x132')](db[_0xab72('0xef')],{'through':_0xab72('0x1ac'),'as':_0xab72('0x180')});db['ChatGroup'][_0xab72('0x121')](db[_0xab72('0xd9')],{'as':_0xab72('0x17a'),'foreignKey':'ChatGroupId','onDelete':_0xab72('0x11e')});db[_0xab72('0x6a')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x15a'),'through':_0xab72('0x134')});db[_0xab72('0x6b')][_0xab72('0x130')](db['ChatWebsite'],{'as':_0xab72('0x1a8'),'foreignKey':_0xab72('0x1a4')});db[_0xab72('0x6d')][_0xab72('0x121')](db[_0xab72('0x6f')],{'as':_0xab72('0x135'),'foreignKey':_0xab72('0x1ad')});db[_0xab72('0x6f')][_0xab72('0x121')](db['CmContactHasItem'],{'as':_0xab72('0x1ae'),'foreignKey':_0xab72('0x1af')});db[_0xab72('0x6f')][_0xab72('0x121')](db[_0xab72('0x15b')],{'as':'Hoppers','foreignKey':_0xab72('0x171')});db['CmContact']['hasMany'](db[_0xab72('0x73')],{'as':'HopperFinals','foreignKey':_0xab72('0x171')});db['CmContact'][_0xab72('0x121')](db[_0xab72('0x74')],{'as':_0xab72('0x15d'),'foreignKey':_0xab72('0x171')});db['CmContact'][_0xab72('0x121')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xab72('0x171')});db['CmContact'][_0xab72('0x121')](db[_0xab72('0xde')],{'as':_0xab72('0x1b0'),'foreignKey':_0xab72('0x171')});db[_0xab72('0x6f')][_0xab72('0x121')](db[_0xab72('0x5e')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db[_0xab72('0x6f')]['hasMany'](db[_0xab72('0x67')],{'as':'ChatInteractions','foreignKey':_0xab72('0x171'),'onDelete':_0xab72('0x175')});db['CmContact'][_0xab72('0x121')](db[_0xab72('0x55')],{'as':'SmsInteractions','foreignKey':_0xab72('0x171'),'onDelete':_0xab72('0x175')});db[_0xab72('0x6f')][_0xab72('0x121')](db[_0xab72('0x4b')],{'as':_0xab72('0x127'),'foreignKey':_0xab72('0x171'),'onDelete':_0xab72('0x175')});db['CmContact'][_0xab72('0x121')](db[_0xab72('0x128')],{'as':_0xab72('0x129'),'foreignKey':_0xab72('0x171'),'onDelete':_0xab72('0x175')});db[_0xab72('0x6f')][_0xab72('0x130')](db[_0xab72('0x6d')],{'as':_0xab72('0x1b1'),'foreignKey':'CompanyId'});db[_0xab72('0x6f')][_0xab72('0x130')](db[_0xab72('0x100')],{'as':'List','foreignKey':'ListId','onDelete':_0xab72('0x11e')});db[_0xab72('0x6f')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':'Users','through':_0xab72('0x136')});db[_0xab72('0x6f')]['belongsToMany'](db[_0xab72('0x8d')],{'as':_0xab72('0x184'),'through':_0xab72('0x1b2')});db[_0xab72('0x6f')]['belongsToMany'](db[_0xab72('0x8d')],{'through':_0xab72('0x1b2'),'as':_0xab72('0x185')});db[_0xab72('0x15b')][_0xab72('0x121')](db[_0xab72('0x92')],{'as':'AdditionalPhones','foreignKey':_0xab72('0x1b3')});db[_0xab72('0x15b')][_0xab72('0x130')](db['CmContact'],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x15b')]['belongsTo'](db[_0xab72('0x100')],{'as':'List','foreignKey':_0xab72('0x17d'),'onDelete':'cascade'});db['CmHopper'][_0xab72('0x130')](db['User'],{'as':_0xab72('0x1a6'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x15b')][_0xab72('0x130')](db['VoiceQueue'],{'as':_0xab72('0x1a7'),'foreignKey':'VoiceQueueId','onDelete':_0xab72('0x11e')});db[_0xab72('0x15b')][_0xab72('0x130')](db[_0xab72('0xf2')],{'as':_0xab72('0xf2'),'foreignKey':_0xab72('0x1b4'),'onDelete':_0xab72('0x11e')});db['CmHopper'][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x182'),'foreignKey':_0xab72('0x1b5')});db[_0xab72('0x15e')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':'Contact','foreignKey':_0xab72('0x171'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x15e')][_0xab72('0x130')](db['CmList'],{'as':'List','foreignKey':_0xab72('0x17d'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db['VoiceQueue'],{'as':'Queue','foreignKey':_0xab72('0x15c'),'onDelete':_0xab72('0x11e')});db['CmHopperBlack']['belongsTo'](db[_0xab72('0xf2')],{'as':_0xab72('0xf2'),'foreignKey':_0xab72('0x1b4'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x7b')][_0xab72('0x121')](db[_0xab72('0x80')],{'as':{'plural':'All','singular':_0xab72('0x1b6')},'foreignKey':_0xab72('0x1b7'),'onDelete':_0xab72('0x11e'),'hooks':!![]});db[_0xab72('0x7b')][_0xab72('0x121')](db[_0xab72('0x80')],{'as':{'plural':_0xab72('0x1b8'),'singular':_0xab72('0x1b9')},'foreignKey':_0xab72('0x1ba'),'onDelete':'cascade','hooks':!![]});db[_0xab72('0x7b')][_0xab72('0x121')](db[_0xab72('0x79')],{'as':_0xab72('0x1bb'),'foreignKey':_0xab72('0x1bc'),'onDelete':_0xab72('0x11e'),'hooks':!![]});db[_0xab72('0x7e')]['hasMany'](db[_0xab72('0x7e')],{'as':_0xab72('0x197'),'foreignKey':_0xab72('0x1bd'),'onDelete':'cascade'});db['Interval'][_0xab72('0x121')](db[_0xab72('0x82')],{'as':_0xab72('0x1be'),'foreignKey':'IntervalId','onDelete':_0xab72('0x11e'),'hooks':!![],'required':![]});db[_0xab72('0x82')][_0xab72('0x121')](db[_0xab72('0x122')],{'as':'Extensions','foreignKey':_0xab72('0x163'),'onDelete':_0xab72('0x175')});db[_0xab72('0x82')][_0xab72('0x121')](db[_0xab72('0x17c')],{'as':'MailApplications','foreignKey':_0xab72('0x163')});db[_0xab72('0x82')]['hasMany'](db[_0xab72('0x66')],{'as':_0xab72('0x1bf'),'foreignKey':_0xab72('0x163')});db[_0xab72('0x82')][_0xab72('0x121')](db['FaxApplication'],{'as':_0xab72('0x1c0'),'foreignKey':'IntervalId'});db[_0xab72('0x82')]['hasMany'](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xab72('0x163')});db[_0xab72('0x1c1')][_0xab72('0x130')](db['MailAccount'],{});db[_0xab72('0x1c1')][_0xab72('0x130')](db['AnalyticDefaultReport'],{'foreignKey':_0xab72('0x1c2')});db['Schedule'][_0xab72('0x130')](db[_0xab72('0x9c')],{'foreignKey':_0xab72('0x1c3')});db['Sound'][_0xab72('0x132')](db[_0xab72('0x158')],{'as':_0xab72('0x1c4'),'through':_0xab72('0x1c5'),'onDelete':_0xab72('0x175')});db[_0xab72('0x8d')][_0xab72('0x132')](db[_0xab72('0x6f')],{'through':'cm_contact_has_tags'});db['Tag'][_0xab72('0x132')](db[_0xab72('0x67')],{'through':'chat_interaction_has_tags'});db[_0xab72('0x8d')][_0xab72('0x132')](db['MailInteraction'],{'through':_0xab72('0x183')});db[_0xab72('0x8d')][_0xab72('0x132')](db['SmsInteraction'],{'through':_0xab72('0x19b')});db[_0xab72('0x8d')][_0xab72('0x132')](db['FaxInteraction'],{'through':_0xab72('0x195')});db[_0xab72('0x8d')][_0xab72('0x132')](db['OpenchannelInteraction'],{'through':_0xab72('0x1a1')});db[_0xab72('0x8d')][_0xab72('0x132')](db['WhatsappInteraction'],{'through':_0xab72('0x1c6')});db[_0xab72('0x90')][_0xab72('0x130')](db[_0xab72('0x8e')],{'as':'ItemType','foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0xab72('0x130')](db[_0xab72('0x15b')],{'as':'Hopper','foreignKey':_0xab72('0x1b3')});db[_0xab72('0x90')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x1af')});db['Trigger'][_0xab72('0x121')](db[_0xab72('0x80')],{'as':{'plural':'AllConditions','singular':_0xab72('0x1c7')},'foreignKey':_0xab72('0x1c8'),'onDelete':_0xab72('0x11e'),'hooks':!![]});db[_0xab72('0x96')]['hasMany'](db[_0xab72('0x80')],{'as':{'plural':'AnyConditions','singular':_0xab72('0x1c9')},'foreignKey':_0xab72('0x1ca'),'onDelete':_0xab72('0x11e'),'hooks':!![]});db[_0xab72('0x96')][_0xab72('0x121')](db[_0xab72('0x79')],{'as':_0xab72('0x1bb'),'foreignKey':_0xab72('0x1cb'),'onDelete':'cascade','hooks':!![]});db[_0xab72('0x9c')][_0xab72('0x121')](db[_0xab72('0x1cc')],{'as':_0xab72('0x1cd'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1c3'),'hooks':!![]});db[_0xab72('0x9e')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xab72('0x1cd'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0xab72('0xa2')][_0xab72('0x121')](db[_0xab72('0x1cc')],{'as':_0xab72('0x1cd'),'onDelete':'cascade','foreignKey':_0xab72('0x1ce')});db['AnalyticFieldReport']['belongsTo'](db[_0xab72('0xa2')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xab72('0x121')](db['SalesforceConfiguration'],{'as':_0xab72('0x1cf'),'onDelete':'cascade','foreignKey':_0xab72('0x1d0')});db['SalesforceConfiguration'][_0xab72('0x121')](db[_0xab72('0xaa')],{'as':_0xab72('0x1d1'),'onDelete':'cascade','foreignKey':_0xab72('0x1d2')});db[_0xab72('0xa9')][_0xab72('0x121')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d3')});db[_0xab72('0xa9')][_0xab72('0x121')](db['SalesforceField'],{'as':_0xab72('0x1cd'),'onDelete':_0xab72('0x11e'),'foreignKey':'FieldId'});db[_0xab72('0xa9')][_0xab72('0x130')](db['SalesforceAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0xab72('0xaa')]['hasMany'](db[_0xab72('0xaa')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db['SalesforceField'][_0xab72('0x121')](db[_0xab72('0xaa')],{'as':'Description','foreignKey':_0xab72('0x1d3')});db[_0xab72('0xaa')][_0xab72('0x121')](db['SalesforceField'],{'as':'Field','foreignKey':_0xab72('0x1d5')});db[_0xab72('0xaa')][_0xab72('0x130')](db[_0xab72('0x1d6')],{'as':'Variable','foreignKey':'VariableId'});db[_0xab72('0xac')][_0xab72('0x121')](db[_0xab72('0xae')],{'as':_0xab72('0x1cf'),'onDelete':'cascade','foreignKey':_0xab72('0x1d0')});db[_0xab72('0xae')][_0xab72('0x121')](db[_0xab72('0xb0')],{'as':_0xab72('0x1d1'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d2')});db['SugarcrmConfiguration'][_0xab72('0x121')](db[_0xab72('0xb0')],{'as':_0xab72('0x1d7'),'onDelete':'cascade','foreignKey':_0xab72('0x1d3')});db['SugarcrmConfiguration'][_0xab72('0x121')](db[_0xab72('0xb0')],{'as':_0xab72('0x1cd'),'onDelete':'cascade','foreignKey':_0xab72('0x1d5')});db[_0xab72('0xae')][_0xab72('0x130')](db[_0xab72('0xac')],{'as':'Account','foreignKey':_0xab72('0x1d0')});db[_0xab72('0xb0')][_0xab72('0x121')](db[_0xab72('0xb0')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xb0')][_0xab72('0x121')](db[_0xab72('0xb0')],{'as':_0xab72('0x1d8'),'foreignKey':_0xab72('0x1d3')});db['SugarcrmField'][_0xab72('0x121')](db[_0xab72('0xb0')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xb0')][_0xab72('0x130')](db['Variable'],{'as':_0xab72('0x1d6'),'foreignKey':_0xab72('0x1da')});db[_0xab72('0xb2')][_0xab72('0x121')](db['DeskConfiguration'],{'as':_0xab72('0x1cf'),'onDelete':_0xab72('0x11e'),'foreignKey':'AccountId'});db[_0xab72('0xb3')][_0xab72('0x121')](db[_0xab72('0xb5')],{'as':_0xab72('0x1d1'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xb3')][_0xab72('0x121')](db['DeskField'],{'as':_0xab72('0x1d7'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d3')});db[_0xab72('0xb3')][_0xab72('0x121')](db[_0xab72('0xb5')],{'as':_0xab72('0x1cd'),'onDelete':'cascade','foreignKey':_0xab72('0x1d5')});db[_0xab72('0xb3')]['belongsTo'](db[_0xab72('0xb2')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1d0')});db['DeskConfiguration'][_0xab72('0x132')](db['Tag'],{'through':_0xab72('0x1db')});db[_0xab72('0xb5')][_0xab72('0x121')](db[_0xab72('0xb5')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xb5')][_0xab72('0x121')](db[_0xab72('0xb5')],{'as':_0xab72('0x1d8'),'foreignKey':_0xab72('0x1d3')});db['DeskField'][_0xab72('0x121')](db[_0xab72('0xb5')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xb5')][_0xab72('0x130')](db[_0xab72('0x1d6')],{'as':_0xab72('0x1d6'),'foreignKey':_0xab72('0x1da')});db['ZohoAccount'][_0xab72('0x121')](db[_0xab72('0x1dc')],{'as':_0xab72('0x1cf'),'onDelete':'cascade','foreignKey':_0xab72('0x1d0')});db[_0xab72('0x1dc')][_0xab72('0x121')](db['ZohoField'],{'as':_0xab72('0x1d1'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0x1dc')][_0xab72('0x121')](db[_0xab72('0xb8')],{'as':_0xab72('0x1d7'),'onDelete':'cascade','foreignKey':_0xab72('0x1d3')});db[_0xab72('0x1dc')]['hasMany'](db[_0xab72('0xb8')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db['ZohoConfiguration'][_0xab72('0x130')](db['ZohoAccount'],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1d0')});db['ZohoField'][_0xab72('0x121')](db[_0xab72('0xb8')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xb8')][_0xab72('0x121')](db[_0xab72('0xb8')],{'as':_0xab72('0x1d8'),'foreignKey':'DescriptionId'});db[_0xab72('0xb8')][_0xab72('0x121')](db[_0xab72('0xb8')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xb8')][_0xab72('0x130')](db[_0xab72('0x1d6')],{'as':_0xab72('0x1d6'),'foreignKey':_0xab72('0x1da')});db[_0xab72('0xb9')][_0xab72('0x121')](db[_0xab72('0xbb')],{'as':_0xab72('0x1cf'),'onDelete':'cascade','foreignKey':_0xab72('0x1d0')});db[_0xab72('0xbb')][_0xab72('0x121')](db[_0xab72('0xbd')],{'as':_0xab72('0x1d1'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xbb')][_0xab72('0x121')](db[_0xab72('0xbd')],{'as':_0xab72('0x1d7'),'foreignKey':'DescriptionId'});db[_0xab72('0xbb')][_0xab72('0x121')](db[_0xab72('0xbd')],{'as':_0xab72('0x1cd'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xbb')][_0xab72('0x130')](db[_0xab72('0xb9')],{'as':_0xab72('0x181'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0xab72('0x1dd')});db[_0xab72('0xbd')]['hasMany'](db[_0xab72('0xbd')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xbd')][_0xab72('0x121')](db[_0xab72('0xbd')],{'as':'Description','foreignKey':_0xab72('0x1d3')});db[_0xab72('0xbd')][_0xab72('0x121')](db[_0xab72('0xbd')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xbd')]['belongsTo'](db[_0xab72('0x1d6')],{'as':_0xab72('0x1d6'),'foreignKey':'VariableId'});db[_0xab72('0xbf')]['hasMany'](db[_0xab72('0x1de')],{'as':_0xab72('0x1cf'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d0')});db['FreshdeskConfiguration'][_0xab72('0x121')](db['FreshdeskField'],{'as':_0xab72('0x1d1'),'onDelete':_0xab72('0x11e'),'foreignKey':'SubjectId'});db[_0xab72('0x1de')][_0xab72('0x121')](db[_0xab72('0xc0')],{'as':_0xab72('0x1d7'),'onDelete':'cascade','foreignKey':_0xab72('0x1d3')});db[_0xab72('0x1de')]['hasMany'](db[_0xab72('0xc0')],{'as':'Fields','onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0x1de')][_0xab72('0x130')](db['FreshdeskAccount'],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1d0')});db['FreshdeskConfiguration'][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1df')});db[_0xab72('0xc0')][_0xab72('0x121')](db[_0xab72('0xc0')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xc0')][_0xab72('0x121')](db[_0xab72('0xc0')],{'as':_0xab72('0x1d8'),'foreignKey':_0xab72('0x1d3')});db['FreshdeskField'][_0xab72('0x121')](db[_0xab72('0xc0')],{'as':_0xab72('0x1d9'),'foreignKey':'FieldId'});db[_0xab72('0xc0')]['belongsTo'](db['Variable'],{'as':_0xab72('0x1d6'),'foreignKey':_0xab72('0x1da')});db['VtigerAccount'][_0xab72('0x121')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xab72('0x11e'),'foreignKey':'AccountId'});db['VtigerConfiguration'][_0xab72('0x121')](db[_0xab72('0x1e0')],{'as':_0xab72('0x1d1'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xc4')][_0xab72('0x121')](db[_0xab72('0x1e0')],{'as':_0xab72('0x1d7'),'foreignKey':_0xab72('0x1d3')});db[_0xab72('0xc4')][_0xab72('0x121')](db['VtigerField'],{'as':_0xab72('0x1cd'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xc4')][_0xab72('0x130')](db['VtigerAccount'],{'as':'Account','foreignKey':'AccountId'});db['VtigerField'][_0xab72('0x121')](db[_0xab72('0x1e0')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db['VtigerField'][_0xab72('0x121')](db[_0xab72('0x1e0')],{'as':'Description','foreignKey':_0xab72('0x1d3')});db[_0xab72('0x1e0')][_0xab72('0x121')](db[_0xab72('0x1e0')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0x1e0')][_0xab72('0x130')](db[_0xab72('0x1d6')],{'as':'Variable','foreignKey':_0xab72('0x1da')});db[_0xab72('0xc7')][_0xab72('0x121')](db[_0xab72('0xc9')],{'as':_0xab72('0x1cf'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d0')});db[_0xab72('0xc9')][_0xab72('0x121')](db['ServicenowField'],{'as':_0xab72('0x1d1'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xc9')][_0xab72('0x121')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0xab72('0x1d3')});db[_0xab72('0xc9')][_0xab72('0x121')](db[_0xab72('0xca')],{'as':_0xab72('0x1cd'),'foreignKey':'FieldId'});db[_0xab72('0xc9')][_0xab72('0x130')](db[_0xab72('0xc7')],{'as':'Account','foreignKey':_0xab72('0x1d0')});db['ServicenowField']['hasMany'](db[_0xab72('0xca')],{'as':_0xab72('0x1d4'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0xab72('0xca')],{'as':_0xab72('0x1d8'),'foreignKey':_0xab72('0x1d3')});db[_0xab72('0xca')][_0xab72('0x121')](db[_0xab72('0xca')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xca')][_0xab72('0x130')](db[_0xab72('0x1d6')],{'as':_0xab72('0x1d6'),'foreignKey':_0xab72('0x1da')});db['Dynamics365Account'][_0xab72('0x121')](db[_0xab72('0xce')],{'as':_0xab72('0x1cf'),'onDelete':'cascade','foreignKey':_0xab72('0x1d0')});db['Dynamics365Account'][_0xab72('0x130')](db[_0xab72('0x114')],{'as':_0xab72('0x114'),'foreignKey':_0xab72('0x174')});db[_0xab72('0xce')][_0xab72('0x121')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0xab72('0x121')](db[_0xab72('0xd0')],{'as':_0xab72('0x1d7'),'onDelete':'cascade','foreignKey':_0xab72('0x1d3')});db[_0xab72('0xce')][_0xab72('0x121')](db[_0xab72('0xd0')],{'as':_0xab72('0x1cd'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xce')][_0xab72('0x130')](db[_0xab72('0xcc')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1d0')});db['Dynamics365Field'][_0xab72('0x121')](db['Dynamics365Field'],{'as':_0xab72('0x1d4'),'foreignKey':'SubjectId'});db[_0xab72('0xd0')][_0xab72('0x121')](db['Dynamics365Field'],{'as':_0xab72('0x1d8'),'foreignKey':'DescriptionId'});db[_0xab72('0xd0')][_0xab72('0x121')](db[_0xab72('0xd0')],{'as':_0xab72('0x1d9'),'foreignKey':_0xab72('0x1d5')});db[_0xab72('0xd0')][_0xab72('0x130')](db[_0xab72('0x1d6')],{'as':_0xab72('0x1d6'),'foreignKey':_0xab72('0x1da')});db[_0xab72('0xd2')][_0xab72('0x121')](db[_0xab72('0xd4')],{'as':_0xab72('0x1cf'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x1d0')});db[_0xab72('0xd4')][_0xab72('0x121')](db[_0xab72('0xd5')],{'as':'Subjects','foreignKey':_0xab72('0x1d2')});db[_0xab72('0xd4')][_0xab72('0x121')](db[_0xab72('0xd5')],{'as':_0xab72('0x1d7'),'foreignKey':_0xab72('0x1d3')});db[_0xab72('0xd4')][_0xab72('0x121')](db[_0xab72('0xd5')],{'as':_0xab72('0x1cd'),'foreignKey':'FieldId'});db['FreshsalesConfiguration']['belongsTo'](db[_0xab72('0xd2')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x1d0')});db['FreshsalesField'][_0xab72('0x121')](db[_0xab72('0xd5')],{'as':_0xab72('0x1d4'),'foreignKey':_0xab72('0x1d2')});db[_0xab72('0xd5')]['hasMany'](db['FreshsalesField'],{'as':_0xab72('0x1d8'),'foreignKey':_0xab72('0x1d3')});db[_0xab72('0xd5')]['hasMany'](db[_0xab72('0xd5')],{'as':_0xab72('0x1d9'),'foreignKey':'FieldId'});db['FreshsalesField']['belongsTo'](db[_0xab72('0x1d6')],{'as':'Variable','foreignKey':_0xab72('0x1da')});db[_0xab72('0x1e1')][_0xab72('0x130')](db[_0xab72('0x62')],{});db['ChatQueueReport']['belongsTo'](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':'ListId'});db[_0xab72('0x1e1')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db[_0xab72('0x1e1')][_0xab72('0x130')](db[_0xab72('0x67')],{});db[_0xab72('0x1e1')]['belongsTo'](db['ChatMessage'],{});db['ChatQueueReport'][_0xab72('0x130')](db['User'],{});db[_0xab72('0x1e1')][_0xab72('0x130')](db['ChatQueue'],{});db[_0xab72('0xd9')]['belongsTo'](db['User'],{'onDelete':'cascade','foreignKey':_0xab72('0x1e2')});db[_0xab72('0xd9')]['belongsTo'](db[_0xab72('0x14')],{'onDelete':_0xab72('0x11e'),'foreignKey':'ToId'});db[_0xab72('0xde')][_0xab72('0x121')](db[_0xab72('0xdc')],{'foreignKey':'SessionId','onDelete':_0xab72('0x11e')});db[_0xab72('0xde')]['hasMany'](db[_0xab72('0xda')],{'foreignKey':_0xab72('0x1e3'),'onDelete':_0xab72('0x11e')});db[_0xab72('0xe0')][_0xab72('0x130')](db['SmsAccount'],{});db[_0xab72('0xe0')][_0xab72('0x130')](db[_0xab72('0x100')],{'as':'List','foreignKey':'ListId'});db[_0xab72('0xe0')]['belongsTo'](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db['SmsQueueReport'][_0xab72('0x130')](db[_0xab72('0x55')],{});db[_0xab72('0xe0')][_0xab72('0x130')](db[_0xab72('0x57')],{});db[_0xab72('0xe0')][_0xab72('0x130')](db[_0xab72('0x14')],{});db[_0xab72('0xe0')][_0xab72('0x130')](db[_0xab72('0x58')],{});db[_0xab72('0xe5')][_0xab72('0x121')](db[_0xab72('0xde')],{'foreignKey':_0xab72('0x1e4')});db[_0xab72('0xe5')][_0xab72('0x121')](db[_0xab72('0xdc')],{'foreignKey':_0xab72('0x1e4')});db[_0xab72('0xe5')][_0xab72('0x121')](db['JscriptyAnswerReport'],{'foreignKey':_0xab72('0x1e4')});db[_0xab72('0xef')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':'Agents','through':_0xab72('0x138')});db['Team'][_0xab72('0x132')](db[_0xab72('0x1c')],{'through':_0xab72('0x115'),'as':'VoiceQueues'});db[_0xab72('0xef')][_0xab72('0x132')](db[_0xab72('0x140')],{'through':_0xab72('0x17f'),'as':_0xab72('0x141')});db[_0xab72('0xef')][_0xab72('0x132')](db[_0xab72('0x142')],{'through':_0xab72('0x1ac'),'as':_0xab72('0x143')});db[_0xab72('0xef')][_0xab72('0x132')](db[_0xab72('0x4e')],{'through':_0xab72('0x1e5'),'as':'FaxQueues'});db[_0xab72('0xef')][_0xab72('0x132')](db[_0xab72('0x58')],{'through':'team_has_sms_queues','as':_0xab72('0x145')});db[_0xab72('0xef')][_0xab72('0x132')](db[_0xab72('0x61')],{'through':_0xab72('0x1a2'),'as':_0xab72('0x146')});db['Team'][_0xab72('0x132')](db[_0xab72('0x147')],{'through':_0xab72('0x1e6'),'as':'WhatsappQueues'});db[_0xab72('0xef')]['belongsToMany'](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0xab72('0xf2')][_0xab72('0x121')](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xab72('0xf2')][_0xab72('0x121')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xab72('0x1b4')});db['Campaign'][_0xab72('0x121')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xab72('0x1b4')});db[_0xab72('0xf2')][_0xab72('0x121')](db[_0xab72('0x15e')],{'as':'HopperBlacks','foreignKey':_0xab72('0x1b4')});db[_0xab72('0xf2')][_0xab72('0x130')](db['Trunk'],{'as':_0xab72('0x2d'),'foreignKey':_0xab72('0x160')});db[_0xab72('0xf2')]['belongsTo'](db[_0xab72('0x2d')],{'as':_0xab72('0x161'),'foreignKey':'TrunkBackupId'});db[_0xab72('0xf2')][_0xab72('0x130')](db[_0xab72('0x82')],{'as':_0xab72('0x82'),'foreignKey':_0xab72('0x163')});db[_0xab72('0xf2')]['belongsTo'](db[_0xab72('0xea')],{'as':_0xab72('0xea'),'foreignKey':_0xab72('0x1e7')});db[_0xab72('0xf2')][_0xab72('0x132')](db[_0xab72('0x100')],{'as':_0xab72('0x166'),'through':'campaigns_has_cm_lists'});db[_0xab72('0xf2')][_0xab72('0x132')](db['CmList'],{'as':_0xab72('0x169'),'through':_0xab72('0x1e8')});db[_0xab72('0xf6')][_0xab72('0x130')](db[_0xab72('0x18a')],{'as':'ChatOfflineMessage','foreignKey':_0xab72('0x1ab')});db[_0xab72('0xf9')]['belongsTo'](db['MailMessage'],{});db[_0xab72('0xf9')]['belongsTo'](db[_0xab72('0x128')],{});db[_0xab72('0xf9')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xab72('0x1e9'),'as':_0xab72('0x1ea')});db['MailTransferReport']['belongsTo'](db[_0xab72('0x14')],{'foreignKey':_0xab72('0x1eb'),'as':_0xab72('0x1ec')});db[_0xab72('0xf9')][_0xab72('0x130')](db[_0xab72('0x14')],{'foreignKey':_0xab72('0x1ed'),'as':'ToAgent'});db[_0xab72('0xf9')]['belongsTo'](db[_0xab72('0x140')],{'foreignKey':_0xab72('0x1ee'),'as':_0xab72('0x1ef')});db[_0xab72('0xf9')][_0xab72('0x130')](db['MailAccount'],{'foreignKey':_0xab72('0x1f0'),'as':_0xab72('0x1f1')});db[_0xab72('0x1f2')]['belongsTo'](db[_0xab72('0x69')],{});db[_0xab72('0x1f2')][_0xab72('0x130')](db[_0xab72('0x67')],{});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xab72('0x1ea')});db['ChatTransferReport'][_0xab72('0x130')](db['User'],{'foreignKey':_0xab72('0x1eb'),'as':_0xab72('0x1ec')});db[_0xab72('0x1f2')][_0xab72('0x130')](db[_0xab72('0x14')],{'foreignKey':_0xab72('0x1ed'),'as':_0xab72('0x1f3')});db[_0xab72('0x1f2')][_0xab72('0x130')](db[_0xab72('0x142')],{'foreignKey':_0xab72('0x1f4'),'as':_0xab72('0x1ef')});db[_0xab72('0x1f2')][_0xab72('0x130')](db[_0xab72('0x62')],{'foreignKey':_0xab72('0x1f5'),'as':_0xab72('0x1f1')});db[_0xab72('0xfc')][_0xab72('0x130')](db[_0xab72('0x4c')],{});db[_0xab72('0xfc')][_0xab72('0x130')](db[_0xab72('0x4b')],{});db[_0xab72('0xfc')][_0xab72('0x130')](db[_0xab72('0x47')],{'foreignKey':_0xab72('0x1f6'),'as':_0xab72('0x1ea')});db[_0xab72('0xfc')][_0xab72('0x130')](db[_0xab72('0x14')],{'foreignKey':_0xab72('0x1eb'),'as':_0xab72('0x1ec')});db['FaxTransferReport']['belongsTo'](db[_0xab72('0x14')],{'foreignKey':'ToUserId','as':_0xab72('0x1f3')});db[_0xab72('0xfc')][_0xab72('0x130')](db[_0xab72('0x4e')],{'foreignKey':_0xab72('0x1f7'),'as':'ToQueue'});db[_0xab72('0xfc')][_0xab72('0x130')](db[_0xab72('0x47')],{'foreignKey':_0xab72('0x1f8'),'as':'ToAccount'});db[_0xab72('0xfe')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xab72('0xfe')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xab72('0xfe')]['belongsTo'](db[_0xab72('0x5a')],{'foreignKey':_0xab72('0x1f9'),'as':_0xab72('0x1ea')});db['OpenchannelTransferReport'][_0xab72('0x130')](db['User'],{'foreignKey':_0xab72('0x1eb'),'as':_0xab72('0x1ec')});db[_0xab72('0xfe')][_0xab72('0x130')](db[_0xab72('0x14')],{'foreignKey':_0xab72('0x1ed'),'as':_0xab72('0x1f3')});db['OpenchannelTransferReport'][_0xab72('0x130')](db['OpenchannelQueue'],{'foreignKey':_0xab72('0x1fa'),'as':_0xab72('0x1ef')});db[_0xab72('0xfe')][_0xab72('0x130')](db[_0xab72('0x5a')],{'foreignKey':_0xab72('0x1fb'),'as':'ToAccount'});db[_0xab72('0x1fc')]['belongsTo'](db[_0xab72('0x57')],{});db[_0xab72('0x1fc')]['belongsTo'](db[_0xab72('0x55')],{});db[_0xab72('0x1fc')][_0xab72('0x130')](db['SmsAccount'],{'foreignKey':_0xab72('0x1fd'),'as':_0xab72('0x1ea')});db[_0xab72('0x1fc')][_0xab72('0x130')](db[_0xab72('0x14')],{'foreignKey':'FromUserId','as':_0xab72('0x1ec')});db[_0xab72('0x1fc')][_0xab72('0x130')](db['User'],{'foreignKey':_0xab72('0x1ed'),'as':_0xab72('0x1f3')});db['SmsTransferReport']['belongsTo'](db[_0xab72('0x58')],{'foreignKey':_0xab72('0x1fe'),'as':_0xab72('0x1ef')});db[_0xab72('0x1fc')]['belongsTo'](db[_0xab72('0x52')],{'foreignKey':_0xab72('0x1ff'),'as':'ToAccount'});db['CmList']['hasMany'](db[_0xab72('0x7e')],{'as':_0xab72('0x197'),'foreignKey':_0xab72('0x17d'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x100')][_0xab72('0x121')](db[_0xab72('0x77')],{'as':_0xab72('0x200'),'foreignKey':'ListId'});db[_0xab72('0x100')][_0xab72('0x121')](db[_0xab72('0x6f')],{'as':_0xab72('0x135'),'onDelete':_0xab72('0x11e'),'foreignKey':_0xab72('0x17d')});db[_0xab72('0x100')]['hasMany'](db[_0xab72('0x73')],{'as':_0xab72('0x123'),'foreignKey':_0xab72('0x17d')});db[_0xab72('0x100')][_0xab72('0x121')](db[_0xab72('0x74')],{'as':_0xab72('0x124'),'foreignKey':'ListId'});db[_0xab72('0x100')][_0xab72('0x121')](db[_0xab72('0x75')],{'as':_0xab72('0x75'),'foreignKey':_0xab72('0x17d')});db[_0xab72('0x100')]['belongsToMany'](db[_0xab72('0x1c')],{'as':'Queues','through':_0xab72('0x167')});db[_0xab72('0x100')]['belongsToMany'](db['User'],{'as':_0xab72('0x168'),'through':_0xab72('0x137')});db['VoicePrefix']['hasMany'](db[_0xab72('0x122')],{'as':_0xab72('0x201'),'onDelete':_0xab72('0x11e')});db['VoicePrefix'][_0xab72('0x132')](db[_0xab72('0x14')],{'as':'Agents','through':_0xab72('0x118')});db[_0xab72('0x102')][_0xab72('0x132')](db[_0xab72('0xef')],{'through':_0xab72('0x116'),'as':_0xab72('0x180')});db[_0xab72('0x104')]['hasMany'](db[_0xab72('0x14')],{'as':'Users','foreignKey':_0xab72('0x131')});db[_0xab72('0x104')][_0xab72('0x121')](db[_0xab72('0x105')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0xab72('0x11e')});db['UserProfileSection'][_0xab72('0x121')](db['UserProfileResource'],{'as':_0xab72('0x202'),'foreignKey':_0xab72('0x203'),'onDelete':'cascade'});db[_0xab72('0x152')][_0xab72('0x121')](db[_0xab72('0x7e')],{'as':_0xab72('0x197'),'foreignKey':_0xab72('0x204'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x152')]['hasMany'](db[_0xab72('0x7c')],{'as':_0xab72('0x191'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xab72('0x121')](db['WhatsappMessage'],{'as':_0xab72('0x17a'),'foreignKey':_0xab72('0x204')});db[_0xab72('0x152')][_0xab72('0x121')](db[_0xab72('0x10c')],{'as':_0xab72('0x17b')});db[_0xab72('0x152')][_0xab72('0x121')](db[_0xab72('0x10a')],{'as':_0xab72('0x157'),'foreignKey':_0xab72('0x204'),'onDelete':_0xab72('0x11e')});db[_0xab72('0x152')][_0xab72('0x130')](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':_0xab72('0x17d')});db['WhatsappAccount'][_0xab72('0x130')](db['Pause'],{'as':_0xab72('0x164'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xab72('0x152')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':'Agents','through':_0xab72('0x153')});db[_0xab72('0x10a')][_0xab72('0x130')](db[_0xab72('0x14')],{'onDelete':_0xab72('0x175')});db[_0xab72('0x10a')]['belongsTo'](db[_0xab72('0x147')],{'onDelete':_0xab72('0x175')});db[_0xab72('0x10a')]['belongsTo'](db[_0xab72('0x152')],{'onDelete':'restrict'});db[_0xab72('0x10a')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xab72('0x163')});db[_0xab72('0x10a')]['belongsTo'](db[_0xab72('0x8d')],{'onDelete':_0xab72('0x175'),'foreignKey':_0xab72('0x18b')});db['WhatsappInteraction'][_0xab72('0x121')](db['WhatsappMessage'],{'as':_0xab72('0x17a'),'onDelete':'cascade','foreignKey':_0xab72('0x205')});db['WhatsappInteraction'][_0xab72('0x130')](db[_0xab72('0x152')],{'as':_0xab72('0x181'),'foreignKey':_0xab72('0x204')});db[_0xab72('0x10c')]['belongsTo'](db[_0xab72('0x6f')],{'as':_0xab72('0x18d'),'foreignKey':_0xab72('0x171')});db['WhatsappInteraction'][_0xab72('0x130')](db[_0xab72('0x14')],{'as':_0xab72('0x182'),'foreignKey':_0xab72('0x11f')});db[_0xab72('0x10c')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1c6'),'as':_0xab72('0x184')});db[_0xab72('0x10c')][_0xab72('0x132')](db[_0xab72('0x8d')],{'through':_0xab72('0x1c6'),'as':_0xab72('0x185')});db[_0xab72('0x10c')][_0xab72('0x132')](db[_0xab72('0x14')],{'as':_0xab72('0x186'),'through':_0xab72('0x13e'),'foreignKey':_0xab72('0x205')});db[_0xab72('0x10e')][_0xab72('0x130')](db['User'],{'as':_0xab72('0x14')});db[_0xab72('0x10e')][_0xab72('0x130')](db['CmContact'],{'onDelete':_0xab72('0x11e'),'as':_0xab72('0x18d')});db[_0xab72('0x10e')]['belongsTo'](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xab72('0x189'),'foreignKey':_0xab72('0x205')});db['WhatsappMessage'][_0xab72('0x130')](db[_0xab72('0x152')],{'as':_0xab72('0x181'),'foreignKey':'WhatsappAccountId'});db['WhatsappQueueReport']['belongsTo'](db[_0xab72('0x152')],{});db[_0xab72('0x110')]['belongsTo'](db[_0xab72('0x100')],{'as':_0xab72('0x193'),'foreignKey':'ListId'});db[_0xab72('0x110')][_0xab72('0x130')](db[_0xab72('0x6f')],{'as':'Contact','foreignKey':_0xab72('0x171')});db[_0xab72('0x110')][_0xab72('0x130')](db[_0xab72('0x10c')],{});db['WhatsappQueueReport'][_0xab72('0x130')](db[_0xab72('0x147')],{});db[_0xab72('0x110')][_0xab72('0x130')](db[_0xab72('0x10e')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0xab72('0x130')](db['WhatsappMessage'],{});db[_0xab72('0x112')][_0xab72('0x130')](db[_0xab72('0x10c')],{});db[_0xab72('0x112')][_0xab72('0x130')](db[_0xab72('0x152')],{'foreignKey':'FromWhatsappAccountId','as':_0xab72('0x1ea')});db['WhatsappTransferReport'][_0xab72('0x130')](db[_0xab72('0x152')],{'foreignKey':_0xab72('0x206'),'as':_0xab72('0x1f1')});db['WhatsappTransferReport'][_0xab72('0x130')](db[_0xab72('0x147')],{'foreignKey':'ToQueueId','as':'ToQueue'});db['WhatsappTransferReport']['belongsTo'](db[_0xab72('0x14')],{'foreignKey':_0xab72('0x1eb'),'as':_0xab72('0x1ec')});db[_0xab72('0x112')][_0xab72('0x130')](db['User'],{'foreignKey':_0xab72('0x1ed'),'as':_0xab72('0x1f3')});db[_0xab72('0x147')]['belongsToMany'](db[_0xab72('0x14')],{'as':_0xab72('0x168'),'through':_0xab72('0x148'),'foreignKey':'WhatsappQueueId'});db[_0xab72('0x147')][_0xab72('0x132')](db[_0xab72('0xef')],{'through':_0xab72('0x1e6'),'as':'Teams'});db[_0xab72('0x11a')][_0xab72('0x130')](db['User'],{'as':_0xab72('0x207'),'foreignKey':'UserId','onDelete':_0xab72('0x11e'),'hooks':!![]});db['CloudProvider'][_0xab72('0x178')](db['Dynamics365Account'],{'as':_0xab72('0xcc'),'onDelete':_0xab72('0x175')});db['CloudProvider'][_0xab72('0x178')](db[_0xab72('0x172')],{'as':'Imap','onDelete':_0xab72('0x175')});db['CloudProvider'][_0xab72('0x178')](db[_0xab72('0x176')],{'as':'Smtp','onDelete':_0xab72('0x175')});module[_0xab72('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 9ff4414..58bf6a3 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd68=['/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','static','join','root','/www','/demo','/snippet','snippet','3.10.1','/plugins','/server/files/plugins','route','get','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','./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/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/pause','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','/api/variables','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount'];(function(_0x9949d9,_0x5908b9){var _0x2adfa0=function(_0x345730){while(--_0x345730){_0x9949d9['push'](_0x9949d9['shift']());}};_0x2adfa0(++_0x5908b9);}(_0xdd68,0x196));var _0x8dd6=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xdd68[_0x5834bc];return _0x3e183a;};'use strict';var path=require(_0x8dd6('0x0'));var express=require('express');var errors=require(_0x8dd6('0x1'));var config=require(_0x8dd6('0x2'));var setupLoggers=require(_0x8dd6('0x3'))[_0x8dd6('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0x8dd6('0x5')]=function(_0x469e0c){return setupLoggers(_0x469e0c)['then'](function(){_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x7'),require('./api/user'));_0x469e0c[_0x8dd6('0x6')]('/api/voice/chanspy',require(_0x8dd6('0x8')));_0x469e0c['use'](_0x8dd6('0x9'),require(_0x8dd6('0xa')));_0x469e0c[_0x8dd6('0x6')]('/api/voice/extensions',require(_0x8dd6('0xb')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xc'),require(_0x8dd6('0xd')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xe'),require(_0x8dd6('0xf')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x10'),require(_0x8dd6('0x11')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x12'),require(_0x8dd6('0x13')));_0x469e0c['use'](_0x8dd6('0x14'),require(_0x8dd6('0x15')));_0x469e0c[_0x8dd6('0x6')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x469e0c[_0x8dd6('0x6')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x16'),require(_0x8dd6('0x17')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x18'),require(_0x8dd6('0x19')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x1a'),require(_0x8dd6('0x1b')));_0x469e0c['use'](_0x8dd6('0x1c'),require(_0x8dd6('0x1d')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x1e'),require(_0x8dd6('0x1f')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x20'),require(_0x8dd6('0x21')));_0x469e0c['use'](_0x8dd6('0x22'),require(_0x8dd6('0x23')));_0x469e0c['use'](_0x8dd6('0x24'),require(_0x8dd6('0x25')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x26'),require('./api/mailQueue'));_0x469e0c['use']('/api/mail/substatuses',require(_0x8dd6('0x27')));_0x469e0c[_0x8dd6('0x6')]('/api/mail/interactions',require(_0x8dd6('0x28')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x29'),require(_0x8dd6('0x2a')));_0x469e0c[_0x8dd6('0x6')]('/api/mail/applications',require(_0x8dd6('0x2b')));_0x469e0c[_0x8dd6('0x6')]('/api/mail/reports/queue',require(_0x8dd6('0x2c')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x2d'),require('./api/dashboard'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x2e'),require(_0x8dd6('0x2f')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x30'),require('./api/faxAccount'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x31'),require('./api/faxApplication'));_0x469e0c['use'](_0x8dd6('0x32'),require(_0x8dd6('0x33')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x34'),require(_0x8dd6('0x35')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x36'),require(_0x8dd6('0x37')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x38'),require(_0x8dd6('0x39')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x3a'),require(_0x8dd6('0x3b')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x3c'),require(_0x8dd6('0x3d')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x3e'),require(_0x8dd6('0x3f')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x40'),require('./api/smsMessage'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x41'),require(_0x8dd6('0x42')));_0x469e0c[_0x8dd6('0x6')]('/api/openchannel/accounts',require(_0x8dd6('0x43')));_0x469e0c['use']('/api/openchannel/applications',require(_0x8dd6('0x44')));_0x469e0c[_0x8dd6('0x6')]('/api/openchannel/interactions',require(_0x8dd6('0x45')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x46'),require(_0x8dd6('0x47')));_0x469e0c[_0x8dd6('0x6')]('/api/openchannel/queues',require(_0x8dd6('0x48')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x49'),require(_0x8dd6('0x4a')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x4b'),require(_0x8dd6('0x4c')));_0x469e0c['use'](_0x8dd6('0x4d'),require(_0x8dd6('0x4e')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x4f'),require(_0x8dd6('0x50')));_0x469e0c[_0x8dd6('0x6')]('/api/chat/messages',require(_0x8dd6('0x51')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x52'),require(_0x8dd6('0x53')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x54'),require(_0x8dd6('0x55')));_0x469e0c['use'](_0x8dd6('0x56'),require(_0x8dd6('0x57')));_0x469e0c[_0x8dd6('0x6')]('/api/chat/proactive_actions',require(_0x8dd6('0x58')));_0x469e0c['use'](_0x8dd6('0x59'),require(_0x8dd6('0x5a')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x5b'),require('./api/cmContact'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x5c'),require(_0x8dd6('0x5d')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x5e'),require(_0x8dd6('0x5f')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x60'),require(_0x8dd6('0x61')));_0x469e0c['use'](_0x8dd6('0x62'),require(_0x8dd6('0x63')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x64'),require(_0x8dd6('0x65')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x66'),require(_0x8dd6('0x67')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x68'),require('./api/automation'));_0x469e0c[_0x8dd6('0x6')]('/api/canned_answers',require(_0x8dd6('0x69')));_0x469e0c[_0x8dd6('0x6')]('/api/dispositions',require(_0x8dd6('0x6a')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x6b'),require(_0x8dd6('0x6c')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x6d'),require('./api/interval'));_0x469e0c[_0x8dd6('0x6')]('/api/pauses',require(_0x8dd6('0x6e')));_0x469e0c[_0x8dd6('0x6')]('/api/cdr',require(_0x8dd6('0x6f')));_0x469e0c['use']('/api/voiceQueuesLog',require(_0x8dd6('0x70')));_0x469e0c['use'](_0x8dd6('0x71'),require(_0x8dd6('0x72')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x73'),require('./api/sound'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x74'),require(_0x8dd6('0x75')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x76'),require(_0x8dd6('0x77')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x78'),require('./api/cmContactHasItem'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x79'),require(_0x8dd6('0x7a')));_0x469e0c['use']('/api/templates',require(_0x8dd6('0x7b')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x7c'),require('./api/trigger'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x7d'),require('./api/variable'));_0x469e0c['use']('/api/integrations',require(_0x8dd6('0x7e')));_0x469e0c['use'](_0x8dd6('0x7f'),require('./api/integrationReport'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x80'),require(_0x8dd6('0x81')));_0x469e0c['use'](_0x8dd6('0x82'),require(_0x8dd6('0x83')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x84'),require(_0x8dd6('0x85')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x86'),require(_0x8dd6('0x87')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x88'),require(_0x8dd6('0x89')));_0x469e0c['use'](_0x8dd6('0x8a'),require('./api/analyticTreeReport'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x8b'),require(_0x8dd6('0x8c')));_0x469e0c['use']('/api/integrations/salesforce/configurations',require(_0x8dd6('0x8d')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x8e'),require(_0x8dd6('0x8f')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x90'),require(_0x8dd6('0x91')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x92'),require('./api/intSugarcrmConfiguration'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x93'),require('./api/intSugarcrmField'));_0x469e0c['use']('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x94'),require(_0x8dd6('0x95')));_0x469e0c['use'](_0x8dd6('0x96'),require(_0x8dd6('0x97')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x98'),require(_0x8dd6('0x99')));_0x469e0c[_0x8dd6('0x6')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x9a'),require(_0x8dd6('0x9b')));_0x469e0c[_0x8dd6('0x6')]('/api/integrations/zendesk/accounts',require(_0x8dd6('0x9c')));_0x469e0c['use'](_0x8dd6('0x9d'),require('./api/intZendeskConfiguration'));_0x469e0c[_0x8dd6('0x6')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x469e0c['use']('/api/integrations/freshdesk/accounts',require(_0x8dd6('0x9e')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x9f'),require('./api/intFreshdeskConfiguration'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xa0'),require('./api/intFreshdeskField'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xa1'),require(_0x8dd6('0xa2')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xa3'),require(_0x8dd6('0xa4')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xa5'),require(_0x8dd6('0xa6')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xa7'),require('./api/intServicenowAccount'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xa8'),require(_0x8dd6('0xa9')));_0x469e0c['use'](_0x8dd6('0xaa'),require('./api/intServicenowField'));_0x469e0c[_0x8dd6('0x6')]('/api/integrations/dynamics365/accounts',require(_0x8dd6('0xab')));_0x469e0c[_0x8dd6('0x6')]('/api/integrations/dynamics365/configurations',require(_0x8dd6('0xac')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xad'),require(_0x8dd6('0xae')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xaf'),require('./api/intFreshsalesAccount'));_0x469e0c[_0x8dd6('0x6')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xb0'),require(_0x8dd6('0xb1')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xb2'),require(_0x8dd6('0xb3')));_0x469e0c[_0x8dd6('0x6')]('/api/chat/reports/queue',require(_0x8dd6('0xb4')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xb5'),require('./api/chatInternalMessage'));_0x469e0c['use']('/api/jscripty/answers/reports',require(_0x8dd6('0xb6')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xb7'),require(_0x8dd6('0xb8')));_0x469e0c['use'](_0x8dd6('0xb9'),require(_0x8dd6('0xba')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xbb'),require(_0x8dd6('0xbc')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xbd'),require(_0x8dd6('0xbe')));_0x469e0c['use']('/api/square/details/reports',require(_0x8dd6('0xbf')));_0x469e0c['use']('/api/jscripty/projects',require(_0x8dd6('0xc0')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xc1'),require(_0x8dd6('0xc2')));_0x469e0c['use'](_0x8dd6('0xc3'),require(_0x8dd6('0xc4')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xc5'),require(_0x8dd6('0xc6')));_0x469e0c['use']('/api/square/recordings',require(_0x8dd6('0xc7')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xc8'),require('./api/squareMessage'));_0x469e0c['use'](_0x8dd6('0xc9'),require(_0x8dd6('0xca')));_0x469e0c[_0x8dd6('0x6')]('/api/license',require(_0x8dd6('0xcb')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xcc'),require('./api/campaign'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xcd'),require(_0x8dd6('0xce')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xcf'),require(_0x8dd6('0xd0')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xd1'),require(_0x8dd6('0xd2')));_0x469e0c['use'](_0x8dd6('0xd3'),require('./api/mailTransferReport'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xd4'),require(_0x8dd6('0xd5')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xd6'),require(_0x8dd6('0xd7')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xd8'),require(_0x8dd6('0xd9')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xda'),require('./api/smsTransferReport'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xdb'),require('./api/cmList'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xdc'),require(_0x8dd6('0xdd')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xde'),require(_0x8dd6('0xdf')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xe0'),require('./api/userProfileSection'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xe1'),require(_0x8dd6('0xe2')));_0x469e0c['use'](_0x8dd6('0xe3'),require(_0x8dd6('0xe4')));_0x469e0c['use'](_0x8dd6('0xe5'),require('./api/whatsappAccount'));_0x469e0c['use'](_0x8dd6('0xe6'),require('./api/whatsappApplication'));_0x469e0c[_0x8dd6('0x6')]('/api/whatsapp/interactions',require(_0x8dd6('0xe7')));_0x469e0c[_0x8dd6('0x6')]('/api/whatsapp/messages',require(_0x8dd6('0xe8')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xe9'),require(_0x8dd6('0xea')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xeb'),require(_0x8dd6('0xec')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xed'),require(_0x8dd6('0xee')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xef'),require(_0x8dd6('0xf0')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xf1'),require('./api/realtime'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xf2'),require(_0x8dd6('0xf3')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xf4'),require(_0x8dd6('0xf5')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xf6'),require('./api/authLocal'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xf7'),require(_0x8dd6('0xf8')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xf9'),require('./api/authActiveDirectory'));_0x469e0c['use']('/api/jira',require(_0x8dd6('0xfa')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xfb'),require(_0x8dd6('0xfc')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xfd'),require(_0x8dd6('0xfe')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0xff'),require(_0x8dd6('0x100')));_0x469e0c['use'](_0x8dd6('0x101'),require(_0x8dd6('0x102')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x103'),require('./api/webbar'));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x104'),clientSideLogs);_0x469e0c['use']('/apidoc',express[_0x8dd6('0x105')](path[_0x8dd6('0x106')](config[_0x8dd6('0x107')],'/apidoc')));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x108'),express[_0x8dd6('0x105')](path[_0x8dd6('0x106')](config['root'],_0x8dd6('0x108'))));_0x469e0c[_0x8dd6('0x6')]('/demo',express[_0x8dd6('0x105')](path[_0x8dd6('0x106')](config[_0x8dd6('0x107')],_0x8dd6('0x109'))));_0x469e0c[_0x8dd6('0x6')](_0x8dd6('0x10a'),express['static'](path[_0x8dd6('0x106')](config[_0x8dd6('0x107')],_0x8dd6('0x10b'),_0x8dd6('0x10c'))));_0x469e0c['use'](_0x8dd6('0x10d'),express['static'](path[_0x8dd6('0x106')](config['root'],_0x8dd6('0x10e'))));_0x469e0c[_0x8dd6('0x10f')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x8dd6('0x110')](errors[0x194]);_0x469e0c[_0x8dd6('0x10f')]('/*')['get'](function(_0x5bd4b8,_0x615a3e){_0x615a3e['sendFile'](path[_0x8dd6('0x111')](_0x469e0c[_0x8dd6('0x110')](_0x8dd6('0x112'))+_0x8dd6('0x113')));});return _0x469e0c;});}; \ No newline at end of file +var _0xf3fe=['/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/tag','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integrationReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/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/intFreshdeskField','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/chatTransferReport','/api/fax/reports/transfer','/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/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/snippet','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage'];(function(_0x951b5d,_0x2feee6){var _0x3fe65d=function(_0x29a01d){while(--_0x29a01d){_0x951b5d['push'](_0x951b5d['shift']());}};_0x3fe65d(++_0x2feee6);}(_0xf3fe,0x1cd));var _0xef3f=function(_0x167295,_0x555a81){_0x167295=_0x167295-0x0;var _0x400be6=_0xf3fe[_0x167295];return _0x400be6;};'use strict';var path=require('path');var express=require(_0xef3f('0x0'));var errors=require(_0xef3f('0x1'));var config=require(_0xef3f('0x2'));var setupLoggers=require(_0xef3f('0x3'))[_0xef3f('0x4')];var clientSideLogs=require('./api/client-side-logs');exports[_0xef3f('0x5')]=function(_0x18a97c){return setupLoggers(_0x18a97c)[_0xef3f('0x6')](function(){_0x18a97c[_0xef3f('0x7')](_0xef3f('0x8'),require('./api/user'));_0x18a97c['use'](_0xef3f('0x9'),require(_0xef3f('0xa')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xb'),require(_0xef3f('0xc')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xd'),require(_0xef3f('0xe')));_0x18a97c[_0xef3f('0x7')]('/api/voice/mohs',require(_0xef3f('0xf')));_0x18a97c['use'](_0xef3f('0x10'),require(_0xef3f('0x11')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x12'),require('./api/voiceRecording'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x13'),require('./api/screenRecording'));_0x18a97c[_0xef3f('0x7')]('/api/voice/mails',require(_0xef3f('0x14')));_0x18a97c['use'](_0xef3f('0x15'),require(_0xef3f('0x16')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x17'),require(_0xef3f('0x18')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x19'),require(_0xef3f('0x1a')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x1b'),require(_0xef3f('0x1c')));_0x18a97c['use'](_0xef3f('0x1d'),require(_0xef3f('0x1e')));_0x18a97c['use'](_0xef3f('0x1f'),require(_0xef3f('0x20')));_0x18a97c['use']('/api/trunks',require('./api/trunk'));_0x18a97c['use'](_0xef3f('0x21'),require(_0xef3f('0x22')));_0x18a97c['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x18a97c[_0xef3f('0x7')]('/api/mail/accounts',require(_0xef3f('0x23')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x24'),require(_0xef3f('0x25')));_0x18a97c['use']('/api/mail/substatuses',require(_0xef3f('0x26')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x27'),require(_0xef3f('0x28')));_0x18a97c[_0xef3f('0x7')]('/api/mail/messages',require(_0xef3f('0x29')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x2a'),require(_0xef3f('0x2b')));_0x18a97c['use'](_0xef3f('0x2c'),require(_0xef3f('0x2d')));_0x18a97c['use'](_0xef3f('0x2e'),require('./api/dashboard'));_0x18a97c[_0xef3f('0x7')]('/api/dashboards/items',require('./api/dashboardItem'));_0x18a97c['use'](_0xef3f('0x2f'),require(_0xef3f('0x30')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x31'),require(_0xef3f('0x32')));_0x18a97c[_0xef3f('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x18a97c['use'](_0xef3f('0x33'),require(_0xef3f('0x34')));_0x18a97c[_0xef3f('0x7')]('/api/fax/queues',require(_0xef3f('0x35')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x36'),require(_0xef3f('0x37')));_0x18a97c['use'](_0xef3f('0x38'),require(_0xef3f('0x39')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x3a'),require('./api/smsApplication'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x3b'),require(_0xef3f('0x3c')));_0x18a97c[_0xef3f('0x7')]('/api/sms/messages',require(_0xef3f('0x3d')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x3e'),require('./api/smsQueue'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x3f'),require(_0xef3f('0x40')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x41'),require(_0xef3f('0x42')));_0x18a97c['use'](_0xef3f('0x43'),require('./api/openchannelInteraction'));_0x18a97c[_0xef3f('0x7')]('/api/openchannel/messages',require(_0xef3f('0x44')));_0x18a97c['use']('/api/openchannel/queues',require('./api/openchannelQueue'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x45'),require(_0xef3f('0x46')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x47'),require(_0xef3f('0x48')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x49'),require('./api/chatApplication'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x4a'),require(_0xef3f('0x4b')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x4c'),require(_0xef3f('0x4d')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x4e'),require(_0xef3f('0x4f')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x50'),require(_0xef3f('0x51')));_0x18a97c[_0xef3f('0x7')]('/api/chat/groups',require(_0xef3f('0x52')));_0x18a97c[_0xef3f('0x7')]('/api/chat/proactive_actions',require('./api/chatProactiveAction'));_0x18a97c[_0xef3f('0x7')]('/api/cm/companies',require(_0xef3f('0x53')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x54'),require(_0xef3f('0x55')));_0x18a97c[_0xef3f('0x7')]('/api/cm/hopper',require(_0xef3f('0x56')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x57'),require(_0xef3f('0x58')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x59'),require('./api/cmHopperFinal'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x5a'),require(_0xef3f('0x5b')));_0x18a97c['use']('/api/cm/custom_fields',require(_0xef3f('0x5c')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x5d'),require('./api/action'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x5e'),require(_0xef3f('0x5f')));_0x18a97c[_0xef3f('0x7')]('/api/canned_answers',require(_0xef3f('0x60')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x61'),require('./api/disposition'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x62'),require(_0xef3f('0x63')));_0x18a97c[_0xef3f('0x7')]('/api/intervals',require(_0xef3f('0x64')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x65'),require('./api/pause'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x66'),require('./api/cdr'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x67'),require(_0xef3f('0x68')));_0x18a97c['use'](_0xef3f('0x69'),require('./api/schedule'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x6a'),require('./api/sound'));_0x18a97c[_0xef3f('0x7')]('/api/tags',require(_0xef3f('0x6b')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x6c'),require(_0xef3f('0x6d')));_0x18a97c['use']('/api/cm_contact_has_items',require(_0xef3f('0x6e')));_0x18a97c[_0xef3f('0x7')]('/api/cm_hopper_additional_phones',require(_0xef3f('0x6f')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x70'),require(_0xef3f('0x71')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x72'),require(_0xef3f('0x73')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x74'),require(_0xef3f('0x75')));_0x18a97c[_0xef3f('0x7')]('/api/integrations',require('./api/integration'));_0x18a97c[_0xef3f('0x7')]('/api/integrations/reports',require(_0xef3f('0x76')));_0x18a97c['use']('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x77'),require('./api/analyticDefaultReport'));_0x18a97c['use'](_0xef3f('0x78'),require('./api/analyticExtractedReport'));_0x18a97c['use'](_0xef3f('0x79'),require('./api/analyticMetric'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x7a'),require('./api/analyticFieldReport'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x7b'),require(_0xef3f('0x7c')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/salesforce/accounts',require(_0xef3f('0x7d')));_0x18a97c['use']('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x7e'),require(_0xef3f('0x7f')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x80'),require(_0xef3f('0x81')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xef3f('0x82')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/sugarcrm/fields',require(_0xef3f('0x83')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x84'),require(_0xef3f('0x85')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x86'),require(_0xef3f('0x87')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/desk/fields',require(_0xef3f('0x88')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x89'),require('./api/intZohoAccount'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x8a'),require(_0xef3f('0x8b')));_0x18a97c['use'](_0xef3f('0x8c'),require(_0xef3f('0x8d')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/zendesk/accounts',require(_0xef3f('0x8e')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x8f'),require(_0xef3f('0x90')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x91'),require(_0xef3f('0x92')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x93'),require(_0xef3f('0x94')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/freshdesk/configurations',require(_0xef3f('0x95')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x96'),require(_0xef3f('0x97')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0x18a97c[_0xef3f('0x7')]('/api/integrations/vtiger/configurations',require(_0xef3f('0x98')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x99'),require(_0xef3f('0x9a')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x9b'),require(_0xef3f('0x9c')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x9d'),require(_0xef3f('0x9e')));_0x18a97c['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x9f'),require(_0xef3f('0xa0')));_0x18a97c['use'](_0xef3f('0xa1'),require('./api/intDynamics365Configuration'));_0x18a97c['use']('/api/integrations/dynamics365/fields',require(_0xef3f('0xa2')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xa3'),require(_0xef3f('0xa4')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xa5'),require(_0xef3f('0xa6')));_0x18a97c[_0xef3f('0x7')]('/api/integrations/freshsales/fields',require(_0xef3f('0xa7')));_0x18a97c[_0xef3f('0x7')]('/api/networks',require('./api/network'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xa8'),require(_0xef3f('0xa9')));_0x18a97c[_0xef3f('0x7')]('/api/chat/internal/messages',require(_0xef3f('0xaa')));_0x18a97c[_0xef3f('0x7')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xab'),require(_0xef3f('0xac')));_0x18a97c['use']('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x18a97c['use'](_0xef3f('0xad'),require('./api/smsQueueReport'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xae'),require(_0xef3f('0xaf')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xb0'),require(_0xef3f('0xb1')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xb2'),require(_0xef3f('0xb3')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xb4'),require(_0xef3f('0xb5')));_0x18a97c[_0xef3f('0x7')]('/api/square/odbc',require(_0xef3f('0xb6')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xb7'),require(_0xef3f('0xb8')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xb9'),require(_0xef3f('0xba')));_0x18a97c[_0xef3f('0x7')]('/api/square/messages',require(_0xef3f('0xbb')));_0x18a97c['use'](_0xef3f('0xbc'),require(_0xef3f('0xbd')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xbe'),require('./api/license'));_0x18a97c[_0xef3f('0x7')]('/api/campaigns',require('./api/campaign'));_0x18a97c['use'](_0xef3f('0xbf'),require(_0xef3f('0xc0')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xc1'),require(_0xef3f('0xc2')));_0x18a97c[_0xef3f('0x7')]('/api/plugins',require(_0xef3f('0xc3')));_0x18a97c[_0xef3f('0x7')]('/api/mail/reports/transfer',require('./api/mailTransferReport'));_0x18a97c['use']('/api/chat/reports/transfer',require(_0xef3f('0xc4')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xc5'),require('./api/faxTransferReport'));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xc6'),require(_0xef3f('0xc7')));_0x18a97c[_0xef3f('0x7')]('/api/sms/reports/transfer',require(_0xef3f('0xc8')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xc9'),require(_0xef3f('0xca')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xcb'),require(_0xef3f('0xcc')));_0x18a97c['use'](_0xef3f('0xcd'),require(_0xef3f('0xce')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xcf'),require(_0xef3f('0xd0')));_0x18a97c[_0xef3f('0x7')]('/api/userProfile/resources',require(_0xef3f('0xd1')));_0x18a97c[_0xef3f('0x7')]('/api/userNotifications',require(_0xef3f('0xd2')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xd3'),require(_0xef3f('0xd4')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xd5'),require(_0xef3f('0xd6')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xd7'),require(_0xef3f('0xd8')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xd9'),require(_0xef3f('0xda')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xdb'),require(_0xef3f('0xdc')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xdd'),require(_0xef3f('0xde')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xdf'),require(_0xef3f('0xe0')));_0x18a97c[_0xef3f('0x7')]('/api/cloudProviders',require(_0xef3f('0xe1')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xe2'),require(_0xef3f('0xe3')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xe4'),require(_0xef3f('0xe5')));_0x18a97c['use'](_0xef3f('0xe6'),require(_0xef3f('0xe7')));_0x18a97c['use'](_0xef3f('0xe8'),require(_0xef3f('0xe9')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xea'),require(_0xef3f('0xeb')));_0x18a97c['use']('/api/auth/activedirectory',require(_0xef3f('0xec')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xed'),require(_0xef3f('0xee')));_0x18a97c[_0xef3f('0x7')]('/api/rpc',require(_0xef3f('0xef')));_0x18a97c['use'](_0xef3f('0xf0'),require(_0xef3f('0xf1')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xf2'),require(_0xef3f('0xf3')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xf4'),require(_0xef3f('0xf5')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xf6'),require(_0xef3f('0xf7')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xf8'),clientSideLogs);_0x18a97c[_0xef3f('0x7')](_0xef3f('0xf9'),express[_0xef3f('0xfa')](path[_0xef3f('0xfb')](config[_0xef3f('0xfc')],'/apidoc')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xfd'),express['static'](path['join'](config['root'],_0xef3f('0xfd'))));_0x18a97c[_0xef3f('0x7')]('/demo',express[_0xef3f('0xfa')](path[_0xef3f('0xfb')](config[_0xef3f('0xfc')],'/demo')));_0x18a97c[_0xef3f('0x7')](_0xef3f('0xfe'),express[_0xef3f('0xfa')](path[_0xef3f('0xfb')](config[_0xef3f('0xfc')],_0xef3f('0xff'),_0xef3f('0x100'))));_0x18a97c[_0xef3f('0x7')](_0xef3f('0x101'),express['static'](path[_0xef3f('0xfb')](config[_0xef3f('0xfc')],_0xef3f('0x102'))));_0x18a97c[_0xef3f('0x103')](_0xef3f('0x104'))[_0xef3f('0x105')](errors[0x194]);_0x18a97c[_0xef3f('0x103')]('/*')[_0xef3f('0x105')](function(_0x31a2a2,_0x52848d){_0x52848d[_0xef3f('0x106')](path[_0xef3f('0x107')](_0x18a97c['get'](_0xef3f('0x108'))+'/index.html'));});return _0x18a97c;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c111a70..43ae856 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7560=['../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.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/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x7560,0x18c));var _0x0756=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0x7560[_0x59b439];return _0x521ea3;};'use strict';var jayson=require(_0x0756('0x0'));var _=require(_0x0756('0x1'));var config=require(_0x0756('0x2'));exports[_0x0756('0x3')]=function(){return new Promise(function(_0x4e5dd0,_0x47a943){var _0x5294af={};_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x5')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x6')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x7')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x8')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x9')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0xa')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0xb')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/memberReport/memberReport.rpc'));_0x5294af=_['merge'](_0x5294af,require('../api/trunk/trunk.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0xc')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0xd')));_0x5294af=_['merge'](_0x5294af,require('../api/mailServerIn/mailServerIn.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0xe')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0xf')));_0x5294af=_['merge'](_0x5294af,require('../api/mailInteraction/mailInteraction.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/mailMessage/mailMessage.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x10')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x11')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/faxApplication/faxApplication.rpc'));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x12')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x13')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x14')));_0x5294af=_['merge'](_0x5294af,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/smsAccount/smsAccount.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/smsInteraction/smsInteraction.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/smsMessage/smsMessage.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x15')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x16')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x17')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x18')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x19')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x1a')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x1b')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x1c')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x1d')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x1e')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/cmHopper/cmHopper.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x1f')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x20')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x21')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x22')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x23')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x24')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x25')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x26')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x27')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x28')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x29')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x2a')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x2b')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x2c')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x2d')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x2e')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x2f')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x30')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x31')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x32')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x33')));_0x5294af=_['merge'](_0x5294af,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x34')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x35')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x36')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x37')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x38')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/squareRecording/squareRecording.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x39')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x3a')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x3b')));_0x5294af=_['merge'](_0x5294af,require(_0x0756('0x3c')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x3d')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x3e')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5294af=_[_0x0756('0x4')](_0x5294af,require(_0x0756('0x3f')));_0x5294af=_[_0x0756('0x4')](_0x5294af,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x5b1634=jayson[_0x0756('0x40')](_0x5294af)[_0x0756('0x41')]();var _0x134aaa=config[_0x0756('0x42')][_0x0756('0x43')]||config[_0x0756('0x43')]+0x1;var _0x540c90=config['rpc']['ip']||_0x0756('0x44');_0x5b1634['on'](_0x0756('0x45'),function(_0x20ad72){return _0x47a943(_0x20ad72);});_0x5b1634['listen'](_0x134aaa,_0x540c90,function(){console[_0x0756('0x46')](_0x0756('0x47'),_0x540c90,_0x134aaa);require('../config/triggers')[_0x0756('0x48')]();return _0x4e5dd0(_0x0756('0x49')+_0x540c90+':'+_0x134aaa);});});}; \ No newline at end of file +var _0x6c32=['../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/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','../api/pause/pause.rpc','../api/sound/sound.rpc'];(function(_0x2399ad,_0x9404ce){var _0x32221b=function(_0x299da1){while(--_0x299da1){_0x2399ad['push'](_0x2399ad['shift']());}};_0x32221b(++_0x9404ce);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x26c3('0x0'));var _=require('lodash');var config=require(_0x26c3('0x1'));exports['listen']=function(){return new Promise(function(_0x3428b4,_0x4eac69){var _0x3847b3={};_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/user/user.rpc'));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x3')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x4')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x5')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x6')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x7')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x8')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x9')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/trunk/trunk.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0xa')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0xb')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/mailServerIn/mailServerIn.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0xc')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0xd')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0xe')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0xf')));_0x3847b3=_['merge'](_0x3847b3,require('../api/mailApplication/mailApplication.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x10')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x11')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x12')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x13')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/faxMessage/faxMessage.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/faxQueue/faxQueue.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x14')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x15')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x16')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x17')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x18')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x19')));_0x3847b3=_['merge'](_0x3847b3,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x1a')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x1b')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x1c')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x1d')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x1e')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x1f')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x20')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x21')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x22')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x23')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x3847b3=_['merge'](_0x3847b3,require('../api/interval/interval.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x24')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x25')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x26')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x27')));_0x3847b3=_['merge'](_0x3847b3,require('../api/variable/variable.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x28')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x29')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x2a')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x2b')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x2c')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x2d')));_0x3847b3=_['merge'](_0x3847b3,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x2e')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x2f')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x30')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x31')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x32')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x33')));_0x3847b3=_['merge'](_0x3847b3,require('../api/squareProject/squareProject.rpc'));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x34')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x35')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x36')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x37')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x38')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x39')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x3a')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x3b')));_0x3847b3=_[_0x26c3('0x2')](_0x3847b3,require(_0x26c3('0x3c')));_0x3847b3=_['merge'](_0x3847b3,require(_0x26c3('0x3d')));var _0x304766=jayson[_0x26c3('0x3e')](_0x3847b3)[_0x26c3('0x3f')]();var _0x5d0d50=config[_0x26c3('0x40')][_0x26c3('0x41')]||config[_0x26c3('0x41')]+0x1;var _0x2783a3=config[_0x26c3('0x40')]['ip']||_0x26c3('0x42');_0x304766['on'](_0x26c3('0x43'),function(_0x1f2a3d){return _0x4eac69(_0x1f2a3d);});_0x304766[_0x26c3('0x44')](_0x5d0d50,_0x2783a3,function(){console['log'](_0x26c3('0x45'),_0x2783a3,_0x5d0d50);require(_0x26c3('0x46'))[_0x26c3('0x47')]();return _0x3428b4(_0x26c3('0x48')+_0x2783a3+':'+_0x5d0d50);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 3700782..3f34c0d 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 _0xd663=['agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./reply','./error','setEncoding','utf8','setTimeout','headers','emit','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','error','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xd663,0xf0));var _0x3d66=function(_0xa27a72,_0x363939){_0xa27a72=_0xa27a72-0x0;var _0x44c9aa=_0xd663[_0xa27a72];return _0x44c9aa;};'use strict';var util=require(_0x3d66('0x0'));var _=require(_0x3d66('0x1'));var EventEmitter=require(_0x3d66('0x2'))['EventEmitter'];var AGIReply=require(_0x3d66('0x3'));var AGIError=require(_0x3d66('0x4'));function AGIChannel(_0x44bebe){var _0x5766c9=this,_0x31971b=new AGIReply(),_0xb66d04=![],_0x2a6137={};EventEmitter['call'](_0x5766c9);_0x44bebe[_0x3d66('0x5')](_0x3d66('0x6'));_0x44bebe[_0x3d66('0x7')](0x8*0x3c*0x3c*0x3e8);_0x31971b[_0x3d66('0x5')]('utf8');_0x31971b['on'](_0x3d66('0x8'),function(_0x15b8cc){for(var _0x3ff200 in _0x15b8cc){_0x5766c9[_0x3ff200]=_0x15b8cc[_0x3ff200];}_0x5766c9[_0x3d66('0x9')]('ready');});_0x31971b['on'](_0x3d66('0xa'),function(_0x34d682){if(_0x34d682['toLowerCase']()==_0x3d66('0xb')){_0x5766c9[_0x3d66('0x9')](_0x3d66('0xb'));return;}if(_0x34d682[_0x3d66('0xc')](0x0,0xb)==_0x3d66('0xd')){_0xb66d04=!![];}if(_0xb66d04){_0x2a6137['rx']+=_0x34d682+'\x0a';if(_0x34d682[_0x3d66('0xe')](_0x3d66('0xf'))!=-0x1){_0xb66d04=![];}}else{_0x2a6137['rx']=_0x34d682;}if(_0xb66d04){return;}if(typeof _0x2a6137['cb']==_0x3d66('0x10')){var _0x597152=_0x2a6137['rx'][_0x3d66('0xc')](0x0,0x3),_0x36d875=null,_0x36817c=null;_0x597152=parseInt(_0x597152);if(isNaN(_0x597152)){_0x2a6137['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3d66('0x11')});return;}if(_0x597152!=0xc8){_0x2a6137['cb'](null,{'code':_0x597152,'result':-0x1,'extra':'KO'});return;}_0x36d875=_0x2a6137['rx'][_0x3d66('0xc')](0x4)[_0x3d66('0x12')](_0x3d66('0x13'),'');if(_0x36d875[_0x3d66('0x14')]('\x20')!=-0x1){_0x36d875=_0x36d875[_0x3d66('0x15')](0x0,_0x36d875[_0x3d66('0x14')]('\x20'));}if(_[_0x3d66('0x16')](_0x36d875,'-1')){_0x36d875=parseInt(_0x36d875);}_0x36817c=_0x2a6137['rx'][_0x3d66('0x17')]('\x20');if(_0x36817c[_0x3d66('0x18')]==0x3){_0x36817c=_0x36817c[0x2]['substring'](0x1,_0x36817c[0x2][_0x3d66('0x18')]-0x1);}else if(_0x36817c[_0x3d66('0x18')]>0x3){var _0x166b15=/\((.+)\)/;var _0x1e66e3=_0x2a6137['rx']['match'](_0x166b15);if(_0x1e66e3){_0x36817c=_0x1e66e3[0x1];}else{_0x36817c=null;}}else{_0x36817c=null;}_0x2a6137['cb'](null,{'code':_0x597152,'result':_0x36d875,'extra':_0x36817c});}});_0x44bebe['on']('error',function(_0x26fd8e){_0x5766c9[_0x3d66('0x9')](_0x3d66('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x26fd8e['code']));});_0x44bebe['on']('close',function(){_0x5766c9[_0x3d66('0x9')](_0x3d66('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x44bebe['on'](_0x3d66('0x1b'),function(){_0x5766c9[_0x3d66('0x9')](_0x3d66('0x1b'),new AGIError(_0x3d66('0x1c')));_0x44bebe[_0x3d66('0x1d')]();});_0x44bebe[_0x3d66('0x1e')](_0x31971b);this[_0x3d66('0x1f')]=function(_0x43d6ed,_0x4497c1){var _0x43d6ed=_0x43d6ed||'',_0x4497c1=typeof _0x4497c1==_0x3d66('0x10')?_0x4497c1:new Function();_0x2a6137={'tx':_0x43d6ed,'rx':'','cb':_0x4497c1};_0x44bebe[_0x3d66('0x20')](_0x43d6ed+'\x0a');},this[_0x3d66('0x1a')]=function(){_0x44bebe[_0x3d66('0x1d')]();};}util[_0x3d66('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x3d66('0x22')][_0x3d66('0x23')]=function(_0x5aacaf){return this['command'][_0x3d66('0x24')](this,_0x5aacaf);};AGIChannel['prototype'][_0x3d66('0x25')]=function(){return this[_0x3d66('0x23')]('ANSWER');};AGIChannel[_0x3d66('0x22')][_0x3d66('0x26')]=function(_0x207b8d,_0x6ad3e8,_0x54e9d4){_0x207b8d=_0x207b8d===undefined?_0x3d66('0x27'):_0x207b8d;_0x6ad3e8=_0x6ad3e8===undefined?'5':_0x6ad3e8;_0x54e9d4=_0x54e9d4===undefined?'1':_0x54e9d4;return this[_0x3d66('0x23')](util[_0x3d66('0x28')](_0x3d66('0x29'),_0x207b8d,_0x6ad3e8*0x3e8,_0x54e9d4));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x2a')]=function(_0x3d350a){_0x3d350a=_0x3d350a||'NO\x20MESSAGE';return this[_0x3d66('0x23')](util['format'](_0x3d66('0x2b'),_0x3d350a));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x2c')]=function(_0x3dea23,_0x53fe6f){if(_[_0x3d66('0x2d')](_0x53fe6f)){return this['sendRequest'](util[_0x3d66('0x28')]('EXEC\x20%s\x20%s',_0x3dea23,_0x53fe6f[_0x3d66('0x2e')](',')));}return this['sendRequest'](util[_0x3d66('0x28')](_0x3d66('0x2f'),_0x3dea23,_0x53fe6f));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x30')]=function(_0x53770c){return this[_0x3d66('0x23')](util[_0x3d66('0x28')](_0x3d66('0x31'),_0x53770c));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x32')]=function(_0x14fca3){return this[_0x3d66('0x23')](util[_0x3d66('0x28')](_0x3d66('0x33'),_0x14fca3));};AGIChannel['prototype']['setPriority']=function(_0x4306df){return this[_0x3d66('0x23')](util[_0x3d66('0x28')]('SET\x20PRIORITY\x20%s',_0x4306df));};AGIChannel['prototype'][_0x3d66('0xb')]=function(){return this['sendRequest'](_0x3d66('0x34'));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x35')]=function(_0x4a8a50,_0x436f99){var _0x198e7b=_[_0x3d66('0x36')](_0x436f99)||_['isNumber'](_0x436f99)?_0x436f99['toString']():_0x436f99;return this[_0x3d66('0x23')](util[_0x3d66('0x28')](_0x3d66('0x37'),_0x4a8a50,_0x198e7b?_0x198e7b['toString']()[_0x3d66('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x38')]=function(_0x19e874,_0x2bdf3d){return this['sendRequest'](util['format'](_0x3d66('0x39'),_0x19e874,_0x2bdf3d));};AGIChannel['prototype'][_0x3d66('0x3a')]=function(_0x3f69a6,_0x156465){return this['sendRequest'](util[_0x3d66('0x28')](_0x3d66('0x3b'),_0x3f69a6,_0x156465));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x3c')]=function(_0x4f01d7,_0xb18159){return this[_0x3d66('0x23')](util['format'](_0x3d66('0x3d'),_0x4f01d7,_0xb18159));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x3e')]=function(_0x15f49e,_0x1b1cda,_0x91132e){_0x1b1cda=_0x1b1cda||this[_0x3d66('0x3f')];_0x91132e=_0x91132e||0x1;this[_0x3d66('0x30')](_0x15f49e);this[_0x3d66('0x32')](_0x1b1cda);this[_0x3d66('0x40')](_0x91132e);return this[_0x3d66('0x2a')](util[_0x3d66('0x28')](_0x3d66('0x41'),_0x15f49e,_0x1b1cda,_0x91132e));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x42')]=function(_0x3fe801){return this[_0x3d66('0x23')](util[_0x3d66('0x28')](_0x3d66('0x43'),_0x3fe801));};AGIChannel[_0x3d66('0x22')]['recordFile']=function(_0x2ec9dd,_0x575c2e,_0xd5d138,_0x54a6ce,_0x1e01f4,_0x5da601){_0x575c2e=_0x575c2e||_0x3d66('0x44');_0xd5d138=_0xd5d138||'';_0x54a6ce=_0x54a6ce===undefined?-0x1:_0x54a6ce==='-1'?-0x1:_0x54a6ce*0x3e8;_0x1e01f4=_0x1e01f4===undefined?'':'s='+_0x1e01f4;_0x5da601=_0x5da601?_0x3d66('0x45'):'';return this[_0x3d66('0x23')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x2ec9dd,_0x575c2e,_0xd5d138,_0x54a6ce,_0x5da601,_0x1e01f4));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x46')]=function(_0x3da9b7,_0x2010f7){_0x2010f7=_0x2010f7||'';return this[_0x3d66('0x23')](util['format'](_0x3d66('0x47'),_0x3da9b7,_0x2010f7));};AGIChannel[_0x3d66('0x22')][_0x3d66('0x48')]=function(_0x14b104){return this['exec'](_0x3d66('0x49'),_0x14b104);};AGIChannel[_0x3d66('0x22')][_0x3d66('0x4a')]=function(_0x2dd202){return this['exec']('WAIT',_0x2dd202);};AGIChannel[_0x3d66('0x22')][_0x3d66('0x19')]=function(_0x3aa439,_0x11342e){this['noop'](util[_0x3d66('0x28')](_0x3d66('0x4b'),_0x3aa439['id'],_0x3aa439[_0x3d66('0x4c')],_0x11342e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3d66('0x4d')]=AGIChannel; \ No newline at end of file +var _0xbc37=['sendRequest','sync','prototype','answer','ANSWER','getData','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\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./reply','./error','call','utf8','setEncoding','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xbc37,0x11a));var _0x7bc3=function(_0x587735,_0x382c7d){_0x587735=_0x587735-0x0;var _0xcf1087=_0xbc37[_0x587735];return _0xcf1087;};'use strict';var util=require(_0x7bc3('0x0'));var _=require(_0x7bc3('0x1'));var EventEmitter=require('events')[_0x7bc3('0x2')];var AGIReply=require(_0x7bc3('0x3'));var AGIError=require(_0x7bc3('0x4'));function AGIChannel(_0x12e140){var _0x5c1914=this,_0x372ad2=new AGIReply(),_0x1524ac=![],_0x2aebf2={};EventEmitter[_0x7bc3('0x5')](_0x5c1914);_0x12e140['setEncoding'](_0x7bc3('0x6'));_0x12e140['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x372ad2[_0x7bc3('0x7')](_0x7bc3('0x6'));_0x372ad2['on'](_0x7bc3('0x8'),function(_0x48fb5b){for(var _0x28e602 in _0x48fb5b){_0x5c1914[_0x28e602]=_0x48fb5b[_0x28e602];}_0x5c1914[_0x7bc3('0x9')](_0x7bc3('0xa'));});_0x372ad2['on'](_0x7bc3('0xb'),function(_0x5bc8cd){if(_0x5bc8cd['toLowerCase']()==_0x7bc3('0xc')){_0x5c1914[_0x7bc3('0x9')](_0x7bc3('0xc'));return;}if(_0x5bc8cd[_0x7bc3('0xd')](0x0,0xb)==_0x7bc3('0xe')){_0x1524ac=!![];}if(_0x1524ac){_0x2aebf2['rx']+=_0x5bc8cd+'\x0a';if(_0x5bc8cd[_0x7bc3('0xf')](_0x7bc3('0x10'))!=-0x1){_0x1524ac=![];}}else{_0x2aebf2['rx']=_0x5bc8cd;}if(_0x1524ac){return;}if(typeof _0x2aebf2['cb']=='function'){var _0x50b00c=_0x2aebf2['rx'][_0x7bc3('0xd')](0x0,0x3),_0x17e70b=null,_0x32cf44=null;_0x50b00c=parseInt(_0x50b00c);if(isNaN(_0x50b00c)){_0x2aebf2['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7bc3('0x11')});return;}if(_0x50b00c!=0xc8){_0x2aebf2['cb'](null,{'code':_0x50b00c,'result':-0x1,'extra':'KO'});return;}_0x17e70b=_0x2aebf2['rx'][_0x7bc3('0xd')](0x4)['replace'](_0x7bc3('0x12'),'');if(_0x17e70b[_0x7bc3('0x13')]('\x20')!=-0x1){_0x17e70b=_0x17e70b[_0x7bc3('0x14')](0x0,_0x17e70b[_0x7bc3('0x13')]('\x20'));}if(_[_0x7bc3('0x15')](_0x17e70b,'-1')){_0x17e70b=parseInt(_0x17e70b);}_0x32cf44=_0x2aebf2['rx'][_0x7bc3('0x16')]('\x20');if(_0x32cf44['length']==0x3){_0x32cf44=_0x32cf44[0x2][_0x7bc3('0xd')](0x1,_0x32cf44[0x2][_0x7bc3('0x17')]-0x1);}else if(_0x32cf44[_0x7bc3('0x17')]>0x3){var _0x29af27=/\((.+)\)/;var _0x588aca=_0x2aebf2['rx'][_0x7bc3('0x18')](_0x29af27);if(_0x588aca){_0x32cf44=_0x588aca[0x1];}else{_0x32cf44=null;}}else{_0x32cf44=null;}_0x2aebf2['cb'](null,{'code':_0x50b00c,'result':_0x17e70b,'extra':_0x32cf44});}});_0x12e140['on'](_0x7bc3('0x19'),function(_0x45c21b){_0x5c1914['emit'](_0x7bc3('0x19'),new AGIError(_0x7bc3('0x1a'),_0x45c21b[_0x7bc3('0x1b')]));});_0x12e140['on'](_0x7bc3('0x1c'),function(){_0x5c1914['emit'](_0x7bc3('0x1c'),new AGIError(_0x7bc3('0x1d')));});_0x12e140['on']('timeout',function(){_0x5c1914[_0x7bc3('0x9')](_0x7bc3('0x1e'),new AGIError(_0x7bc3('0x1f')));_0x12e140[_0x7bc3('0x20')]();});_0x12e140[_0x7bc3('0x21')](_0x372ad2);this[_0x7bc3('0x22')]=function(_0x5ec87f,_0x4ad53d){var _0x5ec87f=_0x5ec87f||'',_0x4ad53d=typeof _0x4ad53d==_0x7bc3('0x23')?_0x4ad53d:new Function();_0x2aebf2={'tx':_0x5ec87f,'rx':'','cb':_0x4ad53d};_0x12e140[_0x7bc3('0x24')](_0x5ec87f+'\x0a');},this[_0x7bc3('0x1c')]=function(){_0x12e140[_0x7bc3('0x20')]();};}util[_0x7bc3('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x7bc3('0x26')]=function(_0x216119){return this[_0x7bc3('0x22')][_0x7bc3('0x27')](this,_0x216119);};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x29')]=function(){return this[_0x7bc3('0x26')](_0x7bc3('0x2a'));};AGIChannel['prototype'][_0x7bc3('0x2b')]=function(_0xa63259,_0x3fe7e9,_0x34907d){_0xa63259=_0xa63259===undefined?'beep':_0xa63259;_0x3fe7e9=_0x3fe7e9===undefined?'5':_0x3fe7e9;_0x34907d=_0x34907d===undefined?'1':_0x34907d;return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')](_0x7bc3('0x2d'),_0xa63259,_0x3fe7e9*0x3e8,_0x34907d));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x2e')]=function(_0x43c053){_0x43c053=_0x43c053||_0x7bc3('0x2f');return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')](_0x7bc3('0x30'),_0x43c053));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x31')]=function(_0x2248e6,_0x518bcb){if(_[_0x7bc3('0x32')](_0x518bcb)){return this['sendRequest'](util['format'](_0x7bc3('0x33'),_0x2248e6,_0x518bcb[_0x7bc3('0x34')](',')));}return this['sendRequest'](util['format'](_0x7bc3('0x33'),_0x2248e6,_0x518bcb));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x35')]=function(_0x18d974){return this[_0x7bc3('0x26')](util['format'](_0x7bc3('0x36'),_0x18d974));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x37')]=function(_0x58a6b2){return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')](_0x7bc3('0x38'),_0x58a6b2));};AGIChannel['prototype'][_0x7bc3('0x39')]=function(_0x3c07bb){return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')]('SET\x20PRIORITY\x20%s',_0x3c07bb));};AGIChannel[_0x7bc3('0x28')]['hangup']=function(){return this[_0x7bc3('0x26')](_0x7bc3('0x3a'));};AGIChannel['prototype'][_0x7bc3('0x3b')]=function(_0x3e20ac,_0x364ff4){var _0x7438af=_[_0x7bc3('0x3c')](_0x364ff4)||_[_0x7bc3('0x3d')](_0x364ff4)?_0x364ff4[_0x7bc3('0x3e')]():_0x364ff4;return this['sendRequest'](util[_0x7bc3('0x2c')](_0x7bc3('0x3f'),_0x3e20ac,_0x7438af?_0x7438af[_0x7bc3('0x3e')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x7bc3('0x40')]=function(_0x515020,_0x22f43a){return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x515020,_0x22f43a));};AGIChannel[_0x7bc3('0x28')]['sayDigits']=function(_0x27d8cb,_0x428a52){return this['sendRequest'](util[_0x7bc3('0x2c')](_0x7bc3('0x41'),_0x27d8cb,_0x428a52));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x42')]=function(_0x38b746,_0x16bb77){return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')](_0x7bc3('0x43'),_0x38b746,_0x16bb77));};AGIChannel[_0x7bc3('0x28')]['continueAt']=function(_0x17dc50,_0x416a0c,_0xac58f5){_0x416a0c=_0x416a0c||this['extension'];_0xac58f5=_0xac58f5||0x1;this[_0x7bc3('0x35')](_0x17dc50);this[_0x7bc3('0x37')](_0x416a0c);this['setPriority'](_0xac58f5);return this[_0x7bc3('0x2e')](util[_0x7bc3('0x2c')]('GOTO\x20%s\x20%s\x20%s',_0x17dc50,_0x416a0c,_0xac58f5));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x44')]=function(_0x5d1371){return this['sendRequest'](util[_0x7bc3('0x2c')](_0x7bc3('0x45'),_0x5d1371));};AGIChannel['prototype']['recordFile']=function(_0x2352c0,_0x28d8a6,_0x301abb,_0x5a11f9,_0x42060c,_0x13901a){_0x28d8a6=_0x28d8a6||_0x7bc3('0x46');_0x301abb=_0x301abb||'';_0x5a11f9=_0x5a11f9===undefined?-0x1:_0x5a11f9==='-1'?-0x1:_0x5a11f9*0x3e8;_0x42060c=_0x42060c===undefined?'':'s='+_0x42060c;_0x13901a=_0x13901a?_0x7bc3('0x47'):'';return this[_0x7bc3('0x26')](util[_0x7bc3('0x2c')](_0x7bc3('0x48'),_0x2352c0,_0x28d8a6,_0x301abb,_0x5a11f9,_0x13901a,_0x42060c));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x49')]=function(_0x4f4005,_0x5bb952){_0x5bb952=_0x5bb952||'';return this['sendRequest'](util[_0x7bc3('0x2c')](_0x7bc3('0x4a'),_0x4f4005,_0x5bb952));};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x4b')]=function(_0xc0ffdb){return this[_0x7bc3('0x31')](_0x7bc3('0x4c'),_0xc0ffdb);};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x4d')]=function(_0x59063c){return this[_0x7bc3('0x31')]('WAIT',_0x59063c);};AGIChannel[_0x7bc3('0x28')][_0x7bc3('0x19')]=function(_0x4c7923,_0x5764c9){this[_0x7bc3('0x2e')](util[_0x7bc3('0x2c')](_0x7bc3('0x4e'),_0x4c7923['id'],_0x4c7923[_0x7bc3('0x4f')],_0x5764c9));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6acc83b..512b3be 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 _0x4ce7=['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\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message','name','exports','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4ce7,0x7d));var _0x74ce=function(_0x58735f,_0x2eaa1a){_0x58735f=_0x58735f-0x0;var _0x448aef=_0x4ce7[_0x58735f];return _0x448aef;};'use strict';var util=require(_0x74ce('0x0'));var error={'E_AGI_UNDEFINED':_0x74ce('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x74ce('0x2'),'E_AGI_SERVER_CLOSE':_0x74ce('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x74ce('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x74ce('0x5'),'E_AGI_SOCKET_ERROR':_0x74ce('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x74ce('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x74ce('0x8')};function AGIError(_0x7e0d60){var _0x7e0d60=_0x7e0d60||null,_0x454115=_0x454115||[],_0x1b34c3=0x1,_0x39ebfc='';if(!error[_0x7e0d60]){_0x7e0d60='E_AGI_UNDEFINED';}_0x454115[_0x74ce('0x9')](error[_0x7e0d60]);while(arguments[_0x1b34c3]){_0x454115[_0x74ce('0x9')](arguments[_0x1b34c3]);_0x1b34c3++;}_0x39ebfc=util[_0x74ce('0xa')]['apply'](util,_0x454115);this[_0x74ce('0xb')]=_0x39ebfc;this[_0x74ce('0xc')]=_0x7e0d60;}module[_0x74ce('0xd')]=AGIError; \ No newline at end of file +var _0x5620=['name','Undefined\x20error.','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.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x233438,_0x48d3d4){var _0x4d06c3=function(_0x224386){while(--_0x224386){_0x233438['push'](_0x233438['shift']());}};_0x4d06c3(++_0x48d3d4);}(_0x5620,0x196));var _0x0562=function(_0x22d202,_0xfcd670){_0x22d202=_0x22d202-0x0;var _0x3cb212=_0x5620[_0x22d202];return _0x3cb212;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x0562('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0562('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x0562('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x0562('0x3'),'E_AGI_SOCKET_ERROR':_0x0562('0x4'),'E_AGI_SOCKET_CLOSE':_0x0562('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x0562('0x6'),'E_AGI_COMMAND_EMPTY':_0x0562('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0562('0x8')};function AGIError(_0x52a0cf){var _0x52a0cf=_0x52a0cf||null,_0x2d1af4=_0x2d1af4||[],_0x14b0a7=0x1,_0x235ea3='';if(!error[_0x52a0cf]){_0x52a0cf=_0x0562('0x9');}_0x2d1af4[_0x0562('0xa')](error[_0x52a0cf]);while(arguments[_0x14b0a7]){_0x2d1af4[_0x0562('0xa')](arguments[_0x14b0a7]);_0x14b0a7++;}_0x235ea3=util[_0x0562('0xb')][_0x0562('0xc')](util,_0x2d1af4);this[_0x0562('0xd')]=_0x235ea3;this[_0x0562('0xe')]=_0x52a0cf;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 5c94f0c..a14375a 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 _0x637f=['subscribe','E_AGI_SERVER_ERROR','message','agi','parse','emit','error','lodash','events','EventEmitter','ioredis','../../config/environment','redis','defaults'];(function(_0x364c2b,_0x2822e7){var _0x529fc4=function(_0x411afe){while(--_0x411afe){_0x364c2b['push'](_0x364c2b['shift']());}};_0x529fc4(++_0x2822e7);}(_0x637f,0x18f));var _0xf637=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x637f[_0x118139];return _0x2fece9;};'use strict';var _=require(_0xf637('0x0'));var EventEmitter=require(_0xf637('0x1'))[_0xf637('0x2')];var Redis=require(_0xf637('0x3'));var AGIError=require('./error');var config=require(_0xf637('0x4'));config[_0xf637('0x5')]=_[_0xf637('0x6')](config[_0xf637('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xf637('0x5')]);sub[_0xf637('0x7')]('agi',function(_0x2e1c77){if(_0x2e1c77)return eventEmitter['emit']('error',new AGIError(_0xf637('0x8'),_0x2e1c77));});sub['on'](_0xf637('0x9'),function(_0x4d6efd,_0x144d5a){if(_0x4d6efd!==_0xf637('0xa'))return;try{var _0x3aabb8=JSON[_0xf637('0xb')](_0x144d5a);eventEmitter[_0xf637('0xc')]('projectUpdate',_0x3aabb8);}catch(_0x3e58c8){eventEmitter[_0xf637('0xc')](_0xf637('0xd'),new AGIError(_0xf637('0x8'),_0x3e58c8));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x1ad9=['redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','exports','lodash','events','./error'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x1ad9,0xb1));var _0x91ad=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x1ad9[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x91ad('0x0'));var EventEmitter=require(_0x91ad('0x1'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require(_0x91ad('0x2'));var config=require('../../config/environment');config[_0x91ad('0x3')]=_[_0x91ad('0x4')](config[_0x91ad('0x3')],{'host':_0x91ad('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x91ad('0x3')]);sub[_0x91ad('0x6')]('agi',function(_0x506505){if(_0x506505)return eventEmitter[_0x91ad('0x7')](_0x91ad('0x8'),new AGIError(_0x91ad('0x9'),_0x506505));});sub['on'](_0x91ad('0xa'),function(_0xc1b41d,_0x5bac2a){if(_0xc1b41d!==_0x91ad('0xb'))return;try{var _0x1a3c39=JSON[_0x91ad('0xc')](_0x5bac2a);eventEmitter[_0x91ad('0x7')](_0x91ad('0xd'),_0x1a3c39);}catch(_0x578492){eventEmitter[_0x91ad('0x7')](_0x91ad('0x8'),new AGIError(_0x91ad('0x9'),_0x578492));}});module[_0x91ad('0xe')]={'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 3d31892..bd2326b 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 _0xdeff=['menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','size','relations','numberOfEdges','getVertex','traverseBFS','no\x20vertex\x20found','stop\x20traverse','info','no\x20edge/s\x20available','length','condition','split','agicommand','vswitch','default','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger'];(function(_0x528575,_0x2e067d){var _0x3063b7=function(_0x1ee183){while(--_0x1ee183){_0x528575['push'](_0x528575['shift']());}};_0x3063b7(++_0x2e067d);}(_0xdeff,0x82));var _0xfdef=function(_0x5c14f6,_0x2979d8){_0x5c14f6=_0x5c14f6-0x0;var _0x4949b3=_0xdeff[_0x5c14f6];return _0x4949b3;};'use strict';var _=require(_0xfdef('0x0'));var logger=require(_0xfdef('0x1'))('agi');var verticesWithRetry=[_0xfdef('0x2'),_0xfdef('0x3'),_0xfdef('0x4')];var Graph=function(){this[_0xfdef('0x5')]={};this[_0xfdef('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0xfdef('0x7')][_0xfdef('0x8')]=function(_0x1b7142){this['vertices'][_0x1b7142['id']]=_0x1b7142;this['edges'][_0x1b7142['id']]=[];};Graph[_0xfdef('0x7')][_0xfdef('0x9')]=function(_0x5ca3c7,_0x3de033,_0x10ed03){this['edges'][_0x5ca3c7][_0xfdef('0xa')]({'target':_0x3de033,'condition':_0x10ed03});this['numberOfEdges']+=0x1;};Graph[_0xfdef('0x7')][_0xfdef('0xb')]=function(){return _[_0xfdef('0xb')](this['vertices']);};Graph[_0xfdef('0x7')][_0xfdef('0xc')]=function(){return this[_0xfdef('0xd')];};Graph[_0xfdef('0x7')][_0xfdef('0xe')]=function(_0xae024a){return this[_0xfdef('0x5')][_0xae024a];};Graph[_0xfdef('0x7')][_0xfdef('0xf')]=function(_0x282353,_0x391999){if(!this['vertices'][_0x282353]){return logger['info'](_0xfdef('0x10'));}var _0xfe9123=_0x391999(this[_0xfdef('0x5')][_0x282353]);if(!_0xfe9123){return logger['info'](_0xfdef('0x11'));}if(this[_0xfdef('0x6')][_0x282353]['length']===0x0){return logger[_0xfdef('0x12')](_0xfdef('0x13'));}for(var _0x358ce9=0x0,_0x3da96c=[],_0x4b9f4=![];_0x358ce9\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','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','handleNotFound','production','handleUnpublished','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','connection','lodash','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','127.0.0.1'];(function(_0x1a4cb2,_0x32a85a){var _0x202c6b=function(_0x217305){while(--_0x217305){_0x1a4cb2['push'](_0x1a4cb2['shift']());}};_0x202c6b(++_0x32a85a);}(_0xfd57,0x100));var _0x7fd5=function(_0x25f2f9,_0xe3551d){_0x25f2f9=_0x25f2f9-0x0;var _0x56ed54=_0xfd57[_0x25f2f9];return _0x56ed54;};'use strict';var _=require(_0x7fd5('0x0'));var syncho=require('syncho');var util=require('util');var config=require(_0x7fd5('0x1'));var logger=require(_0x7fd5('0x2'))(_0x7fd5('0x3'));var utilLicense=require(_0x7fd5('0x4'));var rpc=require('./rpc');var Project=require(_0x7fd5('0x5'));var AGIEmitter=require(_0x7fd5('0x6'))[_0x7fd5('0x7')];var projects=[];config['agi']=_['defaults'](config[_0x7fd5('0x3')],{'ip':_0x7fd5('0x8'),'port':0x11dd});AGIEmitter['on'](_0x7fd5('0x9'),projectUpdateHandler);function connectionHandler(_0xb818eb){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xb818eb);agiHandler(_0xb818eb);}catch(_0x2bfa16){logger[_0x7fd5('0xa')](_0x2bfa16[_0x7fd5('0xb')]);}});});}function projectUpdateHandler(_0x6588d6){try{var _0x3e16f4=_['findIndex'](projects,['id',_0x6588d6['id']]);if(_0x3e16f4>-0x1){if(_0x6588d6[_0x7fd5('0xc')]===!![]){projects['splice'](_0x3e16f4,0x1);}else{projects[_0x3e16f4]=_0x6588d6;}}else{projects['push'](_0x6588d6);}}catch(_0x4a78cc){logger['error'](_0x4a78cc[_0x7fd5('0xb')]);}}function listeningHandler(){console[_0x7fd5('0xd')](_0x7fd5('0xe'),config[_0x7fd5('0x3')][_0x7fd5('0xf')]);logger[_0x7fd5('0x10')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x7fd5('0x3')]['port']));}function errorHandler(_0x11efd3){if(_0x11efd3&&_0x11efd3[_0x7fd5('0x11')]&&_0x11efd3['message']){logger['error'](util[_0x7fd5('0x12')](_0x7fd5('0x13'),_0x11efd3[_0x7fd5('0x11')],_0x11efd3[_0x7fd5('0x14')]));}else{logger[_0x7fd5('0xa')](util[_0x7fd5('0x12')]('[ERROR]\x20%s',_0x11efd3['stack']));}}function closeHandler(){logger[_0x7fd5('0x10')](util[_0x7fd5('0x12')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7fd5('0x15')],this[_0x7fd5('0x16')],this[_0x7fd5('0x17')],this[_0x7fd5('0x18')],this['uniqueid']));try{createSquareReport(this);}catch(_0x795a11){logger['error'](_0x795a11[_0x7fd5('0xb')]);}}function timeoutHandler(){logger[_0x7fd5('0x10')](util[_0x7fd5('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7fd5('0x15')],this['calleridname'],this[_0x7fd5('0x17')],this[_0x7fd5('0x18')],this[_0x7fd5('0x19')]));}function hangupHandler(){logger[_0x7fd5('0x10')](util[_0x7fd5('0x12')](_0x7fd5('0x1a'),this[_0x7fd5('0x15')],this[_0x7fd5('0x16')],this[_0x7fd5('0x17')],this['dnid'],this[_0x7fd5('0x19')]));this[_0x7fd5('0x1b')]=!![];}function createSquareReport(_0x6bc75c,_0x27a446){rpc[_0x7fd5('0x1c')](_0x6bc75c)[_0x7fd5('0x1d')](function(_0x17c353){if(_0x27a446){_0x27a446(null,_0x17c353);}})[_0x7fd5('0x1e')](function(_0x377789){if(_0x27a446){_0x27a446(null,_0x377789);}});}function setChannelVariables(_0x412fb8){for(var _0x4f4438 in _0x412fb8){if(_0x412fb8[_0x7fd5('0x1f')](_0x4f4438)){if(_0x4f4438[_0x7fd5('0x20')](_0x7fd5('0x21'))===0x0){_0x412fb8[_0x4f4438['substring'](0x4)]=_0x412fb8[_0x4f4438];delete _0x412fb8[_0x4f4438];}}}}function agiHandler(_0x381862){logger[_0x7fd5('0x22')](_0x7fd5('0x23'),JSON[_0x7fd5('0x24')](_0x381862,null,0x2));logger[_0x7fd5('0x10')](util[_0x7fd5('0x12')](_0x7fd5('0x25'),_0x381862[_0x7fd5('0x15')],_0x381862['calleridname'],_0x381862[_0x7fd5('0x17')],_0x381862['dnid'],_0x381862['uniqueid']));_0x381862['on']('error',errorHandler);_0x381862['on'](_0x7fd5('0x26'),closeHandler);_0x381862['on'](_0x7fd5('0x27'),timeoutHandler);_0x381862[_0x7fd5('0x1b')]=![];_0x381862['on']('hangup',hangupHandler);var _0x4b5a70=_[_0x7fd5('0x28')](projects,[_0x7fd5('0x11'),_0x381862[_0x7fd5('0x15')]]);if(!_0x4b5a70)return Project[_0x7fd5('0x29')](_0x381862);if(!_0x4b5a70[_0x7fd5('0x2a')])return Project[_0x7fd5('0x2b')](_0x381862);return Project['initialize'](_0x4b5a70,_0x381862);}function main(){var _0x41cc6e;return utilLicense[_0x7fd5('0x2c')]()['then'](function(_0x549974){if(!_0x549974)return;if(_0x549974[_0x7fd5('0x2d')]){if(_0x549974[_0x7fd5('0x2e')]&&_0x549974[_0x7fd5('0x2e')]>0x0){logger[_0x7fd5('0x10')](util[_0x7fd5('0x12')](_0x7fd5('0x2f'),_0x549974[_0x7fd5('0x2e')]));_0x41cc6e=_0x549974[_0x7fd5('0x2e')];}else{logger['info'](_0x7fd5('0x30'));}}else{logger[_0x7fd5('0x10')](_0x7fd5('0x31'));_0x41cc6e=-0x1;}})[_0x7fd5('0x1d')](function(){return Project[_0x7fd5('0x32')]();})[_0x7fd5('0x1d')](function(_0x24290d){projects=_0x24290d;return;})[_0x7fd5('0x1e')](function(_0x3405d3){logger[_0x7fd5('0xa')]('[LICENSE]',_0x3405d3[_0x7fd5('0xb')]);})[_0x7fd5('0x33')](function(){var _0x179ef0=require('./server')(config[_0x7fd5('0x3')]['port'],config[_0x7fd5('0x3')]['ip'],_0x41cc6e);_0x179ef0['on'](_0x7fd5('0xa'),errorHandler);_0x179ef0['on']('listening',listeningHandler);_0x179ef0['on'](_0x7fd5('0x34'),connectionHandler);_0x179ef0['on'](_0x7fd5('0x26'),closeHandler);});}main(); \ No newline at end of file +var _0x66e0=['./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','push','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','info','arg_1','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','close','find','handleNotFound','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','connection','lodash','util','../../config/logger','agi','../../config/license/util','./rpc','./project'];(function(_0x5222da,_0x494a16){var _0x1aa8a0=function(_0x530da0){while(--_0x530da0){_0x5222da['push'](_0x5222da['shift']());}};_0x1aa8a0(++_0x494a16);}(_0x66e0,0x199));var _0x066e=function(_0x314742,_0x1111a2){_0x314742=_0x314742-0x0;var _0x47f041=_0x66e0[_0x314742];return _0x47f041;};'use strict';var _=require(_0x066e('0x0'));var syncho=require('syncho');var util=require(_0x066e('0x1'));var config=require('../../config/environment');var logger=require(_0x066e('0x2'))(_0x066e('0x3'));var utilLicense=require(_0x066e('0x4'));var rpc=require(_0x066e('0x5'));var Project=require(_0x066e('0x6'));var AGIEmitter=require(_0x066e('0x7'))[_0x066e('0x8')];var projects=[];config[_0x066e('0x3')]=_['defaults'](config['agi'],{'ip':_0x066e('0x9'),'port':0x11dd});AGIEmitter['on'](_0x066e('0xa'),projectUpdateHandler);function connectionHandler(_0x2e5c83){process[_0x066e('0xb')](function(){syncho(function(){try{setChannelVariables(_0x2e5c83);agiHandler(_0x2e5c83);}catch(_0x5090d9){logger[_0x066e('0xc')](_0x5090d9[_0x066e('0xd')]);}});});}function projectUpdateHandler(_0x5d0dd7){try{var _0x1d70a6=_[_0x066e('0xe')](projects,['id',_0x5d0dd7['id']]);if(_0x1d70a6>-0x1){if(_0x5d0dd7[_0x066e('0xf')]===!![]){projects['splice'](_0x1d70a6,0x1);}else{projects[_0x1d70a6]=_0x5d0dd7;}}else{projects[_0x066e('0x10')](_0x5d0dd7);}}catch(_0x5c913c){logger[_0x066e('0xc')](_0x5c913c[_0x066e('0xd')]);}}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi']['port']);logger['info'](util[_0x066e('0x11')](_0x066e('0x12'),config[_0x066e('0x3')]['ip'],config[_0x066e('0x3')][_0x066e('0x13')]));}function errorHandler(_0x281546){if(_0x281546&&_0x281546[_0x066e('0x14')]&&_0x281546[_0x066e('0x15')]){logger['error'](util[_0x066e('0x11')](_0x066e('0x16'),_0x281546['name'],_0x281546[_0x066e('0x15')]));}else{logger[_0x066e('0xc')](util['format'](_0x066e('0x17'),_0x281546[_0x066e('0xd')]));}}function closeHandler(){logger['info'](util[_0x066e('0x11')](_0x066e('0x18'),this['arg_1'],this[_0x066e('0x19')],this[_0x066e('0x1a')],this[_0x066e('0x1b')],this['uniqueid']));try{createSquareReport(this);}catch(_0x2fde32){logger['error'](_0x2fde32['stack']);}}function timeoutHandler(){logger[_0x066e('0x1c')](util[_0x066e('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x066e('0x1d')],this[_0x066e('0x19')],this[_0x066e('0x1a')],this[_0x066e('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x066e('0x1c')](util[_0x066e('0x11')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x066e('0x1d')],this[_0x066e('0x19')],this[_0x066e('0x1a')],this[_0x066e('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function createSquareReport(_0x583763,_0x5159eb){rpc['createSquareReport'](_0x583763)[_0x066e('0x1e')](function(_0x45654f){if(_0x5159eb){_0x5159eb(null,_0x45654f);}})[_0x066e('0x1f')](function(_0x110601){if(_0x5159eb){_0x5159eb(null,_0x110601);}});}function setChannelVariables(_0x43b979){for(var _0x5e0a3c in _0x43b979){if(_0x43b979[_0x066e('0x20')](_0x5e0a3c)){if(_0x5e0a3c[_0x066e('0x21')](_0x066e('0x22'))===0x0){_0x43b979[_0x5e0a3c[_0x066e('0x23')](0x4)]=_0x43b979[_0x5e0a3c];delete _0x43b979[_0x5e0a3c];}}}}function agiHandler(_0x3caca5){logger[_0x066e('0x24')](_0x066e('0x25'),JSON['stringify'](_0x3caca5,null,0x2));logger[_0x066e('0x1c')](util[_0x066e('0x11')](_0x066e('0x26'),_0x3caca5[_0x066e('0x1d')],_0x3caca5['calleridname'],_0x3caca5[_0x066e('0x1a')],_0x3caca5[_0x066e('0x1b')],_0x3caca5[_0x066e('0x27')]));_0x3caca5['on']('error',errorHandler);_0x3caca5['on'](_0x066e('0x28'),closeHandler);_0x3caca5['on']('timeout',timeoutHandler);_0x3caca5['evtHangup']=![];_0x3caca5['on']('hangup',hangupHandler);var _0x5c6849=_[_0x066e('0x29')](projects,[_0x066e('0x14'),_0x3caca5[_0x066e('0x1d')]]);if(!_0x5c6849)return Project[_0x066e('0x2a')](_0x3caca5);if(!_0x5c6849['production'])return Project['handleUnpublished'](_0x3caca5);return Project['initialize'](_0x5c6849,_0x3caca5);}function main(){var _0x566726;return utilLicense[_0x066e('0x2b')]()[_0x066e('0x1e')](function(_0x567c9c){if(!_0x567c9c)return;if(_0x567c9c[_0x066e('0x2c')]){if(_0x567c9c[_0x066e('0x2d')]&&_0x567c9c[_0x066e('0x2d')]>0x0){logger[_0x066e('0x1c')](util[_0x066e('0x11')](_0x066e('0x2e'),_0x567c9c[_0x066e('0x2d')]));_0x566726=_0x567c9c[_0x066e('0x2d')];}else{logger[_0x066e('0x1c')](_0x066e('0x2f'));}}else{logger[_0x066e('0x1c')](_0x066e('0x30'));_0x566726=-0x1;}})[_0x066e('0x1e')](function(){return Project['getAll']();})['then'](function(_0x180ef5){projects=_0x180ef5;return;})[_0x066e('0x1f')](function(_0x285d3d){logger['error'](_0x066e('0x31'),_0x285d3d[_0x066e('0xd')]);})[_0x066e('0x32')](function(){var _0x33454a=require('./server')(config[_0x066e('0x3')][_0x066e('0x13')],config[_0x066e('0x3')]['ip'],_0x566726);_0x33454a['on']('error',errorHandler);_0x33454a['on']('listening',listeningHandler);_0x33454a['on'](_0x066e('0x33'),connectionHandler);_0x33454a['on'](_0x066e('0x28'),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 9f080e4..a6c5a50 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 _0x212c=['client','http','then','error','message','result','sendMailMessage','bluebird','jayson/promise'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x212c,0x10c));var _0xc212=function(_0x4909f3,_0x3cfaa0){_0x4909f3=_0x4909f3-0x0;var _0x1c875d=_0x212c[_0x4909f3];return _0x1c875d;};'use strict';var BPromise=require(_0xc212('0x0'));var jayson=require(_0xc212('0x1'));var client=jayson[_0xc212('0x2')][_0xc212('0x3')]({'port':0x232b});function request(_0x4b3864,_0x43b7cd){return new BPromise(function(_0x341cc6,_0x3048d1){return client['request'](_0x4b3864,_0x43b7cd)[_0xc212('0x4')](function(_0x5cf69f){if(_0x5cf69f[_0xc212('0x5')]){return _0x3048d1(_0x5cf69f[_0xc212('0x5')][_0xc212('0x6')]);}else{return _0x341cc6(_0x5cf69f[_0xc212('0x7')]);}})['catch'](function(_0xfa94ba){return _0x3048d1(_0xfa94ba);});});}exports[_0xc212('0x8')]=function(_0x511e13,_0x1a339d){return request('SendMail',{'account':_0x511e13,'message':_0x1a339d});}; \ No newline at end of file +var _0x97ad=['client','http','request','error','message','result','catch','sendMailMessage','bluebird','jayson/promise'];(function(_0x274c48,_0x2d742f){var _0x5148fc=function(_0x13968a){while(--_0x13968a){_0x274c48['push'](_0x274c48['shift']());}};_0x5148fc(++_0x2d742f);}(_0x97ad,0x1ca));var _0xd97a=function(_0x513a02,_0x5910d6){_0x513a02=_0x513a02-0x0;var _0x10fcc9=_0x97ad[_0x513a02];return _0x10fcc9;};'use strict';var BPromise=require(_0xd97a('0x0'));var jayson=require(_0xd97a('0x1'));var client=jayson[_0xd97a('0x2')][_0xd97a('0x3')]({'port':0x232b});function request(_0x2c47cd,_0x445cd8){return new BPromise(function(_0x3867a1,_0x1ffa87){return client[_0xd97a('0x4')](_0x2c47cd,_0x445cd8)['then'](function(_0x3ac0f5){if(_0x3ac0f5[_0xd97a('0x5')]){return _0x1ffa87(_0x3ac0f5['error'][_0xd97a('0x6')]);}else{return _0x3867a1(_0x3ac0f5[_0xd97a('0x7')]);}})[_0xd97a('0x8')](function(_0xc12a4c){return _0x1ffa87(_0xc12a4c);});});}exports[_0xd97a('0x9')]=function(_0x199d00,_0x18e62c){return request('SendMail',{'account':_0x199d00,'message':_0x18e62c});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 0d75bc0..f76575d 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 _0x0ad8=['close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','lodash','../../config/logger','agi','./mailRpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','omit','isArray','length','source','target','addEdge','value','toJson','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','callerid','dnid','uniqueid','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x0ad8,0xe9));var _0x80ad=function(_0x3cc71b,_0xd08227){_0x3cc71b=_0x3cc71b-0x0;var _0x56359d=_0x0ad8[_0x3cc71b];return _0x56359d;};'use strict';var _=require(_0x80ad('0x0'));var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0x80ad('0x1'))(_0x80ad('0x2'));var rpc=require('./rpc');var mailRpc=require(_0x80ad('0x3'));var Graph=require('./graph');var Vertices=require(_0x80ad('0x4'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x80ad('0x5')]()[_0x80ad('0x6')](function(_0x58b893){logger[_0x80ad('0x7')](_0x80ad('0x8'),_0x58b893['stack']);return[];});}function addVertex(_0xe41477,_0x1d3937,_0x30a3fb){_0x1d3937[_0x80ad('0x9')]=_0x30a3fb;if(_0x1d3937[_0x80ad('0xa')](_0x80ad('0xb'))){_0x1d3937['maxRetry']=parseInt(_0x1d3937[_0x80ad('0xb')],0xa);}_0xe41477['addVertex'](_[_0x80ad('0xc')](_0x1d3937,'mxCell'));}function initGraph(_0x52c4ad,_0x4e5df0){var _0x1e1bc1=new Graph();for(var _0xa1a74e in _0x52c4ad){if(_0x52c4ad[_0x80ad('0xa')](_0xa1a74e)){if(_[_0x80ad('0xd')](_0x52c4ad[_0xa1a74e])){for(var _0xd44530=0x0;_0xd44530<_0x52c4ad[_0xa1a74e][_0x80ad('0xe')];_0xd44530+=0x1){addVertex(_0x1e1bc1,_0x52c4ad[_0xa1a74e][_0xd44530],_0xa1a74e);}}else{addVertex(_0x1e1bc1,_0x52c4ad[_0xa1a74e],_0xa1a74e);}}}for(var _0x3f4ed3=0x0;_0x3f4ed3<_0x4e5df0['length'];_0x3f4ed3+=0x1){if(_0x4e5df0[_0x3f4ed3][_0x80ad('0xf')]&&_0x4e5df0[_0x3f4ed3][_0x80ad('0x10')]){_0x1e1bc1[_0x80ad('0x11')](_0x4e5df0[_0x3f4ed3][_0x80ad('0xf')],_0x4e5df0[_0x3f4ed3][_0x80ad('0x10')],_0x4e5df0[_0x3f4ed3][_0x80ad('0x12')]);}}return _0x1e1bc1;}function getRoot(_0x4be296){return parser[_0x80ad('0x13')](_0x4be296,{'object':!![]})['mxGraphModel'][_0x80ad('0x14')];}function inspect(_0x1b295e){return util[_0x80ad('0x15')](_0x1b295e,{'showHidden':![],'depth':null});}function initialize(_0x5e5227,_0x60f968){var _0x141761=getRoot(_0x5e5227[_0x80ad('0x16')]);if(!_0x141761||!_0x141761[_0x80ad('0x17')])return;var _0x49c13c,_0x1c4800,_0x3f7e56;logger[_0x80ad('0x18')](_0x80ad('0x14'),JSON[_0x80ad('0x19')](_0x141761,null,0x2));_0x60f968[_0x80ad('0x1a')]=moment()[_0x80ad('0x1b')](_0x80ad('0x1c'));_0x49c13c=initGraph(_[_0x80ad('0xc')](_0x141761,_0x80ad('0x1d')),_0x141761[_0x80ad('0x1d')]);_0x1c4800=new Vertices(_0x60f968,rpc,mailRpc);logger[_0x80ad('0x1e')](util[_0x80ad('0x1b')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x60f968[_0x80ad('0x1f')],_0x60f968['calleridname'],_0x60f968[_0x80ad('0x20')],_0x60f968[_0x80ad('0x21')],_0x60f968[_0x80ad('0x22')]));_0x49c13c[_0x80ad('0x23')](_0x141761[_0x80ad('0x17')]['id'],function(_0x27b2e1){try{_0x27b2e1=_0x1c4800[_0x80ad('0x24')](_0x27b2e1);logger['debug']('vertex',JSON[_0x80ad('0x19')](_0x27b2e1,null,0x2));if(_0x27b2e1['agicommand']==='gotoc'){logger['info'](_0x80ad('0x25'));_0x60f968[_0x80ad('0x26')]=_0x27b2e1[_0x80ad('0x26')]||_0x60f968['context'];_0x60f968[_0x80ad('0x27')]=_0x27b2e1[_0x80ad('0x27')];_0x60f968['priority']=_0x27b2e1[_0x80ad('0x28')]?_0x27b2e1[_0x80ad('0x28')]-0x1:0x1;return null;}else if(_0x27b2e1&&_0x1c4800[_0x27b2e1[_0x80ad('0x9')]]){_0x3f7e56=_0x1c4800[_0x27b2e1[_0x80ad('0x9')]](_0x27b2e1);logger[_0x80ad('0x1e')](_0x80ad('0x29'),JSON[_0x80ad('0x19')](_0x3f7e56,null,0x2));if(_0x3f7e56&&_0x3f7e56[_0x80ad('0x2a')]===AGI_CODE_SUCCESS&&_0x3f7e56[_0x80ad('0x2b')]!==AGI_RESULT_ERROR&&!_0x60f968['evtHangup']){logger[_0x80ad('0x18')](_0x80ad('0x29'),inspect(_0x3f7e56));return _['isUndefined'](_0x3f7e56[_0x80ad('0x2b')])?null:_0x3f7e56['result'][_0x80ad('0x2c')]();}else{logger[_0x80ad('0x7')](_0x80ad('0x29'),inspect(_0x3f7e56));return null;}}else{logger['error'](_0x80ad('0x2d'));return null;}}catch(_0x44d6ec){logger[_0x80ad('0x7')](_0x44d6ec['stack']);return null;}});if(_0x141761[_0x80ad('0x2e')]){logger['info'](util[_0x80ad('0x1b')](_0x80ad('0x2f'),_0x60f968['arg_1'],_0x60f968['calleridname'],_0x60f968[_0x80ad('0x20')],_0x60f968[_0x80ad('0x21')],_0x60f968[_0x80ad('0x22')]));_0x49c13c['traverseBFS'](_0x141761[_0x80ad('0x2e')]['id'],function(_0x4004f0){try{_0x4004f0=_0x1c4800['clear'](_0x4004f0);logger[_0x80ad('0x18')](_0x80ad('0x30'),JSON[_0x80ad('0x19')](_0x4004f0,null,0x2));if(_0x4004f0&&_0x1c4800[_0x4004f0[_0x80ad('0x9')]]){_0x3f7e56=_0x1c4800[_0x4004f0[_0x80ad('0x9')]](_0x4004f0);if(_0x3f7e56){logger[_0x80ad('0x18')](_0x80ad('0x29'),inspect(_0x3f7e56));return _['isUndefined'](_0x3f7e56[_0x80ad('0x2b')])?null:_0x3f7e56[_0x80ad('0x2b')]['toString']();}else{logger[_0x80ad('0x7')](_0x80ad('0x29'),inspect(_0x3f7e56));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x569964){logger['error'](_0x569964[_0x80ad('0x31')]);return null;}});}logger[_0x80ad('0x1e')](util[_0x80ad('0x1b')](_0x80ad('0x32'),_0x60f968[_0x80ad('0x1f')],_0x60f968[_0x80ad('0x33')],_0x60f968[_0x80ad('0x20')],_0x60f968[_0x80ad('0x21')],_0x60f968['uniqueid']));logger[_0x80ad('0x1e')](util[_0x80ad('0x1b')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x60f968[_0x80ad('0x26')],_0x60f968[_0x80ad('0x27')],parseInt(_0x60f968['priority'],0xa)+0x1));_0x60f968['continueAt'](_0x60f968[_0x80ad('0x26')],_0x60f968[_0x80ad('0x27')],parseInt(_0x60f968[_0x80ad('0x28')],0xa)+0x1);_0x60f968[_0x80ad('0x34')]();}function handleNotFound(_0x6f758a){logger['error'](util['format'](_0x80ad('0x35'),_0x6f758a[_0x80ad('0x1f')]));_0x6f758a[_0x80ad('0x36')](_0x6f758a[_0x80ad('0x26')],_0x6f758a[_0x80ad('0x27')],parseInt(_0x6f758a[_0x80ad('0x28')],0xa)+0x1);_0x6f758a['close']();}function handleUnpublished(_0x56383f){logger[_0x80ad('0x7')](util[_0x80ad('0x1b')](_0x80ad('0x37'),_0x56383f[_0x80ad('0x1f')]));_0x56383f['continueAt'](_0x56383f['context'],_0x56383f[_0x80ad('0x27')],parseInt(_0x56383f[_0x80ad('0x28')],0xa)+0x1);_0x56383f[_0x80ad('0x34')]();}module[_0x80ad('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xb341=['arg_1','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','getSquareProjects','error','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','addEdge','toJson','inspect','production','start','debug','root','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','isUndefined','toString','response','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x2c861c,_0x1bb810){var _0x2ef6e8=function(_0x161d34){while(--_0x161d34){_0x2c861c['push'](_0x2c861c['shift']());}};_0x2ef6e8(++_0x1bb810);}(_0xb341,0x1b8));var _0x1b34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb341[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1b34('0x0'));var moment=require(_0x1b34('0x1'));var parser=require(_0x1b34('0x2'));var util=require(_0x1b34('0x3'));var logger=require(_0x1b34('0x4'))(_0x1b34('0x5'));var rpc=require(_0x1b34('0x6'));var mailRpc=require(_0x1b34('0x7'));var Graph=require(_0x1b34('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1b34('0x9')]()['catch'](function(_0x24822f){logger[_0x1b34('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x24822f['stack']);return[];});}function addVertex(_0x2ff6f2,_0x3f5b3d,_0x52fcd3){_0x3f5b3d[_0x1b34('0xb')]=_0x52fcd3;if(_0x3f5b3d[_0x1b34('0xc')]('retry')){_0x3f5b3d['maxRetry']=parseInt(_0x3f5b3d[_0x1b34('0xd')],0xa);}_0x2ff6f2[_0x1b34('0xe')](_[_0x1b34('0xf')](_0x3f5b3d,'mxCell'));}function initGraph(_0xb5f75f,_0x21d3aa){var _0x53f1fe=new Graph();for(var _0x29566a in _0xb5f75f){if(_0xb5f75f['hasOwnProperty'](_0x29566a)){if(_[_0x1b34('0x10')](_0xb5f75f[_0x29566a])){for(var _0x314dc9=0x0;_0x314dc9<_0xb5f75f[_0x29566a][_0x1b34('0x11')];_0x314dc9+=0x1){addVertex(_0x53f1fe,_0xb5f75f[_0x29566a][_0x314dc9],_0x29566a);}}else{addVertex(_0x53f1fe,_0xb5f75f[_0x29566a],_0x29566a);}}}for(var _0x2a94da=0x0;_0x2a94da<_0x21d3aa[_0x1b34('0x11')];_0x2a94da+=0x1){if(_0x21d3aa[_0x2a94da][_0x1b34('0x12')]&&_0x21d3aa[_0x2a94da][_0x1b34('0x13')]){_0x53f1fe[_0x1b34('0x14')](_0x21d3aa[_0x2a94da][_0x1b34('0x12')],_0x21d3aa[_0x2a94da]['target'],_0x21d3aa[_0x2a94da]['value']);}}return _0x53f1fe;}function getRoot(_0xba893d){return parser[_0x1b34('0x15')](_0xba893d,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x61d623){return util[_0x1b34('0x16')](_0x61d623,{'showHidden':![],'depth':null});}function initialize(_0x32b715,_0x46c2e9){var _0x3c9715=getRoot(_0x32b715[_0x1b34('0x17')]);if(!_0x3c9715||!_0x3c9715[_0x1b34('0x18')])return;var _0x4d3131,_0x3fe071,_0x218f0d;logger[_0x1b34('0x19')](_0x1b34('0x1a'),JSON[_0x1b34('0x1b')](_0x3c9715,null,0x2));_0x46c2e9[_0x1b34('0x1c')]=moment()['format'](_0x1b34('0x1d'));_0x4d3131=initGraph(_[_0x1b34('0xf')](_0x3c9715,_0x1b34('0x1e')),_0x3c9715[_0x1b34('0x1e')]);_0x3fe071=new Vertices(_0x46c2e9,rpc,mailRpc);logger[_0x1b34('0x1f')](util[_0x1b34('0x20')](_0x1b34('0x21'),_0x46c2e9['arg_1'],_0x46c2e9[_0x1b34('0x22')],_0x46c2e9[_0x1b34('0x23')],_0x46c2e9[_0x1b34('0x24')],_0x46c2e9['uniqueid']));_0x4d3131[_0x1b34('0x25')](_0x3c9715[_0x1b34('0x18')]['id'],function(_0x13c2c4){try{_0x13c2c4=_0x3fe071[_0x1b34('0x26')](_0x13c2c4);logger[_0x1b34('0x19')](_0x1b34('0x27'),JSON[_0x1b34('0x1b')](_0x13c2c4,null,0x2));if(_0x13c2c4[_0x1b34('0xb')]==='gotoc'){logger[_0x1b34('0x1f')](_0x1b34('0x28'));_0x46c2e9['context']=_0x13c2c4[_0x1b34('0x29')]||_0x46c2e9[_0x1b34('0x29')];_0x46c2e9[_0x1b34('0x2a')]=_0x13c2c4[_0x1b34('0x2a')];_0x46c2e9[_0x1b34('0x2b')]=_0x13c2c4['priority']?_0x13c2c4[_0x1b34('0x2b')]-0x1:0x1;return null;}else if(_0x13c2c4&&_0x3fe071[_0x13c2c4[_0x1b34('0xb')]]){_0x218f0d=_0x3fe071[_0x13c2c4[_0x1b34('0xb')]](_0x13c2c4);logger[_0x1b34('0x1f')]('response',JSON['stringify'](_0x218f0d,null,0x2));if(_0x218f0d&&_0x218f0d[_0x1b34('0x2c')]===AGI_CODE_SUCCESS&&_0x218f0d[_0x1b34('0x2d')]!==AGI_RESULT_ERROR&&!_0x46c2e9[_0x1b34('0x2e')]){logger[_0x1b34('0x19')]('response',inspect(_0x218f0d));return _[_0x1b34('0x2f')](_0x218f0d['result'])?null:_0x218f0d[_0x1b34('0x2d')][_0x1b34('0x30')]();}else{logger[_0x1b34('0xa')](_0x1b34('0x31'),inspect(_0x218f0d));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x46c8b7){logger[_0x1b34('0xa')](_0x46c8b7[_0x1b34('0x32')]);return null;}});if(_0x3c9715[_0x1b34('0x33')]){logger[_0x1b34('0x1f')](util[_0x1b34('0x20')](_0x1b34('0x34'),_0x46c2e9['arg_1'],_0x46c2e9['calleridname'],_0x46c2e9['callerid'],_0x46c2e9[_0x1b34('0x24')],_0x46c2e9[_0x1b34('0x35')]));_0x4d3131[_0x1b34('0x25')](_0x3c9715[_0x1b34('0x33')]['id'],function(_0x5762d3){try{_0x5762d3=_0x3fe071[_0x1b34('0x26')](_0x5762d3);logger[_0x1b34('0x19')]('vertex',JSON[_0x1b34('0x1b')](_0x5762d3,null,0x2));if(_0x5762d3&&_0x3fe071[_0x5762d3[_0x1b34('0xb')]]){_0x218f0d=_0x3fe071[_0x5762d3['agicommand']](_0x5762d3);if(_0x218f0d){logger[_0x1b34('0x19')](_0x1b34('0x31'),inspect(_0x218f0d));return _[_0x1b34('0x2f')](_0x218f0d[_0x1b34('0x2d')])?null:_0x218f0d[_0x1b34('0x2d')][_0x1b34('0x30')]();}else{logger[_0x1b34('0xa')]('response',inspect(_0x218f0d));return null;}}else{logger[_0x1b34('0xa')](_0x1b34('0x36'));return null;}}catch(_0x1e5596){logger[_0x1b34('0xa')](_0x1e5596[_0x1b34('0x32')]);return null;}});}logger[_0x1b34('0x1f')](util[_0x1b34('0x20')](_0x1b34('0x37'),_0x46c2e9[_0x1b34('0x38')],_0x46c2e9['calleridname'],_0x46c2e9[_0x1b34('0x23')],_0x46c2e9[_0x1b34('0x24')],_0x46c2e9[_0x1b34('0x35')]));logger[_0x1b34('0x1f')](util[_0x1b34('0x20')](_0x1b34('0x39'),_0x46c2e9[_0x1b34('0x29')],_0x46c2e9[_0x1b34('0x2a')],parseInt(_0x46c2e9[_0x1b34('0x2b')],0xa)+0x1));_0x46c2e9[_0x1b34('0x3a')](_0x46c2e9[_0x1b34('0x29')],_0x46c2e9['extension'],parseInt(_0x46c2e9[_0x1b34('0x2b')],0xa)+0x1);_0x46c2e9['close']();}function handleNotFound(_0x5d8834){logger['error'](util[_0x1b34('0x20')]('Project\x20%s\x20not\x20found',_0x5d8834['arg_1']));_0x5d8834[_0x1b34('0x3a')](_0x5d8834[_0x1b34('0x29')],_0x5d8834[_0x1b34('0x2a')],parseInt(_0x5d8834[_0x1b34('0x2b')],0xa)+0x1);_0x5d8834[_0x1b34('0x3b')]();}function handleUnpublished(_0x6766cf){logger['error'](util[_0x1b34('0x20')](_0x1b34('0x3c'),_0x6766cf[_0x1b34('0x38')]));_0x6766cf[_0x1b34('0x3a')](_0x6766cf[_0x1b34('0x29')],_0x6766cf[_0x1b34('0x2a')],parseInt(_0x6766cf[_0x1b34('0x2b')],0xa)+0x1);_0x6766cf[_0x1b34('0x3b')]();}module[_0x1b34('0x3d')]={'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 c08002f..b2b25fe 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 _0xeecb=['Transform','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','split','slice','trim','length','emit','headers','line','util','stream'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xeecb,0x11e));var _0xbeec=function(_0x2dc2f6,_0x486e78){_0x2dc2f6=_0x2dc2f6-0x0;var _0x17d023=_0xeecb[_0x2dc2f6];return _0x17d023;};'use strict';var util=require(_0xbeec('0x0'));var Transform=require(_0xbeec('0x1'))[_0xbeec('0x2')];function AGIReply(_0x2f96bc){Transform['call'](this,_0x2f96bc);this[_0xbeec('0x3')]='';this[_0xbeec('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xbeec('0x5')][_0xbeec('0x6')]=function(_0x5e947d,_0x37f32f,_0x508f31){var _0x396c58='\x0a',_0x3cc597=['\x0a\x0a',_0xbeec('0x7')],_0x32dce3=-0x1,_0x2259e9=-0x1,_0x23570e='',_0x37903f=0x0,_0x5b5ab4='',_0xdc74f2='';this[_0xbeec('0x3')]+=_0x5e947d[_0xbeec('0x8')]();_0x5b5ab4=this['_localBuffer'];if(!this[_0xbeec('0x4')]){_0x37903f=0x0;while(_0x3cc597[_0x37903f]){while((_0x2259e9=_0x5b5ab4[_0xbeec('0x9')](_0x3cc597[_0x37903f]))!=-0x1){_0x23570e=_0x3cc597[_0x37903f];_0xdc74f2=_0x5b5ab4[_0xbeec('0xa')](0x0,_0x2259e9);_0x5b5ab4=_0x5b5ab4[_0xbeec('0xa')](_0x2259e9+_0x23570e['length']);var _0x45d1b9=_0xdc74f2[_0xbeec('0xb')](_0x396c58),_0x34d60f=0x0,_0x1cefd8={},_0x120ad8='',_0x707645='',_0x17098c=-0x1;while(_0x45d1b9[_0x34d60f]){_0x17098c=_0x45d1b9[_0x34d60f][_0xbeec('0x9')](':');if(_0x17098c!=-0x1){_0x120ad8=_0x45d1b9[_0x34d60f][_0xbeec('0xc')](0x0,_0x17098c)['trim']();_0x707645=_0x45d1b9[_0x34d60f][_0xbeec('0xc')](_0x17098c+0x1)[_0xbeec('0xd')]();if(_0x120ad8[_0xbeec('0xe')]>0x0){_0x1cefd8[_0x120ad8]=_0x707645;}}else{}_0x34d60f++;}this[_0xbeec('0xf')](_0xbeec('0x10'),_0x1cefd8);this[_0xbeec('0x4')]=!![];}_0x37903f++;}this[_0xbeec('0x3')]=_0x5b5ab4;}else{while((_0x32dce3=_0x5b5ab4[_0xbeec('0x9')](_0x396c58))!=-0x1){_0xdc74f2=_0x5b5ab4['substring'](0x0,_0x32dce3);this['emit'](_0xbeec('0x11'),_0xdc74f2);_0x5b5ab4=_0x5b5ab4[_0xbeec('0xa')](_0x32dce3+_0x396c58[_0xbeec('0xe')]);}this['_localBuffer']=_0x5b5ab4;}_0x508f31();};module['exports']=AGIReply; \ No newline at end of file +var _0x8782=['Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','emit','line','util','stream'];(function(_0x3708d8,_0x5b6e4d){var _0x388b62=function(_0x3f12bf){while(--_0x3f12bf){_0x3708d8['push'](_0x3708d8['shift']());}};_0x388b62(++_0x5b6e4d);}(_0x8782,0x17a));var _0x2878=function(_0x302fe4,_0x277a94){_0x302fe4=_0x302fe4-0x0;var _0x5667ec=_0x8782[_0x302fe4];return _0x5667ec;};'use strict';var util=require(_0x2878('0x0'));var Transform=require(_0x2878('0x1'))[_0x2878('0x2')];function AGIReply(_0x471f01){Transform[_0x2878('0x3')](this,_0x471f01);this[_0x2878('0x4')]='';this[_0x2878('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x2878('0x6')][_0x2878('0x7')]=function(_0x1c085f,_0x5a32cc,_0x28a5ea){var _0x5826f6='\x0a',_0x2fe6d8=['\x0a\x0a',_0x2878('0x8')],_0x428571=-0x1,_0x2ea986=-0x1,_0x4ed075='',_0x2deb60=0x0,_0x5d9e74='',_0x305bf4='';this[_0x2878('0x4')]+=_0x1c085f[_0x2878('0x9')]();_0x5d9e74=this[_0x2878('0x4')];if(!this[_0x2878('0x5')]){_0x2deb60=0x0;while(_0x2fe6d8[_0x2deb60]){while((_0x2ea986=_0x5d9e74[_0x2878('0xa')](_0x2fe6d8[_0x2deb60]))!=-0x1){_0x4ed075=_0x2fe6d8[_0x2deb60];_0x305bf4=_0x5d9e74[_0x2878('0xb')](0x0,_0x2ea986);_0x5d9e74=_0x5d9e74[_0x2878('0xb')](_0x2ea986+_0x4ed075[_0x2878('0xc')]);var _0x279196=_0x305bf4[_0x2878('0xd')](_0x5826f6),_0x5d7189=0x0,_0x3bdaaf={},_0x37a7d5='',_0x4f5833='',_0x1a225f=-0x1;while(_0x279196[_0x5d7189]){_0x1a225f=_0x279196[_0x5d7189]['indexOf'](':');if(_0x1a225f!=-0x1){_0x37a7d5=_0x279196[_0x5d7189][_0x2878('0xe')](0x0,_0x1a225f)[_0x2878('0xf')]();_0x4f5833=_0x279196[_0x5d7189][_0x2878('0xe')](_0x1a225f+0x1)['trim']();if(_0x37a7d5['length']>0x0){_0x3bdaaf[_0x37a7d5]=_0x4f5833;}}else{}_0x5d7189++;}this['emit'](_0x2878('0x10'),_0x3bdaaf);this[_0x2878('0x5')]=!![];}_0x2deb60++;}this[_0x2878('0x4')]=_0x5d9e74;}else{while((_0x428571=_0x5d9e74['indexOf'](_0x5826f6))!=-0x1){_0x305bf4=_0x5d9e74[_0x2878('0xb')](0x0,_0x428571);this[_0x2878('0x11')](_0x2878('0x12'),_0x305bf4);_0x5d9e74=_0x5d9e74[_0x2878('0xb')](_0x428571+_0x5826f6[_0x2878('0xc')]);}this['_localBuffer']=_0x5d9e74;}_0x28a5ea();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 0113b4d..41e0890 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 _0xa1fd=['LogoutUser','lodash','moment','jayson/promise','client','request','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','getMailAccountById','ShowMailAccount','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','ShowUser','GetContactByPhone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','CreateCmContact','getPauseById','agentLogin','PauseUser','UnpauseUser','agentLogout'];(function(_0x972085,_0x326033){var _0x298ece=function(_0x280e7e){while(--_0x280e7e){_0x972085['push'](_0x972085['shift']());}};_0x298ece(++_0x326033);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x402282,_0x615de3){_0x402282=_0x402282-0x0;var _0x4f65af=_0xa1fd[_0x402282];return _0x4f65af;};'use strict';var _=require(_0xda1f('0x0'));var moment=require(_0xda1f('0x1'));var jayson=require(_0xda1f('0x2'));var client=jayson[_0xda1f('0x3')]['http']({'port':0x2329});function request(_0x221036,_0xafa72c){return new Promise(function(_0x2ce9f4,_0x46b451){return client[_0xda1f('0x4')](_0x221036,_0xafa72c)['then'](function(_0x470569){if(_0x470569[_0xda1f('0x5')]){return _0x46b451(_0x470569[_0xda1f('0x5')]['message']);}else{return _0x2ce9f4(_0x470569[_0xda1f('0x6')]);}})[_0xda1f('0x7')](function(_0x199a8d){return _0x46b451(_0x199a8d);});});}exports[_0xda1f('0x8')]=function(){return request(_0xda1f('0x9'),{'options':{'raw':![],'attributes':['id',_0xda1f('0xa'),_0xda1f('0xb')]}});};exports[_0xda1f('0xc')]=function(_0x13467c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x13467c},'attributes':[_0xda1f('0xb')]}});};exports[_0xda1f('0xd')]=function(_0x20ab8b){return request(_0xda1f('0xe'),{'options':{'raw':![],'where':{'id':_0x20ab8b},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xda1f('0xf'),'as':_0xda1f('0xf')}]}],'attributes':['id',_0xda1f('0xa'),_0xda1f('0x10')],'smtp':!![]}});};exports[_0xda1f('0x11')]=function(_0x4ee57d){return request(_0xda1f('0x12'),{'options':{'where':{'id':_0x4ee57d},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x13')]=function(_0x306184){return request(_0xda1f('0x14'),{'options':{'where':{'id':_0x306184},'attributes':[_0xda1f('0xa')]}});};exports['getVariableById']=function(_0x77da5b){return request(_0xda1f('0x15'),{'options':{'where':{'id':_0x77da5b},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x16')]=function(_0x48f5d0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x48f5d0},'attributes':[_0xda1f('0x17')]}});};exports['getUserById']=function(_0x3424a1){return request(_0xda1f('0x18'),{'options':{'where':{'id':_0x3424a1},'attributes':[_0xda1f('0xa')]}});};exports['getContactByPhone']=function(_0xe81fc2){return request(_0xda1f('0x19'),{'options':{'where':{'phone':_0xe81fc2['phone']},'attributes':['id']}});};exports[_0xda1f('0x1a')]=function(_0x31cbba){return request('ShowTrunk',{'options':{'where':{'id':_0x31cbba},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x1b')]=function(_0x3977cf){return request(_0xda1f('0x1c'),{'options':{'where':{'id':_0x3977cf},'attributes':[_0xda1f('0x1d')]}});};exports[_0xda1f('0x1e')]=function(_0x1f6958){return request(_0xda1f('0x1f'),{'options':{'raw':![],'where':{'id':_0x1f6958},'include':[{'model':_0xda1f('0x20'),'as':_0xda1f('0x21')}]}});};exports[_0xda1f('0x22')]=function(_0xc76888){return request('ShowSmsAccount',{'options':{'where':{'id':_0xc76888},'attributes':['id',_0xda1f('0xa')]}});};exports['createSmsMessage']=function(_0x443fa1){return request('CreateSmsMessage',{'body':_0x443fa1});};exports[_0xda1f('0x23')]=function(_0x2d209d){return request('CreateSquareDetailsReport',{'body':_0x2d209d});};exports[_0xda1f('0x24')]=function(_0x146390){return request(_0xda1f('0x25'),{'body':_[_0xda1f('0x26')](_0x146390,{'project_name':_0x146390[_0xda1f('0x27')],'prev_project_name':_0x146390['arg_2']||'','is_subproject':_0x146390[_0xda1f('0x28')]?!![]:![],'leaveAt':moment()[_0xda1f('0x29')](_0xda1f('0x2a'))})});};exports[_0xda1f('0x2b')]=function(_0x54203a){return request(_0xda1f('0x2c'),{'body':_0x54203a});};exports[_0xda1f('0x2d')]=function(_0x4a994f){return request(_0xda1f('0x2e'),{'body':_0x4a994f});};exports['createCmContact']=function(_0x34459d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x34459d['phone'],'ListId':_0x34459d[_0xda1f('0x2f')]}}})['then'](function(_0x4d5bb0){if(_0x4d5bb0){return _0x4d5bb0;}return request(_0xda1f('0x30'),{'body':_0x34459d});});};exports[_0xda1f('0x31')]=function(_0x2188d9){return request('ShowPause',{'options':{'where':{'id':_0x2188d9},'attributes':[_0xda1f('0xa')]}});};exports[_0xda1f('0x32')]=function(_0x5359a7,_0x1c8cfc){return request('LoginUser',{'body':{'interface':_0x1c8cfc},'options':{'where':_0x5359a7}});};exports['agentPause']=function(_0x4850d3,_0x90a7a3,_0x7f3b78){return request(_0xda1f('0x33'),{'body':{'type':_0x90a7a3,'uniqueid':_0x7f3b78},'options':{'where':_0x4850d3}});};exports['agentUnpause']=function(_0x30b8cf){return request(_0xda1f('0x34'),{'body':{},'options':{'where':_0x30b8cf}});};exports[_0xda1f('0x35')]=function(_0x481dc5){return request(_0xda1f('0x36'),{'body':{},'options':{'where':_0x481dc5}});}; \ No newline at end of file +var _0xe41f=['merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','ShowPause','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','production','getMailAccountById','MailServerOut','Smtp','CloudProvider','email','ShowSquareProject','getVoiceQueueById','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport'];(function(_0x245d64,_0x4b05da){var _0x4dd20a=function(_0x3f8202){while(--_0x3f8202){_0x245d64['push'](_0x245d64['shift']());}};_0x4dd20a(++_0x4b05da);}(_0xe41f,0x13e));var _0xfe41=function(_0x1e01f7,_0x5ccc11){_0x1e01f7=_0x1e01f7-0x0;var _0xec3964=_0xe41f[_0x1e01f7];return _0xec3964;};'use strict';var _=require(_0xfe41('0x0'));var moment=require(_0xfe41('0x1'));var jayson=require(_0xfe41('0x2'));var client=jayson[_0xfe41('0x3')]['http']({'port':0x2329});function request(_0x592921,_0x4a2627){return new Promise(function(_0x196b31,_0x67a2d3){return client[_0xfe41('0x4')](_0x592921,_0x4a2627)[_0xfe41('0x5')](function(_0x53ae3b){if(_0x53ae3b['error']){return _0x67a2d3(_0x53ae3b[_0xfe41('0x6')]['message']);}else{return _0x196b31(_0x53ae3b[_0xfe41('0x7')]);}})[_0xfe41('0x8')](function(_0x4f92d3){return _0x67a2d3(_0x4f92d3);});});}exports[_0xfe41('0x9')]=function(){return request(_0xfe41('0xa'),{'options':{'raw':![],'attributes':['id',_0xfe41('0xb'),'production']}});};exports['getSquareProject']=function(_0x4a072c){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x4a072c},'attributes':[_0xfe41('0xc')]}});};exports[_0xfe41('0xd')]=function(_0x4c858a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x4c858a},'include':[{'model':_0xfe41('0xe'),'as':_0xfe41('0xf'),'include':[{'model':_0xfe41('0x10'),'as':'CloudProvider'}]}],'attributes':['id',_0xfe41('0xb'),_0xfe41('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x313c9b){return request(_0xfe41('0x12'),{'options':{'where':{'id':_0x313c9b},'attributes':[_0xfe41('0xb')]}});};exports[_0xfe41('0x13')]=function(_0x3cffc1){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x3cffc1},'attributes':[_0xfe41('0xb')]}});};exports[_0xfe41('0x14')]=function(_0x1de7f0){return request('ShowVariable',{'options':{'where':{'id':_0x1de7f0},'attributes':['name']}});};exports[_0xfe41('0x15')]=function(_0xca164f){return request(_0xfe41('0x16'),{'options':{'where':{'id':_0xca164f},'attributes':[_0xfe41('0x17')]}});};exports['getUserById']=function(_0x6611fd){return request(_0xfe41('0x18'),{'options':{'where':{'id':_0x6611fd},'attributes':[_0xfe41('0xb')]}});};exports[_0xfe41('0x19')]=function(_0x27de87){return request(_0xfe41('0x1a'),{'options':{'where':{'phone':_0x27de87[_0xfe41('0x1b')]},'attributes':['id']}});};exports[_0xfe41('0x1c')]=function(_0xdce570){return request(_0xfe41('0x1d'),{'options':{'where':{'id':_0xdce570},'attributes':[_0xfe41('0xb')]}});};exports[_0xfe41('0x1e')]=function(_0x3cf01e){return request('ShowSound',{'options':{'where':{'id':_0x3cf01e},'attributes':[_0xfe41('0x1f')]}});};exports[_0xfe41('0x20')]=function(_0x1c532c){return request(_0xfe41('0x21'),{'options':{'raw':![],'where':{'id':_0x1c532c},'include':[{'model':_0xfe41('0x22'),'as':_0xfe41('0x23')}]}});};exports[_0xfe41('0x24')]=function(_0x37599e){return request(_0xfe41('0x25'),{'options':{'where':{'id':_0x37599e},'attributes':['id',_0xfe41('0xb')]}});};exports[_0xfe41('0x26')]=function(_0x21f42a){return request('CreateSmsMessage',{'body':_0x21f42a});};exports[_0xfe41('0x27')]=function(_0x30f703){return request(_0xfe41('0x28'),{'body':_0x30f703});};exports[_0xfe41('0x29')]=function(_0x16709b){return request('CreateSquareReport',{'body':_[_0xfe41('0x2a')](_0x16709b,{'project_name':_0x16709b[_0xfe41('0x2b')],'prev_project_name':_0x16709b[_0xfe41('0x2c')]||'','is_subproject':_0x16709b[_0xfe41('0x2c')]?!![]:![],'leaveAt':moment()[_0xfe41('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0xfe41('0x2e')]=function(_0x2a3dcc){return request(_0xfe41('0x2f'),{'body':_0x2a3dcc});};exports[_0xfe41('0x30')]=function(_0x44d7a3){return request(_0xfe41('0x31'),{'body':_0x44d7a3});};exports[_0xfe41('0x32')]=function(_0x49a86d){return request(_0xfe41('0x33'),{'options':{'raw':![],'where':{'phone':_0x49a86d[_0xfe41('0x1b')],'ListId':_0x49a86d['ListId']}}})[_0xfe41('0x5')](function(_0x52dc17){if(_0x52dc17){return _0x52dc17;}return request(_0xfe41('0x34'),{'body':_0x49a86d});});};exports['getPauseById']=function(_0x2ac84b){return request(_0xfe41('0x35'),{'options':{'where':{'id':_0x2ac84b},'attributes':[_0xfe41('0xb')]}});};exports[_0xfe41('0x36')]=function(_0x33bc2c,_0x83d5ab){return request('LoginUser',{'body':{'interface':_0x83d5ab},'options':{'where':_0x33bc2c}});};exports[_0xfe41('0x37')]=function(_0x40808d,_0x358737,_0x4abf6f){return request(_0xfe41('0x38'),{'body':{'type':_0x358737,'uniqueid':_0x4abf6f},'options':{'where':_0x40808d}});};exports['agentUnpause']=function(_0xd20bc6){return request(_0xfe41('0x39'),{'body':{},'options':{'where':_0xd20bc6}});};exports[_0xfe41('0x3a')]=function(_0xf139e7){return request(_0xfe41('0x3b'),{'body':{},'options':{'where':_0xf139e7}});}; \ 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 860eb22..e3d585a 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 _0x18b2=['exports','./lex'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18b2,0x85));var _0x218b=function(_0x1b3b45,_0x3ba3e7){_0x1b3b45=_0x1b3b45-0x0;var _0x516ce4=_0x18b2[_0x1b3b45];return _0x516ce4;};var polly=require('./polly');var lex=require(_0x218b('0x0'));module[_0x218b('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xab3f=['./polly','exports'];(function(_0x4310f5,_0x2a75a3){var _0x3a391b=function(_0x34e211){while(--_0x34e211){_0x4310f5['push'](_0x4310f5['shift']());}};_0x3a391b(++_0x2a75a3);}(_0xab3f,0x72));var _0xfab3=function(_0x2f3093,_0x1a18aa){_0x2f3093=_0x2f3093-0x0;var _0x44eeb8=_0xab3f[_0x2f3093];return _0x44eeb8;};var polly=require(_0xfab3('0x0'));var lex=require('./lex');module[_0xfab3('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 df6ad69..c10715d 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9348=['exports','./lib/api'];(function(_0x38453e,_0x124881){var _0x50b65f=function(_0x5effe4){while(--_0x5effe4){_0x38453e['push'](_0x38453e['shift']());}};_0x50b65f(++_0x124881);}(_0x9348,0x10d));var _0x8934=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0x9348[_0x2ddfd9];return _0x2668f0;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ No newline at end of file +var _0x2547=['exports'];(function(_0x40e59a,_0x2608dd){var _0x571c0d=function(_0x563802){while(--_0x563802){_0x40e59a['push'](_0x40e59a['shift']());}};_0x571c0d(++_0x2608dd);}(_0x2547,0x1cd));var _0x7254=function(_0x1399e6,_0x575dfc){_0x1399e6=_0x1399e6-0x0;var _0x14081d=_0x2547[_0x1399e6];return _0x14081d;};'use strict';var lex=require('./lib/api');module[_0x7254('0x0')]=function(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435){return lex(_0x23e38c,_0x44b692,_0x3ea6e6,_0xbbc747,_0x1a36de,_0x9f3435);}; \ 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 a5cdd4d..1c056f3 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(_0x27df24,_0x4328ec){var _0x230370=function(_0x54e4c8){while(--_0x54e4c8){_0x27df24['push'](_0x27df24['shift']());}};_0x230370(++_0x4328ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x120760,_0x151824){var _0xaa08f7=function(_0x49eeb8){while(--_0x49eeb8){_0x120760['push'](_0x120760['shift']());}};_0xaa08f7(++_0x151824);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 81666f5..7176d2e 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 _0xae8a=['exports','./lib/api'];(function(_0x544456,_0x2a60ca){var _0x9fbf0d=function(_0x5e6cc7){while(--_0x5e6cc7){_0x544456['push'](_0x544456['shift']());}};_0x9fbf0d(++_0x2a60ca);}(_0xae8a,0x1bb));var _0xaae8=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xae8a[_0x491a7f];return _0x3d8f44;};'use strict';var polly=require(_0xaae8('0x0'));module[_0xaae8('0x1')]=function(_0x4c192d,_0x24aa54,_0xb4ce6c,_0x521fa8,_0x14f1d2,_0x493962,_0x100232){return polly(_0x4c192d,_0x24aa54,_0xb4ce6c,_0x521fa8,_0x14f1d2,_0x493962,_0x100232);}; \ No newline at end of file +var _0x50cd=['exports'];(function(_0x338708,_0x2518ff){var _0x459ec5=function(_0x106f3d){while(--_0x106f3d){_0x338708['push'](_0x338708['shift']());}};_0x459ec5(++_0x2518ff);}(_0x50cd,0x1df));var _0xd50c=function(_0x1d1fdf,_0x33ba5a){_0x1d1fdf=_0x1d1fdf-0x0;var _0x3521d6=_0x50cd[_0x1d1fdf];return _0x3521d6;};'use strict';var polly=require('./lib/api');module[_0xd50c('0x0')]=function(_0x48bb83,_0x41fa3c,_0x421e57,_0x251b2a,_0x258ee0,_0x292e25,_0x344573){return polly(_0x48bb83,_0x41fa3c,_0x421e57,_0x251b2a,_0x258ee0,_0x292e25,_0x344573);}; \ 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 7532f40..a96d7e6 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 _0xa2f5=['randomstring','synthesizeSpeech','writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2f5,0x10d));var _0x5a2f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa2f5[_0xbca1b1];return _0x4e1686;};'use strict';var fs=require('fs');var path=require(_0x5a2f('0x0'));var BPromise=require('bluebird');var rs=require(_0x5a2f('0x1'));var AWS=require('aws-sdk');function pollyResult(_0x33e819,_0x25dd2c,_0x48fa9c){return new BPromise(function(_0x1cce61,_0x68efea){_0x33e819[_0x5a2f('0x2')](_0x25dd2c,function(_0x94d317,_0x578e10){if(_0x94d317){_0x68efea(_0x94d317);}else if(_0x578e10){if(_0x578e10['AudioStream']instanceof Buffer){fs[_0x5a2f('0x3')](_0x48fa9c,_0x578e10[_0x5a2f('0x4')],function(_0x29276a){if(_0x29276a){_0x68efea(_0x29276a);}else{_0x1cce61();}});}else{_0x68efea(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x68efea(new Error(_0x5a2f('0x5')));}});});}module[_0x5a2f('0x6')]=function(_0x2db03b,_0x3ed238,_0x2870e8,_0x3321ba,_0x156ed5,_0xad2432,_0x48d08b){var _0x35b8a4=new AWS[(_0x5a2f('0x7'))]({'accessKeyId':_0x2db03b,'secretAccessKey':_0x3ed238,'region':_0x2870e8});var _0x3a5f07={'Text':_0x156ed5,'TextType':_0xad2432||_0x5a2f('0x8'),'OutputFormat':'mp3','VoiceId':_0x3321ba};return pollyResult(_0x35b8a4,_0x3a5f07,_0x48d08b);}; \ No newline at end of file +var _0x7832=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x7832,0x6c));var _0x2783=function(_0x2eb4a4,_0x4b70cb){_0x2eb4a4=_0x2eb4a4-0x0;var _0x94cbe6=_0x7832[_0x2eb4a4];return _0x94cbe6;};'use strict';var fs=require('fs');var path=require(_0x2783('0x0'));var BPromise=require(_0x2783('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x1fe242,_0x33ac68,_0x16c169){return new BPromise(function(_0x10f54f,_0x17e15a){_0x1fe242[_0x2783('0x2')](_0x33ac68,function(_0x4d26cc,_0xdd70f6){if(_0x4d26cc){_0x17e15a(_0x4d26cc);}else if(_0xdd70f6){if(_0xdd70f6[_0x2783('0x3')]instanceof Buffer){fs[_0x2783('0x4')](_0x16c169,_0xdd70f6[_0x2783('0x3')],function(_0x256eb8){if(_0x256eb8){_0x17e15a(_0x256eb8);}else{_0x10f54f();}});}else{_0x17e15a(new Error(_0x2783('0x5')));}}else{_0x17e15a(new Error(_0x2783('0x6')));}});});}module[_0x2783('0x7')]=function(_0x356a85,_0x5adda0,_0x2a7c62,_0x4eb823,_0x5ed957,_0x246759,_0x597c28){var _0x48a4d9=new AWS[(_0x2783('0x8'))]({'accessKeyId':_0x356a85,'secretAccessKey':_0x5adda0,'region':_0x2a7c62});var _0x28a038={'Text':_0x5ed957,'TextType':_0x246759||_0x2783('0x9'),'OutputFormat':_0x2783('0xa'),'VoiceId':_0x4eb823};return pollyResult(_0x48a4d9,_0x28a038,_0x597c28);}; \ 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 0f73cb5..d59f6c9 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3ff=['exports'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xa3ff,0x154));var _0xfa3f=function(_0x6b3f9c,_0x433d66){_0x6b3f9c=_0x6b3f9c-0x0;var _0x4178e3=_0xa3ff[_0x6b3f9c];return _0x4178e3;};'use strict';var asr=require('./lib/api');module[_0xfa3f('0x0')]=function(_0x35cfe0,_0xbc7ee,_0x1f51b5,_0x5dffd3){return asr(_0x35cfe0,_0xbc7ee,_0x1f51b5);}; \ No newline at end of file +var _0x4074=['./lib/api','exports'];(function(_0x21b6f0,_0x3c948){var _0x1ec11a=function(_0x5d6656){while(--_0x5d6656){_0x21b6f0['push'](_0x21b6f0['shift']());}};_0x1ec11a(++_0x3c948);}(_0x4074,0x1f0));var _0x4407=function(_0x340b99,_0xc9c2c){_0x340b99=_0x340b99-0x0;var _0x1608ba=_0x4074[_0x340b99];return _0x1608ba;};'use strict';var asr=require(_0x4407('0x0'));module[_0x4407('0x1')]=function(_0x500ca3,_0x58f658,_0x2c3e21,_0x5845ad){return asr(_0x500ca3,_0x58f658,_0x2c3e21);}; \ 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 03d41d3..7851fc6 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 _0x430e=['8000','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','LINEAR16'];(function(_0x244a3a,_0x27b0d5){var _0x58603e=function(_0x501258){while(--_0x501258){_0x244a3a['push'](_0x244a3a['shift']());}};_0x58603e(++_0x27b0d5);}(_0x430e,0x105));var _0xe430=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x430e[_0x3eff21];return _0x1945bb;};'use strict';var url=require('url');var BPromise=require(_0xe430('0x0'));var fs=require('fs');var host=_0xe430('0x1');module['exports']=function(_0x85af5b,_0x253dfe,_0x36942f){return new BPromise(function(_0x1a9d61,_0x4a1cd1){var _0x3b9e89;if(typeof _0x85af5b!==_0xe430('0x2')||_0x85af5b[_0xe430('0x3')]===0x0){return _0x4a1cd1(_0xe430('0x4'));}if(typeof _0x253dfe!=='string'||_0x253dfe[_0xe430('0x3')]===0x0){return _0x4a1cd1(_0xe430('0x5'));}if(typeof _0x36942f!==_0xe430('0x6')&&(typeof _0x36942f!==_0xe430('0x2')||_0x36942f[_0xe430('0x3')]===0x0)){return _0x4a1cd1('lang\x20should\x20be\x20a\x20string');}try{_0x3b9e89=fs[_0xe430('0x7')](_0x85af5b)[_0xe430('0x8')](_0xe430('0x9'));}catch(_0x22ce49){return _0x4a1cd1(_0x22ce49);}return _0x1a9d61({'method':_0xe430('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x253dfe,'body':{'config':{'encoding':_0xe430('0xb'),'sampleRateHertz':_0xe430('0xc'),'languageCode':_0x36942f},'audio':{'content':_0x3b9e89}},'json':!![]});});}; \ No newline at end of file +var _0xa9e0=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string'];(function(_0x39fdfe,_0x277109){var _0x390094=function(_0x4bc75e){while(--_0x4bc75e){_0x39fdfe['push'](_0x39fdfe['shift']());}};_0x390094(++_0x277109);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var url=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var fs=require('fs');var host=_0x0a9e('0x2');module['exports']=function(_0x550fbc,_0x18d5c9,_0x4ce2f1){return new BPromise(function(_0x333808,_0x432180){var _0x2ab90b;if(typeof _0x550fbc!==_0x0a9e('0x3')||_0x550fbc[_0x0a9e('0x4')]===0x0){return _0x432180('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x18d5c9!==_0x0a9e('0x3')||_0x18d5c9[_0x0a9e('0x4')]===0x0){return _0x432180(_0x0a9e('0x5'));}if(typeof _0x4ce2f1!=='undefined'&&(typeof _0x4ce2f1!=='string'||_0x4ce2f1[_0x0a9e('0x4')]===0x0)){return _0x432180('lang\x20should\x20be\x20a\x20string');}try{_0x2ab90b=fs['readFileSync'](_0x550fbc)[_0x0a9e('0x6')](_0x0a9e('0x7'));}catch(_0x307b3e){return _0x432180(_0x307b3e);}return _0x333808({'method':_0x0a9e('0x8'),'uri':host+_0x0a9e('0x9')+_0x18d5c9,'body':{'config':{'encoding':_0x0a9e('0xa'),'sampleRateHertz':'8000','languageCode':_0x4ce2f1},'audio':{'content':_0x2ab90b}},'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 1f9539d..66689d6 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 _0x9869=['exports'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x9869,0x126));var _0x9986=function(_0x385c82,_0x55a61b){_0x385c82=_0x385c82-0x0;var _0x7c4d0=_0x9869[_0x385c82];return _0x7c4d0;};var asr=require('./asr');module[_0x9986('0x0')]={'asr':asr}; \ No newline at end of file +var _0x95ae=['./asr'];(function(_0x23bea4,_0x38a38){var _0xb54789=function(_0x2a5608){while(--_0x2a5608){_0x23bea4['push'](_0x23bea4['shift']());}};_0xb54789(++_0x38a38);}(_0x95ae,0xaa));var _0xe95a=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x95ae[_0x344a3f];return _0x264712;};var asr=require(_0xe95a('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index cac346a..3bf65f6 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 _0x7981=['statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','tmp','generate','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','POST','.mp3','from','audioContent','resolve','.wav','then','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','detectIntent','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','awsLex','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','sestekNDA','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','randomstring','sox','parse','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get'];(function(_0x9d9faf,_0xbcb09){var _0x3502e0=function(_0x2924da){while(--_0x2924da){_0x9d9faf['push'](_0x9d9faf['shift']());}};_0x3502e0(++_0xbcb09);}(_0x7981,0xfd));var _0x1798=function(_0x427f6b,_0x5233b9){_0x427f6b=_0x427f6b-0x0;var _0x275299=_0x7981[_0x427f6b];return _0x275299;};'use strict';var apiai=require(_0x1798('0x0'));var BPromise=require(_0x1798('0x1'));var dialogflow=require(_0x1798('0x2'));var fs=require('fs');var http=require(_0x1798('0x3'));var https=require(_0x1798('0x4'));var md5=require(_0x1798('0x5'));var path=require('path');var querystring=require(_0x1798('0x6'));var rp=require('request-promise');var rs=require(_0x1798('0x7'));var sox=require(_0x1798('0x8'));var tts=require('google-tts-api');var urlParse=require('url')[_0x1798('0x9')];var util=require('util');var aws=require('./aws');var google=require(_0x1798('0xa'));var sestek=require(_0x1798('0xb'));var tilde=require(_0x1798('0xc'));var logger=require('../../../config/logger')(_0x1798('0xd'));var ISPEECH_API=_0x1798('0xe');function downloadFile(_0x233092,_0x1b14dc){return new BPromise(function(_0x153945,_0x53acaf){var _0xf4c669=urlParse(_0x233092);var _0x1bea84=_0xf4c669[_0x1798('0xf')]===_0x1798('0x10')?https:http;var _0x503527={'host':_0xf4c669[_0x1798('0x11')],'path':_0xf4c669[_0x1798('0x12')],'headers':{'user-agent':_0x1798('0x13')}};_0x1bea84[_0x1798('0x14')](_0x503527,function(_0x38837a){if(_0x38837a[_0x1798('0x15')]!==0xc8){logger[_0x1798('0x16')](_0x1798('0x17')+_0x233092+_0x1798('0x18')+_0x38837a[_0x1798('0x15')]+'\x20('+_0x38837a[_0x1798('0x19')]+')');_0x53acaf(new Error(_0x1798('0x17')+_0x233092+_0x1798('0x18')+_0x38837a[_0x1798('0x15')]+'\x20('+_0x38837a[_0x1798('0x19')]+')'));return;}var _0x33efb7=fs[_0x1798('0x1a')](_0x1b14dc);_0x33efb7['on'](_0x1798('0x1b'),function(){logger[_0x1798('0x1c')]('finish\x20download\x20file');_0x33efb7[_0x1798('0x1d')](_0x153945);});_0x33efb7['on'](_0x1798('0x16'),function(_0x31966d){fs[_0x1798('0x1e')](_0x1b14dc);logger['error'](_0x1798('0x1f'),_0x31966d);_0x53acaf(_0x31966d);});_0x38837a[_0x1798('0x20')](_0x33efb7);})['on']('error',function(_0x32cd1c){logger[_0x1798('0x16')](_0x32cd1c);_0x53acaf(_0x32cd1c);})['end']();});}function uploadFile(_0x1944f5){return new BPromise(function(_0xe3758d,_0x519430){var _0x964542=urlParse(_0x1944f5);var _0x559592=_0x964542[_0x1798('0xf')]==='https:'?https:http;var _0x403bf1={'host':_0x964542[_0x1798('0x11')],'path':_0x964542[_0x1798('0x12')],'headers':{'user-agent':_0x1798('0x13')}};_0x559592['get'](_0x403bf1,function(_0x1d921a){if(_0x1d921a[_0x1798('0x15')]!==0xc8){_0x519430(new Error(_0x1798('0x17')+_0x1944f5+_0x1798('0x18')+_0x1d921a[_0x1798('0x15')]+'\x20('+_0x1d921a[_0x1798('0x19')]+')'));return;}var _0x5cbca4='';_0x1d921a['on'](_0x1798('0x21'),function(_0x226561){_0x5cbca4+=_0x226561;});_0x1d921a['on'](_0x1798('0x22'),function(){_0xe3758d(_0x5cbca4);});})['on']('error',function(_0x40d69a){_0x519430(_0x40d69a);})[_0x1798('0x22')]();});}function convertFile(_0x4c9232,_0x1fe5cc){return new BPromise(function(_0x58d019,_0x10b160){var _0x491eee=sox[_0x1798('0x23')](_0x4c9232,_0x1fe5cc,{'sampleRate':0x1f40,'format':_0x1798('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x491eee['on']('error',function(_0x5b5e74){logger[_0x1798('0x16')](_0x1798('0x25'),_0x5b5e74);_0x10b160(_0x5b5e74);});_0x491eee['on'](_0x1798('0x22'),function(){logger[_0x1798('0x1c')](_0x1798('0x26'));_0x58d019();});_0x491eee[_0x1798('0x27')]();});}function base64Decode(_0x52ebad,_0x2fef56){var _0x5d81be=path['resolve'](__dirname,_0x1798('0x28'),rs[_0x1798('0x29')](0x4)+'.wav');fs[_0x1798('0x2a')](_0x5d81be,_0x52ebad,_0x1798('0x2b'));return convertFile(_0x5d81be,_0x2fef56)['then'](function(){try{fs['unlink'](_0x5d81be);fs[_0x1798('0x2c')](_0x2fef56,_0x1798('0x2d'));}catch(_0x39f1e8){logger[_0x1798('0x16')](_0x39f1e8);}return _0x2fef56[_0x1798('0x2e')]('.')[0x0];});}function base64Encode(_0x29e085){var _0x256c68=fs[_0x1798('0x2f')](_0x29e085);return new Buffer(_0x256c68)[_0x1798('0x30')](_0x1798('0x2b'));}exports[_0x1798('0x31')]=function(_0x490d8b,_0x2d1234,_0x1ed791,_0x240740,_0x4effa4,_0x7f9668){var _0x287256,_0x158d88;var _0x48297b=_0x1798('0x32');var _0x425787=_0x1798('0x33')+_0x490d8b;var _0x1be369={};if(_0x2d1234===_0x1798('0x34')){_0x1be369[_0x1798('0x35')]={'ssml':_0x1ed791};}else{_0x1be369[_0x1798('0x35')]={'text':_0x1ed791};};_0x1be369[_0x1798('0x36')]={'languageCode':_0x240740,'ssmlGender':_0x4effa4};_0x1be369['audioConfig']={'audioEncoding':_0x1798('0x37'),'sampleRateHertz':0x1f40};var _0x369b3a={'url':_0x48297b+_0x1798('0x38')+_0x425787,'method':_0x1798('0x39'),'json':!![],'body':_0x1be369};return rp(_0x369b3a)['then'](function(_0x4d1449){return new BPromise(function(_0x11d84a,_0x32b766){_0x287256=path['resolve'](__dirname,_0x1798('0x28'),rs[_0x1798('0x29')](0x4)+_0x1798('0x3a'));var _0x5bbe69=Buffer[_0x1798('0x3b')](_0x4d1449[_0x1798('0x3c')],_0x1798('0x2b'));return fs['writeFile'](_0x287256,_0x5bbe69,function(_0x1a6953){_0x32b766(_0x1a6953);},function(_0x5e3323){fs[_0x1798('0x2c')](_0x287256,_0x1798('0x2d'));_0x11d84a(_0x5e3323);});});})['then'](function(_0x370d7f){_0x158d88=path[_0x1798('0x3d')](__dirname,_0x1798('0x28'),rs[_0x1798('0x29')](0x4)+_0x1798('0x3e'));return convertFile(_0x287256,_0x158d88);})[_0x1798('0x3f')](function(){try{fs[_0x1798('0x1e')](_0x287256);fs[_0x1798('0x2c')](_0x158d88,'777');}catch(_0x513d96){logger['error'](_0x513d96);}logger[_0x1798('0x1c')]('googleCloudTTS\x20path',_0x158d88[_0x1798('0x2e')]('.')[0x0]);return _0x158d88[_0x1798('0x2e')]('.')[0x0];});};exports[_0x1798('0x40')]=function(_0x29b8b9,_0x1806f5){var _0x54f6e9=_0x1798('0x41');var _0x238951,_0x891026;var _0x47be1b;var _0x4a269a={'encoding':_0x1798('0x42'),'method':_0x1798('0x39'),'timeout':0x2710,'url':_0x54f6e9,'headers':{'Content-Type':_0x1798('0x43')},'body':_0x1798('0x44')+encodeURIComponent(JSON[_0x1798('0x45')]([[[_0x1798('0x46'),JSON[_0x1798('0x45')]([_0x29b8b9,_0x1806f5||'en',![],_0x1798('0x47')]),null,'generic']]]))};return rp(_0x4a269a)[_0x1798('0x3f')](function(_0x1d1af1){try{_0x47be1b=eval(_0x1d1af1[_0x1798('0x48')](0x5))[0x0][0x2];}catch(_0xb930c){throw new Error(_0x1798('0x49')+_0x1d1af1['data']);}if(!_0x47be1b){if(_0x29b8b9[_0x1798('0x4a')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x1798('0x4b')+_0x1806f5+_0x1798('0x4c'));}}try{_0x47be1b=eval(_0x47be1b)[0x0];}catch(_0x11ca38){throw new Error(_0x1798('0x49')+res[_0x1798('0x21')]);}const _0x58e3e5=_0x47be1b;_0x238951=path[_0x1798('0x3d')](__dirname,'tmp',rs[_0x1798('0x29')](0x4)+'.mp3');fs[_0x1798('0x2a')](_0x238951,_0x47be1b,{'encoding':_0x1798('0x2b')});_0x891026=path[_0x1798('0x3d')](__dirname,_0x1798('0x28'),rs[_0x1798('0x29')](0x4)+_0x1798('0x3e'));return convertFile(_0x238951,_0x891026);})[_0x1798('0x3f')](function(){try{fs[_0x1798('0x1e')](_0x238951);fs[_0x1798('0x2c')](_0x891026,_0x1798('0x2d'));}catch(_0xe01870){logger[_0x1798('0x16')](_0xe01870);}logger[_0x1798('0x1c')](_0x1798('0x4d'),_0x891026[_0x1798('0x2e')]('.')[0x0]);return _0x891026[_0x1798('0x2e')]('.')[0x0];});};exports[_0x1798('0x4e')]=function(_0x5e87cb,_0x20f258,_0x2e278b){return google['asr'](_0x5e87cb,_0x20f258,_0x2e278b)[_0x1798('0x3f')](function(_0x3675d5){logger['info'](_0x3675d5[_0x1798('0x4f')]);return rp(_0x3675d5);})[_0x1798('0x3f')](function(_0x2d33ef){var _0x384861='';var _0x285807=0x0;try{fs['unlink'](_0x5e87cb);}catch(_0x338c01){logger[_0x1798('0x16')](_0x338c01);}if(_0x2d33ef&&_0x2d33ef[_0x1798('0x50')]){_0x384861=_0x2d33ef[_0x1798('0x50')]['map'](function(_0x4ffdcf){return _0x4ffdcf&&_0x4ffdcf[_0x1798('0x51')][0x0]&&_0x4ffdcf[_0x1798('0x51')][0x0][_0x1798('0x52')]?_0x4ffdcf['alternatives'][0x0][_0x1798('0x52')]:'';})[_0x1798('0x53')]('\x0a');_0x285807=_0x2d33ef[_0x1798('0x50')][_0x1798('0x54')](function(_0xdad7b){return _0xdad7b&&_0xdad7b['alternatives'][0x0]&&_0xdad7b[_0x1798('0x51')][0x0][_0x1798('0x55')]?_0xdad7b[_0x1798('0x51')][0x0][_0x1798('0x55')]:0x0;})[_0x1798('0x53')]('\x0a');}logger[_0x1798('0x1c')](_0x1798('0x56'),_0x384861);logger[_0x1798('0x1c')](_0x1798('0x57'),_0x285807);return{'transcript':_0x384861,'confidence':_0x285807};})[_0x1798('0x58')](function(_0x22a126){logger[_0x1798('0x16')](_0x1798('0x59'),_0x22a126[_0x1798('0x15')],_0x22a126['name'],_0x22a126[_0x1798('0x5a')]);});};exports['googleDialogflow']=function(_0x31b647,_0x4f43a6,_0x3b7d86,_0x285d05){var _0x5db246=apiai(_0x4f43a6,{'language':_0x285d05||'en'});return _0x5db246[_0x1798('0x5b')](_0x3b7d86,{'sessionId':md5(_0x31b647)})[_0x1798('0x3f')](function(_0x10cb5a){logger['info'](JSON[_0x1798('0x45')](_0x10cb5a));return{'source':_0x10cb5a[_0x1798('0x5c')][_0x1798('0x5d')],'resolvedQuery':_0x10cb5a['result'][_0x1798('0x5e')],'action':_0x10cb5a[_0x1798('0x5c')][_0x1798('0x5f')],'actionIncomplete':_0x10cb5a['result'][_0x1798('0x60')],'speech':_0x10cb5a['result'][_0x1798('0x61')]['speech'],'score':_0x10cb5a[_0x1798('0x5c')]['score'],'statusCode':_0x10cb5a['status'][_0x1798('0x62')],'endConversation':_0x10cb5a[_0x1798('0x5c')][_0x1798('0x63')][_0x1798('0x64')]||![],'isFallbackIntent':_0x10cb5a[_0x1798('0x5c')][_0x1798('0x63')][_0x1798('0x65')]};});};exports[_0x1798('0x66')]=function(_0x6585e8,_0x116960,_0x3289cd,_0x314e2d,_0x2feaab,_0x3923c6){var _0x70d4f=_0x314e2d[_0x1798('0x67')](/\\n/g,'\x0a');var _0xfa260c={'credentials':{'private_key':_0x70d4f,'client_email':_0x3289cd}};var _0x1cc781=new dialogflow['SessionsClient'](_0xfa260c);var _0x165017=_0x1cc781['sessionPath'](_0x116960,md5(_0x6585e8));var _0x5c5f22={'session':_0x165017,'queryInput':{'text':{'text':_0x2feaab,'languageCode':_0x3923c6}}};return _0x1cc781[_0x1798('0x68')](_0x5c5f22)[_0x1798('0x3f')](function(_0x4eac44){if(_0x4eac44&&_0x4eac44[_0x1798('0x4a')]){logger[_0x1798('0x1c')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x4eac44));var _0x3d53dc=_0x4eac44[0x0];if(_0x3d53dc){var _0x42ffae={'action':_0x3d53dc[_0x1798('0x69')]['action'],'allRequiredParamsPresent':_0x3d53dc[_0x1798('0x69')]['allRequiredParamsPresent'],'endConversation':_0x3d53dc['queryResult'][_0x1798('0x6a')]&&_0x3d53dc[_0x1798('0x69')][_0x1798('0x6a')][_0x1798('0x6b')]?_0x3d53dc[_0x1798('0x69')][_0x1798('0x6a')][_0x1798('0x6b')][_0x1798('0x6c')][_0x1798('0x6d')]:![],'fulfillmentText':_0x3d53dc[_0x1798('0x69')][_0x1798('0x6e')],'intentName':_0x3d53dc['queryResult'][_0x1798('0x6f')][_0x1798('0x70')],'intentDisplayName':_0x3d53dc['queryResult']['intent'][_0x1798('0x71')],'isFallbackIntent':_0x3d53dc[_0x1798('0x69')][_0x1798('0x6f')][_0x1798('0x72')],'languageCode':_0x3d53dc[_0x1798('0x69')][_0x1798('0x73')],'queryText':_0x3d53dc[_0x1798('0x69')]['queryText'],'responseId':_0x3d53dc[_0x1798('0x74')],'score':_0x3d53dc[_0x1798('0x69')][_0x1798('0x75')],'speech':_0x3d53dc[_0x1798('0x69')]['fulfillmentText'],'providerResponse':JSON[_0x1798('0x45')](_0x4eac44)};return _0x42ffae;}}});};exports[_0x1798('0x76')]=function(_0x1fef17,_0x36b14c,_0x4027c8,_0x46e82f){return tilde[_0x1798('0x77')](_0x1fef17,_0x36b14c,_0x4027c8,_0x46e82f)['then'](function(_0x1ce233){try{fs[_0x1798('0x1e')](_0x1fef17);}catch(_0x37743c){logger['error'](_0x37743c);}logger[_0x1798('0x1c')](_0x1798('0x78'),_0x1ce233[_0x1798('0x52')]);logger[_0x1798('0x1c')]('Tilde\x20ASR\x20confidence',_0x1ce233[_0x1798('0x55')]);return _0x1ce233;});};exports['awsPolly']=function(_0x31bb4b,_0x5cf5e2,_0x1af3ee,_0x542c3c,_0x3ce06d,_0x1296a3){var _0x238368=path[_0x1798('0x3d')](__dirname,_0x1798('0x28'),rs[_0x1798('0x29')](0x4)+_0x1798('0x3a'));var _0x1e0bda;return aws['polly'](_0x31bb4b,_0x5cf5e2,_0x1af3ee,_0x542c3c,_0x3ce06d,_0x1296a3,_0x238368)[_0x1798('0x3f')](function(){_0x1e0bda=path[_0x1798('0x3d')](__dirname,'tmp',rs[_0x1798('0x29')](0x4)+_0x1798('0x3e'));return convertFile(_0x238368,_0x1e0bda);})[_0x1798('0x3f')](function(){try{fs['unlink'](_0x238368);fs[_0x1798('0x2c')](_0x1e0bda,'777');}catch(_0x477206){logger[_0x1798('0x16')](_0x477206);}return _0x1e0bda[_0x1798('0x2e')]('.')[0x0];});};exports[_0x1798('0x79')]=function(_0x42af0a,_0x28247e,_0x4aec59,_0x3a37c1,_0x5a73d0,_0x53db47){return aws[_0x1798('0x7a')](_0x42af0a,_0x28247e,_0x4aec59,_0x3a37c1,_0x5a73d0,_0x53db47)[_0x1798('0x3f')](function(_0x41f259){logger['info'](JSON[_0x1798('0x45')](_0x41f259));return _0x41f259;});};exports['ispeechTTS']=function(_0x47c91d,_0x16a926,_0x5408b3,_0xffa588){var _0x1611c7=util['format'](_0x1798('0x7b'),ISPEECH_API,_0x47c91d,encodeURIComponent(_0x16a926),_0x5408b3,_0xffa588);var _0x2c3d9a=path[_0x1798('0x3d')](__dirname,_0x1798('0x28'),rs[_0x1798('0x29')](0x4)+_0x1798('0x3a'));var _0x29ee9d;return downloadFile(_0x1611c7,_0x2c3d9a)['then'](function(){_0x29ee9d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x1798('0x3e'));return convertFile(_0x2c3d9a,_0x29ee9d);})[_0x1798('0x3f')](function(){try{fs[_0x1798('0x1e')](_0x2c3d9a);fs[_0x1798('0x2c')](_0x29ee9d,_0x1798('0x2d'));}catch(_0x5dae56){logger[_0x1798('0x16')](_0x5dae56);}return _0x29ee9d[_0x1798('0x2e')]('.')[0x0];});};exports[_0x1798('0x7c')]=function(_0x5ab467,_0x3c8bd0,_0x2de0bf,_0x12fb23){var _0xff25eb=util[_0x1798('0x7d')](_0x1798('0x7e'),ISPEECH_API,_0x3c8bd0,_0x2de0bf,base64Encode(_0x5ab467),_0x12fb23?util[_0x1798('0x7d')]('model=%s',encodeURIComponent(_0x12fb23)):_0x1798('0x7f'));return uploadFile(_0xff25eb)[_0x1798('0x3f')](function(_0x3ce8e8){return querystring[_0x1798('0x9')](_0x3ce8e8);});};exports[_0x1798('0x80')]=function(_0x17233a,_0x286806){return sestek[_0x1798('0x81')](_0x17233a,_0x286806)['then'](function(_0x55476a){logger[_0x1798('0x1c')](JSON[_0x1798('0x45')](_0x55476a));var _0xb73fbc={'speech':_0x55476a['text'],'action':_0x55476a[_0x1798('0x82')]?_0x55476a[_0x1798('0x82')][_0x1798('0x83')]:undefined,'actiondata':_0x55476a['channelData']?_0x55476a[_0x1798('0x82')][_0x1798('0x84')]:undefined};if(_0x55476a[_0x1798('0x82')]&&_0x55476a[_0x1798('0x82')]['AudioFromTts']){return base64Decode(_0x55476a[_0x1798('0x82')][_0x1798('0x85')][_0x1798('0x86')],path[_0x1798('0x3d')](__dirname,_0x1798('0x28'),rs['generate'](0x4)+_0x1798('0x3e')))['then'](function(_0x13e193){_0xb73fbc[_0x1798('0x87')]=_0x13e193;return _0xb73fbc;});}return _0xb73fbc;});};exports[_0x1798('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0x6922=['name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','fulfillment','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomActionData','AudioFromTts','Data','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./google','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','get','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s'];(function(_0x5c0d76,_0x293106){var _0x250a9b=function(_0xe26981){while(--_0xe26981){_0x5c0d76['push'](_0x5c0d76['shift']());}};_0x250a9b(++_0x293106);}(_0x6922,0x148));var _0x2692=function(_0x1c9dd6,_0xe89ac7){_0x1c9dd6=_0x1c9dd6-0x0;var _0x3b62c4=_0x6922[_0x1c9dd6];return _0x3b62c4;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x2692('0x0'));var dialogflow=require(_0x2692('0x1'));var fs=require('fs');var http=require(_0x2692('0x2'));var https=require(_0x2692('0x3'));var md5=require('md5');var path=require(_0x2692('0x4'));var querystring=require(_0x2692('0x5'));var rp=require(_0x2692('0x6'));var rs=require(_0x2692('0x7'));var sox=require(_0x2692('0x8'));var tts=require(_0x2692('0x9'));var urlParse=require(_0x2692('0xa'))[_0x2692('0xb')];var util=require(_0x2692('0xc'));var aws=require(_0x2692('0xd'));var google=require(_0x2692('0xe'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x2692('0xf'))('agi');var ISPEECH_API=_0x2692('0x10');function downloadFile(_0xb3023b,_0x4b6ec2){return new BPromise(function(_0x284772,_0x5c1d1b){var _0x1336f4=urlParse(_0xb3023b);var _0x29e581=_0x1336f4[_0x2692('0x11')]===_0x2692('0x12')?https:http;var _0x521b7f={'host':_0x1336f4[_0x2692('0x13')],'path':_0x1336f4[_0x2692('0x4')],'headers':{'user-agent':_0x2692('0x14')}};_0x29e581['get'](_0x521b7f,function(_0x25df5){if(_0x25df5[_0x2692('0x15')]!==0xc8){logger[_0x2692('0x16')](_0x2692('0x17')+_0xb3023b+_0x2692('0x18')+_0x25df5[_0x2692('0x15')]+'\x20('+_0x25df5['statusMessage']+')');_0x5c1d1b(new Error('request\x20to\x20'+_0xb3023b+_0x2692('0x18')+_0x25df5['statusCode']+'\x20('+_0x25df5[_0x2692('0x19')]+')'));return;}var _0x113423=fs['createWriteStream'](_0x4b6ec2);_0x113423['on'](_0x2692('0x1a'),function(){logger[_0x2692('0x1b')](_0x2692('0x1c'));_0x113423[_0x2692('0x1d')](_0x284772);});_0x113423['on'](_0x2692('0x16'),function(_0x4dd5e5){fs[_0x2692('0x1e')](_0x4b6ec2);logger['error'](_0x2692('0x1f'),_0x4dd5e5);_0x5c1d1b(_0x4dd5e5);});_0x25df5[_0x2692('0x20')](_0x113423);})['on']('error',function(_0x542990){logger[_0x2692('0x16')](_0x542990);_0x5c1d1b(_0x542990);})[_0x2692('0x21')]();});}function uploadFile(_0x372b52){return new BPromise(function(_0x467c9a,_0x343ff7){var _0x3318e3=urlParse(_0x372b52);var _0x3919dd=_0x3318e3[_0x2692('0x11')]===_0x2692('0x12')?https:http;var _0xe94e33={'host':_0x3318e3['host'],'path':_0x3318e3[_0x2692('0x4')],'headers':{'user-agent':_0x2692('0x14')}};_0x3919dd[_0x2692('0x22')](_0xe94e33,function(_0x184d5c){if(_0x184d5c[_0x2692('0x15')]!==0xc8){_0x343ff7(new Error(_0x2692('0x17')+_0x372b52+_0x2692('0x18')+_0x184d5c['statusCode']+'\x20('+_0x184d5c[_0x2692('0x19')]+')'));return;}var _0x4a9e08='';_0x184d5c['on'](_0x2692('0x23'),function(_0x40dbcc){_0x4a9e08+=_0x40dbcc;});_0x184d5c['on'](_0x2692('0x21'),function(){_0x467c9a(_0x4a9e08);});})['on'](_0x2692('0x16'),function(_0x19c7b0){_0x343ff7(_0x19c7b0);})[_0x2692('0x21')]();});}function convertFile(_0xdc4ce8,_0x3a9507){return new BPromise(function(_0x5ed930,_0x5b7cef){var _0xe011c4=sox[_0x2692('0x24')](_0xdc4ce8,_0x3a9507,{'sampleRate':0x1f40,'format':_0x2692('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xe011c4['on'](_0x2692('0x16'),function(_0x4679e2){logger[_0x2692('0x16')](_0x2692('0x26'),_0x4679e2);_0x5b7cef(_0x4679e2);});_0xe011c4['on'](_0x2692('0x21'),function(){logger[_0x2692('0x1b')](_0x2692('0x27'));_0x5ed930();});_0xe011c4['start']();});}function base64Decode(_0xce0de6,_0x5b41fa){var _0x22369d=path[_0x2692('0x28')](__dirname,'tmp',rs[_0x2692('0x29')](0x4)+_0x2692('0x2a'));fs[_0x2692('0x2b')](_0x22369d,_0xce0de6,_0x2692('0x2c'));return convertFile(_0x22369d,_0x5b41fa)[_0x2692('0x2d')](function(){try{fs[_0x2692('0x1e')](_0x22369d);fs[_0x2692('0x2e')](_0x5b41fa,_0x2692('0x2f'));}catch(_0x3e33ee){logger[_0x2692('0x16')](_0x3e33ee);}return _0x5b41fa[_0x2692('0x30')]('.')[0x0];});}function base64Encode(_0x52583c){var _0x52d7e7=fs[_0x2692('0x31')](_0x52583c);return new Buffer(_0x52d7e7)[_0x2692('0x32')](_0x2692('0x2c'));}exports[_0x2692('0x33')]=function(_0x4a7f9a,_0x148575,_0x43fd1f,_0x33e16c,_0x35d6bb,_0xa28000){var _0x482f8c,_0x3dd2a0;var _0x16c1cc=_0x2692('0x34');var _0x1ce2f0=_0x2692('0x35')+_0x4a7f9a;var _0x142c62={};if(_0x148575===_0x2692('0x36')){_0x142c62[_0x2692('0x37')]={'ssml':_0x43fd1f};}else{_0x142c62[_0x2692('0x37')]={'text':_0x43fd1f};};_0x142c62[_0x2692('0x38')]={'languageCode':_0x33e16c,'ssmlGender':_0x35d6bb};_0x142c62[_0x2692('0x39')]={'audioEncoding':_0x2692('0x3a'),'sampleRateHertz':0x1f40};var _0x114606={'url':_0x16c1cc+_0x2692('0x3b')+_0x1ce2f0,'method':_0x2692('0x3c'),'json':!![],'body':_0x142c62};return rp(_0x114606)[_0x2692('0x2d')](function(_0x1b16af){return new BPromise(function(_0x5b1418,_0x2a5446){_0x482f8c=path[_0x2692('0x28')](__dirname,_0x2692('0x3d'),rs[_0x2692('0x29')](0x4)+_0x2692('0x3e'));var _0x54cca0=Buffer[_0x2692('0x3f')](_0x1b16af['audioContent'],_0x2692('0x2c'));return fs['writeFile'](_0x482f8c,_0x54cca0,function(_0x10567d){_0x2a5446(_0x10567d);},function(_0x4aded9){fs[_0x2692('0x2e')](_0x482f8c,'777');_0x5b1418(_0x4aded9);});});})[_0x2692('0x2d')](function(_0x5259df){_0x3dd2a0=path[_0x2692('0x28')](__dirname,_0x2692('0x3d'),rs[_0x2692('0x29')](0x4)+_0x2692('0x2a'));return convertFile(_0x482f8c,_0x3dd2a0);})[_0x2692('0x2d')](function(){try{fs['unlink'](_0x482f8c);fs[_0x2692('0x2e')](_0x3dd2a0,_0x2692('0x2f'));}catch(_0x1169b9){logger[_0x2692('0x16')](_0x1169b9);}logger['info'](_0x2692('0x40'),_0x3dd2a0['split']('.')[0x0]);return _0x3dd2a0[_0x2692('0x30')]('.')[0x0];});};exports['googleTTS']=function(_0x2054d5,_0x48bfd8){var _0x55a725=_0x2692('0x41');var _0x43b5f2,_0x2e562b;var _0x209a9f;var _0x10a85d={'encoding':_0x2692('0x42'),'method':'POST','timeout':0x2710,'url':_0x55a725,'headers':{'Content-Type':_0x2692('0x43')},'body':_0x2692('0x44')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x2692('0x45')]([_0x2054d5,_0x48bfd8||'en',![],_0x2692('0x46')]),null,_0x2692('0x47')]]]))};return rp(_0x10a85d)['then'](function(_0x3d33ad){try{_0x209a9f=eval(_0x3d33ad[_0x2692('0x48')](0x5))[0x0][0x2];}catch(_0x3dd72b){throw new Error('parse\x20response\x20failed:\x0a'+_0x3d33ad[_0x2692('0x23')]);}if(!_0x209a9f){if(_0x2054d5[_0x2692('0x49')]>0xc8){throw new Error(_0x2692('0x4a'));}else{throw new Error(_0x2692('0x4b')+_0x48bfd8+_0x2692('0x4c'));}}try{_0x209a9f=eval(_0x209a9f)[0x0];}catch(_0x3c6abc){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2692('0x23')]);}const _0x299b1b=_0x209a9f;_0x43b5f2=path['resolve'](__dirname,_0x2692('0x3d'),rs[_0x2692('0x29')](0x4)+_0x2692('0x3e'));fs['writeFileSync'](_0x43b5f2,_0x209a9f,{'encoding':_0x2692('0x2c')});_0x2e562b=path[_0x2692('0x28')](__dirname,_0x2692('0x3d'),rs[_0x2692('0x29')](0x4)+'.wav');return convertFile(_0x43b5f2,_0x2e562b);})[_0x2692('0x2d')](function(){try{fs[_0x2692('0x1e')](_0x43b5f2);fs[_0x2692('0x2e')](_0x2e562b,'777');}catch(_0x25c812){logger[_0x2692('0x16')](_0x25c812);}logger['info']('goggleTTS\x20path',_0x2e562b['split']('.')[0x0]);return _0x2e562b[_0x2692('0x30')]('.')[0x0];});};exports[_0x2692('0x4d')]=function(_0x5e59d9,_0x3864b5,_0xf07bff){return google[_0x2692('0x4e')](_0x5e59d9,_0x3864b5,_0xf07bff)[_0x2692('0x2d')](function(_0x853e0b){logger[_0x2692('0x1b')](_0x853e0b['uri']);return rp(_0x853e0b);})['then'](function(_0x93880e){var _0x345618='';var _0x6a87fb=0x0;try{fs[_0x2692('0x1e')](_0x5e59d9);}catch(_0x40f8f9){logger['error'](_0x40f8f9);}if(_0x93880e&&_0x93880e[_0x2692('0x4f')]){_0x345618=_0x93880e['results'][_0x2692('0x50')](function(_0x1e56e6){return _0x1e56e6&&_0x1e56e6['alternatives'][0x0]&&_0x1e56e6[_0x2692('0x51')][0x0][_0x2692('0x52')]?_0x1e56e6[_0x2692('0x51')][0x0][_0x2692('0x52')]:'';})['join']('\x0a');_0x6a87fb=_0x93880e[_0x2692('0x4f')]['map'](function(_0x1cc36c){return _0x1cc36c&&_0x1cc36c[_0x2692('0x51')][0x0]&&_0x1cc36c[_0x2692('0x51')][0x0][_0x2692('0x53')]?_0x1cc36c[_0x2692('0x51')][0x0][_0x2692('0x53')]:0x0;})[_0x2692('0x54')]('\x0a');}logger[_0x2692('0x1b')](_0x2692('0x55'),_0x345618);logger[_0x2692('0x1b')](_0x2692('0x56'),_0x6a87fb);return{'transcript':_0x345618,'confidence':_0x6a87fb};})[_0x2692('0x57')](function(_0x4e802c){logger[_0x2692('0x16')](_0x2692('0x58'),_0x4e802c[_0x2692('0x15')],_0x4e802c[_0x2692('0x59')],_0x4e802c[_0x2692('0x5a')]);});};exports[_0x2692('0x5b')]=function(_0x1ef476,_0x15864c,_0x224cbe,_0x44cf6f){var _0x3f7f9e=apiai(_0x15864c,{'language':_0x44cf6f||'en'});return _0x3f7f9e[_0x2692('0x5c')](_0x224cbe,{'sessionId':md5(_0x1ef476)})['then'](function(_0x5af33f){logger[_0x2692('0x1b')](JSON[_0x2692('0x45')](_0x5af33f));return{'source':_0x5af33f[_0x2692('0x5d')][_0x2692('0x5e')],'resolvedQuery':_0x5af33f[_0x2692('0x5d')][_0x2692('0x5f')],'action':_0x5af33f[_0x2692('0x5d')][_0x2692('0x60')],'actionIncomplete':_0x5af33f['result']['actionIncomplete'],'speech':_0x5af33f[_0x2692('0x5d')][_0x2692('0x61')]['speech'],'score':_0x5af33f['result'][_0x2692('0x62')],'statusCode':_0x5af33f[_0x2692('0x63')][_0x2692('0x64')],'endConversation':_0x5af33f[_0x2692('0x5d')][_0x2692('0x65')][_0x2692('0x66')]||![],'isFallbackIntent':_0x5af33f[_0x2692('0x5d')][_0x2692('0x65')][_0x2692('0x67')]};});};exports[_0x2692('0x68')]=function(_0x3db15b,_0x80997e,_0x548018,_0xf83b9d,_0x126b02,_0x5d6d87){var _0x277b06=_0xf83b9d['replace'](/\\n/g,'\x0a');var _0x38dc16={'credentials':{'private_key':_0x277b06,'client_email':_0x548018}};var _0x546f43=new dialogflow[(_0x2692('0x69'))](_0x38dc16);var _0x5d03f6=_0x546f43['sessionPath'](_0x80997e,md5(_0x3db15b));var _0x42de98={'session':_0x5d03f6,'queryInput':{'text':{'text':_0x126b02,'languageCode':_0x5d6d87}}};return _0x546f43[_0x2692('0x6a')](_0x42de98)[_0x2692('0x2d')](function(_0x31359f){if(_0x31359f&&_0x31359f['length']){logger[_0x2692('0x1b')](_0x2692('0x6b'),JSON[_0x2692('0x45')](_0x31359f));var _0x59f603=_0x31359f[0x0];if(_0x59f603){var _0x56bd5a={'action':_0x59f603[_0x2692('0x6c')][_0x2692('0x60')],'allRequiredParamsPresent':_0x59f603['queryResult'][_0x2692('0x6d')],'endConversation':_0x59f603[_0x2692('0x6c')]['diagnosticInfo']&&_0x59f603[_0x2692('0x6c')]['diagnosticInfo']['fields']?_0x59f603[_0x2692('0x6c')][_0x2692('0x6e')][_0x2692('0x6f')]['end_conversation'][_0x2692('0x70')]:![],'fulfillmentText':_0x59f603[_0x2692('0x6c')][_0x2692('0x71')],'intentName':_0x59f603['queryResult'][_0x2692('0x72')][_0x2692('0x59')],'intentDisplayName':_0x59f603[_0x2692('0x6c')][_0x2692('0x72')][_0x2692('0x73')],'isFallbackIntent':_0x59f603[_0x2692('0x6c')]['intent'][_0x2692('0x74')],'languageCode':_0x59f603['queryResult'][_0x2692('0x75')],'queryText':_0x59f603[_0x2692('0x6c')]['queryText'],'responseId':_0x59f603[_0x2692('0x76')],'score':_0x59f603[_0x2692('0x6c')][_0x2692('0x77')],'speech':_0x59f603['queryResult'][_0x2692('0x71')],'providerResponse':JSON[_0x2692('0x45')](_0x31359f)};return _0x56bd5a;}}});};exports[_0x2692('0x78')]=function(_0x8d206b,_0x26e864,_0xad176f,_0xe4f684){return tilde[_0x2692('0x4e')](_0x8d206b,_0x26e864,_0xad176f,_0xe4f684)[_0x2692('0x2d')](function(_0x4ed9de){try{fs['unlink'](_0x8d206b);}catch(_0x48fb08){logger[_0x2692('0x16')](_0x48fb08);}logger['info'](_0x2692('0x79'),_0x4ed9de[_0x2692('0x52')]);logger[_0x2692('0x1b')](_0x2692('0x7a'),_0x4ed9de[_0x2692('0x53')]);return _0x4ed9de;});};exports[_0x2692('0x7b')]=function(_0x585263,_0x1b0f51,_0x197229,_0x3923e0,_0x26eecf,_0x4650d1){var _0x466ac3=path['resolve'](__dirname,_0x2692('0x3d'),rs[_0x2692('0x29')](0x4)+_0x2692('0x3e'));var _0x4f3692;return aws[_0x2692('0x7c')](_0x585263,_0x1b0f51,_0x197229,_0x3923e0,_0x26eecf,_0x4650d1,_0x466ac3)[_0x2692('0x2d')](function(){_0x4f3692=path[_0x2692('0x28')](__dirname,'tmp',rs[_0x2692('0x29')](0x4)+_0x2692('0x2a'));return convertFile(_0x466ac3,_0x4f3692);})['then'](function(){try{fs[_0x2692('0x1e')](_0x466ac3);fs[_0x2692('0x2e')](_0x4f3692,_0x2692('0x2f'));}catch(_0x1f43a1){logger[_0x2692('0x16')](_0x1f43a1);}return _0x4f3692['split']('.')[0x0];});};exports[_0x2692('0x7d')]=function(_0x39097f,_0xe1e3b4,_0x1b8432,_0x516246,_0x483258,_0x119d01){return aws[_0x2692('0x7e')](_0x39097f,_0xe1e3b4,_0x1b8432,_0x516246,_0x483258,_0x119d01)['then'](function(_0x548dfe){logger[_0x2692('0x1b')](JSON[_0x2692('0x45')](_0x548dfe));return _0x548dfe;});};exports[_0x2692('0x7f')]=function(_0x3c09c3,_0x5d1a03,_0x15ece7,_0x211ccb){var _0x5f49a3=util[_0x2692('0x80')](_0x2692('0x81'),ISPEECH_API,_0x3c09c3,encodeURIComponent(_0x5d1a03),_0x15ece7,_0x211ccb);var _0x17a305=path[_0x2692('0x28')](__dirname,'tmp',rs[_0x2692('0x29')](0x4)+_0x2692('0x3e'));var _0x220c99;return downloadFile(_0x5f49a3,_0x17a305)[_0x2692('0x2d')](function(){_0x220c99=path[_0x2692('0x28')](__dirname,'tmp',rs[_0x2692('0x29')](0x4)+_0x2692('0x2a'));return convertFile(_0x17a305,_0x220c99);})['then'](function(){try{fs[_0x2692('0x1e')](_0x17a305);fs[_0x2692('0x2e')](_0x220c99,_0x2692('0x2f'));}catch(_0x34cc68){logger[_0x2692('0x16')](_0x34cc68);}return _0x220c99[_0x2692('0x30')]('.')[0x0];});};exports['ispeechASR']=function(_0x835d79,_0x34ea46,_0x5eb2ab,_0x35e380){var _0x131d16=util[_0x2692('0x80')](_0x2692('0x82'),ISPEECH_API,_0x34ea46,_0x5eb2ab,base64Encode(_0x835d79),_0x35e380?util[_0x2692('0x80')](_0x2692('0x83'),encodeURIComponent(_0x35e380)):_0x2692('0x84'));return uploadFile(_0x131d16)[_0x2692('0x2d')](function(_0x49d5c3){return querystring[_0x2692('0xb')](_0x49d5c3);});};exports['sestekNDA']=function(_0x35a635,_0x29236d){return sestek[_0x2692('0x85')](_0x35a635,_0x29236d)['then'](function(_0x373bda){logger[_0x2692('0x1b')](JSON[_0x2692('0x45')](_0x373bda));var _0x1e5a58={'speech':_0x373bda[_0x2692('0x86')],'action':_0x373bda[_0x2692('0x87')]?_0x373bda[_0x2692('0x87')]['CustomAction']:undefined,'actiondata':_0x373bda[_0x2692('0x87')]?_0x373bda['channelData'][_0x2692('0x88')]:undefined};if(_0x373bda[_0x2692('0x87')]&&_0x373bda[_0x2692('0x87')]['AudioFromTts']){return base64Decode(_0x373bda[_0x2692('0x87')][_0x2692('0x89')][_0x2692('0x8a')],path[_0x2692('0x28')](__dirname,_0x2692('0x3d'),rs[_0x2692('0x29')](0x4)+_0x2692('0x2a')))['then'](function(_0x10a621){_0x1e5a58['audiofile']=_0x10a621;return _0x1e5a58;});}return _0x1e5a58;});};exports['dirName']=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 87c2b88..5c6df60 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 _0x7c4e=['exports','./nda'];(function(_0xb6dd1d,_0x2007fa){var _0x4ccb1a=function(_0x21dc47){while(--_0x21dc47){_0xb6dd1d['push'](_0xb6dd1d['shift']());}};_0x4ccb1a(++_0x2007fa);}(_0x7c4e,0x127));var _0xe7c4=function(_0xf25303,_0x3a33c3){_0xf25303=_0xf25303-0x0;var _0x376168=_0x7c4e[_0xf25303];return _0x376168;};var nda=require(_0xe7c4('0x0'));module[_0xe7c4('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1858=['exports'];(function(_0x3b875b,_0x4ffa4f){var _0x36ddb3=function(_0xac8f48){while(--_0xac8f48){_0x3b875b['push'](_0x3b875b['shift']());}};_0x36ddb3(++_0x4ffa4f);}(_0x1858,0x104));var _0x8185=function(_0x3ef61a,_0x3c6073){_0x3ef61a=_0x3ef61a-0x0;var _0xbaae1d=_0x1858[_0x3ef61a];return _0xbaae1d;};var nda=require('./nda');module[_0x8185('0x0')]={'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 064631c..0941206 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 _0x6836=['request-promise','url','../../../../../config/logger','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','message','Nda','uniqueid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0x6836,0x1c0));var _0x6683=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6836[_0x164eca];return _0x2ce562;};'use strict';var rp=require(_0x6683('0x0'));var url=require(_0x6683('0x1'));var logger=require(_0x6683('0x2'))('agi');module[_0x6683('0x3')]=function(_0x4c1868,_0x1dd75d){var _0x52a75f={'method':_0x6683('0x4'),'uri':url['resolve'](_0x1dd75d[_0x6683('0x5')],_0x6683('0x6')),'form':{'grant_type':_0x6683('0x7'),'username':_0x1dd75d[_0x6683('0x8')],'password':_0x1dd75d['password']},'json':!![]};return rp(_0x52a75f)[_0x6683('0x9')](function(_0x2c7cb0){var _0x3d5224={'method':_0x6683('0x4'),'uri':url[_0x6683('0xa')](_0x1dd75d[_0x6683('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1dd75d['ndaactivity_type']||_0x6683('0xc'),'channelId':_0x6683('0xd'),'conversation':{'id':_0x4c1868[_0x6683('0xe')]},'from':{'id':_0x4c1868['callerid'],'name':_0x4c1868[_0x6683('0xf')]},'recipient':{'id':_0x4c1868['dnid'],'name':_0x4c1868[_0x6683('0x10')]},'text':_0x1dd75d[_0x6683('0x11')],'channelData':{}},'headers':{'Authorization':_0x6683('0x12')+_0x2c7cb0[_0x6683('0x13')]},'json':!![]};if(_0x1dd75d[_0x6683('0x14')]){_0x3d5224[_0x6683('0x15')][_0x6683('0x16')][_0x6683('0x17')]=_0x1dd75d['project'];}if(_0x1dd75d[_0x6683('0x18')]=='1'){_0x3d5224[_0x6683('0x15')][_0x6683('0x16')][_0x6683('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6683('0x1a')};}if(_0x1dd75d['custom_action']){_0x3d5224[_0x6683('0x15')][_0x6683('0x16')][_0x6683('0x1b')]=_0x1dd75d[_0x6683('0x1c')];if(_0x1dd75d[_0x6683('0x1d')]){_0x3d5224[_0x6683('0x15')][_0x6683('0x16')][_0x6683('0x1e')]=_0x1dd75d[_0x6683('0x1d')];}}logger[_0x6683('0x1f')](JSON['stringify'](_0x3d5224));return rp(_0x3d5224);});}; \ No newline at end of file +var _0x78f0=['ndagenerate_audio','AudioOutputSettings','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','callerid','calleridname','extension','text','Bearer\x20','access_token','channelData','ProjectName','project'];(function(_0x9664b9,_0x51d10e){var _0x420c36=function(_0x131a18){while(--_0x131a18){_0x9664b9['push'](_0x9664b9['shift']());}};_0x420c36(++_0x51d10e);}(_0x78f0,0x15d));var _0x078f=function(_0x473a6b,_0x48dcbf){_0x473a6b=_0x473a6b-0x0;var _0x4f53d0=_0x78f0[_0x473a6b];return _0x4f53d0;};'use strict';var rp=require(_0x078f('0x0'));var url=require(_0x078f('0x1'));var logger=require(_0x078f('0x2'))(_0x078f('0x3'));module[_0x078f('0x4')]=function(_0x2bde34,_0x34a715){var _0x316f1c={'method':'POST','uri':url[_0x078f('0x5')](_0x34a715[_0x078f('0x6')],_0x078f('0x7')),'form':{'grant_type':_0x078f('0x8'),'username':_0x34a715['username'],'password':_0x34a715[_0x078f('0x8')]},'json':!![]};return rp(_0x316f1c)[_0x078f('0x9')](function(_0x4a7db3){var _0x2ef013={'method':_0x078f('0xa'),'uri':url[_0x078f('0x5')](_0x34a715[_0x078f('0xb')],_0x078f('0xc')),'body':{'type':_0x34a715[_0x078f('0xd')]||_0x078f('0xe'),'channelId':_0x078f('0xf'),'conversation':{'id':_0x2bde34['uniqueid']},'from':{'id':_0x2bde34[_0x078f('0x10')],'name':_0x2bde34[_0x078f('0x11')]},'recipient':{'id':_0x2bde34['dnid'],'name':_0x2bde34[_0x078f('0x12')]},'text':_0x34a715[_0x078f('0x13')],'channelData':{}},'headers':{'Authorization':_0x078f('0x14')+_0x4a7db3[_0x078f('0x15')]},'json':!![]};if(_0x34a715['project']){_0x2ef013['body'][_0x078f('0x16')][_0x078f('0x17')]=_0x34a715[_0x078f('0x18')];}if(_0x34a715[_0x078f('0x19')]=='1'){_0x2ef013['body'][_0x078f('0x16')][_0x078f('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x34a715[_0x078f('0x1b')]){_0x2ef013[_0x078f('0x1c')][_0x078f('0x16')][_0x078f('0x1d')]=_0x34a715[_0x078f('0x1b')];if(_0x34a715[_0x078f('0x1e')]){_0x2ef013['body']['channelData'][_0x078f('0x1f')]=_0x34a715[_0x078f('0x1e')];}}logger[_0x078f('0x20')](JSON[_0x078f('0x21')](_0x2ef013));return rp(_0x2ef013);});}; \ 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 57d8818..f85c619 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x4c2e16,_0xf8df57,_0xd54a9c,_0x31b9d9){return asr(_0x4c2e16,_0xf8df57,_0xd54a9c,_0x31b9d9);}; \ No newline at end of file +var _0x56e9=['exports','./lib/api'];(function(_0x393f95,_0x47ccb2){var _0x1e4dac=function(_0x13efc8){while(--_0x13efc8){_0x393f95['push'](_0x393f95['shift']());}};_0x1e4dac(++_0x47ccb2);}(_0x56e9,0x123));var _0x956e=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x56e9[_0xff5df6];return _0x2634bb;};'use strict';var asr=require(_0x956e('0x0'));module[_0x956e('0x1')]=function(_0x81f34c,_0x2ad282,_0xd4b130,_0x222087){return asr(_0x81f34c,_0x2ad282,_0xd4b130,_0x222087);}; \ 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 9659662..878490d 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 _0x3ec6=['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','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses'];(function(_0x23ebd4,_0x2208a0){var _0x52818c=function(_0x35cc0a){while(--_0x35cc0a){_0x23ebd4['push'](_0x23ebd4['shift']());}};_0x52818c(++_0x2208a0);}(_0x3ec6,0x8c));var _0x63ec=function(_0x3242cf,_0x25b05b){_0x3242cf=_0x3242cf-0x0;var _0x442273=_0x3ec6[_0x3242cf];return _0x442273;};'use strict';var BPromise=require('bluebird');var _=require(_0x63ec('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x63ec('0x1'));var logger=require(_0x63ec('0x2'))('agi');module[_0x63ec('0x3')]=function(_0x5bdee7,_0x4deb53,_0x1a72cc,_0x59adf8){return new BPromise(function(_0x5c59ce,_0x1a272a){logger[_0x63ec('0x4')](_0x63ec('0x5'),_0x59adf8||_0x63ec('0x6'));var _0x289e27=new WebSocket(_0x59adf8||_0x63ec('0x6'),{'perMessageDeflate':![]});var _0x637ca7='';var _0x2df042='0';var _0x5be0f2='1';var _0x90bd93=_0x63ec('0x7');function _0x2649c1(_0x263d44){var _0xae4de7=crypto[_0x63ec('0x8')](_0x63ec('0x9'));_0xae4de7[_0x63ec('0xa')](_0x263d44);return _0xae4de7[_0x63ec('0xb')](_0x63ec('0xc'));}function _0x2fda3b(){try{logger[_0x63ec('0x4')](_0x63ec('0xd'));var _0x3becd7=moment()[_0x63ec('0xe')]();var _0x273d77=_0x2649c1(_0x3becd7+_0x4deb53+_0x1a72cc);_0x289e27[_0x63ec('0xf')](JSON[_0x63ec('0x10')]({'appID':_0x4deb53,'timestamp':_0x3becd7,'appKey':_0x273d77}));var _0x51cc46=fs[_0x63ec('0x11')](_0x5bdee7);_0x51cc46['on'](_0x63ec('0x12'),function(_0x4acf0e){_0x289e27[_0x63ec('0xf')](_0x4acf0e);});_0x51cc46['on'](_0x63ec('0x13'),function(){_0x289e27[_0x63ec('0xf')]('EOS');});}catch(_0x25245d){logger[_0x63ec('0x14')](_0x63ec('0x15'),JSON['stringify'](_0x25245d));_0x289e27[_0x63ec('0x16')]();}}function _0xe9cb3(_0xbab572){try{if(_0xbab572){var _0x116fd4=JSON[_0x63ec('0x17')](_0xbab572);switch(_0x116fd4['status']){case 0x0:if(_0x116fd4[_0x63ec('0x18')]){if(_0x116fd4['result'][_0x63ec('0x19')]){logger['info'](_0x63ec('0x1a'),JSON[_0x63ec('0x10')](_0x116fd4[_0x63ec('0x18')][_0x63ec('0x1b')]));_0x637ca7=_0x116fd4['result']['hypotheses'][0x0][_0x63ec('0x1c')];_0x2df042=_0x116fd4[_0x63ec('0x18')]['hypotheses'][0x0][_0x63ec('0x1d')];_0x5be0f2='0';_0x90bd93=_0x63ec('0x1e');_0x289e27['terminate']();}}break;case 0x1:logger[_0x63ec('0x4')](_0x63ec('0x7'));_0x5be0f2='1';_0x90bd93=_0x63ec('0x7');break;case 0x2:logger[_0x63ec('0x4')](_0x63ec('0x1f'));_0x5be0f2='2';_0x90bd93=_0x63ec('0x1f');break;case 0x9:logger[_0x63ec('0x4')](_0x63ec('0x20'));_0x5be0f2='9';_0x90bd93=_0x63ec('0x20');break;case 0xa:logger[_0x63ec('0x4')]('Authentication\x20failed.');_0x5be0f2='10';_0x90bd93=_0x63ec('0x21');break;case 0xb:logger[_0x63ec('0x4')](_0x63ec('0x22'));_0x5be0f2='11';_0x90bd93=_0x63ec('0x22');}}}catch(_0x3a8633){logger[_0x63ec('0x14')](_0x63ec('0x23'),JSON[_0x63ec('0x10')](_0x3a8633));_0x289e27['terminate']();}}function _0x3afbdf(){logger[_0x63ec('0x4')](_0x63ec('0x24'));_0x5c59ce({'transcript':_0x637ca7,'confidence':_0x2df042,'status':_0x5be0f2,'status_message':_0x90bd93});}function _0x4ba2c4(_0x56415e){logger[_0x63ec('0x14')](_0x63ec('0x25'));if(!_[_0x63ec('0x26')](_0x56415e)){logger[_0x63ec('0x14')](_[_0x63ec('0x27')](_0x56415e)?JSON[_0x63ec('0x10')](_0x56415e):_0x56415e);}}_0x289e27['on'](_0x63ec('0x28'),_0x2fda3b);_0x289e27['on'](_0x63ec('0x29'),_0xe9cb3);_0x289e27['on'](_0x63ec('0x13'),_0x3afbdf);_0x289e27['on'](_0x63ec('0x14'),_0x4ba2c4);});}; \ No newline at end of file +var _0x2927=['../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','moment'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x2927,0x1af));var _0x7292=function(_0x1ba703,_0x5de107){_0x1ba703=_0x1ba703-0x0;var _0x2ef233=_0x2927[_0x1ba703];return _0x2ef233;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7292('0x0'));var crypto=require('crypto');var logger=require(_0x7292('0x1'))(_0x7292('0x2'));module['exports']=function(_0x36dcaf,_0x2c8e6a,_0x367f4c,_0x5d6c45){return new BPromise(function(_0x5c2b2d,_0x5cde3a){logger[_0x7292('0x3')](_0x7292('0x4'),_0x5d6c45||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x48e782=new WebSocket(_0x5d6c45||_0x7292('0x5'),{'perMessageDeflate':![]});var _0x184ae6='';var _0x40bcf7='0';var _0x15dce0='1';var _0x5d3b45=_0x7292('0x6');function _0x1979b8(_0x48026e){var _0x37ace8=crypto[_0x7292('0x7')]('sha1');_0x37ace8['update'](_0x48026e);return _0x37ace8[_0x7292('0x8')](_0x7292('0x9'));}function _0x48c1ab(){try{logger[_0x7292('0x3')](_0x7292('0xa'));var _0x1636bf=moment()[_0x7292('0xb')]();var _0x1214bb=_0x1979b8(_0x1636bf+_0x2c8e6a+_0x367f4c);_0x48e782[_0x7292('0xc')](JSON['stringify']({'appID':_0x2c8e6a,'timestamp':_0x1636bf,'appKey':_0x1214bb}));var _0x5ac44e=fs[_0x7292('0xd')](_0x36dcaf);_0x5ac44e['on']('data',function(_0x9ce84c){_0x48e782[_0x7292('0xc')](_0x9ce84c);});_0x5ac44e['on'](_0x7292('0xe'),function(){_0x48e782[_0x7292('0xc')](_0x7292('0xf'));});}catch(_0x2e1983){logger[_0x7292('0x10')](_0x7292('0x11'),JSON[_0x7292('0x12')](_0x2e1983));_0x48e782[_0x7292('0x13')]();}}function _0x4bb371(_0x340443){try{if(_0x340443){var _0x5a8806=JSON['parse'](_0x340443);switch(_0x5a8806['status']){case 0x0:if(_0x5a8806[_0x7292('0x14')]){if(_0x5a8806[_0x7292('0x14')][_0x7292('0x15')]){logger['info'](_0x7292('0x16'),JSON[_0x7292('0x12')](_0x5a8806[_0x7292('0x14')]['hypotheses']));_0x184ae6=_0x5a8806[_0x7292('0x14')][_0x7292('0x17')][0x0][_0x7292('0x18')];_0x40bcf7=_0x5a8806['result'][_0x7292('0x17')][0x0][_0x7292('0x19')];_0x15dce0='0';_0x5d3b45='Success.';_0x48e782[_0x7292('0x13')]();}}break;case 0x1:logger[_0x7292('0x3')](_0x7292('0x6'));_0x15dce0='1';_0x5d3b45=_0x7292('0x6');break;case 0x2:logger['info'](_0x7292('0x1a'));_0x15dce0='2';_0x5d3b45=_0x7292('0x1a');break;case 0x9:logger[_0x7292('0x3')](_0x7292('0x1b'));_0x15dce0='9';_0x5d3b45=_0x7292('0x1b');break;case 0xa:logger['info'](_0x7292('0x1c'));_0x15dce0='10';_0x5d3b45=_0x7292('0x1c');break;case 0xb:logger[_0x7292('0x3')](_0x7292('0x1d'));_0x15dce0='11';_0x5d3b45=_0x7292('0x1d');}}}catch(_0x4d0c69){logger['error'](_0x7292('0x1e'),JSON[_0x7292('0x12')](_0x4d0c69));_0x48e782['terminate']();}}function _0x485ff4(){logger['info'](_0x7292('0x1f'));_0x5c2b2d({'transcript':_0x184ae6,'confidence':_0x40bcf7,'status':_0x15dce0,'status_message':_0x5d3b45});}function _0x2260ea(_0x391292){logger[_0x7292('0x10')](_0x7292('0x20'));if(!_[_0x7292('0x21')](_0x391292)){logger['error'](_[_0x7292('0x22')](_0x391292)?JSON[_0x7292('0x12')](_0x391292):_0x391292);}}_0x48e782['on'](_0x7292('0x23'),_0x48c1ab);_0x48e782['on']('message',_0x4bb371);_0x48e782['on'](_0x7292('0xe'),_0x485ff4);_0x48e782['on']('error',_0x2260ea);});}; \ 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 49d0d53..6d39faa 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 _0x1763=['./asr'];(function(_0x1b489f,_0xbe7814){var _0x4cdc4e=function(_0x3d8aca){while(--_0x3d8aca){_0x1b489f['push'](_0x1b489f['shift']());}};_0x4cdc4e(++_0xbe7814);}(_0x1763,0x125));var _0x3176=function(_0x4c94d1,_0x573a4f){_0x4c94d1=_0x4c94d1-0x0;var _0x48c2c3=_0x1763[_0x4c94d1];return _0x48c2c3;};var asr=require(_0x3176('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9d86=['./asr'];(function(_0xfd7c1e,_0x5eb3a4){var _0x10498d=function(_0x695a34){while(--_0x695a34){_0xfd7c1e['push'](_0xfd7c1e['shift']());}};_0x10498d(++_0x5eb3a4);}(_0x9d86,0xfb));var _0x69d8=function(_0x37836f,_0x1bed41){_0x37836f=_0x37836f-0x0;var _0x3c38bd=_0x9d86[_0x37836f];return _0x3c38bd;};var asr=require(_0x69d8('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index bff80fe..030abe0 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xe706,0xa3));var _0x6e70=function(_0x22bee0,_0x412ecb){_0x22bee0=_0x22bee0-0x0;var _0x2d295b=_0xe706[_0x22bee0];return _0x2d295b;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _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(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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 f3ffd58..39e02a3 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 _0x6737=['speech','out','Dialogflow\x20is\x20unreachable','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','response','test','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','gotoiftime','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','success','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','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','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','randomstring','moment','mustache','request-promise','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','channel','mailRpc','prototype','getVariable','rpc','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','POST','PUT','method','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','dialogflow_language','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_text_type','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','replaceAll','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','options','MRCPSynth','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','getAndSetVariable','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','custom_app','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','query','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6737,0xe2));var _0x7673=function(_0x1661d6,_0x23bd39){_0x1661d6=_0x1661d6-0x0;var _0x480ab0=_0x6737[_0x1661d6];return _0x480ab0;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x7673('0x0'));var sh=require(_0x7673('0x1'));var odbc=require('odbc')();var rs=require(_0x7673('0x2'));var moment=require(_0x7673('0x3'));var Mustache=require(_0x7673('0x4'));var rp=require(_0x7673('0x5'));var logger=require('../../config/logger')(_0x7673('0x6'));var config=require(_0x7673('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x7673('0x8');var recursiveMapAttributes=[_0x7673('0x9'),'rawBody'];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x285c6d,_0x5bede8,_0x3b3184){this[_0x7673('0xa')]=_0x285c6d;this['rpc']=_0x5bede8;this[_0x7673('0xb')]=_0x3b3184;};AGIVertices[_0x7673('0xc')][_0x7673('0xd')]=function(_0x4d40ce,_0x49fcb2){this[_0x7673('0xe')]['getVariableById'](_0x4d40ce)[_0x7673('0xf')](function(_0x8b5b80){_0x49fcb2(null,_0x8b5b80?_0x8b5b80[_0x7673('0x10')]:![]);})[_0x7673('0x11')](function(_0x41d6bd){_0x49fcb2(_0x41d6bd);});};AGIVertices[_0x7673('0xc')][_0x7673('0x12')]=function(_0x457ffe,_0x1da115){this[_0x7673('0xe')]['getVoiceQueueById'](_0x457ffe)[_0x7673('0xf')](function(_0x4738bd){_0x1da115(null,_0x4738bd?_0x4738bd[_0x7673('0x10')]:![]);})[_0x7673('0x11')](function(_0x224cea){_0x1da115(_0x224cea);});};AGIVertices[_0x7673('0xc')][_0x7673('0x13')]=function(_0x4a8ea0,_0x5ed354){this[_0x7673('0xe')][_0x7673('0x14')](_0x4a8ea0)['then'](function(_0x3afbb3){_0x5ed354(null,_0x3afbb3?_0x3afbb3[_0x7673('0x10')]:![]);})['catch'](function(_0x33ff7d){_0x5ed354(_0x33ff7d);});};AGIVertices[_0x7673('0xc')][_0x7673('0x15')]=function(_0x4b981b,_0x50f22d){this[_0x7673('0xe')][_0x7673('0x16')](_0x4b981b)['then'](function(_0x17c564){_0x50f22d(null,_0x17c564?_0x17c564[_0x7673('0x17')]:![]);})[_0x7673('0x11')](function(_0x33eb47){_0x50f22d(_0x33eb47);});};AGIVertices[_0x7673('0xc')][_0x7673('0x18')]=function(_0x59879a,_0x557161){this[_0x7673('0xe')][_0x7673('0x19')](_0x59879a)[_0x7673('0xf')](function(_0x345277){_0x557161(null,_0x345277?_0x345277[_0x7673('0x10')]:![]);})['catch'](function(_0x2009e1){_0x557161(_0x2009e1);});};AGIVertices[_0x7673('0xc')][_0x7673('0x1a')]=function(_0x2a8abf,_0x132dc6){this[_0x7673('0xe')]['getTrunkById'](_0x2a8abf)[_0x7673('0xf')](function(_0xaca974){_0x132dc6(null,_0xaca974?_0xaca974[_0x7673('0x10')]:![]);})[_0x7673('0x11')](function(_0x5a98fe){_0x132dc6(_0x5a98fe);});};AGIVertices['prototype'][_0x7673('0x1b')]=function(_0x11b42b,_0x291d10){var _0x9d9eab=this;this[_0x7673('0xe')][_0x7673('0x1c')](_0x11b42b)[_0x7673('0xf')](function(_0x5a59f9){_0x291d10(null,_0x5a59f9?_0x9d9eab['getSoundPath'](_0x5a59f9[_0x7673('0x1d')]):![]);})[_0x7673('0x11')](function(_0x1dd436){_0x291d10(_0x1dd436);});};AGIVertices[_0x7673('0xc')][_0x7673('0x1e')]=function(_0x3aaf6b,_0x224122){this['rpc']['getMailAccountById'](_0x3aaf6b)[_0x7673('0xf')](function(_0x36c841){_0x224122(null,_0x36c841?_0x36c841:![]);})[_0x7673('0x11')](function(_0xf5097a){_0x224122(_0xf5097a);});};AGIVertices['prototype'][_0x7673('0x1f')]=function(_0x497760,_0x15f6a7,_0x139717){this[_0x7673('0xb')][_0x7673('0x1f')](_0x497760,_0x15f6a7)[_0x7673('0xf')](function(){_0x139717(null);})[_0x7673('0x11')](function(_0x2cb973){_0x139717(_0x2cb973);});};AGIVertices[_0x7673('0xc')][_0x7673('0x20')]=function(_0x1b6061,_0x16681f){this[_0x7673('0xe')][_0x7673('0x21')](_0x1b6061)['then'](function(_0x32ee3d){if(_0x32ee3d){if(_0x32ee3d[_0x7673('0x22')]){_0x16681f(null,[_0x32ee3d[_0x7673('0x23')]]);}else{_0x16681f(null,_[_0x7673('0x24')](_0x32ee3d[_0x7673('0x25')],_0x7673('0x23')));}}else{_0x16681f(null,![]);}})[_0x7673('0x11')](function(_0x5736c0){_0x16681f(_0x5736c0);});};AGIVertices['prototype'][_0x7673('0x26')]=function(_0x32666c){return util[_0x7673('0x27')](_0x7673('0x28'),FILES_PATH,_0x32666c);};AGIVertices[_0x7673('0xc')][_0x7673('0x29')]=function(_0x159afd,_0x47c9a3,_0x2845f6){odbc[_0x7673('0x2a')](_0x159afd,function(_0x59905c){if(_0x59905c){logger[_0x7673('0x2b')](_0x7673('0x2c'),_0x59905c);_0x2845f6(_0x59905c);}else{logger[_0x7673('0x2d')](_0x7673('0x2e'));odbc['query'](_0x47c9a3,function(_0xcfd76e,_0x1f77c0){if(_0xcfd76e){logger['info'](_0x7673('0x2f'),_0x47c9a3);_0x2845f6(_0xcfd76e);}else{logger[_0x7673('0x2d')](_0x7673('0x30'),_0x47c9a3);odbc['close'](function(_0xe50aa5){if(_0xe50aa5){logger[_0x7673('0x2b')](_0x7673('0x31'),_0xe50aa5);}_0x2845f6(null,_0x1f77c0);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x13ce30,_0x5efdf6){this['rpc'][_0x7673('0x32')](_0x13ce30)[_0x7673('0xf')](function(_0x58b9b1){_0x5efdf6(null,_0x58b9b1?_0x58b9b1:![]);})[_0x7673('0x11')](function(_0x2926a3){_0x5efdf6(_0x2926a3);});};AGIVertices[_0x7673('0xc')][_0x7673('0x33')]=function(_0x12b84d,_0x2466b8){this['rpc'][_0x7673('0x33')](_0x12b84d)['then'](function(_0xf43bb7){_0x2466b8(null,_0xf43bb7);})['catch'](function(_0x76b90a){_0x2466b8(_0x76b90a);});};AGIVertices[_0x7673('0xc')]['createSquareDetailsReport']=function(_0x5b2e69,_0x1cac93,_0x503412){this[_0x7673('0xe')][_0x7673('0x34')]({'uniqueid':this[_0x7673('0xa')][_0x7673('0x35')],'node':_0x5b2e69[_0x7673('0x36')],'application':_0x5b2e69['agicommand'],'data':_0x1cac93||null,'project_name':this['channel'][_0x7673('0x37')],'callerid':this[_0x7673('0xa')]['callerid']})[_0x7673('0xf')](function(_0xb10099){if(_0x503412){_0x503412(null,_0xb10099);}})[_0x7673('0x11')](function(_0x5991d7){if(_0x503412){_0x503412(_0x5991d7);}});};AGIVertices[_0x7673('0xc')][_0x7673('0x38')]=function(_0x46ecbb,_0x229c13,_0xbdd0e5,_0x138e68){this[_0x7673('0xe')][_0x7673('0x38')]({'uniqueid':this[_0x7673('0xa')]['uniqueid'],'callerid':this[_0x7673('0xa')][_0x7673('0x39')],'calleridname':this[_0x7673('0xa')][_0x7673('0x3a')],'context':this[_0x7673('0xa')][_0x7673('0x3b')],'extension':this[_0x7673('0xa')]['extension'],'priority':this[_0x7673('0xa')][_0x7673('0x3c')],'accountcode':this[_0x7673('0xa')][_0x7673('0x3d')],'dnid':this[_0x7673('0xa')]['dnid'],'projectName':this[_0x7673('0xa')][_0x7673('0x37')],'saveName':_0x229c13,'filename':_0x46ecbb[_0x7673('0x3e')]||_0x229c13,'savePath':_0xbdd0e5})[_0x7673('0xf')](function(_0x3f76a3){_0x138e68(null,_0x3f76a3);})['catch'](function(_0x56cd7a){_0x138e68(_0x56cd7a);});};AGIVertices[_0x7673('0xc')][_0x7673('0x3f')]=function(_0x510960,_0x2314e7,_0x2a841b,_0x76ee09,_0x32a5e7){this[_0x7673('0xe')]['createSquareMessage']({'uniqueid':this[_0x7673('0xa')][_0x7673('0x35')],'body':_0x510960,'direction':_0x2314e7,'providerName':_0x2a841b,'providerResponse':_0x76ee09})[_0x7673('0xf')](function(_0x3e802d){if(_0x32a5e7){_0x32a5e7(null,_0x3e802d);}})['catch'](function(_0x1691a5){if(_0x32a5e7){_0x32a5e7(_0x1691a5);}});};AGIVertices[_0x7673('0xc')][_0x7673('0x40')]=function(_0xa93124,_0x228053){this[_0x7673('0xe')][_0x7673('0x40')]({'firstName':_[_0x7673('0x41')](_0xa93124[_0x7673('0x10')])||_[_0x7673('0x42')](_0xa93124[_0x7673('0x10')])?'callback_'+Math[_0x7673('0x43')]():_0xa93124['name'],'lastName':_[_0x7673('0x41')](_0xa93124[_0x7673('0x44')])||_[_0x7673('0x42')](_0xa93124['lastName'])?null:_0xa93124[_0x7673('0x44')],'phone':_0xa93124[_0x7673('0x45')],'ListId':_0xa93124[_0x7673('0x46')],'scheduledat':_0xa93124[_0x7673('0x47')],'callbackUniqueid':this[_0x7673('0xa')][_0x7673('0x35')],'tags':_0x7673('0x48'),'description':_0x7673('0x49')+_0xa93124[_0x7673('0x47')][_0x7673('0x4a')](),'priority':_0xa93124[_0x7673('0x4b')]})[_0x7673('0xf')](function(_0x9be9a4){_0x228053(null,_0x9be9a4);})[_0x7673('0x11')](function(_0x59bcf3){_0x228053(_0x59bcf3);});};AGIVertices[_0x7673('0xc')]['getPause']=function(_0x2f25cc,_0x268ed3){this[_0x7673('0xe')]['getPauseById'](_0x2f25cc)[_0x7673('0xf')](function(_0x5d71b7){_0x268ed3(null,_0x5d71b7?_0x5d71b7['name']:![]);})[_0x7673('0x11')](function(_0x5bbfdd){_0x268ed3(_0x5bbfdd);});};AGIVertices['prototype'][_0x7673('0x4c')]=function(_0x3f6ef3,_0x215a32,_0xeaa731){var _0x10bc98={'role':_0x7673('0x4d')};_0x10bc98[_0x3f6ef3]=this[_0x7673('0xa')][_0x7673('0x39')];this[_0x7673('0xe')][_0x7673('0x4c')](_0x10bc98,_0x215a32,this[_0x7673('0xa')]['uniqueid'])['then'](function(_0x2aa032){_0xeaa731(null,_[_0x7673('0x42')](_0x2aa032)?![]:!![]);})[_0x7673('0x11')](function(_0x204e02){logger[_0x7673('0x2b')](_0x204e02);_0xeaa731(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x44fa26,_0x7ac2d){var _0x1cd46c={'role':_0x7673('0x4d')};_0x1cd46c[_0x44fa26]=this[_0x7673('0xa')]['callerid'];this[_0x7673('0xe')][_0x7673('0x4e')](_0x1cd46c)[_0x7673('0xf')](function(_0x5d121e){_0x7ac2d(null,_[_0x7673('0x42')](_0x5d121e)?![]:!![]);})['catch'](function(_0x1240f9){logger[_0x7673('0x2b')](_0x1240f9);_0x7ac2d(null,![]);});};AGIVertices[_0x7673('0xc')]['agentLogout']=function(_0x278612,_0x20fb33){var _0x562a20={'role':'agent'};_0x562a20[_0x278612]=this['channel'][_0x7673('0x39')];this[_0x7673('0xe')][_0x7673('0x4f')](_0x562a20)[_0x7673('0xf')](function(_0x585989){_0x20fb33(null,_[_0x7673('0x42')](_0x585989)?![]:!![]);})['catch'](function(_0x94bd14){logger[_0x7673('0x2b')](_0x94bd14);_0x20fb33(null,![]);});};AGIVertices[_0x7673('0xc')][_0x7673('0x50')]=function(_0x5abb12,_0x2027b8){var _0x3a2e09={'role':_0x7673('0x4d')};_0x3a2e09[_0x5abb12]=this['channel']['callerid'];var _0x2d21f2=_0x5abb12!=_0x7673('0x51')?util[_0x7673('0x27')](_0x7673('0x52'),_0x7673('0x53'),this['channel'][_0x7673('0x39')]):undefined;this[_0x7673('0xe')]['agentLogin'](_0x3a2e09,_0x2d21f2)['then'](function(_0x4a6ef8){_0x2027b8(null,_[_0x7673('0x42')](_0x4a6ef8)?![]:!![]);})[_0x7673('0x11')](function(_0x56d4cf){logger[_0x7673('0x2b')](_0x56d4cf);_0x2027b8(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x355d27,_0x3f00d0){sh[_0x7673('0x54')](_[_0x7673('0x55')](_0x355d27),function(_0x4a0af5,_0x104704){var _0x4d626e=_0x104704[_0x7673('0x56')](/(\r\n|\n|\r)/gm,'');_0x3f00d0(null,_0x4d626e);});};AGIVertices[_0x7673('0xc')][_0x7673('0x57')]=function(_0x3a12e7,_0xcfbf4){scripts[_0x7673('0x57')](_0x3a12e7[_0x7673('0x58')],_0x3a12e7['google_cloud_tts_text_type']||'text',_0x3a12e7[_0x7673('0x59')],_0x3a12e7[_0x7673('0x5a')]||_0x7673('0x5b'),_0x3a12e7[_0x7673('0x5c')]||'MALE',_0x3a12e7[_0x7673('0x5d')]||_0x7673('0x5e'))[_0x7673('0xf')](function(_0x867245){_0xcfbf4(null,_0x867245);})[_0x7673('0x11')](function(_0x4ef0f8){_0xcfbf4(_0x4ef0f8);});};AGIVertices[_0x7673('0xc')][_0x7673('0x5f')]=function(_0xe587bf,_0x4f35a3){scripts[_0x7673('0x5f')](_0xe587bf[_0x7673('0x59')],_0xe587bf[_0x7673('0x60')]||'en',0x1)[_0x7673('0xf')](function(_0x23521d){_0x4f35a3(null,_0x23521d);})[_0x7673('0x11')](function(_0x5f38ae){_0x4f35a3(_0x5f38ae);});};AGIVertices[_0x7673('0xc')][_0x7673('0x61')]=function(_0xc6660d,_0x413d2a){var _0x1a32e3={'uri':_0xc6660d[_0x7673('0x62')],'method':_0xc6660d['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xc6660d[_0x7673('0x63')])===_0x7673('0x64')&&parseInt(_0xc6660d[_0x7673('0x63')])>=0x1?parseInt(_0xc6660d[_0x7673('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7673('0x65'),_0x7673('0x66')],_0x1a32e3[_0x7673('0x67')][_0x7673('0x68')]())){try{_0x1a32e3[_0x7673('0x69')]=_0xc6660d[_0x7673('0x6a')]?JSON[_0x7673('0x6b')](_0xc6660d[_0x7673('0x6a')]):{};}catch(_0x20ba4a){logger[_0x7673('0x2b')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x20ba4a);}}try{_0x1a32e3['headers']=_0xc6660d[_0x7673('0x9')]?JSON[_0x7673('0x6b')](_0xc6660d[_0x7673('0x9')]):{};}catch(_0x49c80d){logger[_0x7673('0x2b')](_0x7673('0x6c'),_0x49c80d);}if(_0xc6660d[_0x7673('0x6d')]){try{var _0x4d353a=require(_0xc6660d[_0x7673('0x6d')])['sync'](this,_0x1a32e3);_0x1a32e3[_0x7673('0x6e')]=Mustache[_0x7673('0x6f')](_0xc6660d['url'],_0x4d353a,{},['$$','$$']);if(_0x1a32e3['headers']){_0x1a32e3[_0x7673('0x70')]=JSON[_0x7673('0x6b')](Mustache['render'](JSON['stringify'](_0x1a32e3[_0x7673('0x70')]),_0x4d353a,{},['$$','$$']));}if(_0x1a32e3['body']){_0x1a32e3[_0x7673('0x69')]=JSON[_0x7673('0x6b')](Mustache[_0x7673('0x6f')](JSON[_0x7673('0x71')](_0x1a32e3[_0x7673('0x69')]),_0x4d353a,{},['$$','$$']));}}catch(_0x3c82d3){logger[_0x7673('0x2b')](_0x7673('0x72'),_0x3c82d3);}}rp(_0x1a32e3)[_0x7673('0xf')](function(_0x506fdf){var _0xf324d9={'statusCode':_0x506fdf[_0x7673('0x73')]||0xc8,'statusMessage':_0x506fdf[_0x7673('0x74')]||'OK','headers':_0x506fdf['headers']||{},'body':_0x506fdf[_0x7673('0x69')]||{}};_0x413d2a(null,_0xf324d9);})[_0x7673('0x11')](function(_0x460aab){var _0x15b19c={'statusCode':_0x460aab[_0x7673('0x73')]||0x1f4,'statusMessage':_0x460aab[_0x7673('0x75')]||_0x7673('0x76'),'headers':_0x460aab['options'][_0x7673('0x70')]||{},'body':_0x460aab['options'][_0x7673('0x69')]||{}};_0x413d2a(null,_0x15b19c);});};AGIVertices[_0x7673('0xc')][_0x7673('0x77')]=function(_0x3a7767,_0x4ed050){scripts[_0x7673('0x77')](this[_0x7673('0xa')][_0x7673('0x35')],_0x3a7767['key'],_0x3a7767[_0x7673('0x59')],_0x3a7767[_0x7673('0x78')]||'en')[_0x7673('0xf')](function(_0x3a50f4){_0x4ed050(null,_0x3a50f4);})['catch'](function(_0x78baa2){_0x4ed050(_0x78baa2);});};AGIVertices[_0x7673('0xc')]['googleDialogflowV2']=function(_0x2d3583,_0x332c63){scripts['googleDialogflowV2'](this[_0x7673('0xa')]['uniqueid'],_0x2d3583[_0x7673('0x79')],_0x2d3583['client_email'],_0x2d3583[_0x7673('0x7a')],_0x2d3583[_0x7673('0x59')],_0x2d3583[_0x7673('0x7b')]||'en')[_0x7673('0xf')](function(_0x331971){_0x332c63(null,_0x331971);})[_0x7673('0x11')](function(_0x1b49fd){_0x332c63(_0x1b49fd);});};AGIVertices[_0x7673('0xc')]['sestekNDA']=function(_0x555ce3,_0x39901d){scripts[_0x7673('0x7c')](this[_0x7673('0xa')],_0x555ce3)[_0x7673('0xf')](function(_0x5304a4){_0x39901d(null,_0x5304a4);})[_0x7673('0x11')](function(_0x3834ad){_0x39901d(_0x3834ad);});};AGIVertices[_0x7673('0xc')][_0x7673('0x7d')]=function(_0x307617,_0x461cc8){scripts['ispeechTTS'](_0x307617[_0x7673('0x7e')],_0x307617['text'],_0x307617[_0x7673('0x7f')]||_0x7673('0x5b'),_0x307617[_0x7673('0x80')])[_0x7673('0xf')](function(_0x3811b7){_0x461cc8(null,_0x3811b7);})[_0x7673('0x11')](function(_0x2c2e96){_0x461cc8(_0x2c2e96);});};AGIVertices[_0x7673('0xc')][_0x7673('0x81')]=function(_0x16c6c7,_0x40e283,_0x2c90ab){scripts[_0x7673('0x81')](_0x40e283,_0x16c6c7['key'],_0x16c6c7[_0x7673('0x82')]||'en-US',this[_0x7673('0x83')](_0x16c6c7['model'])?_0x16c6c7[_0x7673('0x84')]:undefined)[_0x7673('0xf')](function(_0x3eb426){_0x2c90ab(null,_0x3eb426);})[_0x7673('0x11')](function(_0x1f0a18){_0x2c90ab(_0x1f0a18);});};AGIVertices[_0x7673('0xc')][_0x7673('0x85')]=function(_0x19c25f,_0x31e8c0){scripts[_0x7673('0x85')](_0x19c25f['aws_access_key_id'],_0x19c25f['aws_secret_access_key'],_0x19c25f[_0x7673('0x86')],_0x19c25f['aws_polly_voice']||'Amy',_0x19c25f[_0x7673('0x59')],_0x19c25f[_0x7673('0x87')]||_0x7673('0x59'))['then'](function(_0xe467db){_0x31e8c0(null,_0xe467db);})['catch'](function(_0x419747){_0x31e8c0(_0x419747);});};AGIVertices['prototype'][_0x7673('0x88')]=function(_0x116de3,_0x15f311){scripts['awsLex'](this[_0x7673('0xa')]['uniqueid'],_0x116de3[_0x7673('0x89')],_0x116de3[_0x7673('0x8a')],_0x116de3[_0x7673('0x8b')],_0x116de3[_0x7673('0x59')],_0x116de3[_0x7673('0x8c')])[_0x7673('0xf')](function(_0x179610){_0x15f311(null,_0x179610);})[_0x7673('0x11')](function(_0x3c19ab){_0x15f311(_0x3c19ab);});};AGIVertices['prototype']['googleASR']=function(_0x29632b,_0x26a42a,_0x54de2f){scripts[_0x7673('0x8d')](_0x26a42a,_0x29632b[_0x7673('0x7e')],_0x29632b[_0x7673('0x8e')]||_0x7673('0x5b'))[_0x7673('0xf')](function(_0x336f4e){_0x54de2f(null,_0x336f4e);})[_0x7673('0x11')](function(_0x420e2d){_0x54de2f(_0x420e2d);});};AGIVertices['prototype'][_0x7673('0x8f')]=function(_0x21b7ad,_0x28171b,_0x593182){scripts[_0x7673('0x8f')](_0x28171b,_0x21b7ad[_0x7673('0x90')],_0x21b7ad[_0x7673('0x91')],_0x21b7ad[_0x7673('0x6e')])[_0x7673('0xf')](function(_0x42dc55){_0x593182(null,_0x42dc55);})[_0x7673('0x11')](function(_0x4dee4a){_0x593182(_0x4dee4a);});};AGIVertices[_0x7673('0xc')]['clear']=function(_0x1570b6){var _0x42aa1a=_[_0x7673('0x92')](verticesWithRetry,_0x1570b6['agicommand'])?_0x1570b6:_['clone'](_0x1570b6);for(var _0x1543ac in _0x42aa1a){if(_0x42aa1a['hasOwnProperty'](_0x1543ac)){if(_0x42aa1a[_0x1543ac]&&_[_0x7673('0x93')](_0x42aa1a[_0x1543ac])){if(_[_0x7673('0x92')](recursiveMapAttributes,_0x1543ac)){_0x42aa1a[_0x1543ac]=this[_0x7673('0x94')](_0x42aa1a[_0x1543ac]);}else{_0x42aa1a[_0x1543ac]=this[_0x7673('0x95')](_0x42aa1a[_0x1543ac]);}}}}return _0x42aa1a;};AGIVertices[_0x7673('0xc')][_0x7673('0x96')]=function(_0x4b7faf){for(var _0x264a94 in _0x4b7faf){if(_0x4b7faf[_0x7673('0x97')](_0x264a94)){if(_[_0x7673('0x98')](_0x4b7faf[_0x264a94])){this[_0x7673('0x96')](_0x4b7faf[_0x264a94]);}else if(_[_0x7673('0x99')](_0x4b7faf[_0x264a94])){for(var _0x106f4b=0x0;_0x106f4b<_0x4b7faf[_0x264a94][_0x7673('0x9a')];_0x106f4b++){this[_0x7673('0x96')](_0x4b7faf[_0x264a94][_0x106f4b]);}}else if(_['isString'](_0x4b7faf[_0x264a94])){_0x4b7faf[_0x264a94]=this[_0x7673('0x95')](_0x4b7faf[_0x264a94]);}}}};AGIVertices[_0x7673('0xc')]['saveRestApiResult']=function(_0x3a4be1,_0x5297f0){for(var _0x47cb89 in _0x3a4be1){if(_0x3a4be1[_0x7673('0x97')](_0x47cb89)){if(_['isPlainObject'](_0x3a4be1[_0x47cb89])){if(!_[_0x7673('0x41')](_0x3a4be1[_0x47cb89])){this[_0x7673('0x9b')](_0x3a4be1[_0x47cb89],util[_0x7673('0x27')](_0x7673('0x9c'),_0x5297f0,_0x47cb89));}}else if(_[_0x7673('0x99')](_0x3a4be1[_0x47cb89])){for(var _0x1edb9b=0x0;_0x1edb9b<_0x3a4be1[_0x47cb89][_0x7673('0x9a')];_0x1edb9b++){this[_0x7673('0x9b')](_0x3a4be1[_0x47cb89][_0x1edb9b],util[_0x7673('0x27')](_0x7673('0x9c'),_0x5297f0,_0x47cb89+'['+_0x1edb9b+']'));}}else{if(!_[_0x7673('0x42')](_0x3a4be1[_0x47cb89])){this[_0x7673('0xa')]['setVariable'](util[_0x7673('0x27')](_0x7673('0x9c'),_0x5297f0,_0x47cb89),_0x3a4be1[_0x47cb89]);}}}}};AGIVertices[_0x7673('0xc')]['replaceObjectAllVariables']=function(_0x28722b){try{var _0x3e49ef=JSON[_0x7673('0x6b')](_0x28722b);this[_0x7673('0x96')](_0x3e49ef);return JSON['stringify'](_0x3e49ef);}catch(_0x5c2bc4){return this['replaceAllVariables'](_0x28722b);}};AGIVertices[_0x7673('0xc')]['replaceAllVariables']=function(_0x229285){var _0x445824=_0x229285[_0x7673('0x9d')]('{');for(var _0x590f91=0x1;_0x590f91<_0x445824[_0x7673('0x9a')];_0x590f91+=0x1){var _0xdf47bd=_0x445824[_0x590f91][_0x7673('0x9d')]('}');if(_0xdf47bd[_0x7673('0x9a')]>0x1){_0x229285=_0x229285[_0x7673('0x9e')]('{'+_0xdf47bd[0x0]+'}',this[_0x7673('0xa')][_0x7673('0xd')](_0xdf47bd[0x0])[_0x7673('0x9f')]||_0xdf47bd[0x0]);}}if(_0x445824[_0x7673('0x9a')]===0x1){return _0x229285[_0x7673('0x4a')]();}return this[_0x7673('0x95')](_0x229285);};AGIVertices[_0x7673('0xc')]['getAndSetVariable']=function(_0x566654,_0x58c661){var _0x506e23=this[_0x7673('0xa')][_0x7673('0xd')](_0x566654);if(_0x506e23['result']===-0x1){return _0x506e23;}logger['info'](util['format'](_0x7673('0xa0'),_0x58c661,_0x506e23[_0x7673('0x9f')]));return this[_0x7673('0xa')][_0x7673('0xa1')](_0x58c661,_0x506e23[_0x7673('0x9f')]);};AGIVertices['prototype'][_0x7673('0x83')]=function(_0x4eea90){return _0x4eea90&&_0x4eea90!=='0'&&_0x4eea90!=='-1'&&_0x4eea90!=='';};AGIVertices[_0x7673('0xc')][_0x7673('0xa2')]=function(_0x4aac13){this['createSquareDetailsReport'][_0x7673('0xa3')](this,_0x4aac13,'-');_0x4aac13[_0x7673('0xa4')]=_0x4aac13[_0x7673('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7673('0xc')][_0x7673('0xa5')]=function(_0x3111e7){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xa6'),_0x3111e7[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x3111e7['text'])){return this['channel'][_0x7673('0xa7')](_0x7673('0xa8'));}var _0x2ae811='\x22'+_0x3111e7[_0x7673('0x59')]+'\x22';if(this[_0x7673('0x83')](_0x3111e7['options'])){_0x2ae811+=','+_0x3111e7[_0x7673('0xa9')];}var _0x3d58ac=this[_0x7673('0xa')][_0x7673('0x54')](_0x7673('0xaa'),_0x2ae811);if(_0x3d58ac[_0x7673('0xab')]===-0x1){return _0x3d58ac;}return this['channel'][_0x7673('0xa7')](util['format'](_0x7673('0xac'),_0x2ae811));};AGIVertices[_0x7673('0xc')][_0x7673('0xad')]=function(_0x57da03){logger['info'](util['format'](_0x7673('0xae'),_0x57da03[_0x7673('0x36')]));if(!this['isConfigured'](_0x57da03[_0x7673('0xaf')])){return this['channel'][_0x7673('0xa7')]('no\x20grammar\x20configured');}var _0x22c572=_0x57da03[_0x7673('0xaf')];if(this[_0x7673('0x83')](_0x57da03[_0x7673('0xa9')])){_0x22c572+=','+_0x57da03['options'];}var _0x1e2da6=this[_0x7673('0xa')][_0x7673('0x54')]('MRCPRecog',_0x22c572);if(_0x1e2da6['result']===-0x1){return _0x1e2da6;}var _0x184859=this[_0x7673('0xb0')]('RECOG_CONFIDENCE()',_0x7673('0xb1'));if(_0x184859['result']===-0x1){return _0x184859;}var _0x94d51d=this['getAndSetVariable']('RECOG_INPUT()',_0x7673('0xb2'));if(_0x94d51d[_0x7673('0xab')]===-0x1){return _0x94d51d;}var _0x5bec1a=this[_0x7673('0xb0')]('RECOG_INSTANCE()',_0x7673('0xb3'));if(_0x5bec1a[_0x7673('0xab')]===-0x1){return _0x5bec1a;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xb4'),_0x22c572));};AGIVertices[_0x7673('0xc')]['agi']=function(_0x2b24b1){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xb5'),_0x2b24b1['label']));return this[_0x7673('0xa')][_0x7673('0x6')]([_0x2b24b1[_0x7673('0xb6')],_0x2b24b1['args']]);};AGIVertices[_0x7673('0xc')][_0x7673('0xb7')]=function(_0x2f3ae9){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xb8'),_0x2f3ae9[_0x7673('0x36')]));if(this[_0x7673('0x83')](_0x2f3ae9[_0x7673('0x63')])){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xb9'),_0x2f3ae9['timeout']));var _0x3ff143=this[_0x7673('0xa')][_0x7673('0xba')](_0x2f3ae9[_0x7673('0x63')]);if(_0x3ff143[_0x7673('0xab')]===-0x1){return _0x3ff143;}}return this[_0x7673('0xa')][_0x7673('0xb7')]();};AGIVertices[_0x7673('0xc')]['callback']=function(_0x5e202c){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xbb'),_0x5e202c[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x5e202c['list_id'])){return this[_0x7673('0xa')]['error'](_0x5e202c,'no\x20list\x20selected');}_0x5e202c[_0x7673('0x47')]=moment();if(this['isConfigured'](_0x5e202c[_0x7673('0xbc')])){_0x5e202c[_0x7673('0x47')]=moment()[_0x7673('0xbd')](_0x5e202c[_0x7673('0xbc')],_0x7673('0xbe'));}if(!this[_0x7673('0x83')](_0x5e202c[_0x7673('0x4b')])){_0x5e202c[_0x7673('0x4b')]=0x2;}this[_0x7673('0x40')]['sync'](this,_0x5e202c);return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5e202c[_0x7673('0x45')],_0x5e202c[_0x7673('0x46')],_0x5e202c['scheduledAt']));};AGIVertices[_0x7673('0xc')][_0x7673('0xbf')]=function(_0x1a77a4){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x1a77a4[_0x7673('0x36')]));var _0x28a26a=this[_0x7673('0xa')][_0x7673('0x54')](_0x1a77a4['application'],_0x1a77a4[_0x7673('0xa9')]);if(_0x28a26a[_0x7673('0xab')]===-0x1){return _0x28a26a;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xc0'),_0x1a77a4[_0x7673('0xc1')],_0x1a77a4[_0x7673('0xa9')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x1b3208){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xc2'),_0x1b3208[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x1b3208[_0x7673('0x59')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xa8'));}var _0x2bfe03='\x22'+_0x1b3208[_0x7673('0x59')]+'\x22';if(this[_0x7673('0x83')](_0x1b3208['options'])){_0x2bfe03+=','+_0x1b3208[_0x7673('0xa9')];}var _0x27bd92=this[_0x7673('0xa')]['exec'](_0x7673('0xaa'),_0x2bfe03);if(_0x27bd92[_0x7673('0xab')]===-0x1){return _0x27bd92;}return this['channel']['noop'](util['format'](_0x7673('0xac'),_0x2bfe03));};AGIVertices[_0x7673('0xc')][_0x7673('0xc3')]=function(_0x359833){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x359833[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x359833[_0x7673('0x59')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xa8'));}var _0x2a561d='\x22'+_0x359833[_0x7673('0x59')]+'\x22';if(this[_0x7673('0x83')](_0x359833[_0x7673('0xa9')])){_0x2a561d+=','+_0x359833[_0x7673('0xa9')];}var _0x3ba5bb=this[_0x7673('0xa')][_0x7673('0x54')]('MRCPSynth',_0x2a561d);if(_0x3ba5bb[_0x7673('0xab')]===-0x1){return _0x3ba5bb;}return this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')](_0x7673('0xac'),_0x2a561d));};AGIVertices[_0x7673('0xc')][_0x7673('0xc4')]=function(_0x8c10f9){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xc5'),_0x8c10f9[_0x7673('0x36')]));if(!this['isConfigured'](_0x8c10f9[_0x7673('0xaf')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xc6'));}var _0x1e1c19=_0x8c10f9[_0x7673('0xaf')];if(this[_0x7673('0x83')](_0x8c10f9[_0x7673('0xa9')])){_0x1e1c19+=','+_0x8c10f9[_0x7673('0xa9')];}var _0x179eeb=this['channel'][_0x7673('0x54')](_0x7673('0xc7'),_0x1e1c19);if(_0x179eeb[_0x7673('0xab')]===-0x1){return _0x179eeb;}var _0x22219f=this[_0x7673('0xb0')]('RECOG_CONFIDENCE()',_0x7673('0xc8'));if(_0x22219f['result']===-0x1){return _0x22219f;}var _0x281616=this[_0x7673('0xb0')](_0x7673('0xc9'),_0x7673('0xca'));if(_0x281616[_0x7673('0xab')]===-0x1){return _0x281616;}var _0x84a06=this['getAndSetVariable'](_0x7673('0xcb'),'LUMENVOX_ASR_INSTANCE');if(_0x84a06['result']===-0x1){return _0x84a06;}return this[_0x7673('0xa')]['noop'](util['format'](_0x7673('0xb4'),_0x1e1c19));};AGIVertices[_0x7673('0xc')]['sestekasr']=function(_0x37be59){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xcc'),_0x37be59[_0x7673('0x36')]));if(!this['isConfigured'](_0x37be59['grammar'])){return this['channel'][_0x7673('0xa7')]('no\x20grammar\x20configured');}var _0x3c6e3a=_0x37be59[_0x7673('0xaf')];if(this['isConfigured'](_0x37be59[_0x7673('0xa9')])){_0x3c6e3a+=','+_0x37be59[_0x7673('0xa9')];}var _0x45d2ad=this[_0x7673('0xa')][_0x7673('0x54')](_0x7673('0xc7'),_0x3c6e3a);if(_0x45d2ad[_0x7673('0xab')]===-0x1){return _0x45d2ad;}var _0x2c4280=this[_0x7673('0xb0')](_0x7673('0xcd'),_0x7673('0xce'));if(_0x2c4280[_0x7673('0xab')]===-0x1){return _0x2c4280;}var _0x2e2972=this[_0x7673('0xb0')](_0x7673('0xc9'),_0x7673('0xcf'));if(_0x2e2972[_0x7673('0xab')]===-0x1){return _0x2e2972;}var _0xe4c379=this[_0x7673('0xb0')](_0x7673('0xcb'),_0x7673('0xd0'));if(_0xe4c379[_0x7673('0xab')]===-0x1){return _0xe4c379;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')]('Executed\x20command\x20MRCPRecog\x20%s',_0x3c6e3a));};AGIVertices[_0x7673('0xc')][_0x7673('0xd1')]=function(_0xbe354){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0xd2'),_0xbe354[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0xbe354['odbc_id'])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0xbe354,_0x7673('0xd3'));}var _0x21937d=this[_0x7673('0x15')][_0x7673('0xa3')](this,_0xbe354['odbc_id']);if(!_0x21937d){return this[_0x7673('0xa')]['error'](_0xbe354,'no\x20odbc\x20database\x20found');}if(!this[_0x7673('0x83')](_0xbe354[_0x7673('0xd4')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0xbe354,'no\x20query\x20configured');}var _0x5939f8=_0xbe354[_0x7673('0xd4')][_0x7673('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xd5'),_0x5939f8));var _0x35bbb9=this['getQueryOdbc']['sync'](this,_0x21937d,_0x5939f8);this[_0x7673('0x34')][_0x7673('0xa3')](this,_0xbe354,_0x5939f8);if(!this['isConfigured'](_0xbe354[_0x7673('0xd6')])){return this[_0x7673('0xa')]['noop'](_0x7673('0xd7'));}var _0x5bf7c1=this['getVariable'][_0x7673('0xa3')](this,_0xbe354[_0x7673('0xd6')]);if(!_0x5bf7c1){return this[_0x7673('0xa')][_0x7673('0x2b')](_0xbe354,_0x7673('0xd8'));}var _0x385f47=this;_0x35bbb9[_0x7673('0xd9')](function(_0x4b68dc,_0xd11abd){Object[_0x7673('0xda')](_0x4b68dc)[_0x7673('0xd9')](function(_0x42cdc6){_0x385f47['channel'][_0x7673('0xa1')](util[_0x7673('0x27')]('%s[%s][%s]',_0x5bf7c1,_0xd11abd,_0x42cdc6),_0x4b68dc[_0x42cdc6]);});});this[_0x7673('0xa')]['setVariable'](util[_0x7673('0x27')]('%s_ROWS_COUNT',_0x5bf7c1),_0x35bbb9[_0x7673('0x9a')]);return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xdb'),_0x5bf7c1));};AGIVertices[_0x7673('0xc')][_0x7673('0xdc')]=function(_0x439bb6){logger[_0x7673('0xdd')](util[_0x7673('0x27')](_0x7673('0xde'),_0x439bb6[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x439bb6['sip_id'])){return this['channel'][_0x7673('0x2b')](_0x439bb6,_0x7673('0xdf'));}var _0x655cec=this[_0x7673('0x18')]['sync'](this,_0x439bb6[_0x7673('0xe0')]);if(!_0x655cec){return this['channel'][_0x7673('0x2b')](_0x439bb6,_0x7673('0xe1'));}var _0x18e457=this[_0x7673('0xa')]['exec'](_0x7673('0xe2'),[util[_0x7673('0x27')](_0x7673('0xe3'),_0x655cec),_0x439bb6[_0x7673('0x63')],_0x439bb6[_0x7673('0xe4')],_0x439bb6['url']]);if(_0x18e457['result']===-0x1){return _0x18e457;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')]('Executed\x20command\x20%s',_0x7673('0xe2')));};AGIVertices[_0x7673('0xc')][_0x7673('0xe5')]=function(_0x3a5b10){logger[_0x7673('0x2d')](util['format'](_0x7673('0xe6'),_0x3a5b10[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x3a5b10[_0x7673('0x7e')])){return this['channel'][_0x7673('0xa7')](_0x7673('0xe7'));}if(!this[_0x7673('0x83')](_0x3a5b10['text'])){return this['channel'][_0x7673('0xa7')](_0x7673('0xa8'));}this[_0x7673('0xa')][_0x7673('0xe8')]=!![];this['createSquareDetailsReport'](_0x3a5b10);this[_0x7673('0x3f')](_0x3a5b10['text'],'in','','');this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xe9'),_0x3a5b10[_0x7673('0x59')]));var _0x45d3e5=this[_0x7673('0x77')][_0x7673('0xa3')](this,_0x3a5b10);if(_0x45d3e5){for(var _0x40d623 in _0x45d3e5){if(_0x45d3e5[_0x7673('0x97')](_0x40d623)){this[_0x7673('0xa')]['setVariable'](util[_0x7673('0x27')](_0x7673('0xea'),_0x40d623[_0x7673('0x68')]()),_0x45d3e5[_0x40d623]);}}this['createSquareMessage'](_0x45d3e5[_0x7673('0xeb')],_0x7673('0xec'),_0x7673('0xe5'),'');return this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')]('Dialogflow\x20Result\x20%s',_0x45d3e5[_0x7673('0xeb')]));}return this['channel'][_0x7673('0x2b')](_0x3a5b10,_0x7673('0xed'));};AGIVertices[_0x7673('0xc')]['dialogflowV2']=function(_0x14556b){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x14556b['label']));if(!this[_0x7673('0x83')](_0x14556b[_0x7673('0x79')])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20project_id\x20configured');}if(!this['isConfigured'](_0x14556b[_0x7673('0xee')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xef'));}if(!this[_0x7673('0x83')](_0x14556b[_0x7673('0x7a')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xf0'));}if(!this[_0x7673('0x83')](_0x14556b[_0x7673('0x7b')])){return this['channel'][_0x7673('0xa7')](_0x7673('0xf1'));}if(!this[_0x7673('0x83')](_0x14556b[_0x7673('0x59')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xa8'));}this[_0x7673('0xa')][_0x7673('0xe8')]=!![];this['createSquareDetailsReport'](_0x14556b);this['createSquareMessage'](_0x14556b[_0x7673('0x59')],'in','','');this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xf2'),_0x14556b[_0x7673('0x59')]));var _0x414e82=this[_0x7673('0xf3')][_0x7673('0xa3')](this,_0x14556b);if(_0x414e82){for(var _0x5556b4 in _0x414e82){if(_0x414e82[_0x7673('0x97')](_0x5556b4)){if(_0x5556b4!=='providerResponse'){this[_0x7673('0xa')][_0x7673('0xa1')](util['format'](_0x7673('0xea'),_0x5556b4['toUpperCase']()),_0x414e82[_0x5556b4]);}}}this['createSquareMessage'](_0x414e82[_0x7673('0xeb')],_0x7673('0xec'),'dialogflowV2',_0x414e82[_0x7673('0xf4')]);return this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xf5'),_0x414e82[_0x7673('0xeb')]));}return this[_0x7673('0xa')][_0x7673('0x2b')](_0x14556b,_0x7673('0xf6'));};AGIVertices[_0x7673('0xc')][_0x7673('0xf7')]=function(_0x1e8f47){logger[_0x7673('0x2d')](util['format'](_0x7673('0xf8'),_0x1e8f47[_0x7673('0x36')]));if(!this['isConfigured'](_0x1e8f47['ndauth_url'])){return this['channel'][_0x7673('0xa7')](_0x7673('0xf9'));}if(!this[_0x7673('0x83')](_0x1e8f47['username'])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xfa'));}if(!this[_0x7673('0x83')](_0x1e8f47[_0x7673('0xfb')])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20password\x20configured');}if(!this[_0x7673('0x83')](_0x1e8f47[_0x7673('0xfc')])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20text\x20configured');}this[_0x7673('0xa')]['bot']=!![];this[_0x7673('0x34')](_0x1e8f47);this['createSquareMessage'](_0x1e8f47[_0x7673('0x59')],'in','','');this[_0x7673('0xa')][_0x7673('0xa7')](util['format'](_0x7673('0xfd'),_0x1e8f47['text']));var _0x2e1ab3=this[_0x7673('0x7c')][_0x7673('0xa3')](this,_0x1e8f47);if(_0x2e1ab3){for(var _0x32006c in _0x2e1ab3){if(_0x2e1ab3[_0x7673('0x97')](_0x32006c)){this[_0x7673('0xa')][_0x7673('0xa1')](util[_0x7673('0x27')]('SESTEK_NDA_%s',_0x32006c[_0x7673('0x68')]()),_0x2e1ab3[_0x32006c]);}}this['createSquareMessage'](_0x2e1ab3['speech'],_0x7673('0xec'),'sesteknda','');if(_0x2e1ab3[_0x7673('0xfe')]){this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xff'),_0x2e1ab3['audiofile']));var _0x598ca4=this[_0x7673('0xa')]['streamFile'](_0x2e1ab3[_0x7673('0xfe')]);try{fs[_0x7673('0x100')](_0x2e1ab3[_0x7673('0xfe')]+_0x7673('0x101'));}catch(_0x1927d7){logger[_0x7673('0x2b')](_0x1927d7);}return _0x598ca4;}else{return this['channel'][_0x7673('0xa7')](util['format'](_0x7673('0x102'),_0x2e1ab3[_0x7673('0xeb')]));}}return this[_0x7673('0xa')][_0x7673('0x2b')](_0x1e8f47,_0x7673('0x103'));};AGIVertices[_0x7673('0xc')][_0x7673('0x104')]=function(_0x458512){logger[_0x7673('0x2d')](util['format'](_0x7673('0x105'),_0x458512['label']));return this[_0x7673('0xa')]['noop'](_0x7673('0x104'));};AGIVertices[_0x7673('0xc')][_0x7673('0x106')]=function(_0x18c217){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x107'),_0x18c217[_0x7673('0x36')]));var _0x4b3e1='';if(_0x18c217[_0x7673('0x108')]){if(!this[_0x7673('0x83')](_0x18c217[_0x7673('0x108')])){return this['channel'][_0x7673('0x2b')](_0x18c217,_0x7673('0x109'));}else{var _0x5ad489=parseInt(_0x18c217[_0x7673('0x108')],0xa);if(isNaN(_0x5ad489)){_0x4b3e1=_0x18c217[_0x7673('0x108')];}else{_0x4b3e1=this[_0x7673('0x1a')][_0x7673('0xa3')](this,_0x18c217[_0x7673('0x108')]);if(!_0x4b3e1){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x18c217,'no\x20trunk\x20found');}}}}else if(_0x18c217[_0x7673('0x10a')]){_0x4b3e1=_0x18c217[_0x7673('0x10a')];}else{return this[_0x7673('0xa')][_0x7673('0x2b')](_0x18c217,_0x7673('0x109'));}var _0x24ef37=this[_0x7673('0xa')][_0x7673('0x54')](_0x7673('0xe2'),[util[_0x7673('0x27')](_0x7673('0x10b'),_0x4b3e1,_0x18c217[_0x7673('0x45')]),_0x18c217['timeout'],_0x18c217[_0x7673('0xe4')],_0x18c217[_0x7673('0x62')]]);if(_0x24ef37['result']===-0x1){return _0x24ef37;}return this[_0x7673('0xa')]['noop'](util['format'](_0x7673('0x10c'),_0x7673('0xe2')));};AGIVertices['prototype']['finally']=function(_0x33c5c6){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x33c5c6[_0x7673('0x36')]));return this['channel']['noop']('finally');};AGIVertices[_0x7673('0xc')][_0x7673('0x10d')]=function(_0x47c1ac){logger['info'](util['format'](_0x7673('0x10e'),_0x47c1ac[_0x7673('0x36')]));if(_0x47c1ac[_0x7673('0xa4')]===0x0){return this[_0x7673('0xa2')](_0x47c1ac);}_0x47c1ac[_0x7673('0xa4')]-=0x1;if(!this['isConfigured'](_0x47c1ac['file_id'])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x47c1ac,'no\x20file\x20audio\x20selected');}var _0x3f044c=this['getSound'][_0x7673('0xa3')](this,_0x47c1ac[_0x7673('0x10f')]);if(!_0x3f044c){return this['channel'][_0x7673('0x2b')](_0x47c1ac,_0x7673('0x110'));}if(!this[_0x7673('0x83')](_0x47c1ac[_0x7673('0xd6')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x7673('0xd7'));}var _0x4e7610=this[_0x7673('0xa')]['getData'](_0x3f044c,_0x47c1ac[_0x7673('0x111')],_0x47c1ac['maxdigit']);var _0xbe7337=_0x4e7610[_0x7673('0xab')]?_0x4e7610[_0x7673('0xab')][_0x7673('0x4a')]():'';logger[_0x7673('0x2d')](_0x7673('0x112'),JSON['stringify'](_0x4e7610));if(_0x4e7610[_0x7673('0xab')]===-0x1){this[_0x7673('0x34')]['sync'](this,_0x47c1ac,_0xbe7337);return _0x4e7610;}else if(_0x4e7610[_0x7673('0x9f')]===_0x7673('0x63')){_0x4e7610[_0x7673('0xab')]=_0xbe7337[_0x7673('0x9a')]>=parseInt(_0x47c1ac['mindigit'])?'x':'i';}else{_0x4e7610[_0x7673('0xab')]=_0xbe7337[_0x7673('0x9a')]>=parseInt(_0x47c1ac['mindigit'])&&_0xbe7337[_0x7673('0x9a')]<=parseInt(_0x47c1ac[_0x7673('0x113')])?'x':'i';}var _0x341b24=this['getVariable'][_0x7673('0xa3')](this,_0x47c1ac[_0x7673('0xd6')]);if(!_0x341b24){return this[_0x7673('0xa')]['error'](_0x47c1ac,_0x7673('0xd8'));}this[_0x7673('0xa')][_0x7673('0xa1')](_0x341b24,_0xbe7337);if(this[_0x7673('0x83')](_0x47c1ac[_0x7673('0x114')])){var _0x4d71f1=parseInt(_0x47c1ac[_0x7673('0x114')],0xa);var _0xb1e7cc=rs[_0x7673('0x115')]({'charset':'*','length':_0x4d71f1});var _0x397d90=_0xbe7337[_0x7673('0x9a')];if(_0x397d90>0x0){if(_0x397d90>_0x4d71f1){this[_0x7673('0x34')][_0x7673('0xa3')](this,_0x47c1ac,_0x47c1ac[_0x7673('0x116')]===_0x7673('0x117')?_0xb1e7cc+_0xbe7337[_0x7673('0x118')](_0x4d71f1):_0xbe7337[_0x7673('0x118')](0x0,_0x397d90-_0x4d71f1)+_0xb1e7cc);}else{this[_0x7673('0x34')]['sync'](this,_0x47c1ac,rs[_0x7673('0x115')]({'charset':'*','length':_0x397d90}));}}else{this[_0x7673('0x34')][_0x7673('0xa3')](this,_0x47c1ac,'');}}else{this[_0x7673('0x34')]['sync'](this,_0x47c1ac,_0xbe7337);}return _0x4e7610;};AGIVertices[_0x7673('0xc')][_0x7673('0x119')]=function(_0x53073b){logger['info'](util['format'](_0x7673('0x11a'),_0x53073b[_0x7673('0x36')]));return this['getdigits'](_0x53073b);};AGIVertices[_0x7673('0xc')][_0x7673('0x11b')]=function(_0x4b09a8){logger['info'](util[_0x7673('0x27')](_0x7673('0x11c'),_0x4b09a8[_0x7673('0x36')]));this[_0x7673('0x34')][_0x7673('0xa3')](this,_0x4b09a8,_0x4b09a8[_0x7673('0x11d')]);return this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')]('GOAL\x20%s',_0x4b09a8[_0x7673('0x11d')]));};AGIVertices[_0x7673('0xc')]['awspolly']=function(_0x5f1c08){logger[_0x7673('0x2d')](util['format'](_0x7673('0x11e'),_0x5f1c08[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x5f1c08['aws_access_key_id'])||!this[_0x7673('0x83')](_0x5f1c08['aws_secret_access_key'])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7673('0x83')](_0x5f1c08[_0x7673('0x59')])){return this[_0x7673('0xa')]['noop'](_0x7673('0xa8'));}this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')](_0x7673('0x11f'),_0x5f1c08['text']));var _0x55841c=this[_0x7673('0x85')][_0x7673('0xa3')](this,_0x5f1c08);if(_0x55841c){this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x120'),_0x55841c));var _0x57ee5a=this[_0x7673('0xa')][_0x7673('0x121')](_0x55841c);try{fs[_0x7673('0x100')](_0x55841c+_0x7673('0x101'));}catch(_0x54be32){logger[_0x7673('0x2b')](_0x54be32);}return _0x57ee5a;}return this[_0x7673('0xa')][_0x7673('0x2b')](_0x5f1c08,_0x7673('0x122'));};AGIVertices[_0x7673('0xc')][_0x7673('0x123')]=function(_0x34b73a){logger['info'](util[_0x7673('0x27')](_0x7673('0x124'),_0x34b73a[_0x7673('0x36')]));if(!this['isConfigured'](_0x34b73a['aws_access_key_id'])||!this[_0x7673('0x83')](_0x34b73a['aws_secret_access_key'])){return this['channel']['noop'](_0x7673('0x125'));}if(!this[_0x7673('0x83')](_0x34b73a[_0x7673('0x8c')])){return this[_0x7673('0xa')]['noop'](_0x7673('0x126'));}if(!this[_0x7673('0x83')](_0x34b73a[_0x7673('0x59')])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20text\x20configured');}this[_0x7673('0xa')][_0x7673('0xe8')]=!![];this[_0x7673('0x34')](_0x34b73a);this['createSquareMessage'](_0x34b73a[_0x7673('0x59')],'in','','');this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x127'),_0x34b73a[_0x7673('0x59')]));var _0x4999f2=this['awsLex'][_0x7673('0xa3')](this,_0x34b73a);if(_0x4999f2){for(var _0x292270 in _0x4999f2){if(_0x4999f2[_0x7673('0x97')](_0x292270)&&_[_0x7673('0x93')](_0x4999f2[_0x292270])){this[_0x7673('0xa')][_0x7673('0xa1')](util[_0x7673('0x27')]('AWS_LEX_%s',_0x292270[_0x7673('0x68')]()),_0x4999f2[_0x292270]);}}if(_[_0x7673('0x42')](_0x4999f2[_0x7673('0x75')])){return this[_0x7673('0xa')][_0x7673('0xa7')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x4999f2[_0x7673('0x75')],_0x7673('0xec'),_0x7673('0x128'),'');return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x129'),_0x4999f2[_0x7673('0x75')]));}}return this['channel'][_0x7673('0x2b')](_0x34b73a,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x7673('0xc')]['googleasr']=function(_0x208c73){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x12a'),_0x208c73[_0x7673('0x36')],_0x208c73[_0x7673('0x63')]));if(!this[_0x7673('0x83')](_0x208c73[_0x7673('0x7e')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xe7'));}var _0x33db43=_0x7673('0x12b');var _0x447078=util[_0x7673('0x27')](_0x7673('0x12c'),FILES_PATH,rs[_0x7673('0x115')](0x4));var _0x2b67a2=util['format'](_0x7673('0x9c'),_0x447078,_0x33db43);var _0x3b6de6=!![];if(_0x208c73['beep']===_0x7673('0x12d')){_0x3b6de6=![];}var _0x788fe9=this[_0x7673('0xa')][_0x7673('0x12e')](_0x447078,_0x33db43,_0x208c73[_0x7673('0x12f')],_0x208c73[_0x7673('0x63')],undefined,_0x3b6de6);if(_0x788fe9['result']!==-0x1){this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')]('google\x20%s\x20file\x20created',_0x2b67a2));var _0x222efe=this[_0x7673('0x8d')][_0x7673('0xa3')](this,_0x208c73,_0x2b67a2);if(_0x222efe){for(var _0x892908 in _0x222efe){if(_0x222efe[_0x7673('0x97')](_0x892908)){this[_0x7673('0xa')][_0x7673('0xa1')](util[_0x7673('0x27')](_0x7673('0x130'),_0x892908['toUpperCase']()),_0x222efe[_0x892908]);}}return this['channel'][_0x7673('0xa7')](util['format'](_0x7673('0x131'),JSON[_0x7673('0x71')](_0x222efe)));}}return _0x788fe9;};AGIVertices[_0x7673('0xc')][_0x7673('0x132')]=function(_0x263f8b){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x133'),_0x263f8b['label']));if(!this['isConfigured'](_0x263f8b[_0x7673('0x90')])){return this[_0x7673('0xa')]['noop'](_0x7673('0x134'));}if(!this[_0x7673('0x83')](_0x263f8b[_0x7673('0x91')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0x135'));}var _0x310e0d=_0x7673('0x12b');var _0x45358e=util[_0x7673('0x27')](_0x7673('0x12c'),FILES_PATH,rs[_0x7673('0x115')](0x4));var _0x5b3485=util['format']('%s.%s',_0x45358e,_0x310e0d);var _0xa89ece=!![];if(_0x263f8b[_0x7673('0x136')]===_0x7673('0x12d')){_0xa89ece=![];}var _0x527f79=this[_0x7673('0xa')][_0x7673('0x12e')](_0x45358e,_0x310e0d,_0x263f8b[_0x7673('0x12f')],_0x263f8b[_0x7673('0x63')],undefined,_0xa89ece);if(_0x527f79[_0x7673('0xab')]!==-0x1){this[_0x7673('0xa')]['noop'](util['format'](_0x7673('0x137'),_0x5b3485));var _0x3f9dff=this['tildeASR'][_0x7673('0xa3')](this,_0x263f8b,_0x5b3485);if(_0x3f9dff){for(var _0x40afb3 in _0x3f9dff){if(_0x3f9dff['hasOwnProperty'](_0x40afb3)){this[_0x7673('0xa')]['setVariable'](util[_0x7673('0x27')]('TILDE_ASR_%s',_0x40afb3[_0x7673('0x68')]()),_0x3f9dff[_0x40afb3]);}}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x138'),JSON['stringify'](_0x3f9dff)));}}return _0x527f79;};AGIVertices[_0x7673('0xc')][_0x7673('0x139')]=function(_0x3da51e){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x13a'),_0x3da51e[_0x7673('0x36')]));return this[_0x7673('0xa')][_0x7673('0x13b')](_0x3da51e['context'],_0x3da51e[_0x7673('0x13c')],_0x3da51e[_0x7673('0x3c')]);};AGIVertices[_0x7673('0xc')][_0x7673('0x13d')]=function(_0x5ea0a4){logger['info'](util['format'](_0x7673('0x13e'),_0x5ea0a4[_0x7673('0x36')]));if(!this['isConfigured'](_0x5ea0a4['condition'])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x5ea0a4,_0x7673('0x13f'));}try{var _0x2b931f=eval(_0x5ea0a4[_0x7673('0x140')])?_0x7673('0x141'):_0x7673('0x142');this[_0x7673('0xa')][_0x7673('0xa7')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x5ea0a4[_0x7673('0x140')],_0x2b931f));return{'code':0xc8,'result':_0x2b931f};}catch(_0x3961d6){return{'code':0xc8,'result':_0x7673('0x142')};}};AGIVertices[_0x7673('0xc')][_0x7673('0x143')]=function(_0x509a9c){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x509a9c[_0x7673('0x36')]));if(!this['isConfigured'](_0x509a9c[_0x7673('0x144')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x509a9c,_0x7673('0x145'));}var _0x58a1b1=this[_0x7673('0x20')][_0x7673('0xa3')](this,_0x509a9c[_0x7673('0x144')]);if(!_0x58a1b1){return this[_0x7673('0xa')]['error'](_0x509a9c,'no\x20intervals\x20found');}for(var _0x487af0=0x0;_0x487af0<_0x58a1b1[_0x7673('0x9a')];_0x487af0+=0x1){var _0x220a3b=this[_0x7673('0xa')]['getVariable'](util[_0x7673('0x27')](_0x7673('0x146'),_0x58a1b1[_0x487af0]));if(_0x220a3b[_0x7673('0xab')]===-0x1){return _0x220a3b;}logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x147'),_0x58a1b1[_0x487af0],_0x220a3b[_0x7673('0x9f')]));if(_0x220a3b[_0x7673('0x9f')]===_0x7673('0x141')){logger[_0x7673('0x2d')](util['format'](_0x7673('0x147'),_0x58a1b1[_0x487af0],_0x7673('0x141')));this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x147'),_0x58a1b1[_0x487af0],_0x7673('0x141')));return{'code':0xc8,'result':_0x7673('0x141')};}else{logger[_0x7673('0x2d')](util['format'](_0x7673('0x147'),_0x58a1b1[_0x487af0],_0x7673('0x142')));this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')]('IFTIME\x20%s\x20%s',_0x58a1b1[_0x487af0],'false'));}}return{'code':0xc8,'result':_0x7673('0x142')};};AGIVertices[_0x7673('0xc')]['hangup']=function(_0x19f83c){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x19f83c[_0x7673('0x36')]));return this[_0x7673('0xa')][_0x7673('0x148')]();};AGIVertices[_0x7673('0xc')][_0x7673('0x149')]=function(_0x42d41d){logger[_0x7673('0x2d')](util['format'](_0x7673('0x14a'),_0x42d41d[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x42d41d[_0x7673('0x7e')])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20key\x20configured');}var _0x1e90b6='wav';var _0xcd5715=util[_0x7673('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1df6e5=util['format'](_0x7673('0x9c'),_0xcd5715,_0x1e90b6);var _0x3a4c30=!![];if(_0x42d41d[_0x7673('0x136')]==='NOBEEP'){_0x3a4c30=![];}var _0x21a079=this[_0x7673('0xa')][_0x7673('0x12e')](_0xcd5715,_0x1e90b6,_0x42d41d[_0x7673('0x12f')],_0x42d41d['timeout'],undefined,_0x3a4c30);if(_0x21a079[_0x7673('0xab')]!==-0x1){this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x14b'),_0x1df6e5));var _0x2c1eed=this[_0x7673('0x81')]['sync'](this,_0x42d41d,_0x1df6e5);if(_0x2c1eed){for(var _0x3a61f4 in _0x2c1eed){if(_0x2c1eed[_0x7673('0x97')](_0x3a61f4)){this[_0x7673('0xa')][_0x7673('0xa1')](util['format']('ISPEECH_ASR_%s',_0x3a61f4[_0x7673('0x68')]()),_0x2c1eed[_0x3a61f4]);}}return this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0x7673('0x71')](_0x2c1eed)));}}return _0x21a079;};AGIVertices['prototype']['ispeechtts']=function(_0x40bacb){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x14c'),_0x40bacb[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x40bacb[_0x7673('0x7e')])){return this[_0x7673('0xa')]['noop'](_0x7673('0xe7'));}if(!this['isConfigured'](_0x40bacb['text'])){return this[_0x7673('0xa')][_0x7673('0xa7')]('no\x20text\x20configured');}this[_0x7673('0xa')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x40bacb[_0x7673('0x59')]));var _0x5cb648=this[_0x7673('0x7d')][_0x7673('0xa3')](this,_0x40bacb);if(_0x5cb648){this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')](_0x7673('0x14b'),_0x5cb648));var _0x50a89a=this[_0x7673('0xa')][_0x7673('0x121')](_0x5cb648,_0x40bacb[_0x7673('0x12f')]);try{fs[_0x7673('0x100')](_0x5cb648+_0x7673('0x101'));}catch(_0x2127e2){logger['error'](_0x2127e2);}return _0x50a89a;}return this[_0x7673('0xa')][_0x7673('0x2b')](_0x40bacb,_0x7673('0x14d'));};AGIVertices[_0x7673('0xc')][_0x7673('0x14e')]=function(_0x49e7b9){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x14f'),_0x49e7b9[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x49e7b9[_0x7673('0x150')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x49e7b9,'no\x20find\x20by\x20configured');}logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x151'),this[_0x7673('0xa')][_0x7673('0x39')],_0x49e7b9[_0x7673('0x150')]));var _0x5e5268=this['agentLogin']['sync'](this,_0x49e7b9[_0x7673('0x150')]);if(_0x5e5268){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x152'),this[_0x7673('0xa')][_0x7673('0x39')],_0x49e7b9['findBy']));this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x152'),this['channel']['callerid'],_0x49e7b9[_0x7673('0x150')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x153'),this[_0x7673('0xa')][_0x7673('0x39')],_0x49e7b9['findBy']));this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7673('0xa')][_0x7673('0x39')],_0x49e7b9[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x154')};}};AGIVertices['prototype'][_0x7673('0x155')]=function(_0x51a260){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x156'),_0x51a260['label']));if(!this[_0x7673('0x83')](_0x51a260[_0x7673('0x150')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x51a260,_0x7673('0x157'));}logger['info'](util[_0x7673('0x27')](_0x7673('0x151'),this[_0x7673('0xa')]['callerid'],_0x51a260[_0x7673('0x150')]));var _0x590df0=this['agentLogout'][_0x7673('0xa3')](this,_0x51a260[_0x7673('0x150')]);if(_0x590df0){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x152'),this[_0x7673('0xa')][_0x7673('0x39')],_0x51a260[_0x7673('0x150')]));this['channel'][_0x7673('0xa7')](util['format'](_0x7673('0x152'),this[_0x7673('0xa')]['callerid'],_0x51a260[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x158')};}else{logger['info'](util[_0x7673('0x27')](_0x7673('0x153'),this['channel'][_0x7673('0x39')],_0x51a260[_0x7673('0x150')]));this['channel']['noop'](util[_0x7673('0x27')](_0x7673('0x153'),this[_0x7673('0xa')][_0x7673('0x39')],_0x51a260[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x154')};}};AGIVertices[_0x7673('0xc')][_0x7673('0x159')]=function(_0x15ad6d){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x15ad6d[_0x7673('0x36')]));if(!this['isConfigured'](_0x15ad6d[_0x7673('0x15a')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x15ad6d,_0x7673('0x15b'));}this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x15c'),_0x15ad6d[_0x7673('0x15a')]));var _0x5195db=eval(_0x15ad6d[_0x7673('0x15a')]);if(!this[_0x7673('0x83')](_0x15ad6d['variable_id'])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xd7'));}var _0x146497=this[_0x7673('0xd')][_0x7673('0xa3')](this,_0x15ad6d[_0x7673('0xd6')]);if(!_0x146497){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x15ad6d,_0x7673('0xd8'));}if(_['isArray'](_0x5195db)){var _0x3b6251=this;_0x5195db[_0x7673('0xd9')](function(_0x1d6ed5,_0x4d5f3d){_0x3b6251[_0x7673('0xa')][_0x7673('0xa1')](util[_0x7673('0x27')](_0x7673('0x15d'),_0x146497,_0x4d5f3d),_0x1d6ed5);});return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x15e'),_0x146497));}else{return this[_0x7673('0xa')][_0x7673('0xa1')](_0x146497,_0x5195db);}};AGIVertices['prototype'][_0x7673('0x15f')]=function(_0x5c646d){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5c646d[_0x7673('0x36')]));if(_0x5c646d[_0x7673('0xa4')]===0x0){return this[_0x7673('0xa2')](_0x5c646d);}_0x5c646d[_0x7673('0xa4')]-=0x1;if(!this['isConfigured'](_0x5c646d[_0x7673('0x10f')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x5c646d,_0x7673('0x160'));}var _0x463c1c=this[_0x7673('0x1b')][_0x7673('0xa3')](this,_0x5c646d[_0x7673('0x10f')]);if(!_0x463c1c){return this[_0x7673('0xa')]['error'](_0x5c646d,_0x7673('0x110'));}var _0x2c2feb=this['channel'][_0x7673('0x161')](_0x463c1c,_0x5c646d[_0x7673('0x111')],_0x5c646d[_0x7673('0x162')]);var _0xb41810=_0x2c2feb[_0x7673('0xab')];if(_0x2c2feb[_0x7673('0xab')]===-0x1){this[_0x7673('0x34')][_0x7673('0xa3')](this,_0x5c646d,'-1');return _0x2c2feb;}else if(_0x2c2feb['extra']===_0x7673('0x63')){_0x2c2feb['result']=_0x2c2feb['result']['length']>0x0?_0x2c2feb[_0x7673('0xab')]:'t';}else if(_[_0x7673('0x41')](_0x2c2feb[_0x7673('0xab')])){_0x2c2feb[_0x7673('0xab')]='#';_0xb41810='#';}if(!this['isConfigured'](_0x5c646d['variable_id'])){this['channel']['noop'](_0x7673('0xd7'));}else{var _0x4312eb=this[_0x7673('0xd')][_0x7673('0xa3')](this,_0x5c646d[_0x7673('0xd6')]);if(!_0x4312eb){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x5c646d,_0x7673('0xd8'));}this[_0x7673('0xa')]['setVariable'](_0x4312eb,_0xb41810);}this[_0x7673('0x34')][_0x7673('0xa3')](this,_0x5c646d,_0xb41810);return _0x2c2feb;};AGIVertices[_0x7673('0xc')][_0x7673('0xa7')]=function(_0x1bfd84){logger[_0x7673('0x2d')](util['format'](_0x7673('0x163'),_0x1bfd84[_0x7673('0x36')]));return this[_0x7673('0xa')]['noop'](_0x1bfd84[_0x7673('0x164')]||_0x1bfd84[_0x7673('0x36')]);};AGIVertices[_0x7673('0xc')][_0x7673('0x165')]=function(_0xa75b6f){logger[_0x7673('0x2d')](util['format'](_0x7673('0x166'),_0xa75b6f[_0x7673('0x36')]));if(!this['isConfigured'](_0xa75b6f['findBy'])){return this[_0x7673('0xa')]['error'](_0xa75b6f,_0x7673('0x157'));}logger['info'](util['format'](_0x7673('0x151'),this['channel'][_0x7673('0x39')],_0xa75b6f['findBy']));var _0x1b3250=this['getPause'][_0x7673('0xa3')](this,_0xa75b6f[_0x7673('0x167')]);var _0x110022=this[_0x7673('0x4c')][_0x7673('0xa3')](this,_0xa75b6f[_0x7673('0x150')],_0x1b3250);if(_0x110022){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x152'),this[_0x7673('0xa')]['callerid'],_0xa75b6f['findBy']));this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x152'),this[_0x7673('0xa')][_0x7673('0x39')],_0xa75b6f[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x158')};}else{logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x153'),this[_0x7673('0xa')][_0x7673('0x39')],_0xa75b6f[_0x7673('0x150')]));this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')](_0x7673('0x152'),this['channel'][_0x7673('0x39')],_0xa75b6f[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x154')};}};AGIVertices[_0x7673('0xc')][_0x7673('0x168')]=function(_0x3c9ddf){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3c9ddf[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x3c9ddf['file_id'])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x3c9ddf,'no\x20file\x20audio\x20selected');}var _0x5c4dfb=this[_0x7673('0x1b')][_0x7673('0xa3')](this,_0x3c9ddf['file_id']);if(!_0x5c4dfb){return this['channel'][_0x7673('0x2b')](_0x3c9ddf,_0x7673('0x110'));}var _0x26392b=this[_0x7673('0xa')]['exec'](_0x7673('0x169'),[_0x5c4dfb,_0x3c9ddf[_0x7673('0xe4')]]);if(_0x26392b[_0x7673('0xab')]===-0x1){return _0x26392b;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xc0'),_0x7673('0x169'),_0x5c4dfb));};AGIVertices[_0x7673('0xc')]['queue']=function(_0x4ea130){logger['info'](util[_0x7673('0x27')](_0x7673('0x16a'),_0x4ea130[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x4ea130[_0x7673('0x16b')])){return this[_0x7673('0xa')]['error'](_0x4ea130,_0x7673('0x16c'));}var _0x36a49b='';var _0x20724e=parseInt(_0x4ea130[_0x7673('0x16b')],0xa);if(isNaN(_0x20724e)){_0x36a49b=_0x4ea130[_0x7673('0x16b')];}else{_0x36a49b=this[_0x7673('0x12')][_0x7673('0xa3')](this,_0x4ea130[_0x7673('0x16b')]);if(!_0x36a49b){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x4ea130,_0x7673('0x16d'));}}var _0x2b9fb2='';if(this[_0x7673('0x83')](_0x4ea130[_0x7673('0x10f')])){var _0xf6612e=this[_0x7673('0x1b')][_0x7673('0xa3')](this,_0x4ea130[_0x7673('0x10f')]);if(_0xf6612e){_0x2b9fb2=_0xf6612e;}}this[_0x7673('0x34')][_0x7673('0xa3')](this,_0x4ea130,_0x36a49b);if(_0x4ea130['opts'][_0x7673('0x16e')]('x')<0x0){_0x4ea130[_0x7673('0xe4')]+='x';}if(_0x4ea130['opts'][_0x7673('0x16e')]('X')<0x0){_0x4ea130[_0x7673('0xe4')]+='X';}this[_0x7673('0xa')][_0x7673('0xa1')](_0x7673('0x16f'),_0x36a49b?_0x36a49b[_0x7673('0x170')]():'');var _0x4131e0=this[_0x7673('0xa')][_0x7673('0x54')](_0x7673('0x171'),[_0x36a49b,_0x4ea130[_0x7673('0xe4')],_0x4ea130['url'],_0x2b9fb2,_0x4ea130['timeout'],_0x4ea130[_0x7673('0x6')],_0x4ea130[_0x7673('0x172')],_0x4ea130[_0x7673('0x173')],'',_0x4ea130[_0x7673('0x174')]]);if(_0x4131e0[_0x7673('0xab')]===-0x1){return _0x4131e0;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')]('Executed\x20command\x20%s\x20%s',_0x7673('0x171'),_0x36a49b));};AGIVertices[_0x7673('0xc')][_0x7673('0x175')]=function(_0x520e05){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x176'),_0x520e05['label']));var _0x302c04=_0x520e05[_0x7673('0x177')]||_0x7673('0x12b');var _0x4ca79f=util[_0x7673('0x27')](_0x7673('0x178'),this[_0x7673('0xa')][_0x7673('0x35')],rs[_0x7673('0x115')](0x5));var _0x1bfbd6=util[_0x7673('0x27')](_0x7673('0x179'),FILES_PATH,_0x4ca79f,_0x302c04);var _0x55e3a6=util[_0x7673('0x27')](_0x7673('0x12c'),FILES_PATH,_0x4ca79f);this[_0x7673('0x38')][_0x7673('0xa3')](this,_0x520e05,_0x4ca79f,_0x1bfbd6);this[_0x7673('0xa')][_0x7673('0xa1')]('RECORDING_SAVENAME',_0x4ca79f);logger[_0x7673('0x2d')](_0x7673('0x17a'),_0x55e3a6,_0x302c04,_0x520e05[_0x7673('0x17b')],_0x520e05[_0x7673('0x63')]);return this[_0x7673('0xa')][_0x7673('0x12e')](_0x55e3a6,_0x302c04,_0x520e05[_0x7673('0x17b')],_0x520e05[_0x7673('0x63')],undefined,!![]);};AGIVertices[_0x7673('0xc')][_0x7673('0x17c')]=function(_0x179c39){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x17d'),_0x179c39[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x179c39[_0x7673('0x62')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x39b21a=this[_0x7673('0x61')]['sync'](this,_0x179c39);logger[_0x7673('0x2d')](util['format'](_0x7673('0x17e'),util[_0x7673('0x17f')](_0x39b21a,{'showHidden':![],'depth':null})));if(!this[_0x7673('0x83')](_0x179c39[_0x7673('0xd6')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0x180'));}var _0x1e78d6=this[_0x7673('0xd')][_0x7673('0xa3')](this,_0x179c39[_0x7673('0xd6')]);if(!_0x1e78d6){return this[_0x7673('0xa')]['error'](_0x179c39,_0x7673('0xd8'));}this[_0x7673('0xa')][_0x7673('0xa1')](util['format'](_0x7673('0x181'),_0x1e78d6),_0x39b21a[_0x7673('0x73')]?_0x39b21a[_0x7673('0x73')]:_0x7673('0x182'));this['channel'][_0x7673('0xa1')](util['format'](_0x7673('0x183'),_0x1e78d6),_0x39b21a[_0x7673('0x74')]?_0x39b21a['statusMessage']:'OK');if(_0x39b21a['body']){try{this[_0x7673('0x9b')](_0x39b21a['body'],_0x1e78d6);}catch(_0x3f7376){logger[_0x7673('0x2b')](util[_0x7673('0x27')](_0x7673('0x184'),_0x1e78d6));}}return this[_0x7673('0xa')][_0x7673('0xa7')](util['format'](_0x7673('0xdb'),_0x1e78d6));};AGIVertices[_0x7673('0xc')]['saydigits']=function(_0x14899d){logger['info'](util[_0x7673('0x27')](_0x7673('0x185'),_0x14899d[_0x7673('0x36')]));return this[_0x7673('0xa')][_0x7673('0x186')](_0x14899d[_0x7673('0x187')][_0x7673('0x56')](/\s+/g,''),_0x14899d[_0x7673('0x17b')]);};AGIVertices[_0x7673('0xc')][_0x7673('0x188')]=function(_0x292586){logger[_0x7673('0x2d')](util['format'](_0x7673('0x189'),_0x292586[_0x7673('0x36')]));return this['channel'][_0x7673('0x18a')](_0x292586[_0x7673('0x64')][_0x7673('0x56')](/\s+/g,''),_0x292586['escape_digits']);};AGIVertices[_0x7673('0xc')]['sayphonetic']=function(_0x2c5fd4){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x18b'),_0x2c5fd4['label']));return this[_0x7673('0xa')][_0x7673('0x18c')](_0x2c5fd4[_0x7673('0x59')],_0x2c5fd4['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x3f59ce){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3f59ce[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x3f59ce[_0x7673('0x18d')])){return this[_0x7673('0xa')]['noop']('no\x20mail\x20account\x20configured');}var _0x53659d=this[_0x7673('0x1e')][_0x7673('0xa3')](this,_0x3f59ce[_0x7673('0x18d')]);if(!_0x53659d||!_0x53659d['Smtp']){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x3f59ce,_0x7673('0x18e'));}var _0x59669d={'from':util[_0x7673('0x27')](_0x7673('0x18f'),_0x53659d['name'],_0x53659d[_0x7673('0x190')]||_0x53659d['Smtp'][_0x7673('0x191')]),'to':_0x3f59ce['to']||'','cc':_0x3f59ce['cc']||'','bcc':_0x3f59ce[_0x7673('0x192')]||'','subject':_0x3f59ce['subject'],'html':_0x3f59ce[_0x7673('0x59')],'text':_0x3f59ce[_0x7673('0x59')]};if(this[_0x7673('0x83')](_0x3f59ce[_0x7673('0x193')])){}logger[_0x7673('0xdd')](_0x7673('0x194'),JSON[_0x7673('0x71')](_0x59669d));this['createSquareDetailsReport'][_0x7673('0xa3')](this,_0x3f59ce,_0x3f59ce[_0x7673('0x18d')]);this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x195'),_0x53659d['name']));this[_0x7673('0x1f')]['sync'](this,_0x53659d[_0x7673('0x196')],_0x59669d);return this['channel']['noop'](_0x7673('0x197'));};AGIVertices[_0x7673('0xc')][_0x7673('0x198')]=function(_0x4d7bef){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x199'),_0x4d7bef[_0x7673('0x36')]));return this[_0x7673('0xa')]['noop'](_0x7673('0x19a'));};AGIVertices['prototype'][_0x7673('0x19b')]=function(_0x5e9a63){logger[_0x7673('0x2d')](util[_0x7673('0x27')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5e9a63[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x5e9a63['sms_account_id'])){return this['channel'][_0x7673('0xa7')](_0x7673('0x19c'));}var _0x589f1e=this[_0x7673('0x19d')][_0x7673('0xa3')](this,_0x5e9a63[_0x7673('0x19e')]);if(!_0x589f1e){return this[_0x7673('0xa')]['error'](_0x5e9a63,_0x7673('0x19f'));}var _0x579e45={'body':_0x5e9a63[_0x7673('0x1a0')],'phone':_0x5e9a63['to']||'','SmsAccountId':_0x589f1e['id']};logger[_0x7673('0xdd')]('sendSMS\x20message',JSON[_0x7673('0x71')](_0x579e45));this['createSquareDetailsReport']['sync'](this,_0x5e9a63,_0x5e9a63[_0x7673('0x19e')]);this['channel'][_0x7673('0xa7')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x589f1e[_0x7673('0x10')]));this[_0x7673('0x33')][_0x7673('0xa3')](this,_0x579e45);return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0x1a1'));};AGIVertices[_0x7673('0xc')][_0x7673('0x1a2')]=function(_0x396ce7){logger[_0x7673('0x2d')](util['format'](_0x7673('0x1a3'),_0x396ce7['label']));if(!this['isConfigured'](_0x396ce7[_0x7673('0xd6')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x396ce7,_0x7673('0x1a4'));}var _0x22fd0a=this[_0x7673('0xd')][_0x7673('0xa3')](this,_0x396ce7['variable_id']);if(!_0x22fd0a){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x396ce7,_0x7673('0xd8'));}return this[_0x7673('0xa')][_0x7673('0xa1')](_0x22fd0a,_0x396ce7[_0x7673('0x1a5')]);};AGIVertices[_0x7673('0xc')][_0x7673('0x1a6')]=function(_0x368b43){logger['info'](util[_0x7673('0x27')](_0x7673('0x1a7'),_0x368b43[_0x7673('0x36')]));this[_0x7673('0xa')]['noop'](_0x7673('0x1a8'));var _0x2fc4b2=this[_0x7673('0xa')][_0x7673('0xd')](_0x7673('0x1a9'));if(!_[_0x7673('0x41')](_0x2fc4b2['extra'])){this[_0x7673('0xa')]['uniqueid']=_0x2fc4b2[_0x7673('0x9f')];}if(_0x368b43[_0x7673('0xb7')]===_0x7673('0x1aa')){this['channel'][_0x7673('0xa7')](_0x7673('0x1ab'));return this[_0x7673('0xa')][_0x7673('0xb7')]();}return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0x1ac'));};AGIVertices[_0x7673('0xc')]['subproject']=function(_0x4565af){logger[_0x7673('0x2d')](util['format'](_0x7673('0x1ad'),_0x4565af[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x4565af['project_id'])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x4565af,_0x7673('0x1ae'));}var _0x2a950c=this[_0x7673('0x13')][_0x7673('0xa3')](this,_0x4565af[_0x7673('0x1af')]);if(!this['isConfigured'](_0x2a950c)){return this['channel'][_0x7673('0x2b')](_0x4565af,util['format'](_0x7673('0x1b0'),_0x4565af[_0x7673('0x1af')]));}if(_0x2a950c===this['channel'][_0x7673('0x37')]){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x4565af,_0x7673('0x1b1'));}this['createSquareDetailsReport'][_0x7673('0xa3')](this,_0x4565af,_0x2a950c);var _0x256286=this[_0x7673('0xa')][_0x7673('0x54')]('AGI',util['format'](_0x7673('0x1b2'),config['agi'][_0x7673('0x1b3')]||_0x7673('0x1b4'),_0x2a950c,this[_0x7673('0xa')][_0x7673('0x37')]));if(_0x256286[_0x7673('0xab')]===-0x1){return _0x256286;}return this[_0x7673('0xa')]['noop'](util[_0x7673('0x27')]('Executed\x20command\x20%s\x20%s',_0x7673('0x1b5'),_0x2a950c));};AGIVertices[_0x7673('0xc')][_0x7673('0x1b6')]=function(_0x31e342){logger[_0x7673('0x2d')](util['format'](_0x7673('0x1b7'),_0x31e342[_0x7673('0x36')]));var _0x12c62d=this[_0x7673('0x1b8')][_0x7673('0xa3')](this,_0x31e342[_0x7673('0xb6')]);this[_0x7673('0x34')]['sync'](this,_0x31e342,_0x31e342['command']);if(this[_0x7673('0x83')](_0x31e342['variable_id'])){var _0x8c9bf3=this[_0x7673('0xd')]['sync'](this,_0x31e342[_0x7673('0xd6')]);if(_0x8c9bf3){this['channel'][_0x7673('0xa1')](_0x8c9bf3,_0x12c62d);return this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x1b9'),_0x31e342[_0x7673('0xb6')],_0x8c9bf3));}}return this[_0x7673('0xa')][_0x7673('0xa7')](util['format'](_0x7673('0x1ba'),_0x31e342['command']));};AGIVertices[_0x7673('0xc')][_0x7673('0x1bb')]=function(_0x2dfef1){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x1bc'),_0x2dfef1['label']));_0x2dfef1[_0x7673('0x59')]=_0x2dfef1[_0x7673('0x59')][_0x7673('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x7673('0x83')](_0x2dfef1[_0x7673('0x58')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0x1bd'));}if(!this[_0x7673('0x83')](_0x2dfef1[_0x7673('0x59')])){return this[_0x7673('0xa')][_0x7673('0xa7')](_0x7673('0xa8'));}this['channel']['noop'](util[_0x7673('0x27')](_0x7673('0x1be'),_0x2dfef1[_0x7673('0x59')]));var _0x247500=this[_0x7673('0x57')][_0x7673('0xa3')](this,_0x2dfef1);if(_0x247500){this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x1bf'),_0x247500));var _0x33b24e=this[_0x7673('0xa')][_0x7673('0x121')](_0x247500);try{fs[_0x7673('0x100')](_0x247500+'.wav');}catch(_0x27d82a){logger['error'](_0x27d82a);}return _0x33b24e;}return this[_0x7673('0xa')][_0x7673('0x2b')](_0x2dfef1,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x7673('0xc')][_0x7673('0x1c0')]=function(_0x1b2d21){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x1c1'),_0x1b2d21[_0x7673('0x36')]));_0x1b2d21[_0x7673('0x59')]=_0x1b2d21[_0x7673('0x59')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1b2d21[_0x7673('0x59')])){return this[_0x7673('0xa')]['noop']('no\x20text\x20configured');}this['channel'][_0x7673('0xa7')](util[_0x7673('0x27')]('Trying\x20Google\x20TTS\x20%s',_0x1b2d21[_0x7673('0x59')]));var _0x393bb5=this[_0x7673('0x5f')][_0x7673('0xa3')](this,_0x1b2d21);if(_0x393bb5){this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x1c2'),_0x393bb5));var _0x4841ee=this[_0x7673('0xa')][_0x7673('0x121')](_0x393bb5);try{fs[_0x7673('0x100')](_0x393bb5+_0x7673('0x101'));}catch(_0x59ff68){logger['error'](_0x59ff68);}return _0x4841ee;}return this['channel'][_0x7673('0x2b')](_0x1b2d21,_0x7673('0x1c3'));};AGIVertices[_0x7673('0xc')][_0x7673('0x1c4')]=function(_0x7b0882){logger['info'](util[_0x7673('0x27')](_0x7673('0x1c5'),_0x7b0882[_0x7673('0x36')]));if(!this[_0x7673('0x83')](_0x7b0882[_0x7673('0x150')])){return this['channel'][_0x7673('0x2b')](_0x7b0882,'no\x20find\x20by\x20configured');}logger[_0x7673('0x2d')](util['format'](_0x7673('0x151'),this[_0x7673('0xa')][_0x7673('0x39')],_0x7b0882[_0x7673('0x150')]));var _0x35edd3=this[_0x7673('0x4e')][_0x7673('0xa3')](this,_0x7b0882[_0x7673('0x150')]);if(_0x35edd3){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7673('0xa')][_0x7673('0x39')],_0x7b0882[_0x7673('0x150')]));this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x152'),this['channel'][_0x7673('0x39')],_0x7b0882[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x158')};}else{logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x153'),this[_0x7673('0xa')]['callerid'],_0x7b0882[_0x7673('0x150')]));this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0x153'),this['channel'][_0x7673('0x39')],_0x7b0882[_0x7673('0x150')]));return{'code':0xc8,'result':_0x7673('0x154')};}};AGIVertices[_0x7673('0xc')][_0x7673('0x1c6')]=function(_0x228505){logger[_0x7673('0x2d')](util[_0x7673('0x27')](_0x7673('0x1c7'),_0x228505[_0x7673('0x36')]));var _0x14651b=this[_0x7673('0xa')][_0x7673('0x54')]('VOICEMAIL',[_0x228505[_0x7673('0x1c8')],_0x228505[_0x7673('0xa9')]]);if(_0x14651b[_0x7673('0xab')]===-0x1){return _0x14651b;}return this[_0x7673('0xa')][_0x7673('0xa7')](util[_0x7673('0x27')](_0x7673('0xc0'),'VOICEMAIL',_0x228505[_0x7673('0x1c8')]));};AGIVertices['prototype'][_0x7673('0x1c9')]=function(_0x256d05){logger['info'](util['format'](_0x7673('0x1ca'),_0x256d05['label']));if(!this['isConfigured'](_0x256d05[_0x7673('0xd6')])){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x256d05,_0x7673('0x1a4'));}var _0x56d278=this[_0x7673('0xd')]['sync'](this,_0x256d05[_0x7673('0xd6')]);if(!_0x56d278){return this[_0x7673('0xa')][_0x7673('0x2b')](_0x256d05,_0x7673('0xd8'));}var _0x2b01e5=this[_0x7673('0xa')][_0x7673('0xd')](_0x56d278);return{'code':0xc8,'result':_0x2b01e5['extra']?_0x2b01e5[_0x7673('0x9f')]:'-'};};String[_0x7673('0xc')][_0x7673('0x9e')]=function(_0xa007ae,_0x5c13c4){return this[_0x7673('0x9d')](_0xa007ae)[_0x7673('0x1cb')](_0x5c13c4);};module[_0x7673('0x1cc')]=AGIVertices; \ No newline at end of file +var _0x85d0=['number','includes','PUT','method','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','headers','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','stringify','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','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','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','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','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','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','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','toUpperCase','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','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','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','file_id','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getSound','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','sayDigits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','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','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','host','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','unlink','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','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','exports','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','getSoundPath','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','dnid','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x85d0,0x164));var _0x085d=function(_0x111a62,_0x3b0866){_0x111a62=_0x111a62-0x0;var _0x9cdcb7=_0x85d0[_0x111a62];return _0x9cdcb7;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x085d('0x0'));var moment=require(_0x085d('0x1'));var Mustache=require(_0x085d('0x2'));var rp=require(_0x085d('0x3'));var logger=require(_0x085d('0x4'))(_0x085d('0x5'));var config=require('../../config/environment');var scripts=require(_0x085d('0x6'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x085d('0x7'),_0x085d('0x8')];var verticesWithRetry=[_0x085d('0x9'),'getdigits',_0x085d('0xa')];var AGIVertices=function(_0xa94124,_0x210aa0,_0x3129a8){this[_0x085d('0xb')]=_0xa94124;this[_0x085d('0xc')]=_0x210aa0;this[_0x085d('0xd')]=_0x3129a8;};AGIVertices[_0x085d('0xe')][_0x085d('0xf')]=function(_0x572c9d,_0x764e2b){this[_0x085d('0xc')][_0x085d('0x10')](_0x572c9d)[_0x085d('0x11')](function(_0x4bc325){_0x764e2b(null,_0x4bc325?_0x4bc325[_0x085d('0x12')]:![]);})[_0x085d('0x13')](function(_0x5c6c27){_0x764e2b(_0x5c6c27);});};AGIVertices[_0x085d('0xe')][_0x085d('0x14')]=function(_0x2f2b93,_0x6b21d1){this['rpc'][_0x085d('0x15')](_0x2f2b93)[_0x085d('0x11')](function(_0x5ac8bb){_0x6b21d1(null,_0x5ac8bb?_0x5ac8bb['name']:![]);})[_0x085d('0x13')](function(_0x334263){_0x6b21d1(_0x334263);});};AGIVertices[_0x085d('0xe')][_0x085d('0x16')]=function(_0x309c15,_0x5ed56a){this[_0x085d('0xc')][_0x085d('0x17')](_0x309c15)[_0x085d('0x11')](function(_0x1b0a6c){_0x5ed56a(null,_0x1b0a6c?_0x1b0a6c[_0x085d('0x12')]:![]);})[_0x085d('0x13')](function(_0x5c046e){_0x5ed56a(_0x5c046e);});};AGIVertices[_0x085d('0xe')][_0x085d('0x18')]=function(_0x5c8232,_0xba531c){this[_0x085d('0xc')][_0x085d('0x19')](_0x5c8232)[_0x085d('0x11')](function(_0x3bb427){_0xba531c(null,_0x3bb427?_0x3bb427['dsn']:![]);})[_0x085d('0x13')](function(_0x5fd5f){_0xba531c(_0x5fd5f);});};AGIVertices[_0x085d('0xe')][_0x085d('0x1a')]=function(_0x4cf0e1,_0x5b3f9c){this['rpc'][_0x085d('0x1b')](_0x4cf0e1)[_0x085d('0x11')](function(_0x10735c){_0x5b3f9c(null,_0x10735c?_0x10735c[_0x085d('0x12')]:![]);})[_0x085d('0x13')](function(_0x17dafb){_0x5b3f9c(_0x17dafb);});};AGIVertices['prototype'][_0x085d('0x1c')]=function(_0x27b36a,_0x329703){this['rpc'][_0x085d('0x1d')](_0x27b36a)[_0x085d('0x11')](function(_0xbacfbc){_0x329703(null,_0xbacfbc?_0xbacfbc[_0x085d('0x12')]:![]);})[_0x085d('0x13')](function(_0x4b9032){_0x329703(_0x4b9032);});};AGIVertices['prototype']['getSound']=function(_0x16614,_0x102dfc){var _0x402440=this;this['rpc'][_0x085d('0x1e')](_0x16614)[_0x085d('0x11')](function(_0x3faf6b){_0x102dfc(null,_0x3faf6b?_0x402440['getSoundPath'](_0x3faf6b[_0x085d('0x1f')]):![]);})[_0x085d('0x13')](function(_0x3f905d){_0x102dfc(_0x3f905d);});};AGIVertices[_0x085d('0xe')]['getMailAccount']=function(_0x318cab,_0x580c40){this['rpc'][_0x085d('0x20')](_0x318cab)[_0x085d('0x11')](function(_0x4b0066){_0x580c40(null,_0x4b0066?_0x4b0066:![]);})[_0x085d('0x13')](function(_0x903b71){_0x580c40(_0x903b71);});};AGIVertices[_0x085d('0xe')]['sendMailMessage']=function(_0x30b632,_0x36bd27,_0x1e5cae){this['mailRpc'][_0x085d('0x21')](_0x30b632,_0x36bd27)['then'](function(){_0x1e5cae(null);})[_0x085d('0x13')](function(_0xf16df){_0x1e5cae(_0xf16df);});};AGIVertices[_0x085d('0xe')][_0x085d('0x22')]=function(_0x5c71f3,_0x1f6f72){this[_0x085d('0xc')][_0x085d('0x23')](_0x5c71f3)[_0x085d('0x11')](function(_0x54e579){if(_0x54e579){if(_0x54e579['IntervalId']){_0x1f6f72(null,[_0x54e579[_0x085d('0x24')]]);}else{_0x1f6f72(null,_[_0x085d('0x25')](_0x54e579[_0x085d('0x26')],_0x085d('0x24')));}}else{_0x1f6f72(null,![]);}})[_0x085d('0x13')](function(_0x2f2b65){_0x1f6f72(_0x2f2b65);});};AGIVertices[_0x085d('0xe')][_0x085d('0x27')]=function(_0x16e977){return util['format'](_0x085d('0x28'),FILES_PATH,_0x16e977);};AGIVertices[_0x085d('0xe')]['getQueryOdbc']=function(_0x254a9b,_0x5c82ef,_0x1cc755){odbc[_0x085d('0x29')](_0x254a9b,function(_0x4aed62){if(_0x4aed62){logger[_0x085d('0x2a')](_0x085d('0x2b'),_0x4aed62);_0x1cc755(_0x4aed62);}else{logger[_0x085d('0x2c')](_0x085d('0x2d'));odbc[_0x085d('0x2e')](_0x5c82ef,function(_0x58963f,_0x3fc23c){if(_0x58963f){logger['info']('Error\x20executing\x20query\x20%s',_0x5c82ef);_0x1cc755(_0x58963f);}else{logger[_0x085d('0x2c')](_0x085d('0x2f'),_0x5c82ef);odbc[_0x085d('0x30')](function(_0x7b1d2f){if(_0x7b1d2f){logger[_0x085d('0x2a')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x7b1d2f);}_0x1cc755(null,_0x3fc23c);});}});}});};AGIVertices[_0x085d('0xe')]['getSmsAccount']=function(_0x3a8646,_0x65ec6d){this[_0x085d('0xc')]['getSmsAccountById'](_0x3a8646)[_0x085d('0x11')](function(_0x55d81a){_0x65ec6d(null,_0x55d81a?_0x55d81a:![]);})[_0x085d('0x13')](function(_0x284172){_0x65ec6d(_0x284172);});};AGIVertices['prototype'][_0x085d('0x31')]=function(_0x23c52a,_0x20586e){this['rpc']['createSmsMessage'](_0x23c52a)[_0x085d('0x11')](function(_0x1f1e1f){_0x20586e(null,_0x1f1e1f);})[_0x085d('0x13')](function(_0x336361){_0x20586e(_0x336361);});};AGIVertices[_0x085d('0xe')][_0x085d('0x32')]=function(_0x27e1c7,_0x120980,_0x2978a1){this[_0x085d('0xc')]['createSquareDetailsReport']({'uniqueid':this['channel'][_0x085d('0x33')],'node':_0x27e1c7[_0x085d('0x34')],'application':_0x27e1c7[_0x085d('0x35')],'data':_0x120980||null,'project_name':this[_0x085d('0xb')][_0x085d('0x36')],'callerid':this[_0x085d('0xb')][_0x085d('0x37')]})[_0x085d('0x11')](function(_0x1041ff){if(_0x2978a1){_0x2978a1(null,_0x1041ff);}})[_0x085d('0x13')](function(_0x20a4ef){if(_0x2978a1){_0x2978a1(_0x20a4ef);}});};AGIVertices['prototype'][_0x085d('0x38')]=function(_0x318896,_0x1df88b,_0x399015,_0x39d3ac){this['rpc'][_0x085d('0x38')]({'uniqueid':this['channel'][_0x085d('0x33')],'callerid':this['channel']['callerid'],'calleridname':this[_0x085d('0xb')][_0x085d('0x39')],'context':this[_0x085d('0xb')][_0x085d('0x3a')],'extension':this[_0x085d('0xb')]['extension'],'priority':this['channel']['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0x085d('0xb')][_0x085d('0x3b')],'projectName':this['channel'][_0x085d('0x36')],'saveName':_0x1df88b,'filename':_0x318896['file']||_0x1df88b,'savePath':_0x399015})['then'](function(_0x415a4b){_0x39d3ac(null,_0x415a4b);})[_0x085d('0x13')](function(_0x1da4b8){_0x39d3ac(_0x1da4b8);});};AGIVertices[_0x085d('0xe')]['createSquareMessage']=function(_0x22216c,_0x5ec8dc,_0x43225a,_0x458c54,_0x5d6f22){this[_0x085d('0xc')][_0x085d('0x3c')]({'uniqueid':this[_0x085d('0xb')][_0x085d('0x33')],'body':_0x22216c,'direction':_0x5ec8dc,'providerName':_0x43225a,'providerResponse':_0x458c54})['then'](function(_0x256103){if(_0x5d6f22){_0x5d6f22(null,_0x256103);}})['catch'](function(_0x24dd9c){if(_0x5d6f22){_0x5d6f22(_0x24dd9c);}});};AGIVertices['prototype']['createCmContact']=function(_0x1212e6,_0x41e3e0){this[_0x085d('0xc')][_0x085d('0x3d')]({'firstName':_[_0x085d('0x3e')](_0x1212e6[_0x085d('0x12')])||_[_0x085d('0x3f')](_0x1212e6[_0x085d('0x12')])?'callback_'+Math['random']():_0x1212e6['name'],'lastName':_[_0x085d('0x3e')](_0x1212e6['lastName'])||_[_0x085d('0x3f')](_0x1212e6['lastName'])?null:_0x1212e6[_0x085d('0x40')],'phone':_0x1212e6[_0x085d('0x41')],'ListId':_0x1212e6[_0x085d('0x42')],'scheduledat':_0x1212e6[_0x085d('0x43')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x085d('0x44'),'description':_0x085d('0x45')+_0x1212e6['scheduledAt'][_0x085d('0x46')](),'priority':_0x1212e6[_0x085d('0x47')]})[_0x085d('0x11')](function(_0x2af16a){_0x41e3e0(null,_0x2af16a);})[_0x085d('0x13')](function(_0xc5464e){_0x41e3e0(_0xc5464e);});};AGIVertices[_0x085d('0xe')][_0x085d('0x48')]=function(_0x483f75,_0x3e5a65){this['rpc'][_0x085d('0x49')](_0x483f75)['then'](function(_0x258405){_0x3e5a65(null,_0x258405?_0x258405['name']:![]);})[_0x085d('0x13')](function(_0x183932){_0x3e5a65(_0x183932);});};AGIVertices['prototype']['agentPause']=function(_0x313506,_0x237070,_0x31e99f){var _0x43ce84={'role':_0x085d('0x4a')};_0x43ce84[_0x313506]=this[_0x085d('0xb')][_0x085d('0x37')];this[_0x085d('0xc')][_0x085d('0x4b')](_0x43ce84,_0x237070,this[_0x085d('0xb')][_0x085d('0x33')])[_0x085d('0x11')](function(_0x2b7744){_0x31e99f(null,_[_0x085d('0x3f')](_0x2b7744)?![]:!![]);})['catch'](function(_0x595ba0){logger[_0x085d('0x2a')](_0x595ba0);_0x31e99f(null,![]);});};AGIVertices[_0x085d('0xe')]['agentUnpause']=function(_0x5b89e1,_0x4e695e){var _0xbd6325={'role':_0x085d('0x4a')};_0xbd6325[_0x5b89e1]=this['channel'][_0x085d('0x37')];this[_0x085d('0xc')][_0x085d('0x4c')](_0xbd6325)['then'](function(_0x73e470){_0x4e695e(null,_[_0x085d('0x3f')](_0x73e470)?![]:!![]);})[_0x085d('0x13')](function(_0xc3cb69){logger['error'](_0xc3cb69);_0x4e695e(null,![]);});};AGIVertices[_0x085d('0xe')][_0x085d('0x4d')]=function(_0x5cf5e9,_0x34eb37){var _0x375779={'role':_0x085d('0x4a')};_0x375779[_0x5cf5e9]=this['channel']['callerid'];this['rpc'][_0x085d('0x4d')](_0x375779)[_0x085d('0x11')](function(_0x53bc2e){_0x34eb37(null,_[_0x085d('0x3f')](_0x53bc2e)?![]:!![]);})['catch'](function(_0x376d73){logger[_0x085d('0x2a')](_0x376d73);_0x34eb37(null,![]);});};AGIVertices['prototype'][_0x085d('0x4e')]=function(_0x2af674,_0x5cbc5a){var _0x1a2930={'role':_0x085d('0x4a')};_0x1a2930[_0x2af674]=this[_0x085d('0xb')][_0x085d('0x37')];var _0x52e168=_0x2af674!='internal'?util[_0x085d('0x4f')](_0x085d('0x50'),_0x085d('0x51'),this[_0x085d('0xb')]['callerid']):undefined;this['rpc']['agentLogin'](_0x1a2930,_0x52e168)[_0x085d('0x11')](function(_0x582270){_0x5cbc5a(null,_['isNil'](_0x582270)?![]:!![]);})[_0x085d('0x13')](function(_0x546bbc){logger[_0x085d('0x2a')](_0x546bbc);_0x5cbc5a(null,![]);});};AGIVertices[_0x085d('0xe')][_0x085d('0x52')]=function(_0x1f11c2,_0x557bc3){sh[_0x085d('0x53')](_[_0x085d('0x54')](_0x1f11c2),function(_0x26d0a1,_0x7f5541){var _0x28b92f=_0x7f5541[_0x085d('0x55')](/(\r\n|\n|\r)/gm,'');_0x557bc3(null,_0x28b92f);});};AGIVertices[_0x085d('0xe')][_0x085d('0x56')]=function(_0x3d7e64,_0xaeadce){scripts['googleCloudTTS'](_0x3d7e64['apiKey'],_0x3d7e64[_0x085d('0x57')]||_0x085d('0x58'),_0x3d7e64['text'],_0x3d7e64[_0x085d('0x59')]||_0x085d('0x5a'),_0x3d7e64[_0x085d('0x5b')]||_0x085d('0x5c'),_0x3d7e64[_0x085d('0x5d')]||_0x085d('0x5e'))[_0x085d('0x11')](function(_0x4256d5){_0xaeadce(null,_0x4256d5);})[_0x085d('0x13')](function(_0x351a3d){_0xaeadce(_0x351a3d);});};AGIVertices[_0x085d('0xe')][_0x085d('0x5f')]=function(_0xf885e1,_0x2c60cf){scripts[_0x085d('0x5f')](_0xf885e1[_0x085d('0x58')],_0xf885e1[_0x085d('0x60')]||'en',0x1)['then'](function(_0x2b214f){_0x2c60cf(null,_0x2b214f);})[_0x085d('0x13')](function(_0x178af1){_0x2c60cf(_0x178af1);});};AGIVertices['prototype'][_0x085d('0x61')]=function(_0x4de098,_0x53fd1b){var _0x261ac7={'uri':_0x4de098[_0x085d('0x62')],'method':_0x4de098['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4de098[_0x085d('0x63')])===_0x085d('0x64')&&parseInt(_0x4de098[_0x085d('0x63')])>=0x1?parseInt(_0x4de098[_0x085d('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x085d('0x65')](['POST',_0x085d('0x66')],_0x261ac7[_0x085d('0x67')]['toUpperCase']())){try{_0x261ac7['body']=_0x4de098[_0x085d('0x8')]?JSON['parse'](_0x4de098[_0x085d('0x8')]):{};}catch(_0x10c5f9){logger[_0x085d('0x2a')](_0x085d('0x68'),_0x10c5f9);}}try{_0x261ac7['headers']=_0x4de098['rawHeaders']?JSON[_0x085d('0x69')](_0x4de098[_0x085d('0x7')]):{};}catch(_0x1de071){logger['error'](_0x085d('0x6a'),_0x1de071);}if(_0x4de098['computedVariables']){try{var _0x2f78b6=require(_0x4de098[_0x085d('0x6b')])[_0x085d('0x6c')](this,_0x261ac7);_0x261ac7['uri']=Mustache[_0x085d('0x6d')](_0x4de098['url'],_0x2f78b6,{},['$$','$$']);if(_0x261ac7[_0x085d('0x6e')]){_0x261ac7[_0x085d('0x6e')]=JSON[_0x085d('0x69')](Mustache['render'](JSON['stringify'](_0x261ac7[_0x085d('0x6e')]),_0x2f78b6,{},['$$','$$']));}if(_0x261ac7[_0x085d('0x6f')]){_0x261ac7[_0x085d('0x6f')]=JSON[_0x085d('0x69')](Mustache['render'](JSON['stringify'](_0x261ac7['body']),_0x2f78b6,{},['$$','$$']));}}catch(_0x143289){logger[_0x085d('0x2a')](_0x085d('0x70'),_0x143289);}}rp(_0x261ac7)['then'](function(_0x5baac1){var _0x31802d={'statusCode':_0x5baac1[_0x085d('0x71')]||0xc8,'statusMessage':_0x5baac1[_0x085d('0x72')]||'OK','headers':_0x5baac1['headers']||{},'body':_0x5baac1[_0x085d('0x6f')]||{}};_0x53fd1b(null,_0x31802d);})['catch'](function(_0x2300a5){var _0x3908bf={'statusCode':_0x2300a5['statusCode']||0x1f4,'statusMessage':_0x2300a5[_0x085d('0x73')]||_0x085d('0x74'),'headers':_0x2300a5[_0x085d('0x75')]['headers']||{},'body':_0x2300a5[_0x085d('0x75')][_0x085d('0x6f')]||{}};_0x53fd1b(null,_0x3908bf);});};AGIVertices[_0x085d('0xe')][_0x085d('0x76')]=function(_0x2de70b,_0x562711){scripts[_0x085d('0x76')](this[_0x085d('0xb')][_0x085d('0x33')],_0x2de70b['key'],_0x2de70b[_0x085d('0x58')],_0x2de70b[_0x085d('0x77')]||'en')[_0x085d('0x11')](function(_0x38d2dd){_0x562711(null,_0x38d2dd);})[_0x085d('0x13')](function(_0xcdc93e){_0x562711(_0xcdc93e);});};AGIVertices[_0x085d('0xe')][_0x085d('0x78')]=function(_0x57706d,_0x1f3144){scripts['googleDialogflowV2'](this['channel'][_0x085d('0x33')],_0x57706d[_0x085d('0x79')],_0x57706d[_0x085d('0x7a')],_0x57706d[_0x085d('0x7b')],_0x57706d[_0x085d('0x58')],_0x57706d[_0x085d('0x7c')]||'en')[_0x085d('0x11')](function(_0x22a749){_0x1f3144(null,_0x22a749);})['catch'](function(_0x223858){_0x1f3144(_0x223858);});};AGIVertices[_0x085d('0xe')][_0x085d('0x7d')]=function(_0x4fec3f,_0x28f9a1){scripts[_0x085d('0x7d')](this[_0x085d('0xb')],_0x4fec3f)[_0x085d('0x11')](function(_0x4d8c25){_0x28f9a1(null,_0x4d8c25);})[_0x085d('0x13')](function(_0x5d86b3){_0x28f9a1(_0x5d86b3);});};AGIVertices[_0x085d('0xe')][_0x085d('0x7e')]=function(_0x43ad61,_0x5c92f7){scripts[_0x085d('0x7e')](_0x43ad61[_0x085d('0x7f')],_0x43ad61[_0x085d('0x58')],_0x43ad61['ispeech_tts_language']||_0x085d('0x5a'),_0x43ad61[_0x085d('0x80')])[_0x085d('0x11')](function(_0x5095d2){_0x5c92f7(null,_0x5095d2);})[_0x085d('0x13')](function(_0x397f6f){_0x5c92f7(_0x397f6f);});};AGIVertices[_0x085d('0xe')][_0x085d('0x81')]=function(_0x5ddaa3,_0x8dbaf0,_0xb23019){scripts[_0x085d('0x81')](_0x8dbaf0,_0x5ddaa3[_0x085d('0x7f')],_0x5ddaa3[_0x085d('0x82')]||'en-US',this[_0x085d('0x83')](_0x5ddaa3[_0x085d('0x84')])?_0x5ddaa3[_0x085d('0x84')]:undefined)[_0x085d('0x11')](function(_0x1ea8a3){_0xb23019(null,_0x1ea8a3);})[_0x085d('0x13')](function(_0x1811c7){_0xb23019(_0x1811c7);});};AGIVertices[_0x085d('0xe')][_0x085d('0x85')]=function(_0x52ba3b,_0x58d940){scripts[_0x085d('0x85')](_0x52ba3b[_0x085d('0x86')],_0x52ba3b[_0x085d('0x87')],_0x52ba3b['aws_polly_region'],_0x52ba3b['aws_polly_voice']||'Amy',_0x52ba3b[_0x085d('0x58')],_0x52ba3b[_0x085d('0x88')]||'text')[_0x085d('0x11')](function(_0x802f6f){_0x58d940(null,_0x802f6f);})[_0x085d('0x13')](function(_0x101e5e){_0x58d940(_0x101e5e);});};AGIVertices[_0x085d('0xe')][_0x085d('0x89')]=function(_0x85b1ef,_0x389066){scripts[_0x085d('0x89')](this[_0x085d('0xb')]['uniqueid'],_0x85b1ef['aws_access_key_id'],_0x85b1ef[_0x085d('0x87')],_0x85b1ef['aws_lex_region'],_0x85b1ef[_0x085d('0x58')],_0x85b1ef[_0x085d('0x8a')])[_0x085d('0x11')](function(_0x5da87f){_0x389066(null,_0x5da87f);})['catch'](function(_0x337041){_0x389066(_0x337041);});};AGIVertices[_0x085d('0xe')][_0x085d('0x8b')]=function(_0x7b501,_0x1d2895,_0x227516){scripts[_0x085d('0x8b')](_0x1d2895,_0x7b501['key'],_0x7b501[_0x085d('0x8c')]||'en-US')[_0x085d('0x11')](function(_0x4695d8){_0x227516(null,_0x4695d8);})[_0x085d('0x13')](function(_0x285e8f){_0x227516(_0x285e8f);});};AGIVertices['prototype'][_0x085d('0x8d')]=function(_0x356081,_0x537fe7,_0x17860e){scripts['tildeASR'](_0x537fe7,_0x356081[_0x085d('0x8e')],_0x356081[_0x085d('0x8f')],_0x356081['uri'])[_0x085d('0x11')](function(_0x29119d){_0x17860e(null,_0x29119d);})[_0x085d('0x13')](function(_0xc5b63b){_0x17860e(_0xc5b63b);});};AGIVertices['prototype'][_0x085d('0x90')]=function(_0x2d56f1){var _0x50f3b4=_['includes'](verticesWithRetry,_0x2d56f1[_0x085d('0x35')])?_0x2d56f1:_[_0x085d('0x91')](_0x2d56f1);for(var _0x4a71d9 in _0x50f3b4){if(_0x50f3b4[_0x085d('0x92')](_0x4a71d9)){if(_0x50f3b4[_0x4a71d9]&&_[_0x085d('0x93')](_0x50f3b4[_0x4a71d9])){if(_['includes'](recursiveMapAttributes,_0x4a71d9)){_0x50f3b4[_0x4a71d9]=this[_0x085d('0x94')](_0x50f3b4[_0x4a71d9]);}else{_0x50f3b4[_0x4a71d9]=this[_0x085d('0x95')](_0x50f3b4[_0x4a71d9]);}}}}return _0x50f3b4;};AGIVertices['prototype'][_0x085d('0x96')]=function(_0x4fe369){for(var _0x411e39 in _0x4fe369){if(_0x4fe369[_0x085d('0x92')](_0x411e39)){if(_['isPlainObject'](_0x4fe369[_0x411e39])){this[_0x085d('0x96')](_0x4fe369[_0x411e39]);}else if(_[_0x085d('0x97')](_0x4fe369[_0x411e39])){for(var _0x1819c0=0x0;_0x1819c0<_0x4fe369[_0x411e39]['length'];_0x1819c0++){this[_0x085d('0x96')](_0x4fe369[_0x411e39][_0x1819c0]);}}else if(_[_0x085d('0x93')](_0x4fe369[_0x411e39])){_0x4fe369[_0x411e39]=this[_0x085d('0x95')](_0x4fe369[_0x411e39]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x22d084,_0x5f36d7){for(var _0x5551d0 in _0x22d084){if(_0x22d084['hasOwnProperty'](_0x5551d0)){if(_['isPlainObject'](_0x22d084[_0x5551d0])){if(!_[_0x085d('0x3e')](_0x22d084[_0x5551d0])){this[_0x085d('0x98')](_0x22d084[_0x5551d0],util[_0x085d('0x4f')](_0x085d('0x99'),_0x5f36d7,_0x5551d0));}}else if(_[_0x085d('0x97')](_0x22d084[_0x5551d0])){for(var _0xfb8013=0x0;_0xfb8013<_0x22d084[_0x5551d0][_0x085d('0x9a')];_0xfb8013++){this[_0x085d('0x98')](_0x22d084[_0x5551d0][_0xfb8013],util[_0x085d('0x4f')](_0x085d('0x99'),_0x5f36d7,_0x5551d0+'['+_0xfb8013+']'));}}else{if(!_[_0x085d('0x3f')](_0x22d084[_0x5551d0])){this[_0x085d('0xb')][_0x085d('0x9b')](util['format'](_0x085d('0x99'),_0x5f36d7,_0x5551d0),_0x22d084[_0x5551d0]);}}}}};AGIVertices[_0x085d('0xe')][_0x085d('0x94')]=function(_0x3b44e4){try{var _0x53d995=JSON[_0x085d('0x69')](_0x3b44e4);this['recursiveNodeIndex'](_0x53d995);return JSON[_0x085d('0x9c')](_0x53d995);}catch(_0xc739ab){return this[_0x085d('0x95')](_0x3b44e4);}};AGIVertices[_0x085d('0xe')][_0x085d('0x95')]=function(_0x2f013e){var _0x4109e8=_0x2f013e['split']('{');for(var _0x526724=0x1;_0x526724<_0x4109e8['length'];_0x526724+=0x1){var _0x2b39d1=_0x4109e8[_0x526724][_0x085d('0x9d')]('}');if(_0x2b39d1['length']>0x1){_0x2f013e=_0x2f013e['replaceAll']('{'+_0x2b39d1[0x0]+'}',this[_0x085d('0xb')]['getVariable'](_0x2b39d1[0x0])[_0x085d('0x9e')]||_0x2b39d1[0x0]);}}if(_0x4109e8[_0x085d('0x9a')]===0x1){return _0x2f013e['toString']();}return this[_0x085d('0x95')](_0x2f013e);};AGIVertices[_0x085d('0xe')][_0x085d('0x9f')]=function(_0x445dad,_0x32f9d8){var _0x5297bf=this[_0x085d('0xb')]['getVariable'](_0x445dad);if(_0x5297bf[_0x085d('0xa0')]===-0x1){return _0x5297bf;}logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xa1'),_0x32f9d8,_0x5297bf['extra']));return this[_0x085d('0xb')][_0x085d('0x9b')](_0x32f9d8,_0x5297bf[_0x085d('0x9e')]);};AGIVertices['prototype'][_0x085d('0x83')]=function(_0x8bd318){return _0x8bd318&&_0x8bd318!=='0'&&_0x8bd318!=='-1'&&_0x8bd318!=='';};AGIVertices[_0x085d('0xe')][_0x085d('0xa2')]=function(_0x42b5dd){this['createSquareDetailsReport'][_0x085d('0x6c')](this,_0x42b5dd,'-');_0x42b5dd[_0x085d('0xa3')]=_0x42b5dd['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x085d('0xe')]['mrcpsynth']=function(_0xb1eb39){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xa4'),_0xb1eb39[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0xb1eb39[_0x085d('0x58')])){return this[_0x085d('0xb')]['noop'](_0x085d('0xa5'));}var _0x35c12d='\x22'+_0xb1eb39[_0x085d('0x58')]+'\x22';if(this['isConfigured'](_0xb1eb39[_0x085d('0x75')])){_0x35c12d+=','+_0xb1eb39[_0x085d('0x75')];}var _0x23615a=this['channel']['exec'](_0x085d('0xa6'),_0x35c12d);if(_0x23615a[_0x085d('0xa0')]===-0x1){return _0x23615a;}return this[_0x085d('0xb')][_0x085d('0xa7')](util['format'](_0x085d('0xa8'),_0x35c12d));};AGIVertices[_0x085d('0xe')][_0x085d('0xa9')]=function(_0x3ea23d){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xaa'),_0x3ea23d[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x3ea23d[_0x085d('0xab')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xac'));}var _0x11833f=_0x3ea23d[_0x085d('0xab')];if(this[_0x085d('0x83')](_0x3ea23d[_0x085d('0x75')])){_0x11833f+=','+_0x3ea23d['options'];}var _0x38ac41=this[_0x085d('0xb')][_0x085d('0x53')](_0x085d('0xad'),_0x11833f);if(_0x38ac41[_0x085d('0xa0')]===-0x1){return _0x38ac41;}var _0x3d3c75=this[_0x085d('0x9f')](_0x085d('0xae'),_0x085d('0xaf'));if(_0x3d3c75[_0x085d('0xa0')]===-0x1){return _0x3d3c75;}var _0x3b5724=this[_0x085d('0x9f')]('RECOG_INPUT()',_0x085d('0xb0'));if(_0x3b5724['result']===-0x1){return _0x3b5724;}var _0x4fced0=this[_0x085d('0x9f')]('RECOG_INSTANCE()',_0x085d('0xb1'));if(_0x4fced0['result']===-0x1){return _0x4fced0;}return this[_0x085d('0xb')][_0x085d('0xa7')](util['format'](_0x085d('0xb2'),_0x11833f));};AGIVertices['prototype'][_0x085d('0x5')]=function(_0x497198){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xb3'),_0x497198[_0x085d('0x34')]));return this[_0x085d('0xb')]['agi']([_0x497198[_0x085d('0xb4')],_0x497198[_0x085d('0xb5')]]);};AGIVertices[_0x085d('0xe')]['answer']=function(_0x139ded){logger[_0x085d('0x2c')](util['format'](_0x085d('0xb6'),_0x139ded[_0x085d('0x34')]));if(this[_0x085d('0x83')](_0x139ded[_0x085d('0x63')])){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xb7'),_0x139ded[_0x085d('0x63')]));var _0x300319=this[_0x085d('0xb')]['wait'](_0x139ded[_0x085d('0x63')]);if(_0x300319[_0x085d('0xa0')]===-0x1){return _0x300319;}}return this[_0x085d('0xb')][_0x085d('0xb8')]();};AGIVertices[_0x085d('0xe')][_0x085d('0x44')]=function(_0x26f992){logger[_0x085d('0x2c')](util[_0x085d('0x4f')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x26f992[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x26f992[_0x085d('0x42')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x26f992,_0x085d('0xb9'));}_0x26f992[_0x085d('0x43')]=moment();if(this[_0x085d('0x83')](_0x26f992[_0x085d('0xba')])){_0x26f992[_0x085d('0x43')]=moment()[_0x085d('0xbb')](_0x26f992['delay'],_0x085d('0xbc'));}if(!this[_0x085d('0x83')](_0x26f992[_0x085d('0x47')])){_0x26f992['callback_priority']=0x2;}this['createCmContact'][_0x085d('0x6c')](this,_0x26f992);return this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0xbd'),_0x26f992[_0x085d('0x41')],_0x26f992[_0x085d('0x42')],_0x26f992[_0x085d('0x43')]));};AGIVertices[_0x085d('0xe')]['custom_app']=function(_0x14f47f){logger[_0x085d('0x2c')](util['format'](_0x085d('0xbe'),_0x14f47f[_0x085d('0x34')]));var _0x354645=this[_0x085d('0xb')]['exec'](_0x14f47f[_0x085d('0xbf')],_0x14f47f[_0x085d('0x75')]);if(_0x354645['result']===-0x1){return _0x354645;}return this[_0x085d('0xb')][_0x085d('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0x14f47f[_0x085d('0xbf')],_0x14f47f[_0x085d('0x75')]));};AGIVertices[_0x085d('0xe')][_0x085d('0xc0')]=function(_0x1e41fc){logger[_0x085d('0x2c')](util['format'](_0x085d('0xc1'),_0x1e41fc['label']));if(!this[_0x085d('0x83')](_0x1e41fc['text'])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xa5'));}var _0x2abf11='\x22'+_0x1e41fc[_0x085d('0x58')]+'\x22';if(this[_0x085d('0x83')](_0x1e41fc['options'])){_0x2abf11+=','+_0x1e41fc[_0x085d('0x75')];}var _0x19f0c2=this[_0x085d('0xb')][_0x085d('0x53')](_0x085d('0xa6'),_0x2abf11);if(_0x19f0c2['result']===-0x1){return _0x19f0c2;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')]('Executed\x20command\x20MRCPSynth\x20%s',_0x2abf11));};AGIVertices['prototype'][_0x085d('0xc2')]=function(_0x2660f3){logger[_0x085d('0x2c')](util['format'](_0x085d('0xc3'),_0x2660f3[_0x085d('0x34')]));if(!this['isConfigured'](_0x2660f3[_0x085d('0x58')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xa5'));}var _0x5a036b='\x22'+_0x2660f3[_0x085d('0x58')]+'\x22';if(this[_0x085d('0x83')](_0x2660f3[_0x085d('0x75')])){_0x5a036b+=','+_0x2660f3[_0x085d('0x75')];}var _0x499198=this[_0x085d('0xb')][_0x085d('0x53')](_0x085d('0xa6'),_0x5a036b);if(_0x499198[_0x085d('0xa0')]===-0x1){return _0x499198;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xa8'),_0x5a036b));};AGIVertices['prototype']['lumenvoxasr']=function(_0x40547f){logger[_0x085d('0x2c')](util['format'](_0x085d('0xc4'),_0x40547f[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x40547f[_0x085d('0xab')])){return this[_0x085d('0xb')]['noop'](_0x085d('0xac'));}var _0x5f508d=_0x40547f['grammar'];if(this[_0x085d('0x83')](_0x40547f['options'])){_0x5f508d+=','+_0x40547f[_0x085d('0x75')];}var _0x40653d=this[_0x085d('0xb')][_0x085d('0x53')]('MRCPRecog',_0x5f508d);if(_0x40653d['result']===-0x1){return _0x40653d;}var _0x48b748=this[_0x085d('0x9f')](_0x085d('0xae'),_0x085d('0xc5'));if(_0x48b748[_0x085d('0xa0')]===-0x1){return _0x48b748;}var _0x4878f2=this[_0x085d('0x9f')](_0x085d('0xc6'),_0x085d('0xc7'));if(_0x4878f2[_0x085d('0xa0')]===-0x1){return _0x4878f2;}var _0x570366=this[_0x085d('0x9f')](_0x085d('0xc8'),_0x085d('0xc9'));if(_0x570366[_0x085d('0xa0')]===-0x1){return _0x570366;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xb2'),_0x5f508d));};AGIVertices[_0x085d('0xe')]['sestekasr']=function(_0x11e9ac){logger['info'](util[_0x085d('0x4f')](_0x085d('0xca'),_0x11e9ac[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x11e9ac['grammar'])){return this[_0x085d('0xb')][_0x085d('0xa7')]('no\x20grammar\x20configured');}var _0x50dd9b=_0x11e9ac[_0x085d('0xab')];if(this['isConfigured'](_0x11e9ac['options'])){_0x50dd9b+=','+_0x11e9ac['options'];}var _0x420686=this[_0x085d('0xb')][_0x085d('0x53')]('MRCPRecog',_0x50dd9b);if(_0x420686['result']===-0x1){return _0x420686;}var _0x5d417d=this[_0x085d('0x9f')](_0x085d('0xae'),_0x085d('0xcb'));if(_0x5d417d[_0x085d('0xa0')]===-0x1){return _0x5d417d;}var _0x2d2ee4=this['getAndSetVariable'](_0x085d('0xc6'),_0x085d('0xcc'));if(_0x2d2ee4[_0x085d('0xa0')]===-0x1){return _0x2d2ee4;}var _0x263f19=this['getAndSetVariable'](_0x085d('0xc8'),_0x085d('0xcd'));if(_0x263f19['result']===-0x1){return _0x263f19;}return this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0xb2'),_0x50dd9b));};AGIVertices['prototype']['database']=function(_0xf57977){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xce'),_0xf57977[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0xf57977[_0x085d('0xcf')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0xf57977,_0x085d('0xd0'));}var _0x4fd3be=this[_0x085d('0x18')][_0x085d('0x6c')](this,_0xf57977[_0x085d('0xcf')]);if(!_0x4fd3be){return this['channel'][_0x085d('0x2a')](_0xf57977,_0x085d('0xd1'));}if(!this[_0x085d('0x83')](_0xf57977['query'])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0xf57977,_0x085d('0xd2'));}var _0x4de652=_0xf57977['query'][_0x085d('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0xd3'),_0x4de652));var _0x197187=this[_0x085d('0xd4')][_0x085d('0x6c')](this,_0x4fd3be,_0x4de652);this[_0x085d('0x32')][_0x085d('0x6c')](this,_0xf57977,_0x4de652);if(!this[_0x085d('0x83')](_0xf57977[_0x085d('0xd5')])){return this[_0x085d('0xb')]['noop'](_0x085d('0xd6'));}var _0x2db634=this[_0x085d('0xf')][_0x085d('0x6c')](this,_0xf57977[_0x085d('0xd5')]);if(!_0x2db634){return this[_0x085d('0xb')]['error'](_0xf57977,_0x085d('0xd7'));}var _0x561459=this;_0x197187['forEach'](function(_0x84749b,_0x109891){Object[_0x085d('0xd8')](_0x84749b)[_0x085d('0xd9')](function(_0x580315){_0x561459[_0x085d('0xb')][_0x085d('0x9b')](util['format'](_0x085d('0xda'),_0x2db634,_0x109891,_0x580315),_0x84749b[_0x580315]);});});this['channel'][_0x085d('0x9b')](util[_0x085d('0x4f')]('%s_ROWS_COUNT',_0x2db634),_0x197187['length']);return this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xdb'),_0x2db634));};AGIVertices['prototype'][_0x085d('0xdc')]=function(_0x31b17b){logger[_0x085d('0xdd')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x31b17b[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x31b17b[_0x085d('0xde')])){return this['channel'][_0x085d('0x2a')](_0x31b17b,_0x085d('0xdf'));}var _0xd95388=this[_0x085d('0x1a')][_0x085d('0x6c')](this,_0x31b17b['sip_id']);if(!_0xd95388){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x31b17b,_0x085d('0xe0'));}var _0x3f7591=this[_0x085d('0xb')][_0x085d('0x53')](_0x085d('0xe1'),[util[_0x085d('0x4f')](_0x085d('0xe2'),_0xd95388),_0x31b17b['timeout'],_0x31b17b[_0x085d('0xe3')],_0x31b17b[_0x085d('0x62')]]);if(_0x3f7591['result']===-0x1){return _0x3f7591;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xe4'),_0x085d('0xe1')));};AGIVertices[_0x085d('0xe')]['dialogflow']=function(_0x45942b){logger['info'](util['format'](_0x085d('0xe5'),_0x45942b['label']));if(!this['isConfigured'](_0x45942b[_0x085d('0x7f')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xe6'));}if(!this[_0x085d('0x83')](_0x45942b[_0x085d('0x58')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xa5'));}this[_0x085d('0xb')][_0x085d('0xe7')]=!![];this[_0x085d('0x32')](_0x45942b);this[_0x085d('0x3c')](_0x45942b[_0x085d('0x58')],'in','','');this['channel']['noop'](util['format'](_0x085d('0xe8'),_0x45942b['text']));var _0x5247b1=this[_0x085d('0x76')][_0x085d('0x6c')](this,_0x45942b);if(_0x5247b1){for(var _0x2509ff in _0x5247b1){if(_0x5247b1[_0x085d('0x92')](_0x2509ff)){this['channel'][_0x085d('0x9b')](util['format'](_0x085d('0xe9'),_0x2509ff['toUpperCase']()),_0x5247b1[_0x2509ff]);}}this['createSquareMessage'](_0x5247b1[_0x085d('0xea')],'out',_0x085d('0xeb'),'');return this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xec'),_0x5247b1[_0x085d('0xea')]));}return this[_0x085d('0xb')][_0x085d('0x2a')](_0x45942b,_0x085d('0xed'));};AGIVertices[_0x085d('0xe')][_0x085d('0xee')]=function(_0x1b57eb){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0xef'),_0x1b57eb['label']));if(!this[_0x085d('0x83')](_0x1b57eb[_0x085d('0x79')])){return this['channel'][_0x085d('0xa7')]('no\x20project_id\x20configured');}if(!this[_0x085d('0x83')](_0x1b57eb['client_email'])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xf0'));}if(!this['isConfigured'](_0x1b57eb['private_key'])){return this['channel'][_0x085d('0xa7')](_0x085d('0xf1'));}if(!this['isConfigured'](_0x1b57eb[_0x085d('0x7c')])){return this['channel']['noop'](_0x085d('0xf2'));}if(!this[_0x085d('0x83')](_0x1b57eb[_0x085d('0x58')])){return this['channel'][_0x085d('0xa7')](_0x085d('0xa5'));}this[_0x085d('0xb')][_0x085d('0xe7')]=!![];this[_0x085d('0x32')](_0x1b57eb);this[_0x085d('0x3c')](_0x1b57eb[_0x085d('0x58')],'in','','');this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xf3'),_0x1b57eb[_0x085d('0x58')]));var _0x5719d1=this[_0x085d('0x78')][_0x085d('0x6c')](this,_0x1b57eb);if(_0x5719d1){for(var _0x314052 in _0x5719d1){if(_0x5719d1['hasOwnProperty'](_0x314052)){if(_0x314052!=='providerResponse'){this['channel'][_0x085d('0x9b')](util[_0x085d('0x4f')]('DIALOGFLOW_%s',_0x314052[_0x085d('0xf4')]()),_0x5719d1[_0x314052]);}}}this[_0x085d('0x3c')](_0x5719d1['speech'],_0x085d('0xf5'),_0x085d('0xee'),_0x5719d1[_0x085d('0xf6')]);return this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xf7'),_0x5719d1[_0x085d('0xea')]));}return this[_0x085d('0xb')][_0x085d('0x2a')](_0x1b57eb,_0x085d('0xf8'));};AGIVertices[_0x085d('0xe')][_0x085d('0xf9')]=function(_0x34f743){logger['info'](util[_0x085d('0x4f')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x34f743['label']));if(!this[_0x085d('0x83')](_0x34f743[_0x085d('0xfa')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xfb'));}if(!this[_0x085d('0x83')](_0x34f743[_0x085d('0xfc')])){return this['channel'][_0x085d('0xa7')](_0x085d('0xfd'));}if(!this[_0x085d('0x83')](_0x34f743[_0x085d('0xfe')])){return this[_0x085d('0xb')][_0x085d('0xa7')]('no\x20password\x20configured');}if(!this[_0x085d('0x83')](_0x34f743[_0x085d('0xff')])){return this[_0x085d('0xb')]['noop'](_0x085d('0xa5'));}this[_0x085d('0xb')][_0x085d('0xe7')]=!![];this[_0x085d('0x32')](_0x34f743);this[_0x085d('0x3c')](_0x34f743['text'],'in','','');this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x100'),_0x34f743['text']));var _0x3b5ba4=this[_0x085d('0x7d')][_0x085d('0x6c')](this,_0x34f743);if(_0x3b5ba4){for(var _0x560587 in _0x3b5ba4){if(_0x3b5ba4[_0x085d('0x92')](_0x560587)){this[_0x085d('0xb')][_0x085d('0x9b')](util[_0x085d('0x4f')](_0x085d('0x101'),_0x560587['toUpperCase']()),_0x3b5ba4[_0x560587]);}}this['createSquareMessage'](_0x3b5ba4[_0x085d('0xea')],_0x085d('0xf5'),'sesteknda','');if(_0x3b5ba4['audiofile']){this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0x102'),_0x3b5ba4[_0x085d('0x103')]));var _0x1d9b8e=this[_0x085d('0xb')][_0x085d('0x104')](_0x3b5ba4[_0x085d('0x103')]);try{fs['unlink'](_0x3b5ba4[_0x085d('0x103')]+_0x085d('0x105'));}catch(_0x56f5c5){logger[_0x085d('0x2a')](_0x56f5c5);}return _0x1d9b8e;}else{return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')]('SestekNDA\x20Result\x20%s',_0x3b5ba4[_0x085d('0xea')]));}}return this[_0x085d('0xb')][_0x085d('0x2a')](_0x34f743,_0x085d('0x106'));};AGIVertices[_0x085d('0xe')][_0x085d('0x107')]=function(_0x460610){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x108'),_0x460610['label']));return this[_0x085d('0xb')]['noop'](_0x085d('0x107'));};AGIVertices[_0x085d('0xe')][_0x085d('0x109')]=function(_0x209d48){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x10a'),_0x209d48[_0x085d('0x34')]));var _0x57c4a4='';if(_0x209d48[_0x085d('0x10b')]){if(!this[_0x085d('0x83')](_0x209d48[_0x085d('0x10b')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x209d48,_0x085d('0x10c'));}else{var _0x3463a4=parseInt(_0x209d48[_0x085d('0x10b')],0xa);if(isNaN(_0x3463a4)){_0x57c4a4=_0x209d48[_0x085d('0x10b')];}else{_0x57c4a4=this[_0x085d('0x1c')][_0x085d('0x6c')](this,_0x209d48[_0x085d('0x10b')]);if(!_0x57c4a4){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x209d48,_0x085d('0x10d'));}}}}else if(_0x209d48[_0x085d('0x10e')]){_0x57c4a4=_0x209d48['trunk_name'];}else{return this[_0x085d('0xb')][_0x085d('0x2a')](_0x209d48,'no\x20trunk\x20selected');}var _0x33a322=this[_0x085d('0xb')]['exec'](_0x085d('0xe1'),[util[_0x085d('0x4f')]('SIP/%s/%s',_0x57c4a4,_0x209d48[_0x085d('0x41')]),_0x209d48[_0x085d('0x63')],_0x209d48['opts'],_0x209d48['url']]);if(_0x33a322[_0x085d('0xa0')]===-0x1){return _0x33a322;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0xe4'),_0x085d('0xe1')));};AGIVertices[_0x085d('0xe')]['finally']=function(_0xab3aac){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x10f'),_0xab3aac[_0x085d('0x34')]));return this['channel'][_0x085d('0xa7')]('finally');};AGIVertices[_0x085d('0xe')][_0x085d('0x110')]=function(_0x521eb2){logger['info'](util[_0x085d('0x4f')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x521eb2[_0x085d('0x34')]));if(_0x521eb2[_0x085d('0xa3')]===0x0){return this[_0x085d('0xa2')](_0x521eb2);}_0x521eb2[_0x085d('0xa3')]-=0x1;if(!this[_0x085d('0x83')](_0x521eb2['file_id'])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x521eb2,'no\x20file\x20audio\x20selected');}var _0x326943=this['getSound']['sync'](this,_0x521eb2['file_id']);if(!_0x326943){return this['channel'][_0x085d('0x2a')](_0x521eb2,'no\x20file\x20audio\x20found');}if(!this[_0x085d('0x83')](_0x521eb2[_0x085d('0xd5')])){return this[_0x085d('0xb')][_0x085d('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x31911d=this[_0x085d('0xb')][_0x085d('0x111')](_0x326943,_0x521eb2[_0x085d('0x112')],_0x521eb2[_0x085d('0x113')]);var _0x5a1fb4=_0x31911d[_0x085d('0xa0')]?_0x31911d['result']['toString']():'';logger['info'](_0x085d('0x114'),JSON[_0x085d('0x9c')](_0x31911d));if(_0x31911d[_0x085d('0xa0')]===-0x1){this[_0x085d('0x32')][_0x085d('0x6c')](this,_0x521eb2,_0x5a1fb4);return _0x31911d;}else if(_0x31911d[_0x085d('0x9e')]==='timeout'){_0x31911d[_0x085d('0xa0')]=_0x5a1fb4[_0x085d('0x9a')]>=parseInt(_0x521eb2[_0x085d('0x115')])?'x':'i';}else{_0x31911d[_0x085d('0xa0')]=_0x5a1fb4[_0x085d('0x9a')]>=parseInt(_0x521eb2['mindigit'])&&_0x5a1fb4[_0x085d('0x9a')]<=parseInt(_0x521eb2[_0x085d('0x113')])?'x':'i';}var _0x12c74f=this['getVariable'][_0x085d('0x6c')](this,_0x521eb2[_0x085d('0xd5')]);if(!_0x12c74f){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x521eb2,_0x085d('0xd7'));}this[_0x085d('0xb')][_0x085d('0x9b')](_0x12c74f,_0x5a1fb4);if(this[_0x085d('0x83')](_0x521eb2['hiddendigitsnum'])){var _0x24f5a1=parseInt(_0x521eb2[_0x085d('0x116')],0xa);var _0x48e749=rs[_0x085d('0x117')]({'charset':'*','length':_0x24f5a1});var _0x2af835=_0x5a1fb4[_0x085d('0x9a')];if(_0x2af835>0x0){if(_0x2af835>_0x24f5a1){this['createSquareDetailsReport'][_0x085d('0x6c')](this,_0x521eb2,_0x521eb2[_0x085d('0x118')]==='first'?_0x48e749+_0x5a1fb4[_0x085d('0x119')](_0x24f5a1):_0x5a1fb4[_0x085d('0x119')](0x0,_0x2af835-_0x24f5a1)+_0x48e749);}else{this[_0x085d('0x32')][_0x085d('0x6c')](this,_0x521eb2,rs['generate']({'charset':'*','length':_0x2af835}));}}else{this[_0x085d('0x32')]['sync'](this,_0x521eb2,'');}}else{this[_0x085d('0x32')]['sync'](this,_0x521eb2,_0x5a1fb4);}return _0x31911d;};AGIVertices['prototype'][_0x085d('0xa')]=function(_0xffd5d3){logger[_0x085d('0x2c')](util['format'](_0x085d('0x11a'),_0xffd5d3[_0x085d('0x34')]));return this['getdigits'](_0xffd5d3);};AGIVertices['prototype'][_0x085d('0x11b')]=function(_0x1f31ac){logger['info'](util[_0x085d('0x4f')](_0x085d('0x11c'),_0x1f31ac[_0x085d('0x34')]));this['createSquareDetailsReport']['sync'](this,_0x1f31ac,_0x1f31ac[_0x085d('0x11d')]);return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x11e'),_0x1f31ac[_0x085d('0x11d')]));};AGIVertices[_0x085d('0xe')][_0x085d('0x11f')]=function(_0x22789a){logger['info'](util['format'](_0x085d('0x120'),_0x22789a[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x22789a['aws_access_key_id'])||!this[_0x085d('0x83')](_0x22789a[_0x085d('0x87')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0x121'));}if(!this['isConfigured'](_0x22789a[_0x085d('0x58')])){return this[_0x085d('0xb')]['noop']('no\x20text\x20configured');}this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x122'),_0x22789a[_0x085d('0x58')]));var _0x13d2f9=this[_0x085d('0x85')][_0x085d('0x6c')](this,_0x22789a);if(_0x13d2f9){this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x123'),_0x13d2f9));var _0x59b54b=this['channel'][_0x085d('0x104')](_0x13d2f9);try{fs['unlink'](_0x13d2f9+_0x085d('0x105'));}catch(_0x2b69f9){logger[_0x085d('0x2a')](_0x2b69f9);}return _0x59b54b;}return this['channel'][_0x085d('0x2a')](_0x22789a,_0x085d('0x124'));};AGIVertices['prototype']['awslex']=function(_0x2c4d68){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x125'),_0x2c4d68[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x2c4d68[_0x085d('0x86')])||!this[_0x085d('0x83')](_0x2c4d68[_0x085d('0x87')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0x121'));}if(!this[_0x085d('0x83')](_0x2c4d68[_0x085d('0x8a')])){return this[_0x085d('0xb')]['noop'](_0x085d('0x126'));}if(!this[_0x085d('0x83')](_0x2c4d68[_0x085d('0x58')])){return this['channel'][_0x085d('0xa7')](_0x085d('0xa5'));}this[_0x085d('0xb')][_0x085d('0xe7')]=!![];this[_0x085d('0x32')](_0x2c4d68);this['createSquareMessage'](_0x2c4d68[_0x085d('0x58')],'in','','');this['channel'][_0x085d('0xa7')](util['format'](_0x085d('0x127'),_0x2c4d68[_0x085d('0x58')]));var _0xaa768a=this[_0x085d('0x89')]['sync'](this,_0x2c4d68);if(_0xaa768a){for(var _0x4b2d8a in _0xaa768a){if(_0xaa768a[_0x085d('0x92')](_0x4b2d8a)&&_[_0x085d('0x93')](_0xaa768a[_0x4b2d8a])){this[_0x085d('0xb')][_0x085d('0x9b')](util[_0x085d('0x4f')](_0x085d('0x128'),_0x4b2d8a[_0x085d('0xf4')]()),_0xaa768a[_0x4b2d8a]);}}if(_[_0x085d('0x3f')](_0xaa768a[_0x085d('0x73')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0x129'));}else{this['createSquareMessage'](_0xaa768a[_0x085d('0x73')],_0x085d('0xf5'),'amazonlex','');return this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')]('Amazon\x20Lex\x20Result\x20%s',_0xaa768a[_0x085d('0x73')]));}}return this['channel'][_0x085d('0x2a')](_0x2c4d68,_0x085d('0x12a'));};AGIVertices[_0x085d('0xe')][_0x085d('0x12b')]=function(_0x5395d4){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x12c'),_0x5395d4[_0x085d('0x34')],_0x5395d4[_0x085d('0x63')]));if(!this[_0x085d('0x83')](_0x5395d4['key'])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xe6'));}var _0x5f19a8=_0x085d('0x12d');var _0x3ec20c=util[_0x085d('0x4f')]('%s/recordings/%s',FILES_PATH,rs[_0x085d('0x117')](0x4));var _0x4797af=util['format'](_0x085d('0x99'),_0x3ec20c,_0x5f19a8);var _0xf89dcf=!![];if(_0x5395d4[_0x085d('0x12e')]===_0x085d('0x12f')){_0xf89dcf=![];}var _0x34f54c=this[_0x085d('0xb')][_0x085d('0x130')](_0x3ec20c,_0x5f19a8,_0x5395d4[_0x085d('0x131')],_0x5395d4['timeout'],undefined,_0xf89dcf);if(_0x34f54c['result']!==-0x1){this[_0x085d('0xb')][_0x085d('0xa7')](util['format'](_0x085d('0x132'),_0x4797af));var _0x1e3d0d=this[_0x085d('0x8b')][_0x085d('0x6c')](this,_0x5395d4,_0x4797af);if(_0x1e3d0d){for(var _0x24130d in _0x1e3d0d){if(_0x1e3d0d['hasOwnProperty'](_0x24130d)){this['channel'][_0x085d('0x9b')](util['format'](_0x085d('0x133'),_0x24130d[_0x085d('0xf4')]()),_0x1e3d0d[_0x24130d]);}}return this['channel']['noop'](util['format'](_0x085d('0x134'),JSON[_0x085d('0x9c')](_0x1e3d0d)));}}return _0x34f54c;};AGIVertices[_0x085d('0xe')][_0x085d('0x135')]=function(_0x427580){logger['info'](util[_0x085d('0x4f')](_0x085d('0x136'),_0x427580[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x427580['appid'])){return this['channel']['noop'](_0x085d('0x137'));}if(!this[_0x085d('0x83')](_0x427580[_0x085d('0x8f')])){return this['channel'][_0x085d('0xa7')](_0x085d('0x138'));}var _0x1723ac=_0x085d('0x12d');var _0xe84e8f=util[_0x085d('0x4f')](_0x085d('0x139'),FILES_PATH,rs['generate'](0x4));var _0x34f8c7=util[_0x085d('0x4f')]('%s.%s',_0xe84e8f,_0x1723ac);var _0x44fa89=!![];if(_0x427580[_0x085d('0x12e')]===_0x085d('0x12f')){_0x44fa89=![];}var _0x57d168=this[_0x085d('0xb')][_0x085d('0x130')](_0xe84e8f,_0x1723ac,_0x427580[_0x085d('0x131')],_0x427580[_0x085d('0x63')],undefined,_0x44fa89);if(_0x57d168[_0x085d('0xa0')]!==-0x1){this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0x13a'),_0x34f8c7));var _0x5eb0ca=this[_0x085d('0x8d')][_0x085d('0x6c')](this,_0x427580,_0x34f8c7);if(_0x5eb0ca){for(var _0x581fb7 in _0x5eb0ca){if(_0x5eb0ca[_0x085d('0x92')](_0x581fb7)){this['channel'][_0x085d('0x9b')](util[_0x085d('0x4f')](_0x085d('0x13b'),_0x581fb7['toUpperCase']()),_0x5eb0ca[_0x581fb7]);}}return this['channel']['noop'](util[_0x085d('0x4f')](_0x085d('0x13c'),JSON['stringify'](_0x5eb0ca)));}}return _0x57d168;};AGIVertices[_0x085d('0xe')][_0x085d('0x13d')]=function(_0x15e583){logger['info'](util[_0x085d('0x4f')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x15e583[_0x085d('0x34')]));return this[_0x085d('0xb')]['continueAt'](_0x15e583[_0x085d('0x3a')],_0x15e583[_0x085d('0x13e')],_0x15e583['priority']);};AGIVertices[_0x085d('0xe')][_0x085d('0x13f')]=function(_0x191ede){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x140'),_0x191ede[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x191ede[_0x085d('0x141')])){return this[_0x085d('0xb')]['error'](_0x191ede,'no\x20condition\x20configured');}try{var _0xc69d72=eval(_0x191ede[_0x085d('0x141')])?_0x085d('0x142'):_0x085d('0x143');this[_0x085d('0xb')][_0x085d('0xa7')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x191ede[_0x085d('0x141')],_0xc69d72));return{'code':0xc8,'result':_0xc69d72};}catch(_0x3749b1){return{'code':0xc8,'result':_0x085d('0x143')};}};AGIVertices['prototype'][_0x085d('0x144')]=function(_0x39dc53){logger['info'](util[_0x085d('0x4f')](_0x085d('0x145'),_0x39dc53[_0x085d('0x34')]));if(!this['isConfigured'](_0x39dc53['interval_id'])){return this['channel'][_0x085d('0x2a')](_0x39dc53,_0x085d('0x146'));}var _0x9b90dd=this['getIntervals']['sync'](this,_0x39dc53[_0x085d('0x147')]);if(!_0x9b90dd){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x39dc53,_0x085d('0x148'));}for(var _0x37ce54=0x0;_0x37ce54<_0x9b90dd[_0x085d('0x9a')];_0x37ce54+=0x1){var _0x1ff642=this[_0x085d('0xb')]['getVariable'](util[_0x085d('0x4f')](_0x085d('0x149'),_0x9b90dd[_0x37ce54]));if(_0x1ff642[_0x085d('0xa0')]===-0x1){return _0x1ff642;}logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x14a'),_0x9b90dd[_0x37ce54],_0x1ff642[_0x085d('0x9e')]));if(_0x1ff642[_0x085d('0x9e')]==='true'){logger[_0x085d('0x2c')](util['format'](_0x085d('0x14a'),_0x9b90dd[_0x37ce54],'true'));this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')]('IFTIME\x20%s\x20%s',_0x9b90dd[_0x37ce54],_0x085d('0x142')));return{'code':0xc8,'result':_0x085d('0x142')};}else{logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x14a'),_0x9b90dd[_0x37ce54],'false'));this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x14a'),_0x9b90dd[_0x37ce54],_0x085d('0x143')));}}return{'code':0xc8,'result':_0x085d('0x143')};};AGIVertices['prototype'][_0x085d('0x14b')]=function(_0x3f20ce){logger['info'](util[_0x085d('0x4f')](_0x085d('0x14c'),_0x3f20ce[_0x085d('0x34')]));return this[_0x085d('0xb')][_0x085d('0x14b')]();};AGIVertices['prototype'][_0x085d('0x14d')]=function(_0x540fe6){logger[_0x085d('0x2c')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x540fe6[_0x085d('0x34')]));if(!this['isConfigured'](_0x540fe6['key'])){return this['channel']['noop'](_0x085d('0xe6'));}var _0x1c3fc6=_0x085d('0x12d');var _0x3bf595=util[_0x085d('0x4f')](_0x085d('0x139'),FILES_PATH,rs[_0x085d('0x117')](0x4));var _0x4c355b=util['format'](_0x085d('0x99'),_0x3bf595,_0x1c3fc6);var _0x501685=!![];if(_0x540fe6[_0x085d('0x12e')]==='NOBEEP'){_0x501685=![];}var _0x42771a=this[_0x085d('0xb')]['recordFile'](_0x3bf595,_0x1c3fc6,_0x540fe6[_0x085d('0x131')],_0x540fe6[_0x085d('0x63')],undefined,_0x501685);if(_0x42771a['result']!==-0x1){this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x14e'),_0x4c355b));var _0x4faeea=this[_0x085d('0x81')]['sync'](this,_0x540fe6,_0x4c355b);if(_0x4faeea){for(var _0xa54e4 in _0x4faeea){if(_0x4faeea[_0x085d('0x92')](_0xa54e4)){this['channel'][_0x085d('0x9b')](util[_0x085d('0x4f')](_0x085d('0x14f'),_0xa54e4[_0x085d('0xf4')]()),_0x4faeea[_0xa54e4]);}}return this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x150'),JSON[_0x085d('0x9c')](_0x4faeea)));}}return _0x42771a;};AGIVertices[_0x085d('0xe')][_0x085d('0x151')]=function(_0x240b22){logger['info'](util[_0x085d('0x4f')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x240b22[_0x085d('0x34')]));if(!this['isConfigured'](_0x240b22['key'])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xe6'));}if(!this['isConfigured'](_0x240b22[_0x085d('0x58')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xa5'));}this['channel'][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x152'),_0x240b22[_0x085d('0x58')]));var _0x223eac=this['ispeechTTS'][_0x085d('0x6c')](this,_0x240b22);if(_0x223eac){this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0x14e'),_0x223eac));var _0x958554=this['channel'][_0x085d('0x104')](_0x223eac,_0x240b22[_0x085d('0x131')]);try{fs['unlink'](_0x223eac+'.wav');}catch(_0x3e95f8){logger[_0x085d('0x2a')](_0x3e95f8);}return _0x958554;}return this['channel'][_0x085d('0x2a')](_0x240b22,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x085d('0x153')]=function(_0x245065){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x154'),_0x245065[_0x085d('0x34')]));if(!this['isConfigured'](_0x245065['findBy'])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x245065,'no\x20find\x20by\x20configured');}logger[_0x085d('0x2c')](util['format'](_0x085d('0x155'),this['channel']['callerid'],_0x245065[_0x085d('0x156')]));var _0x51bcdf=this[_0x085d('0x4e')][_0x085d('0x6c')](this,_0x245065[_0x085d('0x156')]);if(_0x51bcdf){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x157'),this['channel'][_0x085d('0x37')],_0x245065['findBy']));this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x157'),this['channel'][_0x085d('0x37')],_0x245065[_0x085d('0x156')]));return{'code':0xc8,'result':_0x085d('0x158')};}else{logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x159'),this[_0x085d('0xb')]['callerid'],_0x245065[_0x085d('0x156')]));this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x159'),this['channel'][_0x085d('0x37')],_0x245065[_0x085d('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x085d('0xe')]['logout']=function(_0x49253a){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x15a'),_0x49253a[_0x085d('0x34')]));if(!this['isConfigured'](_0x49253a['findBy'])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x49253a,_0x085d('0x15b'));}logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x155'),this['channel']['callerid'],_0x49253a[_0x085d('0x156')]));var _0x4d4c72=this[_0x085d('0x4d')][_0x085d('0x6c')](this,_0x49253a[_0x085d('0x156')]);if(_0x4d4c72){logger[_0x085d('0x2c')](util[_0x085d('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x085d('0xb')]['callerid'],_0x49253a['findBy']));this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x157'),this[_0x085d('0xb')][_0x085d('0x37')],_0x49253a['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x159'),this['channel'][_0x085d('0x37')],_0x49253a[_0x085d('0x156')]));this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0x159'),this[_0x085d('0xb')][_0x085d('0x37')],_0x49253a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x4500c2){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x15c'),_0x4500c2[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x4500c2[_0x085d('0x15d')])){return this[_0x085d('0xb')]['error'](_0x4500c2,_0x085d('0x15e'));}this[_0x085d('0xb')]['noop'](util['format'](_0x085d('0x15f'),_0x4500c2[_0x085d('0x15d')]));var _0x4be882=eval(_0x4500c2[_0x085d('0x15d')]);if(!this[_0x085d('0x83')](_0x4500c2[_0x085d('0xd5')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xd6'));}var _0x3e2c35=this[_0x085d('0xf')][_0x085d('0x6c')](this,_0x4500c2[_0x085d('0xd5')]);if(!_0x3e2c35){return this[_0x085d('0xb')]['error'](_0x4500c2,_0x085d('0xd7'));}if(_[_0x085d('0x97')](_0x4be882)){var _0x45867c=this;_0x4be882[_0x085d('0xd9')](function(_0x379ef3,_0x1076b7){_0x45867c['channel']['setVariable'](util[_0x085d('0x4f')](_0x085d('0x160'),_0x3e2c35,_0x1076b7),_0x379ef3);});return this[_0x085d('0xb')][_0x085d('0xa7')](util['format']('variable\x20%s[key]\x20set',_0x3e2c35));}else{return this[_0x085d('0xb')][_0x085d('0x9b')](_0x3e2c35,_0x4be882);}};AGIVertices['prototype'][_0x085d('0x9')]=function(_0x2a5db8){logger['info'](util[_0x085d('0x4f')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2a5db8['label']));if(_0x2a5db8[_0x085d('0xa3')]===0x0){return this['maxRetry'](_0x2a5db8);}_0x2a5db8['retry']-=0x1;if(!this[_0x085d('0x83')](_0x2a5db8['file_id'])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x2a5db8,'no\x20file\x20audio\x20selected');}var _0x236df7=this['getSound'][_0x085d('0x6c')](this,_0x2a5db8[_0x085d('0x161')]);if(!_0x236df7){return this['channel'][_0x085d('0x2a')](_0x2a5db8,_0x085d('0x162'));}var _0x4bfab9=this[_0x085d('0xb')]['getData'](_0x236df7,_0x2a5db8[_0x085d('0x112')],_0x2a5db8[_0x085d('0x163')]);var _0x5dfa44=_0x4bfab9['result'];if(_0x4bfab9[_0x085d('0xa0')]===-0x1){this[_0x085d('0x32')][_0x085d('0x6c')](this,_0x2a5db8,'-1');return _0x4bfab9;}else if(_0x4bfab9[_0x085d('0x9e')]===_0x085d('0x63')){_0x4bfab9[_0x085d('0xa0')]=_0x4bfab9[_0x085d('0xa0')][_0x085d('0x9a')]>0x0?_0x4bfab9[_0x085d('0xa0')]:'t';}else if(_[_0x085d('0x3e')](_0x4bfab9[_0x085d('0xa0')])){_0x4bfab9[_0x085d('0xa0')]='#';_0x5dfa44='#';}if(!this[_0x085d('0x83')](_0x2a5db8[_0x085d('0xd5')])){this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xd6'));}else{var _0x540739=this[_0x085d('0xf')][_0x085d('0x6c')](this,_0x2a5db8[_0x085d('0xd5')]);if(!_0x540739){return this['channel'][_0x085d('0x2a')](_0x2a5db8,_0x085d('0xd7'));}this[_0x085d('0xb')][_0x085d('0x9b')](_0x540739,_0x5dfa44);}this['createSquareDetailsReport'][_0x085d('0x6c')](this,_0x2a5db8,_0x5dfa44);return _0x4bfab9;};AGIVertices[_0x085d('0xe')][_0x085d('0xa7')]=function(_0x561c47){logger['info'](util[_0x085d('0x4f')](_0x085d('0x164'),_0x561c47[_0x085d('0x34')]));return this[_0x085d('0xb')][_0x085d('0xa7')](_0x561c47[_0x085d('0x165')]||_0x561c47[_0x085d('0x34')]);};AGIVertices['prototype']['pause']=function(_0x48e207){logger['info'](util[_0x085d('0x4f')](_0x085d('0x166'),_0x48e207['label']));if(!this[_0x085d('0x83')](_0x48e207[_0x085d('0x156')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x48e207,_0x085d('0x15b'));}logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x155'),this['channel'][_0x085d('0x37')],_0x48e207[_0x085d('0x156')]));var _0x5eaae6=this[_0x085d('0x48')][_0x085d('0x6c')](this,_0x48e207[_0x085d('0x167')]);var _0xc47f55=this[_0x085d('0x4b')][_0x085d('0x6c')](this,_0x48e207[_0x085d('0x156')],_0x5eaae6);if(_0xc47f55){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x157'),this['channel'][_0x085d('0x37')],_0x48e207[_0x085d('0x156')]));this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x085d('0x37')],_0x48e207[_0x085d('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x159'),this['channel'][_0x085d('0x37')],_0x48e207[_0x085d('0x156')]));this[_0x085d('0xb')][_0x085d('0xa7')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x085d('0xb')][_0x085d('0x37')],_0x48e207[_0x085d('0x156')]));return{'code':0xc8,'result':_0x085d('0x168')};}};AGIVertices['prototype'][_0x085d('0x169')]=function(_0x4d44cb){logger['info'](util['format'](_0x085d('0x16a'),_0x4d44cb[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x4d44cb[_0x085d('0x161')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x4d44cb,'no\x20file\x20audio\x20selected');}var _0x19bfb9=this['getSound'][_0x085d('0x6c')](this,_0x4d44cb[_0x085d('0x161')]);if(!_0x19bfb9){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x4d44cb,_0x085d('0x162'));}var _0x24f08c=this[_0x085d('0xb')][_0x085d('0x53')](_0x085d('0x16b'),[_0x19bfb9,_0x4d44cb['opts']]);if(_0x24f08c[_0x085d('0xa0')]===-0x1){return _0x24f08c;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x16c'),_0x085d('0x16b'),_0x19bfb9));};AGIVertices[_0x085d('0xe')][_0x085d('0x16d')]=function(_0x20fae5){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x16e'),_0x20fae5[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0x20fae5[_0x085d('0x16f')])){return this[_0x085d('0xb')]['error'](_0x20fae5,_0x085d('0x170'));}var _0x14d947='';var _0x13e677=parseInt(_0x20fae5[_0x085d('0x16f')],0xa);if(isNaN(_0x13e677)){_0x14d947=_0x20fae5[_0x085d('0x16f')];}else{_0x14d947=this['getVoiceQueue']['sync'](this,_0x20fae5[_0x085d('0x16f')]);if(!_0x14d947){return this['channel'][_0x085d('0x2a')](_0x20fae5,'no\x20queue\x20found');}}var _0x48cece='';if(this[_0x085d('0x83')](_0x20fae5[_0x085d('0x161')])){var _0x3f042b=this[_0x085d('0x171')][_0x085d('0x6c')](this,_0x20fae5['file_id']);if(_0x3f042b){_0x48cece=_0x3f042b;}}this[_0x085d('0x32')]['sync'](this,_0x20fae5,_0x14d947);if(_0x20fae5[_0x085d('0xe3')]['indexOf']('x')<0x0){_0x20fae5['opts']+='x';}if(_0x20fae5[_0x085d('0xe3')][_0x085d('0x172')]('X')<0x0){_0x20fae5[_0x085d('0xe3')]+='X';}this[_0x085d('0xb')][_0x085d('0x9b')](_0x085d('0x173'),_0x14d947?_0x14d947['toLowerCase']():'');var _0x39f705=this[_0x085d('0xb')]['exec'](_0x085d('0x174'),[_0x14d947,_0x20fae5[_0x085d('0xe3')],_0x20fae5[_0x085d('0x62')],_0x48cece,_0x20fae5[_0x085d('0x63')],_0x20fae5[_0x085d('0x5')],_0x20fae5[_0x085d('0x175')],_0x20fae5[_0x085d('0x176')],'',_0x20fae5['position']]);if(_0x39f705['result']===-0x1){return _0x39f705;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x16c'),_0x085d('0x174'),_0x14d947));};AGIVertices['prototype'][_0x085d('0x177')]=function(_0x11cc7d){logger['info'](util[_0x085d('0x4f')](_0x085d('0x178'),_0x11cc7d[_0x085d('0x34')]));var _0x1caae4=_0x11cc7d[_0x085d('0x179')]||_0x085d('0x12d');var _0x2e0713=util[_0x085d('0x4f')](_0x085d('0x17a'),this[_0x085d('0xb')]['uniqueid'],rs['generate'](0x5));var _0x32e28d=util[_0x085d('0x4f')](_0x085d('0x17b'),FILES_PATH,_0x2e0713,_0x1caae4);var _0x26ca77=util[_0x085d('0x4f')]('%s/recordings/%s',FILES_PATH,_0x2e0713);this[_0x085d('0x38')]['sync'](this,_0x11cc7d,_0x2e0713,_0x32e28d);this[_0x085d('0xb')][_0x085d('0x9b')](_0x085d('0x17c'),_0x2e0713);logger[_0x085d('0x2c')](_0x085d('0x17d'),_0x26ca77,_0x1caae4,_0x11cc7d[_0x085d('0x17e')],_0x11cc7d[_0x085d('0x63')]);return this[_0x085d('0xb')][_0x085d('0x130')](_0x26ca77,_0x1caae4,_0x11cc7d[_0x085d('0x17e')],_0x11cc7d['timeout'],undefined,!![]);};AGIVertices[_0x085d('0xe')][_0x085d('0x17f')]=function(_0x493e90){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x180'),_0x493e90['label']));if(!this['isConfigured'](_0x493e90['url'])){return this['channel'][_0x085d('0xa7')]('no\x20url\x20configured');}var _0x87b154=this[_0x085d('0x61')][_0x085d('0x6c')](this,_0x493e90);logger['info'](util[_0x085d('0x4f')](_0x085d('0x181'),util[_0x085d('0x182')](_0x87b154,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x493e90['variable_id'])){return this[_0x085d('0xb')][_0x085d('0xa7')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x21f699=this[_0x085d('0xf')][_0x085d('0x6c')](this,_0x493e90['variable_id']);if(!_0x21f699){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x493e90,'no\x20variable\x20found');}this[_0x085d('0xb')][_0x085d('0x9b')](util[_0x085d('0x4f')](_0x085d('0x183'),_0x21f699),_0x87b154[_0x085d('0x71')]?_0x87b154[_0x085d('0x71')]:_0x085d('0x184'));this[_0x085d('0xb')][_0x085d('0x9b')](util[_0x085d('0x4f')](_0x085d('0x185'),_0x21f699),_0x87b154[_0x085d('0x72')]?_0x87b154['statusMessage']:'OK');if(_0x87b154['body']){try{this['saveRestApiResult'](_0x87b154[_0x085d('0x6f')],_0x21f699);}catch(_0x13ccbe){logger[_0x085d('0x2a')](util[_0x085d('0x4f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x21f699));}}return this[_0x085d('0xb')][_0x085d('0xa7')](util['format'](_0x085d('0xdb'),_0x21f699));};AGIVertices[_0x085d('0xe')][_0x085d('0x186')]=function(_0x36951b){logger[_0x085d('0x2c')](util[_0x085d('0x4f')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x36951b['label']));return this[_0x085d('0xb')][_0x085d('0x187')](_0x36951b['digits'][_0x085d('0x55')](/\s+/g,''),_0x36951b['escape_digits']);};AGIVertices[_0x085d('0xe')][_0x085d('0x188')]=function(_0x30ed34){logger[_0x085d('0x2c')](util[_0x085d('0x4f')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x30ed34[_0x085d('0x34')]));return this[_0x085d('0xb')][_0x085d('0x189')](_0x30ed34[_0x085d('0x64')][_0x085d('0x55')](/\s+/g,''),_0x30ed34[_0x085d('0x17e')]);};AGIVertices['prototype'][_0x085d('0x18a')]=function(_0x1c8911){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x18b'),_0x1c8911[_0x085d('0x34')]));return this[_0x085d('0xb')]['sayPhonetic'](_0x1c8911[_0x085d('0x58')],_0x1c8911[_0x085d('0x17e')]);};AGIVertices[_0x085d('0xe')]['sendMail']=function(_0x77809e){logger['info'](util[_0x085d('0x4f')](_0x085d('0x18c'),_0x77809e[_0x085d('0x34')]));if(!this['isConfigured'](_0x77809e[_0x085d('0x18d')])){return this[_0x085d('0xb')]['noop'](_0x085d('0x18e'));}var _0x5e5aa8=this[_0x085d('0x18f')][_0x085d('0x6c')](this,_0x77809e[_0x085d('0x18d')]);if(!_0x5e5aa8||!_0x5e5aa8[_0x085d('0x190')]){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x77809e,_0x085d('0x191'));}var _0x4d7b56={'from':util[_0x085d('0x4f')](_0x085d('0x192'),_0x5e5aa8[_0x085d('0x12')],_0x5e5aa8[_0x085d('0x193')]||_0x5e5aa8[_0x085d('0x190')][_0x085d('0x194')]),'to':_0x77809e['to']||'','cc':_0x77809e['cc']||'','bcc':_0x77809e[_0x085d('0x195')]||'','subject':_0x77809e['subject'],'html':_0x77809e[_0x085d('0x58')],'text':_0x77809e[_0x085d('0x58')]};if(this[_0x085d('0x83')](_0x77809e[_0x085d('0x196')])){}logger[_0x085d('0xdd')]('sendMail\x20message',JSON[_0x085d('0x9c')](_0x4d7b56));this['createSquareDetailsReport']['sync'](this,_0x77809e,_0x77809e[_0x085d('0x18d')]);this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x197'),_0x5e5aa8[_0x085d('0x12')]));this[_0x085d('0x21')][_0x085d('0x6c')](this,_0x5e5aa8[_0x085d('0x198')],_0x4d7b56);return this['channel']['noop'](_0x085d('0x199'));};AGIVertices['prototype'][_0x085d('0x19a')]=function(_0x645845){logger[_0x085d('0x2c')](util[_0x085d('0x4f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x645845['label']));return this['channel'][_0x085d('0xa7')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x085d('0xe')]['sendSMS']=function(_0x770b1){logger['info'](util['format'](_0x085d('0x19b'),_0x770b1['label']));if(!this['isConfigured'](_0x770b1[_0x085d('0x19c')])){return this['channel'][_0x085d('0xa7')](_0x085d('0x19d'));}var _0x553ea2=this['getSmsAccount']['sync'](this,_0x770b1[_0x085d('0x19c')]);if(!_0x553ea2){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x770b1,_0x085d('0x19e'));}var _0x3e6b68={'body':_0x770b1[_0x085d('0x19f')],'phone':_0x770b1['to']||'','SmsAccountId':_0x553ea2['id']};logger[_0x085d('0xdd')](_0x085d('0x1a0'),JSON['stringify'](_0x3e6b68));this[_0x085d('0x32')][_0x085d('0x6c')](this,_0x770b1,_0x770b1[_0x085d('0x19c')]);this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0x1a1'),_0x553ea2['name']));this[_0x085d('0x31')][_0x085d('0x6c')](this,_0x3e6b68);return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0x1a2'));};AGIVertices[_0x085d('0xe')][_0x085d('0x1a3')]=function(_0xf60363){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x1a4'),_0xf60363['label']));if(!this[_0x085d('0x83')](_0xf60363[_0x085d('0xd5')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0xf60363,'no\x20variable\x20selected');}var _0x5c40b4=this[_0x085d('0xf')][_0x085d('0x6c')](this,_0xf60363[_0x085d('0xd5')]);if(!_0x5c40b4){return this['channel']['error'](_0xf60363,_0x085d('0xd7'));}return this[_0x085d('0xb')]['setVariable'](_0x5c40b4,_0xf60363['variable_value']);};AGIVertices[_0x085d('0xe')][_0x085d('0x1a5')]=function(_0x5d2c8f){logger[_0x085d('0x2c')](util[_0x085d('0x4f')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5d2c8f[_0x085d('0x34')]));this['channel'][_0x085d('0xa7')](_0x085d('0x1a6'));var _0x488fec=this[_0x085d('0xb')][_0x085d('0xf')](_0x085d('0x1a7'));if(!_[_0x085d('0x3e')](_0x488fec['extra'])){this['channel'][_0x085d('0x33')]=_0x488fec[_0x085d('0x9e')];}if(_0x5d2c8f[_0x085d('0xb8')]===_0x085d('0x1a8')){this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0x1a9'));return this[_0x085d('0xb')]['answer']();}return this[_0x085d('0xb')]['noop']('Skipped\x20Answer');};AGIVertices['prototype'][_0x085d('0x1aa')]=function(_0x2ba2cb){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x1ab'),_0x2ba2cb['label']));if(!this[_0x085d('0x83')](_0x2ba2cb[_0x085d('0x1ac')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x2ba2cb,_0x085d('0x1ad'));}var _0x4768e0=this[_0x085d('0x16')][_0x085d('0x6c')](this,_0x2ba2cb[_0x085d('0x1ac')]);if(!this[_0x085d('0x83')](_0x4768e0)){return this['channel']['error'](_0x2ba2cb,util[_0x085d('0x4f')](_0x085d('0x1ae'),_0x2ba2cb[_0x085d('0x1ac')]));}if(_0x4768e0===this[_0x085d('0xb')]['arg_1']){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x2ba2cb,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport']['sync'](this,_0x2ba2cb,_0x4768e0);var _0x32cb65=this[_0x085d('0xb')][_0x085d('0x53')](_0x085d('0x1af'),util[_0x085d('0x4f')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x085d('0x1b0')]||_0x085d('0x1b1'),_0x4768e0,this['channel'][_0x085d('0x36')]));if(_0x32cb65[_0x085d('0xa0')]===-0x1){return _0x32cb65;}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x16c'),'AGI',_0x4768e0));};AGIVertices[_0x085d('0xe')]['system']=function(_0x272a05){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x1b2'),_0x272a05[_0x085d('0x34')]));var _0x4c56a5=this[_0x085d('0x52')][_0x085d('0x6c')](this,_0x272a05[_0x085d('0xb4')]);this[_0x085d('0x32')][_0x085d('0x6c')](this,_0x272a05,_0x272a05[_0x085d('0xb4')]);if(this[_0x085d('0x83')](_0x272a05[_0x085d('0xd5')])){var _0x2f9d57=this[_0x085d('0xf')]['sync'](this,_0x272a05[_0x085d('0xd5')]);if(_0x2f9d57){this[_0x085d('0xb')][_0x085d('0x9b')](_0x2f9d57,_0x4c56a5);return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x1b3'),_0x272a05[_0x085d('0xb4')],_0x2f9d57));}}return this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x272a05['command']));};AGIVertices[_0x085d('0xe')][_0x085d('0x1b4')]=function(_0xa6c18b){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x1b5'),_0xa6c18b[_0x085d('0x34')]));_0xa6c18b[_0x085d('0x58')]=_0xa6c18b[_0x085d('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x085d('0x83')](_0xa6c18b['apiKey'])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0x1b6'));}if(!this['isConfigured'](_0xa6c18b['text'])){return this['channel'][_0x085d('0xa7')](_0x085d('0xa5'));}this[_0x085d('0xb')][_0x085d('0xa7')](util['format'](_0x085d('0x1b7'),_0xa6c18b[_0x085d('0x58')]));var _0x1ae2d9=this[_0x085d('0x56')][_0x085d('0x6c')](this,_0xa6c18b);if(_0x1ae2d9){this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x1b8'),_0x1ae2d9));var _0x37fe94=this['channel'][_0x085d('0x104')](_0x1ae2d9);try{fs[_0x085d('0x1b9')](_0x1ae2d9+_0x085d('0x105'));}catch(_0x2e6597){logger[_0x085d('0x2a')](_0x2e6597);}return _0x37fe94;}return this[_0x085d('0xb')][_0x085d('0x2a')](_0xa6c18b,_0x085d('0x1ba'));};AGIVertices[_0x085d('0xe')][_0x085d('0x1bb')]=function(_0x5ac6fd){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x1bc'),_0x5ac6fd[_0x085d('0x34')]));_0x5ac6fd[_0x085d('0x58')]=_0x5ac6fd[_0x085d('0x58')][_0x085d('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5ac6fd[_0x085d('0x58')])){return this[_0x085d('0xb')][_0x085d('0xa7')](_0x085d('0xa5'));}this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')](_0x085d('0x1bd'),_0x5ac6fd['text']));var _0x3c033f=this[_0x085d('0x5f')]['sync'](this,_0x5ac6fd);if(_0x3c033f){this['channel']['noop'](util[_0x085d('0x4f')](_0x085d('0x1be'),_0x3c033f));var _0x5909ef=this[_0x085d('0xb')]['streamFile'](_0x3c033f);try{fs['unlink'](_0x3c033f+_0x085d('0x105'));}catch(_0x530123){logger['error'](_0x530123);}return _0x5909ef;}return this[_0x085d('0xb')][_0x085d('0x2a')](_0x5ac6fd,_0x085d('0x1bf'));};AGIVertices[_0x085d('0xe')][_0x085d('0x1c0')]=function(_0x2c4b74){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x1c1'),_0x2c4b74['label']));if(!this[_0x085d('0x83')](_0x2c4b74[_0x085d('0x156')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0x2c4b74,_0x085d('0x15b'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x085d('0xb')]['callerid'],_0x2c4b74[_0x085d('0x156')]));var _0x19d18b=this[_0x085d('0x4c')][_0x085d('0x6c')](this,_0x2c4b74['findBy']);if(_0x19d18b){logger[_0x085d('0x2c')](util[_0x085d('0x4f')](_0x085d('0x157'),this[_0x085d('0xb')][_0x085d('0x37')],_0x2c4b74['findBy']));this[_0x085d('0xb')]['noop'](util[_0x085d('0x4f')](_0x085d('0x157'),this[_0x085d('0xb')]['callerid'],_0x2c4b74[_0x085d('0x156')]));return{'code':0xc8,'result':_0x085d('0x158')};}else{logger['info'](util[_0x085d('0x4f')](_0x085d('0x159'),this[_0x085d('0xb')][_0x085d('0x37')],_0x2c4b74[_0x085d('0x156')]));this[_0x085d('0xb')][_0x085d('0xa7')](util[_0x085d('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x085d('0xb')]['callerid'],_0x2c4b74[_0x085d('0x156')]));return{'code':0xc8,'result':_0x085d('0x168')};}};AGIVertices[_0x085d('0xe')]['voicemail']=function(_0x1b9c79){logger['info'](util['format'](_0x085d('0x1c2'),_0x1b9c79[_0x085d('0x34')]));var _0x5c0b37=this[_0x085d('0xb')]['exec'](_0x085d('0x1c3'),[_0x1b9c79['mailbox'],_0x1b9c79['options']]);if(_0x5c0b37[_0x085d('0xa0')]===-0x1){return _0x5c0b37;}return this[_0x085d('0xb')][_0x085d('0xa7')](util['format']('Executed\x20command\x20%s\x20%s',_0x085d('0x1c3'),_0x1b9c79['mailbox']));};AGIVertices[_0x085d('0xe')][_0x085d('0x1c4')]=function(_0xb5c65){logger[_0x085d('0x2c')](util['format'](_0x085d('0x1c5'),_0xb5c65[_0x085d('0x34')]));if(!this[_0x085d('0x83')](_0xb5c65[_0x085d('0xd5')])){return this[_0x085d('0xb')][_0x085d('0x2a')](_0xb5c65,'no\x20variable\x20selected');}var _0xe7420e=this['getVariable'][_0x085d('0x6c')](this,_0xb5c65[_0x085d('0xd5')]);if(!_0xe7420e){return this[_0x085d('0xb')]['error'](_0xb5c65,_0x085d('0xd7'));}var _0x32b128=this['channel'][_0x085d('0xf')](_0xe7420e);return{'code':0xc8,'result':_0x32b128[_0x085d('0x9e')]?_0x32b128[_0x085d('0x9e')]:'-'};};String[_0x085d('0xe')][_0x085d('0x1c6')]=function(_0x2467ab,_0x47e6fb){return this[_0x085d('0x9d')](_0x2467ab)['join'](_0x47e6fb);};module[_0x085d('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 8808d67..63c9ff8 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 _0x89c3=['custom:agentConnectPreview','milliseconds','diff','prototype','lastPauseAt','timer','update','uniqueid','info','catch','error','finally','startAcw','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','ACW','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','deleteChannelAfterTimeout','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','hanguprequest','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0x89c3,0xf1));var _0x389c=function(_0x268a51,_0x269f0b){_0x268a51=_0x268a51-0x0;var _0x2acead=_0x89c3[_0x268a51];return _0x2acead;};'use strict';var _=require('lodash');var moment=require(_0x389c('0x0'));var ami=require(_0x389c('0x1'));var logger=require(_0x389c('0x2'))(_0x389c('0x3'));var RpcUser=require(_0x389c('0x4'));var RpcVoiceAgentReport=require(_0x389c('0x5'));function Acw(_0xeeee90){this[_0x389c('0x6')]=_0xeeee90[_0x389c('0x6')];this[_0x389c('0x7')]=_0xeeee90[_0x389c('0x7')];this[_0x389c('0x8')]=_0xeeee90['timers'];this[_0x389c('0x9')]={};ami['on']('agentconnect',this[_0x389c('0xa')]['bind'](this));ami['on'](_0x389c('0xb'),this[_0x389c('0xc')][_0x389c('0xd')](this));ami['on'](_0x389c('0xe'),this[_0x389c('0xf')][_0x389c('0xd')](this));ami['on'](_0x389c('0x10'),this[_0x389c('0x11')][_0x389c('0xd')](this));ami['on']('attendedtransfer',this[_0x389c('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x389c('0x13')]['bind'](this));ami['on'](_0x389c('0x14'),this['syncAgentConnectPreview'][_0x389c('0xd')](this));}function getDiff(_0x1c2945){var _0x2140fd=moment()[_0x389c('0x15')](0x0);var _0x2d86f8=moment(_0x1c2945)['milliseconds'](0x0);return _0x2140fd[_0x389c('0x16')](_0x2d86f8,'seconds');}Acw[_0x389c('0x17')]['updateAcw']=function(_0x53db85,_0x455f94){var _0x3a09ad=this;var _0x3d631a=getDiff(_0x3a09ad[_0x389c('0x8')][_0x53db85][_0x389c('0x18')]);clearTimeout(_0x3a09ad['timers'][_0x53db85][_0x389c('0x19')]);_0x3a09ad[_0x389c('0x8')][_0x53db85][_0x389c('0x19')]=![];return RpcVoiceAgentReport[_0x389c('0x1a')]({'acwtime':_0x3d631a},_0x3a09ad[_0x389c('0x8')][_0x53db85][_0x389c('0x1b')],_0x53db85)['then'](function(_0x575eaa){logger[_0x389c('0x1c')]('[%s][UPDATE][ACWTIME:%s]',_0x455f94,_0x3d631a,_0x575eaa);})[_0x389c('0x1d')](function(_0x35d2be){logger[_0x389c('0x1e')]('[%s][UPDATE][ERRORS:%s]',_0x455f94,_0x35d2be);})[_0x389c('0x1f')](function(){delete _0x3a09ad['timers'][_0x53db85];});};Acw[_0x389c('0x17')][_0x389c('0x20')]=function(_0x2daf97){try{var _0xb94f40=this;var _0x4740f9=this[_0x389c('0x9')][_0x2daf97]['interface'];var _0x223f6b=this[_0x389c('0x9')][_0x2daf97]['queue'];var _0x448182=this[_0x389c('0x6')][_0x223f6b];var _0x5f0c2a=![];var _0xb15209='ACW';if(_0x448182[_0x389c('0x21')]&&_0x448182[_0x389c('0x22')]['name']){_0x5f0c2a=!![];_0xb15209=_0x448182[_0x389c('0x22')][_0x389c('0x23')];}return ami[_0x389c('0x24')]({'action':_0x389c('0x25'),'interface':_0x4740f9,'paused':!![],'reason':_0xb15209})['then'](function(){if(_0xb94f40[_0x389c('0x7')][_0x4740f9]){return RpcUser['getAgent'](_0xb94f40[_0x389c('0x7')][_0x4740f9]['id'])[_0x389c('0x26')](function(_0x56bf20){if(!_0x56bf20||_0x56bf20[_0x389c('0x27')]){logger[_0x389c('0x1c')](_0x389c('0x28'),_0x2daf97,_0x4740f9,_0x223f6b);return;}logger[_0x389c('0x1c')](_0x389c('0x29'),_0x2daf97,_0x4740f9,_0x223f6b);var _0x54be44=_0xb94f40[_0x389c('0x9')][_0x2daf97][_0x389c('0x2a')]&&_0xb94f40['channels'][_0x2daf97][_0x389c('0x2b')]?_0xb94f40['channels'][_0x2daf97]['destlinkedid']:_0x2daf97;return RpcUser[_0x389c('0x2c')](_0xb94f40['agents'][_0x4740f9],_0xb15209,_0x54be44)[_0x389c('0x26')](function(_0x5ee199){_0xb94f40[_0x389c('0x6')][_0x223f6b][_0x389c('0x2d')]-=0x1;_0xb94f40[_0x389c('0x6')][_0x223f6b][_0x389c('0x2e')]+=0x1;return _0x5ee199;});})[_0x389c('0x26')](function(_0x47eb67){if(_0x5f0c2a||!_0x47eb67){return;}_0xb94f40[_0x389c('0x8')][_0x4740f9]={};logger[_0x389c('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x2daf97,_0xb94f40[_0x389c('0x6')][_0x223f6b][_0x389c('0x2f')],_0x4740f9,_0x223f6b);_0xb94f40[_0x389c('0x8')][_0x4740f9][_0x389c('0x19')]=setTimeout(_0xb94f40[_0x389c('0x30')][_0x389c('0xd')](_0xb94f40,_0x4740f9),_0xb94f40['voiceQueues'][_0x223f6b][_0x389c('0x2f')]*0x3e8);_0xb94f40[_0x389c('0x8')][_0x4740f9][_0x389c('0x18')]=moment()[_0x389c('0x31')](_0x389c('0x32'));_0xb94f40[_0x389c('0x8')][_0x4740f9][_0x389c('0x1b')]=_0x2daf97;_0xb94f40[_0x389c('0x8')][_0x4740f9][_0x389c('0x33')]=_0x223f6b;_0xb94f40['timers'][_0x4740f9]['updateAcw']=_0xb94f40[_0x389c('0x34')][_0x389c('0xd')](_0xb94f40,_0x4740f9,_0x2daf97);});}})['catch'](function(){logger[_0x389c('0x1e')](_0x389c('0x35'),_0x2daf97,_0xb94f40[_0x389c('0x6')][_0x223f6b][_0x389c('0x2f')],_0x4740f9,_0x223f6b);})['finally'](function(){delete _0xb94f40[_0x389c('0x9')][_0x2daf97];});}catch(_0x4cff6e){logger[_0x389c('0x1e')](_0x389c('0x36'),_0x4cff6e[_0x389c('0x37')]);}};Acw[_0x389c('0x17')]['stopAcw']=function(_0x1d2b44){try{var _0x2b2b50=this;if(_0x2b2b50[_0x389c('0x8')][_0x1d2b44]){_0x2b2b50['timers'][_0x1d2b44][_0x389c('0x19')]=![];var _0x51b674=_0x2b2b50[_0x389c('0x8')][_0x1d2b44]['uniqueid'];var _0x55bc54=_0x2b2b50[_0x389c('0x8')][_0x1d2b44][_0x389c('0x33')];var _0x4c101b=_0x2b2b50[_0x389c('0x6')][_0x55bc54]['acwTimeout'];logger[_0x389c('0x1c')](_0x389c('0x38'),_0x51b674,_0x1d2b44);RpcUser['getAgent'](this[_0x389c('0x7')][_0x1d2b44]['id'])[_0x389c('0x26')](function(_0xdff088){if(_0xdff088['pauseType']===_0x389c('0x39')){return RpcUser[_0x389c('0x3a')](_0x2b2b50['agents'][_0x1d2b44]);}});RpcVoiceAgentReport[_0x389c('0x1a')]({'acwtime':_0x4c101b,'agentacw':!![]},_0x51b674,_0x1d2b44)['then'](function(_0x1dc5f4){logger['info'](_0x389c('0x3b'),_0x51b674,_0x4c101b,_0x1dc5f4);})[_0x389c('0x1d')](function(_0x302704){logger[_0x389c('0x1e')](_0x389c('0x3c'),_0x51b674,_0x302704);});}else{logger['error'](_0x389c('0x3d'),_0x1d2b44);if(_0x2b2b50[_0x389c('0x8')]){logger[_0x389c('0x1c')]('[ACW][TIMERS]',JSON[_0x389c('0x3e')](_0x2b2b50['timers']));}}}catch(_0x2cb435){logger['error'](_0x389c('0x3f'),_0x2cb435[_0x389c('0x37')]);}};Acw[_0x389c('0x17')]['syncAgentConnect']=function(_0x2409b2){try{if(this[_0x389c('0x6')][_0x2409b2[_0x389c('0x33')]]&&(this['voiceQueues'][_0x2409b2[_0x389c('0x33')]][_0x389c('0x3')]||this[_0x389c('0x6')][_0x2409b2[_0x389c('0x33')]][_0x389c('0x21')])){if(this['agents'][_0x2409b2[_0x389c('0x40')]]){this['channels'][_0x2409b2[_0x389c('0x1b')]]={'queue':_0x2409b2['queue'],'interface':_0x2409b2[_0x389c('0x40')],'destlinkedid':_0x2409b2[_0x389c('0x2b')]};}}}catch(_0x59c407){logger[_0x389c('0x1e')](_0x389c('0x41'),_0x59c407['message']);}};Acw[_0x389c('0x17')]['syncAgentConnectPreview']=function(_0x523f22){try{if(this[_0x389c('0x6')][_0x523f22['queue']]&&(this[_0x389c('0x6')][_0x523f22[_0x389c('0x33')]][_0x389c('0x3')]||this['voiceQueues'][_0x523f22[_0x389c('0x33')]][_0x389c('0x21')])){if(this[_0x389c('0x7')][_0x523f22[_0x389c('0x40')]]){this[_0x389c('0x9')][_0x523f22[_0x389c('0x1b')]]={'queue':_0x523f22['queue'],'interface':_0x523f22[_0x389c('0x40')]};}}}catch(_0x900277){logger['error'](_0x389c('0x42'),_0x900277[_0x389c('0x37')]);}};Acw['prototype'][_0x389c('0xc')]=function(_0x678017){try{if(this['channels'][_0x678017[_0x389c('0x1b')]]&&_[_0x389c('0x43')](this[_0x389c('0x9')][_0x678017[_0x389c('0x1b')]][_0x389c('0x2a')])){logger['info'](_0x389c('0x44'),_0x678017[_0x389c('0x1b')]);this['startAcw'](_0x678017[_0x389c('0x1b')]);}else if(this['channels'][_0x678017['linkedid']]&&_['isUndefined'](this[_0x389c('0x9')][_0x678017['linkedid']]['attended'])){logger[_0x389c('0x1c')]('[%s][HANGUP:LINKEDID]',_0x678017[_0x389c('0x45')]);this['startAcw'](_0x678017[_0x389c('0x45')]);}}catch(_0x44138c){logger[_0x389c('0x1e')](_0x389c('0x46'),_0x44138c[_0x389c('0x37')]);}};Acw[_0x389c('0x17')]['syncHangup']=function(_0x557c7f){try{if(this[_0x389c('0x9')][_0x557c7f[_0x389c('0x1b')]]&&this[_0x389c('0x9')][_0x557c7f[_0x389c('0x1b')]][_0x389c('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x557c7f[_0x389c('0x1b')]);this[_0x389c('0x20')](_0x557c7f[_0x389c('0x1b')]);}else if(this[_0x389c('0x9')][_0x557c7f['linkedid']]&&this[_0x389c('0x9')][_0x557c7f[_0x389c('0x45')]][_0x389c('0x2a')]){logger[_0x389c('0x1c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x557c7f[_0x389c('0x45')]);this[_0x389c('0x20')](_0x557c7f[_0x389c('0x45')]);}}catch(_0x5ca25c){logger[_0x389c('0x1e')]('[ACW][syncHangup]\x20%s',_0x5ca25c['message']);}};Acw[_0x389c('0x17')][_0x389c('0x12')]=function(_0x110ec8){try{if(!_[_0x389c('0x47')](this[_0x389c('0x9')][_0x110ec8[_0x389c('0x48')]])){this[_0x389c('0x20')](_0x110ec8[_0x389c('0x48')]);if(this[_0x389c('0x9')][_0x110ec8['secondtransfereruniqueid']]){this[_0x389c('0x9')][_0x110ec8['secondtransfereruniqueid']][_0x389c('0x2a')]=!![];this[_0x389c('0x9')][_0x110ec8['transfertargetuniqueid']]=this[_0x389c('0x9')][_0x110ec8[_0x389c('0x49')]];this[_0x389c('0x4a')](_0x110ec8[_0x389c('0x49')]);}}else if(!_[_0x389c('0x47')](this[_0x389c('0x9')][_0x110ec8[_0x389c('0x4b')]])){this[_0x389c('0x20')](_0x110ec8[_0x389c('0x4b')]);if(this['channels'][_0x110ec8['origtransfereruniqueid']]){this[_0x389c('0x9')][_0x110ec8[_0x389c('0x4c')]][_0x389c('0x2a')]=!![];this[_0x389c('0x9')][_0x110ec8[_0x389c('0x48')]]=this[_0x389c('0x9')][_0x110ec8[_0x389c('0x4c')]];this[_0x389c('0x4a')](_0x110ec8[_0x389c('0x4c')]);}}}catch(_0x5f3eac){logger[_0x389c('0x1e')](_0x389c('0x4d'),_0x5f3eac[_0x389c('0x37')]);}};Acw[_0x389c('0x17')]['syncBlindTransfer']=function(_0x55e8b1){try{if(this[_0x389c('0x9')][_0x55e8b1[_0x389c('0x4e')]]){logger[_0x389c('0x1c')](_0x389c('0x4f'),JSON[_0x389c('0x3e')](_0x55e8b1[_0x389c('0x4e')]));this[_0x389c('0x20')](_0x55e8b1['transfereruniqueid']);}else if(this['channels'][_0x55e8b1[_0x389c('0x50')]]){logger[_0x389c('0x1c')](_0x389c('0x51'),JSON['stringify'](_0x55e8b1[_0x389c('0x50')]));this[_0x389c('0x20')](_0x55e8b1[_0x389c('0x50')]);}}catch(_0x1749bb){logger[_0x389c('0x1e')]('[ACW][syncBlindTransfer]\x20%s',_0x1749bb[_0x389c('0x37')]);}};Acw[_0x389c('0x17')][_0x389c('0x11')]=function(_0x2493aa){try{if(this[_0x389c('0x6')][_0x2493aa[_0x389c('0x33')]]&&this[_0x389c('0x6')][_0x2493aa[_0x389c('0x33')]][_0x389c('0x52')]===_0x389c('0x53')){if(this['agents'][_0x2493aa['interface']]){logger[_0x389c('0x1c')](_0x389c('0x54'),_0x2493aa[_0x389c('0x1b')],_0x2493aa[_0x389c('0x40')],_0x2493aa[_0x389c('0x33')]);return RpcUser[_0x389c('0x2c')](this[_0x389c('0x7')][_0x2493aa[_0x389c('0x40')]],'Auto-Pause',_0x2493aa[_0x389c('0x1b')]);}}}catch(_0x908c78){logger['error'](_0x389c('0x55'),_0x908c78[_0x389c('0x37')]);}};Acw[_0x389c('0x17')][_0x389c('0x4a')]=function(_0x13c160,_0x5b9db1=0x2710){if(this[_0x389c('0x9')][_0x13c160]){setTimeout(()=>{delete this[_0x389c('0x9')][_0x13c160];},_0x5b9db1);}};module[_0x389c('0x56')]=Acw; \ No newline at end of file +var _0x0faa=['../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','updateAcw','lastPauseAt','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','prototype','startAcw','queue','ACW','name','mandatoryDispositionPause','QueuePause','then','getAgent','info','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','interface','[ACW][syncAgentConnect]\x20%s','message','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','../ami','acw','../rpc/user'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0x0faa,0xb3));var _0xa0fa=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x0faa[_0x23e7c1];return _0x1add43;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0xa0fa('0x0'));var logger=require('../../../config/logger')(_0xa0fa('0x1'));var RpcUser=require(_0xa0fa('0x2'));var RpcVoiceAgentReport=require(_0xa0fa('0x3'));function Acw(_0x1cf2a1){this[_0xa0fa('0x4')]=_0x1cf2a1[_0xa0fa('0x4')];this[_0xa0fa('0x5')]=_0x1cf2a1[_0xa0fa('0x5')];this[_0xa0fa('0x6')]=_0x1cf2a1[_0xa0fa('0x6')];this[_0xa0fa('0x7')]={};ami['on'](_0xa0fa('0x8'),this[_0xa0fa('0x9')][_0xa0fa('0xa')](this));ami['on'](_0xa0fa('0xb'),this[_0xa0fa('0xc')][_0xa0fa('0xa')](this));ami['on']('hangup',this[_0xa0fa('0xd')][_0xa0fa('0xa')](this));ami['on'](_0xa0fa('0xe'),this[_0xa0fa('0xf')]['bind'](this));ami['on'](_0xa0fa('0x10'),this[_0xa0fa('0x11')][_0xa0fa('0xa')](this));ami['on'](_0xa0fa('0x12'),this[_0xa0fa('0x13')][_0xa0fa('0xa')](this));ami['on'](_0xa0fa('0x14'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x8ddf52){var _0x3a88e7=moment()[_0xa0fa('0x15')](0x0);var _0x1e7a3d=moment(_0x8ddf52)[_0xa0fa('0x15')](0x0);return _0x3a88e7[_0xa0fa('0x16')](_0x1e7a3d,_0xa0fa('0x17'));}Acw['prototype'][_0xa0fa('0x18')]=function(_0x1971d4,_0x4f19d5){var _0x4bc13f=this;var _0xd820d0=getDiff(_0x4bc13f[_0xa0fa('0x6')][_0x1971d4][_0xa0fa('0x19')]);clearTimeout(_0x4bc13f[_0xa0fa('0x6')][_0x1971d4][_0xa0fa('0x1a')]);_0x4bc13f[_0xa0fa('0x6')][_0x1971d4][_0xa0fa('0x1a')]=![];return RpcVoiceAgentReport[_0xa0fa('0x1b')]({'acwtime':_0xd820d0},_0x4bc13f['timers'][_0x1971d4][_0xa0fa('0x1c')],_0x1971d4)['then'](function(_0x1c8e5b){logger['info'](_0xa0fa('0x1d'),_0x4f19d5,_0xd820d0,_0x1c8e5b);})[_0xa0fa('0x1e')](function(_0x5a8b4a){logger[_0xa0fa('0x1f')](_0xa0fa('0x20'),_0x4f19d5,_0x5a8b4a);})[_0xa0fa('0x21')](function(){delete _0x4bc13f['timers'][_0x1971d4];});};Acw[_0xa0fa('0x22')][_0xa0fa('0x23')]=function(_0x3c09a4){try{var _0x4435a1=this;var _0x26ef65=this[_0xa0fa('0x7')][_0x3c09a4]['interface'];var _0x329b08=this[_0xa0fa('0x7')][_0x3c09a4][_0xa0fa('0x24')];var _0x3c0808=this[_0xa0fa('0x4')][_0x329b08];var _0x2a4b84=![];var _0x16be46=_0xa0fa('0x25');if(_0x3c0808['mandatoryDisposition']&&_0x3c0808['mandatoryDispositionPause'][_0xa0fa('0x26')]){_0x2a4b84=!![];_0x16be46=_0x3c0808[_0xa0fa('0x27')][_0xa0fa('0x26')];}return ami['Action']({'action':_0xa0fa('0x28'),'interface':_0x26ef65,'paused':!![],'reason':_0x16be46})[_0xa0fa('0x29')](function(){if(_0x4435a1['agents'][_0x26ef65]){return RpcUser[_0xa0fa('0x2a')](_0x4435a1['agents'][_0x26ef65]['id'])[_0xa0fa('0x29')](function(_0x206256){if(!_0x206256||_0x206256['voicePause']){logger[_0xa0fa('0x2b')](_0xa0fa('0x2c'),_0x3c09a4,_0x26ef65,_0x329b08);return;}logger['info'](_0xa0fa('0x2d'),_0x3c09a4,_0x26ef65,_0x329b08);var _0x497ef0=_0x4435a1[_0xa0fa('0x7')][_0x3c09a4][_0xa0fa('0x2e')]&&_0x4435a1[_0xa0fa('0x7')][_0x3c09a4][_0xa0fa('0x2f')]?_0x4435a1['channels'][_0x3c09a4][_0xa0fa('0x2f')]:_0x3c09a4;return RpcUser[_0xa0fa('0x30')](_0x4435a1[_0xa0fa('0x5')][_0x26ef65],_0x16be46,_0x497ef0)[_0xa0fa('0x29')](function(_0x74817f){_0x4435a1[_0xa0fa('0x4')][_0x329b08][_0xa0fa('0x31')]-=0x1;_0x4435a1[_0xa0fa('0x4')][_0x329b08][_0xa0fa('0x32')]+=0x1;return _0x74817f;});})[_0xa0fa('0x29')](function(_0x22c07f){if(_0x2a4b84||!_0x22c07f){return;}_0x4435a1[_0xa0fa('0x6')][_0x26ef65]={};logger[_0xa0fa('0x2b')](_0xa0fa('0x33'),_0x3c09a4,_0x4435a1[_0xa0fa('0x4')][_0x329b08][_0xa0fa('0x34')],_0x26ef65,_0x329b08);_0x4435a1[_0xa0fa('0x6')][_0x26ef65][_0xa0fa('0x1a')]=setTimeout(_0x4435a1[_0xa0fa('0x35')][_0xa0fa('0xa')](_0x4435a1,_0x26ef65),_0x4435a1[_0xa0fa('0x4')][_0x329b08]['acwTimeout']*0x3e8);_0x4435a1[_0xa0fa('0x6')][_0x26ef65][_0xa0fa('0x19')]=moment()[_0xa0fa('0x36')]('YYYY-MM-DD\x20HH:mm:ss');_0x4435a1[_0xa0fa('0x6')][_0x26ef65][_0xa0fa('0x1c')]=_0x3c09a4;_0x4435a1[_0xa0fa('0x6')][_0x26ef65]['queue']=_0x329b08;_0x4435a1[_0xa0fa('0x6')][_0x26ef65][_0xa0fa('0x18')]=_0x4435a1['updateAcw'][_0xa0fa('0xa')](_0x4435a1,_0x26ef65,_0x3c09a4);});}})[_0xa0fa('0x1e')](function(){logger[_0xa0fa('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x3c09a4,_0x4435a1['voiceQueues'][_0x329b08][_0xa0fa('0x34')],_0x26ef65,_0x329b08);})[_0xa0fa('0x21')](function(){delete _0x4435a1['channels'][_0x3c09a4];});}catch(_0x16b338){logger[_0xa0fa('0x1f')](_0xa0fa('0x37'),_0x16b338['message']);}};Acw[_0xa0fa('0x22')]['stopAcw']=function(_0x680a40){try{var _0x3e5d7c=this;if(_0x3e5d7c['timers'][_0x680a40]){_0x3e5d7c['timers'][_0x680a40][_0xa0fa('0x1a')]=![];var _0x531d89=_0x3e5d7c[_0xa0fa('0x6')][_0x680a40][_0xa0fa('0x1c')];var _0x16f879=_0x3e5d7c[_0xa0fa('0x6')][_0x680a40]['queue'];var _0x49cab8=_0x3e5d7c[_0xa0fa('0x4')][_0x16f879][_0xa0fa('0x34')];logger[_0xa0fa('0x2b')](_0xa0fa('0x38'),_0x531d89,_0x680a40);RpcUser['getAgent'](this[_0xa0fa('0x5')][_0x680a40]['id'])[_0xa0fa('0x29')](function(_0x2db7ce){if(_0x2db7ce[_0xa0fa('0x39')]===_0xa0fa('0x25')){return RpcUser[_0xa0fa('0x3a')](_0x3e5d7c[_0xa0fa('0x5')][_0x680a40]);}});RpcVoiceAgentReport[_0xa0fa('0x1b')]({'acwtime':_0x49cab8,'agentacw':!![]},_0x531d89,_0x680a40)[_0xa0fa('0x29')](function(_0x2d5cfe){logger[_0xa0fa('0x2b')](_0xa0fa('0x1d'),_0x531d89,_0x49cab8,_0x2d5cfe);})[_0xa0fa('0x1e')](function(_0x5dc9d4){logger['error'](_0xa0fa('0x20'),_0x531d89,_0x5dc9d4);});}else{logger[_0xa0fa('0x1f')](_0xa0fa('0x3b'),_0x680a40);if(_0x3e5d7c['timers']){logger['info'](_0xa0fa('0x3c'),JSON[_0xa0fa('0x3d')](_0x3e5d7c[_0xa0fa('0x6')]));}}}catch(_0x52e668){logger[_0xa0fa('0x1f')]('[ACW][STOP]\x20%s',_0x52e668['message']);}};Acw[_0xa0fa('0x22')][_0xa0fa('0x9')]=function(_0x389319){try{if(this[_0xa0fa('0x4')][_0x389319[_0xa0fa('0x24')]]&&(this['voiceQueues'][_0x389319[_0xa0fa('0x24')]]['acw']||this['voiceQueues'][_0x389319[_0xa0fa('0x24')]][_0xa0fa('0x3e')])){if(this[_0xa0fa('0x5')][_0x389319[_0xa0fa('0x3f')]]){this[_0xa0fa('0x7')][_0x389319[_0xa0fa('0x1c')]]={'queue':_0x389319[_0xa0fa('0x24')],'interface':_0x389319[_0xa0fa('0x3f')],'destlinkedid':_0x389319['destlinkedid']};}}}catch(_0x26d4c6){logger[_0xa0fa('0x1f')](_0xa0fa('0x40'),_0x26d4c6[_0xa0fa('0x41')]);}};Acw[_0xa0fa('0x22')][_0xa0fa('0x42')]=function(_0x1a5c9e){try{if(this['voiceQueues'][_0x1a5c9e[_0xa0fa('0x24')]]&&(this[_0xa0fa('0x4')][_0x1a5c9e[_0xa0fa('0x24')]]['acw']||this[_0xa0fa('0x4')][_0x1a5c9e[_0xa0fa('0x24')]]['mandatoryDisposition'])){if(this[_0xa0fa('0x5')][_0x1a5c9e['interface']]){this[_0xa0fa('0x7')][_0x1a5c9e['uniqueid']]={'queue':_0x1a5c9e['queue'],'interface':_0x1a5c9e['interface']};}}}catch(_0x177705){logger[_0xa0fa('0x1f')](_0xa0fa('0x43'),_0x177705[_0xa0fa('0x41')]);}};Acw[_0xa0fa('0x22')][_0xa0fa('0xc')]=function(_0x51ede0){try{if(this[_0xa0fa('0x7')][_0x51ede0[_0xa0fa('0x1c')]]&&_[_0xa0fa('0x44')](this[_0xa0fa('0x7')][_0x51ede0['uniqueid']][_0xa0fa('0x2e')])){logger[_0xa0fa('0x2b')](_0xa0fa('0x45'),_0x51ede0[_0xa0fa('0x1c')]);this[_0xa0fa('0x23')](_0x51ede0['uniqueid']);}else if(this[_0xa0fa('0x7')][_0x51ede0[_0xa0fa('0x46')]]&&_['isUndefined'](this[_0xa0fa('0x7')][_0x51ede0['linkedid']][_0xa0fa('0x2e')])){logger[_0xa0fa('0x2b')](_0xa0fa('0x47'),_0x51ede0[_0xa0fa('0x46')]);this[_0xa0fa('0x23')](_0x51ede0[_0xa0fa('0x46')]);}}catch(_0x32df30){logger[_0xa0fa('0x1f')](_0xa0fa('0x48'),_0x32df30['message']);}};Acw['prototype'][_0xa0fa('0xd')]=function(_0xbebd56){try{if(this[_0xa0fa('0x7')][_0xbebd56[_0xa0fa('0x1c')]]&&this[_0xa0fa('0x7')][_0xbebd56['uniqueid']]['attended']){logger[_0xa0fa('0x2b')](_0xa0fa('0x49'),_0xbebd56[_0xa0fa('0x1c')]);this[_0xa0fa('0x23')](_0xbebd56[_0xa0fa('0x1c')]);}else if(this['channels'][_0xbebd56['linkedid']]&&this['channels'][_0xbebd56[_0xa0fa('0x46')]][_0xa0fa('0x2e')]){logger[_0xa0fa('0x2b')](_0xa0fa('0x4a'),_0xbebd56['linkedid']);this['startAcw'](_0xbebd56[_0xa0fa('0x46')]);}}catch(_0x14f8a5){logger[_0xa0fa('0x1f')](_0xa0fa('0x4b'),_0x14f8a5[_0xa0fa('0x41')]);}};Acw[_0xa0fa('0x22')][_0xa0fa('0x11')]=function(_0x2adf08){try{if(!_[_0xa0fa('0x4c')](this[_0xa0fa('0x7')][_0x2adf08[_0xa0fa('0x4d')]])){this[_0xa0fa('0x23')](_0x2adf08[_0xa0fa('0x4d')]);if(this[_0xa0fa('0x7')][_0x2adf08[_0xa0fa('0x4e')]]){this['channels'][_0x2adf08['secondtransfereruniqueid']][_0xa0fa('0x2e')]=!![];this[_0xa0fa('0x7')][_0x2adf08[_0xa0fa('0x4f')]]=this[_0xa0fa('0x7')][_0x2adf08[_0xa0fa('0x4e')]];this['deleteChannelAfterTimeout'](_0x2adf08[_0xa0fa('0x4e')]);}}else if(!_[_0xa0fa('0x4c')](this['channels'][_0x2adf08['transfertargetuniqueid']])){this['startAcw'](_0x2adf08[_0xa0fa('0x4f')]);if(this['channels'][_0x2adf08[_0xa0fa('0x50')]]){this[_0xa0fa('0x7')][_0x2adf08[_0xa0fa('0x50')]][_0xa0fa('0x2e')]=!![];this[_0xa0fa('0x7')][_0x2adf08[_0xa0fa('0x4d')]]=this['channels'][_0x2adf08[_0xa0fa('0x50')]];this[_0xa0fa('0x51')](_0x2adf08[_0xa0fa('0x50')]);}}}catch(_0x2dfd82){logger[_0xa0fa('0x1f')](_0xa0fa('0x52'),_0x2dfd82[_0xa0fa('0x41')]);}};Acw[_0xa0fa('0x22')]['syncBlindTransfer']=function(_0x1bd744){try{if(this['channels'][_0x1bd744[_0xa0fa('0x53')]]){logger[_0xa0fa('0x2b')](_0xa0fa('0x54'),JSON[_0xa0fa('0x3d')](_0x1bd744['transfereruniqueid']));this[_0xa0fa('0x23')](_0x1bd744['transfereruniqueid']);}else if(this[_0xa0fa('0x7')][_0x1bd744['transfererlinkedid']]){logger['info'](_0xa0fa('0x55'),JSON[_0xa0fa('0x3d')](_0x1bd744[_0xa0fa('0x56')]));this[_0xa0fa('0x23')](_0x1bd744[_0xa0fa('0x56')]);}}catch(_0x477561){logger[_0xa0fa('0x1f')]('[ACW][syncBlindTransfer]\x20%s',_0x477561[_0xa0fa('0x41')]);}};Acw[_0xa0fa('0x22')][_0xa0fa('0xf')]=function(_0x5e3707){try{if(this[_0xa0fa('0x4')][_0x5e3707[_0xa0fa('0x24')]]&&this['voiceQueues'][_0x5e3707['queue']][_0xa0fa('0x57')]==='all'){if(this[_0xa0fa('0x5')][_0x5e3707['interface']]){logger[_0xa0fa('0x2b')](_0xa0fa('0x58'),_0x5e3707['uniqueid'],_0x5e3707[_0xa0fa('0x3f')],_0x5e3707[_0xa0fa('0x24')]);return RpcUser[_0xa0fa('0x30')](this[_0xa0fa('0x5')][_0x5e3707['interface']],_0xa0fa('0x59'),_0x5e3707[_0xa0fa('0x1c')]);}}}catch(_0x5c3715){logger[_0xa0fa('0x1f')](_0xa0fa('0x5a'),_0x5c3715[_0xa0fa('0x41')]);}};Acw['prototype'][_0xa0fa('0x51')]=function(_0x33d7c3,_0x21a6b7=0x2710){if(this[_0xa0fa('0x7')][_0x33d7c3]){setTimeout(()=>{delete this[_0xa0fa('0x7')][_0x33d7c3];},_0x21a6b7);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ea3e7d0..4020bd5 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 _0x3492=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','asterisk-manager','bluebird','../../config/logger','ami','asterisk','port','username','Action','promisify','action','error','format','inspect'];(function(_0x1fc716,_0x263857){var _0x637fd3=function(_0x1fbfeb){while(--_0x1fbfeb){_0x1fc716['push'](_0x1fc716['shift']());}};_0x637fd3(++_0x263857);}(_0x3492,0xe8));var _0x2349=function(_0x5b3005,_0x532daf){_0x5b3005=_0x5b3005-0x0;var _0x308629=_0x3492[_0x5b3005];return _0x308629;};'use strict';var Manager=require(_0x2349('0x0'));var BPromise=require(_0x2349('0x1'));var util=require('util');var logger=require(_0x2349('0x2'))(_0x2349('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x2349('0x4')][_0x2349('0x5')],config[_0x2349('0x4')]['ip'],config['asterisk'][_0x2349('0x6')],config['asterisk']['password'],!![]);ami['keepConnected']();ami[_0x2349('0x7')]=BPromise[_0x2349('0x8')](ami[_0x2349('0x9')]);function error(_0x101540){logger[_0x2349('0xa')](util[_0x2349('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2349('0x4')]['username'],config[_0x2349('0x4')]['ip'],config[_0x2349('0x4')][_0x2349('0x5')],util[_0x2349('0xc')](_0x101540,![],null)));}function close(){logger['error'](util[_0x2349('0xb')](_0x2349('0xd'),config[_0x2349('0x4')][_0x2349('0x6')],config[_0x2349('0x4')]['ip'],config['asterisk'][_0x2349('0x5')]));}ami[_0x2349('0xe')]=function(){return function(){return ami[_0x2349('0x7')]({'action':_0x2349('0xf')});};};ami[_0x2349('0x10')]=function(){return function(){return ami['Action']({'action':_0x2349('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x2349('0x7')]({'action':_0x2349('0x12')});};};ami[_0x2349('0x13')]=function(){return function(){return ami['Action']({'action':_0x2349('0x14')});};};ami[_0x2349('0x15')]=function(){return function(){return ami['Action']({'action':_0x2349('0x16')});};};function connect(){logger[_0x2349('0x17')](util[_0x2349('0xb')](_0x2349('0x18'),config['asterisk'][_0x2349('0x6')],config[_0x2349('0x4')]['ip'],config[_0x2349('0x4')][_0x2349('0x5')]));ami[_0x2349('0x19')](_0x2349('0xa'),error);ami[_0x2349('0x19')](_0x2349('0x1a'),close);}ami['on'](_0x2349('0x1b'),connect);ami['on'](_0x2349('0x1c'),function(_0xa9a0e8){logger[_0x2349('0x17')](util['format'](_0x2349('0x1d'),config['asterisk'][_0x2349('0x6')],config[_0x2349('0x4')]['ip'],config[_0x2349('0x4')]['port'],util[_0x2349('0xc')](_0xa9a0e8,![],null)));});ami['on']('fullybooted',function(){logger[_0x2349('0x17')](util[_0x2349('0xb')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x2349('0x4')][_0x2349('0x6')],config[_0x2349('0x4')]['ip'],config[_0x2349('0x4')]['port']));return Promise[_0x2349('0x1e')]()['then'](ami[_0x2349('0xe')]())[_0x2349('0x1f')](ami[_0x2349('0x10')]())[_0x2349('0x1f')](ami[_0x2349('0x20')]())['then'](ami[_0x2349('0x13')]())[_0x2349('0x1f')](ami['actionCoreShowChannels']())[_0x2349('0x21')](function(_0x39fc75){logger[_0x2349('0xa')](_0x2349('0x22'),util['inspect'](_0x39fc75,{'showHidden':![],'depth':null}));});});ami[_0x2349('0x19')]('error',error);ami[_0x2349('0x19')](_0x2349('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0x5a0b=['Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionDeviceStateList','then','catch','[ami.js][fullybooted]','close','bluebird','util','../../config/logger','asterisk','password','keepConnected','promisify','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','sipshowregistry','Action','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect'];(function(_0x499bcf,_0x46f0fd){var _0x5b795f=function(_0x4efe95){while(--_0x4efe95){_0x499bcf['push'](_0x499bcf['shift']());}};_0x5b795f(++_0x46f0fd);}(_0x5a0b,0xd9));var _0xb5a0=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x5a0b[_0x4d8ed9];return _0x1e2140;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xb5a0('0x0'));var util=require(_0xb5a0('0x1'));var logger=require(_0xb5a0('0x2'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0xb5a0('0x3')]['port'],config[_0xb5a0('0x3')]['ip'],config[_0xb5a0('0x3')]['username'],config[_0xb5a0('0x3')][_0xb5a0('0x4')],!![]);ami[_0xb5a0('0x5')]();ami['Action']=BPromise[_0xb5a0('0x6')](ami['action']);function error(_0x178ecd){logger[_0xb5a0('0x7')](util['format'](_0xb5a0('0x8'),config['asterisk']['username'],config[_0xb5a0('0x3')]['ip'],config[_0xb5a0('0x3')][_0xb5a0('0x9')],util['inspect'](_0x178ecd,![],null)));}function close(){logger[_0xb5a0('0x7')](util[_0xb5a0('0xa')](_0xb5a0('0xb'),config[_0xb5a0('0x3')][_0xb5a0('0xc')],config[_0xb5a0('0x3')]['ip'],config[_0xb5a0('0x3')][_0xb5a0('0x9')]));}ami[_0xb5a0('0xd')]=function(){return function(){return ami['Action']({'action':_0xb5a0('0xe')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xb5a0('0xf')]({'action':_0xb5a0('0x10')});};};ami[_0xb5a0('0x11')]=function(){return function(){return ami[_0xb5a0('0xf')]({'action':'sippeerstatus'});};};ami[_0xb5a0('0x12')]=function(){return function(){return ami['Action']({'action':_0xb5a0('0x13')});};};ami[_0xb5a0('0x14')]=function(){return function(){return ami['Action']({'action':_0xb5a0('0x15')});};};function connect(){logger[_0xb5a0('0x16')](util['format'](_0xb5a0('0x17'),config[_0xb5a0('0x3')][_0xb5a0('0xc')],config[_0xb5a0('0x3')]['ip'],config[_0xb5a0('0x3')][_0xb5a0('0x9')]));ami[_0xb5a0('0x18')](_0xb5a0('0x7'),error);ami[_0xb5a0('0x18')]('close',close);}ami['on']('connect',connect);ami['on'](_0xb5a0('0x19'),function(_0x3ed3e1){logger[_0xb5a0('0x16')](util[_0xb5a0('0xa')](_0xb5a0('0x1a'),config[_0xb5a0('0x3')]['username'],config[_0xb5a0('0x3')]['ip'],config[_0xb5a0('0x3')][_0xb5a0('0x9')],util[_0xb5a0('0x1b')](_0x3ed3e1,![],null)));});ami['on']('fullybooted',function(){logger['info'](util[_0xb5a0('0xa')](_0xb5a0('0x1c'),config[_0xb5a0('0x3')]['username'],config[_0xb5a0('0x3')]['ip'],config[_0xb5a0('0x3')]['port']));return Promise[_0xb5a0('0x1d')]()['then'](ami[_0xb5a0('0xd')]())['then'](ami[_0xb5a0('0x1e')]())[_0xb5a0('0x1f')](ami[_0xb5a0('0x11')]())[_0xb5a0('0x1f')](ami['actionQueueSummary']())[_0xb5a0('0x1f')](ami[_0xb5a0('0x14')]())[_0xb5a0('0x20')](function(_0x46670d){logger[_0xb5a0('0x7')](_0xb5a0('0x21'),util[_0xb5a0('0x1b')](_0x46670d,{'showHidden':![],'depth':null}));});});ami['once'](_0xb5a0('0x7'),error);ami[_0xb5a0('0x18')](_0xb5a0('0x22'),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 a6003e4..943d6e1 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x15df7f,_0x318875){var _0x2cb715=function(_0x10fb5f){while(--_0x10fb5f){_0x15df7f['push'](_0x15df7f['shift']());}};_0x2cb715(++_0x318875);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3b0fc3,_0x14ae81){_0x3b0fc3=_0x3b0fc3-0x0;var _0xe93d0e=_0xf4eb[_0x3b0fc3];return _0xe93d0e;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xda3f,0xec));var _0xfda3=function(_0x20e854,_0xea9a85){_0x20e854=_0x20e854-0x0;var _0x16b34f=_0xda3f[_0x20e854];return _0x16b34f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index ffb9dea..bb9224c 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 _0x4720=['some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','catch','Failure','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','dialMethod','handlePower','power','dialPowerLevel','method\x20not\x20recognized','silly','Dialer::ifTime()','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','type','outboundAnswerCallsDay','agent','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','ListId','VoiceQueueId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','ContactId','CampaignId','[syncAgentComplete][createHistory][11]','channel','strategy','roundrobin','actionid','isNil','locked','paused','stateinterface','rrmemory','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','run','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countnoanswerretry','stateGlobal','dialMachineMaxRetry','dialMachineRetryFrequency','minutes','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Normal\x20Clearing','Unknow','syncQueueSummary','running','isPreviewCampaign','getQueueCampaignStatusMessage','statusMessage','available','inUse','talking','pTalking','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[callProgressDetecting]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','dropRate','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','check\x20failure','floor','erlangCallToSecond','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','limitCalls','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','getContactDialer','countReScheduled','tryOriginatePredictive','not_inuse','dialOrderByScheduledAt','[countReScheduled]\x20','checkIsBlackList','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','busyFactor','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','m\x20=\x20','Ts\x20=\x20','util','lodash','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','hangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x4720,0x187));var _0x0472=function(_0x3c4dad,_0x25ffd5){_0x3c4dad=_0x3c4dad-0x0;var _0x1a4f49=_0x4720[_0x3c4dad];return _0x1a4f49;};'use strict';var util=require(_0x0472('0x0'));var _=require(_0x0472('0x1'));var uuid=require(_0x0472('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x0472('0x3'));var utils=require(_0x0472('0x4'));var hopperUtils=require(_0x0472('0x5'));var ut=require(_0x0472('0x6'));var config=require(_0x0472('0x7'));var logger=require(_0x0472('0x8'))(_0x0472('0x9'));var loggerBooked=require(_0x0472('0x8'))(_0x0472('0xa'));var loggerPredictive=require(_0x0472('0x8'))(_0x0472('0xb'));var loggerPredictiveCalls=require(_0x0472('0x8'))(_0x0472('0xc'));var loggerSyncQueueSummary=require(_0x0472('0x8'))('syncQueueSummary');var ami=require(_0x0472('0xd'));config[_0x0472('0xe')]=_[_0x0472('0xf')](config[_0x0472('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x0472('0x10'))(new Redis(config['redis']));var cmHopper=require(_0x0472('0x11'));var voiceQueueRt=require(_0x0472('0x12'));var RpcSetting=require('../rpc/setting');var Interval=require(_0x0472('0x13'));var Action=require(_0x0472('0x14'));var History=require(_0x0472('0x15'));var Final=require(_0x0472('0x16'));var AgentComplete=require(_0x0472('0x17'));var QueueCallerAbandon=require(_0x0472('0x18'));var Hangup=require(_0x0472('0x19'));var ipAgi=process['env'][_0x0472('0x1a')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0472('0x1b')]=function(_0x3030ea){this['tail']=this[_0x0472('0x1c')]?this['tail']['finally'](_0x3030ea):_0x3030ea();};function Dialer(_0x4da4b4,_0x32e1a3){this[_0x0472('0x1d')]=new Sequence();this[_0x0472('0x1e')]=_0x32e1a3;this[_0x0472('0x1f')]=_0x4da4b4[_0x0472('0x1f')];this[_0x0472('0x20')]=_0x4da4b4['campaigns'];this[_0x0472('0x21')]=_0x4da4b4[_0x0472('0x21')];this[_0x0472('0x22')]=_0x4da4b4[_0x0472('0x22')];this['maxNumberOriginate']=config[_0x0472('0x23')]||0x2;this[_0x0472('0x24')]={};this[_0x0472('0x25')]={};this[_0x0472('0x26')]={};this[_0x0472('0x27')]={};this[_0x0472('0x28')]={};this[_0x0472('0x29')]={};this[_0x0472('0x2a')]={};this['ivrOriginated']={};this[_0x0472('0x2b')]={};this['queueBookedRR']={};this[_0x0472('0x2c')]={};ami['on'](_0x0472('0x2d'),this[_0x0472('0x2e')][_0x0472('0x2f')](this));ami['on']('queuecallerabandon',this[_0x0472('0x30')][_0x0472('0x2f')](this));ami['on'](_0x0472('0x31'),this[_0x0472('0x32')][_0x0472('0x2f')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x0472('0x2f')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x0472('0x2f')](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete'][_0x0472('0x2f')](this));ami['on'](_0x0472('0x33'),this['syncHangup'][_0x0472('0x2f')](this));ami['on'](_0x0472('0x34'),this[_0x0472('0x35')][_0x0472('0x2f')](this));ami['on'](_0x0472('0x36'),this[_0x0472('0x37')][_0x0472('0x2f')](this));ami['on']('queuemember',this[_0x0472('0x38')]['bind'](this));ami['on'](_0x0472('0x39'),this[_0x0472('0x3a')][_0x0472('0x2f')](this));this[_0x0472('0x3b')]();this[_0x0472('0x3c')]();RpcSetting[_0x0472('0x3d')]()[_0x0472('0x3e')](function(_0x394b90){previewRecallmeReminderInterval=_0x394b90[_0x0472('0x3f')];});}function isNotNull(_0x5d4820){return _0x5d4820!==null&&!_[_0x0472('0x40')](_0x5d4820);}function msgResponse(_0x413acf,_0x7d10c8,_0x1c0e7f){return{'action':_0x413acf,'response':_0x7d10c8,'message':_0x1c0e7f,'stack':_0x1c0e7f};}function emit(_0x54816f,_0x1c4c0e,_0x48bca2){io['to'](_0x54816f)['emit'](_0x1c4c0e,_0x48bca2);}function emitOutboundVoiceQueueSummary(_0x504ab3){if(_0x504ab3['type']===_0x0472('0x41')){logger[_0x0472('0x42')](_0x0472('0x43'),util[_0x0472('0x44')](_0x504ab3,{'showHidden':![],'depth':null}));emit(util[_0x0472('0x45')](_0x0472('0x46'),_0x504ab3[_0x0472('0x47')]),_0x0472('0x48'),_0x504ab3);}}function checkGetDataPredictive(_0x5d894d){if(isNotNull(_0x5d894d)&&!_[_0x0472('0x49')](_0x5d894d)){loggerPredictive[_0x0472('0x4a')](_0x0472('0x4b'));loggerPredictive[_0x0472('0x4a')](_0x0472('0x4c'),_0x5d894d[_0x0472('0x4d')]);loggerPredictive[_0x0472('0x4a')](_0x0472('0x4e'),_0x5d894d[_0x0472('0x4f')]);loggerPredictive[_0x0472('0x4a')](_0x0472('0x50'),_0x5d894d[_0x0472('0x51')]);loggerPredictive[_0x0472('0x4a')](_0x0472('0x52'),_0x5d894d[_0x0472('0x53')]);loggerPredictive[_0x0472('0x4a')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d894d[_0x0472('0x54')]);loggerPredictive[_0x0472('0x4a')](_0x0472('0x55'),_0x5d894d[_0x0472('0x56')]);loggerPredictive['info'](_0x0472('0x57'));if(_0x5d894d[_0x0472('0x4d')]>0x0){if(!_[_0x0472('0x40')](_0x5d894d[_0x0472('0x56')])&&_0x5d894d[_0x0472('0x56')]>0x0){return!![];}loggerPredictive[_0x0472('0x4a')](_0x0472('0x58'));if(!_[_0x0472('0x40')](_0x5d894d[_0x0472('0x54')])&&_0x5d894d[_0x0472('0x54')]>0x0){return!![];}loggerPredictive['info'](_0x0472('0x59'));}else{loggerPredictive[_0x0472('0x4a')](_0x0472('0x5a'));}}else{loggerPredictive[_0x0472('0x4a')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x122c46){return function(_0x2d59c5){loggerPredictive[_0x0472('0x4a')](_0x0472('0x5b'));loggerPredictive[_0x0472('0x4a')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d59c5[_0x0472('0x5c')]);loggerPredictive[_0x0472('0x4a')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d59c5['erlangCallToSecond']);loggerPredictive[_0x0472('0x4a')](_0x0472('0x5d'),_0x2d59c5[_0x0472('0x5e')]);loggerPredictive[_0x0472('0x4a')](_0x0472('0x5f'),_0x2d59c5[_0x0472('0x60')]);loggerPredictive['info'](_0x0472('0x5d'),_0x2d59c5[_0x0472('0x5e')]);loggerPredictive[_0x0472('0x4a')](_0x0472('0x57'));_[_0x0472('0x61')](_0x122c46,_0x2d59c5);};}function ifInterval(_0xc7d9c3,_0x4b188a){if(_[_0x0472('0x40')](_0x4b188a)){return![];}return utils[_0x0472('0x62')](undefined,_0x4b188a)<_0xc7d9c3*0x3c;}function clearPredictiveAttributes(_0xd76c16){if(_0xd76c16[_0x0472('0x2a')]){_0xd76c16['startProgressive']=undefined;loggerPredictive[_0x0472('0x42')](_0xd76c16[_0x0472('0x47')],_0x0472('0x63'));}if(_0xd76c16[_0x0472('0x29')]){_0xd76c16[_0x0472('0x29')]=undefined;loggerPredictive[_0x0472('0x42')](_0xd76c16[_0x0472('0x47')],_0x0472('0x64'));}if(_0xd76c16[_0x0472('0x65')]){clearInterval(_0xd76c16['handlePredictive']);_0xd76c16['handlePredictive']=undefined;loggerPredictive[_0x0472('0x42')](_0xd76c16[_0x0472('0x47')],_0x0472('0x66'));}}function loggerCatchPredictive(_0x3e15e6,_0x2a532c){return function(_0x416a1f){loggerPredictive[_0x0472('0x67')](_0x2a532c[_0x0472('0x47')],_0x3e15e6);loggerPredictive['error'](_0x416a1f[_0x0472('0x68')]);clearPredictiveAttributes(_0x2a532c);};}function loggerCatch(_0x93c60a){return function(_0x2f0b3f){logger[_0x0472('0x67')](_0x93c60a,util[_0x0472('0x44')](_0x2f0b3f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xeb623c,_0x5cb17e,_0x238033){return function(_0x523336){utils[_0x0472('0x69')](_0x5cb17e,_0x238033,0x0);_0x5cb17e[_0x0472('0x6a')]=0x0;logger[_0x0472('0x67')](_0xeb623c,util['inspect'](_0x523336,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1280b1){return function(_0x5c2a60){if(isNotNull(_0x5c2a60)&&isNotNull(_0x5c2a60[0x0])){if(_0x5c2a60[0x0]['contactsRescheduled']>0x0){_0x1280b1[_0x0472('0x6b')]=utils[_0x0472('0x6c')][_0x0472('0x6d')];logger[_0x0472('0x4a')](_0x0472('0x6e')+_0x1280b1['name'],_0x5c2a60[0x0]['contactsRescheduled'],_0x0472('0x6f'));}else{_0x1280b1[_0x0472('0x6b')]=utils[_0x0472('0x6c')]['NO_AVAILABLE_CONTACTS'];logger[_0x0472('0x4a')](_0x0472('0x70')+_0x1280b1[_0x0472('0x47')]);}}};}function createObjHistory(_0x104993,_0x270966,_0x38b765,_0x290b5e,_0x574fdd){_0x104993[_0x0472('0x6b')]=_0x38b765;var _0xf90a05=new Action(_0x104993,_0x270966);var _0x5f3ace=new History(_0xf90a05);_0x5f3ace[_0x0472('0x71')]=_0x290b5e;_0x5f3ace[_0x0472('0x72')]=_0x574fdd;_0x5f3ace[_0x0472('0x73')]=_0xf90a05['starttime'];return _0x5f3ace;}function unlockQueueStatus(_0x4476c4,_0xb0c89e){setTimeout(function(){if(_[_0x0472('0x40')](_0x4476c4[_0x0472('0x74')])){loggerBooked[_0x0472('0x67')](_0x0472('0x75'),_0xb0c89e);}_0x4476c4[_0x0472('0x74')]=!![];loggerBooked['info'](_0x0472('0x76'),_0xb0c89e,JSON[_0x0472('0x77')](_[_0x0472('0x78')](_0x4476c4,[_0x0472('0x47'),_0x0472('0x74')])));},0x1f3);}function checkInterval(_0x4e623e){return function(){if(!isNotNull(_0x4e623e['Interval'])){_0x4e623e[_0x0472('0x6b')]=utils[_0x0472('0x6c')][_0x0472('0x79')];throw _0x4e623e['name']+_0x0472('0x7a');}if(!isNotNull(_0x4e623e[_0x0472('0x7b')][_0x0472('0x7c')])){_0x4e623e['message']=utils[_0x0472('0x6c')][_0x0472('0x79')];throw _0x4e623e[_0x0472('0x47')]+_0x0472('0x7a');}if(!isNotNull(_['isEmpty'](_0x4e623e['Interval'][_0x0472('0x7c')]))){_0x4e623e[_0x0472('0x6b')]=utils[_0x0472('0x6c')][_0x0472('0x79')];throw _0x4e623e[_0x0472('0x47')]+_0x0472('0x7a');}};}function checkIsIVRCampaignActive(_0x1a20c1){return function(){if(!utils[_0x0472('0x7d')](_0x1a20c1)){_0x1a20c1['message']=utils['CAMPAIGN_STATUS'][_0x0472('0x7e')];throw _0x1a20c1[_0x0472('0x47')]+_0x0472('0x7f');}};}function emitCampaignSummary(_0x4e486d){if(utils[_0x0472('0x80')](_0x4e486d)){emit(util[_0x0472('0x45')](_0x0472('0x81'),_0x4e486d[_0x0472('0x47')]),_0x0472('0x82'),_0x4e486d);}}function loggerCatchQueueSummary(_0x32cbf0,_0x27a89a){return function(_0x17b443){clearPredictiveAttributes(_0x27a89a);emitCampaignSummary(_0x27a89a);loggerSyncQueueSummary[_0x0472('0x42')](_0x32cbf0,util[_0x0472('0x44')](_0x17b443,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x49d637){if(_0x49d637[_0x0472('0x83')]){if(_0x49d637[_0x0472('0x84')]===0x0){_0x49d637['sendMessageOneNotActive']=![];_0x49d637['message']=utils[_0x0472('0x6c')][_0x0472('0x7e')];loggerSyncQueueSummary[_0x0472('0x42')](_0x0472('0x85'),_0x49d637[_0x0472('0x47')],_0x0472('0x86'));}else{_0x49d637[_0x0472('0x6b')]=utils['CAMPAIGN_STATUS']['DISACTIVED'];loggerSyncQueueSummary[_0x0472('0x42')](_0x0472('0x85'),_0x49d637['name'],_0x0472('0x87'));}emitCampaignSummary(_0x49d637);}}function myreject(_0xb0c112){return function(_0x29da48){return _0xb0c112(msgResponse(_0x0472('0x88'),_0x0472('0x89'),JSON['stringify'](_0x29da48)));};}Dialer[_0x0472('0x8a')][_0x0472('0x8b')]=function(_0x12c640){return!_[_0x0472('0x40')](_0x12c640)&&_0x12c640&&!_['isUndefined'](_0x12c640[_0x0472('0x47')])&&!_['isUndefined'](_0x12c640[_0x0472('0x8c')])&&_0x12c640[_0x0472('0x8c')]&&(this[_0x0472('0x22')][util[_0x0472('0x45')]('SIP/%s',_0x12c640[_0x0472('0x47')])][_0x0472('0x8d')]===_0x0472('0x8e')||this[_0x0472('0x22')][util[_0x0472('0x45')](_0x0472('0x8f'),_0x12c640[_0x0472('0x47')])][_0x0472('0x8d')]===_0x0472('0x90'));};Dialer[_0x0472('0x8a')][_0x0472('0x91')]=function(_0x1519f8){var _0xcf138a=this;return function(){if(!_0xcf138a[_0x0472('0x8b')](_0x1519f8[_0x0472('0x92')])){if(!_0xcf138a['isTrunkReachable'](_0x1519f8[_0x0472('0x93')])){_0x1519f8[_0x0472('0x6b')]=utils[_0x0472('0x6c')]['TRUNK_NOT_REACHABLE'];throw _0x1519f8['name']+_0x0472('0x94');}}};};Dialer[_0x0472('0x8a')][_0x0472('0x95')]=function(_0x131dd1,_0x759bc,_0x10bff6,_0x5b858c){var _0x4a594a=this;return function(){var _0x50123e=!![];return _0x4a594a[_0x0472('0x96')](_0x131dd1,_0x759bc,_0x10bff6,_0x5b858c,_0x50123e);};};Dialer['prototype'][_0x0472('0x97')]=function(_0x412b8b,_0x213bf9,_0x14828e,_0x58e12a){var _0x3f506f=this;return function(){var _0x439bd6=![];return _0x3f506f['ifTimeIvr'](_0x412b8b[_0x0472('0x7c')],_0x213bf9,_0x14828e,_0x58e12a,_0x439bd6);};};Dialer[_0x0472('0x8a')][_0x0472('0x96')]=function(_0x42d7c9,_0x1adeaf,_0x476d14,_0x59d658,_0x1587d2){var _0x201795=[];return new Promise(function(_0x1fc67a,_0x348433){if(!isNotNull(_0x42d7c9)){_0x59d658[_0x0472('0x6b')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];return _0x348433(msgResponse('ifTime','Failure',_0x476d14+_0x0472('0x98')));}if(_[_0x0472('0x49')](_0x42d7c9)){_0x59d658[_0x0472('0x6b')]=utils[_0x0472('0x6c')][_0x0472('0x99')];return _0x348433(msgResponse(_0x0472('0x9a'),'Failure',_0x476d14+_0x0472('0x9b')));}if(_0x1adeaf&&_[_0x0472('0x40')](config[_0x0472('0x9c')][_0x1adeaf])){_0x59d658[_0x0472('0x6b')]=utils[_0x0472('0x6c')]['UNKNOWN_TIMEZONE'];return _0x348433(msgResponse('ifTime','Failure',_0x476d14+_0x0472('0x9d')+_0x1adeaf));}if(_[_0x0472('0x9e')](_0x42d7c9)){for(var _0x27c6ce=0x0;_0x27c6ce<_0x42d7c9[_0x0472('0x9f')];_0x27c6ce+=0x1){_0x201795[_0x0472('0xa0')](ami[_0x0472('0xa1')]({'action':_0x0472('0xa2'),'command':util[_0x0472('0x45')](_0x0472('0xa3'),_0x42d7c9[_0x27c6ce][_0x0472('0xa4')],!_[_0x0472('0x40')](config[_0x0472('0x9c')][_0x1adeaf])?_0x1adeaf:'')})[_0x0472('0x3e')](function(_0x4c6dc4){return _0x4c6dc4[_0x0472('0xa5')][_0x0472('0xa6')]('true')>=0x0;})['catch'](myreject(_0x348433)));}}else{_0x201795[_0x0472('0xa0')](ami[_0x0472('0xa1')]({'action':'command','command':util[_0x0472('0x45')](_0x0472('0xa3'),_0x42d7c9,!_[_0x0472('0x40')](config[_0x0472('0x9c')][_0x1adeaf])?_0x1adeaf:'')})[_0x0472('0x3e')](function(_0x27f43d){return _0x27f43d[_0x0472('0xa5')][_0x0472('0xa6')](_0x0472('0xa7'))>=0x0;})['catch'](myreject(_0x348433)));}Promise[_0x0472('0xa8')](_0x201795)[_0x0472('0x3e')](function(_0x2747e7){var _0x5d62b1=_[_0x0472('0xa9')](_0x2747e7);if(_0x5d62b1){return _0x1fc67a(_0x5d62b1);}else{_0x59d658['message']=_0x1587d2?utils[_0x0472('0x6c')][_0x0472('0xaa')]:utils[_0x0472('0x6c')][_0x0472('0xab')];return _0x348433(msgResponse(_0x0472('0xac'),'Failure',_0x0472('0xad')+_0x1587d2+'\x20'+_0x476d14+_0x0472('0xae')+util[_0x0472('0x44')](_0x42d7c9,{'showHidden':![],'depth':null})+_0x0472('0xaf')+_0x1adeaf));}})[_0x0472('0xb0')](function(_0x385af){return _0x348433(msgResponse(_0x0472('0x9a'),_0x0472('0xb1'),JSON['stringify'](_0x385af)));});});};Dialer[_0x0472('0x8a')][_0x0472('0x3b')]=function(){var _0x26ec96=this;return cmHopper[_0x0472('0xb2')]({'active':![]},{'where':{'active':!![]}})[_0x0472('0x3e')](function(){setInterval(function(){_0x26ec96[_0x0472('0xb3')]();},0x3e8);});};Dialer[_0x0472('0x8a')][_0x0472('0xb3')]=function(){var _0x314a0a=this;var _0x30da6b;for(var _0x3b5e96 in this[_0x0472('0x20')]){if(typeof this[_0x0472('0x20')][_0x3b5e96]!==_0x0472('0xb4')){_0x30da6b=this['campaigns'][_0x3b5e96];if(utils['isIVRCampaign'](_0x30da6b)&&utils['isIVRCampaignActive'](_0x30da6b)){_0x30da6b[_0x0472('0x83')]=!![];Promise[_0x0472('0xb5')]()['then'](checkIsIVRCampaignActive(_0x30da6b))[_0x0472('0x3e')](checkInterval(_0x30da6b))['then'](_0x314a0a[_0x0472('0x91')](_0x30da6b))[_0x0472('0x3e')](_0x314a0a[_0x0472('0x95')](_0x30da6b[_0x0472('0xb6')],_0x30da6b[_0x0472('0xb7')],_0x30da6b[_0x0472('0x47')],_0x30da6b))[_0x0472('0x3e')](_0x314a0a[_0x0472('0x97')](_0x30da6b[_0x0472('0x7b')],_0x30da6b[_0x0472('0xb7')],_0x30da6b[_0x0472('0x47')],_0x30da6b))['then'](_0x314a0a[_0x0472('0xb8')](_0x30da6b))[_0x0472('0xb0')](loggerCatchQueueSummary('[syncCampaigns]',_0x30da6b));}else{notSendMessagesCampaign(_0x30da6b);}}}};Dialer[_0x0472('0x8a')]['checkDialMethod']=function(_0x1223eb){if(_0x1223eb[_0x0472('0xb9')]!==_0x0472('0xb')){clearPredictiveAttributes(_0x1223eb);}switch(_0x1223eb[_0x0472('0xb9')]){case'progressive':this[_0x0472('0xba')](_0x1223eb,0x1);break;case _0x0472('0xbb'):this['handlePower'](_0x1223eb,_0x1223eb[_0x0472('0xbc')]);break;case _0x0472('0xb'):this[_0x0472('0xb')](_0x1223eb);break;case _0x0472('0xa'):this[_0x0472('0xba')](_0x1223eb,0x1);break;default:logger[_0x0472('0x67')]('Queue',_0x1223eb[_0x0472('0x47')],_0x0472('0xbd'));}};Dialer[_0x0472('0x8a')]['ifTime']=function(_0xe02c8,_0x4f581c){var _0x55ec8b=_0xe02c8[_0x0472('0xb7')];var _0x1b4f04=_0x4f581c?_0xe02c8[_0x0472('0xb6')]:_0xe02c8[_0x0472('0x7b')][_0x0472('0x7c')];logger[_0x0472('0xbe')](_0x0472('0xbf'),_0x1b4f04,_0x55ec8b,_0xe02c8[_0x0472('0x47')],util[_0x0472('0x45')]('Voice\x20Queue\x20%s\x20$s',_0xe02c8[_0x0472('0x47')],_0xe02c8['id']));var _0x5365ef=null;return Interval['intervalIftime'](_0x1b4f04,_0x55ec8b)[_0x0472('0x3e')](function(_0xd136ee){if(_0xd136ee===!![]){return _0xd136ee;}else{_0xe02c8[_0x0472('0x6b')]=_0x4f581c?utils[_0x0472('0x6c')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x0472('0x6c')]['OVERTIME_INTERVAL'];_0x5365ef=msgResponse('[ifTime][promiseAll]','Failure',_0x0472('0xad')+_0x4f581c+'\x20'+_0xe02c8['name']+_0x0472('0xae')+util[_0x0472('0x44')](_0x1b4f04,{'showHidden':![],'depth':null})+_0x0472('0xaf')+_0x55ec8b);}if(_0x5365ef!==null){logger[_0x0472('0xbe')](_0x0472('0xc0'),_0x5365ef);_0x5365ef['isGlobal']=_0x4f581c;throw _0x5365ef;}})['catch'](function(_0x18ea40){logger['error'](_0x0472('0xc1'),_0x18ea40);throw msgResponse(_0x0472('0x88'),_0x0472('0x89'),util[_0x0472('0x44')](_0x18ea40,{'showHidden':![],'depth':null}));});};Dialer[_0x0472('0x8a')]['syncAgentConnect']=function(_0x1b7971){if(this[_0x0472('0x1f')][_0x1b7971[_0x0472('0xc2')]]){if(this[_0x0472('0x27')][_0x1b7971['uniqueid']]&&this[_0x0472('0x27')][_0x1b7971[_0x0472('0xc3')]]['type']!==_0x0472('0xc4')){this[_0x0472('0xc5')](this[_0x0472('0x1f')][_0x1b7971['queue']]);this['uniqueId'][_0x1b7971['uniqueid']]['answertime']=moment()['format'](_0x0472('0xc6'));}}};Dialer[_0x0472('0x8a')][_0x0472('0xc7')]=function(_0x5ec2b2){var _0x20b973=this[_0x0472('0x27')][_0x5ec2b2[_0x0472('0xc3')]];if(this[_0x0472('0x1f')][_0x5ec2b2[_0x0472('0xc2')]]){if(_0x20b973&&_0x20b973[_0x0472('0xc8')]!=='ivr'){delete this[_0x0472('0x27')][_0x5ec2b2['uniqueid']];this[_0x0472('0x1f')][_0x5ec2b2['queue']][_0x0472('0xc9')]+=0x1;var _0x475c14=new AgentComplete(_0x20b973,_0x5ec2b2);if(_0x5ec2b2['reason']===_0x0472('0xca')){_0x475c14['agiafterat']=this['voiceQueues'][_0x5ec2b2[_0x0472('0xc2')]][_0x0472('0xcb')]&&this[_0x0472('0x1f')][_0x5ec2b2['queue']]['dialAgiAfterHangupAgent']?moment()[_0x0472('0x45')](_0x0472('0xc6')):undefined;}hopperUtils[_0x0472('0xcc')](_0x475c14)['catch'](loggerCatch(_0x0472('0xcd')));hopperUtils[_0x0472('0xce')](_0x475c14)[_0x0472('0xb0')](loggerCatch(_0x0472('0xcf')));}}};Dialer[_0x0472('0x8a')]['syncQueueCallerAbandon']=function(_0x35a827){var _0x253a7a=this['uniqueId'][_0x35a827[_0x0472('0xc3')]];var _0xb33b0d=this;var _0x1ef36d=![];var _0xc7fc51;var _0x50c889;if(this[_0x0472('0x1f')][_0x35a827['queue']]){if(_0x253a7a&&_0x253a7a[_0x0472('0xc8')]!==_0x0472('0xc4')){delete this[_0x0472('0x27')][_0x35a827[_0x0472('0xc3')]];this[_0x0472('0xc5')](this['voiceQueues'][_0x35a827['queue']]);_0x253a7a[_0x0472('0xd0')]=moment()[_0x0472('0x45')](_0x0472('0xc6'));var _0x1a1235=new QueueCallerAbandon(_0x253a7a,_0x35a827);if(utils[_0x0472('0x62')](_0x253a7a[_0x0472('0xd0')],_0x253a7a['responsetime'])>=_0x253a7a[_0x0472('0xd1')]){this['voiceQueues'][_0x35a827['queue']][_0x0472('0x51')]+=0x1;this[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0xd2')]+=0x1;this[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0xd3')]+=0x1;_0x1a1235[_0x0472('0x71')]=0xa;_0x1a1235[_0x0472('0x72')]=_0x0472('0xd4');_0x1a1235[_0x0472('0xd5')]=_0x0472('0xd6');_0x1a1235['agiafterat']=this[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]]['dialQueueProject2']?moment()[_0x0472('0x45')](_0x0472('0xc6')):undefined;_0x1a1235[_0x0472('0xd7')]+=0x1;_0x1a1235[_0x0472('0xd8')]+=0x1;_0xc7fc51=this[_0x0472('0x1f')][_0x35a827['queue']][_0x0472('0xd9')];_0x50c889=this[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0xda')];hopperUtils[_0x0472('0xdb')](_0x1a1235,_0x1a1235['state'],_0x253a7a[_0x0472('0xdc')])[_0x0472('0x3e')](function(_0x54189c){_0x1ef36d=_0x54189c[_0x0472('0xdd')]==0x1;if(_0x1a1235[_0x0472('0xd7')]>=_0xb33b0d['voiceQueues'][_0x35a827[_0x0472('0xc2')]][_0x0472('0xde')]){_0xb33b0d[_0x0472('0xdf')](_0x1a1235,_0x54189c['additional']);}else{hopperUtils[_0x0472('0xe0')]({'active':![],'countdropretry':_0x1a1235[_0x0472('0xd7')],'scheduledat':moment()[_0x0472('0xe1')](_0xb33b0d[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0xd9')],'minutes')['format'](_0x0472('0xc6')),'ContactId':_0x253a7a['ContactId'],'ListId':_0x253a7a[_0x0472('0xe2')],'VoiceQueueId':_0x253a7a[_0x0472('0xe3')]||undefined,'CampaignId':_0x253a7a['CampaignId']||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0xe4')));var _0x2e267d=new History(_0x1a1235);_0x2e267d[_0x0472('0x71')]=0xa;_0x2e267d[_0x0472('0x72')]=_0x0472('0xd4');_0x2e267d[_0x0472('0xe5')]=moment()[_0x0472('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e267d[_0x0472('0x73')]=_0x2e267d[_0x0472('0xe5')];_0x2e267d['calleridname']=_0x1a1235[_0x0472('0xe6')];_0x2e267d[_0x0472('0xe7')]=_0x1a1235[_0x0472('0xe7')];hopperUtils[_0x0472('0xcc')](_0x2e267d)['catch'](loggerCatch(_0x0472('0xe8')));}})['then'](function(){if(_0x1ef36d)hopperUtils[_0x0472('0xe9')](_0x1a1235,_0xc7fc51,_0x50c889)[_0x0472('0x3e')](function(){return 0x1;});});}else{this[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0x53')]+=0x1;this['voiceQueues'][_0x35a827[_0x0472('0xc2')]][_0x0472('0xea')]+=0x1;_0x1a1235['state']=0xb;_0x1a1235[_0x0472('0x72')]=_0x0472('0xeb');_0x1a1235[_0x0472('0xd5')]='CALLEREXIT';_0x1a1235[_0x0472('0xec')]+=0x1;_0x1a1235[_0x0472('0xd8')]+=0x1;_0xc7fc51=this[_0x0472('0x1f')][_0x35a827['queue']][_0x0472('0xed')];_0x50c889=this[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0xda')];hopperUtils[_0x0472('0xdb')](_0x1a1235,_0x1a1235[_0x0472('0x71')],_0x253a7a['voiceQueue'])[_0x0472('0x3e')](function(_0x89a0a1){if(_0x1a1235[_0x0472('0xec')]>=_0xb33b0d['voiceQueues'][_0x35a827['queue']][_0x0472('0xee')]){_0xb33b0d[_0x0472('0xdf')](_0x1a1235,_0x89a0a1[_0x0472('0xdd')]);}else{hopperUtils[_0x0472('0xe0')]({'active':![],'countabandonedretry':_0x1a1235[_0x0472('0xec')],'scheduledat':moment()['add'](_0xb33b0d[_0x0472('0x1f')][_0x35a827[_0x0472('0xc2')]][_0x0472('0xed')],'minutes')['format'](_0x0472('0xc6')),'ContactId':_0x253a7a[_0x0472('0xef')],'ListId':_0x253a7a['ListId'],'VoiceQueueId':_0x253a7a['VoiceQueueId']||undefined,'CampaignId':_0x253a7a[_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x2e9ab1=new History(_0x1a1235);_0x2e9ab1[_0x0472('0x71')]=0xb;_0x2e9ab1[_0x0472('0x72')]='Abandoned';_0x2e9ab1[_0x0472('0xe5')]=moment()[_0x0472('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x2e9ab1[_0x0472('0x73')]=_0x2e9ab1['starttime'];_0x2e9ab1['calleridname']=_0x1a1235[_0x0472('0xe6')];_0x2e9ab1[_0x0472('0xe7')]=_0x1a1235[_0x0472('0xe7')];hopperUtils[_0x0472('0xcc')](_0x2e9ab1)[_0x0472('0xb0')](loggerCatch(_0x0472('0xf1')));}})[_0x0472('0x3e')](function(){if(_0x1ef36d)hopperUtils[_0x0472('0xe9')](_0x1a1235,_0xc7fc51,_0x50c889)[_0x0472('0x3e')](function(){return 0x1;});});}}}};Dialer['prototype']['syncNewExten']=function(_0x4f6eff){if(this[_0x0472('0x25')][_0x4f6eff['uniqueid']]){this['actions'][_0x4f6eff[_0x0472('0xc3')]][_0x0472('0xf2')]=_0x4f6eff[_0x0472('0xf2')];}if(this['uniqueId'][_0x4f6eff['uniqueid']]){this[_0x0472('0x27')][_0x4f6eff[_0x0472('0xc3')]][_0x0472('0xf2')]=_0x4f6eff[_0x0472('0xf2')];}};Dialer[_0x0472('0x8a')]['syncQueueMember']=function(_0x545581){if(!this[_0x0472('0x25')][_0x545581['actionid']]){return;}var _0x545d1a=this[_0x0472('0x1f')][this[_0x0472('0x25')][_0x545581['actionid']]['queue']][_0x0472('0xf3')]||'rrmemory';if(_0x545d1a===_0x0472('0xf4')){if(this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]]&&_[_0x0472('0xf6')](this['actions'][_0x545581[_0x0472('0xf5')]][_0x0472('0xf7')])&&_0x545581[_0x0472('0x8d')]==='1'&&_0x545581[_0x0472('0xf8')]==='0'){if(this[_0x0472('0x21')][_0x545581[_0x0472('0xf9')]]){if(!this['agents'][_0x545581[_0x0472('0xf9')]]['locked']){this[_0x0472('0x21')][_0x545581[_0x0472('0xf9')]]['locked']=!![];this['actions'][_0x545581['actionid']]['locked']=!![];this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]][_0x0472('0xf9')]=_0x545581[_0x0472('0xf9')];}}}}else if(_0x545d1a===_0x0472('0xfa')){if(this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]]){if(this[_0x0472('0x21')][_0x545581[_0x0472('0xf9')]]){this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]]['stateinterface']=_0x545581[_0x0472('0xf9')];if(_[_0x0472('0xf6')](this[_0x0472('0x2b')][this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]][_0x0472('0xc2')]])){this['queueBooked'][this['actions'][_0x545581[_0x0472('0xf5')]][_0x0472('0xc2')]]=[];}this[_0x0472('0x2b')][this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]]['queue']]['push'](_['merge'](_[_0x0472('0x78')](this[_0x0472('0x25')][_0x545581[_0x0472('0xf5')]],[_0x0472('0xfb'),'stateinterface']),{'status':_0x545581[_0x0472('0x8d')],'paused':_0x545581['paused']}));}}}};Dialer[_0x0472('0x8a')][_0x0472('0x3a')]=function(_0xa4651e){if(!this['actions'][_0xa4651e[_0x0472('0xf5')]]){return;}var _0x37c7e7=this;var _0x1be157=this[_0x0472('0x1f')][this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xc2')]];var _0x299bbd=_0x1be157[_0x0472('0xf3')]||'rrmemory';if(_0x299bbd===_0x0472('0xf4')){if(this[_0x0472('0x25')][_0xa4651e['actionid']]&&this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]]['stateinterface']){this[_0x0472('0x1e')]['run'](this['actions'][_0xa4651e[_0x0472('0xf5')]]['idHopper'],this['actions'][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xf9')])['catch'](function(_0x4507e5){logger[_0x0472('0x67')](_0x0472('0xfc'),util['inspect'](_0x4507e5,{'showHidden':![],'depth':null}));})[_0x0472('0xfd')](function(){_0x37c7e7['updateOriginated'](_0x37c7e7[_0x0472('0x1f')][_0x37c7e7[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]]['queue']]);_0x37c7e7[_0x0472('0x21')][_0x37c7e7[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xf9')]]['locked']=![];delete _0x37c7e7['actions'][_0xa4651e[_0x0472('0xf5')]];unlockQueueStatus(_0x1be157);});}else{this[_0x0472('0xc5')](this[_0x0472('0x1f')][this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xc2')]]);hopperUtils[_0x0472('0xe0')]({'active':![],'ContactId':this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xef')],'ListId':this[_0x0472('0x25')][_0xa4651e['actionid']][_0x0472('0xe2')],'VoiceQueueId':this['actions'][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xe3')]||undefined,'CampaignId':this['actions'][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0xfe')));delete this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]];unlockQueueStatus(_0x1be157);}}else if(_0x299bbd===_0x0472('0xfa')){var _0x481148;if(this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]]&&!_[_0x0472('0x49')](this[_0x0472('0x2b')][this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xc2')]])){if(this['queueBookedRR'][_0x37c7e7[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xc2')]]){this[_0x0472('0xff')][_0x37c7e7[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]]['queue']]=this[_0x0472('0xff')][this['actions'][_0xa4651e[_0x0472('0xf5')]]['queue']]?this[_0x0472('0xff')][this[_0x0472('0x25')][_0xa4651e['actionid']][_0x0472('0xc2')]]:this[_0x0472('0x2b')][this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xc2')]]?this[_0x0472('0x2b')][this[_0x0472('0x25')][_0xa4651e['actionid']]['queue']][_0x0472('0x100')]||0x0:0x0;}this[_0x0472('0x2b')][this[_0x0472('0x25')][_0xa4651e['actionid']][_0x0472('0xc2')]]['_rr']=this[_0x0472('0xff')][this[_0x0472('0x25')][_0xa4651e[_0x0472('0xf5')]][_0x0472('0xc2')]];for(var _0x19cd7e=0x0;_0x19cd7e=_0x1572bd['dialGlobalMaxRetry']){_0xa1e20e['stateGlobal'](_0x236a1e,_0x1c0b72,_0x15d60e,_0x0472('0x12b'));}else{if(_0x236a1e[_0x0472('0x129')]>=_0x1572bd['dialMachineMaxRetry']){_0xa1e20e[_0x0472('0x12c')](_0x236a1e,_0x1c0b72,_0x15d60e,_0x0472('0x12d'));}else{hopperUtils[_0x0472('0xe0')]({'active':![],'countmachineretry':_0x236a1e[_0x0472('0x129')],'scheduledat':moment()[_0x0472('0xe1')](_0x1572bd['dialMachineRetryFrequency'],'minutes')[_0x0472('0x45')](_0x0472('0xc6')),'ContactId':_0x236a1e['ContactId'],'ListId':_0x236a1e['ListId'],'VoiceQueueId':_0x236a1e['VoiceQueueId']||undefined,'CampaignId':_0x236a1e[_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x12e')));_0x1c0b72({'reschedule':0x1});}}});}if(_0x557ed5['type']===_0x0472('0xc4')&&this[_0x0472('0x20')][_0x557ed5[_0x0472('0xc2')]][_0x0472('0x116')]&&_0x3236e5[_0x0472('0x117')]===_0x0472('0x118')){delete this[_0x0472('0x27')][_0x3236e5['uniqueid']];this[_0x0472('0xc5')](this[_0x0472('0x20')][_0x557ed5['queue']]);_0x510906=new Hangup(_0x557ed5,_0x3236e5);_0x510906['state']=0x12;_0x510906['statedesc']=_0x0472('0x11a');_0x510906[_0x0472('0x11b')]=_0x0472('0x11c');ami[_0x0472('0x11d')](_0x0472('0x11e'),ut['buildObj'](_0x510906,_0x0472('0x120')));this['saveInDb'](_0x510906,_0x0472('0x12f'),_0x0472('0x130'));}if(_0x557ed5[_0x0472('0xc8')]===_0x0472('0xc4')&&this['campaigns'][_0x557ed5[_0x0472('0xc2')]]['dialAMDActive']&&_0x3236e5[_0x0472('0x117')]==='MACHINE'){return new Promise(function(_0x2d96f8,_0x20ccf5){delete _0xa1e20e[_0x0472('0x27')][_0x3236e5[_0x0472('0xc3')]];_0xa1e20e[_0x0472('0xc5')](_0xa1e20e['campaigns'][_0x557ed5['queue']]);_0xa1e20e['campaigns'][_0x557ed5['queue']][_0x0472('0xc9')]+=0x1;_0xa1e20e['campaigns'][_0x557ed5[_0x0472('0xc2')]][_0x0472('0x119')]+=0x1;var _0x330cfc=_0xa1e20e['campaigns'][_0x557ed5[_0x0472('0xc2')]];var _0x10fd29=new Hangup(_0x557ed5,_0x3236e5);_0x10fd29[_0x0472('0x71')]=0x13;_0x10fd29[_0x0472('0x72')]=_0x0472('0x131');_0x10fd29[_0x0472('0x11b')]=_0x0472('0x11c');_0x10fd29[_0x0472('0x129')]+=0x1;_0x10fd29[_0x0472('0xd8')]+=0x1;_0x10fd29['amd']=!![];ami[_0x0472('0x11d')](_0x0472('0x11e'),ut[_0x0472('0x11f')](_0x10fd29,_0x0472('0x120')));hopperUtils[_0x0472('0xcc')](_0x10fd29)['catch'](loggerCatch(_0x0472('0x125')));if(_0x10fd29[_0x0472('0x126')]+_0x10fd29[_0x0472('0x127')]+_0x10fd29[_0x0472('0x132')]+_0x10fd29[_0x0472('0x128')]+_0x10fd29[_0x0472('0xd7')]+_0x10fd29[_0x0472('0xec')]+_0x10fd29[_0x0472('0x129')]+_0x10fd29[_0x0472('0x12a')]>=_0x330cfc['dialGlobalMaxRetry']){_0xa1e20e[_0x0472('0x133')](_0x10fd29,_0x2d96f8,_0x20ccf5,_0x0472('0x12b'));}else{if(_0x10fd29['countmachineretry']>=_0x330cfc[_0x0472('0x134')]){_0xa1e20e[_0x0472('0x12c')](_0x10fd29,_0x2d96f8,_0x20ccf5,_0x0472('0x12d'));}else{hopperUtils[_0x0472('0xe0')]({'active':![],'countmachineretry':_0x10fd29[_0x0472('0x129')],'scheduledat':moment()[_0x0472('0xe1')](_0x330cfc[_0x0472('0x135')],_0x0472('0x136'))[_0x0472('0x45')](_0x0472('0xc6')),'ContactId':_0x10fd29[_0x0472('0xef')],'ListId':_0x10fd29[_0x0472('0xe2')],'VoiceQueueId':_0x10fd29[_0x0472('0xe3')]||undefined,'CampaignId':_0x10fd29['CampaignId']||undefined})['catch'](loggerCatch(_0x0472('0x12e')));_0x2d96f8({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x0472('0x137')]=function(_0x339de4){var _0x4967ec=this['uniqueId'][_0x339de4['uniqueid']];var _0xb74879;if(_0x4967ec&&_0x4967ec['type']===_0x0472('0xc4')){delete this['uniqueId'][_0x339de4[_0x0472('0xc3')]];this[_0x0472('0xc5')](this[_0x0472('0x20')][_0x4967ec[_0x0472('0xc2')]]);this[_0x0472('0x20')][_0x4967ec[_0x0472('0xc2')]][_0x0472('0x138')]+=0x1;_0xb74879=new Hangup(_0x4967ec,_0x339de4);hopperUtils[_0x0472('0xcc')](_0xb74879)[_0x0472('0xb0')](loggerCatch(_0x0472('0x139')));hopperUtils[_0x0472('0xce')](_0xb74879)[_0x0472('0xb0')](loggerCatch(_0x0472('0x13a')));}if(_0x4967ec&&_0x4967ec[_0x0472('0xc8')]!==_0x0472('0xc4')&&isNotNull(this['voiceQueues'][_0x4967ec[_0x0472('0xc2')]][_0x0472('0x13b')])){delete this['uniqueId'][_0x339de4['uniqueid']];this[_0x0472('0xc5')](this[_0x0472('0x1f')][_0x4967ec[_0x0472('0xc2')]]);this[_0x0472('0x1f')][_0x4967ec[_0x0472('0xc2')]][_0x0472('0xc9')]+=0x1;this['voiceQueues'][_0x4967ec[_0x0472('0xc2')]][_0x0472('0x119')]+=0x1;_0xb74879=new Hangup(_0x4967ec,_0x339de4);_0xb74879[_0x0472('0x71')]=0x10;_0xb74879[_0x0472('0x72')]=_0x0472('0x13c');_0xb74879['membername']=_0x0472('0x13d');hopperUtils[_0x0472('0xcc')](_0xb74879)[_0x0472('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0472('0xce')](_0xb74879)[_0x0472('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x4967ec&&_0x4967ec[_0x0472('0xc8')]!=='ivr'&&!isNotNull(this[_0x0472('0x1f')][_0x4967ec['queue']][_0x0472('0x13b')])){if(_0x339de4[_0x0472('0x13e')]===_0x0472('0x13f')){delete this[_0x0472('0x27')][_0x339de4[_0x0472('0xc3')]];this[_0x0472('0x1f')][_0x4967ec['queue']][_0x0472('0xc9')]+=0x1;const _0x3308d1=new AgentComplete(_0x4967ec,_0x339de4);_0x3308d1[_0x0472('0xf0')]=this[_0x0472('0x1f')][_0x4967ec[_0x0472('0xc2')]]['id'];hopperUtils[_0x0472('0xcc')](_0x3308d1)[_0x0472('0xb0')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x0472('0xce')](_0x3308d1)[_0x0472('0xb0')](loggerCatch(_0x0472('0xcf')));}else{delete this['uniqueId'][_0x339de4[_0x0472('0xc3')]];this[_0x0472('0xc5')](this[_0x0472('0x1f')][_0x4967ec[_0x0472('0xc2')]]);this[_0x0472('0x1f')][_0x4967ec[_0x0472('0xc2')]]['outboundUnknownCallsDay']+=0x1;_0xb74879=new Hangup(_0x4967ec,_0x339de4);_0xb74879[_0x0472('0x71')]=0xc;_0xb74879[_0x0472('0x72')]=_0x339de4['cause-txt'];_0xb74879[_0x0472('0x11b')]=_0x0472('0x140');hopperUtils['createHistory'](_0xb74879)['catch'](loggerCatch(_0x0472('0x139')));hopperUtils['moveContactManagedDialer'](_0xb74879)['catch'](loggerCatch(_0x0472('0x13a')));}}};Dialer['prototype'][_0x0472('0x141')]=function(_0x32830b){var _0x4702bc=this;if(!_0x4702bc['queuesSummary'][_0x32830b['name']]){_0x4702bc[_0x0472('0x2c')][_0x32830b[_0x0472('0x47')]]={'running':![]};}else if(_0x4702bc[_0x0472('0x2c')][_0x32830b[_0x0472('0x47')]][_0x0472('0x142')]===!![]){return;}else if(_0x4702bc[_0x0472('0x2c')][_0x32830b[_0x0472('0x47')]]['running']===![]){_0x4702bc[_0x0472('0x2c')][_0x32830b[_0x0472('0x47')]][_0x0472('0x142')]=!![];}var _0x23083f=_0x4702bc[_0x0472('0x1f')][_0x32830b[_0x0472('0x47')]];var _0x475977=_0x23083f[_0x0472('0x6b')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x3ea297=utils[_0x0472('0x143')](_0x23083f);_0x23083f['statusMessage']=utils[_0x0472('0x144')](_0x23083f,_0x4702bc[_0x0472('0x22')]);Promise['resolve']()[_0x0472('0x3e')](function(){if(_0x23083f['statusMessage']===utils[_0x0472('0x6c')]['INACTIVE']){if(_0x475977){clearPredictiveAttributes(_0x23083f);_0x32830b['startPredictive']=undefined;_0x32830b[_0x0472('0x2a')]=undefined;}if(_0x23083f[_0x0472('0x145')]===utils['CAMPAIGN_STATUS'][_0x0472('0x7e')]){_0x32830b[_0x0472('0x146')]=0x0;_0x32830b[_0x0472('0xf8')]=0x0;_0x32830b[_0x0472('0x147')]=0x0;_0x32830b[_0x0472('0x148')]=0x0;_0x32830b[_0x0472('0x149')]=0x0;}}else if(_0x23083f['statusMessage']===utils[_0x0472('0x6c')]['ACTIVE']&&!_0x3ea297){return _0x4702bc[_0x0472('0x9a')](_0x23083f,!![])['then'](function(){return _0x4702bc[_0x0472('0x9a')](_0x23083f,![]);})[_0x0472('0x3e')](function(){return _0x4702bc[_0x0472('0x14a')](_0x23083f);})[_0x0472('0xb0')](function(_0xd86b3e){loggerSyncQueueSummary[_0x0472('0x42')](_0x0472('0x14b'),util['inspect'](_0xd86b3e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x23083f);});}else{clearPredictiveAttributes(_0x23083f);}})[_0x0472('0x3e')](function(){var _0x416231=_0x32830b[_0x0472('0x14c')](_0x23083f);if(_0x416231||_0x23083f[_0x0472('0x14d')]){_0x23083f[_0x0472('0x14d')]=![];_0x32830b[_0x0472('0x14e')](_0x23083f);Object[_0x0472('0x14f')](_0x23083f,_0x32830b);emitOutboundVoiceQueueSummary(_0x32830b);}_0x4702bc[_0x0472('0x2c')][_0x23083f[_0x0472('0x47')]][_0x0472('0x142')]=![];})['catch'](function(_0x3ac64f){logger[_0x0472('0x67')](_0x0472('0x14b'),util[_0x0472('0x44')](_0x3ac64f,{'showHidden':![],'depth':null}));_0x4702bc['queuesSummary'][_0x23083f[_0x0472('0x47')]]['running']=![];});};Dialer['prototype'][_0x0472('0x150')]=_[_0x0472('0x151')](function(){var _0x34998f=_[_0x0472('0x152')](this[_0x0472('0x1f')],function(_0xd84068){return _0xd84068[_0x0472('0x153')];});var _0x53f0ce=_[_0x0472('0x152')](this['agents'],function(_0x28bb9f){return _0x28bb9f[_0x0472('0x154')]&&_0x28bb9f[_0x0472('0x8d')]===_0x0472('0x8e');});if(_0x34998f[_0x0472('0x9f')]>0x0&&_0x53f0ce[_0x0472('0x9f')]>0x0){return Promise['resolve']()[_0x0472('0x3e')](cmHopper[_0x0472('0x155')](_[_0x0472('0x156')](_0x34998f,'id'),previewRecallmeReminderInterval,_['map'](_0x53f0ce,'id')))[_0x0472('0x3e')](function(_0x5004f2){for(var _0x50233b=0x0;_0x50233b<_0x5004f2[_0x0472('0x9f')];_0x50233b++){var _0x4c89ab=_0x5004f2[_0x50233b]['Agent'][_0x0472('0x47')];if(_0x4c89ab)io['to'](util[_0x0472('0x45')](_0x0472('0x157'),_0x4c89ab))[_0x0472('0x11d')](_0x0472('0x158'),{'hopper':_0x5004f2[_0x50233b]});}})[_0x0472('0xb0')](function(_0x6e9c03){logger[_0x0472('0x67')](_0x0472('0x159'),_0x6e9c03);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x0472('0x3c')]=function(){var _0x1bf39e=this;setInterval(function(){_0x1bf39e[_0x0472('0x15a')](_0x1bf39e[_0x0472('0x27')],_0x0472('0x15b'));_0x1bf39e['clearZombieChannels'](_0x1bf39e[_0x0472('0x25')],_0x0472('0x15c'));},0x32c8);};Dialer['prototype'][_0x0472('0x15a')]=function(_0x444ea3,_0x87378f){var _0x5500d2=this;for(var _0x5da02b in _0x444ea3){if(typeof _0x444ea3[_0x5da02b]!==_0x0472('0xb4')){this[_0x0472('0x1d')][_0x0472('0x1b')](function(){if(!_[_0x0472('0xf6')](_0x444ea3[_0x5da02b])){return ami[_0x0472('0xa1')]({'action':_0x0472('0x8d'),'channel':_0x444ea3[_0x5da02b][_0x0472('0xf2')]})[_0x0472('0xb0')](function(_0x4489e3){if(_0x4489e3[_0x0472('0x6b')]===_0x0472('0x15d')){setTimeout(function(){if(_0x444ea3[_0x5da02b]&&_0x444ea3[_0x5da02b]['type']!=='ivr'){_0x5500d2[_0x0472('0xc5')](_0x5500d2[_0x0472('0x1f')][_0x444ea3[_0x5da02b]['queue']]);logger[_0x0472('0x67')](_0x0472('0x15e'),_0x87378f,_0x5da02b,_0x444ea3[_0x5da02b][_0x0472('0xc2')]);delete _0x444ea3[_0x5da02b];}if(_0x444ea3[_0x5da02b]&&_0x444ea3[_0x5da02b]['type']===_0x0472('0xc4')){_0x5500d2[_0x0472('0xc5')](_0x5500d2['campaigns'][_0x444ea3[_0x5da02b][_0x0472('0xc2')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x87378f,_0x5da02b,_0x444ea3[_0x5da02b]['queue']);delete _0x444ea3[_0x5da02b];}},0x2328);}});}});}}};Dialer['prototype'][_0x0472('0x15f')]=function(_0x512197){return Promise[_0x0472('0xb5')]()[_0x0472('0x3e')](voiceQueueRt[_0x0472('0x15f')](_0x512197))[_0x0472('0xb0')](loggerCatch(_0x0472('0x160')));};Dialer[_0x0472('0x8a')][_0x0472('0xc5')]=function(_0x33c14a){if(!_[_0x0472('0x40')](_0x33c14a)&&_0x33c14a!==null){if(typeof _0x33c14a['originated']!==_0x0472('0xb4')){if(_0x33c14a[_0x0472('0x84')]>0x0){_0x33c14a[_0x0472('0x84')]-=0x1;}else{logger[_0x0472('0x67')](_0x0472('0x161'));}}}else{logger[_0x0472('0x67')](_0x0472('0x162'));}};Dialer['prototype']['loggerHandler']=function(_0x35ff5e,_0x16e879){var _0x15aeb7=this;return function(_0x50a03e){_0x15aeb7[_0x0472('0xc5')](_0x16e879);logger['error'](_0x35ff5e,util[_0x0472('0x44')](_0x50a03e,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x0472('0x163')]=function(_0x2a2bf1,_0x267444,_0xf28379){var _0x340286={'state':0x19,'statedesc':_0x0472('0x164')};this[_0x0472('0xc5')](_0x267444);this[_0x0472('0x121')](_['merge'](_0x340286,_['pick'](_0xf28379,['ContactId',_0x0472('0xe2'),_0x0472('0x165'),'VoiceQueueId',_0x0472('0xf0')])),'[emptyContact][createHistory]',_0x0472('0x166'));logger['error'](_0x2a2bf1);};Dialer[_0x0472('0x8a')]['saveInDb']=function(_0x16c147,_0x2dffef,_0x47812f){hopperUtils['createHistory'](_0x16c147)[_0x0472('0xb0')](loggerCatch(_0x2dffef));hopperUtils[_0x0472('0xce')](_0x16c147)[_0x0472('0xb0')](loggerCatch(_0x47812f));};Dialer[_0x0472('0x8a')]['queueCallerAbandonCreateState']=function(_0xa8f6fa,_0x3ce6d2){hopperUtils['createHistory'](_0xa8f6fa)[_0x0472('0xb0')](loggerCatch(_0x0472('0xcd')));if(_0x3ce6d2==0x0){hopperUtils['moveContactManagedDialer'](_0xa8f6fa)[_0x0472('0xb0')](loggerCatch(_0x0472('0x167')));}};Dialer[_0x0472('0x8a')][_0x0472('0x159')]=function(_0x50f64a){return Promise[_0x0472('0xb5')]()['then'](cmHopper[_0x0472('0x155')](_0x50f64a['id'],previewRecallmeReminderInterval))[_0x0472('0x3e')](function(_0x884092){for(var _0x2a39c0=0x0;_0x2a39c0<_0x884092['length'];_0x2a39c0++){var _0x1ab17d=_0x884092[_0x2a39c0]['Agent']['name'];if(_0x1ab17d)io['to'](util['format'](_0x0472('0x157'),_0x1ab17d))[_0x0472('0x11d')]('user:dialPreviewRecallReminder',{'hopper':_0x884092[_0x2a39c0]});}})['catch'](function(){});};Dialer[_0x0472('0x8a')]['launchHandleIvr']=function(_0x4de3ed){var _0x526e09=this;return function(){_0x526e09['handleIvr'](_0x4de3ed);};};Dialer[_0x0472('0x8a')][_0x0472('0x168')]=function(_0xca5e03,_0x2ff0f2){var _0x573352=this;var _0x40ed0f=uuid['v4']();this[_0x0472('0x25')][_0x40ed0f]=new Action(_0xca5e03,_0x2ff0f2,_0x40ed0f);return new Promise(function(_0x55bcdc,_0x3c83d3){if(_['isUndefined'](_0xca5e03)&&typeof _0xca5e03!==_0x0472('0x169')){return _0x3c83d3(msgResponse('originate',_0x0472('0xb1'),_0x0472('0x16a')));}if(_['isUndefined'](_0x2ff0f2['phone'])||_0x2ff0f2[_0x0472('0x16b')]===null){return _0x3c83d3(msgResponse(_0x0472('0x16c'),_0x0472('0xb1'),'contact\x20is\x20undefine'));}var _0x40024d={'XMD-CALLERID':_0x573352[_0x0472('0x25')][_0x40ed0f][_0x0472('0x16d')](),'XMD-AGI':_0xca5e03['dialQueueProject']?util[_0x0472('0x45')](_0x0472('0x16e'),ipAgi,_0xca5e03[_0x0472('0x13b')]):_0x0472('0x16f'),'XMD-AGIAFTER':_0xca5e03[_0x0472('0xcb')]?util[_0x0472('0x45')]('\x22agi://%s/square,%s\x22',ipAgi,_0xca5e03[_0x0472('0xcb')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0xca5e03)?util[_0x0472('0x45')](_0x0472('0x170'),_0xca5e03['name'],_0xca5e03['dialQueueOptions']||'',_0xca5e03['dialAgiAfterHangupAgent']?'c':'',_0xca5e03['dialQueueTimeout']||0x3):_0x0472('0x16f'),'XMD-CONTACTID':_0x2ff0f2['ContactId'],'XMD-CDRTYPE':_0x0472('0x9'),'CALLERID(all)':_0x573352[_0x0472('0x25')][_0x40ed0f][_0x0472('0x16d')](),'XMD-AMD':_0xca5e03[_0x0472('0x116')]?_0x0472('0x171'):_0x0472('0x16f'),'XMD-DESTINATION':_0x0472('0x115')};if(_0xca5e03['dialAMDActive']){_0x40024d[_0x0472('0x172')]=_0xca5e03[_0x0472('0x173')]||0x9c4;_0x40024d[_0x0472('0x174')]=_0xca5e03['dialAMDGreeting']||0x5dc;_0x40024d[_0x0472('0x175')]=_0xca5e03[_0x0472('0x176')]||0x320;_0x40024d[_0x0472('0x177')]=_0xca5e03[_0x0472('0x178')]||0x1388;_0x40024d['XMD-AMDMINWORDLENGTH']=_0xca5e03['dialAMDMinWordLength']||0x64;_0x40024d[_0x0472('0x179')]=_0xca5e03[_0x0472('0x17a')]||0x32;_0x40024d['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xca5e03[_0x0472('0x17b')]||0x3;_0x40024d[_0x0472('0x17c')]=_0xca5e03[_0x0472('0x17d')]||0x100;_0x40024d[_0x0472('0x17e')]=_0xca5e03[_0x0472('0x17f')]||0x1388;}if(utils[_0x0472('0x180')](_0xca5e03)){_0x40024d['XMD-VOICEQUEUEID']=_0x2ff0f2[_0x0472('0xe3')];}else{_0x40024d['XMD-CAMPAIGNID']=_0x2ff0f2[_0x0472('0xf0')];}var _0x5aa2e6=utils[_0x0472('0x181')](_0x2ff0f2[_0x0472('0x182')]);Object[_0x0472('0x14f')](_0x40024d,_0x5aa2e6);var _0xcef1b3=_0x573352[_0x0472('0x8b')](_0xca5e03[_0x0472('0x92')])?utils['getCallerId'](_0xca5e03['Trunk'][_0x0472('0x183')],_0xca5e03[_0x0472('0x184')],_0xca5e03['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x0472('0x185')](_0xca5e03['dialOriginateCallerIdNumber'],_0xca5e03[_0x0472('0x186')]):_0xca5e03[_0x0472('0x187')]):utils[_0x0472('0x188')](_[_0x0472('0xf6')](_0xca5e03[_0x0472('0x93')])?_0xca5e03['Trunk'][_0x0472('0x183')]:_0xca5e03['TrunkBackup'][_0x0472('0x183')],_0xca5e03[_0x0472('0x184')],_0xca5e03[_0x0472('0x186')]>0x0?utils['getCallerIdRandom'](_0xca5e03['dialOriginateCallerIdNumber'],_0xca5e03[_0x0472('0x186')]):_0xca5e03[_0x0472('0x187')]);if(_0xcef1b3){_0x40024d[_0x0472('0x189')]=_0x573352[_0x0472('0x25')][_0x40ed0f]['originatecalleridname']=utils[_0x0472('0x18a')](_0xcef1b3);_0x40024d[_0x0472('0x18b')]=_0x2ff0f2['phone'];}_0xca5e03[_0x0472('0x18c')]=_0x40024d;return ami[_0x0472('0xa1')]({'actionid':_0x40ed0f,'action':_0x0472('0x16c'),'channel':_0x573352[_0x0472('0x8b')](_0xca5e03[_0x0472('0x92')])?util[_0x0472('0x45')]('SIP/%s/%s%s',_0xca5e03[_0x0472('0x92')][_0x0472('0x47')],isNotNull(_0xca5e03[_0x0472('0x18d')])?_0xca5e03[_0x0472('0x18d')][_0x0472('0x18e')]()||'':'',_0xca5e03['dialCutDigit']>0x0?_0x2ff0f2['phone'][_0x0472('0x18f')](_0xca5e03[_0x0472('0x190')]):_0x2ff0f2[_0x0472('0x16b')]):util['format'](_0x0472('0x191'),_[_0x0472('0xf6')](_0xca5e03['TrunkBackup'])?_0xca5e03[_0x0472('0x92')]['name']:_0xca5e03['TrunkBackup'][_0x0472('0x47')],isNotNull(_0xca5e03[_0x0472('0x18d')])?_0xca5e03[_0x0472('0x18d')][_0x0472('0x18e')]()||'':'',_0xca5e03[_0x0472('0x190')]>0x0?_0x2ff0f2[_0x0472('0x16b')][_0x0472('0x18f')](_0xca5e03[_0x0472('0x190')]):_0x2ff0f2['phone']),'callerid':_0xcef1b3,'Exten':_0x0472('0x115'),'Context':_0x0472('0x192'),'Priority':'1','variable':_0x40024d,'timeout':(_0xca5e03[_0x0472('0x193')]||0x1e)*0x3e8,'async':!![],'channelid':_0x40ed0f})[_0x0472('0x3e')](function(_0x2425c0){return _0x55bcdc(_0x2425c0);})[_0x0472('0xb0')](function(_0x21abf2){_0xca5e03[_0x0472('0x194')]+=0x1;var _0x43d222=new History(_0x573352[_0x0472('0x25')][_0x40ed0f]);logger['error'](util[_0x0472('0x45')](_0x0472('0x195'),JSON[_0x0472('0x77')](_0x21abf2)));_0x43d222[_0x0472('0x71')]=0xe;_0x43d222[_0x0472('0x72')]=_0x0472('0x196');_0x43d222['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x43d222['endtime']=_0x43d222[_0x0472('0xe5')];hopperUtils[_0x0472('0xcc')](_0x43d222)[_0x0472('0xb0')](loggerCatch(_0x0472('0x197')));_0x573352[_0x0472('0xce')](_0x43d222)[_0x0472('0xb0')](loggerCatch(_0x0472('0x197')))['finally'](function(){delete _0x573352[_0x0472('0x25')][_0x40ed0f];return _0x3c83d3(msgResponse(_0x0472('0x16c'),'Error',_0x0472('0x198')));});});});};Dialer[_0x0472('0x8a')][_0x0472('0x199')]=function(_0x5955f4,_0x2331a1,_0x406d57){var _0x1f9f6a=new History(_0x2331a1);if(_0x1f9f6a[_0x0472('0x126')]+_0x1f9f6a[_0x0472('0x127')]+_0x1f9f6a[_0x0472('0x132')]+_0x1f9f6a[_0x0472('0x128')]+_0x1f9f6a['countdropretry']+_0x1f9f6a[_0x0472('0xec')]+_0x1f9f6a[_0x0472('0x129')]+_0x1f9f6a[_0x0472('0x12a')]>=_0x406d57[_0x0472('0x19a')]-0x1){return!![];}switch(_0x5955f4){case 0x3:if(_0x1f9f6a[_0x0472('0x132')]>=_0x406d57[_0x0472('0x19b')]-0x1){return!![];}hopperUtils[_0x0472('0xe0')]({'active':![],'countnoanswerretry':_0x1f9f6a[_0x0472('0x132')]+=0x1,'scheduledat':moment()[_0x0472('0xe1')](_0x406d57[_0x0472('0x19c')],'minutes')[_0x0472('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f9f6a[_0x0472('0xef')],'ListId':_0x1f9f6a[_0x0472('0xe2')],'VoiceQueueId':_0x1f9f6a['VoiceQueueId']||undefined,'CampaignId':_0x1f9f6a[_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x19d')));break;case 0x5:if(_0x1f9f6a[_0x0472('0x126')]>=_0x406d57[_0x0472('0x19e')]-0x1){return!![];}hopperUtils[_0x0472('0xe0')]({'active':![],'countbusyretry':_0x1f9f6a[_0x0472('0x126')]+=0x1,'scheduledat':moment()['add'](_0x406d57['dialBusyRetryFrequency'],_0x0472('0x136'))[_0x0472('0x45')](_0x0472('0xc6')),'ContactId':_0x1f9f6a[_0x0472('0xef')],'ListId':_0x1f9f6a[_0x0472('0xe2')],'VoiceQueueId':_0x1f9f6a[_0x0472('0xe3')]||undefined,'CampaignId':_0x1f9f6a['CampaignId']||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x19f')));break;case 0x8:if(_0x1f9f6a['countcongestionretry']>=_0x406d57[_0x0472('0x1a0')]-0x1){return!![];}hopperUtils[_0x0472('0xe0')]({'active':![],'countcongestionretry':_0x1f9f6a['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x406d57[_0x0472('0x1a1')],_0x0472('0x136'))['format'](_0x0472('0xc6')),'ContactId':_0x1f9f6a[_0x0472('0xef')],'ListId':_0x1f9f6a[_0x0472('0xe2')],'VoiceQueueId':_0x1f9f6a[_0x0472('0xe3')]||undefined,'CampaignId':_0x1f9f6a[_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x1a2')));break;case 0x0:if(_0x1f9f6a[_0x0472('0x128')]>=_0x406d57['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{hopperUtils[_0x0472('0xe0')]({'active':![],'countnosuchnumberretry':_0x1f9f6a[_0x0472('0x128')]+=0x1,'scheduledat':moment()[_0x0472('0xe1')](_0x406d57['dialNoSuchNumberRetryFrequency'],_0x0472('0x136'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f9f6a[_0x0472('0xef')],'ListId':_0x1f9f6a[_0x0472('0xe2')],'VoiceQueueId':_0x1f9f6a[_0x0472('0xe3')]||undefined,'CampaignId':_0x1f9f6a[_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x1a3')));}break;case 0xa:if(_0x1f9f6a[_0x0472('0xd7')]>=_0x406d57[_0x0472('0xde')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x1f9f6a[_0x0472('0xd7')]+=0x1,'scheduledat':moment()[_0x0472('0xe1')](_0x406d57[_0x0472('0xd9')],'minutes')[_0x0472('0x45')](_0x0472('0xc6')),'ContactId':_0x1f9f6a[_0x0472('0xef')],'ListId':_0x1f9f6a['ListId'],'VoiceQueueId':_0x1f9f6a['VoiceQueueId']||undefined,'CampaignId':_0x1f9f6a['CampaignId']||undefined})[_0x0472('0xb0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1f9f6a[_0x0472('0xec')]>=_0x406d57[_0x0472('0xee')]-0x1){return!![];}hopperUtils[_0x0472('0xe0')]({'active':![],'countabandonedretry':_0x1f9f6a[_0x0472('0xec')]+=0x1,'scheduledat':moment()['add'](_0x406d57['dialAbandonedRetryFrequency'],_0x0472('0x136'))[_0x0472('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f9f6a['ContactId'],'ListId':_0x1f9f6a[_0x0472('0xe2')],'VoiceQueueId':_0x1f9f6a[_0x0472('0xe3')]||undefined,'CampaignId':_0x1f9f6a['CampaignId']||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x1a4')));break;case 0x13:if(_0x1f9f6a['countmachineretry']>=_0x406d57['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0472('0xe0')]({'active':![],'countmachineretry':_0x1f9f6a[_0x0472('0x129')]+=0x1,'scheduledat':moment()[_0x0472('0xe1')](_0x406d57[_0x0472('0x135')],_0x0472('0x136'))[_0x0472('0x45')](_0x0472('0xc6')),'ContactId':_0x1f9f6a['ContactId'],'ListId':_0x1f9f6a[_0x0472('0xe2')],'VoiceQueueId':_0x1f9f6a[_0x0472('0xe3')]||undefined,'CampaignId':_0x1f9f6a[_0x0472('0xf0')]||undefined})['catch'](loggerCatch(_0x0472('0x12e')));break;case 0x14:if(_0x1f9f6a[_0x0472('0x12a')]>=_0x406d57['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x1f9f6a[_0x0472('0x12a')]+=0x1,'scheduledat':moment()['add'](_0x406d57[_0x0472('0x1a5')],_0x0472('0x136'))['format'](_0x0472('0xc6')),'ContactId':_0x1f9f6a[_0x0472('0xef')],'ListId':_0x1f9f6a['ListId'],'VoiceQueueId':_0x1f9f6a[_0x0472('0xe3')]||undefined,'CampaignId':_0x1f9f6a[_0x0472('0xf0')]||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x1a6')));break;default:return!![];}};Dialer[_0x0472('0x8a')][_0x0472('0x110')]=function(_0x59fdf2,_0x40c46e,_0xf727c6){var _0x146df7=this;var _0x3827f1=new History(_0x59fdf2);var _0x1c5465=![];var _0x4422d8;var _0x11fd4b;return new Promise(function(_0x3afa52,_0x220eb3){if(_['isUndefined'](_0x40c46e)&&typeof _0x40c46e!==_0x0472('0x169')){return _0x220eb3(msgResponse('[callProgressDetecting]',_0x0472('0xb1'),_0x0472('0x1a7')));}if(_[_0x0472('0x40')](_0xf727c6)&&typeof _0xf727c6!==_0x0472('0x169')){return _0x220eb3(msgResponse('[callProgressDetecting]','Failure','evt\x20is\x20undefine'));}hopperUtils[_0x0472('0xdb')](_0x3827f1,_0xf727c6[_0x0472('0x1a8')],_0x40c46e)['then'](function(_0x438011){if(_0x438011[_0x0472('0xdd')]==0x1)_0x1c5465=!![];switch(_0xf727c6['reason']){case'0':_0x40c46e[_0x0472('0x1a9')]+=0x1;_0x3827f1['state']=0x0;_0x3827f1[_0x0472('0x72')]=_0x0472('0x1aa');_0x3827f1[_0x0472('0x128')]+=0x1;_0x3827f1[_0x0472('0xd8')]+=0x1;ami[_0x0472('0x11d')]('custom:agentnosuchnumber',ut['buildObj'](_0x59fdf2,_0x0472('0x1ab')));_0x4422d8=_0x40c46e[_0x0472('0x1ac')];_0x11fd4b=_0x40c46e[_0x0472('0xda')];hopperUtils['createHistory'](_0x3827f1)[_0x0472('0xb0')](loggerCatch(_0x0472('0x125')));if(_0x146df7['checkRetriveMax'](0x0,_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1[_0x0472('0x128')]>=_0x40c46e[_0x0472('0x1ad')]){_0x146df7['createStateFinal'](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1ae'));}else{_0x146df7[_0x0472('0x133')](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1ae'));}}break;case'3':_0x40c46e[_0x0472('0x1af')]+=0x1;_0x3827f1[_0x0472('0x71')]=0x3;_0x3827f1[_0x0472('0x72')]=_0x0472('0x1b0');_0x3827f1[_0x0472('0x132')]+=0x1;_0x3827f1[_0x0472('0xd8')]+=0x1;var _0xfd31f7=ut[_0x0472('0x1b1')](_0x59fdf2,_0x40c46e);ami[_0x0472('0x11d')](_0x0472('0x1b2'),_0xfd31f7);_0x4422d8=_0x40c46e[_0x0472('0x19c')];_0x11fd4b=_0x40c46e[_0x0472('0xda')];hopperUtils['createHistory'](_0x3827f1)[_0x0472('0xb0')](loggerCatch(_0x0472('0x1b3')));if(_0x146df7[_0x0472('0x199')](0x3,_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1[_0x0472('0x132')]>=_0x40c46e[_0x0472('0x19b')]){_0x146df7[_0x0472('0x12c')](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1b4'));}else{_0x146df7[_0x0472('0x133')](_0x3827f1,_0x3afa52,_0x220eb3,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x40c46e['outboundBusyCallsDay']+=0x1;_0x3827f1[_0x0472('0x71')]=0x5;_0x3827f1['statedesc']=_0x0472('0x1b5');_0x3827f1['countbusyretry']+=0x1;_0x3827f1[_0x0472('0xd8')]+=0x1;ami['emit'](_0x0472('0x1b6'),ut[_0x0472('0x11f')](_0x59fdf2,'busy'));_0x4422d8=_0x40c46e[_0x0472('0x1b7')];_0x11fd4b=_0x40c46e[_0x0472('0xda')];hopperUtils[_0x0472('0xcc')](_0x3827f1)[_0x0472('0xb0')](loggerCatch(_0x0472('0x1b8')));if(_0x146df7[_0x0472('0x199')](0x5,_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1[_0x0472('0x126')]>=_0x40c46e['dialBusyMaxRetry']){_0x146df7[_0x0472('0x12c')](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1b9'));}else{_0x146df7[_0x0472('0x133')](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1b9'));}}break;case'8':_0x40c46e['outboundCongestionCallsDay']+=0x1;_0x3827f1[_0x0472('0x71')]=0x8;_0x3827f1['statedesc']=_0x0472('0x1ba');_0x3827f1['countcongestionretry']+=0x1;_0x3827f1[_0x0472('0xd8')]+=0x1;_0x4422d8=_0x40c46e[_0x0472('0x1a1')];_0x11fd4b=_0x40c46e['callAdditionalPhoneAfterMin'];ami['emit'](_0x0472('0x1bb'),ut['buildObj'](_0x59fdf2,_0x0472('0x1bc')));hopperUtils[_0x0472('0xcc')](_0x3827f1)[_0x0472('0xb0')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x146df7[_0x0472('0x199')](0x8,_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1[_0x0472('0x127')]>=_0x40c46e['dialCongestionMaxRetry']){_0x146df7['createStateFinal'](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1bd'));}else{_0x146df7['stateGlobal'](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1bd'));}}break;case'11':_0x40c46e['outboundAbandonedCallsDay']+=0x1;_0x3827f1[_0x0472('0x71')]=0xb;_0x3827f1[_0x0472('0x72')]='Abandoned';_0x3827f1[_0x0472('0xec')]+=0x1;_0x3827f1[_0x0472('0xd8')]+=0x1;_0x4422d8=_0x40c46e[_0x0472('0xed')];_0x11fd4b=_0x40c46e[_0x0472('0xda')];hopperUtils[_0x0472('0xcc')](_0x3827f1)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x146df7[_0x0472('0x199')](0xb,_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1[_0x0472('0xec')]>=_0x40c46e[_0x0472('0xee')]){_0x146df7[_0x0472('0x12c')](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1be'));}else{_0x146df7['stateGlobal'](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1be'));}}break;case'20':_0x40c46e[_0x0472('0x1bf')]+=0x1;_0x3827f1[_0x0472('0x71')]=0x14;_0x3827f1['statedesc']=_0x0472('0x1c0');_0x3827f1[_0x0472('0x12a')]+=0x1;_0x3827f1[_0x0472('0xd8')]+=0x1;_0x4422d8=_0x40c46e[_0x0472('0x1a5')];_0x11fd4b=_0x40c46e[_0x0472('0xda')];ami[_0x0472('0x11d')](_0x0472('0x1c1'),ut[_0x0472('0x11f')](_0x59fdf2,'agentreject'));hopperUtils[_0x0472('0xcc')](_0x3827f1)[_0x0472('0xb0')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x146df7['checkRetriveMax'](0x14,_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1['countagentrejectretry']>=_0x40c46e['dialAgentRejectMaxRetry']){_0x146df7['createStateFinal'](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1c2'));}else{_0x146df7[_0x0472('0x133')](_0x3827f1,_0x3afa52,_0x220eb3,_0x0472('0x1c2'));}}break;default:_0x40c46e[_0x0472('0x1c3')]+=0x1;_0x3827f1[_0x0472('0x71')]=0xc;_0x3827f1[_0x0472('0x72')]=_0xf727c6['reason'];_0x4422d8=_0x40c46e[_0x0472('0x1a5')];_0x11fd4b=_0x40c46e[_0x0472('0xda')];hopperUtils[_0x0472('0xcc')](_0x3827f1)['catch'](loggerCatch(_0x0472('0x1c4')));if(_0x146df7['checkRetriveMax'](_0xf727c6[_0x0472('0x1a8')],_0x59fdf2,_0x40c46e)&&!_0x1c5465){if(_0x3827f1[_0x0472('0x126')]+_0x3827f1[_0x0472('0x127')]+_0x3827f1[_0x0472('0x132')]+_0x3827f1[_0x0472('0x128')]+_0x3827f1[_0x0472('0xd7')]+_0x3827f1[_0x0472('0xec')]+_0x3827f1['countmachineretry']+_0x3827f1[_0x0472('0x12a')]>=_0x40c46e[_0x0472('0x19a')]){_0x146df7['stateGlobal'](_0x3827f1,_0x3afa52,_0x220eb3,_0xf727c6[_0x0472('0x1a8')]);}else{_0x146df7[_0x0472('0x12c')](_0x3827f1,_0x3afa52,_0x220eb3,_0xf727c6['reason']);}}}})[_0x0472('0x3e')](function(){if(_0x1c5465){hopperUtils[_0x0472('0xe9')](_0x3827f1,_0x4422d8,_0x11fd4b)[_0x0472('0x3e')](function(){return _0x3afa52(0x1);});}});});};Dialer['prototype'][_0x0472('0x133')]=function(_0xb29b9d,_0x25e5aa,_0x4d63d4,_0x57626c){var _0x52f750=new Final(_0xb29b9d);_0x52f750[_0x0472('0x71')]=0xf;_0x52f750[_0x0472('0x72')]=_0x0472('0x1c5');this[_0x0472('0x12c')](_0x52f750,_0x25e5aa,_0x4d63d4,_0x57626c);};Dialer[_0x0472('0x8a')][_0x0472('0x12c')]=function(_0x4e3367,_0x177a51,_0x27314a,_0x15a003){hopperUtils[_0x0472('0xce')](_0x4e3367)[_0x0472('0x3e')](function(){return _0x177a51(msgResponse(_0x0472('0x1c6'),'Success',_0x15a003));})[_0x0472('0xb0')](function(){return _0x27314a(msgResponse(_0x0472('0x1c7'),_0x0472('0xb1'),_0x0472('0x1c8')));});};Dialer['prototype'][_0x0472('0xb')]=function(_0x42c2ff){var _0x50d793=_0x42c2ff[_0x0472('0x1c9')]/0x64;var _0x2b441d=_0x42c2ff[_0x0472('0xd2')]/(_0x42c2ff[_0x0472('0xd2')]+_0x42c2ff['outboundAnswerCallsDay']);var _0x2c1cc0=Math[_0x0472('0x1ca')](_0x42c2ff[_0x0472('0x1cb')]*(_0x42c2ff[_0x0472('0x1cc')]/0x64));var _0x50d201=Math[_0x0472('0x1ca')](_0x42c2ff[_0x0472('0x1cb')]*(_0x42c2ff[_0x0472('0x1cd')]/0x64));var _0x1ebb62=_0x42c2ff[_0x0472('0x146')]+_0x42c2ff['talking'];var _0x460d33=Math['floor'](_0x42c2ff[_0x0472('0x5c')]*_0x42c2ff[_0x0472('0x5e')]*_0x42c2ff[_0x0472('0x1ce')]*_0x42c2ff[_0x0472('0x1cf')]);if(_['isUndefined'](_0x42c2ff[_0x0472('0x2a')])){if(!_['isUndefined'](_0x42c2ff[_0x0472('0x29')])){_0x42c2ff[_0x0472('0x29')]=undefined;loggerPredictive['error'](_0x0472('0x1d0'),_0x0472('0x1d1'));}if(!_[_0x0472('0x40')](_0x42c2ff[_0x0472('0x65')])){loggerPredictive[_0x0472('0x67')](_0x0472('0x1d0'),_0x0472('0x1d2'));clearInterval(_0x42c2ff[_0x0472('0x65')]);_0x42c2ff[_0x0472('0x65')]=undefined;}_0x42c2ff[_0x0472('0x2a')]=moment()[_0x0472('0x45')](_0x0472('0xc6'));loggerPredictive['info'](_0x42c2ff[_0x0472('0x47')],_0x0472('0x1d3'),_0x42c2ff[_0x0472('0x2a')]);this['handlePower'](_0x42c2ff,0x1);}else if(ifInterval(_0x42c2ff[_0x0472('0x1d4')],_0x42c2ff[_0x0472('0x2a')])){this[_0x0472('0xba')](_0x42c2ff,0x1);loggerPredictiveCalls[_0x0472('0x4a')](_0x0472('0x1d5'),_0x42c2ff[_0x0472('0x2a')],_0x42c2ff['name']);_0x42c2ff['erlangCalls']=0x0;_0x42c2ff['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x50d793<_0x2b441d&&_0x42c2ff['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x42c2ff);loggerPredictive[_0x0472('0x4a')](_0x0472('0x1d6'),_0x0472('0x1d7'),_0x2b441d,'startProgressive',_0x42c2ff[_0x0472('0x47')]);}else if(_0x460d33<_0x42c2ff[_0x0472('0xd3')]&&_0x42c2ff['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x42c2ff);loggerPredictive[_0x0472('0x4a')](_0x0472('0x1d8'),_0x0472('0x1d9'),_0x460d33,_0x0472('0x1da'),_0x42c2ff[_0x0472('0xd3')],_0x0472('0x2a'),_0x42c2ff[_0x0472('0x47')]);}else if(!ifInterval(_0x42c2ff[_0x0472('0x1d4')],_0x42c2ff[_0x0472('0x2a')])&&_[_0x0472('0x40')](_0x42c2ff['startPredictive'])&&!_[_0x0472('0x40')](_0x42c2ff[_0x0472('0x2a')])){_0x42c2ff[_0x0472('0x29')]=moment()[_0x0472('0x45')](_0x0472('0xc6'));loggerPredictive[_0x0472('0x4a')](_0x42c2ff[_0x0472('0x47')],'started\x20in\x20predictive\x20at',_0x42c2ff[_0x0472('0x29')]);hopperUtils[_0x0472('0x1db')](_0x42c2ff[_0x0472('0x1d4')])[_0x0472('0x3e')](this[_0x0472('0x1dc')](_0x42c2ff))[_0x0472('0x3e')](mergeDataErlangB(_0x42c2ff))['then'](this[_0x0472('0x1dd')](_0x42c2ff))[_0x0472('0xb0')](loggerCatchPredictive(_0x0472('0x1de'),_0x42c2ff));}else if(!ifInterval(_0x42c2ff['dialPredictiveInterval'],_0x42c2ff[_0x0472('0x29')])){_0x42c2ff[_0x0472('0xd3')]=0x0;_0x42c2ff[_0x0472('0x29')]=moment()['format'](_0x0472('0xc6'));loggerPredictive[_0x0472('0x4a')](_0x42c2ff[_0x0472('0x47')],_0x0472('0x1df'),_0x42c2ff[_0x0472('0x29')]);clearInterval(_0x42c2ff[_0x0472('0x65')]);_0x42c2ff[_0x0472('0x65')]=undefined;hopperUtils[_0x0472('0x1db')](_0x42c2ff[_0x0472('0x1d4')])['then'](this[_0x0472('0x1dc')](_0x42c2ff))[_0x0472('0x3e')](mergeDataErlangB(_0x42c2ff))[_0x0472('0x3e')](this[_0x0472('0x1dd')](_0x42c2ff))[_0x0472('0xb0')](loggerCatchPredictive(_0x0472('0x1e0'),_0x42c2ff));}else if(_0x42c2ff['predictiveIntervalAvailable']&&_0x1ebb62<_0x42c2ff['predictiveIntervalAvailable']-_0x50d201){clearPredictiveAttributes(_0x42c2ff);loggerPredictive[_0x0472('0x4a')](_0x42c2ff['name'],_0x0472('0x1e1'),_0x1ebb62,_0x0472('0x1e2'),_0x42c2ff[_0x0472('0x1cb')],'-',_0x50d201,'=',_0x42c2ff[_0x0472('0x1cb')]-_0x50d201,')');}else if(_0x42c2ff[_0x0472('0x1cb')]&&_0x1ebb62>_0x42c2ff[_0x0472('0x1cb')]+_0x2c1cc0){clearPredictiveAttributes(_0x42c2ff);loggerPredictive[_0x0472('0x4a')](_0x42c2ff[_0x0472('0x47')],_0x0472('0x1e1'),_0x1ebb62,_0x0472('0x1e3'),_0x42c2ff[_0x0472('0x1cb')],'+',_0x2c1cc0,'=',_0x42c2ff[_0x0472('0x1cb')]+_0x2c1cc0,')');}};Dialer[_0x0472('0x8a')][_0x0472('0x1dc')]=function(_0x474d9b){var _0x119577=this;return function(_0x586e30){return new Promise(function(_0x383b94,_0x2aa6f9){_[_0x0472('0x61')](_0x474d9b,_0x586e30[0x0]);if(checkGetDataPredictive(_0x586e30[0x0])){var _0x5b2110=_0x474d9b[_0x0472('0x1cb')]=_0x474d9b[_0x0472('0x148')]+_0x474d9b[_0x0472('0x146')];var _0x3a65a7=_0x474d9b[_0x0472('0x1d4')]*0x3c;var _0x4d8e39=_0x586e30[0x0][_0x0472('0x56')]+_0x586e30[0x0][_0x0472('0x54')];var _0x4566ef=(_0x586e30[0x0][_0x0472('0x4f')]+_0x586e30[0x0][_0x0472('0x51')]+_0x586e30[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x586e30[0x0]['predictiveIntervalTotalCalls'];_0x474d9b['predictiveIntervalHitRate']=_0x4566ef>0x0?_0x4566ef:0x1;switch(_0x474d9b[_0x0472('0x1e4')]){case _0x0472('0x1e5'):var _0x4b0919=_0x474d9b[_0x0472('0x1c9')]/0x64;return _0x119577[_0x0472('0x1e6')](_0x5b2110,_0x3a65a7,_0x4d8e39,_0x4566ef,_0x4b0919)[_0x0472('0x3e')](function(_0x187615){return _0x383b94(_0x187615);});case _0x0472('0x1e7'):var _0x1445f2=_0x474d9b[_0x0472('0x1c9')]/0x64;return _0x119577['busyFactor'](_0x5b2110,_0x3a65a7,_0x4d8e39,_0x4566ef,_0x1445f2)[_0x0472('0x3e')](function(_0x5bdf26){return _0x383b94(_0x5bdf26);});default:return _0x2aa6f9(msgResponse(_0x0472('0x1e8'),_0x0472('0xb1'),_0x0472('0x1e9')));}}else{return _0x2aa6f9(msgResponse('[getDataPredictive]',_0x0472('0xb1'),'check\x20failure'));}});};};Dialer[_0x0472('0x8a')][_0x0472('0x1ea')]=function(_0xc8cc9d){var _0x541af4=this;return function(_0x3bb1d5){return new Promise(function(_0x23c24a,_0x59976d){_[_0x0472('0x61')](_0xc8cc9d,_0x3bb1d5[0x0]);if(checkGetDataPredictive(_0x3bb1d5[0x0])){loggerPredictive['info'](JSON[_0x0472('0x77')](_0x3bb1d5[0x0]));if(_0xc8cc9d[_0x0472('0x1e4')]==='dropRate'){return _0x541af4['getVoiceQueueRtPauses'](_0xc8cc9d['id'])[_0x0472('0x3e')](function(_0x3a434f){var _0x230f94=_0xc8cc9d['loggedIn']-_0x3a434f[0x0][_0x0472('0x1eb')];var _0x103d99=_0xc8cc9d[_0x0472('0x1d4')]*0x3c;var _0x57782c=_0x3bb1d5[0x0]['predictiveIntervalAvgTalktime']+_0x3bb1d5[0x0][_0x0472('0x54')];var _0x322656=(_0x3bb1d5[0x0][_0x0472('0x4f')]+_0x3bb1d5[0x0][_0x0472('0x51')]+_0x3bb1d5[0x0][_0x0472('0x53')])/_0x3bb1d5[0x0][_0x0472('0x4d')];var _0x177583=_0xc8cc9d['dialPredictiveOptimizationPercentage']/0x64;_0xc8cc9d[_0x0472('0x1ec')]=_0x3a434f[0x0][_0x0472('0x1eb')]||0x0;_0xc8cc9d[_0x0472('0x1ce')]=_0x322656>0x0?_0x322656:0x1;return _0x541af4[_0x0472('0x1e6')](_0x230f94,_0x103d99,_0x57782c,_0x322656,_0x177583);})[_0x0472('0x3e')](function(_0xa01081){return _0x23c24a(_0xa01081);})[_0x0472('0xb0')](function(_0x4803ab){return _0x59976d(msgResponse(_0x0472('0x1ed'),_0x0472('0xb1'),JSON[_0x0472('0x77')](_0x4803ab)));});}if(_0xc8cc9d[_0x0472('0x1e4')]===_0x0472('0x1e7')){return _0x541af4[_0x0472('0x15f')](_0xc8cc9d['id'])[_0x0472('0x3e')](function(_0x56042f){var _0x3b61a3=_0xc8cc9d[_0x0472('0x1ee')]-_0x56042f[0x0][_0x0472('0x1eb')];var _0x1760ad=_0xc8cc9d[_0x0472('0x1d4')]*0x3c;var _0x202f47=_0x3bb1d5[0x0][_0x0472('0x56')]+_0x3bb1d5[0x0][_0x0472('0x54')];var _0xfebda7=(_0x3bb1d5[0x0][_0x0472('0x4f')]+_0x3bb1d5[0x0][_0x0472('0x51')]+_0x3bb1d5[0x0][_0x0472('0x53')])/_0x3bb1d5[0x0][_0x0472('0x4d')];var _0x3e3813=_0xc8cc9d['dialPredictiveOptimizationPercentage']/0x64;_0xc8cc9d[_0x0472('0x1ec')]=_0x56042f[0x0][_0x0472('0x1eb')]||0x0;_0xc8cc9d[_0x0472('0x1ce')]=_0xfebda7>0x0?_0xfebda7:0x1;return _0x541af4['busyFactor'](_0x3b61a3,_0x1760ad,_0x202f47,_0xfebda7,_0x3e3813);})[_0x0472('0x3e')](function(_0x2cd903){return _0x23c24a(_0x2cd903);})['catch'](function(_0x668b09){return _0x59976d(msgResponse(_0x0472('0x1ed'),'Failure',JSON[_0x0472('0x77')](_0x668b09)));});}}else{return _0x59976d(msgResponse('[getDataPredictive]',_0x0472('0xb1'),_0x0472('0x1ef')));}});};};Dialer[_0x0472('0x8a')]['startMethodPredictive']=function(_0x2ff087){var _0x1ee069=this;return function(){var _0x58d86a=0x0;var _0x5bc685=Math[_0x0472('0x1f0')](_0x2ff087[_0x0472('0x1f1')]*0x3e8);if(_0x5bc685>0x0){_0x5bc685=_0x5bc685<0x64?0x64:_0x5bc685;loggerPredictive[_0x0472('0x4a')](_0x2ff087[_0x0472('0x47')],_0x0472('0x1f2'),_0x5bc685,'milliseconds');_0x2ff087[_0x0472('0x65')]=setInterval(function(){_0x1ee069['handlePredictive'](_0x2ff087);loggerPredictiveCalls[_0x0472('0x4a')](_0x0472('0x1f3'),_0x58d86a+=0x1);},_0x5bc685);}else{loggerPredictive[_0x0472('0x4a')](_0x2ff087[_0x0472('0x47')],_0x0472('0x1f4'));}};};Dialer[_0x0472('0x8a')][_0x0472('0x1f5')]=function(_0x1a9416,_0x5d71a2){var _0x165f6e=this;return function(_0x356937){if(_[_0x0472('0x49')](_0x356937)){if(_[_0x0472('0xf6')](_0x5d71a2['UserId'])||!_0x5d71a2[_0x0472('0x1f6')]){if(_0x1a9416['dialMethod']===_0x0472('0xa')){_0x1a9416[_0x0472('0x74')]=_[_0x0472('0x40')](_0x1a9416[_0x0472('0x74')])?!![]:_0x1a9416[_0x0472('0x74')];var _0x1cd750=uuid['v4']();_0x165f6e['actions'][_0x1cd750]=new Action(_0x1a9416,_0x5d71a2,_0x1cd750);loggerBooked[_0x0472('0x4a')](_0x0472('0x1f7'),_0x1cd750,_0x0472('0x1f8'),JSON[_0x0472('0x77')](_0x1a9416[_0x0472('0x74')]),_0x0472('0x1f9'),_0x1a9416[_0x0472('0x47')]);if(_0x1a9416['queueStatusComplete']){_0x1a9416[_0x0472('0x74')]=![];_0x165f6e[_0x0472('0x2b')][_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xc2')]]=[];ami[_0x0472('0xa1')]({'actionid':_0x1cd750,'action':_0x0472('0x1fa'),'queue':_0x1a9416[_0x0472('0x47')]})['catch'](function(){_0x165f6e[_0x0472('0xc5')](_0x1a9416);hopperUtils[_0x0472('0xe0')]({'active':![],'ContactId':_0x165f6e[_0x0472('0x25')][_0x1cd750]['ContactId'],'ListId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xe2')],'VoiceQueueId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xe3')]||undefined,'CampaignId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xf0')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x165f6e['actions'][_0x1cd750];});}else{loggerBooked[_0x0472('0x4a')](_0x0472('0x1fb'),JSON['stringify'](_0x1a9416[_0x0472('0x74')]),_0x0472('0x1f9'),_0x1a9416[_0x0472('0x47')]);_0x165f6e[_0x0472('0xc5')](_0x1a9416);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xef')],'ListId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xe2')],'VoiceQueueId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xe3')]||undefined,'CampaignId':_0x165f6e[_0x0472('0x25')][_0x1cd750][_0x0472('0xf0')]||undefined})['catch'](loggerCatch(_0x0472('0x1fc')));delete _0x165f6e[_0x0472('0x25')][_0x1cd750];}}else{return _0x165f6e['actionOriginate'](_0x1a9416,_0x5d71a2);}}else{if(utils[_0x0472('0x62')](undefined,_0x5d71a2[_0x0472('0x1fd')])<_0x1a9416[_0x0472('0x1fe')]*0x3c){if(_0x5d71a2[_0x0472('0x1ff')]&&!_0x5d71a2['Agent'][_0x0472('0x200')]){_0x165f6e[_0x0472('0x1e')][_0x0472('0x103')](_0x5d71a2['id'])[_0x0472('0xfd')](function(){_0x165f6e[_0x0472('0xc5')](_0x1a9416);});}else{hopperUtils[_0x0472('0x201')]({'active':![]},_0x5d71a2['id'],0x1)[_0x0472('0xfd')](function(){_0x165f6e[_0x0472('0xc5')](_0x1a9416);});}}else{_0x1a9416['outboundReCallsDay']+=0x1;_0x165f6e[_0x0472('0xc5')](_0x1a9416);if(_0x1a9416['dialRecallInQueue']){hopperUtils[_0x0472('0xe0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5d71a2['ContactId'],'ListId':_0x5d71a2['ListId'],'VoiceQueueId':_0x5d71a2[_0x0472('0xe3')]||undefined,'CampaignId':_0x5d71a2['CampaignId']||undefined})[_0x0472('0xb0')](loggerCatch(_0x0472('0x202')));hopperUtils[_0x0472('0xcc')](createObjHistory(_0x1a9416,_0x5d71a2,utils[_0x0472('0x6c')]['QUEUE_RECALL'],0x17,_0x0472('0x203')))[_0x0472('0xb0')](loggerCatch(_0x0472('0x204')));}else{_0x165f6e[_0x0472('0x121')](createObjHistory(_0x1a9416,_0x5d71a2,utils[_0x0472('0x6c')][_0x0472('0x205')],0x16,_0x0472('0x206')),_0x0472('0x207'),_0x0472('0x208'));}}}}else{_0x1a9416['outboundBlacklistCallsDay']+=0x1;_0x165f6e[_0x0472('0x121')](createObjHistory(_0x1a9416,_0x5d71a2,utils['CAMPAIGN_STATUS'][_0x0472('0x209')],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x0472('0x20a'));throw _0x0472('0x20b');}};};Dialer['prototype']['handleIvr']=function(_0x18d091){var _0x1cbe64=this;var _0x9ae18f=_0x18d091[_0x0472('0x20c')]-_0x18d091[_0x0472('0x84')];emitCampaignSummary(_0x18d091);if(_0x9ae18f>0x0&&_0x18d091[_0x0472('0x6a')]==0x0){if(_0x9ae18f>this['maxNumberOriginate']){_0x9ae18f=this[_0x0472('0x23')];}_0x18d091[_0x0472('0x6a')]=0x1;hopperUtils['getContactDialerIvr'](_0x18d091,_0x9ae18f)[_0x0472('0x3e')](function(_0x301a86){_0x18d091['temp']=0x0;if(_0x301a86){if(!utils[_0x0472('0x20d')](_0x301a86)){_0x18d091['message']=utils[_0x0472('0x6c')][_0x0472('0x20e')];logger['info'](_0x0472('0x20f')+_0x18d091[_0x0472('0x47')]);}else{_0x18d091[_0x0472('0x84')]+=_0x301a86[_0x0472('0x9f')];_0x18d091[_0x0472('0x6b')]=utils['CAMPAIGN_STATUS'][_0x0472('0x210')];for(var _0x330806=0x0;_0x330806<_0x301a86[_0x0472('0x9f')];_0x330806+=0x1){_0x18d091['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x301a86[_0x330806])||_[_0x0472('0xf6')](_0x301a86[_0x330806]['Contact'])||_[_0x0472('0xf6')](_0x301a86[_0x330806][_0x0472('0x16b')])){_0x1cbe64['emptyContact'](_0x0472('0x211'),_0x18d091,_0x301a86[_0x330806]);}else{hopperUtils[_0x0472('0x212')](_[_0x0472('0x78')](_0x301a86[_0x330806],[_0x0472('0xf0'),_0x0472('0x16b')]))['then'](_0x1cbe64['checkContactBlack'](_0x18d091,_0x301a86[_0x330806]))['catch'](_0x1cbe64[_0x0472('0x213')](_0x0472('0x214'),_0x18d091));}}}}})['catch'](loggerGetContactDialer(_0x0472('0x215'),_0x18d091,_0x9ae18f));}};Dialer[_0x0472('0x8a')]['handlePower']=function(_0x5a61eb,_0x1a39be){var _0x5576e6=this;var _0x578366=[];if(_0x1a39be<0x1||_0x5a61eb[_0x0472('0xb9')]==='booked'){_0x1a39be=0x1;}var _0x1138dd=Math[_0x0472('0x1f0')](_0x5a61eb['available']*_0x1a39be)-_0x5a61eb[_0x0472('0x84')];if(_0x5a61eb[_0x0472('0x216')]>0x0){var _0x99bb50=_0x5a61eb[_0x0472('0x216')]-_0x5a61eb['originated']-_0x5a61eb[_0x0472('0x148')]-_0x5a61eb[_0x0472('0x149')];if(_0x1138dd>_0x99bb50){_0x1138dd=_0x99bb50;}}if(_0x1138dd>0x0&&_0x5a61eb[_0x0472('0x6a')]==0x0){if(_0x5a61eb['dialMethod']===_0x0472('0xa')){_0x1138dd=0x1;}if(_0x1138dd>this['maxNumberOriginate']){_0x1138dd=this[_0x0472('0x23')];}for(var _0x4c6e0a in this[_0x0472('0x21')]){if(typeof this[_0x0472('0x21')][_0x4c6e0a]!==_0x0472('0xb4')){if(this[_0x0472('0x21')][_0x4c6e0a][_0x0472('0x71')]==='not_inuse'&&this[_0x0472('0x21')][_0x4c6e0a][_0x0472('0x8d')]==='reachable'){_0x578366[_0x0472('0xa0')](this[_0x0472('0x21')][_0x4c6e0a]['id']);}}}_0x5a61eb[_0x0472('0x6a')]=0x1;hopperUtils[_0x0472('0x217')](_0x5a61eb,_0x578366,_0x1138dd)[_0x0472('0x3e')](function(_0x297e5e){_0x5a61eb[_0x0472('0x6a')]=0x0;if(_0x297e5e){if(!utils[_0x0472('0x20d')](_0x297e5e)){hopperUtils[_0x0472('0x218')](_0x5a61eb)[_0x0472('0x3e')](sendMessageReschedule(_0x5a61eb))[_0x0472('0xb0')](loggerCatch('[countReScheduled]\x20'));}else{_0x5a61eb['originated']+=_0x297e5e[_0x0472('0x9f')];_0x5a61eb[_0x0472('0x6b')]=_0x5a61eb[_0x0472('0xb9')]===_0x0472('0xa')?utils[_0x0472('0x6c')]['ACTIVE']:utils[_0x0472('0x6c')][_0x0472('0x210')];for(var _0x1f16d8=0x0;_0x1f16d8<_0x297e5e[_0x0472('0x9f')];_0x1f16d8+=0x1){if(_[_0x0472('0xf6')](_0x297e5e[_0x1f16d8])||_[_0x0472('0xf6')](_0x297e5e[_0x1f16d8][_0x0472('0x182')])||_[_0x0472('0xf6')](_0x297e5e[_0x1f16d8]['phone'])){_0x5576e6[_0x0472('0x163')]('[actionOriginate]\x20',_0x5a61eb,_0x297e5e[_0x1f16d8]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x297e5e[_0x1f16d8],[_0x0472('0xe3'),_0x0472('0x16b')]))['then'](_0x5576e6[_0x0472('0x1f5')](_0x5a61eb,_0x297e5e[_0x1f16d8]))['catch'](_0x5576e6[_0x0472('0x213')](_0x0472('0x211'),_0x5a61eb));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x5a61eb,_0x1138dd));}};Dialer[_0x0472('0x8a')]['handlePredictive']=function(_0x557d88){if(_0x557d88[_0x0472('0x216')]>0x0){var _0x5e47b3=_0x557d88['dialLimitQueue']-_0x557d88[_0x0472('0x84')]-_0x557d88[_0x0472('0x148')];if(_0x5e47b3>0x0&&_0x557d88[_0x0472('0x6a')]==0x0){this[_0x0472('0x219')](_0x557d88);}else{loggerPredictiveCalls[_0x0472('0x4a')]('[handlePredictive][limitChannel]');}}else{this[_0x0472('0x219')](_0x557d88);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x1ea420){var _0x1c8f82=this;var _0x2669df=[];_0x1ea420[_0x0472('0x84')]+=0x1;for(var _0x24544b in this[_0x0472('0x21')]){if(typeof this[_0x0472('0x21')][_0x24544b]!==_0x0472('0xb4')){if(this[_0x0472('0x21')][_0x24544b]['state']===_0x0472('0x21a')&&this[_0x0472('0x21')][_0x24544b][_0x0472('0x8d')]==='reachable'){_0x2669df[_0x0472('0xa0')](this[_0x0472('0x21')][_0x24544b]['id']);}}}_0x1ea420['temp']=0x1;return this[_0x0472('0x217')](_0x1ea420['id'],_0x2669df,0x1,_0x1ea420[_0x0472('0x21b')],_0x1ea420)[_0x0472('0x3e')](function(_0x47bb48){_0x1ea420[_0x0472('0x6a')]=0x1;if(_0x47bb48){if(!utils['checkContactEmpty'](_0x47bb48)){utils[_0x0472('0x69')](_0x1ea420,0x1,0x0);return hopperUtils[_0x0472('0x218')](_0x1ea420)[_0x0472('0x3e')](sendMessageReschedule(_0x1ea420))[_0x0472('0xb0')](loggerCatch(_0x0472('0x21c')));}else{_0x1ea420[_0x0472('0x6b')]=utils[_0x0472('0x6c')][_0x0472('0x210')];if(_['isNil'](_0x47bb48[0x0])||_['isNil'](_0x47bb48[0x0][_0x0472('0x182')])||_[_0x0472('0xf6')](_0x47bb48[0x0][_0x0472('0x16b')])){_0x1c8f82[_0x0472('0x163')](_0x0472('0x211'),_0x1ea420,_0x47bb48[0x0]);}else{return hopperUtils[_0x0472('0x21d')](_[_0x0472('0x78')](_0x47bb48[0x0],[_0x0472('0xe3'),_0x0472('0x16b')]))[_0x0472('0x3e')](_0x1c8f82['checkContactBlack'](_0x1ea420,_0x47bb48[0x0]))[_0x0472('0xb0')](_0x1c8f82[_0x0472('0x213')]('[actionOriginatePredictive]\x20',_0x1ea420));}}}})[_0x0472('0xb0')](loggerGetContactDialer(_0x0472('0x21e'),_0x1ea420,0x1));};Dialer[_0x0472('0x8a')][_0x0472('0x1e6')]=function(_0x35bd19,_0x478310,_0x524e2a,_0x1db2fc,_0xe4b136,_0x30f876){loggerPredictive[_0x0472('0x4a')](_0x0472('0x21f'));loggerPredictive[_0x0472('0x4a')](_0x0472('0x220'),_0x35bd19);loggerPredictive[_0x0472('0x4a')](_0x0472('0x221'),_0x478310);loggerPredictive[_0x0472('0x4a')](_0x0472('0x222'),_0x524e2a);loggerPredictive[_0x0472('0x4a')](_0x0472('0x223'),_0x1db2fc);loggerPredictive['info'](_0x0472('0x224'),_0xe4b136);loggerPredictive[_0x0472('0x4a')](_0x0472('0x57'));return new Promise(function(_0x2e50e5,_0x4dc718){if(_0x35bd19<=0x0||isNaN(_0x35bd19)){return _0x4dc718(msgResponse(_0x0472('0x225'),_0x0472('0x89'),'m\x20=\x20'+_0x35bd19));}if(_0x524e2a<=0x0||isNaN(_0x524e2a)){return _0x4dc718(msgResponse('[abandonmentRate]','Error','Ts\x20=\x20'+_0x524e2a));}if(_0x1db2fc<=0x0||isNaN(_0x1db2fc)){return _0x4dc718(msgResponse(_0x0472('0x225'),_0x0472('0x89'),_0x0472('0x226')+_0x1db2fc));}if(_0x478310<=0x0||isNaN(_0x478310)){return _0x4dc718(msgResponse('[abandonmentRate]',_0x0472('0x89'),_0x0472('0x227')+_0x478310));}if(_0xe4b136<=0x0||isNaN(_0xe4b136)){return _0x4dc718(msgResponse('[abandonmentRate]','Error',_0x0472('0x228')+_0xe4b136));}_0x30f876=_0x30f876||0x0;var _0x507cc5=0x1/_0x524e2a;var _0x4844ec=0x0;var _0xce8ad5=0x0;var _0x57b41d=0x0;var _0x588039=0x0;for(var _0x976ddc=0x0;_0x57b41d<_0xe4b136;_0x976ddc+=0x1){_0xce8ad5=_0x976ddc/_0x478310;_0x4844ec=(_0x1db2fc*_0xce8ad5+_0x30f876)/_0x507cc5;_0x57b41d=utils[_0x0472('0x229')](_0x4844ec,_0x35bd19);_0x588039=_0x4844ec/_0x35bd19*(0x1-utils[_0x0472('0x229')](_0x4844ec,_0x35bd19));}return _0x2e50e5({'erlangCalls':_0x976ddc,'erlangCallToSecond':_0x478310/_0x976ddc,'erlangAbandonmentRate':_0x57b41d,'erlangBusyFactor':_0x588039});});};Dialer['prototype'][_0x0472('0x22a')]=function(_0x2bb50e,_0x4e1c3a,_0x583e69,_0x4a8b15,_0x333594,_0x21c8ad){loggerPredictive['info'](_0x0472('0x22b'));loggerPredictive[_0x0472('0x4a')](_0x0472('0x220'),_0x2bb50e);loggerPredictive[_0x0472('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e1c3a);loggerPredictive[_0x0472('0x4a')]('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',_0x583e69);loggerPredictive[_0x0472('0x4a')](_0x0472('0x223'),_0x4a8b15);loggerPredictive[_0x0472('0x4a')](_0x0472('0x22c'),_0x333594);loggerPredictive[_0x0472('0x4a')](_0x0472('0x57'));return new Promise(function(_0x5d114c,_0xe8e52a){if(_0x2bb50e<=0x0||isNaN(_0x2bb50e)){return _0xe8e52a(msgResponse(_0x0472('0x22d'),_0x0472('0x89'),_0x0472('0x22e')+_0x2bb50e));}if(_0x583e69<=0x0||isNaN(_0x583e69)){return _0xe8e52a(msgResponse(_0x0472('0x22d'),_0x0472('0x89'),_0x0472('0x22f')+_0x583e69));}if(_0x4a8b15<=0x0||isNaN(_0x4a8b15)){return _0xe8e52a(msgResponse(_0x0472('0x22d'),'Error','p\x20=\x20'+_0x4a8b15));}if(_0x4e1c3a<=0x0||isNaN(_0x4e1c3a)){return _0xe8e52a(msgResponse(_0x0472('0x22d'),_0x0472('0x89'),_0x0472('0x227')+_0x4e1c3a));}if(_0x333594<=0x0||isNaN(_0x333594)){return _0xe8e52a(msgResponse('[busyFactor]',_0x0472('0x89'),'Umin\x20=\x20'+_0x333594));}_0x21c8ad=_0x21c8ad||0x0;var _0x4ecb4e=0x1/_0x583e69;var _0x23e661=0x0;var _0x3607ae=0x0;var _0x5e97e2=0x0;var _0x367c68=0x0;for(var _0xab9bc3=0x0;_0x367c68<_0x333594;_0xab9bc3+=0x1){_0x3607ae=_0xab9bc3/_0x4e1c3a;_0x23e661=(_0x4a8b15*_0x3607ae+_0x21c8ad)/_0x4ecb4e;_0x5e97e2=utils[_0x0472('0x229')](_0x23e661,_0x2bb50e);_0x367c68=_0x23e661/_0x2bb50e*(0x1-utils[_0x0472('0x229')](_0x23e661,_0x2bb50e));}return _0x5d114c({'erlangCalls':_0xab9bc3,'erlangCallToSecond':_0x4e1c3a/_0xab9bc3,'erlangAbandonmentRate':_0x5e97e2,'erlangBusyFactor':_0x367c68});});};module['exports']=Dialer; \ No newline at end of file +var _0x0662=['handlePower','power','Queue','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Global:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueid','type','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','state','statedesc','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','callAdditionalPhoneAfterMin','countabandonedretry','add','dialAbandonedRetryFrequency','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','queueBooked','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','updateOriginated','[unlock][syncQueueStatusComplete]','_rr','unlockRR','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','emit','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[syncHangupInAMDIvr][createHistory]','countbusyretry','reason19\x20machine....','[rescheduleContact][Machine]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','[syncHangupIvr][createHistory]','queuesSummary','running','INACTIVE','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','online','resolve','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','Agent','user:%s','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-CAMPAIGNID','setXMDContactVariables','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','agentBusyFactor','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','maxNumberOriginate','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','actions','uniqueId','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive','name','startProgressive\x20value\x20cleared','startPredictive','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','format','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','interval','content','true','catch','iftime\x20%s,%s','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive'];(function(_0xd07e81,_0x1ccacd){var _0x379364=function(_0x8f8eec){while(--_0x8f8eec){_0xd07e81['push'](_0xd07e81['shift']());}};_0x379364(++_0x1ccacd);}(_0x0662,0x175));var _0x2066=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0662[_0x484e36];return _0xafc85d;};'use strict';var util=require('util');var _=require(_0x2066('0x0'));var uuid=require(_0x2066('0x1'));var moment=require(_0x2066('0x2'));var rr=require('rr');var Redis=require(_0x2066('0x3'));var utils=require('./utils');var hopperUtils=require(_0x2066('0x4'));var ut=require(_0x2066('0x5'));var config=require(_0x2066('0x6'));var logger=require(_0x2066('0x7'))(_0x2066('0x8'));var loggerBooked=require(_0x2066('0x7'))(_0x2066('0x9'));var loggerPredictive=require(_0x2066('0x7'))(_0x2066('0xa'));var loggerPredictiveCalls=require(_0x2066('0x7'))(_0x2066('0xb'));var loggerSyncQueueSummary=require(_0x2066('0x7'))(_0x2066('0xc'));var ami=require(_0x2066('0xd'));config[_0x2066('0xe')]=_[_0x2066('0xf')](config[_0x2066('0xe')],{'host':_0x2066('0x10'),'port':0x18eb});var io=require(_0x2066('0x11'))(new Redis(config[_0x2066('0xe')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x2066('0x12'));var RpcSetting=require(_0x2066('0x13'));var Interval=require(_0x2066('0x14'));var Action=require(_0x2066('0x15'));var History=require(_0x2066('0x16'));var Final=require(_0x2066('0x17'));var AgentComplete=require(_0x2066('0x18'));var QueueCallerAbandon=require(_0x2066('0x19'));var Hangup=require(_0x2066('0x1a'));var ipAgi=process[_0x2066('0x1b')][_0x2066('0x1c')]||_0x2066('0x1d');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x2066('0x1e')][_0x2066('0x1f')]=function(_0xb2f61d){this[_0x2066('0x20')]=this['tail']?this['tail'][_0x2066('0x21')](_0xb2f61d):_0xb2f61d();};function Dialer(_0x13d702,_0x469c67){this['sequence']=new Sequence();this['preview']=_0x469c67;this[_0x2066('0x22')]=_0x13d702[_0x2066('0x22')];this[_0x2066('0x23')]=_0x13d702[_0x2066('0x23')];this[_0x2066('0x24')]=_0x13d702[_0x2066('0x24')];this[_0x2066('0x25')]=_0x13d702[_0x2066('0x25')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x2066('0x26')]={};this['contactsId']={};this[_0x2066('0x27')]={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this['queueBooked']={};this[_0x2066('0x28')]={};this['queuesSummary']={};ami['on'](_0x2066('0x29'),this[_0x2066('0x2a')][_0x2066('0x2b')](this));ami['on'](_0x2066('0x2c'),this[_0x2066('0x2d')][_0x2066('0x2b')](this));ami['on'](_0x2066('0x2e'),this['syncOriginateResponse'][_0x2066('0x2b')](this));ami['on'](_0x2066('0x2f'),this[_0x2066('0x30')][_0x2066('0x2b')](this));ami['on'](_0x2066('0x31'),this[_0x2066('0xc')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x2066('0x32')]['bind'](this));ami['on'](_0x2066('0x33'),this[_0x2066('0x34')][_0x2066('0x2b')](this));ami['on'](_0x2066('0x35'),this[_0x2066('0x36')]['bind'](this));ami['on'](_0x2066('0x37'),this['syncVarSet'][_0x2066('0x2b')](this));ami['on']('queuemember',this[_0x2066('0x38')]['bind'](this));ami['on'](_0x2066('0x39'),this[_0x2066('0x3a')][_0x2066('0x2b')](this));this['loopCampaigns']();this[_0x2066('0x3b')]();RpcSetting[_0x2066('0x3c')]()[_0x2066('0x3d')](function(_0x351f52){previewRecallmeReminderInterval=_0x351f52[_0x2066('0x3e')];});}function isNotNull(_0x46dc0b){return _0x46dc0b!==null&&!_[_0x2066('0x3f')](_0x46dc0b);}function msgResponse(_0x393aa5,_0x2aeb4a,_0x2e0bfb){return{'action':_0x393aa5,'response':_0x2aeb4a,'message':_0x2e0bfb,'stack':_0x2e0bfb};}function emit(_0x57370c,_0x50d222,_0x160149){io['to'](_0x57370c)['emit'](_0x50d222,_0x160149);}function emitOutboundVoiceQueueSummary(_0x4b543a){if(_0x4b543a['type']===_0x2066('0x40')){logger[_0x2066('0x41')](_0x2066('0x42'),util[_0x2066('0x43')](_0x4b543a,{'showHidden':![],'depth':null}));emit(util['format'](_0x2066('0x44'),_0x4b543a['name']),'voice_queue:save',_0x4b543a);}}function checkGetDataPredictive(_0x23378e){if(isNotNull(_0x23378e)&&!_['isEmpty'](_0x23378e)){loggerPredictive[_0x2066('0x45')](_0x2066('0x46'));loggerPredictive[_0x2066('0x45')](_0x2066('0x47'),_0x23378e[_0x2066('0x48')]);loggerPredictive[_0x2066('0x45')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23378e[_0x2066('0x49')]);loggerPredictive[_0x2066('0x45')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x23378e[_0x2066('0x4a')]);loggerPredictive['info'](_0x2066('0x4b'),_0x23378e[_0x2066('0x4c')]);loggerPredictive[_0x2066('0x45')](_0x2066('0x4d'),_0x23378e['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x2066('0x45')](_0x2066('0x4e'),_0x23378e[_0x2066('0x4f')]);loggerPredictive[_0x2066('0x45')](_0x2066('0x50'));if(_0x23378e[_0x2066('0x48')]>0x0){if(!_[_0x2066('0x3f')](_0x23378e[_0x2066('0x4f')])&&_0x23378e[_0x2066('0x4f')]>0x0){return!![];}loggerPredictive[_0x2066('0x45')](_0x2066('0x51'));if(!_[_0x2066('0x3f')](_0x23378e[_0x2066('0x52')])&&_0x23378e[_0x2066('0x52')]>0x0){return!![];}loggerPredictive[_0x2066('0x45')](_0x2066('0x53'));}else{loggerPredictive[_0x2066('0x45')](_0x2066('0x54'));}}else{loggerPredictive[_0x2066('0x45')](_0x2066('0x55'));}return![];}function mergeDataErlangB(_0x4fc2f9){return function(_0x27a760){loggerPredictive[_0x2066('0x45')](_0x2066('0x56'));loggerPredictive['info'](_0x2066('0x57'),_0x27a760['erlangCalls']);loggerPredictive[_0x2066('0x45')](_0x2066('0x58'),_0x27a760['erlangCallToSecond']);loggerPredictive[_0x2066('0x45')](_0x2066('0x59'),_0x27a760[_0x2066('0x5a')]);loggerPredictive[_0x2066('0x45')](_0x2066('0x5b'),_0x27a760[_0x2066('0x5c')]);loggerPredictive[_0x2066('0x45')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x27a760['erlangAbandonmentRate']);loggerPredictive[_0x2066('0x45')]('---------------------------');_[_0x2066('0x5d')](_0x4fc2f9,_0x27a760);};}function ifInterval(_0x41b5b2,_0x561f22){if(_[_0x2066('0x3f')](_0x561f22)){return![];}return utils[_0x2066('0x5e')](undefined,_0x561f22)<_0x41b5b2*0x3c;}function clearPredictiveAttributes(_0x2fb74c){if(_0x2fb74c[_0x2066('0x5f')]){_0x2fb74c[_0x2066('0x5f')]=undefined;loggerPredictive[_0x2066('0x41')](_0x2fb74c[_0x2066('0x60')],_0x2066('0x61'));}if(_0x2fb74c[_0x2066('0x62')]){_0x2fb74c[_0x2066('0x62')]=undefined;loggerPredictive['debug'](_0x2fb74c[_0x2066('0x60')],'startPredictive\x20value\x20cleared');}if(_0x2fb74c[_0x2066('0x63')]){clearInterval(_0x2fb74c[_0x2066('0x63')]);_0x2fb74c['handlePredictive']=undefined;loggerPredictive[_0x2066('0x41')](_0x2fb74c[_0x2066('0x60')],_0x2066('0x64'));}}function loggerCatchPredictive(_0x2725f8,_0x3713a3){return function(_0x149232){loggerPredictive[_0x2066('0x65')](_0x3713a3[_0x2066('0x60')],_0x2725f8);loggerPredictive[_0x2066('0x65')](_0x149232[_0x2066('0x66')]);clearPredictiveAttributes(_0x3713a3);};}function loggerCatch(_0x3dab3b){return function(_0x4cf773){logger[_0x2066('0x65')](_0x3dab3b,util[_0x2066('0x43')](_0x4cf773,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0xb2def6,_0x779544,_0x4c9cae){return function(_0x493a59){utils[_0x2066('0x67')](_0x779544,_0x4c9cae,0x0);_0x779544[_0x2066('0x68')]=0x0;logger[_0x2066('0x65')](_0xb2def6,util[_0x2066('0x43')](_0x493a59,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x511336){return function(_0x2e4fd9){if(isNotNull(_0x2e4fd9)&&isNotNull(_0x2e4fd9[0x0])){if(_0x2e4fd9[0x0][_0x2066('0x69')]>0x0){_0x511336['message']=utils[_0x2066('0x6a')][_0x2066('0x6b')];logger[_0x2066('0x45')](_0x2066('0x6c')+_0x511336[_0x2066('0x60')],_0x2e4fd9[0x0][_0x2066('0x69')],_0x2066('0x6d'));}else{_0x511336['message']=utils[_0x2066('0x6a')][_0x2066('0x6e')];logger[_0x2066('0x45')](_0x2066('0x6f')+_0x511336['name']);}}};}function createObjHistory(_0x4bc815,_0x26250c,_0x58cae1,_0x45222c,_0x3dac6e){_0x4bc815[_0x2066('0x70')]=_0x58cae1;var _0x2e3de3=new Action(_0x4bc815,_0x26250c);var _0x297684=new History(_0x2e3de3);_0x297684['state']=_0x45222c;_0x297684['statedesc']=_0x3dac6e;_0x297684[_0x2066('0x71')]=_0x2e3de3[_0x2066('0x72')];return _0x297684;}function unlockQueueStatus(_0x3879e9,_0x3dcdaf){setTimeout(function(){if(_[_0x2066('0x3f')](_0x3879e9[_0x2066('0x73')])){loggerBooked[_0x2066('0x65')](_0x2066('0x74'),_0x3dcdaf);}_0x3879e9['queueStatusComplete']=!![];loggerBooked[_0x2066('0x45')](_0x2066('0x75'),_0x3dcdaf,JSON[_0x2066('0x76')](_[_0x2066('0x77')](_0x3879e9,[_0x2066('0x60'),_0x2066('0x73')])));},0x1f3);}function checkInterval(_0x4e6eaf){return function(){if(!isNotNull(_0x4e6eaf[_0x2066('0x78')])){_0x4e6eaf[_0x2066('0x70')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x4e6eaf[_0x2066('0x60')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4e6eaf[_0x2066('0x78')][_0x2066('0x79')])){_0x4e6eaf[_0x2066('0x70')]=utils['CAMPAIGN_STATUS'][_0x2066('0x7a')];throw _0x4e6eaf['name']+_0x2066('0x7b');}if(!isNotNull(_[_0x2066('0x7c')](_0x4e6eaf[_0x2066('0x78')]['Intervals']))){_0x4e6eaf[_0x2066('0x70')]=utils[_0x2066('0x6a')][_0x2066('0x7a')];throw _0x4e6eaf['name']+_0x2066('0x7b');}};}function checkIsIVRCampaignActive(_0x246b8d){return function(){if(!utils[_0x2066('0x7d')](_0x246b8d)){_0x246b8d[_0x2066('0x70')]=utils[_0x2066('0x6a')]['INACTIVE'];throw _0x246b8d['name']+_0x2066('0x7e');}};}function emitCampaignSummary(_0x275723){if(utils[_0x2066('0x7f')](_0x275723)){emit(util[_0x2066('0x80')]('campaign:ivr:%s',_0x275723[_0x2066('0x60')]),_0x2066('0x81'),_0x275723);}}function loggerCatchQueueSummary(_0x52ee4e,_0x51db08){return function(_0x356f7d){clearPredictiveAttributes(_0x51db08);emitCampaignSummary(_0x51db08);loggerSyncQueueSummary[_0x2066('0x41')](_0x52ee4e,util['inspect'](_0x356f7d,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x339450){if(_0x339450[_0x2066('0x82')]){if(_0x339450[_0x2066('0x83')]===0x0){_0x339450[_0x2066('0x82')]=![];_0x339450['message']=utils[_0x2066('0x6a')]['INACTIVE'];loggerSyncQueueSummary[_0x2066('0x41')](_0x2066('0x84'),_0x339450[_0x2066('0x60')],_0x2066('0x85'));}else{_0x339450[_0x2066('0x70')]=utils[_0x2066('0x6a')]['DISACTIVED'];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x339450[_0x2066('0x60')],_0x2066('0x86'));}emitCampaignSummary(_0x339450);}}function myreject(_0x344d63){return function(_0x20af3a){return _0x344d63(msgResponse(_0x2066('0x87'),_0x2066('0x88'),JSON[_0x2066('0x76')](_0x20af3a)));};}Dialer['prototype'][_0x2066('0x89')]=function(_0x1e3f24){return!_[_0x2066('0x3f')](_0x1e3f24)&&_0x1e3f24&&!_['isUndefined'](_0x1e3f24[_0x2066('0x60')])&&!_[_0x2066('0x3f')](_0x1e3f24['active'])&&_0x1e3f24['active']&&(this[_0x2066('0x25')][util['format'](_0x2066('0x8a'),_0x1e3f24[_0x2066('0x60')])]['status']===_0x2066('0x8b')||this['trunks'][util[_0x2066('0x80')](_0x2066('0x8a'),_0x1e3f24[_0x2066('0x60')])][_0x2066('0x8c')]===_0x2066('0x8d'));};Dialer[_0x2066('0x1e')][_0x2066('0x8e')]=function(_0x256ffe){var _0x466a1b=this;return function(){if(!_0x466a1b['isTrunkReachable'](_0x256ffe[_0x2066('0x8f')])){if(!_0x466a1b[_0x2066('0x89')](_0x256ffe['TrunkBackup'])){_0x256ffe[_0x2066('0x70')]=utils[_0x2066('0x6a')][_0x2066('0x90')];throw _0x256ffe[_0x2066('0x60')]+_0x2066('0x91');}}};};Dialer[_0x2066('0x1e')][_0x2066('0x92')]=function(_0x276cce,_0x5a0a2c,_0x4b99f0,_0x2e149b){var _0x38049f=this;return function(){var _0x1ed4d5=!![];return _0x38049f[_0x2066('0x93')](_0x276cce,_0x5a0a2c,_0x4b99f0,_0x2e149b,_0x1ed4d5);};};Dialer[_0x2066('0x1e')]['checkIfTimeIntervals']=function(_0x4d591c,_0x11a0e0,_0x43a6dd,_0x793b3e){var _0xd4b045=this;return function(){var _0x4a8653=![];return _0xd4b045[_0x2066('0x93')](_0x4d591c[_0x2066('0x79')],_0x11a0e0,_0x43a6dd,_0x793b3e,_0x4a8653);};};Dialer['prototype'][_0x2066('0x93')]=function(_0x4558f9,_0x4a9e98,_0x41aa10,_0x2e4b15,_0xa78c3a){var _0x24ed5c=[];return new Promise(function(_0x24be6c,_0x10373d){if(!isNotNull(_0x4558f9)){_0x2e4b15[_0x2066('0x70')]=utils[_0x2066('0x6a')]['NULL_INTERVAL'];return _0x10373d(msgResponse(_0x2066('0x94'),_0x2066('0x95'),_0x41aa10+_0x2066('0x96')));}if(_['isEmpty'](_0x4558f9)){_0x2e4b15[_0x2066('0x70')]=utils[_0x2066('0x6a')][_0x2066('0x97')];return _0x10373d(msgResponse(_0x2066('0x94'),_0x2066('0x95'),_0x41aa10+'\x20Intervals\x20is\x20empty\x20'));}if(_0x4a9e98&&_[_0x2066('0x3f')](config[_0x2066('0x98')][_0x4a9e98])){_0x2e4b15[_0x2066('0x70')]=utils[_0x2066('0x6a')][_0x2066('0x99')];return _0x10373d(msgResponse('ifTime','Failure',_0x41aa10+_0x2066('0x9a')+_0x4a9e98));}if(_[_0x2066('0x9b')](_0x4558f9)){for(var _0x3beac3=0x0;_0x3beac3<_0x4558f9[_0x2066('0x9c')];_0x3beac3+=0x1){_0x24ed5c[_0x2066('0x9d')](ami[_0x2066('0x9e')]({'action':'command','command':util[_0x2066('0x80')]('iftime\x20%s,%s',_0x4558f9[_0x3beac3][_0x2066('0x9f')],!_[_0x2066('0x3f')](config['timezones'][_0x4a9e98])?_0x4a9e98:'')})[_0x2066('0x3d')](function(_0x5ed332){return _0x5ed332[_0x2066('0xa0')]['indexOf'](_0x2066('0xa1'))>=0x0;})[_0x2066('0xa2')](myreject(_0x10373d)));}}else{_0x24ed5c[_0x2066('0x9d')](ami[_0x2066('0x9e')]({'action':'command','command':util[_0x2066('0x80')](_0x2066('0xa3'),_0x4558f9,!_[_0x2066('0x3f')](config[_0x2066('0x98')][_0x4a9e98])?_0x4a9e98:'')})['then'](function(_0x54c6dd){return _0x54c6dd[_0x2066('0xa0')]['indexOf']('true')>=0x0;})[_0x2066('0xa2')](myreject(_0x10373d)));}Promise['all'](_0x24ed5c)['then'](function(_0x2ea464){var _0x18827d=_['some'](_0x2ea464);if(_0x18827d){return _0x24be6c(_0x18827d);}else{_0x2e4b15[_0x2066('0x70')]=_0xa78c3a?utils[_0x2066('0x6a')][_0x2066('0xa4')]:utils[_0x2066('0x6a')][_0x2066('0xa5')];return _0x10373d(msgResponse(_0x2066('0xa6'),_0x2066('0x95'),'Global:\x20'+_0xa78c3a+'\x20'+_0x41aa10+_0x2066('0xa7')+util[_0x2066('0x43')](_0x4558f9,{'showHidden':![],'depth':null})+_0x2066('0xa8')+_0x4a9e98));}})[_0x2066('0xa2')](function(_0x219136){return _0x10373d(msgResponse(_0x2066('0x94'),_0x2066('0x95'),JSON[_0x2066('0x76')](_0x219136)));});});};Dialer[_0x2066('0x1e')][_0x2066('0xa9')]=function(){var _0x488019=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0x2066('0x3d')](function(){setInterval(function(){_0x488019[_0x2066('0xaa')]();},0x3e8);});};Dialer[_0x2066('0x1e')][_0x2066('0xaa')]=function(){var _0x4d5e53=this;var _0x2d1283;for(var _0x16d912 in this['campaigns']){if(typeof this[_0x2066('0x23')][_0x16d912]!==_0x2066('0xab')){_0x2d1283=this[_0x2066('0x23')][_0x16d912];if(utils['isIVRCampaign'](_0x2d1283)&&utils['isIVRCampaignActive'](_0x2d1283)){_0x2d1283[_0x2066('0x82')]=!![];Promise['resolve']()[_0x2066('0x3d')](checkIsIVRCampaignActive(_0x2d1283))['then'](checkInterval(_0x2d1283))[_0x2066('0x3d')](_0x4d5e53['checkIsTrunkReachable'](_0x2d1283))['then'](_0x4d5e53[_0x2066('0x92')](_0x2d1283[_0x2066('0xac')],_0x2d1283[_0x2066('0xad')],_0x2d1283['name'],_0x2d1283))['then'](_0x4d5e53['checkIfTimeIntervals'](_0x2d1283[_0x2066('0x78')],_0x2d1283['dialTimezone'],_0x2d1283['name'],_0x2d1283))[_0x2066('0x3d')](_0x4d5e53[_0x2066('0xae')](_0x2d1283))['catch'](loggerCatchQueueSummary(_0x2066('0xaf'),_0x2d1283));}else{notSendMessagesCampaign(_0x2d1283);}}}};Dialer[_0x2066('0x1e')][_0x2066('0xb0')]=function(_0x588cb5){if(_0x588cb5[_0x2066('0xb1')]!==_0x2066('0xa')){clearPredictiveAttributes(_0x588cb5);}switch(_0x588cb5[_0x2066('0xb1')]){case _0x2066('0xb2'):this[_0x2066('0xb3')](_0x588cb5,0x1);break;case _0x2066('0xb4'):this[_0x2066('0xb3')](_0x588cb5,_0x588cb5['dialPowerLevel']);break;case _0x2066('0xa'):this['predictive'](_0x588cb5);break;case _0x2066('0x9'):this[_0x2066('0xb3')](_0x588cb5,0x1);break;default:logger['error'](_0x2066('0xb5'),_0x588cb5[_0x2066('0x60')],'method\x20not\x20recognized');}};Dialer[_0x2066('0x1e')]['ifTime']=function(_0x166eb4,_0x51f560){var _0x49afe4=_0x166eb4['dialTimezone'];var _0x432fea=_0x51f560?_0x166eb4['dialGlobalInterval']:_0x166eb4[_0x2066('0x78')][_0x2066('0x79')];logger['silly'](_0x2066('0xb6'),_0x432fea,_0x49afe4,_0x166eb4[_0x2066('0x60')],util[_0x2066('0x80')](_0x2066('0xb7'),_0x166eb4['name'],_0x166eb4['id']));var _0x52e394=null;return Interval[_0x2066('0xb8')](_0x432fea,_0x49afe4)[_0x2066('0x3d')](function(_0x49f884){if(_0x49f884===!![]){return _0x49f884;}else{_0x166eb4[_0x2066('0x70')]=_0x51f560?utils[_0x2066('0x6a')][_0x2066('0xa4')]:utils[_0x2066('0x6a')][_0x2066('0xa5')];_0x52e394=msgResponse(_0x2066('0xa6'),_0x2066('0x95'),_0x2066('0xb9')+_0x51f560+'\x20'+_0x166eb4['name']+_0x2066('0xa7')+util[_0x2066('0x43')](_0x432fea,{'showHidden':![],'depth':null})+_0x2066('0xa8')+_0x49afe4);}if(_0x52e394!==null){logger[_0x2066('0xba')](_0x2066('0xbb'),_0x52e394);_0x52e394['isGlobal']=_0x51f560;throw _0x52e394;}})[_0x2066('0xa2')](function(_0x54c150){logger[_0x2066('0x65')](_0x2066('0xbc'),_0x54c150);throw msgResponse(_0x2066('0x87'),_0x2066('0x88'),util[_0x2066('0x43')](_0x54c150,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x19139d){if(this[_0x2066('0x22')][_0x19139d[_0x2066('0xbd')]]){if(this[_0x2066('0x27')][_0x19139d[_0x2066('0xbe')]]&&this[_0x2066('0x27')][_0x19139d[_0x2066('0xbe')]][_0x2066('0xbf')]!=='ivr'){this['updateOriginated'](this[_0x2066('0x22')][_0x19139d[_0x2066('0xbd')]]);this[_0x2066('0x27')][_0x19139d[_0x2066('0xbe')]]['answertime']=moment()['format'](_0x2066('0xc0'));}}};Dialer[_0x2066('0x1e')]['syncAgentComplete']=function(_0x24434b){var _0x1033cb=this[_0x2066('0x27')][_0x24434b[_0x2066('0xbe')]];if(this['voiceQueues'][_0x24434b['queue']]){if(_0x1033cb&&_0x1033cb[_0x2066('0xbf')]!==_0x2066('0xc1')){delete this[_0x2066('0x27')][_0x24434b[_0x2066('0xbe')]];this['voiceQueues'][_0x24434b[_0x2066('0xbd')]][_0x2066('0xc2')]+=0x1;var _0x169d41=new AgentComplete(_0x1033cb,_0x24434b);if(_0x24434b['reason']===_0x2066('0xc3')){_0x169d41[_0x2066('0xc4')]=this[_0x2066('0x22')][_0x24434b['queue']][_0x2066('0xc5')]&&this[_0x2066('0x22')][_0x24434b[_0x2066('0xbd')]]['dialAgiAfterHangupAgent']?moment()[_0x2066('0x80')](_0x2066('0xc0')):undefined;}hopperUtils[_0x2066('0xc6')](_0x169d41)[_0x2066('0xa2')](loggerCatch(_0x2066('0xc7')));hopperUtils[_0x2066('0xc8')](_0x169d41)['catch'](loggerCatch(_0x2066('0xc9')));}}};Dialer[_0x2066('0x1e')][_0x2066('0x2d')]=function(_0x1c39df){var _0xb98673=this['uniqueId'][_0x1c39df[_0x2066('0xbe')]];var _0x533c87=this;var _0x1a0ecb=![];var _0xe733e1;var _0x1ddaee;if(this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]]){if(_0xb98673&&_0xb98673['type']!==_0x2066('0xc1')){delete this[_0x2066('0x27')][_0x1c39df['uniqueid']];this['updateOriginated'](this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]]);_0xb98673[_0x2066('0xca')]=moment()['format'](_0x2066('0xc0'));var _0x4b8735=new QueueCallerAbandon(_0xb98673,_0x1c39df);if(utils['getSeconds'](_0xb98673[_0x2066('0xca')],_0xb98673[_0x2066('0xcb')])>=_0xb98673['dialQueueTimeout']){this['voiceQueues'][_0x1c39df[_0x2066('0xbd')]][_0x2066('0x4a')]+=0x1;this['voiceQueues'][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xcc')]+=0x1;this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x4b8735[_0x2066('0xcd')]=0xa;_0x4b8735[_0x2066('0xce')]='Drop';_0x4b8735[_0x2066('0xcf')]=_0x2066('0xd0');_0x4b8735[_0x2066('0xc4')]=this['voiceQueues'][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xc5')]?moment()[_0x2066('0x80')](_0x2066('0xc0')):undefined;_0x4b8735[_0x2066('0xd1')]+=0x1;_0x4b8735[_0x2066('0xd2')]+=0x1;_0xe733e1=this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xd3')];_0x1ddaee=this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x2066('0xd4')](_0x4b8735,_0x4b8735[_0x2066('0xcd')],_0xb98673[_0x2066('0xd5')])[_0x2066('0x3d')](function(_0x1b8c0b){_0x1a0ecb=_0x1b8c0b[_0x2066('0xd6')]==0x1;if(_0x4b8735[_0x2066('0xd1')]>=_0x533c87[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xd7')]){_0x533c87['queueCallerAbandonCreateState'](_0x4b8735,_0x1b8c0b['additional']);}else{hopperUtils[_0x2066('0xd8')]({'active':![],'countdropretry':_0x4b8735['countdropretry'],'scheduledat':moment()['add'](_0x533c87[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xd3')],'minutes')[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0xb98673[_0x2066('0xd9')],'ListId':_0xb98673[_0x2066('0xda')],'VoiceQueueId':_0xb98673[_0x2066('0xdb')]||undefined,'CampaignId':_0xb98673[_0x2066('0xdc')]||undefined})['catch'](loggerCatch(_0x2066('0xdd')));var _0x6098d8=new History(_0x4b8735);_0x6098d8['state']=0xa;_0x6098d8['statedesc']=_0x2066('0xde');_0x6098d8['starttime']=moment()['format'](_0x2066('0xc0'));_0x6098d8[_0x2066('0x71')]=_0x6098d8[_0x2066('0x72')];_0x6098d8[_0x2066('0xdf')]=_0x4b8735[_0x2066('0xdf')];_0x6098d8['calleridnum']=_0x4b8735[_0x2066('0xe0')];hopperUtils['createHistory'](_0x6098d8)[_0x2066('0xa2')](loggerCatch(_0x2066('0xe1')));}})[_0x2066('0x3d')](function(){if(_0x1a0ecb)hopperUtils['swapAdditionalPhones'](_0x4b8735,_0xe733e1,_0x1ddaee)[_0x2066('0x3d')](function(){return 0x1;});});}else{this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]][_0x2066('0x4c')]+=0x1;this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xe2')]+=0x1;_0x4b8735[_0x2066('0xcd')]=0xb;_0x4b8735['statedesc']='Abandoned';_0x4b8735[_0x2066('0xcf')]=_0x2066('0xe3');_0x4b8735['countabandonedretry']+=0x1;_0x4b8735['countglobal']+=0x1;_0xe733e1=this[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]]['dialAbandonedRetryFrequency'];_0x1ddaee=this['voiceQueues'][_0x1c39df[_0x2066('0xbd')]][_0x2066('0xe4')];hopperUtils[_0x2066('0xd4')](_0x4b8735,_0x4b8735[_0x2066('0xcd')],_0xb98673[_0x2066('0xd5')])[_0x2066('0x3d')](function(_0x27ea1f){if(_0x4b8735[_0x2066('0xe5')]>=_0x533c87[_0x2066('0x22')][_0x1c39df[_0x2066('0xbd')]]['dialAbandonedMaxRetry']){_0x533c87['queueCallerAbandonCreateState'](_0x4b8735,_0x27ea1f['additional']);}else{hopperUtils[_0x2066('0xd8')]({'active':![],'countabandonedretry':_0x4b8735['countabandonedretry'],'scheduledat':moment()[_0x2066('0xe6')](_0x533c87['voiceQueues'][_0x1c39df['queue']][_0x2066('0xe7')],_0x2066('0xe8'))[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0xb98673['ContactId'],'ListId':_0xb98673[_0x2066('0xda')],'VoiceQueueId':_0xb98673[_0x2066('0xdb')]||undefined,'CampaignId':_0xb98673[_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0xe9')));var _0x108ca0=new History(_0x4b8735);_0x108ca0[_0x2066('0xcd')]=0xb;_0x108ca0[_0x2066('0xce')]='Abandoned';_0x108ca0[_0x2066('0x72')]=moment()[_0x2066('0x80')](_0x2066('0xc0'));_0x108ca0[_0x2066('0x71')]=_0x108ca0[_0x2066('0x72')];_0x108ca0[_0x2066('0xdf')]=_0x4b8735['calleridname'];_0x108ca0['calleridnum']=_0x4b8735[_0x2066('0xe0')];hopperUtils['createHistory'](_0x108ca0)[_0x2066('0xa2')](loggerCatch(_0x2066('0xea')));}})[_0x2066('0x3d')](function(){if(_0x1a0ecb)hopperUtils[_0x2066('0xeb')](_0x4b8735,_0xe733e1,_0x1ddaee)['then'](function(){return 0x1;});});}}}};Dialer[_0x2066('0x1e')][_0x2066('0x36')]=function(_0x3f1208){if(this[_0x2066('0x26')][_0x3f1208[_0x2066('0xbe')]]){this['actions'][_0x3f1208[_0x2066('0xbe')]][_0x2066('0xec')]=_0x3f1208[_0x2066('0xec')];}if(this['uniqueId'][_0x3f1208[_0x2066('0xbe')]]){this[_0x2066('0x27')][_0x3f1208['uniqueid']]['channel']=_0x3f1208[_0x2066('0xec')];}};Dialer[_0x2066('0x1e')][_0x2066('0x38')]=function(_0x38441a){if(!this['actions'][_0x38441a['actionid']]){return;}var _0x75d989=this['voiceQueues'][this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]]['queue']][_0x2066('0xee')]||_0x2066('0xef');if(_0x75d989===_0x2066('0xf0')){if(this['actions'][_0x38441a[_0x2066('0xed')]]&&_[_0x2066('0xf1')](this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]][_0x2066('0xf2')])&&_0x38441a[_0x2066('0x8c')]==='1'&&_0x38441a[_0x2066('0xf3')]==='0'){if(this[_0x2066('0x24')][_0x38441a['stateinterface']]){if(!this['agents'][_0x38441a[_0x2066('0xf4')]][_0x2066('0xf2')]){this[_0x2066('0x24')][_0x38441a[_0x2066('0xf4')]]['locked']=!![];this['actions'][_0x38441a[_0x2066('0xed')]][_0x2066('0xf2')]=!![];this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]][_0x2066('0xf4')]=_0x38441a[_0x2066('0xf4')];}}}}else if(_0x75d989==='rrmemory'){if(this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]]){if(this['agents'][_0x38441a[_0x2066('0xf4')]]){this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]][_0x2066('0xf4')]=_0x38441a[_0x2066('0xf4')];if(_[_0x2066('0xf1')](this[_0x2066('0xf5')][this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]]['queue']])){this[_0x2066('0xf5')][this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]][_0x2066('0xbd')]]=[];}this[_0x2066('0xf5')][this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]][_0x2066('0xbd')]]['push'](_[_0x2066('0x5d')](_[_0x2066('0x77')](this[_0x2066('0x26')][_0x38441a[_0x2066('0xed')]],['idHopper',_0x2066('0xf4')]),{'status':_0x38441a[_0x2066('0x8c')],'paused':_0x38441a[_0x2066('0xf3')]}));}}}};Dialer[_0x2066('0x1e')]['syncQueueStatusComplete']=function(_0x3839a6){if(!this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]]){return;}var _0x1ecc2c=this;var _0x42bf56=this[_0x2066('0x22')][this[_0x2066('0x26')][_0x3839a6['actionid']][_0x2066('0xbd')]];var _0x13fb0d=_0x42bf56[_0x2066('0xee')]||_0x2066('0xef');if(_0x13fb0d===_0x2066('0xf0')){if(this[_0x2066('0x26')][_0x3839a6['actionid']]&&this['actions'][_0x3839a6['actionid']][_0x2066('0xf4')]){this[_0x2066('0xf6')][_0x2066('0xf7')](this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xf8')],this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xf4')])['catch'](function(_0x568a95){logger[_0x2066('0x65')](_0x2066('0xf9'),util['inspect'](_0x568a95,{'showHidden':![],'depth':null}));})[_0x2066('0x21')](function(){_0x1ecc2c[_0x2066('0xfa')](_0x1ecc2c[_0x2066('0x22')][_0x1ecc2c['actions'][_0x3839a6['actionid']][_0x2066('0xbd')]]);_0x1ecc2c[_0x2066('0x24')][_0x1ecc2c[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xf4')]][_0x2066('0xf2')]=![];delete _0x1ecc2c['actions'][_0x3839a6['actionid']];unlockQueueStatus(_0x42bf56);});}else{this[_0x2066('0xfa')](this['voiceQueues'][this['actions'][_0x3839a6['actionid']][_0x2066('0xbd')]]);hopperUtils[_0x2066('0xd8')]({'active':![],'ContactId':this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xd9')],'ListId':this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xda')],'VoiceQueueId':this[_0x2066('0x26')][_0x3839a6['actionid']][_0x2066('0xdb')]||undefined,'CampaignId':this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0xfb')));delete this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]];unlockQueueStatus(_0x42bf56);}}else if(_0x13fb0d===_0x2066('0xef')){var _0x3c0816;if(this['actions'][_0x3839a6[_0x2066('0xed')]]&&!_[_0x2066('0x7c')](this[_0x2066('0xf5')][this['actions'][_0x3839a6[_0x2066('0xed')]][_0x2066('0xbd')]])){if(this['queueBookedRR'][_0x1ecc2c[_0x2066('0x26')][_0x3839a6['actionid']]['queue']]){this[_0x2066('0x28')][_0x1ecc2c[_0x2066('0x26')][_0x3839a6['actionid']][_0x2066('0xbd')]]=this['queueBookedRR'][this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xbd')]]?this[_0x2066('0x28')][this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xbd')]]:this['queueBooked'][this[_0x2066('0x26')][_0x3839a6['actionid']][_0x2066('0xbd')]]?this[_0x2066('0xf5')][this[_0x2066('0x26')][_0x3839a6['actionid']]['queue']][_0x2066('0xfc')]||0x0:0x0;}this[_0x2066('0xf5')][this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xbd')]]['_rr']=this[_0x2066('0x28')][this[_0x2066('0x26')][_0x3839a6[_0x2066('0xed')]][_0x2066('0xbd')]];for(var _0xa1d5de=0x0;_0xa1d5de=_0x44a223[_0x2066('0x121')]){_0x2e953d[_0x2066('0x122')](_0x15b5bd,_0x213618,_0x1ed2e8,'reason19\x20machine....');}else{if(_0x15b5bd[_0x2066('0x11b')]>=_0x44a223[_0x2066('0x123')]){_0x2e953d[_0x2066('0x124')](_0x15b5bd,_0x213618,_0x1ed2e8,_0x2066('0x125'));}else{hopperUtils[_0x2066('0xd8')]({'active':![],'countmachineretry':_0x15b5bd[_0x2066('0x11b')],'scheduledat':moment()[_0x2066('0xe6')](_0x44a223[_0x2066('0x126')],_0x2066('0xe8'))['format'](_0x2066('0xc0')),'ContactId':_0x15b5bd['ContactId'],'ListId':_0x15b5bd[_0x2066('0xda')],'VoiceQueueId':_0x15b5bd['VoiceQueueId']||undefined,'CampaignId':_0x15b5bd[_0x2066('0xdc')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x213618({'reschedule':0x1});}}});}if(_0x13346f[_0x2066('0xbf')]===_0x2066('0xc1')&&this[_0x2066('0x23')][_0x13346f[_0x2066('0xbd')]][_0x2066('0x10c')]&&_0x21ccd4['value']===_0x2066('0x10e')){delete this['uniqueId'][_0x21ccd4[_0x2066('0xbe')]];this['updateOriginated'](this[_0x2066('0x23')][_0x13346f['queue']]);_0x3eed3d=new Hangup(_0x13346f,_0x21ccd4);_0x3eed3d[_0x2066('0xcd')]=0x12;_0x3eed3d[_0x2066('0xce')]=_0x2066('0x110');_0x3eed3d[_0x2066('0x111')]=_0x2066('0x112');ami['emit'](_0x2066('0x114'),ut['buildObj'](_0x3eed3d,_0x2066('0x116')));this[_0x2066('0x117')](_0x3eed3d,_0x2066('0x127'),'[syncHangupInAMDIvr]');}if(_0x13346f[_0x2066('0xbf')]===_0x2066('0xc1')&&this[_0x2066('0x23')][_0x13346f[_0x2066('0xbd')]][_0x2066('0x10c')]&&_0x21ccd4[_0x2066('0x10d')]===_0x2066('0x11a')){return new Promise(function(_0x49d557,_0x49e6c8){delete _0x2e953d[_0x2066('0x27')][_0x21ccd4[_0x2066('0xbe')]];_0x2e953d[_0x2066('0xfa')](_0x2e953d[_0x2066('0x23')][_0x13346f['queue']]);_0x2e953d[_0x2066('0x23')][_0x13346f['queue']]['outboundAnswerCallsDay']+=0x1;_0x2e953d['campaigns'][_0x13346f[_0x2066('0xbd')]][_0x2066('0x10f')]+=0x1;var _0x541530=_0x2e953d[_0x2066('0x23')][_0x13346f[_0x2066('0xbd')]];var _0x4ee7f5=new Hangup(_0x13346f,_0x21ccd4);_0x4ee7f5['state']=0x13;_0x4ee7f5['statedesc']='Machine';_0x4ee7f5[_0x2066('0x111')]='AMD';_0x4ee7f5[_0x2066('0x11b')]+=0x1;_0x4ee7f5[_0x2066('0xd2')]+=0x1;_0x4ee7f5['amd']=!![];ami[_0x2066('0x113')](_0x2066('0x114'),ut[_0x2066('0x115')](_0x4ee7f5,'amd'));hopperUtils[_0x2066('0xc6')](_0x4ee7f5)[_0x2066('0xa2')](loggerCatch(_0x2066('0x11c')));if(_0x4ee7f5[_0x2066('0x128')]+_0x4ee7f5[_0x2066('0x11d')]+_0x4ee7f5['countnoanswerretry']+_0x4ee7f5['countnosuchnumberretry']+_0x4ee7f5[_0x2066('0xd1')]+_0x4ee7f5[_0x2066('0xe5')]+_0x4ee7f5['countmachineretry']+_0x4ee7f5[_0x2066('0x120')]>=_0x541530['dialGlobalMaxRetry']){_0x2e953d[_0x2066('0x122')](_0x4ee7f5,_0x49d557,_0x49e6c8,_0x2066('0x129'));}else{if(_0x4ee7f5[_0x2066('0x11b')]>=_0x541530[_0x2066('0x123')]){_0x2e953d['createStateFinal'](_0x4ee7f5,_0x49d557,_0x49e6c8,'reason\x2019\x20machine....');}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x4ee7f5[_0x2066('0x11b')],'scheduledat':moment()[_0x2066('0xe6')](_0x541530['dialMachineRetryFrequency'],'minutes')[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x4ee7f5['ContactId'],'ListId':_0x4ee7f5['ListId'],'VoiceQueueId':_0x4ee7f5[_0x2066('0xdb')]||undefined,'CampaignId':_0x4ee7f5['CampaignId']||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0x12a')));_0x49d557({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x2066('0x34')]=function(_0x107ee6){var _0x4ea218=this[_0x2066('0x27')][_0x107ee6[_0x2066('0xbe')]];var _0x2e3aec;if(_0x4ea218&&_0x4ea218['type']===_0x2066('0xc1')){delete this['uniqueId'][_0x107ee6['uniqueid']];this[_0x2066('0xfa')](this[_0x2066('0x23')][_0x4ea218['queue']]);this['campaigns'][_0x4ea218[_0x2066('0xbd')]]['ivrAnswerCallsDay']+=0x1;_0x2e3aec=new Hangup(_0x4ea218,_0x107ee6);hopperUtils[_0x2066('0xc6')](_0x2e3aec)[_0x2066('0xa2')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2e3aec)['catch'](loggerCatch(_0x2066('0x12b')));}if(_0x4ea218&&_0x4ea218[_0x2066('0xbf')]!==_0x2066('0xc1')&&isNotNull(this['voiceQueues'][_0x4ea218[_0x2066('0xbd')]][_0x2066('0x12c')])){delete this[_0x2066('0x27')][_0x107ee6[_0x2066('0xbe')]];this[_0x2066('0xfa')](this[_0x2066('0x22')][_0x4ea218['queue']]);this[_0x2066('0x22')][_0x4ea218['queue']][_0x2066('0xc2')]+=0x1;this[_0x2066('0x22')][_0x4ea218['queue']][_0x2066('0x10f')]+=0x1;_0x2e3aec=new Hangup(_0x4ea218,_0x107ee6);_0x2e3aec[_0x2066('0xcd')]=0x10;_0x2e3aec[_0x2066('0xce')]=_0x2066('0x12d');_0x2e3aec[_0x2066('0x111')]=_0x2066('0x12e');hopperUtils[_0x2066('0xc6')](_0x2e3aec)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x2e3aec)[_0x2066('0xa2')](loggerCatch('[syncHangupIvr]'));}if(_0x4ea218&&_0x4ea218['type']!==_0x2066('0xc1')&&!isNotNull(this[_0x2066('0x22')][_0x4ea218['queue']][_0x2066('0x12c')])){if(_0x107ee6['cause-txt']==='Normal\x20Clearing'){delete this[_0x2066('0x27')][_0x107ee6[_0x2066('0xbe')]];this['voiceQueues'][_0x4ea218['queue']][_0x2066('0xc2')]+=0x1;const _0x26ffa2=new AgentComplete(_0x4ea218,_0x107ee6);_0x26ffa2[_0x2066('0xdc')]=this[_0x2066('0x22')][_0x4ea218[_0x2066('0xbd')]]['id'];hopperUtils[_0x2066('0xc6')](_0x26ffa2)[_0x2066('0xa2')](loggerCatch(_0x2066('0xc7')));hopperUtils[_0x2066('0xc8')](_0x26ffa2)[_0x2066('0xa2')](loggerCatch(_0x2066('0xc9')));}else{delete this[_0x2066('0x27')][_0x107ee6['uniqueid']];this[_0x2066('0xfa')](this[_0x2066('0x22')][_0x4ea218[_0x2066('0xbd')]]);this[_0x2066('0x22')][_0x4ea218[_0x2066('0xbd')]][_0x2066('0x12f')]+=0x1;_0x2e3aec=new Hangup(_0x4ea218,_0x107ee6);_0x2e3aec['state']=0xc;_0x2e3aec['statedesc']=_0x107ee6[_0x2066('0x130')];_0x2e3aec['membername']='Unknow';hopperUtils[_0x2066('0xc6')](_0x2e3aec)[_0x2066('0xa2')](loggerCatch(_0x2066('0x131')));hopperUtils['moveContactManagedDialer'](_0x2e3aec)[_0x2066('0xa2')](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0x2066('0x1e')][_0x2066('0xc')]=function(_0xa36d7f){var _0x79bfb1=this;if(!_0x79bfb1[_0x2066('0x132')][_0xa36d7f['name']]){_0x79bfb1['queuesSummary'][_0xa36d7f[_0x2066('0x60')]]={'running':![]};}else if(_0x79bfb1[_0x2066('0x132')][_0xa36d7f['name']][_0x2066('0x133')]===!![]){return;}else if(_0x79bfb1[_0x2066('0x132')][_0xa36d7f[_0x2066('0x60')]][_0x2066('0x133')]===![]){_0x79bfb1[_0x2066('0x132')][_0xa36d7f[_0x2066('0x60')]]['running']=!![];}var _0x4c84d3=_0x79bfb1['voiceQueues'][_0xa36d7f[_0x2066('0x60')]];var _0x2b944d=_0x4c84d3[_0x2066('0x70')]!==utils[_0x2066('0x6a')][_0x2066('0x134')];var _0x459a57=utils['isPreviewCampaign'](_0x4c84d3);_0x4c84d3[_0x2066('0x135')]=utils[_0x2066('0x136')](_0x4c84d3,_0x79bfb1[_0x2066('0x25')]);Promise['resolve']()[_0x2066('0x3d')](function(){if(_0x4c84d3['statusMessage']===utils[_0x2066('0x6a')][_0x2066('0x134')]){if(_0x2b944d){clearPredictiveAttributes(_0x4c84d3);_0xa36d7f[_0x2066('0x62')]=undefined;_0xa36d7f['startProgressive']=undefined;}if(_0x4c84d3[_0x2066('0x135')]===utils[_0x2066('0x6a')][_0x2066('0x134')]){_0xa36d7f[_0x2066('0x137')]=0x0;_0xa36d7f[_0x2066('0xf3')]=0x0;_0xa36d7f[_0x2066('0x138')]=0x0;_0xa36d7f[_0x2066('0x139')]=0x0;_0xa36d7f[_0x2066('0x13a')]=0x0;}}else if(_0x4c84d3['statusMessage']===utils[_0x2066('0x6a')][_0x2066('0x13b')]&&!_0x459a57){return _0x79bfb1[_0x2066('0x94')](_0x4c84d3,!![])[_0x2066('0x3d')](function(){return _0x79bfb1['ifTime'](_0x4c84d3,![]);})[_0x2066('0x3d')](function(){return _0x79bfb1['checkDialMethod'](_0x4c84d3);})[_0x2066('0xa2')](function(_0xb2b42f){loggerSyncQueueSummary[_0x2066('0x41')](_0x2066('0x13c'),util[_0x2066('0x43')](_0xb2b42f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x4c84d3);});}else{clearPredictiveAttributes(_0x4c84d3);}})['then'](function(){var _0x298036=_0xa36d7f[_0x2066('0x13d')](_0x4c84d3);if(_0x298036||_0x4c84d3['queueSummaryCountersUpdated']){_0x4c84d3[_0x2066('0x13e')]=![];_0xa36d7f['updateReportFromOutboundQueue'](_0x4c84d3);Object[_0x2066('0x13f')](_0x4c84d3,_0xa36d7f);emitOutboundVoiceQueueSummary(_0xa36d7f);}_0x79bfb1[_0x2066('0x132')][_0x4c84d3['name']][_0x2066('0x133')]=![];})[_0x2066('0xa2')](function(_0x54f510){logger[_0x2066('0x65')](_0x2066('0x13c'),util['inspect'](_0x54f510,{'showHidden':![],'depth':null}));_0x79bfb1[_0x2066('0x132')][_0x4c84d3[_0x2066('0x60')]]['running']=![];});};Dialer['prototype']['syncQueueSummaryComplete']=_[_0x2066('0x140')](function(){var _0x205227=_[_0x2066('0x141')](this[_0x2066('0x22')],function(_0x1ceb37){return _0x1ceb37[_0x2066('0x142')];});var _0x562765=_[_0x2066('0x141')](this[_0x2066('0x24')],function(_0xdb7fc9){return _0xdb7fc9[_0x2066('0x143')]&&_0xdb7fc9['status']===_0x2066('0x8b');});if(_0x205227[_0x2066('0x9c')]>0x0&&_0x562765['length']>0x0){return Promise[_0x2066('0x144')]()[_0x2066('0x3d')](cmHopper[_0x2066('0x145')](_[_0x2066('0x146')](_0x205227,'id'),previewRecallmeReminderInterval,_['map'](_0x562765,'id')))[_0x2066('0x3d')](function(_0x2ec00b){for(var _0x18175e=0x0;_0x18175e<_0x2ec00b[_0x2066('0x9c')];_0x18175e++){var _0x3ea4ea=_0x2ec00b[_0x18175e]['Agent'][_0x2066('0x60')];if(_0x3ea4ea)io['to'](util['format']('user:%s',_0x3ea4ea))[_0x2066('0x113')](_0x2066('0x147'),{'hopper':_0x2ec00b[_0x18175e]});}})[_0x2066('0xa2')](function(_0x390947){logger[_0x2066('0x65')]('checkPreviewRecallReminder',_0x390947);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x2066('0x1e')][_0x2066('0x3b')]=function(){var _0x4c30ff=this;setInterval(function(){_0x4c30ff[_0x2066('0x148')](_0x4c30ff[_0x2066('0x27')],_0x2066('0x149'));_0x4c30ff['clearZombieChannels'](_0x4c30ff['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0x2066('0x148')]=function(_0x1e08eb,_0xa1ea0b){var _0x1ab7bb=this;for(var _0x196da4 in _0x1e08eb){if(typeof _0x1e08eb[_0x196da4]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x2066('0xf1')](_0x1e08eb[_0x196da4])){return ami[_0x2066('0x9e')]({'action':_0x2066('0x8c'),'channel':_0x1e08eb[_0x196da4][_0x2066('0xec')]})[_0x2066('0xa2')](function(_0xe091d7){if(_0xe091d7[_0x2066('0x70')]===_0x2066('0x14a')){setTimeout(function(){if(_0x1e08eb[_0x196da4]&&_0x1e08eb[_0x196da4][_0x2066('0xbf')]!=='ivr'){_0x1ab7bb[_0x2066('0xfa')](_0x1ab7bb[_0x2066('0x22')][_0x1e08eb[_0x196da4][_0x2066('0xbd')]]);logger[_0x2066('0x65')](_0x2066('0x14b'),_0xa1ea0b,_0x196da4,_0x1e08eb[_0x196da4][_0x2066('0xbd')]);delete _0x1e08eb[_0x196da4];}if(_0x1e08eb[_0x196da4]&&_0x1e08eb[_0x196da4][_0x2066('0xbf')]===_0x2066('0xc1')){_0x1ab7bb[_0x2066('0xfa')](_0x1ab7bb[_0x2066('0x23')][_0x1e08eb[_0x196da4]['queue']]);logger[_0x2066('0x65')](_0x2066('0x14c'),_0xa1ea0b,_0x196da4,_0x1e08eb[_0x196da4][_0x2066('0xbd')]);delete _0x1e08eb[_0x196da4];}},0x2328);}});}});}}};Dialer[_0x2066('0x1e')]['getVoiceQueueRtPauses']=function(_0x348161){return Promise['resolve']()[_0x2066('0x3d')](voiceQueueRt[_0x2066('0x14d')](_0x348161))[_0x2066('0xa2')](loggerCatch(_0x2066('0x14e')));};Dialer['prototype'][_0x2066('0xfa')]=function(_0x3f8caa){if(!_[_0x2066('0x3f')](_0x3f8caa)&&_0x3f8caa!==null){if(typeof _0x3f8caa['originated']!==_0x2066('0xab')){if(_0x3f8caa['originated']>0x0){_0x3f8caa[_0x2066('0x83')]-=0x1;}else{logger[_0x2066('0x65')](_0x2066('0x14f'));}}}else{logger[_0x2066('0x65')](_0x2066('0x150'));}};Dialer[_0x2066('0x1e')]['loggerHandler']=function(_0x317502,_0x472c2e){var _0x23d30f=this;return function(_0x477676){_0x23d30f[_0x2066('0xfa')](_0x472c2e);logger['error'](_0x317502,util[_0x2066('0x43')](_0x477676,{'showHidden':![],'depth':null}));};};Dialer[_0x2066('0x1e')][_0x2066('0x151')]=function(_0x3e63bc,_0x48fcdd,_0x1d3492){var _0x263bea={'state':0x19,'statedesc':_0x2066('0x152')};this[_0x2066('0xfa')](_0x48fcdd);this[_0x2066('0x117')](_[_0x2066('0x5d')](_0x263bea,_['pick'](_0x1d3492,[_0x2066('0xd9'),_0x2066('0xda'),_0x2066('0x153'),'VoiceQueueId',_0x2066('0xdc')])),_0x2066('0x154'),_0x2066('0x155'));logger[_0x2066('0x65')](_0x3e63bc);};Dialer[_0x2066('0x1e')][_0x2066('0x117')]=function(_0x29f716,_0x4de143,_0x22df22){hopperUtils[_0x2066('0xc6')](_0x29f716)['catch'](loggerCatch(_0x4de143));hopperUtils[_0x2066('0xc8')](_0x29f716)[_0x2066('0xa2')](loggerCatch(_0x22df22));};Dialer[_0x2066('0x1e')][_0x2066('0x156')]=function(_0x16f033,_0x160027){hopperUtils['createHistory'](_0x16f033)[_0x2066('0xa2')](loggerCatch(_0x2066('0xc7')));if(_0x160027==0x0){hopperUtils[_0x2066('0xc8')](_0x16f033)[_0x2066('0xa2')](loggerCatch(_0x2066('0x157')));}};Dialer[_0x2066('0x1e')][_0x2066('0x158')]=function(_0x4ffb63){return Promise[_0x2066('0x144')]()[_0x2066('0x3d')](cmHopper[_0x2066('0x145')](_0x4ffb63['id'],previewRecallmeReminderInterval))[_0x2066('0x3d')](function(_0x5232d5){for(var _0x75047f=0x0;_0x75047f<_0x5232d5[_0x2066('0x9c')];_0x75047f++){var _0x341a32=_0x5232d5[_0x75047f][_0x2066('0x159')][_0x2066('0x60')];if(_0x341a32)io['to'](util[_0x2066('0x80')](_0x2066('0x15a'),_0x341a32))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x5232d5[_0x75047f]});}})[_0x2066('0xa2')](function(){});};Dialer[_0x2066('0x1e')][_0x2066('0xae')]=function(_0x42e850){var _0x3af525=this;return function(){_0x3af525[_0x2066('0x15b')](_0x42e850);};};Dialer[_0x2066('0x1e')][_0x2066('0x15c')]=function(_0x57a0cb,_0x13912a){var _0x5344c4=this;var _0x4e1d2c=uuid['v4']();this[_0x2066('0x26')][_0x4e1d2c]=new Action(_0x57a0cb,_0x13912a,_0x4e1d2c);return new Promise(function(_0x3280d3,_0x5554ab){if(_[_0x2066('0x3f')](_0x57a0cb)&&typeof _0x57a0cb!==_0x2066('0x15d')){return _0x5554ab(msgResponse(_0x2066('0x15e'),_0x2066('0x95'),_0x2066('0x15f')));}if(_['isUndefined'](_0x13912a[_0x2066('0x160')])||_0x13912a[_0x2066('0x160')]===null){return _0x5554ab(msgResponse(_0x2066('0x15e'),_0x2066('0x95'),_0x2066('0x161')));}var _0x59fb63={'XMD-CALLERID':_0x5344c4[_0x2066('0x26')][_0x4e1d2c]['getCaller'](),'XMD-AGI':_0x57a0cb[_0x2066('0x12c')]?util[_0x2066('0x80')]('\x22agi://%s/square,%s\x22',ipAgi,_0x57a0cb[_0x2066('0x12c')]):_0x2066('0x162'),'XMD-AGIAFTER':_0x57a0cb[_0x2066('0xc5')]?util[_0x2066('0x80')](_0x2066('0x163'),ipAgi,_0x57a0cb[_0x2066('0xc5')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x57a0cb)?util['format'](_0x2066('0x164'),_0x57a0cb['name'],_0x57a0cb[_0x2066('0x165')]||'',_0x57a0cb[_0x2066('0x166')]?'c':'',_0x57a0cb[_0x2066('0x167')]||0x3):_0x2066('0x162'),'XMD-CONTACTID':_0x13912a[_0x2066('0xd9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5344c4['actions'][_0x4e1d2c]['getCaller'](),'XMD-AMD':_0x57a0cb[_0x2066('0x10c')]?_0x2066('0x13b'):_0x2066('0x162'),'XMD-DESTINATION':_0x2066('0x168')};if(_0x57a0cb[_0x2066('0x10c')]){_0x59fb63[_0x2066('0x169')]=_0x57a0cb[_0x2066('0x16a')]||0x9c4;_0x59fb63[_0x2066('0x16b')]=_0x57a0cb[_0x2066('0x16c')]||0x5dc;_0x59fb63[_0x2066('0x16d')]=_0x57a0cb[_0x2066('0x16e')]||0x320;_0x59fb63['XMD-AMDTOTALANALYSISTIME']=_0x57a0cb[_0x2066('0x16f')]||0x1388;_0x59fb63[_0x2066('0x170')]=_0x57a0cb['dialAMDMinWordLength']||0x64;_0x59fb63[_0x2066('0x171')]=_0x57a0cb[_0x2066('0x172')]||0x32;_0x59fb63[_0x2066('0x173')]=_0x57a0cb[_0x2066('0x174')]||0x3;_0x59fb63[_0x2066('0x175')]=_0x57a0cb['dialAMDSilenceThreshold']||0x100;_0x59fb63[_0x2066('0x176')]=_0x57a0cb[_0x2066('0x177')]||0x1388;}if(utils[_0x2066('0x178')](_0x57a0cb)){_0x59fb63['XMD-VOICEQUEUEID']=_0x13912a[_0x2066('0xdb')];}else{_0x59fb63[_0x2066('0x179')]=_0x13912a[_0x2066('0xdc')];}var _0xad6e08=utils[_0x2066('0x17a')](_0x13912a['Contact']);Object[_0x2066('0x13f')](_0x59fb63,_0xad6e08);var _0xe6b91f=_0x5344c4[_0x2066('0x89')](_0x57a0cb[_0x2066('0x8f')])?utils['getCallerId'](_0x57a0cb[_0x2066('0x8f')][_0x2066('0x17b')],_0x57a0cb[_0x2066('0x17c')],_0x57a0cb[_0x2066('0x17d')]>0x0?utils[_0x2066('0x17e')](_0x57a0cb[_0x2066('0x17f')],_0x57a0cb[_0x2066('0x17d')]):_0x57a0cb['dialOriginateCallerIdNumber']):utils[_0x2066('0x180')](_[_0x2066('0xf1')](_0x57a0cb['TrunkBackup'])?_0x57a0cb[_0x2066('0x8f')][_0x2066('0x17b')]:_0x57a0cb[_0x2066('0x181')][_0x2066('0x17b')],_0x57a0cb[_0x2066('0x17c')],_0x57a0cb[_0x2066('0x17d')]>0x0?utils['getCallerIdRandom'](_0x57a0cb['dialOriginateCallerIdNumber'],_0x57a0cb['dialRandomLastDigitCallerIdNumber']):_0x57a0cb[_0x2066('0x17f')]);if(_0xe6b91f){_0x59fb63['XMD-ORIGINATECALLERIDNAME']=_0x5344c4[_0x2066('0x26')][_0x4e1d2c][_0x2066('0x182')]=utils['extractCalleridName'](_0xe6b91f);_0x59fb63[_0x2066('0x183')]=_0x13912a['phone'];}_0x57a0cb[_0x2066('0x184')]=_0x59fb63;return ami[_0x2066('0x9e')]({'actionid':_0x4e1d2c,'action':_0x2066('0x15e'),'channel':_0x5344c4[_0x2066('0x89')](_0x57a0cb[_0x2066('0x8f')])?util[_0x2066('0x80')](_0x2066('0x185'),_0x57a0cb[_0x2066('0x8f')]['name'],isNotNull(_0x57a0cb[_0x2066('0x186')])?_0x57a0cb['dialPrefix'][_0x2066('0x187')]()||'':'',_0x57a0cb[_0x2066('0x188')]>0x0?_0x13912a[_0x2066('0x160')][_0x2066('0x189')](_0x57a0cb[_0x2066('0x188')]):_0x13912a['phone']):util[_0x2066('0x80')](_0x2066('0x185'),_[_0x2066('0xf1')](_0x57a0cb['TrunkBackup'])?_0x57a0cb['Trunk'][_0x2066('0x60')]:_0x57a0cb[_0x2066('0x181')][_0x2066('0x60')],isNotNull(_0x57a0cb[_0x2066('0x186')])?_0x57a0cb[_0x2066('0x186')][_0x2066('0x187')]()||'':'',_0x57a0cb[_0x2066('0x188')]>0x0?_0x13912a[_0x2066('0x160')][_0x2066('0x189')](_0x57a0cb[_0x2066('0x188')]):_0x13912a[_0x2066('0x160')]),'callerid':_0xe6b91f,'Exten':'xcally-motion-dialer','Context':_0x2066('0x18a'),'Priority':'1','variable':_0x59fb63,'timeout':(_0x57a0cb[_0x2066('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e1d2c})[_0x2066('0x3d')](function(_0x2a8b67){return _0x3280d3(_0x2a8b67);})[_0x2066('0xa2')](function(_0x1f2a5e){_0x57a0cb[_0x2066('0x18c')]+=0x1;var _0x20371d=new History(_0x5344c4[_0x2066('0x26')][_0x4e1d2c]);logger[_0x2066('0x65')](util[_0x2066('0x80')](_0x2066('0x18d'),JSON[_0x2066('0x76')](_0x1f2a5e)));_0x20371d['state']=0xe;_0x20371d[_0x2066('0xce')]=_0x2066('0x18e');_0x20371d['starttime']=moment()[_0x2066('0x80')](_0x2066('0xc0'));_0x20371d['endtime']=_0x20371d['starttime'];hopperUtils[_0x2066('0xc6')](_0x20371d)[_0x2066('0xa2')](loggerCatch(_0x2066('0x18f')));_0x5344c4[_0x2066('0xc8')](_0x20371d)[_0x2066('0xa2')](loggerCatch(_0x2066('0x18f')))[_0x2066('0x21')](function(){delete _0x5344c4[_0x2066('0x26')][_0x4e1d2c];return _0x5554ab(msgResponse(_0x2066('0x15e'),_0x2066('0x88'),_0x2066('0x190')));});});});};Dialer[_0x2066('0x1e')][_0x2066('0x191')]=function(_0x30e32c,_0x3ecb5e,_0x40fb3a){var _0x565c0b=new History(_0x3ecb5e);if(_0x565c0b['countbusyretry']+_0x565c0b[_0x2066('0x11d')]+_0x565c0b[_0x2066('0x11e')]+_0x565c0b[_0x2066('0x11f')]+_0x565c0b['countdropretry']+_0x565c0b[_0x2066('0xe5')]+_0x565c0b[_0x2066('0x11b')]+_0x565c0b[_0x2066('0x120')]>=_0x40fb3a[_0x2066('0x121')]-0x1){return!![];}switch(_0x30e32c){case 0x3:if(_0x565c0b[_0x2066('0x11e')]>=_0x40fb3a['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x2066('0xd8')]({'active':![],'countnoanswerretry':_0x565c0b[_0x2066('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x40fb3a[_0x2066('0x192')],_0x2066('0xe8'))['format'](_0x2066('0xc0')),'ContactId':_0x565c0b['ContactId'],'ListId':_0x565c0b['ListId'],'VoiceQueueId':_0x565c0b[_0x2066('0xdb')]||undefined,'CampaignId':_0x565c0b[_0x2066('0xdc')]||undefined})['catch'](loggerCatch(_0x2066('0x193')));break;case 0x5:if(_0x565c0b[_0x2066('0x128')]>=_0x40fb3a['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x2066('0xd8')]({'active':![],'countbusyretry':_0x565c0b['countbusyretry']+=0x1,'scheduledat':moment()['add'](_0x40fb3a['dialBusyRetryFrequency'],'minutes')[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x565c0b['ContactId'],'ListId':_0x565c0b[_0x2066('0xda')],'VoiceQueueId':_0x565c0b[_0x2066('0xdb')]||undefined,'CampaignId':_0x565c0b['CampaignId']||undefined})['catch'](loggerCatch(_0x2066('0x194')));break;case 0x8:if(_0x565c0b[_0x2066('0x11d')]>=_0x40fb3a[_0x2066('0x195')]-0x1){return!![];}hopperUtils[_0x2066('0xd8')]({'active':![],'countcongestionretry':_0x565c0b[_0x2066('0x11d')]+=0x1,'scheduledat':moment()[_0x2066('0xe6')](_0x40fb3a['dialCongestionRetryFrequency'],_0x2066('0xe8'))[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x565c0b['ContactId'],'ListId':_0x565c0b[_0x2066('0xda')],'VoiceQueueId':_0x565c0b[_0x2066('0xdb')]||undefined,'CampaignId':_0x565c0b[_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0x196')));break;case 0x0:if(_0x565c0b['countnosuchnumberretry']>=_0x40fb3a[_0x2066('0x197')]-0x1){return!![];}else{hopperUtils[_0x2066('0xd8')]({'active':![],'countnosuchnumberretry':_0x565c0b['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x2066('0xe6')](_0x40fb3a[_0x2066('0x198')],'minutes')[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x565c0b[_0x2066('0xd9')],'ListId':_0x565c0b['ListId'],'VoiceQueueId':_0x565c0b['VoiceQueueId']||undefined,'CampaignId':_0x565c0b[_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x565c0b[_0x2066('0xd1')]>=_0x40fb3a['dialDropMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x565c0b['countdropretry']+=0x1,'scheduledat':moment()[_0x2066('0xe6')](_0x40fb3a[_0x2066('0xd3')],_0x2066('0xe8'))[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x565c0b[_0x2066('0xd9')],'ListId':_0x565c0b[_0x2066('0xda')],'VoiceQueueId':_0x565c0b[_0x2066('0xdb')]||undefined,'CampaignId':_0x565c0b['CampaignId']||undefined})[_0x2066('0xa2')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x565c0b[_0x2066('0xe5')]>=_0x40fb3a['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x2066('0xd8')]({'active':![],'countabandonedretry':_0x565c0b[_0x2066('0xe5')]+=0x1,'scheduledat':moment()[_0x2066('0xe6')](_0x40fb3a[_0x2066('0xe7')],_0x2066('0xe8'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x565c0b[_0x2066('0xd9')],'ListId':_0x565c0b[_0x2066('0xda')],'VoiceQueueId':_0x565c0b[_0x2066('0xdb')]||undefined,'CampaignId':_0x565c0b['CampaignId']||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0xe9')));break;case 0x13:if(_0x565c0b[_0x2066('0x11b')]>=_0x40fb3a[_0x2066('0x123')]-0x1){return!![];}hopperUtils[_0x2066('0xd8')]({'active':![],'countmachineretry':_0x565c0b['countmachineretry']+=0x1,'scheduledat':moment()[_0x2066('0xe6')](_0x40fb3a['dialMachineRetryFrequency'],_0x2066('0xe8'))[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x565c0b['ContactId'],'ListId':_0x565c0b[_0x2066('0xda')],'VoiceQueueId':_0x565c0b[_0x2066('0xdb')]||undefined,'CampaignId':_0x565c0b['CampaignId']||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0x12a')));break;case 0x14:if(_0x565c0b[_0x2066('0x120')]>=_0x40fb3a['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x2066('0xd8')]({'active':![],'countagentrejectretry':_0x565c0b['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x2066('0xe6')](_0x40fb3a[_0x2066('0x199')],_0x2066('0xe8'))[_0x2066('0x80')](_0x2066('0xc0')),'ContactId':_0x565c0b[_0x2066('0xd9')],'ListId':_0x565c0b[_0x2066('0xda')],'VoiceQueueId':_0x565c0b['VoiceQueueId']||undefined,'CampaignId':_0x565c0b[_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x2066('0x1e')][_0x2066('0x108')]=function(_0x1b1ee7,_0x38f41c,_0x59ac01){var _0x3532f0=this;var _0x580e52=new History(_0x1b1ee7);var _0x5dc804=![];var _0x3d9041;var _0x5decd2;return new Promise(function(_0x4aac48,_0x5a68ac){if(_[_0x2066('0x3f')](_0x38f41c)&&typeof _0x38f41c!=='object'){return _0x5a68ac(msgResponse(_0x2066('0x19a'),_0x2066('0x95'),_0x2066('0x19b')));}if(_[_0x2066('0x3f')](_0x59ac01)&&typeof _0x59ac01!=='object'){return _0x5a68ac(msgResponse('[callProgressDetecting]','Failure',_0x2066('0x19c')));}hopperUtils[_0x2066('0xd4')](_0x580e52,_0x59ac01[_0x2066('0x19d')],_0x38f41c)[_0x2066('0x3d')](function(_0x4a33c1){if(_0x4a33c1[_0x2066('0xd6')]==0x1)_0x5dc804=!![];switch(_0x59ac01[_0x2066('0x19d')]){case'0':_0x38f41c[_0x2066('0x19e')]+=0x1;_0x580e52[_0x2066('0xcd')]=0x0;_0x580e52[_0x2066('0xce')]=_0x2066('0x19f');_0x580e52[_0x2066('0x11f')]+=0x1;_0x580e52['countglobal']+=0x1;ami[_0x2066('0x113')](_0x2066('0x1a0'),ut[_0x2066('0x115')](_0x1b1ee7,_0x2066('0x1a1')));_0x3d9041=_0x38f41c[_0x2066('0x198')];_0x5decd2=_0x38f41c[_0x2066('0xe4')];hopperUtils[_0x2066('0xc6')](_0x580e52)[_0x2066('0xa2')](loggerCatch(_0x2066('0x11c')));if(_0x3532f0[_0x2066('0x191')](0x0,_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52[_0x2066('0x11f')]>=_0x38f41c[_0x2066('0x197')]){_0x3532f0[_0x2066('0x124')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1a2'));}else{_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x38f41c[_0x2066('0x1a3')]+=0x1;_0x580e52[_0x2066('0xcd')]=0x3;_0x580e52['statedesc']=_0x2066('0x1a4');_0x580e52[_0x2066('0x11e')]+=0x1;_0x580e52['countglobal']+=0x1;var _0x28a3f2=ut[_0x2066('0x1a5')](_0x1b1ee7,_0x38f41c);ami[_0x2066('0x113')](_0x2066('0x1a6'),_0x28a3f2);_0x3d9041=_0x38f41c[_0x2066('0x192')];_0x5decd2=_0x38f41c['callAdditionalPhoneAfterMin'];hopperUtils[_0x2066('0xc6')](_0x580e52)[_0x2066('0xa2')](loggerCatch(_0x2066('0x1a7')));if(_0x3532f0['checkRetriveMax'](0x3,_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52[_0x2066('0x11e')]>=_0x38f41c[_0x2066('0x1a8')]){_0x3532f0[_0x2066('0x124')](_0x580e52,_0x4aac48,_0x5a68ac,'reason\x203\x20ringing\x20no\x20answer');}else{_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x38f41c['outboundBusyCallsDay']+=0x1;_0x580e52[_0x2066('0xcd')]=0x5;_0x580e52['statedesc']='Busy';_0x580e52['countbusyretry']+=0x1;_0x580e52[_0x2066('0xd2')]+=0x1;ami['emit'](_0x2066('0x1a9'),ut[_0x2066('0x115')](_0x1b1ee7,_0x2066('0x1aa')));_0x3d9041=_0x38f41c['dialBusyRetryFrequency'];_0x5decd2=_0x38f41c['callAdditionalPhoneAfterMin'];hopperUtils[_0x2066('0xc6')](_0x580e52)[_0x2066('0xa2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x3532f0['checkRetriveMax'](0x5,_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52['countbusyretry']>=_0x38f41c[_0x2066('0x1ab')]){_0x3532f0[_0x2066('0x124')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1ac'));}else{_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1ac'));}}break;case'8':_0x38f41c[_0x2066('0x1ad')]+=0x1;_0x580e52[_0x2066('0xcd')]=0x8;_0x580e52[_0x2066('0xce')]='Congestion';_0x580e52[_0x2066('0x11d')]+=0x1;_0x580e52[_0x2066('0xd2')]+=0x1;_0x3d9041=_0x38f41c[_0x2066('0x1ae')];_0x5decd2=_0x38f41c[_0x2066('0xe4')];ami[_0x2066('0x113')](_0x2066('0x1af'),ut[_0x2066('0x115')](_0x1b1ee7,_0x2066('0x1b0')));hopperUtils['createHistory'](_0x580e52)[_0x2066('0xa2')](loggerCatch(_0x2066('0x1b1')));if(_0x3532f0[_0x2066('0x191')](0x8,_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52[_0x2066('0x11d')]>=_0x38f41c[_0x2066('0x195')]){_0x3532f0[_0x2066('0x124')](_0x580e52,_0x4aac48,_0x5a68ac,'reason\x208\x20congestion');}else{_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1b2'));}}break;case'11':_0x38f41c[_0x2066('0x1b3')]+=0x1;_0x580e52['state']=0xb;_0x580e52[_0x2066('0xce')]=_0x2066('0x1b4');_0x580e52['countabandonedretry']+=0x1;_0x580e52['countglobal']+=0x1;_0x3d9041=_0x38f41c[_0x2066('0xe7')];_0x5decd2=_0x38f41c['callAdditionalPhoneAfterMin'];hopperUtils[_0x2066('0xc6')](_0x580e52)[_0x2066('0xa2')](loggerCatch(_0x2066('0xea')));if(_0x3532f0[_0x2066('0x191')](0xb,_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52[_0x2066('0xe5')]>=_0x38f41c[_0x2066('0x1b5')]){_0x3532f0[_0x2066('0x124')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1b6'));}else{_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1b6'));}}break;case'20':_0x38f41c[_0x2066('0x1b7')]+=0x1;_0x580e52[_0x2066('0xcd')]=0x14;_0x580e52[_0x2066('0xce')]='AgentReject';_0x580e52['countagentrejectretry']+=0x1;_0x580e52['countglobal']+=0x1;_0x3d9041=_0x38f41c[_0x2066('0x199')];_0x5decd2=_0x38f41c['callAdditionalPhoneAfterMin'];ami['emit'](_0x2066('0x1b8'),ut['buildObj'](_0x1b1ee7,_0x2066('0x1b9')));hopperUtils[_0x2066('0xc6')](_0x580e52)['catch'](loggerCatch(_0x2066('0x1ba')));if(_0x3532f0[_0x2066('0x191')](0x14,_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52[_0x2066('0x120')]>=_0x38f41c[_0x2066('0x1bb')]){_0x3532f0['createStateFinal'](_0x580e52,_0x4aac48,_0x5a68ac,'reason\x2020\x20agentreject');}else{_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,_0x2066('0x1bc'));}}break;default:_0x38f41c[_0x2066('0x12f')]+=0x1;_0x580e52[_0x2066('0xcd')]=0xc;_0x580e52['statedesc']=_0x59ac01[_0x2066('0x19d')];_0x3d9041=_0x38f41c[_0x2066('0x199')];_0x5decd2=_0x38f41c[_0x2066('0xe4')];hopperUtils['createHistory'](_0x580e52)[_0x2066('0xa2')](loggerCatch(_0x2066('0x1bd')));if(_0x3532f0['checkRetriveMax'](_0x59ac01[_0x2066('0x19d')],_0x1b1ee7,_0x38f41c)&&!_0x5dc804){if(_0x580e52[_0x2066('0x128')]+_0x580e52[_0x2066('0x11d')]+_0x580e52[_0x2066('0x11e')]+_0x580e52['countnosuchnumberretry']+_0x580e52[_0x2066('0xd1')]+_0x580e52[_0x2066('0xe5')]+_0x580e52[_0x2066('0x11b')]+_0x580e52[_0x2066('0x120')]>=_0x38f41c['dialGlobalMaxRetry']){_0x3532f0[_0x2066('0x122')](_0x580e52,_0x4aac48,_0x5a68ac,_0x59ac01[_0x2066('0x19d')]);}else{_0x3532f0[_0x2066('0x124')](_0x580e52,_0x4aac48,_0x5a68ac,_0x59ac01['reason']);}}}})[_0x2066('0x3d')](function(){if(_0x5dc804){hopperUtils[_0x2066('0xeb')](_0x580e52,_0x3d9041,_0x5decd2)[_0x2066('0x3d')](function(){return _0x4aac48(0x1);});}});});};Dialer[_0x2066('0x1e')][_0x2066('0x122')]=function(_0x596c39,_0x32f4a1,_0x556150,_0x3ff857){var _0x529f1d=new Final(_0x596c39);_0x529f1d[_0x2066('0xcd')]=0xf;_0x529f1d[_0x2066('0xce')]='Global';this[_0x2066('0x124')](_0x529f1d,_0x32f4a1,_0x556150,_0x3ff857);};Dialer[_0x2066('0x1e')][_0x2066('0x124')]=function(_0x1fef93,_0x120812,_0x148869,_0xf6f11b){hopperUtils['moveContactManagedDialer'](_0x1fef93)[_0x2066('0x3d')](function(){return _0x120812(msgResponse(_0x2066('0x19a'),_0x2066('0x107'),_0xf6f11b));})['catch'](function(){return _0x148869(msgResponse(_0x2066('0x1be'),_0x2066('0x95'),_0x2066('0x1bf')));});};Dialer[_0x2066('0x1e')][_0x2066('0xa')]=function(_0x3cd9f3){var _0x4b53f8=_0x3cd9f3[_0x2066('0x1c0')]/0x64;var _0x1b28d7=_0x3cd9f3[_0x2066('0xcc')]/(_0x3cd9f3[_0x2066('0xcc')]+_0x3cd9f3[_0x2066('0xc2')]);var _0x100af9=Math[_0x2066('0x1c1')](_0x3cd9f3[_0x2066('0x1c2')]*(_0x3cd9f3[_0x2066('0x1c3')]/0x64));var _0x4683d3=Math[_0x2066('0x1c1')](_0x3cd9f3['predictiveIntervalAvailable']*(_0x3cd9f3[_0x2066('0x1c4')]/0x64));var _0x239dd8=_0x3cd9f3['available']+_0x3cd9f3[_0x2066('0x139')];var _0xbd326e=Math[_0x2066('0x1c5')](_0x3cd9f3[_0x2066('0x1c6')]*_0x3cd9f3[_0x2066('0x5a')]*_0x3cd9f3[_0x2066('0x1c7')]*_0x3cd9f3[_0x2066('0x1c8')]);if(_[_0x2066('0x3f')](_0x3cd9f3[_0x2066('0x5f')])){if(!_[_0x2066('0x3f')](_0x3cd9f3['startPredictive'])){_0x3cd9f3['startPredictive']=undefined;loggerPredictive[_0x2066('0x65')](_0x2066('0x1c9'),_0x2066('0x1ca'));}if(!_[_0x2066('0x3f')](_0x3cd9f3[_0x2066('0x63')])){loggerPredictive['error'](_0x2066('0x1c9'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3cd9f3['handlePredictive']);_0x3cd9f3[_0x2066('0x63')]=undefined;}_0x3cd9f3[_0x2066('0x5f')]=moment()[_0x2066('0x80')](_0x2066('0xc0'));loggerPredictive[_0x2066('0x45')](_0x3cd9f3[_0x2066('0x60')],_0x2066('0x1cb'),_0x3cd9f3[_0x2066('0x5f')]);this[_0x2066('0xb3')](_0x3cd9f3,0x1);}else if(ifInterval(_0x3cd9f3[_0x2066('0x1cc')],_0x3cd9f3[_0x2066('0x5f')])){this[_0x2066('0xb3')](_0x3cd9f3,0x1);loggerPredictiveCalls[_0x2066('0x45')](_0x2066('0x1cd'),_0x3cd9f3[_0x2066('0x5f')],_0x3cd9f3[_0x2066('0x60')]);_0x3cd9f3['erlangCalls']=0x0;_0x3cd9f3[_0x2066('0x1ce')]=0x0;}else if(_0x4b53f8<_0x1b28d7&&_0x3cd9f3[_0x2066('0x1cf')]===_0x2066('0x1d0')){clearPredictiveAttributes(_0x3cd9f3);loggerPredictive['info'](_0x2066('0x1d1'),'Dropped\x20calls\x20day',_0x1b28d7,_0x2066('0x5f'),_0x3cd9f3['name']);}else if(_0xbd326e<_0x3cd9f3[_0x2066('0x1ce')]&&_0x3cd9f3[_0x2066('0x1cf')]===_0x2066('0x1d0')){clearPredictiveAttributes(_0x3cd9f3);loggerPredictive[_0x2066('0x45')](_0x2066('0x1d2'),_0x2066('0x1d3'),_0xbd326e,_0x2066('0x1d4'),_0x3cd9f3['predictiveIntervalErlangCallsDroppedCalls'],_0x2066('0x5f'),_0x3cd9f3[_0x2066('0x60')]);}else if(!ifInterval(_0x3cd9f3[_0x2066('0x1cc')],_0x3cd9f3[_0x2066('0x5f')])&&_[_0x2066('0x3f')](_0x3cd9f3['startPredictive'])&&!_[_0x2066('0x3f')](_0x3cd9f3[_0x2066('0x5f')])){_0x3cd9f3[_0x2066('0x62')]=moment()[_0x2066('0x80')](_0x2066('0xc0'));loggerPredictive[_0x2066('0x45')](_0x3cd9f3[_0x2066('0x60')],_0x2066('0x1d5'),_0x3cd9f3[_0x2066('0x62')]);hopperUtils[_0x2066('0x1d6')](_0x3cd9f3['dialPredictiveInterval'])[_0x2066('0x3d')](this['getDataPredictive'](_0x3cd9f3))[_0x2066('0x3d')](mergeDataErlangB(_0x3cd9f3))['then'](this[_0x2066('0x1d7')](_0x3cd9f3))[_0x2066('0xa2')](loggerCatchPredictive(_0x2066('0x1d8'),_0x3cd9f3));}else if(!ifInterval(_0x3cd9f3['dialPredictiveInterval'],_0x3cd9f3[_0x2066('0x62')])){_0x3cd9f3['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3cd9f3[_0x2066('0x62')]=moment()[_0x2066('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x2066('0x45')](_0x3cd9f3[_0x2066('0x60')],_0x2066('0x1d9'),_0x3cd9f3[_0x2066('0x62')]);clearInterval(_0x3cd9f3[_0x2066('0x63')]);_0x3cd9f3['handlePredictive']=undefined;hopperUtils[_0x2066('0x1d6')](_0x3cd9f3[_0x2066('0x1cc')])[_0x2066('0x3d')](this[_0x2066('0x1da')](_0x3cd9f3))['then'](mergeDataErlangB(_0x3cd9f3))[_0x2066('0x3d')](this[_0x2066('0x1d7')](_0x3cd9f3))['catch'](loggerCatchPredictive(_0x2066('0x1db'),_0x3cd9f3));}else if(_0x3cd9f3[_0x2066('0x1c2')]&&_0x239dd8<_0x3cd9f3[_0x2066('0x1c2')]-_0x4683d3){clearPredictiveAttributes(_0x3cd9f3);loggerPredictive[_0x2066('0x45')](_0x3cd9f3[_0x2066('0x60')],_0x2066('0x1dc'),_0x239dd8,_0x2066('0x1dd'),_0x3cd9f3[_0x2066('0x1c2')],'-',_0x4683d3,'=',_0x3cd9f3['predictiveIntervalAvailable']-_0x4683d3,')');}else if(_0x3cd9f3['predictiveIntervalAvailable']&&_0x239dd8>_0x3cd9f3[_0x2066('0x1c2')]+_0x100af9){clearPredictiveAttributes(_0x3cd9f3);loggerPredictive['info'](_0x3cd9f3[_0x2066('0x60')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x239dd8,_0x2066('0x1de'),_0x3cd9f3[_0x2066('0x1c2')],'+',_0x100af9,'=',_0x3cd9f3['predictiveIntervalAvailable']+_0x100af9,')');}};Dialer[_0x2066('0x1e')]['getDataPredictive']=function(_0x22383c){var _0x4052d4=this;return function(_0x2a02be){return new Promise(function(_0xd43446,_0x4c2430){_[_0x2066('0x5d')](_0x22383c,_0x2a02be[0x0]);if(checkGetDataPredictive(_0x2a02be[0x0])){var _0x8fcf23=_0x22383c[_0x2066('0x1c2')]=_0x22383c[_0x2066('0x139')]+_0x22383c['available'];var _0x2172fa=_0x22383c['dialPredictiveInterval']*0x3c;var _0x3a6679=_0x2a02be[0x0][_0x2066('0x4f')]+_0x2a02be[0x0]['predictiveIntervalAvgHoldtime'];var _0x23d351=(_0x2a02be[0x0][_0x2066('0x49')]+_0x2a02be[0x0][_0x2066('0x4a')]+_0x2a02be[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2a02be[0x0][_0x2066('0x48')];_0x22383c[_0x2066('0x1c7')]=_0x23d351>0x0?_0x23d351:0x1;switch(_0x22383c[_0x2066('0x1cf')]){case _0x2066('0x1d0'):var _0x3f53e4=_0x22383c[_0x2066('0x1c0')]/0x64;return _0x4052d4[_0x2066('0x1df')](_0x8fcf23,_0x2172fa,_0x3a6679,_0x23d351,_0x3f53e4)[_0x2066('0x3d')](function(_0x389205){return _0xd43446(_0x389205);});case'agentBusyFactor':var _0x17f39a=_0x22383c[_0x2066('0x1c0')]/0x64;return _0x4052d4[_0x2066('0x1e0')](_0x8fcf23,_0x2172fa,_0x3a6679,_0x23d351,_0x17f39a)[_0x2066('0x3d')](function(_0x409ce0){return _0xd43446(_0x409ce0);});default:return _0x4c2430(msgResponse(_0x2066('0x1e1'),_0x2066('0x95'),_0x2066('0x1e2')));}}else{return _0x4c2430(msgResponse(_0x2066('0x1e1'),_0x2066('0x95'),_0x2066('0x1e3')));}});};};Dialer[_0x2066('0x1e')][_0x2066('0x1e4')]=function(_0x59d4d2){var _0x46e16e=this;return function(_0x128993){return new Promise(function(_0x14b14c,_0x521fcc){_[_0x2066('0x5d')](_0x59d4d2,_0x128993[0x0]);if(checkGetDataPredictive(_0x128993[0x0])){loggerPredictive[_0x2066('0x45')](JSON['stringify'](_0x128993[0x0]));if(_0x59d4d2['dialPredictiveOptimization']==='dropRate'){return _0x46e16e['getVoiceQueueRtPauses'](_0x59d4d2['id'])['then'](function(_0x18a40e){var _0x3b9619=_0x59d4d2[_0x2066('0x1e5')]-_0x18a40e[0x0][_0x2066('0x1e6')];var _0x2e9ea4=_0x59d4d2[_0x2066('0x1cc')]*0x3c;var _0x10fb57=_0x128993[0x0][_0x2066('0x4f')]+_0x128993[0x0]['predictiveIntervalAvgHoldtime'];var _0x2a5e4d=(_0x128993[0x0]['predictiveIntervalAnsweredCalls']+_0x128993[0x0][_0x2066('0x4a')]+_0x128993[0x0][_0x2066('0x4c')])/_0x128993[0x0]['predictiveIntervalTotalCalls'];var _0x4c670f=_0x59d4d2[_0x2066('0x1c0')]/0x64;_0x59d4d2['predictiveIntervalPauses']=_0x18a40e[0x0][_0x2066('0x1e6')]||0x0;_0x59d4d2[_0x2066('0x1c7')]=_0x2a5e4d>0x0?_0x2a5e4d:0x1;return _0x46e16e[_0x2066('0x1df')](_0x3b9619,_0x2e9ea4,_0x10fb57,_0x2a5e4d,_0x4c670f);})[_0x2066('0x3d')](function(_0x58cb6e){return _0x14b14c(_0x58cb6e);})[_0x2066('0xa2')](function(_0x904862){return _0x521fcc(msgResponse('[CatchErlangB]','Failure',JSON[_0x2066('0x76')](_0x904862)));});}if(_0x59d4d2[_0x2066('0x1cf')]===_0x2066('0x1e7')){return _0x46e16e['getVoiceQueueRtPauses'](_0x59d4d2['id'])[_0x2066('0x3d')](function(_0x426ea5){var _0x33aec1=_0x59d4d2[_0x2066('0x1e5')]-_0x426ea5[0x0][_0x2066('0x1e6')];var _0x1aa8ce=_0x59d4d2[_0x2066('0x1cc')]*0x3c;var _0x49cfef=_0x128993[0x0][_0x2066('0x4f')]+_0x128993[0x0][_0x2066('0x52')];var _0x2a397b=(_0x128993[0x0]['predictiveIntervalAnsweredCalls']+_0x128993[0x0][_0x2066('0x4a')]+_0x128993[0x0][_0x2066('0x4c')])/_0x128993[0x0][_0x2066('0x48')];var _0x22b83e=_0x59d4d2[_0x2066('0x1c0')]/0x64;_0x59d4d2[_0x2066('0x1e8')]=_0x426ea5[0x0][_0x2066('0x1e6')]||0x0;_0x59d4d2['predictiveIntervalHitRate']=_0x2a397b>0x0?_0x2a397b:0x1;return _0x46e16e[_0x2066('0x1e0')](_0x33aec1,_0x1aa8ce,_0x49cfef,_0x2a397b,_0x22b83e);})[_0x2066('0x3d')](function(_0x12b2e1){return _0x14b14c(_0x12b2e1);})[_0x2066('0xa2')](function(_0x5b07a2){return _0x521fcc(msgResponse(_0x2066('0x1e9'),_0x2066('0x95'),JSON[_0x2066('0x76')](_0x5b07a2)));});}}else{return _0x521fcc(msgResponse(_0x2066('0x1e1'),'Failure',_0x2066('0x1e3')));}});};};Dialer[_0x2066('0x1e')][_0x2066('0x1d7')]=function(_0x4e3c97){var _0x527e03=this;return function(){var _0x555be0=0x0;var _0x3fac4c=Math['floor'](_0x4e3c97['erlangCallToSecond']*0x3e8);if(_0x3fac4c>0x0){_0x3fac4c=_0x3fac4c<0x64?0x64:_0x3fac4c;loggerPredictive[_0x2066('0x45')](_0x4e3c97[_0x2066('0x60')],_0x2066('0x1ea'),_0x3fac4c,_0x2066('0x1eb'));_0x4e3c97[_0x2066('0x63')]=setInterval(function(){_0x527e03['handlePredictive'](_0x4e3c97);loggerPredictiveCalls[_0x2066('0x45')](_0x2066('0x1ec'),_0x555be0+=0x1);},_0x3fac4c);}else{loggerPredictive['info'](_0x4e3c97[_0x2066('0x60')],_0x2066('0x1ed'));}};};Dialer[_0x2066('0x1e')]['checkContactBlack']=function(_0x21e23d,_0x3a5708){var _0x5de754=this;return function(_0x211b16){if(_[_0x2066('0x7c')](_0x211b16)){if(_['isNil'](_0x3a5708[_0x2066('0x153')])||!_0x3a5708['recallme']){if(_0x21e23d[_0x2066('0xb1')]===_0x2066('0x9')){_0x21e23d[_0x2066('0x73')]=_['isUndefined'](_0x21e23d[_0x2066('0x73')])?!![]:_0x21e23d[_0x2066('0x73')];var _0xf24371=uuid['v4']();_0x5de754['actions'][_0xf24371]=new Action(_0x21e23d,_0x3a5708,_0xf24371);loggerBooked['info']('[booked][checkContactBlack]',_0xf24371,_0x2066('0x1ee'),JSON['stringify'](_0x21e23d['queueStatusComplete']),'Queue:\x20',_0x21e23d[_0x2066('0x60')]);if(_0x21e23d[_0x2066('0x73')]){_0x21e23d[_0x2066('0x73')]=![];_0x5de754[_0x2066('0xf5')][_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xbd')]]=[];ami[_0x2066('0x9e')]({'actionid':_0xf24371,'action':_0x2066('0x1ef'),'queue':_0x21e23d[_0x2066('0x60')]})[_0x2066('0xa2')](function(){_0x5de754[_0x2066('0xfa')](_0x21e23d);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xd9')],'ListId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xda')],'VoiceQueueId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xdb')]||undefined,'CampaignId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0x1f0')));delete _0x5de754[_0x2066('0x26')][_0xf24371];});}else{loggerBooked[_0x2066('0x45')](_0x2066('0x1f1'),JSON[_0x2066('0x76')](_0x21e23d['queueStatusComplete']),_0x2066('0x1f2'),_0x21e23d[_0x2066('0x60')]);_0x5de754[_0x2066('0xfa')](_0x21e23d);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xd9')],'ListId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xda')],'VoiceQueueId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xdb')]||undefined,'CampaignId':_0x5de754[_0x2066('0x26')][_0xf24371][_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0x1f0')));delete _0x5de754['actions'][_0xf24371];}}else{return _0x5de754[_0x2066('0x15c')](_0x21e23d,_0x3a5708);}}else{if(utils['getSeconds'](undefined,_0x3a5708[_0x2066('0x1f3')])<_0x21e23d[_0x2066('0x1f4')]*0x3c){if(_0x3a5708[_0x2066('0x159')]&&!_0x3a5708[_0x2066('0x159')]['voicePause']){_0x5de754[_0x2066('0xf6')]['run'](_0x3a5708['id'])['finally'](function(){_0x5de754[_0x2066('0xfa')](_0x21e23d);});}else{hopperUtils['unlockContact']({'active':![]},_0x3a5708['id'],0x1)[_0x2066('0x21')](function(){_0x5de754[_0x2066('0xfa')](_0x21e23d);});}}else{_0x21e23d['outboundReCallsDay']+=0x1;_0x5de754[_0x2066('0xfa')](_0x21e23d);if(_0x21e23d[_0x2066('0x1f5')]){hopperUtils[_0x2066('0xd8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3a5708[_0x2066('0xd9')],'ListId':_0x3a5708[_0x2066('0xda')],'VoiceQueueId':_0x3a5708[_0x2066('0xdb')]||undefined,'CampaignId':_0x3a5708[_0x2066('0xdc')]||undefined})[_0x2066('0xa2')](loggerCatch(_0x2066('0x1f6')));hopperUtils[_0x2066('0xc6')](createObjHistory(_0x21e23d,_0x3a5708,utils['CAMPAIGN_STATUS'][_0x2066('0x1f7')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x2066('0x1f8')));}else{_0x5de754[_0x2066('0x117')](createObjHistory(_0x21e23d,_0x3a5708,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x2066('0x1f9')),_0x2066('0x1fa'),_0x2066('0x1fb'));}}}}else{_0x21e23d[_0x2066('0x1fc')]+=0x1;_0x5de754[_0x2066('0x117')](createObjHistory(_0x21e23d,_0x3a5708,utils[_0x2066('0x6a')][_0x2066('0x1fd')],0xd,_0x2066('0x1fe')),_0x2066('0x1ff'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0x2066('0x1e')][_0x2066('0x15b')]=function(_0x2341ed){var _0x47e46f=this;var _0x431ce9=_0x2341ed['limitCalls']-_0x2341ed[_0x2066('0x83')];emitCampaignSummary(_0x2341ed);if(_0x431ce9>0x0&&_0x2341ed[_0x2066('0x68')]==0x0){if(_0x431ce9>this[_0x2066('0x200')]){_0x431ce9=this[_0x2066('0x200')];}_0x2341ed[_0x2066('0x68')]=0x1;hopperUtils[_0x2066('0x201')](_0x2341ed,_0x431ce9)['then'](function(_0x559974){_0x2341ed['temp']=0x0;if(_0x559974){if(!utils[_0x2066('0x202')](_0x559974)){_0x2341ed[_0x2066('0x70')]=utils['CAMPAIGN_STATUS'][_0x2066('0x6e')];logger[_0x2066('0x45')]('[getContactCampaign2][Empty]'+_0x2341ed['name']);}else{_0x2341ed[_0x2066('0x83')]+=_0x559974[_0x2066('0x9c')];_0x2341ed[_0x2066('0x70')]=utils[_0x2066('0x6a')][_0x2066('0x203')];for(var _0x552df8=0x0;_0x552df8<_0x559974[_0x2066('0x9c')];_0x552df8+=0x1){_0x2341ed[_0x2066('0x204')]+=0x1;if(_[_0x2066('0xf1')](_0x559974[_0x552df8])||_[_0x2066('0xf1')](_0x559974[_0x552df8][_0x2066('0x205')])||_[_0x2066('0xf1')](_0x559974[_0x552df8][_0x2066('0x160')])){_0x47e46f[_0x2066('0x151')](_0x2066('0x206'),_0x2341ed,_0x559974[_0x552df8]);}else{hopperUtils[_0x2066('0x207')](_['pick'](_0x559974[_0x552df8],['CampaignId','phone']))[_0x2066('0x3d')](_0x47e46f['checkContactBlack'](_0x2341ed,_0x559974[_0x552df8]))[_0x2066('0xa2')](_0x47e46f[_0x2066('0x208')](_0x2066('0x209'),_0x2341ed));}}}}})[_0x2066('0xa2')](loggerGetContactDialer(_0x2066('0x20a'),_0x2341ed,_0x431ce9));}};Dialer[_0x2066('0x1e')][_0x2066('0xb3')]=function(_0x4b83ab,_0x1f0513){var _0xce2a7f=this;var _0xdbc292=[];if(_0x1f0513<0x1||_0x4b83ab[_0x2066('0xb1')]===_0x2066('0x9')){_0x1f0513=0x1;}var _0x3a4fe8=Math[_0x2066('0x1c5')](_0x4b83ab[_0x2066('0x137')]*_0x1f0513)-_0x4b83ab[_0x2066('0x83')];if(_0x4b83ab[_0x2066('0x20b')]>0x0){var _0xbf07c5=_0x4b83ab[_0x2066('0x20b')]-_0x4b83ab[_0x2066('0x83')]-_0x4b83ab['talking']-_0x4b83ab['pTalking'];if(_0x3a4fe8>_0xbf07c5){_0x3a4fe8=_0xbf07c5;}}if(_0x3a4fe8>0x0&&_0x4b83ab[_0x2066('0x68')]==0x0){if(_0x4b83ab[_0x2066('0xb1')]===_0x2066('0x9')){_0x3a4fe8=0x1;}if(_0x3a4fe8>this['maxNumberOriginate']){_0x3a4fe8=this[_0x2066('0x200')];}for(var _0x214d39 in this[_0x2066('0x24')]){if(typeof this[_0x2066('0x24')][_0x214d39]!=='undefined'){if(this[_0x2066('0x24')][_0x214d39][_0x2066('0xcd')]===_0x2066('0x20c')&&this[_0x2066('0x24')][_0x214d39][_0x2066('0x8c')]===_0x2066('0x8b')){_0xdbc292[_0x2066('0x9d')](this[_0x2066('0x24')][_0x214d39]['id']);}}}_0x4b83ab['temp']=0x1;hopperUtils[_0x2066('0x20d')](_0x4b83ab,_0xdbc292,_0x3a4fe8)[_0x2066('0x3d')](function(_0xc7c83b){_0x4b83ab[_0x2066('0x68')]=0x0;if(_0xc7c83b){if(!utils[_0x2066('0x202')](_0xc7c83b)){hopperUtils['countReScheduled'](_0x4b83ab)[_0x2066('0x3d')](sendMessageReschedule(_0x4b83ab))[_0x2066('0xa2')](loggerCatch(_0x2066('0x20e')));}else{_0x4b83ab[_0x2066('0x83')]+=_0xc7c83b[_0x2066('0x9c')];_0x4b83ab['message']=_0x4b83ab[_0x2066('0xb1')]===_0x2066('0x9')?utils['CAMPAIGN_STATUS'][_0x2066('0x13b')]:utils[_0x2066('0x6a')][_0x2066('0x203')];for(var _0x23fbfb=0x0;_0x23fbfb<_0xc7c83b['length'];_0x23fbfb+=0x1){if(_[_0x2066('0xf1')](_0xc7c83b[_0x23fbfb])||_['isNil'](_0xc7c83b[_0x23fbfb][_0x2066('0x205')])||_['isNil'](_0xc7c83b[_0x23fbfb]['phone'])){_0xce2a7f[_0x2066('0x151')](_0x2066('0x206'),_0x4b83ab,_0xc7c83b[_0x23fbfb]);}else{hopperUtils[_0x2066('0x20f')](_[_0x2066('0x77')](_0xc7c83b[_0x23fbfb],[_0x2066('0xdb'),_0x2066('0x160')]))['then'](_0xce2a7f[_0x2066('0x210')](_0x4b83ab,_0xc7c83b[_0x23fbfb]))['catch'](_0xce2a7f[_0x2066('0x208')](_0x2066('0x206'),_0x4b83ab));}}}}})[_0x2066('0xa2')](loggerGetContactDialer(_0x2066('0x211'),_0x4b83ab,_0x3a4fe8));}};Dialer[_0x2066('0x1e')][_0x2066('0x63')]=function(_0x5a2771){if(_0x5a2771[_0x2066('0x20b')]>0x0){var _0xf6ec1f=_0x5a2771[_0x2066('0x20b')]-_0x5a2771['originated']-_0x5a2771['talking'];if(_0xf6ec1f>0x0&&_0x5a2771[_0x2066('0x68')]==0x0){this[_0x2066('0x212')](_0x5a2771);}else{loggerPredictiveCalls[_0x2066('0x45')](_0x2066('0x213'));}}else{this[_0x2066('0x212')](_0x5a2771);}};Dialer[_0x2066('0x1e')][_0x2066('0x212')]=function(_0x4e8d90){var _0x1ab5d3=this;var _0x3b159b=[];_0x4e8d90[_0x2066('0x83')]+=0x1;for(var _0x3f6cda in this[_0x2066('0x24')]){if(typeof this[_0x2066('0x24')][_0x3f6cda]!=='undefined'){if(this[_0x2066('0x24')][_0x3f6cda][_0x2066('0xcd')]===_0x2066('0x20c')&&this[_0x2066('0x24')][_0x3f6cda][_0x2066('0x8c')]===_0x2066('0x8b')){_0x3b159b[_0x2066('0x9d')](this['agents'][_0x3f6cda]['id']);}}}_0x4e8d90[_0x2066('0x68')]=0x1;return this[_0x2066('0x20d')](_0x4e8d90['id'],_0x3b159b,0x1,_0x4e8d90[_0x2066('0x214')],_0x4e8d90)[_0x2066('0x3d')](function(_0x52ac93){_0x4e8d90[_0x2066('0x68')]=0x1;if(_0x52ac93){if(!utils[_0x2066('0x202')](_0x52ac93)){utils[_0x2066('0x67')](_0x4e8d90,0x1,0x0);return hopperUtils[_0x2066('0x215')](_0x4e8d90)[_0x2066('0x3d')](sendMessageReschedule(_0x4e8d90))[_0x2066('0xa2')](loggerCatch(_0x2066('0x20e')));}else{_0x4e8d90['message']=utils[_0x2066('0x6a')][_0x2066('0x203')];if(_[_0x2066('0xf1')](_0x52ac93[0x0])||_[_0x2066('0xf1')](_0x52ac93[0x0][_0x2066('0x205')])||_[_0x2066('0xf1')](_0x52ac93[0x0][_0x2066('0x160')])){_0x1ab5d3['emptyContact'](_0x2066('0x206'),_0x4e8d90,_0x52ac93[0x0]);}else{return hopperUtils[_0x2066('0x20f')](_[_0x2066('0x77')](_0x52ac93[0x0],[_0x2066('0xdb'),_0x2066('0x160')]))[_0x2066('0x3d')](_0x1ab5d3[_0x2066('0x210')](_0x4e8d90,_0x52ac93[0x0]))['catch'](_0x1ab5d3[_0x2066('0x208')](_0x2066('0x216'),_0x4e8d90));}}}})[_0x2066('0xa2')](loggerGetContactDialer(_0x2066('0x217'),_0x4e8d90,0x1));};Dialer[_0x2066('0x1e')]['abandonmentRate']=function(_0x132f1d,_0x11e0ec,_0xb44efe,_0x50fa3e,_0x44d4bf,_0x54a422){loggerPredictive[_0x2066('0x45')](_0x2066('0x218'));loggerPredictive[_0x2066('0x45')](_0x2066('0x219'),_0x132f1d);loggerPredictive[_0x2066('0x45')](_0x2066('0x21a'),_0x11e0ec);loggerPredictive[_0x2066('0x45')](_0x2066('0x21b'),_0xb44efe);loggerPredictive[_0x2066('0x45')](_0x2066('0x21c'),_0x50fa3e);loggerPredictive[_0x2066('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44d4bf);loggerPredictive[_0x2066('0x45')](_0x2066('0x50'));return new Promise(function(_0x141542,_0x187564){if(_0x132f1d<=0x0||isNaN(_0x132f1d)){return _0x187564(msgResponse(_0x2066('0x21d'),_0x2066('0x88'),_0x2066('0x21e')+_0x132f1d));}if(_0xb44efe<=0x0||isNaN(_0xb44efe)){return _0x187564(msgResponse(_0x2066('0x21d'),_0x2066('0x88'),_0x2066('0x21f')+_0xb44efe));}if(_0x50fa3e<=0x0||isNaN(_0x50fa3e)){return _0x187564(msgResponse(_0x2066('0x21d'),_0x2066('0x88'),_0x2066('0x220')+_0x50fa3e));}if(_0x11e0ec<=0x0||isNaN(_0x11e0ec)){return _0x187564(msgResponse(_0x2066('0x21d'),'Error',_0x2066('0x221')+_0x11e0ec));}if(_0x44d4bf<=0x0||isNaN(_0x44d4bf)){return _0x187564(msgResponse(_0x2066('0x21d'),'Error',_0x2066('0x222')+_0x44d4bf));}_0x54a422=_0x54a422||0x0;var _0x406073=0x1/_0xb44efe;var _0x359952=0x0;var _0x3d5597=0x0;var _0x37cba9=0x0;var _0x34bdf7=0x0;for(var _0x435d43=0x0;_0x37cba9<_0x44d4bf;_0x435d43+=0x1){_0x3d5597=_0x435d43/_0x11e0ec;_0x359952=(_0x50fa3e*_0x3d5597+_0x54a422)/_0x406073;_0x37cba9=utils[_0x2066('0x223')](_0x359952,_0x132f1d);_0x34bdf7=_0x359952/_0x132f1d*(0x1-utils[_0x2066('0x223')](_0x359952,_0x132f1d));}return _0x141542({'erlangCalls':_0x435d43,'erlangCallToSecond':_0x11e0ec/_0x435d43,'erlangAbandonmentRate':_0x37cba9,'erlangBusyFactor':_0x34bdf7});});};Dialer['prototype'][_0x2066('0x1e0')]=function(_0x21b432,_0xd25596,_0x5cd138,_0x363c5b,_0x17b16f,_0x4de48b){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x2066('0x45')]('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',_0x21b432);loggerPredictive['info'](_0x2066('0x21a'),_0xd25596);loggerPredictive[_0x2066('0x45')](_0x2066('0x21b'),_0x5cd138);loggerPredictive[_0x2066('0x45')](_0x2066('0x21c'),_0x363c5b);loggerPredictive[_0x2066('0x45')](_0x2066('0x224'),_0x17b16f);loggerPredictive[_0x2066('0x45')](_0x2066('0x50'));return new Promise(function(_0x4ef7d4,_0x406cfe){if(_0x21b432<=0x0||isNaN(_0x21b432)){return _0x406cfe(msgResponse(_0x2066('0x225'),_0x2066('0x88'),_0x2066('0x21e')+_0x21b432));}if(_0x5cd138<=0x0||isNaN(_0x5cd138)){return _0x406cfe(msgResponse(_0x2066('0x225'),'Error',_0x2066('0x21f')+_0x5cd138));}if(_0x363c5b<=0x0||isNaN(_0x363c5b)){return _0x406cfe(msgResponse(_0x2066('0x225'),_0x2066('0x88'),'p\x20=\x20'+_0x363c5b));}if(_0xd25596<=0x0||isNaN(_0xd25596)){return _0x406cfe(msgResponse(_0x2066('0x225'),'Error','interval\x20=\x20'+_0xd25596));}if(_0x17b16f<=0x0||isNaN(_0x17b16f)){return _0x406cfe(msgResponse(_0x2066('0x225'),_0x2066('0x88'),_0x2066('0x226')+_0x17b16f));}_0x4de48b=_0x4de48b||0x0;var _0x336fff=0x1/_0x5cd138;var _0xf40d1=0x0;var _0x465c58=0x0;var _0x52754c=0x0;var _0x3ea746=0x0;for(var _0x4271fc=0x0;_0x3ea746<_0x17b16f;_0x4271fc+=0x1){_0x465c58=_0x4271fc/_0xd25596;_0xf40d1=(_0x363c5b*_0x465c58+_0x4de48b)/_0x336fff;_0x52754c=utils[_0x2066('0x223')](_0xf40d1,_0x21b432);_0x3ea746=_0xf40d1/_0x21b432*(0x1-utils[_0x2066('0x223')](_0xf40d1,_0x21b432));}return _0x4ef7d4({'erlangCalls':_0x4271fc,'erlangCallToSecond':_0xd25596/_0x4271fc,'erlangAbandonmentRate':_0x52754c,'erlangBusyFactor':_0x3ea746});});};module[_0x2066('0x227')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index a4fdcb1..67ae04a 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 _0xb9f4=['callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','exports','util','lodash','isNil','string','voiceQueue','Contact','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x123390,_0xc6d719){var _0x830896=function(_0x355cfb){while(--_0x355cfb){_0x123390['push'](_0x123390['shift']());}};_0x830896(++_0xc6d719);}(_0xb9f4,0x133));var _0x4b9f=function(_0x5891f4,_0x251d8f){_0x5891f4=_0x5891f4-0x0;var _0x141ca1=_0xb9f4[_0x5891f4];return _0x141ca1;};'use strict';var util=require(_0x4b9f('0x0'));var _=require(_0x4b9f('0x1'));var moment=require('moment');function checkNameSurname(_0x165962,_0xf9cde5,_0x44fbf8){var _0x21025f='';if(!_[_0x4b9f('0x2')](_0xf9cde5)&&_0x4b9f('0x3')===typeof _0xf9cde5){_0x21025f+=_0xf9cde5;}if(!_[_0x4b9f('0x2')](_0x44fbf8)&&_0x4b9f('0x3')===typeof _0x44fbf8){_0x21025f+='\x20'+_0x44fbf8;}if(_0x21025f!==''){return _0x21025f;}return _0x165962;}function Action(_0x357de3,_0x456b85,_0x403236){this[_0x4b9f('0x4')]=_0x357de3;this['uniqueid']=_0x403236||undefined;this['name']=checkNameSurname(_0x456b85['Contact']['phone'],_0x456b85[_0x4b9f('0x5')]['firstName'],_0x456b85['Contact'][_0x4b9f('0x6')]);this['number']=_0x456b85[_0x4b9f('0x7')];this[_0x4b9f('0x8')]=_0x357de3['name'];this['active']=_0x456b85[_0x4b9f('0x9')]||![];this[_0x4b9f('0xa')]=_0x357de3[_0x4b9f('0xa')];this['dialQueueTimeout']=_0x357de3[_0x4b9f('0xb')]||0x3;this['scheduledat']=_0x456b85[_0x4b9f('0xc')];this[_0x4b9f('0xd')]=_0x456b85['countbusyretry'];this[_0x4b9f('0xe')]=_0x456b85[_0x4b9f('0xe')];this[_0x4b9f('0xf')]=_0x456b85[_0x4b9f('0xf')];this[_0x4b9f('0x10')]=_0x456b85[_0x4b9f('0x10')];this[_0x4b9f('0x11')]=_0x456b85[_0x4b9f('0x11')];this[_0x4b9f('0x12')]=_0x456b85['countabandonedretry'];this[_0x4b9f('0x13')]=_0x456b85[_0x4b9f('0x13')];this[_0x4b9f('0x14')]=_0x456b85[_0x4b9f('0x14')];this[_0x4b9f('0x15')]=_0x456b85['ContactId'];this[_0x4b9f('0x16')]=_0x456b85[_0x4b9f('0x16')];this[_0x4b9f('0x17')]=_0x456b85[_0x4b9f('0x17')];this[_0x4b9f('0x18')]=_0x456b85[_0x4b9f('0x18')];this['CampaignId']=_0x456b85['CampaignId'];this['idHopper']=_0x456b85['id'];this[_0x4b9f('0x19')]=_0x456b85[_0x4b9f('0x5')][_0x4b9f('0x1a')]||'';this[_0x4b9f('0x1b')]=moment()['format'](_0x4b9f('0x1c'));this[_0x4b9f('0x1d')]=_0x456b85[_0x4b9f('0x1d')];this[_0x4b9f('0x1e')]=_0x456b85['callbackuniqueid'];this[_0x4b9f('0x1f')]=_0x456b85['callbackat'];this[_0x4b9f('0x20')]=_0x456b85[_0x4b9f('0x20')];this[_0x4b9f('0x21')]='';this[_0x4b9f('0x22')]='';}Action[_0x4b9f('0x23')]['getCaller']=function(){return util[_0x4b9f('0x24')](_0x4b9f('0x25'),this['name'],this[_0x4b9f('0x4')][_0x4b9f('0x26')]>0x0?this[_0x4b9f('0x27')][_0x4b9f('0x28')](this[_0x4b9f('0x4')][_0x4b9f('0x26')]):this[_0x4b9f('0x27')]);};Action[_0x4b9f('0x23')]['getQueue']=function(){return this[_0x4b9f('0x8')];};module[_0x4b9f('0x29')]=Action; \ No newline at end of file +var _0xf750=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type'];(function(_0x336e7a,_0x211e1a){var _0x3764db=function(_0x19fdbd){while(--_0x19fdbd){_0x336e7a['push'](_0x336e7a['shift']());}};_0x3764db(++_0x211e1a);}(_0xf750,0x18d));var _0x0f75=function(_0x32bb12,_0x1baa09){_0x32bb12=_0x32bb12-0x0;var _0x1af866=_0xf750[_0x32bb12];return _0x1af866;};'use strict';var util=require(_0x0f75('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x50f57e,_0x34f7bb,_0x521fbe){var _0x1fe2b1='';if(!_[_0x0f75('0x1')](_0x34f7bb)&&_0x0f75('0x2')===typeof _0x34f7bb){_0x1fe2b1+=_0x34f7bb;}if(!_[_0x0f75('0x1')](_0x521fbe)&&_0x0f75('0x2')===typeof _0x521fbe){_0x1fe2b1+='\x20'+_0x521fbe;}if(_0x1fe2b1!==''){return _0x1fe2b1;}return _0x50f57e;}function Action(_0x10f7da,_0x3bb3cb,_0x18fab1){this[_0x0f75('0x3')]=_0x10f7da;this[_0x0f75('0x4')]=_0x18fab1||undefined;this[_0x0f75('0x5')]=checkNameSurname(_0x3bb3cb[_0x0f75('0x6')][_0x0f75('0x7')],_0x3bb3cb[_0x0f75('0x6')]['firstName'],_0x3bb3cb[_0x0f75('0x6')][_0x0f75('0x8')]);this[_0x0f75('0x9')]=_0x3bb3cb['phone'];this[_0x0f75('0xa')]=_0x10f7da['name'];this[_0x0f75('0xb')]=_0x3bb3cb[_0x0f75('0xb')]||![];this['type']=_0x10f7da[_0x0f75('0xc')];this['dialQueueTimeout']=_0x10f7da[_0x0f75('0xd')]||0x3;this[_0x0f75('0xe')]=_0x3bb3cb[_0x0f75('0xe')];this[_0x0f75('0xf')]=_0x3bb3cb[_0x0f75('0xf')];this[_0x0f75('0x10')]=_0x3bb3cb[_0x0f75('0x10')];this['countnoanswerretry']=_0x3bb3cb[_0x0f75('0x11')];this[_0x0f75('0x12')]=_0x3bb3cb[_0x0f75('0x12')];this['countdropretry']=_0x3bb3cb[_0x0f75('0x13')];this[_0x0f75('0x14')]=_0x3bb3cb[_0x0f75('0x14')];this[_0x0f75('0x15')]=_0x3bb3cb[_0x0f75('0x15')];this[_0x0f75('0x16')]=_0x3bb3cb[_0x0f75('0x16')];this[_0x0f75('0x17')]=_0x3bb3cb[_0x0f75('0x17')];this['ListId']=_0x3bb3cb['ListId'];this['UserId']=_0x3bb3cb[_0x0f75('0x18')];this[_0x0f75('0x19')]=_0x3bb3cb[_0x0f75('0x19')];this['CampaignId']=_0x3bb3cb['CampaignId'];this['idHopper']=_0x3bb3cb['id'];this[_0x0f75('0x1a')]=_0x3bb3cb[_0x0f75('0x6')][_0x0f75('0x1b')]||'';this[_0x0f75('0x1c')]=moment()['format'](_0x0f75('0x1d'));this['callback']=_0x3bb3cb[_0x0f75('0x1e')];this[_0x0f75('0x1f')]=_0x3bb3cb[_0x0f75('0x1f')];this[_0x0f75('0x20')]=_0x3bb3cb['callbackat'];this[_0x0f75('0x21')]=_0x3bb3cb['recallme'];this['originatecalleridnum']='';this[_0x0f75('0x22')]='';}Action['prototype'][_0x0f75('0x23')]=function(){return util['format'](_0x0f75('0x24'),this[_0x0f75('0x5')],this[_0x0f75('0x3')][_0x0f75('0x25')]>0x0?this[_0x0f75('0x9')][_0x0f75('0x26')](this['voiceQueue'][_0x0f75('0x25')]):this[_0x0f75('0x9')]);};Action['prototype'][_0x0f75('0x27')]=function(){return this[_0x0f75('0xa')];};module[_0x0f75('0x28')]=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 a14983f..e2fd296 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 _0x5c10=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid'];(function(_0x473bae,_0x52a02){var _0x93f33=function(_0x31e126){while(--_0x31e126){_0x473bae['push'](_0x473bae['shift']());}};_0x93f33(++_0x52a02);}(_0x5c10,0xcb));var _0x05c1=function(_0x3f58ba,_0x7501f7){_0x3f58ba=_0x3f58ba-0x0;var _0x3d2e0f=_0x5c10[_0x3f58ba];return _0x3d2e0f;};'use strict';var moment=require(_0x05c1('0x0'));var utils=require(_0x05c1('0x1'));function AgentComplete(_0x568462,_0x5ca9d9){this[_0x05c1('0x2')]=0x4;this[_0x05c1('0x3')]=_0x05c1('0x4');this[_0x05c1('0x5')]=_0x568462[_0x05c1('0x5')];this[_0x05c1('0x6')]=_0x568462['type'];this[_0x05c1('0x7')]=_0x568462[_0x05c1('0x6')]===_0x05c1('0x8')?_0x05c1('0x9'):_0x568462[_0x05c1('0x6')];this[_0x05c1('0xa')]=_0x568462[_0x05c1('0xa')];this['countcongestionretry']=_0x568462[_0x05c1('0xb')];this[_0x05c1('0xc')]=_0x568462[_0x05c1('0xc')];this[_0x05c1('0xd')]=_0x568462[_0x05c1('0xa')]+_0x568462['countcongestionretry']+_0x568462[_0x05c1('0xc')]+_0x568462['countnosuchnumberretry']+_0x568462[_0x05c1('0xe')]+_0x568462[_0x05c1('0xf')]+_0x568462[_0x05c1('0x10')]+_0x568462[_0x05c1('0x11')];this[_0x05c1('0x12')]=_0x568462[_0x05c1('0x12')];this[_0x05c1('0xe')]=_0x568462[_0x05c1('0xe')];this[_0x05c1('0xf')]=_0x568462[_0x05c1('0xf')];this[_0x05c1('0x10')]=_0x568462[_0x05c1('0x10')];this[_0x05c1('0x11')]=_0x568462[_0x05c1('0x11')];this[_0x05c1('0x13')]=_0x5ca9d9[_0x05c1('0x13')];this[_0x05c1('0x14')]=_0x568462[_0x05c1('0x15')];this[_0x05c1('0x16')]=_0x568462['number'];this[_0x05c1('0x17')]=_0x568462[_0x05c1('0x17')];this[_0x05c1('0x18')]=_0x568462[_0x05c1('0x18')];this[_0x05c1('0x19')]=_0x568462[_0x05c1('0x19')];this[_0x05c1('0x1a')]=moment()[_0x05c1('0x1b')](_0x05c1('0x1c'));this[_0x05c1('0x1d')]=utils[_0x05c1('0x1e')](_0x568462['responsetime'],_0x568462[_0x05c1('0x17')]);this[_0x05c1('0x1f')]=utils[_0x05c1('0x1e')](_0x568462[_0x05c1('0x19')],_0x568462[_0x05c1('0x18')]);this[_0x05c1('0x20')]=utils[_0x05c1('0x1e')](this[_0x05c1('0x1a')],_0x568462[_0x05c1('0x19')]);this[_0x05c1('0x9')]=_0x5ca9d9[_0x05c1('0x9')];this[_0x05c1('0x21')]=_0x5ca9d9[_0x05c1('0x21')];this[_0x05c1('0x22')]=_0x5ca9d9[_0x05c1('0x22')];this[_0x05c1('0x23')]=_0x568462[_0x05c1('0x23')];this[_0x05c1('0x24')]=_0x568462[_0x05c1('0x24')];this[_0x05c1('0x25')]=_0x568462['callbackat'];this[_0x05c1('0x26')]=_0x568462['recallme'];this[_0x05c1('0x27')]=_0x568462['ContactId'];this[_0x05c1('0x28')]=_0x568462[_0x05c1('0x28')];this['UserId']=_0x568462[_0x05c1('0x29')];this['VoiceQueueId']=_0x568462[_0x05c1('0x2a')];this['CampaignId']=_0x568462[_0x05c1('0x2b')];this[_0x05c1('0x2c')]=_0x568462['originatecalleridnum']||'';this[_0x05c1('0x2d')]=_0x568462[_0x05c1('0x2d')]||'';this['agiafterat']=_0x568462[_0x05c1('0x2e')];}module[_0x05c1('0x2f')]=AgentComplete; \ No newline at end of file +var _0x8ab6=['membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','endtime'];(function(_0x5a0fea,_0x165294){var _0xb1fbdb=function(_0x2bce29){while(--_0x2bce29){_0x5a0fea['push'](_0x5a0fea['shift']());}};_0xb1fbdb(++_0x165294);}(_0x8ab6,0xda));var _0x68ab=function(_0x2efa61,_0x2f33cc){_0x2efa61=_0x2efa61-0x0;var _0x2651c4=_0x8ab6[_0x2efa61];return _0x2651c4;};'use strict';var moment=require(_0x68ab('0x0'));var utils=require(_0x68ab('0x1'));function AgentComplete(_0x2d80c8,_0x3a477a){this['state']=0x4;this['statedesc']='Answer';this['scheduledat']=_0x2d80c8['scheduledat'];this[_0x68ab('0x2')]=_0x2d80c8[_0x68ab('0x2')];this[_0x68ab('0x3')]=_0x2d80c8['type']===_0x68ab('0x4')?_0x68ab('0x5'):_0x2d80c8[_0x68ab('0x2')];this['countbusyretry']=_0x2d80c8[_0x68ab('0x6')];this[_0x68ab('0x7')]=_0x2d80c8[_0x68ab('0x7')];this[_0x68ab('0x8')]=_0x2d80c8[_0x68ab('0x8')];this[_0x68ab('0x9')]=_0x2d80c8[_0x68ab('0x6')]+_0x2d80c8[_0x68ab('0x7')]+_0x2d80c8[_0x68ab('0x8')]+_0x2d80c8[_0x68ab('0xa')]+_0x2d80c8[_0x68ab('0xb')]+_0x2d80c8[_0x68ab('0xc')]+_0x2d80c8['countmachineretry']+_0x2d80c8[_0x68ab('0xd')];this[_0x68ab('0xa')]=_0x2d80c8['countnosuchnumberretry'];this[_0x68ab('0xb')]=_0x2d80c8[_0x68ab('0xb')];this[_0x68ab('0xc')]=_0x2d80c8[_0x68ab('0xc')];this[_0x68ab('0xe')]=_0x2d80c8['countmachineretry'];this['countagentrejectretry']=_0x2d80c8['countagentrejectretry'];this['uniqueid']=_0x3a477a['uniqueid'];this['calleridname']=_0x2d80c8[_0x68ab('0xf')];this[_0x68ab('0x10')]=_0x2d80c8[_0x68ab('0x11')];this[_0x68ab('0x12')]=_0x2d80c8[_0x68ab('0x12')];this['responsetime']=_0x2d80c8[_0x68ab('0x13')];this[_0x68ab('0x14')]=_0x2d80c8[_0x68ab('0x14')];this['endtime']=moment()[_0x68ab('0x15')](_0x68ab('0x16'));this[_0x68ab('0x17')]=utils[_0x68ab('0x18')](_0x2d80c8['responsetime'],_0x2d80c8[_0x68ab('0x12')]);this[_0x68ab('0x19')]=utils[_0x68ab('0x18')](_0x2d80c8[_0x68ab('0x14')],_0x2d80c8['responsetime']);this[_0x68ab('0x1a')]=utils[_0x68ab('0x18')](this[_0x68ab('0x1b')],_0x2d80c8['answertime']);this['queue']=_0x3a477a[_0x68ab('0x5')];this[_0x68ab('0x1c')]=_0x3a477a[_0x68ab('0x1c')];this['reason']=_0x3a477a[_0x68ab('0x1d')];this['callback']=_0x2d80c8['callback'];this[_0x68ab('0x1e')]=_0x2d80c8[_0x68ab('0x1e')];this[_0x68ab('0x1f')]=_0x2d80c8['callbackat'];this[_0x68ab('0x20')]=_0x2d80c8['recallme'];this[_0x68ab('0x21')]=_0x2d80c8[_0x68ab('0x21')];this[_0x68ab('0x22')]=_0x2d80c8['ListId'];this[_0x68ab('0x23')]=_0x2d80c8[_0x68ab('0x23')];this[_0x68ab('0x24')]=_0x2d80c8['VoiceQueueId'];this['CampaignId']=_0x2d80c8['CampaignId'];this[_0x68ab('0x25')]=_0x2d80c8['originatecalleridnum']||'';this[_0x68ab('0x26')]=_0x2d80c8[_0x68ab('0x26')]||'';this[_0x68ab('0x27')]=_0x2d80c8[_0x68ab('0x27')];}module[_0x68ab('0x28')]=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 5c29920..344f9ed 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 _0xb231=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x478f6b,_0x32d534){var _0x56dc63=function(_0x20631a){while(--_0x20631a){_0x478f6b['push'](_0x478f6b['shift']());}};_0x56dc63(++_0x32d534);}(_0xb231,0x1b6));var _0x1b23=function(_0x4c3f40,_0x39f8bc){_0x4c3f40=_0x4c3f40-0x0;var _0x5f10cb=_0xb231[_0x4c3f40];return _0x5f10cb;};'use strict';function Final(_0x1acbf8){this[_0x1b23('0x0')]=_0x1acbf8[_0x1b23('0x0')];this[_0x1b23('0x1')]=_0x1acbf8[_0x1b23('0x1')];this['type']=_0x1acbf8[_0x1b23('0x2')];this[_0x1b23('0x3')]=_0x1acbf8[_0x1b23('0x2')]===_0x1b23('0x4')?'queue':_0x1acbf8[_0x1b23('0x2')];this[_0x1b23('0x5')]=_0x1acbf8[_0x1b23('0x5')];this[_0x1b23('0x6')]=_0x1acbf8['countcongestionretry'];this[_0x1b23('0x7')]=_0x1acbf8[_0x1b23('0x7')];this[_0x1b23('0x8')]=_0x1acbf8[_0x1b23('0x5')]+_0x1acbf8[_0x1b23('0x6')]+_0x1acbf8[_0x1b23('0x7')]+_0x1acbf8[_0x1b23('0x9')]+_0x1acbf8[_0x1b23('0xa')]+_0x1acbf8[_0x1b23('0xb')]+_0x1acbf8[_0x1b23('0xc')]+_0x1acbf8[_0x1b23('0xd')];this[_0x1b23('0x9')]=_0x1acbf8[_0x1b23('0x9')];this[_0x1b23('0xa')]=_0x1acbf8[_0x1b23('0xa')];this['countabandonedretry']=_0x1acbf8[_0x1b23('0xb')];this[_0x1b23('0xc')]=_0x1acbf8[_0x1b23('0xc')];this[_0x1b23('0xd')]=_0x1acbf8['countagentrejectretry'];this[_0x1b23('0xe')]=_0x1acbf8['queue'];this[_0x1b23('0xf')]=_0x1acbf8[_0x1b23('0xf')];this[_0x1b23('0x10')]=_0x1acbf8[_0x1b23('0x10')];this['starttime']=_0x1acbf8[_0x1b23('0x11')];this[_0x1b23('0x12')]=_0x1acbf8['responsetime'];this['endtime']=_0x1acbf8[_0x1b23('0x12')];this[_0x1b23('0x13')]=_0x1acbf8[_0x1b23('0x13')]||0x0;this[_0x1b23('0x14')]=_0x1acbf8[_0x1b23('0x14')]||0x0;this[_0x1b23('0x15')]=_0x1acbf8[_0x1b23('0x15')]||0x0;this[_0x1b23('0x16')]=_0x1acbf8[_0x1b23('0x16')];this[_0x1b23('0x17')]=_0x1acbf8[_0x1b23('0x17')];this[_0x1b23('0x18')]=_0x1acbf8[_0x1b23('0x18')];this[_0x1b23('0x19')]=_0x1acbf8[_0x1b23('0x19')];this[_0x1b23('0x1a')]=_0x1acbf8[_0x1b23('0x1a')];this[_0x1b23('0x1b')]=_0x1acbf8['ListId'];this[_0x1b23('0x1c')]=_0x1acbf8[_0x1b23('0x1c')];this[_0x1b23('0x1d')]=_0x1acbf8[_0x1b23('0x1d')];this['CampaignId']=_0x1acbf8[_0x1b23('0x1e')];this[_0x1b23('0x1f')]=_0x1acbf8[_0x1b23('0x1f')]||'';this['originatecalleridname']=_0x1acbf8[_0x1b23('0x20')]||'';this[_0x1b23('0x21')]=_0x1acbf8[_0x1b23('0x21')];this[_0x1b23('0x22')]=_0x1acbf8['statedesc'];}module[_0x1b23('0x23')]=Final; \ No newline at end of file +var _0x2604=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x532ec3,_0x395975){var _0x4e7f2b=function(_0xb6514b){while(--_0xb6514b){_0x532ec3['push'](_0x532ec3['shift']());}};_0x4e7f2b(++_0x395975);}(_0x2604,0x7b));var _0x4260=function(_0x39ef43,_0x54c722){_0x39ef43=_0x39ef43-0x0;var _0x12965d=_0x2604[_0x39ef43];return _0x12965d;};'use strict';function Final(_0x303c23){this[_0x4260('0x0')]=_0x303c23[_0x4260('0x0')];this[_0x4260('0x1')]=_0x303c23['scheduledat'];this[_0x4260('0x2')]=_0x303c23['type'];this[_0x4260('0x3')]=_0x303c23[_0x4260('0x2')]==='outbound'?_0x4260('0x4'):_0x303c23[_0x4260('0x2')];this['countbusyretry']=_0x303c23[_0x4260('0x5')];this[_0x4260('0x6')]=_0x303c23[_0x4260('0x6')];this[_0x4260('0x7')]=_0x303c23['countnoanswerretry'];this[_0x4260('0x8')]=_0x303c23[_0x4260('0x5')]+_0x303c23[_0x4260('0x6')]+_0x303c23[_0x4260('0x7')]+_0x303c23['countnosuchnumberretry']+_0x303c23['countdropretry']+_0x303c23[_0x4260('0x9')]+_0x303c23[_0x4260('0xa')]+_0x303c23[_0x4260('0xb')];this[_0x4260('0xc')]=_0x303c23['countnosuchnumberretry'];this['countdropretry']=_0x303c23['countdropretry'];this[_0x4260('0x9')]=_0x303c23[_0x4260('0x9')];this['countmachineretry']=_0x303c23['countmachineretry'];this[_0x4260('0xb')]=_0x303c23['countagentrejectretry'];this[_0x4260('0x4')]=_0x303c23[_0x4260('0x4')];this['calleridname']=_0x303c23[_0x4260('0xd')];this[_0x4260('0xe')]=_0x303c23['calleridnum'];this[_0x4260('0xf')]=_0x303c23['starttime'];this[_0x4260('0x10')]=_0x303c23['responsetime'];this[_0x4260('0x11')]=_0x303c23[_0x4260('0x10')];this['ringtime']=_0x303c23['ringtime']||0x0;this['holdtime']=_0x303c23[_0x4260('0x12')]||0x0;this[_0x4260('0x13')]=_0x303c23[_0x4260('0x13')]||0x0;this[_0x4260('0x14')]=_0x303c23[_0x4260('0x14')];this[_0x4260('0x15')]=_0x303c23[_0x4260('0x15')];this[_0x4260('0x16')]=_0x303c23[_0x4260('0x16')];this[_0x4260('0x17')]=_0x303c23['recallme'];this['ContactId']=_0x303c23['ContactId'];this[_0x4260('0x18')]=_0x303c23[_0x4260('0x18')];this[_0x4260('0x19')]=_0x303c23['UserId'];this[_0x4260('0x1a')]=_0x303c23[_0x4260('0x1a')];this[_0x4260('0x1b')]=_0x303c23[_0x4260('0x1b')];this[_0x4260('0x1c')]=_0x303c23[_0x4260('0x1c')]||'';this['originatecalleridname']=_0x303c23[_0x4260('0x1d')]||'';this[_0x4260('0x1e')]=_0x303c23['state'];this[_0x4260('0x1f')]=_0x303c23[_0x4260('0x1f')];}module[_0x4260('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 d8fbaa4..8d371d1 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 _0x7d49=['countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','statedesc','scheduledat','type','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal'];(function(_0x4c44e2,_0x44a9f6){var _0x1311a3=function(_0x13e107){while(--_0x13e107){_0x4c44e2['push'](_0x4c44e2['shift']());}};_0x1311a3(++_0x44a9f6);}(_0x7d49,0x1a2));var _0x97d4=function(_0x5ed503,_0x96dfe){_0x5ed503=_0x5ed503-0x0;var _0x34f3c0=_0x7d49[_0x5ed503];return _0x34f3c0;};'use strict';var moment=require(_0x97d4('0x0'));var utils=require(_0x97d4('0x1'));function Hangup(_0x70005e,_0x8fe670){this['state']=0x4;this[_0x97d4('0x2')]='Answer';this[_0x97d4('0x3')]=_0x70005e[_0x97d4('0x3')];this[_0x97d4('0x4')]=_0x70005e[_0x97d4('0x4')];this['campaigntype']=_0x70005e['type']===_0x97d4('0x5')?_0x97d4('0x6'):_0x70005e['type'];this[_0x97d4('0x7')]=_0x70005e[_0x97d4('0x7')]||![];this[_0x97d4('0x8')]=_0x70005e['countbusyretry'];this['countcongestionretry']=_0x70005e['countcongestionretry'];this[_0x97d4('0x9')]=_0x70005e[_0x97d4('0x9')];this[_0x97d4('0xa')]=_0x70005e['countbusyretry']+_0x70005e[_0x97d4('0xb')]+_0x70005e[_0x97d4('0x9')]+_0x70005e[_0x97d4('0xc')]+_0x70005e[_0x97d4('0xd')]+_0x70005e[_0x97d4('0xe')]+_0x70005e[_0x97d4('0xf')]+_0x70005e[_0x97d4('0x10')];this['countnosuchnumberretry']=_0x70005e[_0x97d4('0xc')];this['countdropretry']=_0x70005e[_0x97d4('0xd')];this['countabandonedretry']=_0x70005e[_0x97d4('0xe')];this[_0x97d4('0xf')]=_0x70005e[_0x97d4('0xf')];this['countagentrejectretry']=_0x70005e[_0x97d4('0x10')];this['uniqueid']=_0x8fe670[_0x97d4('0x11')];this[_0x97d4('0x12')]=_0x70005e[_0x97d4('0x13')];this['calleridnum']=_0x70005e['number'];this['starttime']=_0x70005e[_0x97d4('0x14')];this[_0x97d4('0x15')]=_0x70005e[_0x97d4('0x15')];this[_0x97d4('0x16')]=moment()['format'](_0x97d4('0x17'));this[_0x97d4('0x18')]=utils[_0x97d4('0x19')](_0x70005e[_0x97d4('0x15')],_0x70005e[_0x97d4('0x14')]);this[_0x97d4('0x1a')]=0x0;this['talktime']=utils['getSeconds'](this[_0x97d4('0x16')],_0x70005e[_0x97d4('0x15')]);this['queue']=_0x70005e[_0x97d4('0x6')];this['membername']=_0x97d4('0x1b');this[_0x97d4('0x1c')]=_0x8fe670[_0x97d4('0x1d')];this[_0x97d4('0x1e')]=_0x70005e[_0x97d4('0x1e')];this[_0x97d4('0x1f')]=_0x70005e[_0x97d4('0x1f')];this['callbackat']=_0x70005e[_0x97d4('0x20')];this['recallme']=_0x70005e[_0x97d4('0x21')];this[_0x97d4('0x22')]=_0x70005e[_0x97d4('0x22')];this['ListId']=_0x70005e['ListId'];this['UserId']=_0x70005e[_0x97d4('0x23')];this[_0x97d4('0x24')]=_0x70005e[_0x97d4('0x24')];this[_0x97d4('0x25')]=_0x70005e[_0x97d4('0x25')];}module[_0x97d4('0x26')]=Hangup; \ No newline at end of file +var _0xbdfd=['YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime'];(function(_0x1c0711,_0x56a619){var _0x377178=function(_0x4dad2b){while(--_0x4dad2b){_0x1c0711['push'](_0x1c0711['shift']());}};_0x377178(++_0x56a619);}(_0xbdfd,0x10d));var _0xdbdf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbdfd[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xdbdf('0x0'));var utils=require(_0xdbdf('0x1'));function Hangup(_0x48d5e6,_0xc33dc3){this[_0xdbdf('0x2')]=0x4;this[_0xdbdf('0x3')]='Answer';this[_0xdbdf('0x4')]=_0x48d5e6[_0xdbdf('0x4')];this[_0xdbdf('0x5')]=_0x48d5e6['type'];this['campaigntype']=_0x48d5e6['type']===_0xdbdf('0x6')?_0xdbdf('0x7'):_0x48d5e6[_0xdbdf('0x5')];this[_0xdbdf('0x8')]=_0x48d5e6['amd']||![];this[_0xdbdf('0x9')]=_0x48d5e6[_0xdbdf('0x9')];this[_0xdbdf('0xa')]=_0x48d5e6[_0xdbdf('0xa')];this[_0xdbdf('0xb')]=_0x48d5e6[_0xdbdf('0xb')];this[_0xdbdf('0xc')]=_0x48d5e6['countbusyretry']+_0x48d5e6[_0xdbdf('0xa')]+_0x48d5e6[_0xdbdf('0xb')]+_0x48d5e6['countnosuchnumberretry']+_0x48d5e6[_0xdbdf('0xd')]+_0x48d5e6[_0xdbdf('0xe')]+_0x48d5e6[_0xdbdf('0xf')]+_0x48d5e6[_0xdbdf('0x10')];this[_0xdbdf('0x11')]=_0x48d5e6[_0xdbdf('0x11')];this[_0xdbdf('0xd')]=_0x48d5e6['countdropretry'];this[_0xdbdf('0xe')]=_0x48d5e6[_0xdbdf('0xe')];this[_0xdbdf('0xf')]=_0x48d5e6[_0xdbdf('0xf')];this[_0xdbdf('0x10')]=_0x48d5e6['countagentrejectretry'];this[_0xdbdf('0x12')]=_0xc33dc3[_0xdbdf('0x12')];this[_0xdbdf('0x13')]=_0x48d5e6[_0xdbdf('0x14')];this['calleridnum']=_0x48d5e6[_0xdbdf('0x15')];this[_0xdbdf('0x16')]=_0x48d5e6['starttime'];this[_0xdbdf('0x17')]=_0x48d5e6[_0xdbdf('0x17')];this[_0xdbdf('0x18')]=moment()['format'](_0xdbdf('0x19'));this[_0xdbdf('0x1a')]=utils[_0xdbdf('0x1b')](_0x48d5e6[_0xdbdf('0x17')],_0x48d5e6[_0xdbdf('0x16')]);this[_0xdbdf('0x1c')]=0x0;this[_0xdbdf('0x1d')]=utils[_0xdbdf('0x1b')](this[_0xdbdf('0x18')],_0x48d5e6[_0xdbdf('0x17')]);this[_0xdbdf('0x7')]=_0x48d5e6[_0xdbdf('0x7')];this[_0xdbdf('0x1e')]='IVR';this['reason']=_0xc33dc3[_0xdbdf('0x1f')];this['callback']=_0x48d5e6[_0xdbdf('0x20')];this[_0xdbdf('0x21')]=_0x48d5e6[_0xdbdf('0x21')];this[_0xdbdf('0x22')]=_0x48d5e6['callbackat'];this[_0xdbdf('0x23')]=_0x48d5e6[_0xdbdf('0x23')];this[_0xdbdf('0x24')]=_0x48d5e6[_0xdbdf('0x24')];this[_0xdbdf('0x25')]=_0x48d5e6[_0xdbdf('0x25')];this[_0xdbdf('0x26')]=_0x48d5e6['UserId'];this[_0xdbdf('0x27')]=_0x48d5e6[_0xdbdf('0x27')];this['CampaignId']=_0x48d5e6[_0xdbdf('0x28')];}module[_0xdbdf('0x29')]=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 08ef4c6..44f7415 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 _0x09ec=['uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils'];(function(_0x1c16d9,_0x247f1d){var _0x50ae11=function(_0x52f18d){while(--_0x52f18d){_0x1c16d9['push'](_0x1c16d9['shift']());}};_0x50ae11(++_0x247f1d);}(_0x09ec,0x109));var _0xc09e=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x09ec[_0x424a9a];return _0xa7831c;};'use strict';var utils=require(_0xc09e('0x0'));function History(_0x2cf3f4){this[_0xc09e('0x1')]=_0x2cf3f4[_0xc09e('0x1')];this[_0xc09e('0x2')]=_0x2cf3f4['scheduledat']||undefined;this[_0xc09e('0x3')]=_0x2cf3f4[_0xc09e('0x3')];this[_0xc09e('0x4')]=_0x2cf3f4['type']==='outbound'?_0xc09e('0x5'):_0x2cf3f4[_0xc09e('0x3')];this[_0xc09e('0x6')]=_0x2cf3f4[_0xc09e('0x6')];this[_0xc09e('0x7')]=_0x2cf3f4['countcongestionretry'];this[_0xc09e('0x8')]=_0x2cf3f4[_0xc09e('0x8')];this[_0xc09e('0x9')]=_0x2cf3f4[_0xc09e('0x6')]+_0x2cf3f4[_0xc09e('0x7')]+_0x2cf3f4[_0xc09e('0x8')]+_0x2cf3f4[_0xc09e('0xa')]+_0x2cf3f4[_0xc09e('0xb')]+_0x2cf3f4[_0xc09e('0xc')]+_0x2cf3f4[_0xc09e('0xd')]+_0x2cf3f4[_0xc09e('0xe')];this[_0xc09e('0xa')]=_0x2cf3f4[_0xc09e('0xa')];this[_0xc09e('0xb')]=_0x2cf3f4[_0xc09e('0xb')];this['countabandonedretry']=_0x2cf3f4[_0xc09e('0xc')];this[_0xc09e('0xd')]=_0x2cf3f4['countmachineretry'];this[_0xc09e('0xe')]=_0x2cf3f4[_0xc09e('0xe')];this[_0xc09e('0x5')]=_0x2cf3f4['queue'];this[_0xc09e('0xf')]=_0x2cf3f4[_0xc09e('0x10')];this[_0xc09e('0x11')]=_0x2cf3f4['number'];this[_0xc09e('0x12')]=_0x2cf3f4[_0xc09e('0x12')];this[_0xc09e('0x13')]=_0x2cf3f4[_0xc09e('0x13')];this[_0xc09e('0x14')]=_0x2cf3f4['responsetime'];this[_0xc09e('0x15')]=utils[_0xc09e('0x16')](_0x2cf3f4[_0xc09e('0x13')],_0x2cf3f4[_0xc09e('0x12')]);this[_0xc09e('0x17')]=0x0;this[_0xc09e('0x18')]=0x0;this['callback']=_0x2cf3f4[_0xc09e('0x19')];this[_0xc09e('0x1a')]=_0x2cf3f4['callbackuniqueid'];this[_0xc09e('0x1b')]=_0x2cf3f4[_0xc09e('0x1b')];this[_0xc09e('0x1c')]=_0x2cf3f4[_0xc09e('0x1c')];this[_0xc09e('0x1d')]=_0x2cf3f4[_0xc09e('0x1d')];this[_0xc09e('0x1e')]=_0x2cf3f4['ListId'];this[_0xc09e('0x1f')]=_0x2cf3f4[_0xc09e('0x1f')];this[_0xc09e('0x20')]=_0x2cf3f4['VoiceQueueId'];this[_0xc09e('0x21')]=_0x2cf3f4[_0xc09e('0x21')];this[_0xc09e('0x22')]=_0x2cf3f4[_0xc09e('0x22')]||'';this['originatecalleridname']=_0x2cf3f4[_0xc09e('0x23')]||'';this[_0xc09e('0x24')]=_0x2cf3f4[_0xc09e('0x24')];this[_0xc09e('0x25')]=_0x2cf3f4['statedesc'];}module['exports']=History; \ No newline at end of file +var _0xc63e=['CampaignId','originatecalleridnum','originatecalleridname','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','calleridname','name','number','starttime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId'];(function(_0x134c95,_0x49ed19){var _0x5ac841=function(_0x442161){while(--_0x442161){_0x134c95['push'](_0x134c95['shift']());}};_0x5ac841(++_0x49ed19);}(_0xc63e,0x1d3));var _0xec63=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xc63e[_0x5d4f12];return _0x4eb577;};'use strict';var utils=require(_0xec63('0x0'));function History(_0x2c8f3d){this[_0xec63('0x1')]=_0x2c8f3d[_0xec63('0x1')];this['scheduledat']=_0x2c8f3d[_0xec63('0x2')]||undefined;this['type']=_0x2c8f3d[_0xec63('0x3')];this[_0xec63('0x4')]=_0x2c8f3d[_0xec63('0x3')]==='outbound'?_0xec63('0x5'):_0x2c8f3d['type'];this[_0xec63('0x6')]=_0x2c8f3d[_0xec63('0x6')];this[_0xec63('0x7')]=_0x2c8f3d[_0xec63('0x7')];this['countnoanswerretry']=_0x2c8f3d[_0xec63('0x8')];this[_0xec63('0x9')]=_0x2c8f3d[_0xec63('0x6')]+_0x2c8f3d[_0xec63('0x7')]+_0x2c8f3d[_0xec63('0x8')]+_0x2c8f3d[_0xec63('0xa')]+_0x2c8f3d['countdropretry']+_0x2c8f3d[_0xec63('0xb')]+_0x2c8f3d[_0xec63('0xc')]+_0x2c8f3d['countagentrejectretry'];this[_0xec63('0xa')]=_0x2c8f3d['countnosuchnumberretry'];this[_0xec63('0xd')]=_0x2c8f3d[_0xec63('0xd')];this[_0xec63('0xb')]=_0x2c8f3d[_0xec63('0xb')];this[_0xec63('0xc')]=_0x2c8f3d[_0xec63('0xc')];this['countagentrejectretry']=_0x2c8f3d['countagentrejectretry'];this[_0xec63('0x5')]=_0x2c8f3d['queue'];this[_0xec63('0xe')]=_0x2c8f3d[_0xec63('0xf')];this['calleridnum']=_0x2c8f3d[_0xec63('0x10')];this[_0xec63('0x11')]=_0x2c8f3d['starttime'];this[_0xec63('0x12')]=_0x2c8f3d[_0xec63('0x12')];this['endtime']=_0x2c8f3d[_0xec63('0x12')];this[_0xec63('0x13')]=utils[_0xec63('0x14')](_0x2c8f3d[_0xec63('0x12')],_0x2c8f3d[_0xec63('0x11')]);this['holdtime']=0x0;this[_0xec63('0x15')]=0x0;this[_0xec63('0x16')]=_0x2c8f3d[_0xec63('0x16')];this[_0xec63('0x17')]=_0x2c8f3d[_0xec63('0x17')];this[_0xec63('0x18')]=_0x2c8f3d[_0xec63('0x18')];this[_0xec63('0x19')]=_0x2c8f3d['recallme'];this['ContactId']=_0x2c8f3d['ContactId'];this[_0xec63('0x1a')]=_0x2c8f3d[_0xec63('0x1a')];this['UserId']=_0x2c8f3d['UserId'];this['VoiceQueueId']=_0x2c8f3d[_0xec63('0x1b')];this[_0xec63('0x1c')]=_0x2c8f3d['CampaignId'];this[_0xec63('0x1d')]=_0x2c8f3d['originatecalleridnum']||'';this[_0xec63('0x1e')]=_0x2c8f3d['originatecalleridname']||'';this['state']=_0x2c8f3d['state'];this[_0xec63('0x1f')]=_0x2c8f3d[_0xec63('0x1f')];}module[_0xec63('0x20')]=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 434b923..62a54b0 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 _0xea47=['countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','starttime','droptime','dropreason','responsetime','getSeconds','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','agiafterat','state','exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x4419bb,_0x4bcbc2){var _0xce44a4=function(_0x3e6aef){while(--_0x3e6aef){_0x4419bb['push'](_0x4419bb['shift']());}};_0xce44a4(++_0x4bcbc2);}(_0xea47,0x8e));var _0x7ea4=function(_0x5b2e8f,_0x4bf0ed){_0x5b2e8f=_0x5b2e8f-0x0;var _0x167dea=_0xea47[_0x5b2e8f];return _0x167dea;};'use strict';var utils=require(_0x7ea4('0x0'));function QueueCallerAbandon(_0x248911,_0x5ddb29){this[_0x7ea4('0x1')]=_0x248911[_0x7ea4('0x1')];this[_0x7ea4('0x2')]=_0x248911[_0x7ea4('0x2')];this['campaigntype']=_0x248911[_0x7ea4('0x2')]==='outbound'?'queue':_0x248911[_0x7ea4('0x2')];this[_0x7ea4('0x3')]=_0x248911['countbusyretry'];this[_0x7ea4('0x4')]=_0x248911[_0x7ea4('0x4')];this[_0x7ea4('0x5')]=_0x248911[_0x7ea4('0x5')];this[_0x7ea4('0x6')]=_0x248911['countbusyretry']+_0x248911['countcongestionretry']+_0x248911[_0x7ea4('0x5')]+_0x248911[_0x7ea4('0x7')]+_0x248911['countdropretry']+_0x248911[_0x7ea4('0x8')]+_0x248911[_0x7ea4('0x9')]+_0x248911[_0x7ea4('0xa')];this[_0x7ea4('0x7')]=_0x248911[_0x7ea4('0x7')];this[_0x7ea4('0xb')]=_0x248911[_0x7ea4('0xb')];this[_0x7ea4('0x8')]=_0x248911[_0x7ea4('0x8')];this[_0x7ea4('0x9')]=_0x248911[_0x7ea4('0x9')];this['countagentrejectretry']=_0x248911['countagentrejectretry'];this['uniqueid']=_0x5ddb29['uniqueid'];this[_0x7ea4('0xc')]=_0x248911[_0x7ea4('0xd')];this[_0x7ea4('0xe')]=_0x248911['number'];this['starttime']=_0x248911[_0x7ea4('0xf')];this['responsetime']=_0x248911['responsetime'];this[_0x7ea4('0x10')]=_0x248911[_0x7ea4('0x10')];this[_0x7ea4('0x11')]=_0x248911['dropreason'];this['endtime']=this[_0x7ea4('0x10')];this['ringtime']=utils['getSeconds'](_0x248911[_0x7ea4('0x12')],_0x248911['starttime']);this['holdtime']=utils[_0x7ea4('0x13')](this[_0x7ea4('0x10')],_0x248911['responsetime']);this[_0x7ea4('0x14')]=0x0;this['queue']=_0x5ddb29[_0x7ea4('0x15')];this[_0x7ea4('0x16')]=_0x5ddb29[_0x7ea4('0x17')];this['reason']=_0x5ddb29[_0x7ea4('0x18')];this[_0x7ea4('0x19')]=_0x248911[_0x7ea4('0x19')];this[_0x7ea4('0x1a')]=_0x248911['callbackuniqueid'];this[_0x7ea4('0x1b')]=_0x248911[_0x7ea4('0x1b')];this[_0x7ea4('0x1c')]=_0x248911[_0x7ea4('0x1c')];this[_0x7ea4('0x1d')]=_0x248911['ContactId'];this[_0x7ea4('0x1e')]=_0x248911['ListId'];this['UserId']=_0x248911[_0x7ea4('0x1f')];this[_0x7ea4('0x20')]=_0x248911[_0x7ea4('0x20')];this['CampaignId']=_0x248911['CampaignId'];this[_0x7ea4('0x21')]=_0x248911[_0x7ea4('0x21')]||'';this['originatecalleridname']=_0x248911['originatecalleridname']||'';this[_0x7ea4('0x22')]=_0x248911[_0x7ea4('0x22')];this[_0x7ea4('0x23')]=_0x248911[_0x7ea4('0x23')];this['statedesc']=_0x248911['statedesc'];}module[_0x7ea4('0x24')]=QueueCallerAbandon; \ No newline at end of file +var _0x767b=['type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','dropreason','droptime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat'];(function(_0x2c1841,_0x505204){var _0x28d148=function(_0x5be79f){while(--_0x5be79f){_0x2c1841['push'](_0x2c1841['shift']());}};_0x28d148(++_0x505204);}(_0x767b,0xd0));var _0xb767=function(_0x25a1ac,_0x113c18){_0x25a1ac=_0x25a1ac-0x0;var _0x13ea3a=_0x767b[_0x25a1ac];return _0x13ea3a;};'use strict';var utils=require(_0xb767('0x0'));function QueueCallerAbandon(_0x17d9e0,_0x96ec90){this[_0xb767('0x1')]=_0x17d9e0[_0xb767('0x1')];this[_0xb767('0x2')]=_0x17d9e0['type'];this['campaigntype']=_0x17d9e0[_0xb767('0x2')]==='outbound'?_0xb767('0x3'):_0x17d9e0[_0xb767('0x2')];this[_0xb767('0x4')]=_0x17d9e0[_0xb767('0x4')];this[_0xb767('0x5')]=_0x17d9e0[_0xb767('0x5')];this[_0xb767('0x6')]=_0x17d9e0[_0xb767('0x6')];this[_0xb767('0x7')]=_0x17d9e0[_0xb767('0x4')]+_0x17d9e0[_0xb767('0x5')]+_0x17d9e0[_0xb767('0x6')]+_0x17d9e0[_0xb767('0x8')]+_0x17d9e0['countdropretry']+_0x17d9e0[_0xb767('0x9')]+_0x17d9e0[_0xb767('0xa')]+_0x17d9e0[_0xb767('0xb')];this[_0xb767('0x8')]=_0x17d9e0[_0xb767('0x8')];this[_0xb767('0xc')]=_0x17d9e0['countdropretry'];this[_0xb767('0x9')]=_0x17d9e0[_0xb767('0x9')];this[_0xb767('0xa')]=_0x17d9e0[_0xb767('0xa')];this[_0xb767('0xb')]=_0x17d9e0[_0xb767('0xb')];this['uniqueid']=_0x96ec90[_0xb767('0xd')];this[_0xb767('0xe')]=_0x17d9e0['name'];this[_0xb767('0xf')]=_0x17d9e0[_0xb767('0x10')];this['starttime']=_0x17d9e0[_0xb767('0x11')];this[_0xb767('0x12')]=_0x17d9e0[_0xb767('0x12')];this['droptime']=_0x17d9e0['droptime'];this[_0xb767('0x13')]=_0x17d9e0[_0xb767('0x13')];this['endtime']=this[_0xb767('0x14')];this[_0xb767('0x15')]=utils['getSeconds'](_0x17d9e0[_0xb767('0x12')],_0x17d9e0[_0xb767('0x11')]);this[_0xb767('0x16')]=utils[_0xb767('0x17')](this[_0xb767('0x14')],_0x17d9e0[_0xb767('0x12')]);this[_0xb767('0x18')]=0x0;this[_0xb767('0x3')]=_0x96ec90[_0xb767('0x3')];this[_0xb767('0x19')]=_0x96ec90[_0xb767('0x1a')];this[_0xb767('0x1b')]=_0x96ec90['reason'];this[_0xb767('0x1c')]=_0x17d9e0['callback'];this['callbackuniqueid']=_0x17d9e0['callbackuniqueid'];this['callbackat']=_0x17d9e0[_0xb767('0x1d')];this[_0xb767('0x1e')]=_0x17d9e0['recallme'];this[_0xb767('0x1f')]=_0x17d9e0[_0xb767('0x1f')];this['ListId']=_0x17d9e0[_0xb767('0x20')];this[_0xb767('0x21')]=_0x17d9e0[_0xb767('0x21')];this[_0xb767('0x22')]=_0x17d9e0[_0xb767('0x22')];this[_0xb767('0x23')]=_0x17d9e0['CampaignId'];this[_0xb767('0x24')]=_0x17d9e0[_0xb767('0x24')]||'';this[_0xb767('0x25')]=_0x17d9e0[_0xb767('0x25')]||'';this[_0xb767('0x26')]=_0x17d9e0[_0xb767('0x26')];this[_0xb767('0x27')]=_0x17d9e0[_0xb767('0x27')];this['statedesc']=_0x17d9e0[_0xb767('0x28')];}module[_0xb767('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 5625796..5a8c3af 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 _0x77d4=['[avgHandleTime]','[createHistory]','createHistory','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','error','getContactDialerIvr','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime'];(function(_0x303269,_0x9f3a2f){var _0x4100c7=function(_0x36e80d){while(--_0x36e80d){_0x303269['push'](_0x303269['shift']());}};_0x4100c7(++_0x9f3a2f);}(_0x77d4,0x108));var _0x477d=function(_0x235cea,_0x4c3504){_0x235cea=_0x235cea-0x0;var _0x15ee93=_0x77d4[_0x235cea];return _0x15ee93;};'use strict';var util=require('util');var logger=require(_0x477d('0x0'))('dialer');var cmHopper=require(_0x477d('0x1'));var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x477d('0x2'));var cmHopperHistory=require(_0x477d('0x3'));function inspectError(_0x53637c){return util['inspect'](_0x53637c,{'showHidden':![],'depth':null});}function getContactDialer(_0x16213f,_0xf3cde0,_0x3d2f8d){return cmHopper[_0x477d('0x4')](_0x16213f['id'],_0xf3cde0,_0x3d2f8d,_0x16213f[_0x477d('0x5')])[_0x477d('0x6')](function(_0x5153df){_0x16213f['temp']=0x0;logger[_0x477d('0x7')]('[getContactDialer]',inspectError(_0x5153df));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x70b0f1,_0x29f11b){return cmHopper[_0x477d('0x8')](_0x70b0f1['id'],_0x29f11b,_0x70b0f1[_0x477d('0x5')])[_0x477d('0x6')](function(_0x58ff29){_0x70b0f1[_0x477d('0x9')]=0x0;logger['error'](_0x477d('0xa'),inspectError(_0x58ff29));});}exports[_0x477d('0x8')]=getContactDialerIvr;function countReScheduled(_0x55ace3){return cmHopper[_0x477d('0xb')](_0x55ace3)[_0x477d('0x6')](function(_0x5a190c){logger['error'](_0x477d('0xc'),inspectError(_0x5a190c));});}exports[_0x477d('0xb')]=countReScheduled;function rescheduleContact(_0x55bdfd){return cmHopper[_0x477d('0xd')](_0x55bdfd)[_0x477d('0x6')](function(_0x48c73a){logger['error'](_0x477d('0xe'),inspectError(_0x48c73a));});}exports['rescheduleContact']=rescheduleContact;function unlockContact(_0x30481f,_0x234b99,_0x25fc02){return cmHopper['unlockContact'](_0x30481f,_0x234b99,_0x25fc02)[_0x477d('0x6')](function(_0x78d1f2){logger[_0x477d('0x7')](_0x477d('0xf'),inspectError(_0x78d1f2));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x28f17a){return cmHopper['moveContactManagedDialer'](_0x28f17a)[_0x477d('0x6')](function(_0x1399d7){logger[_0x477d('0x7')](_0x477d('0x10'),inspectError(_0x1399d7));});}exports[_0x477d('0x11')]=moveContactManagedDialer;function checkIsBlackList(_0x2145ce){return cmHopperBlack['checkIsBlackList'](_0x2145ce)[_0x477d('0x6')](function(_0x49c442){logger[_0x477d('0x7')](_0x477d('0x12'),inspectError(_0x49c442));});}exports[_0x477d('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0x14cbd5){return cmHopperBlack[_0x477d('0x14')](_0x14cbd5)[_0x477d('0x6')](function(_0x435a3b){logger[_0x477d('0x7')](_0x477d('0x15'),inspectError(_0x435a3b));});}exports[_0x477d('0x14')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d2943,_0x3525e8,_0x43c845){return cmHopperAdditionalPhone[_0x477d('0x16')](_0x3d2943,_0x3525e8,_0x43c845)['catch'](function(_0x4481b0){logger['error'](_0x477d('0x17'),inspectError(_0x4481b0));});}exports[_0x477d('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x26a4b2,_0x2287b4,_0x4bb50e){return cmHopperAdditionalPhone[_0x477d('0x18')](_0x26a4b2,_0x2287b4,_0x4bb50e)[_0x477d('0x6')](function(_0x1ca4fe){logger['error']('[swapAdditionalPhone]',inspectError(_0x1ca4fe));});}exports[_0x477d('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x3c6270){return cmHopperHistory[_0x477d('0x19')](_0x3c6270)['catch'](function(_0x254141){logger[_0x477d('0x7')](_0x477d('0x1a'),inspectError(_0x254141));});}exports[_0x477d('0x19')]=avgHandleTime;function createHistory(_0x37b332){return cmHopperHistory['createHistory'](_0x37b332)[_0x477d('0x6')](function(_0xeb02f5){logger[_0x477d('0x7')](_0x477d('0x1b'),inspectError(_0xeb02f5));});}exports[_0x477d('0x1c')]=createHistory; \ No newline at end of file +var _0x68b3=['../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper'];(function(_0x1068c2,_0xe81fac){var _0x5c15a6=function(_0x160350){while(--_0x160350){_0x1068c2['push'](_0x1068c2['shift']());}};_0x5c15a6(++_0xe81fac);}(_0x68b3,0x1d8));var _0x368b=function(_0x4923f4,_0x2cdb7c){_0x4923f4=_0x4923f4-0x0;var _0x45beaa=_0x68b3[_0x4923f4];return _0x45beaa;};'use strict';var util=require(_0x368b('0x0'));var logger=require(_0x368b('0x1'))(_0x368b('0x2'));var cmHopper=require(_0x368b('0x3'));var cmHopperAdditionalPhone=require(_0x368b('0x4'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0x368b('0x5'));function inspectError(_0x3325ac){return util[_0x368b('0x6')](_0x3325ac,{'showHidden':![],'depth':null});}function getContactDialer(_0x404282,_0x5d68cb,_0x12eb8f){return cmHopper[_0x368b('0x7')](_0x404282['id'],_0x5d68cb,_0x12eb8f,_0x404282[_0x368b('0x8')])[_0x368b('0x9')](function(_0x4406c8){_0x404282[_0x368b('0xa')]=0x0;logger[_0x368b('0xb')](_0x368b('0xc'),inspectError(_0x4406c8));});}exports[_0x368b('0x7')]=getContactDialer;function getContactDialerIvr(_0x1f64d8,_0x2a7b9f){return cmHopper['getContactDialerIvr'](_0x1f64d8['id'],_0x2a7b9f,_0x1f64d8[_0x368b('0x8')])[_0x368b('0x9')](function(_0x34a110){_0x1f64d8['temp']=0x0;logger[_0x368b('0xb')](_0x368b('0xd'),inspectError(_0x34a110));});}exports[_0x368b('0xe')]=getContactDialerIvr;function countReScheduled(_0x5924a6){return cmHopper[_0x368b('0xf')](_0x5924a6)[_0x368b('0x9')](function(_0x514dc7){logger[_0x368b('0xb')](_0x368b('0x10'),inspectError(_0x514dc7));});}exports[_0x368b('0xf')]=countReScheduled;function rescheduleContact(_0x4015fe){return cmHopper[_0x368b('0x11')](_0x4015fe)['catch'](function(_0x2b326c){logger[_0x368b('0xb')]('[rescheduleContact]',inspectError(_0x2b326c));});}exports[_0x368b('0x11')]=rescheduleContact;function unlockContact(_0x2aabb9,_0x30c245,_0x515350){return cmHopper[_0x368b('0x12')](_0x2aabb9,_0x30c245,_0x515350)[_0x368b('0x9')](function(_0x1f1029){logger['error'](_0x368b('0x13'),inspectError(_0x1f1029));});}exports[_0x368b('0x12')]=unlockContact;function moveContactManagedDialer(_0x1c2956){return cmHopper['moveContactManagedDialer'](_0x1c2956)['catch'](function(_0x3e2e9f){logger[_0x368b('0xb')](_0x368b('0x14'),inspectError(_0x3e2e9f));});}exports[_0x368b('0x15')]=moveContactManagedDialer;function checkIsBlackList(_0x1a4f20){return cmHopperBlack['checkIsBlackList'](_0x1a4f20)[_0x368b('0x9')](function(_0x44cfe6){logger[_0x368b('0xb')](_0x368b('0x16'),inspectError(_0x44cfe6));});}exports[_0x368b('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x26b206){return cmHopperBlack[_0x368b('0x18')](_0x26b206)[_0x368b('0x9')](function(_0x508e48){logger[_0x368b('0xb')](_0x368b('0x19'),inspectError(_0x508e48));});}exports[_0x368b('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0xc0f7af,_0x286853,_0x4c2fca){return cmHopperAdditionalPhone[_0x368b('0x1a')](_0xc0f7af,_0x286853,_0x4c2fca)[_0x368b('0x9')](function(_0x3a22bd){logger[_0x368b('0xb')](_0x368b('0x1b'),inspectError(_0x3a22bd));});}exports[_0x368b('0x1a')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x430e16,_0x11ea2d,_0x3123c1){return cmHopperAdditionalPhone[_0x368b('0x1c')](_0x430e16,_0x11ea2d,_0x3123c1)[_0x368b('0x9')](function(_0x344d8a){logger[_0x368b('0xb')](_0x368b('0x1d'),inspectError(_0x344d8a));});}exports[_0x368b('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x23a83a){return cmHopperHistory[_0x368b('0x1e')](_0x23a83a)[_0x368b('0x9')](function(_0x39ef94){logger[_0x368b('0xb')](_0x368b('0x1f'),inspectError(_0x39ef94));});}exports[_0x368b('0x1e')]=avgHandleTime;function createHistory(_0x107d2f){return cmHopperHistory[_0x368b('0x20')](_0x107d2f)['catch'](function(_0x4af77a){logger[_0x368b('0xb')](_0x368b('0x21'),inspectError(_0x4af77a));});}exports[_0x368b('0x20')]=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 a5dd477..bd2a4b7 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 _0x180d=['UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','tags','updatedAt','undefined','toUpperCase','substring','XMD-','setXMDContactVariables','lodash','util','../../../../config/environment/shared','ACTIVE','BLACKLIST','DEACTIVATED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','name','includes','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x180d,0x188));var _0xd180=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x180d[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xd180('0x0'));var moment=require('moment');var util=require(_0xd180('0x1'));var logger=require('../../../../config/logger')('dialer');var timezones=require(_0xd180('0x2'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xd180('0x3'),'BLACKLIST':_0xd180('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xd180('0x5'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xd180('0x6'),'INACTIVE':_0xd180('0x7'),'NO_AGENTS_LOGGED':_0xd180('0x8'),'NO_AVAILABLE_CONTACTS':_0xd180('0x9'),'NULL_INTERVAL':_0xd180('0xa'),'OVERTIME_INTERVAL':_0xd180('0xb'),'OVERTIME_GLOBAL_INTERVAL':_0xd180('0xc'),'QUEUE_RECALL':_0xd180('0xd'),'RECALL_TIMEOUT':_0xd180('0xe'),'RUNNING':_0xd180('0xf'),'UNKNOWN_TIMEZONE':_0xd180('0x10'),'UNREACHABLE_TRUNK':_0xd180('0x11')};exports[_0xd180('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x313aa9){return _0x313aa9['dialMethod']===_0xd180('0x13');}exports[_0xd180('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x785137){return _0x785137[_0xd180('0x15')]===_0xd180('0x16');}exports[_0xd180('0x17')]=isIVRCampaign;function isOutboundQueue(_0x582630){return _0x582630[_0xd180('0x15')]===_0xd180('0x18');}exports[_0xd180('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x23029d){return _0x23029d[_0xd180('0x1a')];}exports[_0xd180('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4e0ca7){return _0x4e0ca7[_0xd180('0x1c')];}exports[_0xd180('0x1d')]=isIVRCampaignActive;function getSeconds(_0x4f678e,_0x598f20){var _0x2f423b=moment(_0x4f678e)['milliseconds'](0x0);var _0x3b28f2=moment(_0x598f20)[_0xd180('0x1e')](0x0);return _0x2f423b['diff'](_0x3b28f2,'seconds');}exports[_0xd180('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x3be8fd,_0x10212a){var _0x50210e=![];var _0x331446=_0x3be8fd[_0xd180('0x20')]!==_0x10212a[_0xd180('0x20')]||_0x3be8fd['dialActive']!==_0x10212a[_0xd180('0x1a')]||_0x3be8fd[_0xd180('0x21')]!==_0x10212a['message'];var _0x3ad927=_0x3be8fd[_0xd180('0x22')]!==_0x10212a[_0xd180('0x22')]||_0x3be8fd[_0xd180('0x23')]!==_0x10212a[_0xd180('0x23')]||_0x3be8fd['loggedInDb']!==_0x10212a[_0xd180('0x24')]||_0x3be8fd[_0xd180('0x25')]!==_0x10212a[_0xd180('0x25')]||_0x3be8fd['talking']!==_0x10212a[_0xd180('0x26')]||_0x3be8fd[_0xd180('0x27')]!==_0x10212a[_0xd180('0x27')]||_0x3be8fd[_0xd180('0x28')]!==_0x10212a[_0xd180('0x28')]||_0x3be8fd[_0xd180('0x29')]!==_0x10212a[_0xd180('0x29')]||_0x3be8fd['originated']!==_0x10212a[_0xd180('0x2a')];if(_0x3be8fd[_0xd180('0x2b')]&&_0x10212a[_0xd180('0x2b')]){_0x50210e=_0x3be8fd[_0xd180('0x2b')]['name']!==_0x10212a[_0xd180('0x2b')]['name']||_0x3be8fd[_0xd180('0x2b')][_0xd180('0x1c')]!==_0x10212a[_0xd180('0x2b')][_0xd180('0x1c')];}return _0x331446||_0x3ad927||_0x50210e;}exports[_0xd180('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x250938){var _0x10d905=null;var _0x2c582d=_0x250938[_0xd180('0x2d')];if(_[_0xd180('0x2e')](_0x250938[_0xd180('0x2f')])||_[_0xd180('0x2e')](_0x250938['Interval'])||_[_0xd180('0x2e')](_0x250938[_0xd180('0x30')][_0xd180('0x31')])){_0x10d905=CAMPAIGN_STATUS[_0xd180('0x32')];}else if(_[_0xd180('0x33')](_0x250938[_0xd180('0x2f')])||_[_0xd180('0x33')](_0x250938[_0xd180('0x30')][_0xd180('0x31')])){_0x10d905=CAMPAIGN_STATUS[_0xd180('0x34')];}else if(_0x2c582d&&!timezones[_0x2c582d]){_0x10d905=CAMPAIGN_STATUS[_0xd180('0x35')];}return _0x10d905;}function checkAnyValidTrunk(_0x2d1172,_0x1bf467){var _0x42c060=null;var _0x4ba479=_0xd180('0x36');var _0x540f2d=[_0xd180('0x37'),'unmonitored'];var _0x33fed6=!![];if(_0x2d1172[_0xd180('0x2b')]&&_0x2d1172[_0xd180('0x2b')][_0xd180('0x1c')]){_0x4ba479+=_0x2d1172[_0xd180('0x2b')][_0xd180('0x38')];_0x42c060=_0x1bf467[_0x4ba479];_0x33fed6=_0x540f2d[_0xd180('0x39')](_0x42c060['status']);}else if(_0x2d1172['TrunkBackup']&&_0x2d1172['TrunkBackup'][_0xd180('0x1c')]){_0x4ba479+=_0x2d1172[_0xd180('0x3a')]['name'];_0x42c060=_0x1bf467[_0x4ba479];_0x33fed6=_0x540f2d[_0xd180('0x39')](_0x42c060[_0xd180('0x3b')]);}return _0x33fed6;}function getQueueCampaignStatusMessage(_0x32c9bf,_0x1ebbe4){var _0x15152a=CAMPAIGN_STATUS[_0xd180('0x3')];var _0x43ef23=isPreviewCampaign(_0x32c9bf);if(!isQueueCampaignActive(_0x32c9bf)){if(_0x43ef23){_0x15152a=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x32c9bf[_0xd180('0x2a')]===0x0&&_0x32c9bf[_0xd180('0x26')]===0x0&&_0x32c9bf['waiting']===0x0&&(_0x32c9bf[_0xd180('0x27')]||0x0)===0x0){_0x15152a=CAMPAIGN_STATUS[_0xd180('0x3c')];}else{_0x15152a=CAMPAIGN_STATUS[_0xd180('0x3d')];}}}else if(_0x32c9bf[_0xd180('0x23')]===0x0){_0x15152a=CAMPAIGN_STATUS[_0xd180('0x3e')];}else if(!checkAnyValidTrunk(_0x32c9bf,_0x1ebbe4)){_0x15152a=CAMPAIGN_STATUS[_0xd180('0x3f')];}else if(!isPreviewCampaign(_0x32c9bf)){var _0x13b2d6=checkAnyValidQueueCampaignInterval(_0x32c9bf);if(_0x13b2d6){_0x15152a=_0x13b2d6;}}return _0x15152a;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2d5459){var _0x24b182=CAMPAIGN_STATUS[_0xd180('0x3d')];if(_0x2d5459[_0xd180('0x2a')]===0x0&&_0x2d5459['talking']===0x0&&_0x2d5459[_0xd180('0x28')]===0x0&&(_0x2d5459[_0xd180('0x27')]||0x0)===0x0){_0x24b182=CAMPAIGN_STATUS['INACTIVE'];}return _0x24b182;}exports[_0xd180('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2ce26a){var _0x25e386=_0x2ce26a[_0xd180('0x41')](/"(.*?)"/);return _0x25e386?_0x25e386[0x1]:_0x2ce26a;}exports[_0xd180('0x42')]=extractCalleridName;function getCallerId(_0x202220,_0x5ad63f,_0x418e54){if(!_['isUndefined'](_0x418e54)&&typeof _0x418e54===_0xd180('0x43')&&!_[_0xd180('0x33')](_0x418e54)){if(!_['isUndefined'](_0x5ad63f)&&typeof _0x5ad63f===_0xd180('0x43')&&!_[_0xd180('0x33')](_0x5ad63f)){return util[_0xd180('0x44')](_0xd180('0x45'),_0x5ad63f,_0x418e54);}return util['format'](_0xd180('0x45'),_0x418e54,_0x418e54);}if(!_[_0xd180('0x46')](_0x202220)&&typeof _0x202220===_0xd180('0x43')&&!_[_0xd180('0x33')](_0x202220)){return _0x202220;}return _0xd180('0x47');}exports[_0xd180('0x48')]=getCallerId;function getCallerIdRandom(_0x485d2e,_0x2a5fd8){var _0x20eae2;var _0x24fa2a;var _0x5c9874;if(_0x2a5fd8<=0x0){_0x2a5fd8=0x1;}_0x20eae2=new RegExp(_0xd180('0x49')+_0x2a5fd8+'}$');_0x24fa2a=Math['pow'](0xa,_0x2a5fd8-0x1);_0x5c9874=Math[_0xd180('0x4a')](0xa,_0x2a5fd8)-0x1;return util[_0xd180('0x44')]('%s',_[_0xd180('0x4b')](_0x485d2e,_0x20eae2,_[_0xd180('0x4c')](_0x24fa2a,_0x5c9874)[_0xd180('0x4d')]()));}exports[_0xd180('0x4e')]=getCallerIdRandom;function decrementOriginate(_0x4413ba){if(_0x4413ba[_0xd180('0x2a')]&&_0x4413ba[_0xd180('0x2a')]>0x0){_0x4413ba['originated']-=0x1;}else{logger[_0xd180('0x4f')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xd180('0x50')]=decrementOriginate;function checkContactEmpty(_0x47510c){return _0x47510c&&_0x47510c[_0xd180('0x51')]>0x0;}exports[_0xd180('0x52')]=checkContactEmpty;function erlangb(_0x377025,_0x39bec7){if(_0x39bec7===0x0){return 0x0;}var _0x8107d2=0x1;for(var _0x258c04=0x1;_0x258c04<=_0x39bec7;_0x258c04+=0x1){_0x8107d2=0x1+_0x8107d2*_0x258c04/_0x377025;}return 0x1/_0x8107d2;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x101981,_0x3bb6cb,_0x2a957f){if(_0x3bb6cb>_0x2a957f){for(var _0x49abaf=0x0;_0x49abaf<_0x3bb6cb-_0x2a957f;_0x49abaf+=0x1){decrementOriginate(_0x101981);}}}exports[_0xd180('0x53')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x6772ea){var _0x46c4dc={};var _0x402af2=['id','createdAt',_0xd180('0x54'),_0xd180('0x55')];const _0x335523=0xfa;if(_0x6772ea){for(var _0x240027 in _0x6772ea){if(typeof _0x6772ea[_0x240027]!==_0xd180('0x56')){if(!_[_0xd180('0x2e')](_0x6772ea[_0x240027])&&!_0x402af2[_0xd180('0x39')](_0x240027)){if(_0x240027==='description'&&_0x6772ea[_0x240027][_0xd180('0x51')]>_0x335523){_0x46c4dc['XMD-'+_0x240027[_0xd180('0x57')]()]=_0x6772ea[_0x240027][_0xd180('0x4d')]()[_0xd180('0x58')](0x0,_0x335523);}else{_0x46c4dc[_0xd180('0x59')+_0x240027[_0xd180('0x57')]()]=_0x6772ea[_0x240027];}}}}}return _0x46c4dc;}exports[_0xd180('0x5a')]=setXMDContactVariables; \ No newline at end of file +var _0xd154=['\x22\x22\x20<>','getCallerId','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','erlangb','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','length','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd154,0x17c));var _0x4d15=function(_0x25a170,_0x3d493d){_0x25a170=_0x25a170-0x0;var _0x3b342c=_0xd154[_0x25a170];return _0x3b342c;};'use strict';var _=require(_0x4d15('0x0'));var moment=require('moment');var util=require(_0x4d15('0x1'));var logger=require('../../../../config/logger')(_0x4d15('0x2'));var timezones=require(_0x4d15('0x3'))[_0x4d15('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x4d15('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x4d15('0x6'),'DEACTIVATED':_0x4d15('0x7'),'DISACTIVED':_0x4d15('0x8'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x4d15('0x9'),'NO_AVAILABLE_CONTACTS':_0x4d15('0xa'),'NULL_INTERVAL':_0x4d15('0xb'),'OVERTIME_INTERVAL':_0x4d15('0xc'),'OVERTIME_GLOBAL_INTERVAL':_0x4d15('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x4d15('0xe'),'RUNNING':_0x4d15('0xf'),'UNKNOWN_TIMEZONE':_0x4d15('0x10'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0x4d15('0x11')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3b42c9){return _0x3b42c9[_0x4d15('0x12')]==='preview';}exports[_0x4d15('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x57b1e8){return _0x57b1e8['type']===_0x4d15('0x14');}exports[_0x4d15('0x15')]=isIVRCampaign;function isOutboundQueue(_0x1cad10){return _0x1cad10[_0x4d15('0x16')]===_0x4d15('0x17');}exports[_0x4d15('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x21e8f9){return _0x21e8f9[_0x4d15('0x19')];}exports[_0x4d15('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1ce464){return _0x1ce464[_0x4d15('0x1b')];}exports[_0x4d15('0x1c')]=isIVRCampaignActive;function getSeconds(_0x33902a,_0x29ddf1){var _0x2db45e=moment(_0x33902a)[_0x4d15('0x1d')](0x0);var _0x56d081=moment(_0x29ddf1)[_0x4d15('0x1d')](0x0);return _0x2db45e[_0x4d15('0x1e')](_0x56d081,_0x4d15('0x1f'));}exports[_0x4d15('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x1895ea,_0x4f9ebe){var _0x547fc7=![];var _0x4d374b=_0x1895ea[_0x4d15('0x12')]!==_0x4f9ebe[_0x4d15('0x12')]||_0x1895ea[_0x4d15('0x19')]!==_0x4f9ebe[_0x4d15('0x19')]||_0x1895ea['message']!==_0x4f9ebe[_0x4d15('0x21')];var _0x5ddfd0=_0x1895ea['available']!==_0x4f9ebe['available']||_0x1895ea[_0x4d15('0x22')]!==_0x4f9ebe[_0x4d15('0x22')]||_0x1895ea[_0x4d15('0x23')]!==_0x4f9ebe[_0x4d15('0x23')]||_0x1895ea['paused']!==_0x4f9ebe[_0x4d15('0x24')]||_0x1895ea[_0x4d15('0x25')]!==_0x4f9ebe[_0x4d15('0x25')]||_0x1895ea['pTalking']!==_0x4f9ebe[_0x4d15('0x26')]||_0x1895ea[_0x4d15('0x27')]!==_0x4f9ebe[_0x4d15('0x27')]||_0x1895ea[_0x4d15('0x28')]!==_0x4f9ebe[_0x4d15('0x28')]||_0x1895ea[_0x4d15('0x29')]!==_0x4f9ebe[_0x4d15('0x29')];if(_0x1895ea['Trunk']&&_0x4f9ebe[_0x4d15('0x2a')]){_0x547fc7=_0x1895ea[_0x4d15('0x2a')][_0x4d15('0x2b')]!==_0x4f9ebe[_0x4d15('0x2a')][_0x4d15('0x2b')]||_0x1895ea[_0x4d15('0x2a')][_0x4d15('0x1b')]!==_0x4f9ebe[_0x4d15('0x2a')][_0x4d15('0x1b')];}return _0x4d374b||_0x5ddfd0||_0x547fc7;}exports[_0x4d15('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x43792c){var _0x1addd0=null;var _0x538baa=_0x43792c[_0x4d15('0x2d')];if(_[_0x4d15('0x2e')](_0x43792c[_0x4d15('0x2f')])||_[_0x4d15('0x2e')](_0x43792c[_0x4d15('0x30')])||_[_0x4d15('0x2e')](_0x43792c[_0x4d15('0x30')]['Intervals'])){_0x1addd0=CAMPAIGN_STATUS[_0x4d15('0x31')];}else if(_[_0x4d15('0x32')](_0x43792c[_0x4d15('0x2f')])||_[_0x4d15('0x32')](_0x43792c[_0x4d15('0x30')][_0x4d15('0x33')])){_0x1addd0=CAMPAIGN_STATUS[_0x4d15('0x34')];}else if(_0x538baa&&!timezones[_0x538baa]){_0x1addd0=CAMPAIGN_STATUS[_0x4d15('0x35')];}return _0x1addd0;}function checkAnyValidTrunk(_0x10869c,_0xa5cf7c){var _0x5d5d2e=null;var _0x61c68d=_0x4d15('0x36');var _0x187365=[_0x4d15('0x37'),_0x4d15('0x38')];var _0x443e56=!![];if(_0x10869c['Trunk']&&_0x10869c[_0x4d15('0x2a')]['active']){_0x61c68d+=_0x10869c[_0x4d15('0x2a')][_0x4d15('0x2b')];_0x5d5d2e=_0xa5cf7c[_0x61c68d];_0x443e56=_0x187365[_0x4d15('0x39')](_0x5d5d2e[_0x4d15('0x3a')]);}else if(_0x10869c[_0x4d15('0x3b')]&&_0x10869c[_0x4d15('0x3b')][_0x4d15('0x1b')]){_0x61c68d+=_0x10869c['TrunkBackup'][_0x4d15('0x2b')];_0x5d5d2e=_0xa5cf7c[_0x61c68d];_0x443e56=_0x187365[_0x4d15('0x39')](_0x5d5d2e[_0x4d15('0x3a')]);}return _0x443e56;}function getQueueCampaignStatusMessage(_0xd815ef,_0x276127){var _0x36a162=CAMPAIGN_STATUS['ACTIVE'];var _0x4df42b=isPreviewCampaign(_0xd815ef);if(!isQueueCampaignActive(_0xd815ef)){if(_0x4df42b){_0x36a162=CAMPAIGN_STATUS[_0x4d15('0x3c')];}else{if(_0xd815ef[_0x4d15('0x29')]===0x0&&_0xd815ef[_0x4d15('0x25')]===0x0&&_0xd815ef[_0x4d15('0x27')]===0x0&&(_0xd815ef[_0x4d15('0x26')]||0x0)===0x0){_0x36a162=CAMPAIGN_STATUS[_0x4d15('0x3c')];}else{_0x36a162=CAMPAIGN_STATUS[_0x4d15('0x3d')];}}}else if(_0xd815ef[_0x4d15('0x22')]===0x0){_0x36a162=CAMPAIGN_STATUS[_0x4d15('0x3e')];}else if(!checkAnyValidTrunk(_0xd815ef,_0x276127)){_0x36a162=CAMPAIGN_STATUS[_0x4d15('0x3f')];}else if(!isPreviewCampaign(_0xd815ef)){var _0x1da257=checkAnyValidQueueCampaignInterval(_0xd815ef);if(_0x1da257){_0x36a162=_0x1da257;}}return _0x36a162;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x31e112){var _0x2d3d5c=CAMPAIGN_STATUS[_0x4d15('0x3d')];if(_0x31e112[_0x4d15('0x29')]===0x0&&_0x31e112[_0x4d15('0x25')]===0x0&&_0x31e112['waiting']===0x0&&(_0x31e112[_0x4d15('0x26')]||0x0)===0x0){_0x2d3d5c=CAMPAIGN_STATUS[_0x4d15('0x3c')];}return _0x2d3d5c;}exports[_0x4d15('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5f59b4){var _0xe6bc39=_0x5f59b4['match'](/"(.*?)"/);return _0xe6bc39?_0xe6bc39[0x1]:_0x5f59b4;}exports[_0x4d15('0x41')]=extractCalleridName;function getCallerId(_0x199d6d,_0x3aa0b9,_0x59f28f){if(!_[_0x4d15('0x42')](_0x59f28f)&&typeof _0x59f28f===_0x4d15('0x43')&&!_[_0x4d15('0x32')](_0x59f28f)){if(!_['isUndefined'](_0x3aa0b9)&&typeof _0x3aa0b9===_0x4d15('0x43')&&!_['isEmpty'](_0x3aa0b9)){return util['format'](_0x4d15('0x44'),_0x3aa0b9,_0x59f28f);}return util[_0x4d15('0x45')]('\x22%s\x22\x20<%s>',_0x59f28f,_0x59f28f);}if(!_[_0x4d15('0x42')](_0x199d6d)&&typeof _0x199d6d===_0x4d15('0x43')&&!_[_0x4d15('0x32')](_0x199d6d)){return _0x199d6d;}return _0x4d15('0x46');}exports[_0x4d15('0x47')]=getCallerId;function getCallerIdRandom(_0x501e9c,_0x1a97b6){var _0x118629;var _0x22f417;var _0x1857d3;if(_0x1a97b6<=0x0){_0x1a97b6=0x1;}_0x118629=new RegExp('\x5cw{0,'+_0x1a97b6+'}$');_0x22f417=Math[_0x4d15('0x48')](0xa,_0x1a97b6-0x1);_0x1857d3=Math[_0x4d15('0x48')](0xa,_0x1a97b6)-0x1;return util[_0x4d15('0x45')]('%s',_[_0x4d15('0x49')](_0x501e9c,_0x118629,_[_0x4d15('0x4a')](_0x22f417,_0x1857d3)[_0x4d15('0x4b')]()));}exports[_0x4d15('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x2f9747){if(_0x2f9747[_0x4d15('0x29')]&&_0x2f9747[_0x4d15('0x29')]>0x0){_0x2f9747[_0x4d15('0x29')]-=0x1;}else{logger['error'](_0x4d15('0x4d'));}}exports[_0x4d15('0x4e')]=decrementOriginate;function checkContactEmpty(_0x563d42){return _0x563d42&&_0x563d42['length']>0x0;}exports['checkContactEmpty']=checkContactEmpty;function erlangb(_0x1f7046,_0x1d0cdf){if(_0x1d0cdf===0x0){return 0x0;}var _0x129d91=0x1;for(var _0x33422e=0x1;_0x33422e<=_0x1d0cdf;_0x33422e+=0x1){_0x129d91=0x1+_0x129d91*_0x33422e/_0x1f7046;}return 0x1/_0x129d91;}exports[_0x4d15('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x2e1795,_0x21e047,_0x44d8ee){if(_0x21e047>_0x44d8ee){for(var _0x1a56c6=0x0;_0x1a56c6<_0x21e047-_0x44d8ee;_0x1a56c6+=0x1){decrementOriginate(_0x2e1795);}}}exports[_0x4d15('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x54ebf7){var _0x2ce32a={};var _0x17c9ec=['id',_0x4d15('0x51'),'tags',_0x4d15('0x52')];const _0x12abd1=0xfa;if(_0x54ebf7){for(var _0x1dc05d in _0x54ebf7){if(typeof _0x54ebf7[_0x1dc05d]!==_0x4d15('0x53')){if(!_[_0x4d15('0x2e')](_0x54ebf7[_0x1dc05d])&&!_0x17c9ec[_0x4d15('0x39')](_0x1dc05d)){if(_0x1dc05d===_0x4d15('0x54')&&_0x54ebf7[_0x1dc05d][_0x4d15('0x55')]>_0x12abd1){_0x2ce32a[_0x4d15('0x56')+_0x1dc05d[_0x4d15('0x57')]()]=_0x54ebf7[_0x1dc05d][_0x4d15('0x4b')]()[_0x4d15('0x58')](0x0,_0x12abd1);}else{_0x2ce32a[_0x4d15('0x56')+_0x1dc05d[_0x4d15('0x57')]()]=_0x54ebf7[_0x1dc05d];}}}}}return _0x2ce32a;}exports[_0x4d15('0x59')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 50ca813..e6bfb1f 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(_0x1057d9,_0x209e94){var _0x59d112=function(_0x345225){while(--_0x345225){_0x1057d9['push'](_0x1057d9['shift']());}};_0x59d112(++_0x209e94);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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(_0x16f8d6,_0xeae008){var _0x30d2ff=function(_0x1e5cd9){while(--_0x1e5cd9){_0x16f8d6['push'](_0x16f8d6['shift']());}};_0x30d2ff(++_0xeae008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 9701236..fedf166 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 _0xfed0=['Empty\x20Fax','Is\x20Valid','util','lodash','moment','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status','filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','parse','.pdf','application/pdf','then','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]'];(function(_0x2f50a8,_0x3d7260){var _0x41231b=function(_0x2a1452){while(--_0x2a1452){_0x2f50a8['push'](_0x2f50a8['shift']());}};_0x41231b(++_0x3d7260);}(_0xfed0,0x14c));var _0x0fed=function(_0x1ae1b9,_0x445cb2){_0x1ae1b9=_0x1ae1b9-0x0;var _0x3a577c=_0xfed0[_0x1ae1b9];return _0x3a577c;};'use strict';var util=require(_0x0fed('0x0'));var _=require(_0x0fed('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x0fed('0x2'));var path=require(_0x0fed('0x3'));var tiff2pdf=require(_0x0fed('0x4'));var gs=require(_0x0fed('0x5'));var logger=require('../../../config/logger')(_0x0fed('0x6'));var ami=require(_0x0fed('0x7'));var rpcDb=require(_0x0fed('0x8'));var Channel=require('./channel');var ut=require(_0x0fed('0x9'));var Action=require(_0x0fed('0xa'));var faxAccount=require(_0x0fed('0xb'));var attachment=require(_0x0fed('0xc'));var faxMessage=require(_0x0fed('0xd'));function Fax(_0x45681f){this[_0x0fed('0xe')]={};this[_0x0fed('0xf')]=_0x45681f[_0x0fed('0xf')];this[_0x0fed('0x10')]=_0x45681f[_0x0fed('0x10')];this[_0x0fed('0x11')]={};ami['on'](_0x0fed('0x12'),this[_0x0fed('0x13')][_0x0fed('0x14')](this));ami['on'](_0x0fed('0x15'),this[_0x0fed('0x16')][_0x0fed('0x14')](this));ami['on'](_0x0fed('0x17'),this[_0x0fed('0x18')]['bind'](this));ami['on'](_0x0fed('0x19'),this['syncNewExten'][_0x0fed('0x14')](this));ami['on'](_0x0fed('0x1a'),this[_0x0fed('0x1b')][_0x0fed('0x14')](this));ami['on']('receivefax',this['syncReceiveFax'][_0x0fed('0x14')](this));ami['on']('hangup',this[_0x0fed('0x1c')][_0x0fed('0x14')](this));ami['on'](_0x0fed('0x1d'),this[_0x0fed('0x1e')][_0x0fed('0x14')](this));}Fax[_0x0fed('0x1f')]['syncNewchannel']=function(_0x4bf719){if(_0x4bf719[_0x0fed('0x20')]===_0x0fed('0x21')){for(var _0x41c55a in this['faxAccounts']){if(this[_0x0fed('0xf')][_0x0fed('0x22')](_0x41c55a)){if(_0x4bf719['exten']===this[_0x0fed('0xf')][_0x41c55a][_0x0fed('0x23')]){this[_0x0fed('0xe')][_0x4bf719['uniqueid']]={};this[_0x0fed('0xe')][_0x4bf719[_0x0fed('0x24')]][_0x0fed('0x25')]=_0x4bf719[_0x0fed('0x25')];this['channels'][_0x4bf719[_0x0fed('0x24')]]['id']=this[_0x0fed('0xf')][_0x41c55a]['id'];this[_0x0fed('0xe')][_0x4bf719['uniqueid']]['name']=this[_0x0fed('0xf')][_0x41c55a][_0x0fed('0x26')];logger[_0x0fed('0x27')](_0x4bf719[_0x0fed('0x24')],'\x20syncNewchannel\x20');}}}}if(this[_0x0fed('0x11')][_0x4bf719[_0x0fed('0x24')]]){this['channels'][_0x4bf719[_0x0fed('0x24')]]={};this['channels'][_0x4bf719[_0x0fed('0x24')]][_0x0fed('0x25')]=_0x4bf719['channel'];logger['info'](_0x4bf719[_0x0fed('0x24')],_0x0fed('0x28'));}};Fax[_0x0fed('0x1f')][_0x0fed('0x16')]=function(_0x476e09){if(this['channels'][_0x476e09[_0x0fed('0x24')]]){for(var _0x2c9a19 in _0x476e09[_0x0fed('0x29')]){if(_0x476e09['variable'][_0x0fed('0x22')](_0x2c9a19)){this['channels'][_0x476e09[_0x0fed('0x24')]][_0x2c9a19]=_0x476e09[_0x0fed('0x2a')];}}}};Fax[_0x0fed('0x1f')][_0x0fed('0x18')]=function(_0xf5e808){if(this[_0x0fed('0xe')][_0xf5e808['uniqueid']]){this[_0x0fed('0xe')][_0xf5e808[_0x0fed('0x24')]][_0x0fed('0x2b')]=_0xf5e808[_0x0fed('0x2b')];this['channels'][_0xf5e808[_0x0fed('0x24')]][_0x0fed('0x2c')]=_0xf5e808['channelstatedesc'];}};Fax[_0x0fed('0x1f')][_0x0fed('0x2d')]=function(_0x4f303a){if(this[_0x0fed('0xe')][_0x4f303a['uniqueid']]){for(var _0x20f143 in _0x4f303a[_0x0fed('0x29')]){if(_0x4f303a[_0x0fed('0x29')][_0x0fed('0x22')](_0x20f143)){this['channels'][_0x4f303a[_0x0fed('0x24')]][_0x20f143]=_0x4f303a[_0x0fed('0x2a')];}}}};Fax[_0x0fed('0x1f')][_0x0fed('0x1b')]=function(_0x25aa75){if(this[_0x0fed('0xe')][_0x25aa75[_0x0fed('0x24')]]){this[_0x0fed('0xe')][_0x25aa75[_0x0fed('0x24')]][_0x0fed('0x2e')]=_0x25aa75['operation'];this[_0x0fed('0xe')][_0x25aa75['uniqueid']][_0x0fed('0x2f')]=_0x25aa75[_0x0fed('0x2f')];this['channels'][_0x25aa75[_0x0fed('0x24')]][_0x0fed('0x23')]=_0x25aa75['localstationid'];this[_0x0fed('0xe')][_0x25aa75[_0x0fed('0x24')]][_0x0fed('0x30')]=_0x25aa75[_0x0fed('0x30')];logger['info'](_0x25aa75[_0x0fed('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x0fed('0x1f')][_0x0fed('0x31')]=function(_0x257bcc){var _0x1723b0=this;if(this[_0x0fed('0xe')][_0x257bcc['uniqueid']]){var _0xb51550=this[_0x0fed('0xe')][_0x257bcc[_0x0fed('0x24')]]['id'];this['channels'][_0x257bcc[_0x0fed('0x24')]][_0x0fed('0x32')]=_0x257bcc['remotestationid'];this[_0x0fed('0xe')][_0x257bcc[_0x0fed('0x24')]][_0x0fed('0x33')]=_0x257bcc[_0x0fed('0x33')];this[_0x0fed('0xe')][_0x257bcc['uniqueid']][_0x0fed('0x23')]=_0x257bcc[_0x0fed('0x23')];this[_0x0fed('0xe')][_0x257bcc['uniqueid']]['resolution']=_0x257bcc[_0x0fed('0x34')];this[_0x0fed('0xe')][_0x257bcc[_0x0fed('0x24')]][_0x0fed('0x35')]=_0x257bcc[_0x0fed('0x35')];this[_0x0fed('0xe')][_0x257bcc[_0x0fed('0x24')]]['filename']=_0x257bcc['filename'];this[_0x0fed('0xe')][_0x257bcc['uniqueid']][_0x0fed('0x36')]=_0x257bcc['calleridnum'];if(this[_0x0fed('0xe')][_0x257bcc['uniqueid']][_0x0fed('0x33')]>0x0){tiff2pdf(_0x257bcc[_0x0fed('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x43f570){logger[_0x0fed('0x27')](_0x257bcc[_0x0fed('0x24')],'\x20result\x20conversion\x20file\x20',_0x43f570[_0x0fed('0x37')]);attachment['create']({'name':path['parse'](_0x257bcc[_0x0fed('0x30')])['name'],'basename':path[_0x0fed('0x38')](_0x257bcc[_0x0fed('0x30')])[_0x0fed('0x26')]+_0x0fed('0x39'),'type':_0x0fed('0x3a')})[_0x0fed('0x3b')](function(_0x8ed9dd){faxAccount['notify'](_0xb51550,{'from':_0x257bcc['calleridnum'],'mapKey':'fax','body':path[_0x0fed('0x38')](_0x257bcc[_0x0fed('0x30')])[_0x0fed('0x26')]+_0x0fed('0x39'),'AttachmentId':_0x8ed9dd['id']})['catch'](function(_0x74dfc4){logger['error'](_0x257bcc[_0x0fed('0x24')],_0x0fed('0x3c'),JSON[_0x0fed('0x3d')](_0x74dfc4));});})[_0x0fed('0x3e')](function(_0x2a319){logger['error'](_0x257bcc[_0x0fed('0x24')],_0x0fed('0x3f'),JSON[_0x0fed('0x3d')](_0x2a319));});});}logger[_0x0fed('0x27')](_0x257bcc[_0x0fed('0x24')],'\x20receiveFax\x20');}};Fax[_0x0fed('0x1f')][_0x0fed('0x1e')]=function(_0x4109ce){if(this['actions'][_0x4109ce['uniqueid']]){_[_0x0fed('0x40')](this['channels'][_0x4109ce[_0x0fed('0x24')]],_[_0x0fed('0x41')](_0x4109ce,['response',_0x0fed('0x42')]));}};function updateStatus(_0x568f5b){if(_0x568f5b[_0x0fed('0x43')]){faxMessage[_0x0fed('0x44')](_0x568f5b['AttachmentId'],{'failMessage':_0x0fed('0x45')})['then'](function(_0x6b927){ut[_0x0fed('0x46')]('[Fax][Message][Error][Updated]',_0x6b927);})[_0x0fed('0x3e')](function(_0x13af47){ut[_0x0fed('0x46')]('[Fax][Message][Error][NoUpdate1]',_0x13af47);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x0fed('0x1f')][_0x0fed('0x47')]=function(_0x47c123,_0x148ee2,_0xbe20b0){var _0x4f458b=this;var _0x3b150d={};if(_0x148ee2){_0x3b150d={'read':_0x148ee2};}else{_0x3b150d={'failMessage':_0xbe20b0};}if(this[_0x0fed('0x11')][_0x47c123]['AttachmentId']){faxMessage[_0x0fed('0x44')](this['actions'][_0x47c123][_0x0fed('0x43')],_0x3b150d)[_0x0fed('0x3b')](function(_0x1e739f){ut[_0x0fed('0x46')](_0x0fed('0x48'),_0x1e739f);})[_0x0fed('0x3e')](function(_0x19338a){ut[_0x0fed('0x46')]('[Fax][Message][NoUpdate1]',_0x19338a);})['finally'](function(){delete _0x4f458b['channels'][_0x47c123];delete _0x4f458b[_0x0fed('0x11')][_0x47c123];});}else{ut[_0x0fed('0x46')](_0x0fed('0x49'));this[_0x0fed('0x4a')](_0x47c123);delete this[_0x0fed('0x11')][_0x47c123];}};Fax[_0x0fed('0x1f')][_0x0fed('0x1c')]=function(_0x288d55){var _0x2f0996=this;if(this['channels'][_0x288d55[_0x0fed('0x24')]]){if(this[_0x0fed('0x11')][_0x288d55[_0x0fed('0x24')]]){this[_0x0fed('0xe')][_0x288d55[_0x0fed('0x24')]]['id']=this[_0x0fed('0x11')][_0x288d55[_0x0fed('0x24')]]['id'];this[_0x0fed('0xe')][_0x288d55[_0x0fed('0x24')]][_0x0fed('0x26')]=this['actions'][_0x288d55[_0x0fed('0x24')]][_0x0fed('0x26')];}logger[_0x0fed('0x27')](_0x288d55[_0x0fed('0x24')],this[_0x0fed('0x11')][_0x288d55[_0x0fed('0x24')]]?_0x0fed('0x4b'):'\x20hangup\x20faxRiceive\x20',JSON[_0x0fed('0x3d')](this[_0x0fed('0xe')][_0x288d55['uniqueid']]));if(this[_0x0fed('0x11')][_0x288d55[_0x0fed('0x24')]]){if(this[_0x0fed('0xe')][_0x288d55[_0x0fed('0x24')]][_0x0fed('0x4c')]>0x0&&this[_0x0fed('0xe')][_0x288d55[_0x0fed('0x24')]][_0x0fed('0x1a')]===_0x0fed('0x4d')){this[_0x0fed('0x47')](_0x288d55['uniqueid'],!![]);}else{this[_0x0fed('0x47')](_0x288d55['uniqueid'],![],this[_0x0fed('0xe')][_0x288d55['uniqueid']][_0x0fed('0x4e')]?_0x0fed('0x4f')+this[_0x0fed('0xe')][_0x288d55['uniqueid']][_0x0fed('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x0fed('0x1f')]['send']=function(_0x21ba69){var _0x17723b=this;return new BPromise(function(_0x197ab5,_0x4bc8dd){_0x17723b[_0x0fed('0x50')](_0x21ba69,_0x17723b[_0x0fed('0xf')][_0x21ba69[_0x0fed('0x51')]])[_0x0fed('0x3b')](function(_0x5f4928){ut[_0x0fed('0x46')](_0x0fed('0x52'),_0x5f4928);_0x197ab5(ut[_0x0fed('0x37')](_0x0fed('0x53')));})[_0x0fed('0x3e')](function(_0x43bbde){ut[_0x0fed('0x46')](_0x0fed('0x54'),_0x43bbde);updateStatus(_0x21ba69);_0x4bc8dd(ut['message'](_0x0fed('0x55')));});});};Fax['prototype'][_0x0fed('0x56')]=function(_0x3ffc38){var _0x54c3c9=this;return new BPromise(function(_0x134b3f,_0x26fd03){var _0x1c7182=_0x54c3c9[_0x0fed('0x57')](_0x54c3c9[_0x0fed('0xf')][_0x3ffc38[_0x0fed('0x51')]][_0x0fed('0x58')],_0x3ffc38);if(_0x1c7182[_0x0fed('0x59')]){_0x134b3f(ut[_0x0fed('0x37')]('Trunk\x20Reachable'));}else{_0x26fd03(ut['message'](_0x1c7182[_0x0fed('0x37')]));}});};function originate(_0x16ad72,_0x2a7ce2,_0x3c8102){return new BPromise(function(_0x4daef3,_0x26011a){if(_0x3c8102){var _0x207d98=util['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[_0x0fed('0x38')](_0x16ad72[_0x0fed('0x3')])['name'],_0x16ad72[_0x0fed('0x3')]);gs[_0x0fed('0x5a')](_0x207d98)[_0x0fed('0x3b')](function(){_0x16ad72[_0x0fed('0x3')]=util[_0x0fed('0x5b')]('%s/%s.tif',path[_0x0fed('0x38')](_0x16ad72['path'])[_0x0fed('0x5c')],path['parse'](_0x16ad72[_0x0fed('0x3')])[_0x0fed('0x26')]);_0x2a7ce2[_0x0fed('0x5d')]=_0x16ad72[_0x0fed('0x3')];ut['logger'](_0x0fed('0x5e'),'');ami[_0x0fed('0x5f')](ut[_0x0fed('0x60')](_0x16ad72,_0x2a7ce2))['then'](function(_0x5495d1){_0x4daef3(_0x5495d1);})[_0x0fed('0x3e')](function(_0x15e753){_0x26011a(_0x15e753);});})[_0x0fed('0x3e')](function(_0x577b12){_0x26011a(_0x577b12);});}else{ami[_0x0fed('0x5f')](ut[_0x0fed('0x60')](_0x16ad72,_0x2a7ce2))[_0x0fed('0x3b')](function(_0x8a1827){_0x4daef3(_0x8a1827);})[_0x0fed('0x3e')](function(_0x2cf97e){_0x26011a(_0x2cf97e);});}});}Fax[_0x0fed('0x1f')][_0x0fed('0x50')]=function(_0x4c9af8,_0x5a69ee){var _0x2b3be9=this;return new BPromise(function(_0x27fe16,_0x3d3674){var _0x42a66f=uuid['v4']();var _0x21c01a=ut[_0x0fed('0x61')](_0x4c9af8,_0x5a69ee);_0x2b3be9[_0x0fed('0x11')][_0x42a66f]=new Action(_0x42a66f,_0x5a69ee,_0x4c9af8);var _0x2fa1ce=_0x2b3be9[_0x0fed('0x11')][_0x42a66f];if(path[_0x0fed('0x38')](_0x4c9af8[_0x0fed('0x3')])[_0x0fed('0x62')]===_0x0fed('0x39')){originate(_0x2fa1ce,_0x21c01a,!![])['then'](function(_0x1384a6){_0x27fe16(_0x1384a6);})['catch'](function(_0x3801ff){_0x3d3674(_0x3801ff);});}else{originate(_0x2fa1ce,_0x21c01a,![])[_0x0fed('0x3b')](function(_0x441356){_0x27fe16(_0x441356);})['catch'](function(_0x3e4c5e){_0x3d3674(_0x3e4c5e);});}});};Fax[_0x0fed('0x1f')][_0x0fed('0x63')]=function(_0x1bacae){return!_[_0x0fed('0x64')](_0x1bacae)&&!_[_0x0fed('0x64')](_0x1bacae['name'])&&!_[_0x0fed('0x64')](_0x1bacae[_0x0fed('0x65')])&&_0x1bacae['active']&&!_[_0x0fed('0x64')](this[_0x0fed('0x10')][util['format']('SIP/%s',_0x1bacae[_0x0fed('0x26')])])&&!_[_0x0fed('0x64')](this['trunks'][util[_0x0fed('0x5b')](_0x0fed('0x66'),_0x1bacae[_0x0fed('0x26')])]['status'])&&(this[_0x0fed('0x10')][util[_0x0fed('0x5b')](_0x0fed('0x66'),_0x1bacae['name'])][_0x0fed('0x2f')]===_0x0fed('0x67')||this['trunks'][util[_0x0fed('0x5b')](_0x0fed('0x66'),_0x1bacae[_0x0fed('0x26')])][_0x0fed('0x2f')]===_0x0fed('0x68'));};Fax[_0x0fed('0x1f')][_0x0fed('0x57')]=function(_0x1ea5e4,_0x226c1f){if(!this[_0x0fed('0x63')](_0x1ea5e4)){ut[_0x0fed('0x46')](_0x0fed('0x69'),_['isNil'](_0x1ea5e4)?'':_0x1ea5e4[_0x0fed('0x26')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x0fed('0x6a')};}if(_[_0x0fed('0x64')](_0x226c1f[_0x0fed('0x6')])){ut[_0x0fed('0x46')](_0x0fed('0x6b'),JSON[_0x0fed('0x3d')](_0x226c1f));return{'isValid':![],'message':_0x0fed('0x6c')};}if(_['isNil'](_0x226c1f[_0x0fed('0x3')])){ut[_0x0fed('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x0fed('0x3d')](_0x226c1f));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x0fed('0x6d')};};Fax['prototype'][_0x0fed('0x4a')]=function(_0x4b4d3f,_0x2f3bd6=0x2710){if(this[_0x0fed('0xe')][_0x4b4d3f]){setTimeout(()=>{delete this[_0x0fed('0xe')][_0x4b4d3f];},_0x2f3bd6);}};module['exports']=Fax; \ No newline at end of file +var _0x95a5=['[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','deleteChannelAfterTimeout','exports','util','lodash','bluebird','uuid','moment','path','../../../config/logger','fax','../ami','./rpcDb','./util/util','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','varset','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','syncVarSet','variable','value','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x95a5,0x179));var _0x595a=function(_0xc1967,_0x33a731){_0xc1967=_0xc1967-0x0;var _0x320c77=_0x95a5[_0xc1967];return _0x320c77;};'use strict';var util=require(_0x595a('0x0'));var _=require(_0x595a('0x1'));var BPromise=require(_0x595a('0x2'));var uuid=require(_0x595a('0x3'));var moment=require(_0x595a('0x4'));var path=require(_0x595a('0x5'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0x595a('0x6'))(_0x595a('0x7'));var ami=require(_0x595a('0x8'));var rpcDb=require(_0x595a('0x9'));var Channel=require('./channel');var ut=require(_0x595a('0xa'));var Action=require('./action');var faxAccount=require(_0x595a('0xb'));var attachment=require(_0x595a('0xc'));var faxMessage=require(_0x595a('0xd'));function Fax(_0x505347){this[_0x595a('0xe')]={};this[_0x595a('0xf')]=_0x505347['faxAccounts'];this[_0x595a('0x10')]=_0x505347['trunks'];this[_0x595a('0x11')]={};ami['on']('newchannel',this[_0x595a('0x12')]['bind'](this));ami['on'](_0x595a('0x13'),this['syncVarSet'][_0x595a('0x14')](this));ami['on'](_0x595a('0x15'),this['syncNewState'][_0x595a('0x14')](this));ami['on'](_0x595a('0x16'),this[_0x595a('0x17')][_0x595a('0x14')](this));ami['on'](_0x595a('0x18'),this[_0x595a('0x19')][_0x595a('0x14')](this));ami['on'](_0x595a('0x1a'),this[_0x595a('0x1b')]['bind'](this));ami['on'](_0x595a('0x1c'),this[_0x595a('0x1d')][_0x595a('0x14')](this));ami['on'](_0x595a('0x1e'),this[_0x595a('0x1f')][_0x595a('0x14')](this));}Fax['prototype'][_0x595a('0x12')]=function(_0x139951){if(_0x139951[_0x595a('0x20')]==='from-voip-provider'){for(var _0x2d4fe8 in this[_0x595a('0xf')]){if(this[_0x595a('0xf')][_0x595a('0x21')](_0x2d4fe8)){if(_0x139951[_0x595a('0x22')]===this[_0x595a('0xf')][_0x2d4fe8][_0x595a('0x23')]){this['channels'][_0x139951[_0x595a('0x24')]]={};this[_0x595a('0xe')][_0x139951[_0x595a('0x24')]][_0x595a('0x25')]=_0x139951['channel'];this[_0x595a('0xe')][_0x139951[_0x595a('0x24')]]['id']=this['faxAccounts'][_0x2d4fe8]['id'];this['channels'][_0x139951[_0x595a('0x24')]][_0x595a('0x26')]=this[_0x595a('0xf')][_0x2d4fe8][_0x595a('0x26')];logger[_0x595a('0x27')](_0x139951[_0x595a('0x24')],_0x595a('0x28'));}}}}if(this[_0x595a('0x11')][_0x139951[_0x595a('0x24')]]){this[_0x595a('0xe')][_0x139951[_0x595a('0x24')]]={};this[_0x595a('0xe')][_0x139951[_0x595a('0x24')]]['channel']=_0x139951[_0x595a('0x25')];logger['info'](_0x139951[_0x595a('0x24')],_0x595a('0x28'));}};Fax[_0x595a('0x29')][_0x595a('0x2a')]=function(_0x385ee0){if(this[_0x595a('0xe')][_0x385ee0[_0x595a('0x24')]]){for(var _0x11b733 in _0x385ee0[_0x595a('0x2b')]){if(_0x385ee0[_0x595a('0x2b')][_0x595a('0x21')](_0x11b733)){this['channels'][_0x385ee0['uniqueid']][_0x11b733]=_0x385ee0[_0x595a('0x2c')];}}}};Fax[_0x595a('0x29')]['syncNewState']=function(_0x196415){if(this[_0x595a('0xe')][_0x196415[_0x595a('0x24')]]){this[_0x595a('0xe')][_0x196415['uniqueid']]['channelstate']=_0x196415['channelstate'];this['channels'][_0x196415['uniqueid']][_0x595a('0x2d')]=_0x196415['channelstatedesc'];}};Fax['prototype'][_0x595a('0x17')]=function(_0x5f14df){if(this['channels'][_0x5f14df[_0x595a('0x24')]]){for(var _0x3d6163 in _0x5f14df[_0x595a('0x2b')]){if(_0x5f14df[_0x595a('0x2b')]['hasOwnProperty'](_0x3d6163)){this[_0x595a('0xe')][_0x5f14df[_0x595a('0x24')]][_0x3d6163]=_0x5f14df[_0x595a('0x2c')];}}}};Fax[_0x595a('0x29')]['syncFaxStatus']=function(_0x590b4e){if(this['channels'][_0x590b4e['uniqueid']]){this['channels'][_0x590b4e[_0x595a('0x24')]]['operation']=_0x590b4e[_0x595a('0x2e')];this[_0x595a('0xe')][_0x590b4e[_0x595a('0x24')]][_0x595a('0x2f')]=_0x590b4e['status'];this[_0x595a('0xe')][_0x590b4e[_0x595a('0x24')]][_0x595a('0x23')]=_0x590b4e[_0x595a('0x23')];this['channels'][_0x590b4e['uniqueid']]['filename']=_0x590b4e[_0x595a('0x30')];logger[_0x595a('0x27')](_0x590b4e[_0x595a('0x24')],'\x20syncFaxStatus\x20');}};Fax[_0x595a('0x29')]['syncReceiveFax']=function(_0xd63fba){var _0x101c07=this;if(this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]]){var _0x5037d5=this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]]['id'];this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]][_0x595a('0x31')]=_0xd63fba[_0x595a('0x31')];this['channels'][_0xd63fba[_0x595a('0x24')]]['pagestransferred']=_0xd63fba[_0x595a('0x32')];this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]][_0x595a('0x23')]=_0xd63fba[_0x595a('0x23')];this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]][_0x595a('0x33')]=_0xd63fba[_0x595a('0x33')];this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]][_0x595a('0x34')]=_0xd63fba[_0x595a('0x34')];this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]]['filename']=_0xd63fba[_0x595a('0x30')];this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]][_0x595a('0x35')]=_0xd63fba[_0x595a('0x35')];if(this[_0x595a('0xe')][_0xd63fba[_0x595a('0x24')]][_0x595a('0x32')]>0x0){tiff2pdf(_0xd63fba[_0x595a('0x30')],_0x595a('0x36'),function(_0x1faaf8){logger['info'](_0xd63fba[_0x595a('0x24')],_0x595a('0x37'),_0x1faaf8[_0x595a('0x38')]);attachment[_0x595a('0x39')]({'name':path['parse'](_0xd63fba[_0x595a('0x30')])[_0x595a('0x26')],'basename':path[_0x595a('0x3a')](_0xd63fba[_0x595a('0x30')])[_0x595a('0x26')]+_0x595a('0x3b'),'type':_0x595a('0x3c')})['then'](function(_0x3b2cfc){faxAccount[_0x595a('0x3d')](_0x5037d5,{'from':_0xd63fba[_0x595a('0x35')],'mapKey':_0x595a('0x7'),'body':path[_0x595a('0x3a')](_0xd63fba['filename'])[_0x595a('0x26')]+_0x595a('0x3b'),'AttachmentId':_0x3b2cfc['id']})[_0x595a('0x3e')](function(_0x12accd){logger['error'](_0xd63fba[_0x595a('0x24')],_0x595a('0x3f'),JSON[_0x595a('0x40')](_0x12accd));});})[_0x595a('0x3e')](function(_0x500972){logger['error'](_0xd63fba[_0x595a('0x24')],_0x595a('0x41'),JSON[_0x595a('0x40')](_0x500972));});});}logger[_0x595a('0x27')](_0xd63fba[_0x595a('0x24')],_0x595a('0x41'));}};Fax[_0x595a('0x29')]['syncOriginateResponse']=function(_0x2e365b){if(this[_0x595a('0x11')][_0x2e365b[_0x595a('0x24')]]){_[_0x595a('0x42')](this[_0x595a('0xe')][_0x2e365b['uniqueid']],_[_0x595a('0x43')](_0x2e365b,['response',_0x595a('0x44')]));}};function updateStatus(_0x24cf4e){if(_0x24cf4e[_0x595a('0x45')]){faxMessage[_0x595a('0x46')](_0x24cf4e[_0x595a('0x45')],{'failMessage':_0x595a('0x47')})[_0x595a('0x48')](function(_0x10b831){ut[_0x595a('0x49')](_0x595a('0x4a'),_0x10b831);})['catch'](function(_0x2a8dbb){ut[_0x595a('0x49')](_0x595a('0x4b'),_0x2a8dbb);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x595a('0x4c')]=function(_0x405b65,_0x745a9a,_0x21e92a){var _0x147d98=this;var _0x5f5dd7={};if(_0x745a9a){_0x5f5dd7={'read':_0x745a9a};}else{_0x5f5dd7={'failMessage':_0x21e92a};}if(this[_0x595a('0x11')][_0x405b65][_0x595a('0x45')]){faxMessage['update'](this['actions'][_0x405b65][_0x595a('0x45')],_0x5f5dd7)[_0x595a('0x48')](function(_0x5a51d7){ut[_0x595a('0x49')]('[Fax][Message][Updated]',_0x5a51d7);})[_0x595a('0x3e')](function(_0x1e717d){ut[_0x595a('0x49')](_0x595a('0x4d'),_0x1e717d);})[_0x595a('0x4e')](function(){delete _0x147d98[_0x595a('0xe')][_0x405b65];delete _0x147d98[_0x595a('0x11')][_0x405b65];});}else{ut[_0x595a('0x49')](_0x595a('0x4f'));this['deleteChannelAfterTimeout'](_0x405b65);delete this[_0x595a('0x11')][_0x405b65];}};Fax[_0x595a('0x29')][_0x595a('0x1d')]=function(_0x41a060){var _0x2eab21=this;if(this['channels'][_0x41a060[_0x595a('0x24')]]){if(this[_0x595a('0x11')][_0x41a060[_0x595a('0x24')]]){this['channels'][_0x41a060[_0x595a('0x24')]]['id']=this[_0x595a('0x11')][_0x41a060['uniqueid']]['id'];this[_0x595a('0xe')][_0x41a060['uniqueid']][_0x595a('0x26')]=this[_0x595a('0x11')][_0x41a060[_0x595a('0x24')]][_0x595a('0x26')];}logger[_0x595a('0x27')](_0x41a060[_0x595a('0x24')],this[_0x595a('0x11')][_0x41a060['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x595a('0x50'),JSON['stringify'](this[_0x595a('0xe')][_0x41a060['uniqueid']]));if(this[_0x595a('0x11')][_0x41a060[_0x595a('0x24')]]){if(this['channels'][_0x41a060[_0x595a('0x24')]][_0x595a('0x51')]>0x0&&this[_0x595a('0xe')][_0x41a060[_0x595a('0x24')]][_0x595a('0x18')]===_0x595a('0x52')){this[_0x595a('0x4c')](_0x41a060['uniqueid'],!![]);}else{this[_0x595a('0x4c')](_0x41a060[_0x595a('0x24')],![],this[_0x595a('0xe')][_0x41a060[_0x595a('0x24')]][_0x595a('0x53')]?_0x595a('0x54')+this[_0x595a('0xe')][_0x41a060[_0x595a('0x24')]][_0x595a('0x53')]:_0x595a('0x55'));}}}};Fax[_0x595a('0x29')]['send']=function(_0xc47ff6){var _0xdaa0d4=this;return new BPromise(function(_0x364fdf,_0x162c83){_0xdaa0d4[_0x595a('0x56')](_0xc47ff6,_0xdaa0d4[_0x595a('0xf')][_0xc47ff6['FaxAccountId']])['then'](function(_0x3cbfe7){ut[_0x595a('0x49')](_0x595a('0x57'),_0x3cbfe7);_0x364fdf(ut[_0x595a('0x38')](_0x595a('0x58')));})[_0x595a('0x3e')](function(_0x2431f9){ut['logger'](_0x595a('0x59'),_0x2431f9);updateStatus(_0xc47ff6);_0x162c83(ut['message']('Fax\x20failed'));});});};Fax['prototype'][_0x595a('0x5a')]=function(_0x62f1a8){var _0x27d7f7=this;return new BPromise(function(_0xb990ed,_0x8df183){var _0x3a2ea5=_0x27d7f7[_0x595a('0x5b')](_0x27d7f7['faxAccounts'][_0x62f1a8[_0x595a('0x5c')]][_0x595a('0x5d')],_0x62f1a8);if(_0x3a2ea5[_0x595a('0x5e')]){_0xb990ed(ut[_0x595a('0x38')](_0x595a('0x5f')));}else{_0x8df183(ut[_0x595a('0x38')](_0x3a2ea5['message']));}});};function originate(_0x9f0dcb,_0x37070d,_0x46b9c0){return new BPromise(function(_0x518f91,_0x51afbb){if(_0x46b9c0){var _0x26fd0b=util[_0x595a('0x60')](_0x595a('0x61'),path['parse'](_0x9f0dcb[_0x595a('0x5')])[_0x595a('0x26')],_0x9f0dcb['path']);gs[_0x595a('0x62')](_0x26fd0b)[_0x595a('0x48')](function(){_0x9f0dcb['path']=util[_0x595a('0x60')]('%s/%s.tif',path['parse'](_0x9f0dcb[_0x595a('0x5')])['dir'],path[_0x595a('0x3a')](_0x9f0dcb[_0x595a('0x5')])[_0x595a('0x26')]);_0x37070d[_0x595a('0x63')]=_0x9f0dcb[_0x595a('0x5')];ut[_0x595a('0x49')]('Convert\x20pdf\x20to\x20tif','');ami[_0x595a('0x64')](ut['variablesAction'](_0x9f0dcb,_0x37070d))[_0x595a('0x48')](function(_0x588f17){_0x518f91(_0x588f17);})[_0x595a('0x3e')](function(_0x2a9044){_0x51afbb(_0x2a9044);});})[_0x595a('0x3e')](function(_0x2a4794){_0x51afbb(_0x2a4794);});}else{ami[_0x595a('0x64')](ut[_0x595a('0x65')](_0x9f0dcb,_0x37070d))['then'](function(_0x544ad4){_0x518f91(_0x544ad4);})[_0x595a('0x3e')](function(_0x9e7d85){_0x51afbb(_0x9e7d85);});}});}Fax['prototype'][_0x595a('0x56')]=function(_0x1e1421,_0x1b9278){var _0x3ddab4=this;return new BPromise(function(_0x1f78a0,_0x52c0b6){var _0x20b6dd=uuid['v4']();var _0x5607ab=ut[_0x595a('0x66')](_0x1e1421,_0x1b9278);_0x3ddab4[_0x595a('0x11')][_0x20b6dd]=new Action(_0x20b6dd,_0x1b9278,_0x1e1421);var _0xc0d86d=_0x3ddab4['actions'][_0x20b6dd];if(path[_0x595a('0x3a')](_0x1e1421['path'])[_0x595a('0x67')]===_0x595a('0x3b')){originate(_0xc0d86d,_0x5607ab,!![])[_0x595a('0x48')](function(_0x38c7af){_0x1f78a0(_0x38c7af);})[_0x595a('0x3e')](function(_0x1a36bc){_0x52c0b6(_0x1a36bc);});}else{originate(_0xc0d86d,_0x5607ab,![])['then'](function(_0x3b66c2){_0x1f78a0(_0x3b66c2);})[_0x595a('0x3e')](function(_0x1e83aa){_0x52c0b6(_0x1e83aa);});}});};Fax['prototype'][_0x595a('0x68')]=function(_0x6b7810){return!_['isNil'](_0x6b7810)&&!_[_0x595a('0x69')](_0x6b7810['name'])&&!_[_0x595a('0x69')](_0x6b7810[_0x595a('0x6a')])&&_0x6b7810[_0x595a('0x6a')]&&!_['isNil'](this[_0x595a('0x10')][util['format'](_0x595a('0x6b'),_0x6b7810['name'])])&&!_[_0x595a('0x69')](this[_0x595a('0x10')][util[_0x595a('0x60')](_0x595a('0x6b'),_0x6b7810[_0x595a('0x26')])][_0x595a('0x2f')])&&(this[_0x595a('0x10')][util[_0x595a('0x60')](_0x595a('0x6b'),_0x6b7810['name'])][_0x595a('0x2f')]==='reachable'||this[_0x595a('0x10')][util[_0x595a('0x60')](_0x595a('0x6b'),_0x6b7810['name'])]['status']==='unmonitored');};Fax[_0x595a('0x29')][_0x595a('0x5b')]=function(_0x112905,_0xa89e){if(!this[_0x595a('0x68')](_0x112905)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x595a('0x69')](_0x112905)?'':_0x112905[_0x595a('0x26')]+_0x595a('0x6c'));return{'isValid':![],'message':_0x595a('0x6d')};}if(_[_0x595a('0x69')](_0xa89e[_0x595a('0x7')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON['stringify'](_0xa89e));return{'isValid':![],'message':_0x595a('0x6e')};}if(_[_0x595a('0x69')](_0xa89e[_0x595a('0x5')])){ut[_0x595a('0x49')](_0x595a('0x6f'),JSON[_0x595a('0x40')](_0xa89e));return{'isValid':![],'message':_0x595a('0x70')};}return{'isValid':!![],'message':_0x595a('0x71')};};Fax[_0x595a('0x29')][_0x595a('0x72')]=function(_0x222caf,_0x5872d6=0x2710){if(this[_0x595a('0xe')][_0x222caf]){setTimeout(()=>{delete this['channels'][_0x222caf];},_0x5872d6);}};module[_0x595a('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 72dd12b..f04ab7d 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 _0x3061=['../rpc/faxAccount','error','inspect','resolve','then','notify','catch','[Notify]\x20','util','../../../config/logger','preview','lodash'];(function(_0x329767,_0x1e589a){var _0x7cd74a=function(_0x3263e8){while(--_0x3263e8){_0x329767['push'](_0x329767['shift']());}};_0x7cd74a(++_0x1e589a);}(_0x3061,0x1e8));var _0x1306=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x3061[_0x396466];return _0x5e9ab4;};'use strict';var util=require(_0x1306('0x0'));var BPromise=require('bluebird');var logger=require(_0x1306('0x1'))(_0x1306('0x2'));var _=require(_0x1306('0x3'));var faxAccount=require(_0x1306('0x4'));function loggerCatch(_0x1046fd){return function(_0x2effc2){logger[_0x1306('0x5')](_0x1046fd,util[_0x1306('0x6')](_0x2effc2,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x133c5e,_0x57c6f2){return BPromise[_0x1306('0x7')]()[_0x1306('0x8')](faxAccount[_0x1306('0x9')](_0x133c5e,_0x57c6f2))[_0x1306('0xa')](loggerCatch(_0x1306('0xb')));}; \ No newline at end of file +var _0xb5a8=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','util'];(function(_0x48f7c2,_0x4dabfc){var _0x32b5ab=function(_0xd413bb){while(--_0xd413bb){_0x48f7c2['push'](_0x48f7c2['shift']());}};_0x32b5ab(++_0x4dabfc);}(_0xb5a8,0x15b));var _0x8b5a=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb5a8[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x8b5a('0x0'));var BPromise=require(_0x8b5a('0x1'));var logger=require(_0x8b5a('0x2'))(_0x8b5a('0x3'));var _=require(_0x8b5a('0x4'));var faxAccount=require(_0x8b5a('0x5'));function loggerCatch(_0x3bb751){return function(_0xb80ea1){logger[_0x8b5a('0x6')](_0x3bb751,util[_0x8b5a('0x7')](_0xb80ea1,{'showHidden':![],'depth':null}));};}exports[_0x8b5a('0x8')]=function(_0x39dbfd,_0x1cc3cc){return BPromise[_0x8b5a('0x9')]()[_0x8b5a('0xa')](faxAccount[_0x8b5a('0x8')](_0x39dbfd,_0x1cc3cc))[_0x8b5a('0xb')](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 28b7818..45adfe1 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 _0xd660=['execute','info','Exec\x20gs','util','../../../../config/logger','child_process','exec'];(function(_0x551e7a,_0x371f71){var _0x2dd574=function(_0x59226f){while(--_0x59226f){_0x551e7a['push'](_0x551e7a['shift']());}};_0x2dd574(++_0x371f71);}(_0xd660,0x184));var _0x0d66=function(_0x47680e,_0x1f2270){_0x47680e=_0x47680e-0x0;var _0x35f749=_0xd660[_0x47680e];return _0x35f749;};'use strict';var util=require(_0x0d66('0x0'));var logger=require(_0x0d66('0x1'))('fax');var BPromise=require('bluebird');var exec=require(_0x0d66('0x2'))[_0x0d66('0x3')];exports[_0x0d66('0x4')]=function(_0x277f14){return new BPromise(function(_0x1b97a1,_0x3cbc3d){exec(_0x277f14,function(_0x51f711,_0x2b63ac,_0x2890c1){logger[_0x0d66('0x5')](_0x0d66('0x6'),_0x2b63ac);if(_0x51f711){logger[_0x0d66('0x5')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x51f711,{'showHidden':![],'depth':null}),_0x2b63ac,_0x2890c1);_0x3cbc3d(_0x51f711);}_0x1b97a1(_0x2b63ac);});});}; \ No newline at end of file +var _0xa4ad=['exec','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','bluebird','child_process'];(function(_0x1079b3,_0x1c3c8e){var _0x2be27e=function(_0x38d54b){while(--_0x38d54b){_0x1079b3['push'](_0x1079b3['shift']());}};_0x2be27e(++_0x1c3c8e);}(_0xa4ad,0xc2));var _0xda4a=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0xa4ad[_0x3bef2c];return _0x331503;};'use strict';var util=require('util');var logger=require(_0xda4a('0x0'))(_0xda4a('0x1'));var BPromise=require(_0xda4a('0x2'));var exec=require(_0xda4a('0x3'))[_0xda4a('0x4')];exports['execute']=function(_0x25d81a){return new BPromise(function(_0xdac76c,_0x252c42){exec(_0x25d81a,function(_0x3b092f,_0x3e8421,_0x48d599){logger[_0xda4a('0x5')](_0xda4a('0x6'),_0x3e8421);if(_0x3b092f){logger['info'](_0xda4a('0x6'),_0xda4a('0x7'),util[_0xda4a('0x8')](_0x3b092f,{'showHidden':![],'depth':null}),_0x3e8421,_0x48d599);_0x252c42(_0x3b092f);}_0xdac76c(_0x3e8421);});});}; \ 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 5fdd51a..4c9ae4f 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 _0xaa85=['logger','info','addVariables','headerinfo','maxrate','format','\x22%s\x22','gateway','t38timeout','uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','moment','../../../../config/logger'];(function(_0x1086c5,_0x433d09){var _0xfa59ca=function(_0x1f3ae7){while(--_0x1f3ae7){_0x1086c5['push'](_0x1086c5['shift']());}};_0xfa59ca(++_0x433d09);}(_0xaa85,0x1bf));var _0x5aa8=function(_0x1545fe,_0x379459){_0x1545fe=_0x1545fe-0x0;var _0x2cf122=_0xaa85[_0x1545fe];return _0x2cf122;};'use strict';var util=require(_0x5aa8('0x0'));var _=require('lodash');var moment=require(_0x5aa8('0x1'));var logger=require(_0x5aa8('0x2'))('fax');exports['message']=function(_0x13be34){return{'message':_0x13be34};};exports[_0x5aa8('0x3')]=function(_0x28d1be,_0x325394){logger[_0x5aa8('0x4')](_0x28d1be,util['inspect'](_0x325394,{'showHidden':![],'depth':null}));};exports[_0x5aa8('0x5')]=function(_0x4347d8,_0x2cdb57){var _0x37e5b3={'XMF-ECM':_0x2cdb57['ecm'],'XMF-HEADERINFO':_0x2cdb57[_0x5aa8('0x6')],'XMF-MINRATE':_0x2cdb57['minrate'],'XMF-MAXRATE':_0x2cdb57[_0x5aa8('0x7')],'XMF-MODEM':util[_0x5aa8('0x8')](_0x5aa8('0x9'),_0x2cdb57['modem']),'XMF-GATEWAY':_0x2cdb57[_0x5aa8('0xa')],'XMF-FAXDETECT':_0x2cdb57['faxdetect'],'XMF-T38TIMEOUT':_0x2cdb57[_0x5aa8('0xb')],'XMF-LOCALSTATIONID':_0x2cdb57['localstationid'],'XMF-PATH':_0x4347d8['path']};return _0x37e5b3;};exports['variablesAction']=function(_0x5b4197,_0x2fd361){return{'actionid':_0x5b4197[_0x5aa8('0xc')],'action':_0x5aa8('0xd'),'channel':_0x5b4197['channel'],'Exten':_0x5aa8('0xe'),'Context':_0x5aa8('0xf'),'Priority':'1','callerid':util[_0x5aa8('0x8')](_0x5aa8('0x10'),_0x5b4197[_0x5aa8('0x6')]?_0x5b4197[_0x5aa8('0x6')]:'',_0x5b4197[_0x5aa8('0x11')]),'variable':_0x2fd361,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5b4197[_0x5aa8('0xc')]};}; \ No newline at end of file +var _0x9462=['localstationid','path','uniqueid','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','lodash','moment','fax','info','inspect','ecm','minrate','format','modem','gateway','faxdetect','t38timeout'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x9462,0x111));var _0x2946=function(_0x2a2816,_0x21057a){_0x2a2816=_0x2a2816-0x0;var _0x32ba44=_0x9462[_0x2a2816];return _0x32ba44;};'use strict';var util=require('util');var _=require(_0x2946('0x0'));var moment=require(_0x2946('0x1'));var logger=require('../../../../config/logger')(_0x2946('0x2'));exports['message']=function(_0x35c8cc){return{'message':_0x35c8cc};};exports['logger']=function(_0x514f33,_0x161769){logger[_0x2946('0x3')](_0x514f33,util[_0x2946('0x4')](_0x161769,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2f86b0,_0x351580){var _0x42bb98={'XMF-ECM':_0x351580[_0x2946('0x5')],'XMF-HEADERINFO':_0x351580['headerinfo'],'XMF-MINRATE':_0x351580[_0x2946('0x6')],'XMF-MAXRATE':_0x351580['maxrate'],'XMF-MODEM':util[_0x2946('0x7')]('\x22%s\x22',_0x351580[_0x2946('0x8')]),'XMF-GATEWAY':_0x351580[_0x2946('0x9')],'XMF-FAXDETECT':_0x351580[_0x2946('0xa')],'XMF-T38TIMEOUT':_0x351580[_0x2946('0xb')],'XMF-LOCALSTATIONID':_0x351580[_0x2946('0xc')],'XMF-PATH':_0x2f86b0[_0x2946('0xd')]};return _0x42bb98;};exports['variablesAction']=function(_0xbd52aa,_0x23fe07){return{'actionid':_0xbd52aa[_0x2946('0xe')],'action':'originate','channel':_0xbd52aa['channel'],'Exten':_0x2946('0xf'),'Context':_0x2946('0x10'),'Priority':'1','callerid':util['format'](_0x2946('0x11'),_0xbd52aa[_0x2946('0x12')]?_0xbd52aa[_0x2946('0x12')]:'',_0xbd52aa['localstationid']),'variable':_0x23fe07,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xbd52aa['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 931cde1..d94b9ae 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 _0xd6ef=['getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts'];(function(_0x47f61a,_0x55b32f){var _0x3b2f5e=function(_0x10eeff){while(--_0x10eeff){_0x47f61a['push'](_0x47f61a['shift']());}};_0x3b2f5e(++_0x55b32f);}(_0xd6ef,0x1b4));var _0xfd6e=function(_0x549960,_0x18dd0e){_0x549960=_0x549960-0x0;var _0x29756a=_0xd6ef[_0x549960];return _0x29756a;};'use strict';var util=require('util');var moment=require(_0xfd6e('0x0'));var server=require(_0xfd6e('0x1'));var Realtime=require(_0xfd6e('0x2'));var Report=require(_0xfd6e('0x3'));var Acw=require(_0xfd6e('0x4'));var Trigger=require(_0xfd6e('0x5'));var Dialer=require(_0xfd6e('0x6'));var Preview=require(_0xfd6e('0x7'));var Fax=require('./fax');var user=require(_0xfd6e('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xfd6e('0x9'));var voiceCallReport=require(_0xfd6e('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xfd6e('0xb'));var template=require(_0xfd6e('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xfd6e('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xfd6e('0xe'));var salesforce=require(_0xfd6e('0xf'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xfd6e('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xfd6e('0x11'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xfd6e('0x12'));var servicenow=require(_0xfd6e('0x13'));var dynamics365=require(_0xfd6e('0x14'));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('../../config/logger')(_0xfd6e('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xfd6e('0x16')](_0xfd6e('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfd6e('0x16')](_0xfd6e('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xfd6e('0x18')]()[_0xfd6e('0x19')](user[_0xfd6e('0x1a')]())['then'](realtime[_0xfd6e('0x1b')]())['then'](user[_0xfd6e('0x1c')]())[_0xfd6e('0x19')](realtime['initTelephones']())[_0xfd6e('0x19')](trunk[_0xfd6e('0x1d')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x1e')]())[_0xfd6e('0x19')](voiceQueue[_0xfd6e('0x1f')]())['then'](realtime[_0xfd6e('0x20')]())[_0xfd6e('0x19')](trigger[_0xfd6e('0x21')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x22')]())[_0xfd6e('0x19')](template[_0xfd6e('0x23')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x24')]())[_0xfd6e('0x19')](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0xfd6e('0x19')](salesforce[_0xfd6e('0x25')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x26')]())['then'](sugarcrm[_0xfd6e('0x27')]())['then'](realtime[_0xfd6e('0x28')]())[_0xfd6e('0x19')](freshdesk[_0xfd6e('0x29')]())['then'](realtime['initFreshdeskAccounts']())[_0xfd6e('0x19')](desk[_0xfd6e('0x2a')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x2b')]())[_0xfd6e('0x19')](zoho['getZohoAccounts']())[_0xfd6e('0x19')](realtime[_0xfd6e('0x2c')]())[_0xfd6e('0x19')](vtiger[_0xfd6e('0x2d')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x2e')]())[_0xfd6e('0x19')](freshsales[_0xfd6e('0x2f')]())[_0xfd6e('0x19')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xfd6e('0x30')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x31')]())[_0xfd6e('0x19')](dynamics365[_0xfd6e('0x32')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x33')]())['then'](campaign[_0xfd6e('0x34')]())['then'](realtime['initCampaigns']())[_0xfd6e('0x19')](voiceExtension[_0xfd6e('0x35')]())['then'](realtime[_0xfd6e('0x36')]())[_0xfd6e('0x19')](faxAccount[_0xfd6e('0x37')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x38')]())[_0xfd6e('0x19')](function(){return realtime;});}function initParams(){return Promise[_0xfd6e('0x18')]()[_0xfd6e('0x19')](voiceQueueReport['getVoiceQueueReports']())[_0xfd6e('0x19')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xfd6e('0x39')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x3a')]())[_0xfd6e('0x19')](cmHopperHistory[_0xfd6e('0x3b')]())[_0xfd6e('0x19')](realtime[_0xfd6e('0x3c')]())[_0xfd6e('0x19')](voiceCallReport[_0xfd6e('0x3d')]())[_0xfd6e('0x19')](realtime['initVoiceCallReports']())[_0xfd6e('0x3e')](function(_0x195902){logger[_0xfd6e('0x3f')](_0xfd6e('0x40'),util[_0xfd6e('0x41')](_0x195902,{'showHidden':![],'depth':null}));});}function main(){return server[_0xfd6e('0x42')](realtime,preview,fax)[_0xfd6e('0x19')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xfd6e('0x19')](function(){report[_0xfd6e('0x43')]();setInterval(initRealtime,0x1388);})[_0xfd6e('0x3e')](function(_0x38c3fa){logger['error'](_0xfd6e('0x44'),util[_0xfd6e('0x41')](_0x38c3fa,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xbfbf=['initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','sync','util','moment','./server','./realtime','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfbf,0xa4));var _0xfbfb=function(_0x3f668b,_0x6ab15c){_0x3f668b=_0x3f668b-0x0;var _0x259a77=_0xbfbf[_0x3f668b];return _0x259a77;};'use strict';var util=require(_0xfbfb('0x0'));var moment=require(_0xfbfb('0x1'));var server=require(_0xfbfb('0x2'));var Realtime=require(_0xfbfb('0x3'));var Report=require('./report');var Acw=require(_0xfbfb('0x4'));var Trigger=require(_0xfbfb('0x5'));var Dialer=require(_0xfbfb('0x6'));var Preview=require(_0xfbfb('0x7'));var Fax=require(_0xfbfb('0x8'));var user=require(_0xfbfb('0x9'));var voiceQueue=require(_0xfbfb('0xa'));var voiceQueueReport=require(_0xfbfb('0xb'));var voiceCallReport=require(_0xfbfb('0xc'));var trunk=require(_0xfbfb('0xd'));var trigger=require(_0xfbfb('0xe'));var template=require(_0xfbfb('0xf'));var cmHopperHistory=require(_0xfbfb('0x10'));var campaign=require(_0xfbfb('0x11'));var voiceExtension=require(_0xfbfb('0x12'));var faxAccount=require(_0xfbfb('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xfbfb('0x14'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xfbfb('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xfbfb('0x16'));var freshsales=require(_0xfbfb('0x17'));var servicenow=require(_0xfbfb('0x18'));var dynamics365=require(_0xfbfb('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(_0xfbfb('0x1a'))(_0xfbfb('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xfbfb('0x1c')](_0xfbfb('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xfbfb('0x1c')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()['then'](user['getAgents']())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x1f')]())['then'](user[_0xfbfb('0x20')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x21')]())[_0xfbfb('0x1e')](trunk[_0xfbfb('0x22')]())[_0xfbfb('0x1e')](realtime['initTrunks']())['then'](voiceQueue[_0xfbfb('0x23')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x24')]())[_0xfbfb('0x1e')](trigger[_0xfbfb('0x25')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x26')]())['then'](template['getTemplates']())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x27')]())[_0xfbfb('0x1e')](zendesk[_0xfbfb('0x28')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x29')]())[_0xfbfb('0x1e')](salesforce[_0xfbfb('0x2a')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x2b')]())[_0xfbfb('0x1e')](sugarcrm[_0xfbfb('0x2c')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xfbfb('0x2d')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x2e')]())['then'](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())['then'](zoho[_0xfbfb('0x2f')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x30')]())[_0xfbfb('0x1e')](vtiger[_0xfbfb('0x31')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x32')]())[_0xfbfb('0x1e')](freshsales[_0xfbfb('0x33')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x34')]())[_0xfbfb('0x1e')](servicenow['getServicenowAccounts']())['then'](realtime[_0xfbfb('0x35')]())['then'](dynamics365[_0xfbfb('0x36')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x37')]())['then'](campaign[_0xfbfb('0x38')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x39')]())['then'](voiceExtension[_0xfbfb('0x3a')]())[_0xfbfb('0x1e')](realtime['initVoiceExtensions']())[_0xfbfb('0x1e')](faxAccount[_0xfbfb('0x3b')]())['then'](realtime[_0xfbfb('0x3c')]())[_0xfbfb('0x1e')](function(){return realtime;});}function initParams(){return Promise['resolve']()['then'](voiceQueueReport[_0xfbfb('0x3d')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x3e')]())[_0xfbfb('0x1e')](cmHopperHistory[_0xfbfb('0x3f')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x40')]())[_0xfbfb('0x1e')](cmHopperHistory[_0xfbfb('0x41')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x42')]())[_0xfbfb('0x1e')](voiceCallReport[_0xfbfb('0x43')]())[_0xfbfb('0x1e')](realtime[_0xfbfb('0x44')]())['catch'](function(_0x30bbd2){logger[_0xfbfb('0x45')](_0xfbfb('0x46'),util[_0xfbfb('0x47')](_0x30bbd2,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xfbfb('0x1e')](function(){return initRealtime();})[_0xfbfb('0x1e')](function(){return initParams();})['then'](function(){report[_0xfbfb('0x48')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x424e3d){logger[_0xfbfb('0x45')]('[index.js][main]',util[_0xfbfb('0x47')](_0x424e3d,{'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 c074433..f2dd945 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 _0x7658=['redis','socket.io-emitter','name','email','accountcode','fullname','unknown','status','address','phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','state','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format','stateTime','interface','stringify','user:%s','emit','omit','exports','lodash','moment','ioredis','../../../config/environment'];(function(_0xaf8269,_0x466ff4){var _0x4a1029=function(_0x4a2f75){while(--_0x4a2f75){_0xaf8269['push'](_0xaf8269['shift']());}};_0x4a1029(++_0x466ff4);}(_0x7658,0x94));var _0x8765=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7658[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8765('0x0'));var util=require('util');var moment=require(_0x8765('0x1'));var md5=require('md5');var Redis=require(_0x8765('0x2'));var config=require(_0x8765('0x3'));config[_0x8765('0x4')]=_['defaults'](config[_0x8765('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x8765('0x5'))(new Redis(config[_0x8765('0x4')]));function Agent(_0x3cd255){this['id']=_0x3cd255['id']||0x0;this[_0x8765('0x6')]=_0x3cd255[_0x8765('0x6')]||'';this[_0x8765('0x7')]=_0x3cd255[_0x8765('0x7')]||'';this['accountcode']=_0x3cd255[_0x8765('0x8')]||'';this[_0x8765('0x9')]=_0x3cd255[_0x8765('0x9')]||'';this['state']=_0x8765('0xa');this['stateTime']=0x0;this[_0x8765('0xb')]='unknown';this[_0x8765('0xc')]='';this[_0x8765('0xd')]='';this[_0x8765('0xe')]='';this['interface']='';this[_0x8765('0xf')]=_0x3cd255[_0x8765('0xf')]||![];this[_0x8765('0x10')]='unknown';this[_0x8765('0x11')]=0x0;this[_0x8765('0x12')]='';this[_0x8765('0x13')]='';this[_0x8765('0x14')]=![];this['local']=![];this[_0x8765('0x15')]='';}Agent[_0x8765('0x16')]['updateStatusRealtime']=function(_0x16af8d){var _0x27413d;if(_0x16af8d&&_0x16af8d[_0x8765('0x17')]){_0x27413d=_0x16af8d[_0x8765('0x17')][_0x8765('0x18')]();switch(_0x27413d){case _0x8765('0x19'):_0x27413d=_0x8765('0x1a');break;case _0x8765('0x1b'):_0x27413d='talking';break;}}if(_0x27413d&&this['voiceStatus']!==_0x27413d||_0x16af8d[_0x8765('0x1c')]){this['voiceStatusTime']=_[_0x8765('0x1d')](moment()[_0x8765('0x1e')]('x'));}if(_0x27413d){this[_0x8765('0x10')]=_0x27413d;}var _0x459044={'id':this['id'],'name':this[_0x8765('0x6')],'email':this[_0x8765('0x7')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x8765('0x17')],'stateTime':this[_0x8765('0x1f')],'status':this[_0x8765('0xb')],'address':this[_0x8765('0xc')],'online':this['online'],'voiceStatus':this[_0x8765('0x10')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x8765('0x12')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x8765('0x20')],'onhold':this['onhold']};var _0x39b577=md5(JSON[_0x8765('0x21')](_0x459044));if(this[_0x8765('0x15')]!==_0x39b577){this[_0x8765('0x15')]=_0x39b577;io['to'](util[_0x8765('0x1e')](_0x8765('0x22'),_0x459044[_0x8765('0x6')]))[_0x8765('0x23')]('user:ami:update',_[_0x8765('0x24')](_0x459044,[_0x8765('0xf')]));io[_0x8765('0x23')]('user:presence',_0x459044);}};module[_0x8765('0x25')]=Agent; \ No newline at end of file +var _0x8544=['interface','online','voiceStatusTime','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','email','address','voiceStatusCallerIdNumber','stringify','format','emit','omit','user:presence','exports','ioredis','redis','defaults','localhost','socket.io-emitter','name','fullname','state','unknown','stateTime','status','phone'];(function(_0x15d076,_0x3946fa){var _0x4ccd7b=function(_0x1b1ba7){while(--_0x1b1ba7){_0x15d076['push'](_0x15d076['shift']());}};_0x4ccd7b(++_0x3946fa);}(_0x8544,0xd8));var _0x4854=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x8544[_0x3fba9f];return _0x192cf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0x4854('0x0'));var config=require('../../../config/environment');config[_0x4854('0x1')]=_[_0x4854('0x2')](config[_0x4854('0x1')],{'host':_0x4854('0x3'),'port':0x18eb});var io=require(_0x4854('0x4'))(new Redis(config['redis']));function Agent(_0xb0cab4){this['id']=_0xb0cab4['id']||0x0;this[_0x4854('0x5')]=_0xb0cab4[_0x4854('0x5')]||'';this['email']=_0xb0cab4['email']||'';this['accountcode']=_0xb0cab4['accountcode']||'';this[_0x4854('0x6')]=_0xb0cab4['fullname']||'';this[_0x4854('0x7')]=_0x4854('0x8');this[_0x4854('0x9')]=0x0;this[_0x4854('0xa')]=_0x4854('0x8');this['address']='';this[_0x4854('0xb')]='';this['mobile']='';this[_0x4854('0xc')]='';this[_0x4854('0xd')]=_0xb0cab4['online']||![];this['voiceStatus']='unknown';this[_0x4854('0xe')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x4854('0xf')]='';this[_0x4854('0x10')]=![];this[_0x4854('0x11')]=![];this[_0x4854('0x12')]='';}Agent[_0x4854('0x13')][_0x4854('0x14')]=function(_0x245fff){var _0x5f3fc7;if(_0x245fff&&_0x245fff['state']){_0x5f3fc7=_0x245fff['state'][_0x4854('0x15')]();switch(_0x5f3fc7){case _0x4854('0x16'):_0x5f3fc7=_0x4854('0x17');break;case _0x4854('0x18'):_0x5f3fc7=_0x4854('0x19');break;}}if(_0x5f3fc7&&this[_0x4854('0x1a')]!==_0x5f3fc7||_0x245fff[_0x4854('0x1b')]){this[_0x4854('0xe')]=_[_0x4854('0x1c')](moment()['format']('x'));}if(_0x5f3fc7){this['voiceStatus']=_0x5f3fc7;}var _0x1fbe25={'id':this['id'],'name':this['name'],'email':this[_0x4854('0x1d')],'accountcode':this['accountcode'],'fullname':this[_0x4854('0x6')],'state':this[_0x4854('0x7')],'stateTime':this[_0x4854('0x9')],'status':this['status'],'address':this[_0x4854('0x1e')],'online':this[_0x4854('0xd')],'voiceStatus':this[_0x4854('0x1a')],'voiceStatusTime':this[_0x4854('0xe')],'voiceStatusCallerIdNumber':this[_0x4854('0x1f')],'voiceStatusQueue':this[_0x4854('0xf')],'interface':this[_0x4854('0xc')],'onhold':this[_0x4854('0x10')]};var _0x538a73=md5(JSON[_0x4854('0x20')](_0x1fbe25));if(this[_0x4854('0x12')]!==_0x538a73){this[_0x4854('0x12')]=_0x538a73;io['to'](util[_0x4854('0x21')]('user:%s',_0x1fbe25[_0x4854('0x5')]))[_0x4854('0x22')]('user:ami:update',_[_0x4854('0x23')](_0x1fbe25,[_0x4854('0xd')]));io[_0x4854('0x22')](_0x4854('0x24'),_0x1fbe25);}};module[_0x4854('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 9b2e4e8..1a63985 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 _0xd577=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x24e272,_0xa610b){var _0x5db8be=function(_0x2ed9e6){while(--_0x2ed9e6){_0x24e272['push'](_0x24e272['shift']());}};_0x5db8be(++_0xa610b);}(_0xd577,0xb6));var _0x7d57=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xd577[_0x31b5a5];return _0x364cc9;};'use strict';function Campaign(_0x805b2e){this['id']=_0x805b2e['id']||0x0;this['name']=_0x805b2e[_0x7d57('0x0')]||'';this[_0x7d57('0x1')]=_0x805b2e[_0x7d57('0x1')]||'campaign';this['originated']=0x0;this[_0x7d57('0x2')]=0x0;this[_0x7d57('0x3')]=0x0;this[_0x7d57('0x4')]=0x0;this[_0x7d57('0x5')]='';this[_0x7d57('0x6')]=!![];this[_0x7d57('0x7')]=_0x805b2e[_0x7d57('0x7')];this['limitCalls']=_0x805b2e[_0x7d57('0x8')];this[_0x7d57('0x9')]=_0x805b2e[_0x7d57('0x9')]||null;this[_0x7d57('0xa')]=_0x805b2e['dialGlobalInterval']?_0x805b2e[_0x7d57('0xa')]:null;this[_0x7d57('0xb')]=_0x805b2e['dialOriginateCallerIdName'];this[_0x7d57('0xc')]=_0x805b2e[_0x7d57('0xc')];this[_0x7d57('0xd')]=_0x805b2e['dialOriginateTimeout']||0x1e;this[_0x7d57('0xe')]=_0x805b2e[_0x7d57('0xe')];this[_0x7d57('0xf')]=_0x805b2e[_0x7d57('0xf')];this[_0x7d57('0x10')]=_0x805b2e[_0x7d57('0x10')];this[_0x7d57('0x11')]=_0x805b2e[_0x7d57('0x11')];this['dialNoAnswerMaxRetry']=_0x805b2e[_0x7d57('0x12')];this['dialNoAnswerRetryFrequency']=_0x805b2e['dialNoAnswerRetryFrequency'];this[_0x7d57('0x13')]=_0x805b2e[_0x7d57('0x13')];this[_0x7d57('0x14')]=_0x805b2e[_0x7d57('0x14')]||0x3;this[_0x7d57('0x15')]=_0x805b2e[_0x7d57('0x15')]||0x96;this[_0x7d57('0x16')]=_0x805b2e[_0x7d57('0x16')]||0x3;this[_0x7d57('0x17')]=_0x805b2e[_0x7d57('0x17')]||0x96;this[_0x7d57('0x18')]=_0x805b2e[_0x7d57('0x18')]||0x3;this[_0x7d57('0x19')]=_0x805b2e[_0x7d57('0x19')]||0x96;this[_0x7d57('0x1a')]=_0x805b2e[_0x7d57('0x1a')]||0x3;this[_0x7d57('0x1b')]=_0x805b2e[_0x7d57('0x1b')]||0x96;this[_0x7d57('0x1c')]=_0x805b2e[_0x7d57('0x1c')]||0x3;this[_0x7d57('0x1d')]=_0x805b2e['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x805b2e['dialOrderByScheduledAt']||'DESC';this[_0x7d57('0x1e')]=_0x805b2e['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x805b2e['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x805b2e[_0x7d57('0x1f')]||undefined;this[_0x7d57('0x20')]=_0x805b2e['TrunkBackup']?_0x805b2e[_0x7d57('0x20')]:undefined;this[_0x7d57('0x21')]=_0x805b2e[_0x7d57('0x21')]?_0x805b2e[_0x7d57('0x21')]:undefined;this['Interval']=_0x805b2e[_0x7d57('0x22')]?_0x805b2e[_0x7d57('0x22')]:undefined;this[_0x7d57('0x23')]=_0x805b2e[_0x7d57('0x23')]?_0x805b2e[_0x7d57('0x23')]:undefined;this[_0x7d57('0x24')]=_0x805b2e['SquareProject']?_0x805b2e[_0x7d57('0x23')][_0x7d57('0x0')]:undefined;this['dialAMDActive']=_0x805b2e[_0x7d57('0x25')]||![];this[_0x7d57('0x26')]=_0x805b2e[_0x7d57('0x26')];this[_0x7d57('0x27')]=_0x805b2e[_0x7d57('0x27')];this[_0x7d57('0x28')]=_0x805b2e['dialAMDAfterGreetingSilence'];this[_0x7d57('0x29')]=_0x805b2e['dialAMDTotalAnalysisTime'];this[_0x7d57('0x2a')]=_0x805b2e['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x805b2e[_0x7d57('0x2b')];this['dialAMDMaximumNumberOfWords']=_0x805b2e[_0x7d57('0x2c')];this[_0x7d57('0x2d')]=_0x805b2e[_0x7d57('0x2d')];this['dialAMDMaximumWordLength']=_0x805b2e[_0x7d57('0x2e')];}module[_0x7d57('0x2f')]=Campaign; \ No newline at end of file +var _0xafbc=['dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x20e7ce,_0x21fee8){var _0x3b8b9b=function(_0xeae0fc){while(--_0xeae0fc){_0x20e7ce['push'](_0x20e7ce['shift']());}};_0x3b8b9b(++_0x21fee8);}(_0xafbc,0x1ab));var _0xcafb=function(_0x48723f,_0x45e8c3){_0x48723f=_0x48723f-0x0;var _0x517962=_0xafbc[_0x48723f];return _0x517962;};'use strict';function Campaign(_0x529586){this['id']=_0x529586['id']||0x0;this[_0xcafb('0x0')]=_0x529586['name']||'';this[_0xcafb('0x1')]=_0x529586[_0xcafb('0x1')]||_0xcafb('0x2');this[_0xcafb('0x3')]=0x0;this['temp']=0x0;this[_0xcafb('0x4')]=0x0;this[_0xcafb('0x5')]=0x0;this[_0xcafb('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0xcafb('0x7')]=_0x529586[_0xcafb('0x7')];this[_0xcafb('0x8')]=_0x529586['limitCalls'];this['dialTimezone']=_0x529586[_0xcafb('0x9')]||null;this['dialGlobalInterval']=_0x529586['dialGlobalInterval']?_0x529586[_0xcafb('0xa')]:null;this['dialOriginateCallerIdName']=_0x529586['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x529586[_0xcafb('0xb')];this[_0xcafb('0xc')]=_0x529586[_0xcafb('0xc')]||0x1e;this[_0xcafb('0xd')]=_0x529586[_0xcafb('0xd')];this['dialCongestionRetryFrequency']=_0x529586['dialCongestionRetryFrequency'];this[_0xcafb('0xe')]=_0x529586[_0xcafb('0xe')];this[_0xcafb('0xf')]=_0x529586[_0xcafb('0xf')];this[_0xcafb('0x10')]=_0x529586[_0xcafb('0x10')];this['dialNoAnswerRetryFrequency']=_0x529586[_0xcafb('0x11')];this[_0xcafb('0x12')]=_0x529586[_0xcafb('0x12')];this[_0xcafb('0x13')]=_0x529586[_0xcafb('0x13')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x529586[_0xcafb('0x14')]||0x96;this[_0xcafb('0x15')]=_0x529586[_0xcafb('0x15')]||0x3;this[_0xcafb('0x16')]=_0x529586['dialDropRetryFrequency']||0x96;this[_0xcafb('0x17')]=_0x529586[_0xcafb('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x529586['dialAbandonedRetryFrequency']||0x96;this[_0xcafb('0x18')]=_0x529586[_0xcafb('0x18')]||0x3;this[_0xcafb('0x19')]=_0x529586[_0xcafb('0x19')]||0x96;this[_0xcafb('0x1a')]=_0x529586[_0xcafb('0x1a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x529586[_0xcafb('0x1b')]||0x96;this[_0xcafb('0x1c')]=_0x529586[_0xcafb('0x1c')]||_0xcafb('0x1d');this[_0xcafb('0x1e')]=_0x529586[_0xcafb('0x1e')]||undefined;this[_0xcafb('0x1f')]=_0x529586[_0xcafb('0x1f')]||undefined;this['dialCutDigit']=_0x529586[_0xcafb('0x20')]||undefined;this['TrunkBackup']=_0x529586[_0xcafb('0x21')]?_0x529586['TrunkBackup']:undefined;this['Trunk']=_0x529586['Trunk']?_0x529586['Trunk']:undefined;this[_0xcafb('0x22')]=_0x529586[_0xcafb('0x22')]?_0x529586[_0xcafb('0x22')]:undefined;this['SquareProject']=_0x529586[_0xcafb('0x23')]?_0x529586[_0xcafb('0x23')]:undefined;this[_0xcafb('0x24')]=_0x529586[_0xcafb('0x23')]?_0x529586['SquareProject'][_0xcafb('0x0')]:undefined;this[_0xcafb('0x25')]=_0x529586['dialAMDActive']||![];this[_0xcafb('0x26')]=_0x529586[_0xcafb('0x26')];this['dialAMDGreeting']=_0x529586[_0xcafb('0x27')];this['dialAMDAfterGreetingSilence']=_0x529586['dialAMDAfterGreetingSilence'];this[_0xcafb('0x28')]=_0x529586['dialAMDTotalAnalysisTime'];this[_0xcafb('0x29')]=_0x529586['dialAMDMinWordLength'];this[_0xcafb('0x2a')]=_0x529586['dialAMDBetweenWordsSilence'];this[_0xcafb('0x2b')]=_0x529586[_0xcafb('0x2b')];this[_0xcafb('0x2c')]=_0x529586['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x529586['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index caa9893..7595a58 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 _0xa9e1=['endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','monitorFilename','monitors','transferType','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','accountcode','uniqueid','exten','answered','answertime'];(function(_0x279a95,_0x51633e){var _0x47cf1e=function(_0x1bf47a){while(--_0x1bf47a){_0x279a95['push'](_0x279a95['shift']());}};_0x47cf1e(++_0x51633e);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0xa9e1[_0x3a4318];return _0x36d746;};'use strict';function Channel(){this[_0x1a9e('0x0')]=null;this[_0x1a9e('0x1')]='';this['destinationchannel']='';this[_0x1a9e('0x2')]=0x0;this[_0x1a9e('0x3')]='';this[_0x1a9e('0x4')]=undefined;this['connectedlinename']=undefined;this[_0x1a9e('0x5')]=0x0;this['context']='';this[_0x1a9e('0x6')]=0x0;this['linkedid']=0x0;this[_0x1a9e('0x7')]=0x0;this[_0x1a9e('0x8')]=![];this[_0x1a9e('0x9')]=null;this[_0x1a9e('0xa')]=null;this[_0x1a9e('0xb')]=![];this[_0x1a9e('0xc')]=![];this[_0x1a9e('0xd')]='';this[_0x1a9e('0xe')]='';this[_0x1a9e('0xf')]=0x0;this[_0x1a9e('0x10')]=0x0;this['holdtime']=0x0;this[_0x1a9e('0x11')]=null;this['tag']=null;this['disposition']=null;this['monitor']=![];this[_0x1a9e('0x12')]=null;this['queue']=null;this[_0x1a9e('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x1a9e('0x14')]=undefined;this['mohtime']=0x0;}module[_0x1a9e('0x15')]=Channel; \ No newline at end of file +var _0x553e=['calleridname','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','duration','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','exports','starttime','channel','destinationchannel','calleridnum'];(function(_0x1e723e,_0x3640e2){var _0x3c7483=function(_0x4f4217){while(--_0x4f4217){_0x1e723e['push'](_0x1e723e['shift']());}};_0x3c7483(++_0x3640e2);}(_0x553e,0x10f));var _0xe553=function(_0x2687bb,_0x1beb75){_0x2687bb=_0x2687bb-0x0;var _0x34c4a1=_0x553e[_0x2687bb];return _0x34c4a1;};'use strict';function Channel(){this[_0xe553('0x0')]=null;this[_0xe553('0x1')]='';this[_0xe553('0x2')]='';this[_0xe553('0x3')]=0x0;this[_0xe553('0x4')]='';this[_0xe553('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xe553('0x6')]=0x0;this[_0xe553('0x7')]='';this[_0xe553('0x8')]=0x0;this[_0xe553('0x9')]=0x0;this[_0xe553('0xa')]=0x0;this[_0xe553('0xb')]=![];this[_0xe553('0xc')]=null;this['endtime']=null;this[_0xe553('0xd')]=![];this[_0xe553('0xe')]=![];this[_0xe553('0xf')]='';this[_0xe553('0x10')]='';this[_0xe553('0x11')]=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this[_0xe553('0x12')]=null;this[_0xe553('0x13')]=![];this[_0xe553('0x14')]=null;this[_0xe553('0x15')]=null;this[_0xe553('0x16')]=[];this['transfercalleridnum']=undefined;this[_0xe553('0x17')]=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xe553('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index caea1be..7206a61 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 _0xe1bf=['serverUrl','exports','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xe1bf,0x120));var _0xfe1b=function(_0xb29ab3,_0x29d664){_0xb29ab3=_0xb29ab3-0x0;var _0x379126=_0xe1bf[_0xb29ab3];return _0x379126;};'use strict';function DeskAccount(_0x187968){this['id']=_0x187968['id']||0x0;this['name']=_0x187968['name']||'';this[_0xfe1b('0x0')]=_0x187968[_0xfe1b('0x0')]||'';this[_0xfe1b('0x1')]=_0x187968[_0xfe1b('0x1')]||'';this['authType']=_0x187968[_0xfe1b('0x2')]||'';this[_0xfe1b('0x3')]=_0x187968[_0xfe1b('0x3')]||'';this[_0xfe1b('0x4')]=_0x187968['consumerKey']||'';this['consumerSecret']=_0x187968[_0xfe1b('0x5')]||'';this[_0xfe1b('0x6')]=_0x187968[_0xfe1b('0x6')]||'';this[_0xfe1b('0x7')]=_0x187968[_0xfe1b('0x7')]||'';this[_0xfe1b('0x8')]=_0x187968[_0xfe1b('0x8')]||'';this[_0xfe1b('0x9')]=_0x187968[_0xfe1b('0x9')]||'';this['Configurations']=_0x187968['Configurations']||{};}module[_0xfe1b('0xa')]=DeskAccount; \ No newline at end of file +var _0x4408=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4408,0xd9));var _0x8440=function(_0x2a416e,_0x478646){_0x2a416e=_0x2a416e-0x0;var _0x4a4f81=_0x4408[_0x2a416e];return _0x4a4f81;};'use strict';function DeskAccount(_0x2e2e9f){this['id']=_0x2e2e9f['id']||0x0;this[_0x8440('0x0')]=_0x2e2e9f[_0x8440('0x0')]||'';this[_0x8440('0x1')]=_0x2e2e9f[_0x8440('0x1')]||'';this['remoteUri']=_0x2e2e9f[_0x8440('0x2')]||'';this[_0x8440('0x3')]=_0x2e2e9f[_0x8440('0x3')]||'';this[_0x8440('0x4')]=_0x2e2e9f[_0x8440('0x4')]||'';this[_0x8440('0x5')]=_0x2e2e9f[_0x8440('0x5')]||'';this[_0x8440('0x6')]=_0x2e2e9f['consumerSecret']||'';this[_0x8440('0x7')]=_0x2e2e9f[_0x8440('0x7')]||'';this[_0x8440('0x8')]=_0x2e2e9f['tokenSecret']||'';this[_0x8440('0x9')]=_0x2e2e9f[_0x8440('0x9')]||'';this[_0x8440('0xa')]=_0x2e2e9f[_0x8440('0xa')]||'';this[_0x8440('0xb')]=_0x2e2e9f['Configurations']||{};}module[_0x8440('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 502c53b..ce94d12 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 _0x7988=['modernAuthentication','CloudProvider','name','username','password','tenantId','clientId','clientSecret','serverUrl'];(function(_0x45ba1c,_0x19de0e){var _0x2095d2=function(_0x1f079f){while(--_0x1f079f){_0x45ba1c['push'](_0x45ba1c['shift']());}};_0x2095d2(++_0x19de0e);}(_0x7988,0x92));var _0x8798=function(_0x3acb76,_0x2dc3c7){_0x3acb76=_0x3acb76-0x0;var _0x434d45=_0x7988[_0x3acb76];return _0x434d45;};'use strict';function Dynamics365Account(_0x208263){this['id']=_0x208263['id']||0x0;this[_0x8798('0x0')]=_0x208263[_0x8798('0x0')]||'';this[_0x8798('0x1')]=_0x208263[_0x8798('0x1')]||'';this[_0x8798('0x2')]=_0x208263[_0x8798('0x2')]||'';this['remoteUri']=_0x208263['remoteUri']||'';this[_0x8798('0x3')]=_0x208263['tenantId']||'';this[_0x8798('0x4')]=_0x208263['clientId']||'';this[_0x8798('0x5')]=_0x208263[_0x8798('0x5')]||{};this[_0x8798('0x6')]=_0x208263[_0x8798('0x6')]||'';this['modernAuthentication']=_0x208263[_0x8798('0x7')]||![];this['Configurations']=_0x208263['Configurations']||{};this['CloudProvider']=_0x208263[_0x8798('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x3b7f=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x3b7f,0xbe));var _0xf3b7=function(_0x550204,_0x58d6aa){_0x550204=_0x550204-0x0;var _0x33a54b=_0x3b7f[_0x550204];return _0x33a54b;};'use strict';function Dynamics365Account(_0x3e01df){this['id']=_0x3e01df['id']||0x0;this['name']=_0x3e01df[_0xf3b7('0x0')]||'';this[_0xf3b7('0x1')]=_0x3e01df[_0xf3b7('0x1')]||'';this['password']=_0x3e01df[_0xf3b7('0x2')]||'';this[_0xf3b7('0x3')]=_0x3e01df[_0xf3b7('0x3')]||'';this['tenantId']=_0x3e01df[_0xf3b7('0x4')]||'';this[_0xf3b7('0x5')]=_0x3e01df['clientId']||'';this['clientSecret']=_0x3e01df[_0xf3b7('0x6')]||{};this[_0xf3b7('0x7')]=_0x3e01df['serverUrl']||'';this[_0xf3b7('0x8')]=_0x3e01df[_0xf3b7('0x8')]||![];this[_0xf3b7('0x9')]=_0x3e01df[_0xf3b7('0x9')]||{};this[_0xf3b7('0xa')]=_0x3e01df[_0xf3b7('0xa')]||{};}module[_0xf3b7('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 c4ff0f8..36adbfd 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 _0xf462=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','key','name','description','ecm','headerinfo','minrate'];(function(_0x3879f5,_0x5b4fe8){var _0x27ee90=function(_0x46484a){while(--_0x46484a){_0x3879f5['push'](_0x3879f5['shift']());}};_0x27ee90(++_0x5b4fe8);}(_0xf462,0x1ad));var _0x2f46=function(_0x18f152,_0x41585a){_0x18f152=_0x18f152-0x0;var _0xa10b34=_0xf462[_0x18f152];return _0xa10b34;};'use strict';function FaxAccount(_0x49646a){this['id']=_0x49646a['id']||0x0;this['name']=_0x49646a[_0x2f46('0x0')]||'';this['description']=_0x49646a[_0x2f46('0x1')];this[_0x2f46('0x2')]=_0x49646a[_0x2f46('0x2')];this[_0x2f46('0x3')]=_0x49646a[_0x2f46('0x3')];this['localstationid']=_0x49646a['localstationid'];this[_0x2f46('0x4')]=_0x49646a[_0x2f46('0x4')]||0x960;this[_0x2f46('0x5')]=_0x49646a['maxrate']||0x3840;this[_0x2f46('0x6')]=_0x49646a[_0x2f46('0x6')]||_0x2f46('0x7');this[_0x2f46('0x8')]=_0x49646a['gateway']||'no';this[_0x2f46('0x9')]=_0x49646a[_0x2f46('0x9')]||'no';this['t38timeout']=_0x49646a[_0x2f46('0xa')]||0x1388;this[_0x2f46('0xb')]=_0x49646a['tech']||'SIP';this[_0x2f46('0xc')]=_0x49646a[_0x2f46('0xc')]?_0x49646a[_0x2f46('0xc')]:undefined;this['ListId']=_0x49646a['ListId'];this[_0x2f46('0xd')]=_0x49646a[_0x2f46('0xd')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xb4d9=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x265565,_0x46c184){var _0x61c377=function(_0x16bde9){while(--_0x16bde9){_0x265565['push'](_0x265565['shift']());}};_0x61c377(++_0x46c184);}(_0xb4d9,0x1af));var _0x9b4d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb4d9[_0xc4001c];return _0x49f7bc;};'use strict';function FaxAccount(_0x5fb3bb){this['id']=_0x5fb3bb['id']||0x0;this[_0x9b4d('0x0')]=_0x5fb3bb[_0x9b4d('0x0')]||'';this['description']=_0x5fb3bb[_0x9b4d('0x1')];this[_0x9b4d('0x2')]=_0x5fb3bb['ecm'];this['headerinfo']=_0x5fb3bb[_0x9b4d('0x3')];this[_0x9b4d('0x4')]=_0x5fb3bb[_0x9b4d('0x4')];this['minrate']=_0x5fb3bb['minrate']||0x960;this[_0x9b4d('0x5')]=_0x5fb3bb[_0x9b4d('0x5')]||0x3840;this[_0x9b4d('0x6')]=_0x5fb3bb['modem']||_0x9b4d('0x7');this[_0x9b4d('0x8')]=_0x5fb3bb[_0x9b4d('0x8')]||'no';this['faxdetect']=_0x5fb3bb[_0x9b4d('0x9')]||'no';this[_0x9b4d('0xa')]=_0x5fb3bb[_0x9b4d('0xa')]||0x1388;this[_0x9b4d('0xb')]=_0x5fb3bb[_0x9b4d('0xb')]||_0x9b4d('0xc');this[_0x9b4d('0xd')]=_0x5fb3bb[_0x9b4d('0xd')]?_0x5fb3bb[_0x9b4d('0xd')]:undefined;this[_0x9b4d('0xe')]=_0x5fb3bb[_0x9b4d('0xe')];this[_0x9b4d('0xf')]=_0x5fb3bb[_0x9b4d('0xf')];}module[_0x9b4d('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 0a59ffa..ac7f22d 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 _0x1797=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x13d693,_0x943ecc){var _0x55f2ec=function(_0x30a31a){while(--_0x30a31a){_0x13d693['push'](_0x13d693['shift']());}};_0x55f2ec(++_0x943ecc);}(_0x1797,0xb8));var _0x7179=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x1797[_0x934425];return _0x31d596;};'use strict';function FreshdeskAccount(_0x2c52b0){this['id']=_0x2c52b0['id']||0x0;this[_0x7179('0x0')]=_0x2c52b0[_0x7179('0x0')]||'';this['username']=_0x2c52b0[_0x7179('0x1')]||'';this[_0x7179('0x2')]=_0x2c52b0['token']||'';this['remoteUri']=_0x2c52b0[_0x7179('0x3')]||'';this[_0x7179('0x4')]=_0x2c52b0['serverUrl']||'';this[_0x7179('0x5')]=_0x2c52b0[_0x7179('0x5')]||{};}module[_0x7179('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x38bd=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x25ff2f,_0x5c70dc){var _0x5c2cb2=function(_0x7a945a){while(--_0x7a945a){_0x25ff2f['push'](_0x25ff2f['shift']());}};_0x5c2cb2(++_0x5c70dc);}(_0x38bd,0x92));var _0xd38b=function(_0x5dcc71,_0x29a28f){_0x5dcc71=_0x5dcc71-0x0;var _0x4a2e76=_0x38bd[_0x5dcc71];return _0x4a2e76;};'use strict';function FreshdeskAccount(_0x25e077){this['id']=_0x25e077['id']||0x0;this[_0xd38b('0x0')]=_0x25e077[_0xd38b('0x0')]||'';this[_0xd38b('0x1')]=_0x25e077['username']||'';this['apiKey']=_0x25e077[_0xd38b('0x2')]||'';this[_0xd38b('0x3')]=_0x25e077[_0xd38b('0x3')]||'';this[_0xd38b('0x4')]=_0x25e077[_0xd38b('0x4')]||'';this[_0xd38b('0x5')]=_0x25e077[_0xd38b('0x5')]||{};}module[_0xd38b('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 58a6cd3..34db57f 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 _0x6379=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6379,0x84));var _0x9637=function(_0x278b00,_0x1c7a48){_0x278b00=_0x278b00-0x0;var _0x2dc8f2=_0x6379[_0x278b00];return _0x2dc8f2;};'use strict';function FreshsalesAccount(_0x17b97e){this['id']=_0x17b97e['id']||0x0;this[_0x9637('0x0')]=_0x17b97e[_0x9637('0x0')]||'';this[_0x9637('0x1')]=_0x17b97e[_0x9637('0x1')]||'';this['apiKey']=_0x17b97e[_0x9637('0x2')]||'';this[_0x9637('0x3')]=_0x17b97e['remoteUri']||'';this['serverUrl']=_0x17b97e[_0x9637('0x4')]||'';this[_0x9637('0x5')]=_0x17b97e[_0x9637('0x5')]||{};}module[_0x9637('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0xbe52=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x45dafa,_0x171e29){var _0xeb385a=function(_0x2491d0){while(--_0x2491d0){_0x45dafa['push'](_0x45dafa['shift']());}};_0xeb385a(++_0x171e29);}(_0xbe52,0x164));var _0x2be5=function(_0x51ebfc,_0x31f722){_0x51ebfc=_0x51ebfc-0x0;var _0x528ca4=_0xbe52[_0x51ebfc];return _0x528ca4;};'use strict';function FreshsalesAccount(_0x21fb70){this['id']=_0x21fb70['id']||0x0;this[_0x2be5('0x0')]=_0x21fb70[_0x2be5('0x0')]||'';this[_0x2be5('0x1')]=_0x21fb70[_0x2be5('0x1')]||'';this['apiKey']=_0x21fb70[_0x2be5('0x2')]||'';this[_0x2be5('0x3')]=_0x21fb70[_0x2be5('0x3')]||'';this[_0x2be5('0x4')]=_0x21fb70[_0x2be5('0x4')]||'';this[_0x2be5('0x5')]=_0x21fb70[_0x2be5('0x5')]||{};}module[_0x2be5('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1b8183f..3179348 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 _0xe015=['calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','uniqueid'];(function(_0x751a9d,_0x4a5d4f){var _0xc430d4=function(_0x510385){while(--_0x510385){_0x751a9d['push'](_0x751a9d['shift']());}};_0xc430d4(++_0x4a5d4f);}(_0xe015,0x1d2));var _0x5e01=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xe015[_0x126558];return _0x1f6d14;};'use strict';function QueueReport(){this[_0x5e01('0x0')]='inbound';this[_0x5e01('0x1')]='';this[_0x5e01('0x2')]='';this[_0x5e01('0x3')]='';this[_0x5e01('0x4')]='';this[_0x5e01('0x5')]=null;this[_0x5e01('0x6')]=null;this[_0x5e01('0x7')]=0x1;this[_0x5e01('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x5e01('0x9')]=![];this[_0x5e01('0xa')]=null;this[_0x5e01('0xb')]=![];this[_0x5e01('0xc')]=null;this[_0x5e01('0xd')]=0x1;this['channel']='';this[_0x5e01('0xe')]='';this[_0x5e01('0xf')]='';this['accountcode']='';this[_0x5e01('0x10')]='';this[_0x5e01('0x11')]='';this[_0x5e01('0x12')]='';this['holdtime']=0x0;this[_0x5e01('0x13')]=![];this[_0x5e01('0x14')]='';this[_0x5e01('0x15')]=_0x5e01('0x16');this[_0x5e01('0x17')]=0x0;this[_0x5e01('0x18')]={};}module[_0x5e01('0x19')]=QueueReport; \ No newline at end of file +var _0x991c=['calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum'];(function(_0x576de1,_0x25656b){var _0x31ed89=function(_0x15c4bf){while(--_0x15c4bf){_0x576de1['push'](_0x576de1['shift']());}};_0x31ed89(++_0x25656b);}(_0x991c,0xc0));var _0xc991=function(_0x5de10b,_0x1c9a8f){_0x5de10b=_0x5de10b-0x0;var _0x56f9f7=_0x991c[_0x5de10b];return _0x56f9f7;};'use strict';function QueueReport(){this[_0xc991('0x0')]=_0xc991('0x1');this[_0xc991('0x2')]='';this[_0xc991('0x3')]='';this[_0xc991('0x4')]='';this[_0xc991('0x5')]='';this[_0xc991('0x6')]=null;this[_0xc991('0x7')]=null;this['position']=0x1;this[_0xc991('0x8')]=0x1;this[_0xc991('0x9')]=![];this[_0xc991('0xa')]=null;this[_0xc991('0xb')]=![];this[_0xc991('0xc')]=null;this[_0xc991('0xd')]=![];this[_0xc991('0xe')]=null;this['originalposition']=0x1;this[_0xc991('0xf')]='';this[_0xc991('0x10')]='';this[_0xc991('0x11')]='';this[_0xc991('0x12')]='';this[_0xc991('0x13')]='';this[_0xc991('0x14')]='';this[_0xc991('0x15')]='';this['holdtime']=0x0;this[_0xc991('0x16')]=![];this[_0xc991('0x17')]='';this[_0xc991('0x18')]=_0xc991('0x19');this[_0xc991('0x1a')]=0x0;this[_0xc991('0x1b')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 9fb7dca..26ecb07 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 _0xbbbc=['securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x3a7c56,_0x23c34f){var _0x4f52eb=function(_0x8645bd){while(--_0x8645bd){_0x3a7c56['push'](_0x3a7c56['shift']());}};_0x4f52eb(++_0x23c34f);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xbbbc[_0x79ebc5];return _0x3813b6;};'use strict';function SalesforceAccount(_0x372caa){this['id']=_0x372caa['id']||0x0;this[_0xcbbb('0x0')]=_0x372caa[_0xcbbb('0x0')]||'';this[_0xcbbb('0x1')]=_0x372caa[_0xcbbb('0x1')]||'';this[_0xcbbb('0x2')]=_0x372caa[_0xcbbb('0x2')]||'';this['password']=_0x372caa[_0xcbbb('0x3')]||'';this[_0xcbbb('0x4')]=_0x372caa[_0xcbbb('0x4')]||'';this[_0xcbbb('0x5')]=_0x372caa[_0xcbbb('0x5')]||'';this['securityToken']=_0x372caa[_0xcbbb('0x6')]||'';this[_0xcbbb('0x7')]=_0x372caa[_0xcbbb('0x7')]||_0xcbbb('0x8');this[_0xcbbb('0x9')]=_0x372caa[_0xcbbb('0x9')]||'';this[_0xcbbb('0xa')]=_0x372caa['Configurations']||{};}module[_0xcbbb('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xc8a4=['type','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xc8a4,0x99));var _0x4c8a=function(_0xcb5c7,_0x39d0f3){_0xcb5c7=_0xcb5c7-0x0;var _0x46ceb2=_0xc8a4[_0xcb5c7];return _0x46ceb2;};'use strict';function SalesforceAccount(_0x2a20d7){this['id']=_0x2a20d7['id']||0x0;this[_0x4c8a('0x0')]=_0x2a20d7[_0x4c8a('0x0')]||'';this[_0x4c8a('0x1')]=_0x2a20d7['username']||'';this[_0x4c8a('0x2')]=_0x2a20d7[_0x4c8a('0x2')]||'';this[_0x4c8a('0x3')]=_0x2a20d7[_0x4c8a('0x3')]||'';this[_0x4c8a('0x4')]=_0x2a20d7['clientId']||'';this['clientSecret']=_0x2a20d7[_0x4c8a('0x5')]||'';this[_0x4c8a('0x6')]=_0x2a20d7['securityToken']||'';this[_0x4c8a('0x7')]=_0x2a20d7[_0x4c8a('0x7')]||'integrationTab';this[_0x4c8a('0x8')]=_0x2a20d7['serverUrl']||'';this[_0x4c8a('0x9')]=_0x2a20d7[_0x4c8a('0x9')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7418ffb..a2a49e1 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 _0x9a8c=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x56d8b7,_0x361765){var _0x513a1f=function(_0x4708f7){while(--_0x4708f7){_0x56d8b7['push'](_0x56d8b7['shift']());}};_0x513a1f(++_0x361765);}(_0x9a8c,0x66));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';function ServicenowAccount(_0x110ad7){this['id']=_0x110ad7['id']||0x0;this[_0xc9a8('0x0')]=_0x110ad7[_0xc9a8('0x0')]||'';this[_0xc9a8('0x1')]=_0x110ad7['username']||'';this[_0xc9a8('0x2')]=_0x110ad7[_0xc9a8('0x2')]||'';this[_0xc9a8('0x3')]=_0x110ad7[_0xc9a8('0x3')]||'';this['serverUrl']=_0x110ad7[_0xc9a8('0x4')]||'';this[_0xc9a8('0x5')]=_0x110ad7[_0xc9a8('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xa780=['remoteUri','Configurations','name','username','password'];(function(_0x2513d4,_0x4fa5b9){var _0x4e92ee=function(_0x494d6f){while(--_0x494d6f){_0x2513d4['push'](_0x2513d4['shift']());}};_0x4e92ee(++_0x4fa5b9);}(_0xa780,0x151));var _0x0a78=function(_0x2f53c7,_0x22810a){_0x2f53c7=_0x2f53c7-0x0;var _0x5955f0=_0xa780[_0x2f53c7];return _0x5955f0;};'use strict';function ServicenowAccount(_0x3f7a36){this['id']=_0x3f7a36['id']||0x0;this[_0x0a78('0x0')]=_0x3f7a36[_0x0a78('0x0')]||'';this['username']=_0x3f7a36[_0x0a78('0x1')]||'';this['password']=_0x3f7a36[_0x0a78('0x2')]||'';this[_0x0a78('0x3')]=_0x3f7a36['remoteUri']||'';this['serverUrl']=_0x3f7a36['serverUrl']||'';this[_0x0a78('0x4')]=_0x3f7a36['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index a48972f..81fe5d2 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 _0x1793=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x5030f5,_0x3878ec){var _0x418f60=function(_0x3a4467){while(--_0x3a4467){_0x5030f5['push'](_0x5030f5['shift']());}};_0x418f60(++_0x3878ec);}(_0x1793,0x1ce));var _0x3179=function(_0x429003,_0x3508da){_0x429003=_0x429003-0x0;var _0x3cc0d9=_0x1793[_0x429003];return _0x3cc0d9;};'use strict';function SugarcrmAccount(_0x2b990b){this['id']=_0x2b990b['id']||0x0;this[_0x3179('0x0')]=_0x2b990b[_0x3179('0x0')]||'';this[_0x3179('0x1')]=_0x2b990b['username']||'';this[_0x3179('0x2')]=_0x2b990b[_0x3179('0x2')]||'';this[_0x3179('0x3')]=_0x2b990b[_0x3179('0x3')]||'';this[_0x3179('0x4')]=_0x2b990b['serverUrl']||'';this['Configurations']=_0x2b990b[_0x3179('0x5')]||{};}module[_0x3179('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x54a9=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3d5a50,_0x276d89){var _0x45edc2=function(_0x5ccff3){while(--_0x5ccff3){_0x3d5a50['push'](_0x3d5a50['shift']());}};_0x45edc2(++_0x276d89);}(_0x54a9,0x186));var _0x954a=function(_0x3d1e37,_0xc68814){_0x3d1e37=_0x3d1e37-0x0;var _0x246053=_0x54a9[_0x3d1e37];return _0x246053;};'use strict';function SugarcrmAccount(_0xba7292){this['id']=_0xba7292['id']||0x0;this['name']=_0xba7292[_0x954a('0x0')]||'';this['username']=_0xba7292[_0x954a('0x1')]||'';this[_0x954a('0x2')]=_0xba7292[_0x954a('0x2')]||'';this[_0x954a('0x3')]=_0xba7292[_0x954a('0x3')]||'';this[_0x954a('0x4')]=_0xba7292[_0x954a('0x4')]||'';this['Configurations']=_0xba7292[_0x954a('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 3c12730..21ab703 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 _0x5f01=['stateTime','status','name','accountcode','state','unknown'];(function(_0xbcebe0,_0x559478){var _0x4a158d=function(_0x32aab3){while(--_0x32aab3){_0xbcebe0['push'](_0xbcebe0['shift']());}};_0x4a158d(++_0x559478);}(_0x5f01,0x9e));var _0x15f0=function(_0xb567a4,_0x1c1359){_0xb567a4=_0xb567a4-0x0;var _0x128a97=_0x5f01[_0xb567a4];return _0x128a97;};'use strict';function Telephone(_0x1e55d4){this['id']=_0x1e55d4['id']||0x0;this[_0x15f0('0x0')]=_0x1e55d4[_0x15f0('0x0')]||'';this[_0x15f0('0x1')]=_0x1e55d4['accountcode']||'';this[_0x15f0('0x2')]=_0x15f0('0x3');this[_0x15f0('0x4')]=0x0;this[_0x15f0('0x5')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xf269=['name','accountcode','state','unknown','status','address','exports'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0xf269,0xd2));var _0x9f26=function(_0x1ab342,_0x92ea3c){_0x1ab342=_0x1ab342-0x0;var _0x3751d1=_0xf269[_0x1ab342];return _0x3751d1;};'use strict';function Telephone(_0x3c1489){this['id']=_0x3c1489['id']||0x0;this[_0x9f26('0x0')]=_0x3c1489[_0x9f26('0x0')]||'';this['accountcode']=_0x3c1489[_0x9f26('0x1')]||'';this[_0x9f26('0x2')]=_0x9f26('0x3');this['stateTime']=0x0;this[_0x9f26('0x4')]='unknown';this[_0x9f26('0x5')]='';}module[_0x9f26('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 5dee14e..8020eaa 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(_0x2fc334,_0x91dd5d){var _0x3748e3=function(_0xc3d205){while(--_0xc3d205){_0x2fc334['push'](_0x2fc334['shift']());}};_0x3748e3(++_0x91dd5d);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b5aea,_0x1afe6f){_0x1b5aea=_0x1b5aea-0x0;var _0x51cae9=_0xb10b[_0x1b5aea];return _0x51cae9;};'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 _0xa9e0=['exports','name'];(function(_0x4298fa,_0x3e6203){var _0x518fe7=function(_0x2683c1){while(--_0x2683c1){_0x4298fa['push'](_0x4298fa['shift']());}};_0x518fe7(++_0x3e6203);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 597d947..bfbd1b5 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 _0x2032=['exports','name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x18a3e4,_0x12a024){var _0x15b5df=function(_0x366d73){while(--_0x366d73){_0x18a3e4['push'](_0x18a3e4['shift']());}};_0x15b5df(++_0x12a024);}(_0x2032,0xd9));var _0x2203=function(_0x3c7472,_0x2b25f1){_0x3c7472=_0x3c7472-0x0;var _0x1abd70=_0x2032[_0x3c7472];return _0x1abd70;};'use strict';function Trigger(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['channel']||_0x2203('0x2');this[_0x2203('0x3')]=_0x4d6c97['status']||![];this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||[];this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||[];this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||[];}module[_0x2203('0x7')]=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'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 66dadfa..6d417b2 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 _0xc39f=['name','stateTime','status','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','exports','active'];(function(_0x4dc44f,_0x510fdf){var _0x2d0870=function(_0x186d2d){while(--_0x186d2d){_0x4dc44f['push'](_0x4dc44f['shift']());}};_0x2d0870(++_0x510fdf);}(_0xc39f,0xcb));var _0xfc39=function(_0x32dbf0,_0x2402f0){_0x32dbf0=_0x32dbf0-0x0;var _0x2dc7a8=_0xc39f[_0x32dbf0];return _0x2dc7a8;};'use strict';function Trunk(_0x5460b8){this['id']=_0x5460b8['id']||0x0;this[_0xfc39('0x0')]=_0x5460b8[_0xfc39('0x0')]||![];this[_0xfc39('0x1')]=_0x5460b8[_0xfc39('0x1')]||'';this['state']='unknown';this[_0xfc39('0x2')]=0x0;this[_0xfc39('0x3')]=_0xfc39('0x4');this['registry']=_0x5460b8[_0xfc39('0x5')]&&_0x5460b8[_0xfc39('0x5')][_0xfc39('0x6')](':')?_0x5460b8[_0xfc39('0x5')][_0xfc39('0x7')](':')[0x0]:'';this[_0xfc39('0x8')]='';this[_0xfc39('0x9')]='';this[_0xfc39('0xa')]='';this[_0xfc39('0xb')]='';this[_0xfc39('0xc')]='';this[_0xfc39('0xd')]=_0xfc39('0x4');this['registrationtime']='';this[_0xfc39('0xe')]='';this[_0xfc39('0xf')]=_0x5460b8[_0xfc39('0xf')]||'';}module[_0xfc39('0x10')]=Trunk; \ No newline at end of file +var _0xd3c1=['port','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','stateTime','status','unknown','registry','indexOf','split','host'];(function(_0x116785,_0x438b60){var _0x3e85d7=function(_0x5274eb){while(--_0x5274eb){_0x116785['push'](_0x116785['shift']());}};_0x3e85d7(++_0x438b60);}(_0xd3c1,0x1a7));var _0x1d3c=function(_0x48246c,_0x4db4e8){_0x48246c=_0x48246c-0x0;var _0x3e4397=_0xd3c1[_0x48246c];return _0x3e4397;};'use strict';function Trunk(_0x204e7a){this['id']=_0x204e7a['id']||0x0;this[_0x1d3c('0x0')]=_0x204e7a['active']||![];this['name']=_0x204e7a[_0x1d3c('0x1')]||'';this['state']='unknown';this[_0x1d3c('0x2')]=0x0;this[_0x1d3c('0x3')]=_0x1d3c('0x4');this[_0x1d3c('0x5')]=_0x204e7a['registry']&&_0x204e7a['registry'][_0x1d3c('0x6')](':')?_0x204e7a[_0x1d3c('0x5')][_0x1d3c('0x7')](':')[0x0]:'';this[_0x1d3c('0x8')]='';this[_0x1d3c('0x9')]='';this[_0x1d3c('0xa')]='';this[_0x1d3c('0xb')]='';this[_0x1d3c('0xc')]='';this[_0x1d3c('0xd')]=_0x1d3c('0x4');this[_0x1d3c('0xe')]='';this[_0x1d3c('0xf')]='';this[_0x1d3c('0x10')]=_0x204e7a['defaultuser']||'';}module[_0x1d3c('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 0c67da4..8022ac1 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 _0xeb20=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x93ef59,_0xa99df3){var _0x56c896=function(_0x52850b){while(--_0x52850b){_0x93ef59['push'](_0x93ef59['shift']());}};_0x56c896(++_0xa99df3);}(_0xeb20,0x16a));var _0x0eb2=function(_0x2829a2,_0x32047b){_0x2829a2=_0x2829a2-0x0;var _0x3e4b17=_0xeb20[_0x2829a2];return _0x3e4b17;};'use strict';function voiceExtension(_0x146c8c){this['id']=_0x146c8c['id']||0x0;this[_0x0eb2('0x0')]=_0x146c8c[_0x0eb2('0x0')]||'';this[_0x0eb2('0x1')]=_0x146c8c[_0x0eb2('0x1')]||_0x0eb2('0x2');this[_0x0eb2('0x3')]=_0x146c8c[_0x0eb2('0x3')]||![];}module[_0x0eb2('0x4')]=voiceExtension; \ No newline at end of file +var _0x0e0e=['exten','recordingFormat','none','mandatoryDisposition','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0e0e,0x15e));var _0xe0e0=function(_0x29e4c0,_0xf8b14d){_0x29e4c0=_0x29e4c0-0x0;var _0x15b64b=_0x0e0e[_0x29e4c0];return _0x15b64b;};'use strict';function voiceExtension(_0x4ba3af){this['id']=_0x4ba3af['id']||0x0;this[_0xe0e0('0x0')]=_0x4ba3af['exten']||'';this[_0xe0e0('0x1')]=_0x4ba3af[_0xe0e0('0x1')]||_0xe0e0('0x2');this['mandatoryDisposition']=_0x4ba3af[_0xe0e0('0x3')]||![];}module[_0xe0e0('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 2881e50..980fa59 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 _0x3de9=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','random','roundrobin','rrmemory','rrordered','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acwTimeout','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0x472fbc,_0x30a6f2){var _0x24bace=function(_0x166d6f){while(--_0x166d6f){_0x472fbc['push'](_0x472fbc['shift']());}};_0x24bace(++_0x30a6f2);}(_0x3de9,0x147));var _0x93de=function(_0x579d69,_0x22ad84){_0x579d69=_0x579d69-0x0;var _0x5e9bcc=_0x3de9[_0x579d69];return _0x5e9bcc;};'use strict';var monitorFormat={'wav':_0x93de('0x0'),'wav49':_0x93de('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x93de('0x2'),'leastrecent':'leastrecent','linear':'linear','random':_0x93de('0x3'),'ringall':'ringall','rr':_0x93de('0x4'),'rrmemory':_0x93de('0x5'),'rrordered':_0x93de('0x6'),'wrandom':'wrandom'};function VoiceQueue(_0x4e3fad){this['id']=_0x4e3fad['id']||0x0;this[_0x93de('0x7')]=_0x4e3fad[_0x93de('0x7')]||'';this[_0x93de('0x8')]=_0x4e3fad[_0x93de('0x8')]||'';this[_0x93de('0x9')]=_0x4e3fad['type']||_0x93de('0xa');this[_0x93de('0xb')]=0x0;this[_0x93de('0xc')]=0x0;this[_0x93de('0xd')]=0x0;this[_0x93de('0xe')]=0x0;this[_0x93de('0xf')]=0x0;this[_0x93de('0x10')]=0x0;this[_0x93de('0x11')]=0x0;this[_0x93de('0x12')]=0x0;this[_0x93de('0x13')]=0x0;this[_0x93de('0x14')]=0x0;this[_0x93de('0x15')]=0x0;this[_0x93de('0x16')]=0x0;this[_0x93de('0x17')]=0x0;this[_0x93de('0x18')]=0x0;this[_0x93de('0x19')]=0x0;this[_0x93de('0x1a')]=0x0;this[_0x93de('0x1b')]=0x0;this[_0x93de('0x1c')]=0x0;this[_0x93de('0x1d')]=0x0;this[_0x93de('0x1e')]=0x0;this[_0x93de('0x1f')]=0x0;this['acw']=_0x4e3fad['acw']||![];this[_0x93de('0x20')]=_0x4e3fad[_0x93de('0x20')]||0xa;this['autopause']=_0x4e3fad['autopause']||'no';this[_0x93de('0x21')]=!![];this[_0x93de('0x22')]='';this[_0x93de('0x23')]='';this[_0x93de('0x24')]=0x0;this[_0x93de('0x25')]=0x0;this[_0x93de('0x26')]=_0x4e3fad[_0x93de('0x26')]||null;this[_0x93de('0x27')]=_0x4e3fad[_0x93de('0x27')]?_0x4e3fad[_0x93de('0x27')]:null;this[_0x93de('0x28')]=_0x4e3fad[_0x93de('0x28')];this[_0x93de('0x29')]=_0x4e3fad[_0x93de('0x29')]||_0x93de('0x2a');this[_0x93de('0x2b')]=_0x4e3fad[_0x93de('0x2b')]||0x0;this[_0x93de('0x2c')]=_0x4e3fad[_0x93de('0x2c')]||0x0;this[_0x93de('0x2d')]=_0x4e3fad[_0x93de('0x2d')]||0x1;this['dialPredictiveOptimization']=_0x4e3fad[_0x93de('0x2e')]||_0x93de('0x2f');this[_0x93de('0x30')]=_0x4e3fad[_0x93de('0x30')]||0.03;this['dialPredictiveInterval']=_0x4e3fad[_0x93de('0x31')]||0x258;this[_0x93de('0x32')]=_0x4e3fad[_0x93de('0x32')]||_0x93de('0x33');this[_0x93de('0x34')]=_0x4e3fad['dialOriginateCallerIdNumber']||_0x93de('0x33');this[_0x93de('0x35')]=_0x4e3fad['dialOriginateTimeout']||0x1e;this[_0x93de('0x36')]=_0x4e3fad[_0x93de('0x36')]||'tTxX';this['dialQueueTimeout']=_0x4e3fad[_0x93de('0x37')]||0x3;this[_0x93de('0x38')]=_0x4e3fad[_0x93de('0x38')]||undefined;this[_0x93de('0x39')]=_0x4e3fad['dialCongestionMaxRetry']||0x3;this[_0x93de('0x3a')]=_0x4e3fad[_0x93de('0x3a')]||0x96;this[_0x93de('0x3b')]=_0x4e3fad[_0x93de('0x3b')]||0x3;this[_0x93de('0x3c')]=_0x4e3fad['dialBusyRetryFrequency']||0x96;this[_0x93de('0x3d')]=_0x4e3fad[_0x93de('0x3d')]||0x3;this[_0x93de('0x3e')]=_0x4e3fad[_0x93de('0x3e')]||0x96;this[_0x93de('0x3f')]=_0x4e3fad[_0x93de('0x3f')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4e3fad[_0x93de('0x40')]||0x96;this['dialDropMaxRetry']=_0x4e3fad[_0x93de('0x41')]||0x3;this[_0x93de('0x42')]=_0x4e3fad[_0x93de('0x42')]||0x96;this['dialAbandonedMaxRetry']=_0x4e3fad['dialAbandonedMaxRetry']||0x3;this[_0x93de('0x43')]=_0x4e3fad[_0x93de('0x43')]||0x96;this['dialMachineMaxRetry']=_0x4e3fad[_0x93de('0x44')]||0x3;this['dialMachineRetryFrequency']=_0x4e3fad[_0x93de('0x45')]||0x96;this[_0x93de('0x46')]=_0x4e3fad[_0x93de('0x46')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4e3fad[_0x93de('0x47')]||0x96;this[_0x93de('0x48')]=_0x4e3fad[_0x93de('0x48')]||0x3;this[_0x93de('0x49')]=_0x4e3fad[_0x93de('0x49')]||0x4;this[_0x93de('0x4a')]=_0x4e3fad[_0x93de('0x4a')]?_0x4e3fad[_0x93de('0x4a')]:undefined;this[_0x93de('0x4b')]=_0x4e3fad[_0x93de('0x4b')]?_0x4e3fad[_0x93de('0x4b')]:undefined;this[_0x93de('0x4c')]=_0x4e3fad[_0x93de('0x4c')]||undefined;this[_0x93de('0x4d')]=_0x4e3fad[_0x93de('0x4d')]?_0x4e3fad[_0x93de('0x4d')]:undefined;this[_0x93de('0x4e')]=_0x4e3fad[_0x93de('0x4e')]||_0x93de('0x4f');this[_0x93de('0x50')]=_0x4e3fad[_0x93de('0x50')]||undefined;this['dialCutDigit']=_0x4e3fad[_0x93de('0x51')]||undefined;this['strategy']=strategy[_0x4e3fad[_0x93de('0x52')]];this['queueStatusComplete']=!![];this[_0x93de('0x53')]=_0x4e3fad[_0x93de('0x53')]||![];this[_0x93de('0x54')]=_0x4e3fad[_0x93de('0x54')];this[_0x93de('0x55')]=_0x4e3fad[_0x93de('0x55')];this[_0x93de('0x56')]=_0x4e3fad[_0x93de('0x56')];this[_0x93de('0x57')]=_0x4e3fad[_0x93de('0x57')];this['dialAMDMinWordLength']=_0x4e3fad['dialAMDMinWordLength'];this[_0x93de('0x58')]=_0x4e3fad[_0x93de('0x58')];this[_0x93de('0x59')]=_0x4e3fad[_0x93de('0x59')];this[_0x93de('0x5a')]=_0x4e3fad['dialAMDSilenceThreshold'];this[_0x93de('0x5b')]=_0x4e3fad['dialAMDMaximumWordLength'];this[_0x93de('0x5c')]=0x0;this['pTalking']=0x0;this[_0x93de('0x5d')]=_0x4e3fad[_0x93de('0x5d')];this[_0x93de('0x5e')]=0x0;this[_0x93de('0x5f')]=0x0;this[_0x93de('0x60')]=0x0;this[_0x93de('0x61')]=0x0;this[_0x93de('0x62')]=0x0;this[_0x93de('0x63')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x93de('0x64')]=0x0;this[_0x93de('0x65')]=0x0;this[_0x93de('0x66')]=0x0;this[_0x93de('0x67')]=0x0;this[_0x93de('0x68')]=0x0;this[_0x93de('0x69')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x93de('0x6a')]=undefined;this['startPredictive']=undefined;this[_0x93de('0x6b')]=undefined;this[_0x93de('0x6c')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x93de('0x6d')]=0x0;this[_0x93de('0x6e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x93de('0x6f')]=0x0;this[_0x93de('0x70')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x93de('0x71')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4e3fad[_0x93de('0x72')]||0x14;this[_0x93de('0x73')]=_0x4e3fad[_0x93de('0x72')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x93de('0x74')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x93de('0x75')]=0x0;this[_0x93de('0x76')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x93de('0x77')]=0x0;this['dialRecallMeTimeout']=_0x4e3fad[_0x93de('0x78')]||0x1e;this[_0x93de('0x79')]=_0x4e3fad[_0x93de('0x79')]||![];this[_0x93de('0x7a')]=!!_0x4e3fad[_0x93de('0x7a')]||![];this[_0x93de('0x7b')]=!!_0x4e3fad['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x4e3fad[_0x93de('0x7c')]||undefined;this['dialAgiAfterHangupClient']=_0x4e3fad['dialAgiAfterHangupClient']||![];this[_0x93de('0x7d')]=_0x4e3fad[_0x93de('0x7d')]||![];this['monitor_format']=monitorFormat[_0x4e3fad[_0x93de('0x8')]]?monitorFormat[_0x4e3fad[_0x93de('0x8')]]:undefined;this[_0x93de('0x7e')]=_0x4e3fad[_0x93de('0x7e')]||![];this[_0x93de('0x7f')]=_0x4e3fad['mandatoryDispositionPause']?_0x4e3fad[_0x93de('0x7f')]:undefined;this[_0x93de('0x80')]=![];}module[_0x93de('0x81')]=VoiceQueue; \ No newline at end of file +var _0x09da=['unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','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','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','name','monitor_format','type','inbound','total','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','ringing','ringInUse'];(function(_0x2ccc13,_0x53efad){var _0x3819b6=function(_0x2ad293){while(--_0x2ad293){_0x2ccc13['push'](_0x2ccc13['shift']());}};_0x3819b6(++_0x53efad);}(_0x09da,0xf4));var _0xa09d=function(_0x43cbd2,_0x3bf672){_0x43cbd2=_0x43cbd2-0x0;var _0x567296=_0x09da[_0x43cbd2];return _0x567296;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xa09d('0x0'),'gsm':_0xa09d('0x1')};var strategy={'fewestcalls':_0xa09d('0x2'),'leastrecent':_0xa09d('0x3'),'linear':_0xa09d('0x4'),'random':_0xa09d('0x5'),'ringall':_0xa09d('0x6'),'rr':'roundrobin','rrmemory':_0xa09d('0x7'),'rrordered':_0xa09d('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x45cf7e){this['id']=_0x45cf7e['id']||0x0;this[_0xa09d('0x9')]=_0x45cf7e[_0xa09d('0x9')]||'';this[_0xa09d('0xa')]=_0x45cf7e['monitor_format']||'';this['type']=_0x45cf7e[_0xa09d('0xb')]||_0xa09d('0xc');this['waiting']=0x0;this[_0xa09d('0xd')]=0x0;this['answered']=0x0;this[_0xa09d('0xe')]=0x0;this[_0xa09d('0xf')]=0x0;this[_0xa09d('0x10')]=0x0;this[_0xa09d('0x11')]=0x0;this[_0xa09d('0x12')]=0x0;this[_0xa09d('0x13')]=0x0;this[_0xa09d('0x14')]=0x0;this[_0xa09d('0x15')]=0x0;this[_0xa09d('0x16')]=0x0;this[_0xa09d('0x17')]=0x0;this[_0xa09d('0x18')]=0x0;this[_0xa09d('0x19')]=0x0;this['paused']=0x0;this[_0xa09d('0x1a')]=0x0;this[_0xa09d('0x1b')]=0x0;this['talking']=0x0;this[_0xa09d('0x1c')]=0x0;this[_0xa09d('0x1d')]=0x0;this[_0xa09d('0x1e')]=_0x45cf7e['acw']||![];this['acwTimeout']=_0x45cf7e['acwTimeout']||0xa;this[_0xa09d('0x1f')]=_0x45cf7e[_0xa09d('0x1f')]||'no';this[_0xa09d('0x20')]=!![];this[_0xa09d('0x21')]='';this[_0xa09d('0x22')]='';this['originated']=0x0;this[_0xa09d('0x23')]=0x0;this[_0xa09d('0x24')]=_0x45cf7e[_0xa09d('0x24')]||null;this[_0xa09d('0x25')]=_0x45cf7e[_0xa09d('0x25')]?_0x45cf7e['dialGlobalInterval']:null;this[_0xa09d('0x26')]=_0x45cf7e[_0xa09d('0x26')];this[_0xa09d('0x27')]=_0x45cf7e[_0xa09d('0x27')]||_0xa09d('0x28');this[_0xa09d('0x29')]=_0x45cf7e[_0xa09d('0x29')]||0x0;this[_0xa09d('0x2a')]=_0x45cf7e[_0xa09d('0x2a')]||0x0;this[_0xa09d('0x2b')]=_0x45cf7e[_0xa09d('0x2b')]||0x1;this[_0xa09d('0x2c')]=_0x45cf7e[_0xa09d('0x2c')]||_0xa09d('0x2d');this['dialPredictiveOptimizationPercentage']=_0x45cf7e[_0xa09d('0x2e')]||0.03;this['dialPredictiveInterval']=_0x45cf7e['dialPredictiveInterval']||0x258;this[_0xa09d('0x2f')]=_0x45cf7e[_0xa09d('0x2f')]||_0xa09d('0x30');this[_0xa09d('0x31')]=_0x45cf7e[_0xa09d('0x31')]||_0xa09d('0x30');this[_0xa09d('0x32')]=_0x45cf7e[_0xa09d('0x32')]||0x1e;this['dialQueueOptions']=_0x45cf7e[_0xa09d('0x33')]||_0xa09d('0x34');this['dialQueueTimeout']=_0x45cf7e['dialQueueTimeout']||0x3;this[_0xa09d('0x35')]=_0x45cf7e[_0xa09d('0x35')]||undefined;this[_0xa09d('0x36')]=_0x45cf7e['dialCongestionMaxRetry']||0x3;this[_0xa09d('0x37')]=_0x45cf7e[_0xa09d('0x37')]||0x96;this[_0xa09d('0x38')]=_0x45cf7e['dialBusyMaxRetry']||0x3;this[_0xa09d('0x39')]=_0x45cf7e[_0xa09d('0x39')]||0x96;this[_0xa09d('0x3a')]=_0x45cf7e['dialNoAnswerMaxRetry']||0x3;this[_0xa09d('0x3b')]=_0x45cf7e[_0xa09d('0x3b')]||0x96;this[_0xa09d('0x3c')]=_0x45cf7e[_0xa09d('0x3c')]||0x3;this[_0xa09d('0x3d')]=_0x45cf7e['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x45cf7e[_0xa09d('0x3e')]||0x3;this[_0xa09d('0x3f')]=_0x45cf7e[_0xa09d('0x3f')]||0x96;this['dialAbandonedMaxRetry']=_0x45cf7e[_0xa09d('0x40')]||0x3;this[_0xa09d('0x41')]=_0x45cf7e['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x45cf7e[_0xa09d('0x42')]||0x3;this[_0xa09d('0x43')]=_0x45cf7e[_0xa09d('0x43')]||0x96;this[_0xa09d('0x44')]=_0x45cf7e[_0xa09d('0x44')]||0x3;this[_0xa09d('0x45')]=_0x45cf7e['dialAgentRejectRetryFrequency']||0x96;this[_0xa09d('0x46')]=_0x45cf7e[_0xa09d('0x46')]||0x3;this[_0xa09d('0x47')]=_0x45cf7e['dialGlobalMaxRetry']||0x4;this[_0xa09d('0x48')]=_0x45cf7e[_0xa09d('0x48')]?_0x45cf7e[_0xa09d('0x48')]:undefined;this[_0xa09d('0x49')]=_0x45cf7e['TrunkBackup']?_0x45cf7e[_0xa09d('0x49')]:undefined;this[_0xa09d('0x4a')]=_0x45cf7e[_0xa09d('0x4a')]||undefined;this[_0xa09d('0x4b')]=_0x45cf7e[_0xa09d('0x4b')]?_0x45cf7e['Interval']:undefined;this[_0xa09d('0x4c')]=_0x45cf7e[_0xa09d('0x4c')]||_0xa09d('0x4d');this[_0xa09d('0x4e')]=_0x45cf7e[_0xa09d('0x4e')]||undefined;this[_0xa09d('0x4f')]=_0x45cf7e[_0xa09d('0x4f')]||undefined;this['strategy']=strategy[_0x45cf7e[_0xa09d('0x50')]];this[_0xa09d('0x51')]=!![];this[_0xa09d('0x52')]=_0x45cf7e[_0xa09d('0x52')]||![];this[_0xa09d('0x53')]=_0x45cf7e[_0xa09d('0x53')];this[_0xa09d('0x54')]=_0x45cf7e[_0xa09d('0x54')];this['dialAMDAfterGreetingSilence']=_0x45cf7e[_0xa09d('0x55')];this[_0xa09d('0x56')]=_0x45cf7e['dialAMDTotalAnalysisTime'];this[_0xa09d('0x57')]=_0x45cf7e[_0xa09d('0x57')];this[_0xa09d('0x58')]=_0x45cf7e['dialAMDBetweenWordsSilence'];this[_0xa09d('0x59')]=_0x45cf7e[_0xa09d('0x59')];this[_0xa09d('0x5a')]=_0x45cf7e['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x45cf7e[_0xa09d('0x5b')];this[_0xa09d('0x5c')]=0x0;this['pTalking']=0x0;this[_0xa09d('0x5d')]=_0x45cf7e[_0xa09d('0x5d')];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xa09d('0x5e')]=0x0;this[_0xa09d('0x5f')]=0x0;this[_0xa09d('0x60')]=0x0;this[_0xa09d('0x61')]=0x0;this[_0xa09d('0x62')]=0x0;this[_0xa09d('0x63')]=0x0;this[_0xa09d('0x64')]=0x0;this[_0xa09d('0x65')]=0x0;this[_0xa09d('0x66')]=0x0;this[_0xa09d('0x67')]=0x0;this[_0xa09d('0x68')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xa09d('0x69')]=undefined;this[_0xa09d('0x6a')]=undefined;this[_0xa09d('0x6b')]=undefined;this[_0xa09d('0x6c')]=1.05;this[_0xa09d('0x6d')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa09d('0x6e')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xa09d('0x6f')]=0x0;this[_0xa09d('0x70')]=0x0;this[_0xa09d('0x71')]=0x0;this[_0xa09d('0x72')]=0x0;this[_0xa09d('0x73')]=_0x45cf7e['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xa09d('0x74')]=_0x45cf7e[_0xa09d('0x75')]||0xa;this[_0xa09d('0x76')]=0x0;this[_0xa09d('0x77')]=0x0;this[_0xa09d('0x78')]=0x1;this[_0xa09d('0x79')]=0x0;this[_0xa09d('0x7a')]=0x0;this[_0xa09d('0x7b')]=0x0;this[_0xa09d('0x7c')]=0x0;this[_0xa09d('0x7d')]=_0x45cf7e[_0xa09d('0x7d')]||0x1e;this[_0xa09d('0x7e')]=_0x45cf7e['dialRecallInQueue']||![];this[_0xa09d('0x7f')]=!!_0x45cf7e[_0xa09d('0x7f')]||![];this[_0xa09d('0x80')]=!!_0x45cf7e[_0xa09d('0x80')]||![];this[_0xa09d('0x81')]=_0x45cf7e[_0xa09d('0x81')]||undefined;this[_0xa09d('0x82')]=_0x45cf7e['dialAgiAfterHangupClient']||![];this[_0xa09d('0x83')]=_0x45cf7e[_0xa09d('0x83')]||![];this[_0xa09d('0xa')]=monitorFormat[_0x45cf7e[_0xa09d('0xa')]]?monitorFormat[_0x45cf7e[_0xa09d('0xa')]]:undefined;this[_0xa09d('0x84')]=_0x45cf7e[_0xa09d('0x84')]||![];this['mandatoryDispositionPause']=_0x45cf7e['mandatoryDispositionPause']?_0x45cf7e[_0xa09d('0x85')]:undefined;this[_0xa09d('0x86')]=![];}module[_0xa09d('0x87')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 0dff872..c1ee1f4 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 _0x56a4=['predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','unknown','ringInUse','loggedin','callers','length','SIP/','online','incall','status','booked','keys','dialer','xcally-motion-preview','some','outboundAnswerCallsDay','preview','available','loggedIn','paused','ringing','answered','inUse','loggedInDb','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','talking','sumBillable','sumDuration','total','waiting','name','strategy','busy','invalid','onHold','notInUse','sumHoldTime','type','unavailable','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor'];(function(_0x3cff4d,_0x6c3127){var _0x389707=function(_0x1757cb){while(--_0x1757cb){_0x3cff4d['push'](_0x3cff4d['shift']());}};_0x389707(++_0x6c3127);}(_0x56a4,0x11b));var _0x456a=function(_0x230078,_0x40e1b4){_0x230078=_0x230078-0x0;var _0x379ab7=_0x56a4[_0x230078];return _0x379ab7;};'use strict';var INBOUND_COUNTERS=[_0x456a('0x0'),_0x456a('0x1'),'loggedInDb',_0x456a('0x2'),_0x456a('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x456a('0x0'),_0x456a('0x4'),_0x456a('0x5'),_0x456a('0x1'),_0x456a('0x6'),'originated',_0x456a('0x7'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0x456a('0x8'),_0x456a('0x9'),_0x456a('0xa'),'outboundNoSuchCallsDay',_0x456a('0xb'),'outboundRejectCallsDay',_0x456a('0xc'),_0x456a('0x2'),_0x456a('0xd'),_0x456a('0xe'),_0x456a('0xf'),_0x456a('0x10'),_0x456a('0x11'),_0x456a('0x12')];function VoiceQueueSummary(_0x2c2a92){this['id']=_0x2c2a92['id'];this[_0x456a('0x13')]=_0x2c2a92[_0x456a('0x13')];this['strategy']=_0x2c2a92[_0x456a('0x14')];this['abandoned']=_0x2c2a92['abandoned']||0x0;this[_0x456a('0x4')]=_0x2c2a92[_0x456a('0x4')]||0x0;this[_0x456a('0x0')]=_0x2c2a92[_0x456a('0x0')]||0x0;this['busy']=_0x2c2a92[_0x456a('0x15')]||0x0;this[_0x456a('0x5')]=_0x2c2a92[_0x456a('0x5')]||0x0;this[_0x456a('0x16')]=_0x2c2a92[_0x456a('0x16')]||0x0;this[_0x456a('0x1')]=_0x2c2a92['loggedIn']||0x0;this[_0x456a('0x6')]=_0x2c2a92[_0x456a('0x6')]||0x0;this[_0x456a('0x17')]=_0x2c2a92[_0x456a('0x17')]||0x0;this['notInUse']=_0x2c2a92[_0x456a('0x18')]||0x0;this[_0x456a('0x2')]=_0x2c2a92[_0x456a('0x2')]||0x0;this['ringing']=_0x2c2a92[_0x456a('0x3')]||0x0;this['ringInUse']=_0x2c2a92['ringInUse'];this[_0x456a('0xf')]=_0x2c2a92['sumBillable'];this[_0x456a('0x10')]=_0x2c2a92['sumDuration'];this[_0x456a('0x19')]=_0x2c2a92[_0x456a('0x19')]||0x0;this['talking']=_0x2c2a92['talking']||0x0;this['total']=_0x2c2a92[_0x456a('0x11')]||0x0;this[_0x456a('0x1a')]=_0x2c2a92[_0x456a('0x1a')];this['unavailable']=_0x2c2a92[_0x456a('0x1b')]||0x0;this['unknown']=_0x2c2a92['unknown']||0x0;this['unmanaged']=_0x2c2a92[_0x456a('0x1c')]||0x0;this[_0x456a('0x12')]=_0x2c2a92[_0x456a('0x12')]||0x0;if(_0x2c2a92['type']===_0x456a('0x1d')){this[_0x456a('0xd')]=_0x2c2a92['pTalking']||0x0;this[_0x456a('0x1e')]=_0x2c2a92['dialActive'];this['dialMethod']=_0x2c2a92[_0x456a('0x1f')];this['dialOriginateCallerIdName']=_0x2c2a92[_0x456a('0x20')];this['dialOriginateCallerIdNumber']=_0x2c2a92[_0x456a('0x21')];this[_0x456a('0x22')]=_0x2c2a92[_0x456a('0x22')];this[_0x456a('0x23')]=_0x2c2a92[_0x456a('0x23')];this[_0x456a('0x24')]=_0x2c2a92[_0x456a('0x24')];this[_0x456a('0x25')]=_0x2c2a92['outboundAnswerAgiCallsDay'];this['outboundAnswerCallsDay']=_0x2c2a92['outboundAnswerCallsDay'];this[_0x456a('0x26')]=_0x2c2a92[_0x456a('0x26')];this['outboundBusyCallsDay']=_0x2c2a92[_0x456a('0x8')];this[_0x456a('0x9')]=_0x2c2a92[_0x456a('0x9')];this[_0x456a('0x27')]=_0x2c2a92[_0x456a('0x27')];this['outboundDropCallsDayCallersExit']=_0x2c2a92[_0x456a('0x28')];this[_0x456a('0x29')]=_0x2c2a92[_0x456a('0x29')];this['outboundNoAnswerCallsDay']=_0x2c2a92[_0x456a('0xa')];this[_0x456a('0x2a')]=_0x2c2a92['outboundNoSuchCallsDay'];this[_0x456a('0x2b')]=_0x2c2a92[_0x456a('0x2b')];this[_0x456a('0xb')]=_0x2c2a92[_0x456a('0xb')];this[_0x456a('0x2c')]=_0x2c2a92['outboundRejectCallsDay'];this[_0x456a('0xc')]=_0x2c2a92[_0x456a('0xc')];this[_0x456a('0x2d')]=_0x2c2a92['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x2c2a92[_0x456a('0x2e')];this['predictiveIntervalAvgTalktime']=_0x2c2a92['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x2c2a92[_0x456a('0x2f')];this[_0x456a('0x30')]=_0x2c2a92[_0x456a('0x30')];this[_0x456a('0x31')]=_0x2c2a92['predictiveIntervalErlangCalls'];this[_0x456a('0x32')]=_0x2c2a92[_0x456a('0x32')];this['predictiveIntervalHitRate']=_0x2c2a92[_0x456a('0x33')];this[_0x456a('0x34')]=_0x2c2a92[_0x456a('0x34')];this[_0x456a('0x35')]=_0x2c2a92[_0x456a('0x35')];this['predictiveIntervalAvailable']=_0x2c2a92[_0x456a('0x36')];this[_0x456a('0x37')]=_0x2c2a92['predictiveIntervalTotalCalls'];this[_0x456a('0x38')]=_0x2c2a92[_0x456a('0x38')];this[_0x456a('0x39')]=_0x2c2a92[_0x456a('0x39')];this[_0x456a('0x3a')]=_0x2c2a92[_0x456a('0x3a')];this[_0x456a('0x3b')]=_0x2c2a92[_0x456a('0x3b')];this['erlangBusyFactor']=_0x2c2a92[_0x456a('0x3c')];this[_0x456a('0x3d')]=_0x2c2a92[_0x456a('0x3d')];this[_0x456a('0x3e')]=_0x2c2a92[_0x456a('0x3e')];this['message']=_0x2c2a92[_0x456a('0x3f')];this['statusMessage']=_0x2c2a92[_0x456a('0x40')];}if(_0x2c2a92[_0x456a('0x41')]){this['Trunk']={'id':_0x2c2a92[_0x456a('0x41')]['id'],'name':_0x2c2a92[_0x456a('0x41')][_0x456a('0x13')],'active':_0x2c2a92['Trunk'][_0x456a('0x42')],'callerid':_0x2c2a92['Trunk']['callerid']};}}VoiceQueueSummary[_0x456a('0x43')]['createReport']=function(_0x13c52c,_0x291f23,_0x5878f4,_0x442da9){this[_0x456a('0x6')]=0x0;this[_0x456a('0xe')]=0x0;this[_0x456a('0x2')]=0x0;this[_0x456a('0x44')]=0x0;this[_0x456a('0x18')]=0x0;this['inUse']=0x0;this[_0x456a('0x15')]=0x0;this['invalid']=0x0;this[_0x456a('0x1b')]=0x0;this[_0x456a('0x3')]=0x0;this[_0x456a('0x45')]=0x0;this[_0x456a('0x17')]=0x0;if(_0x5878f4){if(_0x5878f4[_0x456a('0x0')]){this['available']=Number(_0x5878f4[_0x456a('0x0')]);}if(_0x5878f4[_0x456a('0x46')]){this[_0x456a('0x1')]=Number(_0x5878f4[_0x456a('0x46')]);}if(_0x5878f4[_0x456a('0x47')]){this[_0x456a('0x12')]=Number(_0x5878f4[_0x456a('0x47')]);}}for(var _0x5a8a3a=0x0;_0x5a8a3a<_0x13c52c[_0x456a('0x48')];_0x5a8a3a++){var _0x28eff9=_0x291f23[_0x456a('0x49')+_0x13c52c[_0x5a8a3a][_0x456a('0x13')]];if(_0x28eff9&&_0x28eff9[_0x456a('0x4a')]){this['loggedInDb']+=0x1;}if(_0x13c52c[_0x5a8a3a][_0x456a('0x4b')]==='1'){this[_0x456a('0xe')]+=0x1;}if(_0x13c52c[_0x5a8a3a]['paused']==='1'&&!['2','7','8']['includes'](_0x13c52c[_0x5a8a3a][_0x456a('0x4c')])){this['paused']+=0x1;}switch(_0x13c52c[_0x5a8a3a][_0x456a('0x4c')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x456a('0x18')]+=0x1;break;case'2':this[_0x456a('0x5')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0x456a('0x3')]+=0x1;break;case'7':this[_0x456a('0x45')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this['dialMethod']===_0x456a('0x4d')){var _0x509e13=Object[_0x456a('0x4e')](_0x442da9);for(var _0xd08a6d=0x0;_0xd08a6d<_0x509e13[_0x456a('0x48')];_0xd08a6d++){var _0x51c97d=_0x509e13[_0xd08a6d];var _0x4e2b92=_0x442da9[_0x51c97d];if(_0x4e2b92['queue']===this[_0x456a('0x13')]&&_0x4e2b92[_0x456a('0x1a')]===_0x456a('0x4f')&&_0x4e2b92['exten']===_0x456a('0x50')){this[_0x456a('0xe')]+=0x1;}}if(this[_0x456a('0xe')]>this[_0x456a('0x5')]){this[_0x456a('0xe')]=this[_0x456a('0x5')];}this[_0x456a('0xd')]=0x0;}return this;};VoiceQueueSummary[_0x456a('0x43')]['compareToInboundQueue']=function(_0x3f539e){var _0x2a3f7f=![];if(_0x3f539e){_0x2a3f7f=INBOUND_COUNTERS['some'](function(_0x239862){return this[_0x239862]!==_0x3f539e[_0x239862];},this);}return _0x2a3f7f;};VoiceQueueSummary[_0x456a('0x43')]['compareToOutboundQueue']=function(_0x3fd45d){var _0x2db013=![];var _0x54c33c=![];var _0x19d20d=![];if(_0x3fd45d){_0x2db013=this[_0x456a('0x1f')]!==_0x3fd45d[_0x456a('0x1f')]||this[_0x456a('0x1e')]!==_0x3fd45d['dialActive']||this['message']!==_0x3fd45d[_0x456a('0x3f')]||this['statusMessage']!==_0x3fd45d[_0x456a('0x40')];_0x54c33c=OUTBOUND_COUNTERS[_0x456a('0x51')](function(_0x564622){return this[_0x564622]!==_0x3fd45d[_0x564622];},this);if(this['Trunk']&&_0x3fd45d[_0x456a('0x41')]){_0x19d20d=this[_0x456a('0x41')]['name']!==_0x3fd45d[_0x456a('0x41')][_0x456a('0x13')]||this[_0x456a('0x41')][_0x456a('0x42')]!==_0x3fd45d[_0x456a('0x41')][_0x456a('0x42')];}}return _0x2db013||_0x54c33c||_0x19d20d;};VoiceQueueSummary[_0x456a('0x43')]['updateReportFromOutboundQueue']=function(_0x3ff564){this[_0x456a('0x4')]=_0x3ff564['answered'];this['message']=_0x3ff564['message'];this[_0x456a('0x40')]=_0x3ff564[_0x456a('0x40')];this[_0x456a('0x38')]=_0x3ff564['originated'];this['outboundAbandonedCallsDay']=_0x3ff564[_0x456a('0x7')];this[_0x456a('0x52')]=_0x3ff564['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x3ff564[_0x456a('0x26')];this[_0x456a('0x8')]=_0x3ff564['outboundBusyCallsDay'];this[_0x456a('0x9')]=_0x3ff564[_0x456a('0x9')];this[_0x456a('0xa')]=_0x3ff564['outboundNoAnswerCallsDay'];this[_0x456a('0x2a')]=_0x3ff564[_0x456a('0x2a')];this[_0x456a('0xb')]=_0x3ff564[_0x456a('0xb')];this[_0x456a('0x2c')]=_0x3ff564[_0x456a('0x2c')];this[_0x456a('0xc')]=_0x3ff564[_0x456a('0xc')];this[_0x456a('0xf')]=_0x3ff564[_0x456a('0xf')];this['sumDuration']=_0x3ff564[_0x456a('0x10')];this[_0x456a('0x11')]=_0x3ff564['total'];if(this[_0x456a('0x1f')]===_0x456a('0x53')){this[_0x456a('0xd')]=_0x3ff564[_0x456a('0xd')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x1670=['abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','keys','queue','exten','inUse','some','updateReportFromOutboundQueue','preview','available','loggedIn','paused','talking','waiting','answered','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy'];(function(_0x14ed75,_0x54c6c2){var _0x448446=function(_0x59ecc5){while(--_0x59ecc5){_0x14ed75['push'](_0x14ed75['shift']());}};_0x448446(++_0x54c6c2);}(_0x1670,0x9a));var _0x0167=function(_0x5d892e,_0x20d511){_0x5d892e=_0x5d892e-0x0;var _0x2c73ba=_0x1670[_0x5d892e];return _0x2c73ba;};'use strict';var INBOUND_COUNTERS=[_0x0167('0x0'),_0x0167('0x1'),'loggedInDb',_0x0167('0x2'),'ringing',_0x0167('0x3'),_0x0167('0x4')];var OUTBOUND_COUNTERS=[_0x0167('0x0'),_0x0167('0x5'),'inUse','loggedIn',_0x0167('0x6'),_0x0167('0x7'),_0x0167('0x8'),_0x0167('0x9'),_0x0167('0xa'),_0x0167('0xb'),_0x0167('0xc'),_0x0167('0xd'),'outboundNoSuchCallsDay','outboundReCallsDay',_0x0167('0xe'),_0x0167('0xf'),_0x0167('0x2'),_0x0167('0x10'),_0x0167('0x3'),_0x0167('0x11'),_0x0167('0x12'),_0x0167('0x13'),_0x0167('0x4')];function VoiceQueueSummary(_0x275e2f){this['id']=_0x275e2f['id'];this[_0x0167('0x14')]=_0x275e2f[_0x0167('0x14')];this[_0x0167('0x15')]=_0x275e2f[_0x0167('0x15')];this['abandoned']=_0x275e2f[_0x0167('0x16')]||0x0;this['answered']=_0x275e2f[_0x0167('0x5')]||0x0;this['available']=_0x275e2f[_0x0167('0x0')]||0x0;this[_0x0167('0x17')]=_0x275e2f[_0x0167('0x17')]||0x0;this['inUse']=_0x275e2f['inUse']||0x0;this['invalid']=_0x275e2f[_0x0167('0x18')]||0x0;this[_0x0167('0x1')]=_0x275e2f['loggedIn']||0x0;this[_0x0167('0x6')]=_0x275e2f['loggedInDb']||0x0;this['onHold']=_0x275e2f[_0x0167('0x19')]||0x0;this['notInUse']=_0x275e2f[_0x0167('0x1a')]||0x0;this['paused']=_0x275e2f[_0x0167('0x2')]||0x0;this[_0x0167('0x1b')]=_0x275e2f[_0x0167('0x1b')]||0x0;this[_0x0167('0x1c')]=_0x275e2f[_0x0167('0x1c')];this[_0x0167('0x11')]=_0x275e2f[_0x0167('0x11')];this[_0x0167('0x12')]=_0x275e2f[_0x0167('0x12')];this[_0x0167('0x1d')]=_0x275e2f[_0x0167('0x1d')]||0x0;this[_0x0167('0x3')]=_0x275e2f['talking']||0x0;this[_0x0167('0x13')]=_0x275e2f[_0x0167('0x13')]||0x0;this[_0x0167('0x1e')]=_0x275e2f['type'];this[_0x0167('0x1f')]=_0x275e2f[_0x0167('0x1f')]||0x0;this[_0x0167('0x20')]=_0x275e2f[_0x0167('0x20')]||0x0;this['unmanaged']=_0x275e2f[_0x0167('0x21')]||0x0;this['waiting']=_0x275e2f[_0x0167('0x4')]||0x0;if(_0x275e2f[_0x0167('0x1e')]===_0x0167('0x22')){this[_0x0167('0x10')]=_0x275e2f[_0x0167('0x10')]||0x0;this[_0x0167('0x23')]=_0x275e2f[_0x0167('0x23')];this['dialMethod']=_0x275e2f[_0x0167('0x24')];this[_0x0167('0x25')]=_0x275e2f[_0x0167('0x25')];this['dialOriginateCallerIdNumber']=_0x275e2f[_0x0167('0x26')];this[_0x0167('0x27')]=_0x275e2f['dialOriginateTimeout'];this[_0x0167('0x28')]=_0x275e2f[_0x0167('0x28')];this['temp']=_0x275e2f[_0x0167('0x29')];this[_0x0167('0x2a')]=_0x275e2f[_0x0167('0x2a')];this['outboundAnswerCallsDay']=_0x275e2f[_0x0167('0x9')];this[_0x0167('0xa')]=_0x275e2f['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x275e2f[_0x0167('0xb')];this[_0x0167('0xc')]=_0x275e2f[_0x0167('0xc')];this[_0x0167('0x2b')]=_0x275e2f['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x275e2f[_0x0167('0x2c')];this['outboundDropCallsDayTimeout']=_0x275e2f['outboundDropCallsDayTimeout'];this[_0x0167('0xd')]=_0x275e2f[_0x0167('0xd')];this[_0x0167('0x2d')]=_0x275e2f[_0x0167('0x2d')];this[_0x0167('0x2e')]=_0x275e2f[_0x0167('0x2e')];this[_0x0167('0x2f')]=_0x275e2f['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x275e2f[_0x0167('0xe')];this[_0x0167('0xf')]=_0x275e2f[_0x0167('0xf')];this[_0x0167('0x30')]=_0x275e2f[_0x0167('0x30')];this[_0x0167('0x31')]=_0x275e2f['predictiveIntervalAvgHoldtime'];this[_0x0167('0x32')]=_0x275e2f['predictiveIntervalAvgTalktime'];this['predictiveIntervalDroppedCallsCallersExit']=_0x275e2f[_0x0167('0x33')];this[_0x0167('0x34')]=_0x275e2f[_0x0167('0x34')];this['predictiveIntervalErlangCalls']=_0x275e2f[_0x0167('0x35')];this[_0x0167('0x36')]=_0x275e2f[_0x0167('0x36')];this[_0x0167('0x37')]=_0x275e2f['predictiveIntervalHitRate'];this[_0x0167('0x38')]=_0x275e2f[_0x0167('0x38')];this[_0x0167('0x39')]=_0x275e2f['predictiveIntervalPauses'];this[_0x0167('0x3a')]=_0x275e2f[_0x0167('0x3a')];this[_0x0167('0x3b')]=_0x275e2f[_0x0167('0x3b')];this[_0x0167('0x7')]=_0x275e2f['originated'];this[_0x0167('0x3c')]=_0x275e2f[_0x0167('0x3c')];this['erlangCallToSecond']=_0x275e2f[_0x0167('0x3d')];this[_0x0167('0x3e')]=_0x275e2f[_0x0167('0x3e')];this[_0x0167('0x3f')]=_0x275e2f[_0x0167('0x3f')];this[_0x0167('0x40')]=_0x275e2f['startPredictive'];this[_0x0167('0x41')]=_0x275e2f[_0x0167('0x41')];this[_0x0167('0x42')]=_0x275e2f[_0x0167('0x42')];this['statusMessage']=_0x275e2f[_0x0167('0x43')];}if(_0x275e2f[_0x0167('0x44')]){this['Trunk']={'id':_0x275e2f[_0x0167('0x44')]['id'],'name':_0x275e2f[_0x0167('0x44')][_0x0167('0x14')],'active':_0x275e2f['Trunk'][_0x0167('0x45')],'callerid':_0x275e2f[_0x0167('0x44')][_0x0167('0x46')]};}}VoiceQueueSummary[_0x0167('0x47')][_0x0167('0x48')]=function(_0x42183d,_0x14105b,_0x24841d,_0x5f2dd9){this[_0x0167('0x6')]=0x0;this['talking']=0x0;this[_0x0167('0x2')]=0x0;this[_0x0167('0x20')]=0x0;this[_0x0167('0x1a')]=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x0167('0x1f')]=0x0;this[_0x0167('0x1b')]=0x0;this[_0x0167('0x1c')]=0x0;this[_0x0167('0x19')]=0x0;if(_0x24841d){if(_0x24841d[_0x0167('0x0')]){this[_0x0167('0x0')]=Number(_0x24841d['available']);}if(_0x24841d['loggedin']){this['loggedIn']=Number(_0x24841d[_0x0167('0x49')]);}if(_0x24841d['callers']){this[_0x0167('0x4')]=Number(_0x24841d[_0x0167('0x4a')]);}}for(var _0x29588f=0x0;_0x29588f<_0x42183d[_0x0167('0x4b')];_0x29588f++){var _0x482eed=_0x14105b[_0x0167('0x4c')+_0x42183d[_0x29588f][_0x0167('0x14')]];if(_0x482eed&&_0x482eed[_0x0167('0x4d')]){this[_0x0167('0x6')]+=0x1;}if(_0x42183d[_0x29588f][_0x0167('0x4e')]==='1'){this[_0x0167('0x3')]+=0x1;}if(_0x42183d[_0x29588f][_0x0167('0x2')]==='1'&&!['2','7','8'][_0x0167('0x4f')](_0x42183d[_0x29588f][_0x0167('0x50')])){this[_0x0167('0x2')]+=0x1;}switch(_0x42183d[_0x29588f]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x0167('0x1a')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x0167('0x17')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x0167('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x0167('0x1c')]+=0x1;break;case'8':this[_0x0167('0x19')]+=0x1;break;}}if(this['dialMethod']==='booked'){var _0x4b5742=Object[_0x0167('0x51')](_0x5f2dd9);for(var _0x55aaa0=0x0;_0x55aaa0<_0x4b5742['length'];_0x55aaa0++){var _0x18d29d=_0x4b5742[_0x55aaa0];var _0x4b4b37=_0x5f2dd9[_0x18d29d];if(_0x4b4b37[_0x0167('0x52')]===this[_0x0167('0x14')]&&_0x4b4b37[_0x0167('0x1e')]==='dialer'&&_0x4b4b37[_0x0167('0x53')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this['talking']>this[_0x0167('0x54')]){this[_0x0167('0x3')]=this[_0x0167('0x54')];}this[_0x0167('0x10')]=0x0;}return this;};VoiceQueueSummary[_0x0167('0x47')]['compareToInboundQueue']=function(_0x1eb8c3){var _0x36b989=![];if(_0x1eb8c3){_0x36b989=INBOUND_COUNTERS[_0x0167('0x55')](function(_0x441b4e){return this[_0x441b4e]!==_0x1eb8c3[_0x441b4e];},this);}return _0x36b989;};VoiceQueueSummary['prototype']['compareToOutboundQueue']=function(_0x19af14){var _0x5b3ffd=![];var _0x3a9e01=![];var _0x1deb9c=![];if(_0x19af14){_0x5b3ffd=this[_0x0167('0x24')]!==_0x19af14[_0x0167('0x24')]||this[_0x0167('0x23')]!==_0x19af14[_0x0167('0x23')]||this[_0x0167('0x42')]!==_0x19af14[_0x0167('0x42')]||this[_0x0167('0x43')]!==_0x19af14[_0x0167('0x43')];_0x3a9e01=OUTBOUND_COUNTERS['some'](function(_0x494b91){return this[_0x494b91]!==_0x19af14[_0x494b91];},this);if(this[_0x0167('0x44')]&&_0x19af14['Trunk']){_0x1deb9c=this[_0x0167('0x44')][_0x0167('0x14')]!==_0x19af14['Trunk'][_0x0167('0x14')]||this[_0x0167('0x44')]['active']!==_0x19af14[_0x0167('0x44')][_0x0167('0x45')];}}return _0x5b3ffd||_0x3a9e01||_0x1deb9c;};VoiceQueueSummary[_0x0167('0x47')][_0x0167('0x56')]=function(_0x50b310){this[_0x0167('0x5')]=_0x50b310[_0x0167('0x5')];this[_0x0167('0x42')]=_0x50b310['message'];this[_0x0167('0x43')]=_0x50b310[_0x0167('0x43')];this[_0x0167('0x7')]=_0x50b310[_0x0167('0x7')];this[_0x0167('0x8')]=_0x50b310[_0x0167('0x8')];this[_0x0167('0x9')]=_0x50b310[_0x0167('0x9')];this[_0x0167('0xa')]=_0x50b310['outboundBlacklistCallsDay'];this[_0x0167('0xb')]=_0x50b310[_0x0167('0xb')];this[_0x0167('0xc')]=_0x50b310[_0x0167('0xc')];this[_0x0167('0xd')]=_0x50b310[_0x0167('0xd')];this['outboundNoSuchCallsDay']=_0x50b310[_0x0167('0x2d')];this['outboundReCallsDay']=_0x50b310['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x50b310[_0x0167('0xe')];this[_0x0167('0xf')]=_0x50b310[_0x0167('0xf')];this[_0x0167('0x11')]=_0x50b310[_0x0167('0x11')];this['sumDuration']=_0x50b310[_0x0167('0x12')];this[_0x0167('0x13')]=_0x50b310['total'];if(this[_0x0167('0x24')]===_0x0167('0x57')){this[_0x0167('0x10')]=_0x50b310[_0x0167('0x10')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f7e4d3b..2ba428f 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 _0x33b7=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x183afd,_0x538559){var _0x5a5b0c=function(_0xb15f80){while(--_0xb15f80){_0x183afd['push'](_0x183afd['shift']());}};_0x5a5b0c(++_0x538559);}(_0x33b7,0xf3));var _0x733b=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x33b7[_0x5e3b04];return _0x1fc44d;};'use strict';function VtigerAccount(_0x4306ed){this['id']=_0x4306ed['id']||0x0;this[_0x733b('0x0')]=_0x4306ed['name']||'';this[_0x733b('0x1')]=_0x4306ed[_0x733b('0x1')]||'';this[_0x733b('0x2')]=_0x4306ed[_0x733b('0x2')]||'';this[_0x733b('0x3')]=_0x4306ed[_0x733b('0x3')]||'';this[_0x733b('0x4')]=_0x4306ed[_0x733b('0x4')]||'';this[_0x733b('0x5')]=_0x4306ed['Configurations']||{};}module[_0x733b('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8b43=['name','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x37464d,_0x29bf11){var _0x4e7573=function(_0x4de5e3){while(--_0x4de5e3){_0x37464d['push'](_0x37464d['shift']());}};_0x4e7573(++_0x29bf11);}(_0x8b43,0x7e));var _0x38b4=function(_0xabfb21,_0x16eb6f){_0xabfb21=_0xabfb21-0x0;var _0x2d9984=_0x8b43[_0xabfb21];return _0x2d9984;};'use strict';function VtigerAccount(_0x284f4c){this['id']=_0x284f4c['id']||0x0;this[_0x38b4('0x0')]=_0x284f4c[_0x38b4('0x0')]||'';this['username']=_0x284f4c['username']||'';this[_0x38b4('0x1')]=_0x284f4c[_0x38b4('0x1')]||'';this[_0x38b4('0x2')]=_0x284f4c['remoteUri']||'';this[_0x38b4('0x3')]=_0x284f4c[_0x38b4('0x3')]||'';this[_0x38b4('0x4')]=_0x284f4c[_0x38b4('0x4')]||{};}module[_0x38b4('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 104bc2e..8a50c2a 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 _0x1a6c=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0xcfc44,_0x179bc1){var _0x307a25=function(_0x2b64de){while(--_0x2b64de){_0xcfc44['push'](_0xcfc44['shift']());}};_0x307a25(++_0x179bc1);}(_0x1a6c,0x18e));var _0xc1a6=function(_0x5203cb,_0x4fc08a){_0x5203cb=_0x5203cb-0x0;var _0xa5ccfe=_0x1a6c[_0x5203cb];return _0xa5ccfe;};'use strict';function ZendeskAccount(_0x50a5a6){this['id']=_0x50a5a6['id']||0x0;this[_0xc1a6('0x0')]=_0x50a5a6[_0xc1a6('0x0')]||'';this[_0xc1a6('0x1')]=_0x50a5a6[_0xc1a6('0x1')]||'';this[_0xc1a6('0x2')]=_0x50a5a6[_0xc1a6('0x2')]||'';this[_0xc1a6('0x3')]=_0x50a5a6[_0xc1a6('0x3')]||'';this[_0xc1a6('0x4')]=_0x50a5a6[_0xc1a6('0x4')]||'';this[_0xc1a6('0x5')]=_0x50a5a6[_0xc1a6('0x5')]||'';this[_0xc1a6('0x6')]=_0x50a5a6[_0xc1a6('0x6')]||_0xc1a6('0x7');this[_0xc1a6('0x8')]=_0x50a5a6[_0xc1a6('0x8')]||'';this[_0xc1a6('0x9')]=_0x50a5a6[_0xc1a6('0x9')]||{};}module[_0xc1a6('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x0187=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0187,0x165));var _0x7018=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x0187[_0x15c421];return _0x5e5ed5;};'use strict';function ZendeskAccount(_0x466001){this['id']=_0x466001['id']||0x0;this[_0x7018('0x0')]=_0x466001['name']||'';this[_0x7018('0x1')]=_0x466001[_0x7018('0x1')]||'';this[_0x7018('0x2')]=_0x466001[_0x7018('0x2')]||'';this[_0x7018('0x3')]=_0x466001[_0x7018('0x3')]||'';this[_0x7018('0x4')]=_0x466001[_0x7018('0x4')]||'';this[_0x7018('0x5')]=_0x466001[_0x7018('0x5')]||'';this[_0x7018('0x6')]=_0x466001[_0x7018('0x6')]||_0x7018('0x7');this['serverUrl']=_0x466001[_0x7018('0x8')]||'';this['Configurations']=_0x466001[_0x7018('0x9')]||{};}module[_0x7018('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 f2433cf..b29e147 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 _0x90dd=['clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x90dd,0x164));var _0xd90d=function(_0x490ddc,_0x2f6ba5){_0x490ddc=_0x490ddc-0x0;var _0x1956ed=_0x90dd[_0x490ddc];return _0x1956ed;};'use strict';function ZohoAccount(_0x57bfda){this['id']=_0x57bfda['id']||0x0;this[_0xd90d('0x0')]=_0x57bfda['name']||'';this[_0xd90d('0x1')]=_0x57bfda[_0xd90d('0x1')]||'';this[_0xd90d('0x2')]=_0x57bfda[_0xd90d('0x2')]||'';this[_0xd90d('0x3')]=_0x57bfda['zone']||'';this[_0xd90d('0x4')]=_0x57bfda['clientId']||'';this[_0xd90d('0x5')]=_0x57bfda[_0xd90d('0x5')]||'';this['serverUrl']=_0x57bfda['serverUrl']||'';this[_0xd90d('0x6')]=_0x57bfda[_0xd90d('0x6')]||'';this[_0xd90d('0x7')]=_0x57bfda[_0xd90d('0x7')]||'';this['Configurations']=_0x57bfda[_0xd90d('0x8')]||{};}module[_0xd90d('0x9')]=ZohoAccount; \ No newline at end of file +var _0xe7e3=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','exports','name'];(function(_0x5bbe7e,_0x19c08f){var _0x6ebda1=function(_0x501701){while(--_0x501701){_0x5bbe7e['push'](_0x5bbe7e['shift']());}};_0x6ebda1(++_0x19c08f);}(_0xe7e3,0x95));var _0x3e7e=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xe7e3[_0x19159a];return _0xa677f4;};'use strict';function ZohoAccount(_0x5a649f){this['id']=_0x5a649f['id']||0x0;this[_0x3e7e('0x0')]=_0x5a649f[_0x3e7e('0x0')]||'';this[_0x3e7e('0x1')]=_0x5a649f[_0x3e7e('0x1')]||'';this['host']=_0x5a649f[_0x3e7e('0x2')]||'';this[_0x3e7e('0x3')]=_0x5a649f['zone']||'';this[_0x3e7e('0x4')]=_0x5a649f[_0x3e7e('0x4')]||'';this[_0x3e7e('0x5')]=_0x5a649f[_0x3e7e('0x5')]||'';this[_0x3e7e('0x6')]=_0x5a649f[_0x3e7e('0x6')]||'';this[_0x3e7e('0x7')]=_0x5a649f[_0x3e7e('0x7')]||'';this[_0x3e7e('0x8')]=_0x5a649f[_0x3e7e('0x8')]||'';this['Configurations']=_0x5a649f['Configurations']||{};}module[_0x3e7e('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 b5e8eae..b7163a5 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 _0xcf2f=['lodash','moment','isNil','string','uniqueid','idContact','queue','name','dialAnswer','Agent','format','SIP/%s','membername','calleridname','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util'];(function(_0x4486ee,_0x85b039){var _0x2713cb=function(_0x2b67f0){while(--_0x2b67f0){_0x4486ee['push'](_0x4486ee['shift']());}};_0x2713cb(++_0x85b039);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x68a813,_0x1cdad9){_0x68a813=_0x68a813-0x0;var _0x5b7a95=_0xcf2f[_0x68a813];return _0x5b7a95;};'use strict';var util=require(_0xfcf2('0x0'));var _=require(_0xfcf2('0x1'));var moment=require(_0xfcf2('0x2'));function checkNameSurname(_0x3165cf,_0x343fc4,_0x5637be){var _0x16c210='';if(!_[_0xfcf2('0x3')](_0x343fc4)&&_0xfcf2('0x4')===typeof _0x343fc4){_0x16c210+=_0x343fc4;}if(!_[_0xfcf2('0x3')](_0x5637be)&&_0xfcf2('0x4')===typeof _0x5637be){_0x16c210+='\x20'+_0x5637be;}if(_0x16c210!==''){return _0x16c210;}return _0x3165cf;}function Action(_0x167a77,_0x1e6d99,_0x3a4950,_0x41d4bd,_0x157f48){this[_0xfcf2('0x5')]=_0x3a4950||undefined;this[_0xfcf2('0x6')]=_0x167a77['id'];this[_0xfcf2('0x7')]=_0x1e6d99[_0xfcf2('0x8')];this['type']=_0x1e6d99['type'];this['campaigntype']=_0xfcf2('0x7');this[_0xfcf2('0x9')]=![];this['membername']=_[_0xfcf2('0x3')](_0x167a77[_0xfcf2('0xa')])?undefined:_0x167a77[_0xfcf2('0xa')][_0xfcf2('0x8')];this['channelAgent']=this['membername']?util[_0xfcf2('0xb')](_0xfcf2('0xc'),this[_0xfcf2('0xd')]):_0x41d4bd||undefined;this[_0xfcf2('0xe')]=checkNameSurname(_0x167a77['Contact'][_0xfcf2('0xf')],_0x167a77['Contact']['firstName'],_0x167a77['Contact'][_0xfcf2('0x10')]);this['active']=_0x167a77[_0xfcf2('0x11')]||![];this[_0xfcf2('0x12')]=_0x167a77[_0xfcf2('0xf')];this[_0xfcf2('0x13')]=_0x167a77[_0xfcf2('0x13')];this[_0xfcf2('0x14')]=_0x167a77[_0xfcf2('0x14')]||0x0;this['countcongestionretry']=_0x167a77[_0xfcf2('0x15')]||0x0;this[_0xfcf2('0x16')]=_0x167a77[_0xfcf2('0x16')]||0x0;this['countglobal']=(_0x167a77[_0xfcf2('0x14')]||0x0)+(_0x167a77[_0xfcf2('0x15')]||0x0)+(_0x167a77[_0xfcf2('0x16')]||0x0)+(_0x167a77[_0xfcf2('0x17')]||0x0)+(_0x167a77[_0xfcf2('0x18')]||0x0)+(_0x167a77['countabandonedretry']||0x0)+(_0x167a77[_0xfcf2('0x19')]||0x0)+(_0x167a77[_0xfcf2('0x1a')]||0x0);this['countnosuchnumberretry']=_0x167a77[_0xfcf2('0x17')]||0x0;this[_0xfcf2('0x18')]=_0x167a77[_0xfcf2('0x18')]||0x0;this[_0xfcf2('0x1b')]=_0x167a77[_0xfcf2('0x1b')]||0x0;this[_0xfcf2('0x19')]=_0x167a77[_0xfcf2('0x19')]||0x0;this[_0xfcf2('0x1a')]=_0x167a77[_0xfcf2('0x1a')]||0x0;this['callback']=_0x167a77[_0xfcf2('0x1c')];this[_0xfcf2('0x1d')]=_0x167a77[_0xfcf2('0x1d')];this['callbackat']=_0x167a77[_0xfcf2('0x1e')];this[_0xfcf2('0x1f')]=_0x167a77['recallme'];this[_0xfcf2('0x20')]=_0x167a77[_0xfcf2('0x20')];this['ListId']=_0x167a77[_0xfcf2('0x21')];this[_0xfcf2('0x22')]=_[_0xfcf2('0x3')](_0x167a77[_0xfcf2('0xa')])?_0x167a77['UserId']:_0x167a77[_0xfcf2('0xa')]['id'];this[_0xfcf2('0x23')]=_0x167a77[_0xfcf2('0x23')];this[_0xfcf2('0x24')]='';this[_0xfcf2('0x25')]='';}Action[_0xfcf2('0x26')][_0xfcf2('0x27')]=function(){return util[_0xfcf2('0xb')](_0xfcf2('0x28'),this['calleridname'],this['number']);};module[_0xfcf2('0x29')]=Action; \ No newline at end of file +var _0x32f4=['isNil','uniqueid','queue','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','format','calleridname','exports','util','lodash','moment','string'];(function(_0x5e65a6,_0x58ed34){var _0xd596c0=function(_0x7b55a){while(--_0x7b55a){_0x5e65a6['push'](_0x5e65a6['shift']());}};_0xd596c0(++_0x58ed34);}(_0x32f4,0x154));var _0x432f=function(_0x2dc0eb,_0x5b9c4f){_0x2dc0eb=_0x2dc0eb-0x0;var _0x17548b=_0x32f4[_0x2dc0eb];return _0x17548b;};'use strict';var util=require(_0x432f('0x0'));var _=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));function checkNameSurname(_0x2b22ad,_0x5ee65a,_0x2a4628){var _0x6f0e8a='';if(!_['isNil'](_0x5ee65a)&&_0x432f('0x3')===typeof _0x5ee65a){_0x6f0e8a+=_0x5ee65a;}if(!_[_0x432f('0x4')](_0x2a4628)&&_0x432f('0x3')===typeof _0x2a4628){_0x6f0e8a+='\x20'+_0x2a4628;}if(_0x6f0e8a!==''){return _0x6f0e8a;}return _0x2b22ad;}function Action(_0x355b02,_0x2f5f03,_0x5d8cc0,_0x5b5f08,_0x2f66fd){this[_0x432f('0x5')]=_0x5d8cc0||undefined;this['idContact']=_0x355b02['id'];this[_0x432f('0x6')]=_0x2f5f03['name'];this[_0x432f('0x7')]=_0x2f5f03[_0x432f('0x7')];this[_0x432f('0x8')]=_0x432f('0x6');this[_0x432f('0x9')]=![];this['membername']=_[_0x432f('0x4')](_0x355b02['Agent'])?undefined:_0x355b02[_0x432f('0xa')]['name'];this[_0x432f('0xb')]=this[_0x432f('0xc')]?util['format'](_0x432f('0xd'),this[_0x432f('0xc')]):_0x5b5f08||undefined;this['calleridname']=checkNameSurname(_0x355b02[_0x432f('0xe')][_0x432f('0xf')],_0x355b02['Contact']['firstName'],_0x355b02[_0x432f('0xe')][_0x432f('0x10')]);this[_0x432f('0x11')]=_0x355b02[_0x432f('0x11')]||![];this[_0x432f('0x12')]=_0x355b02['phone'];this[_0x432f('0x13')]=_0x355b02[_0x432f('0x13')];this[_0x432f('0x14')]=_0x355b02[_0x432f('0x14')]||0x0;this['countcongestionretry']=_0x355b02[_0x432f('0x15')]||0x0;this[_0x432f('0x16')]=_0x355b02[_0x432f('0x16')]||0x0;this[_0x432f('0x17')]=(_0x355b02[_0x432f('0x14')]||0x0)+(_0x355b02[_0x432f('0x15')]||0x0)+(_0x355b02['countnoanswerretry']||0x0)+(_0x355b02[_0x432f('0x18')]||0x0)+(_0x355b02['countdropretry']||0x0)+(_0x355b02[_0x432f('0x19')]||0x0)+(_0x355b02[_0x432f('0x1a')]||0x0)+(_0x355b02[_0x432f('0x1b')]||0x0);this[_0x432f('0x18')]=_0x355b02[_0x432f('0x18')]||0x0;this[_0x432f('0x1c')]=_0x355b02[_0x432f('0x1c')]||0x0;this[_0x432f('0x19')]=_0x355b02[_0x432f('0x19')]||0x0;this[_0x432f('0x1a')]=_0x355b02[_0x432f('0x1a')]||0x0;this[_0x432f('0x1b')]=_0x355b02['countagentrejectretry']||0x0;this['callback']=_0x355b02[_0x432f('0x1d')];this['callbackuniqueid']=_0x355b02[_0x432f('0x1e')];this['callbackat']=_0x355b02[_0x432f('0x1f')];this[_0x432f('0x20')]=_0x355b02[_0x432f('0x20')];this[_0x432f('0x21')]=_0x355b02[_0x432f('0x21')];this[_0x432f('0x22')]=_0x355b02['ListId'];this[_0x432f('0x23')]=_[_0x432f('0x4')](_0x355b02['Agent'])?_0x355b02[_0x432f('0x23')]:_0x355b02[_0x432f('0xa')]['id'];this[_0x432f('0x24')]=_0x355b02[_0x432f('0x24')];this[_0x432f('0x25')]='';this[_0x432f('0x26')]='';}Action[_0x432f('0x27')]['getCaller']=function(){return util[_0x432f('0x28')]('\x22%s\x22\x20<%s>',this[_0x432f('0x29')],this['number']);};module[_0x432f('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 28e4a49..6e817bd 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x120a6c,_0x5a1917){var _0x26b23b=function(_0x14fded){while(--_0x14fded){_0x120a6c['push'](_0x120a6c['shift']());}};_0x26b23b(++_0x5a1917);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4260af,_0x58f258){var _0x90689f=function(_0x47a4d9){while(--_0x47a4d9){_0x4260af['push'](_0x4260af['shift']());}};_0x90689f(++_0x58f258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c619c42..286e7a5 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 _0xaa92=['getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','create','[voiceQueueReport]\x20'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xaa92,0x1e9));var _0x2aa9=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0xaa92[_0x257017];return _0x38536d;};'use strict';var util=require(_0x2aa9('0x0'));var BPromise=require(_0x2aa9('0x1'));var logger=require(_0x2aa9('0x2'))(_0x2aa9('0x3'));var cmHopper=require(_0x2aa9('0x4'));var cmHopperHistory=require(_0x2aa9('0x5'));var cmHopperBlack=require(_0x2aa9('0x6'));var agentReportPreview=require(_0x2aa9('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55bb5c){return function(_0x3c109c){logger[_0x2aa9('0x8')](_0x55bb5c,util[_0x2aa9('0x9')](_0x3c109c,{'showHidden':![],'depth':null}));};}function create(_0x166d35){return cmHopperHistory[_0x2aa9('0xa')](_0x166d35)[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0xc')));}function createAgent(_0x199e2c){return BPromise[_0x2aa9('0xd')]()['then'](agentReportPreview['createHistory'](_0x199e2c))[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0xc')));}function moveContact(_0x32da2e){return cmHopper[_0x2aa9('0xe')](_0x32da2e,!![])[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0xf')));}exports[_0x2aa9('0x10')]=function(_0x17fc0c){return cmHopperBlack['checkIsBlackList'](_0x17fc0c)[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0x11')));};exports[_0x2aa9('0x12')]=function(_0x2cbef7){return BPromise['resolve']()[_0x2aa9('0x13')](cmHopper['getContactPreview'](_0x2cbef7))['catch'](loggerCatch(_0x2aa9('0x14')));};exports[_0x2aa9('0xa')]=function(_0x454518,_0x7d6776){create(_0x454518)[_0x2aa9('0xb')](loggerCatch(_0x7d6776));moveContact(_0x454518)[_0x2aa9('0xb')](loggerCatch(_0x7d6776));};exports['createAgentHistory']=function(_0x285481,_0xeb182a){createAgent(_0x285481)[_0x2aa9('0xb')](loggerCatch(_0xeb182a));};exports[_0x2aa9('0x15')]=function(_0x111d93,_0x588ce2){create(_0x111d93)[_0x2aa9('0xb')](loggerCatch(_0x588ce2));};exports[_0x2aa9('0x16')]=function(_0x63dc16,_0x54deb8){moveContact(_0x63dc16)[_0x2aa9('0xb')](loggerCatch(_0x54deb8));};exports[_0x2aa9('0x17')]=function(_0x1cee40,_0xfc64d0,_0x507f2c){if(_0xfc64d0){_0x1cee40[_0x2aa9('0x18')]=null;}if(_0x507f2c){_0x1cee40[_0x2aa9('0x19')]=![];}return cmHopper[_0x2aa9('0x17')](_0x1cee40)['catch'](loggerCatch(_0x2aa9('0x1a')));};exports[_0x2aa9('0x1b')]=function(_0x5b0f73){return cmHopper['countReScheduled'](_0x5b0f73)[_0x2aa9('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0x2aa9('0x1c')]=function(_0x5791d0){return cmHopper[_0x2aa9('0x1c')]({'UserId':null},_0x5791d0,0x1)[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0x1d')));};exports[_0x2aa9('0x1e')]=function(_0x1fe6a5){return cmHopper['unlockContact']({'active':![]},_0x1fe6a5,0x1)[_0x2aa9('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x2aa9('0x1f')]=function(_0x370924){var _0x4a78ec={};_0x4a78ec[_0x2aa9('0x20')]=_0x370924['type'];_0x4a78ec[_0x2aa9('0x21')]=_0x370924[_0x2aa9('0x21')];_0x4a78ec['calleridnum']=_0x370924[_0x2aa9('0x22')];_0x4a78ec[_0x2aa9('0x23')]=_0x370924[_0x2aa9('0x23')];_0x4a78ec[_0x2aa9('0x24')]=_0x370924[_0x2aa9('0x24')];_0x4a78ec['queuecallerjoinAt']=_0x370924[_0x2aa9('0x25')];_0x4a78ec['queuecallerleaveAt']=_0x370924[_0x2aa9('0x25')];_0x4a78ec[_0x2aa9('0x26')]=0x1;_0x4a78ec[_0x2aa9('0x27')]=_0x370924[_0x2aa9('0x28')];_0x4a78ec['connectedlinename']=_0x370924['membername'];_0x4a78ec[_0x2aa9('0x29')]=_0x2aa9('0x2a');_0x4a78ec[_0x2aa9('0x2b')]=_0x2aa9('0x2c');_0x4a78ec[_0x2aa9('0x2d')]=0x0;_0x4a78ec[_0x2aa9('0x2e')]=0x1;_0x4a78ec[_0x2aa9('0x2f')]=_0x370924[_0x2aa9('0x30')];_0x4a78ec['queuecallerexitreason']='COMPLETED';return BPromise[_0x2aa9('0xd')]()[_0x2aa9('0x13')](voiceQueueReport[_0x2aa9('0x31')](_0x4a78ec))[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0x32')));};exports[_0x2aa9('0x33')]=function(_0x168adb,_0x15f928){return BPromise[_0x2aa9('0xd')]()[_0x2aa9('0x13')](cmHopper[_0x2aa9('0x33')](_0x168adb,_0x15f928))[_0x2aa9('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x2aa9('0x34')]=function(_0x3175c2){return cmHopper[_0x2aa9('0x17')](_0x3175c2,!![],!![])[_0x2aa9('0xb')](loggerCatch(_0x2aa9('0x35')));}; \ No newline at end of file +var _0xd0d2=['error','catch','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0xa41459,_0x16e1c4){var _0xce9284=function(_0x3f2d28){while(--_0x3f2d28){_0xa41459['push'](_0xa41459['shift']());}};_0xce9284(++_0x16e1c4);}(_0xd0d2,0x1b3));var _0x2d0d=function(_0xb33f4,_0x337620){_0xb33f4=_0xb33f4-0x0;var _0x2ae66c=_0xd0d2[_0xb33f4];return _0x2ae66c;};'use strict';var util=require('util');var BPromise=require(_0x2d0d('0x0'));var logger=require(_0x2d0d('0x1'))('preview');var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x2d0d('0x2'));var cmHopperBlack=require(_0x2d0d('0x3'));var agentReportPreview=require(_0x2d0d('0x4'));var voiceQueueReport=require(_0x2d0d('0x5'));function loggerCatch(_0x157226){return function(_0x3d5cad){logger[_0x2d0d('0x6')](_0x157226,util['inspect'](_0x3d5cad,{'showHidden':![],'depth':null}));};}function create(_0x4ce10f){return cmHopperHistory['createHistory'](_0x4ce10f)[_0x2d0d('0x7')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2f3f86){return BPromise[_0x2d0d('0x8')]()[_0x2d0d('0x9')](agentReportPreview[_0x2d0d('0xa')](_0x2f3f86))[_0x2d0d('0x7')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x55ee85){return cmHopper[_0x2d0d('0xb')](_0x55ee85,!![])[_0x2d0d('0x7')](loggerCatch(_0x2d0d('0xc')));}exports['checkIsBlackList']=function(_0x1073c9){return cmHopperBlack[_0x2d0d('0xd')](_0x1073c9)[_0x2d0d('0x7')](loggerCatch(_0x2d0d('0xe')));};exports[_0x2d0d('0xf')]=function(_0x3d85ab){return BPromise[_0x2d0d('0x8')]()[_0x2d0d('0x9')](cmHopper[_0x2d0d('0xf')](_0x3d85ab))[_0x2d0d('0x7')](loggerCatch(_0x2d0d('0x10')));};exports[_0x2d0d('0xa')]=function(_0x517aa6,_0x3ccd6c){create(_0x517aa6)[_0x2d0d('0x7')](loggerCatch(_0x3ccd6c));moveContact(_0x517aa6)[_0x2d0d('0x7')](loggerCatch(_0x3ccd6c));};exports['createAgentHistory']=function(_0x45c3b5,_0x334c76){createAgent(_0x45c3b5)[_0x2d0d('0x7')](loggerCatch(_0x334c76));};exports[_0x2d0d('0x11')]=function(_0x10d47c,_0x549627){create(_0x10d47c)[_0x2d0d('0x7')](loggerCatch(_0x549627));};exports[_0x2d0d('0x12')]=function(_0x284ee2,_0x1a1db1){moveContact(_0x284ee2)['catch'](loggerCatch(_0x1a1db1));};exports['rescheduleContact']=function(_0x55a256,_0x2e19ea,_0x3ea359){if(_0x2e19ea){_0x55a256['UserId']=null;}if(_0x3ea359){_0x55a256['active']=![];}return cmHopper[_0x2d0d('0x13')](_0x55a256)[_0x2d0d('0x7')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x2d0d('0x14')]=function(_0x3887fa){return cmHopper['countReScheduled'](_0x3887fa)['catch'](loggerCatch(_0x2d0d('0x15')));};exports[_0x2d0d('0x16')]=function(_0x17b77f){return cmHopper[_0x2d0d('0x16')]({'UserId':null},_0x17b77f,0x1)[_0x2d0d('0x7')](loggerCatch(_0x2d0d('0x17')));};exports[_0x2d0d('0x18')]=function(_0x550e18){return cmHopper[_0x2d0d('0x16')]({'active':![]},_0x550e18,0x1)[_0x2d0d('0x7')](loggerCatch('[activeContact]\x20'));};exports[_0x2d0d('0x19')]=function(_0x7dc8ee){var _0x52bef3={};_0x52bef3[_0x2d0d('0x1a')]=_0x7dc8ee[_0x2d0d('0x1a')];_0x52bef3[_0x2d0d('0x1b')]=_0x7dc8ee[_0x2d0d('0x1b')];_0x52bef3[_0x2d0d('0x1c')]=_0x7dc8ee[_0x2d0d('0x1c')];_0x52bef3[_0x2d0d('0x1d')]=_0x7dc8ee[_0x2d0d('0x1d')];_0x52bef3[_0x2d0d('0x1e')]=_0x7dc8ee[_0x2d0d('0x1e')];_0x52bef3[_0x2d0d('0x1f')]=_0x7dc8ee['answertime'];_0x52bef3[_0x2d0d('0x20')]=_0x7dc8ee[_0x2d0d('0x21')];_0x52bef3[_0x2d0d('0x22')]=0x1;_0x52bef3[_0x2d0d('0x23')]=_0x7dc8ee[_0x2d0d('0x24')];_0x52bef3['connectedlinename']=_0x7dc8ee[_0x2d0d('0x25')];_0x52bef3['context']=_0x2d0d('0x26');_0x52bef3[_0x2d0d('0x27')]='xcally-motion-preview';_0x52bef3[_0x2d0d('0x28')]=0x0;_0x52bef3[_0x2d0d('0x29')]=0x1;_0x52bef3[_0x2d0d('0x2a')]=_0x7dc8ee[_0x2d0d('0x25')];_0x52bef3[_0x2d0d('0x2b')]=_0x2d0d('0x2c');return BPromise[_0x2d0d('0x8')]()['then'](voiceQueueReport[_0x2d0d('0x2d')](_0x52bef3))[_0x2d0d('0x7')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x2d0d('0x2e')]=function(_0x2158fc,_0x179482){return BPromise[_0x2d0d('0x8')]()['then'](cmHopper['getContactRecallMe'](_0x2158fc,_0x179482))[_0x2d0d('0x7')](loggerCatch(_0x2d0d('0x2f')));};exports['rescheduleContactInQueue']=function(_0x1f23f8){return cmHopper[_0x2d0d('0x13')](_0x1f23f8,!![],!![])[_0x2d0d('0x7')](loggerCatch(_0x2d0d('0x30')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 1d1563f..1a6126f 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 _0x6b5d=['toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','info','loggerError','logger2','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridname','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','logAgent','responsetime','ringtime','logLookAgent','membername','logCustomer','getSeconds','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','calleridnum','from-sip','timeout','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','interface','voice','mandatoryDisposition','buildObj','agentReadyId','status','reachable','push','getDiff','milliseconds','seconds','CampaignId','filterKey','idContact','type','countbusyretry','countglobal','callback','recallme','UserId','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','pow','random','extractCalleridName','match','extractCalleridNumber','keys','variables'];(function(_0x15279f,_0x55316c){var _0x77a06e=function(_0x43683f){while(--_0x43683f){_0x15279f['push'](_0x15279f['shift']());}};_0x77a06e(++_0x55316c);}(_0x6b5d,0x114));var _0xd6b5=function(_0x15a930,_0xb77266){_0x15a930=_0x15a930-0x0;var _0x46ca74=_0x6b5d[_0x15a930];return _0x46ca74;};'use strict';var util=require(_0xd6b5('0x0'));var _=require(_0xd6b5('0x1'));var moment=require(_0xd6b5('0x2'));var logger=require(_0xd6b5('0x3'))(_0xd6b5('0x4'));var ipAgi=process[_0xd6b5('0x5')][_0xd6b5('0x6')]||'127.0.0.1';var utils=require(_0xd6b5('0x7'));exports[_0xd6b5('0x8')]=function(_0x47c28b){return function(_0x27263e){logger[_0xd6b5('0x9')](_0x47c28b,util[_0xd6b5('0xa')](_0x27263e,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1a11cb,_0x2a074a){logger[_0xd6b5('0xb')](_0x1a11cb,util[_0xd6b5('0xa')](_0x2a074a,{'showHidden':![],'depth':null}));};exports[_0xd6b5('0xc')]=function(_0x33de7a,_0x341025){logger['error'](_0x33de7a,util[_0xd6b5('0xa')](_0x341025,{'showHidden':![],'depth':null}));};exports[_0xd6b5('0xd')]=function(_0x5244e0){return function(_0x3b99aa){logger[_0xd6b5('0xb')](_0x5244e0,util['inspect'](_0x3b99aa,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x376ba2,_0x594c79,_0x10cdcf){return{'message':_0x376ba2,'unlock':_0x594c79,'active':_0x10cdcf};};exports[_0xd6b5('0xe')]=function(_0x217fab,_0x51fb24,_0x568e22){if(!_[_0xd6b5('0xf')](_0x568e22)&&'string'===typeof _0x568e22&&!_[_0xd6b5('0x10')](_0x568e22)){if(!_[_0xd6b5('0xf')](_0x51fb24)&&_0xd6b5('0x11')===typeof _0x51fb24&&!_[_0xd6b5('0x10')](_0x51fb24)){return util[_0xd6b5('0x12')](_0xd6b5('0x13'),_0x51fb24,_0x568e22);}return util[_0xd6b5('0x12')](_0xd6b5('0x13'),_0x568e22,_0x568e22);}if(!_[_0xd6b5('0xf')](_0x217fab)&&'string'===typeof _0x217fab&&!_[_0xd6b5('0x10')](_0x217fab)){return _0x217fab;}return'\x22\x22\x20<>';};exports[_0xd6b5('0x14')]=function(_0x461d7f){if(_[_0xd6b5('0x15')](_0x461d7f)){return![];}return _0x461d7f;};exports[_0xd6b5('0x16')]=function(_0x1e6f4d,_0x407c99,_0x12103a,_0x463c7e,_0x4c0160,_0x58141f){var _0x33f048={'XMD-QUEUE':_0x407c99[_0xd6b5('0x17')]?_0x407c99[_0xd6b5('0x17')][_0xd6b5('0x18')]:'','XMD-CALLERID':_0x463c7e,'XMD-CALLERID-PREVIEW':_0x58141f?util[_0xd6b5('0x12')]('\x22%s\x22\x20<%s>',_0x58141f[_0xd6b5('0x19')],_0x58141f['calleridnum']):_0x463c7e,'XMD-DIALID':_0x4c0160,'XMD-CONTACTID':_0x407c99['ContactId'],'XMD-CDRTYPE':_0xd6b5('0x1a'),'CALLERID(all)':_0x463c7e,'XMD-VOICEQUEUEID':_0x407c99[_0xd6b5('0x1b')],'XMD-DIALCHANNEL':_0x12103a,'XMD-DIALTIMEOUT':_0x1e6f4d[_0xd6b5('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xd6b5('0x12')](_0xd6b5('0x1d'),_0x1e6f4d[_0xd6b5('0x1e')]?'g':'',_[_0xd6b5('0x10')](_0x1e6f4d['monitor_format'])?'':_0xd6b5('0x1f')),'XMD-DIALURL':_0x1e6f4d['dialPreviewUrl']||'','XMD-AGI':_0x1e6f4d[_0xd6b5('0x20')]?util[_0xd6b5('0x12')](_0xd6b5('0x21'),ipAgi,_0x1e6f4d['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x1e6f4d[_0xd6b5('0x1e')]?util[_0xd6b5('0x12')](_0xd6b5('0x21'),ipAgi,_0x1e6f4d['dialQueueProject2']):_0xd6b5('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x58141f?_0x58141f[_0xd6b5('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x58141f?_0x58141f[_0xd6b5('0x24')]:'','XMD-DESTINATION':_0xd6b5('0x25'),'SIPADDHEADER':_0xd6b5('0x26')};if(!_[_0xd6b5('0x10')](_0x1e6f4d[_0xd6b5('0x27')])){_0x33f048[util[_0xd6b5('0x12')]('%s',_0xd6b5('0x28'))]=_0x1e6f4d[_0xd6b5('0x27')];_0x33f048[util[_0xd6b5('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4c0160;}return _0x33f048;};exports[_0xd6b5('0x29')]=function(_0x180801){var _0xd3e896={};for(var _0x487557 in _0x180801){if(_0x180801['hasOwnProperty'](_0x487557)){_0xd3e896[util[_0xd6b5('0x12')]('%s',_[_0xd6b5('0x2a')](_0x487557))]=_0x180801[_0x487557];}}return{'variables':_0xd3e896};};exports[_0xd6b5('0x2b')]=function(_0x4ca49b,_0x281213){if(!_[_0xd6b5('0x15')](_0x4ca49b)){if(_0x4ca49b[_0xd6b5('0x2c')](_0xd6b5('0x2d'))){if(_0x4ca49b[_0xd6b5('0x2d')]>0x0){_0x4ca49b[_0xd6b5('0x2d')]-=0x1;}else{logger[_0xd6b5('0x9')](_0xd6b5('0x2e'),_0x281213);}}}else{logger[_0xd6b5('0x9')](_0xd6b5('0x2f'),_0x281213);}};exports[_0xd6b5('0x30')]=function(_0x2157f6){var _0xba771b=moment()[_0xd6b5('0x12')](_0xd6b5('0x31'));_0x2157f6[_0xd6b5('0x32')]=0xd;_0x2157f6[_0xd6b5('0x33')]=_0xd6b5('0x34');_0x2157f6[_0xd6b5('0x35')]=_0xba771b;_0x2157f6['responsetime']=_0xba771b;_0x2157f6[_0xd6b5('0x36')]=_0xba771b;};exports[_0xd6b5('0x37')]=function(_0x591476,_0x58690d,_0x22da7a){var _0x26ded8=moment()['format'](_0xd6b5('0x31'));_0x591476[_0xd6b5('0x32')]=_0x58690d;_0x591476[_0xd6b5('0x33')]=_0x22da7a;_0x591476[_0xd6b5('0x38')]=_0x26ded8;_0x591476[_0xd6b5('0x39')]=utils['getSeconds'](_0x591476['responsetime'],_0x591476['starttime']);};exports[_0xd6b5('0x3a')]=function(_0x181a1d,_0x4f5f2c,_0x354cd4){_0x181a1d[_0xd6b5('0x3b')]=_0x4f5f2c;_0x181a1d['UserId']=_0x354cd4;};exports[_0xd6b5('0x3c')]=function(_0x73b5dc,_0x5cdcaa,_0x534c22){var _0x1035b2=moment()[_0xd6b5('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x73b5dc['state']=_0x5cdcaa;_0x73b5dc['statedesc']=_0x534c22;_0x73b5dc[_0xd6b5('0x38')]=_0x73b5dc[_0xd6b5('0x38')]?_0x73b5dc[_0xd6b5('0x38')]:_0x1035b2;_0x73b5dc[_0xd6b5('0x36')]=_0x73b5dc[_0xd6b5('0x36')]?_0x73b5dc['endtime']:_0x1035b2;_0x73b5dc[_0xd6b5('0x39')]=utils[_0xd6b5('0x3d')](_0x73b5dc[_0xd6b5('0x38')]||0x0,_0x73b5dc['starttime']||0x0);_0x73b5dc['talktime']=_0x73b5dc[_0xd6b5('0x3e')]?utils[_0xd6b5('0x3d')](_0x73b5dc['endtime'],_0x73b5dc[_0xd6b5('0x3e')]):0x0;};exports['isFailure']=function(_0x38f7d1){return _0x38f7d1===_0xd6b5('0x3f');};exports[_0xd6b5('0x40')]=function(_0x47d6f5,_0x48252e,_0x4ccf2e,_0x15288c,_0x46c64d){var _0x3e87b0=_0x15288c?_0xd6b5('0x41'):_0x47d6f5[_0xd6b5('0x19')];_0x3e87b0=_0x46c64d?_0xd6b5('0x42'):_0x3e87b0;return{'actionid':_0x47d6f5[_0xd6b5('0x43')],'action':'originate','channel':_0x47d6f5[_0xd6b5('0x44')],'callerid':util[_0xd6b5('0x12')]('\x22%s\x22\x20<%s>',_0x3e87b0,_0x47d6f5[_0xd6b5('0x45')]),'Exten':_0xd6b5('0x25'),'Context':_0xd6b5('0x46'),'Priority':'1','variable':_0x4ccf2e,'timeout':(_0x48252e[_0xd6b5('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x47d6f5[_0xd6b5('0x43')]};};exports['totalGlobal']=function(_0x516361){return _0x516361['countbusyretry']+_0x516361['countcongestionretry']+_0x516361[_0xd6b5('0x48')]+_0x516361[_0xd6b5('0x49')]+_0x516361[_0xd6b5('0x4a')];};exports[_0xd6b5('0x4b')]=function(_0x50b336){var _0x316f2b=_['clone'](_0x50b336);_0x316f2b[_0xd6b5('0x32')]=0xf;_0x316f2b[_0xd6b5('0x33')]='Global';return _0x316f2b;};exports['scheduledAt']=function(_0x3a15fa,_0x5e43c6,_0x9b37c9){var _0x4f872d={};_0x4f872d[_0x5e43c6]=_0x3a15fa[_0x5e43c6];_0x4f872d[_0xd6b5('0x4c')]=![];_0x4f872d[_0xd6b5('0x4d')]=moment()[_0xd6b5('0x4e')](_0x9b37c9,_0xd6b5('0x4f'))[_0xd6b5('0x12')](_0xd6b5('0x31'));_0x4f872d[_0xd6b5('0x50')]=_0x3a15fa[_0xd6b5('0x50')];_0x4f872d[_0xd6b5('0x51')]=_0x3a15fa[_0xd6b5('0x51')];_0x4f872d['VoiceQueueId']=_0x3a15fa[_0xd6b5('0x1b')]||undefined;return _0x4f872d;};exports[_0xd6b5('0x52')]=function(_0x3215c4,_0x6c3503){if(!_['isNil'](_0x3215c4)){if(_0x3215c4['pTalking']>0x0){_0x3215c4['pTalking']-=0x1;}else{logger[_0xd6b5('0x9')](_0x6c3503,_0xd6b5('0x53'));}}else{logger[_0xd6b5('0x9')](_0x6c3503,_0xd6b5('0x54'));}};exports['IsNotLoggedIn']=function(_0x37cc24){if(_0x37cc24<=0x0){return!![];}return![];};function buildObj(_0x9d6719,_0x17242f,_0x50bf44){_0x9d6719[_0xd6b5('0x55')]=_0x17242f;_0x9d6719[_0xd6b5('0x18')]=_0x9d6719[_0xd6b5('0x56')];_0x9d6719[_0xd6b5('0x57')]=_0x9d6719['channelAgent'];_0x9d6719['motionChannel']=_0xd6b5('0x58');if(_0x50bf44){_0x9d6719['mandatoryDisposition']=_0x50bf44[_0xd6b5('0x59')];}return _0x9d6719;}exports[_0xd6b5('0x5a')]=buildObj;exports[_0xd6b5('0x5b')]=function(_0x1f21d0){var _0x25fd80=[];for(var _0x41d4b1 in _0x1f21d0){if(_0x1f21d0['hasOwnProperty'](_0x41d4b1)){if(!_[_0xd6b5('0x15')](_0x1f21d0[_0x41d4b1])&&_0x1f21d0[_0x41d4b1][_0xd6b5('0x32')]==='not_inuse'&&_0x1f21d0[_0x41d4b1][_0xd6b5('0x5c')]===_0xd6b5('0x5d')){_0x25fd80[_0xd6b5('0x5e')](_0x1f21d0[_0x41d4b1]['id']);}}}return _0x25fd80;};exports[_0xd6b5('0x5f')]=function(_0xdfcae5){var _0x587db6=moment()[_0xd6b5('0x60')](0x0);var _0x52ee41=moment(_0xdfcae5)['milliseconds'](0x0);return _0x587db6['diff'](_0x52ee41,_0xd6b5('0x61'));};exports['createBody']=function(_0x3cc483){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3cc483[_0xd6b5('0x50')],'ListId':_0x3cc483[_0xd6b5('0x51')],'VoiceQueueId':_0x3cc483['VoiceQueueId']||undefined,'CampaignId':_0x3cc483[_0xd6b5('0x62')]||undefined};};exports[_0xd6b5('0x63')]=function(_0x40749e){if(_0x40749e===_0xd6b5('0x43')||_0x40749e===_0xd6b5('0x64')||_0x40749e===_0xd6b5('0x56')||_0x40749e===_0xd6b5('0x65')||_0x40749e==='campaigntype'||_0x40749e==='dialAnswer'||_0x40749e===_0xd6b5('0x3b')||_0x40749e===_0xd6b5('0x44')||_0x40749e===_0xd6b5('0x19')||_0x40749e===_0xd6b5('0x4c')||_0x40749e==='calleridnum'||_0x40749e==='scheduledat'||_0x40749e===_0xd6b5('0x66')||_0x40749e==='countcongestionretry'||_0x40749e===_0xd6b5('0x48')||_0x40749e===_0xd6b5('0x67')||_0x40749e===_0xd6b5('0x68')||_0x40749e==='callbackuniqueid'||_0x40749e==='callbackat'||_0x40749e===_0xd6b5('0x69')||_0x40749e===_0xd6b5('0x50')||_0x40749e==='ListId'||_0x40749e===_0xd6b5('0x6a')||_0x40749e===_0xd6b5('0x1b')||_0x40749e==='sipcallid'||_0x40749e==='xmd-voicequeueid'||_0x40749e===_0xd6b5('0x6b')||_0x40749e===_0xd6b5('0x6c')||_0x40749e==='xmd-listid'||_0x40749e===_0xd6b5('0x6d')||_0x40749e===_0xd6b5('0x6e')||_0x40749e===_0xd6b5('0x6f')||_0x40749e===_0xd6b5('0x70')||_0x40749e===_0xd6b5('0x71')||_0x40749e===_0xd6b5('0x72')||_0x40749e==='xmd-cdrtype'||_0x40749e===_0xd6b5('0x73')||_0x40749e===_0xd6b5('0x74')||_0x40749e===_0xd6b5('0x75')||_0x40749e===_0xd6b5('0x76')||_0x40749e==='rtpaudioqosbridged'||_0x40749e===_0xd6b5('0x77')||_0x40749e===_0xd6b5('0x78')||_0x40749e===_0xd6b5('0x79')||_0x40749e==='rtpaudioqoslossbridged'||_0x40749e==='rtpaudioqosrtt'||_0x40749e===_0xd6b5('0x7a')||_0x40749e===_0xd6b5('0x76')||_0x40749e===_0xd6b5('0x7b')||_0x40749e===_0xd6b5('0x77')||_0x40749e===_0xd6b5('0x78')||_0x40749e==='rtpaudioqosloss'||_0x40749e===_0xd6b5('0x7c')||_0x40749e===_0xd6b5('0x7d')||_0x40749e===_0xd6b5('0x7a')||_0x40749e===_0xd6b5('0x7e')||_0x40749e===_0xd6b5('0x7f')||_0x40749e===_0xd6b5('0x32')||_0x40749e===_0xd6b5('0x33')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x493653,_0x1098cd){var _0x3153d7,_0x368cfe,_0x15b1db;if(_0x1098cd<=0x0){_0x1098cd=0x1;}_0x3153d7=new RegExp('\x5cw{0,'+_0x1098cd+'}$');_0x368cfe=Math['pow'](0xa,_0x1098cd-0x1);_0x15b1db=Math[_0xd6b5('0x80')](0xa,_0x1098cd)-0x1;return util[_0xd6b5('0x12')]('%s',_['replace'](_0x493653,_0x3153d7,_[_0xd6b5('0x81')](_0x368cfe,_0x15b1db)));};exports[_0xd6b5('0x82')]=function(_0x41acf0){var _0x399486=_0x41acf0[_0xd6b5('0x83')](/"(.*?)"/);return _0x399486?_0x399486[0x1]:_0x41acf0;};exports[_0xd6b5('0x84')]=function(_0x28e9c3){var _0x2ac65d=_0x28e9c3[_0xd6b5('0x83')](/<(.*?)>/);return _0x2ac65d?_0x2ac65d[0x1]:_0x28e9c3;};function buildNoAnswerEventPayload(_0x2a51e6,_0x558dc8){var _0x5e01c4=buildObj(_0x2a51e6,'noanswer');if(!_[_0xd6b5('0x10')](_0x558dc8['variables'])){Object[_0xd6b5('0x85')](_0x558dc8[_0xd6b5('0x86')])['forEach'](function(_0x42ef55){_0x5e01c4[_0x42ef55[_0xd6b5('0x87')]()]=_0x558dc8[_0xd6b5('0x86')][_0x42ef55];});}return _0x5e01c4;}exports[_0xd6b5('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xfdd6=['127.0.0.1','../../dialer/utils','error','inspect','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','getSeconds','membername','UserId','ringtime','talktime','answertime','isFailure','RECALL','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','extractCalleridNumber','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI'];(function(_0x2980d9,_0xef7ff){var _0x37994e=function(_0x555936){while(--_0x555936){_0x2980d9['push'](_0x2980d9['shift']());}};_0x37994e(++_0xef7ff);}(_0xfdd6,0x10c));var _0x6fdd=function(_0x529296,_0x1a6a23){_0x529296=_0x529296-0x0;var _0x1796bf=_0xfdd6[_0x529296];return _0x1796bf;};'use strict';var util=require(_0x6fdd('0x0'));var _=require(_0x6fdd('0x1'));var moment=require('moment');var logger=require(_0x6fdd('0x2'))(_0x6fdd('0x3'));var ipAgi=process[_0x6fdd('0x4')][_0x6fdd('0x5')]||_0x6fdd('0x6');var utils=require(_0x6fdd('0x7'));exports['loggerCatch']=function(_0x2349cc){return function(_0x111261){logger[_0x6fdd('0x8')](_0x2349cc,util[_0x6fdd('0x9')](_0x111261,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x149a53,_0x22ac04){logger[_0x6fdd('0xa')](_0x149a53,util[_0x6fdd('0x9')](_0x22ac04,{'showHidden':![],'depth':null}));};exports[_0x6fdd('0xb')]=function(_0x36dc57,_0x335027){logger[_0x6fdd('0x8')](_0x36dc57,util[_0x6fdd('0x9')](_0x335027,{'showHidden':![],'depth':null}));};exports[_0x6fdd('0xc')]=function(_0x3544e1){return function(_0x5108b1){logger[_0x6fdd('0xa')](_0x3544e1,util[_0x6fdd('0x9')](_0x5108b1,{'showHidden':![],'depth':null}));};};exports[_0x6fdd('0xd')]=function(_0x4c3f49,_0x48ac4d,_0x4b63a3){return{'message':_0x4c3f49,'unlock':_0x48ac4d,'active':_0x4b63a3};};exports['getCallerId']=function(_0x2c8302,_0x3b9b5c,_0x44c2d0){if(!_[_0x6fdd('0xe')](_0x44c2d0)&&'string'===typeof _0x44c2d0&&!_['isEmpty'](_0x44c2d0)){if(!_['isUndefined'](_0x3b9b5c)&&_0x6fdd('0xf')===typeof _0x3b9b5c&&!_[_0x6fdd('0x10')](_0x3b9b5c)){return util[_0x6fdd('0x11')]('\x22%s\x22\x20<%s>',_0x3b9b5c,_0x44c2d0);}return util[_0x6fdd('0x11')](_0x6fdd('0x12'),_0x44c2d0,_0x44c2d0);}if(!_[_0x6fdd('0xe')](_0x2c8302)&&_0x6fdd('0xf')===typeof _0x2c8302&&!_['isEmpty'](_0x2c8302)){return _0x2c8302;}return _0x6fdd('0x13');};exports[_0x6fdd('0x14')]=function(_0x4df7ad){if(_[_0x6fdd('0x15')](_0x4df7ad)){return![];}return _0x4df7ad;};exports[_0x6fdd('0x16')]=function(_0x12410a,_0x22a950,_0x4fd68a,_0x2f8374,_0x264790,_0x2d9645){var _0x2d7fd7={'XMD-QUEUE':_0x22a950[_0x6fdd('0x17')]?_0x22a950[_0x6fdd('0x17')][_0x6fdd('0x18')]:'','XMD-CALLERID':_0x2f8374,'XMD-CALLERID-PREVIEW':_0x2d9645?util[_0x6fdd('0x11')]('\x22%s\x22\x20<%s>',_0x2d9645[_0x6fdd('0x19')],_0x2d9645['calleridnum']):_0x2f8374,'XMD-DIALID':_0x264790,'XMD-CONTACTID':_0x22a950[_0x6fdd('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2f8374,'XMD-VOICEQUEUEID':_0x22a950[_0x6fdd('0x1b')],'XMD-DIALCHANNEL':_0x4fd68a,'XMD-DIALTIMEOUT':_0x12410a[_0x6fdd('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x6fdd('0x11')](_0x6fdd('0x1d'),_0x12410a[_0x6fdd('0x1e')]?'g':'',_[_0x6fdd('0x10')](_0x12410a[_0x6fdd('0x1f')])?'':_0x6fdd('0x20')),'XMD-DIALURL':_0x12410a['dialPreviewUrl']||'','XMD-AGI':_0x12410a['dialQueueProject']?util['format'](_0x6fdd('0x21'),ipAgi,_0x12410a[_0x6fdd('0x22')]):_0x6fdd('0x23'),'XMD-AGIAFTER':_0x12410a['dialQueueProject2']?util[_0x6fdd('0x11')](_0x6fdd('0x21'),ipAgi,_0x12410a[_0x6fdd('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x2d9645?_0x2d9645[_0x6fdd('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x2d9645?_0x2d9645['originatecalleridname']:'','XMD-DESTINATION':_0x6fdd('0x25'),'SIPADDHEADER':_0x6fdd('0x26')};if(!_[_0x6fdd('0x10')](_0x12410a[_0x6fdd('0x1f')])){_0x2d7fd7[util[_0x6fdd('0x11')]('%s',_0x6fdd('0x27'))]=_0x12410a[_0x6fdd('0x1f')];_0x2d7fd7[util[_0x6fdd('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x264790;}return _0x2d7fd7;};exports['toLowerVariables']=function(_0x533f0f){var _0x2a6203={};for(var _0x52212e in _0x533f0f){if(_0x533f0f[_0x6fdd('0x28')](_0x52212e)){_0x2a6203[util[_0x6fdd('0x11')]('%s',_[_0x6fdd('0x29')](_0x52212e))]=_0x533f0f[_0x52212e];}}return{'variables':_0x2a6203};};exports['updateOriginated']=function(_0x471789,_0x45b397){if(!_[_0x6fdd('0x15')](_0x471789)){if(_0x471789[_0x6fdd('0x28')](_0x6fdd('0x2a'))){if(_0x471789['originated']>0x0){_0x471789['originated']-=0x1;}else{logger[_0x6fdd('0x8')](_0x6fdd('0x2b'),_0x45b397);}}}else{logger[_0x6fdd('0x8')](_0x6fdd('0x2c'),_0x45b397);}};exports[_0x6fdd('0x2d')]=function(_0x4a8d84){var _0x44c792=moment()[_0x6fdd('0x11')](_0x6fdd('0x2e'));_0x4a8d84[_0x6fdd('0x2f')]=0xd;_0x4a8d84['statedesc']=_0x6fdd('0x30');_0x4a8d84[_0x6fdd('0x31')]=_0x44c792;_0x4a8d84[_0x6fdd('0x32')]=_0x44c792;_0x4a8d84[_0x6fdd('0x33')]=_0x44c792;};exports['logAgent']=function(_0x2d1c40,_0x1bb747,_0x54f7ff){var _0x3d77ee=moment()[_0x6fdd('0x11')](_0x6fdd('0x2e'));_0x2d1c40[_0x6fdd('0x2f')]=_0x1bb747;_0x2d1c40[_0x6fdd('0x34')]=_0x54f7ff;_0x2d1c40[_0x6fdd('0x32')]=_0x3d77ee;_0x2d1c40['ringtime']=utils[_0x6fdd('0x35')](_0x2d1c40[_0x6fdd('0x32')],_0x2d1c40[_0x6fdd('0x31')]);};exports['logLookAgent']=function(_0x532b08,_0xe5a9dd,_0x442162){_0x532b08[_0x6fdd('0x36')]=_0xe5a9dd;_0x532b08[_0x6fdd('0x37')]=_0x442162;};exports['logCustomer']=function(_0x27fd4d,_0x307089,_0x3bf603){var _0x19e290=moment()[_0x6fdd('0x11')](_0x6fdd('0x2e'));_0x27fd4d['state']=_0x307089;_0x27fd4d[_0x6fdd('0x34')]=_0x3bf603;_0x27fd4d['responsetime']=_0x27fd4d['responsetime']?_0x27fd4d[_0x6fdd('0x32')]:_0x19e290;_0x27fd4d[_0x6fdd('0x33')]=_0x27fd4d['endtime']?_0x27fd4d['endtime']:_0x19e290;_0x27fd4d[_0x6fdd('0x38')]=utils[_0x6fdd('0x35')](_0x27fd4d[_0x6fdd('0x32')]||0x0,_0x27fd4d['starttime']||0x0);_0x27fd4d[_0x6fdd('0x39')]=_0x27fd4d[_0x6fdd('0x3a')]?utils[_0x6fdd('0x35')](_0x27fd4d['endtime'],_0x27fd4d[_0x6fdd('0x3a')]):0x0;};exports[_0x6fdd('0x3b')]=function(_0xf37158){return _0xf37158==='Failure';};exports['variablesAction']=function(_0x321c83,_0x1fdaad,_0x4534c3,_0x1e3a26,_0x5c1f39){var _0x2f8d84=_0x1e3a26?_0x6fdd('0x3c'):_0x321c83[_0x6fdd('0x19')];_0x2f8d84=_0x5c1f39?'BOOKED':_0x2f8d84;return{'actionid':_0x321c83[_0x6fdd('0x3d')],'action':_0x6fdd('0x3e'),'channel':_0x321c83[_0x6fdd('0x3f')],'callerid':util[_0x6fdd('0x11')](_0x6fdd('0x12'),_0x2f8d84,_0x321c83[_0x6fdd('0x40')]),'Exten':_0x6fdd('0x25'),'Context':'from-sip','Priority':'1','variable':_0x4534c3,'timeout':(_0x1fdaad[_0x6fdd('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x321c83[_0x6fdd('0x3d')]};};exports[_0x6fdd('0x42')]=function(_0x4aff36){return _0x4aff36[_0x6fdd('0x43')]+_0x4aff36[_0x6fdd('0x44')]+_0x4aff36['countnoanswerretry']+_0x4aff36['countagentrejectretry']+_0x4aff36[_0x6fdd('0x45')];};exports[_0x6fdd('0x46')]=function(_0x33ce9b){var _0x40f6f2=_['clone'](_0x33ce9b);_0x40f6f2[_0x6fdd('0x2f')]=0xf;_0x40f6f2['statedesc']=_0x6fdd('0x47');return _0x40f6f2;};exports[_0x6fdd('0x48')]=function(_0x1d21a2,_0x4d075a,_0x39421a){var _0x3ad39d={};_0x3ad39d[_0x4d075a]=_0x1d21a2[_0x4d075a];_0x3ad39d[_0x6fdd('0x49')]=![];_0x3ad39d[_0x6fdd('0x4a')]=moment()[_0x6fdd('0x4b')](_0x39421a,'minutes')[_0x6fdd('0x11')](_0x6fdd('0x2e'));_0x3ad39d[_0x6fdd('0x1a')]=_0x1d21a2[_0x6fdd('0x1a')];_0x3ad39d[_0x6fdd('0x4c')]=_0x1d21a2[_0x6fdd('0x4c')];_0x3ad39d[_0x6fdd('0x1b')]=_0x1d21a2[_0x6fdd('0x1b')]||undefined;return _0x3ad39d;};exports['decrementTalkink']=function(_0x1508fd,_0x635b5a){if(!_[_0x6fdd('0x15')](_0x1508fd)){if(_0x1508fd[_0x6fdd('0x4d')]>0x0){_0x1508fd[_0x6fdd('0x4d')]-=0x1;}else{logger['error'](_0x635b5a,_0x6fdd('0x4e'));}}else{logger['error'](_0x635b5a,_0x6fdd('0x4f'));}};exports[_0x6fdd('0x50')]=function(_0x21faae){if(_0x21faae<=0x0){return!![];}return![];};function buildObj(_0x5db3fb,_0x19b087,_0x2905e7){_0x5db3fb[_0x6fdd('0x51')]=_0x19b087;_0x5db3fb[_0x6fdd('0x18')]=_0x5db3fb[_0x6fdd('0x52')];_0x5db3fb[_0x6fdd('0x53')]=_0x5db3fb[_0x6fdd('0x3f')];_0x5db3fb[_0x6fdd('0x54')]=_0x6fdd('0x55');if(_0x2905e7){_0x5db3fb['mandatoryDisposition']=_0x2905e7['mandatoryDisposition'];}return _0x5db3fb;}exports['buildObj']=buildObj;exports[_0x6fdd('0x56')]=function(_0x39c332){var _0x4829c3=[];for(var _0x2274ce in _0x39c332){if(_0x39c332[_0x6fdd('0x28')](_0x2274ce)){if(!_['isNil'](_0x39c332[_0x2274ce])&&_0x39c332[_0x2274ce][_0x6fdd('0x2f')]===_0x6fdd('0x57')&&_0x39c332[_0x2274ce][_0x6fdd('0x58')]===_0x6fdd('0x59')){_0x4829c3[_0x6fdd('0x5a')](_0x39c332[_0x2274ce]['id']);}}}return _0x4829c3;};exports[_0x6fdd('0x5b')]=function(_0x155e77){var _0xaba93c=moment()[_0x6fdd('0x5c')](0x0);var _0x6beee=moment(_0x155e77)[_0x6fdd('0x5c')](0x0);return _0xaba93c['diff'](_0x6beee,'seconds');};exports[_0x6fdd('0x5d')]=function(_0xa013eb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xa013eb['ContactId'],'ListId':_0xa013eb[_0x6fdd('0x4c')],'VoiceQueueId':_0xa013eb[_0x6fdd('0x1b')]||undefined,'CampaignId':_0xa013eb[_0x6fdd('0x5e')]||undefined};};exports[_0x6fdd('0x5f')]=function(_0xab74c6){if(_0xab74c6==='uniqueid'||_0xab74c6===_0x6fdd('0x60')||_0xab74c6===_0x6fdd('0x52')||_0xab74c6===_0x6fdd('0x61')||_0xab74c6===_0x6fdd('0x62')||_0xab74c6===_0x6fdd('0x63')||_0xab74c6===_0x6fdd('0x36')||_0xab74c6===_0x6fdd('0x3f')||_0xab74c6===_0x6fdd('0x19')||_0xab74c6===_0x6fdd('0x49')||_0xab74c6==='calleridnum'||_0xab74c6===_0x6fdd('0x4a')||_0xab74c6===_0x6fdd('0x43')||_0xab74c6===_0x6fdd('0x44')||_0xab74c6===_0x6fdd('0x64')||_0xab74c6===_0x6fdd('0x65')||_0xab74c6===_0x6fdd('0x66')||_0xab74c6===_0x6fdd('0x67')||_0xab74c6===_0x6fdd('0x68')||_0xab74c6==='recallme'||_0xab74c6===_0x6fdd('0x1a')||_0xab74c6===_0x6fdd('0x4c')||_0xab74c6==='UserId'||_0xab74c6===_0x6fdd('0x1b')||_0xab74c6===_0x6fdd('0x69')||_0xab74c6==='xmd-voicequeueid'||_0xab74c6===_0x6fdd('0x6a')||_0xab74c6===_0x6fdd('0x6b')||_0xab74c6===_0x6fdd('0x6c')||_0xab74c6==='xmd-dialurl'||_0xab74c6==='xmd-dialtimeout'||_0xab74c6===_0x6fdd('0x6d')||_0xab74c6===_0x6fdd('0x6e')||_0xab74c6===_0x6fdd('0x6f')||_0xab74c6===_0x6fdd('0x70')||_0xab74c6===_0x6fdd('0x71')||_0xab74c6===_0x6fdd('0x72')||_0xab74c6===_0x6fdd('0x73')||_0xab74c6==='xmd-agi'||_0xab74c6===_0x6fdd('0x74')||_0xab74c6===_0x6fdd('0x75')||_0xab74c6===_0x6fdd('0x76')||_0xab74c6==='rtpaudioqosjitterbridged'||_0xab74c6===_0x6fdd('0x77')||_0xab74c6===_0x6fdd('0x78')||_0xab74c6===_0x6fdd('0x79')||_0xab74c6===_0x6fdd('0x7a')||_0xab74c6==='rtpaudioqos'||_0xab74c6==='rtpaudioqosbridged'||_0xab74c6===_0x6fdd('0x76')||_0xab74c6===_0x6fdd('0x7b')||_0xab74c6===_0x6fdd('0x77')||_0xab74c6===_0x6fdd('0x78')||_0xab74c6==='rtpaudioqosrtt'||_0xab74c6===_0x6fdd('0x7a')||_0xab74c6===_0x6fdd('0x7c')||_0xab74c6===_0x6fdd('0x7d')||_0xab74c6===_0x6fdd('0x2f')||_0xab74c6==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0xb1cc5a,_0x162b28){var _0x2244e0,_0x4f6070,_0x464a15;if(_0x162b28<=0x0){_0x162b28=0x1;}_0x2244e0=new RegExp(_0x6fdd('0x7e')+_0x162b28+'}$');_0x4f6070=Math[_0x6fdd('0x7f')](0xa,_0x162b28-0x1);_0x464a15=Math['pow'](0xa,_0x162b28)-0x1;return util[_0x6fdd('0x11')]('%s',_['replace'](_0xb1cc5a,_0x2244e0,_[_0x6fdd('0x80')](_0x4f6070,_0x464a15)));};exports['extractCalleridName']=function(_0x1c098f){var _0x47f274=_0x1c098f['match'](/"(.*?)"/);return _0x47f274?_0x47f274[0x1]:_0x1c098f;};exports[_0x6fdd('0x81')]=function(_0x5966ae){var _0x4b14f7=_0x5966ae[_0x6fdd('0x82')](/<(.*?)>/);return _0x4b14f7?_0x4b14f7[0x1]:_0x5966ae;};function buildNoAnswerEventPayload(_0x3ea579,_0xb427cf){var _0x3ffbb5=buildObj(_0x3ea579,_0x6fdd('0x83'));if(!_['isEmpty'](_0xb427cf[_0x6fdd('0x84')])){Object[_0x6fdd('0x85')](_0xb427cf[_0x6fdd('0x84')])[_0x6fdd('0x86')](function(_0x21f785){_0x3ffbb5[_0x21f785[_0x6fdd('0x87')]()]=_0xb427cf[_0x6fdd('0x84')][_0x21f785];});}return _0x3ffbb5;}exports[_0x6fdd('0x88')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e26bba6..3f70853 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 _0x3b29=['reload','voicequeuechannel','voicechannel','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause'];(function(_0xb313e1,_0x472cfa){var _0x22de8c=function(_0x305cc6){while(--_0x305cc6){_0xb313e1['push'](_0xb313e1['shift']());}};_0x22de8c(++_0x472cfa);}(_0x3b29,0x15a));var _0x93b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3b29[_0x14add3];return _0x4a174f;};'use strict';exports['queueadd']={'queue':{'type':_0x93b2('0x0'),'required':!![]},'interface':{'type':_0x93b2('0x0'),'required':!![]},'membername':{'type':_0x93b2('0x0'),'required':!![]},'penalty':{'type':_0x93b2('0x1'),'required':![]},'paused':{'type':_0x93b2('0x2'),'required':![]}};exports[_0x93b2('0x3')]={'queue':{'type':_0x93b2('0x0'),'required':!![]},'interface':{'type':_0x93b2('0x0'),'required':!![]}};exports[_0x93b2('0x4')]={'interface':{'type':_0x93b2('0x0'),'required':!![]},'paused':{'type':_0x93b2('0x2')},'reason':{'type':_0x93b2('0x0'),'required':![]}};exports[_0x93b2('0x5')]={'module':{'type':'string','required':![]}};exports[_0x93b2('0x6')]={'uniqueid':{'type':_0x93b2('0x0'),'required':!![]}};exports[_0x93b2('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x93b2('0x0')},'format':{'type':_0x93b2('0x0')},'mixmonitorid':{'type':_0x93b2('0x0')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x93b2('0x0'),'required':!![]}};exports[_0x93b2('0x8')]={'uniqueid':{'type':_0x93b2('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x93b2('0x0')}}; \ No newline at end of file +var _0x268d=['reload','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','queuepause'];(function(_0x322fa9,_0x40780c){var _0x232126=function(_0x4d4260){while(--_0x4d4260){_0x322fa9['push'](_0x322fa9['shift']());}};_0x232126(++_0x40780c);}(_0x268d,0x115));var _0xd268=function(_0x1b6751,_0x43a3a5){_0x1b6751=_0x1b6751-0x0;var _0x5484a8=_0x268d[_0x1b6751];return _0x5484a8;};'use strict';exports[_0xd268('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xd268('0x1'),'required':!![]},'membername':{'type':_0xd268('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xd268('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xd268('0x2')]={'interface':{'type':_0xd268('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xd268('0x1'),'required':![]}};exports[_0xd268('0x3')]={'module':{'type':_0xd268('0x1'),'required':![]}};exports[_0xd268('0x4')]={'uniqueid':{'type':_0xd268('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xd268('0x1')},'format':{'type':_0xd268('0x1')},'mixmonitorid':{'type':_0xd268('0x1')}};exports[_0xd268('0x5')]={'uniqueid':{'type':_0xd268('0x1'),'required':!![]}};exports[_0xd268('0x6')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xd268('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ba5a556..0b83a79 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0xffa037,_0x10f6ed){var _0x4c02e4=function(_0x294146){while(--_0x294146){_0xffa037['push'](_0xffa037['shift']());}};_0x4c02e4(++_0x10f6ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x33c98e,_0x4eb3d0){_0x33c98e=_0x33c98e-0x0;var _0x39a756=_0xb10b[_0x33c98e];return _0x39a756;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x21f8ee,_0x437c18){var _0x170f3a=function(_0xdadd23){while(--_0xdadd23){_0x21f8ee['push'](_0x21f8ee['shift']());}};_0x170f3a(++_0x437c18);}(_0xadb5,0xad));var _0x5adb=function(_0x5061a9,_0x5ddb3e){_0x5061a9=_0x5061a9-0x0;var _0x54995e=_0xadb5[_0x5061a9];return _0x54995e;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index cd7f38c..a4ff3d6 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 _0x04ae=['mergeDBDataToRealtime'];(function(_0x972f76,_0x25d2f8){var _0x3445df=function(_0x43574a){while(--_0x43574a){_0x972f76['push'](_0x972f76['shift']());}};_0x3445df(++_0x25d2f8);}(_0x04ae,0xfe));var _0xe04a=function(_0x5b44f,_0x48ea2d){_0x5b44f=_0x5b44f-0x0;var _0x5c2d43=_0x04ae[_0x5b44f];return _0x5c2d43;};'use strict';function mergeDBDataToRealtime(_0x2a34ff,_0x99309){var _0x5cfc52=Object['assign']({},_0x2a34ff);for(var _0x5dbc97 in _0x99309){if(_0x5cfc52['hasOwnProperty'](_0x5dbc97)){_0x5cfc52[_0x5dbc97]=_0x99309[_0x5dbc97];}}return _0x5cfc52;}exports[_0xe04a('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xce65=['hasOwnProperty','mergeDBDataToRealtime','assign'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xce65,0x1ca));var _0x5ce6=function(_0x4c32bc,_0x3cefe4){_0x4c32bc=_0x4c32bc-0x0;var _0x26a3b4=_0xce65[_0x4c32bc];return _0x26a3b4;};'use strict';function mergeDBDataToRealtime(_0x3e803c,_0x599b03){var _0x3a03eb=Object[_0x5ce6('0x0')]({},_0x3e803c);for(var _0x2e2505 in _0x599b03){if(_0x3a03eb[_0x5ce6('0x1')](_0x2e2505)){_0x3a03eb[_0x2e2505]=_0x599b03[_0x2e2505];}}return _0x3a03eb;}exports[_0x5ce6('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index cfce36f..7e50a74 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 _0x7772=['attendedTransfer','prototype','findAgent','find','accountcode','name','interface','format','SIP/%s','length','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','getAgentByInternal','getCallType','channel','split','outbound','destination','exten','type','dialer','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','transfers','linkedid','transfereelinkedid','blindTransfer','UserId','membername','monitor','monitors','monitorFilename','createdAt','calleridname','connectedlinename','xcally-motion-dialer','isArray','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer'];(function(_0xa5d9f9,_0x17c6bf){var _0x40e9f6=function(_0x1c2585){while(--_0x1c2585){_0xa5d9f9['push'](_0xa5d9f9['shift']());}};_0x40e9f6(++_0x17c6bf);}(_0x7772,0x98));var _0x2777=function(_0x1f215c,_0x397309){_0x1f215c=_0x1f215c-0x0;var _0x54712d=_0x7772[_0x1f215c];return _0x54712d;};'use strict';var _=require(_0x2777('0x0'));var moment=require(_0x2777('0x1'));var util=require('util');var config=require(_0x2777('0x2'));var ami=require(_0x2777('0x3'));var RpcVoiceAgentReport=require(_0x2777('0x4'));var RpcVoiceCallReport=require(_0x2777('0x5'));var RpcVoiceDialReport=require(_0x2777('0x6'));var RpcMemberReport=require(_0x2777('0x7'));var RpcVoiceQueueReport=require(_0x2777('0x8'));var RpcVoiceRecording=require(_0x2777('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x2777('0xa'));var VoiceDialReport=require(_0x2777('0xb'));var UserReport=require(_0x2777('0xc'));function Report(_0x1f79fe){this['realtime']=_0x1f79fe;this['agents']=_0x1f79fe[_0x2777('0xd')];this['telephones']=_0x1f79fe[_0x2777('0xe')];}Report['prototype'][_0x2777('0xf')]=function(_0x442a75){var _0x31c63d=new VoiceQueueReport(this[_0x2777('0x10')]);var _0x22db34=new VoiceAgentReport(this['realtime']);var _0x372717=new VoiceDialReport(this[_0x2777('0x10')]);var _0x1ded14=new VoiceCallReport(this[_0x2777('0x10')]);var _0x12b1d2=new UserReport(this[_0x2777('0x10')]);if(config['xdr']&&config[_0x2777('0x11')][_0x2777('0x12')]){ami['on'](_0x2777('0x13'),this[_0x2777('0x14')][_0x2777('0x15')](this));ami['on'](_0x2777('0x16'),this[_0x2777('0x17')][_0x2777('0x15')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0x2777('0x18'),this[_0x2777('0x19')][_0x2777('0x15')](this));ami['on'](_0x2777('0x1a'),this['blindTransfer'][_0x2777('0x15')](this));ami['on'](_0x2777('0x1b'),this[_0x2777('0x1c')][_0x2777('0x15')](this));}};Report[_0x2777('0x1d')][_0x2777('0x1e')]=function(_0x2666d1){var _0x4c5ae4;_0x4c5ae4=_[_0x2777('0x1f')](this[_0x2777('0xd')],function(_0x24a2be){return _0x24a2be['accountcode']==_0x2666d1||_0x24a2be['name']==_0x2666d1;});if(_['isNil'](_0x4c5ae4)){var _0x5207c7=_[_0x2777('0x1f')](this[_0x2777('0xe')],function(_0x546129){return _0x546129[_0x2777('0x20')]==_0x2666d1||_0x546129[_0x2777('0x21')]==_0x2666d1;});if(_0x5207c7){_0x4c5ae4=_[_0x2777('0x1f')](this[_0x2777('0xd')],function(_0x1515a4){return _0x1515a4[_0x2777('0x22')]==util[_0x2777('0x23')](_0x2777('0x24'),_0x5207c7[_0x2777('0x21')]);});}}return _0x4c5ae4;};Report[_0x2777('0x1d')][_0x2777('0x14')]=function(_0xc481ef){for(var _0x1989bd=0x0;_0x1989bd<_0xc481ef[_0x2777('0x25')];_0x1989bd+=0x1){var _0x4f25ba=this[_0x2777('0x1e')](_0xc481ef[_0x1989bd]['connectedlinenum']);if(_0x4f25ba){_0xc481ef[_0x1989bd][_0x2777('0x20')]=_0x4f25ba[_0x2777('0x20')];_0xc481ef[_0x1989bd]['assigned']=!![];_0xc481ef[_0x1989bd][_0x2777('0x26')]=_0x4f25ba[_0x2777('0x21')];_0xc481ef[_0x1989bd][_0x2777('0x22')]=_[_0x2777('0x27')](_0x4f25ba[_0x2777('0x22')])?util[_0x2777('0x23')]('SIP/%s',_0x4f25ba[_0x2777('0x21')]):_0x4f25ba[_0x2777('0x22')];if(_0xc481ef[_0x1989bd][_0x2777('0x28')]){_0xc481ef[_0x1989bd][_0x2777('0x29')]=moment()[_0x2777('0x23')](_0x2777('0x2a'));}if(_0xc481ef[_0x1989bd][_0x2777('0x2b')]){_0xc481ef[_0x1989bd]['queuecallerexitAt']=moment()[_0x2777('0x23')](_0x2777('0x2a'));}RpcMemberReport[_0x2777('0x14')](_0xc481ef[_0x1989bd]);}RpcVoiceQueueReport[_0x2777('0x2c')](_0xc481ef[_0x1989bd]);}};function extractCalleridNumber(_0x2b9303){var _0x526886=_0x2b9303['match'](/<(.*?)>/);return _0x526886?_0x526886[0x1]:_0x2b9303;}Report[_0x2777('0x1d')][_0x2777('0x2d')]=function(_0x2f934d){for(var _0x20780d=0x0;_0x20780d','calleridname','transfers','linkedid','transfereelinkedid','type','UserId','membername','monitor','monitors','length','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','phone','indexOf','lastIndexOf','transfererlinkedid','exports','moment','util'];(function(_0xaa9b4b,_0x515dff){var _0x29625f=function(_0x284950){while(--_0x284950){_0xaa9b4b['push'](_0xaa9b4b['shift']());}};_0x29625f(++_0x515dff);}(_0x3fdd,0x17a));var _0xd3fd=function(_0x1ea148,_0x22ec0c){_0x1ea148=_0x1ea148-0x0;var _0x12558=_0x3fdd[_0x1ea148];return _0x12558;};'use strict';var _=require('lodash');var moment=require(_0xd3fd('0x0'));var util=require(_0xd3fd('0x1'));var config=require('../../../config/environment');var ami=require(_0xd3fd('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xd3fd('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xd3fd('0x4'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xd3fd('0x5'));var RpcVoiceTransferReport=require(_0xd3fd('0x6'));var VoiceQueueReport=require(_0xd3fd('0x7'));var VoiceCallReport=require(_0xd3fd('0x8'));var VoiceAgentReport=require(_0xd3fd('0x9'));var VoiceDialReport=require(_0xd3fd('0xa'));var UserReport=require('./userReport');function Report(_0x2a512a){this[_0xd3fd('0xb')]=_0x2a512a;this['agents']=_0x2a512a[_0xd3fd('0xc')];this[_0xd3fd('0xd')]=_0x2a512a[_0xd3fd('0xd')];}Report[_0xd3fd('0xe')][_0xd3fd('0xf')]=function(_0x58b37d){var _0x5082a4=new VoiceQueueReport(this[_0xd3fd('0xb')]);var _0x3705df=new VoiceAgentReport(this[_0xd3fd('0xb')]);var _0x12fba=new VoiceDialReport(this[_0xd3fd('0xb')]);var _0x56da65=new VoiceCallReport(this[_0xd3fd('0xb')]);var _0x35c75b=new UserReport(this[_0xd3fd('0xb')]);if(config[_0xd3fd('0x10')]&&config[_0xd3fd('0x10')]['disabled']){ami['on'](_0xd3fd('0x11'),this[_0xd3fd('0x12')][_0xd3fd('0x13')](this));ami['on'](_0xd3fd('0x14'),this[_0xd3fd('0x15')][_0xd3fd('0x13')](this));ami['on'](_0xd3fd('0x16'),this[_0xd3fd('0x17')][_0xd3fd('0x13')](this));ami['on'](_0xd3fd('0x18'),this[_0xd3fd('0x19')][_0xd3fd('0x13')](this));ami['on'](_0xd3fd('0x1a'),this[_0xd3fd('0x1b')]['bind'](this));ami['on']('attendedtransfer',this[_0xd3fd('0x1c')][_0xd3fd('0x13')](this));}};Report[_0xd3fd('0xe')][_0xd3fd('0x1d')]=function(_0x5cdea4){var _0x276d8f;_0x276d8f=_[_0xd3fd('0x1e')](this[_0xd3fd('0xc')],function(_0x3a62ca){return _0x3a62ca[_0xd3fd('0x1f')]==_0x5cdea4||_0x3a62ca[_0xd3fd('0x20')]==_0x5cdea4;});if(_[_0xd3fd('0x21')](_0x276d8f)){var _0x22de61=_[_0xd3fd('0x1e')](this[_0xd3fd('0xd')],function(_0x245622){return _0x245622[_0xd3fd('0x1f')]==_0x5cdea4||_0x245622['name']==_0x5cdea4;});if(_0x22de61){_0x276d8f=_[_0xd3fd('0x1e')](this[_0xd3fd('0xc')],function(_0xf65115){return _0xf65115[_0xd3fd('0x22')]==util[_0xd3fd('0x23')](_0xd3fd('0x24'),_0x22de61[_0xd3fd('0x20')]);});}}return _0x276d8f;};Report['prototype']['voiceQueueReport']=function(_0x17285a){for(var _0x8f6d33=0x0;_0x8f6d33<_0x17285a['length'];_0x8f6d33+=0x1){var _0x17bd1b=this[_0xd3fd('0x1d')](_0x17285a[_0x8f6d33][_0xd3fd('0x25')]);if(_0x17bd1b){_0x17285a[_0x8f6d33][_0xd3fd('0x1f')]=_0x17bd1b['accountcode'];_0x17285a[_0x8f6d33][_0xd3fd('0x26')]=!![];_0x17285a[_0x8f6d33][_0xd3fd('0x27')]=_0x17bd1b[_0xd3fd('0x20')];_0x17285a[_0x8f6d33]['interface']=_[_0xd3fd('0x21')](_0x17bd1b[_0xd3fd('0x22')])?util[_0xd3fd('0x23')](_0xd3fd('0x24'),_0x17bd1b[_0xd3fd('0x20')]):_0x17bd1b[_0xd3fd('0x22')];if(_0x17285a[_0x8f6d33]['queuecallercomplete']){_0x17285a[_0x8f6d33][_0xd3fd('0x28')]=moment()[_0xd3fd('0x23')](_0xd3fd('0x29'));}if(_0x17285a[_0x8f6d33][_0xd3fd('0x2a')]){_0x17285a[_0x8f6d33][_0xd3fd('0x2b')]=moment()[_0xd3fd('0x23')](_0xd3fd('0x29'));}RpcMemberReport[_0xd3fd('0x12')](_0x17285a[_0x8f6d33]);}RpcVoiceQueueReport[_0xd3fd('0x2c')](_0x17285a[_0x8f6d33]);}};function extractCalleridNumber(_0x13be27){var _0x8e4430=_0x13be27[_0xd3fd('0x2d')](/<(.*?)>/);return _0x8e4430?_0x8e4430[0x1]:_0x13be27;}Report[_0xd3fd('0xe')][_0xd3fd('0x2e')]=function(_0x2be427){for(var _0x1f5acc=0x0;_0x1f5acc{delete this[_0x6165('0x8')][_0x1bb6ba];},_0x3dfa9a);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x9760=['seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','deleteChannelAfterTimeout','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','syncAgentCalled','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','interface','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','assign','event','privilege','calleridnum','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','destconnectedlinenum','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswer','agentringnoanswerAt','answeredelsewheredestinationuniqueid','reason','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','name','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','talktime','acw','acwtime','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][agentcomplete]','addVariable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','variable','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x9760,0xae));var _0x0976=function(_0x16fd72,_0x56ed52){_0x16fd72=_0x16fd72-0x0;var _0xba8d46=_0x9760[_0x16fd72];return _0xba8d46;};'use strict';var _=require(_0x0976('0x0'));var moment=require(_0x0976('0x1'));var util=require('util');var Redis=require(_0x0976('0x2'));var config=require(_0x0976('0x3'));var logger=require(_0x0976('0x4'))('ami');var ami=require(_0x0976('0x5'));config[_0x0976('0x6')]=_['defaults'](config[_0x0976('0x6')],{'host':_0x0976('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0976('0x6')]));function VoiceAgentReport(_0x1666e5){this[_0x0976('0x8')]={};this[_0x0976('0x9')]=_0x1666e5[_0x0976('0x8')];this[_0x0976('0xa')]=_0x1666e5['voiceQueues'];this[_0x0976('0xb')]=_0x1666e5[_0x0976('0xb')];this[_0x0976('0xc')]={};ami['on'](_0x0976('0xd'),this['syncAgentCalled'][_0x0976('0xe')](this));ami['on'](_0x0976('0xf'),this[_0x0976('0x10')][_0x0976('0xe')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0976('0xe')](this));ami['on'](_0x0976('0x11'),this[_0x0976('0x12')][_0x0976('0xe')](this));ami['on'](_0x0976('0x13'),this[_0x0976('0x14')][_0x0976('0xe')](this));ami['on']('varset',this[_0x0976('0x15')][_0x0976('0xe')](this));ami['on'](_0x0976('0x16'),this['syncHangup']['bind'](this));ami['on']('musiconholdstart',this[_0x0976('0x17')][_0x0976('0xe')](this));ami['on']('musiconholdstop',this[_0x0976('0x18')][_0x0976('0xe')](this));ami['on'](_0x0976('0x19'),this[_0x0976('0x1a')][_0x0976('0xe')](this));ami['on'](_0x0976('0x1b'),this[_0x0976('0x1c')][_0x0976('0xe')](this));}VoiceAgentReport['prototype']['emit']=function(_0x16524b,_0x54ac1a,_0x420d44){io['to'](_0x16524b)[_0x0976('0x1d')](_0x54ac1a,_0x420d44);};VoiceAgentReport[_0x0976('0x1e')]['isNotNull']=function(_0x68223b){return _0x68223b!==null&&!_['isUndefined'](_0x68223b);};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x1f')]=function(_0x59e9db){try{if(this[_0x0976('0x20')](_0x59e9db)){logger[_0x0976('0x21')](_0x0976('0x22'),_0x59e9db[_0x0976('0x23')],_0x59e9db[_0x0976('0x24')],_0x59e9db[_0x0976('0x25')]);logger[_0x0976('0x26')](_0x0976('0x27'),_0x59e9db['uniqueid'],util[_0x0976('0x28')](_0x59e9db,{'showHidden':![],'depth':null}));if(_[_0x0976('0x29')](this['channels'][_0x59e9db['uniqueid']])){this[_0x0976('0x8')][_0x59e9db[_0x0976('0x23')]]={};}var _0x1499bc=this[_0x0976('0xb')][_0x59e9db[_0x0976('0x2a')]];var _0x31af08=this[_0x0976('0x8')][_0x59e9db['uniqueid']][_0x59e9db[_0x0976('0x25')]];var _0x46bef6=this[_0x0976('0xa')][_0x59e9db[_0x0976('0x2b')]];var _0x36210e=this[_0x0976('0xc')][_0x59e9db[_0x0976('0x23')]];if(_['isUndefined'](_0x31af08)){_0x31af08={'agentcalledAt':moment()[_0x0976('0x2c')](_0x0976('0x2d')),'lastevent':_0x0976('0x2e'),'mandatoryDisposition':_0x46bef6&&_0x46bef6[_0x0976('0x2f')]?_0x46bef6[_0x0976('0x2f')]:![],'type':_0x46bef6&&_0x46bef6[_0x0976('0x30')]?_0x46bef6[_0x0976('0x30')]:_0x0976('0x31'),'variables':_0x36210e,'motionChannel':'voice'};}Object[_0x0976('0x32')](_0x31af08,_['omit'](_0x59e9db,[_0x0976('0x33'),_0x0976('0x34')]));this['channels'][_0x59e9db[_0x0976('0x23')]][_0x59e9db['destuniqueid']]=_0x31af08;logger[_0x0976('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x59e9db[_0x0976('0x23')],util['inspect'](_0x31af08,{'showHidden':![],'depth':null}));ami[_0x0976('0x1d')]('custom:agentcalled',_0x31af08);var _0x2d03b3={'id':_0x1499bc['id'],'calleridnum':_0x31af08[_0x0976('0x35')],'queue':_0x31af08[_0x0976('0x2b')],'variables':_0x31af08[_0x0976('0xc')],'uniqueid':_0x59e9db[_0x0976('0x23')]};logger[_0x0976('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x59e9db[_0x0976('0x23')],util[_0x0976('0x28')](_0x2d03b3,{'showHidden':![],'depth':null}));this[_0x0976('0x1d')](util[_0x0976('0x2c')](_0x0976('0x36'),_0x59e9db['membername']),_0x0976('0x37'),_0x2d03b3);}}catch(_0x11d779){logger[_0x0976('0x38')](_0x0976('0x39'),_0x59e9db[_0x0976('0x23')],util['inspect'](_0x11d779,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x10')]=function(_0x1af0f8){try{if(this['isNotNull'](_0x1af0f8)){if(this[_0x0976('0x8')][_0x1af0f8['uniqueid']]){for(var _0x4ec859 in this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]]){if(this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x0976('0x3a')](_0x4ec859)){if(_0x1af0f8['destuniqueid']===_0x4ec859){logger[_0x0976('0x21')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x1af0f8[_0x0976('0x23')],_0x1af0f8[_0x0976('0x24')],_0x1af0f8[_0x0976('0x25')]);this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x3b')]=moment()[_0x0976('0x2c')](_0x0976('0x2d'));this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x3c')]=_0x1af0f8['connectedlinename'];this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x3d')]=_0x1af0f8[_0x0976('0x3d')];this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x3e')]=_0x1af0f8[_0x0976('0x3e')];this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x3f')]=_0x1af0f8[_0x0976('0x3f')];this['channels'][_0x1af0f8[_0x0976('0x23')]][_0x4ec859]['holdtime']=_0x1af0f8[_0x0976('0x40')];this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x41')]=_0x0976('0x42');_['merge'](this['agents'][_0x1af0f8[_0x0976('0x2a')]],_[_0x0976('0x43')](_0x1af0f8,['queue',_0x0976('0x44')]));var _0x2f3957=this[_0x0976('0xb')][_0x1af0f8[_0x0976('0x2a')]];var _0xd945b4={'id':_0x2f3957['id'],'name':_0x2f3957['name'],'agentconnected':!![],'destaccountcode':_0x2f3957[_0x0976('0x45')],'destconnectedlinenum':this[_0x0976('0x8')][_0x1af0f8['uniqueid']][_0x1af0f8[_0x0976('0x25')]]['exten'],'queue':this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x1af0f8['destuniqueid']][_0x0976('0x2b')],'uniqueid':this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x1af0f8[_0x0976('0x25')]][_0x0976('0x23')]};ami['emit'](_0x0976('0x46'),this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x1af0f8[_0x0976('0x25')]]);this[_0x0976('0x1d')](util['format'](_0x0976('0x36'),_0x1af0f8[_0x0976('0x24')]),_0x0976('0x47'),_0xd945b4);}else if(!this['channels'][_0x1af0f8['uniqueid']][_0x4ec859]['agentringnoanswer']&&!this['channels'][_0x1af0f8['uniqueid']][_0x4ec859][_0x0976('0x13')]){logger[_0x0976('0x21')](_0x0976('0x48'),_0x1af0f8[_0x0976('0x23')],this[_0x0976('0x8')][_0x1af0f8['uniqueid']][_0x4ec859][_0x0976('0x24')],_0x4ec859);this['channels'][_0x1af0f8['uniqueid']][_0x4ec859][_0x0976('0x49')]=!![];this['channels'][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x4a')]=moment()[_0x0976('0x2c')](_0x0976('0x2d'));this['channels'][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x4b')]=_0x1af0f8[_0x0976('0x25')];this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859]['answeredelsewheremembername']=_0x1af0f8[_0x0976('0x24')];this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x41')]='answered_elsewhere';this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859][_0x0976('0x4c')]=_0x0976('0x4d');logger[_0x0976('0x26')](_0x0976('0x4e'),_0x1af0f8[_0x0976('0x23')],util['inspect'](this[_0x0976('0x8')][_0x1af0f8[_0x0976('0x23')]][_0x4ec859],{'showHidden':![],'depth':null}));ami[_0x0976('0x1d')](_0x0976('0x4f'),this['channels'][_0x1af0f8['uniqueid']][_0x4ec859]);}else{logger[_0x0976('0x26')](_0x0976('0x50'),_0x1af0f8[_0x0976('0x23')]);}}}}}}catch(_0x374482){logger['error'](_0x0976('0x51'),_0x1af0f8[_0x0976('0x23')],util[_0x0976('0x28')](_0x374482,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x52')]=function(_0x2edb52){try{if(this[_0x0976('0x20')](_0x2edb52)){logger['debug'](_0x0976('0x53'),_0x2edb52['uniqueid'],util[_0x0976('0x28')](_0x2edb52,{'showHidden':![],'depth':null}));if(this[_0x0976('0x8')][_0x2edb52[_0x0976('0x23')]]&&this[_0x0976('0x8')][_0x2edb52[_0x0976('0x23')]][_0x2edb52[_0x0976('0x25')]]){logger[_0x0976('0x21')](_0x0976('0x54'),_0x2edb52['uniqueid'],_0x2edb52[_0x0976('0x24')],_0x2edb52[_0x0976('0x25')]);var _0x39abce=this[_0x0976('0xb')][_0x2edb52['interface']];var _0x33a8ec=this[_0x0976('0x8')][_0x2edb52[_0x0976('0x23')]][_0x2edb52[_0x0976('0x25')]];_0x33a8ec[_0x0976('0x49')]=!![];_0x33a8ec['agentringnoanswerAt']=moment()[_0x0976('0x2c')](_0x0976('0x2d'));_0x33a8ec[_0x0976('0x41')]=_0x0976('0x55');_0x33a8ec[_0x0976('0x4c')]=_0x0976('0x55');var _0x3c8559={'id':_0x39abce['id'],'name':_0x39abce['name'],'queue':_0x33a8ec[_0x0976('0x2b')],'uniqueid':_0x33a8ec[_0x0976('0x23')]};logger[_0x0976('0x26')](_0x0976('0x56'),_0x2edb52['uniqueid'],util[_0x0976('0x28')](_0x3c8559,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x0976('0x36'),_0x39abce[_0x0976('0x57')]),_0x0976('0x58'),_0x3c8559);ami['emit'](_0x0976('0x59'),_0x33a8ec);this['channels'][_0x2edb52[_0x0976('0x23')]][_0x2edb52[_0x0976('0x25')]]=Object[_0x0976('0x32')]({},_0x33a8ec);}}}catch(_0x776d4b){logger[_0x0976('0x38')](_0x0976('0x5a'),_0x2edb52[_0x0976('0x23')],util['inspect'](_0x776d4b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x12')]=function(_0x91962a){try{if(this[_0x0976('0x20')](_0x91962a)){logger['debug'](_0x0976('0x5b'),_0x91962a['uniqueid'],util['inspect'](_0x91962a,{'showHidden':![],'depth':null}));if(this[_0x0976('0x8')][_0x91962a['uniqueid']]){for(var _0x56e6b1 in this[_0x0976('0x8')][_0x91962a['uniqueid']]){if(this[_0x0976('0x8')][_0x91962a['uniqueid']][_0x0976('0x3a')](_0x56e6b1)&&!this[_0x0976('0x8')][_0x91962a[_0x0976('0x23')]][_0x56e6b1][_0x0976('0x49')]&&!this[_0x0976('0x8')][_0x91962a[_0x0976('0x23')]][_0x56e6b1][_0x0976('0x13')]){logger[_0x0976('0x21')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x91962a[_0x0976('0x23')],this[_0x0976('0x8')][_0x91962a['uniqueid']][_0x56e6b1][_0x0976('0x24')],_0x56e6b1);this['channels'][_0x91962a[_0x0976('0x23')]][_0x56e6b1][_0x0976('0x49')]=!![];this['channels'][_0x91962a[_0x0976('0x23')]][_0x56e6b1]['agentringnoanswerAt']=moment()[_0x0976('0x2c')](_0x0976('0x2d'));this[_0x0976('0x8')][_0x91962a[_0x0976('0x23')]][_0x56e6b1][_0x0976('0x41')]='abandoned';this['channels'][_0x91962a[_0x0976('0x23')]][_0x56e6b1][_0x0976('0x4c')]=_0x0976('0x5c');logger[_0x0976('0x26')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x91962a['uniqueid'],util['inspect'](this[_0x0976('0x8')][_0x91962a['uniqueid']][_0x56e6b1],{'showHidden':![],'depth':null}));ami[_0x0976('0x1d')](_0x0976('0x5d'),this['channels'][_0x91962a[_0x0976('0x23')]][_0x56e6b1]);}}}}}catch(_0x1f0863){logger[_0x0976('0x38')](_0x0976('0x5e'),_0x91962a[_0x0976('0x23')],util[_0x0976('0x28')](_0x1f0863,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x14')]=function(_0x59af68){try{if(this[_0x0976('0x20')](_0x59af68)){logger['debug'](_0x0976('0x5f'),_0x59af68[_0x0976('0x23')],util[_0x0976('0x28')](_0x59af68,{'showHidden':![],'depth':null}));if(this[_0x0976('0x8')][_0x59af68['uniqueid']]){for(var _0x3d2a2f in this['channels'][_0x59af68[_0x0976('0x23')]]){if(this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x0976('0x3a')](_0x3d2a2f)){if(this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x3b')]&&!this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x13')]){logger[_0x0976('0x21')](_0x0976('0x60'),_0x59af68[_0x0976('0x23')],this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x24')],_0x3d2a2f);this[_0x0976('0x8')][_0x59af68['uniqueid']][_0x3d2a2f]['agentcomplete']=!![];this[_0x0976('0x8')][_0x59af68['uniqueid']][_0x3d2a2f][_0x0976('0x61')]=moment()[_0x0976('0x2c')](_0x0976('0x2d'));this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x41')]=_0x0976('0x62');this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x4c')]=_0x59af68[_0x0976('0x4c')]=='transfer'?'agent':_0x59af68[_0x0976('0x4c')];this['channels'][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x63')]=_0x59af68[_0x0976('0x63')];if(this['voiceQueues'][_0x59af68['queue']]&&this['voiceQueues'][_0x59af68[_0x0976('0x2b')]][_0x0976('0x64')]){this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f][_0x0976('0x65')]=this[_0x0976('0xa')][_0x59af68[_0x0976('0x2b')]]['acwTimeout'];this[_0x0976('0x8')][_0x59af68['uniqueid']][_0x3d2a2f]['agentacw']=!![];}this[_0x0976('0xb')][_0x59af68[_0x0976('0x2a')]]=_[_0x0976('0x66')](this[_0x0976('0xb')][_0x59af68[_0x0976('0x2a')]],[_0x0976('0x2b'),_0x0976('0x44')]);logger[_0x0976('0x26')](_0x0976('0x67'),_0x59af68[_0x0976('0x23')],util['inspect'](this['channels'][_0x59af68[_0x0976('0x23')]][_0x3d2a2f],{'showHidden':![],'depth':null}));ami[_0x0976('0x1d')]('custom:agentcomplete',this[_0x0976('0x8')][_0x59af68[_0x0976('0x23')]][_0x3d2a2f]);logger[_0x0976('0x26')](_0x0976('0x68'),_0x59af68[_0x0976('0x23')],util[_0x0976('0x28')]({'id':this['agents'][_0x59af68[_0x0976('0x2a')]]['id'],'destaccountcode':_0x59af68['destaccountcode']},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x0976('0x36'),_0x59af68[_0x0976('0x24')]),_0x0976('0x69'),{'id':this['agents'][_0x59af68[_0x0976('0x2a')]]['id'],'destaccountcode':Number(_0x59af68[_0x0976('0x6a')])});}}}}}}catch(_0x321e98){logger[_0x0976('0x38')](_0x0976('0x6b'),_0x59af68[_0x0976('0x23')],util[_0x0976('0x28')](_0x321e98,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')]['syncVarSet']=function(_0x16140f){try{if(this['isNotNull'](_0x16140f)){logger[_0x0976('0x26')]('[%s][voiceAgentReport][varset]\x20event:',_0x16140f['uniqueid'],util['inspect'](_0x16140f,{'showHidden':![],'depth':null}));this[_0x0976('0x6c')](_0x16140f[_0x0976('0x23')],_['keys'](_0x16140f['variable'])[0x0],_0x16140f['value']);if(this[_0x0976('0x8')][_0x16140f[_0x0976('0x23')]]){for(var _0x41a4f5 in this['channels'][_0x16140f[_0x0976('0x23')]]){if(this[_0x0976('0x8')][_0x16140f[_0x0976('0x23')]][_0x0976('0x3a')](_0x41a4f5)){logger[_0x0976('0x21')](_0x0976('0x6d'),_0x16140f[_0x0976('0x23')],_0x41a4f5,_[_0x0976('0x6e')](_0x16140f[_0x0976('0x6f')])[0x0],_0x16140f['value']);if(_['isUndefined'](this[_0x0976('0x8')][_0x16140f[_0x0976('0x23')]][_0x41a4f5][_0x0976('0xc')])){this['channels'][_0x16140f[_0x0976('0x23')]][_0x41a4f5][_0x0976('0xc')]={};}this['channels'][_0x16140f['uniqueid']][_0x41a4f5][_0x0976('0xc')]=this[_0x0976('0xc')][_0x16140f[_0x0976('0x23')]];}}}}}catch(_0x33619f){logger[_0x0976('0x38')](_0x0976('0x70'),_0x16140f[_0x0976('0x23')],util[_0x0976('0x28')](_0x33619f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0976('0x6c')]=function(_0x404166,_0x1d75c0,_0x3657dd){var _0x237220=[_0x0976('0x71'),_0x0976('0x72'),_0x0976('0x73'),_0x0976('0x74'),_0x0976('0x75'),_0x0976('0x76'),'rtpaudioqosrtt',_0x0976('0x77'),_0x0976('0x78'),'sipuri',_0x0976('0x79'),_0x0976('0x7a'),_0x0976('0x7b'),_0x0976('0x7c'),_0x0976('0x7d'),_0x0976('0x7e'),'membername','memberpenalty',_0x0976('0x7f')];if(!_[_0x0976('0x80')](_0x1d75c0)&&!_[_0x0976('0x81')](_0x237220,_0x1d75c0)){if(_['isUndefined'](this['variables'][_0x404166])){this[_0x0976('0xc')][_0x404166]={};}this['variables'][_0x404166][_0x1d75c0]=_0x3657dd;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x592fab){try{if(this[_0x0976('0x20')](_0x592fab)){logger[_0x0976('0x26')](_0x0976('0x82'),_0x592fab[_0x0976('0x23')],util[_0x0976('0x28')](_0x592fab,{'showHidden':![],'depth':null}));if(this[_0x0976('0x8')][_0x592fab[_0x0976('0x23')]]){for(var _0x2cb154 in this[_0x0976('0x8')][_0x592fab[_0x0976('0x23')]]){if(this[_0x0976('0x8')][_0x592fab[_0x0976('0x23')]][_0x0976('0x3a')](_0x2cb154)){if(this['channels'][_0x592fab[_0x0976('0x23')]][_0x2cb154][_0x0976('0x4c')]==_0x0976('0x83')&&this['channels'][_0x592fab[_0x0976('0x23')]][_0x2cb154][_0x0976('0x13')]){logger[_0x0976('0x21')](_0x0976('0x84'),_0x592fab[_0x0976('0x23')],_0x2cb154);this['channels'][_0x592fab['uniqueid']][_0x2cb154][_0x0976('0x61')]=moment()[_0x0976('0x2c')](_0x0976('0x2d'));}}}logger[_0x0976('0x26')](_0x0976('0x85'),_0x592fab[_0x0976('0x23')],util['inspect'](_[_0x0976('0x86')](this[_0x0976('0x8')][_0x592fab[_0x0976('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x0976('0x1d')]('custom:voiceAgentReport',_['values'](this['channels'][_0x592fab[_0x0976('0x23')]]));this['deleteChannelAfterTimeout'](_0x592fab[_0x0976('0x23')]);}if(this[_0x0976('0xc')][_0x592fab[_0x0976('0x23')]]){delete this['variables'][_0x592fab[_0x0976('0x23')]];}}}catch(_0x10102c){logger['error'](_0x0976('0x87'),_0x592fab[_0x0976('0x23')],util[_0x0976('0x28')](_0x10102c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0976('0x1a')]=function(_0x58e984){try{if(this[_0x0976('0x20')](_0x58e984)){logger[_0x0976('0x26')](_0x0976('0x88'),_0x58e984['uniqueid'],util[_0x0976('0x28')](_0x58e984,{'showHidden':![],'depth':null}));if(this[_0x0976('0x8')][_0x58e984['transfereeuniqueid']]){for(var _0x1c49ca in this[_0x0976('0x8')][_0x58e984[_0x0976('0x89')]]){if(this[_0x0976('0x8')][_0x58e984[_0x0976('0x89')]][_0x0976('0x3a')](_0x1c49ca)){if(_0x58e984[_0x0976('0x8a')]===_0x1c49ca){logger[_0x0976('0x21')](_0x0976('0x8b'),_0x58e984[_0x0976('0x23')],this[_0x0976('0x8')][_0x58e984[_0x0976('0x89')]][_0x1c49ca]['membername'],_0x1c49ca);var _0x3c55af=moment();this[_0x0976('0x8')][_0x58e984[_0x0976('0x89')]][_0x1c49ca]['agentcomplete']=!![];this[_0x0976('0x8')][_0x58e984[_0x0976('0x89')]][_0x1c49ca][_0x0976('0x61')]=moment()[_0x0976('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x58e984[_0x0976('0x89')]][_0x1c49ca][_0x0976('0x41')]=_0x0976('0x62');this['channels'][_0x58e984[_0x0976('0x89')]][_0x1c49ca][_0x0976('0x4c')]='transfer';this[_0x0976('0x8')][_0x58e984['transfereeuniqueid']][_0x1c49ca][_0x0976('0x63')]=_0x3c55af['diff'](this[_0x0976('0x8')][_0x58e984['transfereeuniqueid']][_0x1c49ca][_0x0976('0x3b')],_0x0976('0x8c'));}}}}if(this['channels'][_0x58e984[_0x0976('0x8d')]]){var _0x3e49de=this[_0x0976('0x8')][_0x58e984['secondtransfereruniqueid']];this[_0x0976('0x8')][_0x58e984[_0x0976('0x8d')]]=this[_0x0976('0x8')][_0x58e984[_0x0976('0x89')]];this['channels'][_0x58e984[_0x0976('0x89')]]=_0x3e49de;}}}catch(_0x314a47){logger[_0x0976('0x38')](_0x0976('0x8e'),_0x58e984[_0x0976('0x23')],util[_0x0976('0x28')](_0x314a47,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0976('0x1c')]=function(_0xf3ce2d){try{if(this[_0x0976('0x20')](_0xf3ce2d)){logger[_0x0976('0x26')](_0x0976('0x8f'),_0xf3ce2d['uniqueid'],util[_0x0976('0x28')](_0xf3ce2d,{'showHidden':![],'depth':null}));if(this[_0x0976('0x8')][_0xf3ce2d[_0x0976('0x89')]]){for(var _0x4efe6b in this['channels'][_0xf3ce2d[_0x0976('0x89')]]){if(this[_0x0976('0x8')][_0xf3ce2d[_0x0976('0x89')]][_0x0976('0x3a')](_0x4efe6b)){if(_0xf3ce2d[_0x0976('0x90')]===_0x4efe6b){logger[_0x0976('0x21')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xf3ce2d[_0x0976('0x23')],this[_0x0976('0x8')][_0xf3ce2d[_0x0976('0x89')]][_0x4efe6b][_0x0976('0x24')],_0x4efe6b);var _0x3b3f5e=moment();this[_0x0976('0x8')][_0xf3ce2d[_0x0976('0x89')]][_0x4efe6b]['agentcomplete']=!![];this[_0x0976('0x8')][_0xf3ce2d[_0x0976('0x89')]][_0x4efe6b][_0x0976('0x61')]=_0x3b3f5e;this['channels'][_0xf3ce2d[_0x0976('0x89')]][_0x4efe6b]['lastevent']=_0x0976('0x62');this['channels'][_0xf3ce2d['transfereeuniqueid']][_0x4efe6b][_0x0976('0x4c')]=_0x0976('0x83');this[_0x0976('0x8')][_0xf3ce2d['transfereeuniqueid']][_0x4efe6b][_0x0976('0x63')]=_0x3b3f5e['diff'](this[_0x0976('0x8')][_0xf3ce2d[_0x0976('0x89')]][_0x4efe6b]['agentconnectAt'],'seconds');}}}}}}catch(_0xbf04ca){logger[_0x0976('0x38')](_0x0976('0x91'),_0xf3ce2d[_0x0976('0x23')],util['inspect'](_0xbf04ca,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x17')]=function(_0x286f09){var _0x1048d7='';try{if(this[_0x0976('0x20')](_0x286f09)){logger[_0x0976('0x26')](_0x0976('0x92'),_0x286f09[_0x0976('0x23')],util[_0x0976('0x28')](_0x286f09,{'showHidden':![],'depth':null}));if(_0x286f09['channel']){_0x1048d7=_0x286f09[_0x0976('0x93')]['substring'](0x0,_0x286f09[_0x0976('0x93')][_0x0976('0x94')]('-'));if(this['agents'][_0x1048d7]){logger[_0x0976('0x21')](_0x0976('0x95'),_0x286f09['uniqueid'],_0x1048d7);this['agents'][_0x1048d7][_0x0976('0x96')]=!![];}}}}catch(_0x281ec7){logger[_0x0976('0x38')](_0x0976('0x97'),_0x286f09[_0x0976('0x23')],util['inspect'](_0x281ec7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0976('0x1e')][_0x0976('0x18')]=function(_0xb977b4){var _0x644b1c='';try{if(this[_0x0976('0x20')](_0xb977b4)){logger[_0x0976('0x26')](_0x0976('0x98'),_0xb977b4[_0x0976('0x23')],util[_0x0976('0x28')](_0xb977b4,{'showHidden':![],'depth':null}));if(_0xb977b4[_0x0976('0x93')]){_0x644b1c=_0xb977b4['channel']['substring'](0x0,_0xb977b4[_0x0976('0x93')][_0x0976('0x94')]('-'));if(this['agents'][_0x644b1c]){logger['info'](_0x0976('0x99'),_0xb977b4[_0x0976('0x23')],_0x644b1c);this['agents'][_0x644b1c][_0x0976('0x96')]=![];}}}}catch(_0x58b856){logger[_0x0976('0x38')](_0x0976('0x9a'),_0xb977b4['uniqueid'],util['inspect'](_0x58b856,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0976('0x9b')]=function(_0x49f8e3,_0x54bf7c=0x2710){if(this[_0x0976('0x8')][_0x49f8e3]){setTimeout(()=>{delete this['channels'][_0x49f8e3];},_0x54bf7c);}};module[_0x0976('0x9c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 7201f8b..84bdd27 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd017=['[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','syncMixMonitorFilename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','answertime','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','transferType','then','isEmpty','getSettings','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','routeid','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','prototype','isUndefined','emit','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','pick','keys','from-sip','split','exten','xcally-motion-preview','user:agentconnect','connectedlinenum','[%s][voiceCallReport][newcallerid]','syncNewChannel','debug','channel','OutgoingSpoolFailed','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','merge','destconnectedlinenum','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','type','isNil','[%s][voiceCallReport][newexten]','calleridname','answered','diff','connectedlinename','UserId','membername','holdtime','destinationchannel','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','monitor','endsWith','.wav49','.WAV','monitorFilename','monitors','rec'];(function(_0x31cc8f,_0x69866b){var _0x2169d8=function(_0x139948){while(--_0x139948){_0x31cc8f['push'](_0x31cc8f['shift']());}};_0x2169d8(++_0x69866b);}(_0xd017,0x116));var _0x7d01=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xd017[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x7d01('0x0'));var moment=require(_0x7d01('0x1'));var util=require(_0x7d01('0x2'));var path=require(_0x7d01('0x3'));var Redis=require(_0x7d01('0x4'));var config=require(_0x7d01('0x5'));var logger=require('../../../config/logger')(_0x7d01('0x6'));var ami=require('../ami');var Channel=require(_0x7d01('0x7'));var RpcSetting=require(_0x7d01('0x8'));var applications=[_0x7d01('0x9'),_0x7d01('0xa'),_0x7d01('0xb'),_0x7d01('0xc'),_0x7d01('0xd'),_0x7d01('0xe')];var dispositions=[_0x7d01('0xf'),_0x7d01('0x10'),_0x7d01('0x10'),_0x7d01('0xf'),'NO\x20ANSWER',_0x7d01('0xf'),_0x7d01('0x11'),'BUSY',_0x7d01('0x10'),_0x7d01('0x10'),_0x7d01('0x10')];config['redis']=_['defaults'](config[_0x7d01('0x12')],{'host':_0x7d01('0x13'),'port':0x18eb});var io=require(_0x7d01('0x14'))(new Redis(config[_0x7d01('0x12')]));function VoiceCallReport(_0x33e55e){this['channels']=_0x33e55e[_0x7d01('0x15')];this[_0x7d01('0x16')]=_0x33e55e[_0x7d01('0x16')];this[_0x7d01('0x17')]={};ami['on'](_0x7d01('0x18'),this[_0x7d01('0x19')][_0x7d01('0x1a')](this));ami['on'](_0x7d01('0x1b'),this[_0x7d01('0x19')]['bind'](this));ami['on'](_0x7d01('0x1c'),this['syncNewChannel']['bind'](this));ami['on'](_0x7d01('0x1d'),this[_0x7d01('0x1e')][_0x7d01('0x1a')](this));ami['on'](_0x7d01('0x1f'),this[_0x7d01('0x20')][_0x7d01('0x1a')](this));ami['on']('hangup',this[_0x7d01('0x21')]['bind'](this));ami['on'](_0x7d01('0x22'),this['syncNewCallerId'][_0x7d01('0x1a')](this));ami['on'](_0x7d01('0x23'),this[_0x7d01('0x24')][_0x7d01('0x1a')](this));ami['on'](_0x7d01('0x25'),this[_0x7d01('0x26')]['bind'](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0x7d01('0x1a')](this));ami['on'](_0x7d01('0x27'),this[_0x7d01('0x28')]['bind'](this));try{logger[_0x7d01('0x29')](_0x7d01('0x2a'));ami['actionCoreShowChannels']();}catch(_0x31da75){logger[_0x7d01('0x2b')](_0x7d01('0x2c'),util['inspect'](_0x31da75,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x7d01('0x2d')]['isNotNull']=function(_0x3ac8e0){return _0x3ac8e0!==null&&!_[_0x7d01('0x2e')](_0x3ac8e0);};VoiceCallReport[_0x7d01('0x2d')][_0x7d01('0x2f')]=function(_0x3d8a8e,_0x450a76,_0x4cab14){io['to'](_0x3d8a8e)[_0x7d01('0x2f')](_0x450a76,_0x4cab14);};VoiceCallReport[_0x7d01('0x2d')][_0x7d01('0x30')]=function(_0x22630c){try{if(this[_0x7d01('0x31')](_0x22630c)){logger[_0x7d01('0x29')](_0x7d01('0x32'),_0x22630c[_0x7d01('0x33')],_0x22630c['calleridname'],_0x22630c[_0x7d01('0x34')]);logger['debug'](_0x7d01('0x35'),_0x22630c[_0x7d01('0x33')],util[_0x7d01('0x36')](_0x22630c,{'showHidden':![],'depth':null}));if(_0x22630c[_0x7d01('0x33')]===_0x22630c[_0x7d01('0x37')]){if(!_[_0x7d01('0x2e')](this[_0x7d01('0x15')][_0x22630c[_0x7d01('0x33')]])){_['merge'](this[_0x7d01('0x15')][_0x22630c[_0x7d01('0x33')]],_[_0x7d01('0x38')](_0x22630c,_[_0x7d01('0x39')](this[_0x7d01('0x15')][_0x22630c[_0x7d01('0x33')]])));}}if(_0x22630c['context']===_0x7d01('0x3a')){var _0x53689f=this[_0x7d01('0x16')][_0x22630c['channel'][_0x7d01('0x3b')]('-')[0x0]];if(_0x53689f){if(_0x22630c[_0x7d01('0x3c')]==_0x7d01('0x3d')){_0x53689f['destconnectedlinenum']=_0x22630c['connectedlinenum'];this['emit'](util['format']('user:%s',_0x53689f['name']),_0x7d01('0x3e'),{'id':_0x53689f['id'],'destaccountcode':_0x53689f['accountcode'],'destconnectedlinenum':_0x22630c[_0x7d01('0x3f')]});}}}}}catch(_0x333a02){logger[_0x7d01('0x2b')](_0x7d01('0x40'),_0x22630c[_0x7d01('0x33')],util[_0x7d01('0x36')](_0x333a02,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d01('0x2d')][_0x7d01('0x41')]=function(_0x3fa9a3){try{if(this['isNotNull'](_0x3fa9a3)){logger[_0x7d01('0x42')]('[%s][voiceCallReport][newchannel]\x20event:',_0x3fa9a3[_0x7d01('0x33')],util[_0x7d01('0x36')](_0x3fa9a3,{'showHidden':![],'depth':null}));if(this[_0x7d01('0x15')][_0x3fa9a3[_0x7d01('0x33')]]){return;}if(_0x3fa9a3[_0x7d01('0x43')]===_0x7d01('0x44')){return;}if(_0x3fa9a3[_0x7d01('0x33')]!==_0x3fa9a3[_0x7d01('0x37')]&&!this['blindTransfers'][_0x3fa9a3['linkedid']]){return;}logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3fa9a3[_0x7d01('0x33')],_0x3fa9a3[_0x7d01('0x45')],_0x3fa9a3[_0x7d01('0x3c')]);this[_0x7d01('0x15')][_0x3fa9a3[_0x7d01('0x33')]]=new Channel();this[_0x7d01('0x15')][_0x3fa9a3[_0x7d01('0x33')]][_0x7d01('0x46')]=moment()[_0x7d01('0x47')](_0x7d01('0x48'));this[_0x7d01('0x15')][_0x3fa9a3[_0x7d01('0x33')]]['disposition']=dispositions[_[_0x7d01('0x49')](_0x3fa9a3[_0x7d01('0x4a')])];_[_0x7d01('0x4b')](this['channels'][_0x3fa9a3[_0x7d01('0x33')]],_['pick'](_0x3fa9a3,_['keys'](this['channels'][_0x3fa9a3[_0x7d01('0x33')]])));if(_0x3fa9a3[_0x7d01('0x45')]===_0x7d01('0x3a')){var _0x212702=this['agents'][_0x3fa9a3['channel']['split']('-')[0x0]];if(_0x212702&&typeof _0x212702[_0x7d01('0x4c')]===_0x7d01('0x4d')){_0x212702[_0x7d01('0x4c')]=_0x3fa9a3[_0x7d01('0x3c')];logger[_0x7d01('0x42')](_0x7d01('0x4e'),_0x3fa9a3[_0x7d01('0x33')],util[_0x7d01('0x36')]({'id':_0x212702['id'],'destaccountcode':_0x212702[_0x7d01('0x4f')],'destconnectedlinenum':_0x3fa9a3['exten']},{'showHidden':![],'depth':null}));this[_0x7d01('0x2f')](util[_0x7d01('0x47')](_0x7d01('0x50'),_0x212702[_0x7d01('0x51')]),'user:agentconnect',{'id':_0x212702['id'],'destaccountcode':_0x212702[_0x7d01('0x4f')],'destconnectedlinenum':_0x3fa9a3[_0x7d01('0x3c')]});}}}}catch(_0x53a796){logger[_0x7d01('0x2b')](_0x7d01('0x52'),_0x3fa9a3[_0x7d01('0x33')],util['inspect'](_0x53a796,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7d01('0x19')]=function(_0xceada7){try{if(this[_0x7d01('0x31')](_0xceada7)){logger[_0x7d01('0x42')](_0x7d01('0x53'),_0xceada7[_0x7d01('0x33')],util[_0x7d01('0x36')](_0xceada7,{'showHidden':![],'depth':null}));if(_0xceada7['channel']===_0x7d01('0x44')||_0xceada7[_0x7d01('0x3c')]==='h')return;if(_0xceada7[_0x7d01('0x33')]===_0xceada7[_0x7d01('0x37')]||this['blindTransfers'][_0xceada7[_0x7d01('0x37')]]){_0xceada7['application']=_0xceada7[_0x7d01('0x54')]?_0xceada7[_0x7d01('0x54')][_0x7d01('0x55')]():undefined;_0xceada7[_0x7d01('0x56')]=_0xceada7[_0x7d01('0x57')]||_0xceada7[_0x7d01('0x56')];if(_0xceada7[_0x7d01('0x57')]&&_0xceada7[_0x7d01('0x54')]!==_0x7d01('0xa')){_0xceada7[_0x7d01('0x56')]=_0xceada7[_0x7d01('0x56')][_0x7d01('0x55')]();}logger[_0x7d01('0x29')](_0x7d01('0x58'),_0xceada7[_0x7d01('0x33')],_0xceada7[_0x7d01('0x54')],_0xceada7[_0x7d01('0x56')]);if(_[_0x7d01('0x2e')](this[_0x7d01('0x15')][_0xceada7[_0x7d01('0x33')]])){this[_0x7d01('0x15')][_0xceada7['uniqueid']]=new Channel();this[_0x7d01('0x15')][_0xceada7[_0x7d01('0x33')]][_0x7d01('0x46')]=_0xceada7[_0x7d01('0x59')]?moment()['subtract'](moment[_0x7d01('0x59')](_0xceada7['duration'])[_0x7d01('0x5a')](),'seconds')[_0x7d01('0x47')](_0x7d01('0x48')):moment()[_0x7d01('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7d01('0x15')][_0xceada7[_0x7d01('0x33')]][_0x7d01('0x5b')]='NO\x20ANSWER';}_['merge'](this[_0x7d01('0x15')][_0xceada7[_0x7d01('0x33')]],_[_0x7d01('0x38')](_0xceada7,_[_0x7d01('0x39')](this[_0x7d01('0x15')][_0xceada7[_0x7d01('0x33')]])));if(_[_0x7d01('0x5c')](applications,_0xceada7['application'])){this['channels'][_0xceada7[_0x7d01('0x33')]][_0x7d01('0x5d')]=_0xceada7[_0x7d01('0x54')];this['channels'][_0xceada7['uniqueid']][_0x7d01('0x5e')]=_0xceada7[_0x7d01('0x56')];if(_0xceada7[_0x7d01('0x54')]===_0x7d01('0x9')&&_[_0x7d01('0x5f')](_0xceada7[_0x7d01('0x56')][_0x7d01('0x55')](),_0x7d01('0x60'))){var _0x5cceaf=_0xceada7[_0x7d01('0x56')][_0x7d01('0x3b')]('=');var _0x9ba7a5=_0x5cceaf[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x9ba7a5){if(_0x9ba7a5[0x1]===_0x7d01('0x61')&&!_[_0x7d01('0x62')](this['channels'][_0xceada7[_0x7d01('0x33')]][_0x9ba7a5[0x1]]))return;this[_0x7d01('0x15')][_0xceada7[_0x7d01('0x33')]][_0x9ba7a5[0x1]]=_0x5cceaf[0x1];}}else if(_0xceada7[_0x7d01('0x54')]===_0x7d01('0xa')){this[_0x7d01('0x15')][_0xceada7['uniqueid']]['queue']=_0xceada7[_0x7d01('0x56')][_0x7d01('0x3b')](',')[0x0];}}}}}catch(_0x25f818){logger[_0x7d01('0x2b')](_0x7d01('0x63'),_0xceada7[_0x7d01('0x33')],util[_0x7d01('0x36')](_0x25f818,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d01('0x2d')][_0x7d01('0x1e')]=function(_0x3cae3c){try{if(this['isNotNull'](_0x3cae3c)){logger[_0x7d01('0x29')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x3cae3c[_0x7d01('0x33')],_0x3cae3c[_0x7d01('0x37')],_0x3cae3c[_0x7d01('0x64')],_0x3cae3c[_0x7d01('0x34')]);logger[_0x7d01('0x42')]('[%s][voiceCallReport][newstate]\x20event:',_0x3cae3c[_0x7d01('0x33')],util['inspect'](_0x3cae3c,{'showHidden':![],'depth':null}));if(_0x3cae3c[_0x7d01('0x4a')]!=='6')return;var _0x470a4c=this[_0x7d01('0x16')][_0x3cae3c[_0x7d01('0x43')][_0x7d01('0x3b')]('-')[0x0]];if(_0x3cae3c[_0x7d01('0x33')]!==_0x3cae3c['linkedid']){var _0x2dbbe9=moment();if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]]){if(!this['channels'][_0x3cae3c[_0x7d01('0x37')]][_0x7d01('0x65')]){this['channels'][_0x3cae3c[_0x7d01('0x37')]][_0x7d01('0x65')]=!![];this[_0x7d01('0x15')][_0x3cae3c['linkedid']]['answertime']=_0x2dbbe9[_0x7d01('0x47')](_0x7d01('0x48'));if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]][_0x7d01('0x46')]){this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]]['holdtime']=_0x2dbbe9[_0x7d01('0x66')](this['channels'][_0x3cae3c[_0x7d01('0x37')]]['starttime'],_0x7d01('0x5a'));}}this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]][_0x7d01('0x37')]=_0x3cae3c['uniqueid'];if(_0x3cae3c[_0x7d01('0x34')]!==_0x7d01('0x3d')){this['channels'][_0x3cae3c[_0x7d01('0x37')]]['connectedlinenum']=_0x3cae3c[_0x7d01('0x34')];}this[_0x7d01('0x15')][_0x3cae3c['linkedid']][_0x7d01('0x67')]=_0x3cae3c['calleridname'];this['channels'][_0x3cae3c[_0x7d01('0x37')]]['destinationchannel']=_0x3cae3c[_0x7d01('0x43')];this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]]['disposition']=dispositions[_[_0x7d01('0x49')](_0x3cae3c[_0x7d01('0x4a')])];if(_0x470a4c){this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]][_0x7d01('0x68')]=_0x470a4c['id'];this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]][_0x7d01('0x69')]=_0x470a4c['name'];}}if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]){if(!this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]['answered']){this['channels'][_0x3cae3c['uniqueid']][_0x7d01('0x65')]=!![];this[_0x7d01('0x15')][_0x3cae3c['uniqueid']]['answertime']=_0x2dbbe9['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]['starttime']){this[_0x7d01('0x15')][_0x3cae3c['uniqueid']][_0x7d01('0x6a')]=_0x2dbbe9[_0x7d01('0x66')](this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]['starttime'],_0x7d01('0x5a'));}}if(_0x3cae3c['calleridnum']!==_0x7d01('0x3d')){this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]['connectedlinenum']=_0x3cae3c[_0x7d01('0x34')];}this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]['connectedlinename']=_0x3cae3c['calleridname'];this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]][_0x7d01('0x6b')]=_0x3cae3c['channel'];this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]][_0x7d01('0x5b')]=dispositions[_[_0x7d01('0x49')](_0x3cae3c[_0x7d01('0x4a')])];}}else{if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]){if(_0x470a4c){this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]['UserId']=_0x470a4c['id'];this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]][_0x7d01('0x69')]=_0x470a4c[_0x7d01('0x51')];}}}if(_0x3cae3c[_0x7d01('0x45')]===_0x7d01('0x3a')){if(_0x470a4c){_0x470a4c[_0x7d01('0x4c')]=_0x3cae3c[_0x7d01('0x3c')];var _0x263267;if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]]){_0x263267=this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x33')]][_0x7d01('0xa')];}else if(this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]]){_0x263267=this[_0x7d01('0x15')][_0x3cae3c[_0x7d01('0x37')]]['queue'];}_0x470a4c[_0x7d01('0xa')]=_0x263267;var _0x248733={'id':_0x470a4c['id'],'name':_0x470a4c[_0x7d01('0x51')],'agentconnected':!![],'destaccountcode':_0x470a4c[_0x7d01('0x4f')],'destconnectedlinenum':_0x3cae3c[_0x7d01('0x3c')],'queue':_0x263267||undefined,'uniqueid':_0x3cae3c[_0x7d01('0x37')]};logger[_0x7d01('0x42')](_0x7d01('0x6c'),_0x3cae3c[_0x7d01('0x33')],util[_0x7d01('0x36')](_0x248733,{'showHidden':![],'depth':null}));this[_0x7d01('0x2f')](util[_0x7d01('0x47')](_0x7d01('0x50'),_0x470a4c[_0x7d01('0x51')]),'user:agentconnect',_0x248733);}}}}catch(_0x5de082){logger[_0x7d01('0x2b')]('[%s][voiceCallReport][newstate]',_0x3cae3c['uniqueid'],util[_0x7d01('0x36')](_0x5de082,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d01('0x2d')]['syncMixMonitorFilename']=function(_0x485e71,_0x646f33){try{if(this['channels'][_0x485e71]){logger[_0x7d01('0x29')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x485e71,_0x646f33);this[_0x7d01('0x15')][_0x485e71][_0x7d01('0x6d')]=!![];if(_[_0x7d01('0x6e')](_0x646f33,_0x7d01('0x6f'))){_0x646f33=_0x646f33['replace'](_0x7d01('0x6f'),_0x7d01('0x70'));}this[_0x7d01('0x15')][_0x485e71][_0x7d01('0x71')]=_0x646f33;var _0x542031=_['find'](this['channels'][_0x485e71]['monitors'],{'filename':_0x646f33});if(_['isNil'](_0x542031)){this['channels'][_0x485e71][_0x7d01('0x72')]['push']({'filename':_0x646f33,'createdAt':moment()[_0x7d01('0x47')](_0x7d01('0x48')),'mixmonitorid':'','status':_0x7d01('0x73')});}}}catch(_0x339ed4){logger['error'](_0x7d01('0x74'),_0x485e71,util[_0x7d01('0x36')](_0x339ed4,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d01('0x2d')][_0x7d01('0x20')]=function(_0x43deac){try{if(this[_0x7d01('0x31')](_0x43deac)){logger[_0x7d01('0x42')]('[%s][voiceCallReport][varset]\x20event:',_0x43deac[_0x7d01('0x33')],util['inspect'](_0x43deac,{'showHidden':![],'depth':null}));if(this[_0x7d01('0x15')][_0x43deac[_0x7d01('0x33')]]&&_0x43deac[_0x7d01('0x43')]!='OutgoingSpoolFailed'){if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')])){if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')][_0x7d01('0x76')])){logger[_0x7d01('0x29')](_0x7d01('0x77'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);this['syncMixMonitorFilename'](_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);}else if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')]['xmd-phone'])){logger[_0x7d01('0x29')](_0x7d01('0x79'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);this[_0x7d01('0x15')][_0x43deac[_0x7d01('0x33')]]['calleridnum']=_0x43deac[_0x7d01('0x78')];}else if(this[_0x7d01('0x31')](_0x43deac['variable']['xmd-callerid'])){logger['info'](_0x7d01('0x7a'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);this[_0x7d01('0x15')][_0x43deac[_0x7d01('0x33')]][_0x7d01('0x7b')]=_0x43deac[_0x7d01('0x78')];}else if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')][_0x7d01('0x7c')])){logger[_0x7d01('0x29')](_0x7d01('0x7d'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);this[_0x7d01('0x15')][_0x43deac['uniqueid']]['type']=_0x43deac[_0x7d01('0x78')];}else if(this['isNotNull'](_0x43deac['variable']['xmd-queue'])){logger[_0x7d01('0x29')](_0x7d01('0x7e'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')][_0x7d01('0x3b')](',')[0x0]);this[_0x7d01('0x15')][_0x43deac['uniqueid']][_0x7d01('0xa')]=_0x43deac['value'][_0x7d01('0x3b')](',')[0x0];}else if(this[_0x7d01('0x31')](_0x43deac['variable'][_0x7d01('0x7f')])){logger[_0x7d01('0x29')](_0x7d01('0x80'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);this['channels'][_0x43deac[_0x7d01('0x33')]]['originatecalleridnum']=_0x43deac[_0x7d01('0x78')];}else if(this['isNotNull'](_0x43deac[_0x7d01('0x75')][_0x7d01('0x81')])){logger[_0x7d01('0x29')](_0x7d01('0x82'),_0x43deac[_0x7d01('0x33')],_0x43deac['value']);this[_0x7d01('0x15')][_0x43deac['uniqueid']][_0x7d01('0x83')]=_0x43deac[_0x7d01('0x78')];}else if(this['isNotNull'](_0x43deac[_0x7d01('0x75')][_0x7d01('0x84')])){logger[_0x7d01('0x29')](_0x7d01('0x85'),_0x43deac[_0x7d01('0x33')],_0x43deac[_0x7d01('0x78')]);this['channels'][_0x43deac[_0x7d01('0x33')]]['calleridpreview']=_0x43deac[_0x7d01('0x78')];}else if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')][_0x7d01('0x86')])){logger['info'](_0x7d01('0x87'),_0x43deac[_0x7d01('0x33')],_0x43deac['value']);this[_0x7d01('0x15')][_0x43deac[_0x7d01('0x33')]][_0x7d01('0xa')]=_0x43deac['value'];}else if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')][_0x7d01('0x88')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x43deac[_0x7d01('0x33')],_0x43deac['value']);this['channels'][_0x43deac[_0x7d01('0x33')]][_0x7d01('0x89')]=_0x43deac[_0x7d01('0x78')];}}}else if(this[_0x7d01('0x31')](_0x43deac['variable'][_0x7d01('0x76')])){if(_0x43deac['value']){var _0x5cf05d=path[_0x7d01('0x8a')](_0x43deac['value'])[_0x7d01('0x51')];logger[_0x7d01('0x29')](_0x7d01('0x77'),_0x5cf05d,_0x43deac['value']);this[_0x7d01('0x8b')](_0x5cf05d,_0x43deac[_0x7d01('0x78')]);}}else if(this[_0x7d01('0x15')][_0x43deac[_0x7d01('0x37')]]){if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')])){if(this[_0x7d01('0x31')](_0x43deac[_0x7d01('0x75')][_0x7d01('0x88')])){logger[_0x7d01('0x29')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x43deac[_0x7d01('0x37')],_0x43deac[_0x7d01('0x78')]);this[_0x7d01('0x15')][_0x43deac[_0x7d01('0x37')]][_0x7d01('0x8c')]=_0x43deac['value'];}}}}}catch(_0x27a6c1){logger[_0x7d01('0x2b')](_0x7d01('0x8d'),_0x43deac['uniqueid'],util[_0x7d01('0x36')](_0x27a6c1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7d01('0x2d')]['syncHangup']=function(_0x5ebaf4){try{if(this[_0x7d01('0x31')](_0x5ebaf4)){logger[_0x7d01('0x42')](_0x7d01('0x8e'),_0x5ebaf4[_0x7d01('0x33')],util[_0x7d01('0x36')](_0x5ebaf4,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x5ebaf4['linkedid']]){if(this[_0x7d01('0x15')][this['blindTransfers'][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x37')]]){this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]]['linkedid']]['uniqueid']=_0x5ebaf4[_0x7d01('0x33')];this[_0x7d01('0x15')][this['blindTransfers'][_0x5ebaf4[_0x7d01('0x37')]]['linkedid']][_0x7d01('0x65')]=this['channels'][_0x5ebaf4['uniqueid']]['answered'];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4['linkedid']][_0x7d01('0x37')]][_0x7d01('0x8f')]=this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x8f')];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]]['linkedid']][_0x7d01('0x6b')]=this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x37')]][_0x7d01('0x43')];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4['linkedid']][_0x7d01('0x37')]]['disposition']=this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x5b')];this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]]=this[_0x7d01('0x15')][this['blindTransfers'][_0x5ebaf4[_0x7d01('0x37')]]['linkedid']];this[_0x7d01('0x90')](this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x37')]);}else if(this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4['linkedid']]['uniqueid']]){this[_0x7d01('0x15')][this['blindTransfers'][_0x5ebaf4['linkedid']][_0x7d01('0x33')]][_0x7d01('0x33')]=[this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x33')]][_0x7d01('0x37')],this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x33')]][_0x7d01('0x37')]=this[_0x7d01('0x15')][this['blindTransfers'][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x33')]][_0x7d01('0x33')]][0x0];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x33')]]['answered']=this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x65')];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4['linkedid']][_0x7d01('0x33')]]['answertime']=this['channels'][_0x5ebaf4['uniqueid']][_0x7d01('0x8f')];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4['linkedid']][_0x7d01('0x33')]][_0x7d01('0x6b')]=this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x33')]][_0x7d01('0x43')];this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]][_0x7d01('0x33')]][_0x7d01('0x5b')]=this['channels'][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x5b')];this['channels'][_0x5ebaf4[_0x7d01('0x33')]]=this[_0x7d01('0x15')][this[_0x7d01('0x17')][_0x5ebaf4[_0x7d01('0x37')]]['uniqueid']];this[_0x7d01('0x90')](this[_0x7d01('0x17')][_0x5ebaf4['linkedid']][_0x7d01('0x33')]);}}if(this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]]){logger[_0x7d01('0x29')](_0x7d01('0x91'),_0x5ebaf4[_0x7d01('0x33')],_0x5ebaf4[_0x7d01('0x92')]);var _0x5b795c=moment();this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x93')]=_0x5b795c[_0x7d01('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x59')]=_0x5b795c[_0x7d01('0x66')](this[_0x7d01('0x15')][_0x5ebaf4['uniqueid']]['starttime'],_0x7d01('0x5a'));if(this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]]['answered']){this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x94')]=_0x5b795c[_0x7d01('0x66')](this[_0x7d01('0x15')][_0x5ebaf4[_0x7d01('0x33')]]['answertime'],_0x7d01('0x5a'));this[_0x7d01('0x15')][_0x5ebaf4['uniqueid']][_0x7d01('0x6a')]=this[_0x7d01('0x15')][_0x5ebaf4['uniqueid']][_0x7d01('0x59')]-this['channels'][_0x5ebaf4[_0x7d01('0x33')]][_0x7d01('0x94')];}if(_0x5ebaf4['context']===_0x7d01('0x3a')){if(this['agents'][_0x5ebaf4['channel'][_0x7d01('0x3b')]('-')[0x0]]){this[_0x7d01('0x16')][_0x5ebaf4[_0x7d01('0x43')][_0x7d01('0x3b')]('-')[0x0]]=_[_0x7d01('0x95')](this[_0x7d01('0x16')][_0x5ebaf4[_0x7d01('0x43')]['split']('-')[0x0]],[_0x7d01('0x4c')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x5ebaf4[_0x7d01('0x33')],util['inspect']({'id':this['agents'][_0x5ebaf4['channel'][_0x7d01('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x7d01('0x16')][_0x5ebaf4[_0x7d01('0x43')]['split']('-')[0x0]][_0x7d01('0x4f')]},{'showHidden':![],'depth':null}));this[_0x7d01('0x2f')](util[_0x7d01('0x47')](_0x7d01('0x50'),this[_0x7d01('0x16')][_0x5ebaf4[_0x7d01('0x43')][_0x7d01('0x3b')]('-')[0x0]][_0x7d01('0x51')]),_0x7d01('0x96'),{'id':this[_0x7d01('0x16')][_0x5ebaf4['channel'][_0x7d01('0x3b')]('-')[0x0]]['id'],'destaccountcode':this[_0x7d01('0x16')][_0x5ebaf4[_0x7d01('0x43')][_0x7d01('0x3b')]('-')[0x0]][_0x7d01('0x4f')]});for(var _0x1048ed=0x0;_0x1048ed{delete this['channels'][_0x2ff2cd];},_0x3c8ca4);}};module[_0x7d01('0xc4')]=VoiceCallReport; \ No newline at end of file +var _0x4303=['syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','agi','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','syncVarSet','syncHangup','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','uniqueid','linkedid','channels','merge','pick','keys','context','from-sip','channel','exten','xcally-motion-preview','destconnectedlinenum','format','user:%s','name','user:agentconnect','connectedlinenum','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','split','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','appdata','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','disposition','includes','lastapplication','set','startsWith','cdr(','type','isNil','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','answertime','holdtime','diff','seconds','connectedlinename','destinationchannel','UserId','membername','queue','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','length','transferType','then','transferToInternal','isEmpty','stopRecordingOnTransfer','resolve','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0x4303,0x18e));var _0x3430=function(_0x54e628,_0xd5c97d){_0x54e628=_0x54e628-0x0;var _0x23f6f5=_0x4303[_0x54e628];return _0x23f6f5;};'use strict';var _=require(_0x3430('0x0'));var moment=require(_0x3430('0x1'));var util=require(_0x3430('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x3430('0x3'));var logger=require(_0x3430('0x4'))(_0x3430('0x5'));var ami=require('../ami');var Channel=require(_0x3430('0x6'));var RpcSetting=require(_0x3430('0x7'));var applications=['set','queue',_0x3430('0x8'),'dial',_0x3430('0x9'),_0x3430('0xa')];var dispositions=['NO\x20ANSWER',_0x3430('0xb'),'FAILED',_0x3430('0xc'),_0x3430('0xc'),_0x3430('0xc'),_0x3430('0xd'),_0x3430('0xe'),'FAILED',_0x3430('0xb'),_0x3430('0xb')];config[_0x3430('0xf')]=_[_0x3430('0x10')](config[_0x3430('0xf')],{'host':_0x3430('0x11'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x583dbe){this['channels']=_0x583dbe['channels'];this[_0x3430('0x12')]=_0x583dbe[_0x3430('0x12')];this[_0x3430('0x13')]={};ami['on'](_0x3430('0x14'),this[_0x3430('0x15')][_0x3430('0x16')](this));ami['on']('newexten',this[_0x3430('0x15')]['bind'](this));ami['on'](_0x3430('0x17'),this[_0x3430('0x18')][_0x3430('0x16')](this));ami['on']('newstate',this['syncNewState'][_0x3430('0x16')](this));ami['on']('varset',this[_0x3430('0x19')]['bind'](this));ami['on']('hangup',this[_0x3430('0x1a')]['bind'](this));ami['on']('newcallerid',this['syncNewCallerId'][_0x3430('0x16')](this));ami['on'](_0x3430('0x1b'),this['syncAttendedTransfer'][_0x3430('0x16')](this));ami['on'](_0x3430('0x1c'),this[_0x3430('0x1d')]['bind'](this));ami['on'](_0x3430('0x1e'),this[_0x3430('0x1f')][_0x3430('0x16')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x3430('0x16')](this));try{logger[_0x3430('0x20')](_0x3430('0x21'));ami[_0x3430('0x22')]();}catch(_0x1e785e){logger[_0x3430('0x23')](_0x3430('0x24'),util[_0x3430('0x25')](_0x1e785e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3430('0x26')][_0x3430('0x27')]=function(_0x3c0d0e){return _0x3c0d0e!==null&&!_[_0x3430('0x28')](_0x3c0d0e);};VoiceCallReport[_0x3430('0x26')][_0x3430('0x29')]=function(_0x440ce7,_0x4bbee0,_0x16a5de){io['to'](_0x440ce7)['emit'](_0x4bbee0,_0x16a5de);};VoiceCallReport[_0x3430('0x26')][_0x3430('0x2a')]=function(_0x35a8f7){try{if(this[_0x3430('0x27')](_0x35a8f7)){logger[_0x3430('0x20')](_0x3430('0x2b'),_0x35a8f7['uniqueid'],_0x35a8f7[_0x3430('0x2c')],_0x35a8f7[_0x3430('0x2d')]);logger[_0x3430('0x2e')](_0x3430('0x2f'),_0x35a8f7['uniqueid'],util['inspect'](_0x35a8f7,{'showHidden':![],'depth':null}));if(_0x35a8f7[_0x3430('0x30')]===_0x35a8f7[_0x3430('0x31')]){if(!_[_0x3430('0x28')](this[_0x3430('0x32')][_0x35a8f7[_0x3430('0x30')]])){_[_0x3430('0x33')](this['channels'][_0x35a8f7[_0x3430('0x30')]],_[_0x3430('0x34')](_0x35a8f7,_[_0x3430('0x35')](this[_0x3430('0x32')][_0x35a8f7['uniqueid']])));}}if(_0x35a8f7[_0x3430('0x36')]===_0x3430('0x37')){var _0x3610a7=this[_0x3430('0x12')][_0x35a8f7[_0x3430('0x38')]['split']('-')[0x0]];if(_0x3610a7){if(_0x35a8f7[_0x3430('0x39')]==_0x3430('0x3a')){_0x3610a7[_0x3430('0x3b')]=_0x35a8f7['connectedlinenum'];this[_0x3430('0x29')](util[_0x3430('0x3c')](_0x3430('0x3d'),_0x3610a7[_0x3430('0x3e')]),_0x3430('0x3f'),{'id':_0x3610a7['id'],'destaccountcode':_0x3610a7['accountcode'],'destconnectedlinenum':_0x35a8f7[_0x3430('0x40')]});}}}}}catch(_0x3f73ac){logger[_0x3430('0x23')](_0x3430('0x41'),_0x35a8f7[_0x3430('0x30')],util[_0x3430('0x25')](_0x3f73ac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3430('0x26')][_0x3430('0x18')]=function(_0x2d93a9){try{if(this[_0x3430('0x27')](_0x2d93a9)){logger[_0x3430('0x2e')](_0x3430('0x42'),_0x2d93a9[_0x3430('0x30')],util['inspect'](_0x2d93a9,{'showHidden':![],'depth':null}));if(this[_0x3430('0x32')][_0x2d93a9[_0x3430('0x30')]]){return;}if(_0x2d93a9[_0x3430('0x38')]===_0x3430('0x43')){return;}if(_0x2d93a9[_0x3430('0x30')]!==_0x2d93a9[_0x3430('0x31')]&&!this[_0x3430('0x13')][_0x2d93a9['linkedid']]){return;}logger['info'](_0x3430('0x44'),_0x2d93a9[_0x3430('0x30')],_0x2d93a9[_0x3430('0x36')],_0x2d93a9[_0x3430('0x39')]);this[_0x3430('0x32')][_0x2d93a9[_0x3430('0x30')]]=new Channel();this['channels'][_0x2d93a9[_0x3430('0x30')]][_0x3430('0x45')]=moment()[_0x3430('0x3c')](_0x3430('0x46'));this['channels'][_0x2d93a9[_0x3430('0x30')]]['disposition']=dispositions[_[_0x3430('0x47')](_0x2d93a9[_0x3430('0x48')])];_['merge'](this[_0x3430('0x32')][_0x2d93a9[_0x3430('0x30')]],_[_0x3430('0x34')](_0x2d93a9,_[_0x3430('0x35')](this[_0x3430('0x32')][_0x2d93a9[_0x3430('0x30')]])));if(_0x2d93a9['context']===_0x3430('0x37')){var _0x2f56e6=this[_0x3430('0x12')][_0x2d93a9[_0x3430('0x38')][_0x3430('0x49')]('-')[0x0]];if(_0x2f56e6&&typeof _0x2f56e6['destconnectedlinenum']===_0x3430('0x4a')){_0x2f56e6[_0x3430('0x3b')]=_0x2d93a9['exten'];logger[_0x3430('0x2e')](_0x3430('0x4b'),_0x2d93a9[_0x3430('0x30')],util[_0x3430('0x25')]({'id':_0x2f56e6['id'],'destaccountcode':_0x2f56e6['accountcode'],'destconnectedlinenum':_0x2d93a9[_0x3430('0x39')]},{'showHidden':![],'depth':null}));this[_0x3430('0x29')](util[_0x3430('0x3c')](_0x3430('0x3d'),_0x2f56e6[_0x3430('0x3e')]),_0x3430('0x3f'),{'id':_0x2f56e6['id'],'destaccountcode':_0x2f56e6[_0x3430('0x4c')],'destconnectedlinenum':_0x2d93a9[_0x3430('0x39')]});}}}}catch(_0x291dc5){logger[_0x3430('0x23')](_0x3430('0x4d'),_0x2d93a9['uniqueid'],util[_0x3430('0x25')](_0x291dc5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3430('0x26')]['syncNewExten']=function(_0x569c64){try{if(this[_0x3430('0x27')](_0x569c64)){logger[_0x3430('0x2e')](_0x3430('0x4e'),_0x569c64[_0x3430('0x30')],util[_0x3430('0x25')](_0x569c64,{'showHidden':![],'depth':null}));if(_0x569c64[_0x3430('0x38')]===_0x3430('0x43')||_0x569c64[_0x3430('0x39')]==='h')return;if(_0x569c64[_0x3430('0x30')]===_0x569c64[_0x3430('0x31')]||this[_0x3430('0x13')][_0x569c64[_0x3430('0x31')]]){_0x569c64[_0x3430('0x4f')]=_0x569c64[_0x3430('0x4f')]?_0x569c64[_0x3430('0x4f')]['toLowerCase']():undefined;_0x569c64['applicationdata']=_0x569c64[_0x3430('0x50')]||_0x569c64[_0x3430('0x51')];if(_0x569c64[_0x3430('0x50')]&&_0x569c64[_0x3430('0x4f')]!=='queue'){_0x569c64[_0x3430('0x51')]=_0x569c64[_0x3430('0x51')][_0x3430('0x52')]();}logger[_0x3430('0x20')](_0x3430('0x53'),_0x569c64[_0x3430('0x30')],_0x569c64[_0x3430('0x4f')],_0x569c64[_0x3430('0x51')]);if(_[_0x3430('0x28')](this['channels'][_0x569c64[_0x3430('0x30')]])){this['channels'][_0x569c64[_0x3430('0x30')]]=new Channel();this[_0x3430('0x32')][_0x569c64[_0x3430('0x30')]][_0x3430('0x45')]=_0x569c64[_0x3430('0x54')]?moment()[_0x3430('0x55')](moment['duration'](_0x569c64[_0x3430('0x54')])['seconds'](),'seconds')[_0x3430('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3430('0x32')][_0x569c64[_0x3430('0x30')]][_0x3430('0x56')]='NO\x20ANSWER';}_[_0x3430('0x33')](this[_0x3430('0x32')][_0x569c64[_0x3430('0x30')]],_[_0x3430('0x34')](_0x569c64,_['keys'](this[_0x3430('0x32')][_0x569c64[_0x3430('0x30')]])));if(_[_0x3430('0x57')](applications,_0x569c64['application'])){this[_0x3430('0x32')][_0x569c64['uniqueid']][_0x3430('0x58')]=_0x569c64[_0x3430('0x4f')];this[_0x3430('0x32')][_0x569c64[_0x3430('0x30')]]['lastdata']=_0x569c64[_0x3430('0x51')];if(_0x569c64[_0x3430('0x4f')]===_0x3430('0x59')&&_[_0x3430('0x5a')](_0x569c64[_0x3430('0x51')]['toLowerCase'](),_0x3430('0x5b'))){var _0x3bfee9=_0x569c64[_0x3430('0x51')]['split']('=');var _0x1912a6=_0x3bfee9[0x0]['toLowerCase']()['match'](/cdr\((.*)\)/);if(_0x1912a6){if(_0x1912a6[0x1]===_0x3430('0x5c')&&!_[_0x3430('0x5d')](this[_0x3430('0x32')][_0x569c64[_0x3430('0x30')]][_0x1912a6[0x1]]))return;this[_0x3430('0x32')][_0x569c64['uniqueid']][_0x1912a6[0x1]]=_0x3bfee9[0x1];}}else if(_0x569c64[_0x3430('0x4f')]==='queue'){this['channels'][_0x569c64[_0x3430('0x30')]]['queue']=_0x569c64['applicationdata'][_0x3430('0x49')](',')[0x0];}}}}}catch(_0x102e9e){logger[_0x3430('0x23')](_0x3430('0x5e'),_0x569c64[_0x3430('0x30')],util[_0x3430('0x25')](_0x102e9e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3430('0x26')][_0x3430('0x5f')]=function(_0x92cbe1){try{if(this['isNotNull'](_0x92cbe1)){logger[_0x3430('0x20')](_0x3430('0x60'),_0x92cbe1[_0x3430('0x30')],_0x92cbe1['linkedid'],_0x92cbe1['calleridname'],_0x92cbe1[_0x3430('0x2d')]);logger[_0x3430('0x2e')]('[%s][voiceCallReport][newstate]\x20event:',_0x92cbe1[_0x3430('0x30')],util[_0x3430('0x25')](_0x92cbe1,{'showHidden':![],'depth':null}));if(_0x92cbe1[_0x3430('0x48')]!=='6')return;var _0x2c7bb4=this[_0x3430('0x12')][_0x92cbe1[_0x3430('0x38')]['split']('-')[0x0]];if(_0x92cbe1[_0x3430('0x30')]!==_0x92cbe1[_0x3430('0x31')]){var _0x58bb3d=moment();if(this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]]){if(!this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]]['answered']){this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x61')]=!![];this[_0x3430('0x32')][_0x92cbe1['linkedid']][_0x3430('0x62')]=_0x58bb3d[_0x3430('0x3c')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x3430('0x32')][_0x92cbe1['linkedid']]['starttime']){this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x63')]=_0x58bb3d[_0x3430('0x64')](this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x45')],_0x3430('0x65'));}}this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x31')]=_0x92cbe1[_0x3430('0x30')];if(_0x92cbe1[_0x3430('0x2d')]!==_0x3430('0x3a')){this[_0x3430('0x32')][_0x92cbe1['linkedid']][_0x3430('0x40')]=_0x92cbe1['calleridnum'];}this[_0x3430('0x32')][_0x92cbe1['linkedid']][_0x3430('0x66')]=_0x92cbe1[_0x3430('0x2c')];this[_0x3430('0x32')][_0x92cbe1['linkedid']][_0x3430('0x67')]=_0x92cbe1[_0x3430('0x38')];this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x56')]=dispositions[_[_0x3430('0x47')](_0x92cbe1[_0x3430('0x48')])];if(_0x2c7bb4){this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x68')]=_0x2c7bb4['id'];this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]][_0x3430('0x69')]=_0x2c7bb4[_0x3430('0x3e')];}}if(this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]]){if(!this['channels'][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x61')]){this['channels'][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x61')]=!![];this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x62')]=_0x58bb3d[_0x3430('0x3c')](_0x3430('0x46'));if(this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x45')]){this['channels'][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x63')]=_0x58bb3d[_0x3430('0x64')](this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x45')],_0x3430('0x65'));}}if(_0x92cbe1[_0x3430('0x2d')]!==_0x3430('0x3a')){this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x40')]=_0x92cbe1[_0x3430('0x2d')];}this['channels'][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x66')]=_0x92cbe1['calleridname'];this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x67')]=_0x92cbe1[_0x3430('0x38')];this['channels'][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x56')]=dispositions[_['toNumber'](_0x92cbe1[_0x3430('0x48')])];}}else{if(this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]]){if(_0x2c7bb4){this[_0x3430('0x32')][_0x92cbe1['uniqueid']][_0x3430('0x68')]=_0x2c7bb4['id'];this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x69')]=_0x2c7bb4[_0x3430('0x3e')];}}}if(_0x92cbe1[_0x3430('0x36')]===_0x3430('0x37')){if(_0x2c7bb4){_0x2c7bb4[_0x3430('0x3b')]=_0x92cbe1[_0x3430('0x39')];var _0x1daf2b;if(this['channels'][_0x92cbe1[_0x3430('0x30')]]){_0x1daf2b=this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x30')]][_0x3430('0x6a')];}else if(this[_0x3430('0x32')][_0x92cbe1[_0x3430('0x31')]]){_0x1daf2b=this[_0x3430('0x32')][_0x92cbe1['linkedid']][_0x3430('0x6a')];}_0x2c7bb4[_0x3430('0x6a')]=_0x1daf2b;var _0x4d0f91={'id':_0x2c7bb4['id'],'name':_0x2c7bb4[_0x3430('0x3e')],'agentconnected':!![],'destaccountcode':_0x2c7bb4['accountcode'],'destconnectedlinenum':_0x92cbe1[_0x3430('0x39')],'queue':_0x1daf2b||undefined,'uniqueid':_0x92cbe1[_0x3430('0x31')]};logger[_0x3430('0x2e')](_0x3430('0x6b'),_0x92cbe1[_0x3430('0x30')],util['inspect'](_0x4d0f91,{'showHidden':![],'depth':null}));this[_0x3430('0x29')](util[_0x3430('0x3c')](_0x3430('0x3d'),_0x2c7bb4[_0x3430('0x3e')]),_0x3430('0x3f'),_0x4d0f91);}}}}catch(_0x4869fa){logger[_0x3430('0x23')](_0x3430('0x6c'),_0x92cbe1[_0x3430('0x30')],util[_0x3430('0x25')](_0x4869fa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3430('0x26')][_0x3430('0x6d')]=function(_0x1e04a0,_0x510c87){try{if(this[_0x3430('0x32')][_0x1e04a0]){logger[_0x3430('0x20')](_0x3430('0x6e'),_0x1e04a0,_0x510c87);this['channels'][_0x1e04a0][_0x3430('0x6f')]=!![];if(_['endsWith'](_0x510c87,_0x3430('0x70'))){_0x510c87=_0x510c87[_0x3430('0x71')](_0x3430('0x70'),'.WAV');}this['channels'][_0x1e04a0][_0x3430('0x72')]=_0x510c87;var _0x11f9c3=_['find'](this[_0x3430('0x32')][_0x1e04a0][_0x3430('0x73')],{'filename':_0x510c87});if(_[_0x3430('0x5d')](_0x11f9c3)){this[_0x3430('0x32')][_0x1e04a0][_0x3430('0x73')][_0x3430('0x74')]({'filename':_0x510c87,'createdAt':moment()[_0x3430('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x3430('0x75')});}}}catch(_0x468927){logger['error'](_0x3430('0x76'),_0x1e04a0,util['inspect'](_0x468927,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3430('0x26')][_0x3430('0x19')]=function(_0x466ef2){try{if(this[_0x3430('0x27')](_0x466ef2)){logger[_0x3430('0x2e')](_0x3430('0x77'),_0x466ef2[_0x3430('0x30')],util[_0x3430('0x25')](_0x466ef2,{'showHidden':![],'depth':null}));if(this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]]&&_0x466ef2[_0x3430('0x38')]!=_0x3430('0x43')){if(this[_0x3430('0x27')](_0x466ef2['variable'])){if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x79')])){logger[_0x3430('0x20')](_0x3430('0x7a'),_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x6d')](_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);}else if(this['isNotNull'](_0x466ef2[_0x3430('0x78')][_0x3430('0x7c')])){logger[_0x3430('0x20')](_0x3430('0x7d'),_0x466ef2[_0x3430('0x30')],_0x466ef2['value']);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]][_0x3430('0x2d')]=_0x466ef2[_0x3430('0x7b')];}else if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x7e')])){logger['info'](_0x3430('0x7f'),_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]][_0x3430('0x80')]=_0x466ef2[_0x3430('0x7b')];}else if(this[_0x3430('0x27')](_0x466ef2['variable'][_0x3430('0x81')])){logger[_0x3430('0x20')](_0x3430('0x82'),_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]]['type']=_0x466ef2[_0x3430('0x7b')];}else if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x83')])){logger[_0x3430('0x20')](_0x3430('0x84'),_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')][_0x3430('0x49')](',')[0x0]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]][_0x3430('0x6a')]=_0x466ef2['value'][_0x3430('0x49')](',')[0x0];}else if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x85')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x466ef2['uniqueid'],_0x466ef2[_0x3430('0x7b')]);this['channels'][_0x466ef2[_0x3430('0x30')]][_0x3430('0x86')]=_0x466ef2[_0x3430('0x7b')];}else if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')]['xmd-destination'])){logger['info'](_0x3430('0x87'),_0x466ef2[_0x3430('0x30')],_0x466ef2['value']);this['channels'][_0x466ef2[_0x3430('0x30')]]['destination']=_0x466ef2['value'];}else if(this['isNotNull'](_0x466ef2['variable']['xmd-callerid-preview'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]]['calleridpreview']=_0x466ef2['value'];}else if(this['isNotNull'](_0x466ef2[_0x3430('0x78')][_0x3430('0x88')])){logger['info'](_0x3430('0x89'),_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]][_0x3430('0x6a')]=_0x466ef2[_0x3430('0x7b')];}else if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x8a')])){logger[_0x3430('0x20')](_0x3430('0x8b'),_0x466ef2[_0x3430('0x30')],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x30')]][_0x3430('0x8c')]=_0x466ef2[_0x3430('0x7b')];}}}else if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x79')])){if(_0x466ef2[_0x3430('0x7b')]){var _0x39f7e7=path[_0x3430('0x8d')](_0x466ef2[_0x3430('0x7b')])[_0x3430('0x3e')];logger['info'](_0x3430('0x7a'),_0x39f7e7,_0x466ef2['value']);this[_0x3430('0x6d')](_0x39f7e7,_0x466ef2['value']);}}else if(this[_0x3430('0x32')][_0x466ef2['linkedid']]){if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')])){if(this[_0x3430('0x27')](_0x466ef2[_0x3430('0x78')][_0x3430('0x8a')])){logger[_0x3430('0x20')](_0x3430('0x8b'),_0x466ef2['linkedid'],_0x466ef2[_0x3430('0x7b')]);this[_0x3430('0x32')][_0x466ef2[_0x3430('0x31')]][_0x3430('0x8e')]=_0x466ef2[_0x3430('0x7b')];}}}}}catch(_0x5227dc){logger[_0x3430('0x23')](_0x3430('0x8f'),_0x466ef2[_0x3430('0x30')],util[_0x3430('0x25')](_0x5227dc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3430('0x26')][_0x3430('0x1a')]=function(_0x11c9e8){try{if(this[_0x3430('0x27')](_0x11c9e8)){logger[_0x3430('0x2e')](_0x3430('0x90'),_0x11c9e8[_0x3430('0x30')],util[_0x3430('0x25')](_0x11c9e8,{'showHidden':![],'depth':null}));if(this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]){if(this['channels'][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['linkedid']]){this['channels'][this[_0x3430('0x13')][_0x11c9e8['linkedid']][_0x3430('0x31')]][_0x3430('0x30')]=_0x11c9e8['uniqueid'];this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['linkedid']][_0x3430('0x61')]=this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x61')];this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['linkedid']][_0x3430('0x62')]=this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x62')];this[_0x3430('0x32')][this['blindTransfers'][_0x11c9e8['linkedid']]['linkedid']]['destinationchannel']=this['channels'][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['linkedid']][_0x3430('0x38')];this['channels'][this['blindTransfers'][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x31')]]['disposition']=this['channels'][_0x11c9e8[_0x3430('0x30')]]['disposition'];this['channels'][_0x11c9e8['uniqueid']]=this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x31')]];this[_0x3430('0x91')](this['blindTransfers'][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x31')]);}else if(this['channels'][this[_0x3430('0x13')][_0x11c9e8['linkedid']][_0x3430('0x30')]]){this['channels'][this['blindTransfers'][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x30')]][_0x3430('0x30')]=[this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['uniqueid']]['linkedid'],this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x30')]][_0x3430('0x31')]=this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['uniqueid']][_0x3430('0x30')]][0x0];this[_0x3430('0x32')][this['blindTransfers'][_0x11c9e8['linkedid']]['uniqueid']][_0x3430('0x61')]=this['channels'][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x61')];this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x30')]][_0x3430('0x62')]=this[_0x3430('0x32')][_0x11c9e8['uniqueid']][_0x3430('0x62')];this[_0x3430('0x32')][this['blindTransfers'][_0x11c9e8[_0x3430('0x31')]]['uniqueid']]['destinationchannel']=this[_0x3430('0x32')][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x30')]][_0x3430('0x38')];this['channels'][this[_0x3430('0x13')][_0x11c9e8[_0x3430('0x31')]]['uniqueid']]['disposition']=this['channels'][_0x11c9e8['uniqueid']]['disposition'];this[_0x3430('0x32')][_0x11c9e8['uniqueid']]=this[_0x3430('0x32')][this['blindTransfers'][_0x11c9e8[_0x3430('0x31')]][_0x3430('0x30')]];this[_0x3430('0x91')](this['blindTransfers'][_0x11c9e8[_0x3430('0x31')]]['uniqueid']);}}if(this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]]){logger['info'](_0x3430('0x92'),_0x11c9e8[_0x3430('0x30')],_0x11c9e8[_0x3430('0x93')]);var _0x12f6b1=moment();this[_0x3430('0x32')][_0x11c9e8['uniqueid']][_0x3430('0x94')]=_0x12f6b1[_0x3430('0x3c')](_0x3430('0x46'));this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x54')]=_0x12f6b1[_0x3430('0x64')](this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x45')],_0x3430('0x65'));if(this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x61')]){this['channels'][_0x11c9e8['uniqueid']][_0x3430('0x95')]=_0x12f6b1['diff'](this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]]['answertime'],'seconds');this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x63')]=this[_0x3430('0x32')][_0x11c9e8[_0x3430('0x30')]][_0x3430('0x54')]-this[_0x3430('0x32')][_0x11c9e8['uniqueid']][_0x3430('0x95')];}if(_0x11c9e8[_0x3430('0x36')]===_0x3430('0x37')){if(this[_0x3430('0x12')][_0x11c9e8[_0x3430('0x38')]['split']('-')[0x0]]){this[_0x3430('0x12')][_0x11c9e8[_0x3430('0x38')]['split']('-')[0x0]]=_[_0x3430('0x96')](this[_0x3430('0x12')][_0x11c9e8[_0x3430('0x38')][_0x3430('0x49')]('-')[0x0]],['destconnectedlinenum']);logger[_0x3430('0x2e')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x11c9e8[_0x3430('0x30')],util[_0x3430('0x25')]({'id':this[_0x3430('0x12')][_0x11c9e8[_0x3430('0x38')][_0x3430('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x3430('0x12')][_0x11c9e8[_0x3430('0x38')][_0x3430('0x49')]('-')[0x0]][_0x3430('0x4c')]},{'showHidden':![],'depth':null}));this[_0x3430('0x29')](util['format'](_0x3430('0x3d'),this[_0x3430('0x12')][_0x11c9e8[_0x3430('0x38')][_0x3430('0x49')]('-')[0x0]]['name']),_0x3430('0x97'),{'id':this[_0x3430('0x12')][_0x11c9e8['channel'][_0x3430('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x3430('0x12')][_0x11c9e8['channel'][_0x3430('0x49')]('-')[0x0]][_0x3430('0x4c')]});for(var _0x5d5c2f=0x0;_0x5d5c2f{delete this[_0x3430('0x32')][_0x1431b0];},_0x4bf20b);}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 2e80696..faf75eb 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f10=['seconds','complete','answertime','answered','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','../../../config/logger','ami','redis','channels','outboundChannels','outbound','applications','variables','syncDialBegin','bind','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','lastevent','custom:dialconnect','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberinterface','memberlastcall','isNil','includes','isUndefined','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime'];(function(_0x50085a,_0x2fa0ff){var _0x4ee9ad=function(_0x2a0d8d){while(--_0x2a0d8d){_0x50085a['push'](_0x50085a['shift']());}};_0x4ee9ad(++_0x2fa0ff);}(_0x1f10,0x160));var _0x01f1=function(_0x4313c0,_0x40059c){_0x4313c0=_0x4313c0-0x0;var _0x1cee38=_0x1f10[_0x4313c0];return _0x1cee38;};'use strict';var _=require('lodash');var moment=require(_0x01f1('0x0'));var util=require(_0x01f1('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x01f1('0x2'))(_0x01f1('0x3'));var ami=require('../ami');config[_0x01f1('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x01f1('0x4')]));function VoiceDialReport(_0x5a0f9a){this[_0x01f1('0x5')]=_0x5a0f9a[_0x01f1('0x6')];this[_0x01f1('0x7')]=_0x5a0f9a[_0x01f1('0x7')];this[_0x01f1('0x8')]={};this[_0x01f1('0x9')]={};ami['on']('dialbegin',this[_0x01f1('0xa')][_0x01f1('0xb')](this));ami['on']('dialend',this[_0x01f1('0xc')]['bind'](this));ami['on']('varset',this[_0x01f1('0xd')][_0x01f1('0xb')](this));ami['on'](_0x01f1('0xe'),this[_0x01f1('0xf')][_0x01f1('0xb')](this));}VoiceDialReport[_0x01f1('0x10')]['isNotNull']=function(_0x264209){return _0x264209!==null&&!_['isUndefined'](_0x264209);};VoiceDialReport[_0x01f1('0x10')]['emit']=function(_0x40cead,_0x38f437,_0x384c18){io['to'](_0x40cead)[_0x01f1('0x11')](_0x38f437,_0x384c18);};VoiceDialReport[_0x01f1('0x10')][_0x01f1('0xa')]=function(_0x25ce56){try{if(this['isNotNull'](_0x25ce56)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x25ce56[_0x01f1('0x12')],util['inspect'](_0x25ce56,{'showHidden':![],'depth':null}));if(this[_0x01f1('0x5')][_0x25ce56[_0x01f1('0x12')]]){_[_0x01f1('0x13')](this[_0x01f1('0x5')][_0x25ce56['uniqueid']],{'starttime':moment()[_0x01f1('0x14')](_0x01f1('0x15')),'lastevent':_0x01f1('0x16'),'interface':_0x25ce56[_0x01f1('0x17')][_0x01f1('0x18')](0x0,_0x25ce56[_0x01f1('0x17')]['lastIndexOf']('-')),'membername':_0x25ce56[_0x01f1('0x17')]['substring'](_0x25ce56['channel'][_0x01f1('0x19')]('/')+0x1,_0x25ce56['channel']['lastIndexOf']('-'))},_['omit'](_0x25ce56,[_0x01f1('0x1a'),_0x01f1('0x1b')]));logger[_0x01f1('0x1c')](_0x01f1('0x1d'),_0x25ce56[_0x01f1('0x12')],this[_0x01f1('0x5')][_0x25ce56[_0x01f1('0x12')]][_0x01f1('0x1e')],this['channels'][_0x25ce56[_0x01f1('0x12')]][_0x01f1('0x1f')]);logger['debug'](_0x01f1('0x20'),_0x25ce56[_0x01f1('0x12')],util[_0x01f1('0x21')](this['channels'][_0x25ce56[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));if(this[_0x01f1('0x8')][_0x25ce56['uniqueid']])_[_0x01f1('0x13')](this[_0x01f1('0x5')][_0x25ce56[_0x01f1('0x12')]],this[_0x01f1('0x8')][_0x25ce56[_0x01f1('0x12')]]);this[_0x01f1('0x11')]('voice:outbound',_0x01f1('0x22'),this['channels'][_0x25ce56['uniqueid']]);logger[_0x01f1('0x23')](_0x01f1('0x24'),_0x25ce56[_0x01f1('0x12')],util[_0x01f1('0x21')](this[_0x01f1('0x5')][_0x25ce56[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0x01f1('0x5')][_0x25ce56[_0x01f1('0x12')]]);}}}catch(_0x389e4b){logger[_0x01f1('0x25')](_0x01f1('0x26'),_0x25ce56[_0x01f1('0x12')],util[_0x01f1('0x21')](_0x389e4b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x01f1('0x10')]['syncDialEnd']=function(_0x4c81e2){try{if(this[_0x01f1('0x27')](_0x4c81e2)){logger[_0x01f1('0x23')](_0x01f1('0x28'),_0x4c81e2[_0x01f1('0x12')],util[_0x01f1('0x21')](_0x4c81e2,{'showHidden':![],'depth':null}));if(this['channels'][_0x4c81e2[_0x01f1('0x12')]]){this['channels'][_0x4c81e2[_0x01f1('0x12')]]['dialstatus']=_0x4c81e2[_0x01f1('0x29')];if(_0x4c81e2[_0x01f1('0x29')]==='ANSWER'){this[_0x01f1('0x5')][_0x4c81e2[_0x01f1('0x12')]][_0x01f1('0x2a')]=_0x4c81e2[_0x01f1('0x2a')];this[_0x01f1('0x5')][_0x4c81e2['uniqueid']][_0x01f1('0x2b')]=_0x4c81e2[_0x01f1('0x2b')];this[_0x01f1('0x5')][_0x4c81e2[_0x01f1('0x12')]]['answertime']=moment()[_0x01f1('0x14')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x01f1('0x5')][_0x4c81e2[_0x01f1('0x12')]][_0x01f1('0x2c')]='connect';logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x4c81e2[_0x01f1('0x12')],_0x4c81e2[_0x01f1('0x17')]['substring'](_0x4c81e2[_0x01f1('0x17')][_0x01f1('0x19')]('/')+0x1,_0x4c81e2[_0x01f1('0x17')][_0x01f1('0x19')]('-')));logger[_0x01f1('0x23')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x4c81e2['uniqueid'],util[_0x01f1('0x21')](this[_0x01f1('0x5')][_0x4c81e2[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));ami[_0x01f1('0x11')](_0x01f1('0x2d'),this[_0x01f1('0x5')][_0x4c81e2['uniqueid']]);}logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4c81e2[_0x01f1('0x12')],util['inspect'](this[_0x01f1('0x5')][_0x4c81e2[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));this[_0x01f1('0x11')](_0x01f1('0x2e'),'voice_outbound_channel:save',this[_0x01f1('0x5')][_0x4c81e2[_0x01f1('0x12')]]);}}}catch(_0x414117){logger['error'](_0x01f1('0x2f'),_0x4c81e2[_0x01f1('0x12')],util[_0x01f1('0x21')](_0x414117,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x01f1('0x10')]['syncVarSet']=function(_0x195da3){try{if(this['isNotNull'](_0x195da3)){logger[_0x01f1('0x23')](_0x01f1('0x30'),_0x195da3[_0x01f1('0x12')],util['inspect'](_0x195da3,{'showHidden':![],'depth':null}));this[_0x01f1('0x31')](_0x195da3[_0x01f1('0x12')],_[_0x01f1('0x32')](_0x195da3[_0x01f1('0x33')])[0x0],_0x195da3[_0x01f1('0x34')]);if(this['isNotNull'](_0x195da3[_0x01f1('0x33')])&&this['isNotNull'](_0x195da3[_0x01f1('0x33')][_0x01f1('0x35')])){if(_['isUndefined'](this['channels'][_0x195da3[_0x01f1('0x12')]])){this['channels'][_0x195da3['uniqueid']]={'routeId':_0x195da3[_0x01f1('0x34')],'variables':this[_0x01f1('0x9')][_0x195da3[_0x01f1('0x12')]],'motionChannel':_0x01f1('0x36')};logger['info'](_0x01f1('0x37'),_0x195da3['uniqueid'],_0x195da3[_0x01f1('0x33')][_0x01f1('0x35')],_[_0x01f1('0x32')](_0x195da3[_0x01f1('0x33')])[0x0],_0x195da3[_0x01f1('0x34')]);logger[_0x01f1('0x23')](_0x01f1('0x38'),_0x195da3[_0x01f1('0x12')],util[_0x01f1('0x21')](this['channels'][_0x195da3[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));this['emit'](_0x01f1('0x2e'),'voice_outbound_channel:save',this[_0x01f1('0x5')][_0x195da3[_0x01f1('0x12')]]);}}}}catch(_0xc1eff){logger['error'](_0x01f1('0x39'),_0x195da3[_0x01f1('0x12')],util[_0x01f1('0x21')](_0xc1eff,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x01f1('0x10')][_0x01f1('0x31')]=function(_0xd9a5d1,_0x17a7f4,_0x73cc4c){var _0x151099=[_0x01f1('0x3a'),_0x01f1('0x3b'),_0x01f1('0x3c'),_0x01f1('0x3d'),_0x01f1('0x3e'),_0x01f1('0x3f'),'rtpaudioqosrtt',_0x01f1('0x40'),_0x01f1('0x41'),_0x01f1('0x42'),'bridgepeer',_0x01f1('0x43'),_0x01f1('0x44'),'memberdynamic',_0x01f1('0x45'),_0x01f1('0x46'),_0x01f1('0x1e'),'memberpenalty','memberrealtime'];if(!_[_0x01f1('0x47')](_0x17a7f4)&&!_[_0x01f1('0x48')](_0x151099,_0x17a7f4)){if(_[_0x01f1('0x49')](this['variables'][_0xd9a5d1])){this[_0x01f1('0x9')][_0xd9a5d1]={};}this[_0x01f1('0x9')][_0xd9a5d1][_0x17a7f4]=_0x73cc4c;}};VoiceDialReport[_0x01f1('0x10')][_0x01f1('0xf')]=function(_0x4bf7fd){try{if(this[_0x01f1('0x27')](_0x4bf7fd)){logger[_0x01f1('0x23')]('[%s][voiceDialReport][hangup]\x20event:',_0x4bf7fd[_0x01f1('0x12')],util['inspect'](_0x4bf7fd,{'showHidden':![],'depth':null}));if(this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]]){logger[_0x01f1('0x1c')](_0x01f1('0x4a'),_0x4bf7fd[_0x01f1('0x12')],_0x4bf7fd[_0x01f1('0x4b')]);this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x4c')]=moment()[_0x01f1('0x14')](_0x01f1('0x15'));this[_0x01f1('0x5')][_0x4bf7fd['uniqueid']][_0x01f1('0x4d')]=moment(this['channels'][_0x4bf7fd['uniqueid']]['endtime'])[_0x01f1('0x4e')](this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x4f')],_0x01f1('0x50'));this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x2c')]=_0x01f1('0x51');this['outbound']['total']+=0x1;if(this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x52')]){this[_0x01f1('0x7')][_0x01f1('0x53')]+=0x1;this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x54')]=moment(this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x52')])['diff'](this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]]['starttime'],_0x01f1('0x50'));this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x55')]=moment(this['channels'][_0x4bf7fd['uniqueid']][_0x01f1('0x4c')])['diff'](this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x52')],_0x01f1('0x50'));this[_0x01f1('0x7')]['sumHoldTime']+=this[_0x01f1('0x5')][_0x4bf7fd['uniqueid']][_0x01f1('0x54')]||0x0;this[_0x01f1('0x7')]['sumBillable']+=this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]][_0x01f1('0x55')];}this[_0x01f1('0x7')][_0x01f1('0x56')]+=this[_0x01f1('0x5')][_0x4bf7fd['uniqueid']][_0x01f1('0x4d')];logger[_0x01f1('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4bf7fd['uniqueid'],util[_0x01f1('0x21')](this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]]);logger[_0x01f1('0x23')](_0x01f1('0x57'),_0x4bf7fd['uniqueid'],util[_0x01f1('0x21')](this['channels'][_0x4bf7fd[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));ami[_0x01f1('0x11')](_0x01f1('0x58'),this[_0x01f1('0x5')][_0x4bf7fd['uniqueid']]);logger[_0x01f1('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x4bf7fd[_0x01f1('0x12')],util[_0x01f1('0x21')](this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));this['emit'](_0x01f1('0x2e'),_0x01f1('0x59'),this[_0x01f1('0x7')]);logger['info'](_0x01f1('0x5a'),JSON[_0x01f1('0x5b')](this['channels'][_0x4bf7fd['uniqueid']]));logger['debug'](_0x01f1('0x5c'),_0x4bf7fd['uniqueid'],util[_0x01f1('0x21')](this['channels'][_0x4bf7fd[_0x01f1('0x12')]],{'showHidden':![],'depth':null}));this[_0x01f1('0x11')](_0x01f1('0x2e'),_0x01f1('0x5d'),this['channels'][_0x4bf7fd[_0x01f1('0x12')]]);this[_0x01f1('0x5e')](_0x4bf7fd[_0x01f1('0x12')]);}else if(this[_0x01f1('0x5')][_0x4bf7fd['linkedid']]){this[_0x01f1('0x5')][_0x4bf7fd['linkedid']][_0x01f1('0x12')]=this[_0x01f1('0x5')][_0x4bf7fd[_0x01f1('0x5f')]]['destuniqueid'];}if(this['variables'][_0x4bf7fd[_0x01f1('0x12')]]){delete this[_0x01f1('0x9')][_0x4bf7fd[_0x01f1('0x12')]];}}}catch(_0x40b777){logger[_0x01f1('0x25')](_0x01f1('0x60'),_0x4bf7fd['uniqueid'],util[_0x01f1('0x21')](_0x40b777,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x01f1('0x61')]=function(_0xea46b4){try{if(this[_0x01f1('0x27')](_0xea46b4)){logger[_0x01f1('0x23')](_0x01f1('0x62'),_0xea46b4[_0x01f1('0x12')],util[_0x01f1('0x21')](_0xea46b4,{'showHidden':![],'depth':null}));if(_0xea46b4[_0x01f1('0x63')][_0x01f1('0x64')]()==='set'){_0xea46b4[_0x01f1('0x65')]=(_0xea46b4[_0x01f1('0x66')]||_0xea46b4[_0x01f1('0x65')])['toLowerCase']();if(_[_0x01f1('0x67')](_0xea46b4['applicationdata'],'cdr(')){if(_[_0x01f1('0x49')](this[_0x01f1('0x8')][_0xea46b4['uniqueid']]))this[_0x01f1('0x8')][_0xea46b4[_0x01f1('0x12')]]={};logger[_0x01f1('0x1c')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0xea46b4['uniqueid'],_0xea46b4[_0x01f1('0x63')],_0xea46b4[_0x01f1('0x65')]);var _0x1554d8=_0xea46b4[_0x01f1('0x65')][_0x01f1('0x68')]('=');var _0x48ed15=_0x1554d8[0x0][_0x01f1('0x69')](/cdr\((.*)\)/);if(_0x48ed15)this[_0x01f1('0x8')][_0xea46b4['uniqueid']][_0x48ed15[0x1]]=_0x1554d8[0x1];}}}}catch(_0x2f753f){logger[_0x01f1('0x25')](_0x01f1('0x6a'),_0xea46b4['uniqueid'],util[_0x01f1('0x21')](_0x2f753f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x01f1('0x10')][_0x01f1('0x5e')]=function(_0x42e1b9,_0xd8a8fc=0x2710){if(this[_0x01f1('0x5')][_0x42e1b9]){setTimeout(()=>{delete this['channels'][_0x42e1b9];},_0xd8a8fc);}};module[_0x01f1('0x6b')]=VoiceDialReport; \ No newline at end of file +var _0x6df6=['deleteChannelAfterTimeout','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isUndefined','emit','prototype','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','isNotNull','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','complete','total','answertime','answered','billableseconds','sumHoldTime','holdtime','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','toLowerCase','startsWith','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','[%s][voiceDialReport][newexten]'];(function(_0x1b4ceb,_0x9be1a0){var _0x5d2beb=function(_0x24a5bc){while(--_0x24a5bc){_0x1b4ceb['push'](_0x1b4ceb['shift']());}};_0x5d2beb(++_0x9be1a0);}(_0x6df6,0x15a));var _0x66df=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0x6df6[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0x66df('0x0'));var moment=require(_0x66df('0x1'));var util=require('util');var Redis=require(_0x66df('0x2'));var config=require(_0x66df('0x3'));var logger=require(_0x66df('0x4'))(_0x66df('0x5'));var ami=require(_0x66df('0x6'));config[_0x66df('0x7')]=_['defaults'](config[_0x66df('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x66df('0x8'))(new Redis(config[_0x66df('0x7')]));function VoiceDialReport(_0x544d57){this[_0x66df('0x9')]=_0x544d57[_0x66df('0xa')];this[_0x66df('0xb')]=_0x544d57['outbound'];this[_0x66df('0xc')]={};this[_0x66df('0xd')]={};ami['on'](_0x66df('0xe'),this['syncDialBegin'][_0x66df('0xf')](this));ami['on'](_0x66df('0x10'),this[_0x66df('0x11')][_0x66df('0xf')](this));ami['on'](_0x66df('0x12'),this[_0x66df('0x13')][_0x66df('0xf')](this));ami['on'](_0x66df('0x14'),this[_0x66df('0x15')][_0x66df('0xf')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0xa9d0e4){return _0xa9d0e4!==null&&!_[_0x66df('0x16')](_0xa9d0e4);};VoiceDialReport['prototype']['emit']=function(_0x530b60,_0x1a7581,_0x3d7e7a){io['to'](_0x530b60)[_0x66df('0x17')](_0x1a7581,_0x3d7e7a);};VoiceDialReport[_0x66df('0x18')][_0x66df('0x19')]=function(_0x3c0048){try{if(this['isNotNull'](_0x3c0048)){logger[_0x66df('0x1a')](_0x66df('0x1b'),_0x3c0048[_0x66df('0x1c')],util[_0x66df('0x1d')](_0x3c0048,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c0048[_0x66df('0x1c')]]){_[_0x66df('0x1e')](this[_0x66df('0x9')][_0x3c0048[_0x66df('0x1c')]],{'starttime':moment()[_0x66df('0x1f')](_0x66df('0x20')),'lastevent':'called','interface':_0x3c0048['channel']['substring'](0x0,_0x3c0048[_0x66df('0x21')][_0x66df('0x22')]('-')),'membername':_0x3c0048[_0x66df('0x21')][_0x66df('0x23')](_0x3c0048[_0x66df('0x21')][_0x66df('0x22')]('/')+0x1,_0x3c0048['channel'][_0x66df('0x22')]('-'))},_[_0x66df('0x24')](_0x3c0048,[_0x66df('0x25'),_0x66df('0x26')]));logger[_0x66df('0x27')](_0x66df('0x28'),_0x3c0048[_0x66df('0x1c')],this[_0x66df('0x9')][_0x3c0048[_0x66df('0x1c')]][_0x66df('0x29')],this[_0x66df('0x9')][_0x3c0048[_0x66df('0x1c')]][_0x66df('0x2a')]);logger['debug'](_0x66df('0x2b'),_0x3c0048[_0x66df('0x1c')],util['inspect'](this[_0x66df('0x9')][_0x3c0048[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0x66df('0xc')][_0x3c0048['uniqueid']])_[_0x66df('0x1e')](this[_0x66df('0x9')][_0x3c0048['uniqueid']],this[_0x66df('0xc')][_0x3c0048[_0x66df('0x1c')]]);this[_0x66df('0x17')](_0x66df('0x2c'),_0x66df('0x2d'),this[_0x66df('0x9')][_0x3c0048[_0x66df('0x1c')]]);logger[_0x66df('0x1a')](_0x66df('0x2e'),_0x3c0048['uniqueid'],util[_0x66df('0x1d')](this['channels'][_0x3c0048[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x66df('0x17')](_0x66df('0x2f'),this[_0x66df('0x9')][_0x3c0048[_0x66df('0x1c')]]);}}}catch(_0x274179){logger[_0x66df('0x30')]('[%s][voiceDialReport][dialbegin]',_0x3c0048[_0x66df('0x1c')],util[_0x66df('0x1d')](_0x274179,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x66df('0x18')][_0x66df('0x11')]=function(_0x4e7df7){try{if(this[_0x66df('0x31')](_0x4e7df7)){logger['debug'](_0x66df('0x32'),_0x4e7df7[_0x66df('0x1c')],util[_0x66df('0x1d')](_0x4e7df7,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e7df7['uniqueid']]){this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]][_0x66df('0x33')]=_0x4e7df7[_0x66df('0x33')];if(_0x4e7df7[_0x66df('0x33')]===_0x66df('0x34')){this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]][_0x66df('0x35')]=_0x4e7df7[_0x66df('0x35')];this['channels'][_0x4e7df7['uniqueid']]['connectedlinename']=_0x4e7df7[_0x66df('0x36')];this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]]['answertime']=moment()[_0x66df('0x1f')](_0x66df('0x20'));this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]][_0x66df('0x37')]=_0x66df('0x38');logger[_0x66df('0x27')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x4e7df7['uniqueid'],_0x4e7df7['channel'][_0x66df('0x23')](_0x4e7df7[_0x66df('0x21')]['lastIndexOf']('/')+0x1,_0x4e7df7[_0x66df('0x21')][_0x66df('0x22')]('-')));logger[_0x66df('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x4e7df7[_0x66df('0x1c')],util[_0x66df('0x1d')](this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x66df('0x39'),this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]]);}logger[_0x66df('0x1a')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4e7df7[_0x66df('0x1c')],util[_0x66df('0x1d')](this['channels'][_0x4e7df7[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));this['emit'](_0x66df('0x2c'),_0x66df('0x2d'),this[_0x66df('0x9')][_0x4e7df7[_0x66df('0x1c')]]);}}}catch(_0x4f9347){logger['error'](_0x66df('0x3a'),_0x4e7df7[_0x66df('0x1c')],util['inspect'](_0x4f9347,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x66df('0x18')]['syncVarSet']=function(_0x534d4c){try{if(this[_0x66df('0x31')](_0x534d4c)){logger[_0x66df('0x1a')](_0x66df('0x3b'),_0x534d4c[_0x66df('0x1c')],util[_0x66df('0x1d')](_0x534d4c,{'showHidden':![],'depth':null}));this[_0x66df('0x3c')](_0x534d4c[_0x66df('0x1c')],_[_0x66df('0x3d')](_0x534d4c['variable'])[0x0],_0x534d4c[_0x66df('0x3e')]);if(this[_0x66df('0x31')](_0x534d4c[_0x66df('0x3f')])&&this[_0x66df('0x31')](_0x534d4c['variable'][_0x66df('0x40')])){if(_[_0x66df('0x16')](this[_0x66df('0x9')][_0x534d4c[_0x66df('0x1c')]])){this[_0x66df('0x9')][_0x534d4c[_0x66df('0x1c')]]={'routeId':_0x534d4c[_0x66df('0x3e')],'variables':this[_0x66df('0xd')][_0x534d4c['uniqueid']],'motionChannel':_0x66df('0x41')};logger['info'](_0x66df('0x42'),_0x534d4c[_0x66df('0x1c')],_0x534d4c['variable'][_0x66df('0x40')],_[_0x66df('0x3d')](_0x534d4c[_0x66df('0x3f')])[0x0],_0x534d4c['value']);logger[_0x66df('0x1a')](_0x66df('0x43'),_0x534d4c[_0x66df('0x1c')],util['inspect'](this[_0x66df('0x9')][_0x534d4c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x66df('0x17')](_0x66df('0x2c'),_0x66df('0x2d'),this[_0x66df('0x9')][_0x534d4c['uniqueid']]);}}}}catch(_0x56e41e){logger[_0x66df('0x30')]('[%s][voiceDialReport][varset]',_0x534d4c['uniqueid'],util[_0x66df('0x1d')](_0x56e41e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x66df('0x3c')]=function(_0x1456c9,_0x24914e,_0x46a338){var _0x4fa8f4=[_0x66df('0x44'),'rtpaudioqosbridged',_0x66df('0x45'),'rtpaudioqosjitterbridged',_0x66df('0x46'),_0x66df('0x47'),_0x66df('0x48'),_0x66df('0x49'),'sipcallid','sipuri',_0x66df('0x4a'),_0x66df('0x4b'),'membercalls',_0x66df('0x4c'),_0x66df('0x4d'),_0x66df('0x4e'),_0x66df('0x29'),'memberpenalty',_0x66df('0x4f')];if(!_[_0x66df('0x50')](_0x24914e)&&!_[_0x66df('0x51')](_0x4fa8f4,_0x24914e)){if(_[_0x66df('0x16')](this[_0x66df('0xd')][_0x1456c9])){this['variables'][_0x1456c9]={};}this[_0x66df('0xd')][_0x1456c9][_0x24914e]=_0x46a338;}};VoiceDialReport[_0x66df('0x18')]['syncHangup']=function(_0x2fd7d9){try{if(this[_0x66df('0x31')](_0x2fd7d9)){logger[_0x66df('0x1a')]('[%s][voiceDialReport][hangup]\x20event:',_0x2fd7d9[_0x66df('0x1c')],util['inspect'](_0x2fd7d9,{'showHidden':![],'depth':null}));if(this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]]){logger[_0x66df('0x27')](_0x66df('0x52'),_0x2fd7d9['uniqueid'],_0x2fd7d9[_0x66df('0x53')]);this['channels'][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x54')]=moment()[_0x66df('0x1f')](_0x66df('0x20'));this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]]['duration']=moment(this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x54')])[_0x66df('0x55')](this['channels'][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x56')],_0x66df('0x57'));this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x37')]=_0x66df('0x58');this['outbound'][_0x66df('0x59')]+=0x1;if(this['channels'][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x5a')]){this['outbound'][_0x66df('0x5b')]+=0x1;this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]]['holdtime']=moment(this['channels'][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x5a')])['diff'](this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]]['starttime'],_0x66df('0x57'));this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x5c')]=moment(this[_0x66df('0x9')][_0x2fd7d9['uniqueid']][_0x66df('0x54')])[_0x66df('0x55')](this['channels'][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x5a')],'seconds');this[_0x66df('0xb')][_0x66df('0x5d')]+=this[_0x66df('0x9')][_0x2fd7d9['uniqueid']][_0x66df('0x5e')]||0x0;this[_0x66df('0xb')]['sumBillable']+=this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x5c')];}this[_0x66df('0xb')][_0x66df('0x5f')]+=this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]][_0x66df('0x60')];logger['debug'](_0x66df('0x61'),_0x2fd7d9[_0x66df('0x1c')],util[_0x66df('0x1d')](this['channels'][_0x2fd7d9[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x66df('0x17')](_0x66df('0x62'),this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]]);logger[_0x66df('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x2fd7d9['uniqueid'],util[_0x66df('0x1d')](this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x66df('0x17')]('custom:dialend',this['channels'][_0x2fd7d9['uniqueid']]);logger[_0x66df('0x1a')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x2fd7d9['uniqueid'],util[_0x66df('0x1d')](this['channels'][_0x2fd7d9['uniqueid']],{'showHidden':![],'depth':null}));this[_0x66df('0x17')](_0x66df('0x2c'),'voice_outbound:save',this[_0x66df('0xb')]);logger['info'](_0x66df('0x63'),JSON[_0x66df('0x64')](this[_0x66df('0x9')][_0x2fd7d9['uniqueid']]));logger[_0x66df('0x1a')](_0x66df('0x65'),_0x2fd7d9[_0x66df('0x1c')],util['inspect'](this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]],{'showHidden':![],'depth':null}));this[_0x66df('0x17')](_0x66df('0x2c'),_0x66df('0x66'),this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x1c')]]);this['deleteChannelAfterTimeout'](_0x2fd7d9[_0x66df('0x1c')]);}else if(this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x67')]]){this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x67')]]['uniqueid']=this[_0x66df('0x9')][_0x2fd7d9[_0x66df('0x67')]][_0x66df('0x68')];}if(this[_0x66df('0xd')][_0x2fd7d9[_0x66df('0x1c')]]){delete this[_0x66df('0xd')][_0x2fd7d9[_0x66df('0x1c')]];}}}catch(_0x306568){logger[_0x66df('0x30')]('[%s][voiceDialReport][hangup]',_0x2fd7d9[_0x66df('0x1c')],util[_0x66df('0x1d')](_0x306568,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x66df('0x18')][_0x66df('0x69')]=function(_0x11b1b0){try{if(this[_0x66df('0x31')](_0x11b1b0)){logger[_0x66df('0x1a')](_0x66df('0x6a'),_0x11b1b0['uniqueid'],util[_0x66df('0x1d')](_0x11b1b0,{'showHidden':![],'depth':null}));if(_0x11b1b0[_0x66df('0x6b')]['toLowerCase']()===_0x66df('0x6c')){_0x11b1b0[_0x66df('0x6d')]=(_0x11b1b0['appdata']||_0x11b1b0[_0x66df('0x6d')])[_0x66df('0x6e')]();if(_[_0x66df('0x6f')](_0x11b1b0['applicationdata'],'cdr(')){if(_[_0x66df('0x16')](this[_0x66df('0xc')][_0x11b1b0[_0x66df('0x1c')]]))this[_0x66df('0xc')][_0x11b1b0[_0x66df('0x1c')]]={};logger[_0x66df('0x27')](_0x66df('0x70'),_0x11b1b0['uniqueid'],_0x11b1b0[_0x66df('0x6b')],_0x11b1b0[_0x66df('0x6d')]);var _0xaeebf2=_0x11b1b0[_0x66df('0x6d')]['split']('=');var _0x5eb33c=_0xaeebf2[0x0]['match'](/cdr\((.*)\)/);if(_0x5eb33c)this[_0x66df('0xc')][_0x11b1b0[_0x66df('0x1c')]][_0x5eb33c[0x1]]=_0xaeebf2[0x1];}}}}catch(_0xb7b71a){logger[_0x66df('0x30')](_0x66df('0x71'),_0x11b1b0[_0x66df('0x1c')],util['inspect'](_0xb7b71a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x66df('0x18')][_0x66df('0x72')]=function(_0x565c39,_0x24b5ec=0x2710){if(this['channels'][_0x565c39]){setTimeout(()=>{delete this[_0x66df('0x9')][_0x565c39];},_0x24b5ec);}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index cd3413c..15df146 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x49ed=['realtime','agents','channels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','queuecallerexit','queuecallercomplete','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','uniqueid','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','isUndefined','loopQueueShow','clearZombieChannels','queues','isRunning','then','actionid','[voiceQueueReport][queuesummary]','createReport','createQueueSummaryReport','compareToInboundQueue','assign','queuestatus','inbound','handleInboundQueueSummaryReport','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','queuecallerjoinAt','position','count','info','pick','keys','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','last','queuecallerleaveAt','connectedlinenum','connectedlinename','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','queuecallerabandon','membername','queuecallerexitAt','reason','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','handleHangup','length','sumHoldTime','diff','sumDuration','total','answered','sumBillable','milliseconds','unmanaged','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][hangup]','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','transferid','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','appdata','applicationdata','cdr(','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','redis','localhost','prototype','enqueue','tail','finally','sequence'];(function(_0x445369,_0x33b0c4){var _0x312a9e=function(_0x27d5f3){while(--_0x27d5f3){_0x445369['push'](_0x445369['shift']());}};_0x312a9e(++_0x33b0c4);}(_0x49ed,0x1c2));var _0xd49e=function(_0x3042e5,_0x4652de){_0x3042e5=_0x3042e5-0x0;var _0x4bac3c=_0x49ed[_0x3042e5];return _0x4bac3c;};'use strict';var _=require(_0xd49e('0x0'));var moment=require(_0xd49e('0x1'));var util=require(_0xd49e('0x2'));var Redis=require('ioredis');var config=require(_0xd49e('0x3'));var logger=require(_0xd49e('0x4'))('ami');var ami=require(_0xd49e('0x5'));var QueueReport=require(_0xd49e('0x6'));var VoiceQueueSummary=require(_0xd49e('0x7'));config['redis']=_[_0xd49e('0x8')](config[_0xd49e('0x9')],{'host':_0xd49e('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xd49e('0xb')][_0xd49e('0xc')]=function(_0x51768a){this[_0xd49e('0xd')]=this[_0xd49e('0xd')]?this[_0xd49e('0xd')][_0xd49e('0xe')](_0x51768a):_0x51768a();};function VoiceQueueReport(_0x282f6a){this[_0xd49e('0xf')]=new Sequence();this['queueReports']={};this[_0xd49e('0x10')]=_0x282f6a;this[_0xd49e('0x11')]=_0x282f6a[_0xd49e('0x11')];this[_0xd49e('0x12')]=_0x282f6a['queueChannels'];this[_0xd49e('0x13')]=_0x282f6a[_0xd49e('0x13')];this[_0xd49e('0x14')]=_0x282f6a[_0xd49e('0x14')];this[_0xd49e('0x15')]=initializeSummary();this[_0xd49e('0x16')]={};ami['on'](_0xd49e('0x17'),this[_0xd49e('0x18')][_0xd49e('0x19')](this));ami['on']('queuesummarycomplete',this[_0xd49e('0x1a')][_0xd49e('0x19')](this));ami['on']('queuemember',this[_0xd49e('0x1b')][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x1c'),this[_0xd49e('0x1d')][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x1e'),this[_0xd49e('0x1f')][_0xd49e('0x19')](this));ami['on']('queuecallerabandon',this[_0xd49e('0x20')][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x21'),this['syncQueueCallerLeave']['bind'](this));ami['on'](_0xd49e('0x22'),this[_0xd49e('0x23')]['bind'](this));ami['on'](_0xd49e('0x24'),this[_0xd49e('0x25')][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x26'),this['syncVarSet'][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x27'),this[_0xd49e('0x28')][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x29'),this[_0xd49e('0x2a')][_0xd49e('0x19')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xd49e('0x2b'),this[_0xd49e('0x2c')][_0xd49e('0x19')](this));ami['on'](_0xd49e('0x2d'),this[_0xd49e('0x2e')]['bind'](this));ami['on'](_0xd49e('0x2f'),this[_0xd49e('0x30')][_0xd49e('0x19')](this));this[_0xd49e('0x31')]();this['loopQueueShow']();}function clearChannels(_0x9ce211){if(!_[_0xd49e('0x32')](_0x9ce211)){for(var _0x58c9ae in _0x9ce211){if(_0x9ce211[_0xd49e('0x33')](_0x58c9ae)){delete _0x9ce211[_0x58c9ae];}}}}function clearCampaigns(_0x2fce16){if(!_[_0xd49e('0x32')](_0x2fce16)){for(var _0x9d4d20 in _0x2fce16){if(_0x2fce16[_0xd49e('0x33')](_0x9d4d20)){_0x2fce16[_0x9d4d20][_0xd49e('0x34')]=0x0;}}}}function clearVoiceQueues(_0x252a03){if(!_['isEmpty'](_0x252a03)){for(var _0x423f97 in _0x252a03){if(_0x252a03[_0xd49e('0x33')](_0x423f97)){_0x252a03[_0x423f97]['originated']=0x0;_0x252a03[_0x423f97][_0xd49e('0x35')]=0x0;_0x252a03[_0x423f97][_0xd49e('0x36')]=0x0;_0x252a03[_0x423f97]['waiting']=0x0;_0x252a03[_0x423f97][_0xd49e('0x37')]=!![];}}}}function clearAgentBooked(_0x16c8d9){if(!_[_0xd49e('0x32')](_0x16c8d9)){for(var _0x1e3446 in _0x16c8d9){if(_0x16c8d9['hasOwnProperty'](_0x1e3446)){_0x16c8d9[_0x1e3446]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x10a31f){return _0x10a31f[_0xd49e('0x38')]||_0x10a31f['queuecallerabandon']||_0x10a31f[_0xd49e('0x39')];}VoiceQueueReport[_0xd49e('0xb')]['clearZombieChannels']=function(){var _0x3edf63=this;for(var _0x5696de in this[_0xd49e('0x12')]){if(this['channels']['hasOwnProperty'](_0x5696de)&&!this[_0xd49e('0x12')][_0x5696de][_0xd49e('0x3a')]){this[_0xd49e('0xf')][_0xd49e('0xc')](function(){if(!_[_0xd49e('0x3b')](_0x3edf63[_0xd49e('0x12')][_0x5696de])){return ami[_0xd49e('0x3c')]({'action':'status','channel':_0x3edf63['channels'][_0x5696de][_0xd49e('0x3d')]})[_0xd49e('0x3e')](function(_0x2fe4c2){if(_0x2fe4c2[_0xd49e('0x3f')]===_0xd49e('0x40')){setTimeout(function(){if(_0x3edf63[_0xd49e('0x12')][_0x5696de]){delete _0x3edf63[_0xd49e('0x12')][_0x5696de];logger[_0xd49e('0x41')](_0xd49e('0x42'),_0x5696de,util[_0xd49e('0x43')](_0x2fe4c2,{'showHidden':![],'depth':null}));}if(_0x3edf63['queueReports'][_0x5696de]){delete _0x3edf63[_0xd49e('0x44')][_0x5696de];logger[_0xd49e('0x41')]('[%s][voiceQueueReport][checkQueueReport]',_0x5696de,util[_0xd49e('0x43')](_0x2fe4c2,{'showHidden':![],'depth':null}));}if(_0x3edf63[_0xd49e('0x16')][_0x5696de]){delete _0x3edf63['variables'][_0x5696de];logger[_0xd49e('0x41')](_0xd49e('0x45'),_0x5696de,util[_0xd49e('0x43')](_0x2fe4c2,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0xd49e('0x2a')]=function(){logger[_0xd49e('0x41')](_0xd49e('0x46'));clearChannels(this[_0xd49e('0x12')]);this[_0xd49e('0x47')](this['queueReports']);clearAgentBooked(this[_0xd49e('0x11')]);clearVoiceQueues(this[_0xd49e('0x13')]);clearCampaigns(this[_0xd49e('0x14')]);this[_0xd49e('0x15')]=initializeSummary();};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x47')]=function(_0x713524){var _0x581fa0=this;if(!_[_0xd49e('0x32')](_0x713524)){for(var _0x593e2c in _0x713524){if(_0x713524['hasOwnProperty'](_0x593e2c)){_0x581fa0[_0xd49e('0x48')](_0x713524[_0x593e2c],'clearqueuereport');delete _0x713524[_0x593e2c];}}}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x49')]=function(_0x5ea8da,_0x990ec8,_0x32dde6){io['to'](_0x5ea8da)['emit'](_0x990ec8,_0x32dde6);};VoiceQueueReport['prototype'][_0xd49e('0x4a')]=function(_0x30d72d,_0x3ee815){logger[_0xd49e('0x4b')](_0xd49e('0x4c')+_0x3ee815+_0xd49e('0x4d'),_0x30d72d['uniqueid'],util[_0xd49e('0x43')](_0x30d72d,{'showHidden':![],'depth':null}));this[_0xd49e('0x49')](util[_0xd49e('0x4e')](_0xd49e('0x4f'),_0x30d72d[_0xd49e('0x50')]),_0xd49e('0x51'),_0x30d72d);io[_0xd49e('0x49')](_0xd49e('0x52'),_0x30d72d);};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x48')]=function(_0x4cc9e6,_0x837288){logger[_0xd49e('0x4b')]('[%s][voiceQueueReport]['+_0x837288+_0xd49e('0x53'),_0x4cc9e6[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x4cc9e6,{'showHidden':![],'depth':null}));if(_0x4cc9e6[_0xd49e('0x55')]===_0xd49e('0x56')){return;}this[_0xd49e('0x49')](util[_0xd49e('0x4e')](_0xd49e('0x4f'),_0x4cc9e6[_0xd49e('0x50')]),'voice_queue_channel:remove',_0x4cc9e6);io[_0xd49e('0x49')](_0xd49e('0x57'),_0x4cc9e6);};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x58')]=function(_0x2ac25c){if(_0x2ac25c[_0xd49e('0x59')]==='inbound'){logger[_0xd49e('0x4b')](_0xd49e('0x5a'),util[_0xd49e('0x43')](_0x2ac25c,{'showHidden':![],'depth':null}));this[_0xd49e('0x49')](util['format'](_0xd49e('0x4f'),_0x2ac25c[_0xd49e('0x5b')]),'voice_queue:save',_0x2ac25c);}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x5c')]=function(_0x54ab77){return _0x54ab77!==null&&!_[_0xd49e('0x5d')](_0x54ab77);};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x5e')]=function(){var _0x3bab39=this;setInterval(function(){_0x3bab39[_0xd49e('0x5f')]();ami[_0xd49e('0x3c')]({'action':_0xd49e('0x60')})[_0xd49e('0x3e')](function(_0xa4fee9){logger[_0xd49e('0x41')]('[voiceQueueReport][queues]',util[_0xd49e('0x43')](_0xa4fee9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd49e('0xb')]['loopQueueSummary']=function(){var _0x41594e=this;setInterval(function(){if(!_0x41594e[_0xd49e('0x15')][_0xd49e('0x61')]){return ami[_0xd49e('0x3c')]({'action':_0xd49e('0x17')})[_0xd49e('0x62')](function(_0x86700b){_0x41594e[_0xd49e('0x15')]['id']=_0x86700b[_0xd49e('0x63')];_0x41594e[_0xd49e('0x15')]['isRunning']=!![];_0x41594e[_0xd49e('0x15')]['queuestatus'][_0x86700b[_0xd49e('0x63')]]={};})['catch'](function(_0x3ca587){logger[_0xd49e('0x41')](_0xd49e('0x64'),util['inspect'](_0x3ca587,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xd49e('0xb')]['createQueueSummaryReport']=function(_0xc6b083,_0x5ac999){var _0x2ee205;if(this[_0xd49e('0x15')]&&this['summary'][_0xd49e('0x60')]&&this['summary'][_0xd49e('0x60')][_0xc6b083[_0xd49e('0x5b')]]){_0x2ee205=this['summary'][_0xd49e('0x60')][_0xc6b083[_0xd49e('0x5b')]]['summaryEvent'];}var _0x44ba3e=new VoiceQueueSummary(_0xc6b083);return _0x44ba3e[_0xd49e('0x65')](_0x5ac999[_0xd49e('0x11')],this['agents'],_0x2ee205,this[_0xd49e('0x10')][_0xd49e('0x12')]);};VoiceQueueReport['prototype']['handleInboundQueueSummaryReport']=function(_0x3ff3c4,_0x599b20){var _0x3e3823=this[_0xd49e('0x66')](_0x3ff3c4,_0x599b20);var _0x148950=![];_0x148950=_0x3e3823[_0xd49e('0x67')](_0x3ff3c4);if(_0x148950){Object[_0xd49e('0x68')](_0x3ff3c4,_0x3e3823);this[_0xd49e('0x10')][_0xd49e('0x13')][_0x3ff3c4[_0xd49e('0x5b')]]=_0x3ff3c4;this[_0xd49e('0x58')](_0x3e3823);}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x1d')]=function(_0xf0924){var _0x4cddda=null;var _0x419084=this[_0xd49e('0x15')]['id'];if(this['summary'][_0xd49e('0x69')][_0x419084]){_0x4cddda=this[_0xd49e('0x15')][_0xd49e('0x69')][_0x419084][_0xf0924[_0xd49e('0x63')]];}if(!_0x4cddda){this[_0xd49e('0x15')]=initializeSummary();return;}var _0x2f0544=this[_0xd49e('0x13')][_0x4cddda[_0xd49e('0x50')]];if(_0x2f0544[_0xd49e('0x59')]===_0xd49e('0x6a')){this[_0xd49e('0x6b')](_0x2f0544,_0x4cddda);}else if(_0x2f0544[_0xd49e('0x59')]===_0xd49e('0x6c')){var _0x31fdd2=this[_0xd49e('0x66')](_0x2f0544,_0x4cddda);ami[_0xd49e('0x49')](_0xd49e('0x6d'),_0x31fdd2);}this[_0xd49e('0x15')][_0xd49e('0x6e')]-=0x1;var _0x5b6f17=this['summary'][_0xd49e('0x6e')]>0x0?!![]:![];if(!_0x5b6f17){return this['syncQueueSummaryComplete'](this[_0xd49e('0x15')][_0xd49e('0x6f')]);}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x1b')]=function(_0x2bad50){var _0x703528=this[_0xd49e('0x15')]['id'];if(this[_0xd49e('0x15')][_0xd49e('0x69')][_0x703528]&&this[_0xd49e('0x15')][_0xd49e('0x69')][_0x703528][_0x2bad50[_0xd49e('0x63')]]){this[_0xd49e('0x15')][_0xd49e('0x69')][_0x703528][_0x2bad50[_0xd49e('0x63')]][_0xd49e('0x11')][_0xd49e('0x70')](_0x2bad50);}};VoiceQueueReport[_0xd49e('0xb')]['syncQueueSummary']=function(_0x1744f9){var _0x80463f=this;try{if(this[_0xd49e('0x5c')](_0x1744f9)&&this[_0xd49e('0x5c')](_0x1744f9['queue'])){logger[_0xd49e('0x4b')](_0xd49e('0x71'),util[_0xd49e('0x43')](_0x1744f9,{'showHidden':![],'depth':null}));var _0x2ac196=this[_0xd49e('0x13')][_0x1744f9[_0xd49e('0x50')]];if(_0x2ac196){logger[_0xd49e('0x4b')](_0xd49e('0x72'),_0x2ac196[_0xd49e('0x5b')]);this[_0xd49e('0x15')]['queues'][_0x2ac196[_0xd49e('0x5b')]]={'summaryEvent':_0x1744f9};this['summary'][_0xd49e('0x6e')]+=0x1;return ami[_0xd49e('0x3c')]({'action':'queuestatus','queue':_0x2ac196[_0xd49e('0x5b')]})['then'](function(_0x38eea7){if(!_0x80463f['summary'][_0xd49e('0x69')][_0x1744f9[_0xd49e('0x63')]]){_0x80463f['summary'][_0xd49e('0x69')][_0x1744f9[_0xd49e('0x63')]]={};}_0x80463f[_0xd49e('0x15')][_0xd49e('0x69')][_0x1744f9[_0xd49e('0x63')]][_0x38eea7['actionid']]={'queue':_0x2ac196[_0xd49e('0x5b')],'agents':[]};})['catch'](function(_0x1a9382){throw _0x1a9382;});}}}catch(_0x32f859){logger[_0xd49e('0x41')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x32f859,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')]['syncQueueSummaryComplete']=function(_0x2b263f){if(this['summary'][_0xd49e('0x6e')]>0x0){this[_0xd49e('0x15')][_0xd49e('0x6f')]=_0x2b263f;return;}logger[_0xd49e('0x4b')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xd49e('0x43')](_0x2b263f,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xd49e('0x49')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0xd49e('0x1f')]=function(_0xc77347){try{if(this[_0xd49e('0x5c')](_0xc77347)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0xc77347[_0xd49e('0x54')],util['inspect'](_0xc77347,{'showHidden':![],'depth':null}));if(_[_0xd49e('0x5d')](this['queueReports'][_0xc77347[_0xd49e('0x54')]])){this[_0xd49e('0x44')][_0xc77347['uniqueid']]=[];}if(_['isUndefined'](this[_0xd49e('0x12')][_0xc77347[_0xd49e('0x54')]])){this[_0xd49e('0x12')][_0xc77347['uniqueid']]={};}var _0xca0b6=new QueueReport();_0xca0b6[_0xd49e('0x50')]=_0xc77347[_0xd49e('0x50')];_0xca0b6[_0xd49e('0x59')]=this['voiceQueues'][_0xca0b6[_0xd49e('0x50')]]&&this[_0xd49e('0x13')][_0xca0b6['queue']]['type']?this[_0xd49e('0x13')][_0xca0b6['queue']][_0xd49e('0x59')]||_0xd49e('0x6a'):_0xd49e('0x6a');_0xca0b6[_0xd49e('0x73')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xca0b6['position']=_0xc77347[_0xd49e('0x74')];_0xca0b6[_0xd49e('0x75')]=_0xc77347[_0xd49e('0x75')];_0xca0b6[_0xd49e('0x54')]=_0xc77347[_0xd49e('0x54')];logger[_0xd49e('0x76')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0xca0b6[_0xd49e('0x50')],_0xca0b6[_0xd49e('0x59')]);Object[_0xd49e('0x68')](_0xca0b6,_[_0xd49e('0x77')](_0xc77347,_[_0xd49e('0x78')](_0xca0b6)));this[_0xd49e('0x44')][_0xc77347[_0xd49e('0x54')]][_0xd49e('0x70')](_0xca0b6);this[_0xd49e('0x12')][_0xc77347[_0xd49e('0x54')]]=_0xca0b6;this[_0xd49e('0x4a')](_0xca0b6,_0xd49e('0x1e'));}}catch(_0x1189b8){logger[_0xd49e('0x41')](_0xd49e('0x79'),_0xc77347[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x1189b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x20')]=function(_0x160ecb){try{if(this[_0xd49e('0x5c')](_0x160ecb)){logger[_0xd49e('0x4b')](_0xd49e('0x7a'),_0x160ecb[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x160ecb,{'showHidden':![],'depth':null}));if(this[_0xd49e('0x44')][_0x160ecb['uniqueid']]){var _0x2825e7=_['last'](this[_0xd49e('0x44')][_0x160ecb[_0xd49e('0x54')]]);_0x2825e7['queuecallercomplete']=![];_0x2825e7[_0xd49e('0x7b')]=null;_0x2825e7[_0xd49e('0x7c')]=_0x160ecb[_0xd49e('0x7c')];_0x2825e7[_0xd49e('0x7d')]=_0x160ecb[_0xd49e('0x7d')];_0x2825e7['queuecallerabandon']=!![];_0x2825e7[_0xd49e('0x7e')]=moment()[_0xd49e('0x4e')](_0xd49e('0x7f'));_0x2825e7['queuecallerexitreason']='ABANDONED';_0x2825e7['lastAssignedTo']=null;logger[_0xd49e('0x76')](_0xd49e('0x80'),_0x2825e7[_0xd49e('0x50')],_0x2825e7[_0xd49e('0x59')]);this[_0xd49e('0x12')][_0x160ecb[_0xd49e('0x54')]]=_0x2825e7;this[_0xd49e('0x48')](_0x2825e7,'queuecallerabandon');}}}catch(_0x4f1477){logger[_0xd49e('0x41')](_0xd49e('0x7a'),_0x160ecb['uniqueid'],util['inspect'](_0x4f1477,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')]['syncQueueCallerLeave']=function(_0x88e9c8){try{if(this[_0xd49e('0x5c')](_0x88e9c8)){logger[_0xd49e('0x4b')]('[%s][voiceQueueReport][queuecallerleave]',_0x88e9c8[_0xd49e('0x54')],util['inspect'](_0x88e9c8,{'showHidden':![],'depth':null}));if(this[_0xd49e('0x44')][_0x88e9c8[_0xd49e('0x54')]]){var _0x43a441=_[_0xd49e('0x81')](this['queueReports'][_0x88e9c8['uniqueid']]);_0x43a441[_0xd49e('0x82')]=moment()[_0xd49e('0x4e')](_0xd49e('0x7f'));_0x43a441[_0xd49e('0x83')]=_0x88e9c8[_0xd49e('0x83')];_0x43a441[_0xd49e('0x84')]=_0x88e9c8[_0xd49e('0x84')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x43a441[_0xd49e('0x50')],_0x43a441[_0xd49e('0x59')],_0x88e9c8[_0xd49e('0x83')],_0x88e9c8[_0xd49e('0x84')]);this[_0xd49e('0x12')][_0x88e9c8[_0xd49e('0x54')]]=_0x43a441;this['emitVoiceQueueChannelSave'](_0x43a441,_0xd49e('0x21'));}}}catch(_0x45eb19){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x88e9c8[_0xd49e('0x54')],util['inspect'](_0x45eb19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')]['syncAgentConnect']=function(_0x1478dc){try{if(this[_0xd49e('0x5c')](_0x1478dc)){logger[_0xd49e('0x4b')]('[%s][voiceQueueReport][agentconnect]',_0x1478dc[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x1478dc,{'showHidden':![],'depth':null}));if(this[_0xd49e('0x44')][_0x1478dc[_0xd49e('0x54')]]){var _0x53c1f5=_[_0xd49e('0x81')](this[_0xd49e('0x44')][_0x1478dc[_0xd49e('0x54')]]);_0x53c1f5[_0xd49e('0x39')]=!![];_0x53c1f5[_0xd49e('0x55')]=_0xd49e('0x85');logger[_0xd49e('0x76')](_0xd49e('0x86'),_0x53c1f5[_0xd49e('0x50')],_0x53c1f5[_0xd49e('0x59')]);}}}catch(_0x3ca88b){logger[_0xd49e('0x41')](_0xd49e('0x87'),_0x1478dc[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x3ca88b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')]['syncAgentComplete']=function(_0x5ad702){try{if(this[_0xd49e('0x5c')](_0x5ad702)){logger[_0xd49e('0x4b')](_0xd49e('0x88'),_0x5ad702[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x5ad702,{'showHidden':![],'depth':null}));if(this[_0xd49e('0x44')][_0x5ad702[_0xd49e('0x54')]]){var _0x490c82=_[_0xd49e('0x81')](this['queueReports'][_0x5ad702['uniqueid']]);_0x490c82[_0xd49e('0x89')]=![];_0x490c82['queuecallerabandonAt']=null;_0x490c82['assigned']=!![];_0x490c82['lastAssignedTo']=_0x5ad702[_0xd49e('0x8a')];_0x490c82[_0xd49e('0x7c')]=_0x5ad702[_0xd49e('0x7c')];_0x490c82[_0xd49e('0x39')]=!![];_0x490c82['queuecallerexit']=![];_0x490c82[_0xd49e('0x8b')]=null;if(!_0x490c82['transfer']){if(_0x5ad702[_0xd49e('0x8c')]==_0xd49e('0x8d')){_0x490c82['queuecallerexitreason']='COMPLETED';logger[_0xd49e('0x76')](_0xd49e('0x8e'),_0x490c82[_0xd49e('0x50')],_0x490c82[_0xd49e('0x59')]);}else{if(_[_0xd49e('0x8f')](_0x5ad702['channel']['toLowerCase'](),'local/')){if(this['queueReports'][_0x5ad702[_0xd49e('0x90')]]){var _0x2be022=_[_0xd49e('0x81')](this[_0xd49e('0x44')][_0x5ad702[_0xd49e('0x90')]]);_0x2be022[_0xd49e('0x39')]=![];_0x2be022[_0xd49e('0x38')]=!![];_0x2be022[_0xd49e('0x8b')]=moment(_0x490c82['queuecallerjoinAt'])[_0xd49e('0x91')](_0x5ad702[_0xd49e('0x7c')],_0xd49e('0x92'))[_0xd49e('0x4e')](_0xd49e('0x7f'));_0x2be022[_0xd49e('0x55')]=_0xd49e('0x93');_0x2be022[_0xd49e('0x8d')]=!![];_0x2be022[_0xd49e('0x94')]=_0xd49e('0x95');_0x2be022[_0xd49e('0x96')]=_0x5ad702[_0xd49e('0x97')];_0x2be022['transferuniqueid']=_0x5ad702[_0xd49e('0x54')];logger[_0xd49e('0x76')](_0xd49e('0x98'),_0x2be022[_0xd49e('0x50')],_0x2be022['type']);var _0x535b11=this[_0xd49e('0x44')][_0x5ad702[_0xd49e('0x90')]];this[_0xd49e('0x44')][_0x5ad702[_0xd49e('0x90')]]=this['queueReports'][_0x5ad702[_0xd49e('0x54')]];this[_0xd49e('0x44')][_0x5ad702[_0xd49e('0x54')]]=_0x535b11;}}else{_0x490c82[_0xd49e('0x55')]='COMPLETEDBY'+_0x5ad702[_0xd49e('0x8c')]['toUpperCase']();logger[_0xd49e('0x76')](_0xd49e('0x99'),_0x490c82[_0xd49e('0x50')],_0x490c82[_0xd49e('0x59')],_0x490c82[_0xd49e('0x55')]);}}}this[_0xd49e('0x12')][_0x5ad702[_0xd49e('0x54')]]=_0x490c82;}}}catch(_0x100899){logger[_0xd49e('0x41')]('[%s][voiceQueueReport][agentcomplete]',_0x5ad702[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x100899,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0x9a')]=function(_0x1f5723){try{if(this['isNotNull'](_0x1f5723)){logger[_0xd49e('0x4b')](_0xd49e('0x9b'),_0x1f5723[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x1f5723,{'showHidden':![],'depth':null}));this[_0xd49e('0x9c')](_0x1f5723['uniqueid'],_[_0xd49e('0x78')](_0x1f5723[_0xd49e('0x9d')])[0x0],_0x1f5723['value']);if(this['queueReports'][_0x1f5723['uniqueid']]){var _0x25f6b9=_[_0xd49e('0x81')](this[_0xd49e('0x44')][_0x1f5723['uniqueid']]);if(_0x25f6b9){if(this[_0xd49e('0x5c')](_0x1f5723[_0xd49e('0x9d')])&&this[_0xd49e('0x5c')](_0x1f5723[_0xd49e('0x9d')][_0xd49e('0x69')])){switch(_0x1f5723[_0xd49e('0x9e')]){case _0xd49e('0x9f'):_0x25f6b9[_0xd49e('0x38')]=![];_0x25f6b9[_0xd49e('0x8b')]=null;break;case _0xd49e('0xa0'):_0x25f6b9[_0xd49e('0xa1')]=_0xd49e('0xa2');_0x25f6b9['queuecallerexit']=!![];_0x25f6b9['queuecallerexitAt']=moment()[_0xd49e('0x4e')](_0xd49e('0x7f'));_0x25f6b9[_0xd49e('0x82')]=moment()['format'](_0xd49e('0x7f'));logger[_0xd49e('0x4b')](_0xd49e('0xa3'),_0x1f5723[_0xd49e('0x54')],util[_0xd49e('0x43')](_0x25f6b9,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x25f6b9);break;default:_0x25f6b9[_0xd49e('0x38')]=!![];_0x25f6b9[_0xd49e('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x25f6b9[_0xd49e('0x82')]=moment()['format'](_0xd49e('0x7f'));}_0x25f6b9[_0xd49e('0x89')]=![];_0x25f6b9[_0xd49e('0x7e')]=null;_0x25f6b9[_0xd49e('0x55')]=_0x1f5723['value'];this[_0xd49e('0x12')][_0x1f5723[_0xd49e('0x54')]]=_0x25f6b9;this[_0xd49e('0x48')](_0x25f6b9,_0xd49e('0x26'));}else if(this[_0xd49e('0x5c')](_0x1f5723['variable'])&&this[_0xd49e('0x5c')](_0x1f5723[_0xd49e('0x9d')][_0xd49e('0xa4')])){if(!_0x25f6b9[_0xd49e('0x89')]){_0x25f6b9[_0xd49e('0x38')]=!![];_0x25f6b9['queuecallerexitAt']=moment()[_0xd49e('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x25f6b9[_0xd49e('0x55')]=_0xd49e('0xa5');_0x25f6b9['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1f5723[_0xd49e('0x54')]]=_0x25f6b9;}}logger[_0xd49e('0x76')](_0xd49e('0xa6'),_0x1f5723[_0xd49e('0x54')],_0x25f6b9[_0xd49e('0x50')],_0x25f6b9['type'],_[_0xd49e('0x78')](_0x1f5723[_0xd49e('0x9d')])[0x0],_0x1f5723[_0xd49e('0x9e')]);_0x25f6b9[_0xd49e('0x16')]=this[_0xd49e('0x16')][_0x1f5723[_0xd49e('0x54')]];}}}}catch(_0x141b95){logger['error']('[%s][voiceQueueReport][varset]',_0x1f5723[_0xd49e('0x54')],util['inspect'](_0x141b95,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd49e('0xb')]['addVariable']=function(_0x30a11c,_0x2e9848,_0xff30ef){var _0x1fc761=[_0xd49e('0xa7'),_0xd49e('0xa8'),_0xd49e('0xa9'),_0xd49e('0xaa'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0xd49e('0xab'),_0xd49e('0xac'),_0xd49e('0xad'),'bridgepeer',_0xd49e('0xae'),_0xd49e('0xaf'),_0xd49e('0xb0'),_0xd49e('0xb1'),_0xd49e('0xb2'),_0xd49e('0x8a'),'memberpenalty',_0xd49e('0xb3')];if(!_[_0xd49e('0x3b')](_0x2e9848)&&!_[_0xd49e('0xb4')](_0x1fc761,_0x2e9848)){if(_[_0xd49e('0x5d')](this[_0xd49e('0x16')][_0x30a11c])){this[_0xd49e('0x16')][_0x30a11c]={};}this[_0xd49e('0x16')][_0x30a11c][_0x2e9848]=_0xff30ef;}};VoiceQueueReport[_0xd49e('0xb')][_0xd49e('0xb5')]=function(_0x474951,_0x2adf41,_0x354fb0){try{var _0xc30b70={};if(this[_0xd49e('0x44')][_0x474951]){for(var _0x2d04aa=0x0;_0x2d04aa{delete this[_0xd49e('0x12')][_0xbf14d];},_0x543507);}};module[_0xd49e('0xe8')]=VoiceQueueReport; \ No newline at end of file +var _0xca79=['[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','Action','queues','[voiceQueueReport][queues]','isRunning','queuesummary','queuestatus','[voiceQueueReport][queuesummary]','summaryEvent','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','actionid','inbound','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','queuecallerleaveAt','connectedlinename','connectedlinenum','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','info','syncAgentComplete','assigned','membername','queuecallerexit','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','queuecallerjoinAt','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','sumHoldTime','ATTENDEDTRANSFER','length','milliseconds','diff','total','answered','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','switch','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','application','appdata','applicationdata','cdr(','split','exports','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','defaults','localhost','redis','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','originated','isEmpty','talking','pTalking','waiting','unlockRR','queuecallerabandon','queuecallercomplete','clearZombieChannels','isNil','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][','uniqueid','format','voice:queue:%s','queue','voice_queue_presence:save','debug',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type'];(function(_0x569d81,_0xa7b4c7){var _0x172cf0=function(_0x436a01){while(--_0x436a01){_0x569d81['push'](_0x569d81['shift']());}};_0x172cf0(++_0xa7b4c7);}(_0xca79,0x99));var _0x9ca7=function(_0xcad337,_0xe6d7d3){_0xcad337=_0xcad337-0x0;var _0x1bd207=_0xca79[_0xcad337];return _0x1bd207;};'use strict';var _=require(_0x9ca7('0x0'));var moment=require(_0x9ca7('0x1'));var util=require(_0x9ca7('0x2'));var Redis=require(_0x9ca7('0x3'));var config=require('../../../config/environment');var logger=require(_0x9ca7('0x4'))(_0x9ca7('0x5'));var ami=require(_0x9ca7('0x6'));var QueueReport=require(_0x9ca7('0x7'));var VoiceQueueSummary=require(_0x9ca7('0x8'));config['redis']=_[_0x9ca7('0x9')](config['redis'],{'host':_0x9ca7('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ca7('0xb')]));var Sequence=function(){};Sequence[_0x9ca7('0xc')][_0x9ca7('0xd')]=function(_0x535438){this[_0x9ca7('0xe')]=this['tail']?this[_0x9ca7('0xe')][_0x9ca7('0xf')](_0x535438):_0x535438();};function VoiceQueueReport(_0x1d6ff5){this[_0x9ca7('0x10')]=new Sequence();this[_0x9ca7('0x11')]={};this[_0x9ca7('0x12')]=_0x1d6ff5;this['agents']=_0x1d6ff5[_0x9ca7('0x13')];this[_0x9ca7('0x14')]=_0x1d6ff5[_0x9ca7('0x15')];this['voiceQueues']=_0x1d6ff5[_0x9ca7('0x16')];this['campaigns']=_0x1d6ff5[_0x9ca7('0x17')];this[_0x9ca7('0x18')]=initializeSummary();this[_0x9ca7('0x19')]={};ami['on']('queuesummary',this[_0x9ca7('0x1a')]['bind'](this));ami['on'](_0x9ca7('0x1b'),this[_0x9ca7('0x1c')][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x1e'),this[_0x9ca7('0x1f')][_0x9ca7('0x1d')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));ami['on'](_0x9ca7('0x20'),this[_0x9ca7('0x21')][_0x9ca7('0x1d')](this));ami['on']('queuecallerabandon',this[_0x9ca7('0x22')][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x23'),this['syncQueueCallerLeave'][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x24'),this['syncAgentComplete'][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x25'),this[_0x9ca7('0x26')][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x27'),this[_0x9ca7('0x28')]['bind'](this));ami['on'](_0x9ca7('0x29'),this[_0x9ca7('0x2a')][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x2b'),this[_0x9ca7('0x2c')]['bind'](this));ami['on']('musiconholdstart',this[_0x9ca7('0x2d')][_0x9ca7('0x1d')](this));ami['on'](_0x9ca7('0x2e'),this[_0x9ca7('0x2f')][_0x9ca7('0x1d')](this));ami['on']('attendedtransfer',this[_0x9ca7('0x30')][_0x9ca7('0x1d')](this));ami['on']('blindtransfer',this['syncBlindTransfer']['bind'](this));this[_0x9ca7('0x31')]();this[_0x9ca7('0x32')]();}function clearChannels(_0x500d77){if(!_['isEmpty'](_0x500d77)){for(var _0x182079 in _0x500d77){if(_0x500d77[_0x9ca7('0x33')](_0x182079)){delete _0x500d77[_0x182079];}}}}function clearCampaigns(_0x123da2){if(!_['isEmpty'](_0x123da2)){for(var _0x25226d in _0x123da2){if(_0x123da2[_0x9ca7('0x33')](_0x25226d)){_0x123da2[_0x25226d][_0x9ca7('0x34')]=0x0;}}}}function clearVoiceQueues(_0x1f5cf8){if(!_[_0x9ca7('0x35')](_0x1f5cf8)){for(var _0x1f6ea0 in _0x1f5cf8){if(_0x1f5cf8[_0x9ca7('0x33')](_0x1f6ea0)){_0x1f5cf8[_0x1f6ea0][_0x9ca7('0x34')]=0x0;_0x1f5cf8[_0x1f6ea0][_0x9ca7('0x36')]=0x0;_0x1f5cf8[_0x1f6ea0][_0x9ca7('0x37')]=0x0;_0x1f5cf8[_0x1f6ea0][_0x9ca7('0x38')]=0x0;_0x1f5cf8[_0x1f6ea0]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x597748){if(!_[_0x9ca7('0x35')](_0x597748)){for(var _0x5bc409 in _0x597748){if(_0x597748[_0x9ca7('0x33')](_0x5bc409)){_0x597748[_0x5bc409][_0x9ca7('0x39')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x1dc175){return _0x1dc175['queuecallerexit']||_0x1dc175[_0x9ca7('0x3a')]||_0x1dc175[_0x9ca7('0x3b')];}VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x3c')]=function(){var _0x172349=this;for(var _0x2886ca in this[_0x9ca7('0x14')]){if(this[_0x9ca7('0x14')]['hasOwnProperty'](_0x2886ca)&&!this[_0x9ca7('0x14')][_0x2886ca]['switch']){this[_0x9ca7('0x10')][_0x9ca7('0xd')](function(){if(!_[_0x9ca7('0x3d')](_0x172349[_0x9ca7('0x14')][_0x2886ca])){return ami['Action']({'action':_0x9ca7('0x3e'),'channel':_0x172349['channels'][_0x2886ca][_0x9ca7('0x3f')]})[_0x9ca7('0x40')](function(_0x304bd6){if(_0x304bd6[_0x9ca7('0x41')]===_0x9ca7('0x42')){setTimeout(function(){if(_0x172349['channels'][_0x2886ca]){delete _0x172349['channels'][_0x2886ca];logger[_0x9ca7('0x43')](_0x9ca7('0x44'),_0x2886ca,util[_0x9ca7('0x45')](_0x304bd6,{'showHidden':![],'depth':null}));}if(_0x172349[_0x9ca7('0x11')][_0x2886ca]){delete _0x172349[_0x9ca7('0x11')][_0x2886ca];logger[_0x9ca7('0x43')](_0x9ca7('0x46'),_0x2886ca,util[_0x9ca7('0x45')](_0x304bd6,{'showHidden':![],'depth':null}));}if(_0x172349['variables'][_0x2886ca]){delete _0x172349[_0x9ca7('0x19')][_0x2886ca];logger[_0x9ca7('0x43')](_0x9ca7('0x47'),_0x2886ca,util['inspect'](_0x304bd6,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x2c')]=function(){logger['error'](_0x9ca7('0x48'));clearChannels(this[_0x9ca7('0x14')]);this['clearQueueReport'](this[_0x9ca7('0x11')]);clearAgentBooked(this[_0x9ca7('0x13')]);clearVoiceQueues(this[_0x9ca7('0x16')]);clearCampaigns(this[_0x9ca7('0x17')]);this['summary']=initializeSummary();};VoiceQueueReport['prototype'][_0x9ca7('0x49')]=function(_0x2861cf){var _0x2fb9ce=this;if(!_['isEmpty'](_0x2861cf)){for(var _0x4e6e00 in _0x2861cf){if(_0x2861cf[_0x9ca7('0x33')](_0x4e6e00)){_0x2fb9ce[_0x9ca7('0x4a')](_0x2861cf[_0x4e6e00],_0x9ca7('0x4b'));delete _0x2861cf[_0x4e6e00];}}}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x4c')]=function(_0x77146e,_0x5685dd,_0x5d27f1){io['to'](_0x77146e)[_0x9ca7('0x4c')](_0x5685dd,_0x5d27f1);};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x4d')]=function(_0x36d278,_0x5a60e7){logger['debug'](_0x9ca7('0x4e')+_0x5a60e7+']\x20sending\x20voice_queue_channel:save\x20event:',_0x36d278[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x36d278,{'showHidden':![],'depth':null}));this[_0x9ca7('0x4c')](util[_0x9ca7('0x50')](_0x9ca7('0x51'),_0x36d278[_0x9ca7('0x52')]),'voice_queue_channel:save',_0x36d278);io['emit'](_0x9ca7('0x53'),_0x36d278);};VoiceQueueReport[_0x9ca7('0xc')]['emitVoiceQueueChannelRemove']=function(_0x2a6b7a,_0x2bfbe8){logger[_0x9ca7('0x54')](_0x9ca7('0x4e')+_0x2bfbe8+_0x9ca7('0x55'),_0x2a6b7a[_0x9ca7('0x4f')],util['inspect'](_0x2a6b7a,{'showHidden':![],'depth':null}));if(_0x2a6b7a[_0x9ca7('0x56')]==='ATTENDEDTRANSFER'){return;}this[_0x9ca7('0x4c')](util[_0x9ca7('0x50')](_0x9ca7('0x51'),_0x2a6b7a['queue']),_0x9ca7('0x57'),_0x2a6b7a);io['emit'](_0x9ca7('0x58'),_0x2a6b7a);};VoiceQueueReport['prototype'][_0x9ca7('0x59')]=function(_0x57a4e4){if(_0x57a4e4[_0x9ca7('0x5a')]==='inbound'){logger[_0x9ca7('0x54')](_0x9ca7('0x5b'),util[_0x9ca7('0x45')](_0x57a4e4,{'showHidden':![],'depth':null}));this['emit'](util[_0x9ca7('0x50')](_0x9ca7('0x51'),_0x57a4e4[_0x9ca7('0x5c')]),_0x9ca7('0x5d'),_0x57a4e4);}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x5e')]=function(_0x2b9eb7){return _0x2b9eb7!==null&&!_['isUndefined'](_0x2b9eb7);};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x32')]=function(){var _0xd7f9b3=this;setInterval(function(){_0xd7f9b3[_0x9ca7('0x3c')]();ami[_0x9ca7('0x5f')]({'action':_0x9ca7('0x60')})[_0x9ca7('0x40')](function(_0x54a094){logger['error'](_0x9ca7('0x61'),util[_0x9ca7('0x45')](_0x54a094,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x31')]=function(){var _0x40dc64=this;setInterval(function(){if(!_0x40dc64['summary'][_0x9ca7('0x62')]){return ami['Action']({'action':_0x9ca7('0x63')})['then'](function(_0x22faf3){_0x40dc64[_0x9ca7('0x18')]['id']=_0x22faf3['actionid'];_0x40dc64[_0x9ca7('0x18')]['isRunning']=!![];_0x40dc64['summary'][_0x9ca7('0x64')][_0x22faf3['actionid']]={};})['catch'](function(_0x5d92c8){logger[_0x9ca7('0x43')](_0x9ca7('0x65'),util[_0x9ca7('0x45')](_0x5d92c8,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x33e20c,_0x3fba5e){var _0x554660;if(this[_0x9ca7('0x18')]&&this[_0x9ca7('0x18')]['queues']&&this[_0x9ca7('0x18')]['queues'][_0x33e20c[_0x9ca7('0x5c')]]){_0x554660=this[_0x9ca7('0x18')][_0x9ca7('0x60')][_0x33e20c[_0x9ca7('0x5c')]][_0x9ca7('0x66')];}var _0x915635=new VoiceQueueSummary(_0x33e20c);return _0x915635['createReport'](_0x3fba5e['agents'],this[_0x9ca7('0x13')],_0x554660,this[_0x9ca7('0x12')]['channels']);};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x67')]=function(_0xaf574f,_0x5d805d){var _0x46bdd5=this[_0x9ca7('0x68')](_0xaf574f,_0x5d805d);var _0x5abb25=![];_0x5abb25=_0x46bdd5[_0x9ca7('0x69')](_0xaf574f);if(_0x5abb25){Object[_0x9ca7('0x6a')](_0xaf574f,_0x46bdd5);this[_0x9ca7('0x12')][_0x9ca7('0x16')][_0xaf574f['name']]=_0xaf574f;this[_0x9ca7('0x59')](_0x46bdd5);}};VoiceQueueReport[_0x9ca7('0xc')]['syncQueueStatusComplete']=function(_0x4dee2a){var _0xbb568f=null;var _0x2da9dd=this[_0x9ca7('0x18')]['id'];if(this['summary'][_0x9ca7('0x64')][_0x2da9dd]){_0xbb568f=this[_0x9ca7('0x18')][_0x9ca7('0x64')][_0x2da9dd][_0x4dee2a[_0x9ca7('0x6b')]];}if(!_0xbb568f){this['summary']=initializeSummary();return;}var _0x1568f0=this['voiceQueues'][_0xbb568f[_0x9ca7('0x52')]];if(_0x1568f0['type']===_0x9ca7('0x6c')){this[_0x9ca7('0x67')](_0x1568f0,_0xbb568f);}else if(_0x1568f0['type']===_0x9ca7('0x6d')){var _0x8ea4a9=this['createQueueSummaryReport'](_0x1568f0,_0xbb568f);ami[_0x9ca7('0x4c')](_0x9ca7('0x6e'),_0x8ea4a9);}this[_0x9ca7('0x18')][_0x9ca7('0x6f')]-=0x1;var _0x5a0ab0=this[_0x9ca7('0x18')][_0x9ca7('0x6f')]>0x0?!![]:![];if(!_0x5a0ab0){return this[_0x9ca7('0x1c')](this[_0x9ca7('0x18')][_0x9ca7('0x70')]);}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x1f')]=function(_0x463743){var _0xbe90ba=this[_0x9ca7('0x18')]['id'];if(this[_0x9ca7('0x18')]['queuestatus'][_0xbe90ba]&&this[_0x9ca7('0x18')]['queuestatus'][_0xbe90ba][_0x463743[_0x9ca7('0x6b')]]){this[_0x9ca7('0x18')][_0x9ca7('0x64')][_0xbe90ba][_0x463743[_0x9ca7('0x6b')]][_0x9ca7('0x13')][_0x9ca7('0x71')](_0x463743);}};VoiceQueueReport[_0x9ca7('0xc')]['syncQueueSummary']=function(_0x375f9e){var _0x43878a=this;try{if(this[_0x9ca7('0x5e')](_0x375f9e)&&this[_0x9ca7('0x5e')](_0x375f9e[_0x9ca7('0x52')])){logger[_0x9ca7('0x54')](_0x9ca7('0x72'),util[_0x9ca7('0x45')](_0x375f9e,{'showHidden':![],'depth':null}));var _0x3df73e=this[_0x9ca7('0x16')][_0x375f9e[_0x9ca7('0x52')]];if(_0x3df73e){logger[_0x9ca7('0x54')](_0x9ca7('0x73'),_0x3df73e[_0x9ca7('0x5c')]);this['summary']['queues'][_0x3df73e[_0x9ca7('0x5c')]]={'summaryEvent':_0x375f9e};this[_0x9ca7('0x18')][_0x9ca7('0x6f')]+=0x1;return ami['Action']({'action':'queuestatus','queue':_0x3df73e[_0x9ca7('0x5c')]})['then'](function(_0x485f68){if(!_0x43878a['summary']['queuestatus'][_0x375f9e[_0x9ca7('0x6b')]]){_0x43878a[_0x9ca7('0x18')][_0x9ca7('0x64')][_0x375f9e[_0x9ca7('0x6b')]]={};}_0x43878a[_0x9ca7('0x18')][_0x9ca7('0x64')][_0x375f9e[_0x9ca7('0x6b')]][_0x485f68['actionid']]={'queue':_0x3df73e[_0x9ca7('0x5c')],'agents':[]};})[_0x9ca7('0x40')](function(_0xc32982){throw _0xc32982;});}}}catch(_0x81a6){logger[_0x9ca7('0x43')](_0x9ca7('0x65'),util[_0x9ca7('0x45')](_0x81a6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x1c')]=function(_0x271ef9){if(this['summary']['statusRequests']>0x0){this[_0x9ca7('0x18')][_0x9ca7('0x70')]=_0x271ef9;return;}logger['debug'](_0x9ca7('0x74'),util[_0x9ca7('0x45')](_0x271ef9,{'showHidden':![],'depth':null}));this[_0x9ca7('0x18')]=initializeSummary();ami[_0x9ca7('0x4c')](_0x9ca7('0x75'),{});};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x21')]=function(_0x228e70){try{if(this[_0x9ca7('0x5e')](_0x228e70)){logger[_0x9ca7('0x54')](_0x9ca7('0x76'),_0x228e70[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x228e70,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9ca7('0x11')][_0x228e70['uniqueid']])){this[_0x9ca7('0x11')][_0x228e70[_0x9ca7('0x4f')]]=[];}if(_[_0x9ca7('0x77')](this['channels'][_0x228e70['uniqueid']])){this[_0x9ca7('0x14')][_0x228e70['uniqueid']]={};}var _0x3a1b16=new QueueReport();_0x3a1b16[_0x9ca7('0x52')]=_0x228e70['queue'];_0x3a1b16[_0x9ca7('0x5a')]=this[_0x9ca7('0x16')][_0x3a1b16['queue']]&&this[_0x9ca7('0x16')][_0x3a1b16[_0x9ca7('0x52')]][_0x9ca7('0x5a')]?this[_0x9ca7('0x16')][_0x3a1b16[_0x9ca7('0x52')]][_0x9ca7('0x5a')]||'inbound':_0x9ca7('0x6c');_0x3a1b16['queuecallerjoinAt']=moment()['format'](_0x9ca7('0x78'));_0x3a1b16[_0x9ca7('0x79')]=_0x228e70[_0x9ca7('0x79')];_0x3a1b16[_0x9ca7('0x7a')]=_0x228e70[_0x9ca7('0x7a')];_0x3a1b16[_0x9ca7('0x4f')]=_0x228e70[_0x9ca7('0x4f')];logger['info'](_0x9ca7('0x7b'),_0x3a1b16[_0x9ca7('0x52')],_0x3a1b16[_0x9ca7('0x5a')]);Object[_0x9ca7('0x6a')](_0x3a1b16,_['pick'](_0x228e70,_['keys'](_0x3a1b16)));this[_0x9ca7('0x11')][_0x228e70[_0x9ca7('0x4f')]]['push'](_0x3a1b16);this[_0x9ca7('0x14')][_0x228e70[_0x9ca7('0x4f')]]=_0x3a1b16;this[_0x9ca7('0x4d')](_0x3a1b16,_0x9ca7('0x20'));}}catch(_0x291ec8){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x228e70[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x291ec8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x22')]=function(_0x53c67e){try{if(this[_0x9ca7('0x5e')](_0x53c67e)){logger[_0x9ca7('0x54')](_0x9ca7('0x7c'),_0x53c67e[_0x9ca7('0x4f')],util['inspect'](_0x53c67e,{'showHidden':![],'depth':null}));if(this[_0x9ca7('0x11')][_0x53c67e[_0x9ca7('0x4f')]]){var _0x148fe7=_[_0x9ca7('0x7d')](this[_0x9ca7('0x11')][_0x53c67e[_0x9ca7('0x4f')]]);_0x148fe7[_0x9ca7('0x3b')]=![];_0x148fe7[_0x9ca7('0x7e')]=null;_0x148fe7[_0x9ca7('0x7f')]=_0x53c67e[_0x9ca7('0x7f')];_0x148fe7[_0x9ca7('0x80')]=_0x53c67e['originalposition'];_0x148fe7[_0x9ca7('0x3a')]=!![];_0x148fe7[_0x9ca7('0x81')]=moment()['format'](_0x9ca7('0x78'));_0x148fe7[_0x9ca7('0x56')]='ABANDONED';_0x148fe7[_0x9ca7('0x82')]=null;logger['info'](_0x9ca7('0x83'),_0x148fe7[_0x9ca7('0x52')],_0x148fe7[_0x9ca7('0x5a')]);this['channels'][_0x53c67e[_0x9ca7('0x4f')]]=_0x148fe7;this[_0x9ca7('0x4a')](_0x148fe7,_0x9ca7('0x3a'));}}}catch(_0x49eab3){logger['error'](_0x9ca7('0x7c'),_0x53c67e[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x49eab3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x84')]=function(_0x4f192a){try{if(this[_0x9ca7('0x5e')](_0x4f192a)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x4f192a['uniqueid'],util[_0x9ca7('0x45')](_0x4f192a,{'showHidden':![],'depth':null}));if(this[_0x9ca7('0x11')][_0x4f192a[_0x9ca7('0x4f')]]){var _0xbaced9=_[_0x9ca7('0x7d')](this['queueReports'][_0x4f192a['uniqueid']]);_0xbaced9[_0x9ca7('0x85')]=moment()[_0x9ca7('0x50')](_0x9ca7('0x78'));_0xbaced9['connectedlinenum']=_0x4f192a['connectedlinenum'];_0xbaced9['connectedlinename']=_0x4f192a[_0x9ca7('0x86')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0xbaced9['queue'],_0xbaced9[_0x9ca7('0x5a')],_0x4f192a[_0x9ca7('0x87')],_0x4f192a[_0x9ca7('0x86')]);this[_0x9ca7('0x14')][_0x4f192a[_0x9ca7('0x4f')]]=_0xbaced9;this[_0x9ca7('0x4d')](_0xbaced9,'queuecallerleave');}}}catch(_0x15d4b6){logger['error'](_0x9ca7('0x88'),_0x4f192a[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x15d4b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x26')]=function(_0x1ba62c){try{if(this[_0x9ca7('0x5e')](_0x1ba62c)){logger[_0x9ca7('0x54')](_0x9ca7('0x89'),_0x1ba62c['uniqueid'],util[_0x9ca7('0x45')](_0x1ba62c,{'showHidden':![],'depth':null}));if(this[_0x9ca7('0x11')][_0x1ba62c[_0x9ca7('0x4f')]]){var _0x4e889a=_['last'](this[_0x9ca7('0x11')][_0x1ba62c[_0x9ca7('0x4f')]]);_0x4e889a['queuecallercomplete']=!![];_0x4e889a[_0x9ca7('0x56')]=_0x9ca7('0x8a');logger[_0x9ca7('0x8b')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4e889a[_0x9ca7('0x52')],_0x4e889a[_0x9ca7('0x5a')]);}}}catch(_0x36d18b){logger[_0x9ca7('0x43')](_0x9ca7('0x89'),_0x1ba62c[_0x9ca7('0x4f')],util['inspect'](_0x36d18b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')][_0x9ca7('0x8c')]=function(_0x4c7366){try{if(this[_0x9ca7('0x5e')](_0x4c7366)){logger[_0x9ca7('0x54')]('[%s][voiceQueueReport][agentcomplete]',_0x4c7366[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x4c7366,{'showHidden':![],'depth':null}));if(this[_0x9ca7('0x11')][_0x4c7366[_0x9ca7('0x4f')]]){var _0x11b810=_[_0x9ca7('0x7d')](this[_0x9ca7('0x11')][_0x4c7366[_0x9ca7('0x4f')]]);_0x11b810[_0x9ca7('0x3a')]=![];_0x11b810[_0x9ca7('0x81')]=null;_0x11b810[_0x9ca7('0x8d')]=!![];_0x11b810[_0x9ca7('0x82')]=_0x4c7366[_0x9ca7('0x8e')];_0x11b810[_0x9ca7('0x7f')]=_0x4c7366[_0x9ca7('0x7f')];_0x11b810[_0x9ca7('0x3b')]=!![];_0x11b810[_0x9ca7('0x8f')]=![];_0x11b810['queuecallerexitAt']=null;if(!_0x11b810[_0x9ca7('0x90')]){if(_0x4c7366[_0x9ca7('0x91')]==_0x9ca7('0x90')){_0x11b810['queuecallerexitreason']=_0x9ca7('0x92');logger[_0x9ca7('0x8b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x11b810['queue'],_0x11b810[_0x9ca7('0x5a')]);}else{if(_[_0x9ca7('0x93')](_0x4c7366[_0x9ca7('0x3f')][_0x9ca7('0x94')](),_0x9ca7('0x95'))){if(this['queueReports'][_0x4c7366[_0x9ca7('0x96')]]){var _0x46f84c=_[_0x9ca7('0x7d')](this[_0x9ca7('0x11')][_0x4c7366[_0x9ca7('0x96')]]);_0x46f84c[_0x9ca7('0x3b')]=![];_0x46f84c[_0x9ca7('0x8f')]=!![];_0x46f84c[_0x9ca7('0x97')]=moment(_0x11b810[_0x9ca7('0x98')])['add'](_0x4c7366[_0x9ca7('0x7f')],_0x9ca7('0x99'))[_0x9ca7('0x50')](_0x9ca7('0x78'));_0x46f84c['queuecallerexitreason']=_0x9ca7('0x9a');_0x46f84c[_0x9ca7('0x90')]=!![];_0x46f84c[_0x9ca7('0x9b')]=_0x9ca7('0x9c');_0x46f84c[_0x9ca7('0x9d')]=_0x4c7366[_0x9ca7('0x9e')];_0x46f84c[_0x9ca7('0x9f')]=_0x4c7366[_0x9ca7('0x4f')];logger[_0x9ca7('0x8b')](_0x9ca7('0xa0'),_0x46f84c['queue'],_0x46f84c[_0x9ca7('0x5a')]);var _0x148608=this['queueReports'][_0x4c7366[_0x9ca7('0x96')]];this['queueReports'][_0x4c7366[_0x9ca7('0x96')]]=this[_0x9ca7('0x11')][_0x4c7366[_0x9ca7('0x4f')]];this[_0x9ca7('0x11')][_0x4c7366['uniqueid']]=_0x148608;}}else{_0x11b810[_0x9ca7('0x56')]=_0x9ca7('0xa1')+_0x4c7366['reason']['toUpperCase']();logger[_0x9ca7('0x8b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x11b810[_0x9ca7('0x52')],_0x11b810[_0x9ca7('0x5a')],_0x11b810[_0x9ca7('0x56')]);}}}this[_0x9ca7('0x14')][_0x4c7366[_0x9ca7('0x4f')]]=_0x11b810;}}}catch(_0x5c4690){logger[_0x9ca7('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x4c7366[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x5c4690,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')]['syncVarSet']=function(_0x3fd5b2){try{if(this[_0x9ca7('0x5e')](_0x3fd5b2)){logger[_0x9ca7('0x54')](_0x9ca7('0xa2'),_0x3fd5b2['uniqueid'],util[_0x9ca7('0x45')](_0x3fd5b2,{'showHidden':![],'depth':null}));this[_0x9ca7('0xa3')](_0x3fd5b2[_0x9ca7('0x4f')],_[_0x9ca7('0xa4')](_0x3fd5b2[_0x9ca7('0xa5')])[0x0],_0x3fd5b2['value']);if(this[_0x9ca7('0x11')][_0x3fd5b2[_0x9ca7('0x4f')]]){var _0x5dde4d=_[_0x9ca7('0x7d')](this[_0x9ca7('0x11')][_0x3fd5b2[_0x9ca7('0x4f')]]);if(_0x5dde4d){if(this[_0x9ca7('0x5e')](_0x3fd5b2['variable'])&&this[_0x9ca7('0x5e')](_0x3fd5b2['variable'][_0x9ca7('0x64')])){switch(_0x3fd5b2[_0x9ca7('0xa6')]){case'CONTINUE':_0x5dde4d[_0x9ca7('0x8f')]=![];_0x5dde4d[_0x9ca7('0x97')]=null;break;case _0x9ca7('0xa7'):_0x5dde4d[_0x9ca7('0xa8')]=_0x9ca7('0xa9');_0x5dde4d[_0x9ca7('0x8f')]=!![];_0x5dde4d[_0x9ca7('0x97')]=moment()[_0x9ca7('0x50')](_0x9ca7('0x78'));_0x5dde4d['queuecallerleaveAt']=moment()[_0x9ca7('0x50')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x9ca7('0x54')](_0x9ca7('0xaa'),_0x3fd5b2[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x5dde4d,{'showHidden':![],'depth':null}));ami[_0x9ca7('0x4c')](_0x9ca7('0xab'),_0x5dde4d);break;default:_0x5dde4d[_0x9ca7('0x8f')]=!![];_0x5dde4d['queuecallerexitAt']=moment()['format'](_0x9ca7('0x78'));_0x5dde4d[_0x9ca7('0x85')]=moment()[_0x9ca7('0x50')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5dde4d[_0x9ca7('0x3a')]=![];_0x5dde4d[_0x9ca7('0x81')]=null;_0x5dde4d[_0x9ca7('0x56')]=_0x3fd5b2['value'];this[_0x9ca7('0x14')][_0x3fd5b2[_0x9ca7('0x4f')]]=_0x5dde4d;this['emitVoiceQueueChannelRemove'](_0x5dde4d,_0x9ca7('0x27'));}else if(this[_0x9ca7('0x5e')](_0x3fd5b2['variable'])&&this[_0x9ca7('0x5e')](_0x3fd5b2[_0x9ca7('0xa5')][_0x9ca7('0xac')])){if(!_0x5dde4d[_0x9ca7('0x3a')]){_0x5dde4d[_0x9ca7('0x8f')]=!![];_0x5dde4d['queuecallerexitAt']=moment()[_0x9ca7('0x50')](_0x9ca7('0x78'));_0x5dde4d[_0x9ca7('0x56')]=_0x9ca7('0xad');_0x5dde4d['queuecallerleaveAt']=moment()['format'](_0x9ca7('0x78'));this[_0x9ca7('0x14')][_0x3fd5b2[_0x9ca7('0x4f')]]=_0x5dde4d;}}logger[_0x9ca7('0x8b')](_0x9ca7('0xae'),_0x3fd5b2['uniqueid'],_0x5dde4d[_0x9ca7('0x52')],_0x5dde4d[_0x9ca7('0x5a')],_[_0x9ca7('0xa4')](_0x3fd5b2[_0x9ca7('0xa5')])[0x0],_0x3fd5b2[_0x9ca7('0xa6')]);_0x5dde4d[_0x9ca7('0x19')]=this[_0x9ca7('0x19')][_0x3fd5b2['uniqueid']];}}}}catch(_0x5ab9c1){logger[_0x9ca7('0x43')](_0x9ca7('0xa2'),_0x3fd5b2[_0x9ca7('0x4f')],util[_0x9ca7('0x45')](_0x5ab9c1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9ca7('0xc')]['addVariable']=function(_0x2d6d15,_0x1f109c,_0x570288){var _0x59e096=[_0x9ca7('0xaf'),_0x9ca7('0xb0'),_0x9ca7('0xb1'),_0x9ca7('0xb2'),_0x9ca7('0xb3'),_0x9ca7('0xb4'),_0x9ca7('0xb5'),'rtpaudioqosrttbridged',_0x9ca7('0xb6'),_0x9ca7('0xb7'),_0x9ca7('0xb8'),_0x9ca7('0xb9'),_0x9ca7('0xba'),_0x9ca7('0xbb'),_0x9ca7('0xbc'),'memberlastcall',_0x9ca7('0x8e'),_0x9ca7('0xbd'),_0x9ca7('0xbe')];if(!_[_0x9ca7('0x3d')](_0x1f109c)&&!_[_0x9ca7('0xbf')](_0x59e096,_0x1f109c)){if(_[_0x9ca7('0x77')](this['variables'][_0x2d6d15])){this[_0x9ca7('0x19')][_0x2d6d15]={};}this[_0x9ca7('0x19')][_0x2d6d15][_0x1f109c]=_0x570288;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x155f39,_0x10014b,_0x153768){try{var _0x4fa1cc={};if(this['queueReports'][_0x155f39]){for(var _0x2f86c7=0x0;_0x2f86c7{delete this[_0x9ca7('0x14')][_0x4610a7];},_0x27f6f3);}};module[_0x9ca7('0xf3')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index d962594..27a3a17 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7fd=['../client','queue','Request','CreateReportAgentPreview'];(function(_0x50a56f,_0x735bab){var _0x3b1339=function(_0x451f10){while(--_0x451f10){_0x50a56f['push'](_0x50a56f['shift']());}};_0x3b1339(++_0x735bab);}(_0xf7fd,0x14c));var _0xdf7f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf7fd[_0x484e36];return _0xafc85d;};'use strict';var client=require(_0xdf7f('0x0'));exports['createHistory']=function(_0x47eb4e){return function(){_0x47eb4e['campaign']=_0x47eb4e[_0xdf7f('0x1')];return client[_0xdf7f('0x2')]('CreateReportAgentPreview',{'body':_0x47eb4e,'log':_0xdf7f('0x3')});};}; \ No newline at end of file +var _0x47aa=['CreateReportAgentPreview','createHistory'];(function(_0x5c0979,_0x287854){var _0x309972=function(_0x17defd){while(--_0x17defd){_0x5c0979['push'](_0x5c0979['shift']());}};_0x309972(++_0x287854);}(_0x47aa,0x16d));var _0xa47a=function(_0x50212e,_0x1b2b2e){_0x50212e=_0x50212e-0x0;var _0x1525c8=_0x47aa[_0x50212e];return _0x1525c8;};'use strict';var client=require('../client');exports[_0xa47a('0x0')]=function(_0x41b12e){return function(){_0x41b12e['campaign']=_0x41b12e['queue'];return client['Request'](_0xa47a('0x1'),{'body':_0x41b12e,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 113a3a9..532b72a 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3440=['Request','../client','create'];(function(_0x22ac92,_0x5b15e8){var _0x489cde=function(_0xa927cf){while(--_0xa927cf){_0x22ac92['push'](_0x22ac92['shift']());}};_0x489cde(++_0x5b15e8);}(_0x3440,0x9a));var _0x0344=function(_0x4a9a0c,_0x120b8a){_0x4a9a0c=_0x4a9a0c-0x0;var _0x316d25=_0x3440[_0x4a9a0c];return _0x316d25;};'use strict';var client=require(_0x0344('0x0'));exports[_0x0344('0x1')]=function(_0x4fa1da){return client[_0x0344('0x2')]('CreateAttachment',{'body':_0x4fa1da,'log':'CreateAttachment'});}; \ No newline at end of file +var _0x53aa=['CreateAttachment','Request'];(function(_0x36ddae,_0x3c11e8){var _0x2fac2e=function(_0x4a3080){while(--_0x4a3080){_0x36ddae['push'](_0x36ddae['shift']());}};_0x2fac2e(++_0x3c11e8);}(_0x53aa,0x6d));var _0xa53a=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x53aa[_0x25d386];return _0x857f4a;};'use strict';var client=require('../client');exports['create']=function(_0x2f2dc1){return client[_0xa53a('0x0')]('CreateAttachment',{'body':_0x2f2dc1,'log':_0xa53a('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 19880a6..96af5c2 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x49f0d7,_0x4fba73){var _0x2995ec=function(_0x463d7f){while(--_0x463d7f){_0x49f0d7['push'](_0x49f0d7['shift']());}};_0x2995ec(++_0x4fba73);}(_0x326f,0xd1));var _0xf326=function(_0x530908,_0x36ade4){_0x530908=_0x530908-0x0;var _0x497d0a=_0x326f[_0x530908];return _0x497d0a;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0x326f=['dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialPrefix','Trunk','callerid','TrunkBackup','Interval','Intervals','SquareProject','../client','GetCampaign','name','type','active','limitCalls','dialOriginateCallerIdName'];(function(_0x4266c7,_0x35c815){var _0xb87663=function(_0x4e9d0b){while(--_0x4e9d0b){_0x4266c7['push'](_0x4266c7['shift']());}};_0xb87663(++_0x35c815);}(_0x326f,0xd1));var _0xf326=function(_0x58e869,_0x596371){_0x58e869=_0x58e869-0x0;var _0x1a16b2=_0x326f[_0x58e869];return _0x1a16b2;};'use strict';var client=require(_0xf326('0x0'));exports['getCampaigns']=function(){return function(){return client['Request'](_0xf326('0x1'),{'options':{'raw':![],'attributes':['id',_0xf326('0x2'),_0xf326('0x3'),_0xf326('0x4'),_0xf326('0x5'),_0xf326('0x6'),_0xf326('0x7'),_0xf326('0x8'),_0xf326('0x9'),_0xf326('0xa'),'dialBusyMaxRetry',_0xf326('0xb'),_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0xf326('0xf'),_0xf326('0x10'),_0xf326('0x11'),_0xf326('0x12'),_0xf326('0x13'),'dialAgentRejectMaxRetry',_0xf326('0x14'),'dialTimezone',_0xf326('0x15'),'dialAMDActive',_0xf326('0x16'),'dialAMDGreeting',_0xf326('0x17'),_0xf326('0x18'),'dialAMDMinWordLength',_0xf326('0x19'),_0xf326('0x1a'),_0xf326('0x1b'),_0xf326('0x1c'),'dialOrderByScheduledAt',_0xf326('0x1d'),'dialRandomLastDigitCallerIdNumber','dialCutDigit'],'include':[{'model':_0xf326('0x1e'),'as':_0xf326('0x1e'),'attributes':['id',_0xf326('0x2'),_0xf326('0x1f'),_0xf326('0x4')]},{'model':_0xf326('0x1e'),'as':_0xf326('0x20'),'attributes':['id',_0xf326('0x2'),'callerid',_0xf326('0x4')]},{'model':_0xf326('0x21'),'as':_0xf326('0x21'),'attributes':['id',_0xf326('0x2')],'include':[{'model':_0xf326('0x21'),'as':_0xf326('0x22'),'attributes':['id','name','interval']}]},{'model':'SquareProject','as':_0xf326('0x23'),'attributes':['id',_0xf326('0x2')]}]},'log':'getCampaign'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index a9d9cb5..66049a6 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x415d=['getContacts','Request','GetCmContact','createContact'];(function(_0x149319,_0x4182b5){var _0x4637c9=function(_0x2ff6ce){while(--_0x2ff6ce){_0x149319['push'](_0x149319['shift']());}};_0x4637c9(++_0x4182b5);}(_0x415d,0x17b));var _0xd415=function(_0x2386eb,_0x575c8a){_0x2386eb=_0x2386eb-0x0;var _0x3277ba=_0x415d[_0x2386eb];return _0x3277ba;};'use strict';var client=require('../client');exports[_0xd415('0x0')]=function(_0x4dc149){return function(){return client['Request']('CreateCmContact',{'body':_0x4dc149,'log':'CreateCmContact'});};};exports[_0xd415('0x1')]=function(_0x19c224){return function(){return client[_0xd415('0x2')]('GetCmContact',{'options':_0x19c224,'log':_0xd415('0x3')});};}; \ No newline at end of file +var _0xb1a8=['GetCmContact','../client','createContact','Request','CreateCmContact','getContacts'];(function(_0x5412e5,_0x604c7){var _0x2ee0e1=function(_0x55dd3c){while(--_0x55dd3c){_0x5412e5['push'](_0x5412e5['shift']());}};_0x2ee0e1(++_0x604c7);}(_0xb1a8,0xeb));var _0x8b1a=function(_0x19d7e9,_0x3c1fe7){_0x19d7e9=_0x19d7e9-0x0;var _0x48d705=_0xb1a8[_0x19d7e9];return _0x48d705;};'use strict';var client=require(_0x8b1a('0x0'));exports[_0x8b1a('0x1')]=function(_0x49ea51){return function(){return client[_0x8b1a('0x2')](_0x8b1a('0x3'),{'body':_0x49ea51,'log':_0x8b1a('0x3')});};};exports[_0x8b1a('0x4')]=function(_0x567c9d){return function(){return client[_0x8b1a('0x2')](_0x8b1a('0x5'),{'options':_0x567c9d,'log':_0x8b1a('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index c662a5b..c0d8a42 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x379e=['updateContacts','UpdateCmHopper','format','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','GetContactDialerIvr','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','User','Agent','VoiceQueue','Queue','name','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','Request','GetCmHopper','CmContact','Contact','getCmHopper'];(function(_0x457585,_0x47e33a){var _0x1f96e1=function(_0x5be312){while(--_0x5be312){_0x457585['push'](_0x457585['shift']());}};_0x1f96e1(++_0x47e33a);}(_0x379e,0x104));var _0xe379=function(_0xbf2296,_0xf38224){_0xbf2296=_0xbf2296-0x0;var _0x216a06=_0x379e[_0xbf2296];return _0x216a06;};'use strict';var client=require(_0xe379('0x0'));var moment=require('moment');exports['getContacts']=function(_0x4bbe70,_0x594cd4){return function(){return client[_0xe379('0x1')](_0xe379('0x2'),{'options':{'where':{'VoiceQueueId':_0x4bbe70},'include':[{'model':_0xe379('0x3'),'as':_0xe379('0x4')}],'limit':_0x594cd4,'raw':![]},'log':_0xe379('0x5')});};};exports[_0xe379('0x6')]=function(_0x5ebed1,_0x1f6c46,_0x24221c){return function(){return client[_0xe379('0x1')](_0xe379('0x7'),{'body':_0x5ebed1,'options':{'where':{'VoiceQueueId':_0x1f6c46,'scheduledat':{'$lte':moment()[_0xe379('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x24221c},'log':_0xe379('0x7')});};};exports[_0xe379('0x9')]=function(_0x29537d){return client[_0xe379('0x1')](_0xe379('0x7'),{'body':_0x29537d,'options':{'where':{'ContactId':_0x29537d[_0xe379('0xa')],'ListId':_0x29537d[_0xe379('0xb')],'VoiceQueueId':_0x29537d[_0xe379('0xc')],'CampaignId':_0x29537d[_0xe379('0xd')]}},'log':'rescheduleContact'});};exports[_0xe379('0xe')]=function(_0x19631b,_0x1ba1ef,_0x3c6971){return function(){return client['Request']('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x19631b,'ListId':_0x1ba1ef,'ContactId':_0x3c6971}},'log':_0xe379('0xf')});};};exports[_0xe379('0x10')]=function(_0x128bce,_0x2a1e96,_0x450f16,_0x1ee8e0){return client[_0xe379('0x1')](_0xe379('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x128bce,'active':![],'scheduledat':{'$lte':moment()['format'](_0xe379('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x2a1e96}}]},'order':[[_0xe379('0x13'),_0xe379('0x14')],[_0xe379('0x15'),_0x1ee8e0],['id',_0xe379('0x16')]],'raw':!![],'limit':_0x450f16},'log':_0xe379('0x11')});};exports['getContactDialerIvr']=function(_0x2615bd,_0x5cb274,_0x2c2bd9){return client['Request'](_0xe379('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x2615bd,'active':![],'scheduledat':{'$lte':moment()[_0xe379('0x8')](_0xe379('0x12'))}},'include':[{'model':_0xe379('0x3'),'as':'Contact'}],'order':[[_0xe379('0x13'),_0xe379('0x14')],[_0xe379('0x15'),_0x2c2bd9],['id',_0xe379('0x16')]],'raw':!![],'limit':_0x5cb274},'log':_0xe379('0x17')});};exports['moveContactManagedDialer']=function(_0x2c749e,_0x3a8d17){_0x2c749e['campaign']=_0x2c749e[_0xe379('0x18')];return client[_0xe379('0x1')](_0xe379('0x19'),{'body':_0x2c749e,'options':{'where':{'ContactId':_0x2c749e[_0xe379('0xa')],'ListId':_0x2c749e[_0xe379('0xb')],'VoiceQueueId':_0x2c749e[_0xe379('0xc')],'CampaignId':_0x2c749e['CampaignId'],'active':_0x3a8d17?undefined:!![]}},'log':_0xe379('0x19')});};exports[_0xe379('0x1a')]=function(_0x21e31b){return client['Request'](_0xe379('0x1b'),{'options':{'where':{'VoiceQueueId':_0x21e31b['id']?_0x21e31b['id']||null:null}},'log':_0xe379('0x1a')});};exports['getContactPreview']=function(_0x1f545f){return function(){return client[_0xe379('0x1')]('GetCmHopperPreview',{'options':{'where':{'id':_0x1f545f},'include':[{'model':'CmContact','as':_0xe379('0x4')},{'model':_0xe379('0x1c'),'as':_0xe379('0x1d'),'attributes':['id','name']},{'model':_0xe379('0x1e'),'as':_0xe379('0x1f'),'attributes':['id',_0xe379('0x20')]}],'raw':!![]},'log':_0xe379('0x5')});};};exports['unlockContact']=function(_0x236633,_0x33314a,_0x13e049){return client['Request'](_0xe379('0x7'),{'body':_0x236633,'options':{'where':{'id':_0x33314a},'limit':_0x13e049},'log':_0xe379('0x7')});};exports['getContactRecallMe']=function(_0x24c85d,_0x528a44){return function(){return client[_0xe379('0x1')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x24c85d,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xe379('0x8')](_0xe379('0x12'))},'UserId':{'$in':_0x528a44}},'order':[[_0xe379('0x13'),_0xe379('0x14')],[_0xe379('0x15'),_0xe379('0x14')],['id',_0xe379('0x16')]],'include':[{'model':'CmContact','as':_0xe379('0x4')},{'model':_0xe379('0x1c'),'as':_0xe379('0x1d'),'attributes':['id','name',_0xe379('0x21')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':'GetContactDialer'});};};exports[_0xe379('0x22')]=function(_0x998d5c,_0x2c773b){return client[_0xe379('0x1')]('ResetActiveCalls',{'body':_0x998d5c,'options':_0x2c773b||{},'log':_0xe379('0x23')});};exports[_0xe379('0x24')]=function(_0x58ccb9,_0x361a49,_0x3c8d84){return function(){return client[_0xe379('0x1')](_0xe379('0x25'),{'body':{'where':{'voiceQueueIds':_0x58ccb9,'interval':_0x361a49,'availableAgentsIds':_0x3c8d84}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file +var _0x0c23=['resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','countReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','VoiceQueue','unlockContact','getContactRecallMe','GetContactRecallMe','User','voicePause','db.CmHopper.UserId'];(function(_0x4b602f,_0x29d7ba){var _0x283a73=function(_0x30b9d6){while(--_0x30b9d6){_0x4b602f['push'](_0x4b602f['shift']());}};_0x283a73(++_0x29d7ba);}(_0x0c23,0x13e));var _0x30c2=function(_0xadf660,_0x59f1dd){_0xadf660=_0xadf660-0x0;var _0xab229b=_0x0c23[_0xadf660];return _0xab229b;};'use strict';var client=require(_0x30c2('0x0'));var moment=require(_0x30c2('0x1'));exports[_0x30c2('0x2')]=function(_0x461cbb,_0x14066d){return function(){return client[_0x30c2('0x3')](_0x30c2('0x4'),{'options':{'where':{'VoiceQueueId':_0x461cbb},'include':[{'model':'CmContact','as':_0x30c2('0x5')}],'limit':_0x14066d,'raw':![]},'log':_0x30c2('0x6')});};};exports[_0x30c2('0x7')]=function(_0x2c453c,_0x28630b,_0x166e7a){return function(){return client['Request'](_0x30c2('0x8'),{'body':_0x2c453c,'options':{'where':{'VoiceQueueId':_0x28630b,'scheduledat':{'$lte':moment()[_0x30c2('0x9')](_0x30c2('0xa'))}},'limit':_0x166e7a},'log':_0x30c2('0x8')});};};exports[_0x30c2('0xb')]=function(_0x508c12){return client[_0x30c2('0x3')](_0x30c2('0x8'),{'body':_0x508c12,'options':{'where':{'ContactId':_0x508c12['ContactId'],'ListId':_0x508c12[_0x30c2('0xc')],'VoiceQueueId':_0x508c12[_0x30c2('0xd')],'CampaignId':_0x508c12[_0x30c2('0xe')]}},'log':_0x30c2('0xb')});};exports[_0x30c2('0xf')]=function(_0x17eb67,_0x526ba0,_0x4983f4){return function(){return client['Request'](_0x30c2('0x10'),{'options':{'where':{'VoiceQueueId':_0x17eb67,'ListId':_0x526ba0,'ContactId':_0x4983f4}},'log':_0x30c2('0x10')});};};exports[_0x30c2('0x11')]=function(_0x26d859,_0x396194,_0x1b94e3,_0x2712dc){return client['Request'](_0x30c2('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x26d859,'active':![],'scheduledat':{'$lte':moment()[_0x30c2('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x396194}}]},'order':[[_0x30c2('0x13'),_0x30c2('0x14')],[_0x30c2('0x15'),_0x2712dc],['id',_0x30c2('0x16')]],'raw':!![],'limit':_0x1b94e3},'log':_0x30c2('0x12')});};exports[_0x30c2('0x17')]=function(_0x170f58,_0x271d10,_0x1d6318){return client[_0x30c2('0x3')](_0x30c2('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x170f58,'active':![],'scheduledat':{'$lte':moment()[_0x30c2('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x30c2('0x18'),'as':'Contact'}],'order':[['priority',_0x30c2('0x14')],[_0x30c2('0x15'),_0x1d6318],['id',_0x30c2('0x16')]],'raw':!![],'limit':_0x271d10},'log':'GetContactDialerIvr'});};exports[_0x30c2('0x19')]=function(_0x1d0b52,_0x124140){_0x1d0b52[_0x30c2('0x1a')]=_0x1d0b52[_0x30c2('0x1b')];return client[_0x30c2('0x3')](_0x30c2('0x1c'),{'body':_0x1d0b52,'options':{'where':{'ContactId':_0x1d0b52[_0x30c2('0x1d')],'ListId':_0x1d0b52['ListId'],'VoiceQueueId':_0x1d0b52['VoiceQueueId'],'CampaignId':_0x1d0b52[_0x30c2('0xe')],'active':_0x124140?undefined:!![]}},'log':_0x30c2('0x1c')});};exports[_0x30c2('0x1e')]=function(_0x16f218){return client[_0x30c2('0x3')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x16f218['id']?_0x16f218['id']||null:null}},'log':_0x30c2('0x1e')});};exports[_0x30c2('0x1f')]=function(_0x1a11b1){return function(){return client['Request'](_0x30c2('0x20'),{'options':{'where':{'id':_0x1a11b1},'include':[{'model':_0x30c2('0x18'),'as':_0x30c2('0x5')},{'model':'User','as':_0x30c2('0x21'),'attributes':['id',_0x30c2('0x22')]},{'model':_0x30c2('0x23'),'as':'Queue','attributes':['id',_0x30c2('0x22')]}],'raw':!![]},'log':_0x30c2('0x6')});};};exports[_0x30c2('0x24')]=function(_0x382b1b,_0x5f3634,_0x4d00f3){return client[_0x30c2('0x3')]('UpdateCmHopper',{'body':_0x382b1b,'options':{'where':{'id':_0x5f3634},'limit':_0x4d00f3},'log':_0x30c2('0x8')});};exports[_0x30c2('0x25')]=function(_0x208b54,_0x5227bb){return function(){return client[_0x30c2('0x3')](_0x30c2('0x26'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x208b54,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x30c2('0xa'))},'UserId':{'$in':_0x5227bb}},'order':[[_0x30c2('0x13'),_0x30c2('0x14')],[_0x30c2('0x15'),_0x30c2('0x14')],['id',_0x30c2('0x16')]],'include':[{'model':_0x30c2('0x18'),'as':_0x30c2('0x5')},{'model':_0x30c2('0x27'),'as':_0x30c2('0x21'),'attributes':['id',_0x30c2('0x22'),_0x30c2('0x28')]}],'group':_0x30c2('0x29'),'raw':!![]},'log':_0x30c2('0x12')});};};exports[_0x30c2('0x2a')]=function(_0x474b91,_0xbff615){return client['Request']('ResetActiveCalls',{'body':_0x474b91,'options':_0xbff615||{},'log':_0x30c2('0x2b')});};exports['handlePreviewRecallNotifications']=function(_0x59bdde,_0x3c5117,_0x2557f3){return function(){return client['Request']('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x59bdde,'interval':_0x3c5117,'availableAgentsIds':_0x2557f3}},'log':_0x30c2('0x2c')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index e65214b..de1c939 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf25=['IncrementPreviewCounters','../client','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters'];(function(_0x4948e7,_0x474068){var _0x38c02f=function(_0x428a92){while(--_0x428a92){_0x4948e7['push'](_0x4948e7['shift']());}};_0x38c02f(++_0x474068);}(_0xdf25,0x143));var _0x5df2=function(_0x17cc31,_0x33c0a5){_0x17cc31=_0x17cc31-0x0;var _0x273211=_0xdf25[_0x17cc31];return _0x273211;};'use strict';var client=require(_0x5df2('0x0'));exports['verifyAdditionalPhones']=function(_0x46db15,_0x55f4b6,_0x27ffd1){return client[_0x5df2('0x1')](_0x5df2('0x2'),{'body':_0x46db15,'reason':_0x55f4b6,'entity':_0x27ffd1,'log':'VerifyAdditionalPhones'});};exports[_0x5df2('0x3')]=function(_0x36b29f,_0x1d1778,_0x2b4fbd){return client['Request'](_0x5df2('0x4'),{'body':_0x36b29f,'duration':_0x1d1778,'waitTime':_0x2b4fbd,'log':_0x5df2('0x4')});};exports[_0x5df2('0x5')]=function(_0x1d4e4f){return function(){return client[_0x5df2('0x1')]('IncrementPreviewCounters',{'body':_0x1d4e4f,'log':_0x5df2('0x6')});};}; \ No newline at end of file +var _0xcf29=['SwapAdditionalPhones','incrementPreviewCounters','Request','IncrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones','swapAdditionalPhones'];(function(_0x36c932,_0x1804b7){var _0xca46dc=function(_0x8a79a9){while(--_0x8a79a9){_0x36c932['push'](_0x36c932['shift']());}};_0xca46dc(++_0x1804b7);}(_0xcf29,0xcc));var _0x9cf2=function(_0x786e9,_0x1a029){_0x786e9=_0x786e9-0x0;var _0x1f891b=_0xcf29[_0x786e9];return _0x1f891b;};'use strict';var client=require(_0x9cf2('0x0'));exports[_0x9cf2('0x1')]=function(_0x8e1a5f,_0x1ca953,_0x24d0d2){return client['Request']('VerifyAdditionalPhones',{'body':_0x8e1a5f,'reason':_0x1ca953,'entity':_0x24d0d2,'log':_0x9cf2('0x2')});};exports[_0x9cf2('0x3')]=function(_0x38562f,_0x3a0f9a,_0x267079){return client['Request'](_0x9cf2('0x4'),{'body':_0x38562f,'duration':_0x3a0f9a,'waitTime':_0x267079,'log':_0x9cf2('0x4')});};exports[_0x9cf2('0x5')]=function(_0x3e4315){return function(){return client[_0x9cf2('0x6')](_0x9cf2('0x7'),{'body':_0x3e4315,'log':_0x9cf2('0x7')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 445cbb3..5ffe411 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a2c=['VoiceQueueId','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','phone','GetCmHopperBlackIvr','checkIsBlackList','Request'];(function(_0x2c6fb9,_0xc7d7c0){var _0x49fd5e=function(_0x3dcbaf){while(--_0x3dcbaf){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x49fd5e(++_0xc7d7c0);}(_0x7a2c,0xa6));var _0xc7a2=function(_0x198ebc,_0x2c5c64){_0x198ebc=_0x198ebc-0x0;var _0x21a2cd=_0x7a2c[_0x198ebc];return _0x21a2cd;};'use strict';var client=require('../client');exports[_0xc7a2('0x0')]=function(_0x2508c9){return client[_0xc7a2('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x2508c9[_0xc7a2('0x2')],'phone':_0x2508c9['phone']},'raw':![]},'log':_0xc7a2('0x3')});};exports[_0xc7a2('0x4')]=function(_0x2df20c){return client[_0xc7a2('0x1')](_0xc7a2('0x3'),{'options':{'where':{'CampaignId':_0x2df20c[_0xc7a2('0x5')],'phone':_0x2df20c[_0xc7a2('0x6')]},'raw':![]},'log':_0xc7a2('0x7')});}; \ No newline at end of file +var _0x17d3=['GetCmHopperBlack','checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','phone'];(function(_0x184a56,_0x503f50){var _0x89ba34=function(_0x2cce45){while(--_0x2cce45){_0x184a56['push'](_0x184a56['shift']());}};_0x89ba34(++_0x503f50);}(_0x17d3,0x13d));var _0x317d=function(_0x3b43f1,_0x42f22b){_0x3b43f1=_0x3b43f1-0x0;var _0x4c4401=_0x17d3[_0x3b43f1];return _0x4c4401;};'use strict';var client=require(_0x317d('0x0'));exports[_0x317d('0x1')]=function(_0x397605){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x397605['VoiceQueueId'],'phone':_0x397605[_0x317d('0x2')]},'raw':![]},'log':_0x317d('0x3')});};exports[_0x317d('0x4')]=function(_0x1cbdb8){return client[_0x317d('0x5')](_0x317d('0x3'),{'options':{'where':{'CampaignId':_0x1cbdb8[_0x317d('0x6')],'phone':_0x1cbdb8['phone']},'raw':![]},'log':_0x317d('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index f541b5b..b76b59f 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4546=['queue','Request','CreateCmHopperFinal','../client','createContact'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x4546,0x1bb));var _0x6454=function(_0x51fb74,_0x39b400){_0x51fb74=_0x51fb74-0x0;var _0x49c05c=_0x4546[_0x51fb74];return _0x49c05c;};'use strict';var client=require(_0x6454('0x0'));exports[_0x6454('0x1')]=function(_0x3e1628){return function(){_0x3e1628['campaign']=_0x3e1628[_0x6454('0x2')];return client[_0x6454('0x3')](_0x6454('0x4'),{'body':_0x3e1628,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0x9ab0=['createContact','queue','CreateCmHopperFinal','../client'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9ab0,0x19b));var _0x09ab=function(_0x52b472,_0x4ed28e){_0x52b472=_0x52b472-0x0;var _0x13254d=_0x9ab0[_0x52b472];return _0x13254d;};'use strict';var client=require(_0x09ab('0x0'));exports[_0x09ab('0x1')]=function(_0x237e6){return function(){_0x237e6['campaign']=_0x237e6[_0x09ab('0x2')];return client['Request'](_0x09ab('0x3'),{'body':_0x237e6,'log':_0x09ab('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index cffecd4..760e639 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d17=['startOf','ivr','../client','moment','campaign','Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','format','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf','queue','getCampaignHopperHistory','GetCampaignHopperHistory'];(function(_0x1e49ff,_0x1a41e6){var _0x20ab06=function(_0x4d160b){while(--_0x4d160b){_0x1e49ff['push'](_0x1e49ff['shift']());}};_0x20ab06(++_0x1a41e6);}(_0x2d17,0x17e));var _0x72d1=function(_0x3d4ec0,_0x74e3cf){_0x3d4ec0=_0x3d4ec0-0x0;var _0x4c91ab=_0x2d17[_0x3d4ec0];return _0x4c91ab;};'use strict';var client=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));exports['createHistory']=function(_0x12f23c){_0x12f23c[_0x72d1('0x2')]=_0x12f23c['queue'];return client[_0x72d1('0x3')](_0x72d1('0x4'),{'body':_0x12f23c,'log':'CreateCmHopperHistory'});};exports[_0x72d1('0x5')]=function(_0x4dfee1){return client[_0x72d1('0x3')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x72d1('0x6')](_0x4dfee1,_0x72d1('0x7'))['format'](_0x72d1('0x8')),moment()[_0x72d1('0x9')](_0x72d1('0x8'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x72d1('0xa')]=function(){return function(){return client[_0x72d1('0x3')](_0x72d1('0xb'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x72d1('0xc'))[_0x72d1('0x9')](_0x72d1('0x8')),moment()[_0x72d1('0xd')](_0x72d1('0xc'))[_0x72d1('0x9')](_0x72d1('0x8'))]},'campaigntype':_0x72d1('0xe')},'raw':![]},'log':_0x72d1('0xb')});};};exports[_0x72d1('0xf')]=function(){return function(){return client['Request'](_0x72d1('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x72d1('0x11')](_0x72d1('0xc'))[_0x72d1('0x9')](_0x72d1('0x8')),moment()[_0x72d1('0xd')](_0x72d1('0xc'))[_0x72d1('0x9')](_0x72d1('0x8'))]},'campaigntype':_0x72d1('0x12')},'raw':![]},'log':_0x72d1('0x10')});};}; \ No newline at end of file +var _0x4365=['minutes','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','startOf','day','format','endOf','queue','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivr','moment','campaign','Request','CreateCmHopperHistory','avgHandleTime','subtract'];(function(_0x21d2a6,_0x44c6cc){var _0x3a5b9f=function(_0x49353f){while(--_0x49353f){_0x21d2a6['push'](_0x21d2a6['shift']());}};_0x3a5b9f(++_0x44c6cc);}(_0x4365,0x82));var _0x5436=function(_0x248c97,_0x1d9091){_0x248c97=_0x248c97-0x0;var _0x23b211=_0x4365[_0x248c97];return _0x23b211;};'use strict';var client=require('../client');var moment=require(_0x5436('0x0'));exports['createHistory']=function(_0x41a4fe){_0x41a4fe[_0x5436('0x1')]=_0x41a4fe['queue'];return client[_0x5436('0x2')](_0x5436('0x3'),{'body':_0x41a4fe,'log':'CreateCmHopperHistory'});};exports[_0x5436('0x4')]=function(_0x46fede){return client[_0x5436('0x2')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x5436('0x5')](_0x46fede,_0x5436('0x6'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['format'](_0x5436('0x7'))]}},'raw':![]},'log':_0x5436('0x8')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x5436('0x2')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x5436('0x9')](_0x5436('0xa'))[_0x5436('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x5436('0xc')](_0x5436('0xa'))[_0x5436('0xb')](_0x5436('0x7'))]},'campaigntype':_0x5436('0xd')},'raw':![]},'log':_0x5436('0xe')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x5436('0x2')](_0x5436('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5436('0x9')](_0x5436('0xa'))['format'](_0x5436('0x7')),moment()[_0x5436('0xc')](_0x5436('0xa'))[_0x5436('0xb')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x5436('0x10')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 3044097..7e1992e 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbcae=['gateway','t38timeout','tech','TrunkId','key','Trunk','callerid','active','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','description','ecm','headerinfo','localstationid','minrate','modem'];(function(_0x299bef,_0x29009e){var _0x4dab5b=function(_0x272071){while(--_0x272071){_0x299bef['push'](_0x299bef['shift']());}};_0x4dab5b(++_0x29009e);}(_0xbcae,0xa9));var _0xebca=function(_0x40e560,_0xe77a25){_0x40e560=_0x40e560-0x0;var _0x3e50ae=_0xbcae[_0x40e560];return _0x3e50ae;};'use strict';var client=require(_0xebca('0x0'));exports[_0xebca('0x1')]=function(){return function(){return client[_0xebca('0x2')](_0xebca('0x3'),{'options':{'raw':![],'attributes':['id',_0xebca('0x4'),_0xebca('0x5'),_0xebca('0x6'),_0xebca('0x7'),_0xebca('0x8'),_0xebca('0x9'),'maxrate',_0xebca('0xa'),_0xebca('0xb'),'faxdetect',_0xebca('0xc'),_0xebca('0xd'),_0xebca('0xe'),'ListId',_0xebca('0xf')],'include':[{'model':_0xebca('0x10'),'as':_0xebca('0x10'),'attributes':['id',_0xebca('0x4'),_0xebca('0x11'),_0xebca('0x12')]}]},'log':'getFaxAccount'});};};exports['notify']=function(_0x5d8909,_0x689e67){return client[_0xebca('0x2')](_0xebca('0x13'),{'account':{'id':_0x5d8909},'body':_0x689e67,'log':_0xebca('0x13')});}; \ No newline at end of file +var _0x6ac2=['tech','TrunkId','ListId','key','callerid','active','getFaxAccount','NotifyFaxAccount','../client','Request','GetFaxAccount','name','description','ecm','headerinfo','minrate','modem','gateway','faxdetect','t38timeout'];(function(_0x5a6707,_0xdefaf3){var _0x5b58c5=function(_0xf7f131){while(--_0xf7f131){_0x5a6707['push'](_0x5a6707['shift']());}};_0x5b58c5(++_0xdefaf3);}(_0x6ac2,0x184));var _0x26ac=function(_0x29dce3,_0x126f7f){_0x29dce3=_0x29dce3-0x0;var _0xe0701=_0x6ac2[_0x29dce3];return _0xe0701;};'use strict';var client=require(_0x26ac('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0x26ac('0x1')](_0x26ac('0x2'),{'options':{'raw':![],'attributes':['id',_0x26ac('0x3'),_0x26ac('0x4'),_0x26ac('0x5'),_0x26ac('0x6'),'localstationid',_0x26ac('0x7'),'maxrate',_0x26ac('0x8'),_0x26ac('0x9'),_0x26ac('0xa'),_0x26ac('0xb'),_0x26ac('0xc'),_0x26ac('0xd'),_0x26ac('0xe'),_0x26ac('0xf')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x26ac('0x3'),_0x26ac('0x10'),_0x26ac('0x11')]}]},'log':_0x26ac('0x12')});};};exports['notify']=function(_0x11e8a1,_0x2507f9){return client[_0x26ac('0x1')](_0x26ac('0x13'),{'account':{'id':_0x11e8a1},'body':_0x2507f9,'log':'NotifyFaxAccount'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 232cbc0..8839d5a 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x901c=['UpdateFaxMessage','../client','update','Request'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x901c,0x185));var _0xc901=function(_0x32f6a0,_0xb4fd0c){_0x32f6a0=_0x32f6a0-0x0;var _0x45c9bc=_0x901c[_0x32f6a0];return _0x45c9bc;};'use strict';var client=require(_0xc901('0x0'));exports[_0xc901('0x1')]=function(_0x2df5b8,_0x54936f){return client[_0xc901('0x2')](_0xc901('0x3'),{'body':_0x54936f,'options':{'where':{'AttachmentId':_0x2df5b8}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0x6c01=['update','Request','UpdateFaxMessage','../client'];(function(_0x4ce612,_0x20fd12){var _0x4807=function(_0x28fdff){while(--_0x28fdff){_0x4ce612['push'](_0x4ce612['shift']());}};_0x4807(++_0x20fd12);}(_0x6c01,0x1c7));var _0x16c0=function(_0xa7e916,_0x3e7ff8){_0xa7e916=_0xa7e916-0x0;var _0x21261c=_0x6c01[_0xa7e916];return _0x21261c;};'use strict';var client=require(_0x16c0('0x0'));exports[_0x16c0('0x1')]=function(_0x2e2a79,_0x239337){return client[_0x16c0('0x2')](_0x16c0('0x3'),{'body':_0x239337,'options':{'where':{'AttachmentId':_0x2e2a79}},'log':'UpdateFaxMessage'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index ff3474a..019df87 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7747=['password','remoteUri','type','DeskConfiguration','content','Variable','DeskField','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','Tag','Tags','getDeskAccounts','Request','GetDeskAccount','name','description','username'];(function(_0x4b308f,_0x4f89d4){var _0x3bd92f=function(_0x1a5cb7){while(--_0x1a5cb7){_0x4b308f['push'](_0x4b308f['shift']());}};_0x3bd92f(++_0x4f89d4);}(_0x7747,0x16a));var _0x7774=function(_0x1af469,_0x584d95){_0x1af469=_0x1af469-0x0;var _0x336171=_0x7747[_0x1af469];return _0x336171;};'use strict';var client=require('../../client');exports[_0x7774('0x0')]=function(){return function(_0x3c5102){return client[_0x7774('0x1')](_0x7774('0x2'),{'options':{'raw':![],'attributes':['id',_0x7774('0x3'),_0x7774('0x4'),_0x7774('0x5'),_0x7774('0x6'),_0x7774('0x7'),'authType',_0x7774('0x8'),'serverUrl'],'include':[{'model':_0x7774('0x9'),'as':'Configurations','attributes':['id',_0x7774('0x3')],'include':[{'model':'DeskField','as':'Subjects','attributes':['id',_0x7774('0x8'),_0x7774('0xa'),'variableName'],'include':[{'model':_0x7774('0xb'),'as':_0x7774('0xb'),'attributes':['id',_0x7774('0x3')]}]},{'model':_0x7774('0xc'),'as':'Descriptions','attributes':['id','type',_0x7774('0xa'),_0x7774('0xd'),_0x7774('0xe'),_0x7774('0xf'),_0x7774('0x10')],'include':[{'model':_0x7774('0xb'),'as':_0x7774('0xb'),'attributes':['id','name']}]},{'model':_0x7774('0xc'),'as':_0x7774('0x11'),'attributes':['id',_0x7774('0x8'),_0x7774('0xa'),_0x7774('0x12'),_0x7774('0x13'),_0x7774('0x14'),_0x7774('0x10')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x7774('0x15'),'as':_0x7774('0x16'),'attributes':['id',_0x7774('0x3')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file +var _0xf49e=['customField','Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','remoteUri','authType','type','serverUrl','Configurations','DeskField','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields'];(function(_0x331e11,_0x475e39){var _0x18a2bd=function(_0x24c571){while(--_0x24c571){_0x331e11['push'](_0x331e11['shift']());}};_0x18a2bd(++_0x475e39);}(_0xf49e,0x1c5));var _0xef49=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf49e[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0xef49('0x0'));exports[_0xef49('0x1')]=function(){return function(_0x23b4a4){return client[_0xef49('0x2')](_0xef49('0x3'),{'options':{'raw':![],'attributes':['id',_0xef49('0x4'),_0xef49('0x5'),_0xef49('0x6'),_0xef49('0x7'),_0xef49('0x8'),_0xef49('0x9'),_0xef49('0xa'),_0xef49('0xb')],'include':[{'model':'DeskConfiguration','as':_0xef49('0xc'),'attributes':['id',_0xef49('0x4')],'include':[{'model':_0xef49('0xd'),'as':'Subjects','attributes':['id',_0xef49('0xa'),_0xef49('0xe'),_0xef49('0xf')],'include':[{'model':_0xef49('0x10'),'as':_0xef49('0x10'),'attributes':['id',_0xef49('0x4')]}]},{'model':_0xef49('0xd'),'as':_0xef49('0x11'),'attributes':['id',_0xef49('0xa'),_0xef49('0xe'),_0xef49('0x12'),_0xef49('0x13'),_0xef49('0x14'),_0xef49('0xf')],'include':[{'model':_0xef49('0x10'),'as':'Variable','attributes':['id','name']}]},{'model':_0xef49('0xd'),'as':_0xef49('0x15'),'attributes':['id',_0xef49('0xa'),_0xef49('0xe'),'idField','nameField',_0xef49('0x16'),_0xef49('0xf')],'include':[{'model':_0xef49('0x10'),'as':'Variable','attributes':['id',_0xef49('0x4')]}]},{'model':_0xef49('0x17'),'as':_0xef49('0x18'),'attributes':['id',_0xef49('0x4')]}]}]},'log':_0xef49('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 43ca513..93802fe 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x20df=['customField','CloudProvider','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','password','remoteUri','tenantId','clientSecret','description','modernAuthentication','Configurations','ticketType','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','content','variableName','Variable','Descriptions','type','key','keyContent','Fields','nameField'];(function(_0x3b0281,_0xd670a7){var _0x1a74e1=function(_0x35a047){while(--_0x35a047){_0x3b0281['push'](_0x3b0281['shift']());}};_0x1a74e1(++_0xd670a7);}(_0x20df,0x7c));var _0xf20d=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0x20df[_0x11ec6c];return _0xb59506;};'use strict';var client=require(_0xf20d('0x0'));exports[_0xf20d('0x1')]=function(){return function(_0x44f997){return client[_0xf20d('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xf20d('0x3'),_0xf20d('0x4'),_0xf20d('0x5'),_0xf20d('0x6'),_0xf20d('0x7'),'clientId',_0xf20d('0x8'),'serverUrl',_0xf20d('0x9'),_0xf20d('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0xf20d('0xb'),'attributes':['id','name',_0xf20d('0xc'),'moduleCreate',_0xf20d('0xd'),_0xf20d('0xe')],'include':[{'model':_0xf20d('0xf'),'as':_0xf20d('0x10'),'attributes':['id','type',_0xf20d('0x11'),_0xf20d('0x12')],'include':[{'model':_0xf20d('0x13'),'as':_0xf20d('0x13'),'attributes':['id',_0xf20d('0x3')]}]},{'model':_0xf20d('0xf'),'as':_0xf20d('0x14'),'attributes':['id',_0xf20d('0x15'),'content',_0xf20d('0x16'),'keyType',_0xf20d('0x17'),_0xf20d('0x12')],'include':[{'model':'Variable','as':_0xf20d('0x13'),'attributes':['id',_0xf20d('0x3')]}]},{'model':_0xf20d('0xf'),'as':_0xf20d('0x18'),'attributes':['id',_0xf20d('0x15'),'content','idField',_0xf20d('0x19'),_0xf20d('0x1a'),_0xf20d('0x12')],'include':[{'model':_0xf20d('0x13'),'as':'Variable','attributes':['id',_0xf20d('0x3')]}]}]},{'model':'CloudProvider','as':_0xf20d('0x1b'),'attributes':['id','data2','data5',_0xf20d('0x1c')]}]},'log':_0xf20d('0x1d')});};}; \ No newline at end of file +var _0x9d9b=['moduleCreate','additionalSearchContact','openNewTab','variableName','Variable','Dynamics365Field','Descriptions','content','keyType','keyContent','Fields','idField','nameField','customField','data2','data5','data7','getDynamics365Accounts','GetDynamics365Account','username','password','remoteUri','clientId','serverUrl','description','Dynamics365Configuration','Configurations','name','ticketType'];(function(_0x14f006,_0x258850){var _0x4d08c4=function(_0x5b8c2b){while(--_0x5b8c2b){_0x14f006['push'](_0x14f006['shift']());}};_0x4d08c4(++_0x258850);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x1b095d,_0x165325){_0x1b095d=_0x1b095d-0x0;var _0x3b3480=_0x9d9b[_0x1b095d];return _0x3b3480;};'use strict';var client=require('../../client');exports[_0xb9d9('0x0')]=function(){return function(_0x2c6a23){return client['Request'](_0xb9d9('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xb9d9('0x2'),_0xb9d9('0x3'),_0xb9d9('0x4'),'tenantId',_0xb9d9('0x5'),'clientSecret',_0xb9d9('0x6'),_0xb9d9('0x7'),'modernAuthentication'],'include':[{'model':_0xb9d9('0x8'),'as':_0xb9d9('0x9'),'attributes':['id',_0xb9d9('0xa'),_0xb9d9('0xb'),_0xb9d9('0xc'),_0xb9d9('0xd'),_0xb9d9('0xe')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id','type','content',_0xb9d9('0xf')],'include':[{'model':_0xb9d9('0x10'),'as':_0xb9d9('0x10'),'attributes':['id','name']}]},{'model':_0xb9d9('0x11'),'as':_0xb9d9('0x12'),'attributes':['id','type',_0xb9d9('0x13'),'key',_0xb9d9('0x14'),_0xb9d9('0x15'),_0xb9d9('0xf')],'include':[{'model':_0xb9d9('0x10'),'as':_0xb9d9('0x10'),'attributes':['id',_0xb9d9('0xa')]}]},{'model':_0xb9d9('0x11'),'as':_0xb9d9('0x16'),'attributes':['id','type','content',_0xb9d9('0x17'),_0xb9d9('0x18'),_0xb9d9('0x19'),_0xb9d9('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xb9d9('0xa')]}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0xb9d9('0x1a'),_0xb9d9('0x1b'),_0xb9d9('0x1c')]}]},'log':'GetDynamics365Account'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 090abc7..52613fd 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x988c=['type','key','keyType','idField','nameField','customField','../../client','GetFreshdeskAccount','name','username','FreshdeskConfiguration','Configurations','FreshdeskField','content','variableName','Variable','Descriptions'];(function(_0x498763,_0x334579){var _0x290625=function(_0x111468){while(--_0x111468){_0x498763['push'](_0x498763['shift']());}};_0x290625(++_0x334579);}(_0x988c,0x19e));var _0xc988=function(_0x821278,_0x488724){_0x821278=_0x821278-0x0;var _0x463668=_0x988c[_0x821278];return _0x463668;};'use strict';var client=require(_0xc988('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x53a4fd){return client['Request'](_0xc988('0x1'),{'options':{'raw':![],'attributes':['id',_0xc988('0x2'),_0xc988('0x3'),'apiKey','remoteUri','serverUrl'],'include':[{'model':_0xc988('0x4'),'as':_0xc988('0x5'),'attributes':['id',_0xc988('0x2')],'include':[{'model':'Tag','attributes':['id',_0xc988('0x2')]},{'model':_0xc988('0x6'),'as':'Subjects','attributes':['id','type',_0xc988('0x7'),_0xc988('0x8')],'include':[{'model':_0xc988('0x9'),'as':_0xc988('0x9'),'attributes':['id',_0xc988('0x2')]}]},{'model':'FreshdeskField','as':_0xc988('0xa'),'attributes':['id',_0xc988('0xb'),_0xc988('0x7'),_0xc988('0xc'),_0xc988('0xd'),'keyContent',_0xc988('0x8')],'include':[{'model':_0xc988('0x9'),'as':_0xc988('0x9'),'attributes':['id','name']}]},{'model':_0xc988('0x6'),'as':'Fields','attributes':['id',_0xc988('0xb'),'content',_0xc988('0xe'),_0xc988('0xf'),_0xc988('0x10'),_0xc988('0x8')],'include':[{'model':'Variable','as':_0xc988('0x9'),'attributes':['id',_0xc988('0x2')]}]}]}]},'log':_0xc988('0x1')});};}; \ No newline at end of file +var _0xd71d=['idField','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','username','apiKey','remoteUri','FreshdeskConfiguration','Configurations','name','FreshdeskField','Subjects','type','variableName','Variable','content','key','keyType','Fields'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xd71d,0x1a5));var _0xdd71=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xd71d[_0x15876a];return _0xbd900f;};'use strict';var client=require(_0xdd71('0x0'));exports[_0xdd71('0x1')]=function(){return function(_0x164949){return client[_0xdd71('0x2')](_0xdd71('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xdd71('0x4'),_0xdd71('0x5'),_0xdd71('0x6'),'serverUrl'],'include':[{'model':_0xdd71('0x7'),'as':_0xdd71('0x8'),'attributes':['id',_0xdd71('0x9')],'include':[{'model':'Tag','attributes':['id',_0xdd71('0x9')]},{'model':_0xdd71('0xa'),'as':_0xdd71('0xb'),'attributes':['id',_0xdd71('0xc'),'content',_0xdd71('0xd')],'include':[{'model':_0xdd71('0xe'),'as':_0xdd71('0xe'),'attributes':['id',_0xdd71('0x9')]}]},{'model':_0xdd71('0xa'),'as':'Descriptions','attributes':['id',_0xdd71('0xc'),_0xdd71('0xf'),_0xdd71('0x10'),_0xdd71('0x11'),'keyContent',_0xdd71('0xd')],'include':[{'model':_0xdd71('0xe'),'as':_0xdd71('0xe'),'attributes':['id',_0xdd71('0x9')]}]},{'model':_0xdd71('0xa'),'as':_0xdd71('0x12'),'attributes':['id','type',_0xdd71('0xf'),_0xdd71('0x13'),_0xdd71('0x14'),_0xdd71('0x15'),'variableName'],'include':[{'model':_0xdd71('0xe'),'as':_0xdd71('0xe'),'attributes':['id',_0xdd71('0x9')]}]}]}]},'log':_0xdd71('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index f1ca4a7..b2426ef 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b65=['getFreshsalesAccounts','Request','name','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','Variable','key','keyType','keyContent','variableName','../../client'];(function(_0x2586b4,_0x2a886c){var _0x2bf1f7=function(_0x5d80fd){while(--_0x5d80fd){_0x2586b4['push'](_0x2586b4['shift']());}};_0x2bf1f7(++_0x2a886c);}(_0x1b65,0x1b4));var _0x51b6=function(_0x501099,_0x223250){_0x501099=_0x501099-0x0;var _0x555ebf=_0x1b65[_0x501099];return _0x555ebf;};'use strict';var client=require(_0x51b6('0x0'));exports[_0x51b6('0x1')]=function(){return function(_0x3e4953){return client[_0x51b6('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x51b6('0x3'),_0x51b6('0x4'),_0x51b6('0x5'),_0x51b6('0x6'),_0x51b6('0x7')],'include':[{'model':_0x51b6('0x8'),'as':_0x51b6('0x9'),'attributes':['id','name'],'include':[{'model':_0x51b6('0xa'),'as':_0x51b6('0xb'),'attributes':['id',_0x51b6('0xc'),_0x51b6('0xd'),'variableName'],'include':[{'model':_0x51b6('0xe'),'as':_0x51b6('0xe'),'attributes':['id','name']}]},{'model':_0x51b6('0xa'),'as':'Descriptions','attributes':['id','type',_0x51b6('0xd'),_0x51b6('0xf'),_0x51b6('0x10'),_0x51b6('0x11'),_0x51b6('0x12')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x51b6('0x3')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file +var _0x39e6=['username','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','variableName','Variable','Descriptions','key','GetFreshsalesccount','../../client','name'];(function(_0x4a9691,_0x2e40bb){var _0xcc72f5=function(_0x1010af){while(--_0x1010af){_0x4a9691['push'](_0x4a9691['shift']());}};_0xcc72f5(++_0x2e40bb);}(_0x39e6,0x9e));var _0x639e=function(_0x10ee05,_0x4e2028){_0x10ee05=_0x10ee05-0x0;var _0x6c665f=_0x39e6[_0x10ee05];return _0x6c665f;};'use strict';var client=require(_0x639e('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x2b265a){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x639e('0x1'),_0x639e('0x2'),'apiKey',_0x639e('0x3'),_0x639e('0x4')],'include':[{'model':_0x639e('0x5'),'as':_0x639e('0x6'),'attributes':['id',_0x639e('0x1')],'include':[{'model':_0x639e('0x7'),'as':_0x639e('0x8'),'attributes':['id',_0x639e('0x9'),_0x639e('0xa'),_0x639e('0xb')],'include':[{'model':_0x639e('0xc'),'as':_0x639e('0xc'),'attributes':['id',_0x639e('0x1')]}]},{'model':_0x639e('0x7'),'as':_0x639e('0xd'),'attributes':['id',_0x639e('0x9'),_0x639e('0xa'),_0x639e('0xe'),'keyType','keyContent',_0x639e('0xb')],'include':[{'model':_0x639e('0xc'),'as':_0x639e('0xc'),'attributes':['id',_0x639e('0x1')]}]}]}]},'log':_0x639e('0xf')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 436744d..a328ffd 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01b5=['SalesforceField','Subjects','Variable','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','password','remoteUri','clientId','clientSecret','serverUrl','type','SalesforceConfiguration','moduleSearch','moduleCreate','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'];(function(_0xbcb6b4,_0x58980d){var _0x16a505=function(_0x4e1c88){while(--_0x4e1c88){_0xbcb6b4['push'](_0xbcb6b4['shift']());}};_0x16a505(++_0x58980d);}(_0x01b5,0xca));var _0x501b=function(_0x20f5bb,_0x4538ed){_0x20f5bb=_0x20f5bb-0x0;var _0x22c379=_0x01b5[_0x20f5bb];return _0x22c379;};'use strict';var client=require(_0x501b('0x0'));exports[_0x501b('0x1')]=function(){return function(_0xa7700d){return client[_0x501b('0x2')](_0x501b('0x3'),{'options':{'raw':![],'attributes':['id',_0x501b('0x4'),'username',_0x501b('0x5'),_0x501b('0x6'),_0x501b('0x7'),_0x501b('0x8'),'securityToken',_0x501b('0x9'),_0x501b('0xa')],'include':[{'model':_0x501b('0xb'),'as':'Configurations','attributes':['id',_0x501b('0x4'),_0x501b('0xc'),_0x501b('0xd'),'ticketType',_0x501b('0xe'),_0x501b('0xf'),_0x501b('0x10'),_0x501b('0x11')],'include':[{'model':_0x501b('0x12'),'as':_0x501b('0x13'),'include':[{'model':_0x501b('0x14'),'as':_0x501b('0x14'),'attributes':['id',_0x501b('0x4')]}]},{'model':'SalesforceField','as':'Descriptions','include':[{'model':_0x501b('0x14'),'as':_0x501b('0x14'),'attributes':['id',_0x501b('0x4')]}]},{'model':'SalesforceField','as':_0x501b('0x15'),'include':[{'model':_0x501b('0x14'),'as':_0x501b('0x14'),'attributes':['id',_0x501b('0x4')]}]}]}]},'log':_0x501b('0x3')});};}; \ No newline at end of file +var _0xd958=['moduleCreate','ticketType','additionalSearchAccount','additionalSearchContact','additionalSearchLead','Variable','Descriptions','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','username','password','remoteUri','clientId','clientSecret','securityToken','serverUrl','type','Configurations','name','moduleSearch'];(function(_0x57da5d,_0x54d750){var _0x11c440=function(_0x29bee5){while(--_0x29bee5){_0x57da5d['push'](_0x57da5d['shift']());}};_0x11c440(++_0x54d750);}(_0xd958,0xb8));var _0x8d95=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd958[_0x25e7cb];return _0x375d92;};'use strict';var client=require(_0x8d95('0x0'));exports[_0x8d95('0x1')]=function(){return function(_0x5c134f){return client['Request'](_0x8d95('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8d95('0x3'),_0x8d95('0x4'),_0x8d95('0x5'),_0x8d95('0x6'),_0x8d95('0x7'),_0x8d95('0x8'),_0x8d95('0x9'),_0x8d95('0xa')],'include':[{'model':'SalesforceConfiguration','as':_0x8d95('0xb'),'attributes':['id',_0x8d95('0xc'),_0x8d95('0xd'),_0x8d95('0xe'),_0x8d95('0xf'),'leadId',_0x8d95('0x10'),_0x8d95('0x11'),_0x8d95('0x12')],'include':[{'model':'SalesforceField','as':'Subjects','include':[{'model':_0x8d95('0x13'),'as':_0x8d95('0x13'),'attributes':['id',_0x8d95('0xc')]}]},{'model':'SalesforceField','as':_0x8d95('0x14'),'include':[{'model':'Variable','as':_0x8d95('0x13'),'attributes':['id',_0x8d95('0xc')]}]},{'model':'SalesforceField','as':_0x8d95('0x15'),'include':[{'model':_0x8d95('0x13'),'as':'Variable','attributes':['id',_0x8d95('0xc')]}]}]}]},'log':_0x8d95('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 0b8d775..c40b956 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','username','email','remoteUri','ServicenowConfiguration','ServicenowField','type','content','variableName','Variable','Descriptions','keyType','idField','nameField'];(function(_0x1b9593,_0x3daa09){var _0x3810c7=function(_0x3e57ba){while(--_0x3e57ba){_0x1b9593['push'](_0x1b9593['shift']());}};_0x3810c7(++_0x3daa09);}(_0x53ec,0x192));var _0xc53e=function(_0x3f146c,_0x42e0dc){_0x3f146c=_0x3f146c-0x0;var _0x407f72=_0x53ec[_0x3f146c];return _0x407f72;};'use strict';var client=require(_0xc53e('0x0'));exports[_0xc53e('0x1')]=function(){return function(_0x2d5f51){return client[_0xc53e('0x2')](_0xc53e('0x3'),{'options':{'raw':![],'attributes':['id',_0xc53e('0x4'),'description',_0xc53e('0x5'),'password',_0xc53e('0x6'),_0xc53e('0x7'),'serverUrl'],'include':[{'model':_0xc53e('0x8'),'as':'Configurations','attributes':['id',_0xc53e('0x4')],'include':[{'model':_0xc53e('0x9'),'as':'Subjects','attributes':['id',_0xc53e('0xa'),_0xc53e('0xb'),_0xc53e('0xc')],'include':[{'model':_0xc53e('0xd'),'as':_0xc53e('0xd'),'attributes':['id',_0xc53e('0x4')]}]},{'model':_0xc53e('0x9'),'as':_0xc53e('0xe'),'attributes':['id',_0xc53e('0xa'),'content','key',_0xc53e('0xf'),'keyContent','variableName'],'include':[{'model':_0xc53e('0xd'),'as':_0xc53e('0xd'),'attributes':['id',_0xc53e('0x4')]}]},{'model':_0xc53e('0x9'),'as':'Fields','attributes':['id','type',_0xc53e('0xb'),_0xc53e('0x10'),_0xc53e('0x11'),_0xc53e('0x12'),_0xc53e('0xc')],'include':[{'model':_0xc53e('0xd'),'as':_0xc53e('0xd'),'attributes':['id',_0xc53e('0x4')]}]}]}]},'log':_0xc53e('0x13')});};}; \ No newline at end of file +var _0x187d=['../../client','Request','GetServicenowAccount','name','description','username','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','idField','nameField'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x187d,0x93));var _0xd187=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x187d[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0xd187('0x0'));exports['getServicenowAccounts']=function(){return function(_0x3b9b6d){return client[_0xd187('0x1')](_0xd187('0x2'),{'options':{'raw':![],'attributes':['id',_0xd187('0x3'),_0xd187('0x4'),_0xd187('0x5'),'password',_0xd187('0x6'),_0xd187('0x7'),'serverUrl'],'include':[{'model':_0xd187('0x8'),'as':_0xd187('0x9'),'attributes':['id',_0xd187('0x3')],'include':[{'model':_0xd187('0xa'),'as':_0xd187('0xb'),'attributes':['id',_0xd187('0xc'),_0xd187('0xd'),_0xd187('0xe')],'include':[{'model':'Variable','as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]},{'model':_0xd187('0xa'),'as':_0xd187('0x10'),'attributes':['id',_0xd187('0xc'),_0xd187('0xd'),'key',_0xd187('0x11'),_0xd187('0x12'),_0xd187('0xe')],'include':[{'model':'Variable','as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]},{'model':_0xd187('0xa'),'as':'Fields','attributes':['id',_0xd187('0xc'),_0xd187('0xd'),_0xd187('0x13'),_0xd187('0x14'),'customField',_0xd187('0xe')],'include':[{'model':_0xd187('0xf'),'as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 2300e59..7afad58 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x3ae147,_0x4ca19b){var _0x235663=function(_0x1a9a99){while(--_0x1a9a99){_0x3ae147['push'](_0x3ae147['shift']());}};_0x235663(++_0x4ca19b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x0b0e[_0x1d70db];return _0x3060c6;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file +var _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0x2abb6a,_0x385d2d){var _0x34c83f=function(_0x279b12){while(--_0x279b12){_0x2abb6a['push'](_0x2abb6a['shift']());}};_0x34c83f(++_0x385d2d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 4b2fbf2..57743c5 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x95f3=['GetVtigerAccount','name','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','Subjects','type','Variable','VtigerField','Descriptions','content','key','keyContent','variableName','Fields','idField','customField','../../client','getVtigerAccounts'];(function(_0x14bff8,_0x5dca25){var _0x26e63b=function(_0x2e6a8a){while(--_0x2e6a8a){_0x14bff8['push'](_0x14bff8['shift']());}};_0x26e63b(++_0x5dca25);}(_0x95f3,0x1b3));var _0x395f=function(_0x54a8f8,_0x28c1b2){_0x54a8f8=_0x54a8f8-0x0;var _0x5af95c=_0x95f3[_0x54a8f8];return _0x5af95c;};'use strict';var client=require(_0x395f('0x0'));exports[_0x395f('0x1')]=function(){return function(_0x1f8ead){return client['Request'](_0x395f('0x2'),{'options':{'raw':![],'attributes':['id',_0x395f('0x3'),_0x395f('0x4'),_0x395f('0x5'),_0x395f('0x6'),_0x395f('0x7'),_0x395f('0x8')],'include':[{'model':_0x395f('0x9'),'as':_0x395f('0xa'),'attributes':['id',_0x395f('0x3')],'include':[{'model':'VtigerField','as':_0x395f('0xb'),'attributes':['id',_0x395f('0xc'),'content','variableName'],'include':[{'model':_0x395f('0xd'),'as':_0x395f('0xd'),'attributes':['id',_0x395f('0x3')]}]},{'model':_0x395f('0xe'),'as':_0x395f('0xf'),'attributes':['id','type',_0x395f('0x10'),_0x395f('0x11'),'keyType',_0x395f('0x12'),_0x395f('0x13')],'include':[{'model':_0x395f('0xd'),'as':_0x395f('0xd'),'attributes':['id',_0x395f('0x3')]}]},{'model':'VtigerField','as':_0x395f('0x14'),'attributes':['id','type',_0x395f('0x10'),_0x395f('0x15'),'nameField',_0x395f('0x16'),_0x395f('0x13')],'include':[{'model':_0x395f('0xd'),'as':_0x395f('0xd'),'attributes':['id','name']}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file +var _0x8abb=['VtigerField','key','keyContent','Fields','content','nameField','../../client','getVtigerAccounts','Request','GetVtigerAccount','description','username','accessKey','remoteUri','VtigerConfiguration','Configurations','name','Subjects','type','variableName','Variable'];(function(_0x2fef32,_0x18992d){var _0x1087c2=function(_0x1ead9f){while(--_0x1ead9f){_0x2fef32['push'](_0x2fef32['shift']());}};_0x1087c2(++_0x18992d);}(_0x8abb,0x102));var _0xb8ab=function(_0xa19011,_0x3523a7){_0xa19011=_0xa19011-0x0;var _0x54f1ea=_0x8abb[_0xa19011];return _0x54f1ea;};'use strict';var client=require(_0xb8ab('0x0'));exports[_0xb8ab('0x1')]=function(){return function(_0x12e295){return client[_0xb8ab('0x2')](_0xb8ab('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb8ab('0x4'),_0xb8ab('0x5'),_0xb8ab('0x6'),_0xb8ab('0x7'),'serverUrl'],'include':[{'model':_0xb8ab('0x8'),'as':_0xb8ab('0x9'),'attributes':['id',_0xb8ab('0xa')],'include':[{'model':'VtigerField','as':_0xb8ab('0xb'),'attributes':['id',_0xb8ab('0xc'),'content',_0xb8ab('0xd')],'include':[{'model':_0xb8ab('0xe'),'as':_0xb8ab('0xe'),'attributes':['id',_0xb8ab('0xa')]}]},{'model':_0xb8ab('0xf'),'as':'Descriptions','attributes':['id',_0xb8ab('0xc'),'content',_0xb8ab('0x10'),'keyType',_0xb8ab('0x11'),_0xb8ab('0xd')],'include':[{'model':_0xb8ab('0xe'),'as':'Variable','attributes':['id','name']}]},{'model':'VtigerField','as':_0xb8ab('0x12'),'attributes':['id',_0xb8ab('0xc'),_0xb8ab('0x13'),'idField',_0xb8ab('0x14'),'customField','variableName'],'include':[{'model':_0xb8ab('0xe'),'as':_0xb8ab('0xe'),'attributes':['id',_0xb8ab('0xa')]}]}]}]},'log':_0xb8ab('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 871276c..7db70ef 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde1e=['ZendeskField','Subjects','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','customField','GetZendeskAccount','../../client','getZendeskAccounts','Request','password','token','remoteUri','authType','serverUrl','type','Configurations','name','Tag'];(function(_0x3831be,_0x62691f){var _0x515005=function(_0x58b060){while(--_0x58b060){_0x3831be['push'](_0x3831be['shift']());}};_0x515005(++_0x62691f);}(_0xde1e,0x1d4));var _0xede1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde1e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xede1('0x0'));exports[_0xede1('0x1')]=function(){return function(_0x53eee1){return client[_0xede1('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id','name','username',_0xede1('0x3'),_0xede1('0x4'),_0xede1('0x5'),_0xede1('0x6'),_0xede1('0x7'),_0xede1('0x8')],'include':[{'model':'ZendeskConfiguration','as':_0xede1('0x9'),'attributes':['id',_0xede1('0xa')],'include':[{'model':_0xede1('0xb'),'attributes':['id','name']},{'model':_0xede1('0xc'),'as':_0xede1('0xd'),'attributes':['id','type',_0xede1('0xe'),_0xede1('0xf')],'include':[{'model':'Variable','as':_0xede1('0x10'),'attributes':['id',_0xede1('0xa')]}]},{'model':'ZendeskField','as':_0xede1('0x11'),'attributes':['id',_0xede1('0x8'),'content','key',_0xede1('0x12'),_0xede1('0x13'),_0xede1('0xf')],'include':[{'model':_0xede1('0x10'),'as':_0xede1('0x10'),'attributes':['id','name']}]},{'model':_0xede1('0xc'),'as':_0xede1('0x14'),'attributes':['id',_0xede1('0x8'),'content',_0xede1('0x15'),'nameField',_0xede1('0x16'),_0xede1('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xede1('0xa')]}]}]}]},'log':_0xede1('0x17')});};}; \ No newline at end of file +var _0x7010=['username','password','token','authType','serverUrl','type','ZendeskConfiguration','Configurations','name','Subjects','content','variableName','Variable','ZendeskField','Descriptions','keyContent','Fields','nameField','customField','../../client','getZendeskAccounts','GetZendeskAccount'];(function(_0x29372b,_0x4b9f6e){var _0x88acd4=function(_0x4909ce){while(--_0x4909ce){_0x29372b['push'](_0x29372b['shift']());}};_0x88acd4(++_0x4b9f6e);}(_0x7010,0xc3));var _0x0701=function(_0x4de4e6,_0x5aa090){_0x4de4e6=_0x4de4e6-0x0;var _0x61b815=_0x7010[_0x4de4e6];return _0x61b815;};'use strict';var client=require(_0x0701('0x0'));exports[_0x0701('0x1')]=function(){return function(_0x91a514){return client['Request'](_0x0701('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0701('0x3'),_0x0701('0x4'),_0x0701('0x5'),'remoteUri',_0x0701('0x6'),_0x0701('0x7'),_0x0701('0x8')],'include':[{'model':_0x0701('0x9'),'as':_0x0701('0xa'),'attributes':['id',_0x0701('0xb')],'include':[{'model':'Tag','attributes':['id',_0x0701('0xb')]},{'model':'ZendeskField','as':_0x0701('0xc'),'attributes':['id',_0x0701('0x8'),_0x0701('0xd'),_0x0701('0xe')],'include':[{'model':_0x0701('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':_0x0701('0x10'),'as':_0x0701('0x11'),'attributes':['id',_0x0701('0x8'),_0x0701('0xd'),'key','keyType',_0x0701('0x12'),_0x0701('0xe')],'include':[{'model':_0x0701('0xf'),'as':'Variable','attributes':['id',_0x0701('0xb')]}]},{'model':_0x0701('0x10'),'as':_0x0701('0x13'),'attributes':['id','type',_0x0701('0xd'),'idField',_0x0701('0x14'),_0x0701('0x15'),_0x0701('0xe')],'include':[{'model':_0x0701('0xf'),'as':_0x0701('0xf'),'attributes':['id',_0x0701('0xb')]}]}]}]},'log':_0x0701('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index bd24fc2..69b1c81 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd27=['nameField','customField','name','description','host','zone','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','idField'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0xfd27,0x10a));var _0x7fd2=function(_0x2f0544,_0x340fd8){_0x2f0544=_0x2f0544-0x0;var _0x136c75=_0xfd27[_0x2f0544];return _0x136c75;};'use strict';var client=require('../../client');exports['getZohoAccounts']=function(){return function(_0x5672bc){return client['Request']('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x7fd2('0x0'),_0x7fd2('0x1'),_0x7fd2('0x2'),_0x7fd2('0x3'),'clientId',_0x7fd2('0x4'),_0x7fd2('0x5'),_0x7fd2('0x6'),_0x7fd2('0x7')],'include':[{'model':_0x7fd2('0x8'),'as':_0x7fd2('0x9'),'attributes':['id','name','moduleCreate','moduleSearch','description'],'include':[{'model':_0x7fd2('0xa'),'as':_0x7fd2('0xb'),'attributes':['id',_0x7fd2('0xc'),_0x7fd2('0xd'),_0x7fd2('0xe')],'include':[{'model':_0x7fd2('0xf'),'as':_0x7fd2('0xf'),'attributes':['id',_0x7fd2('0x0')]}]},{'model':_0x7fd2('0xa'),'as':_0x7fd2('0x10'),'attributes':['id',_0x7fd2('0xc'),_0x7fd2('0xd'),'key',_0x7fd2('0x11'),_0x7fd2('0x12'),_0x7fd2('0xe')],'include':[{'model':_0x7fd2('0xf'),'as':_0x7fd2('0xf'),'attributes':['id',_0x7fd2('0x0')]}]},{'model':'ZohoField','as':'Fields','attributes':['id',_0x7fd2('0xc'),_0x7fd2('0xd'),_0x7fd2('0x13'),_0x7fd2('0x14'),_0x7fd2('0x15'),_0x7fd2('0xe')],'include':[{'model':_0x7fd2('0xf'),'as':_0x7fd2('0xf'),'attributes':['id',_0x7fd2('0x0')]}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0x48d7=['content','variableName','Variable','Descriptions','keyType','keyContent','Fields','type','nameField','customField','../../client','Request','GetZohoAccount','description','host','zone','serverUrl','code','refreshToken','Configurations','name','ZohoField'];(function(_0x1fe903,_0x44f2bc){var _0x559922=function(_0x31f54f){while(--_0x31f54f){_0x1fe903['push'](_0x1fe903['shift']());}};_0x559922(++_0x44f2bc);}(_0x48d7,0x128));var _0x748d=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x48d7[_0x45783c];return _0x1161da;};'use strict';var client=require(_0x748d('0x0'));exports['getZohoAccounts']=function(){return function(_0x1d825d){return client[_0x748d('0x1')](_0x748d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x748d('0x3'),_0x748d('0x4'),_0x748d('0x5'),'clientId','clientSecret',_0x748d('0x6'),_0x748d('0x7'),_0x748d('0x8')],'include':[{'model':'ZohoConfiguration','as':_0x748d('0x9'),'attributes':['id',_0x748d('0xa'),'moduleCreate','moduleSearch',_0x748d('0x3')],'include':[{'model':_0x748d('0xb'),'as':'Subjects','attributes':['id','type',_0x748d('0xc'),_0x748d('0xd')],'include':[{'model':_0x748d('0xe'),'as':_0x748d('0xe'),'attributes':['id',_0x748d('0xa')]}]},{'model':_0x748d('0xb'),'as':_0x748d('0xf'),'attributes':['id','type','content','key',_0x748d('0x10'),_0x748d('0x11'),_0x748d('0xd')],'include':[{'model':_0x748d('0xe'),'as':_0x748d('0xe'),'attributes':['id',_0x748d('0xa')]}]},{'model':_0x748d('0xb'),'as':_0x748d('0x12'),'attributes':['id',_0x748d('0x13'),_0x748d('0xc'),'idField',_0x748d('0x14'),_0x748d('0x15'),_0x748d('0xd')],'include':[{'model':_0x748d('0xe'),'as':_0x748d('0xe'),'attributes':['id',_0x748d('0xa')]}]}]}]},'log':_0x748d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index bc20c3c..008f120 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd00=['replace','silly','length','resolve','number','every','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','stack'];(function(_0x164b0b,_0x442681){var _0x4d32d8=function(_0x137a94){while(--_0x137a94){_0x164b0b['push'](_0x164b0b['shift']());}};_0x4d32d8(++_0x442681);}(_0xcd00,0x10b));var _0x0cd0=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xcd00[_0x1928c9];return _0x51b5fb;};var logger=require(_0x0cd0('0x0'))(_0x0cd0('0x1'));var client=require('../client');function intervalIftime(_0x284be5,_0x6192ad){const _0x5e1274=new Error()[_0x0cd0('0x2')][_0x0cd0('0x3')](/^Error/,'')['trim']();logger[_0x0cd0('0x4')]('intervalIftime\x20called\x20with',_0x284be5,_0x6192ad,_0x5e1274);const _0x18f673=Array['isArray'](_0x284be5);if(!_0x284be5||_0x18f673&&_0x284be5[_0x0cd0('0x5')]===0x0){return Promise[_0x0cd0('0x6')](![]);}else{var _0x825163=[];var _0x2cc098=[];var _0x4057bb=_0x18f673?_0x284be5:[_0x284be5];var _0x19e495=_0x4057bb['every'](function(_0x572c48){return typeof _0x572c48===_0x0cd0('0x7');});var _0x46eee6=_0x4057bb[_0x0cd0('0x8')](function(_0x410190){return typeof _0x410190==='string';});if(!_0x19e495&&!_0x46eee6){_0x825163=_0x4057bb[_0x0cd0('0x9')](function(_0x6285cf){return _0x6285cf['id'];});if(_0x825163[_0x0cd0('0x5')]===0x0){_0x2cc098=_0x4057bb[_0x0cd0('0x9')](function(_0x7ccec6){return _0x7ccec6[_0x0cd0('0xa')];});}}else{if(_0x19e495){_0x825163=_0x825163[_0x0cd0('0xb')](_0x4057bb);}if(_0x46eee6){_0x2cc098=_0x2cc098[_0x0cd0('0xb')](_0x4057bb);}}return client[_0x0cd0('0xc')](_0x0cd0('0xd'),{'intervalIds':_0x825163,'intervals':_0x2cc098,'timezone':_0x6192ad,'log':_0x0cd0('0xd')});}}exports[_0x0cd0('0xe')]=intervalIftime; \ No newline at end of file +var _0x3247=['IntervalIftime','intervalIftime','../../../config/logger','dialer','stack','replace','trim','silly','intervalIftime\x20called\x20with','resolve','number','every','map','length','interval','concat','Request'];(function(_0x20afc7,_0x263339){var _0x20cd51=function(_0x5aa807){while(--_0x5aa807){_0x20afc7['push'](_0x20afc7['shift']());}};_0x20cd51(++_0x263339);}(_0x3247,0x1ab));var _0x7324=function(_0x58c8d3,_0x53f9ce){_0x58c8d3=_0x58c8d3-0x0;var _0x4667a2=_0x3247[_0x58c8d3];return _0x4667a2;};var logger=require(_0x7324('0x0'))(_0x7324('0x1'));var client=require('../client');function intervalIftime(_0x3aa87c,_0x52584c){const _0x152bdd=new Error()[_0x7324('0x2')][_0x7324('0x3')](/^Error/,'')[_0x7324('0x4')]();logger[_0x7324('0x5')](_0x7324('0x6'),_0x3aa87c,_0x52584c,_0x152bdd);const _0x4d813e=Array['isArray'](_0x3aa87c);if(!_0x3aa87c||_0x4d813e&&_0x3aa87c['length']===0x0){return Promise[_0x7324('0x7')](![]);}else{var _0x459135=[];var _0x3302b7=[];var _0x78d3b3=_0x4d813e?_0x3aa87c:[_0x3aa87c];var _0x4b969d=_0x78d3b3['every'](function(_0x24a212){return typeof _0x24a212===_0x7324('0x8');});var _0x8f2de1=_0x78d3b3[_0x7324('0x9')](function(_0x58c1ab){return typeof _0x58c1ab==='string';});if(!_0x4b969d&&!_0x8f2de1){_0x459135=_0x78d3b3[_0x7324('0xa')](function(_0x82b391){return _0x82b391['id'];});if(_0x459135[_0x7324('0xb')]===0x0){_0x3302b7=_0x78d3b3[_0x7324('0xa')](function(_0x2c8de8){return _0x2c8de8[_0x7324('0xc')];});}}else{if(_0x4b969d){_0x459135=_0x459135[_0x7324('0xd')](_0x78d3b3);}if(_0x8f2de1){_0x3302b7=_0x3302b7[_0x7324('0xd')](_0x78d3b3);}}return client[_0x7324('0xe')](_0x7324('0xf'),{'intervalIds':_0x459135,'intervals':_0x3302b7,'timezone':_0x52584c,'log':_0x7324('0xf')});}}exports[_0x7324('0x10')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 4001501..edc6a4e 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1313=['toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','CreateMemberReport','voice','lastAssignedTo','interface','format','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','queue','agent','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','outbound','exten','dialstring'];(function(_0x3f1710,_0x3877a2){var _0x528458=function(_0x4b5d0f){while(--_0x4b5d0f){_0x3f1710['push'](_0x3f1710['shift']());}};_0x528458(++_0x3877a2);}(_0x1313,0x92));var _0x3131=function(_0x362d69,_0x497bb6){_0x362d69=_0x362d69-0x0;var _0x343482=_0x1313[_0x362d69];return _0x343482;};'use strict';var moment=require(_0x3131('0x0'));var _=require(_0x3131('0x1'));var util=require(_0x3131('0x2'));var client=require(_0x3131('0x3'));exports[_0x3131('0x4')]=function(_0x5a6105){var _0x2487f0=_0x5a6105[_0x3131('0x5')]||_0x5a6105['queuecallerexitAt'];return client['Request'](_0x3131('0x6'),{'body':{'channel':_0x3131('0x7'),'membername':_0x5a6105[_0x3131('0x8')],'interface':_['isNil'](_0x5a6105[_0x3131('0x9')])?util[_0x3131('0xa')]('SIP/%s',_0x5a6105[_0x3131('0x8')]):_0x5a6105[_0x3131('0x9')],'type':_0x3131('0xb'),'enterAt':_0x5a6105['queuecallerleaveAt'],'exitAt':_0x2487f0,'duration':moment(_0x2487f0)[_0x3131('0xc')](_0x5a6105[_0x3131('0xd')],_0x3131('0xe')),'data1':_0x3131('0xf'),'data2':_0x5a6105[_0x3131('0x10')],'data3':_0x5a6105['exten'],'data4':null,'data5':_0x5a6105[_0x3131('0x11')],'role':_0x3131('0x12'),'internal':_0x5a6105[_0x3131('0x13')]?_['toNumber'](_0x5a6105[_0x3131('0x13')]):undefined,'uniqueid':_0x5a6105[_0x3131('0x14')]},'log':'CreateMemberReport'});};exports[_0x3131('0x15')]=function(_0x11ee40){return client['Request']('CreateMemberReport',{'body':{'channel':'voice','membername':_0x11ee40[_0x3131('0x16')],'interface':_0x11ee40[_0x3131('0x9')],'type':_0x3131('0xb'),'enterAt':_0x11ee40[_0x3131('0x17')],'exitAt':_0x11ee40[_0x3131('0x18')],'duration':moment(_0x11ee40[_0x3131('0x18')])[_0x3131('0xc')](_0x11ee40[_0x3131('0x17')],'seconds')>=0x0?moment(_0x11ee40['endtime'])[_0x3131('0xc')](_0x11ee40[_0x3131('0x17')],'seconds'):null,'data1':_0x3131('0x19'),'data2':_0x11ee40[_0x3131('0x13')],'data3':_0x11ee40[_0x3131('0x1a')],'data4':_0x11ee40[_0x3131('0x1b')]||null,'role':_0x3131('0x12'),'internal':_0x11ee40[_0x3131('0x13')]?_[_0x3131('0x1c')](_0x11ee40[_0x3131('0x13')]):undefined,'uniqueid':_0x11ee40[_0x3131('0x14')]},'log':_0x3131('0x6')});}; \ No newline at end of file +var _0xfaff=['CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','inbound','calleridnum','queue','agent','toNumber','accountcode','uniqueid','Request','starttime','endtime','diff','seconds','outbound','dialstring','lodash','util','../client','voiceQueueReport','queuecallercompleteAt'];(function(_0x109a66,_0x39a107){var _0x22e0ab=function(_0x87ab08){while(--_0x87ab08){_0x109a66['push'](_0x109a66['shift']());}};_0x22e0ab(++_0x39a107);}(_0xfaff,0x183));var _0xffaf=function(_0x4f29ae,_0x1e0c4c){_0x4f29ae=_0x4f29ae-0x0;var _0x44c080=_0xfaff[_0x4f29ae];return _0x44c080;};'use strict';var moment=require('moment');var _=require(_0xffaf('0x0'));var util=require(_0xffaf('0x1'));var client=require(_0xffaf('0x2'));exports[_0xffaf('0x3')]=function(_0xe411db){var _0x3f4f6f=_0xe411db[_0xffaf('0x4')]||_0xe411db['queuecallerexitAt'];return client['Request'](_0xffaf('0x5'),{'body':{'channel':_0xffaf('0x6'),'membername':_0xe411db[_0xffaf('0x7')],'interface':_[_0xffaf('0x8')](_0xe411db[_0xffaf('0x9')])?util[_0xffaf('0xa')](_0xffaf('0xb'),_0xe411db[_0xffaf('0x7')]):_0xe411db[_0xffaf('0x9')],'type':_0xffaf('0xc'),'enterAt':_0xe411db[_0xffaf('0xd')],'exitAt':_0x3f4f6f,'duration':moment(_0x3f4f6f)['diff'](_0xe411db[_0xffaf('0xd')],'seconds'),'data1':_0xffaf('0xe'),'data2':_0xe411db[_0xffaf('0xf')],'data3':_0xe411db['exten'],'data4':null,'data5':_0xe411db[_0xffaf('0x10')],'role':_0xffaf('0x11'),'internal':_0xe411db['accountcode']?_[_0xffaf('0x12')](_0xe411db[_0xffaf('0x13')]):undefined,'uniqueid':_0xe411db[_0xffaf('0x14')]},'log':_0xffaf('0x5')});};exports['voiceDialReport']=function(_0x3d05bb){return client[_0xffaf('0x15')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x3d05bb['membername'],'interface':_0x3d05bb['interface'],'type':_0xffaf('0xc'),'enterAt':_0x3d05bb[_0xffaf('0x16')],'exitAt':_0x3d05bb[_0xffaf('0x17')],'duration':moment(_0x3d05bb[_0xffaf('0x17')])[_0xffaf('0x18')](_0x3d05bb[_0xffaf('0x16')],_0xffaf('0x19'))>=0x0?moment(_0x3d05bb['endtime'])[_0xffaf('0x18')](_0x3d05bb[_0xffaf('0x16')],'seconds'):null,'data1':_0xffaf('0x1a'),'data2':_0x3d05bb[_0xffaf('0x13')],'data3':_0x3d05bb['exten'],'data4':_0x3d05bb[_0xffaf('0x1b')]||null,'role':_0xffaf('0x11'),'internal':_0x3d05bb[_0xffaf('0x13')]?_[_0xffaf('0x12')](_0x3d05bb[_0xffaf('0x13')]):undefined,'uniqueid':_0x3d05bb['uniqueid']},'log':_0xffaf('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e119df1..014e36c 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 _0xa79a=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x59d32c,_0x306b7a){var _0x26e818=function(_0x4c3ed4){while(--_0x4c3ed4){_0x59d32c['push'](_0x59d32c['shift']());}};_0x26e818(++_0x306b7a);}(_0xa79a,0x1df));var _0xaa79=function(_0x4144da,_0x13acfe){_0x4144da=_0x4144da-0x0;var _0xaac3ef=_0xa79a[_0x4144da];return _0xaac3ef;};'use strict';var client=require(_0xaa79('0x0'));exports[_0xaa79('0x1')]=function(){return client[_0xaa79('0x2')](_0xaa79('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xaa79('0x4'),_0xaa79('0x5')]},'log':_0xaa79('0x6')});}; \ No newline at end of file +var _0x83cd=['GetSettings','../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x118733,_0x2bd820){var _0x4777af=function(_0x52886a){while(--_0x52886a){_0x118733['push'](_0x118733['shift']());}};_0x4777af(++_0x2bd820);}(_0x83cd,0x17b));var _0xd83c=function(_0x430cc6,_0x278b59){_0x430cc6=_0x430cc6-0x0;var _0x36470e=_0x83cd[_0x430cc6];return _0x36470e;};'use strict';var client=require(_0xd83c('0x0'));exports[_0xd83c('0x1')]=function(){return client[_0xd83c('0x2')](_0xd83c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd83c('0x4'),'previewRecallmeReminderInterval']},'log':_0xd83c('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 71c170a..c53d8db 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 _0x0659=['name','html','../client','getTemplates'];(function(_0x4bb6c2,_0x1e2244){var _0x571f1f=function(_0x5b097e){while(--_0x5b097e){_0x4bb6c2['push'](_0x4bb6c2['shift']());}};_0x571f1f(++_0x1e2244);}(_0x0659,0x122));var _0x9065=function(_0x20bbcc,_0x5f0320){_0x20bbcc=_0x20bbcc-0x0;var _0x3bebda=_0x0659[_0x20bbcc];return _0x3bebda;};'use strict';var client=require(_0x9065('0x0'));exports[_0x9065('0x1')]=function(_0x2d8a07){return function(_0xd98cf7){return client['Request']('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9065('0x2'),_0x9065('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xc224=['GetTemplate','name','html','../client','getTemplates'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xc224,0xe4));var _0x4c22=function(_0x2e79c3,_0x2798ec){_0x2e79c3=_0x2e79c3-0x0;var _0x2e8097=_0xc224[_0x2e79c3];return _0x2e8097;};'use strict';var client=require(_0x4c22('0x0'));exports[_0x4c22('0x1')]=function(_0xde4605){return function(_0x251669){return client['Request'](_0x4c22('0x2'),{'options':{'raw':!![],'attributes':['id',_0x4c22('0x3'),_0x4c22('0x4')]},'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 8d088db..2a6d9bf 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 _0xa0fe=['data6','data7','../client','getTriggers','GetTrigger','name','channel','Condition','field','operator','value','AnyConditions','Action','action','data1','data4','data5'];(function(_0x54f4f1,_0x2e603b){var _0x14b71f=function(_0x410ca5){while(--_0x410ca5){_0x54f4f1['push'](_0x54f4f1['shift']());}};_0x14b71f(++_0x2e603b);}(_0xa0fe,0x178));var _0xea0f=function(_0x184d7d,_0xd5ac95){_0x184d7d=_0x184d7d-0x0;var _0x467580=_0xa0fe[_0x184d7d];return _0x467580;};'use strict';var client=require(_0xea0f('0x0'));exports[_0xea0f('0x1')]=function(_0x36d028){return function(_0x4c51e9){return client['Request'](_0xea0f('0x2'),{'options':{'raw':![],'attributes':['id',_0xea0f('0x3'),_0xea0f('0x4'),'status'],'include':[{'model':_0xea0f('0x5'),'as':'AllConditions','attributes':['id',_0xea0f('0x6'),_0xea0f('0x7'),_0xea0f('0x8')]},{'model':_0xea0f('0x5'),'as':_0xea0f('0x9'),'attributes':['id',_0xea0f('0x6'),_0xea0f('0x7'),_0xea0f('0x8')]},{'model':_0xea0f('0xa'),'as':'Actions','attributes':['id',_0xea0f('0xb'),_0xea0f('0xc'),'data2','data3',_0xea0f('0xd'),_0xea0f('0xe'),_0xea0f('0xf'),_0xea0f('0x10')]}]},'log':_0xea0f('0x2')});};}; \ No newline at end of file +var _0x6366=['getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data6','data7','../client'];(function(_0x214890,_0x2562c0){var _0x760050=function(_0x29742c){while(--_0x29742c){_0x214890['push'](_0x214890['shift']());}};_0x760050(++_0x2562c0);}(_0x6366,0x175));var _0x6636=function(_0xa11b75,_0x436a7c){_0xa11b75=_0xa11b75-0x0;var _0x4a4dd1=_0x6366[_0xa11b75];return _0x4a4dd1;};'use strict';var client=require(_0x6636('0x0'));exports[_0x6636('0x1')]=function(_0x4af26f){return function(_0x47f86e){return client[_0x6636('0x2')](_0x6636('0x3'),{'options':{'raw':![],'attributes':['id',_0x6636('0x4'),_0x6636('0x5'),_0x6636('0x6')],'include':[{'model':_0x6636('0x7'),'as':_0x6636('0x8'),'attributes':['id',_0x6636('0x9'),_0x6636('0xa'),_0x6636('0xb')]},{'model':_0x6636('0x7'),'as':_0x6636('0xc'),'attributes':['id',_0x6636('0x9'),_0x6636('0xa'),_0x6636('0xb')]},{'model':_0x6636('0xd'),'as':_0x6636('0xe'),'attributes':['id',_0x6636('0xf'),_0x6636('0x10'),_0x6636('0x11'),_0x6636('0x12'),_0x6636('0x13'),'data5',_0x6636('0x14'),_0x6636('0x15')]}]},'log':_0x6636('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index f2747ac..4ed42a4 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 _0x06bc=['registry','defaultuser','GetTrunk','../client','getTrunks','name'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x06bc,0x1c5));var _0xc06b=function(_0x4b61c6,_0x297003){_0x4b61c6=_0x4b61c6-0x0;var _0x149b85=_0x06bc[_0x4b61c6];return _0x149b85;};'use strict';var client=require(_0xc06b('0x0'));exports[_0xc06b('0x1')]=function(_0x27036c){return function(_0x521e02){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xc06b('0x2'),_0xc06b('0x3'),_0xc06b('0x4')]},'log':_0xc06b('0x5')});};}; \ No newline at end of file +var _0xcc92=['name','../client','getTrunks','Request','GetTrunk'];(function(_0x189db2,_0x2eaf6a){var _0x48e121=function(_0x4c3cb9){while(--_0x4c3cb9){_0x189db2['push'](_0x189db2['shift']());}};_0x48e121(++_0x2eaf6a);}(_0xcc92,0x141));var _0x2cc9=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0xcc92[_0x3a9661];return _0x5bb119;};'use strict';var client=require(_0x2cc9('0x0'));exports[_0x2cc9('0x1')]=function(_0x954c2d){return function(_0x4b23d9){return client[_0x2cc9('0x2')](_0x2cc9('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2cc9('0x4'),'registry','defaultuser']},'log':_0x2cc9('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 42d68be..b65eb13 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x91cf75,_0x156959){var _0x562f63=function(_0x3f1f8a){while(--_0x3f1f8a){_0x91cf75['push'](_0x91cf75['shift']());}};_0x562f63(++_0x156959);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xcb91[_0x58547b];return _0x1d3fd2;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x417d2d,_0x5a87af){var _0x19f1c1=function(_0x2b515b){while(--_0x2b515b){_0x417d2d['push'](_0x417d2d['shift']());}};_0x19f1c1(++_0x5a87af);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 956f374..db4fa16 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 _0x598b=['update','UpdateVoiceAgentReport','Request','CreateVoiceAgentReport'];(function(_0x55f720,_0x1eee02){var _0x3fb0a9=function(_0x59b5a4){while(--_0x59b5a4){_0x55f720['push'](_0x55f720['shift']());}};_0x3fb0a9(++_0x1eee02);}(_0x598b,0x13a));var _0xb598=function(_0x3da887,_0x536787){_0x3da887=_0x3da887-0x0;var _0x59769a=_0x598b[_0x3da887];return _0x59769a;};'use strict';var client=require('../client');exports['create']=function(_0x5a2f89){return client[_0xb598('0x0')](_0xb598('0x1'),{'body':_0x5a2f89,'log':_0xb598('0x1')});};exports[_0xb598('0x2')]=function(_0x201857,_0x406f38,_0x2a80a6){return client[_0xb598('0x0')](_0xb598('0x3'),{'body':_0x201857,'options':{'where':{'uniqueid':_0x406f38,'interface':_0x2a80a6,'agentcomplete':!![]}},'log':_0xb598('0x3')});}; \ No newline at end of file +var _0xf89b=['update','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x2d4a07,_0x2e1f4d){var _0x43f637=function(_0x2992cf){while(--_0x2992cf){_0x2d4a07['push'](_0x2d4a07['shift']());}};_0x43f637(++_0x2e1f4d);}(_0xf89b,0xb7));var _0xbf89=function(_0x231022,_0x13ac7c){_0x231022=_0x231022-0x0;var _0x39d4d6=_0xf89b[_0x231022];return _0x39d4d6;};'use strict';var client=require(_0xbf89('0x0'));exports[_0xbf89('0x1')]=function(_0x4c4062){return client['Request']('CreateVoiceAgentReport',{'body':_0x4c4062,'log':'CreateVoiceAgentReport'});};exports[_0xbf89('0x2')]=function(_0x1b482d,_0x395b92,_0x2b31aa){return client[_0xbf89('0x3')]('UpdateVoiceAgentReport',{'body':_0x1b482d,'options':{'where':{'uniqueid':_0x395b92,'interface':_0x2b31aa,'agentcomplete':!![]}},'log':_0xbf89('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2e09e54..fd353ec 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 _0x6f62=['disposition','duration','moment','util','lodash','../client','create','merge','calleridnum','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4a4f08,_0x51ea54){var _0x3b912e=function(_0x267514){while(--_0x267514){_0x4a4f08['push'](_0x4a4f08['shift']());}};_0x3b912e(++_0x51ea54);}(_0x6f62,0x1e2));var _0x26f6=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x6f62[_0x39e283];return _0x7de89f;};'use strict';var moment=require(_0x26f6('0x0'));var util=require(_0x26f6('0x1'));var _=require(_0x26f6('0x2'));var client=require(_0x26f6('0x3'));exports[_0x26f6('0x4')]=function(_0x3673fd){return client['Request']('CreateVoiceCallReport',{'body':_[_0x26f6('0x5')](_0x3673fd,{'source':_0x3673fd[_0x26f6('0x6')],'destinationcontext':_0x3673fd['context'],'callerid':_0x3673fd['callerid'],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x26f6('0x7')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x26f6('0x8')],'createdAt':{'$between':[moment()[_0x26f6('0x9')](_0x26f6('0xa'))[_0x26f6('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0x26f6('0xa'))[_0x26f6('0xb')](_0x26f6('0xc'))]}},'attributes':['type',_0x26f6('0xd'),_0x26f6('0xe'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x13e6=['YYYY-MM-DD\x20HH:mm:ss','endOf','duration','billableseconds','moment','util','lodash','create','Request','CreateVoiceCallReport','calleridnum','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day'];(function(_0x4f8709,_0x252add){var _0x1d4968=function(_0x2f3d78){while(--_0x2f3d78){_0x4f8709['push'](_0x4f8709['shift']());}};_0x1d4968(++_0x252add);}(_0x13e6,0xdc));var _0x613e=function(_0x570413,_0x517175){_0x570413=_0x570413-0x0;var _0x5ab28f=_0x13e6[_0x570413];return _0x5ab28f;};'use strict';var moment=require(_0x613e('0x0'));var util=require(_0x613e('0x1'));var _=require(_0x613e('0x2'));var client=require('../client');exports[_0x613e('0x3')]=function(_0x47108f){return client[_0x613e('0x4')](_0x613e('0x5'),{'body':_['merge'](_0x47108f,{'source':_0x47108f[_0x613e('0x6')],'destinationcontext':_0x47108f['context'],'callerid':_0x47108f[_0x613e('0x7')],'amaflags':_0x613e('0x8')}),'log':_0x613e('0x5')});};exports[_0x613e('0x9')]=function(){return function(){return client['Request'](_0x613e('0xa'),{'options':{'where':{'type':[_0x613e('0xb')],'createdAt':{'$between':[moment()[_0x613e('0xc')](_0x613e('0xd'))['format'](_0x613e('0xe')),moment()[_0x613e('0xf')](_0x613e('0xd'))['format'](_0x613e('0xe'))]}},'attributes':['type','disposition',_0x613e('0x10'),_0x613e('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a5c9b7a..f3c6f8e 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 _0x8695=['Request','CreateVoiceDialReport','../client'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x8695,0x11c));var _0x5869=function(_0x5ad294,_0x1477c7){_0x5ad294=_0x5ad294-0x0;var _0x20a450=_0x8695[_0x5ad294];return _0x20a450;};'use strict';var client=require(_0x5869('0x0'));exports['create']=function(_0x325aa1){return client[_0x5869('0x1')](_0x5869('0x2'),{'body':_0x325aa1,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x31bf=['create','Request','CreateVoiceDialReport','../client'];(function(_0x376326,_0x31aa9){var _0x2a7340=function(_0x2464b5){while(--_0x2464b5){_0x376326['push'](_0x376326['shift']());}};_0x2a7340(++_0x31aa9);}(_0x31bf,0x8b));var _0xf31b=function(_0x4ce48b,_0x5a86ff){_0x4ce48b=_0x4ce48b-0x0;var _0x2c49c6=_0x31bf[_0x4ce48b];return _0x2c49c6;};'use strict';var client=require(_0xf31b('0x0'));exports[_0xf31b('0x1')]=function(_0x3c4787){return client[_0xf31b('0x2')](_0xf31b('0x3'),{'body':_0x3c4787,'log':_0xf31b('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 59c0f31..bde6f4f 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 _0x222f=['../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x37e763,_0x1a19e3){var _0x4bf4ab=function(_0x1b0abd){while(--_0x1b0abd){_0x37e763['push'](_0x37e763['shift']());}};_0x4bf4ab(++_0x1a19e3);}(_0x222f,0x1a4));var _0xf222=function(_0x1f15bb,_0x4663fb){_0x1f15bb=_0x1f15bb-0x0;var _0x3a49ef=_0x222f[_0x1f15bb];return _0x3a49ef;};'use strict';var client=require(_0xf222('0x0'));exports[_0xf222('0x1')]=function(){return function(){return client[_0xf222('0x2')](_0xf222('0x3'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf222('0x1')});};}; \ No newline at end of file +var _0x9e0d=['GetVoiceExtension','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x4f95ab,_0x18f61d){var _0x1c8c57=function(_0x12471f){while(--_0x12471f){_0x4f95ab['push'](_0x4f95ab['shift']());}};_0x1c8c57(++_0x18f61d);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x12e506,_0x1718fe){_0x12e506=_0x12e506-0x0;var _0xbddeb4=_0x9e0d[_0x12e506];return _0xbddeb4;};'use strict';var client=require(_0xd9e0('0x0'));exports[_0xd9e0('0x1')]=function(){return function(){return client[_0xd9e0('0x2')](_0xd9e0('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0xd9e0('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xd9e0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7dee9fd..fa204c1 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 _0x54b0=['dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','name','Intervals','interval','../client','getVoiceQueues','Request','acw','acwTimeout','autopause','monitor_format','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallInQueue'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x54b0,0xcf));var _0x054b=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x54b0[_0x14e27a];return _0x288688;};'use strict';var client=require(_0x054b('0x0'));exports[_0x054b('0x1')]=function(){return function(){return client[_0x054b('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name',_0x054b('0x3'),_0x054b('0x4'),_0x054b('0x5'),_0x054b('0x6'),'type','dialActive',_0x054b('0x7'),_0x054b('0x8'),_0x054b('0x9'),_0x054b('0xa'),_0x054b('0xb'),_0x054b('0xc'),'dialPredictiveInterval',_0x054b('0xd'),_0x054b('0xe'),_0x054b('0xf'),'dialQueueOptions',_0x054b('0x10'),_0x054b('0x11'),'dialCongestionMaxRetry',_0x054b('0x12'),_0x054b('0x13'),_0x054b('0x14'),_0x054b('0x15'),_0x054b('0x16'),_0x054b('0x17'),_0x054b('0x18'),_0x054b('0x19'),_0x054b('0x1a'),_0x054b('0x1b'),_0x054b('0x1c'),_0x054b('0x1d'),'dialAMDGreeting',_0x054b('0x1e'),_0x054b('0x1f'),_0x054b('0x20'),_0x054b('0x21'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x054b('0x22'),_0x054b('0x23'),'dialRecallMeTimeout',_0x054b('0x24'),_0x054b('0x25'),_0x054b('0x26'),'dialAgiAfterHangupClient','dialQueueProject2',_0x054b('0x6'),_0x054b('0x27'),_0x054b('0x28'),_0x054b('0x29'),_0x054b('0x2a'),_0x054b('0x2b'),_0x054b('0x2c'),_0x054b('0x2d'),_0x054b('0x2e'),'dialAbandonedRetryFrequency','dialMachineMaxRetry',_0x054b('0x2f'),'dialAgentRejectMaxRetry',_0x054b('0x30'),_0x054b('0x31'),_0x054b('0x32'),_0x054b('0x33'),_0x054b('0x34'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x054b('0x35'),'as':'Trunk','attributes':['id','name',_0x054b('0x36'),_0x054b('0x37')]},{'model':_0x054b('0x38'),'as':_0x054b('0x39'),'attributes':['id','name']},{'model':_0x054b('0x35'),'as':'TrunkBackup','attributes':['id',_0x054b('0x3a'),_0x054b('0x36'),'active']},{'model':'Interval','as':'Interval','attributes':['id',_0x054b('0x3a')],'include':[{'model':'Interval','as':_0x054b('0x3b'),'attributes':['id','name',_0x054b('0x3c')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x181b=['dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient'];(function(_0x150be7,_0x31fab6){var _0x3e0db1=function(_0x885e28){while(--_0x885e28){_0x150be7['push'](_0x150be7['shift']());}};_0x3e0db1(++_0x31fab6);}(_0x181b,0x18f));var _0xb181=function(_0x58454f,_0x1d05b8){_0x58454f=_0x58454f-0x0;var _0x428e78=_0x181b[_0x58454f];return _0x428e78;};'use strict';var client=require(_0xb181('0x0'));exports[_0xb181('0x1')]=function(){return function(){return client['Request'](_0xb181('0x2'),{'options':{'raw':![],'attributes':['id',_0xb181('0x3'),_0xb181('0x4'),_0xb181('0x5'),'autopause',_0xb181('0x6'),'type',_0xb181('0x7'),_0xb181('0x8'),_0xb181('0x9'),'dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0xb181('0xa'),_0xb181('0xb'),_0xb181('0xc'),_0xb181('0xd'),_0xb181('0xe'),_0xb181('0xf'),_0xb181('0x10'),_0xb181('0x11'),_0xb181('0x12'),_0xb181('0x13'),'dialBusyMaxRetry',_0xb181('0x14'),_0xb181('0x15'),_0xb181('0x16'),_0xb181('0x17'),_0xb181('0x18'),'dialGlobalInterval',_0xb181('0x19'),_0xb181('0x1a'),_0xb181('0x1b'),_0xb181('0x1c'),_0xb181('0x1d'),_0xb181('0x1e'),_0xb181('0x1f'),_0xb181('0x20'),_0xb181('0x21'),_0xb181('0x22'),_0xb181('0x23'),_0xb181('0x24'),_0xb181('0x25'),_0xb181('0x26'),_0xb181('0x27'),'dialOrderByScheduledAt',_0xb181('0x28'),_0xb181('0x29'),_0xb181('0x2a'),_0xb181('0x6'),_0xb181('0x2b'),'dialRandomLastDigitCallerIdNumber',_0xb181('0x2c'),_0xb181('0x2d'),_0xb181('0x2e'),_0xb181('0x2f'),_0xb181('0x30'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0xb181('0x31'),'dialMachineRetryFrequency',_0xb181('0x32'),'dialAgentRejectRetryFrequency',_0xb181('0x33'),_0xb181('0x34'),_0xb181('0x35'),_0xb181('0x36'),_0xb181('0x37')],'include':[{'model':_0xb181('0x38'),'as':_0xb181('0x38'),'attributes':['id',_0xb181('0x3'),_0xb181('0x39'),_0xb181('0x3a')]},{'model':_0xb181('0x3b'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0xb181('0x3c'),'attributes':['id',_0xb181('0x3'),_0xb181('0x39'),_0xb181('0x3a')]},{'model':_0xb181('0x3d'),'as':'Interval','attributes':['id',_0xb181('0x3')],'include':[{'model':_0xb181('0x3d'),'as':_0xb181('0x3e'),'attributes':['id',_0xb181('0x3'),'interval']}]}]},'log':_0xb181('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f32589e..527a9be 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(_0x3cde96,_0x30c33f){var _0xaa8ef4=function(_0x54ecbe){while(--_0x54ecbe){_0x3cde96['push'](_0x3cde96['shift']());}};_0xaa8ef4(++_0x30c33f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x496fa7,_0xcd0497){var _0x5bfedb=function(_0x46c27b){while(--_0x46c27b){_0x496fa7['push'](_0x496fa7['shift']());}};_0x5bfedb(++_0xcd0497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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 c00ce67..b7acb10 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 _0x7c79=['getVoiceQueueRtPauses','../client','Request','GetVoiceQueueRtPauses'];(function(_0x5f26cd,_0x21f262){var _0x45123f=function(_0x2bb6a1){while(--_0x2bb6a1){_0x5f26cd['push'](_0x5f26cd['shift']());}};_0x45123f(++_0x21f262);}(_0x7c79,0x7d));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x97c7('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4bb301){return function(){return client[_0x97c7('0x1')](_0x97c7('0x2'),{'options':{'where':{'VoiceQueueId':_0x4bb301,'paused':!![]},'raw':!![]},'log':_0x97c7('0x3')});};}; \ No newline at end of file +var _0x2394=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x486217,_0x4fc85f){var _0x1f5d36=function(_0x39edf0){while(--_0x39edf0){_0x486217['push'](_0x486217['shift']());}};_0x1f5d36(++_0x4fc85f);}(_0x2394,0x139));var _0x4239=function(_0x764eb6,_0x4ddc00){_0x764eb6=_0x764eb6-0x0;var _0x12e77d=_0x2394[_0x764eb6];return _0x12e77d;};'use strict';var client=require(_0x4239('0x0'));exports[_0x4239('0x1')]=function(_0x37b78d){return function(){return client[_0x4239('0x2')](_0x4239('0x3'),{'options':{'where':{'VoiceQueueId':_0x37b78d,'paused':!![]},'raw':!![]},'log':_0x4239('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 95ab859..b7e7791 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(_0x3c4c6f,_0x38255f){var _0x40403e=function(_0x3b534f){while(--_0x3b534f){_0x3c4c6f['push'](_0x3c4c6f['shift']());}};_0x40403e(++_0x38255f);}(_0x7a54,0x106));var _0x47a5=function(_0x21c358,_0x377485){_0x21c358=_0x21c358-0x0;var _0x48fb30=_0x7a54[_0x21c358];return _0x48fb30;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x2fdeff,_0x1bb36a){var _0x1841c8=function(_0x5483c4){while(--_0x5483c4){_0x2fdeff['push'](_0x2fdeff['shift']());}};_0x1841c8(++_0x1bb36a);}(_0x7a54,0x106));var _0x47a5=function(_0x42de94,_0x37923a){_0x42de94=_0x42de94-0x0;var _0x1f7be1=_0x7a54[_0x42de94];return _0x1f7be1;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index be8e1eb..180a7d1 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 _0xf7fb=['origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','secondtransferercontext','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer'];(function(_0x292887,_0x532833){var _0xc7f3d4=function(_0x50d772){while(--_0x50d772){_0x292887['push'](_0x292887['shift']());}};_0xc7f3d4(++_0x532833);}(_0xf7fb,0x146));var _0xbf7f=function(_0x1ff817,_0x1c46cb){_0x1ff817=_0x1ff817-0x0;var _0x5e131f=_0xf7fb[_0x1ff817];return _0x5e131f;};'use strict';var client=require(_0xbf7f('0x0'));exports['transfers']={};exports[_0xbf7f('0x1')]=function(_0x34d263){return client[_0xbf7f('0x2')](_0xbf7f('0x3'),{'body':{'result':_0x34d263[_0xbf7f('0x4')],'transfererchannel':_0x34d263[_0xbf7f('0x5')],'transferercalleridnum':_0x34d263[_0xbf7f('0x6')],'transferercalleridname':_0x34d263[_0xbf7f('0x7')],'transfererconnectedlinenum':_0x34d263['transfererconnectedlinenum'],'transfererconnectedlinename':_0x34d263[_0xbf7f('0x8')],'transfereraccountcode':_0x34d263[_0xbf7f('0x9')],'transferercontext':_0x34d263[_0xbf7f('0xa')],'transfererexten':_0x34d263[_0xbf7f('0xb')],'transfererlinkedid':_0x34d263[_0xbf7f('0xc')],'transfereechannel':_0x34d263[_0xbf7f('0xd')],'transfereecalleridnum':_0x34d263[_0xbf7f('0xe')],'transfereecalleridname':_0x34d263[_0xbf7f('0xf')],'transfereeconnectedlinenum':_0x34d263['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x34d263['transfereeconnectedlinename'],'transfereeaccountcode':_0x34d263[_0xbf7f('0x10')],'transfereecontext':_0x34d263[_0xbf7f('0x11')],'transfereeexten':_0x34d263['transfereeexten'],'transfereelinkedid':_0x34d263[_0xbf7f('0x12')],'isexternal':_0x34d263[_0xbf7f('0x13')],'context':_0x34d263[_0xbf7f('0x14')],'extension':_0x34d263[_0xbf7f('0x15')],'type':_0xbf7f('0x16')},'log':_0xbf7f('0x3')});};exports[_0xbf7f('0x17')]=function(_0xc6bcdf){return client[_0xbf7f('0x2')](_0xbf7f('0x3'),{'body':{'result':_0xc6bcdf[_0xbf7f('0x4')],'transfererchannel':_0xc6bcdf[_0xbf7f('0x18')],'transferercalleridnum':_0xc6bcdf[_0xbf7f('0x19')],'transferercalleridname':_0xc6bcdf['origtransferercalleridname'],'transfererconnectedlinenum':_0xc6bcdf['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xc6bcdf[_0xbf7f('0x1a')],'transfereraccountcode':_0xc6bcdf['origtransfereraccountcode'],'transferercontext':_0xc6bcdf[_0xbf7f('0x1b')],'transfererexten':_0xc6bcdf['secondtransfererexten'],'transfererlinkedid':_0xc6bcdf['origtransfererlinkedid'],'transfereechannel':_0xc6bcdf['transfertargetchannel'],'transfereecalleridnum':_0xc6bcdf[_0xbf7f('0x1c')],'transfereecalleridname':_0xc6bcdf[_0xbf7f('0x1d')],'transfereeconnectedlinenum':_0xc6bcdf[_0xbf7f('0x1e')],'transfereeconnectedlinename':_0xc6bcdf['transfertargetconnectedlinename'],'transfereeaccountcode':_0xc6bcdf[_0xbf7f('0x1f')],'transfereecontext':_0xc6bcdf['transfertargetcontext'],'transfereeexten':_0xc6bcdf[_0xbf7f('0x20')],'transfereelinkedid':_0xc6bcdf['transfertargetlinkedid'],'isexternal':_0xc6bcdf['isexternal'],'context':_0xc6bcdf[_0xbf7f('0x21')],'extension':_0xc6bcdf[_0xbf7f('0x22')],'type':'attended'},'log':_0xbf7f('0x3')});}; \ No newline at end of file +var _0xb192=['context','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','isexternal','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid'];(function(_0x282f1c,_0x5605f0){var _0x258044=function(_0x907ee6){while(--_0x907ee6){_0x282f1c['push'](_0x282f1c['shift']());}};_0x258044(++_0x5605f0);}(_0xb192,0x132));var _0x2b19=function(_0x25f005,_0x5e2d36){_0x25f005=_0x25f005-0x0;var _0x2aee98=_0xb192[_0x25f005];return _0x2aee98;};'use strict';var client=require(_0x2b19('0x0'));exports['transfers']={};exports[_0x2b19('0x1')]=function(_0x28475f){return client[_0x2b19('0x2')](_0x2b19('0x3'),{'body':{'result':_0x28475f[_0x2b19('0x4')],'transfererchannel':_0x28475f[_0x2b19('0x5')],'transferercalleridnum':_0x28475f[_0x2b19('0x6')],'transferercalleridname':_0x28475f['transferercalleridname'],'transfererconnectedlinenum':_0x28475f['transfererconnectedlinenum'],'transfererconnectedlinename':_0x28475f[_0x2b19('0x7')],'transfereraccountcode':_0x28475f['transfereraccountcode'],'transferercontext':_0x28475f[_0x2b19('0x8')],'transfererexten':_0x28475f[_0x2b19('0x9')],'transfererlinkedid':_0x28475f[_0x2b19('0xa')],'transfereechannel':_0x28475f[_0x2b19('0xb')],'transfereecalleridnum':_0x28475f['transfereecalleridnum'],'transfereecalleridname':_0x28475f['transfereecalleridname'],'transfereeconnectedlinenum':_0x28475f[_0x2b19('0xc')],'transfereeconnectedlinename':_0x28475f[_0x2b19('0xd')],'transfereeaccountcode':_0x28475f[_0x2b19('0xe')],'transfereecontext':_0x28475f[_0x2b19('0xf')],'transfereeexten':_0x28475f[_0x2b19('0x10')],'transfereelinkedid':_0x28475f[_0x2b19('0x11')],'isexternal':_0x28475f['isexternal'],'context':_0x28475f[_0x2b19('0x12')],'extension':_0x28475f['extension'],'type':'blind'},'log':_0x2b19('0x3')});};exports['attendedTransfer']=function(_0x3cab15){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x3cab15['result'],'transfererchannel':_0x3cab15[_0x2b19('0x13')],'transferercalleridnum':_0x3cab15[_0x2b19('0x14')],'transferercalleridname':_0x3cab15[_0x2b19('0x15')],'transfererconnectedlinenum':_0x3cab15[_0x2b19('0x16')],'transfererconnectedlinename':_0x3cab15[_0x2b19('0x17')],'transfereraccountcode':_0x3cab15[_0x2b19('0x18')],'transferercontext':_0x3cab15[_0x2b19('0x19')],'transfererexten':_0x3cab15[_0x2b19('0x1a')],'transfererlinkedid':_0x3cab15[_0x2b19('0x1b')],'transfereechannel':_0x3cab15['transfertargetchannel'],'transfereecalleridnum':_0x3cab15[_0x2b19('0x1c')],'transfereecalleridname':_0x3cab15[_0x2b19('0x1d')],'transfereeconnectedlinenum':_0x3cab15[_0x2b19('0x1e')],'transfereeconnectedlinename':_0x3cab15[_0x2b19('0x1f')],'transfereeaccountcode':_0x3cab15['transfertargetaccountcode'],'transfereecontext':_0x3cab15[_0x2b19('0x20')],'transfereeexten':_0x3cab15[_0x2b19('0x21')],'transfereelinkedid':_0x3cab15['transfertargetlinkedid'],'isexternal':_0x3cab15[_0x2b19('0x22')],'context':_0x3cab15['origtransferercontext'],'extension':_0x3cab15[_0x2b19('0x23')],'type':'attended'},'log':_0x2b19('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1c9cda5..7a2e894 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 _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(_0x29e433,_0x147bc0){var _0x5cc61f=function(_0x11f7b2){while(--_0x11f7b2){_0x29e433['push'](_0x29e433['shift']());}};_0x5cc61f(++_0x147bc0);}(_0x7a54,0x106));var _0x47a5=function(_0x16f469,_0x1954c7){_0x16f469=_0x16f469-0x0;var _0x4fffd6=_0x7a54[_0x16f469];return _0x4fffd6;};'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 +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(_0x3b02ab,_0x3764b3){var _0xf6770f=function(_0x2add79){while(--_0x2add79){_0x3b02ab['push'](_0x3b02ab['shift']());}};_0xf6770f(++_0x3764b3);}(_0xb10b,0x12a));var _0xbb10=function(_0x2830fc,_0x1bbb32){_0x2830fc=_0x2830fc-0x0;var _0x3cc76b=_0xb10b[_0x2830fc];return _0x3cc76b;};'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 diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index ad47b4f..6b24368 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 _0x3066=['toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','ListId','updatedAt','then','getContacts','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','format','trigger:%s','action'];(function(_0x4a2d0c,_0x36adcf){var _0x454722=function(_0x42e9d0){while(--_0x42e9d0){_0x4a2d0c['push'](_0x4a2d0c['shift']());}};_0x454722(++_0x36adcf);}(_0x3066,0x1e8));var _0x6306=function(_0x3dcd0c,_0x150086){_0x3dcd0c=_0x3dcd0c-0x0;var _0x53543c=_0x3066[_0x3dcd0c];return _0x53543c;};'use strict';var _=require(_0x6306('0x0'));var BPromise=require(_0x6306('0x1'));var Redis=require(_0x6306('0x2'));var util=require('util');var config=require(_0x6306('0x3'));var logger=require(_0x6306('0x4'))(_0x6306('0x5'));var cmContactRpc=require(_0x6306('0x6'));config[_0x6306('0x7')]=_[_0x6306('0x8')](config['redis'],{'host':_0x6306('0x9'),'port':0x18eb});var io=require(_0x6306('0xa'))(new Redis(config[_0x6306('0x7')]));function emit(_0x36986e,_0x53f59a,_0x3bbb1b,_0x3d9861,_0x78aa0d){logger[_0x6306('0xb')](_0x6306('0xc'),_0x36986e,_0x53f59a['id'],_0x3bbb1b,_0x3d9861,JSON['stringify'](_0x78aa0d));io['to'](_0x3bbb1b)[_0x6306('0xd')](_0x3d9861,_0x78aa0d);}exports[_0x6306('0xe')]=function(_0x2d75bf,_0x2b0de7,_0x15d411,_0x3f0941){var _0x39fc9c,_0x13fe16;var _0x118779={};var _0x58bfb4;var _0x2e7d8c=Number(_0x15d411[_0x6306('0xf')]);var _0x1d0728=_0x15d411[_0x6306('0x10')]?Boolean(Number(_0x15d411[_0x6306('0x10')])):![];var _0x1409e1;var _0x4343dc=![];if(!_[_0x6306('0x11')](_0x15d411['data5'])){if(_0x15d411[_0x6306('0x12')]=='1')_0x4343dc=!![];}if(!_0x4343dc){if(_0x3f0941['xmd-contactid']){_0x118779['id']=_0x3f0941[_0x6306('0x13')];}}if(!_0x118779['id']){_0x118779['ListId']=_0x2e7d8c;_0x1409e1=_0x15d411[_0x6306('0x14')]&&_0x15d411[_0x6306('0x14')]!=='0'?_0x15d411[_0x6306('0x14')][_0x6306('0x15')](','):[_0x6306('0x16')];_0x118779['$or']=_[_0x6306('0x17')](_0x1409e1,function(_0x4c52de){var _0x1aa028={};_0x1aa028[_0x4c52de]=_0x3f0941[_0x6306('0x18')]?_0x3f0941[_0x6306('0x19')]:_0x3f0941[_0x6306('0x1a')];return _0x1aa028;});_0x58bfb4=_0x3f0941['routeId']?_0x3f0941[_0x6306('0x19')]:_0x3f0941[_0x6306('0x1a')];}var _0x3a14a7=['id',_0x6306('0x1b'),_0x6306('0x1c'),'phone',_0x6306('0x1d'),'fax',_0x6306('0x1e'),'createdAt','scheduledAt',_0x6306('0x1f')];var _0x4303c6=_['union'](_0x3a14a7,_0x1409e1);BPromise['resolve']()[_0x6306('0x20')](cmContactRpc[_0x6306('0x21')]({'attributes':_0x4303c6,'where':_0x118779,'phone':_0x58bfb4}))[_0x6306('0x20')](function(_0x521104){_0x13fe16=_0x521104;if(!_[_0x6306('0x22')](_0x13fe16)){if(_0x13fe16['length']===0x1){_0x39fc9c=_0x13fe16[0x0];logger[_0x6306('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x3f0941[_0x6306('0x23')],_0x2b0de7['id'],_0x39fc9c['id']);}else{logger['info'](_0x6306('0x24'),_0x3f0941['uniqueid'],_0x2b0de7['id'],_[_0x6306('0x17')](_0x13fe16,'id')['join'](','));}return;}else{logger[_0x6306('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x3f0941[_0x6306('0x23')],_0x2b0de7['id']);var _0x2e0448={'ListId':_0x2e7d8c};var _0x220b6c=_0x15d411[_0x6306('0x25')]&&_0x15d411[_0x6306('0x25')]!=='0'?_0x15d411[_0x6306('0x25')]:_0x6306('0x16');if(_0x1d0728){logger[_0x6306('0xb')](_0x6306('0x26'),_0x3f0941['uniqueid'],_0x2b0de7['id']);_0x2e0448[_0x220b6c]=_[_0x6306('0x11')](_0x3f0941['routeId'])?_0x3f0941[_0x6306('0x1a')]:_0x3f0941[_0x6306('0x19')];if(_['isNil'](_0x3f0941[_0x6306('0x18')])){_0x2e0448[_0x6306('0x1b')]=_0x3f0941[_0x6306('0x27')]&&_0x3f0941[_0x6306('0x27')]!==_0x6306('0x28')?_0x3f0941[_0x6306('0x27')]:_0x6306('0x29');}else{_0x2e0448[_0x6306('0x1b')]=_0x3f0941[_0x6306('0x2a')]&&_0x3f0941['destcalleridname']!==_0x6306('0x28')?_0x3f0941[_0x6306('0x2a')]:_0x6306('0x29');}return BPromise[_0x6306('0x2b')]()[_0x6306('0x20')](cmContactRpc['createContact'](_0x2e0448))[_0x6306('0x20')](function(_0x1b2058){_0x39fc9c=_0x1b2058;_0x13fe16[_0x6306('0x2c')](_0x1b2058);if(_0x39fc9c){logger[_0x6306('0xb')](_0x6306('0x2d'),_0x3f0941['uniqueid'],_0x2b0de7['id'],_0x39fc9c['id']);}return;});}else{logger[_0x6306('0xb')](_0x6306('0x2e'),_0x3f0941[_0x6306('0x23')],_0x2b0de7['id']);_0x2e0448[_0x220b6c]=_['isNil'](_0x3f0941[_0x6306('0x18')])?_0x3f0941[_0x6306('0x1a')]:_0x3f0941[_0x6306('0x19')];if(_['isNil'](_0x3f0941[_0x6306('0x18')])){_0x2e0448[_0x6306('0x1b')]=_0x3f0941[_0x6306('0x27')]&&_0x3f0941[_0x6306('0x27')]!==''?_0x3f0941['calleridname']:'Unknown';}else{_0x2e0448[_0x6306('0x1b')]=_0x3f0941[_0x6306('0x2a')]&&_0x3f0941[_0x6306('0x2a')]!==_0x6306('0x28')?_0x3f0941['destcalleridname']:_0x6306('0x29');}_0x39fc9c=_0x2e0448;_0x13fe16[_0x6306('0x2c')](_0x2e0448);return;}}})[_0x6306('0x20')](function(){if(_0x2d75bf){emit(_0x3f0941['uniqueid'],_0x2b0de7,util['format'](_0x6306('0x2f'),_0x2d75bf[_0x6306('0x30')]),util[_0x6306('0x31')](_0x6306('0x32'),_0x15d411[_0x6306('0x33')][_0x6306('0x34')]()),{'evt':_[_0x6306('0x35')](_0x3f0941,{'autoCreate':_0x1d0728}),'contact':_0x39fc9c===undefined?{}:_0x39fc9c,'contacts':_0x13fe16['length']===0x0?undefined:_0x13fe16});}});}; \ No newline at end of file +var _0x671e=['ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','scheduledAt','updatedAt','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','isNil','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x671e,0xd6));var _0xe671=function(_0x22a35b,_0x55764a){_0x22a35b=_0x22a35b-0x0;var _0xa4e884=_0x671e[_0x22a35b];return _0xa4e884;};'use strict';var _=require(_0xe671('0x0'));var BPromise=require(_0xe671('0x1'));var Redis=require(_0xe671('0x2'));var util=require('util');var config=require(_0xe671('0x3'));var logger=require(_0xe671('0x4'))('trigger');var cmContactRpc=require(_0xe671('0x5'));config[_0xe671('0x6')]=_[_0xe671('0x7')](config['redis'],{'host':_0xe671('0x8'),'port':0x18eb});var io=require(_0xe671('0x9'))(new Redis(config['redis']));function emit(_0x27b847,_0x7ec84b,_0xda7edc,_0x4033d9,_0x48f194){logger[_0xe671('0xa')](_0xe671('0xb'),_0x27b847,_0x7ec84b['id'],_0xda7edc,_0x4033d9,JSON[_0xe671('0xc')](_0x48f194));io['to'](_0xda7edc)[_0xe671('0xd')](_0x4033d9,_0x48f194);}exports['exec']=function(_0x5831af,_0xdceecd,_0x1b34e8,_0x1ea1c3){var _0x5682ac,_0x1893d0;var _0x467e6f={};var _0x1878be;var _0x39c4b9=Number(_0x1b34e8['data1']);var _0x3a051e=_0x1b34e8['data2']?Boolean(Number(_0x1b34e8[_0xe671('0xe')])):![];var _0x52757d;var _0x4f62c1=![];if(!_['isNil'](_0x1b34e8['data5'])){if(_0x1b34e8[_0xe671('0xf')]=='1')_0x4f62c1=!![];}if(!_0x4f62c1){if(_0x1ea1c3[_0xe671('0x10')]){_0x467e6f['id']=_0x1ea1c3[_0xe671('0x10')];}}if(!_0x467e6f['id']){_0x467e6f[_0xe671('0x11')]=_0x39c4b9;_0x52757d=_0x1b34e8['data3']&&_0x1b34e8[_0xe671('0x12')]!=='0'?_0x1b34e8[_0xe671('0x12')][_0xe671('0x13')](','):[_0xe671('0x14')];_0x467e6f[_0xe671('0x15')]=_['map'](_0x52757d,function(_0x135e68){var _0x186bba={};_0x186bba[_0x135e68]=_0x1ea1c3[_0xe671('0x16')]?_0x1ea1c3[_0xe671('0x17')]:_0x1ea1c3[_0xe671('0x18')];return _0x186bba;});_0x1878be=_0x1ea1c3[_0xe671('0x16')]?_0x1ea1c3[_0xe671('0x17')]:_0x1ea1c3[_0xe671('0x18')];}var _0x4a24bf=['id',_0xe671('0x19'),_0xe671('0x1a'),_0xe671('0x14'),_0xe671('0x1b'),'fax',_0xe671('0x11'),'createdAt',_0xe671('0x1c'),_0xe671('0x1d')];var _0x59c49c=_['union'](_0x4a24bf,_0x52757d);BPromise[_0xe671('0x1e')]()[_0xe671('0x1f')](cmContactRpc['getContacts']({'attributes':_0x59c49c,'where':_0x467e6f,'phone':_0x1878be}))['then'](function(_0x3c796b){_0x1893d0=_0x3c796b;if(!_['isEmpty'](_0x1893d0)){if(_0x1893d0[_0xe671('0x20')]===0x1){_0x5682ac=_0x1893d0[0x0];logger['info'](_0xe671('0x21'),_0x1ea1c3[_0xe671('0x22')],_0xdceecd['id'],_0x5682ac['id']);}else{logger['info'](_0xe671('0x23'),_0x1ea1c3[_0xe671('0x22')],_0xdceecd['id'],_[_0xe671('0x24')](_0x1893d0,'id')[_0xe671('0x25')](','));}return;}else{logger[_0xe671('0xa')](_0xe671('0x26'),_0x1ea1c3[_0xe671('0x22')],_0xdceecd['id']);var _0x529266={'ListId':_0x39c4b9};var _0xb4d0ef=_0x1b34e8[_0xe671('0x27')]&&_0x1b34e8[_0xe671('0x27')]!=='0'?_0x1b34e8['data4']:_0xe671('0x14');if(_0x3a051e){logger[_0xe671('0xa')](_0xe671('0x28'),_0x1ea1c3[_0xe671('0x22')],_0xdceecd['id']);_0x529266[_0xb4d0ef]=_['isNil'](_0x1ea1c3[_0xe671('0x16')])?_0x1ea1c3[_0xe671('0x18')]:_0x1ea1c3[_0xe671('0x17')];if(_['isNil'](_0x1ea1c3[_0xe671('0x16')])){_0x529266[_0xe671('0x19')]=_0x1ea1c3['calleridname']&&_0x1ea1c3[_0xe671('0x29')]!==_0xe671('0x2a')?_0x1ea1c3[_0xe671('0x29')]:_0xe671('0x2b');}else{_0x529266[_0xe671('0x19')]=_0x1ea1c3[_0xe671('0x2c')]&&_0x1ea1c3[_0xe671('0x2c')]!==''?_0x1ea1c3[_0xe671('0x2c')]:'Unknown';}return BPromise[_0xe671('0x1e')]()[_0xe671('0x1f')](cmContactRpc[_0xe671('0x2d')](_0x529266))['then'](function(_0x2db5cc){_0x5682ac=_0x2db5cc;_0x1893d0[_0xe671('0x2e')](_0x2db5cc);if(_0x5682ac){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x1ea1c3['uniqueid'],_0xdceecd['id'],_0x5682ac['id']);}return;});}else{logger[_0xe671('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x1ea1c3[_0xe671('0x22')],_0xdceecd['id']);_0x529266[_0xb4d0ef]=_[_0xe671('0x2f')](_0x1ea1c3['routeId'])?_0x1ea1c3['calleridnum']:_0x1ea1c3[_0xe671('0x17')];if(_[_0xe671('0x2f')](_0x1ea1c3[_0xe671('0x16')])){_0x529266[_0xe671('0x19')]=_0x1ea1c3['calleridname']&&_0x1ea1c3[_0xe671('0x29')]!==_0xe671('0x2a')?_0x1ea1c3[_0xe671('0x29')]:_0xe671('0x2b');}else{_0x529266['firstName']=_0x1ea1c3['destcalleridname']&&_0x1ea1c3[_0xe671('0x2c')]!==_0xe671('0x2a')?_0x1ea1c3[_0xe671('0x2c')]:_0xe671('0x2b');}_0x5682ac=_0x529266;_0x1893d0[_0xe671('0x2e')](_0x529266);return;}}})[_0xe671('0x1f')](function(){if(_0x5831af){emit(_0x1ea1c3[_0xe671('0x22')],_0xdceecd,util[_0xe671('0x30')](_0xe671('0x31'),_0x5831af[_0xe671('0x32')]),util['format'](_0xe671('0x33'),_0x1b34e8[_0xe671('0x34')][_0xe671('0x35')]()),{'evt':_['merge'](_0x1ea1c3,{'autoCreate':_0x3a051e}),'contact':_0x5682ac===undefined?{}:_0x5682ac,'contacts':_0x1893d0[_0xe671('0x20')]===0x0?undefined:_0x1893d0});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 43d3335..7435773 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 _0x038f=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','motionChannel','voice','debug','checkTriggers','interface','hasOwnProperty','variables','length','action','toLowerCase','motionbar','data1','TemplateId','data2','html','render','uri','isNil','data3','data4','location','windowWidth','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','contactmanager','exec','accounts','queue','routeId','urlforward','parse','query','search','replace','checkTrigger','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','inspect','evt','field','account','chat','operator','ChatWebsiteId','upperFirst','AccountId','value','interaction','channel','event','agent','membername','lastevent','mailSubstatus','null','undefined','substatus','equals','exports','lodash','url','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x038f,0xe1));var _0xf038=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x038f[_0xd0b415];return _0x2bdf2c;};'use strict';var util=require('util');var _=require(_0xf038('0x0'));var url=require(_0xf038('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0xf038('0x2'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xf038('0x3'));var config=require(_0xf038('0x4'));var logger=require(_0xf038('0x5'))(_0xf038('0x6'));var ami=require(_0xf038('0x7'));config[_0xf038('0x8')]=_[_0xf038('0x9')](config[_0xf038('0x8')],{'host':_0xf038('0xa'),'port':0x18eb});var io=require(_0xf038('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x10fc9b,_0x50110e){return _0x10fc9b==_0x50110e;},'not_equals':function(_0x10c858,_0x584b25){return _0x10c858!=_0x584b25;}};var barAndWebActions=[_0xf038('0xc'),'url','winapp'];function Trigger(_0x42655b){this[_0xf038('0xd')]=_0x42655b['triggers'];this[_0xf038('0xe')]=_0x42655b[_0xf038('0xe')];this[_0xf038('0xf')]=_0x42655b[_0xf038('0xf')];this[_0xf038('0x10')]=_0x42655b[_0xf038('0x10')];this[_0xf038('0x11')]=_0x42655b[_0xf038('0x11')];this[_0xf038('0x12')]=_0x42655b['zendeskAccounts'];this['freshdeskAccounts']=_0x42655b[_0xf038('0x13')];this[_0xf038('0x14')]=_0x42655b[_0xf038('0x14')];this[_0xf038('0x15')]=_0x42655b[_0xf038('0x15')];this[_0xf038('0x16')]=_0x42655b[_0xf038('0x16')];this[_0xf038('0x17')]=_0x42655b[_0xf038('0x17')];this[_0xf038('0x18')]=_0x42655b[_0xf038('0x18')];this[_0xf038('0x19')]=_0x42655b[_0xf038('0x19')];this['dynamics365Accounts']=_0x42655b[_0xf038('0x1a')];this['freshsalesAccounts']=_0x42655b[_0xf038('0x1b')];this['accounts']={'zendesk':this[_0xf038('0x12')],'salesforce':this[_0xf038('0x14')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xf038('0x15')],'zoho':this[_0xf038('0x16')],'desk':this['deskAccounts'],'vtiger':this[_0xf038('0x18')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xf038('0x1b')],'servicenow':this[_0xf038('0x19')]};ami['on'](_0xf038('0x1c'),this[_0xf038('0x1d')]['bind'](this));ami['on'](_0xf038('0x1e'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x20'),this['syncCustomEvent'][_0xf038('0x1f')](this));ami['on'](_0xf038('0x21'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x22'),this[_0xf038('0x1d')]['bind'](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent']['bind'](this));ami['on'](_0xf038('0x23'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on']('custom:agentcongestion',this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on']('custom:agentreject',this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x24'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x25'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x26'),this[_0xf038('0x1d')]['bind'](this));ami['on'](_0xf038('0x27'),this['syncAgentDial'][_0xf038('0x1f')](this));ami['on'](_0xf038('0x28'),this[_0xf038('0x29')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x2a'),this[_0xf038('0x29')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x2b'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x2c'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x2d'),this[_0xf038('0x1d')]['bind'](this));ami['on'](_0xf038('0x2e'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x2f'),this['syncCustomEvent'][_0xf038('0x1f')](this));ami['on'](_0xf038('0x30'),this[_0xf038('0x1d')]['bind'](this));ami['on']('custom:rejectmessage',this[_0xf038('0x1d')][_0xf038('0x1f')](this));ami['on'](_0xf038('0x31'),this[_0xf038('0x1d')][_0xf038('0x1f')](this));}Trigger[_0xf038('0x32')][_0xf038('0x33')]=function(_0x35ffcd,_0x2fd95f,_0x2f2b00){logger['info'](_0x35ffcd,_0x2fd95f,JSON['stringify'](_0x2f2b00));io['to'](_0x35ffcd)[_0xf038('0x33')](_0x2fd95f,_0x2f2b00);};Trigger[_0xf038('0x32')][_0xf038('0x1d')]=function(_0x4283e7){var _0x38f501=_['clone'](_0x4283e7);if(typeof _0x38f501['motionChannel']==='undefined'){_0x38f501[_0xf038('0x34')]=_0xf038('0x35');}logger[_0xf038('0x36')](_0xf038('0x1d'),util['inspect'](_0x38f501,{'showHidden':!![],'depth':null}));this[_0xf038('0x37')](_0x38f501);};Trigger[_0xf038('0x32')][_0xf038('0x29')]=function(_0x28a98b){if(this[_0xf038('0xe')][_0x28a98b[_0xf038('0x38')]]){this['syncCustomEvent'](_0x28a98b);}};Trigger[_0xf038('0x32')][_0xf038('0x37')]=function(_0x517bd6){var _0x6077db;for(var _0x4212fc in this['triggers']){if(this['triggers'][_0xf038('0x39')](_0x4212fc)){if(this[_0xf038('0xd')][_0x4212fc]['status']){_0x6077db=this['checkTrigger'](this['triggers'][_0x4212fc],_0x517bd6);if(_0x6077db){_['merge'](_0x517bd6,_0x517bd6[_0xf038('0x3a')]);for(var _0x3926c3=0x0,_0x411568,_0x35f9a0,_0x5a8608;_0x3926c30x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x5fc3[_0x3ceb54];return _0x26d8a6;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ 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 e01f3af..c9e2cd4 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 _0x8d97=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','resolve','data5','POST','username','password','clientSecret','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','userId','length','systemuserid','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','body','headers','odata-entityid','lastIndexOf','enduserId','message','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','idField','indexOf','substring','content','incident','incidents','assign','getString','Subjects','/contacts(','ticketType','phonecall','queue','callDirection','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s'];(function(_0x5ecb71,_0x5335fa){var _0x13f242=function(_0x44b42a){while(--_0x44b42a){_0x5ecb71['push'](_0x5ecb71['shift']());}};_0x13f242(++_0x5335fa);}(_0x8d97,0x1c4));var _0x78d9=function(_0x4f7009,_0x2bf8f4){_0x4f7009=_0x4f7009-0x0;var _0x5445c1=_0x8d97[_0x4f7009];return _0x5445c1;};'use strict';var _=require(_0x78d9('0x0'));var rp=require('request-promise');var util=require(_0x78d9('0x1'));var intUtil=require(_0x78d9('0x2'));var md5=require(_0x78d9('0x3'));var Redis=require(_0x78d9('0x4'));var logger=require(_0x78d9('0x5'))(_0x78d9('0x6'));var config=require(_0x78d9('0x7'));config['redis']=_[_0x78d9('0x8')](config[_0x78d9('0x9')],{'host':_0x78d9('0xa'),'port':0x18eb});var io=require(_0x78d9('0xb'))(new Redis(config['redis']));function getAuthToken(_0x28467c,_0x5491a8,_0x2bc717){if(_0x28467c[_0x78d9('0xc')]){_0x28467c[_0x78d9('0xd')]=_0x28467c[_0x78d9('0xe')]['data7'];_0x28467c[_0x78d9('0xf')]=_0x28467c[_0x78d9('0xe')][_0x78d9('0x10')];return Promise[_0x78d9('0x11')](_0x28467c['CloudProvider'][_0x78d9('0x12')]);}var _0x59f492={'method':_0x78d9('0x13'),'uri':_0x5491a8,'form':{'client_id':_0x28467c['clientId'],'resource':_0x28467c[_0x78d9('0xd')],'username':_0x28467c[_0x78d9('0x14')],'password':_0x28467c[_0x78d9('0x15')],'grant_type':_0x78d9('0x15'),'client_secret':_0x28467c[_0x78d9('0x16')]},'json':!![]};return rp(_0x59f492)['then'](function(_0x4b2a95){return _0x4b2a95['access_token'];})[_0x78d9('0x17')](function(_0x5a4130){logger[_0x78d9('0x18')]('['+[_0x2bc717[_0x78d9('0x19')]()]+_0x78d9('0x1a'));return _0x5a4130['message'];});}function getUser(_0x131932,_0x371c53,_0x5a2ff1,_0x4db89b,_0x1b2198,_0x19f599){return new Promise(function(_0x466ed3,_0x359a60){return getAuthToken(_0x371c53,_0x4db89b,_0x19f599)[_0x78d9('0x1b')](function(_0x2570a8){var _0x25fd34={'method':_0x78d9('0x1c'),'uri':_0x1b2198+_0x78d9('0x1d'),'headers':{'Authorization':'Bearer\x20'+_0x2570a8,'OData-Version':'4.0'},'json':!![]};return rp(_0x25fd34);})['then'](function(_0x346636){var _0xb865f3=_0x346636[_0x78d9('0x1e')];var _0x218b45=![];var _0x33e0cf=null;if(!_[_0x78d9('0x1f')](_0x5a2ff1)){if(intUtil['validateEmail'](_0x5a2ff1[_0x78d9('0x20')])){_0x131932[_0x78d9('0x21')]=_0x5a2ff1[_0x78d9('0x20')];for(_0x33e0cf=0x0;_0x33e0cf<_0xb865f3['length'];_0x33e0cf++){if(_0xb865f3[_0x33e0cf][_0x78d9('0x22')]===_0x5a2ff1[_0x78d9('0x20')]&&!_0xb865f3[_0x33e0cf][_0x78d9('0x23')]){_0x218b45=!![];logger[_0x78d9('0x24')]('['+[_0x19f599['toUpperCase']()]+_0x78d9('0x25')+_0xb865f3[_0x33e0cf]['systemuserid']+'!');_0x131932[_0x78d9('0x26')]=_0xb865f3[_0x33e0cf]['systemuserid'];}}}}if(!_0x218b45){logger['info']('['+[_0x19f599[_0x78d9('0x19')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x131932[_0x78d9('0x21')]=_0x371c53[_0x78d9('0x14')];for(_0x33e0cf=0x0;_0x33e0cf<_0xb865f3[_0x78d9('0x27')];_0x33e0cf++){if(_0xb865f3[_0x33e0cf]['internalemailaddress']===_0x371c53[_0x78d9('0x14')]){_0x131932[_0x78d9('0x26')]=_0xb865f3[_0x33e0cf][_0x78d9('0x28')];}}}_0x466ed3(_0x131932);})['catch'](function(_0x31afd6){_0x359a60(_0x31afd6['message']);});});}function createEndUser(_0x1b5af9,_0x150ef5,_0x5c288b,_0x50a11d,_0x49c986,_0x45d8d1,_0x20efed){return new Promise(function(_0x1e9fd9,_0x271a10){return getAuthToken(_0x150ef5,_0x5c288b,_0x45d8d1)[_0x78d9('0x1b')](function(_0xf335){var _0x27f450=_0x45d8d1[_0x78d9('0x29')]()===_0x78d9('0x2a')?_0x49c986[_0x78d9('0x2b')]:_0x49c986[_0x78d9('0x2c')];var _0x2804db={'method':_0x78d9('0x13'),'uri':_0x50a11d+_0x78d9('0x2d'),'body':{'fullname':_0x27f450,'firstname':_0x27f450,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x78d9('0x2e')+_0x1b5af9[_0x78d9('0x26')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xf335,'OData-Version':_0x78d9('0x2f')},'json':!![],'resolveWithFullResponse':!![]};_0x2804db[_0x78d9('0x30')][_0x20efed]=_0x27f450;return rp(_0x2804db);})['then'](function(_0x5c01f5){var _0x3e0cc9=_0x5c01f5[_0x78d9('0x31')][_0x78d9('0x32')];var _0x49dce9=_0x3e0cc9['substring'](_0x3e0cc9[_0x78d9('0x33')]('(')+0x1,_0x3e0cc9[_0x78d9('0x33')](')'));_0x1b5af9[_0x78d9('0x34')]=_0x49dce9;_0x1e9fd9(_0x1b5af9);})['catch'](function(_0x319bc4){_0x271a10(_0x319bc4[_0x78d9('0x35')]);});});}function getEndUser(_0x564698,_0xc65a30,_0x1cb234,_0x7a8f54,_0x5699d1,_0x98cb6,_0x5bf71d,_0x39742c){var _0x3ba233=_0x98cb6['toLowerCase']()==='outbound'?_0x5699d1[_0x78d9('0x2b')]:_0x5699d1[_0x78d9('0x2c')];return getAuthToken(_0xc65a30,_0x1cb234,_0x98cb6)[_0x78d9('0x1b')](function(_0x179a72){_0x39742c=_0x39742c?_0x39742c:_0x78d9('0x36');var _0x1ba959={'method':_0x78d9('0x1c'),'uri':_0x7a8f54+_0x78d9('0x37')+_0x39742c+_0x78d9('0x38')+_0x39742c+_0x78d9('0x39')+_0x3ba233[_0x78d9('0x3a')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x179a72,'If-None-Match':null,'OData-Version':_0x78d9('0x2f')},'json':!![]};return rp(_0x1ba959);})[_0x78d9('0x1b')](function(_0x3188bd){var _0x2196b1=![];if(!_0x3188bd)return _0x2196b1;var _0x34959a=_0x3188bd['value'];for(var _0x4ec689=0x0;_0x4ec689<_0x34959a[_0x78d9('0x27')];_0x4ec689++){if(_0x34959a[_0x4ec689][_0x39742c]===_0x3ba233){_0x2196b1=!![];_0x564698[_0x78d9('0x34')]=_0x34959a[_0x4ec689][_0x78d9('0x3b')];}}return _0x2196b1;})[_0x78d9('0x1b')](function(_0x299532){if(_0x299532)return _0x564698;if(_0x5bf71d===_0x78d9('0x3c')){logger[_0x78d9('0x24')]('['+[_0x98cb6[_0x78d9('0x19')]()]+_0x78d9('0x3d'));return _0x564698;}return createEndUser(_0x564698,_0xc65a30,_0x1cb234,_0x7a8f54,_0x5699d1,_0x98cb6,_0x39742c)[_0x78d9('0x1b')](function(_0x3201eb){logger[_0x78d9('0x24')]('['+[_0x98cb6['toUpperCase']()]+_0x78d9('0x3e'),_0x3201eb['enduserId']);return _0x3201eb;});});}function getCustomFields(_0x5a619c,_0x280741,_0xcbb9b6){var _0x65b56d={};if(_0x5a619c[_0x78d9('0x27')]>0x0){_[_0x78d9('0x3f')](_0x5a619c,function(_0x3e10dd){if(_[_0x78d9('0x40')]([_0x78d9('0x41'),_0x78d9('0x42')],_0x3e10dd['type'])&&_0x3e10dd[_0x78d9('0x43')]&&!_0x3e10dd['customField']){var _0x368e4e=_0x3e10dd[_0x78d9('0x44')][_0x78d9('0x29')]();var _0x397a36=_0x368e4e['substring'](0x0,_0x368e4e[_0x78d9('0x45')]('_'));var _0x3087f7=_0x368e4e[_0x78d9('0x46')](_0x368e4e[_0x78d9('0x45')]('_')+0x1);if(_0x397a36===_0xcbb9b6){_0x65b56d[_0x3087f7]=_0x3e10dd[_0x78d9('0x47')];}}});}return _0x65b56d;}function getTicket(_0x211c74,_0x4f7e55,_0x2e40c2,_0x300f74,_0x33c53d,_0x27596d,_0x41da92){return new Promise(function(_0x496874,_0x12f1b5){var _0x553962;return getAuthToken(_0x4f7e55,_0x2e40c2,_0x41da92)[_0x78d9('0x1b')](function(_0x15d4a2){if(_0x27596d['ticketType']===_0x78d9('0x48')){_0x553962={'method':'POST','uri':_0x300f74+_0x78d9('0x49'),'body':Object[_0x78d9('0x4a')]({},{'title':intUtil[_0x78d9('0x4b')](_0x27596d[_0x78d9('0x4c')],_0x33c53d,'\x20'),'description':intUtil['getString'](_0x27596d['Descriptions'],_0x33c53d,'\x0a'),'customerid_contact@odata.bind':_0x211c74['enduserId']?_0x78d9('0x4d')+_0x211c74[_0x78d9('0x34')]+')':undefined,'ownerid@odata.bind':_0x78d9('0x2e')+_0x211c74[_0x78d9('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x27596d['Fields'],_0x33c53d,_0x27596d[_0x78d9('0x4e')])),'headers':{'Authorization':'Bearer\x20'+_0x15d4a2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x27596d[_0x78d9('0x4e')]===_0x78d9('0x4f')){var _0x992c4=_0x211c74[_0x78d9('0x34')]?[{'partyid_systemuser@odata.bind':_0x78d9('0x2e')+_0x211c74['userId']+')','participationtypemask':_0x211c74['callDirection']===_0x78d9('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0x78d9('0x4d')+_0x211c74[_0x78d9('0x34')]+')','participationtypemask':_0x211c74[_0x78d9('0x51')]===_0x78d9('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x78d9('0x2e')+_0x211c74[_0x78d9('0x26')]+')','participationtypemask':_0x211c74[_0x78d9('0x51')]===_0x78d9('0x50')?0x2:0x1}];_0x553962={'method':'POST','uri':_0x300f74+'phonecalls','body':Object[_0x78d9('0x4a')]({},{'subject':intUtil[_0x78d9('0x4b')](_0x27596d[_0x78d9('0x4c')],_0x33c53d,'\x20'),'phonenumber':String(_0x33c53d[_0x78d9('0x2c')]),'description':intUtil[_0x78d9('0x4b')](_0x27596d['Descriptions'],_0x33c53d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x211c74[_0x78d9('0x34')]?_0x78d9('0x4d')+_0x211c74[_0x78d9('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x211c74['userId']+')','directioncode':_0x211c74[_0x78d9('0x51')]===_0x78d9('0x50')?![]:!![],'phonecall_activity_parties':_0x992c4},getCustomFields(_0x27596d[_0x78d9('0x52')],_0x33c53d,_0x27596d[_0x78d9('0x4e')])),'headers':{'Authorization':'Bearer\x20'+_0x15d4a2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x553962);})[_0x78d9('0x1b')](function(_0x514ceb){var _0x348f2e=_0x514ceb[_0x78d9('0x31')]['odata-entityid'];var _0x510655=_0x348f2e[_0x78d9('0x46')](_0x348f2e[_0x78d9('0x33')]('(')+0x1,_0x348f2e[_0x78d9('0x33')](')'));_0x211c74[_0x78d9('0x53')]=_0x510655;_0x496874(_0x211c74);})[_0x78d9('0x17')](function(_0x2306fa){_0x12f1b5(_0x2306fa['message']);});});}function emit(_0x5f0b1e,_0x4a4c58,_0x5326d3,_0xc25dc4){var _0x547dee={'uri':util[_0x78d9('0x54')](_0x78d9('0x55'),_0x5f0b1e,_0x5326d3,_0xc25dc4)};io['to'](util[_0x78d9('0x54')]('user:%s',_0x4a4c58))[_0x78d9('0x56')](_0x78d9('0x57'),_0x547dee);}exports['cs']=function(_0x4acadc,_0x497677,_0x59d59,_0x491565,_0x1af707,_0x34672a,_0x2b4fef,_0x1b7eeb){var _0x4af93b={};_0x34672a['remoteUri']=_0x34672a[_0x78d9('0xc')]?intUtil[_0x78d9('0x58')](_0x34672a[_0x78d9('0xe')]['data7']):intUtil[_0x78d9('0x58')](_0x34672a[_0x78d9('0xd')]);_0x34672a[_0x78d9('0x59')]=intUtil[_0x78d9('0x58')](_0x34672a['serverUrl']);_0x4af93b[_0x78d9('0x51')]=_0x1b7eeb===_0x78d9('0x50')||_0x1b7eeb===_0x78d9('0x5a')?_0x78d9('0x50'):_0x78d9('0x2a');var _0x35bc94=_0x34672a['modernAuthentication']?util[_0x78d9('0x54')](_0x78d9('0x5b'),_0x34672a[_0x78d9('0xe')][_0x78d9('0x5c')]):util[_0x78d9('0x54')](_0x78d9('0x5b'),_0x34672a[_0x78d9('0xd')]);var _0x3cbe0c=util['format'](_0x78d9('0x5d'),_0x34672a[_0x78d9('0xf')]);var _0x1855b6=util[_0x78d9('0x54')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34672a[_0x78d9('0x59')],_0x497677['uniqueid'],md5(_0x497677[_0x78d9('0x5e')]));if(_0x1af707&&_0x1af707[_0x78d9('0x5f')]){logger['info'](_0x78d9('0x60'),_0x78d9('0x61'));_0x497677[_0x78d9('0x62')]=_0x1855b6;}else if(_0x2b4fef&&_0x2b4fef[_0x78d9('0x63')]&&_0x2b4fef[_0x78d9('0x63')]!==_0x78d9('0x64')){logger['info'](_0x78d9('0x65'),_0x78d9('0x61'));_0x497677[_0x78d9('0x62')]=_0x1855b6;}else{_0x497677[_0x78d9('0x62')]='';}return getUser(_0x4af93b,_0x34672a,_0x491565,_0x3cbe0c,_0x35bc94,_0x1b7eeb)[_0x78d9('0x1b')](function(_0x4ea8b9){logger[_0x78d9('0x24')]('['+_0x1b7eeb[_0x78d9('0x19')]()+_0x78d9('0x66'),_0x4ea8b9[_0x78d9('0x26')]);logger[_0x78d9('0x24')]('['+_0x1b7eeb['toUpperCase']()+_0x78d9('0x67'),_0x4ea8b9[_0x78d9('0x21')]);return getEndUser(_0x4ea8b9,_0x34672a,_0x3cbe0c,_0x35bc94,_0x497677,_0x1b7eeb,_0x59d59[_0x78d9('0x68')],_0x59d59[_0x78d9('0x69')]);})[_0x78d9('0x1b')](function(_0x410b7f){logger[_0x78d9('0x24')]('['+_0x1b7eeb[_0x78d9('0x19')]()+_0x78d9('0x6a'),_0x410b7f['enduserId']);logger['info']('['+_0x1b7eeb[_0x78d9('0x19')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x497677[_0x78d9('0x2c')]);return getTicket(_0x410b7f,_0x34672a,_0x3cbe0c,_0x35bc94,_0x497677,_0x59d59,_0x1b7eeb);})[_0x78d9('0x1b')](function(_0x4b4a00){logger[_0x78d9('0x24')](util[_0x78d9('0x54')]('['+_0x1b7eeb[_0x78d9('0x19')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x59d59[_0x78d9('0x4e')],_0x4b4a00['ticketId']));logger[_0x78d9('0x24')](util['format']('['+_0x1b7eeb['toUpperCase']()+_0x78d9('0x6b'),_0x1b7eeb));if(_0x1b7eeb!==_0x78d9('0x5a')&&_0x59d59['openNewTab']){logger[_0x78d9('0x24')]('['+_0x1b7eeb['toUpperCase']()+']',_0x78d9('0x6c'));emit(_0x34672a[_0x78d9('0xd')],_0x491565[_0x78d9('0x6d')],_0x59d59[_0x78d9('0x4e')],_0x4b4a00[_0x78d9('0x53')]);}})[_0x78d9('0x17')](function(_0x5af53d){logger[_0x78d9('0x18')]('['+_0x1b7eeb['toUpperCase']()+_0x78d9('0x6e'),_0x5af53d['message']);console[_0x78d9('0x18')](_0x78d9('0x6f'),_0x5af53d);});}; \ No newline at end of file +var _0xc347=['/systemusers(','Bearer\x20','4.0','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','nameField','customField','idField','substring','indexOf','content','assign','Subjects','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/environment','defaults','localhost','redis','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','value','isNil','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','message','toLowerCase','outbound','calleridnum'];(function(_0x4e8acf,_0x1256e1){var _0x394bab=function(_0x4c838d){while(--_0x4c838d){_0x4e8acf['push'](_0x4e8acf['shift']());}};_0x394bab(++_0x1256e1);}(_0xc347,0x11b));var _0x7c34=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xc347[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x7c34('0x0'));var rp=require(_0x7c34('0x1'));var util=require(_0x7c34('0x2'));var intUtil=require(_0x7c34('0x3'));var md5=require(_0x7c34('0x4'));var Redis=require(_0x7c34('0x5'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x7c34('0x6'));config['redis']=_[_0x7c34('0x7')](config['redis'],{'host':_0x7c34('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7c34('0x9')]));function getAuthToken(_0x48bc6c,_0x5e861c,_0x1801de){if(_0x48bc6c[_0x7c34('0xa')]){_0x48bc6c[_0x7c34('0xb')]=_0x48bc6c[_0x7c34('0xc')][_0x7c34('0xd')];_0x48bc6c[_0x7c34('0xe')]=_0x48bc6c[_0x7c34('0xc')][_0x7c34('0xf')];return Promise[_0x7c34('0x10')](_0x48bc6c['CloudProvider'][_0x7c34('0x11')]);}var _0x454d48={'method':_0x7c34('0x12'),'uri':_0x5e861c,'form':{'client_id':_0x48bc6c[_0x7c34('0x13')],'resource':_0x48bc6c['remoteUri'],'username':_0x48bc6c[_0x7c34('0x14')],'password':_0x48bc6c[_0x7c34('0x15')],'grant_type':_0x7c34('0x15'),'client_secret':_0x48bc6c[_0x7c34('0x16')]},'json':!![]};return rp(_0x454d48)[_0x7c34('0x17')](function(_0x2521b5){return _0x2521b5[_0x7c34('0x18')];})['catch'](function(_0x5efe40){logger[_0x7c34('0x19')]('['+[_0x1801de[_0x7c34('0x1a')]()]+_0x7c34('0x1b'));return _0x5efe40['message'];});}function getUser(_0x234da8,_0x1e6304,_0x15485b,_0x5f322e,_0x39cede,_0x4e52f3){return new Promise(function(_0x44dc34,_0x4daaf0){return getAuthToken(_0x1e6304,_0x5f322e,_0x4e52f3)['then'](function(_0x3ea439){var _0x4bcfc9={'method':_0x7c34('0x1c'),'uri':_0x39cede+_0x7c34('0x1d'),'headers':{'Authorization':'Bearer\x20'+_0x3ea439,'OData-Version':'4.0'},'json':!![]};return rp(_0x4bcfc9);})[_0x7c34('0x17')](function(_0x298737){var _0x23a3f9=_0x298737[_0x7c34('0x1e')];var _0x29e1b9=![];var _0x95953d=null;if(!_[_0x7c34('0x1f')](_0x15485b)){if(intUtil['validateEmail'](_0x15485b[_0x7c34('0x20')])){_0x234da8[_0x7c34('0x21')]=_0x15485b[_0x7c34('0x20')];for(_0x95953d=0x0;_0x95953d<_0x23a3f9[_0x7c34('0x22')];_0x95953d++){if(_0x23a3f9[_0x95953d][_0x7c34('0x23')]===_0x15485b[_0x7c34('0x20')]&&!_0x23a3f9[_0x95953d][_0x7c34('0x24')]){_0x29e1b9=!![];logger[_0x7c34('0x25')]('['+[_0x4e52f3[_0x7c34('0x1a')]()]+_0x7c34('0x26')+_0x23a3f9[_0x95953d][_0x7c34('0x27')]+'!');_0x234da8[_0x7c34('0x28')]=_0x23a3f9[_0x95953d][_0x7c34('0x27')];}}}}if(!_0x29e1b9){logger[_0x7c34('0x25')]('['+[_0x4e52f3['toUpperCase']()]+_0x7c34('0x29'));_0x234da8[_0x7c34('0x21')]=_0x1e6304[_0x7c34('0x14')];for(_0x95953d=0x0;_0x95953d<_0x23a3f9[_0x7c34('0x22')];_0x95953d++){if(_0x23a3f9[_0x95953d][_0x7c34('0x23')]===_0x1e6304[_0x7c34('0x14')]){_0x234da8[_0x7c34('0x28')]=_0x23a3f9[_0x95953d][_0x7c34('0x27')];}}}_0x44dc34(_0x234da8);})[_0x7c34('0x2a')](function(_0x4497f3){_0x4daaf0(_0x4497f3[_0x7c34('0x2b')]);});});}function createEndUser(_0x3bc468,_0x114757,_0x146611,_0x13788c,_0x45d24a,_0xa46517,_0x2f321d){return new Promise(function(_0x136407,_0x23b97d){return getAuthToken(_0x114757,_0x146611,_0xa46517)[_0x7c34('0x17')](function(_0x4844a1){var _0x337b4c=_0xa46517[_0x7c34('0x2c')]()===_0x7c34('0x2d')?_0x45d24a['destcalleridnum']:_0x45d24a[_0x7c34('0x2e')];var _0x3b5a98={'method':_0x7c34('0x12'),'uri':_0x13788c+'contacts','body':{'fullname':_0x337b4c,'firstname':_0x337b4c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7c34('0x2f')+_0x3bc468[_0x7c34('0x28')]+')'},'headers':{'Authorization':_0x7c34('0x30')+_0x4844a1,'OData-Version':_0x7c34('0x31')},'json':!![],'resolveWithFullResponse':!![]};_0x3b5a98[_0x7c34('0x32')][_0x2f321d]=_0x337b4c;return rp(_0x3b5a98);})[_0x7c34('0x17')](function(_0x297061){var _0x440b79=_0x297061[_0x7c34('0x33')][_0x7c34('0x34')];var _0x8c9e46=_0x440b79['substring'](_0x440b79[_0x7c34('0x35')]('(')+0x1,_0x440b79['lastIndexOf'](')'));_0x3bc468[_0x7c34('0x36')]=_0x8c9e46;_0x136407(_0x3bc468);})[_0x7c34('0x2a')](function(_0x3afdc0){_0x23b97d(_0x3afdc0[_0x7c34('0x2b')]);});});}function getEndUser(_0x41e0ef,_0x5f0946,_0x26906b,_0x3fcf9d,_0x15d206,_0x30b2f5,_0x11e510,_0x140128){var _0x38de1d=_0x30b2f5[_0x7c34('0x2c')]()===_0x7c34('0x2d')?_0x15d206['destcalleridnum']:_0x15d206[_0x7c34('0x2e')];return getAuthToken(_0x5f0946,_0x26906b,_0x30b2f5)[_0x7c34('0x17')](function(_0x1477d6){_0x140128=_0x140128?_0x140128:_0x7c34('0x37');var _0x5cd9ab={'method':'GET','uri':_0x3fcf9d+_0x7c34('0x38')+_0x140128+_0x7c34('0x39')+_0x140128+_0x7c34('0x3a')+_0x38de1d[_0x7c34('0x3b')]('+',_0x7c34('0x3c'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x1477d6,'If-None-Match':null,'OData-Version':_0x7c34('0x31')},'json':!![]};return rp(_0x5cd9ab);})['then'](function(_0x43f346){var _0x144fe9=![];if(!_0x43f346)return _0x144fe9;var _0x343154=_0x43f346[_0x7c34('0x1e')];for(var _0x4a3873=0x0;_0x4a3873<_0x343154[_0x7c34('0x22')];_0x4a3873++){if(_0x343154[_0x4a3873][_0x140128]===_0x38de1d){_0x144fe9=!![];_0x41e0ef[_0x7c34('0x36')]=_0x343154[_0x4a3873][_0x7c34('0x3d')];}}return _0x144fe9;})[_0x7c34('0x17')](function(_0x4c57a9){if(_0x4c57a9)return _0x41e0ef;if(_0x11e510===_0x7c34('0x3e')){logger[_0x7c34('0x25')]('['+[_0x30b2f5[_0x7c34('0x1a')]()]+_0x7c34('0x3f'));return _0x41e0ef;}return createEndUser(_0x41e0ef,_0x5f0946,_0x26906b,_0x3fcf9d,_0x15d206,_0x30b2f5,_0x140128)[_0x7c34('0x17')](function(_0x4c50a8){logger['info']('['+[_0x30b2f5[_0x7c34('0x1a')]()]+_0x7c34('0x40'),_0x4c50a8[_0x7c34('0x36')]);return _0x4c50a8;});});}function getCustomFields(_0x1adaec,_0x425e01,_0xdef2df){var _0x47ec2a={};if(_0x1adaec['length']>0x0){_[_0x7c34('0x41')](_0x1adaec,function(_0x16a930){if(_['includes']([_0x7c34('0x42'),_0x7c34('0x43')],_0x16a930['type'])&&_0x16a930[_0x7c34('0x44')]&&!_0x16a930[_0x7c34('0x45')]){var _0x57a007=_0x16a930[_0x7c34('0x46')][_0x7c34('0x2c')]();var _0x5c6fff=_0x57a007[_0x7c34('0x47')](0x0,_0x57a007[_0x7c34('0x48')]('_'));var _0x274934=_0x57a007[_0x7c34('0x47')](_0x57a007[_0x7c34('0x48')]('_')+0x1);if(_0x5c6fff===_0xdef2df){_0x47ec2a[_0x274934]=_0x16a930[_0x7c34('0x49')];}}});}return _0x47ec2a;}function getTicket(_0x4e532b,_0x596dfa,_0x1658ed,_0x831a8b,_0x3fb5ac,_0x442b69,_0x2e13ad){return new Promise(function(_0x2cbd1f,_0x43876f){var _0x35d067;return getAuthToken(_0x596dfa,_0x1658ed,_0x2e13ad)[_0x7c34('0x17')](function(_0x5a7bf0){if(_0x442b69['ticketType']==='incident'){_0x35d067={'method':_0x7c34('0x12'),'uri':_0x831a8b+'incidents','body':Object[_0x7c34('0x4a')]({},{'title':intUtil['getString'](_0x442b69[_0x7c34('0x4b')],_0x3fb5ac,'\x20'),'description':intUtil[_0x7c34('0x4c')](_0x442b69[_0x7c34('0x4d')],_0x3fb5ac,'\x0a'),'customerid_contact@odata.bind':_0x4e532b[_0x7c34('0x36')]?_0x7c34('0x4e')+_0x4e532b[_0x7c34('0x36')]+')':undefined,'ownerid@odata.bind':_0x7c34('0x2f')+_0x4e532b[_0x7c34('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x442b69[_0x7c34('0x4f')],_0x3fb5ac,_0x442b69[_0x7c34('0x50')])),'headers':{'Authorization':'Bearer\x20'+_0x5a7bf0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x442b69[_0x7c34('0x50')]===_0x7c34('0x51')){var _0x462c2c=_0x4e532b[_0x7c34('0x36')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4e532b['userId']+')','participationtypemask':_0x4e532b[_0x7c34('0x52')]===_0x7c34('0x53')?0x2:0x1},{'partyid_contact@odata.bind':_0x7c34('0x4e')+_0x4e532b[_0x7c34('0x36')]+')','participationtypemask':_0x4e532b[_0x7c34('0x52')]===_0x7c34('0x53')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x7c34('0x2f')+_0x4e532b[_0x7c34('0x28')]+')','participationtypemask':_0x4e532b[_0x7c34('0x52')]===_0x7c34('0x53')?0x2:0x1}];_0x35d067={'method':_0x7c34('0x12'),'uri':_0x831a8b+_0x7c34('0x54'),'body':Object[_0x7c34('0x4a')]({},{'subject':intUtil[_0x7c34('0x4c')](_0x442b69[_0x7c34('0x4b')],_0x3fb5ac,'\x20'),'phonenumber':String(_0x3fb5ac['calleridnum']),'description':intUtil[_0x7c34('0x4c')](_0x442b69['Descriptions'],_0x3fb5ac,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4e532b[_0x7c34('0x36')]?'/contacts('+_0x4e532b[_0x7c34('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4e532b[_0x7c34('0x28')]+')','directioncode':_0x4e532b[_0x7c34('0x52')]===_0x7c34('0x53')?![]:!![],'phonecall_activity_parties':_0x462c2c},getCustomFields(_0x442b69[_0x7c34('0x4f')],_0x3fb5ac,_0x442b69['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5a7bf0,'OData-Version':_0x7c34('0x31')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x35d067);})[_0x7c34('0x17')](function(_0x5a1c56){var _0x8cb603=_0x5a1c56['headers'][_0x7c34('0x34')];var _0xa76582=_0x8cb603[_0x7c34('0x47')](_0x8cb603['lastIndexOf']('(')+0x1,_0x8cb603[_0x7c34('0x35')](')'));_0x4e532b[_0x7c34('0x55')]=_0xa76582;_0x2cbd1f(_0x4e532b);})[_0x7c34('0x2a')](function(_0x3f9845){_0x43876f(_0x3f9845[_0x7c34('0x2b')]);});});}function emit(_0x17b96d,_0x2a15ae,_0x4de245,_0x201842){var _0x3a67dc={'uri':util[_0x7c34('0x56')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x17b96d,_0x4de245,_0x201842)};io['to'](util[_0x7c34('0x56')](_0x7c34('0x57'),_0x2a15ae))[_0x7c34('0x58')](_0x7c34('0x59'),_0x3a67dc);}exports['cs']=function(_0x3d0241,_0x405f7b,_0x2277b0,_0x429798,_0x36b144,_0x5d866d,_0x240a92,_0x308602){var _0x13ebe4={};_0x5d866d['remoteUri']=_0x5d866d['modernAuthentication']?intUtil[_0x7c34('0x5a')](_0x5d866d[_0x7c34('0xc')][_0x7c34('0xd')]):intUtil[_0x7c34('0x5a')](_0x5d866d[_0x7c34('0xb')]);_0x5d866d['serverUrl']=intUtil[_0x7c34('0x5a')](_0x5d866d[_0x7c34('0x5b')]);_0x13ebe4[_0x7c34('0x52')]=_0x308602===_0x7c34('0x53')||_0x308602==='unmanaged'?_0x7c34('0x53'):_0x7c34('0x2d');var _0x4dc14d=_0x5d866d['modernAuthentication']?util['format'](_0x7c34('0x5c'),_0x5d866d[_0x7c34('0xc')][_0x7c34('0xd')]):util[_0x7c34('0x56')](_0x7c34('0x5c'),_0x5d866d[_0x7c34('0xb')]);var _0xfa16fb=util['format'](_0x7c34('0x5d'),_0x5d866d[_0x7c34('0xe')]);var _0x4673b0=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d866d[_0x7c34('0x5b')],_0x405f7b['uniqueid'],md5(_0x405f7b[_0x7c34('0x5e')]));if(_0x36b144&&_0x36b144[_0x7c34('0x5f')]){logger[_0x7c34('0x25')](_0x7c34('0x60'),_0x7c34('0x61'));_0x405f7b['recordingURL']=_0x4673b0;}else if(_0x240a92&&_0x240a92[_0x7c34('0x62')]&&_0x240a92['recordingFormat']!==_0x7c34('0x63')){logger[_0x7c34('0x25')]('[OUTBOUND]',_0x7c34('0x61'));_0x405f7b['recordingURL']=_0x4673b0;}else{_0x405f7b[_0x7c34('0x64')]='';}return getUser(_0x13ebe4,_0x5d866d,_0x429798,_0xfa16fb,_0x4dc14d,_0x308602)[_0x7c34('0x17')](function(_0x1099ab){logger[_0x7c34('0x25')]('['+_0x308602[_0x7c34('0x1a')]()+']\x20The\x20User\x20ID\x20is:',_0x1099ab['userId']);logger['info']('['+_0x308602[_0x7c34('0x1a')]()+_0x7c34('0x65'),_0x1099ab[_0x7c34('0x21')]);return getEndUser(_0x1099ab,_0x5d866d,_0xfa16fb,_0x4dc14d,_0x405f7b,_0x308602,_0x2277b0[_0x7c34('0x66')],_0x2277b0[_0x7c34('0x67')]);})[_0x7c34('0x17')](function(_0x18b11c){logger['info']('['+_0x308602['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x18b11c[_0x7c34('0x36')]);logger[_0x7c34('0x25')]('['+_0x308602[_0x7c34('0x1a')]()+_0x7c34('0x68'),_0x405f7b[_0x7c34('0x2e')]);return getTicket(_0x18b11c,_0x5d866d,_0xfa16fb,_0x4dc14d,_0x405f7b,_0x2277b0,_0x308602);})[_0x7c34('0x17')](function(_0x542559){logger[_0x7c34('0x25')](util[_0x7c34('0x56')]('['+_0x308602[_0x7c34('0x1a')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2277b0[_0x7c34('0x50')],_0x542559[_0x7c34('0x55')]));logger['info'](util['format']('['+_0x308602[_0x7c34('0x1a')]()+_0x7c34('0x69'),_0x308602));if(_0x308602!==_0x7c34('0x6a')&&_0x2277b0['openNewTab']){logger[_0x7c34('0x25')]('['+_0x308602[_0x7c34('0x1a')]()+']',_0x7c34('0x6b'));emit(_0x5d866d[_0x7c34('0xb')],_0x429798[_0x7c34('0x6c')],_0x2277b0[_0x7c34('0x50')],_0x542559[_0x7c34('0x55')]);}})[_0x7c34('0x2a')](function(_0x1457e4){logger[_0x7c34('0x19')]('['+_0x308602[_0x7c34('0x1a')]()+_0x7c34('0x6d'),_0x1457e4[_0x7c34('0x2b')]);console[_0x7c34('0x19')]('Error\x20running\x20Dynamics365\x20integration',_0x1457e4);});}; \ 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 610f682..cf0a8b3 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 _0x3eca=['outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','stringify','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Descriptions','
','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','[HTTP]','GET','map','forEach','includes','picklist','nameField','toLowerCase','type','customField','push','idField','variable','variableName','toString','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error'];(function(_0x413ff0,_0x1e782d){var _0x3826d4=function(_0x46c7ae){while(--_0x46c7ae){_0x413ff0['push'](_0x413ff0['shift']());}};_0x3826d4(++_0x1e782d);}(_0x3eca,0x11b));var _0xa3ec=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0x3eca[_0x254081];return _0x5d1e2a;};'use strict';var _=require(_0xa3ec('0x0'));var rp=require(_0xa3ec('0x1'));var md5=require(_0xa3ec('0x2'));var util=require(_0xa3ec('0x3'));var Redis=require(_0xa3ec('0x4'));var intUtil=require(_0xa3ec('0x5'));var config=require(_0xa3ec('0x6'));var logger=require(_0xa3ec('0x7'))('freshdesk');config['redis']=_[_0xa3ec('0x8')](config[_0xa3ec('0x9')],{'host':_0xa3ec('0xa'),'port':0x18eb});var io=require(_0xa3ec('0xb'))(new Redis(config[_0xa3ec('0x9')]));var headers={'Content-Type':_0xa3ec('0xc'),'Accept':'application/json'};function emit(_0x5e9b95,_0x1901b7,_0x1af87a){io['to'](_0x5e9b95)['emit'](_0x1901b7,_0x1af87a);}function getTicket(_0x427e51,_0x55c6d0,_0x8b8931,_0x5490f3,_0xbc5cd1){logger[_0xa3ec('0xd')](_0xa3ec('0xe'));var _0x46fae4=_[_0xa3ec('0xf')]({'responder_id':_0x55c6d0['id'],'requester_id':_0x8b8931['id'],'name':util[_0xa3ec('0x10')](_0xa3ec('0x11'),_0xbc5cd1[_0xa3ec('0x12')]),'phone':_0xbc5cd1[_0xa3ec('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5490f3['Subjects'],_0xbc5cd1,'\x20'),'description':intUtil['getString'](_0x5490f3[_0xa3ec('0x14')],_0xbc5cd1,_0xa3ec('0x15')),'tags':getTags(_0x5490f3['Tags'],_0xa3ec('0x16'))},getCustomFields(_0x5490f3['Fields'],_0xbc5cd1));_0x46fae4[_0xa3ec('0x17')]=_['mapValues'](_[_0xa3ec('0x18')](_0x46fae4[_0xa3ec('0x17')],'id'),_0xa3ec('0x19'));return request({'uri':util[_0xa3ec('0x10')](_0xa3ec('0x1a'),_0x427e51[_0xa3ec('0x1b')]),'method':_0xa3ec('0x1c'),'body':_0x46fae4})[_0xa3ec('0x1d')](function(_0x751fe9){logger['info'](_0xa3ec('0x1e'));return _0x751fe9;});}function getUser(_0x52f212,_0x4fa51b){if(intUtil['validateEmail'](_0x4fa51b)){return request({'uri':util[_0xa3ec('0x10')](_0xa3ec('0x1f'),_0x52f212['remoteUri']),'qs':{'email':_0x4fa51b}})[_0xa3ec('0x1d')](function(_0x27f15f){if(_0x27f15f[_0xa3ec('0x20')]){logger['info'](_0xa3ec('0x21'));return _[_0xa3ec('0x22')](_0x27f15f,function(_0x101d19){return _0x101d19[_0xa3ec('0x23')][_0xa3ec('0x24')]===_0x4fa51b;});}else{logger[_0xa3ec('0xd')](_0xa3ec('0x25'));return request({'uri':util[_0xa3ec('0x10')]('%s/api/v2/agents/me',_0x52f212[_0xa3ec('0x1b')])})['then'](function(_0x5ec472){logger[_0xa3ec('0xd')](_0xa3ec('0x26'));return _0x5ec472;});}});}else{logger[_0xa3ec('0xd')](_0xa3ec('0x27'));return request({'uri':util[_0xa3ec('0x10')](_0xa3ec('0x28'),_0x52f212[_0xa3ec('0x1b')])})[_0xa3ec('0x1d')](function(_0x17e4fd){logger[_0xa3ec('0xd')](_0xa3ec('0x26'));return _0x17e4fd;});}}function getEndUser(_0x598c88,_0x44ba55,_0x16d7a8){logger[_0xa3ec('0xd')](_0xa3ec('0x29'),_0x16d7a8);return request({'uri':util[_0xa3ec('0x10')](_0xa3ec('0x2a'),_0x598c88['remoteUri']),'qs':{'phone':_0x16d7a8}})[_0xa3ec('0x1d')](function(_0x12e956){if(_0x12e956[_0xa3ec('0x20')]){logger[_0xa3ec('0xd')]('Enduser\x20found!');return _[_0xa3ec('0x22')](_0x12e956,{'phone':_0x16d7a8});}else{logger[_0xa3ec('0xd')](_0xa3ec('0x2b'));return request({'uri':util[_0xa3ec('0x10')](_0xa3ec('0x2a'),_0x598c88[_0xa3ec('0x1b')]),'method':_0xa3ec('0x1c'),'body':{'name':_0x44ba55,'phone':_0x16d7a8}})[_0xa3ec('0x1d')](function(_0x309c42){logger[_0xa3ec('0xd')](_0xa3ec('0x2c'));return _0x309c42;});}});}function getAuth(_0x220078){return util[_0xa3ec('0x10')](_0xa3ec('0x2d'),new Buffer(_0x220078[_0xa3ec('0x2e')]+':X')['toString'](_0xa3ec('0x2f')));}function request(_0x4bb677){logger[_0xa3ec('0x30')](_0xa3ec('0x31'),JSON['stringify'](_0x4bb677));return rp(_['defaults'](_0x4bb677,{'method':_0xa3ec('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x692666,_0x20d3db){var _0x91288a=[];if(_0x692666&&_0x692666['length']>0x0){_0x91288a=_[_0xa3ec('0x33')](_0x692666,_0x20d3db);}return _0x91288a;}function getCustomFields(_0x5ad6f6,_0x926034){var _0x484d45=[];var _0x90c609={'custom_fields':[]};if(_0x5ad6f6[_0xa3ec('0x20')]>0x0){_[_0xa3ec('0x34')](_0x5ad6f6,function(_0x1d5ee4){if(_[_0xa3ec('0x35')](['string',_0xa3ec('0x36')],_0x1d5ee4['type'])&&_0x1d5ee4[_0xa3ec('0x37')]&&!_0x1d5ee4['customField']){_0x90c609[_0x1d5ee4[_0xa3ec('0x37')][_0xa3ec('0x38')]()]=_0x1d5ee4['content']['toString']();}else if(_[_0xa3ec('0x35')](['string','picklist'],_0x1d5ee4[_0xa3ec('0x39')])&&_0x1d5ee4['idField']&&_0x1d5ee4[_0xa3ec('0x3a')]){_0x90c609[_0xa3ec('0x17')][_0xa3ec('0x3b')]({'id':_0x1d5ee4[_0xa3ec('0x3c')],'value':_0x1d5ee4['content']['toString']()});}else if(_0x1d5ee4[_0xa3ec('0x39')]===_0xa3ec('0x3d')&&_0x1d5ee4[_0xa3ec('0x3e')]&&_0x1d5ee4['idField']&&_0x1d5ee4[_0xa3ec('0x3a')]){_0x926034[_0x1d5ee4[_0xa3ec('0x3e')]]&&_0x90c609[_0xa3ec('0x17')]['push']({'id':_0x1d5ee4[_0xa3ec('0x3c')],'value':_0x926034[_0x1d5ee4[_0xa3ec('0x3e')]][_0xa3ec('0x3f')]()});}else if(_0x1d5ee4[_0xa3ec('0x39')]===_0xa3ec('0x40')&&_0x1d5ee4[_0xa3ec('0x41')]&&_0x1d5ee4[_0xa3ec('0x41')]['name']&&_0x1d5ee4[_0xa3ec('0x3c')]&&_0x1d5ee4['customField']){_0x926034[_0x1d5ee4[_0xa3ec('0x41')]['name'][_0xa3ec('0x38')]()]&&_0x90c609['custom_fields'][_0xa3ec('0x3b')]({'id':_0x1d5ee4[_0xa3ec('0x3c')],'value':_0x926034[_0x1d5ee4['Variable']['name']['toLowerCase']()]['toString']()});}});}return _0x90c609;}exports['queue']=function(_0x47e896,_0x215a36,_0x4fbbda,_0x44308f,_0x17f4bd,_0x28e267){var _0xa17bd2,_0x58eb1e;_0x28e267[_0xa3ec('0x1b')]=intUtil[_0xa3ec('0x42')](_0x28e267[_0xa3ec('0x1b')]);_0x28e267[_0xa3ec('0x43')]=intUtil[_0xa3ec('0x42')](_0x28e267[_0xa3ec('0x43')]);if(_0x17f4bd&&_0x17f4bd[_0xa3ec('0x44')]){logger[_0xa3ec('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x215a36[_0xa3ec('0x45')]=util[_0xa3ec('0x10')](_0xa3ec('0x46'),_0x28e267[_0xa3ec('0x43')],_0x215a36[_0xa3ec('0x47')],md5(_0x215a36['uniqueid']));}else{_0x215a36[_0xa3ec('0x45')]='';}headers[_0xa3ec('0x48')]=getAuth(_0x28e267);return getUser(_0x28e267,_0x44308f[_0xa3ec('0x24')])[_0xa3ec('0x1d')](function(_0x2be61f){_0xa17bd2=_0x2be61f;logger[_0xa3ec('0xd')]('The\x20User\x20ID\x20is:',_0xa17bd2['id']);return getEndUser(_0x28e267,_0x215a36[_0xa3ec('0x12')],_0x215a36['calleridnum']);})['then'](function(_0xfbe954){_0x58eb1e=_0xfbe954;logger['info'](_0xa3ec('0x49'),_0x58eb1e['id']);return getTicket(_0x28e267,_0xa17bd2,_0x58eb1e,_0x4fbbda,_0x215a36);})['then'](function(_0x1efb58){if(_0x1efb58&&_0x1efb58['id']){logger[_0xa3ec('0xd')](_0xa3ec('0x1e'));logger[_0xa3ec('0xd')](_0xa3ec('0x4a'),_0x1efb58['id']);logger[_0xa3ec('0xd')]('[QUEUE]',_0xa3ec('0x4b'));emit(util[_0xa3ec('0x10')](_0xa3ec('0x4c'),_0x44308f['name']),_0xa3ec('0x4d'),{'uri':util[_0xa3ec('0x10')](_0xa3ec('0x4e'),_0x28e267[_0xa3ec('0x1b')],_0x1efb58['id'])});}})[_0xa3ec('0x4f')](function(_0x4aa270){logger[_0xa3ec('0x50')]('[QUEUE]',JSON['stringify'](_0x4aa270));});};exports[_0xa3ec('0x51')]=function(_0x279eb8,_0x52c916,_0x574cac,_0x1686e3,_0x4e61e2,_0x352d85,_0x24d982){var _0xe287eb,_0x3df92a;_0x352d85[_0xa3ec('0x1b')]=intUtil[_0xa3ec('0x42')](_0x352d85[_0xa3ec('0x1b')]);_0x352d85['serverUrl']=intUtil['stripTrailingSlash'](_0x352d85[_0xa3ec('0x43')]);if(_0x24d982&&_0x24d982[_0xa3ec('0x52')]&&_0x24d982[_0xa3ec('0x52')]!==_0xa3ec('0x53')){logger['info'](_0xa3ec('0x54'),_0xa3ec('0x55'));_0x52c916['recordingURL']=util[_0xa3ec('0x10')](_0xa3ec('0x46'),_0x352d85[_0xa3ec('0x43')],_0x52c916[_0xa3ec('0x47')],md5(_0x52c916[_0xa3ec('0x47')]));}headers[_0xa3ec('0x48')]=getAuth(_0x352d85);return getUser(_0x352d85,_0x1686e3[_0xa3ec('0x24')])['then'](function(_0x4cdbc0){_0xe287eb=_0x4cdbc0;logger[_0xa3ec('0xd')](_0xa3ec('0x56'),_0xe287eb['id']);return getEndUser(_0x352d85,_0x52c916['destcalleridname'],_0x52c916['destcalleridnum']);})['then'](function(_0x9e5a6b){_0x3df92a=_0x9e5a6b;logger[_0xa3ec('0xd')](_0xa3ec('0x49'),_0x3df92a['id']);return getTicket(_0x352d85,_0xe287eb,_0x3df92a,_0x574cac,_0x52c916);})[_0xa3ec('0x1d')](function(_0xf9d294){if(_0xf9d294&&_0xf9d294['id']){logger[_0xa3ec('0xd')](_0xa3ec('0x1e'));logger['info'](_0xa3ec('0x4a'),_0xf9d294['id']);logger[_0xa3ec('0xd')](_0xa3ec('0x54'),_0xa3ec('0x4b'));emit(util[_0xa3ec('0x10')]('user:%s',_0x1686e3[_0xa3ec('0x16')]),'trigger:browser:url',{'uri':util['format'](_0xa3ec('0x4e'),_0x352d85[_0xa3ec('0x1b')],_0xf9d294['id'])});}})['catch'](function(_0x51e849){logger['error'](_0xa3ec('0x54'),JSON[_0xa3ec('0x57')](_0x51e849));});};exports[_0xa3ec('0x58')]=function(_0x47eb95,_0x4756bc,_0x124ec3,_0x4d241b,_0x38b23e,_0x1754fb){var _0x2aee00,_0x517d33;_0x1754fb[_0xa3ec('0x1b')]=intUtil[_0xa3ec('0x42')](_0x1754fb[_0xa3ec('0x1b')]);_0x1754fb['serverUrl']=intUtil[_0xa3ec('0x42')](_0x1754fb['serverUrl']);if(_0x38b23e&&_0x38b23e[_0xa3ec('0x44')]){logger[_0xa3ec('0xd')]('['+_0x4756bc[_0xa3ec('0x59')][_0xa3ec('0x5a')]()+']','Recording\x20is\x20enabled!');_0x4756bc[_0xa3ec('0x45')]=util[_0xa3ec('0x10')](_0xa3ec('0x46'),_0x1754fb[_0xa3ec('0x43')],_0x4756bc[_0xa3ec('0x47')],md5(_0x4756bc['uniqueid']));}else{_0x4756bc[_0xa3ec('0x45')]='';}headers[_0xa3ec('0x48')]=getAuth(_0x1754fb);return getUser(_0x1754fb,'')['then'](function(_0x11a6d0){_0x2aee00=_0x11a6d0;logger[_0xa3ec('0xd')](_0xa3ec('0x56'),_0x2aee00['id']);return getEndUser(_0x1754fb,_0x4756bc[_0xa3ec('0x12')],_0x4756bc['calleridnum']);})[_0xa3ec('0x1d')](function(_0x5bb457){_0x517d33=_0x5bb457;logger[_0xa3ec('0xd')](_0xa3ec('0x49'),_0x517d33['id']);return getTicket(_0x1754fb,_0x2aee00,_0x517d33,_0x124ec3,_0x4756bc);})[_0xa3ec('0x1d')](function(_0x3ca08c){if(_0x3ca08c){logger[_0xa3ec('0xd')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x3ca08c['id']);}})[_0xa3ec('0x4f')](function(_0xd77498){logger[_0xa3ec('0x50')]('['+_0x4756bc['lastevent']['toUpperCase']()+']',JSON[_0xa3ec('0x57')](_0xd77498));});}; \ No newline at end of file +var _0xb0e4=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Ticket\x20ID\x20is:','user:%s','stringify','monitor_format','lastevent','toUpperCase','request-promise','md5','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','name','Fields','custom_fields','value','POST','then','info','%s/api/v2/agents','remoteUri','length','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','GET','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','push','idField','variable','variableName','Variable','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[QUEUE]'];(function(_0x5d6f0e,_0x28d536){var _0x1810e7=function(_0x52ced3){while(--_0x52ced3){_0x5d6f0e['push'](_0x5d6f0e['shift']());}};_0x1810e7(++_0x28d536);}(_0xb0e4,0x1c8));var _0x4b0e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xb0e4[_0x1d24eb];return _0x1dc576;};'use strict';var _=require('lodash');var rp=require(_0x4b0e('0x0'));var md5=require(_0x4b0e('0x1'));var util=require(_0x4b0e('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4b0e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x4b0e('0x4'))(_0x4b0e('0x5'));config[_0x4b0e('0x6')]=_[_0x4b0e('0x7')](config[_0x4b0e('0x6')],{'host':_0x4b0e('0x8'),'port':0x18eb});var io=require(_0x4b0e('0x9'))(new Redis(config[_0x4b0e('0x6')]));var headers={'Content-Type':_0x4b0e('0xa'),'Accept':_0x4b0e('0xa')};function emit(_0x41521a,_0x51727a,_0x1d4385){io['to'](_0x41521a)[_0x4b0e('0xb')](_0x51727a,_0x1d4385);}function getTicket(_0x3a6efd,_0x5e0ead,_0x272e51,_0xfb046b,_0x5c6852){logger['info'](_0x4b0e('0xc'));var _0x1e7a25=_[_0x4b0e('0xd')]({'responder_id':_0x5e0ead['id'],'requester_id':_0x272e51['id'],'name':util[_0x4b0e('0xe')](_0x4b0e('0xf'),_0x5c6852[_0x4b0e('0x10')]),'phone':_0x5c6852[_0x4b0e('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xfb046b[_0x4b0e('0x12')],_0x5c6852,'\x20'),'description':intUtil[_0x4b0e('0x13')](_0xfb046b[_0x4b0e('0x14')],_0x5c6852,'
'),'tags':getTags(_0xfb046b['Tags'],_0x4b0e('0x15'))},getCustomFields(_0xfb046b[_0x4b0e('0x16')],_0x5c6852));_0x1e7a25['custom_fields']=_['mapValues'](_['keyBy'](_0x1e7a25[_0x4b0e('0x17')],'id'),_0x4b0e('0x18'));return request({'uri':util[_0x4b0e('0xe')]('%s/api/v2/tickets',_0x3a6efd['remoteUri']),'method':_0x4b0e('0x19'),'body':_0x1e7a25})[_0x4b0e('0x1a')](function(_0x223155){logger[_0x4b0e('0x1b')]('Ticket\x20created!');return _0x223155;});}function getUser(_0x4b6761,_0x139643){if(intUtil['validateEmail'](_0x139643)){return request({'uri':util[_0x4b0e('0xe')](_0x4b0e('0x1c'),_0x4b6761[_0x4b0e('0x1d')]),'qs':{'email':_0x139643}})['then'](function(_0x5027eb){if(_0x5027eb[_0x4b0e('0x1e')]){logger[_0x4b0e('0x1b')]('Agent\x20found!');return _['find'](_0x5027eb,function(_0x1eb2d0){return _0x1eb2d0[_0x4b0e('0x1f')][_0x4b0e('0x20')]===_0x139643;});}else{logger[_0x4b0e('0x1b')](_0x4b0e('0x21'));return request({'uri':util[_0x4b0e('0xe')]('%s/api/v2/agents/me',_0x4b6761[_0x4b0e('0x1d')])})[_0x4b0e('0x1a')](function(_0x511788){logger['info']('Admin\x20account\x20selected.');return _0x511788;});}});}else{logger[_0x4b0e('0x1b')](_0x4b0e('0x22'));return request({'uri':util[_0x4b0e('0xe')](_0x4b0e('0x23'),_0x4b6761['remoteUri'])})[_0x4b0e('0x1a')](function(_0x43ad98){logger[_0x4b0e('0x1b')](_0x4b0e('0x24'));return _0x43ad98;});}}function getEndUser(_0x51d459,_0x40d974,_0x27d525){logger[_0x4b0e('0x1b')](_0x4b0e('0x25'),_0x27d525);return request({'uri':util[_0x4b0e('0xe')](_0x4b0e('0x26'),_0x51d459[_0x4b0e('0x1d')]),'qs':{'phone':_0x27d525}})[_0x4b0e('0x1a')](function(_0x30027a){if(_0x30027a['length']){logger[_0x4b0e('0x1b')]('Enduser\x20found!');return _[_0x4b0e('0x27')](_0x30027a,{'phone':_0x27d525});}else{logger[_0x4b0e('0x1b')](_0x4b0e('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x51d459[_0x4b0e('0x1d')]),'method':'POST','body':{'name':_0x40d974,'phone':_0x27d525}})[_0x4b0e('0x1a')](function(_0x53b2c1){logger['info'](_0x4b0e('0x29'));return _0x53b2c1;});}});}function getAuth(_0x35f38e){return util['format'](_0x4b0e('0x2a'),new Buffer(_0x35f38e[_0x4b0e('0x2b')]+':X')[_0x4b0e('0x2c')](_0x4b0e('0x2d')));}function request(_0x46a348){logger[_0x4b0e('0x2e')]('[HTTP]',JSON['stringify'](_0x46a348));return rp(_['defaults'](_0x46a348,{'method':_0x4b0e('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x14d573,_0x44e2a2){var _0x5d12be=[];if(_0x14d573&&_0x14d573[_0x4b0e('0x1e')]>0x0){_0x5d12be=_['map'](_0x14d573,_0x44e2a2);}return _0x5d12be;}function getCustomFields(_0x242b47,_0x275c26){var _0x2ebe9f=[];var _0x18e748={'custom_fields':[]};if(_0x242b47['length']>0x0){_[_0x4b0e('0x30')](_0x242b47,function(_0x4a340f){if(_[_0x4b0e('0x31')]([_0x4b0e('0x32'),_0x4b0e('0x33')],_0x4a340f[_0x4b0e('0x34')])&&_0x4a340f[_0x4b0e('0x35')]&&!_0x4a340f[_0x4b0e('0x36')]){_0x18e748[_0x4a340f[_0x4b0e('0x35')][_0x4b0e('0x37')]()]=_0x4a340f[_0x4b0e('0x38')][_0x4b0e('0x2c')]();}else if(_[_0x4b0e('0x31')]([_0x4b0e('0x32'),_0x4b0e('0x33')],_0x4a340f[_0x4b0e('0x34')])&&_0x4a340f['idField']&&_0x4a340f[_0x4b0e('0x36')]){_0x18e748[_0x4b0e('0x17')][_0x4b0e('0x39')]({'id':_0x4a340f[_0x4b0e('0x3a')],'value':_0x4a340f[_0x4b0e('0x38')][_0x4b0e('0x2c')]()});}else if(_0x4a340f[_0x4b0e('0x34')]===_0x4b0e('0x3b')&&_0x4a340f[_0x4b0e('0x3c')]&&_0x4a340f['idField']&&_0x4a340f[_0x4b0e('0x36')]){_0x275c26[_0x4a340f['variableName']]&&_0x18e748[_0x4b0e('0x17')][_0x4b0e('0x39')]({'id':_0x4a340f[_0x4b0e('0x3a')],'value':_0x275c26[_0x4a340f['variableName']][_0x4b0e('0x2c')]()});}else if(_0x4a340f[_0x4b0e('0x34')]==='customVariable'&&_0x4a340f['Variable']&&_0x4a340f[_0x4b0e('0x3d')][_0x4b0e('0x15')]&&_0x4a340f[_0x4b0e('0x3a')]&&_0x4a340f['customField']){_0x275c26[_0x4a340f[_0x4b0e('0x3d')]['name'][_0x4b0e('0x37')]()]&&_0x18e748['custom_fields']['push']({'id':_0x4a340f[_0x4b0e('0x3a')],'value':_0x275c26[_0x4a340f['Variable'][_0x4b0e('0x15')][_0x4b0e('0x37')]()]['toString']()});}});}return _0x18e748;}exports['queue']=function(_0x2a71bb,_0x12fa6f,_0x1e2cbd,_0x25f259,_0xe7f0b4,_0x5bdbd9){var _0x2d45b3,_0x4131b4;_0x5bdbd9[_0x4b0e('0x1d')]=intUtil['stripTrailingSlash'](_0x5bdbd9[_0x4b0e('0x1d')]);_0x5bdbd9[_0x4b0e('0x3e')]=intUtil[_0x4b0e('0x3f')](_0x5bdbd9[_0x4b0e('0x3e')]);if(_0xe7f0b4&&_0xe7f0b4['monitor_format']){logger[_0x4b0e('0x1b')]('[QUEUE]',_0x4b0e('0x40'));_0x12fa6f[_0x4b0e('0x41')]=util[_0x4b0e('0xe')](_0x4b0e('0x42'),_0x5bdbd9[_0x4b0e('0x3e')],_0x12fa6f[_0x4b0e('0x43')],md5(_0x12fa6f[_0x4b0e('0x43')]));}else{_0x12fa6f[_0x4b0e('0x41')]='';}headers[_0x4b0e('0x44')]=getAuth(_0x5bdbd9);return getUser(_0x5bdbd9,_0x25f259[_0x4b0e('0x20')])[_0x4b0e('0x1a')](function(_0x1fae03){_0x2d45b3=_0x1fae03;logger[_0x4b0e('0x1b')]('The\x20User\x20ID\x20is:',_0x2d45b3['id']);return getEndUser(_0x5bdbd9,_0x12fa6f[_0x4b0e('0x10')],_0x12fa6f[_0x4b0e('0x11')]);})[_0x4b0e('0x1a')](function(_0x1f16e2){_0x4131b4=_0x1f16e2;logger[_0x4b0e('0x1b')](_0x4b0e('0x45'),_0x4131b4['id']);return getTicket(_0x5bdbd9,_0x2d45b3,_0x4131b4,_0x1e2cbd,_0x12fa6f);})[_0x4b0e('0x1a')](function(_0x572030){if(_0x572030&&_0x572030['id']){logger[_0x4b0e('0x1b')](_0x4b0e('0x46'));logger[_0x4b0e('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x572030['id']);logger[_0x4b0e('0x1b')](_0x4b0e('0x47'),_0x4b0e('0x48'));emit(util[_0x4b0e('0xe')]('user:%s',_0x25f259[_0x4b0e('0x15')]),_0x4b0e('0x49'),{'uri':util[_0x4b0e('0xe')](_0x4b0e('0x4a'),_0x5bdbd9[_0x4b0e('0x1d')],_0x572030['id'])});}})[_0x4b0e('0x4b')](function(_0x1798ab){logger[_0x4b0e('0x4c')](_0x4b0e('0x47'),JSON['stringify'](_0x1798ab));});};exports['outbound']=function(_0x31407d,_0x5e3fc6,_0xc28320,_0x1766cd,_0x3fb29d,_0x2ca0f3,_0x209795){var _0x3562ce,_0x238ba9;_0x2ca0f3[_0x4b0e('0x1d')]=intUtil[_0x4b0e('0x3f')](_0x2ca0f3[_0x4b0e('0x1d')]);_0x2ca0f3[_0x4b0e('0x3e')]=intUtil[_0x4b0e('0x3f')](_0x2ca0f3[_0x4b0e('0x3e')]);if(_0x209795&&_0x209795[_0x4b0e('0x4d')]&&_0x209795[_0x4b0e('0x4d')]!==_0x4b0e('0x4e')){logger[_0x4b0e('0x1b')](_0x4b0e('0x4f'),_0x4b0e('0x40'));_0x5e3fc6[_0x4b0e('0x41')]=util[_0x4b0e('0xe')](_0x4b0e('0x42'),_0x2ca0f3[_0x4b0e('0x3e')],_0x5e3fc6['uniqueid'],md5(_0x5e3fc6[_0x4b0e('0x43')]));}headers[_0x4b0e('0x44')]=getAuth(_0x2ca0f3);return getUser(_0x2ca0f3,_0x1766cd[_0x4b0e('0x20')])[_0x4b0e('0x1a')](function(_0x1abaf6){_0x3562ce=_0x1abaf6;logger[_0x4b0e('0x1b')](_0x4b0e('0x50'),_0x3562ce['id']);return getEndUser(_0x2ca0f3,_0x5e3fc6[_0x4b0e('0x51')],_0x5e3fc6['destcalleridnum']);})[_0x4b0e('0x1a')](function(_0x4420b4){_0x238ba9=_0x4420b4;logger[_0x4b0e('0x1b')](_0x4b0e('0x45'),_0x238ba9['id']);return getTicket(_0x2ca0f3,_0x3562ce,_0x238ba9,_0xc28320,_0x5e3fc6);})[_0x4b0e('0x1a')](function(_0x1bf7f8){if(_0x1bf7f8&&_0x1bf7f8['id']){logger[_0x4b0e('0x1b')]('Ticket\x20created!');logger[_0x4b0e('0x1b')](_0x4b0e('0x52'),_0x1bf7f8['id']);logger[_0x4b0e('0x1b')](_0x4b0e('0x4f'),_0x4b0e('0x48'));emit(util[_0x4b0e('0xe')](_0x4b0e('0x53'),_0x1766cd['name']),_0x4b0e('0x49'),{'uri':util[_0x4b0e('0xe')]('%s/helpdesk/tickets/%d',_0x2ca0f3['remoteUri'],_0x1bf7f8['id'])});}})['catch'](function(_0x2156d8){logger[_0x4b0e('0x4c')](_0x4b0e('0x4f'),JSON[_0x4b0e('0x54')](_0x2156d8));});};exports['unmanaged']=function(_0x57a889,_0x471603,_0x1d76c2,_0x2747e4,_0x2b2417,_0x1c3a13){var _0x36ec0e,_0x35e14f;_0x1c3a13[_0x4b0e('0x1d')]=intUtil[_0x4b0e('0x3f')](_0x1c3a13[_0x4b0e('0x1d')]);_0x1c3a13[_0x4b0e('0x3e')]=intUtil[_0x4b0e('0x3f')](_0x1c3a13[_0x4b0e('0x3e')]);if(_0x2b2417&&_0x2b2417[_0x4b0e('0x55')]){logger[_0x4b0e('0x1b')]('['+_0x471603[_0x4b0e('0x56')][_0x4b0e('0x57')]()+']',_0x4b0e('0x40'));_0x471603['recordingURL']=util[_0x4b0e('0xe')](_0x4b0e('0x42'),_0x1c3a13[_0x4b0e('0x3e')],_0x471603[_0x4b0e('0x43')],md5(_0x471603['uniqueid']));}else{_0x471603[_0x4b0e('0x41')]='';}headers[_0x4b0e('0x44')]=getAuth(_0x1c3a13);return getUser(_0x1c3a13,'')[_0x4b0e('0x1a')](function(_0x13131b){_0x36ec0e=_0x13131b;logger[_0x4b0e('0x1b')](_0x4b0e('0x50'),_0x36ec0e['id']);return getEndUser(_0x1c3a13,_0x471603[_0x4b0e('0x10')],_0x471603[_0x4b0e('0x11')]);})[_0x4b0e('0x1a')](function(_0x16a5cd){_0x35e14f=_0x16a5cd;logger[_0x4b0e('0x1b')](_0x4b0e('0x45'),_0x35e14f['id']);return getTicket(_0x1c3a13,_0x36ec0e,_0x35e14f,_0x1d76c2,_0x471603);})[_0x4b0e('0x1a')](function(_0x676d62){if(_0x676d62){logger[_0x4b0e('0x1b')](_0x4b0e('0x46'));logger[_0x4b0e('0x1b')](_0x4b0e('0x52'),_0x676d62['id']);}})[_0x4b0e('0x4b')](function(_0x27f689){logger[_0x4b0e('0x4c')]('['+_0x471603[_0x4b0e('0x56')][_0x4b0e('0x57')]()+']',JSON['stringify'](_0x27f689));});}; \ 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 a9b428a..f13d49f 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 _0xfcf4=['redis','defaults','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','GET','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','add','task','Task\x20created:','ticketId','/contacts/','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','queue','unmanaged','outbound','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','request-promise','util','moment','bluebird','../../../../config/logger','freshsales'];(function(_0x4c8aaf,_0x18c608){var _0x439044=function(_0x247e79){while(--_0x247e79){_0x4c8aaf['push'](_0x4c8aaf['shift']());}};_0x439044(++_0x18c608);}(_0xfcf4,0xd7));var _0x4fcf=function(_0x4193c5,_0x3aaf30){_0x4193c5=_0x4193c5-0x0;var _0xfa16cc=_0xfcf4[_0x4193c5];return _0xfa16cc;};'use strict';var _=require(_0x4fcf('0x0'));var rp=require(_0x4fcf('0x1'));var md5=require('md5');var util=require(_0x4fcf('0x2'));var moment=require(_0x4fcf('0x3'));var Promise=require(_0x4fcf('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x4fcf('0x5'))(_0x4fcf('0x6'));config[_0x4fcf('0x7')]=_[_0x4fcf('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x4fcf('0x9'))(new Redis(config['redis']));function getAdminId(_0x55c2a9,_0x55ff5f,_0x36645f,_0x3197b2){return new Promise(function(_0x54dfc4,_0x5a5abc){var _0x52b247=![];var _0x5535bb={'method':'GET','uri':_0x3197b2+_0x4fcf('0xa'),'json':!![]};_0x5535bb[_0x4fcf('0xb')]=_0x36645f;logger[_0x4fcf('0xc')](_0x4fcf('0xd'));return rp(_0x5535bb)[_0x4fcf('0xe')](function(_0x5e5d30){if(_0x5e5d30){var _0x5544e0=_0x5e5d30[_0x4fcf('0xf')];var _0x621668=null;for(_0x621668=0x0;_0x621668<_0x5544e0['length'];_0x621668++){if(_0x5544e0[_0x621668][_0x4fcf('0x10')]===_0x55c2a9[_0x4fcf('0x11')]){_0x55c2a9[_0x4fcf('0x12')]=_0x5544e0[_0x621668]['id'];_0x52b247=!![];}}if(_0x52b247){logger[_0x4fcf('0xc')](_0x4fcf('0x13'),_0x55c2a9[_0x4fcf('0x12')]);_0x54dfc4(_0x55c2a9);}else{_0x5a5abc({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5a5abc({'statusCode':0x194,'message':_0x4fcf('0x14')});}})[_0x4fcf('0x15')](function(_0x49cc13){logger[_0x4fcf('0x16')]('['+[_0x55ff5f[_0x4fcf('0x17')]()]+']',_0x49cc13[_0x4fcf('0x18')]);_0x5a5abc(_0x49cc13);});});}function getUser(_0x5e8a22,_0x19291c,_0x282b45){return function(_0x245fc1){return new Promise(function(_0x46a107,_0x1c2a01){var _0x477c7f={'method':'GET','uri':_0x282b45+_0x4fcf('0xa'),'json':!![]};_0x477c7f[_0x4fcf('0xb')]=_0x19291c;logger[_0x4fcf('0xc')](_0x4fcf('0x19'));return rp(_0x477c7f)['then'](function(_0x3ee821){if(_0x3ee821){var _0x23f098=_0x3ee821['users'];var _0x5ac253=![];var _0x4fc9fe=null;if(_0x245fc1[_0x4fcf('0x1a')]!==null){logger[_0x4fcf('0xc')]('Getting\x20user\x20with\x20email',_0x245fc1[_0x4fcf('0x1a')]);_0x245fc1[_0x4fcf('0x1b')]=_0x245fc1['agentEmail'];for(_0x4fc9fe=0x0;_0x4fc9fe<_0x23f098['length'];_0x4fc9fe++){if(_0x23f098[_0x4fc9fe][_0x4fcf('0x10')]===_0x245fc1[_0x4fcf('0x1a')]){_0x5ac253=!![];_0x245fc1[_0x4fcf('0x1c')]=_0x23f098[_0x4fc9fe]['id'];logger[_0x4fcf('0xc')]('User\x20found:',_0x245fc1[_0x4fcf('0x1c')]);}}}if(!_0x5ac253){logger[_0x4fcf('0xc')](_0x4fcf('0x1d'));_0x245fc1[_0x4fcf('0x1b')]=_0x245fc1[_0x4fcf('0x11')];_0x245fc1[_0x4fcf('0x1c')]=_0x245fc1[_0x4fcf('0x12')];_0x5ac253=!![];}if(_0x5ac253){_0x46a107(_0x245fc1);}else{_0x1c2a01({'statusCode':0x194,'message':_0x4fcf('0x14')});}}else{_0x1c2a01({'statusCode':0x194,'message':_0x4fcf('0x14')});}})[_0x4fcf('0x15')](function(_0x397bdf){logger['error']('['+[_0x5e8a22['toUpperCase']()]+']',_0x397bdf[_0x4fcf('0x18')]);_0x1c2a01(_0x397bdf);});});};}function searchContact(_0x13eb26,_0x4afe3a,_0x16b9a5,_0x15e157){return new Promise(function(_0x486284,_0x13be46){var _0x2d59d0={'method':_0x4fcf('0x1e'),'headers':_0x4afe3a,'uri':_0x13eb26+_0x4fcf('0x1f')+_0x15e157+_0x4fcf('0x20')+_0x16b9a5+_0x4fcf('0x21'),'json':!![]};rp(_0x2d59d0)[_0x4fcf('0xe')](function(_0x108925){var _0x27fe11=_[_0x4fcf('0x22')](_0x108925[_0x4fcf('0x23')][_0x4fcf('0x23')],[_0x16b9a5,_0x15e157]);_0x486284(_0x27fe11);})[_0x4fcf('0x15')](function(_0xb61838){_0x13be46(_0xb61838);});});}function getEndUser(_0x5280d1,_0x54ab44,_0x41a1af){return function(_0x433a30){return new Promise(function(_0x5a68cb,_0x2ce50a){logger[_0x4fcf('0xc')](util['format'](_0x4fcf('0x24'),_0x433a30[_0x4fcf('0x25')]));searchContact(_0x41a1af,_0x54ab44,'mobile_number',_0x433a30[_0x4fcf('0x25')])['then'](function(_0x5724b6){if(_0x5724b6){_0x433a30[_0x4fcf('0x26')]=_0x5724b6['id'];logger[_0x4fcf('0xc')](_0x4fcf('0x27'),_0x433a30[_0x4fcf('0x26')]);return _0x5a68cb(_0x433a30);}searchContact(_0x41a1af,_0x54ab44,_0x4fcf('0x28'),_0x433a30['contactNumber'])[_0x4fcf('0xe')](function(_0x4c8b64){if(_0x4c8b64){_0x433a30[_0x4fcf('0x26')]=_0x4c8b64['id'];logger[_0x4fcf('0xc')]('Contact\x20found\x20work_number:',_0x433a30['endUserId']);return _0x5a68cb(_0x433a30);}createEndUser(_0x433a30,_0x5280d1,_0x54ab44,_0x41a1af)['then'](function(_0x31d02f){logger[_0x4fcf('0xc')](_0x4fcf('0x29'),_0x31d02f[_0x4fcf('0x26')]);return _0x5a68cb(_0x31d02f);});});})[_0x4fcf('0x15')](function(_0x10e337){_0x2ce50a(_0x10e337);});});};}function createEndUser(_0x3b53d5,_0x170f21,_0x29bedd,_0x2d3aa7){return new Promise(function(_0x12e3ce,_0x33d6d5){var _0x4c6a29=moment();var _0x18638d={'method':_0x4fcf('0x2a'),'uri':_0x2d3aa7+_0x4fcf('0x2b'),'body':{'contact':{'last_name':_0x3b53d5[_0x4fcf('0x25')],'work_number':_0x3b53d5['contactNumber'],'mobile_number':_0x3b53d5[_0x4fcf('0x25')],'owner_id':_0x3b53d5['userId'],'created_at':_0x4c6a29[_0x4fcf('0x2c')](_0x4fcf('0x2d'))}},'json':!![]};_0x18638d['headers']=_0x29bedd;logger[_0x4fcf('0xc')](_0x4fcf('0x2e'));return rp(_0x18638d)[_0x4fcf('0xe')](function(_0x43b39d){_0x3b53d5[_0x4fcf('0x26')]=_0x43b39d[_0x4fcf('0x2f')]['id'];_0x12e3ce(_0x3b53d5);})['catch'](function(_0x5f4269){logger[_0x4fcf('0x16')]('['+[_0x170f21[_0x4fcf('0x17')]()]+']',_0x5f4269[_0x4fcf('0x18')]);_0x33d6d5(_0x5f4269[_0x4fcf('0x18')]);});});}function getTicket(_0x198a9a,_0x22d414,_0x4061ee,_0x4258bc,_0x30b411){return function(_0x269ac1){logger[_0x4fcf('0xc')](_0x4fcf('0x30'));return new Promise(function(_0x41cb28,_0x2f1496){var _0x4ba7ab=moment();var _0x28d977={'method':'POST','uri':_0x4061ee+'/api/tasks','body':{'title':intUtil['getString'](_0x4258bc[_0x4fcf('0x31')],_0x30b411,'\x20'),'description':intUtil['getString'](_0x4258bc['Descriptions'],_0x30b411,'\x0a'),'owner_id':_0x269ac1[_0x4fcf('0x1c')],'creater_id':_0x269ac1['adminId'],'targetable_id':_0x269ac1[_0x4fcf('0x26')],'targetable_type':'Contact','created_at':_0x4ba7ab['format'](_0x4fcf('0x2d')),'due_date':_0x4ba7ab[_0x4fcf('0x32')](0x1e,'m')[_0x4fcf('0x2c')](_0x4fcf('0x2d'))},'json':!![]};_0x28d977[_0x4fcf('0xb')]=_0x22d414;return rp(_0x28d977)[_0x4fcf('0xe')](function(_0x193fc8){_0x269ac1['ticketId']=_0x193fc8[_0x4fcf('0x33')]['id'];logger['info'](_0x4fcf('0x34'),_0x269ac1[_0x4fcf('0x35')]);_0x41cb28(_0x269ac1);})['catch'](function(_0x4e81c1){logger[_0x4fcf('0x16')]('['+[_0x198a9a[_0x4fcf('0x17')]()]+']',_0x4e81c1[_0x4fcf('0x18')]);_0x2f1496(_0x4e81c1[_0x4fcf('0x18')]);});});};}function emit(_0x337f46,_0x116db0,_0x2829aa){var _0x223941={'uri':_0x337f46+_0x4fcf('0x36')+_0x2829aa};io['to'](util[_0x4fcf('0x2c')]('user:%s',_0x116db0))['emit']('trigger:browser:url',_0x223941);}exports['cs']=function(_0x5d71b1,_0x4dc708,_0x479031,_0x39ba24,_0x5e9f66,_0x553d23,_0x297469,_0x32bd9c){var _0xed1b4a={};var _0x49d35d={'Authorization':_0x4fcf('0x37')+_0x553d23['apiKey']};_0x553d23[_0x4fcf('0x38')]=intUtil[_0x4fcf('0x39')](_0x553d23[_0x4fcf('0x38')]);_0x553d23['serverUrl']=intUtil[_0x4fcf('0x39')](_0x553d23[_0x4fcf('0x3a')]);var _0x4f4d2a=_0x553d23[_0x4fcf('0x38')];_0xed1b4a[_0x4fcf('0x11')]=_0x553d23[_0x4fcf('0x3b')];_0xed1b4a[_0x4fcf('0x25')]=_0x32bd9c['toLowerCase']()==='outbound'?_0x4dc708[_0x4fcf('0x3c')]:_0x4dc708['calleridnum'];_0xed1b4a['callDirection']=_0x32bd9c===_0x4fcf('0x3d')||_0x32bd9c===_0x4fcf('0x3e')?_0x4fcf('0x3d'):_0x4fcf('0x3f');if(_0x39ba24){_0xed1b4a['agentEmail']=_0x39ba24[_0x4fcf('0x10')];}var _0x48ce45=util[_0x4fcf('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x553d23['serverUrl'],_0x4dc708['uniqueid'],md5(_0x4dc708[_0x4fcf('0x40')]));if(_0x5e9f66&&_0x5e9f66[_0x4fcf('0x41')]){logger[_0x4fcf('0xc')](_0x4fcf('0x42'),'Recording\x20is\x20enabled!');_0x4dc708[_0x4fcf('0x43')]=_0x48ce45;}else if(_0x297469&&_0x297469[_0x4fcf('0x44')]&&_0x297469[_0x4fcf('0x44')]!==_0x4fcf('0x45')){logger['info'](_0x4fcf('0x46'),_0x4fcf('0x47'));_0x4dc708[_0x4fcf('0x43')]=_0x48ce45;}else{_0x4dc708[_0x4fcf('0x43')]='';}return getAdminId(_0xed1b4a,_0x32bd9c,_0x49d35d,_0x4f4d2a)[_0x4fcf('0xe')](getUser(_0x32bd9c,_0x49d35d,_0x4f4d2a))[_0x4fcf('0xe')](getEndUser(_0x32bd9c,_0x49d35d,_0x4f4d2a))[_0x4fcf('0xe')](getTicket(_0x32bd9c,_0x49d35d,_0x4f4d2a,_0x479031,_0x4dc708))['then'](function(_0x398598){logger[_0x4fcf('0xc')](util[_0x4fcf('0x2c')]('The\x20ticket\x20ID\x20is:\x20%s',_0x398598['ticketId']));if(_0x32bd9c!==_0x4fcf('0x3e')){logger[_0x4fcf('0xc')]('['+[_0x32bd9c[_0x4fcf('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4f4d2a,_0x39ba24[_0x4fcf('0x48')],_0x398598[_0x4fcf('0x26')]);}})['catch'](function(_0x34a819){logger[_0x4fcf('0x16')]('['+[_0x32bd9c[_0x4fcf('0x17')]()]+_0x4fcf('0x49'),util['inspect'](_0x34a819,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9482=['/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail'];(function(_0x5be791,_0x94dd5a){var _0x2ea8b8=function(_0x4423c0){while(--_0x4423c0){_0x5be791['push'](_0x5be791['shift']());}};_0x2ea8b8(++_0x94dd5a);}(_0x9482,0x130));var _0x2948=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9482[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x2948('0x0'));var rp=require(_0x2948('0x1'));var md5=require(_0x2948('0x2'));var util=require(_0x2948('0x3'));var moment=require(_0x2948('0x4'));var Promise=require(_0x2948('0x5'));var Redis=require('ioredis');var intUtil=require(_0x2948('0x6'));var config=require(_0x2948('0x7'));var logger=require('../../../../config/logger')('freshsales');config['redis']=_[_0x2948('0x8')](config[_0x2948('0x9')],{'host':_0x2948('0xa'),'port':0x18eb});var io=require(_0x2948('0xb'))(new Redis(config['redis']));function getAdminId(_0x5ba5b7,_0x1c4d2a,_0x55099e,_0x29d595){return new Promise(function(_0x339f54,_0x1c8096){var _0x44fc18=![];var _0x3a304f={'method':_0x2948('0xc'),'uri':_0x29d595+_0x2948('0xd'),'json':!![]};_0x3a304f[_0x2948('0xe')]=_0x55099e;logger[_0x2948('0xf')](_0x2948('0x10'));return rp(_0x3a304f)[_0x2948('0x11')](function(_0x51bfd2){if(_0x51bfd2){var _0x459ecf=_0x51bfd2[_0x2948('0x12')];var _0x2ce82c=null;for(_0x2ce82c=0x0;_0x2ce82c<_0x459ecf[_0x2948('0x13')];_0x2ce82c++){if(_0x459ecf[_0x2ce82c][_0x2948('0x14')]===_0x5ba5b7['adminEmail']){_0x5ba5b7[_0x2948('0x15')]=_0x459ecf[_0x2ce82c]['id'];_0x44fc18=!![];}}if(_0x44fc18){logger['info'](_0x2948('0x16'),_0x5ba5b7[_0x2948('0x15')]);_0x339f54(_0x5ba5b7);}else{_0x1c8096({'statusCode':0x194,'message':_0x2948('0x17')});}}else{_0x1c8096({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x2948('0x18')](function(_0x31fc3c){logger[_0x2948('0x19')]('['+[_0x1c4d2a[_0x2948('0x1a')]()]+']',_0x31fc3c[_0x2948('0x1b')]);_0x1c8096(_0x31fc3c);});});}function getUser(_0xf11f26,_0x9bad34,_0x4562d1){return function(_0x4c4b8f){return new Promise(function(_0xbaa345,_0xfbd94){var _0x37585c={'method':_0x2948('0xc'),'uri':_0x4562d1+_0x2948('0xd'),'json':!![]};_0x37585c[_0x2948('0xe')]=_0x9bad34;logger[_0x2948('0xf')](_0x2948('0x1c'));return rp(_0x37585c)[_0x2948('0x11')](function(_0x3ca9c0){if(_0x3ca9c0){var _0x24714c=_0x3ca9c0[_0x2948('0x12')];var _0x486105=![];var _0x308343=null;if(_0x4c4b8f[_0x2948('0x1d')]!==null){logger[_0x2948('0xf')](_0x2948('0x1e'),_0x4c4b8f[_0x2948('0x1d')]);_0x4c4b8f[_0x2948('0x1f')]=_0x4c4b8f[_0x2948('0x1d')];for(_0x308343=0x0;_0x308343<_0x24714c[_0x2948('0x13')];_0x308343++){if(_0x24714c[_0x308343]['email']===_0x4c4b8f[_0x2948('0x1d')]){_0x486105=!![];_0x4c4b8f[_0x2948('0x20')]=_0x24714c[_0x308343]['id'];logger[_0x2948('0xf')](_0x2948('0x21'),_0x4c4b8f['userId']);}}}if(!_0x486105){logger[_0x2948('0xf')](_0x2948('0x22'));_0x4c4b8f[_0x2948('0x1f')]=_0x4c4b8f[_0x2948('0x23')];_0x4c4b8f[_0x2948('0x20')]=_0x4c4b8f[_0x2948('0x15')];_0x486105=!![];}if(_0x486105){_0xbaa345(_0x4c4b8f);}else{_0xfbd94({'statusCode':0x194,'message':_0x2948('0x17')});}}else{_0xfbd94({'statusCode':0x194,'message':_0x2948('0x17')});}})[_0x2948('0x18')](function(_0x12a0be){logger['error']('['+[_0xf11f26['toUpperCase']()]+']',_0x12a0be[_0x2948('0x1b')]);_0xfbd94(_0x12a0be);});});};}function searchContact(_0x2afa22,_0x5f3fa6,_0x200319,_0x509cdf){return new Promise(function(_0x5643da,_0xfe96fd){var _0x140735={'method':_0x2948('0xc'),'headers':_0x5f3fa6,'uri':_0x2afa22+_0x2948('0x24')+_0x509cdf+'&f='+_0x200319+_0x2948('0x25'),'json':!![]};rp(_0x140735)[_0x2948('0x11')](function(_0x211a34){var _0x4fca6e=_[_0x2948('0x26')](_0x211a34[_0x2948('0x27')][_0x2948('0x27')],[_0x200319,_0x509cdf]);_0x5643da(_0x4fca6e);})['catch'](function(_0x1d803d){_0xfe96fd(_0x1d803d);});});}function getEndUser(_0x3a16bc,_0x1113bb,_0x36accb){return function(_0x295a4b){return new Promise(function(_0x5062d9,_0x1b32e4){logger[_0x2948('0xf')](util[_0x2948('0x28')](_0x2948('0x29'),_0x295a4b[_0x2948('0x2a')]));searchContact(_0x36accb,_0x1113bb,_0x2948('0x2b'),_0x295a4b[_0x2948('0x2a')])[_0x2948('0x11')](function(_0xa0d904){if(_0xa0d904){_0x295a4b[_0x2948('0x2c')]=_0xa0d904['id'];logger['info'](_0x2948('0x2d'),_0x295a4b[_0x2948('0x2c')]);return _0x5062d9(_0x295a4b);}searchContact(_0x36accb,_0x1113bb,_0x2948('0x2e'),_0x295a4b['contactNumber'])[_0x2948('0x11')](function(_0x17ad15){if(_0x17ad15){_0x295a4b[_0x2948('0x2c')]=_0x17ad15['id'];logger[_0x2948('0xf')](_0x2948('0x2f'),_0x295a4b[_0x2948('0x2c')]);return _0x5062d9(_0x295a4b);}createEndUser(_0x295a4b,_0x3a16bc,_0x1113bb,_0x36accb)[_0x2948('0x11')](function(_0x3a064e){logger[_0x2948('0xf')]('Contact\x20created:',_0x3a064e[_0x2948('0x2c')]);return _0x5062d9(_0x3a064e);});});})[_0x2948('0x18')](function(_0x1cde46){_0x1b32e4(_0x1cde46);});});};}function createEndUser(_0x205e58,_0x4fb083,_0x5c3887,_0x14ad3a){return new Promise(function(_0x51b8b8,_0x5fe66d){var _0xf96b5d=moment();var _0x35c183={'method':_0x2948('0x30'),'uri':_0x14ad3a+_0x2948('0x31'),'body':{'contact':{'last_name':_0x205e58[_0x2948('0x2a')],'work_number':_0x205e58[_0x2948('0x2a')],'mobile_number':_0x205e58[_0x2948('0x2a')],'owner_id':_0x205e58['userId'],'created_at':_0xf96b5d[_0x2948('0x28')](_0x2948('0x32'))}},'json':!![]};_0x35c183[_0x2948('0xe')]=_0x5c3887;logger[_0x2948('0xf')](_0x2948('0x33'));return rp(_0x35c183)['then'](function(_0x15a61d){_0x205e58[_0x2948('0x2c')]=_0x15a61d['contact']['id'];_0x51b8b8(_0x205e58);})['catch'](function(_0x5a14af){logger[_0x2948('0x19')]('['+[_0x4fb083['toUpperCase']()]+']',_0x5a14af[_0x2948('0x1b')]);_0x5fe66d(_0x5a14af[_0x2948('0x1b')]);});});}function getTicket(_0x52391d,_0xc91d90,_0x3b0a1e,_0xd43f7b,_0x4720b4){return function(_0x3e3b0a){logger[_0x2948('0xf')](_0x2948('0x34'));return new Promise(function(_0x275149,_0x4bf265){var _0x4c20f6=moment();var _0x1b0a5d={'method':_0x2948('0x30'),'uri':_0x3b0a1e+_0x2948('0x35'),'body':{'title':intUtil[_0x2948('0x36')](_0xd43f7b[_0x2948('0x37')],_0x4720b4,'\x20'),'description':intUtil[_0x2948('0x36')](_0xd43f7b['Descriptions'],_0x4720b4,'\x0a'),'owner_id':_0x3e3b0a[_0x2948('0x20')],'creater_id':_0x3e3b0a[_0x2948('0x15')],'targetable_id':_0x3e3b0a[_0x2948('0x2c')],'targetable_type':_0x2948('0x38'),'created_at':_0x4c20f6['format'](_0x2948('0x32')),'due_date':_0x4c20f6[_0x2948('0x39')](0x1e,'m')[_0x2948('0x28')](_0x2948('0x32'))},'json':!![]};_0x1b0a5d[_0x2948('0xe')]=_0xc91d90;return rp(_0x1b0a5d)[_0x2948('0x11')](function(_0x5ead83){_0x3e3b0a[_0x2948('0x3a')]=_0x5ead83[_0x2948('0x3b')]['id'];logger[_0x2948('0xf')](_0x2948('0x3c'),_0x3e3b0a[_0x2948('0x3a')]);_0x275149(_0x3e3b0a);})[_0x2948('0x18')](function(_0x10a00b){logger['error']('['+[_0x52391d[_0x2948('0x1a')]()]+']',_0x10a00b[_0x2948('0x1b')]);_0x4bf265(_0x10a00b['message']);});});};}function emit(_0x44ddca,_0x4c48da,_0x591c73){var _0x1e9650={'uri':_0x44ddca+_0x2948('0x3d')+_0x591c73};io['to'](util[_0x2948('0x28')]('user:%s',_0x4c48da))[_0x2948('0x3e')](_0x2948('0x3f'),_0x1e9650);}exports['cs']=function(_0x25e45e,_0x26a3f2,_0x5deb20,_0x516028,_0x7a5ffe,_0x17d9ba,_0x492c1e,_0x3ec327){var _0x179b3a={};var _0x2e622f={'Authorization':_0x2948('0x40')+_0x17d9ba[_0x2948('0x41')]};_0x17d9ba[_0x2948('0x42')]=intUtil[_0x2948('0x43')](_0x17d9ba[_0x2948('0x42')]);_0x17d9ba['serverUrl']=intUtil[_0x2948('0x43')](_0x17d9ba[_0x2948('0x44')]);var _0x2132d3=_0x17d9ba[_0x2948('0x42')];_0x179b3a[_0x2948('0x23')]=_0x17d9ba[_0x2948('0x45')];_0x179b3a[_0x2948('0x2a')]=_0x3ec327[_0x2948('0x46')]()===_0x2948('0x47')?_0x26a3f2['destcalleridnum']:_0x26a3f2['calleridnum'];_0x179b3a[_0x2948('0x48')]=_0x3ec327==='queue'||_0x3ec327===_0x2948('0x49')?'queue':_0x2948('0x47');if(_0x516028){_0x179b3a[_0x2948('0x1d')]=_0x516028['email'];}var _0x54e608=util[_0x2948('0x28')](_0x2948('0x4a'),_0x17d9ba[_0x2948('0x44')],_0x26a3f2[_0x2948('0x4b')],md5(_0x26a3f2[_0x2948('0x4b')]));if(_0x7a5ffe&&_0x7a5ffe[_0x2948('0x4c')]){logger[_0x2948('0xf')](_0x2948('0x4d'),'Recording\x20is\x20enabled!');_0x26a3f2[_0x2948('0x4e')]=_0x54e608;}else if(_0x492c1e&&_0x492c1e[_0x2948('0x4f')]&&_0x492c1e['recordingFormat']!==_0x2948('0x50')){logger[_0x2948('0xf')]('[OUTBOUND]',_0x2948('0x51'));_0x26a3f2[_0x2948('0x4e')]=_0x54e608;}else{_0x26a3f2[_0x2948('0x4e')]='';}return getAdminId(_0x179b3a,_0x3ec327,_0x2e622f,_0x2132d3)[_0x2948('0x11')](getUser(_0x3ec327,_0x2e622f,_0x2132d3))[_0x2948('0x11')](getEndUser(_0x3ec327,_0x2e622f,_0x2132d3))[_0x2948('0x11')](getTicket(_0x3ec327,_0x2e622f,_0x2132d3,_0x5deb20,_0x26a3f2))['then'](function(_0x309c27){logger['info'](util[_0x2948('0x28')]('The\x20ticket\x20ID\x20is:\x20%s',_0x309c27[_0x2948('0x3a')]));if(_0x3ec327!==_0x2948('0x49')){logger[_0x2948('0xf')]('['+[_0x3ec327[_0x2948('0x1a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2132d3,_0x516028[_0x2948('0x52')],_0x309c27[_0x2948('0x2c')]);}})[_0x2948('0x18')](function(_0x536bae){logger[_0x2948('0x19')]('['+[_0x3ec327[_0x2948('0x1a')]()]+_0x2948('0x53'),util[_0x2948('0x54')](_0x536bae,{'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 a918141..25cb0d2 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 _0xee83=['log','unmanaged','sugarcrm','vtiger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound'];(function(_0x1e54a7,_0x4e7ea3){var _0x41d78e=function(_0xbf0801){while(--_0xbf0801){_0x1e54a7['push'](_0x1e54a7['shift']());}};_0x41d78e(++_0x4e7ea3);}(_0xee83,0x1a0));var _0x3ee8=function(_0x10975d,_0x39c1fd){_0x10975d=_0x10975d-0x0;var _0xeeff43=_0xee83[_0x10975d];return _0xeeff43;};'use strict';var _=require(_0x3ee8('0x0'));var util=require(_0x3ee8('0x1'));var zendesk=require(_0x3ee8('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x3ee8('0x3'));var zoho=require(_0x3ee8('0x4'));var desk=require(_0x3ee8('0x5'));var vtiger=require(_0x3ee8('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x3ee8('0x7'));var freshsales=require(_0x3ee8('0x8'));var integrations=[_0x3ee8('0x9'),_0x3ee8('0xa'),'sugarcrm',_0x3ee8('0xb'),_0x3ee8('0xc'),_0x3ee8('0xd'),'vtiger',_0x3ee8('0xe'),_0x3ee8('0xf'),_0x3ee8('0x10')];exports[_0x3ee8('0x11')]=function(_0x13970c,_0x1c2e65,_0x1d02a6,_0x40465f,_0x596b77,_0x2a13af){if(_0x1d02a6){if(_[_0x3ee8('0x12')](integrations,_0x13970c[_0x3ee8('0x13')][_0x3ee8('0x14')]())){try{var _0x48794d=null;var _0x1ac6a7='';var _0x13d934=_0x1d02a6[_0x13970c[_0x3ee8('0x13')]['toLowerCase']()];if(_0x13d934){var _0x35260b=_0x13d934[_0x13970c[_0x3ee8('0x15')]];if(_0x35260b){var _0x399679=_[_0x3ee8('0x16')](_0x35260b[_0x3ee8('0x17')],{'id':parseInt(_0x13970c[_0x3ee8('0x18')],0xa)});if(_0x399679){if(_0x40465f){if(_0x596b77&&_0x1c2e65[_0x3ee8('0x19')]){_0x1ac6a7=_0x3ee8('0x19');}else if(_0x1c2e65[_0x3ee8('0x1a')]){_0x1ac6a7=_0x3ee8('0x1b');}else{console[_0x3ee8('0x1c')]('EVENT\x20UNKNOWN',_0x1c2e65);}}else{_0x1ac6a7=_0x3ee8('0x1d');}switch(_0x13970c['data1']['toLowerCase']()){case _0x3ee8('0x9'):zendesk[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0xa'):salesforce[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0x1e'):sugarcrm[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0xb'):freshdesk[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0xc'):zoho[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0xd'):desk[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0x1f'):vtiger[_0x1ac6a7](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af);break;case _0x3ee8('0xf'):freshsales['cs'](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af,_0x1ac6a7);break;case _0x3ee8('0x10'):servicenow['cs'](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af,_0x1ac6a7);break;case _0x3ee8('0xe'):dynamics365['cs'](_0x13970c,_0x1c2e65,_0x399679,_0x40465f,_0x596b77,_0x35260b,_0x2a13af,_0x1ac6a7);break;default:console['log']('unknown\x20integration');}}else{_0x48794d=require('../../../../config/logger')(_0x13970c[_0x3ee8('0x13')][_0x3ee8('0x14')]());_0x48794d[_0x3ee8('0x20')](_0x3ee8('0x21'),util[_0x3ee8('0x22')](_0x3ee8('0x23'),_0x13970c[_0x3ee8('0x13')]['toLowerCase'](),_0x13970c[_0x3ee8('0x18')]));}}else{_0x48794d=require('../../../../config/logger')(_0x13970c['data1'][_0x3ee8('0x14')]());_0x48794d[_0x3ee8('0x20')](_0x3ee8('0x21'),util[_0x3ee8('0x22')](_0x3ee8('0x24'),_0x13970c['data1'][_0x3ee8('0x14')](),_0x13970c[_0x3ee8('0x15')]));}}else{}}catch(_0x12ca4a){console[_0x3ee8('0x20')](_0x12ca4a);}}}}; \ No newline at end of file +var _0x629c=['./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','salesforce','zoho','log','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger'];(function(_0x304fe0,_0x430c48){var _0x1649f8=function(_0x33a894){while(--_0x33a894){_0x304fe0['push'](_0x304fe0['shift']());}};_0x1649f8(++_0x430c48);}(_0x629c,0x1b0));var _0xc629=function(_0x375061,_0x27025){_0x375061=_0x375061-0x0;var _0x19fbfd=_0x629c[_0x375061];return _0x19fbfd;};'use strict';var _=require(_0xc629('0x0'));var util=require(_0xc629('0x1'));var zendesk=require(_0xc629('0x2'));var salesforce=require(_0xc629('0x3'));var sugarcrm=require(_0xc629('0x4'));var freshdesk=require(_0xc629('0x5'));var zoho=require('./zoho');var desk=require(_0xc629('0x6'));var vtiger=require(_0xc629('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0xc629('0x8'));var freshsales=require(_0xc629('0x9'));var integrations=[_0xc629('0xa'),'salesforce',_0xc629('0xb'),_0xc629('0xc'),'zoho',_0xc629('0xd'),_0xc629('0xe'),_0xc629('0xf'),_0xc629('0x10'),_0xc629('0x11')];exports['exec']=function(_0x438ad2,_0x3455e9,_0xc954be,_0xa22cf,_0x237a93,_0x1a7343){if(_0xc954be){if(_[_0xc629('0x12')](integrations,_0x438ad2[_0xc629('0x13')]['toLowerCase']())){try{var _0x4436f1=null;var _0x29d858='';var _0x7464eb=_0xc954be[_0x438ad2[_0xc629('0x13')][_0xc629('0x14')]()];if(_0x7464eb){var _0x2ea7d7=_0x7464eb[_0x438ad2[_0xc629('0x15')]];if(_0x2ea7d7){var _0x571ae1=_[_0xc629('0x16')](_0x2ea7d7[_0xc629('0x17')],{'id':parseInt(_0x438ad2[_0xc629('0x18')],0xa)});if(_0x571ae1){if(_0xa22cf){if(_0x237a93&&_0x3455e9['queue']){_0x29d858=_0xc629('0x19');}else if(_0x3455e9[_0xc629('0x1a')]){_0x29d858=_0xc629('0x1b');}else{console['log'](_0xc629('0x1c'),_0x3455e9);}}else{_0x29d858=_0xc629('0x1d');}switch(_0x438ad2[_0xc629('0x13')]['toLowerCase']()){case _0xc629('0xa'):zendesk[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case _0xc629('0x1e'):salesforce[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case _0xc629('0xb'):sugarcrm[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case _0xc629('0xc'):freshdesk[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case _0xc629('0x1f'):zoho[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case'desk':desk[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case'vtiger':vtiger[_0x29d858](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343);break;case _0xc629('0x10'):freshsales['cs'](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343,_0x29d858);break;case _0xc629('0x11'):servicenow['cs'](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343,_0x29d858);break;case _0xc629('0xf'):dynamics365['cs'](_0x438ad2,_0x3455e9,_0x571ae1,_0xa22cf,_0x237a93,_0x2ea7d7,_0x1a7343,_0x29d858);break;default:console[_0xc629('0x20')](_0xc629('0x21'));}}else{_0x4436f1=require(_0xc629('0x22'))(_0x438ad2[_0xc629('0x13')][_0xc629('0x14')]());_0x4436f1[_0xc629('0x23')]('[EXEC]',util[_0xc629('0x24')](_0xc629('0x25'),_0x438ad2[_0xc629('0x13')][_0xc629('0x14')](),_0x438ad2[_0xc629('0x18')]));}}else{_0x4436f1=require('../../../../config/logger')(_0x438ad2[_0xc629('0x13')][_0xc629('0x14')]());_0x4436f1['error'](_0xc629('0x26'),util[_0xc629('0x24')](_0xc629('0x27'),_0x438ad2[_0xc629('0x13')][_0xc629('0x14')](),_0x438ad2[_0xc629('0x15')]));}}else{}}catch(_0x539c03){console[_0xc629('0x23')](_0x539c03);}}}}; \ 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 e5b70be..f930981 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 _0xf5a8=['error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','Caller\x20-\x20%s','Company','No\x20Company','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','upperFirst','forEach','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url'];(function(_0x4e7e86,_0x36d8a3){var _0x41cd06=function(_0x4186e4){while(--_0x4186e4){_0x4e7e86['push'](_0x4e7e86['shift']());}};_0x41cd06(++_0x36d8a3);}(_0xf5a8,0x8d));var _0x8f5a=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0xf5a8[_0x5180c3];return _0x55c975;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x8f5a('0x0'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x8f5a('0x1'));var intUtil=require('./util');var config=require(_0x8f5a('0x2'));var logger=require('../../../../config/logger')(_0x8f5a('0x3'));config[_0x8f5a('0x4')]=_[_0x8f5a('0x5')](config[_0x8f5a('0x4')],{'host':_0x8f5a('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8f5a('0x4')]));function emit(_0x152295,_0x2a925d,_0x2e8cf8){io['to'](_0x152295)['emit'](_0x2a925d,_0x2e8cf8);}function getTicket(_0x1523e1,_0x11b2df,_0x3da6c8,_0x561a3e,_0x111017,_0x4813d4,_0x4b45e8,_0x520df2){var _0x1eeb83=Object['assign']({},{'OwnerId':_0x11b2df['id'],'Subject':intUtil['getString'](_0x561a3e[_0x8f5a('0x7')],_0x111017,'\x20'),'Description':intUtil['getString'](_0x561a3e[_0x8f5a('0x8')],_0x111017,'\x0a')},getCustomFields(_0x4813d4,_0x111017));if(_0x3da6c8){if(_0x561a3e[_0x8f5a('0x9')]==='Task'){_0x1eeb83[_0x8f5a('0xa')]=moment[_0x8f5a('0xb')]();_0x1eeb83[_0x8f5a('0xc')]=![];_0x1eeb83[_0x8f5a('0xd')]=![];if(_0x3da6c8[_0x8f5a('0xe')]===_0x8f5a('0xf')||_0x3da6c8[_0x8f5a('0xe')]===_0x8f5a('0x10')){_0x1eeb83[_0x8f5a('0x11')]=_0x3da6c8['id'];}else if(_0x3da6c8[_0x8f5a('0xe')]===_0x8f5a('0x12')){_0x1eeb83[_0x8f5a('0x13')]=_0x3da6c8['id'];}}else if(_0x561a3e[_0x8f5a('0x9')]===_0x8f5a('0x14')){if(_0x3da6c8['endUserType']===_0x8f5a('0xf')){_0x1eeb83[_0x8f5a('0x15')]=_0x3da6c8['id'];}else if(_0x3da6c8[_0x8f5a('0xe')]==='account'){_0x1eeb83['AccountId']=_0x3da6c8['id'];}else if(_0x3da6c8[_0x8f5a('0xe')]==='lead'&&_0x561a3e[_0x8f5a('0x16')]){_0x1eeb83[_0x561a3e[_0x8f5a('0x16')]]=_0x3da6c8['id'];}else{logger[_0x8f5a('0x17')](_0x8f5a('0x18'));}}}return _0x4b45e8['sobject'](_0x561a3e[_0x8f5a('0x9')])[_0x8f5a('0x19')](_0x1eeb83);}function getUser(_0x44e0d4,_0x3bebcd,_0x2381b9){if(!_[_0x8f5a('0x1a')](_0x3bebcd)&&intUtil[_0x8f5a('0x1b')](_0x3bebcd)){var _0x356a45={'Email':_0x3bebcd};var _0x5c4b0b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2381b9['sobject']('User')[_0x8f5a('0x1c')](_0x356a45,_0x5c4b0b)[_0x8f5a('0x1d')]()[_0x8f5a('0x1e')](function(_0x2b5b78){if(_0x2b5b78[_0x8f5a('0x1f')]){var _0x48b5e6=_['find'](_0x2b5b78,function(_0xe053bd){return _0xe053bd[_0x8f5a('0x20')]===_0x3bebcd;});if(_0x48b5e6){logger[_0x8f5a('0x17')](_0x8f5a('0x21'),_0x3bebcd);return BPromise[_0x8f5a('0x22')]({'id':_0x48b5e6['Id'],'name':_0x48b5e6['Name']});}}else{logger[_0x8f5a('0x17')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3bebcd);return _0x2381b9[_0x8f5a('0x23')]()[_0x8f5a('0x1e')](function(_0x50207c){return BPromise[_0x8f5a('0x22')]({'id':_0x50207c[_0x8f5a('0x24')],'name':_0x50207c[_0x8f5a('0x25')]});});}});}else{logger[_0x8f5a('0x17')](_0x8f5a('0x26'),_0x3bebcd);return _0x2381b9[_0x8f5a('0x23')]()[_0x8f5a('0x1e')](function(_0x23ac15){return BPromise[_0x8f5a('0x22')]({'id':_0x23ac15[_0x8f5a('0x24')],'name':_0x23ac15[_0x8f5a('0x25')]});});}}function getEndUser(_0x25c9c,_0xaa6b5b,_0x16d4c0,_0x2833ae,_0x211065){var _0x15367d={'$or':{'Phone':_0x2833ae}};var _0x344726={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8f5a('0x22')]()[_0x8f5a('0x1e')](function(){logger[_0x8f5a('0x17')](_0x8f5a('0x27'),_0x2833ae,_0xaa6b5b[_0x8f5a('0x28')]);switch(_0xaa6b5b[_0x8f5a('0x28')]){case _0x8f5a('0x29'):var _0x1770f3=_[_0x8f5a('0x2a')](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x2b')]){var _0xb5ac23={};_0xb5ac23[_0xaa6b5b[_0x8f5a('0x2b')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x1770f3[_0x8f5a('0x2d')],_0xb5ac23);}return _0x211065[_0x8f5a('0x2e')](_0x8f5a('0x2f'))[_0x8f5a('0x1c')](_0x1770f3,_0x344726)[_0x8f5a('0x1d')]()[_0x8f5a('0x1e')](function(_0x1f495d){if(_0x1f495d&&_0x1f495d[_0x8f5a('0x1f')]){return _0x1f495d;}else{var _0x510836=_['cloneDeep'](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x30')]){var _0x4b1a8e={};_0x4b1a8e[_0xaa6b5b[_0x8f5a('0x30')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x510836['$or'],_0x4b1a8e);}return _0x211065[_0x8f5a('0x2e')](_0x8f5a('0x31'))[_0x8f5a('0x1c')](_0x510836,_0x344726);}});case _0x8f5a('0x32'):var _0x355671=_[_0x8f5a('0x2a')](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x33')]){var _0xb5ac23={};_0xb5ac23[_0xaa6b5b[_0x8f5a('0x33')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x355671[_0x8f5a('0x2d')],_0xb5ac23);}return _0x211065['sobject'](_0x8f5a('0x34'))[_0x8f5a('0x1c')](_0x355671,_0x344726)[_0x8f5a('0x1d')]()[_0x8f5a('0x1e')](function(_0x1c1d7c){if(_0x1c1d7c&&_0x1c1d7c[_0x8f5a('0x1f')]){return _0x1c1d7c;}else{var _0x1116c7=_[_0x8f5a('0x2a')](_0x15367d);if(_0xaa6b5b['additionalSearchContact']){var _0x53c5e2={};_0x53c5e2[_0xaa6b5b[_0x8f5a('0x2b')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x1116c7['$or'],_0x53c5e2);}return _0x211065[_0x8f5a('0x2e')](_0x8f5a('0x2f'))[_0x8f5a('0x1c')](_0x1116c7,_0x344726)[_0x8f5a('0x1e')](function(_0x2b7cf2){if(_0x2b7cf2&&_0x2b7cf2[_0x8f5a('0x1f')]){return _0x2b7cf2;}else{var _0x43deae=_['cloneDeep'](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x30')]){var _0x4dfa9d={};_0x4dfa9d[_0xaa6b5b[_0x8f5a('0x30')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x43deae[_0x8f5a('0x2d')],_0x4dfa9d);}return _0x211065[_0x8f5a('0x2e')]('Lead')[_0x8f5a('0x1c')](_0x43deae,_0x344726);}});}});case _0x8f5a('0xf'):var _0x1770f3=_['cloneDeep'](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x2b')]){var _0xb5ac23={};_0xb5ac23[_0xaa6b5b['additionalSearchContact']]=_0x2833ae;_[_0x8f5a('0x2c')](_0x1770f3[_0x8f5a('0x2d')],_0xb5ac23);}return _0x211065[_0x8f5a('0x2e')](_0x8f5a('0x2f'))[_0x8f5a('0x1c')](_0x1770f3,_0x344726)[_0x8f5a('0x1d')]();case'lead':var _0x1bd32f=_[_0x8f5a('0x2a')](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x30')]){var _0xb5ac23={};_0xb5ac23[_0xaa6b5b[_0x8f5a('0x30')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x1bd32f['$or'],_0xb5ac23);}return _0x211065[_0x8f5a('0x2e')](_0x8f5a('0x31'))[_0x8f5a('0x1c')](_0x1bd32f,_0x344726);case _0x8f5a('0x12'):var _0x355671=_['cloneDeep'](_0x15367d);if(_0xaa6b5b[_0x8f5a('0x33')]){var _0xb5ac23={};_0xb5ac23[_0xaa6b5b[_0x8f5a('0x33')]]=_0x2833ae;_[_0x8f5a('0x2c')](_0x355671[_0x8f5a('0x2d')],_0xb5ac23);}return _0x211065[_0x8f5a('0x2e')](_0x8f5a('0x34'))[_0x8f5a('0x1c')](_0x355671,_0x344726);default:return null;}})[_0x8f5a('0x1e')](function(_0x3210b5){if(_0x3210b5&&_0x3210b5[_0x8f5a('0x1f')]){var _0x254666=_[_0x8f5a('0x35')](_0x3210b5);if(_0x254666){return BPromise[_0x8f5a('0x22')]({'id':_0x254666['Id'],'name':_0x254666[_0x8f5a('0x36')],'phone':_0x254666['Phone'],'endUserType':_0x254666[_0x8f5a('0x37')]['type']['toLowerCase']()});}}})['then'](function(_0x2e7341){if(_0x2e7341){logger['info'](_0x8f5a('0x38'),_0x2e7341[_0x8f5a('0xe')],_0x2833ae);return BPromise['resolve'](_0x2e7341);}else{logger[_0x8f5a('0x17')](_0x8f5a('0x39'),_0x2833ae);var _0x373cb5={'Phone':_0x2833ae};if(_0xaa6b5b[_0x8f5a('0x3a')]){if(_0xaa6b5b[_0x8f5a('0x3a')]===_0x8f5a('0xf')){logger[_0x8f5a('0x17')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2833ae,_0xaa6b5b[_0x8f5a('0x3a')]);_0x373cb5[_0x8f5a('0x3b')]=_0x16d4c0!==_0x8f5a('0x3c')?_0x16d4c0:util['format'](_0x8f5a('0x3d'),_0x2833ae);}else if(_0xaa6b5b[_0x8f5a('0x3a')]===_0x8f5a('0x10')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2833ae,_0xaa6b5b[_0x8f5a('0x3a')]);_0x373cb5[_0x8f5a('0x3b')]=_0x16d4c0!==_0x8f5a('0x3c')?_0x16d4c0:util['format'](_0x8f5a('0x3d'),_0x2833ae);_0x373cb5[_0x8f5a('0x3e')]=_0x8f5a('0x3f');}else if(_0xaa6b5b[_0x8f5a('0x3a')]===_0x8f5a('0x12')){logger[_0x8f5a('0x17')](_0x8f5a('0x40'),_0x2833ae,_0xaa6b5b[_0x8f5a('0x3a')]);_0x373cb5[_0x8f5a('0x36')]=_0x16d4c0!==_0x8f5a('0x3c')?_0x16d4c0:util['format'](_0x8f5a('0x3d'),_0x2833ae);}else{return null;}}return _0x211065[_0x8f5a('0x2e')](_[_0x8f5a('0x41')](_0xaa6b5b[_0x8f5a('0x3a')]))['create'](_0x373cb5)[_0x8f5a('0x1e')](function(_0x415eb2){return BPromise['resolve']({'id':_0x415eb2['id'],'endUserType':_0xaa6b5b[_0x8f5a('0x3a')]});});}});}function getCustomFields(_0x4bd565,_0x5730f8){var _0x5777b9={};if(_0x4bd565[_0x8f5a('0x1f')]>0x0){_[_0x8f5a('0x42')](_0x4bd565,function(_0xac31fd){if(_['includes']([_0x8f5a('0x43'),_0x8f5a('0x44')],_0xac31fd[_0x8f5a('0x45')])&&_0xac31fd[_0x8f5a('0x46')]){_0x5777b9[_0xac31fd['idField']]=_0xac31fd[_0x8f5a('0x47')][_0x8f5a('0x48')]();}else if(_0xac31fd[_0x8f5a('0x45')]===_0x8f5a('0x49')&&_0xac31fd[_0x8f5a('0x4a')]&&_0xac31fd[_0x8f5a('0x46')]){_0x5730f8[_0xac31fd[_0x8f5a('0x4a')]]&&(_0x5777b9[_0xac31fd[_0x8f5a('0x46')]]=_0x5730f8[_0xac31fd[_0x8f5a('0x4a')]][_0x8f5a('0x48')]());}else if(_0xac31fd[_0x8f5a('0x45')]==='customVariable'&&_0xac31fd[_0x8f5a('0x4b')]&&_0xac31fd[_0x8f5a('0x4b')]['name']&&_0xac31fd[_0x8f5a('0x46')]){_0x5730f8[_0xac31fd[_0x8f5a('0x4b')][_0x8f5a('0x4c')][_0x8f5a('0x4d')]()]&&(_0x5777b9[_0xac31fd[_0x8f5a('0x46')]]=_0x5730f8[_0xac31fd['Variable']['name']['toLowerCase']()][_0x8f5a('0x48')]());}});}return _0x5777b9;}function getConnection(_0x2dd054){var _0x48ccea=_0x2dd054[_0x8f5a('0x4e')][_0x8f5a('0x4f')](_0x2dd054[_0x8f5a('0x50')]);var _0x4711b3=new jsforce[(_0x8f5a('0x51'))]({'oauth2':{'loginUrl':_0x2dd054[_0x8f5a('0x52')]||_0x8f5a('0x53'),'clientId':_0x2dd054[_0x8f5a('0x54')],'clientSecret':_0x2dd054[_0x8f5a('0x55')]}});return _0x4711b3[_0x8f5a('0x56')](_0x2dd054[_0x8f5a('0x57')],_0x48ccea)['then'](function(){logger['info'](_0x8f5a('0x58'));return _0x4711b3;});}exports[_0x8f5a('0x59')]=function(_0x2bf8ed,_0x3808d5,_0x2dee67,_0x4563a6,_0x125b41,_0x4616d8){var _0x51ce84,_0x74e8c,_0x2a2997,_0x15af8d;_0x4616d8[_0x8f5a('0x5a')]=intUtil[_0x8f5a('0x5b')](_0x4616d8[_0x8f5a('0x5a')]);_0x4616d8[_0x8f5a('0x52')]=intUtil[_0x8f5a('0x5b')](_0x4616d8['remoteUri']);if(_0x125b41&&_0x125b41[_0x8f5a('0x5c')]){logger['info']('[QUEUE]',_0x8f5a('0x5d'));_0x3808d5[_0x8f5a('0x5e')]=util[_0x8f5a('0x5f')](_0x8f5a('0x60'),_0x4616d8['serverUrl'],_0x3808d5[_0x8f5a('0x61')],md5(_0x3808d5['uniqueid']));}else{_0x3808d5[_0x8f5a('0x5e')]='';}return getConnection(_0x4616d8)[_0x8f5a('0x1e')](function(_0x394bac){_0x15af8d=_0x394bac;return getUser(_0x4616d8,_0x4563a6[_0x8f5a('0x62')],_0x15af8d);})['then'](function(_0x2c9f87){_0x51ce84=_0x2c9f87;return getEndUser(_0x4616d8,_0x2dee67,_0x3808d5['calleridname'],_0x3808d5[_0x8f5a('0x63')],_0x15af8d);})[_0x8f5a('0x1e')](function(_0x73b14d){_0x74e8c=_0x73b14d;return getTicket(_0x4616d8,_0x51ce84,_0x74e8c,_0x2dee67,_0x3808d5,_0x2dee67['Fields'],_0x15af8d,'queue');})[_0x8f5a('0x1e')](function(_0x321b38){_0x2a2997=_0x321b38;logger['info'](_0x8f5a('0x64'),_0x2a2997['id']);logger[_0x8f5a('0x17')](_0x8f5a('0x65'),_0x2a2997['id'],_0x4563a6[_0x8f5a('0x4c')],_0x4616d8[_0x8f5a('0x45')]);switch(_0x4616d8[_0x8f5a('0x45')]){case _0x8f5a('0x66'):emit(util[_0x8f5a('0x5f')](_0x8f5a('0x67'),_0x4563a6[_0x8f5a('0x4c')]),_0x8f5a('0x68'),{'recordId':_0x2a2997['id']});break;case _0x8f5a('0x69'):emit(util['format'](_0x8f5a('0x67'),_0x4563a6[_0x8f5a('0x4c')]),_0x8f5a('0x6a'),{'uri':util[_0x8f5a('0x5f')]('%s/%s/e',_0x15af8d['instanceUrl'],_0x2a2997['id'])});break;default:logger[_0x8f5a('0x6b')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2f4291){logger[_0x8f5a('0x6b')]('[QUEUE]',_0x2f4291);});};exports[_0x8f5a('0x6c')]=function(_0x1c1cc3,_0x1783d8,_0x3dfc98,_0x1b13e7,_0x39c825,_0x3030b2,_0x1b7d43){var _0x518277,_0x44e56a,_0x35fb03,_0x365c5a;_0x3030b2[_0x8f5a('0x5a')]=intUtil[_0x8f5a('0x5b')](_0x3030b2[_0x8f5a('0x5a')]);_0x3030b2[_0x8f5a('0x52')]=intUtil['stripTrailingSlash'](_0x3030b2[_0x8f5a('0x52')]);if(_0x1b7d43&&_0x1b7d43[_0x8f5a('0x6d')]&&_0x1b7d43['recordingFormat']!==_0x8f5a('0x6e')){logger[_0x8f5a('0x17')](_0x8f5a('0x6f'),_0x8f5a('0x5d'));_0x1783d8[_0x8f5a('0x5e')]=util[_0x8f5a('0x5f')](_0x8f5a('0x60'),_0x3030b2['serverUrl'],_0x1783d8[_0x8f5a('0x61')],md5(_0x1783d8['uniqueid']));}return getConnection(_0x3030b2)[_0x8f5a('0x1e')](function(_0x1aac8){_0x365c5a=_0x1aac8;return getUser(_0x3030b2,_0x1b13e7[_0x8f5a('0x62')],_0x365c5a);})[_0x8f5a('0x1e')](function(_0x3d8f5e){_0x518277=_0x3d8f5e;return getEndUser(_0x3030b2,_0x3dfc98,_0x1783d8['destcalleridname'],_0x1783d8[_0x8f5a('0x70')],_0x365c5a);})['then'](function(_0x2d7830){_0x44e56a=_0x2d7830;return getTicket(_0x3030b2,_0x518277,_0x44e56a,_0x3dfc98,_0x1783d8,_0x3dfc98[_0x8f5a('0x71')],_0x365c5a,_0x8f5a('0x6c'));})[_0x8f5a('0x1e')](function(_0x1bc83e){_0x35fb03=_0x1bc83e;logger[_0x8f5a('0x17')](_0x8f5a('0x72'),_0x35fb03['id']);logger[_0x8f5a('0x17')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x35fb03['id'],_0x1b13e7[_0x8f5a('0x4c')],_0x3030b2[_0x8f5a('0x45')]);switch(_0x3030b2['type']){case _0x8f5a('0x66'):emit(util[_0x8f5a('0x5f')](_0x8f5a('0x67'),_0x1b13e7[_0x8f5a('0x4c')]),_0x8f5a('0x68'),{'recordId':_0x35fb03['id']});break;case _0x8f5a('0x69'):emit(util[_0x8f5a('0x5f')](_0x8f5a('0x67'),_0x1b13e7[_0x8f5a('0x4c')]),'trigger:browser:url',{'uri':util['format'](_0x8f5a('0x73'),_0x365c5a[_0x8f5a('0x74')],_0x35fb03['id'])});break;default:logger['error'](_0x8f5a('0x6f'),_0x8f5a('0x75'));}})[_0x8f5a('0x76')](function(_0x245566){logger[_0x8f5a('0x6b')](_0x8f5a('0x6f'),_0x245566);});};exports[_0x8f5a('0x77')]=function(_0x3dc916,_0x4d0f5d,_0x4fe9ff,_0x23e356,_0x447f11,_0x37085f){var _0x339b51,_0x263d35,_0x28a233,_0x501606;_0x37085f['serverUrl']=intUtil[_0x8f5a('0x5b')](_0x37085f[_0x8f5a('0x5a')]);_0x37085f['remoteUri']=intUtil['stripTrailingSlash'](_0x37085f['remoteUri']);if(_0x447f11&&_0x447f11['monitor_format']){logger['info']('['+_0x4d0f5d[_0x8f5a('0x78')][_0x8f5a('0x79')]()+']',_0x8f5a('0x5d'));_0x4d0f5d[_0x8f5a('0x5e')]=util[_0x8f5a('0x5f')](_0x8f5a('0x60'),_0x37085f[_0x8f5a('0x5a')],_0x4d0f5d[_0x8f5a('0x61')],md5(_0x4d0f5d[_0x8f5a('0x61')]));}else{_0x4d0f5d[_0x8f5a('0x5e')]='';}return getConnection(_0x37085f)[_0x8f5a('0x1e')](function(_0x108fb4){_0x501606=_0x108fb4;if(!_[_0x8f5a('0x1a')](_0x23e356)){return getUser(_0x37085f,_0x23e356['name'],_0x501606);}else{return getUser(_0x37085f,null,_0x501606);}})['then'](function(_0x495764){_0x339b51=_0x495764;return getEndUser(_0x37085f,_0x4fe9ff,_0x4d0f5d['calleridname'],_0x4d0f5d[_0x8f5a('0x63')],_0x501606);})['then'](function(_0x316b33){_0x263d35=_0x316b33;return getTicket(_0x37085f,_0x339b51,_0x263d35,_0x4fe9ff,_0x4d0f5d,_0x4fe9ff['Fields'],_0x501606);})[_0x8f5a('0x1e')](function(_0x487219){_0x28a233=_0x487219;logger[_0x8f5a('0x17')]('['+_0x4d0f5d[_0x8f5a('0x78')][_0x8f5a('0x79')]()+_0x8f5a('0x7a'),_0x28a233['id']);logger['info']('['+_0x4d0f5d[_0x8f5a('0x78')][_0x8f5a('0x79')]()+_0x8f5a('0x7b'),_0x37085f[_0x8f5a('0x45')]);})[_0x8f5a('0x76')](function(_0x19c2d0){logger[_0x8f5a('0x6b')]('['+_0x4d0f5d[_0x8f5a('0x78')][_0x8f5a('0x79')]()+']',_0x19c2d0);});}; \ No newline at end of file +var _0x1204=['toString','variable','variableName','idField','customVariable','Variable','name','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','lastevent','request-promise','moment','bluebird','md5','jsforce','ioredis','../../../../config/environment','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','moduleSearch','contact_lead','merge','$or','Contact','additionalSearchLead','Lead','cloneDeep','additionalSearchAccount','Account','execute','additionalSearchContact','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','includes','picklist'];(function(_0x1d895c,_0x175701){var _0x7505c7=function(_0x4f065d){while(--_0x4f065d){_0x1d895c['push'](_0x1d895c['shift']());}};_0x7505c7(++_0x175701);}(_0x1204,0x12d));var _0x4120=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1204[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var rp=require(_0x4120('0x0'));var moment=require(_0x4120('0x1'));var BPromise=require(_0x4120('0x2'));var md5=require(_0x4120('0x3'));var jsforce=require(_0x4120('0x4'));var util=require('util');var Redis=require(_0x4120('0x5'));var intUtil=require('./util');var config=require(_0x4120('0x6'));var logger=require('../../../../config/logger')(_0x4120('0x7'));config[_0x4120('0x8')]=_[_0x4120('0x9')](config[_0x4120('0x8')],{'host':_0x4120('0xa'),'port':0x18eb});var io=require(_0x4120('0xb'))(new Redis(config[_0x4120('0x8')]));function emit(_0x4d2444,_0x12f314,_0x3e76c8){io['to'](_0x4d2444)[_0x4120('0xc')](_0x12f314,_0x3e76c8);}function getTicket(_0x29febc,_0x4f7404,_0x37d7e9,_0x269abe,_0x22da8a,_0x122072,_0x108b92,_0x4b3af3){var _0x3bbe83=Object[_0x4120('0xd')]({},{'OwnerId':_0x4f7404['id'],'Subject':intUtil[_0x4120('0xe')](_0x269abe[_0x4120('0xf')],_0x22da8a,'\x20'),'Description':intUtil[_0x4120('0xe')](_0x269abe[_0x4120('0x10')],_0x22da8a,'\x0a')},getCustomFields(_0x122072,_0x22da8a));if(_0x37d7e9){if(_0x269abe[_0x4120('0x11')]===_0x4120('0x12')){_0x3bbe83['ActivityDate']=moment[_0x4120('0x13')]();_0x3bbe83[_0x4120('0x14')]=![];_0x3bbe83[_0x4120('0x15')]=![];if(_0x37d7e9[_0x4120('0x16')]===_0x4120('0x17')||_0x37d7e9[_0x4120('0x16')]==='lead'){_0x3bbe83[_0x4120('0x18')]=_0x37d7e9['id'];}else if(_0x37d7e9[_0x4120('0x16')]===_0x4120('0x19')){_0x3bbe83[_0x4120('0x1a')]=_0x37d7e9['id'];}}else if(_0x269abe[_0x4120('0x11')]===_0x4120('0x1b')){if(_0x37d7e9['endUserType']===_0x4120('0x17')){_0x3bbe83['ContactId']=_0x37d7e9['id'];}else if(_0x37d7e9[_0x4120('0x16')]===_0x4120('0x19')){_0x3bbe83[_0x4120('0x1c')]=_0x37d7e9['id'];}else if(_0x37d7e9[_0x4120('0x16')]===_0x4120('0x1d')&&_0x269abe[_0x4120('0x1e')]){_0x3bbe83[_0x269abe[_0x4120('0x1e')]]=_0x37d7e9['id'];}else{logger[_0x4120('0x1f')](_0x4120('0x20'));}}}return _0x108b92['sobject'](_0x269abe[_0x4120('0x11')])[_0x4120('0x21')](_0x3bbe83);}function getUser(_0x3e20ee,_0x14399b,_0x4eba06){if(!_[_0x4120('0x22')](_0x14399b)&&intUtil['validateEmail'](_0x14399b)){var _0x2d27c3={'Email':_0x14399b};var _0x55e662={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4eba06[_0x4120('0x23')]('User')['find'](_0x2d27c3,_0x55e662)['execute']()[_0x4120('0x24')](function(_0x4a1483){if(_0x4a1483[_0x4120('0x25')]){var _0x221faf=_[_0x4120('0x26')](_0x4a1483,function(_0x128f91){return _0x128f91[_0x4120('0x27')]===_0x14399b;});if(_0x221faf){logger['info']('Agent\x20%s\x20found.',_0x14399b);return BPromise[_0x4120('0x28')]({'id':_0x221faf['Id'],'name':_0x221faf[_0x4120('0x29')]});}}else{logger[_0x4120('0x1f')](_0x4120('0x2a'),_0x14399b);return _0x4eba06[_0x4120('0x2b')]()[_0x4120('0x24')](function(_0x5587c1){return BPromise[_0x4120('0x28')]({'id':_0x5587c1['user_id'],'name':_0x5587c1[_0x4120('0x2c')]});});}});}else{logger[_0x4120('0x1f')](_0x4120('0x2a'),_0x14399b);return _0x4eba06[_0x4120('0x2b')]()[_0x4120('0x24')](function(_0x31b7f){return BPromise['resolve']({'id':_0x31b7f[_0x4120('0x2d')],'name':_0x31b7f[_0x4120('0x2c')]});});}}function getEndUser(_0x1d2797,_0x293df5,_0x4d200a,_0x5ca6be,_0x288518){var _0x5bcdc6={'$or':{'Phone':_0x5ca6be}};var _0x17b965={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x4120('0x24')](function(){logger[_0x4120('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5ca6be,_0x293df5['moduleSearch']);switch(_0x293df5[_0x4120('0x2e')]){case _0x4120('0x2f'):var _0x3bd1d1=_['cloneDeep'](_0x5bcdc6);if(_0x293df5['additionalSearchContact']){var _0x1ece07={};_0x1ece07[_0x293df5['additionalSearchContact']]=_0x5ca6be;_[_0x4120('0x30')](_0x3bd1d1[_0x4120('0x31')],_0x1ece07);}return _0x288518['sobject'](_0x4120('0x32'))[_0x4120('0x26')](_0x3bd1d1,_0x17b965)['execute']()[_0x4120('0x24')](function(_0x17555c){if(_0x17555c&&_0x17555c['length']){return _0x17555c;}else{var _0x1f0581=_['cloneDeep'](_0x5bcdc6);if(_0x293df5[_0x4120('0x33')]){var _0x4e789e={};_0x4e789e[_0x293df5[_0x4120('0x33')]]=_0x5ca6be;_[_0x4120('0x30')](_0x1f0581[_0x4120('0x31')],_0x4e789e);}return _0x288518['sobject'](_0x4120('0x34'))[_0x4120('0x26')](_0x1f0581,_0x17b965);}});case'account_contact_lead':var _0x1da19e=_[_0x4120('0x35')](_0x5bcdc6);if(_0x293df5[_0x4120('0x36')]){var _0x1ece07={};_0x1ece07[_0x293df5[_0x4120('0x36')]]=_0x5ca6be;_[_0x4120('0x30')](_0x1da19e[_0x4120('0x31')],_0x1ece07);}return _0x288518['sobject'](_0x4120('0x37'))['find'](_0x1da19e,_0x17b965)[_0x4120('0x38')]()['then'](function(_0x375988){if(_0x375988&&_0x375988['length']){return _0x375988;}else{var _0x2c1743=_[_0x4120('0x35')](_0x5bcdc6);if(_0x293df5['additionalSearchContact']){var _0x5b37e7={};_0x5b37e7[_0x293df5['additionalSearchContact']]=_0x5ca6be;_[_0x4120('0x30')](_0x2c1743[_0x4120('0x31')],_0x5b37e7);}return _0x288518[_0x4120('0x23')](_0x4120('0x32'))[_0x4120('0x26')](_0x2c1743,_0x17b965)['then'](function(_0x3d4d04){if(_0x3d4d04&&_0x3d4d04[_0x4120('0x25')]){return _0x3d4d04;}else{var _0x57ac64=_[_0x4120('0x35')](_0x5bcdc6);if(_0x293df5[_0x4120('0x33')]){var _0x194b88={};_0x194b88[_0x293df5[_0x4120('0x33')]]=_0x5ca6be;_[_0x4120('0x30')](_0x57ac64[_0x4120('0x31')],_0x194b88);}return _0x288518[_0x4120('0x23')](_0x4120('0x34'))[_0x4120('0x26')](_0x57ac64,_0x17b965);}});}});case'contact':var _0x3bd1d1=_[_0x4120('0x35')](_0x5bcdc6);if(_0x293df5['additionalSearchContact']){var _0x1ece07={};_0x1ece07[_0x293df5[_0x4120('0x39')]]=_0x5ca6be;_['merge'](_0x3bd1d1['$or'],_0x1ece07);}return _0x288518['sobject'](_0x4120('0x32'))[_0x4120('0x26')](_0x3bd1d1,_0x17b965)['execute']();case _0x4120('0x1d'):var _0x36b924=_[_0x4120('0x35')](_0x5bcdc6);if(_0x293df5['additionalSearchLead']){var _0x1ece07={};_0x1ece07[_0x293df5[_0x4120('0x33')]]=_0x5ca6be;_[_0x4120('0x30')](_0x36b924[_0x4120('0x31')],_0x1ece07);}return _0x288518[_0x4120('0x23')](_0x4120('0x34'))[_0x4120('0x26')](_0x36b924,_0x17b965);case _0x4120('0x19'):var _0x1da19e=_[_0x4120('0x35')](_0x5bcdc6);if(_0x293df5['additionalSearchAccount']){var _0x1ece07={};_0x1ece07[_0x293df5[_0x4120('0x36')]]=_0x5ca6be;_[_0x4120('0x30')](_0x1da19e[_0x4120('0x31')],_0x1ece07);}return _0x288518[_0x4120('0x23')](_0x4120('0x37'))[_0x4120('0x26')](_0x1da19e,_0x17b965);default:return null;}})[_0x4120('0x24')](function(_0x3bdb5e){if(_0x3bdb5e&&_0x3bdb5e[_0x4120('0x25')]){var _0x2fefb8=_[_0x4120('0x3a')](_0x3bdb5e);if(_0x2fefb8){return BPromise[_0x4120('0x28')]({'id':_0x2fefb8['Id'],'name':_0x2fefb8[_0x4120('0x29')],'phone':_0x2fefb8[_0x4120('0x3b')],'endUserType':_0x2fefb8['attributes'][_0x4120('0x3c')][_0x4120('0x3d')]()});}}})[_0x4120('0x24')](function(_0x2d4278){if(_0x2d4278){logger[_0x4120('0x1f')](_0x4120('0x3e'),_0x2d4278[_0x4120('0x16')],_0x5ca6be);return BPromise['resolve'](_0x2d4278);}else{logger[_0x4120('0x1f')](_0x4120('0x3f'),_0x5ca6be);var _0x35eaa6={'Phone':_0x5ca6be};if(_0x293df5[_0x4120('0x40')]){if(_0x293df5[_0x4120('0x40')]===_0x4120('0x17')){logger[_0x4120('0x1f')](_0x4120('0x41'),_0x5ca6be,_0x293df5[_0x4120('0x40')]);_0x35eaa6[_0x4120('0x42')]=_0x4d200a!==''?_0x4d200a:util[_0x4120('0x43')](_0x4120('0x44'),_0x5ca6be);}else if(_0x293df5['moduleCreate']===_0x4120('0x1d')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5ca6be,_0x293df5[_0x4120('0x40')]);_0x35eaa6[_0x4120('0x42')]=_0x4d200a!==''?_0x4d200a:util[_0x4120('0x43')](_0x4120('0x44'),_0x5ca6be);_0x35eaa6[_0x4120('0x45')]=_0x4120('0x46');}else if(_0x293df5[_0x4120('0x40')]===_0x4120('0x19')){logger[_0x4120('0x1f')](_0x4120('0x41'),_0x5ca6be,_0x293df5['moduleCreate']);_0x35eaa6['Name']=_0x4d200a!==''?_0x4d200a:util['format']('Caller\x20-\x20%s',_0x5ca6be);}else{return null;}}return _0x288518[_0x4120('0x23')](_[_0x4120('0x47')](_0x293df5[_0x4120('0x40')]))[_0x4120('0x21')](_0x35eaa6)[_0x4120('0x24')](function(_0xe2572a){return BPromise['resolve']({'id':_0xe2572a['id'],'endUserType':_0x293df5[_0x4120('0x40')]});});}});}function getCustomFields(_0x94145a,_0x31ccdf){var _0x1b79b9={};if(_0x94145a['length']>0x0){_['forEach'](_0x94145a,function(_0x758e91){if(_[_0x4120('0x48')](['string',_0x4120('0x49')],_0x758e91[_0x4120('0x3c')])&&_0x758e91['idField']){_0x1b79b9[_0x758e91['idField']]=_0x758e91['content'][_0x4120('0x4a')]();}else if(_0x758e91[_0x4120('0x3c')]===_0x4120('0x4b')&&_0x758e91[_0x4120('0x4c')]&&_0x758e91[_0x4120('0x4d')]){_0x31ccdf[_0x758e91[_0x4120('0x4c')]]&&(_0x1b79b9[_0x758e91[_0x4120('0x4d')]]=_0x31ccdf[_0x758e91[_0x4120('0x4c')]][_0x4120('0x4a')]());}else if(_0x758e91[_0x4120('0x3c')]===_0x4120('0x4e')&&_0x758e91[_0x4120('0x4f')]&&_0x758e91[_0x4120('0x4f')][_0x4120('0x50')]&&_0x758e91[_0x4120('0x4d')]){_0x31ccdf[_0x758e91['Variable'][_0x4120('0x50')][_0x4120('0x3d')]()]&&(_0x1b79b9[_0x758e91[_0x4120('0x4d')]]=_0x31ccdf[_0x758e91['Variable']['name'][_0x4120('0x3d')]()][_0x4120('0x4a')]());}});}return _0x1b79b9;}function getConnection(_0x48dd12){var _0xd87e6=_0x48dd12['password'][_0x4120('0x51')](_0x48dd12[_0x4120('0x52')]);var _0x4acc57=new jsforce[(_0x4120('0x53'))]({'oauth2':{'loginUrl':_0x48dd12[_0x4120('0x54')]||_0x4120('0x55'),'clientId':_0x48dd12[_0x4120('0x56')],'clientSecret':_0x48dd12['clientSecret']}});return _0x4acc57[_0x4120('0x57')](_0x48dd12['username'],_0xd87e6)['then'](function(){logger['info'](_0x4120('0x58'));return _0x4acc57;});}exports[_0x4120('0x59')]=function(_0x2b581b,_0x300f28,_0x4a1ae8,_0x209f3c,_0x46bda1,_0x507072){var _0x54892a,_0x5473e8,_0xc34862,_0x11e3db;_0x507072['serverUrl']=intUtil[_0x4120('0x5a')](_0x507072[_0x4120('0x5b')]);_0x507072[_0x4120('0x54')]=intUtil['stripTrailingSlash'](_0x507072[_0x4120('0x54')]);if(_0x46bda1&&_0x46bda1[_0x4120('0x5c')]){logger[_0x4120('0x1f')](_0x4120('0x5d'),_0x4120('0x5e'));_0x300f28['recordingURL']=util[_0x4120('0x43')](_0x4120('0x5f'),_0x507072['serverUrl'],_0x300f28[_0x4120('0x60')],md5(_0x300f28['uniqueid']));}else{_0x300f28[_0x4120('0x61')]='';}return getConnection(_0x507072)[_0x4120('0x24')](function(_0x1282a9){_0x11e3db=_0x1282a9;return getUser(_0x507072,_0x209f3c[_0x4120('0x62')],_0x11e3db);})[_0x4120('0x24')](function(_0x2cb284){_0x54892a=_0x2cb284;return getEndUser(_0x507072,_0x4a1ae8,_0x300f28[_0x4120('0x63')],_0x300f28[_0x4120('0x64')],_0x11e3db);})[_0x4120('0x24')](function(_0x121470){_0x5473e8=_0x121470;return getTicket(_0x507072,_0x54892a,_0x5473e8,_0x4a1ae8,_0x300f28,_0x4a1ae8[_0x4120('0x65')],_0x11e3db,_0x4120('0x59'));})[_0x4120('0x24')](function(_0x3f4748){_0xc34862=_0x3f4748;logger[_0x4120('0x1f')](_0x4120('0x66'),_0xc34862['id']);logger[_0x4120('0x1f')](_0x4120('0x67'),_0xc34862['id'],_0x209f3c[_0x4120('0x50')],_0x507072[_0x4120('0x3c')]);switch(_0x507072[_0x4120('0x3c')]){case _0x4120('0x68'):emit(util[_0x4120('0x43')](_0x4120('0x69'),_0x209f3c[_0x4120('0x50')]),_0x4120('0x6a'),{'recordId':_0xc34862['id']});break;case _0x4120('0x6b'):emit(util[_0x4120('0x43')]('user:%s',_0x209f3c[_0x4120('0x50')]),_0x4120('0x6c'),{'uri':util[_0x4120('0x43')](_0x4120('0x6d'),_0x11e3db[_0x4120('0x6e')],_0xc34862['id'])});break;default:logger[_0x4120('0x6f')](_0x4120('0x70'));}})['catch'](function(_0x53e68b){logger['error'](_0x4120('0x5d'),_0x53e68b);});};exports[_0x4120('0x71')]=function(_0x226012,_0x2c8c15,_0x4e6d49,_0x483970,_0x440486,_0x4072b3,_0x5a58c7){var _0x58416d,_0x3d9c10,_0x1ababb,_0x3ef124;_0x4072b3[_0x4120('0x5b')]=intUtil[_0x4120('0x5a')](_0x4072b3[_0x4120('0x5b')]);_0x4072b3[_0x4120('0x54')]=intUtil[_0x4120('0x5a')](_0x4072b3[_0x4120('0x54')]);if(_0x5a58c7&&_0x5a58c7[_0x4120('0x72')]&&_0x5a58c7[_0x4120('0x72')]!==_0x4120('0x73')){logger[_0x4120('0x1f')](_0x4120('0x74'),_0x4120('0x5e'));_0x2c8c15[_0x4120('0x61')]=util['format'](_0x4120('0x5f'),_0x4072b3['serverUrl'],_0x2c8c15[_0x4120('0x60')],md5(_0x2c8c15['uniqueid']));}return getConnection(_0x4072b3)[_0x4120('0x24')](function(_0x4d9059){_0x3ef124=_0x4d9059;return getUser(_0x4072b3,_0x483970[_0x4120('0x62')],_0x3ef124);})[_0x4120('0x24')](function(_0x185854){_0x58416d=_0x185854;return getEndUser(_0x4072b3,_0x4e6d49,_0x2c8c15[_0x4120('0x75')],_0x2c8c15[_0x4120('0x76')],_0x3ef124);})[_0x4120('0x24')](function(_0x202dc7){_0x3d9c10=_0x202dc7;return getTicket(_0x4072b3,_0x58416d,_0x3d9c10,_0x4e6d49,_0x2c8c15,_0x4e6d49[_0x4120('0x65')],_0x3ef124,_0x4120('0x71'));})['then'](function(_0x360703){_0x1ababb=_0x360703;logger[_0x4120('0x1f')](_0x4120('0x77'),_0x1ababb['id']);logger[_0x4120('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1ababb['id'],_0x483970['name'],_0x4072b3[_0x4120('0x3c')]);switch(_0x4072b3['type']){case'integrationTab':emit(util[_0x4120('0x43')](_0x4120('0x69'),_0x483970['name']),'trigger:salesforce:display',{'recordId':_0x1ababb['id']});break;case _0x4120('0x6b'):emit(util[_0x4120('0x43')](_0x4120('0x69'),_0x483970[_0x4120('0x50')]),_0x4120('0x6c'),{'uri':util[_0x4120('0x43')](_0x4120('0x6d'),_0x3ef124[_0x4120('0x6e')],_0x1ababb['id'])});break;default:logger[_0x4120('0x6f')]('[OUTBOUND]',_0x4120('0x78'));}})[_0x4120('0x79')](function(_0x3d8e8b){logger['error'](_0x4120('0x74'),_0x3d8e8b);});};exports[_0x4120('0x7a')]=function(_0x317fa9,_0x49ff1a,_0x166e58,_0x30bcfb,_0x29d66f,_0x32b925){var _0x3c424f,_0x1ebd38,_0x15e344,_0x1e5071;_0x32b925[_0x4120('0x5b')]=intUtil[_0x4120('0x5a')](_0x32b925[_0x4120('0x5b')]);_0x32b925['remoteUri']=intUtil['stripTrailingSlash'](_0x32b925[_0x4120('0x54')]);if(_0x29d66f&&_0x29d66f['monitor_format']){logger['info']('['+_0x49ff1a['lastevent'][_0x4120('0x7b')]()+']',_0x4120('0x5e'));_0x49ff1a[_0x4120('0x61')]=util[_0x4120('0x43')](_0x4120('0x5f'),_0x32b925[_0x4120('0x5b')],_0x49ff1a['uniqueid'],md5(_0x49ff1a[_0x4120('0x60')]));}else{_0x49ff1a[_0x4120('0x61')]='';}return getConnection(_0x32b925)['then'](function(_0x1d9fe7){_0x1e5071=_0x1d9fe7;if(!_[_0x4120('0x22')](_0x30bcfb)){return getUser(_0x32b925,_0x30bcfb[_0x4120('0x50')],_0x1e5071);}else{return getUser(_0x32b925,null,_0x1e5071);}})[_0x4120('0x24')](function(_0xd4f870){_0x3c424f=_0xd4f870;return getEndUser(_0x32b925,_0x166e58,_0x49ff1a[_0x4120('0x63')],_0x49ff1a[_0x4120('0x64')],_0x1e5071);})[_0x4120('0x24')](function(_0x34d534){_0x1ebd38=_0x34d534;return getTicket(_0x32b925,_0x3c424f,_0x1ebd38,_0x166e58,_0x49ff1a,_0x166e58[_0x4120('0x65')],_0x1e5071);})[_0x4120('0x24')](function(_0x310e6a){_0x15e344=_0x310e6a;logger[_0x4120('0x1f')]('['+_0x49ff1a[_0x4120('0x7c')][_0x4120('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x15e344['id']);logger['info']('['+_0x49ff1a[_0x4120('0x7c')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x32b925[_0x4120('0x3c')]);})['catch'](function(_0x62932f){logger[_0x4120('0x6f')]('['+_0x49ff1a[_0x4120('0x7c')][_0x4120('0x7b')]()+']',_0x62932f);});}; \ 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 131a0e7..4eeff02 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 _0xb471=['request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','endUserNumber','user','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','string','picklist','type','nameField','customField','content','includes','idField','toLowerCase','toString','variableName','customVariable','Variable','name','outbound','POST','incident','assign','getString','Subjects','Descriptions','Fields','ticketNumber','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0xb471,0x6f));var _0x1b47=function(_0x328639,_0x46ca8c){_0x328639=_0x328639-0x0;var _0x3ad3f3=_0xb471[_0x328639];return _0x3ad3f3;};'use strict';var _=require(_0x1b47('0x0'));var Promise=require(_0x1b47('0x1'));var rp=require(_0x1b47('0x2'));var util=require(_0x1b47('0x3'));var md5=require(_0x1b47('0x4'));var Redis=require(_0x1b47('0x5'));var intUtil=require(_0x1b47('0x6'));var config=require(_0x1b47('0x7'));var logger=require(_0x1b47('0x8'))(_0x1b47('0x9'));config[_0x1b47('0xa')]=_[_0x1b47('0xb')](config[_0x1b47('0xa')],{'host':_0x1b47('0xc'),'port':0x18eb});var io=require(_0x1b47('0xd'))(new Redis(config['redis']));function getAdminUser(_0xd677f0,_0x5bd1c5,_0x9b986b,_0x452856,_0x22580c,_0x3e57e8){return new Promise(function(_0x1a4961,_0x2cc795){var _0x3ebeca={'method':'GET','uri':_0x452856+_0x1b47('0xe')+'&'+_0x22580c+'&'+_0x3e57e8,'auth':_0x5bd1c5,'json':!![]};return rp(_0x3ebeca)[_0x1b47('0xf')](function(_0x3f3e81){if(_0x3f3e81[_0x1b47('0x10')]['length']>0x0){_0x9b986b[_0x1b47('0x11')]=_0x3f3e81[_0x1b47('0x10')][0x0][_0x1b47('0x12')];}logger[_0x1b47('0x13')]('['+[_0xd677f0[_0x1b47('0x14')]()]+'],\x20getAdminUser\x20crm',_0x9b986b);_0x1a4961(_0x9b986b);})[_0x1b47('0x15')](function(_0x4f4ca6){logger[_0x1b47('0x16')]('['+[_0xd677f0[_0x1b47('0x14')]()]+']',_0x4f4ca6[_0x1b47('0x17')]);_0x2cc795(_0x4f4ca6[_0x1b47('0x17')]);});});}function getUser(_0x905def,_0x56c87d,_0x292f0e,_0x24214b,_0x1a6dc4){return function(_0x41a920){logger[_0x1b47('0x13')]('['+[_0x905def[_0x1b47('0x14')]()]+_0x1b47('0x18'),_0x41a920);return new Promise(function(_0x46728a,_0x43c13d){if(intUtil[_0x1b47('0x19')](_0x41a920[_0x1b47('0x1a')])){var _0x1dff4f={'method':_0x1b47('0x1b'),'uri':_0x292f0e+_0x1b47('0x1c')+_0x41a920['userEmail']+'&'+_0x24214b+'&'+_0x1a6dc4,'auth':_0x56c87d,'json':!![]};logger[_0x1b47('0x13')]('['+[_0x905def[_0x1b47('0x14')]()]+_0x1b47('0x1d'),_0x1dff4f);return rp(_0x1dff4f)[_0x1b47('0xf')](function(_0x353690){logger[_0x1b47('0x13')]('['+[_0x905def[_0x1b47('0x14')]()]+_0x1b47('0x1e'),_0x353690);if(_0x353690[_0x1b47('0x10')][_0x1b47('0x1f')]>0x0&&String(_0x353690[_0x1b47('0x10')][0x0][_0x1b47('0x20')])===_0x1b47('0x21')){_0x41a920[_0x1b47('0x22')]=_0x353690[_0x1b47('0x10')][0x0][_0x1b47('0x12')];}else{_0x41a920[_0x1b47('0x22')]=_0x41a920['adminId'];_0x41a920[_0x1b47('0x1a')]=_0x41a920[_0x1b47('0x23')];}logger[_0x1b47('0x13')]('['+[_0x905def[_0x1b47('0x14')]()]+_0x1b47('0x24'),_0x41a920);_0x46728a(_0x41a920);})[_0x1b47('0x15')](function(_0x30a1e7){logger[_0x1b47('0x16')]('['+[_0x905def[_0x1b47('0x14')]()]+']',_0x30a1e7[_0x1b47('0x17')]);_0x43c13d(_0x30a1e7[_0x1b47('0x17')]);});}else{logger['info']('['+[_0x905def[_0x1b47('0x14')]()]+_0x1b47('0x25'));_0x41a920[_0x1b47('0x22')]=_0x41a920[_0x1b47('0x11')];_0x41a920[_0x1b47('0x1a')]=_0x41a920['adminEmail'];_0x46728a(_0x41a920);}});};}function createEndUser(_0x535ea1,_0x130f07,_0x268c8e,_0x5bb34f,_0x582d65){logger[_0x1b47('0x13')]('['+[_0x535ea1[_0x1b47('0x14')]()]+_0x1b47('0x26'),_0x268c8e);return new Promise(function(_0x4475c5,_0x512874){var _0x5799ad={'method':'POST','uri':_0x5bb34f+'sys_user?'+_0x582d65,'body':{'user_name':_0x268c8e[_0x1b47('0x27')],'roles':_0x1b47('0x28'),'first_name':_0x268c8e['endUserNumber'],'active':_0x1b47('0x21'),'date_format':'System','phone':_0x268c8e['endUserNumber']},'auth':_0x130f07,'json':!![]};return rp(_0x5799ad)[_0x1b47('0xf')](function(_0x55c6a6){logger['info']('['+[_0x535ea1[_0x1b47('0x14')]()]+_0x1b47('0x29'),_0x55c6a6[_0x1b47('0x10')]);_0x268c8e['endUserId']=_0x55c6a6[_0x1b47('0x10')][_0x1b47('0x12')];_0x4475c5(_0x268c8e);})[_0x1b47('0x15')](function(_0x11f68d){logger[_0x1b47('0x16')]('['+[_0x535ea1[_0x1b47('0x14')]()]+']',_0x11f68d[_0x1b47('0x17')]);_0x512874(_0x11f68d[_0x1b47('0x17')]);});});}function getEndUser(_0x17ad99,_0x5d9b23,_0xf5c042,_0x3c7dd2,_0xee6b04){return function(_0xd80c0a){logger[_0x1b47('0x13')]('['+[_0x17ad99[_0x1b47('0x14')]()]+_0x1b47('0x2a'),_0xd80c0a);return new Promise(function(_0x5d7863,_0x58b465){var _0x356085={'method':_0x1b47('0x1b'),'uri':_0xf5c042+_0x1b47('0x2b')+_0xd80c0a[_0x1b47('0x27')]+'&'+_0x3c7dd2+'&'+_0xee6b04,'auth':_0x5d9b23,'json':!![]};return rp(_0x356085)[_0x1b47('0xf')](function(_0x1e0659){if(_0x1e0659[_0x1b47('0x10')][_0x1b47('0x1f')]>0x0){_0xd80c0a[_0x1b47('0x2c')]=_0x1e0659[_0x1b47('0x10')][0x0]['sys_id'];logger[_0x1b47('0x13')]('['+[_0x17ad99[_0x1b47('0x14')]()]+'],\x20getEndUser\x20crm',_0xd80c0a);_0x5d7863(_0xd80c0a);}else{return createEndUser(_0x17ad99,_0x5d9b23,_0xd80c0a,_0xf5c042,_0x3c7dd2)[_0x1b47('0xf')](function(_0x3a5449){logger['info']('['+[_0x17ad99['toUpperCase']()]+_0x1b47('0x2d'),_0x3a5449);_0x5d7863(_0x3a5449);});}})[_0x1b47('0x15')](function(_0x187585){logger[_0x1b47('0x16')]('['+[_0x17ad99[_0x1b47('0x14')]()]+']',_0x187585[_0x1b47('0x17')]);_0x58b465(_0x187585[_0x1b47('0x17')]);});});};}function getCustomFields(_0x52a80d,_0x4c8e49){var _0x4bdd4d={};if(_0x52a80d[_0x1b47('0x1f')]>0x0){_[_0x1b47('0x2e')](_0x52a80d,function(_0xeb36dc){if(_['includes']([_0x1b47('0x2f'),_0x1b47('0x30')],_0xeb36dc[_0x1b47('0x31')])&&_0xeb36dc[_0x1b47('0x32')]&&!_0xeb36dc[_0x1b47('0x33')]){_0x4bdd4d[_0xeb36dc[_0x1b47('0x32')]['toLowerCase']()]=_0xeb36dc[_0x1b47('0x34')]['toString']();}else if(_[_0x1b47('0x35')](['string',_0x1b47('0x30')],_0xeb36dc[_0x1b47('0x31')])&&_0xeb36dc[_0x1b47('0x36')]&&_0xeb36dc[_0x1b47('0x33')]){_0x4bdd4d[_0xeb36dc['idField'][_0x1b47('0x37')]()]=_0xeb36dc['content'][_0x1b47('0x38')]();}else if(_0xeb36dc['type']==='variable'&&_0xeb36dc[_0x1b47('0x39')]&&_0xeb36dc['idField']&&_0xeb36dc['customField']){_0x4bdd4d[_0xeb36dc[_0x1b47('0x36')][_0x1b47('0x37')]()]=_0x4c8e49[_0xeb36dc[_0x1b47('0x39')]]['toString']();}else if(_0xeb36dc['type']===_0x1b47('0x3a')&&_0xeb36dc[_0x1b47('0x3b')]&&_0xeb36dc[_0x1b47('0x3b')][_0x1b47('0x3c')]&&_0xeb36dc['idField']&&_0xeb36dc[_0x1b47('0x33')]){_0x4bdd4d[_0xeb36dc['idField']['toLowerCase']()]=_0x4c8e49[_0xeb36dc[_0x1b47('0x3b')][_0x1b47('0x3c')]['toLowerCase']()][_0x1b47('0x38')]();}});}return _0x4bdd4d;}function getTicket(_0x434a23,_0x379d56,_0x32e1e6,_0x25edb8,_0x4c212e,_0x22a29b){return function(_0x54c93a){logger['info']('['+[_0x434a23[_0x1b47('0x14')]()]+']\x20getTicket\x20input\x20crm',_0x54c93a);return new Promise(function(_0x5afb79,_0x822609){var _0x352590=_0x434a23[_0x1b47('0x37')]()===_0x1b47('0x3d')?_0x54c93a[_0x1b47('0x22')]:_0x54c93a[_0x1b47('0x2c')];var _0x3fda7c={'method':_0x1b47('0x3e'),'uri':_0x32e1e6+_0x1b47('0x3f')+'?'+_0x22a29b,'body':Object[_0x1b47('0x40')]({},{'active':'true','caller_id':_0x352590,'assigned_to':_0x54c93a[_0x1b47('0x22')],'short_description':intUtil[_0x1b47('0x41')](_0x25edb8[_0x1b47('0x42')],_0x4c212e,'\x20'),'description':intUtil[_0x1b47('0x41')](_0x25edb8[_0x1b47('0x43')],_0x4c212e,'\x0a')},getCustomFields(_0x25edb8[_0x1b47('0x44')],_0x4c212e)),'auth':_0x379d56,'json':!![]};return rp(_0x3fda7c)[_0x1b47('0xf')](function(_0x1ebb0a){logger[_0x1b47('0x13')]('['+[_0x434a23[_0x1b47('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x1ebb0a[_0x1b47('0x10')]);_0x54c93a['ticketId']=_0x1ebb0a[_0x1b47('0x10')][_0x1b47('0x12')];_0x54c93a[_0x1b47('0x45')]=_0x1ebb0a[_0x1b47('0x10')]['number'];logger['info']('['+[_0x434a23[_0x1b47('0x14')]()]+']\x20getTicket\x20crm',_0x54c93a);_0x5afb79(_0x54c93a);})['catch'](function(_0x52a0ee){logger[_0x1b47('0x16')]('['+[_0x434a23[_0x1b47('0x14')]()]+']',_0x52a0ee[_0x1b47('0x17')]);_0x822609(_0x52a0ee[_0x1b47('0x17')]);});});};}function createRemoteTag(_0x1f1e98,_0x2f1976,_0x40d1ed,_0x69ced4){return new Promise(function(_0x2bcc0d,_0x2ba216){var _0x17ce11={'method':_0x1b47('0x3e'),'uri':_0x40d1ed+_0x1b47('0x46')+'?'+_0x69ced4,'body':{'short_description':_0x1f1e98,'global':!![],'active':!![],'name':_0x1f1e98},'auth':_0x2f1976,'json':!![]};return rp(_0x17ce11)[_0x1b47('0xf')](function(_0x11509a){var _0x57c9f7=_0x11509a['result'][_0x1b47('0x12')];_0x2bcc0d(_0x57c9f7);});});}function getRemoteTag(_0x472df5,_0x32ed4f,_0x49d07e,_0x2305be,_0x31bdff){return new Promise(function(_0x2aa5a4,_0x551618){var _0x42622a={'method':'GET','uri':_0x49d07e+_0x1b47('0x46')+_0x1b47('0x47')+_0x472df5+'&'+_0x2305be,'auth':_0x32ed4f,'json':!![]};return rp(_0x42622a)[_0x1b47('0xf')](function(_0x288b63){if(_0x288b63[_0x1b47('0x10')][_0x1b47('0x1f')]>0x0){var _0xa6f245=_0x288b63['result'][0x0][_0x1b47('0x12')];_0x2aa5a4(_0xa6f245);}else{return createRemoteTag(_0x472df5,_0x32ed4f,_0x49d07e,_0x2305be)['then'](function(_0x3ac300){_0x2aa5a4(_0x3ac300);});}});});}function assignTagToIncident(_0x18eab1,_0x5b95df,_0x3c0ab5,_0x1631a9,_0xd8f27b){return new Promise(function(_0x51e016,_0x1f02eb){var _0x20916b={'method':_0x1b47('0x3e'),'uri':_0x3c0ab5+_0x1b47('0x48')+'?'+_0xd8f27b,'body':{'label':_0x18eab1,'table':'incident','id_type':_0x1b47('0x49'),'table_key':_0x1631a9[_0x1b47('0x4a')],'title':_0x1b47('0x4b')+_0x1631a9['ticketNumber'],'id_display':_0x1631a9[_0x1b47('0x45')]},'auth':_0x5b95df,'json':!![]};return rp(_0x20916b)['then'](function(_0xd155a){_0x51e016();})[_0x1b47('0x15')](function(){_0x51e016();});});}function manageTags(_0xea6c65,_0x2ee785,_0xd2b8bc,_0x447067,_0x128ba5,_0x2b367d,_0x50c3b1){return new Promise(function(_0x274a9c,_0x2285a7){var _0x521dd6=[];_0x2ee785[_0x1b47('0x2e')](function(_0x16fa51){_0x521dd6[_0x1b47('0x4c')](getRemoteTag(_0x16fa51,_0xd2b8bc,_0x447067,_0x2b367d,_0x50c3b1));});return Promise[_0x1b47('0x4d')](_0x521dd6)['then'](function(_0x1bdd00){if(_0x1bdd00[_0x1b47('0x1f')]){logger[_0x1b47('0x13')]('['+[_0xea6c65[_0x1b47('0x14')]()]+_0x1b47('0x4e'),_0x1bdd00);var _0x483e62=[];_0x1bdd00['forEach'](function(_0x1df238){_0x483e62[_0x1b47('0x4c')](assignTagToIncident(_0x1df238,_0xd2b8bc,_0x447067,_0x128ba5,_0x2b367d));});return Promise[_0x1b47('0x4d')](_0x483e62)['then'](function(){_0x274a9c();})[_0x1b47('0x15')](function(){_0x274a9c();});}else{_0x274a9c();}});});}function getTags(_0x3af6ed,_0x1f50fb,_0x408595,_0x5308d9,_0x41a327,_0x4af2b4){return function(_0x478ff5){return new Promise(function(_0x36ee7b,_0x37dc68){var _0x4be4d9=[];var _0x3ef11b=_0x5308d9['Tags'];if(_0x3ef11b&&_0x3ef11b[_0x1b47('0x1f')]>0x0){_0x4be4d9=_[_0x1b47('0x4f')](_0x3ef11b,_0x1b47('0x3c'));}if(_0x4be4d9['length']>0x0){return manageTags(_0x3af6ed,_0x4be4d9,_0x1f50fb,_0x408595,_0x478ff5,_0x41a327,_0x4af2b4)[_0x1b47('0xf')](function(){_0x36ee7b(_0x478ff5);});}else{_0x36ee7b(_0x478ff5);}});};}function emit(_0x59879b,_0x210cd5,_0x766c07){var _0x69b1ef=_0x1b47('0x50')+_0x1b47('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x1b47('0x52');var _0x3e9632={'uri':_0x59879b+_0x1b47('0x53')+_0x766c07+_0x69b1ef};io['to'](util[_0x1b47('0x54')](_0x1b47('0x55'),_0x210cd5))[_0x1b47('0x56')](_0x1b47('0x57'),_0x3e9632);}exports['cs']=function(_0x43c9ef,_0x50782e,_0x352292,_0x16f9f8,_0x1272d2,_0x5d9bc7,_0x56884b,_0x17720e){var _0x4f0e42={};var _0x3f76b5={'user':_0x5d9bc7[_0x1b47('0x58')],'pass':_0x5d9bc7['password']};var _0x4b8004=_0x1b47('0x59');var _0x1d5feb='sysparm_display_value=true';_0x5d9bc7['remoteUri']=intUtil['stripTrailingSlash'](_0x5d9bc7[_0x1b47('0x5a')]);_0x5d9bc7[_0x1b47('0x5b')]=intUtil[_0x1b47('0x5c')](_0x5d9bc7[_0x1b47('0x5b')]);var _0x3c736d=util['format'](_0x1b47('0x5d'),_0x5d9bc7[_0x1b47('0x5a')]);_0x4f0e42[_0x1b47('0x1a')]=!_[_0x1b47('0x5e')](_0x16f9f8)?_0x16f9f8['email']:null;_0x4f0e42['adminEmail']=_0x5d9bc7[_0x1b47('0x5f')];_0x4f0e42['endUserNumber']=_0x17720e[_0x1b47('0x37')]()==='outbound'?_0x50782e[_0x1b47('0x60')]:_0x50782e[_0x1b47('0x61')];_0x4f0e42[_0x1b47('0x62')]=_0x17720e===_0x1b47('0x63')||_0x17720e===_0x1b47('0x64')?'queue':'outbound';var _0x322138=util[_0x1b47('0x54')](_0x1b47('0x65'),_0x5d9bc7[_0x1b47('0x5b')],_0x50782e[_0x1b47('0x66')],md5(_0x50782e[_0x1b47('0x66')]));if(_0x1272d2&&_0x1272d2[_0x1b47('0x67')]){logger[_0x1b47('0x13')]('[QUEUE]',_0x1b47('0x68'));_0x50782e[_0x1b47('0x69')]=_0x322138;}else if(_0x56884b&&_0x56884b[_0x1b47('0x6a')]&&_0x56884b[_0x1b47('0x6a')]!==_0x1b47('0x6b')){logger[_0x1b47('0x13')](_0x1b47('0x6c'),_0x1b47('0x68'));_0x50782e[_0x1b47('0x69')]=_0x322138;}else{_0x50782e[_0x1b47('0x69')]='';}return getAdminUser(_0x17720e,_0x3f76b5,_0x4f0e42,_0x3c736d,_0x1d5feb,_0x4b8004)[_0x1b47('0xf')](getUser(_0x17720e,_0x3f76b5,_0x3c736d,_0x1d5feb,_0x4b8004))[_0x1b47('0xf')](getEndUser(_0x17720e,_0x3f76b5,_0x3c736d,_0x1d5feb,_0x4b8004))['then'](getTicket(_0x17720e,_0x3f76b5,_0x3c736d,_0x352292,_0x50782e,_0x1d5feb))[_0x1b47('0xf')](function(_0x5ad997){logger[_0x1b47('0x13')](util[_0x1b47('0x54')](_0x1b47('0x6d'),_0x5ad997[_0x1b47('0x4a')]));logger['info'](util[_0x1b47('0x54')](_0x1b47('0x6e'),_0x17720e));if(_0x17720e!==_0x1b47('0x64')){logger['info']('['+[_0x17720e[_0x1b47('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5d9bc7[_0x1b47('0x5a')],_0x16f9f8[_0x1b47('0x3c')],_0x5ad997['ticketId']);}})[_0x1b47('0x15')](function(_0x3a8f50){logger[_0x1b47('0x16')]('['+[_0x17720e[_0x1b47('0x14')]()]+_0x1b47('0x6f'),util[_0x1b47('0x70')](_0x3a8f50,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7745=['info','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','error',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','string','idField','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketNumber','push','all','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','util','md5','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','message'];(function(_0x238211,_0x34249c){var _0x37b320=function(_0x13e67d){while(--_0x13e67d){_0x238211['push'](_0x238211['shift']());}};_0x37b320(++_0x34249c);}(_0x7745,0xc1));var _0x5774=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0x7745[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x5774('0x0'));var Promise=require(_0x5774('0x1'));var rp=require('request-promise');var util=require(_0x5774('0x2'));var md5=require(_0x5774('0x3'));var Redis=require(_0x5774('0x4'));var intUtil=require(_0x5774('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5774('0x6'))(_0x5774('0x7'));config[_0x5774('0x8')]=_[_0x5774('0x9')](config[_0x5774('0x8')],{'host':_0x5774('0xa'),'port':0x18eb});var io=require(_0x5774('0xb'))(new Redis(config['redis']));function getAdminUser(_0x2f4f7a,_0x27fa59,_0xaeddb2,_0xd7d637,_0x9258f2,_0x1577fa){return new Promise(function(_0x5babd1,_0x3761c3){var _0x51d22e={'method':_0x5774('0xc'),'uri':_0xd7d637+_0x5774('0xd')+'&'+_0x9258f2+'&'+_0x1577fa,'auth':_0x27fa59,'json':!![]};return rp(_0x51d22e)[_0x5774('0xe')](function(_0x527449){if(_0x527449['result'][_0x5774('0xf')]>0x0){_0xaeddb2[_0x5774('0x10')]=_0x527449[_0x5774('0x11')][0x0][_0x5774('0x12')];}logger['info']('['+[_0x2f4f7a[_0x5774('0x13')]()]+_0x5774('0x14'),_0xaeddb2);_0x5babd1(_0xaeddb2);})[_0x5774('0x15')](function(_0x5e649c){logger['error']('['+[_0x2f4f7a[_0x5774('0x13')]()]+']',_0x5e649c['message']);_0x3761c3(_0x5e649c[_0x5774('0x16')]);});});}function getUser(_0x1802ff,_0x5e1069,_0x5d2754,_0x42a9a1,_0x343585){return function(_0x3d4d06){logger[_0x5774('0x17')]('['+[_0x1802ff[_0x5774('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x3d4d06);return new Promise(function(_0x10b2b4,_0x347852){if(intUtil[_0x5774('0x18')](_0x3d4d06[_0x5774('0x19')])){var _0x1f24b2={'method':_0x5774('0xc'),'uri':_0x5d2754+_0x5774('0x1a')+_0x3d4d06[_0x5774('0x19')]+'&'+_0x42a9a1+'&'+_0x343585,'auth':_0x5e1069,'json':!![]};logger[_0x5774('0x17')]('['+[_0x1802ff[_0x5774('0x13')]()]+_0x5774('0x1b'),_0x1f24b2);return rp(_0x1f24b2)[_0x5774('0xe')](function(_0x211809){logger[_0x5774('0x17')]('['+[_0x1802ff[_0x5774('0x13')]()]+_0x5774('0x1c'),_0x211809);if(_0x211809[_0x5774('0x11')]['length']>0x0&&String(_0x211809['result'][0x0][_0x5774('0x1d')])===_0x5774('0x1e')){_0x3d4d06[_0x5774('0x1f')]=_0x211809['result'][0x0]['sys_id'];}else{_0x3d4d06[_0x5774('0x1f')]=_0x3d4d06['adminId'];_0x3d4d06[_0x5774('0x19')]=_0x3d4d06[_0x5774('0x20')];}logger[_0x5774('0x17')]('['+[_0x1802ff[_0x5774('0x13')]()]+_0x5774('0x21'),_0x3d4d06);_0x10b2b4(_0x3d4d06);})[_0x5774('0x15')](function(_0x178ba0){logger[_0x5774('0x22')]('['+[_0x1802ff[_0x5774('0x13')]()]+']',_0x178ba0[_0x5774('0x16')]);_0x347852(_0x178ba0[_0x5774('0x16')]);});}else{logger[_0x5774('0x17')]('['+[_0x1802ff[_0x5774('0x13')]()]+_0x5774('0x23'));_0x3d4d06['userId']=_0x3d4d06['adminId'];_0x3d4d06[_0x5774('0x19')]=_0x3d4d06[_0x5774('0x20')];_0x10b2b4(_0x3d4d06);}});};}function createEndUser(_0x913c73,_0x1974e1,_0x228c74,_0x44c0cf,_0x2bc179){logger[_0x5774('0x17')]('['+[_0x913c73[_0x5774('0x13')]()]+_0x5774('0x24'),_0x228c74);return new Promise(function(_0x5c4fae,_0x123cb2){var _0x142b71={'method':_0x5774('0x25'),'uri':_0x44c0cf+_0x5774('0x26')+_0x2bc179,'body':{'user_name':_0x228c74['endUserNumber'],'roles':_0x5774('0x27'),'first_name':_0x228c74[_0x5774('0x28')],'active':_0x5774('0x1e'),'date_format':_0x5774('0x29'),'phone':_0x228c74[_0x5774('0x28')]},'auth':_0x1974e1,'json':!![]};return rp(_0x142b71)[_0x5774('0xe')](function(_0x390dfa){logger['info']('['+[_0x913c73[_0x5774('0x13')]()]+'],\x20EndUser\x20schema',_0x390dfa[_0x5774('0x11')]);_0x228c74['endUserId']=_0x390dfa[_0x5774('0x11')][_0x5774('0x12')];_0x5c4fae(_0x228c74);})[_0x5774('0x15')](function(_0x19cf6b){logger[_0x5774('0x22')]('['+[_0x913c73['toUpperCase']()]+']',_0x19cf6b[_0x5774('0x16')]);_0x123cb2(_0x19cf6b['message']);});});}function getEndUser(_0x4c95cf,_0x4ba880,_0x5c1220,_0xde7130,_0x27f76d){return function(_0x59f320){logger[_0x5774('0x17')]('['+[_0x4c95cf['toUpperCase']()]+_0x5774('0x2a'),_0x59f320);return new Promise(function(_0x49ceca,_0x45d314){var _0x4dde88={'method':_0x5774('0xc'),'uri':_0x5c1220+_0x5774('0x2b')+_0x59f320[_0x5774('0x28')]+'&'+_0xde7130+'&'+_0x27f76d,'auth':_0x4ba880,'json':!![]};return rp(_0x4dde88)[_0x5774('0xe')](function(_0x388f81){if(_0x388f81[_0x5774('0x11')]['length']>0x0){_0x59f320[_0x5774('0x2c')]=_0x388f81[_0x5774('0x11')][0x0][_0x5774('0x12')];logger[_0x5774('0x17')]('['+[_0x4c95cf[_0x5774('0x13')]()]+_0x5774('0x2d'),_0x59f320);_0x49ceca(_0x59f320);}else{return createEndUser(_0x4c95cf,_0x4ba880,_0x59f320,_0x5c1220,_0xde7130)[_0x5774('0xe')](function(_0x108ee7){logger[_0x5774('0x17')]('['+[_0x4c95cf[_0x5774('0x13')]()]+_0x5774('0x2e'),_0x108ee7);_0x49ceca(_0x108ee7);});}})[_0x5774('0x15')](function(_0x166adf){logger[_0x5774('0x22')]('['+[_0x4c95cf[_0x5774('0x13')]()]+']',_0x166adf[_0x5774('0x16')]);_0x45d314(_0x166adf[_0x5774('0x16')]);});});};}function getCustomFields(_0x63b4c8,_0x46fea8){var _0xbfb6fd={};if(_0x63b4c8[_0x5774('0xf')]>0x0){_[_0x5774('0x2f')](_0x63b4c8,function(_0xa80745){if(_[_0x5774('0x30')](['string',_0x5774('0x31')],_0xa80745[_0x5774('0x32')])&&_0xa80745[_0x5774('0x33')]&&!_0xa80745[_0x5774('0x34')]){_0xbfb6fd[_0xa80745['nameField'][_0x5774('0x35')]()]=_0xa80745[_0x5774('0x36')][_0x5774('0x37')]();}else if(_['includes']([_0x5774('0x38'),_0x5774('0x31')],_0xa80745['type'])&&_0xa80745[_0x5774('0x39')]&&_0xa80745[_0x5774('0x34')]){_0xbfb6fd[_0xa80745[_0x5774('0x39')][_0x5774('0x35')]()]=_0xa80745['content'][_0x5774('0x37')]();}else if(_0xa80745[_0x5774('0x32')]===_0x5774('0x3a')&&_0xa80745[_0x5774('0x3b')]&&_0xa80745[_0x5774('0x39')]&&_0xa80745[_0x5774('0x34')]){_0xbfb6fd[_0xa80745[_0x5774('0x39')][_0x5774('0x35')]()]=_0x46fea8[_0xa80745[_0x5774('0x3b')]]['toString']();}else if(_0xa80745[_0x5774('0x32')]==='customVariable'&&_0xa80745[_0x5774('0x3c')]&&_0xa80745[_0x5774('0x3c')]['name']&&_0xa80745[_0x5774('0x39')]&&_0xa80745['customField']){_0xbfb6fd[_0xa80745[_0x5774('0x39')][_0x5774('0x35')]()]=_0x46fea8[_0xa80745[_0x5774('0x3c')][_0x5774('0x3d')][_0x5774('0x35')]()][_0x5774('0x37')]();}});}return _0xbfb6fd;}function getTicket(_0x2aabfa,_0xf27404,_0x54c9bd,_0x56596d,_0x37cf94,_0x4d3321){return function(_0x53bdf6){logger[_0x5774('0x17')]('['+[_0x2aabfa[_0x5774('0x13')]()]+_0x5774('0x3e'),_0x53bdf6);return new Promise(function(_0x698ca4,_0x27f65a){var _0x26cbe3=_0x2aabfa[_0x5774('0x35')]()===_0x5774('0x3f')?_0x53bdf6['userId']:_0x53bdf6['endUserId'];var _0x20cb58={'method':_0x5774('0x25'),'uri':_0x54c9bd+_0x5774('0x40')+'?'+_0x4d3321,'body':Object['assign']({},{'active':_0x5774('0x1e'),'caller_id':_0x26cbe3,'assigned_to':_0x53bdf6[_0x5774('0x1f')],'short_description':intUtil['getString'](_0x56596d[_0x5774('0x41')],_0x37cf94,'\x20'),'description':intUtil[_0x5774('0x42')](_0x56596d[_0x5774('0x43')],_0x37cf94,'\x0a')},getCustomFields(_0x56596d[_0x5774('0x44')],_0x37cf94)),'auth':_0xf27404,'json':!![]};return rp(_0x20cb58)[_0x5774('0xe')](function(_0x5cd96a){logger[_0x5774('0x17')]('['+[_0x2aabfa[_0x5774('0x13')]()]+_0x5774('0x45'),_0x5cd96a[_0x5774('0x11')]);_0x53bdf6[_0x5774('0x46')]=_0x5cd96a[_0x5774('0x11')]['sys_id'];_0x53bdf6['ticketNumber']=_0x5cd96a[_0x5774('0x11')][_0x5774('0x47')];logger[_0x5774('0x17')]('['+[_0x2aabfa['toUpperCase']()]+_0x5774('0x48'),_0x53bdf6);_0x698ca4(_0x53bdf6);})[_0x5774('0x15')](function(_0x31f46e){logger[_0x5774('0x22')]('['+[_0x2aabfa[_0x5774('0x13')]()]+']',_0x31f46e[_0x5774('0x16')]);_0x27f65a(_0x31f46e['message']);});});};}function createRemoteTag(_0x6d0a93,_0x2f75e8,_0x3573e4,_0x5499a6){return new Promise(function(_0x32fb51,_0x27db76){var _0xeea370={'method':'POST','uri':_0x3573e4+_0x5774('0x49')+'?'+_0x5499a6,'body':{'short_description':_0x6d0a93,'global':!![],'active':!![],'name':_0x6d0a93},'auth':_0x2f75e8,'json':!![]};return rp(_0xeea370)[_0x5774('0xe')](function(_0x43b906){var _0x255ae7=_0x43b906['result'][_0x5774('0x12')];_0x32fb51(_0x255ae7);});});}function getRemoteTag(_0x48919e,_0xe956d0,_0x50468e,_0x58c880,_0xf5265f){return new Promise(function(_0x274478,_0x3fddfc){var _0x56fe2e={'method':_0x5774('0xc'),'uri':_0x50468e+_0x5774('0x49')+'?sysparm_query=name%3D'+_0x48919e+'&'+_0x58c880,'auth':_0xe956d0,'json':!![]};return rp(_0x56fe2e)[_0x5774('0xe')](function(_0xabce6a){if(_0xabce6a[_0x5774('0x11')][_0x5774('0xf')]>0x0){var _0x2c72d4=_0xabce6a['result'][0x0][_0x5774('0x12')];_0x274478(_0x2c72d4);}else{return createRemoteTag(_0x48919e,_0xe956d0,_0x50468e,_0x58c880)[_0x5774('0xe')](function(_0x410b93){_0x274478(_0x410b93);});}});});}function assignTagToIncident(_0x316bfb,_0x178407,_0x4e437e,_0x5c7d82,_0x5a435e){return new Promise(function(_0xbce78a,_0x20ed71){var _0x44e43b={'method':_0x5774('0x25'),'uri':_0x4e437e+_0x5774('0x4a')+'?'+_0x5a435e,'body':{'label':_0x316bfb,'table':'incident','id_type':_0x5774('0x4b'),'table_key':_0x5c7d82[_0x5774('0x46')],'title':'Incident\x20-\x20'+_0x5c7d82[_0x5774('0x4c')],'id_display':_0x5c7d82[_0x5774('0x4c')]},'auth':_0x178407,'json':!![]};return rp(_0x44e43b)[_0x5774('0xe')](function(_0x1cbdec){_0xbce78a();})[_0x5774('0x15')](function(){_0xbce78a();});});}function manageTags(_0xb10b39,_0x4439ad,_0x4212fa,_0x45bc59,_0x4d4f12,_0xe6d42d,_0x173e8a){return new Promise(function(_0x1143c3,_0x109686){var _0x32366e=[];_0x4439ad[_0x5774('0x2f')](function(_0xbf935c){_0x32366e[_0x5774('0x4d')](getRemoteTag(_0xbf935c,_0x4212fa,_0x45bc59,_0xe6d42d,_0x173e8a));});return Promise[_0x5774('0x4e')](_0x32366e)['then'](function(_0x2be9b0){if(_0x2be9b0['length']){logger[_0x5774('0x17')]('['+[_0xb10b39[_0x5774('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x2be9b0);var _0x3d7c62=[];_0x2be9b0[_0x5774('0x2f')](function(_0x170f31){_0x3d7c62['push'](assignTagToIncident(_0x170f31,_0x4212fa,_0x45bc59,_0x4d4f12,_0xe6d42d));});return Promise[_0x5774('0x4e')](_0x3d7c62)[_0x5774('0xe')](function(){_0x1143c3();})[_0x5774('0x15')](function(){_0x1143c3();});}else{_0x1143c3();}});});}function getTags(_0x12e666,_0xf3b477,_0x1fb5db,_0x89d81d,_0x36ca1c,_0x97214b){return function(_0x35adfe){return new Promise(function(_0x2ffd6e,_0x359bd5){var _0x1970e0=[];var _0x28e49e=_0x89d81d['Tags'];if(_0x28e49e&&_0x28e49e[_0x5774('0xf')]>0x0){_0x1970e0=_[_0x5774('0x4f')](_0x28e49e,_0x5774('0x3d'));}if(_0x1970e0[_0x5774('0xf')]>0x0){return manageTags(_0x12e666,_0x1970e0,_0xf3b477,_0x1fb5db,_0x35adfe,_0x36ca1c,_0x97214b)[_0x5774('0xe')](function(){_0x2ffd6e(_0x35adfe);});}else{_0x2ffd6e(_0x35adfe);}});};}function emit(_0x154bbd,_0x95c6c1,_0x294afd){var _0x255894='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x5774('0x50')+_0x5774('0x51');var _0x3d5e6a={'uri':_0x154bbd+_0x5774('0x52')+_0x294afd+_0x255894};io['to'](util[_0x5774('0x53')](_0x5774('0x54'),_0x95c6c1))[_0x5774('0x55')]('trigger:browser:url',_0x3d5e6a);}exports['cs']=function(_0x481839,_0x378789,_0x298d17,_0x3eaf2f,_0x58a859,_0x205589,_0xfdc124,_0x4a4574){var _0x21d13b={};var _0x2a650d={'user':_0x205589['username'],'pass':_0x205589[_0x5774('0x56')]};var _0x76929e=_0x5774('0x57');var _0x1f43f1=_0x5774('0x58');_0x205589[_0x5774('0x59')]=intUtil[_0x5774('0x5a')](_0x205589[_0x5774('0x59')]);_0x205589[_0x5774('0x5b')]=intUtil[_0x5774('0x5a')](_0x205589[_0x5774('0x5b')]);var _0x1a73a4=util['format'](_0x5774('0x5c'),_0x205589[_0x5774('0x59')]);_0x21d13b[_0x5774('0x19')]=!_[_0x5774('0x5d')](_0x3eaf2f)?_0x3eaf2f[_0x5774('0x5e')]:null;_0x21d13b[_0x5774('0x20')]=_0x205589[_0x5774('0x5e')];_0x21d13b[_0x5774('0x28')]=_0x4a4574[_0x5774('0x35')]()==='outbound'?_0x378789[_0x5774('0x5f')]:_0x378789['calleridnum'];_0x21d13b['callDirection']=_0x4a4574===_0x5774('0x60')||_0x4a4574==='unmanaged'?_0x5774('0x60'):_0x5774('0x3f');var _0xa759d2=util[_0x5774('0x53')](_0x5774('0x61'),_0x205589[_0x5774('0x5b')],_0x378789[_0x5774('0x62')],md5(_0x378789[_0x5774('0x62')]));if(_0x58a859&&_0x58a859[_0x5774('0x63')]){logger[_0x5774('0x17')](_0x5774('0x64'),'Recording\x20is\x20enabled!');_0x378789[_0x5774('0x65')]=_0xa759d2;}else if(_0xfdc124&&_0xfdc124[_0x5774('0x66')]&&_0xfdc124[_0x5774('0x66')]!=='none'){logger[_0x5774('0x17')](_0x5774('0x67'),_0x5774('0x68'));_0x378789[_0x5774('0x65')]=_0xa759d2;}else{_0x378789[_0x5774('0x65')]='';}return getAdminUser(_0x4a4574,_0x2a650d,_0x21d13b,_0x1a73a4,_0x1f43f1,_0x76929e)[_0x5774('0xe')](getUser(_0x4a4574,_0x2a650d,_0x1a73a4,_0x1f43f1,_0x76929e))[_0x5774('0xe')](getEndUser(_0x4a4574,_0x2a650d,_0x1a73a4,_0x1f43f1,_0x76929e))[_0x5774('0xe')](getTicket(_0x4a4574,_0x2a650d,_0x1a73a4,_0x298d17,_0x378789,_0x1f43f1))['then'](function(_0x4ff8df){logger['info'](util[_0x5774('0x53')](_0x5774('0x69'),_0x4ff8df['ticketId']));logger[_0x5774('0x17')](util[_0x5774('0x53')]('call\x20direction:\x20%s',_0x4a4574));if(_0x4a4574!==_0x5774('0x6a')){logger['info']('['+[_0x4a4574['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x205589[_0x5774('0x59')],_0x3eaf2f[_0x5774('0x3d')],_0x4ff8df['ticketId']);}})['catch'](function(_0x1172cc){logger['error']('['+[_0x4a4574[_0x5774('0x13')]()]+_0x5774('0x6b'),util['inspect'](_0x1172cc,{'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 75aaf11..12b490c 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 _0x9b2d=['Enduser\x20found!','first_name','Caller\x20-\x20%s','[HTTP]','merge','map','nameField','customField','toLowerCase','type','string','idField','custom_fields','push','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','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:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Fields','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','%s/service/v4_1/rest.php','lastevent','Inbound','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','description','Descriptions','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','set_entry','JSON','Basic\x20%s','apiKey','toString','base64','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','Agent\x20found!','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','stringify','format','phone_home'];(function(_0x49ea62,_0x1ee28e){var _0x52207f=function(_0x3b0a33){while(--_0x3b0a33){_0x49ea62['push'](_0x49ea62['shift']());}};_0x52207f(++_0x1ee28e);}(_0x9b2d,0x128));var _0xd9b2=function(_0x101095,_0x2c2eb4){_0x101095=_0x101095-0x0;var _0x5cea00=_0x9b2d[_0x101095];return _0x5cea00;};'use strict';var _=require(_0xd9b2('0x0'));var rp=require(_0xd9b2('0x1'));var BPromise=require(_0xd9b2('0x2'));var md5=require(_0xd9b2('0x3'));var util=require(_0xd9b2('0x4'));var Redis=require(_0xd9b2('0x5'));var intUtil=require('./util');var config=require(_0xd9b2('0x6'));var logger=require(_0xd9b2('0x7'))(_0xd9b2('0x8'));config[_0xd9b2('0x9')]=_[_0xd9b2('0xa')](config['redis'],{'host':_0xd9b2('0xb'),'port':0x18eb});var io=require(_0xd9b2('0xc'))(new Redis(config[_0xd9b2('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x9beea8,_0x45699f,_0x192d9a){io['to'](_0x9beea8)['emit'](_0x45699f,_0x192d9a);}function getTicket(_0xc66f5,_0x173f1f,_0x3bf485,_0x1c26e2,_0x340de0,_0x1dd82a,_0x4f1517,_0x2c3030){logger[_0xd9b2('0xd')](_0xd9b2('0xe'));var _0x5e738c=new Date();var _0x3b2474=[{'name':_0xd9b2('0xf'),'value':intUtil['getString'](_0x1c26e2[_0xd9b2('0x10')],_0x340de0,'\x20')},{'name':_0xd9b2('0x11'),'value':_0x173f1f['id']},{'name':'created_by','value':_0x173f1f['id']},{'name':_0xd9b2('0x12'),'value':intUtil['getString'](_0x1c26e2[_0xd9b2('0x13')],_0x340de0,'\x0a')},{'name':'date_start','value':_0x5e738c['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xd9b2('0x14'),'value':'0'},{'name':_0xd9b2('0x15'),'value':'15'},{'name':_0xd9b2('0x16'),'value':_0x3bf485['id']},{'name':'parent_type','value':_0xd9b2('0x17')},{'name':_0xd9b2('0x18'),'value':_0x3bf485['name']},{'name':_0xd9b2('0x19'),'value':_0x2c3030}];if(_0x1dd82a[_0xd9b2('0x1a')]){_[_0xd9b2('0x1b')](_0x1dd82a,function(_0x26e2cf){if(_0x340de0[_0x26e2cf[_0xd9b2('0x1c')]]){_0x3b2474['push']({'name':_0x26e2cf['idField'],'value':_0x340de0[_0x26e2cf[_0xd9b2('0x1c')]]});}});}return request({'form':{'method':_0xd9b2('0x1d'),'input_type':'JSON','response_type':_0xd9b2('0x1e'),'rest_data':JSON['stringify']({'session':_0x4f1517['id'],'module_name':'Calls','name_value_list':_0x3b2474})}});}function getAuth(_0x1b841f){return util['format'](_0xd9b2('0x1f'),new Buffer(_0x1b841f[_0xd9b2('0x20')]+':X')[_0xd9b2('0x21')](_0xd9b2('0x22')));}function getServerInfo(_0x32deb2){return request({'form':{'method':'get_server_info','input_type':_0xd9b2('0x1e'),'response_type':_0xd9b2('0x1e'),'rest_data':JSON['stringify']({'session':_0x32deb2['id']})}});}function getUser(_0x34c98b,_0x2b5872,_0x710bd){if(!_['isNil'](_0x2b5872)){logger[_0xd9b2('0xd')]('Getting\x20agent\x20with\x20name',_0x2b5872);return request({'form':{'method':_0xd9b2('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x710bd['id'],'module_name':_0xd9b2('0x24'),'query':util['format'](_0xd9b2('0x25'),_0x2b5872),'order_by':'','offset':'0','select_fields':['id',_0xd9b2('0xf'),_0xd9b2('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd9b2('0x27')](function(_0x2820f3){if(_0x2820f3['entry_list'][_0xd9b2('0x1a')]){var _0x55ed3d=_[_0xd9b2('0x28')](_0x2820f3[_0xd9b2('0x29')],function(_0x3d72ca){return _0x3d72ca[_0xd9b2('0x2a')][_0xd9b2('0x26')]['value']===_0x2b5872;});if(_0x55ed3d){logger[_0xd9b2('0xd')](_0xd9b2('0x2b'));return BPromise[_0xd9b2('0x2c')]({'id':_0x55ed3d[_0xd9b2('0x2a')]['id'][_0xd9b2('0x2d')],'name':_0x55ed3d['name_value_list'][_0xd9b2('0xf')][_0xd9b2('0x2d')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd9b2('0x2c')]({'id':_0x710bd[_0xd9b2('0x2a')][_0xd9b2('0x2e')][_0xd9b2('0x2d')],'name':_0x710bd[_0xd9b2('0x2a')][_0xd9b2('0x26')][_0xd9b2('0x2d')]});});}else{logger['info'](_0xd9b2('0x2f'));return BPromise[_0xd9b2('0x2c')]({'id':_0x710bd[_0xd9b2('0x2a')]['user_id'][_0xd9b2('0x2d')],'name':_0x710bd[_0xd9b2('0x2a')][_0xd9b2('0x26')][_0xd9b2('0x2d')]});}}function getEndUser(_0xe8e453,_0x2502ef,_0x350f86,_0x578e76){logger[_0xd9b2('0xd')](_0xd9b2('0x30'),_0x350f86);return request({'form':{'method':_0xd9b2('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd9b2('0x31')]({'session':_0x578e76['id'],'module_name':_0xd9b2('0x17'),'query':util[_0xd9b2('0x32')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x350f86),'order_by':'','offset':'0','select_fields':['id',_0xd9b2('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x442fde){if(_0x442fde[_0xd9b2('0x29')][_0xd9b2('0x1a')]){var _0x35b948=_[_0xd9b2('0x28')](_0x442fde[_0xd9b2('0x29')],function(_0x3d3d92){return _0x3d3d92[_0xd9b2('0x2a')][_0xd9b2('0x33')][_0xd9b2('0x2d')]===_0x350f86;});if(_0x35b948){logger['info'](_0xd9b2('0x34'));return BPromise[_0xd9b2('0x2c')]({'id':_0x35b948[_0xd9b2('0x2a')]['id'][_0xd9b2('0x2d')],'name':_0x35b948['name_value_list'][_0xd9b2('0xf')][_0xd9b2('0x2d')],'phone':_0x35b948['name_value_list'][_0xd9b2('0x33')][_0xd9b2('0x2d')]});}}else{logger[_0xd9b2('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xd9b2('0x1e'),'response_type':_0xd9b2('0x1e'),'rest_data':JSON[_0xd9b2('0x31')]({'session':_0x578e76['id'],'module_name':'Contacts','name_value_list':[{'name':_0xd9b2('0x35'),'value':_0x2502ef!==''?_0x2502ef:util[_0xd9b2('0x32')](_0xd9b2('0x36'),_0x350f86)},{'name':_0xd9b2('0x33'),'value':_0x350f86}]})}})[_0xd9b2('0x27')](function(_0x5947f9){logger[_0xd9b2('0xd')]('Enduser\x20created.');return BPromise[_0xd9b2('0x2c')]({'id':_0x5947f9['id'],'name':_0x5947f9[_0xd9b2('0x29')][_0xd9b2('0x35')]['value'],'phone':_0x5947f9[_0xd9b2('0x29')][_0xd9b2('0x33')][_0xd9b2('0x2d')]});});}});}function request(_0x4efb94){logger['debug'](_0xd9b2('0x37'),JSON[_0xd9b2('0x31')](_0x4efb94));return rp(_[_0xd9b2('0x38')](def,_0x4efb94));}function getTags(_0x46e0a5,_0xc7f1c4){var _0x2166fc=[];if(_0x46e0a5&&_0x46e0a5[_0xd9b2('0x1a')]>0x0){_0x2166fc=_[_0xd9b2('0x39')](_0x46e0a5,_0xc7f1c4);}return _0x2166fc;}function getCustomFields(_0x27a36e,_0x1f3787){var _0x524d39=[];var _0x3fc7c0={'custom_fields':[]};if(_0x27a36e[_0xd9b2('0x1a')]>0x0){_[_0xd9b2('0x1b')](_0x27a36e,function(_0x55ba2e){if(_0x55ba2e['type']==='string'&&_0x55ba2e[_0xd9b2('0x3a')]&&!_0x55ba2e[_0xd9b2('0x3b')]){_0x3fc7c0[_0x55ba2e[_0xd9b2('0x3a')][_0xd9b2('0x3c')]()]=_0x55ba2e['content'][_0xd9b2('0x21')]();}else if(_0x55ba2e[_0xd9b2('0x3d')]===_0xd9b2('0x3e')&&_0x55ba2e[_0xd9b2('0x3f')]&&_0x55ba2e[_0xd9b2('0x3b')]){_0x3fc7c0[_0xd9b2('0x40')][_0xd9b2('0x41')]({'id':_0x55ba2e[_0xd9b2('0x3f')],'value':_0x55ba2e['content'][_0xd9b2('0x21')]()});}else if(_0x55ba2e['type']===_0xd9b2('0x42')&&_0x55ba2e[_0xd9b2('0x1c')]&&_0x55ba2e[_0xd9b2('0x3f')]&&_0x55ba2e[_0xd9b2('0x3b')]){_0x1f3787[_0x55ba2e['variableName']]&&_0x3fc7c0['custom_fields']['push']({'id':_0x55ba2e[_0xd9b2('0x3f')],'value':_0x1f3787[_0x55ba2e[_0xd9b2('0x1c')]][_0xd9b2('0x21')]()});}else if(_0x55ba2e[_0xd9b2('0x3d')]===_0xd9b2('0x43')&&_0x55ba2e[_0xd9b2('0x44')]&&_0x55ba2e[_0xd9b2('0x44')][_0xd9b2('0xf')]&&_0x55ba2e[_0xd9b2('0x3f')]&&_0x55ba2e[_0xd9b2('0x3b')]){_0x1f3787[_0x55ba2e[_0xd9b2('0x44')][_0xd9b2('0xf')][_0xd9b2('0x3c')]()]&&_0x3fc7c0[_0xd9b2('0x40')]['push']({'id':_0x55ba2e[_0xd9b2('0x3f')],'value':_0x1f3787[_0x55ba2e[_0xd9b2('0x44')][_0xd9b2('0xf')][_0xd9b2('0x3c')]()][_0xd9b2('0x21')]()});}});}return _0x3fc7c0;}function getConnection(_0x5bd196){return request({'method':'POST','form':{'method':_0xd9b2('0x45'),'input_type':_0xd9b2('0x1e'),'response_type':_0xd9b2('0x1e'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5bd196[_0xd9b2('0x46')],'password':_0x5bd196[_0xd9b2('0x47')],'encryption':_0xd9b2('0x48')},'application':_0xd9b2('0x49')})}})['then'](function(_0x209b30){var _0x5246ad=_0x209b30;if(_0x5246ad['id']){def[_0xd9b2('0x4a')]=_0x5246ad['id'];return BPromise['resolve'](_0x5246ad);}else{throw new Error(util['format'](_0xd9b2('0x4b'),_0x5bd196['id']));}});}function setRelationship(_0x10ac7f,_0x32c04b,_0x540b35,_0x5d6912){return request({'form':{'method':_0xd9b2('0x4c'),'input_type':_0xd9b2('0x1e'),'response_type':_0xd9b2('0x1e'),'rest_data':JSON[_0xd9b2('0x31')]({'session':_0x10ac7f['id'],'module_name':'Calls','module_id':_0x540b35['id'],'link_field_name':_0x5d6912,'related_ids':[_0x32c04b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xd9b2('0x4d')]=function(_0x2cee07,_0x580e8d,_0x5d0d68,_0x546749,_0x224732,_0x453033){var _0x1276b2,_0x146446,_0x3e974e,_0x3862ba;_0x453033[_0xd9b2('0x4e')]=intUtil[_0xd9b2('0x4f')](_0x453033[_0xd9b2('0x4e')]);_0x453033['serverUrl']=intUtil[_0xd9b2('0x4f')](_0x453033[_0xd9b2('0x50')]);def[_0xd9b2('0x51')]=util[_0xd9b2('0x32')]('%s/service/v4_1/rest.php',_0x453033['remoteUri']);if(_0x224732&&_0x224732[_0xd9b2('0x52')]){logger[_0xd9b2('0xd')](_0xd9b2('0x53'),_0xd9b2('0x54'));_0x580e8d[_0xd9b2('0x55')]=util[_0xd9b2('0x32')](_0xd9b2('0x56'),_0x453033[_0xd9b2('0x50')],_0x580e8d[_0xd9b2('0x57')],md5(_0x580e8d['uniqueid']));}else{_0x580e8d[_0xd9b2('0x55')]='';}return getConnection(_0x453033)[_0xd9b2('0x27')](function(_0x35f84f){_0x3862ba=_0x35f84f;return getUser(_0x453033,_0x546749[_0xd9b2('0xf')],_0x3862ba);})['then'](function(_0x56da64){_0x1276b2=_0x56da64;logger[_0xd9b2('0xd')](_0xd9b2('0x58'),_0x1276b2['id']);return getEndUser(_0x453033,_0x580e8d[_0xd9b2('0x59')],_0x580e8d[_0xd9b2('0x5a')],_0x3862ba);})[_0xd9b2('0x27')](function(_0x36a1d7){_0x146446=_0x36a1d7;logger[_0xd9b2('0xd')](_0xd9b2('0x5b'),_0x146446['id']);return getTicket(_0x453033,_0x1276b2,_0x146446,_0x5d0d68,_0x580e8d,_0x5d0d68['Fields'],_0x3862ba,'Inbound');})[_0xd9b2('0x27')](function(_0x45224f){_0x3e974e=_0x45224f;logger[_0xd9b2('0xd')](_0xd9b2('0x5c'));logger['info'](_0xd9b2('0x5d'),_0x3e974e['id']);return setRelationship(_0x3862ba,_0x1276b2,_0x3e974e,_0xd9b2('0x5e'));})[_0xd9b2('0x27')](function(){return setRelationship(_0x3862ba,_0x146446,_0x3e974e,_0xd9b2('0x5f'));})[_0xd9b2('0x27')](function(){return getServerInfo(_0x3862ba);})[_0xd9b2('0x27')](function(_0x36af1a){var _0x431ef9=parseInt(_0x36af1a[_0xd9b2('0x60')]['charAt'](0x0));var _0x2894d1=util[_0xd9b2('0x32')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x453033[_0xd9b2('0x4e')],_0x3e974e['id']);if(_0x431ef9>0x6){_0x2894d1=util[_0xd9b2('0x32')](_0xd9b2('0x61'),_0x453033['remoteUri'],_0x3e974e['id']);}logger[_0xd9b2('0xd')](_0xd9b2('0x53'),_0xd9b2('0x62'));emit(util[_0xd9b2('0x32')]('user:%s',_0x546749[_0xd9b2('0xf')]),_0xd9b2('0x63'),{'uri':_0x2894d1});})[_0xd9b2('0x64')](function(_0x25e7f9){logger[_0xd9b2('0x65')](_0xd9b2('0x53'),JSON[_0xd9b2('0x31')](_0x25e7f9));});};exports[_0xd9b2('0x66')]=function(_0x473c4e,_0x4b4546,_0xe33a5d,_0x2a9998,_0x17f47b,_0x2ccee1,_0x48dc1e){var _0x5770fd,_0x54a26c,_0x4eed34,_0x321477;_0x2ccee1[_0xd9b2('0x4e')]=intUtil[_0xd9b2('0x4f')](_0x2ccee1[_0xd9b2('0x4e')]);_0x2ccee1[_0xd9b2('0x50')]=intUtil[_0xd9b2('0x4f')](_0x2ccee1['serverUrl']);def[_0xd9b2('0x51')]=util[_0xd9b2('0x32')]('%s/service/v4_1/rest.php',_0x2ccee1[_0xd9b2('0x4e')]);if(_0x48dc1e&&_0x48dc1e[_0xd9b2('0x67')]&&_0x48dc1e[_0xd9b2('0x67')]!==_0xd9b2('0x68')){logger['info']('[OUTBOUND]',_0xd9b2('0x54'));_0x4b4546[_0xd9b2('0x55')]=util['format'](_0xd9b2('0x56'),_0x2ccee1[_0xd9b2('0x50')],_0x4b4546[_0xd9b2('0x57')],md5(_0x4b4546['uniqueid']));}return getConnection(_0x2ccee1)[_0xd9b2('0x27')](function(_0x1d0e2b){_0x321477=_0x1d0e2b;return getUser(_0x2ccee1,_0x2a9998[_0xd9b2('0xf')],_0x321477);})['then'](function(_0x5d8d14){_0x5770fd=_0x5d8d14;logger[_0xd9b2('0xd')](_0xd9b2('0x58'),_0x5770fd['id']);return getEndUser(_0x2ccee1,_0x4b4546[_0xd9b2('0x69')],_0x4b4546[_0xd9b2('0x6a')],_0x321477);})[_0xd9b2('0x27')](function(_0x536814){_0x54a26c=_0x536814;logger['info'](_0xd9b2('0x5b'),_0x54a26c['id']);return getTicket(_0x2ccee1,_0x5770fd,_0x54a26c,_0xe33a5d,_0x4b4546,_0xe33a5d[_0xd9b2('0x6b')],_0x321477,_0xd9b2('0x6c'));})[_0xd9b2('0x27')](function(_0x1c92c4){_0x4eed34=_0x1c92c4;logger[_0xd9b2('0xd')](_0xd9b2('0x5c'));logger[_0xd9b2('0xd')](_0xd9b2('0x5d'),_0x4eed34['id']);return setRelationship(_0x321477,_0x5770fd,_0x4eed34,_0xd9b2('0x5e'));})[_0xd9b2('0x27')](function(){return setRelationship(_0x321477,_0x54a26c,_0x4eed34,_0xd9b2('0x5f'));})['then'](function(){return getServerInfo(_0x321477);})[_0xd9b2('0x27')](function(_0x56de3c){var _0x53a236=parseInt(_0x56de3c[_0xd9b2('0x60')][_0xd9b2('0x6d')](0x0));var _0x3e2234=util[_0xd9b2('0x32')](_0xd9b2('0x6e'),_0x2ccee1['remoteUri'],_0x4eed34['id']);if(_0x53a236>0x6){_0x3e2234=util[_0xd9b2('0x32')](_0xd9b2('0x61'),_0x2ccee1['remoteUri'],_0x4eed34['id']);}logger[_0xd9b2('0xd')](_0xd9b2('0x6f'),_0xd9b2('0x62'));emit(util['format']('user:%s',_0x2a9998[_0xd9b2('0xf')]),'trigger:browser:url',{'uri':_0x3e2234});})[_0xd9b2('0x64')](function(_0x127281){logger['error'](_0xd9b2('0x6f'),JSON[_0xd9b2('0x31')](_0x127281));});};exports[_0xd9b2('0x70')]=function(_0x307566,_0x129fe3,_0x5dd5e2,_0x21f3c8,_0x366dc7,_0x332ce7){var _0x134e04,_0x2a2c65,_0x4b439c,_0x4f3712;_0x332ce7[_0xd9b2('0x4e')]=intUtil[_0xd9b2('0x4f')](_0x332ce7[_0xd9b2('0x4e')]);_0x332ce7['serverUrl']=intUtil[_0xd9b2('0x4f')](_0x332ce7['serverUrl']);def[_0xd9b2('0x51')]=util[_0xd9b2('0x32')](_0xd9b2('0x71'),_0x332ce7[_0xd9b2('0x4e')]);if(_0x366dc7&&_0x366dc7[_0xd9b2('0x52')]){logger['info']('['+_0x129fe3[_0xd9b2('0x72')]['toUpperCase']()+']',_0xd9b2('0x54'));_0x129fe3['recordingURL']=util[_0xd9b2('0x32')](_0xd9b2('0x56'),_0x332ce7[_0xd9b2('0x50')],_0x129fe3[_0xd9b2('0x57')],md5(_0x129fe3['uniqueid']));}else{_0x129fe3[_0xd9b2('0x55')]='';}return getConnection(_0x332ce7)[_0xd9b2('0x27')](function(_0x113408){_0x4f3712=_0x113408;if(!_['isNil'](_0x21f3c8)){return getUser(_0x332ce7,_0x21f3c8['name'],_0x4f3712);}else{return getUser(_0x332ce7,null,_0x4f3712);}})[_0xd9b2('0x27')](function(_0x4de6d5){_0x134e04=_0x4de6d5;logger[_0xd9b2('0xd')](_0xd9b2('0x58'),_0x134e04['id']);return getEndUser(_0x332ce7,_0x129fe3['calleridname'],_0x129fe3[_0xd9b2('0x5a')],_0x4f3712);})['then'](function(_0x5136a8){_0x2a2c65=_0x5136a8;logger[_0xd9b2('0xd')](_0xd9b2('0x5b'),_0x2a2c65['id']);return getTicket(_0x332ce7,_0x134e04,_0x2a2c65,_0x5dd5e2,_0x129fe3,_0x5dd5e2[_0xd9b2('0x6b')],_0x4f3712,_0xd9b2('0x73'));})[_0xd9b2('0x27')](function(_0x3a3e9b){_0x4b439c=_0x3a3e9b;logger[_0xd9b2('0xd')](_0xd9b2('0x5c'));logger[_0xd9b2('0xd')](_0xd9b2('0x5d'),_0x4b439c['id']);return setRelationship(_0x4f3712,_0x134e04,_0x4b439c,'users');})[_0xd9b2('0x27')](function(){return setRelationship(_0x4f3712,_0x2a2c65,_0x4b439c,_0xd9b2('0x5f'));})[_0xd9b2('0x27')](function(){return getServerInfo(_0x4f3712);})[_0xd9b2('0x64')](function(_0x4b1b41){logger[_0xd9b2('0x65')]('['+_0x129fe3[_0xd9b2('0x72')]['toUpperCase']()+']',JSON['stringify'](_0x4b1b41));});}; \ No newline at end of file +var _0x3a42=['recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','Ticket\x20created!','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','length','forEach','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','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','merge','string','nameField','customField','toLowerCase','content','type','variable','Variable','custom_fields','login','username','password','PLAIN','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','outbound','uri'];(function(_0x4a92e2,_0x2190c5){var _0x425690=function(_0x9d6016){while(--_0x9d6016){_0x4a92e2['push'](_0x4a92e2['shift']());}};_0x425690(++_0x2190c5);}(_0x3a42,0x103));var _0x23a4=function(_0x5de62a,_0x598b61){_0x5de62a=_0x5de62a-0x0;var _0x170063=_0x3a42[_0x5de62a];return _0x170063;};'use strict';var _=require(_0x23a4('0x0'));var rp=require(_0x23a4('0x1'));var BPromise=require(_0x23a4('0x2'));var md5=require(_0x23a4('0x3'));var util=require(_0x23a4('0x4'));var Redis=require(_0x23a4('0x5'));var intUtil=require(_0x23a4('0x6'));var config=require('../../../../config/environment');var logger=require(_0x23a4('0x7'))(_0x23a4('0x8'));config[_0x23a4('0x9')]=_[_0x23a4('0xa')](config['redis'],{'host':_0x23a4('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0x23a4('0xc'),'json':!![]};function emit(_0x5142b3,_0x22e02c,_0xc47d47){io['to'](_0x5142b3)[_0x23a4('0xd')](_0x22e02c,_0xc47d47);}function getTicket(_0x2ba12a,_0x43b5ed,_0x40cfdf,_0x5e1767,_0x167a24,_0x453f60,_0x5d0732,_0x4e4cbc){logger[_0x23a4('0xe')](_0x23a4('0xf'));var _0x464ef3=new Date();var _0x4ee016=[{'name':_0x23a4('0x10'),'value':intUtil[_0x23a4('0x11')](_0x5e1767[_0x23a4('0x12')],_0x167a24,'\x20')},{'name':'assigned_user_id','value':_0x43b5ed['id']},{'name':_0x23a4('0x13'),'value':_0x43b5ed['id']},{'name':_0x23a4('0x14'),'value':intUtil[_0x23a4('0x11')](_0x5e1767[_0x23a4('0x15')],_0x167a24,'\x0a')},{'name':'date_start','value':_0x464ef3[_0x23a4('0x16')]()[_0x23a4('0x17')](0x0,0x13)[_0x23a4('0x18')]('T','\x20')},{'name':_0x23a4('0x19'),'value':'0'},{'name':_0x23a4('0x1a'),'value':'15'},{'name':_0x23a4('0x1b'),'value':_0x40cfdf['id']},{'name':_0x23a4('0x1c'),'value':_0x23a4('0x1d')},{'name':'parent_name','value':_0x40cfdf['name']},{'name':'direction','value':_0x4e4cbc}];if(_0x453f60[_0x23a4('0x1e')]){_[_0x23a4('0x1f')](_0x453f60,function(_0x2f4230){if(_0x167a24[_0x2f4230[_0x23a4('0x20')]]){_0x4ee016[_0x23a4('0x21')]({'name':_0x2f4230[_0x23a4('0x22')],'value':_0x167a24[_0x2f4230['variableName']]});}});}return request({'form':{'method':_0x23a4('0x23'),'input_type':'JSON','response_type':_0x23a4('0x24'),'rest_data':JSON[_0x23a4('0x25')]({'session':_0x5d0732['id'],'module_name':_0x23a4('0x26'),'name_value_list':_0x4ee016})}});}function getAuth(_0x705d9b){return util[_0x23a4('0x27')](_0x23a4('0x28'),new Buffer(_0x705d9b['apiKey']+':X')[_0x23a4('0x29')](_0x23a4('0x2a')));}function getServerInfo(_0x11f860){return request({'form':{'method':_0x23a4('0x2b'),'input_type':_0x23a4('0x24'),'response_type':_0x23a4('0x24'),'rest_data':JSON[_0x23a4('0x25')]({'session':_0x11f860['id']})}});}function getUser(_0x317f40,_0x4858f5,_0x55598f){if(!_[_0x23a4('0x2c')](_0x4858f5)){logger[_0x23a4('0xe')](_0x23a4('0x2d'),_0x4858f5);return request({'form':{'method':_0x23a4('0x2e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x23a4('0x25')]({'session':_0x55598f['id'],'module_name':'Employees','query':util['format'](_0x23a4('0x2f'),_0x4858f5),'order_by':'','offset':'0','select_fields':['id',_0x23a4('0x10'),_0x23a4('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4a0496){if(_0x4a0496[_0x23a4('0x31')][_0x23a4('0x1e')]){var _0x1366b4=_['find'](_0x4a0496[_0x23a4('0x31')],function(_0x17d4f4){return _0x17d4f4['name_value_list'][_0x23a4('0x30')][_0x23a4('0x32')]===_0x4858f5;});if(_0x1366b4){logger[_0x23a4('0xe')](_0x23a4('0x33'));return BPromise[_0x23a4('0x34')]({'id':_0x1366b4[_0x23a4('0x35')]['id'][_0x23a4('0x32')],'name':_0x1366b4[_0x23a4('0x35')][_0x23a4('0x10')][_0x23a4('0x32')]});}}logger[_0x23a4('0xe')](_0x23a4('0x36'));return BPromise[_0x23a4('0x34')]({'id':_0x55598f[_0x23a4('0x35')][_0x23a4('0x37')][_0x23a4('0x32')],'name':_0x55598f['name_value_list'][_0x23a4('0x30')]['value']});});}else{logger['info'](_0x23a4('0x38'));return BPromise[_0x23a4('0x34')]({'id':_0x55598f[_0x23a4('0x35')]['user_id'][_0x23a4('0x32')],'name':_0x55598f[_0x23a4('0x35')][_0x23a4('0x30')][_0x23a4('0x32')]});}}function getEndUser(_0x47cda1,_0x2f72e6,_0x183354,_0x2ca745){logger[_0x23a4('0xe')]('Searching\x20enduser\x20with\x20phone',_0x183354);return request({'form':{'method':_0x23a4('0x2e'),'input_type':_0x23a4('0x24'),'response_type':_0x23a4('0x24'),'rest_data':JSON[_0x23a4('0x25')]({'session':_0x2ca745['id'],'module_name':_0x23a4('0x1d'),'query':util[_0x23a4('0x27')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x183354),'order_by':'','offset':'0','select_fields':['id',_0x23a4('0x10'),_0x23a4('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x23a4('0x3a')](function(_0x1df7a0){if(_0x1df7a0[_0x23a4('0x31')]['length']){var _0x5f7ee9=_[_0x23a4('0x3b')](_0x1df7a0[_0x23a4('0x31')],function(_0x226bd0){return _0x226bd0['name_value_list']['phone_home'][_0x23a4('0x32')]===_0x183354;});if(_0x5f7ee9){logger[_0x23a4('0xe')](_0x23a4('0x3c'));return BPromise[_0x23a4('0x34')]({'id':_0x5f7ee9[_0x23a4('0x35')]['id'][_0x23a4('0x32')],'name':_0x5f7ee9[_0x23a4('0x35')][_0x23a4('0x10')][_0x23a4('0x32')],'phone':_0x5f7ee9[_0x23a4('0x35')][_0x23a4('0x39')][_0x23a4('0x32')]});}}else{logger[_0x23a4('0xe')](_0x23a4('0x3d'));return request({'form':{'method':'set_entry','input_type':_0x23a4('0x24'),'response_type':_0x23a4('0x24'),'rest_data':JSON[_0x23a4('0x25')]({'session':_0x2ca745['id'],'module_name':_0x23a4('0x1d'),'name_value_list':[{'name':'first_name','value':_0x2f72e6!==_0x23a4('0x3e')?_0x2f72e6:util[_0x23a4('0x27')](_0x23a4('0x3f'),_0x183354)},{'name':_0x23a4('0x39'),'value':_0x183354}]})}})[_0x23a4('0x3a')](function(_0x592833){logger['info'](_0x23a4('0x40'));return BPromise[_0x23a4('0x34')]({'id':_0x592833['id'],'name':_0x592833['entry_list'][_0x23a4('0x41')][_0x23a4('0x32')],'phone':_0x592833[_0x23a4('0x31')]['phone_home'][_0x23a4('0x32')]});});}});}function request(_0x4313c0){logger[_0x23a4('0x42')]('[HTTP]',JSON[_0x23a4('0x25')](_0x4313c0));return rp(_[_0x23a4('0x43')](def,_0x4313c0));}function getTags(_0x1e8f57,_0x3d36ce){var _0x22a0fe=[];if(_0x1e8f57&&_0x1e8f57[_0x23a4('0x1e')]>0x0){_0x22a0fe=_['map'](_0x1e8f57,_0x3d36ce);}return _0x22a0fe;}function getCustomFields(_0x3efce7,_0xdedf6){var _0x39dcf5=[];var _0x3dfce2={'custom_fields':[]};if(_0x3efce7[_0x23a4('0x1e')]>0x0){_[_0x23a4('0x1f')](_0x3efce7,function(_0x44f931){if(_0x44f931['type']===_0x23a4('0x44')&&_0x44f931[_0x23a4('0x45')]&&!_0x44f931[_0x23a4('0x46')]){_0x3dfce2[_0x44f931[_0x23a4('0x45')][_0x23a4('0x47')]()]=_0x44f931[_0x23a4('0x48')][_0x23a4('0x29')]();}else if(_0x44f931['type']===_0x23a4('0x44')&&_0x44f931['idField']&&_0x44f931[_0x23a4('0x46')]){_0x3dfce2['custom_fields'][_0x23a4('0x21')]({'id':_0x44f931['idField'],'value':_0x44f931[_0x23a4('0x48')]['toString']()});}else if(_0x44f931[_0x23a4('0x49')]===_0x23a4('0x4a')&&_0x44f931[_0x23a4('0x20')]&&_0x44f931[_0x23a4('0x22')]&&_0x44f931[_0x23a4('0x46')]){_0xdedf6[_0x44f931[_0x23a4('0x20')]]&&_0x3dfce2['custom_fields'][_0x23a4('0x21')]({'id':_0x44f931['idField'],'value':_0xdedf6[_0x44f931[_0x23a4('0x20')]][_0x23a4('0x29')]()});}else if(_0x44f931['type']==='customVariable'&&_0x44f931[_0x23a4('0x4b')]&&_0x44f931[_0x23a4('0x4b')][_0x23a4('0x10')]&&_0x44f931[_0x23a4('0x22')]&&_0x44f931[_0x23a4('0x46')]){_0xdedf6[_0x44f931['Variable'][_0x23a4('0x10')][_0x23a4('0x47')]()]&&_0x3dfce2[_0x23a4('0x4c')]['push']({'id':_0x44f931[_0x23a4('0x22')],'value':_0xdedf6[_0x44f931[_0x23a4('0x4b')]['name'][_0x23a4('0x47')]()]['toString']()});}});}return _0x3dfce2;}function getConnection(_0x8cecc0){return request({'method':_0x23a4('0xc'),'form':{'method':_0x23a4('0x4d'),'input_type':_0x23a4('0x24'),'response_type':'JSON','rest_data':JSON[_0x23a4('0x25')]({'user_auth':{'user_name':_0x8cecc0[_0x23a4('0x4e')],'password':_0x8cecc0[_0x23a4('0x4f')],'encryption':_0x23a4('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x23a4('0x3a')](function(_0x4529eb){var _0x13d5a7=_0x4529eb;if(_0x13d5a7['id']){def[_0x23a4('0x51')]=_0x13d5a7['id'];return BPromise[_0x23a4('0x34')](_0x13d5a7);}else{throw new Error(util[_0x23a4('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x8cecc0['id']));}});}function setRelationship(_0x5977ff,_0x557e1f,_0x54797e,_0x5bdcf9){return request({'form':{'method':_0x23a4('0x52'),'input_type':_0x23a4('0x24'),'response_type':_0x23a4('0x24'),'rest_data':JSON[_0x23a4('0x25')]({'session':_0x5977ff['id'],'module_name':'Calls','module_id':_0x54797e['id'],'link_field_name':_0x5bdcf9,'related_ids':[_0x557e1f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x23a4('0x53')]=function(_0x50fdbe,_0x298243,_0x4c5e7d,_0x1cc2f0,_0x37e189,_0xc8da2c){var _0x10926a,_0x20c065,_0x2371fc,_0x34ac98;_0xc8da2c[_0x23a4('0x54')]=intUtil['stripTrailingSlash'](_0xc8da2c[_0x23a4('0x54')]);_0xc8da2c['serverUrl']=intUtil[_0x23a4('0x55')](_0xc8da2c[_0x23a4('0x56')]);def['uri']=util[_0x23a4('0x27')](_0x23a4('0x57'),_0xc8da2c[_0x23a4('0x54')]);if(_0x37e189&&_0x37e189[_0x23a4('0x58')]){logger[_0x23a4('0xe')](_0x23a4('0x59'),_0x23a4('0x5a'));_0x298243[_0x23a4('0x5b')]=util[_0x23a4('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc8da2c['serverUrl'],_0x298243['uniqueid'],md5(_0x298243[_0x23a4('0x5c')]));}else{_0x298243['recordingURL']='';}return getConnection(_0xc8da2c)[_0x23a4('0x3a')](function(_0x1da269){_0x34ac98=_0x1da269;return getUser(_0xc8da2c,_0x1cc2f0[_0x23a4('0x10')],_0x34ac98);})['then'](function(_0x100613){_0x10926a=_0x100613;logger['info'](_0x23a4('0x5d'),_0x10926a['id']);return getEndUser(_0xc8da2c,_0x298243[_0x23a4('0x5e')],_0x298243[_0x23a4('0x5f')],_0x34ac98);})[_0x23a4('0x3a')](function(_0x18f8a7){_0x20c065=_0x18f8a7;logger[_0x23a4('0xe')](_0x23a4('0x60'),_0x20c065['id']);return getTicket(_0xc8da2c,_0x10926a,_0x20c065,_0x4c5e7d,_0x298243,_0x4c5e7d[_0x23a4('0x61')],_0x34ac98,_0x23a4('0x62'));})[_0x23a4('0x3a')](function(_0x10a7a3){_0x2371fc=_0x10a7a3;logger[_0x23a4('0xe')]('Ticket\x20created!');logger[_0x23a4('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2371fc['id']);return setRelationship(_0x34ac98,_0x10926a,_0x2371fc,_0x23a4('0x63'));})[_0x23a4('0x3a')](function(){return setRelationship(_0x34ac98,_0x20c065,_0x2371fc,_0x23a4('0x64'));})[_0x23a4('0x3a')](function(){return getServerInfo(_0x34ac98);})['then'](function(_0xe3839f){var _0x527b9f=parseInt(_0xe3839f[_0x23a4('0x65')][_0x23a4('0x66')](0x0));var _0x5694e8=util[_0x23a4('0x27')](_0x23a4('0x67'),_0xc8da2c[_0x23a4('0x54')],_0x2371fc['id']);if(_0x527b9f>0x6){_0x5694e8=util[_0x23a4('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xc8da2c[_0x23a4('0x54')],_0x2371fc['id']);}logger[_0x23a4('0xe')](_0x23a4('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x23a4('0x27')](_0x23a4('0x68'),_0x1cc2f0[_0x23a4('0x10')]),_0x23a4('0x69'),{'uri':_0x5694e8});})[_0x23a4('0x6a')](function(_0x2f5167){logger[_0x23a4('0x6b')](_0x23a4('0x59'),JSON[_0x23a4('0x25')](_0x2f5167));});};exports[_0x23a4('0x6c')]=function(_0x5b07e3,_0x3a5825,_0x1ffe0a,_0xa5a502,_0x1db9d4,_0x115785,_0x38722c){var _0x1b4a35,_0x2bda4f,_0x5b376c,_0x33d5a0;_0x115785['remoteUri']=intUtil[_0x23a4('0x55')](_0x115785[_0x23a4('0x54')]);_0x115785[_0x23a4('0x56')]=intUtil[_0x23a4('0x55')](_0x115785[_0x23a4('0x56')]);def[_0x23a4('0x6d')]=util[_0x23a4('0x27')](_0x23a4('0x57'),_0x115785[_0x23a4('0x54')]);if(_0x38722c&&_0x38722c['recordingFormat']&&_0x38722c[_0x23a4('0x6e')]!==_0x23a4('0x6f')){logger[_0x23a4('0xe')](_0x23a4('0x70'),_0x23a4('0x5a'));_0x3a5825[_0x23a4('0x5b')]=util['format'](_0x23a4('0x71'),_0x115785['serverUrl'],_0x3a5825[_0x23a4('0x5c')],md5(_0x3a5825['uniqueid']));}return getConnection(_0x115785)['then'](function(_0x49288d){_0x33d5a0=_0x49288d;return getUser(_0x115785,_0xa5a502[_0x23a4('0x10')],_0x33d5a0);})[_0x23a4('0x3a')](function(_0xa1713c){_0x1b4a35=_0xa1713c;logger[_0x23a4('0xe')](_0x23a4('0x5d'),_0x1b4a35['id']);return getEndUser(_0x115785,_0x3a5825[_0x23a4('0x72')],_0x3a5825[_0x23a4('0x73')],_0x33d5a0);})['then'](function(_0x1e85e1){_0x2bda4f=_0x1e85e1;logger[_0x23a4('0xe')](_0x23a4('0x60'),_0x2bda4f['id']);return getTicket(_0x115785,_0x1b4a35,_0x2bda4f,_0x1ffe0a,_0x3a5825,_0x1ffe0a[_0x23a4('0x61')],_0x33d5a0,_0x23a4('0x74'));})[_0x23a4('0x3a')](function(_0x4f96f4){_0x5b376c=_0x4f96f4;logger['info']('Ticket\x20created!');logger[_0x23a4('0xe')](_0x23a4('0x75'),_0x5b376c['id']);return setRelationship(_0x33d5a0,_0x1b4a35,_0x5b376c,_0x23a4('0x63'));})[_0x23a4('0x3a')](function(){return setRelationship(_0x33d5a0,_0x2bda4f,_0x5b376c,_0x23a4('0x64'));})[_0x23a4('0x3a')](function(){return getServerInfo(_0x33d5a0);})[_0x23a4('0x3a')](function(_0x1d8fd9){var _0x3317cc=parseInt(_0x1d8fd9[_0x23a4('0x65')][_0x23a4('0x66')](0x0));var _0x30acd9=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x115785[_0x23a4('0x54')],_0x5b376c['id']);if(_0x3317cc>0x6){_0x30acd9=util[_0x23a4('0x27')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x115785[_0x23a4('0x54')],_0x5b376c['id']);}logger[_0x23a4('0xe')](_0x23a4('0x70'),_0x23a4('0x76'));emit(util[_0x23a4('0x27')](_0x23a4('0x68'),_0xa5a502[_0x23a4('0x10')]),_0x23a4('0x69'),{'uri':_0x30acd9});})[_0x23a4('0x6a')](function(_0x1d216c){logger[_0x23a4('0x6b')](_0x23a4('0x70'),JSON[_0x23a4('0x25')](_0x1d216c));});};exports[_0x23a4('0x77')]=function(_0x2d6a12,_0x5e9819,_0x170d25,_0x5ebb80,_0x134f4b,_0x5453eb){var _0x106261,_0x363865,_0x2871b8,_0xaa5eb9;_0x5453eb[_0x23a4('0x54')]=intUtil[_0x23a4('0x55')](_0x5453eb['remoteUri']);_0x5453eb['serverUrl']=intUtil[_0x23a4('0x55')](_0x5453eb[_0x23a4('0x56')]);def['uri']=util[_0x23a4('0x27')](_0x23a4('0x57'),_0x5453eb[_0x23a4('0x54')]);if(_0x134f4b&&_0x134f4b[_0x23a4('0x58')]){logger[_0x23a4('0xe')]('['+_0x5e9819[_0x23a4('0x78')][_0x23a4('0x79')]()+']',_0x23a4('0x5a'));_0x5e9819[_0x23a4('0x5b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5453eb['serverUrl'],_0x5e9819[_0x23a4('0x5c')],md5(_0x5e9819[_0x23a4('0x5c')]));}else{_0x5e9819['recordingURL']='';}return getConnection(_0x5453eb)[_0x23a4('0x3a')](function(_0x2969cc){_0xaa5eb9=_0x2969cc;if(!_['isNil'](_0x5ebb80)){return getUser(_0x5453eb,_0x5ebb80['name'],_0xaa5eb9);}else{return getUser(_0x5453eb,null,_0xaa5eb9);}})['then'](function(_0x77bdef){_0x106261=_0x77bdef;logger[_0x23a4('0xe')](_0x23a4('0x5d'),_0x106261['id']);return getEndUser(_0x5453eb,_0x5e9819['calleridname'],_0x5e9819[_0x23a4('0x5f')],_0xaa5eb9);})[_0x23a4('0x3a')](function(_0x55b86b){_0x363865=_0x55b86b;logger['info'](_0x23a4('0x60'),_0x363865['id']);return getTicket(_0x5453eb,_0x106261,_0x363865,_0x170d25,_0x5e9819,_0x170d25[_0x23a4('0x61')],_0xaa5eb9,_0x23a4('0x62'));})[_0x23a4('0x3a')](function(_0x41bbc9){_0x2871b8=_0x41bbc9;logger['info'](_0x23a4('0x7a'));logger['info'](_0x23a4('0x75'),_0x2871b8['id']);return setRelationship(_0xaa5eb9,_0x106261,_0x2871b8,_0x23a4('0x63'));})[_0x23a4('0x3a')](function(){return setRelationship(_0xaa5eb9,_0x363865,_0x2871b8,_0x23a4('0x64'));})[_0x23a4('0x3a')](function(){return getServerInfo(_0xaa5eb9);})[_0x23a4('0x6a')](function(_0x4433b7){logger['error']('['+_0x5e9819[_0x23a4('0x78')][_0x23a4('0x79')]()+']',JSON[_0x23a4('0x25')](_0x4433b7));});}; \ 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 1971a33..4cbfc43 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 _0x446a=['isNil','test','lodash','util','length','sortBy','string','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring'];(function(_0x32b15a,_0x59ce91){var _0x265029=function(_0x4e1d0f){while(--_0x4e1d0f){_0x32b15a['push'](_0x32b15a['shift']());}};_0x265029(++_0x59ce91);}(_0x446a,0x1e8));var _0xa446=function(_0x5c9b0f,_0x436e79){_0x5c9b0f=_0x5c9b0f-0x0;var _0x50d36f=_0x446a[_0x5c9b0f];return _0x50d36f;};'use strict';var _=require(_0xa446('0x0'));var util=require(_0xa446('0x1'));exports['getString']=function(_0x366839,_0x3dcd62,_0x116a5f){var _0xae97e0=[];if(_0x366839[_0xa446('0x2')]>0x0){var _0x38b53b=_[_0xa446('0x3')](_0x366839,['id']);for(var _0x2ef119=0x0;_0x2ef119<_0x38b53b[_0xa446('0x2')];_0x2ef119++){var _0x29b368=_0x38b53b[_0x2ef119];if(_0x29b368['type']===_0xa446('0x4')){_0xae97e0[_0xa446('0x5')](_0x29b368[_0xa446('0x6')]);}else if(_0x29b368[_0xa446('0x7')]===_0xa446('0x8')&&_0x29b368[_0xa446('0x9')]){_0x3dcd62[_0x29b368['variableName']]&&_0xae97e0[_0xa446('0x5')](_0x3dcd62[_0x29b368[_0xa446('0x9')]][_0xa446('0xa')]());}else if(_0x29b368[_0xa446('0x7')]===_0xa446('0xb')&&_0x29b368[_0xa446('0xc')]&&_0x29b368[_0xa446('0xc')][_0xa446('0xd')]){_0x3dcd62[_0x29b368[_0xa446('0xc')][_0xa446('0xd')][_0xa446('0xe')]()]&&_0xae97e0[_0xa446('0x5')](_0x3dcd62[_0x29b368['Variable'][_0xa446('0xd')]['toLowerCase']()][_0xa446('0xa')]());}else if(_0x29b368['type']===_0xa446('0xf')){if(_0x29b368[_0xa446('0x10')]===_0xa446('0x4')&&_0x29b368[_0xa446('0x11')]){_0xae97e0[_0xa446('0x5')](util[_0xa446('0x12')]('%s:\x20%s',_0x29b368['key'],_0x29b368[_0xa446('0x13')]));}else if(_0x29b368[_0xa446('0x10')]==='variable'&&_0x29b368[_0xa446('0x9')]&&_0x29b368['key']){_0x3dcd62[_0x29b368[_0xa446('0x9')]]&&_0xae97e0[_0xa446('0x5')](util[_0xa446('0x12')](_0xa446('0x14'),_0x29b368[_0xa446('0x11')],_0x3dcd62[_0x29b368[_0xa446('0x9')]]));}else if(_0x29b368[_0xa446('0x10')]===_0xa446('0xb')&&_0x29b368[_0xa446('0xc')]&&_0x29b368[_0xa446('0xc')][_0xa446('0xd')]&&_0x29b368[_0xa446('0x11')]){_0x3dcd62[_0x29b368[_0xa446('0xc')][_0xa446('0xd')][_0xa446('0xe')]()]&&_0xae97e0[_0xa446('0x5')](util[_0xa446('0x12')]('%s:\x20%s',_0x29b368[_0xa446('0x11')],_0x3dcd62[_0x29b368[_0xa446('0xc')]['name'][_0xa446('0xe')]()]));}}}}return _0xae97e0[_0xa446('0x15')](_0x116a5f);};exports[_0xa446('0x16')]=function(_0x120ddb){var _0x13af85=_0x120ddb[_0xa446('0x17')](-0x1);if(_0x13af85==='/'){_0x120ddb=_0x120ddb[_0xa446('0x18')](0x0,_0x120ddb['lastIndexOf'](_0x13af85));}return _0x120ddb;};exports['validateEmail']=function(_0x2bee97){if(!_[_0xa446('0x19')](_0x2bee97)&&_0x2bee97!==''){var _0x13ccaf=/^(([^<>()\[\]\\.,;:\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 _0x13ccaf[_0xa446('0x1a')](String(_0x2bee97)[_0xa446('0xe')]());}else{return![];}}; \ No newline at end of file +var _0x67fe=['keyType','string','key','push','format','keyContent','variable','join','stripTrailingSlash','slice','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x4f6cc2,_0x3652b0){var _0x1f3163=function(_0x51c4e6){while(--_0x51c4e6){_0x4f6cc2['push'](_0x4f6cc2['shift']());}};_0x1f3163(++_0x3652b0);}(_0x67fe,0xaf));var _0xe67f=function(_0x207e3b,_0x45f48c){_0x207e3b=_0x207e3b-0x0;var _0xa8121a=_0x67fe[_0x207e3b];return _0xa8121a;};'use strict';var _=require(_0xe67f('0x0'));var util=require(_0xe67f('0x1'));exports[_0xe67f('0x2')]=function(_0x3f47e9,_0x3a0454,_0x2509d6){var _0x5ad6c0=[];if(_0x3f47e9[_0xe67f('0x3')]>0x0){var _0x5889bb=_[_0xe67f('0x4')](_0x3f47e9,['id']);for(var _0x313ac6=0x0;_0x313ac6<_0x5889bb['length'];_0x313ac6++){var _0x19ae49=_0x5889bb[_0x313ac6];if(_0x19ae49[_0xe67f('0x5')]==='string'){_0x5ad6c0['push'](_0x19ae49[_0xe67f('0x6')]);}else if(_0x19ae49[_0xe67f('0x5')]==='variable'&&_0x19ae49[_0xe67f('0x7')]){_0x3a0454[_0x19ae49['variableName']]&&_0x5ad6c0['push'](_0x3a0454[_0x19ae49[_0xe67f('0x7')]][_0xe67f('0x8')]());}else if(_0x19ae49[_0xe67f('0x5')]===_0xe67f('0x9')&&_0x19ae49['Variable']&&_0x19ae49[_0xe67f('0xa')][_0xe67f('0xb')]){_0x3a0454[_0x19ae49[_0xe67f('0xa')][_0xe67f('0xb')][_0xe67f('0xc')]()]&&_0x5ad6c0['push'](_0x3a0454[_0x19ae49['Variable'][_0xe67f('0xb')][_0xe67f('0xc')]()][_0xe67f('0x8')]());}else if(_0x19ae49['type']===_0xe67f('0xd')){if(_0x19ae49[_0xe67f('0xe')]===_0xe67f('0xf')&&_0x19ae49[_0xe67f('0x10')]){_0x5ad6c0[_0xe67f('0x11')](util[_0xe67f('0x12')]('%s:\x20%s',_0x19ae49['key'],_0x19ae49[_0xe67f('0x13')]));}else if(_0x19ae49[_0xe67f('0xe')]===_0xe67f('0x14')&&_0x19ae49['variableName']&&_0x19ae49[_0xe67f('0x10')]){_0x3a0454[_0x19ae49['variableName']]&&_0x5ad6c0[_0xe67f('0x11')](util['format']('%s:\x20%s',_0x19ae49[_0xe67f('0x10')],_0x3a0454[_0x19ae49['variableName']]));}else if(_0x19ae49[_0xe67f('0xe')]==='customVariable'&&_0x19ae49['Variable']&&_0x19ae49[_0xe67f('0xa')][_0xe67f('0xb')]&&_0x19ae49['key']){_0x3a0454[_0x19ae49[_0xe67f('0xa')][_0xe67f('0xb')][_0xe67f('0xc')]()]&&_0x5ad6c0[_0xe67f('0x11')](util[_0xe67f('0x12')]('%s:\x20%s',_0x19ae49['key'],_0x3a0454[_0x19ae49[_0xe67f('0xa')][_0xe67f('0xb')]['toLowerCase']()]));}}}}return _0x5ad6c0[_0xe67f('0x15')](_0x2509d6);};exports[_0xe67f('0x16')]=function(_0x4e3da6){var _0x2fc003=_0x4e3da6[_0xe67f('0x17')](-0x1);if(_0x2fc003==='/'){_0x4e3da6=_0x4e3da6['substring'](0x0,_0x4e3da6['lastIndexOf'](_0x2fc003));}return _0x4e3da6;};exports[_0xe67f('0x18')]=function(_0x30f14f){if(!_[_0xe67f('0x19')](_0x30f14f)&&_0x30f14f!==''){var _0x3f3df7=/^(([^<>()\[\]\\.,;:\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 _0x3f3df7[_0xe67f('0x1a')](String(_0x30f14f)[_0xe67f('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index a440a99..bdb75a2 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 _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0xfb2afc,_0x27cbd3){var _0x5aafcf=function(_0x21992b){while(--_0x21992b){_0xfb2afc['push'](_0xfb2afc['shift']());}};_0x5aafcf(++_0x27cbd3);}(_0x34e8,0x12c));var _0x834e=function(_0x26a8a1,_0x5b4856){_0x26a8a1=_0x26a8a1-0x0;var _0x323f37=_0x34e8[_0x26a8a1];return _0x323f37;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 34094a1..0733022 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 _0x6710=['password','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','GET','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','custom_fields','push','variable','variableName','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','inspect','lodash','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6710,0xae));var _0x0671=function(_0x1ee72e,_0x434843){_0x1ee72e=_0x1ee72e-0x0;var _0x4025e8=_0x6710[_0x1ee72e];return _0x4025e8;};'use strict';var _=require(_0x0671('0x0'));var rp=require(_0x0671('0x1'));var md5=require(_0x0671('0x2'));var util=require(_0x0671('0x3'));var Redis=require(_0x0671('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x0671('0x5'))(_0x0671('0x6'));config[_0x0671('0x7')]=_['defaults'](config[_0x0671('0x7')],{'host':_0x0671('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xdfe773,_0x5db7c6,_0x10f0f0){io['to'](_0xdfe773)[_0x0671('0x9')](_0x5db7c6,_0x10f0f0);}var headers={'Content-Type':_0x0671('0xa'),'Accept':_0x0671('0xa')};function getTicket(_0x53a9b8,_0xe228bf,_0x89b8a,_0x2c459f,_0x373223){logger[_0x0671('0xb')](_0x0671('0xc'));return request({'uri':util[_0x0671('0xd')](_0x0671('0xe'),_0x53a9b8['remoteUri']),'method':_0x0671('0xf'),'body':{'ticket':_[_0x0671('0x10')]({'requester_id':_0x89b8a['id'],'submitter_id':_0xe228bf?_0xe228bf['id']:undefined,'assignee_id':_0xe228bf?_0xe228bf['id']:undefined,'tags':getTags(_0x2c459f[_0x0671('0x11')],'name'),'subject':intUtil[_0x0671('0x12')](_0x2c459f[_0x0671('0x13')],_0x373223,'\x20'),'description':intUtil[_0x0671('0x12')](_0x2c459f['Descriptions'],_0x373223,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0671('0x12')](_0x2c459f[_0x0671('0x14')],_0x373223,'\x0a')}},getCustomFields(_0x2c459f[_0x0671('0x15')],_0x373223))}})[_0x0671('0x16')](function(_0xceb23d){logger[_0x0671('0xb')]('Ticket\x20created!');return _0xceb23d['ticket'];});}function getUser(_0x6af36e,_0x17c767){if(intUtil[_0x0671('0x17')](_0x17c767)){logger['info'](_0x0671('0x18'),_0x17c767);return request({'uri':util[_0x0671('0xd')](_0x0671('0x19'),_0x6af36e[_0x0671('0x1a')]),'qs':{'query':util[_0x0671('0xd')](_0x0671('0x1b'),_0x17c767)}})['then'](function(_0x5bf760){if(_0x5bf760[_0x0671('0x1c')]){logger[_0x0671('0xb')](_0x0671('0x1d'));return _[_0x0671('0x1e')](_0x5bf760['results'],{'email':_0x17c767,'role':_0x0671('0x1f')});}else{logger[_0x0671('0xb')](_0x0671('0x20'));return request({'uri':util['format'](_0x0671('0x21'),_0x6af36e[_0x0671('0x1a')])})[_0x0671('0x16')](function(_0x539061){logger[_0x0671('0xb')](_0x0671('0x22'));return _0x539061['user'];});}});}else{logger[_0x0671('0xb')](_0x0671('0x20'));return request({'uri':util['format'](_0x0671('0x21'),_0x6af36e['remoteUri'])})['then'](function(_0xdef9db){logger['info'](_0x0671('0x22'));return _0xdef9db[_0x0671('0x23')];});}}function getEndUser(_0x1b0cc9,_0x397f63,_0x5d9347){logger[_0x0671('0xb')](_0x0671('0x24'),_0x5d9347);return request({'uri':util[_0x0671('0xd')]('%s/search.json',_0x1b0cc9[_0x0671('0x1a')]),'qs':{'query':util[_0x0671('0xd')](_0x0671('0x25'),_0x5d9347)}})[_0x0671('0x16')](function(_0x415682){var _0x33e134;if(_0x415682[_0x0671('0x26')][_0x0671('0x27')]){_0x415682[_0x0671('0x26')]=_[_0x0671('0x28')](_0x415682[_0x0671('0x26')],{'suspended':![],'role':_0x0671('0x29')});if(_0x415682[_0x0671('0x26')]['length']){_0x33e134=_[_0x0671('0x2a')](_0x415682['results']);}}if(_0x33e134){logger[_0x0671('0xb')](_0x0671('0x2b'));return _0x33e134;}else{logger['info'](_0x0671('0x2c'));return request({'uri':util['format']('%s/users.json',_0x1b0cc9[_0x0671('0x1a')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x0671('0xd')](_0x0671('0x2d'),_0x397f63||_0x5d9347),'phone':_0x5d9347}}})[_0x0671('0x16')](function(_0x3d0daa){logger[_0x0671('0xb')](_0x0671('0x2e'));return _0x3d0daa[_0x0671('0x23')];});}});}function getAuth(_0x61ba07){var _0x2e4f34;if(_0x61ba07[_0x0671('0x2f')]===_0x0671('0x30')){_0x2e4f34=util[_0x0671('0xd')]('%s:%s',_0x61ba07[_0x0671('0x31')],_0x61ba07[_0x0671('0x30')]);}else if(_0x61ba07['authType']===_0x0671('0x32')){_0x2e4f34=util[_0x0671('0xd')](_0x0671('0x33'),_0x61ba07['username'],_0x61ba07[_0x0671('0x32')]);}return util[_0x0671('0xd')](_0x0671('0x34'),new Buffer(_0x2e4f34)['toString'](_0x0671('0x35')));}function request(_0x58bf59){logger[_0x0671('0x36')](_0x0671('0x37'),JSON['stringify'](_0x58bf59));return rp(_['defaults'](_0x58bf59,{'method':_0x0671('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x50411c,_0x7181e9){var _0x4e0823=[];if(_0x50411c&&_0x50411c['length']>0x0){_0x4e0823=_['map'](_0x50411c,_0x7181e9);}return _0x4e0823;}function getCustomFields(_0x1d85a5,_0x4046ff){var _0x329712=[];var _0x164725={'custom_fields':[]};if(_0x1d85a5[_0x0671('0x27')]>0x0){_['forEach'](_0x1d85a5,function(_0x1c3029){if(_[_0x0671('0x39')]([_0x0671('0x3a'),_0x0671('0x3b')],_0x1c3029['type'])&&_0x1c3029[_0x0671('0x3c')]&&!_0x1c3029[_0x0671('0x3d')]){_0x164725[_0x1c3029['nameField'][_0x0671('0x3e')]()]=_0x1c3029[_0x0671('0x3f')][_0x0671('0x40')]();}else if(_[_0x0671('0x39')]([_0x0671('0x3a'),_0x0671('0x3b')],_0x1c3029[_0x0671('0x41')])&&_0x1c3029[_0x0671('0x42')]&&_0x1c3029[_0x0671('0x3d')]){_0x164725[_0x0671('0x43')][_0x0671('0x44')]({'id':_0x1c3029['idField'],'value':_0x1c3029[_0x0671('0x3f')][_0x0671('0x40')]()});}else if(_0x1c3029[_0x0671('0x41')]===_0x0671('0x45')&&_0x1c3029['variableName']&&_0x1c3029[_0x0671('0x42')]&&_0x1c3029[_0x0671('0x3d')]){_0x4046ff[_0x1c3029[_0x0671('0x46')]]&&_0x164725['custom_fields'][_0x0671('0x44')]({'id':_0x1c3029[_0x0671('0x42')],'value':_0x4046ff[_0x1c3029[_0x0671('0x46')]][_0x0671('0x40')]()});}else if(_0x1c3029[_0x0671('0x41')]==='customVariable'&&_0x1c3029[_0x0671('0x47')]&&_0x1c3029[_0x0671('0x47')][_0x0671('0x48')]&&_0x1c3029[_0x0671('0x42')]&&_0x1c3029[_0x0671('0x3d')]){_0x4046ff[_0x1c3029[_0x0671('0x47')]['name']['toLowerCase']()]&&_0x164725['custom_fields'][_0x0671('0x44')]({'id':_0x1c3029['idField'],'value':_0x4046ff[_0x1c3029[_0x0671('0x47')]['name'][_0x0671('0x3e')]()]['toString']()});}});}return _0x164725;}exports[_0x0671('0x49')]=function(_0x5ba083,_0x14802d,_0x18d455,_0x3a690f,_0x128c16,_0xcd5928){var _0x53a54e,_0x352fce;_0xcd5928[_0x0671('0x1a')]=intUtil['stripTrailingSlash'](_0xcd5928[_0x0671('0x1a')]);_0xcd5928[_0x0671('0x4a')]=intUtil[_0x0671('0x4b')](_0xcd5928[_0x0671('0x4a')]);if(_0x128c16&&_0x128c16[_0x0671('0x4c')]){logger[_0x0671('0xb')]('[QUEUE]',_0x0671('0x4d'));_0x14802d['recordingURL']=util[_0x0671('0xd')](_0x0671('0x4e'),_0xcd5928[_0x0671('0x4a')],_0x14802d[_0x0671('0x4f')],md5(_0x14802d[_0x0671('0x4f')]));}else{_0x14802d[_0x0671('0x50')]='';}headers[_0x0671('0x51')]=getAuth(_0xcd5928);return getUser(_0xcd5928,_0x3a690f[_0x0671('0x52')])[_0x0671('0x16')](function(_0x238cf2){_0x53a54e=_0x238cf2;logger[_0x0671('0xb')](_0x0671('0x53'),_0x53a54e['id']);return getEndUser(_0xcd5928,_0x14802d[_0x0671('0x54')],_0x14802d[_0x0671('0x55')]);})['then'](function(_0x2ad470){_0x352fce=_0x2ad470;logger[_0x0671('0xb')](_0x0671('0x56'),_0x352fce['id']);return getTicket(_0xcd5928,_0x53a54e,_0x352fce,_0x18d455,_0x14802d);})[_0x0671('0x16')](function(_0x35bd7f){if(_0x35bd7f){logger[_0x0671('0xb')](_0x0671('0x57'),_0x35bd7f['id']);switch(_0xcd5928[_0x0671('0x41')]){case _0x0671('0x58'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x0671('0x59'),_0xcd5928['remoteUri'],_0x53a54e['id'],_0x35bd7f['id']),'method':_0x0671('0xf')});case _0x0671('0x5a'):logger['info'](_0x0671('0x5b'),_0x0671('0x5c'));emit(util[_0x0671('0xd')]('user:%s',_0x3a690f[_0x0671('0x48')]),'trigger:browser:url',{'uri':util[_0x0671('0xd')]('%s/agent/tickets/%s',_0xcd5928[_0x0671('0x1a')][_0x0671('0x5d')](_0x0671('0x5e'),''),_0x35bd7f['id'])});break;default:logger[_0x0671('0x5f')](_0x0671('0x5b'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0671('0x60')](function(_0x24a293){logger[_0x0671('0x5f')](_0x0671('0x61'),util['inspect'](_0x24a293,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x379fdf,_0x2ab4bd,_0x2a2e06,_0xa732e5,_0x3c4001,_0x32dc5a,_0x5a58e1){var _0x497090,_0x192258;_0x32dc5a[_0x0671('0x1a')]=intUtil[_0x0671('0x4b')](_0x32dc5a[_0x0671('0x1a')]);_0x32dc5a['serverUrl']=intUtil[_0x0671('0x4b')](_0x32dc5a[_0x0671('0x4a')]);if(_0x5a58e1&&_0x5a58e1['recordingFormat']&&_0x5a58e1[_0x0671('0x62')]!==_0x0671('0x63')){logger[_0x0671('0xb')](_0x0671('0x64'),_0x0671('0x4d'));_0x2ab4bd[_0x0671('0x50')]=util['format'](_0x0671('0x4e'),_0x32dc5a['serverUrl'],_0x2ab4bd['uniqueid'],md5(_0x2ab4bd[_0x0671('0x4f')]));}headers[_0x0671('0x51')]=getAuth(_0x32dc5a);return getUser(_0x32dc5a,_0xa732e5[_0x0671('0x52')])['then'](function(_0x262acc){_0x497090=_0x262acc;logger[_0x0671('0xb')](_0x0671('0x53'),_0x497090['id']);return getEndUser(_0x32dc5a,_0x2ab4bd['destcalleridname'],_0x2ab4bd[_0x0671('0x65')]);})[_0x0671('0x16')](function(_0xe14270){_0x192258=_0xe14270;logger[_0x0671('0xb')](_0x0671('0x56'),_0x192258['id']);return getTicket(_0x32dc5a,_0x497090,_0x192258,_0x2a2e06,_0x2ab4bd);})[_0x0671('0x16')](function(_0x4d1d85){if(_0x4d1d85){logger[_0x0671('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4d1d85['id']);switch(_0x32dc5a[_0x0671('0x41')]){case _0x0671('0x58'):logger[_0x0671('0xb')]('[OUTBOUND]',_0x0671('0x66'));return request({'uri':util[_0x0671('0xd')](_0x0671('0x59'),_0x32dc5a[_0x0671('0x1a')],_0x497090['id'],_0x4d1d85['id']),'method':'POST'});case _0x0671('0x5a'):logger['info'](_0x0671('0x64'),_0x0671('0x5c'));emit(util['format'](_0x0671('0x67'),_0xa732e5[_0x0671('0x48')]),_0x0671('0x68'),{'uri':util['format'](_0x0671('0x69'),_0x32dc5a[_0x0671('0x1a')][_0x0671('0x5d')](_0x0671('0x5e'),''),_0x4d1d85['id'])});break;default:logger[_0x0671('0x5f')](_0x0671('0x64'),_0x0671('0x6a'));}}})[_0x0671('0x60')](function(_0x14751b){logger['error'](_0x0671('0x6b'),util['inspect'](_0x14751b,{'showHidden':!![],'depth':null}));});};exports[_0x0671('0x6c')]=function(_0x21e698,_0x5adc05,_0x2ccfa6,_0x525505,_0xeed16e,_0x32f53c){var _0xca6a54,_0x259bfd;_0x32f53c['remoteUri']=intUtil['stripTrailingSlash'](_0x32f53c[_0x0671('0x1a')]);_0x32f53c['serverUrl']=intUtil[_0x0671('0x4b')](_0x32f53c['serverUrl']);if(_0xeed16e&&_0xeed16e['monitor_format']){logger['info']('['+_0x5adc05['lastevent'][_0x0671('0x6d')]()+']',_0x0671('0x4d'));_0x5adc05[_0x0671('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x32f53c['serverUrl'],_0x5adc05[_0x0671('0x4f')],md5(_0x5adc05[_0x0671('0x4f')]));}else{_0x5adc05[_0x0671('0x50')]='';}headers[_0x0671('0x51')]=getAuth(_0x32f53c);return getUser(_0x32f53c)[_0x0671('0x16')](function(_0x5c1081){_0xca6a54=_0x5c1081;logger[_0x0671('0xb')](_0x0671('0x53'),_0xca6a54['id']);return getEndUser(_0x32f53c,_0x5adc05[_0x0671('0x54')],_0x5adc05['calleridnum']);})[_0x0671('0x16')](function(_0x14d58f){_0x259bfd=_0x14d58f;logger[_0x0671('0xb')]('The\x20Enduser\x20ID\x20is:',_0x259bfd['id']);return getTicket(_0x32f53c,_0xca6a54,_0x259bfd,_0x2ccfa6,_0x5adc05);})[_0x0671('0x16')](function(_0xbed017){if(_0xbed017){logger[_0x0671('0xb')](_0x0671('0x57'),_0xbed017['id']);}})['catch'](function(_0xc6d664){logger[_0x0671('0x5f')]('['+_0x5adc05['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x0671('0x6e')](_0xc6d664,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3cc9=['The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','trigger:browser:url','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','format','%s/search.json','type:user\x20role:agent\x20email:%s','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','remoteUri','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','results','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','content','idField','customField','push','variableName','custom_fields','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x1f01f8,_0xe249c5){var _0x31ea67=function(_0x5e05b5){while(--_0x5e05b5){_0x1f01f8['push'](_0x1f01f8['shift']());}};_0x31ea67(++_0xe249c5);}(_0x3cc9,0x105));var _0x93cc=function(_0x3e05a0,_0x2426a3){_0x3e05a0=_0x3e05a0-0x0;var _0x5084fc=_0x3cc9[_0x3e05a0];return _0x5084fc;};'use strict';var _=require(_0x93cc('0x0'));var rp=require(_0x93cc('0x1'));var md5=require(_0x93cc('0x2'));var util=require('util');var Redis=require(_0x93cc('0x3'));var intUtil=require(_0x93cc('0x4'));var config=require(_0x93cc('0x5'));var logger=require(_0x93cc('0x6'))('zendesk');config['redis']=_[_0x93cc('0x7')](config[_0x93cc('0x8')],{'host':_0x93cc('0x9'),'port':0x18eb});var io=require(_0x93cc('0xa'))(new Redis(config[_0x93cc('0x8')]));function emit(_0x43b9af,_0x4621a1,_0xe59ae6){io['to'](_0x43b9af)[_0x93cc('0xb')](_0x4621a1,_0xe59ae6);}var headers={'Content-Type':'application/json','Accept':_0x93cc('0xc')};function getTicket(_0x3f23b4,_0x4f0a03,_0x532578,_0x2f25c3,_0x29ecb8){logger[_0x93cc('0xd')](_0x93cc('0xe'));return request({'uri':util['format'](_0x93cc('0xf'),_0x3f23b4['remoteUri']),'method':_0x93cc('0x10'),'body':{'ticket':_[_0x93cc('0x11')]({'requester_id':_0x532578['id'],'submitter_id':_0x4f0a03?_0x4f0a03['id']:undefined,'assignee_id':_0x4f0a03?_0x4f0a03['id']:undefined,'tags':getTags(_0x2f25c3[_0x93cc('0x12')],'name'),'subject':intUtil[_0x93cc('0x13')](_0x2f25c3[_0x93cc('0x14')],_0x29ecb8,'\x20'),'description':intUtil[_0x93cc('0x13')](_0x2f25c3[_0x93cc('0x15')],_0x29ecb8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x93cc('0x13')](_0x2f25c3['Descriptions'],_0x29ecb8,'\x0a')}},getCustomFields(_0x2f25c3[_0x93cc('0x16')],_0x29ecb8))}})[_0x93cc('0x17')](function(_0x148a19){logger[_0x93cc('0xd')](_0x93cc('0x18'));return _0x148a19['ticket'];});}function getUser(_0x627d07,_0x5900a3){if(intUtil[_0x93cc('0x19')](_0x5900a3)){logger[_0x93cc('0xd')]('Getting\x20agent\x20with\x20email',_0x5900a3);return request({'uri':util[_0x93cc('0x1a')](_0x93cc('0x1b'),_0x627d07['remoteUri']),'qs':{'query':util['format'](_0x93cc('0x1c'),_0x5900a3)}})['then'](function(_0x2d9bb2){if(_0x2d9bb2['count']){logger[_0x93cc('0xd')]('Agent\x20found!');return _[_0x93cc('0x1d')](_0x2d9bb2['results'],{'email':_0x5900a3,'role':_0x93cc('0x1e')});}else{logger['info'](_0x93cc('0x1f'));return request({'uri':util[_0x93cc('0x1a')](_0x93cc('0x20'),_0x627d07['remoteUri'])})[_0x93cc('0x17')](function(_0x51258d){logger[_0x93cc('0xd')]('Admin\x20account\x20selected.');return _0x51258d[_0x93cc('0x21')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x93cc('0x1a')](_0x93cc('0x20'),_0x627d07[_0x93cc('0x22')])})[_0x93cc('0x17')](function(_0x441b65){logger[_0x93cc('0xd')](_0x93cc('0x23'));return _0x441b65['user'];});}}function getEndUser(_0x3f9e7f,_0x44c1f8,_0xa1820a){logger[_0x93cc('0xd')](_0x93cc('0x24'),_0xa1820a);return request({'uri':util[_0x93cc('0x1a')]('%s/search.json',_0x3f9e7f[_0x93cc('0x22')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0xa1820a)}})['then'](function(_0x378048){var _0x5e1e9c;if(_0x378048['results'][_0x93cc('0x25')]){_0x378048[_0x93cc('0x26')]=_[_0x93cc('0x27')](_0x378048[_0x93cc('0x26')],{'suspended':![],'role':'end-user'});if(_0x378048[_0x93cc('0x26')][_0x93cc('0x25')]){_0x5e1e9c=_[_0x93cc('0x28')](_0x378048[_0x93cc('0x26')]);}}if(_0x5e1e9c){logger[_0x93cc('0xd')](_0x93cc('0x29'));return _0x5e1e9c;}else{logger[_0x93cc('0xd')](_0x93cc('0x2a'));return request({'uri':util[_0x93cc('0x1a')](_0x93cc('0x2b'),_0x3f9e7f['remoteUri']),'method':_0x93cc('0x10'),'body':{'user':{'role':_0x93cc('0x2c'),'name':util['format'](_0x93cc('0x2d'),_0x44c1f8||_0xa1820a),'phone':_0xa1820a}}})[_0x93cc('0x17')](function(_0x5911e9){logger[_0x93cc('0xd')](_0x93cc('0x2e'));return _0x5911e9[_0x93cc('0x21')];});}});}function getAuth(_0x51bce7){var _0x1c215a;if(_0x51bce7['authType']===_0x93cc('0x2f')){_0x1c215a=util[_0x93cc('0x1a')](_0x93cc('0x30'),_0x51bce7[_0x93cc('0x31')],_0x51bce7[_0x93cc('0x2f')]);}else if(_0x51bce7[_0x93cc('0x32')]===_0x93cc('0x33')){_0x1c215a=util[_0x93cc('0x1a')](_0x93cc('0x34'),_0x51bce7[_0x93cc('0x31')],_0x51bce7[_0x93cc('0x33')]);}return util['format'](_0x93cc('0x35'),new Buffer(_0x1c215a)[_0x93cc('0x36')](_0x93cc('0x37')));}function request(_0x86a18e){logger[_0x93cc('0x38')](_0x93cc('0x39'),JSON[_0x93cc('0x3a')](_0x86a18e));return rp(_[_0x93cc('0x7')](_0x86a18e,{'method':_0x93cc('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x49aac2,_0x791812){var _0x2a4b55=[];if(_0x49aac2&&_0x49aac2['length']>0x0){_0x2a4b55=_[_0x93cc('0x3c')](_0x49aac2,_0x791812);}return _0x2a4b55;}function getCustomFields(_0x41cdc9,_0x33ee93){var _0x1519ac=[];var _0x3e37b1={'custom_fields':[]};if(_0x41cdc9[_0x93cc('0x25')]>0x0){_[_0x93cc('0x3d')](_0x41cdc9,function(_0x1a39dd){if(_[_0x93cc('0x3e')]([_0x93cc('0x3f'),_0x93cc('0x40')],_0x1a39dd[_0x93cc('0x41')])&&_0x1a39dd[_0x93cc('0x42')]&&!_0x1a39dd['customField']){_0x3e37b1[_0x1a39dd[_0x93cc('0x42')]['toLowerCase']()]=_0x1a39dd[_0x93cc('0x43')]['toString']();}else if(_['includes']([_0x93cc('0x3f'),'picklist'],_0x1a39dd[_0x93cc('0x41')])&&_0x1a39dd[_0x93cc('0x44')]&&_0x1a39dd[_0x93cc('0x45')]){_0x3e37b1['custom_fields'][_0x93cc('0x46')]({'id':_0x1a39dd['idField'],'value':_0x1a39dd['content']['toString']()});}else if(_0x1a39dd[_0x93cc('0x41')]==='variable'&&_0x1a39dd[_0x93cc('0x47')]&&_0x1a39dd[_0x93cc('0x44')]&&_0x1a39dd['customField']){_0x33ee93[_0x1a39dd['variableName']]&&_0x3e37b1[_0x93cc('0x48')][_0x93cc('0x46')]({'id':_0x1a39dd[_0x93cc('0x44')],'value':_0x33ee93[_0x1a39dd[_0x93cc('0x47')]]['toString']()});}else if(_0x1a39dd[_0x93cc('0x41')]===_0x93cc('0x49')&&_0x1a39dd[_0x93cc('0x4a')]&&_0x1a39dd[_0x93cc('0x4a')][_0x93cc('0x4b')]&&_0x1a39dd['idField']&&_0x1a39dd[_0x93cc('0x45')]){_0x33ee93[_0x1a39dd['Variable'][_0x93cc('0x4b')][_0x93cc('0x4c')]()]&&_0x3e37b1['custom_fields'][_0x93cc('0x46')]({'id':_0x1a39dd[_0x93cc('0x44')],'value':_0x33ee93[_0x1a39dd[_0x93cc('0x4a')]['name'][_0x93cc('0x4c')]()][_0x93cc('0x36')]()});}});}return _0x3e37b1;}exports[_0x93cc('0x4d')]=function(_0x211565,_0x1bf973,_0x1d2d87,_0x1ae6fd,_0xadbd7,_0x2f02f8){var _0x1e31b4,_0x2f0d34;_0x2f02f8[_0x93cc('0x22')]=intUtil[_0x93cc('0x4e')](_0x2f02f8['remoteUri']);_0x2f02f8[_0x93cc('0x4f')]=intUtil[_0x93cc('0x4e')](_0x2f02f8[_0x93cc('0x4f')]);if(_0xadbd7&&_0xadbd7['monitor_format']){logger['info'](_0x93cc('0x50'),_0x93cc('0x51'));_0x1bf973[_0x93cc('0x52')]=util['format'](_0x93cc('0x53'),_0x2f02f8[_0x93cc('0x4f')],_0x1bf973[_0x93cc('0x54')],md5(_0x1bf973[_0x93cc('0x54')]));}else{_0x1bf973[_0x93cc('0x52')]='';}headers['Authorization']=getAuth(_0x2f02f8);return getUser(_0x2f02f8,_0x1ae6fd[_0x93cc('0x55')])[_0x93cc('0x17')](function(_0x2658cc){_0x1e31b4=_0x2658cc;logger[_0x93cc('0xd')](_0x93cc('0x56'),_0x1e31b4['id']);return getEndUser(_0x2f02f8,_0x1bf973[_0x93cc('0x57')],_0x1bf973[_0x93cc('0x58')]);})['then'](function(_0x47ff31){_0x2f0d34=_0x47ff31;logger[_0x93cc('0xd')](_0x93cc('0x59'),_0x2f0d34['id']);return getTicket(_0x2f02f8,_0x1e31b4,_0x2f0d34,_0x1d2d87,_0x1bf973);})[_0x93cc('0x17')](function(_0x2ecc4a){if(_0x2ecc4a){logger['info'](_0x93cc('0x5a'),_0x2ecc4a['id']);switch(_0x2f02f8['type']){case _0x93cc('0x5b'):logger[_0x93cc('0xd')]('[QUEUE]',_0x93cc('0x5c'));return request({'uri':util[_0x93cc('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2f02f8[_0x93cc('0x22')],_0x1e31b4['id'],_0x2ecc4a['id']),'method':'POST'});case'newTab':logger[_0x93cc('0xd')](_0x93cc('0x50'),_0x93cc('0x5d'));emit(util[_0x93cc('0x1a')](_0x93cc('0x5e'),_0x1ae6fd[_0x93cc('0x4b')]),'trigger:browser:url',{'uri':util[_0x93cc('0x1a')](_0x93cc('0x5f'),_0x2f02f8['remoteUri'][_0x93cc('0x60')](_0x93cc('0x61'),''),_0x2ecc4a['id'])});break;default:logger['error'](_0x93cc('0x50'),_0x93cc('0x62'));}}})[_0x93cc('0x63')](function(_0x56dfa6){logger['error'](_0x93cc('0x64'),util[_0x93cc('0x65')](_0x56dfa6,{'showHidden':!![],'depth':null}));});};exports[_0x93cc('0x66')]=function(_0x54f0d0,_0x540b3e,_0x5459d4,_0x12c35a,_0x1c4ada,_0x51b51c,_0xc65b50){var _0x91e93c,_0x27a323;_0x51b51c[_0x93cc('0x22')]=intUtil[_0x93cc('0x4e')](_0x51b51c[_0x93cc('0x22')]);_0x51b51c[_0x93cc('0x4f')]=intUtil['stripTrailingSlash'](_0x51b51c[_0x93cc('0x4f')]);if(_0xc65b50&&_0xc65b50[_0x93cc('0x67')]&&_0xc65b50[_0x93cc('0x67')]!==_0x93cc('0x68')){logger['info'](_0x93cc('0x69'),_0x93cc('0x51'));_0x540b3e['recordingURL']=util[_0x93cc('0x1a')](_0x93cc('0x53'),_0x51b51c[_0x93cc('0x4f')],_0x540b3e[_0x93cc('0x54')],md5(_0x540b3e[_0x93cc('0x54')]));}headers[_0x93cc('0x6a')]=getAuth(_0x51b51c);return getUser(_0x51b51c,_0x12c35a[_0x93cc('0x55')])[_0x93cc('0x17')](function(_0x513e17){_0x91e93c=_0x513e17;logger['info'](_0x93cc('0x56'),_0x91e93c['id']);return getEndUser(_0x51b51c,_0x540b3e['destcalleridname'],_0x540b3e[_0x93cc('0x6b')]);})[_0x93cc('0x17')](function(_0x2e0b5d){_0x27a323=_0x2e0b5d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x27a323['id']);return getTicket(_0x51b51c,_0x91e93c,_0x27a323,_0x5459d4,_0x540b3e);})[_0x93cc('0x17')](function(_0x33282e){if(_0x33282e){logger[_0x93cc('0xd')]('The\x20Ticket\x20ID\x20is:',_0x33282e['id']);switch(_0x51b51c[_0x93cc('0x41')]){case _0x93cc('0x5b'):logger['info'](_0x93cc('0x69'),_0x93cc('0x5c'));return request({'uri':util[_0x93cc('0x1a')](_0x93cc('0x6c'),_0x51b51c[_0x93cc('0x22')],_0x91e93c['id'],_0x33282e['id']),'method':'POST'});case _0x93cc('0x6d'):logger[_0x93cc('0xd')]('[OUTBOUND]',_0x93cc('0x5d'));emit(util[_0x93cc('0x1a')](_0x93cc('0x5e'),_0x12c35a[_0x93cc('0x4b')]),_0x93cc('0x6e'),{'uri':util['format']('%s/agent/tickets/%s',_0x51b51c[_0x93cc('0x22')]['replace']('/api/v2',''),_0x33282e['id'])});break;default:logger[_0x93cc('0x6f')](_0x93cc('0x69'),_0x93cc('0x62'));}}})[_0x93cc('0x63')](function(_0x11ddf2){logger['error'](_0x93cc('0x70'),util[_0x93cc('0x65')](_0x11ddf2,{'showHidden':!![],'depth':null}));});};exports[_0x93cc('0x71')]=function(_0x286ead,_0x501ad6,_0x1aa758,_0x373357,_0x2fe690,_0x29a52a){var _0x424da5,_0x2ac2ae;_0x29a52a[_0x93cc('0x22')]=intUtil[_0x93cc('0x4e')](_0x29a52a['remoteUri']);_0x29a52a[_0x93cc('0x4f')]=intUtil['stripTrailingSlash'](_0x29a52a[_0x93cc('0x4f')]);if(_0x2fe690&&_0x2fe690[_0x93cc('0x72')]){logger['info']('['+_0x501ad6[_0x93cc('0x73')]['toUpperCase']()+']',_0x93cc('0x51'));_0x501ad6['recordingURL']=util[_0x93cc('0x1a')](_0x93cc('0x53'),_0x29a52a[_0x93cc('0x4f')],_0x501ad6[_0x93cc('0x54')],md5(_0x501ad6['uniqueid']));}else{_0x501ad6[_0x93cc('0x52')]='';}headers[_0x93cc('0x6a')]=getAuth(_0x29a52a);return getUser(_0x29a52a)[_0x93cc('0x17')](function(_0x43b865){_0x424da5=_0x43b865;logger[_0x93cc('0xd')]('The\x20User\x20ID\x20is:',_0x424da5['id']);return getEndUser(_0x29a52a,_0x501ad6['calleridname'],_0x501ad6['calleridnum']);})[_0x93cc('0x17')](function(_0x1329b4){_0x2ac2ae=_0x1329b4;logger['info'](_0x93cc('0x59'),_0x2ac2ae['id']);return getTicket(_0x29a52a,_0x424da5,_0x2ac2ae,_0x1aa758,_0x501ad6);})[_0x93cc('0x17')](function(_0x3c47d3){if(_0x3c47d3){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3c47d3['id']);}})['catch'](function(_0xb5c2e5){logger['error']('['+_0x501ad6['lastevent'][_0x93cc('0x74')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x93cc('0x65')](_0xb5c2e5,{'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 48dbf29..6bbd719 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 _0x637f=['split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','Agent\x20found!','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/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','lead','Creating\x20new\x20call...','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','mm:ss','endtime','Call_Duration','utc','diff','starttime','YYYY-MM-DDTHH:mm:ss','called','Call_Result','Called','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','destcalleridnum','Outbound','user:%s','trigger:browser:url','unmanaged','monitor_format','lastevent','The\x20User\x20ID\x20is:','toUpperCase','md5','./util','moment','ioredis','redis','defaults','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','idField','content','type','variable','variableName','toString','Variable','name','toLowerCase','indexOf'];(function(_0x4a1171,_0x57db6f){var _0x123743=function(_0x351d48){while(--_0x351d48){_0x4a1171['push'](_0x4a1171['shift']());}};_0x123743(++_0x57db6f);}(_0x637f,0x1af));var _0xf637=function(_0x44799d,_0x26c23a){_0x44799d=_0x44799d-0x0;var _0x4f4a20=_0x637f[_0x44799d];return _0x4f4a20;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xf637('0x0'));var util=require('util');var intUtil=require(_0xf637('0x1'));var moment=require(_0xf637('0x2'));var Redis=require(_0xf637('0x3'));var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0xf637('0x4')]=_[_0xf637('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf637('0x6'))(new Redis(config[_0xf637('0x4')]));function emit(_0xb2291e,_0x1b2b7c,_0x2daea3){io['to'](_0xb2291e)['emit'](_0x1b2b7c,_0x2daea3);}function request(_0x443b0e){logger[_0xf637('0x7')](_0xf637('0x8'),JSON[_0xf637('0x9')](_0x443b0e));return rp(_0x443b0e);}function getCustomFields(_0x5b6ce8,_0x563044){var _0x2e9acd={};if(_0x5b6ce8[_0xf637('0xa')]>0x0){_[_0xf637('0xb')](_0x5b6ce8,function(_0x5c7451){if(_[_0xf637('0xc')]([_0xf637('0xd'),_0xf637('0xe')],_0x5c7451['type'])&&_0x5c7451[_0xf637('0xf')]){_0x2e9acd[_0x5c7451[_0xf637('0xf')]]=_0x5c7451[_0xf637('0x10')]['toString']();}else if(_0x5c7451[_0xf637('0x11')]===_0xf637('0x12')&&_0x5c7451[_0xf637('0x13')]&&_0x5c7451[_0xf637('0xf')]&&_0x563044[_0x5c7451[_0xf637('0x13')]]){_0x2e9acd[_0x5c7451[_0xf637('0xf')]]=_0x563044[_0x5c7451['variableName']][_0xf637('0x14')]();}else if(_0x5c7451[_0xf637('0x11')]==='customVariable'&&_0x5c7451['Variable']&&_0x5c7451[_0xf637('0x15')][_0xf637('0x16')]&&_0x5c7451[_0xf637('0xf')]&&_0x563044[_0x5c7451[_0xf637('0x15')][_0xf637('0x16')][_0xf637('0x17')]()]){_0x2e9acd[_0x5c7451[_0xf637('0xf')]]=_0x563044[_0x5c7451[_0xf637('0x15')][_0xf637('0x16')][_0xf637('0x17')]()][_0xf637('0x14')]();}});}return _0x2e9acd;}function getName(_0x494c48){if(_0x494c48[_0xf637('0x18')]('\x20')>0x0){var _0xb4898=_0x494c48[_0xf637('0x19')](/ (.+)/);if(_0xb4898[0x1]){return _0xb4898;}}return[_0x494c48,_0x494c48];}var accountsTokens={};function getAccessToken(_0xb4c4ea){return new Promise(function(_0x2446e4,_0x2cd016){if(!_['isNil'](accountsTokens[_0xb4c4ea['id']])&&!_[_0xf637('0x1a')](accountsTokens[_0xb4c4ea['id']][_0xf637('0x1b')])){if(moment()[_0xf637('0x1c')](accountsTokens[_0xb4c4ea['id']][_0xf637('0x1d')])){_0x2446e4(accountsTokens[_0xb4c4ea['id']][_0xf637('0x1b')]);}}var _0x28502c;switch(_0xb4c4ea[_0xf637('0x1e')]){case'US':_0x28502c=_0xf637('0x1f');break;case'AU':_0x28502c='https://accounts.zoho.com.au';break;case'EU':_0x28502c=_0xf637('0x20');break;case'IN':_0x28502c='https://accounts.zoho.in';break;case'CN':_0x28502c=_0xf637('0x21');break;default:_0x28502c=_0xf637('0x20');break;}var _0x27940b={'method':_0xf637('0x22'),'uri':_0x28502c+_0xf637('0x23'),'qs':{'refresh_token':_0xb4c4ea[_0xf637('0x24')],'client_id':_0xb4c4ea['clientId'],'client_secret':_0xb4c4ea[_0xf637('0x25')],'grant_type':_0xf637('0x26')},'json':!![]};return rp(_0x27940b)['then'](function(_0xd2ba99){accountsTokens[_0xb4c4ea['id']]={'access_token':_0xd2ba99[_0xf637('0x1b')],'expires_in':moment()[_0xf637('0x27')](_0xd2ba99[_0xf637('0x1d')],_0xf637('0x28'))};_0x2446e4(_0xd2ba99[_0xf637('0x1b')]);})[_0xf637('0x29')](function(_0x372f88){logger[_0xf637('0x2a')]('Failing\x20creating\x20the\x20access_token',_0x372f88[_0xf637('0x2b')]);_0x2cd016(_0x372f88);});});}function getUser(_0x36b0c3,_0x24f038,_0xcb8519,_0x4a7077){logger[_0xf637('0x2c')](_0xf637('0x2d'));return request({'method':_0xf637('0x2e'),'uri':util[_0xf637('0x2f')](_0xf637('0x30'),_0x24f038),'qs':{'type':_0xf637('0x31')},'headers':{'Authorization':_0xf637('0x32')+_0x36b0c3},'json':!![]})[_0xf637('0x33')](function(_0x291f41){if(_0x291f41[_0xf637('0x34')]){var _0x5d9433=-0x1;if(_[_0xf637('0x35')](_0x291f41[_0xf637('0x34')])){if(!_[_0xf637('0x1a')](_0x4a7077)){_0x5d9433=_[_0xf637('0x36')](_0x291f41[_0xf637('0x34')],function(_0x48ae1e){return _0x48ae1e[_0xf637('0x37')]===_0x4a7077;});}if(_0x5d9433>=0x0){logger[_0xf637('0x2c')](_0xf637('0x38'));}else{logger[_0xf637('0x2c')](_0xf637('0x39'));_0x5d9433=_[_0xf637('0x36')](_0x291f41['users'],function(_0x3fbab7){return _0x3fbab7[_0xf637('0x3a')][_0xf637('0x16')]===_0xf637('0x3b');});}return _0x291f41[_0xf637('0x34')][_0x5d9433];}else{if(_0x291f41[_0xf637('0x3c')][_0xf637('0x3a')][_0xf637('0x16')]===_0xf637('0x3b')){logger[_0xf637('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x291f41['user'];return user;}else{logger[_0xf637('0x2a')](_0xf637('0x3d'),JSON[_0xf637('0x9')](_0x291f41));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x291f41));}}}else{logger[_0xf637('0x2a')](_0xf637('0x3d'),JSON[_0xf637('0x9')](_0x291f41));throw new Error(_0xf637('0x3e')+JSON[_0xf637('0x9')](_0x291f41));}})[_0xf637('0x29')](function(_0x3cf840){console[_0xf637('0x2a')](_0x3cf840);});}function getZohoUser(_0x30cf37,_0x20acd0){return new BPromise(function(_0x28885a,_0x17845a){request(_0x30cf37)[_0xf637('0x33')](function(_0x38fe3e){var _0x501d22=null;if(_0x38fe3e){_0x501d22=_0x38fe3e[_0xf637('0x3f')][0x0];_0x501d22[_0xf637('0x40')]=_0x20acd0;}_0x28885a(_0x501d22);})[_0xf637('0x29')](function(_0x70820d){_0x17845a(_0x70820d);});});}function createEndUser(_0xa15c86,_0x46ab8b,_0x3d847d,_0x1a703f,_0x43681e,_0xa6ef01){var _0x3d847d=getName(_0x3d847d);return request({'method':_0xf637('0x22'),'uri':_0xf637('0x41')+_0x46ab8b+_0xf637('0x42')+_['startCase'](_0xa6ef01[_0xf637('0x43')])+'s','body':{'data':[{'Last_Name':_0x3d847d[0x1],'First_Name':_0x3d847d[0x0],'Phone':_0x1a703f,'Owner':{'name':!_[_0xf637('0x1a')](_0x43681e[_0xf637('0x44')][_0xf637('0x16')])?_0x43681e['role'][_0xf637('0x16')]:!_[_0xf637('0x1a')](_0x43681e[_0xf637('0x45')])?_0x43681e[_0xf637('0x45')]+'\x20'+_0x43681e[_0xf637('0x46')]:_0x43681e[_0xf637('0x46')],'id':_0x43681e['id']}}]},'headers':{'Authorization':_0xf637('0x32')+_0xa15c86},'json':!![]})[_0xf637('0x33')](function(_0x87710){if(_0x87710&&_0x87710[_0xf637('0x3f')][0x0][_0xf637('0x47')]===_0xf637('0x48')){var _0x5c2e85=_0x87710[_0xf637('0x3f')][0x0][_0xf637('0x49')];_0x5c2e85[_0xf637('0x40')]=_[_0xf637('0x4a')](_0xa6ef01['moduleCreate'])+'s';return _0x5c2e85;}logger['error'](_0xf637('0x3d'),JSON['stringify'](data));throw new Error(_0xf637('0x4b')+JSON[_0xf637('0x9')](data));})[_0xf637('0x29')](function(_0x26f013){console[_0xf637('0x4c')](_0xf637('0x4d'),_0x26f013);});}function getEndUser(_0x20a62d,_0x5db5ce,_0x1c73a3,_0x58f911,_0x250745,_0x4cd0a8,_0x3206be){var _0x4acad1={'method':_0xf637('0x2e'),'uri':'','headers':{'Authorization':_0xf637('0x32')+_0x20a62d},'json':!![]};switch(_0x3206be[_0xf637('0x4e')]){case'contact_lead':_0x4acad1['uri']=_0xf637('0x41')+_0x5db5ce+_0xf637('0x4f')+_0x250745+'))';return getZohoUser(_0x4acad1,_0xf637('0x50'))['then'](function(_0x3f4ca4){if(_0x3f4ca4)return _0x3f4ca4;_0x4acad1[_0xf637('0x51')]=_0xf637('0x41')+_0x5db5ce+_0xf637('0x52')+_0x250745+'))';return getZohoUser(_0x4acad1,_0xf637('0x53'))[_0xf637('0x33')](function(_0x529d2b){if(_0x529d2b)return _0x529d2b;if(_0x3206be[_0xf637('0x43')]!=_0xf637('0x54')){return createEndUser(_0x20a62d,_0x5db5ce,_0x58f911,_0x250745,_0x4cd0a8,_0x3206be);}else{return{};}});});break;case'contact':_0x4acad1[_0xf637('0x51')]='https://www.zohoapis.'+_0x5db5ce+_0xf637('0x4f')+_0x250745+'))';return getZohoUser(_0x4acad1,'Contacts')['then'](function(_0x1605c2){if(_0x1605c2)return _0x1605c2;if(_0x3206be[_0xf637('0x43')]!=_0xf637('0x54')){return createEndUser(_0x20a62d,_0x5db5ce,_0x58f911,_0x250745,_0x4cd0a8,_0x3206be);}else{return{};}});break;case _0xf637('0x55'):_0x4acad1[_0xf637('0x51')]=_0xf637('0x41')+_0x5db5ce+_0xf637('0x52')+_0x250745+'))';return getZohoUser(_0x4acad1,_0xf637('0x53'))['then'](function(_0x424279){if(_0x424279)return _0x424279;if(_0x3206be[_0xf637('0x43')]!=_0xf637('0x54')){return createEndUser(_0x20a62d,_0x5db5ce,_0x58f911,_0x250745,_0x4cd0a8,_0x3206be);}else{return{};}});break;}}function getCall(_0x369dcc,_0x47e481,_0x1bb6c0,_0x4be5ed,_0x338e0a,_0x299b3b,_0x183e93,_0x245877){logger[_0xf637('0x2c')](_0xf637('0x56'));var _0x1f8b8c={};_0x1f8b8c['Owner']={'name':!_['isNil'](_0x4be5ed['role'][_0xf637('0x16')])&&!_[_0xf637('0x1a')](_0x4be5ed[_0xf637('0x3a')][_0xf637('0x16')])&&_0x4be5ed[_0xf637('0x3a')][_0xf637('0x16')]==='administrator'?_0x4be5ed[_0xf637('0x44')]['name']:!_[_0xf637('0x1a')](_0x4be5ed[_0xf637('0x45')])?_0x4be5ed[_0xf637('0x45')]+'\x20'+_0x4be5ed[_0xf637('0x46')]:_0x4be5ed[_0xf637('0x46')],'id':_0x4be5ed['id']};_0x1f8b8c['Subject']=intUtil[_0xf637('0x57')](_0x299b3b[_0xf637('0x58')],_0x183e93,'\x20');_0x1f8b8c[_0xf637('0x59')]=intUtil[_0xf637('0x57')](_0x299b3b[_0xf637('0x5a')],_0x183e93,'\x0a');if(_0x338e0a[_0xf637('0x40')]===_0xf637('0x50')){_0x1f8b8c['Who_Id']={'name':!_[_0xf637('0x1a')](_0x338e0a[_0xf637('0x5b')])?_0x338e0a[_0xf637('0x5b')]:!_[_0xf637('0x1a')](_0x338e0a[_0xf637('0x5c')])?_0x338e0a[_0xf637('0x5c')]+'\x20'+_0x338e0a['Last_Name']:_0x338e0a[_0xf637('0x5d')],'id':_0x338e0a['id']};}if(_0x338e0a[_0xf637('0x40')]===_0xf637('0x53')){_0x1f8b8c[_0xf637('0x5e')]={'name':!_[_0xf637('0x1a')](_0x338e0a[_0xf637('0x5b')])?_0x338e0a[_0xf637('0x5b')]:!_[_0xf637('0x1a')](_0x338e0a[_0xf637('0x5c')])?_0x338e0a[_0xf637('0x5c')]+'\x20'+_0x338e0a['Last_Name']:_0x338e0a[_0xf637('0x5d')],'id':_0x338e0a['id']};_0x1f8b8c[_0xf637('0x5f')]=_[_0xf637('0x4a')](_0x338e0a[_0xf637('0x40')]);}if(_0x183e93[_0xf637('0x60')]){_0x1f8b8c['Call_Duration']=moment['utc'](parseInt(_0x183e93['talktime'])*0x3e8)[_0xf637('0x2f')](_0xf637('0x61'));}else if(_0x183e93['answertime']&&_0x183e93[_0xf637('0x62')]){_0x1f8b8c[_0xf637('0x63')]=moment[_0xf637('0x64')](moment(_0x183e93[_0xf637('0x62')],'YYYY-MM-DDTHH:mm:ss')[_0xf637('0x65')](moment(_0x183e93[_0xf637('0x66')],_0xf637('0x67'))))[_0xf637('0x2f')](_0xf637('0x61'));}switch(_0x183e93['lastevent']){case _0xf637('0x68'):_0x1f8b8c[_0xf637('0x69')]=_0xf637('0x6a');break;case'complete':case _0xf637('0x6b'):_0x1f8b8c[_0xf637('0x69')]='Answered';break;case _0xf637('0x6c'):_0x1f8b8c[_0xf637('0x69')]=_0xf637('0x6d');break;case _0xf637('0x6e'):_0x1f8b8c[_0xf637('0x69')]=_0xf637('0x6f');break;case _0xf637('0x70'):_0x1f8b8c[_0xf637('0x69')]=_0xf637('0x71');default:}_0x1f8b8c[_0xf637('0x72')]=(_0x245877===_0xf637('0x73')?moment(_0x183e93['starttime'])[_0xf637('0x2f')](_0xf637('0x67')):moment(_0x183e93[_0xf637('0x74')])[_0xf637('0x2f')](_0xf637('0x67')))||moment()[_0xf637('0x2f')](_0xf637('0x67'));_0x1f8b8c['Call_Type']=_0x245877||_0xf637('0x75');_0x1f8b8c=_[_0xf637('0x76')](_0x1f8b8c,getCustomFields(_0x299b3b[_0xf637('0x77')],_0x183e93));return request({'method':_0xf637('0x22'),'uri':_0xf637('0x41')+_0x47e481+'/crm/v2/Calls','headers':{'Authorization':_0xf637('0x32')+_0x369dcc},'body':{'data':[_0x1f8b8c]},'json':!![]})['then'](function(_0x3c84dc){if(_0x3c84dc&&_0x3c84dc['data'][0x0][_0xf637('0x47')]===_0xf637('0x48')){logger[_0xf637('0x2c')](_0xf637('0x78'));return{'id':_0x3c84dc['data'][0x0]['details']['id']};}})[_0xf637('0x29')](function(_0x444145){logger[_0xf637('0x2c')](_0xf637('0x79'),_0x444145[_0xf637('0x2b')]);console['log'](_0xf637('0x79'),_0x444145);});}exports[_0xf637('0x7a')]=function(_0x2036d2,_0x448506,_0x221874,_0x3549ba,_0x29bbbc,_0x4615cc){var _0x534d27,_0x2e02c2,_0x39ed5d;_0x4615cc[_0xf637('0x7b')]=intUtil[_0xf637('0x7c')](_0x4615cc[_0xf637('0x7b')]);_0x4615cc[_0xf637('0x7d')]=intUtil[_0xf637('0x7c')](_0x4615cc[_0xf637('0x7d')]);if(_0x29bbbc&&_0x29bbbc['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x448506[_0xf637('0x7e')]=_0x4615cc[_0xf637('0x7d')]+_0xf637('0x7f')+_0x448506[_0xf637('0x80')]+'/downloads?type=uniqueid&token='+md5(_0x448506[_0xf637('0x80')]);}else{_0x448506['recordingURL']='';}var _0x58fd81=_0x4615cc[_0xf637('0x7b')]===_0xf637('0x81')?'eu':_0xf637('0x82');return getAccessToken(_0x4615cc)[_0xf637('0x33')](function(_0x3650eb){_0x39ed5d=_0x3650eb;return getUser(_0x39ed5d,_0x58fd81,_0x4615cc,_0x3549ba[_0xf637('0x37')]);})[_0xf637('0x33')](function(_0x2f781b){_0x534d27=_0x2f781b;logger[_0xf637('0x2c')]('The\x20User\x20ID\x20is:',_0x534d27['id']);return getEndUser(_0x39ed5d,_0x58fd81,_0x4615cc,_0x448506[_0xf637('0x83')],_0x448506[_0xf637('0x84')],_0x534d27,_0x221874);})[_0xf637('0x33')](function(_0x48160e){_0x2e02c2=_0x48160e;return getCall(_0x39ed5d,_0x58fd81,_0x4615cc,_0x534d27,_0x2e02c2,_0x221874,_0x448506,'Inbound');})['then'](function(_0x12fd31){if(_0x12fd31){logger['info'](_0xf637('0x85'),_0x12fd31['id']);logger['info'](_0xf637('0x86'),_0xf637('0x87'));emit(util['format']('user:%s',_0x3549ba['name']),'trigger:browser:url',{'uri':_0xf637('0x88')+_0x4615cc['host']+_0xf637('0x89')+_0x12fd31['id']});}})[_0xf637('0x29')](function(_0x4d7e80){logger[_0xf637('0x2a')](_0xf637('0x86'),JSON[_0xf637('0x9')](_0x4d7e80));});};exports[_0xf637('0x73')]=function(_0xe7953f,_0x12bd40,_0x2b58ed,_0x346b1e,_0x9634ae,_0x59204b,_0x4c5ad2){var _0x30ae18,_0x446790,_0x5aa613;_0x59204b[_0xf637('0x7b')]=intUtil[_0xf637('0x7c')](_0x59204b['host']);_0x59204b[_0xf637('0x7d')]=intUtil[_0xf637('0x7c')](_0x59204b[_0xf637('0x7d')]);if(_0x4c5ad2&&_0x4c5ad2['recordingFormat']&&_0x4c5ad2[_0xf637('0x8a')]!==_0xf637('0x8b')){logger[_0xf637('0x2c')](_0xf637('0x8c'),_0xf637('0x8d'));_0x12bd40[_0xf637('0x7e')]=_0x59204b[_0xf637('0x7d')]+'/api/voice/recordings/'+_0x12bd40[_0xf637('0x80')]+_0xf637('0x8e')+md5(_0x12bd40[_0xf637('0x80')]);}var _0x238070=_0x59204b[_0xf637('0x7b')]===_0xf637('0x81')?'eu':_0xf637('0x82');return getAccessToken(_0x59204b)[_0xf637('0x33')](function(_0x4560de){_0x5aa613=_0x4560de;return getUser(_0x5aa613,_0x238070,_0x59204b,_0x346b1e[_0xf637('0x37')]);})[_0xf637('0x33')](function(_0x26076b){_0x30ae18=_0x26076b;logger[_0xf637('0x2c')]('The\x20User\x20ID\x20is:',_0x30ae18['id']);return getEndUser(_0x5aa613,_0x238070,_0x59204b,_0x12bd40['destcalleridname'],_0x12bd40[_0xf637('0x8f')],_0x30ae18,_0x2b58ed);})[_0xf637('0x33')](function(_0xa97b44){_0x446790=_0xa97b44;return getCall(_0x5aa613,_0x238070,_0x59204b,_0x30ae18,_0x446790,_0x2b58ed,_0x12bd40,_0xf637('0x90'));})['then'](function(_0x1961c6){if(_0x1961c6){logger[_0xf637('0x2c')](_0xf637('0x85'),_0x1961c6['id']);logger['info'](_0xf637('0x8c'),_0xf637('0x87'));emit(util['format'](_0xf637('0x91'),_0x346b1e[_0xf637('0x16')]),_0xf637('0x92'),{'uri':_0xf637('0x88')+_0x59204b[_0xf637('0x7b')]+_0xf637('0x89')+_0x1961c6['id']});}})[_0xf637('0x29')](function(_0x2d1d46){logger[_0xf637('0x2a')](_0xf637('0x8c'),JSON[_0xf637('0x9')](_0x2d1d46));});};exports[_0xf637('0x93')]=function(_0xb4984d,_0x2c3e7c,_0x5da90a,_0x59dc6d,_0x46be16,_0x3634e5){var _0x2587f2,_0x281fb6,_0x30754c;_0x3634e5[_0xf637('0x7b')]=intUtil['stripTrailingSlash'](_0x3634e5[_0xf637('0x7b')]);_0x3634e5['serverUrl']=intUtil[_0xf637('0x7c')](_0x3634e5[_0xf637('0x7d')]);if(_0x46be16&&_0x46be16[_0xf637('0x94')]){logger[_0xf637('0x2c')]('['+_0x2c3e7c[_0xf637('0x95')]['toUpperCase']()+']',_0xf637('0x8d'));_0x2c3e7c[_0xf637('0x7e')]=_0x3634e5['serverUrl']+_0xf637('0x7f')+_0x2c3e7c[_0xf637('0x80')]+_0xf637('0x8e')+md5(_0x2c3e7c[_0xf637('0x80')]);}else{_0x2c3e7c[_0xf637('0x7e')]='';}var _0x54b1b0=_0x3634e5['host']===_0xf637('0x81')?'eu':'com';return getAccessToken(_0x3634e5)[_0xf637('0x33')](function(_0x273433){_0x30754c=_0x273433;return getUser(_0x30754c,_0x54b1b0,_0x3634e5);})[_0xf637('0x33')](function(_0x5751c5){_0x2587f2=_0x5751c5;logger[_0xf637('0x2c')](_0xf637('0x96'),_0x2587f2['id']);return getEndUser(_0x30754c,_0x54b1b0,_0x3634e5,_0x2c3e7c[_0xf637('0x83')],_0x2c3e7c[_0xf637('0x84')],_0x2587f2,_0x5da90a);})[_0xf637('0x33')](function(_0xcaf0e7){_0x281fb6=_0xcaf0e7;return getCall(_0x30754c,_0x54b1b0,_0x3634e5,_0x2587f2,_0x281fb6,_0x5da90a,_0x2c3e7c,'Inbound');})[_0xf637('0x33')](function(_0xd1cb42){if(_0xd1cb42){logger[_0xf637('0x2c')](_0xf637('0x85'),_0xd1cb42['id']);}})[_0xf637('0x29')](function(_0x1aa995){logger[_0xf637('0x2a')]('['+_0x2c3e7c[_0xf637('0x95')][_0xf637('0x97')]()+']',JSON[_0xf637('0x9')](_0x1aa995));});}; \ No newline at end of file +var _0x4513=['role','first_name','last_name','code','moduleCreate','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','Creating\x20new\x20call...','administrator','Description','Descriptions','Full_Name','Last_Name','First_Name','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','merge','/crm/v2/Calls','SUCCESS','details','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','Inbound','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Using\x20the\x20admin\x20account!','profile','user','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase'];(function(_0x462926,_0x549149){var _0x1c995f=function(_0x2dc80b){while(--_0x2dc80b){_0x462926['push'](_0x462926['shift']());}};_0x1c995f(++_0x549149);}(_0x4513,0xef));var _0x3451=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4513[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require(_0x3451('0x0'));var md5=require(_0x3451('0x1'));var util=require('util');var intUtil=require('./util');var moment=require('moment');var Redis=require(_0x3451('0x2'));var BPromise=require('bluebird');var config=require(_0x3451('0x3'));var logger=require(_0x3451('0x4'))(_0x3451('0x5'));config[_0x3451('0x6')]=_['defaults'](config['redis'],{'host':_0x3451('0x7'),'port':0x18eb});var io=require(_0x3451('0x8'))(new Redis(config[_0x3451('0x6')]));function emit(_0x150365,_0x258d51,_0x1274d9){io['to'](_0x150365)[_0x3451('0x9')](_0x258d51,_0x1274d9);}function request(_0x262156){logger[_0x3451('0xa')](_0x3451('0xb'),JSON[_0x3451('0xc')](_0x262156));return rp(_0x262156);}function getCustomFields(_0x5c1f71,_0x235e9b){var _0x476688={};if(_0x5c1f71[_0x3451('0xd')]>0x0){_['forEach'](_0x5c1f71,function(_0x542092){if(_['includes']([_0x3451('0xe'),_0x3451('0xf')],_0x542092[_0x3451('0x10')])&&_0x542092[_0x3451('0x11')]){_0x476688[_0x542092['idField']]=_0x542092[_0x3451('0x12')][_0x3451('0x13')]();}else if(_0x542092[_0x3451('0x10')]===_0x3451('0x14')&&_0x542092[_0x3451('0x15')]&&_0x542092['idField']&&_0x235e9b[_0x542092[_0x3451('0x15')]]){_0x476688[_0x542092[_0x3451('0x11')]]=_0x235e9b[_0x542092[_0x3451('0x15')]][_0x3451('0x13')]();}else if(_0x542092[_0x3451('0x10')]===_0x3451('0x16')&&_0x542092[_0x3451('0x17')]&&_0x542092[_0x3451('0x17')]['name']&&_0x542092['idField']&&_0x235e9b[_0x542092[_0x3451('0x17')][_0x3451('0x18')][_0x3451('0x19')]()]){_0x476688[_0x542092[_0x3451('0x11')]]=_0x235e9b[_0x542092['Variable']['name']['toLowerCase']()][_0x3451('0x13')]();}});}return _0x476688;}function getName(_0x3b8bea){if(_0x3b8bea[_0x3451('0x1a')]('\x20')>0x0){var _0x3e04bc=_0x3b8bea[_0x3451('0x1b')](/ (.+)/);if(_0x3e04bc[0x1]){return _0x3e04bc;}}return[_0x3b8bea,_0x3b8bea];}var accountsTokens={};function getAccessToken(_0x39b68a){return new Promise(function(_0x266ed9,_0x3f1fa4){if(!_[_0x3451('0x1c')](accountsTokens[_0x39b68a['id']])&&!_['isNil'](accountsTokens[_0x39b68a['id']]['access_token'])){if(moment()[_0x3451('0x1d')](accountsTokens[_0x39b68a['id']][_0x3451('0x1e')])){_0x266ed9(accountsTokens[_0x39b68a['id']]['access_token']);}}var _0x57fc59;switch(_0x39b68a[_0x3451('0x1f')]){case'US':_0x57fc59=_0x3451('0x20');break;case'AU':_0x57fc59=_0x3451('0x21');break;case'EU':_0x57fc59='https://accounts.zoho.eu';break;case'IN':_0x57fc59='https://accounts.zoho.in';break;case'CN':_0x57fc59=_0x3451('0x22');break;default:_0x57fc59='https://accounts.zoho.eu';break;}var _0x2ae737={'method':_0x3451('0x23'),'uri':_0x57fc59+_0x3451('0x24'),'qs':{'refresh_token':_0x39b68a[_0x3451('0x25')],'client_id':_0x39b68a[_0x3451('0x26')],'client_secret':_0x39b68a[_0x3451('0x27')],'grant_type':_0x3451('0x28')},'json':!![]};return rp(_0x2ae737)[_0x3451('0x29')](function(_0x4d8ff4){accountsTokens[_0x39b68a['id']]={'access_token':_0x4d8ff4[_0x3451('0x2a')],'expires_in':moment()[_0x3451('0x2b')](_0x4d8ff4[_0x3451('0x1e')],_0x3451('0x2c'))};_0x266ed9(_0x4d8ff4[_0x3451('0x2a')]);})[_0x3451('0x2d')](function(_0x3b12c9){logger[_0x3451('0x2e')](_0x3451('0x2f'),_0x3b12c9[_0x3451('0x30')]);_0x3f1fa4(_0x3b12c9);});});}function getUser(_0x4645ab,_0x57b242,_0x1d745e,_0x42c0b2){logger[_0x3451('0x31')](_0x3451('0x32'));return request({'method':'GET','uri':util[_0x3451('0x33')]('https://www.zohoapis.%s/crm/v2/users',_0x57b242),'qs':{'type':_0x3451('0x34')},'headers':{'Authorization':_0x3451('0x35')+_0x4645ab},'json':!![]})['then'](function(_0x16c49c){if(_0x16c49c[_0x3451('0x36')]){var _0x3185d7=-0x1;if(_[_0x3451('0x37')](_0x16c49c['users'])){if(!_[_0x3451('0x1c')](_0x42c0b2)){_0x3185d7=_[_0x3451('0x38')](_0x16c49c[_0x3451('0x36')],function(_0x137f1d){return _0x137f1d['email']===_0x42c0b2;});}if(_0x3185d7>=0x0){logger[_0x3451('0x31')]('Agent\x20found!');}else{logger[_0x3451('0x31')](_0x3451('0x39'));_0x3185d7=_[_0x3451('0x38')](_0x16c49c[_0x3451('0x36')],function(_0x3aec1e){return _0x3aec1e[_0x3451('0x3a')][_0x3451('0x18')]==='Administrator';});}return _0x16c49c[_0x3451('0x36')][_0x3185d7];}else{if(_0x16c49c[_0x3451('0x3b')][_0x3451('0x3a')]['name']===_0x3451('0x3c')){logger[_0x3451('0x31')]('Using\x20the\x20admin\x20account!');user=_0x16c49c['user'];return user;}else{logger[_0x3451('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x3451('0xc')](_0x16c49c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x3451('0xc')](_0x16c49c));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x16c49c));throw new Error(_0x3451('0x3d')+JSON[_0x3451('0xc')](_0x16c49c));}})[_0x3451('0x2d')](function(_0x3eef80){console['error'](_0x3eef80);});}function getZohoUser(_0x29de50,_0x275977){return new BPromise(function(_0x1b912d,_0x4b215f){request(_0x29de50)['then'](function(_0x2881b6){var _0x441442=null;if(_0x2881b6){_0x441442=_0x2881b6[_0x3451('0x3e')][0x0];_0x441442[_0x3451('0x3f')]=_0x275977;}_0x1b912d(_0x441442);})[_0x3451('0x2d')](function(_0x59193f){_0x4b215f(_0x59193f);});});}function createEndUser(_0x20279f,_0x2b1774,_0x249b87,_0x34dc42,_0x1d6ac5,_0x533c04){var _0x249b87=getName(_0x249b87);return request({'method':_0x3451('0x23'),'uri':_0x3451('0x40')+_0x2b1774+_0x3451('0x41')+_[_0x3451('0x42')](_0x533c04['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x249b87[0x1],'First_Name':_0x249b87[0x0],'Phone':_0x34dc42,'Owner':{'name':!_[_0x3451('0x1c')](_0x1d6ac5[_0x3451('0x43')][_0x3451('0x18')])?_0x1d6ac5[_0x3451('0x43')][_0x3451('0x18')]:!_[_0x3451('0x1c')](_0x1d6ac5[_0x3451('0x44')])?_0x1d6ac5[_0x3451('0x44')]+'\x20'+_0x1d6ac5[_0x3451('0x45')]:_0x1d6ac5[_0x3451('0x45')],'id':_0x1d6ac5['id']}}]},'headers':{'Authorization':_0x3451('0x35')+_0x20279f},'json':!![]})[_0x3451('0x29')](function(_0x294813){if(_0x294813&&_0x294813['data'][0x0][_0x3451('0x46')]==='SUCCESS'){var _0x48ec17=_0x294813['data'][0x0]['details'];_0x48ec17['enduserType']=_[_0x3451('0x42')](_0x533c04[_0x3451('0x47')])+'s';return _0x48ec17;}logger[_0x3451('0x2e')](_0x3451('0x48'),JSON[_0x3451('0xc')](data));throw new Error(_0x3451('0x49')+JSON[_0x3451('0xc')](data));})['catch'](function(_0x1d63c9){console[_0x3451('0x4a')](_0x3451('0x4b'),_0x1d63c9);});}function getEndUser(_0x46c4f9,_0x315806,_0x344bd1,_0x1c74db,_0x57900c,_0x510211,_0x42ce3d){var _0x130e53={'method':_0x3451('0x4c'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x46c4f9},'json':!![]};switch(_0x42ce3d[_0x3451('0x4d')]){case'contact_lead':_0x130e53['uri']=_0x3451('0x40')+_0x315806+_0x3451('0x4e')+_0x57900c+'))';return getZohoUser(_0x130e53,_0x3451('0x4f'))['then'](function(_0x58814f){if(_0x58814f)return _0x58814f;_0x130e53[_0x3451('0x50')]=_0x3451('0x40')+_0x315806+_0x3451('0x51')+_0x57900c+'))';return getZohoUser(_0x130e53,_0x3451('0x52'))['then'](function(_0x476b16){if(_0x476b16)return _0x476b16;if(_0x42ce3d[_0x3451('0x47')]!='nothing'){return createEndUser(_0x46c4f9,_0x315806,_0x1c74db,_0x57900c,_0x510211,_0x42ce3d);}else{return{};}});});break;case _0x3451('0x53'):_0x130e53[_0x3451('0x50')]=_0x3451('0x40')+_0x315806+_0x3451('0x4e')+_0x57900c+'))';return getZohoUser(_0x130e53,_0x3451('0x4f'))['then'](function(_0x594c9b){if(_0x594c9b)return _0x594c9b;if(_0x42ce3d[_0x3451('0x47')]!=_0x3451('0x54')){return createEndUser(_0x46c4f9,_0x315806,_0x1c74db,_0x57900c,_0x510211,_0x42ce3d);}else{return{};}});break;case'lead':_0x130e53[_0x3451('0x50')]=_0x3451('0x40')+_0x315806+_0x3451('0x51')+_0x57900c+'))';return getZohoUser(_0x130e53,'Leads')['then'](function(_0x29fadb){if(_0x29fadb)return _0x29fadb;if(_0x42ce3d[_0x3451('0x47')]!=_0x3451('0x54')){return createEndUser(_0x46c4f9,_0x315806,_0x1c74db,_0x57900c,_0x510211,_0x42ce3d);}else{return{};}});break;}}function getCall(_0x539a38,_0x598250,_0x3905dc,_0x1482cb,_0x33319e,_0x4a8fb5,_0x3e822c,_0x49d814){logger[_0x3451('0x31')](_0x3451('0x55'));var _0x4c6e61={};_0x4c6e61['Owner']={'name':!_['isNil'](_0x1482cb['role']['name'])&&!_[_0x3451('0x1c')](_0x1482cb['profile'][_0x3451('0x18')])&&_0x1482cb[_0x3451('0x3a')][_0x3451('0x18')]===_0x3451('0x56')?_0x1482cb['role'][_0x3451('0x18')]:!_[_0x3451('0x1c')](_0x1482cb['first_name'])?_0x1482cb['first_name']+'\x20'+_0x1482cb[_0x3451('0x45')]:_0x1482cb[_0x3451('0x45')],'id':_0x1482cb['id']};_0x4c6e61['Subject']=intUtil['getString'](_0x4a8fb5['Subjects'],_0x3e822c,'\x20');_0x4c6e61[_0x3451('0x57')]=intUtil['getString'](_0x4a8fb5[_0x3451('0x58')],_0x3e822c,'\x0a');if(_0x33319e['enduserType']===_0x3451('0x4f')){_0x4c6e61['Who_Id']={'name':!_['isNil'](_0x33319e['Full_Name'])?_0x33319e[_0x3451('0x59')]:!_[_0x3451('0x1c')](_0x33319e['First_Name'])?_0x33319e['First_Name']+'\x20'+_0x33319e[_0x3451('0x5a')]:_0x33319e['Last_Name'],'id':_0x33319e['id']};}if(_0x33319e[_0x3451('0x3f')]===_0x3451('0x52')){_0x4c6e61['What_Id']={'name':!_[_0x3451('0x1c')](_0x33319e[_0x3451('0x59')])?_0x33319e[_0x3451('0x59')]:!_[_0x3451('0x1c')](_0x33319e[_0x3451('0x5b')])?_0x33319e['First_Name']+'\x20'+_0x33319e[_0x3451('0x5a')]:_0x33319e[_0x3451('0x5a')],'id':_0x33319e['id']};_0x4c6e61[_0x3451('0x5c')]=_[_0x3451('0x42')](_0x33319e['enduserType']);}if(_0x3e822c['talktime']){_0x4c6e61[_0x3451('0x5d')]=moment[_0x3451('0x5e')](parseInt(_0x3e822c[_0x3451('0x5f')])*0x3e8)['format'](_0x3451('0x60'));}else if(_0x3e822c[_0x3451('0x61')]&&_0x3e822c[_0x3451('0x62')]){_0x4c6e61[_0x3451('0x5d')]=moment[_0x3451('0x5e')](moment(_0x3e822c['endtime'],_0x3451('0x63'))[_0x3451('0x64')](moment(_0x3e822c['starttime'],_0x3451('0x63'))))['format'](_0x3451('0x60'));}switch(_0x3e822c[_0x3451('0x65')]){case'called':_0x4c6e61[_0x3451('0x66')]=_0x3451('0x67');break;case _0x3451('0x68'):case _0x3451('0x69'):_0x4c6e61['Call_Result']='Answered';break;case _0x3451('0x6a'):_0x4c6e61[_0x3451('0x66')]=_0x3451('0x6b');break;case _0x3451('0x6c'):_0x4c6e61[_0x3451('0x66')]=_0x3451('0x6d');break;case _0x3451('0x6e'):_0x4c6e61[_0x3451('0x66')]=_0x3451('0x6f');default:}_0x4c6e61[_0x3451('0x70')]=(_0x49d814==='outbound'?moment(_0x3e822c[_0x3451('0x71')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x3e822c[_0x3451('0x72')])[_0x3451('0x33')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x4c6e61[_0x3451('0x73')]=_0x49d814||'Inbound';_0x4c6e61=_[_0x3451('0x74')](_0x4c6e61,getCustomFields(_0x4a8fb5['Fields'],_0x3e822c));return request({'method':_0x3451('0x23'),'uri':_0x3451('0x40')+_0x598250+_0x3451('0x75'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x539a38},'body':{'data':[_0x4c6e61]},'json':!![]})[_0x3451('0x29')](function(_0x266daf){if(_0x266daf&&_0x266daf[_0x3451('0x3e')][0x0][_0x3451('0x46')]===_0x3451('0x76')){logger['info']('Call\x20created!');return{'id':_0x266daf[_0x3451('0x3e')][0x0][_0x3451('0x77')]['id']};}})[_0x3451('0x2d')](function(_0x4fb023){logger[_0x3451('0x31')](_0x3451('0x78'),_0x4fb023['stack']);console[_0x3451('0x4a')](_0x3451('0x78'),_0x4fb023);});}exports[_0x3451('0x79')]=function(_0x30558c,_0x37fe12,_0x4010db,_0x2a4d53,_0x203f1f,_0x331cb8){var _0x3588da,_0x233bc3,_0x493679;_0x331cb8[_0x3451('0x7a')]=intUtil['stripTrailingSlash'](_0x331cb8[_0x3451('0x7a')]);_0x331cb8[_0x3451('0x7b')]=intUtil[_0x3451('0x7c')](_0x331cb8[_0x3451('0x7b')]);if(_0x203f1f&&_0x203f1f[_0x3451('0x7d')]){logger['info'](_0x3451('0x7e'),'Recording\x20is\x20enabled!');_0x37fe12[_0x3451('0x7f')]=_0x331cb8[_0x3451('0x7b')]+_0x3451('0x80')+_0x37fe12[_0x3451('0x81')]+_0x3451('0x82')+md5(_0x37fe12[_0x3451('0x81')]);}else{_0x37fe12['recordingURL']='';}var _0x4f987d=_0x331cb8[_0x3451('0x7a')]===_0x3451('0x83')?'eu':_0x3451('0x84');return getAccessToken(_0x331cb8)[_0x3451('0x29')](function(_0x17a07a){_0x493679=_0x17a07a;return getUser(_0x493679,_0x4f987d,_0x331cb8,_0x2a4d53[_0x3451('0x85')]);})[_0x3451('0x29')](function(_0x49d454){_0x3588da=_0x49d454;logger[_0x3451('0x31')]('The\x20User\x20ID\x20is:',_0x3588da['id']);return getEndUser(_0x493679,_0x4f987d,_0x331cb8,_0x37fe12[_0x3451('0x86')],_0x37fe12['calleridnum'],_0x3588da,_0x4010db);})['then'](function(_0x23420d){_0x233bc3=_0x23420d;return getCall(_0x493679,_0x4f987d,_0x331cb8,_0x3588da,_0x233bc3,_0x4010db,_0x37fe12,'Inbound');})['then'](function(_0xf91a81){if(_0xf91a81){logger[_0x3451('0x31')](_0x3451('0x87'),_0xf91a81['id']);logger[_0x3451('0x31')](_0x3451('0x7e'),_0x3451('0x88'));emit(util['format'](_0x3451('0x89'),_0x2a4d53[_0x3451('0x18')]),_0x3451('0x8a'),{'uri':_0x3451('0x8b')+_0x331cb8[_0x3451('0x7a')]+_0x3451('0x8c')+_0xf91a81['id']});}})['catch'](function(_0x59bbbe){logger['error'](_0x3451('0x7e'),JSON[_0x3451('0xc')](_0x59bbbe));});};exports['outbound']=function(_0x53aea5,_0x406c36,_0x86c384,_0xe145e9,_0x502de9,_0x1245f4,_0x45c9f5){var _0x5096f9,_0x2295ab,_0x2e14f7;_0x1245f4[_0x3451('0x7a')]=intUtil[_0x3451('0x7c')](_0x1245f4['host']);_0x1245f4['serverUrl']=intUtil['stripTrailingSlash'](_0x1245f4[_0x3451('0x7b')]);if(_0x45c9f5&&_0x45c9f5['recordingFormat']&&_0x45c9f5[_0x3451('0x8d')]!==_0x3451('0x8e')){logger['info'](_0x3451('0x8f'),_0x3451('0x90'));_0x406c36['recordingURL']=_0x1245f4[_0x3451('0x7b')]+'/api/voice/recordings/'+_0x406c36[_0x3451('0x81')]+_0x3451('0x82')+md5(_0x406c36[_0x3451('0x81')]);}var _0x334401=_0x1245f4[_0x3451('0x7a')]==='zoho.eu'?'eu':_0x3451('0x84');return getAccessToken(_0x1245f4)[_0x3451('0x29')](function(_0x14c338){_0x2e14f7=_0x14c338;return getUser(_0x2e14f7,_0x334401,_0x1245f4,_0xe145e9[_0x3451('0x85')]);})[_0x3451('0x29')](function(_0x7b02e6){_0x5096f9=_0x7b02e6;logger[_0x3451('0x31')]('The\x20User\x20ID\x20is:',_0x5096f9['id']);return getEndUser(_0x2e14f7,_0x334401,_0x1245f4,_0x406c36[_0x3451('0x91')],_0x406c36[_0x3451('0x92')],_0x5096f9,_0x86c384);})[_0x3451('0x29')](function(_0x2665f3){_0x2295ab=_0x2665f3;return getCall(_0x2e14f7,_0x334401,_0x1245f4,_0x5096f9,_0x2295ab,_0x86c384,_0x406c36,_0x3451('0x93'));})[_0x3451('0x29')](function(_0x3442e6){if(_0x3442e6){logger[_0x3451('0x31')](_0x3451('0x87'),_0x3442e6['id']);logger[_0x3451('0x31')](_0x3451('0x8f'),_0x3451('0x88'));emit(util[_0x3451('0x33')](_0x3451('0x89'),_0xe145e9[_0x3451('0x18')]),_0x3451('0x8a'),{'uri':_0x3451('0x8b')+_0x1245f4[_0x3451('0x7a')]+_0x3451('0x8c')+_0x3442e6['id']});}})[_0x3451('0x2d')](function(_0x1d9710){logger[_0x3451('0x2e')]('[OUTBOUND]',JSON['stringify'](_0x1d9710));});};exports[_0x3451('0x94')]=function(_0x41255f,_0x278e61,_0x6d9e08,_0x1a526c,_0x1a9bc2,_0x656e65){var _0x263e1a,_0x1a8e25,_0x12cfd3;_0x656e65[_0x3451('0x7a')]=intUtil['stripTrailingSlash'](_0x656e65[_0x3451('0x7a')]);_0x656e65[_0x3451('0x7b')]=intUtil[_0x3451('0x7c')](_0x656e65[_0x3451('0x7b')]);if(_0x1a9bc2&&_0x1a9bc2['monitor_format']){logger[_0x3451('0x31')]('['+_0x278e61[_0x3451('0x65')][_0x3451('0x95')]()+']',_0x3451('0x90'));_0x278e61['recordingURL']=_0x656e65[_0x3451('0x7b')]+_0x3451('0x80')+_0x278e61[_0x3451('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x278e61[_0x3451('0x81')]);}else{_0x278e61[_0x3451('0x7f')]='';}var _0x27293e=_0x656e65[_0x3451('0x7a')]===_0x3451('0x83')?'eu':'com';return getAccessToken(_0x656e65)[_0x3451('0x29')](function(_0x57696b){_0x12cfd3=_0x57696b;return getUser(_0x12cfd3,_0x27293e,_0x656e65);})['then'](function(_0x3ecf5f){_0x263e1a=_0x3ecf5f;logger['info'](_0x3451('0x96'),_0x263e1a['id']);return getEndUser(_0x12cfd3,_0x27293e,_0x656e65,_0x278e61[_0x3451('0x86')],_0x278e61[_0x3451('0x97')],_0x263e1a,_0x6d9e08);})[_0x3451('0x29')](function(_0x43a592){_0x1a8e25=_0x43a592;return getCall(_0x12cfd3,_0x27293e,_0x656e65,_0x263e1a,_0x1a8e25,_0x6d9e08,_0x278e61,_0x3451('0x98'));})[_0x3451('0x29')](function(_0x49ace2){if(_0x49ace2){logger[_0x3451('0x31')](_0x3451('0x87'),_0x49ace2['id']);}})['catch'](function(_0x214eb4){logger[_0x3451('0x2e')]('['+_0x278e61['lastevent'][_0x3451('0x95')]()+']',JSON['stringify'](_0x214eb4));});}; \ 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 3a140cf..143e1ad 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 _0xe8f1=['../../../../config/logger','trigger','exec','data2','Script','render','data3','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache'];(function(_0x5e8e34,_0x313192){var _0x501d92=function(_0x4005d2){while(--_0x4005d2){_0x5e8e34['push'](_0x5e8e34['shift']());}};_0x501d92(++_0x313192);}(_0xe8f1,0xa5));var _0x1e8f=function(_0x1c9f90,_0x538898){_0x1c9f90=_0x1c9f90-0x0;var _0x2e0c4c=_0xe8f1[_0x1c9f90];return _0x2e0c4c;};'use strict';var util=require(_0x1e8f('0x0'));var sh=require(_0x1e8f('0x1'));var Mustache=require(_0x1e8f('0x2'));var logger=require(_0x1e8f('0x3'))(_0x1e8f('0x4'));exports[_0x1e8f('0x5')]=function(_0x324044,_0x3fbd39){var _0x3a6450=_0x324044['data2']?_0x324044[_0x1e8f('0x6')]:_0x1e8f('0x7');var _0xb12a49=_0x324044['data3']?Mustache[_0x1e8f('0x8')](_0x324044[_0x1e8f('0x9')],_0x3fbd39):_0x3fbd39;sh['exec'](_0xb12a49,function(_0x12d357,_0x22040b,_0x560387){if(_0x12d357!==0x0){logger[_0x1e8f('0xa')](util[_0x1e8f('0xb')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x3a6450,_0xb12a49,_0x12d357,_0x560387));}else{logger[_0x1e8f('0xc')](util[_0x1e8f('0xb')](_0x1e8f('0xd'),_0x3a6450,_0xb12a49,_0x22040b));}});}; \ No newline at end of file +var _0x450c=['data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','exec'];(function(_0x29eff2,_0xde51e9){var _0x2b5e13=function(_0x5be192){while(--_0x5be192){_0x29eff2['push'](_0x29eff2['shift']());}};_0x2b5e13(++_0xde51e9);}(_0x450c,0x14e));var _0xc450=function(_0x159cbe,_0x2ed6a6){_0x159cbe=_0x159cbe-0x0;var _0x485dc1=_0x450c[_0x159cbe];return _0x485dc1;};'use strict';var util=require('util');var sh=require(_0xc450('0x0'));var Mustache=require(_0xc450('0x1'));var logger=require(_0xc450('0x2'))('trigger');exports[_0xc450('0x3')]=function(_0x42b841,_0x2745e5){var _0x3c0899=_0x42b841[_0xc450('0x4')]?_0x42b841[_0xc450('0x4')]:_0xc450('0x5');var _0x4fb6d2=_0x42b841[_0xc450('0x6')]?Mustache[_0xc450('0x7')](_0x42b841[_0xc450('0x6')],_0x2745e5):_0x2745e5;sh[_0xc450('0x3')](_0x4fb6d2,function(_0x3b13e8,_0x176484,_0x575233){if(_0x3b13e8!==0x0){logger[_0xc450('0x8')](util[_0xc450('0x9')](_0xc450('0xa'),_0x3c0899,_0x4fb6d2,_0x3b13e8,_0x575233));}else{logger[_0xc450('0xb')](util[_0xc450('0x9')](_0xc450('0xc'),_0x3c0899,_0x4fb6d2,_0x176484));}});}; \ 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 d9f8d66..73bfce6 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 _0xce14=['then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger','data1','render','data5','headers','data6','stack','toUpperCase','GET','DELETE','PUT','data7','parse','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','data2','stringify'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xce14,0x128));var _0x4ce1=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xce14[_0x3947c9];return _0x2e7871;};'use strict';var rp=require(_0x4ce1('0x0'));var util=require(_0x4ce1('0x1'));var _=require(_0x4ce1('0x2'));var Mustache=require(_0x4ce1('0x3'));var logger=require(_0x4ce1('0x4'))('trigger');exports['exec']=function(_0x2863a4,_0x1fe7e8){var _0x31d618,_0x108a7a;var _0x362de1={'method':_0x2863a4[_0x4ce1('0x5')]['toUpperCase'](),'uri':Mustache[_0x4ce1('0x6')](_0x2863a4['data2'],_0x1fe7e8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2863a4[_0x4ce1('0x7')])==='number'&&parseInt(_0x2863a4[_0x4ce1('0x7')])>=0x1&&parseInt(_0x2863a4['data5'])<=0xa?parseInt(_0x2863a4['data5'])*0x3e8:0x5*0x3e8};try{_0x362de1[_0x4ce1('0x8')]=_0x2863a4[_0x4ce1('0x9')]?JSON['parse'](Mustache[_0x4ce1('0x6')](_0x2863a4[_0x4ce1('0x9')],_0x1fe7e8)):{};}catch(_0x1b4104){logger['error'](_0x1b4104[_0x4ce1('0xa')]);}switch(_0x2863a4[_0x4ce1('0x5')][_0x4ce1('0xb')]()){case _0x4ce1('0xc'):case _0x4ce1('0xd'):_0x31d618=null;_0x362de1['qs']=_0x1fe7e8;break;case'POST':case _0x4ce1('0xe'):if(_0x2863a4[_0x4ce1('0xf')]){try{_0x31d618=JSON[_0x4ce1('0x10')](Mustache[_0x4ce1('0x6')](_0x2863a4[_0x4ce1('0xf')],_0x1fe7e8));_0x362de1['body']=_0x31d618;}catch(_0x43d929){logger[_0x4ce1('0x11')](_0x43d929[_0x4ce1('0xa')]);logger[_0x4ce1('0x11')](_0x4ce1('0x12'));}}else{_0x31d618=_0x1fe7e8;_0x362de1[_0x4ce1('0x13')]=_0x31d618;}break;}logger[_0x4ce1('0x14')](util[_0x4ce1('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x2863a4[_0x4ce1('0x5')],_0x2863a4[_0x4ce1('0x16')],JSON[_0x4ce1('0x17')](_0x362de1)));rp(_0x362de1)[_0x4ce1('0x18')](function(_0x5ec6f8){_0x31d618=!_[_0x4ce1('0x19')](_0x31d618)?_0x4ce1('0x1a')+_0x31d618:'';_0x108a7a=typeof _0x5ec6f8['body']==='object'?JSON['stringify'](_0x5ec6f8[_0x4ce1('0x13')]):_0x5ec6f8[_0x4ce1('0x13')];logger[_0x4ce1('0x14')](util[_0x4ce1('0x15')](_0x4ce1('0x1b'),_0x2863a4[_0x4ce1('0x5')],_0x2863a4[_0x4ce1('0x16')],_0x5ec6f8['statusCode'],_0x108a7a));})[_0x4ce1('0x1c')](function(_0x45e473){logger[_0x4ce1('0x11')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x2863a4[_0x4ce1('0x5')],_0x2863a4[_0x4ce1('0x16')],_0x45e473[_0x4ce1('0x1d')],_0x45e473[_0x4ce1('0x1e')],_0x45e473[_0x4ce1('0x1f')]));});}; \ No newline at end of file +var _0x763a=['data2','number','data5','headers','data6','error','stack','toUpperCase','DELETE','data7','parse','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','lodash','../../../../config/logger','trigger','data1','render'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x763a,0x157));var _0xa763=function(_0x11bcbb,_0x57e85d){_0x11bcbb=_0x11bcbb-0x0;var _0x1561e9=_0x763a[_0x11bcbb];return _0x1561e9;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xa763('0x0'));var Mustache=require('mustache');var logger=require(_0xa763('0x1'))(_0xa763('0x2'));exports['exec']=function(_0x4b0f37,_0x4b86a6){var _0x593d62,_0x2f0de0;var _0x51a6a5={'method':_0x4b0f37[_0xa763('0x3')]['toUpperCase'](),'uri':Mustache[_0xa763('0x4')](_0x4b0f37[_0xa763('0x5')],_0x4b86a6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4b0f37['data5'])===_0xa763('0x6')&&parseInt(_0x4b0f37['data5'])>=0x1&&parseInt(_0x4b0f37[_0xa763('0x7')])<=0xa?parseInt(_0x4b0f37['data5'])*0x3e8:0x5*0x3e8};try{_0x51a6a5[_0xa763('0x8')]=_0x4b0f37['data6']?JSON['parse'](Mustache[_0xa763('0x4')](_0x4b0f37[_0xa763('0x9')],_0x4b86a6)):{};}catch(_0x1ea62a){logger[_0xa763('0xa')](_0x1ea62a[_0xa763('0xb')]);}switch(_0x4b0f37[_0xa763('0x3')][_0xa763('0xc')]()){case'GET':case _0xa763('0xd'):_0x593d62=null;_0x51a6a5['qs']=_0x4b86a6;break;case'POST':case'PUT':if(_0x4b0f37[_0xa763('0xe')]){try{_0x593d62=JSON[_0xa763('0xf')](Mustache[_0xa763('0x4')](_0x4b0f37[_0xa763('0xe')],_0x4b86a6));_0x51a6a5[_0xa763('0x10')]=_0x593d62;}catch(_0x52c8b2){logger[_0xa763('0xa')](_0x52c8b2['stack']);logger[_0xa763('0xa')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x593d62=_0x4b86a6;_0x51a6a5['body']=_0x593d62;}break;}logger[_0xa763('0x11')](util[_0xa763('0x12')](_0xa763('0x13'),_0x4b0f37[_0xa763('0x3')],_0x4b0f37[_0xa763('0x5')],JSON['stringify'](_0x51a6a5)));rp(_0x51a6a5)[_0xa763('0x14')](function(_0x56ea4f){_0x593d62=!_['isNil'](_0x593d62)?_0xa763('0x15')+_0x593d62:'';_0x2f0de0=typeof _0x56ea4f[_0xa763('0x10')]===_0xa763('0x16')?JSON[_0xa763('0x17')](_0x56ea4f[_0xa763('0x10')]):_0x56ea4f['body'];logger[_0xa763('0x11')](util[_0xa763('0x12')](_0xa763('0x18'),_0x4b0f37[_0xa763('0x3')],_0x4b0f37[_0xa763('0x5')],_0x56ea4f[_0xa763('0x19')],_0x2f0de0));})[_0xa763('0x1a')](function(_0x18d32a){logger['error'](util[_0xa763('0x12')](_0xa763('0x1b'),_0x4b0f37[_0xa763('0x3')],_0x4b0f37[_0xa763('0x5')],_0x18d32a[_0xa763('0x19')],_0x18d32a['name'],_0x18d32a[_0xa763('0x1c')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b29fdfd..4ef7aad 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 _0x73ae=['then','debug','error','rpc','result','jayson/promise','bluebird','routing','client','http','Request','request'];(function(_0x45ff95,_0x4c138e){var _0x3ff0a7=function(_0x4163a7){while(--_0x4163a7){_0x45ff95['push'](_0x45ff95['shift']());}};_0x3ff0a7(++_0x4c138e);}(_0x73ae,0x95));var _0xe73a=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x73ae[_0x4ea69d];return _0x5318e0;};'use strict';var jayson=require(_0xe73a('0x0'));var BPromise=require(_0xe73a('0x1'));var logger=require('../../config/logger')(_0xe73a('0x2'));var client=jayson[_0xe73a('0x3')][_0xe73a('0x4')]({'port':0x2329});client[_0xe73a('0x5')]=function(_0x1ffd02,_0x44a552){return new BPromise(function(_0xe88efe,_0x1b3f8c){return client[_0xe73a('0x6')](_0x1ffd02,_0x44a552)[_0xe73a('0x7')](function(_0x111d92){logger[_0xe73a('0x8')]('rpc',_0xe73a('0x2'),_0x1ffd02,_0x44a552,_0x111d92);if(_0x111d92[_0xe73a('0x9')]){logger[_0xe73a('0x9')](_0xe73a('0xa'),_0xe73a('0x2'),_0x1ffd02,_0x111d92[_0xe73a('0x9')]['message'],_0x44a552);return _0x1b3f8c(_0x111d92[_0xe73a('0x9')]['message']);}else{return _0xe88efe(_0x111d92[_0xe73a('0xb')]);}})['catch'](function(_0x384bb6){logger[_0xe73a('0x9')](_0xe73a('0xa'),_0xe73a('0x2'),_0x1ffd02,_0x384bb6,_0x44a552);return _0x1b3f8c(_0x384bb6);});});};module['exports']=client; \ No newline at end of file +var _0xcafd=['http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x391bf7,_0x5b92f7){var _0x41c384=function(_0x13541a){while(--_0x13541a){_0x391bf7['push'](_0x391bf7['shift']());}};_0x41c384(++_0x5b92f7);}(_0xcafd,0x10a));var _0xdcaf=function(_0x4b54b9,_0x2a2f68){_0x4b54b9=_0x4b54b9-0x0;var _0x30f9d4=_0xcafd[_0x4b54b9];return _0x30f9d4;};'use strict';var jayson=require(_0xdcaf('0x0'));var BPromise=require(_0xdcaf('0x1'));var logger=require(_0xdcaf('0x2'))(_0xdcaf('0x3'));var client=jayson['client'][_0xdcaf('0x4')]({'port':0x2329});client[_0xdcaf('0x5')]=function(_0x59eaed,_0x139662){return new BPromise(function(_0x5c3bc0,_0x378a3e){return client[_0xdcaf('0x6')](_0x59eaed,_0x139662)[_0xdcaf('0x7')](function(_0x446060){logger[_0xdcaf('0x8')](_0xdcaf('0x9'),_0xdcaf('0x3'),_0x59eaed,_0x139662,_0x446060);if(_0x446060['error']){logger[_0xdcaf('0xa')](_0xdcaf('0x9'),_0xdcaf('0x3'),_0x59eaed,_0x446060[_0xdcaf('0xa')][_0xdcaf('0xb')],_0x139662);return _0x378a3e(_0x446060['error'][_0xdcaf('0xb')]);}else{return _0x5c3bc0(_0x446060[_0xdcaf('0xc')]);}})[_0xdcaf('0xd')](function(_0x5a1304){logger[_0xdcaf('0xa')]('rpc',_0xdcaf('0x3'),_0x59eaed,_0x5a1304,_0x139662);return _0x378a3e(_0x5a1304);});});};module[_0xdcaf('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0e69954..e4c22c0 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 _0x4e62=['loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0xd0e4f5,_0x5a9059){var _0x53fb8c=function(_0x5b4397){while(--_0x5b4397){_0xd0e4f5['push'](_0xd0e4f5['shift']());}};_0x53fb8c(++_0x5a9059);}(_0x4e62,0x17e));var _0x24e6=function(_0x51cd3f,_0x13df57){_0x51cd3f=_0x51cd3f-0x0;var _0xb62bff=_0x4e62[_0x51cd3f];return _0xb62bff;};'use strict';var server=require(_0x24e6('0x0'));var Realtime=require(_0x24e6('0x1'));var EmailChannel=require(_0x24e6('0x2'));var mailAccount=require(_0x24e6('0x3'));var setting=require(_0x24e6('0x4'));var logger=require(_0x24e6('0x5'))(_0x24e6('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x24e6('0x7')]()[_0x24e6('0x8')](mailAccount[_0x24e6('0x9')]())[_0x24e6('0x8')](realtime['initMailAccounts']())[_0x24e6('0x8')](function(){email[_0x24e6('0xa')](realtime[_0x24e6('0xb')]);return realtime;});}function main(){return server[_0x24e6('0xc')](realtime,email)[_0x24e6('0x8')](function(){return initRealtime();})[_0x24e6('0x8')](function(){return setting[_0x24e6('0xd')]();})[_0x24e6('0x8')](function(_0x11d9a9){return setInterval(initRealtime,_0x11d9a9[_0x24e6('0xe')]*0x3e8);})[_0x24e6('0xf')](function(_0x30cf66){logger[_0x24e6('0x10')](_0x24e6('0x11'),_0x30cf66);});}main(); \ No newline at end of file +var _0xd0f2=['./realtime','./rpc/mailAccount','email','resolve','then','initMailAccounts','refresh','listen','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server'];(function(_0x1ffe91,_0x43ece5){var _0x2ad3ae=function(_0x3134b1){while(--_0x3134b1){_0x1ffe91['push'](_0x1ffe91['shift']());}};_0x2ad3ae(++_0x43ece5);}(_0xd0f2,0x141));var _0x2d0f=function(_0x3fcb8c,_0x120ae0){_0x3fcb8c=_0x3fcb8c-0x0;var _0x3cca17=_0xd0f2[_0x3fcb8c];return _0x3cca17;};'use strict';var server=require(_0x2d0f('0x0'));var Realtime=require(_0x2d0f('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x2d0f('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0x2d0f('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x2d0f('0x4')]()[_0x2d0f('0x5')](mailAccount['getMailAccounts']())[_0x2d0f('0x5')](realtime[_0x2d0f('0x6')]())['then'](function(){email[_0x2d0f('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x2d0f('0x8')](realtime,email)[_0x2d0f('0x5')](function(){return initRealtime();})[_0x2d0f('0x5')](function(){return setting[_0x2d0f('0x9')]();})[_0x2d0f('0x5')](function(_0x408628){return setInterval(initRealtime,_0x408628[_0x2d0f('0xa')]*0x3e8);})[_0x2d0f('0xb')](function(_0x153141){logger[_0x2d0f('0xc')](_0x2d0f('0xd'),_0x153141);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 2f29c70..69fcde1 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 _0x262a=['info','start\x20email\x20channel','mailAccounts','imapAccounts','name','key','active','Imap','status','messageStatus','total','md5','mailAccount:update','prototype','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','disabled','emit','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','lastSync','smtp','verified','catch','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x87035f,_0x16dbf9){var _0x25ff8c=function(_0x4389c8){while(--_0x4389c8){_0x87035f['push'](_0x87035f['shift']());}};_0x25ff8c(++_0x16dbf9);}(_0x262a,0x11b));var _0xa262=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x262a[_0x2e4cbf];return _0x52840f;};'use strict';var _=require(_0xa262('0x0'));var moment=require(_0xa262('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xa262('0x2'));var config=require(_0xa262('0x3'));var logger=require(_0xa262('0x4'))(_0xa262('0x5'));config[_0xa262('0x6')]=_[_0xa262('0x7')](config[_0xa262('0x6')],{'host':_0xa262('0x8'),'port':0x18eb});var io=require(_0xa262('0x9'))(new Redis(config[_0xa262('0x6')]));var EmailImap=require(_0xa262('0xa'));var EmailSmtp=require(_0xa262('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x129808){logger[_0xa262('0xc')](_0xa262('0xd'));this['mailAccounts']=_0x129808[_0xa262('0xe')];this[_0xa262('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x226fcc){var _0x18da44=this['mailAccounts'][_0x226fcc];var _0x55eb0e={'id':_0x18da44['id'],'name':_0x18da44[_0xa262('0x10')],'key':_0x18da44[_0xa262('0x11')],'active':_0x18da44[_0xa262('0x12')],'Imap':{'status':_0x18da44[_0xa262('0x13')][_0xa262('0x14')],'messageStatus':_0x18da44['Imap'][_0xa262('0x15')],'total':_0x18da44['Imap'][_0xa262('0x16')]}};if(_['isNil'](md5Accounts[_0x226fcc])){md5Accounts[_0x226fcc]={};}var _0x3323aa=md5(JSON['stringify'](_0x55eb0e));if(md5Accounts[_0x226fcc][_0xa262('0x17')]!==_0x3323aa){md5Accounts[_0x226fcc]['md5']=_0x3323aa;io['emit'](_0xa262('0x18'),_0x55eb0e);}};EmailChannel[_0xa262('0x19')]['refresh']=function(_0x38ba9f){for(var _0x464677 in _0x38ba9f){if(_0x38ba9f[_0xa262('0x1a')](_0x464677)){if(_0x38ba9f[_0x464677][_0xa262('0x13')]&&_0x38ba9f[_0x464677][_0xa262('0x12')]){var _0x13bb73=_0x38ba9f[_0x464677]['Imap'];if(!_0x13bb73[_0xa262('0x1b')]&&_0x38ba9f[_0x464677][_0xa262('0x1c')]!==_0xa262('0x1d'))_0x13bb73[_0xa262('0x1b')]=_0x38ba9f[_0x464677][_0xa262('0x1c')];if(!this['imapAccounts'][_0xa262('0x1a')](_0x13bb73['id'])){this[_0xa262('0xf')][_0x13bb73['id']]=new EmailImap(_0x13bb73,_0x38ba9f[_0x464677][_0xa262('0x5')]);this[_0xa262('0xf')][_0x13bb73['id']]['on'](_0xa262('0x1e'),this[_0xa262('0x1f')][_0xa262('0x20')](this,_0x464677));this[_0xa262('0xf')][_0x13bb73['id']]['on'](_0xa262('0x5'),this[_0xa262('0x21')][_0xa262('0x20')](this,_0x464677));this[_0xa262('0xf')][_0x13bb73['id']]['on'](_0xa262('0x22'),this[_0xa262('0x23')]['bind'](this,_0x464677));this['imapAccounts'][_0x13bb73['id']]['on'](_0xa262('0x24'),this[_0xa262('0x25')][_0xa262('0x20')](this,_0x464677));}}else{if(_[_0xa262('0x26')](this[_0xa262('0xe')][_0x464677][_0xa262('0x13')])){this['mailAccounts'][_0x464677]['Imap']={};}this['mailAccounts'][_0x464677][_0xa262('0x13')][_0xa262('0x14')]=_0xa262('0x27');this[_0xa262('0xe')][_0x464677]['Imap'][_0xa262('0x15')]='';this[_0xa262('0x28')](_0x464677);}}}};EmailChannel[_0xa262('0x19')][_0xa262('0x1f')]=function(_0x2af4c2,_0x5ad626){if(this[_0xa262('0xe')][_0x2af4c2]){this['mailAccounts'][_0x2af4c2]['Imap'][_0xa262('0x14')]='connected';this[_0xa262('0xe')][_0x2af4c2]['Imap'][_0xa262('0x15')]=_0x5ad626[_0xa262('0x10')];if(_0x5ad626[_0xa262('0x29')]){this[_0xa262('0xe')][_0x2af4c2][_0xa262('0x13')][_0xa262('0x16')]=_0x5ad626[_0xa262('0x29')][_0xa262('0x16')];}return this[_0xa262('0x28')](_0x2af4c2);}};EmailChannel[_0xa262('0x19')]['handleImapEmail']=function(_0x37073b,_0x5de4f3){logger[_0xa262('0xc')](_0xa262('0x2a'),_0x5de4f3['firstName'],_0x5de4f3[_0xa262('0x2b')],_0x5de4f3[_0xa262('0x2c')],_0x37073b);if(this[_0xa262('0xe')][_0x37073b]){return mailAccount[_0xa262('0x2d')](_0x37073b,_0x5de4f3)[_0xa262('0x2e')](function(_0x31c531){if(_0x31c531){logger[_0xa262('0xc')](_0xa262('0x2f'));}})['catch'](function(_0x50d011){logger['error'](_0xa262('0x30'),JSON[_0xa262('0x31')](_0x50d011));});}};EmailChannel[_0xa262('0x19')][_0xa262('0x23')]=function(_0x2524e9){if(this['mailAccounts'][_0x2524e9]&&this['mailAccounts'][_0x2524e9]['Imap']){if(this[_0xa262('0xf')][this[_0xa262('0xe')][_0x2524e9]['Imap']['id']]){delete this['imapAccounts'][this[_0xa262('0xe')][_0x2524e9][_0xa262('0x13')]['id']];}this['mailAccounts'][_0x2524e9][_0xa262('0x13')]['lastSync']=moment();this[_0xa262('0x28')](_0x2524e9);}};EmailChannel[_0xa262('0x19')]['handleImapError']=function(_0x46fd8c,_0x3ee1de){if(this[_0xa262('0xe')][_0x46fd8c]){this['mailAccounts'][_0x46fd8c][_0xa262('0x13')][_0xa262('0x14')]='error';this['mailAccounts'][_0x46fd8c]['Imap'][_0xa262('0x15')]=_0x3ee1de;return this[_0xa262('0x28')](_0x46fd8c);}};EmailChannel[_0xa262('0x19')][_0xa262('0x32')]=function(_0x52e884,_0x39a461){return this['smtp'][_0xa262('0x33')](_0x52e884,_0x39a461);};EmailChannel[_0xa262('0x19')][_0xa262('0x34')]=function(_0x163830){var _0x2bee61=this;if(this[_0xa262('0xe')][_0x163830['id']]){if(_[_0xa262('0x26')](this[_0xa262('0xe')][_0x163830['id']][_0xa262('0x35')])){this['mailAccounts'][_0x163830['id']]['Smtp']={};}this[_0xa262('0xe')][_0x163830['id']][_0xa262('0x35')][_0xa262('0x36')]=moment();return new BPromise(function(_0x538e37,_0x4d2126){return _0x2bee61[_0xa262('0x37')]['verify'](_0x163830)[_0xa262('0x2e')](function(_0x47b9a0){_0x2bee61['mailAccounts'][_0x163830['id']][_0xa262('0x35')][_0xa262('0x14')]=_0xa262('0x38');_0x2bee61['mailAccounts'][_0x163830['id']][_0xa262('0x35')][_0xa262('0x15')]='';_0x2bee61[_0xa262('0x28')](_0x163830['id']);_0x538e37(_0x47b9a0);})[_0xa262('0x39')](function(_0x2899d9){_0x2bee61[_0xa262('0xe')][_0x163830['id']]['Smtp'][_0xa262('0x14')]=_0xa262('0x24');_0x2bee61[_0xa262('0xe')][_0x163830['id']][_0xa262('0x35')][_0xa262('0x15')]=_0x2899d9;_0x2bee61[_0xa262('0x28')](_0x163830['id']);_0x4d2126(_0x2899d9);});});}return this[_0xa262('0x37')]['verify'](_0x163830);};module[_0xa262('0x3a')]=EmailChannel; \ No newline at end of file +var _0x58ce=['socket.io-emitter','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','refresh','service','provider','custom','imapAccounts','hasOwnProperty','email','bind','handleImapEmail','end','handleImapEnd','error','disabled','handleImapBox','messageStatus','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','Smtp','verify','verified','exports','bluebird','md5','../../../config/environment','../../../config/logger','redis','localhost'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x58ce,0x16d));var _0xe58c=function(_0xfd04a5,_0x1fbd6a){_0xfd04a5=_0xfd04a5-0x0;var _0x576bfe=_0x58ce[_0xfd04a5];return _0x576bfe;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xe58c('0x0'));var md5=require(_0xe58c('0x1'));var Redis=require('ioredis');var config=require(_0xe58c('0x2'));var logger=require(_0xe58c('0x3'))('email');config['redis']=_['defaults'](config[_0xe58c('0x4')],{'host':_0xe58c('0x5'),'port':0x18eb});var io=require(_0xe58c('0x6'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x51adf1){logger['info'](_0xe58c('0x7'));this[_0xe58c('0x8')]=_0x51adf1[_0xe58c('0x8')];this['imapAccounts']={};this[_0xe58c('0x9')]=new EmailSmtp();}EmailChannel[_0xe58c('0xa')][_0xe58c('0xb')]=function(_0x3054e0){var _0x467a0b=this[_0xe58c('0x8')][_0x3054e0];var _0x596f5f={'id':_0x467a0b['id'],'name':_0x467a0b[_0xe58c('0xc')],'key':_0x467a0b[_0xe58c('0xd')],'active':_0x467a0b[_0xe58c('0xe')],'Imap':{'status':_0x467a0b[_0xe58c('0xf')][_0xe58c('0x10')],'messageStatus':_0x467a0b[_0xe58c('0xf')]['messageStatus'],'total':_0x467a0b[_0xe58c('0xf')][_0xe58c('0x11')]}};if(_[_0xe58c('0x12')](md5Accounts[_0x3054e0])){md5Accounts[_0x3054e0]={};}var _0x4a412e=md5(JSON[_0xe58c('0x13')](_0x596f5f));if(md5Accounts[_0x3054e0][_0xe58c('0x1')]!==_0x4a412e){md5Accounts[_0x3054e0]['md5']=_0x4a412e;io[_0xe58c('0xb')]('mailAccount:update',_0x596f5f);}};EmailChannel[_0xe58c('0xa')][_0xe58c('0x14')]=function(_0x2351b9){for(var _0x1017d5 in _0x2351b9){if(_0x2351b9['hasOwnProperty'](_0x1017d5)){if(_0x2351b9[_0x1017d5][_0xe58c('0xf')]&&_0x2351b9[_0x1017d5][_0xe58c('0xe')]){var _0x434b6a=_0x2351b9[_0x1017d5]['Imap'];if(!_0x434b6a[_0xe58c('0x15')]&&_0x2351b9[_0x1017d5][_0xe58c('0x16')]!==_0xe58c('0x17'))_0x434b6a[_0xe58c('0x15')]=_0x2351b9[_0x1017d5][_0xe58c('0x16')];if(!this[_0xe58c('0x18')][_0xe58c('0x19')](_0x434b6a['id'])){this[_0xe58c('0x18')][_0x434b6a['id']]=new EmailImap(_0x434b6a,_0x2351b9[_0x1017d5][_0xe58c('0x1a')]);this[_0xe58c('0x18')][_0x434b6a['id']]['on']('box',this['handleImapBox'][_0xe58c('0x1b')](this,_0x1017d5));this[_0xe58c('0x18')][_0x434b6a['id']]['on'](_0xe58c('0x1a'),this[_0xe58c('0x1c')][_0xe58c('0x1b')](this,_0x1017d5));this[_0xe58c('0x18')][_0x434b6a['id']]['on'](_0xe58c('0x1d'),this[_0xe58c('0x1e')][_0xe58c('0x1b')](this,_0x1017d5));this['imapAccounts'][_0x434b6a['id']]['on'](_0xe58c('0x1f'),this['handleImapError'][_0xe58c('0x1b')](this,_0x1017d5));}}else{if(_[_0xe58c('0x12')](this[_0xe58c('0x8')][_0x1017d5][_0xe58c('0xf')])){this[_0xe58c('0x8')][_0x1017d5][_0xe58c('0xf')]={};}this[_0xe58c('0x8')][_0x1017d5][_0xe58c('0xf')][_0xe58c('0x10')]=_0xe58c('0x20');this[_0xe58c('0x8')][_0x1017d5][_0xe58c('0xf')]['messageStatus']='';this[_0xe58c('0xb')](_0x1017d5);}}}};EmailChannel[_0xe58c('0xa')][_0xe58c('0x21')]=function(_0x2029f4,_0x16d7bb){if(this['mailAccounts'][_0x2029f4]){this[_0xe58c('0x8')][_0x2029f4][_0xe58c('0xf')][_0xe58c('0x10')]='connected';this[_0xe58c('0x8')][_0x2029f4][_0xe58c('0xf')][_0xe58c('0x22')]=_0x16d7bb[_0xe58c('0xc')];if(_0x16d7bb[_0xe58c('0x23')]){this[_0xe58c('0x8')][_0x2029f4][_0xe58c('0xf')][_0xe58c('0x11')]=_0x16d7bb[_0xe58c('0x23')]['total'];}return this[_0xe58c('0xb')](_0x2029f4);}};EmailChannel[_0xe58c('0xa')][_0xe58c('0x1c')]=function(_0xd3c136,_0x29048b){logger[_0xe58c('0x24')](_0xe58c('0x25'),_0x29048b[_0xe58c('0x26')],_0x29048b[_0xe58c('0x27')],_0x29048b[_0xe58c('0x28')],_0xd3c136);if(this[_0xe58c('0x8')][_0xd3c136]){return mailAccount['notify'](_0xd3c136,_0x29048b)[_0xe58c('0x29')](function(_0x1bb693){if(_0x1bb693){logger[_0xe58c('0x24')](_0xe58c('0x2a'));}})[_0xe58c('0x2b')](function(_0xd249de){logger[_0xe58c('0x1f')](_0xe58c('0x2c'),JSON[_0xe58c('0x13')](_0xd249de));});}};EmailChannel[_0xe58c('0xa')]['handleImapEnd']=function(_0x2f828e){if(this[_0xe58c('0x8')][_0x2f828e]&&this[_0xe58c('0x8')][_0x2f828e][_0xe58c('0xf')]){if(this[_0xe58c('0x18')][this[_0xe58c('0x8')][_0x2f828e][_0xe58c('0xf')]['id']]){delete this[_0xe58c('0x18')][this[_0xe58c('0x8')][_0x2f828e][_0xe58c('0xf')]['id']];}this[_0xe58c('0x8')][_0x2f828e][_0xe58c('0xf')][_0xe58c('0x2d')]=moment();this[_0xe58c('0xb')](_0x2f828e);}};EmailChannel[_0xe58c('0xa')][_0xe58c('0x2e')]=function(_0x10b44e,_0x42178f){if(this[_0xe58c('0x8')][_0x10b44e]){this['mailAccounts'][_0x10b44e][_0xe58c('0xf')][_0xe58c('0x10')]=_0xe58c('0x1f');this[_0xe58c('0x8')][_0x10b44e]['Imap'][_0xe58c('0x22')]=_0x42178f;return this[_0xe58c('0xb')](_0x10b44e);}};EmailChannel[_0xe58c('0xa')][_0xe58c('0x2f')]=function(_0x55535d,_0x2d920c){return this[_0xe58c('0x9')][_0xe58c('0x30')](_0x55535d,_0x2d920c);};EmailChannel[_0xe58c('0xa')]['verifySmtp']=function(_0x312ec2){var _0x1b0060=this;if(this[_0xe58c('0x8')][_0x312ec2['id']]){if(_['isNil'](this[_0xe58c('0x8')][_0x312ec2['id']][_0xe58c('0x31')])){this[_0xe58c('0x8')][_0x312ec2['id']][_0xe58c('0x31')]={};}this[_0xe58c('0x8')][_0x312ec2['id']][_0xe58c('0x31')][_0xe58c('0x2d')]=moment();return new BPromise(function(_0x5ba52f,_0x517c20){return _0x1b0060[_0xe58c('0x9')][_0xe58c('0x32')](_0x312ec2)[_0xe58c('0x29')](function(_0x17c409){_0x1b0060[_0xe58c('0x8')][_0x312ec2['id']]['Smtp'][_0xe58c('0x10')]=_0xe58c('0x33');_0x1b0060[_0xe58c('0x8')][_0x312ec2['id']]['Smtp']['messageStatus']='';_0x1b0060[_0xe58c('0xb')](_0x312ec2['id']);_0x5ba52f(_0x17c409);})[_0xe58c('0x2b')](function(_0x446bc8){_0x1b0060['mailAccounts'][_0x312ec2['id']][_0xe58c('0x31')][_0xe58c('0x10')]=_0xe58c('0x1f');_0x1b0060[_0xe58c('0x8')][_0x312ec2['id']][_0xe58c('0x31')][_0xe58c('0x22')]=_0x446bc8;_0x1b0060['emit'](_0x312ec2['id']);_0x517c20(_0x446bc8);});});}return this['smtp'][_0xe58c('0x32')](_0x312ec2);};module[_0xe58c('0x34')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a25f713..dd725a9 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 _0x5b13=['tls','autotls','required','prototype','handleReady','openBox','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','handleEnd','textCode','hasOwnProperty','lodash','imap','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','once','bind','end','error','connect','inherits','connTimeout','service','user','xoauth2','generateXOAuth2Token','password','authentication','anonymous@xcally.com','port'];(function(_0x4ae921,_0x57cb71){var _0x1f203b=function(_0xcd008e){while(--_0xcd008e){_0x4ae921['push'](_0x4ae921['shift']());}};_0x1f203b(++_0x57cb71);}(_0x5b13,0x1ad));var _0x35b1=function(_0x2439da,_0x15a322){_0x2439da=_0x2439da-0x0;var _0x233325=_0x5b13[_0x2439da];return _0x233325;};'use strict';var _=require(_0x35b1('0x0'));var util=require('util');var Imap=require(_0x35b1('0x1'));var simpleParser=require(_0x35b1('0x2'))[_0x35b1('0x3')];var Iconv=require(_0x35b1('0x4'))['Iconv'];var EventEmitter=require(_0x35b1('0x5'))['EventEmitter'];var utils=require(_0x35b1('0x6'));var logger=require(_0x35b1('0x7'))(_0x35b1('0x8'));function EmailImap(_0x3ac75b,_0x542b6){this[_0x35b1('0x9')]=_0x3ac75b['mailbox'];this[_0x35b1('0xa')]=this[_0x35b1('0xb')](_0x3ac75b,_0x542b6);this[_0x35b1('0x1')]=new Imap(this['account']);this['imap'][_0x35b1('0xc')]('ready',this['handleReady'][_0x35b1('0xd')](this));this[_0x35b1('0x1')][_0x35b1('0xc')](_0x35b1('0xe'),this['handleEnd'][_0x35b1('0xd')](this));this[_0x35b1('0x1')]['on'](_0x35b1('0xf'),this['handleError']['bind'](this));this[_0x35b1('0x1')][_0x35b1('0x10')]();}util[_0x35b1('0x11')](EmailImap,EventEmitter);EmailImap['prototype'][_0x35b1('0xb')]=function(_0x232c0f,_0x175409){var _0x585991={'connTimeout':_0x232c0f['connTimeout']?_0x232c0f[_0x35b1('0x12')]*0x3e8:0x2710,'authTimeout':_0x232c0f['authTimeout']?_0x232c0f['authTimeout']*0x3e8:0x1388};if(_0x232c0f[_0x35b1('0x13')]){_0x585991[_0x35b1('0x14')]=_0x232c0f['user'];if(_0x232c0f['modernAuthentication']){_0x585991[_0x35b1('0x15')]=utils[_0x35b1('0x16')](_0x232c0f['CloudProvider']['data5'],_0x232c0f[_0x35b1('0x14')]);}else{_0x585991[_0x35b1('0x17')]=_0x232c0f[_0x35b1('0x17')];}}else{if(_0x232c0f[_0x35b1('0x18')]){_0x585991[_0x35b1('0x14')]=_0x232c0f[_0x35b1('0x14')];_0x585991[_0x35b1('0x17')]=_0x232c0f[_0x35b1('0x17')];}}_0x585991['email']=_0x175409||_0x232c0f['user']||_0x35b1('0x19');_0x585991['host']=_0x232c0f['host'];_0x585991[_0x35b1('0x1a')]=_0x232c0f[_0x35b1('0x1a')]||0x3e1;if(_0x232c0f['tls']){_0x585991[_0x35b1('0x1b')]=!![];}else{_0x585991[_0x35b1('0x1b')]=![];_0x585991[_0x35b1('0x1c')]=_0x35b1('0x1d');}return _0x585991;};EmailImap[_0x35b1('0x1e')][_0x35b1('0x1f')]=function(){this['imap'][_0x35b1('0x20')](this[_0x35b1('0x9')],![],this[_0x35b1('0x21')][_0x35b1('0xd')](this));};EmailImap[_0x35b1('0x1e')][_0x35b1('0x21')]=function(_0x3ee6fd,_0x238198){if(_0x3ee6fd){this[_0x35b1('0x22')](_0x3ee6fd,!![]);}else{this[_0x35b1('0x23')](_0x35b1('0x24'),_0x238198);this[_0x35b1('0x25')]();}};EmailImap[_0x35b1('0x1e')][_0x35b1('0x26')]=function(_0x1df754){if(_0x1df754){this[_0x35b1('0x22')](_0x1df754,!![]);}else{this[_0x35b1('0x1')][_0x35b1('0xe')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0x35b1('0x1')][_0x35b1('0x27')]([_0x35b1('0x28')],this[_0x35b1('0x29')]['bind'](this));};EmailImap['prototype'][_0x35b1('0x29')]=function(_0x11b8b3,_0x550175){if(_0x11b8b3){this[_0x35b1('0x22')](_0x11b8b3,!![]);}else{if(_0x550175['length']){try{var _0xd61098=this[_0x35b1('0x1')][_0x35b1('0x2a')](_0x550175,{'bodies':'','markSeen':!![]});_0xd61098['on'](_0x35b1('0x2b'),this[_0x35b1('0x2c')]['bind'](this));_0xd61098['once'](_0x35b1('0xf'),this['handleFetchError'][_0x35b1('0xd')](this));_0xd61098['once']('end',this[_0x35b1('0x2d')][_0x35b1('0xd')](this));}catch(_0x1f98c0){logger[_0x35b1('0xf')](_0x1f98c0);}}else{this[_0x35b1('0x1')][_0x35b1('0x2e')](!![],this[_0x35b1('0x26')][_0x35b1('0xd')](this));}}};EmailImap[_0x35b1('0x1e')]['handleFetchMessage']=function(_0x12d9c8){_0x12d9c8['on']('body',this[_0x35b1('0x2f')][_0x35b1('0xd')](this));_0x12d9c8[_0x35b1('0xc')](_0x35b1('0x30'),this[_0x35b1('0x31')][_0x35b1('0xd')](this));_0x12d9c8[_0x35b1('0xc')]('end',this[_0x35b1('0x32')][_0x35b1('0xd')](this));};EmailImap[_0x35b1('0x1e')]['handleMessageBody']=function(_0x1584e4){simpleParser(_0x1584e4,{'Iconv':Iconv},this[_0x35b1('0x33')][_0x35b1('0xd')](this));};EmailImap[_0x35b1('0x1e')][_0x35b1('0x31')]=function(){};EmailImap[_0x35b1('0x1e')][_0x35b1('0x32')]=function(){};EmailImap[_0x35b1('0x1e')][_0x35b1('0x33')]=function(_0x2386f1,_0xe64ce4){if(_0x2386f1){logger[_0x35b1('0xf')](_0x2386f1);}else{var _0x51ad34=this;utils[_0x35b1('0x34')](this[_0x35b1('0xa')],_0xe64ce4,function(_0x27265a){_0x51ad34[_0x35b1('0x23')](_0x35b1('0x8'),_0x27265a);});}};EmailImap[_0x35b1('0x1e')][_0x35b1('0x2d')]=function(){this[_0x35b1('0x1')][_0x35b1('0x2e')](!![],this[_0x35b1('0x26')][_0x35b1('0xd')](this));};EmailImap[_0x35b1('0x1e')][_0x35b1('0x35')]=function(_0x5663fd){this[_0x35b1('0x22')](_0x5663fd);this[_0x35b1('0x1')][_0x35b1('0x2e')](!![],this[_0x35b1('0x26')][_0x35b1('0xd')](this));};EmailImap['prototype'][_0x35b1('0x36')]=function(){this[_0x35b1('0x23')](_0x35b1('0xe'));};EmailImap['prototype'][_0x35b1('0x22')]=function(_0x20b089,_0x124743){logger[_0x35b1('0xf')](_0x35b1('0x22'),this[_0x35b1('0xa')][_0x35b1('0x8')],JSON['stringify'](_0x20b089));var _0x3be698='';if(_0x20b089){if(_0x20b089[_0x35b1('0x37')]){_0x3be698=_0x20b089['textCode'];}else{for(var _0x500e07 in _0x20b089){if(_0x20b089[_0x35b1('0x38')](_0x500e07)){_0x3be698+=_['upperFirst'](_0x500e07)+':\x20'+_0x20b089[_0x500e07]+'\x0a';}}}}if(_0x124743){this['imap'][_0x35b1('0xe')]();}else{this['emit'](_0x35b1('0xf'),_0x3be698);this[_0x35b1('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x94a5=['handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','length','message','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','exports','lodash','util','imap','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','password','authentication','host','port','tls','required','openBox','handleOpenBox','emit'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x94a5,0x16b));var _0x594a=function(_0x40e423,_0x10e3df){_0x40e423=_0x40e423-0x0;var _0x2c41f9=_0x94a5[_0x40e423];return _0x2c41f9;};'use strict';var _=require(_0x594a('0x0'));var util=require(_0x594a('0x1'));var Imap=require(_0x594a('0x2'));var simpleParser=require(_0x594a('0x3'))[_0x594a('0x4')];var Iconv=require('iconv')[_0x594a('0x5')];var EventEmitter=require('events')[_0x594a('0x6')];var utils=require(_0x594a('0x7'));var logger=require(_0x594a('0x8'))(_0x594a('0x9'));function EmailImap(_0x1508b2,_0x3fe416){this[_0x594a('0xa')]=_0x1508b2['mailbox'];this[_0x594a('0xb')]=this['getAccount'](_0x1508b2,_0x3fe416);this['imap']=new Imap(this[_0x594a('0xb')]);this[_0x594a('0x2')][_0x594a('0xc')](_0x594a('0xd'),this[_0x594a('0xe')]['bind'](this));this[_0x594a('0x2')][_0x594a('0xc')]('end',this['handleEnd'][_0x594a('0xf')](this));this[_0x594a('0x2')]['on'](_0x594a('0x10'),this[_0x594a('0x11')][_0x594a('0xf')](this));this[_0x594a('0x2')][_0x594a('0x12')]();}util[_0x594a('0x13')](EmailImap,EventEmitter);EmailImap[_0x594a('0x14')]['getAccount']=function(_0x6771b9,_0x51dbb9){var _0x28aab4={'connTimeout':_0x6771b9[_0x594a('0x15')]?_0x6771b9[_0x594a('0x15')]*0x3e8:0x2710,'authTimeout':_0x6771b9[_0x594a('0x16')]?_0x6771b9['authTimeout']*0x3e8:0x1388};if(_0x6771b9[_0x594a('0x17')]){_0x28aab4['user']=_0x6771b9[_0x594a('0x18')];if(_0x6771b9['modernAuthentication']){_0x28aab4[_0x594a('0x19')]=utils[_0x594a('0x1a')](_0x6771b9['CloudProvider']['data5'],_0x6771b9[_0x594a('0x18')]);}else{_0x28aab4[_0x594a('0x1b')]=_0x6771b9[_0x594a('0x1b')];}}else{if(_0x6771b9[_0x594a('0x1c')]){_0x28aab4[_0x594a('0x18')]=_0x6771b9[_0x594a('0x18')];_0x28aab4['password']=_0x6771b9['password'];}}_0x28aab4[_0x594a('0x9')]=_0x51dbb9||_0x6771b9[_0x594a('0x18')]||'anonymous@xcally.com';_0x28aab4['host']=_0x6771b9[_0x594a('0x1d')];_0x28aab4[_0x594a('0x1e')]=_0x6771b9[_0x594a('0x1e')]||0x3e1;if(_0x6771b9[_0x594a('0x1f')]){_0x28aab4[_0x594a('0x1f')]=!![];}else{_0x28aab4[_0x594a('0x1f')]=![];_0x28aab4['autotls']=_0x594a('0x20');}return _0x28aab4;};EmailImap[_0x594a('0x14')][_0x594a('0xe')]=function(){this['imap'][_0x594a('0x21')](this[_0x594a('0xa')],![],this[_0x594a('0x22')][_0x594a('0xf')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x151bca,_0x5bcc09){if(_0x151bca){this[_0x594a('0x11')](_0x151bca,!![]);}else{this[_0x594a('0x23')]('box',_0x5bcc09);this['readUnseen']();}};EmailImap[_0x594a('0x14')][_0x594a('0x24')]=function(_0x4cb28c){if(_0x4cb28c){this[_0x594a('0x11')](_0x4cb28c,!![]);}else{this[_0x594a('0x2')][_0x594a('0x25')]();}};EmailImap[_0x594a('0x14')][_0x594a('0x26')]=function(){this[_0x594a('0x2')][_0x594a('0x27')]([_0x594a('0x28')],this['handleReadUnseen'][_0x594a('0xf')](this));};EmailImap['prototype'][_0x594a('0x29')]=function(_0x16ac52,_0x486913){if(_0x16ac52){this['handleError'](_0x16ac52,!![]);}else{if(_0x486913[_0x594a('0x2a')]){try{var _0x478ed2=this[_0x594a('0x2')]['fetch'](_0x486913,{'bodies':'','markSeen':!![]});_0x478ed2['on'](_0x594a('0x2b'),this['handleFetchMessage']['bind'](this));_0x478ed2[_0x594a('0xc')](_0x594a('0x10'),this['handleFetchError'][_0x594a('0xf')](this));_0x478ed2[_0x594a('0xc')](_0x594a('0x25'),this[_0x594a('0x2c')][_0x594a('0xf')](this));}catch(_0x57f6c9){logger[_0x594a('0x10')](_0x57f6c9);}}else{this['imap'][_0x594a('0x2d')](!![],this[_0x594a('0x24')][_0x594a('0xf')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x5b41f2){_0x5b41f2['on'](_0x594a('0x2e'),this[_0x594a('0x2f')][_0x594a('0xf')](this));_0x5b41f2[_0x594a('0xc')](_0x594a('0x30'),this[_0x594a('0x31')][_0x594a('0xf')](this));_0x5b41f2[_0x594a('0xc')](_0x594a('0x25'),this[_0x594a('0x32')]['bind'](this));};EmailImap[_0x594a('0x14')][_0x594a('0x2f')]=function(_0x3ee6a8){simpleParser(_0x3ee6a8,{'Iconv':Iconv},this[_0x594a('0x33')]['bind'](this));};EmailImap[_0x594a('0x14')][_0x594a('0x31')]=function(){};EmailImap[_0x594a('0x14')]['handleMessageEnd']=function(){};EmailImap[_0x594a('0x14')][_0x594a('0x33')]=function(_0x471884,_0x2060b2){if(_0x471884){logger[_0x594a('0x10')](_0x471884);}else{var _0x217799=this;utils[_0x594a('0x34')](this[_0x594a('0xb')],_0x2060b2,function(_0x496c41){_0x217799[_0x594a('0x23')](_0x594a('0x9'),_0x496c41);});}};EmailImap[_0x594a('0x14')][_0x594a('0x2c')]=function(){this[_0x594a('0x2')][_0x594a('0x2d')](!![],this['handleCloseBox'][_0x594a('0xf')](this));};EmailImap[_0x594a('0x14')][_0x594a('0x35')]=function(_0x5a93da){this[_0x594a('0x11')](_0x5a93da);this[_0x594a('0x2')][_0x594a('0x2d')](!![],this[_0x594a('0x24')][_0x594a('0xf')](this));};EmailImap[_0x594a('0x14')]['handleEnd']=function(){this[_0x594a('0x23')](_0x594a('0x25'));};EmailImap[_0x594a('0x14')]['handleError']=function(_0x23d8d8,_0x2006fe){logger[_0x594a('0x10')]('handleError',this[_0x594a('0xb')][_0x594a('0x9')],JSON[_0x594a('0x36')](_0x23d8d8));var _0x2e5b9a='';if(_0x23d8d8){if(_0x23d8d8[_0x594a('0x37')]){_0x2e5b9a=_0x23d8d8[_0x594a('0x37')];}else{for(var _0x3ac145 in _0x23d8d8){if(_0x23d8d8['hasOwnProperty'](_0x3ac145)){_0x2e5b9a+=_['upperFirst'](_0x3ac145)+':\x20'+_0x23d8d8[_0x3ac145]+'\x0a';}}}}if(_0x2006fe){this[_0x594a('0x2')]['end']();}else{this['emit'](_0x594a('0x10'),_0x2e5b9a);this[_0x594a('0x23')]('end');}};module[_0x594a('0x38')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6aa6ae6..494fdda 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 _0x054b=['nodemailer','nodemailer-plugin-inline-base64','send','createTransport','compile','sendMail','prototype','verify','toString','Not\x20verifired','exports'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x054b,0x9a));var _0xb054=function(_0x2340a9,_0x28b675){_0x2340a9=_0x2340a9-0x0;var _0x25914e=_0x054b[_0x2340a9];return _0x25914e;};'use strict';var nodemailer=require(_0xb054('0x0'));var inlineBase64=require(_0xb054('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xb054('0x2')]=function(_0x512973,_0x31cd18){return new Promise(function(_0x22b9bb,_0x2715f3){var _0x2e2c28=nodemailer[_0xb054('0x3')](_0x512973);_0x2e2c28['use'](_0xb054('0x4'),inlineBase64());_0x2e2c28[_0xb054('0x5')](_0x31cd18,function(_0x47554c,_0x47b5b7){if(_0x47554c){_0x2715f3(_0x47554c['toString']());}else{_0x22b9bb(_0x47b5b7);}});});};EmailSmtp[_0xb054('0x6')][_0xb054('0x7')]=function(_0x45d400){return new Promise(function(_0xbfbb01,_0xeb2af3){var _0x3504bb=nodemailer[_0xb054('0x3')](_0x45d400);_0x3504bb['verify'](function(_0x17b153,_0x538426){if(_0x17b153){_0xeb2af3(_0x17b153[_0xb054('0x8')]());}else{if(_0x538426){_0xbfbb01(_0x538426);}else{_0xeb2af3(_0xb054('0x9'));}}});});};module[_0xb054('0xa')]=EmailSmtp; \ No newline at end of file +var _0xce51=['nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','sendMail','toString','verify','Not\x20verifired'];(function(_0x3f2d3a,_0x1f611c){var _0x38ebdf=function(_0x441c86){while(--_0x441c86){_0x3f2d3a['push'](_0x3f2d3a['shift']());}};_0x38ebdf(++_0x1f611c);}(_0xce51,0x140));var _0x1ce5=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xce51[_0x4551f6];return _0x581dc2;};'use strict';var nodemailer=require(_0x1ce5('0x0'));var inlineBase64=require(_0x1ce5('0x1'));function EmailSmtp(){}EmailSmtp[_0x1ce5('0x2')][_0x1ce5('0x3')]=function(_0x116ea7,_0x1a732f){return new Promise(function(_0x19b43f,_0x29b6af){var _0xaa9fbb=nodemailer[_0x1ce5('0x4')](_0x116ea7);_0xaa9fbb[_0x1ce5('0x5')]('compile',inlineBase64());_0xaa9fbb[_0x1ce5('0x6')](_0x1a732f,function(_0x3d634e,_0x4fcc55){if(_0x3d634e){_0x29b6af(_0x3d634e[_0x1ce5('0x7')]());}else{_0x19b43f(_0x4fcc55);}});});};EmailSmtp[_0x1ce5('0x2')][_0x1ce5('0x8')]=function(_0x14059b){return new Promise(function(_0x5efb44,_0x1b6ef4){var _0x1fa1cf=nodemailer[_0x1ce5('0x4')](_0x14059b);_0x1fa1cf[_0x1ce5('0x8')](function(_0x17847c,_0x2b6d20){if(_0x17847c){_0x1b6ef4(_0x17847c[_0x1ce5('0x7')]());}else{if(_0x2b6d20){_0x5efb44(_0x2b6d20);}else{_0x1b6ef4(_0x1ce5('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index fb4f779..b35872c 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 _0xb800=['from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','../../../config/environment','address','anonymous','@xcally.com','head','value','name','substring','indexOf','split','length','join','pop','isEmpty','generate','test','html','\x20[Attachment:\x20','\x20]','body','0x1?_0xf30df['slice'](0x0,-0x1)[_0x0b80('0x12')]('\x20'):_0x3817ee[_0x0b80('0xd')];}return'Anonymous';}function getLastName(_0xf44715){var _0x1021cd=_[_0x0b80('0xb')](_0xf44715['value']);if(_0x1021cd&&_0x1021cd[_0x0b80('0xd')]){var _0x2c860f=_0x1021cd[_0x0b80('0xd')][_0x0b80('0x10')](/\s+/);return _0x2c860f['length']>0x1?_0x2c860f[_0x0b80('0x13')]():'';}return'';}function getMails(_0x2ebf54,_0x1e881a){var _0x11ec8f='';for(var _0xeb3d43=0x0;_0xeb3d43<_0x1e881a[_0x0b80('0xc')][_0x0b80('0x11')];_0xeb3d43+=0x1){if(_0x1e881a['value'][_0xeb3d43][_0x0b80('0x8')]!==_0x2ebf54){if(!_[_0x0b80('0x14')](_0x11ec8f)){_0x11ec8f+=',';}_0x11ec8f+=_0x1e881a[_0x0b80('0xc')][_0xeb3d43]['name']||_0x1e881a[_0x0b80('0xc')][_0xeb3d43][_0x0b80('0x8')]||'';_0x11ec8f+='\x20<';_0x11ec8f+=_0x1e881a[_0x0b80('0xc')][_0xeb3d43][_0x0b80('0x8')]?_0x1e881a[_0x0b80('0xc')][_0xeb3d43][_0x0b80('0x8')]:_0x0b80('0x9')+random[_0x0b80('0x15')](0x6)+_0x0b80('0xa');_0x11ec8f+='>';}}return _0x11ec8f;}function parseEmail(_0x15c4fc,_0x536a38,_0x127c49){if(_0x536a38['html']){var _0x5624d8=/)<[^<]*)*<\/script>/gi;while(_0x5624d8[_0x0b80('0x16')](_0x536a38['html'])){_0x536a38[_0x0b80('0x17')]=_0x536a38[_0x0b80('0x17')]['replace'](_0x5624d8,'');}if(_0x536a38[_0x0b80('0x17')]['includes'](_0x0b80('0x18'))){var _0x4dbf76=[];_0x536a38[_0x0b80('0x19')][_0x0b80('0x1a')](_0x1c0436=>{_0x4dbf76[_0x0b80('0x1b')](_0x1c0436[_0x0b80('0x1c')]);});var _0x1c242d=/]+>/g;var _0x3c09f7=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x440fbb=_0x536a38['html'][_0x0b80('0x1d')](_0x3c09f7,'_SRC');var _0x520b42=_0x440fbb['replace'](_0x1c242d,_0x0b80('0x1e'));for(let _0xeddfc8=0x0;_0xeddfc8<_0x4dbf76[_0x0b80('0x11')];_0xeddfc8++){var _0x4013d2=_0x520b42[_0x0b80('0x1d')](_0x0b80('0x1e'),_0x0b80('0x1f')+_0x4dbf76[_0xeddfc8]+_0x0b80('0x20'));_0x520b42=_0x4013d2;}_0x536a38[_0x0b80('0x17')]=_0x520b42;}_0x127c49['body']=_0x536a38[_0x0b80('0x17')];}else{_0x127c49[_0x0b80('0x21')]=_0x536a38['textAsHtml'];}if(_0x127c49[_0x0b80('0x21')]){_0x127c49[_0x0b80('0x21')]=_0x127c49[_0x0b80('0x21')][_0x0b80('0x1d')](/0x0){var _0x3d3f7a=['Auto-Submitted:\x20auto-replied',_0x0b80('0x30'),'Precedence:\x20auto_reply'];for(var _0x42b79b=0x0;_0x42b79b<_0x536a38[_0x0b80('0x2f')][_0x0b80('0x11')];_0x42b79b++){var _0x51935a=_[_0x0b80('0xf')](_0x3d3f7a,_0x536a38['headerLines'][_0x42b79b][_0x0b80('0x31')]);if(_0x51935a>=0x0){_0x127c49[_0x0b80('0x32')]=!![];}}}return _0x127c49;}exports[_0x0b80('0x33')]=function(_0x4674a8,_0x2622dd,_0x304c78){var _0x56e62d={'from':getAddress(_0x2622dd[_0x0b80('0x34')]),'firstName':getFirstName(_0x2622dd[_0x0b80('0x34')]),'lastName':getLastName(_0x2622dd[_0x0b80('0x34')]),'mapKey':'email','message':{'from':getMails(_0x4674a8['email'],_0x2622dd['from']),'to':_0x4674a8[_0x0b80('0x23')],'cc':'','subject':_0x2622dd[_0x0b80('0x35')]||'','messageId':_0x2622dd[_0x0b80('0x36')],'inReplyTo':_0x2622dd['inReplyTo'],'sentAt':moment(_0x2622dd[_0x0b80('0x37')])[_0x0b80('0x2a')](_0x0b80('0x38')),'attach':![],'attachments':[]}};if(!_0x2622dd[_0x0b80('0x17')]&&!_0x2622dd[_0x0b80('0x39')]){var _0x2d2749=_[_0x0b80('0x3a')](_0x2622dd['attachments'],{'contentType':_0x0b80('0x3b')});if(_0x2d2749[_0x0b80('0x11')]){logger[_0x0b80('0x3c')](util[_0x0b80('0x2a')](_0x0b80('0x3d'),_0x2622dd[_0x0b80('0x36')]));tnef['parseBuffer'](_['first'](_0x2d2749)[_0x0b80('0x2e')],function(_0x4389f3,_0xacd03a){if(_0xacd03a){_0x2622dd['html']=_0xacd03a[_0x0b80('0x3e')]||_0x0b80('0x3f');if(_0xacd03a[_0x0b80('0x40')]){for(var _0x1e9c54=0x0;_0x1e9c54<_0xacd03a[_0x0b80('0x40')]['length'];_0x1e9c54++){var _0x51e434=_0xacd03a[_0x0b80('0x40')][_0x1e9c54];_0x56e62d[_0x0b80('0x24')]['attachments'][_0x0b80('0x1b')]({'filename':_0x51e434[_0x0b80('0x41')],'content':Buffer[_0x0b80('0x34')](_0x51e434[_0x0b80('0x42')])});}}}_0x304c78(parseEmail(_0x4674a8,_0x2622dd,_0x56e62d));});}else{_0x2622dd['html']=_0x0b80('0x3f');_0x304c78(parseEmail(_0x4674a8,_0x2622dd,_0x56e62d));}}else{_0x304c78(parseEmail(_0x4674a8,_0x2622dd,_0x56e62d));}};exports[_0x0b80('0x43')]=function(_0x193d8f,_0xb77073){var _0x3f77f0=[_0x0b80('0x44')+(_0xb77073||''),_0x0b80('0x45')+_0x193d8f,'',''];return Buffer[_0x0b80('0x34')](_0x3f77f0[_0x0b80('0x12')](''),_0x0b80('0x46'))[_0x0b80('0x47')](_0x0b80('0x48'));}; \ No newline at end of file +var _0x4f24=['replace','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','generateXOAuth2Token','user=','utf-8','toString','base64','randomstring','path','util','email','address','anonymous','generate','@xcally.com','head','value','name','split','length','slice','join','Anonymous','pop','isEmpty','html','0x1?_0x216222[_0x44f2('0xd')](0x0,-0x1)[_0x44f2('0xe')]('\x20'):_0x47b887[_0x44f2('0xa')];}return _0x44f2('0xf');}function getLastName(_0xf03a86){var _0x59c7d0=_[_0x44f2('0x8')](_0xf03a86[_0x44f2('0x9')]);if(_0x59c7d0&&_0x59c7d0[_0x44f2('0xa')]){var _0x44ea1d=_0x59c7d0[_0x44f2('0xa')][_0x44f2('0xb')](/\s+/);return _0x44ea1d[_0x44f2('0xc')]>0x1?_0x44ea1d[_0x44f2('0x10')]():'';}return'';}function getMails(_0x406721,_0x406822){var _0x7f0230='';for(var _0x4daf66=0x0;_0x4daf66<_0x406822[_0x44f2('0x9')]['length'];_0x4daf66+=0x1){if(_0x406822[_0x44f2('0x9')][_0x4daf66][_0x44f2('0x4')]!==_0x406721){if(!_[_0x44f2('0x11')](_0x7f0230)){_0x7f0230+=',';}_0x7f0230+=_0x406822[_0x44f2('0x9')][_0x4daf66][_0x44f2('0xa')]||_0x406822[_0x44f2('0x9')][_0x4daf66][_0x44f2('0x4')]||'';_0x7f0230+='\x20<';_0x7f0230+=_0x406822[_0x44f2('0x9')][_0x4daf66][_0x44f2('0x4')]?_0x406822['value'][_0x4daf66][_0x44f2('0x4')]:'anonymous'+random['generate'](0x6)+_0x44f2('0x7');_0x7f0230+='>';}}return _0x7f0230;}function parseEmail(_0x50a010,_0x4064f8,_0x145bac){if(_0x4064f8[_0x44f2('0x12')]){var _0x349853=/)<[^<]*)*<\/script>/gi;while(_0x349853['test'](_0x4064f8[_0x44f2('0x12')])){_0x4064f8[_0x44f2('0x12')]=_0x4064f8[_0x44f2('0x12')]['replace'](_0x349853,'');}if(_0x4064f8[_0x44f2('0x12')]['includes'](_0x44f2('0x13'))){var _0xfadb14=[];_0x4064f8['attachments'][_0x44f2('0x14')](_0x106b68=>{_0xfadb14[_0x44f2('0x15')](_0x106b68[_0x44f2('0x16')]);});var _0x5bd310=/]+>/g;var _0x5578ec=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x8ae08a=_0x4064f8[_0x44f2('0x12')][_0x44f2('0x17')](_0x5578ec,_0x44f2('0x18'));var _0x264cae=_0x8ae08a[_0x44f2('0x17')](_0x5bd310,'_IMG');for(let _0x48b5de=0x0;_0x48b5de<_0xfadb14['length'];_0x48b5de++){var _0x133e53=_0x264cae[_0x44f2('0x17')](_0x44f2('0x19'),_0x44f2('0x1a')+_0xfadb14[_0x48b5de]+_0x44f2('0x1b'));_0x264cae=_0x133e53;}_0x4064f8[_0x44f2('0x12')]=_0x264cae;}_0x145bac['body']=_0x4064f8[_0x44f2('0x12')];}else{_0x145bac['body']=_0x4064f8['textAsHtml'];}if(_0x145bac[_0x44f2('0x1c')]){_0x145bac[_0x44f2('0x1c')]=_0x145bac[_0x44f2('0x1c')][_0x44f2('0x17')](/0x0){var _0x2cfbe3=[_0x44f2('0x2d'),_0x44f2('0x2e'),_0x44f2('0x2f')];for(var _0x4e3e64=0x0;_0x4e3e64<_0x4064f8[_0x44f2('0x2c')][_0x44f2('0xc')];_0x4e3e64++){var _0x4d86db=_[_0x44f2('0x30')](_0x2cfbe3,_0x4064f8[_0x44f2('0x2c')][_0x4e3e64][_0x44f2('0x31')]);if(_0x4d86db>=0x0){_0x145bac[_0x44f2('0x32')]=!![];}}}return _0x145bac;}exports[_0x44f2('0x33')]=function(_0x416f1f,_0x28897c,_0x172403){var _0x3a9c06={'from':getAddress(_0x28897c[_0x44f2('0x34')]),'firstName':getFirstName(_0x28897c['from']),'lastName':getLastName(_0x28897c[_0x44f2('0x34')]),'mapKey':'email','message':{'from':getMails(_0x416f1f['email'],_0x28897c[_0x44f2('0x34')]),'to':_0x416f1f[_0x44f2('0x3')],'cc':'','subject':_0x28897c[_0x44f2('0x35')]||'','messageId':_0x28897c[_0x44f2('0x36')],'inReplyTo':_0x28897c['inReplyTo'],'sentAt':moment(_0x28897c[_0x44f2('0x37')])[_0x44f2('0x27')](_0x44f2('0x38')),'attach':![],'attachments':[]}};if(!_0x28897c[_0x44f2('0x12')]&&!_0x28897c[_0x44f2('0x39')]){var _0x15680a=_[_0x44f2('0x3a')](_0x28897c[_0x44f2('0x23')],{'contentType':_0x44f2('0x3b')});if(_0x15680a[_0x44f2('0xc')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x28897c['messageId']));tnef[_0x44f2('0x3c')](_['first'](_0x15680a)['content'],function(_0xb8272c,_0x49807b){if(_0x49807b){_0x28897c[_0x44f2('0x12')]=_0x49807b[_0x44f2('0x3d')]||'

Empty\x20message

';if(_0x49807b[_0x44f2('0x3e')]){for(var _0x4b397b=0x0;_0x4b397b<_0x49807b[_0x44f2('0x3e')]['length'];_0x4b397b++){var _0x357edb=_0x49807b[_0x44f2('0x3e')][_0x4b397b];_0x3a9c06[_0x44f2('0x1e')]['attachments'][_0x44f2('0x15')]({'filename':_0x357edb[_0x44f2('0x3f')],'content':Buffer[_0x44f2('0x34')](_0x357edb['Data'])});}}}_0x172403(parseEmail(_0x416f1f,_0x28897c,_0x3a9c06));});}else{_0x28897c[_0x44f2('0x12')]=_0x44f2('0x40');_0x172403(parseEmail(_0x416f1f,_0x28897c,_0x3a9c06));}}else{_0x172403(parseEmail(_0x416f1f,_0x28897c,_0x3a9c06));}};exports[_0x44f2('0x41')]=function(_0x10a9d4,_0x2d1550){var _0x4314fe=[_0x44f2('0x42')+(_0x2d1550||''),'auth=Bearer\x20'+_0x10a9d4,'',''];return Buffer[_0x44f2('0x34')](_0x4314fe['join'](''),_0x44f2('0x43'))[_0x44f2('0x44')](_0x44f2('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 04584e0..c709909 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 _0x7a96=['key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a96,0x1db));var _0x67a9=function(_0x4bcfcd,_0x5cf858){_0x4bcfcd=_0x4bcfcd-0x0;var _0x5e3bd8=_0x7a96[_0x4bcfcd];return _0x5e3bd8;};'use strict';var _=require(_0x67a9('0x0'));function MailAccount(_0x5da467){this['id']=_0x5da467['id']||0x0;this['name']=_0x5da467['name']||'Service';this[_0x67a9('0x1')]=_0x5da467[_0x67a9('0x1')]||_0x67a9('0x2');this[_0x67a9('0x3')]=_0x5da467[_0x67a9('0x3')]||![];this[_0x67a9('0x4')]=_0x5da467[_0x67a9('0x4')]||[];this[_0x67a9('0x5')]=_0x5da467[_0x67a9('0x5')]||[];}module[_0x67a9('0x6')]=MailAccount; \ No newline at end of file +var _0x3e72=['active','Imap','Smtp','exports','lodash','key','SERV'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0x3e72,0x82));var _0x23e7=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0x3e72[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0x23e7('0x0'));function MailAccount(_0x3b2f93){this['id']=_0x3b2f93['id']||0x0;this['name']=_0x3b2f93['name']||'Service';this[_0x23e7('0x1')]=_0x3b2f93['key']||_0x23e7('0x2');this[_0x23e7('0x3')]=_0x3b2f93[_0x23e7('0x3')]||![];this[_0x23e7('0x4')]=_0x3b2f93[_0x23e7('0x4')]||[];this[_0x23e7('0x5')]=_0x3b2f93['Smtp']||[];}module[_0x23e7('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7ebb102..67522d1 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 _0x3c04=['lodash','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','mailAccounts','length','merge'];(function(_0x11c5ef,_0x1e2cb7){var _0x3a334c=function(_0x2b51fb){while(--_0x2b51fb){_0x11c5ef['push'](_0x11c5ef['shift']());}};_0x3a334c(++_0x1e2cb7);}(_0x3c04,0xc0));var _0x43c0=function(_0x1ff58b,_0x107fe0){_0x1ff58b=_0x1ff58b-0x0;var _0x45f80e=_0x3c04[_0x1ff58b];return _0x45f80e;};'use strict';var _=require(_0x43c0('0x0'));var MailAccount=require(_0x43c0('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1cd988,_0x736499,_0x53c76c){var _0x288d8a=_['mapKeys'](_0x1cd988,function(_0x2387fb,_0x185dfc){return _0x2387fb[_0x53c76c];});for(var _0x10b615 in _0x736499){if(_0x736499[_0x43c0('0x2')](_0x10b615)){if(!_0x288d8a[_0x10b615]){delete _0x736499[_0x10b615];}}}}Realtime[_0x43c0('0x3')][_0x43c0('0x4')]=function(_0x114deb,_0x2a811c){for(var _0x20bc86 in _0x2a811c){if(_0x114deb[_0x43c0('0x2')](_0x20bc86)){_0x114deb[_0x20bc86]=_0x2a811c[_0x20bc86];}}};Realtime[_0x43c0('0x3')]['initMailAccounts']=function(){var _0x49ad20=this;return function(_0x3c1ad0){if(_0x3c1ad0){freeIsNotKey(_0x3c1ad0,_0x49ad20[_0x43c0('0x5')],'id');for(var _0x5ee6c5=0x0,_0x3bb712={},_0x4c3c0f={};_0x5ee6c5<_0x3c1ad0[_0x43c0('0x6')];_0x5ee6c5+=0x1){_0x3bb712=_0x3c1ad0[_0x5ee6c5];if(_['isUndefined'](_0x49ad20['mailAccounts'][_0x3bb712['id']])){_0x49ad20[_0x43c0('0x5')][_0x3bb712['id']]=new MailAccount(_0x3bb712);}else{_[_0x43c0('0x7')](_0x49ad20[_0x43c0('0x5')][_0x3bb712['id']],_0x3bb712);}}}return _0x49ad20['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x1436=['mailAccounts','mapKeys','prototype','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1436,0x1e2));var _0x6143=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1436[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x6143('0x0'));var MailAccount=require(_0x6143('0x1'));var Realtime=function(){this[_0x6143('0x2')]={};};function freeIsNotKey(_0x4a74ff,_0x42fb2c,_0x8f1a10){var _0x219427=_[_0x6143('0x3')](_0x4a74ff,function(_0x72bdb3,_0x3c2d01){return _0x72bdb3[_0x8f1a10];});for(var _0x3910a6 in _0x42fb2c){if(_0x42fb2c['hasOwnProperty'](_0x3910a6)){if(!_0x219427[_0x3910a6]){delete _0x42fb2c[_0x3910a6];}}}}Realtime[_0x6143('0x4')]['mergeFromDatabase']=function(_0x4dbd85,_0x694dd5){for(var _0x807d5 in _0x694dd5){if(_0x4dbd85[_0x6143('0x5')](_0x807d5)){_0x4dbd85[_0x807d5]=_0x694dd5[_0x807d5];}}};Realtime[_0x6143('0x4')][_0x6143('0x6')]=function(){var _0x343ea1=this;return function(_0x1b3fff){if(_0x1b3fff){freeIsNotKey(_0x1b3fff,_0x343ea1['mailAccounts'],'id');for(var _0x29f68a=0x0,_0x4228d3={},_0xfc9357={};_0x29f68a<_0x1b3fff[_0x6143('0x7')];_0x29f68a+=0x1){_0x4228d3=_0x1b3fff[_0x29f68a];if(_[_0x6143('0x8')](_0x343ea1['mailAccounts'][_0x4228d3['id']])){_0x343ea1[_0x6143('0x2')][_0x4228d3['id']]=new MailAccount(_0x4228d3);}else{_[_0x6143('0x9')](_0x343ea1[_0x6143('0x2')][_0x4228d3['id']],_0x4228d3);}}}return _0x343ea1[_0x6143('0x2')];};};module[_0x6143('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 739a035..bc31ecc 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 _0x251b=['email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request','GetMailAccount','name','provider','service'];(function(_0x5122ae,_0x5b6e50){var _0x6c30bd=function(_0x1034a8){while(--_0x1034a8){_0x5122ae['push'](_0x5122ae['shift']());}};_0x6c30bd(++_0x5b6e50);}(_0x251b,0xcc));var _0xb251=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x251b[_0x1a0600];return _0x734670;};'use strict';var client=require(_0xb251('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xb251('0x1')](_0xb251('0x2'),{'options':{'attributes':['id',_0xb251('0x3'),_0xb251('0x4'),_0xb251('0x5'),_0xb251('0x6'),_0xb251('0x7'),_0xb251('0x8'),_0xb251('0x9'),_0xb251('0xa')],'raw':![],'include':[{'model':_0xb251('0xb'),'as':_0xb251('0xc'),'include':[{'model':_0xb251('0xd'),'attributes':['id',_0xb251('0x3'),_0xb251('0x5'),_0xb251('0xe'),_0xb251('0xf')],'as':_0xb251('0xd')}]},{'model':_0xb251('0x10'),'as':_0xb251('0x11'),'include':[{'model':_0xb251('0xd'),'attributes':['id','name','service',_0xb251('0xe'),_0xb251('0xf')],'as':_0xb251('0xd')}]}]},'log':_0xb251('0x12')});};};exports[_0xb251('0x13')]=function(_0x44a02f,_0x3fa6a9){return client[_0xb251('0x1')](_0xb251('0x14'),{'account':{'id':_0x44a02f},'body':_0x3fa6a9,'log':_0xb251('0x14')});}; \ No newline at end of file +var _0x75b6=['Smtp','service','data5','getMailAccount','Request','NotifyMailAccount','../client','GetMailAccount','name','provider','email','active','key','TemplateId','Imap','CloudProvider','type','MailServerOut'];(function(_0x386031,_0x387404){var _0x15b451=function(_0x4fb808){while(--_0x4fb808){_0x386031['push'](_0x386031['shift']());}};_0x15b451(++_0x387404);}(_0x75b6,0x1a4));var _0x675b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x75b6[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x675b('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0x675b('0x1'),{'options':{'attributes':['id',_0x675b('0x2'),_0x675b('0x3'),'service',_0x675b('0x4'),_0x675b('0x5'),_0x675b('0x6'),'ListId',_0x675b('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':_0x675b('0x8'),'include':[{'model':_0x675b('0x9'),'attributes':['id',_0x675b('0x2'),'service',_0x675b('0xa'),'data5'],'as':_0x675b('0x9')}]},{'model':_0x675b('0xb'),'as':_0x675b('0xc'),'include':[{'model':_0x675b('0x9'),'attributes':['id',_0x675b('0x2'),_0x675b('0xd'),_0x675b('0xa'),_0x675b('0xe')],'as':_0x675b('0x9')}]}]},'log':_0x675b('0xf')});};};exports['notify']=function(_0x3ce0a2,_0x13e14b){return client[_0x675b('0x10')](_0x675b('0x11'),{'account':{'id':_0x3ce0a2},'body':_0x13e14b,'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 5c0104d..66b5341 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 _0x9e0f=['../client','getSettings','Request','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9e0f,0x1ec));var _0xf9e0=function(_0x178a5b,_0x4efddd){_0x178a5b=_0x178a5b-0x0;var _0x5483e1=_0x9e0f[_0x178a5b];return _0x5483e1;};'use strict';var client=require(_0xf9e0('0x0'));exports[_0xf9e0('0x1')]=function(){return client[_0xf9e0('0x2')](_0xf9e0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf9e0('0x4')]},'log':_0xf9e0('0x5')});}; \ No newline at end of file +var _0xaf1b=['ShowSetting','loginMailFrequency','GetSettings','../client','getSettings','Request'];(function(_0x4cd14a,_0x3c08b4){var _0x59ac6a=function(_0x5d95ec){while(--_0x5d95ec){_0x4cd14a['push'](_0x4cd14a['shift']());}};_0x59ac6a(++_0x3c08b4);}(_0xaf1b,0x1b3));var _0xbaf1=function(_0x1038ea,_0x1409d3){_0x1038ea=_0x1038ea-0x0;var _0x4b7456=_0xaf1b[_0x1038ea];return _0x4b7456;};'use strict';var client=require(_0xbaf1('0x0'));exports[_0xbaf1('0x1')]=function(){return client[_0xbaf1('0x2')](_0xbaf1('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbaf1('0x4')]},'log':_0xbaf1('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f2a56bd..7209296 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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 f45bce7..f691481 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 _0x48ba=['socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','http','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','redis','localhost','adapter'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x48ba,0x182));var _0xa48b=function(_0xaf2a24,_0x500cfc){_0xaf2a24=_0xaf2a24-0x0;var _0x48ab6a=_0x48ba[_0xaf2a24];return _0x48ab6a;};'use strict';var _=require('lodash');var http=require(_0xa48b('0x0'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xa48b('0x1'));var app=express();var server=http[_0xa48b('0x2')](app);server[_0xa48b('0x3')]=0xdbba0;if(sticky[_0xa48b('0x4')](server,config[_0xa48b('0x5')])){var socketio=require(_0xa48b('0x6'))(server,{'transports':[_0xa48b('0x7'),_0xa48b('0x8')]});config['redis']=_[_0xa48b('0x9')](config[_0xa48b('0xa')],{'host':_0xa48b('0xb'),'port':0x18eb});socketio[_0xa48b('0xc')](require(_0xa48b('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xa48b('0xa')])}));require(_0xa48b('0xe'))[_0xa48b('0xf')]();require('../../config/socketio')[_0xa48b('0xf')](socketio);require(_0xa48b('0x10'))['default'](app);require(_0xa48b('0x11'))[_0xa48b('0xf')](app);}else{server[_0xa48b('0x12')]('listening',function(){console[_0xa48b('0x13')](_0xa48b('0x14'),config[_0xa48b('0x5')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x5ddb=['socket.io','websocket','polling','redis','socket.io-redis','../../config/socketio','../../config/express','default','once','listening','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x5ddb,0x1af));var _0xb5dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5ddb[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb5dd('0x0'));var http=require('http');var express=require(_0xb5dd('0x1'));var sticky=require(_0xb5dd('0x2'));var Redis=require(_0xb5dd('0x3'));var config=require(_0xb5dd('0x4'));var app=express();var server=http[_0xb5dd('0x5')](app);server[_0xb5dd('0x6')]=0xdbba0;if(sticky[_0xb5dd('0x7')](server,config[_0xb5dd('0x8')])){var socketio=require(_0xb5dd('0x9'))(server,{'transports':[_0xb5dd('0xa'),_0xb5dd('0xb')]});config[_0xb5dd('0xc')]=_['defaults'](config[_0xb5dd('0xc')],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0xb5dd('0xd'))({'pubClient':new Redis(config[_0xb5dd('0xc')]),'subClient':new Redis(config[_0xb5dd('0xc')])}));require('../../config/triggers')['default']();require(_0xb5dd('0xe'))['default'](socketio);require(_0xb5dd('0xf'))['default'](app);require('../../routes')[_0xb5dd('0x10')](app);}else{server[_0xb5dd('0x11')](_0xb5dd('0x12'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config['port']);});}exports=module[_0xb5dd('0x13')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 1d1e852..cfe7a1b 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 _0xc9b6=['exports','bluebird','../../config/logger','routing','client','request','then','debug','rpc','error','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9b6,0xcd));var _0x6c9b=function(_0x1c16ee,_0xefb5ba){_0x1c16ee=_0x1c16ee-0x0;var _0x1a8f88=_0xc9b6[_0x1c16ee];return _0x1a8f88;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6c9b('0x0'));var logger=require(_0x6c9b('0x1'))(_0x6c9b('0x2'));var client=jayson[_0x6c9b('0x3')]['http']({'port':0x2329});client['Request']=function(_0x33cb54,_0x24aa12){return new BPromise(function(_0x380add,_0x9dbf5){return client[_0x6c9b('0x4')](_0x33cb54,_0x24aa12)[_0x6c9b('0x5')](function(_0x4a89d1){logger[_0x6c9b('0x6')](_0x6c9b('0x7'),_0x6c9b('0x2'),_0x33cb54,_0x24aa12,_0x4a89d1);if(_0x4a89d1[_0x6c9b('0x8')]){logger[_0x6c9b('0x8')](_0x6c9b('0x7'),_0x6c9b('0x2'),_0x33cb54,_0x4a89d1['error'][_0x6c9b('0x9')],_0x24aa12);return _0x9dbf5(_0x4a89d1['error'][_0x6c9b('0x9')]);}else{return _0x380add(_0x4a89d1[_0x6c9b('0xa')]);}})['catch'](function(_0x3e748a){logger['error'](_0x6c9b('0x7'),'routing',_0x33cb54,_0x3e748a,_0x24aa12);return _0x9dbf5(_0x3e748a);});});};module[_0x6c9b('0xb')]=client; \ No newline at end of file +var _0x61c9=['routing','client','http','Request','request','then','debug','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger'];(function(_0xea1bcd,_0x465e08){var _0xfbe4c6=function(_0x4e20f1){while(--_0x4e20f1){_0xea1bcd['push'](_0xea1bcd['shift']());}};_0xfbe4c6(++_0x465e08);}(_0x61c9,0x177));var _0x961c=function(_0x3543e7,_0x501fcf){_0x3543e7=_0x3543e7-0x0;var _0x42df23=_0x61c9[_0x3543e7];return _0x42df23;};'use strict';var jayson=require(_0x961c('0x0'));var BPromise=require(_0x961c('0x1'));var logger=require(_0x961c('0x2'))(_0x961c('0x3'));var client=jayson[_0x961c('0x4')][_0x961c('0x5')]({'port':0x2329});client[_0x961c('0x6')]=function(_0x22717b,_0x454cef){return new BPromise(function(_0x98ad24,_0x4b20be){return client[_0x961c('0x7')](_0x22717b,_0x454cef)[_0x961c('0x8')](function(_0x29cb75){logger[_0x961c('0x9')](_0x961c('0xa'),_0x961c('0x3'),_0x22717b,_0x454cef,_0x29cb75);if(_0x29cb75[_0x961c('0xb')]){logger[_0x961c('0xb')](_0x961c('0xa'),_0x961c('0x3'),_0x22717b,_0x29cb75[_0x961c('0xb')][_0x961c('0xc')],_0x454cef);return _0x4b20be(_0x29cb75['error'][_0x961c('0xc')]);}else{return _0x98ad24(_0x29cb75['result']);}})[_0x961c('0xd')](function(_0x4928ff){logger[_0x961c('0xb')](_0x961c('0xa'),_0x961c('0x3'),_0x22717b,_0x4928ff,_0x454cef);return _0x4b20be(_0x4928ff);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 1d308b1..91ac234 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 _0xca2b=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0xf400a9,_0x37dcb9){var _0x7fdc84=function(_0x469c13){while(--_0x469c13){_0xf400a9['push'](_0xf400a9['shift']());}};_0x7fdc84(++_0x37dcb9);}(_0xca2b,0x7f));var _0xbca2=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xca2b[_0x138adb];return _0x1b27f2;};'use strict';var BPromise=require(_0xbca2('0x0'));var server=require(_0xbca2('0x1'));var Realtime=require(_0xbca2('0x2'));var user=require(_0xbca2('0x3'));var interval=require(_0xbca2('0x4'));var openchannelQueue=require(_0xbca2('0x5'));var chatQueue=require(_0xbca2('0x6'));var smsQueue=require(_0xbca2('0x7'));var mailQueue=require(_0xbca2('0x8'));var faxQueue=require(_0xbca2('0x9'));var whatsappQueue=require(_0xbca2('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbca2('0xb')]()[_0xbca2('0xc')](user[_0xbca2('0xd')]())[_0xbca2('0xc')](realtime[_0xbca2('0xe')]())['then'](interval[_0xbca2('0xf')]())[_0xbca2('0xc')](realtime['initIntervals']())[_0xbca2('0xc')](openchannelQueue['getOpenchannelQueues']())[_0xbca2('0xc')](realtime[_0xbca2('0x10')]())[_0xbca2('0xc')](chatQueue[_0xbca2('0x11')]())['then'](realtime[_0xbca2('0x12')]())[_0xbca2('0xc')](smsQueue[_0xbca2('0x13')]())[_0xbca2('0xc')](realtime[_0xbca2('0x14')]())['then'](mailQueue[_0xbca2('0x15')]())[_0xbca2('0xc')](realtime[_0xbca2('0x16')]())[_0xbca2('0xc')](faxQueue[_0xbca2('0x17')]())[_0xbca2('0xc')](realtime['initFaxQueues']())['then'](whatsappQueue[_0xbca2('0x18')]())[_0xbca2('0xc')](realtime['initWhatsappQueues']())[_0xbca2('0xc')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xbca2('0xc')](function(_0x948aed){return initRealtime();})['then'](function(_0x161cd0){return setInterval(initRealtime,0x1388);})[_0xbca2('0x19')](function(_0x26d1b0){console[_0xbca2('0x1a')](_0x26d1b0);});}main(); \ No newline at end of file +var _0xcfe8=['./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval'];(function(_0x135ea8,_0x402fba){var _0x11ced5=function(_0x450c86){while(--_0x450c86){_0x135ea8['push'](_0x135ea8['shift']());}};_0x11ced5(++_0x402fba);}(_0xcfe8,0x1f0));var _0x8cfe=function(_0xe3b599,_0x2cdc1b){_0xe3b599=_0xe3b599-0x0;var _0x447be3=_0xcfe8[_0xe3b599];return _0x447be3;};'use strict';var BPromise=require(_0x8cfe('0x0'));var server=require(_0x8cfe('0x1'));var Realtime=require('./realtime');var user=require(_0x8cfe('0x2'));var interval=require(_0x8cfe('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x8cfe('0x4'));var smsQueue=require(_0x8cfe('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x8cfe('0x6'));var whatsappQueue=require(_0x8cfe('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x8cfe('0x8')](user[_0x8cfe('0x9')]())[_0x8cfe('0x8')](realtime['initAgents']())[_0x8cfe('0x8')](interval[_0x8cfe('0xa')]())[_0x8cfe('0x8')](realtime[_0x8cfe('0xb')]())['then'](openchannelQueue[_0x8cfe('0xc')]())[_0x8cfe('0x8')](realtime[_0x8cfe('0xd')]())['then'](chatQueue[_0x8cfe('0xe')]())[_0x8cfe('0x8')](realtime[_0x8cfe('0xf')]())[_0x8cfe('0x8')](smsQueue[_0x8cfe('0x10')]())[_0x8cfe('0x8')](realtime[_0x8cfe('0x11')]())[_0x8cfe('0x8')](mailQueue[_0x8cfe('0x12')]())['then'](realtime['initMailQueues']())[_0x8cfe('0x8')](faxQueue['getFaxQueues']())[_0x8cfe('0x8')](realtime[_0x8cfe('0x13')]())[_0x8cfe('0x8')](whatsappQueue[_0x8cfe('0x14')]())[_0x8cfe('0x8')](realtime[_0x8cfe('0x15')]())[_0x8cfe('0x8')](function(){return realtime;});}function main(){return server[_0x8cfe('0x16')](realtime)[_0x8cfe('0x8')](function(_0x33fed3){return initRealtime();})[_0x8cfe('0x8')](function(_0x4d1a3d){return setInterval(initRealtime,0x1388);})[_0x8cfe('0x17')](function(_0x2a8cab){console[_0x8cfe('0x18')](_0x2a8cab);});}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 1fd9bb1..165686a 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4b3358,_0x5cda77){var _0x1ea011=function(_0x1a17ea){while(--_0x1a17ea){_0x4b3358['push'](_0x4b3358['shift']());}};_0x1ea011(++_0x5cda77);}(_0x326f,0xd1));var _0xf326=function(_0x102499,_0x59aa4e){_0x102499=_0x102499-0x0;var _0x2c6b7a=_0x326f[_0x102499];return _0x2c6b7a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _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(_0x21b74b,_0x543c76){var _0x518cc6=function(_0x5b3010){while(--_0x5b3010){_0x21b74b['push'](_0x21b74b['shift']());}};_0x518cc6(++_0x543c76);}(_0x814b,0x1a2));var _0xb814=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x814b[_0x64aff8];return _0x5488a3;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index a9b31fd..20d7103 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 _0x24b9=['client','then','error','message','result','catch','sendMailMessage','bluebird'];(function(_0x4fcf09,_0x2e315a){var _0x575df5=function(_0x27aa70){while(--_0x27aa70){_0x4fcf09['push'](_0x4fcf09['shift']());}};_0x575df5(++_0x2e315a);}(_0x24b9,0xc7));var _0x924b=function(_0x58162a,_0x44c5a3){_0x58162a=_0x58162a-0x0;var _0x5482b9=_0x24b9[_0x58162a];return _0x5482b9;};'use strict';var BPromise=require(_0x924b('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x924b('0x1')]['http']({'port':0x232b});function request(_0x3c8a5c,_0x385839){return new BPromise(function(_0x47eb91,_0xffa70f){return client['request'](_0x3c8a5c,_0x385839)[_0x924b('0x2')](function(_0x2e30ac){if(_0x2e30ac[_0x924b('0x3')]){return _0xffa70f(_0x2e30ac[_0x924b('0x3')][_0x924b('0x4')]);}else{return _0x47eb91(_0x2e30ac[_0x924b('0x5')]);}})[_0x924b('0x6')](function(_0x3ee7e8){return _0xffa70f(_0x3ee7e8);});});}exports[_0x924b('0x7')]=function(_0x388b35,_0x27b057){return request('SendMail',{'account':_0x388b35,'message':_0x27b057});}; \ No newline at end of file +var _0xb448=['then','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xb448,0xde));var _0x8b44=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xb448[_0x4ae6ef];return _0x3cbb4e;};'use strict';var BPromise=require(_0x8b44('0x0'));var jayson=require(_0x8b44('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x555b43,_0x2a318e){return new BPromise(function(_0x4954be,_0x5a5785){return client['request'](_0x555b43,_0x2a318e)[_0x8b44('0x2')](function(_0x1e7dc9){if(_0x1e7dc9['error']){return _0x5a5785(_0x1e7dc9['error'][_0x8b44('0x3')]);}else{return _0x4954be(_0x1e7dc9['result']);}})[_0x8b44('0x4')](function(_0x4cf30a){return _0x5a5785(_0x4cf30a);});});}exports[_0x8b44('0x5')]=function(_0x61578a,_0x8cef9c){return request(_0x8b44('0x6'),{'account':_0x61578a,'message':_0x8cef9c});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index fcb156d..92d799a 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 _0xda2d=['busyQueue','chatWaitingInteractions','stringify','user:routing:update','omit','exports','md5','moment','ioredis','../../../config/environment','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','updateRealtime','openchannel','fax','sms','length','Status','StatusTime','format','chatCapacity','smsCapacity','whatsappStatus'];(function(_0x43490e,_0x393e4d){var _0x22534f=function(_0x41affa){while(--_0x41affa){_0x43490e['push'](_0x43490e['shift']());}};_0x22534f(++_0x393e4d);}(_0xda2d,0x102));var _0xdda2=function(_0x9567cf,_0xedfed6){_0x9567cf=_0x9567cf-0x0;var _0x442338=_0xda2d[_0x9567cf];return _0x442338;};'use strict';var _=require('lodash');var md5=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var Redis=require(_0xdda2('0x2'));var config=require(_0xdda2('0x3'));config[_0xdda2('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xdda2('0x5'))(new Redis(config[_0xdda2('0x4')]));function Agent(_0x2965a5){this['id']=_0x2965a5['id']||0x0;this[_0xdda2('0x6')]=_0x2965a5[_0xdda2('0x6')]||'';this[_0xdda2('0x7')]=_0x2965a5[_0xdda2('0x7')]||!![];this[_0xdda2('0x8')]=_0x2965a5[_0xdda2('0x8')]||![];this[_0xdda2('0x9')]=_0x2965a5['chatPause']||![];this[_0xdda2('0xa')]=_0x2965a5[_0xdda2('0xa')]||![];this['faxPause']=_0x2965a5[_0xdda2('0xb')]||![];this[_0xdda2('0xc')]=_0x2965a5[_0xdda2('0xc')]||![];this[_0xdda2('0xd')]=_0x2965a5[_0xdda2('0xd')]||![];this[_0xdda2('0xe')]=_0xdda2('0xf');this[_0xdda2('0x10')]=0x0;this['chatCapacity']=_0x2965a5['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xdda2('0x11')]=_0xdda2('0xf');this[_0xdda2('0x12')]=0x0;this[_0xdda2('0x13')]=_0x2965a5[_0xdda2('0x13')]||0x0;this[_0xdda2('0x14')]=0x0;this[_0xdda2('0x15')]='unknown';this[_0xdda2('0x16')]=0x0;this['faxCapacity']=_0x2965a5[_0xdda2('0x17')]||0x0;this[_0xdda2('0x18')]=0x0;this[_0xdda2('0x19')]=_0xdda2('0xf');this[_0xdda2('0x1a')]=0x0;this['smsCapacity']=_0x2965a5['smsCapacity']||0x0;this[_0xdda2('0x1b')]=0x0;this['whatsappStatus']=_0xdda2('0xf');this[_0xdda2('0x1c')]=0x0;this[_0xdda2('0x1d')]=_0x2965a5[_0xdda2('0x1d')]||0x0;this[_0xdda2('0x1e')]=0x0;this[_0xdda2('0x1f')]=_0xdda2('0xf');this[_0xdda2('0x20')]=0x0;this[_0xdda2('0x21')]=_0x2965a5[_0xdda2('0x21')]||0x0;this[_0xdda2('0x22')]=0x0;this[_0xdda2('0x23')]=![];this['busyQueue']=undefined;this[_0xdda2('0x0')]='';this['chatWaitingInteractions']={};this[_0xdda2('0x24')]={};this[_0xdda2('0x25')]={};this[_0xdda2('0x26')]={};this['smsWaitingInteractions']={};this[_0xdda2('0x27')]={};this['updateRealtime']();}Agent[_0xdda2('0x28')][_0xdda2('0x29')]=function(_0x4ac3eb){if(this[_0x4ac3eb+_0xdda2('0x2a')]>0x0){if(this[_0x4ac3eb+_0xdda2('0x2b')]>0x0&&this[_0x4ac3eb+_0xdda2('0x2a')]>=this[_0x4ac3eb+_0xdda2('0x2b')]){return _0xdda2('0x2c');}else{return'working';}}else{return _0xdda2('0x2d');}};Agent[_0xdda2('0x28')][_0xdda2('0x2e')]=function(){var _0x31d48b=['mail','chat',_0xdda2('0x2f'),_0xdda2('0x30'),_0xdda2('0x31'),'whatsapp'];for(var _0x90d919=0x0;_0x90d919<_0x31d48b[_0xdda2('0x32')];_0x90d919+=0x1){var _0x2e755b=this[_0xdda2('0x29')](_0x31d48b[_0x90d919]);if(this[_0x31d48b[_0x90d919]+_0xdda2('0x33')]!==_0x2e755b){this[_0x31d48b[_0x90d919]+_0xdda2('0x34')]=_['toNumber'](moment()[_0xdda2('0x35')]('x'));}this[_0x31d48b[_0x90d919]+_0xdda2('0x33')]=_0x2e755b;}var _0x53acb5={'id':this['id'],'name':this[_0xdda2('0x6')],'online':this[_0xdda2('0x7')],'voicePause':this[_0xdda2('0x8')],'chatPause':this[_0xdda2('0x9')],'mailPause':this['mailPause'],'smsPause':this[_0xdda2('0xc')],'faxPause':this[_0xdda2('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xdda2('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xdda2('0x36')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xdda2('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xdda2('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xdda2('0x19')],'smsStatusTime':this[_0xdda2('0x1a')],'smsCapacity':this[_0xdda2('0x37')],'smsCurrentCapacity':this[_0xdda2('0x1b')],'whatsappStatus':this[_0xdda2('0x38')],'whatsappStatusTime':this[_0xdda2('0x1c')],'whatsappCapacity':this[_0xdda2('0x1d')],'whatsappCurrentCapacity':this[_0xdda2('0x1e')],'openchannelStatus':this[_0xdda2('0x1f')],'openchannelStatusTime':this[_0xdda2('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xdda2('0x22')],'busy':this[_0xdda2('0x23')],'busyQueue':this[_0xdda2('0x39')],'chatWaitingInteractions':this[_0xdda2('0x3a')],'faxWaitingInteractions':this[_0xdda2('0x24')],'mailWaitingInteractions':this[_0xdda2('0x25')],'openchannelWaitingInteractions':this[_0xdda2('0x26')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0xa03f5=md5(JSON[_0xdda2('0x3b')](_0x53acb5));if(this[_0xdda2('0x0')]!==_0xa03f5){this['md5']=_0xa03f5;io['emit'](_0xdda2('0x3c'),_[_0xdda2('0x3d')](_0x53acb5,[_0xdda2('0x7')]));}};module[_0xdda2('0x3e')]=Agent; \ No newline at end of file +var _0x3a6d=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','mailWaitingInteractions','stringify','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x16d014,_0x4a5042){var _0x6e8ea1=function(_0x49d37a){while(--_0x49d37a){_0x16d014['push'](_0x16d014['shift']());}};_0x6e8ea1(++_0x4a5042);}(_0x3a6d,0x143));var _0xd3a6=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x3a6d[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xd3a6('0x0'));var md5=require(_0xd3a6('0x1'));var moment=require('moment');var Redis=require(_0xd3a6('0x2'));var config=require(_0xd3a6('0x3'));config[_0xd3a6('0x4')]=_[_0xd3a6('0x5')](config[_0xd3a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd3a6('0x6'))(new Redis(config[_0xd3a6('0x4')]));function Agent(_0x1e44bd){this['id']=_0x1e44bd['id']||0x0;this[_0xd3a6('0x7')]=_0x1e44bd[_0xd3a6('0x7')]||'';this[_0xd3a6('0x8')]=_0x1e44bd['online']||!![];this[_0xd3a6('0x9')]=_0x1e44bd[_0xd3a6('0x9')]||![];this[_0xd3a6('0xa')]=_0x1e44bd[_0xd3a6('0xa')]||![];this[_0xd3a6('0xb')]=_0x1e44bd[_0xd3a6('0xb')]||![];this[_0xd3a6('0xc')]=_0x1e44bd[_0xd3a6('0xc')]||![];this[_0xd3a6('0xd')]=_0x1e44bd['smsPause']||![];this[_0xd3a6('0xe')]=_0x1e44bd[_0xd3a6('0xe')]||![];this[_0xd3a6('0xf')]=_0xd3a6('0x10');this[_0xd3a6('0x11')]=0x0;this['chatCapacity']=_0x1e44bd['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xd3a6('0x12')]=_0xd3a6('0x10');this[_0xd3a6('0x13')]=0x0;this[_0xd3a6('0x14')]=_0x1e44bd[_0xd3a6('0x14')]||0x0;this[_0xd3a6('0x15')]=0x0;this[_0xd3a6('0x16')]='unknown';this[_0xd3a6('0x17')]=0x0;this[_0xd3a6('0x18')]=_0x1e44bd[_0xd3a6('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd3a6('0x19')]=_0xd3a6('0x10');this[_0xd3a6('0x1a')]=0x0;this['smsCapacity']=_0x1e44bd[_0xd3a6('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xd3a6('0x10');this[_0xd3a6('0x1c')]=0x0;this[_0xd3a6('0x1d')]=_0x1e44bd[_0xd3a6('0x1d')]||0x0;this[_0xd3a6('0x1e')]=0x0;this[_0xd3a6('0x1f')]=_0xd3a6('0x10');this['openchannelStatusTime']=0x0;this[_0xd3a6('0x20')]=_0x1e44bd['openchannelCapacity']||0x0;this[_0xd3a6('0x21')]=0x0;this[_0xd3a6('0x22')]=![];this[_0xd3a6('0x23')]=undefined;this[_0xd3a6('0x1')]='';this[_0xd3a6('0x24')]={};this[_0xd3a6('0x25')]={};this['mailWaitingInteractions']={};this[_0xd3a6('0x26')]={};this[_0xd3a6('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x5c9075){if(this[_0x5c9075+_0xd3a6('0x28')]>0x0){if(this[_0x5c9075+_0xd3a6('0x29')]>0x0&&this[_0x5c9075+_0xd3a6('0x28')]>=this[_0x5c9075+'Capacity']){return _0xd3a6('0x2a');}else{return'working';}}else{return _0xd3a6('0x2b');}};Agent[_0xd3a6('0x2c')][_0xd3a6('0x2d')]=function(){var _0x4f6130=[_0xd3a6('0x2e'),_0xd3a6('0x2f'),_0xd3a6('0x30'),_0xd3a6('0x31'),_0xd3a6('0x32'),_0xd3a6('0x33')];for(var _0x5650d1=0x0;_0x5650d1<_0x4f6130[_0xd3a6('0x34')];_0x5650d1+=0x1){var _0x2b5448=this[_0xd3a6('0x35')](_0x4f6130[_0x5650d1]);if(this[_0x4f6130[_0x5650d1]+_0xd3a6('0x36')]!==_0x2b5448){this[_0x4f6130[_0x5650d1]+_0xd3a6('0x37')]=_[_0xd3a6('0x38')](moment()['format']('x'));}this[_0x4f6130[_0x5650d1]+'Status']=_0x2b5448;}var _0x1f4859={'id':this['id'],'name':this[_0xd3a6('0x7')],'online':this[_0xd3a6('0x8')],'voicePause':this[_0xd3a6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xd3a6('0xb')],'smsPause':this[_0xd3a6('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd3a6('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd3a6('0x11')],'chatCapacity':this[_0xd3a6('0x39')],'chatCurrentCapacity':this[_0xd3a6('0x3a')],'mailStatus':this[_0xd3a6('0x12')],'mailStatusTime':this[_0xd3a6('0x13')],'mailCapacity':this[_0xd3a6('0x14')],'mailCurrentCapacity':this[_0xd3a6('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd3a6('0x18')],'faxCurrentCapacity':this[_0xd3a6('0x3b')],'smsStatus':this[_0xd3a6('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd3a6('0x1b')],'smsCurrentCapacity':this[_0xd3a6('0x3c')],'whatsappStatus':this[_0xd3a6('0x3d')],'whatsappStatusTime':this[_0xd3a6('0x1c')],'whatsappCapacity':this[_0xd3a6('0x1d')],'whatsappCurrentCapacity':this[_0xd3a6('0x1e')],'openchannelStatus':this[_0xd3a6('0x1f')],'openchannelStatusTime':this[_0xd3a6('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd3a6('0x21')],'busy':this[_0xd3a6('0x22')],'busyQueue':this[_0xd3a6('0x23')],'chatWaitingInteractions':this[_0xd3a6('0x24')],'faxWaitingInteractions':this[_0xd3a6('0x25')],'mailWaitingInteractions':this[_0xd3a6('0x3f')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd3a6('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x263615=md5(JSON[_0xd3a6('0x40')](_0x1f4859));if(this[_0xd3a6('0x1')]!==_0x263615){this[_0xd3a6('0x1')]=_0x263615;io['emit']('user:routing:update',_[_0xd3a6('0x41')](_0x1f4859,[_0xd3a6('0x8')]));}};module[_0xd3a6('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 632e18d..af05526 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 _0xcf59=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','paused','length','online','loggedIn','chatPause','available','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost'];(function(_0x3a1b27,_0x4147e4){var _0x15f42e=function(_0x45a328){while(--_0x45a328){_0x3a1b27['push'](_0x3a1b27['shift']());}};_0x15f42e(++_0x4147e4);}(_0xcf59,0xe2));var _0x9cf5=function(_0x50514b,_0x83db65){_0x50514b=_0x50514b-0x0;var _0x5d8587=_0xcf59[_0x50514b];return _0x5d8587;};'use strict';var _=require(_0x9cf5('0x0'));var md5=require(_0x9cf5('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x9cf5('0x2'));config[_0x9cf5('0x3')]=_[_0x9cf5('0x4')](config[_0x9cf5('0x3')],{'host':_0x9cf5('0x5'),'port':0x18eb});var io=require(_0x9cf5('0x6'))(new Redis(config[_0x9cf5('0x3')]));function ChatQueue(_0x2b6604){this['id']=_0x2b6604['id']||0x0;this[_0x9cf5('0x7')]=_0x2b6604[_0x9cf5('0x7')]||'';this[_0x9cf5('0x8')]=_0x2b6604[_0x9cf5('0x8')]||0xa;this[_0x9cf5('0x9')]=_0x2b6604[_0x9cf5('0x9')]||_0x9cf5('0xa');this[_0x9cf5('0xb')]=_0x2b6604[_0x9cf5('0xb')];this[_0x9cf5('0xc')]={};this[_0x9cf5('0xd')]=0x0;this[_0x9cf5('0x1')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x9cf5('0xe')][_0x9cf5('0xf')]=function(){var _0x1a43d5=this[_0x9cf5('0xc')][_0x9cf5('0x10')];this[_0x9cf5('0xc')]=_[_0x9cf5('0x11')](this[_0x9cf5('0xb')],'id');this['mapAgentsId'][_0x9cf5('0x10')]=_0x1a43d5;};ChatQueue[_0x9cf5('0xe')][_0x9cf5('0x12')]=function(){this['loggedIn']=0x0;this[_0x9cf5('0x13')]=0x0;for(var _0x131908=0x0;_0x131908=0x0?this['available']:0x0;var _0x3cb71b={'id':this['id'],'available':this[_0x9cf5('0x18')],'loggedIn':this[_0x9cf5('0x16')],'name':this[_0x9cf5('0x7')],'paused':this['paused'],'waiting':this[_0x9cf5('0xd')]};var _0x34179c=md5(JSON['stringify'](_0x3cb71b));if(this[_0x9cf5('0x1')]!==_0x34179c){this[_0x9cf5('0x1')]=_0x34179c;io['to'](util['format'](_0x9cf5('0x19'),_0x3cb71b[_0x9cf5('0x7')]))[_0x9cf5('0x1a')](_0x9cf5('0x1b'),_0x3cb71b);}};module[_0x9cf5('0x1c')]=ChatQueue; \ No newline at end of file +var _0xb883=['timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','online','loggedIn','chatPause','paused','available','name','stringify','format','emit','chat_queue:save','exports','lodash','md5','util','redis','defaults','localhost'];(function(_0x14db9e,_0x3a48c9){var _0x32dd2f=function(_0x7eabde){while(--_0x7eabde){_0x14db9e['push'](_0x14db9e['shift']());}};_0x32dd2f(++_0x3a48c9);}(_0xb883,0x159));var _0x3b88=function(_0x1b9497,_0x5300ef){_0x1b9497=_0x1b9497-0x0;var _0xc684f5=_0xb883[_0x1b9497];return _0xc684f5;};'use strict';var _=require(_0x3b88('0x0'));var md5=require(_0x3b88('0x1'));var util=require(_0x3b88('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x3b88('0x3')]=_[_0x3b88('0x4')](config[_0x3b88('0x3')],{'host':_0x3b88('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3b88('0x3')]));function ChatQueue(_0xef1365){this['id']=_0xef1365['id']||0x0;this['name']=_0xef1365['name']||'';this[_0x3b88('0x6')]=_0xef1365['timeout']||0xa;this['strategy']=_0xef1365[_0x3b88('0x7')]||_0x3b88('0x8');this[_0x3b88('0x9')]=_0xef1365[_0x3b88('0x9')];this['mapAgentsId']={};this[_0x3b88('0xa')]=0x0;this[_0x3b88('0x1')]='';this[_0x3b88('0xb')]();this[_0x3b88('0xc')]();}ChatQueue[_0x3b88('0xd')]['updateRouting']=function(){var _0x58be3d=this[_0x3b88('0xe')][_0x3b88('0xf')];this[_0x3b88('0xe')]=_['map'](this[_0x3b88('0x9')],'id');this[_0x3b88('0xe')][_0x3b88('0xf')]=_0x58be3d;};ChatQueue[_0x3b88('0xd')][_0x3b88('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4c6008=0x0;_0x4c6008=0x0?this[_0x3b88('0x14')]:0x0;var _0x3e7fec={'id':this['id'],'available':this[_0x3b88('0x14')],'loggedIn':this[_0x3b88('0x11')],'name':this[_0x3b88('0x15')],'paused':this[_0x3b88('0x13')],'waiting':this[_0x3b88('0xa')]};var _0x348583=md5(JSON[_0x3b88('0x16')](_0x3e7fec));if(this[_0x3b88('0x1')]!==_0x348583){this[_0x3b88('0x1')]=_0x348583;io['to'](util[_0x3b88('0x17')]('chat:queue:%s',_0x3e7fec[_0x3b88('0x15')]))[_0x3b88('0x18')](_0x3b88('0x19'),_0x3e7fec);}};module[_0x3b88('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index d38262d..45d009e 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 _0xcbb2=['localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0xcbb2,0x18f));var _0x2cbb=function(_0x270e55,_0x406969){_0x270e55=_0x270e55-0x0;var _0x5b503a=_0xcbb2[_0x270e55];return _0x5b503a;};'use strict';var _=require(_0x2cbb('0x0'));var md5=require(_0x2cbb('0x1'));var util=require(_0x2cbb('0x2'));var Redis=require(_0x2cbb('0x3'));var config=require(_0x2cbb('0x4'));config[_0x2cbb('0x5')]=_['defaults'](config['redis'],{'host':_0x2cbb('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2cbb('0x5')]));function FaxQueue(_0x4ba912){this['id']=_0x4ba912['id']||0x0;this[_0x2cbb('0x7')]=_0x4ba912[_0x2cbb('0x7')]||'';this[_0x2cbb('0x8')]=_0x4ba912[_0x2cbb('0x8')]||0xa;this[_0x2cbb('0x9')]=_0x4ba912[_0x2cbb('0x9')]||'beepall';this['Agents']=_0x4ba912[_0x2cbb('0xa')];this[_0x2cbb('0xb')]={};this[_0x2cbb('0xc')]=0x0;this[_0x2cbb('0x1')]='';this[_0x2cbb('0xd')]();this['updateRealtime']();}FaxQueue['prototype'][_0x2cbb('0xd')]=function(){var _0x51879f=this['mapAgentsId'][_0x2cbb('0xe')];this[_0x2cbb('0xb')]=_[_0x2cbb('0xf')](this[_0x2cbb('0xa')],'id');this['mapAgentsId']['_rr']=_0x51879f;};FaxQueue['prototype'][_0x2cbb('0x10')]=function(){this[_0x2cbb('0x11')]=0x0;this[_0x2cbb('0x12')]=0x0;for(var _0x38fa0d=0x0;_0x38fa0d=0x0?this[_0x2cbb('0x15')]:0x0;var _0x230a3c={'id':this['id'],'available':this[_0x2cbb('0x15')],'loggedIn':this[_0x2cbb('0x11')],'name':this['name'],'paused':this[_0x2cbb('0x12')],'waiting':this['waiting']};var _0x24524d=md5(JSON[_0x2cbb('0x16')](_0x230a3c));if(this['md5']!==_0x24524d){this[_0x2cbb('0x1')]=_0x24524d;io['to'](util[_0x2cbb('0x17')]('fax:queue:%s',_0x230a3c['name']))[_0x2cbb('0x18')](_0x2cbb('0x19'),_0x230a3c);}};module[_0x2cbb('0x1a')]=FaxQueue; \ No newline at end of file +var _0xb9e8=['updateRealtime','updateRouting','_rr','prototype','loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xb9e8,0x130));var _0x8b9e=function(_0x20b9fc,_0x5dab92){_0x20b9fc=_0x20b9fc-0x0;var _0x511a2b=_0xb9e8[_0x20b9fc];return _0x511a2b;};'use strict';var _=require(_0x8b9e('0x0'));var md5=require(_0x8b9e('0x1'));var util=require(_0x8b9e('0x2'));var Redis=require(_0x8b9e('0x3'));var config=require(_0x8b9e('0x4'));config['redis']=_[_0x8b9e('0x5')](config[_0x8b9e('0x6')],{'host':_0x8b9e('0x7'),'port':0x18eb});var io=require(_0x8b9e('0x8'))(new Redis(config['redis']));function FaxQueue(_0x10cec){this['id']=_0x10cec['id']||0x0;this[_0x8b9e('0x9')]=_0x10cec[_0x8b9e('0x9')]||'';this[_0x8b9e('0xa')]=_0x10cec[_0x8b9e('0xa')]||0xa;this[_0x8b9e('0xb')]=_0x10cec[_0x8b9e('0xb')]||'beepall';this[_0x8b9e('0xc')]=_0x10cec['Agents'];this[_0x8b9e('0xd')]={};this[_0x8b9e('0xe')]=0x0;this[_0x8b9e('0x1')]='';this['updateRouting']();this[_0x8b9e('0xf')]();}FaxQueue['prototype'][_0x8b9e('0x10')]=function(){var _0x236182=this['mapAgentsId'][_0x8b9e('0x11')];this[_0x8b9e('0xd')]=_['map'](this[_0x8b9e('0xc')],'id');this[_0x8b9e('0xd')][_0x8b9e('0x11')]=_0x236182;};FaxQueue[_0x8b9e('0x12')][_0x8b9e('0xf')]=function(){this[_0x8b9e('0x13')]=0x0;this[_0x8b9e('0x14')]=0x0;for(var _0x3d9b67=0x0;_0x3d9b67=0x0?this[_0x8b9e('0x17')]:0x0;var _0xce0580={'id':this['id'],'available':this[_0x8b9e('0x17')],'loggedIn':this[_0x8b9e('0x13')],'name':this['name'],'paused':this[_0x8b9e('0x14')],'waiting':this['waiting']};var _0x289af2=md5(JSON[_0x8b9e('0x18')](_0xce0580));if(this['md5']!==_0x289af2){this[_0x8b9e('0x1')]=_0x289af2;io['to'](util[_0x8b9e('0x19')](_0x8b9e('0x1a'),_0xce0580[_0x8b9e('0x9')]))['emit'](_0x8b9e('0x1b'),_0xce0580);}};module[_0x8b9e('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 10aefa5..7928369 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 _0x4243=['name','Intervals','exports'];(function(_0x10a0e7,_0x5cd95d){var _0x293b07=function(_0x2f97c9){while(--_0x2f97c9){_0x10a0e7['push'](_0x10a0e7['shift']());}};_0x293b07(++_0x5cd95d);}(_0x4243,0x1f2));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';function Interval(_0x4d708a){this['id']=_0x4d708a['id']||0x0;this[_0x3424('0x0')]=_0x4d708a[_0x3424('0x0')]||'';this[_0x3424('0x1')]=_0x4d708a[_0x3424('0x1')]||{};}module[_0x3424('0x2')]=Interval; \ No newline at end of file +var _0x3992=['exports','name','Intervals'];(function(_0xa1fa,_0xad4d14){var _0x3b6173=function(_0x13c0b1){while(--_0x13c0b1){_0xa1fa['push'](_0xa1fa['shift']());}};_0x3b6173(++_0xad4d14);}(_0x3992,0x15d));var _0x2399=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3992[_0x4cf98e];return _0x1623ac;};'use strict';function Interval(_0x430789){this['id']=_0x430789['id']||0x0;this[_0x2399('0x0')]=_0x430789[_0x2399('0x0')]||'';this['Intervals']=_0x430789[_0x2399('0x1')]||{};}module[_0x2399('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1d530e4..4abf7b4 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 _0xd080=['prototype','map','_rr','updateRealtime','paused','loggedIn','mailPause','available','stringify','format','emit','mail_queue:save','md5','util','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x92da9c,_0xa6cedc){var _0x1b85e4=function(_0x304840){while(--_0x304840){_0x92da9c['push'](_0x92da9c['shift']());}};_0x1b85e4(++_0xa6cedc);}(_0xd080,0x74));var _0x0d08=function(_0x3d59c7,_0x31ed0a){_0x3d59c7=_0x3d59c7-0x0;var _0x43c337=_0xd080[_0x3d59c7];return _0x43c337;};'use strict';var _=require('lodash');var md5=require(_0x0d08('0x0'));var util=require(_0x0d08('0x1'));var Redis=require(_0x0d08('0x2'));var config=require(_0x0d08('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x0d08('0x4'),'port':0x18eb});var io=require(_0x0d08('0x5'))(new Redis(config[_0x0d08('0x6')]));function MailQueue(_0x50079e){this['id']=_0x50079e['id']||0x0;this['name']=_0x50079e[_0x0d08('0x7')]||'';this[_0x0d08('0x8')]=_0x50079e[_0x0d08('0x8')]||0xa;this[_0x0d08('0x9')]=_0x50079e[_0x0d08('0x9')]||'beepall';this[_0x0d08('0xa')]=_0x50079e[_0x0d08('0xa')];this[_0x0d08('0xb')]={};this[_0x0d08('0xc')]=0x0;this['md5']='';this[_0x0d08('0xd')]();this['updateRealtime']();}MailQueue[_0x0d08('0xe')][_0x0d08('0xd')]=function(){var _0x449fd5=this['mapAgentsId']['_rr'];this[_0x0d08('0xb')]=_[_0x0d08('0xf')](this[_0x0d08('0xa')],'id');this[_0x0d08('0xb')][_0x0d08('0x10')]=_0x449fd5;};MailQueue[_0x0d08('0xe')][_0x0d08('0x11')]=function(){this['loggedIn']=0x0;this[_0x0d08('0x12')]=0x0;for(var _0x3a2973=0x0;_0x3a2973=0x0?this[_0x0d08('0x15')]:0x0;var _0x115bdc={'id':this['id'],'available':this[_0x0d08('0x15')],'loggedIn':this[_0x0d08('0x13')],'name':this['name'],'paused':this[_0x0d08('0x12')],'waiting':this['waiting']};var _0x88af4d=md5(JSON[_0x0d08('0x16')](_0x115bdc));if(this[_0x0d08('0x0')]!==_0x88af4d){this['md5']=_0x88af4d;io['to'](util[_0x0d08('0x17')]('mail:queue:%s',_0x115bdc[_0x0d08('0x7')]))[_0x0d08('0x18')](_0x0d08('0x19'),_0x115bdc);}};module['exports']=MailQueue; \ No newline at end of file +var _0xc488=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','online','mailPause','available','format','emit','mail_queue:save','md5','util','ioredis'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xc488,0x14f));var _0x8c48=function(_0x11ca17,_0x53671f){_0x11ca17=_0x11ca17-0x0;var _0x5899d8=_0xc488[_0x11ca17];return _0x5899d8;};'use strict';var _=require('lodash');var md5=require(_0x8c48('0x0'));var util=require(_0x8c48('0x1'));var Redis=require(_0x8c48('0x2'));var config=require('../../../config/environment');config[_0x8c48('0x3')]=_[_0x8c48('0x4')](config[_0x8c48('0x3')],{'host':_0x8c48('0x5'),'port':0x18eb});var io=require(_0x8c48('0x6'))(new Redis(config['redis']));function MailQueue(_0x2f6b09){this['id']=_0x2f6b09['id']||0x0;this[_0x8c48('0x7')]=_0x2f6b09[_0x8c48('0x7')]||'';this['timeout']=_0x2f6b09[_0x8c48('0x8')]||0xa;this[_0x8c48('0x9')]=_0x2f6b09[_0x8c48('0x9')]||'beepall';this[_0x8c48('0xa')]=_0x2f6b09['Agents'];this['mapAgentsId']={};this[_0x8c48('0xb')]=0x0;this[_0x8c48('0x0')]='';this[_0x8c48('0xc')]();this[_0x8c48('0xd')]();}MailQueue[_0x8c48('0xe')][_0x8c48('0xc')]=function(){var _0x5eaf22=this[_0x8c48('0xf')][_0x8c48('0x10')];this['mapAgentsId']=_[_0x8c48('0x11')](this[_0x8c48('0xa')],'id');this[_0x8c48('0xf')][_0x8c48('0x10')]=_0x5eaf22;};MailQueue[_0x8c48('0xe')][_0x8c48('0xd')]=function(){this[_0x8c48('0x12')]=0x0;this[_0x8c48('0x13')]=0x0;for(var _0x49685f=0x0;_0x49685f=0x0?this['available']:0x0;var _0x1a0bec={'id':this['id'],'available':this[_0x8c48('0x16')],'loggedIn':this[_0x8c48('0x12')],'name':this['name'],'paused':this[_0x8c48('0x13')],'waiting':this[_0x8c48('0xb')]};var _0x55b8a9=md5(JSON['stringify'](_0x1a0bec));if(this['md5']!==_0x55b8a9){this[_0x8c48('0x0')]=_0x55b8a9;io['to'](util[_0x8c48('0x17')]('mail:queue:%s',_0x1a0bec[_0x8c48('0x7')]))[_0x8c48('0x18')](_0x8c48('0x19'),_0x1a0bec);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index c0c2b3d..3860e99 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x1ebb07,_0x1b9738){var _0x1726a3=function(_0x22dfa2){while(--_0x22dfa2){_0x1ebb07['push'](_0x1ebb07['shift']());}};_0x1726a3(++_0x1b9738);}(_0x814b,0x1a2));var _0xb814=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0x814b[_0x3beea0];return _0x314eb1;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x427bfb,_0x1b54a3){var _0x34be85=function(_0x2c88f0){while(--_0x2c88f0){_0x427bfb['push'](_0x427bfb['shift']());}};_0x34be85(++_0x1b54a3);}(_0x814b,0x1a2));var _0xb814=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0x814b[_0x4d3187];return _0x107906;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3960601..67f1c48 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 _0x0487=['ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','format','sms:queue:%s','sms_queue:save','lodash','md5','util'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0x0487,0x14f));var _0x7048=function(_0x1aed80,_0x3ca6f6){_0x1aed80=_0x1aed80-0x0;var _0x43961e=_0x0487[_0x1aed80];return _0x43961e;};'use strict';var _=require(_0x7048('0x0'));var md5=require(_0x7048('0x1'));var util=require(_0x7048('0x2'));var Redis=require(_0x7048('0x3'));var config=require(_0x7048('0x4'));config[_0x7048('0x5')]=_['defaults'](config[_0x7048('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7048('0x6'))(new Redis(config[_0x7048('0x5')]));function SmsQueue(_0x1f00bf){this['id']=_0x1f00bf['id']||0x0;this[_0x7048('0x7')]=_0x1f00bf['name']||'';this[_0x7048('0x8')]=_0x1f00bf[_0x7048('0x8')]||0xa;this[_0x7048('0x9')]=_0x1f00bf['strategy']||_0x7048('0xa');this['Agents']=_0x1f00bf[_0x7048('0xb')];this[_0x7048('0xc')]={};this[_0x7048('0xd')]=0x0;this[_0x7048('0x1')]='';this[_0x7048('0xe')]();this[_0x7048('0xf')]();}SmsQueue[_0x7048('0x10')]['updateRouting']=function(){var _0x2eba6e=this[_0x7048('0xc')][_0x7048('0x11')];this['mapAgentsId']=_[_0x7048('0x12')](this[_0x7048('0xb')],'id');this['mapAgentsId'][_0x7048('0x11')]=_0x2eba6e;};SmsQueue[_0x7048('0x10')][_0x7048('0xf')]=function(){this[_0x7048('0x13')]=0x0;this[_0x7048('0x14')]=0x0;for(var _0x546c51=0x0;_0x546c51=0x0?this[_0x7048('0x16')]:0x0;var _0xbef931={'id':this['id'],'available':this[_0x7048('0x16')],'loggedIn':this[_0x7048('0x13')],'name':this['name'],'paused':this[_0x7048('0x14')],'waiting':this['waiting']};var _0x521a61=md5(JSON['stringify'](_0xbef931));if(this[_0x7048('0x1')]!==_0x521a61){this[_0x7048('0x1')]=_0x521a61;io['to'](util[_0x7048('0x17')](_0x7048('0x18'),_0xbef931[_0x7048('0x7')]))['emit'](_0x7048('0x19'),_0xbef931);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xf041=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','sms_queue:save','exports','util','ioredis','../../../config/environment','redis'];(function(_0x37858a,_0x3b523f){var _0x1ff350=function(_0x13f59c){while(--_0x13f59c){_0x37858a['push'](_0x37858a['shift']());}};_0x1ff350(++_0x3b523f);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1f04('0x0'));var Redis=require(_0x1f04('0x1'));var config=require(_0x1f04('0x2'));config[_0x1f04('0x3')]=_['defaults'](config[_0x1f04('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x1f04('0x4'))(new Redis(config['redis']));function SmsQueue(_0x530a67){this['id']=_0x530a67['id']||0x0;this[_0x1f04('0x5')]=_0x530a67['name']||'';this[_0x1f04('0x6')]=_0x530a67[_0x1f04('0x6')]||0xa;this[_0x1f04('0x7')]=_0x530a67[_0x1f04('0x7')]||'beepall';this[_0x1f04('0x8')]=_0x530a67[_0x1f04('0x8')];this[_0x1f04('0x9')]={};this[_0x1f04('0xa')]=0x0;this[_0x1f04('0xb')]='';this[_0x1f04('0xc')]();this[_0x1f04('0xd')]();}SmsQueue[_0x1f04('0xe')]['updateRouting']=function(){var _0x4f4e37=this[_0x1f04('0x9')][_0x1f04('0xf')];this[_0x1f04('0x9')]=_[_0x1f04('0x10')](this[_0x1f04('0x8')],'id');this[_0x1f04('0x9')][_0x1f04('0xf')]=_0x4f4e37;};SmsQueue[_0x1f04('0xe')][_0x1f04('0xd')]=function(){this[_0x1f04('0x11')]=0x0;this[_0x1f04('0x12')]=0x0;for(var _0x4ebd86=0x0;_0x4ebd86=0x0?this['available']:0x0;var _0x4964bd={'id':this['id'],'available':this[_0x1f04('0x15')],'loggedIn':this[_0x1f04('0x11')],'name':this[_0x1f04('0x5')],'paused':this[_0x1f04('0x12')],'waiting':this[_0x1f04('0xa')]};var _0x30d2e5=md5(JSON[_0x1f04('0x16')](_0x4964bd));if(this[_0x1f04('0xb')]!==_0x30d2e5){this['md5']=_0x30d2e5;io['to'](util[_0x1f04('0x17')](_0x1f04('0x18'),_0x4964bd[_0x1f04('0x5')]))['emit'](_0x1f04('0x19'),_0x4964bd);}};module[_0x1f04('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 6965926..c59638d 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 _0xca0a=['redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','_rr','mapAgentsId','map','loggedIn','paused','online','whatsappPause','available','format','whatsapp_queue:save','exports','md5','util','defaults'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xca0a,0x129));var _0xaca0=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xca0a[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var md5=require(_0xaca0('0x0'));var util=require(_0xaca0('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xaca0('0x2')](config[_0xaca0('0x3')],{'host':_0xaca0('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaca0('0x3')]));function WhatsappQueue(_0x266fd4){this['id']=_0x266fd4['id']||0x0;this['name']=_0x266fd4[_0xaca0('0x5')]||'';this[_0xaca0('0x6')]=_0x266fd4[_0xaca0('0x6')]||0xa;this['strategy']=_0x266fd4[_0xaca0('0x7')]||_0xaca0('0x8');this[_0xaca0('0x9')]=_0x266fd4[_0xaca0('0x9')];this['mapAgentsId']={};this[_0xaca0('0xa')]=0x0;this[_0xaca0('0x0')]='';this['updateRouting']();this[_0xaca0('0xb')]();}WhatsappQueue[_0xaca0('0xc')][_0xaca0('0xd')]=function(){var _0x5960c8=this['mapAgentsId'][_0xaca0('0xe')];this[_0xaca0('0xf')]=_[_0xaca0('0x10')](this[_0xaca0('0x9')],'id');this[_0xaca0('0xf')]['_rr']=_0x5960c8;};WhatsappQueue[_0xaca0('0xc')][_0xaca0('0xb')]=function(){this[_0xaca0('0x11')]=0x0;this[_0xaca0('0x12')]=0x0;for(var _0x40fdeb=0x0;_0x40fdeb=0x0?this[_0xaca0('0x15')]:0x0;var _0x2191f4={'id':this['id'],'available':this[_0xaca0('0x15')],'loggedIn':this[_0xaca0('0x11')],'name':this[_0xaca0('0x5')],'paused':this['paused'],'waiting':this[_0xaca0('0xa')]};var _0x4a4883=md5(JSON['stringify'](_0x2191f4));if(this[_0xaca0('0x0')]!==_0x4a4883){this[_0xaca0('0x0')]=_0x4a4883;io['to'](util[_0xaca0('0x16')]('whatsapp:queue:%s',_0x2191f4[_0xaca0('0x5')]))['emit'](_0xaca0('0x17'),_0x2191f4);}};module[_0xaca0('0x18')]=WhatsappQueue; \ No newline at end of file +var _0x1dcc=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x29b44e,_0x37210f){var _0x4ab492=function(_0x3e3c4a){while(--_0x3e3c4a){_0x29b44e['push'](_0x29b44e['shift']());}};_0x4ab492(++_0x37210f);}(_0x1dcc,0x74));var _0xc1dc=function(_0x36c280,_0x27086c){_0x36c280=_0x36c280-0x0;var _0x527dc8=_0x1dcc[_0x36c280];return _0x527dc8;};'use strict';var _=require(_0xc1dc('0x0'));var md5=require(_0xc1dc('0x1'));var util=require(_0xc1dc('0x2'));var Redis=require(_0xc1dc('0x3'));var config=require(_0xc1dc('0x4'));config[_0xc1dc('0x5')]=_[_0xc1dc('0x6')](config['redis'],{'host':_0xc1dc('0x7'),'port':0x18eb});var io=require(_0xc1dc('0x8'))(new Redis(config[_0xc1dc('0x5')]));function WhatsappQueue(_0x108745){this['id']=_0x108745['id']||0x0;this[_0xc1dc('0x9')]=_0x108745[_0xc1dc('0x9')]||'';this[_0xc1dc('0xa')]=_0x108745[_0xc1dc('0xa')]||0xa;this[_0xc1dc('0xb')]=_0x108745['strategy']||_0xc1dc('0xc');this['Agents']=_0x108745[_0xc1dc('0xd')];this[_0xc1dc('0xe')]={};this[_0xc1dc('0xf')]=0x0;this[_0xc1dc('0x1')]='';this[_0xc1dc('0x10')]();this[_0xc1dc('0x11')]();}WhatsappQueue[_0xc1dc('0x12')][_0xc1dc('0x10')]=function(){var _0xed8bdd=this['mapAgentsId']['_rr'];this[_0xc1dc('0xe')]=_[_0xc1dc('0x13')](this[_0xc1dc('0xd')],'id');this[_0xc1dc('0xe')][_0xc1dc('0x14')]=_0xed8bdd;};WhatsappQueue['prototype'][_0xc1dc('0x11')]=function(){this[_0xc1dc('0x15')]=0x0;this[_0xc1dc('0x16')]=0x0;for(var _0x2d8c63=0x0;_0x2d8c63=0x0?this[_0xc1dc('0x1a')]:0x0;var _0x19e62f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xc1dc('0x9')],'paused':this['paused'],'waiting':this['waiting']};var _0x485ffb=md5(JSON['stringify'](_0x19e62f));if(this[_0xc1dc('0x1')]!==_0x485ffb){this[_0xc1dc('0x1')]=_0x485ffb;io['to'](util[_0xc1dc('0x1b')](_0xc1dc('0x1c'),_0x19e62f['name']))[_0xc1dc('0x1d')]('whatsapp_queue:save',_0x19e62f);}};module[_0xc1dc('0x1e')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1bd7bd5..4f25f0f 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x6f7ed6,_0x38fc62){var _0x2671c8=function(_0x4bb557){while(--_0x4bb557){_0x6f7ed6['push'](_0x6f7ed6['shift']());}};_0x2671c8(++_0x38fc62);}(_0xb10b,0x12a));var _0xbb10=function(_0x276cc9,_0x17774c){_0x276cc9=_0x276cc9-0x0;var _0x31ac6b=_0xb10b[_0x276cc9];return _0x31ac6b;};'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 70a56f0..1814965 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 _0xb7d1=['../client','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xb7d1,0xa2));var _0x1b7d=function(_0x1e5229,_0x7a8de3){_0x1e5229=_0x1e5229-0x0;var _0x4be739=_0xb7d1[_0x1e5229];return _0x4be739;};'use strict';var client=require(_0x1b7d('0x0'));exports['update']=function(_0x4fe877,_0x183095){return client[_0x1b7d('0x1')](_0x1b7d('0x2'),{'body':_0x183095,'options':{'where':{'id':_0x4fe877}},'log':'updateChatInteraction'});};exports[_0x1b7d('0x3')]=function(_0x3480ca,_0xccb6be){return client['Request'](_0x1b7d('0x4'),{'body':_0xccb6be,'options':{'where':{'id':_0x3480ca}},'log':_0x1b7d('0x5')});}; \ No newline at end of file +var _0xa533=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa533,0x1e2));var _0x3a53=function(_0x30e112,_0x272717){_0x30e112=_0x30e112-0x0;var _0x311ac6=_0xa533[_0x30e112];return _0x311ac6;};'use strict';var client=require(_0x3a53('0x0'));exports[_0x3a53('0x1')]=function(_0x4bd113,_0xeef1f1){return client[_0x3a53('0x2')](_0x3a53('0x3'),{'body':_0xeef1f1,'options':{'where':{'id':_0x4bd113}},'log':_0x3a53('0x4')});};exports[_0x3a53('0x5')]=function(_0x583c7f,_0x1eaad8){return client['Request'](_0x3a53('0x6'),{'body':_0x1eaad8,'options':{'where':{'id':_0x583c7f}},'log':_0x3a53('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index d022d95..227bd85 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 _0xd1c5=['Request','CreateChatMessage','../client','create'];(function(_0x57fa31,_0x19dafc){var _0x415d7e=function(_0x5a512c){while(--_0x5a512c){_0x57fa31['push'](_0x57fa31['shift']());}};_0x415d7e(++_0x19dafc);}(_0xd1c5,0xf2));var _0x5d1c=function(_0x364efd,_0x37d653){_0x364efd=_0x364efd-0x0;var _0x3f2011=_0xd1c5[_0x364efd];return _0x3f2011;};'use strict';var client=require(_0x5d1c('0x0'));exports[_0x5d1c('0x1')]=function(_0x23e4ef){return client[_0x5d1c('0x2')](_0x5d1c('0x3'),{'body':_0x23e4ef,'log':'createChatMessage'});}; \ No newline at end of file +var _0x2a35=['../client','createChatMessage'];(function(_0x2634a7,_0x118508){var _0xa52e2c=function(_0x400f75){while(--_0x400f75){_0x2634a7['push'](_0x2634a7['shift']());}};_0xa52e2c(++_0x118508);}(_0x2a35,0x72));var _0x52a3=function(_0x9b9c8b,_0x6666ba){_0x9b9c8b=_0x9b9c8b-0x0;var _0x47a74d=_0x2a35[_0x9b9c8b];return _0x47a74d;};'use strict';var client=require(_0x52a3('0x0'));exports['create']=function(_0x2fa0b8){return client['Request']('CreateChatMessage',{'body':_0x2fa0b8,'log':_0x52a3('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 040c495..2982aaa 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 _0x5089=['strategy','User','chatPause','../client','getChatQueues','GetChatQueue','name','timeout'];(function(_0x43837c,_0x2b4d79){var _0x51eb0e=function(_0x2be8a2){while(--_0x2be8a2){_0x43837c['push'](_0x43837c['shift']());}};_0x51eb0e(++_0x2b4d79);}(_0x5089,0x1bb));var _0x9508=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x5089[_0x363ef8];return _0x148822;};'use strict';var client=require(_0x9508('0x0'));exports[_0x9508('0x1')]=function(){return function(){return client['Request'](_0x9508('0x2'),{'options':{'raw':![],'attributes':['id',_0x9508('0x3'),_0x9508('0x4'),_0x9508('0x5')],'include':[{'model':_0x9508('0x6'),'as':'Agents','attributes':['id',_0x9508('0x3'),'online',_0x9508('0x7')]}]},'log':_0x9508('0x1')});};}; \ No newline at end of file +var _0x6bb4=['../client','getChatQueues','Request','name','timeout','User','Agents','online','chatPause'];(function(_0x483ab9,_0x419148){var _0x35043b=function(_0x3453a3){while(--_0x3453a3){_0x483ab9['push'](_0x483ab9['shift']());}};_0x35043b(++_0x419148);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x1779d1,_0x55acb6){_0x1779d1=_0x1779d1-0x0;var _0x2884e3=_0x6bb4[_0x1779d1];return _0x2884e3;};'use strict';var client=require(_0x46bb('0x0'));exports[_0x46bb('0x1')]=function(){return function(){return client[_0x46bb('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x46bb('0x3'),_0x46bb('0x4'),'strategy'],'include':[{'model':_0x46bb('0x5'),'as':_0x46bb('0x6'),'attributes':['id',_0x46bb('0x3'),_0x46bb('0x7'),_0x46bb('0x8')]}]},'log':_0x46bb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index b076d4a..2740f10 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 _0x2cc1=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x2cc1[_0x12ddb2];return _0x10b6dd;};'use strict';var client=require(_0x12cc('0x0'));exports[_0x12cc('0x1')]=function(_0x4387a4){return client[_0x12cc('0x2')](_0x12cc('0x3'),{'body':_0x4387a4,'log':_0x12cc('0x3')});};exports[_0x12cc('0x4')]=function(_0x4316fc,_0x49436d){return client['Request'](_0x12cc('0x5'),{'body':_0x49436d,'options':{'where':{'uniqueid':_0x4316fc},'order':[['id',_0x12cc('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xa5ca=['update','Request','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xa5ca[_0x261522];return _0x98a25a;};'use strict';var client=require(_0xaa5c('0x0'));exports[_0xaa5c('0x1')]=function(_0x3d7bfc){return client['Request']('CreateChatQueueReport',{'body':_0x3d7bfc,'log':_0xaa5c('0x2')});};exports[_0xaa5c('0x3')]=function(_0x2757fe,_0x12c12f){return client[_0xaa5c('0x4')](_0xaa5c('0x5'),{'body':_0x12c12f,'options':{'where':{'uniqueid':_0x2757fe},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9cc1cb9..4a5e7c8 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(_0x439d59,_0x11ccdf){var _0x3670c7=function(_0x11cfcb){while(--_0x11cfcb){_0x439d59['push'](_0x439d59['shift']());}};_0x3670c7(++_0x11ccdf);}(_0x7a54,0x106));var _0x47a5=function(_0xaed82c,_0x234005){_0xaed82c=_0xaed82c-0x0;var _0x3fd2b6=_0x7a54[_0xaed82c];return _0x3fd2b6;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1ac6e5,_0x40f47f){var _0x5877dc=function(_0x99caea){while(--_0x99caea){_0x1ac6e5['push'](_0x1ac6e5['shift']());}};_0x5877dc(++_0x40f47f);}(_0x7a54,0x106));var _0x47a5=function(_0xa1a2f4,_0x595478){_0xa1a2f4=_0xa1a2f4-0x0;var _0x40727b=_0x7a54[_0xa1a2f4];return _0x40727b;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 8165951..d079915 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 _0x0d82=['../client','Request'];(function(_0x3b86ca,_0x6a4148){var _0x399205=function(_0x55d421){while(--_0x55d421){_0x3b86ca['push'](_0x3b86ca['shift']());}};_0x399205(++_0x6a4148);}(_0x0d82,0x14e));var _0x20d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0d82[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x20d8('0x0'));exports['create']=function(_0xb4ac18){return client[_0x20d8('0x1')]('CreateFaxMessage',{'body':_0xb4ac18,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xb0de=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb0de,0x6a));var _0xeb0d=function(_0x1db33d,_0x15befd){_0x1db33d=_0x1db33d-0x0;var _0x4ec6a9=_0xb0de[_0x1db33d];return _0x4ec6a9;};'use strict';var client=require(_0xeb0d('0x0'));exports['create']=function(_0x11e76f){return client[_0xeb0d('0x1')](_0xeb0d('0x2'),{'body':_0x11e76f,'log':_0xeb0d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 259aa49..85612a1 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 _0xb1db=['User','Agents','online','faxPause','../client','getFaxQueues','timeout','strategy'];(function(_0x2173e7,_0x34fcd3){var _0x550cab=function(_0x743abd){while(--_0x743abd){_0x2173e7['push'](_0x2173e7['shift']());}};_0x550cab(++_0x34fcd3);}(_0xb1db,0x13c));var _0xbb1d=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xb1db[_0x2dea24];return _0x309d58;};'use strict';var client=require(_0xbb1d('0x0'));exports[_0xbb1d('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0xbb1d('0x2'),_0xbb1d('0x3')],'include':[{'model':_0xbb1d('0x4'),'as':_0xbb1d('0x5'),'attributes':['id','name',_0xbb1d('0x6'),_0xbb1d('0x7')]}]},'log':_0xbb1d('0x1')});};}; \ No newline at end of file +var _0x0448=['../client','getFaxQueues','Request','name','strategy','User','online','faxPause'];(function(_0x37e890,_0x38dfa4){var _0x299034=function(_0x261887){while(--_0x261887){_0x37e890['push'](_0x37e890['shift']());}};_0x299034(++_0x38dfa4);}(_0x0448,0x150));var _0x8044=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x0448[_0x5a3cf0];return _0x5a64ee;};'use strict';var client=require(_0x8044('0x0'));exports[_0x8044('0x1')]=function(){return function(){return client[_0x8044('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8044('0x3'),'timeout',_0x8044('0x4')],'include':[{'model':_0x8044('0x5'),'as':'Agents','attributes':['id','name',_0x8044('0x6'),_0x8044('0x7')]}]},'log':_0x8044('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ca566b1..2f7c21f 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 _0x09e6=['update','Request','DESC','UpdateFaxQueueReport','../client','create','CreateFaxQueueReport'];(function(_0x546eed,_0x9b4516){var _0x1a9dd1=function(_0x4d1bbe){while(--_0x4d1bbe){_0x546eed['push'](_0x546eed['shift']());}};_0x1a9dd1(++_0x9b4516);}(_0x09e6,0xba));var _0x609e=function(_0x999ea5,_0x112f02){_0x999ea5=_0x999ea5-0x0;var _0x16b5dd=_0x09e6[_0x999ea5];return _0x16b5dd;};'use strict';var client=require(_0x609e('0x0'));exports[_0x609e('0x1')]=function(_0x2eb7e8){return client['Request'](_0x609e('0x2'),{'body':_0x2eb7e8,'log':_0x609e('0x2')});};exports[_0x609e('0x3')]=function(_0x45acf6,_0xdcd07c){return client[_0x609e('0x4')]('UpdateFaxQueueReport',{'body':_0xdcd07c,'options':{'where':{'uniqueid':_0x45acf6},'order':[['id',_0x609e('0x5')]],'limit':0x1},'log':_0x609e('0x6')});}; \ No newline at end of file +var _0xe4e7=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x3ca04d,_0xc49617){var _0x2e1091=function(_0x2d1db3){while(--_0x2d1db3){_0x3ca04d['push'](_0x3ca04d['shift']());}};_0x2e1091(++_0xc49617);}(_0xe4e7,0xc5));var _0x7e4e=function(_0x3cb10d,_0x26b91b){_0x3cb10d=_0x3cb10d-0x0;var _0xb504ba=_0xe4e7[_0x3cb10d];return _0xb504ba;};'use strict';var client=require('../client');exports[_0x7e4e('0x0')]=function(_0x4d2c7b){return client[_0x7e4e('0x1')]('CreateFaxQueueReport',{'body':_0x4d2c7b,'log':_0x7e4e('0x2')});};exports[_0x7e4e('0x3')]=function(_0x2274f1,_0x22b119){return client['Request'](_0x7e4e('0x4'),{'body':_0x22b119,'options':{'where':{'uniqueid':_0x2274f1},'order':[['id',_0x7e4e('0x5')]],'limit':0x1},'log':_0x7e4e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index cc22420..a64cca8 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 _0x654b=['../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x5ab329,_0x240291){var _0x541da7=function(_0x2082cd){while(--_0x2082cd){_0x5ab329['push'](_0x5ab329['shift']());}};_0x541da7(++_0x240291);}(_0x654b,0x13e));var _0xb654=function(_0x32a773,_0x57b5c7){_0x32a773=_0x32a773-0x0;var _0x430dcb=_0x654b[_0x32a773];return _0x430dcb;};'use strict';var client=require(_0xb654('0x0'));exports[_0xb654('0x1')]=function(){return function(){return client[_0xb654('0x2')](_0xb654('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb654('0x4')],'include':[{'model':_0xb654('0x5'),'as':'Intervals','attributes':['id',_0xb654('0x4'),'interval']}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x2c64=['GetInterval','name','Intervals','interval','getIntervals','../client','Request'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0x2c64,0x1ef));var _0x42c6=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x2c64[_0x2080a3];return _0x8d7d17;};'use strict';var client=require(_0x42c6('0x0'));exports['getIntervals']=function(){return function(){return client[_0x42c6('0x1')](_0x42c6('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x42c6('0x3')],'include':[{'model':'Interval','as':_0x42c6('0x4'),'attributes':['id',_0x42c6('0x3'),_0x42c6('0x5')]}]},'log':_0x42c6('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cf46ced..c85cd1c 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 _0x4b17=['addTagsToChatInteraction','../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x278610,_0x109fae){var _0x58f5f1=function(_0xfbbc2c){while(--_0xfbbc2c){_0x278610['push'](_0x278610['shift']());}};_0x58f5f1(++_0x109fae);}(_0x4b17,0x10f));var _0x74b1=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x4b17[_0x51674a];return _0x13fca6;};'use strict';var client=require(_0x74b1('0x0'));exports['update']=function(_0xd6951,_0x5483a2){return client[_0x74b1('0x1')](_0x74b1('0x2'),{'body':_0x5483a2,'options':{'where':{'id':_0xd6951}},'log':'updateMailInteraction'});};exports[_0x74b1('0x3')]=function(_0x4f206f,_0x4fdea2){return client[_0x74b1('0x1')](_0x74b1('0x4'),{'body':_0x4fdea2,'options':{'where':{'id':_0x4f206f}},'log':_0x74b1('0x5')});}; \ No newline at end of file +var _0x958a=['../client','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x31b777,_0x495416){var _0x3ed3ec=function(_0x23dd46){while(--_0x23dd46){_0x31b777['push'](_0x31b777['shift']());}};_0x3ed3ec(++_0x495416);}(_0x958a,0x128));var _0xa958=function(_0x262235,_0x404d1e){_0x262235=_0x262235-0x0;var _0x54d365=_0x958a[_0x262235];return _0x54d365;};'use strict';var client=require(_0xa958('0x0'));exports[_0xa958('0x1')]=function(_0x519e66,_0x44a925){return client[_0xa958('0x2')](_0xa958('0x3'),{'body':_0x44a925,'options':{'where':{'id':_0x519e66}},'log':_0xa958('0x4')});};exports[_0xa958('0x5')]=function(_0x5194f8,_0x3424b0){return client['Request'](_0xa958('0x6'),{'body':_0x3424b0,'options':{'where':{'id':_0x5194f8}},'log':_0xa958('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index fc3ada9..3676d40 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 _0x1525=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x34a9b8,_0x594eaa){var _0x3101f5=function(_0x219d7d){while(--_0x219d7d){_0x34a9b8['push'](_0x34a9b8['shift']());}};_0x3101f5(++_0x594eaa);}(_0x1525,0xa1));var _0x5152=function(_0x2c32c7,_0x19f691){_0x2c32c7=_0x2c32c7-0x0;var _0x473449=_0x1525[_0x2c32c7];return _0x473449;};'use strict';var client=require(_0x5152('0x0'));exports[_0x5152('0x1')]=function(_0x21a106){return client[_0x5152('0x2')](_0x5152('0x3'),{'body':_0x21a106,'log':_0x5152('0x4')});}; \ No newline at end of file +var _0x44a2=['create','Request','CreateMailMessage','createMailMessage'];(function(_0x26e66e,_0x68684a){var _0x1b3147=function(_0x5d0824){while(--_0x5d0824){_0x26e66e['push'](_0x26e66e['shift']());}};_0x1b3147(++_0x68684a);}(_0x44a2,0x14c));var _0x244a=function(_0x1d618b,_0x20c297){_0x1d618b=_0x1d618b-0x0;var _0x2c0e72=_0x44a2[_0x1d618b];return _0x2c0e72;};'use strict';var client=require('../client');exports[_0x244a('0x0')]=function(_0x551876){return client[_0x244a('0x1')](_0x244a('0x2'),{'body':_0x551876,'log':_0x244a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a7e2779..1e3e125 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 _0x16c8=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online'];(function(_0x42efd4,_0x2c3ee1){var _0x45159a=function(_0x501f95){while(--_0x501f95){_0x42efd4['push'](_0x42efd4['shift']());}};_0x45159a(++_0x2c3ee1);}(_0x16c8,0x1eb));var _0x816c=function(_0x4a50ab,_0xe7651b){_0x4a50ab=_0x4a50ab-0x0;var _0x1e65c2=_0x16c8[_0x4a50ab];return _0x1e65c2;};'use strict';var client=require('../client');exports[_0x816c('0x0')]=function(){return function(){return client[_0x816c('0x1')](_0x816c('0x2'),{'options':{'raw':![],'attributes':['id',_0x816c('0x3'),_0x816c('0x4'),_0x816c('0x5')],'include':[{'model':_0x816c('0x6'),'as':_0x816c('0x7'),'attributes':['id',_0x816c('0x3'),_0x816c('0x8'),_0x816c('0x9')]}]},'log':_0x816c('0x0')});};}; \ No newline at end of file +var _0x1e1e=['online','mailPause','getMailQueues','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x11daf4,_0x1528c6){var _0x2305c0=function(_0x168e4e){while(--_0x168e4e){_0x11daf4['push'](_0x11daf4['shift']());}};_0x2305c0(++_0x1528c6);}(_0x1e1e,0x161));var _0xe1e1=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x1e1e[_0x16629d];return _0x56ccee;};'use strict';var client=require('../client');exports[_0xe1e1('0x0')]=function(){return function(){return client['Request'](_0xe1e1('0x1'),{'options':{'raw':![],'attributes':['id',_0xe1e1('0x2'),_0xe1e1('0x3'),_0xe1e1('0x4')],'include':[{'model':_0xe1e1('0x5'),'as':_0xe1e1('0x6'),'attributes':['id',_0xe1e1('0x2'),_0xe1e1('0x7'),_0xe1e1('0x8')]}]},'log':_0xe1e1('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7292605..84baf38 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 _0xd025=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport','update'];(function(_0x54ae66,_0x333c4e){var _0x37e5f2=function(_0x1df56a){while(--_0x1df56a){_0x54ae66['push'](_0x54ae66['shift']());}};_0x37e5f2(++_0x333c4e);}(_0xd025,0x18a));var _0x5d02=function(_0xbab353,_0x37e159){_0xbab353=_0xbab353-0x0;var _0x56871e=_0xd025[_0xbab353];return _0x56871e;};'use strict';var client=require(_0x5d02('0x0'));exports[_0x5d02('0x1')]=function(_0x41934a){return client[_0x5d02('0x2')](_0x5d02('0x3'),{'body':_0x41934a,'log':'CreateMailQueueReport'});};exports[_0x5d02('0x4')]=function(_0x569b9e,_0x4c47f6){return client[_0x5d02('0x2')](_0x5d02('0x5'),{'body':_0x4c47f6,'options':{'where':{'uniqueid':_0x569b9e},'order':[['id',_0x5d02('0x6')]],'limit':0x1},'log':_0x5d02('0x5')});}; \ No newline at end of file +var _0x1cf7=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client','create'];(function(_0x3e3e8d,_0x4b3914){var _0x3d51d4=function(_0x3f0d40){while(--_0x3f0d40){_0x3e3e8d['push'](_0x3e3e8d['shift']());}};_0x3d51d4(++_0x4b3914);}(_0x1cf7,0x16a));var _0x71cf=function(_0x2e407f,_0x3bbd8d){_0x2e407f=_0x2e407f-0x0;var _0x27e69d=_0x1cf7[_0x2e407f];return _0x27e69d;};'use strict';var client=require(_0x71cf('0x0'));exports[_0x71cf('0x1')]=function(_0x1eb301){return client['Request'](_0x71cf('0x2'),{'body':_0x1eb301,'log':'CreateMailQueueReport'});};exports[_0x71cf('0x3')]=function(_0x1490bf,_0x1bea99){return client[_0x71cf('0x4')](_0x71cf('0x5'),{'body':_0x1bea99,'options':{'where':{'uniqueid':_0x1490bf},'order':[['id',_0x71cf('0x6')]],'limit':0x1},'log':_0x71cf('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 61bceab..928aa74 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 _0xf269=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x50e8eb,_0x3a56c7){var _0x2b6ad5=function(_0x556c11){while(--_0x556c11){_0x50e8eb['push'](_0x50e8eb['shift']());}};_0x2b6ad5(++_0x3a56c7);}(_0xf269,0x74));var _0x9f26=function(_0x5a890b,_0x51c862){_0x5a890b=_0x5a890b-0x0;var _0x43bfc5=_0xf269[_0x5a890b];return _0x43bfc5;};'use strict';var client=require(_0x9f26('0x0'));exports[_0x9f26('0x1')]=function(_0x48e698,_0x5474f3){return client[_0x9f26('0x2')](_0x9f26('0x3'),{'body':_0x5474f3,'options':{'where':{'id':_0x48e698}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x260736,_0x2777e3){return client[_0x9f26('0x2')](_0x9f26('0x4'),{'body':_0x2777e3,'options':{'where':{'id':_0x260736}},'log':_0x9f26('0x5')});}; \ No newline at end of file +var _0x77eb=['addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction'];(function(_0x1ea552,_0x127250){var _0x52a7ce=function(_0x165732){while(--_0x165732){_0x1ea552['push'](_0x1ea552['shift']());}};_0x52a7ce(++_0x127250);}(_0x77eb,0x81));var _0xb77e=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x77eb[_0xfc406a];return _0x395473;};'use strict';var client=require(_0xb77e('0x0'));exports[_0xb77e('0x1')]=function(_0x18ff21,_0x5b5b67){return client['Request'](_0xb77e('0x2'),{'body':_0x5b5b67,'options':{'where':{'id':_0x18ff21}},'log':_0xb77e('0x3')});};exports[_0xb77e('0x4')]=function(_0x4806d4,_0x206756){return client[_0xb77e('0x5')](_0xb77e('0x6'),{'body':_0x206756,'options':{'where':{'id':_0x4806d4}},'log':_0xb77e('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 57c4e12..06f9f36 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 _0x28bc=['createOpenchannelMessage','../client','create'];(function(_0x2533fe,_0x3be227){var _0x380eb1=function(_0x21fec8){while(--_0x21fec8){_0x2533fe['push'](_0x2533fe['shift']());}};_0x380eb1(++_0x3be227);}(_0x28bc,0xe2));var _0xc28b=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x28bc[_0x1a36a5];return _0x746243;};'use strict';var client=require(_0xc28b('0x0'));exports[_0xc28b('0x1')]=function(_0x1d1022){return client['Request']('CreateOpenchannelMessage',{'body':_0x1d1022,'log':_0xc28b('0x2')});}; \ No newline at end of file +var _0x6edf=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x2d7bc7,_0x3d1615){var _0x24832e=function(_0x462e94){while(--_0x462e94){_0x2d7bc7['push'](_0x2d7bc7['shift']());}};_0x24832e(++_0x3d1615);}(_0x6edf,0x1b2));var _0xf6ed=function(_0x1100ec,_0x4c97b1){_0x1100ec=_0x1100ec-0x0;var _0x9d4dee=_0x6edf[_0x1100ec];return _0x9d4dee;};'use strict';var client=require(_0xf6ed('0x0'));exports[_0xf6ed('0x1')]=function(_0x36c9fe){return client[_0xf6ed('0x2')](_0xf6ed('0x3'),{'body':_0x36c9fe,'log':_0xf6ed('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index bf36036..8036112 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 _0x6f65=['timeout','strategy','User','Agents','name','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x49a9e1,_0x547461){var _0x30d15e=function(_0x3cd52d){while(--_0x3cd52d){_0x49a9e1['push'](_0x49a9e1['shift']());}};_0x30d15e(++_0x547461);}(_0x6f65,0xec));var _0x56f6=function(_0x53aee9,_0x3b09f){_0x53aee9=_0x53aee9-0x0;var _0x416456=_0x6f65[_0x53aee9];return _0x416456;};'use strict';var client=require(_0x56f6('0x0'));exports[_0x56f6('0x1')]=function(){return function(){return client[_0x56f6('0x2')](_0x56f6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x56f6('0x4'),_0x56f6('0x5')],'include':[{'model':_0x56f6('0x6'),'as':_0x56f6('0x7'),'attributes':['id',_0x56f6('0x8'),_0x56f6('0x9'),'openchannelPause']}]},'log':_0x56f6('0x1')});};}; \ No newline at end of file +var _0xb0dc=['../client','getOpenchannelQueues','Request','name','strategy','User','online','openchannelPause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb0dc,0x150));var _0xcb0d=function(_0x36baac,_0x2ca483){_0x36baac=_0x36baac-0x0;var _0x430de5=_0xb0dc[_0x36baac];return _0x430de5;};'use strict';var client=require(_0xcb0d('0x0'));exports[_0xcb0d('0x1')]=function(){return function(){return client[_0xcb0d('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xcb0d('0x3'),'timeout',_0xcb0d('0x4')],'include':[{'model':_0xcb0d('0x5'),'as':'Agents','attributes':['id',_0xcb0d('0x3'),_0xcb0d('0x6'),_0xcb0d('0x7')]}]},'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 85b4022..4d8ca98 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 _0x1beb=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x2a0a63,_0x20729c){var _0x581215=function(_0x37a6fa){while(--_0x37a6fa){_0x2a0a63['push'](_0x2a0a63['shift']());}};_0x581215(++_0x20729c);}(_0x1beb,0x165));var _0xb1be=function(_0x2eac0d,_0xad77ac){_0x2eac0d=_0x2eac0d-0x0;var _0xc265dd=_0x1beb[_0x2eac0d];return _0xc265dd;};'use strict';var client=require(_0xb1be('0x0'));exports[_0xb1be('0x1')]=function(_0x56672f){return client[_0xb1be('0x2')](_0xb1be('0x3'),{'body':_0x56672f,'log':_0xb1be('0x3')});};exports['update']=function(_0x3c6ddd,_0xe463e1){return client['Request'](_0xb1be('0x4'),{'body':_0xe463e1,'options':{'where':{'uniqueid':_0x3c6ddd},'order':[['id',_0xb1be('0x5')]],'limit':0x1},'log':_0xb1be('0x4')});}; \ No newline at end of file +var _0x1d3a=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x4071cc,_0x2ba75f){var _0x2f2f8c=function(_0x5bd564){while(--_0x5bd564){_0x4071cc['push'](_0x4071cc['shift']());}};_0x2f2f8c(++_0x2ba75f);}(_0x1d3a,0xa2));var _0xa1d3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x1d3a[_0x5f0089];return _0x193892;};'use strict';var client=require(_0xa1d3('0x0'));exports[_0xa1d3('0x1')]=function(_0x304300){return client[_0xa1d3('0x2')](_0xa1d3('0x3'),{'body':_0x304300,'log':_0xa1d3('0x3')});};exports[_0xa1d3('0x4')]=function(_0x44bbf7,_0x3de76b){return client[_0xa1d3('0x2')](_0xa1d3('0x5'),{'body':_0x3de76b,'options':{'where':{'uniqueid':_0x44bbf7},'order':[['id',_0xa1d3('0x6')]],'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 5f5dfc5..4aaeed5 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 _0x6597=['../client','update','Request','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0xddd419,_0xfc2bb8){var _0x235494=function(_0x597657){while(--_0x597657){_0xddd419['push'](_0xddd419['shift']());}};_0x235494(++_0xfc2bb8);}(_0x6597,0x16e));var _0x7659=function(_0x31fdd2,_0x23d6fe){_0x31fdd2=_0x31fdd2-0x0;var _0x1cd1c3=_0x6597[_0x31fdd2];return _0x1cd1c3;};'use strict';var client=require(_0x7659('0x0'));exports[_0x7659('0x1')]=function(_0x2720d8,_0x5c67e8){return client[_0x7659('0x2')]('UpdateSmsInteraction',{'body':_0x5c67e8,'options':{'where':{'id':_0x2720d8}},'log':_0x7659('0x3')});};exports['addTags']=function(_0x5e96ed,_0x576e8b){return client[_0x7659('0x2')](_0x7659('0x4'),{'body':_0x576e8b,'options':{'where':{'id':_0x5e96ed}},'log':_0x7659('0x5')});}; \ No newline at end of file +var _0x46fc=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x282898,_0x556c29){var _0x147a14=function(_0x24e730){while(--_0x24e730){_0x282898['push'](_0x282898['shift']());}};_0x147a14(++_0x556c29);}(_0x46fc,0x103));var _0xc46f=function(_0x2e1464,_0x39ed59){_0x2e1464=_0x2e1464-0x0;var _0x195022=_0x46fc[_0x2e1464];return _0x195022;};'use strict';var client=require(_0xc46f('0x0'));exports[_0xc46f('0x1')]=function(_0xf5212c,_0x23d3ae){return client[_0xc46f('0x2')](_0xc46f('0x3'),{'body':_0x23d3ae,'options':{'where':{'id':_0xf5212c}},'log':_0xc46f('0x4')});};exports[_0xc46f('0x5')]=function(_0x3a56db,_0x5b0483){return client['Request'](_0xc46f('0x6'),{'body':_0x5b0483,'options':{'where':{'id':_0x3a56db}},'log':_0xc46f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ea7bed9..af78ec4 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 _0xca16=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0xa34cd7,_0x589125){var _0x45bb92=function(_0x4f2227){while(--_0x4f2227){_0xa34cd7['push'](_0xa34cd7['shift']());}};_0x45bb92(++_0x589125);}(_0xca16,0x7c));var _0x6ca1=function(_0x3e5743,_0x1277c4){_0x3e5743=_0x3e5743-0x0;var _0x27bf6f=_0xca16[_0x3e5743];return _0x27bf6f;};'use strict';var client=require(_0x6ca1('0x0'));exports[_0x6ca1('0x1')]=function(_0x537d4a){return client[_0x6ca1('0x2')](_0x6ca1('0x3'),{'body':_0x537d4a,'log':_0x6ca1('0x4')});}; \ No newline at end of file +var _0x0df7=['create','Request','CreateSmsMessage','createSmsMessage','../client'];(function(_0x41d432,_0x20e878){var _0x1650f9=function(_0x27f177){while(--_0x27f177){_0x41d432['push'](_0x41d432['shift']());}};_0x1650f9(++_0x20e878);}(_0x0df7,0x72));var _0x70df=function(_0x2af589,_0x3e7e14){_0x2af589=_0x2af589-0x0;var _0x33d2a6=_0x0df7[_0x2af589];return _0x33d2a6;};'use strict';var client=require(_0x70df('0x0'));exports[_0x70df('0x1')]=function(_0x565578){return client[_0x70df('0x2')](_0x70df('0x3'),{'body':_0x565578,'log':_0x70df('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9f1ce45..013e906 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4792c6,_0x5ecdaa){var _0x368ef0=function(_0xa53d82){while(--_0xa53d82){_0x4792c6['push'](_0x4792c6['shift']());}};_0x368ef0(++_0x5ecdaa);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x5a2ec8,_0x560609){var _0x69efdb=function(_0x948ca){while(--_0x948ca){_0x5a2ec8['push'](_0x5a2ec8['shift']());}};_0x69efdb(++_0x560609);}(_0x70e0,0x17b));var _0x070e=function(_0x4ddfc5,_0x20ae5f){_0x4ddfc5=_0x4ddfc5-0x0;var _0x2cb98b=_0x70e0[_0x4ddfc5];return _0x2cb98b;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ccee573..75b0703 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(_0x18fa1b,_0x3b6d3e){var _0x4036e6=function(_0x566906){while(--_0x566906){_0x18fa1b['push'](_0x18fa1b['shift']());}};_0x4036e6(++_0x3b6d3e);}(_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){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x5c304f,_0x11280c){var _0xd635be=function(_0xd597ee){while(--_0xd597ee){_0x5c304f['push'](_0x5c304f['shift']());}};_0xd635be(++_0x11280c);}(_0x70e0,0x17b));var _0x070e=function(_0x1e90eb,_0x25b0fe){_0x1e90eb=_0x1e90eb-0x0;var _0x3f54e4=_0x70e0[_0x1e90eb];return _0x3f54e4;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index edd7234..9c0c2b7 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(_0x4bdae6,_0xdf4405){var _0x573030=function(_0x4837d6){while(--_0x4837d6){_0x4bdae6['push'](_0x4bdae6['shift']());}};_0x573030(++_0xdf4405);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x2f92fb,_0x6a65a2){var _0x1fec4d=function(_0x349aad){while(--_0x349aad){_0x2f92fb['push'](_0x2f92fb['shift']());}};_0x1fec4d(++_0x6a65a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 65cc4ff..de43317 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 _0xacf4=['AddTagsToWhatsappInteraction','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xacf4,0xe7));var _0x4acf=function(_0x5eddec,_0x5c4b78){_0x5eddec=_0x5eddec-0x0;var _0x1339f1=_0xacf4[_0x5eddec];return _0x1339f1;};'use strict';var client=require('../client');exports['update']=function(_0x867c40,_0x14a022){return client[_0x4acf('0x0')](_0x4acf('0x1'),{'body':_0x14a022,'options':{'where':{'id':_0x867c40}},'log':_0x4acf('0x2')});};exports[_0x4acf('0x3')]=function(_0x145264,_0x5cf22d){return client[_0x4acf('0x0')](_0x4acf('0x4'),{'body':_0x5cf22d,'options':{'where':{'id':_0x145264}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x96fd=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction'];(function(_0xd6e8f7,_0x45b7d0){var _0x3cbb02=function(_0x515935){while(--_0x515935){_0xd6e8f7['push'](_0xd6e8f7['shift']());}};_0x3cbb02(++_0x45b7d0);}(_0x96fd,0x1e9));var _0xd96f=function(_0x34baf0,_0x44d55c){_0x34baf0=_0x34baf0-0x0;var _0x30e3a0=_0x96fd[_0x34baf0];return _0x30e3a0;};'use strict';var client=require('../client');exports[_0xd96f('0x0')]=function(_0x5334c3,_0x2022bf){return client[_0xd96f('0x1')]('UpdateWhatsappInteraction',{'body':_0x2022bf,'options':{'where':{'id':_0x5334c3}},'log':_0xd96f('0x2')});};exports[_0xd96f('0x3')]=function(_0x44f63c,_0x22b39b){return client['Request'](_0xd96f('0x4'),{'body':_0x22b39b,'options':{'where':{'id':_0x44f63c}},'log':_0xd96f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 957b54c..97863be 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 _0xfced=['create','Request','CreateWhatsappMessage','../client'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0xfced,0x19f));var _0xdfce=function(_0x436020,_0x475eb0){_0x436020=_0x436020-0x0;var _0x400eb6=_0xfced[_0x436020];return _0x400eb6;};'use strict';var client=require(_0xdfce('0x0'));exports[_0xdfce('0x1')]=function(_0x3ec623){return client[_0xdfce('0x2')](_0xdfce('0x3'),{'body':_0x3ec623,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x30dc=['Request','createWhatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30dc,0x12e));var _0xc30d=function(_0x7e8ffb,_0x272fcc){_0x7e8ffb=_0x7e8ffb-0x0;var _0x1756f6=_0x30dc[_0x7e8ffb];return _0x1756f6;};'use strict';var client=require('../client');exports['create']=function(_0x3b2f39){return client[_0xc30d('0x0')]('CreateWhatsappMessage',{'body':_0x3b2f39,'log':_0xc30d('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index bf168ae..635184f 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 _0x0739=['name','timeout','User','Agents','online','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x348bac,_0x1804b2){var _0x4e2cbf=function(_0x4c4421){while(--_0x4c4421){_0x348bac['push'](_0x348bac['shift']());}};_0x4e2cbf(++_0x1804b2);}(_0x0739,0x9e));var _0x9073=function(_0x568cea,_0xfe4c08){_0x568cea=_0x568cea-0x0;var _0x3403b6=_0x0739[_0x568cea];return _0x3403b6;};'use strict';var client=require(_0x9073('0x0'));exports[_0x9073('0x1')]=function(){return function(){return client[_0x9073('0x2')](_0x9073('0x3'),{'options':{'raw':![],'attributes':['id',_0x9073('0x4'),_0x9073('0x5'),'strategy'],'include':[{'model':_0x9073('0x6'),'as':_0x9073('0x7'),'attributes':['id',_0x9073('0x4'),_0x9073('0x8'),'whatsappPause']}]},'log':_0x9073('0x1')});};}; \ No newline at end of file +var _0x7069=['User','Agents','online','../client','getWhatsappQueues','GetWhatsappQueue','name','timeout'];(function(_0x37c820,_0x5667dc){var _0x234312=function(_0x1462d){while(--_0x1462d){_0x37c820['push'](_0x37c820['shift']());}};_0x234312(++_0x5667dc);}(_0x7069,0x1a3));var _0x9706=function(_0x4ca95f,_0x33ea2b){_0x4ca95f=_0x4ca95f-0x0;var _0xb2f0ac=_0x7069[_0x4ca95f];return _0xb2f0ac;};'use strict';var client=require(_0x9706('0x0'));exports[_0x9706('0x1')]=function(){return function(){return client['Request'](_0x9706('0x2'),{'options':{'raw':![],'attributes':['id',_0x9706('0x3'),_0x9706('0x4'),'strategy'],'include':[{'model':_0x9706('0x5'),'as':_0x9706('0x6'),'attributes':['id','name',_0x9706('0x7'),'whatsappPause']}]},'log':_0x9706('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1964bad..7f85e3e 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 _0xfa67=['../client','create','Request','update','UpdateWhatsappQueueReport','DESC'];(function(_0x2a6501,_0x9c5a0e){var _0x34d3ae=function(_0x204c8b){while(--_0x204c8b){_0x2a6501['push'](_0x2a6501['shift']());}};_0x34d3ae(++_0x9c5a0e);}(_0xfa67,0x1e0));var _0x7fa6=function(_0x506247,_0x48a919){_0x506247=_0x506247-0x0;var _0x12fab9=_0xfa67[_0x506247];return _0x12fab9;};'use strict';var client=require(_0x7fa6('0x0'));exports[_0x7fa6('0x1')]=function(_0x5aaa97){return client[_0x7fa6('0x2')]('CreateWhatsappQueueReport',{'body':_0x5aaa97,'log':'CreateWhatsappQueueReport'});};exports[_0x7fa6('0x3')]=function(_0x5e4757,_0x204a5c){return client[_0x7fa6('0x2')](_0x7fa6('0x4'),{'body':_0x204a5c,'options':{'where':{'uniqueid':_0x5e4757},'order':[['id',_0x7fa6('0x5')]],'limit':0x1},'log':_0x7fa6('0x4')});}; \ No newline at end of file +var _0xfba5=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x5e4cb8,_0x431e82){var _0x323bbe=function(_0x2f756a){while(--_0x2f756a){_0x5e4cb8['push'](_0x5e4cb8['shift']());}};_0x323bbe(++_0x431e82);}(_0xfba5,0xbd));var _0x5fba=function(_0x9ad32c,_0x852bef){_0x9ad32c=_0x9ad32c-0x0;var _0x45f700=_0xfba5[_0x9ad32c];return _0x45f700;};'use strict';var client=require(_0x5fba('0x0'));exports[_0x5fba('0x1')]=function(_0x5771ab){return client[_0x5fba('0x2')]('CreateWhatsappQueueReport',{'body':_0x5771ab,'log':_0x5fba('0x3')});};exports[_0x5fba('0x4')]=function(_0x3a5392,_0x62f533){return client[_0x5fba('0x2')](_0x5fba('0x5'),{'body':_0x62f533,'options':{'where':{'uniqueid':_0x3a5392},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 74f6e27..00e3eb8 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 _0xa840=['agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','info','next'];(function(_0x2eca9c,_0x3f028c){var _0x1a3e36=function(_0x4679c0){while(--_0x4679c0){_0x2eca9c['push'](_0x2eca9c['shift']());}};_0x1a3e36(++_0x3f028c);}(_0xa840,0x1e5));var _0x0a84=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa840[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x0a84('0x0'));var _=require('lodash');var util=require(_0x0a84('0x1'));var seqqueue=require(_0x0a84('0x2'));var logger=require(_0x0a84('0x3'))(_0x0a84('0x4'));var strategy=require(_0x0a84('0x5'));var queue=schema({'name':{'type':_0x0a84('0x6'),'required':!![],'message':_0x0a84('0x7')},'timeout':{'type':_0x0a84('0x8'),'message':_0x0a84('0x9')}});function writeLog(_0x114d68,_0x574cab,_0x910ac0){return logger['info'](util[_0x0a84('0xa')](_0x0a84('0xb'),_0x114d68,_0x574cab[_0x0a84('0xc')],_0x910ac0));}function handleFindAgent(_0x13b735){return function(_0x1540e7){return _0x1540e7['name']['toLowerCase']()===_0x13b735[_0x0a84('0xd')]();};}exports['consequence']=function(_0x5197ae,_0xea4d88,_0x3e6e18,_0x621bce){return function(_0x203f70){try{var _0x1e5471={'name':_0xea4d88[0x0],'timeout':_0xea4d88[0x1]};var _0x2e887a=queue['validate'](_0x1e5471,{'typecast':!![]});if(_0x2e887a[_0x0a84('0xe')]){logger[_0x0a84('0xf')](_0x0a84('0x10'),_0x5197ae,_[_0x0a84('0x11')](_0x2e887a,'message')[_0x0a84('0x12')](',\x20'));_0x203f70[_0x0a84('0x13')]();}else{var _0x494714=_[_0x0a84('0x14')](_0x3e6e18[_0x0a84('0x15')],handleFindAgent(_0x1e5471['name']));if(_0x494714){var _0x295b78=(_0x1e5471[_0x0a84('0x16')]||0xa)*0x3e8;var _0x37d1e0,_0x241494;var _0x429f4c=seqqueue[_0x0a84('0x17')](_0x295b78);_0x429f4c['id']=_0x5197ae;_0x429f4c[_0x0a84('0x18')]=_0x295b78;_0x429f4c[_0x0a84('0x19')]=_0x621bce[_0x0a84('0x19')];writeLog(_0x5197ae,_0x494714,util['format'](_0x0a84('0x1a'),_0x295b78));_0x3e6e18[_0x0a84('0x1b')][_0x5197ae]['on'](_0x0a84('0x1c'),function(){logger['info'](_0x0a84('0x1d'),_0x5197ae);clearTimeout(_0x241494);_0x241494=undefined;_0x429f4c[_0x0a84('0x1e')]();if(_0x3e6e18[_0x0a84('0x1b')][_0x5197ae]){delete _0x3e6e18[_0x0a84('0x1b')][_0x5197ae];}_0x203f70[_0x0a84('0x13')]();});_0x3e6e18[_0x0a84('0x1b')][_0x5197ae]['on']('complete',function(){if(_0x3e6e18[_0x0a84('0x1b')][_0x5197ae]){delete _0x3e6e18[_0x0a84('0x1b')][_0x5197ae];}});_0x241494=setTimeout(function(){logger[_0x0a84('0x1f')]('[%s][AGENT]\x20ROUTING\x20END',_0x5197ae);clearTimeout(_0x241494);_0x429f4c[_0x0a84('0x1e')]();_0x203f70[_0x0a84('0x20')]();},_0x295b78);strategy[_0x0a84('0x21')](_0x429f4c,_0x494714,_0x3e6e18,_0x621bce);}else{logger[_0x0a84('0xf')](_0x0a84('0x22'),_0x5197ae,_0x1e5471['name']);_0x203f70[_0x0a84('0x13')]();}}}catch(_0x15c11e){console[_0x0a84('0x23')](_0x15c11e);logger[_0x0a84('0xf')]('[%s][QUEUE]\x20%s',_0x5197ae,_0x15c11e[_0x0a84('0x24')]);_0x203f70[_0x0a84('0x13')]();}};}; \ No newline at end of file +var _0xbfcf=['toLowerCase','consequence','length','error','map','message','join','stop','find','agents','atimeout','channel','format','START:%s','rules','close','complete','info','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','[%s][AGENT][NAME:%s][STATUS:%s]','name'];(function(_0x5b8cb6,_0x41036a){var _0x461932=function(_0x62141c){while(--_0x62141c){_0x5b8cb6['push'](_0x5b8cb6['shift']());}};_0x461932(++_0x41036a);}(_0xbfcf,0x183));var _0xfbfc=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0xbfcf[_0x3fc97b];return _0x3a0c82;};'use strict';var schema=require(_0xfbfc('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xfbfc('0x1'))('routing');var strategy=require(_0xfbfc('0x2'));var queue=schema({'name':{'type':_0xfbfc('0x3'),'required':!![],'message':_0xfbfc('0x4')},'timeout':{'type':_0xfbfc('0x5'),'message':_0xfbfc('0x6')}});function writeLog(_0x537c22,_0x16e15e,_0x1b63e8){return logger['info'](util['format'](_0xfbfc('0x7'),_0x537c22,_0x16e15e[_0xfbfc('0x8')],_0x1b63e8));}function handleFindAgent(_0x5e6898){return function(_0x501ba5){return _0x501ba5['name'][_0xfbfc('0x9')]()===_0x5e6898[_0xfbfc('0x9')]();};}exports[_0xfbfc('0xa')]=function(_0x21394f,_0x418741,_0x10ebcd,_0x4a7554){return function(_0x40f4fc){try{var _0x27a462={'name':_0x418741[0x0],'timeout':_0x418741[0x1]};var _0x129fc4=queue['validate'](_0x27a462,{'typecast':!![]});if(_0x129fc4[_0xfbfc('0xb')]){logger[_0xfbfc('0xc')]('[%s][AGENT]\x20%s',_0x21394f,_[_0xfbfc('0xd')](_0x129fc4,_0xfbfc('0xe'))[_0xfbfc('0xf')](',\x20'));_0x40f4fc[_0xfbfc('0x10')]();}else{var _0x2cc61f=_[_0xfbfc('0x11')](_0x10ebcd[_0xfbfc('0x12')],handleFindAgent(_0x27a462['name']));if(_0x2cc61f){var _0x279905=(_0x27a462['timeout']||0xa)*0x3e8;var _0x3ccbe7,_0x3bce84;var _0x591966=seqqueue['createQueue'](_0x279905);_0x591966['id']=_0x21394f;_0x591966[_0xfbfc('0x13')]=_0x279905;_0x591966[_0xfbfc('0x14')]=_0x4a7554['channel'];writeLog(_0x21394f,_0x2cc61f,util[_0xfbfc('0x15')](_0xfbfc('0x16'),_0x279905));_0x10ebcd[_0xfbfc('0x17')][_0x21394f]['on']('end',function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x21394f);clearTimeout(_0x3bce84);_0x3bce84=undefined;_0x591966[_0xfbfc('0x18')]();if(_0x10ebcd[_0xfbfc('0x17')][_0x21394f]){delete _0x10ebcd['rules'][_0x21394f];}_0x40f4fc[_0xfbfc('0x10')]();});_0x10ebcd[_0xfbfc('0x17')][_0x21394f]['on'](_0xfbfc('0x19'),function(){if(_0x10ebcd[_0xfbfc('0x17')][_0x21394f]){delete _0x10ebcd[_0xfbfc('0x17')][_0x21394f];}});_0x3bce84=setTimeout(function(){logger[_0xfbfc('0x1a')](_0xfbfc('0x1b'),_0x21394f);clearTimeout(_0x3bce84);_0x591966[_0xfbfc('0x18')]();_0x40f4fc[_0xfbfc('0x1c')]();},_0x279905);strategy[_0xfbfc('0x1d')](_0x591966,_0x2cc61f,_0x10ebcd,_0x4a7554);}else{logger[_0xfbfc('0xc')](_0xfbfc('0x1e'),_0x21394f,_0x27a462[_0xfbfc('0x8')]);_0x40f4fc[_0xfbfc('0x10')]();}}}catch(_0x413852){console['log'](_0x413852);logger[_0xfbfc('0xc')](_0xfbfc('0x1f'),_0x21394f,_0x413852[_0xfbfc('0x20')]);_0x40f4fc[_0xfbfc('0x10')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index f56cb74..0507fdc 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 _0xc621=['aws-sdk','./utils','../../../../config/logger','routing','../../rpc/smsMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','Message','body','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse','stringify','create','then','dialogState','Failed','error','lodash','moment'];(function(_0x56de9d,_0x413b89){var _0x5b63fd=function(_0x2a5d13){while(--_0x2a5d13){_0x56de9d['push'](_0x56de9d['shift']());}};_0x5b63fd(++_0x413b89);}(_0xc621,0xfd));var _0x1c62=function(_0x38e5b3,_0xfc7aaa){_0x38e5b3=_0x38e5b3-0x0;var _0x26908b=_0xc621[_0x38e5b3];return _0x26908b;};'use strict';var _=require(_0x1c62('0x0'));var moment=require(_0x1c62('0x1'));var AWS=require(_0x1c62('0x2'));var utils=require(_0x1c62('0x3'));var logger=require(_0x1c62('0x4'))(_0x1c62('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1c62('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1c62('0x7')]=function(_0x42435d,_0x4495b8){return function(_0x1cd038){try{if(!_[_0x1c62('0x8')](this['interaction'][_0x1c62('0x9')])){logger[_0x1c62('0xa')](_0x1c62('0xb'),_0x42435d,_0x1c62('0xc'));return _0x1cd038[_0x1c62('0xd')]();}var _0x5f0922={'ContactId':this[_0x1c62('0xe')]['id'],'sentAt':moment()[_0x1c62('0xf')](_0x1c62('0x10')),'direction':_0x1c62('0x11')};if(this[_0x1c62('0x12')]===_0x1c62('0x13')||this[_0x1c62('0x12')]===_0x1c62('0x14')){_0x5f0922['phone']=this[_0x1c62('0x15')][_0x1c62('0x16')];}var _0x3874ba=this['channel'];if(_0x3874ba===_0x1c62('0x17')){_0x5f0922[_0x1c62('0x18')]=this[_0x1c62('0x19')]['id'];}else{_0x5f0922[_['upperFirst'](_0x3874ba)+'AccountId']=this[_0x1c62('0x19')]['id'];}_0x5f0922[_[_0x1c62('0x1a')](_0x3874ba)+_0x1c62('0x1b')]=this[_0x1c62('0x15')]['id'];if(this['interaction'][_0x1c62('0x1c')]){var _0x1f33ca=_0x4495b8[0x4];if(!_[_0x1c62('0x1d')](_0x1f33ca)){_0x5f0922['body']=utils[_0x1c62('0x1e')](_0x1f33ca,this);return rpc[_0x3874ba+_0x1c62('0x1f')]['create'](_0x5f0922)['then'](function(_0x257beb){logger['info'](_0x1c62('0xb'),_0x42435d,_0x5f0922[_0x1c62('0x20')]);})[_0x1c62('0x21')](function(_0x5c7ff9){logger['error'](_0x1c62('0xb'),_0x42435d,JSON['stringify'](_0x5c7ff9));})[_0x1c62('0x22')](function(){logger[_0x1c62('0xa')](_0x1c62('0x23'),_0x42435d);_0x1cd038[_0x1c62('0x24')]();});}else{logger[_0x1c62('0xa')](_0x1c62('0x25'),_0x42435d);_0x1cd038[_0x1c62('0x24')]();}}else{var _0x722e13=this;var _0x370d3b=new AWS[(_0x1c62('0x26'))]({'accessKeyId':_0x4495b8[0x0],'secretAccessKey':_0x4495b8[0x1],'region':_0x4495b8[0x2]});var _0x153250={'botAlias':_0x1c62('0x27'),'botName':_0x4495b8[0x3],'inputText':this[_0x1c62('0x28')][_0x1c62('0x20')],'userId':this[_0x1c62('0x12')]+':'+this['interaction']['id'][_0x1c62('0x29')]()};_0x370d3b[_0x1c62('0x2a')](_0x153250,function(_0x366f49,_0x5deebd){if(_0x366f49){logger['error'](_0x1c62('0xb'),_0x42435d,_0x366f49['message']);_0x1cd038[_0x1c62('0xd')]();}else if(_0x5deebd&&_0x5deebd[_0x1c62('0x28')]){_0x722e13[_0x1c62('0x20')][_0x1c62('0x2b')]=_0x5deebd;_0x5f0922[_0x1c62('0x20')]=_0x5deebd[_0x1c62('0x28')];_0x5f0922['providerName']=_0x1c62('0x2b');_0x5f0922[_0x1c62('0x2c')]=JSON[_0x1c62('0x2d')](_0x5deebd);return rpc[_0x3874ba+_0x1c62('0x1f')][_0x1c62('0x2e')](_0x5f0922)[_0x1c62('0x2f')](function(_0x2ee262){logger[_0x1c62('0xa')](_0x1c62('0xb'),_0x42435d,_0x5f0922[_0x1c62('0x20')]);if(_0x5deebd[_0x1c62('0x30')]==_0x1c62('0x31')){_0x1cd038[_0x1c62('0xd')]();}else{_0x1cd038['stop']();}})[_0x1c62('0x21')](function(_0x503149){logger[_0x1c62('0x32')](_0x1c62('0xb'),_0x42435d,JSON['stringify'](_0x503149));_0x1cd038['next']();});}else{_0x1cd038['next']();}});}}catch(_0x3a89b4){logger[_0x1c62('0x32')](_0x1c62('0xb'),_0x42435d,JSON['stringify'](_0x3a89b4));_0x1cd038[_0x1c62('0x24')]();}};}; \ No newline at end of file +var _0x0d35=['[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','toString','postText','message','amazonlex','providerResponse','stringify','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','account','upperFirst','InteractionId','created','isEmpty','body','Message','then','[%s][AMAZONLEX]\x20%s','catch','error','finally','stop'];(function(_0xacaf51,_0x1f4d4d){var _0x14cfac=function(_0x41a3fd){while(--_0x41a3fd){_0xacaf51['push'](_0xacaf51['shift']());}};_0x14cfac(++_0x1f4d4d);}(_0x0d35,0x196));var _0x50d3=function(_0x437c69,_0x14b6e1){_0x437c69=_0x437c69-0x0;var _0x8ad84d=_0x0d35[_0x437c69];return _0x8ad84d;};'use strict';var _=require('lodash');var moment=require(_0x50d3('0x0'));var AWS=require(_0x50d3('0x1'));var utils=require(_0x50d3('0x2'));var logger=require(_0x50d3('0x3'))(_0x50d3('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x50d3('0x5')),'mailMessage':require(_0x50d3('0x6')),'smsMessage':require(_0x50d3('0x7')),'faxMessage':require(_0x50d3('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x1ea598,_0x2a5f74){return function(_0x3562af){try{if(!_['isNil'](this[_0x50d3('0x9')]['UserId'])){logger[_0x50d3('0xa')]('[%s][AMAZONLEX]\x20%s',_0x1ea598,_0x50d3('0xb'));return _0x3562af[_0x50d3('0xc')]();}var _0x2ee1e0={'ContactId':this[_0x50d3('0xd')]['id'],'sentAt':moment()[_0x50d3('0xe')](_0x50d3('0xf')),'direction':_0x50d3('0x10')};if(this[_0x50d3('0x11')]==='sms'||this[_0x50d3('0x11')]===_0x50d3('0x12')){_0x2ee1e0[_0x50d3('0x13')]=this[_0x50d3('0x9')][_0x50d3('0x13')];}var _0x2b2116=this[_0x50d3('0x11')];if(_0x2b2116===_0x50d3('0x14')){_0x2ee1e0['ChatWebsiteId']=this[_0x50d3('0x15')]['id'];}else{_0x2ee1e0[_[_0x50d3('0x16')](_0x2b2116)+'AccountId']=this[_0x50d3('0x15')]['id'];}_0x2ee1e0[_[_0x50d3('0x16')](_0x2b2116)+_0x50d3('0x17')]=this[_0x50d3('0x9')]['id'];if(this['interaction'][_0x50d3('0x18')]){var _0x5ddc37=_0x2a5f74[0x4];if(!_[_0x50d3('0x19')](_0x5ddc37)){_0x2ee1e0[_0x50d3('0x1a')]=utils['getMustacheRender'](_0x5ddc37,this);return rpc[_0x2b2116+_0x50d3('0x1b')]['create'](_0x2ee1e0)[_0x50d3('0x1c')](function(_0x355cd1){logger[_0x50d3('0xa')](_0x50d3('0x1d'),_0x1ea598,_0x2ee1e0[_0x50d3('0x1a')]);})[_0x50d3('0x1e')](function(_0x11045d){logger[_0x50d3('0x1f')](_0x50d3('0x1d'),_0x1ea598,JSON['stringify'](_0x11045d));})[_0x50d3('0x20')](function(){logger[_0x50d3('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1ea598);_0x3562af[_0x50d3('0x21')]();});}else{logger['info'](_0x50d3('0x22'),_0x1ea598);_0x3562af[_0x50d3('0x21')]();}}else{var _0x254491=this;var _0x27574b=new AWS[(_0x50d3('0x23'))]({'accessKeyId':_0x2a5f74[0x0],'secretAccessKey':_0x2a5f74[0x1],'region':_0x2a5f74[0x2]});var _0x145b28={'botAlias':'$LATEST','botName':_0x2a5f74[0x3],'inputText':this['message'][_0x50d3('0x1a')],'userId':this['channel']+':'+this[_0x50d3('0x9')]['id'][_0x50d3('0x24')]()};_0x27574b[_0x50d3('0x25')](_0x145b28,function(_0x373cd8,_0x15e122){if(_0x373cd8){logger[_0x50d3('0x1f')](_0x50d3('0x1d'),_0x1ea598,_0x373cd8[_0x50d3('0x26')]);_0x3562af[_0x50d3('0xc')]();}else if(_0x15e122&&_0x15e122[_0x50d3('0x26')]){_0x254491['body'][_0x50d3('0x27')]=_0x15e122;_0x2ee1e0[_0x50d3('0x1a')]=_0x15e122[_0x50d3('0x26')];_0x2ee1e0['providerName']=_0x50d3('0x27');_0x2ee1e0[_0x50d3('0x28')]=JSON[_0x50d3('0x29')](_0x15e122);return rpc[_0x2b2116+_0x50d3('0x1b')]['create'](_0x2ee1e0)[_0x50d3('0x1c')](function(_0x2829b0){logger['info'](_0x50d3('0x1d'),_0x1ea598,_0x2ee1e0[_0x50d3('0x1a')]);if(_0x15e122[_0x50d3('0x2a')]==_0x50d3('0x2b')){_0x3562af[_0x50d3('0xc')]();}else{_0x3562af['stop']();}})[_0x50d3('0x1e')](function(_0x458869){logger[_0x50d3('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x1ea598,JSON[_0x50d3('0x29')](_0x458869));_0x3562af[_0x50d3('0xc')]();});}else{_0x3562af[_0x50d3('0xc')]();}});}}catch(_0xbd44ac){logger[_0x50d3('0x1f')](_0x50d3('0x1d'),_0x1ea598,JSON[_0x50d3('0x29')](_0xbd44ac));_0x3562af[_0x50d3('0x21')]();}};}; \ 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 610e7b5..ad3c9f6 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 _0xfb38=['update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','resolve','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../mailRpc','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','Message','html','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction'];(function(_0x314854,_0x2e42f7){var _0x177c7e=function(_0x458a51){while(--_0x458a51){_0x314854['push'](_0x314854['shift']());}};_0x177c7e(++_0x2e42f7);}(_0xfb38,0x14f));var _0x8fb3=function(_0x228acb,_0x3d4196){_0x228acb=_0x228acb-0x0;var _0x294939=_0xfb38[_0x228acb];return _0x294939;};'use strict';var _=require(_0x8fb3('0x0'));var moment=require(_0x8fb3('0x1'));var utils=require('./utils');var logger=require(_0x8fb3('0x2'))(_0x8fb3('0x3'));var rpc={'chatMessage':require(_0x8fb3('0x4')),'openchannelMessage':require(_0x8fb3('0x5')),'mailMessage':require(_0x8fb3('0x6')),'smsMessage':require(_0x8fb3('0x7')),'faxMessage':require(_0x8fb3('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x8fb3('0x9')),'openchannelInteraction':require(_0x8fb3('0xa')),'mailInteraction':require(_0x8fb3('0xb')),'smsInteraction':require(_0x8fb3('0xc')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x8fb3('0xd'));exports['consequence']=function(_0x1b34ed,_0x48112c,_0x5f57c7,_0x393f60){return function(_0x34feef){try{var _0x161fe0=this[_0x8fb3('0xe')];if(_0x161fe0===_0x8fb3('0xf')&&_0x393f60[_0x8fb3('0x10')]['isAutoreply']){logger[_0x8fb3('0x11')](_0x8fb3('0x12'),_0x1b34ed,_0x8fb3('0x13'));return _0x34feef[_0x8fb3('0x14')]();}if(_0x48112c[0x0]==='1'&&(_[_0x8fb3('0x15')](this[_0x8fb3('0x16')][_0x8fb3('0x17')])||!this[_0x8fb3('0x16')]['created'])){logger['info'](_0x8fb3('0x12'),_0x1b34ed,_0x8fb3('0x18'));return _0x34feef[_0x8fb3('0x14')]();}if(_0x48112c[0x0]==='2'&&this['interaction'][_0x8fb3('0x19')]){logger[_0x8fb3('0x11')](_0x8fb3('0x1a'),_0x1b34ed,_0x8fb3('0x1b'));return _0x34feef[_0x8fb3('0x14')]();}var _0x446564={'ContactId':this['contact']['id'],'sentAt':moment()[_0x8fb3('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x8fb3('0x1d')};if(this[_0x8fb3('0xe')]==='mail'){_0x446564[_0x8fb3('0x10')]=utils[_0x8fb3('0x1e')](_0x48112c[0x2],this);}else{_0x446564[_0x8fb3('0x10')]=utils['getMustacheRender'](_0x48112c[0x1],this);}if(this[_0x8fb3('0x1f')]){_0x446564['to']=this[_0x8fb3('0x1f')][_0x8fb3('0x20')]||'';if(this[_0x8fb3('0xe')]===_0x8fb3('0xf')&&_0x48112c[0x1]==='1'){_0x446564['cc']=this[_0x8fb3('0x1f')]['cc']||'';}_0x446564[_0x8fb3('0x20')]=this[_0x8fb3('0x1f')]['to']||'';_0x446564[_0x8fb3('0x21')]=this[_0x8fb3('0x1f')][_0x8fb3('0x21')]||'';_0x446564[_0x8fb3('0x22')]=!![];if(this['message'][_0x8fb3('0x23')]){_0x446564[_0x8fb3('0x23')]='';_0x446564['subject']+=_[_0x8fb3('0x24')](this['message'][_0x8fb3('0x23')],_0x8fb3('0x25'))?'':_0x8fb3('0x26');_0x446564['subject']+=this[_0x8fb3('0x1f')]['subject'];}}if(this[_0x8fb3('0xe')]===_0x8fb3('0x27')){_0x446564['ChatWebsiteId']=this[_0x8fb3('0x28')]['id'];}else{_0x446564[_[_0x8fb3('0x29')](this[_0x8fb3('0xe')])+'AccountId']=this[_0x8fb3('0x28')]['id'];}_0x446564[_[_0x8fb3('0x29')](this[_0x8fb3('0xe')])+'InteractionId']=this[_0x8fb3('0x16')]['id'];var _0x5ebe71=this['interaction'];if(rpc[this[_0x8fb3('0xe')]+_0x8fb3('0x2a')]){if(this[_0x8fb3('0xe')]===_0x8fb3('0xf')){_0x446564['inReplyTo']=this['message']['messageId'];_0x446564[_0x8fb3('0x2b')]=''+_['replace'](_0x446564[_0x8fb3('0x10')],'','replace','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfd67,0x19e));var _0x7fd6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfd67[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7fd6('0x0'));var moment=require(_0x7fd6('0x1'));var utils=require(_0x7fd6('0x2'));var logger=require('../../../../config/logger')(_0x7fd6('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7fd6('0x4')),'mailMessage':require(_0x7fd6('0x5')),'smsMessage':require(_0x7fd6('0x6')),'faxMessage':require(_0x7fd6('0x7')),'whatsappMessage':require(_0x7fd6('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7fd6('0x9')),'mailInteraction':require(_0x7fd6('0xa')),'smsInteraction':require(_0x7fd6('0xb')),'faxInteraction':require(_0x7fd6('0xc')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x7fd6('0xd')]=function(_0x389cf8,_0x4b23c2,_0x2b8b06,_0x4c52f8){return function(_0x1a2364){try{var _0x27f5a3=this[_0x7fd6('0xe')];if(_0x27f5a3==='mail'&&_0x4c52f8[_0x7fd6('0xf')][_0x7fd6('0x10')]){logger[_0x7fd6('0x11')](_0x7fd6('0x12'),_0x389cf8,_0x7fd6('0x13'));return _0x1a2364[_0x7fd6('0x14')]();}if(_0x4b23c2[0x0]==='1'&&(_[_0x7fd6('0x15')](this[_0x7fd6('0x16')]['created'])||!this[_0x7fd6('0x16')][_0x7fd6('0x17')])){logger[_0x7fd6('0x11')](_0x7fd6('0x12'),_0x389cf8,_0x7fd6('0x18'));return _0x1a2364['next']();}if(_0x4b23c2[0x0]==='2'&&this[_0x7fd6('0x16')]['autoreplyExecuted']){logger[_0x7fd6('0x11')](_0x7fd6('0x19'),_0x389cf8,'One\x20Time\x20already\x20sent');return _0x1a2364[_0x7fd6('0x14')]();}var _0x327803={'ContactId':this[_0x7fd6('0x1a')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7fd6('0x1b')};if(this[_0x7fd6('0xe')]==='mail'){_0x327803[_0x7fd6('0xf')]=utils[_0x7fd6('0x1c')](_0x4b23c2[0x2],this);}else{_0x327803[_0x7fd6('0xf')]=utils['getMustacheRender'](_0x4b23c2[0x1],this);}if(this[_0x7fd6('0x1d')]){_0x327803['to']=this['message'][_0x7fd6('0x1e')]||'';if(this['channel']===_0x7fd6('0x1f')&&_0x4b23c2[0x1]==='1'){_0x327803['cc']=this[_0x7fd6('0x1d')]['cc']||'';}_0x327803[_0x7fd6('0x1e')]=this[_0x7fd6('0x1d')]['to']||'';_0x327803[_0x7fd6('0x20')]=this[_0x7fd6('0x1d')][_0x7fd6('0x20')]||'';_0x327803[_0x7fd6('0x21')]=!![];if(this[_0x7fd6('0x1d')][_0x7fd6('0x22')]){_0x327803[_0x7fd6('0x22')]='';_0x327803[_0x7fd6('0x22')]+=_['startsWith'](this[_0x7fd6('0x1d')][_0x7fd6('0x22')],_0x7fd6('0x23'))?'':'Re:\x20';_0x327803['subject']+=this[_0x7fd6('0x1d')][_0x7fd6('0x22')];}}if(this[_0x7fd6('0xe')]==='chat'){_0x327803[_0x7fd6('0x24')]=this['account']['id'];}else{_0x327803[_[_0x7fd6('0x25')](this['channel'])+_0x7fd6('0x26')]=this[_0x7fd6('0x27')]['id'];}_0x327803[_[_0x7fd6('0x25')](this[_0x7fd6('0xe')])+_0x7fd6('0x28')]=this[_0x7fd6('0x16')]['id'];var _0x39e3b2=this[_0x7fd6('0x16')];if(rpc[this[_0x7fd6('0xe')]+'Message']){if(this['channel']==='mail'){_0x327803[_0x7fd6('0x29')]=this[_0x7fd6('0x1d')][_0x7fd6('0x2a')];_0x327803[_0x7fd6('0x2b')]=_0x7fd6('0x2c')+_[_0x7fd6('0x2d')](_0x327803['body'],_0x7fd6('0x2e'),']+(>|$)/g,''),'priorityTrue':_0xbcd5a8[0x1],'priorityFalse':_0xbcd5a8[0x2]};var _0x5683b6=gotoif[_0x0e0b('0x0')](_0x19a6b6,{'typecast':!![]});if(_0x5683b6[_0x0e0b('0xc')]){logger[_0x0e0b('0xd')]('[%s][GOTOIF]\x20%s',_0x396416,_[_0x0e0b('0xe')](_0x5683b6,_0x0e0b('0xf'))[_0x0e0b('0x10')](',\x20'));_0x12ffd9[_0x0e0b('0x11')]();}else{try{var _0x3d2355=eval('('+_0x19a6b6[_0x0e0b('0x12')]+')');var _0x278f3b=_0x3d2355?_0x19a6b6[_0x0e0b('0x13')]:_0x19a6b6[_0x0e0b('0x14')];logger[_0x0e0b('0x15')](_0x0e0b('0x16'),_0x396416,_0x19a6b6['condition'],_0x3d2355,_0x278f3b||_0x0e0b('0x17'));if(_0x278f3b){var _0x208ed8=_[_0x0e0b('0x18')](_0x12ffd9[_0x0e0b('0x19')](),{'p':_0x278f3b});if(_0x208ed8>=0x0){logger[_0x0e0b('0x15')](_0x0e0b('0x1a'),_0x396416,_0x278f3b||'next',_0x208ed8);_0x12ffd9[_0x0e0b('0x17')](_0x208ed8);}else{logger[_0x0e0b('0x15')](_0x0e0b('0x1b'),_0x396416,_0x278f3b||_0x0e0b('0x17'));_0x12ffd9['stop']();}}else{_0x12ffd9[_0x0e0b('0x17')]();}}catch(_0x35c03f){logger[_0x0e0b('0xd')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x396416,_0x35c03f[_0x0e0b('0xf')]);_0x12ffd9[_0x0e0b('0x11')]();}}}catch(_0x1ee825){logger[_0x0e0b('0xd')](_0x0e0b('0x1c'),_0x396416,JSON['stringify'](_0x1ee825));_0x12ffd9[_0x0e0b('0x11')]();}};}; \ No newline at end of file +var _0x1554=['consequence','getMustacheRender','error','[%s][GOTOIF]\x20%s','message','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1554,0x1d1));var _0x4155=function(_0x16b516,_0x4da0e3){_0x16b516=_0x16b516-0x0;var _0x2ce78a=_0x1554[_0x16b516];return _0x2ce78a;};'use strict';var schema=require('validate');var _=require(_0x4155('0x0'));var htmlToText=require(_0x4155('0x1'));var utils=require(_0x4155('0x2'));var logger=require(_0x4155('0x3'))(_0x4155('0x4'));var gotoif=schema({'condition':{'type':_0x4155('0x5'),'required':!![],'message':_0x4155('0x6')},'priorityTrue':{'type':_0x4155('0x7'),'message':_0x4155('0x8')},'priorityFalse':{'type':_0x4155('0x7'),'message':_0x4155('0x9')}});exports[_0x4155('0xa')]=function(_0x5e0c66,_0x5dd71a){return function(_0x4da0f5){try{var _0xaa4339={'condition':htmlToText['fromString'](utils[_0x4155('0xb')](_0x5dd71a[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5dd71a[0x1],'priorityFalse':_0x5dd71a[0x2]};var _0x2dae01=gotoif['validate'](_0xaa4339,{'typecast':!![]});if(_0x2dae01['length']){logger[_0x4155('0xc')](_0x4155('0xd'),_0x5e0c66,_['map'](_0x2dae01,_0x4155('0xe'))['join'](',\x20'));_0x4da0f5[_0x4155('0xf')]();}else{try{var _0x47771c=eval('('+_0xaa4339[_0x4155('0x10')]+')');var _0x2c27fd=_0x47771c?_0xaa4339['priorityTrue']:_0xaa4339[_0x4155('0x11')];logger['info'](_0x4155('0x12'),_0x5e0c66,_0xaa4339['condition'],_0x47771c,_0x2c27fd||_0x4155('0x13'));if(_0x2c27fd){var _0xf4b2db=_[_0x4155('0x14')](_0x4da0f5['rules'](),{'p':_0x2c27fd});if(_0xf4b2db>=0x0){logger[_0x4155('0x15')](_0x4155('0x16'),_0x5e0c66,_0x2c27fd||_0x4155('0x13'),_0xf4b2db);_0x4da0f5[_0x4155('0x13')](_0xf4b2db);}else{logger[_0x4155('0x15')](_0x4155('0x17'),_0x5e0c66,_0x2c27fd||'next');_0x4da0f5[_0x4155('0xf')]();}}else{_0x4da0f5['next']();}}catch(_0x5a9880){logger[_0x4155('0xc')](_0x4155('0x18'),_0x5e0c66,_0x5a9880['message']);_0x4da0f5['stop']();}}}catch(_0x2c1731){logger[_0x4155('0xc')](_0x4155('0xd'),_0x5e0c66,JSON['stringify'](_0x2c1731));_0x4da0f5[_0x4155('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index fa4ccf8..96c6cc8 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 _0xe8a3=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','message','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','stop','lodash','../../../../config/logger','routing'];(function(_0x125c85,_0x4c8246){var _0x226c88=function(_0x3f4f9f){while(--_0x3f4f9f){_0x125c85['push'](_0x125c85['shift']());}};_0x226c88(++_0x4c8246);}(_0xe8a3,0x162));var _0x3e8a=function(_0x1c8791,_0x17d51f){_0x1c8791=_0x1c8791-0x0;var _0x44e64c=_0xe8a3[_0x1c8791];return _0x44e64c;};'use strict';var schema=require('validate');var _=require(_0x3e8a('0x0'));var logger=require(_0x3e8a('0x1'))(_0x3e8a('0x2'));var gotop=schema({'priority':{'type':_0x3e8a('0x3'),'required':!![],'message':_0x3e8a('0x4')}});exports['consequence']=function(_0x21c39c,_0x4bf8f0){return function(_0x43ff3f){try{var _0x303d8e={'priority':_0x4bf8f0[0x0]};var _0x381258=gotop['validate'](_0x303d8e,{'typecast':!![]});if(_0x381258['length']){logger[_0x3e8a('0x5')](_0x3e8a('0x6'),_0x21c39c,_['map'](_0x381258,_0x3e8a('0x7'))['join'](',\x20'));_0x43ff3f['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x21c39c,_0x303d8e[_0x3e8a('0x8')]);if(_0x303d8e[_0x3e8a('0x8')]){var _0x584b5e=_[_0x3e8a('0x9')](_0x43ff3f[_0x3e8a('0xa')](),{'p':_0x303d8e[_0x3e8a('0x8')]});if(_0x584b5e>=0x0){logger[_0x3e8a('0xb')](_0x3e8a('0xc'),_0x21c39c,_0x303d8e['priority']||_0x3e8a('0xd'),_0x584b5e);_0x43ff3f[_0x3e8a('0xd')](_0x584b5e);}else{logger[_0x3e8a('0xb')](_0x3e8a('0xe'),_0x21c39c,_0x303d8e[_0x3e8a('0x8')]||_0x3e8a('0xd'));_0x43ff3f['stop']();}}else{_0x43ff3f[_0x3e8a('0xd')]();}}}catch(_0x2d91a5){logger[_0x3e8a('0x5')](_0x3e8a('0x6'),_0x21c39c,JSON[_0x3e8a('0xf')](_0x2d91a5));_0x43ff3f[_0x3e8a('0x10')]();}};}; \ No newline at end of file +var _0xf141=['join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','map','message'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xf141,0x17d));var _0x1f14=function(_0x368016,_0x5b65ac){_0x368016=_0x368016-0x0;var _0x15ae43=_0xf141[_0x368016];return _0x15ae43;};'use strict';var schema=require(_0x1f14('0x0'));var _=require(_0x1f14('0x1'));var logger=require(_0x1f14('0x2'))(_0x1f14('0x3'));var gotop=schema({'priority':{'type':_0x1f14('0x4'),'required':!![],'message':_0x1f14('0x5')}});exports[_0x1f14('0x6')]=function(_0x3b978f,_0x38401b){return function(_0x11e379){try{var _0x43a97d={'priority':_0x38401b[0x0]};var _0x311c73=gotop[_0x1f14('0x0')](_0x43a97d,{'typecast':!![]});if(_0x311c73[_0x1f14('0x7')]){logger['error']('[%s][GOTOP]\x20%s',_0x3b978f,_[_0x1f14('0x8')](_0x311c73,_0x1f14('0x9'))[_0x1f14('0xa')](',\x20'));_0x11e379['stop']();}else{logger[_0x1f14('0xb')](_0x1f14('0xc'),_0x3b978f,_0x43a97d['priority']);if(_0x43a97d[_0x1f14('0xd')]){var _0x59b799=_[_0x1f14('0xe')](_0x11e379[_0x1f14('0xf')](),{'p':_0x43a97d[_0x1f14('0xd')]});if(_0x59b799>=0x0){logger[_0x1f14('0xb')](_0x1f14('0x10'),_0x3b978f,_0x43a97d['priority']||_0x1f14('0x11'),_0x59b799);_0x11e379[_0x1f14('0x11')](_0x59b799);}else{logger[_0x1f14('0xb')](_0x1f14('0x12'),_0x3b978f,_0x43a97d[_0x1f14('0xd')]||'next');_0x11e379[_0x1f14('0x13')]();}}else{_0x11e379[_0x1f14('0x11')]();}}}catch(_0x4a8e28){logger[_0x1f14('0x14')](_0x1f14('0x15'),_0x3b978f,JSON[_0x1f14('0x16')](_0x4a8e28));_0x11e379[_0x1f14('0x13')]();}};}; \ 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 869cde9..76d378e 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 _0x6acf=['info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','getMustacheRender','channel','ChatWebsiteId','upperFirst','account','InteractionId','interaction','create'];(function(_0x15d3e9,_0x2a89a2){var _0xf4db3c=function(_0x3f4fdf){while(--_0x3f4fdf){_0x15d3e9['push'](_0x15d3e9['shift']());}};_0xf4db3c(++_0x2a89a2);}(_0x6acf,0x1d5));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6ac('0x0'));var utils=require(_0xf6ac('0x1'));var logger=require(_0xf6ac('0x2'))(_0xf6ac('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xf6ac('0x4')),'mailMessage':require(_0xf6ac('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf6ac('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x572eac,_0x2b0b54){return function(_0x2eeaeb){try{var _0x3c93e3={'body':utils[_0xf6ac('0x7')](_0x2b0b54[0x0],this),'ContactId':this['contact']['id']};if(this[_0xf6ac('0x8')]==='chat'){_0x3c93e3[_0xf6ac('0x9')]=this['account']['id'];}else{_0x3c93e3[_[_0xf6ac('0xa')](this[_0xf6ac('0x8')])+'AccountId']=this[_0xf6ac('0xb')]['id'];}_0x3c93e3[_['upperFirst'](this[_0xf6ac('0x8')])+_0xf6ac('0xc')]=this[_0xf6ac('0xd')]['id'];if(rpc[this[_0xf6ac('0x8')]+'Message']){return rpc[this[_0xf6ac('0x8')]+'Message'][_0xf6ac('0xe')](_0x3c93e3)['then'](function(_0x80ca5b){logger[_0xf6ac('0xf')](_0xf6ac('0x10'),_0x572eac,_0x3c93e3['body']);_0x2eeaeb[_0xf6ac('0x11')]();})[_0xf6ac('0x12')](function(_0x32b21b){logger[_0xf6ac('0x13')](_0xf6ac('0x10'),_0x572eac,JSON[_0xf6ac('0x14')](_0x32b21b));_0x2eeaeb[_0xf6ac('0x15')]();});}}catch(_0x1d225a){logger[_0xf6ac('0x13')]('[%s][MESSAGE]\x20%s',_0x572eac,JSON['stringify'](_0x1d225a));_0x2eeaeb[_0xf6ac('0x15')]();}};}; \ No newline at end of file +var _0x7e07=['then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','upperFirst','AccountId','InteractionId','Message','create'];(function(_0x1cb21a,_0x4f84f0){var _0x43b337=function(_0x3542c3){while(--_0x3542c3){_0x1cb21a['push'](_0x1cb21a['shift']());}};_0x43b337(++_0x4f84f0);}(_0x7e07,0xfc));var _0x77e0=function(_0x4bb66d,_0x32f27b){_0x4bb66d=_0x4bb66d-0x0;var _0x530883=_0x7e07[_0x4bb66d];return _0x530883;};'use strict';var _=require(_0x77e0('0x0'));var utils=require(_0x77e0('0x1'));var logger=require(_0x77e0('0x2'))(_0x77e0('0x3'));var rpc={'chatMessage':require(_0x77e0('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x77e0('0x5')),'smsMessage':require(_0x77e0('0x6')),'faxMessage':require(_0x77e0('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x77e0('0x8')]=function(_0x9b1f7,_0x53ef23){return function(_0x394c1e){try{var _0x22af63={'body':utils[_0x77e0('0x9')](_0x53ef23[0x0],this),'ContactId':this[_0x77e0('0xa')]['id']};if(this[_0x77e0('0xb')]===_0x77e0('0xc')){_0x22af63['ChatWebsiteId']=this['account']['id'];}else{_0x22af63[_[_0x77e0('0xd')](this[_0x77e0('0xb')])+_0x77e0('0xe')]=this['account']['id'];}_0x22af63[_[_0x77e0('0xd')](this[_0x77e0('0xb')])+_0x77e0('0xf')]=this['interaction']['id'];if(rpc[this[_0x77e0('0xb')]+_0x77e0('0x10')]){return rpc[this['channel']+_0x77e0('0x10')][_0x77e0('0x11')](_0x22af63)[_0x77e0('0x12')](function(_0x26ac8b){logger[_0x77e0('0x13')](_0x77e0('0x14'),_0x9b1f7,_0x22af63[_0x77e0('0x15')]);_0x394c1e[_0x77e0('0x16')]();})[_0x77e0('0x17')](function(_0x21ebe6){logger[_0x77e0('0x18')](_0x77e0('0x14'),_0x9b1f7,JSON[_0x77e0('0x19')](_0x21ebe6));_0x394c1e[_0x77e0('0x1a')]();});}}catch(_0x47c75f){logger[_0x77e0('0x18')](_0x77e0('0x14'),_0x9b1f7,JSON[_0x77e0('0x19')](_0x47c75f));_0x394c1e[_0x77e0('0x1a')]();}};}; \ 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 102ae87..961d216 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 _0x7d2b=['error','stringify','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7d2b,0x11c));var _0xb7d2=function(_0x3780a8,_0x3efd7e){_0x3780a8=_0x3780a8-0x0;var _0x362c59=_0x7d2b[_0x3780a8];return _0x362c59;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0xb7d2('0x0'));exports[_0xb7d2('0x1')]=function(_0x188947,_0x42d007){return function(_0x47f567){try{logger[_0xb7d2('0x2')](_0xb7d2('0x3'),_0x188947,utils['getMustacheRender'](_0x42d007[0x0],this));_0x47f567['next']();}catch(_0x2cad39){logger[_0xb7d2('0x4')]('[%s][NOOP]\x20%s',_0x188947,JSON[_0xb7d2('0x5')](_0x2cad39));_0x47f567['stop']();}};}; \ No newline at end of file +var _0x67ec=['next','stringify','stop','./utils','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x67ec,0x1e3));var _0xc67e=function(_0x44fa91,_0x56a9e0){_0x44fa91=_0x44fa91-0x0;var _0x40a373=_0x67ec[_0x44fa91];return _0x40a373;};'use strict';var utils=require(_0xc67e('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0xc67e('0x1')]=function(_0x18741c,_0x5bd942){return function(_0x4e90c2){try{logger[_0xc67e('0x2')](_0xc67e('0x3'),_0x18741c,utils[_0xc67e('0x4')](_0x5bd942[0x0],this));_0x4e90c2[_0xc67e('0x5')]();}catch(_0x1cf970){logger['error']('[%s][NOOP]\x20%s',_0x18741c,JSON[_0xc67e('0x6')](_0x1cf970));_0x4e90c2[_0xc67e('0x7')]();}};}; \ 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 6c38191..9e7ea60 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 _0xe8e5=['../../rpc/faxQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','qtimeout','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','seq-queue','ioredis','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','queue_id','account','queue','from','joinAt','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0xe8e5,0x138));var _0x5e8e=function(_0x555122,_0x3052d6){_0x555122=_0x555122-0x0;var _0x44c543=_0xe8e5[_0x555122];return _0x44c543;};'use strict';var schema=require('validate');var _=require(_0x5e8e('0x0'));var util=require(_0x5e8e('0x1'));var seqqueue=require(_0x5e8e('0x2'));var moment=require('moment');var Redis=require(_0x5e8e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5e8e('0x4'))('routing');var strategy=require(_0x5e8e('0x5'));config[_0x5e8e('0x6')]=_[_0x5e8e('0x7')](config[_0x5e8e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x5e8e('0x8'))(new Redis(config[_0x5e8e('0x6')]));var attributes=['id',_0x5e8e('0x9'),_0x5e8e('0xa'),_0x5e8e('0xb'),_0x5e8e('0xc'),_0x5e8e('0xd')];function emit(_0x2813e2,_0x2e1e4a,_0x5d0901){io['to'](_0x2813e2)['emit'](_0x2e1e4a,_0x5d0901);}function emitChannelQueueInteraction(_0x315540,_0x4348b5,_0x1c4306,_0x3a0e63,_0x5da459,_0xd8443f,_0x33095e,_0x5dfa5a){var _0x239026=_['clone'](_0x1c4306);_0x239026[_0x5e8e('0x9')]=_0x5dfa5a;_0x239026[_0x5e8e('0xb')]=_0x4348b5;_0x239026['account']=_0x3a0e63;_0x239026['id']=_0x5da459;if(_0xd8443f){attributes[_0x5e8e('0xe')](_[_0x5e8e('0xf')](_0x315540)+_0x5e8e('0x10'));_0x33095e[util[_0x5e8e('0x11')]('%sQueuesWaitingInteractions',_0x315540)][_0x5da459]=_['pick'](_0x239026,attributes);}else{delete _0x33095e[util['format'](_0x5e8e('0x12'),_0x315540)][_0x5da459];}emit(util['format']('%s:queue:%s',_0x315540,_0x4348b5),util['format'](_0x5e8e('0x13'),_0x315540,_0xd8443f?_0x5e8e('0x14'):'remove'),_[_0x5e8e('0x15')](_0x239026,attributes));}var rpc={'openchannelQueueReport':require(_0x5e8e('0x16')),'mailQueueReport':require(_0x5e8e('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x5e8e('0x18')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0x5e8e('0x19')),'faxInteraction':require(_0x5e8e('0x1a')),'mailInteraction':require(_0x5e8e('0x1b')),'openchannelInteraction':require(_0x5e8e('0x1c')),'smsInteraction':require(_0x5e8e('0x1d')),'whatsappInteraction':require(_0x5e8e('0x1e'))};var queue=schema({'name':{'type':_0x5e8e('0x1f'),'required':!![],'message':_0x5e8e('0x20')},'timeout':{'type':'number','message':_0x5e8e('0x21')}});function startRouting(_0x50d6fe,_0x171e06,_0x58d073,_0x86222c){if(_0x50d6fe&&_0x171e06&&_0x58d073){_0x171e06[_0x5e8e('0x22')]+=0x1;var _0x41a044={'uniqueid':_0x50d6fe,'from':_0x58d073[_0x5e8e('0x23')]?_0x58d073[_0x5e8e('0x23')]['from']:'','joinAt':moment()[_0x5e8e('0x11')](_0x5e8e('0x24')),'ContactId':_0x58d073[_0x5e8e('0x25')]?_0x58d073[_0x5e8e('0x25')]['id']:null,'ListId':_0x58d073[_0x5e8e('0x26')]?_0x58d073[_0x5e8e('0x26')]['id']:null};_0x41a044[_[_0x5e8e('0x27')](_0x58d073[_0x5e8e('0x28')])+_0x5e8e('0x29')]=_0x171e06['id']||null;_0x41a044[_[_0x5e8e('0x27')](_0x58d073['channel'])+'InteractionId']=_0x58d073['interaction']?_0x58d073[_0x5e8e('0x2a')]['id']:null;_0x41a044[_[_0x5e8e('0x27')](_0x58d073['channel'])+_0x5e8e('0x2b')]=_0x58d073[_0x5e8e('0x2c')]?_0x58d073['message']['id']:null;_0x41a044[_[_0x5e8e('0x27')](_0x58d073[_0x5e8e('0x28')])+(_0x58d073['channel']!==_0x5e8e('0x2d')?_0x5e8e('0x2e'):'WebsiteId')]=_0x58d073[_0x5e8e('0xa')]?_0x58d073[_0x5e8e('0xa')]['id']:null;logger[_0x5e8e('0x2f')](util[_0x5e8e('0x11')](_0x5e8e('0x30'),_0x50d6fe,_0x171e06[_0x5e8e('0x31')]));emitChannelQueueInteraction(_0x58d073[_0x5e8e('0x28')],_0x171e06[_0x5e8e('0x31')],_0x41a044,_0x58d073[_0x5e8e('0xa')][_0x5e8e('0x31')],_0x58d073['message']['id'],!![],_0x86222c,_0x171e06['id']);if(rpc[_0x58d073[_0x5e8e('0x28')]+_0x5e8e('0x32')]){return rpc[_0x58d073[_0x5e8e('0x28')]+_0x5e8e('0x32')][_0x5e8e('0x33')](_0x41a044)[_0x5e8e('0x34')](function(_0x5c68fb){logger[_0x5e8e('0x35')](_0x5e8e('0x36'),_0x5c68fb);});}}}function stopRouting(_0x394acc,_0x45644c,_0x44e594,_0x153ea2){if(_0x394acc&&_0x45644c){_0x45644c['waiting']-=0x1;var _0x138a88={'leaveAt':moment()[_0x5e8e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x5e8e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5e8e('0x37')};logger[_0x5e8e('0x2f')](util['format'](_0x5e8e('0x38'),_0x394acc,_0x45644c['name']));emitChannelQueueInteraction(_0x44e594[_0x5e8e('0x28')],_0x45644c[_0x5e8e('0x31')],_0x44e594[_0x5e8e('0x23')],_0x44e594['account']['name'],_0x44e594[_0x5e8e('0x2c')]['id'],![],_0x153ea2,_0x45644c['id']);return rpc[_0x44e594[_0x5e8e('0x28')]+_0x5e8e('0x39')][_0x5e8e('0x3a')](_0x44e594[_0x5e8e('0x2a')]['id'],{'queueId':_0x45644c['id']})[_0x5e8e('0x3b')](function(){if(rpc[_0x44e594[_0x5e8e('0x28')]+'QueueReport']){return rpc[_0x44e594['channel']+'QueueReport'][_0x5e8e('0x3a')](_0x394acc,_0x138a88)[_0x5e8e('0x34')](function(_0x1bc976){logger[_0x5e8e('0x35')](_0x5e8e('0x3c'),_0x1bc976);});}});}}function endRouting(_0x288f55,_0x7c3774,_0x294ea7,_0x3a4861){if(_0x288f55&&_0x7c3774){_0x7c3774[_0x5e8e('0x22')]-=0x1;var _0x48e6c3={'leaveAt':moment()[_0x5e8e('0x11')](_0x5e8e('0x24')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5e8e('0x3d')};logger[_0x5e8e('0x2f')](util['format'](_0x5e8e('0x3e'),_0x288f55,_0x7c3774['name']));emitChannelQueueInteraction(_0x294ea7['channel'],_0x7c3774[_0x5e8e('0x31')],_0x294ea7[_0x5e8e('0x23')],_0x294ea7[_0x5e8e('0xa')][_0x5e8e('0x31')],_0x294ea7['message']['id'],![],_0x3a4861);if(rpc[_0x294ea7['channel']+_0x5e8e('0x32')]){return rpc[_0x294ea7['channel']+_0x5e8e('0x32')]['update'](_0x288f55,_0x48e6c3)['catch'](function(_0x2787aa){logger[_0x5e8e('0x35')](_0x5e8e('0x3c'),_0x2787aa);});}}}function handleFindQueue(_0x260ca8){return function(_0x25614a){return _0x25614a[_0x5e8e('0x31')][_0x5e8e('0x3f')]()===_0x260ca8[_0x5e8e('0x3f')]();};}exports['consequence']=function(_0x4eda79,_0x3a3f82,_0x3a967f,_0x51ac38){return function(_0x1f9ff5){try{var _0x506cad={'name':_0x3a3f82[0x0],'timeout':_0x3a3f82[0x1]};var _0x1b2dce=queue[_0x5e8e('0x40')](_0x506cad,{'typecast':!![]});if(_0x1b2dce[_0x5e8e('0x41')]){logger[_0x5e8e('0x35')](_0x5e8e('0x42'),_0x4eda79,_[_0x5e8e('0x43')](_0x1b2dce,'message')['join'](',\x20'));_0x1f9ff5[_0x5e8e('0x44')]();}else{var _0x4d93a6=_['find'](_0x3a967f[_0x51ac38[_0x5e8e('0x28')]+_0x5e8e('0x45')],handleFindQueue(_0x506cad[_0x5e8e('0x31')]));if(_0x4d93a6){startRouting(_0x4eda79,_0x4d93a6,_0x51ac38,_0x3a967f);var _0x491727=(_0x4d93a6['timeout']||0xa)*0x3e8;var _0x43dd30=(_0x506cad[_0x5e8e('0x3d')]||0x14)*0x3e8;var _0x51375c;if(_0x491727>_0x43dd30){_0x43dd30=_0x491727;}var _0x90fc8f=seqqueue[_0x5e8e('0x46')](_0x491727);_0x90fc8f['id']=_0x4eda79;_0x90fc8f[_0x5e8e('0x47')]=_0x491727;_0x90fc8f[_0x5e8e('0x48')]=_0x43dd30;_0x90fc8f[_0x5e8e('0x28')]=_0x51ac38[_0x5e8e('0x28')];_0x3a967f['rules'][_0x4eda79]['on']('end',function(){logger[_0x5e8e('0x2f')](_0x5e8e('0x49'),_0x4eda79);stopRouting(_0x4eda79,_0x4d93a6,_0x51ac38,_0x3a967f);clearTimeout(_0x51375c);_0x51375c=undefined;_0x90fc8f[_0x5e8e('0x4a')](!![]);if(_0x3a967f[_0x5e8e('0x4b')][_0x4eda79]){delete _0x3a967f['rules'][_0x4eda79];}_0x1f9ff5[_0x5e8e('0x44')]();});_0x3a967f[_0x5e8e('0x4b')][_0x4eda79]['on'](_0x5e8e('0x4c'),function(){if(_0x3a967f[_0x5e8e('0x4b')][_0x4eda79]){delete _0x3a967f[_0x5e8e('0x4b')][_0x4eda79];}});_0x51375c=setTimeout(function(){logger[_0x5e8e('0x2f')](_0x5e8e('0x4d'),_0x4eda79);endRouting(_0x4eda79,_0x4d93a6,_0x51ac38,_0x3a967f);clearTimeout(_0x51375c);_0x90fc8f[_0x5e8e('0x4a')](!![]);_0x1f9ff5[_0x5e8e('0x4e')]();},_0x43dd30);switch(_0x4d93a6[_0x5e8e('0x4f')]){case _0x5e8e('0x50'):strategy[_0x5e8e('0x50')](_0x90fc8f,_0x4d93a6,_0x3a967f,_0x51ac38);break;default:strategy[_0x5e8e('0x51')](_0x90fc8f,_0x4d93a6,_0x3a967f,_0x51ac38);}}else{logger[_0x5e8e('0x35')](_0x5e8e('0x52'),_0x4eda79,_0x506cad['name']);_0x1f9ff5[_0x5e8e('0x44')]();}}}catch(_0x130f5c){logger[_0x5e8e('0x35')](_0x5e8e('0x42'),_0x4eda79,_0x130f5c[_0x5e8e('0x53')]);_0x1f9ff5[_0x5e8e('0x44')]();}};}; \ No newline at end of file +var _0x8322=['error','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','join','find','Queues','createQueue','atimeout','qtimeout','rules','end','close','stop','complete','next','rrmemory','beepall','validate','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x8322,0xbc));var _0x2832=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0x8322[_0x26d386];return _0x4ef9a8;};'use strict';var schema=require(_0x2832('0x0'));var _=require('lodash');var util=require(_0x2832('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x2832('0x2'));var Redis=require(_0x2832('0x3'));var config=require(_0x2832('0x4'));var logger=require(_0x2832('0x5'))(_0x2832('0x6'));var strategy=require('./strategy');config[_0x2832('0x7')]=_['defaults'](config['redis'],{'host':_0x2832('0x8'),'port':0x18eb});var io=require(_0x2832('0x9'))(new Redis(config[_0x2832('0x7')]));var attributes=['id',_0x2832('0xa'),_0x2832('0xb'),_0x2832('0xc'),_0x2832('0xd'),_0x2832('0xe')];function emit(_0x16d391,_0x34b644,_0x14d87e){io['to'](_0x16d391)[_0x2832('0xf')](_0x34b644,_0x14d87e);}function emitChannelQueueInteraction(_0x3099db,_0x2c2fc5,_0x1f3aa,_0x341c34,_0x3dc1e5,_0x131c10,_0x3a8a27,_0x296a5a){var _0x4b50f6=_[_0x2832('0x10')](_0x1f3aa);_0x4b50f6[_0x2832('0xa')]=_0x296a5a;_0x4b50f6[_0x2832('0xc')]=_0x2c2fc5;_0x4b50f6['account']=_0x341c34;_0x4b50f6['id']=_0x3dc1e5;if(_0x131c10){attributes[_0x2832('0x11')](_[_0x2832('0x12')](_0x3099db)+'InteractionId');_0x3a8a27[util[_0x2832('0x13')]('%sQueuesWaitingInteractions',_0x3099db)][_0x3dc1e5]=_[_0x2832('0x14')](_0x4b50f6,attributes);}else{delete _0x3a8a27[util['format'](_0x2832('0x15'),_0x3099db)][_0x3dc1e5];}emit(util['format'](_0x2832('0x16'),_0x3099db,_0x2c2fc5),util['format'](_0x2832('0x17'),_0x3099db,_0x131c10?_0x2832('0x18'):'remove'),_[_0x2832('0x14')](_0x4b50f6,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2832('0x19')),'chatQueueReport':require(_0x2832('0x1a')),'smsQueueReport':require(_0x2832('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x2832('0x1c')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x2832('0x1d')),'openchannelInteraction':require(_0x2832('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x2832('0x1f'))};var queue=schema({'name':{'type':_0x2832('0x20'),'required':!![],'message':_0x2832('0x21')},'timeout':{'type':_0x2832('0x22'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xfc9ea0,_0x50d29f,_0x6b79ac,_0x5d0f0c){if(_0xfc9ea0&&_0x50d29f&&_0x6b79ac){_0x50d29f[_0x2832('0x23')]+=0x1;var _0x1844b4={'uniqueid':_0xfc9ea0,'from':_0x6b79ac[_0x2832('0x24')]?_0x6b79ac[_0x2832('0x24')][_0x2832('0xd')]:'','joinAt':moment()['format'](_0x2832('0x25')),'ContactId':_0x6b79ac['contact']?_0x6b79ac[_0x2832('0x26')]['id']:null,'ListId':_0x6b79ac[_0x2832('0x27')]?_0x6b79ac[_0x2832('0x27')]['id']:null};_0x1844b4[_[_0x2832('0x28')](_0x6b79ac[_0x2832('0x29')])+_0x2832('0x2a')]=_0x50d29f['id']||null;_0x1844b4[_[_0x2832('0x28')](_0x6b79ac[_0x2832('0x29')])+_0x2832('0x2b')]=_0x6b79ac[_0x2832('0x2c')]?_0x6b79ac['interaction']['id']:null;_0x1844b4[_['upperFirst'](_0x6b79ac[_0x2832('0x29')])+_0x2832('0x2d')]=_0x6b79ac[_0x2832('0x2e')]?_0x6b79ac['message']['id']:null;_0x1844b4[_[_0x2832('0x28')](_0x6b79ac[_0x2832('0x29')])+(_0x6b79ac[_0x2832('0x29')]!==_0x2832('0x2f')?_0x2832('0x30'):'WebsiteId')]=_0x6b79ac['account']?_0x6b79ac[_0x2832('0xb')]['id']:null;logger[_0x2832('0x31')](util[_0x2832('0x13')](_0x2832('0x32'),_0xfc9ea0,_0x50d29f[_0x2832('0x33')]));emitChannelQueueInteraction(_0x6b79ac['channel'],_0x50d29f[_0x2832('0x33')],_0x1844b4,_0x6b79ac[_0x2832('0xb')][_0x2832('0x33')],_0x6b79ac[_0x2832('0x2e')]['id'],!![],_0x5d0f0c,_0x50d29f['id']);if(rpc[_0x6b79ac[_0x2832('0x29')]+'QueueReport']){return rpc[_0x6b79ac[_0x2832('0x29')]+_0x2832('0x34')][_0x2832('0x35')](_0x1844b4)[_0x2832('0x36')](function(_0x26c2dc){logger[_0x2832('0x37')]('create\x20queue\x20report',_0x26c2dc);});}}}function stopRouting(_0xa41d52,_0x12a1dd,_0xcec23b,_0x60e055){if(_0xa41d52&&_0x12a1dd){_0x12a1dd[_0x2832('0x23')]-=0x1;var _0x170b5a={'leaveAt':moment()[_0x2832('0x13')](_0x2832('0x25')),'acceptAt':moment()[_0x2832('0x13')](_0x2832('0x25')),'reason':_0x2832('0x38')};logger[_0x2832('0x31')](util[_0x2832('0x13')](_0x2832('0x39'),_0xa41d52,_0x12a1dd['name']));emitChannelQueueInteraction(_0xcec23b['channel'],_0x12a1dd[_0x2832('0x33')],_0xcec23b[_0x2832('0x24')],_0xcec23b[_0x2832('0xb')][_0x2832('0x33')],_0xcec23b[_0x2832('0x2e')]['id'],![],_0x60e055,_0x12a1dd['id']);return rpc[_0xcec23b[_0x2832('0x29')]+_0x2832('0x3a')][_0x2832('0x3b')](_0xcec23b[_0x2832('0x2c')]['id'],{'queueId':_0x12a1dd['id']})['then'](function(){if(rpc[_0xcec23b['channel']+_0x2832('0x34')]){return rpc[_0xcec23b[_0x2832('0x29')]+_0x2832('0x34')][_0x2832('0x3b')](_0xa41d52,_0x170b5a)[_0x2832('0x36')](function(_0x446d11){logger[_0x2832('0x37')](_0x2832('0x3c'),_0x446d11);});}});}}function endRouting(_0x158c01,_0x493f82,_0x51bb72,_0x3effc7){if(_0x158c01&&_0x493f82){_0x493f82[_0x2832('0x23')]-=0x1;var _0x115826={'leaveAt':moment()[_0x2832('0x13')](_0x2832('0x25')),'exitAt':moment()[_0x2832('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x2832('0x3d')};logger[_0x2832('0x31')](util[_0x2832('0x13')](_0x2832('0x3e'),_0x158c01,_0x493f82['name']));emitChannelQueueInteraction(_0x51bb72[_0x2832('0x29')],_0x493f82['name'],_0x51bb72[_0x2832('0x24')],_0x51bb72['account']['name'],_0x51bb72[_0x2832('0x2e')]['id'],![],_0x3effc7);if(rpc[_0x51bb72[_0x2832('0x29')]+_0x2832('0x34')]){return rpc[_0x51bb72['channel']+_0x2832('0x34')][_0x2832('0x3b')](_0x158c01,_0x115826)[_0x2832('0x36')](function(_0x393095){logger['error'](_0x2832('0x3c'),_0x393095);});}}}function handleFindQueue(_0x900dc1){return function(_0x525596){return _0x525596[_0x2832('0x33')][_0x2832('0x3f')]()===_0x900dc1['toLowerCase']();};}exports[_0x2832('0x40')]=function(_0x4841c5,_0x5bf208,_0x2e7a63,_0x112fe0){return function(_0x4aa38a){try{var _0x56b528={'name':_0x5bf208[0x0],'timeout':_0x5bf208[0x1]};var _0x5c9979=queue[_0x2832('0x0')](_0x56b528,{'typecast':!![]});if(_0x5c9979[_0x2832('0x41')]){logger['error'](_0x2832('0x42'),_0x4841c5,_['map'](_0x5c9979,_0x2832('0x2e'))[_0x2832('0x43')](',\x20'));_0x4aa38a['stop']();}else{var _0x40c19e=_[_0x2832('0x44')](_0x2e7a63[_0x112fe0[_0x2832('0x29')]+_0x2832('0x45')],handleFindQueue(_0x56b528[_0x2832('0x33')]));if(_0x40c19e){startRouting(_0x4841c5,_0x40c19e,_0x112fe0,_0x2e7a63);var _0x2eef8a=(_0x40c19e[_0x2832('0x3d')]||0xa)*0x3e8;var _0x4807eb=(_0x56b528['timeout']||0x14)*0x3e8;var _0x319ef6;if(_0x2eef8a>_0x4807eb){_0x4807eb=_0x2eef8a;}var _0x5b5b3e=seqqueue[_0x2832('0x46')](_0x2eef8a);_0x5b5b3e['id']=_0x4841c5;_0x5b5b3e[_0x2832('0x47')]=_0x2eef8a;_0x5b5b3e[_0x2832('0x48')]=_0x4807eb;_0x5b5b3e[_0x2832('0x29')]=_0x112fe0[_0x2832('0x29')];_0x2e7a63[_0x2832('0x49')][_0x4841c5]['on'](_0x2832('0x4a'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x4841c5);stopRouting(_0x4841c5,_0x40c19e,_0x112fe0,_0x2e7a63);clearTimeout(_0x319ef6);_0x319ef6=undefined;_0x5b5b3e[_0x2832('0x4b')](!![]);if(_0x2e7a63[_0x2832('0x49')][_0x4841c5]){delete _0x2e7a63[_0x2832('0x49')][_0x4841c5];}_0x4aa38a[_0x2832('0x4c')]();});_0x2e7a63['rules'][_0x4841c5]['on'](_0x2832('0x4d'),function(){if(_0x2e7a63['rules'][_0x4841c5]){delete _0x2e7a63[_0x2832('0x49')][_0x4841c5];}});_0x319ef6=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x4841c5);endRouting(_0x4841c5,_0x40c19e,_0x112fe0,_0x2e7a63);clearTimeout(_0x319ef6);_0x5b5b3e[_0x2832('0x4b')](!![]);_0x4aa38a[_0x2832('0x4e')]();},_0x4807eb);switch(_0x40c19e['strategy']){case'rrmemory':strategy[_0x2832('0x4f')](_0x5b5b3e,_0x40c19e,_0x2e7a63,_0x112fe0);break;default:strategy[_0x2832('0x50')](_0x5b5b3e,_0x40c19e,_0x2e7a63,_0x112fe0);}}else{logger[_0x2832('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4841c5,_0x56b528[_0x2832('0x33')]);_0x4aa38a[_0x2832('0x4c')]();}}}catch(_0x3281d3){logger[_0x2832('0x37')]('[%s][QUEUE]\x20%s',_0x4841c5,_0x3281d3['stack']);_0x4aa38a[_0x2832('0x4c')]();}};}; \ 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 b5adf2e..bd91cbd 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 _0x0faf=['showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification'];(function(_0x4840b0,_0x1bc010){var _0x54b78c=function(_0x1ad5b4){while(--_0x1ad5b4){_0x4840b0['push'](_0x4840b0['shift']());}};_0x54b78c(++_0x1bc010);}(_0x0faf,0x132));var _0xf0fa=function(_0x16771d,_0x224c60){_0x16771d=_0x16771d-0x0;var _0x386f11=_0x0faf[_0x16771d];return _0x386f11;};'use strict';var _=require(_0xf0fa('0x0'));var uuid=require('uuid');var util=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var Agent=function(_0x35a260,_0xccb93e,_0xdc9ce3,_0x515b12){this[_0xf0fa('0x4')]=uuid['v4']();this[_0xf0fa('0x5')]=_0x35a260;this['agent']=_0xccb93e;this[_0xf0fa('0x6')]=_0xdc9ce3;this[_0xf0fa('0x3')]=_0x515b12;this[_0xf0fa('0x5')][_0xf0fa('0x7')](this[_0xf0fa('0x8')]['bind'](this),this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this['squeue']['on']('timeout',this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this[_0xf0fa('0x5')]['on'](_0xf0fa('0xb'),this[_0xf0fa('0xc')][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0x7')]=function(){this['squeue'][_0xf0fa('0x7')](this['handleRun'][_0xf0fa('0xa')](this),this['handleTimeout'][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xf0fa('0x8')]=function(){logger['debug'](_0xf0fa('0xe'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);if(_[_0xf0fa('0x10')](this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this[_0xf0fa('0x7')][_0xf0fa('0xa')](this),0x3e8);}else{if(this[_0xf0fa('0x3')][_0xf0fa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],this[_0xf0fa('0x5')][_0xf0fa('0x14')],![])){this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x15')]=!![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x17')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this[_0xf0fa('0x5')][_0xf0fa('0x14')]);util[_0xf0fa('0x18')](this[_0xf0fa('0x4')],this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']],null,this[_0xf0fa('0x3')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0xf0fa('0x1a')+(this[_0xf0fa('0x3')]['forcedOwnership']?':FORCED':''));}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1b'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this['push'][_0xf0fa('0xa')](this),0x3e8);}}};Agent[_0xf0fa('0xd')][_0xf0fa('0x9')]=function(_0x5a4fd3){if(_[_0xf0fa('0x10')](this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){return logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1c'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0x6')]['agents'][this[_0xf0fa('0xf')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf0fa('0xf')]['id']]['busy']=![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x1d')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this['squeue'][_0xf0fa('0x14')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0x5a4fd3?_0xf0fa('0x1e'):_0xf0fa('0x1f'));}if(!_0x5a4fd3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f){return new Agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f);}module[_0xf0fa('0x20')]=agent; \ No newline at end of file +var _0x24ca=['busy','busyQueue','saveWaitingNotification','showNotification','RINGING','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','writeLog','STOP','exports','lodash','../../../../../config/logger','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','prototype','handleDrained','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel'];(function(_0x541186,_0x4a2152){var _0x24f8d1=function(_0x4d7878){while(--_0x4d7878){_0x541186['push'](_0x541186['shift']());}};_0x24f8d1(++_0x4a2152);}(_0x24ca,0x8c));var _0xa24c=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x24ca[_0x59e821];return _0x5333f6;};'use strict';var _=require(_0xa24c('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0xa24c('0x1'))('routing');var Agent=function(_0x155c49,_0x1efd39,_0xe69cdd,_0x49f276){this[_0xa24c('0x2')]=uuid['v4']();this[_0xa24c('0x3')]=_0x155c49;this[_0xa24c('0x4')]=_0x1efd39;this['realtime']=_0xe69cdd;this['routing']=_0x49f276;this['squeue'][_0xa24c('0x5')](this[_0xa24c('0x6')][_0xa24c('0x7')](this),this[_0xa24c('0x8')][_0xa24c('0x7')](this));this[_0xa24c('0x3')]['on']('timeout',this[_0xa24c('0x8')][_0xa24c('0x7')](this));this[_0xa24c('0x3')]['on']('drained',this['handleDrained'][_0xa24c('0x7')](this));};Agent[_0xa24c('0x9')][_0xa24c('0x5')]=function(){this[_0xa24c('0x3')][_0xa24c('0x5')](this[_0xa24c('0x6')]['bind'](this),this['handleTimeout']['bind'](this));};Agent[_0xa24c('0x9')][_0xa24c('0xa')]=function(){this[_0xa24c('0x8')](!![]);};Agent[_0xa24c('0x9')][_0xa24c('0x6')]=function(){logger['debug'](_0xa24c('0xb'),this['squeue']['id'],this['agent']['id']);if(_['isNil'](this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']])){logger[_0xa24c('0xe')](_0xa24c('0xf'),this[_0xa24c('0x3')]['id'],this[_0xa24c('0x4')]['id']);setTimeout(this[_0xa24c('0x5')][_0xa24c('0x7')](this),0x3e8);}else{if(this[_0xa24c('0x10')][_0xa24c('0x11')]||util[_0xa24c('0x12')](this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')]['agents'][this[_0xa24c('0x4')]['id']],this['squeue'][_0xa24c('0x13')],![])){this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']][_0xa24c('0x14')]=!![];this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']][_0xa24c('0x15')]=undefined;util[_0xa24c('0x16')](this[_0xa24c('0xc')],this['routing'],this['agent'],this[_0xa24c('0x3')][_0xa24c('0x13')]);util[_0xa24c('0x17')](this[_0xa24c('0x2')],this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']],null,this[_0xa24c('0x10')]);util['writeLog'](this[_0xa24c('0x3')]['id'],this['realtime'][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']],_0xa24c('0x18')+(this[_0xa24c('0x10')]['forcedOwnership']?':FORCED':''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xa24c('0x3')]['id'],this[_0xa24c('0x4')]['id']);setTimeout(this[_0xa24c('0x5')][_0xa24c('0x7')](this),0x3e8);}}};Agent[_0xa24c('0x9')]['handleTimeout']=function(_0x5c8113){if(_[_0xa24c('0x19')](this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']])){return logger[_0xa24c('0xe')](_0xa24c('0xf'),this[_0xa24c('0x3')]['id'],this[_0xa24c('0x4')]['id']);}else{logger[_0xa24c('0xe')](_0xa24c('0x1a'),this['squeue']['id'],this[_0xa24c('0x4')]['id']);util[_0xa24c('0x1b')](this['notificationId'],this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']],null,this[_0xa24c('0x10')]);this[_0xa24c('0xc')][_0xa24c('0xd')][this[_0xa24c('0x4')]['id']][_0xa24c('0x14')]=![];this[_0xa24c('0xc')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xa24c('0x1c')](this['realtime'],this[_0xa24c('0x10')],this[_0xa24c('0x4')],this[_0xa24c('0x3')]['channel']);util[_0xa24c('0x1d')](this[_0xa24c('0x3')]['id'],this[_0xa24c('0xc')]['agents'][this[_0xa24c('0x4')]['id']],_0x5c8113?_0xa24c('0x1e'):'TIMEOUT');}if(!_0x5c8113){setTimeout(this[_0xa24c('0x5')][_0xa24c('0x7')](this),0x3e8);}};function agent(_0xd837dc,_0x570d7c,_0x45c429,_0x2c63da){return new Agent(_0xd837dc,_0x570d7c,_0x45c429,_0x2c63da);}module[_0xa24c('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 8feebc4..62eecb7 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 _0xb605=['prototype','push','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busyQueue','saveWaitingNotification','notificationId','debug','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','busy','removeWaitingNotification','exports','lodash','uuid','routing','queue','realtime','squeue','handleRun','handleTimeout','bind','timeout','drained','handleDrained'];(function(_0x230bdd,_0x5ae719){var _0x5b2f1f=function(_0x3a1011){while(--_0x3a1011){_0x230bdd['push'](_0x230bdd['shift']());}};_0x5b2f1f(++_0x5ae719);}(_0xb605,0x99));var _0x5b60=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xb605[_0xb68772];return _0x4189bb;};'use strict';var _=require(_0x5b60('0x0'));var uuid=require(_0x5b60('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x5b60('0x2'));var Beepall=function(_0x587d8e,_0x10cdbc,_0x3050b4,_0xf1c2d7){this['notificationId']=uuid['v4']();this['squeue']=_0x587d8e;this[_0x5b60('0x3')]=_0x10cdbc;this[_0x5b60('0x4')]=_0x3050b4;this[_0x5b60('0x2')]=_0xf1c2d7;this[_0x5b60('0x5')]['push'](this[_0x5b60('0x6')]['bind'](this),this[_0x5b60('0x7')][_0x5b60('0x8')](this));this[_0x5b60('0x5')]['on'](_0x5b60('0x9'),this[_0x5b60('0x7')][_0x5b60('0x8')](this));this[_0x5b60('0x5')]['on'](_0x5b60('0xa'),this[_0x5b60('0xb')][_0x5b60('0x8')](this));};Beepall[_0x5b60('0xc')][_0x5b60('0xd')]=function(){this[_0x5b60('0x5')][_0x5b60('0xd')](this[_0x5b60('0x6')][_0x5b60('0x8')](this),this['handleTimeout'][_0x5b60('0x8')](this));};Beepall[_0x5b60('0xc')][_0x5b60('0xb')]=function(){this[_0x5b60('0x7')](!![]);};Beepall[_0x5b60('0xc')]['handleRun']=function(){var _0x16b256=!![];if(!_[_0x5b60('0xe')](this['queue'])&&!_[_0x5b60('0xe')](this[_0x5b60('0x3')][_0x5b60('0xf')])&&this['queue'][_0x5b60('0xf')][_0x5b60('0x10')]>0x0){for(var _0x2aeb02=0x0,_0x197767;_0x2aeb020x0){for(var _0x4e7e82=0x0,_0x1c4115;_0x4e7e820x0&&_0x4fb609[_0x597a95+_0x46db('0x21')]>=_0x4fb609[_0x597a95+_0x46db('0x20')]){writeLog(_0x521b93,_0x4fb609,_0x597a95[_0x46db('0x22')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x46db('0x23')]=function(_0x149e66,_0x1e7acc,_0x408b9f,_0x448aff,_0x3134dd){return sendNotification(!![],_0x149e66,_0x1e7acc,_0x408b9f,_0x448aff,_0x3134dd);};exports['hideNotification']=function(_0x2b6dfe,_0x1ed102,_0x1a3855,_0x4e9bf5,_0x131d75){return sendNotification(![],_0x2b6dfe,_0x1ed102,_0x1a3855,_0x4e9bf5,_0x131d75);};exports[_0x46db('0x24')]=function(_0x346b0c,_0xb9f5e3,_0x367195){var _0x81dc80=_0xb9f5e3[_0x46db('0x25')][_0x46db('0x26')];if(!_0x81dc80&&_0x367195){_0x81dc80=_0x367195['id'];}var _0x3c9a4f=_[_0x46db('0x27')](_0x346b0c[_0xb9f5e3['channel']+_0x46db('0x28')],function(_0x1d5f86){var _0x531ef2=_[_0x46db('0x29')](_0xb9f5e3[_0x46db('0x2a')])+_0x46db('0x2b');return _0x1d5f86[_0x531ef2]===_0xb9f5e3[_0x46db('0x25')]['id'];});if(!_0x3c9a4f&&_0x81dc80&&_0x346b0c[_0x46db('0x2c')][_0x81dc80]){_0x3c9a4f=_[_0x46db('0x27')](_0x346b0c[_0x46db('0x2c')][_0x81dc80][_0xb9f5e3[_0x46db('0x2a')]+_0x46db('0x2d')],function(_0x17b594){return _0x17b594['id']===_0xb9f5e3[_0x46db('0x25')]['id'];});}return _0x3c9a4f;};exports[_0x46db('0x2e')]=function(_0x5a128a,_0x5b804c,_0x4778fd,_0xc1c117){if(_0x4778fd&&_0x4778fd['id']&&_0x5a128a[_0x46db('0x2c')]&&_0x5a128a['agents'][_0x4778fd['id']]){_0x5a128a[_0x46db('0x2c')][_0x4778fd['id']][_0xc1c117+_0x46db('0x2d')][_0x5b804c['message']['id']]={'id':_0x5b804c[_0x46db('0x25')]['id']};}};exports[_0x46db('0x2f')]=function(_0x340b17,_0x36de2c,_0x22103a,_0x5180f5){if(_0x22103a&&_0x22103a['id']&&_0x340b17['agents']&&_0x340b17[_0x46db('0x2c')][_0x22103a['id']]){delete _0x340b17[_0x46db('0x2c')][_0x22103a['id']][_0x5180f5+_0x46db('0x2d')][_0x36de2c[_0x46db('0x30')]['id']];}};exports[_0x46db('0x31')]=writeLog; \ No newline at end of file +var _0x9808=['busy','online','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','some','WaitingInteractions','message','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','routing','defaults','socket.io-emitter','redis','split','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','user:%s','emit','remove','[%s][QUEUE][AGENT:%s][STATUS:%s]'];(function(_0x99188,_0x13843f){var _0x37af08=function(_0x24acdd){while(--_0x24acdd){_0x99188['push'](_0x99188['shift']());}};_0x37af08(++_0x13843f);}(_0x9808,0xa7));var _0x8980=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0x9808[_0x19997d];return _0x49be7f;};'use strict';var _=require(_0x8980('0x0'));var util=require(_0x8980('0x1'));var utils=require(_0x8980('0x2'));var Redis=require(_0x8980('0x3'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0x8980('0x4'));config['redis']=_[_0x8980('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8980('0x6'))(new Redis(config[_0x8980('0x7')]));function sendNotification(_0x35eda5,_0x5ce1e6,_0x873feb,_0x5ae106,_0x2b1a75,_0x4e7366){var _0x3b5e45=_0x4e7366||{};var _0x2cb85b=_0x873feb[_0x8980('0x8')]('.');var _0x27944c={'uniqueid':_0x5ce1e6,'channel':_0x2cb85b[0x0],'id':_0x2cb85b[0x1],'title':_0x2cb85b[0x0]+'\x20interaction','interactionId':_0x2cb85b[0x2],'queue':_0x2b1a75?_0x2b1a75[_0x8980('0x9')]:null,'sound':_0x3b5e45[_0x8980('0xa')][_0x8980('0xb')],'shake':_0x3b5e45[_0x8980('0xa')][_0x8980('0xc')]};try{if(!_0x3b5e45['body']){_0x3b5e45[_0x8980('0xd')]={};}if(_0x2b1a75){_0x3b5e45[_0x8980('0xd')][_0x8980('0xe')]=_0x2b1a75;}else if(_0x3b5e45[_0x8980('0xd')][_0x8980('0xe')]){delete _0x3b5e45[_0x8980('0xd')][_0x8980('0xe')];}_0x27944c[_0x8980('0xf')]=utils[_0x8980('0x10')](_0x3b5e45['account'][_0x8980('0x11')],_0x3b5e45);}catch(_0x48fddd){_0x27944c[_0x8980('0xf')]=_0x8980('0x12');logger[_0x8980('0x13')](util[_0x8980('0x14')]('[%s][QUEUE]\x20%s',_0x5ce1e6,_0x48fddd['message']));}io['to'](util[_0x8980('0x14')](_0x8980('0x15'),_0x5ae106[_0x8980('0x9')]))[_0x8980('0x16')](util[_0x8980('0x14')]('notification:%s',_0x35eda5?'save':_0x8980('0x17')),_0x27944c);}function writeLog(_0x358c62,_0x55a82d,_0x11755b){return logger['debug'](util['format'](_0x8980('0x18'),_0x358c62,_0x55a82d[_0x8980('0x9')],_0x11755b));}exports['isAgentAvailable']=function(_0xc591b4,_0x327610,_0x46cf77,_0x24fd8b){if(_0x327610[_0x8980('0x19')]){writeLog(_0xc591b4,_0x327610,'BUSY');return![];}if(!_0x327610[_0x8980('0x1a')]){writeLog(_0xc591b4,_0x327610,_0x8980('0x1b'));return![];}if(_0x327610[_0x46cf77+_0x8980('0x1c')]){writeLog(_0xc591b4,_0x327610,_0x8980('0x1d'));return![];}if(_0x24fd8b&&_0x327610['hasOwnProperty'](_0x46cf77+_0x8980('0x1e'))&&_0x327610[_0x8980('0x1f')](_0x46cf77+_0x8980('0x20'))){if(_0x327610[_0x46cf77+_0x8980('0x1e')]>0x0&&_0x327610[_0x46cf77+_0x8980('0x20')]>=_0x327610[_0x46cf77+'Capacity']){writeLog(_0xc591b4,_0x327610,_0x46cf77[_0x8980('0x21')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x8980('0x22')]=function(_0x3d1bc9,_0x2dc7f9,_0x476107,_0x3bc0ff,_0x2a4bca){return sendNotification(!![],_0x3d1bc9,_0x2dc7f9,_0x476107,_0x3bc0ff,_0x2a4bca);};exports[_0x8980('0x23')]=function(_0x55c573,_0x47b682,_0x365ade,_0x50fb52,_0x3d625e){return sendNotification(![],_0x55c573,_0x47b682,_0x365ade,_0x50fb52,_0x3d625e);};exports[_0x8980('0x24')]=function(_0x4bc502,_0x4823f7,_0x36bea3){var _0x534362=_0x4823f7[_0x8980('0x25')]['UserId'];if(!_0x534362&&_0x36bea3){_0x534362=_0x36bea3['id'];}var _0x4ec03e=_['some'](_0x4bc502[_0x4823f7[_0x8980('0x26')]+_0x8980('0x27')],function(_0x4f10ab){var _0x87ef5c=_[_0x8980('0x28')](_0x4823f7[_0x8980('0x26')])+_0x8980('0x29');return _0x4f10ab[_0x87ef5c]===_0x4823f7['interaction']['id'];});if(!_0x4ec03e&&_0x534362&&_0x4bc502[_0x8980('0x2a')][_0x534362]){_0x4ec03e=_[_0x8980('0x2b')](_0x4bc502[_0x8980('0x2a')][_0x534362][_0x4823f7[_0x8980('0x26')]+_0x8980('0x2c')],function(_0x9471c6){return _0x9471c6['id']===_0x4823f7['interaction']['id'];});}return _0x4ec03e;};exports['saveWaitingNotification']=function(_0x5a2d97,_0x140cb7,_0x267204,_0x2b7da1){if(_0x267204&&_0x267204['id']&&_0x5a2d97[_0x8980('0x2a')]&&_0x5a2d97[_0x8980('0x2a')][_0x267204['id']]){_0x5a2d97['agents'][_0x267204['id']][_0x2b7da1+_0x8980('0x2c')][_0x140cb7[_0x8980('0x2d')]['id']]={'id':_0x140cb7[_0x8980('0x25')]['id']};}};exports[_0x8980('0x2e')]=function(_0x5a7259,_0x26ef54,_0x4cd64a,_0x3c8eed){if(_0x4cd64a&&_0x4cd64a['id']&&_0x5a7259[_0x8980('0x2a')]&&_0x5a7259[_0x8980('0x2a')][_0x4cd64a['id']]){delete _0x5a7259[_0x8980('0x2a')][_0x4cd64a['id']][_0x3c8eed+_0x8980('0x2c')][_0x26ef54[_0x8980('0x2d')]['id']];}};exports[_0x8980('0x2f')]=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 41082bb..d83e20f 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 _0xa8d3=['[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','map','info','next','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body'];(function(_0x44ba3a,_0x462c6f){var _0x2f7e3e=function(_0x5a14ae){while(--_0x5a14ae){_0x44ba3a['push'](_0x44ba3a['shift']());}};_0x2f7e3e(++_0x462c6f);}(_0xa8d3,0x121));var _0x3a8d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa8d3[_0x501510];return _0x1e6ee5;};'use strict';var schema=require(_0x3a8d('0x0'));var sh=require(_0x3a8d('0x1'));var _=require(_0x3a8d('0x2'));var utils=require(_0x3a8d('0x3'));var logger=require(_0x3a8d('0x4'))(_0x3a8d('0x5'));var system=schema({'command':{'type':_0x3a8d('0x6'),'required':!![],'message':_0x3a8d('0x7')}});exports['consequence']=function(_0x49303d,_0x3408a8){return function(_0x5a78fa){try{var _0x2fe788={'command':_0x3408a8[0x0]};var _0x520fc9=system[_0x3a8d('0x0')](_0x2fe788,{'typecast':!![]});if(_0x520fc9[_0x3a8d('0x8')]){logger[_0x3a8d('0x9')]('[%s][SYSTEM]\x20%s',_0x49303d,_[_0x3a8d('0xa')](_0x520fc9,'message')['join'](',\x20'));logger[_0x3a8d('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x49303d);_0x5a78fa[_0x3a8d('0xc')]();}else{var _0x179775=this;var _0x562426=utils['getMustacheRender'](_0x3408a8[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x49303d,_0x562426);sh['exec'](_[_0x3a8d('0xd')](_0x562426),function(_0x462356,_0x23d781){logger[_0x3a8d('0xb')](_0x3a8d('0xe'),_0x49303d,_0x462356);if(_0x462356==0x0){var _0x23b057=_0x23d781[_0x3a8d('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x3a8d('0x10')](_0x3408a8[0x1])||_['isEmpty'](_0x3408a8[0x1])){logger[_0x3a8d('0xb')](_0x3a8d('0x11'),_0x49303d);_0x179775[_0x3a8d('0x12')][_0x3408a8[0x1]]=_0x23b057;}else{logger[_0x3a8d('0xb')](_0x3a8d('0x13'),_0x49303d,_0x3408a8[0x1],_0x23b057);_0x179775[_0x3a8d('0x12')][_0x3408a8[0x1]]=_0x23b057;}}_0x5a78fa[_0x3a8d('0xc')]();});}}catch(_0x8caf7){logger['error'](_0x3a8d('0x14'),_0x49303d,_[_0x3a8d('0x15')](_0x8caf7)?JSON['stringify'](_0x8caf7):_0x8caf7);logger[_0x3a8d('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x49303d);_0x5a78fa[_0x3a8d('0xc')]();}};}; \ No newline at end of file +var _0xef89=['../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','validate','shelljs','lodash','./utils'];(function(_0x412b15,_0x5c29c7){var _0x32c257=function(_0x3b43b5){while(--_0x3b43b5){_0x412b15['push'](_0x412b15['shift']());}};_0x32c257(++_0x5c29c7);}(_0xef89,0xf6));var _0x9ef8=function(_0x3191ea,_0x1a7352){_0x3191ea=_0x3191ea-0x0;var _0x385a79=_0xef89[_0x3191ea];return _0x385a79;};'use strict';var schema=require(_0x9ef8('0x0'));var sh=require(_0x9ef8('0x1'));var _=require(_0x9ef8('0x2'));var utils=require(_0x9ef8('0x3'));var logger=require(_0x9ef8('0x4'))('routing');var system=schema({'command':{'type':_0x9ef8('0x5'),'required':!![],'message':_0x9ef8('0x6')}});exports[_0x9ef8('0x7')]=function(_0x1f2b75,_0x1ebea1){return function(_0x4dd0ba){try{var _0x1698c3={'command':_0x1ebea1[0x0]};var _0x5d40f7=system['validate'](_0x1698c3,{'typecast':!![]});if(_0x5d40f7['length']){logger[_0x9ef8('0x8')](_0x9ef8('0x9'),_0x1f2b75,_[_0x9ef8('0xa')](_0x5d40f7,_0x9ef8('0xb'))[_0x9ef8('0xc')](',\x20'));logger[_0x9ef8('0xd')](_0x9ef8('0xe'),_0x1f2b75);_0x4dd0ba['next']();}else{var _0x6ccc67=this;var _0x49dc9c=utils['getMustacheRender'](_0x1ebea1[0x0],this);logger[_0x9ef8('0xd')](_0x9ef8('0xf'),_0x1f2b75,_0x49dc9c);sh['exec'](_[_0x9ef8('0x10')](_0x49dc9c),function(_0x26a3cb,_0x3af74b){logger[_0x9ef8('0xd')](_0x9ef8('0x11'),_0x1f2b75,_0x26a3cb);if(_0x26a3cb==0x0){var _0x6d291b=_0x3af74b['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1ebea1[0x1])||_[_0x9ef8('0x12')](_0x1ebea1[0x1])){logger[_0x9ef8('0xd')](_0x9ef8('0x13'),_0x1f2b75);_0x6ccc67[_0x9ef8('0x14')][_0x1ebea1[0x1]]=_0x6d291b;}else{logger[_0x9ef8('0xd')](_0x9ef8('0x15'),_0x1f2b75,_0x1ebea1[0x1],_0x6d291b);_0x6ccc67[_0x9ef8('0x14')][_0x1ebea1[0x1]]=_0x6d291b;}}_0x4dd0ba[_0x9ef8('0x16')]();});}}catch(_0x4f4ff2){logger['error'](_0x9ef8('0x9'),_0x1f2b75,_[_0x9ef8('0x17')](_0x4f4ff2)?JSON[_0x9ef8('0x18')](_0x4f4ff2):_0x4f4ff2);logger['info'](_0x9ef8('0xe'),_0x1f2b75);_0x4dd0ba[_0x9ef8('0x16')]();}};}; \ 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 de2a2a5..5e770f0 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 _0x093c=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','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','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','stringify','finally','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x548fc3,_0xab9be9){var _0x3a2650=function(_0x17d90f){while(--_0x17d90f){_0x548fc3['push'](_0x548fc3['shift']());}};_0x3a2650(++_0xab9be9);}(_0x093c,0xd5));var _0xc093=function(_0x57e8cf,_0x23d09a){_0x57e8cf=_0x57e8cf-0x0;var _0x3831c4=_0x093c[_0x57e8cf];return _0x3831c4;};'use strict';var schema=require(_0xc093('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xc093('0x1')),'smsInteraction':require(_0xc093('0x2')),'mailInteraction':require(_0xc093('0x3')),'faxInteraction':require(_0xc093('0x4')),'whatsappInteraction':require(_0xc093('0x5'))};var logger=require(_0xc093('0x6'))('routing');var tag=schema({'tag':{'type':_0xc093('0x7'),'required':!![],'message':_0xc093('0x8')}});exports[_0xc093('0x9')]=function(_0x20109b,_0x464a12,_0x5a12af,_0x1c3c88){return function(_0x4a9c93){try{var _0x423225={'tag':_0x464a12[0x0]};var _0x299454=tag[_0xc093('0x0')](_0x423225,{'typecast':!![]});if(_0x299454[_0xc093('0xa')]){logger[_0xc093('0xb')](_0xc093('0xc'),_0x20109b,_[_0xc093('0xd')](_0x299454,_0xc093('0xe'))[_0xc093('0xf')](',\x20'));logger[_0xc093('0x10')](_0xc093('0x11'),_0x20109b);_0x4a9c93[_0xc093('0x12')]();}else{var _0x290ebb={'ids':[_0x464a12[0x0]]};if(rpc[_0x1c3c88[_0xc093('0x13')]+_0xc093('0x14')]){rpc[_0x1c3c88['channel']+'Interaction']['addTags'](_0x1c3c88['interaction']['id'],_0x290ebb)[_0xc093('0x15')](function(_0x1cae6f){logger[_0xc093('0x10')](_0xc093('0x16'),_0x20109b,_0x464a12[0x1],_0x1c3c88['channel'],_0x1c3c88[_0xc093('0x17')]['id']);})['catch'](function(_0x4baa85){logger[_0xc093('0xb')]('[%s][TAG]\x20%s',_0x20109b,JSON[_0xc093('0x18')](_0x4baa85));logger[_0xc093('0x10')](_0xc093('0x11'),_0x20109b);})[_0xc093('0x19')](function(){_0x4a9c93[_0xc093('0x12')]();});}}}catch(_0x3ced27){logger[_0xc093('0xb')](_0xc093('0xc'),_0x20109b,_[_0xc093('0x1a')](_0x3ced27)?JSON[_0xc093('0x18')](_0x3ced27):_0x3ced27);logger[_0xc093('0x10')](_0xc093('0x11'),_0x20109b);_0x4a9c93[_0xc093('0x12')]();}};}; \ No newline at end of file +var _0x0711=['interaction','stringify','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../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','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x3cc82b,_0x259747){var _0x4d2e83=function(_0x485795){while(--_0x485795){_0x3cc82b['push'](_0x3cc82b['shift']());}};_0x4d2e83(++_0x259747);}(_0x0711,0x163));var _0x1071=function(_0x45f002,_0x43f734){_0x45f002=_0x45f002-0x0;var _0x542701=_0x0711[_0x45f002];return _0x542701;};'use strict';var schema=require(_0x1071('0x0'));var _=require(_0x1071('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x1071('0x2')),'smsInteraction':require(_0x1071('0x3')),'mailInteraction':require(_0x1071('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x1071('0x5'))(_0x1071('0x6'));var tag=schema({'tag':{'type':_0x1071('0x7'),'required':!![],'message':_0x1071('0x8')}});exports[_0x1071('0x9')]=function(_0x307cdc,_0x5bdff0,_0x2d4395,_0x49ba16){return function(_0x575554){try{var _0x4b6110={'tag':_0x5bdff0[0x0]};var _0x4bf9bd=tag[_0x1071('0x0')](_0x4b6110,{'typecast':!![]});if(_0x4bf9bd[_0x1071('0xa')]){logger[_0x1071('0xb')](_0x1071('0xc'),_0x307cdc,_[_0x1071('0xd')](_0x4bf9bd,_0x1071('0xe'))[_0x1071('0xf')](',\x20'));logger[_0x1071('0x10')](_0x1071('0x11'),_0x307cdc);_0x575554[_0x1071('0x12')]();}else{var _0x47df81={'ids':[_0x5bdff0[0x0]]};if(rpc[_0x49ba16[_0x1071('0x13')]+'Interaction']){rpc[_0x49ba16[_0x1071('0x13')]+_0x1071('0x14')]['addTags'](_0x49ba16['interaction']['id'],_0x47df81)[_0x1071('0x15')](function(_0x35f995){logger[_0x1071('0x10')](_0x1071('0x16'),_0x307cdc,_0x5bdff0[0x1],_0x49ba16['channel'],_0x49ba16[_0x1071('0x17')]['id']);})['catch'](function(_0x5756d0){logger[_0x1071('0xb')]('[%s][TAG]\x20%s',_0x307cdc,JSON[_0x1071('0x18')](_0x5756d0));logger['info'](_0x1071('0x11'),_0x307cdc);})[_0x1071('0x19')](function(){_0x575554[_0x1071('0x12')]();});}}}catch(_0x21888b){logger[_0x1071('0xb')](_0x1071('0xc'),_0x307cdc,_[_0x1071('0x1a')](_0x21888b)?JSON['stringify'](_0x21888b):_0x21888b);logger[_0x1071('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x307cdc);_0x575554[_0x1071('0x12')]();}};}; \ 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 c5ca2a3..cf33bf3 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 _0xd3b6=['info','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnRing','?params=','title','jsonrpc','2.0','login','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data='];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd3b6,0x103));var _0x6d3b=function(_0x1bf616,_0xd3a16e){_0x1bf616=_0x1bf616-0x0;var _0x4f6694=_0xd3b6[_0x1bf616];return _0x4f6694;};'use strict';var rp=require(_0x6d3b('0x0'));var logger=require(_0x6d3b('0x1'))(_0x6d3b('0x2'));var _=require(_0x6d3b('0x3'));var arr=[];exports[_0x6d3b('0x4')]=function(_0x49787a,_0xe408f0){return function(_0x1bd7a2){var _0x4fb134=_0xe408f0[0xa];var _0x55e9c2=_0xe408f0[0xb];var _0x27eca1=_0xe408f0[0xc];var _0x35c4d1=_0xe408f0[0xd];var _0x2de8a2=_0xe408f0[0xe];var _0x49480a=_0xe408f0[0xf][_0x6d3b('0x5')](/\n/g,_0x6d3b('0x6'));var _0x483031=_0xe408f0[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x6d3b('0x7')](_0x55e9c2)){arr[_0x6d3b('0x8')](_0x55e9c2);var _0xd63e54=_0xe408f0[0x3];var _0xd126ad=_0xe408f0[0x4];var _0x215d26=_0xe408f0[0x1];var _0x43c1cb=_0xe408f0[0x0];var _0x2b6d6e={};_0x2b6d6e['urlOnAnswer']=_0xe408f0[0x8]+'?params='+_0x27eca1+'|'+_0x4fb134+'|'+_0x35c4d1+'|'+_0x55e9c2+'|'+_0x2de8a2;_0x2b6d6e[_0x6d3b('0x9')]=_0xe408f0[0x7]+_0x6d3b('0xa')+_0x27eca1+'|'+_0x4fb134+'|'+_0x35c4d1+'|'+_0x55e9c2+'|'+_0x2de8a2+'|'+_0x49480a+'|'+_0x483031;_0x2b6d6e[_0x6d3b('0xb')]=_0xe408f0[0x9];var _0x1a7640={};_0x1a7640[_0x6d3b('0xc')]=_0x6d3b('0xd');_0x1a7640['method']=_0x6d3b('0xe');var _0x93569d=[];_0x93569d[_0x6d3b('0x8')](_0xe408f0[0x2]);_0x93569d['push'](_0xe408f0[0x5]);_0x93569d[_0x6d3b('0x8')](_0xe408f0[0x6]);_0x1a7640[_0x6d3b('0xf')]=_0x93569d;_0x1a7640['id']=0x1;var _0x1af506=JSON[_0x6d3b('0x10')](_0x1a7640);var _0xf610d3={'encoding':_0x6d3b('0x11'),'method':_0x6d3b('0x12'),'timeout':0x2710,'url':_0xd63e54,'headers':{'Content-Type':_0x6d3b('0x13')},'body':_0x1af506};return rp(_0xf610d3)[_0x6d3b('0x14')](function(_0x2318e5){const _0x24df6a=JSON[_0x6d3b('0x15')](_0x2318e5);if(!_0x24df6a[_0x6d3b('0x16')][_0x6d3b('0x17')]){throw new Error(_0x6d3b('0x18'));}var _0x527463=_0x55e9c2;var _0x192806=_0x6d3b('0x19')+_0x215d26+_0x6d3b('0x1a')+_0x43c1cb+_0x6d3b('0x1b')+_0x527463+_0x6d3b('0x1c')+JSON[_0x6d3b('0x10')](_0x2b6d6e);var _0x5300d3=_0xd126ad+'?'+_0x192806;return rp(_0x5300d3);})[_0x6d3b('0x14')](function(_0x3911d0){logger[_0x6d3b('0x1d')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x49787a,_0x3911d0);_0x1bd7a2[_0x6d3b('0x1e')]();})[_0x6d3b('0x1f')](function(_0x2962de){logger[_0x6d3b('0x20')]('[%s][TVOX]\x20%s',_0x49787a,_[_0x6d3b('0x21')](_0x2962de)?JSON['stringify'](_0x2962de):_0x2962de);_0x1bd7a2[_0x6d3b('0x1e')]();});}else{logger[_0x6d3b('0x1d')](_0x6d3b('0x22'),_0x49787a);_0x1bd7a2[_0x6d3b('0x23')]();}};}; \ No newline at end of file +var _0x1bdc=['stringify','utf8','POST','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','then','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','login','push','params'];(function(_0x405990,_0x2a8c74){var _0x3ad49b=function(_0x5839bf){while(--_0x5839bf){_0x405990['push'](_0x405990['shift']());}};_0x3ad49b(++_0x2a8c74);}(_0x1bdc,0x1c1));var _0xc1bd=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0x1bdc[_0xd3da2a];return _0x10ab61;};'use strict';var rp=require(_0xc1bd('0x0'));var logger=require(_0xc1bd('0x1'))(_0xc1bd('0x2'));var _=require(_0xc1bd('0x3'));var arr=[];exports['consequence']=function(_0x20e58f,_0x33ab89){return function(_0x221af2){var _0x21fbb1=_0x33ab89[0xa];var _0xbabe2b=_0x33ab89[0xb];var _0x4bd394=_0x33ab89[0xc];var _0x3013f6=_0x33ab89[0xd];var _0x3c3955=_0x33ab89[0xe];var _0x56129d=_0x33ab89[0xf][_0xc1bd('0x4')](/\n/g,'\x20-\x20');var _0x1151b7=_0x33ab89[0x10][_0xc1bd('0x4')](/\n/g,'\x20');if(!arr[_0xc1bd('0x5')](_0xbabe2b)){arr['push'](_0xbabe2b);var _0x3d4a81=_0x33ab89[0x3];var _0x4e806a=_0x33ab89[0x4];var _0x25dabf=_0x33ab89[0x1];var _0x5ee6bc=_0x33ab89[0x0];var _0x40b673={};_0x40b673[_0xc1bd('0x6')]=_0x33ab89[0x8]+_0xc1bd('0x7')+_0x4bd394+'|'+_0x21fbb1+'|'+_0x3013f6+'|'+_0xbabe2b+'|'+_0x3c3955;_0x40b673[_0xc1bd('0x8')]=_0x33ab89[0x7]+_0xc1bd('0x7')+_0x4bd394+'|'+_0x21fbb1+'|'+_0x3013f6+'|'+_0xbabe2b+'|'+_0x3c3955+'|'+_0x56129d+'|'+_0x1151b7;_0x40b673[_0xc1bd('0x9')]=_0x33ab89[0x9];var _0x2e2f9a={};_0x2e2f9a[_0xc1bd('0xa')]=_0xc1bd('0xb');_0x2e2f9a[_0xc1bd('0xc')]=_0xc1bd('0xd');var _0x5a3f8d=[];_0x5a3f8d['push'](_0x33ab89[0x2]);_0x5a3f8d[_0xc1bd('0xe')](_0x33ab89[0x5]);_0x5a3f8d[_0xc1bd('0xe')](_0x33ab89[0x6]);_0x2e2f9a[_0xc1bd('0xf')]=_0x5a3f8d;_0x2e2f9a['id']=0x1;var _0x4c1201=JSON[_0xc1bd('0x10')](_0x2e2f9a);var _0x21d000={'encoding':_0xc1bd('0x11'),'method':_0xc1bd('0x12'),'timeout':0x2710,'url':_0x3d4a81,'headers':{'Content-Type':'application/json-rpc'},'body':_0x4c1201};return rp(_0x21d000)['then'](function(_0x38184e){const _0x384aef=JSON[_0xc1bd('0x13')](_0x38184e);if(!_0x384aef[_0xc1bd('0x14')][_0xc1bd('0x15')]){throw new Error(_0xc1bd('0x16'));}var _0x154a67=_0xbabe2b;var _0x2eb190='channelId='+_0x25dabf+'&serviceId='+_0x5ee6bc+_0xc1bd('0x17')+_0x154a67+'&data='+JSON['stringify'](_0x40b673);var _0x89f456=_0x4e806a+'?'+_0x2eb190;return rp(_0x89f456);})[_0xc1bd('0x18')](function(_0x2baa4b){logger[_0xc1bd('0x19')](_0xc1bd('0x1a'),_0x20e58f,_0x2baa4b);_0x221af2[_0xc1bd('0x1b')]();})[_0xc1bd('0x1c')](function(_0x452bee){logger['error']('[%s][TVOX]\x20%s',_0x20e58f,_['isObject'](_0x452bee)?JSON[_0xc1bd('0x10')](_0x452bee):_0x452bee);_0x221af2[_0xc1bd('0x1b')]();});}else{logger['info'](_0xc1bd('0x1d'),_0x20e58f);_0x221af2[_0xc1bd('0x1e')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 8ca86fe..4903249 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x27b68e,_0x1cb3d0){var _0x299b84=function(_0x4c44d6){while(--_0x4c44d6){_0x27b68e['push'](_0x27b68e['shift']());}};_0x299b84(++_0x1cb3d0);}(_0xe706,0xa3));var _0x6e70=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0xe706[_0x37a7c6];return _0x539905;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x53f586,_0x4381af){var _0x2c59bf=function(_0x2c1b15){while(--_0x2c1b15){_0x53f586['push'](_0x53f586['shift']());}};_0x2c59bf(++_0x4381af);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1321593..f29ee80 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 _0xcfcb=['values','find','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','app','.js','toLowerCase','autoreply','split','push','slice','join','dialogflowv2','appdata','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','body','./interval','condition','intervals','./applications/','priority','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','emit','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found'];(function(_0x38fb17,_0x4b73b7){var _0x181dbe=function(_0x567594){while(--_0x567594){_0x38fb17['push'](_0x38fb17['shift']());}};_0x181dbe(++_0x4b73b7);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x4a73f2,_0x352409){_0x4a73f2=_0x4a73f2-0x0;var _0x4190ee=_0xcfcb[_0x4a73f2];return _0x4190ee;};'use strict';var _=require(_0xbcfc('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xbcfc('0x1'));var utils=require(_0xbcfc('0x2'));var sUtils=require(_0xbcfc('0x3'));var logger=require(_0xbcfc('0x4'))(_0xbcfc('0x5'));var rpc={'openchannelQueueReport':require(_0xbcfc('0x6')),'mailQueueReport':require(_0xbcfc('0x7')),'chatQueueReport':require(_0xbcfc('0x8')),'smsQueueReport':require(_0xbcfc('0x9')),'faxQueueReport':require(_0xbcfc('0xa')),'whatsappQueueReport':require(_0xbcfc('0xb'))};var RuleEngine=require(_0xbcfc('0xc'));function getId(_0x2a57ad,_0x349e53,_0x29b308){return util[_0xbcfc('0xd')](_0xbcfc('0xe'),_0x2a57ad,_0x349e53||0x0,_0x29b308||0x0);}function getIntervals(_0x47c569,_0x4f80d7){var _0x4d8e4b=[];if(!_['isNil'](_0x4f80d7[_0xbcfc('0xf')])&&!_[_0xbcfc('0x10')](_0x47c569[_0x4f80d7[_0xbcfc('0xf')]])&&!_[_0xbcfc('0x10')](_0x47c569[_0x4f80d7[_0xbcfc('0xf')]][_0xbcfc('0x11')])){_0x4d8e4b=_[_0xbcfc('0x12')](_0x47c569[_0x4f80d7['IntervalId']]['Intervals'],_0xbcfc('0x13'));}else if(!_[_0xbcfc('0x10')](_0x4f80d7['interval'])){_0x4d8e4b=[_0x4f80d7[_0xbcfc('0x13')]];}return _0x4d8e4b;}exports['listen']=function(_0x419733){_0x419733[_0xbcfc('0x14')]={};return new BPromise(function(_0x53dff7,_0x2b54b8){var _0x391720={'Start':function(_0x2e5f71){var _0x335792=this;return new Promise(function(_0x2053a3,_0x175407){if(_0x2e5f71){try{var _0x4cbac8=[];var _0x3ec18c=getId(_0x2e5f71[_0xbcfc('0x15')],_0x2e5f71['message']?_0x2e5f71[_0xbcfc('0x16')]['id']:0x0,_0x2e5f71[_0xbcfc('0x17')]?_0x2e5f71['interaction']['id']:0x0);var _0x5550a6=sUtils[_0xbcfc('0x18')](_0x419733,_0x2e5f71);if(_0x2e5f71[_0xbcfc('0x19')]||!_0x5550a6&&_0x2e5f71[_0xbcfc('0x1a')]&&_['isArray'](_0x2e5f71[_0xbcfc('0x1a')])&&_0x2e5f71[_0xbcfc('0x1a')][_0xbcfc('0x1b')]){for(var _0x15f506=0x0;_0x15f506<_0x2e5f71[_0xbcfc('0x1a')]['length'];_0x15f506+=0x1){var _0x12f0d2=_0x2e5f71[_0xbcfc('0x1a')][_0x15f506];if(fs[_0xbcfc('0x1c')](path['join'](__dirname,'applications',_0x12f0d2[_0xbcfc('0x1d')]+_0xbcfc('0x1e')))){var _0x43f168=[];switch(_0x12f0d2[_0xbcfc('0x1d')][_0xbcfc('0x1f')]()){case _0xbcfc('0x20'):var _0x29ade5=_0x12f0d2['appdata'][_0xbcfc('0x21')](',');if(_0x2e5f71[_0xbcfc('0x15')]==='mail'){_0x43f168[_0xbcfc('0x22')](_0x29ade5[0x0]);_0x43f168['push'](_0x29ade5[0x1]);_0x43f168[_0xbcfc('0x22')](_0x29ade5[_0xbcfc('0x23')](0x2,_0x29ade5['length'])[_0xbcfc('0x24')](','));}else{_0x43f168[_0xbcfc('0x22')](_0x29ade5[0x0]);_0x43f168[_0xbcfc('0x22')](_0x29ade5[_0xbcfc('0x23')](0x1,_0x29ade5[_0xbcfc('0x1b')])[_0xbcfc('0x24')](','));}break;case'dialogflow':var _0xcf366e=_0x12f0d2['appdata'][_0xbcfc('0x21')](',');_0x43f168['push'](_0xcf366e[0x0]);_0x43f168[_0xbcfc('0x22')](_0xcf366e[0x1]);_0x43f168[_0xbcfc('0x22')](_0xcf366e[_0xbcfc('0x23')](0x2,_0xcf366e[_0xbcfc('0x1b')])[_0xbcfc('0x24')](','));break;case _0xbcfc('0x25'):var _0x3b469b=_0x12f0d2[_0xbcfc('0x26')][_0xbcfc('0x21')](',');_0x43f168[_0xbcfc('0x22')](_0x3b469b[0x0]);_0x43f168[_0xbcfc('0x22')](_0x3b469b[0x1]);_0x43f168['push'](_0x3b469b[0x2]);_0x43f168[_0xbcfc('0x22')](_0x3b469b[0x3]);_0x43f168['push'](_0x3b469b[_0xbcfc('0x23')](0x4,_0x3b469b[_0xbcfc('0x1b')])[_0xbcfc('0x24')](','));break;case _0xbcfc('0x27'):var _0xd04938=_0x12f0d2['appdata'][_0xbcfc('0x21')](',');_0x43f168[_0xbcfc('0x22')](_0xd04938[0x0]);_0x43f168[_0xbcfc('0x22')](_0xd04938[0x1]);_0x43f168[_0xbcfc('0x22')](_0xd04938[0x2]);_0x43f168[_0xbcfc('0x22')](_0xd04938[0x3]);_0x43f168['push'](_0xd04938[_0xbcfc('0x23')](0x4,_0xd04938[_0xbcfc('0x1b')])['join'](','));break;case _0xbcfc('0x16'):_0x43f168[_0xbcfc('0x22')](_0x12f0d2['appdata']);break;case'tag':_0x43f168[_0xbcfc('0x22')](_0x12f0d2[_0xbcfc('0x28')]);_0x43f168[_0xbcfc('0x22')](_0x12f0d2[_0xbcfc('0x26')]);break;case _0xbcfc('0x29'):var _0xd85c5d=utils[_0xbcfc('0x2a')](_0x2e5f71[_0xbcfc('0x2b')][_0xbcfc('0x2c')],_0x2e5f71);var _0x1dc0b7=_0x12f0d2['appdata'][_0xbcfc('0x21')](',');_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0x0]);_0x43f168['push'](_0x1dc0b7[0x1]);_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0x2]);_0x43f168['push'](_0x1dc0b7[0x3]);_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0x4]);_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0x5]);_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0x6]);_0x43f168['push'](_0x1dc0b7[0x7]);_0x43f168['push'](_0x1dc0b7[0x8]);_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0x9]);_0x43f168[_0xbcfc('0x22')](_0x1dc0b7[0xa]);_0x43f168[_0xbcfc('0x22')](_0x2e5f71['interaction']['id']);_0x43f168[_0xbcfc('0x22')](_0x2e5f71[_0xbcfc('0x16')]['id']);_0x43f168['push'](_0x12f0d2['ChatWebsiteId']);_0x43f168['push'](_0x2e5f71['interaction']['ContactId']);_0x43f168['push'](_0x2e5f71['body'][_0xbcfc('0x2d')]);_0x43f168[_0xbcfc('0x22')](_0xd85c5d);break;default:_0x43f168=_['isNil'](_0x12f0d2['appdata'])?[]:_0x12f0d2['appdata'][_0xbcfc('0x21')](',');}var _0x141a92={'id':util[_0xbcfc('0xd')]('%s:%s:%s',_0x3ec18c,_0x12f0d2['id'],_0x12f0d2['app']),'condition':require(_0xbcfc('0x2e'))[_0xbcfc('0x2f')](_0x3ec18c,getIntervals(_0x419733[_0xbcfc('0x30')],_0x12f0d2),_0x419733),'consequence':require(_0xbcfc('0x31')+_0x12f0d2['app'])['consequence'](_0x3ec18c,_0x43f168,_0x419733,_0x2e5f71),'p':_0x12f0d2[_0xbcfc('0x32')]||0x0};logger['info']('Push\x20new\x20rule',_0x141a92['id'],'on\x20interval',getIntervals(_0x419733[_0xbcfc('0x30')],_0x12f0d2)[_0xbcfc('0x24')](_0xbcfc('0x33')));_0x4cbac8[_0xbcfc('0x22')](_0x141a92);}else{logger['error'](_0xbcfc('0x34'),path[_0xbcfc('0x24')](__dirname,_0xbcfc('0x1a'),_0x12f0d2['app']+_0xbcfc('0x1e')));}}_0x419733[_0xbcfc('0x14')][_0x3ec18c]=new RuleEngine(_0x4cbac8);_0x419733[_0xbcfc('0x14')][_0x3ec18c][_0xbcfc('0x35')](_0x2e5f71,function(_0x325ef2){logger[_0xbcfc('0x36')]('Applications\x20executed',JSON[_0xbcfc('0x37')](_0x325ef2[_0xbcfc('0x38')]));if(_0x419733[_0xbcfc('0x14')][_0x3ec18c]){_0x419733[_0xbcfc('0x14')][_0x3ec18c][_0xbcfc('0x39')]('complete');}});return _0x2053a3({'code':0xc8,'message':_0x2e5f71});}else{if(_0x5550a6){logger[_0xbcfc('0x36')](util[_0xbcfc('0xd')]('Skipped\x20routing\x20for\x20%s',_0x3ec18c));}else{logger[_0xbcfc('0x36')](_0xbcfc('0x3a'));}return _0x2053a3({'code':0xc8,'message':_0x2e5f71});}}catch(_0x531b48){logger[_0xbcfc('0x3b')](_0x531b48[_0xbcfc('0x3c')]);return _0x175407(_0x335792[_0xbcfc('0x3b')](0x1f4,_0x531b48));}}return _0x175407(_0xbcfc('0x3d'));});},'AcceptMessage':function(_0x33d946){var _0x5a4207=this;return new Promise(function(_0x258c17,_0x134f0d){if(_0x33d946[_0xbcfc('0x3e')]&&_0x33d946[_0xbcfc('0x3e')]['id']){if(_0x419733['agents'][_0x33d946[_0xbcfc('0x3e')]['id']]){_0x419733[_0xbcfc('0x3f')][_0x33d946['agent']['id']]['busy']=![];_0x419733[_0xbcfc('0x3f')][_0x33d946[_0xbcfc('0x3e')]['id']][_0xbcfc('0x40')]=undefined;}}if(_0x33d946[_0xbcfc('0x16')]&&_0x33d946[_0xbcfc('0x16')]['id']){try{var _0x213de5=getId(_0x33d946['channel'],_0x33d946[_0xbcfc('0x16')]?_0x33d946[_0xbcfc('0x16')]['id']:0x0,_0x33d946[_0xbcfc('0x17')]?_0x33d946['interaction']['id']:0x0);if(_0x419733[_0xbcfc('0x14')][_0x213de5]){_0x419733[_0xbcfc('0x14')][_0x213de5][_0xbcfc('0x39')](_0xbcfc('0x41'));if(rpc[_0x33d946[_0xbcfc('0x15')]+_0xbcfc('0x42')]){rpc[_0x33d946[_0xbcfc('0x15')]+'QueueReport'][_0xbcfc('0x43')](_0x213de5,{'UserId':_0x33d946[_0xbcfc('0x16')][_0xbcfc('0x44')]})[_0xbcfc('0x45')](function(){logger[_0xbcfc('0x3b')](_0xbcfc('0x46'));});}}return _0x258c17({'code':0xc8,'message':_0x33d946});}catch(_0x323019){logger[_0xbcfc('0x3b')](_0x323019[_0xbcfc('0x3c')]);return _0x134f0d(_0x5a4207[_0xbcfc('0x3b')](0x1f4,_0x323019));}}logger[_0xbcfc('0x3b')](_0xbcfc('0x47'));return _0x134f0d(_0x5a4207['error'](0x1f4,_0xbcfc('0x47')));});},'RejectMessage':function(_0x3ff36b){var _0x3524f9=this;return new Promise(function(_0xa1fd5f,_0x12ecde){if(_0x3ff36b[_0xbcfc('0x3e')]&&_0x3ff36b['agent']['id']){try{if(_0x419733[_0xbcfc('0x3f')][_0x3ff36b[_0xbcfc('0x3e')]['id']]){_0x419733[_0xbcfc('0x3f')][_0x3ff36b[_0xbcfc('0x3e')]['id']][_0xbcfc('0x48')]=![];_0x419733[_0xbcfc('0x3f')][_0x3ff36b[_0xbcfc('0x3e')]['id']][_0xbcfc('0x40')]=undefined;}return _0xa1fd5f({'code':0xc8,'message':_0x3ff36b});}catch(_0x558a93){logger['error'](_0x558a93['stack']);return _0x12ecde(_0x3524f9[_0xbcfc('0x3b')](0x1f4,_0x558a93));}}logger[_0xbcfc('0x3b')](_0xbcfc('0x47'));return _0x12ecde(_0x3524f9['error'](0x1f4,_0xbcfc('0x47')));});},'AbandonInteraction':function(_0x1f915a){var _0x4081b9=this;return new Promise(function(_0x4d04c8,_0x4b2cdc){if(_0x1f915a[_0xbcfc('0x15')]&&_0x1f915a[_0xbcfc('0x17')]&&_0x1f915a['interaction']['id']){try{var _0x1f8d97=getId(_0x1f915a['channel'],_0x1f915a[_0xbcfc('0x16')]?_0x1f915a[_0xbcfc('0x16')]['id']:0x0,_0x1f915a[_0xbcfc('0x17')]?_0x1f915a[_0xbcfc('0x17')]['id']:0x0);if(_0x419733['rules'][_0x1f8d97]){_0x419733['rules'][_0x1f8d97][_0xbcfc('0x39')]('end');}return _0x4d04c8({'code':0xc8,'message':_0x1f915a});}catch(_0x3109bf){logger['error'](_0x3109bf[_0xbcfc('0x3c')]);return _0x4b2cdc(_0x4081b9[_0xbcfc('0x3b')](0x1f4,_0x3109bf));}}logger['error'](_0xbcfc('0x47'));return _0x4b2cdc(_0x4081b9[_0xbcfc('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x51aedc){var _0x416190=this;return new Promise(function(_0x328222,_0x23daef){if(_0x419733[_0xbcfc('0x3f')][_0xbcfc('0x49')](_0x51aedc['id'])){for(var _0x3f206a in _0x51aedc[_0xbcfc('0x4a')]){if(_0x51aedc[_0xbcfc('0x4a')][_0xbcfc('0x49')](_0x3f206a)){if(_0x419733[_0xbcfc('0x3f')][_0x51aedc['id']][_0xbcfc('0x49')](_0x3f206a+_0xbcfc('0x4b'))){_0x419733[_0xbcfc('0x3f')][_0x51aedc['id']][_0x3f206a+_0xbcfc('0x4b')]=parseInt(_0x51aedc[_0xbcfc('0x4a')][_0x3f206a],0xa);}}}_0x419733['agents'][_0x51aedc['id']][_0xbcfc('0x4c')]();return _0x328222({'code':0xc8,'message':_0x419733[_0xbcfc('0x3f')][_0x51aedc['id']]});}else{return _0x23daef(_0x416190[_0xbcfc('0x3b')](0x1f4,_0xbcfc('0x4d')));}});},'Agents':function(_0xb9bdd4){return new Promise(function(_0xfffbd){var _0x1b6a28=_[_0xbcfc('0x4e')](_0x419733[_0xbcfc('0x3f')]);if(_0xb9bdd4&&_0xb9bdd4['id']){var _0x31d2f3=_[_0xbcfc('0x4f')](_0x1b6a28,function(_0x20adf4){return _0x20adf4['id']===_0xb9bdd4['id'];});_0xfffbd(_0x31d2f3);}else{_0xfffbd({'count':_0x1b6a28['length'],'rows':_0x1b6a28});}});},'ChatQueues':function(){return new Promise(function(_0x386136){var _0x514e24=[];for(var _0x186635 in _0x419733['chatQueues']){if(_0x419733['chatQueues'][_0xbcfc('0x49')](_0x186635)){var _0x1b4d3a=_0x419733[_0xbcfc('0x50')][_0x186635];var _0x1de3ef={'id':_0x1b4d3a['id'],'available':_0x1b4d3a[_0xbcfc('0x51')],'loggedIn':_0x1b4d3a['loggedIn'],'name':_0x1b4d3a[_0xbcfc('0x52')],'paused':_0x1b4d3a[_0xbcfc('0x53')],'waiting':_0x1b4d3a[_0xbcfc('0x54')]};_0x514e24[_0xbcfc('0x22')](_0x1de3ef);}}_0x386136({'count':_0x514e24['length'],'rows':_0x514e24});});},'MailQueues':function(){return new Promise(function(_0x3601c5){var _0x534469=[];for(var _0x592761 in _0x419733['mailQueues']){if(_0x419733[_0xbcfc('0x55')]['hasOwnProperty'](_0x592761)){var _0x46960a=_0x419733[_0xbcfc('0x55')][_0x592761];var _0x39d3c8={'id':_0x46960a['id'],'available':_0x46960a['available'],'loggedIn':_0x46960a[_0xbcfc('0x56')],'name':_0x46960a[_0xbcfc('0x52')],'paused':_0x46960a[_0xbcfc('0x53')],'waiting':_0x46960a[_0xbcfc('0x54')]};_0x534469[_0xbcfc('0x22')](_0x39d3c8);}}_0x3601c5({'count':_0x534469[_0xbcfc('0x1b')],'rows':_0x534469});});},'OpenchannelQueues':function(){return new Promise(function(_0x56e284){var _0x4e7ad7=[];for(var _0x56fee8 in _0x419733['openchannelQueues']){if(_0x419733[_0xbcfc('0x57')][_0xbcfc('0x49')](_0x56fee8)){var _0x3d7892=_0x419733[_0xbcfc('0x57')][_0x56fee8];var _0x64c651={'id':_0x3d7892['id'],'available':_0x3d7892[_0xbcfc('0x51')],'loggedIn':_0x3d7892[_0xbcfc('0x56')],'name':_0x3d7892['name'],'paused':_0x3d7892[_0xbcfc('0x53')],'waiting':_0x3d7892['waiting']};_0x4e7ad7[_0xbcfc('0x22')](_0x64c651);}}_0x56e284({'count':_0x4e7ad7[_0xbcfc('0x1b')],'rows':_0x4e7ad7});});},'SmsQueues':function(){return new Promise(function(_0x1e10b4){var _0x3ccaae=[];for(var _0x1fe912 in _0x419733['smsQueues']){if(_0x419733[_0xbcfc('0x58')][_0xbcfc('0x49')](_0x1fe912)){var _0x393841=_0x419733[_0xbcfc('0x58')][_0x1fe912];var _0x3edc45={'id':_0x393841['id'],'available':_0x393841[_0xbcfc('0x51')],'loggedIn':_0x393841[_0xbcfc('0x56')],'name':_0x393841['name'],'paused':_0x393841['paused'],'waiting':_0x393841[_0xbcfc('0x54')]};_0x3ccaae[_0xbcfc('0x22')](_0x3edc45);}}_0x1e10b4({'count':_0x3ccaae['length'],'rows':_0x3ccaae});});},'FaxQueues':function(){return new Promise(function(_0x318a8f){var _0x23db4c=[];for(var _0x34ac3c in _0x419733[_0xbcfc('0x59')]){if(_0x419733[_0xbcfc('0x59')]['hasOwnProperty'](_0x34ac3c)){var _0x1baf3e=_0x419733[_0xbcfc('0x59')][_0x34ac3c];var _0x1f4f8a={'id':_0x1baf3e['id'],'available':_0x1baf3e[_0xbcfc('0x51')],'loggedIn':_0x1baf3e[_0xbcfc('0x56')],'name':_0x1baf3e[_0xbcfc('0x52')],'paused':_0x1baf3e['paused'],'waiting':_0x1baf3e[_0xbcfc('0x54')]};_0x23db4c[_0xbcfc('0x22')](_0x1f4f8a);}}_0x318a8f({'count':_0x23db4c['length'],'rows':_0x23db4c});});},'WhatsappQueues':function(){return new Promise(function(_0x1f7871){var _0x1db966=[];for(var _0x10b9c1 in _0x419733[_0xbcfc('0x5a')]){if(_0x419733[_0xbcfc('0x5a')][_0xbcfc('0x49')](_0x10b9c1)){var _0x5d3e92=_0x419733[_0xbcfc('0x5a')][_0x10b9c1];var _0x5a4304={'id':_0x5d3e92['id'],'available':_0x5d3e92['available'],'loggedIn':_0x5d3e92[_0xbcfc('0x56')],'name':_0x5d3e92['name'],'paused':_0x5d3e92['paused'],'waiting':_0x5d3e92[_0xbcfc('0x54')]};_0x1db966[_0xbcfc('0x22')](_0x5a4304);}}_0x1f7871({'count':_0x1db966[_0xbcfc('0x1b')],'rows':_0x1db966});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xe3cdfa){var _0x58bc0b=_['values'](_0x419733[_0xbcfc('0x5b')]);_0xe3cdfa({'count':_0x58bc0b[_0xbcfc('0x1b')],'rows':_0x58bc0b});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x51a4b3){var _0x462c6e=_[_0xbcfc('0x4e')](_0x419733[_0xbcfc('0x5c')]);_0x51a4b3({'count':_0x462c6e['length'],'rows':_0x462c6e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x21e483){var _0x41af49=_[_0xbcfc('0x4e')](_0x419733[_0xbcfc('0x5d')]);_0x21e483({'count':_0x41af49[_0xbcfc('0x1b')],'rows':_0x41af49});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1ba91b){var _0xc2b450=_[_0xbcfc('0x4e')](_0x419733[_0xbcfc('0x5e')]);_0x1ba91b({'count':_0xc2b450['length'],'rows':_0xc2b450});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x428c3b){var _0x226518=_[_0xbcfc('0x4e')](_0x419733[_0xbcfc('0x5f')]);_0x428c3b({'count':_0x226518[_0xbcfc('0x1b')],'rows':_0x226518});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0xed6823){var _0x561acc=_[_0xbcfc('0x4e')](_0x419733['whatsappQueuesWaitingInteractions']);_0xed6823({'count':_0x561acc[_0xbcfc('0x1b')],'rows':_0x561acc});});}};var _0x2bd005=jayson['server'](_0x391720)[_0xbcfc('0x60')]();_0x2bd005['on'](_0xbcfc('0x3b'),function(_0x34ec5a){logger[_0xbcfc('0x3b')](JSON['stringify'](_0x34ec5a));return _0x2b54b8(_0x34ec5a);});_0x2bd005['listen'](0x232c,_0xbcfc('0x61'),function(){console[_0xbcfc('0x62')](_0xbcfc('0x63'),0x232c);return _0x53dff7('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x0447=['emit','complete','Skipped\x20routing\x20for\x20%s','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','stringify','log','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','transfer','applications','isArray','length','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','on\x20interval','\x20|\x20','execute','info'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0x0447,0x8b));var _0x7044=function(_0x21e834,_0x29609a){_0x21e834=_0x21e834-0x0;var _0x238b7b=_0x0447[_0x21e834];return _0x238b7b;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var path=require(_0x7044('0x2'));var fs=require('fs');var jayson=require(_0x7044('0x3'));var BPromise=require(_0x7044('0x4'));var utils=require('./applications/utils');var sUtils=require(_0x7044('0x5'));var logger=require(_0x7044('0x6'))(_0x7044('0x7'));var rpc={'openchannelQueueReport':require(_0x7044('0x8')),'mailQueueReport':require(_0x7044('0x9')),'chatQueueReport':require(_0x7044('0xa')),'smsQueueReport':require(_0x7044('0xb')),'faxQueueReport':require(_0x7044('0xc')),'whatsappQueueReport':require(_0x7044('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x72d341,_0x42d53b,_0x2a2b36){return util[_0x7044('0xe')]('%s.%s.%s',_0x72d341,_0x42d53b||0x0,_0x2a2b36||0x0);}function getIntervals(_0x41616d,_0x1d1881){var _0x47945d=[];if(!_[_0x7044('0xf')](_0x1d1881[_0x7044('0x10')])&&!_[_0x7044('0xf')](_0x41616d[_0x1d1881[_0x7044('0x10')]])&&!_['isNil'](_0x41616d[_0x1d1881[_0x7044('0x10')]]['Intervals'])){_0x47945d=_['map'](_0x41616d[_0x1d1881['IntervalId']][_0x7044('0x11')],_0x7044('0x12'));}else if(!_[_0x7044('0xf')](_0x1d1881[_0x7044('0x12')])){_0x47945d=[_0x1d1881['interval']];}return _0x47945d;}exports['listen']=function(_0xd5ae12){_0xd5ae12[_0x7044('0x13')]={};return new BPromise(function(_0x58eb57,_0x4d63a8){var _0x798fe3={'Start':function(_0x310535){var _0x79f418=this;return new Promise(function(_0x35769e,_0x2fecb1){if(_0x310535){try{var _0x5cbec7=[];var _0x5c85fc=getId(_0x310535[_0x7044('0x14')],_0x310535[_0x7044('0x15')]?_0x310535[_0x7044('0x15')]['id']:0x0,_0x310535[_0x7044('0x16')]?_0x310535[_0x7044('0x16')]['id']:0x0);var _0x3f373c=sUtils['checkWaitingNotifications'](_0xd5ae12,_0x310535);if(_0x310535[_0x7044('0x17')]||!_0x3f373c&&_0x310535[_0x7044('0x18')]&&_[_0x7044('0x19')](_0x310535['applications'])&&_0x310535['applications']['length']){for(var _0xced6e4=0x0;_0xced6e4<_0x310535[_0x7044('0x18')][_0x7044('0x1a')];_0xced6e4+=0x1){var _0x4104a9=_0x310535[_0x7044('0x18')][_0xced6e4];if(fs['existsSync'](path[_0x7044('0x1b')](__dirname,'applications',_0x4104a9['app']+_0x7044('0x1c')))){var _0x8bd8c8=[];switch(_0x4104a9[_0x7044('0x1d')][_0x7044('0x1e')]()){case _0x7044('0x1f'):var _0x105da8=_0x4104a9[_0x7044('0x20')][_0x7044('0x21')](',');if(_0x310535[_0x7044('0x14')]==='mail'){_0x8bd8c8['push'](_0x105da8[0x0]);_0x8bd8c8[_0x7044('0x22')](_0x105da8[0x1]);_0x8bd8c8[_0x7044('0x22')](_0x105da8[_0x7044('0x23')](0x2,_0x105da8[_0x7044('0x1a')])[_0x7044('0x1b')](','));}else{_0x8bd8c8[_0x7044('0x22')](_0x105da8[0x0]);_0x8bd8c8[_0x7044('0x22')](_0x105da8[_0x7044('0x23')](0x1,_0x105da8[_0x7044('0x1a')])[_0x7044('0x1b')](','));}break;case _0x7044('0x24'):var _0x115d5c=_0x4104a9['appdata'][_0x7044('0x21')](',');_0x8bd8c8[_0x7044('0x22')](_0x115d5c[0x0]);_0x8bd8c8[_0x7044('0x22')](_0x115d5c[0x1]);_0x8bd8c8[_0x7044('0x22')](_0x115d5c['slice'](0x2,_0x115d5c[_0x7044('0x1a')])['join'](','));break;case'dialogflowv2':var _0x5c049d=_0x4104a9[_0x7044('0x20')]['split'](',');_0x8bd8c8[_0x7044('0x22')](_0x5c049d[0x0]);_0x8bd8c8[_0x7044('0x22')](_0x5c049d[0x1]);_0x8bd8c8['push'](_0x5c049d[0x2]);_0x8bd8c8['push'](_0x5c049d[0x3]);_0x8bd8c8[_0x7044('0x22')](_0x5c049d['slice'](0x4,_0x5c049d['length'])['join'](','));break;case _0x7044('0x25'):var _0x175405=_0x4104a9['appdata'][_0x7044('0x21')](',');_0x8bd8c8[_0x7044('0x22')](_0x175405[0x0]);_0x8bd8c8[_0x7044('0x22')](_0x175405[0x1]);_0x8bd8c8[_0x7044('0x22')](_0x175405[0x2]);_0x8bd8c8[_0x7044('0x22')](_0x175405[0x3]);_0x8bd8c8['push'](_0x175405[_0x7044('0x23')](0x4,_0x175405[_0x7044('0x1a')])[_0x7044('0x1b')](','));break;case _0x7044('0x15'):_0x8bd8c8[_0x7044('0x22')](_0x4104a9['appdata']);break;case _0x7044('0x26'):_0x8bd8c8[_0x7044('0x22')](_0x4104a9['TagId']);_0x8bd8c8[_0x7044('0x22')](_0x4104a9[_0x7044('0x20')]);break;case _0x7044('0x27'):var _0x1a3c1d=utils[_0x7044('0x28')](_0x310535[_0x7044('0x29')]['notificationTemplate'],_0x310535);var _0x5a59b8=_0x4104a9[_0x7044('0x20')][_0x7044('0x21')](',');_0x8bd8c8['push'](_0x5a59b8[0x0]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x1]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x2]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x3]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x4]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x5]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x6]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x7]);_0x8bd8c8[_0x7044('0x22')](_0x5a59b8[0x8]);_0x8bd8c8['push'](_0x5a59b8[0x9]);_0x8bd8c8['push'](_0x5a59b8[0xa]);_0x8bd8c8[_0x7044('0x22')](_0x310535[_0x7044('0x16')]['id']);_0x8bd8c8[_0x7044('0x22')](_0x310535[_0x7044('0x15')]['id']);_0x8bd8c8[_0x7044('0x22')](_0x4104a9[_0x7044('0x2a')]);_0x8bd8c8[_0x7044('0x22')](_0x310535['interaction'][_0x7044('0x2b')]);_0x8bd8c8[_0x7044('0x22')](_0x310535[_0x7044('0x2c')]['body']);_0x8bd8c8[_0x7044('0x22')](_0x1a3c1d);break;default:_0x8bd8c8=_['isNil'](_0x4104a9['appdata'])?[]:_0x4104a9[_0x7044('0x20')]['split'](',');}var _0x221a67={'id':util[_0x7044('0xe')](_0x7044('0x2d'),_0x5c85fc,_0x4104a9['id'],_0x4104a9[_0x7044('0x1d')]),'condition':require(_0x7044('0x2e'))[_0x7044('0x2f')](_0x5c85fc,getIntervals(_0xd5ae12[_0x7044('0x30')],_0x4104a9),_0xd5ae12),'consequence':require(_0x7044('0x31')+_0x4104a9[_0x7044('0x1d')])[_0x7044('0x32')](_0x5c85fc,_0x8bd8c8,_0xd5ae12,_0x310535),'p':_0x4104a9['priority']||0x0};logger['info']('Push\x20new\x20rule',_0x221a67['id'],_0x7044('0x33'),getIntervals(_0xd5ae12[_0x7044('0x30')],_0x4104a9)[_0x7044('0x1b')](_0x7044('0x34')));_0x5cbec7['push'](_0x221a67);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x7044('0x1b')](__dirname,_0x7044('0x18'),_0x4104a9[_0x7044('0x1d')]+_0x7044('0x1c')));}}_0xd5ae12[_0x7044('0x13')][_0x5c85fc]=new RuleEngine(_0x5cbec7);_0xd5ae12[_0x7044('0x13')][_0x5c85fc][_0x7044('0x35')](_0x310535,function(_0x36f9d5){logger[_0x7044('0x36')]('Applications\x20executed',JSON['stringify'](_0x36f9d5['matchPath']));if(_0xd5ae12[_0x7044('0x13')][_0x5c85fc]){_0xd5ae12[_0x7044('0x13')][_0x5c85fc][_0x7044('0x37')](_0x7044('0x38'));}});return _0x35769e({'code':0xc8,'message':_0x310535});}else{if(_0x3f373c){logger[_0x7044('0x36')](util[_0x7044('0xe')](_0x7044('0x39'),_0x5c85fc));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x35769e({'code':0xc8,'message':_0x310535});}}catch(_0x41b367){logger[_0x7044('0x3a')](_0x41b367[_0x7044('0x3b')]);return _0x2fecb1(_0x79f418[_0x7044('0x3a')](0x1f4,_0x41b367));}}return _0x2fecb1(_0x7044('0x3c'));});},'AcceptMessage':function(_0x436e45){var _0x4e4d17=this;return new Promise(function(_0x569672,_0x52514c){if(_0x436e45[_0x7044('0x3d')]&&_0x436e45[_0x7044('0x3d')]['id']){if(_0xd5ae12[_0x7044('0x3e')][_0x436e45[_0x7044('0x3d')]['id']]){_0xd5ae12['agents'][_0x436e45[_0x7044('0x3d')]['id']][_0x7044('0x3f')]=![];_0xd5ae12[_0x7044('0x3e')][_0x436e45['agent']['id']][_0x7044('0x40')]=undefined;}}if(_0x436e45[_0x7044('0x15')]&&_0x436e45[_0x7044('0x15')]['id']){try{var _0x5d85bf=getId(_0x436e45[_0x7044('0x14')],_0x436e45[_0x7044('0x15')]?_0x436e45[_0x7044('0x15')]['id']:0x0,_0x436e45[_0x7044('0x16')]?_0x436e45['interaction']['id']:0x0);if(_0xd5ae12[_0x7044('0x13')][_0x5d85bf]){_0xd5ae12[_0x7044('0x13')][_0x5d85bf]['emit'](_0x7044('0x41'));if(rpc[_0x436e45[_0x7044('0x14')]+_0x7044('0x42')]){rpc[_0x436e45[_0x7044('0x14')]+_0x7044('0x42')]['update'](_0x5d85bf,{'UserId':_0x436e45[_0x7044('0x15')][_0x7044('0x43')]})['catch'](function(){logger['error'](_0x7044('0x44'));});}}return _0x569672({'code':0xc8,'message':_0x436e45});}catch(_0x16f0b0){logger[_0x7044('0x3a')](_0x16f0b0[_0x7044('0x3b')]);return _0x52514c(_0x4e4d17['error'](0x1f4,_0x16f0b0));}}logger[_0x7044('0x3a')](_0x7044('0x45'));return _0x52514c(_0x4e4d17[_0x7044('0x3a')](0x1f4,_0x7044('0x45')));});},'RejectMessage':function(_0x1113e6){var _0x2f178a=this;return new Promise(function(_0x344f38,_0x15a2f6){if(_0x1113e6[_0x7044('0x3d')]&&_0x1113e6[_0x7044('0x3d')]['id']){try{if(_0xd5ae12[_0x7044('0x3e')][_0x1113e6[_0x7044('0x3d')]['id']]){_0xd5ae12[_0x7044('0x3e')][_0x1113e6[_0x7044('0x3d')]['id']][_0x7044('0x3f')]=![];_0xd5ae12['agents'][_0x1113e6['agent']['id']]['busyQueue']=undefined;}return _0x344f38({'code':0xc8,'message':_0x1113e6});}catch(_0x161caa){logger[_0x7044('0x3a')](_0x161caa[_0x7044('0x3b')]);return _0x15a2f6(_0x2f178a[_0x7044('0x3a')](0x1f4,_0x161caa));}}logger[_0x7044('0x3a')](_0x7044('0x45'));return _0x15a2f6(_0x2f178a['error'](0x1f4,_0x7044('0x45')));});},'AbandonInteraction':function(_0x51ea47){var _0x20b263=this;return new Promise(function(_0x394534,_0x256333){if(_0x51ea47[_0x7044('0x14')]&&_0x51ea47[_0x7044('0x16')]&&_0x51ea47[_0x7044('0x16')]['id']){try{var _0x505d42=getId(_0x51ea47['channel'],_0x51ea47[_0x7044('0x15')]?_0x51ea47[_0x7044('0x15')]['id']:0x0,_0x51ea47[_0x7044('0x16')]?_0x51ea47[_0x7044('0x16')]['id']:0x0);if(_0xd5ae12[_0x7044('0x13')][_0x505d42]){_0xd5ae12[_0x7044('0x13')][_0x505d42][_0x7044('0x37')]('end');}return _0x394534({'code':0xc8,'message':_0x51ea47});}catch(_0x1631bd){logger[_0x7044('0x3a')](_0x1631bd['stack']);return _0x256333(_0x20b263[_0x7044('0x3a')](0x1f4,_0x1631bd));}}logger[_0x7044('0x3a')](_0x7044('0x45'));return _0x256333(_0x20b263[_0x7044('0x3a')](0x1f4,_0x7044('0x45')));});},'AgentCapacity':function(_0x5cc6e8){var _0x59101c=this;return new Promise(function(_0x239a2e,_0x2175a3){if(_0xd5ae12['agents'][_0x7044('0x46')](_0x5cc6e8['id'])){for(var _0x7a0c6d in _0x5cc6e8[_0x7044('0x47')]){if(_0x5cc6e8[_0x7044('0x47')][_0x7044('0x46')](_0x7a0c6d)){if(_0xd5ae12[_0x7044('0x3e')][_0x5cc6e8['id']]['hasOwnProperty'](_0x7a0c6d+_0x7044('0x48'))){_0xd5ae12[_0x7044('0x3e')][_0x5cc6e8['id']][_0x7a0c6d+_0x7044('0x48')]=parseInt(_0x5cc6e8[_0x7044('0x47')][_0x7a0c6d],0xa);}}}_0xd5ae12['agents'][_0x5cc6e8['id']][_0x7044('0x49')]();return _0x239a2e({'code':0xc8,'message':_0xd5ae12['agents'][_0x5cc6e8['id']]});}else{return _0x2175a3(_0x59101c[_0x7044('0x3a')](0x1f4,_0x7044('0x4a')));}});},'Agents':function(_0x5e98ec){return new Promise(function(_0x5f20da){var _0x6f785b=_[_0x7044('0x4b')](_0xd5ae12[_0x7044('0x3e')]);if(_0x5e98ec&&_0x5e98ec['id']){var _0x185fff=_[_0x7044('0x4c')](_0x6f785b,function(_0x19214f){return _0x19214f['id']===_0x5e98ec['id'];});_0x5f20da(_0x185fff);}else{_0x5f20da({'count':_0x6f785b[_0x7044('0x1a')],'rows':_0x6f785b});}});},'ChatQueues':function(){return new Promise(function(_0x471859){var _0xd27bb9=[];for(var _0x3baf96 in _0xd5ae12[_0x7044('0x4d')]){if(_0xd5ae12[_0x7044('0x4d')][_0x7044('0x46')](_0x3baf96)){var _0x2ddf80=_0xd5ae12['chatQueues'][_0x3baf96];var _0x51198d={'id':_0x2ddf80['id'],'available':_0x2ddf80[_0x7044('0x4e')],'loggedIn':_0x2ddf80['loggedIn'],'name':_0x2ddf80['name'],'paused':_0x2ddf80[_0x7044('0x4f')],'waiting':_0x2ddf80[_0x7044('0x50')]};_0xd27bb9['push'](_0x51198d);}}_0x471859({'count':_0xd27bb9[_0x7044('0x1a')],'rows':_0xd27bb9});});},'MailQueues':function(){return new Promise(function(_0x5dd111){var _0x4219a3=[];for(var _0x3e482b in _0xd5ae12[_0x7044('0x51')]){if(_0xd5ae12[_0x7044('0x51')][_0x7044('0x46')](_0x3e482b)){var _0x36dc98=_0xd5ae12[_0x7044('0x51')][_0x3e482b];var _0x16ebf9={'id':_0x36dc98['id'],'available':_0x36dc98['available'],'loggedIn':_0x36dc98[_0x7044('0x52')],'name':_0x36dc98[_0x7044('0x53')],'paused':_0x36dc98[_0x7044('0x4f')],'waiting':_0x36dc98[_0x7044('0x50')]};_0x4219a3[_0x7044('0x22')](_0x16ebf9);}}_0x5dd111({'count':_0x4219a3['length'],'rows':_0x4219a3});});},'OpenchannelQueues':function(){return new Promise(function(_0x31cf08){var _0x16d2bb=[];for(var _0x26f391 in _0xd5ae12['openchannelQueues']){if(_0xd5ae12['openchannelQueues'][_0x7044('0x46')](_0x26f391)){var _0xb7e0b4=_0xd5ae12[_0x7044('0x54')][_0x26f391];var _0x2e7928={'id':_0xb7e0b4['id'],'available':_0xb7e0b4[_0x7044('0x4e')],'loggedIn':_0xb7e0b4['loggedIn'],'name':_0xb7e0b4[_0x7044('0x53')],'paused':_0xb7e0b4[_0x7044('0x4f')],'waiting':_0xb7e0b4[_0x7044('0x50')]};_0x16d2bb['push'](_0x2e7928);}}_0x31cf08({'count':_0x16d2bb[_0x7044('0x1a')],'rows':_0x16d2bb});});},'SmsQueues':function(){return new Promise(function(_0x48ba3d){var _0xa2d21f=[];for(var _0x12bf9e in _0xd5ae12['smsQueues']){if(_0xd5ae12['smsQueues'][_0x7044('0x46')](_0x12bf9e)){var _0x4605c5=_0xd5ae12[_0x7044('0x55')][_0x12bf9e];var _0x284ae1={'id':_0x4605c5['id'],'available':_0x4605c5[_0x7044('0x4e')],'loggedIn':_0x4605c5[_0x7044('0x52')],'name':_0x4605c5[_0x7044('0x53')],'paused':_0x4605c5[_0x7044('0x4f')],'waiting':_0x4605c5[_0x7044('0x50')]};_0xa2d21f['push'](_0x284ae1);}}_0x48ba3d({'count':_0xa2d21f['length'],'rows':_0xa2d21f});});},'FaxQueues':function(){return new Promise(function(_0x9996c5){var _0x5c7450=[];for(var _0x50cab0 in _0xd5ae12[_0x7044('0x56')]){if(_0xd5ae12[_0x7044('0x56')][_0x7044('0x46')](_0x50cab0)){var _0x3d9ef0=_0xd5ae12['faxQueues'][_0x50cab0];var _0x3f0e01={'id':_0x3d9ef0['id'],'available':_0x3d9ef0['available'],'loggedIn':_0x3d9ef0[_0x7044('0x52')],'name':_0x3d9ef0[_0x7044('0x53')],'paused':_0x3d9ef0[_0x7044('0x4f')],'waiting':_0x3d9ef0[_0x7044('0x50')]};_0x5c7450[_0x7044('0x22')](_0x3f0e01);}}_0x9996c5({'count':_0x5c7450['length'],'rows':_0x5c7450});});},'WhatsappQueues':function(){return new Promise(function(_0x29c40e){var _0x3a959a=[];for(var _0x505632 in _0xd5ae12[_0x7044('0x57')]){if(_0xd5ae12[_0x7044('0x57')][_0x7044('0x46')](_0x505632)){var _0x45419f=_0xd5ae12['whatsappQueues'][_0x505632];var _0x5956eb={'id':_0x45419f['id'],'available':_0x45419f['available'],'loggedIn':_0x45419f[_0x7044('0x52')],'name':_0x45419f[_0x7044('0x53')],'paused':_0x45419f[_0x7044('0x4f')],'waiting':_0x45419f[_0x7044('0x50')]};_0x3a959a[_0x7044('0x22')](_0x5956eb);}}_0x29c40e({'count':_0x3a959a['length'],'rows':_0x3a959a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x25e551){var _0x57e1cd=_[_0x7044('0x4b')](_0xd5ae12[_0x7044('0x58')]);_0x25e551({'count':_0x57e1cd[_0x7044('0x1a')],'rows':_0x57e1cd});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x22c4b8){var _0x1edc2d=_[_0x7044('0x4b')](_0xd5ae12[_0x7044('0x59')]);_0x22c4b8({'count':_0x1edc2d[_0x7044('0x1a')],'rows':_0x1edc2d});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x52e710){var _0x2dd19c=_[_0x7044('0x4b')](_0xd5ae12[_0x7044('0x5a')]);_0x52e710({'count':_0x2dd19c[_0x7044('0x1a')],'rows':_0x2dd19c});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xd7e30e){var _0x39d69f=_['values'](_0xd5ae12[_0x7044('0x5b')]);_0xd7e30e({'count':_0x39d69f['length'],'rows':_0x39d69f});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x1e0601){var _0x440fce=_[_0x7044('0x4b')](_0xd5ae12[_0x7044('0x5c')]);_0x1e0601({'count':_0x440fce[_0x7044('0x1a')],'rows':_0x440fce});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x46be2e){var _0x5103ff=_['values'](_0xd5ae12[_0x7044('0x5d')]);_0x46be2e({'count':_0x5103ff[_0x7044('0x1a')],'rows':_0x5103ff});});}};var _0x19175f=jayson[_0x7044('0x5e')](_0x798fe3)['http']();_0x19175f['on']('error',function(_0x3ddad0){logger[_0x7044('0x3a')](JSON[_0x7044('0x5f')](_0x3ddad0));return _0x4d63a8(_0x3ddad0);});_0x19175f['listen'](0x232c,'127.0.0.1',function(){console[_0x7044('0x60')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x58eb57('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 bd9c32e..0b56f30 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 _0xc8f1=['[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stop','util','bluebird','lodash','../../../config/logger','client','http','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','Command','format','iftime\x20%s','indexOf'];(function(_0x61aa1b,_0x57dd0f){var _0xd280e1=function(_0x3793f9){while(--_0x3793f9){_0x61aa1b['push'](_0x61aa1b['shift']());}};_0xd280e1(++_0x57dd0f);}(_0xc8f1,0x8f));var _0x1c8f=function(_0x349f8d,_0x12731e){_0x349f8d=_0x349f8d-0x0;var _0x134b98=_0xc8f1[_0x349f8d];return _0x134b98;};'use strict';var util=require(_0x1c8f('0x0'));var BPromise=require(_0x1c8f('0x1'));var jayson=require('jayson/promise');var _=require(_0x1c8f('0x2'));var logger=require(_0x1c8f('0x3'))('routing');var client=jayson[_0x1c8f('0x4')][_0x1c8f('0x5')]({'port':0x232a});function request(_0x394bb8,_0x5c4478){return new BPromise(function(_0x484fdb,_0x290603){return client['request'](_0x394bb8,_0x5c4478)[_0x1c8f('0x6')](function(_0xe82a49){if(_0xe82a49[_0x1c8f('0x7')]){return _0x290603(_0xe82a49[_0x1c8f('0x7')]['message']);}else{return _0x484fdb(_0xe82a49[_0x1c8f('0x8')]);}})[_0x1c8f('0x9')](function(_0x5b459f){return _0x290603(_0x5b459f);});});}exports[_0x1c8f('0xa')]=function(_0x5da830,_0x52184e,_0x568512){return function(_0x1e622b){if(_0x568512[_0x1c8f('0xb')]&&!_0x568512[_0x1c8f('0xb')][_0x5da830]){logger[_0x1c8f('0xc')](_0x1c8f('0xd'),_0x5da830);return _0x1e622b['stop']();}var _0x5a51e2=[];for(var _0x5ea58c=0x0;_0x5ea58c<_0x52184e['length'];_0x5ea58c+=0x1){_0x5a51e2[_0x1c8f('0xe')](request(_0x1c8f('0xf'),{'command':util[_0x1c8f('0x10')](_0x1c8f('0x11'),_0x52184e[_0x5ea58c])})[_0x1c8f('0x6')](function(_0xc369ce){return _0xc369ce&&_0xc369ce['message']&&_0xc369ce['message'][_0x1c8f('0x12')]('true')>=0x0?!![]:![];})[_0x1c8f('0x9')](function(){logger[_0x1c8f('0x7')](_0x1c8f('0x13'),_0x5da830,_0x52184e[_0x5ea58c]);}));}BPromise[_0x1c8f('0x14')](_0x5a51e2)['then'](function(_0x96a03c){var _0x44f80c=_[_0x1c8f('0x15')](_0x96a03c);logger[_0x1c8f('0xc')](_0x1c8f('0x16'),_0x5da830,_0x52184e[_0x1c8f('0x17')](_0x1c8f('0x18')),_0x44f80c);_0x1e622b[_0x1c8f('0x19')](_0x44f80c);})[_0x1c8f('0x9')](function(_0x34de02){logger['error'](_0x1c8f('0x16'),_0x5da830,_0x52184e[_0x1c8f('0x17')]('\x20|\x20'),_0x34de02['stack']);_0x1e622b[_0x1c8f('0x1a')]();});};}; \ No newline at end of file +var _0x5097=['../../../config/logger','routing','client','request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','message','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','stop','util','jayson/promise'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x5097,0x1eb));var _0x7509=function(_0x21a8b2,_0x2664af){_0x21a8b2=_0x21a8b2-0x0;var _0x3220de=_0x5097[_0x21a8b2];return _0x3220de;};'use strict';var util=require(_0x7509('0x0'));var BPromise=require('bluebird');var jayson=require(_0x7509('0x1'));var _=require('lodash');var logger=require(_0x7509('0x2'))(_0x7509('0x3'));var client=jayson[_0x7509('0x4')]['http']({'port':0x232a});function request(_0x118fcc,_0x454d3f){return new BPromise(function(_0x14f355,_0x545ffc){return client[_0x7509('0x5')](_0x118fcc,_0x454d3f)[_0x7509('0x6')](function(_0x5abb20){if(_0x5abb20[_0x7509('0x7')]){return _0x545ffc(_0x5abb20[_0x7509('0x7')]['message']);}else{return _0x14f355(_0x5abb20[_0x7509('0x8')]);}})[_0x7509('0x9')](function(_0x234ee8){return _0x545ffc(_0x234ee8);});});}exports[_0x7509('0xa')]=function(_0xbb4cd3,_0x4cd70,_0x185aa6){return function(_0x3ab8b5){if(_0x185aa6[_0x7509('0xb')]&&!_0x185aa6['rules'][_0xbb4cd3]){logger[_0x7509('0xc')](_0x7509('0xd'),_0xbb4cd3);return _0x3ab8b5['stop']();}var _0x2ef1e0=[];for(var _0x5c1189=0x0;_0x5c1189<_0x4cd70[_0x7509('0xe')];_0x5c1189+=0x1){_0x2ef1e0[_0x7509('0xf')](request(_0x7509('0x10'),{'command':util[_0x7509('0x11')]('iftime\x20%s',_0x4cd70[_0x5c1189])})[_0x7509('0x6')](function(_0x581c71){return _0x581c71&&_0x581c71[_0x7509('0x12')]&&_0x581c71['message'][_0x7509('0x13')](_0x7509('0x14'))>=0x0?!![]:![];})[_0x7509('0x9')](function(){logger['error'](_0x7509('0x15'),_0xbb4cd3,_0x4cd70[_0x5c1189]);}));}BPromise[_0x7509('0x16')](_0x2ef1e0)[_0x7509('0x6')](function(_0x515530){var _0x195a8e=_['some'](_0x515530);logger[_0x7509('0xc')](_0x7509('0x17'),_0xbb4cd3,_0x4cd70[_0x7509('0x18')](_0x7509('0x19')),_0x195a8e);_0x3ab8b5[_0x7509('0x1a')](_0x195a8e);})['catch'](function(_0xdd66cc){logger[_0x7509('0x7')]('[%s][INTERVAL]\x20%s\x20%s',_0xbb4cd3,_0x4cd70[_0x7509('0x18')](_0x7509('0x19')),_0xdd66cc[_0x7509('0x1b')]);_0x3ab8b5[_0x7509('0x1c')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b6712fc..18ff4a8 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 _0x9348=['clone','calleridname','transfer','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','[%s][agents][hangup]','rejected','indexOf','splice','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agentcomplete','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','uniqueid','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','forIn','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transfereeuniqueid'];(function(_0x22c54c,_0x2f2292){var _0x1cd162=function(_0x2aabdc){while(--_0x2aabdc){_0x22c54c['push'](_0x22c54c['shift']());}};_0x1cd162(++_0x2f2292);}(_0x9348,0x10d));var _0x8934=function(_0x2406da,_0x1bb1d3){_0x2406da=_0x2406da-0x0;var _0x122195=_0x9348[_0x2406da];return _0x122195;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var utils=require(_0x8934('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x135b2c,_0x46a231){utils['info'](util[_0x8934('0x3')](_0x8934('0x4'),_0x135b2c['uniqueid'],_0x135b2c[_0x8934('0x5')],_0x135b2c[_0x8934('0x6')],_0x135b2c[_0x8934('0x7')],_0x135b2c[_0x8934('0x8')],_0x135b2c[_0x8934('0x9')],_0x135b2c[_0x8934('0xa')],_0x135b2c['lastevent']));if(_0x135b2c[_0x8934('0x6')]){utils[_0x8934('0xb')](_0x135b2c[_0x8934('0x6')])['then'](function(_0x4b470d){if(_0x4b470d){_0x135b2c['type']=_0x4b470d['type'];_0x135b2c[_0x8934('0xc')]=_0x135b2c['agentcomplete']?_0x4b470d[_0x8934('0xd')]:![];_0x135b2c[_0x8934('0xe')]=_0x135b2c[_0x8934('0xc')]?_0x4b470d[_0x8934('0xf')]:0x0;}utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);});}else{utils[_0x8934('0x10')](_0x8934('0x11'),_0x135b2c);}if(_0x46a231){delete transfers[_0x135b2c['uniqueid']];}else{delete agents[_0x135b2c[_0x8934('0x12')]];}}exports[_0x8934('0x13')]=function(_0x46bca5){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0x46bca5);agents[_0x46bca5[_0x8934('0x12')]]=_0x46bca5;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x19');agents[_0x46bca5[_0x8934('0x12')]]['connectedlinenum']=null;agents[_0x46bca5[_0x8934('0x12')]][_0x8934('0x1a')]=null;utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x46bca5['uniqueid'],agents[_0x46bca5[_0x8934('0x12')]]['membername'],_0x46bca5[_0x8934('0x12')]));}catch(_0xa9c394){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x15'),_0x46bca5['uniqueid']),_0xa9c394);}};exports[_0x8934('0x1d')]=function(_0x5ae49f){try{if(!_[_0x8934('0x1e')](agents[_0x5ae49f[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x5ae49f);utils[_0x8934('0x1b')](util['format'](_0x8934('0x21'),_0x5ae49f[_0x8934('0x20')],agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x7')],_0x5ae49f[_0x8934('0x12')]));agents[_0x5ae49f['destuniqueid']][_0x8934('0x1d')]=!![];agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x22')]=utils['now']();agents[_0x5ae49f[_0x8934('0x12')]]['lastevent']=_0x8934('0x23');agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x24')]='timeout';agents[_0x5ae49f[_0x8934('0x12')]][_0x8934('0x25')]=_0x5ae49f[_0x8934('0x26')]?parseInt(_0x5ae49f[_0x8934('0x26')])/0x3e8:0x0;agents[_0x5ae49f['destuniqueid']][_0x8934('0x27')]=0x0;unanswered[_0x8934('0x28')](_0x5ae49f[_0x8934('0x12')]);}}catch(_0x3d93c7){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x1f'),_0x5ae49f[_0x8934('0x20')]),_0x3d93c7);}};exports[_0x8934('0x29')]=function(_0x18938a){try{_['forIn'](agents,function(_0x1d068c,_0x3e973e){if(_0x1d068c['uniqueid']==_0x18938a[_0x8934('0x20')]&&!_[_0x8934('0x2a')](unanswered,_0x1d068c[_0x8934('0x12')])){utils[_0x8934('0x14')](util['format'](_0x8934('0x2b'),_0x18938a[_0x8934('0x20')]),_0x18938a);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2c'),_0x18938a['uniqueid'],_0x1d068c[_0x8934('0x7')],_0x1d068c['destuniqueid']));_0x1d068c['agentringnoanswer']=!![];_0x1d068c[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x1d068c[_0x8934('0x18')]=_0x8934('0x2d');_0x1d068c['reason']=_0x8934('0x2d');_0x1d068c[_0x8934('0x25')]=_0x18938a[_0x8934('0x25')];_0x1d068c[_0x8934('0x27')]=0x0;writeDB(_0x1d068c);}});}catch(_0x7b2a1c){utils['error'](util[_0x8934('0x3')](_0x8934('0x2b'),_0x18938a['uniqueid']),_0x7b2a1c);}};exports['agentconnect']=function(_0x845028){try{if(agents[_0x845028[_0x8934('0x12')]]){utils['debug'](util['format'](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x845028);utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x2f'),_0x845028[_0x8934('0x20')],agents[_0x845028[_0x8934('0x12')]][_0x8934('0x7')],_0x845028[_0x8934('0x12')]));agents[_0x845028[_0x8934('0x12')]][_0x8934('0x30')]=utils['now']();agents[_0x845028[_0x8934('0x12')]][_0x8934('0xa')]=_0x845028['connectedlinenum'];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x1a')]=_0x845028[_0x8934('0x1a')];agents[_0x845028[_0x8934('0x12')]][_0x8934('0x25')]=_0x845028['ringtime'];agents[_0x845028['destuniqueid']]['lastevent']=_0x8934('0x31');_[_0x8934('0x32')](agents,function(_0x8814f6,_0x53581b){if(_0x8814f6[_0x8934('0x12')]!=_0x845028['destuniqueid']&&_0x8814f6['uniqueid']==_0x845028[_0x8934('0x20')]){_0x8814f6[_0x8934('0x27')]=0x0;_0x8814f6['holdtime']=_0x845028['ringtime'];_0x8814f6[_0x8934('0x1d')]=!![];_0x8814f6[_0x8934('0x22')]=utils[_0x8934('0x17')]();_0x8814f6['lastevent']=_0x8934('0x33');_0x8814f6['reason']=_0x8934('0x33');_0x8814f6['answeredelsewheredestinationuniqueid']=_0x845028[_0x8934('0x12')];_0x8814f6[_0x8934('0x34')]=_0x845028[_0x8934('0x7')];writeDB(_0x8814f6);}});}}catch(_0x566d67){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x2e'),_0x845028[_0x8934('0x20')]),_0x566d67);}};exports['agentcomplete']=function(_0x2182db){try{if(!_[_0x8934('0x1e')](agents[_0x2182db[_0x8934('0x12')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0x2182db);utils[_0x8934('0x1b')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2182db['uniqueid'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x7')],_0x2182db['destuniqueid']));agents[_0x2182db[_0x8934('0x12')]]['agentcomplete']=!![];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x36')]=utils['now']();agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x2182db[_0x8934('0x12')]]['agentcompleteAt'],agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x30')]);agents[_0x2182db['destuniqueid']][_0x8934('0x24')]=_0x2182db[_0x8934('0x24')];agents[_0x2182db[_0x8934('0x12')]][_0x8934('0x18')]=_0x8934('0x38');writeDB(agents[_0x2182db[_0x8934('0x12')]]);}}catch(_0xa45543){utils[_0x8934('0x1c')](util[_0x8934('0x3')](_0x8934('0x35'),_0x2182db[_0x8934('0x20')]),_0xa45543);}};exports[_0x8934('0x39')]=function(_0x2c322d){try{if(!_[_0x8934('0x1e')](agents[_0x2c322d[_0x8934('0x3a')]])){utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x3b'),_0x2c322d['uniqueid']),_0x2c322d);utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c322d['uniqueid'],agents[_0x2c322d['transfereruniqueid']]['membername'],agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')]));agents[_0x2c322d[_0x8934('0x3a')]]['transfer']=!![];agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3c')]='blind';agents[_0x2c322d['transfereruniqueid']][_0x8934('0x3d')]=_0x2c322d[_0x8934('0x3e')];agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x3f')]=agents[_0x2c322d[_0x8934('0x3a')]][_0x8934('0x20')];}}catch(_0x3902fb){utils['error'](util[_0x8934('0x3')]('[%s][agents][blindtransfer]',_0x2c322d[_0x8934('0x20')]),_0x3902fb);}};exports[_0x8934('0x40')]=function(_0x2d776a){try{utils[_0x8934('0x14')](util[_0x8934('0x3')](_0x8934('0x41'),_0x2d776a[_0x8934('0x42')]),_0x2d776a);if(_0x2d776a[_0x8934('0x42')]==_0x2d776a['origtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x43')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a['origtransfereruniqueid'],agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x7')]));agents[_0x2d776a[_0x8934('0x43')]]['transfer']=!![];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a['secondtransfereruniqueid']]['transferexten']=_0x2d776a['origtransfererexten'];agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x42')];}if(_0x2d776a['transfereeuniqueid']&&agents[_0x2d776a[_0x8934('0x46')]]){agents[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x1;transfers[_0x2d776a['transfereeuniqueid']]=_[_0x8934('0x47')](agents[_0x2d776a[_0x8934('0x46')]]);transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x9')]=agents[_0x2d776a['secondtransfereruniqueid']]['calleridnum'];transfers[_0x2d776a['transfereeuniqueid']]['calleridname']=agents[_0x2d776a[_0x8934('0x43')]][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x46')]][_0x8934('0x16')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['agentconnectAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x46')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x46')]]['agententerreason']=0x2;}}else if(_0x2d776a[_0x8934('0x43')]==_0x2d776a['secondtransfererlinkedid']){if(!_[_0x8934('0x1e')](agents[_0x2d776a[_0x8934('0x42')]])){utils[_0x8934('0x1b')](util[_0x8934('0x3')](_0x8934('0x44'),_0x2d776a[_0x8934('0x42')],agents[_0x2d776a[_0x8934('0x42')]]['membername']));agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x49')]=!![];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3c')]=_0x8934('0x45');agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3d')]=_0x2d776a[_0x8934('0x4a')];agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x3f')]=_0x2d776a[_0x8934('0x43')];}if(_0x2d776a[_0x8934('0x4b')]&&agents[_0x2d776a[_0x8934('0x4b')]]){agents[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x1;transfers[_0x2d776a['transfertargetuniqueid']]=_['clone'](agents[_0x2d776a[_0x8934('0x4b')]]);transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x9')]=agents[_0x2d776a[_0x8934('0x42')]][_0x8934('0x9')];transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x48')]=agents[_0x2d776a['origtransfereruniqueid']][_0x8934('0x48')];transfers[_0x2d776a[_0x8934('0x4b')]]['agentcalledAt']=utils[_0x8934('0x17')]();transfers[_0x2d776a['transfertargetuniqueid']][_0x8934('0x30')]=utils[_0x8934('0x17')]();transfers[_0x2d776a[_0x8934('0x4b')]]['holdtime']=0x0;transfers[_0x2d776a[_0x8934('0x4b')]][_0x8934('0x4c')]=0x2;}}}catch(_0x544fa7){utils[_0x8934('0x1c')](util['format'](_0x8934('0x41'),_0x2d776a['origtransfereruniqueid']),_0x544fa7);}};exports[_0x8934('0x4d')]=function(_0x6b3376){try{utils[_0x8934('0x14')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x6b3376);if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]]['reason']===_0x8934('0x23')){if(_0x6b3376['cause']==='21'){agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=_0x8934('0x4f');agents[_0x6b3376[_0x8934('0x20')]]['lastevent']=_0x8934('0x4f');}utils[_0x8934('0x1b')](util[_0x8934('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376['uniqueid']]['reason'],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);var _0x1efd58=unanswered[_0x8934('0x50')](_0x6b3376[_0x8934('0x20')]);if(_0x1efd58>-0x1){unanswered[_0x8934('0x51')](_0x1efd58,0x1);}}if(transfers[_0x6b3376[_0x8934('0x20')]]){transfers[_0x6b3376[_0x8934('0x20')]]['agentcomplete']=!![];transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils['diffTime'](transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')],transfers[_0x6b3376['uniqueid']][_0x8934('0x30')]);transfers[_0x6b3376['uniqueid']]['reason']='agent';transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]=_0x8934('0x38');utils['info'](util[_0x8934('0x3')](_0x8934('0x52'),_0x6b3376['uniqueid'],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],transfers[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(transfers[_0x6b3376[_0x8934('0x20')]],!![]);}if(agents[_0x6b3376[_0x8934('0x20')]]&&agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]){agents[_0x6b3376['uniqueid']][_0x8934('0x53')]=!![];agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x36')]=utils[_0x8934('0x17')]();agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x27')]=utils[_0x8934('0x37')](agents[_0x6b3376['uniqueid']][_0x8934('0x36')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x30')]);agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')]=agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x49')]?_0x8934('0x49'):_0x8934('0x54');agents[_0x6b3376['uniqueid']]['lastevent']=_0x8934('0x38');utils[_0x8934('0x1b')](util['format'](_0x8934('0x52'),_0x6b3376[_0x8934('0x20')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x7')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x24')],agents[_0x6b3376[_0x8934('0x20')]][_0x8934('0x18')]));writeDB(agents[_0x6b3376[_0x8934('0x20')]]);}}catch(_0x2d094e){utils[_0x8934('0x1c')](util['format'](_0x8934('0x4e'),_0x6b3376[_0x8934('0x20')]),_0x2d094e);}}; \ No newline at end of file +var _0xb469=['agentringnoanswerAt','timeout','holdtime','ringtime','talktime','[%s][agents][agentringnoanswer]','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','splice','diffTime','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','lastevent','called','connectedlinename','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout'];(function(_0x340377,_0x5d4ed8){var _0x5601dc=function(_0x514759){while(--_0x514759){_0x340377['push'](_0x340377['shift']());}};_0x5601dc(++_0x5d4ed8);}(_0xb469,0x13b));var _0x9b46=function(_0x580c6e,_0x346a36){_0x580c6e=_0x580c6e-0x0;var _0x594018=_0xb469[_0x580c6e];return _0x594018;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var utils=require(_0x9b46('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x34f477,_0x1a41e8){utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x34f477[_0x9b46('0x5')],_0x34f477[_0x9b46('0x6')],_0x34f477['queue'],_0x34f477[_0x9b46('0x7')],_0x34f477[_0x9b46('0x8')],_0x34f477['calleridnum'],_0x34f477[_0x9b46('0x9')],_0x34f477['lastevent']));if(_0x34f477['queue']){utils[_0x9b46('0xa')](_0x34f477['queue'])[_0x9b46('0xb')](function(_0xb9d1b5){if(_0xb9d1b5){_0x34f477[_0x9b46('0xc')]=_0xb9d1b5['type'];_0x34f477[_0x9b46('0xd')]=_0x34f477['agentcomplete']?_0xb9d1b5[_0x9b46('0xe')]:![];_0x34f477['acwtime']=_0x34f477[_0x9b46('0xd')]?_0xb9d1b5['acwTimeout']:0x0;}utils[_0x9b46('0xf')](_0x9b46('0x10'),_0x34f477);});}else{utils['request'](_0x9b46('0x10'),_0x34f477);}if(_0x1a41e8){delete transfers[_0x34f477[_0x9b46('0x5')]];}else{delete agents[_0x34f477['destuniqueid']];}}exports[_0x9b46('0x11')]=function(_0x2cfb35){try{utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x13'),_0x2cfb35[_0x9b46('0x5')]),_0x2cfb35);agents[_0x2cfb35[_0x9b46('0x14')]]=_0x2cfb35;agents[_0x2cfb35[_0x9b46('0x14')]][_0x9b46('0x15')]=utils[_0x9b46('0x16')]();agents[_0x2cfb35[_0x9b46('0x14')]][_0x9b46('0x17')]=_0x9b46('0x18');agents[_0x2cfb35['destuniqueid']]['connectedlinenum']=null;agents[_0x2cfb35['destuniqueid']][_0x9b46('0x19')]=null;utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2cfb35['uniqueid'],agents[_0x2cfb35[_0x9b46('0x14')]]['membername'],_0x2cfb35['destuniqueid']));}catch(_0xfeb1b9){utils[_0x9b46('0x1a')](util['format'](_0x9b46('0x13'),_0x2cfb35[_0x9b46('0x5')]),_0xfeb1b9);}};exports['agentringnoanswer']=function(_0x55aece){try{if(!_[_0x9b46('0x1b')](agents[_0x55aece[_0x9b46('0x14')]])){utils[_0x9b46('0x12')](util['format']('[%s][agents][agentringnoanswer]',_0x55aece[_0x9b46('0x5')]),_0x55aece);utils['info'](util[_0x9b46('0x4')](_0x9b46('0x1c'),_0x55aece['uniqueid'],agents[_0x55aece[_0x9b46('0x14')]]['membername'],_0x55aece[_0x9b46('0x14')]));agents[_0x55aece[_0x9b46('0x14')]]['agentringnoanswer']=!![];agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x1d')]=utils[_0x9b46('0x16')]();agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x17')]=_0x9b46('0x1e');agents[_0x55aece[_0x9b46('0x14')]]['reason']=_0x9b46('0x1e');agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x1f')]=_0x55aece[_0x9b46('0x20')]?parseInt(_0x55aece[_0x9b46('0x20')])/0x3e8:0x0;agents[_0x55aece[_0x9b46('0x14')]][_0x9b46('0x21')]=0x0;unanswered['push'](_0x55aece[_0x9b46('0x14')]);}}catch(_0xee519e){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x22'),_0x55aece[_0x9b46('0x5')]),_0xee519e);}};exports[_0x9b46('0x23')]=function(_0x17ba3d){try{_[_0x9b46('0x24')](agents,function(_0x20090a,_0x2e1c51){if(_0x20090a['uniqueid']==_0x17ba3d[_0x9b46('0x5')]&&!_[_0x9b46('0x25')](unanswered,_0x20090a[_0x9b46('0x14')])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x26'),_0x17ba3d[_0x9b46('0x5')]),_0x17ba3d);utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x27'),_0x17ba3d[_0x9b46('0x5')],_0x20090a['membername'],_0x20090a[_0x9b46('0x14')]));_0x20090a['agentringnoanswer']=!![];_0x20090a[_0x9b46('0x1d')]=utils[_0x9b46('0x16')]();_0x20090a[_0x9b46('0x17')]='abandoned';_0x20090a[_0x9b46('0x28')]=_0x9b46('0x29');_0x20090a[_0x9b46('0x1f')]=_0x17ba3d[_0x9b46('0x1f')];_0x20090a[_0x9b46('0x21')]=0x0;writeDB(_0x20090a);}});}catch(_0x5cb73f){utils['error'](util[_0x9b46('0x4')](_0x9b46('0x26'),_0x17ba3d[_0x9b46('0x5')]),_0x5cb73f);}};exports[_0x9b46('0x2a')]=function(_0x4fa731){try{if(agents[_0x4fa731[_0x9b46('0x14')]]){utils['debug'](util[_0x9b46('0x4')](_0x9b46('0x2b'),_0x4fa731[_0x9b46('0x5')]),_0x4fa731);utils[_0x9b46('0x3')](util['format'](_0x9b46('0x2c'),_0x4fa731['uniqueid'],agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x7')],_0x4fa731[_0x9b46('0x14')]));agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x2d')]=utils[_0x9b46('0x16')]();agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x9')]=_0x4fa731[_0x9b46('0x9')];agents[_0x4fa731[_0x9b46('0x14')]][_0x9b46('0x19')]=_0x4fa731['connectedlinename'];agents[_0x4fa731[_0x9b46('0x14')]]['holdtime']=_0x4fa731[_0x9b46('0x20')];agents[_0x4fa731[_0x9b46('0x14')]]['lastevent']=_0x9b46('0x2e');_['forIn'](agents,function(_0x416538,_0x493b0f){if(_0x416538[_0x9b46('0x14')]!=_0x4fa731[_0x9b46('0x14')]&&_0x416538[_0x9b46('0x5')]==_0x4fa731[_0x9b46('0x5')]){_0x416538[_0x9b46('0x21')]=0x0;_0x416538['holdtime']=_0x4fa731['ringtime'];_0x416538[_0x9b46('0x2f')]=!![];_0x416538['agentringnoanswerAt']=utils['now']();_0x416538['lastevent']='answered_elsewhere';_0x416538[_0x9b46('0x28')]='answered_elsewhere';_0x416538[_0x9b46('0x30')]=_0x4fa731['destuniqueid'];_0x416538[_0x9b46('0x31')]=_0x4fa731[_0x9b46('0x7')];writeDB(_0x416538);}});}}catch(_0x2e92aa){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x2b'),_0x4fa731[_0x9b46('0x5')]),_0x2e92aa);}};exports[_0x9b46('0x32')]=function(_0x148d86){try{if(!_['isNil'](agents[_0x148d86[_0x9b46('0x14')]])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x33'),_0x148d86[_0x9b46('0x5')]),_0x148d86);utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x34'),_0x148d86[_0x9b46('0x5')],agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x7')],_0x148d86[_0x9b46('0x14')]));agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x32')]=!![];agents[_0x148d86['destuniqueid']]['agentcompleteAt']=utils[_0x9b46('0x16')]();agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x21')]=utils['diffTime'](agents[_0x148d86['destuniqueid']][_0x9b46('0x35')],agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x2d')]);agents[_0x148d86[_0x9b46('0x14')]][_0x9b46('0x28')]=_0x148d86[_0x9b46('0x28')];agents[_0x148d86['destuniqueid']][_0x9b46('0x17')]=_0x9b46('0x36');writeDB(agents[_0x148d86[_0x9b46('0x14')]]);}}catch(_0x47a938){utils[_0x9b46('0x1a')](util['format'](_0x9b46('0x33'),_0x148d86[_0x9b46('0x5')]),_0x47a938);}};exports[_0x9b46('0x37')]=function(_0x566bad){try{if(!_[_0x9b46('0x1b')](agents[_0x566bad[_0x9b46('0x38')]])){utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x39'),_0x566bad[_0x9b46('0x5')]),_0x566bad);utils['info'](util[_0x9b46('0x4')](_0x9b46('0x3a'),_0x566bad[_0x9b46('0x5')],agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x7')],agents[_0x566bad[_0x9b46('0x38')]]['uniqueid']));agents[_0x566bad[_0x9b46('0x38')]]['transfer']=!![];agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3b')]=_0x9b46('0x3c');agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3d')]=_0x566bad['extension'];agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x3e')]=agents[_0x566bad[_0x9b46('0x38')]][_0x9b46('0x5')];}}catch(_0x3f6b2f){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x39'),_0x566bad[_0x9b46('0x5')]),_0x3f6b2f);}};exports[_0x9b46('0x3f')]=function(_0x2f411f){try{utils['debug'](util['format']('[%s][agents][attendedtransfer]',_0x2f411f[_0x9b46('0x40')]),_0x2f411f);if(_0x2f411f['origtransfereruniqueid']==_0x2f411f[_0x9b46('0x41')]){if(!_['isNil'](agents[_0x2f411f[_0x9b46('0x42')]])){utils['info'](util[_0x9b46('0x4')](_0x9b46('0x43'),_0x2f411f[_0x9b46('0x40')],agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x7')]));agents[_0x2f411f['secondtransfereruniqueid']][_0x9b46('0x44')]=!![];agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x3b')]=_0x9b46('0x45');agents[_0x2f411f[_0x9b46('0x42')]]['transferexten']=_0x2f411f['origtransfererexten'];agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x3e')]=_0x2f411f[_0x9b46('0x40')];}if(_0x2f411f[_0x9b46('0x46')]&&agents[_0x2f411f[_0x9b46('0x46')]]){agents[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x47')]=0x1;transfers[_0x2f411f[_0x9b46('0x46')]]=_['clone'](agents[_0x2f411f[_0x9b46('0x46')]]);transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x48')]=agents[_0x2f411f['secondtransfereruniqueid']][_0x9b46('0x48')];transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x49')]=agents[_0x2f411f[_0x9b46('0x42')]][_0x9b46('0x49')];transfers[_0x2f411f[_0x9b46('0x46')]]['agentcalledAt']=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x2d')]=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x46')]][_0x9b46('0x1f')]=0x0;transfers[_0x2f411f['transfereeuniqueid']][_0x9b46('0x47')]=0x2;}}else if(_0x2f411f['secondtransfereruniqueid']==_0x2f411f[_0x9b46('0x4a')]){if(!_['isNil'](agents[_0x2f411f[_0x9b46('0x40')]])){utils[_0x9b46('0x3')](util['format'](_0x9b46('0x43'),_0x2f411f[_0x9b46('0x40')],agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x7')]));agents[_0x2f411f[_0x9b46('0x40')]]['transfer']=!![];agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x3b')]='ATTENDED';agents[_0x2f411f['origtransfereruniqueid']][_0x9b46('0x3d')]=_0x2f411f[_0x9b46('0x4b')];agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x3e')]=_0x2f411f[_0x9b46('0x42')];}if(_0x2f411f[_0x9b46('0x4c')]&&agents[_0x2f411f[_0x9b46('0x4c')]]){agents[_0x2f411f[_0x9b46('0x4c')]]['agententerreason']=0x1;transfers[_0x2f411f['transfertargetuniqueid']]=_[_0x9b46('0x4d')](agents[_0x2f411f[_0x9b46('0x4c')]]);transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x48')]=agents[_0x2f411f['origtransfereruniqueid']][_0x9b46('0x48')];transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x49')]=agents[_0x2f411f[_0x9b46('0x40')]][_0x9b46('0x49')];transfers[_0x2f411f['transfertargetuniqueid']][_0x9b46('0x15')]=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x4c')]]['agentconnectAt']=utils[_0x9b46('0x16')]();transfers[_0x2f411f[_0x9b46('0x4c')]][_0x9b46('0x1f')]=0x0;transfers[_0x2f411f[_0x9b46('0x4c')]][_0x9b46('0x47')]=0x2;}}}catch(_0x4e8756){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x2f411f['origtransfereruniqueid']),_0x4e8756);}};exports[_0x9b46('0x4e')]=function(_0x200607){try{utils[_0x9b46('0x12')](util[_0x9b46('0x4')](_0x9b46('0x4f'),_0x200607[_0x9b46('0x5')]),_0x200607);if(agents[_0x200607[_0x9b46('0x5')]]&&agents[_0x200607[_0x9b46('0x5')]]['reason']===_0x9b46('0x1e')){if(_0x200607[_0x9b46('0x50')]==='21'){agents[_0x200607['uniqueid']][_0x9b46('0x28')]='rejected';agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x17')]=_0x9b46('0x51');}utils[_0x9b46('0x3')](util[_0x9b46('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x200607['uniqueid'],agents[_0x200607[_0x9b46('0x5')]]['membername'],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')],agents[_0x200607['uniqueid']]['lastevent']));writeDB(agents[_0x200607['uniqueid']]);var _0x2978aa=unanswered['indexOf'](_0x200607['uniqueid']);if(_0x2978aa>-0x1){unanswered[_0x9b46('0x52')](_0x2978aa,0x1);}}if(transfers[_0x200607[_0x9b46('0x5')]]){transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x32')]=!![];transfers[_0x200607['uniqueid']][_0x9b46('0x35')]=utils[_0x9b46('0x16')]();transfers[_0x200607[_0x9b46('0x5')]]['talktime']=utils['diffTime'](transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x35')],transfers[_0x200607[_0x9b46('0x5')]]['agentconnectAt']);transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')]='agent';transfers[_0x200607[_0x9b46('0x5')]][_0x9b46('0x17')]=_0x9b46('0x36');utils[_0x9b46('0x3')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x200607[_0x9b46('0x5')],transfers[_0x200607['uniqueid']][_0x9b46('0x7')],transfers[_0x200607[_0x9b46('0x5')]]['reason'],transfers[_0x200607['uniqueid']]['lastevent']));writeDB(transfers[_0x200607[_0x9b46('0x5')]],!![]);}if(agents[_0x200607['uniqueid']]&&agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x2d')]){agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x32')]=!![];agents[_0x200607['uniqueid']][_0x9b46('0x35')]=utils[_0x9b46('0x16')]();agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x21')]=utils[_0x9b46('0x53')](agents[_0x200607['uniqueid']][_0x9b46('0x35')],agents[_0x200607['uniqueid']][_0x9b46('0x2d')]);agents[_0x200607[_0x9b46('0x5')]]['reason']=agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x44')]?_0x9b46('0x44'):_0x9b46('0x54');agents[_0x200607['uniqueid']][_0x9b46('0x17')]='complete';utils[_0x9b46('0x3')](util[_0x9b46('0x4')](_0x9b46('0x55'),_0x200607['uniqueid'],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x7')],agents[_0x200607[_0x9b46('0x5')]][_0x9b46('0x28')],agents[_0x200607['uniqueid']][_0x9b46('0x17')]));writeDB(agents[_0x200607['uniqueid']]);}}catch(_0x420d61){utils[_0x9b46('0x1a')](util[_0x9b46('0x4')](_0x9b46('0x4f'),_0x200607[_0x9b46('0x5')]),_0x420d61);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 87413b7..606dd6e 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 _0x2849=['noop','execif','set','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','source','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','includes'];(function(_0xa9859c,_0x50500d){var _0x3e23f9=function(_0x4f242a){while(--_0x4f242a){_0xa9859c['push'](_0xa9859c['shift']());}};_0x3e23f9(++_0x50500d);}(_0x2849,0x14e));var _0x9284=function(_0x13859b,_0x16468d){_0x13859b=_0x13859b-0x0;var _0x39f613=_0x2849[_0x13859b];return _0x39f613;};'use strict';var _=require(_0x9284('0x0'));var util=require(_0x9284('0x1'));var utils=require(_0x9284('0x2'));var dispositions=[_0x9284('0x3'),_0x9284('0x4'),_0x9284('0x4'),_0x9284('0x3'),_0x9284('0x3'),'NO\x20ANSWER',_0x9284('0x5'),_0x9284('0x6'),_0x9284('0x4'),_0x9284('0x4'),_0x9284('0x4')];var channels={};function writeDB(_0x190f0e){utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x9'),_0x190f0e[_0x9284('0xa')],_0x190f0e[_0x9284('0xb')],_0x190f0e[_0x9284('0xc')],_0x190f0e[_0x9284('0xd')],_0x190f0e[_0x9284('0xe')],_0x190f0e[_0x9284('0xf')],_0x190f0e[_0x9284('0x10')],_0x190f0e[_0x9284('0x11')]));if(_0x190f0e[_0x9284('0x12')]){utils[_0x9284('0x13')](_0x190f0e[_0x9284('0x12')])[_0x9284('0x14')](function(_0x1f47e3){if(_0x1f47e3){_0x190f0e[_0x9284('0x15')]=_0x1f47e3['id'];}utils[_0x9284('0x16')](_0x9284('0x17'),_0x190f0e);});}else{utils[_0x9284('0x16')](_0x9284('0x17'),_0x190f0e);}if(channels[_0x190f0e[_0x9284('0xa')]]){delete channels[_0x190f0e[_0x9284('0xa')]];}}exports[_0x9284('0x18')]=function(_0x40f7ed){try{utils[_0x9284('0x19')](util[_0x9284('0x8')]('[%s][calls][newchannel]',_0x40f7ed['uniqueid']),_0x40f7ed);if(_0x40f7ed[_0x9284('0xa')]==_0x40f7ed[_0x9284('0x1a')]&&_0x40f7ed[_0x9284('0xb')]!='OutgoingSpoolFailed'){utils['info'](util[_0x9284('0x8')](_0x9284('0x1b'),_0x40f7ed[_0x9284('0xa')],_0x40f7ed['context'],_0x40f7ed[_0x9284('0x1c')]));channels[_0x40f7ed[_0x9284('0xa')]]={'uniqueid':_0x40f7ed['uniqueid'],'accountcode':_0x40f7ed[_0x9284('0x12')],'source':_0x40f7ed[_0x9284('0xf')],'destination':_0x40f7ed[_0x9284('0x1c')],'destinationcontext':_0x40f7ed[_0x9284('0x1d')],'channel':_0x40f7ed[_0x9284('0xb')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9284('0x3'),'amaflags':_0x9284('0x1e')};}}catch(_0x39e99a){utils[_0x9284('0x1f')](util[_0x9284('0x8')](_0x9284('0x20'),_0x40f7ed[_0x9284('0xa')]),_0x39e99a);}};exports[_0x9284('0x21')]=function(_0x421c1a){try{utils[_0x9284('0x19')](util[_0x9284('0x8')](_0x9284('0x22'),_0x421c1a['uniqueid']),_0x421c1a);if(!_[_0x9284('0x23')](channels[_0x421c1a['uniqueid']])&&_0x421c1a[_0x9284('0x24')]==0x6){utils[_0x9284('0x7')](util[_0x9284('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x421c1a[_0x9284('0xa')],_0x421c1a[_0x9284('0x1d')],_0x421c1a[_0x9284('0xb')]));if(_[_0x9284('0x23')](channels[_0x421c1a['uniqueid']]['systemanswertime'])){channels[_0x421c1a['uniqueid']][_0x9284('0x25')]=utils[_0x9284('0x26')]();}}else if(!_[_0x9284('0x23')](channels[_0x421c1a[_0x9284('0x1a')]])&&_0x421c1a[_0x9284('0x24')]==0x6&&_0x421c1a['context']!=_0x9284('0x27')){utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x28'),_0x421c1a[_0x9284('0xa')],_0x421c1a['linkedid'],_0x421c1a[_0x9284('0x1d')],_0x421c1a[_0x9284('0xb')]));channels[_0x421c1a[_0x9284('0x1a')]][_0x9284('0x12')]=_0x421c1a['accountcode'];channels[_0x421c1a[_0x9284('0x1a')]][_0x9284('0x29')]=_0x421c1a[_0x9284('0xb')];if(_[_0x9284('0x23')](channels[_0x421c1a[_0x9284('0x1a')]]['answertime'])){channels[_0x421c1a['linkedid']][_0x9284('0x2a')]=utils[_0x9284('0x26')]();}channels[_0x421c1a[_0x9284('0x1a')]]['disposition']=dispositions[_[_0x9284('0x2b')](_0x421c1a['channelstate'])]||_0x9284('0x5');}}catch(_0x312d35){utils[_0x9284('0x1f')](util['format'](_0x9284('0x22'),_0x421c1a[_0x9284('0xa')]),_0x312d35);}};exports[_0x9284('0x2c')]=function(_0x376e11){try{if(!_['isNil'](channels[_0x376e11['uniqueid']])){utils[_0x9284('0x19')](util['format'](_0x9284('0x2d'),_0x376e11[_0x9284('0xa')]),_0x376e11);if(_[_0x9284('0x23')](channels[_0x376e11[_0x9284('0xa')]][_0x9284('0x2e')])){channels[_0x376e11[_0x9284('0xa')]][_0x9284('0x2e')]=_0x376e11[_0x9284('0x2f')]+'\x20<'+_0x376e11[_0x9284('0xf')]+'>';}utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x30'),_0x376e11[_0x9284('0xa')],channels[_0x376e11[_0x9284('0xa')]]['callerid'],_0x376e11['cause-txt']));channels[_0x376e11[_0x9284('0xa')]][_0x9284('0x31')]=utils[_0x9284('0x26')]();channels[_0x376e11['uniqueid']]['duration']=utils[_0x9284('0x32')](channels[_0x376e11[_0x9284('0xa')]][_0x9284('0x31')],channels[_0x376e11[_0x9284('0xa')]]['starttime']);channels[_0x376e11['uniqueid']][_0x9284('0x33')]=channels[_0x376e11[_0x9284('0xa')]][_0x9284('0x2a')]?utils[_0x9284('0x32')](channels[_0x376e11[_0x9284('0xa')]]['endtime'],channels[_0x376e11[_0x9284('0xa')]]['answertime']):0x0;writeDB(channels[_0x376e11[_0x9284('0xa')]]);}}catch(_0x565102){utils['error'](util[_0x9284('0x8')]('[%s][calls][hangup]',_0x376e11[_0x9284('0xa')]),_0x565102);}};exports[_0x9284('0x34')]=function(_0x36518a){try{if(!_[_0x9284('0x23')](channels[_0x36518a[_0x9284('0x35')]])){utils[_0x9284('0x19')](util[_0x9284('0x8')]('[%s][calls][attendedtransfer]',_0x36518a[_0x9284('0x36')]),_0x36518a);if(channels[_0x36518a[_0x9284('0x35')]]['channel']==_0x36518a[_0x9284('0x37')]){utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x38'),_0x36518a['origtransfereruniqueid'],_0x36518a['localtwolinkedid'],_0x36518a[_0x9284('0x39')]));channels[_0x36518a[_0x9284('0x35')]][_0x9284('0x29')]=_0x36518a[_0x9284('0x39')];channels[_0x36518a[_0x9284('0x35')]][_0x9284('0x3a')]=_0x9284('0x3b');}else if(channels[_0x36518a[_0x9284('0x35')]]['channel']=_0x36518a[_0x9284('0x3c')]){utils['info'](util[_0x9284('0x8')](_0x9284('0x38'),_0x36518a['origtransfereruniqueid'],_0x36518a['localtwolinkedid'],_0x36518a[_0x9284('0x3d')]));channels[_0x36518a[_0x9284('0x35')]][_0x9284('0x29')]=_0x36518a[_0x9284('0x3d')];channels[_0x36518a[_0x9284('0x35')]]['userfield']='_attended';}}}catch(_0x49c940){utils[_0x9284('0x1f')](util[_0x9284('0x8')](_0x9284('0x3e'),_0x36518a[_0x9284('0x36')]),_0x49c940);}};exports[_0x9284('0x3f')]=function(_0x5df017){try{if(!_['isNil'](channels[_0x5df017[_0x9284('0xa')]])){utils['debug'](util[_0x9284('0x8')]('[%s][calls][musiconholdstart]',_0x5df017['uniqueid']),_0x5df017);channels[_0x5df017[_0x9284('0xa')]][_0x9284('0x40')]=utils[_0x9284('0x26')]();utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x41'),_0x5df017[_0x9284('0xa')],channels[_0x5df017[_0x9284('0xa')]][_0x9284('0x40')]));}}catch(_0x549ed4){utils[_0x9284('0x1f')](util['format'](_0x9284('0x42'),_0x5df017[_0x9284('0xa')]),_0x549ed4);}};exports['musiconholdstop']=function(_0x2d3f5a){try{if(!_['isNil'](channels[_0x2d3f5a['uniqueid']])){utils[_0x9284('0x19')](util[_0x9284('0x8')](_0x9284('0x43'),_0x2d3f5a[_0x9284('0xa')]),_0x2d3f5a);if(!_[_0x9284('0x23')](channels[_0x2d3f5a[_0x9284('0xa')]]['musiconholdstartAt'])){channels[_0x2d3f5a[_0x9284('0xa')]][_0x9284('0x44')]+=utils[_0x9284('0x32')](utils[_0x9284('0x26')](),channels[_0x2d3f5a[_0x9284('0xa')]]['musiconholdstartAt']);utils['info'](util[_0x9284('0x8')](_0x9284('0x45'),_0x2d3f5a['uniqueid'],channels[_0x2d3f5a[_0x9284('0xa')]][_0x9284('0x44')]));delete channels[_0x2d3f5a[_0x9284('0xa')]][_0x9284('0x40')];}}}catch(_0x40c213){utils[_0x9284('0x1f')](util[_0x9284('0x8')](_0x9284('0x43'),_0x2d3f5a['uniqueid']),_0x40c213);}};exports[_0x9284('0x46')]=function(_0x8695d8){try{if(!_[_0x9284('0x23')](channels[_0x8695d8[_0x9284('0xa')]])){utils[_0x9284('0x19')](util[_0x9284('0x8')]('[%s][calls][varset]',_0x8695d8[_0x9284('0xa')]),_0x8695d8);if(!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x48')])){utils[_0x9284('0x7')](util[_0x9284('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x8695d8[_0x9284('0xa')],_0x8695d8['value']));channels[_0x8695d8['uniqueid']][_0x9284('0x49')]=_0x8695d8[_0x9284('0x4a')];}if(!_['isNil'](_0x8695d8['variable']['xmd-phone'])){utils[_0x9284('0x7')](util['format'](_0x9284('0x4b'),_0x8695d8[_0x9284('0xa')],_0x8695d8[_0x9284('0x4a')]));channels[_0x8695d8[_0x9284('0xa')]][_0x9284('0x4c')]=_0x8695d8[_0x9284('0x4a')];channels[_0x8695d8[_0x9284('0xa')]][_0x9284('0x2e')]='\x22'+_0x8695d8[_0x9284('0x4a')]+_0x9284('0x4d')+_0x8695d8['value']+'>';}if(!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x4e')])||!_[_0x9284('0x23')](_0x8695d8['variable'][_0x9284('0x4f')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x8695d8[_0x9284('0xa')],!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x4e')])?_0x9284('0x4e'):'xmd-callerid',_0x8695d8[_0x9284('0x4a')]));channels[_0x8695d8[_0x9284('0xa')]]['callerid']=_0x8695d8[_0x9284('0x4a')];}if(!_['isNil'](_0x8695d8[_0x9284('0x47')][_0x9284('0x50')])||!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x51')])){utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x52'),_0x8695d8['uniqueid'],!_[_0x9284('0x23')](_0x8695d8['variable']['xmd-queue'])?_0x9284('0x50'):_0x9284('0x51'),_0x8695d8[_0x9284('0x4a')]));channels[_0x8695d8[_0x9284('0xa')]][_0x9284('0x53')]=_0x9284('0x54');channels[_0x8695d8[_0x9284('0xa')]][_0x9284('0x55')]=_0x8695d8['value'];channels[_0x8695d8[_0x9284('0xa')]][_0x9284('0xc')]=!![];}if(!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')]['xmd-contactid'])){utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x56'),_0x8695d8[_0x9284('0xa')],_0x8695d8['value']));channels[_0x8695d8['uniqueid']][_0x9284('0x57')]=_0x8695d8[_0x9284('0x4a')];}if(!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x58')])){utils[_0x9284('0x7')](util['format'](_0x9284('0x59'),_0x8695d8['uniqueid'],_0x8695d8[_0x9284('0x4a')]));channels[_0x8695d8[_0x9284('0xa')]][_0x9284('0x5a')]=_0x8695d8['value'];}if(!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x5b')])){utils[_0x9284('0x7')](util[_0x9284('0x8')](_0x9284('0x5c'),_0x8695d8[_0x9284('0xa')],_0x8695d8[_0x9284('0x4a')]));channels[_0x8695d8[_0x9284('0xa')]]['routeid']=_0x8695d8[_0x9284('0x4a')];}if(!_[_0x9284('0x23')](_0x8695d8[_0x9284('0x47')][_0x9284('0x5d')])){utils[_0x9284('0x7')](util[_0x9284('0x8')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x8695d8[_0x9284('0xa')],_0x8695d8[_0x9284('0x4a')]));channels[_0x8695d8[_0x9284('0xa')]]['sipcallid']=_0x8695d8[_0x9284('0x4a')];}}}catch(_0x5b63cf){utils[_0x9284('0x1f')](util[_0x9284('0x8')](_0x9284('0x5e'),_0x8695d8[_0x9284('0xa')]),_0x5b63cf);}};exports[_0x9284('0x5f')]=function(_0xdded2b){try{if(!_[_0x9284('0x23')](channels[_0xdded2b['uniqueid']])){utils[_0x9284('0x19')](util['format'](_0x9284('0x60'),_0xdded2b[_0x9284('0xa')]),_0xdded2b);utils[_0x9284('0x7')](util['format'](_0x9284('0x61'),_0xdded2b[_0x9284('0xa')],_0xdded2b[_0x9284('0x62')],_0xdded2b[_0x9284('0x63')]));if(_0xdded2b[_0x9284('0x62')][_0x9284('0x64')]()=='set'&&_[_0x9284('0x65')](_0xdded2b[_0x9284('0x63')][_0x9284('0x64')](),_0x9284('0x66'))){var _0x1b5eb5=_0xdded2b['appdata'][_0x9284('0x67')]('=');var _0x4e7592=_0x1b5eb5[0x0]['substring'](_0x1b5eb5[0x0]['lastIndexOf']('(')+0x1,_0x1b5eb5[0x0][_0x9284('0x68')](')'));var _0x317624=_0x1b5eb5[0x1];channels[_0xdded2b[_0x9284('0xa')]][_0x4e7592]=_0x317624;}if(!_[_0x9284('0x69')]([_0x9284('0x2c'),_0x9284('0x6a'),_0x9284('0x6b'),_0x9284('0x6c'),_0x9284('0x6d')],_0xdded2b['application'][_0x9284('0x64')]())){channels[_0xdded2b[_0x9284('0xa')]][_0x9284('0x53')]=_0xdded2b[_0x9284('0x62')];channels[_0xdded2b[_0x9284('0xa')]][_0x9284('0x55')]=_0xdded2b['appdata'];}}}catch(_0x13292a){utils[_0x9284('0x1f')](util[_0x9284('0x8')](_0x9284('0x60'),_0xdded2b[_0x9284('0xa')]),_0x13292a);}}; \ No newline at end of file +var _0xdc65=['origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','substring','lastIndexOf','noop','execif','set','gotoif','[%s][calls][newexten]','util','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','debug','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','channel','now','DOCUMENTATION','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','channelstate','ANSWERED','hangup','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','billableseconds','[%s][calls][hangup]','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended'];(function(_0x4d2a1d,_0x547e52){var _0x3e75ca=function(_0x4da669){while(--_0x4da669){_0x4d2a1d['push'](_0x4d2a1d['shift']());}};_0x3e75ca(++_0x547e52);}(_0xdc65,0x9f));var _0x5dc6=function(_0x582e59,_0x5380ce){_0x582e59=_0x582e59-0x0;var _0x5e4c8f=_0xdc65[_0x582e59];return _0x5e4c8f;};'use strict';var _=require('lodash');var util=require(_0x5dc6('0x0'));var utils=require('./utils');var dispositions=[_0x5dc6('0x1'),_0x5dc6('0x2'),'FAILED','NO\x20ANSWER',_0x5dc6('0x1'),_0x5dc6('0x1'),'ANSWERED',_0x5dc6('0x3'),'FAILED',_0x5dc6('0x2'),'FAILED'];var channels={};function writeDB(_0x5775df){utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x6'),_0x5775df[_0x5dc6('0x7')],_0x5775df['channel'],_0x5775df[_0x5dc6('0x8')],_0x5775df[_0x5dc6('0x9')],_0x5775df[_0x5dc6('0xa')],_0x5775df['calleridnum'],_0x5775df[_0x5dc6('0xb')],_0x5775df['lastevent']));if(_0x5775df[_0x5dc6('0xc')]){utils[_0x5dc6('0xd')](_0x5775df[_0x5dc6('0xc')])['then'](function(_0x458872){if(_0x458872){_0x5775df[_0x5dc6('0xe')]=_0x458872['id'];}utils[_0x5dc6('0xf')](_0x5dc6('0x10'),_0x5775df);});}else{utils[_0x5dc6('0xf')](_0x5dc6('0x10'),_0x5775df);}if(channels[_0x5775df[_0x5dc6('0x7')]]){delete channels[_0x5775df['uniqueid']];}}exports[_0x5dc6('0x11')]=function(_0x4b4c5a){try{utils[_0x5dc6('0x12')](util[_0x5dc6('0x5')]('[%s][calls][newchannel]',_0x4b4c5a['uniqueid']),_0x4b4c5a);if(_0x4b4c5a[_0x5dc6('0x7')]==_0x4b4c5a['linkedid']&&_0x4b4c5a['channel']!=_0x5dc6('0x13')){utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x14'),_0x4b4c5a['uniqueid'],_0x4b4c5a[_0x5dc6('0x15')],_0x4b4c5a[_0x5dc6('0x16')]));channels[_0x4b4c5a[_0x5dc6('0x7')]]={'uniqueid':_0x4b4c5a[_0x5dc6('0x7')],'accountcode':_0x4b4c5a[_0x5dc6('0xc')],'source':_0x4b4c5a[_0x5dc6('0x17')],'destination':_0x4b4c5a['exten'],'destinationcontext':_0x4b4c5a[_0x5dc6('0x15')],'channel':_0x4b4c5a[_0x5dc6('0x18')],'starttime':utils[_0x5dc6('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5dc6('0x1'),'amaflags':_0x5dc6('0x1a')};}}catch(_0x178408){utils[_0x5dc6('0x1b')](util[_0x5dc6('0x5')](_0x5dc6('0x1c'),_0x4b4c5a['uniqueid']),_0x178408);}};exports[_0x5dc6('0x1d')]=function(_0x13b506){try{utils[_0x5dc6('0x12')](util['format'](_0x5dc6('0x1e'),_0x13b506[_0x5dc6('0x7')]),_0x13b506);if(!_[_0x5dc6('0x1f')](channels[_0x13b506[_0x5dc6('0x7')]])&&_0x13b506['channelstate']==0x6){utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x13b506[_0x5dc6('0x7')],_0x13b506['context'],_0x13b506[_0x5dc6('0x18')]));if(_['isNil'](channels[_0x13b506[_0x5dc6('0x7')]][_0x5dc6('0x20')])){channels[_0x13b506[_0x5dc6('0x7')]][_0x5dc6('0x20')]=utils['now']();}}else if(!_[_0x5dc6('0x1f')](channels[_0x13b506[_0x5dc6('0x21')]])&&_0x13b506['channelstate']==0x6&&_0x13b506['context']!=_0x5dc6('0x22')){utils['info'](util[_0x5dc6('0x5')](_0x5dc6('0x23'),_0x13b506[_0x5dc6('0x7')],_0x13b506['linkedid'],_0x13b506[_0x5dc6('0x15')],_0x13b506[_0x5dc6('0x18')]));channels[_0x13b506[_0x5dc6('0x21')]][_0x5dc6('0xc')]=_0x13b506['accountcode'];channels[_0x13b506[_0x5dc6('0x21')]]['destinationchannel']=_0x13b506[_0x5dc6('0x18')];if(_[_0x5dc6('0x1f')](channels[_0x13b506['linkedid']][_0x5dc6('0x24')])){channels[_0x13b506[_0x5dc6('0x21')]]['answertime']=utils['now']();}channels[_0x13b506[_0x5dc6('0x21')]][_0x5dc6('0x25')]=dispositions[_[_0x5dc6('0x26')](_0x13b506[_0x5dc6('0x27')])]||_0x5dc6('0x28');}}catch(_0xc82347){utils['error'](util[_0x5dc6('0x5')](_0x5dc6('0x1e'),_0x13b506['uniqueid']),_0xc82347);}};exports[_0x5dc6('0x29')]=function(_0x123b04){try{if(!_[_0x5dc6('0x1f')](channels[_0x123b04[_0x5dc6('0x7')]])){utils[_0x5dc6('0x12')](util[_0x5dc6('0x5')]('[%s][calls][hangup]',_0x123b04[_0x5dc6('0x7')]),_0x123b04);if(_[_0x5dc6('0x1f')](channels[_0x123b04[_0x5dc6('0x7')]][_0x5dc6('0x2a')])){channels[_0x123b04['uniqueid']]['callerid']=_0x123b04[_0x5dc6('0x2b')]+'\x20<'+_0x123b04[_0x5dc6('0x17')]+'>';}utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x123b04['uniqueid'],channels[_0x123b04[_0x5dc6('0x7')]]['callerid'],_0x123b04[_0x5dc6('0x2c')]));channels[_0x123b04['uniqueid']][_0x5dc6('0x2d')]=utils[_0x5dc6('0x19')]();channels[_0x123b04['uniqueid']][_0x5dc6('0x2e')]=utils[_0x5dc6('0x2f')](channels[_0x123b04[_0x5dc6('0x7')]][_0x5dc6('0x2d')],channels[_0x123b04[_0x5dc6('0x7')]][_0x5dc6('0x30')]);channels[_0x123b04[_0x5dc6('0x7')]][_0x5dc6('0x31')]=channels[_0x123b04['uniqueid']][_0x5dc6('0x24')]?utils[_0x5dc6('0x2f')](channels[_0x123b04[_0x5dc6('0x7')]][_0x5dc6('0x2d')],channels[_0x123b04[_0x5dc6('0x7')]][_0x5dc6('0x24')]):0x0;writeDB(channels[_0x123b04[_0x5dc6('0x7')]]);}}catch(_0x2bf9f8){utils[_0x5dc6('0x1b')](util[_0x5dc6('0x5')](_0x5dc6('0x32'),_0x123b04[_0x5dc6('0x7')]),_0x2bf9f8);}};exports['attendedtransfer']=function(_0x185f6d){try{if(!_['isNil'](channels[_0x185f6d[_0x5dc6('0x33')]])){utils['debug'](util[_0x5dc6('0x5')]('[%s][calls][attendedtransfer]',_0x185f6d[_0x5dc6('0x34')]),_0x185f6d);if(channels[_0x185f6d[_0x5dc6('0x33')]][_0x5dc6('0x18')]==_0x185f6d[_0x5dc6('0x35')]){utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x36'),_0x185f6d['origtransfereruniqueid'],_0x185f6d[_0x5dc6('0x33')],_0x185f6d[_0x5dc6('0x37')]));channels[_0x185f6d[_0x5dc6('0x33')]][_0x5dc6('0x38')]=_0x185f6d['secondtransfererchannel'];channels[_0x185f6d[_0x5dc6('0x33')]][_0x5dc6('0x39')]=_0x5dc6('0x3a');}else if(channels[_0x185f6d[_0x5dc6('0x33')]][_0x5dc6('0x18')]=_0x185f6d['transfertargetchannel']){utils['info'](util[_0x5dc6('0x5')](_0x5dc6('0x36'),_0x185f6d[_0x5dc6('0x34')],_0x185f6d[_0x5dc6('0x33')],_0x185f6d[_0x5dc6('0x3b')]));channels[_0x185f6d[_0x5dc6('0x33')]]['destinationchannel']=_0x185f6d[_0x5dc6('0x3b')];channels[_0x185f6d['localtwolinkedid']][_0x5dc6('0x39')]=_0x5dc6('0x3a');}}}catch(_0x4ccdf6){utils[_0x5dc6('0x1b')](util[_0x5dc6('0x5')](_0x5dc6('0x3c'),_0x185f6d[_0x5dc6('0x34')]),_0x4ccdf6);}};exports['musiconholdstart']=function(_0x44b215){try{if(!_[_0x5dc6('0x1f')](channels[_0x44b215['uniqueid']])){utils[_0x5dc6('0x12')](util[_0x5dc6('0x5')]('[%s][calls][musiconholdstart]',_0x44b215[_0x5dc6('0x7')]),_0x44b215);channels[_0x44b215[_0x5dc6('0x7')]][_0x5dc6('0x3d')]=utils[_0x5dc6('0x19')]();utils['info'](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x44b215[_0x5dc6('0x7')],channels[_0x44b215[_0x5dc6('0x7')]][_0x5dc6('0x3d')]));}}catch(_0x3154b5){utils[_0x5dc6('0x1b')](util['format'](_0x5dc6('0x3e'),_0x44b215[_0x5dc6('0x7')]),_0x3154b5);}};exports[_0x5dc6('0x3f')]=function(_0x2c3afe){try{if(!_[_0x5dc6('0x1f')](channels[_0x2c3afe[_0x5dc6('0x7')]])){utils[_0x5dc6('0x12')](util[_0x5dc6('0x5')](_0x5dc6('0x40'),_0x2c3afe[_0x5dc6('0x7')]),_0x2c3afe);if(!_[_0x5dc6('0x1f')](channels[_0x2c3afe['uniqueid']][_0x5dc6('0x3d')])){channels[_0x2c3afe['uniqueid']][_0x5dc6('0x41')]+=utils[_0x5dc6('0x2f')](utils['now'](),channels[_0x2c3afe['uniqueid']]['musiconholdstartAt']);utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x42'),_0x2c3afe['uniqueid'],channels[_0x2c3afe[_0x5dc6('0x7')]]['mohtime']));delete channels[_0x2c3afe[_0x5dc6('0x7')]]['musiconholdstartAt'];}}}catch(_0x320539){utils[_0x5dc6('0x1b')](util[_0x5dc6('0x5')](_0x5dc6('0x40'),_0x2c3afe[_0x5dc6('0x7')]),_0x320539);}};exports['varset']=function(_0x261124){try{if(!_['isNil'](channels[_0x261124[_0x5dc6('0x7')]])){utils[_0x5dc6('0x12')](util[_0x5dc6('0x5')]('[%s][calls][varset]',_0x261124[_0x5dc6('0x7')]),_0x261124);if(!_[_0x5dc6('0x1f')](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x44')])){utils['info'](util[_0x5dc6('0x5')](_0x5dc6('0x45'),_0x261124[_0x5dc6('0x7')],_0x261124[_0x5dc6('0x46')]));channels[_0x261124[_0x5dc6('0x7')]][_0x5dc6('0x47')]=_0x261124[_0x5dc6('0x46')];}if(!_[_0x5dc6('0x1f')](_0x261124['variable'][_0x5dc6('0x48')])){utils[_0x5dc6('0x4')](util['format'](_0x5dc6('0x49'),_0x261124['uniqueid'],_0x261124['value']));channels[_0x261124['uniqueid']][_0x5dc6('0x4a')]=_0x261124['value'];channels[_0x261124['uniqueid']][_0x5dc6('0x2a')]='\x22'+_0x261124[_0x5dc6('0x46')]+_0x5dc6('0x4b')+_0x261124[_0x5dc6('0x46')]+'>';}if(!_[_0x5dc6('0x1f')](_0x261124['variable']['xmd-callerid-preview'])||!_['isNil'](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x4c')])){utils['info'](util[_0x5dc6('0x5')](_0x5dc6('0x4d'),_0x261124[_0x5dc6('0x7')],!_[_0x5dc6('0x1f')](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x4e')])?_0x5dc6('0x4e'):_0x5dc6('0x4c'),_0x261124[_0x5dc6('0x46')]));channels[_0x261124[_0x5dc6('0x7')]][_0x5dc6('0x2a')]=_0x261124['value'];}if(!_['isNil'](_0x261124['variable'][_0x5dc6('0x4f')])||!_[_0x5dc6('0x1f')](_0x261124[_0x5dc6('0x43')]['xmcs-queue'])){utils[_0x5dc6('0x4')](util['format'](_0x5dc6('0x4d'),_0x261124[_0x5dc6('0x7')],!_['isNil'](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x4f')])?'xmd-queue':_0x5dc6('0x50'),_0x261124[_0x5dc6('0x46')]));channels[_0x261124['uniqueid']][_0x5dc6('0x51')]=_0x5dc6('0x52');channels[_0x261124[_0x5dc6('0x7')]][_0x5dc6('0x53')]=_0x261124['value'];channels[_0x261124['uniqueid']][_0x5dc6('0x8')]=!![];}if(!_[_0x5dc6('0x1f')](_0x261124['variable'][_0x5dc6('0x54')])){utils['info'](util[_0x5dc6('0x5')](_0x5dc6('0x55'),_0x261124[_0x5dc6('0x7')],_0x261124[_0x5dc6('0x46')]));channels[_0x261124[_0x5dc6('0x7')]][_0x5dc6('0x56')]=_0x261124[_0x5dc6('0x46')];}if(!_[_0x5dc6('0x1f')](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x57')])){utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x58'),_0x261124[_0x5dc6('0x7')],_0x261124[_0x5dc6('0x46')]));channels[_0x261124[_0x5dc6('0x7')]][_0x5dc6('0x59')]=_0x261124[_0x5dc6('0x46')];}if(!_[_0x5dc6('0x1f')](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x5a')])){utils[_0x5dc6('0x4')](util['format'](_0x5dc6('0x5b'),_0x261124[_0x5dc6('0x7')],_0x261124[_0x5dc6('0x46')]));channels[_0x261124['uniqueid']][_0x5dc6('0x5c')]=_0x261124[_0x5dc6('0x46')];}if(!_[_0x5dc6('0x1f')](_0x261124[_0x5dc6('0x43')][_0x5dc6('0x5d')])){utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x5e'),_0x261124[_0x5dc6('0x7')],_0x261124[_0x5dc6('0x46')]));channels[_0x261124['uniqueid']][_0x5dc6('0x5d')]=_0x261124[_0x5dc6('0x46')];}}}catch(_0x21e6e8){utils['error'](util[_0x5dc6('0x5')]('[%s][calls][varset]',_0x261124['uniqueid']),_0x21e6e8);}};exports[_0x5dc6('0x5f')]=function(_0x4d3b49){try{if(!_[_0x5dc6('0x1f')](channels[_0x4d3b49['uniqueid']])){utils[_0x5dc6('0x12')](util['format']('[%s][calls][newexten]',_0x4d3b49[_0x5dc6('0x7')]),_0x4d3b49);utils[_0x5dc6('0x4')](util[_0x5dc6('0x5')](_0x5dc6('0x60'),_0x4d3b49[_0x5dc6('0x7')],_0x4d3b49[_0x5dc6('0x61')],_0x4d3b49[_0x5dc6('0x62')]));if(_0x4d3b49[_0x5dc6('0x61')][_0x5dc6('0x63')]()=='set'&&_['startsWith'](_0x4d3b49[_0x5dc6('0x62')][_0x5dc6('0x63')](),_0x5dc6('0x64'))){var _0x429c64=_0x4d3b49['appdata'][_0x5dc6('0x65')]('=');var _0x2bb699=_0x429c64[0x0][_0x5dc6('0x66')](_0x429c64[0x0][_0x5dc6('0x67')]('(')+0x1,_0x429c64[0x0][_0x5dc6('0x67')](')'));var _0xec5da7=_0x429c64[0x1];channels[_0x4d3b49[_0x5dc6('0x7')]][_0x2bb699]=_0xec5da7;}if(!_['includes']([_0x5dc6('0x29'),_0x5dc6('0x68'),_0x5dc6('0x69'),_0x5dc6('0x6a'),_0x5dc6('0x6b')],_0x4d3b49[_0x5dc6('0x61')][_0x5dc6('0x63')]())){channels[_0x4d3b49['uniqueid']][_0x5dc6('0x51')]=_0x4d3b49[_0x5dc6('0x61')];channels[_0x4d3b49[_0x5dc6('0x7')]][_0x5dc6('0x53')]=_0x4d3b49[_0x5dc6('0x62')];}}}catch(_0x4a7bf2){utils['error'](util[_0x5dc6('0x5')](_0x5dc6('0x6c'),_0x4d3b49[_0x5dc6('0x7')]),_0x4a7bf2);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 7235731..d487188 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 _0xe359=['connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','./utils'];(function(_0x548f33,_0x25527b){var _0x442192=function(_0xc289d7){while(--_0xc289d7){_0x548f33['push'](_0x548f33['shift']());}};_0x442192(++_0x25527b);}(_0xe359,0x9b));var _0x9e35=function(_0x541e90,_0x54d144){_0x541e90=_0x541e90-0x0;var _0x29ea15=_0xe359[_0x541e90];return _0x29ea15;};'use strict';var utils=require(_0x9e35('0x0'));exports[_0x9e35('0x1')]=function(){utils[_0x9e35('0x2')](_0x9e35('0x3'));};exports[_0x9e35('0x4')]=function(){utils[_0x9e35('0x2')](_0x9e35('0x5'));};exports[_0x9e35('0x6')]=function(){utils[_0x9e35('0x2')](_0x9e35('0x7'));};exports['error']=function(_0x2cc1cd){utils[_0x9e35('0x8')](_0x9e35('0x9'),_0x2cc1cd);};exports[_0x9e35('0xa')]=function(){utils[_0x9e35('0x2')](_0x9e35('0xb'));};exports['managerevent']=function(_0x3b623a){}; \ No newline at end of file +var _0xf1e5=['./utils','info','shutdown','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x12514c,_0x4e394c){var _0x39ebe5=function(_0x16105e){while(--_0x16105e){_0x12514c['push'](_0x12514c['shift']());}};_0x39ebe5(++_0x4e394c);}(_0xf1e5,0x70));var _0x5f1e=function(_0x122d03,_0x3dc975){_0x122d03=_0x122d03-0x0;var _0x5dd107=_0xf1e5[_0x122d03];return _0x5dd107;};'use strict';var utils=require(_0x5f1e('0x0'));exports['connect']=function(){utils[_0x5f1e('0x1')]('[core]\x20connected');};exports[_0x5f1e('0x2')]=function(){utils[_0x5f1e('0x1')]('[core]\x20shutdown');};exports['fullybooted']=function(){utils[_0x5f1e('0x1')](_0x5f1e('0x3'));};exports[_0x5f1e('0x4')]=function(_0x40e543){utils['error'](_0x5f1e('0x5'),_0x40e543);};exports[_0x5f1e('0x6')]=function(){utils[_0x5f1e('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x15529a){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e8f1c08..657343a 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 _0xd118=['channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','cdr(routeid)','split','error','varset','debug','[%s][dials][varset]','isNil','outboundrouteid','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridname','cause-txt','complete','endtime','holdtime','billableseconds','diffTime','lodash','util','./utils','info','format','uniqueid'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd118,0x11a));var _0x8d11=function(_0x2c032f,_0x1f1ce6){_0x2c032f=_0x2c032f-0x0;var _0x40fe6d=_0xd118[_0x2c032f];return _0x40fe6d;};'use strict';var _=require(_0x8d11('0x0'));var util=require(_0x8d11('0x1'));var utils=require(_0x8d11('0x2'));var dials={};function writeDB(_0x2b731f){utils[_0x8d11('0x3')](util[_0x8d11('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2b731f[_0x8d11('0x5')],_0x2b731f[_0x8d11('0x6')],_0x2b731f[_0x8d11('0x7')],_0x2b731f[_0x8d11('0x8')],_0x2b731f['connectedlinenum'],_0x2b731f[_0x8d11('0x9')]));utils[_0x8d11('0xa')](_0x8d11('0xb'),_0x2b731f);delete dials[_0x2b731f[_0x8d11('0x5')]];}exports[_0x8d11('0xc')]=function(_0x54535e){try{utils['debug'](util[_0x8d11('0x4')](_0x8d11('0xd'),_0x54535e[_0x8d11('0x5')]),_0x54535e);utils['info'](util[_0x8d11('0x4')](_0x8d11('0xe'),_0x54535e[_0x8d11('0x5')],_0x54535e['application'],_0x54535e[_0x8d11('0xf')]));if(_0x54535e[_0x8d11('0x10')][_0x8d11('0x11')]()==_0x8d11('0x12')&&_['startsWith'](_0x54535e[_0x8d11('0xf')][_0x8d11('0x11')](),_0x8d11('0x13'))){var _0x580daf=_0x54535e['appdata'][_0x8d11('0x14')]('=');dials[_0x54535e[_0x8d11('0x5')]]={'routeId':_0x580daf[0x1]};}}catch(_0x35949e){utils[_0x8d11('0x15')](util[_0x8d11('0x4')](_0x8d11('0xd'),_0x54535e[_0x8d11('0x5')]),_0x35949e);}};exports[_0x8d11('0x16')]=function(_0x1b3bf7){try{utils[_0x8d11('0x17')](util['format'](_0x8d11('0x18'),_0x1b3bf7[_0x8d11('0x5')]),_0x1b3bf7);if(!_[_0x8d11('0x19')](_0x1b3bf7['variable'][_0x8d11('0x1a')])){utils[_0x8d11('0x3')](util[_0x8d11('0x4')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1b3bf7[_0x8d11('0x5')],_0x1b3bf7[_0x8d11('0x1b')]));dials[_0x1b3bf7[_0x8d11('0x5')]]={'routeId':_0x1b3bf7[_0x8d11('0x1b')]};}}catch(_0x2a8c4c){utils[_0x8d11('0x15')](util['format'](_0x8d11('0x18'),_0x1b3bf7[_0x8d11('0x5')]),_0x2a8c4c);}};exports['dialbegin']=function(_0xaafc27){try{if(!_[_0x8d11('0x19')](dials[_0xaafc27['uniqueid']])){utils[_0x8d11('0x17')](util[_0x8d11('0x4')](_0x8d11('0x1c'),_0xaafc27['uniqueid']),_0xaafc27);dials[_0xaafc27['uniqueid']]=_[_0x8d11('0x1d')](dials[_0xaafc27[_0x8d11('0x5')]],_0xaafc27);dials[_0xaafc27[_0x8d11('0x5')]][_0x8d11('0x1e')]=utils[_0x8d11('0x1f')]();dials[_0xaafc27[_0x8d11('0x5')]][_0x8d11('0x20')]='called';utils[_0x8d11('0x3')](util[_0x8d11('0x4')](_0x8d11('0x21'),_0xaafc27[_0x8d11('0x5')],dials[_0xaafc27['uniqueid']][_0x8d11('0x1e')]));}}catch(_0x693911){utils[_0x8d11('0x15')](util[_0x8d11('0x4')](_0x8d11('0x1c'),_0xaafc27[_0x8d11('0x5')]),_0x693911);}};exports[_0x8d11('0x22')]=function(_0x2581ce){try{if(!_[_0x8d11('0x19')](dials[_0x2581ce['uniqueid']])){utils[_0x8d11('0x17')](util[_0x8d11('0x4')](_0x8d11('0x23'),_0x2581ce[_0x8d11('0x5')]),_0x2581ce);dials[_0x2581ce[_0x8d11('0x5')]]['dialstatus']=_0x2581ce['dialstatus'];if(_0x2581ce[_0x8d11('0x9')]==_0x8d11('0x24')){dials[_0x2581ce[_0x8d11('0x5')]]=_[_0x8d11('0x1d')](dials[_0x2581ce['uniqueid']],_0x2581ce);dials[_0x2581ce['uniqueid']][_0x8d11('0x25')]=utils['now']();dials[_0x2581ce[_0x8d11('0x5')]]['lastevent']='connect';utils[_0x8d11('0x3')](util['format'](_0x8d11('0x26'),_0x2581ce[_0x8d11('0x5')],_0x2581ce[_0x8d11('0x9')],dials[_0x2581ce[_0x8d11('0x5')]]['answertime']));}else{utils['info'](util['format'](_0x8d11('0x27'),_0x2581ce['uniqueid'],_0x2581ce[_0x8d11('0x9')]));}}}catch(_0x6b16cd){utils[_0x8d11('0x15')](util['format']('[%s][dials][dialend]',_0x2581ce[_0x8d11('0x5')]),_0x6b16cd);}};exports['hangup']=function(_0x4c274b){try{if(!_[_0x8d11('0x19')](dials[_0x4c274b[_0x8d11('0x5')]])){utils[_0x8d11('0x17')](util['format'](_0x8d11('0x28'),_0x4c274b[_0x8d11('0x5')]),_0x4c274b);utils[_0x8d11('0x3')](util[_0x8d11('0x4')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x4c274b['uniqueid'],_0x4c274b[_0x8d11('0x8')],_0x4c274b[_0x8d11('0x29')],_0x4c274b[_0x8d11('0x2a')]));dials[_0x4c274b[_0x8d11('0x5')]]=_[_0x8d11('0x1d')](dials[_0x4c274b[_0x8d11('0x5')]],{'endtime':utils[_0x8d11('0x1f')](),'lastevent':_0x8d11('0x2b')});dials[_0x4c274b[_0x8d11('0x5')]]['duration']=utils['diffTime'](dials[_0x4c274b['uniqueid']][_0x8d11('0x2c')],dials[_0x4c274b[_0x8d11('0x5')]][_0x8d11('0x1e')]);dials[_0x4c274b['uniqueid']][_0x8d11('0x2d')]=utils['diffTime'](dials[_0x4c274b[_0x8d11('0x5')]]['answertime']||dials[_0x4c274b[_0x8d11('0x5')]][_0x8d11('0x2c')],dials[_0x4c274b[_0x8d11('0x5')]][_0x8d11('0x1e')]);dials[_0x4c274b[_0x8d11('0x5')]][_0x8d11('0x2e')]=dials[_0x4c274b[_0x8d11('0x5')]][_0x8d11('0x25')]?utils[_0x8d11('0x2f')](dials[_0x4c274b[_0x8d11('0x5')]][_0x8d11('0x2c')],dials[_0x4c274b['uniqueid']][_0x8d11('0x25')]):0x0;writeDB(dials[_0x4c274b[_0x8d11('0x5')]]);}}catch(_0x149d60){utils[_0x8d11('0x15')](util[_0x8d11('0x4')](_0x8d11('0x28'),_0x4c274b[_0x8d11('0x5')]),_0x149d60);}}; \ No newline at end of file +var _0x9dda=['now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','duration','endtime','holdtime','diffTime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','connectedlinenum','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','split','error','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','debug','[%s][dials][dialbegin]','assign','starttime'];(function(_0x24277d,_0x5a3f0d){var _0x5b5710=function(_0x3fbe78){while(--_0x3fbe78){_0x24277d['push'](_0x24277d['shift']());}};_0x5b5710(++_0x5a3f0d);}(_0x9dda,0x1e9));var _0xa9dd=function(_0x26b36d,_0x2ca82b){_0x26b36d=_0x26b36d-0x0;var _0x55f378=_0x9dda[_0x26b36d];return _0x55f378;};'use strict';var _=require(_0xa9dd('0x0'));var util=require('util');var utils=require(_0xa9dd('0x1'));var dials={};function writeDB(_0x3edc65){utils[_0xa9dd('0x2')](util[_0xa9dd('0x3')](_0xa9dd('0x4'),_0x3edc65[_0xa9dd('0x5')],_0x3edc65['channel'],_0x3edc65[_0xa9dd('0x6')],_0x3edc65['calleridnum'],_0x3edc65[_0xa9dd('0x7')],_0x3edc65['dialstatus']));utils['request']('CreateVoiceDialReport',_0x3edc65);delete dials[_0x3edc65[_0xa9dd('0x5')]];}exports[_0xa9dd('0x8')]=function(_0x29f358){try{utils['debug'](util[_0xa9dd('0x3')](_0xa9dd('0x9'),_0x29f358[_0xa9dd('0x5')]),_0x29f358);utils[_0xa9dd('0x2')](util[_0xa9dd('0x3')](_0xa9dd('0xa'),_0x29f358[_0xa9dd('0x5')],_0x29f358[_0xa9dd('0xb')],_0x29f358['appdata']));if(_0x29f358['application'][_0xa9dd('0xc')]()==_0xa9dd('0xd')&&_['startsWith'](_0x29f358[_0xa9dd('0xe')][_0xa9dd('0xc')](),_0xa9dd('0xf'))){var _0x1dacbe=_0x29f358[_0xa9dd('0xe')][_0xa9dd('0x10')]('=');dials[_0x29f358[_0xa9dd('0x5')]]={'routeId':_0x1dacbe[0x1]};}}catch(_0x924b77){utils[_0xa9dd('0x11')](util[_0xa9dd('0x3')]('[%s][dials][newexten]',_0x29f358[_0xa9dd('0x5')]),_0x924b77);}};exports['varset']=function(_0x47d074){try{utils['debug'](util['format'](_0xa9dd('0x12'),_0x47d074[_0xa9dd('0x5')]),_0x47d074);if(!_['isNil'](_0x47d074[_0xa9dd('0x13')][_0xa9dd('0x14')])){utils['info'](util[_0xa9dd('0x3')](_0xa9dd('0x15'),_0x47d074[_0xa9dd('0x5')],_0x47d074[_0xa9dd('0x16')]));dials[_0x47d074[_0xa9dd('0x5')]]={'routeId':_0x47d074[_0xa9dd('0x16')]};}}catch(_0x474d4b){utils['error'](util['format'](_0xa9dd('0x12'),_0x47d074[_0xa9dd('0x5')]),_0x474d4b);}};exports['dialbegin']=function(_0x3e805a){try{if(!_[_0xa9dd('0x17')](dials[_0x3e805a[_0xa9dd('0x5')]])){utils[_0xa9dd('0x18')](util['format'](_0xa9dd('0x19'),_0x3e805a[_0xa9dd('0x5')]),_0x3e805a);dials[_0x3e805a['uniqueid']]=_[_0xa9dd('0x1a')](dials[_0x3e805a[_0xa9dd('0x5')]],_0x3e805a);dials[_0x3e805a['uniqueid']][_0xa9dd('0x1b')]=utils[_0xa9dd('0x1c')]();dials[_0x3e805a[_0xa9dd('0x5')]]['lastevent']=_0xa9dd('0x1d');utils[_0xa9dd('0x2')](util[_0xa9dd('0x3')](_0xa9dd('0x1e'),_0x3e805a[_0xa9dd('0x5')],dials[_0x3e805a[_0xa9dd('0x5')]][_0xa9dd('0x1b')]));}}catch(_0x585f8e){utils['error'](util[_0xa9dd('0x3')](_0xa9dd('0x19'),_0x3e805a['uniqueid']),_0x585f8e);}};exports['dialend']=function(_0x953bcc){try{if(!_[_0xa9dd('0x17')](dials[_0x953bcc[_0xa9dd('0x5')]])){utils[_0xa9dd('0x18')](util['format'](_0xa9dd('0x1f'),_0x953bcc[_0xa9dd('0x5')]),_0x953bcc);dials[_0x953bcc[_0xa9dd('0x5')]][_0xa9dd('0x20')]=_0x953bcc[_0xa9dd('0x20')];if(_0x953bcc[_0xa9dd('0x20')]==_0xa9dd('0x21')){dials[_0x953bcc[_0xa9dd('0x5')]]=_[_0xa9dd('0x1a')](dials[_0x953bcc[_0xa9dd('0x5')]],_0x953bcc);dials[_0x953bcc[_0xa9dd('0x5')]]['answertime']=utils['now']();dials[_0x953bcc[_0xa9dd('0x5')]][_0xa9dd('0x22')]=_0xa9dd('0x23');utils[_0xa9dd('0x2')](util[_0xa9dd('0x3')](_0xa9dd('0x24'),_0x953bcc[_0xa9dd('0x5')],_0x953bcc[_0xa9dd('0x20')],dials[_0x953bcc['uniqueid']][_0xa9dd('0x25')]));}else{utils['info'](util[_0xa9dd('0x3')](_0xa9dd('0x26'),_0x953bcc[_0xa9dd('0x5')],_0x953bcc[_0xa9dd('0x20')]));}}}catch(_0x9ff710){utils['error'](util[_0xa9dd('0x3')]('[%s][dials][dialend]',_0x953bcc['uniqueid']),_0x9ff710);}};exports['hangup']=function(_0x23b935){try{if(!_[_0xa9dd('0x17')](dials[_0x23b935[_0xa9dd('0x5')]])){utils[_0xa9dd('0x18')](util['format']('[%s][dials][hangup]',_0x23b935[_0xa9dd('0x5')]),_0x23b935);utils[_0xa9dd('0x2')](util[_0xa9dd('0x3')](_0xa9dd('0x27'),_0x23b935['uniqueid'],_0x23b935[_0xa9dd('0x28')],_0x23b935[_0xa9dd('0x29')],_0x23b935[_0xa9dd('0x2a')]));dials[_0x23b935[_0xa9dd('0x5')]]=_['assign'](dials[_0x23b935['uniqueid']],{'endtime':utils[_0xa9dd('0x1c')](),'lastevent':'complete'});dials[_0x23b935[_0xa9dd('0x5')]][_0xa9dd('0x2b')]=utils['diffTime'](dials[_0x23b935[_0xa9dd('0x5')]][_0xa9dd('0x2c')],dials[_0x23b935[_0xa9dd('0x5')]][_0xa9dd('0x1b')]);dials[_0x23b935[_0xa9dd('0x5')]][_0xa9dd('0x2d')]=utils['diffTime'](dials[_0x23b935['uniqueid']][_0xa9dd('0x25')]||dials[_0x23b935['uniqueid']][_0xa9dd('0x2c')],dials[_0x23b935[_0xa9dd('0x5')]]['starttime']);dials[_0x23b935[_0xa9dd('0x5')]]['billableseconds']=dials[_0x23b935['uniqueid']][_0xa9dd('0x25')]?utils[_0xa9dd('0x2e')](dials[_0x23b935[_0xa9dd('0x5')]][_0xa9dd('0x2c')],dials[_0x23b935[_0xa9dd('0x5')]][_0xa9dd('0x25')]):0x0;writeDB(dials[_0x23b935[_0xa9dd('0x5')]]);}}catch(_0x21dcb0){utils[_0xa9dd('0x11')](util['format']('[%s][dials][hangup]',_0x23b935['uniqueid']),_0x21dcb0);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 587bb10..9d0b306 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 _0xffab=['hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','format','[%s][index][devicestatechange]','device','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xffab,0x12a));var _0xbffa=function(_0x202753,_0x209b89){_0x202753=_0x202753-0x0;var _0x2c4038=_0xffab[_0x202753];return _0x2c4038;};var AsteriskManager=require(_0xbffa('0x0'));var config=require(_0xbffa('0x1'));var utils=require(_0xbffa('0x2'));var util=require('util');var isXDREnabled=config[_0xbffa('0x3')]&&config['xdr'][_0xbffa('0x4')]?!config[_0xbffa('0x3')][_0xbffa('0x4')]:!![];var isProduction=config[_0xbffa('0x5')]===_0xbffa('0x6')||![];var isLocalAsterisk=config[_0xbffa('0x3')]&&config[_0xbffa('0x3')][_0xbffa('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xbffa('0x8')][_0xbffa('0x9')],config[_0xbffa('0x8')]['ip'],config['asterisk'][_0xbffa('0xa')],config[_0xbffa('0x8')][_0xbffa('0xb')],!![]);ami[_0xbffa('0xc')]();if(!isXDREnabled){utils['info'](_0xbffa('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xbffa('0xe')](_0xbffa('0xf'));}else{var agents=require(_0xbffa('0x10'));var calls=require(_0xbffa('0x11'));var queues=require(_0xbffa('0x12'));var recordings=require('./recordings.controller');var members=require(_0xbffa('0x13'));var dials=require(_0xbffa('0x14'));var transfers=require('./transfers.controller');var core=require(_0xbffa('0x15'));ami['on'](_0xbffa('0x16'),core[_0xbffa('0x16')]);ami['on'](_0xbffa('0x17'),core[_0xbffa('0x17')]);ami['on']('fullybooted',core[_0xbffa('0x18')]);ami['on'](_0xbffa('0x19'),core[_0xbffa('0x19')]);ami['on'](_0xbffa('0x1a'),core[_0xbffa('0x1a')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0xbffa('0x1b'),function(_0x331d14){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')](_0xbffa('0x1e'),_0x331d14['device']),_0x331d14);members[_0xbffa('0x1b')](_0x331d14);}catch(_0x283f7a){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x1e'),_0x331d14[_0xbffa('0x1f')]),_0x283f7a);}});ami['on']('agentcalled',function(_0x56a22b){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')]('[%s][index][agentcalled]',_0x56a22b[_0xbffa('0x20')]),_0x56a22b);agents['agentcalled'](_0x56a22b);}catch(_0x5a76c0){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x21'),_0x56a22b[_0xbffa('0x20')]),_0x5a76c0);}});ami['on'](_0xbffa('0x22'),function(_0x19447b){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')](_0xbffa('0x23'),_0x19447b['uniqueid']),_0x19447b);agents[_0xbffa('0x22')](_0x19447b);}catch(_0x17c10f){utils['error'](util[_0xbffa('0x1d')](_0xbffa('0x23'),_0x19447b['uniqueid']),_0x17c10f);}});ami['on']('agentconnect',function(_0x241295){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')]('[%s][index][agentconnect]',_0x241295[_0xbffa('0x20')]),_0x241295);agents[_0xbffa('0x24')](_0x241295);queues[_0xbffa('0x24')](_0x241295);}catch(_0x5e2bc0){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x25'),_0x241295[_0xbffa('0x20')]),_0x5e2bc0);}});ami['on'](_0xbffa('0x26'),function(_0x363048){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')](_0xbffa('0x27'),_0x363048[_0xbffa('0x20')]),_0x363048);agents['agentcomplete'](_0x363048);queues[_0xbffa('0x26')](_0x363048);members['agentcomplete'](_0x363048);}catch(_0x777d7e){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x27'),_0x363048[_0xbffa('0x20')]),_0x777d7e);}});ami['on'](_0xbffa('0x28'),function(_0x3f5b6a){try{utils['debug'](util[_0xbffa('0x1d')](_0xbffa('0x29'),_0x3f5b6a[_0xbffa('0x20')]),_0x3f5b6a);agents[_0xbffa('0x28')](_0x3f5b6a);queues[_0xbffa('0x28')](_0x3f5b6a);}catch(_0x53e5b6){utils['error'](util[_0xbffa('0x1d')](_0xbffa('0x29'),_0x3f5b6a['uniqueid']),_0x53e5b6);}});ami['on'](_0xbffa('0x2a'),function(_0x10f204){try{utils['debug'](util['format'](_0xbffa('0x2b'),_0x10f204[_0xbffa('0x20')]),_0x10f204);queues[_0xbffa('0x2a')](_0x10f204);recordings['queuecallerjoin'](_0x10f204);}catch(_0x28b9f9){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x2b'),_0x10f204['uniqueid']),_0x28b9f9);}});ami['on'](_0xbffa('0x2c'),function(_0x13eddb){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')](_0xbffa('0x2d'),_0x13eddb[_0xbffa('0x20')]),_0x13eddb);queues[_0xbffa('0x2c')](_0x13eddb);}catch(_0x505d9d){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x2d'),_0x13eddb[_0xbffa('0x20')]),_0x505d9d);}});ami['on'](_0xbffa('0x2e'),function(_0x22c40a){try{utils[_0xbffa('0x1c')](util['format']('[%s][index][musiconholdstart]',_0x22c40a[_0xbffa('0x20')]),_0x22c40a);queues[_0xbffa('0x2e')](_0x22c40a);calls['musiconholdstart'](_0x22c40a);}catch(_0x8458d5){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x2f'),_0x22c40a[_0xbffa('0x20')]),_0x8458d5);}});ami['on'](_0xbffa('0x30'),function(_0x54d63f){try{utils[_0xbffa('0x1c')](util['format']('[%s][index][musiconholdstop]',_0x54d63f[_0xbffa('0x20')]),_0x54d63f);queues[_0xbffa('0x30')](_0x54d63f);calls[_0xbffa('0x30')](_0x54d63f);}catch(_0x4c9dd6){utils[_0xbffa('0x19')](util['format'](_0xbffa('0x31'),_0x54d63f[_0xbffa('0x20')]),_0x4c9dd6);}});ami['on'](_0xbffa('0x32'),function(_0x5a8064){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')](_0xbffa('0x33'),_0x5a8064[_0xbffa('0x20')]),_0x5a8064);calls[_0xbffa('0x32')](_0x5a8064);recordings[_0xbffa('0x32')](_0x5a8064);}catch(_0x5bc961){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x33'),_0x5a8064[_0xbffa('0x20')]),_0x5bc961);}});ami['on'](_0xbffa('0x34'),function(_0x14cd3f){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')](_0xbffa('0x35'),_0x14cd3f[_0xbffa('0x20')]),_0x14cd3f);calls['hangup'](_0x14cd3f);recordings['hangup'](_0x14cd3f);dials[_0xbffa('0x34')](_0x14cd3f);agents[_0xbffa('0x34')](_0x14cd3f);queues[_0xbffa('0x34')](_0x14cd3f);}catch(_0x329ce4){utils['error'](util[_0xbffa('0x1d')]('[%s][index][hangup]',_0x14cd3f[_0xbffa('0x20')]),_0x329ce4);}});ami['on'](_0xbffa('0x36'),function(_0x13e6fe){try{utils[_0xbffa('0x1c')](util['format'](_0xbffa('0x37'),_0x13e6fe[_0xbffa('0x20')]),_0x13e6fe);members[_0xbffa('0x36')](_0x13e6fe);}catch(_0x19d89d){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x37'),_0x13e6fe['uniqueid']),_0x19d89d);}});ami['on'](_0xbffa('0x38'),function(_0x446c12){try{utils[_0xbffa('0x1c')](util['format'](_0xbffa('0x39'),_0x446c12[_0xbffa('0x20')]),_0x446c12);queues['blindtransfer'](_0x446c12);agents['blindtransfer'](_0x446c12);transfers[_0xbffa('0x38')](_0x446c12);}catch(_0x528b94){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')]('[%s][index][blindtransfer]',_0x446c12['uniqueid']),_0x528b94);}});ami['on'](_0xbffa('0x3a'),function(_0x57f25d){try{utils['debug'](util[_0xbffa('0x1d')]('[%s][index][attendedtransfer]',_0x57f25d[_0xbffa('0x3b')]),_0x57f25d);queues[_0xbffa('0x3a')](_0x57f25d);transfers[_0xbffa('0x3a')](_0x57f25d);agents['attendedtransfer'](_0x57f25d);calls[_0xbffa('0x3a')](_0x57f25d);}catch(_0x80f219){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x3c'),_0x57f25d[_0xbffa('0x3b')]),_0x80f219);}});ami['on'](_0xbffa('0x3d'),function(_0x4c7e76){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')]('[%s][index][varset]',_0x4c7e76['uniqueid']),_0x4c7e76);queues[_0xbffa('0x3d')](_0x4c7e76);recordings[_0xbffa('0x3d')](_0x4c7e76);calls['varset'](_0x4c7e76);dials[_0xbffa('0x3d')](_0x4c7e76);}catch(_0x313d38){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x3e'),_0x4c7e76[_0xbffa('0x20')]),_0x313d38);}});ami['on']('newexten',function(_0x5e1210){try{utils['debug'](util[_0xbffa('0x1d')](_0xbffa('0x3f'),_0x5e1210[_0xbffa('0x20')]),_0x5e1210);calls[_0xbffa('0x40')](_0x5e1210);recordings[_0xbffa('0x40')](_0x5e1210);dials[_0xbffa('0x40')](_0x5e1210);}catch(_0x44f86c){utils['error'](util[_0xbffa('0x1d')](_0xbffa('0x3f'),_0x5e1210[_0xbffa('0x20')]),_0x44f86c);}});ami['on'](_0xbffa('0x41'),function(_0x558d08){try{utils['debug'](util[_0xbffa('0x1d')](_0xbffa('0x42'),_0x558d08[_0xbffa('0x20')]),_0x558d08);calls[_0xbffa('0x41')](_0x558d08);recordings[_0xbffa('0x41')](_0x558d08);}catch(_0xb8997f){utils[_0xbffa('0x19')](util['format'](_0xbffa('0x42'),_0x558d08[_0xbffa('0x20')]),_0xb8997f);}});ami['on'](_0xbffa('0x43'),function(_0x295ca6){try{utils['debug'](util[_0xbffa('0x1d')]('[%s][index][dialbegin]',_0x295ca6['uniqueid']),_0x295ca6);dials[_0xbffa('0x43')](_0x295ca6);}catch(_0x2bc474){utils[_0xbffa('0x19')](util['format']('[%s]dialbegin',_0x295ca6['uniqueid']),_0x2bc474);}});ami['on'](_0xbffa('0x44'),function(_0x370475){try{utils[_0xbffa('0x1c')](util[_0xbffa('0x1d')]('[%s][index][dialend]',_0x370475[_0xbffa('0x20')]),_0x370475);dials['dialend'](_0x370475);}catch(_0x279712){utils[_0xbffa('0x19')](util[_0xbffa('0x1d')](_0xbffa('0x45'),_0x370475[_0xbffa('0x20')]),_0x279712);}});} \ No newline at end of file +var _0x1f96=['util','xdr','disabled','production','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils'];(function(_0x32691a,_0x4e946a){var _0x1a9905=function(_0x2c7ea5){while(--_0x2c7ea5){_0x32691a['push'](_0x32691a['shift']());}};_0x1a9905(++_0x4e946a);}(_0x1f96,0x1a8));var _0x61f9=function(_0x523347,_0x5b7207){_0x523347=_0x523347-0x0;var _0x3e30dd=_0x1f96[_0x523347];return _0x3e30dd;};var AsteriskManager=require('asterisk-manager');var config=require(_0x61f9('0x0'));var utils=require(_0x61f9('0x1'));var util=require(_0x61f9('0x2'));var isXDREnabled=config['xdr']&&config[_0x61f9('0x3')][_0x61f9('0x4')]?!config[_0x61f9('0x3')]['disabled']:!![];var isProduction=config['env']===_0x61f9('0x5')||![];var isLocalAsterisk=config['xdr']&&config['xdr']['local']===!![]||![];var ami=new AsteriskManager(config[_0x61f9('0x6')][_0x61f9('0x7')],config['asterisk']['ip'],config[_0x61f9('0x6')][_0x61f9('0x8')],config['asterisk'][_0x61f9('0x9')],!![]);ami[_0x61f9('0xa')]();if(!isXDREnabled){utils[_0x61f9('0xb')](_0x61f9('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x61f9('0xb')](_0x61f9('0xd'));}else{var agents=require(_0x61f9('0xe'));var calls=require(_0x61f9('0xf'));var queues=require(_0x61f9('0x10'));var recordings=require(_0x61f9('0x11'));var members=require(_0x61f9('0x12'));var dials=require(_0x61f9('0x13'));var transfers=require('./transfers.controller');var core=require(_0x61f9('0x14'));ami['on']('connect',core[_0x61f9('0x15')]);ami['on']('shutdown',core[_0x61f9('0x16')]);ami['on']('fullybooted',core[_0x61f9('0x17')]);ami['on'](_0x61f9('0x18'),core[_0x61f9('0x18')]);ami['on'](_0x61f9('0x19'),core['close']);ami['on'](_0x61f9('0x1a'),core['managerevent']);ami['on']('devicestatechange',function(_0x23d1da){try{utils['debug'](util[_0x61f9('0x1b')](_0x61f9('0x1c'),_0x23d1da[_0x61f9('0x1d')]),_0x23d1da);members['devicestatechange'](_0x23d1da);}catch(_0x36f88b){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x1c'),_0x23d1da[_0x61f9('0x1d')]),_0x36f88b);}});ami['on'](_0x61f9('0x1e'),function(_0x25bd7f){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x20'),_0x25bd7f[_0x61f9('0x21')]),_0x25bd7f);agents['agentcalled'](_0x25bd7f);}catch(_0x5f0dcb){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x20'),_0x25bd7f[_0x61f9('0x21')]),_0x5f0dcb);}});ami['on']('agentringnoanswer',function(_0x4c40ec){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x22'),_0x4c40ec[_0x61f9('0x21')]),_0x4c40ec);agents[_0x61f9('0x23')](_0x4c40ec);}catch(_0x153c83){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x22'),_0x4c40ec[_0x61f9('0x21')]),_0x153c83);}});ami['on']('agentconnect',function(_0x1987a2){try{utils['debug'](util[_0x61f9('0x1b')](_0x61f9('0x24'),_0x1987a2[_0x61f9('0x21')]),_0x1987a2);agents[_0x61f9('0x25')](_0x1987a2);queues[_0x61f9('0x25')](_0x1987a2);}catch(_0x126e43){utils['error'](util[_0x61f9('0x1b')](_0x61f9('0x24'),_0x1987a2[_0x61f9('0x21')]),_0x126e43);}});ami['on'](_0x61f9('0x26'),function(_0x212b17){try{utils['debug'](util[_0x61f9('0x1b')](_0x61f9('0x27'),_0x212b17[_0x61f9('0x21')]),_0x212b17);agents[_0x61f9('0x26')](_0x212b17);queues['agentcomplete'](_0x212b17);members[_0x61f9('0x26')](_0x212b17);}catch(_0x1027b2){utils[_0x61f9('0x18')](util['format'](_0x61f9('0x27'),_0x212b17[_0x61f9('0x21')]),_0x1027b2);}});ami['on'](_0x61f9('0x28'),function(_0x251186){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x29'),_0x251186[_0x61f9('0x21')]),_0x251186);agents[_0x61f9('0x28')](_0x251186);queues['queuecallerabandon'](_0x251186);}catch(_0xb60d1e){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')]('[%s][index][queuecallerabandon]',_0x251186[_0x61f9('0x21')]),_0xb60d1e);}});ami['on'](_0x61f9('0x2a'),function(_0x107b68){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x2b'),_0x107b68[_0x61f9('0x21')]),_0x107b68);queues[_0x61f9('0x2a')](_0x107b68);recordings['queuecallerjoin'](_0x107b68);}catch(_0x582206){utils['error'](util[_0x61f9('0x1b')](_0x61f9('0x2b'),_0x107b68[_0x61f9('0x21')]),_0x582206);}});ami['on'](_0x61f9('0x2c'),function(_0x13e37f){try{utils['debug'](util[_0x61f9('0x1b')](_0x61f9('0x2d'),_0x13e37f['uniqueid']),_0x13e37f);queues['queuecallerleave'](_0x13e37f);}catch(_0x3fe03a){utils[_0x61f9('0x18')](util['format'](_0x61f9('0x2d'),_0x13e37f[_0x61f9('0x21')]),_0x3fe03a);}});ami['on']('musiconholdstart',function(_0x11844c){try{utils['debug'](util[_0x61f9('0x1b')](_0x61f9('0x2e'),_0x11844c['uniqueid']),_0x11844c);queues[_0x61f9('0x2f')](_0x11844c);calls[_0x61f9('0x2f')](_0x11844c);}catch(_0x4235b5){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x2e'),_0x11844c[_0x61f9('0x21')]),_0x4235b5);}});ami['on'](_0x61f9('0x30'),function(_0x1bd0be){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x31'),_0x1bd0be[_0x61f9('0x21')]),_0x1bd0be);queues[_0x61f9('0x30')](_0x1bd0be);calls[_0x61f9('0x30')](_0x1bd0be);}catch(_0x5d081d){utils[_0x61f9('0x18')](util['format'](_0x61f9('0x31'),_0x1bd0be[_0x61f9('0x21')]),_0x5d081d);}});ami['on'](_0x61f9('0x32'),function(_0x1348a1){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x33'),_0x1348a1[_0x61f9('0x21')]),_0x1348a1);calls[_0x61f9('0x32')](_0x1348a1);recordings[_0x61f9('0x32')](_0x1348a1);}catch(_0x139bf2){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x33'),_0x1348a1[_0x61f9('0x21')]),_0x139bf2);}});ami['on'](_0x61f9('0x34'),function(_0x56b4af){try{utils[_0x61f9('0x1f')](util['format']('[%s][index][hangup]',_0x56b4af['uniqueid']),_0x56b4af);calls[_0x61f9('0x34')](_0x56b4af);recordings[_0x61f9('0x34')](_0x56b4af);dials[_0x61f9('0x34')](_0x56b4af);agents[_0x61f9('0x34')](_0x56b4af);queues[_0x61f9('0x34')](_0x56b4af);}catch(_0x4aa93d){utils['error'](util[_0x61f9('0x1b')]('[%s][index][hangup]',_0x56b4af[_0x61f9('0x21')]),_0x4aa93d);}});ami['on'](_0x61f9('0x35'),function(_0x1a5257){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x36'),_0x1a5257['uniqueid']),_0x1a5257);members[_0x61f9('0x35')](_0x1a5257);}catch(_0x2a8138){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x36'),_0x1a5257['uniqueid']),_0x2a8138);}});ami['on'](_0x61f9('0x37'),function(_0x1668e0){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x38'),_0x1668e0[_0x61f9('0x21')]),_0x1668e0);queues['blindtransfer'](_0x1668e0);agents[_0x61f9('0x37')](_0x1668e0);transfers[_0x61f9('0x37')](_0x1668e0);}catch(_0x4583c2){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')]('[%s][index][blindtransfer]',_0x1668e0[_0x61f9('0x21')]),_0x4583c2);}});ami['on'](_0x61f9('0x39'),function(_0x304ab6){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x3a'),_0x304ab6[_0x61f9('0x3b')]),_0x304ab6);queues[_0x61f9('0x39')](_0x304ab6);transfers[_0x61f9('0x39')](_0x304ab6);agents['attendedtransfer'](_0x304ab6);calls['attendedtransfer'](_0x304ab6);}catch(_0x22aee5){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x3a'),_0x304ab6['origtransfereruniqueid']),_0x22aee5);}});ami['on'](_0x61f9('0x3c'),function(_0x342bc3){try{utils[_0x61f9('0x1f')](util['format'](_0x61f9('0x3d'),_0x342bc3['uniqueid']),_0x342bc3);queues[_0x61f9('0x3c')](_0x342bc3);recordings[_0x61f9('0x3c')](_0x342bc3);calls[_0x61f9('0x3c')](_0x342bc3);dials[_0x61f9('0x3c')](_0x342bc3);}catch(_0x5ae2cd){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x3d'),_0x342bc3['uniqueid']),_0x5ae2cd);}});ami['on'](_0x61f9('0x3e'),function(_0x1fbd8f){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x3f'),_0x1fbd8f[_0x61f9('0x21')]),_0x1fbd8f);calls[_0x61f9('0x3e')](_0x1fbd8f);recordings[_0x61f9('0x3e')](_0x1fbd8f);dials['newexten'](_0x1fbd8f);}catch(_0x2147e6){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x3f'),_0x1fbd8f['uniqueid']),_0x2147e6);}});ami['on'](_0x61f9('0x40'),function(_0x5a7d5c){try{utils['debug'](util[_0x61f9('0x1b')](_0x61f9('0x41'),_0x5a7d5c['uniqueid']),_0x5a7d5c);calls[_0x61f9('0x40')](_0x5a7d5c);recordings[_0x61f9('0x40')](_0x5a7d5c);}catch(_0x49908b){utils['error'](util['format'](_0x61f9('0x41'),_0x5a7d5c[_0x61f9('0x21')]),_0x49908b);}});ami['on'](_0x61f9('0x42'),function(_0xf02681){try{utils[_0x61f9('0x1f')](util[_0x61f9('0x1b')](_0x61f9('0x43'),_0xf02681['uniqueid']),_0xf02681);dials[_0x61f9('0x42')](_0xf02681);}catch(_0x5101c4){utils[_0x61f9('0x18')](util[_0x61f9('0x1b')](_0x61f9('0x44'),_0xf02681['uniqueid']),_0x5101c4);}});ami['on'](_0x61f9('0x45'),function(_0x5b6bde){try{utils['debug'](util['format'](_0x61f9('0x46'),_0x5b6bde[_0x61f9('0x21')]),_0x5b6bde);dials['dialend'](_0x5b6bde);}catch(_0x4ba1af){utils[_0x61f9('0x18')](util['format'](_0x61f9('0x46'),_0x5b6bde[_0x61f9('0x21')]),_0x4ba1af);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 9915ad8..e462ea5 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 _0x66cf=['isNil','exitAt','now','duration','diffTime','enterAt','debug','[%s][members][agentcomplete]','queue','assign','cdr','data1','source','destination','data2','data3','destinationchannel','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','membername','internal','request','split','name','CreateMemberReport','catch','error','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','NOT_INUSE'];(function(_0x2f3d29,_0x1a1587){var _0x25cff2=function(_0x499a80){while(--_0x499a80){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x25cff2(++_0x1a1587);}(_0x66cf,0x1a2));var _0xf66c=function(_0x11cf9d,_0xa611e5){_0x11cf9d=_0x11cf9d-0x0;var _0x2640e2=_0x66cf[_0x11cf9d];return _0x2640e2;};'use strict';var _=require(_0xf66c('0x0'));var util=require('util');var utils=require(_0xf66c('0x1'));var members={};var exclude=[_0xf66c('0x2'),'Queue:'];function writeDB(_0x2e436e){utils[_0xf66c('0x3')](util[_0xf66c('0x4')](_0xf66c('0x5'),_0x2e436e[_0xf66c('0x6')],_0x2e436e[_0xf66c('0x7')],_0x2e436e[_0xf66c('0x8')],_0x2e436e['data2'],_0x2e436e['membername'],_0x2e436e[_0xf66c('0x9')]));if(_0x2e436e[_0xf66c('0x7')]){utils[_0xf66c('0xa')](_0x2e436e['interface'])['then'](function(_0x54c1b6){if(_0x54c1b6){_0x2e436e[_0xf66c('0xb')]=_0x54c1b6['name'];_0x2e436e[_0xf66c('0xc')]=_0x54c1b6[_0xf66c('0xc')];utils[_0xf66c('0xd')]('CreateMemberReport',_0x2e436e);}else{utils['getUserByName'](_0x2e436e[_0xf66c('0x7')][_0xf66c('0xe')]('/')[0x1])['then'](function(_0x30b0ab){if(_0x30b0ab){_0x2e436e[_0xf66c('0xb')]=_0x30b0ab[_0xf66c('0xf')];_0x2e436e[_0xf66c('0xc')]=_0x30b0ab[_0xf66c('0xc')];utils[_0xf66c('0xd')](_0xf66c('0x10'),_0x2e436e);}});}})[_0xf66c('0x11')](function(_0x10306d){utils[_0xf66c('0x12')](util[_0xf66c('0x4')]('[%s][members][writeDB]',_0x2e436e[_0xf66c('0x6')]),_0x10306d);});}delete members[_0x2e436e[_0xf66c('0x7')]];}function startsWith(_0x480ca2,_0xec645e){return _[_0xf66c('0x13')](_0x480ca2,function(_0x475397){return _[_0xf66c('0x14')](_0xec645e,_0x475397);});}exports[_0xf66c('0x15')]=function(_0x12f51f){try{utils['debug'](util[_0xf66c('0x4')](_0xf66c('0x16'),members[_0x12f51f[_0xf66c('0x17')]]?members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x6')]:_0x12f51f[_0xf66c('0x17')]),_0x12f51f);utils[_0xf66c('0x3')](util[_0xf66c('0x4')](_0xf66c('0x18'),members[_0x12f51f[_0xf66c('0x17')]]?members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x6')]:_0x12f51f[_0xf66c('0x17')],_0x12f51f[_0xf66c('0x19')],_0x12f51f[_0xf66c('0x17')]));switch(_0x12f51f[_0xf66c('0x19')]){case _0xf66c('0x1a'):case _0xf66c('0x1b'):if(!startsWith(exclude,_0x12f51f[_0xf66c('0x17')])){members[_0x12f51f[_0xf66c('0x17')]]={'channel':_0xf66c('0x1c'),'interface':_0x12f51f[_0xf66c('0x17')],'type':_0xf66c('0x1d'),'enterAt':utils['now'](),'role':_0xf66c('0x1e')};}break;case _0xf66c('0x1f'):if(!_[_0xf66c('0x20')](members[_0x12f51f[_0xf66c('0x17')]])){members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x21')]=utils[_0xf66c('0x22')]();members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x23')]=utils[_0xf66c('0x24')](members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x21')],members[_0x12f51f['device']][_0xf66c('0x25')]);if(members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x6')]){writeDB(members[_0x12f51f[_0xf66c('0x17')]]);}}break;default:break;}}catch(_0x488ce5){utils[_0xf66c('0x12')](util[_0xf66c('0x4')](_0xf66c('0x16'),members[_0x12f51f[_0xf66c('0x17')]]?members[_0x12f51f[_0xf66c('0x17')]][_0xf66c('0x6')]:_0x12f51f[_0xf66c('0x17')]),_0x488ce5);}};exports['agentcomplete']=function(_0x963722){try{if(!_[_0xf66c('0x20')](members[_0x963722[_0xf66c('0x7')]])){utils[_0xf66c('0x26')](util[_0xf66c('0x4')](_0xf66c('0x27'),_0x963722[_0xf66c('0x6')]),_0x963722);utils[_0xf66c('0x3')](util[_0xf66c('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x963722[_0xf66c('0x6')],_0x963722[_0xf66c('0x7')],_0x963722[_0xf66c('0x28')]));members[_0x963722[_0xf66c('0x7')]]=_[_0xf66c('0x29')](members[_0x963722['interface']],{'data4':_0x963722[_0xf66c('0x28')],'uniqueid':_0x963722[_0xf66c('0x6')]});}}catch(_0x120ade){utils[_0xf66c('0x12')](util[_0xf66c('0x4')]('[%s][members][agentcomplete]',_0x963722[_0xf66c('0x6')]),_0x120ade);}};exports[_0xf66c('0x2a')]=function(_0x30c14d){try{utils[_0xf66c('0x26')](util[_0xf66c('0x4')]('[%s][members][cdr]',_0x30c14d[_0xf66c('0x6')]),_0x30c14d);if(_0x30c14d[_0xf66c('0x8')]){var _0x3d5a5a=_0x30c14d[_0xf66c('0x8')][_0xf66c('0xe')]('-')[0x0];if(!_[_0xf66c('0x20')](members[_0x3d5a5a])){members[_0x3d5a5a]=_['assign'](members[_0x3d5a5a],{'data1':members[_0x3d5a5a][_0xf66c('0x2b')]||_0x30c14d[_0xf66c('0x9')],'data2':members[_0x3d5a5a]['data2']||_0x30c14d[_0xf66c('0x2c')],'data3':members[_0x3d5a5a]['data3']||_0x30c14d[_0xf66c('0x2d')],'uniqueid':members[_0x3d5a5a][_0xf66c('0x6')]||_0x30c14d[_0xf66c('0x6')]});utils[_0xf66c('0x3')](util[_0xf66c('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x30c14d[_0xf66c('0x6')],members[_0x3d5a5a][_0xf66c('0x2b')],members[_0x3d5a5a][_0xf66c('0x2e')],members[_0x3d5a5a][_0xf66c('0x2f')]));if(members[_0x3d5a5a][_0xf66c('0x21')]){writeDB(members[_0x3d5a5a]);}}}if(_0x30c14d[_0xf66c('0x30')]){var _0x54064f=_0x30c14d[_0xf66c('0x30')][_0xf66c('0xe')]('-')[0x0];if(!_[_0xf66c('0x20')](members[_0x54064f])){members[_0x54064f]=_[_0xf66c('0x29')](members[_0x54064f],{'data1':members[_0x54064f]['data1']||_0x30c14d[_0xf66c('0x9')],'data2':members[_0x54064f][_0xf66c('0x2e')]||_0x30c14d[_0xf66c('0x2c')],'data3':members[_0x54064f][_0xf66c('0x2f')]||_0x30c14d[_0xf66c('0x2d')],'uniqueid':members[_0x54064f][_0xf66c('0x6')]||_0x30c14d[_0xf66c('0x6')]});utils['info'](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x30c14d[_0xf66c('0x6')],members[_0x54064f][_0xf66c('0x2b')],members[_0x54064f][_0xf66c('0x2e')],members[_0x54064f]['data3']));if(members[_0x54064f][_0xf66c('0x21')]){writeDB(members[_0x54064f]);}}}}catch(_0x1d68ab){utils[_0xf66c('0x12')](util[_0xf66c('0x4')](_0xf66c('0x31'),_0x30c14d[_0xf66c('0x6')]),_0x1d68ab);}}; \ No newline at end of file +var _0x8150=['queue','[%s][members][agentcomplete]','[%s][members][cdr]','data1','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','data2','membername','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','device','state','voice','now','agent','exitAt','duration','enterAt','[%s][members][devicestatechange]','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign'];(function(_0x5a63a1,_0x4ef850){var _0x1f115d=function(_0x1e5bd1){while(--_0x1e5bd1){_0x5a63a1['push'](_0x5a63a1['shift']());}};_0x1f115d(++_0x4ef850);}(_0x8150,0x1a7));var _0x0815=function(_0x1bf2cc,_0x1bea91){_0x1bf2cc=_0x1bf2cc-0x0;var _0x3edcf1=_0x8150[_0x1bf2cc];return _0x3edcf1;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var members={};var exclude=[_0x0815('0x0'),_0x0815('0x1')];function writeDB(_0x456b25){utils[_0x0815('0x2')](util[_0x0815('0x3')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x456b25[_0x0815('0x4')],_0x456b25['interface'],_0x456b25[_0x0815('0x5')],_0x456b25[_0x0815('0x6')],_0x456b25[_0x0815('0x7')],_0x456b25['type']));if(_0x456b25[_0x0815('0x8')]){utils[_0x0815('0x9')](_0x456b25[_0x0815('0x8')])[_0x0815('0xa')](function(_0x15a262){if(_0x15a262){_0x456b25[_0x0815('0x7')]=_0x15a262[_0x0815('0xb')];_0x456b25[_0x0815('0xc')]=_0x15a262[_0x0815('0xc')];utils[_0x0815('0xd')](_0x0815('0xe'),_0x456b25);}else{utils[_0x0815('0xf')](_0x456b25['interface'][_0x0815('0x10')]('/')[0x1])[_0x0815('0xa')](function(_0x551555){if(_0x551555){_0x456b25[_0x0815('0x7')]=_0x551555[_0x0815('0xb')];_0x456b25[_0x0815('0xc')]=_0x551555['internal'];utils[_0x0815('0xd')](_0x0815('0xe'),_0x456b25);}});}})[_0x0815('0x11')](function(_0x3b9e73){utils[_0x0815('0x12')](util['format'](_0x0815('0x13'),_0x456b25[_0x0815('0x4')]),_0x3b9e73);});}delete members[_0x456b25[_0x0815('0x8')]];}function startsWith(_0x34b746,_0x229719){return _[_0x0815('0x14')](_0x34b746,function(_0x1d8180){return _[_0x0815('0x15')](_0x229719,_0x1d8180);});}exports[_0x0815('0x16')]=function(_0x1eb43d){try{utils[_0x0815('0x17')](util[_0x0815('0x3')]('[%s][members][devicestatechange]',members[_0x1eb43d[_0x0815('0x18')]]?members[_0x1eb43d[_0x0815('0x18')]]['uniqueid']:_0x1eb43d[_0x0815('0x18')]),_0x1eb43d);utils[_0x0815('0x2')](util[_0x0815('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x1eb43d[_0x0815('0x18')]]?members[_0x1eb43d['device']][_0x0815('0x4')]:_0x1eb43d[_0x0815('0x18')],_0x1eb43d[_0x0815('0x19')],_0x1eb43d[_0x0815('0x18')]));switch(_0x1eb43d[_0x0815('0x19')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x1eb43d[_0x0815('0x18')])){members[_0x1eb43d['device']]={'channel':_0x0815('0x1a'),'interface':_0x1eb43d[_0x0815('0x18')],'type':'TALKING','enterAt':utils[_0x0815('0x1b')](),'role':_0x0815('0x1c')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x1eb43d[_0x0815('0x18')]])){members[_0x1eb43d[_0x0815('0x18')]][_0x0815('0x1d')]=utils['now']();members[_0x1eb43d[_0x0815('0x18')]][_0x0815('0x1e')]=utils['diffTime'](members[_0x1eb43d[_0x0815('0x18')]][_0x0815('0x1d')],members[_0x1eb43d[_0x0815('0x18')]][_0x0815('0x1f')]);if(members[_0x1eb43d[_0x0815('0x18')]]['uniqueid']){writeDB(members[_0x1eb43d[_0x0815('0x18')]]);}}break;default:break;}}catch(_0x3bc37a){utils[_0x0815('0x12')](util[_0x0815('0x3')](_0x0815('0x20'),members[_0x1eb43d['device']]?members[_0x1eb43d[_0x0815('0x18')]]['uniqueid']:_0x1eb43d['device']),_0x3bc37a);}};exports[_0x0815('0x21')]=function(_0x3ae189){try{if(!_[_0x0815('0x22')](members[_0x3ae189[_0x0815('0x8')]])){utils[_0x0815('0x17')](util['format']('[%s][members][agentcomplete]',_0x3ae189[_0x0815('0x4')]),_0x3ae189);utils[_0x0815('0x2')](util['format'](_0x0815('0x23'),_0x3ae189[_0x0815('0x4')],_0x3ae189[_0x0815('0x8')],_0x3ae189['queue']));members[_0x3ae189[_0x0815('0x8')]]=_[_0x0815('0x24')](members[_0x3ae189[_0x0815('0x8')]],{'data4':_0x3ae189[_0x0815('0x25')],'uniqueid':_0x3ae189[_0x0815('0x4')]});}}catch(_0x2d74a1){utils[_0x0815('0x12')](util['format'](_0x0815('0x26'),_0x3ae189['uniqueid']),_0x2d74a1);}};exports['cdr']=function(_0x4c9927){try{utils[_0x0815('0x17')](util[_0x0815('0x3')](_0x0815('0x27'),_0x4c9927['uniqueid']),_0x4c9927);if(_0x4c9927[_0x0815('0x5')]){var _0xab3529=_0x4c9927[_0x0815('0x5')][_0x0815('0x10')]('-')[0x0];if(!_[_0x0815('0x22')](members[_0xab3529])){members[_0xab3529]=_[_0x0815('0x24')](members[_0xab3529],{'data1':members[_0xab3529][_0x0815('0x28')]||_0x4c9927[_0x0815('0x29')],'data2':members[_0xab3529][_0x0815('0x6')]||_0x4c9927[_0x0815('0x2a')],'data3':members[_0xab3529][_0x0815('0x2b')]||_0x4c9927[_0x0815('0x2c')],'uniqueid':members[_0xab3529]['uniqueid']||_0x4c9927[_0x0815('0x4')]});utils[_0x0815('0x2')](util[_0x0815('0x3')](_0x0815('0x2d'),_0x4c9927[_0x0815('0x4')],members[_0xab3529][_0x0815('0x28')],members[_0xab3529][_0x0815('0x6')],members[_0xab3529][_0x0815('0x2b')]));if(members[_0xab3529][_0x0815('0x1d')]){writeDB(members[_0xab3529]);}}}if(_0x4c9927['destinationchannel']){var _0x4d3337=_0x4c9927['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0x4d3337])){members[_0x4d3337]=_[_0x0815('0x24')](members[_0x4d3337],{'data1':members[_0x4d3337][_0x0815('0x28')]||_0x4c9927[_0x0815('0x29')],'data2':members[_0x4d3337][_0x0815('0x6')]||_0x4c9927[_0x0815('0x2a')],'data3':members[_0x4d3337]['data3']||_0x4c9927[_0x0815('0x2c')],'uniqueid':members[_0x4d3337][_0x0815('0x4')]||_0x4c9927['uniqueid']});utils[_0x0815('0x2')](util['format'](_0x0815('0x2d'),_0x4c9927[_0x0815('0x4')],members[_0x4d3337]['data1'],members[_0x4d3337][_0x0815('0x6')],members[_0x4d3337]['data3']));if(members[_0x4d3337][_0x0815('0x1d')]){writeDB(members[_0x4d3337]);}}}}catch(_0x2e5017){utils[_0x0815('0x12')](util['format']('[%s][members][cdr]',_0x4c9927[_0x0815('0x4')]),_0x2e5017);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6c71884..e04d093 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 _0x4c4b=['queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexit','queuecallerexitAt','now','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','queuecallerabandonAt','assigned','membername','agentcomplete','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','[%s][queues][hangup]','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x4c4b,0x182));var _0xb4c4=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0x4c4b[_0x1c7137];return _0xeb4432;};'use strict';var _=require(_0xb4c4('0x0'));var util=require(_0xb4c4('0x1'));var utils=require(_0xb4c4('0x2'));var queues={};function writeDB(_0x1967da){utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x5'),_0x1967da[_0xb4c4('0x6')],_0x1967da[_0xb4c4('0x7')],_0x1967da[_0xb4c4('0x8')],_0x1967da[_0xb4c4('0x9')],_0x1967da[_0xb4c4('0xa')],_0x1967da[_0xb4c4('0xb')],_0x1967da[_0xb4c4('0xc')]));if(_0x1967da[_0xb4c4('0x8')]){utils[_0xb4c4('0xd')](_0x1967da[_0xb4c4('0x8')])[_0xb4c4('0xe')](function(_0x5f8785){if(_0x5f8785){_0x1967da[_0xb4c4('0xf')]=_0x5f8785[_0xb4c4('0xf')];}utils[_0xb4c4('0x10')](_0xb4c4('0x11'),_0x1967da);});}else{utils[_0xb4c4('0x10')](_0xb4c4('0x11'),_0x1967da);}if(_0x1967da[_0xb4c4('0x12')]){delete queues[_0x1967da['transfereduniqueid']];}else{delete queues[_0x1967da[_0xb4c4('0x6')]];}}exports[_0xb4c4('0x13')]=function(_0x3877a2){try{utils[_0xb4c4('0x14')](util[_0xb4c4('0x4')](_0xb4c4('0x15'),_0x3877a2[_0xb4c4('0x6')]),_0x3877a2);utils['info'](util['format'](_0xb4c4('0x16'),_0x3877a2['uniqueid'],_0x3877a2[_0xb4c4('0x8')],_0x3877a2[_0xb4c4('0x17')]));queues[_0x3877a2['uniqueid']]=_['assign'](_0x3877a2,{'originalposition':_0x3877a2[_0xb4c4('0x17')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5ca24e){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')](_0xb4c4('0x15'),_0x3877a2[_0xb4c4('0x6')]),_0x5ca24e);}};exports[_0xb4c4('0x19')]=function(_0x211f5c){try{if(!_[_0xb4c4('0x1a')](queues[_0x211f5c[_0xb4c4('0x6')]])){utils['debug'](util['format'](_0xb4c4('0x1b'),_0x211f5c[_0xb4c4('0x6')]),_0x211f5c);if(queues[_0x211f5c[_0xb4c4('0x6')]]['queuecallerleaveAt']){if(!queues[_0x211f5c[_0xb4c4('0x6')]]['queuecallerabandon']&&!queues[_0x211f5c[_0xb4c4('0x6')]]['queuecallerexit']){queues[_0x211f5c[_0xb4c4('0x6')]][_0xb4c4('0x1c')]=!![];queues[_0x211f5c[_0xb4c4('0x6')]][_0xb4c4('0x1d')]=utils['now']();queues[_0x211f5c['uniqueid']]['queuecallerexitreason']=_0xb4c4('0x1e');}utils[_0xb4c4('0x3')](util['format'](_0xb4c4('0x1f'),_0x211f5c[_0xb4c4('0x6')],queues[_0x211f5c[_0xb4c4('0x6')]]['name'],queues[_0x211f5c['uniqueid']][_0xb4c4('0xc')]));writeDB(queues[_0x211f5c[_0xb4c4('0x6')]]);}else if(queues[_0x211f5c['uniqueid']][_0xb4c4('0x12')]){utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x20'),_0x211f5c[_0xb4c4('0x6')],queues[_0x211f5c['uniqueid']][_0xb4c4('0x21')],queues[_0x211f5c[_0xb4c4('0x6')]]['transfereduniqueid']));queues[queues[_0x211f5c[_0xb4c4('0x6')]][_0xb4c4('0x12')]]=queues[_0x211f5c['uniqueid']];queues[queues[_0x211f5c['uniqueid']][_0xb4c4('0x12')]][_0xb4c4('0x22')]=0x2;delete queues[_0x211f5c[_0xb4c4('0x6')]];}}}catch(_0x2c60c3){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')](_0xb4c4('0x1b'),_0x211f5c[_0xb4c4('0x6')]),_0x2c60c3);}};exports[_0xb4c4('0x23')]=function(_0x4d0562){try{utils[_0xb4c4('0x14')](util[_0xb4c4('0x4')](_0xb4c4('0x24'),_0x4d0562[_0xb4c4('0x6')]),_0x4d0562);if(!_[_0xb4c4('0x1a')](_0x4d0562[_0xb4c4('0x25')][_0xb4c4('0x26')])&&_0x4d0562[_0xb4c4('0x27')][_0xb4c4('0x28')]()!==_0xb4c4('0x29')){if(!_[_0xb4c4('0x1a')](queues[_0x4d0562['uniqueid']])){queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x2a')]=![];queues[_0x4d0562[_0xb4c4('0x6')]]['queuecallerabandonAt']=null;queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x2b')]=!![];queues[_0x4d0562['uniqueid']][_0xb4c4('0x2c')]=utils[_0xb4c4('0x2d')]();queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0xc')]=_0x4d0562[_0xb4c4('0x27')][_0xb4c4('0x28')]();utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x2e'),_0x4d0562[_0xb4c4('0x6')],queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x21')],_0x4d0562[_0xb4c4('0x27')],queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0xc')]));writeDB(queues[_0x4d0562[_0xb4c4('0x6')]]);}}else if(!_[_0xb4c4('0x1a')](_0x4d0562[_0xb4c4('0x25')][_0xb4c4('0x2f')])){if(!_[_0xb4c4('0x1a')](queues[_0x4d0562[_0xb4c4('0x6')]])&&!queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x2a')]){queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x2a')]=![];queues[_0x4d0562['uniqueid']]['queuecallerabandonAt']=null;queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x2b')]=!![];queues[_0x4d0562[_0xb4c4('0x6')]]['queuecallerexitAt']=utils[_0xb4c4('0x2d')]();queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0xc')]=_0xb4c4('0x30');utils['info'](util[_0xb4c4('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4d0562[_0xb4c4('0x6')],queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0x21')],_0x4d0562[_0xb4c4('0x27')],queues[_0x4d0562[_0xb4c4('0x6')]][_0xb4c4('0xc')]));}}}catch(_0x4f1003){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')](_0xb4c4('0x24'),_0x4d0562[_0xb4c4('0x6')]),_0x4f1003);}};exports[_0xb4c4('0x2a')]=function(_0x1950f8){try{if(!_['isNil'](queues[_0x1950f8[_0xb4c4('0x6')]])){utils[_0xb4c4('0x14')](util[_0xb4c4('0x4')](_0xb4c4('0x31'),_0x1950f8['uniqueid']),_0x1950f8);queues[_0x1950f8[_0xb4c4('0x6')]][_0xb4c4('0x2b')]=![];queues[_0x1950f8[_0xb4c4('0x6')]][_0xb4c4('0x2c')]=null;queues[_0x1950f8[_0xb4c4('0x6')]][_0xb4c4('0x2a')]=!![];queues[_0x1950f8[_0xb4c4('0x6')]]['queuecallerabandonAt']=utils[_0xb4c4('0x2d')]();queues[_0x1950f8[_0xb4c4('0x6')]][_0xb4c4('0xc')]='ABANDONED';utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1950f8[_0xb4c4('0x6')],queues[_0x1950f8[_0xb4c4('0x6')]]['name'],queues[_0x1950f8['uniqueid']][_0xb4c4('0xc')]));}}catch(_0x13c377){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')]('[%s][queues][queuecallerabandon]',_0x1950f8[_0xb4c4('0x6')]),_0x13c377);}};exports['queuecallerleave']=function(_0x1734f6){try{if(!_[_0xb4c4('0x1a')](queues[_0x1734f6['uniqueid']])){utils['debug'](util[_0xb4c4('0x4')](_0xb4c4('0x32'),_0x1734f6[_0xb4c4('0x6')]),_0x1734f6);utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x33'),_0x1734f6['uniqueid'],queues[_0x1734f6[_0xb4c4('0x6')]]['name'],_0x1734f6['connectedlinenum'],_0x1734f6[_0xb4c4('0x34')]));queues[_0x1734f6['uniqueid']][_0xb4c4('0x35')]=!![];queues[_0x1734f6[_0xb4c4('0x6')]][_0xb4c4('0x36')]=utils[_0xb4c4('0x2d')]();queues[_0x1734f6[_0xb4c4('0x6')]][_0xb4c4('0x37')]=utils[_0xb4c4('0x38')](queues[_0x1734f6[_0xb4c4('0x6')]][_0xb4c4('0x36')],queues[_0x1734f6[_0xb4c4('0x6')]][_0xb4c4('0x39')]);queues[_0x1734f6[_0xb4c4('0x6')]][_0xb4c4('0x17')]=_0x1734f6[_0xb4c4('0x17')];queues[_0x1734f6[_0xb4c4('0x6')]]['count']=_0x1734f6[_0xb4c4('0x3a')];queues[_0x1734f6[_0xb4c4('0x6')]]['connectedlinenum']=_0x1734f6[_0xb4c4('0x3b')];queues[_0x1734f6[_0xb4c4('0x6')]]['connectedlinename']=_0x1734f6[_0xb4c4('0x34')];}}catch(_0xf499b7){utils[_0xb4c4('0x18')](util['format'](_0xb4c4('0x32'),_0x1734f6[_0xb4c4('0x6')]),_0xf499b7);}};exports[_0xb4c4('0x3c')]=function(_0x4d3c8c){try{if(!_['isNil'](queues[_0x4d3c8c[_0xb4c4('0x6')]])){utils['debug'](util[_0xb4c4('0x4')](_0xb4c4('0x3d'),_0x4d3c8c['uniqueid']),_0x4d3c8c);utils['info'](util[_0xb4c4('0x4')](_0xb4c4('0x3e'),_0x4d3c8c[_0xb4c4('0x6')],queues[_0x4d3c8c['uniqueid']][_0xb4c4('0x21')],_0x4d3c8c['membername'],_0x4d3c8c[_0xb4c4('0x3f')]));queues[_0x4d3c8c[_0xb4c4('0x6')]]['queuecallerabandon']=![];queues[_0x4d3c8c['uniqueid']]['queuecallerabandon']=![];queues[_0x4d3c8c[_0xb4c4('0x6')]][_0xb4c4('0x40')]=null;queues[_0x4d3c8c['uniqueid']][_0xb4c4('0x2b')]=![];queues[_0x4d3c8c['uniqueid']]['queuecallerexitreason']=null;queues[_0x4d3c8c[_0xb4c4('0x6')]]['queuecallerexitAt']=null;queues[_0x4d3c8c[_0xb4c4('0x6')]][_0xb4c4('0x41')]=!![];queues[_0x4d3c8c[_0xb4c4('0x6')]]['accountcode']=_0x4d3c8c[_0xb4c4('0x3f')];queues[_0x4d3c8c[_0xb4c4('0x6')]]['lastAssignedTo']=_0x4d3c8c[_0xb4c4('0x42')];}}catch(_0x1e85a5){utils[_0xb4c4('0x18')](util['format'](_0xb4c4('0x3d'),_0x4d3c8c[_0xb4c4('0x6')]),_0x1e85a5);}};exports[_0xb4c4('0x43')]=function(_0x5b3e1d){try{if(!_[_0xb4c4('0x1a')](queues[_0x5b3e1d[_0xb4c4('0x6')]])){if(queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x36')]){utils[_0xb4c4('0x14')](util[_0xb4c4('0x4')]('[%s][queues][agentcomplete]',_0x5b3e1d['uniqueid']),_0x5b3e1d);queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x2a')]=![];queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x2a')]=![];queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x40')]=null;queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x2b')]=![];queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x2c')]=null;queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x41')]=!![];queues[_0x5b3e1d[_0xb4c4('0x6')]]['lastAssignedTo']=_0x5b3e1d[_0xb4c4('0x42')];queues[_0x5b3e1d['uniqueid']][_0xb4c4('0x1c')]=!![];queues[_0x5b3e1d[_0xb4c4('0x6')]]['queuecallercompleteAt']=utils[_0xb4c4('0x2d')]();if(_0x5b3e1d['reason']==_0xb4c4('0x44')){if(!queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0x44')]){queues[_0x5b3e1d['uniqueid']][_0xb4c4('0xc')]=_0xb4c4('0x45');}}else{queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0xc')]='COMPLETEDBY'+_0x5b3e1d[_0xb4c4('0x46')][_0xb4c4('0x28')]();}utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x47'),_0x5b3e1d[_0xb4c4('0x6')],queues[_0x5b3e1d['uniqueid']][_0xb4c4('0x21')],_0x5b3e1d[_0xb4c4('0x42')],queues[_0x5b3e1d[_0xb4c4('0x6')]][_0xb4c4('0xc')]));writeDB(queues[_0x5b3e1d[_0xb4c4('0x6')]]);}}}catch(_0x42e9dc){utils[_0xb4c4('0x18')](util['format'](_0xb4c4('0x48'),_0x5b3e1d[_0xb4c4('0x6')]),_0x42e9dc);}};exports['blindtransfer']=function(_0x437582){try{if(!_[_0xb4c4('0x1a')](queues[_0x437582['transfereeuniqueid']])){utils['debug'](util['format'](_0xb4c4('0x49'),_0x437582['uniqueid']),_0x437582);queues[_0x437582[_0xb4c4('0x4a')]][_0xb4c4('0x44')]=!![];queues[_0x437582[_0xb4c4('0x4a')]][_0xb4c4('0x4b')]=_0xb4c4('0x4c');queues[_0x437582['transfereeuniqueid']][_0xb4c4('0x4d')]=_0x437582['extension'];queues[_0x437582[_0xb4c4('0x4a')]][_0xb4c4('0x4e')]=_0x437582['transfereeuniqueid'];queues[_0x437582[_0xb4c4('0x4a')]][_0xb4c4('0xc')]=_0xb4c4('0x4f');utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x437582[_0xb4c4('0x6')],queues[_0x437582[_0xb4c4('0x4a')]][_0xb4c4('0x21')],_0x437582[_0xb4c4('0x4a')],_0x437582[_0xb4c4('0x50')]));}}catch(_0x210d15){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')](_0xb4c4('0x49'),_0x437582['uniqueid']),_0x210d15);}};exports['attendedtransfer']=function(_0x47805a){try{utils[_0xb4c4('0x14')](util[_0xb4c4('0x4')]('[%s][queues][attendedtransfer]',_0x47805a[_0xb4c4('0x51')]),_0x47805a);if(_0x47805a[_0xb4c4('0x51')]==_0x47805a[_0xb4c4('0x52')]){if(!_[_0xb4c4('0x1a')](queues[_0x47805a[_0xb4c4('0x53')]])){utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x54'),_0x47805a[_0xb4c4('0x51')],queues[_0x47805a[_0xb4c4('0x53')]]['name'],_0x47805a[_0xb4c4('0x55')]));queues[_0x47805a[_0xb4c4('0x53')]][_0xb4c4('0x44')]=!![];queues[_0x47805a['secondtransfererlinkedid']][_0xb4c4('0x4b')]=_0xb4c4('0x56');queues[_0x47805a[_0xb4c4('0x53')]][_0xb4c4('0x4d')]=_0x47805a[_0xb4c4('0x55')];queues[_0x47805a[_0xb4c4('0x53')]][_0xb4c4('0x4e')]=_0x47805a[_0xb4c4('0x51')];queues[_0x47805a[_0xb4c4('0x53')]][_0xb4c4('0xc')]='ATTENDEDTRANSFER';}if(!_[_0xb4c4('0x1a')](queues[_0x47805a[_0xb4c4('0x52')]])){if(_0x47805a[_0xb4c4('0x57')]&&queues[_0x47805a[_0xb4c4('0x57')]]){queues[_0x47805a[_0xb4c4('0x57')]][_0xb4c4('0x22')]=0x1;queues[_0x47805a[_0xb4c4('0x4a')]]=_['clone'](queues[_0x47805a['transfereelinkedid']]);queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0x12')]=_0x47805a[_0xb4c4('0x58')];queues[_0x47805a['transfereeuniqueid']][_0xb4c4('0x22')]=0x2;queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0xa')]=queues[_0x47805a[_0xb4c4('0x53')]][_0xb4c4('0xa')];queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0x59')]=queues[_0x47805a['secondtransfererlinkedid']]['calleridname'];queues[_0x47805a[_0xb4c4('0x4a')]]['queuecallerjoinAt']=utils[_0xb4c4('0x2d')]();queues[_0x47805a[_0xb4c4('0x4a')]]['queuecallerleaveAt']=utils[_0xb4c4('0x2d')]();queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0x37')]=0x0;queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0x5a')]=0x0;utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x5b'),_0x47805a[_0xb4c4('0x51')],queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0x21')],queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0xa')],queues[_0x47805a[_0xb4c4('0x4a')]][_0xb4c4('0x59')]));}else{utils['info'](util[_0xb4c4('0x4')](_0xb4c4('0x5c'),_0x47805a[_0xb4c4('0x51')],queues[_0x47805a[_0xb4c4('0x52')]]['name'],_0x47805a[_0xb4c4('0x53')]));queues[_0x47805a[_0xb4c4('0x52')]][_0xb4c4('0x12')]=_0x47805a[_0xb4c4('0x53')];}}}else if(_0x47805a[_0xb4c4('0x5d')]==_0x47805a[_0xb4c4('0x53')]){if(!_[_0xb4c4('0x1a')](queues[_0x47805a[_0xb4c4('0x52')]])){utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x47805a[_0xb4c4('0x51')],queues[_0x47805a['origtransfererlinkedid']][_0xb4c4('0x21')],_0x47805a[_0xb4c4('0x5d')],_0x47805a[_0xb4c4('0x5e')]));queues[_0x47805a[_0xb4c4('0x52')]][_0xb4c4('0x44')]=!![];queues[_0x47805a[_0xb4c4('0x52')]]['transfertype']=_0xb4c4('0x56');queues[_0x47805a['origtransfererlinkedid']][_0xb4c4('0x4d')]=_0x47805a[_0xb4c4('0x5e')];queues[_0x47805a['origtransfererlinkedid']][_0xb4c4('0x4e')]=_0x47805a[_0xb4c4('0x5d')];queues[_0x47805a[_0xb4c4('0x52')]][_0xb4c4('0xc')]=_0xb4c4('0x5f');}if(!_[_0xb4c4('0x1a')](queues[_0x47805a[_0xb4c4('0x53')]])){if(_0x47805a[_0xb4c4('0x60')]&&queues[_0x47805a[_0xb4c4('0x60')]]){queues[_0x47805a[_0xb4c4('0x60')]][_0xb4c4('0x22')]=0x1;queues[_0x47805a[_0xb4c4('0x58')]]=_[_0xb4c4('0x61')](queues[_0x47805a[_0xb4c4('0x60')]]);queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0x12')]=_0x47805a[_0xb4c4('0x58')];queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0x22')]=0x2;queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0xa')]=queues[_0x47805a[_0xb4c4('0x52')]]['calleridnum'];queues[_0x47805a['transfertargetuniqueid']][_0xb4c4('0x59')]=queues[_0x47805a[_0xb4c4('0x52')]][_0xb4c4('0x59')];queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0x39')]=utils[_0xb4c4('0x2d')]();queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0x36')]=utils[_0xb4c4('0x2d')]();queues[_0x47805a['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x47805a['transfertargetuniqueid']]['mohtime']=0x0;utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x62'),_0x47805a['origtransfereruniqueid'],queues[_0x47805a['transfertargetuniqueid']][_0xb4c4('0x21')],queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0x12')],queues[_0x47805a[_0xb4c4('0x58')]]['calleridnum'],queues[_0x47805a[_0xb4c4('0x58')]][_0xb4c4('0x59')]));}else{utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x5c'),_0x47805a[_0xb4c4('0x51')],queues[_0x47805a['secondtransfererlinkedid']][_0xb4c4('0x21')],_0x47805a[_0xb4c4('0x52')]));queues[_0x47805a[_0xb4c4('0x53')]][_0xb4c4('0x12')]=_0x47805a[_0xb4c4('0x52')];}}}}catch(_0x897aa4){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')](_0xb4c4('0x63'),_0x47805a[_0xb4c4('0x51')]),_0x897aa4);}};exports[_0xb4c4('0x64')]=function(_0x59b284){try{if(!_[_0xb4c4('0x1a')](queues[_0x59b284['uniqueid']])){utils[_0xb4c4('0x14')](util[_0xb4c4('0x4')](_0xb4c4('0x65'),_0x59b284[_0xb4c4('0x6')]),_0x59b284);queues[_0x59b284['uniqueid']][_0xb4c4('0x66')]=utils[_0xb4c4('0x2d')]();utils[_0xb4c4('0x3')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x59b284['uniqueid'],queues[_0x59b284[_0xb4c4('0x6')]][_0xb4c4('0x21')],queues[_0x59b284['uniqueid']]['musiconholdstartAt']));}}catch(_0x2cef7b){utils['error'](util[_0xb4c4('0x4')](_0xb4c4('0x65'),_0x59b284[_0xb4c4('0x6')]),_0x2cef7b);}};exports[_0xb4c4('0x67')]=function(_0x288c59){try{if(!_[_0xb4c4('0x1a')](queues[_0x288c59[_0xb4c4('0x6')]])){if(!_['isNil'](queues[_0x288c59['uniqueid']][_0xb4c4('0x66')])){utils['debug'](util[_0xb4c4('0x4')](_0xb4c4('0x68'),_0x288c59[_0xb4c4('0x6')]),_0x288c59);queues[_0x288c59[_0xb4c4('0x6')]]['mohtime']+=utils[_0xb4c4('0x38')](utils[_0xb4c4('0x2d')](),queues[_0x288c59[_0xb4c4('0x6')]][_0xb4c4('0x66')]);utils[_0xb4c4('0x3')](util[_0xb4c4('0x4')](_0xb4c4('0x69'),_0x288c59[_0xb4c4('0x6')],queues[_0x288c59['uniqueid']]['name'],queues[_0x288c59['uniqueid']][_0xb4c4('0x5a')]));delete queues[_0x288c59[_0xb4c4('0x6')]][_0xb4c4('0x66')];}}}catch(_0x2af415){utils[_0xb4c4('0x18')](util[_0xb4c4('0x4')](_0xb4c4('0x68'),_0x288c59[_0xb4c4('0x6')]),_0x2af415);}}; \ No newline at end of file +var _0x81f6=['secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','info','position','assign','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','transfertargetuniqueid','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','origtransfererlinkedid'];(function(_0x3ef21a,_0x46b2b5){var _0x2f5710=function(_0x1d573a){while(--_0x1d573a){_0x3ef21a['push'](_0x3ef21a['shift']());}};_0x2f5710(++_0x46b2b5);}(_0x81f6,0x1ae));var _0x681f=function(_0x5b6d8c,_0x547ba4){_0x5b6d8c=_0x5b6d8c-0x0;var _0x1d4e23=_0x81f6[_0x5b6d8c];return _0x1d4e23;};'use strict';var _=require('lodash');var util=require(_0x681f('0x0'));var utils=require(_0x681f('0x1'));var queues={};function writeDB(_0x301d0a){utils['info'](util[_0x681f('0x2')](_0x681f('0x3'),_0x301d0a[_0x681f('0x4')],_0x301d0a[_0x681f('0x5')],_0x301d0a['queue'],_0x301d0a[_0x681f('0x6')],_0x301d0a[_0x681f('0x7')],_0x301d0a[_0x681f('0x8')],_0x301d0a[_0x681f('0x9')]));if(_0x301d0a['queue']){utils[_0x681f('0xa')](_0x301d0a[_0x681f('0xb')])['then'](function(_0x4a80fc){if(_0x4a80fc){_0x301d0a['type']=_0x4a80fc[_0x681f('0xc')];}utils[_0x681f('0xd')]('CreateVoiceQueueReport',_0x301d0a);});}else{utils[_0x681f('0xd')](_0x681f('0xe'),_0x301d0a);}if(_0x301d0a[_0x681f('0xf')]){delete queues[_0x301d0a[_0x681f('0xf')]];}else{delete queues[_0x301d0a['uniqueid']];}}exports['queuecallerjoin']=function(_0x57258b){try{utils[_0x681f('0x10')](util[_0x681f('0x2')](_0x681f('0x11'),_0x57258b[_0x681f('0x4')]),_0x57258b);utils[_0x681f('0x12')](util[_0x681f('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x57258b[_0x681f('0x4')],_0x57258b[_0x681f('0xb')],_0x57258b[_0x681f('0x13')]));queues[_0x57258b[_0x681f('0x4')]]=_[_0x681f('0x14')](_0x57258b,{'originalposition':_0x57258b['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x8aa713){utils[_0x681f('0x15')](util[_0x681f('0x2')](_0x681f('0x11'),_0x57258b['uniqueid']),_0x8aa713);}};exports['hangup']=function(_0x278ade){try{if(!_[_0x681f('0x16')](queues[_0x278ade[_0x681f('0x4')]])){utils[_0x681f('0x10')](util[_0x681f('0x2')](_0x681f('0x17'),_0x278ade['uniqueid']),_0x278ade);if(queues[_0x278ade['uniqueid']][_0x681f('0x18')]){if(!queues[_0x278ade[_0x681f('0x4')]][_0x681f('0x19')]&&!queues[_0x278ade['uniqueid']][_0x681f('0x1a')]){queues[_0x278ade[_0x681f('0x4')]]['queuecallercomplete']=!![];queues[_0x278ade[_0x681f('0x4')]][_0x681f('0x1b')]=utils[_0x681f('0x1c')]();queues[_0x278ade[_0x681f('0x4')]]['queuecallerexitreason']='COMPLETEDBYAGENT';}utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x1d'),_0x278ade[_0x681f('0x4')],queues[_0x278ade[_0x681f('0x4')]][_0x681f('0x1e')],queues[_0x278ade['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x278ade['uniqueid']]);}else if(queues[_0x278ade[_0x681f('0x4')]][_0x681f('0xf')]){utils[_0x681f('0x12')](util['format'](_0x681f('0x1f'),_0x278ade[_0x681f('0x4')],queues[_0x278ade[_0x681f('0x4')]][_0x681f('0x1e')],queues[_0x278ade[_0x681f('0x4')]]['transfereduniqueid']));queues[queues[_0x278ade['uniqueid']][_0x681f('0xf')]]=queues[_0x278ade[_0x681f('0x4')]];queues[queues[_0x278ade[_0x681f('0x4')]][_0x681f('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x278ade['uniqueid']];}}}catch(_0x5bf6b6){utils[_0x681f('0x15')](util['format'](_0x681f('0x17'),_0x278ade[_0x681f('0x4')]),_0x5bf6b6);}};exports[_0x681f('0x20')]=function(_0x18e64c){try{utils[_0x681f('0x10')](util[_0x681f('0x2')](_0x681f('0x21'),_0x18e64c[_0x681f('0x4')]),_0x18e64c);if(!_[_0x681f('0x16')](_0x18e64c[_0x681f('0x22')][_0x681f('0x23')])&&_0x18e64c['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0x681f('0x16')](queues[_0x18e64c[_0x681f('0x4')]])){queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x19')]=![];queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x24')]=null;queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x1a')]=!![];queues[_0x18e64c[_0x681f('0x4')]]['queuecallerexitAt']=utils[_0x681f('0x1c')]();queues[_0x18e64c['uniqueid']]['queuecallerexitreason']=_0x18e64c['value'][_0x681f('0x25')]();utils['info'](util['format'](_0x681f('0x26'),_0x18e64c[_0x681f('0x4')],queues[_0x18e64c['uniqueid']][_0x681f('0x1e')],_0x18e64c[_0x681f('0x27')],queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x9')]));writeDB(queues[_0x18e64c[_0x681f('0x4')]]);}}else if(!_[_0x681f('0x16')](_0x18e64c[_0x681f('0x22')][_0x681f('0x28')])){if(!_[_0x681f('0x16')](queues[_0x18e64c[_0x681f('0x4')]])&&!queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x19')]){queues[_0x18e64c['uniqueid']][_0x681f('0x19')]=![];queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x24')]=null;queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x1a')]=!![];queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x29')]=utils[_0x681f('0x1c')]();queues[_0x18e64c[_0x681f('0x4')]][_0x681f('0x9')]=_0x681f('0x2a');utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x2b'),_0x18e64c[_0x681f('0x4')],queues[_0x18e64c['uniqueid']][_0x681f('0x1e')],_0x18e64c[_0x681f('0x27')],queues[_0x18e64c['uniqueid']][_0x681f('0x9')]));}}}catch(_0x21f91f){utils[_0x681f('0x15')](util[_0x681f('0x2')]('[%s][queues][varset]',_0x18e64c[_0x681f('0x4')]),_0x21f91f);}};exports[_0x681f('0x19')]=function(_0x54f057){try{if(!_['isNil'](queues[_0x54f057[_0x681f('0x4')]])){utils[_0x681f('0x10')](util[_0x681f('0x2')]('[%s][queues][queuecallerabandon]',_0x54f057[_0x681f('0x4')]),_0x54f057);queues[_0x54f057[_0x681f('0x4')]]['queuecallerexit']=![];queues[_0x54f057['uniqueid']][_0x681f('0x29')]=null;queues[_0x54f057['uniqueid']][_0x681f('0x19')]=!![];queues[_0x54f057[_0x681f('0x4')]][_0x681f('0x24')]=utils[_0x681f('0x1c')]();queues[_0x54f057['uniqueid']][_0x681f('0x9')]=_0x681f('0x2c');utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x2d'),_0x54f057[_0x681f('0x4')],queues[_0x54f057[_0x681f('0x4')]]['name'],queues[_0x54f057[_0x681f('0x4')]][_0x681f('0x9')]));}}catch(_0x4a731d){utils[_0x681f('0x15')](util[_0x681f('0x2')](_0x681f('0x2e'),_0x54f057[_0x681f('0x4')]),_0x4a731d);}};exports[_0x681f('0x2f')]=function(_0x1a6792){try{if(!_[_0x681f('0x16')](queues[_0x1a6792[_0x681f('0x4')]])){utils[_0x681f('0x10')](util[_0x681f('0x2')](_0x681f('0x30'),_0x1a6792[_0x681f('0x4')]),_0x1a6792);utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x31'),_0x1a6792[_0x681f('0x4')],queues[_0x1a6792[_0x681f('0x4')]]['name'],_0x1a6792['connectedlinenum'],_0x1a6792[_0x681f('0x32')]));queues[_0x1a6792[_0x681f('0x4')]]['queuecallerleave']=!![];queues[_0x1a6792[_0x681f('0x4')]][_0x681f('0x18')]=utils[_0x681f('0x1c')]();queues[_0x1a6792[_0x681f('0x4')]]['holdtime']=utils[_0x681f('0x33')](queues[_0x1a6792['uniqueid']]['queuecallerleaveAt'],queues[_0x1a6792[_0x681f('0x4')]][_0x681f('0x34')]);queues[_0x1a6792[_0x681f('0x4')]][_0x681f('0x13')]=_0x1a6792[_0x681f('0x13')];queues[_0x1a6792['uniqueid']][_0x681f('0x35')]=_0x1a6792['count'];queues[_0x1a6792[_0x681f('0x4')]][_0x681f('0x36')]=_0x1a6792['connectedlinenum'];queues[_0x1a6792[_0x681f('0x4')]][_0x681f('0x32')]=_0x1a6792[_0x681f('0x32')];}}catch(_0x506b02){utils[_0x681f('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x1a6792['uniqueid']),_0x506b02);}};exports['agentconnect']=function(_0x49e99f){try{if(!_[_0x681f('0x16')](queues[_0x49e99f[_0x681f('0x4')]])){utils['debug'](util[_0x681f('0x2')]('[%s][queues][agentconnect]',_0x49e99f[_0x681f('0x4')]),_0x49e99f);utils[_0x681f('0x12')](util['format'](_0x681f('0x37'),_0x49e99f['uniqueid'],queues[_0x49e99f[_0x681f('0x4')]]['name'],_0x49e99f[_0x681f('0x38')],_0x49e99f[_0x681f('0x39')]));queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x19')]=![];queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x19')]=![];queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x24')]=null;queues[_0x49e99f['uniqueid']]['queuecallerexit']=![];queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x9')]=null;queues[_0x49e99f[_0x681f('0x4')]]['queuecallerexitAt']=null;queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x3a')]=!![];queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x8')]=_0x49e99f[_0x681f('0x39')];queues[_0x49e99f[_0x681f('0x4')]][_0x681f('0x6')]=_0x49e99f[_0x681f('0x38')];}}catch(_0x1a5be9){utils['error'](util['format'](_0x681f('0x3b'),_0x49e99f[_0x681f('0x4')]),_0x1a5be9);}};exports['agentcomplete']=function(_0x33c8da){try{if(!_[_0x681f('0x16')](queues[_0x33c8da[_0x681f('0x4')]])){if(queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x18')]){utils[_0x681f('0x10')](util['format'](_0x681f('0x3c'),_0x33c8da[_0x681f('0x4')]),_0x33c8da);queues[_0x33c8da['uniqueid']]['queuecallerabandon']=![];queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x19')]=![];queues[_0x33c8da[_0x681f('0x4')]]['queuecallerabandonAt']=null;queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x1a')]=![];queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x29')]=null;queues[_0x33c8da[_0x681f('0x4')]]['assigned']=!![];queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x6')]=_0x33c8da[_0x681f('0x38')];queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x3d')]=!![];queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x1b')]=utils[_0x681f('0x1c')]();if(_0x33c8da[_0x681f('0x3e')]==_0x681f('0x3f')){if(!queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x3f')]){queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x9')]=_0x681f('0x40');}}else{queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x9')]=_0x681f('0x41')+_0x33c8da[_0x681f('0x3e')][_0x681f('0x25')]();}utils['info'](util[_0x681f('0x2')](_0x681f('0x42'),_0x33c8da[_0x681f('0x4')],queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x1e')],_0x33c8da['membername'],queues[_0x33c8da[_0x681f('0x4')]][_0x681f('0x9')]));writeDB(queues[_0x33c8da[_0x681f('0x4')]]);}}}catch(_0x3529f6){utils[_0x681f('0x15')](util[_0x681f('0x2')](_0x681f('0x3c'),_0x33c8da[_0x681f('0x4')]),_0x3529f6);}};exports[_0x681f('0x43')]=function(_0x5d3ca0){try{if(!_[_0x681f('0x16')](queues[_0x5d3ca0['transfereeuniqueid']])){utils['debug'](util[_0x681f('0x2')](_0x681f('0x44'),_0x5d3ca0[_0x681f('0x4')]),_0x5d3ca0);queues[_0x5d3ca0[_0x681f('0x45')]][_0x681f('0x3f')]=!![];queues[_0x5d3ca0[_0x681f('0x45')]][_0x681f('0x46')]='BLIND';queues[_0x5d3ca0['transfereeuniqueid']][_0x681f('0x47')]=_0x5d3ca0[_0x681f('0x48')];queues[_0x5d3ca0['transfereeuniqueid']][_0x681f('0x49')]=_0x5d3ca0[_0x681f('0x45')];queues[_0x5d3ca0[_0x681f('0x45')]][_0x681f('0x9')]='BLINDTRANSFER';utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x4a'),_0x5d3ca0[_0x681f('0x4')],queues[_0x5d3ca0[_0x681f('0x45')]]['name'],_0x5d3ca0[_0x681f('0x45')],_0x5d3ca0[_0x681f('0x48')]));}}catch(_0x1aa551){utils[_0x681f('0x15')](util['format'](_0x681f('0x44'),_0x5d3ca0[_0x681f('0x4')]),_0x1aa551);}};exports[_0x681f('0x4b')]=function(_0x377d21){try{utils['debug'](util[_0x681f('0x2')](_0x681f('0x4c'),_0x377d21[_0x681f('0x4d')]),_0x377d21);if(_0x377d21[_0x681f('0x4d')]==_0x377d21['origtransfererlinkedid']){if(!_[_0x681f('0x16')](queues[_0x377d21['secondtransfererlinkedid']])){utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x4e'),_0x377d21[_0x681f('0x4d')],queues[_0x377d21['secondtransfererlinkedid']][_0x681f('0x1e')],_0x377d21[_0x681f('0x4f')]));queues[_0x377d21[_0x681f('0x50')]]['transfer']=!![];queues[_0x377d21[_0x681f('0x50')]]['transfertype']=_0x681f('0x51');queues[_0x377d21[_0x681f('0x50')]][_0x681f('0x47')]=_0x377d21[_0x681f('0x4f')];queues[_0x377d21[_0x681f('0x50')]][_0x681f('0x49')]=_0x377d21[_0x681f('0x4d')];queues[_0x377d21[_0x681f('0x50')]]['queuecallerexitreason']=_0x681f('0x52');}if(!_[_0x681f('0x16')](queues[_0x377d21['origtransfererlinkedid']])){if(_0x377d21['transfereelinkedid']&&queues[_0x377d21[_0x681f('0x53')]]){queues[_0x377d21[_0x681f('0x53')]][_0x681f('0x54')]=0x1;queues[_0x377d21['transfereeuniqueid']]=_['clone'](queues[_0x377d21[_0x681f('0x53')]]);queues[_0x377d21[_0x681f('0x45')]][_0x681f('0xf')]=_0x377d21[_0x681f('0x55')];queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x54')]=0x2;queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x7')]=queues[_0x377d21['secondtransfererlinkedid']][_0x681f('0x7')];queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x56')]=queues[_0x377d21['secondtransfererlinkedid']][_0x681f('0x56')];queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x34')]=utils['now']();queues[_0x377d21['transfereeuniqueid']][_0x681f('0x18')]=utils[_0x681f('0x1c')]();queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x57')]=0x0;queues[_0x377d21[_0x681f('0x45')]]['mohtime']=0x0;utils['info'](util[_0x681f('0x2')](_0x681f('0x58'),_0x377d21[_0x681f('0x4d')],queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x1e')],queues[_0x377d21['transfereeuniqueid']][_0x681f('0x7')],queues[_0x377d21[_0x681f('0x45')]][_0x681f('0x56')]));}else{utils['info'](util[_0x681f('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x377d21['origtransfereruniqueid'],queues[_0x377d21[_0x681f('0x59')]][_0x681f('0x1e')],_0x377d21[_0x681f('0x50')]));queues[_0x377d21[_0x681f('0x59')]][_0x681f('0xf')]=_0x377d21[_0x681f('0x50')];}}}else if(_0x377d21[_0x681f('0x5a')]==_0x377d21[_0x681f('0x50')]){if(!_['isNil'](queues[_0x377d21[_0x681f('0x59')]])){utils[_0x681f('0x12')](util[_0x681f('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x377d21[_0x681f('0x4d')],queues[_0x377d21[_0x681f('0x59')]][_0x681f('0x1e')],_0x377d21[_0x681f('0x5a')],_0x377d21[_0x681f('0x5b')]));queues[_0x377d21[_0x681f('0x59')]][_0x681f('0x3f')]=!![];queues[_0x377d21[_0x681f('0x59')]][_0x681f('0x46')]=_0x681f('0x51');queues[_0x377d21['origtransfererlinkedid']]['transferexten']=_0x377d21[_0x681f('0x5b')];queues[_0x377d21[_0x681f('0x59')]]['transferuniqueid']=_0x377d21['secondtransfereruniqueid'];queues[_0x377d21[_0x681f('0x59')]][_0x681f('0x9')]=_0x681f('0x52');}if(!_[_0x681f('0x16')](queues[_0x377d21[_0x681f('0x50')]])){if(_0x377d21[_0x681f('0x5c')]&&queues[_0x377d21[_0x681f('0x5c')]]){queues[_0x377d21[_0x681f('0x5c')]][_0x681f('0x54')]=0x1;queues[_0x377d21[_0x681f('0x55')]]=_[_0x681f('0x5d')](queues[_0x377d21[_0x681f('0x5c')]]);queues[_0x377d21[_0x681f('0x55')]][_0x681f('0xf')]=_0x377d21[_0x681f('0x55')];queues[_0x377d21['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x377d21[_0x681f('0x55')]][_0x681f('0x7')]=queues[_0x377d21[_0x681f('0x59')]]['calleridnum'];queues[_0x377d21[_0x681f('0x55')]]['calleridname']=queues[_0x377d21['origtransfererlinkedid']]['calleridname'];queues[_0x377d21[_0x681f('0x55')]][_0x681f('0x34')]=utils[_0x681f('0x1c')]();queues[_0x377d21[_0x681f('0x55')]][_0x681f('0x18')]=utils[_0x681f('0x1c')]();queues[_0x377d21[_0x681f('0x55')]][_0x681f('0x57')]=0x0;queues[_0x377d21[_0x681f('0x55')]]['mohtime']=0x0;utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x5e'),_0x377d21[_0x681f('0x4d')],queues[_0x377d21[_0x681f('0x55')]][_0x681f('0x1e')],queues[_0x377d21[_0x681f('0x55')]][_0x681f('0xf')],queues[_0x377d21[_0x681f('0x55')]][_0x681f('0x7')],queues[_0x377d21[_0x681f('0x55')]]['calleridname']));}else{utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x5f'),_0x377d21['origtransfereruniqueid'],queues[_0x377d21[_0x681f('0x50')]][_0x681f('0x1e')],_0x377d21[_0x681f('0x59')]));queues[_0x377d21[_0x681f('0x50')]]['transfereduniqueid']=_0x377d21[_0x681f('0x59')];}}}}catch(_0x4e75e7){utils['error'](util[_0x681f('0x2')](_0x681f('0x4c'),_0x377d21['origtransfereruniqueid']),_0x4e75e7);}};exports[_0x681f('0x60')]=function(_0x184caa){try{if(!_[_0x681f('0x16')](queues[_0x184caa[_0x681f('0x4')]])){utils['debug'](util[_0x681f('0x2')](_0x681f('0x61'),_0x184caa[_0x681f('0x4')]),_0x184caa);queues[_0x184caa['uniqueid']][_0x681f('0x62')]=utils[_0x681f('0x1c')]();utils[_0x681f('0x12')](util['format'](_0x681f('0x63'),_0x184caa[_0x681f('0x4')],queues[_0x184caa['uniqueid']]['name'],queues[_0x184caa[_0x681f('0x4')]][_0x681f('0x62')]));}}catch(_0x55e074){utils[_0x681f('0x15')](util[_0x681f('0x2')]('[%s][queues][musiconholdstart]',_0x184caa[_0x681f('0x4')]),_0x55e074);}};exports[_0x681f('0x64')]=function(_0x513736){try{if(!_[_0x681f('0x16')](queues[_0x513736[_0x681f('0x4')]])){if(!_[_0x681f('0x16')](queues[_0x513736[_0x681f('0x4')]]['musiconholdstartAt'])){utils[_0x681f('0x10')](util[_0x681f('0x2')](_0x681f('0x65'),_0x513736[_0x681f('0x4')]),_0x513736);queues[_0x513736[_0x681f('0x4')]][_0x681f('0x66')]+=utils[_0x681f('0x33')](utils[_0x681f('0x1c')](),queues[_0x513736[_0x681f('0x4')]][_0x681f('0x62')]);utils[_0x681f('0x12')](util[_0x681f('0x2')](_0x681f('0x67'),_0x513736['uniqueid'],queues[_0x513736[_0x681f('0x4')]]['name'],queues[_0x513736['uniqueid']][_0x681f('0x66')]));delete queues[_0x513736['uniqueid']][_0x681f('0x62')];}}}catch(_0x3547d6){utils['error'](util[_0x681f('0x2')]('[%s][queues][musiconholdstop]',_0x513736[_0x681f('0x4')]),_0x3547d6);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 025bcb7..6764486 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 _0x5bf2=['varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','.WAV','find','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','newexten','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','format','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','debug','[%s][recordings][newstate]','channelstate','isNil','transfer','linkedid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bf2,0x1f1));var _0x25bf=function(_0x483dd9,_0xb38973){_0x483dd9=_0x483dd9-0x0;var _0x4ce8b6=_0x5bf2[_0x483dd9];return _0x4ce8b6;};'use strict';var _=require(_0x25bf('0x0'));var util=require(_0x25bf('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x50f040){utils[_0x25bf('0x2')](util[_0x25bf('0x3')]('[%s][recordings][writeDB]',_0x50f040[_0x25bf('0x4')]));if(_0x50f040[_0x25bf('0x5')]){utils[_0x25bf('0x6')](_0x50f040[_0x25bf('0x5')])['then'](function(_0x4779a7){if(_0x4779a7){_0x50f040[_0x25bf('0x7')]=_0x4779a7[_0x25bf('0x8')];_0x50f040[_0x25bf('0x9')]=_0x4779a7['id'];}utils[_0x25bf('0xa')]('CreateVoiceRecording',_0x50f040);});}else{utils[_0x25bf('0xa')](_0x25bf('0xb'),_0x50f040);}}exports['newchannel']=function(_0x12c7d6){try{utils['debug'](util[_0x25bf('0x3')](_0x25bf('0xc'),_0x12c7d6['uniqueid']),_0x12c7d6);if(_0x12c7d6['uniqueid']==_0x12c7d6['linkedid']){utils[_0x25bf('0x2')](util['format'](_0x25bf('0xd'),_0x12c7d6[_0x25bf('0x4')],_0x12c7d6['context'],_0x12c7d6[_0x25bf('0xe')]));recordings[_0x12c7d6[_0x25bf('0x4')]]={'uniqueid':_0x12c7d6[_0x25bf('0x4')],'accountcode':_0x12c7d6[_0x25bf('0x5')],'exten':_0x12c7d6[_0x25bf('0xe')],'context':_0x12c7d6[_0x25bf('0xf')],'channel':_0x12c7d6[_0x25bf('0x10')],'monitors':[]};}}catch(_0x14e945){utils[_0x25bf('0x11')](util[_0x25bf('0x3')](_0x25bf('0xc'),_0x12c7d6[_0x25bf('0x4')]),_0x14e945);}};exports[_0x25bf('0x12')]=function(_0x21c0bb){try{utils[_0x25bf('0x13')](util[_0x25bf('0x3')](_0x25bf('0x14'),_0x21c0bb['uniqueid']),_0x21c0bb);if(!_['isNil'](recordings[_0x21c0bb[_0x25bf('0x4')]])&&_0x21c0bb[_0x25bf('0x15')]==0x6){utils['info'](util[_0x25bf('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x21c0bb[_0x25bf('0x4')],_0x21c0bb['context'],_0x21c0bb[_0x25bf('0x10')]));}else if(!_[_0x25bf('0x16')](recordings[_0x21c0bb['linkedid']])&&_0x21c0bb[_0x25bf('0x15')]==0x6&&_0x21c0bb[_0x25bf('0xf')]!=_0x25bf('0x17')){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x21c0bb[_0x25bf('0x4')],_0x21c0bb[_0x25bf('0x18')],_0x21c0bb[_0x25bf('0xf')],_0x21c0bb[_0x25bf('0x10')]));recordings[_0x21c0bb[_0x25bf('0x18')]][_0x25bf('0x5')]=_0x21c0bb[_0x25bf('0x5')];}}catch(_0x133ee3){utils[_0x25bf('0x11')](util[_0x25bf('0x3')](_0x25bf('0x14'),_0x21c0bb['uniqueid']),_0x133ee3);}};exports[_0x25bf('0x19')]=function(_0x385c12){try{if(!_['isNil'](_0x385c12['variable'])&&!_[_0x25bf('0x16')](_0x385c12[_0x25bf('0x1a')]['mixmonitor_filename'])){utils['debug'](util[_0x25bf('0x3')](_0x25bf('0x1b'),_0x385c12[_0x25bf('0x4')]),_0x385c12);utils[_0x25bf('0x2')](util[_0x25bf('0x3')](_0x25bf('0x1c'),_0x385c12[_0x25bf('0x4')],_0x385c12[_0x25bf('0x1a')],_0x385c12['value']));if(_[_0x25bf('0x1d')](_0x385c12[_0x25bf('0x1e')],_0x25bf('0x1f'))){_0x385c12[_0x25bf('0x1e')]=_0x385c12['value']['replace'](_0x25bf('0x1f'),_0x25bf('0x20'));}if(recordings[_0x385c12[_0x25bf('0x18')]]){var _0x1b5e9b=_[_0x25bf('0x21')](recordings[_0x385c12[_0x25bf('0x18')]][_0x25bf('0x22')],{'value':_0x385c12['value']});if(_['isNil'](_0x1b5e9b)){recordings[_0x385c12[_0x25bf('0x18')]][_0x25bf('0x22')]['push']({'value':_0x385c12['value']});}}}}catch(_0x29fc4e){utils['error'](util[_0x25bf('0x3')](_0x25bf('0x1b'),_0x385c12['uniqueid']),_0x29fc4e);}};exports['hangup']=function(_0x403e30){try{if(!_[_0x25bf('0x16')](recordings[_0x403e30[_0x25bf('0x4')]])){utils[_0x25bf('0x13')](util['format'](_0x25bf('0x23'),_0x403e30[_0x25bf('0x4')]),_0x403e30);utils[_0x25bf('0x2')](util[_0x25bf('0x3')](_0x25bf('0x24'),_0x403e30[_0x25bf('0x4')],_0x403e30['calleridnum'],_0x403e30[_0x25bf('0x25')],_0x403e30[_0x25bf('0x26')]));recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x27')]=_0x403e30['calleridnum'];recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x25')]=_0x403e30[_0x25bf('0x25')];recordings[_0x403e30[_0x25bf('0x4')]]['connectedlinenum']=_0x403e30[_0x25bf('0x28')];recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x29')]=_0x403e30['connectedlinename'];if(recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x2a')]==_0x25bf('0x2b')&&recordings[_0x403e30[_0x25bf('0x4')]]['accountcode']){recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x28')]=recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x5')];recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x29')]='';}recordings[_0x403e30[_0x25bf('0x4')]][_0x25bf('0x22')]['forEach'](function(_0x37fa20){var _0x4950cd=_['clone'](recordings[_0x403e30[_0x25bf('0x4')]]);_0x4950cd[_0x25bf('0x1e')]=_0x37fa20['value'];writeDB(_0x4950cd);});delete recordings[_0x403e30[_0x25bf('0x4')]];}}catch(_0x4cdd28){utils['error'](util[_0x25bf('0x3')](_0x25bf('0x23'),_0x403e30[_0x25bf('0x4')]),_0x4cdd28);}};exports[_0x25bf('0x2c')]=function(_0x150148){try{if(!_['isNil'](recordings[_0x150148[_0x25bf('0x4')]])){utils['debug'](util[_0x25bf('0x3')]('[%s][recordings][newexten]',_0x150148['uniqueid']),_0x150148);utils['info'](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x150148[_0x25bf('0x4')],_0x150148[_0x25bf('0x2d')],_0x150148[_0x25bf('0x2e')]));if(_0x150148[_0x25bf('0x2d')][_0x25bf('0x2f')]()=='set'&&_[_0x25bf('0x30')](_0x150148[_0x25bf('0x2e')]['toLowerCase'](),_0x25bf('0x31'))){var _0x49298a=_0x150148[_0x25bf('0x2e')][_0x25bf('0x32')]('=');var _0x3c5797=_0x49298a[0x0][_0x25bf('0x33')](_0x49298a[0x0][_0x25bf('0x34')]('(')+0x1,_0x49298a[0x0][_0x25bf('0x34')](')'));var _0x5410f6=_0x49298a[0x1];recordings[_0x150148[_0x25bf('0x4')]][_0x3c5797]=_0x5410f6;}}}catch(_0xc41f53){utils[_0x25bf('0x11')](util['format'](_0x25bf('0x35'),_0x150148['uniqueid']),_0xc41f53);}};exports[_0x25bf('0x36')]=function(_0xbefb8e){try{if(!_['isNil'](recordings[_0xbefb8e['uniqueid']])){utils[_0x25bf('0x13')](util[_0x25bf('0x3')](_0x25bf('0x37'),_0xbefb8e[_0x25bf('0x4')]),_0xbefb8e);utils[_0x25bf('0x2')](util[_0x25bf('0x3')](_0x25bf('0x38'),_0xbefb8e['uniqueid'],_0xbefb8e[_0x25bf('0x39')]));recordings[_0xbefb8e[_0x25bf('0x4')]][_0x25bf('0x39')]=_0xbefb8e['queue'];}}catch(_0x35e37b){utils[_0x25bf('0x11')](util[_0x25bf('0x3')](_0x25bf('0x37'),_0xbefb8e[_0x25bf('0x4')]),_0x35e37b);}}; \ No newline at end of file +var _0x1f8c=['name','UserId','CreateVoiceRecording','request','newchannel','[%s][recordings][newchannel]','linkedid','context','exten','channel','error','debug','[%s][recordings][newstate]','isNil','channelstate','transfer','info','varset','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','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','format','uniqueid','accountcode','then','membername'];(function(_0x2cc61a,_0x13f591){var _0xbbdfb4=function(_0xb2524f){while(--_0xb2524f){_0x2cc61a['push'](_0x2cc61a['shift']());}};_0xbbdfb4(++_0x13f591);}(_0x1f8c,0x126));var _0xc1f8=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x1f8c[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require(_0xc1f8('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0xe208bc){utils['info'](util[_0xc1f8('0x1')]('[%s][recordings][writeDB]',_0xe208bc[_0xc1f8('0x2')]));if(_0xe208bc[_0xc1f8('0x3')]){utils['getUserByInternal'](_0xe208bc[_0xc1f8('0x3')])[_0xc1f8('0x4')](function(_0x43fccf){if(_0x43fccf){_0xe208bc[_0xc1f8('0x5')]=_0x43fccf[_0xc1f8('0x6')];_0xe208bc[_0xc1f8('0x7')]=_0x43fccf['id'];}utils['request'](_0xc1f8('0x8'),_0xe208bc);});}else{utils[_0xc1f8('0x9')](_0xc1f8('0x8'),_0xe208bc);}}exports[_0xc1f8('0xa')]=function(_0x559c00){try{utils['debug'](util[_0xc1f8('0x1')](_0xc1f8('0xb'),_0x559c00[_0xc1f8('0x2')]),_0x559c00);if(_0x559c00[_0xc1f8('0x2')]==_0x559c00[_0xc1f8('0xc')]){utils['info'](util[_0xc1f8('0x1')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x559c00[_0xc1f8('0x2')],_0x559c00[_0xc1f8('0xd')],_0x559c00['exten']));recordings[_0x559c00[_0xc1f8('0x2')]]={'uniqueid':_0x559c00[_0xc1f8('0x2')],'accountcode':_0x559c00['accountcode'],'exten':_0x559c00[_0xc1f8('0xe')],'context':_0x559c00[_0xc1f8('0xd')],'channel':_0x559c00[_0xc1f8('0xf')],'monitors':[]};}}catch(_0x35c050){utils[_0xc1f8('0x10')](util[_0xc1f8('0x1')]('[%s][recordings][newchannel]',_0x559c00[_0xc1f8('0x2')]),_0x35c050);}};exports['newstate']=function(_0x2ce487){try{utils[_0xc1f8('0x11')](util[_0xc1f8('0x1')](_0xc1f8('0x12'),_0x2ce487[_0xc1f8('0x2')]),_0x2ce487);if(!_[_0xc1f8('0x13')](recordings[_0x2ce487[_0xc1f8('0x2')]])&&_0x2ce487[_0xc1f8('0x14')]==0x6){utils['info'](util[_0xc1f8('0x1')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x2ce487[_0xc1f8('0x2')],_0x2ce487[_0xc1f8('0xd')],_0x2ce487[_0xc1f8('0xf')]));}else if(!_[_0xc1f8('0x13')](recordings[_0x2ce487[_0xc1f8('0xc')]])&&_0x2ce487[_0xc1f8('0x14')]==0x6&&_0x2ce487[_0xc1f8('0xd')]!=_0xc1f8('0x15')){utils[_0xc1f8('0x16')](util[_0xc1f8('0x1')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2ce487['uniqueid'],_0x2ce487[_0xc1f8('0xc')],_0x2ce487[_0xc1f8('0xd')],_0x2ce487['channel']));recordings[_0x2ce487['linkedid']][_0xc1f8('0x3')]=_0x2ce487[_0xc1f8('0x3')];}}catch(_0x307555){utils['error'](util['format']('[%s][recordings][newstate]',_0x2ce487[_0xc1f8('0x2')]),_0x307555);}};exports[_0xc1f8('0x17')]=function(_0x2873c9){try{if(!_['isNil'](_0x2873c9[_0xc1f8('0x18')])&&!_[_0xc1f8('0x13')](_0x2873c9[_0xc1f8('0x18')][_0xc1f8('0x19')])){utils['debug'](util['format'](_0xc1f8('0x1a'),_0x2873c9[_0xc1f8('0x2')]),_0x2873c9);utils['info'](util['format'](_0xc1f8('0x1b'),_0x2873c9[_0xc1f8('0x2')],_0x2873c9['variable'],_0x2873c9[_0xc1f8('0x1c')]));if(_[_0xc1f8('0x1d')](_0x2873c9[_0xc1f8('0x1c')],_0xc1f8('0x1e'))){_0x2873c9[_0xc1f8('0x1c')]=_0x2873c9[_0xc1f8('0x1c')][_0xc1f8('0x1f')](_0xc1f8('0x1e'),'.WAV');}if(recordings[_0x2873c9[_0xc1f8('0xc')]]){var _0x374507=_[_0xc1f8('0x20')](recordings[_0x2873c9[_0xc1f8('0xc')]][_0xc1f8('0x21')],{'value':_0x2873c9[_0xc1f8('0x1c')]});if(_[_0xc1f8('0x13')](_0x374507)){recordings[_0x2873c9[_0xc1f8('0xc')]]['monitors'][_0xc1f8('0x22')]({'value':_0x2873c9[_0xc1f8('0x1c')]});}}}}catch(_0x586e96){utils[_0xc1f8('0x10')](util[_0xc1f8('0x1')](_0xc1f8('0x1a'),_0x2873c9[_0xc1f8('0x2')]),_0x586e96);}};exports[_0xc1f8('0x23')]=function(_0x2dab76){try{if(!_['isNil'](recordings[_0x2dab76[_0xc1f8('0x2')]])){utils[_0xc1f8('0x11')](util[_0xc1f8('0x1')](_0xc1f8('0x24'),_0x2dab76[_0xc1f8('0x2')]),_0x2dab76);utils[_0xc1f8('0x16')](util[_0xc1f8('0x1')](_0xc1f8('0x25'),_0x2dab76[_0xc1f8('0x2')],_0x2dab76['calleridnum'],_0x2dab76[_0xc1f8('0x26')],_0x2dab76[_0xc1f8('0x27')]));recordings[_0x2dab76[_0xc1f8('0x2')]]['calleridnum']=_0x2dab76[_0xc1f8('0x28')];recordings[_0x2dab76['uniqueid']][_0xc1f8('0x26')]=_0x2dab76[_0xc1f8('0x26')];recordings[_0x2dab76[_0xc1f8('0x2')]]['connectedlinenum']=_0x2dab76[_0xc1f8('0x29')];recordings[_0x2dab76[_0xc1f8('0x2')]][_0xc1f8('0x2a')]=_0x2dab76[_0xc1f8('0x2a')];if(recordings[_0x2dab76['uniqueid']][_0xc1f8('0x2b')]==_0xc1f8('0x2c')&&recordings[_0x2dab76[_0xc1f8('0x2')]]['accountcode']){recordings[_0x2dab76[_0xc1f8('0x2')]]['connectedlinenum']=recordings[_0x2dab76[_0xc1f8('0x2')]]['accountcode'];recordings[_0x2dab76[_0xc1f8('0x2')]]['connectedlinename']='';}recordings[_0x2dab76[_0xc1f8('0x2')]]['monitors']['forEach'](function(_0x3d0f7e){var _0x44d7ff=_['clone'](recordings[_0x2dab76[_0xc1f8('0x2')]]);_0x44d7ff['value']=_0x3d0f7e[_0xc1f8('0x1c')];writeDB(_0x44d7ff);});delete recordings[_0x2dab76[_0xc1f8('0x2')]];}}catch(_0x2375c1){utils[_0xc1f8('0x10')](util['format']('[%s][recordings][hangup]',_0x2dab76[_0xc1f8('0x2')]),_0x2375c1);}};exports[_0xc1f8('0x2d')]=function(_0xd49cff){try{if(!_['isNil'](recordings[_0xd49cff[_0xc1f8('0x2')]])){utils[_0xc1f8('0x11')](util[_0xc1f8('0x1')](_0xc1f8('0x2e'),_0xd49cff['uniqueid']),_0xd49cff);utils['info'](util[_0xc1f8('0x1')](_0xc1f8('0x2f'),_0xd49cff[_0xc1f8('0x2')],_0xd49cff['application'],_0xd49cff[_0xc1f8('0x30')]));if(_0xd49cff[_0xc1f8('0x31')][_0xc1f8('0x32')]()=='set'&&_[_0xc1f8('0x33')](_0xd49cff[_0xc1f8('0x30')][_0xc1f8('0x32')](),_0xc1f8('0x34'))){var _0x460d28=_0xd49cff[_0xc1f8('0x30')][_0xc1f8('0x35')]('=');var _0x47ccdd=_0x460d28[0x0][_0xc1f8('0x36')](_0x460d28[0x0]['lastIndexOf']('(')+0x1,_0x460d28[0x0][_0xc1f8('0x37')](')'));var _0x52b71f=_0x460d28[0x1];recordings[_0xd49cff[_0xc1f8('0x2')]][_0x47ccdd]=_0x52b71f;}}}catch(_0x241b79){utils[_0xc1f8('0x10')](util['format']('[%s][recordings][newexten]',_0xd49cff[_0xc1f8('0x2')]),_0x241b79);}};exports[_0xc1f8('0x38')]=function(_0x458849){try{if(!_[_0xc1f8('0x13')](recordings[_0x458849['uniqueid']])){utils[_0xc1f8('0x11')](util['format'](_0xc1f8('0x39'),_0x458849[_0xc1f8('0x2')]),_0x458849);utils[_0xc1f8('0x16')](util['format'](_0xc1f8('0x3a'),_0x458849['uniqueid'],_0x458849[_0xc1f8('0x3b')]));recordings[_0x458849['uniqueid']][_0xc1f8('0x3b')]=_0x458849[_0xc1f8('0x3b')];}}catch(_0x48fdea){utils[_0xc1f8('0x10')](util['format'](_0xc1f8('0x39'),_0x458849[_0xc1f8('0x2')]),_0x48fdea);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 0c0e347..a2ef9ff 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 _0xe699=['transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','[%s][transfers][attendedtransfer]','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','debug','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xe699,0x19f));var _0x9e69=function(_0x46cdfc,_0x31582b){_0x46cdfc=_0x46cdfc-0x0;var _0x5360f7=_0xe699[_0x46cdfc];return _0x5360f7;};'use strict';var _=require(_0x9e69('0x0'));var util=require('util');var utils=require(_0x9e69('0x1'));function writeDB(_0x5cead5){utils['info'](util[_0x9e69('0x2')](_0x9e69('0x3'),_0x5cead5[_0x9e69('0x4')]===_0x9e69('0x5')?_0x5cead5[_0x9e69('0x6')]:_0x5cead5[_0x9e69('0x7')],_0x5cead5[_0x9e69('0x4')]));utils[_0x9e69('0x8')](_0x9e69('0x9'),_0x5cead5);}exports['blindtransfer']=function(_0x14cf54){try{utils[_0x9e69('0xa')](util['format']('[%s][transfers][blindtransfer]',_0x14cf54[_0x9e69('0x7')]),_0x14cf54);utils[_0x9e69('0xb')](util[_0x9e69('0x2')](_0x9e69('0xc'),_0x14cf54[_0x9e69('0x7')],_0x14cf54[_0x9e69('0xd')],_0x14cf54[_0x9e69('0xe')],_0x14cf54[_0x9e69('0xf')],_0x14cf54[_0x9e69('0x10')]));_0x14cf54[_0x9e69('0x4')]='blind';writeDB(_0x14cf54);}catch(_0x40416c){utils[_0x9e69('0x11')](util['format']('[%s][transfers][blindtransfer]',_0x14cf54[_0x9e69('0x7')]),_0x40416c);}};exports[_0x9e69('0x12')]=function(_0x4bbb0b){try{utils[_0x9e69('0xa')](util['format']('[%s][transfers][attendedtransfer]',_0x4bbb0b['origtransfereruniqueid']),_0x4bbb0b);utils['info'](util[_0x9e69('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4bbb0b['origtransfereruniqueid'],_0x4bbb0b[_0x9e69('0x13')],_0x4bbb0b['origtransferercalleridname'],_0x4bbb0b[_0x9e69('0x14')],_0x4bbb0b[_0x9e69('0x15')]));_0x4bbb0b=_[_0x9e69('0x16')](_0x4bbb0b,{'transfererchannel':_0x4bbb0b[_0x9e69('0x17')],'transferercalleridnum':_0x4bbb0b[_0x9e69('0x13')],'transferercalleridname':_0x4bbb0b[_0x9e69('0x18')],'transfererconnectedlinenum':_0x4bbb0b[_0x9e69('0x19')],'transfererconnectedlinename':_0x4bbb0b[_0x9e69('0x1a')],'transfereraccountcode':_0x4bbb0b[_0x9e69('0x1b')],'transferercontext':_0x4bbb0b['secondtransferercontext'],'transfererexten':_0x4bbb0b[_0x9e69('0x1c')],'transfererlinkedid':_0x4bbb0b[_0x9e69('0x1d')],'context':_0x4bbb0b[_0x9e69('0x1e')],'extension':_0x4bbb0b['origtransfererexten'],'type':_0x9e69('0x5')});if(_[_0x9e69('0x1f')](_0x4bbb0b[_0x9e69('0x20')])){_0x4bbb0b=_[_0x9e69('0x16')](_0x4bbb0b,{'transfereechannel':_0x4bbb0b[_0x9e69('0x21')],'transfereecalleridnum':_0x4bbb0b[_0x9e69('0x14')],'transfereecalleridname':_0x4bbb0b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4bbb0b[_0x9e69('0x22')],'transfereeconnectedlinename':_0x4bbb0b[_0x9e69('0x23')],'transfereeaccountcode':_0x4bbb0b[_0x9e69('0x24')],'transfereecontext':_0x4bbb0b['transfertargetcontext'],'transfereeexten':_0x4bbb0b[_0x9e69('0x25')],'transfereelinkedid':_0x4bbb0b['transfertargetlinkedid']});}writeDB(_0x4bbb0b);}catch(_0x4867f0){utils[_0x9e69('0x11')](util[_0x9e69('0x2')](_0x9e69('0x26'),_0x4bbb0b[_0x9e69('0x6')]),_0x4867f0);}}; \ No newline at end of file +var _0x1c72=['transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x51bfa2,_0x31420e){var _0x4522be=function(_0x5b2991){while(--_0x5b2991){_0x51bfa2['push'](_0x51bfa2['shift']());}};_0x4522be(++_0x31420e);}(_0x1c72,0x13f));var _0x21c7=function(_0x595aec,_0x5dd604){_0x595aec=_0x595aec-0x0;var _0x1cd077=_0x1c72[_0x595aec];return _0x1cd077;};'use strict';var _=require('lodash');var util=require(_0x21c7('0x0'));var utils=require(_0x21c7('0x1'));function writeDB(_0x26513a){utils[_0x21c7('0x2')](util[_0x21c7('0x3')](_0x21c7('0x4'),_0x26513a[_0x21c7('0x5')]==='attended'?_0x26513a[_0x21c7('0x6')]:_0x26513a[_0x21c7('0x7')],_0x26513a[_0x21c7('0x5')]));utils[_0x21c7('0x8')](_0x21c7('0x9'),_0x26513a);}exports[_0x21c7('0xa')]=function(_0x5677a3){try{utils[_0x21c7('0xb')](util[_0x21c7('0x3')](_0x21c7('0xc'),_0x5677a3[_0x21c7('0x7')]),_0x5677a3);utils[_0x21c7('0x2')](util[_0x21c7('0x3')](_0x21c7('0xd'),_0x5677a3[_0x21c7('0x7')],_0x5677a3['transferercalleridnum'],_0x5677a3['transferercalleridname'],_0x5677a3[_0x21c7('0xe')],_0x5677a3[_0x21c7('0xf')]));_0x5677a3[_0x21c7('0x5')]='blind';writeDB(_0x5677a3);}catch(_0x5852db){utils[_0x21c7('0x10')](util['format'](_0x21c7('0xc'),_0x5677a3[_0x21c7('0x7')]),_0x5852db);}};exports[_0x21c7('0x11')]=function(_0x3d3208){try{utils['debug'](util[_0x21c7('0x3')](_0x21c7('0x12'),_0x3d3208['origtransfereruniqueid']),_0x3d3208);utils[_0x21c7('0x2')](util[_0x21c7('0x3')](_0x21c7('0x13'),_0x3d3208['origtransfereruniqueid'],_0x3d3208['origtransferercalleridnum'],_0x3d3208[_0x21c7('0x14')],_0x3d3208['transfertargetcalleridnum'],_0x3d3208[_0x21c7('0x15')]));_0x3d3208=_[_0x21c7('0x16')](_0x3d3208,{'transfererchannel':_0x3d3208[_0x21c7('0x17')],'transferercalleridnum':_0x3d3208[_0x21c7('0x18')],'transferercalleridname':_0x3d3208[_0x21c7('0x14')],'transfererconnectedlinenum':_0x3d3208[_0x21c7('0x19')],'transfererconnectedlinename':_0x3d3208[_0x21c7('0x1a')],'transfereraccountcode':_0x3d3208[_0x21c7('0x1b')],'transferercontext':_0x3d3208['secondtransferercontext'],'transfererexten':_0x3d3208[_0x21c7('0x1c')],'transfererlinkedid':_0x3d3208['origtransfererlinkedid'],'context':_0x3d3208[_0x21c7('0x1d')],'extension':_0x3d3208['origtransfererexten'],'type':_0x21c7('0x1e')});if(_[_0x21c7('0x1f')](_0x3d3208[_0x21c7('0x20')])){_0x3d3208=_[_0x21c7('0x16')](_0x3d3208,{'transfereechannel':_0x3d3208[_0x21c7('0x21')],'transfereecalleridnum':_0x3d3208['transfertargetcalleridnum'],'transfereecalleridname':_0x3d3208['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3d3208['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x3d3208[_0x21c7('0x22')],'transfereeaccountcode':_0x3d3208['transfertargetaccountcode'],'transfereecontext':_0x3d3208['transfertargetcontext'],'transfereeexten':_0x3d3208[_0x21c7('0x23')],'transfereelinkedid':_0x3d3208[_0x21c7('0x24')]});}writeDB(_0x3d3208);}catch(_0x4072e0){utils[_0x21c7('0x10')](util['format'](_0x21c7('0x12'),_0x3d3208[_0x21c7('0x6')]),_0x4072e0);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 031483e..858a5d1 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 _0x91cb=['seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','isAfter','isBefore','bluebird','jayson/promise','util','../../config/logger','xdr','info','debug','inspect','error','request','catch','[utils][request]\x20name:%s','GetUser','name','then','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]'];(function(_0x162122,_0x7a0d9b){var _0x23ac32=function(_0xf6cfff){while(--_0xf6cfff){_0x162122['push'](_0x162122['shift']());}};_0x23ac32(++_0x7a0d9b);}(_0x91cb,0xbc));var _0xb91c=function(_0x541e4f,_0x48d7fa){_0x541e4f=_0x541e4f-0x0;var _0x5c1711=_0x91cb[_0x541e4f];return _0x5c1711;};'use strict';var BPromise=require(_0xb91c('0x0'));var jayson=require(_0xb91c('0x1'));var moment=require('moment');var util=require(_0xb91c('0x2'));var client=jayson['client']['http']({'port':0x2329});var logger=require(_0xb91c('0x3'))(_0xb91c('0x4'));exports[_0xb91c('0x5')]=function(_0x138722,_0x2bc445){logger[_0xb91c('0x5')](_0x138722,_0x2bc445?util['inspect'](_0x2bc445,{'showHidden':![],'depth':null}):'');};exports[_0xb91c('0x6')]=function(_0x4aa611,_0x4e6ab4){logger[_0xb91c('0x6')](_0x4aa611,_0x4e6ab4?util[_0xb91c('0x7')](_0x4e6ab4,{'showHidden':![],'depth':null}):'');};exports[_0xb91c('0x8')]=function(_0x10b3c0,_0x22f884){logger[_0xb91c('0x8')](_0x10b3c0,_0x22f884?util['inspect'](_0x22f884,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x523e1b,_0x52bdc8){return client[_0xb91c('0x9')](_0x523e1b,{'body':_0x52bdc8})['then'](function(_0x4f63fd){logger['debug']('[utils][request]\x20name:%s',_0x523e1b,_0x4f63fd?util[_0xb91c('0x7')](_0x4f63fd,{'showHidden':![],'depth':null}):'');})[_0xb91c('0xa')](function(_0x18d6c6){logger['error'](_0xb91c('0xb'),_0x523e1b,_0x18d6c6?util[_0xb91c('0x7')](_0x18d6c6,{'showHidden':![],'depth':null}):'');});};function getUser(_0x36e14c){return client[_0xb91c('0x9')](_0xb91c('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0xb91c('0xd'),'interface'],'where':_0x36e14c,'limit':0x1}})[_0xb91c('0xe')](function(_0x248837){logger[_0xb91c('0x6')](_0xb91c('0xf'),JSON[_0xb91c('0x10')](_0x36e14c),_0x248837?util['inspect'](_0x248837,{'showHidden':![],'depth':null}):'');return _0x248837[_0xb91c('0x11')][_0xb91c('0x12')]?_0x248837['result'][0x0]:null;});}exports[_0xb91c('0x13')]=function(_0x573bfc){return new BPromise(function(_0x4f25ad,_0x2bcccf){if(_0x573bfc){return getUser({'internal':_0x573bfc})[_0xb91c('0xe')](function(_0x3c474e){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x573bfc,_0x3c474e?_0xb91c('0x14'):_0xb91c('0x15'));return _0x4f25ad(_0x3c474e);})[_0xb91c('0xa')](function(_0xfab6ad){logger['error'](_0xb91c('0x16'),_0xfab6ad?util[_0xb91c('0x7')](_0xfab6ad,{'showHidden':![],'depth':null}):'');return _0x4f25ad(null);});}return _0x4f25ad(null);});};exports[_0xb91c('0x17')]=function(_0x435bde){return new BPromise(function(_0x1628ce,_0x3638dd){if(_0x435bde){return getUser({'interface':_0x435bde})[_0xb91c('0xe')](function(_0xa75a9f){logger[_0xb91c('0x5')](_0xb91c('0x18'),_0x435bde,_0xa75a9f?_0xb91c('0x14'):_0xb91c('0x15'));return _0x1628ce(_0xa75a9f);})['catch'](function(_0x8ef921){logger['error'](_0xb91c('0x19'),_0x8ef921?util['inspect'](_0x8ef921,{'showHidden':![],'depth':null}):'');return _0x1628ce(null);});}return _0x1628ce(null);});};exports[_0xb91c('0x1a')]=function(_0x3a9910){return new BPromise(function(_0x47b709,_0x3ddc1a){if(_0x3a9910){return getUser({'name':_0x3a9910})[_0xb91c('0xe')](function(_0x10833e){logger[_0xb91c('0x5')](_0xb91c('0x1b'),_0x3a9910,_0x10833e?_0xb91c('0x14'):_0xb91c('0x15'));return _0x47b709(_0x10833e);})[_0xb91c('0xa')](function(_0x39aa4a){logger[_0xb91c('0x8')](_0xb91c('0x1c'),_0x39aa4a?util[_0xb91c('0x7')](_0x39aa4a,{'showHidden':![],'depth':null}):'');return _0x47b709(null);});}return _0x47b709(null);});};exports[_0xb91c('0x1d')]=function(_0xf7874f){return new BPromise(function(_0x59290e,_0x1be504){if(_0xf7874f){return client[_0xb91c('0x9')](_0xb91c('0x1e'),{'options':{'raw':!![],'attributes':['id',_0xb91c('0xd'),_0xb91c('0x1f'),_0xb91c('0x20'),_0xb91c('0x21')],'where':{'name':_0xf7874f},'limit':0x1}})[_0xb91c('0xe')](function(_0x40e934){logger['debug'](_0xb91c('0x22'),_0xf7874f,_0x40e934?util[_0xb91c('0x7')](_0x40e934,{'showHidden':![],'depth':null}):'');logger[_0xb91c('0x5')](_0xb91c('0x23'),_0xf7874f,_0x40e934?'found':'notfound');return _0x59290e(_0x40e934[_0xb91c('0x11')][_0xb91c('0x12')]?_0x40e934[_0xb91c('0x11')][0x0]:null);})[_0xb91c('0xa')](function(_0x448004){logger[_0xb91c('0x8')](_0xb91c('0x24'),_0x448004?util['inspect'](_0x448004,{'showHidden':![],'depth':null}):'');return _0x59290e(null);});}return _0x59290e(null);});};exports['addTime']=function(_0x5950b2,_0x5753fe){return moment(_0x5950b2)['add'](_0x5753fe,_0xb91c('0x25'))['format'](_0xb91c('0x26'));};exports[_0xb91c('0x27')]=function(_0x3993a3,_0x1578f2){return moment(_0x3993a3)[_0xb91c('0x28')](_0x1578f2,_0xb91c('0x25'))[_0xb91c('0x29')](_0xb91c('0x26'));};exports[_0xb91c('0x2a')]=function(_0x614e71,_0x3b703a){return moment(_0x614e71)['diff'](moment(_0x3b703a),_0xb91c('0x25'));};exports['sumTime']=function(_0xaa97d3,_0x2caee0){return parseInt(_0xaa97d3,0xa)+parseInt(_0x2caee0,0xa);};exports['now']=function(){return moment()['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xb91c('0x2b')]=function(_0x33eb38,_0x16aba7){if(_0x16aba7){return moment(_0x33eb38)[_0xb91c('0x2b')](_0x16aba7);}return!![];};exports['isBefore']=function(_0x4254f6,_0x134a03){if(_0x134a03){return moment(_0x4254f6)[_0xb91c('0x2c')](_0x134a03);}else if(_0x4254f6){return!![];}return![];}; \ No newline at end of file +var _0xc991=['result','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then','[utils][getUser]\x20where:%s','stringify','length'];(function(_0x131a6a,_0x2f67a4){var _0x27598b=function(_0x312302){while(--_0x312302){_0x131a6a['push'](_0x131a6a['shift']());}};_0x27598b(++_0x2f67a4);}(_0xc991,0xfc));var _0x1c99=function(_0x3ffc1f,_0x5f0586){_0x3ffc1f=_0x3ffc1f-0x0;var _0x2685fe=_0xc991[_0x3ffc1f];return _0x2685fe;};'use strict';var BPromise=require(_0x1c99('0x0'));var jayson=require(_0x1c99('0x1'));var moment=require('moment');var util=require(_0x1c99('0x2'));var client=jayson['client'][_0x1c99('0x3')]({'port':0x2329});var logger=require(_0x1c99('0x4'))('xdr');exports['info']=function(_0x3eae7f,_0x2e581b){logger[_0x1c99('0x5')](_0x3eae7f,_0x2e581b?util['inspect'](_0x2e581b,{'showHidden':![],'depth':null}):'');};exports[_0x1c99('0x6')]=function(_0x561f40,_0x2d714e){logger[_0x1c99('0x6')](_0x561f40,_0x2d714e?util[_0x1c99('0x7')](_0x2d714e,{'showHidden':![],'depth':null}):'');};exports[_0x1c99('0x8')]=function(_0x28645d,_0x566bde){logger[_0x1c99('0x8')](_0x28645d,_0x566bde?util[_0x1c99('0x7')](_0x566bde,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x47fbb5,_0x462afc){return client[_0x1c99('0x9')](_0x47fbb5,{'body':_0x462afc})['then'](function(_0x560ccd){logger[_0x1c99('0x6')](_0x1c99('0xa'),_0x47fbb5,_0x560ccd?util[_0x1c99('0x7')](_0x560ccd,{'showHidden':![],'depth':null}):'');})[_0x1c99('0xb')](function(_0xcb2ced){logger[_0x1c99('0x8')](_0x1c99('0xa'),_0x47fbb5,_0xcb2ced?util[_0x1c99('0x7')](_0xcb2ced,{'showHidden':![],'depth':null}):'');});};function getUser(_0x24f4cd){return client[_0x1c99('0x9')](_0x1c99('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x1c99('0xd'),'interface'],'where':_0x24f4cd,'limit':0x1}})[_0x1c99('0xe')](function(_0x13d2f3){logger['debug'](_0x1c99('0xf'),JSON[_0x1c99('0x10')](_0x24f4cd),_0x13d2f3?util[_0x1c99('0x7')](_0x13d2f3,{'showHidden':![],'depth':null}):'');return _0x13d2f3['result'][_0x1c99('0x11')]?_0x13d2f3[_0x1c99('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x23aef0){return new BPromise(function(_0x1ff07f,_0x505e6d){if(_0x23aef0){return getUser({'internal':_0x23aef0})[_0x1c99('0xe')](function(_0x39a8a6){logger[_0x1c99('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x23aef0,_0x39a8a6?'found':_0x1c99('0x13'));return _0x1ff07f(_0x39a8a6);})['catch'](function(_0x2974e2){logger['error'](_0x1c99('0x14'),_0x2974e2?util[_0x1c99('0x7')](_0x2974e2,{'showHidden':![],'depth':null}):'');return _0x1ff07f(null);});}return _0x1ff07f(null);});};exports[_0x1c99('0x15')]=function(_0x3d6a61){return new BPromise(function(_0x4b420d,_0x516d9d){if(_0x3d6a61){return getUser({'interface':_0x3d6a61})['then'](function(_0x440ec5){logger[_0x1c99('0x5')](_0x1c99('0x16'),_0x3d6a61,_0x440ec5?_0x1c99('0x17'):_0x1c99('0x13'));return _0x4b420d(_0x440ec5);})[_0x1c99('0xb')](function(_0x2504a9){logger[_0x1c99('0x8')]('[utils][getUserByInterface]',_0x2504a9?util[_0x1c99('0x7')](_0x2504a9,{'showHidden':![],'depth':null}):'');return _0x4b420d(null);});}return _0x4b420d(null);});};exports[_0x1c99('0x18')]=function(_0x364e95){return new BPromise(function(_0x4764b5,_0x52bd5d){if(_0x364e95){return getUser({'name':_0x364e95})[_0x1c99('0xe')](function(_0x513c23){logger[_0x1c99('0x5')](_0x1c99('0x19'),_0x364e95,_0x513c23?'found':_0x1c99('0x13'));return _0x4764b5(_0x513c23);})['catch'](function(_0x1d6c5e){logger['error']('[utils][getUserByName]',_0x1d6c5e?util[_0x1c99('0x7')](_0x1d6c5e,{'showHidden':![],'depth':null}):'');return _0x4764b5(null);});}return _0x4764b5(null);});};exports['getVoiceQueueByName']=function(_0x349bcc){return new BPromise(function(_0x4b1095,_0x24e61e){if(_0x349bcc){return client[_0x1c99('0x9')](_0x1c99('0x1a'),{'options':{'raw':!![],'attributes':['id',_0x1c99('0xd'),_0x1c99('0x1b'),_0x1c99('0x1c'),_0x1c99('0x1d')],'where':{'name':_0x349bcc},'limit':0x1}})[_0x1c99('0xe')](function(_0x2b93e4){logger['debug'](_0x1c99('0x1e'),_0x349bcc,_0x2b93e4?util['inspect'](_0x2b93e4,{'showHidden':![],'depth':null}):'');logger[_0x1c99('0x5')](_0x1c99('0x1f'),_0x349bcc,_0x2b93e4?_0x1c99('0x17'):_0x1c99('0x13'));return _0x4b1095(_0x2b93e4[_0x1c99('0x12')]['length']?_0x2b93e4[_0x1c99('0x12')][0x0]:null);})[_0x1c99('0xb')](function(_0xc80968){logger[_0x1c99('0x8')](_0x1c99('0x20'),_0xc80968?util['inspect'](_0xc80968,{'showHidden':![],'depth':null}):'');return _0x4b1095(null);});}return _0x4b1095(null);});};exports[_0x1c99('0x21')]=function(_0xd8e696,_0x24a431){return moment(_0xd8e696)[_0x1c99('0x22')](_0x24a431,'seconds')['format'](_0x1c99('0x23'));};exports[_0x1c99('0x24')]=function(_0x3ab34b,_0x2416a8){return moment(_0x3ab34b)[_0x1c99('0x25')](_0x2416a8,_0x1c99('0x26'))[_0x1c99('0x27')](_0x1c99('0x23'));};exports[_0x1c99('0x28')]=function(_0x5a9dba,_0x39fda0){return moment(_0x5a9dba)[_0x1c99('0x29')](moment(_0x39fda0),_0x1c99('0x26'));};exports[_0x1c99('0x2a')]=function(_0x36c432,_0x14a852){return parseInt(_0x36c432,0xa)+parseInt(_0x14a852,0xa);};exports['now']=function(){return moment()[_0x1c99('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1c99('0x2b')]=function(_0xd3dbab,_0x3aa42b){if(_0x3aa42b){return moment(_0xd3dbab)['isAfter'](_0x3aa42b);}return!![];};exports['isBefore']=function(_0x409f96,_0x2409da){if(_0x2409da){return moment(_0x409f96)[_0x1c99('0x2c')](_0x2409da);}else if(_0x409f96){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 0b4259e..b5bcbd5 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 _0x26bd=['log','xcally','client','role','ensureDir','then','catch','user','no-user','timestamp','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','name','inspect','agent_id','url','device','other','agent_name','test','setupLoggers','lodash','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','/var'];(function(_0x5962b4,_0x84be73){var _0xe6443c=function(_0x2b37d4){while(--_0x2b37d4){_0x5962b4['push'](_0x5962b4['shift']());}};_0xe6443c(++_0x84be73);}(_0x26bd,0xac));var _0xd26b=function(_0x3b573d,_0x5e912d){_0x3b573d=_0x3b573d-0x0;var _0x4e6026=_0x26bd[_0x3b573d];return _0x4e6026;};var fs=require('fs-extra');var _=require(_0xd26b('0x0'));var ewinston=require('express-winston');var path=require('path');var util=require('util');var fileLogger=require(_0xd26b('0x1'))[_0xd26b('0x2')];var safeTemplate=require(_0xd26b('0x3'))[_0xd26b('0x4')];var maskSensitiveData=require('./mask-sensitive-data')[_0xd26b('0x5')];function ClientSideLogger(){function _0x4491f5(_0x42afb2){var _0x5b9f9a=path[_0xd26b('0x6')](_0xd26b('0x7'),_0xd26b('0x8'),_0xd26b('0x9'));var _0x18086e=path[_0xd26b('0x6')](_0xd26b('0xa'),_0x42afb2[_0xd26b('0xb')]+'-'+_0x42afb2['name']);return fs[_0xd26b('0xc')](path[_0xd26b('0x6')](_0x5b9f9a,_0x18086e))[_0xd26b('0xd')](function(){var _0x309937=fileLogger(_0xd26b('0xa'),path['join'](_0x5b9f9a,_0x18086e));return _0x309937;})[_0xd26b('0xe')](function(_0x1be1eb){throw _0x1be1eb;});}this[_0xd26b('0x8')]=function(_0x5b3340,_0x53eeab,_0x652835,_0x42f427){return _0x4491f5(_0x5b3340[_0xd26b('0xf')])['then'](function(_0x378b6b){var _0x341961=_0x378b6b[_0x53eeab];return _0x341961;})[_0xd26b('0xd')](function(_0x84a65c){var _0x183490=_0x5b3340[_0xd26b('0xf')]?_0x5b3340[_0xd26b('0xf')]['id']:_0xd26b('0x10');var _0x52f7c4=_0x42f427['data'];var _0x3647e5=_0x42f427[_0xd26b('0x11')];var _0x442e58=new Date(Number(_0x3647e5));return _0x84a65c(_0x183490,_0x442e58,_0x652835,_0x52f7c4);})[_0xd26b('0xe')](function(_0x4acc98){fileLogger(_0xd26b('0xa'))['error'](_0x4acc98);});};}function setupLoggers(_0x49ee77){return new Promise(function(_0x5e3f7b){var _0x21759d=new ClientSideLogger();var _0x1e61f0=fileLogger(_0xd26b('0x12'));var _0x3330be=fileLogger(_0xd26b('0x13'));_0x49ee77[_0xd26b('0x14')](_0xd26b('0x15'),_0x21759d);_0x49ee77[_0xd26b('0x16')](ewinston[_0xd26b('0x17')]({'winstonInstance':_0x1e61f0,'meta':![],'statusLevels':!![],'msg':function(_0x295eb1,_0x23ec48){var _0x558397=_0xd26b('0x18');if(!_[_0xd26b('0x19')](_0x295eb1[_0xd26b('0x1a')])){_0x558397+=_0xd26b('0x1b');var _0x3677ad=_0x295eb1[_0xd26b('0x1a')];maskSensitiveData(_0x3677ad);}return safeTemplate(util[_0xd26b('0x1c')](_0x558397,_0x295eb1[_0xd26b('0x1d')],_0x295eb1[_0xd26b('0x1e')]['x-forwarded-for']?_0x295eb1[_0xd26b('0x1e')][_0xd26b('0x1f')]:_0x295eb1[_0xd26b('0x20')][_0xd26b('0x21')]||_0x295eb1['ip'],_0x295eb1['url'],_0x23ec48[_0xd26b('0x22')],_0x23ec48[_0xd26b('0x23')],_0x295eb1[_0xd26b('0xf')]?_0x295eb1[_0xd26b('0xf')]['id']:null,_0x295eb1['user']?_0x295eb1[_0xd26b('0xf')][_0xd26b('0x24')]:null,_0x295eb1[_0xd26b('0xf')]?_0x295eb1[_0xd26b('0xf')][_0xd26b('0xb')]:null,_0x3677ad?util[_0xd26b('0x25')](_0x3677ad,![],null):''));}}));_0x49ee77[_0xd26b('0x16')](ewinston['logger']({'winstonInstance':_0x3330be,'meta':![],'statusLevels':!![],'msg':function(_0x555061,_0x4ce4b6){var _0x35158d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x555061[_0xd26b('0x1a')]&&_0x555061[_0xd26b('0x1a')]['device']&&_0x555061[_0xd26b('0x1a')][_0xd26b('0x26')]){_0x35158d='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xd26b('0x1c')](_0x35158d,_0x555061[_0xd26b('0x1d')],_0x555061[_0xd26b('0x1e')][_0xd26b('0x1f')]?_0x555061[_0xd26b('0x1e')][_0xd26b('0x1f')]:_0x555061[_0xd26b('0x20')][_0xd26b('0x21')]||_0x555061['ip'],_0x555061[_0xd26b('0x27')],_0x4ce4b6[_0xd26b('0x22')],_0x4ce4b6[_0xd26b('0x23')],_0x555061[_0xd26b('0xf')]?_0x555061[_0xd26b('0xf')]['id']:null,_0x555061[_0xd26b('0xf')]?_0x555061['user'][_0xd26b('0x24')]:null,_0x555061[_0xd26b('0xf')]?_0x555061['user'][_0xd26b('0xb')]:null,_0x555061[_0xd26b('0x1a')]&&_0x555061['body'][_0xd26b('0x28')]?_0x555061[_0xd26b('0x1a')][_0xd26b('0x28')]:_0xd26b('0x29'),_0x555061[_0xd26b('0x1a')]&&_0x555061[_0xd26b('0x1a')]['agent_id']?_0x555061[_0xd26b('0x1a')][_0xd26b('0x26')]:'',_0x555061[_0xd26b('0x1a')]&&_0x555061[_0xd26b('0x1a')][_0xd26b('0x2a')]?_0x555061['body'][_0xd26b('0x2a')]:'');},'ignoreRoute':function(_0x426acf){var _0x116630=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x116630[_0xd26b('0x2b')](_0x426acf['url']);}}));return _0x5e3f7b();});}exports[_0xd26b('0x2c')]=setupLoggers; \ No newline at end of file +var _0x486c=['connection','other','agent_name','test','setupLoggers','express-winston','util','./loggers','fileLogger','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','catch','user','then','no-user','timestamp','error','api','auth','set','use','body','\x20body=%s','method','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format'];(function(_0x275093,_0x4fb771){var _0x533401=function(_0x585a38){while(--_0x585a38){_0x275093['push'](_0x275093['shift']());}};_0x533401(++_0x4fb771);}(_0x486c,0xdc));var _0xc486=function(_0x5ce24b,_0x2fc794){_0x5ce24b=_0x5ce24b-0x0;var _0x4f750f=_0x486c[_0x5ce24b];return _0x4f750f;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0xc486('0x0'));var path=require('path');var util=require(_0xc486('0x1'));var fileLogger=require(_0xc486('0x2'))[_0xc486('0x3')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0xc486('0x4'))[_0xc486('0x5')];function ClientSideLogger(){function _0xa35768(_0x5764d6){var _0x10c73c=path[_0xc486('0x6')](_0xc486('0x7'),_0xc486('0x8'),_0xc486('0x9'));var _0x510b87=path[_0xc486('0x6')](_0xc486('0xa'),_0x5764d6[_0xc486('0xb')]+'-'+_0x5764d6['name']);return fs['ensureDir'](path[_0xc486('0x6')](_0x10c73c,_0x510b87))['then'](function(){var _0x5d8c6f=fileLogger(_0xc486('0xa'),path[_0xc486('0x6')](_0x10c73c,_0x510b87));return _0x5d8c6f;})[_0xc486('0xc')](function(_0x9e81a2){throw _0x9e81a2;});}this[_0xc486('0x8')]=function(_0x4011b2,_0x4f0ac0,_0x447a33,_0x43f989){return _0xa35768(_0x4011b2[_0xc486('0xd')])[_0xc486('0xe')](function(_0x561242){var _0x3afb1b=_0x561242[_0x4f0ac0];return _0x3afb1b;})[_0xc486('0xe')](function(_0x118d6e){var _0x56622d=_0x4011b2[_0xc486('0xd')]?_0x4011b2[_0xc486('0xd')]['id']:_0xc486('0xf');var _0x53492c=_0x43f989['data'];var _0x39eb2b=_0x43f989[_0xc486('0x10')];var _0x491d7f=new Date(Number(_0x39eb2b));return _0x118d6e(_0x56622d,_0x491d7f,_0x447a33,_0x53492c);})[_0xc486('0xc')](function(_0x3426d4){fileLogger(_0xc486('0xa'))[_0xc486('0x11')](_0x3426d4);});};}function setupLoggers(_0x2b190d){return new Promise(function(_0x1d237f){var _0x2fd0a0=new ClientSideLogger();var _0x404a46=fileLogger(_0xc486('0x12'));var _0x46f3c5=fileLogger(_0xc486('0x13'));_0x2b190d[_0xc486('0x14')]('client-side-logger',_0x2fd0a0);_0x2b190d[_0xc486('0x15')](ewinston['logger']({'winstonInstance':_0x404a46,'meta':![],'statusLevels':!![],'msg':function(_0x3823bf,_0x36a144){var _0x47cab4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x3823bf[_0xc486('0x16')])){_0x47cab4+=_0xc486('0x17');var _0x2edbf0=_0x3823bf[_0xc486('0x16')];maskSensitiveData(_0x2edbf0);}return safeTemplate(util['format'](_0x47cab4,_0x3823bf[_0xc486('0x18')],_0x3823bf[_0xc486('0x19')]['x-forwarded-for']?_0x3823bf['headers'][_0xc486('0x1a')]:_0x3823bf['connection'][_0xc486('0x1b')]||_0x3823bf['ip'],_0x3823bf[_0xc486('0x1c')],_0x36a144[_0xc486('0x1d')],_0x36a144[_0xc486('0x1e')],_0x3823bf[_0xc486('0xd')]?_0x3823bf['user']['id']:null,_0x3823bf[_0xc486('0xd')]?_0x3823bf[_0xc486('0xd')]['name']:null,_0x3823bf[_0xc486('0xd')]?_0x3823bf['user'][_0xc486('0xb')]:null,_0x2edbf0?util[_0xc486('0x1f')](_0x2edbf0,![],null):''));}}));_0x2b190d[_0xc486('0x15')](ewinston[_0xc486('0x20')]({'winstonInstance':_0x46f3c5,'meta':![],'statusLevels':!![],'msg':function(_0x1cd1d6,_0x297a33){var _0x4a4f68=_0xc486('0x21');if(_0x1cd1d6['body']&&_0x1cd1d6['body'][_0xc486('0x22')]&&_0x1cd1d6[_0xc486('0x16')][_0xc486('0x23')]){_0x4a4f68=_0xc486('0x24');}return util[_0xc486('0x25')](_0x4a4f68,_0x1cd1d6['method'],_0x1cd1d6[_0xc486('0x19')]['x-forwarded-for']?_0x1cd1d6[_0xc486('0x19')][_0xc486('0x1a')]:_0x1cd1d6[_0xc486('0x26')]['remoteAddress']||_0x1cd1d6['ip'],_0x1cd1d6[_0xc486('0x1c')],_0x297a33[_0xc486('0x1d')],_0x297a33['responseTime'],_0x1cd1d6[_0xc486('0xd')]?_0x1cd1d6[_0xc486('0xd')]['id']:null,_0x1cd1d6['user']?_0x1cd1d6[_0xc486('0xd')]['name']:null,_0x1cd1d6['user']?_0x1cd1d6[_0xc486('0xd')][_0xc486('0xb')]:null,_0x1cd1d6[_0xc486('0x16')]&&_0x1cd1d6[_0xc486('0x16')]['device']?_0x1cd1d6[_0xc486('0x16')][_0xc486('0x22')]:_0xc486('0x27'),_0x1cd1d6[_0xc486('0x16')]&&_0x1cd1d6[_0xc486('0x16')]['agent_id']?_0x1cd1d6[_0xc486('0x16')]['agent_id']:'',_0x1cd1d6['body']&&_0x1cd1d6[_0xc486('0x16')][_0xc486('0x28')]?_0x1cd1d6[_0xc486('0x16')][_0xc486('0x28')]:'');},'ignoreRoute':function(_0x1e1bfe){var _0x303b02=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x303b02[_0xc486('0x29')](_0x1e1bfe['url']);}}));return _0x1d237f();});}exports[_0xc486('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index b2cdae2..8e432ef 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe103=['isBefore','day','endOf','isBetween','format','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','isMoment','padStart','length','iftime','lodash','map','join','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','hours','minutes','clone'];(function(_0x1f795b,_0x300246){var _0x2a42e7=function(_0x518b03){while(--_0x518b03){_0x1f795b['push'](_0x1f795b['shift']());}};_0x2a42e7(++_0x300246);}(_0xe103,0x170));var _0x3e10=function(_0x9b03f8,_0x3fe1cc){_0x9b03f8=_0x9b03f8-0x0;var _0x526295=_0xe103[_0x9b03f8];return _0x526295;};var _=require(_0x3e10('0x0'));var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x3e10('0x1')](function(_0x11545d){return _0x11545d['source'];})[_0x3e10('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x3e10('0x3');function throwIfDateNotValid(_0x1cec55){if(!_0x1cec55[_0x3e10('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x413580){var _0x437d2e=_0x413580[_0x3e10('0x5')](':')['map'](function(_0x2a7aa4){return parseInt(_0x2a7aa4,0xa);});var _0x17409d=_0x437d2e[0x0];var _0x3d9188=_0x437d2e[0x1];if(_0x17409d<0x0||_0x17409d>0x17||_0x3d9188<0x0||_0x3d9188>0x3b){throw new Error(EINVALID_DATE);}return[_0x17409d,_0x3d9188];}function circularDoWInterval(_0x3f496f,_0x259596){if(_0x3f496f===_0x259596){return[_0x3f496f];}else{var _0x287fae=moment[_0x3e10('0x6')]();moment[_0x3e10('0x6')]('en');var _0x69b22e=moment[_0x3e10('0x7')]()[_0x3e10('0x1')](function(_0x1bcacc){return _0x1bcacc[_0x3e10('0x8')]();});moment[_0x3e10('0x6')](_0x287fae);var _0x2be263=_0x69b22e[_0x3e10('0x9')](_0x3f496f);var _0x5c3504=_0x69b22e[_0x3e10('0x9')](_0x259596);if(_0x5c3504>_0x2be263){return _0x69b22e[_0x3e10('0xa')](_0x2be263,_0x5c3504+0x1);}else{var _0x578bf5=_0x69b22e['slice'](0x0,_0x5c3504+0x1);var _0x3114c7=_0x69b22e[_0x3e10('0xa')](_0x2be263);return _0x3114c7[_0x3e10('0xb')](_0x578bf5);}}}module[_0x3e10('0xc')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x2c719a,_0xd1023){if(_0x2c719a===_0xd1023){return[_0x2c719a];}else{var _0x2e3c8=moment[_0x3e10('0x6')]();moment[_0x3e10('0x6')]('en');var _0x3848d8=moment[_0x3e10('0xd')]()[_0x3e10('0x1')](function(_0x2c5d9e){return _0x2c5d9e[_0x3e10('0x8')]();});moment[_0x3e10('0x6')](_0x2e3c8);var _0x3d5771=_0x3848d8[_0x3e10('0x9')](_0x2c719a);var _0xbd077b=_0x3848d8[_0x3e10('0x9')](_0xd1023);if(_0xbd077b>_0x3d5771){return _0x3848d8['slice'](_0x3d5771,_0xbd077b+0x1);}else{var _0x461aaa=_0x3848d8[_0x3e10('0xa')](0x0,_0xbd077b+0x1);var _0x9429fb=_0x3848d8[_0x3e10('0xa')](_0x3d5771);return _0x9429fb['concat'](_0x461aaa);}}}module[_0x3e10('0xc')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x2ed1c9){var _0x40e03f=parseInt(_0x2ed1c9,0xa);if(_0x40e03f<0x1||_0x40e03f>0x1f){throw new Error(EINVALID_DATE);}return _0x40e03f;}function timeCompare(_0x502fe6,_0x5b9371,_0x23bbb6){var _0x18f4e3=_0x502fe6['clone']();var _0x4786dd=extractTime(_0x5b9371);var _0x16b20d=_0x4786dd[0x0];var _0xfad283=_0x4786dd[0x1];var _0x37ec12=_0x502fe6['clone']()[_0x3e10('0xe')](_0x16b20d)[_0x3e10('0xf')](_0xfad283);throwIfDateNotValid(_0x37ec12);var _0x273489=extractTime(_0x23bbb6);var _0x48a0e5=_0x273489[0x0];var _0x3852da=_0x273489[0x1];var _0x1c702d=_0x502fe6[_0x3e10('0x10')]()['hours'](_0x48a0e5)['minutes'](_0x3852da);throwIfDateNotValid(_0x1c702d);if(_0x1c702d[_0x3e10('0x11')](_0x37ec12)){var _0x19fb1f=_0x18f4e3['clone']()['startOf'](_0x3e10('0x12'));var _0x5db49f=_0x18f4e3['clone']()[_0x3e10('0x13')](_0x3e10('0x12'));return _0x18f4e3[_0x3e10('0x14')](_0x37ec12,_0x5db49f,undefined,'[]')||_0x18f4e3['isBetween'](_0x19fb1f,_0x1c702d,undefined,'[]');}else{return _0x18f4e3[_0x3e10('0x14')](_0x37ec12,_0x1c702d,undefined,'[]');}}module[_0x3e10('0xc')]['timeCompare']=timeCompare;function dowCompare(_0x4a96d6,_0x30af0e,_0x150afe){var _0x4e8d80=_0x4a96d6[_0x3e10('0x6')]('en')[_0x3e10('0x15')]('ddd')['toLowerCase']();return circularDoWInterval(_0x30af0e,_0x150afe)[_0x3e10('0x16')](_0x4e8d80);}module[_0x3e10('0xc')][_0x3e10('0x17')]=dowCompare;function domCompare(_0x53021f,_0x174e95,_0x42d65f){var _0x293e93=_0x53021f[_0x3e10('0x18')]();if(_0x174e95===_0x42d65f){return _0x293e93===_0x174e95;}else{var _0x3abb60=_0x53021f[_0x3e10('0x19')]();var _0x36b198=_0x174e95<_0x42d65f;let _0x4966fb=![];var _0x5b5a0b=0x0;var _0xc01fee=0x0;if(_0x36b198){_0x5b5a0b=Math[_0x3e10('0x1a')](0x1,_0x174e95);_0xc01fee=Math[_0x3e10('0x1b')](_0x42d65f,_0x3abb60);_0x4966fb=_0x293e93>=_0x5b5a0b&&_0x293e93<=_0xc01fee;}else{_0x5b5a0b=Math[_0x3e10('0x1b')](_0x174e95,_0x3abb60);_0xc01fee=Math[_0x3e10('0x1a')](0x1,_0x42d65f);_0x4966fb=_0x293e93>=_0x5b5a0b||_0x293e93<=_0xc01fee;}return _0x4966fb;}}module[_0x3e10('0xc')][_0x3e10('0x1c')]=domCompare;function monthCompare(_0x504561,_0xb6ec66,_0x167dc1){var _0x462983=_0x504561['locale']('en')[_0x3e10('0x15')](_0x3e10('0x1d'))[_0x3e10('0x8')]();return circularMonthInterval(_0xb6ec66,_0x167dc1)[_0x3e10('0x16')](_0x462983);}module[_0x3e10('0xc')][_0x3e10('0x1e')]=monthCompare;function iftime(_0x3200ed,_0x31cb91=moment['tz']['guess'](),_0x24da3e=moment()){if(!validateRx['test'](_0x3200ed)){throw new Error(EINVALID_STRING);}else{var _0x19ff33=(moment[_0x3e10('0x1f')](_0x24da3e)?_0x24da3e[_0x3e10('0x10')]():moment(_0x24da3e))['tz'](_0x31cb91)[_0x3e10('0x6')]('en');throwIfDateNotValid(_0x19ff33);var _0xb6c5ff=_0x3200ed[_0x3e10('0x5')](',');var _0x2f6a22=_0xb6c5ff[0x0];var _0x340ad2=_0xb6c5ff[0x1];var _0x74a56b=_0xb6c5ff[0x2];var _0x27a150=_0xb6c5ff[0x3];let _0x46a077=!![];if(_0x2f6a22!=='*'){var _0x4e46c2=_0x2f6a22[_0x3e10('0x5')]('-');var _0x313513=_[_0x3e10('0x20')](_0x4e46c2[0x0],0x5,'0');var _0x47d329=_0x4e46c2[_0x3e10('0x21')]===0x2?_['padStart'](_0x4e46c2[0x1],0x5,'0'):_0x313513;_0x46a077=timeCompare(_0x19ff33,_0x313513,_0x47d329);}let _0x43357f=!![];if(_0x340ad2!=='*'){var _0x24637b=_0x340ad2[_0x3e10('0x5')]('-');var _0x5bf95c=_0x24637b[0x0];var _0x2589f7=_0x24637b['length']===0x2?_0x24637b[0x1]:_0x5bf95c;_0x43357f=dowCompare(_0x19ff33,_0x5bf95c,_0x2589f7);}let _0x2e1970=!![];if(_0x74a56b!=='*'){var _0x2498e9=_0x74a56b[_0x3e10('0x5')]('-');var _0xd0460c=parseDom(_0x2498e9[0x0]);var _0x157dee=_0x2498e9[_0x3e10('0x21')]===0x2?parseDom(_0x2498e9[0x1]):_0xd0460c;_0x2e1970=domCompare(_0x19ff33,_0xd0460c,_0x157dee);}let _0x5053e6=!![];if(_0x27a150!=='*'){var _0x20bbe1=_0x27a150['split']('-');var _0x5c4663=_0x20bbe1[0x0];var _0x64110c=_0x20bbe1['length']===0x2?_0x20bbe1[0x1]:_0x20bbe1[0x0];_0x5053e6=monthCompare(_0x19ff33,_0x5c4663,_0x64110c);}return _0x46a077&&_0x43357f&&_0x2e1970&&_0x5053e6;}}module[_0x3e10('0xc')][_0x3e10('0x22')]=iftime; \ No newline at end of file +var _0xa5af=['iftime','lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','isValid','locale','weekdaysShort','indexOf','slice','concat','exports','circularDoWInterval','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','daysInMonth','max','domCompare','MMM','includes','monthCompare','guess','isMoment','split','padStart','length'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0xa5af,0xf1));var _0xfa5a=function(_0x5ed547,_0x4d6d4f){_0x5ed547=_0x5ed547-0x0;var _0x5c373d=_0xa5af[_0x5ed547];return _0x5c373d;};var _=require(_0xfa5a('0x0'));var moment=require(_0xfa5a('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][_0xfa5a('0x2')](function(_0x5d7845){return _0x5d7845[_0xfa5a('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xfa5a('0x4');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x39f8a6){if(!_0x39f8a6[_0xfa5a('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x4f143b){var _0x4f3e3e=_0x4f143b['split'](':')['map'](function(_0x5293c6){return parseInt(_0x5293c6,0xa);});var _0x865e1b=_0x4f3e3e[0x0];var _0x502ba0=_0x4f3e3e[0x1];if(_0x865e1b<0x0||_0x865e1b>0x17||_0x502ba0<0x0||_0x502ba0>0x3b){throw new Error(EINVALID_DATE);}return[_0x865e1b,_0x502ba0];}function circularDoWInterval(_0x25ed24,_0xf6bc45){if(_0x25ed24===_0xf6bc45){return[_0x25ed24];}else{var _0x34e834=moment['locale']();moment[_0xfa5a('0x6')]('en');var _0x4338fa=moment[_0xfa5a('0x7')]()[_0xfa5a('0x2')](function(_0x3bfcd4){return _0x3bfcd4['toLowerCase']();});moment[_0xfa5a('0x6')](_0x34e834);var _0x4a082e=_0x4338fa[_0xfa5a('0x8')](_0x25ed24);var _0x155219=_0x4338fa[_0xfa5a('0x8')](_0xf6bc45);if(_0x155219>_0x4a082e){return _0x4338fa[_0xfa5a('0x9')](_0x4a082e,_0x155219+0x1);}else{var _0x39ff7a=_0x4338fa['slice'](0x0,_0x155219+0x1);var _0x363b2c=_0x4338fa[_0xfa5a('0x9')](_0x4a082e);return _0x363b2c[_0xfa5a('0xa')](_0x39ff7a);}}}module[_0xfa5a('0xb')][_0xfa5a('0xc')]=circularDoWInterval;function circularMonthInterval(_0x1ed50b,_0x1160be){if(_0x1ed50b===_0x1160be){return[_0x1ed50b];}else{var _0x212705=moment[_0xfa5a('0x6')]();moment[_0xfa5a('0x6')]('en');var _0x775a8f=moment['monthsShort']()['map'](function(_0x3f45ff){return _0x3f45ff[_0xfa5a('0xd')]();});moment[_0xfa5a('0x6')](_0x212705);var _0x1ae7c0=_0x775a8f[_0xfa5a('0x8')](_0x1ed50b);var _0x10f628=_0x775a8f['indexOf'](_0x1160be);if(_0x10f628>_0x1ae7c0){return _0x775a8f['slice'](_0x1ae7c0,_0x10f628+0x1);}else{var _0x3187fc=_0x775a8f['slice'](0x0,_0x10f628+0x1);var _0x95ff=_0x775a8f[_0xfa5a('0x9')](_0x1ae7c0);return _0x95ff[_0xfa5a('0xa')](_0x3187fc);}}}module[_0xfa5a('0xb')][_0xfa5a('0xe')]=circularMonthInterval;function parseDom(_0x4886f0){var _0x355cfd=parseInt(_0x4886f0,0xa);if(_0x355cfd<0x1||_0x355cfd>0x1f){throw new Error(EINVALID_DATE);}return _0x355cfd;}function timeCompare(_0x26ba3d,_0x3d0e7b,_0x3b4338){var _0x349639=_0x26ba3d['clone']();var _0x575d9a=extractTime(_0x3d0e7b);var _0x32305f=_0x575d9a[0x0];var _0x2c791e=_0x575d9a[0x1];var _0x24d046=_0x26ba3d[_0xfa5a('0xf')]()['hours'](_0x32305f)['minutes'](_0x2c791e);throwIfDateNotValid(_0x24d046);var _0x331542=extractTime(_0x3b4338);var _0x5764dc=_0x331542[0x0];var _0x43b52e=_0x331542[0x1];var _0x579e49=_0x26ba3d['clone']()[_0xfa5a('0x10')](_0x5764dc)[_0xfa5a('0x11')](_0x43b52e);throwIfDateNotValid(_0x579e49);if(_0x579e49[_0xfa5a('0x12')](_0x24d046)){var _0x1c604a=_0x349639[_0xfa5a('0xf')]()[_0xfa5a('0x13')](_0xfa5a('0x14'));var _0x4326fb=_0x349639[_0xfa5a('0xf')]()[_0xfa5a('0x15')](_0xfa5a('0x14'));return _0x349639['isBetween'](_0x24d046,_0x4326fb,undefined,'[]')||_0x349639['isBetween'](_0x1c604a,_0x579e49,undefined,'[]');}else{return _0x349639[_0xfa5a('0x16')](_0x24d046,_0x579e49,undefined,'[]');}}module['exports'][_0xfa5a('0x17')]=timeCompare;function dowCompare(_0x5da533,_0x2d1722,_0x1f8a65){var _0x532760=_0x5da533[_0xfa5a('0x6')]('en')[_0xfa5a('0x18')](_0xfa5a('0x19'))[_0xfa5a('0xd')]();return circularDoWInterval(_0x2d1722,_0x1f8a65)['includes'](_0x532760);}module[_0xfa5a('0xb')][_0xfa5a('0x1a')]=dowCompare;function domCompare(_0x398cd2,_0x47043b,_0x392fb6){var _0xf1630d=_0x398cd2[_0xfa5a('0x1b')]();if(_0x47043b===_0x392fb6){return _0xf1630d===_0x47043b;}else{var _0x500b0f=_0x398cd2[_0xfa5a('0x1c')]();var _0x317d21=_0x47043b<_0x392fb6;let _0x5eb074=![];var _0x54f3b9=0x0;var _0x32bd5d=0x0;if(_0x317d21){_0x54f3b9=Math[_0xfa5a('0x1d')](0x1,_0x47043b);_0x32bd5d=Math['min'](_0x392fb6,_0x500b0f);_0x5eb074=_0xf1630d>=_0x54f3b9&&_0xf1630d<=_0x32bd5d;}else{_0x54f3b9=Math['min'](_0x47043b,_0x500b0f);_0x32bd5d=Math[_0xfa5a('0x1d')](0x1,_0x392fb6);_0x5eb074=_0xf1630d>=_0x54f3b9||_0xf1630d<=_0x32bd5d;}return _0x5eb074;}}module[_0xfa5a('0xb')][_0xfa5a('0x1e')]=domCompare;function monthCompare(_0x2124f7,_0x3fac80,_0x563dc6){var _0x41eeab=_0x2124f7[_0xfa5a('0x6')]('en')['format'](_0xfa5a('0x1f'))[_0xfa5a('0xd')]();return circularMonthInterval(_0x3fac80,_0x563dc6)[_0xfa5a('0x20')](_0x41eeab);}module[_0xfa5a('0xb')][_0xfa5a('0x21')]=monthCompare;function iftime(_0x30cd42,_0x3d56e9=moment['tz'][_0xfa5a('0x22')](),_0x544a7a=moment()){if(!validateRx['test'](_0x30cd42)){throw new Error(EINVALID_STRING);}else{var _0x374226=(moment[_0xfa5a('0x23')](_0x544a7a)?_0x544a7a[_0xfa5a('0xf')]():moment(_0x544a7a))['tz'](_0x3d56e9)[_0xfa5a('0x6')]('en');throwIfDateNotValid(_0x374226);var _0x412700=_0x30cd42['split'](',');var _0x1bf9be=_0x412700[0x0];var _0x43c064=_0x412700[0x1];var _0x249e90=_0x412700[0x2];var _0x52f39c=_0x412700[0x3];let _0x435c7e=!![];if(_0x1bf9be!=='*'){var _0x572d5d=_0x1bf9be[_0xfa5a('0x24')]('-');var _0x498e97=_[_0xfa5a('0x25')](_0x572d5d[0x0],0x5,'0');var _0x3b91bb=_0x572d5d[_0xfa5a('0x26')]===0x2?_['padStart'](_0x572d5d[0x1],0x5,'0'):_0x498e97;_0x435c7e=timeCompare(_0x374226,_0x498e97,_0x3b91bb);}let _0x34c717=!![];if(_0x43c064!=='*'){var _0x12b7ea=_0x43c064[_0xfa5a('0x24')]('-');var _0x54cccb=_0x12b7ea[0x0];var _0x34d017=_0x12b7ea[_0xfa5a('0x26')]===0x2?_0x12b7ea[0x1]:_0x54cccb;_0x34c717=dowCompare(_0x374226,_0x54cccb,_0x34d017);}let _0x2bf94a=!![];if(_0x249e90!=='*'){var _0x4661a6=_0x249e90[_0xfa5a('0x24')]('-');var _0x4398db=parseDom(_0x4661a6[0x0]);var _0x24aa64=_0x4661a6[_0xfa5a('0x26')]===0x2?parseDom(_0x4661a6[0x1]):_0x4398db;_0x2bf94a=domCompare(_0x374226,_0x4398db,_0x24aa64);}let _0x1ec006=!![];if(_0x52f39c!=='*'){var _0x45f646=_0x52f39c[_0xfa5a('0x24')]('-');var _0x1f1d40=_0x45f646[0x0];var _0xc255ee=_0x45f646[_0xfa5a('0x26')]===0x2?_0x45f646[0x1]:_0x45f646[0x0];_0x1ec006=monthCompare(_0x374226,_0x1f1d40,_0xc255ee);}return _0x435c7e&&_0x34c717&&_0x2bf94a&&_0x1ec006;}}module['exports'][_0xfa5a('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 63df2ce..c341138 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf192=['Logger','File','%s-%s','error','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','length','stringify','transports','Console','warn'];(function(_0x57b4ff,_0x3f3be0){var _0x28642e=function(_0x9a5198){while(--_0x9a5198){_0x57b4ff['push'](_0x57b4ff['shift']());}};_0x28642e(++_0x3f3be0);}(_0xf192,0x102));var _0x2f19=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf192[_0x3ab51d];return _0x29a04e;};'use strict';var path=require(_0x2f19('0x0'));var util=require(_0x2f19('0x1'));var moment=require(_0x2f19('0x2'));var winston=require(_0x2f19('0x3'));var config=require(_0x2f19('0x4'));var debugLevel=config[_0x2f19('0x5')]?config[_0x2f19('0x5')][_0x2f19('0x6')]():_0x2f19('0x7');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2f19('0x8'),'error':'red','warn':_0x2f19('0x9'),'info':'white','print':_0x2f19('0xa'),'success':_0x2f19('0xb'),'http':_0x2f19('0xc'),'verbose':_0x2f19('0xd'),'debug':_0x2f19('0xe'),'silly':_0x2f19('0xf')};winston[_0x2f19('0x10')](XC_LOG_COLORS);function getLogFileName(_0x40aaee,_0x816319,_0x13a628){var _0x1a9143=_0x40aaee||_0x2f19('0x11');return path[_0x2f19('0x12')](_0x1a9143,util['format'](_0x2f19('0x13'),_0x816319,_0x13a628));}function formatter(_0x2725f2,_0x5c5fb2){_0x5c5fb2[_0x2f19('0x14')]=_0x5c5fb2[_0x2f19('0x14')][_0x2f19('0x15')](/@@{/g,'{{{')[_0x2f19('0x15')](/}@@/g,_0x2f19('0x16'))['replace'](/@{/g,'{{')[_0x2f19('0x15')](/}@/g,'}}');return util[_0x2f19('0x17')](_0x2f19('0x18'),moment()[_0x2f19('0x17')](_0x2f19('0x19')),_0x5c5fb2[_0x2f19('0x1a')][_0x2f19('0x1b')](),_0x2725f2,_0x5c5fb2['message']);}function fileFormat(_0x410b17,_0x1c3f66){_0x1c3f66['message']=_0x1c3f66[_0x2f19('0x14')][_0x2f19('0x15')](/@@{/g,_0x2f19('0x1c'))[_0x2f19('0x15')](/}@@/g,_0x2f19('0x16'))[_0x2f19('0x15')](/@{/g,'{{')[_0x2f19('0x15')](/}@/g,'}}');var _0xf6883f=_0x1c3f66[_0x2f19('0x1d')]&&Object[_0x2f19('0x1e')](_0x1c3f66[_0x2f19('0x1d')])[_0x2f19('0x1f')]?'\x0a\x09'+JSON[_0x2f19('0x20')](_0x1c3f66[_0x2f19('0x1d')]):'';return util[_0x2f19('0x17')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2f19('0x17')](_0x2f19('0x19')),_0x1c3f66[_0x2f19('0x1a')]['toUpperCase'](),_0x410b17,_0x1c3f66['message'],_0xf6883f);}function consoleLogger(){var _0x4588bf=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2f19('0x21'))][(_0x2f19('0x22'))]({'level':_0x2f19('0x23'),'json':![],'formatter':function(_0x540bf2){return formatter('',_0x540bf2);}})]});return _0x4588bf;}function fileLogger(_0x3a2f80,_0x4a40f5){var _0x17cb84=new winston[(_0x2f19('0x24'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2f19('0x21'))][(_0x2f19('0x25'))]({'name':util[_0x2f19('0x17')](_0x2f19('0x26'),_0x3a2f80,_0x2f19('0x27')),'filename':getLogFileName(_0x4a40f5,_0x3a2f80,_0x2f19('0x27')),'level':_0x2f19('0x27'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x35aeed){return fileFormat(_0x3a2f80,_0x35aeed);}}),new winston[(_0x2f19('0x21'))][(_0x2f19('0x25'))]({'name':util[_0x2f19('0x17')](_0x2f19('0x26'),_0x3a2f80,debugLevel),'filename':getLogFileName(_0x4a40f5,_0x3a2f80,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d0c71){return fileFormat(_0x3a2f80,_0x5d0c71);}}),new winston[(_0x2f19('0x21'))][(_0x2f19('0x22'))]({'level':_0x2f19('0x23'),'json':![],'formatter':function(_0x9242a7){return fileFormat(_0x3a2f80,_0x9242a7);}})]});return _0x17cb84;}exports[_0x2f19('0x28')]=consoleLogger;exports[_0x2f19('0x29')]=fileLogger; \ No newline at end of file +var _0x2f48=['bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','format','message','replace','{{{','}}}','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','Console','warn','File','error','transports','consoleLogger','path','moment','winston','../config/environment','debugLevel','redBG\x20white','red','bold\x20yellow','white','gray'];(function(_0x432e30,_0x459f2e){var _0xb5ac70=function(_0x31e7e3){while(--_0x31e7e3){_0x432e30['push'](_0x432e30['shift']());}};_0xb5ac70(++_0x459f2e);}(_0x2f48,0x154));var _0x82f4=function(_0x4c2960,_0x17c000){_0x4c2960=_0x4c2960-0x0;var _0x3c2150=_0x2f48[_0x4c2960];return _0x3c2150;};'use strict';var path=require(_0x82f4('0x0'));var util=require('util');var moment=require(_0x82f4('0x1'));var winston=require(_0x82f4('0x2'));var config=require(_0x82f4('0x3'));var debugLevel=config[_0x82f4('0x4')]?config[_0x82f4('0x4')]['toLowerCase']():'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':_0x82f4('0x5'),'error':_0x82f4('0x6'),'warn':_0x82f4('0x7'),'info':_0x82f4('0x8'),'print':'bold\x20white','success':'bold\x20green','http':_0x82f4('0x9'),'verbose':_0x82f4('0xa'),'debug':_0x82f4('0xb'),'silly':_0x82f4('0xc')};winston[_0x82f4('0xd')](XC_LOG_COLORS);function getLogFileName(_0x94062f,_0x4b8d26,_0x25227e){var _0x35f857=_0x94062f||'/var/log/xcally';return path[_0x82f4('0xe')](_0x35f857,util[_0x82f4('0xf')]('%s-%s.log',_0x4b8d26,_0x25227e));}function formatter(_0x1b22fe,_0x40ed14){_0x40ed14[_0x82f4('0x10')]=_0x40ed14['message'][_0x82f4('0x11')](/@@{/g,_0x82f4('0x12'))[_0x82f4('0x11')](/}@@/g,_0x82f4('0x13'))[_0x82f4('0x11')](/@{/g,'{{')[_0x82f4('0x11')](/}@/g,'}}');return util[_0x82f4('0xf')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x82f4('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0x40ed14[_0x82f4('0x14')][_0x82f4('0x15')](),_0x1b22fe,_0x40ed14[_0x82f4('0x10')]);}function fileFormat(_0x50bc4b,_0x1d28c1){_0x1d28c1[_0x82f4('0x10')]=_0x1d28c1['message'][_0x82f4('0x11')](/@@{/g,_0x82f4('0x12'))['replace'](/}@@/g,_0x82f4('0x13'))[_0x82f4('0x11')](/@{/g,'{{')[_0x82f4('0x11')](/}@/g,'}}');var _0x472a71=_0x1d28c1[_0x82f4('0x16')]&&Object[_0x82f4('0x17')](_0x1d28c1[_0x82f4('0x16')])[_0x82f4('0x18')]?'\x0a\x09'+JSON[_0x82f4('0x19')](_0x1d28c1[_0x82f4('0x16')]):'';return util[_0x82f4('0xf')](_0x82f4('0x1a'),moment()[_0x82f4('0xf')](_0x82f4('0x1b')),_0x1d28c1[_0x82f4('0x14')][_0x82f4('0x15')](),_0x50bc4b,_0x1d28c1['message'],_0x472a71);}function consoleLogger(){var _0x3fce76=new winston[(_0x82f4('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x82f4('0x1d'))]({'level':_0x82f4('0x1e'),'json':![],'formatter':function(_0x29ef52){return formatter('',_0x29ef52);}})]});return _0x3fce76;}function fileLogger(_0x2d4adb,_0xfa2404){var _0x204cca=new winston[(_0x82f4('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x82f4('0x1f'))]({'name':util[_0x82f4('0xf')]('%s-%s',_0x2d4adb,'error'),'filename':getLogFileName(_0xfa2404,_0x2d4adb,'error'),'level':_0x82f4('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x54c0f8){return fileFormat(_0x2d4adb,_0x54c0f8);}}),new winston[(_0x82f4('0x21'))]['File']({'name':util['format']('%s-%s',_0x2d4adb,debugLevel),'filename':getLogFileName(_0xfa2404,_0x2d4adb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x404a08){return fileFormat(_0x2d4adb,_0x404a08);}}),new winston['transports'][(_0x82f4('0x1d'))]({'level':_0x82f4('0x1e'),'json':![],'formatter':function(_0x2f5b1c){return fileFormat(_0x2d4adb,_0x2f5b1c);}})]});return _0x204cca;}exports[_0x82f4('0x22')]=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 a716bf1..452f65f 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0x0295,0x1f0));var _0x5029=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0x0295[_0x5cfa35];return _0xf7dffb;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _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(_0x5c150c,_0x27dee0){var _0x514d69=function(_0x2d8516){while(--_0x2d8516){_0x5c150c['push'](_0x5c150c['shift']());}};_0x514d69(++_0x27dee0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x0b0e[_0x166e96];return _0x553d73;};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 diff --git a/server/utils/misc.js b/server/utils/misc.js index 26dd293..b344a4f 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['exports','replace','\x5c$&'];(function(_0x4f272c,_0x431618){var _0x1cc959=function(_0x173c46){while(--_0x173c46){_0x4f272c['push'](_0x4f272c['shift']());}};_0x1cc959(++_0x431618);}(_0x53ec,0x192));var _0xc53e=function(_0x354b70,_0x2ee366){_0x354b70=_0x354b70-0x0;var _0x56a7e8=_0x53ec[_0x354b70];return _0x56a7e8;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file +var _0x5fab=['exports','replace','\x5c$&'];(function(_0x708c47,_0x6eaa1f){var _0x52a470=function(_0x14a750){while(--_0x14a750){_0x708c47['push'](_0x708c47['shift']());}};_0x52a470(++_0x6eaa1f);}(_0x5fab,0x177));var _0xb5fa=function(_0x96be88,_0x2c01a4){_0x96be88=_0x96be88-0x0;var _0x1c14c0=_0x5fab[_0x96be88];return _0x1c14c0;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index c176726..be09b84 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 _0x5c00=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','{\x20{\x20','string'];(function(_0x4ca957,_0x468c7a){var _0x387074=function(_0x296439){while(--_0x296439){_0x4ca957['push'](_0x4ca957['shift']());}};_0x387074(++_0x468c7a);}(_0x5c00,0x17e));var _0x05c0=function(_0x29bfbe,_0x37060a){_0x29bfbe=_0x29bfbe-0x0;var _0x230663=_0x5c00[_0x29bfbe];return _0x230663;};var _=require(_0x05c0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x7f1364){return _0x7f1364==='{{'?_0x05c0('0x1'):'\x20}\x20}';}function safeTemplate(_0x1e76da){var _0x5859bc=_0x1e76da;if(typeof _0x1e76da===_0x05c0('0x2')){_0x5859bc=_0x1e76da[_0x05c0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x05c0('0x4')](_0x1e76da)){_0x5859bc=_0x1e76da[_0x05c0('0x5')](function(_0x565efc){return safeTemplate(_0x565efc);});}else if(_[_0x05c0('0x6')](_0x1e76da)){_0x5859bc=Object[_0x05c0('0x7')](_0x1e76da)[_0x05c0('0x8')](function(_0x27dc10,_0x5b9f09){_0x27dc10[_0x5b9f09]=safeTemplate(_0x1e76da[_0x5b9f09]);return _0x27dc10;},{});}return _0x5859bc;}module[_0x05c0('0x9')][_0x05c0('0xa')]=safeTemplate; \ No newline at end of file +var _0xf7b4=['replace','isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','lodash','\x20}\x20}'];(function(_0x1db3b4,_0x1e2c29){var _0x2cbd6a=function(_0x4a431a){while(--_0x4a431a){_0x1db3b4['push'](_0x1db3b4['shift']());}};_0x2cbd6a(++_0x1e2c29);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5e08be,_0x9bf344){_0x5e08be=_0x5e08be-0x0;var _0x4db79e=_0xf7b4[_0x5e08be];return _0x4db79e;};var _=require(_0x4f7b('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x5579ed){return _0x5579ed==='{{'?'{\x20{\x20':_0x4f7b('0x1');}function safeTemplate(_0x103165){var _0x50ea23=_0x103165;if(typeof _0x103165==='string'){_0x50ea23=_0x103165[_0x4f7b('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4f7b('0x3')](_0x103165)){_0x50ea23=_0x103165[_0x4f7b('0x4')](function(_0x44f991){return safeTemplate(_0x44f991);});}else if(_[_0x4f7b('0x5')](_0x103165)){_0x50ea23=Object[_0x4f7b('0x6')](_0x103165)[_0x4f7b('0x7')](function(_0x3ad135,_0x173784){_0x3ad135[_0x173784]=safeTemplate(_0x103165[_0x173784]);return _0x3ad135;},{});}return _0x50ea23;}module[_0x4f7b('0x8')][_0x4f7b('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 7c209fa..1c0b622 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 _0x049c=['legacy-libs','apps','findIndex','name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','../config/environment','root','resolve','server/app.json'];(function(_0x1d0553,_0x3fa211){var _0x2360e1=function(_0x2fb294){while(--_0x2fb294){_0x1d0553['push'](_0x1d0553['shift']());}};_0x2360e1(++_0x3fa211);}(_0x049c,0x9b));var _0xc049=function(_0x2d7b2e,_0x32f225){_0x2d7b2e=_0x2d7b2e-0x0;var _0x3d538b=_0x049c[_0x2d7b2e];return _0x3d538b;};var fs=require(_0xc049('0x0'));var path=require('path');var config=require(_0xc049('0x1'));var root=config[_0xc049('0x2')];var APP_JSON_PATH=path[_0xc049('0x3')](root,_0xc049('0x4'));var NODEPATH=path[_0xc049('0x3')](root,_0xc049('0x5'));function setLegacyLibsNodeEnvPath(_0x3efae6){let _0x3b3b77=![];if(Array['isArray'](_0x3efae6['apps'])){var _0x28f476=_0x3efae6[_0xc049('0x6')][_0xc049('0x7')](function(_0x4cb66b){return _0x4cb66b[_0xc049('0x8')]===_0xc049('0x9');});if(_0x28f476>-0x1){var _0xbd213a=_0x3efae6[_0xc049('0x6')][_0x28f476];if(typeof _0xbd213a[_0xc049('0xa')][_0xc049('0xb')]!==_0xc049('0xc')){_0xbd213a[_0xc049('0xa')][_0xc049('0xb')]=NODEPATH;_0x3b3b77=!![];}}return{'appConfig':_0x3efae6,'updated':_0x3b3b77};}}function updateAppConfig(_0x504929){return fs[_0xc049('0xd')](APP_JSON_PATH)[_0xc049('0xe')](function(_0x59b80f){if(_0x59b80f){return fs[_0xc049('0xf')](APP_JSON_PATH)[_0xc049('0xe')](function(_0x3713ae){var _0x3c0eab=setLegacyLibsNodeEnvPath(_0x3713ae);if(_0x3c0eab['updated']){_0x504929[_0xc049('0x10')](_0xc049('0x11'));return fs[_0xc049('0x12')](APP_JSON_PATH,_0x3713ae,{'spaces':0x2});}else{return Promise[_0xc049('0x3')]();}});}else{return Promise['resolve']();}});}module[_0xc049('0x13')]=updateAppConfig; \ No newline at end of file +var _0x1eee=['then','updated','Updating\x20app.json','writeJSON','exports','fs-extra','path','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env','NODE_PATH','readJSON'];(function(_0x587a26,_0x219122){var _0x347dc0=function(_0x5a06d4){while(--_0x5a06d4){_0x587a26['push'](_0x587a26['shift']());}};_0x347dc0(++_0x219122);}(_0x1eee,0x7c));var _0xe1ee=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x1eee[_0x3df223];return _0x562d11;};var fs=require(_0xe1ee('0x0'));var path=require(_0xe1ee('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path[_0xe1ee('0x2')](root,_0xe1ee('0x3'));var NODEPATH=path[_0xe1ee('0x2')](root,_0xe1ee('0x4'));function setLegacyLibsNodeEnvPath(_0x59fcbb){let _0x37704d=![];if(Array[_0xe1ee('0x5')](_0x59fcbb[_0xe1ee('0x6')])){var _0x22f60d=_0x59fcbb[_0xe1ee('0x6')][_0xe1ee('0x7')](function(_0xb2e467){return _0xb2e467[_0xe1ee('0x8')]==='motion2';});if(_0x22f60d>-0x1){var _0x5a15c0=_0x59fcbb['apps'][_0x22f60d];if(typeof _0x5a15c0[_0xe1ee('0x9')][_0xe1ee('0xa')]!=='string'){_0x5a15c0[_0xe1ee('0x9')]['NODE_PATH']=NODEPATH;_0x37704d=!![];}}return{'appConfig':_0x59fcbb,'updated':_0x37704d};}}function updateAppConfig(_0x29347d){return fs['pathExists'](APP_JSON_PATH)['then'](function(_0x12aca3){if(_0x12aca3){return fs[_0xe1ee('0xb')](APP_JSON_PATH)[_0xe1ee('0xc')](function(_0x48efda){var _0x4cf610=setLegacyLibsNodeEnvPath(_0x48efda);if(_0x4cf610[_0xe1ee('0xd')]){_0x29347d['info'](_0xe1ee('0xe'));return fs[_0xe1ee('0xf')](APP_JSON_PATH,_0x48efda,{'spaces':0x2});}else{return Promise[_0xe1ee('0x2')]();}});}else{return Promise[_0xe1ee('0x2')]();}});}module[_0xe1ee('0x10')]=updateAppConfig; \ No newline at end of file